From 1f1c7b7b5673fac3d3d38a1291ed1171f6cdc3eb Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 13 Jan 2025 03:52:37 -0500 Subject: [PATCH 001/478] Remove useless code. --- comfy/ldm/cosmos/cosmos_tokenizer/utils.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/comfy/ldm/cosmos/cosmos_tokenizer/utils.py b/comfy/ldm/cosmos/cosmos_tokenizer/utils.py index 64dd5e288..3af8d0d05 100644 --- a/comfy/ldm/cosmos/cosmos_tokenizer/utils.py +++ b/comfy/ldm/cosmos/cosmos_tokenizer/utils.py @@ -17,7 +17,7 @@ from typing import Any import torch -from einops import pack, rearrange, unpack +from einops import rearrange import comfy.ops @@ -98,14 +98,6 @@ def default(*args): return None -def pack_one(t, pattern): - return pack([t], pattern) - - -def unpack_one(t, ps, pattern): - return unpack(t, ps, pattern)[0] - - def round_ste(z: torch.Tensor) -> torch.Tensor: """Round with straight through gradients.""" zhat = z.round() From 3aaabb12d422eb35cd0314a09582c0a47d505a37 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 14 Jan 2025 05:14:10 -0500 Subject: [PATCH 002/478] Implement Cosmos Image/Video to World (Video) diffusion models. Use CosmosImageToVideoLatent to set the input image/video. --- comfy/model_base.py | 29 ++++++++++++++++++++---- comfy/model_detection.py | 5 ++-- comfy/samplers.py | 2 +- comfy/sd.py | 2 +- comfy/supported_models.py | 14 ++++++++++-- comfy_extras/nodes_cosmos.py | 44 +++++++++++++++++++++++++++++++++++- 6 files changed, 84 insertions(+), 12 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index a67504cbb..7625b7126 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -189,9 +189,10 @@ class BaseModel(torch.nn.Module): if denoise_mask is not None: if len(denoise_mask.shape) == len(noise.shape): - denoise_mask = denoise_mask[:,:1] + denoise_mask = denoise_mask[:, :1] - denoise_mask = denoise_mask.reshape((-1, 1, denoise_mask.shape[-2], denoise_mask.shape[-1])) + num_dim = noise.ndim - 2 + denoise_mask = denoise_mask.reshape((-1, 1) + tuple(denoise_mask.shape[-num_dim:])) if denoise_mask.shape[-2:] != noise.shape[-2:]: denoise_mask = utils.common_upscale(denoise_mask, noise.shape[-1], noise.shape[-2], "bilinear", "center") denoise_mask = utils.resize_to_batch_size(denoise_mask.round(), noise.shape[0]) @@ -201,12 +202,16 @@ class BaseModel(torch.nn.Module): if ck == "mask": cond_concat.append(denoise_mask.to(device)) elif ck == "masked_image": - cond_concat.append(concat_latent_image.to(device)) #NOTE: the latent_image should be masked by the mask in pixel space + cond_concat.append(concat_latent_image.to(device)) # NOTE: the latent_image should be masked by the mask in pixel space + elif ck == "mask_inverted": + cond_concat.append(1.0 - denoise_mask.to(device)) else: if ck == "mask": - cond_concat.append(torch.ones_like(noise)[:,:1]) + cond_concat.append(torch.ones_like(noise)[:, :1]) elif ck == "masked_image": cond_concat.append(self.blank_inpaint_image_like(noise)) + elif ck == "mask_inverted": + cond_concat.append(torch.zeros_like(noise)[:, :1]) data = torch.cat(cond_concat, dim=1) return data return None @@ -294,6 +299,9 @@ class BaseModel(torch.nn.Module): return blank_image self.blank_inpaint_image_like = blank_inpaint_image_like + def scale_latent_inpaint(self, sigma, noise, latent_image, **kwargs): + return self.model_sampling.noise_scaling(sigma.reshape([sigma.shape[0]] + [1] * (len(noise.shape) - 1)), noise, latent_image) + def memory_required(self, input_shape): if comfy.model_management.xformers_enabled() or comfy.model_management.pytorch_attention_flash_attention(): dtype = self.get_dtype() @@ -859,8 +867,11 @@ class HunyuanVideo(BaseModel): return out class CosmosVideo(BaseModel): - def __init__(self, model_config, model_type=ModelType.EDM, device=None): + def __init__(self, model_config, model_type=ModelType.EDM, image_to_video=False, device=None): super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.cosmos.model.GeneralDIT) + self.image_to_video = image_to_video + if self.image_to_video: + self.concat_keys = ("mask_inverted",) def extra_conds(self, **kwargs): out = super().extra_conds(**kwargs) @@ -873,3 +884,11 @@ class CosmosVideo(BaseModel): out['fps'] = comfy.conds.CONDConstant(kwargs.get("frame_rate", None)) return out + + def scale_latent_inpaint(self, sigma, noise, latent_image, **kwargs): + sigma = sigma.reshape([sigma.shape[0]] + [1] * (len(noise.shape) - 1)) + sigma_noise_augmentation = 0 #TODO + if sigma_noise_augmentation != 0: + latent_image = latent_image + noise + latent_image = self.model_sampling.calculate_input(torch.tensor([sigma_noise_augmentation], device=latent_image.device, dtype=latent_image.dtype), latent_image) + return latent_image * ((sigma ** 2 + self.model_sampling.sigma_data ** 2) ** 0.5) diff --git a/comfy/model_detection.py b/comfy/model_detection.py index 20cd6bb86..ba96ebe85 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -245,13 +245,14 @@ def detect_unet_config(state_dict, key_prefix): dit_config["max_img_h"] = 240 dit_config["max_img_w"] = 240 dit_config["max_frames"] = 128 - dit_config["in_channels"] = 16 + concat_padding_mask = True + dit_config["in_channels"] = (state_dict['{}x_embedder.proj.1.weight'.format(key_prefix)].shape[1] // 4) - int(concat_padding_mask) dit_config["out_channels"] = 16 dit_config["patch_spatial"] = 2 dit_config["patch_temporal"] = 1 dit_config["model_channels"] = state_dict['{}blocks.block0.blocks.0.block.attn.to_q.0.weight'.format(key_prefix)].shape[0] dit_config["block_config"] = "FA-CA-MLP" - dit_config["concat_padding_mask"] = True + dit_config["concat_padding_mask"] = concat_padding_mask dit_config["pos_emb_cls"] = "rope3d" dit_config["pos_emb_learnable"] = False dit_config["pos_emb_interpolation"] = "crop" diff --git a/comfy/samplers.py b/comfy/samplers.py index fa176c6de..8f25935d7 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -376,7 +376,7 @@ class KSamplerX0Inpaint: if "denoise_mask_function" in model_options: denoise_mask = model_options["denoise_mask_function"](sigma, denoise_mask, extra_options={"model": self.inner_model, "sigmas": self.sigmas}) latent_mask = 1. - denoise_mask - x = x * denoise_mask + self.inner_model.inner_model.model_sampling.noise_scaling(sigma.reshape([sigma.shape[0]] + [1] * (len(self.noise.shape) - 1)), self.noise, self.latent_image) * latent_mask + x = x * denoise_mask + self.inner_model.inner_model.scale_latent_inpaint(x=x, sigma=sigma, noise=self.noise, latent_image=self.latent_image) * latent_mask out = self.inner_model(x, sigma, model_options=model_options, seed=seed) if denoise_mask is not None: out = out * denoise_mask + self.latent_image * latent_mask diff --git a/comfy/sd.py b/comfy/sd.py index 7db1c2d60..6ba6af474 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -534,7 +534,7 @@ class VAE: def encode(self, pixel_samples): pixel_samples = self.vae_encode_crop_pixels(pixel_samples) pixel_samples = pixel_samples.movedim(-1, 1) - if self.latent_dim == 3: + if self.latent_dim == 3 and pixel_samples.ndim < 5: pixel_samples = pixel_samples.movedim(1, 0).unsqueeze(0) try: memory_used = self.memory_used_encode(pixel_samples.shape, self.vae_dtype) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 31de1ae9e..ff3f14329 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -824,9 +824,10 @@ class HunyuanVideo(supported_models_base.BASE): hunyuan_detect = comfy.text_encoders.hunyuan_video.llama_detect(state_dict, "{}llama.transformer.".format(pref)) return supported_models_base.ClipTarget(comfy.text_encoders.hunyuan_video.HunyuanVideoTokenizer, comfy.text_encoders.hunyuan_video.hunyuan_video_clip(**hunyuan_detect)) -class Cosmos(supported_models_base.BASE): +class CosmosT2V(supported_models_base.BASE): unet_config = { "image_model": "cosmos", + "in_channels": 16, } sampling_settings = { @@ -854,7 +855,16 @@ class Cosmos(supported_models_base.BASE): t5_detect = comfy.text_encoders.sd3_clip.t5_xxl_detect(state_dict, "{}t5xxl.transformer.".format(pref)) return supported_models_base.ClipTarget(comfy.text_encoders.cosmos.CosmosT5Tokenizer, comfy.text_encoders.cosmos.te(**t5_detect)) +class CosmosI2V(CosmosT2V): + unet_config = { + "image_model": "cosmos", + "in_channels": 17, + } -models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideo, Cosmos] + def get_model(self, state_dict, prefix="", device=None): + out = model_base.CosmosVideo(self, image_to_video=True, device=device) + return out + +models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideo, CosmosT2V, CosmosI2V] models += [SVD_img2vid] diff --git a/comfy_extras/nodes_cosmos.py b/comfy_extras/nodes_cosmos.py index d88773e25..5fbabb9a7 100644 --- a/comfy_extras/nodes_cosmos.py +++ b/comfy_extras/nodes_cosmos.py @@ -1,6 +1,8 @@ import nodes import torch import comfy.model_management +import comfy.utils + class EmptyCosmosLatentVideo: @classmethod @@ -16,8 +18,48 @@ class EmptyCosmosLatentVideo: def generate(self, width, height, length, batch_size=1): latent = torch.zeros([batch_size, 16, ((length - 1) // 8) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) - return ({"samples":latent}, ) + return ({"samples": latent}, ) + + +class CosmosImageToVideoLatent: + @classmethod + def INPUT_TYPES(s): + return {"required": {"vae": ("VAE", ), + "image": ("IMAGE", ), + "width": ("INT", {"default": 1280, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "height": ("INT", {"default": 704, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "length": ("INT", {"default": 121, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 8}), + "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), + }} + + RETURN_TYPES = ("LATENT",) + FUNCTION = "encode" + + CATEGORY = "conditioning/inpaint" + + def encode(self, vae, image, width, height, length, batch_size): + pixels = comfy.utils.common_upscale(image[..., :3].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + pixel_len = min(pixels.shape[0], length) + padded_length = min(length, (((pixel_len - 1) // 8) + 2) * 8 - 7) + padded_pixels = torch.ones((padded_length, height, width, 3)) * 0.5 + padded_pixels[:pixel_len] = pixels[:pixel_len] + + latent_temp = vae.encode(padded_pixels) + + latent = torch.zeros([1, latent_temp.shape[1], ((length - 1) // 8) + 1, latent_temp.shape[-2], latent_temp.shape[-1]], device=comfy.model_management.intermediate_device()) + latent_len = ((pixel_len - 1) // 8) + 1 + latent[:, :, :latent_len] = latent_temp[:, :, :latent_len] + + mask = torch.ones([latent.shape[0], 1, ((length - 1) // 8) + 1, latent.shape[-2], latent.shape[-1]], device=comfy.model_management.intermediate_device()) + mask[:, :, :latent_len] *= 0.0 + + out_latent = {} + out_latent["samples"] = latent + out_latent["noise_mask"] = mask + return (out_latent,) + NODE_CLASS_MAPPINGS = { "EmptyCosmosLatentVideo": EmptyCosmosLatentVideo, + "CosmosImageToVideoLatent": CosmosImageToVideoLatent, } From c78a45685d2664e03927b8b57bc2f950c47d6ad3 Mon Sep 17 00:00:00 2001 From: Pam <42671363+pamparamm@users.noreply.github.com> Date: Wed, 15 Jan 2025 04:20:06 +0500 Subject: [PATCH 003/478] Rewrite res_multistep sampler and implement res_multistep_cfg_pp sampler. (#6462) --- comfy/k_diffusion/res.py | 258 ---------------------------------- comfy/k_diffusion/sampling.py | 71 ++++++++-- comfy/samplers.py | 2 +- 3 files changed, 63 insertions(+), 268 deletions(-) delete mode 100644 comfy/k_diffusion/res.py diff --git a/comfy/k_diffusion/res.py b/comfy/k_diffusion/res.py deleted file mode 100644 index 6caedec39..000000000 --- a/comfy/k_diffusion/res.py +++ /dev/null @@ -1,258 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Copied from Nvidia Cosmos code. - -import torch -from torch import Tensor -from typing import Callable, List, Tuple, Optional, Any -import math -from tqdm.auto import trange - - -def common_broadcast(x: Tensor, y: Tensor) -> tuple[Tensor, Tensor]: - ndims1 = x.ndim - ndims2 = y.ndim - - if ndims1 < ndims2: - x = x.reshape(x.shape + (1,) * (ndims2 - ndims1)) - elif ndims2 < ndims1: - y = y.reshape(y.shape + (1,) * (ndims1 - ndims2)) - - return x, y - - -def batch_mul(x: Tensor, y: Tensor) -> Tensor: - x, y = common_broadcast(x, y) - return x * y - - -def phi1(t: torch.Tensor) -> torch.Tensor: - """ - Compute the first order phi function: (exp(t) - 1) / t. - - Args: - t: Input tensor. - - Returns: - Tensor: Result of phi1 function. - """ - input_dtype = t.dtype - t = t.to(dtype=torch.float32) - return (torch.expm1(t) / t).to(dtype=input_dtype) - - -def phi2(t: torch.Tensor) -> torch.Tensor: - """ - Compute the second order phi function: (phi1(t) - 1) / t. - - Args: - t: Input tensor. - - Returns: - Tensor: Result of phi2 function. - """ - input_dtype = t.dtype - t = t.to(dtype=torch.float32) - return ((phi1(t) - 1.0) / t).to(dtype=input_dtype) - - -def res_x0_rk2_step( - x_s: torch.Tensor, - t: torch.Tensor, - s: torch.Tensor, - x0_s: torch.Tensor, - s1: torch.Tensor, - x0_s1: torch.Tensor, -) -> torch.Tensor: - """ - Perform a residual-based 2nd order Runge-Kutta step. - - Args: - x_s: Current state tensor. - t: Target time tensor. - s: Current time tensor. - x0_s: Prediction at current time. - s1: Intermediate time tensor. - x0_s1: Prediction at intermediate time. - - Returns: - Tensor: Updated state tensor. - - Raises: - AssertionError: If step size is too small. - """ - s = -torch.log(s) - t = -torch.log(t) - m = -torch.log(s1) - - dt = t - s - assert not torch.any(torch.isclose(dt, torch.zeros_like(dt), atol=1e-6)), "Step size is too small" - assert not torch.any(torch.isclose(m - s, torch.zeros_like(dt), atol=1e-6)), "Step size is too small" - - c2 = (m - s) / dt - phi1_val, phi2_val = phi1(-dt), phi2(-dt) - - # Handle edge case where t = s = m - b1 = torch.nan_to_num(phi1_val - 1.0 / c2 * phi2_val, nan=0.0) - b2 = torch.nan_to_num(1.0 / c2 * phi2_val, nan=0.0) - - return batch_mul(torch.exp(-dt), x_s) + batch_mul(dt, batch_mul(b1, x0_s) + batch_mul(b2, x0_s1)) - - -def reg_x0_euler_step( - x_s: torch.Tensor, - s: torch.Tensor, - t: torch.Tensor, - x0_s: torch.Tensor, -) -> Tuple[torch.Tensor, torch.Tensor]: - """ - Perform a regularized Euler step based on x0 prediction. - - Args: - x_s: Current state tensor. - s: Current time tensor. - t: Target time tensor. - x0_s: Prediction at current time. - - Returns: - Tuple[Tensor, Tensor]: Updated state tensor and current prediction. - """ - coef_x0 = (s - t) / s - coef_xs = t / s - return batch_mul(coef_x0, x0_s) + batch_mul(coef_xs, x_s), x0_s - - -def order2_fn( - x_s: torch.Tensor, s: torch.Tensor, t: torch.Tensor, x0_s: torch.Tensor, x0_preds: torch.Tensor -) -> Tuple[torch.Tensor, List[torch.Tensor]]: - """ - impl the second order multistep method in https://arxiv.org/pdf/2308.02157 - Adams Bashforth approach! - """ - if x0_preds: - x0_s1, s1 = x0_preds[0] - x_t = res_x0_rk2_step(x_s, t, s, x0_s, s1, x0_s1) - else: - x_t = reg_x0_euler_step(x_s, s, t, x0_s)[0] - return x_t, [(x0_s, s)] - - -class SolverConfig: - is_multi: bool = True - rk: str = "2mid" - multistep: str = "2ab" - s_churn: float = 0.0 - s_t_max: float = float("inf") - s_t_min: float = 0.0 - s_noise: float = 1.0 - - -def fori_loop(lower: int, upper: int, body_fun: Callable[[int, Any], Any], init_val: Any, disable=None) -> Any: - """ - Implements a for loop with a function. - - Args: - lower: Lower bound of the loop (inclusive). - upper: Upper bound of the loop (exclusive). - body_fun: Function to be applied in each iteration. - init_val: Initial value for the loop. - - Returns: - The final result after all iterations. - """ - val = init_val - for i in trange(lower, upper, disable=disable): - val = body_fun(i, val) - return val - - -def differential_equation_solver( - x0_fn: Callable[[torch.Tensor, torch.Tensor], torch.Tensor], - sigmas_L: torch.Tensor, - solver_cfg: SolverConfig, - noise_sampler, - callback=None, - disable=None, -) -> Callable[[torch.Tensor], torch.Tensor]: - """ - Creates a differential equation solver function. - - Args: - x0_fn: Function to compute x0 prediction. - sigmas_L: Tensor of sigma values with shape [L,]. - solver_cfg: Configuration for the solver. - - Returns: - A function that solves the differential equation. - """ - num_step = len(sigmas_L) - 1 - - # if solver_cfg.is_multi: - # update_step_fn = get_multi_step_fn(solver_cfg.multistep) - # else: - # update_step_fn = get_runge_kutta_fn(solver_cfg.rk) - update_step_fn = order2_fn - - eta = min(solver_cfg.s_churn / (num_step + 1), math.sqrt(1.2) - 1) - - def sample_fn(input_xT_B_StateShape: torch.Tensor) -> torch.Tensor: - """ - Samples from the differential equation. - - Args: - input_xT_B_StateShape: Input tensor with shape [B, StateShape]. - - Returns: - Output tensor with shape [B, StateShape]. - """ - ones_B = torch.ones(input_xT_B_StateShape.size(0), device=input_xT_B_StateShape.device, dtype=torch.float32) - - def step_fn( - i_th: int, state: Tuple[torch.Tensor, Optional[List[torch.Tensor]]] - ) -> Tuple[torch.Tensor, Optional[List[torch.Tensor]]]: - input_x_B_StateShape, x0_preds = state - sigma_cur_0, sigma_next_0 = sigmas_L[i_th], sigmas_L[i_th + 1] - - if sigma_next_0 == 0: - output_x_B_StateShape = x0_pred_B_StateShape = x0_fn(input_x_B_StateShape, sigma_cur_0 * ones_B) - else: - # algorithm 2: line 4-6 - if solver_cfg.s_t_min < sigma_cur_0 < solver_cfg.s_t_max and eta > 0: - hat_sigma_cur_0 = sigma_cur_0 + eta * sigma_cur_0 - input_x_B_StateShape = input_x_B_StateShape + ( - hat_sigma_cur_0**2 - sigma_cur_0**2 - ).sqrt() * solver_cfg.s_noise * noise_sampler(sigma_cur_0, sigma_next_0) # torch.randn_like(input_x_B_StateShape) - sigma_cur_0 = hat_sigma_cur_0 - - if solver_cfg.is_multi: - x0_pred_B_StateShape = x0_fn(input_x_B_StateShape, sigma_cur_0 * ones_B) - output_x_B_StateShape, x0_preds = update_step_fn( - input_x_B_StateShape, sigma_cur_0 * ones_B, sigma_next_0 * ones_B, x0_pred_B_StateShape, x0_preds - ) - else: - output_x_B_StateShape, x0_preds = update_step_fn( - input_x_B_StateShape, sigma_cur_0 * ones_B, sigma_next_0 * ones_B, x0_fn - ) - - if callback is not None: - callback({'x': input_x_B_StateShape, 'i': i_th, 'sigma': sigma_cur_0, 'sigma_hat': sigma_cur_0, 'denoised': x0_pred_B_StateShape}) - - return output_x_B_StateShape, x0_preds - - x_at_eps, _ = fori_loop(0, num_step, step_fn, [input_xT_B_StateShape, None], disable=disable) - return x_at_eps - - return sample_fn diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index 3a98e6a7c..13ae272fd 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -8,7 +8,6 @@ from tqdm.auto import trange, tqdm from . import utils from . import deis -from . import res import comfy.model_patcher import comfy.model_sampling @@ -1268,18 +1267,72 @@ def sample_dpmpp_2m_cfg_pp(model, x, sigmas, extra_args=None, callback=None, dis return x @torch.no_grad() -def sample_res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1., noise_sampler=None): +def res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1., noise_sampler=None, cfg_pp=False): extra_args = {} if extra_args is None else extra_args seed = extra_args.get("seed", None) noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler + s_in = x.new_ones([x.shape[0]]) + sigma_fn = lambda t: t.neg().exp() + t_fn = lambda sigma: sigma.log().neg() + phi1_fn = lambda t: torch.expm1(t) / t + phi2_fn = lambda t: (phi1_fn(t) - 1.0) / t - x0_func = lambda x, sigma: model(x, sigma, **extra_args) + old_denoised = None + uncond_denoised = None + def post_cfg_function(args): + nonlocal uncond_denoised + uncond_denoised = args["uncond_denoised"] + return args["denoised"] - solver_cfg = res.SolverConfig() - solver_cfg.s_churn = s_churn - solver_cfg.s_t_max = s_tmax - solver_cfg.s_t_min = s_tmin - solver_cfg.s_noise = s_noise + if cfg_pp: + model_options = extra_args.get("model_options", {}).copy() + extra_args["model_options"] = comfy.model_patcher.set_model_options_post_cfg_function(model_options, post_cfg_function, disable_cfg1_optimization=True) - x = res.differential_equation_solver(x0_func, sigmas, solver_cfg, noise_sampler, callback=callback, disable=disable)(x) + for i in trange(len(sigmas) - 1, disable=disable): + if s_churn > 0: + gamma = min(s_churn / (len(sigmas) - 1), 2**0.5 - 1) if s_tmin <= sigmas[i] <= s_tmax else 0.0 + sigma_hat = sigmas[i] * (gamma + 1) + else: + gamma = 0 + sigma_hat = sigmas[i] + + if gamma > 0: + eps = torch.randn_like(x) * s_noise + x = x + eps * (sigma_hat**2 - sigmas[i] ** 2) ** 0.5 + denoised = model(x, sigma_hat * s_in, **extra_args) + if callback is not None: + callback({"x": x, "i": i, "sigma": sigmas[i], "sigma_hat": sigma_hat, "denoised": denoised}) + if sigmas[i + 1] == 0 or old_denoised is None: + # Euler method + if cfg_pp: + d = to_d(x, sigma_hat, uncond_denoised) + x = denoised + d * sigmas[i + 1] + else: + d = to_d(x, sigma_hat, denoised) + dt = sigmas[i + 1] - sigma_hat + x = x + d * dt + else: + # Second order multistep method in https://arxiv.org/pdf/2308.02157 + t, t_next, t_prev = t_fn(sigmas[i]), t_fn(sigmas[i + 1]), t_fn(sigmas[i - 1]) + h = t_next - t + c2 = (t_prev - t) / h + + phi1_val, phi2_val = phi1_fn(-h), phi2_fn(-h) + b1 = torch.nan_to_num(phi1_val - 1.0 / c2 * phi2_val, nan=0.0) + b2 = torch.nan_to_num(1.0 / c2 * phi2_val, nan=0.0) + + if cfg_pp: + x = x + (denoised - uncond_denoised) + + x = (sigma_fn(t_next) / sigma_fn(t)) * x + h * (b1 * denoised + b2 * old_denoised) + + old_denoised = denoised return x + +@torch.no_grad() +def sample_res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1., noise_sampler=None): + return res_multistep(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, s_churn=s_churn, s_tmin=s_tmin, s_tmax=s_tmax, s_noise=s_noise, noise_sampler=noise_sampler, cfg_pp=False) + +@torch.no_grad() +def sample_res_multistep_cfg_pp(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1., noise_sampler=None): + return res_multistep(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, s_churn=s_churn, s_tmin=s_tmin, s_tmax=s_tmax, s_noise=s_noise, noise_sampler=noise_sampler, cfg_pp=True) diff --git a/comfy/samplers.py b/comfy/samplers.py index 8f25935d7..c508a3a41 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -687,7 +687,7 @@ class Sampler: KSAMPLER_NAMES = ["euler", "euler_cfg_pp", "euler_ancestral", "euler_ancestral_cfg_pp", "heun", "heunpp2","dpm_2", "dpm_2_ancestral", "lms", "dpm_fast", "dpm_adaptive", "dpmpp_2s_ancestral", "dpmpp_2s_ancestral_cfg_pp", "dpmpp_sde", "dpmpp_sde_gpu", "dpmpp_2m", "dpmpp_2m_cfg_pp", "dpmpp_2m_sde", "dpmpp_2m_sde_gpu", "dpmpp_3m_sde", "dpmpp_3m_sde_gpu", "ddpm", "lcm", - "ipndm", "ipndm_v", "deis", "res_multistep"] + "ipndm", "ipndm_v", "deis", "res_multistep", "res_multistep_cfg_pp"] class KSAMPLER(Sampler): def __init__(self, sampler_function, extra_options={}, inpaint_options={}): From 2cdbaf5169a631b126542f41432f2484c4f0a608 Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Tue, 14 Jan 2025 19:05:45 -0500 Subject: [PATCH 004/478] Add SetFirstSigma node (#6459) Useful for models utilizing ztSNR. See: https://arxiv.org/abs/2409.15997 --- comfy_extras/nodes_custom_sampler.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/comfy_extras/nodes_custom_sampler.py b/comfy_extras/nodes_custom_sampler.py index c7ff9a4d8..576fc3b2c 100644 --- a/comfy_extras/nodes_custom_sampler.py +++ b/comfy_extras/nodes_custom_sampler.py @@ -231,6 +231,24 @@ class FlipSigmas: sigmas[0] = 0.0001 return (sigmas,) +class SetFirstSigma: + @classmethod + def INPUT_TYPES(s): + return {"required": + {"sigmas": ("SIGMAS", ), + "sigma": ("FLOAT", {"default": 136.0, "min": 0.0, "max": 20000.0, "step": 0.001, "round": False}), + } + } + RETURN_TYPES = ("SIGMAS",) + CATEGORY = "sampling/custom_sampling/sigmas" + + FUNCTION = "set_first_sigma" + + def set_first_sigma(self, sigmas, sigma): + sigmas = sigmas.clone() + sigmas[0] = sigma + return (sigmas, ) + class KSamplerSelect: @classmethod def INPUT_TYPES(s): @@ -710,6 +728,7 @@ NODE_CLASS_MAPPINGS = { "SplitSigmas": SplitSigmas, "SplitSigmasDenoise": SplitSigmasDenoise, "FlipSigmas": FlipSigmas, + "SetFirstSigma": SetFirstSigma, "CFGGuider": CFGGuider, "DualCFGGuider": DualCFGGuider, From 5b657f8c15a2cc437049dcbfc10eb268fb0194d4 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 15 Jan 2025 00:41:35 -0500 Subject: [PATCH 005/478] Allow setting start and end image in CosmosImageToVideoLatent. --- comfy_extras/nodes_cosmos.py | 47 ++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/comfy_extras/nodes_cosmos.py b/comfy_extras/nodes_cosmos.py index 5fbabb9a7..b76ff950b 100644 --- a/comfy_extras/nodes_cosmos.py +++ b/comfy_extras/nodes_cosmos.py @@ -21,37 +21,54 @@ class EmptyCosmosLatentVideo: return ({"samples": latent}, ) +def vae_encode_with_padding(vae, image, width, height, length, padding=0): + pixels = comfy.utils.common_upscale(image[..., :3].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + pixel_len = min(pixels.shape[0], length) + padded_length = min(length, (((pixel_len - 1) // 8) + 1 + padding) * 8 - 7) + padded_pixels = torch.ones((padded_length, height, width, 3)) * 0.5 + padded_pixels[:pixel_len] = pixels[:pixel_len] + latent_len = ((pixel_len - 1) // 8) + 1 + latent_temp = vae.encode(padded_pixels) + return latent_temp[:, :, :latent_len] + + class CosmosImageToVideoLatent: @classmethod def INPUT_TYPES(s): return {"required": {"vae": ("VAE", ), - "image": ("IMAGE", ), "width": ("INT", {"default": 1280, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), "height": ("INT", {"default": 704, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), "length": ("INT", {"default": 121, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 8}), "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), - }} + }, + "optional": {"start_image": ("IMAGE", ), + "end_image": ("IMAGE", ), + }} + RETURN_TYPES = ("LATENT",) FUNCTION = "encode" CATEGORY = "conditioning/inpaint" - def encode(self, vae, image, width, height, length, batch_size): - pixels = comfy.utils.common_upscale(image[..., :3].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) - pixel_len = min(pixels.shape[0], length) - padded_length = min(length, (((pixel_len - 1) // 8) + 2) * 8 - 7) - padded_pixels = torch.ones((padded_length, height, width, 3)) * 0.5 - padded_pixels[:pixel_len] = pixels[:pixel_len] - - latent_temp = vae.encode(padded_pixels) - - latent = torch.zeros([1, latent_temp.shape[1], ((length - 1) // 8) + 1, latent_temp.shape[-2], latent_temp.shape[-1]], device=comfy.model_management.intermediate_device()) - latent_len = ((pixel_len - 1) // 8) + 1 - latent[:, :, :latent_len] = latent_temp[:, :, :latent_len] + def encode(self, vae, width, height, length, batch_size, start_image=None, end_image=None): + latent = torch.zeros([1, 16, ((length - 1) // 8) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) + if start_image is None and end_image is None: + out_latent = {} + out_latent["samples"] = latent + return (out_latent,) mask = torch.ones([latent.shape[0], 1, ((length - 1) // 8) + 1, latent.shape[-2], latent.shape[-1]], device=comfy.model_management.intermediate_device()) - mask[:, :, :latent_len] *= 0.0 + + if start_image is not None: + latent_temp = vae_encode_with_padding(vae, start_image, width, height, length, padding=1) + latent[:, :, :latent_temp.shape[-3]] = latent_temp + mask[:, :, :latent_temp.shape[-3]] *= 0.0 + + if end_image is not None: + latent_temp = vae_encode_with_padding(vae, end_image, width, height, length, padding=0) + latent[:, :, -latent_temp.shape[-3]:] = latent_temp + mask[:, :, -latent_temp.shape[-3]:] *= 0.0 out_latent = {} out_latent["samples"] = latent From 2feb8d0b77ce80a471ecab84b92d5bbcaa37f8fe Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 15 Jan 2025 03:50:27 -0500 Subject: [PATCH 006/478] Force safe loading of files in torch format on pytorch 2.4+ If this breaks something for you make an issue. --- comfy/utils.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/comfy/utils.py b/comfy/utils.py index b486b2deb..bcefa1804 100644 --- a/comfy/utils.py +++ b/comfy/utils.py @@ -29,17 +29,29 @@ import itertools from torch.nn.functional import interpolate from einops import rearrange +ALWAYS_SAFE_LOAD = False +if hasattr(torch.serialization, "add_safe_globals"): # TODO: this was added in pytorch 2.4, the unsafe path should be removed once earlier versions are deprecated + class ModelCheckpoint: + pass + ModelCheckpoint.__module__ = "pytorch_lightning.callbacks.model_checkpoint" + + from numpy.core.multiarray import scalar + from numpy import dtype + from numpy.dtypes import Float64DType + from _codecs import encode + + torch.serialization.add_safe_globals([ModelCheckpoint, scalar, dtype, Float64DType, encode]) + ALWAYS_SAFE_LOAD = True + logging.info("Checkpoint files will always be loaded safely.") + + def load_torch_file(ckpt, safe_load=False, device=None): if device is None: device = torch.device("cpu") if ckpt.lower().endswith(".safetensors") or ckpt.lower().endswith(".sft"): sd = safetensors.torch.load_file(ckpt, device=device.type) else: - if safe_load: - if not 'weights_only' in torch.load.__code__.co_varnames: - logging.warning("Warning torch.load doesn't support weights_only on this pytorch version, loading unsafely.") - safe_load = False - if safe_load: + if safe_load or ALWAYS_SAFE_LOAD: pl_sd = torch.load(ckpt, map_location=device, weights_only=True) else: pl_sd = torch.load(ckpt, map_location=device, pickle_module=comfy.checkpoint_pickle) From cba58fff0bfebfc81fbe678bb80491890a3df14a Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 15 Jan 2025 04:32:23 -0500 Subject: [PATCH 007/478] Remove unsafe embedding load for very old pytorch. --- comfy/sd1_clip.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/comfy/sd1_clip.py b/comfy/sd1_clip.py index 95d41c30f..85518afd9 100644 --- a/comfy/sd1_clip.py +++ b/comfy/sd1_clip.py @@ -388,13 +388,10 @@ def load_embed(embedding_name, embedding_directory, embedding_size, embed_key=No import safetensors.torch embed = safetensors.torch.load_file(embed_path, device="cpu") else: - if 'weights_only' in torch.load.__code__.co_varnames: - try: - embed = torch.load(embed_path, weights_only=True, map_location="cpu") - except: - embed_out = safe_load_embed_zip(embed_path) - else: - embed = torch.load(embed_path, map_location="cpu") + try: + embed = torch.load(embed_path, weights_only=True, map_location="cpu") + except: + embed_out = safe_load_embed_zip(embed_path) except Exception: logging.warning("{}\n\nerror loading embedding, skipping loading: {}".format(traceback.format_exc(), embedding_name)) return None From 1709a8441e7ad88ead87285b802e429b5ab7aebb Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 15 Jan 2025 14:50:40 -0500 Subject: [PATCH 008/478] Use latest python 3.12.8 the portable release. --- .github/workflows/stable-release.yml | 2 +- .github/workflows/windows_release_dependencies.yml | 2 +- .github/workflows/windows_release_package.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.yml index 0bdd5a3bd..4a5ba58f6 100644 --- a/.github/workflows/stable-release.yml +++ b/.github/workflows/stable-release.yml @@ -22,7 +22,7 @@ on: description: 'Python patch version' required: true type: string - default: "7" + default: "8" jobs: diff --git a/.github/workflows/windows_release_dependencies.yml b/.github/workflows/windows_release_dependencies.yml index 85e6a52fd..6c7937ae2 100644 --- a/.github/workflows/windows_release_dependencies.yml +++ b/.github/workflows/windows_release_dependencies.yml @@ -29,7 +29,7 @@ on: description: 'python patch version' required: true type: string - default: "7" + default: "8" # push: # branches: # - master diff --git a/.github/workflows/windows_release_package.yml b/.github/workflows/windows_release_package.yml index 11e724ba7..24f928ee0 100644 --- a/.github/workflows/windows_release_package.yml +++ b/.github/workflows/windows_release_package.yml @@ -19,7 +19,7 @@ on: description: 'python patch version' required: true type: string - default: "7" + default: "8" # push: # branches: # - master From 3baf92d120a91842c84a9907883eda64882e90d6 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 15 Jan 2025 17:19:59 -0500 Subject: [PATCH 009/478] CosmosImageToVideoLatent batch_size now does something. --- comfy_extras/nodes_cosmos.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy_extras/nodes_cosmos.py b/comfy_extras/nodes_cosmos.py index b76ff950b..bd35ddb06 100644 --- a/comfy_extras/nodes_cosmos.py +++ b/comfy_extras/nodes_cosmos.py @@ -71,8 +71,8 @@ class CosmosImageToVideoLatent: mask[:, :, -latent_temp.shape[-3]:] *= 0.0 out_latent = {} - out_latent["samples"] = latent - out_latent["noise_mask"] = mask + out_latent["samples"] = latent.repeat((batch_size, ) + (1,) * (latent.ndim - 1)) + out_latent["noise_mask"] = mask.repeat((batch_size, ) + (1,) * (mask.ndim - 1)) return (out_latent,) From 2e20e399ea6d9fad5f0e40f987d96088f052b74c Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 15 Jan 2025 20:19:56 -0500 Subject: [PATCH 010/478] Add minimum numpy version to requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 4c2c0b2b2..3bc945a1b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ torch torchsde torchvision torchaudio +numpy>=1.25.0 einops transformers>=4.28.1 tokenizers>=0.13.3 From 55ade36d01fd4bf3c1ba7238a06a5fa386597124 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 15 Jan 2025 20:24:55 -0500 Subject: [PATCH 011/478] Remove python 3.8 from test-build workflow. --- .github/workflows/test-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 444d6b254..419873ad8 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -28,4 +28,4 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt \ No newline at end of file + pip install -r requirements.txt From bfd5dfd6111d4133b305b8174c71b224a780b6e3 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 15 Jan 2025 20:32:44 -0500 Subject: [PATCH 012/478] 3.13 doesn't work yet. --- .github/workflows/test-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 419873ad8..865e1ec25 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} From 008761166fdf90db95f7f757f6f995be8bded508 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 15 Jan 2025 21:48:46 -0500 Subject: [PATCH 013/478] Optimize first attention block in cosmos VAE. --- comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py | 17 +++++---------- comfy/ldm/modules/diffusionmodules/model.py | 21 +++++++++++-------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py b/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py index 6149e53ec..7d864a754 100644 --- a/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py +++ b/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py @@ -30,6 +30,8 @@ import torch.nn as nn import torch.nn.functional as F import logging +from comfy.ldm.modules.diffusionmodules.model import vae_attention + from .patching import ( Patcher, Patcher3D, @@ -400,6 +402,8 @@ class CausalAttnBlock(nn.Module): in_channels, in_channels, kernel_size=1, stride=1, padding=0 ) + self.optimized_attention = vae_attention() + def forward(self, x: torch.Tensor) -> torch.Tensor: h_ = x h_ = self.norm(h_) @@ -413,18 +417,7 @@ class CausalAttnBlock(nn.Module): v, batch_size = time2batch(v) b, c, h, w = q.shape - q = q.reshape(b, c, h * w) - q = q.permute(0, 2, 1) - k = k.reshape(b, c, h * w) - w_ = torch.bmm(q, k) - w_ = w_ * (int(c) ** (-0.5)) - w_ = F.softmax(w_, dim=2) - - # attend to values - v = v.reshape(b, c, h * w) - w_ = w_.permute(0, 2, 1) - h_ = torch.bmm(v, w_) - h_ = h_.reshape(b, c, h, w) + h_ = self.optimized_attention(q, k, v) h_ = batch2time(h_, batch_size) h_ = self.proj_out(h_) diff --git a/comfy/ldm/modules/diffusionmodules/model.py b/comfy/ldm/modules/diffusionmodules/model.py index ed1e88212..303147a98 100644 --- a/comfy/ldm/modules/diffusionmodules/model.py +++ b/comfy/ldm/modules/diffusionmodules/model.py @@ -293,6 +293,17 @@ def pytorch_attention(q, k, v): return out +def vae_attention(): + if model_management.xformers_enabled_vae(): + logging.info("Using xformers attention in VAE") + return xformers_attention + elif model_management.pytorch_attention_enabled(): + logging.info("Using pytorch attention in VAE") + return pytorch_attention + else: + logging.info("Using split attention in VAE") + return normal_attention + class AttnBlock(nn.Module): def __init__(self, in_channels, conv_op=ops.Conv2d): super().__init__() @@ -320,15 +331,7 @@ class AttnBlock(nn.Module): stride=1, padding=0) - if model_management.xformers_enabled_vae(): - logging.info("Using xformers attention in VAE") - self.optimized_attention = xformers_attention - elif model_management.pytorch_attention_enabled(): - logging.info("Using pytorch attention in VAE") - self.optimized_attention = pytorch_attention - else: - logging.info("Using split attention in VAE") - self.optimized_attention = normal_attention + self.optimized_attention = vae_attention() def forward(self, x): h_ = x From 4758fb64b9afb31f48a872368b98615004f04e83 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 15 Jan 2025 22:57:52 -0500 Subject: [PATCH 014/478] Lower cosmos VAE memory usage by a bit. --- comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py | 8 +++---- comfy/ldm/cosmos/cosmos_tokenizer/patching.py | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py b/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py index 7d864a754..9a3ebed6a 100644 --- a/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py +++ b/comfy/ldm/cosmos/cosmos_tokenizer/layers3d.py @@ -864,18 +864,16 @@ class EncoderFactorized(nn.Module): x = self.patcher3d(x) # downsampling - hs = [self.conv_in(x)] + h = self.conv_in(x) for i_level in range(self.num_resolutions): for i_block in range(self.num_res_blocks): - h = self.down[i_level].block[i_block](hs[-1]) + h = self.down[i_level].block[i_block](h) if len(self.down[i_level].attn) > 0: h = self.down[i_level].attn[i_block](h) - hs.append(h) if i_level != self.num_resolutions - 1: - hs.append(self.down[i_level].downsample(hs[-1])) + h = self.down[i_level].downsample(h) # middle - h = hs[-1] h = self.mid.block_1(h) h = self.mid.attn_1(h) h = self.mid.block_2(h) diff --git a/comfy/ldm/cosmos/cosmos_tokenizer/patching.py b/comfy/ldm/cosmos/cosmos_tokenizer/patching.py index 793f0da8a..87a53a1d9 100644 --- a/comfy/ldm/cosmos/cosmos_tokenizer/patching.py +++ b/comfy/ldm/cosmos/cosmos_tokenizer/patching.py @@ -281,54 +281,76 @@ class UnPatcher3D(UnPatcher): hh = hh.to(dtype=dtype) xlll, xllh, xlhl, xlhh, xhll, xhlh, xhhl, xhhh = torch.chunk(x, 8, dim=1) + del x # Height height transposed convolutions. xll = F.conv_transpose3d( xlll, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xlll + xll += F.conv_transpose3d( xllh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xllh xlh = F.conv_transpose3d( xlhl, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xlhl + xlh += F.conv_transpose3d( xlhh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xlhh xhl = F.conv_transpose3d( xhll, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xhll + xhl += F.conv_transpose3d( xhlh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xhlh xhh = F.conv_transpose3d( xhhl, hl.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xhhl + xhh += F.conv_transpose3d( xhhh, hh.unsqueeze(2).unsqueeze(3), groups=g, stride=(1, 1, 2) ) + del xhhh # Handles width transposed convolutions. xl = F.conv_transpose3d( xll, hl.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1) ) + del xll + xl += F.conv_transpose3d( xlh, hh.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1) ) + del xlh + xh = F.conv_transpose3d( xhl, hl.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1) ) + del xhl + xh += F.conv_transpose3d( xhh, hh.unsqueeze(2).unsqueeze(4), groups=g, stride=(1, 2, 1) ) + del xhh # Handles time axis transposed convolutions. x = F.conv_transpose3d( xl, hl.unsqueeze(3).unsqueeze(4), groups=g, stride=(2, 1, 1) ) + del xl + x += F.conv_transpose3d( xh, hh.unsqueeze(3).unsqueeze(4), groups=g, stride=(2, 1, 1) ) From 25683b5b0269590ba24f96753cf55cc6ad093cd0 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 15 Jan 2025 23:46:42 -0500 Subject: [PATCH 015/478] Lower cosmos diffusion model memory usage. --- comfy/ldm/cosmos/blocks.py | 26 +++++++++++++++----------- comfy/ldm/cosmos/model.py | 10 +++++++--- comfy/ldm/cosmos/position_embedding.py | 7 ++++--- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/comfy/ldm/cosmos/blocks.py b/comfy/ldm/cosmos/blocks.py index 3e9c6497a..84fd6d839 100644 --- a/comfy/ldm/cosmos/blocks.py +++ b/comfy/ldm/cosmos/blocks.py @@ -168,14 +168,18 @@ class Attention(nn.Module): k = self.to_k[1](k) v = self.to_v[1](v) if self.is_selfattn and rope_emb is not None: # only apply to self-attention! - q = apply_rotary_pos_emb(q, rope_emb) - k = apply_rotary_pos_emb(k, rope_emb) - return q, k, v + # apply_rotary_pos_emb inlined + q_shape = q.shape + q = q.reshape(*q.shape[:-1], 2, -1).movedim(-2, -1).unsqueeze(-2) + q = rope_emb[..., 0] * q[..., 0] + rope_emb[..., 1] * q[..., 1] + q = q.movedim(-1, -2).reshape(*q_shape).to(x.dtype) - def cal_attn(self, q, k, v, mask=None): - out = optimized_attention(q, k, v, self.heads, skip_reshape=True, mask=mask, skip_output_reshape=True) - out = rearrange(out, " b n s c -> s b (n c)") - return self.to_out(out) + # apply_rotary_pos_emb inlined + k_shape = k.shape + k = k.reshape(*k.shape[:-1], 2, -1).movedim(-2, -1).unsqueeze(-2) + k = rope_emb[..., 0] * k[..., 0] + rope_emb[..., 1] * k[..., 1] + k = k.movedim(-1, -2).reshape(*k_shape).to(x.dtype) + return q, k, v def forward( self, @@ -191,7 +195,10 @@ class Attention(nn.Module): context (Optional[Tensor]): The key tensor of shape [B, Mk, K] or use x as context [self attention] if None """ q, k, v = self.cal_qkv(x, context, mask, rope_emb=rope_emb, **kwargs) - return self.cal_attn(q, k, v, mask) + out = optimized_attention(q, k, v, self.heads, skip_reshape=True, mask=mask, skip_output_reshape=True) + del q, k, v + out = rearrange(out, " b n s c -> s b (n c)") + return self.to_out(out) class FeedForward(nn.Module): @@ -788,10 +795,7 @@ class GeneralDITTransformerBlock(nn.Module): crossattn_mask: Optional[torch.Tensor] = None, rope_emb_L_1_1_D: Optional[torch.Tensor] = None, adaln_lora_B_3D: Optional[torch.Tensor] = None, - extra_per_block_pos_emb: Optional[torch.Tensor] = None, ) -> torch.Tensor: - if extra_per_block_pos_emb is not None: - x = x + extra_per_block_pos_emb for block in self.blocks: x = block( x, diff --git a/comfy/ldm/cosmos/model.py b/comfy/ldm/cosmos/model.py index 05dd38469..1205838b5 100644 --- a/comfy/ldm/cosmos/model.py +++ b/comfy/ldm/cosmos/model.py @@ -168,7 +168,7 @@ class GeneralDIT(nn.Module): operations=operations, ) - self.build_pos_embed(device=device) + self.build_pos_embed(device=device, dtype=dtype) self.block_x_format = block_x_format self.use_adaln_lora = use_adaln_lora self.adaln_lora_dim = adaln_lora_dim @@ -210,7 +210,7 @@ class GeneralDIT(nn.Module): operations=operations, ) - def build_pos_embed(self, device=None): + def build_pos_embed(self, device=None, dtype=None): if self.pos_emb_cls == "rope3d": cls_type = VideoRopePosition3DEmb else: @@ -242,6 +242,7 @@ class GeneralDIT(nn.Module): kwargs["w_extrapolation_ratio"] = self.extra_w_extrapolation_ratio kwargs["t_extrapolation_ratio"] = self.extra_t_extrapolation_ratio kwargs["device"] = device + kwargs["dtype"] = dtype self.extra_pos_embedder = LearnablePosEmbAxis( **kwargs, ) @@ -476,6 +477,8 @@ class GeneralDIT(nn.Module): inputs["original_shape"], ) extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D = inputs["extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D"].to(x.dtype) + del inputs + if extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D is not None: assert ( x.shape == extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D.shape @@ -486,6 +489,8 @@ class GeneralDIT(nn.Module): self.blocks["block0"].x_format == block.x_format ), f"First block has x_format {self.blocks[0].x_format}, got {block.x_format}" + if extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D is not None: + x += extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D x = block( x, affline_emb_B_D, @@ -493,7 +498,6 @@ class GeneralDIT(nn.Module): crossattn_mask, rope_emb_L_1_1_D=rope_emb_L_1_1_D, adaln_lora_B_3D=adaln_lora_B_3D, - extra_per_block_pos_emb=extra_pos_emb_B_T_H_W_D_or_T_H_W_B_D, ) x_B_T_H_W_D = rearrange(x, "T H W B D -> B T H W D") diff --git a/comfy/ldm/cosmos/position_embedding.py b/comfy/ldm/cosmos/position_embedding.py index dda752cb8..cf45ab0e3 100644 --- a/comfy/ldm/cosmos/position_embedding.py +++ b/comfy/ldm/cosmos/position_embedding.py @@ -173,6 +173,7 @@ class LearnablePosEmbAxis(VideoPositionEmb): len_w: int, len_t: int, device=None, + dtype=None, **kwargs, ): """ @@ -184,9 +185,9 @@ class LearnablePosEmbAxis(VideoPositionEmb): self.interpolation = interpolation assert self.interpolation in ["crop"], f"Unknown interpolation method {self.interpolation}" - self.pos_emb_h = nn.Parameter(torch.empty(len_h, model_channels, device=device)) - self.pos_emb_w = nn.Parameter(torch.empty(len_w, model_channels, device=device)) - self.pos_emb_t = nn.Parameter(torch.empty(len_t, model_channels, device=device)) + self.pos_emb_h = nn.Parameter(torch.empty(len_h, model_channels, device=device, dtype=dtype)) + self.pos_emb_w = nn.Parameter(torch.empty(len_w, model_channels, device=device, dtype=dtype)) + self.pos_emb_t = nn.Parameter(torch.empty(len_t, model_channels, device=device, dtype=dtype)) def generate_embeddings(self, B_T_H_W_C: torch.Size, fps=Optional[torch.Tensor], device=None) -> torch.Tensor: From 6320d0569642b4c28c36c47f80aecb28e5fbc04d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 16 Jan 2025 00:23:01 -0500 Subject: [PATCH 016/478] Slightly lower hunyuan video memory usage. --- comfy/ldm/flux/math.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/comfy/ldm/flux/math.py b/comfy/ldm/flux/math.py index b6549585a..b5960ffd3 100644 --- a/comfy/ldm/flux/math.py +++ b/comfy/ldm/flux/math.py @@ -5,8 +5,15 @@ from torch import Tensor from comfy.ldm.modules.attention import optimized_attention import comfy.model_management + def attention(q: Tensor, k: Tensor, v: Tensor, pe: Tensor, mask=None) -> Tensor: - q, k = apply_rope(q, k, pe) + q_shape = q.shape + k_shape = k.shape + + q = q.float().reshape(*q.shape[:-1], -1, 1, 2) + k = k.float().reshape(*k.shape[:-1], -1, 1, 2) + q = (pe[..., 0] * q[..., 0] + pe[..., 1] * q[..., 1]).reshape(*q_shape).type_as(v) + k = (pe[..., 0] * k[..., 0] + pe[..., 1] * k[..., 1]).reshape(*k_shape).type_as(v) heads = q.shape[1] x = optimized_attention(q, k, v, heads, skip_reshape=True, mask=mask) From 9d8b6c1f464e01a730bc4039cce483895dc888a4 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 16 Jan 2025 03:48:40 -0500 Subject: [PATCH 017/478] More accurate memory estimation for cosmos and hunyuan video. --- comfy/sd.py | 4 ++-- comfy/supported_models.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/comfy/sd.py b/comfy/sd.py index 6ba6af474..d7e89f726 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -388,8 +388,8 @@ class VAE: ddconfig = {'z_channels': 16, 'latent_channels': self.latent_channels, 'z_factor': 1, 'resolution': 1024, 'in_channels': 3, 'out_channels': 3, 'channels': 128, 'channels_mult': [2, 4, 4], 'num_res_blocks': 2, 'attn_resolutions': [32], 'dropout': 0.0, 'patch_size': 4, 'num_groups': 1, 'temporal_compression': 8, 'spacial_compression': 8} self.first_stage_model = comfy.ldm.cosmos.vae.CausalContinuousVideoTokenizer(**ddconfig) #TODO: these values are a bit off because this is not a standard VAE - self.memory_used_decode = lambda shape, dtype: (220 * shape[2] * shape[3] * shape[4] * (8 * 8 * 8)) * model_management.dtype_size(dtype) - self.memory_used_encode = lambda shape, dtype: (500 * max(shape[2], 2) * shape[3] * shape[4]) * model_management.dtype_size(dtype) + self.memory_used_decode = lambda shape, dtype: (50 * shape[2] * shape[3] * shape[4] * (8 * 8 * 8)) * model_management.dtype_size(dtype) + self.memory_used_encode = lambda shape, dtype: (50 * (round((shape[2] + 7) / 8) * 8) * shape[3] * shape[4]) * model_management.dtype_size(dtype) self.working_dtypes = [torch.bfloat16, torch.float32] else: logging.warning("WARNING: No VAE weights detected, VAE not initalized.") diff --git a/comfy/supported_models.py b/comfy/supported_models.py index ff3f14329..87fecde5a 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -788,7 +788,7 @@ class HunyuanVideo(supported_models_base.BASE): unet_extra_config = {} latent_format = latent_formats.HunyuanVideo - memory_usage_factor = 2.0 #TODO + memory_usage_factor = 1.7 #TODO supported_inference_dtypes = [torch.bfloat16, torch.float32] @@ -839,7 +839,7 @@ class CosmosT2V(supported_models_base.BASE): unet_extra_config = {} latent_format = latent_formats.Cosmos1CV8x8x8 - memory_usage_factor = 2.4 #TODO + memory_usage_factor = 1.6 #TODO supported_inference_dtypes = [torch.bfloat16, torch.float16, torch.float32] #TODO From 23289a6a5c23cd548d247bb096c56f3ad328c727 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 16 Jan 2025 04:24:39 -0500 Subject: [PATCH 018/478] Clean up some debug lines. --- comfy/ldm/cosmos/vae.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/ldm/cosmos/vae.py b/comfy/ldm/cosmos/vae.py index 94fcc54ce..c8db68612 100644 --- a/comfy/ldm/cosmos/vae.py +++ b/comfy/ldm/cosmos/vae.py @@ -89,8 +89,8 @@ class CausalContinuousVideoTokenizer(nn.Module): self.distribution = IdentityDistribution() # ContinuousFormulation[formulation_name].value() num_parameters = sum(param.numel() for param in self.parameters()) - logging.info(f"model={self.name}, num_parameters={num_parameters:,}") - logging.info( + logging.debug(f"model={self.name}, num_parameters={num_parameters:,}") + logging.debug( f"z_channels={z_channels}, latent_channels={self.latent_channels}." ) From 88ceb28e2094e97d837ea86338121ea8f9f7d38e Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 16 Jan 2025 06:31:03 -0500 Subject: [PATCH 019/478] Tweak hunyuan memory usage factor. --- comfy/supported_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 87fecde5a..ff0bea418 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -788,7 +788,7 @@ class HunyuanVideo(supported_models_base.BASE): unet_extra_config = {} latent_format = latent_formats.HunyuanVideo - memory_usage_factor = 1.7 #TODO + memory_usage_factor = 1.8 #TODO supported_inference_dtypes = [torch.bfloat16, torch.float32] From 31831e6ef13474b975eee1a94f39078e00b00156 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 16 Jan 2025 07:23:54 -0500 Subject: [PATCH 020/478] Code refactor. --- comfy/ldm/flux/layers.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/comfy/ldm/flux/layers.py b/comfy/ldm/flux/layers.py index 8e055151f..59a62e0df 100644 --- a/comfy/ldm/flux/layers.py +++ b/comfy/ldm/flux/layers.py @@ -230,8 +230,7 @@ class SingleStreamBlock(nn.Module): def forward(self, x: Tensor, vec: Tensor, pe: Tensor, attn_mask=None) -> Tensor: mod, _ = self.modulation(vec) - x_mod = (1 + mod.scale) * self.pre_norm(x) + mod.shift - qkv, mlp = torch.split(self.linear1(x_mod), [3 * self.hidden_size, self.mlp_hidden_dim], dim=-1) + qkv, mlp = torch.split(self.linear1((1 + mod.scale) * self.pre_norm(x) + mod.shift), [3 * self.hidden_size, self.mlp_hidden_dim], dim=-1) q, k, v = qkv.view(qkv.shape[0], qkv.shape[1], 3, self.num_heads, -1).permute(2, 0, 3, 1, 4) q, k = self.norm(q, k, v) From 619b8cde74538a1dc62b85e47e34daa493705c06 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 16 Jan 2025 14:54:48 -0500 Subject: [PATCH 021/478] Bump ComfyUI version to 0.3.11 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 7cccc7535..fbe4747a7 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.10" +__version__ = "0.3.11" diff --git a/pyproject.toml b/pyproject.toml index b747d6ef7..db8967b6b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.10" +version = "0.3.11" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From cca96a85ae753c9a7de722884f43b81e4eb3abff Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 16 Jan 2025 16:30:06 -0500 Subject: [PATCH 022/478] Fix cosmos VAE failing with videos longer than 121 frames. --- comfy/ldm/cosmos/vae.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/comfy/ldm/cosmos/vae.py b/comfy/ldm/cosmos/vae.py index c8db68612..d64f292de 100644 --- a/comfy/ldm/cosmos/vae.py +++ b/comfy/ldm/cosmos/vae.py @@ -18,6 +18,7 @@ import logging import torch from torch import nn from enum import Enum +import math from .cosmos_tokenizer.layers3d import ( EncoderFactorized, @@ -105,17 +106,23 @@ class CausalContinuousVideoTokenizer(nn.Module): z, posteriors = self.distribution(moments) latent_ch = z.shape[1] latent_t = z.shape[2] - dtype = z.dtype - mean = self.latent_mean.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=dtype, device=z.device) - std = self.latent_std.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=dtype, device=z.device) + in_dtype = z.dtype + mean = self.latent_mean.view(latent_ch, -1) + std = self.latent_std.view(latent_ch, -1) + + mean = mean.repeat(1, math.ceil(latent_t / mean.shape[-1]))[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) + std = std.repeat(1, math.ceil(latent_t / std.shape[-1]))[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) return ((z - mean) / std) * self.sigma_data def decode(self, z): in_dtype = z.dtype latent_ch = z.shape[1] latent_t = z.shape[2] - mean = self.latent_mean.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) - std = self.latent_std.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) + mean = self.latent_mean.view(latent_ch, -1) + std = self.latent_std.view(latent_ch, -1) + + mean = mean.repeat(1, math.ceil(latent_t / mean.shape[-1]))[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) + std = std.repeat(1, math.ceil(latent_t / std.shape[-1]))[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=in_dtype, device=z.device) z = z / self.sigma_data z = z * std + mean From 0aa2368e462664bb9a00e17660d786e69cc2e25c Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 16 Jan 2025 17:45:37 -0500 Subject: [PATCH 023/478] Fix some cosmos fp8 issues. --- comfy/ldm/cosmos/model.py | 2 +- comfy/ldm/cosmos/position_embedding.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/comfy/ldm/cosmos/model.py b/comfy/ldm/cosmos/model.py index 1205838b5..06d0baef3 100644 --- a/comfy/ldm/cosmos/model.py +++ b/comfy/ldm/cosmos/model.py @@ -293,7 +293,7 @@ class GeneralDIT(nn.Module): x_B_T_H_W_D = self.x_embedder(x_B_C_T_H_W) if self.extra_per_block_abs_pos_emb: - extra_pos_emb = self.extra_pos_embedder(x_B_T_H_W_D, fps=fps, device=x_B_C_T_H_W.device) + extra_pos_emb = self.extra_pos_embedder(x_B_T_H_W_D, fps=fps, device=x_B_C_T_H_W.device, dtype=x_B_C_T_H_W.dtype) else: extra_pos_emb = None diff --git a/comfy/ldm/cosmos/position_embedding.py b/comfy/ldm/cosmos/position_embedding.py index cf45ab0e3..4d6a58dba 100644 --- a/comfy/ldm/cosmos/position_embedding.py +++ b/comfy/ldm/cosmos/position_embedding.py @@ -41,12 +41,12 @@ def normalize(x: torch.Tensor, dim: Optional[List[int]] = None, eps: float = 0) class VideoPositionEmb(nn.Module): - def forward(self, x_B_T_H_W_C: torch.Tensor, fps=Optional[torch.Tensor], device=None) -> torch.Tensor: + def forward(self, x_B_T_H_W_C: torch.Tensor, fps=Optional[torch.Tensor], device=None, dtype=None) -> torch.Tensor: """ It delegates the embedding generation to generate_embeddings function. """ B_T_H_W_C = x_B_T_H_W_C.shape - embeddings = self.generate_embeddings(B_T_H_W_C, fps=fps, device=device) + embeddings = self.generate_embeddings(B_T_H_W_C, fps=fps, device=device, dtype=dtype) return embeddings @@ -104,6 +104,7 @@ class VideoRopePosition3DEmb(VideoPositionEmb): w_ntk_factor: Optional[float] = None, t_ntk_factor: Optional[float] = None, device=None, + dtype=None, ): """ Generate embeddings for the given input size. @@ -189,13 +190,12 @@ class LearnablePosEmbAxis(VideoPositionEmb): self.pos_emb_w = nn.Parameter(torch.empty(len_w, model_channels, device=device, dtype=dtype)) self.pos_emb_t = nn.Parameter(torch.empty(len_t, model_channels, device=device, dtype=dtype)) - - def generate_embeddings(self, B_T_H_W_C: torch.Size, fps=Optional[torch.Tensor], device=None) -> torch.Tensor: + def generate_embeddings(self, B_T_H_W_C: torch.Size, fps=Optional[torch.Tensor], device=None, dtype=None) -> torch.Tensor: B, T, H, W, _ = B_T_H_W_C if self.interpolation == "crop": - emb_h_H = self.pos_emb_h[:H].to(device=device) - emb_w_W = self.pos_emb_w[:W].to(device=device) - emb_t_T = self.pos_emb_t[:T].to(device=device) + emb_h_H = self.pos_emb_h[:H].to(device=device, dtype=dtype) + emb_w_W = self.pos_emb_w[:W].to(device=device, dtype=dtype) + emb_t_T = self.pos_emb_t[:T].to(device=device, dtype=dtype) emb = ( repeat(emb_t_T, "t d-> b t h w d", b=B, h=H, w=W) + repeat(emb_h_H, "h d-> b t h w d", b=B, t=T, w=W) From 55add502206ed5511a04215db4ab8f1cfa3d99ae Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 16 Jan 2025 18:11:57 -0500 Subject: [PATCH 024/478] Bump ComfyUI version to v0.3.12 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index fbe4747a7..411243f6c 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.11" +__version__ = "0.3.12" diff --git a/pyproject.toml b/pyproject.toml index db8967b6b..0198d1b08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.11" +version = "0.3.12" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 7fc3ccdcc2fb1f20c4b7dd4aca374db952fd66df Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 16 Jan 2025 21:17:18 -0500 Subject: [PATCH 025/478] Add that nvidia cosmos is supported to the README. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 000d76801..fd21f5624 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ This ui will let you design and execute advanced stable diffusion pipelines usin - [Mochi](https://comfyanonymous.github.io/ComfyUI_examples/mochi/) - [LTX-Video](https://comfyanonymous.github.io/ComfyUI_examples/ltxv/) - [Hunyuan Video](https://comfyanonymous.github.io/ComfyUI_examples/hunyuan_video/) + - [Nvidia Cosmos](https://comfyanonymous.github.io/ComfyUI_examples/cosmos/) - [Stable Audio](https://comfyanonymous.github.io/ComfyUI_examples/audio/) - Asynchronous Queue system - Many optimizations: Only re-executes the parts of the workflow that changes between executions. From 2f3ab40b62b44f874264b8bfae3756546a96ab44 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 17 Jan 2025 18:47:27 -0500 Subject: [PATCH 026/478] Add warning when using old pytorch versions. --- comfy/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/comfy/utils.py b/comfy/utils.py index bcefa1804..b35062824 100644 --- a/comfy/utils.py +++ b/comfy/utils.py @@ -43,7 +43,8 @@ if hasattr(torch.serialization, "add_safe_globals"): # TODO: this was added in torch.serialization.add_safe_globals([ModelCheckpoint, scalar, dtype, Float64DType, encode]) ALWAYS_SAFE_LOAD = True logging.info("Checkpoint files will always be loaded safely.") - +else: + logging.info("Warning, you are using an old pytorch version and some ckpt/pt files might be loaded unsafely. Upgrading to 2.4 or above is recommended.") def load_torch_file(ckpt, safe_load=False, device=None): if device is None: From 507199d9a8902f9dd35a90d4bd2fc3b12cdf54f1 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 18 Jan 2025 05:27:58 -0500 Subject: [PATCH 027/478] Uni pc sampler now works with audio and video models. --- comfy/extra_samplers/uni_pc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/extra_samplers/uni_pc.py b/comfy/extra_samplers/uni_pc.py index 5b80a8aff..c57e081e4 100644 --- a/comfy/extra_samplers/uni_pc.py +++ b/comfy/extra_samplers/uni_pc.py @@ -661,7 +661,7 @@ class UniPC: if x_t is None: if use_predictor: - pred_res = torch.einsum('k,bkchw->bchw', rhos_p, D1s) + pred_res = torch.tensordot(D1s, rhos_p, dims=([1], [0])) # torch.einsum('k,bkchw->bchw', rhos_p, D1s) else: pred_res = 0 x_t = x_t_ - expand_dims(alpha_t * B_h, dims) * pred_res @@ -669,7 +669,7 @@ class UniPC: if use_corrector: model_t = self.model_fn(x_t, t) if D1s is not None: - corr_res = torch.einsum('k,bkchw->bchw', rhos_c[:-1], D1s) + corr_res = torch.tensordot(D1s, rhos_c[:-1], dims=([1], [0])) # torch.einsum('k,bkchw->bchw', rhos_c[:-1], D1s) else: corr_res = 0 D1_t = (model_t - model_prev_0) From 3a3910f91dc14eccde3d991bbd74aa519f3fb95d Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Sat, 18 Jan 2025 17:47:33 -0500 Subject: [PATCH 028/478] PromptServer: Return 400 for empty filename param (#6504) --- server.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server.py b/server.py index bae898ef5..88c163fc7 100644 --- a/server.py +++ b/server.py @@ -329,6 +329,9 @@ class PromptServer(): original_ref = json.loads(post.get("original_ref")) filename, output_dir = folder_paths.annotated_filepath(original_ref['filename']) + if not filename: + return web.Response(status=400) + # validation for security: prevent accessing arbitrary path if filename[0] == '/' or '..' in filename: return web.Response(status=400) @@ -370,6 +373,9 @@ class PromptServer(): filename = request.rel_url.query["filename"] filename,output_dir = folder_paths.annotated_filepath(filename) + if not filename: + return web.Response(status=400) + # validation for security: prevent accessing arbitrary path if filename[0] == '/' or '..' in filename: return web.Response(status=400) From b1a02131c9ca3da0c27743b4727d5055269f300e Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Sat, 18 Jan 2025 17:49:51 -0500 Subject: [PATCH 029/478] Remove comfy.samplers self-import (#6506) --- comfy/samplers.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/comfy/samplers.py b/comfy/samplers.py index c508a3a41..d281ecc19 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -12,7 +12,6 @@ import collections from comfy import model_management import math import logging -import comfy.samplers import comfy.sampler_helpers import comfy.model_patcher import comfy.patcher_extension @@ -178,7 +177,7 @@ def finalize_default_conds(model: 'BaseModel', hooked_to_run: dict[comfy.hooks.H cond = default_conds[i] for x in cond: # do get_area_and_mult to get all the expected values - p = comfy.samplers.get_area_and_mult(x, x_in, timestep) + p = get_area_and_mult(x, x_in, timestep) if p is None: continue # replace p's mult with calculated mult @@ -215,7 +214,7 @@ def _calc_cond_batch(model: 'BaseModel', conds: list[list[dict]], x_in: torch.Te default_c.append(x) has_default_conds = True continue - p = comfy.samplers.get_area_and_mult(x, x_in, timestep) + p = get_area_and_mult(x, x_in, timestep) if p is None: continue if p.hooks is not None: From b4de04a1c1e90c4183d7880e49ce7e80d82c7c0a Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Sun, 19 Jan 2025 11:43:37 +0900 Subject: [PATCH 030/478] Update frontend to v1.7.14 (#6522) Co-authored-by: huchenlei <20929282+huchenlei@users.noreply.github.com> --- web/assets/BaseViewTemplate-BNGF4K22.js | 23 - web/assets/BaseViewTemplate-BhQMaVFP.js | 54 + web/assets/DesktopStartView-le6AjGZr.js | 22 + ...eC7MBzG.js => DownloadGitView-rPK_vYgU.js} | 6 +- ...D4Phn0Zr.js => ExtensionPanel-3jWrm6Zi.js} | 9 +- ...View-HVeNbkaW.js => GraphView-CDDCHVO0.js} | 1109 +- ...ew-CIRWBKTm.css => GraphView-CqZ3opAX.css} | 157 +- ...ew-CAcYt0HL.js => InstallView-By3hC1fC.js} | 71 +- ...-CwQdoH-C.css => InstallView-CxhfFC8Y.css} | 36 +- ...c3C4lG1.js => KeybindingPanel-D6O16W_1.js} | 11 +- ...s => ManualConfigurationView-CsirlNfV.css} | 4 +- ...js => ManualConfigurationView-enyqGo0M.js} | 12 +- web/assets/MetricsConsentView-lSfLu4nr.js | 86 + ...mqNj.css => NotSupportedView-DQerxQzi.css} | 8 +- ...z3x2d-.js => NotSupportedView-Vc8_xWgH.js} | 14 +- ...StJmv.js => ServerConfigPanel-B-w0HFlz.js} | 6 +- web/assets/ServerStartView-48wfE1MS.js | 101 + web/assets/ServerStartView-CIDTUh4x.js | 98 - ...N4Ib6.css => ServerStartView-CJiwVDQY.css} | 2 +- ...B3jYchWu.js => UserSelectView-CXmVKOeK.js} | 6 +- ...ew-N0ZXLjdi.js => WelcomeView-C8whKl15.js} | 6 +- web/assets/index-5HFeZax4.js | 27 - ...{index-t-sFBuUC.css => index-Cf-n7v0V.css} | 146 +- .../{index-B5F0uxTQ.js => index-DpF-ptbJ.js} | 7 +- .../{index-B-aVupP5.js => index-Q1cQr26V.js} | 4 +- .../{index-DjNHn37O.js => index-QvfM__ze.js} | 68188 +++++++++++----- web/assets/index-jXPKy3pP.js | 173 - .../{index-Bordpmzt.js => index-je62U6DH.js} | 613 +- ...YdkXn.js => keybindingService-Cak1En5n.js} | 24 +- ...KFVuP.js => serverConfigStore-DCme3xlV.js} | 4 +- web/index.html | 4 +- 31 files changed, 49852 insertions(+), 21179 deletions(-) delete mode 100644 web/assets/BaseViewTemplate-BNGF4K22.js create mode 100644 web/assets/BaseViewTemplate-BhQMaVFP.js create mode 100644 web/assets/DesktopStartView-le6AjGZr.js rename web/assets/{DownloadGitView-DeC7MBzG.js => DownloadGitView-rPK_vYgU.js} (87%) rename web/assets/{ExtensionPanel-D4Phn0Zr.js => ExtensionPanel-3jWrm6Zi.js} (91%) rename web/assets/{GraphView-HVeNbkaW.js => GraphView-CDDCHVO0.js} (94%) rename web/assets/{GraphView-CIRWBKTm.css => GraphView-CqZ3opAX.css} (70%) rename web/assets/{InstallView-CAcYt0HL.js => InstallView-By3hC1fC.js} (94%) rename web/assets/{InstallView-CwQdoH-C.css => InstallView-CxhfFC8Y.css} (70%) rename web/assets/{KeybindingPanel-Dc3C4lG1.js => KeybindingPanel-D6O16W_1.js} (92%) rename web/assets/{ManualConfigurationView-B6ecEClB.css => ManualConfigurationView-CsirlNfV.css} (59%) rename web/assets/{ManualConfigurationView-Bi_qHE-n.js => ManualConfigurationView-enyqGo0M.js} (81%) create mode 100644 web/assets/MetricsConsentView-lSfLu4nr.js rename web/assets/{NotSupportedView-bFzHmqNj.css => NotSupportedView-DQerxQzi.css} (63%) rename web/assets/{NotSupportedView-Drz3x2d-.js => NotSupportedView-Vc8_xWgH.js} (81%) rename web/assets/{ServerConfigPanel-Be4StJmv.js => ServerConfigPanel-B-w0HFlz.js} (91%) create mode 100644 web/assets/ServerStartView-48wfE1MS.js delete mode 100644 web/assets/ServerStartView-CIDTUh4x.js rename web/assets/{ServerStartView-CnyN4Ib6.css => ServerStartView-CJiwVDQY.css} (64%) rename web/assets/{UserSelectView-B3jYchWu.js => UserSelectView-CXmVKOeK.js} (89%) rename web/assets/{WelcomeView-N0ZXLjdi.js => WelcomeView-C8whKl15.js} (79%) delete mode 100644 web/assets/index-5HFeZax4.js rename web/assets/{index-t-sFBuUC.css => index-Cf-n7v0V.css} (97%) rename web/assets/{index-B5F0uxTQ.js => index-DpF-ptbJ.js} (99%) rename web/assets/{index-B-aVupP5.js => index-Q1cQr26V.js} (91%) rename web/assets/{index-DjNHn37O.js => index-QvfM__ze.js} (81%) delete mode 100644 web/assets/index-jXPKy3pP.js rename web/assets/{index-Bordpmzt.js => index-je62U6DH.js} (99%) rename web/assets/{keybindingService-Bx7YdkXn.js => keybindingService-Cak1En5n.js} (89%) rename web/assets/{serverConfigStore-CvyKFVuP.js => serverConfigStore-DCme3xlV.js} (95%) diff --git a/web/assets/BaseViewTemplate-BNGF4K22.js b/web/assets/BaseViewTemplate-BNGF4K22.js deleted file mode 100644 index b03956141..000000000 --- a/web/assets/BaseViewTemplate-BNGF4K22.js +++ /dev/null @@ -1,23 +0,0 @@ -import { d as defineComponent, o as openBlock, f as createElementBlock, J as renderSlot, T as normalizeClass } from "./index-DjNHn37O.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-BNGF4K22.js.map diff --git a/web/assets/BaseViewTemplate-BhQMaVFP.js b/web/assets/BaseViewTemplate-BhQMaVFP.js new file mode 100644 index 000000000..af2f3028c --- /dev/null +++ b/web/assets/BaseViewTemplate-BhQMaVFP.js @@ -0,0 +1,54 @@ +import { d as defineComponent, ad as ref, t as onMounted, bT as isElectron, bV as electronAPI, af as nextTick, o as openBlock, f as createElementBlock, i as withDirectives, v as vShow, m as createBaseVNode, M as renderSlot, V as normalizeClass } from "./index-QvfM__ze.js"; +const _hoisted_1 = { class: "flex-grow w-full flex items-center justify-center overflow-auto" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "BaseViewTemplate", + props: { + dark: { type: Boolean, default: false } + }, + setup(__props) { + const props = __props; + const darkTheme = { + color: "rgba(0, 0, 0, 0)", + symbolColor: "#d4d4d4" + }; + const lightTheme = { + color: "rgba(0, 0, 0, 0)", + symbolColor: "#171717" + }; + const topMenuRef = ref(null); + const isNativeWindow = ref(false); + onMounted(async () => { + if (isElectron()) { + const windowStyle = await electronAPI().Config.getWindowStyle(); + isNativeWindow.value = windowStyle === "custom"; + await nextTick(); + electronAPI().changeTheme({ + ...props.dark ? darkTheme : lightTheme, + height: topMenuRef.value.getBoundingClientRect().height + }); + } + }); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", { + class: normalizeClass(["font-sans w-screen h-screen flex flex-col pointer-events-auto", [ + props.dark ? "text-neutral-300 bg-neutral-900 dark-theme" : "text-neutral-900 bg-neutral-300" + ]]) + }, [ + withDirectives(createBaseVNode("div", { + ref_key: "topMenuRef", + ref: topMenuRef, + class: "app-drag w-full h-[var(--comfy-topbar-height)]" + }, null, 512), [ + [vShow, isNativeWindow.value] + ]), + createBaseVNode("div", _hoisted_1, [ + renderSlot(_ctx.$slots, "default") + ]) + ], 2); + }; + } +}); +export { + _sfc_main as _ +}; +//# sourceMappingURL=BaseViewTemplate-BhQMaVFP.js.map diff --git a/web/assets/DesktopStartView-le6AjGZr.js b/web/assets/DesktopStartView-le6AjGZr.js new file mode 100644 index 000000000..41a212f3a --- /dev/null +++ b/web/assets/DesktopStartView-le6AjGZr.js @@ -0,0 +1,22 @@ +import { d as defineComponent, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, k as createVNode, j as unref, ch as script } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; +const _hoisted_1 = { class: "max-w-screen-sm w-screen p-8" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "DesktopStartView", + setup(__props) { + return (_ctx, _cache) => { + return openBlock(), createBlock(_sfc_main$1, { dark: "" }, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_1, [ + createVNode(unref(script), { mode: "indeterminate" }) + ]) + ]), + _: 1 + }); + }; + } +}); +export { + _sfc_main as default +}; +//# sourceMappingURL=DesktopStartView-le6AjGZr.js.map diff --git a/web/assets/DownloadGitView-DeC7MBzG.js b/web/assets/DownloadGitView-rPK_vYgU.js similarity index 87% rename from web/assets/DownloadGitView-DeC7MBzG.js rename to web/assets/DownloadGitView-rPK_vYgU.js index 6f00b3647..c286da355 100644 --- a/web/assets/DownloadGitView-DeC7MBzG.js +++ b/web/assets/DownloadGitView-rPK_vYgU.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -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-DjNHn37O.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; +import { d as defineComponent, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, j as unref, l as script, c2 as useRouter } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.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" }; @@ -55,4 +55,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=DownloadGitView-DeC7MBzG.js.map +//# sourceMappingURL=DownloadGitView-rPK_vYgU.js.map diff --git a/web/assets/ExtensionPanel-D4Phn0Zr.js b/web/assets/ExtensionPanel-3jWrm6Zi.js similarity index 91% rename from web/assets/ExtensionPanel-D4Phn0Zr.js rename to web/assets/ExtensionPanel-3jWrm6Zi.js index 02baf6e17..3c580dd1b 100644 --- a/web/assets/ExtensionPanel-D4Phn0Zr.js +++ b/web/assets/ExtensionPanel-3jWrm6Zi.js @@ -1,9 +1,8 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -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-DjNHn37O.js"; -import { s as script$2, a as script$6 } from "./index-B5F0uxTQ.js"; -import "./index-B-aVupP5.js"; -import "./index-5HFeZax4.js"; +import { d as defineComponent, ad as ref, cu as FilterMatchMode, cz as useExtensionStore, a as useSettingStore, t as onMounted, c as computed, o as openBlock, J as createBlock, P as withCtx, k as createVNode, cv as SearchBox, j as unref, c6 as script, m as createBaseVNode, f as createElementBlock, I as renderList, Z as toDisplayString, aG as createTextVNode, H as Fragment, l as script$1, L as createCommentVNode, aK as script$3, b8 as script$4, cc as script$5, cw as _sfc_main$1 } from "./index-QvfM__ze.js"; +import { s as script$2, a as script$6 } from "./index-DpF-ptbJ.js"; +import "./index-Q1cQr26V.js"; const _hoisted_1 = { class: "flex justify-end" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "ExtensionPanel", @@ -180,4 +179,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ExtensionPanel-D4Phn0Zr.js.map +//# sourceMappingURL=ExtensionPanel-3jWrm6Zi.js.map diff --git a/web/assets/GraphView-HVeNbkaW.js b/web/assets/GraphView-CDDCHVO0.js similarity index 94% rename from web/assets/GraphView-HVeNbkaW.js rename to web/assets/GraphView-CDDCHVO0.js index 648d3aab1..34b0cd731 100644 --- a/web/assets/GraphView-HVeNbkaW.js +++ b/web/assets/GraphView-CDDCHVO0.js @@ -1,14 +1,12 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -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-DjNHn37O.js"; -import { s as script$y } from "./index-jXPKy3pP.js"; -import { s as script$A } from "./index-B-aVupP5.js"; -import { u as useKeybindingService } from "./keybindingService-Bx7YdkXn.js"; -import { u as useServerConfigStore } from "./serverConfigStore-CvyKFVuP.js"; -import "./index-5HFeZax4.js"; +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 createVNode, s as showNativeMenu, l as script$d, m as createBaseVNode, n as normalizeStyle, p as pushScopeId, q as popScopeId, _ as _export_sfc, t as onMounted, x as onBeforeUnmount, B as BaseStyle, y as script$e, z as getWidth, A as getHeight, C as getOuterWidth, D as getOuterHeight, E as getVNodeProp, F as isArray, G as mergeProps, H as Fragment, I as renderList, J as createBlock, K as resolveDynamicComponent, L as createCommentVNode, M as renderSlot, N as useSidebarTabStore, O as useBottomPanelStore, P as withCtx, Q as getAttribute, R as findSingle, S as focus, T as equals, U as Ripple, V as normalizeClass, W as getOffset, X as script$f, Y as script$g, Z as toDisplayString, $ as script$h, a0 as markRaw, a1 as defineStore, a2 as shallowRef, a3 as useI18n, a4 as useCommandStore, a5 as LiteGraph, a6 as useColorPaletteStore, a7 as watch, a8 as useNodeDefStore, a9 as BadgePosition, aa as LGraphBadge, ab as _, ac as NodeBadgeMode, ad as ref, ae as useEventListener, af as nextTick, ag as st, ah as normalizeI18nKey, ai as LGraphGroup, aj as LGraphNode, ak as EditableText, al as isNotEmpty, am as UniqueComponentId, an as ZIndex, ao as resolveFieldData, ap as OverlayEventBus, aq as isEmpty, ar as addStyle, as as relativePosition, at as absolutePosition, au as ConnectedOverlayScrollHandler, av as isTouchDevice, aw as findLastIndex, ax as script$i, ay as script$j, az as script$k, aA as script$l, aB as script$m, aC as script$n, aD as resolveComponent, aE as Transition, aF as createSlots, aG as createTextVNode, aH as useNodeFrequencyStore, aI as useNodeBookmarkStore, aJ as highlightQuery, aK as script$o, aL as formatNumberWithSuffix, aM as NodeSourceType, 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 usePragmaticDraggable, b2 as usePragmaticDroppable, b3 as withModifiers, b4 as useWorkflowService, b5 as useWorkflowBookmarkStore, b6 as script$r, b7 as script$s, b8 as script$t, b9 as LinkMarkerShape, ba as useModelToNodeStore, bb as getStorageValue, bc as CanvasPointer, bd as IS_CONTROL_WIDGET, be as updateControlWidgetLabel, bf as useColorPaletteService, bg as setStorageValue, bh as api, bi as LGraph, bj as LLink, bk as DragAndScale, bl as LGraphCanvas, bm as ContextMenu, bn as ChangeTracker, bo as ComfyNodeDefImpl, bp as ComfyModelDef, bq as script$u, br as script$v, bs as script$w, bt as script$x, bu as script$y, bv as normalizeProps, bw as ToastEventBus, bx as setAttribute, by as TransitionGroup, bz as useToast, bA as useToastStore, bB as resolve, bC as nestedPosition, bD as script$z, bE as isPrintableCharacter, bF as useQueueSettingsStore, bG as script$A, bH as useQueuePendingTaskCountStore, bI as useLocalStorage, bJ as useDraggable, bK as watchDebounced, bL as inject, bM as useElementBounding, bN as script$B, bO as lodashExports, bP as useEventBus, bQ as script$C, bR as guardReactiveProps, bS as useMenuItemStore, bT as isElectron, bU as provide, bV as electronAPI, bW as useDialogService, bX as LGraphEventMode, bY as useQueueStore, bZ as DEFAULT_DARK_COLOR_PALETTE, b_ as DEFAULT_LIGHT_COLOR_PALETTE, b$ as i18n, c0 as useErrorHandling, c1 as useModelStore } from "./index-QvfM__ze.js"; +import { s as script$D } from "./index-Q1cQr26V.js"; +import { u as useKeybindingService } from "./keybindingService-Cak1En5n.js"; +import { u as useServerConfigStore } from "./serverConfigStore-DCme3xlV.js"; const DEFAULT_TITLE = "ComfyUI"; const TITLE_SUFFIX = " - ComfyUI"; -const _sfc_main$t = /* @__PURE__ */ defineComponent({ +const _sfc_main$u = /* @__PURE__ */ defineComponent({ __name: "BrowserTabTitle", setup(__props) { const executionStore = useExecutionStore(); @@ -40,7 +38,9 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({ }; } }); -const _sfc_main$s = /* @__PURE__ */ defineComponent({ +const _withScopeId$9 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-7ed57d1a"), n = n(), popScopeId(), n), "_withScopeId$9"); +const _hoisted_1$q = { class: "window-actions-spacer" }; +const _sfc_main$t = /* @__PURE__ */ defineComponent({ __name: "MenuHamburger", setup(__props) { const workspaceState = useWorkspaceStore(); @@ -68,29 +68,39 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({ ); return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); - return withDirectives((openBlock(), createBlock(unref(script$d), { - 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 }] + return withDirectives((openBlock(), createElementBlock("div", { + class: "comfy-menu-hamburger no-drag", + style: normalizeStyle(positionCSS.value) + }, [ + withDirectives(createVNode(unref(script$d), { + icon: "pi pi-bars", + severity: "secondary", + text: "", + size: "large", + "aria-label": _ctx.$t("menu.showMenu"), + "aria-live": "assertive", + onClick: exitFocusMode, + onContextmenu: unref(showNativeMenu) + }, null, 8, ["aria-label", "onContextmenu"]), [ + [_directive_tooltip, { value: _ctx.$t("menu.showMenu"), showDelay: 300 }] + ]), + withDirectives(createBaseVNode("div", _hoisted_1$q, null, 512), [ + [vShow, menuSetting.value !== "Bottom"] + ]) + ], 4)), [ + [vShow, unref(workspaceState).focusMode] ]); }; } }); -const MenuHamburger = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-5661bed0"]]); -const _sfc_main$r = /* @__PURE__ */ defineComponent({ +const MenuHamburger = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-7ed57d1a"]]); +const _sfc_main$s = /* @__PURE__ */ defineComponent({ __name: "UnloadWindowConfirmDialog", setup(__props) { const settingStore = useSettingStore(); + const workflowStore = useWorkflowStore(); const handleBeforeUnload = /* @__PURE__ */ __name((event) => { - if (settingStore.get("Comfy.Window.UnloadConfirmation")) { + if (settingStore.get("Comfy.Window.UnloadConfirmation") && workflowStore.modifiedWorkflows.length > 0) { event.preventDefault(); return true; } @@ -542,7 +552,7 @@ var script$c = { }, "getPTOptions") } }; -var _hoisted_1$m = ["onMousedown", "onTouchstart", "onTouchmove", "onTouchend"]; +var _hoisted_1$p = ["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({ @@ -587,7 +597,7 @@ function render$j(_ctx, _cache, $props, $setup, $data, $options) { return $options.onGutterKeyDown($event, i); }, "onKeydown"), ref_for: true - }, _ctx.ptm("gutterHandle")), null, 16, _hoisted_2$j)], 16, _hoisted_1$m)) : createCommentVNode("", true)], 64); + }, _ctx.ptm("gutterHandle")), null, 16, _hoisted_2$j)], 16, _hoisted_1$p)) : createCommentVNode("", true)], 64); }), 128))], 16); } __name(render$j, "render$j"); @@ -659,7 +669,7 @@ function render$i(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$i, "render$i"); script$b.render = render$i; -const _sfc_main$q = /* @__PURE__ */ defineComponent({ +const _sfc_main$r = /* @__PURE__ */ defineComponent({ __name: "LiteGraphCanvasSplitterOverlay", setup(__props) { const settingStore = useSettingStore(); @@ -746,7 +756,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({ }; } }); -const LiteGraphCanvasSplitterOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-e50caa15"]]); +const LiteGraphCanvasSplitterOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-e50caa15"]]); var classes$8 = { root: /* @__PURE__ */ __name(function root4(_ref) { var instance = _ref.instance, props = _ref.props; @@ -1112,9 +1122,9 @@ var script$9 = { ripple: Ripple } }; -var _hoisted_1$l = ["aria-label", "tabindex"]; +var _hoisted_1$o = ["aria-label", "tabindex"]; var _hoisted_2$i = ["aria-orientation"]; -var _hoisted_3$g = ["aria-label", "tabindex"]; +var _hoisted_3$h = ["aria-label", "tabindex"]; function render$g(_ctx, _cache, $props, $setup, $data, $options) { var _directive_ripple = resolveDirective("ripple"); return openBlock(), createElementBlock("div", mergeProps({ @@ -1133,7 +1143,7 @@ function render$g(_ctx, _cache, $props, $setup, $data, $options) { "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({ + }, _ctx.ptm("prevIcon")), null, 16))], 16, _hoisted_1$o)), [[_directive_ripple]]) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ ref: "content", "class": _ctx.cx("content"), onScroll: _cache[1] || (_cache[1] = function() { @@ -1162,11 +1172,11 @@ function render$g(_ctx, _cache, $props, $setup, $data, $options) { "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); + }, _ctx.ptm("nextIcon")), null, 16))], 16, _hoisted_3$h)), [[_directive_ripple]]) : createCommentVNode("", true)], 16); } __name(render$g, "render$g"); script$9.render = render$g; -const _sfc_main$p = /* @__PURE__ */ defineComponent({ +const _sfc_main$q = /* @__PURE__ */ defineComponent({ __name: "ExtensionSlot", props: { extension: {} @@ -1195,17 +1205,17 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$k = { class: "flex flex-col h-full" }; +const _hoisted_1$n = { 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_3$g = { class: "tabs-container" }; +const _hoisted_4$6 = { class: "font-bold" }; const _hoisted_5$4 = { class: "flex-grow h-0" }; -const _sfc_main$o = /* @__PURE__ */ defineComponent({ +const _sfc_main$p = /* @__PURE__ */ defineComponent({ __name: "BottomPanel", setup(__props) { const bottomPanelStore = useBottomPanelStore(); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$k, [ + return openBlock(), createElementBlock("div", _hoisted_1$n, [ createVNode(unref(script$h), { value: unref(bottomPanelStore).activeBottomPanelTabId, "onUpdate:value": _cache[1] || (_cache[1] = ($event) => unref(bottomPanelStore).activeBottomPanelTabId = $event) @@ -1214,7 +1224,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ createVNode(unref(script$9), { "pt:tabList": "border-none" }, { default: withCtx(() => [ createBaseVNode("div", _hoisted_2$h, [ - createBaseVNode("div", _hoisted_3$f, [ + createBaseVNode("div", _hoisted_3$g, [ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(bottomPanelStore).bottomPanelTabs, (tab) => { return openBlock(), createBlock(unref(script$a), { key: tab.id, @@ -1222,7 +1232,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ class: "p-3 border-none" }, { default: withCtx(() => [ - createBaseVNode("span", _hoisted_4$5, toDisplayString(tab.title.toUpperCase()), 1) + createBaseVNode("span", _hoisted_4$6, toDisplayString(tab.title.toUpperCase()), 1) ]), _: 2 }, 1032, ["value"]); @@ -1244,7 +1254,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ _: 1 }, 8, ["value"]), createBaseVNode("div", _hoisted_5$4, [ - unref(bottomPanelStore).bottomPanelVisible && unref(bottomPanelStore).activeBottomPanelTab ? (openBlock(), createBlock(_sfc_main$p, { + unref(bottomPanelStore).bottomPanelVisible && unref(bottomPanelStore).activeBottomPanelTab ? (openBlock(), createBlock(_sfc_main$q, { key: 0, extension: unref(bottomPanelStore).activeBottomPanelTab }, null, 8, ["extension"])) : createCommentVNode("", true) @@ -1253,7 +1263,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$j = { +const _hoisted_1$m = { viewBox: "0 0 1024 1024", width: "1.2em", height: "1.2em" @@ -1262,15 +1272,15 @@ 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 = [ +const _hoisted_3$f = [ _hoisted_2$g ]; function render$f(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$j, [..._hoisted_3$e]); + return openBlock(), createElementBlock("svg", _hoisted_1$m, [..._hoisted_3$f]); } __name(render$f, "render$f"); const __unplugin_components_1$2 = markRaw({ name: "simple-line-icons-cursor", render: render$f }); -const _hoisted_1$i = { +const _hoisted_1$l = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" @@ -1279,11 +1289,11 @@ 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 = [ +const _hoisted_3$e = [ _hoisted_2$f ]; function render$e(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$i, [..._hoisted_3$d]); + return openBlock(), createElementBlock("svg", _hoisted_1$l, [..._hoisted_3$e]); } __name(render$e, "render$e"); const __unplugin_components_0$2 = markRaw({ name: "material-symbols-pan-tool-outline", render: render$e }); @@ -1335,7 +1345,7 @@ const useCanvasStore = defineStore("canvas", () => { canvas }; }); -const _sfc_main$n = /* @__PURE__ */ defineComponent({ +const _sfc_main$o = /* @__PURE__ */ defineComponent({ __name: "GraphCanvasMenu", setup(__props) { const { t } = useI18n(); @@ -1367,9 +1377,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ withDirectives(createVNode(unref(script$d), { severity: "secondary", icon: "pi pi-plus", + "aria-label": _ctx.$t("graphCanvasMenu.zoomIn"), onMousedown: _cache[0] || (_cache[0] = ($event) => repeat2("Comfy.Canvas.ZoomIn")), onMouseup: stopRepeat - }, null, 512), [ + }, null, 8, ["aria-label"]), [ [ _directive_tooltip, unref(t)("graphCanvasMenu.zoomIn"), @@ -1380,9 +1391,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ withDirectives(createVNode(unref(script$d), { severity: "secondary", icon: "pi pi-minus", + "aria-label": _ctx.$t("graphCanvasMenu.zoomOut"), onMousedown: _cache[1] || (_cache[1] = ($event) => repeat2("Comfy.Canvas.ZoomOut")), onMouseup: stopRepeat - }, null, 512), [ + }, null, 8, ["aria-label"]), [ [ _directive_tooltip, unref(t)("graphCanvasMenu.zoomOut"), @@ -1393,8 +1405,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ withDirectives(createVNode(unref(script$d), { severity: "secondary", icon: "pi pi-expand", + "aria-label": _ctx.$t("graphCanvasMenu.fitView"), onClick: _cache[2] || (_cache[2] = () => unref(commandStore).execute("Comfy.Canvas.FitView")) - }, null, 512), [ + }, null, 8, ["aria-label"]), [ [ _directive_tooltip, unref(t)("graphCanvasMenu.fitView"), @@ -1404,13 +1417,16 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ ]), withDirectives((openBlock(), createBlock(unref(script$d), { severity: "secondary", + "aria-label": unref(t)( + "graphCanvasMenu." + (unref(canvasStore).canvas?.read_only ? "panMode" : "selectMode") + ), 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 - })), [ + }, 8, ["aria-label"])), [ [ _directive_tooltip, unref(t)( @@ -1423,9 +1439,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ withDirectives(createVNode(unref(script$d), { severity: "secondary", icon: linkHidden.value ? "pi pi-eye-slash" : "pi pi-eye", + "aria-label": _ctx.$t("graphCanvasMenu.toggleLinkVisibility"), onClick: _cache[4] || (_cache[4] = () => unref(commandStore).execute("Comfy.Canvas.ToggleLinkVisibility")), "data-testid": "toggle-link-visibility-button" - }, null, 8, ["icon"]), [ + }, null, 8, ["icon", "aria-label"]), [ [ _directive_tooltip, unref(t)("graphCanvasMenu.toggleLinkVisibility"), @@ -1439,8 +1456,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ }; } }); -const GraphCanvasMenu = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-cf40dd39"]]); -const _sfc_main$m = /* @__PURE__ */ defineComponent({ +const GraphCanvasMenu = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-cb8f9a1a"]]); +const _sfc_main$n = /* @__PURE__ */ defineComponent({ __name: "NodeBadge", setup(__props) { const settingStore = useSettingStore(); @@ -1493,7 +1510,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({ }; } }); -const _sfc_main$l = /* @__PURE__ */ defineComponent({ +const _sfc_main$m = /* @__PURE__ */ defineComponent({ __name: "NodeTooltip", setup(__props) { let idleTimeout; @@ -1582,8 +1599,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({ }; } }); -const NodeTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-46859edf"]]); -const _sfc_main$k = /* @__PURE__ */ defineComponent({ +const NodeTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-46859edf"]]); +const _sfc_main$l = /* @__PURE__ */ defineComponent({ __name: "TitleEditor", setup(__props) { const settingStore = useSettingStore(); @@ -1690,7 +1707,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({ }; } }); -const TitleEditor = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-12d3fd12"]]); +const TitleEditor = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-12d3fd12"]]); const useSearchBoxStore = defineStore("searchBox", () => { const visible = ref(false); function toggleVisible() { @@ -2873,10 +2890,10 @@ function _toPrimitive$4(t, r) { return ("string" === r ? String : Number)(t); } __name(_toPrimitive$4, "_toPrimitive$4"); -var _hoisted_1$h = ["aria-activedescendant"]; +var _hoisted_1$k = ["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_3$d = ["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_5$3 = ["id"]; var _hoisted_6$2 = ["id", "aria-label"]; var _hoisted_7$1 = ["id"]; @@ -3024,7 +3041,7 @@ function render$c(_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$c)], 16)], 16, _hoisted_1$h)) : createCommentVNode("", true), $data.searching || _ctx.loading ? renderSlot(_ctx.$slots, _ctx.$slots.loader ? "loader" : "loadingicon", { + }, _ctx.ptm("input")), null, 16, _hoisted_3$d)], 16)], 16, _hoisted_1$k)) : createCommentVNode("", true), $data.searching || _ctx.loading ? renderSlot(_ctx.$slots, _ctx.$slots.loader ? "loader" : "loadingicon", { key: 2, "class": normalizeClass(_ctx.cx("loader")) }, function() { @@ -3061,7 +3078,7 @@ function render$c(_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$4)) : createCommentVNode("", true)]; + })], 16, _hoisted_4$5)) : createCommentVNode("", true)]; }), createBaseVNode("span", mergeProps({ role: "status", "aria-live": "polite", @@ -3206,7 +3223,7 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$c, "render$c"); script$7.render = render$c; -const _sfc_main$j = { +const _sfc_main$k = { name: "AutoCompletePlus", extends: script$7, emits: ["focused-option-changed"], @@ -3222,23 +3239,23 @@ const _sfc_main$j = { ); } }; -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 _withScopeId$8 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-fd0a74bd"), n = n(), popScopeId(), n), "_withScopeId$8"); +const _hoisted_1$j = { 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_3$c = { key: 0 }; +const _hoisted_4$4 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ createBaseVNode("i", { class: "pi pi-bookmark-fill text-sm mr-1" }, null, -1)); const _hoisted_5$2 = [ - _hoisted_4$3 + _hoisted_4$4 ]; const _hoisted_6$1 = ["innerHTML"]; -const _hoisted_7 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ createBaseVNode("span", null, " ", -1)); +const _hoisted_7 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ createBaseVNode("span", null, " ", -1)); const _hoisted_8 = ["innerHTML"]; const _hoisted_9 = { key: 0, - class: "option-category font-light text-sm text-gray-400 overflow-hidden text-ellipsis whitespace-nowrap" + class: "option-category font-light text-sm text-muted overflow-hidden text-ellipsis whitespace-nowrap" }; const _hoisted_10 = { class: "option-badges" }; -const _sfc_main$i = /* @__PURE__ */ defineComponent({ +const _sfc_main$j = /* @__PURE__ */ defineComponent({ __name: "NodeSearchItem", props: { nodeDef: {}, @@ -3265,10 +3282,10 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ ); const props = __props; return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$g, [ + return openBlock(), createElementBlock("div", _hoisted_1$j, [ createBaseVNode("div", _hoisted_2$d, [ createBaseVNode("div", null, [ - isBookmarked.value ? (openBlock(), createElementBlock("span", _hoisted_3$b, _hoisted_5$2)) : createCommentVNode("", true), + isBookmarked.value ? (openBlock(), createElementBlock("span", _hoisted_3$c, _hoisted_5$2)) : createCommentVNode("", true), createBaseVNode("span", { innerHTML: unref(highlightQuery)(_ctx.nodeDef.display_name, _ctx.currentQuery) }, null, 8, _hoisted_6$1), @@ -3317,15 +3334,15 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ }; } }); -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 NodeSearchItem = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-fd0a74bd"]]); +const _hoisted_1$i = { 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$a = /* @__PURE__ */ createBaseVNode("h3", null, "Add node filter condition", -1); -const _hoisted_4$2 = { class: "_dialog-body" }; -const _sfc_main$h = /* @__PURE__ */ defineComponent({ +const _hoisted_3$b = /* @__PURE__ */ createBaseVNode("h3", null, "Add node filter condition", -1); +const _hoisted_4$3 = { class: "_dialog-body" }; +const _sfc_main$i = /* @__PURE__ */ defineComponent({ __name: "NodeSearchBox", props: { filters: {}, @@ -3371,7 +3388,6 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ const onAddFilter = /* @__PURE__ */ __name((filterAndValue) => { nodeSearchFilterVisible.value = false; emit("addFilter", filterAndValue); - reFocusInput(); }, "onAddFilter"); const onRemoveFilter = /* @__PURE__ */ __name((event, filterAndValue) => { event.stopPropagation(); @@ -3388,7 +3404,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ hoveredSuggestion.value = value; }, "setHoverSuggestion"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$f, [ + return openBlock(), createElementBlock("div", _hoisted_1$i, [ enableNodePreview.value ? (openBlock(), createElementBlock("div", _hoisted_2$c, [ hoveredSuggestion.value ? (openBlock(), createBlock(NodePreview, { nodeDef: hoveredSuggestion.value, @@ -3404,19 +3420,22 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ createVNode(unref(script$p), { visible: nodeSearchFilterVisible.value, "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => nodeSearchFilterVisible.value = $event), - class: "min-w-96" + class: "min-w-96", + "dismissable-mask": "", + modal: "", + onHide: reFocusInput }, { header: withCtx(() => [ - _hoisted_3$a + _hoisted_3$b ]), default: withCtx(() => [ - createBaseVNode("div", _hoisted_4$2, [ + createBaseVNode("div", _hoisted_4$3, [ createVNode(NodeSearchFilter, { onAddFilter }) ]) ]), _: 1 }, 8, ["visible"]), - createVNode(_sfc_main$j, { + createVNode(_sfc_main$k, { "model-value": props.filters, class: "comfy-vue-node-search-box z-10 flex-grow", scrollHeight: "40vh", @@ -3457,7 +3476,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({ }; } }); -const _sfc_main$g = /* @__PURE__ */ defineComponent({ +const _sfc_main$h = /* @__PURE__ */ defineComponent({ __name: "NodeSearchBoxPopover", setup(__props) { const settingStore = useSettingStore(); @@ -3638,7 +3657,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({ } }, { container: withCtx(() => [ - createVNode(_sfc_main$h, { + createVNode(_sfc_main$i, { filters: nodeFilters.value, onAddFilter: addFilter, onRemoveFilter: removeFilter, @@ -3692,7 +3711,7 @@ function render$b(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$b, "render$b"); script$6.render = render$b; -const _sfc_main$f = /* @__PURE__ */ defineComponent({ +const _sfc_main$g = /* @__PURE__ */ defineComponent({ __name: "SidebarIcon", props: { icon: String, @@ -3754,8 +3773,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({ }; } }); -const SidebarIcon = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-6ab4daa6"]]); -const _sfc_main$e = /* @__PURE__ */ defineComponent({ +const SidebarIcon = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-6ab4daa6"]]); +const _sfc_main$f = /* @__PURE__ */ defineComponent({ __name: "SidebarLogoutIcon", setup(__props) { const { t } = useI18n(); @@ -3776,7 +3795,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({ }; } }); -const _sfc_main$d = /* @__PURE__ */ defineComponent({ +const _sfc_main$e = /* @__PURE__ */ defineComponent({ __name: "SidebarSettingsToggleIcon", setup(__props) { const dialogStore = useDialogStore(); @@ -3797,13 +3816,12 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({ }; } }); -const _sfc_main$c = /* @__PURE__ */ defineComponent({ +const _sfc_main$d = /* @__PURE__ */ defineComponent({ __name: "SidebarThemeToggleIcon", setup(__props) { - const settingStore = useSettingStore(); - const currentTheme = computed(() => settingStore.get("Comfy.ColorPalette")); + const colorPaletteStore = useColorPaletteStore(); const icon = computed( - () => currentTheme.value !== "light" ? "pi pi-moon" : "pi pi-sun" + () => colorPaletteStore.completedActivePalette.light_theme ? "pi pi-sun" : "pi pi-moon" ); const commandStore = useCommandStore(); const toggleTheme = /* @__PURE__ */ __name(() => { @@ -3819,13 +3837,13 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ }; } }); -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 _withScopeId$7 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-33cac83a"), n = n(), popScopeId(), n), "_withScopeId$7"); +const _hoisted_1$h = { 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({ +const _sfc_main$c = /* @__PURE__ */ defineComponent({ __name: "SideToolbar", setup(__props) { const workspaceStore = useWorkspaceStore(); @@ -3853,7 +3871,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ return openBlock(), createElementBlock(Fragment, null, [ (openBlock(), createBlock(Teleport, { to: teleportTarget.value }, [ createBaseVNode("nav", { - class: normalizeClass("side-tool-bar-container" + (isSmall.value ? " small-sidebar" : "")) + class: normalizeClass(["side-tool-bar-container", { "small-sidebar": isSmall.value }]) }, [ (openBlock(true), createElementBlock(Fragment, null, renderList(tabs.value, (tab) => { return openBlock(), createBlock(SidebarIcon, { @@ -3866,21 +3884,277 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ 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) + createBaseVNode("div", _hoisted_1$h, [ + unref(userStore).isMultiUserServer ? (openBlock(), createBlock(_sfc_main$f, { key: 0 })) : createCommentVNode("", true), + createVNode(_sfc_main$d), + createVNode(_sfc_main$e) ]) ], 2) ], 8, ["to"])), selectedTab.value ? (openBlock(), createElementBlock("div", _hoisted_2$b, [ - createVNode(_sfc_main$p, { extension: selectedTab.value }, null, 8, ["extension"]) + createVNode(_sfc_main$q, { extension: selectedTab.value }, null, 8, ["extension"]) ])) : createCommentVNode("", true) ], 64); }; } }); -const SideToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-37d8d7b4"]]); +const SideToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-33cac83a"]]); +const _withScopeId$6 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-8d011a31"), n = n(), popScopeId(), n), "_withScopeId$6"); +const _hoisted_1$g = { class: "workflow-label text-sm max-w-[150px] truncate inline-block" }; +const _hoisted_2$a = { class: "relative" }; +const _hoisted_3$a = { + key: 0, + class: "status-indicator" +}; +const _sfc_main$b = /* @__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$g, [ + createTextVNode(toDisplayString(_ctx.workflowOption.workflow.filename), 1) + ])), [ + [ + _directive_tooltip, + _ctx.workflowOption.workflow.key, + void 0, + { bottom: true } + ] + ]), + createBaseVNode("div", _hoisted_2$a, [ + !unref(workspaceStore).shiftDown && (_ctx.workflowOption.workflow.isModified || !_ctx.workflowOption.workflow.isPersisted) ? (openBlock(), createElementBlock("span", _hoisted_3$a, "•")) : 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$b, [["__scopeId", "data-v-8d011a31"]]); +const _withScopeId$5 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-54fadc45"), n = n(), popScopeId(), n), "_withScopeId$5"); +const _hoisted_1$f = { class: "workflow-tabs-container flex flex-row max-w-full h-full" }; +const _sfc_main$a = /* @__PURE__ */ defineComponent({ + __name: "WorkflowTabs", + props: { + class: {} + }, + setup(__props) { + const props = __props; + const { t } = useI18n(); + const workspaceStore = useWorkspaceStore(); + const workflowStore = useWorkflowStore(); + const workflowService = useWorkflowService(); + const workflowBookmarkStore = useWorkflowBookmarkStore(); + 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 + }, + { + label: workflowBookmarkStore.isBookmarked(tab.workflow.path) ? t("tabMenu.removeFromBookmarks") : t("tabMenu.addToBookmarks"), + command: /* @__PURE__ */ __name(() => workflowBookmarkStore.toggleBookmarked(tab.workflow.path), "command"), + disabled: tab.workflow.isTemporary + } + ]; + }); + const commandStore = useCommandStore(); + const handleWheel = /* @__PURE__ */ __name((event) => { + const scrollElement = event.currentTarget; + const scrollAmount = event.deltaX || event.deltaY; + scrollElement.scroll({ + left: scrollElement.scrollLeft + scrollAmount + }); + }, "handleWheel"); + return (_ctx, _cache) => { + const _directive_tooltip = resolveDirective("tooltip"); + return openBlock(), createElementBlock("div", _hoisted_1$f, [ + createVNode(unref(script$s), { + class: "overflow-hidden no-drag", + "pt:content": { + class: "p-0 w-full", + onwheel: handleWheel + }, + "pt:barX": "h-1" + }, { + default: withCtx(() => [ + createVNode(unref(script$r), { + class: normalizeClass(["workflow-tabs bg-transparent", 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"]) + ]), + _: 1 + }, 8, ["pt:content"]), + withDirectives(createVNode(unref(script$d), { + class: "new-blank-workflow-button flex-shrink-0 no-drag", + icon: "pi pi-plus", + text: "", + severity: "secondary", + "aria-label": _ctx.$t("sideToolbar.newBlankWorkflow"), + onClick: _cache[0] || (_cache[0] = () => unref(commandStore).execute("Comfy.NewBlankWorkflow")) + }, null, 8, ["aria-label"]), [ + [_directive_tooltip, { value: _ctx.$t("sideToolbar.newBlankWorkflow"), showDelay: 300 }] + ]), + createVNode(unref(script$t), { + ref_key: "menu", + ref: menu, + model: contextMenuItems.value + }, null, 8, ["model"]) + ]); + }; + } +}); +const WorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-54fadc45"]]); +const _withScopeId$4 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-38831d8e"), n = n(), popScopeId(), n), "_withScopeId$4"); +const _hoisted_1$e = { class: "absolute top-0 left-0 w-auto max-w-full pointer-events-auto" }; +const _sfc_main$9 = /* @__PURE__ */ defineComponent({ + __name: "SecondRowWorkflowTabs", + setup(__props) { + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", _hoisted_1$e, [ + createVNode(WorkflowTabs) + ]); + }; + } +}); +const SecondRowWorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-38831d8e"]]); const CORE_SETTINGS = [ { id: "Comfy.Validation.Workflows", @@ -3959,7 +4233,8 @@ const CORE_SETTINGS = [ name: "Sidebar size", type: "combo", options: ["normal", "small"], - defaultValue: /* @__PURE__ */ __name(() => window.innerWidth < 1600 ? "small" : "normal", "defaultValue") + // Default to small if the window is less than 1536px(2xl) wide. + defaultValue: /* @__PURE__ */ __name(() => window.innerWidth < 1536 ? "small" : "normal", "defaultValue") }, { id: "Comfy.TextareaWidget.FontSize", @@ -4101,7 +4376,8 @@ const CORE_SETTINGS = [ id: "Comfy.Window.UnloadConfirmation", name: "Show confirmation when closing window", type: "boolean", - defaultValue: false + defaultValue: true, + versionModified: "1.7.12" }, { id: "Comfy.TreeExplorer.ItemPadding", @@ -4266,8 +4542,9 @@ const CORE_SETTINGS = [ id: "Comfy.Workflow.WorkflowTabsPosition", name: "Opened workflows position", type: "combo", - options: ["Sidebar", "Topbar"], - defaultValue: "Topbar" + options: ["Sidebar", "Topbar", "Topbar (2nd-row)"], + // Default to topbar (2nd-row) if the window is less than 1536px(2xl) wide. + defaultValue: /* @__PURE__ */ __name(() => window.innerWidth < 1536 ? "Topbar (2nd-row)" : "Topbar", "defaultValue") }, { id: "Comfy.Graph.CanvasMenu", @@ -4289,7 +4566,16 @@ const CORE_SETTINGS = [ name: "Keybindings unset by the user", type: "hidden", defaultValue: [], - versionAdded: "1.3.7" + versionAdded: "1.3.7", + versionModified: "1.7.3", + migrateDeprecatedValue: /* @__PURE__ */ __name((value) => { + return value.map((keybinding) => { + if (keybinding["targetSelector"] === "#graph-canvas") { + keybinding["targetElementId"] = "graph-canvas"; + } + return keybinding; + }); + }, "migrateDeprecatedValue") }, { id: "Comfy.Keybinding.NewBindings", @@ -4550,7 +4836,7 @@ const CORE_SETTINGS = [ versionModified: "1.6.10" } ]; -const _sfc_main$a = /* @__PURE__ */ defineComponent({ +const _sfc_main$8 = /* @__PURE__ */ defineComponent({ __name: "GraphCanvas", emits: ["ready"], setup(__props, { emit: __emit }) { @@ -4565,10 +4851,31 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({ const betaMenuEnabled = computed( () => settingStore.get("Comfy.UseNewMenu") !== "Disabled" ); + const workflowTabsPosition = computed( + () => settingStore.get("Comfy.Workflow.WorkflowTabsPosition") + ); const canvasMenuEnabled = computed( () => settingStore.get("Comfy.Graph.CanvasMenu") ); const tooltipEnabled = computed(() => settingStore.get("Comfy.EnableTooltips")); + const storedWorkflows = JSON.parse( + getStorageValue("Comfy.OpenWorkflowsPaths") || "[]" + ); + const storedActiveIndex = JSON.parse( + getStorageValue("Comfy.ActiveWorkflowIndex") || "-1" + ); + const openWorkflows = computed(() => workspaceStore?.workflow?.openWorkflows); + const activeWorkflow = computed(() => workspaceStore?.workflow?.activeWorkflow); + const restoreState2 = computed(() => { + if (!openWorkflows.value || !activeWorkflow.value) { + return { paths: [], activeIndex: -1 }; + } + const paths = openWorkflows.value.filter((workflow) => workflow?.isPersisted && !workflow.isModified).map((workflow) => workflow.path); + const activeIndex = openWorkflows.value.findIndex( + (workflow) => workflow.path === activeWorkflow.value?.path + ); + return { paths, activeIndex }; + }); watchEffect(() => { const canvasInfoEnabled = settingStore.get("Comfy.Graph.CanvasInfo"); if (canvasStore.canvas) { @@ -4799,6 +5106,16 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({ colorPaletteStore.customPalettes = settingStore.get( "Comfy.CustomColorPalettes" ); + const isRestorable = storedWorkflows?.length > 0 && storedActiveIndex >= 0; + if (isRestorable) + workflowStore.openWorkflowsInBackground({ + left: storedWorkflows.slice(0, storedActiveIndex), + right: storedWorkflows.slice(storedActiveIndex) + }); + watch(restoreState2, ({ paths, activeIndex }) => { + setStorageValue("Comfy.OpenWorkflowsPaths", JSON.stringify(paths)); + setStorageValue("Comfy.ActiveWorkflowIndex", JSON.stringify(activeIndex)); + }); watch( () => settingStore.get("Comfy.Locale"), async () => { @@ -4816,10 +5133,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({ createVNode(SideToolbar) ]), "bottom-panel": withCtx(() => [ - createVNode(_sfc_main$o) + createVNode(_sfc_main$p) ]), "graph-canvas-panel": withCtx(() => [ - canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { key: 0 })) : createCommentVNode("", true) + workflowTabsPosition.value === "Topbar (2nd-row)" ? (openBlock(), createBlock(SecondRowWorkflowTabs, { key: 0 })) : createCommentVNode("", true), + canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { key: 1 })) : createCommentVNode("", true) ]), _: 1 })) : createCommentVNode("", true), @@ -4832,9 +5150,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({ tabindex: "1" }, null, 512) ])), - createVNode(_sfc_main$g), + createVNode(_sfc_main$h), tooltipEnabled.value ? (openBlock(), createBlock(NodeTooltip, { key: 0 })) : createCommentVNode("", true), - createVNode(_sfc_main$m) + createVNode(_sfc_main$n) ], 64); }; } @@ -5049,10 +5367,10 @@ var script$1$3 = { computed: { iconComponent: /* @__PURE__ */ __name(function iconComponent() { return { - info: !this.infoIcon && script$r, - success: !this.successIcon && script$s, - warn: !this.warnIcon && script$t, - error: !this.errorIcon && script$u + info: !this.infoIcon && script$u, + success: !this.successIcon && script$v, + warn: !this.warnIcon && script$w, + error: !this.errorIcon && script$x }[this.message.severity]; }, "iconComponent"), closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel() { @@ -5060,11 +5378,11 @@ var script$1$3 = { }, "closeAriaLabel") }, components: { - TimesIcon: script$v, - InfoCircleIcon: script$r, - CheckIcon: script$s, - ExclamationTriangleIcon: script$t, - TimesCircleIcon: script$u + TimesIcon: script$y, + InfoCircleIcon: script$u, + CheckIcon: script$v, + ExclamationTriangleIcon: script$w, + TimesCircleIcon: script$x }, directives: { ripple: Ripple @@ -5410,7 +5728,7 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$a, "render$a"); script$5.render = render$a; -const _sfc_main$9 = /* @__PURE__ */ defineComponent({ +const _sfc_main$7 = /* @__PURE__ */ defineComponent({ __name: "GlobalToast", setup(__props) { const toast = useToast(); @@ -5489,7 +5807,7 @@ const _hoisted_1$c = { width: "1.2em", height: "1.2em" }; -const _hoisted_2$a = /* @__PURE__ */ createBaseVNode("path", { +const _hoisted_2$9 = /* @__PURE__ */ createBaseVNode("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", @@ -5498,7 +5816,7 @@ const _hoisted_2$a = /* @__PURE__ */ createBaseVNode("path", { d: "M6 4v16m4-16l10 8l-10 8z" }, null, -1); const _hoisted_3$9 = [ - _hoisted_2$a + _hoisted_2$9 ]; function render$9(_ctx, _cache) { return openBlock(), createElementBlock("svg", _hoisted_1$c, [..._hoisted_3$9]); @@ -5510,7 +5828,7 @@ const _hoisted_1$b = { width: "1.2em", height: "1.2em" }; -const _hoisted_2$9 = /* @__PURE__ */ createBaseVNode("path", { +const _hoisted_2$8 = /* @__PURE__ */ createBaseVNode("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", @@ -5519,7 +5837,7 @@ const _hoisted_2$9 = /* @__PURE__ */ createBaseVNode("path", { d: "m13 19l9-7l-9-7zM2 19l9-7l-9-7z" }, null, -1); const _hoisted_3$8 = [ - _hoisted_2$9 + _hoisted_2$8 ]; function render$8(_ctx, _cache) { return openBlock(), createElementBlock("svg", _hoisted_1$b, [..._hoisted_3$8]); @@ -5531,7 +5849,7 @@ const _hoisted_1$a = { width: "1.2em", height: "1.2em" }; -const _hoisted_2$8 = /* @__PURE__ */ createBaseVNode("path", { +const _hoisted_2$7 = /* @__PURE__ */ createBaseVNode("path", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", @@ -5540,7 +5858,7 @@ const _hoisted_2$8 = /* @__PURE__ */ createBaseVNode("path", { d: "m6 3l14 9l-14 9z" }, null, -1); const _hoisted_3$7 = [ - _hoisted_2$8 + _hoisted_2$7 ]; function render$7(_ctx, _cache) { return openBlock(), createElementBlock("svg", _hoisted_1$a, [..._hoisted_3$7]); @@ -5552,7 +5870,7 @@ const _hoisted_1$9 = { width: "1.2em", height: "1.2em" }; -const _hoisted_2$7 = /* @__PURE__ */ createBaseVNode("g", { +const _hoisted_2$6 = /* @__PURE__ */ createBaseVNode("g", { fill: "none", stroke: "currentColor", "stroke-linecap": "round", @@ -5563,7 +5881,7 @@ const _hoisted_2$7 = /* @__PURE__ */ createBaseVNode("g", { /* @__PURE__ */ createBaseVNode("path", { d: "m16 8l-2-2l2-2" }) ], -1); const _hoisted_3$6 = [ - _hoisted_2$7 + _hoisted_2$6 ]; function render$6(_ctx, _cache) { return openBlock(), createElementBlock("svg", _hoisted_1$9, [..._hoisted_3$6]); @@ -5809,16 +6127,16 @@ var script$1$2 = { }, "containerRef") }, components: { - AngleRightIcon: script$w + AngleRightIcon: script$z }, directives: { ripple: Ripple } }; 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_2$5 = ["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_4$2 = ["href", "target"]; var _hoisted_5$1 = ["id"]; var _hoisted_6 = ["id"]; function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { @@ -5900,7 +6218,7 @@ 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$1)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { + }, $options.getPTOptions(processedItem, index, "submenuIcon")), null, 16, ["class"]))], 64)) : createCommentVNode("", true)], 16, _hoisted_4$2)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { key: 1, item: processedItem.item, hasSubmenu: $options.getItemProp(processedItem, "items"), @@ -5932,7 +6250,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$6)) : 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$5)) : createCommentVNode("", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ key: 1, id: $options.getItemId(processedItem), style: $options.getItemProp(processedItem, "style"), @@ -6910,8 +7228,10 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$4, "render$4"); script$3.render = render$4; +const _withScopeId$3 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-26957f1f"), n = n(), popScopeId(), n), "_withScopeId$3"); +const _hoisted_1$6 = ["aria-label"]; const minQueueCount = 1; -const _sfc_main$8 = /* @__PURE__ */ defineComponent({ +const _sfc_main$6 = /* @__PURE__ */ defineComponent({ __name: "BatchCountEdit", props: { class: { default: "" } @@ -6938,9 +7258,10 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({ return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); return withDirectives((openBlock(), createElementBlock("div", { - class: normalizeClass(["batch-count", props.class]) + class: normalizeClass(["batch-count", props.class]), + "aria-label": _ctx.$t("menu.batchCount") }, [ - createVNode(unref(script$x), { + createVNode(unref(script$A), { class: "w-14", modelValue: unref(batchCount), "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(batchCount) ? batchCount.value = $event : null), @@ -6963,7 +7284,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({ } } }, null, 8, ["modelValue", "max", "pt"]) - ], 2)), [ + ], 10, _hoisted_1$6)), [ [ _directive_tooltip, _ctx.$t("menu.batchCount"), @@ -6974,10 +7295,10 @@ const _sfc_main$8 = /* @__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({ +const BatchCountEdit = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-26957f1f"]]); +const _withScopeId$2 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-e9044686"), n = n(), popScopeId(), n), "_withScopeId$2"); +const _hoisted_1$5 = { class: "queue-button-group flex" }; +const _sfc_main$5 = /* @__PURE__ */ defineComponent({ __name: "ComfyQueueButton", setup(__props) { const workspaceStore = useWorkspaceStore(); @@ -7029,7 +7350,7 @@ const _sfc_main$7 = /* @__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$6, [ + return openBlock(), createElementBlock("div", _hoisted_1$5, [ withDirectives((openBlock(), createBlock(unref(script$3), { class: "comfyui-queue-button", label: activeQueueModeMenuItem.value.label, @@ -7070,8 +7391,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({ severity: executingPrompt.value ? "danger" : "secondary", disabled: !executingPrompt.value, text: "", + "aria-label": _ctx.$t("menu.interrupt"), onClick: _cache[0] || (_cache[0] = () => unref(commandStore).execute("Comfy.Interrupt")) - }, null, 8, ["severity", "disabled"]), [ + }, null, 8, ["severity", "disabled", "aria-label"]), [ [ _directive_tooltip, _ctx.$t("menu.interrupt"), @@ -7084,8 +7406,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({ severity: hasPendingTasks.value ? "danger" : "secondary", disabled: !hasPendingTasks.value, text: "", + "aria-label": _ctx.$t("sideToolbar.queueTab.clearPendingTasks"), onClick: _cache[1] || (_cache[1] = () => unref(commandStore).execute("Comfy.ClearPendingTasks")) - }, null, 8, ["severity", "disabled"]), [ + }, null, 8, ["severity", "disabled", "aria-label"]), [ [ _directive_tooltip, _ctx.$t("sideToolbar.queueTab.clearPendingTasks"), @@ -7100,9 +7423,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({ }; } }); -const ComfyQueueButton = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-7f4f551b"]]); +const ComfyQueueButton = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-e9044686"]]); const overlapThreshold = 20; -const _sfc_main$6 = /* @__PURE__ */ defineComponent({ +const _sfc_main$4 = /* @__PURE__ */ defineComponent({ __name: "ComfyActionbar", setup(__props) { const settingsStore = useSettingStore(); @@ -7251,7 +7574,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({ }); }); return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$y), { + return openBlock(), createBlock(unref(script$B), { class: normalizeClass(["actionbar w-fit", { "is-dragging": unref(isDragging), "is-docked": unref(isDocked) }]), style: normalizeStyle(unref(style)) }, { @@ -7274,42 +7597,42 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({ }; } }); -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$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$4 = [ - _hoisted_2$5 -]; -function render$3(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$5, [..._hoisted_3$4]); -} -__name(render$3, "render$3"); -const __unplugin_components_1 = markRaw({ name: "material-symbols-dock-to-bottom-outline", render: render$3 }); +const Actionbar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-915e5456"]]); const _hoisted_1$4 = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; 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-5v3h14v-3zm0-2h14V5H5zm0 2v3z" +}, null, -1); +const _hoisted_3$4 = [ + _hoisted_2$4 +]; +function render$3(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$4, [..._hoisted_3$4]); +} +__name(render$3, "render$3"); +const __unplugin_components_1 = markRaw({ name: "material-symbols-dock-to-bottom-outline", render: render$3 }); +const _hoisted_1$3 = { + viewBox: "0 0 24 24", + width: "1.2em", + height: "1.2em" +}; +const _hoisted_2$3 = /* @__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$3 = [ - _hoisted_2$4 + _hoisted_2$3 ]; function render$2(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$4, [..._hoisted_3$3]); + return openBlock(), createElementBlock("svg", _hoisted_1$3, [..._hoisted_3$3]); } __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({ +const _sfc_main$3 = /* @__PURE__ */ defineComponent({ __name: "BottomPanelToggleButton", setup(__props) { const bottomPanelStore = useBottomPanelStore(); @@ -7320,13 +7643,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({ return withDirectives((openBlock(), createBlock(unref(script$d), { severity: "secondary", text: "", + "aria-label": _ctx.$t("menu.toggleBottomPanel"), onClick: unref(bottomPanelStore).toggleBottomPanel }, { icon: withCtx(() => [ unref(bottomPanelStore).bottomPanelVisible ? (openBlock(), createBlock(_component_i_material_symbols58dock_to_bottom, { key: 0 })) : (openBlock(), createBlock(_component_i_material_symbols58dock_to_bottom_outline, { key: 1 })) ]), _: 1 - }, 8, ["onClick"])), [ + }, 8, ["aria-label", "onClick"])), [ [vShow, unref(bottomPanelStore).bottomPanelTabs.length > 0], [_directive_tooltip, { value: _ctx.$t("menu.toggleBottomPanel"), showDelay: 300 }] ]); @@ -7561,17 +7885,17 @@ var script$1 = { }, "getAriaSetSize") }, components: { - AngleRightIcon: script$w, - AngleDownIcon: script$z + AngleRightIcon: script$z, + AngleDownIcon: script$C }, 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_2$2 = ["onClick", "onMouseenter", "onMousemove"]; var _hoisted_3$2 = ["href", "target"]; -var _hoisted_4 = ["id"]; +var _hoisted_4$1 = ["id"]; var _hoisted_5 = ["id"]; function render$1(_ctx, _cache, $props, $setup, $data, $options) { var _component_MenubarSub = resolveComponent("MenubarSub", true); @@ -7632,7 +7956,7 @@ function render$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_4), $options.getItemProp(processedItem, "items") ? (openBlock(), createElementBlock(Fragment, { + }, $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, @@ -7650,7 +7974,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) { 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, { + }, null, 8, ["item", "root", "hasSubmenu", "label", "props"]))], 16, _hoisted_2$2), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_MenubarSub, { key: 0, id: $options.getItemId(processedItem) + "_list", menuId: $props.menuId, @@ -8293,7 +8617,7 @@ var script = { }, components: { MenubarSub: script$1, - BarsIcon: script$A + BarsIcon: script$D } }; function _typeof(o) { @@ -8348,7 +8672,7 @@ function _toPrimitive(t, r) { return ("string" === r ? String : Number)(t); } __name(_toPrimitive, "_toPrimitive"); -var _hoisted_1$3 = ["aria-haspopup", "aria-expanded", "aria-controls", "aria-label"]; +var _hoisted_1$2 = ["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"); @@ -8384,7 +8708,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { }) }, _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)]; + })], 16, _hoisted_1$2)) : createCommentVNode("", true)]; }), createVNode(_component_MenubarSub, { ref: $options.menubarRef, id: $data.id + "_list", @@ -8416,14 +8740,14 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { } __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 _withScopeId$1 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-56df69d2"), n = n(), popScopeId(), n), "_withScopeId$1"); +const _hoisted_1$1 = ["href"]; +const _hoisted_2$1 = { 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" + class: "ml-auto border border-surface rounded text-muted text-xs text-nowrap p-1 keybinding-tag" }; -const _sfc_main$4 = /* @__PURE__ */ defineComponent({ +const _sfc_main$2 = /* @__PURE__ */ defineComponent({ __name: "CommandMenubar", setup(__props) { const settingStore = useSettingStore(); @@ -8463,231 +8787,21 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ key: 0, class: normalizeClass(["p-menubar-item-icon", item3.icon]) }, null, 2)) : createCommentVNode("", true), - createBaseVNode("span", _hoisted_2$2, toDisplayString(item3.label), 1), + createBaseVNode("span", _hoisted_2$1, 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) + ], 16, _hoisted_1$1) ]), _: 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 CommandMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-56df69d2"]]); +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-6e35440f"), n = n(), popScopeId(), n), "_withScopeId"); +const _hoisted_1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createBaseVNode("h1", { class: "comfyui-logo mx-2 app-drag" }, "ComfyUI", -1)); +const _hoisted_2 = { class: "flex-grow min-w-0 app-drag h-full" }; +const _hoisted_3 = { class: "window-actions-spacer flex-shrink-0" }; +const _hoisted_4 = { class: "fixed top-0 left-0 app-drag w-full h-[var(--comfy-topbar-height)]" }; const _sfc_main$1 = /* @__PURE__ */ defineComponent({ __name: "TopMenubar", setup(__props) { @@ -8696,12 +8810,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ const workflowTabsPosition = computed( () => settingStore.get("Comfy.Workflow.WorkflowTabsPosition") ); - const betaMenuEnabled = computed( - () => settingStore.get("Comfy.UseNewMenu") !== "Disabled" - ); + const menuSetting = computed(() => settingStore.get("Comfy.UseNewMenu")); + const betaMenuEnabled = computed(() => menuSetting.value !== "Disabled"); const teleportTarget = computed( () => settingStore.get("Comfy.UseNewMenu") === "Top" ? ".comfyui-body-top" : ".comfyui-body-bottom" ); + const isNativeWindow = computed( + () => isElectron() && settingStore.get("Comfy-Desktop.WindowStyle") === "custom" + ); + const showTopMenu = computed( + () => betaMenuEnabled.value && !workspaceState.focusMode + ); const menuRight = ref(null); onMounted(() => { if (menuRight.value) { @@ -8719,47 +8838,60 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ isDroppable.value = payload.isOverlapping && payload.isDragging; } }); + onMounted(() => { + if (isElectron()) { + electronAPI().changeTheme({ + height: topMenuRef.value.getBoundingClientRect().height + }); + } + }); return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createBlock(Teleport, { to: teleportTarget.value }, [ - withDirectives(createBaseVNode("div", { - ref_key: "topMenuRef", - ref: topMenuRef, - class: normalizeClass(["comfyui-menu flex items-center", { dropzone: isDropZone.value, "dropzone-active": isDroppable.value }]) - }, [ - _hoisted_1, - createVNode(CommandMenubar), - createVNode(unref(script$D), { - layout: "vertical", - class: "mx-2" - }), - createBaseVNode("div", _hoisted_2, [ - workflowTabsPosition.value === "Topbar" ? (openBlock(), createBlock(WorkflowTabs, { key: 0 })) : createCommentVNode("", true) - ]), - createBaseVNode("div", { - class: "comfyui-menu-right", - ref_key: "menuRight", - ref: menuRight - }, null, 512), - createVNode(Actionbar), - createVNode(_sfc_main$5), - withDirectives(createVNode(unref(script$d), { - icon: "pi pi-bars", - severity: "secondary", - text: "", - onClick: _cache[0] || (_cache[0] = ($event) => unref(workspaceState).focusMode = true), - onContextmenu: unref(showNativeMenu) - }, null, 8, ["onContextmenu"]), [ - [_directive_tooltip, { value: _ctx.$t("menu.hideMenu"), showDelay: 300 }] + return openBlock(), createElementBlock(Fragment, null, [ + (openBlock(), createBlock(Teleport, { to: teleportTarget.value }, [ + withDirectives(createBaseVNode("div", { + ref_key: "topMenuRef", + ref: topMenuRef, + class: normalizeClass(["comfyui-menu flex items-center", { dropzone: isDropZone.value, "dropzone-active": isDroppable.value }]) + }, [ + _hoisted_1, + createVNode(CommandMenubar), + createBaseVNode("div", _hoisted_2, [ + workflowTabsPosition.value === "Topbar" ? (openBlock(), createBlock(WorkflowTabs, { key: 0 })) : createCommentVNode("", true) + ]), + createBaseVNode("div", { + class: "comfyui-menu-right", + ref_key: "menuRight", + ref: menuRight + }, null, 512), + createVNode(Actionbar), + createVNode(_sfc_main$3, { class: "flex-shrink-0" }), + withDirectives(createVNode(unref(script$d), { + class: "flex-shrink-0", + icon: "pi pi-bars", + severity: "secondary", + text: "", + "aria-label": _ctx.$t("menu.hideMenu"), + onClick: _cache[0] || (_cache[0] = ($event) => unref(workspaceState).focusMode = true), + onContextmenu: unref(showNativeMenu) + }, null, 8, ["aria-label", "onContextmenu"]), [ + [_directive_tooltip, { value: _ctx.$t("menu.hideMenu"), showDelay: 300 }] + ]), + withDirectives(createBaseVNode("div", _hoisted_3, null, 512), [ + [vShow, menuSetting.value !== "Bottom"] + ]) + ], 2), [ + [vShow, showTopMenu.value] ]) - ], 2), [ - [vShow, betaMenuEnabled.value && !unref(workspaceState).focusMode] + ], 8, ["to"])), + withDirectives(createBaseVNode("div", _hoisted_4, null, 512), [ + [vShow, isNativeWindow.value && !showTopMenu.value] ]) - ], 8, ["to"]); + ], 64); }; } }); -const TopMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-878b63b8"]]); +const TopMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-6e35440f"]]); var LatentPreviewMethod = /* @__PURE__ */ ((LatentPreviewMethod2) => { LatentPreviewMethod2["NoPreviews"] = "none"; LatentPreviewMethod2["Auto"] = "auto"; @@ -9241,6 +9373,7 @@ function useCoreCommands() { const workflowService = useWorkflowService(); const workflowStore = useWorkflowStore(); const dialogService = useDialogService(); + const colorPaletteStore = useColorPaletteStore(); const getTracker = /* @__PURE__ */ __name(() => workflowStore.activeWorkflow?.changeTracker, "getTracker"); const getSelectedNodes = /* @__PURE__ */ __name(() => { const selectedNodes = app.canvas.selected_nodes; @@ -9613,17 +9746,18 @@ function useCoreCommands() { icon: "pi pi-moon", label: "Toggle Theme (Dark/Light)", versionAdded: "1.3.12", - function: /* @__PURE__ */ (() => { - let previousDarkTheme = "dark"; - const isDarkMode = /* @__PURE__ */ __name((themeId) => themeId !== "light", "isDarkMode"); + function: (() => { + let previousDarkTheme = DEFAULT_DARK_COLOR_PALETTE.id; + let previousLightTheme = DEFAULT_LIGHT_COLOR_PALETTE.id; return () => { const settingStore = useSettingStore(); - const currentTheme = settingStore.get("Comfy.ColorPalette"); - if (isDarkMode(currentTheme)) { - previousDarkTheme = currentTheme; - settingStore.set("Comfy.ColorPalette", "light"); - } else { + const theme10 = colorPaletteStore.completedActivePalette; + if (theme10.light_theme) { + previousLightTheme = theme10.id; settingStore.set("Comfy.ColorPalette", previousDarkTheme); + } else { + previousDarkTheme = theme10.id; + settingStore.set("Comfy.ColorPalette", previousLightTheme); } }; })() @@ -9724,6 +9858,16 @@ function useCoreCommands() { function: /* @__PURE__ */ __name(() => { workflowService.duplicateWorkflow(workflowStore.activeWorkflow); }, "function") + }, + { + id: "Workspace.CloseWorkflow", + icon: "pi pi-times", + label: "Close Current Workflow", + versionAdded: "1.7.3", + function: /* @__PURE__ */ __name(() => { + if (workflowStore.activeWorkflow) + workflowService.closeWorkflow(workflowStore.activeWorkflow); + }, "function") } ]; } @@ -9766,20 +9910,45 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ const toast = useToast(); const settingStore = useSettingStore(); const executionStore = useExecutionStore(); - const theme10 = computed(() => settingStore.get("Comfy.ColorPalette")); + const colorPaletteStore = useColorPaletteStore(); + const queueStore = useQueueStore(); watch( - theme10, + () => colorPaletteStore.completedActivePalette, (newTheme) => { const DARK_THEME_CLASS = "dark-theme"; - const isDarkTheme = newTheme !== "light"; - if (isDarkTheme) { - document.body.classList.add(DARK_THEME_CLASS); - } else { + if (newTheme.light_theme) { document.body.classList.remove(DARK_THEME_CLASS); + } else { + document.body.classList.add(DARK_THEME_CLASS); + } + if (isElectron()) { + electronAPI().changeTheme({ + color: "rgba(0, 0, 0, 0)", + symbolColor: newTheme.colors.comfy_base["input-text"] + }); } }, { immediate: true } ); + if (isElectron()) { + watch( + () => queueStore.tasks, + (newTasks, oldTasks) => { + const oldRunningTaskIds = new Set( + oldTasks.filter((task) => task.isRunning).map((task) => task.promptId) + ); + newTasks.filter( + (task) => oldRunningTaskIds.has(task.promptId) && task.isHistory + ).forEach((task) => { + electronAPI().Events.incrementUserProperty( + `execution:${task.displayStatus.toLowerCase()}`, + 1 + ); + }); + }, + { deep: true } + ); + } watchEffect(() => { const fontSize = settingStore.get("Comfy.TextareaWidget.FontSize"); document.documentElement.style.setProperty( @@ -9810,9 +9979,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ } }); watchEffect(() => { - useQueueStore().maxHistoryItems = settingStore.get( - "Comfy.Queue.MaxHistoryItems" - ); + queueStore.maxHistoryItems = settingStore.get("Comfy.Queue.MaxHistoryItems"); }); const init = /* @__PURE__ */ __name(() => { const coreCommands = useCoreCommands(); @@ -9824,8 +9991,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ app.extensionManager = useWorkspaceStore(); }, "init"); const queuePendingTaskCountStore = useQueuePendingTaskCountStore(); - const onStatus = /* @__PURE__ */ __name((e) => { + const onStatus = /* @__PURE__ */ __name(async (e) => { queuePendingTaskCountStore.update(e); + await queueStore.update(); }, "onStatus"); const reconnectingMessage = { severity: "error", @@ -9861,17 +10029,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ executionStore.unbindExecutionEvents(); }); useEventListener(window, "keydown", useKeybindingService().keybindHandler); + const { wrapWithErrorHandling, wrapWithErrorHandlingAsync } = useErrorHandling(); const onGraphReady = /* @__PURE__ */ __name(() => { requestIdleCallback( () => { - useKeybindingService().registerUserKeybindings(); - useServerConfigStore().loadServerConfig( + wrapWithErrorHandling(useKeybindingService().registerUserKeybindings)(); + wrapWithErrorHandling(useServerConfigStore().loadServerConfig)( SERVER_CONFIG_ITEMS, settingStore.get("Comfy.Server.ServerConfigValues") ); - useModelStore().loadModelFolders(); + wrapWithErrorHandlingAsync(useModelStore().loadModelFolders)(); + wrapWithErrorHandlingAsync(useNodeFrequencyStore().loadNodeFrequencies)(); useNodeDefStore().nodeSearchService.endsWithFilterStartSequence(""); - useNodeFrequencyStore().loadNodeFrequencies(); }, { timeout: 1e3 } ); @@ -9879,10 +10048,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ return (_ctx, _cache) => { return openBlock(), createElementBlock(Fragment, null, [ createVNode(TopMenubar), - createVNode(_sfc_main$a, { onReady: onGraphReady }), - createVNode(_sfc_main$9), - createVNode(_sfc_main$r), - createVNode(_sfc_main$t), + createVNode(_sfc_main$8, { onReady: onGraphReady }), + createVNode(_sfc_main$7), + createVNode(_sfc_main$s), + createVNode(_sfc_main$u), createVNode(MenuHamburger) ], 64); }; @@ -9891,4 +10060,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=GraphView-HVeNbkaW.js.map +//# sourceMappingURL=GraphView-CDDCHVO0.js.map diff --git a/web/assets/GraphView-CIRWBKTm.css b/web/assets/GraphView-CqZ3opAX.css similarity index 70% rename from web/assets/GraphView-CIRWBKTm.css rename to web/assets/GraphView-CqZ3opAX.css index 59d1b3d14..f735c8386 100644 --- a/web/assets/GraphView-CIRWBKTm.css +++ b/web/assets/GraphView-CqZ3opAX.css @@ -1,8 +1,10 @@ -.comfy-menu-hamburger[data-v-5661bed0] { - pointer-events: auto; - position: fixed; - z-index: 9999; +.comfy-menu-hamburger[data-v-7ed57d1a] { + pointer-events: auto; + position: fixed; + z-index: 9999; + display: flex; + flex-direction: row } [data-v-e50caa15] .p-splitter-gutter { @@ -39,14 +41,14 @@ z-index: 999; } -.p-buttongroup-vertical[data-v-cf40dd39] { +.p-buttongroup-vertical[data-v-cb8f9a1a] { 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] { +.p-buttongroup-vertical .p-button[data-v-cb8f9a1a] { margin: 0; border-radius: 0; } @@ -82,7 +84,7 @@ font-size: inherit; } -[data-v-5741c9ae] .highlight { +[data-v-fd0a74bd] .highlight { background-color: var(--p-primary-color); color: var(--p-primary-contrast-color); font-weight: bold; @@ -131,16 +133,7 @@ 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] { +.side-tool-bar-container[data-v-33cac83a] { display: flex; flex-direction: column; align-items: center; @@ -153,18 +146,91 @@ background-color: var(--comfy-menu-secondary-bg); color: var(--fg-color); box-shadow: var(--bar-shadow); + + --sidebar-width: 4rem; + --sidebar-icon-size: 1.5rem; } -.side-tool-bar-end[data-v-37d8d7b4] { +.side-tool-bar-container.small-sidebar[data-v-33cac83a] { + --sidebar-width: 2.5rem; + --sidebar-icon-size: 1rem; +} +.side-tool-bar-end[data-v-33cac83a] { align-self: flex-end; margin-top: auto; } -[data-v-b9328350] .p-inputtext { +.status-indicator[data-v-8d011a31] { + position: absolute; + font-weight: 700; + font-size: 1.5rem; + top: 50%; + left: 50%; + transform: translate(-50%, -50%) +} + +[data-v-54fadc45] .p-togglebutton { + position: relative; + flex-shrink: 0; + border-radius: 0px; + border-width: 0px; + border-right-width: 1px; + border-style: solid; + background-color: transparent; + padding: 0px; + border-right-color: var(--border-color) +} +[data-v-54fadc45] .p-togglebutton::before { + display: none +} +[data-v-54fadc45] .p-togglebutton:first-child { + border-left-width: 1px; + border-style: solid; + border-left-color: var(--border-color) +} +[data-v-54fadc45] .p-togglebutton:not(:first-child) { + border-left-width: 0px +} +[data-v-54fadc45] .p-togglebutton.p-togglebutton-checked { + height: 100%; + border-bottom-width: 1px; + border-style: solid; + border-bottom-color: var(--p-button-text-primary-color) +} +[data-v-54fadc45] .p-togglebutton:not(.p-togglebutton-checked) { + opacity: 0.75 +} +[data-v-54fadc45] .p-togglebutton-checked .close-button,[data-v-54fadc45] .p-togglebutton:hover .close-button { + visibility: visible +} +[data-v-54fadc45] .p-togglebutton:hover .status-indicator { + display: none +} +[data-v-54fadc45] .p-togglebutton .close-button { + visibility: hidden +} +[data-v-54fadc45] .p-scrollpanel-content { + height: 100% +} + +/* Scrollbar half opacity to avoid blocking the active tab bottom border */ +[data-v-54fadc45] .p-scrollpanel:hover .p-scrollpanel-bar,[data-v-54fadc45] .p-scrollpanel:active .p-scrollpanel-bar { + opacity: 0.5 +} +[data-v-54fadc45] .p-selectbutton { + height: 100%; + border-radius: 0px +} + +[data-v-38831d8e] .workflow-tabs { + background-color: var(--comfy-menu-bg); +} + +[data-v-26957f1f] .p-inputtext { border-top-left-radius: 0; border-bottom-left-radius: 0; } -.comfyui-queue-button[data-v-7f4f551b] .p-splitbutton-dropdown { +.comfyui-queue-button[data-v-e9044686] .p-splitbutton-dropdown { border-top-right-radius: 0; border-bottom-right-radius: 0; } @@ -195,55 +261,23 @@ display: none; } -.top-menubar[data-v-6fecd137] .p-menubar-item-link svg { +.top-menubar[data-v-56df69d2] .p-menubar-item-link svg { display: none; } -[data-v-6fecd137] .p-menubar-submenu.dropdown-direction-up { +[data-v-56df69d2] .p-menubar-submenu.dropdown-direction-up { top: auto; bottom: 100%; flex-direction: column-reverse; } -.keybinding-tag[data-v-6fecd137] { +.keybinding-tag[data-v-56df69d2] { 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; - top: 50%; - left: 50%; - transform: translate(-50%, -50%) -} - -[data-v-d485c044] .p-togglebutton::before { - display: none -} -[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 -} - -.comfyui-menu[data-v-878b63b8] { +.comfyui-menu[data-v-6e35440f] { width: 100vw; + height: var(--comfy-topbar-height); background: var(--comfy-menu-bg); color: var(--fg-color); box-shadow: var(--bar-shadow); @@ -253,18 +287,17 @@ z-index: 1000; order: 0; grid-column: 1/-1; - max-height: 90vh; } -.comfyui-menu.dropzone[data-v-878b63b8] { +.comfyui-menu.dropzone[data-v-6e35440f] { background: var(--p-highlight-background); } -.comfyui-menu.dropzone-active[data-v-878b63b8] { +.comfyui-menu.dropzone-active[data-v-6e35440f] { background: var(--p-highlight-background-focus); } -[data-v-878b63b8] .p-menubar-item-label { +[data-v-6e35440f] .p-menubar-item-label { line-height: revert; } -.comfyui-logo[data-v-878b63b8] { +.comfyui-logo[data-v-6e35440f] { font-size: 1.2em; -webkit-user-select: none; -moz-user-select: none; diff --git a/web/assets/InstallView-CAcYt0HL.js b/web/assets/InstallView-By3hC1fC.js similarity index 94% rename from web/assets/InstallView-CAcYt0HL.js rename to web/assets/InstallView-By3hC1fC.js index 2cf9e7f15..4262b2646 100644 --- a/web/assets/InstallView-CAcYt0HL.js +++ b/web/assets/InstallView-By3hC1fC.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -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-DjNHn37O.js"; -import { _ as _sfc_main$5 } from "./BaseViewTemplate-BNGF4K22.js"; +import { B as BaseStyle, y as script$6, o as openBlock, f as createElementBlock, G as mergeProps, c9 as findIndexInList, ca as find, aD as resolveComponent, J as createBlock, K as resolveDynamicComponent, P as withCtx, m as createBaseVNode, Z as toDisplayString, M as renderSlot, L as createCommentVNode, V as normalizeClass, R as findSingle, H as Fragment, aE as Transition, i as withDirectives, v as vShow, am as UniqueComponentId, d as defineComponent, ad as ref, cb as useModel, k as createVNode, j as unref, cc as script$7, c4 as script$8, b3 as withModifiers, aP as script$9, a3 as useI18n, c as computed, aK as script$a, aG as createTextVNode, p as pushScopeId, q as popScopeId, bV as electronAPI, _ as _export_sfc, t as onMounted, r as resolveDirective, ax as script$b, cd as script$c, ce as script$d, l as script$e, c6 as script$f, cf as MigrationItems, w as watchEffect, I as renderList, cg as script$g, c2 as useRouter, aU as toRaw } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$5 } from "./BaseViewTemplate-BhQMaVFP.js"; var classes$4 = { root: /* @__PURE__ */ __name(function root(_ref) { var instance = _ref.instance; @@ -548,6 +548,12 @@ 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 _hoisted_19 = { class: "mt-4" }; +const _hoisted_20 = { + href: "https://comfy.org/privacy", + target: "_blank", + class: "text-blue-400 hover:text-blue-300 underline" +}; const _sfc_main$4 = /* @__PURE__ */ defineComponent({ __name: "DesktopSettingsConfiguration", props: { @@ -608,17 +614,29 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ 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("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.collect.errorReports")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.collect.systemInfo")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t( + "install.settings.dataCollectionDialog.collect.userJourneyEvents" + )), 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" + "install.settings.dataCollectionDialog.doNotCollect.personalInformation" + )), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t( + "install.settings.dataCollectionDialog.doNotCollect.workflowContents" + )), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t( + "install.settings.dataCollectionDialog.doNotCollect.fileSystemInformation" + )), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t( + "install.settings.dataCollectionDialog.doNotCollect.customNodeConfigurations" )), 1) + ]), + createBaseVNode("div", _hoisted_19, [ + createBaseVNode("a", _hoisted_20, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.viewFullPolicy")), 1) ]) ]) ]), @@ -631,36 +649,37 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ 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 _withScopeId$1 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-79125ff6"), n = n(), popScopeId(), n), "_withScopeId$1"); 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: "m-1 text-neutral-400" }; -const _hoisted_5$2 = /* @__PURE__ */ createBaseVNode("img", { +const _hoisted_5$2 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createBaseVNode("img", { class: "m-12", alt: "NVIDIA logo", width: "196", height: "32", src: _imports_0 -}, null, -1); +}, null, -1)); const _hoisted_6$2 = [ _hoisted_5$2 ]; -const _hoisted_7$2 = /* @__PURE__ */ createBaseVNode("img", { +const _hoisted_7$2 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createBaseVNode("img", { class: "rounded-lg hover-brighten", alt: "Apple Metal Performance Shaders Logo", width: "292", ratio: "", src: _imports_1 -}, null, -1); +}, null, -1)); const _hoisted_8$2 = [ _hoisted_7$2 ]; -const _hoisted_9$2 = /* @__PURE__ */ createBaseVNode("img", { +const _hoisted_9$2 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createBaseVNode("img", { class: "m-12", alt: "Manual configuration", width: "196", src: _imports_2 -}, null, -1); +}, null, -1)); const _hoisted_10$2 = [ _hoisted_9$2 ]; @@ -797,6 +816,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({ }; } }); +const GpuPicker = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-79125ff6"]]); 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" }; @@ -1082,7 +1102,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ }; } }); -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-de33872d"), n = n(), popScopeId(), n), "_withScopeId"); +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-0a97b0ae"), 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" }; @@ -1098,6 +1118,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ const autoUpdate = ref(true); const allowMetrics = ref(true); const highestStep = ref(0); + const handleStepChange = /* @__PURE__ */ __name((value2) => { + setHighestStep(value2); + electronAPI().Events.trackEvent("install_stepper_change", { + step: value2 + }); + }, "handleStepChange"); const setHighestStep = /* @__PURE__ */ __name((value2) => { const int = typeof value2 === "number" ? value2 : parseInt(value2, 10); if (!isNaN(int) && int > highestStep.value) highestStep.value = int; @@ -1122,8 +1148,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ onMounted(async () => { if (!electron) return; const detectedGpu = await electron.Config.getDetectedGpu(); - if (detectedGpu === "mps" || detectedGpu === "nvidia") + if (detectedGpu === "mps" || detectedGpu === "nvidia") { device.value = detectedGpu; + } + electronAPI().Events.trackEvent("install_stepper_change", { + step: "0", + gpu: detectedGpu + }); }); return (_ctx, _cache) => { return openBlock(), createBlock(_sfc_main$5, { dark: "" }, { @@ -1131,7 +1162,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ createVNode(unref(script), { class: "h-full p-8 2xl:p-16", value: "0", - "onUpdate:value": setHighestStep + "onUpdate:value": handleStepChange }, { default: withCtx(() => [ createVNode(unref(script$4), { class: "select-none" }, { @@ -1176,7 +1207,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ default: withCtx(() => [ createVNode(unref(script$3), { value: "0" }, { default: withCtx(({ activateCallback }) => [ - createVNode(_sfc_main$3, { + createVNode(GpuPicker, { device: device.value, "onUpdate:device": _cache[0] || (_cache[0] = ($event) => device.value = $event) }, null, 8, ["device"]), @@ -1281,8 +1312,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }; } }); -const InstallView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-de33872d"]]); +const InstallView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0a97b0ae"]]); export { InstallView as default }; -//# sourceMappingURL=InstallView-CAcYt0HL.js.map +//# sourceMappingURL=InstallView-By3hC1fC.js.map diff --git a/web/assets/InstallView-CwQdoH-C.css b/web/assets/InstallView-CxhfFC8Y.css similarity index 70% rename from web/assets/InstallView-CwQdoH-C.css rename to web/assets/InstallView-CxhfFC8Y.css index df5787787..a406c8695 100644 --- a/web/assets/InstallView-CwQdoH-C.css +++ b/web/assets/InstallView-CxhfFC8Y.css @@ -1,18 +1,18 @@ -:root { +.p-tag[data-v-79125ff6] { --p-tag-gap: 0.5rem; } -.hover-brighten { +.hover-brighten[data-v-79125ff6] { 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 { +&[data-v-79125ff6]:hover { filter: brightness(107%) contrast(105%); box-shadow: 0 0 0.25rem #ffffff79; } } -.p-accordioncontent-content { +.p-accordioncontent-content[data-v-79125ff6] { border-radius: 0.5rem; --tw-bg-opacity: 1; background-color: rgb(23 23 23 / var(--tw-bg-opacity)); @@ -20,15 +20,15 @@ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; } -div.selected { -.gpu-button:not(.selected) { +div.selected[data-v-79125ff6] { +.gpu-button[data-v-79125ff6]:not(.selected) { opacity: 0.5; } -.gpu-button:not(.selected):hover { +.gpu-button[data-v-79125ff6]:not(.selected):hover { opacity: 1; } } -.gpu-button { +.gpu-button[data-v-79125ff6] { margin: 0px; display: flex; width: 50%; @@ -43,37 +43,37 @@ div.selected { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; } -.gpu-button:hover { +.gpu-button[data-v-79125ff6]:hover { --tw-bg-opacity: 0.75; } -.gpu-button { -&.selected { +.gpu-button[data-v-79125ff6] { +&.selected[data-v-79125ff6] { --tw-bg-opacity: 1; background-color: rgb(64 64 64 / var(--tw-bg-opacity)); } -&.selected { +&.selected[data-v-79125ff6] { --tw-bg-opacity: 0.5; } -&.selected { +&.selected[data-v-79125ff6] { opacity: 1; } -&.selected:hover { +&.selected[data-v-79125ff6]:hover { --tw-bg-opacity: 0.6; } } -.disabled { +.disabled[data-v-79125ff6] { pointer-events: none; opacity: 0.4; } -.p-card-header { +.p-card-header[data-v-79125ff6] { flex-grow: 1; text-align: center; } -.p-card-body { +.p-card-body[data-v-79125ff6] { padding-top: 0px; text-align: center; } -[data-v-de33872d] .p-steppanel { +[data-v-0a97b0ae] .p-steppanel { background-color: transparent } diff --git a/web/assets/KeybindingPanel-Dc3C4lG1.js b/web/assets/KeybindingPanel-D6O16W_1.js similarity index 92% rename from web/assets/KeybindingPanel-Dc3C4lG1.js rename to web/assets/KeybindingPanel-D6O16W_1.js index 6cf204dd2..b0fbfd845 100644 --- a/web/assets/KeybindingPanel-Dc3C4lG1.js +++ b/web/assets/KeybindingPanel-D6O16W_1.js @@ -1,10 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -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-DjNHn37O.js"; -import { s as script$1, a as script$3 } from "./index-B5F0uxTQ.js"; -import { u as useKeybindingService } from "./keybindingService-Bx7YdkXn.js"; -import "./index-B-aVupP5.js"; -import "./index-5HFeZax4.js"; +import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, H as Fragment, I as renderList, k as createVNode, P as withCtx, aG as createTextVNode, Z as toDisplayString, j as unref, aK as script, L as createCommentVNode, ad as ref, cu as FilterMatchMode, a$ as useKeybindingStore, a4 as useCommandStore, a3 as useI18n, ah as normalizeI18nKey, w as watchEffect, bz as useToast, r as resolveDirective, J as createBlock, cv as SearchBox, m as createBaseVNode, l as script$2, ax as script$4, b3 as withModifiers, c6 as script$5, aP as script$6, i as withDirectives, cw as _sfc_main$2, p as pushScopeId, q as popScopeId, cx as KeyComboImpl, cy as KeybindingImpl, _ as _export_sfc } from "./index-QvfM__ze.js"; +import { s as script$1, a as script$3 } from "./index-DpF-ptbJ.js"; +import { u as useKeybindingService } from "./keybindingService-Cak1En5n.js"; +import "./index-Q1cQr26V.js"; const _hoisted_1$1 = { key: 0, class: "px-2" @@ -281,4 +280,4 @@ const KeybindingPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { KeybindingPanel as default }; -//# sourceMappingURL=KeybindingPanel-Dc3C4lG1.js.map +//# sourceMappingURL=KeybindingPanel-D6O16W_1.js.map diff --git a/web/assets/ManualConfigurationView-B6ecEClB.css b/web/assets/ManualConfigurationView-CsirlNfV.css similarity index 59% rename from web/assets/ManualConfigurationView-B6ecEClB.css rename to web/assets/ManualConfigurationView-CsirlNfV.css index 06a5cc3e8..dba81a0bb 100644 --- a/web/assets/ManualConfigurationView-B6ecEClB.css +++ b/web/assets/ManualConfigurationView-CsirlNfV.css @@ -1,7 +1,7 @@ -:root { +.p-tag[data-v-dc169863] { --p-tag-gap: 0.5rem; } -.comfy-installer { +.comfy-installer[data-v-dc169863] { margin-top: max(1rem, max(0px, calc((100vh - 42rem) * 0.5))); } diff --git a/web/assets/ManualConfigurationView-Bi_qHE-n.js b/web/assets/ManualConfigurationView-enyqGo0M.js similarity index 81% rename from web/assets/ManualConfigurationView-Bi_qHE-n.js rename to web/assets/ManualConfigurationView-enyqGo0M.js index 233f20fa7..43131f52c 100644 --- a/web/assets/ManualConfigurationView-Bi_qHE-n.js +++ b/web/assets/ManualConfigurationView-enyqGo0M.js @@ -1,9 +1,8 @@ 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-DjNHn37O.js"; -import { s as script$1 } from "./index-jXPKy3pP.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; -import "./index-5HFeZax4.js"; +import { d as defineComponent, a3 as useI18n, ad as ref, t as onMounted, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, j as unref, aK as script, bN as script$1, l as script$2, p as pushScopeId, q as popScopeId, bV as electronAPI, _ as _export_sfc } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-dc169863"), n = n(), popScopeId(), n), "_withScopeId"); 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" }; @@ -69,7 +68,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }; } }); +const ManualConfigurationView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-dc169863"]]); export { - _sfc_main as default + ManualConfigurationView as default }; -//# sourceMappingURL=ManualConfigurationView-Bi_qHE-n.js.map +//# sourceMappingURL=ManualConfigurationView-enyqGo0M.js.map diff --git a/web/assets/MetricsConsentView-lSfLu4nr.js b/web/assets/MetricsConsentView-lSfLu4nr.js new file mode 100644 index 000000000..a53fdbb9c --- /dev/null +++ b/web/assets/MetricsConsentView-lSfLu4nr.js @@ -0,0 +1,86 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; +import { d as defineComponent, bz as useToast, a3 as useI18n, ad as ref, c2 as useRouter, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, aG as createTextVNode, k as createVNode, j as unref, cc as script, l as script$1, bV as electronAPI } from "./index-QvfM__ze.js"; +const _hoisted_1 = { class: "h-full p-8 2xl:p-16 flex flex-col items-center justify-center" }; +const _hoisted_2 = { class: "bg-neutral-800 rounded-lg shadow-lg p-6 w-full max-w-[600px] flex flex-col gap-6" }; +const _hoisted_3 = { class: "text-3xl font-semibold text-neutral-100" }; +const _hoisted_4 = { class: "text-neutral-400" }; +const _hoisted_5 = { class: "text-neutral-400" }; +const _hoisted_6 = { + href: "https://comfy.org/privacy", + target: "_blank", + class: "text-blue-400 hover:text-blue-300 underline" +}; +const _hoisted_7 = { class: "flex items-center gap-4" }; +const _hoisted_8 = { + id: "metricsDescription", + class: "text-neutral-100" +}; +const _hoisted_9 = { class: "flex pt-6 justify-end" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "MetricsConsentView", + setup(__props) { + const toast = useToast(); + const { t } = useI18n(); + const allowMetrics = ref(true); + const router = useRouter(); + const isUpdating = ref(false); + const updateConsent = /* @__PURE__ */ __name(async () => { + isUpdating.value = true; + try { + await electronAPI().setMetricsConsent(allowMetrics.value); + } catch (error) { + toast.add({ + severity: "error", + summary: t("install.errorUpdatingConsent"), + detail: t("install.errorUpdatingConsentDetail"), + life: 3e3 + }); + } finally { + isUpdating.value = false; + } + router.push("/"); + }, "updateConsent"); + return (_ctx, _cache) => { + const _component_BaseViewTemplate = _sfc_main$1; + return openBlock(), createBlock(_component_BaseViewTemplate, { dark: "" }, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_1, [ + createBaseVNode("div", _hoisted_2, [ + createBaseVNode("h2", _hoisted_3, toDisplayString(_ctx.$t("install.helpImprove")), 1), + createBaseVNode("p", _hoisted_4, toDisplayString(_ctx.$t("install.updateConsent")), 1), + createBaseVNode("p", _hoisted_5, [ + createTextVNode(toDisplayString(_ctx.$t("install.moreInfo")) + " ", 1), + createBaseVNode("a", _hoisted_6, toDisplayString(_ctx.$t("install.privacyPolicy")), 1), + createTextVNode(". ") + ]), + createBaseVNode("div", _hoisted_7, [ + createVNode(unref(script), { + modelValue: allowMetrics.value, + "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => allowMetrics.value = $event), + "aria-describedby": "metricsDescription" + }, null, 8, ["modelValue"]), + createBaseVNode("span", _hoisted_8, toDisplayString(allowMetrics.value ? _ctx.$t("install.metricsEnabled") : _ctx.$t("install.metricsDisabled")), 1) + ]), + createBaseVNode("div", _hoisted_9, [ + createVNode(unref(script$1), { + label: _ctx.$t("g.ok"), + icon: "pi pi-check", + loading: isUpdating.value, + iconPos: "right", + onClick: updateConsent + }, null, 8, ["label", "loading"]) + ]) + ]) + ]) + ]), + _: 1 + }); + }; + } +}); +export { + _sfc_main as default +}; +//# sourceMappingURL=MetricsConsentView-lSfLu4nr.js.map diff --git a/web/assets/NotSupportedView-bFzHmqNj.css b/web/assets/NotSupportedView-DQerxQzi.css similarity index 63% rename from web/assets/NotSupportedView-bFzHmqNj.css rename to web/assets/NotSupportedView-DQerxQzi.css index 80ac32982..3b90d2796 100644 --- a/web/assets/NotSupportedView-bFzHmqNj.css +++ b/web/assets/NotSupportedView-DQerxQzi.css @@ -1,17 +1,17 @@ -.sad-container { +.sad-container[data-v-ebb20958] { display: grid; align-items: center; justify-content: space-evenly; grid-template-columns: 25rem 1fr; -& > * { +&[data-v-ebb20958] > * { grid-row: 1; } } -.sad-text { +.sad-text[data-v-ebb20958] { grid-column: 1/3; } -.sad-girl { +.sad-girl[data-v-ebb20958] { grid-column: 2/3; width: min(75vw, 100vh); } diff --git a/web/assets/NotSupportedView-Drz3x2d-.js b/web/assets/NotSupportedView-Vc8_xWgH.js similarity index 81% rename from web/assets/NotSupportedView-Drz3x2d-.js rename to web/assets/NotSupportedView-Vc8_xWgH.js index a24af84a2..ebc712a47 100644 --- a/web/assets/NotSupportedView-Drz3x2d-.js +++ b/web/assets/NotSupportedView-Vc8_xWgH.js @@ -1,14 +1,15 @@ 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-DjNHn37O.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; +import { d as defineComponent, c2 as useRouter, r as resolveDirective, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, j as unref, l as script, i as withDirectives, p as pushScopeId, q as popScopeId, _ as _export_sfc } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; const _imports_0 = "" + new URL("images/sad_girl.png", import.meta.url).href; +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-ebb20958"), n = n(), popScopeId(), n), "_withScopeId"); const _hoisted_1 = { class: "sad-container" }; -const _hoisted_2 = /* @__PURE__ */ createBaseVNode("img", { +const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createBaseVNode("img", { class: "sad-girl", src: _imports_0, alt: "Sad girl illustration" -}, null, -1); +}, 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" }; @@ -80,7 +81,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }; } }); +const NotSupportedView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ebb20958"]]); export { - _sfc_main as default + NotSupportedView as default }; -//# sourceMappingURL=NotSupportedView-Drz3x2d-.js.map +//# sourceMappingURL=NotSupportedView-Vc8_xWgH.js.map diff --git a/web/assets/ServerConfigPanel-Be4StJmv.js b/web/assets/ServerConfigPanel-B-w0HFlz.js similarity index 91% rename from web/assets/ServerConfigPanel-Be4StJmv.js rename to web/assets/ServerConfigPanel-B-w0HFlz.js index e84d2d43a..d00cf672a 100644 --- a/web/assets/ServerConfigPanel-Be4StJmv.js +++ b/web/assets/ServerConfigPanel-B-w0HFlz.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -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-DjNHn37O.js"; -import { u as useServerConfigStore } from "./serverConfigStore-CvyKFVuP.js"; +import { m as createBaseVNode, o as openBlock, f as createElementBlock, a0 as markRaw, d as defineComponent, a as useSettingStore, aS as storeToRefs, a7 as watch, cW as useCopyToClipboard, a3 as useI18n, J as createBlock, P as withCtx, j as unref, c6 as script, Z as toDisplayString, I as renderList, H as Fragment, k as createVNode, l as script$1, L as createCommentVNode, c4 as script$2, cX as FormItem, cw as _sfc_main$1, bV as electronAPI } from "./index-QvfM__ze.js"; +import { u as useServerConfigStore } from "./serverConfigStore-DCme3xlV.js"; const _hoisted_1$1 = { viewBox: "0 0 24 24", width: "1.2em", @@ -155,4 +155,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ServerConfigPanel-Be4StJmv.js.map +//# sourceMappingURL=ServerConfigPanel-B-w0HFlz.js.map diff --git a/web/assets/ServerStartView-48wfE1MS.js b/web/assets/ServerStartView-48wfE1MS.js new file mode 100644 index 000000000..4b74f5ad1 --- /dev/null +++ b/web/assets/ServerStartView-48wfE1MS.js @@ -0,0 +1,101 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { d as defineComponent, a3 as useI18n, ad as ref, c7 as ProgressStatus, t as onMounted, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, aG as createTextVNode, Z as toDisplayString, j as unref, f as createElementBlock, L as createCommentVNode, k as createVNode, l as script, i as withDirectives, v as vShow, c8 as BaseTerminal, p as pushScopeId, q as popScopeId, bV as electronAPI, _ as _export_sfc } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; +const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-4140d62b"), n = n(), popScopeId(), n), "_withScopeId"); +const _hoisted_1 = { class: "flex flex-col w-full h-full items-center" }; +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, autoRows: true, autoCols: 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("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] + ]) + ]) + ]), + _: 1 + }); + }; + } +}); +const ServerStartView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4140d62b"]]); +export { + ServerStartView as default +}; +//# sourceMappingURL=ServerStartView-48wfE1MS.js.map diff --git a/web/assets/ServerStartView-CIDTUh4x.js b/web/assets/ServerStartView-CIDTUh4x.js deleted file mode 100644 index 6567eea21..000000000 --- a/web/assets/ServerStartView-CIDTUh4x.js +++ /dev/null @@ -1,98 +0,0 @@ -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-DjNHn37O.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.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-CIDTUh4x.js.map diff --git a/web/assets/ServerStartView-CnyN4Ib6.css b/web/assets/ServerStartView-CJiwVDQY.css similarity index 64% rename from web/assets/ServerStartView-CnyN4Ib6.css rename to web/assets/ServerStartView-CJiwVDQY.css index 60a63414f..7d53a927c 100644 --- a/web/assets/ServerStartView-CnyN4Ib6.css +++ b/web/assets/ServerStartView-CJiwVDQY.css @@ -1,5 +1,5 @@ -[data-v-42c1131d] .xterm-helper-textarea { +[data-v-4140d62b] .xterm-helper-textarea { /* Hide this as it moves all over when uv is running */ display: none; } diff --git a/web/assets/UserSelectView-B3jYchWu.js b/web/assets/UserSelectView-CXmVKOeK.js similarity index 89% rename from web/assets/UserSelectView-B3jYchWu.js rename to web/assets/UserSelectView-CXmVKOeK.js index 9d2dda86c..88b4d3f3d 100644 --- a/web/assets/UserSelectView-B3jYchWu.js +++ b/web/assets/UserSelectView-CXmVKOeK.js @@ -1,7 +1,7 @@ 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-DjNHn37O.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; +import { d as defineComponent, aX as useUserStore, c2 as useRouter, ad as ref, c as computed, t as onMounted, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, c3 as withKeys, j as unref, ax as script, c4 as script$1, c5 as script$2, c6 as script$3, aG as createTextVNode, L as createCommentVNode, l as script$4 } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.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" @@ -99,4 +99,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=UserSelectView-B3jYchWu.js.map +//# sourceMappingURL=UserSelectView-CXmVKOeK.js.map diff --git a/web/assets/WelcomeView-N0ZXLjdi.js b/web/assets/WelcomeView-C8whKl15.js similarity index 79% rename from web/assets/WelcomeView-N0ZXLjdi.js rename to web/assets/WelcomeView-C8whKl15.js index bec1292ec..7625ec43b 100644 --- a/web/assets/WelcomeView-N0ZXLjdi.js +++ b/web/assets/WelcomeView-C8whKl15.js @@ -1,7 +1,7 @@ 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-DjNHn37O.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BNGF4K22.js"; +import { d as defineComponent, c2 as useRouter, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, j as unref, l as script, p as pushScopeId, q as popScopeId, _ as _export_sfc } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.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" }; @@ -37,4 +37,4 @@ const WelcomeView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data- export { WelcomeView as default }; -//# sourceMappingURL=WelcomeView-N0ZXLjdi.js.map +//# sourceMappingURL=WelcomeView-C8whKl15.js.map diff --git a/web/assets/index-5HFeZax4.js b/web/assets/index-5HFeZax4.js deleted file mode 100644 index b4bc111e9..000000000 --- a/web/assets/index-5HFeZax4.js +++ /dev/null @@ -1,27 +0,0 @@ -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-DjNHn37O.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-5HFeZax4.js.map diff --git a/web/assets/index-t-sFBuUC.css b/web/assets/index-Cf-n7v0V.css similarity index 97% rename from web/assets/index-t-sFBuUC.css rename to web/assets/index-Cf-n7v0V.css index f588a35ce..b8e6a53ad 100644 --- a/web/assets/index-t-sFBuUC.css +++ b/web/assets/index-Cf-n7v0V.css @@ -2131,6 +2131,9 @@ .z-\[1000\]{ z-index: 1000; } + .z-\[9999\]{ + z-index: 9999; + } .m-0{ margin: 0px; } @@ -2253,6 +2256,9 @@ .h-0{ height: 0px; } + .h-1{ + height: 0.25rem; + } .h-16{ height: 4rem; } @@ -2271,6 +2277,9 @@ .h-\[30rem\]{ height: 30rem; } + .h-\[var\(--comfy-topbar-height\)\]{ + height: var(--comfy-topbar-height); + } .h-full{ height: 100%; } @@ -2341,6 +2350,9 @@ .w-screen{ width: 100vw; } + .min-w-0{ + min-width: 0px; + } .min-w-110{ min-width: 32rem; } @@ -2359,6 +2371,9 @@ .max-w-\[150px\]{ max-width: 150px; } + .max-w-\[600px\]{ + max-width: 600px; + } .max-w-full{ max-width: 100%; } @@ -2519,6 +2534,9 @@ .text-wrap{ text-wrap: wrap; } + .text-nowrap{ + text-wrap: nowrap; + } .rounded{ border-radius: 0.25rem; } @@ -2528,16 +2546,35 @@ .rounded-none{ border-radius: 0px; } + .rounded-t-lg{ + border-top-left-radius: 0.5rem; + border-top-right-radius: 0.5rem; + } .border{ border-width: 1px; } + .border-0{ + border-width: 0px; + } .border-x-0{ border-left-width: 0px; border-right-width: 0px; } + .border-b{ + border-bottom-width: 1px; + } + .border-l{ + border-left-width: 1px; + } + .border-r{ + border-right-width: 1px; + } .border-t-0{ border-top-width: 0px; } + .border-solid{ + border-style: solid; + } .border-none{ border-style: none; } @@ -2635,6 +2672,9 @@ .p-5{ padding: 1.25rem; } + .p-6{ + padding: 1.5rem; + } .p-8{ padding: 2rem; } @@ -2701,6 +2741,9 @@ .text-2xl{ font-size: 1.5rem; } + .text-3xl{ + font-size: 1.875rem; + } .text-4xl{ font-size: 2.25rem; } @@ -2783,6 +2826,9 @@ --tw-text-opacity: 1; color: rgb(239 68 68 / var(--tw-text-opacity)); } + .underline{ + text-decoration-line: underline; + } .no-underline{ text-decoration-line: none; } @@ -2868,6 +2914,7 @@ --bg-color: #fff; --comfy-menu-bg: #353535; --comfy-menu-secondary-bg: #292929; + --comfy-topbar-height: 2.5rem; --comfy-input-bg: #222; --input-text: #ddd; --descrip-text: #999; @@ -3625,24 +3672,33 @@ audio.comfy-audio.empty-audio-widget { padding: var(--comfy-tree-explorer-item-padding) !important; } +/* [Desktop] Electron window specific styles */ +.app-drag { + app-region: drag; +} + +.no-drag { + app-region: no-drag; +} + +.window-actions-spacer { + width: calc(100vw - env(titlebar-area-width, 100vw)); +} +/* End of [Desktop] Electron window specific styles */ .hover\:bg-neutral-700:hover{ --tw-bg-opacity: 1; background-color: rgb(64 64 64 / var(--tw-bg-opacity)); } - .hover\:bg-opacity-75:hover{ --tw-bg-opacity: 0.75; } - .hover\:text-blue-300:hover{ --tw-text-opacity: 1; color: rgb(144 205 244 / var(--tw-text-opacity)); } - .hover\:opacity-100:hover{ opacity: 1; } - @media (min-width: 768px){ .md\:flex{ @@ -3653,7 +3709,6 @@ audio.comfy-audio.empty-audio-widget { display: none; } } - @media (min-width: 1536px){ .\32xl\:mx-4{ @@ -3689,8 +3744,11 @@ audio.comfy-audio.empty-audio-widget { padding-left: 1rem; padding-right: 1rem; } -} + .\32xl\:text-sm{ + font-size: 0.875rem; + } +} @media (prefers-color-scheme: dark){ .dark\:bg-gray-800{ @@ -3740,17 +3798,17 @@ audio.comfy-audio.empty-audio-widget { margin-bottom: 1rem; } -.comfy-error-report[data-v-ddf3e2da] { +.comfy-error-report[data-v-09b72a20] { display: flex; flex-direction: column; gap: 1rem; } -.action-container[data-v-ddf3e2da] { +.action-container[data-v-09b72a20] { display: flex; gap: 1rem; justify-content: flex-end; } -.wrapper-pre[data-v-ddf3e2da] { +.wrapper-pre[data-v-09b72a20] { white-space: pre-wrap; word-wrap: break-word; } @@ -3834,7 +3892,7 @@ audio.comfy-audio.empty-audio-widget { padding-top: 0px !important; } -.settings-container[data-v-67f71ae9] { +.settings-container[data-v-2e21278f] { display: flex; height: 70vh; width: 60vw; @@ -3842,25 +3900,25 @@ audio.comfy-audio.empty-audio-widget { overflow: hidden; } @media (max-width: 768px) { -.settings-container[data-v-67f71ae9] { +.settings-container[data-v-2e21278f] { flex-direction: column; height: auto; width: 80vw; } -.settings-sidebar[data-v-67f71ae9] { +.settings-sidebar[data-v-2e21278f] { width: 100%; } -.settings-content[data-v-67f71ae9] { +.settings-content[data-v-2e21278f] { height: 350px; } } /* Show a separator line above the Keybinding tab */ /* This indicates the start of custom setting panels */ -.settings-sidebar[data-v-67f71ae9] .p-listbox-option[aria-label='Keybinding'] { +.settings-sidebar[data-v-2e21278f] .p-listbox-option[aria-label='Keybinding'] { position: relative; } -.settings-sidebar[data-v-67f71ae9] .p-listbox-option[aria-label='Keybinding']::before { +.settings-sidebar[data-v-2e21278f] .p-listbox-option[aria-label='Keybinding']::before { position: absolute; top: 0px; left: 0px; @@ -3878,15 +3936,15 @@ audio.comfy-audio.empty-audio-widget { margin-left: 0.5rem; } -.p-card[data-v-d65acb9a] { +.p-card[data-v-ffc83afa] { --p-card-body-padding: 10px 0 0 0; overflow: hidden; } -[data-v-d65acb9a] .p-card-subtitle { +[data-v-ffc83afa] .p-card-subtitle { text-align: center; } -.carousel[data-v-fc26284b] { +.carousel[data-v-d9962275] { width: 66vw; } /** @@ -4123,18 +4181,18 @@ audio.comfy-audio.empty-audio-widget { overflow-y: hidden; } -[data-v-6187144a] .p-terminal .xterm { +[data-v-90a7f075] .p-terminal .xterm { overflow-x: auto; } -[data-v-6187144a] .p-terminal .xterm-screen { +[data-v-90a7f075] .p-terminal .xterm-screen { background-color: black; overflow-y: hidden; } -[data-v-b27b58f4] .p-terminal .xterm { +[data-v-03daf1c8] .p-terminal .xterm { overflow-x: auto; } -[data-v-b27b58f4] .p-terminal .xterm-screen { +[data-v-03daf1c8] .p-terminal .xterm-screen { background-color: black; overflow-y: hidden; } @@ -4494,16 +4552,28 @@ audio.comfy-audio.empty-audio-widget { pointer-events: none; } -[data-v-9159c070] .p-toolbar-end .p-button { +[data-v-5e759e25] .p-toolbar-end .p-button { + padding-top: 0.25rem; + padding-bottom: 0.25rem } @media (min-width: 1536px) { -[data-v-9159c070] .p-toolbar-end .p-button { +[data-v-5e759e25] .p-toolbar-end .p-button { + padding-top: 0.5rem; + padding-bottom: 0.5rem } } +[data-v-5e759e25] .p-toolbar-start { + + min-width: 0px; + + flex: 1 1 0%; + + overflow: hidden +} .model_preview[data-v-32e6c4d9] { background-color: var(--comfy-menu-bg); @@ -4736,18 +4806,18 @@ audio.comfy-audio.empty-audio-widget { width: 100% } -.p-selectbutton .p-button[data-v-4b8adc78] { +.p-selectbutton .p-button[data-v-05364174] { padding: 0.5rem; } -.p-selectbutton .p-button .pi[data-v-4b8adc78] { +.p-selectbutton .p-button .pi[data-v-05364174] { font-size: 1.5rem; } -.field[data-v-4b8adc78] { +.field[data-v-05364174] { display: flex; flex-direction: column; gap: 0.5rem; } -.color-picker-container[data-v-4b8adc78] { +.color-picker-container[data-v-05364174] { display: flex; align-items: center; gap: 0.5rem; @@ -4767,10 +4837,10 @@ audio.comfy-audio.empty-audio-widget { } } -.comfy-image-wrap[data-v-ffe66146] { +.comfy-image-wrap[data-v-a748ccd8] { display: contents; } -.comfy-image-blur[data-v-ffe66146] { +.comfy-image-blur[data-v-a748ccd8] { position: absolute; top: 0; left: 0; @@ -4779,7 +4849,7 @@ audio.comfy-audio.empty-audio-widget { -o-object-fit: cover; object-fit: cover; } -.comfy-image-main[data-v-ffe66146] { +.comfy-image-main[data-v-a748ccd8] { width: 100%; height: 100%; -o-object-fit: cover; @@ -4788,19 +4858,19 @@ audio.comfy-audio.empty-audio-widget { object-position: center; z-index: 1; } -.contain .comfy-image-wrap[data-v-ffe66146] { +.contain .comfy-image-wrap[data-v-a748ccd8] { position: relative; width: 100%; height: 100%; } -.contain .comfy-image-main[data-v-ffe66146] { +.contain .comfy-image-main[data-v-a748ccd8] { -o-object-fit: contain; object-fit: contain; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); position: absolute; } -.broken-image-placeholder[data-v-ffe66146] { +.broken-image-placeholder[data-v-a748ccd8] { display: flex; flex-direction: column; align-items: center; @@ -4809,7 +4879,7 @@ audio.comfy-audio.empty-audio-widget { height: 100%; margin: 2rem; } -.broken-image-placeholder i[data-v-ffe66146] { +.broken-image-placeholder i[data-v-a748ccd8] { font-size: 3rem; margin-bottom: 0.5rem; } @@ -4827,7 +4897,7 @@ img.galleria-image { z-index: 1; } -.result-container[data-v-61515e14] { +.result-container[data-v-2403edc6] { width: 100%; height: 100%; aspect-ratio: 1 / 1; @@ -4837,7 +4907,7 @@ img.galleria-image { justify-content: center; align-items: center; } -.preview-mask[data-v-61515e14] { +.preview-mask[data-v-2403edc6] { position: absolute; left: 50%; top: 50%; @@ -4849,7 +4919,7 @@ img.galleria-image { transition: opacity 0.3s ease; z-index: 1; } -.result-container:hover .preview-mask[data-v-61515e14] { +.result-container:hover .preview-mask[data-v-2403edc6] { opacity: 1; } diff --git a/web/assets/index-B5F0uxTQ.js b/web/assets/index-DpF-ptbJ.js similarity index 99% rename from web/assets/index-B5F0uxTQ.js rename to web/assets/index-DpF-ptbJ.js index 78222d183..792856c66 100644 --- a/web/assets/index-B5F0uxTQ.js +++ b/web/assets/index-DpF-ptbJ.js @@ -1,8 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { B as BaseStyle, q as script$s, ct as script$t, H as createBaseVNode, o as openBlock, f as createElementBlock, D as mergeProps, X as toDisplayString, S as Ripple, r as resolveDirective, i as withDirectives, k as createBlock, G as resolveDynamicComponent, bY as script$u, aB as resolveComponent, T as normalizeClass, aD as createSlots, M as withCtx, bz as script$v, bw as script$w, F as Fragment, E as renderList, aE as createTextVNode, bq as setAttribute, ak as UniqueComponentId, bo as normalizeProps, J as renderSlot, I as createCommentVNode, R as equals, bk as script$x, c8 as script$y, cu as getFirstFocusableElement, an as OverlayEventBus, A as getVNodeProp, am as resolveFieldData, cv as invokeElementMethod, O as getAttribute, cw as getNextElementSibling, y as getOuterWidth, cx as getPreviousElementSibling, l as script$z, ay as script$A, W as script$B, bn as script$D, aj as isNotEmpty, bM as withModifiers, z as getOuterHeight, cy as _default, al as ZIndex, Q as focus, ap as addStyle, ar as absolutePosition, as as ConnectedOverlayScrollHandler, at as isTouchDevice, cz as FilterOperator, ax as script$E, cA as FocusTrap, N as createVNode, aC as Transition, bX as withKeys, cB as getIndex, aW as script$G, cC as isClickable, cD as clearSelection, cE as localeComparator, cF as sort, cG as FilterService, cn as FilterMatchMode, P as findSingle, c1 as findIndexInList, c2 as find, cH as exportCSV, U as getOffset, cI as getHiddenElementOuterWidth, cJ as getHiddenElementOuterHeight, cK as reorderArray, cL as getWindowScrollTop, cM as removeClass, cN as addClass, ao as isEmpty, aw as script$H, az as script$I } from "./index-DjNHn37O.js"; -import { s as script$C } from "./index-B-aVupP5.js"; -import { s as script$F } from "./index-5HFeZax4.js"; +import { B as BaseStyle, y as script$s, cA as script$t, m as createBaseVNode, o as openBlock, f as createElementBlock, G as mergeProps, Z as toDisplayString, U as Ripple, r as resolveDirective, i as withDirectives, J as createBlock, K as resolveDynamicComponent, c5 as script$u, aD as resolveComponent, V as normalizeClass, aF as createSlots, P as withCtx, bG as script$v, bD as script$w, H as Fragment, I as renderList, aG as createTextVNode, bx as setAttribute, am as UniqueComponentId, bv as normalizeProps, M as renderSlot, L as createCommentVNode, T as equals, br as script$x, cg as script$y, cB as getFirstFocusableElement, ap as OverlayEventBus, E as getVNodeProp, ao as resolveFieldData, cC as invokeElementMethod, Q as getAttribute, cD as getNextElementSibling, C as getOuterWidth, cE as getPreviousElementSibling, l as script$z, aA as script$A, Y as script$B, bu as script$D, al as isNotEmpty, b3 as withModifiers, D as getOuterHeight, cF as _default, an as ZIndex, S as focus, ar as addStyle, at as absolutePosition, au as ConnectedOverlayScrollHandler, av as isTouchDevice, cG as FilterOperator, az as script$E, cH as script$F, cI as FocusTrap, k as createVNode, aE as Transition, c3 as withKeys, cJ as getIndex, aW as script$G, cK as isClickable, cL as clearSelection, cM as localeComparator, cN as sort, cO as FilterService, cu as FilterMatchMode, R as findSingle, c9 as findIndexInList, ca as find, cP as exportCSV, W as getOffset, cQ as getHiddenElementOuterWidth, cR as getHiddenElementOuterHeight, cS as reorderArray, cT as getWindowScrollTop, cU as removeClass, cV as addClass, aq as isEmpty, ay as script$H, aB as script$I } from "./index-QvfM__ze.js"; +import { s as script$C } from "./index-Q1cQr26V.js"; var ColumnStyle = BaseStyle.extend({ name: "column" }); @@ -8783,4 +8782,4 @@ export { script as a, script$r as s }; -//# sourceMappingURL=index-B5F0uxTQ.js.map +//# sourceMappingURL=index-DpF-ptbJ.js.map diff --git a/web/assets/index-B-aVupP5.js b/web/assets/index-Q1cQr26V.js similarity index 91% rename from web/assets/index-B-aVupP5.js rename to web/assets/index-Q1cQr26V.js index 2f4957c2f..ce20e200e 100644 --- a/web/assets/index-B-aVupP5.js +++ b/web/assets/index-Q1cQr26V.js @@ -1,6 +1,6 @@ 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-DjNHn37O.js"; +import { cA as script$1, m as createBaseVNode, o as openBlock, f as createElementBlock, G as mergeProps } from "./index-QvfM__ze.js"; var script = { name: "BarsIcon", "extends": script$1 @@ -26,4 +26,4 @@ script.render = render; export { script as s }; -//# sourceMappingURL=index-B-aVupP5.js.map +//# sourceMappingURL=index-Q1cQr26V.js.map diff --git a/web/assets/index-DjNHn37O.js b/web/assets/index-QvfM__ze.js similarity index 81% rename from web/assets/index-DjNHn37O.js rename to web/assets/index-QvfM__ze.js index fff8484bd..dc3143769 100644 --- a/web/assets/index-DjNHn37O.js +++ b/web/assets/index-QvfM__ze.js @@ -1,7 +1,7 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-HVeNbkaW.js","./index-jXPKy3pP.js","./index-5HFeZax4.js","./index-B-aVupP5.js","./keybindingService-Bx7YdkXn.js","./serverConfigStore-CvyKFVuP.js","./GraphView-CIRWBKTm.css","./UserSelectView-B3jYchWu.js","./BaseViewTemplate-BNGF4K22.js","./ServerStartView-CIDTUh4x.js","./ServerStartView-CnyN4Ib6.css","./InstallView-CAcYt0HL.js","./InstallView-CwQdoH-C.css","./WelcomeView-N0ZXLjdi.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-Drz3x2d-.js","./NotSupportedView-bFzHmqNj.css","./DownloadGitView-DeC7MBzG.js","./ManualConfigurationView-Bi_qHE-n.js","./ManualConfigurationView-B6ecEClB.css","./KeybindingPanel-Dc3C4lG1.js","./index-B5F0uxTQ.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-D4Phn0Zr.js","./ServerConfigPanel-Be4StJmv.js","./index-Bordpmzt.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-CDDCHVO0.js","./index-Q1cQr26V.js","./keybindingService-Cak1En5n.js","./serverConfigStore-DCme3xlV.js","./GraphView-CqZ3opAX.css","./UserSelectView-CXmVKOeK.js","./BaseViewTemplate-BhQMaVFP.js","./ServerStartView-48wfE1MS.js","./ServerStartView-CJiwVDQY.css","./InstallView-By3hC1fC.js","./InstallView-CxhfFC8Y.css","./WelcomeView-C8whKl15.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-Vc8_xWgH.js","./NotSupportedView-DQerxQzi.css","./DownloadGitView-rPK_vYgU.js","./ManualConfigurationView-enyqGo0M.js","./ManualConfigurationView-CsirlNfV.css","./MetricsConsentView-lSfLu4nr.js","./DesktopStartView-le6AjGZr.js","./KeybindingPanel-D6O16W_1.js","./index-DpF-ptbJ.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-3jWrm6Zi.js","./ServerConfigPanel-B-w0HFlz.js","./index-je62U6DH.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); var __defProp2 = Object.defineProperty; var __name = (target, value4) => __defProp2(target, "name", { value: value4, configurable: true }); -(/* @__PURE__ */ __name(function polyfill() { +(/* @__PURE__ */ __name(function polyfill2() { const relList = document.createElement("link").relList; if (relList && relList.supports && relList.supports("modulepreload")) { return; @@ -45,16 +45,16 @@ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols; var __hasOwnProp$1 = Object.prototype.hasOwnProperty; var __propIsEnum$1 = Object.prototype.propertyIsEnumerable; var __defNormalProp$2 = /* @__PURE__ */ __name((obj, key, value4) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value: value4 }) : obj[key] = value4, "__defNormalProp$2"); -var __spreadValues$1 = /* @__PURE__ */ __name((a, b) => { - for (var prop2 in b || (b = {})) - if (__hasOwnProp$1.call(b, prop2)) - __defNormalProp$2(a, prop2, b[prop2]); +var __spreadValues$1 = /* @__PURE__ */ __name((a2, b2) => { + for (var prop2 in b2 || (b2 = {})) + if (__hasOwnProp$1.call(b2, prop2)) + __defNormalProp$2(a2, prop2, b2[prop2]); if (__getOwnPropSymbols$1) - for (var prop2 of __getOwnPropSymbols$1(b)) { - if (__propIsEnum$1.call(b, prop2)) - __defNormalProp$2(a, prop2, b[prop2]); + for (var prop2 of __getOwnPropSymbols$1(b2)) { + if (__propIsEnum$1.call(b2, prop2)) + __defNormalProp$2(a2, prop2, b2[prop2]); } - return a; + return a2; }, "__spreadValues$1"); function isEmpty$1(value4) { return value4 === null || value4 === void 0 || value4 === "" || Array.isArray(value4) && value4.length === 0 || !(value4 instanceof Date) && typeof value4 === "object" && Object.keys(value4).length === 0; @@ -102,31 +102,31 @@ function deepEquals(obj1, obj2) { return obj1 !== obj1 && obj2 !== obj2; } __name(deepEquals, "deepEquals"); -function isFunction$5(value4) { +function isFunction$9(value4) { return !!(value4 && value4.constructor && value4.call && value4.apply); } -__name(isFunction$5, "isFunction$5"); +__name(isFunction$9, "isFunction$9"); function isNotEmpty(value4) { return !isEmpty$1(value4); } __name(isNotEmpty, "isNotEmpty"); -function resolveFieldData(data24, field) { - if (!data24 || !field) { +function resolveFieldData(data25, field) { + if (!data25 || !field) { return null; } try { - const value4 = data24[field]; + const value4 = data25[field]; if (isNotEmpty(value4)) return value4; } catch (e2) { } - if (Object.keys(data24).length) { - if (isFunction$5(field)) { - return field(data24); + if (Object.keys(data25).length) { + if (isFunction$9(field)) { + return field(data25); } else if (field.indexOf(".") === -1) { - return data24[field]; + return data25[field]; } else { let fields = field.split("."); - let value4 = data24; + let value4 = data25; for (let i2 = 0, len = fields.length; i2 < len; ++i2) { if (value4 == null) { return null; @@ -205,26 +205,26 @@ function findLastIndex(arr, callback) { return index2; } __name(findLastIndex, "findLastIndex"); -function isObject$7(value4, empty3 = true) { +function isObject$e(value4, empty3 = true) { return value4 instanceof Object && value4.constructor === Object && (empty3 || Object.keys(value4).length !== 0); } -__name(isObject$7, "isObject$7"); -function resolve$1(obj, ...params) { - return isFunction$5(obj) ? obj(...params) : obj; +__name(isObject$e, "isObject$e"); +function resolve$2(obj, ...params) { + return isFunction$9(obj) ? obj(...params) : obj; } -__name(resolve$1, "resolve$1"); -function isString$8(value4, empty3 = true) { +__name(resolve$2, "resolve$2"); +function isString$9(value4, empty3 = true) { return typeof value4 === "string" && (empty3 || value4 !== ""); } -__name(isString$8, "isString$8"); +__name(isString$9, "isString$9"); function toFlatCase(str) { - return isString$8(str) ? str.replace(/(-|_)/g, "").toLowerCase() : str; + return isString$9(str) ? str.replace(/(-|_)/g, "").toLowerCase() : str; } __name(toFlatCase, "toFlatCase"); function getKeyValue(obj, key = "", params = {}) { const fKeys = toFlatCase(key).split("."); const fKey = fKeys.shift(); - return fKey ? isObject$7(obj) ? getKeyValue(resolve$1(obj[Object.keys(obj).find((k) => toFlatCase(k) === fKey) || ""], params), fKeys.join("."), params) : void 0 : resolve$1(obj, params); + return fKey ? isObject$e(obj) ? getKeyValue(resolve$2(obj[Object.keys(obj).find((k2) => toFlatCase(k2) === fKey) || ""], params), fKeys.join("."), params) : void 0 : resolve$2(obj, params); } __name(getKeyValue, "getKeyValue"); function insertIntoOrderedArray(item3, index2, arr, sourceArr) { @@ -246,10 +246,10 @@ function insertIntoOrderedArray(item3, index2, arr, sourceArr) { } } __name(insertIntoOrderedArray, "insertIntoOrderedArray"); -function isArray$5(value4, empty3 = true) { +function isArray$a(value4, empty3 = true) { return Array.isArray(value4) && (empty3 || value4.length !== 0); } -__name(isArray$5, "isArray$5"); +__name(isArray$a, "isArray$a"); function isDate$3(value4) { return value4 instanceof Date && value4.constructor === Date; } @@ -279,7 +279,7 @@ function mergeKeys(...args) { const _mergeKeys = /* @__PURE__ */ __name((target = {}, source = {}) => { const mergedObj = __spreadValues$1({}, target); Object.keys(source).forEach((key) => { - if (isObject$7(source[key]) && key in target && isObject$7(target[key])) { + if (isObject$e(source[key]) && key in target && isObject$e(target[key])) { mergedObj[key] = _mergeKeys(target[key], source[key]); } else { mergedObj[key] = source[key]; @@ -295,10 +295,10 @@ function minifyCSS(css3) { } __name(minifyCSS, "minifyCSS"); function nestedKeys(obj = {}, parentKey = "") { - return Object.entries(obj).reduce((o, [key, value4]) => { + return Object.entries(obj).reduce((o2, [key, value4]) => { const currentKey = parentKey ? `${parentKey}.${key}` : key; - isObject$7(value4) ? o = o.concat(nestedKeys(value4, currentKey)) : o.push(currentKey); - return o; + isObject$e(value4) ? o2 = o2.concat(nestedKeys(value4, currentKey)) : o2.push(currentKey); + return o2; }, []); } __name(nestedKeys, "nestedKeys"); @@ -331,14 +331,14 @@ __name(sort, "sort"); function stringify(value4, indent = 2, currentIndent = 0) { const currentIndentStr = " ".repeat(currentIndent); const nextIndentStr = " ".repeat(currentIndent + indent); - if (isArray$5(value4)) { + if (isArray$a(value4)) { return "[" + value4.map((v2) => stringify(v2, indent, currentIndent + indent)).join(", ") + "]"; } else if (isDate$3(value4)) { return value4.toISOString(); - } else if (isFunction$5(value4)) { + } else if (isFunction$9(value4)) { return value4.toString(); - } else if (isObject$7(value4)) { - return "{\n" + Object.entries(value4).map(([k, v2]) => `${nextIndentStr}${k}: ${stringify(v2, indent, currentIndent + indent)}`).join(",\n") + ` + } else if (isObject$e(value4)) { + return "{\n" + Object.entries(value4).map(([k2, v2]) => `${nextIndentStr}${k2}: ${stringify(v2, indent, currentIndent + indent)}`).join(",\n") + ` ${currentIndentStr}}`; } else { return JSON.stringify(value4); @@ -346,15 +346,15 @@ ${currentIndentStr}}`; } __name(stringify, "stringify"); function toCapitalCase(str) { - return isString$8(str, false) ? str[0].toUpperCase() + str.slice(1) : str; + return isString$9(str, false) ? str[0].toUpperCase() + str.slice(1) : str; } __name(toCapitalCase, "toCapitalCase"); function toKebabCase(str) { - return isString$8(str) ? str.replace(/(_)/g, "-").replace(/[A-Z]/g, (c, i2) => i2 === 0 ? c : "-" + c.toLowerCase()).toLowerCase() : str; + return isString$9(str) ? str.replace(/(_)/g, "-").replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "-" + c2.toLowerCase()).toLowerCase() : str; } __name(toKebabCase, "toKebabCase"); function toTokenKey$1(str) { - return isString$8(str) ? str.replace(/[A-Z]/g, (c, i2) => i2 === 0 ? c : "." + c.toLowerCase()).toLowerCase() : str; + return isString$9(str) ? str.replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "." + c2.toLowerCase()).toLowerCase() : str; } __name(toTokenKey$1, "toTokenKey$1"); function EventBus() { @@ -395,18 +395,18 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp$1 = /* @__PURE__ */ __name((obj, key, value4) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value: value4 }) : obj[key] = value4, "__defNormalProp$1"); -var __spreadValues = /* @__PURE__ */ __name((a, b) => { - for (var prop2 in b || (b = {})) - if (__hasOwnProp.call(b, prop2)) - __defNormalProp$1(a, prop2, b[prop2]); +var __spreadValues = /* @__PURE__ */ __name((a2, b2) => { + for (var prop2 in b2 || (b2 = {})) + if (__hasOwnProp.call(b2, prop2)) + __defNormalProp$1(a2, prop2, b2[prop2]); if (__getOwnPropSymbols) - for (var prop2 of __getOwnPropSymbols(b)) { - if (__propIsEnum.call(b, prop2)) - __defNormalProp$1(a, prop2, b[prop2]); + for (var prop2 of __getOwnPropSymbols(b2)) { + if (__propIsEnum.call(b2, prop2)) + __defNormalProp$1(a2, prop2, b2[prop2]); } - return a; + return a2; }, "__spreadValues"); -var __spreadProps = /* @__PURE__ */ __name((a, b) => __defProps(a, __getOwnPropDescs(b)), "__spreadProps"); +var __spreadProps = /* @__PURE__ */ __name((a2, b2) => __defProps(a2, __getOwnPropDescs(b2)), "__spreadProps"); var __objRest = /* @__PURE__ */ __name((source, exclude) => { var target = {}; for (var prop2 in source) @@ -426,19 +426,19 @@ __name(definePreset, "definePreset"); var ThemeService = EventBus(); var service_default = ThemeService; function toTokenKey(str) { - return isString$8(str) ? str.replace(/[A-Z]/g, (c, i2) => i2 === 0 ? c : "." + c.toLowerCase()).toLowerCase() : str; + return isString$9(str) ? str.replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "." + c2.toLowerCase()).toLowerCase() : str; } __name(toTokenKey, "toTokenKey"); -function merge$1(value1, value22) { - if (isArray$5(value1)) { +function merge$2(value1, value22) { + if (isArray$a(value1)) { value1.push(...value22 || []); - } else if (isObject$7(value1)) { + } else if (isObject$e(value1)) { Object.assign(value1, value22); } } -__name(merge$1, "merge$1"); +__name(merge$2, "merge$2"); function toValue$2(value4) { - return isObject$7(value4) && value4.hasOwnProperty("value") && value4.hasOwnProperty("type") ? value4.value : value4; + return isObject$e(value4) && value4.hasOwnProperty("value") && value4.hasOwnProperty("type") ? value4.value : value4; } __name(toValue$2, "toValue$2"); function toUnit(value4, variable = "") { @@ -456,7 +456,7 @@ function toNormalizePrefix(prefix2) { } __name(toNormalizePrefix, "toNormalizePrefix"); function toNormalizeVariable(prefix2 = "", variable = "") { - return toNormalizePrefix(`${isString$8(prefix2, false) && isString$8(variable, false) ? `${prefix2}-` : prefix2}${variable}`); + return toNormalizePrefix(`${isString$9(prefix2, false) && isString$9(variable, false) ? `${prefix2}-` : prefix2}${variable}`); } __name(toNormalizeVariable, "toNormalizeVariable"); function getVariableName(prefix2 = "", variable = "") { @@ -464,7 +464,7 @@ function getVariableName(prefix2 = "", variable = "") { } __name(getVariableName, "getVariableName"); function getVariableValue(value4, variable = "", prefix2 = "", excludedKeyRegexes = [], fallback) { - if (isString$8(value4)) { + if (isString$9(value4)) { const regex2 = /{([^}]*)}/g; const val = value4.trim(); if (matchRegex(val, regex2)) { @@ -485,7 +485,7 @@ function getVariableValue(value4, variable = "", prefix2 = "", excludedKeyRegexe } __name(getVariableValue, "getVariableValue"); function getComputedValue(obj = {}, value4) { - if (isString$8(value4)) { + if (isString$9(value4)) { const regex2 = /{([^}]*)}/g; const val = value4.trim(); return matchRegex(val, regex2) ? val.replaceAll(regex2, (v2) => getKeyValue(obj, v2.replace(/{|}/g, ""))) : val; @@ -496,7 +496,7 @@ function getComputedValue(obj = {}, value4) { } __name(getComputedValue, "getComputedValue"); function setProperty(properties, key, value4) { - if (isString$8(key, false)) { + if (isString$9(key, false)) { properties.push(`${key}:${value4};`); } } @@ -517,29 +517,29 @@ function normalizeColor(color2) { __name(normalizeColor, "normalizeColor"); function hexToRgb$1(hex) { var bigint = parseInt(hex.substring(1), 16); - var r = bigint >> 16 & 255; + var r2 = bigint >> 16 & 255; var g2 = bigint >> 8 & 255; - var b = bigint & 255; - return { r, g: g2, b }; + var b2 = bigint & 255; + return { r: r2, g: g2, b: b2 }; } __name(hexToRgb$1, "hexToRgb$1"); -function rgbToHex(r, g2, b) { - return `#${r.toString(16).padStart(2, "0")}${g2.toString(16).padStart(2, "0")}${b.toString(16).padStart(2, "0")}`; +function rgbToHex(r2, g2, b2) { + return `#${r2.toString(16).padStart(2, "0")}${g2.toString(16).padStart(2, "0")}${b2.toString(16).padStart(2, "0")}`; } __name(rgbToHex, "rgbToHex"); var mix_default = /* @__PURE__ */ __name((color1, color2, weight) => { color1 = normalizeColor(color1); color2 = normalizeColor(color2); var p2 = weight / 100; - var w = p2 * 2 - 1; - var w1 = (w + 1) / 2; - var w2 = 1 - w1; + var w2 = p2 * 2 - 1; + var w1 = (w2 + 1) / 2; + var w22 = 1 - w1; var rgb1 = hexToRgb$1(color1); var rgb2 = hexToRgb$1(color2); - var r = Math.round(rgb1.r * w1 + rgb2.r * w2); - var g2 = Math.round(rgb1.g * w1 + rgb2.g * w2); - var b = Math.round(rgb1.b * w1 + rgb2.b * w2); - return rgbToHex(r, g2, b); + var r2 = Math.round(rgb1.r * w1 + rgb2.r * w22); + var g2 = Math.round(rgb1.g * w1 + rgb2.g * w22); + var b2 = Math.round(rgb1.b * w1 + rgb2.b * w22); + return rgbToHex(r2, g2, b2); }, "mix_default"); var shade_default = /* @__PURE__ */ __name((color2, percent) => mix_default("#000000", color2, percent), "shade_default"); var tint_default = /* @__PURE__ */ __name((color2, percent) => mix_default("#ffffff", color2, percent), "tint_default"); @@ -553,10 +553,10 @@ var palette_default = /* @__PURE__ */ __name((color2) => { }, "palette_default"); var $dt = /* @__PURE__ */ __name((tokenPath) => { var _a2; - const theme40 = config_default.getTheme(); - const variable = dtwt(theme40, tokenPath, void 0, "variable"); + const theme42 = config_default.getTheme(); + const variable = dtwt(theme42, tokenPath, void 0, "variable"); const name2 = (_a2 = variable.match(/--[\w-]+/g)) == null ? void 0 : _a2[0]; - const value4 = dtwt(theme40, tokenPath, void 0, "value"); + const value4 = dtwt(theme42, tokenPath, void 0, "value"); return { name: name2, variable, @@ -566,10 +566,10 @@ var $dt = /* @__PURE__ */ __name((tokenPath) => { var dt = /* @__PURE__ */ __name((...args) => { return dtwt(config_default.getTheme(), ...args); }, "dt"); -var dtwt = /* @__PURE__ */ __name((theme40 = {}, tokenPath, fallback, type = "variable") => { +var dtwt = /* @__PURE__ */ __name((theme42 = {}, tokenPath, fallback, type = "variable") => { if (tokenPath) { const { variable: VARIABLE, options: OPTIONS } = config_default.defaults || {}; - const { prefix: prefix2, transform: transform2 } = (theme40 == null ? void 0 : theme40.options) || OPTIONS || {}; + const { prefix: prefix2, transform: transform2 } = (theme42 == null ? void 0 : theme42.options) || OPTIONS || {}; const regex2 = /{([^}]*)}/g; const token = matchRegex(tokenPath, regex2) ? tokenPath : `{${tokenPath}}`; const isStrictTransform = type === "value" || transform2 === "strict"; @@ -578,11 +578,11 @@ var dtwt = /* @__PURE__ */ __name((theme40 = {}, tokenPath, fallback, type = "va return ""; }, "dtwt"); function css$2(style2) { - return resolve$1(style2, { dt }); + return resolve$2(style2, { dt }); } __name(css$2, "css$2"); -var $t = /* @__PURE__ */ __name((theme40 = {}) => { - let { preset: _preset, options: _options } = theme40; +var $t = /* @__PURE__ */ __name((theme42 = {}) => { + let { preset: _preset, options: _options } = theme42; return { preset(value4) { _preset = _preset ? mergeKeys(_preset, value4) : value4; @@ -634,7 +634,7 @@ var $t = /* @__PURE__ */ __name((theme40 = {}) => { } }; }, "$t"); -function toVariables_default(theme40, options4 = {}) { +function toVariables_default(theme42, options4 = {}) { const VARIABLE = config_default.defaults.variable; const { prefix: prefix2 = VARIABLE.prefix, selector = VARIABLE.selector, excludedKeyRegex = VARIABLE.excludedKeyRegex } = options4; const _toVariables = /* @__PURE__ */ __name((_theme, _prefix = "") => { @@ -642,10 +642,10 @@ function toVariables_default(theme40, options4 = {}) { (acc, [key, value4]) => { const px = matchRegex(key, excludedKeyRegex) ? toNormalizeVariable(_prefix) : toNormalizeVariable(_prefix, toKebabCase(key)); const v2 = toValue$2(value4); - if (isObject$7(v2)) { + if (isObject$e(v2)) { const { variables: variables2, tokens: tokens2 } = _toVariables(v2, px); - merge$1(acc["tokens"], tokens2); - merge$1(acc["variables"], variables2); + merge$2(acc["tokens"], tokens2); + merge$2(acc["variables"], variables2); } else { acc["tokens"].push((prefix2 ? px.replace(`${prefix2}-`, "") : px).replaceAll("-", ".")); setProperty(acc["variables"], getVariableName(px), getVariableValue(v2, px, prefix2, [excludedKeyRegex])); @@ -655,7 +655,7 @@ function toVariables_default(theme40, options4 = {}) { { variables: [], tokens: [] } ); }, "_toVariables"); - const { variables, tokens } = _toVariables(theme40, prefix2); + const { variables, tokens } = _toVariables(theme42, prefix2); return { value: variables, tokens, @@ -698,19 +698,19 @@ var themeUtils_default = { } }, resolve(value4) { - const rules = Object.keys(this.rules).filter((k) => k !== "custom").map((r) => this.rules[r]); + const rules = Object.keys(this.rules).filter((k2) => k2 !== "custom").map((r2) => this.rules[r2]); return [value4].flat().map((v2) => { var _a2; - return (_a2 = rules.map((r) => r.resolve(v2)).find((rr) => rr.matched)) != null ? _a2 : this.rules.custom.resolve(v2); + return (_a2 = rules.map((r2) => r2.resolve(v2)).find((rr) => rr.matched)) != null ? _a2 : this.rules.custom.resolve(v2); }); } }, - _toVariables(theme40, options4) { - return toVariables_default(theme40, { prefix: options4 == null ? void 0 : options4.prefix }); + _toVariables(theme42, options4) { + return toVariables_default(theme42, { prefix: options4 == null ? void 0 : options4.prefix }); }, - getCommon({ name: name2 = "", theme: theme40 = {}, params, set: set3, defaults: defaults2 }) { + getCommon({ name: name2 = "", theme: theme42 = {}, params, set: set3, defaults: defaults2 }) { var _c, _d, _e, _f; - const { preset, options: options4 } = theme40; + const { preset, options: options4 } = theme42; let primitive_css, primitive_tokens, semantic_css, semantic_tokens; if (isNotEmpty(preset)) { const { primitive, semantic } = preset; @@ -761,16 +761,16 @@ var themeUtils_default = { tokens }; }, - getPresetC({ name: name2 = "", theme: theme40 = {}, params, set: set3, defaults: defaults2 }) { + getPresetC({ name: name2 = "", theme: theme42 = {}, params, set: set3, defaults: defaults2 }) { var _a2; - const { preset, options: options4 } = theme40; + const { preset, options: options4 } = theme42; const cPreset = (_a2 = preset == null ? void 0 : preset.components) == null ? void 0 : _a2[name2]; return this.getPreset({ name: name2, preset: cPreset, options: options4, params, set: set3, defaults: defaults2 }); }, - getPresetD({ name: name2 = "", theme: theme40 = {}, params, set: set3, defaults: defaults2 }) { + getPresetD({ name: name2 = "", theme: theme42 = {}, params, set: set3, defaults: defaults2 }) { var _a2; const dName = name2.replace("-directive", ""); - const { preset, options: options4 } = theme40; + const { preset, options: options4 } = theme42; const dPreset = (_a2 = preset == null ? void 0 : preset.directives) == null ? void 0 : _a2[dName]; return this.getPreset({ name: dName, preset: dPreset, options: options4, params, set: set3, defaults: defaults2 }); }, @@ -781,14 +781,14 @@ var themeUtils_default = { getLayerOrder(name2, options4 = {}, params, defaults2) { const { cssLayer } = options4; if (cssLayer) { - const order = resolve$1(cssLayer.order || "primeui", params); + const order = resolve$2(cssLayer.order || "primeui", params); return `@layer ${order}`; } return ""; }, - getCommonStyleSheet({ name: name2 = "", theme: theme40 = {}, params, props = {}, set: set3, defaults: defaults2 }) { - const common = this.getCommon({ name: name2, theme: theme40, params, set: set3, defaults: defaults2 }); - const _props = Object.entries(props).reduce((acc, [k, v2]) => acc.push(`${k}="${v2}"`) && acc, []).join(" "); + getCommonStyleSheet({ name: name2 = "", theme: theme42 = {}, params, props = {}, set: set3, defaults: defaults2 }) { + const common = this.getCommon({ name: name2, theme: theme42, params, set: set3, defaults: defaults2 }); + const _props = Object.entries(props).reduce((acc, [k2, v2]) => acc.push(`${k2}="${v2}"`) && acc, []).join(" "); return Object.entries(common || {}).reduce((acc, [key, value4]) => { if (value4 == null ? void 0 : value4.css) { const _css = minifyCSS(value4 == null ? void 0 : value4.css); @@ -798,18 +798,18 @@ var themeUtils_default = { return acc; }, []).join(""); }, - getStyleSheet({ name: name2 = "", theme: theme40 = {}, params, props = {}, set: set3, defaults: defaults2 }) { + getStyleSheet({ name: name2 = "", theme: theme42 = {}, params, props = {}, set: set3, defaults: defaults2 }) { var _a2; - const options4 = { name: name2, theme: theme40, params, set: set3, defaults: defaults2 }; + const options4 = { name: name2, theme: theme42, params, set: set3, defaults: defaults2 }; const preset_css = (_a2 = name2.includes("-directive") ? this.getPresetD(options4) : this.getPresetC(options4)) == null ? void 0 : _a2.css; - const _props = Object.entries(props).reduce((acc, [k, v2]) => acc.push(`${k}="${v2}"`) && acc, []).join(" "); + const _props = Object.entries(props).reduce((acc, [k2, v2]) => acc.push(`${k2}="${v2}"`) && acc, []).join(" "); return preset_css ? `` : ""; }, createTokens(obj = {}, defaults2, parentKey = "", parentPath = "", tokens = {}) { Object.entries(obj).forEach(([key, value4]) => { const currentKey = matchRegex(key, defaults2.variable.excludedKeyRegex) ? parentKey : parentKey ? `${parentKey}.${toTokenKey$1(key)}` : toTokenKey$1(key); const currentPath = parentPath ? `${parentPath}.${key}` : key; - if (isObject$7(value4)) { + if (isObject$e(value4)) { this.createTokens(value4, defaults2, currentKey, currentPath, tokens); } else { tokens[currentKey] || (tokens[currentKey] = { @@ -857,11 +857,11 @@ var themeUtils_default = { }, getTokenValue(tokens, path, defaults2) { var _a2; - const normalizePath = /* @__PURE__ */ __name((str) => { + const normalizePath2 = /* @__PURE__ */ __name((str) => { const strArr = str.split("."); - return strArr.filter((s) => !matchRegex(s.toLowerCase(), defaults2.variable.excludedKeyRegex)).join("."); + return strArr.filter((s2) => !matchRegex(s2.toLowerCase(), defaults2.variable.excludedKeyRegex)).join("."); }, "normalizePath"); - const token = normalizePath(path); + const token = normalizePath2(path); const colorScheme = path.includes("colorScheme.light") ? "light" : path.includes("colorScheme.dark") ? "dark" : void 0; const computedValues = [(_a2 = tokens[token]) == null ? void 0 : _a2.computed(colorScheme)].flat().filter((computed2) => computed2); return computedValues.length === 1 ? computedValues[0].value : computedValues.reduce((acc = {}, computed2) => { @@ -888,7 +888,7 @@ var themeUtils_default = { name: "primeui", order: "primeui" }; - isObject$7(cssLayer) && (layerOptions.name = resolve$1(cssLayer.name, { name: name2, type })); + isObject$e(cssLayer) && (layerOptions.name = resolve$2(cssLayer.name, { name: name2, type })); if (isNotEmpty(layerOptions.name)) { css22 = getRule(`@layer ${layerOptions.name}`, css22); set3 == null ? void 0 : set3.layerNames(layerOptions.name); @@ -918,10 +918,10 @@ var config_default = { _loadingStyles: /* @__PURE__ */ new Set(), _tokens: {}, update(newValues = {}) { - const { theme: theme40 } = newValues; - if (theme40) { - this._theme = __spreadProps(__spreadValues({}, theme40), { - options: __spreadValues(__spreadValues({}, this.defaults.options), theme40.options) + const { theme: theme42 } = newValues; + if (theme42) { + this._theme = __spreadProps(__spreadValues({}, theme42), { + options: __spreadValues(__spreadValues({}, this.defaults.options), theme42.options) }); this._tokens = themeUtils_default.createTokens(this.preset, this.defaults); this.clearLoadedStyleNames(); @@ -1052,8 +1052,8 @@ function usePreset(...presets) { return newPreset; } __name(usePreset, "usePreset"); -function useTheme(theme40) { - return $t(theme40).update({ mergePresets: false }); +function useTheme(theme42) { + return $t(theme42).update({ mergePresets: false }); } __name(useTheme, "useTheme"); var index$1n = { @@ -5973,6 +5973,25391 @@ var index$2 = { ripple: index$u } }; +const DEBUG_BUILD$6 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +const SDK_VERSION = "8.48.0"; +const GLOBAL_OBJ = globalThis; +function getGlobalSingleton(name2, creator, obj) { + const gbl = obj || GLOBAL_OBJ; + const __SENTRY__ = gbl.__SENTRY__ = gbl.__SENTRY__ || {}; + const versionedCarrier = __SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {}; + return versionedCarrier[name2] || (versionedCarrier[name2] = creator()); +} +__name(getGlobalSingleton, "getGlobalSingleton"); +const DEBUG_BUILD$5 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +const PREFIX$2 = "Sentry Logger "; +const CONSOLE_LEVELS$1 = [ + "debug", + "info", + "warn", + "error", + "log", + "assert", + "trace" +]; +const originalConsoleMethods = {}; +function consoleSandbox(callback) { + if (!("console" in GLOBAL_OBJ)) { + return callback(); + } + const console2 = GLOBAL_OBJ.console; + const wrappedFuncs = {}; + const wrappedLevels = Object.keys(originalConsoleMethods); + wrappedLevels.forEach((level) => { + const originalConsoleMethod = originalConsoleMethods[level]; + wrappedFuncs[level] = console2[level]; + console2[level] = originalConsoleMethod; + }); + try { + return callback(); + } finally { + wrappedLevels.forEach((level) => { + console2[level] = wrappedFuncs[level]; + }); + } +} +__name(consoleSandbox, "consoleSandbox"); +function makeLogger() { + let enabled = false; + const logger2 = { + enable: /* @__PURE__ */ __name(() => { + enabled = true; + }, "enable"), + disable: /* @__PURE__ */ __name(() => { + enabled = false; + }, "disable"), + isEnabled: /* @__PURE__ */ __name(() => enabled, "isEnabled") + }; + if (DEBUG_BUILD$5) { + CONSOLE_LEVELS$1.forEach((name2) => { + logger2[name2] = (...args) => { + if (enabled) { + consoleSandbox(() => { + GLOBAL_OBJ.console[name2](`${PREFIX$2}[${name2}]:`, ...args); + }); + } + }; + }); + } else { + CONSOLE_LEVELS$1.forEach((name2) => { + logger2[name2] = () => void 0; + }); + } + return logger2; +} +__name(makeLogger, "makeLogger"); +const logger$2 = getGlobalSingleton("logger", makeLogger); +const STACKTRACE_FRAME_LIMIT = 50; +const UNKNOWN_FUNCTION = "?"; +const WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/; +const STRIP_FRAME_REGEXP = /captureMessage|captureException/; +function createStackParser(...parsers) { + const sortedParsers = parsers.sort((a2, b2) => a2[0] - b2[0]).map((p2) => p2[1]); + return (stack2, skipFirstLines = 0, framesToPop = 0) => { + const frames = []; + const lines = stack2.split("\n"); + for (let i2 = skipFirstLines; i2 < lines.length; i2++) { + const line = lines[i2]; + if (line.length > 1024) { + continue; + } + const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, "$1") : line; + if (cleanedLine.match(/\S*Error: /)) { + continue; + } + for (const parser of sortedParsers) { + const frame = parser(cleanedLine); + if (frame) { + frames.push(frame); + break; + } + } + if (frames.length >= STACKTRACE_FRAME_LIMIT + framesToPop) { + break; + } + } + return stripSentryFramesAndReverse(frames.slice(framesToPop)); + }; +} +__name(createStackParser, "createStackParser"); +function stackParserFromStackParserOptions(stackParser) { + if (Array.isArray(stackParser)) { + return createStackParser(...stackParser); + } + return stackParser; +} +__name(stackParserFromStackParserOptions, "stackParserFromStackParserOptions"); +function stripSentryFramesAndReverse(stack2) { + if (!stack2.length) { + return []; + } + const localStack = Array.from(stack2); + if (/sentryWrapped/.test(getLastStackFrame(localStack).function || "")) { + localStack.pop(); + } + localStack.reverse(); + if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || "")) { + localStack.pop(); + if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || "")) { + localStack.pop(); + } + } + return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map((frame) => ({ + ...frame, + filename: frame.filename || getLastStackFrame(localStack).filename, + function: frame.function || UNKNOWN_FUNCTION + })); +} +__name(stripSentryFramesAndReverse, "stripSentryFramesAndReverse"); +function getLastStackFrame(arr) { + return arr[arr.length - 1] || {}; +} +__name(getLastStackFrame, "getLastStackFrame"); +const defaultFunctionName = ""; +function getFunctionName(fn) { + try { + if (!fn || typeof fn !== "function") { + return defaultFunctionName; + } + return fn.name || defaultFunctionName; + } catch (e2) { + return defaultFunctionName; + } +} +__name(getFunctionName, "getFunctionName"); +function getFramesFromEvent(event) { + const exception = event.exception; + if (exception) { + const frames = []; + try { + exception.values.forEach((value4) => { + if (value4.stacktrace.frames) { + frames.push(...value4.stacktrace.frames); + } + }); + return frames; + } catch (_oO) { + return void 0; + } + } + return void 0; +} +__name(getFramesFromEvent, "getFramesFromEvent"); +const handlers$4 = {}; +const instrumented$1 = {}; +function addHandler$1(type, handler6) { + handlers$4[type] = handlers$4[type] || []; + handlers$4[type].push(handler6); +} +__name(addHandler$1, "addHandler$1"); +function resetInstrumentationHandlers() { + Object.keys(handlers$4).forEach((key) => { + handlers$4[key] = void 0; + }); +} +__name(resetInstrumentationHandlers, "resetInstrumentationHandlers"); +function maybeInstrument(type, instrumentFn) { + if (!instrumented$1[type]) { + instrumented$1[type] = true; + try { + instrumentFn(); + } catch (e2) { + DEBUG_BUILD$5 && logger$2.error(`Error while instrumenting ${type}`, e2); + } + } +} +__name(maybeInstrument, "maybeInstrument"); +function triggerHandlers$1(type, data25) { + const typeHandlers = type && handlers$4[type]; + if (!typeHandlers) { + return; + } + for (const handler6 of typeHandlers) { + try { + handler6(data25); + } catch (e2) { + DEBUG_BUILD$5 && logger$2.error( + `Error while triggering instrumentation handler. +Type: ${type} +Name: ${getFunctionName(handler6)} +Error:`, + e2 + ); + } + } +} +__name(triggerHandlers$1, "triggerHandlers$1"); +let _oldOnErrorHandler = null; +function addGlobalErrorInstrumentationHandler(handler6) { + const type = "error"; + addHandler$1(type, handler6); + maybeInstrument(type, instrumentError); +} +__name(addGlobalErrorInstrumentationHandler, "addGlobalErrorInstrumentationHandler"); +function instrumentError() { + _oldOnErrorHandler = GLOBAL_OBJ.onerror; + GLOBAL_OBJ.onerror = function(msg, url, line, column, error2) { + const handlerData = { + column, + error: error2, + line, + msg, + url + }; + triggerHandlers$1("error", handlerData); + if (_oldOnErrorHandler) { + return _oldOnErrorHandler.apply(this, arguments); + } + return false; + }; + GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true; +} +__name(instrumentError, "instrumentError"); +let _oldOnUnhandledRejectionHandler = null; +function addGlobalUnhandledRejectionInstrumentationHandler(handler6) { + const type = "unhandledrejection"; + addHandler$1(type, handler6); + maybeInstrument(type, instrumentUnhandledRejection); +} +__name(addGlobalUnhandledRejectionInstrumentationHandler, "addGlobalUnhandledRejectionInstrumentationHandler"); +function instrumentUnhandledRejection() { + _oldOnUnhandledRejectionHandler = GLOBAL_OBJ.onunhandledrejection; + GLOBAL_OBJ.onunhandledrejection = function(e2) { + const handlerData = e2; + triggerHandlers$1("unhandledrejection", handlerData); + if (_oldOnUnhandledRejectionHandler) { + return _oldOnUnhandledRejectionHandler.apply(this, arguments); + } + return true; + }; + GLOBAL_OBJ.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true; +} +__name(instrumentUnhandledRejection, "instrumentUnhandledRejection"); +function getMainCarrier() { + getSentryCarrier(GLOBAL_OBJ); + return GLOBAL_OBJ; +} +__name(getMainCarrier, "getMainCarrier"); +function getSentryCarrier(carrier) { + const __SENTRY__ = carrier.__SENTRY__ = carrier.__SENTRY__ || {}; + __SENTRY__.version = __SENTRY__.version || SDK_VERSION; + return __SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {}; +} +__name(getSentryCarrier, "getSentryCarrier"); +const objectToString$4 = Object.prototype.toString; +function isError(wat) { + switch (objectToString$4.call(wat)) { + case "[object Error]": + case "[object Exception]": + case "[object DOMException]": + case "[object WebAssembly.Exception]": + return true; + default: + return isInstanceOf(wat, Error); + } +} +__name(isError, "isError"); +function isBuiltin(wat, className) { + return objectToString$4.call(wat) === `[object ${className}]`; +} +__name(isBuiltin, "isBuiltin"); +function isErrorEvent$2(wat) { + return isBuiltin(wat, "ErrorEvent"); +} +__name(isErrorEvent$2, "isErrorEvent$2"); +function isDOMError(wat) { + return isBuiltin(wat, "DOMError"); +} +__name(isDOMError, "isDOMError"); +function isDOMException(wat) { + return isBuiltin(wat, "DOMException"); +} +__name(isDOMException, "isDOMException"); +function isString$8(wat) { + return isBuiltin(wat, "String"); +} +__name(isString$8, "isString$8"); +function isParameterizedString(wat) { + return typeof wat === "object" && wat !== null && "__sentry_template_string__" in wat && "__sentry_template_values__" in wat; +} +__name(isParameterizedString, "isParameterizedString"); +function isPrimitive(wat) { + return wat === null || isParameterizedString(wat) || typeof wat !== "object" && typeof wat !== "function"; +} +__name(isPrimitive, "isPrimitive"); +function isPlainObject$5(wat) { + return isBuiltin(wat, "Object"); +} +__name(isPlainObject$5, "isPlainObject$5"); +function isEvent(wat) { + return typeof Event !== "undefined" && isInstanceOf(wat, Event); +} +__name(isEvent, "isEvent"); +function isElement$3(wat) { + return typeof Element !== "undefined" && isInstanceOf(wat, Element); +} +__name(isElement$3, "isElement$3"); +function isRegExp$5(wat) { + return isBuiltin(wat, "RegExp"); +} +__name(isRegExp$5, "isRegExp$5"); +function isThenable$1(wat) { + return Boolean(wat && wat.then && typeof wat.then === "function"); +} +__name(isThenable$1, "isThenable$1"); +function isSyntheticEvent(wat) { + return isPlainObject$5(wat) && "nativeEvent" in wat && "preventDefault" in wat && "stopPropagation" in wat; +} +__name(isSyntheticEvent, "isSyntheticEvent"); +function isInstanceOf(wat, base2) { + try { + return wat instanceof base2; + } catch (_e) { + return false; + } +} +__name(isInstanceOf, "isInstanceOf"); +function isVueViewModel(wat) { + return !!(typeof wat === "object" && wat !== null && (wat.__isVue || wat._isVue)); +} +__name(isVueViewModel, "isVueViewModel"); +const WINDOW$8 = GLOBAL_OBJ; +const DEFAULT_MAX_STRING_LENGTH = 80; +function htmlTreeAsString(elem, options4 = {}) { + if (!elem) { + return ""; + } + try { + let currentElem = elem; + const MAX_TRAVERSE_HEIGHT = 5; + const out = []; + let height = 0; + let len = 0; + const separator = " > "; + const sepLength = separator.length; + let nextStr; + const keyAttrs = Array.isArray(options4) ? options4 : options4.keyAttrs; + const maxStringLength = !Array.isArray(options4) && options4.maxStringLength || DEFAULT_MAX_STRING_LENGTH; + while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) { + nextStr = _htmlElementAsString(currentElem, keyAttrs); + if (nextStr === "html" || height > 1 && len + out.length * sepLength + nextStr.length >= maxStringLength) { + break; + } + out.push(nextStr); + len += nextStr.length; + currentElem = currentElem.parentNode; + } + return out.reverse().join(separator); + } catch (_oO) { + return ""; + } +} +__name(htmlTreeAsString, "htmlTreeAsString"); +function _htmlElementAsString(el, keyAttrs) { + const elem = el; + const out = []; + if (!elem || !elem.tagName) { + return ""; + } + if (WINDOW$8.HTMLElement) { + if (elem instanceof HTMLElement && elem.dataset) { + if (elem.dataset["sentryComponent"]) { + return elem.dataset["sentryComponent"]; + } + if (elem.dataset["sentryElement"]) { + return elem.dataset["sentryElement"]; + } + } + } + out.push(elem.tagName.toLowerCase()); + const keyAttrPairs = keyAttrs && keyAttrs.length ? keyAttrs.filter((keyAttr) => elem.getAttribute(keyAttr)).map((keyAttr) => [keyAttr, elem.getAttribute(keyAttr)]) : null; + if (keyAttrPairs && keyAttrPairs.length) { + keyAttrPairs.forEach((keyAttrPair) => { + out.push(`[${keyAttrPair[0]}="${keyAttrPair[1]}"]`); + }); + } else { + if (elem.id) { + out.push(`#${elem.id}`); + } + const className = elem.className; + if (className && isString$8(className)) { + const classes2 = className.split(/\s+/); + for (const c2 of classes2) { + out.push(`.${c2}`); + } + } + } + const allowedAttrs = ["aria-label", "type", "name", "title", "alt"]; + for (const k2 of allowedAttrs) { + const attr = elem.getAttribute(k2); + if (attr) { + out.push(`[${k2}="${attr}"]`); + } + } + return out.join(""); +} +__name(_htmlElementAsString, "_htmlElementAsString"); +function getLocationHref() { + try { + return WINDOW$8.document.location.href; + } catch (oO) { + return ""; + } +} +__name(getLocationHref, "getLocationHref"); +function getDomElement(selector) { + if (WINDOW$8.document && WINDOW$8.document.querySelector) { + return WINDOW$8.document.querySelector(selector); + } + return null; +} +__name(getDomElement, "getDomElement"); +function getComponentName$1(elem) { + if (!WINDOW$8.HTMLElement) { + return null; + } + let currentElem = elem; + const MAX_TRAVERSE_HEIGHT = 5; + for (let i2 = 0; i2 < MAX_TRAVERSE_HEIGHT; i2++) { + if (!currentElem) { + return null; + } + if (currentElem instanceof HTMLElement) { + if (currentElem.dataset["sentryComponent"]) { + return currentElem.dataset["sentryComponent"]; + } + if (currentElem.dataset["sentryElement"]) { + return currentElem.dataset["sentryElement"]; + } + } + currentElem = currentElem.parentNode; + } + return null; +} +__name(getComponentName$1, "getComponentName$1"); +function truncate(str, max = 0) { + if (typeof str !== "string" || max === 0) { + return str; + } + return str.length <= max ? str : `${str.slice(0, max)}...`; +} +__name(truncate, "truncate"); +function snipLine(line, colno) { + let newLine = line; + const lineLength = newLine.length; + if (lineLength <= 150) { + return newLine; + } + if (colno > lineLength) { + colno = lineLength; + } + let start2 = Math.max(colno - 60, 0); + if (start2 < 5) { + start2 = 0; + } + let end = Math.min(start2 + 140, lineLength); + if (end > lineLength - 5) { + end = lineLength; + } + if (end === lineLength) { + start2 = Math.max(end - 140, 0); + } + newLine = newLine.slice(start2, end); + if (start2 > 0) { + newLine = `'{snip} ${newLine}`; + } + if (end < lineLength) { + newLine += " {snip}"; + } + return newLine; +} +__name(snipLine, "snipLine"); +function safeJoin(input, delimiter2) { + if (!Array.isArray(input)) { + return ""; + } + const output = []; + for (let i2 = 0; i2 < input.length; i2++) { + const value4 = input[i2]; + try { + if (isVueViewModel(value4)) { + output.push("[VueViewModel]"); + } else { + output.push(String(value4)); + } + } catch (e2) { + output.push("[value cannot be serialized]"); + } + } + return output.join(delimiter2); +} +__name(safeJoin, "safeJoin"); +function isMatchingPattern(value4, pattern, requireExactStringMatch = false) { + if (!isString$8(value4)) { + return false; + } + if (isRegExp$5(pattern)) { + return pattern.test(value4); + } + if (isString$8(pattern)) { + return requireExactStringMatch ? value4 === pattern : value4.includes(pattern); + } + return false; +} +__name(isMatchingPattern, "isMatchingPattern"); +function stringMatchesSomePattern(testString, patterns = [], requireExactStringMatch = false) { + return patterns.some((pattern) => isMatchingPattern(testString, pattern, requireExactStringMatch)); +} +__name(stringMatchesSomePattern, "stringMatchesSomePattern"); +function fill(source, name2, replacementFactory) { + if (!(name2 in source)) { + return; + } + const original = source[name2]; + const wrapped = replacementFactory(original); + if (typeof wrapped === "function") { + markFunctionWrapped(wrapped, original); + } + try { + source[name2] = wrapped; + } catch (e2) { + DEBUG_BUILD$5 && logger$2.log(`Failed to replace method "${name2}" in object`, source); + } +} +__name(fill, "fill"); +function addNonEnumerableProperty(obj, name2, value4) { + try { + Object.defineProperty(obj, name2, { + // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it + value: value4, + writable: true, + configurable: true + }); + } catch (o_O) { + DEBUG_BUILD$5 && logger$2.log(`Failed to add non-enumerable property "${name2}" to object`, obj); + } +} +__name(addNonEnumerableProperty, "addNonEnumerableProperty"); +function markFunctionWrapped(wrapped, original) { + try { + const proto = original.prototype || {}; + wrapped.prototype = original.prototype = proto; + addNonEnumerableProperty(wrapped, "__sentry_original__", original); + } catch (o_O) { + } +} +__name(markFunctionWrapped, "markFunctionWrapped"); +function getOriginalFunction(func) { + return func.__sentry_original__; +} +__name(getOriginalFunction, "getOriginalFunction"); +function urlEncode(object) { + return Object.entries(object).map(([key, value4]) => `${encodeURIComponent(key)}=${encodeURIComponent(value4)}`).join("&"); +} +__name(urlEncode, "urlEncode"); +function convertToPlainObject(value4) { + if (isError(value4)) { + return { + message: value4.message, + name: value4.name, + stack: value4.stack, + ...getOwnProperties(value4) + }; + } else if (isEvent(value4)) { + const newObj = { + type: value4.type, + target: serializeEventTarget(value4.target), + currentTarget: serializeEventTarget(value4.currentTarget), + ...getOwnProperties(value4) + }; + if (typeof CustomEvent !== "undefined" && isInstanceOf(value4, CustomEvent)) { + newObj.detail = value4.detail; + } + return newObj; + } else { + return value4; + } +} +__name(convertToPlainObject, "convertToPlainObject"); +function serializeEventTarget(target) { + try { + return isElement$3(target) ? htmlTreeAsString(target) : Object.prototype.toString.call(target); + } catch (_oO) { + return ""; + } +} +__name(serializeEventTarget, "serializeEventTarget"); +function getOwnProperties(obj) { + if (typeof obj === "object" && obj !== null) { + const extractedProps = {}; + for (const property in obj) { + if (Object.prototype.hasOwnProperty.call(obj, property)) { + extractedProps[property] = obj[property]; + } + } + return extractedProps; + } else { + return {}; + } +} +__name(getOwnProperties, "getOwnProperties"); +function extractExceptionKeysForMessage(exception, maxLength = 40) { + const keys2 = Object.keys(convertToPlainObject(exception)); + keys2.sort(); + const firstKey = keys2[0]; + if (!firstKey) { + return "[object has no keys]"; + } + if (firstKey.length >= maxLength) { + return truncate(firstKey, maxLength); + } + for (let includedKeys = keys2.length; includedKeys > 0; includedKeys--) { + const serialized = keys2.slice(0, includedKeys).join(", "); + if (serialized.length > maxLength) { + continue; + } + if (includedKeys === keys2.length) { + return serialized; + } + return truncate(serialized, maxLength); + } + return ""; +} +__name(extractExceptionKeysForMessage, "extractExceptionKeysForMessage"); +function dropUndefinedKeys(inputValue) { + const memoizationMap = /* @__PURE__ */ new Map(); + return _dropUndefinedKeys(inputValue, memoizationMap); +} +__name(dropUndefinedKeys, "dropUndefinedKeys"); +function _dropUndefinedKeys(inputValue, memoizationMap) { + if (isPojo(inputValue)) { + const memoVal = memoizationMap.get(inputValue); + if (memoVal !== void 0) { + return memoVal; + } + const returnValue = {}; + memoizationMap.set(inputValue, returnValue); + for (const key of Object.getOwnPropertyNames(inputValue)) { + if (typeof inputValue[key] !== "undefined") { + returnValue[key] = _dropUndefinedKeys(inputValue[key], memoizationMap); + } + } + return returnValue; + } + if (Array.isArray(inputValue)) { + const memoVal = memoizationMap.get(inputValue); + if (memoVal !== void 0) { + return memoVal; + } + const returnValue = []; + memoizationMap.set(inputValue, returnValue); + inputValue.forEach((item3) => { + returnValue.push(_dropUndefinedKeys(item3, memoizationMap)); + }); + return returnValue; + } + return inputValue; +} +__name(_dropUndefinedKeys, "_dropUndefinedKeys"); +function isPojo(input) { + if (!isPlainObject$5(input)) { + return false; + } + try { + const name2 = Object.getPrototypeOf(input).constructor.name; + return !name2 || name2 === "Object"; + } catch (e2) { + return true; + } +} +__name(isPojo, "isPojo"); +function objectify(wat) { + let objectified; + switch (true) { + case wat == void 0: + objectified = new String(wat); + break; + case (typeof wat === "symbol" || typeof wat === "bigint"): + objectified = Object(wat); + break; + case isPrimitive(wat): + objectified = new wat.constructor(wat); + break; + default: + objectified = wat; + break; + } + return objectified; +} +__name(objectify, "objectify"); +const ONE_SECOND_IN_MS = 1e3; +function dateTimestampInSeconds() { + return Date.now() / ONE_SECOND_IN_MS; +} +__name(dateTimestampInSeconds, "dateTimestampInSeconds"); +function createUnixTimestampInSecondsFunc() { + const { performance: performance2 } = GLOBAL_OBJ; + if (!performance2 || !performance2.now) { + return dateTimestampInSeconds; + } + const approxStartingTimeOrigin = Date.now() - performance2.now(); + const timeOrigin = performance2.timeOrigin == void 0 ? approxStartingTimeOrigin : performance2.timeOrigin; + return () => { + return (timeOrigin + performance2.now()) / ONE_SECOND_IN_MS; + }; +} +__name(createUnixTimestampInSecondsFunc, "createUnixTimestampInSecondsFunc"); +const timestampInSeconds = createUnixTimestampInSecondsFunc(); +let _browserPerformanceTimeOriginMode; +const browserPerformanceTimeOrigin = (() => { + const { performance: performance2 } = GLOBAL_OBJ; + if (!performance2 || !performance2.now) { + _browserPerformanceTimeOriginMode = "none"; + return void 0; + } + const threshold = 3600 * 1e3; + const performanceNow = performance2.now(); + const dateNow = Date.now(); + const timeOriginDelta = performance2.timeOrigin ? Math.abs(performance2.timeOrigin + performanceNow - dateNow) : threshold; + const timeOriginIsReliable = timeOriginDelta < threshold; + const navigationStart = performance2.timing && performance2.timing.navigationStart; + const hasNavigationStart = typeof navigationStart === "number"; + const navigationStartDelta = hasNavigationStart ? Math.abs(navigationStart + performanceNow - dateNow) : threshold; + const navigationStartIsReliable = navigationStartDelta < threshold; + if (timeOriginIsReliable || navigationStartIsReliable) { + if (timeOriginDelta <= navigationStartDelta) { + _browserPerformanceTimeOriginMode = "timeOrigin"; + return performance2.timeOrigin; + } else { + _browserPerformanceTimeOriginMode = "navigationStart"; + return navigationStart; + } + } + _browserPerformanceTimeOriginMode = "dateNow"; + return dateNow; +})(); +function uuid4() { + const gbl = GLOBAL_OBJ; + const crypto = gbl.crypto || gbl.msCrypto; + let getRandomByte = /* @__PURE__ */ __name(() => Math.random() * 16, "getRandomByte"); + try { + if (crypto && crypto.randomUUID) { + return crypto.randomUUID().replace(/-/g, ""); + } + if (crypto && crypto.getRandomValues) { + getRandomByte = /* @__PURE__ */ __name(() => { + const typedArray = new Uint8Array(1); + crypto.getRandomValues(typedArray); + return typedArray[0]; + }, "getRandomByte"); + } + } catch (_2) { + } + return ("10000000100040008000" + 1e11).replace( + /[018]/g, + (c2) => ( + // eslint-disable-next-line no-bitwise + (c2 ^ (getRandomByte() & 15) >> c2 / 4).toString(16) + ) + ); +} +__name(uuid4, "uuid4"); +function getFirstException(event) { + return event.exception && event.exception.values ? event.exception.values[0] : void 0; +} +__name(getFirstException, "getFirstException"); +function getEventDescription(event) { + const { message: message3, event_id: eventId } = event; + if (message3) { + return message3; + } + const firstException = getFirstException(event); + if (firstException) { + if (firstException.type && firstException.value) { + return `${firstException.type}: ${firstException.value}`; + } + return firstException.type || firstException.value || eventId || ""; + } + return eventId || ""; +} +__name(getEventDescription, "getEventDescription"); +function addExceptionTypeValue(event, value4, type) { + const exception = event.exception = event.exception || {}; + const values = exception.values = exception.values || []; + const firstException = values[0] = values[0] || {}; + if (!firstException.value) { + firstException.value = value4 || ""; + } + if (!firstException.type) { + firstException.type = type || "Error"; + } +} +__name(addExceptionTypeValue, "addExceptionTypeValue"); +function addExceptionMechanism(event, newMechanism) { + const firstException = getFirstException(event); + if (!firstException) { + return; + } + const defaultMechanism = { type: "generic", handled: true }; + const currentMechanism = firstException.mechanism; + firstException.mechanism = { ...defaultMechanism, ...currentMechanism, ...newMechanism }; + if (newMechanism && "data" in newMechanism) { + const mergedData = { ...currentMechanism && currentMechanism.data, ...newMechanism.data }; + firstException.mechanism.data = mergedData; + } +} +__name(addExceptionMechanism, "addExceptionMechanism"); +const SEMVER_REGEXP = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; +function _parseInt(input) { + return parseInt(input || "", 10); +} +__name(_parseInt, "_parseInt"); +function parseSemver(input) { + const match2 = input.match(SEMVER_REGEXP) || []; + const major = _parseInt(match2[1]); + const minor = _parseInt(match2[2]); + const patch2 = _parseInt(match2[3]); + return { + buildmetadata: match2[5], + major: isNaN(major) ? void 0 : major, + minor: isNaN(minor) ? void 0 : minor, + patch: isNaN(patch2) ? void 0 : patch2, + prerelease: match2[4] + }; +} +__name(parseSemver, "parseSemver"); +function addContextToFrame(lines, frame, linesOfContext = 5) { + if (frame.lineno === void 0) { + return; + } + const maxLines = lines.length; + const sourceLine = Math.max(Math.min(maxLines - 1, frame.lineno - 1), 0); + frame.pre_context = lines.slice(Math.max(0, sourceLine - linesOfContext), sourceLine).map((line) => snipLine(line, 0)); + const lineIndex = Math.min(maxLines - 1, sourceLine); + frame.context_line = snipLine(lines[lineIndex], frame.colno || 0); + frame.post_context = lines.slice(Math.min(sourceLine + 1, maxLines), sourceLine + 1 + linesOfContext).map((line) => snipLine(line, 0)); +} +__name(addContextToFrame, "addContextToFrame"); +function checkOrSetAlreadyCaught(exception) { + if (isAlreadyCaptured(exception)) { + return true; + } + try { + addNonEnumerableProperty(exception, "__sentry_captured__", true); + } catch (err) { + } + return false; +} +__name(checkOrSetAlreadyCaught, "checkOrSetAlreadyCaught"); +function isAlreadyCaptured(exception) { + try { + return exception.__sentry_captured__; + } catch (e2) { + } +} +__name(isAlreadyCaptured, "isAlreadyCaptured"); +function arrayify(maybeArray) { + return Array.isArray(maybeArray) ? maybeArray : [maybeArray]; +} +__name(arrayify, "arrayify"); +var States; +(function(States2) { + const PENDING = 0; + States2[States2["PENDING"] = PENDING] = "PENDING"; + const RESOLVED = 1; + States2[States2["RESOLVED"] = RESOLVED] = "RESOLVED"; + const REJECTED = 2; + States2[States2["REJECTED"] = REJECTED] = "REJECTED"; +})(States || (States = {})); +function resolvedSyncPromise(value4) { + return new SyncPromise((resolve2) => { + resolve2(value4); + }); +} +__name(resolvedSyncPromise, "resolvedSyncPromise"); +function rejectedSyncPromise(reason) { + return new SyncPromise((_2, reject3) => { + reject3(reason); + }); +} +__name(rejectedSyncPromise, "rejectedSyncPromise"); +class SyncPromise { + static { + __name(this, "SyncPromise"); + } + constructor(executor) { + SyncPromise.prototype.__init.call(this); + SyncPromise.prototype.__init2.call(this); + SyncPromise.prototype.__init3.call(this); + SyncPromise.prototype.__init4.call(this); + this._state = States.PENDING; + this._handlers = []; + try { + executor(this._resolve, this._reject); + } catch (e2) { + this._reject(e2); + } + } + /** JSDoc */ + then(onfulfilled, onrejected) { + return new SyncPromise((resolve2, reject3) => { + this._handlers.push([ + false, + (result) => { + if (!onfulfilled) { + resolve2(result); + } else { + try { + resolve2(onfulfilled(result)); + } catch (e2) { + reject3(e2); + } + } + }, + (reason) => { + if (!onrejected) { + reject3(reason); + } else { + try { + resolve2(onrejected(reason)); + } catch (e2) { + reject3(e2); + } + } + } + ]); + this._executeHandlers(); + }); + } + /** JSDoc */ + catch(onrejected) { + return this.then((val) => val, onrejected); + } + /** JSDoc */ + finally(onfinally) { + return new SyncPromise((resolve2, reject3) => { + let val; + let isRejected; + return this.then( + (value4) => { + isRejected = false; + val = value4; + if (onfinally) { + onfinally(); + } + }, + (reason) => { + isRejected = true; + val = reason; + if (onfinally) { + onfinally(); + } + } + ).then(() => { + if (isRejected) { + reject3(val); + return; + } + resolve2(val); + }); + }); + } + /** JSDoc */ + __init() { + this._resolve = (value4) => { + this._setResult(States.RESOLVED, value4); + }; + } + /** JSDoc */ + __init2() { + this._reject = (reason) => { + this._setResult(States.REJECTED, reason); + }; + } + /** JSDoc */ + __init3() { + this._setResult = (state, value4) => { + if (this._state !== States.PENDING) { + return; + } + if (isThenable$1(value4)) { + void value4.then(this._resolve, this._reject); + return; + } + this._state = state; + this._value = value4; + this._executeHandlers(); + }; + } + /** JSDoc */ + __init4() { + this._executeHandlers = () => { + if (this._state === States.PENDING) { + return; + } + const cachedHandlers = this._handlers.slice(); + this._handlers = []; + cachedHandlers.forEach((handler6) => { + if (handler6[0]) { + return; + } + if (this._state === States.RESOLVED) { + handler6[1](this._value); + } + if (this._state === States.REJECTED) { + handler6[2](this._value); + } + handler6[0] = true; + }); + }; + } +} +function makeSession$1(context) { + const startingTime = timestampInSeconds(); + const session = { + sid: uuid4(), + init: true, + timestamp: startingTime, + started: startingTime, + duration: 0, + status: "ok", + errors: 0, + ignoreDuration: false, + toJSON: /* @__PURE__ */ __name(() => sessionToJSON(session), "toJSON") + }; + if (context) { + updateSession(session, context); + } + return session; +} +__name(makeSession$1, "makeSession$1"); +function updateSession(session, context = {}) { + if (context.user) { + if (!session.ipAddress && context.user.ip_address) { + session.ipAddress = context.user.ip_address; + } + if (!session.did && !context.did) { + session.did = context.user.id || context.user.email || context.user.username; + } + } + session.timestamp = context.timestamp || timestampInSeconds(); + if (context.abnormal_mechanism) { + session.abnormal_mechanism = context.abnormal_mechanism; + } + if (context.ignoreDuration) { + session.ignoreDuration = context.ignoreDuration; + } + if (context.sid) { + session.sid = context.sid.length === 32 ? context.sid : uuid4(); + } + if (context.init !== void 0) { + session.init = context.init; + } + if (!session.did && context.did) { + session.did = `${context.did}`; + } + if (typeof context.started === "number") { + session.started = context.started; + } + if (session.ignoreDuration) { + session.duration = void 0; + } else if (typeof context.duration === "number") { + session.duration = context.duration; + } else { + const duration = session.timestamp - session.started; + session.duration = duration >= 0 ? duration : 0; + } + if (context.release) { + session.release = context.release; + } + if (context.environment) { + session.environment = context.environment; + } + if (!session.ipAddress && context.ipAddress) { + session.ipAddress = context.ipAddress; + } + if (!session.userAgent && context.userAgent) { + session.userAgent = context.userAgent; + } + if (typeof context.errors === "number") { + session.errors = context.errors; + } + if (context.status) { + session.status = context.status; + } +} +__name(updateSession, "updateSession"); +function closeSession(session, status) { + let context = {}; + if (status) { + context = { status }; + } else if (session.status === "ok") { + context = { status: "exited" }; + } + updateSession(session, context); +} +__name(closeSession, "closeSession"); +function sessionToJSON(session) { + return dropUndefinedKeys({ + sid: `${session.sid}`, + init: session.init, + // Make sure that sec is converted to ms for date constructor + started: new Date(session.started * 1e3).toISOString(), + timestamp: new Date(session.timestamp * 1e3).toISOString(), + status: session.status, + errors: session.errors, + did: typeof session.did === "number" || typeof session.did === "string" ? `${session.did}` : void 0, + duration: session.duration, + abnormal_mechanism: session.abnormal_mechanism, + attrs: { + release: session.release, + environment: session.environment, + ip_address: session.ipAddress, + user_agent: session.userAgent + } + }); +} +__name(sessionToJSON, "sessionToJSON"); +function generatePropagationContext() { + return { + traceId: generateTraceId(), + spanId: generateSpanId() + }; +} +__name(generatePropagationContext, "generatePropagationContext"); +function generateTraceId() { + return uuid4(); +} +__name(generateTraceId, "generateTraceId"); +function generateSpanId() { + return uuid4().substring(16); +} +__name(generateSpanId, "generateSpanId"); +function merge$1(initialObj, mergeObj, levels = 2) { + if (!mergeObj || typeof mergeObj !== "object" || levels <= 0) { + return mergeObj; + } + if (initialObj && mergeObj && Object.keys(mergeObj).length === 0) { + return initialObj; + } + const output = { ...initialObj }; + for (const key in mergeObj) { + if (Object.prototype.hasOwnProperty.call(mergeObj, key)) { + output[key] = merge$1(output[key], mergeObj[key], levels - 1); + } + } + return output; +} +__name(merge$1, "merge$1"); +const SCOPE_SPAN_FIELD = "_sentrySpan"; +function _setSpanForScope(scope, span) { + if (span) { + addNonEnumerableProperty(scope, SCOPE_SPAN_FIELD, span); + } else { + delete scope[SCOPE_SPAN_FIELD]; + } +} +__name(_setSpanForScope, "_setSpanForScope"); +function _getSpanForScope(scope) { + return scope[SCOPE_SPAN_FIELD]; +} +__name(_getSpanForScope, "_getSpanForScope"); +const DEFAULT_MAX_BREADCRUMBS = 100; +class ScopeClass { + static { + __name(this, "ScopeClass"); + } + /** Flag if notifying is happening. */ + /** Callback for client to receive scope changes. */ + /** Callback list that will be called during event processing. */ + /** Array of breadcrumbs. */ + /** User */ + /** Tags */ + /** Extra */ + /** Contexts */ + /** Attachments */ + /** Propagation Context for distributed tracing */ + /** + * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get + * sent to Sentry + */ + /** Fingerprint */ + /** Severity */ + /** + * Transaction Name + * + * IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects. + * It's purpose is to assign a transaction to the scope that's added to non-transaction events. + */ + /** Session */ + /** Request Mode Session Status */ + // eslint-disable-next-line deprecation/deprecation + /** The client on this scope */ + /** Contains the last event id of a captured event. */ + // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method. + constructor() { + this._notifyingListeners = false; + this._scopeListeners = []; + this._eventProcessors = []; + this._breadcrumbs = []; + this._attachments = []; + this._user = {}; + this._tags = {}; + this._extra = {}; + this._contexts = {}; + this._sdkProcessingMetadata = {}; + this._propagationContext = { + traceId: generateTraceId(), + spanId: generateSpanId() + }; + } + /** + * @inheritDoc + */ + clone() { + const newScope = new ScopeClass(); + newScope._breadcrumbs = [...this._breadcrumbs]; + newScope._tags = { ...this._tags }; + newScope._extra = { ...this._extra }; + newScope._contexts = { ...this._contexts }; + if (this._contexts.flags) { + newScope._contexts.flags = { + values: [...this._contexts.flags.values] + }; + } + newScope._user = this._user; + newScope._level = this._level; + newScope._session = this._session; + newScope._transactionName = this._transactionName; + newScope._fingerprint = this._fingerprint; + newScope._eventProcessors = [...this._eventProcessors]; + newScope._requestSession = this._requestSession; + newScope._attachments = [...this._attachments]; + newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata }; + newScope._propagationContext = { ...this._propagationContext }; + newScope._client = this._client; + newScope._lastEventId = this._lastEventId; + _setSpanForScope(newScope, _getSpanForScope(this)); + return newScope; + } + /** + * @inheritDoc + */ + setClient(client) { + this._client = client; + } + /** + * @inheritDoc + */ + setLastEventId(lastEventId2) { + this._lastEventId = lastEventId2; + } + /** + * @inheritDoc + */ + getClient() { + return this._client; + } + /** + * @inheritDoc + */ + lastEventId() { + return this._lastEventId; + } + /** + * @inheritDoc + */ + addScopeListener(callback) { + this._scopeListeners.push(callback); + } + /** + * @inheritDoc + */ + addEventProcessor(callback) { + this._eventProcessors.push(callback); + return this; + } + /** + * @inheritDoc + */ + setUser(user) { + this._user = user || { + email: void 0, + id: void 0, + ip_address: void 0, + username: void 0 + }; + if (this._session) { + updateSession(this._session, { user }); + } + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + getUser() { + return this._user; + } + /** + * @inheritDoc + */ + // eslint-disable-next-line deprecation/deprecation + getRequestSession() { + return this._requestSession; + } + /** + * @inheritDoc + */ + // eslint-disable-next-line deprecation/deprecation + setRequestSession(requestSession) { + this._requestSession = requestSession; + return this; + } + /** + * @inheritDoc + */ + setTags(tags) { + this._tags = { + ...this._tags, + ...tags + }; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setTag(key, value4) { + this._tags = { ...this._tags, [key]: value4 }; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setExtras(extras) { + this._extra = { + ...this._extra, + ...extras + }; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setExtra(key, extra) { + this._extra = { ...this._extra, [key]: extra }; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setFingerprint(fingerprint) { + this._fingerprint = fingerprint; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setLevel(level) { + this._level = level; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setTransactionName(name2) { + this._transactionName = name2; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setContext(key, context) { + if (context === null) { + delete this._contexts[key]; + } else { + this._contexts[key] = context; + } + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + setSession(session) { + if (!session) { + delete this._session; + } else { + this._session = session; + } + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + getSession() { + return this._session; + } + /** + * @inheritDoc + */ + update(captureContext) { + if (!captureContext) { + return this; + } + const scopeToMerge = typeof captureContext === "function" ? captureContext(this) : captureContext; + const [scopeInstance, requestSession] = scopeToMerge instanceof Scope ? ( + // eslint-disable-next-line deprecation/deprecation + [scopeToMerge.getScopeData(), scopeToMerge.getRequestSession()] + ) : isPlainObject$5(scopeToMerge) ? [captureContext, captureContext.requestSession] : []; + const { tags, extra, user, contexts, level, fingerprint = [], propagationContext } = scopeInstance || {}; + this._tags = { ...this._tags, ...tags }; + this._extra = { ...this._extra, ...extra }; + this._contexts = { ...this._contexts, ...contexts }; + if (user && Object.keys(user).length) { + this._user = user; + } + if (level) { + this._level = level; + } + if (fingerprint.length) { + this._fingerprint = fingerprint; + } + if (propagationContext) { + this._propagationContext = propagationContext; + } + if (requestSession) { + this._requestSession = requestSession; + } + return this; + } + /** + * @inheritDoc + */ + clear() { + this._breadcrumbs = []; + this._tags = {}; + this._extra = {}; + this._user = {}; + this._contexts = {}; + this._level = void 0; + this._transactionName = void 0; + this._fingerprint = void 0; + this._requestSession = void 0; + this._session = void 0; + _setSpanForScope(this, void 0); + this._attachments = []; + this.setPropagationContext({ traceId: generateTraceId() }); + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + addBreadcrumb(breadcrumb, maxBreadcrumbs) { + const maxCrumbs = typeof maxBreadcrumbs === "number" ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS; + if (maxCrumbs <= 0) { + return this; + } + const mergedBreadcrumb = { + timestamp: dateTimestampInSeconds(), + ...breadcrumb + }; + const breadcrumbs = this._breadcrumbs; + breadcrumbs.push(mergedBreadcrumb); + this._breadcrumbs = breadcrumbs.length > maxCrumbs ? breadcrumbs.slice(-maxCrumbs) : breadcrumbs; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + getLastBreadcrumb() { + return this._breadcrumbs[this._breadcrumbs.length - 1]; + } + /** + * @inheritDoc + */ + clearBreadcrumbs() { + this._breadcrumbs = []; + this._notifyScopeListeners(); + return this; + } + /** + * @inheritDoc + */ + addAttachment(attachment) { + this._attachments.push(attachment); + return this; + } + /** + * @inheritDoc + */ + clearAttachments() { + this._attachments = []; + return this; + } + /** @inheritDoc */ + getScopeData() { + return { + breadcrumbs: this._breadcrumbs, + attachments: this._attachments, + contexts: this._contexts, + tags: this._tags, + extra: this._extra, + user: this._user, + level: this._level, + fingerprint: this._fingerprint || [], + eventProcessors: this._eventProcessors, + propagationContext: this._propagationContext, + sdkProcessingMetadata: this._sdkProcessingMetadata, + transactionName: this._transactionName, + span: _getSpanForScope(this) + }; + } + /** + * @inheritDoc + */ + setSDKProcessingMetadata(newData) { + this._sdkProcessingMetadata = merge$1(this._sdkProcessingMetadata, newData, 2); + return this; + } + /** + * @inheritDoc + */ + setPropagationContext(context) { + this._propagationContext = { + // eslint-disable-next-line deprecation/deprecation + spanId: generateSpanId(), + ...context + }; + return this; + } + /** + * @inheritDoc + */ + getPropagationContext() { + return this._propagationContext; + } + /** + * @inheritDoc + */ + captureException(exception, hint) { + const eventId = hint && hint.event_id ? hint.event_id : uuid4(); + if (!this._client) { + logger$2.warn("No client configured on scope - will not capture exception!"); + return eventId; + } + const syntheticException = new Error("Sentry syntheticException"); + this._client.captureException( + exception, + { + originalException: exception, + syntheticException, + ...hint, + event_id: eventId + }, + this + ); + return eventId; + } + /** + * @inheritDoc + */ + captureMessage(message3, level, hint) { + const eventId = hint && hint.event_id ? hint.event_id : uuid4(); + if (!this._client) { + logger$2.warn("No client configured on scope - will not capture message!"); + return eventId; + } + const syntheticException = new Error(message3); + this._client.captureMessage( + message3, + level, + { + originalException: message3, + syntheticException, + ...hint, + event_id: eventId + }, + this + ); + return eventId; + } + /** + * @inheritDoc + */ + captureEvent(event, hint) { + const eventId = hint && hint.event_id ? hint.event_id : uuid4(); + if (!this._client) { + logger$2.warn("No client configured on scope - will not capture event!"); + return eventId; + } + this._client.captureEvent(event, { ...hint, event_id: eventId }, this); + return eventId; + } + /** + * This will be called on every set call. + */ + _notifyScopeListeners() { + if (!this._notifyingListeners) { + this._notifyingListeners = true; + this._scopeListeners.forEach((callback) => { + callback(this); + }); + this._notifyingListeners = false; + } + } +} +const Scope = ScopeClass; +function getDefaultCurrentScope() { + return getGlobalSingleton("defaultCurrentScope", () => new Scope()); +} +__name(getDefaultCurrentScope, "getDefaultCurrentScope"); +function getDefaultIsolationScope() { + return getGlobalSingleton("defaultIsolationScope", () => new Scope()); +} +__name(getDefaultIsolationScope, "getDefaultIsolationScope"); +class AsyncContextStack { + static { + __name(this, "AsyncContextStack"); + } + constructor(scope, isolationScope) { + let assignedScope; + if (!scope) { + assignedScope = new Scope(); + } else { + assignedScope = scope; + } + let assignedIsolationScope; + if (!isolationScope) { + assignedIsolationScope = new Scope(); + } else { + assignedIsolationScope = isolationScope; + } + this._stack = [{ scope: assignedScope }]; + this._isolationScope = assignedIsolationScope; + } + /** + * Fork a scope for the stack. + */ + withScope(callback) { + const scope = this._pushScope(); + let maybePromiseResult; + try { + maybePromiseResult = callback(scope); + } catch (e2) { + this._popScope(); + throw e2; + } + if (isThenable$1(maybePromiseResult)) { + return maybePromiseResult.then( + (res) => { + this._popScope(); + return res; + }, + (e2) => { + this._popScope(); + throw e2; + } + ); + } + this._popScope(); + return maybePromiseResult; + } + /** + * Get the client of the stack. + */ + getClient() { + return this.getStackTop().client; + } + /** + * Returns the scope of the top stack. + */ + getScope() { + return this.getStackTop().scope; + } + /** + * Get the isolation scope for the stack. + */ + getIsolationScope() { + return this._isolationScope; + } + /** + * Returns the topmost scope layer in the order domain > local > process. + */ + getStackTop() { + return this._stack[this._stack.length - 1]; + } + /** + * Push a scope to the stack. + */ + _pushScope() { + const scope = this.getScope().clone(); + this._stack.push({ + client: this.getClient(), + scope + }); + return scope; + } + /** + * Pop a scope from the stack. + */ + _popScope() { + if (this._stack.length <= 1) return false; + return !!this._stack.pop(); + } +} +function getAsyncContextStack() { + const registry = getMainCarrier(); + const sentry = getSentryCarrier(registry); + return sentry.stack = sentry.stack || new AsyncContextStack(getDefaultCurrentScope(), getDefaultIsolationScope()); +} +__name(getAsyncContextStack, "getAsyncContextStack"); +function withScope$1(callback) { + return getAsyncContextStack().withScope(callback); +} +__name(withScope$1, "withScope$1"); +function withSetScope(scope, callback) { + const stack2 = getAsyncContextStack(); + return stack2.withScope(() => { + stack2.getStackTop().scope = scope; + return callback(scope); + }); +} +__name(withSetScope, "withSetScope"); +function withIsolationScope$1(callback) { + return getAsyncContextStack().withScope(() => { + return callback(getAsyncContextStack().getIsolationScope()); + }); +} +__name(withIsolationScope$1, "withIsolationScope$1"); +function getStackAsyncContextStrategy() { + return { + withIsolationScope: withIsolationScope$1, + withScope: withScope$1, + withSetScope, + withSetIsolationScope: /* @__PURE__ */ __name((_isolationScope, callback) => { + return withIsolationScope$1(callback); + }, "withSetIsolationScope"), + getCurrentScope: /* @__PURE__ */ __name(() => getAsyncContextStack().getScope(), "getCurrentScope"), + getIsolationScope: /* @__PURE__ */ __name(() => getAsyncContextStack().getIsolationScope(), "getIsolationScope") + }; +} +__name(getStackAsyncContextStrategy, "getStackAsyncContextStrategy"); +function setAsyncContextStrategy(strategy) { + const registry = getMainCarrier(); + const sentry = getSentryCarrier(registry); + sentry.acs = strategy; +} +__name(setAsyncContextStrategy, "setAsyncContextStrategy"); +function getAsyncContextStrategy(carrier) { + const sentry = getSentryCarrier(carrier); + if (sentry.acs) { + return sentry.acs; + } + return getStackAsyncContextStrategy(); +} +__name(getAsyncContextStrategy, "getAsyncContextStrategy"); +function getCurrentScope$1() { + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + return acs.getCurrentScope(); +} +__name(getCurrentScope$1, "getCurrentScope$1"); +function getIsolationScope() { + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + return acs.getIsolationScope(); +} +__name(getIsolationScope, "getIsolationScope"); +function getGlobalScope() { + return getGlobalSingleton("globalScope", () => new Scope()); +} +__name(getGlobalScope, "getGlobalScope"); +function withScope(...rest) { + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + if (rest.length === 2) { + const [scope, callback] = rest; + if (!scope) { + return acs.withScope(callback); + } + return acs.withSetScope(scope, callback); + } + return acs.withScope(rest[0]); +} +__name(withScope, "withScope"); +function withIsolationScope(...rest) { + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + if (rest.length === 2) { + const [isolationScope, callback] = rest; + if (!isolationScope) { + return acs.withIsolationScope(callback); + } + return acs.withSetIsolationScope(isolationScope, callback); + } + return acs.withIsolationScope(rest[0]); +} +__name(withIsolationScope, "withIsolationScope"); +function getClient() { + return getCurrentScope$1().getClient(); +} +__name(getClient, "getClient"); +function getTraceContextFromScope(scope) { + const propagationContext = scope.getPropagationContext(); + const { traceId, spanId, parentSpanId } = propagationContext; + const traceContext = dropUndefinedKeys({ + trace_id: traceId, + span_id: spanId, + parent_span_id: parentSpanId + }); + return traceContext; +} +__name(getTraceContextFromScope, "getTraceContextFromScope"); +const METRICS_SPAN_FIELD = "_sentryMetrics"; +function getMetricSummaryJsonForSpan(span) { + const storage = span[METRICS_SPAN_FIELD]; + if (!storage) { + return void 0; + } + const output = {}; + for (const [, [exportKey, summary]] of storage) { + const arr = output[exportKey] || (output[exportKey] = []); + arr.push(dropUndefinedKeys(summary)); + } + return output; +} +__name(getMetricSummaryJsonForSpan, "getMetricSummaryJsonForSpan"); +function updateMetricSummaryOnSpan(span, metricType, sanitizedName, value4, unit, tags, bucketKey) { + const existingStorage = span[METRICS_SPAN_FIELD]; + const storage = existingStorage || (span[METRICS_SPAN_FIELD] = /* @__PURE__ */ new Map()); + const exportKey = `${metricType}:${sanitizedName}@${unit}`; + const bucketItem = storage.get(bucketKey); + if (bucketItem) { + const [, summary] = bucketItem; + storage.set(bucketKey, [ + exportKey, + { + min: Math.min(summary.min, value4), + max: Math.max(summary.max, value4), + count: summary.count += 1, + sum: summary.sum += value4, + tags: summary.tags + } + ]); + } else { + storage.set(bucketKey, [ + exportKey, + { + min: value4, + max: value4, + count: 1, + sum: value4, + tags + } + ]); + } +} +__name(updateMetricSummaryOnSpan, "updateMetricSummaryOnSpan"); +const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = "sentry.source"; +const SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE = "sentry.sample_rate"; +const SEMANTIC_ATTRIBUTE_SENTRY_OP = "sentry.op"; +const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = "sentry.origin"; +const SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON = "sentry.idle_span_finish_reason"; +const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT = "sentry.measurement_unit"; +const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE = "sentry.measurement_value"; +const SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME = "sentry.custom_span_name"; +const SEMANTIC_ATTRIBUTE_PROFILE_ID = "sentry.profile_id"; +const SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME = "sentry.exclusive_time"; +const SEMANTIC_ATTRIBUTE_CACHE_HIT = "cache.hit"; +const SEMANTIC_ATTRIBUTE_CACHE_KEY = "cache.key"; +const SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE = "cache.item_size"; +const SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD = "http.request.method"; +const SEMANTIC_ATTRIBUTE_URL_FULL = "url.full"; +const SPAN_STATUS_UNSET = 0; +const SPAN_STATUS_OK = 1; +const SPAN_STATUS_ERROR = 2; +function getSpanStatusFromHttpCode(httpStatus) { + if (httpStatus < 400 && httpStatus >= 100) { + return { code: SPAN_STATUS_OK }; + } + if (httpStatus >= 400 && httpStatus < 500) { + switch (httpStatus) { + case 401: + return { code: SPAN_STATUS_ERROR, message: "unauthenticated" }; + case 403: + return { code: SPAN_STATUS_ERROR, message: "permission_denied" }; + case 404: + return { code: SPAN_STATUS_ERROR, message: "not_found" }; + case 409: + return { code: SPAN_STATUS_ERROR, message: "already_exists" }; + case 413: + return { code: SPAN_STATUS_ERROR, message: "failed_precondition" }; + case 429: + return { code: SPAN_STATUS_ERROR, message: "resource_exhausted" }; + case 499: + return { code: SPAN_STATUS_ERROR, message: "cancelled" }; + default: + return { code: SPAN_STATUS_ERROR, message: "invalid_argument" }; + } + } + if (httpStatus >= 500 && httpStatus < 600) { + switch (httpStatus) { + case 501: + return { code: SPAN_STATUS_ERROR, message: "unimplemented" }; + case 503: + return { code: SPAN_STATUS_ERROR, message: "unavailable" }; + case 504: + return { code: SPAN_STATUS_ERROR, message: "deadline_exceeded" }; + default: + return { code: SPAN_STATUS_ERROR, message: "internal_error" }; + } + } + return { code: SPAN_STATUS_ERROR, message: "unknown_error" }; +} +__name(getSpanStatusFromHttpCode, "getSpanStatusFromHttpCode"); +function setHttpStatus(span, httpStatus) { + span.setAttribute("http.response.status_code", httpStatus); + const spanStatus = getSpanStatusFromHttpCode(httpStatus); + if (spanStatus.message !== "unknown_error") { + span.setStatus(spanStatus); + } +} +__name(setHttpStatus, "setHttpStatus"); +const BAGGAGE_HEADER_NAME = "baggage"; +const SENTRY_BAGGAGE_KEY_PREFIX = "sentry-"; +const SENTRY_BAGGAGE_KEY_PREFIX_REGEX = /^sentry-/; +const MAX_BAGGAGE_STRING_LENGTH = 8192; +function baggageHeaderToDynamicSamplingContext(baggageHeader) { + const baggageObject = parseBaggageHeader(baggageHeader); + if (!baggageObject) { + return void 0; + } + const dynamicSamplingContext = Object.entries(baggageObject).reduce((acc, [key, value4]) => { + if (key.match(SENTRY_BAGGAGE_KEY_PREFIX_REGEX)) { + const nonPrefixedKey = key.slice(SENTRY_BAGGAGE_KEY_PREFIX.length); + acc[nonPrefixedKey] = value4; + } + return acc; + }, {}); + if (Object.keys(dynamicSamplingContext).length > 0) { + return dynamicSamplingContext; + } else { + return void 0; + } +} +__name(baggageHeaderToDynamicSamplingContext, "baggageHeaderToDynamicSamplingContext"); +function dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext) { + if (!dynamicSamplingContext) { + return void 0; + } + const sentryPrefixedDSC = Object.entries(dynamicSamplingContext).reduce( + (acc, [dscKey, dscValue]) => { + if (dscValue) { + acc[`${SENTRY_BAGGAGE_KEY_PREFIX}${dscKey}`] = dscValue; + } + return acc; + }, + {} + ); + return objectToBaggageHeader(sentryPrefixedDSC); +} +__name(dynamicSamplingContextToSentryBaggageHeader, "dynamicSamplingContextToSentryBaggageHeader"); +function parseBaggageHeader(baggageHeader) { + if (!baggageHeader || !isString$8(baggageHeader) && !Array.isArray(baggageHeader)) { + return void 0; + } + if (Array.isArray(baggageHeader)) { + return baggageHeader.reduce((acc, curr) => { + const currBaggageObject = baggageHeaderToObject(curr); + Object.entries(currBaggageObject).forEach(([key, value4]) => { + acc[key] = value4; + }); + return acc; + }, {}); + } + return baggageHeaderToObject(baggageHeader); +} +__name(parseBaggageHeader, "parseBaggageHeader"); +function baggageHeaderToObject(baggageHeader) { + return baggageHeader.split(",").map((baggageEntry) => baggageEntry.split("=").map((keyOrValue) => decodeURIComponent(keyOrValue.trim()))).reduce((acc, [key, value4]) => { + if (key && value4) { + acc[key] = value4; + } + return acc; + }, {}); +} +__name(baggageHeaderToObject, "baggageHeaderToObject"); +function objectToBaggageHeader(object) { + if (Object.keys(object).length === 0) { + return void 0; + } + return Object.entries(object).reduce((baggageHeader, [objectKey, objectValue], currentIndex) => { + const baggageEntry = `${encodeURIComponent(objectKey)}=${encodeURIComponent(objectValue)}`; + const newBaggageHeader = currentIndex === 0 ? baggageEntry : `${baggageHeader},${baggageEntry}`; + if (newBaggageHeader.length > MAX_BAGGAGE_STRING_LENGTH) { + DEBUG_BUILD$5 && logger$2.warn( + `Not adding key: ${objectKey} with val: ${objectValue} to baggage header due to exceeding baggage size limits.` + ); + return baggageHeader; + } else { + return newBaggageHeader; + } + }, ""); +} +__name(objectToBaggageHeader, "objectToBaggageHeader"); +const TRACEPARENT_REGEXP = new RegExp( + "^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$" + // whitespace +); +function extractTraceparentData(traceparent) { + if (!traceparent) { + return void 0; + } + const matches2 = traceparent.match(TRACEPARENT_REGEXP); + if (!matches2) { + return void 0; + } + let parentSampled; + if (matches2[3] === "1") { + parentSampled = true; + } else if (matches2[3] === "0") { + parentSampled = false; + } + return { + traceId: matches2[1], + parentSampled, + parentSpanId: matches2[2] + }; +} +__name(extractTraceparentData, "extractTraceparentData"); +function propagationContextFromHeaders(sentryTrace, baggage) { + const traceparentData = extractTraceparentData(sentryTrace); + const dynamicSamplingContext = baggageHeaderToDynamicSamplingContext(baggage); + if (!traceparentData || !traceparentData.traceId) { + return { traceId: generateTraceId(), spanId: generateSpanId() }; + } + const { traceId, parentSpanId, parentSampled } = traceparentData; + const virtualSpanId = generateSpanId(); + return { + traceId, + parentSpanId, + spanId: virtualSpanId, + sampled: parentSampled, + dsc: dynamicSamplingContext || {} + // If we have traceparent data but no DSC it means we are not head of trace and we must freeze it + }; +} +__name(propagationContextFromHeaders, "propagationContextFromHeaders"); +function generateSentryTraceHeader(traceId = generateTraceId(), spanId = generateSpanId(), sampled) { + let sampledString = ""; + if (sampled !== void 0) { + sampledString = sampled ? "-1" : "-0"; + } + return `${traceId}-${spanId}${sampledString}`; +} +__name(generateSentryTraceHeader, "generateSentryTraceHeader"); +const TRACE_FLAG_NONE = 0; +const TRACE_FLAG_SAMPLED = 1; +let hasShownSpanDropWarning = false; +function spanToTransactionTraceContext(span) { + const { spanId: span_id, traceId: trace_id } = span.spanContext(); + const { data: data25, op, parent_span_id, status, origin: origin2 } = spanToJSON(span); + return dropUndefinedKeys({ + parent_span_id, + span_id, + trace_id, + data: data25, + op, + status, + origin: origin2 + }); +} +__name(spanToTransactionTraceContext, "spanToTransactionTraceContext"); +function spanToTraceContext(span) { + const { spanId, traceId: trace_id, isRemote } = span.spanContext(); + const parent_span_id = isRemote ? spanId : spanToJSON(span).parent_span_id; + const span_id = isRemote ? generateSpanId() : spanId; + return dropUndefinedKeys({ + parent_span_id, + span_id, + trace_id + }); +} +__name(spanToTraceContext, "spanToTraceContext"); +function spanToTraceHeader(span) { + const { traceId, spanId } = span.spanContext(); + const sampled = spanIsSampled(span); + return generateSentryTraceHeader(traceId, spanId, sampled); +} +__name(spanToTraceHeader, "spanToTraceHeader"); +function spanTimeInputToSeconds(input) { + if (typeof input === "number") { + return ensureTimestampInSeconds(input); + } + if (Array.isArray(input)) { + return input[0] + input[1] / 1e9; + } + if (input instanceof Date) { + return ensureTimestampInSeconds(input.getTime()); + } + return timestampInSeconds(); +} +__name(spanTimeInputToSeconds, "spanTimeInputToSeconds"); +function ensureTimestampInSeconds(timestamp2) { + const isMs = timestamp2 > 9999999999; + return isMs ? timestamp2 / 1e3 : timestamp2; +} +__name(ensureTimestampInSeconds, "ensureTimestampInSeconds"); +function spanToJSON(span) { + if (spanIsSentrySpan(span)) { + return span.getSpanJSON(); + } + try { + const { spanId: span_id, traceId: trace_id } = span.spanContext(); + if (spanIsOpenTelemetrySdkTraceBaseSpan(span)) { + const { attributes, startTime, name: name2, endTime, parentSpanId, status } = span; + return dropUndefinedKeys({ + span_id, + trace_id, + data: attributes, + description: name2, + parent_span_id: parentSpanId, + start_timestamp: spanTimeInputToSeconds(startTime), + // This is [0,0] by default in OTEL, in which case we want to interpret this as no end time + timestamp: spanTimeInputToSeconds(endTime) || void 0, + status: getStatusMessage(status), + op: attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP], + origin: attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN], + _metrics_summary: getMetricSummaryJsonForSpan(span) + }); + } + return { + span_id, + trace_id + }; + } catch (e2) { + return {}; + } +} +__name(spanToJSON, "spanToJSON"); +function spanIsOpenTelemetrySdkTraceBaseSpan(span) { + const castSpan = span; + return !!castSpan.attributes && !!castSpan.startTime && !!castSpan.name && !!castSpan.endTime && !!castSpan.status; +} +__name(spanIsOpenTelemetrySdkTraceBaseSpan, "spanIsOpenTelemetrySdkTraceBaseSpan"); +function spanIsSentrySpan(span) { + return typeof span.getSpanJSON === "function"; +} +__name(spanIsSentrySpan, "spanIsSentrySpan"); +function spanIsSampled(span) { + const { traceFlags } = span.spanContext(); + return traceFlags === TRACE_FLAG_SAMPLED; +} +__name(spanIsSampled, "spanIsSampled"); +function getStatusMessage(status) { + if (!status || status.code === SPAN_STATUS_UNSET) { + return void 0; + } + if (status.code === SPAN_STATUS_OK) { + return "ok"; + } + return status.message || "unknown_error"; +} +__name(getStatusMessage, "getStatusMessage"); +const CHILD_SPANS_FIELD = "_sentryChildSpans"; +const ROOT_SPAN_FIELD = "_sentryRootSpan"; +function addChildSpanToSpan(span, childSpan) { + const rootSpan = span[ROOT_SPAN_FIELD] || span; + addNonEnumerableProperty(childSpan, ROOT_SPAN_FIELD, rootSpan); + if (span[CHILD_SPANS_FIELD]) { + span[CHILD_SPANS_FIELD].add(childSpan); + } else { + addNonEnumerableProperty(span, CHILD_SPANS_FIELD, /* @__PURE__ */ new Set([childSpan])); + } +} +__name(addChildSpanToSpan, "addChildSpanToSpan"); +function removeChildSpanFromSpan(span, childSpan) { + if (span[CHILD_SPANS_FIELD]) { + span[CHILD_SPANS_FIELD].delete(childSpan); + } +} +__name(removeChildSpanFromSpan, "removeChildSpanFromSpan"); +function getSpanDescendants(span) { + const resultSet = /* @__PURE__ */ new Set(); + function addSpanChildren(span2) { + if (resultSet.has(span2)) { + return; + } else if (spanIsSampled(span2)) { + resultSet.add(span2); + const childSpans = span2[CHILD_SPANS_FIELD] ? Array.from(span2[CHILD_SPANS_FIELD]) : []; + for (const childSpan of childSpans) { + addSpanChildren(childSpan); + } + } + } + __name(addSpanChildren, "addSpanChildren"); + addSpanChildren(span); + return Array.from(resultSet); +} +__name(getSpanDescendants, "getSpanDescendants"); +function getRootSpan(span) { + return span[ROOT_SPAN_FIELD] || span; +} +__name(getRootSpan, "getRootSpan"); +function getActiveSpan() { + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + if (acs.getActiveSpan) { + return acs.getActiveSpan(); + } + return _getSpanForScope(getCurrentScope$1()); +} +__name(getActiveSpan, "getActiveSpan"); +function updateMetricSummaryOnActiveSpan(metricType, sanitizedName, value4, unit, tags, bucketKey) { + const span = getActiveSpan(); + if (span) { + updateMetricSummaryOnSpan(span, metricType, sanitizedName, value4, unit, tags, bucketKey); + } +} +__name(updateMetricSummaryOnActiveSpan, "updateMetricSummaryOnActiveSpan"); +function showSpanDropWarning() { + if (!hasShownSpanDropWarning) { + consoleSandbox(() => { + console.warn( + "[Sentry] Deprecation warning: Returning null from `beforeSendSpan` will be disallowed from SDK version 9.0.0 onwards. The callback will only support mutating spans. To drop certain spans, configure the respective integrations directly." + ); + }); + hasShownSpanDropWarning = true; + } +} +__name(showSpanDropWarning, "showSpanDropWarning"); +function updateSpanName(span, name2) { + span.updateName(name2); + span.setAttributes({ + [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "custom", + [SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]: name2 + }); +} +__name(updateSpanName, "updateSpanName"); +let errorsInstrumented = false; +function registerSpanErrorInstrumentation() { + if (errorsInstrumented) { + return; + } + errorsInstrumented = true; + addGlobalErrorInstrumentationHandler(errorCallback); + addGlobalUnhandledRejectionInstrumentationHandler(errorCallback); +} +__name(registerSpanErrorInstrumentation, "registerSpanErrorInstrumentation"); +function errorCallback() { + const activeSpan = getActiveSpan(); + const rootSpan = activeSpan && getRootSpan(activeSpan); + if (rootSpan) { + const message3 = "internal_error"; + DEBUG_BUILD$6 && logger$2.log(`[Tracing] Root span: ${message3} -> Global error occurred`); + rootSpan.setStatus({ code: SPAN_STATUS_ERROR, message: message3 }); + } +} +__name(errorCallback, "errorCallback"); +errorCallback.tag = "sentry_tracingErrorCallback"; +const SCOPE_ON_START_SPAN_FIELD = "_sentryScope"; +const ISOLATION_SCOPE_ON_START_SPAN_FIELD = "_sentryIsolationScope"; +function setCapturedScopesOnSpan(span, scope, isolationScope) { + if (span) { + addNonEnumerableProperty(span, ISOLATION_SCOPE_ON_START_SPAN_FIELD, isolationScope); + addNonEnumerableProperty(span, SCOPE_ON_START_SPAN_FIELD, scope); + } +} +__name(setCapturedScopesOnSpan, "setCapturedScopesOnSpan"); +function getCapturedScopesOnSpan(span) { + return { + scope: span[SCOPE_ON_START_SPAN_FIELD], + isolationScope: span[ISOLATION_SCOPE_ON_START_SPAN_FIELD] + }; +} +__name(getCapturedScopesOnSpan, "getCapturedScopesOnSpan"); +function addTracingExtensions() { + registerSpanErrorInstrumentation(); +} +__name(addTracingExtensions, "addTracingExtensions"); +function hasTracingEnabled(maybeOptions) { + if (typeof __SENTRY_TRACING__ === "boolean" && !__SENTRY_TRACING__) { + return false; + } + const client = getClient(); + const options4 = maybeOptions || client && client.getOptions(); + return !!options4 && (options4.enableTracing || "tracesSampleRate" in options4 || "tracesSampler" in options4); +} +__name(hasTracingEnabled, "hasTracingEnabled"); +class SentryNonRecordingSpan { + static { + __name(this, "SentryNonRecordingSpan"); + } + constructor(spanContext = {}) { + this._traceId = spanContext.traceId || generateTraceId(); + this._spanId = spanContext.spanId || generateSpanId(); + } + /** @inheritdoc */ + spanContext() { + return { + spanId: this._spanId, + traceId: this._traceId, + traceFlags: TRACE_FLAG_NONE + }; + } + /** @inheritdoc */ + // eslint-disable-next-line @typescript-eslint/no-empty-function + end(_timestamp) { + } + /** @inheritdoc */ + setAttribute(_key, _value) { + return this; + } + /** @inheritdoc */ + setAttributes(_values) { + return this; + } + /** @inheritdoc */ + setStatus(_status) { + return this; + } + /** @inheritdoc */ + updateName(_name) { + return this; + } + /** @inheritdoc */ + isRecording() { + return false; + } + /** @inheritdoc */ + addEvent(_name, _attributesOrStartTime, _startTime) { + return this; + } + /** + * This should generally not be used, + * but we need it for being compliant with the OTEL Span interface. + * + * @hidden + * @internal + */ + addLink(_link) { + return this; + } + /** + * This should generally not be used, + * but we need it for being compliant with the OTEL Span interface. + * + * @hidden + * @internal + */ + addLinks(_links) { + return this; + } + /** + * This should generally not be used, + * but we need it for being compliant with the OTEL Span interface. + * + * @hidden + * @internal + */ + recordException(_exception, _time) { + } +} +function handleCallbackErrors(fn, onError, onFinally = () => { +}) { + let maybePromiseResult; + try { + maybePromiseResult = fn(); + } catch (e2) { + onError(e2); + onFinally(); + throw e2; + } + return maybeHandlePromiseRejection(maybePromiseResult, onError, onFinally); +} +__name(handleCallbackErrors, "handleCallbackErrors"); +function maybeHandlePromiseRejection(value4, onError, onFinally) { + if (isThenable$1(value4)) { + return value4.then( + (res) => { + onFinally(); + return res; + }, + (e2) => { + onError(e2); + onFinally(); + throw e2; + } + ); + } + onFinally(); + return value4; +} +__name(maybeHandlePromiseRejection, "maybeHandlePromiseRejection"); +const DEFAULT_ENVIRONMENT = "production"; +const FROZEN_DSC_FIELD = "_frozenDsc"; +function freezeDscOnSpan(span, dsc) { + const spanWithMaybeDsc = span; + addNonEnumerableProperty(spanWithMaybeDsc, FROZEN_DSC_FIELD, dsc); +} +__name(freezeDscOnSpan, "freezeDscOnSpan"); +function getDynamicSamplingContextFromClient(trace_id, client) { + const options4 = client.getOptions(); + const { publicKey: public_key } = client.getDsn() || {}; + const dsc = dropUndefinedKeys({ + environment: options4.environment || DEFAULT_ENVIRONMENT, + release: options4.release, + public_key, + trace_id + }); + client.emit("createDsc", dsc); + return dsc; +} +__name(getDynamicSamplingContextFromClient, "getDynamicSamplingContextFromClient"); +function getDynamicSamplingContextFromScope(client, scope) { + const propagationContext = scope.getPropagationContext(); + return propagationContext.dsc || getDynamicSamplingContextFromClient(propagationContext.traceId, client); +} +__name(getDynamicSamplingContextFromScope, "getDynamicSamplingContextFromScope"); +function getDynamicSamplingContextFromSpan(span) { + const client = getClient(); + if (!client) { + return {}; + } + const rootSpan = getRootSpan(span); + const frozenDsc = rootSpan[FROZEN_DSC_FIELD]; + if (frozenDsc) { + return frozenDsc; + } + const traceState = rootSpan.spanContext().traceState; + const traceStateDsc = traceState && traceState.get("sentry.dsc"); + const dscOnTraceState = traceStateDsc && baggageHeaderToDynamicSamplingContext(traceStateDsc); + if (dscOnTraceState) { + return dscOnTraceState; + } + const dsc = getDynamicSamplingContextFromClient(span.spanContext().traceId, client); + const jsonSpan = spanToJSON(rootSpan); + const attributes = jsonSpan.data || {}; + const maybeSampleRate = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]; + if (maybeSampleRate != null) { + dsc.sample_rate = `${maybeSampleRate}`; + } + const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; + const name2 = jsonSpan.description; + if (source !== "url" && name2) { + dsc.transaction = name2; + } + if (hasTracingEnabled()) { + dsc.sampled = String(spanIsSampled(rootSpan)); + } + client.emit("createDsc", dsc, rootSpan); + return dsc; +} +__name(getDynamicSamplingContextFromSpan, "getDynamicSamplingContextFromSpan"); +function spanToBaggageHeader(span) { + const dsc = getDynamicSamplingContextFromSpan(span); + return dynamicSamplingContextToSentryBaggageHeader(dsc); +} +__name(spanToBaggageHeader, "spanToBaggageHeader"); +function logSpanStart(span) { + if (!DEBUG_BUILD$6) return; + const { description = "< unknown name >", op = "< unknown op >", parent_span_id: parentSpanId } = spanToJSON(span); + const { spanId } = span.spanContext(); + const sampled = spanIsSampled(span); + const rootSpan = getRootSpan(span); + const isRootSpan = rootSpan === span; + const header3 = `[Tracing] Starting ${sampled ? "sampled" : "unsampled"} ${isRootSpan ? "root " : ""}span`; + const infoParts = [`op: ${op}`, `name: ${description}`, `ID: ${spanId}`]; + if (parentSpanId) { + infoParts.push(`parent ID: ${parentSpanId}`); + } + if (!isRootSpan) { + const { op: op2, description: description2 } = spanToJSON(rootSpan); + infoParts.push(`root ID: ${rootSpan.spanContext().spanId}`); + if (op2) { + infoParts.push(`root op: ${op2}`); + } + if (description2) { + infoParts.push(`root description: ${description2}`); + } + } + logger$2.log(`${header3} + ${infoParts.join("\n ")}`); +} +__name(logSpanStart, "logSpanStart"); +function logSpanEnd(span) { + if (!DEBUG_BUILD$6) return; + const { description = "< unknown name >", op = "< unknown op >" } = spanToJSON(span); + const { spanId } = span.spanContext(); + const rootSpan = getRootSpan(span); + const isRootSpan = rootSpan === span; + const msg = `[Tracing] Finishing "${op}" ${isRootSpan ? "root " : ""}span "${description}" with ID ${spanId}`; + logger$2.log(msg); +} +__name(logSpanEnd, "logSpanEnd"); +function parseSampleRate(sampleRate) { + if (typeof sampleRate === "boolean") { + return Number(sampleRate); + } + const rate = typeof sampleRate === "string" ? parseFloat(sampleRate) : sampleRate; + if (typeof rate !== "number" || isNaN(rate) || rate < 0 || rate > 1) { + DEBUG_BUILD$6 && logger$2.warn( + `[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify( + sampleRate + )} of type ${JSON.stringify(typeof sampleRate)}.` + ); + return void 0; + } + return rate; +} +__name(parseSampleRate, "parseSampleRate"); +function sampleSpan(options4, samplingContext) { + if (!hasTracingEnabled(options4)) { + return [false]; + } + const normalizedRequest = getIsolationScope().getScopeData().sdkProcessingMetadata.normalizedRequest; + const enhancedSamplingContext = { + ...samplingContext, + normalizedRequest: samplingContext.normalizedRequest || normalizedRequest + }; + let sampleRate; + if (typeof options4.tracesSampler === "function") { + sampleRate = options4.tracesSampler(enhancedSamplingContext); + } else if (enhancedSamplingContext.parentSampled !== void 0) { + sampleRate = enhancedSamplingContext.parentSampled; + } else if (typeof options4.tracesSampleRate !== "undefined") { + sampleRate = options4.tracesSampleRate; + } else { + sampleRate = 1; + } + const parsedSampleRate = parseSampleRate(sampleRate); + if (parsedSampleRate === void 0) { + DEBUG_BUILD$6 && logger$2.warn("[Tracing] Discarding transaction because of invalid sample rate."); + return [false]; + } + if (!parsedSampleRate) { + DEBUG_BUILD$6 && logger$2.log( + `[Tracing] Discarding transaction because ${typeof options4.tracesSampler === "function" ? "tracesSampler returned 0 or false" : "a negative sampling decision was inherited or tracesSampleRate is set to 0"}` + ); + return [false, parsedSampleRate]; + } + const shouldSample = Math.random() < parsedSampleRate; + if (!shouldSample) { + DEBUG_BUILD$6 && logger$2.log( + `[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number( + sampleRate + )})` + ); + return [false, parsedSampleRate]; + } + return [true, parsedSampleRate]; +} +__name(sampleSpan, "sampleSpan"); +const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/; +function isValidProtocol(protocol) { + return protocol === "http" || protocol === "https"; +} +__name(isValidProtocol, "isValidProtocol"); +function dsnToString(dsn, withPassword = false) { + const { host, path, pass, port, projectId, protocol, publicKey } = dsn; + return `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ""}@${host}${port ? `:${port}` : ""}/${path ? `${path}/` : path}${projectId}`; +} +__name(dsnToString, "dsnToString"); +function dsnFromString(str) { + const match2 = DSN_REGEX.exec(str); + if (!match2) { + consoleSandbox(() => { + console.error(`Invalid Sentry Dsn: ${str}`); + }); + return void 0; + } + const [protocol, publicKey, pass = "", host = "", port = "", lastPath = ""] = match2.slice(1); + let path = ""; + let projectId = lastPath; + const split2 = projectId.split("/"); + if (split2.length > 1) { + path = split2.slice(0, -1).join("/"); + projectId = split2.pop(); + } + if (projectId) { + const projectMatch = projectId.match(/^\d+/); + if (projectMatch) { + projectId = projectMatch[0]; + } + } + return dsnFromComponents({ host, pass, path, projectId, port, protocol, publicKey }); +} +__name(dsnFromString, "dsnFromString"); +function dsnFromComponents(components) { + return { + protocol: components.protocol, + publicKey: components.publicKey || "", + pass: components.pass || "", + host: components.host, + port: components.port || "", + path: components.path || "", + projectId: components.projectId + }; +} +__name(dsnFromComponents, "dsnFromComponents"); +function validateDsn(dsn) { + if (!DEBUG_BUILD$5) { + return true; + } + const { port, projectId, protocol } = dsn; + const requiredComponents = ["protocol", "publicKey", "host", "projectId"]; + const hasMissingRequiredComponent = requiredComponents.find((component) => { + if (!dsn[component]) { + logger$2.error(`Invalid Sentry Dsn: ${component} missing`); + return true; + } + return false; + }); + if (hasMissingRequiredComponent) { + return false; + } + if (!projectId.match(/^\d+$/)) { + logger$2.error(`Invalid Sentry Dsn: Invalid projectId ${projectId}`); + return false; + } + if (!isValidProtocol(protocol)) { + logger$2.error(`Invalid Sentry Dsn: Invalid protocol ${protocol}`); + return false; + } + if (port && isNaN(parseInt(port, 10))) { + logger$2.error(`Invalid Sentry Dsn: Invalid port ${port}`); + return false; + } + return true; +} +__name(validateDsn, "validateDsn"); +function makeDsn(from2) { + const components = typeof from2 === "string" ? dsnFromString(from2) : dsnFromComponents(from2); + if (!components || !validateDsn(components)) { + return void 0; + } + return components; +} +__name(makeDsn, "makeDsn"); +function memoBuilder() { + const hasWeakSet = typeof WeakSet === "function"; + const inner = hasWeakSet ? /* @__PURE__ */ new WeakSet() : []; + function memoize(obj) { + if (hasWeakSet) { + if (inner.has(obj)) { + return true; + } + inner.add(obj); + return false; + } + for (let i2 = 0; i2 < inner.length; i2++) { + const value4 = inner[i2]; + if (value4 === obj) { + return true; + } + } + inner.push(obj); + return false; + } + __name(memoize, "memoize"); + function unmemoize(obj) { + if (hasWeakSet) { + inner.delete(obj); + } else { + for (let i2 = 0; i2 < inner.length; i2++) { + if (inner[i2] === obj) { + inner.splice(i2, 1); + break; + } + } + } + } + __name(unmemoize, "unmemoize"); + return [memoize, unmemoize]; +} +__name(memoBuilder, "memoBuilder"); +function normalize$2(input, depth = 100, maxProperties = Infinity) { + try { + return visit("", input, depth, maxProperties); + } catch (err) { + return { ERROR: `**non-serializable** (${err})` }; + } +} +__name(normalize$2, "normalize$2"); +function normalizeToSize(object, depth = 3, maxSize = 100 * 1024) { + const normalized = normalize$2(object, depth); + if (jsonSize(normalized) > maxSize) { + return normalizeToSize(object, depth - 1, maxSize); + } + return normalized; +} +__name(normalizeToSize, "normalizeToSize"); +function visit(key, value4, depth = Infinity, maxProperties = Infinity, memo = memoBuilder()) { + const [memoize, unmemoize] = memo; + if (value4 == null || // this matches null and undefined -> eqeq not eqeqeq + ["boolean", "string"].includes(typeof value4) || typeof value4 === "number" && Number.isFinite(value4)) { + return value4; + } + const stringified = stringifyValue(key, value4); + if (!stringified.startsWith("[object ")) { + return stringified; + } + if (value4["__sentry_skip_normalization__"]) { + return value4; + } + const remainingDepth = typeof value4["__sentry_override_normalization_depth__"] === "number" ? value4["__sentry_override_normalization_depth__"] : depth; + if (remainingDepth === 0) { + return stringified.replace("object ", ""); + } + if (memoize(value4)) { + return "[Circular ~]"; + } + const valueWithToJSON = value4; + if (valueWithToJSON && typeof valueWithToJSON.toJSON === "function") { + try { + const jsonValue = valueWithToJSON.toJSON(); + return visit("", jsonValue, remainingDepth - 1, maxProperties, memo); + } catch (err) { + } + } + const normalized = Array.isArray(value4) ? [] : {}; + let numAdded = 0; + const visitable = convertToPlainObject(value4); + for (const visitKey in visitable) { + if (!Object.prototype.hasOwnProperty.call(visitable, visitKey)) { + continue; + } + if (numAdded >= maxProperties) { + normalized[visitKey] = "[MaxProperties ~]"; + break; + } + const visitValue = visitable[visitKey]; + normalized[visitKey] = visit(visitKey, visitValue, remainingDepth - 1, maxProperties, memo); + numAdded++; + } + unmemoize(value4); + return normalized; +} +__name(visit, "visit"); +function stringifyValue(key, value4) { + try { + if (key === "domain" && value4 && typeof value4 === "object" && value4._events) { + return "[Domain]"; + } + if (key === "domainEmitter") { + return "[DomainEmitter]"; + } + if (typeof global !== "undefined" && value4 === global) { + return "[Global]"; + } + if (typeof window !== "undefined" && value4 === window) { + return "[Window]"; + } + if (typeof document !== "undefined" && value4 === document) { + return "[Document]"; + } + if (isVueViewModel(value4)) { + return "[VueViewModel]"; + } + if (isSyntheticEvent(value4)) { + return "[SyntheticEvent]"; + } + if (typeof value4 === "number" && !Number.isFinite(value4)) { + return `[${value4}]`; + } + if (typeof value4 === "function") { + return `[Function: ${getFunctionName(value4)}]`; + } + if (typeof value4 === "symbol") { + return `[${String(value4)}]`; + } + if (typeof value4 === "bigint") { + return `[BigInt: ${String(value4)}]`; + } + const objName = getConstructorName(value4); + if (/^HTML(\w*)Element$/.test(objName)) { + return `[HTMLElement: ${objName}]`; + } + return `[object ${objName}]`; + } catch (err) { + return `**non-serializable** (${err})`; + } +} +__name(stringifyValue, "stringifyValue"); +function getConstructorName(value4) { + const prototype2 = Object.getPrototypeOf(value4); + return prototype2 ? prototype2.constructor.name : "null prototype"; +} +__name(getConstructorName, "getConstructorName"); +function utf8Length(value4) { + return ~-encodeURI(value4).split(/%..|./).length; +} +__name(utf8Length, "utf8Length"); +function jsonSize(value4) { + return utf8Length(JSON.stringify(value4)); +} +__name(jsonSize, "jsonSize"); +function normalizeUrlToBase(url, basePath2) { + const escapedBase = basePath2.replace(/\\/g, "/").replace(/[|\\{}()[\]^$+*?.]/g, "\\$&"); + let newUrl = url; + try { + newUrl = decodeURI(url); + } catch (_Oo) { + } + return newUrl.replace(/\\/g, "/").replace(/webpack:\/?/g, "").replace(new RegExp(`(file://)?/*${escapedBase}/*`, "ig"), "app:///"); +} +__name(normalizeUrlToBase, "normalizeUrlToBase"); +function createEnvelope(headers, items2 = []) { + return [headers, items2]; +} +__name(createEnvelope, "createEnvelope"); +function addItemToEnvelope(envelope, newItem) { + const [headers, items2] = envelope; + return [headers, [...items2, newItem]]; +} +__name(addItemToEnvelope, "addItemToEnvelope"); +function forEachEnvelopeItem(envelope, callback) { + const envelopeItems = envelope[1]; + for (const envelopeItem of envelopeItems) { + const envelopeItemType = envelopeItem[0].type; + const result = callback(envelopeItem, envelopeItemType); + if (result) { + return true; + } + } + return false; +} +__name(forEachEnvelopeItem, "forEachEnvelopeItem"); +function envelopeContainsItemType(envelope, types) { + return forEachEnvelopeItem(envelope, (_2, type) => types.includes(type)); +} +__name(envelopeContainsItemType, "envelopeContainsItemType"); +function encodeUTF8(input) { + return GLOBAL_OBJ.__SENTRY__ && GLOBAL_OBJ.__SENTRY__.encodePolyfill ? GLOBAL_OBJ.__SENTRY__.encodePolyfill(input) : new TextEncoder().encode(input); +} +__name(encodeUTF8, "encodeUTF8"); +function decodeUTF8(input) { + return GLOBAL_OBJ.__SENTRY__ && GLOBAL_OBJ.__SENTRY__.decodePolyfill ? GLOBAL_OBJ.__SENTRY__.decodePolyfill(input) : new TextDecoder().decode(input); +} +__name(decodeUTF8, "decodeUTF8"); +function serializeEnvelope(envelope) { + const [envHeaders, items2] = envelope; + let parts2 = JSON.stringify(envHeaders); + function append3(next2) { + if (typeof parts2 === "string") { + parts2 = typeof next2 === "string" ? parts2 + next2 : [encodeUTF8(parts2), next2]; + } else { + parts2.push(typeof next2 === "string" ? encodeUTF8(next2) : next2); + } + } + __name(append3, "append"); + for (const item3 of items2) { + const [itemHeaders, payload] = item3; + append3(` +${JSON.stringify(itemHeaders)} +`); + if (typeof payload === "string" || payload instanceof Uint8Array) { + append3(payload); + } else { + let stringifiedPayload; + try { + stringifiedPayload = JSON.stringify(payload); + } catch (e2) { + stringifiedPayload = JSON.stringify(normalize$2(payload)); + } + append3(stringifiedPayload); + } + } + return typeof parts2 === "string" ? parts2 : concatBuffers(parts2); +} +__name(serializeEnvelope, "serializeEnvelope"); +function concatBuffers(buffers) { + const totalLength = buffers.reduce((acc, buf) => acc + buf.length, 0); + const merged = new Uint8Array(totalLength); + let offset = 0; + for (const buffer2 of buffers) { + merged.set(buffer2, offset); + offset += buffer2.length; + } + return merged; +} +__name(concatBuffers, "concatBuffers"); +function parseEnvelope(env) { + let buffer2 = typeof env === "string" ? encodeUTF8(env) : env; + function readBinary(length) { + const bin = buffer2.subarray(0, length); + buffer2 = buffer2.subarray(length + 1); + return bin; + } + __name(readBinary, "readBinary"); + function readJson() { + let i2 = buffer2.indexOf(10); + if (i2 < 0) { + i2 = buffer2.length; + } + return JSON.parse(decodeUTF8(readBinary(i2))); + } + __name(readJson, "readJson"); + const envelopeHeader = readJson(); + const items2 = []; + while (buffer2.length) { + const itemHeader = readJson(); + const binaryLength = typeof itemHeader.length === "number" ? itemHeader.length : void 0; + items2.push([itemHeader, binaryLength ? readBinary(binaryLength) : readJson()]); + } + return [envelopeHeader, items2]; +} +__name(parseEnvelope, "parseEnvelope"); +function createSpanEnvelopeItem(spanJson) { + const spanHeaders = { + type: "span" + }; + return [spanHeaders, spanJson]; +} +__name(createSpanEnvelopeItem, "createSpanEnvelopeItem"); +function createAttachmentEnvelopeItem(attachment) { + const buffer2 = typeof attachment.data === "string" ? encodeUTF8(attachment.data) : attachment.data; + return [ + dropUndefinedKeys({ + type: "attachment", + length: buffer2.length, + filename: attachment.filename, + content_type: attachment.contentType, + attachment_type: attachment.attachmentType + }), + buffer2 + ]; +} +__name(createAttachmentEnvelopeItem, "createAttachmentEnvelopeItem"); +const ITEM_TYPE_TO_DATA_CATEGORY_MAP = { + session: "session", + sessions: "session", + attachment: "attachment", + transaction: "transaction", + event: "error", + client_report: "internal", + user_report: "default", + profile: "profile", + profile_chunk: "profile", + replay_event: "replay", + replay_recording: "replay", + check_in: "monitor", + feedback: "feedback", + span: "span", + statsd: "metric_bucket", + raw_security: "security" +}; +function envelopeItemTypeToDataCategory(type) { + return ITEM_TYPE_TO_DATA_CATEGORY_MAP[type]; +} +__name(envelopeItemTypeToDataCategory, "envelopeItemTypeToDataCategory"); +function getSdkMetadataForEnvelopeHeader(metadataOrEvent) { + if (!metadataOrEvent || !metadataOrEvent.sdk) { + return; + } + const { name: name2, version: version2 } = metadataOrEvent.sdk; + return { name: name2, version: version2 }; +} +__name(getSdkMetadataForEnvelopeHeader, "getSdkMetadataForEnvelopeHeader"); +function createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn) { + const dynamicSamplingContext = event.sdkProcessingMetadata && event.sdkProcessingMetadata.dynamicSamplingContext; + return { + event_id: event.event_id, + sent_at: (/* @__PURE__ */ new Date()).toISOString(), + ...sdkInfo && { sdk: sdkInfo }, + ...!!tunnel && dsn && { dsn: dsnToString(dsn) }, + ...dynamicSamplingContext && { + trace: dropUndefinedKeys({ ...dynamicSamplingContext }) + } + }; +} +__name(createEventEnvelopeHeaders, "createEventEnvelopeHeaders"); +function enhanceEventWithSdkInfo(event, sdkInfo) { + if (!sdkInfo) { + return event; + } + event.sdk = event.sdk || {}; + event.sdk.name = event.sdk.name || sdkInfo.name; + event.sdk.version = event.sdk.version || sdkInfo.version; + event.sdk.integrations = [...event.sdk.integrations || [], ...sdkInfo.integrations || []]; + event.sdk.packages = [...event.sdk.packages || [], ...sdkInfo.packages || []]; + return event; +} +__name(enhanceEventWithSdkInfo, "enhanceEventWithSdkInfo"); +function createSessionEnvelope(session, dsn, metadata, tunnel) { + const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata); + const envelopeHeaders = { + sent_at: (/* @__PURE__ */ new Date()).toISOString(), + ...sdkInfo && { sdk: sdkInfo }, + ...!!tunnel && dsn && { dsn: dsnToString(dsn) } + }; + const envelopeItem = "aggregates" in session ? [{ type: "sessions" }, session] : [{ type: "session" }, session.toJSON()]; + return createEnvelope(envelopeHeaders, [envelopeItem]); +} +__name(createSessionEnvelope, "createSessionEnvelope"); +function createEventEnvelope(event, dsn, metadata, tunnel) { + const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata); + const eventType = event.type && event.type !== "replay_event" ? event.type : "event"; + enhanceEventWithSdkInfo(event, metadata && metadata.sdk); + const envelopeHeaders = createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn); + delete event.sdkProcessingMetadata; + const eventItem = [{ type: eventType }, event]; + return createEnvelope(envelopeHeaders, [eventItem]); +} +__name(createEventEnvelope, "createEventEnvelope"); +function createSpanEnvelope(spans, client) { + function dscHasRequiredProps(dsc2) { + return !!dsc2.trace_id && !!dsc2.public_key; + } + __name(dscHasRequiredProps, "dscHasRequiredProps"); + const dsc = getDynamicSamplingContextFromSpan(spans[0]); + const dsn = client && client.getDsn(); + const tunnel = client && client.getOptions().tunnel; + const headers = { + sent_at: (/* @__PURE__ */ new Date()).toISOString(), + ...dscHasRequiredProps(dsc) && { trace: dsc }, + ...!!tunnel && dsn && { dsn: dsnToString(dsn) } + }; + const beforeSendSpan = client && client.getOptions().beforeSendSpan; + const convertToSpanJSON = beforeSendSpan ? (span) => { + const spanJson = beforeSendSpan(spanToJSON(span)); + if (!spanJson) { + showSpanDropWarning(); + } + return spanJson; + } : (span) => spanToJSON(span); + const items2 = []; + for (const span of spans) { + const spanJson = convertToSpanJSON(span); + if (spanJson) { + items2.push(createSpanEnvelopeItem(spanJson)); + } + } + return createEnvelope(headers, items2); +} +__name(createSpanEnvelope, "createSpanEnvelope"); +function setMeasurement(name2, value4, unit, activeSpan = getActiveSpan()) { + const rootSpan = activeSpan && getRootSpan(activeSpan); + if (rootSpan) { + DEBUG_BUILD$6 && logger$2.log(`[Measurement] Setting measurement on root span: ${name2} = ${value4} ${unit}`); + rootSpan.addEvent(name2, { + [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: value4, + [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: unit + }); + } +} +__name(setMeasurement, "setMeasurement"); +function timedEventsToMeasurements(events2) { + if (!events2 || events2.length === 0) { + return void 0; + } + const measurements = {}; + events2.forEach((event) => { + const attributes = event.attributes || {}; + const unit = attributes[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]; + const value4 = attributes[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]; + if (typeof unit === "string" && typeof value4 === "number") { + measurements[event.name] = { value: value4, unit }; + } + }); + return measurements; +} +__name(timedEventsToMeasurements, "timedEventsToMeasurements"); +const MAX_SPAN_COUNT = 1e3; +class SentrySpan { + static { + __name(this, "SentrySpan"); + } + /** Epoch timestamp in seconds when the span started. */ + /** Epoch timestamp in seconds when the span ended. */ + /** Internal keeper of the status */ + /** The timed events added to this span. */ + /** if true, treat span as a standalone span (not part of a transaction) */ + /** + * You should never call the constructor manually, always use `Sentry.startSpan()` + * or other span methods. + * @internal + * @hideconstructor + * @hidden + */ + constructor(spanContext = {}) { + this._traceId = spanContext.traceId || generateTraceId(); + this._spanId = spanContext.spanId || generateSpanId(); + this._startTime = spanContext.startTimestamp || timestampInSeconds(); + this._attributes = {}; + this.setAttributes({ + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "manual", + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: spanContext.op, + ...spanContext.attributes + }); + this._name = spanContext.name; + if (spanContext.parentSpanId) { + this._parentSpanId = spanContext.parentSpanId; + } + if ("sampled" in spanContext) { + this._sampled = spanContext.sampled; + } + if (spanContext.endTimestamp) { + this._endTime = spanContext.endTimestamp; + } + this._events = []; + this._isStandaloneSpan = spanContext.isStandalone; + if (this._endTime) { + this._onSpanEnded(); + } + } + /** + * This should generally not be used, + * but it is needed for being compliant with the OTEL Span interface. + * + * @hidden + * @internal + */ + addLink(_link) { + return this; + } + /** + * This should generally not be used, + * but it is needed for being compliant with the OTEL Span interface. + * + * @hidden + * @internal + */ + addLinks(_links) { + return this; + } + /** + * This should generally not be used, + * but it is needed for being compliant with the OTEL Span interface. + * + * @hidden + * @internal + */ + recordException(_exception, _time) { + } + /** @inheritdoc */ + spanContext() { + const { _spanId: spanId, _traceId: traceId, _sampled: sampled } = this; + return { + spanId, + traceId, + traceFlags: sampled ? TRACE_FLAG_SAMPLED : TRACE_FLAG_NONE + }; + } + /** @inheritdoc */ + setAttribute(key, value4) { + if (value4 === void 0) { + delete this._attributes[key]; + } else { + this._attributes[key] = value4; + } + return this; + } + /** @inheritdoc */ + setAttributes(attributes) { + Object.keys(attributes).forEach((key) => this.setAttribute(key, attributes[key])); + return this; + } + /** + * This should generally not be used, + * but we need it for browser tracing where we want to adjust the start time afterwards. + * USE THIS WITH CAUTION! + * + * @hidden + * @internal + */ + updateStartTime(timeInput) { + this._startTime = spanTimeInputToSeconds(timeInput); + } + /** + * @inheritDoc + */ + setStatus(value4) { + this._status = value4; + return this; + } + /** + * @inheritDoc + */ + updateName(name2) { + this._name = name2; + this.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, "custom"); + return this; + } + /** @inheritdoc */ + end(endTimestamp) { + if (this._endTime) { + return; + } + this._endTime = spanTimeInputToSeconds(endTimestamp); + logSpanEnd(this); + this._onSpanEnded(); + } + /** + * Get JSON representation of this span. + * + * @hidden + * @internal This method is purely for internal purposes and should not be used outside + * of SDK code. If you need to get a JSON representation of a span, + * use `spanToJSON(span)` instead. + */ + getSpanJSON() { + return dropUndefinedKeys({ + data: this._attributes, + description: this._name, + op: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP], + parent_span_id: this._parentSpanId, + span_id: this._spanId, + start_timestamp: this._startTime, + status: getStatusMessage(this._status), + timestamp: this._endTime, + trace_id: this._traceId, + origin: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN], + _metrics_summary: getMetricSummaryJsonForSpan(this), + profile_id: this._attributes[SEMANTIC_ATTRIBUTE_PROFILE_ID], + exclusive_time: this._attributes[SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME], + measurements: timedEventsToMeasurements(this._events), + is_segment: this._isStandaloneSpan && getRootSpan(this) === this || void 0, + segment_id: this._isStandaloneSpan ? getRootSpan(this).spanContext().spanId : void 0 + }); + } + /** @inheritdoc */ + isRecording() { + return !this._endTime && !!this._sampled; + } + /** + * @inheritdoc + */ + addEvent(name2, attributesOrStartTime, startTime) { + DEBUG_BUILD$6 && logger$2.log("[Tracing] Adding an event to span:", name2); + const time = isSpanTimeInput(attributesOrStartTime) ? attributesOrStartTime : startTime || timestampInSeconds(); + const attributes = isSpanTimeInput(attributesOrStartTime) ? {} : attributesOrStartTime || {}; + const event = { + name: name2, + time: spanTimeInputToSeconds(time), + attributes + }; + this._events.push(event); + return this; + } + /** + * This method should generally not be used, + * but for now we need a way to publicly check if the `_isStandaloneSpan` flag is set. + * USE THIS WITH CAUTION! + * @internal + * @hidden + * @experimental + */ + isStandaloneSpan() { + return !!this._isStandaloneSpan; + } + /** Emit `spanEnd` when the span is ended. */ + _onSpanEnded() { + const client = getClient(); + if (client) { + client.emit("spanEnd", this); + } + const isSegmentSpan = this._isStandaloneSpan || this === getRootSpan(this); + if (!isSegmentSpan) { + return; + } + if (this._isStandaloneSpan) { + if (this._sampled) { + sendSpanEnvelope(createSpanEnvelope([this], client)); + } else { + DEBUG_BUILD$6 && logger$2.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."); + if (client) { + client.recordDroppedEvent("sample_rate", "span"); + } + } + return; + } + const transactionEvent = this._convertSpanToTransaction(); + if (transactionEvent) { + const scope = getCapturedScopesOnSpan(this).scope || getCurrentScope$1(); + scope.captureEvent(transactionEvent); + } + } + /** + * Finish the transaction & prepare the event to send to Sentry. + */ + _convertSpanToTransaction() { + if (!isFullFinishedSpan(spanToJSON(this))) { + return void 0; + } + if (!this._name) { + DEBUG_BUILD$6 && logger$2.warn("Transaction has no name, falling back to ``."); + this._name = ""; + } + const { scope: capturedSpanScope, isolationScope: capturedSpanIsolationScope } = getCapturedScopesOnSpan(this); + const scope = capturedSpanScope || getCurrentScope$1(); + const client = scope.getClient() || getClient(); + if (this._sampled !== true) { + DEBUG_BUILD$6 && logger$2.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."); + if (client) { + client.recordDroppedEvent("sample_rate", "transaction"); + } + return void 0; + } + const finishedSpans = getSpanDescendants(this).filter((span) => span !== this && !isStandaloneSpan(span)); + const spans = finishedSpans.map((span) => spanToJSON(span)).filter(isFullFinishedSpan); + const source = this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; + delete this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]; + spans.forEach((span) => { + span.data && delete span.data[SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]; + }); + const transaction = { + contexts: { + trace: spanToTransactionTraceContext(this) + }, + spans: ( + // spans.sort() mutates the array, but `spans` is already a copy so we can safely do this here + // we do not use spans anymore after this point + spans.length > MAX_SPAN_COUNT ? spans.sort((a2, b2) => a2.start_timestamp - b2.start_timestamp).slice(0, MAX_SPAN_COUNT) : spans + ), + start_timestamp: this._startTime, + timestamp: this._endTime, + transaction: this._name, + type: "transaction", + sdkProcessingMetadata: { + capturedSpanScope, + capturedSpanIsolationScope, + ...dropUndefinedKeys({ + dynamicSamplingContext: getDynamicSamplingContextFromSpan(this) + }) + }, + _metrics_summary: getMetricSummaryJsonForSpan(this), + ...source && { + transaction_info: { + source + } + } + }; + const measurements = timedEventsToMeasurements(this._events); + const hasMeasurements = measurements && Object.keys(measurements).length; + if (hasMeasurements) { + DEBUG_BUILD$6 && logger$2.log( + "[Measurements] Adding measurements to transaction event", + JSON.stringify(measurements, void 0, 2) + ); + transaction.measurements = measurements; + } + return transaction; + } +} +function isSpanTimeInput(value4) { + return value4 && typeof value4 === "number" || value4 instanceof Date || Array.isArray(value4); +} +__name(isSpanTimeInput, "isSpanTimeInput"); +function isFullFinishedSpan(input) { + return !!input.start_timestamp && !!input.timestamp && !!input.span_id && !!input.trace_id; +} +__name(isFullFinishedSpan, "isFullFinishedSpan"); +function isStandaloneSpan(span) { + return span instanceof SentrySpan && span.isStandaloneSpan(); +} +__name(isStandaloneSpan, "isStandaloneSpan"); +function sendSpanEnvelope(envelope) { + const client = getClient(); + if (!client) { + return; + } + const spanItems = envelope[1]; + if (!spanItems || spanItems.length === 0) { + client.recordDroppedEvent("before_send", "span"); + return; + } + client.sendEnvelope(envelope); +} +__name(sendSpanEnvelope, "sendSpanEnvelope"); +const SUPPRESS_TRACING_KEY = "__SENTRY_SUPPRESS_TRACING__"; +function startSpan(options4, callback) { + const acs = getAcs(); + if (acs.startSpan) { + return acs.startSpan(options4, callback); + } + const spanArguments = parseSentrySpanArguments(options4); + const { forceTransaction, parentSpan: customParentSpan } = options4; + return withScope(options4.scope, () => { + const wrapper = getActiveSpanWrapper(customParentSpan); + return wrapper(() => { + const scope = getCurrentScope$1(); + const parentSpan = getParentSpan(scope); + const shouldSkipSpan = options4.onlyIfParent && !parentSpan; + const activeSpan = shouldSkipSpan ? new SentryNonRecordingSpan() : createChildOrRootSpan({ + parentSpan, + spanArguments, + forceTransaction, + scope + }); + _setSpanForScope(scope, activeSpan); + return handleCallbackErrors( + () => callback(activeSpan), + () => { + const { status } = spanToJSON(activeSpan); + if (activeSpan.isRecording() && (!status || status === "ok")) { + activeSpan.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" }); + } + }, + () => activeSpan.end() + ); + }); + }); +} +__name(startSpan, "startSpan"); +function startSpanManual(options4, callback) { + const acs = getAcs(); + if (acs.startSpanManual) { + return acs.startSpanManual(options4, callback); + } + const spanArguments = parseSentrySpanArguments(options4); + const { forceTransaction, parentSpan: customParentSpan } = options4; + return withScope(options4.scope, () => { + const wrapper = getActiveSpanWrapper(customParentSpan); + return wrapper(() => { + const scope = getCurrentScope$1(); + const parentSpan = getParentSpan(scope); + const shouldSkipSpan = options4.onlyIfParent && !parentSpan; + const activeSpan = shouldSkipSpan ? new SentryNonRecordingSpan() : createChildOrRootSpan({ + parentSpan, + spanArguments, + forceTransaction, + scope + }); + _setSpanForScope(scope, activeSpan); + function finishAndSetSpan() { + activeSpan.end(); + } + __name(finishAndSetSpan, "finishAndSetSpan"); + return handleCallbackErrors( + () => callback(activeSpan, finishAndSetSpan), + () => { + const { status } = spanToJSON(activeSpan); + if (activeSpan.isRecording() && (!status || status === "ok")) { + activeSpan.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" }); + } + } + ); + }); + }); +} +__name(startSpanManual, "startSpanManual"); +function startInactiveSpan(options4) { + const acs = getAcs(); + if (acs.startInactiveSpan) { + return acs.startInactiveSpan(options4); + } + const spanArguments = parseSentrySpanArguments(options4); + const { forceTransaction, parentSpan: customParentSpan } = options4; + const wrapper = options4.scope ? (callback) => withScope(options4.scope, callback) : customParentSpan !== void 0 ? (callback) => withActiveSpan(customParentSpan, callback) : (callback) => callback(); + return wrapper(() => { + const scope = getCurrentScope$1(); + const parentSpan = getParentSpan(scope); + const shouldSkipSpan = options4.onlyIfParent && !parentSpan; + if (shouldSkipSpan) { + return new SentryNonRecordingSpan(); + } + return createChildOrRootSpan({ + parentSpan, + spanArguments, + forceTransaction, + scope + }); + }); +} +__name(startInactiveSpan, "startInactiveSpan"); +const continueTrace = /* @__PURE__ */ __name((options4, callback) => { + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + if (acs.continueTrace) { + return acs.continueTrace(options4, callback); + } + const { sentryTrace, baggage } = options4; + return withScope((scope) => { + const propagationContext = propagationContextFromHeaders(sentryTrace, baggage); + scope.setPropagationContext(propagationContext); + return callback(); + }); +}, "continueTrace"); +function withActiveSpan(span, callback) { + const acs = getAcs(); + if (acs.withActiveSpan) { + return acs.withActiveSpan(span, callback); + } + return withScope((scope) => { + _setSpanForScope(scope, span || void 0); + return callback(scope); + }); +} +__name(withActiveSpan, "withActiveSpan"); +function suppressTracing(callback) { + const acs = getAcs(); + if (acs.suppressTracing) { + return acs.suppressTracing(callback); + } + return withScope((scope) => { + scope.setSDKProcessingMetadata({ [SUPPRESS_TRACING_KEY]: true }); + return callback(); + }); +} +__name(suppressTracing, "suppressTracing"); +function startNewTrace(callback) { + return withScope((scope) => { + scope.setPropagationContext({ traceId: generateTraceId() }); + DEBUG_BUILD$6 && logger$2.info(`Starting a new trace with id ${scope.getPropagationContext().traceId}`); + return withActiveSpan(null, callback); + }); +} +__name(startNewTrace, "startNewTrace"); +function createChildOrRootSpan({ + parentSpan, + spanArguments, + forceTransaction, + scope +}) { + if (!hasTracingEnabled()) { + return new SentryNonRecordingSpan(); + } + const isolationScope = getIsolationScope(); + let span; + if (parentSpan && !forceTransaction) { + span = _startChildSpan(parentSpan, scope, spanArguments); + addChildSpanToSpan(parentSpan, span); + } else if (parentSpan) { + const dsc = getDynamicSamplingContextFromSpan(parentSpan); + const { traceId, spanId: parentSpanId } = parentSpan.spanContext(); + const parentSampled = spanIsSampled(parentSpan); + span = _startRootSpan( + { + traceId, + parentSpanId, + ...spanArguments + }, + scope, + parentSampled + ); + freezeDscOnSpan(span, dsc); + } else { + const { + traceId, + dsc, + parentSpanId, + sampled: parentSampled + } = { + ...isolationScope.getPropagationContext(), + ...scope.getPropagationContext() + }; + span = _startRootSpan( + { + traceId, + parentSpanId, + ...spanArguments + }, + scope, + parentSampled + ); + if (dsc) { + freezeDscOnSpan(span, dsc); + } + } + logSpanStart(span); + setCapturedScopesOnSpan(span, scope, isolationScope); + return span; +} +__name(createChildOrRootSpan, "createChildOrRootSpan"); +function parseSentrySpanArguments(options4) { + const exp = options4.experimental || {}; + const initialCtx = { + isStandalone: exp.standalone, + ...options4 + }; + if (options4.startTime) { + const ctx = { ...initialCtx }; + ctx.startTimestamp = spanTimeInputToSeconds(options4.startTime); + delete ctx.startTime; + return ctx; + } + return initialCtx; +} +__name(parseSentrySpanArguments, "parseSentrySpanArguments"); +function getAcs() { + const carrier = getMainCarrier(); + return getAsyncContextStrategy(carrier); +} +__name(getAcs, "getAcs"); +function _startRootSpan(spanArguments, scope, parentSampled) { + const client = getClient(); + const options4 = client && client.getOptions() || {}; + const { name: name2 = "", attributes } = spanArguments; + const [sampled, sampleRate] = scope.getScopeData().sdkProcessingMetadata[SUPPRESS_TRACING_KEY] ? [false] : sampleSpan(options4, { + name: name2, + parentSampled, + attributes, + transactionContext: { + name: name2, + parentSampled + } + }); + const rootSpan = new SentrySpan({ + ...spanArguments, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "custom", + ...spanArguments.attributes + }, + sampled + }); + if (sampleRate !== void 0) { + rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, sampleRate); + } + if (client) { + client.emit("spanStart", rootSpan); + } + return rootSpan; +} +__name(_startRootSpan, "_startRootSpan"); +function _startChildSpan(parentSpan, scope, spanArguments) { + const { spanId, traceId } = parentSpan.spanContext(); + const sampled = scope.getScopeData().sdkProcessingMetadata[SUPPRESS_TRACING_KEY] ? false : spanIsSampled(parentSpan); + const childSpan = sampled ? new SentrySpan({ + ...spanArguments, + parentSpanId: spanId, + traceId, + sampled + }) : new SentryNonRecordingSpan({ traceId }); + addChildSpanToSpan(parentSpan, childSpan); + const client = getClient(); + if (client) { + client.emit("spanStart", childSpan); + if (spanArguments.endTimestamp) { + client.emit("spanEnd", childSpan); + } + } + return childSpan; +} +__name(_startChildSpan, "_startChildSpan"); +function getParentSpan(scope) { + const span = _getSpanForScope(scope); + if (!span) { + return void 0; + } + const client = getClient(); + const options4 = client ? client.getOptions() : {}; + if (options4.parentSpanIsAlwaysRootSpan) { + return getRootSpan(span); + } + return span; +} +__name(getParentSpan, "getParentSpan"); +function getActiveSpanWrapper(parentSpan) { + return parentSpan !== void 0 ? (callback) => { + return withActiveSpan(parentSpan, callback); + } : (callback) => callback(); +} +__name(getActiveSpanWrapper, "getActiveSpanWrapper"); +const TRACING_DEFAULTS = { + idleTimeout: 1e3, + finalTimeout: 3e4, + childSpanTimeout: 15e3 +}; +const FINISH_REASON_HEARTBEAT_FAILED = "heartbeatFailed"; +const FINISH_REASON_IDLE_TIMEOUT = "idleTimeout"; +const FINISH_REASON_FINAL_TIMEOUT = "finalTimeout"; +const FINISH_REASON_EXTERNAL_FINISH = "externalFinish"; +function startIdleSpan(startSpanOptions, options4 = {}) { + const activities = /* @__PURE__ */ new Map(); + let _finished = false; + let _idleTimeoutID; + let _finishReason = FINISH_REASON_EXTERNAL_FINISH; + let _autoFinishAllowed = !options4.disableAutoFinish; + const _cleanupHooks = []; + const { + idleTimeout = TRACING_DEFAULTS.idleTimeout, + finalTimeout = TRACING_DEFAULTS.finalTimeout, + childSpanTimeout = TRACING_DEFAULTS.childSpanTimeout, + beforeSpanEnd + } = options4; + const client = getClient(); + if (!client || !hasTracingEnabled()) { + return new SentryNonRecordingSpan(); + } + const scope = getCurrentScope$1(); + const previousActiveSpan = getActiveSpan(); + const span = _startIdleSpan(startSpanOptions); + span.end = new Proxy(span.end, { + apply(target, thisArg, args) { + if (beforeSpanEnd) { + beforeSpanEnd(span); + } + const [definedEndTimestamp, ...rest] = args; + const timestamp2 = definedEndTimestamp || timestampInSeconds(); + const spanEndTimestamp = spanTimeInputToSeconds(timestamp2); + const spans = getSpanDescendants(span).filter((child) => child !== span); + if (!spans.length) { + onIdleSpanEnded(spanEndTimestamp); + return Reflect.apply(target, thisArg, [spanEndTimestamp, ...rest]); + } + const childEndTimestamps = spans.map((span2) => spanToJSON(span2).timestamp).filter((timestamp3) => !!timestamp3); + const latestSpanEndTimestamp = childEndTimestamps.length ? Math.max(...childEndTimestamps) : void 0; + const spanStartTimestamp = spanToJSON(span).start_timestamp; + const endTimestamp = Math.min( + spanStartTimestamp ? spanStartTimestamp + finalTimeout / 1e3 : Infinity, + Math.max(spanStartTimestamp || -Infinity, Math.min(spanEndTimestamp, latestSpanEndTimestamp || Infinity)) + ); + onIdleSpanEnded(endTimestamp); + return Reflect.apply(target, thisArg, [endTimestamp, ...rest]); + } + }); + function _cancelIdleTimeout() { + if (_idleTimeoutID) { + clearTimeout(_idleTimeoutID); + _idleTimeoutID = void 0; + } + } + __name(_cancelIdleTimeout, "_cancelIdleTimeout"); + function _restartIdleTimeout(endTimestamp) { + _cancelIdleTimeout(); + _idleTimeoutID = setTimeout(() => { + if (!_finished && activities.size === 0 && _autoFinishAllowed) { + _finishReason = FINISH_REASON_IDLE_TIMEOUT; + span.end(endTimestamp); + } + }, idleTimeout); + } + __name(_restartIdleTimeout, "_restartIdleTimeout"); + function _restartChildSpanTimeout(endTimestamp) { + _idleTimeoutID = setTimeout(() => { + if (!_finished && _autoFinishAllowed) { + _finishReason = FINISH_REASON_HEARTBEAT_FAILED; + span.end(endTimestamp); + } + }, childSpanTimeout); + } + __name(_restartChildSpanTimeout, "_restartChildSpanTimeout"); + function _pushActivity(spanId) { + _cancelIdleTimeout(); + activities.set(spanId, true); + const endTimestamp = timestampInSeconds(); + _restartChildSpanTimeout(endTimestamp + childSpanTimeout / 1e3); + } + __name(_pushActivity, "_pushActivity"); + function _popActivity(spanId) { + if (activities.has(spanId)) { + activities.delete(spanId); + } + if (activities.size === 0) { + const endTimestamp = timestampInSeconds(); + _restartIdleTimeout(endTimestamp + idleTimeout / 1e3); + } + } + __name(_popActivity, "_popActivity"); + function onIdleSpanEnded(endTimestamp) { + _finished = true; + activities.clear(); + _cleanupHooks.forEach((cleanup) => cleanup()); + _setSpanForScope(scope, previousActiveSpan); + const spanJSON = spanToJSON(span); + const { start_timestamp: startTimestamp } = spanJSON; + if (!startTimestamp) { + return; + } + const attributes = spanJSON.data || {}; + if (!attributes[SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON]) { + span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, _finishReason); + } + logger$2.log(`[Tracing] Idle span "${spanJSON.op}" finished`); + const childSpans = getSpanDescendants(span).filter((child) => child !== span); + let discardedSpans = 0; + childSpans.forEach((childSpan) => { + if (childSpan.isRecording()) { + childSpan.setStatus({ code: SPAN_STATUS_ERROR, message: "cancelled" }); + childSpan.end(endTimestamp); + DEBUG_BUILD$6 && logger$2.log("[Tracing] Cancelling span since span ended early", JSON.stringify(childSpan, void 0, 2)); + } + const childSpanJSON = spanToJSON(childSpan); + const { timestamp: childEndTimestamp = 0, start_timestamp: childStartTimestamp = 0 } = childSpanJSON; + const spanStartedBeforeIdleSpanEnd = childStartTimestamp <= endTimestamp; + const timeoutWithMarginOfError = (finalTimeout + idleTimeout) / 1e3; + const spanEndedBeforeFinalTimeout = childEndTimestamp - childStartTimestamp <= timeoutWithMarginOfError; + if (DEBUG_BUILD$6) { + const stringifiedSpan = JSON.stringify(childSpan, void 0, 2); + if (!spanStartedBeforeIdleSpanEnd) { + logger$2.log("[Tracing] Discarding span since it happened after idle span was finished", stringifiedSpan); + } else if (!spanEndedBeforeFinalTimeout) { + logger$2.log("[Tracing] Discarding span since it finished after idle span final timeout", stringifiedSpan); + } + } + if (!spanEndedBeforeFinalTimeout || !spanStartedBeforeIdleSpanEnd) { + removeChildSpanFromSpan(span, childSpan); + discardedSpans++; + } + }); + if (discardedSpans > 0) { + span.setAttribute("sentry.idle_span_discarded_spans", discardedSpans); + } + } + __name(onIdleSpanEnded, "onIdleSpanEnded"); + _cleanupHooks.push( + client.on("spanStart", (startedSpan) => { + if (_finished || startedSpan === span || !!spanToJSON(startedSpan).timestamp) { + return; + } + const allSpans = getSpanDescendants(span); + if (allSpans.includes(startedSpan)) { + _pushActivity(startedSpan.spanContext().spanId); + } + }) + ); + _cleanupHooks.push( + client.on("spanEnd", (endedSpan) => { + if (_finished) { + return; + } + _popActivity(endedSpan.spanContext().spanId); + }) + ); + _cleanupHooks.push( + client.on("idleSpanEnableAutoFinish", (spanToAllowAutoFinish) => { + if (spanToAllowAutoFinish === span) { + _autoFinishAllowed = true; + _restartIdleTimeout(); + if (activities.size) { + _restartChildSpanTimeout(); + } + } + }) + ); + if (!options4.disableAutoFinish) { + _restartIdleTimeout(); + } + setTimeout(() => { + if (!_finished) { + span.setStatus({ code: SPAN_STATUS_ERROR, message: "deadline_exceeded" }); + _finishReason = FINISH_REASON_FINAL_TIMEOUT; + span.end(); + } + }, finalTimeout); + return span; +} +__name(startIdleSpan, "startIdleSpan"); +function _startIdleSpan(options4) { + const span = startInactiveSpan(options4); + _setSpanForScope(getCurrentScope$1(), span); + DEBUG_BUILD$6 && logger$2.log("[Tracing] Started span is an idle span"); + return span; +} +__name(_startIdleSpan, "_startIdleSpan"); +function notifyEventProcessors(processors, event, hint, index2 = 0) { + return new SyncPromise((resolve2, reject3) => { + const processor = processors[index2]; + if (event === null || typeof processor !== "function") { + resolve2(event); + } else { + const result = processor({ ...event }, hint); + DEBUG_BUILD$6 && processor.id && result === null && logger$2.log(`Event processor "${processor.id}" dropped event`); + if (isThenable$1(result)) { + void result.then((final) => notifyEventProcessors(processors, final, hint, index2 + 1).then(resolve2)).then(null, reject3); + } else { + void notifyEventProcessors(processors, result, hint, index2 + 1).then(resolve2).then(null, reject3); + } + } + }); +} +__name(notifyEventProcessors, "notifyEventProcessors"); +let parsedStackResults; +let lastKeysCount; +let cachedFilenameDebugIds; +function getFilenameToDebugIdMap(stackParser) { + const debugIdMap = GLOBAL_OBJ._sentryDebugIds; + if (!debugIdMap) { + return {}; + } + const debugIdKeys = Object.keys(debugIdMap); + if (cachedFilenameDebugIds && debugIdKeys.length === lastKeysCount) { + return cachedFilenameDebugIds; + } + lastKeysCount = debugIdKeys.length; + cachedFilenameDebugIds = debugIdKeys.reduce((acc, stackKey) => { + if (!parsedStackResults) { + parsedStackResults = {}; + } + const result = parsedStackResults[stackKey]; + if (result) { + acc[result[0]] = result[1]; + } else { + const parsedStack = stackParser(stackKey); + for (let i2 = parsedStack.length - 1; i2 >= 0; i2--) { + const stackFrame = parsedStack[i2]; + const filename = stackFrame && stackFrame.filename; + const debugId = debugIdMap[stackKey]; + if (filename && debugId) { + acc[filename] = debugId; + parsedStackResults[stackKey] = [filename, debugId]; + break; + } + } + } + return acc; + }, {}); + return cachedFilenameDebugIds; +} +__name(getFilenameToDebugIdMap, "getFilenameToDebugIdMap"); +function getDebugImagesForResources(stackParser, resource_paths) { + const filenameDebugIdMap = getFilenameToDebugIdMap(stackParser); + if (!filenameDebugIdMap) { + return []; + } + const images = []; + for (const path of resource_paths) { + if (path && filenameDebugIdMap[path]) { + images.push({ + type: "sourcemap", + code_file: path, + debug_id: filenameDebugIdMap[path] + }); + } + } + return images; +} +__name(getDebugImagesForResources, "getDebugImagesForResources"); +function applyScopeDataToEvent(event, data25) { + const { fingerprint, span, breadcrumbs, sdkProcessingMetadata } = data25; + applyDataToEvent(event, data25); + if (span) { + applySpanToEvent(event, span); + } + applyFingerprintToEvent(event, fingerprint); + applyBreadcrumbsToEvent(event, breadcrumbs); + applySdkMetadataToEvent(event, sdkProcessingMetadata); +} +__name(applyScopeDataToEvent, "applyScopeDataToEvent"); +function mergeScopeData(data25, mergeData) { + const { + extra, + tags, + user, + contexts, + level, + sdkProcessingMetadata, + breadcrumbs, + fingerprint, + eventProcessors, + attachments, + propagationContext, + transactionName, + span + } = mergeData; + mergeAndOverwriteScopeData(data25, "extra", extra); + mergeAndOverwriteScopeData(data25, "tags", tags); + mergeAndOverwriteScopeData(data25, "user", user); + mergeAndOverwriteScopeData(data25, "contexts", contexts); + data25.sdkProcessingMetadata = merge$1(data25.sdkProcessingMetadata, sdkProcessingMetadata, 2); + if (level) { + data25.level = level; + } + if (transactionName) { + data25.transactionName = transactionName; + } + if (span) { + data25.span = span; + } + if (breadcrumbs.length) { + data25.breadcrumbs = [...data25.breadcrumbs, ...breadcrumbs]; + } + if (fingerprint.length) { + data25.fingerprint = [...data25.fingerprint, ...fingerprint]; + } + if (eventProcessors.length) { + data25.eventProcessors = [...data25.eventProcessors, ...eventProcessors]; + } + if (attachments.length) { + data25.attachments = [...data25.attachments, ...attachments]; + } + data25.propagationContext = { ...data25.propagationContext, ...propagationContext }; +} +__name(mergeScopeData, "mergeScopeData"); +function mergeAndOverwriteScopeData(data25, prop2, mergeVal) { + data25[prop2] = merge$1(data25[prop2], mergeVal, 1); +} +__name(mergeAndOverwriteScopeData, "mergeAndOverwriteScopeData"); +function applyDataToEvent(event, data25) { + const { extra, tags, user, contexts, level, transactionName } = data25; + const cleanedExtra = dropUndefinedKeys(extra); + if (cleanedExtra && Object.keys(cleanedExtra).length) { + event.extra = { ...cleanedExtra, ...event.extra }; + } + const cleanedTags = dropUndefinedKeys(tags); + if (cleanedTags && Object.keys(cleanedTags).length) { + event.tags = { ...cleanedTags, ...event.tags }; + } + const cleanedUser = dropUndefinedKeys(user); + if (cleanedUser && Object.keys(cleanedUser).length) { + event.user = { ...cleanedUser, ...event.user }; + } + const cleanedContexts = dropUndefinedKeys(contexts); + if (cleanedContexts && Object.keys(cleanedContexts).length) { + event.contexts = { ...cleanedContexts, ...event.contexts }; + } + if (level) { + event.level = level; + } + if (transactionName && event.type !== "transaction") { + event.transaction = transactionName; + } +} +__name(applyDataToEvent, "applyDataToEvent"); +function applyBreadcrumbsToEvent(event, breadcrumbs) { + const mergedBreadcrumbs = [...event.breadcrumbs || [], ...breadcrumbs]; + event.breadcrumbs = mergedBreadcrumbs.length ? mergedBreadcrumbs : void 0; +} +__name(applyBreadcrumbsToEvent, "applyBreadcrumbsToEvent"); +function applySdkMetadataToEvent(event, sdkProcessingMetadata) { + event.sdkProcessingMetadata = { + ...event.sdkProcessingMetadata, + ...sdkProcessingMetadata + }; +} +__name(applySdkMetadataToEvent, "applySdkMetadataToEvent"); +function applySpanToEvent(event, span) { + event.contexts = { + trace: spanToTraceContext(span), + ...event.contexts + }; + event.sdkProcessingMetadata = { + dynamicSamplingContext: getDynamicSamplingContextFromSpan(span), + ...event.sdkProcessingMetadata + }; + const rootSpan = getRootSpan(span); + const transactionName = spanToJSON(rootSpan).description; + if (transactionName && !event.transaction && event.type === "transaction") { + event.transaction = transactionName; + } +} +__name(applySpanToEvent, "applySpanToEvent"); +function applyFingerprintToEvent(event, fingerprint) { + event.fingerprint = event.fingerprint ? Array.isArray(event.fingerprint) ? event.fingerprint : [event.fingerprint] : []; + if (fingerprint) { + event.fingerprint = event.fingerprint.concat(fingerprint); + } + if (event.fingerprint && !event.fingerprint.length) { + delete event.fingerprint; + } +} +__name(applyFingerprintToEvent, "applyFingerprintToEvent"); +function prepareEvent(options4, event, hint, scope, client, isolationScope) { + const { normalizeDepth = 3, normalizeMaxBreadth = 1e3 } = options4; + const prepared = { + ...event, + event_id: event.event_id || hint.event_id || uuid4(), + timestamp: event.timestamp || dateTimestampInSeconds() + }; + const integrations = hint.integrations || options4.integrations.map((i2) => i2.name); + applyClientOptions(prepared, options4); + applyIntegrationsMetadata(prepared, integrations); + if (client) { + client.emit("applyFrameMetadata", event); + } + if (event.type === void 0) { + applyDebugIds(prepared, options4.stackParser); + } + const finalScope = getFinalScope(scope, hint.captureContext); + if (hint.mechanism) { + addExceptionMechanism(prepared, hint.mechanism); + } + const clientEventProcessors = client ? client.getEventProcessors() : []; + const data25 = getGlobalScope().getScopeData(); + if (isolationScope) { + const isolationData = isolationScope.getScopeData(); + mergeScopeData(data25, isolationData); + } + if (finalScope) { + const finalScopeData = finalScope.getScopeData(); + mergeScopeData(data25, finalScopeData); + } + const attachments = [...hint.attachments || [], ...data25.attachments]; + if (attachments.length) { + hint.attachments = attachments; + } + applyScopeDataToEvent(prepared, data25); + const eventProcessors = [ + ...clientEventProcessors, + // Run scope event processors _after_ all other processors + ...data25.eventProcessors + ]; + const result = notifyEventProcessors(eventProcessors, prepared, hint); + return result.then((evt) => { + if (evt) { + applyDebugMeta(evt); + } + if (typeof normalizeDepth === "number" && normalizeDepth > 0) { + return normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth); + } + return evt; + }); +} +__name(prepareEvent, "prepareEvent"); +function applyClientOptions(event, options4) { + const { environment, release, dist: dist3, maxValueLength = 250 } = options4; + event.environment = event.environment || environment || DEFAULT_ENVIRONMENT; + if (!event.release && release) { + event.release = release; + } + if (!event.dist && dist3) { + event.dist = dist3; + } + if (event.message) { + event.message = truncate(event.message, maxValueLength); + } + const exception = event.exception && event.exception.values && event.exception.values[0]; + if (exception && exception.value) { + exception.value = truncate(exception.value, maxValueLength); + } + const request = event.request; + if (request && request.url) { + request.url = truncate(request.url, maxValueLength); + } +} +__name(applyClientOptions, "applyClientOptions"); +function applyDebugIds(event, stackParser) { + const filenameDebugIdMap = getFilenameToDebugIdMap(stackParser); + try { + event.exception.values.forEach((exception) => { + exception.stacktrace.frames.forEach((frame) => { + if (filenameDebugIdMap && frame.filename) { + frame.debug_id = filenameDebugIdMap[frame.filename]; + } + }); + }); + } catch (e2) { + } +} +__name(applyDebugIds, "applyDebugIds"); +function applyDebugMeta(event) { + const filenameDebugIdMap = {}; + try { + event.exception.values.forEach((exception) => { + exception.stacktrace.frames.forEach((frame) => { + if (frame.debug_id) { + if (frame.abs_path) { + filenameDebugIdMap[frame.abs_path] = frame.debug_id; + } else if (frame.filename) { + filenameDebugIdMap[frame.filename] = frame.debug_id; + } + delete frame.debug_id; + } + }); + }); + } catch (e2) { + } + if (Object.keys(filenameDebugIdMap).length === 0) { + return; + } + event.debug_meta = event.debug_meta || {}; + event.debug_meta.images = event.debug_meta.images || []; + const images = event.debug_meta.images; + Object.entries(filenameDebugIdMap).forEach(([filename, debug_id]) => { + images.push({ + type: "sourcemap", + code_file: filename, + debug_id + }); + }); +} +__name(applyDebugMeta, "applyDebugMeta"); +function applyIntegrationsMetadata(event, integrationNames) { + if (integrationNames.length > 0) { + event.sdk = event.sdk || {}; + event.sdk.integrations = [...event.sdk.integrations || [], ...integrationNames]; + } +} +__name(applyIntegrationsMetadata, "applyIntegrationsMetadata"); +function normalizeEvent(event, depth, maxBreadth) { + if (!event) { + return null; + } + const normalized = { + ...event, + ...event.breadcrumbs && { + breadcrumbs: event.breadcrumbs.map((b2) => ({ + ...b2, + ...b2.data && { + data: normalize$2(b2.data, depth, maxBreadth) + } + })) + }, + ...event.user && { + user: normalize$2(event.user, depth, maxBreadth) + }, + ...event.contexts && { + contexts: normalize$2(event.contexts, depth, maxBreadth) + }, + ...event.extra && { + extra: normalize$2(event.extra, depth, maxBreadth) + } + }; + if (event.contexts && event.contexts.trace && normalized.contexts) { + normalized.contexts.trace = event.contexts.trace; + if (event.contexts.trace.data) { + normalized.contexts.trace.data = normalize$2(event.contexts.trace.data, depth, maxBreadth); + } + } + if (event.spans) { + normalized.spans = event.spans.map((span) => { + return { + ...span, + ...span.data && { + data: normalize$2(span.data, depth, maxBreadth) + } + }; + }); + } + if (event.contexts && event.contexts.flags && normalized.contexts) { + normalized.contexts.flags = normalize$2(event.contexts.flags, 3, maxBreadth); + } + return normalized; +} +__name(normalizeEvent, "normalizeEvent"); +function getFinalScope(scope, captureContext) { + if (!captureContext) { + return scope; + } + const finalScope = scope ? scope.clone() : new Scope(); + finalScope.update(captureContext); + return finalScope; +} +__name(getFinalScope, "getFinalScope"); +function parseEventHintOrCaptureContext(hint) { + if (!hint) { + return void 0; + } + if (hintIsScopeOrFunction(hint)) { + return { captureContext: hint }; + } + if (hintIsScopeContext(hint)) { + return { + captureContext: hint + }; + } + return hint; +} +__name(parseEventHintOrCaptureContext, "parseEventHintOrCaptureContext"); +function hintIsScopeOrFunction(hint) { + return hint instanceof Scope || typeof hint === "function"; +} +__name(hintIsScopeOrFunction, "hintIsScopeOrFunction"); +const captureContextKeys = [ + "user", + "level", + "extra", + "contexts", + "tags", + "fingerprint", + "requestSession", + "propagationContext" +]; +function hintIsScopeContext(hint) { + return Object.keys(hint).some((key) => captureContextKeys.includes(key)); +} +__name(hintIsScopeContext, "hintIsScopeContext"); +function captureException(exception, hint) { + return getCurrentScope$1().captureException(exception, parseEventHintOrCaptureContext(hint)); +} +__name(captureException, "captureException"); +function captureMessage(message3, captureContext) { + const level = typeof captureContext === "string" ? captureContext : void 0; + const context = typeof captureContext !== "string" ? { captureContext } : void 0; + return getCurrentScope$1().captureMessage(message3, level, context); +} +__name(captureMessage, "captureMessage"); +function captureEvent(event, hint) { + return getCurrentScope$1().captureEvent(event, hint); +} +__name(captureEvent, "captureEvent"); +function setContext(name2, context) { + getIsolationScope().setContext(name2, context); +} +__name(setContext, "setContext"); +function setExtras(extras) { + getIsolationScope().setExtras(extras); +} +__name(setExtras, "setExtras"); +function setExtra(key, extra) { + getIsolationScope().setExtra(key, extra); +} +__name(setExtra, "setExtra"); +function setTags(tags) { + getIsolationScope().setTags(tags); +} +__name(setTags, "setTags"); +function setTag$5(key, value4) { + getIsolationScope().setTag(key, value4); +} +__name(setTag$5, "setTag$5"); +function setUser(user) { + getIsolationScope().setUser(user); +} +__name(setUser, "setUser"); +function lastEventId() { + return getIsolationScope().lastEventId(); +} +__name(lastEventId, "lastEventId"); +function captureCheckIn(checkIn, upsertMonitorConfig) { + const scope = getCurrentScope$1(); + const client = getClient(); + if (!client) { + DEBUG_BUILD$6 && logger$2.warn("Cannot capture check-in. No client defined."); + } else if (!client.captureCheckIn) { + DEBUG_BUILD$6 && logger$2.warn("Cannot capture check-in. Client does not support sending check-ins."); + } else { + return client.captureCheckIn(checkIn, upsertMonitorConfig, scope); + } + return uuid4(); +} +__name(captureCheckIn, "captureCheckIn"); +function withMonitor(monitorSlug, callback, upsertMonitorConfig) { + const checkInId = captureCheckIn({ monitorSlug, status: "in_progress" }, upsertMonitorConfig); + const now2 = timestampInSeconds(); + function finishCheckIn(status) { + captureCheckIn({ monitorSlug, status, checkInId, duration: timestampInSeconds() - now2 }); + } + __name(finishCheckIn, "finishCheckIn"); + return withIsolationScope(() => { + let maybePromiseResult; + try { + maybePromiseResult = callback(); + } catch (e2) { + finishCheckIn("error"); + throw e2; + } + if (isThenable$1(maybePromiseResult)) { + Promise.resolve(maybePromiseResult).then( + () => { + finishCheckIn("ok"); + }, + (e2) => { + finishCheckIn("error"); + throw e2; + } + ); + } else { + finishCheckIn("ok"); + } + return maybePromiseResult; + }); +} +__name(withMonitor, "withMonitor"); +async function flush(timeout) { + const client = getClient(); + if (client) { + return client.flush(timeout); + } + DEBUG_BUILD$6 && logger$2.warn("Cannot flush events. No client defined."); + return Promise.resolve(false); +} +__name(flush, "flush"); +async function close$1(timeout) { + const client = getClient(); + if (client) { + return client.close(timeout); + } + DEBUG_BUILD$6 && logger$2.warn("Cannot flush events and disable SDK. No client defined."); + return Promise.resolve(false); +} +__name(close$1, "close$1"); +function isInitialized() { + return !!getClient(); +} +__name(isInitialized, "isInitialized"); +function isEnabled() { + const client = getClient(); + return !!client && client.getOptions().enabled !== false && !!client.getTransport(); +} +__name(isEnabled, "isEnabled"); +function addEventProcessor(callback) { + getIsolationScope().addEventProcessor(callback); +} +__name(addEventProcessor, "addEventProcessor"); +function startSession(context) { + const client = getClient(); + const isolationScope = getIsolationScope(); + const currentScope = getCurrentScope$1(); + const { release, environment = DEFAULT_ENVIRONMENT } = client && client.getOptions() || {}; + const { userAgent } = GLOBAL_OBJ.navigator || {}; + const session = makeSession$1({ + release, + environment, + user: currentScope.getUser() || isolationScope.getUser(), + ...userAgent && { userAgent }, + ...context + }); + const currentSession = isolationScope.getSession(); + if (currentSession && currentSession.status === "ok") { + updateSession(currentSession, { status: "exited" }); + } + endSession(); + isolationScope.setSession(session); + currentScope.setSession(session); + return session; +} +__name(startSession, "startSession"); +function endSession() { + const isolationScope = getIsolationScope(); + const currentScope = getCurrentScope$1(); + const session = currentScope.getSession() || isolationScope.getSession(); + if (session) { + closeSession(session); + } + _sendSessionUpdate$1(); + isolationScope.setSession(); + currentScope.setSession(); +} +__name(endSession, "endSession"); +function _sendSessionUpdate$1() { + const isolationScope = getIsolationScope(); + const currentScope = getCurrentScope$1(); + const client = getClient(); + const session = currentScope.getSession() || isolationScope.getSession(); + if (session && client) { + client.captureSession(session); + } +} +__name(_sendSessionUpdate$1, "_sendSessionUpdate$1"); +function captureSession(end = false) { + if (end) { + endSession(); + return; + } + _sendSessionUpdate$1(); +} +__name(captureSession, "captureSession"); +class SessionFlusher { + static { + __name(this, "SessionFlusher"); + } + // We adjust the type here to add the `unref()` part, as setInterval can technically return a number or a NodeJS.Timer + constructor(client, attrs4) { + this._client = client; + this.flushTimeout = 60; + this._pendingAggregates = /* @__PURE__ */ new Map(); + this._isEnabled = true; + this._intervalId = setInterval(() => this.flush(), this.flushTimeout * 1e3); + if (this._intervalId.unref) { + this._intervalId.unref(); + } + this._sessionAttrs = attrs4; + } + /** Checks if `pendingAggregates` has entries, and if it does flushes them by calling `sendSession` */ + flush() { + const sessionAggregates = this.getSessionAggregates(); + if (sessionAggregates.aggregates.length === 0) { + return; + } + this._pendingAggregates = /* @__PURE__ */ new Map(); + this._client.sendSession(sessionAggregates); + } + /** Massages the entries in `pendingAggregates` and returns aggregated sessions */ + getSessionAggregates() { + const aggregates = Array.from(this._pendingAggregates.values()); + const sessionAggregates = { + attrs: this._sessionAttrs, + aggregates + }; + return dropUndefinedKeys(sessionAggregates); + } + /** JSDoc */ + close() { + clearInterval(this._intervalId); + this._isEnabled = false; + this.flush(); + } + /** + * Wrapper function for _incrementSessionStatusCount that checks if the instance of SessionFlusher is enabled then + * fetches the session status of the request from `Scope.getRequestSession().status` on the scope and passes them to + * `_incrementSessionStatusCount` along with the start date + */ + incrementSessionStatusCount() { + if (!this._isEnabled) { + return; + } + const isolationScope = getIsolationScope(); + const requestSession = isolationScope.getRequestSession(); + if (requestSession && requestSession.status) { + this._incrementSessionStatusCount(requestSession.status, /* @__PURE__ */ new Date()); + isolationScope.setRequestSession(void 0); + } + } + /** + * Increments status bucket in pendingAggregates buffer (internal state) corresponding to status of + * the session received + */ + // eslint-disable-next-line deprecation/deprecation + _incrementSessionStatusCount(status, date) { + const sessionStartedTrunc = new Date(date).setSeconds(0, 0); + let aggregationCounts = this._pendingAggregates.get(sessionStartedTrunc); + if (!aggregationCounts) { + aggregationCounts = { started: new Date(sessionStartedTrunc).toISOString() }; + this._pendingAggregates.set(sessionStartedTrunc, aggregationCounts); + } + switch (status) { + case "errored": + aggregationCounts.errored = (aggregationCounts.errored || 0) + 1; + return aggregationCounts.errored; + case "ok": + aggregationCounts.exited = (aggregationCounts.exited || 0) + 1; + return aggregationCounts.exited; + default: + aggregationCounts.crashed = (aggregationCounts.crashed || 0) + 1; + return aggregationCounts.crashed; + } + } +} +const SENTRY_API_VERSION = "7"; +function getBaseApiEndpoint(dsn) { + const protocol = dsn.protocol ? `${dsn.protocol}:` : ""; + const port = dsn.port ? `:${dsn.port}` : ""; + return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ""}/api/`; +} +__name(getBaseApiEndpoint, "getBaseApiEndpoint"); +function _getIngestEndpoint(dsn) { + return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`; +} +__name(_getIngestEndpoint, "_getIngestEndpoint"); +function _encodedAuth(dsn, sdkInfo) { + const params = { + sentry_version: SENTRY_API_VERSION + }; + if (dsn.publicKey) { + params.sentry_key = dsn.publicKey; + } + if (sdkInfo) { + params.sentry_client = `${sdkInfo.name}/${sdkInfo.version}`; + } + return new URLSearchParams(params).toString(); +} +__name(_encodedAuth, "_encodedAuth"); +function getEnvelopeEndpointWithUrlEncodedAuth(dsn, tunnel, sdkInfo) { + return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`; +} +__name(getEnvelopeEndpointWithUrlEncodedAuth, "getEnvelopeEndpointWithUrlEncodedAuth"); +function getReportDialogEndpoint(dsnLike, dialogOptions) { + const dsn = makeDsn(dsnLike); + if (!dsn) { + return ""; + } + const endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`; + let encodedOptions = `dsn=${dsnToString(dsn)}`; + for (const key in dialogOptions) { + if (key === "dsn") { + continue; + } + if (key === "onClose") { + continue; + } + if (key === "user") { + const user = dialogOptions.user; + if (!user) { + continue; + } + if (user.name) { + encodedOptions += `&name=${encodeURIComponent(user.name)}`; + } + if (user.email) { + encodedOptions += `&email=${encodeURIComponent(user.email)}`; + } + } else { + encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key])}`; + } + } + return `${endpoint}?${encodedOptions}`; +} +__name(getReportDialogEndpoint, "getReportDialogEndpoint"); +const installedIntegrations = []; +function filterDuplicates(integrations) { + const integrationsByName = {}; + integrations.forEach((currentInstance2) => { + const { name: name2 } = currentInstance2; + const existingInstance = integrationsByName[name2]; + if (existingInstance && !existingInstance.isDefaultInstance && currentInstance2.isDefaultInstance) { + return; + } + integrationsByName[name2] = currentInstance2; + }); + return Object.values(integrationsByName); +} +__name(filterDuplicates, "filterDuplicates"); +function getIntegrationsToSetup(options4) { + const defaultIntegrations = options4.defaultIntegrations || []; + const userIntegrations = options4.integrations; + defaultIntegrations.forEach((integration) => { + integration.isDefaultInstance = true; + }); + let integrations; + if (Array.isArray(userIntegrations)) { + integrations = [...defaultIntegrations, ...userIntegrations]; + } else if (typeof userIntegrations === "function") { + const resolvedUserIntegrations = userIntegrations(defaultIntegrations); + integrations = Array.isArray(resolvedUserIntegrations) ? resolvedUserIntegrations : [resolvedUserIntegrations]; + } else { + integrations = defaultIntegrations; + } + const finalIntegrations = filterDuplicates(integrations); + const debugIndex = finalIntegrations.findIndex((integration) => integration.name === "Debug"); + if (debugIndex > -1) { + const [debugInstance] = finalIntegrations.splice(debugIndex, 1); + finalIntegrations.push(debugInstance); + } + return finalIntegrations; +} +__name(getIntegrationsToSetup, "getIntegrationsToSetup"); +function setupIntegrations(client, integrations) { + const integrationIndex = {}; + integrations.forEach((integration) => { + if (integration) { + setupIntegration(client, integration, integrationIndex); + } + }); + return integrationIndex; +} +__name(setupIntegrations, "setupIntegrations"); +function afterSetupIntegrations(client, integrations) { + for (const integration of integrations) { + if (integration && integration.afterAllSetup) { + integration.afterAllSetup(client); + } + } +} +__name(afterSetupIntegrations, "afterSetupIntegrations"); +function setupIntegration(client, integration, integrationIndex) { + if (integrationIndex[integration.name]) { + DEBUG_BUILD$6 && logger$2.log(`Integration skipped because it was already installed: ${integration.name}`); + return; + } + integrationIndex[integration.name] = integration; + if (installedIntegrations.indexOf(integration.name) === -1 && typeof integration.setupOnce === "function") { + integration.setupOnce(); + installedIntegrations.push(integration.name); + } + if (integration.setup && typeof integration.setup === "function") { + integration.setup(client); + } + if (typeof integration.preprocessEvent === "function") { + const callback = integration.preprocessEvent.bind(integration); + client.on("preprocessEvent", (event, hint) => callback(event, hint, client)); + } + if (typeof integration.processEvent === "function") { + const callback = integration.processEvent.bind(integration); + const processor = Object.assign((event, hint) => callback(event, hint, client), { + id: integration.name + }); + client.addEventProcessor(processor); + } + DEBUG_BUILD$6 && logger$2.log(`Integration installed: ${integration.name}`); +} +__name(setupIntegration, "setupIntegration"); +function addIntegration(integration) { + const client = getClient(); + if (!client) { + DEBUG_BUILD$6 && logger$2.warn(`Cannot add integration "${integration.name}" because no SDK Client is available.`); + return; + } + client.addIntegration(integration); +} +__name(addIntegration, "addIntegration"); +function defineIntegration(fn) { + return fn; +} +__name(defineIntegration, "defineIntegration"); +function createClientReportEnvelope(discarded_events, dsn, timestamp2) { + const clientReportItem = [ + { type: "client_report" }, + { + timestamp: timestamp2 || dateTimestampInSeconds(), + discarded_events + } + ]; + return createEnvelope(dsn ? { dsn } : {}, [clientReportItem]); +} +__name(createClientReportEnvelope, "createClientReportEnvelope"); +class SentryError extends Error { + static { + __name(this, "SentryError"); + } + /** Display name of this error instance. */ + constructor(message3, logLevel = "warn") { + super(message3); + this.message = message3; + this.name = new.target.prototype.constructor.name; + Object.setPrototypeOf(this, new.target.prototype); + this.logLevel = logLevel; + } +} +const ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured."; +class BaseClient { + static { + __name(this, "BaseClient"); + } + /** Options passed to the SDK. */ + /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */ + /** Array of set up integrations. */ + /** Number of calls being processed */ + /** Holds flushable */ + // eslint-disable-next-line @typescript-eslint/ban-types + /** + * Initializes this client instance. + * + * @param options Options for the client. + */ + constructor(options4) { + this._options = options4; + this._integrations = {}; + this._numProcessing = 0; + this._outcomes = {}; + this._hooks = {}; + this._eventProcessors = []; + if (options4.dsn) { + this._dsn = makeDsn(options4.dsn); + } else { + DEBUG_BUILD$6 && logger$2.warn("No DSN provided, client will not send events."); + } + if (this._dsn) { + const url = getEnvelopeEndpointWithUrlEncodedAuth( + this._dsn, + options4.tunnel, + options4._metadata ? options4._metadata.sdk : void 0 + ); + this._transport = options4.transport({ + tunnel: this._options.tunnel, + recordDroppedEvent: this.recordDroppedEvent.bind(this), + ...options4.transportOptions, + url + }); + } + const tracingOptions = ["enableTracing", "tracesSampleRate", "tracesSampler"]; + const undefinedOption = tracingOptions.find((option3) => option3 in options4 && options4[option3] == void 0); + if (undefinedOption) { + consoleSandbox(() => { + console.warn( + `[Sentry] Deprecation warning: \`${undefinedOption}\` is set to undefined, which leads to tracing being enabled. In v9, a value of \`undefined\` will result in tracing being disabled.` + ); + }); + } + } + /** + * @inheritDoc + */ + captureException(exception, hint, scope) { + const eventId = uuid4(); + if (checkOrSetAlreadyCaught(exception)) { + DEBUG_BUILD$6 && logger$2.log(ALREADY_SEEN_ERROR); + return eventId; + } + const hintWithEventId = { + event_id: eventId, + ...hint + }; + this._process( + this.eventFromException(exception, hintWithEventId).then( + (event) => this._captureEvent(event, hintWithEventId, scope) + ) + ); + return hintWithEventId.event_id; + } + /** + * @inheritDoc + */ + captureMessage(message3, level, hint, currentScope) { + const hintWithEventId = { + event_id: uuid4(), + ...hint + }; + const eventMessage = isParameterizedString(message3) ? message3 : String(message3); + const promisedEvent = isPrimitive(message3) ? this.eventFromMessage(eventMessage, level, hintWithEventId) : this.eventFromException(message3, hintWithEventId); + this._process(promisedEvent.then((event) => this._captureEvent(event, hintWithEventId, currentScope))); + return hintWithEventId.event_id; + } + /** + * @inheritDoc + */ + captureEvent(event, hint, currentScope) { + const eventId = uuid4(); + if (hint && hint.originalException && checkOrSetAlreadyCaught(hint.originalException)) { + DEBUG_BUILD$6 && logger$2.log(ALREADY_SEEN_ERROR); + return eventId; + } + const hintWithEventId = { + event_id: eventId, + ...hint + }; + const sdkProcessingMetadata = event.sdkProcessingMetadata || {}; + const capturedSpanScope = sdkProcessingMetadata.capturedSpanScope; + this._process(this._captureEvent(event, hintWithEventId, capturedSpanScope || currentScope)); + return hintWithEventId.event_id; + } + /** + * @inheritDoc + */ + captureSession(session) { + if (!(typeof session.release === "string")) { + DEBUG_BUILD$6 && logger$2.warn("Discarded session because of missing or non-string release"); + } else { + this.sendSession(session); + updateSession(session, { init: false }); + } + } + /** + * @inheritDoc + */ + getDsn() { + return this._dsn; + } + /** + * @inheritDoc + */ + getOptions() { + return this._options; + } + /** + * @see SdkMetadata + * + * @return The metadata of the SDK + */ + getSdkMetadata() { + return this._options._metadata; + } + /** + * @inheritDoc + */ + getTransport() { + return this._transport; + } + /** + * @inheritDoc + */ + flush(timeout) { + const transport = this._transport; + if (transport) { + this.emit("flush"); + return this._isClientDoneProcessing(timeout).then((clientFinished) => { + return transport.flush(timeout).then((transportFlushed) => clientFinished && transportFlushed); + }); + } else { + return resolvedSyncPromise(true); + } + } + /** + * @inheritDoc + */ + close(timeout) { + return this.flush(timeout).then((result) => { + this.getOptions().enabled = false; + this.emit("close"); + return result; + }); + } + /** Get all installed event processors. */ + getEventProcessors() { + return this._eventProcessors; + } + /** @inheritDoc */ + addEventProcessor(eventProcessor) { + this._eventProcessors.push(eventProcessor); + } + /** @inheritdoc */ + init() { + if (this._isEnabled() || // Force integrations to be setup even if no DSN was set when we have + // Spotlight enabled. This is particularly important for browser as we + // don't support the `spotlight` option there and rely on the users + // adding the `spotlightBrowserIntegration()` to their integrations which + // wouldn't get initialized with the check below when there's no DSN set. + this._options.integrations.some(({ name: name2 }) => name2.startsWith("Spotlight"))) { + this._setupIntegrations(); + } + } + /** + * Gets an installed integration by its name. + * + * @returns The installed integration or `undefined` if no integration with that `name` was installed. + */ + getIntegrationByName(integrationName) { + return this._integrations[integrationName]; + } + /** + * @inheritDoc + */ + addIntegration(integration) { + const isAlreadyInstalled = this._integrations[integration.name]; + setupIntegration(this, integration, this._integrations); + if (!isAlreadyInstalled) { + afterSetupIntegrations(this, [integration]); + } + } + /** + * @inheritDoc + */ + sendEvent(event, hint = {}) { + this.emit("beforeSendEvent", event, hint); + let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel); + for (const attachment of hint.attachments || []) { + env = addItemToEnvelope(env, createAttachmentEnvelopeItem(attachment)); + } + const promise = this.sendEnvelope(env); + if (promise) { + promise.then((sendResponse) => this.emit("afterSendEvent", event, sendResponse), null); + } + } + /** + * @inheritDoc + */ + sendSession(session) { + const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel); + this.sendEnvelope(env); + } + /** + * @inheritDoc + */ + recordDroppedEvent(reason, category, eventOrCount) { + if (this._options.sendClientReports) { + const count = typeof eventOrCount === "number" ? eventOrCount : 1; + const key = `${reason}:${category}`; + DEBUG_BUILD$6 && logger$2.log(`Recording outcome: "${key}"${count > 1 ? ` (${count} times)` : ""}`); + this._outcomes[key] = (this._outcomes[key] || 0) + count; + } + } + // Keep on() & emit() signatures in sync with types' client.ts interface + /* eslint-disable @typescript-eslint/unified-signatures */ + /** @inheritdoc */ + /** @inheritdoc */ + on(hook, callback) { + const hooks2 = this._hooks[hook] = this._hooks[hook] || []; + hooks2.push(callback); + return () => { + const cbIndex = hooks2.indexOf(callback); + if (cbIndex > -1) { + hooks2.splice(cbIndex, 1); + } + }; + } + /** @inheritdoc */ + /** @inheritdoc */ + emit(hook, ...rest) { + const callbacks = this._hooks[hook]; + if (callbacks) { + callbacks.forEach((callback) => callback(...rest)); + } + } + /** + * @inheritdoc + */ + sendEnvelope(envelope) { + this.emit("beforeEnvelope", envelope); + if (this._isEnabled() && this._transport) { + return this._transport.send(envelope).then(null, (reason) => { + DEBUG_BUILD$6 && logger$2.error("Error while sending envelope:", reason); + return reason; + }); + } + DEBUG_BUILD$6 && logger$2.error("Transport disabled"); + return resolvedSyncPromise({}); + } + /* eslint-enable @typescript-eslint/unified-signatures */ + /** Setup integrations for this client. */ + _setupIntegrations() { + const { integrations } = this._options; + this._integrations = setupIntegrations(this, integrations); + afterSetupIntegrations(this, integrations); + } + /** Updates existing session based on the provided event */ + _updateSessionFromEvent(session, event) { + let crashed = false; + let errored = false; + const exceptions = event.exception && event.exception.values; + if (exceptions) { + errored = true; + for (const ex of exceptions) { + const mechanism = ex.mechanism; + if (mechanism && mechanism.handled === false) { + crashed = true; + break; + } + } + } + const sessionNonTerminal = session.status === "ok"; + const shouldUpdateAndSend = sessionNonTerminal && session.errors === 0 || sessionNonTerminal && crashed; + if (shouldUpdateAndSend) { + updateSession(session, { + ...crashed && { status: "crashed" }, + errors: session.errors || Number(errored || crashed) + }); + this.captureSession(session); + } + } + /** + * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying + * "no" (resolving to `false`) in order to give the client a chance to potentially finish first. + * + * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not + * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to + * `true`. + * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and + * `false` otherwise + */ + _isClientDoneProcessing(timeout) { + return new SyncPromise((resolve2) => { + let ticked = 0; + const tick = 1; + const interval = setInterval(() => { + if (this._numProcessing == 0) { + clearInterval(interval); + resolve2(true); + } else { + ticked += tick; + if (timeout && ticked >= timeout) { + clearInterval(interval); + resolve2(false); + } + } + }, tick); + }); + } + /** Determines whether this SDK is enabled and a transport is present. */ + _isEnabled() { + return this.getOptions().enabled !== false && this._transport !== void 0; + } + /** + * Adds common information to events. + * + * The information includes release and environment from `options`, + * breadcrumbs and context (extra, tags and user) from the scope. + * + * Information that is already present in the event is never overwritten. For + * nested objects, such as the context, keys are merged. + * + * @param event The original event. + * @param hint May contain additional information about the original exception. + * @param currentScope A scope containing event metadata. + * @returns A new event with more information. + */ + _prepareEvent(event, hint, currentScope = getCurrentScope$1(), isolationScope = getIsolationScope()) { + const options4 = this.getOptions(); + const integrations = Object.keys(this._integrations); + if (!hint.integrations && integrations.length > 0) { + hint.integrations = integrations; + } + this.emit("preprocessEvent", event, hint); + if (!event.type) { + isolationScope.setLastEventId(event.event_id || hint.event_id); + } + return prepareEvent(options4, event, hint, currentScope, this, isolationScope).then((evt) => { + if (evt === null) { + return evt; + } + evt.contexts = { + trace: getTraceContextFromScope(currentScope), + ...evt.contexts + }; + const dynamicSamplingContext = getDynamicSamplingContextFromScope(this, currentScope); + evt.sdkProcessingMetadata = { + dynamicSamplingContext, + ...evt.sdkProcessingMetadata + }; + return evt; + }); + } + /** + * Processes the event and logs an error in case of rejection + * @param event + * @param hint + * @param scope + */ + _captureEvent(event, hint = {}, scope) { + return this._processEvent(event, hint, scope).then( + (finalEvent) => { + return finalEvent.event_id; + }, + (reason) => { + if (DEBUG_BUILD$6) { + const sentryError = reason; + if (sentryError.logLevel === "log") { + logger$2.log(sentryError.message); + } else { + logger$2.warn(sentryError); + } + } + return void 0; + } + ); + } + /** + * Processes an event (either error or message) and sends it to Sentry. + * + * This also adds breadcrumbs and context information to the event. However, + * platform specific meta data (such as the User's IP address) must be added + * by the SDK implementor. + * + * + * @param event The event to send to Sentry. + * @param hint May contain additional information about the original exception. + * @param currentScope A scope containing event metadata. + * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send. + */ + _processEvent(event, hint, currentScope) { + const options4 = this.getOptions(); + const { sampleRate } = options4; + const isTransaction = isTransactionEvent$1(event); + const isError2 = isErrorEvent$1(event); + const eventType = event.type || "error"; + const beforeSendLabel = `before send for type \`${eventType}\``; + const parsedSampleRate = typeof sampleRate === "undefined" ? void 0 : parseSampleRate(sampleRate); + if (isError2 && typeof parsedSampleRate === "number" && Math.random() > parsedSampleRate) { + this.recordDroppedEvent("sample_rate", "error", event); + return rejectedSyncPromise( + new SentryError( + `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`, + "log" + ) + ); + } + const dataCategory = eventType === "replay_event" ? "replay" : eventType; + const sdkProcessingMetadata = event.sdkProcessingMetadata || {}; + const capturedSpanIsolationScope = sdkProcessingMetadata.capturedSpanIsolationScope; + return this._prepareEvent(event, hint, currentScope, capturedSpanIsolationScope).then((prepared) => { + if (prepared === null) { + this.recordDroppedEvent("event_processor", dataCategory, event); + throw new SentryError("An event processor returned `null`, will not send event.", "log"); + } + const isInternalException = hint.data && hint.data.__sentry__ === true; + if (isInternalException) { + return prepared; + } + const result = processBeforeSend(this, options4, prepared, hint); + return _validateBeforeSendResult(result, beforeSendLabel); + }).then((processedEvent) => { + if (processedEvent === null) { + this.recordDroppedEvent("before_send", dataCategory, event); + if (isTransaction) { + const spans = event.spans || []; + const spanCount = 1 + spans.length; + this.recordDroppedEvent("before_send", "span", spanCount); + } + throw new SentryError(`${beforeSendLabel} returned \`null\`, will not send event.`, "log"); + } + const session = currentScope && currentScope.getSession(); + if (!isTransaction && session) { + this._updateSessionFromEvent(session, processedEvent); + } + if (isTransaction) { + const spanCountBefore = processedEvent.sdkProcessingMetadata && processedEvent.sdkProcessingMetadata.spanCountBeforeProcessing || 0; + const spanCountAfter = processedEvent.spans ? processedEvent.spans.length : 0; + const droppedSpanCount = spanCountBefore - spanCountAfter; + if (droppedSpanCount > 0) { + this.recordDroppedEvent("before_send", "span", droppedSpanCount); + } + } + const transactionInfo = processedEvent.transaction_info; + if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) { + const source = "custom"; + processedEvent.transaction_info = { + ...transactionInfo, + source + }; + } + this.sendEvent(processedEvent, hint); + return processedEvent; + }).then(null, (reason) => { + if (reason instanceof SentryError) { + throw reason; + } + this.captureException(reason, { + data: { + __sentry__: true + }, + originalException: reason + }); + throw new SentryError( + `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event. +Reason: ${reason}` + ); + }); + } + /** + * Occupies the client with processing and event + */ + _process(promise) { + this._numProcessing++; + void promise.then( + (value4) => { + this._numProcessing--; + return value4; + }, + (reason) => { + this._numProcessing--; + return reason; + } + ); + } + /** + * Clears outcomes on this client and returns them. + */ + _clearOutcomes() { + const outcomes = this._outcomes; + this._outcomes = {}; + return Object.entries(outcomes).map(([key, quantity]) => { + const [reason, category] = key.split(":"); + return { + reason, + category, + quantity + }; + }); + } + /** + * Sends client reports as an envelope. + */ + _flushOutcomes() { + DEBUG_BUILD$6 && logger$2.log("Flushing outcomes..."); + const outcomes = this._clearOutcomes(); + if (outcomes.length === 0) { + DEBUG_BUILD$6 && logger$2.log("No outcomes to send"); + return; + } + if (!this._dsn) { + DEBUG_BUILD$6 && logger$2.log("No dsn provided, will not send outcomes"); + return; + } + DEBUG_BUILD$6 && logger$2.log("Sending outcomes:", outcomes); + const envelope = createClientReportEnvelope(outcomes, this._options.tunnel && dsnToString(this._dsn)); + this.sendEnvelope(envelope); + } + /** + * @inheritDoc + */ +} +function _validateBeforeSendResult(beforeSendResult, beforeSendLabel) { + const invalidValueError = `${beforeSendLabel} must return \`null\` or a valid event.`; + if (isThenable$1(beforeSendResult)) { + return beforeSendResult.then( + (event) => { + if (!isPlainObject$5(event) && event !== null) { + throw new SentryError(invalidValueError); + } + return event; + }, + (e2) => { + throw new SentryError(`${beforeSendLabel} rejected with ${e2}`); + } + ); + } else if (!isPlainObject$5(beforeSendResult) && beforeSendResult !== null) { + throw new SentryError(invalidValueError); + } + return beforeSendResult; +} +__name(_validateBeforeSendResult, "_validateBeforeSendResult"); +function processBeforeSend(client, options4, event, hint) { + const { beforeSend, beforeSendTransaction, beforeSendSpan } = options4; + if (isErrorEvent$1(event) && beforeSend) { + return beforeSend(event, hint); + } + if (isTransactionEvent$1(event)) { + if (event.spans && beforeSendSpan) { + const processedSpans = []; + for (const span of event.spans) { + const processedSpan = beforeSendSpan(span); + if (processedSpan) { + processedSpans.push(processedSpan); + } else { + showSpanDropWarning(); + client.recordDroppedEvent("before_send", "span"); + } + } + event.spans = processedSpans; + } + if (beforeSendTransaction) { + if (event.spans) { + const spanCountBefore = event.spans.length; + event.sdkProcessingMetadata = { + ...event.sdkProcessingMetadata, + spanCountBeforeProcessing: spanCountBefore + }; + } + return beforeSendTransaction(event, hint); + } + } + return event; +} +__name(processBeforeSend, "processBeforeSend"); +function isErrorEvent$1(event) { + return event.type === void 0; +} +__name(isErrorEvent$1, "isErrorEvent$1"); +function isTransactionEvent$1(event) { + return event.type === "transaction"; +} +__name(isTransactionEvent$1, "isTransactionEvent$1"); +function createCheckInEnvelope(checkIn, dynamicSamplingContext, metadata, tunnel, dsn) { + const headers = { + sent_at: (/* @__PURE__ */ new Date()).toISOString() + }; + if (metadata && metadata.sdk) { + headers.sdk = { + name: metadata.sdk.name, + version: metadata.sdk.version + }; + } + if (!!tunnel && !!dsn) { + headers.dsn = dsnToString(dsn); + } + if (dynamicSamplingContext) { + headers.trace = dropUndefinedKeys(dynamicSamplingContext); + } + const item3 = createCheckInEnvelopeItem(checkIn); + return createEnvelope(headers, [item3]); +} +__name(createCheckInEnvelope, "createCheckInEnvelope"); +function createCheckInEnvelopeItem(checkIn) { + const checkInHeaders = { + type: "check_in" + }; + return [checkInHeaders, checkIn]; +} +__name(createCheckInEnvelopeItem, "createCheckInEnvelopeItem"); +function parseStackFrames$1(stackParser, error2) { + return stackParser(error2.stack || "", 1); +} +__name(parseStackFrames$1, "parseStackFrames$1"); +function exceptionFromError$1(stackParser, error2) { + const exception = { + type: error2.name || error2.constructor.name, + value: error2.message + }; + const frames = parseStackFrames$1(stackParser, error2); + if (frames.length) { + exception.stacktrace = { frames }; + } + return exception; +} +__name(exceptionFromError$1, "exceptionFromError$1"); +function getErrorPropertyFromObject$1(obj) { + for (const prop2 in obj) { + if (Object.prototype.hasOwnProperty.call(obj, prop2)) { + const value4 = obj[prop2]; + if (value4 instanceof Error) { + return value4; + } + } + } + return void 0; +} +__name(getErrorPropertyFromObject$1, "getErrorPropertyFromObject$1"); +function getMessageForObject(exception) { + if ("name" in exception && typeof exception.name === "string") { + let message3 = `'${exception.name}' captured as exception`; + if ("message" in exception && typeof exception.message === "string") { + message3 += ` with message '${exception.message}'`; + } + return message3; + } else if ("message" in exception && typeof exception.message === "string") { + return exception.message; + } + const keys2 = extractExceptionKeysForMessage(exception); + if (isErrorEvent$2(exception)) { + return `Event \`ErrorEvent\` captured as exception with message \`${exception.message}\``; + } + const className = getObjectClassName$1(exception); + return `${className && className !== "Object" ? `'${className}'` : "Object"} captured as exception with keys: ${keys2}`; +} +__name(getMessageForObject, "getMessageForObject"); +function getObjectClassName$1(obj) { + try { + const prototype2 = Object.getPrototypeOf(obj); + return prototype2 ? prototype2.constructor.name : void 0; + } catch (e2) { + } +} +__name(getObjectClassName$1, "getObjectClassName$1"); +function getException(client, mechanism, exception, hint) { + if (isError(exception)) { + return [exception, void 0]; + } + mechanism.synthetic = true; + if (isPlainObject$5(exception)) { + const normalizeDepth = client && client.getOptions().normalizeDepth; + const extras = { ["__serialized__"]: normalizeToSize(exception, normalizeDepth) }; + const errorFromProp = getErrorPropertyFromObject$1(exception); + if (errorFromProp) { + return [errorFromProp, extras]; + } + const message3 = getMessageForObject(exception); + const ex2 = hint && hint.syntheticException || new Error(message3); + ex2.message = message3; + return [ex2, extras]; + } + const ex = hint && hint.syntheticException || new Error(exception); + ex.message = `${exception}`; + return [ex, void 0]; +} +__name(getException, "getException"); +function eventFromUnknownInput$1(client, stackParser, exception, hint) { + const providedMechanism = hint && hint.data && hint.data.mechanism; + const mechanism = providedMechanism || { + handled: true, + type: "generic" + }; + const [ex, extras] = getException(client, mechanism, exception, hint); + const event = { + exception: { + values: [exceptionFromError$1(stackParser, ex)] + } + }; + if (extras) { + event.extra = extras; + } + addExceptionTypeValue(event, void 0, void 0); + addExceptionMechanism(event, mechanism); + return { + ...event, + event_id: hint && hint.event_id + }; +} +__name(eventFromUnknownInput$1, "eventFromUnknownInput$1"); +function eventFromMessage$1(stackParser, message3, level = "info", hint, attachStacktrace) { + const event = { + event_id: hint && hint.event_id, + level + }; + if (attachStacktrace && hint && hint.syntheticException) { + const frames = parseStackFrames$1(stackParser, hint.syntheticException); + if (frames.length) { + event.exception = { + values: [ + { + value: message3, + stacktrace: { frames } + } + ] + }; + addExceptionMechanism(event, { synthetic: true }); + } + } + if (isParameterizedString(message3)) { + const { __sentry_template_string__, __sentry_template_values__ } = message3; + event.logentry = { + message: __sentry_template_string__, + params: __sentry_template_values__ + }; + return event; + } + event.message = message3; + return event; +} +__name(eventFromMessage$1, "eventFromMessage$1"); +class ServerRuntimeClient extends BaseClient { + static { + __name(this, "ServerRuntimeClient"); + } + // eslint-disable-next-line deprecation/deprecation + /** + * Creates a new Edge SDK instance. + * @param options Configuration options for this SDK. + */ + constructor(options4) { + registerSpanErrorInstrumentation(); + super(options4); + } + /** + * @inheritDoc + */ + eventFromException(exception, hint) { + const event = eventFromUnknownInput$1(this, this._options.stackParser, exception, hint); + event.level = "error"; + return resolvedSyncPromise(event); + } + /** + * @inheritDoc + */ + eventFromMessage(message3, level = "info", hint) { + return resolvedSyncPromise( + eventFromMessage$1(this._options.stackParser, message3, level, hint, this._options.attachStacktrace) + ); + } + /** + * @inheritDoc + */ + captureException(exception, hint, scope) { + if (this._options.autoSessionTracking && this._sessionFlusher) { + const requestSession = getIsolationScope().getRequestSession(); + if (requestSession && requestSession.status === "ok") { + requestSession.status = "errored"; + } + } + return super.captureException(exception, hint, scope); + } + /** + * @inheritDoc + */ + captureEvent(event, hint, scope) { + if (this._options.autoSessionTracking && this._sessionFlusher) { + const eventType = event.type || "exception"; + const isException = eventType === "exception" && event.exception && event.exception.values && event.exception.values.length > 0; + if (isException) { + const requestSession = getIsolationScope().getRequestSession(); + if (requestSession && requestSession.status === "ok") { + requestSession.status = "errored"; + } + } + } + return super.captureEvent(event, hint, scope); + } + /** + * + * @inheritdoc + */ + close(timeout) { + if (this._sessionFlusher) { + this._sessionFlusher.close(); + } + return super.close(timeout); + } + /** + * Initializes an instance of SessionFlusher on the client which will aggregate and periodically flush session data. + * + * NOTICE: This method will implicitly create an interval that is periodically called. + * To clean up this resources, call `.close()` when you no longer intend to use the client. + * Not doing so will result in a memory leak. + */ + initSessionFlusher() { + const { release, environment } = this._options; + if (!release) { + DEBUG_BUILD$6 && logger$2.warn("Cannot initialize an instance of SessionFlusher if no release is provided!"); + } else { + this._sessionFlusher = new SessionFlusher(this, { + release, + environment + }); + } + } + /** + * Create a cron monitor check in and send it to Sentry. + * + * @param checkIn An object that describes a check in. + * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want + * to create a monitor automatically when sending a check in. + */ + captureCheckIn(checkIn, monitorConfig, scope) { + const id3 = "checkInId" in checkIn && checkIn.checkInId ? checkIn.checkInId : uuid4(); + if (!this._isEnabled()) { + DEBUG_BUILD$6 && logger$2.warn("SDK not enabled, will not capture checkin."); + return id3; + } + const options4 = this.getOptions(); + const { release, environment, tunnel } = options4; + const serializedCheckIn = { + check_in_id: id3, + monitor_slug: checkIn.monitorSlug, + status: checkIn.status, + release, + environment + }; + if ("duration" in checkIn) { + serializedCheckIn.duration = checkIn.duration; + } + if (monitorConfig) { + serializedCheckIn.monitor_config = { + schedule: monitorConfig.schedule, + checkin_margin: monitorConfig.checkinMargin, + max_runtime: monitorConfig.maxRuntime, + timezone: monitorConfig.timezone, + failure_issue_threshold: monitorConfig.failureIssueThreshold, + recovery_threshold: monitorConfig.recoveryThreshold + }; + } + const [dynamicSamplingContext, traceContext] = this._getTraceInfoFromScope(scope); + if (traceContext) { + serializedCheckIn.contexts = { + trace: traceContext + }; + } + const envelope = createCheckInEnvelope( + serializedCheckIn, + dynamicSamplingContext, + this.getSdkMetadata(), + tunnel, + this.getDsn() + ); + DEBUG_BUILD$6 && logger$2.info("Sending checkin:", checkIn.monitorSlug, checkIn.status); + this.sendEnvelope(envelope); + return id3; + } + /** + * Method responsible for capturing/ending a request session by calling `incrementSessionStatusCount` to increment + * appropriate session aggregates bucket + * + * @deprecated This method should not be used or extended. It's functionality will move into the `httpIntegration` and not be part of any public API. + */ + _captureRequestSession() { + if (!this._sessionFlusher) { + DEBUG_BUILD$6 && logger$2.warn("Discarded request mode session because autoSessionTracking option was disabled"); + } else { + this._sessionFlusher.incrementSessionStatusCount(); + } + } + /** + * @inheritDoc + */ + _prepareEvent(event, hint, scope, isolationScope) { + if (this._options.platform) { + event.platform = event.platform || this._options.platform; + } + if (this._options.runtime) { + event.contexts = { + ...event.contexts, + runtime: (event.contexts || {}).runtime || this._options.runtime + }; + } + if (this._options.serverName) { + event.server_name = event.server_name || this._options.serverName; + } + return super._prepareEvent(event, hint, scope, isolationScope); + } + /** Extract trace information from scope */ + _getTraceInfoFromScope(scope) { + if (!scope) { + return [void 0, void 0]; + } + const span = _getSpanForScope(scope); + const traceContext = span ? spanToTraceContext(span) : getTraceContextFromScope(scope); + const dynamicSamplingContext = span ? getDynamicSamplingContextFromSpan(span) : getDynamicSamplingContextFromScope(this, scope); + return [dynamicSamplingContext, traceContext]; + } +} +function initAndBind(clientClass, options4) { + if (options4.debug === true) { + if (DEBUG_BUILD$6) { + logger$2.enable(); + } else { + consoleSandbox(() => { + console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle."); + }); + } + } + const scope = getCurrentScope$1(); + scope.update(options4.initialScope); + const client = new clientClass(options4); + setCurrentClient(client); + client.init(); + return client; +} +__name(initAndBind, "initAndBind"); +function setCurrentClient(client) { + getCurrentScope$1().setClient(client); +} +__name(setCurrentClient, "setCurrentClient"); +function makePromiseBuffer(limit) { + const buffer2 = []; + function isReady() { + return limit === void 0 || buffer2.length < limit; + } + __name(isReady, "isReady"); + function remove4(task) { + return buffer2.splice(buffer2.indexOf(task), 1)[0] || Promise.resolve(void 0); + } + __name(remove4, "remove"); + function add3(taskProducer) { + if (!isReady()) { + return rejectedSyncPromise(new SentryError("Not adding Promise because buffer limit was reached.")); + } + const task = taskProducer(); + if (buffer2.indexOf(task) === -1) { + buffer2.push(task); + } + void task.then(() => remove4(task)).then( + null, + () => remove4(task).then(null, () => { + }) + ); + return task; + } + __name(add3, "add"); + function drain(timeout) { + return new SyncPromise((resolve2, reject3) => { + let counter = buffer2.length; + if (!counter) { + return resolve2(true); + } + const capturedSetTimeout = setTimeout(() => { + if (timeout && timeout > 0) { + resolve2(false); + } + }, timeout); + buffer2.forEach((item3) => { + void resolvedSyncPromise(item3).then(() => { + if (!--counter) { + clearTimeout(capturedSetTimeout); + resolve2(true); + } + }, reject3); + }); + }); + } + __name(drain, "drain"); + return { + $: buffer2, + add: add3, + drain + }; +} +__name(makePromiseBuffer, "makePromiseBuffer"); +const DEFAULT_RETRY_AFTER = 60 * 1e3; +function parseRetryAfterHeader(header3, now2 = Date.now()) { + const headerDelay = parseInt(`${header3}`, 10); + if (!isNaN(headerDelay)) { + return headerDelay * 1e3; + } + const headerDate = Date.parse(`${header3}`); + if (!isNaN(headerDate)) { + return headerDate - now2; + } + return DEFAULT_RETRY_AFTER; +} +__name(parseRetryAfterHeader, "parseRetryAfterHeader"); +function disabledUntil(limits, dataCategory) { + return limits[dataCategory] || limits.all || 0; +} +__name(disabledUntil, "disabledUntil"); +function isRateLimited(limits, dataCategory, now2 = Date.now()) { + return disabledUntil(limits, dataCategory) > now2; +} +__name(isRateLimited, "isRateLimited"); +function updateRateLimits(limits, { statusCode, headers }, now2 = Date.now()) { + const updatedRateLimits = { + ...limits + }; + const rateLimitHeader = headers && headers["x-sentry-rate-limits"]; + const retryAfterHeader = headers && headers["retry-after"]; + if (rateLimitHeader) { + for (const limit of rateLimitHeader.trim().split(",")) { + const [retryAfter, categories, , , namespaces] = limit.split(":", 5); + const headerDelay = parseInt(retryAfter, 10); + const delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1e3; + if (!categories) { + updatedRateLimits.all = now2 + delay; + } else { + for (const category of categories.split(";")) { + if (category === "metric_bucket") { + if (!namespaces || namespaces.split(";").includes("custom")) { + updatedRateLimits[category] = now2 + delay; + } + } else { + updatedRateLimits[category] = now2 + delay; + } + } + } + } + } else if (retryAfterHeader) { + updatedRateLimits.all = now2 + parseRetryAfterHeader(retryAfterHeader, now2); + } else if (statusCode === 429) { + updatedRateLimits.all = now2 + 60 * 1e3; + } + return updatedRateLimits; +} +__name(updateRateLimits, "updateRateLimits"); +const DEFAULT_TRANSPORT_BUFFER_SIZE = 64; +function createTransport(options4, makeRequest, buffer2 = makePromiseBuffer( + options4.bufferSize || DEFAULT_TRANSPORT_BUFFER_SIZE +)) { + let rateLimits = {}; + const flush2 = /* @__PURE__ */ __name((timeout) => buffer2.drain(timeout), "flush"); + function send(envelope) { + const filteredEnvelopeItems = []; + forEachEnvelopeItem(envelope, (item3, type) => { + const dataCategory = envelopeItemTypeToDataCategory(type); + if (isRateLimited(rateLimits, dataCategory)) { + const event = getEventForEnvelopeItem(item3, type); + options4.recordDroppedEvent("ratelimit_backoff", dataCategory, event); + } else { + filteredEnvelopeItems.push(item3); + } + }); + if (filteredEnvelopeItems.length === 0) { + return resolvedSyncPromise({}); + } + const filteredEnvelope = createEnvelope(envelope[0], filteredEnvelopeItems); + const recordEnvelopeLoss = /* @__PURE__ */ __name((reason) => { + forEachEnvelopeItem(filteredEnvelope, (item3, type) => { + const event = getEventForEnvelopeItem(item3, type); + options4.recordDroppedEvent(reason, envelopeItemTypeToDataCategory(type), event); + }); + }, "recordEnvelopeLoss"); + const requestTask = /* @__PURE__ */ __name(() => makeRequest({ body: serializeEnvelope(filteredEnvelope) }).then( + (response) => { + if (response.statusCode !== void 0 && (response.statusCode < 200 || response.statusCode >= 300)) { + DEBUG_BUILD$6 && logger$2.warn(`Sentry responded with status code ${response.statusCode} to sent event.`); + } + rateLimits = updateRateLimits(rateLimits, response); + return response; + }, + (error2) => { + recordEnvelopeLoss("network_error"); + throw error2; + } + ), "requestTask"); + return buffer2.add(requestTask).then( + (result) => result, + (error2) => { + if (error2 instanceof SentryError) { + DEBUG_BUILD$6 && logger$2.error("Skipped sending event because buffer is full."); + recordEnvelopeLoss("queue_overflow"); + return resolvedSyncPromise({}); + } else { + throw error2; + } + } + ); + } + __name(send, "send"); + return { + send, + flush: flush2 + }; +} +__name(createTransport, "createTransport"); +function getEventForEnvelopeItem(item3, type) { + if (type !== "event" && type !== "transaction") { + return void 0; + } + return Array.isArray(item3) ? item3[1] : void 0; +} +__name(getEventForEnvelopeItem, "getEventForEnvelopeItem"); +const MIN_DELAY = 100; +const START_DELAY = 5e3; +const MAX_DELAY = 36e5; +function makeOfflineTransport(createTransport2) { + function log2(...args) { + DEBUG_BUILD$6 && logger$2.info("[Offline]:", ...args); + } + __name(log2, "log"); + return (options4) => { + const transport = createTransport2(options4); + if (!options4.createStore) { + throw new Error("No `createStore` function was provided"); + } + const store = options4.createStore(options4); + let retryDelay = START_DELAY; + let flushTimer; + function shouldQueue(env, error2, retryDelay2) { + if (envelopeContainsItemType(env, ["client_report"])) { + return false; + } + if (options4.shouldStore) { + return options4.shouldStore(env, error2, retryDelay2); + } + return true; + } + __name(shouldQueue, "shouldQueue"); + function flushIn(delay) { + if (flushTimer) { + clearTimeout(flushTimer); + } + flushTimer = setTimeout(async () => { + flushTimer = void 0; + const found2 = await store.shift(); + if (found2) { + log2("Attempting to send previously queued event"); + found2[0].sent_at = (/* @__PURE__ */ new Date()).toISOString(); + void send(found2, true).catch((e2) => { + log2("Failed to retry sending", e2); + }); + } + }, delay); + if (typeof flushTimer !== "number" && flushTimer.unref) { + flushTimer.unref(); + } + } + __name(flushIn, "flushIn"); + function flushWithBackOff() { + if (flushTimer) { + return; + } + flushIn(retryDelay); + retryDelay = Math.min(retryDelay * 2, MAX_DELAY); + } + __name(flushWithBackOff, "flushWithBackOff"); + async function send(envelope, isRetry = false) { + if (!isRetry && envelopeContainsItemType(envelope, ["replay_event", "replay_recording"])) { + await store.push(envelope); + flushIn(MIN_DELAY); + return {}; + } + try { + const result = await transport.send(envelope); + let delay = MIN_DELAY; + if (result) { + if (result.headers && result.headers["retry-after"]) { + delay = parseRetryAfterHeader(result.headers["retry-after"]); + } else if (result.headers && result.headers["x-sentry-rate-limits"]) { + delay = 6e4; + } else if ((result.statusCode || 0) >= 400) { + return result; + } + } + flushIn(delay); + retryDelay = START_DELAY; + return result; + } catch (e2) { + if (await shouldQueue(envelope, e2, retryDelay)) { + if (isRetry) { + await store.unshift(envelope); + } else { + await store.push(envelope); + } + flushWithBackOff(); + log2("Error sending. Event queued.", e2); + return {}; + } else { + throw e2; + } + } + } + __name(send, "send"); + if (options4.flushAtStartup) { + flushWithBackOff(); + } + return { + send, + flush: /* @__PURE__ */ __name((t2) => transport.flush(t2), "flush") + }; + }; +} +__name(makeOfflineTransport, "makeOfflineTransport"); +function eventFromEnvelope(env, types) { + let event; + forEachEnvelopeItem(env, (item3, type) => { + if (types.includes(type)) { + event = Array.isArray(item3) ? item3[1] : void 0; + } + return !!event; + }); + return event; +} +__name(eventFromEnvelope, "eventFromEnvelope"); +function makeOverrideReleaseTransport(createTransport2, release) { + return (options4) => { + const transport = createTransport2(options4); + return { + ...transport, + send: /* @__PURE__ */ __name(async (envelope) => { + const event = eventFromEnvelope(envelope, ["event", "transaction", "profile", "replay_event"]); + if (event) { + event.release = release; + } + return transport.send(envelope); + }, "send") + }; + }; +} +__name(makeOverrideReleaseTransport, "makeOverrideReleaseTransport"); +function overrideDsn(envelope, dsn) { + return createEnvelope( + dsn ? { + ...envelope[0], + dsn + } : envelope[0], + envelope[1] + ); +} +__name(overrideDsn, "overrideDsn"); +function makeMultiplexedTransport(createTransport2, matcher) { + return (options4) => { + const fallbackTransport = createTransport2(options4); + const otherTransports = /* @__PURE__ */ new Map(); + function getTransport(dsn, release) { + const key = release ? `${dsn}:${release}` : dsn; + let transport = otherTransports.get(key); + if (!transport) { + const validatedDsn = dsnFromString(dsn); + if (!validatedDsn) { + return void 0; + } + const url = getEnvelopeEndpointWithUrlEncodedAuth(validatedDsn, options4.tunnel); + transport = release ? makeOverrideReleaseTransport(createTransport2, release)({ ...options4, url }) : createTransport2({ ...options4, url }); + otherTransports.set(key, transport); + } + return [dsn, transport]; + } + __name(getTransport, "getTransport"); + async function send(envelope) { + function getEvent(types) { + const eventTypes = types && types.length ? types : ["event"]; + return eventFromEnvelope(envelope, eventTypes); + } + __name(getEvent, "getEvent"); + const transports = matcher({ envelope, getEvent }).map((result) => { + if (typeof result === "string") { + return getTransport(result, void 0); + } else { + return getTransport(result.dsn, result.release); + } + }).filter((t2) => !!t2); + const transportsWithFallback = transports.length ? transports : [["", fallbackTransport]]; + const results = await Promise.all( + transportsWithFallback.map(([dsn, transport]) => transport.send(overrideDsn(envelope, dsn))) + ); + return results[0]; + } + __name(send, "send"); + async function flush2(timeout) { + const allTransports = [...otherTransports.values(), fallbackTransport]; + const results = await Promise.all(allTransports.map((transport) => transport.flush(timeout))); + return results.every((r2) => r2); + } + __name(flush2, "flush"); + return { + send, + flush: flush2 + }; + }; +} +__name(makeMultiplexedTransport, "makeMultiplexedTransport"); +function isSentryRequestUrl(url, client) { + const dsn = client && client.getDsn(); + const tunnel = client && client.getOptions().tunnel; + return checkDsn(url, dsn) || checkTunnel(url, tunnel); +} +__name(isSentryRequestUrl, "isSentryRequestUrl"); +function checkTunnel(url, tunnel) { + if (!tunnel) { + return false; + } + return removeTrailingSlash$1(url) === removeTrailingSlash$1(tunnel); +} +__name(checkTunnel, "checkTunnel"); +function checkDsn(url, dsn) { + return dsn ? url.includes(dsn.host) : false; +} +__name(checkDsn, "checkDsn"); +function removeTrailingSlash$1(str) { + return str[str.length - 1] === "/" ? str.slice(0, -1) : str; +} +__name(removeTrailingSlash$1, "removeTrailingSlash$1"); +function parameterize(strings, ...values) { + const formatted = new String(String.raw(strings, ...values)); + formatted.__sentry_template_string__ = strings.join("\0").replace(/%/g, "%%").replace(/\0/g, "%s"); + formatted.__sentry_template_values__ = values; + return formatted; +} +__name(parameterize, "parameterize"); +function applySdkMetadata(options4, name2, names = [name2], source = "npm") { + const metadata = options4._metadata || {}; + if (!metadata.sdk) { + metadata.sdk = { + name: `sentry.javascript.${name2}`, + packages: names.map((name3) => ({ + name: `${source}:@sentry/${name3}`, + version: SDK_VERSION + })), + version: SDK_VERSION + }; + } + options4._metadata = metadata; +} +__name(applySdkMetadata, "applySdkMetadata"); +function getTraceData(options4 = {}) { + const client = getClient(); + if (!isEnabled() || !client) { + return {}; + } + const carrier = getMainCarrier(); + const acs = getAsyncContextStrategy(carrier); + if (acs.getTraceData) { + return acs.getTraceData(options4); + } + const scope = getCurrentScope$1(); + const span = options4.span || getActiveSpan(); + const sentryTrace = span ? spanToTraceHeader(span) : scopeToTraceHeader(scope); + const dsc = span ? getDynamicSamplingContextFromSpan(span) : getDynamicSamplingContextFromScope(client, scope); + const baggage = dynamicSamplingContextToSentryBaggageHeader(dsc); + const isValidSentryTraceHeader = TRACEPARENT_REGEXP.test(sentryTrace); + if (!isValidSentryTraceHeader) { + logger$2.warn("Invalid sentry-trace data. Cannot generate trace data"); + return {}; + } + return { + "sentry-trace": sentryTrace, + baggage + }; +} +__name(getTraceData, "getTraceData"); +function scopeToTraceHeader(scope) { + const { traceId, sampled, spanId } = scope.getPropagationContext(); + return generateSentryTraceHeader(traceId, spanId, sampled); +} +__name(scopeToTraceHeader, "scopeToTraceHeader"); +function getTraceMetaTags() { + return Object.entries(getTraceData()).map(([key, value4]) => ``).join("\n"); +} +__name(getTraceMetaTags, "getTraceMetaTags"); +const DEFAULT_BREADCRUMBS = 100; +function addBreadcrumb(breadcrumb, hint) { + const client = getClient(); + const isolationScope = getIsolationScope(); + if (!client) return; + const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } = client.getOptions(); + if (maxBreadcrumbs <= 0) return; + const timestamp2 = dateTimestampInSeconds(); + const mergedBreadcrumb = { timestamp: timestamp2, ...breadcrumb }; + const finalBreadcrumb = beforeBreadcrumb ? consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) : mergedBreadcrumb; + if (finalBreadcrumb === null) return; + if (client.emit) { + client.emit("beforeAddBreadcrumb", finalBreadcrumb, hint); + } + isolationScope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs); +} +__name(addBreadcrumb, "addBreadcrumb"); +let originalFunctionToString; +const INTEGRATION_NAME$l = "FunctionToString"; +const SETUP_CLIENTS$1 = /* @__PURE__ */ new WeakMap(); +const _functionToStringIntegration = /* @__PURE__ */ __name(() => { + return { + name: INTEGRATION_NAME$l, + setupOnce() { + originalFunctionToString = Function.prototype.toString; + try { + Function.prototype.toString = function(...args) { + const originalFunction = getOriginalFunction(this); + const context = SETUP_CLIENTS$1.has(getClient()) && originalFunction !== void 0 ? originalFunction : this; + return originalFunctionToString.apply(context, args); + }; + } catch (e2) { + } + }, + setup(client) { + SETUP_CLIENTS$1.set(client, true); + } + }; +}, "_functionToStringIntegration"); +const functionToStringIntegration = defineIntegration(_functionToStringIntegration); +const DEFAULT_IGNORE_ERRORS = [ + /^Script error\.?$/, + /^Javascript error: Script error\.? on line 0$/, + /^ResizeObserver loop completed with undelivered notifications.$/, + // The browser logs this when a ResizeObserver handler takes a bit longer. Usually this is not an actual issue though. It indicates slowness. + /^Cannot redefine property: googletag$/, + // This is thrown when google tag manager is used in combination with an ad blocker + "undefined is not an object (evaluating 'a.L')", + // Random error that happens but not actionable or noticeable to end-users. + `can't redefine non-configurable property "solana"`, + // Probably a browser extension or custom browser (Brave) throwing this error + "vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)", + // Error thrown by GTM, seemingly not affecting end-users + "Can't find variable: _AutofillCallbackHandler", + // Unactionable error in instagram webview https://developers.facebook.com/community/threads/320013549791141/ + /^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/ + // unactionable error from CEFSharp, a .NET library that embeds chromium in .NET apps +]; +const INTEGRATION_NAME$k = "InboundFilters"; +const _inboundFiltersIntegration = /* @__PURE__ */ __name((options4 = {}) => { + return { + name: INTEGRATION_NAME$k, + processEvent(event, _hint, client) { + const clientOptions = client.getOptions(); + const mergedOptions = _mergeOptions(options4, clientOptions); + return _shouldDropEvent$1(event, mergedOptions) ? null : event; + } + }; +}, "_inboundFiltersIntegration"); +const inboundFiltersIntegration = defineIntegration(_inboundFiltersIntegration); +function _mergeOptions(internalOptions = {}, clientOptions = {}) { + return { + allowUrls: [...internalOptions.allowUrls || [], ...clientOptions.allowUrls || []], + denyUrls: [...internalOptions.denyUrls || [], ...clientOptions.denyUrls || []], + ignoreErrors: [ + ...internalOptions.ignoreErrors || [], + ...clientOptions.ignoreErrors || [], + ...internalOptions.disableErrorDefaults ? [] : DEFAULT_IGNORE_ERRORS + ], + ignoreTransactions: [...internalOptions.ignoreTransactions || [], ...clientOptions.ignoreTransactions || []], + ignoreInternal: internalOptions.ignoreInternal !== void 0 ? internalOptions.ignoreInternal : true + }; +} +__name(_mergeOptions, "_mergeOptions"); +function _shouldDropEvent$1(event, options4) { + if (options4.ignoreInternal && _isSentryError(event)) { + DEBUG_BUILD$6 && logger$2.warn(`Event dropped due to being internal Sentry Error. +Event: ${getEventDescription(event)}`); + return true; + } + if (_isIgnoredError(event, options4.ignoreErrors)) { + DEBUG_BUILD$6 && logger$2.warn( + `Event dropped due to being matched by \`ignoreErrors\` option. +Event: ${getEventDescription(event)}` + ); + return true; + } + if (_isUselessError(event)) { + DEBUG_BUILD$6 && logger$2.warn( + `Event dropped due to not having an error message, error type or stacktrace. +Event: ${getEventDescription( + event + )}` + ); + return true; + } + if (_isIgnoredTransaction(event, options4.ignoreTransactions)) { + DEBUG_BUILD$6 && logger$2.warn( + `Event dropped due to being matched by \`ignoreTransactions\` option. +Event: ${getEventDescription(event)}` + ); + return true; + } + if (_isDeniedUrl(event, options4.denyUrls)) { + DEBUG_BUILD$6 && logger$2.warn( + `Event dropped due to being matched by \`denyUrls\` option. +Event: ${getEventDescription( + event + )}. +Url: ${_getEventFilterUrl(event)}` + ); + return true; + } + if (!_isAllowedUrl(event, options4.allowUrls)) { + DEBUG_BUILD$6 && logger$2.warn( + `Event dropped due to not being matched by \`allowUrls\` option. +Event: ${getEventDescription( + event + )}. +Url: ${_getEventFilterUrl(event)}` + ); + return true; + } + return false; +} +__name(_shouldDropEvent$1, "_shouldDropEvent$1"); +function _isIgnoredError(event, ignoreErrors) { + if (event.type || !ignoreErrors || !ignoreErrors.length) { + return false; + } + return _getPossibleEventMessages(event).some((message3) => stringMatchesSomePattern(message3, ignoreErrors)); +} +__name(_isIgnoredError, "_isIgnoredError"); +function _isIgnoredTransaction(event, ignoreTransactions) { + if (event.type !== "transaction" || !ignoreTransactions || !ignoreTransactions.length) { + return false; + } + const name2 = event.transaction; + return name2 ? stringMatchesSomePattern(name2, ignoreTransactions) : false; +} +__name(_isIgnoredTransaction, "_isIgnoredTransaction"); +function _isDeniedUrl(event, denyUrls) { + if (!denyUrls || !denyUrls.length) { + return false; + } + const url = _getEventFilterUrl(event); + return !url ? false : stringMatchesSomePattern(url, denyUrls); +} +__name(_isDeniedUrl, "_isDeniedUrl"); +function _isAllowedUrl(event, allowUrls) { + if (!allowUrls || !allowUrls.length) { + return true; + } + const url = _getEventFilterUrl(event); + return !url ? true : stringMatchesSomePattern(url, allowUrls); +} +__name(_isAllowedUrl, "_isAllowedUrl"); +function _getPossibleEventMessages(event) { + const possibleMessages = []; + if (event.message) { + possibleMessages.push(event.message); + } + let lastException; + try { + lastException = event.exception.values[event.exception.values.length - 1]; + } catch (e2) { + } + if (lastException) { + if (lastException.value) { + possibleMessages.push(lastException.value); + if (lastException.type) { + possibleMessages.push(`${lastException.type}: ${lastException.value}`); + } + } + } + return possibleMessages; +} +__name(_getPossibleEventMessages, "_getPossibleEventMessages"); +function _isSentryError(event) { + try { + return event.exception.values[0].type === "SentryError"; + } catch (e2) { + } + return false; +} +__name(_isSentryError, "_isSentryError"); +function _getLastValidUrl(frames = []) { + for (let i2 = frames.length - 1; i2 >= 0; i2--) { + const frame = frames[i2]; + if (frame && frame.filename !== "" && frame.filename !== "[native code]") { + return frame.filename || null; + } + } + return null; +} +__name(_getLastValidUrl, "_getLastValidUrl"); +function _getEventFilterUrl(event) { + try { + let frames; + try { + frames = event.exception.values[0].stacktrace.frames; + } catch (e2) { + } + return frames ? _getLastValidUrl(frames) : null; + } catch (oO) { + DEBUG_BUILD$6 && logger$2.error(`Cannot extract url for event ${getEventDescription(event)}`); + return null; + } +} +__name(_getEventFilterUrl, "_getEventFilterUrl"); +function _isUselessError(event) { + if (event.type) { + return false; + } + if (!event.exception || !event.exception.values || event.exception.values.length === 0) { + return false; + } + return ( + // No top-level message + !event.message && // There are no exception values that have a stacktrace, a non-generic-Error type or value + !event.exception.values.some((value4) => value4.stacktrace || value4.type && value4.type !== "Error" || value4.value) + ); +} +__name(_isUselessError, "_isUselessError"); +function applyAggregateErrorsToEvent(exceptionFromErrorImplementation, parser, maxValueLimit = 250, key, limit, event, hint) { + if (!event.exception || !event.exception.values || !hint || !isInstanceOf(hint.originalException, Error)) { + return; + } + const originalException = event.exception.values.length > 0 ? event.exception.values[event.exception.values.length - 1] : void 0; + if (originalException) { + event.exception.values = truncateAggregateExceptions( + aggregateExceptionsFromError( + exceptionFromErrorImplementation, + parser, + limit, + hint.originalException, + key, + event.exception.values, + originalException, + 0 + ), + maxValueLimit + ); + } +} +__name(applyAggregateErrorsToEvent, "applyAggregateErrorsToEvent"); +function aggregateExceptionsFromError(exceptionFromErrorImplementation, parser, limit, error2, key, prevExceptions, exception, exceptionId) { + if (prevExceptions.length >= limit + 1) { + return prevExceptions; + } + let newExceptions = [...prevExceptions]; + if (isInstanceOf(error2[key], Error)) { + applyExceptionGroupFieldsForParentException(exception, exceptionId); + const newException = exceptionFromErrorImplementation(parser, error2[key]); + const newExceptionId = newExceptions.length; + applyExceptionGroupFieldsForChildException(newException, key, newExceptionId, exceptionId); + newExceptions = aggregateExceptionsFromError( + exceptionFromErrorImplementation, + parser, + limit, + error2[key], + key, + [newException, ...newExceptions], + newException, + newExceptionId + ); + } + if (Array.isArray(error2.errors)) { + error2.errors.forEach((childError, i2) => { + if (isInstanceOf(childError, Error)) { + applyExceptionGroupFieldsForParentException(exception, exceptionId); + const newException = exceptionFromErrorImplementation(parser, childError); + const newExceptionId = newExceptions.length; + applyExceptionGroupFieldsForChildException(newException, `errors[${i2}]`, newExceptionId, exceptionId); + newExceptions = aggregateExceptionsFromError( + exceptionFromErrorImplementation, + parser, + limit, + childError, + key, + [newException, ...newExceptions], + newException, + newExceptionId + ); + } + }); + } + return newExceptions; +} +__name(aggregateExceptionsFromError, "aggregateExceptionsFromError"); +function applyExceptionGroupFieldsForParentException(exception, exceptionId) { + exception.mechanism = exception.mechanism || { type: "generic", handled: true }; + exception.mechanism = { + ...exception.mechanism, + ...exception.type === "AggregateError" && { is_exception_group: true }, + exception_id: exceptionId + }; +} +__name(applyExceptionGroupFieldsForParentException, "applyExceptionGroupFieldsForParentException"); +function applyExceptionGroupFieldsForChildException(exception, source, exceptionId, parentId) { + exception.mechanism = exception.mechanism || { type: "generic", handled: true }; + exception.mechanism = { + ...exception.mechanism, + type: "chained", + source, + exception_id: exceptionId, + parent_id: parentId + }; +} +__name(applyExceptionGroupFieldsForChildException, "applyExceptionGroupFieldsForChildException"); +function truncateAggregateExceptions(exceptions, maxValueLength) { + return exceptions.map((exception) => { + if (exception.value) { + exception.value = truncate(exception.value, maxValueLength); + } + return exception; + }); +} +__name(truncateAggregateExceptions, "truncateAggregateExceptions"); +const DEFAULT_KEY$1 = "cause"; +const DEFAULT_LIMIT$2 = 5; +const INTEGRATION_NAME$j = "LinkedErrors"; +const _linkedErrorsIntegration$1 = /* @__PURE__ */ __name((options4 = {}) => { + const limit = options4.limit || DEFAULT_LIMIT$2; + const key = options4.key || DEFAULT_KEY$1; + return { + name: INTEGRATION_NAME$j, + preprocessEvent(event, hint, client) { + const options5 = client.getOptions(); + applyAggregateErrorsToEvent( + exceptionFromError$1, + options5.stackParser, + options5.maxValueLength, + key, + limit, + event, + hint + ); + } + }; +}, "_linkedErrorsIntegration$1"); +const linkedErrorsIntegration$1 = defineIntegration(_linkedErrorsIntegration$1); +const filenameMetadataMap = /* @__PURE__ */ new Map(); +const parsedStacks = /* @__PURE__ */ new Set(); +function ensureMetadataStacksAreParsed(parser) { + if (!GLOBAL_OBJ._sentryModuleMetadata) { + return; + } + for (const stack2 of Object.keys(GLOBAL_OBJ._sentryModuleMetadata)) { + const metadata = GLOBAL_OBJ._sentryModuleMetadata[stack2]; + if (parsedStacks.has(stack2)) { + continue; + } + parsedStacks.add(stack2); + const frames = parser(stack2); + for (const frame of frames.reverse()) { + if (frame.filename) { + filenameMetadataMap.set(frame.filename, metadata); + break; + } + } + } +} +__name(ensureMetadataStacksAreParsed, "ensureMetadataStacksAreParsed"); +function getMetadataForUrl(parser, filename) { + ensureMetadataStacksAreParsed(parser); + return filenameMetadataMap.get(filename); +} +__name(getMetadataForUrl, "getMetadataForUrl"); +function addMetadataToStackFrames(parser, event) { + try { + event.exception.values.forEach((exception) => { + if (!exception.stacktrace) { + return; + } + for (const frame of exception.stacktrace.frames || []) { + if (!frame.filename || frame.module_metadata) { + continue; + } + const metadata = getMetadataForUrl(parser, frame.filename); + if (metadata) { + frame.module_metadata = metadata; + } + } + }); + } catch (_2) { + } +} +__name(addMetadataToStackFrames, "addMetadataToStackFrames"); +function stripMetadataFromStackFrames(event) { + try { + event.exception.values.forEach((exception) => { + if (!exception.stacktrace) { + return; + } + for (const frame of exception.stacktrace.frames || []) { + delete frame.module_metadata; + } + }); + } catch (_2) { + } +} +__name(stripMetadataFromStackFrames, "stripMetadataFromStackFrames"); +const moduleMetadataIntegration = defineIntegration(() => { + return { + name: "ModuleMetadata", + setup(client) { + client.on("beforeEnvelope", (envelope) => { + forEachEnvelopeItem(envelope, (item3, type) => { + if (type === "event") { + const event = Array.isArray(item3) ? item3[1] : void 0; + if (event) { + stripMetadataFromStackFrames(event); + item3[1] = event; + } + } + }); + }); + client.on("applyFrameMetadata", (event) => { + if (event.type) { + return; + } + const stackParser = client.getOptions().stackParser; + addMetadataToStackFrames(stackParser, event); + }); + } + }; +}); +function parseCookie(str) { + const obj = {}; + let index2 = 0; + while (index2 < str.length) { + const eqIdx = str.indexOf("=", index2); + if (eqIdx === -1) { + break; + } + let endIdx = str.indexOf(";", index2); + if (endIdx === -1) { + endIdx = str.length; + } else if (endIdx < eqIdx) { + index2 = str.lastIndexOf(";", eqIdx - 1) + 1; + continue; + } + const key = str.slice(index2, eqIdx).trim(); + if (void 0 === obj[key]) { + let val = str.slice(eqIdx + 1, endIdx).trim(); + if (val.charCodeAt(0) === 34) { + val = val.slice(1, -1); + } + try { + obj[key] = val.indexOf("%") !== -1 ? decodeURIComponent(val) : val; + } catch (e2) { + obj[key] = val; + } + } + index2 = endIdx + 1; + } + return obj; +} +__name(parseCookie, "parseCookie"); +function parseUrl$1(url) { + if (!url) { + return {}; + } + const match2 = url.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/); + if (!match2) { + return {}; + } + const query = match2[6] || ""; + const fragment = match2[8] || ""; + return { + host: match2[4], + path: match2[5], + protocol: match2[2], + search: query, + hash: fragment, + relative: match2[5] + query + fragment + // everything minus origin + }; +} +__name(parseUrl$1, "parseUrl$1"); +function stripUrlQueryAndFragment(urlPath) { + return urlPath.split(/[?#]/, 1)[0]; +} +__name(stripUrlQueryAndFragment, "stripUrlQueryAndFragment"); +function getNumberOfUrlSegments(url) { + return url.split(/\\?\//).filter((s2) => s2.length > 0 && s2 !== ",").length; +} +__name(getNumberOfUrlSegments, "getNumberOfUrlSegments"); +function getSanitizedUrlString(url) { + const { protocol, host, path } = url; + const filteredHost = host && host.replace(/^.*@/, "[filtered]:[filtered]@").replace(/(:80)$/, "").replace(/(:443)$/, "") || ""; + return `${protocol ? `${protocol}://` : ""}${filteredHost}${path}`; +} +__name(getSanitizedUrlString, "getSanitizedUrlString"); +const ipHeaderNames = [ + "X-Client-IP", + "X-Forwarded-For", + "Fly-Client-IP", + "CF-Connecting-IP", + "Fastly-Client-Ip", + "True-Client-Ip", + "X-Real-IP", + "X-Cluster-Client-IP", + "X-Forwarded", + "Forwarded-For", + "Forwarded", + "X-Vercel-Forwarded-For" +]; +function getClientIPAddress(headers) { + const headerValues = ipHeaderNames.map((headerName) => { + const rawValue = headers[headerName]; + const value4 = Array.isArray(rawValue) ? rawValue.join(";") : rawValue; + if (headerName === "Forwarded") { + return parseForwardedHeader(value4); + } + return value4 && value4.split(",").map((v2) => v2.trim()); + }); + const flattenedHeaderValues = headerValues.reduce((acc, val) => { + if (!val) { + return acc; + } + return acc.concat(val); + }, []); + const ipAddress = flattenedHeaderValues.find((ip) => ip !== null && isIP(ip)); + return ipAddress || null; +} +__name(getClientIPAddress, "getClientIPAddress"); +function parseForwardedHeader(value4) { + if (!value4) { + return null; + } + for (const part of value4.split(";")) { + if (part.startsWith("for=")) { + return part.slice(4); + } + } + return null; +} +__name(parseForwardedHeader, "parseForwardedHeader"); +function isIP(str) { + const regex2 = /(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/; + return regex2.test(str); +} +__name(isIP, "isIP"); +const DEFAULT_INCLUDES = { + ip: false, + request: true, + user: true +}; +const DEFAULT_REQUEST_INCLUDES = ["cookies", "data", "headers", "method", "query_string", "url"]; +const DEFAULT_USER_INCLUDES = ["id", "username", "email"]; +function extractPathForTransaction(req, options4 = {}) { + const method = req.method && req.method.toUpperCase(); + let path = ""; + let source = "url"; + if (options4.customRoute || req.route) { + path = options4.customRoute || `${req.baseUrl || ""}${req.route && req.route.path}`; + source = "route"; + } else if (req.originalUrl || req.url) { + path = stripUrlQueryAndFragment(req.originalUrl || req.url || ""); + } + let name2 = ""; + if (options4.method && method) { + name2 += method; + } + if (options4.method && options4.path) { + name2 += " "; + } + if (options4.path && path) { + name2 += path; + } + return [name2, source]; +} +__name(extractPathForTransaction, "extractPathForTransaction"); +function extractUserData(user, keys2) { + const extractedUser = {}; + const attributes = Array.isArray(keys2) ? keys2 : DEFAULT_USER_INCLUDES; + attributes.forEach((key) => { + if (user && key in user) { + extractedUser[key] = user[key]; + } + }); + return extractedUser; +} +__name(extractUserData, "extractUserData"); +function extractRequestData(req, options4 = {}) { + const { include = DEFAULT_REQUEST_INCLUDES } = options4; + const requestData = {}; + const headers = req.headers || {}; + const method = req.method; + const host = headers.host || req.hostname || req.host || ""; + const protocol = req.protocol === "https" || req.socket && req.socket.encrypted ? "https" : "http"; + const originalUrl = req.originalUrl || req.url || ""; + const absoluteUrl = originalUrl.startsWith(protocol) ? originalUrl : `${protocol}://${host}${originalUrl}`; + include.forEach((key) => { + switch (key) { + case "headers": { + requestData.headers = headers; + if (!include.includes("cookies")) { + delete requestData.headers.cookie; + } + if (!include.includes("ip")) { + ipHeaderNames.forEach((ipHeaderName) => { + delete requestData.headers[ipHeaderName]; + }); + } + break; + } + case "method": { + requestData.method = method; + break; + } + case "url": { + requestData.url = absoluteUrl; + break; + } + case "cookies": { + requestData.cookies = // TODO (v8 / #5257): We're only sending the empty object for backwards compatibility, so the last bit can + // come off in v8 + req.cookies || headers.cookie && parseCookie(headers.cookie) || {}; + break; + } + case "query_string": { + requestData.query_string = extractQueryParams(req); + break; + } + case "data": { + if (method === "GET" || method === "HEAD") { + break; + } + const body = req.body; + if (body !== void 0) { + const stringBody = isString$8(body) ? body : isPlainObject$5(body) ? JSON.stringify(normalize$2(body)) : truncate(`${body}`, 1024); + if (stringBody) { + requestData.data = stringBody; + } + } + break; + } + default: { + if ({}.hasOwnProperty.call(req, key)) { + requestData[key] = req[key]; + } + } + } + }); + return requestData; +} +__name(extractRequestData, "extractRequestData"); +function addNormalizedRequestDataToEvent(event, req, additionalData, options4) { + const include = { + ...DEFAULT_INCLUDES, + ...options4 && options4.include + }; + if (include.request) { + const includeRequest = Array.isArray(include.request) ? [...include.request] : [...DEFAULT_REQUEST_INCLUDES]; + if (include.ip) { + includeRequest.push("ip"); + } + const extractedRequestData = extractNormalizedRequestData(req, { include: includeRequest }); + event.request = { + ...event.request, + ...extractedRequestData + }; + } + if (include.user) { + const extractedUser = additionalData.user && isPlainObject$5(additionalData.user) ? extractUserData(additionalData.user, include.user) : {}; + if (Object.keys(extractedUser).length) { + event.user = { + ...extractedUser, + ...event.user + }; + } + } + if (include.ip) { + const ip = req.headers && getClientIPAddress(req.headers) || additionalData.ipAddress; + if (ip) { + event.user = { + ...event.user, + ip_address: ip + }; + } + } +} +__name(addNormalizedRequestDataToEvent, "addNormalizedRequestDataToEvent"); +function addRequestDataToEvent(event, req, options4) { + const include = { + ...DEFAULT_INCLUDES, + ...options4 && options4.include + }; + if (include.request) { + const includeRequest = Array.isArray(include.request) ? [...include.request] : [...DEFAULT_REQUEST_INCLUDES]; + if (include.ip) { + includeRequest.push("ip"); + } + const extractedRequestData = extractRequestData(req, { include: includeRequest }); + event.request = { + ...event.request, + ...extractedRequestData + }; + } + if (include.user) { + const extractedUser = req.user && isPlainObject$5(req.user) ? extractUserData(req.user, include.user) : {}; + if (Object.keys(extractedUser).length) { + event.user = { + ...event.user, + ...extractedUser + }; + } + } + if (include.ip) { + const ip = req.headers && getClientIPAddress(req.headers) || req.ip || req.socket && req.socket.remoteAddress; + if (ip) { + event.user = { + ...event.user, + ip_address: ip + }; + } + } + return event; +} +__name(addRequestDataToEvent, "addRequestDataToEvent"); +function extractQueryParams(req) { + let originalUrl = req.originalUrl || req.url || ""; + if (!originalUrl) { + return; + } + if (originalUrl.startsWith("/")) { + originalUrl = `http://dogs.are.great${originalUrl}`; + } + try { + const queryParams = req.query || new URL(originalUrl).search.slice(1); + return queryParams.length ? queryParams : void 0; + } catch (e2) { + return void 0; + } +} +__name(extractQueryParams, "extractQueryParams"); +function winterCGHeadersToDict(winterCGHeaders) { + const headers = {}; + try { + winterCGHeaders.forEach((value4, key) => { + if (typeof value4 === "string") { + headers[key] = value4; + } + }); + } catch (e2) { + DEBUG_BUILD$5 && logger$2.warn("Sentry failed extracting headers from a request object. If you see this, please file an issue."); + } + return headers; +} +__name(winterCGHeadersToDict, "winterCGHeadersToDict"); +function headersToDict(reqHeaders) { + const headers = /* @__PURE__ */ Object.create(null); + try { + Object.entries(reqHeaders).forEach(([key, value4]) => { + if (typeof value4 === "string") { + headers[key] = value4; + } + }); + } catch (e2) { + DEBUG_BUILD$5 && logger$2.warn("Sentry failed extracting headers from a request object. If you see this, please file an issue."); + } + return headers; +} +__name(headersToDict, "headersToDict"); +function winterCGRequestToRequestData(req) { + const headers = winterCGHeadersToDict(req.headers); + return { + method: req.method, + url: req.url, + query_string: extractQueryParamsFromUrl(req.url), + headers + // TODO: Can we extract body data from the request? + }; +} +__name(winterCGRequestToRequestData, "winterCGRequestToRequestData"); +function httpRequestToRequestData(request) { + const headers = request.headers || {}; + const host = headers.host || ""; + const protocol = request.socket && request.socket.encrypted ? "https" : "http"; + const originalUrl = request.url || ""; + const absoluteUrl = originalUrl.startsWith(protocol) ? originalUrl : `${protocol}://${host}${originalUrl}`; + const data25 = request.body || void 0; + const cookies2 = request.cookies; + return dropUndefinedKeys({ + url: absoluteUrl, + method: request.method, + query_string: extractQueryParamsFromUrl(originalUrl), + headers: headersToDict(headers), + cookies: cookies2, + data: data25 + }); +} +__name(httpRequestToRequestData, "httpRequestToRequestData"); +function extractQueryParamsFromUrl(url) { + if (!url) { + return; + } + try { + const queryParams = new URL(url, "http://dogs.are.great").search.slice(1); + return queryParams.length ? queryParams : void 0; + } catch (e3) { + return void 0; + } +} +__name(extractQueryParamsFromUrl, "extractQueryParamsFromUrl"); +function extractNormalizedRequestData(normalizedRequest, { include }) { + const includeKeys = include ? Array.isArray(include) ? include : DEFAULT_REQUEST_INCLUDES : []; + const requestData = {}; + const headers = { ...normalizedRequest.headers }; + if (includeKeys.includes("headers")) { + requestData.headers = headers; + if (!include.includes("cookies")) { + delete headers.cookie; + } + if (!include.includes("ip")) { + ipHeaderNames.forEach((ipHeaderName) => { + delete headers[ipHeaderName]; + }); + } + } + if (includeKeys.includes("method")) { + requestData.method = normalizedRequest.method; + } + if (includeKeys.includes("url")) { + requestData.url = normalizedRequest.url; + } + if (includeKeys.includes("cookies")) { + const cookies2 = normalizedRequest.cookies || (headers && headers.cookie ? parseCookie(headers.cookie) : void 0); + requestData.cookies = cookies2 || {}; + } + if (includeKeys.includes("query_string")) { + requestData.query_string = normalizedRequest.query_string; + } + if (includeKeys.includes("data")) { + requestData.data = normalizedRequest.data; + } + return requestData; +} +__name(extractNormalizedRequestData, "extractNormalizedRequestData"); +const DEFAULT_OPTIONS$1 = { + include: { + cookies: true, + data: true, + headers: true, + ip: false, + query_string: true, + url: true, + user: { + id: true, + username: true, + email: true + } + }, + transactionNamingScheme: "methodPath" +}; +const INTEGRATION_NAME$i = "RequestData"; +const _requestDataIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const _options = { + ...DEFAULT_OPTIONS$1, + ...options4, + include: { + ...DEFAULT_OPTIONS$1.include, + ...options4.include, + user: options4.include && typeof options4.include.user === "boolean" ? options4.include.user : { + ...DEFAULT_OPTIONS$1.include.user, + // Unclear why TS still thinks `options.include.user` could be a boolean at this point + ...(options4.include || {}).user + } + } + }; + return { + name: INTEGRATION_NAME$i, + processEvent(event) { + const { sdkProcessingMetadata = {} } = event; + const { request, normalizedRequest } = sdkProcessingMetadata; + const addRequestDataOptions = convertReqDataIntegrationOptsToAddReqDataOpts(_options); + if (normalizedRequest) { + const ipAddress = request ? request.ip || request.socket && request.socket.remoteAddress : void 0; + const user = request ? request.user : void 0; + addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress, user }, addRequestDataOptions); + return event; + } + if (!request) { + return event; + } + return addRequestDataToEvent(event, request, addRequestDataOptions); + } + }; +}, "_requestDataIntegration"); +const requestDataIntegration = defineIntegration(_requestDataIntegration); +function convertReqDataIntegrationOptsToAddReqDataOpts(integrationOptions) { + const { + // eslint-disable-next-line deprecation/deprecation + transactionNamingScheme, + include: { ip, user, ...requestOptions } + } = integrationOptions; + const requestIncludeKeys = ["method"]; + for (const [key, value4] of Object.entries(requestOptions)) { + if (value4) { + requestIncludeKeys.push(key); + } + } + let addReqDataUserOpt; + if (user === void 0) { + addReqDataUserOpt = true; + } else if (typeof user === "boolean") { + addReqDataUserOpt = user; + } else { + const userIncludeKeys = []; + for (const [key, value4] of Object.entries(user)) { + if (value4) { + userIncludeKeys.push(key); + } + } + addReqDataUserOpt = userIncludeKeys; + } + return { + include: { + ip, + user: addReqDataUserOpt, + request: requestIncludeKeys.length !== 0 ? requestIncludeKeys : void 0, + transaction: transactionNamingScheme + } + }; +} +__name(convertReqDataIntegrationOptsToAddReqDataOpts, "convertReqDataIntegrationOptsToAddReqDataOpts"); +function addConsoleInstrumentationHandler(handler6) { + const type = "console"; + addHandler$1(type, handler6); + maybeInstrument(type, instrumentConsole); +} +__name(addConsoleInstrumentationHandler, "addConsoleInstrumentationHandler"); +function instrumentConsole() { + if (!("console" in GLOBAL_OBJ)) { + return; + } + CONSOLE_LEVELS$1.forEach(function(level) { + if (!(level in GLOBAL_OBJ.console)) { + return; + } + fill(GLOBAL_OBJ.console, level, function(originalConsoleMethod) { + originalConsoleMethods[level] = originalConsoleMethod; + return function(...args) { + const handlerData = { args, level }; + triggerHandlers$1("console", handlerData); + const log2 = originalConsoleMethods[level]; + log2 && log2.apply(GLOBAL_OBJ.console, args); + }; + }); + }); +} +__name(instrumentConsole, "instrumentConsole"); +const validSeverityLevels = ["fatal", "error", "warning", "log", "info", "debug"]; +function severityLevelFromString(level) { + return level === "warn" ? "warning" : ["fatal", "error", "warning", "log", "info", "debug"].includes(level) ? level : "log"; +} +__name(severityLevelFromString, "severityLevelFromString"); +const INTEGRATION_NAME$h = "CaptureConsole"; +const _captureConsoleIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const levels = options4.levels || CONSOLE_LEVELS$1; + const handled = !!options4.handled; + return { + name: INTEGRATION_NAME$h, + setup(client) { + if (!("console" in GLOBAL_OBJ)) { + return; + } + addConsoleInstrumentationHandler(({ args, level }) => { + if (getClient() !== client || !levels.includes(level)) { + return; + } + consoleHandler(args, level, handled); + }); + } + }; +}, "_captureConsoleIntegration"); +const captureConsoleIntegration = defineIntegration(_captureConsoleIntegration); +function consoleHandler(args, level, handled) { + const captureContext = { + level: severityLevelFromString(level), + extra: { + arguments: args + } + }; + withScope((scope) => { + scope.addEventProcessor((event) => { + event.logger = "console"; + addExceptionMechanism(event, { + handled, + type: "console" + }); + return event; + }); + if (level === "assert") { + if (!args[0]) { + const message4 = `Assertion failed: ${safeJoin(args.slice(1), " ") || "console.assert"}`; + scope.setExtra("arguments", args.slice(1)); + captureMessage(message4, captureContext); + } + return; + } + const error2 = args.find((arg) => arg instanceof Error); + if (error2) { + captureException(error2, captureContext); + return; + } + const message3 = safeJoin(args, " "); + captureMessage(message3, captureContext); + }); +} +__name(consoleHandler, "consoleHandler"); +const INTEGRATION_NAME$g = "Debug"; +const _debugIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const _options = { + debugger: false, + stringify: false, + ...options4 + }; + return { + name: INTEGRATION_NAME$g, + setup(client) { + client.on("beforeSendEvent", (event, hint) => { + if (_options.debugger) { + debugger; + } + consoleSandbox(() => { + if (_options.stringify) { + console.log(JSON.stringify(event, null, 2)); + if (hint && Object.keys(hint).length) { + console.log(JSON.stringify(hint, null, 2)); + } + } else { + console.log(event); + if (hint && Object.keys(hint).length) { + console.log(hint); + } + } + }); + }); + } + }; +}, "_debugIntegration"); +const debugIntegration = defineIntegration(_debugIntegration); +const INTEGRATION_NAME$f = "Dedupe"; +const _dedupeIntegration = /* @__PURE__ */ __name(() => { + let previousEvent; + return { + name: INTEGRATION_NAME$f, + processEvent(currentEvent) { + if (currentEvent.type) { + return currentEvent; + } + try { + if (_shouldDropEvent(currentEvent, previousEvent)) { + DEBUG_BUILD$6 && logger$2.warn("Event dropped due to being a duplicate of previously captured event."); + return null; + } + } catch (_oO) { + } + return previousEvent = currentEvent; + } + }; +}, "_dedupeIntegration"); +const dedupeIntegration = defineIntegration(_dedupeIntegration); +function _shouldDropEvent(currentEvent, previousEvent) { + if (!previousEvent) { + return false; + } + if (_isSameMessageEvent(currentEvent, previousEvent)) { + return true; + } + if (_isSameExceptionEvent(currentEvent, previousEvent)) { + return true; + } + return false; +} +__name(_shouldDropEvent, "_shouldDropEvent"); +function _isSameMessageEvent(currentEvent, previousEvent) { + const currentMessage = currentEvent.message; + const previousMessage = previousEvent.message; + if (!currentMessage && !previousMessage) { + return false; + } + if (currentMessage && !previousMessage || !currentMessage && previousMessage) { + return false; + } + if (currentMessage !== previousMessage) { + return false; + } + if (!_isSameFingerprint(currentEvent, previousEvent)) { + return false; + } + if (!_isSameStacktrace(currentEvent, previousEvent)) { + return false; + } + return true; +} +__name(_isSameMessageEvent, "_isSameMessageEvent"); +function _isSameExceptionEvent(currentEvent, previousEvent) { + const previousException = _getExceptionFromEvent(previousEvent); + const currentException = _getExceptionFromEvent(currentEvent); + if (!previousException || !currentException) { + return false; + } + if (previousException.type !== currentException.type || previousException.value !== currentException.value) { + return false; + } + if (!_isSameFingerprint(currentEvent, previousEvent)) { + return false; + } + if (!_isSameStacktrace(currentEvent, previousEvent)) { + return false; + } + return true; +} +__name(_isSameExceptionEvent, "_isSameExceptionEvent"); +function _isSameStacktrace(currentEvent, previousEvent) { + let currentFrames = getFramesFromEvent(currentEvent); + let previousFrames = getFramesFromEvent(previousEvent); + if (!currentFrames && !previousFrames) { + return true; + } + if (currentFrames && !previousFrames || !currentFrames && previousFrames) { + return false; + } + currentFrames = currentFrames; + previousFrames = previousFrames; + if (previousFrames.length !== currentFrames.length) { + return false; + } + for (let i2 = 0; i2 < previousFrames.length; i2++) { + const frameA = previousFrames[i2]; + const frameB = currentFrames[i2]; + if (frameA.filename !== frameB.filename || frameA.lineno !== frameB.lineno || frameA.colno !== frameB.colno || frameA.function !== frameB.function) { + return false; + } + } + return true; +} +__name(_isSameStacktrace, "_isSameStacktrace"); +function _isSameFingerprint(currentEvent, previousEvent) { + let currentFingerprint = currentEvent.fingerprint; + let previousFingerprint = previousEvent.fingerprint; + if (!currentFingerprint && !previousFingerprint) { + return true; + } + if (currentFingerprint && !previousFingerprint || !currentFingerprint && previousFingerprint) { + return false; + } + currentFingerprint = currentFingerprint; + previousFingerprint = previousFingerprint; + try { + return !!(currentFingerprint.join("") === previousFingerprint.join("")); + } catch (_oO) { + return false; + } +} +__name(_isSameFingerprint, "_isSameFingerprint"); +function _getExceptionFromEvent(event) { + return event.exception && event.exception.values && event.exception.values[0]; +} +__name(_getExceptionFromEvent, "_getExceptionFromEvent"); +const INTEGRATION_NAME$e = "ExtraErrorData"; +const _extraErrorDataIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const { depth = 3, captureErrorCause = true } = options4; + return { + name: INTEGRATION_NAME$e, + processEvent(event, hint, client) { + const { maxValueLength = 250 } = client.getOptions(); + return _enhanceEventWithErrorData(event, hint, depth, captureErrorCause, maxValueLength); + } + }; +}, "_extraErrorDataIntegration"); +const extraErrorDataIntegration = defineIntegration(_extraErrorDataIntegration); +function _enhanceEventWithErrorData(event, hint = {}, depth, captureErrorCause, maxValueLength) { + if (!hint.originalException || !isError(hint.originalException)) { + return event; + } + const exceptionName = hint.originalException.name || hint.originalException.constructor.name; + const errorData = _extractErrorData(hint.originalException, captureErrorCause, maxValueLength); + if (errorData) { + const contexts = { + ...event.contexts + }; + const normalizedErrorData = normalize$2(errorData, depth); + if (isPlainObject$5(normalizedErrorData)) { + addNonEnumerableProperty(normalizedErrorData, "__sentry_skip_normalization__", true); + contexts[exceptionName] = normalizedErrorData; + } + return { + ...event, + contexts + }; + } + return event; +} +__name(_enhanceEventWithErrorData, "_enhanceEventWithErrorData"); +function _extractErrorData(error2, captureErrorCause, maxValueLength) { + try { + const nativeKeys2 = [ + "name", + "message", + "stack", + "line", + "column", + "fileName", + "lineNumber", + "columnNumber", + "toJSON" + ]; + const extraErrorInfo = {}; + for (const key of Object.keys(error2)) { + if (nativeKeys2.indexOf(key) !== -1) { + continue; + } + const value4 = error2[key]; + extraErrorInfo[key] = isError(value4) || typeof value4 === "string" ? truncate(`${value4}`, maxValueLength) : value4; + } + if (captureErrorCause && error2.cause !== void 0) { + extraErrorInfo.cause = isError(error2.cause) ? error2.cause.toString() : error2.cause; + } + if (typeof error2.toJSON === "function") { + const serializedError = error2.toJSON(); + for (const key of Object.keys(serializedError)) { + const value4 = serializedError[key]; + extraErrorInfo[key] = isError(value4) ? value4.toString() : value4; + } + } + return extraErrorInfo; + } catch (oO) { + DEBUG_BUILD$6 && logger$2.error("Unable to extract extra data from the Error object:", oO); + } + return null; +} +__name(_extractErrorData, "_extractErrorData"); +function normalizeArray(parts2, allowAboveRoot) { + let up = 0; + for (let i2 = parts2.length - 1; i2 >= 0; i2--) { + const last = parts2[i2]; + if (last === ".") { + parts2.splice(i2, 1); + } else if (last === "..") { + parts2.splice(i2, 1); + up++; + } else if (up) { + parts2.splice(i2, 1); + up--; + } + } + if (allowAboveRoot) { + for (; up--; up) { + parts2.unshift(".."); + } + } + return parts2; +} +__name(normalizeArray, "normalizeArray"); +const splitPathRe = /^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/; +function splitPath(filename) { + const truncated = filename.length > 1024 ? `${filename.slice(-1024)}` : filename; + const parts2 = splitPathRe.exec(truncated); + return parts2 ? parts2.slice(1) : []; +} +__name(splitPath, "splitPath"); +function resolve$1(...args) { + let resolvedPath = ""; + let resolvedAbsolute = false; + for (let i2 = args.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) { + const path = i2 >= 0 ? args[i2] : "/"; + if (!path) { + continue; + } + resolvedPath = `${path}/${resolvedPath}`; + resolvedAbsolute = path.charAt(0) === "/"; + } + resolvedPath = normalizeArray( + resolvedPath.split("/").filter((p2) => !!p2), + !resolvedAbsolute + ).join("/"); + return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; +} +__name(resolve$1, "resolve$1"); +function trim$1(arr) { + let start2 = 0; + for (; start2 < arr.length; start2++) { + if (arr[start2] !== "") { + break; + } + } + let end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== "") { + break; + } + } + if (start2 > end) { + return []; + } + return arr.slice(start2, end - start2 + 1); +} +__name(trim$1, "trim$1"); +function relative(from2, to) { + from2 = resolve$1(from2).slice(1); + to = resolve$1(to).slice(1); + const fromParts = trim$1(from2.split("/")); + const toParts = trim$1(to.split("/")); + const length = Math.min(fromParts.length, toParts.length); + let samePartsLength = length; + for (let i2 = 0; i2 < length; i2++) { + if (fromParts[i2] !== toParts[i2]) { + samePartsLength = i2; + break; + } + } + let outputParts = []; + for (let i2 = samePartsLength; i2 < fromParts.length; i2++) { + outputParts.push(".."); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join("/"); +} +__name(relative, "relative"); +function normalizePath(path) { + const isPathAbsolute = isAbsolute(path); + const trailingSlash = path.slice(-1) === "/"; + let normalizedPath = normalizeArray( + path.split("/").filter((p2) => !!p2), + !isPathAbsolute + ).join("/"); + if (!normalizedPath && !isPathAbsolute) { + normalizedPath = "."; + } + if (normalizedPath && trailingSlash) { + normalizedPath += "/"; + } + return (isPathAbsolute ? "/" : "") + normalizedPath; +} +__name(normalizePath, "normalizePath"); +function isAbsolute(path) { + return path.charAt(0) === "/"; +} +__name(isAbsolute, "isAbsolute"); +function join$3(...args) { + return normalizePath(args.join("/")); +} +__name(join$3, "join$3"); +function dirname(path) { + const result = splitPath(path); + const root27 = result[0] || ""; + let dir = result[1]; + if (!root27 && !dir) { + return "."; + } + if (dir) { + dir = dir.slice(0, dir.length - 1); + } + return root27 + dir; +} +__name(dirname, "dirname"); +function basename(path, ext) { + let f2 = splitPath(path)[2] || ""; + if (ext && f2.slice(ext.length * -1) === ext) { + f2 = f2.slice(0, f2.length - ext.length); + } + return f2; +} +__name(basename, "basename"); +const INTEGRATION_NAME$d = "RewriteFrames"; +const rewriteFramesIntegration = defineIntegration((options4 = {}) => { + const root27 = options4.root; + const prefix2 = options4.prefix || "app:///"; + const isBrowser2 = "window" in GLOBAL_OBJ && GLOBAL_OBJ.window !== void 0; + const iteratee = options4.iteratee || generateIteratee({ isBrowser: isBrowser2, root: root27, prefix: prefix2 }); + function _processExceptionsEvent(event) { + try { + return { + ...event, + exception: { + ...event.exception, + // The check for this is performed inside `process` call itself, safe to skip here + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + values: event.exception.values.map((value4) => ({ + ...value4, + ...value4.stacktrace && { stacktrace: _processStacktrace(value4.stacktrace) } + })) + } + }; + } catch (_oO) { + return event; + } + } + __name(_processExceptionsEvent, "_processExceptionsEvent"); + function _processStacktrace(stacktrace) { + return { + ...stacktrace, + frames: stacktrace && stacktrace.frames && stacktrace.frames.map((f2) => iteratee(f2)) + }; + } + __name(_processStacktrace, "_processStacktrace"); + return { + name: INTEGRATION_NAME$d, + processEvent(originalEvent) { + let processedEvent = originalEvent; + if (originalEvent.exception && Array.isArray(originalEvent.exception.values)) { + processedEvent = _processExceptionsEvent(processedEvent); + } + return processedEvent; + } + }; +}); +function generateIteratee({ + isBrowser: isBrowser2, + root: root27, + prefix: prefix2 +}) { + return (frame) => { + if (!frame.filename) { + return frame; + } + const isWindowsFrame = /^[a-zA-Z]:\\/.test(frame.filename) || // or the presence of a backslash without a forward slash (which are not allowed on Windows) + frame.filename.includes("\\") && !frame.filename.includes("/"); + const startsWithSlash = /^\//.test(frame.filename); + if (isBrowser2) { + if (root27) { + const oldFilename = frame.filename; + if (oldFilename.indexOf(root27) === 0) { + frame.filename = oldFilename.replace(root27, prefix2); + } + } + } else { + if (isWindowsFrame || startsWithSlash) { + const filename = isWindowsFrame ? frame.filename.replace(/^[a-zA-Z]:/, "").replace(/\\/g, "/") : frame.filename; + const base2 = root27 ? relative(root27, filename) : basename(filename); + frame.filename = `${prefix2}${base2}`; + } + } + return frame; + }; +} +__name(generateIteratee, "generateIteratee"); +const INTEGRATION_NAME$c = "SessionTiming"; +const _sessionTimingIntegration = /* @__PURE__ */ __name(() => { + const startTime = timestampInSeconds() * 1e3; + return { + name: INTEGRATION_NAME$c, + processEvent(event) { + const now2 = timestampInSeconds() * 1e3; + return { + ...event, + extra: { + ...event.extra, + ["session:start"]: startTime, + ["session:duration"]: now2 - startTime, + ["session:end"]: now2 + } + }; + } + }; +}, "_sessionTimingIntegration"); +const sessionTimingIntegration = defineIntegration(_sessionTimingIntegration); +const DEFAULT_LIMIT$1 = 10; +const INTEGRATION_NAME$b = "ZodErrors"; +function originalExceptionIsZodError(originalException) { + return isError(originalException) && originalException.name === "ZodError" && Array.isArray(originalException.errors); +} +__name(originalExceptionIsZodError, "originalExceptionIsZodError"); +function formatIssueTitle(issue) { + return { + ...issue, + path: "path" in issue && Array.isArray(issue.path) ? issue.path.join(".") : void 0, + keys: "keys" in issue ? JSON.stringify(issue.keys) : void 0, + unionErrors: "unionErrors" in issue ? JSON.stringify(issue.unionErrors) : void 0 + }; +} +__name(formatIssueTitle, "formatIssueTitle"); +function formatIssueMessage(zodError) { + const errorKeyMap = /* @__PURE__ */ new Set(); + for (const iss of zodError.issues) { + if (iss.path && iss.path[0]) { + errorKeyMap.add(iss.path[0]); + } + } + const errorKeys = Array.from(errorKeyMap); + return `Failed to validate keys: ${truncate(errorKeys.join(", "), 100)}`; +} +__name(formatIssueMessage, "formatIssueMessage"); +function applyZodErrorsToEvent(limit, event, hint) { + if (!event.exception || !event.exception.values || !hint || !hint.originalException || !originalExceptionIsZodError(hint.originalException) || hint.originalException.issues.length === 0) { + return event; + } + return { + ...event, + exception: { + ...event.exception, + values: [ + { + ...event.exception.values[0], + value: formatIssueMessage(hint.originalException) + }, + ...event.exception.values.slice(1) + ] + }, + extra: { + ...event.extra, + "zoderror.issues": hint.originalException.errors.slice(0, limit).map(formatIssueTitle) + } + }; +} +__name(applyZodErrorsToEvent, "applyZodErrorsToEvent"); +const _zodErrorsIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const limit = options4.limit || DEFAULT_LIMIT$1; + return { + name: INTEGRATION_NAME$b, + processEvent(originalEvent, hint) { + const processedEvent = applyZodErrorsToEvent(limit, originalEvent, hint); + return processedEvent; + } + }; +}, "_zodErrorsIntegration"); +const zodErrorsIntegration = defineIntegration(_zodErrorsIntegration); +const thirdPartyErrorFilterIntegration = defineIntegration((options4) => { + return { + name: "ThirdPartyErrorsFilter", + setup(client) { + client.on("beforeEnvelope", (envelope) => { + forEachEnvelopeItem(envelope, (item3, type) => { + if (type === "event") { + const event = Array.isArray(item3) ? item3[1] : void 0; + if (event) { + stripMetadataFromStackFrames(event); + item3[1] = event; + } + } + }); + }); + client.on("applyFrameMetadata", (event) => { + if (event.type) { + return; + } + const stackParser = client.getOptions().stackParser; + addMetadataToStackFrames(stackParser, event); + }); + }, + processEvent(event) { + const frameKeys = getBundleKeysForAllFramesWithFilenames(event); + if (frameKeys) { + const arrayMethod = options4.behaviour === "drop-error-if-contains-third-party-frames" || options4.behaviour === "apply-tag-if-contains-third-party-frames" ? "some" : "every"; + const behaviourApplies = frameKeys[arrayMethod]((keys2) => !keys2.some((key) => options4.filterKeys.includes(key))); + if (behaviourApplies) { + const shouldDrop = options4.behaviour === "drop-error-if-contains-third-party-frames" || options4.behaviour === "drop-error-if-exclusively-contains-third-party-frames"; + if (shouldDrop) { + return null; + } else { + event.tags = { + ...event.tags, + third_party_code: true + }; + } + } + } + return event; + } + }; +}); +function getBundleKeysForAllFramesWithFilenames(event) { + const frames = getFramesFromEvent(event); + if (!frames) { + return void 0; + } + return frames.filter((frame) => !!frame.filename).map((frame) => { + if (frame.module_metadata) { + return Object.keys(frame.module_metadata).filter((key) => key.startsWith(BUNDLER_PLUGIN_APP_KEY_PREFIX)).map((key) => key.slice(BUNDLER_PLUGIN_APP_KEY_PREFIX.length)); + } + return []; + }); +} +__name(getBundleKeysForAllFramesWithFilenames, "getBundleKeysForAllFramesWithFilenames"); +const BUNDLER_PLUGIN_APP_KEY_PREFIX = "_sentryBundlerPluginAppKey:"; +const COUNTER_METRIC_TYPE = "c"; +const GAUGE_METRIC_TYPE = "g"; +const SET_METRIC_TYPE = "s"; +const DISTRIBUTION_METRIC_TYPE = "d"; +const DEFAULT_BROWSER_FLUSH_INTERVAL = 5e3; +const DEFAULT_FLUSH_INTERVAL = 1e4; +const MAX_WEIGHT = 1e4; +function getMetricsAggregatorForClient$1(client, Aggregator) { + const globalMetricsAggregators = getGlobalSingleton( + "globalMetricsAggregators", + () => /* @__PURE__ */ new WeakMap() + ); + const aggregator = globalMetricsAggregators.get(client); + if (aggregator) { + return aggregator; + } + const newAggregator = new Aggregator(client); + client.on("flush", () => newAggregator.flush()); + client.on("close", () => newAggregator.close()); + globalMetricsAggregators.set(client, newAggregator); + return newAggregator; +} +__name(getMetricsAggregatorForClient$1, "getMetricsAggregatorForClient$1"); +function addToMetricsAggregator(Aggregator, metricType, name2, value4, data25 = {}) { + const client = data25.client || getClient(); + if (!client) { + return; + } + const span = getActiveSpan(); + const rootSpan = span ? getRootSpan(span) : void 0; + const transactionName = rootSpan && spanToJSON(rootSpan).description; + const { unit, tags, timestamp: timestamp2 } = data25; + const { release, environment } = client.getOptions(); + const metricTags = {}; + if (release) { + metricTags.release = release; + } + if (environment) { + metricTags.environment = environment; + } + if (transactionName) { + metricTags.transaction = transactionName; + } + DEBUG_BUILD$6 && logger$2.log(`Adding value of ${value4} to ${metricType} metric ${name2}`); + const aggregator = getMetricsAggregatorForClient$1(client, Aggregator); + aggregator.add(metricType, name2, value4, unit, { ...metricTags, ...tags }, timestamp2); +} +__name(addToMetricsAggregator, "addToMetricsAggregator"); +function increment$2(aggregator, name2, value4 = 1, data25) { + addToMetricsAggregator(aggregator, COUNTER_METRIC_TYPE, name2, ensureNumber(value4), data25); +} +__name(increment$2, "increment$2"); +function distribution$2(aggregator, name2, value4, data25) { + addToMetricsAggregator(aggregator, DISTRIBUTION_METRIC_TYPE, name2, ensureNumber(value4), data25); +} +__name(distribution$2, "distribution$2"); +function timing$2(aggregator, name2, value4, unit = "second", data25) { + if (typeof value4 === "function") { + const startTime = timestampInSeconds(); + return startSpanManual( + { + op: "metrics.timing", + name: name2, + startTime, + onlyIfParent: true + }, + (span) => { + return handleCallbackErrors( + () => value4(), + () => { + }, + () => { + const endTime = timestampInSeconds(); + const timeDiff = endTime - startTime; + distribution$2(aggregator, name2, timeDiff, { ...data25, unit: "second" }); + span.end(endTime); + } + ); + } + ); + } + distribution$2(aggregator, name2, value4, { ...data25, unit }); +} +__name(timing$2, "timing$2"); +function set$7(aggregator, name2, value4, data25) { + addToMetricsAggregator(aggregator, SET_METRIC_TYPE, name2, value4, data25); +} +__name(set$7, "set$7"); +function gauge$2(aggregator, name2, value4, data25) { + addToMetricsAggregator(aggregator, GAUGE_METRIC_TYPE, name2, ensureNumber(value4), data25); +} +__name(gauge$2, "gauge$2"); +const metrics$1 = { + increment: increment$2, + distribution: distribution$2, + set: set$7, + gauge: gauge$2, + timing: timing$2, + /** + * @ignore This is for internal use only. + */ + getMetricsAggregatorForClient: getMetricsAggregatorForClient$1 +}; +function ensureNumber(number2) { + return typeof number2 === "string" ? parseInt(number2) : number2; +} +__name(ensureNumber, "ensureNumber"); +function isProfilingIntegrationWithProfiler(integration) { + return !!integration && typeof integration["_profiler"] !== "undefined" && typeof integration["_profiler"]["start"] === "function" && typeof integration["_profiler"]["stop"] === "function"; +} +__name(isProfilingIntegrationWithProfiler, "isProfilingIntegrationWithProfiler"); +function startProfiler() { + const client = getClient(); + if (!client) { + DEBUG_BUILD$6 && logger$2.warn("No Sentry client available, profiling is not started"); + return; + } + const integration = client.getIntegrationByName("ProfilingIntegration"); + if (!integration) { + DEBUG_BUILD$6 && logger$2.warn("ProfilingIntegration is not available"); + return; + } + if (!isProfilingIntegrationWithProfiler(integration)) { + DEBUG_BUILD$6 && logger$2.warn("Profiler is not available on profiling integration."); + return; + } + integration._profiler.start(); +} +__name(startProfiler, "startProfiler"); +function stopProfiler() { + const client = getClient(); + if (!client) { + DEBUG_BUILD$6 && logger$2.warn("No Sentry client available, profiling is not started"); + return; + } + const integration = client.getIntegrationByName("ProfilingIntegration"); + if (!integration) { + DEBUG_BUILD$6 && logger$2.warn("ProfilingIntegration is not available"); + return; + } + if (!isProfilingIntegrationWithProfiler(integration)) { + DEBUG_BUILD$6 && logger$2.warn("Profiler is not available on profiling integration."); + return; + } + integration._profiler.stop(); +} +__name(stopProfiler, "stopProfiler"); +const profiler = { + startProfiler, + stopProfiler +}; +function getBucketKey(metricType, name2, unit, tags) { + const stringifiedTags = Object.entries(dropUndefinedKeys(tags)).sort((a2, b2) => a2[0].localeCompare(b2[0])); + return `${metricType}${name2}${unit}${stringifiedTags}`; +} +__name(getBucketKey, "getBucketKey"); +function simpleHash(s2) { + let rv = 0; + for (let i2 = 0; i2 < s2.length; i2++) { + const c2 = s2.charCodeAt(i2); + rv = (rv << 5) - rv + c2; + rv &= rv; + } + return rv >>> 0; +} +__name(simpleHash, "simpleHash"); +function serializeMetricBuckets(metricBucketItems) { + let out = ""; + for (const item3 of metricBucketItems) { + const tagEntries = Object.entries(item3.tags); + const maybeTags = tagEntries.length > 0 ? `|#${tagEntries.map(([key, value4]) => `${key}:${value4}`).join(",")}` : ""; + out += `${item3.name}@${item3.unit}:${item3.metric}|${item3.metricType}${maybeTags}|T${item3.timestamp} +`; + } + return out; +} +__name(serializeMetricBuckets, "serializeMetricBuckets"); +function sanitizeUnit(unit) { + return unit.replace(/[^\w]+/gi, "_"); +} +__name(sanitizeUnit, "sanitizeUnit"); +function sanitizeMetricKey(key) { + return key.replace(/[^\w\-.]+/gi, "_"); +} +__name(sanitizeMetricKey, "sanitizeMetricKey"); +function sanitizeTagKey(key) { + return key.replace(/[^\w\-./]+/gi, ""); +} +__name(sanitizeTagKey, "sanitizeTagKey"); +const tagValueReplacements = [ + ["\n", "\\n"], + ["\r", "\\r"], + [" ", "\\t"], + ["\\", "\\\\"], + ["|", "\\u{7c}"], + [",", "\\u{2c}"] +]; +function getCharOrReplacement(input) { + for (const [search2, replacement] of tagValueReplacements) { + if (input === search2) { + return replacement; + } + } + return input; +} +__name(getCharOrReplacement, "getCharOrReplacement"); +function sanitizeTagValue(value4) { + return [...value4].reduce((acc, char) => acc + getCharOrReplacement(char), ""); +} +__name(sanitizeTagValue, "sanitizeTagValue"); +function sanitizeTags(unsanitizedTags) { + const tags = {}; + for (const key in unsanitizedTags) { + if (Object.prototype.hasOwnProperty.call(unsanitizedTags, key)) { + const sanitizedKey = sanitizeTagKey(key); + tags[sanitizedKey] = sanitizeTagValue(String(unsanitizedTags[key])); + } + } + return tags; +} +__name(sanitizeTags, "sanitizeTags"); +function captureAggregateMetrics(client, metricBucketItems) { + logger$2.log(`Flushing aggregated metrics, number of metrics: ${metricBucketItems.length}`); + const dsn = client.getDsn(); + const metadata = client.getSdkMetadata(); + const tunnel = client.getOptions().tunnel; + const metricsEnvelope = createMetricEnvelope(metricBucketItems, dsn, metadata, tunnel); + client.sendEnvelope(metricsEnvelope); +} +__name(captureAggregateMetrics, "captureAggregateMetrics"); +function createMetricEnvelope(metricBucketItems, dsn, metadata, tunnel) { + const headers = { + sent_at: (/* @__PURE__ */ new Date()).toISOString() + }; + if (metadata && metadata.sdk) { + headers.sdk = { + name: metadata.sdk.name, + version: metadata.sdk.version + }; + } + if (!!tunnel && dsn) { + headers.dsn = dsnToString(dsn); + } + const item3 = createMetricEnvelopeItem(metricBucketItems); + return createEnvelope(headers, [item3]); +} +__name(createMetricEnvelope, "createMetricEnvelope"); +function createMetricEnvelopeItem(metricBucketItems) { + const payload = serializeMetricBuckets(metricBucketItems); + const metricHeaders = { + type: "statsd", + length: payload.length + }; + return [metricHeaders, payload]; +} +__name(createMetricEnvelopeItem, "createMetricEnvelopeItem"); +class CounterMetric { + static { + __name(this, "CounterMetric"); + } + constructor(_value) { + this._value = _value; + } + /** @inheritDoc */ + get weight() { + return 1; + } + /** @inheritdoc */ + add(value4) { + this._value += value4; + } + /** @inheritdoc */ + toString() { + return `${this._value}`; + } +} +class GaugeMetric { + static { + __name(this, "GaugeMetric"); + } + constructor(value4) { + this._last = value4; + this._min = value4; + this._max = value4; + this._sum = value4; + this._count = 1; + } + /** @inheritDoc */ + get weight() { + return 5; + } + /** @inheritdoc */ + add(value4) { + this._last = value4; + if (value4 < this._min) { + this._min = value4; + } + if (value4 > this._max) { + this._max = value4; + } + this._sum += value4; + this._count++; + } + /** @inheritdoc */ + toString() { + return `${this._last}:${this._min}:${this._max}:${this._sum}:${this._count}`; + } +} +class DistributionMetric { + static { + __name(this, "DistributionMetric"); + } + constructor(first2) { + this._value = [first2]; + } + /** @inheritDoc */ + get weight() { + return this._value.length; + } + /** @inheritdoc */ + add(value4) { + this._value.push(value4); + } + /** @inheritdoc */ + toString() { + return this._value.join(":"); + } +} +class SetMetric { + static { + __name(this, "SetMetric"); + } + constructor(first2) { + this.first = first2; + this._value = /* @__PURE__ */ new Set([first2]); + } + /** @inheritDoc */ + get weight() { + return this._value.size; + } + /** @inheritdoc */ + add(value4) { + this._value.add(value4); + } + /** @inheritdoc */ + toString() { + return Array.from(this._value).map((val) => typeof val === "string" ? simpleHash(val) : val).join(":"); + } +} +const METRIC_MAP = { + [COUNTER_METRIC_TYPE]: CounterMetric, + [GAUGE_METRIC_TYPE]: GaugeMetric, + [DISTRIBUTION_METRIC_TYPE]: DistributionMetric, + [SET_METRIC_TYPE]: SetMetric +}; +class MetricsAggregator { + static { + __name(this, "MetricsAggregator"); + } + // TODO(@anonrig): Use FinalizationRegistry to have a proper way of flushing the buckets + // when the aggregator is garbage collected. + // Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry + // Different metrics have different weights. We use this to limit the number of metrics + // that we store in memory. + // We adjust the type here to add the `unref()` part, as setInterval can technically return a number or a NodeJS.Timer + // SDKs are required to shift the flush interval by random() * rollup_in_seconds. + // That shift is determined once per startup to create jittering. + // An SDK is required to perform force flushing ahead of scheduled time if the memory + // pressure is too high. There is no rule for this other than that SDKs should be tracking + // abstract aggregation complexity (eg: a counter only carries a single float, whereas a + // distribution is a float per emission). + // + // Force flush is used on either shutdown, flush() or when we exceed the max weight. + constructor(_client) { + this._client = _client; + this._buckets = /* @__PURE__ */ new Map(); + this._bucketsTotalWeight = 0; + this._interval = setInterval(() => this._flush(), DEFAULT_FLUSH_INTERVAL); + if (this._interval.unref) { + this._interval.unref(); + } + this._flushShift = Math.floor(Math.random() * DEFAULT_FLUSH_INTERVAL / 1e3); + this._forceFlush = false; + } + /** + * @inheritDoc + */ + add(metricType, unsanitizedName, value4, unsanitizedUnit = "none", unsanitizedTags = {}, maybeFloatTimestamp = timestampInSeconds()) { + const timestamp2 = Math.floor(maybeFloatTimestamp); + const name2 = sanitizeMetricKey(unsanitizedName); + const tags = sanitizeTags(unsanitizedTags); + const unit = sanitizeUnit(unsanitizedUnit); + const bucketKey = getBucketKey(metricType, name2, unit, tags); + let bucketItem = this._buckets.get(bucketKey); + const previousWeight = bucketItem && metricType === SET_METRIC_TYPE ? bucketItem.metric.weight : 0; + if (bucketItem) { + bucketItem.metric.add(value4); + if (bucketItem.timestamp < timestamp2) { + bucketItem.timestamp = timestamp2; + } + } else { + bucketItem = { + // @ts-expect-error we don't need to narrow down the type of value here, saves bundle size. + metric: new METRIC_MAP[metricType](value4), + timestamp: timestamp2, + metricType, + name: name2, + unit, + tags + }; + this._buckets.set(bucketKey, bucketItem); + } + const val = typeof value4 === "string" ? bucketItem.metric.weight - previousWeight : value4; + updateMetricSummaryOnActiveSpan(metricType, name2, val, unit, unsanitizedTags, bucketKey); + this._bucketsTotalWeight += bucketItem.metric.weight; + if (this._bucketsTotalWeight >= MAX_WEIGHT) { + this.flush(); + } + } + /** + * Flushes the current metrics to the transport via the transport. + */ + flush() { + this._forceFlush = true; + this._flush(); + } + /** + * Shuts down metrics aggregator and clears all metrics. + */ + close() { + this._forceFlush = true; + clearInterval(this._interval); + this._flush(); + } + /** + * Flushes the buckets according to the internal state of the aggregator. + * If it is a force flush, which happens on shutdown, it will flush all buckets. + * Otherwise, it will only flush buckets that are older than the flush interval, + * and according to the flush shift. + * + * This function mutates `_forceFlush` and `_bucketsTotalWeight` properties. + */ + _flush() { + if (this._forceFlush) { + this._forceFlush = false; + this._bucketsTotalWeight = 0; + this._captureMetrics(this._buckets); + this._buckets.clear(); + return; + } + const cutoffSeconds = Math.floor(timestampInSeconds()) - DEFAULT_FLUSH_INTERVAL / 1e3 - this._flushShift; + const flushedBuckets = /* @__PURE__ */ new Map(); + for (const [key, bucket] of this._buckets) { + if (bucket.timestamp <= cutoffSeconds) { + flushedBuckets.set(key, bucket); + this._bucketsTotalWeight -= bucket.metric.weight; + } + } + for (const [key] of flushedBuckets) { + this._buckets.delete(key); + } + this._captureMetrics(flushedBuckets); + } + /** + * Only captures a subset of the buckets passed to this function. + * @param flushedBuckets + */ + _captureMetrics(flushedBuckets) { + if (flushedBuckets.size > 0) { + const buckets = Array.from(flushedBuckets).map(([, bucketItem]) => bucketItem); + captureAggregateMetrics(this._client, buckets); + } + } +} +function increment$1(name2, value4 = 1, data25) { + metrics$1.increment(MetricsAggregator, name2, value4, data25); +} +__name(increment$1, "increment$1"); +function distribution$1(name2, value4, data25) { + metrics$1.distribution(MetricsAggregator, name2, value4, data25); +} +__name(distribution$1, "distribution$1"); +function set$6(name2, value4, data25) { + metrics$1.set(MetricsAggregator, name2, value4, data25); +} +__name(set$6, "set$6"); +function gauge$1(name2, value4, data25) { + metrics$1.gauge(MetricsAggregator, name2, value4, data25); +} +__name(gauge$1, "gauge$1"); +function timing$1(name2, value4, unit = "second", data25) { + return metrics$1.timing(MetricsAggregator, name2, value4, unit, data25); +} +__name(timing$1, "timing$1"); +function getMetricsAggregatorForClient(client) { + return metrics$1.getMetricsAggregatorForClient(client, MetricsAggregator); +} +__name(getMetricsAggregatorForClient, "getMetricsAggregatorForClient"); +const metricsDefault = { + increment: increment$1, + distribution: distribution$1, + set: set$6, + gauge: gauge$1, + timing: timing$1, + /** + * @ignore This is for internal use only. + */ + getMetricsAggregatorForClient +}; +class BrowserMetricsAggregator { + static { + __name(this, "BrowserMetricsAggregator"); + } + // TODO(@anonrig): Use FinalizationRegistry to have a proper way of flushing the buckets + // when the aggregator is garbage collected. + // Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry + constructor(_client) { + this._client = _client; + this._buckets = /* @__PURE__ */ new Map(); + this._interval = setInterval(() => this.flush(), DEFAULT_BROWSER_FLUSH_INTERVAL); + } + /** + * @inheritDoc + */ + add(metricType, unsanitizedName, value4, unsanitizedUnit = "none", unsanitizedTags = {}, maybeFloatTimestamp = timestampInSeconds()) { + const timestamp2 = Math.floor(maybeFloatTimestamp); + const name2 = sanitizeMetricKey(unsanitizedName); + const tags = sanitizeTags(unsanitizedTags); + const unit = sanitizeUnit(unsanitizedUnit); + const bucketKey = getBucketKey(metricType, name2, unit, tags); + let bucketItem = this._buckets.get(bucketKey); + const previousWeight = bucketItem && metricType === SET_METRIC_TYPE ? bucketItem.metric.weight : 0; + if (bucketItem) { + bucketItem.metric.add(value4); + if (bucketItem.timestamp < timestamp2) { + bucketItem.timestamp = timestamp2; + } + } else { + bucketItem = { + // @ts-expect-error we don't need to narrow down the type of value here, saves bundle size. + metric: new METRIC_MAP[metricType](value4), + timestamp: timestamp2, + metricType, + name: name2, + unit, + tags + }; + this._buckets.set(bucketKey, bucketItem); + } + const val = typeof value4 === "string" ? bucketItem.metric.weight - previousWeight : value4; + updateMetricSummaryOnActiveSpan(metricType, name2, val, unit, unsanitizedTags, bucketKey); + } + /** + * @inheritDoc + */ + flush() { + if (this._buckets.size === 0) { + return; + } + const metricBuckets = Array.from(this._buckets.values()); + captureAggregateMetrics(this._client, metricBuckets); + this._buckets.clear(); + } + /** + * @inheritDoc + */ + close() { + clearInterval(this._interval); + this.flush(); + } +} +function instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeaders2, spans, spanOrigin = "auto.http.browser") { + if (!handlerData.fetchData) { + return void 0; + } + const shouldCreateSpanResult = hasTracingEnabled() && shouldCreateSpan(handlerData.fetchData.url); + if (handlerData.endTimestamp && shouldCreateSpanResult) { + const spanId = handlerData.fetchData.__span; + if (!spanId) return; + const span2 = spans[spanId]; + if (span2) { + endSpan(span2, handlerData); + delete spans[spanId]; + } + return void 0; + } + const { method, url } = handlerData.fetchData; + const fullUrl = getFullURL$1(url); + const host = fullUrl ? parseUrl$1(fullUrl).host : void 0; + const hasParent = !!getActiveSpan(); + const span = shouldCreateSpanResult && hasParent ? startInactiveSpan({ + name: `${method} ${url}`, + attributes: { + url, + type: "fetch", + "http.method": method, + "http.url": fullUrl, + "server.address": host, + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin, + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: "http.client" + } + }) : new SentryNonRecordingSpan(); + handlerData.fetchData.__span = span.spanContext().spanId; + spans[span.spanContext().spanId] = span; + if (shouldAttachHeaders2(handlerData.fetchData.url)) { + const request = handlerData.args[0]; + const options4 = handlerData.args[1] || {}; + const headers = _addTracingHeadersToFetchRequest( + request, + options4, + // If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction), + // we do not want to use the span as base for the trace headers, + // which means that the headers will be generated from the scope and the sampling decision is deferred + hasTracingEnabled() && hasParent ? span : void 0 + ); + if (headers) { + handlerData.args[1] = options4; + options4.headers = headers; + } + } + return span; +} +__name(instrumentFetchRequest, "instrumentFetchRequest"); +function _addTracingHeadersToFetchRequest(request, fetchOptionsObj, span) { + const traceHeaders = getTraceData({ span }); + const sentryTrace = traceHeaders["sentry-trace"]; + const baggage = traceHeaders.baggage; + if (!sentryTrace) { + return void 0; + } + const headers = fetchOptionsObj.headers || (isRequest$1(request) ? request.headers : void 0); + if (!headers) { + return { ...traceHeaders }; + } else if (isHeaders$1(headers)) { + const newHeaders = new Headers(headers); + newHeaders.set("sentry-trace", sentryTrace); + if (baggage) { + const prevBaggageHeader = newHeaders.get("baggage"); + if (prevBaggageHeader) { + const prevHeaderStrippedFromSentryBaggage = stripBaggageHeaderOfSentryBaggageValues(prevBaggageHeader); + newHeaders.set( + "baggage", + // If there are non-sentry entries (i.e. if the stripped string is non-empty/truthy) combine the stripped header and sentry baggage header + // otherwise just set the sentry baggage header + prevHeaderStrippedFromSentryBaggage ? `${prevHeaderStrippedFromSentryBaggage},${baggage}` : baggage + ); + } else { + newHeaders.set("baggage", baggage); + } + } + return newHeaders; + } else if (Array.isArray(headers)) { + const newHeaders = [ + ...headers.filter((header3) => { + return !(Array.isArray(header3) && header3[0] === "sentry-trace"); + }).map((header3) => { + if (Array.isArray(header3) && header3[0] === "baggage" && typeof header3[1] === "string") { + const [headerName, headerValue, ...rest] = header3; + return [headerName, stripBaggageHeaderOfSentryBaggageValues(headerValue), ...rest]; + } else { + return header3; + } + }), + // Attach the new sentry-trace header + ["sentry-trace", sentryTrace] + ]; + if (baggage) { + newHeaders.push(["baggage", baggage]); + } + return newHeaders; + } else { + const existingBaggageHeader = "baggage" in headers ? headers.baggage : void 0; + let newBaggageHeaders = []; + if (Array.isArray(existingBaggageHeader)) { + newBaggageHeaders = existingBaggageHeader.map( + (headerItem) => typeof headerItem === "string" ? stripBaggageHeaderOfSentryBaggageValues(headerItem) : headerItem + ).filter((headerItem) => headerItem === ""); + } else if (existingBaggageHeader) { + newBaggageHeaders.push(stripBaggageHeaderOfSentryBaggageValues(existingBaggageHeader)); + } + if (baggage) { + newBaggageHeaders.push(baggage); + } + return { + ...headers, + "sentry-trace": sentryTrace, + baggage: newBaggageHeaders.length > 0 ? newBaggageHeaders.join(",") : void 0 + }; + } +} +__name(_addTracingHeadersToFetchRequest, "_addTracingHeadersToFetchRequest"); +function addTracingHeadersToFetchRequest(request, _client, _scope, fetchOptionsObj, span) { + return _addTracingHeadersToFetchRequest(request, fetchOptionsObj, span); +} +__name(addTracingHeadersToFetchRequest, "addTracingHeadersToFetchRequest"); +function getFullURL$1(url) { + try { + const parsed = new URL(url); + return parsed.href; + } catch (e2) { + return void 0; + } +} +__name(getFullURL$1, "getFullURL$1"); +function endSpan(span, handlerData) { + if (handlerData.response) { + setHttpStatus(span, handlerData.response.status); + const contentLength = handlerData.response && handlerData.response.headers && handlerData.response.headers.get("content-length"); + if (contentLength) { + const contentLengthNum = parseInt(contentLength); + if (contentLengthNum > 0) { + span.setAttribute("http.response_content_length", contentLengthNum); + } + } + } else if (handlerData.error) { + span.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" }); + } + span.end(); +} +__name(endSpan, "endSpan"); +function stripBaggageHeaderOfSentryBaggageValues(baggageHeader) { + return baggageHeader.split(",").filter((baggageEntry) => !baggageEntry.split("=")[0].startsWith(SENTRY_BAGGAGE_KEY_PREFIX)).join(","); +} +__name(stripBaggageHeaderOfSentryBaggageValues, "stripBaggageHeaderOfSentryBaggageValues"); +function isRequest$1(request) { + return typeof Request !== "undefined" && isInstanceOf(request, Request); +} +__name(isRequest$1, "isRequest$1"); +function isHeaders$1(headers) { + return typeof Headers !== "undefined" && isInstanceOf(headers, Headers); +} +__name(isHeaders$1, "isHeaders$1"); +const trpcCaptureContext = { mechanism: { handled: false, data: { function: "trpcMiddleware" } } }; +function captureIfError(nextResult) { + if (typeof nextResult === "object" && nextResult !== null && "ok" in nextResult && !nextResult.ok && "error" in nextResult) { + captureException(nextResult.error, trpcCaptureContext); + } +} +__name(captureIfError, "captureIfError"); +function trpcMiddleware(options4 = {}) { + return async function(opts) { + const { path, type, next: next2, rawInput, getRawInput } = opts; + const client = getClient(); + const clientOptions = client && client.getOptions(); + const trpcContext = { + procedure_path: path, + procedure_type: type + }; + if (options4.attachRpcInput !== void 0 ? options4.attachRpcInput : clientOptions && clientOptions.sendDefaultPii) { + if (rawInput !== void 0) { + trpcContext.input = normalize$2(rawInput); + } + if (getRawInput !== void 0 && typeof getRawInput === "function") { + try { + const rawRes = await getRawInput(); + trpcContext.input = normalize$2(rawRes); + } catch (err) { + } + } + } + return withScope((scope) => { + scope.setContext("trpc", trpcContext); + return startSpanManual( + { + name: `trpc/${path}`, + op: "rpc.server", + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "route", + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.rpc.trpc" + } + }, + async (span) => { + try { + const nextResult = await next2(); + captureIfError(nextResult); + span.end(); + return nextResult; + } catch (e2) { + captureException(e2, trpcCaptureContext); + span.end(); + throw e2; + } + } + ); + }); + }; +} +__name(trpcMiddleware, "trpcMiddleware"); +function captureFeedback(params, hint = {}, scope = getCurrentScope$1()) { + const { message: message3, name: name2, email, url, source, associatedEventId, tags } = params; + const feedbackEvent = { + contexts: { + feedback: dropUndefinedKeys({ + contact_email: email, + name: name2, + message: message3, + url, + source, + associated_event_id: associatedEventId + }) + }, + type: "feedback", + level: "info", + tags + }; + const client = scope && scope.getClient() || getClient(); + if (client) { + client.emit("beforeSendFeedback", feedbackEvent, hint); + } + const eventId = scope.captureEvent(feedbackEvent, hint); + return eventId; +} +__name(captureFeedback, "captureFeedback"); +function getCurrentHubShim() { + return { + bindClient(client) { + const scope = getCurrentScope$1(); + scope.setClient(client); + }, + withScope, + getClient: /* @__PURE__ */ __name(() => getClient(), "getClient"), + getScope: getCurrentScope$1, + getIsolationScope, + captureException: /* @__PURE__ */ __name((exception, hint) => { + return getCurrentScope$1().captureException(exception, hint); + }, "captureException"), + captureMessage: /* @__PURE__ */ __name((message3, level, hint) => { + return getCurrentScope$1().captureMessage(message3, level, hint); + }, "captureMessage"), + captureEvent, + addBreadcrumb, + setUser, + setTags, + setTag: setTag$5, + setExtra, + setExtras, + setContext, + getIntegration(integration) { + const client = getClient(); + return client && client.getIntegrationByName(integration.id) || null; + }, + startSession, + endSession, + captureSession(end) { + if (end) { + return endSession(); + } + _sendSessionUpdate(); + } + }; +} +__name(getCurrentHubShim, "getCurrentHubShim"); +const getCurrentHub = getCurrentHubShim; +function _sendSessionUpdate() { + const scope = getCurrentScope$1(); + const client = getClient(); + const session = scope.getSession(); + if (client && session) { + client.captureSession(session); + } +} +__name(_sendSessionUpdate, "_sendSessionUpdate"); +function flatten(input) { + const result = []; + const flattenHelper = /* @__PURE__ */ __name((input2) => { + input2.forEach((el) => { + if (Array.isArray(el)) { + flattenHelper(el); + } else { + result.push(el); + } + }); + }, "flattenHelper"); + flattenHelper(input); + return result; +} +__name(flatten, "flatten"); +function getBreadcrumbLogLevelFromHttpStatusCode(statusCode) { + if (statusCode === void 0) { + return void 0; + } else if (statusCode >= 400 && statusCode < 500) { + return "warning"; + } else if (statusCode >= 500) { + return "error"; + } else { + return void 0; + } +} +__name(getBreadcrumbLogLevelFromHttpStatusCode, "getBreadcrumbLogLevelFromHttpStatusCode"); +const WINDOW$7 = GLOBAL_OBJ; +function supportsErrorEvent() { + try { + new ErrorEvent(""); + return true; + } catch (e2) { + return false; + } +} +__name(supportsErrorEvent, "supportsErrorEvent"); +function supportsDOMError() { + try { + new DOMError(""); + return true; + } catch (e2) { + return false; + } +} +__name(supportsDOMError, "supportsDOMError"); +function supportsDOMException() { + try { + new DOMException(""); + return true; + } catch (e2) { + return false; + } +} +__name(supportsDOMException, "supportsDOMException"); +function supportsFetch() { + if (!("fetch" in WINDOW$7)) { + return false; + } + try { + new Headers(); + new Request("http://www.example.com"); + new Response(); + return true; + } catch (e2) { + return false; + } +} +__name(supportsFetch, "supportsFetch"); +function isNativeFunction(func) { + return func && /^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(func.toString()); +} +__name(isNativeFunction, "isNativeFunction"); +function supportsNativeFetch() { + if (typeof EdgeRuntime === "string") { + return true; + } + if (!supportsFetch()) { + return false; + } + if (isNativeFunction(WINDOW$7.fetch)) { + return true; + } + let result = false; + const doc2 = WINDOW$7.document; + if (doc2 && typeof doc2.createElement === "function") { + try { + const sandbox = doc2.createElement("iframe"); + sandbox.hidden = true; + doc2.head.appendChild(sandbox); + if (sandbox.contentWindow && sandbox.contentWindow.fetch) { + result = isNativeFunction(sandbox.contentWindow.fetch); + } + doc2.head.removeChild(sandbox); + } catch (err) { + DEBUG_BUILD$5 && logger$2.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ", err); + } + } + return result; +} +__name(supportsNativeFetch, "supportsNativeFetch"); +function supportsReportingObserver() { + return "ReportingObserver" in WINDOW$7; +} +__name(supportsReportingObserver, "supportsReportingObserver"); +function supportsReferrerPolicy() { + if (!supportsFetch()) { + return false; + } + try { + new Request("_", { + referrerPolicy: "origin" + }); + return true; + } catch (e2) { + return false; + } +} +__name(supportsReferrerPolicy, "supportsReferrerPolicy"); +function addFetchInstrumentationHandler(handler6, skipNativeFetchCheck) { + const type = "fetch"; + addHandler$1(type, handler6); + maybeInstrument(type, () => instrumentFetch(void 0, skipNativeFetchCheck)); +} +__name(addFetchInstrumentationHandler, "addFetchInstrumentationHandler"); +function addFetchEndInstrumentationHandler(handler6) { + const type = "fetch-body-resolved"; + addHandler$1(type, handler6); + maybeInstrument(type, () => instrumentFetch(streamHandler)); +} +__name(addFetchEndInstrumentationHandler, "addFetchEndInstrumentationHandler"); +function instrumentFetch(onFetchResolved, skipNativeFetchCheck = false) { + if (skipNativeFetchCheck && !supportsNativeFetch()) { + return; + } + fill(GLOBAL_OBJ, "fetch", function(originalFetch) { + return function(...args) { + const virtualError = new Error(); + const { method, url } = parseFetchArgs(args); + const handlerData = { + args, + fetchData: { + method, + url + }, + startTimestamp: timestampInSeconds() * 1e3, + // // Adding the error to be able to fingerprint the failed fetch event in HttpClient instrumentation + virtualError + }; + if (!onFetchResolved) { + triggerHandlers$1("fetch", { + ...handlerData + }); + } + return originalFetch.apply(GLOBAL_OBJ, args).then( + async (response) => { + if (onFetchResolved) { + onFetchResolved(response); + } else { + triggerHandlers$1("fetch", { + ...handlerData, + endTimestamp: timestampInSeconds() * 1e3, + response + }); + } + return response; + }, + (error2) => { + triggerHandlers$1("fetch", { + ...handlerData, + endTimestamp: timestampInSeconds() * 1e3, + error: error2 + }); + if (isError(error2) && error2.stack === void 0) { + error2.stack = virtualError.stack; + addNonEnumerableProperty(error2, "framesToPop", 1); + } + throw error2; + } + ); + }; + }); +} +__name(instrumentFetch, "instrumentFetch"); +async function resolveResponse(res, onFinishedResolving) { + if (res && res.body) { + const body = res.body; + const responseReader = body.getReader(); + const maxFetchDurationTimeout = setTimeout( + () => { + body.cancel().then(null, () => { + }); + }, + 90 * 1e3 + // 90s + ); + let readingActive = true; + while (readingActive) { + let chunkTimeout; + try { + chunkTimeout = setTimeout(() => { + body.cancel().then(null, () => { + }); + }, 5e3); + const { done } = await responseReader.read(); + clearTimeout(chunkTimeout); + if (done) { + onFinishedResolving(); + readingActive = false; + } + } catch (error2) { + readingActive = false; + } finally { + clearTimeout(chunkTimeout); + } + } + clearTimeout(maxFetchDurationTimeout); + responseReader.releaseLock(); + body.cancel().then(null, () => { + }); + } +} +__name(resolveResponse, "resolveResponse"); +function streamHandler(response) { + let clonedResponseForResolving; + try { + clonedResponseForResolving = response.clone(); + } catch (e2) { + return; + } + resolveResponse(clonedResponseForResolving, () => { + triggerHandlers$1("fetch-body-resolved", { + endTimestamp: timestampInSeconds() * 1e3, + response + }); + }); +} +__name(streamHandler, "streamHandler"); +function hasProp(obj, prop2) { + return !!obj && typeof obj === "object" && !!obj[prop2]; +} +__name(hasProp, "hasProp"); +function getUrlFromResource(resource) { + if (typeof resource === "string") { + return resource; + } + if (!resource) { + return ""; + } + if (hasProp(resource, "url")) { + return resource.url; + } + if (resource.toString) { + return resource.toString(); + } + return ""; +} +__name(getUrlFromResource, "getUrlFromResource"); +function parseFetchArgs(fetchArgs) { + if (fetchArgs.length === 0) { + return { method: "GET", url: "" }; + } + if (fetchArgs.length === 2) { + const [url, options4] = fetchArgs; + return { + url: getUrlFromResource(url), + method: hasProp(options4, "method") ? String(options4.method).toUpperCase() : "GET" + }; + } + const arg = fetchArgs[0]; + return { + url: getUrlFromResource(arg), + method: hasProp(arg, "method") ? String(arg.method).toUpperCase() : "GET" + }; +} +__name(parseFetchArgs, "parseFetchArgs"); +function isBrowserBundle() { + return typeof __SENTRY_BROWSER_BUNDLE__ !== "undefined" && !!__SENTRY_BROWSER_BUNDLE__; +} +__name(isBrowserBundle, "isBrowserBundle"); +function getSDKSource() { + return "npm"; +} +__name(getSDKSource, "getSDKSource"); +function isNodeEnv() { + return !isBrowserBundle() && Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]"; +} +__name(isNodeEnv, "isNodeEnv"); +function dynamicRequire(mod, request) { + return mod.require(request); +} +__name(dynamicRequire, "dynamicRequire"); +function loadModule(moduleName) { + let mod; + try { + mod = dynamicRequire(module, moduleName); + } catch (e2) { + } + if (!mod) { + try { + const { cwd } = dynamicRequire(module, "process"); + mod = dynamicRequire(module, `${cwd()}/node_modules/${moduleName}`); + } catch (e2) { + } + } + return mod; +} +__name(loadModule, "loadModule"); +function isBrowser$1() { + return typeof window !== "undefined" && (!isNodeEnv() || isElectronNodeRenderer()); +} +__name(isBrowser$1, "isBrowser$1"); +function isElectronNodeRenderer() { + const process2 = GLOBAL_OBJ.process; + return !!process2 && process2.type === "renderer"; +} +__name(isElectronNodeRenderer, "isElectronNodeRenderer"); +function filenameIsInApp(filename, isNative = false) { + const isInternal = isNative || filename && // It's not internal if it's an absolute linux path + !filename.startsWith("/") && // It's not internal if it's an absolute windows path + !filename.match(/^[A-Z]:/) && // It's not internal if the path is starting with a dot + !filename.startsWith(".") && // It's not internal if the frame has a protocol. In node, this is usually the case if the file got pre-processed with a bundler like webpack + !filename.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//); + return !isInternal && filename !== void 0 && !filename.includes("node_modules/"); +} +__name(filenameIsInApp, "filenameIsInApp"); +function node(getModule) { + const FILENAME_MATCH = /^\s*[-]{4,}$/; + const FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/; + return (line) => { + const lineMatch = line.match(FULL_MATCH); + if (lineMatch) { + let object; + let method; + let functionName; + let typeName; + let methodName; + if (lineMatch[1]) { + functionName = lineMatch[1]; + let methodStart = functionName.lastIndexOf("."); + if (functionName[methodStart - 1] === ".") { + methodStart--; + } + if (methodStart > 0) { + object = functionName.slice(0, methodStart); + method = functionName.slice(methodStart + 1); + const objectEnd = object.indexOf(".Module"); + if (objectEnd > 0) { + functionName = functionName.slice(objectEnd + 1); + object = object.slice(0, objectEnd); + } + } + typeName = void 0; + } + if (method) { + typeName = object; + methodName = method; + } + if (method === "") { + methodName = void 0; + functionName = void 0; + } + if (functionName === void 0) { + methodName = methodName || UNKNOWN_FUNCTION; + functionName = typeName ? `${typeName}.${methodName}` : methodName; + } + let filename = lineMatch[2] && lineMatch[2].startsWith("file://") ? lineMatch[2].slice(7) : lineMatch[2]; + const isNative = lineMatch[5] === "native"; + if (filename && filename.match(/\/[A-Z]:/)) { + filename = filename.slice(1); + } + if (!filename && lineMatch[5] && !isNative) { + filename = lineMatch[5]; + } + return { + filename: filename ? decodeURI(filename) : void 0, + module: getModule ? getModule(filename) : void 0, + function: functionName, + lineno: _parseIntOrUndefined(lineMatch[3]), + colno: _parseIntOrUndefined(lineMatch[4]), + in_app: filenameIsInApp(filename || "", isNative) + }; + } + if (line.match(FILENAME_MATCH)) { + return { + filename: line + }; + } + return void 0; + }; +} +__name(node, "node"); +function nodeStackLineParser(getModule) { + return [90, node(getModule)]; +} +__name(nodeStackLineParser, "nodeStackLineParser"); +function _parseIntOrUndefined(input) { + return parseInt(input || "", 10) || void 0; +} +__name(_parseIntOrUndefined, "_parseIntOrUndefined"); +function makeFifoCache(size2) { + let evictionOrder = []; + let cache2 = {}; + return { + add(key, value4) { + while (evictionOrder.length >= size2) { + const evictCandidate = evictionOrder.shift(); + if (evictCandidate !== void 0) { + delete cache2[evictCandidate]; + } + } + if (cache2[key]) { + this.delete(key); + } + evictionOrder.push(key); + cache2[key] = value4; + }, + clear() { + cache2 = {}; + evictionOrder = []; + }, + get(key) { + return cache2[key]; + }, + size() { + return evictionOrder.length; + }, + // Delete cache key and return true if it existed, false otherwise. + delete(key) { + if (!cache2[key]) { + return false; + } + delete cache2[key]; + for (let i2 = 0; i2 < evictionOrder.length; i2++) { + if (evictionOrder[i2] === key) { + evictionOrder.splice(i2, 1); + break; + } + } + return true; + } + }; +} +__name(makeFifoCache, "makeFifoCache"); +function watchdogTimer(createTimer, pollInterval, anrThreshold, callback) { + const timer = createTimer(); + let triggered = false; + let enabled = true; + setInterval(() => { + const diffMs = timer.getTimeMs(); + if (triggered === false && diffMs > pollInterval + anrThreshold) { + triggered = true; + if (enabled) { + callback(); + } + } + if (diffMs < pollInterval + anrThreshold) { + triggered = false; + } + }, 20); + return { + poll: /* @__PURE__ */ __name(() => { + timer.reset(); + }, "poll"), + enabled: /* @__PURE__ */ __name((state) => { + enabled = state; + }, "enabled") + }; +} +__name(watchdogTimer, "watchdogTimer"); +function callFrameToStackFrame(frame, url, getModuleFromFilename) { + const filename = url ? url.replace(/^file:\/\//, "") : void 0; + const colno = frame.location.columnNumber ? frame.location.columnNumber + 1 : void 0; + const lineno = frame.location.lineNumber ? frame.location.lineNumber + 1 : void 0; + return dropUndefinedKeys({ + filename, + module: getModuleFromFilename(filename), + function: frame.functionName || UNKNOWN_FUNCTION, + colno, + lineno, + in_app: filename ? filenameIsInApp(filename) : void 0 + }); +} +__name(callFrameToStackFrame, "callFrameToStackFrame"); +class LRUMap { + static { + __name(this, "LRUMap"); + } + constructor(_maxSize) { + this._maxSize = _maxSize; + this._cache = /* @__PURE__ */ new Map(); + } + /** Get the current size of the cache */ + get size() { + return this._cache.size; + } + /** Get an entry or undefined if it was not in the cache. Re-inserts to update the recently used order */ + get(key) { + const value4 = this._cache.get(key); + if (value4 === void 0) { + return void 0; + } + this._cache.delete(key); + this._cache.set(key, value4); + return value4; + } + /** Insert an entry and evict an older entry if we've reached maxSize */ + set(key, value4) { + if (this._cache.size >= this._maxSize) { + this._cache.delete(this._cache.keys().next().value); + } + this._cache.set(key, value4); + } + /** Remove an entry and return the entry if it was in the cache */ + remove(key) { + const value4 = this._cache.get(key); + if (value4) { + this._cache.delete(key); + } + return value4; + } + /** Clear all entries */ + clear() { + this._cache.clear(); + } + /** Get all the keys */ + keys() { + return Array.from(this._cache.keys()); + } + /** Get all the values */ + values() { + const values = []; + this._cache.forEach((value4) => values.push(value4)); + return values; + } +} +function vercelWaitUntil(task) { + const vercelRequestContextGlobal = ( + // @ts-expect-error This is not typed + GLOBAL_OBJ[Symbol.for("@vercel/request-context")] + ); + const ctx = vercelRequestContextGlobal && vercelRequestContextGlobal.get && vercelRequestContextGlobal.get() ? vercelRequestContextGlobal.get() : {}; + if (ctx && ctx.waitUntil) { + ctx.waitUntil(task); + } +} +__name(vercelWaitUntil, "vercelWaitUntil"); +function escapeStringForRegex(regexString) { + return regexString.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); +} +__name(escapeStringForRegex, "escapeStringForRegex"); +const WINDOW$6 = GLOBAL_OBJ; +function supportsHistory() { + const chromeVar = WINDOW$6.chrome; + const isChromePackagedApp = chromeVar && chromeVar.app && chromeVar.app.runtime; + const hasHistoryApi = "history" in WINDOW$6 && !!WINDOW$6.history.pushState && !!WINDOW$6.history.replaceState; + return !isChromePackagedApp && hasHistoryApi; +} +__name(supportsHistory, "supportsHistory"); +function _nullishCoalesce(lhs, rhsFn) { + return lhs != null ? lhs : rhsFn(); +} +__name(_nullishCoalesce, "_nullishCoalesce"); +async function _asyncNullishCoalesce(lhs, rhsFn) { + return _nullishCoalesce(lhs, rhsFn); +} +__name(_asyncNullishCoalesce, "_asyncNullishCoalesce"); +async function _asyncOptionalChain(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = await fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = await fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_asyncOptionalChain, "_asyncOptionalChain"); +async function _asyncOptionalChainDelete(ops) { + const result = await _asyncOptionalChain(ops); + return result == null ? true : result; +} +__name(_asyncOptionalChainDelete, "_asyncOptionalChainDelete"); +function _optionalChain(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_optionalChain, "_optionalChain"); +function _optionalChainDelete(ops) { + const result = _optionalChain(ops); + return result == null ? true : result; +} +__name(_optionalChainDelete, "_optionalChainDelete"); +const WINDOW$5 = GLOBAL_OBJ; +let ignoreOnError = 0; +function shouldIgnoreOnError() { + return ignoreOnError > 0; +} +__name(shouldIgnoreOnError, "shouldIgnoreOnError"); +function ignoreNextOnError() { + ignoreOnError++; + setTimeout(() => { + ignoreOnError--; + }); +} +__name(ignoreNextOnError, "ignoreNextOnError"); +function wrap$1(fn, options4 = {}) { + function isFunction2(fn2) { + return typeof fn2 === "function"; + } + __name(isFunction2, "isFunction"); + if (!isFunction2(fn)) { + return fn; + } + try { + const wrapper = fn.__sentry_wrapped__; + if (wrapper) { + if (typeof wrapper === "function") { + return wrapper; + } else { + return fn; + } + } + if (getOriginalFunction(fn)) { + return fn; + } + } catch (e2) { + return fn; + } + const sentryWrapped = /* @__PURE__ */ __name(function(...args) { + try { + const wrappedArguments = args.map((arg) => wrap$1(arg, options4)); + return fn.apply(this, wrappedArguments); + } catch (ex) { + ignoreNextOnError(); + withScope((scope) => { + scope.addEventProcessor((event) => { + if (options4.mechanism) { + addExceptionTypeValue(event, void 0, void 0); + addExceptionMechanism(event, options4.mechanism); + } + event.extra = { + ...event.extra, + arguments: args + }; + return event; + }); + captureException(ex); + }); + throw ex; + } + }, "sentryWrapped"); + try { + for (const property in fn) { + if (Object.prototype.hasOwnProperty.call(fn, property)) { + sentryWrapped[property] = fn[property]; + } + } + } catch (e2) { + } + markFunctionWrapped(sentryWrapped, fn); + addNonEnumerableProperty(fn, "__sentry_wrapped__", sentryWrapped); + try { + const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, "name"); + if (descriptor.configurable) { + Object.defineProperty(sentryWrapped, "name", { + get() { + return fn.name; + } + }); + } + } catch (e3) { + } + return sentryWrapped; +} +__name(wrap$1, "wrap$1"); +const DEBUG_BUILD$4 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +function exceptionFromError(stackParser, ex) { + const frames = parseStackFrames(stackParser, ex); + const exception = { + type: extractType(ex), + value: extractMessage(ex) + }; + if (frames.length) { + exception.stacktrace = { frames }; + } + if (exception.type === void 0 && exception.value === "") { + exception.value = "Unrecoverable error caught"; + } + return exception; +} +__name(exceptionFromError, "exceptionFromError"); +function eventFromPlainObject(stackParser, exception, syntheticException, isUnhandledRejection) { + const client = getClient(); + const normalizeDepth = client && client.getOptions().normalizeDepth; + const errorFromProp = getErrorPropertyFromObject(exception); + const extra = { + __serialized__: normalizeToSize(exception, normalizeDepth) + }; + if (errorFromProp) { + return { + exception: { + values: [exceptionFromError(stackParser, errorFromProp)] + }, + extra + }; + } + const event = { + exception: { + values: [ + { + type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? "UnhandledRejection" : "Error", + value: getNonErrorObjectExceptionValue(exception, { isUnhandledRejection }) + } + ] + }, + extra + }; + if (syntheticException) { + const frames = parseStackFrames(stackParser, syntheticException); + if (frames.length) { + event.exception.values[0].stacktrace = { frames }; + } + } + return event; +} +__name(eventFromPlainObject, "eventFromPlainObject"); +function eventFromError(stackParser, ex) { + return { + exception: { + values: [exceptionFromError(stackParser, ex)] + } + }; +} +__name(eventFromError, "eventFromError"); +function parseStackFrames(stackParser, ex) { + const stacktrace = ex.stacktrace || ex.stack || ""; + const skipLines = getSkipFirstStackStringLines(ex); + const framesToPop = getPopFirstTopFrames(ex); + try { + return stackParser(stacktrace, skipLines, framesToPop); + } catch (e2) { + } + return []; +} +__name(parseStackFrames, "parseStackFrames"); +const reactMinifiedRegexp = /Minified React error #\d+;/i; +function getSkipFirstStackStringLines(ex) { + if (ex && reactMinifiedRegexp.test(ex.message)) { + return 1; + } + return 0; +} +__name(getSkipFirstStackStringLines, "getSkipFirstStackStringLines"); +function getPopFirstTopFrames(ex) { + if (typeof ex.framesToPop === "number") { + return ex.framesToPop; + } + return 0; +} +__name(getPopFirstTopFrames, "getPopFirstTopFrames"); +function isWebAssemblyException(exception) { + if (typeof WebAssembly !== "undefined" && typeof WebAssembly.Exception !== "undefined") { + return exception instanceof WebAssembly.Exception; + } else { + return false; + } +} +__name(isWebAssemblyException, "isWebAssemblyException"); +function extractType(ex) { + const name2 = ex && ex.name; + if (!name2 && isWebAssemblyException(ex)) { + const hasTypeInMessage = ex.message && Array.isArray(ex.message) && ex.message.length == 2; + return hasTypeInMessage ? ex.message[0] : "WebAssembly.Exception"; + } + return name2; +} +__name(extractType, "extractType"); +function extractMessage(ex) { + const message3 = ex && ex.message; + if (!message3) { + return "No error message"; + } + if (message3.error && typeof message3.error.message === "string") { + return message3.error.message; + } + if (isWebAssemblyException(ex) && Array.isArray(ex.message) && ex.message.length == 2) { + return ex.message[1]; + } + return message3; +} +__name(extractMessage, "extractMessage"); +function eventFromException(stackParser, exception, hint, attachStacktrace) { + const syntheticException = hint && hint.syntheticException || void 0; + const event = eventFromUnknownInput(stackParser, exception, syntheticException, attachStacktrace); + addExceptionMechanism(event); + event.level = "error"; + if (hint && hint.event_id) { + event.event_id = hint.event_id; + } + return resolvedSyncPromise(event); +} +__name(eventFromException, "eventFromException"); +function eventFromMessage(stackParser, message3, level = "info", hint, attachStacktrace) { + const syntheticException = hint && hint.syntheticException || void 0; + const event = eventFromString(stackParser, message3, syntheticException, attachStacktrace); + event.level = level; + if (hint && hint.event_id) { + event.event_id = hint.event_id; + } + return resolvedSyncPromise(event); +} +__name(eventFromMessage, "eventFromMessage"); +function eventFromUnknownInput(stackParser, exception, syntheticException, attachStacktrace, isUnhandledRejection) { + let event; + if (isErrorEvent$2(exception) && exception.error) { + const errorEvent = exception; + return eventFromError(stackParser, errorEvent.error); + } + if (isDOMError(exception) || isDOMException(exception)) { + const domException = exception; + if ("stack" in exception) { + event = eventFromError(stackParser, exception); + } else { + const name2 = domException.name || (isDOMError(domException) ? "DOMError" : "DOMException"); + const message3 = domException.message ? `${name2}: ${domException.message}` : name2; + event = eventFromString(stackParser, message3, syntheticException, attachStacktrace); + addExceptionTypeValue(event, message3); + } + if ("code" in domException) { + event.tags = { ...event.tags, "DOMException.code": `${domException.code}` }; + } + return event; + } + if (isError(exception)) { + return eventFromError(stackParser, exception); + } + if (isPlainObject$5(exception) || isEvent(exception)) { + const objectException = exception; + event = eventFromPlainObject(stackParser, objectException, syntheticException, isUnhandledRejection); + addExceptionMechanism(event, { + synthetic: true + }); + return event; + } + event = eventFromString(stackParser, exception, syntheticException, attachStacktrace); + addExceptionTypeValue(event, `${exception}`, void 0); + addExceptionMechanism(event, { + synthetic: true + }); + return event; +} +__name(eventFromUnknownInput, "eventFromUnknownInput"); +function eventFromString(stackParser, message3, syntheticException, attachStacktrace) { + const event = {}; + if (attachStacktrace && syntheticException) { + const frames = parseStackFrames(stackParser, syntheticException); + if (frames.length) { + event.exception = { + values: [{ value: message3, stacktrace: { frames } }] + }; + } + addExceptionMechanism(event, { synthetic: true }); + } + if (isParameterizedString(message3)) { + const { __sentry_template_string__, __sentry_template_values__ } = message3; + event.logentry = { + message: __sentry_template_string__, + params: __sentry_template_values__ + }; + return event; + } + event.message = message3; + return event; +} +__name(eventFromString, "eventFromString"); +function getNonErrorObjectExceptionValue(exception, { isUnhandledRejection }) { + const keys2 = extractExceptionKeysForMessage(exception); + const captureType = isUnhandledRejection ? "promise rejection" : "exception"; + if (isErrorEvent$2(exception)) { + return `Event \`ErrorEvent\` captured as ${captureType} with message \`${exception.message}\``; + } + if (isEvent(exception)) { + const className = getObjectClassName(exception); + return `Event \`${className}\` (type=${exception.type}) captured as ${captureType}`; + } + return `Object captured as ${captureType} with keys: ${keys2}`; +} +__name(getNonErrorObjectExceptionValue, "getNonErrorObjectExceptionValue"); +function getObjectClassName(obj) { + try { + const prototype2 = Object.getPrototypeOf(obj); + return prototype2 ? prototype2.constructor.name : void 0; + } catch (e2) { + } +} +__name(getObjectClassName, "getObjectClassName"); +function getErrorPropertyFromObject(obj) { + for (const prop2 in obj) { + if (Object.prototype.hasOwnProperty.call(obj, prop2)) { + const value4 = obj[prop2]; + if (value4 instanceof Error) { + return value4; + } + } + } + return void 0; +} +__name(getErrorPropertyFromObject, "getErrorPropertyFromObject"); +function createUserFeedbackEnvelope(feedback, { + metadata, + tunnel, + dsn +}) { + const headers = { + event_id: feedback.event_id, + sent_at: (/* @__PURE__ */ new Date()).toISOString(), + ...metadata && metadata.sdk && { + sdk: { + name: metadata.sdk.name, + version: metadata.sdk.version + } + }, + ...!!tunnel && !!dsn && { dsn: dsnToString(dsn) } + }; + const item3 = createUserFeedbackEnvelopeItem(feedback); + return createEnvelope(headers, [item3]); +} +__name(createUserFeedbackEnvelope, "createUserFeedbackEnvelope"); +function createUserFeedbackEnvelopeItem(feedback) { + const feedbackHeaders = { + type: "user_report" + }; + return [feedbackHeaders, feedback]; +} +__name(createUserFeedbackEnvelopeItem, "createUserFeedbackEnvelopeItem"); +class BrowserClient extends BaseClient { + static { + __name(this, "BrowserClient"); + } + /** + * Creates a new Browser SDK instance. + * + * @param options Configuration options for this SDK. + */ + constructor(options4) { + const opts = { + // We default this to true, as it is the safer scenario + parentSpanIsAlwaysRootSpan: true, + ...options4 + }; + const sdkSource = WINDOW$5.SENTRY_SDK_SOURCE || getSDKSource(); + applySdkMetadata(opts, "browser", ["browser"], sdkSource); + super(opts); + if (opts.sendClientReports && WINDOW$5.document) { + WINDOW$5.document.addEventListener("visibilitychange", () => { + if (WINDOW$5.document.visibilityState === "hidden") { + this._flushOutcomes(); + } + }); + } + } + /** + * @inheritDoc + */ + eventFromException(exception, hint) { + return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace); + } + /** + * @inheritDoc + */ + eventFromMessage(message3, level = "info", hint) { + return eventFromMessage(this._options.stackParser, message3, level, hint, this._options.attachStacktrace); + } + /** + * Sends user feedback to Sentry. + * + * @deprecated Use `captureFeedback` instead. + */ + captureUserFeedback(feedback) { + if (!this._isEnabled()) { + DEBUG_BUILD$4 && logger$2.warn("SDK not enabled, will not capture user feedback."); + return; + } + const envelope = createUserFeedbackEnvelope(feedback, { + metadata: this.getSdkMetadata(), + dsn: this.getDsn(), + tunnel: this.getOptions().tunnel + }); + this.sendEnvelope(envelope); + } + /** + * @inheritDoc + */ + _prepareEvent(event, hint, scope) { + event.platform = event.platform || "javascript"; + return super._prepareEvent(event, hint, scope); + } +} +const DEBUG_BUILD$3 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +const getRating = /* @__PURE__ */ __name((value4, thresholds) => { + if (value4 > thresholds[1]) { + return "poor"; + } + if (value4 > thresholds[0]) { + return "needs-improvement"; + } + return "good"; +}, "getRating"); +const bindReporter = /* @__PURE__ */ __name((callback, metric, thresholds, reportAllChanges) => { + let prevValue; + let delta2; + return (forceReport) => { + if (metric.value >= 0) { + if (forceReport || reportAllChanges) { + delta2 = metric.value - (prevValue || 0); + if (delta2 || prevValue === void 0) { + prevValue = metric.value; + metric.delta = delta2; + metric.rating = getRating(metric.value, thresholds); + callback(metric); + } + } + } + }; +}, "bindReporter"); +const WINDOW$4 = GLOBAL_OBJ; +const generateUniqueID = /* @__PURE__ */ __name(() => { + return `v4-${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`; +}, "generateUniqueID"); +const getNavigationEntry = /* @__PURE__ */ __name((checkResponseStart = true) => { + const navigationEntry = WINDOW$4.performance && WINDOW$4.performance.getEntriesByType && WINDOW$4.performance.getEntriesByType("navigation")[0]; + if ( + // sentry-specific change: + // We don't want to check for responseStart for our own use of `getNavigationEntry` + !checkResponseStart || navigationEntry && navigationEntry.responseStart > 0 && navigationEntry.responseStart < performance.now() + ) { + return navigationEntry; + } +}, "getNavigationEntry"); +const getActivationStart = /* @__PURE__ */ __name(() => { + const navEntry = getNavigationEntry(); + return navEntry && navEntry.activationStart || 0; +}, "getActivationStart"); +const initMetric = /* @__PURE__ */ __name((name2, value4) => { + const navEntry = getNavigationEntry(); + let navigationType = "navigate"; + if (navEntry) { + if (WINDOW$4.document && WINDOW$4.document.prerendering || getActivationStart() > 0) { + navigationType = "prerender"; + } else if (WINDOW$4.document && WINDOW$4.document.wasDiscarded) { + navigationType = "restore"; + } else if (navEntry.type) { + navigationType = navEntry.type.replace(/_/g, "-"); + } + } + const entries = []; + return { + name: name2, + value: typeof value4 === "undefined" ? -1 : value4, + rating: "good", + // If needed, will be updated when reported. `const` to keep the type from widening to `string`. + delta: 0, + entries, + id: generateUniqueID(), + navigationType + }; +}, "initMetric"); +const observe = /* @__PURE__ */ __name((type, callback, opts) => { + try { + if (PerformanceObserver.supportedEntryTypes.includes(type)) { + const po2 = new PerformanceObserver((list2) => { + Promise.resolve().then(() => { + callback(list2.getEntries()); + }); + }); + po2.observe( + Object.assign( + { + type, + buffered: true + }, + opts || {} + ) + ); + return po2; + } + } catch (e2) { + } + return; +}, "observe"); +const onHidden = /* @__PURE__ */ __name((cb) => { + const onHiddenOrPageHide = /* @__PURE__ */ __name((event) => { + if (event.type === "pagehide" || WINDOW$4.document && WINDOW$4.document.visibilityState === "hidden") { + cb(event); + } + }, "onHiddenOrPageHide"); + if (WINDOW$4.document) { + addEventListener("visibilitychange", onHiddenOrPageHide, true); + addEventListener("pagehide", onHiddenOrPageHide, true); + } +}, "onHidden"); +const runOnce = /* @__PURE__ */ __name((cb) => { + let called = false; + return () => { + if (!called) { + cb(); + called = true; + } + }; +}, "runOnce"); +let firstHiddenTime = -1; +const initHiddenTime = /* @__PURE__ */ __name(() => { + return WINDOW$4.document.visibilityState === "hidden" && !WINDOW$4.document.prerendering ? 0 : Infinity; +}, "initHiddenTime"); +const onVisibilityUpdate = /* @__PURE__ */ __name((event) => { + if (WINDOW$4.document.visibilityState === "hidden" && firstHiddenTime > -1) { + firstHiddenTime = event.type === "visibilitychange" ? event.timeStamp : 0; + removeChangeListeners(); + } +}, "onVisibilityUpdate"); +const addChangeListeners = /* @__PURE__ */ __name(() => { + addEventListener("visibilitychange", onVisibilityUpdate, true); + addEventListener("prerenderingchange", onVisibilityUpdate, true); +}, "addChangeListeners"); +const removeChangeListeners = /* @__PURE__ */ __name(() => { + removeEventListener("visibilitychange", onVisibilityUpdate, true); + removeEventListener("prerenderingchange", onVisibilityUpdate, true); +}, "removeChangeListeners"); +const getVisibilityWatcher = /* @__PURE__ */ __name(() => { + if (WINDOW$4.document && firstHiddenTime < 0) { + firstHiddenTime = initHiddenTime(); + addChangeListeners(); + } + return { + get firstHiddenTime() { + return firstHiddenTime; + } + }; +}, "getVisibilityWatcher"); +const whenActivated = /* @__PURE__ */ __name((callback) => { + if (WINDOW$4.document && WINDOW$4.document.prerendering) { + addEventListener("prerenderingchange", () => callback(), true); + } else { + callback(); + } +}, "whenActivated"); +const FCPThresholds = [1800, 3e3]; +const onFCP = /* @__PURE__ */ __name((onReport, opts = {}) => { + whenActivated(() => { + const visibilityWatcher = getVisibilityWatcher(); + const metric = initMetric("FCP"); + let report; + const handleEntries = /* @__PURE__ */ __name((entries) => { + entries.forEach((entry) => { + if (entry.name === "first-contentful-paint") { + po2.disconnect(); + if (entry.startTime < visibilityWatcher.firstHiddenTime) { + metric.value = Math.max(entry.startTime - getActivationStart(), 0); + metric.entries.push(entry); + report(true); + } + } + }); + }, "handleEntries"); + const po2 = observe("paint", handleEntries); + if (po2) { + report = bindReporter(onReport, metric, FCPThresholds, opts.reportAllChanges); + } + }); +}, "onFCP"); +const CLSThresholds = [0.1, 0.25]; +const onCLS = /* @__PURE__ */ __name((onReport, opts = {}) => { + onFCP( + runOnce(() => { + const metric = initMetric("CLS", 0); + let report; + let sessionValue = 0; + let sessionEntries = []; + const handleEntries = /* @__PURE__ */ __name((entries) => { + entries.forEach((entry) => { + if (!entry.hadRecentInput) { + const firstSessionEntry = sessionEntries[0]; + const lastSessionEntry = sessionEntries[sessionEntries.length - 1]; + if (sessionValue && firstSessionEntry && lastSessionEntry && entry.startTime - lastSessionEntry.startTime < 1e3 && entry.startTime - firstSessionEntry.startTime < 5e3) { + sessionValue += entry.value; + sessionEntries.push(entry); + } else { + sessionValue = entry.value; + sessionEntries = [entry]; + } + } + }); + if (sessionValue > metric.value) { + metric.value = sessionValue; + metric.entries = sessionEntries; + report(); + } + }, "handleEntries"); + const po2 = observe("layout-shift", handleEntries); + if (po2) { + report = bindReporter(onReport, metric, CLSThresholds, opts.reportAllChanges); + onHidden(() => { + handleEntries(po2.takeRecords()); + report(true); + }); + setTimeout(report, 0); + } + }) + ); +}, "onCLS"); +const FIDThresholds = [100, 300]; +const onFID = /* @__PURE__ */ __name((onReport, opts = {}) => { + whenActivated(() => { + const visibilityWatcher = getVisibilityWatcher(); + const metric = initMetric("FID"); + let report; + const handleEntry = /* @__PURE__ */ __name((entry) => { + if (entry.startTime < visibilityWatcher.firstHiddenTime) { + metric.value = entry.processingStart - entry.startTime; + metric.entries.push(entry); + report(true); + } + }, "handleEntry"); + const handleEntries = /* @__PURE__ */ __name((entries) => { + entries.forEach(handleEntry); + }, "handleEntries"); + const po2 = observe("first-input", handleEntries); + report = bindReporter(onReport, metric, FIDThresholds, opts.reportAllChanges); + if (po2) { + onHidden( + runOnce(() => { + handleEntries(po2.takeRecords()); + po2.disconnect(); + }) + ); + } + }); +}, "onFID"); +let interactionCountEstimate = 0; +let minKnownInteractionId = Infinity; +let maxKnownInteractionId = 0; +const updateEstimate = /* @__PURE__ */ __name((entries) => { + entries.forEach((e2) => { + if (e2.interactionId) { + minKnownInteractionId = Math.min(minKnownInteractionId, e2.interactionId); + maxKnownInteractionId = Math.max(maxKnownInteractionId, e2.interactionId); + interactionCountEstimate = maxKnownInteractionId ? (maxKnownInteractionId - minKnownInteractionId) / 7 + 1 : 0; + } + }); +}, "updateEstimate"); +let po; +const getInteractionCount = /* @__PURE__ */ __name(() => { + return po ? interactionCountEstimate : performance.interactionCount || 0; +}, "getInteractionCount"); +const initInteractionCountPolyfill = /* @__PURE__ */ __name(() => { + if ("interactionCount" in performance || po) return; + po = observe("event", updateEstimate, { + type: "event", + buffered: true, + durationThreshold: 0 + }); +}, "initInteractionCountPolyfill"); +const longestInteractionList = []; +const longestInteractionMap = /* @__PURE__ */ new Map(); +const DEFAULT_DURATION_THRESHOLD = 40; +let prevInteractionCount = 0; +const getInteractionCountForNavigation = /* @__PURE__ */ __name(() => { + return getInteractionCount() - prevInteractionCount; +}, "getInteractionCountForNavigation"); +const estimateP98LongestInteraction = /* @__PURE__ */ __name(() => { + const candidateInteractionIndex = Math.min( + longestInteractionList.length - 1, + Math.floor(getInteractionCountForNavigation() / 50) + ); + return longestInteractionList[candidateInteractionIndex]; +}, "estimateP98LongestInteraction"); +const MAX_INTERACTIONS_TO_CONSIDER = 10; +const entryPreProcessingCallbacks = []; +const processInteractionEntry = /* @__PURE__ */ __name((entry) => { + entryPreProcessingCallbacks.forEach((cb) => cb(entry)); + if (!(entry.interactionId || entry.entryType === "first-input")) return; + const minLongestInteraction = longestInteractionList[longestInteractionList.length - 1]; + const existingInteraction = longestInteractionMap.get(entry.interactionId); + if (existingInteraction || longestInteractionList.length < MAX_INTERACTIONS_TO_CONSIDER || minLongestInteraction && entry.duration > minLongestInteraction.latency) { + if (existingInteraction) { + if (entry.duration > existingInteraction.latency) { + existingInteraction.entries = [entry]; + existingInteraction.latency = entry.duration; + } else if (entry.duration === existingInteraction.latency && entry.startTime === (existingInteraction.entries[0] && existingInteraction.entries[0].startTime)) { + existingInteraction.entries.push(entry); + } + } else { + const interaction = { + id: entry.interactionId, + latency: entry.duration, + entries: [entry] + }; + longestInteractionMap.set(interaction.id, interaction); + longestInteractionList.push(interaction); + } + longestInteractionList.sort((a2, b2) => b2.latency - a2.latency); + if (longestInteractionList.length > MAX_INTERACTIONS_TO_CONSIDER) { + longestInteractionList.splice(MAX_INTERACTIONS_TO_CONSIDER).forEach((i2) => longestInteractionMap.delete(i2.id)); + } + } +}, "processInteractionEntry"); +const whenIdle = /* @__PURE__ */ __name((cb) => { + const rIC = WINDOW$4.requestIdleCallback || WINDOW$4.setTimeout; + let handle = -1; + cb = runOnce(cb); + if (WINDOW$4.document && WINDOW$4.document.visibilityState === "hidden") { + cb(); + } else { + handle = rIC(cb); + onHidden(cb); + } + return handle; +}, "whenIdle"); +const INPThresholds = [200, 500]; +const onINP = /* @__PURE__ */ __name((onReport, opts = {}) => { + if (!("PerformanceEventTiming" in WINDOW$4 && "interactionId" in PerformanceEventTiming.prototype)) { + return; + } + whenActivated(() => { + initInteractionCountPolyfill(); + const metric = initMetric("INP"); + let report; + const handleEntries = /* @__PURE__ */ __name((entries) => { + whenIdle(() => { + entries.forEach(processInteractionEntry); + const inp = estimateP98LongestInteraction(); + if (inp && inp.latency !== metric.value) { + metric.value = inp.latency; + metric.entries = inp.entries; + report(); + } + }); + }, "handleEntries"); + const po2 = observe("event", handleEntries, { + // Event Timing entries have their durations rounded to the nearest 8ms, + // so a duration of 40ms would be any event that spans 2.5 or more frames + // at 60Hz. This threshold is chosen to strike a balance between usefulness + // and performance. Running this callback for any interaction that spans + // just one or two frames is likely not worth the insight that could be + // gained. + durationThreshold: opts.durationThreshold != null ? opts.durationThreshold : DEFAULT_DURATION_THRESHOLD + }); + report = bindReporter(onReport, metric, INPThresholds, opts.reportAllChanges); + if (po2) { + po2.observe({ type: "first-input", buffered: true }); + onHidden(() => { + handleEntries(po2.takeRecords()); + report(true); + }); + } + }); +}, "onINP"); +const LCPThresholds = [2500, 4e3]; +const reportedMetricIDs = {}; +const onLCP = /* @__PURE__ */ __name((onReport, opts = {}) => { + whenActivated(() => { + const visibilityWatcher = getVisibilityWatcher(); + const metric = initMetric("LCP"); + let report; + const handleEntries = /* @__PURE__ */ __name((entries) => { + if (!opts.reportAllChanges) { + entries = entries.slice(-1); + } + entries.forEach((entry) => { + if (entry.startTime < visibilityWatcher.firstHiddenTime) { + metric.value = Math.max(entry.startTime - getActivationStart(), 0); + metric.entries = [entry]; + report(); + } + }); + }, "handleEntries"); + const po2 = observe("largest-contentful-paint", handleEntries); + if (po2) { + report = bindReporter(onReport, metric, LCPThresholds, opts.reportAllChanges); + const stopListening = runOnce(() => { + if (!reportedMetricIDs[metric.id]) { + handleEntries(po2.takeRecords()); + po2.disconnect(); + reportedMetricIDs[metric.id] = true; + report(true); + } + }); + ["keydown", "click"].forEach((type) => { + if (WINDOW$4.document) { + addEventListener(type, () => whenIdle(stopListening), { + once: true, + capture: true + }); + } + }); + onHidden(stopListening); + } + }); +}, "onLCP"); +const TTFBThresholds = [800, 1800]; +const whenReady = /* @__PURE__ */ __name((callback) => { + if (WINDOW$4.document && WINDOW$4.document.prerendering) { + whenActivated(() => whenReady(callback)); + } else if (WINDOW$4.document && WINDOW$4.document.readyState !== "complete") { + addEventListener("load", () => whenReady(callback), true); + } else { + setTimeout(callback, 0); + } +}, "whenReady"); +const onTTFB = /* @__PURE__ */ __name((onReport, opts = {}) => { + const metric = initMetric("TTFB"); + const report = bindReporter(onReport, metric, TTFBThresholds, opts.reportAllChanges); + whenReady(() => { + const navigationEntry = getNavigationEntry(); + if (navigationEntry) { + metric.value = Math.max(navigationEntry.responseStart - getActivationStart(), 0); + metric.entries = [navigationEntry]; + report(true); + } + }); +}, "onTTFB"); +const handlers$3 = {}; +const instrumented = {}; +let _previousCls; +let _previousFid; +let _previousLcp; +let _previousTtfb; +let _previousInp; +function addClsInstrumentationHandler(callback, stopOnCallback = false) { + return addMetricObserver("cls", callback, instrumentCls, _previousCls, stopOnCallback); +} +__name(addClsInstrumentationHandler, "addClsInstrumentationHandler"); +function addLcpInstrumentationHandler(callback, stopOnCallback = false) { + return addMetricObserver("lcp", callback, instrumentLcp, _previousLcp, stopOnCallback); +} +__name(addLcpInstrumentationHandler, "addLcpInstrumentationHandler"); +function addFidInstrumentationHandler(callback) { + return addMetricObserver("fid", callback, instrumentFid, _previousFid); +} +__name(addFidInstrumentationHandler, "addFidInstrumentationHandler"); +function addTtfbInstrumentationHandler(callback) { + return addMetricObserver("ttfb", callback, instrumentTtfb, _previousTtfb); +} +__name(addTtfbInstrumentationHandler, "addTtfbInstrumentationHandler"); +function addInpInstrumentationHandler(callback) { + return addMetricObserver("inp", callback, instrumentInp, _previousInp); +} +__name(addInpInstrumentationHandler, "addInpInstrumentationHandler"); +function addPerformanceInstrumentationHandler(type, callback) { + addHandler(type, callback); + if (!instrumented[type]) { + instrumentPerformanceObserver(type); + instrumented[type] = true; + } + return getCleanupCallback(type, callback); +} +__name(addPerformanceInstrumentationHandler, "addPerformanceInstrumentationHandler"); +function triggerHandlers(type, data25) { + const typeHandlers = handlers$3[type]; + if (!typeHandlers || !typeHandlers.length) { + return; + } + for (const handler6 of typeHandlers) { + try { + handler6(data25); + } catch (e2) { + DEBUG_BUILD$3 && logger$2.error( + `Error while triggering instrumentation handler. +Type: ${type} +Name: ${getFunctionName(handler6)} +Error:`, + e2 + ); + } + } +} +__name(triggerHandlers, "triggerHandlers"); +function instrumentCls() { + return onCLS( + (metric) => { + triggerHandlers("cls", { + metric + }); + _previousCls = metric; + }, + // We want the callback to be called whenever the CLS value updates. + // By default, the callback is only called when the tab goes to the background. + { reportAllChanges: true } + ); +} +__name(instrumentCls, "instrumentCls"); +function instrumentFid() { + return onFID((metric) => { + triggerHandlers("fid", { + metric + }); + _previousFid = metric; + }); +} +__name(instrumentFid, "instrumentFid"); +function instrumentLcp() { + return onLCP( + (metric) => { + triggerHandlers("lcp", { + metric + }); + _previousLcp = metric; + }, + // We want the callback to be called whenever the LCP value updates. + // By default, the callback is only called when the tab goes to the background. + { reportAllChanges: true } + ); +} +__name(instrumentLcp, "instrumentLcp"); +function instrumentTtfb() { + return onTTFB((metric) => { + triggerHandlers("ttfb", { + metric + }); + _previousTtfb = metric; + }); +} +__name(instrumentTtfb, "instrumentTtfb"); +function instrumentInp() { + return onINP((metric) => { + triggerHandlers("inp", { + metric + }); + _previousInp = metric; + }); +} +__name(instrumentInp, "instrumentInp"); +function addMetricObserver(type, callback, instrumentFn, previousValue, stopOnCallback = false) { + addHandler(type, callback); + let stopListening; + if (!instrumented[type]) { + stopListening = instrumentFn(); + instrumented[type] = true; + } + if (previousValue) { + callback({ metric: previousValue }); + } + return getCleanupCallback(type, callback, stopOnCallback ? stopListening : void 0); +} +__name(addMetricObserver, "addMetricObserver"); +function instrumentPerformanceObserver(type) { + const options4 = {}; + if (type === "event") { + options4.durationThreshold = 0; + } + observe( + type, + (entries) => { + triggerHandlers(type, { entries }); + }, + options4 + ); +} +__name(instrumentPerformanceObserver, "instrumentPerformanceObserver"); +function addHandler(type, handler6) { + handlers$3[type] = handlers$3[type] || []; + handlers$3[type].push(handler6); +} +__name(addHandler, "addHandler"); +function getCleanupCallback(type, callback, stopListening) { + return () => { + if (stopListening) { + stopListening(); + } + const typeHandlers = handlers$3[type]; + if (!typeHandlers) { + return; + } + const index2 = typeHandlers.indexOf(callback); + if (index2 !== -1) { + typeHandlers.splice(index2, 1); + } + }; +} +__name(getCleanupCallback, "getCleanupCallback"); +function isPerformanceEventTiming(entry) { + return "duration" in entry; +} +__name(isPerformanceEventTiming, "isPerformanceEventTiming"); +function isMeasurementValue(value4) { + return typeof value4 === "number" && isFinite(value4); +} +__name(isMeasurementValue, "isMeasurementValue"); +function startAndEndSpan(parentSpan, startTimeInSeconds, endTime, { ...ctx }) { + const parentStartTime = spanToJSON(parentSpan).start_timestamp; + if (parentStartTime && parentStartTime > startTimeInSeconds) { + if (typeof parentSpan.updateStartTime === "function") { + parentSpan.updateStartTime(startTimeInSeconds); + } + } + return withActiveSpan(parentSpan, () => { + const span = startInactiveSpan({ + startTime: startTimeInSeconds, + ...ctx + }); + if (span) { + span.end(endTime); + } + return span; + }); +} +__name(startAndEndSpan, "startAndEndSpan"); +function startStandaloneWebVitalSpan(options4) { + const client = getClient(); + if (!client) { + return; + } + const { name: name2, transaction, attributes: passedAttributes, startTime } = options4; + const { release, environment } = client.getOptions(); + const replay = client.getIntegrationByName("Replay"); + const replayId = replay && replay.getReplayId(); + const scope = getCurrentScope$1(); + const user = scope.getUser(); + const userDisplay = user !== void 0 ? user.email || user.id || user.ip_address : void 0; + let profileId; + try { + profileId = scope.getScopeData().contexts.profile.profile_id; + } catch (e2) { + } + const attributes = { + release, + environment, + user: userDisplay || void 0, + profile_id: profileId || void 0, + replay_id: replayId || void 0, + transaction, + // Web vital score calculation relies on the user agent to account for different + // browsers setting different thresholds for what is considered a good/meh/bad value. + // For example: Chrome vs. Chrome Mobile + "user_agent.original": WINDOW$4.navigator && WINDOW$4.navigator.userAgent, + ...passedAttributes + }; + return startInactiveSpan({ + name: name2, + attributes, + startTime, + experimental: { + standalone: true + } + }); +} +__name(startStandaloneWebVitalSpan, "startStandaloneWebVitalSpan"); +function getBrowserPerformanceAPI() { + return WINDOW$4 && WINDOW$4.addEventListener && WINDOW$4.performance; +} +__name(getBrowserPerformanceAPI, "getBrowserPerformanceAPI"); +function msToSec(time) { + return time / 1e3; +} +__name(msToSec, "msToSec"); +function trackClsAsStandaloneSpan() { + let standaloneCLsValue = 0; + let standaloneClsEntry; + let pageloadSpanId; + if (!supportsLayoutShift()) { + return; + } + let sentSpan = false; + function _collectClsOnce() { + if (sentSpan) { + return; + } + sentSpan = true; + if (pageloadSpanId) { + sendStandaloneClsSpan(standaloneCLsValue, standaloneClsEntry, pageloadSpanId); + } + cleanupClsHandler(); + } + __name(_collectClsOnce, "_collectClsOnce"); + const cleanupClsHandler = addClsInstrumentationHandler(({ metric }) => { + const entry = metric.entries[metric.entries.length - 1]; + if (!entry) { + return; + } + standaloneCLsValue = metric.value; + standaloneClsEntry = entry; + }, true); + onHidden(() => { + _collectClsOnce(); + }); + setTimeout(() => { + const client = getClient(); + if (!client) { + return; + } + const unsubscribeStartNavigation = client.on("startNavigationSpan", () => { + _collectClsOnce(); + unsubscribeStartNavigation && unsubscribeStartNavigation(); + }); + const activeSpan = getActiveSpan(); + const rootSpan = activeSpan && getRootSpan(activeSpan); + const spanJSON = rootSpan && spanToJSON(rootSpan); + if (spanJSON && spanJSON.op === "pageload") { + pageloadSpanId = rootSpan.spanContext().spanId; + } + }, 0); +} +__name(trackClsAsStandaloneSpan, "trackClsAsStandaloneSpan"); +function sendStandaloneClsSpan(clsValue, entry, pageloadSpanId) { + DEBUG_BUILD$3 && logger$2.log(`Sending CLS span (${clsValue})`); + const startTime = msToSec((browserPerformanceTimeOrigin || 0) + (entry && entry.startTime || 0)); + const routeName = getCurrentScope$1().getScopeData().transactionName; + const name2 = entry ? htmlTreeAsString(entry.sources[0] && entry.sources[0].node) : "Layout shift"; + const attributes = dropUndefinedKeys({ + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.browser.cls", + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: "ui.webvital.cls", + [SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: entry && entry.duration || 0, + // attach the pageload span id to the CLS span so that we can link them in the UI + "sentry.pageload.span_id": pageloadSpanId + }); + const span = startStandaloneWebVitalSpan({ + name: name2, + transaction: routeName, + attributes, + startTime + }); + if (span) { + span.addEvent("cls", { + [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: "", + [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: clsValue + }); + span.end(startTime); + } +} +__name(sendStandaloneClsSpan, "sendStandaloneClsSpan"); +function supportsLayoutShift() { + try { + return PerformanceObserver.supportedEntryTypes.includes("layout-shift"); + } catch (e2) { + return false; + } +} +__name(supportsLayoutShift, "supportsLayoutShift"); +const MAX_INT_AS_BYTES = 2147483647; +let _performanceCursor = 0; +let _measurements = {}; +let _lcpEntry; +let _clsEntry; +function startTrackingWebVitals({ recordClsStandaloneSpans }) { + const performance2 = getBrowserPerformanceAPI(); + if (performance2 && browserPerformanceTimeOrigin) { + if (performance2.mark) { + WINDOW$4.performance.mark("sentry-tracing-init"); + } + const fidCleanupCallback = _trackFID(); + const lcpCleanupCallback = _trackLCP(); + const ttfbCleanupCallback = _trackTtfb(); + const clsCleanupCallback = recordClsStandaloneSpans ? trackClsAsStandaloneSpan() : _trackCLS(); + return () => { + fidCleanupCallback(); + lcpCleanupCallback(); + ttfbCleanupCallback(); + clsCleanupCallback && clsCleanupCallback(); + }; + } + return () => void 0; +} +__name(startTrackingWebVitals, "startTrackingWebVitals"); +function startTrackingLongTasks() { + addPerformanceInstrumentationHandler("longtask", ({ entries }) => { + const parent = getActiveSpan(); + if (!parent) { + return; + } + const { op: parentOp, start_timestamp: parentStartTimestamp } = spanToJSON(parent); + for (const entry of entries) { + const startTime = msToSec(browserPerformanceTimeOrigin + entry.startTime); + const duration = msToSec(entry.duration); + if (parentOp === "navigation" && parentStartTimestamp && startTime < parentStartTimestamp) { + continue; + } + startAndEndSpan(parent, startTime, startTime + duration, { + name: "Main UI thread blocked", + op: "ui.long-task", + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + } + }); + } + }); +} +__name(startTrackingLongTasks, "startTrackingLongTasks"); +function startTrackingLongAnimationFrames() { + const observer = new PerformanceObserver((list2) => { + const parent = getActiveSpan(); + if (!parent) { + return; + } + for (const entry of list2.getEntries()) { + if (!entry.scripts[0]) { + continue; + } + const startTime = msToSec(browserPerformanceTimeOrigin + entry.startTime); + const { start_timestamp: parentStartTimestamp, op: parentOp } = spanToJSON(parent); + if (parentOp === "navigation" && parentStartTimestamp && startTime < parentStartTimestamp) { + continue; + } + const duration = msToSec(entry.duration); + const attributes = { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + }; + const initialScript = entry.scripts[0]; + const { invoker, invokerType, sourceURL, sourceFunctionName, sourceCharPosition } = initialScript; + attributes["browser.script.invoker"] = invoker; + attributes["browser.script.invoker_type"] = invokerType; + if (sourceURL) { + attributes["code.filepath"] = sourceURL; + } + if (sourceFunctionName) { + attributes["code.function"] = sourceFunctionName; + } + if (sourceCharPosition !== -1) { + attributes["browser.script.source_char_position"] = sourceCharPosition; + } + startAndEndSpan(parent, startTime, startTime + duration, { + name: "Main UI thread blocked", + op: "ui.long-animation-frame", + attributes + }); + } + }); + observer.observe({ type: "long-animation-frame", buffered: true }); +} +__name(startTrackingLongAnimationFrames, "startTrackingLongAnimationFrames"); +function startTrackingInteractions() { + addPerformanceInstrumentationHandler("event", ({ entries }) => { + const parent = getActiveSpan(); + if (!parent) { + return; + } + for (const entry of entries) { + if (entry.name === "click") { + const startTime = msToSec(browserPerformanceTimeOrigin + entry.startTime); + const duration = msToSec(entry.duration); + const spanOptions = { + name: htmlTreeAsString(entry.target), + op: `ui.interaction.${entry.name}`, + startTime, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + } + }; + const componentName = getComponentName$1(entry.target); + if (componentName) { + spanOptions.attributes["ui.component_name"] = componentName; + } + startAndEndSpan(parent, startTime, startTime + duration, spanOptions); + } + } + }); +} +__name(startTrackingInteractions, "startTrackingInteractions"); +function _trackCLS() { + return addClsInstrumentationHandler(({ metric }) => { + const entry = metric.entries[metric.entries.length - 1]; + if (!entry) { + return; + } + _measurements["cls"] = { value: metric.value, unit: "" }; + _clsEntry = entry; + }, true); +} +__name(_trackCLS, "_trackCLS"); +function _trackLCP() { + return addLcpInstrumentationHandler(({ metric }) => { + const entry = metric.entries[metric.entries.length - 1]; + if (!entry) { + return; + } + _measurements["lcp"] = { value: metric.value, unit: "millisecond" }; + _lcpEntry = entry; + }, true); +} +__name(_trackLCP, "_trackLCP"); +function _trackFID() { + return addFidInstrumentationHandler(({ metric }) => { + const entry = metric.entries[metric.entries.length - 1]; + if (!entry) { + return; + } + const timeOrigin = msToSec(browserPerformanceTimeOrigin); + const startTime = msToSec(entry.startTime); + _measurements["fid"] = { value: metric.value, unit: "millisecond" }; + _measurements["mark.fid"] = { value: timeOrigin + startTime, unit: "second" }; + }); +} +__name(_trackFID, "_trackFID"); +function _trackTtfb() { + return addTtfbInstrumentationHandler(({ metric }) => { + const entry = metric.entries[metric.entries.length - 1]; + if (!entry) { + return; + } + _measurements["ttfb"] = { value: metric.value, unit: "millisecond" }; + }); +} +__name(_trackTtfb, "_trackTtfb"); +function addPerformanceEntries(span, options4) { + const performance2 = getBrowserPerformanceAPI(); + if (!performance2 || !performance2.getEntries || !browserPerformanceTimeOrigin) { + return; + } + const timeOrigin = msToSec(browserPerformanceTimeOrigin); + const performanceEntries = performance2.getEntries(); + const { op, start_timestamp: transactionStartTime } = spanToJSON(span); + performanceEntries.slice(_performanceCursor).forEach((entry) => { + const startTime = msToSec(entry.startTime); + const duration = msToSec( + // Inexplicably, Chrome sometimes emits a negative duration. We need to work around this. + // There is a SO post attempting to explain this, but it leaves one with open questions: https://stackoverflow.com/questions/23191918/peformance-getentries-and-negative-duration-display + // The way we clamp the value is probably not accurate, since we have observed this happen for things that may take a while to load, like for example the replay worker. + // TODO: Investigate why this happens and how to properly mitigate. For now, this is a workaround to prevent transactions being dropped due to negative duration spans. + Math.max(0, entry.duration) + ); + if (op === "navigation" && transactionStartTime && timeOrigin + startTime < transactionStartTime) { + return; + } + switch (entry.entryType) { + case "navigation": { + _addNavigationSpans(span, entry, timeOrigin); + break; + } + case "mark": + case "paint": + case "measure": { + _addMeasureSpans(span, entry, startTime, duration, timeOrigin); + const firstHidden = getVisibilityWatcher(); + const shouldRecord = entry.startTime < firstHidden.firstHiddenTime; + if (entry.name === "first-paint" && shouldRecord) { + _measurements["fp"] = { value: entry.startTime, unit: "millisecond" }; + } + if (entry.name === "first-contentful-paint" && shouldRecord) { + _measurements["fcp"] = { value: entry.startTime, unit: "millisecond" }; + } + break; + } + case "resource": { + _addResourceSpans(span, entry, entry.name, startTime, duration, timeOrigin); + break; + } + } + }); + _performanceCursor = Math.max(performanceEntries.length - 1, 0); + _trackNavigator(span); + if (op === "pageload") { + _addTtfbRequestTimeToMeasurements(_measurements); + const fidMark = _measurements["mark.fid"]; + if (fidMark && _measurements["fid"]) { + startAndEndSpan(span, fidMark.value, fidMark.value + msToSec(_measurements["fid"].value), { + name: "first input delay", + op: "ui.action", + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + } + }); + delete _measurements["mark.fid"]; + } + if (!("fcp" in _measurements) || !options4.recordClsOnPageloadSpan) { + delete _measurements.cls; + } + Object.entries(_measurements).forEach(([measurementName, measurement]) => { + setMeasurement(measurementName, measurement.value, measurement.unit); + }); + span.setAttribute("performance.timeOrigin", timeOrigin); + span.setAttribute("performance.activationStart", getActivationStart()); + _setWebVitalAttributes(span); + } + _lcpEntry = void 0; + _clsEntry = void 0; + _measurements = {}; +} +__name(addPerformanceEntries, "addPerformanceEntries"); +function _addMeasureSpans(span, entry, startTime, duration, timeOrigin) { + const navEntry = getNavigationEntry(false); + const requestTime = msToSec(navEntry ? navEntry.requestStart : 0); + const measureStartTimestamp = timeOrigin + Math.max(startTime, requestTime); + const startTimeStamp = timeOrigin + startTime; + const measureEndTimestamp = startTimeStamp + duration; + const attributes = { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.resource.browser.metrics" + }; + if (measureStartTimestamp !== startTimeStamp) { + attributes["sentry.browser.measure_happened_before_request"] = true; + attributes["sentry.browser.measure_start_time"] = measureStartTimestamp; + } + startAndEndSpan(span, measureStartTimestamp, measureEndTimestamp, { + name: entry.name, + op: entry.entryType, + attributes + }); + return measureStartTimestamp; +} +__name(_addMeasureSpans, "_addMeasureSpans"); +function _addNavigationSpans(span, entry, timeOrigin) { + ["unloadEvent", "redirect", "domContentLoadedEvent", "loadEvent", "connect"].forEach((event) => { + _addPerformanceNavigationTiming(span, entry, event, timeOrigin); + }); + _addPerformanceNavigationTiming(span, entry, "secureConnection", timeOrigin, "TLS/SSL"); + _addPerformanceNavigationTiming(span, entry, "fetch", timeOrigin, "cache"); + _addPerformanceNavigationTiming(span, entry, "domainLookup", timeOrigin, "DNS"); + _addRequest(span, entry, timeOrigin); +} +__name(_addNavigationSpans, "_addNavigationSpans"); +function _addPerformanceNavigationTiming(span, entry, event, timeOrigin, name2 = event) { + const eventEnd = _getEndPropertyNameForNavigationTiming(event); + const end = entry[eventEnd]; + const start2 = entry[`${event}Start`]; + if (!start2 || !end) { + return; + } + startAndEndSpan(span, timeOrigin + msToSec(start2), timeOrigin + msToSec(end), { + op: `browser.${name2}`, + name: entry.name, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + } + }); +} +__name(_addPerformanceNavigationTiming, "_addPerformanceNavigationTiming"); +function _getEndPropertyNameForNavigationTiming(event) { + if (event === "secureConnection") { + return "connectEnd"; + } + if (event === "fetch") { + return "domainLookupStart"; + } + return `${event}End`; +} +__name(_getEndPropertyNameForNavigationTiming, "_getEndPropertyNameForNavigationTiming"); +function _addRequest(span, entry, timeOrigin) { + const requestStartTimestamp = timeOrigin + msToSec(entry.requestStart); + const responseEndTimestamp = timeOrigin + msToSec(entry.responseEnd); + const responseStartTimestamp = timeOrigin + msToSec(entry.responseStart); + if (entry.responseEnd) { + startAndEndSpan(span, requestStartTimestamp, responseEndTimestamp, { + op: "browser.request", + name: entry.name, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + } + }); + startAndEndSpan(span, responseStartTimestamp, responseEndTimestamp, { + op: "browser.response", + name: entry.name, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" + } + }); + } +} +__name(_addRequest, "_addRequest"); +function _addResourceSpans(span, entry, resourceUrl, startTime, duration, timeOrigin) { + if (entry.initiatorType === "xmlhttprequest" || entry.initiatorType === "fetch") { + return; + } + const parsedUrl = parseUrl$1(resourceUrl); + const attributes = { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.resource.browser.metrics" + }; + setResourceEntrySizeData(attributes, entry, "transferSize", "http.response_transfer_size"); + setResourceEntrySizeData(attributes, entry, "encodedBodySize", "http.response_content_length"); + setResourceEntrySizeData(attributes, entry, "decodedBodySize", "http.decoded_response_content_length"); + const deliveryType = entry.deliveryType; + if (deliveryType != null) { + attributes["http.response_delivery_type"] = deliveryType; + } + const renderBlockingStatus = entry.renderBlockingStatus; + if (renderBlockingStatus) { + attributes["resource.render_blocking_status"] = renderBlockingStatus; + } + if (parsedUrl.protocol) { + attributes["url.scheme"] = parsedUrl.protocol.split(":").pop(); + } + if (parsedUrl.host) { + attributes["server.address"] = parsedUrl.host; + } + attributes["url.same_origin"] = resourceUrl.includes(WINDOW$4.location.origin); + const startTimestamp = timeOrigin + startTime; + const endTimestamp = startTimestamp + duration; + startAndEndSpan(span, startTimestamp, endTimestamp, { + name: resourceUrl.replace(WINDOW$4.location.origin, ""), + op: entry.initiatorType ? `resource.${entry.initiatorType}` : "resource.other", + attributes + }); +} +__name(_addResourceSpans, "_addResourceSpans"); +function _trackNavigator(span) { + const navigator2 = WINDOW$4.navigator; + if (!navigator2) { + return; + } + const connection = navigator2.connection; + if (connection) { + if (connection.effectiveType) { + span.setAttribute("effectiveConnectionType", connection.effectiveType); + } + if (connection.type) { + span.setAttribute("connectionType", connection.type); + } + if (isMeasurementValue(connection.rtt)) { + _measurements["connection.rtt"] = { value: connection.rtt, unit: "millisecond" }; + } + } + if (isMeasurementValue(navigator2.deviceMemory)) { + span.setAttribute("deviceMemory", `${navigator2.deviceMemory} GB`); + } + if (isMeasurementValue(navigator2.hardwareConcurrency)) { + span.setAttribute("hardwareConcurrency", String(navigator2.hardwareConcurrency)); + } +} +__name(_trackNavigator, "_trackNavigator"); +function _setWebVitalAttributes(span) { + if (_lcpEntry) { + if (_lcpEntry.element) { + span.setAttribute("lcp.element", htmlTreeAsString(_lcpEntry.element)); + } + if (_lcpEntry.id) { + span.setAttribute("lcp.id", _lcpEntry.id); + } + if (_lcpEntry.url) { + span.setAttribute("lcp.url", _lcpEntry.url.trim().slice(0, 200)); + } + if (_lcpEntry.loadTime != null) { + span.setAttribute("lcp.loadTime", _lcpEntry.loadTime); + } + if (_lcpEntry.renderTime != null) { + span.setAttribute("lcp.renderTime", _lcpEntry.renderTime); + } + span.setAttribute("lcp.size", _lcpEntry.size); + } + if (_clsEntry && _clsEntry.sources) { + _clsEntry.sources.forEach( + (source, index2) => span.setAttribute(`cls.source.${index2 + 1}`, htmlTreeAsString(source.node)) + ); + } +} +__name(_setWebVitalAttributes, "_setWebVitalAttributes"); +function setResourceEntrySizeData(attributes, entry, key, dataKey) { + const entryVal = entry[key]; + if (entryVal != null && entryVal < MAX_INT_AS_BYTES) { + attributes[dataKey] = entryVal; + } +} +__name(setResourceEntrySizeData, "setResourceEntrySizeData"); +function _addTtfbRequestTimeToMeasurements(_measurements2) { + const navEntry = getNavigationEntry(false); + if (!navEntry) { + return; + } + const { responseStart, requestStart } = navEntry; + if (requestStart <= responseStart) { + _measurements2["ttfb.requestTime"] = { + value: responseStart - requestStart, + unit: "millisecond" + }; + } +} +__name(_addTtfbRequestTimeToMeasurements, "_addTtfbRequestTimeToMeasurements"); +const DEBOUNCE_DURATION = 1e3; +let debounceTimerID; +let lastCapturedEventType; +let lastCapturedEventTargetId; +function addClickKeypressInstrumentationHandler(handler6) { + const type = "dom"; + addHandler$1(type, handler6); + maybeInstrument(type, instrumentDOM); +} +__name(addClickKeypressInstrumentationHandler, "addClickKeypressInstrumentationHandler"); +function instrumentDOM() { + if (!WINDOW$4.document) { + return; + } + const triggerDOMHandler = triggerHandlers$1.bind(null, "dom"); + const globalDOMEventHandler = makeDOMEventHandler(triggerDOMHandler, true); + WINDOW$4.document.addEventListener("click", globalDOMEventHandler, false); + WINDOW$4.document.addEventListener("keypress", globalDOMEventHandler, false); + ["EventTarget", "Node"].forEach((target) => { + const globalObject = WINDOW$4; + const targetObj = globalObject[target]; + const proto = targetObj && targetObj.prototype; + if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty("addEventListener")) { + return; + } + fill(proto, "addEventListener", function(originalAddEventListener) { + return function(type, listener, options4) { + if (type === "click" || type == "keypress") { + try { + const handlers2 = this.__sentry_instrumentation_handlers__ = this.__sentry_instrumentation_handlers__ || {}; + const handlerForType = handlers2[type] = handlers2[type] || { refCount: 0 }; + if (!handlerForType.handler) { + const handler6 = makeDOMEventHandler(triggerDOMHandler); + handlerForType.handler = handler6; + originalAddEventListener.call(this, type, handler6, options4); + } + handlerForType.refCount++; + } catch (e2) { + } + } + return originalAddEventListener.call(this, type, listener, options4); + }; + }); + fill( + proto, + "removeEventListener", + function(originalRemoveEventListener) { + return function(type, listener, options4) { + if (type === "click" || type == "keypress") { + try { + const handlers2 = this.__sentry_instrumentation_handlers__ || {}; + const handlerForType = handlers2[type]; + if (handlerForType) { + handlerForType.refCount--; + if (handlerForType.refCount <= 0) { + originalRemoveEventListener.call(this, type, handlerForType.handler, options4); + handlerForType.handler = void 0; + delete handlers2[type]; + } + if (Object.keys(handlers2).length === 0) { + delete this.__sentry_instrumentation_handlers__; + } + } + } catch (e2) { + } + } + return originalRemoveEventListener.call(this, type, listener, options4); + }; + } + ); + }); +} +__name(instrumentDOM, "instrumentDOM"); +function isSimilarToLastCapturedEvent(event) { + if (event.type !== lastCapturedEventType) { + return false; + } + try { + if (!event.target || event.target._sentryId !== lastCapturedEventTargetId) { + return false; + } + } catch (e2) { + } + return true; +} +__name(isSimilarToLastCapturedEvent, "isSimilarToLastCapturedEvent"); +function shouldSkipDOMEvent(eventType, target) { + if (eventType !== "keypress") { + return false; + } + if (!target || !target.tagName) { + return true; + } + if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) { + return false; + } + return true; +} +__name(shouldSkipDOMEvent, "shouldSkipDOMEvent"); +function makeDOMEventHandler(handler6, globalListener = false) { + return (event) => { + if (!event || event["_sentryCaptured"]) { + return; + } + const target = getEventTarget$1(event); + if (shouldSkipDOMEvent(event.type, target)) { + return; + } + addNonEnumerableProperty(event, "_sentryCaptured", true); + if (target && !target._sentryId) { + addNonEnumerableProperty(target, "_sentryId", uuid4()); + } + const name2 = event.type === "keypress" ? "input" : event.type; + if (!isSimilarToLastCapturedEvent(event)) { + const handlerData = { event, name: name2, global: globalListener }; + handler6(handlerData); + lastCapturedEventType = event.type; + lastCapturedEventTargetId = target ? target._sentryId : void 0; + } + clearTimeout(debounceTimerID); + debounceTimerID = WINDOW$4.setTimeout(() => { + lastCapturedEventTargetId = void 0; + lastCapturedEventType = void 0; + }, DEBOUNCE_DURATION); + }; +} +__name(makeDOMEventHandler, "makeDOMEventHandler"); +function getEventTarget$1(event) { + try { + return event.target; + } catch (e2) { + return null; + } +} +__name(getEventTarget$1, "getEventTarget$1"); +let lastHref; +function addHistoryInstrumentationHandler(handler6) { + const type = "history"; + addHandler$1(type, handler6); + maybeInstrument(type, instrumentHistory); +} +__name(addHistoryInstrumentationHandler, "addHistoryInstrumentationHandler"); +function instrumentHistory() { + if (!supportsHistory()) { + return; + } + const oldOnPopState = WINDOW$4.onpopstate; + WINDOW$4.onpopstate = function(...args) { + const to = WINDOW$4.location.href; + const from2 = lastHref; + lastHref = to; + const handlerData = { from: from2, to }; + triggerHandlers$1("history", handlerData); + if (oldOnPopState) { + try { + return oldOnPopState.apply(this, args); + } catch (_oO) { + } + } + }; + function historyReplacementFunction(originalHistoryFunction) { + return function(...args) { + const url = args.length > 2 ? args[2] : void 0; + if (url) { + const from2 = lastHref; + const to = String(url); + lastHref = to; + const handlerData = { from: from2, to }; + triggerHandlers$1("history", handlerData); + } + return originalHistoryFunction.apply(this, args); + }; + } + __name(historyReplacementFunction, "historyReplacementFunction"); + fill(WINDOW$4.history, "pushState", historyReplacementFunction); + fill(WINDOW$4.history, "replaceState", historyReplacementFunction); +} +__name(instrumentHistory, "instrumentHistory"); +const cachedImplementations$3 = {}; +function getNativeImplementation(name2) { + const cached = cachedImplementations$3[name2]; + if (cached) { + return cached; + } + let impl = WINDOW$4[name2]; + if (isNativeFunction(impl)) { + return cachedImplementations$3[name2] = impl.bind(WINDOW$4); + } + const document2 = WINDOW$4.document; + if (document2 && typeof document2.createElement === "function") { + try { + const sandbox = document2.createElement("iframe"); + sandbox.hidden = true; + document2.head.appendChild(sandbox); + const contentWindow = sandbox.contentWindow; + if (contentWindow && contentWindow[name2]) { + impl = contentWindow[name2]; + } + document2.head.removeChild(sandbox); + } catch (e2) { + DEBUG_BUILD$3 && logger$2.warn(`Could not create sandbox iframe for ${name2} check, bailing to window.${name2}: `, e2); + } + } + if (!impl) { + return impl; + } + return cachedImplementations$3[name2] = impl.bind(WINDOW$4); +} +__name(getNativeImplementation, "getNativeImplementation"); +function clearCachedImplementation(name2) { + cachedImplementations$3[name2] = void 0; +} +__name(clearCachedImplementation, "clearCachedImplementation"); +function fetch$1(...rest) { + return getNativeImplementation("fetch")(...rest); +} +__name(fetch$1, "fetch$1"); +function setTimeout$3(...rest) { + return getNativeImplementation("setTimeout")(...rest); +} +__name(setTimeout$3, "setTimeout$3"); +const SENTRY_XHR_DATA_KEY = "__sentry_xhr_v3__"; +function addXhrInstrumentationHandler(handler6) { + const type = "xhr"; + addHandler$1(type, handler6); + maybeInstrument(type, instrumentXHR); +} +__name(addXhrInstrumentationHandler, "addXhrInstrumentationHandler"); +function instrumentXHR() { + if (!WINDOW$4.XMLHttpRequest) { + return; + } + const xhrproto = XMLHttpRequest.prototype; + xhrproto.open = new Proxy(xhrproto.open, { + apply(originalOpen, xhrOpenThisArg, xhrOpenArgArray) { + const virtualError = new Error(); + const startTimestamp = timestampInSeconds() * 1e3; + const method = isString$8(xhrOpenArgArray[0]) ? xhrOpenArgArray[0].toUpperCase() : void 0; + const url = parseUrl(xhrOpenArgArray[1]); + if (!method || !url) { + return originalOpen.apply(xhrOpenThisArg, xhrOpenArgArray); + } + xhrOpenThisArg[SENTRY_XHR_DATA_KEY] = { + method, + url, + request_headers: {} + }; + if (method === "POST" && url.match(/sentry_key/)) { + xhrOpenThisArg.__sentry_own_request__ = true; + } + const onreadystatechangeHandler = /* @__PURE__ */ __name(() => { + const xhrInfo = xhrOpenThisArg[SENTRY_XHR_DATA_KEY]; + if (!xhrInfo) { + return; + } + if (xhrOpenThisArg.readyState === 4) { + try { + xhrInfo.status_code = xhrOpenThisArg.status; + } catch (e2) { + } + const handlerData = { + endTimestamp: timestampInSeconds() * 1e3, + startTimestamp, + xhr: xhrOpenThisArg, + virtualError + }; + triggerHandlers$1("xhr", handlerData); + } + }, "onreadystatechangeHandler"); + if ("onreadystatechange" in xhrOpenThisArg && typeof xhrOpenThisArg.onreadystatechange === "function") { + xhrOpenThisArg.onreadystatechange = new Proxy(xhrOpenThisArg.onreadystatechange, { + apply(originalOnreadystatechange, onreadystatechangeThisArg, onreadystatechangeArgArray) { + onreadystatechangeHandler(); + return originalOnreadystatechange.apply(onreadystatechangeThisArg, onreadystatechangeArgArray); + } + }); + } else { + xhrOpenThisArg.addEventListener("readystatechange", onreadystatechangeHandler); + } + xhrOpenThisArg.setRequestHeader = new Proxy(xhrOpenThisArg.setRequestHeader, { + apply(originalSetRequestHeader, setRequestHeaderThisArg, setRequestHeaderArgArray) { + const [header3, value4] = setRequestHeaderArgArray; + const xhrInfo = setRequestHeaderThisArg[SENTRY_XHR_DATA_KEY]; + if (xhrInfo && isString$8(header3) && isString$8(value4)) { + xhrInfo.request_headers[header3.toLowerCase()] = value4; + } + return originalSetRequestHeader.apply(setRequestHeaderThisArg, setRequestHeaderArgArray); + } + }); + return originalOpen.apply(xhrOpenThisArg, xhrOpenArgArray); + } + }); + xhrproto.send = new Proxy(xhrproto.send, { + apply(originalSend, sendThisArg, sendArgArray) { + const sentryXhrData = sendThisArg[SENTRY_XHR_DATA_KEY]; + if (!sentryXhrData) { + return originalSend.apply(sendThisArg, sendArgArray); + } + if (sendArgArray[0] !== void 0) { + sentryXhrData.body = sendArgArray[0]; + } + const handlerData = { + startTimestamp: timestampInSeconds() * 1e3, + xhr: sendThisArg + }; + triggerHandlers$1("xhr", handlerData); + return originalSend.apply(sendThisArg, sendArgArray); + } + }); +} +__name(instrumentXHR, "instrumentXHR"); +function parseUrl(url) { + if (isString$8(url)) { + return url; + } + try { + return url.toString(); + } catch (e2) { + } + return void 0; +} +__name(parseUrl, "parseUrl"); +const LAST_INTERACTIONS = []; +const INTERACTIONS_SPAN_MAP = /* @__PURE__ */ new Map(); +function startTrackingINP() { + const performance2 = getBrowserPerformanceAPI(); + if (performance2 && browserPerformanceTimeOrigin) { + const inpCallback = _trackINP(); + return () => { + inpCallback(); + }; + } + return () => void 0; +} +__name(startTrackingINP, "startTrackingINP"); +const INP_ENTRY_MAP = { + click: "click", + pointerdown: "click", + pointerup: "click", + mousedown: "click", + mouseup: "click", + touchstart: "click", + touchend: "click", + mouseover: "hover", + mouseout: "hover", + mouseenter: "hover", + mouseleave: "hover", + pointerover: "hover", + pointerout: "hover", + pointerenter: "hover", + pointerleave: "hover", + dragstart: "drag", + dragend: "drag", + drag: "drag", + dragenter: "drag", + dragleave: "drag", + dragover: "drag", + drop: "drag", + keydown: "press", + keyup: "press", + keypress: "press", + input: "press" +}; +function _trackINP() { + return addInpInstrumentationHandler(({ metric }) => { + if (metric.value == void 0) { + return; + } + const entry = metric.entries.find((entry2) => entry2.duration === metric.value && INP_ENTRY_MAP[entry2.name]); + if (!entry) { + return; + } + const { interactionId } = entry; + const interactionType = INP_ENTRY_MAP[entry.name]; + const startTime = msToSec(browserPerformanceTimeOrigin + entry.startTime); + const duration = msToSec(metric.value); + const activeSpan = getActiveSpan(); + const rootSpan = activeSpan ? getRootSpan(activeSpan) : void 0; + const cachedSpan = interactionId != null ? INTERACTIONS_SPAN_MAP.get(interactionId) : void 0; + const spanToUse = cachedSpan || rootSpan; + const routeName = spanToUse ? spanToJSON(spanToUse).description : getCurrentScope$1().getScopeData().transactionName; + const name2 = htmlTreeAsString(entry.target); + const attributes = dropUndefinedKeys({ + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.browser.inp", + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `ui.interaction.${interactionType}`, + [SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: entry.duration + }); + const span = startStandaloneWebVitalSpan({ + name: name2, + transaction: routeName, + attributes, + startTime + }); + if (span) { + span.addEvent("inp", { + [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: "millisecond", + [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: metric.value + }); + span.end(startTime + duration); + } + }); +} +__name(_trackINP, "_trackINP"); +function registerInpInteractionListener(_latestRoute) { + const handleEntries = /* @__PURE__ */ __name(({ entries }) => { + const activeSpan = getActiveSpan(); + const activeRootSpan = activeSpan && getRootSpan(activeSpan); + entries.forEach((entry) => { + if (!isPerformanceEventTiming(entry) || !activeRootSpan) { + return; + } + const interactionId = entry.interactionId; + if (interactionId == null) { + return; + } + if (INTERACTIONS_SPAN_MAP.has(interactionId)) { + return; + } + if (LAST_INTERACTIONS.length > 10) { + const last = LAST_INTERACTIONS.shift(); + INTERACTIONS_SPAN_MAP.delete(last); + } + LAST_INTERACTIONS.push(interactionId); + INTERACTIONS_SPAN_MAP.set(interactionId, activeRootSpan); + }); + }, "handleEntries"); + addPerformanceInstrumentationHandler("event", handleEntries); + addPerformanceInstrumentationHandler("first-input", handleEntries); +} +__name(registerInpInteractionListener, "registerInpInteractionListener"); +function makeFetchTransport(options4, nativeFetch = getNativeImplementation("fetch")) { + let pendingBodySize = 0; + let pendingCount = 0; + function makeRequest(request) { + const requestSize = request.body.length; + pendingBodySize += requestSize; + pendingCount++; + const requestOptions = { + body: request.body, + method: "POST", + referrerPolicy: "origin", + headers: options4.headers, + // Outgoing requests are usually cancelled when navigating to a different page, causing a "TypeError: Failed to + // fetch" error and sending a "network_error" client-outcome - in Chrome, the request status shows "(cancelled)". + // The `keepalive` flag keeps outgoing requests alive, even when switching pages. We want this since we're + // frequently sending events right before the user is switching pages (eg. when finishing navigation transactions). + // Gotchas: + // - `keepalive` isn't supported by Firefox + // - As per spec (https://fetch.spec.whatwg.org/#http-network-or-cache-fetch): + // If the sum of contentLength and inflightKeepaliveBytes is greater than 64 kibibytes, then return a network error. + // We will therefore only activate the flag when we're below that limit. + // There is also a limit of requests that can be open at the same time, so we also limit this to 15 + // See https://github.com/getsentry/sentry-javascript/pull/7553 for details + keepalive: pendingBodySize <= 6e4 && pendingCount < 15, + ...options4.fetchOptions + }; + if (!nativeFetch) { + clearCachedImplementation("fetch"); + return rejectedSyncPromise("No fetch implementation available"); + } + try { + return nativeFetch(options4.url, requestOptions).then((response) => { + pendingBodySize -= requestSize; + pendingCount--; + return { + statusCode: response.status, + headers: { + "x-sentry-rate-limits": response.headers.get("X-Sentry-Rate-Limits"), + "retry-after": response.headers.get("Retry-After") + } + }; + }); + } catch (e2) { + clearCachedImplementation("fetch"); + pendingBodySize -= requestSize; + pendingCount--; + return rejectedSyncPromise(e2); + } + } + __name(makeRequest, "makeRequest"); + return createTransport(options4, makeRequest); +} +__name(makeFetchTransport, "makeFetchTransport"); +const OPERA10_PRIORITY = 10; +const OPERA11_PRIORITY = 20; +const CHROME_PRIORITY = 30; +const WINJS_PRIORITY = 40; +const GECKO_PRIORITY = 50; +function createFrame(filename, func, lineno, colno) { + const frame = { + filename, + function: func === "" ? UNKNOWN_FUNCTION : func, + in_app: true + // All browser frames are considered in_app + }; + if (lineno !== void 0) { + frame.lineno = lineno; + } + if (colno !== void 0) { + frame.colno = colno; + } + return frame; +} +__name(createFrame, "createFrame"); +const chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i; +const chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i; +const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/; +const chromeStackParserFn = /* @__PURE__ */ __name((line) => { + const noFnParts = chromeRegexNoFnName.exec(line); + if (noFnParts) { + const [, filename, line2, col] = noFnParts; + return createFrame(filename, UNKNOWN_FUNCTION, +line2, +col); + } + const parts2 = chromeRegex.exec(line); + if (parts2) { + const isEval = parts2[2] && parts2[2].indexOf("eval") === 0; + if (isEval) { + const subMatch = chromeEvalRegex.exec(parts2[2]); + if (subMatch) { + parts2[2] = subMatch[1]; + parts2[3] = subMatch[2]; + parts2[4] = subMatch[3]; + } + } + const [func, filename] = extractSafariExtensionDetails(parts2[1] || UNKNOWN_FUNCTION, parts2[2]); + return createFrame(filename, func, parts2[3] ? +parts2[3] : void 0, parts2[4] ? +parts2[4] : void 0); + } + return; +}, "chromeStackParserFn"); +const chromeStackLineParser = [CHROME_PRIORITY, chromeStackParserFn]; +const geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i; +const geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i; +const gecko$1 = /* @__PURE__ */ __name((line) => { + const parts2 = geckoREgex.exec(line); + if (parts2) { + const isEval = parts2[3] && parts2[3].indexOf(" > eval") > -1; + if (isEval) { + const subMatch = geckoEvalRegex.exec(parts2[3]); + if (subMatch) { + parts2[1] = parts2[1] || "eval"; + parts2[3] = subMatch[1]; + parts2[4] = subMatch[2]; + parts2[5] = ""; + } + } + let filename = parts2[3]; + let func = parts2[1] || UNKNOWN_FUNCTION; + [func, filename] = extractSafariExtensionDetails(func, filename); + return createFrame(filename, func, parts2[4] ? +parts2[4] : void 0, parts2[5] ? +parts2[5] : void 0); + } + return; +}, "gecko$1"); +const geckoStackLineParser = [GECKO_PRIORITY, gecko$1]; +const winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i; +const winjs = /* @__PURE__ */ __name((line) => { + const parts2 = winjsRegex.exec(line); + return parts2 ? createFrame(parts2[2], parts2[1] || UNKNOWN_FUNCTION, +parts2[3], parts2[4] ? +parts2[4] : void 0) : void 0; +}, "winjs"); +const winjsStackLineParser = [WINJS_PRIORITY, winjs]; +const opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i; +const opera10 = /* @__PURE__ */ __name((line) => { + const parts2 = opera10Regex.exec(line); + return parts2 ? createFrame(parts2[2], parts2[3] || UNKNOWN_FUNCTION, +parts2[1]) : void 0; +}, "opera10"); +const opera10StackLineParser = [OPERA10_PRIORITY, opera10]; +const opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:]+)>|([^)]+))\(.*\))? in (.*):\s*$/i; +const opera11 = /* @__PURE__ */ __name((line) => { + const parts2 = opera11Regex.exec(line); + return parts2 ? createFrame(parts2[5], parts2[3] || parts2[4] || UNKNOWN_FUNCTION, +parts2[1], +parts2[2]) : void 0; +}, "opera11"); +const opera11StackLineParser = [OPERA11_PRIORITY, opera11]; +const defaultStackLineParsers = [chromeStackLineParser, geckoStackLineParser]; +const defaultStackParser = createStackParser(...defaultStackLineParsers); +const extractSafariExtensionDetails = /* @__PURE__ */ __name((func, filename) => { + const isSafariExtension = func.indexOf("safari-extension") !== -1; + const isSafariWebExtension = func.indexOf("safari-web-extension") !== -1; + return isSafariExtension || isSafariWebExtension ? [ + func.indexOf("@") !== -1 ? func.split("@")[0] : UNKNOWN_FUNCTION, + isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}` + ] : [func, filename]; +}, "extractSafariExtensionDetails"); +const MAX_ALLOWED_STRING_LENGTH = 1024; +const INTEGRATION_NAME$a = "Breadcrumbs"; +const _breadcrumbsIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const _options = { + console: true, + dom: true, + fetch: true, + history: true, + sentry: true, + xhr: true, + ...options4 + }; + return { + name: INTEGRATION_NAME$a, + setup(client) { + if (_options.console) { + addConsoleInstrumentationHandler(_getConsoleBreadcrumbHandler(client)); + } + if (_options.dom) { + addClickKeypressInstrumentationHandler(_getDomBreadcrumbHandler(client, _options.dom)); + } + if (_options.xhr) { + addXhrInstrumentationHandler(_getXhrBreadcrumbHandler(client)); + } + if (_options.fetch) { + addFetchInstrumentationHandler(_getFetchBreadcrumbHandler(client)); + } + if (_options.history) { + addHistoryInstrumentationHandler(_getHistoryBreadcrumbHandler(client)); + } + if (_options.sentry) { + client.on("beforeSendEvent", _getSentryBreadcrumbHandler(client)); + } + } + }; +}, "_breadcrumbsIntegration"); +const breadcrumbsIntegration = defineIntegration(_breadcrumbsIntegration); +function _getSentryBreadcrumbHandler(client) { + return /* @__PURE__ */ __name(function addSentryBreadcrumb(event) { + if (getClient() !== client) { + return; + } + addBreadcrumb( + { + category: `sentry.${event.type === "transaction" ? "transaction" : "event"}`, + event_id: event.event_id, + level: event.level, + message: getEventDescription(event) + }, + { + event + } + ); + }, "addSentryBreadcrumb"); +} +__name(_getSentryBreadcrumbHandler, "_getSentryBreadcrumbHandler"); +function _getDomBreadcrumbHandler(client, dom) { + return /* @__PURE__ */ __name(function _innerDomBreadcrumb(handlerData) { + if (getClient() !== client) { + return; + } + let target; + let componentName; + let keyAttrs = typeof dom === "object" ? dom.serializeAttribute : void 0; + let maxStringLength = typeof dom === "object" && typeof dom.maxStringLength === "number" ? dom.maxStringLength : void 0; + if (maxStringLength && maxStringLength > MAX_ALLOWED_STRING_LENGTH) { + DEBUG_BUILD$4 && logger$2.warn( + `\`dom.maxStringLength\` cannot exceed ${MAX_ALLOWED_STRING_LENGTH}, but a value of ${maxStringLength} was configured. Sentry will use ${MAX_ALLOWED_STRING_LENGTH} instead.` + ); + maxStringLength = MAX_ALLOWED_STRING_LENGTH; + } + if (typeof keyAttrs === "string") { + keyAttrs = [keyAttrs]; + } + try { + const event = handlerData.event; + const element = _isEvent(event) ? event.target : event; + target = htmlTreeAsString(element, { keyAttrs, maxStringLength }); + componentName = getComponentName$1(element); + } catch (e2) { + target = ""; + } + if (target.length === 0) { + return; + } + const breadcrumb = { + category: `ui.${handlerData.name}`, + message: target + }; + if (componentName) { + breadcrumb.data = { "ui.component_name": componentName }; + } + addBreadcrumb(breadcrumb, { + event: handlerData.event, + name: handlerData.name, + global: handlerData.global + }); + }, "_innerDomBreadcrumb"); +} +__name(_getDomBreadcrumbHandler, "_getDomBreadcrumbHandler"); +function _getConsoleBreadcrumbHandler(client) { + return /* @__PURE__ */ __name(function _consoleBreadcrumb(handlerData) { + if (getClient() !== client) { + return; + } + const breadcrumb = { + category: "console", + data: { + arguments: handlerData.args, + logger: "console" + }, + level: severityLevelFromString(handlerData.level), + message: safeJoin(handlerData.args, " ") + }; + if (handlerData.level === "assert") { + if (handlerData.args[0] === false) { + breadcrumb.message = `Assertion failed: ${safeJoin(handlerData.args.slice(1), " ") || "console.assert"}`; + breadcrumb.data.arguments = handlerData.args.slice(1); + } else { + return; + } + } + addBreadcrumb(breadcrumb, { + input: handlerData.args, + level: handlerData.level + }); + }, "_consoleBreadcrumb"); +} +__name(_getConsoleBreadcrumbHandler, "_getConsoleBreadcrumbHandler"); +function _getXhrBreadcrumbHandler(client) { + return /* @__PURE__ */ __name(function _xhrBreadcrumb(handlerData) { + if (getClient() !== client) { + return; + } + const { startTimestamp, endTimestamp } = handlerData; + const sentryXhrData = handlerData.xhr[SENTRY_XHR_DATA_KEY]; + if (!startTimestamp || !endTimestamp || !sentryXhrData) { + return; + } + const { method, url, status_code, body } = sentryXhrData; + const data25 = { + method, + url, + status_code + }; + const hint = { + xhr: handlerData.xhr, + input: body, + startTimestamp, + endTimestamp + }; + const level = getBreadcrumbLogLevelFromHttpStatusCode(status_code); + addBreadcrumb( + { + category: "xhr", + data: data25, + type: "http", + level + }, + hint + ); + }, "_xhrBreadcrumb"); +} +__name(_getXhrBreadcrumbHandler, "_getXhrBreadcrumbHandler"); +function _getFetchBreadcrumbHandler(client) { + return /* @__PURE__ */ __name(function _fetchBreadcrumb(handlerData) { + if (getClient() !== client) { + return; + } + const { startTimestamp, endTimestamp } = handlerData; + if (!endTimestamp) { + return; + } + if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === "POST") { + return; + } + if (handlerData.error) { + const data25 = handlerData.fetchData; + const hint = { + data: handlerData.error, + input: handlerData.args, + startTimestamp, + endTimestamp + }; + addBreadcrumb( + { + category: "fetch", + data: data25, + level: "error", + type: "http" + }, + hint + ); + } else { + const response = handlerData.response; + const data25 = { + ...handlerData.fetchData, + status_code: response && response.status + }; + const hint = { + input: handlerData.args, + response, + startTimestamp, + endTimestamp + }; + const level = getBreadcrumbLogLevelFromHttpStatusCode(data25.status_code); + addBreadcrumb( + { + category: "fetch", + data: data25, + type: "http", + level + }, + hint + ); + } + }, "_fetchBreadcrumb"); +} +__name(_getFetchBreadcrumbHandler, "_getFetchBreadcrumbHandler"); +function _getHistoryBreadcrumbHandler(client) { + return /* @__PURE__ */ __name(function _historyBreadcrumb(handlerData) { + if (getClient() !== client) { + return; + } + let from2 = handlerData.from; + let to = handlerData.to; + const parsedLoc = parseUrl$1(WINDOW$5.location.href); + let parsedFrom = from2 ? parseUrl$1(from2) : void 0; + const parsedTo = parseUrl$1(to); + if (!parsedFrom || !parsedFrom.path) { + parsedFrom = parsedLoc; + } + if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) { + to = parsedTo.relative; + } + if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) { + from2 = parsedFrom.relative; + } + addBreadcrumb({ + category: "navigation", + data: { + from: from2, + to + } + }); + }, "_historyBreadcrumb"); +} +__name(_getHistoryBreadcrumbHandler, "_getHistoryBreadcrumbHandler"); +function _isEvent(event) { + return !!event && !!event.target; +} +__name(_isEvent, "_isEvent"); +const DEFAULT_EVENT_TARGET = [ + "EventTarget", + "Window", + "Node", + "ApplicationCache", + "AudioTrackList", + "BroadcastChannel", + "ChannelMergerNode", + "CryptoOperation", + "EventSource", + "FileReader", + "HTMLUnknownElement", + "IDBDatabase", + "IDBRequest", + "IDBTransaction", + "KeyOperation", + "MediaController", + "MessagePort", + "ModalWindow", + "Notification", + "SVGElementInstance", + "Screen", + "SharedWorker", + "TextTrack", + "TextTrackCue", + "TextTrackList", + "WebSocket", + "WebSocketWorker", + "Worker", + "XMLHttpRequest", + "XMLHttpRequestEventTarget", + "XMLHttpRequestUpload" +]; +const INTEGRATION_NAME$9 = "BrowserApiErrors"; +const _browserApiErrorsIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const _options = { + XMLHttpRequest: true, + eventTarget: true, + requestAnimationFrame: true, + setInterval: true, + setTimeout: true, + ...options4 + }; + return { + name: INTEGRATION_NAME$9, + // TODO: This currently only works for the first client this is setup + // We may want to adjust this to check for client etc. + setupOnce() { + if (_options.setTimeout) { + fill(WINDOW$5, "setTimeout", _wrapTimeFunction); + } + if (_options.setInterval) { + fill(WINDOW$5, "setInterval", _wrapTimeFunction); + } + if (_options.requestAnimationFrame) { + fill(WINDOW$5, "requestAnimationFrame", _wrapRAF); + } + if (_options.XMLHttpRequest && "XMLHttpRequest" in WINDOW$5) { + fill(XMLHttpRequest.prototype, "send", _wrapXHR$1); + } + const eventTargetOption = _options.eventTarget; + if (eventTargetOption) { + const eventTarget = Array.isArray(eventTargetOption) ? eventTargetOption : DEFAULT_EVENT_TARGET; + eventTarget.forEach(_wrapEventTarget); + } + } + }; +}, "_browserApiErrorsIntegration"); +const browserApiErrorsIntegration = defineIntegration(_browserApiErrorsIntegration); +function _wrapTimeFunction(original) { + return function(...args) { + const originalCallback = args[0]; + args[0] = wrap$1(originalCallback, { + mechanism: { + data: { function: getFunctionName(original) }, + handled: false, + type: "instrument" + } + }); + return original.apply(this, args); + }; +} +__name(_wrapTimeFunction, "_wrapTimeFunction"); +function _wrapRAF(original) { + return function(callback) { + return original.apply(this, [ + wrap$1(callback, { + mechanism: { + data: { + function: "requestAnimationFrame", + handler: getFunctionName(original) + }, + handled: false, + type: "instrument" + } + }) + ]); + }; +} +__name(_wrapRAF, "_wrapRAF"); +function _wrapXHR$1(originalSend) { + return function(...args) { + const xhr = this; + const xmlHttpRequestProps = ["onload", "onerror", "onprogress", "onreadystatechange"]; + xmlHttpRequestProps.forEach((prop2) => { + if (prop2 in xhr && typeof xhr[prop2] === "function") { + fill(xhr, prop2, function(original) { + const wrapOptions = { + mechanism: { + data: { + function: prop2, + handler: getFunctionName(original) + }, + handled: false, + type: "instrument" + } + }; + const originalFunction = getOriginalFunction(original); + if (originalFunction) { + wrapOptions.mechanism.data.handler = getFunctionName(originalFunction); + } + return wrap$1(original, wrapOptions); + }); + } + }); + return originalSend.apply(this, args); + }; +} +__name(_wrapXHR$1, "_wrapXHR$1"); +function _wrapEventTarget(target) { + const globalObject = WINDOW$5; + const targetObj = globalObject[target]; + const proto = targetObj && targetObj.prototype; + if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty("addEventListener")) { + return; + } + fill(proto, "addEventListener", function(original) { + return function(eventName, fn, options4) { + try { + if (isEventListenerObject(fn)) { + fn.handleEvent = wrap$1(fn.handleEvent, { + mechanism: { + data: { + function: "handleEvent", + handler: getFunctionName(fn), + target + }, + handled: false, + type: "instrument" + } + }); + } + } catch (e2) { + } + return original.apply(this, [ + eventName, + wrap$1(fn, { + mechanism: { + data: { + function: "addEventListener", + handler: getFunctionName(fn), + target + }, + handled: false, + type: "instrument" + } + }), + options4 + ]); + }; + }); + fill(proto, "removeEventListener", function(originalRemoveEventListener) { + return function(eventName, fn, options4) { + try { + const originalEventHandler = fn.__sentry_wrapped__; + if (originalEventHandler) { + originalRemoveEventListener.call(this, eventName, originalEventHandler, options4); + } + } catch (e2) { + } + return originalRemoveEventListener.call(this, eventName, fn, options4); + }; + }); +} +__name(_wrapEventTarget, "_wrapEventTarget"); +function isEventListenerObject(obj) { + return typeof obj.handleEvent === "function"; +} +__name(isEventListenerObject, "isEventListenerObject"); +const browserSessionIntegration = defineIntegration(() => { + return { + name: "BrowserSession", + setupOnce() { + if (typeof WINDOW$5.document === "undefined") { + DEBUG_BUILD$4 && logger$2.warn("Using the `browserSessionIntegration` in non-browser environments is not supported."); + return; + } + startSession({ ignoreDuration: true }); + captureSession(); + addHistoryInstrumentationHandler(({ from: from2, to }) => { + if (from2 !== void 0 && from2 !== to) { + startSession({ ignoreDuration: true }); + captureSession(); + } + }); + } + }; +}); +const INTEGRATION_NAME$8 = "GlobalHandlers"; +const _globalHandlersIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const _options = { + onerror: true, + onunhandledrejection: true, + ...options4 + }; + return { + name: INTEGRATION_NAME$8, + setupOnce() { + Error.stackTraceLimit = 50; + }, + setup(client) { + if (_options.onerror) { + _installGlobalOnErrorHandler(client); + globalHandlerLog("onerror"); + } + if (_options.onunhandledrejection) { + _installGlobalOnUnhandledRejectionHandler(client); + globalHandlerLog("onunhandledrejection"); + } + } + }; +}, "_globalHandlersIntegration"); +const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration); +function _installGlobalOnErrorHandler(client) { + addGlobalErrorInstrumentationHandler((data25) => { + const { stackParser, attachStacktrace } = getOptions(); + if (getClient() !== client || shouldIgnoreOnError()) { + return; + } + const { msg, url, line, column, error: error2 } = data25; + const event = _enhanceEventWithInitialFrame( + eventFromUnknownInput(stackParser, error2 || msg, void 0, attachStacktrace, false), + url, + line, + column + ); + event.level = "error"; + captureEvent(event, { + originalException: error2, + mechanism: { + handled: false, + type: "onerror" + } + }); + }); +} +__name(_installGlobalOnErrorHandler, "_installGlobalOnErrorHandler"); +function _installGlobalOnUnhandledRejectionHandler(client) { + addGlobalUnhandledRejectionInstrumentationHandler((e2) => { + const { stackParser, attachStacktrace } = getOptions(); + if (getClient() !== client || shouldIgnoreOnError()) { + return; + } + const error2 = _getUnhandledRejectionError(e2); + const event = isPrimitive(error2) ? _eventFromRejectionWithPrimitive(error2) : eventFromUnknownInput(stackParser, error2, void 0, attachStacktrace, true); + event.level = "error"; + captureEvent(event, { + originalException: error2, + mechanism: { + handled: false, + type: "onunhandledrejection" + } + }); + }); +} +__name(_installGlobalOnUnhandledRejectionHandler, "_installGlobalOnUnhandledRejectionHandler"); +function _getUnhandledRejectionError(error2) { + if (isPrimitive(error2)) { + return error2; + } + try { + if ("reason" in error2) { + return error2.reason; + } + if ("detail" in error2 && "reason" in error2.detail) { + return error2.detail.reason; + } + } catch (e2) { + } + return error2; +} +__name(_getUnhandledRejectionError, "_getUnhandledRejectionError"); +function _eventFromRejectionWithPrimitive(reason) { + return { + exception: { + values: [ + { + type: "UnhandledRejection", + // String() is needed because the Primitive type includes symbols (which can't be automatically stringified) + value: `Non-Error promise rejection captured with value: ${String(reason)}` + } + ] + } + }; +} +__name(_eventFromRejectionWithPrimitive, "_eventFromRejectionWithPrimitive"); +function _enhanceEventWithInitialFrame(event, url, line, column) { + const e2 = event.exception = event.exception || {}; + const ev = e2.values = e2.values || []; + const ev0 = ev[0] = ev[0] || {}; + const ev0s = ev0.stacktrace = ev0.stacktrace || {}; + const ev0sf = ev0s.frames = ev0s.frames || []; + const colno = column; + const lineno = line; + const filename = isString$8(url) && url.length > 0 ? url : getLocationHref(); + if (ev0sf.length === 0) { + ev0sf.push({ + colno, + filename, + function: UNKNOWN_FUNCTION, + in_app: true, + lineno + }); + } + return event; +} +__name(_enhanceEventWithInitialFrame, "_enhanceEventWithInitialFrame"); +function globalHandlerLog(type) { + DEBUG_BUILD$4 && logger$2.log(`Global Handler attached: ${type}`); +} +__name(globalHandlerLog, "globalHandlerLog"); +function getOptions() { + const client = getClient(); + const options4 = client && client.getOptions() || { + stackParser: /* @__PURE__ */ __name(() => [], "stackParser"), + attachStacktrace: false + }; + return options4; +} +__name(getOptions, "getOptions"); +const httpContextIntegration = defineIntegration(() => { + return { + name: "HttpContext", + preprocessEvent(event) { + if (!WINDOW$5.navigator && !WINDOW$5.location && !WINDOW$5.document) { + return; + } + const url = event.request && event.request.url || WINDOW$5.location && WINDOW$5.location.href; + const { referrer } = WINDOW$5.document || {}; + const { userAgent } = WINDOW$5.navigator || {}; + const headers = { + ...event.request && event.request.headers, + ...referrer && { Referer: referrer }, + ...userAgent && { "User-Agent": userAgent } + }; + const request = { ...event.request, ...url && { url }, headers }; + event.request = request; + } + }; +}); +const DEFAULT_KEY = "cause"; +const DEFAULT_LIMIT = 5; +const INTEGRATION_NAME$7 = "LinkedErrors"; +const _linkedErrorsIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const limit = options4.limit || DEFAULT_LIMIT; + const key = options4.key || DEFAULT_KEY; + return { + name: INTEGRATION_NAME$7, + preprocessEvent(event, hint, client) { + const options5 = client.getOptions(); + applyAggregateErrorsToEvent( + // This differs from the LinkedErrors integration in core by using a different exceptionFromError function + exceptionFromError, + options5.stackParser, + options5.maxValueLength, + key, + limit, + event, + hint + ); + } + }; +}, "_linkedErrorsIntegration"); +const linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration); +function getDefaultIntegrations(options4) { + const integrations = [ + inboundFiltersIntegration(), + functionToStringIntegration(), + browserApiErrorsIntegration(), + breadcrumbsIntegration(), + globalHandlersIntegration(), + linkedErrorsIntegration(), + dedupeIntegration(), + httpContextIntegration() + ]; + if (options4.autoSessionTracking !== false) { + integrations.push(browserSessionIntegration()); + } + return integrations; +} +__name(getDefaultIntegrations, "getDefaultIntegrations"); +function applyDefaultOptions(optionsArg = {}) { + const defaultOptions2 = { + defaultIntegrations: getDefaultIntegrations(optionsArg), + release: typeof __SENTRY_RELEASE__ === "string" ? __SENTRY_RELEASE__ : WINDOW$5.SENTRY_RELEASE && WINDOW$5.SENTRY_RELEASE.id ? WINDOW$5.SENTRY_RELEASE.id : void 0, + autoSessionTracking: true, + sendClientReports: true + }; + if (optionsArg.defaultIntegrations == null) { + delete optionsArg.defaultIntegrations; + } + return { ...defaultOptions2, ...optionsArg }; +} +__name(applyDefaultOptions, "applyDefaultOptions"); +function shouldShowBrowserExtensionError() { + const windowWithMaybeExtension = typeof WINDOW$5.window !== "undefined" && WINDOW$5; + if (!windowWithMaybeExtension) { + return false; + } + const extensionKey = windowWithMaybeExtension.chrome ? "chrome" : "browser"; + const extensionObject = windowWithMaybeExtension[extensionKey]; + const runtimeId = extensionObject && extensionObject.runtime && extensionObject.runtime.id; + const href = WINDOW$5.location && WINDOW$5.location.href || ""; + const extensionProtocols = ["chrome-extension:", "moz-extension:", "ms-browser-extension:", "safari-web-extension:"]; + const isDedicatedExtensionPage = !!runtimeId && WINDOW$5 === WINDOW$5.top && extensionProtocols.some((protocol) => href.startsWith(`${protocol}//`)); + const isNWjs = typeof windowWithMaybeExtension.nw !== "undefined"; + return !!runtimeId && !isDedicatedExtensionPage && !isNWjs; +} +__name(shouldShowBrowserExtensionError, "shouldShowBrowserExtensionError"); +function init$4(browserOptions = {}) { + const options4 = applyDefaultOptions(browserOptions); + if (!options4.skipBrowserExtensionCheck && shouldShowBrowserExtensionError()) { + consoleSandbox(() => { + console.error( + "[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/" + ); + }); + return; + } + if (DEBUG_BUILD$4) { + if (!supportsFetch()) { + logger$2.warn( + "No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill." + ); + } + } + const clientOptions = { + ...options4, + stackParser: stackParserFromStackParserOptions(options4.stackParser || defaultStackParser), + integrations: getIntegrationsToSetup(options4), + transport: options4.transport || makeFetchTransport + }; + return initAndBind(BrowserClient, clientOptions); +} +__name(init$4, "init$4"); +function showReportDialog(options4 = {}) { + if (!WINDOW$5.document) { + DEBUG_BUILD$4 && logger$2.error("Global document not defined in showReportDialog call"); + return; + } + const scope = getCurrentScope$1(); + const client = scope.getClient(); + const dsn = client && client.getDsn(); + if (!dsn) { + DEBUG_BUILD$4 && logger$2.error("DSN not configured for showReportDialog call"); + return; + } + if (scope) { + options4.user = { + ...scope.getUser(), + ...options4.user + }; + } + if (!options4.eventId) { + const eventId = lastEventId(); + if (eventId) { + options4.eventId = eventId; + } + } + const script2 = WINDOW$5.document.createElement("script"); + script2.async = true; + script2.crossOrigin = "anonymous"; + script2.src = getReportDialogEndpoint(dsn, options4); + if (options4.onLoad) { + script2.onload = options4.onLoad; + } + const { onClose } = options4; + if (onClose) { + const reportDialogClosedMessageHandler = /* @__PURE__ */ __name((event) => { + if (event.data === "__sentry_reportdialog_closed__") { + try { + onClose(); + } finally { + WINDOW$5.removeEventListener("message", reportDialogClosedMessageHandler); + } + } + }, "reportDialogClosedMessageHandler"); + WINDOW$5.addEventListener("message", reportDialogClosedMessageHandler); + } + const injectionPoint = WINDOW$5.document.head || WINDOW$5.document.body; + if (injectionPoint) { + injectionPoint.appendChild(script2); + } else { + DEBUG_BUILD$4 && logger$2.error("Not injecting report dialog. No injection point found in HTML"); + } +} +__name(showReportDialog, "showReportDialog"); +function forceLoad() { +} +__name(forceLoad, "forceLoad"); +function onLoad(callback) { + callback(); +} +__name(onLoad, "onLoad"); +function captureUserFeedback(feedback) { + const client = getClient(); + if (client) { + client.captureUserFeedback(feedback); + } +} +__name(captureUserFeedback, "captureUserFeedback"); +const LazyLoadableIntegrations = { + replayIntegration: "replay", + replayCanvasIntegration: "replay-canvas", + feedbackIntegration: "feedback", + feedbackModalIntegration: "feedback-modal", + feedbackScreenshotIntegration: "feedback-screenshot", + captureConsoleIntegration: "captureconsole", + contextLinesIntegration: "contextlines", + linkedErrorsIntegration: "linkederrors", + debugIntegration: "debug", + dedupeIntegration: "dedupe", + extraErrorDataIntegration: "extraerrordata", + httpClientIntegration: "httpclient", + reportingObserverIntegration: "reportingobserver", + rewriteFramesIntegration: "rewriteframes", + sessionTimingIntegration: "sessiontiming", + browserProfilingIntegration: "browserprofiling", + moduleMetadataIntegration: "modulemetadata" +}; +const WindowWithMaybeIntegration = WINDOW$5; +async function lazyLoadIntegration(name2, scriptNonce) { + const bundle = LazyLoadableIntegrations[name2]; + const sentryOnWindow = WindowWithMaybeIntegration.Sentry = WindowWithMaybeIntegration.Sentry || {}; + if (!bundle) { + throw new Error(`Cannot lazy load integration: ${name2}`); + } + const existing = sentryOnWindow[name2]; + if (typeof existing === "function" && !("_isShim" in existing)) { + return existing; + } + const url = getScriptURL(bundle); + const script2 = WINDOW$5.document.createElement("script"); + script2.src = url; + script2.crossOrigin = "anonymous"; + script2.referrerPolicy = "origin"; + if (scriptNonce) { + script2.setAttribute("nonce", scriptNonce); + } + const waitForLoad = new Promise((resolve2, reject3) => { + script2.addEventListener("load", () => resolve2()); + script2.addEventListener("error", reject3); + }); + const currentScript = WINDOW$5.document.currentScript; + const parent = WINDOW$5.document.body || WINDOW$5.document.head || currentScript && currentScript.parentElement; + if (parent) { + parent.appendChild(script2); + } else { + throw new Error(`Could not find parent element to insert lazy-loaded ${name2} script`); + } + try { + await waitForLoad; + } catch (e2) { + throw new Error(`Error when loading integration: ${name2}`); + } + const integrationFn = sentryOnWindow[name2]; + if (typeof integrationFn !== "function") { + throw new Error(`Could not load integration: ${name2}`); + } + return integrationFn; +} +__name(lazyLoadIntegration, "lazyLoadIntegration"); +function getScriptURL(bundle) { + const client = getClient(); + const options4 = client && client.getOptions(); + const baseURL = options4 && options4.cdnBaseUrl || "https://browser.sentry-cdn.com"; + return new URL(`/${SDK_VERSION}/${bundle}.min.js`, baseURL).toString(); +} +__name(getScriptURL, "getScriptURL"); +const WINDOW$3 = GLOBAL_OBJ; +const INTEGRATION_NAME$6 = "ReportingObserver"; +const SETUP_CLIENTS = /* @__PURE__ */ new WeakMap(); +const _reportingObserverIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const types = options4.types || ["crash", "deprecation", "intervention"]; + function handler6(reports) { + if (!SETUP_CLIENTS.has(getClient())) { + return; + } + for (const report of reports) { + withScope((scope) => { + scope.setExtra("url", report.url); + const label5 = `ReportingObserver [${report.type}]`; + let details = "No details available"; + if (report.body) { + const plainBody = {}; + for (const prop2 in report.body) { + plainBody[prop2] = report.body[prop2]; + } + scope.setExtra("body", plainBody); + if (report.type === "crash") { + const body = report.body; + details = [body.crashId || "", body.reason || ""].join(" ").trim() || details; + } else { + const body = report.body; + details = body.message || details; + } + } + captureMessage(`${label5}: ${details}`); + }); + } + } + __name(handler6, "handler"); + return { + name: INTEGRATION_NAME$6, + setupOnce() { + if (!supportsReportingObserver()) { + return; + } + const observer = new WINDOW$3.ReportingObserver( + handler6, + { + buffered: true, + types + } + ); + observer.observe(); + }, + setup(client) { + SETUP_CLIENTS.set(client, true); + } + }; +}, "_reportingObserverIntegration"); +const reportingObserverIntegration = defineIntegration(_reportingObserverIntegration); +const INTEGRATION_NAME$5 = "HttpClient"; +const _httpClientIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const _options = { + failedRequestStatusCodes: [[500, 599]], + failedRequestTargets: [/.*/], + ...options4 + }; + return { + name: INTEGRATION_NAME$5, + setup(client) { + _wrapFetch(client, _options); + _wrapXHR(client, _options); + } + }; +}, "_httpClientIntegration"); +const httpClientIntegration = defineIntegration(_httpClientIntegration); +function _fetchResponseHandler(options4, requestInfo, response, requestInit, error2) { + if (_shouldCaptureResponse(options4, response.status, response.url)) { + const request = _getRequest(requestInfo, requestInit); + let requestHeaders, responseHeaders, requestCookies, responseCookies; + if (_shouldSendDefaultPii()) { + [requestHeaders, requestCookies] = _parseCookieHeaders("Cookie", request); + [responseHeaders, responseCookies] = _parseCookieHeaders("Set-Cookie", response); + } + const event = _createEvent({ + url: request.url, + method: request.method, + status: response.status, + requestHeaders, + responseHeaders, + requestCookies, + responseCookies, + error: error2 + }); + captureEvent(event); + } +} +__name(_fetchResponseHandler, "_fetchResponseHandler"); +function _parseCookieHeaders(cookieHeader, obj) { + const headers = _extractFetchHeaders(obj.headers); + let cookies2; + try { + const cookieString = headers[cookieHeader] || headers[cookieHeader.toLowerCase()] || void 0; + if (cookieString) { + cookies2 = _parseCookieString(cookieString); + } + } catch (e2) { + } + return [headers, cookies2]; +} +__name(_parseCookieHeaders, "_parseCookieHeaders"); +function _xhrResponseHandler(options4, xhr, method, headers, error2) { + if (_shouldCaptureResponse(options4, xhr.status, xhr.responseURL)) { + let requestHeaders, responseCookies, responseHeaders; + if (_shouldSendDefaultPii()) { + try { + const cookieString = xhr.getResponseHeader("Set-Cookie") || xhr.getResponseHeader("set-cookie") || void 0; + if (cookieString) { + responseCookies = _parseCookieString(cookieString); + } + } catch (e3) { + } + try { + responseHeaders = _getXHRResponseHeaders(xhr); + } catch (e4) { + } + requestHeaders = headers; + } + const event = _createEvent({ + url: xhr.responseURL, + method, + status: xhr.status, + requestHeaders, + // Can't access request cookies from XHR + responseHeaders, + responseCookies, + error: error2 + }); + captureEvent(event); + } +} +__name(_xhrResponseHandler, "_xhrResponseHandler"); +function _getResponseSizeFromHeaders(headers) { + if (headers) { + const contentLength = headers["Content-Length"] || headers["content-length"]; + if (contentLength) { + return parseInt(contentLength, 10); + } + } + return void 0; +} +__name(_getResponseSizeFromHeaders, "_getResponseSizeFromHeaders"); +function _parseCookieString(cookieString) { + return cookieString.split("; ").reduce((acc, cookie) => { + const [key, value4] = cookie.split("="); + if (key && value4) { + acc[key] = value4; + } + return acc; + }, {}); +} +__name(_parseCookieString, "_parseCookieString"); +function _extractFetchHeaders(headers) { + const result = {}; + headers.forEach((value4, key) => { + result[key] = value4; + }); + return result; +} +__name(_extractFetchHeaders, "_extractFetchHeaders"); +function _getXHRResponseHeaders(xhr) { + const headers = xhr.getAllResponseHeaders(); + if (!headers) { + return {}; + } + return headers.split("\r\n").reduce((acc, line) => { + const [key, value4] = line.split(": "); + if (key && value4) { + acc[key] = value4; + } + return acc; + }, {}); +} +__name(_getXHRResponseHeaders, "_getXHRResponseHeaders"); +function _isInGivenRequestTargets(failedRequestTargets, target) { + return failedRequestTargets.some((givenRequestTarget) => { + if (typeof givenRequestTarget === "string") { + return target.includes(givenRequestTarget); + } + return givenRequestTarget.test(target); + }); +} +__name(_isInGivenRequestTargets, "_isInGivenRequestTargets"); +function _isInGivenStatusRanges(failedRequestStatusCodes, status) { + return failedRequestStatusCodes.some((range2) => { + if (typeof range2 === "number") { + return range2 === status; + } + return status >= range2[0] && status <= range2[1]; + }); +} +__name(_isInGivenStatusRanges, "_isInGivenStatusRanges"); +function _wrapFetch(client, options4) { + if (!supportsNativeFetch()) { + return; + } + addFetchInstrumentationHandler((handlerData) => { + if (getClient() !== client) { + return; + } + const { response, args, error: error2, virtualError } = handlerData; + const [requestInfo, requestInit] = args; + if (!response) { + return; + } + _fetchResponseHandler(options4, requestInfo, response, requestInit, error2 || virtualError); + }, false); +} +__name(_wrapFetch, "_wrapFetch"); +function _wrapXHR(client, options4) { + if (!("XMLHttpRequest" in GLOBAL_OBJ)) { + return; + } + addXhrInstrumentationHandler((handlerData) => { + if (getClient() !== client) { + return; + } + const { error: error2, virtualError } = handlerData; + const xhr = handlerData.xhr; + const sentryXhrData = xhr[SENTRY_XHR_DATA_KEY]; + if (!sentryXhrData) { + return; + } + const { method, request_headers: headers } = sentryXhrData; + try { + _xhrResponseHandler(options4, xhr, method, headers, error2 || virtualError); + } catch (e2) { + DEBUG_BUILD$4 && logger$2.warn("Error while extracting response event form XHR response", e2); + } + }); +} +__name(_wrapXHR, "_wrapXHR"); +function _shouldCaptureResponse(options4, status, url) { + return _isInGivenStatusRanges(options4.failedRequestStatusCodes, status) && _isInGivenRequestTargets(options4.failedRequestTargets, url) && !isSentryRequestUrl(url, getClient()); +} +__name(_shouldCaptureResponse, "_shouldCaptureResponse"); +function _createEvent(data25) { + const client = getClient(); + const virtualStackTrace = client && data25.error && data25.error instanceof Error ? data25.error.stack : void 0; + const stack2 = virtualStackTrace && client ? client.getOptions().stackParser(virtualStackTrace, 0, 1) : void 0; + const message3 = `HTTP Client Error with status code: ${data25.status}`; + const event = { + message: message3, + exception: { + values: [ + { + type: "Error", + value: message3, + stacktrace: stack2 ? { frames: stack2 } : void 0 + } + ] + }, + request: { + url: data25.url, + method: data25.method, + headers: data25.requestHeaders, + cookies: data25.requestCookies + }, + contexts: { + response: { + status_code: data25.status, + headers: data25.responseHeaders, + cookies: data25.responseCookies, + body_size: _getResponseSizeFromHeaders(data25.responseHeaders) + } + } + }; + addExceptionMechanism(event, { + type: "http.client", + handled: false + }); + return event; +} +__name(_createEvent, "_createEvent"); +function _getRequest(requestInfo, requestInit) { + if (!requestInit && requestInfo instanceof Request) { + return requestInfo; + } + if (requestInfo instanceof Request && requestInfo.bodyUsed) { + return requestInfo; + } + return new Request(requestInfo, requestInit); +} +__name(_getRequest, "_getRequest"); +function _shouldSendDefaultPii() { + const client = getClient(); + return client ? Boolean(client.getOptions().sendDefaultPii) : false; +} +__name(_shouldSendDefaultPii, "_shouldSendDefaultPii"); +const WINDOW$2 = GLOBAL_OBJ; +const DEFAULT_LINES_OF_CONTEXT = 7; +const INTEGRATION_NAME$4 = "ContextLines"; +const _contextLinesIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const contextLines = options4.frameContextLines != null ? options4.frameContextLines : DEFAULT_LINES_OF_CONTEXT; + return { + name: INTEGRATION_NAME$4, + processEvent(event) { + return addSourceContext(event, contextLines); + } + }; +}, "_contextLinesIntegration"); +const contextLinesIntegration = defineIntegration(_contextLinesIntegration); +function addSourceContext(event, contextLines) { + const doc2 = WINDOW$2.document; + const htmlFilename = WINDOW$2.location && stripUrlQueryAndFragment(WINDOW$2.location.href); + if (!doc2 || !htmlFilename) { + return event; + } + const exceptions = event.exception && event.exception.values; + if (!exceptions || !exceptions.length) { + return event; + } + const html = doc2.documentElement.innerHTML; + if (!html) { + return event; + } + const htmlLines = ["", "", ...html.split("\n"), ""]; + exceptions.forEach((exception) => { + const stacktrace = exception.stacktrace; + if (stacktrace && stacktrace.frames) { + stacktrace.frames = stacktrace.frames.map( + (frame) => applySourceContextToFrame(frame, htmlLines, htmlFilename, contextLines) + ); + } + }); + return event; +} +__name(addSourceContext, "addSourceContext"); +function applySourceContextToFrame(frame, htmlLines, htmlFilename, linesOfContext) { + if (frame.filename !== htmlFilename || !frame.lineno || !htmlLines.length) { + return frame; + } + addContextToFrame(htmlLines, frame, linesOfContext); + return frame; +} +__name(applySourceContextToFrame, "applySourceContextToFrame"); +const WINDOW$1 = GLOBAL_OBJ; +const REPLAY_SESSION_KEY = "sentryReplaySession"; +const REPLAY_EVENT_NAME = "replay_event"; +const UNABLE_TO_SEND_REPLAY = "Unable to send Replay"; +const SESSION_IDLE_PAUSE_DURATION = 3e5; +const SESSION_IDLE_EXPIRE_DURATION = 9e5; +const DEFAULT_FLUSH_MIN_DELAY = 5e3; +const DEFAULT_FLUSH_MAX_DELAY = 5500; +const BUFFER_CHECKOUT_TIME = 6e4; +const RETRY_BASE_INTERVAL = 5e3; +const RETRY_MAX_COUNT = 3; +const NETWORK_BODY_MAX_SIZE = 15e4; +const CONSOLE_ARG_MAX_SIZE = 5e3; +const SLOW_CLICK_THRESHOLD = 3e3; +const SLOW_CLICK_SCROLL_TIMEOUT = 300; +const REPLAY_MAX_EVENT_BUFFER_SIZE = 2e7; +const MIN_REPLAY_DURATION = 4999; +const MIN_REPLAY_DURATION_LIMIT = 15e3; +const MAX_REPLAY_DURATION = 36e5; +function _nullishCoalesce$1(lhs, rhsFn) { + if (lhs != null) { + return lhs; + } else { + return rhsFn(); + } +} +__name(_nullishCoalesce$1, "_nullishCoalesce$1"); +function _optionalChain$5(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return void 0; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_optionalChain$5, "_optionalChain$5"); +var NodeType$3; +(function(NodeType3) { + NodeType3[NodeType3["Document"] = 0] = "Document"; + NodeType3[NodeType3["DocumentType"] = 1] = "DocumentType"; + NodeType3[NodeType3["Element"] = 2] = "Element"; + NodeType3[NodeType3["Text"] = 3] = "Text"; + NodeType3[NodeType3["CDATA"] = 4] = "CDATA"; + NodeType3[NodeType3["Comment"] = 5] = "Comment"; +})(NodeType$3 || (NodeType$3 = {})); +function isElement$1(n2) { + return n2.nodeType === n2.ELEMENT_NODE; +} +__name(isElement$1, "isElement$1"); +function isShadowRoot(n2) { + const host = _optionalChain$5([n2, "optionalAccess", (_2) => _2.host]); + return Boolean(_optionalChain$5([host, "optionalAccess", (_2) => _2.shadowRoot]) === n2); +} +__name(isShadowRoot, "isShadowRoot"); +function isNativeShadowDom(shadowRoot) { + return Object.prototype.toString.call(shadowRoot) === "[object ShadowRoot]"; +} +__name(isNativeShadowDom, "isNativeShadowDom"); +function fixBrowserCompatibilityIssuesInCSS(cssText) { + if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) { + cssText = cssText.replace(/\sbackground-clip:\s*text;/g, " -webkit-background-clip: text; background-clip: text;"); + } + return cssText; +} +__name(fixBrowserCompatibilityIssuesInCSS, "fixBrowserCompatibilityIssuesInCSS"); +function escapeImportStatement(rule) { + const { cssText } = rule; + if (cssText.split('"').length < 3) + return cssText; + const statement = ["@import", `url(${JSON.stringify(rule.href)})`]; + if (rule.layerName === "") { + statement.push(`layer`); + } else if (rule.layerName) { + statement.push(`layer(${rule.layerName})`); + } + if (rule.supportsText) { + statement.push(`supports(${rule.supportsText})`); + } + if (rule.media.length) { + statement.push(rule.media.mediaText); + } + return statement.join(" ") + ";"; +} +__name(escapeImportStatement, "escapeImportStatement"); +function stringifyStylesheet(s2) { + try { + const rules = s2.rules || s2.cssRules; + return rules ? fixBrowserCompatibilityIssuesInCSS(Array.from(rules, stringifyRule).join("")) : null; + } catch (error2) { + return null; + } +} +__name(stringifyStylesheet, "stringifyStylesheet"); +function fixAllCssProperty(rule) { + let styles = ""; + for (let i2 = 0; i2 < rule.style.length; i2++) { + const styleDeclaration = rule.style; + const attribute2 = styleDeclaration[i2]; + const isImportant = styleDeclaration.getPropertyPriority(attribute2); + styles += `${attribute2}:${styleDeclaration.getPropertyValue(attribute2)}${isImportant ? ` !important` : ""};`; + } + return `${rule.selectorText} { ${styles} }`; +} +__name(fixAllCssProperty, "fixAllCssProperty"); +function stringifyRule(rule) { + let importStringified; + if (isCSSImportRule(rule)) { + try { + importStringified = stringifyStylesheet(rule.styleSheet) || escapeImportStatement(rule); + } catch (error2) { + } + } else if (isCSSStyleRule(rule)) { + let cssText = rule.cssText; + const needsSafariColonFix = rule.selectorText.includes(":"); + const needsAllFix = typeof rule.style["all"] === "string" && rule.style["all"]; + if (needsAllFix) { + cssText = fixAllCssProperty(rule); + } + if (needsSafariColonFix) { + cssText = fixSafariColons(cssText); + } + if (needsSafariColonFix || needsAllFix) { + return cssText; + } + } + return importStringified || rule.cssText; +} +__name(stringifyRule, "stringifyRule"); +function fixSafariColons(cssStringified) { + const regex2 = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm; + return cssStringified.replace(regex2, "$1\\$2"); +} +__name(fixSafariColons, "fixSafariColons"); +function isCSSImportRule(rule) { + return "styleSheet" in rule; +} +__name(isCSSImportRule, "isCSSImportRule"); +function isCSSStyleRule(rule) { + return "selectorText" in rule; +} +__name(isCSSStyleRule, "isCSSStyleRule"); +class Mirror { + static { + __name(this, "Mirror"); + } + constructor() { + this.idNodeMap = /* @__PURE__ */ new Map(); + this.nodeMetaMap = /* @__PURE__ */ new WeakMap(); + } + getId(n2) { + if (!n2) + return -1; + const id3 = _optionalChain$5([this, "access", (_3) => _3.getMeta, "call", (_4) => _4(n2), "optionalAccess", (_5) => _5.id]); + return _nullishCoalesce$1(id3, () => -1); + } + getNode(id3) { + return this.idNodeMap.get(id3) || null; + } + getIds() { + return Array.from(this.idNodeMap.keys()); + } + getMeta(n2) { + return this.nodeMetaMap.get(n2) || null; + } + removeNodeFromMap(n2) { + const id3 = this.getId(n2); + this.idNodeMap.delete(id3); + if (n2.childNodes) { + n2.childNodes.forEach((childNode) => this.removeNodeFromMap(childNode)); + } + } + has(id3) { + return this.idNodeMap.has(id3); + } + hasNode(node3) { + return this.nodeMetaMap.has(node3); + } + add(n2, meta) { + const id3 = meta.id; + this.idNodeMap.set(id3, n2); + this.nodeMetaMap.set(n2, meta); + } + replace(id3, n2) { + const oldNode = this.getNode(id3); + if (oldNode) { + const meta = this.nodeMetaMap.get(oldNode); + if (meta) + this.nodeMetaMap.set(n2, meta); + } + this.idNodeMap.set(id3, n2); + } + reset() { + this.idNodeMap = /* @__PURE__ */ new Map(); + this.nodeMetaMap = /* @__PURE__ */ new WeakMap(); + } +} +function createMirror() { + return new Mirror(); +} +__name(createMirror, "createMirror"); +function shouldMaskInput({ maskInputOptions, tagName, type }) { + if (tagName === "OPTION") { + tagName = "SELECT"; + } + return Boolean(maskInputOptions[tagName.toLowerCase()] || type && maskInputOptions[type] || type === "password" || tagName === "INPUT" && !type && maskInputOptions["text"]); +} +__name(shouldMaskInput, "shouldMaskInput"); +function maskInputValue({ isMasked: isMasked2, element, value: value4, maskInputFn }) { + let text2 = value4 || ""; + if (!isMasked2) { + return text2; + } + if (maskInputFn) { + text2 = maskInputFn(text2, element); + } + return "*".repeat(text2.length); +} +__name(maskInputValue, "maskInputValue"); +function toLowerCase(str) { + return str.toLowerCase(); +} +__name(toLowerCase, "toLowerCase"); +function toUpperCase(str) { + return str.toUpperCase(); +} +__name(toUpperCase, "toUpperCase"); +const ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__"; +function is2DCanvasBlank(canvas) { + const ctx = canvas.getContext("2d"); + if (!ctx) + return true; + const chunkSize = 50; + for (let x2 = 0; x2 < canvas.width; x2 += chunkSize) { + for (let y2 = 0; y2 < canvas.height; y2 += chunkSize) { + const getImageData = ctx.getImageData; + const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData; + const pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x2, y2, Math.min(chunkSize, canvas.width - x2), Math.min(chunkSize, canvas.height - y2)).data.buffer); + if (pixelBuffer.some((pixel) => pixel !== 0)) + return false; + } + } + return true; +} +__name(is2DCanvasBlank, "is2DCanvasBlank"); +function getInputType(element) { + const type = element.type; + return element.hasAttribute("data-rr-is-password") ? "password" : type ? toLowerCase(type) : null; +} +__name(getInputType, "getInputType"); +function getInputValue(el, tagName, type) { + if (tagName === "INPUT" && (type === "radio" || type === "checkbox")) { + return el.getAttribute("value") || ""; + } + return el.value; +} +__name(getInputValue, "getInputValue"); +function extractFileExtension(path, baseURL) { + let url; + try { + url = new URL(path, _nullishCoalesce$1(baseURL, () => window.location.href)); + } catch (err) { + return null; + } + const regex2 = /\.([0-9a-z]+)(?:$)/i; + const match2 = url.pathname.match(regex2); + return _nullishCoalesce$1(_optionalChain$5([match2, "optionalAccess", (_6) => _6[1]]), () => null); +} +__name(extractFileExtension, "extractFileExtension"); +const cachedImplementations$1 = {}; +function getImplementation$1(name2) { + const cached = cachedImplementations$1[name2]; + if (cached) { + return cached; + } + const document2 = window.document; + let impl = window[name2]; + if (document2 && typeof document2.createElement === "function") { + try { + const sandbox = document2.createElement("iframe"); + sandbox.hidden = true; + document2.head.appendChild(sandbox); + const contentWindow = sandbox.contentWindow; + if (contentWindow && contentWindow[name2]) { + impl = contentWindow[name2]; + } + document2.head.removeChild(sandbox); + } catch (e2) { + } + } + return cachedImplementations$1[name2] = impl.bind(window); +} +__name(getImplementation$1, "getImplementation$1"); +function setTimeout$2(...rest) { + return getImplementation$1("setTimeout")(...rest); +} +__name(setTimeout$2, "setTimeout$2"); +function clearTimeout$2(...rest) { + return getImplementation$1("clearTimeout")(...rest); +} +__name(clearTimeout$2, "clearTimeout$2"); +function getIframeContentDocument(iframe) { + try { + return iframe.contentDocument; + } catch (e2) { + } +} +__name(getIframeContentDocument, "getIframeContentDocument"); +let _id$2 = 1; +const tagNameRegex = new RegExp("[^a-z0-9-_:]"); +const IGNORED_NODE = -2; +function genId() { + return _id$2++; +} +__name(genId, "genId"); +function getValidTagName(element) { + if (element instanceof HTMLFormElement) { + return "form"; + } + const processedTagName = toLowerCase(element.tagName); + if (tagNameRegex.test(processedTagName)) { + return "div"; + } + return processedTagName; +} +__name(getValidTagName, "getValidTagName"); +function extractOrigin(url) { + let origin2 = ""; + if (url.indexOf("//") > -1) { + origin2 = url.split("/").slice(0, 3).join("/"); + } else { + origin2 = url.split("/")[0]; + } + origin2 = origin2.split("?")[0]; + return origin2; +} +__name(extractOrigin, "extractOrigin"); +let canvasService; +let canvasCtx; +const URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm; +const URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\/\//i; +const URL_WWW_MATCH = /^www\..*/i; +const DATA_URI = /^(data:)([^,]*),(.*)/i; +function absoluteToStylesheet(cssText, href) { + return (cssText || "").replace(URL_IN_CSS_REF, (origin2, quote1, path1, quote2, path2, path3) => { + const filePath = path1 || path2 || path3; + const maybeQuote = quote1 || quote2 || ""; + if (!filePath) { + return origin2; + } + if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) { + return `url(${maybeQuote}${filePath}${maybeQuote})`; + } + if (DATA_URI.test(filePath)) { + return `url(${maybeQuote}${filePath}${maybeQuote})`; + } + if (filePath[0] === "/") { + return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`; + } + const stack2 = href.split("/"); + const parts2 = filePath.split("/"); + stack2.pop(); + for (const part of parts2) { + if (part === ".") { + continue; + } else if (part === "..") { + stack2.pop(); + } else { + stack2.push(part); + } + } + return `url(${maybeQuote}${stack2.join("/")}${maybeQuote})`; + }); +} +__name(absoluteToStylesheet, "absoluteToStylesheet"); +const SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/; +const SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/; +function getAbsoluteSrcsetString(doc2, attributeValue) { + if (attributeValue.trim() === "") { + return attributeValue; + } + let pos2 = 0; + function collectCharacters(regEx) { + let chars2; + const match2 = regEx.exec(attributeValue.substring(pos2)); + if (match2) { + chars2 = match2[0]; + pos2 += chars2.length; + return chars2; + } + return ""; + } + __name(collectCharacters, "collectCharacters"); + const output = []; + while (true) { + collectCharacters(SRCSET_COMMAS_OR_SPACES); + if (pos2 >= attributeValue.length) { + break; + } + let url = collectCharacters(SRCSET_NOT_SPACES); + if (url.slice(-1) === ",") { + url = absoluteToDoc(doc2, url.substring(0, url.length - 1)); + output.push(url); + } else { + let descriptorsStr = ""; + url = absoluteToDoc(doc2, url); + let inParens = false; + while (true) { + const c2 = attributeValue.charAt(pos2); + if (c2 === "") { + output.push((url + descriptorsStr).trim()); + break; + } else if (!inParens) { + if (c2 === ",") { + pos2 += 1; + output.push((url + descriptorsStr).trim()); + break; + } else if (c2 === "(") { + inParens = true; + } + } else { + if (c2 === ")") { + inParens = false; + } + } + descriptorsStr += c2; + pos2 += 1; + } + } + } + return output.join(", "); +} +__name(getAbsoluteSrcsetString, "getAbsoluteSrcsetString"); +const cachedDocument = /* @__PURE__ */ new WeakMap(); +function absoluteToDoc(doc2, attributeValue) { + if (!attributeValue || attributeValue.trim() === "") { + return attributeValue; + } + return getHref(doc2, attributeValue); +} +__name(absoluteToDoc, "absoluteToDoc"); +function isSVGElement(el) { + return Boolean(el.tagName === "svg" || el.ownerSVGElement); +} +__name(isSVGElement, "isSVGElement"); +function getHref(doc2, customHref) { + let a2 = cachedDocument.get(doc2); + if (!a2) { + a2 = doc2.createElement("a"); + cachedDocument.set(doc2, a2); + } + if (!customHref) { + customHref = ""; + } else if (customHref.startsWith("blob:") || customHref.startsWith("data:")) { + return customHref; + } + a2.setAttribute("href", customHref); + return a2.href; +} +__name(getHref, "getHref"); +function transformAttribute(doc2, tagName, name2, value4, element, maskAttributeFn) { + if (!value4) { + return value4; + } + if (name2 === "src" || name2 === "href" && !(tagName === "use" && value4[0] === "#")) { + return absoluteToDoc(doc2, value4); + } else if (name2 === "xlink:href" && value4[0] !== "#") { + return absoluteToDoc(doc2, value4); + } else if (name2 === "background" && (tagName === "table" || tagName === "td" || tagName === "th")) { + return absoluteToDoc(doc2, value4); + } else if (name2 === "srcset") { + return getAbsoluteSrcsetString(doc2, value4); + } else if (name2 === "style") { + return absoluteToStylesheet(value4, getHref(doc2)); + } else if (tagName === "object" && name2 === "data") { + return absoluteToDoc(doc2, value4); + } + if (typeof maskAttributeFn === "function") { + return maskAttributeFn(name2, value4, element); + } + return value4; +} +__name(transformAttribute, "transformAttribute"); +function ignoreAttribute(tagName, name2, _value) { + return (tagName === "video" || tagName === "audio") && name2 === "autoplay"; +} +__name(ignoreAttribute, "ignoreAttribute"); +function _isBlockedElement(element, blockClass, blockSelector, unblockSelector) { + try { + if (unblockSelector && element.matches(unblockSelector)) { + return false; + } + if (typeof blockClass === "string") { + if (element.classList.contains(blockClass)) { + return true; + } + } else { + for (let eIndex = element.classList.length; eIndex--; ) { + const className = element.classList[eIndex]; + if (blockClass.test(className)) { + return true; + } + } + } + if (blockSelector) { + return element.matches(blockSelector); + } + } catch (e2) { + } + return false; +} +__name(_isBlockedElement, "_isBlockedElement"); +function elementClassMatchesRegex$1(el, regex2) { + for (let eIndex = el.classList.length; eIndex--; ) { + const className = el.classList[eIndex]; + if (regex2.test(className)) { + return true; + } + } + return false; +} +__name(elementClassMatchesRegex$1, "elementClassMatchesRegex$1"); +function distanceToMatch$1(node3, matchPredicate, limit = Infinity, distance2 = 0) { + if (!node3) + return -1; + if (node3.nodeType !== node3.ELEMENT_NODE) + return -1; + if (distance2 > limit) + return -1; + if (matchPredicate(node3)) + return distance2; + return distanceToMatch$1(node3.parentNode, matchPredicate, limit, distance2 + 1); +} +__name(distanceToMatch$1, "distanceToMatch$1"); +function createMatchPredicate$1(className, selector) { + return (node3) => { + const el = node3; + if (el === null) + return false; + try { + if (className) { + if (typeof className === "string") { + if (el.matches(`.${className}`)) + return true; + } else if (elementClassMatchesRegex$1(el, className)) { + return true; + } + } + if (selector && el.matches(selector)) + return true; + return false; + } catch (e2) { + return false; + } + }; +} +__name(createMatchPredicate$1, "createMatchPredicate$1"); +function needMaskingText(node3, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, maskAllText) { + try { + const el = node3.nodeType === node3.ELEMENT_NODE ? node3 : node3.parentElement; + if (el === null) + return false; + if (el.tagName === "INPUT") { + const autocomplete = el.getAttribute("autocomplete"); + const disallowedAutocompleteValues = [ + "current-password", + "new-password", + "cc-number", + "cc-exp", + "cc-exp-month", + "cc-exp-year", + "cc-csc" + ]; + if (disallowedAutocompleteValues.includes(autocomplete)) { + return true; + } + } + let maskDistance = -1; + let unmaskDistance = -1; + if (maskAllText) { + unmaskDistance = distanceToMatch$1(el, createMatchPredicate$1(unmaskTextClass, unmaskTextSelector)); + if (unmaskDistance < 0) { + return true; + } + maskDistance = distanceToMatch$1(el, createMatchPredicate$1(maskTextClass, maskTextSelector), unmaskDistance >= 0 ? unmaskDistance : Infinity); + } else { + maskDistance = distanceToMatch$1(el, createMatchPredicate$1(maskTextClass, maskTextSelector)); + if (maskDistance < 0) { + return false; + } + unmaskDistance = distanceToMatch$1(el, createMatchPredicate$1(unmaskTextClass, unmaskTextSelector), maskDistance >= 0 ? maskDistance : Infinity); + } + return maskDistance >= 0 ? unmaskDistance >= 0 ? maskDistance <= unmaskDistance : true : unmaskDistance >= 0 ? false : !!maskAllText; + } catch (e2) { + } + return !!maskAllText; +} +__name(needMaskingText, "needMaskingText"); +function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) { + const win = iframeEl.contentWindow; + if (!win) { + return; + } + let fired = false; + let readyState; + try { + readyState = win.document.readyState; + } catch (error2) { + return; + } + if (readyState !== "complete") { + const timer = setTimeout$2(() => { + if (!fired) { + listener(); + fired = true; + } + }, iframeLoadTimeout); + iframeEl.addEventListener("load", () => { + clearTimeout$2(timer); + fired = true; + listener(); + }); + return; + } + const blankUrl = "about:blank"; + if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") { + setTimeout$2(listener, 0); + return iframeEl.addEventListener("load", listener); + } + iframeEl.addEventListener("load", listener); +} +__name(onceIframeLoaded, "onceIframeLoaded"); +function onceStylesheetLoaded(link2, listener, styleSheetLoadTimeout) { + let fired = false; + let styleSheetLoaded; + try { + styleSheetLoaded = link2.sheet; + } catch (error2) { + return; + } + if (styleSheetLoaded) + return; + const timer = setTimeout$2(() => { + if (!fired) { + listener(); + fired = true; + } + }, styleSheetLoadTimeout); + link2.addEventListener("load", () => { + clearTimeout$2(timer); + fired = true; + listener(); + }); +} +__name(onceStylesheetLoaded, "onceStylesheetLoaded"); +function serializeNode(n2, options4) { + const { doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, maskAllText, maskAttributeFn, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, inlineStylesheet, maskInputOptions = {}, maskTextFn, maskInputFn, dataURLOptions = {}, inlineImages, recordCanvas, keepIframeSrcFn, newlyAddedElement = false } = options4; + const rootId = getRootId(doc2, mirror2); + switch (n2.nodeType) { + case n2.DOCUMENT_NODE: + if (n2.compatMode !== "CSS1Compat") { + return { + type: NodeType$3.Document, + childNodes: [], + compatMode: n2.compatMode + }; + } else { + return { + type: NodeType$3.Document, + childNodes: [] + }; + } + case n2.DOCUMENT_TYPE_NODE: + return { + type: NodeType$3.DocumentType, + name: n2.name, + publicId: n2.publicId, + systemId: n2.systemId, + rootId + }; + case n2.ELEMENT_NODE: + return serializeElementNode(n2, { + doc: doc2, + blockClass, + blockSelector, + unblockSelector, + inlineStylesheet, + maskAttributeFn, + maskInputOptions, + maskInputFn, + dataURLOptions, + inlineImages, + recordCanvas, + keepIframeSrcFn, + newlyAddedElement, + rootId, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector + }); + case n2.TEXT_NODE: + return serializeTextNode(n2, { + doc: doc2, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + maskTextFn, + maskInputOptions, + maskInputFn, + rootId + }); + case n2.CDATA_SECTION_NODE: + return { + type: NodeType$3.CDATA, + textContent: "", + rootId + }; + case n2.COMMENT_NODE: + return { + type: NodeType$3.Comment, + textContent: n2.textContent || "", + rootId + }; + default: + return false; + } +} +__name(serializeNode, "serializeNode"); +function getRootId(doc2, mirror2) { + if (!mirror2.hasNode(doc2)) + return void 0; + const docId = mirror2.getId(doc2); + return docId === 1 ? void 0 : docId; +} +__name(getRootId, "getRootId"); +function serializeTextNode(n2, options4) { + const { maskAllText, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, maskTextFn, maskInputOptions, maskInputFn, rootId } = options4; + const parentTagName = n2.parentNode && n2.parentNode.tagName; + let textContent = n2.textContent; + const isStyle = parentTagName === "STYLE" ? true : void 0; + const isScript = parentTagName === "SCRIPT" ? true : void 0; + const isTextarea = parentTagName === "TEXTAREA" ? true : void 0; + if (isStyle && textContent) { + try { + if (n2.nextSibling || n2.previousSibling) { + } else if (_optionalChain$5([n2, "access", (_7) => _7.parentNode, "access", (_8) => _8.sheet, "optionalAccess", (_9) => _9.cssRules])) { + textContent = stringifyStylesheet(n2.parentNode.sheet); + } + } catch (err) { + console.warn(`Cannot get CSS styles from text's parentNode. Error: ${err}`, n2); + } + textContent = absoluteToStylesheet(textContent, getHref(options4.doc)); + } + if (isScript) { + textContent = "SCRIPT_PLACEHOLDER"; + } + const forceMask = needMaskingText(n2, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, maskAllText); + if (!isStyle && !isScript && !isTextarea && textContent && forceMask) { + textContent = maskTextFn ? maskTextFn(textContent, n2.parentElement) : textContent.replace(/[\S]/g, "*"); + } + if (isTextarea && textContent && (maskInputOptions.textarea || forceMask)) { + textContent = maskInputFn ? maskInputFn(textContent, n2.parentNode) : textContent.replace(/[\S]/g, "*"); + } + if (parentTagName === "OPTION" && textContent) { + const isInputMasked = shouldMaskInput({ + type: null, + tagName: parentTagName, + maskInputOptions + }); + textContent = maskInputValue({ + isMasked: needMaskingText(n2, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, isInputMasked), + element: n2, + value: textContent, + maskInputFn + }); + } + return { + type: NodeType$3.Text, + textContent: textContent || "", + isStyle, + rootId + }; +} +__name(serializeTextNode, "serializeTextNode"); +function serializeElementNode(n2, options4) { + const { doc: doc2, blockClass, blockSelector, unblockSelector, inlineStylesheet, maskInputOptions = {}, maskAttributeFn, maskInputFn, dataURLOptions = {}, inlineImages, recordCanvas, keepIframeSrcFn, newlyAddedElement = false, rootId, maskAllText, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector } = options4; + const needBlock = _isBlockedElement(n2, blockClass, blockSelector, unblockSelector); + const tagName = getValidTagName(n2); + let attributes = {}; + const len = n2.attributes.length; + for (let i2 = 0; i2 < len; i2++) { + const attr = n2.attributes[i2]; + if (attr.name && !ignoreAttribute(tagName, attr.name, attr.value)) { + attributes[attr.name] = transformAttribute(doc2, tagName, toLowerCase(attr.name), attr.value, n2, maskAttributeFn); + } + } + if (tagName === "link" && inlineStylesheet) { + const stylesheet = Array.from(doc2.styleSheets).find((s2) => { + return s2.href === n2.href; + }); + let cssText = null; + if (stylesheet) { + cssText = stringifyStylesheet(stylesheet); + } + if (cssText) { + attributes.rel = null; + attributes.href = null; + attributes.crossorigin = null; + attributes._cssText = absoluteToStylesheet(cssText, stylesheet.href); + } + } + if (tagName === "style" && n2.sheet && !(n2.innerText || n2.textContent || "").trim().length) { + const cssText = stringifyStylesheet(n2.sheet); + if (cssText) { + attributes._cssText = absoluteToStylesheet(cssText, getHref(doc2)); + } + } + if (tagName === "input" || tagName === "textarea" || tagName === "select" || tagName === "option") { + const el = n2; + const type = getInputType(el); + const value4 = getInputValue(el, toUpperCase(tagName), type); + const checked4 = el.checked; + if (type !== "submit" && type !== "button" && value4) { + const forceMask = needMaskingText(el, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, shouldMaskInput({ + type, + tagName: toUpperCase(tagName), + maskInputOptions + })); + attributes.value = maskInputValue({ + isMasked: forceMask, + element: el, + value: value4, + maskInputFn + }); + } + if (checked4) { + attributes.checked = checked4; + } + } + if (tagName === "option") { + if (n2.selected && !maskInputOptions["select"]) { + attributes.selected = true; + } else { + delete attributes.selected; + } + } + if (tagName === "canvas" && recordCanvas) { + if (n2.__context === "2d") { + if (!is2DCanvasBlank(n2)) { + attributes.rr_dataURL = n2.toDataURL(dataURLOptions.type, dataURLOptions.quality); + } + } else if (!("__context" in n2)) { + const canvasDataURL = n2.toDataURL(dataURLOptions.type, dataURLOptions.quality); + const blankCanvas = doc2.createElement("canvas"); + blankCanvas.width = n2.width; + blankCanvas.height = n2.height; + const blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality); + if (canvasDataURL !== blankCanvasDataURL) { + attributes.rr_dataURL = canvasDataURL; + } + } + } + if (tagName === "img" && inlineImages) { + if (!canvasService) { + canvasService = doc2.createElement("canvas"); + canvasCtx = canvasService.getContext("2d"); + } + const image2 = n2; + const imageSrc = image2.currentSrc || image2.getAttribute("src") || ""; + const priorCrossOrigin = image2.crossOrigin; + const recordInlineImage = /* @__PURE__ */ __name(() => { + image2.removeEventListener("load", recordInlineImage); + try { + canvasService.width = image2.naturalWidth; + canvasService.height = image2.naturalHeight; + canvasCtx.drawImage(image2, 0, 0); + attributes.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality); + } catch (err) { + if (image2.crossOrigin !== "anonymous") { + image2.crossOrigin = "anonymous"; + if (image2.complete && image2.naturalWidth !== 0) + recordInlineImage(); + else + image2.addEventListener("load", recordInlineImage); + return; + } else { + console.warn(`Cannot inline img src=${imageSrc}! Error: ${err}`); + } + } + if (image2.crossOrigin === "anonymous") { + priorCrossOrigin ? attributes.crossOrigin = priorCrossOrigin : image2.removeAttribute("crossorigin"); + } + }, "recordInlineImage"); + if (image2.complete && image2.naturalWidth !== 0) + recordInlineImage(); + else + image2.addEventListener("load", recordInlineImage); + } + if (tagName === "audio" || tagName === "video") { + attributes.rr_mediaState = n2.paused ? "paused" : "played"; + attributes.rr_mediaCurrentTime = n2.currentTime; + } + if (!newlyAddedElement) { + if (n2.scrollLeft) { + attributes.rr_scrollLeft = n2.scrollLeft; + } + if (n2.scrollTop) { + attributes.rr_scrollTop = n2.scrollTop; + } + } + if (needBlock) { + const { width: width2, height } = n2.getBoundingClientRect(); + attributes = { + class: attributes.class, + rr_width: `${width2}px`, + rr_height: `${height}px` + }; + } + if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) { + if (!needBlock && !getIframeContentDocument(n2)) { + attributes.rr_src = attributes.src; + } + delete attributes.src; + } + let isCustomElement; + try { + if (customElements.get(tagName)) + isCustomElement = true; + } catch (e2) { + } + return { + type: NodeType$3.Element, + tagName, + attributes, + childNodes: [], + isSVG: isSVGElement(n2) || void 0, + needBlock, + rootId, + isCustom: isCustomElement + }; +} +__name(serializeElementNode, "serializeElementNode"); +function lowerIfExists(maybeAttr) { + if (maybeAttr === void 0 || maybeAttr === null) { + return ""; + } else { + return maybeAttr.toLowerCase(); + } +} +__name(lowerIfExists, "lowerIfExists"); +function slimDOMExcluded(sn, slimDOMOptions) { + if (slimDOMOptions.comment && sn.type === NodeType$3.Comment) { + return true; + } else if (sn.type === NodeType$3.Element) { + if (slimDOMOptions.script && (sn.tagName === "script" || sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") || sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) { + return true; + } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) || lowerIfExists(sn.attributes.name) === "application-name" || lowerIfExists(sn.attributes.rel) === "icon" || lowerIfExists(sn.attributes.rel) === "apple-touch-icon" || lowerIfExists(sn.attributes.rel) === "shortcut icon"))) { + return true; + } else if (sn.tagName === "meta") { + if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) { + return true; + } else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) { + return true; + } else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) { + return true; + } else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) { + return true; + } else if (slimDOMOptions.headMetaAuthorship && (lowerIfExists(sn.attributes.name) === "author" || lowerIfExists(sn.attributes.name) === "generator" || lowerIfExists(sn.attributes.name) === "framework" || lowerIfExists(sn.attributes.name) === "publisher" || lowerIfExists(sn.attributes.name) === "progid" || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) { + return true; + } else if (slimDOMOptions.headMetaVerification && (lowerIfExists(sn.attributes.name) === "google-site-verification" || lowerIfExists(sn.attributes.name) === "yandex-verification" || lowerIfExists(sn.attributes.name) === "csrf-token" || lowerIfExists(sn.attributes.name) === "p:domain_verify" || lowerIfExists(sn.attributes.name) === "verify-v1" || lowerIfExists(sn.attributes.name) === "verification" || lowerIfExists(sn.attributes.name) === "shopify-checkout-api-token")) { + return true; + } + } + } + return false; +} +__name(slimDOMExcluded, "slimDOMExcluded"); +function serializeNodeWithId(n2, options4) { + const { doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, maskAllText, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, skipChild = false, inlineStylesheet = true, maskInputOptions = {}, maskAttributeFn, maskTextFn, maskInputFn, slimDOMOptions, dataURLOptions = {}, inlineImages = false, recordCanvas = false, onSerialize, onIframeLoad, iframeLoadTimeout = 5e3, onStylesheetLoad, stylesheetLoadTimeout = 5e3, keepIframeSrcFn = /* @__PURE__ */ __name(() => false, "keepIframeSrcFn"), newlyAddedElement = false } = options4; + let { preserveWhiteSpace = true } = options4; + const _serializedNode = serializeNode(n2, { + doc: doc2, + mirror: mirror2, + blockClass, + blockSelector, + maskAllText, + unblockSelector, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + inlineStylesheet, + maskInputOptions, + maskAttributeFn, + maskTextFn, + maskInputFn, + dataURLOptions, + inlineImages, + recordCanvas, + keepIframeSrcFn, + newlyAddedElement + }); + if (!_serializedNode) { + console.warn(n2, "not serialized"); + return null; + } + let id3; + if (mirror2.hasNode(n2)) { + id3 = mirror2.getId(n2); + } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$3.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) { + id3 = IGNORED_NODE; + } else { + id3 = genId(); + } + const serializedNode = Object.assign(_serializedNode, { id: id3 }); + mirror2.add(n2, serializedNode); + if (id3 === IGNORED_NODE) { + return null; + } + if (onSerialize) { + onSerialize(n2); + } + let recordChild = !skipChild; + if (serializedNode.type === NodeType$3.Element) { + recordChild = recordChild && !serializedNode.needBlock; + delete serializedNode.needBlock; + const shadowRoot = n2.shadowRoot; + if (shadowRoot && isNativeShadowDom(shadowRoot)) + serializedNode.isShadowHost = true; + } + if ((serializedNode.type === NodeType$3.Document || serializedNode.type === NodeType$3.Element) && recordChild) { + if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$3.Element && serializedNode.tagName === "head") { + preserveWhiteSpace = false; + } + const bypassOptions = { + doc: doc2, + mirror: mirror2, + blockClass, + blockSelector, + maskAllText, + unblockSelector, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + skipChild, + inlineStylesheet, + maskInputOptions, + maskAttributeFn, + maskTextFn, + maskInputFn, + slimDOMOptions, + dataURLOptions, + inlineImages, + recordCanvas, + preserveWhiteSpace, + onSerialize, + onIframeLoad, + iframeLoadTimeout, + onStylesheetLoad, + stylesheetLoadTimeout, + keepIframeSrcFn + }; + for (const childN of Array.from(n2.childNodes)) { + const serializedChildNode = serializeNodeWithId(childN, bypassOptions); + if (serializedChildNode) { + serializedNode.childNodes.push(serializedChildNode); + } + } + if (isElement$1(n2) && n2.shadowRoot) { + for (const childN of Array.from(n2.shadowRoot.childNodes)) { + const serializedChildNode = serializeNodeWithId(childN, bypassOptions); + if (serializedChildNode) { + isNativeShadowDom(n2.shadowRoot) && (serializedChildNode.isShadow = true); + serializedNode.childNodes.push(serializedChildNode); + } + } + } + } + if (n2.parentNode && isShadowRoot(n2.parentNode) && isNativeShadowDom(n2.parentNode)) { + serializedNode.isShadow = true; + } + if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe") { + onceIframeLoaded(n2, () => { + const iframeDoc = getIframeContentDocument(n2); + if (iframeDoc && onIframeLoad) { + const serializedIframeNode = serializeNodeWithId(iframeDoc, { + doc: iframeDoc, + mirror: mirror2, + blockClass, + blockSelector, + unblockSelector, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + skipChild: false, + inlineStylesheet, + maskInputOptions, + maskAttributeFn, + maskTextFn, + maskInputFn, + slimDOMOptions, + dataURLOptions, + inlineImages, + recordCanvas, + preserveWhiteSpace, + onSerialize, + onIframeLoad, + iframeLoadTimeout, + onStylesheetLoad, + stylesheetLoadTimeout, + keepIframeSrcFn + }); + if (serializedIframeNode) { + onIframeLoad(n2, serializedIframeNode); + } + } + }, iframeLoadTimeout); + } + if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && extractFileExtension(serializedNode.attributes.href) === "css")) { + onceStylesheetLoaded(n2, () => { + if (onStylesheetLoad) { + const serializedLinkNode = serializeNodeWithId(n2, { + doc: doc2, + mirror: mirror2, + blockClass, + blockSelector, + unblockSelector, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + skipChild: false, + inlineStylesheet, + maskInputOptions, + maskAttributeFn, + maskTextFn, + maskInputFn, + slimDOMOptions, + dataURLOptions, + inlineImages, + recordCanvas, + preserveWhiteSpace, + onSerialize, + onIframeLoad, + iframeLoadTimeout, + onStylesheetLoad, + stylesheetLoadTimeout, + keepIframeSrcFn + }); + if (serializedLinkNode) { + onStylesheetLoad(n2, serializedLinkNode); + } + } + }, stylesheetLoadTimeout); + } + return serializedNode; +} +__name(serializeNodeWithId, "serializeNodeWithId"); +function snapshot(n2, options4) { + const { mirror: mirror2 = new Mirror(), blockClass = "rr-block", blockSelector = null, unblockSelector = null, maskAllText = false, maskTextClass = "rr-mask", unmaskTextClass = null, maskTextSelector = null, unmaskTextSelector = null, inlineStylesheet = true, inlineImages = false, recordCanvas = false, maskAllInputs = false, maskAttributeFn, maskTextFn, maskInputFn, slimDOM = false, dataURLOptions, preserveWhiteSpace, onSerialize, onIframeLoad, iframeLoadTimeout, onStylesheetLoad, stylesheetLoadTimeout, keepIframeSrcFn = /* @__PURE__ */ __name(() => false, "keepIframeSrcFn") } = options4 || {}; + const maskInputOptions = maskAllInputs === true ? { + color: true, + date: true, + "datetime-local": true, + email: true, + month: true, + number: true, + range: true, + search: true, + tel: true, + text: true, + time: true, + url: true, + week: true, + textarea: true, + select: true + } : maskAllInputs === false ? {} : maskAllInputs; + const slimDOMOptions = slimDOM === true || slimDOM === "all" ? { + script: true, + comment: true, + headFavicon: true, + headWhitespace: true, + headMetaDescKeywords: slimDOM === "all", + headMetaSocial: true, + headMetaRobots: true, + headMetaHttpEquiv: true, + headMetaAuthorship: true, + headMetaVerification: true + } : slimDOM === false ? {} : slimDOM; + return serializeNodeWithId(n2, { + doc: n2, + mirror: mirror2, + blockClass, + blockSelector, + unblockSelector, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + skipChild: false, + inlineStylesheet, + maskInputOptions, + maskAttributeFn, + maskTextFn, + maskInputFn, + slimDOMOptions, + dataURLOptions, + inlineImages, + recordCanvas, + preserveWhiteSpace, + onSerialize, + onIframeLoad, + iframeLoadTimeout, + onStylesheetLoad, + stylesheetLoadTimeout, + keepIframeSrcFn, + newlyAddedElement: false + }); +} +__name(snapshot, "snapshot"); +function _optionalChain$4(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return void 0; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_optionalChain$4, "_optionalChain$4"); +function on(type, fn, target = document) { + const options4 = { capture: true, passive: true }; + target.addEventListener(type, fn, options4); + return () => target.removeEventListener(type, fn, options4); +} +__name(on, "on"); +const DEPARTED_MIRROR_ACCESS_WARNING$1 = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording."; +let _mirror$1 = { + map: {}, + getId() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); + return -1; + }, + getNode() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); + return null; + }, + removeNodeFromMap() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); + }, + has() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); + return false; + }, + reset() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); + } +}; +if (typeof window !== "undefined" && window.Proxy && window.Reflect) { + _mirror$1 = new Proxy(_mirror$1, { + get(target, prop2, receiver) { + if (prop2 === "map") { + console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); + } + return Reflect.get(target, prop2, receiver); + } + }); +} +function throttle$1(func, wait, options4 = {}) { + let timeout = null; + let previous = 0; + return function(...args) { + const now2 = Date.now(); + if (!previous && options4.leading === false) { + previous = now2; + } + const remaining = wait - (now2 - previous); + const context = this; + if (remaining <= 0 || remaining > wait) { + if (timeout) { + clearTimeout$1(timeout); + timeout = null; + } + previous = now2; + func.apply(context, args); + } else if (!timeout && options4.trailing !== false) { + timeout = setTimeout$1$1(() => { + previous = options4.leading === false ? 0 : Date.now(); + timeout = null; + func.apply(context, args); + }, remaining); + } + }; +} +__name(throttle$1, "throttle$1"); +function hookSetter$1(target, key, d2, isRevoked, win = window) { + const original = win.Object.getOwnPropertyDescriptor(target, key); + win.Object.defineProperty(target, key, isRevoked ? d2 : { + set(value4) { + setTimeout$1$1(() => { + d2.set.call(this, value4); + }, 0); + if (original && original.set) { + original.set.call(this, value4); + } + } + }); + return () => hookSetter$1(target, key, original || {}, true); +} +__name(hookSetter$1, "hookSetter$1"); +function patch$2(source, name2, replacement) { + try { + if (!(name2 in source)) { + return () => { + }; + } + const original = source[name2]; + const wrapped = replacement(original); + if (typeof wrapped === "function") { + wrapped.prototype = wrapped.prototype || {}; + Object.defineProperties(wrapped, { + __rrweb_original__: { + enumerable: false, + value: original + } + }); + } + source[name2] = wrapped; + return () => { + source[name2] = original; + }; + } catch (e2) { + return () => { + }; + } +} +__name(patch$2, "patch$2"); +let nowTimestamp = Date.now; +if (!/[1-9][0-9]{12}/.test(Date.now().toString())) { + nowTimestamp = /* @__PURE__ */ __name(() => (/* @__PURE__ */ new Date()).getTime(), "nowTimestamp"); +} +function getWindowScroll(win) { + const doc2 = win.document; + return { + left: doc2.scrollingElement ? doc2.scrollingElement.scrollLeft : win.pageXOffset !== void 0 ? win.pageXOffset : _optionalChain$4([doc2, "optionalAccess", (_2) => _2.documentElement, "access", (_2) => _2.scrollLeft]) || _optionalChain$4([doc2, "optionalAccess", (_3) => _3.body, "optionalAccess", (_4) => _4.parentElement, "optionalAccess", (_5) => _5.scrollLeft]) || _optionalChain$4([doc2, "optionalAccess", (_6) => _6.body, "optionalAccess", (_7) => _7.scrollLeft]) || 0, + top: doc2.scrollingElement ? doc2.scrollingElement.scrollTop : win.pageYOffset !== void 0 ? win.pageYOffset : _optionalChain$4([doc2, "optionalAccess", (_8) => _8.documentElement, "access", (_9) => _9.scrollTop]) || _optionalChain$4([doc2, "optionalAccess", (_10) => _10.body, "optionalAccess", (_11) => _11.parentElement, "optionalAccess", (_12) => _12.scrollTop]) || _optionalChain$4([doc2, "optionalAccess", (_13) => _13.body, "optionalAccess", (_14) => _14.scrollTop]) || 0 + }; +} +__name(getWindowScroll, "getWindowScroll"); +function getWindowHeight() { + return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight; +} +__name(getWindowHeight, "getWindowHeight"); +function getWindowWidth() { + return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth; +} +__name(getWindowWidth, "getWindowWidth"); +function closestElementOfNode$1(node3) { + if (!node3) { + return null; + } + const el = node3.nodeType === node3.ELEMENT_NODE ? node3 : node3.parentElement; + return el; +} +__name(closestElementOfNode$1, "closestElementOfNode$1"); +function isBlocked$1(node3, blockClass, blockSelector, unblockSelector, checkAncestors) { + if (!node3) { + return false; + } + const el = closestElementOfNode$1(node3); + if (!el) { + return false; + } + const blockedPredicate = createMatchPredicate$1(blockClass, blockSelector); + if (!checkAncestors) { + const isUnblocked = unblockSelector && el.matches(unblockSelector); + return blockedPredicate(el) && !isUnblocked; + } + const blockDistance = distanceToMatch$1(el, blockedPredicate); + let unblockDistance = -1; + if (blockDistance < 0) { + return false; + } + if (unblockSelector) { + unblockDistance = distanceToMatch$1(el, createMatchPredicate$1(null, unblockSelector)); + } + if (blockDistance > -1 && unblockDistance < 0) { + return true; + } + return blockDistance < unblockDistance; +} +__name(isBlocked$1, "isBlocked$1"); +function isSerialized(n2, mirror2) { + return mirror2.getId(n2) !== -1; +} +__name(isSerialized, "isSerialized"); +function isIgnored(n2, mirror2) { + return mirror2.getId(n2) === IGNORED_NODE; +} +__name(isIgnored, "isIgnored"); +function isAncestorRemoved(target, mirror2) { + if (isShadowRoot(target)) { + return false; + } + const id3 = mirror2.getId(target); + if (!mirror2.has(id3)) { + return true; + } + if (target.parentNode && target.parentNode.nodeType === target.DOCUMENT_NODE) { + return false; + } + if (!target.parentNode) { + return true; + } + return isAncestorRemoved(target.parentNode, mirror2); +} +__name(isAncestorRemoved, "isAncestorRemoved"); +function legacy_isTouchEvent(event) { + return Boolean(event.changedTouches); +} +__name(legacy_isTouchEvent, "legacy_isTouchEvent"); +function polyfill(win = window) { + if ("NodeList" in win && !win.NodeList.prototype.forEach) { + win.NodeList.prototype.forEach = Array.prototype.forEach; + } + if ("DOMTokenList" in win && !win.DOMTokenList.prototype.forEach) { + win.DOMTokenList.prototype.forEach = Array.prototype.forEach; + } + if (!Node.prototype.contains) { + Node.prototype.contains = (...args) => { + let node3 = args[0]; + if (!(0 in args)) { + throw new TypeError("1 argument is required"); + } + do { + if (this === node3) { + return true; + } + } while (node3 = node3 && node3.parentNode); + return false; + }; + } +} +__name(polyfill, "polyfill"); +function isSerializedIframe(n2, mirror2) { + return Boolean(n2.nodeName === "IFRAME" && mirror2.getMeta(n2)); +} +__name(isSerializedIframe, "isSerializedIframe"); +function isSerializedStylesheet(n2, mirror2) { + return Boolean(n2.nodeName === "LINK" && n2.nodeType === n2.ELEMENT_NODE && n2.getAttribute && n2.getAttribute("rel") === "stylesheet" && mirror2.getMeta(n2)); +} +__name(isSerializedStylesheet, "isSerializedStylesheet"); +function hasShadowRoot(n2) { + return Boolean(_optionalChain$4([n2, "optionalAccess", (_18) => _18.shadowRoot])); +} +__name(hasShadowRoot, "hasShadowRoot"); +class StyleSheetMirror { + static { + __name(this, "StyleSheetMirror"); + } + constructor() { + this.id = 1; + this.styleIDMap = /* @__PURE__ */ new WeakMap(); + this.idStyleMap = /* @__PURE__ */ new Map(); + } + getId(stylesheet) { + return _nullishCoalesce(this.styleIDMap.get(stylesheet), () => -1); + } + has(stylesheet) { + return this.styleIDMap.has(stylesheet); + } + add(stylesheet, id3) { + if (this.has(stylesheet)) + return this.getId(stylesheet); + let newId; + if (id3 === void 0) { + newId = this.id++; + } else + newId = id3; + this.styleIDMap.set(stylesheet, newId); + this.idStyleMap.set(newId, stylesheet); + return newId; + } + getStyle(id3) { + return this.idStyleMap.get(id3) || null; + } + reset() { + this.styleIDMap = /* @__PURE__ */ new WeakMap(); + this.idStyleMap = /* @__PURE__ */ new Map(); + this.id = 1; + } + generateId() { + return this.id++; + } +} +function getShadowHost(n2) { + let shadowHost = null; + if (_optionalChain$4([n2, "access", (_19) => _19.getRootNode, "optionalCall", (_20) => _20(), "optionalAccess", (_21) => _21.nodeType]) === Node.DOCUMENT_FRAGMENT_NODE && n2.getRootNode().host) + shadowHost = n2.getRootNode().host; + return shadowHost; +} +__name(getShadowHost, "getShadowHost"); +function getRootShadowHost(n2) { + let rootShadowHost = n2; + let shadowHost; + while (shadowHost = getShadowHost(rootShadowHost)) + rootShadowHost = shadowHost; + return rootShadowHost; +} +__name(getRootShadowHost, "getRootShadowHost"); +function shadowHostInDom(n2) { + const doc2 = n2.ownerDocument; + if (!doc2) + return false; + const shadowHost = getRootShadowHost(n2); + return doc2.contains(shadowHost); +} +__name(shadowHostInDom, "shadowHostInDom"); +function inDom(n2) { + const doc2 = n2.ownerDocument; + if (!doc2) + return false; + return doc2.contains(n2) || shadowHostInDom(n2); +} +__name(inDom, "inDom"); +const cachedImplementations$2 = {}; +function getImplementation$2(name2) { + const cached = cachedImplementations$2[name2]; + if (cached) { + return cached; + } + const document2 = window.document; + let impl = window[name2]; + if (document2 && typeof document2.createElement === "function") { + try { + const sandbox = document2.createElement("iframe"); + sandbox.hidden = true; + document2.head.appendChild(sandbox); + const contentWindow = sandbox.contentWindow; + if (contentWindow && contentWindow[name2]) { + impl = contentWindow[name2]; + } + document2.head.removeChild(sandbox); + } catch (e2) { + } + } + return cachedImplementations$2[name2] = impl.bind(window); +} +__name(getImplementation$2, "getImplementation$2"); +function onRequestAnimationFrame$1(...rest) { + return getImplementation$2("requestAnimationFrame")(...rest); +} +__name(onRequestAnimationFrame$1, "onRequestAnimationFrame$1"); +function setTimeout$1$1(...rest) { + return getImplementation$2("setTimeout")(...rest); +} +__name(setTimeout$1$1, "setTimeout$1$1"); +function clearTimeout$1(...rest) { + return getImplementation$2("clearTimeout")(...rest); +} +__name(clearTimeout$1, "clearTimeout$1"); +var EventType = /* @__PURE__ */ ((EventType2) => { + EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded"; + EventType2[EventType2["Load"] = 1] = "Load"; + EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot"; + EventType2[EventType2["IncrementalSnapshot"] = 3] = "IncrementalSnapshot"; + EventType2[EventType2["Meta"] = 4] = "Meta"; + EventType2[EventType2["Custom"] = 5] = "Custom"; + EventType2[EventType2["Plugin"] = 6] = "Plugin"; + return EventType2; +})(EventType || {}); +var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => { + IncrementalSource2[IncrementalSource2["Mutation"] = 0] = "Mutation"; + IncrementalSource2[IncrementalSource2["MouseMove"] = 1] = "MouseMove"; + IncrementalSource2[IncrementalSource2["MouseInteraction"] = 2] = "MouseInteraction"; + IncrementalSource2[IncrementalSource2["Scroll"] = 3] = "Scroll"; + IncrementalSource2[IncrementalSource2["ViewportResize"] = 4] = "ViewportResize"; + IncrementalSource2[IncrementalSource2["Input"] = 5] = "Input"; + IncrementalSource2[IncrementalSource2["TouchMove"] = 6] = "TouchMove"; + IncrementalSource2[IncrementalSource2["MediaInteraction"] = 7] = "MediaInteraction"; + IncrementalSource2[IncrementalSource2["StyleSheetRule"] = 8] = "StyleSheetRule"; + IncrementalSource2[IncrementalSource2["CanvasMutation"] = 9] = "CanvasMutation"; + IncrementalSource2[IncrementalSource2["Font"] = 10] = "Font"; + IncrementalSource2[IncrementalSource2["Log"] = 11] = "Log"; + IncrementalSource2[IncrementalSource2["Drag"] = 12] = "Drag"; + IncrementalSource2[IncrementalSource2["StyleDeclaration"] = 13] = "StyleDeclaration"; + IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection"; + IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet"; + IncrementalSource2[IncrementalSource2["CustomElement"] = 16] = "CustomElement"; + return IncrementalSource2; +})(IncrementalSource || {}); +var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => { + MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp"; + MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown"; + MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click"; + MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu"; + MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick"; + MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus"; + MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur"; + MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart"; + MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed"; + MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd"; + MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel"; + return MouseInteractions2; +})(MouseInteractions || {}); +var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => { + PointerTypes2[PointerTypes2["Mouse"] = 0] = "Mouse"; + PointerTypes2[PointerTypes2["Pen"] = 1] = "Pen"; + PointerTypes2[PointerTypes2["Touch"] = 2] = "Touch"; + return PointerTypes2; +})(PointerTypes || {}); +var NodeType$1$1; +(function(NodeType3) { + NodeType3[NodeType3["Document"] = 0] = "Document"; + NodeType3[NodeType3["DocumentType"] = 1] = "DocumentType"; + NodeType3[NodeType3["Element"] = 2] = "Element"; + NodeType3[NodeType3["Text"] = 3] = "Text"; + NodeType3[NodeType3["CDATA"] = 4] = "CDATA"; + NodeType3[NodeType3["Comment"] = 5] = "Comment"; +})(NodeType$1$1 || (NodeType$1$1 = {})); +var NodeType$2$1; +(function(NodeType3) { + NodeType3[NodeType3["PLACEHOLDER"] = 0] = "PLACEHOLDER"; + NodeType3[NodeType3["ELEMENT_NODE"] = 1] = "ELEMENT_NODE"; + NodeType3[NodeType3["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE"; + NodeType3[NodeType3["TEXT_NODE"] = 3] = "TEXT_NODE"; + NodeType3[NodeType3["CDATA_SECTION_NODE"] = 4] = "CDATA_SECTION_NODE"; + NodeType3[NodeType3["ENTITY_REFERENCE_NODE"] = 5] = "ENTITY_REFERENCE_NODE"; + NodeType3[NodeType3["ENTITY_NODE"] = 6] = "ENTITY_NODE"; + NodeType3[NodeType3["PROCESSING_INSTRUCTION_NODE"] = 7] = "PROCESSING_INSTRUCTION_NODE"; + NodeType3[NodeType3["COMMENT_NODE"] = 8] = "COMMENT_NODE"; + NodeType3[NodeType3["DOCUMENT_NODE"] = 9] = "DOCUMENT_NODE"; + NodeType3[NodeType3["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE"; + NodeType3[NodeType3["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE"; +})(NodeType$2$1 || (NodeType$2$1 = {})); +function getIFrameContentDocument(iframe) { + try { + return iframe.contentDocument; + } catch (e2) { + } +} +__name(getIFrameContentDocument, "getIFrameContentDocument"); +function getIFrameContentWindow(iframe) { + try { + return iframe.contentWindow; + } catch (e2) { + } +} +__name(getIFrameContentWindow, "getIFrameContentWindow"); +function _optionalChain$3(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return void 0; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_optionalChain$3, "_optionalChain$3"); +function isNodeInLinkedList(n2) { + return "__ln" in n2; +} +__name(isNodeInLinkedList, "isNodeInLinkedList"); +class DoubleLinkedList { + static { + __name(this, "DoubleLinkedList"); + } + constructor() { + this.length = 0; + this.head = null; + this.tail = null; + } + get(position3) { + if (position3 >= this.length) { + throw new Error("Position outside of list range"); + } + let current = this.head; + for (let index2 = 0; index2 < position3; index2++) { + current = _optionalChain$3([current, "optionalAccess", (_2) => _2.next]) || null; + } + return current; + } + addNode(n2) { + const node3 = { + value: n2, + previous: null, + next: null + }; + n2.__ln = node3; + if (n2.previousSibling && isNodeInLinkedList(n2.previousSibling)) { + const current = n2.previousSibling.__ln.next; + node3.next = current; + node3.previous = n2.previousSibling.__ln; + n2.previousSibling.__ln.next = node3; + if (current) { + current.previous = node3; + } + } else if (n2.nextSibling && isNodeInLinkedList(n2.nextSibling) && n2.nextSibling.__ln.previous) { + const current = n2.nextSibling.__ln.previous; + node3.previous = current; + node3.next = n2.nextSibling.__ln; + n2.nextSibling.__ln.previous = node3; + if (current) { + current.next = node3; + } + } else { + if (this.head) { + this.head.previous = node3; + } + node3.next = this.head; + this.head = node3; + } + if (node3.next === null) { + this.tail = node3; + } + this.length++; + } + removeNode(n2) { + const current = n2.__ln; + if (!this.head) { + return; + } + if (!current.previous) { + this.head = current.next; + if (this.head) { + this.head.previous = null; + } else { + this.tail = null; + } + } else { + current.previous.next = current.next; + if (current.next) { + current.next.previous = current.previous; + } else { + this.tail = current.previous; + } + } + if (n2.__ln) { + delete n2.__ln; + } + this.length--; + } +} +const moveKey = /* @__PURE__ */ __name((id3, parentId) => `${id3}@${parentId}`, "moveKey"); +class MutationBuffer { + static { + __name(this, "MutationBuffer"); + } + constructor() { + this.frozen = false; + this.locked = false; + this.texts = []; + this.attributes = []; + this.attributeMap = /* @__PURE__ */ new WeakMap(); + this.removes = []; + this.mapRemoves = []; + this.movedMap = {}; + this.addedSet = /* @__PURE__ */ new Set(); + this.movedSet = /* @__PURE__ */ new Set(); + this.droppedSet = /* @__PURE__ */ new Set(); + this.processMutations = (mutations) => { + mutations.forEach(this.processMutation); + this.emit(); + }; + this.emit = () => { + if (this.frozen || this.locked) { + return; + } + const adds = []; + const addedIds = /* @__PURE__ */ new Set(); + const addList = new DoubleLinkedList(); + const getNextId = /* @__PURE__ */ __name((n2) => { + let ns = n2; + let nextId = IGNORED_NODE; + while (nextId === IGNORED_NODE) { + ns = ns && ns.nextSibling; + nextId = ns && this.mirror.getId(ns); + } + return nextId; + }, "getNextId"); + const pushAdd = /* @__PURE__ */ __name((n2) => { + if (!n2.parentNode || !inDom(n2)) { + return; + } + const parentId = isShadowRoot(n2.parentNode) ? this.mirror.getId(getShadowHost(n2)) : this.mirror.getId(n2.parentNode); + const nextId = getNextId(n2); + if (parentId === -1 || nextId === -1) { + return addList.addNode(n2); + } + const sn = serializeNodeWithId(n2, { + doc: this.doc, + mirror: this.mirror, + blockClass: this.blockClass, + blockSelector: this.blockSelector, + maskAllText: this.maskAllText, + unblockSelector: this.unblockSelector, + maskTextClass: this.maskTextClass, + unmaskTextClass: this.unmaskTextClass, + maskTextSelector: this.maskTextSelector, + unmaskTextSelector: this.unmaskTextSelector, + skipChild: true, + newlyAddedElement: true, + inlineStylesheet: this.inlineStylesheet, + maskInputOptions: this.maskInputOptions, + maskAttributeFn: this.maskAttributeFn, + maskTextFn: this.maskTextFn, + maskInputFn: this.maskInputFn, + slimDOMOptions: this.slimDOMOptions, + dataURLOptions: this.dataURLOptions, + recordCanvas: this.recordCanvas, + inlineImages: this.inlineImages, + onSerialize: /* @__PURE__ */ __name((currentN) => { + if (isSerializedIframe(currentN, this.mirror) && !isBlocked$1(currentN, this.blockClass, this.blockSelector, this.unblockSelector, false)) { + this.iframeManager.addIframe(currentN); + } + if (isSerializedStylesheet(currentN, this.mirror)) { + this.stylesheetManager.trackLinkElement(currentN); + } + if (hasShadowRoot(n2)) { + this.shadowDomManager.addShadowRoot(n2.shadowRoot, this.doc); + } + }, "onSerialize"), + onIframeLoad: /* @__PURE__ */ __name((iframe, childSn) => { + if (isBlocked$1(iframe, this.blockClass, this.blockSelector, this.unblockSelector, false)) { + return; + } + this.iframeManager.attachIframe(iframe, childSn); + if (iframe.contentWindow) { + this.canvasManager.addWindow(iframe.contentWindow); + } + this.shadowDomManager.observeAttachShadow(iframe); + }, "onIframeLoad"), + onStylesheetLoad: /* @__PURE__ */ __name((link2, childSn) => { + this.stylesheetManager.attachLinkElement(link2, childSn); + }, "onStylesheetLoad") + }); + if (sn) { + adds.push({ + parentId, + nextId, + node: sn + }); + addedIds.add(sn.id); + } + }, "pushAdd"); + while (this.mapRemoves.length) { + this.mirror.removeNodeFromMap(this.mapRemoves.shift()); + } + for (const n2 of this.movedSet) { + if (isParentRemoved(this.removes, n2, this.mirror) && !this.movedSet.has(n2.parentNode)) { + continue; + } + pushAdd(n2); + } + for (const n2 of this.addedSet) { + if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removes, n2, this.mirror)) { + pushAdd(n2); + } else if (isAncestorInSet(this.movedSet, n2)) { + pushAdd(n2); + } else { + this.droppedSet.add(n2); + } + } + let candidate = null; + while (addList.length) { + let node3 = null; + if (candidate) { + const parentId = this.mirror.getId(candidate.value.parentNode); + const nextId = getNextId(candidate.value); + if (parentId !== -1 && nextId !== -1) { + node3 = candidate; + } + } + if (!node3) { + let tailNode = addList.tail; + while (tailNode) { + const _node = tailNode; + tailNode = tailNode.previous; + if (_node) { + const parentId = this.mirror.getId(_node.value.parentNode); + const nextId = getNextId(_node.value); + if (nextId === -1) + continue; + else if (parentId !== -1) { + node3 = _node; + break; + } else { + const unhandledNode = _node.value; + if (unhandledNode.parentNode && unhandledNode.parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + const shadowHost = unhandledNode.parentNode.host; + const parentId2 = this.mirror.getId(shadowHost); + if (parentId2 !== -1) { + node3 = _node; + break; + } + } + } + } + } + } + if (!node3) { + while (addList.head) { + addList.removeNode(addList.head.value); + } + break; + } + candidate = node3.previous; + addList.removeNode(node3.value); + pushAdd(node3.value); + } + const payload = { + texts: this.texts.map((text2) => ({ + id: this.mirror.getId(text2.node), + value: text2.value + })).filter((text2) => !addedIds.has(text2.id)).filter((text2) => this.mirror.has(text2.id)), + attributes: this.attributes.map((attribute2) => { + const { attributes } = attribute2; + if (typeof attributes.style === "string") { + const diffAsStr = JSON.stringify(attribute2.styleDiff); + const unchangedAsStr = JSON.stringify(attribute2._unchangedStyles); + if (diffAsStr.length < attributes.style.length) { + if ((diffAsStr + unchangedAsStr).split("var(").length === attributes.style.split("var(").length) { + attributes.style = attribute2.styleDiff; + } + } + } + return { + id: this.mirror.getId(attribute2.node), + attributes + }; + }).filter((attribute2) => !addedIds.has(attribute2.id)).filter((attribute2) => this.mirror.has(attribute2.id)), + removes: this.removes, + adds + }; + if (!payload.texts.length && !payload.attributes.length && !payload.removes.length && !payload.adds.length) { + return; + } + this.texts = []; + this.attributes = []; + this.attributeMap = /* @__PURE__ */ new WeakMap(); + this.removes = []; + this.addedSet = /* @__PURE__ */ new Set(); + this.movedSet = /* @__PURE__ */ new Set(); + this.droppedSet = /* @__PURE__ */ new Set(); + this.movedMap = {}; + this.mutationCb(payload); + }; + this.processMutation = (m2) => { + if (isIgnored(m2.target, this.mirror)) { + return; + } + switch (m2.type) { + case "characterData": { + const value4 = m2.target.textContent; + if (!isBlocked$1(m2.target, this.blockClass, this.blockSelector, this.unblockSelector, false) && value4 !== m2.oldValue) { + this.texts.push({ + value: needMaskingText(m2.target, this.maskTextClass, this.maskTextSelector, this.unmaskTextClass, this.unmaskTextSelector, this.maskAllText) && value4 ? this.maskTextFn ? this.maskTextFn(value4, closestElementOfNode$1(m2.target)) : value4.replace(/[\S]/g, "*") : value4, + node: m2.target + }); + } + break; + } + case "attributes": { + const target = m2.target; + let attributeName = m2.attributeName; + let value4 = m2.target.getAttribute(attributeName); + if (attributeName === "value") { + const type = getInputType(target); + const tagName = target.tagName; + value4 = getInputValue(target, tagName, type); + const isInputMasked = shouldMaskInput({ + maskInputOptions: this.maskInputOptions, + tagName, + type + }); + const forceMask = needMaskingText(m2.target, this.maskTextClass, this.maskTextSelector, this.unmaskTextClass, this.unmaskTextSelector, isInputMasked); + value4 = maskInputValue({ + isMasked: forceMask, + element: target, + value: value4, + maskInputFn: this.maskInputFn + }); + } + if (isBlocked$1(m2.target, this.blockClass, this.blockSelector, this.unblockSelector, false) || value4 === m2.oldValue) { + return; + } + let item3 = this.attributeMap.get(m2.target); + if (target.tagName === "IFRAME" && attributeName === "src" && !this.keepIframeSrcFn(value4)) { + const iframeDoc = getIFrameContentDocument(target); + if (!iframeDoc) { + attributeName = "rr_src"; + } else { + return; + } + } + if (!item3) { + item3 = { + node: m2.target, + attributes: {}, + styleDiff: {}, + _unchangedStyles: {} + }; + this.attributes.push(item3); + this.attributeMap.set(m2.target, item3); + } + if (attributeName === "type" && target.tagName === "INPUT" && (m2.oldValue || "").toLowerCase() === "password") { + target.setAttribute("data-rr-is-password", "true"); + } + if (!ignoreAttribute(target.tagName, attributeName)) { + item3.attributes[attributeName] = transformAttribute(this.doc, toLowerCase(target.tagName), toLowerCase(attributeName), value4, target, this.maskAttributeFn); + if (attributeName === "style") { + if (!this.unattachedDoc) { + try { + this.unattachedDoc = document.implementation.createHTMLDocument(); + } catch (e2) { + this.unattachedDoc = this.doc; + } + } + const old = this.unattachedDoc.createElement("span"); + if (m2.oldValue) { + old.setAttribute("style", m2.oldValue); + } + for (const pname of Array.from(target.style)) { + const newValue2 = target.style.getPropertyValue(pname); + const newPriority = target.style.getPropertyPriority(pname); + if (newValue2 !== old.style.getPropertyValue(pname) || newPriority !== old.style.getPropertyPriority(pname)) { + if (newPriority === "") { + item3.styleDiff[pname] = newValue2; + } else { + item3.styleDiff[pname] = [newValue2, newPriority]; + } + } else { + item3._unchangedStyles[pname] = [newValue2, newPriority]; + } + } + for (const pname of Array.from(old.style)) { + if (target.style.getPropertyValue(pname) === "") { + item3.styleDiff[pname] = false; + } + } + } + } + break; + } + case "childList": { + if (isBlocked$1(m2.target, this.blockClass, this.blockSelector, this.unblockSelector, true)) { + return; + } + m2.addedNodes.forEach((n2) => this.genAdds(n2, m2.target)); + m2.removedNodes.forEach((n2) => { + const nodeId = this.mirror.getId(n2); + const parentId = isShadowRoot(m2.target) ? this.mirror.getId(m2.target.host) : this.mirror.getId(m2.target); + if (isBlocked$1(m2.target, this.blockClass, this.blockSelector, this.unblockSelector, false) || isIgnored(n2, this.mirror) || !isSerialized(n2, this.mirror)) { + return; + } + if (this.addedSet.has(n2)) { + deepDelete(this.addedSet, n2); + this.droppedSet.add(n2); + } else if (this.addedSet.has(m2.target) && nodeId === -1) ; + else if (isAncestorRemoved(m2.target, this.mirror)) ; + else if (this.movedSet.has(n2) && this.movedMap[moveKey(nodeId, parentId)]) { + deepDelete(this.movedSet, n2); + } else { + this.removes.push({ + parentId, + id: nodeId, + isShadow: isShadowRoot(m2.target) && isNativeShadowDom(m2.target) ? true : void 0 + }); + } + this.mapRemoves.push(n2); + }); + break; + } + } + }; + this.genAdds = (n2, target) => { + if (this.processedNodeManager.inOtherBuffer(n2, this)) + return; + if (this.addedSet.has(n2) || this.movedSet.has(n2)) + return; + if (this.mirror.hasNode(n2)) { + if (isIgnored(n2, this.mirror)) { + return; + } + this.movedSet.add(n2); + let targetId = null; + if (target && this.mirror.hasNode(target)) { + targetId = this.mirror.getId(target); + } + if (targetId && targetId !== -1) { + this.movedMap[moveKey(this.mirror.getId(n2), targetId)] = true; + } + } else { + this.addedSet.add(n2); + this.droppedSet.delete(n2); + } + if (!isBlocked$1(n2, this.blockClass, this.blockSelector, this.unblockSelector, false)) { + n2.childNodes.forEach((childN) => this.genAdds(childN)); + if (hasShadowRoot(n2)) { + n2.shadowRoot.childNodes.forEach((childN) => { + this.processedNodeManager.add(childN, this); + this.genAdds(childN, n2); + }); + } + } + }; + } + init(options4) { + [ + "mutationCb", + "blockClass", + "blockSelector", + "unblockSelector", + "maskAllText", + "maskTextClass", + "unmaskTextClass", + "maskTextSelector", + "unmaskTextSelector", + "inlineStylesheet", + "maskInputOptions", + "maskAttributeFn", + "maskTextFn", + "maskInputFn", + "keepIframeSrcFn", + "recordCanvas", + "inlineImages", + "slimDOMOptions", + "dataURLOptions", + "doc", + "mirror", + "iframeManager", + "stylesheetManager", + "shadowDomManager", + "canvasManager", + "processedNodeManager" + ].forEach((key) => { + this[key] = options4[key]; + }); + } + freeze() { + this.frozen = true; + this.canvasManager.freeze(); + } + unfreeze() { + this.frozen = false; + this.canvasManager.unfreeze(); + this.emit(); + } + isFrozen() { + return this.frozen; + } + lock() { + this.locked = true; + this.canvasManager.lock(); + } + unlock() { + this.locked = false; + this.canvasManager.unlock(); + this.emit(); + } + reset() { + this.shadowDomManager.reset(); + this.canvasManager.reset(); + } +} +function deepDelete(addsSet, n2) { + addsSet.delete(n2); + n2.childNodes.forEach((childN) => deepDelete(addsSet, childN)); +} +__name(deepDelete, "deepDelete"); +function isParentRemoved(removes, n2, mirror2) { + if (removes.length === 0) + return false; + return _isParentRemoved(removes, n2, mirror2); +} +__name(isParentRemoved, "isParentRemoved"); +function _isParentRemoved(removes, n2, mirror2) { + let node3 = n2.parentNode; + while (node3) { + const parentId = mirror2.getId(node3); + if (removes.some((r2) => r2.id === parentId)) { + return true; + } + node3 = node3.parentNode; + } + return false; +} +__name(_isParentRemoved, "_isParentRemoved"); +function isAncestorInSet(set3, n2) { + if (set3.size === 0) + return false; + return _isAncestorInSet(set3, n2); +} +__name(isAncestorInSet, "isAncestorInSet"); +function _isAncestorInSet(set3, n2) { + const { parentNode: parentNode2 } = n2; + if (!parentNode2) { + return false; + } + if (set3.has(parentNode2)) { + return true; + } + return _isAncestorInSet(set3, parentNode2); +} +__name(_isAncestorInSet, "_isAncestorInSet"); +let errorHandler$1; +function registerErrorHandler$1(handler6) { + errorHandler$1 = handler6; +} +__name(registerErrorHandler$1, "registerErrorHandler$1"); +function unregisterErrorHandler() { + errorHandler$1 = void 0; +} +__name(unregisterErrorHandler, "unregisterErrorHandler"); +const callbackWrapper$1 = /* @__PURE__ */ __name((cb) => { + if (!errorHandler$1) { + return cb; + } + const rrwebWrapped = /* @__PURE__ */ __name((...rest) => { + try { + return cb(...rest); + } catch (error2) { + if (errorHandler$1 && errorHandler$1(error2) === true) { + return () => { + }; + } + throw error2; + } + }, "rrwebWrapped"); + return rrwebWrapped; +}, "callbackWrapper$1"); +function _optionalChain$2(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return void 0; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_optionalChain$2, "_optionalChain$2"); +const mutationBuffers = []; +function getEventTarget(event) { + try { + if ("composedPath" in event) { + const path = event.composedPath(); + if (path.length) { + return path[0]; + } + } else if ("path" in event && event.path.length) { + return event.path[0]; + } + } catch (e2) { + } + return event && event.target; +} +__name(getEventTarget, "getEventTarget"); +function initMutationObserver(options4, rootEl) { + const mutationBuffer = new MutationBuffer(); + mutationBuffers.push(mutationBuffer); + mutationBuffer.init(options4); + let mutationObserverCtor = window.MutationObserver || window.__rrMutationObserver; + const angularZoneSymbol = _optionalChain$2([window, "optionalAccess", (_2) => _2.Zone, "optionalAccess", (_2) => _2.__symbol__, "optionalCall", (_3) => _3("MutationObserver")]); + if (angularZoneSymbol && window[angularZoneSymbol]) { + mutationObserverCtor = window[angularZoneSymbol]; + } + const observer = new mutationObserverCtor(callbackWrapper$1((mutations) => { + if (options4.onMutation && options4.onMutation(mutations) === false) { + return; + } + mutationBuffer.processMutations.bind(mutationBuffer)(mutations); + })); + observer.observe(rootEl, { + attributes: true, + attributeOldValue: true, + characterData: true, + characterDataOldValue: true, + childList: true, + subtree: true + }); + return observer; +} +__name(initMutationObserver, "initMutationObserver"); +function initMoveObserver({ mousemoveCb, sampling, doc: doc2, mirror: mirror2 }) { + if (sampling.mousemove === false) { + return () => { + }; + } + const threshold = typeof sampling.mousemove === "number" ? sampling.mousemove : 50; + const callbackThreshold = typeof sampling.mousemoveCallback === "number" ? sampling.mousemoveCallback : 500; + let positions = []; + let timeBaseline; + const wrappedCb = throttle$1(callbackWrapper$1((source) => { + const totalOffset = Date.now() - timeBaseline; + mousemoveCb(positions.map((p2) => { + p2.timeOffset -= totalOffset; + return p2; + }), source); + positions = []; + timeBaseline = null; + }), callbackThreshold); + const updatePosition = callbackWrapper$1(throttle$1(callbackWrapper$1((evt) => { + const target = getEventTarget(evt); + const { clientX, clientY } = legacy_isTouchEvent(evt) ? evt.changedTouches[0] : evt; + if (!timeBaseline) { + timeBaseline = nowTimestamp(); + } + positions.push({ + x: clientX, + y: clientY, + id: mirror2.getId(target), + timeOffset: nowTimestamp() - timeBaseline + }); + wrappedCb(typeof DragEvent !== "undefined" && evt instanceof DragEvent ? IncrementalSource.Drag : evt instanceof MouseEvent ? IncrementalSource.MouseMove : IncrementalSource.TouchMove); + }), threshold, { + trailing: false + })); + const handlers2 = [ + on("mousemove", updatePosition, doc2), + on("touchmove", updatePosition, doc2), + on("drag", updatePosition, doc2) + ]; + return callbackWrapper$1(() => { + handlers2.forEach((h2) => h2()); + }); +} +__name(initMoveObserver, "initMoveObserver"); +function initMouseInteractionObserver({ mouseInteractionCb, doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, sampling }) { + if (sampling.mouseInteraction === false) { + return () => { + }; + } + const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction; + const handlers2 = []; + let currentPointerType = null; + const getHandler = /* @__PURE__ */ __name((eventKey) => { + return (event) => { + const target = getEventTarget(event); + if (isBlocked$1(target, blockClass, blockSelector, unblockSelector, true)) { + return; + } + let pointerType = null; + let thisEventKey = eventKey; + if ("pointerType" in event) { + switch (event.pointerType) { + case "mouse": + pointerType = PointerTypes.Mouse; + break; + case "touch": + pointerType = PointerTypes.Touch; + break; + case "pen": + pointerType = PointerTypes.Pen; + break; + } + if (pointerType === PointerTypes.Touch) { + if (MouseInteractions[eventKey] === MouseInteractions.MouseDown) { + thisEventKey = "TouchStart"; + } else if (MouseInteractions[eventKey] === MouseInteractions.MouseUp) { + thisEventKey = "TouchEnd"; + } + } else if (pointerType === PointerTypes.Pen) ; + } else if (legacy_isTouchEvent(event)) { + pointerType = PointerTypes.Touch; + } + if (pointerType !== null) { + currentPointerType = pointerType; + if (thisEventKey.startsWith("Touch") && pointerType === PointerTypes.Touch || thisEventKey.startsWith("Mouse") && pointerType === PointerTypes.Mouse) { + pointerType = null; + } + } else if (MouseInteractions[eventKey] === MouseInteractions.Click) { + pointerType = currentPointerType; + currentPointerType = null; + } + const e2 = legacy_isTouchEvent(event) ? event.changedTouches[0] : event; + if (!e2) { + return; + } + const id3 = mirror2.getId(target); + const { clientX, clientY } = e2; + callbackWrapper$1(mouseInteractionCb)({ + type: MouseInteractions[thisEventKey], + id: id3, + x: clientX, + y: clientY, + ...pointerType !== null && { pointerType } + }); + }; + }, "getHandler"); + Object.keys(MouseInteractions).filter((key) => Number.isNaN(Number(key)) && !key.endsWith("_Departed") && disableMap[key] !== false).forEach((eventKey) => { + let eventName = toLowerCase(eventKey); + const handler6 = getHandler(eventKey); + if (window.PointerEvent) { + switch (MouseInteractions[eventKey]) { + case MouseInteractions.MouseDown: + case MouseInteractions.MouseUp: + eventName = eventName.replace("mouse", "pointer"); + break; + case MouseInteractions.TouchStart: + case MouseInteractions.TouchEnd: + return; + } + } + handlers2.push(on(eventName, handler6, doc2)); + }); + return callbackWrapper$1(() => { + handlers2.forEach((h2) => h2()); + }); +} +__name(initMouseInteractionObserver, "initMouseInteractionObserver"); +function initScrollObserver({ scrollCb, doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, sampling }) { + const updatePosition = callbackWrapper$1(throttle$1(callbackWrapper$1((evt) => { + const target = getEventTarget(evt); + if (!target || isBlocked$1(target, blockClass, blockSelector, unblockSelector, true)) { + return; + } + const id3 = mirror2.getId(target); + if (target === doc2 && doc2.defaultView) { + const scrollLeftTop = getWindowScroll(doc2.defaultView); + scrollCb({ + id: id3, + x: scrollLeftTop.left, + y: scrollLeftTop.top + }); + } else { + scrollCb({ + id: id3, + x: target.scrollLeft, + y: target.scrollTop + }); + } + }), sampling.scroll || 100)); + return on("scroll", updatePosition, doc2); +} +__name(initScrollObserver, "initScrollObserver"); +function initViewportResizeObserver({ viewportResizeCb }, { win }) { + let lastH = -1; + let lastW = -1; + const updateDimension = callbackWrapper$1(throttle$1(callbackWrapper$1(() => { + const height = getWindowHeight(); + const width2 = getWindowWidth(); + if (lastH !== height || lastW !== width2) { + viewportResizeCb({ + width: Number(width2), + height: Number(height) + }); + lastH = height; + lastW = width2; + } + }), 200)); + return on("resize", updateDimension, win); +} +__name(initViewportResizeObserver, "initViewportResizeObserver"); +const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"]; +const lastInputValueMap = /* @__PURE__ */ new WeakMap(); +function initInputObserver({ inputCb, doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, ignoreClass, ignoreSelector, maskInputOptions, maskInputFn, sampling, userTriggeredOnInput, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector }) { + function eventHandler(event) { + let target = getEventTarget(event); + const userTriggered = event.isTrusted; + const tagName = target && toUpperCase(target.tagName); + if (tagName === "OPTION") + target = target.parentElement; + if (!target || !tagName || INPUT_TAGS.indexOf(tagName) < 0 || isBlocked$1(target, blockClass, blockSelector, unblockSelector, true)) { + return; + } + const el = target; + if (el.classList.contains(ignoreClass) || ignoreSelector && el.matches(ignoreSelector)) { + return; + } + const type = getInputType(target); + let text2 = getInputValue(el, tagName, type); + let isChecked2 = false; + const isInputMasked = shouldMaskInput({ + maskInputOptions, + tagName, + type + }); + const forceMask = needMaskingText(target, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, isInputMasked); + if (type === "radio" || type === "checkbox") { + isChecked2 = target.checked; + } + text2 = maskInputValue({ + isMasked: forceMask, + element: target, + value: text2, + maskInputFn + }); + cbWithDedup(target, userTriggeredOnInput ? { text: text2, isChecked: isChecked2, userTriggered } : { text: text2, isChecked: isChecked2 }); + const name2 = target.name; + if (type === "radio" && name2 && isChecked2) { + doc2.querySelectorAll(`input[type="radio"][name="${name2}"]`).forEach((el2) => { + if (el2 !== target) { + const text3 = maskInputValue({ + isMasked: forceMask, + element: el2, + value: getInputValue(el2, tagName, type), + maskInputFn + }); + cbWithDedup(el2, userTriggeredOnInput ? { text: text3, isChecked: !isChecked2, userTriggered: false } : { text: text3, isChecked: !isChecked2 }); + } + }); + } + } + __name(eventHandler, "eventHandler"); + function cbWithDedup(target, v2) { + const lastInputValue = lastInputValueMap.get(target); + if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) { + lastInputValueMap.set(target, v2); + const id3 = mirror2.getId(target); + callbackWrapper$1(inputCb)({ + ...v2, + id: id3 + }); + } + } + __name(cbWithDedup, "cbWithDedup"); + const events2 = sampling.input === "last" ? ["change"] : ["input", "change"]; + const handlers2 = events2.map((eventName) => on(eventName, callbackWrapper$1(eventHandler), doc2)); + const currentWindow = doc2.defaultView; + if (!currentWindow) { + return () => { + handlers2.forEach((h2) => h2()); + }; + } + const propertyDescriptor = currentWindow.Object.getOwnPropertyDescriptor(currentWindow.HTMLInputElement.prototype, "value"); + const hookProperties = [ + [currentWindow.HTMLInputElement.prototype, "value"], + [currentWindow.HTMLInputElement.prototype, "checked"], + [currentWindow.HTMLSelectElement.prototype, "value"], + [currentWindow.HTMLTextAreaElement.prototype, "value"], + [currentWindow.HTMLSelectElement.prototype, "selectedIndex"], + [currentWindow.HTMLOptionElement.prototype, "selected"] + ]; + if (propertyDescriptor && propertyDescriptor.set) { + handlers2.push(...hookProperties.map((p2) => hookSetter$1(p2[0], p2[1], { + set() { + callbackWrapper$1(eventHandler)({ + target: this, + isTrusted: false + }); + } + }, false, currentWindow))); + } + return callbackWrapper$1(() => { + handlers2.forEach((h2) => h2()); + }); +} +__name(initInputObserver, "initInputObserver"); +function getNestedCSSRulePositions(rule) { + const positions = []; + function recurse(childRule, pos2) { + if (hasNestedCSSRule("CSSGroupingRule") && childRule.parentRule instanceof CSSGroupingRule || hasNestedCSSRule("CSSMediaRule") && childRule.parentRule instanceof CSSMediaRule || hasNestedCSSRule("CSSSupportsRule") && childRule.parentRule instanceof CSSSupportsRule || hasNestedCSSRule("CSSConditionRule") && childRule.parentRule instanceof CSSConditionRule) { + const rules = Array.from(childRule.parentRule.cssRules); + const index2 = rules.indexOf(childRule); + pos2.unshift(index2); + } else if (childRule.parentStyleSheet) { + const rules = Array.from(childRule.parentStyleSheet.cssRules); + const index2 = rules.indexOf(childRule); + pos2.unshift(index2); + } + return pos2; + } + __name(recurse, "recurse"); + return recurse(rule, positions); +} +__name(getNestedCSSRulePositions, "getNestedCSSRulePositions"); +function getIdAndStyleId(sheet, mirror2, styleMirror) { + let id3, styleId; + if (!sheet) + return {}; + if (sheet.ownerNode) + id3 = mirror2.getId(sheet.ownerNode); + else + styleId = styleMirror.getId(sheet); + return { + styleId, + id: id3 + }; +} +__name(getIdAndStyleId, "getIdAndStyleId"); +function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetManager }, { win }) { + if (!win.CSSStyleSheet || !win.CSSStyleSheet.prototype) { + return () => { + }; + } + const insertRule = win.CSSStyleSheet.prototype.insertRule; + win.CSSStyleSheet.prototype.insertRule = new Proxy(insertRule, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [rule, index2] = argumentsList; + const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleSheetRuleCb({ + id: id3, + styleId, + adds: [{ rule, index: index2 }] + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + const deleteRule = win.CSSStyleSheet.prototype.deleteRule; + win.CSSStyleSheet.prototype.deleteRule = new Proxy(deleteRule, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [index2] = argumentsList; + const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleSheetRuleCb({ + id: id3, + styleId, + removes: [{ index: index2 }] + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + let replace2; + if (win.CSSStyleSheet.prototype.replace) { + replace2 = win.CSSStyleSheet.prototype.replace; + win.CSSStyleSheet.prototype.replace = new Proxy(replace2, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [text2] = argumentsList; + const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleSheetRuleCb({ + id: id3, + styleId, + replace: text2 + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + } + let replaceSync; + if (win.CSSStyleSheet.prototype.replaceSync) { + replaceSync = win.CSSStyleSheet.prototype.replaceSync; + win.CSSStyleSheet.prototype.replaceSync = new Proxy(replaceSync, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [text2] = argumentsList; + const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleSheetRuleCb({ + id: id3, + styleId, + replaceSync: text2 + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + } + const supportedNestedCSSRuleTypes = {}; + if (canMonkeyPatchNestedCSSRule("CSSGroupingRule")) { + supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule; + } else { + if (canMonkeyPatchNestedCSSRule("CSSMediaRule")) { + supportedNestedCSSRuleTypes.CSSMediaRule = win.CSSMediaRule; + } + if (canMonkeyPatchNestedCSSRule("CSSConditionRule")) { + supportedNestedCSSRuleTypes.CSSConditionRule = win.CSSConditionRule; + } + if (canMonkeyPatchNestedCSSRule("CSSSupportsRule")) { + supportedNestedCSSRuleTypes.CSSSupportsRule = win.CSSSupportsRule; + } + } + const unmodifiedFunctions = {}; + Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => { + unmodifiedFunctions[typeKey] = { + insertRule: type.prototype.insertRule, + deleteRule: type.prototype.deleteRule + }; + type.prototype.insertRule = new Proxy(unmodifiedFunctions[typeKey].insertRule, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [rule, index2] = argumentsList; + const { id: id3, styleId } = getIdAndStyleId(thisArg.parentStyleSheet, mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleSheetRuleCb({ + id: id3, + styleId, + adds: [ + { + rule, + index: [ + ...getNestedCSSRulePositions(thisArg), + index2 || 0 + ] + } + ] + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + type.prototype.deleteRule = new Proxy(unmodifiedFunctions[typeKey].deleteRule, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [index2] = argumentsList; + const { id: id3, styleId } = getIdAndStyleId(thisArg.parentStyleSheet, mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleSheetRuleCb({ + id: id3, + styleId, + removes: [ + { index: [...getNestedCSSRulePositions(thisArg), index2] } + ] + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + }); + return callbackWrapper$1(() => { + win.CSSStyleSheet.prototype.insertRule = insertRule; + win.CSSStyleSheet.prototype.deleteRule = deleteRule; + replace2 && (win.CSSStyleSheet.prototype.replace = replace2); + replaceSync && (win.CSSStyleSheet.prototype.replaceSync = replaceSync); + Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => { + type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule; + type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule; + }); + }); +} +__name(initStyleSheetObserver, "initStyleSheetObserver"); +function initAdoptedStyleSheetObserver({ mirror: mirror2, stylesheetManager }, host) { + let hostId = null; + if (host.nodeName === "#document") + hostId = mirror2.getId(host); + else + hostId = mirror2.getId(host.host); + const patchTarget = host.nodeName === "#document" ? _optionalChain$2([host, "access", (_4) => _4.defaultView, "optionalAccess", (_5) => _5.Document]) : _optionalChain$2([host, "access", (_6) => _6.ownerDocument, "optionalAccess", (_7) => _7.defaultView, "optionalAccess", (_8) => _8.ShadowRoot]); + const originalPropertyDescriptor = _optionalChain$2([patchTarget, "optionalAccess", (_9) => _9.prototype]) ? Object.getOwnPropertyDescriptor(_optionalChain$2([patchTarget, "optionalAccess", (_10) => _10.prototype]), "adoptedStyleSheets") : void 0; + if (hostId === null || hostId === -1 || !patchTarget || !originalPropertyDescriptor) + return () => { + }; + Object.defineProperty(host, "adoptedStyleSheets", { + configurable: originalPropertyDescriptor.configurable, + enumerable: originalPropertyDescriptor.enumerable, + get() { + return _optionalChain$2([originalPropertyDescriptor, "access", (_11) => _11.get, "optionalAccess", (_12) => _12.call, "call", (_13) => _13(this)]); + }, + set(sheets) { + const result = _optionalChain$2([originalPropertyDescriptor, "access", (_14) => _14.set, "optionalAccess", (_15) => _15.call, "call", (_16) => _16(this, sheets)]); + if (hostId !== null && hostId !== -1) { + try { + stylesheetManager.adoptStyleSheets(sheets, hostId); + } catch (e2) { + } + } + return result; + } + }); + return callbackWrapper$1(() => { + Object.defineProperty(host, "adoptedStyleSheets", { + configurable: originalPropertyDescriptor.configurable, + enumerable: originalPropertyDescriptor.enumerable, + get: originalPropertyDescriptor.get, + set: originalPropertyDescriptor.set + }); + }); +} +__name(initAdoptedStyleSheetObserver, "initAdoptedStyleSheetObserver"); +function initStyleDeclarationObserver({ styleDeclarationCb, mirror: mirror2, ignoreCSSAttributes, stylesheetManager }, { win }) { + const setProperty2 = win.CSSStyleDeclaration.prototype.setProperty; + win.CSSStyleDeclaration.prototype.setProperty = new Proxy(setProperty2, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [property, value4, priority] = argumentsList; + if (ignoreCSSAttributes.has(property)) { + return setProperty2.apply(thisArg, [property, value4, priority]); + } + const { id: id3, styleId } = getIdAndStyleId(_optionalChain$2([thisArg, "access", (_17) => _17.parentRule, "optionalAccess", (_18) => _18.parentStyleSheet]), mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleDeclarationCb({ + id: id3, + styleId, + set: { + property, + value: value4, + priority + }, + index: getNestedCSSRulePositions(thisArg.parentRule) + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty; + win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, { + apply: callbackWrapper$1((target, thisArg, argumentsList) => { + const [property] = argumentsList; + if (ignoreCSSAttributes.has(property)) { + return removeProperty.apply(thisArg, [property]); + } + const { id: id3, styleId } = getIdAndStyleId(_optionalChain$2([thisArg, "access", (_19) => _19.parentRule, "optionalAccess", (_20) => _20.parentStyleSheet]), mirror2, stylesheetManager.styleMirror); + if (id3 && id3 !== -1 || styleId && styleId !== -1) { + styleDeclarationCb({ + id: id3, + styleId, + remove: { + property + }, + index: getNestedCSSRulePositions(thisArg.parentRule) + }); + } + return target.apply(thisArg, argumentsList); + }) + }); + return callbackWrapper$1(() => { + win.CSSStyleDeclaration.prototype.setProperty = setProperty2; + win.CSSStyleDeclaration.prototype.removeProperty = removeProperty; + }); +} +__name(initStyleDeclarationObserver, "initStyleDeclarationObserver"); +function initMediaInteractionObserver({ mediaInteractionCb, blockClass, blockSelector, unblockSelector, mirror: mirror2, sampling, doc: doc2 }) { + const handler6 = callbackWrapper$1((type) => throttle$1(callbackWrapper$1((event) => { + const target = getEventTarget(event); + if (!target || isBlocked$1(target, blockClass, blockSelector, unblockSelector, true)) { + return; + } + const { currentTime, volume, muted, playbackRate } = target; + mediaInteractionCb({ + type, + id: mirror2.getId(target), + currentTime, + volume, + muted, + playbackRate + }); + }), sampling.media || 500)); + const handlers2 = [ + on("play", handler6(0), doc2), + on("pause", handler6(1), doc2), + on("seeked", handler6(2), doc2), + on("volumechange", handler6(3), doc2), + on("ratechange", handler6(4), doc2) + ]; + return callbackWrapper$1(() => { + handlers2.forEach((h2) => h2()); + }); +} +__name(initMediaInteractionObserver, "initMediaInteractionObserver"); +function initFontObserver({ fontCb, doc: doc2 }) { + const win = doc2.defaultView; + if (!win) { + return () => { + }; + } + const handlers2 = []; + const fontMap = /* @__PURE__ */ new WeakMap(); + const originalFontFace = win.FontFace; + win.FontFace = /* @__PURE__ */ __name(function FontFace(family, source, descriptors2) { + const fontFace = new originalFontFace(family, source, descriptors2); + fontMap.set(fontFace, { + family, + buffer: typeof source !== "string", + descriptors: descriptors2, + fontSource: typeof source === "string" ? source : JSON.stringify(Array.from(new Uint8Array(source))) + }); + return fontFace; + }, "FontFace"); + const restoreHandler = patch$2(doc2.fonts, "add", function(original) { + return function(fontFace) { + setTimeout$1$1(callbackWrapper$1(() => { + const p2 = fontMap.get(fontFace); + if (p2) { + fontCb(p2); + fontMap.delete(fontFace); + } + }), 0); + return original.apply(this, [fontFace]); + }; + }); + handlers2.push(() => { + win.FontFace = originalFontFace; + }); + handlers2.push(restoreHandler); + return callbackWrapper$1(() => { + handlers2.forEach((h2) => h2()); + }); +} +__name(initFontObserver, "initFontObserver"); +function initSelectionObserver(param) { + const { doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, selectionCb } = param; + let collapsed2 = true; + const updateSelection2 = callbackWrapper$1(() => { + const selection = doc2.getSelection(); + if (!selection || collapsed2 && _optionalChain$2([selection, "optionalAccess", (_21) => _21.isCollapsed])) + return; + collapsed2 = selection.isCollapsed || false; + const ranges = []; + const count = selection.rangeCount || 0; + for (let i2 = 0; i2 < count; i2++) { + const range2 = selection.getRangeAt(i2); + const { startContainer, startOffset, endContainer, endOffset } = range2; + const blocked2 = isBlocked$1(startContainer, blockClass, blockSelector, unblockSelector, true) || isBlocked$1(endContainer, blockClass, blockSelector, unblockSelector, true); + if (blocked2) + continue; + ranges.push({ + start: mirror2.getId(startContainer), + startOffset, + end: mirror2.getId(endContainer), + endOffset + }); + } + selectionCb({ ranges }); + }); + updateSelection2(); + return on("selectionchange", updateSelection2); +} +__name(initSelectionObserver, "initSelectionObserver"); +function initCustomElementObserver({ doc: doc2, customElementCb }) { + const win = doc2.defaultView; + if (!win || !win.customElements) + return () => { + }; + const restoreHandler = patch$2(win.customElements, "define", function(original) { + return function(name2, constructor, options4) { + try { + customElementCb({ + define: { + name: name2 + } + }); + } catch (e2) { + } + return original.apply(this, [name2, constructor, options4]); + }; + }); + return restoreHandler; +} +__name(initCustomElementObserver, "initCustomElementObserver"); +function initObservers(o2, _hooks = {}) { + const currentWindow = o2.doc.defaultView; + if (!currentWindow) { + return () => { + }; + } + let mutationObserver; + if (o2.recordDOM) { + mutationObserver = initMutationObserver(o2, o2.doc); + } + const mousemoveHandler = initMoveObserver(o2); + const mouseInteractionHandler = initMouseInteractionObserver(o2); + const scrollHandler = initScrollObserver(o2); + const viewportResizeHandler = initViewportResizeObserver(o2, { + win: currentWindow + }); + const inputHandler = initInputObserver(o2); + const mediaInteractionHandler = initMediaInteractionObserver(o2); + let styleSheetObserver = /* @__PURE__ */ __name(() => { + }, "styleSheetObserver"); + let adoptedStyleSheetObserver = /* @__PURE__ */ __name(() => { + }, "adoptedStyleSheetObserver"); + let styleDeclarationObserver = /* @__PURE__ */ __name(() => { + }, "styleDeclarationObserver"); + let fontObserver = /* @__PURE__ */ __name(() => { + }, "fontObserver"); + if (o2.recordDOM) { + styleSheetObserver = initStyleSheetObserver(o2, { win: currentWindow }); + adoptedStyleSheetObserver = initAdoptedStyleSheetObserver(o2, o2.doc); + styleDeclarationObserver = initStyleDeclarationObserver(o2, { + win: currentWindow + }); + if (o2.collectFonts) { + fontObserver = initFontObserver(o2); + } + } + const selectionObserver = initSelectionObserver(o2); + const customElementObserver = initCustomElementObserver(o2); + const pluginHandlers = []; + for (const plugin of o2.plugins) { + pluginHandlers.push(plugin.observer(plugin.callback, currentWindow, plugin.options)); + } + return callbackWrapper$1(() => { + mutationBuffers.forEach((b2) => b2.reset()); + _optionalChain$2([mutationObserver, "optionalAccess", (_22) => _22.disconnect, "call", (_23) => _23()]); + mousemoveHandler(); + mouseInteractionHandler(); + scrollHandler(); + viewportResizeHandler(); + inputHandler(); + mediaInteractionHandler(); + styleSheetObserver(); + adoptedStyleSheetObserver(); + styleDeclarationObserver(); + fontObserver(); + selectionObserver(); + customElementObserver(); + pluginHandlers.forEach((h2) => h2()); + }); +} +__name(initObservers, "initObservers"); +function hasNestedCSSRule(prop2) { + return typeof window[prop2] !== "undefined"; +} +__name(hasNestedCSSRule, "hasNestedCSSRule"); +function canMonkeyPatchNestedCSSRule(prop2) { + return Boolean(typeof window[prop2] !== "undefined" && window[prop2].prototype && "insertRule" in window[prop2].prototype && "deleteRule" in window[prop2].prototype); +} +__name(canMonkeyPatchNestedCSSRule, "canMonkeyPatchNestedCSSRule"); +class CrossOriginIframeMirror { + static { + __name(this, "CrossOriginIframeMirror"); + } + constructor(generateIdFn) { + this.generateIdFn = generateIdFn; + this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap(); + this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap(); + } + getId(iframe, remoteId, idToRemoteMap, remoteToIdMap) { + const idToRemoteIdMap = idToRemoteMap || this.getIdToRemoteIdMap(iframe); + const remoteIdToIdMap = remoteToIdMap || this.getRemoteIdToIdMap(iframe); + let id3 = idToRemoteIdMap.get(remoteId); + if (!id3) { + id3 = this.generateIdFn(); + idToRemoteIdMap.set(remoteId, id3); + remoteIdToIdMap.set(id3, remoteId); + } + return id3; + } + getIds(iframe, remoteId) { + const idToRemoteIdMap = this.getIdToRemoteIdMap(iframe); + const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe); + return remoteId.map((id3) => this.getId(iframe, id3, idToRemoteIdMap, remoteIdToIdMap)); + } + getRemoteId(iframe, id3, map3) { + const remoteIdToIdMap = map3 || this.getRemoteIdToIdMap(iframe); + if (typeof id3 !== "number") + return id3; + const remoteId = remoteIdToIdMap.get(id3); + if (!remoteId) + return -1; + return remoteId; + } + getRemoteIds(iframe, ids) { + const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe); + return ids.map((id3) => this.getRemoteId(iframe, id3, remoteIdToIdMap)); + } + reset(iframe) { + if (!iframe) { + this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap(); + this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap(); + return; + } + this.iframeIdToRemoteIdMap.delete(iframe); + this.iframeRemoteIdToIdMap.delete(iframe); + } + getIdToRemoteIdMap(iframe) { + let idToRemoteIdMap = this.iframeIdToRemoteIdMap.get(iframe); + if (!idToRemoteIdMap) { + idToRemoteIdMap = /* @__PURE__ */ new Map(); + this.iframeIdToRemoteIdMap.set(iframe, idToRemoteIdMap); + } + return idToRemoteIdMap; + } + getRemoteIdToIdMap(iframe) { + let remoteIdToIdMap = this.iframeRemoteIdToIdMap.get(iframe); + if (!remoteIdToIdMap) { + remoteIdToIdMap = /* @__PURE__ */ new Map(); + this.iframeRemoteIdToIdMap.set(iframe, remoteIdToIdMap); + } + return remoteIdToIdMap; + } +} +function _optionalChain$1(ops) { + let lastAccessLHS = void 0; + let value4 = ops[0]; + let i2 = 1; + while (i2 < ops.length) { + const op = ops[i2]; + const fn = ops[i2 + 1]; + i2 += 2; + if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { + return void 0; + } + if (op === "access" || op === "optionalAccess") { + lastAccessLHS = value4; + value4 = fn(value4); + } else if (op === "call" || op === "optionalCall") { + value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); + lastAccessLHS = void 0; + } + } + return value4; +} +__name(_optionalChain$1, "_optionalChain$1"); +class IframeManagerNoop { + static { + __name(this, "IframeManagerNoop"); + } + constructor() { + this.crossOriginIframeMirror = new CrossOriginIframeMirror(genId); + this.crossOriginIframeRootIdMap = /* @__PURE__ */ new WeakMap(); + } + addIframe() { + } + addLoadListener() { + } + attachIframe() { + } +} +class IframeManager { + static { + __name(this, "IframeManager"); + } + constructor(options4) { + this.iframes = /* @__PURE__ */ new WeakMap(); + this.crossOriginIframeMap = /* @__PURE__ */ new WeakMap(); + this.crossOriginIframeMirror = new CrossOriginIframeMirror(genId); + this.crossOriginIframeRootIdMap = /* @__PURE__ */ new WeakMap(); + this.mutationCb = options4.mutationCb; + this.wrappedEmit = options4.wrappedEmit; + this.stylesheetManager = options4.stylesheetManager; + this.recordCrossOriginIframes = options4.recordCrossOriginIframes; + this.crossOriginIframeStyleMirror = new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)); + this.mirror = options4.mirror; + if (this.recordCrossOriginIframes) { + window.addEventListener("message", this.handleMessage.bind(this)); + } + } + addIframe(iframeEl) { + this.iframes.set(iframeEl, true); + if (iframeEl.contentWindow) + this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl); + } + addLoadListener(cb) { + this.loadListener = cb; + } + attachIframe(iframeEl, childSn) { + this.mutationCb({ + adds: [ + { + parentId: this.mirror.getId(iframeEl), + nextId: null, + node: childSn + } + ], + removes: [], + texts: [], + attributes: [], + isAttachIframe: true + }); + _optionalChain$1([this, "access", (_2) => _2.loadListener, "optionalCall", (_2) => _2(iframeEl)]); + const iframeDoc = getIFrameContentDocument(iframeEl); + if (iframeDoc && iframeDoc.adoptedStyleSheets && iframeDoc.adoptedStyleSheets.length > 0) + this.stylesheetManager.adoptStyleSheets(iframeDoc.adoptedStyleSheets, this.mirror.getId(iframeDoc)); + } + handleMessage(message3) { + const crossOriginMessageEvent = message3; + if (crossOriginMessageEvent.data.type !== "rrweb" || crossOriginMessageEvent.origin !== crossOriginMessageEvent.data.origin) + return; + const iframeSourceWindow = message3.source; + if (!iframeSourceWindow) + return; + const iframeEl = this.crossOriginIframeMap.get(message3.source); + if (!iframeEl) + return; + const transformedEvent = this.transformCrossOriginEvent(iframeEl, crossOriginMessageEvent.data.event); + if (transformedEvent) + this.wrappedEmit(transformedEvent, crossOriginMessageEvent.data.isCheckout); + } + transformCrossOriginEvent(iframeEl, e2) { + switch (e2.type) { + case EventType.FullSnapshot: { + this.crossOriginIframeMirror.reset(iframeEl); + this.crossOriginIframeStyleMirror.reset(iframeEl); + this.replaceIdOnNode(e2.data.node, iframeEl); + const rootId = e2.data.node.id; + this.crossOriginIframeRootIdMap.set(iframeEl, rootId); + this.patchRootIdOnNode(e2.data.node, rootId); + return { + timestamp: e2.timestamp, + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.Mutation, + adds: [ + { + parentId: this.mirror.getId(iframeEl), + nextId: null, + node: e2.data.node + } + ], + removes: [], + texts: [], + attributes: [], + isAttachIframe: true + } + }; + } + case EventType.Meta: + case EventType.Load: + case EventType.DomContentLoaded: { + return false; + } + case EventType.Plugin: { + return e2; + } + case EventType.Custom: { + this.replaceIds(e2.data.payload, iframeEl, ["id", "parentId", "previousId", "nextId"]); + return e2; + } + case EventType.IncrementalSnapshot: { + switch (e2.data.source) { + case IncrementalSource.Mutation: { + e2.data.adds.forEach((n2) => { + this.replaceIds(n2, iframeEl, [ + "parentId", + "nextId", + "previousId" + ]); + this.replaceIdOnNode(n2.node, iframeEl); + const rootId = this.crossOriginIframeRootIdMap.get(iframeEl); + rootId && this.patchRootIdOnNode(n2.node, rootId); + }); + e2.data.removes.forEach((n2) => { + this.replaceIds(n2, iframeEl, ["parentId", "id"]); + }); + e2.data.attributes.forEach((n2) => { + this.replaceIds(n2, iframeEl, ["id"]); + }); + e2.data.texts.forEach((n2) => { + this.replaceIds(n2, iframeEl, ["id"]); + }); + return e2; + } + case IncrementalSource.Drag: + case IncrementalSource.TouchMove: + case IncrementalSource.MouseMove: { + e2.data.positions.forEach((p2) => { + this.replaceIds(p2, iframeEl, ["id"]); + }); + return e2; + } + case IncrementalSource.ViewportResize: { + return false; + } + case IncrementalSource.MediaInteraction: + case IncrementalSource.MouseInteraction: + case IncrementalSource.Scroll: + case IncrementalSource.CanvasMutation: + case IncrementalSource.Input: { + this.replaceIds(e2.data, iframeEl, ["id"]); + return e2; + } + case IncrementalSource.StyleSheetRule: + case IncrementalSource.StyleDeclaration: { + this.replaceIds(e2.data, iframeEl, ["id"]); + this.replaceStyleIds(e2.data, iframeEl, ["styleId"]); + return e2; + } + case IncrementalSource.Font: { + return e2; + } + case IncrementalSource.Selection: { + e2.data.ranges.forEach((range2) => { + this.replaceIds(range2, iframeEl, ["start", "end"]); + }); + return e2; + } + case IncrementalSource.AdoptedStyleSheet: { + this.replaceIds(e2.data, iframeEl, ["id"]); + this.replaceStyleIds(e2.data, iframeEl, ["styleIds"]); + _optionalChain$1([e2, "access", (_3) => _3.data, "access", (_4) => _4.styles, "optionalAccess", (_5) => _5.forEach, "call", (_6) => _6((style2) => { + this.replaceStyleIds(style2, iframeEl, ["styleId"]); + })]); + return e2; + } + } + } + } + return false; + } + replace(iframeMirror, obj, iframeEl, keys2) { + for (const key of keys2) { + if (!Array.isArray(obj[key]) && typeof obj[key] !== "number") + continue; + if (Array.isArray(obj[key])) { + obj[key] = iframeMirror.getIds(iframeEl, obj[key]); + } else { + obj[key] = iframeMirror.getId(iframeEl, obj[key]); + } + } + return obj; + } + replaceIds(obj, iframeEl, keys2) { + return this.replace(this.crossOriginIframeMirror, obj, iframeEl, keys2); + } + replaceStyleIds(obj, iframeEl, keys2) { + return this.replace(this.crossOriginIframeStyleMirror, obj, iframeEl, keys2); + } + replaceIdOnNode(node3, iframeEl) { + this.replaceIds(node3, iframeEl, ["id", "rootId"]); + if ("childNodes" in node3) { + node3.childNodes.forEach((child) => { + this.replaceIdOnNode(child, iframeEl); + }); + } + } + patchRootIdOnNode(node3, rootId) { + if (node3.type !== NodeType$3.Document && !node3.rootId) + node3.rootId = rootId; + if ("childNodes" in node3) { + node3.childNodes.forEach((child) => { + this.patchRootIdOnNode(child, rootId); + }); + } + } +} +class ShadowDomManagerNoop { + static { + __name(this, "ShadowDomManagerNoop"); + } + init() { + } + addShadowRoot() { + } + observeAttachShadow() { + } + reset() { + } +} +class ShadowDomManager { + static { + __name(this, "ShadowDomManager"); + } + constructor(options4) { + this.shadowDoms = /* @__PURE__ */ new WeakSet(); + this.restoreHandlers = []; + this.mutationCb = options4.mutationCb; + this.scrollCb = options4.scrollCb; + this.bypassOptions = options4.bypassOptions; + this.mirror = options4.mirror; + this.init(); + } + init() { + this.reset(); + this.patchAttachShadow(Element, document); + } + addShadowRoot(shadowRoot, doc2) { + if (!isNativeShadowDom(shadowRoot)) + return; + if (this.shadowDoms.has(shadowRoot)) + return; + this.shadowDoms.add(shadowRoot); + this.bypassOptions.canvasManager.addShadowRoot(shadowRoot); + const observer = initMutationObserver({ + ...this.bypassOptions, + doc: doc2, + mutationCb: this.mutationCb, + mirror: this.mirror, + shadowDomManager: this + }, shadowRoot); + this.restoreHandlers.push(() => observer.disconnect()); + this.restoreHandlers.push(initScrollObserver({ + ...this.bypassOptions, + scrollCb: this.scrollCb, + doc: shadowRoot, + mirror: this.mirror + })); + setTimeout$1$1(() => { + if (shadowRoot.adoptedStyleSheets && shadowRoot.adoptedStyleSheets.length > 0) + this.bypassOptions.stylesheetManager.adoptStyleSheets(shadowRoot.adoptedStyleSheets, this.mirror.getId(shadowRoot.host)); + this.restoreHandlers.push(initAdoptedStyleSheetObserver({ + mirror: this.mirror, + stylesheetManager: this.bypassOptions.stylesheetManager + }, shadowRoot)); + }, 0); + } + observeAttachShadow(iframeElement) { + const iframeDoc = getIFrameContentDocument(iframeElement); + const iframeWindow = getIFrameContentWindow(iframeElement); + if (!iframeDoc || !iframeWindow) + return; + this.patchAttachShadow(iframeWindow.Element, iframeDoc); + } + patchAttachShadow(element, doc2) { + const manager = this; + this.restoreHandlers.push(patch$2(element.prototype, "attachShadow", function(original) { + return function(option3) { + const shadowRoot = original.call(this, option3); + if (this.shadowRoot && inDom(this)) + manager.addShadowRoot(this.shadowRoot, doc2); + return shadowRoot; + }; + })); + } + reset() { + this.restoreHandlers.forEach((handler6) => { + try { + handler6(); + } catch (e2) { + } + }); + this.restoreHandlers = []; + this.shadowDoms = /* @__PURE__ */ new WeakSet(); + this.bypassOptions.canvasManager.resetShadowRoots(); + } +} +class CanvasManagerNoop { + static { + __name(this, "CanvasManagerNoop"); + } + reset() { + } + freeze() { + } + unfreeze() { + } + lock() { + } + unlock() { + } + snapshot() { + } + addWindow() { + } + addShadowRoot() { + } + resetShadowRoots() { + } +} +class StylesheetManager { + static { + __name(this, "StylesheetManager"); + } + constructor(options4) { + this.trackedLinkElements = /* @__PURE__ */ new WeakSet(); + this.styleMirror = new StyleSheetMirror(); + this.mutationCb = options4.mutationCb; + this.adoptedStyleSheetCb = options4.adoptedStyleSheetCb; + } + attachLinkElement(linkEl, childSn) { + if ("_cssText" in childSn.attributes) + this.mutationCb({ + adds: [], + removes: [], + texts: [], + attributes: [ + { + id: childSn.id, + attributes: childSn.attributes + } + ] + }); + this.trackLinkElement(linkEl); + } + trackLinkElement(linkEl) { + if (this.trackedLinkElements.has(linkEl)) + return; + this.trackedLinkElements.add(linkEl); + this.trackStylesheetInLinkElement(linkEl); + } + adoptStyleSheets(sheets, hostId) { + if (sheets.length === 0) + return; + const adoptedStyleSheetData = { + id: hostId, + styleIds: [] + }; + const styles = []; + for (const sheet of sheets) { + let styleId; + if (!this.styleMirror.has(sheet)) { + styleId = this.styleMirror.add(sheet); + styles.push({ + styleId, + rules: Array.from(sheet.rules || CSSRule, (r2, index2) => ({ + rule: stringifyRule(r2), + index: index2 + })) + }); + } else + styleId = this.styleMirror.getId(sheet); + adoptedStyleSheetData.styleIds.push(styleId); + } + if (styles.length > 0) + adoptedStyleSheetData.styles = styles; + this.adoptedStyleSheetCb(adoptedStyleSheetData); + } + reset() { + this.styleMirror.reset(); + this.trackedLinkElements = /* @__PURE__ */ new WeakSet(); + } + trackStylesheetInLinkElement(linkEl) { + } +} +class ProcessedNodeManager { + static { + __name(this, "ProcessedNodeManager"); + } + constructor() { + this.nodeMap = /* @__PURE__ */ new WeakMap(); + this.active = false; + } + inOtherBuffer(node3, thisBuffer) { + const buffers = this.nodeMap.get(node3); + return buffers && Array.from(buffers).some((buffer2) => buffer2 !== thisBuffer); + } + add(node3, buffer2) { + if (!this.active) { + this.active = true; + onRequestAnimationFrame$1(() => { + this.nodeMap = /* @__PURE__ */ new WeakMap(); + this.active = false; + }); + } + this.nodeMap.set(node3, (this.nodeMap.get(node3) || /* @__PURE__ */ new Set()).add(buffer2)); + } + destroy() { + } +} +let wrappedEmit; +let _takeFullSnapshot; +try { + if (Array.from([1], (x2) => x2 * 2)[0] !== 2) { + const cleanFrame = document.createElement("iframe"); + document.body.appendChild(cleanFrame); + Array.from = _optionalChain([cleanFrame, "access", (_2) => _2.contentWindow, "optionalAccess", (_2) => _2.Array, "access", (_3) => _3.from]) || Array.from; + document.body.removeChild(cleanFrame); + } +} catch (err) { + console.debug("Unable to override Array.from", err); +} +const mirror = createMirror(); +function record(options4 = {}) { + const { emit: emit2, checkoutEveryNms, checkoutEveryNth, blockClass = "rr-block", blockSelector = null, unblockSelector = null, ignoreClass = "rr-ignore", ignoreSelector = null, maskAllText = false, maskTextClass = "rr-mask", unmaskTextClass = null, maskTextSelector = null, unmaskTextSelector = null, inlineStylesheet = true, maskAllInputs, maskInputOptions: _maskInputOptions, slimDOMOptions: _slimDOMOptions, maskAttributeFn, maskInputFn, maskTextFn, maxCanvasSize = null, packFn, sampling = {}, dataURLOptions = {}, mousemoveWait, recordDOM = true, recordCanvas = false, recordCrossOriginIframes = false, recordAfter = options4.recordAfter === "DOMContentLoaded" ? options4.recordAfter : "load", userTriggeredOnInput = false, collectFonts = false, inlineImages = false, plugins, keepIframeSrcFn = /* @__PURE__ */ __name(() => false, "keepIframeSrcFn"), ignoreCSSAttributes = /* @__PURE__ */ new Set([]), errorHandler: errorHandler2, onMutation, getCanvasManager } = options4; + registerErrorHandler$1(errorHandler2); + const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true; + let passEmitsToParent = false; + if (!inEmittingFrame) { + try { + if (window.parent.document) { + passEmitsToParent = false; + } + } catch (e2) { + passEmitsToParent = true; + } + } + if (inEmittingFrame && !emit2) { + throw new Error("emit function is required"); + } + if (!inEmittingFrame && !passEmitsToParent) { + return () => { + }; + } + if (mousemoveWait !== void 0 && sampling.mousemove === void 0) { + sampling.mousemove = mousemoveWait; + } + mirror.reset(); + const maskInputOptions = maskAllInputs === true ? { + color: true, + date: true, + "datetime-local": true, + email: true, + month: true, + number: true, + range: true, + search: true, + tel: true, + text: true, + time: true, + url: true, + week: true, + textarea: true, + select: true, + radio: true, + checkbox: true + } : _maskInputOptions !== void 0 ? _maskInputOptions : {}; + const slimDOMOptions = _slimDOMOptions === true || _slimDOMOptions === "all" ? { + script: true, + comment: true, + headFavicon: true, + headWhitespace: true, + headMetaSocial: true, + headMetaRobots: true, + headMetaHttpEquiv: true, + headMetaVerification: true, + headMetaAuthorship: _slimDOMOptions === "all", + headMetaDescKeywords: _slimDOMOptions === "all" + } : _slimDOMOptions ? _slimDOMOptions : {}; + polyfill(); + let lastFullSnapshotEvent; + let incrementalSnapshotCount = 0; + const eventProcessor = /* @__PURE__ */ __name((e2) => { + for (const plugin of plugins || []) { + if (plugin.eventProcessor) { + e2 = plugin.eventProcessor(e2); + } + } + if (packFn && !passEmitsToParent) { + e2 = packFn(e2); + } + return e2; + }, "eventProcessor"); + wrappedEmit = /* @__PURE__ */ __name((r2, isCheckout) => { + const e2 = r2; + e2.timestamp = nowTimestamp(); + if (_optionalChain([mutationBuffers, "access", (_4) => _4[0], "optionalAccess", (_5) => _5.isFrozen, "call", (_6) => _6()]) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) { + mutationBuffers.forEach((buf) => buf.unfreeze()); + } + if (inEmittingFrame) { + _optionalChain([emit2, "optionalCall", (_7) => _7(eventProcessor(e2), isCheckout)]); + } else if (passEmitsToParent) { + const message3 = { + type: "rrweb", + event: eventProcessor(e2), + origin: window.location.origin, + isCheckout + }; + window.parent.postMessage(message3, "*"); + } + if (e2.type === EventType.FullSnapshot) { + lastFullSnapshotEvent = e2; + incrementalSnapshotCount = 0; + } else if (e2.type === EventType.IncrementalSnapshot) { + if (e2.data.source === IncrementalSource.Mutation && e2.data.isAttachIframe) { + return; + } + incrementalSnapshotCount++; + const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth; + const exceedTime = checkoutEveryNms && lastFullSnapshotEvent && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms; + if (exceedCount || exceedTime) { + takeFullSnapshot2(true); + } + } + }, "wrappedEmit"); + const wrappedMutationEmit = /* @__PURE__ */ __name((m2) => { + wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.Mutation, + ...m2 + } + }); + }, "wrappedMutationEmit"); + const wrappedScrollEmit = /* @__PURE__ */ __name((p2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.Scroll, + ...p2 + } + }), "wrappedScrollEmit"); + const wrappedCanvasMutationEmit = /* @__PURE__ */ __name((p2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.CanvasMutation, + ...p2 + } + }), "wrappedCanvasMutationEmit"); + const wrappedAdoptedStyleSheetEmit = /* @__PURE__ */ __name((a2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.AdoptedStyleSheet, + ...a2 + } + }), "wrappedAdoptedStyleSheetEmit"); + const stylesheetManager = new StylesheetManager({ + mutationCb: wrappedMutationEmit, + adoptedStyleSheetCb: wrappedAdoptedStyleSheetEmit + }); + const iframeManager = typeof __RRWEB_EXCLUDE_IFRAME__ === "boolean" && __RRWEB_EXCLUDE_IFRAME__ ? new IframeManagerNoop() : new IframeManager({ + mirror, + mutationCb: wrappedMutationEmit, + stylesheetManager, + recordCrossOriginIframes, + wrappedEmit + }); + for (const plugin of plugins || []) { + if (plugin.getMirror) + plugin.getMirror({ + nodeMirror: mirror, + crossOriginIframeMirror: iframeManager.crossOriginIframeMirror, + crossOriginIframeStyleMirror: iframeManager.crossOriginIframeStyleMirror + }); + } + const processedNodeManager = new ProcessedNodeManager(); + const canvasManager = _getCanvasManager(getCanvasManager, { + mirror, + win: window, + mutationCb: /* @__PURE__ */ __name((p2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.CanvasMutation, + ...p2 + } + }), "mutationCb"), + recordCanvas, + blockClass, + blockSelector, + unblockSelector, + maxCanvasSize, + sampling: sampling["canvas"], + dataURLOptions, + errorHandler: errorHandler2 + }); + const shadowDomManager = typeof __RRWEB_EXCLUDE_SHADOW_DOM__ === "boolean" && __RRWEB_EXCLUDE_SHADOW_DOM__ ? new ShadowDomManagerNoop() : new ShadowDomManager({ + mutationCb: wrappedMutationEmit, + scrollCb: wrappedScrollEmit, + bypassOptions: { + onMutation, + blockClass, + blockSelector, + unblockSelector, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + inlineStylesheet, + maskInputOptions, + dataURLOptions, + maskAttributeFn, + maskTextFn, + maskInputFn, + recordCanvas, + inlineImages, + sampling, + slimDOMOptions, + iframeManager, + stylesheetManager, + canvasManager, + keepIframeSrcFn, + processedNodeManager + }, + mirror + }); + const takeFullSnapshot2 = /* @__PURE__ */ __name((isCheckout = false) => { + if (!recordDOM) { + return; + } + wrappedEmit({ + type: EventType.Meta, + data: { + href: window.location.href, + width: getWindowWidth(), + height: getWindowHeight() + } + }, isCheckout); + stylesheetManager.reset(); + shadowDomManager.init(); + mutationBuffers.forEach((buf) => buf.lock()); + const node3 = snapshot(document, { + mirror, + blockClass, + blockSelector, + unblockSelector, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + inlineStylesheet, + maskAllInputs: maskInputOptions, + maskAttributeFn, + maskInputFn, + maskTextFn, + slimDOM: slimDOMOptions, + dataURLOptions, + recordCanvas, + inlineImages, + onSerialize: /* @__PURE__ */ __name((n2) => { + if (isSerializedIframe(n2, mirror)) { + iframeManager.addIframe(n2); + } + if (isSerializedStylesheet(n2, mirror)) { + stylesheetManager.trackLinkElement(n2); + } + if (hasShadowRoot(n2)) { + shadowDomManager.addShadowRoot(n2.shadowRoot, document); + } + }, "onSerialize"), + onIframeLoad: /* @__PURE__ */ __name((iframe, childSn) => { + iframeManager.attachIframe(iframe, childSn); + if (iframe.contentWindow) { + canvasManager.addWindow(iframe.contentWindow); + } + shadowDomManager.observeAttachShadow(iframe); + }, "onIframeLoad"), + onStylesheetLoad: /* @__PURE__ */ __name((linkEl, childSn) => { + stylesheetManager.attachLinkElement(linkEl, childSn); + }, "onStylesheetLoad"), + keepIframeSrcFn + }); + if (!node3) { + return console.warn("Failed to snapshot the document"); + } + wrappedEmit({ + type: EventType.FullSnapshot, + data: { + node: node3, + initialOffset: getWindowScroll(window) + } + }); + mutationBuffers.forEach((buf) => buf.unlock()); + if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0) + stylesheetManager.adoptStyleSheets(document.adoptedStyleSheets, mirror.getId(document)); + }, "takeFullSnapshot"); + _takeFullSnapshot = takeFullSnapshot2; + try { + const handlers2 = []; + const observe2 = /* @__PURE__ */ __name((doc2) => { + return callbackWrapper$1(initObservers)({ + onMutation, + mutationCb: wrappedMutationEmit, + mousemoveCb: /* @__PURE__ */ __name((positions, source) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source, + positions + } + }), "mousemoveCb"), + mouseInteractionCb: /* @__PURE__ */ __name((d2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.MouseInteraction, + ...d2 + } + }), "mouseInteractionCb"), + scrollCb: wrappedScrollEmit, + viewportResizeCb: /* @__PURE__ */ __name((d2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.ViewportResize, + ...d2 + } + }), "viewportResizeCb"), + inputCb: /* @__PURE__ */ __name((v2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.Input, + ...v2 + } + }), "inputCb"), + mediaInteractionCb: /* @__PURE__ */ __name((p2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.MediaInteraction, + ...p2 + } + }), "mediaInteractionCb"), + styleSheetRuleCb: /* @__PURE__ */ __name((r2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.StyleSheetRule, + ...r2 + } + }), "styleSheetRuleCb"), + styleDeclarationCb: /* @__PURE__ */ __name((r2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.StyleDeclaration, + ...r2 + } + }), "styleDeclarationCb"), + canvasMutationCb: wrappedCanvasMutationEmit, + fontCb: /* @__PURE__ */ __name((p2) => wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.Font, + ...p2 + } + }), "fontCb"), + selectionCb: /* @__PURE__ */ __name((p2) => { + wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.Selection, + ...p2 + } + }); + }, "selectionCb"), + customElementCb: /* @__PURE__ */ __name((c2) => { + wrappedEmit({ + type: EventType.IncrementalSnapshot, + data: { + source: IncrementalSource.CustomElement, + ...c2 + } + }); + }, "customElementCb"), + blockClass, + ignoreClass, + ignoreSelector, + maskAllText, + maskTextClass, + unmaskTextClass, + maskTextSelector, + unmaskTextSelector, + maskInputOptions, + inlineStylesheet, + sampling, + recordDOM, + recordCanvas, + inlineImages, + userTriggeredOnInput, + collectFonts, + doc: doc2, + maskAttributeFn, + maskInputFn, + maskTextFn, + keepIframeSrcFn, + blockSelector, + unblockSelector, + slimDOMOptions, + dataURLOptions, + mirror, + iframeManager, + stylesheetManager, + shadowDomManager, + processedNodeManager, + canvasManager, + ignoreCSSAttributes, + plugins: _optionalChain([ + plugins, + "optionalAccess", + (_8) => _8.filter, + "call", + (_9) => _9((p2) => p2.observer), + "optionalAccess", + (_10) => _10.map, + "call", + (_11) => _11((p2) => ({ + observer: p2.observer, + options: p2.options, + callback: /* @__PURE__ */ __name((payload) => wrappedEmit({ + type: EventType.Plugin, + data: { + plugin: p2.name, + payload + } + }), "callback") + })) + ]) || [] + }, {}); + }, "observe"); + iframeManager.addLoadListener((iframeEl) => { + try { + handlers2.push(observe2(iframeEl.contentDocument)); + } catch (error2) { + console.warn(error2); + } + }); + const init3 = /* @__PURE__ */ __name(() => { + takeFullSnapshot2(); + handlers2.push(observe2(document)); + }, "init"); + if (document.readyState === "interactive" || document.readyState === "complete") { + init3(); + } else { + handlers2.push(on("DOMContentLoaded", () => { + wrappedEmit({ + type: EventType.DomContentLoaded, + data: {} + }); + if (recordAfter === "DOMContentLoaded") + init3(); + })); + handlers2.push(on("load", () => { + wrappedEmit({ + type: EventType.Load, + data: {} + }); + if (recordAfter === "load") + init3(); + }, window)); + } + return () => { + handlers2.forEach((h2) => h2()); + processedNodeManager.destroy(); + _takeFullSnapshot = void 0; + unregisterErrorHandler(); + }; + } catch (error2) { + console.warn(error2); + } +} +__name(record, "record"); +function takeFullSnapshot(isCheckout) { + if (!_takeFullSnapshot) { + throw new Error("please take full snapshot after start recording"); + } + _takeFullSnapshot(isCheckout); +} +__name(takeFullSnapshot, "takeFullSnapshot"); +record.mirror = mirror; +record.takeFullSnapshot = takeFullSnapshot; +function _getCanvasManager(getCanvasManagerFn, options4) { + try { + return getCanvasManagerFn ? getCanvasManagerFn(options4) : new CanvasManagerNoop(); + } catch (e2) { + console.warn("Unable to initialize CanvasManager"); + return new CanvasManagerNoop(); + } +} +__name(_getCanvasManager, "_getCanvasManager"); +const ReplayEventTypeIncrementalSnapshot = 3; +const ReplayEventTypeCustom = 5; +function timestampToMs(timestamp2) { + const isMs = timestamp2 > 9999999999; + return isMs ? timestamp2 : timestamp2 * 1e3; +} +__name(timestampToMs, "timestampToMs"); +function timestampToS(timestamp2) { + const isMs = timestamp2 > 9999999999; + return isMs ? timestamp2 / 1e3 : timestamp2; +} +__name(timestampToS, "timestampToS"); +function addBreadcrumbEvent(replay, breadcrumb) { + if (breadcrumb.category === "sentry.transaction") { + return; + } + if (["ui.click", "ui.input"].includes(breadcrumb.category)) { + replay.triggerUserActivity(); + } else { + replay.checkAndHandleExpiredSession(); + } + replay.addUpdate(() => { + replay.throttledAddEvent({ + type: EventType.Custom, + // TODO: We were converting from ms to seconds for breadcrumbs, spans, + // but maybe we should just keep them as milliseconds + timestamp: (breadcrumb.timestamp || 0) * 1e3, + data: { + tag: "breadcrumb", + // normalize to max. 10 depth and 1_000 properties per object + payload: normalize$2(breadcrumb, 10, 1e3) + } + }); + return breadcrumb.category === "console"; + }); +} +__name(addBreadcrumbEvent, "addBreadcrumbEvent"); +const INTERACTIVE_SELECTOR = "button,a"; +function getClosestInteractive(element) { + const closestInteractive = element.closest(INTERACTIVE_SELECTOR); + return closestInteractive || element; +} +__name(getClosestInteractive, "getClosestInteractive"); +function getClickTargetNode(event) { + const target = getTargetNode(event); + if (!target || !(target instanceof Element)) { + return target; + } + return getClosestInteractive(target); +} +__name(getClickTargetNode, "getClickTargetNode"); +function getTargetNode(event) { + if (isEventWithTarget(event)) { + return event.target; + } + return event; +} +__name(getTargetNode, "getTargetNode"); +function isEventWithTarget(event) { + return typeof event === "object" && !!event && "target" in event; +} +__name(isEventWithTarget, "isEventWithTarget"); +let handlers$2; +function onWindowOpen(cb) { + if (!handlers$2) { + handlers$2 = []; + monkeyPatchWindowOpen(); + } + handlers$2.push(cb); + return () => { + const pos2 = handlers$2 ? handlers$2.indexOf(cb) : -1; + if (pos2 > -1) { + handlers$2.splice(pos2, 1); + } + }; +} +__name(onWindowOpen, "onWindowOpen"); +function monkeyPatchWindowOpen() { + fill(WINDOW$1, "open", function(originalWindowOpen) { + return function(...args) { + if (handlers$2) { + try { + handlers$2.forEach((handler6) => handler6()); + } catch (e2) { + } + } + return originalWindowOpen.apply(WINDOW$1, args); + }; + }); +} +__name(monkeyPatchWindowOpen, "monkeyPatchWindowOpen"); +const IncrementalMutationSources = /* @__PURE__ */ new Set([ + IncrementalSource.Mutation, + IncrementalSource.StyleSheetRule, + IncrementalSource.StyleDeclaration, + IncrementalSource.AdoptedStyleSheet, + IncrementalSource.CanvasMutation, + IncrementalSource.Selection, + IncrementalSource.MediaInteraction +]); +function handleClick$1(clickDetector, clickBreadcrumb, node3) { + clickDetector.handleClick(clickBreadcrumb, node3); +} +__name(handleClick$1, "handleClick$1"); +class ClickDetector { + static { + __name(this, "ClickDetector"); + } + // protected for testing + constructor(replay, slowClickConfig, _addBreadcrumbEvent = addBreadcrumbEvent) { + this._lastMutation = 0; + this._lastScroll = 0; + this._clicks = []; + this._timeout = slowClickConfig.timeout / 1e3; + this._threshold = slowClickConfig.threshold / 1e3; + this._scrollTimeout = slowClickConfig.scrollTimeout / 1e3; + this._replay = replay; + this._ignoreSelector = slowClickConfig.ignoreSelector; + this._addBreadcrumbEvent = _addBreadcrumbEvent; + } + /** Register click detection handlers on mutation or scroll. */ + addListeners() { + const cleanupWindowOpen = onWindowOpen(() => { + this._lastMutation = nowInSeconds(); + }); + this._teardown = () => { + cleanupWindowOpen(); + this._clicks = []; + this._lastMutation = 0; + this._lastScroll = 0; + }; + } + /** Clean up listeners. */ + removeListeners() { + if (this._teardown) { + this._teardown(); + } + if (this._checkClickTimeout) { + clearTimeout(this._checkClickTimeout); + } + } + /** @inheritDoc */ + handleClick(breadcrumb, node3) { + if (ignoreElement(node3, this._ignoreSelector) || !isClickBreadcrumb(breadcrumb)) { + return; + } + const newClick = { + timestamp: timestampToS(breadcrumb.timestamp), + clickBreadcrumb: breadcrumb, + // Set this to 0 so we know it originates from the click breadcrumb + clickCount: 0, + node: node3 + }; + if (this._clicks.some((click2) => click2.node === newClick.node && Math.abs(click2.timestamp - newClick.timestamp) < 1)) { + return; + } + this._clicks.push(newClick); + if (this._clicks.length === 1) { + this._scheduleCheckClicks(); + } + } + /** @inheritDoc */ + registerMutation(timestamp2 = Date.now()) { + this._lastMutation = timestampToS(timestamp2); + } + /** @inheritDoc */ + registerScroll(timestamp2 = Date.now()) { + this._lastScroll = timestampToS(timestamp2); + } + /** @inheritDoc */ + registerClick(element) { + const node3 = getClosestInteractive(element); + this._handleMultiClick(node3); + } + /** Count multiple clicks on elements. */ + _handleMultiClick(node3) { + this._getClicks(node3).forEach((click2) => { + click2.clickCount++; + }); + } + /** Get all pending clicks for a given node. */ + _getClicks(node3) { + return this._clicks.filter((click2) => click2.node === node3); + } + /** Check the clicks that happened. */ + _checkClicks() { + const timedOutClicks = []; + const now2 = nowInSeconds(); + this._clicks.forEach((click2) => { + if (!click2.mutationAfter && this._lastMutation) { + click2.mutationAfter = click2.timestamp <= this._lastMutation ? this._lastMutation - click2.timestamp : void 0; + } + if (!click2.scrollAfter && this._lastScroll) { + click2.scrollAfter = click2.timestamp <= this._lastScroll ? this._lastScroll - click2.timestamp : void 0; + } + if (click2.timestamp + this._timeout <= now2) { + timedOutClicks.push(click2); + } + }); + for (const click2 of timedOutClicks) { + const pos2 = this._clicks.indexOf(click2); + if (pos2 > -1) { + this._generateBreadcrumbs(click2); + this._clicks.splice(pos2, 1); + } + } + if (this._clicks.length) { + this._scheduleCheckClicks(); + } + } + /** Generate matching breadcrumb(s) for the click. */ + _generateBreadcrumbs(click2) { + const replay = this._replay; + const hadScroll = click2.scrollAfter && click2.scrollAfter <= this._scrollTimeout; + const hadMutation = click2.mutationAfter && click2.mutationAfter <= this._threshold; + const isSlowClick = !hadScroll && !hadMutation; + const { clickCount, clickBreadcrumb } = click2; + if (isSlowClick) { + const timeAfterClickMs = Math.min(click2.mutationAfter || this._timeout, this._timeout) * 1e3; + const endReason = timeAfterClickMs < this._timeout * 1e3 ? "mutation" : "timeout"; + const breadcrumb = { + type: "default", + message: clickBreadcrumb.message, + timestamp: clickBreadcrumb.timestamp, + category: "ui.slowClickDetected", + data: { + ...clickBreadcrumb.data, + url: WINDOW$1.location.href, + route: replay.getCurrentRoute(), + timeAfterClickMs, + endReason, + // If clickCount === 0, it means multiClick was not correctly captured here + // - we still want to send 1 in this case + clickCount: clickCount || 1 + } + }; + this._addBreadcrumbEvent(replay, breadcrumb); + return; + } + if (clickCount > 1) { + const breadcrumb = { + type: "default", + message: clickBreadcrumb.message, + timestamp: clickBreadcrumb.timestamp, + category: "ui.multiClick", + data: { + ...clickBreadcrumb.data, + url: WINDOW$1.location.href, + route: replay.getCurrentRoute(), + clickCount, + metric: true + } + }; + this._addBreadcrumbEvent(replay, breadcrumb); + } + } + /** Schedule to check current clicks. */ + _scheduleCheckClicks() { + if (this._checkClickTimeout) { + clearTimeout(this._checkClickTimeout); + } + this._checkClickTimeout = setTimeout$3(() => this._checkClicks(), 1e3); + } +} +const SLOW_CLICK_TAGS = ["A", "BUTTON", "INPUT"]; +function ignoreElement(node3, ignoreSelector) { + if (!SLOW_CLICK_TAGS.includes(node3.tagName)) { + return true; + } + if (node3.tagName === "INPUT" && !["submit", "button"].includes(node3.getAttribute("type") || "")) { + return true; + } + if (node3.tagName === "A" && (node3.hasAttribute("download") || node3.hasAttribute("target") && node3.getAttribute("target") !== "_self")) { + return true; + } + if (ignoreSelector && node3.matches(ignoreSelector)) { + return true; + } + return false; +} +__name(ignoreElement, "ignoreElement"); +function isClickBreadcrumb(breadcrumb) { + return !!(breadcrumb.data && typeof breadcrumb.data.nodeId === "number" && breadcrumb.timestamp); +} +__name(isClickBreadcrumb, "isClickBreadcrumb"); +function nowInSeconds() { + return Date.now() / 1e3; +} +__name(nowInSeconds, "nowInSeconds"); +function updateClickDetectorForRecordingEvent(clickDetector, event) { + try { + if (!isIncrementalEvent(event)) { + return; + } + const { source } = event.data; + if (IncrementalMutationSources.has(source)) { + clickDetector.registerMutation(event.timestamp); + } + if (source === IncrementalSource.Scroll) { + clickDetector.registerScroll(event.timestamp); + } + if (isIncrementalMouseInteraction(event)) { + const { type, id: id3 } = event.data; + const node3 = record.mirror.getNode(id3); + if (node3 instanceof HTMLElement && type === MouseInteractions.Click) { + clickDetector.registerClick(node3); + } + } + } catch (e2) { + } +} +__name(updateClickDetectorForRecordingEvent, "updateClickDetectorForRecordingEvent"); +function isIncrementalEvent(event) { + return event.type === ReplayEventTypeIncrementalSnapshot; +} +__name(isIncrementalEvent, "isIncrementalEvent"); +function isIncrementalMouseInteraction(event) { + return event.data.source === IncrementalSource.MouseInteraction; +} +__name(isIncrementalMouseInteraction, "isIncrementalMouseInteraction"); +function createBreadcrumb(breadcrumb) { + return { + timestamp: Date.now() / 1e3, + type: "default", + ...breadcrumb + }; +} +__name(createBreadcrumb, "createBreadcrumb"); +var NodeType$4; +(function(NodeType3) { + NodeType3[NodeType3["Document"] = 0] = "Document"; + NodeType3[NodeType3["DocumentType"] = 1] = "DocumentType"; + NodeType3[NodeType3["Element"] = 2] = "Element"; + NodeType3[NodeType3["Text"] = 3] = "Text"; + NodeType3[NodeType3["CDATA"] = 4] = "CDATA"; + NodeType3[NodeType3["Comment"] = 5] = "Comment"; +})(NodeType$4 || (NodeType$4 = {})); +const ATTRIBUTES_TO_RECORD = /* @__PURE__ */ new Set([ + "id", + "class", + "aria-label", + "role", + "name", + "alt", + "title", + "data-test-id", + "data-testid", + "disabled", + "aria-disabled", + "data-sentry-component" +]); +function getAttributesToRecord(attributes) { + const obj = {}; + if (!attributes["data-sentry-component"] && attributes["data-sentry-element"]) { + attributes["data-sentry-component"] = attributes["data-sentry-element"]; + } + for (const key in attributes) { + if (ATTRIBUTES_TO_RECORD.has(key)) { + let normalizedKey = key; + if (key === "data-testid" || key === "data-test-id") { + normalizedKey = "testId"; + } + obj[normalizedKey] = attributes[key]; + } + } + return obj; +} +__name(getAttributesToRecord, "getAttributesToRecord"); +const handleDomListener = /* @__PURE__ */ __name((replay) => { + return (handlerData) => { + if (!replay.isEnabled()) { + return; + } + const result = handleDom(handlerData); + if (!result) { + return; + } + const isClick = handlerData.name === "click"; + const event = isClick ? handlerData.event : void 0; + if (isClick && replay.clickDetector && event && event.target && !event.altKey && !event.metaKey && !event.ctrlKey && !event.shiftKey) { + handleClick$1( + replay.clickDetector, + result, + getClickTargetNode(handlerData.event) + ); + } + addBreadcrumbEvent(replay, result); + }; +}, "handleDomListener"); +function getBaseDomBreadcrumb(target, message3) { + const nodeId = record.mirror.getId(target); + const node3 = nodeId && record.mirror.getNode(nodeId); + const meta = node3 && record.mirror.getMeta(node3); + const element = meta && isElement$2(meta) ? meta : null; + return { + message: message3, + data: element ? { + nodeId, + node: { + id: nodeId, + tagName: element.tagName, + textContent: Array.from(element.childNodes).map((node4) => node4.type === NodeType$4.Text && node4.textContent).filter(Boolean).map((text2) => text2.trim()).join(""), + attributes: getAttributesToRecord(element.attributes) + } + } : {} + }; +} +__name(getBaseDomBreadcrumb, "getBaseDomBreadcrumb"); +function handleDom(handlerData) { + const { target, message: message3 } = getDomTarget(handlerData); + return createBreadcrumb({ + category: `ui.${handlerData.name}`, + ...getBaseDomBreadcrumb(target, message3) + }); +} +__name(handleDom, "handleDom"); +function getDomTarget(handlerData) { + const isClick = handlerData.name === "click"; + let message3; + let target = null; + try { + target = isClick ? getClickTargetNode(handlerData.event) : getTargetNode(handlerData.event); + message3 = htmlTreeAsString(target, { maxStringLength: 200 }) || ""; + } catch (e2) { + message3 = ""; + } + return { target, message: message3 }; +} +__name(getDomTarget, "getDomTarget"); +function isElement$2(node3) { + return node3.type === NodeType$4.Element; +} +__name(isElement$2, "isElement$2"); +function handleKeyboardEvent(replay, event) { + if (!replay.isEnabled()) { + return; + } + replay.updateUserActivity(); + const breadcrumb = getKeyboardBreadcrumb(event); + if (!breadcrumb) { + return; + } + addBreadcrumbEvent(replay, breadcrumb); +} +__name(handleKeyboardEvent, "handleKeyboardEvent"); +function getKeyboardBreadcrumb(event) { + const { metaKey, shiftKey, ctrlKey, altKey, key, target } = event; + if (!target || isInputElement(target) || !key) { + return null; + } + const hasModifierKey = metaKey || ctrlKey || altKey; + const isCharacterKey = key.length === 1; + if (!hasModifierKey && isCharacterKey) { + return null; + } + const message3 = htmlTreeAsString(target, { maxStringLength: 200 }) || ""; + const baseBreadcrumb = getBaseDomBreadcrumb(target, message3); + return createBreadcrumb({ + category: "ui.keyDown", + message: message3, + data: { + ...baseBreadcrumb.data, + metaKey, + shiftKey, + ctrlKey, + altKey, + key + } + }); +} +__name(getKeyboardBreadcrumb, "getKeyboardBreadcrumb"); +function isInputElement(target) { + return target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable; +} +__name(isInputElement, "isInputElement"); +const ENTRY_TYPES = { + // @ts-expect-error TODO: entry type does not fit the create* functions entry type + resource: createResourceEntry, + paint: createPaintEntry, + // @ts-expect-error TODO: entry type does not fit the create* functions entry type + navigation: createNavigationEntry +}; +function webVitalHandler(getter, replay) { + return ({ metric }) => void replay.replayPerformanceEntries.push(getter(metric)); +} +__name(webVitalHandler, "webVitalHandler"); +function createPerformanceEntries(entries) { + return entries.map(createPerformanceEntry).filter(Boolean); +} +__name(createPerformanceEntries, "createPerformanceEntries"); +function createPerformanceEntry(entry) { + const entryType = ENTRY_TYPES[entry.entryType]; + if (!entryType) { + return null; + } + return entryType(entry); +} +__name(createPerformanceEntry, "createPerformanceEntry"); +function getAbsoluteTime$1(time) { + return ((browserPerformanceTimeOrigin || WINDOW$1.performance.timeOrigin) + time) / 1e3; +} +__name(getAbsoluteTime$1, "getAbsoluteTime$1"); +function createPaintEntry(entry) { + const { duration, entryType, name: name2, startTime } = entry; + const start2 = getAbsoluteTime$1(startTime); + return { + type: entryType, + name: name2, + start: start2, + end: start2 + duration, + data: void 0 + }; +} +__name(createPaintEntry, "createPaintEntry"); +function createNavigationEntry(entry) { + const { + entryType, + name: name2, + decodedBodySize, + duration, + domComplete, + encodedBodySize, + domContentLoadedEventStart, + domContentLoadedEventEnd, + domInteractive, + loadEventStart, + loadEventEnd, + redirectCount, + startTime, + transferSize, + type + } = entry; + if (duration === 0) { + return null; + } + return { + type: `${entryType}.${type}`, + start: getAbsoluteTime$1(startTime), + end: getAbsoluteTime$1(domComplete), + name: name2, + data: { + size: transferSize, + decodedBodySize, + encodedBodySize, + duration, + domInteractive, + domContentLoadedEventStart, + domContentLoadedEventEnd, + loadEventStart, + loadEventEnd, + domComplete, + redirectCount + } + }; +} +__name(createNavigationEntry, "createNavigationEntry"); +function createResourceEntry(entry) { + const { + entryType, + initiatorType, + name: name2, + responseEnd, + startTime, + decodedBodySize, + encodedBodySize, + responseStatus, + transferSize + } = entry; + if (["fetch", "xmlhttprequest"].includes(initiatorType)) { + return null; + } + return { + type: `${entryType}.${initiatorType}`, + start: getAbsoluteTime$1(startTime), + end: getAbsoluteTime$1(responseEnd), + name: name2, + data: { + size: transferSize, + statusCode: responseStatus, + decodedBodySize, + encodedBodySize + } + }; +} +__name(createResourceEntry, "createResourceEntry"); +function getLargestContentfulPaint(metric) { + const lastEntry = metric.entries[metric.entries.length - 1]; + const node3 = lastEntry && lastEntry.element ? [lastEntry.element] : void 0; + return getWebVital(metric, "largest-contentful-paint", node3); +} +__name(getLargestContentfulPaint, "getLargestContentfulPaint"); +function isLayoutShift(entry) { + return entry.sources !== void 0; +} +__name(isLayoutShift, "isLayoutShift"); +function getCumulativeLayoutShift(metric) { + const layoutShifts = []; + const nodes = []; + for (const entry of metric.entries) { + if (isLayoutShift(entry)) { + const nodeIds = []; + for (const source of entry.sources) { + if (source.node) { + nodes.push(source.node); + const nodeId = record.mirror.getId(source.node); + if (nodeId) { + nodeIds.push(nodeId); + } + } + } + layoutShifts.push({ value: entry.value, nodeIds: nodeIds.length ? nodeIds : void 0 }); + } + } + return getWebVital(metric, "cumulative-layout-shift", nodes, layoutShifts); +} +__name(getCumulativeLayoutShift, "getCumulativeLayoutShift"); +function getFirstInputDelay(metric) { + const lastEntry = metric.entries[metric.entries.length - 1]; + const node3 = lastEntry && lastEntry.target ? [lastEntry.target] : void 0; + return getWebVital(metric, "first-input-delay", node3); +} +__name(getFirstInputDelay, "getFirstInputDelay"); +function getInteractionToNextPaint(metric) { + const lastEntry = metric.entries[metric.entries.length - 1]; + const node3 = lastEntry && lastEntry.target ? [lastEntry.target] : void 0; + return getWebVital(metric, "interaction-to-next-paint", node3); +} +__name(getInteractionToNextPaint, "getInteractionToNextPaint"); +function getWebVital(metric, name2, nodes, attributions) { + const value4 = metric.value; + const rating = metric.rating; + const end = getAbsoluteTime$1(value4); + return { + type: "web-vital", + name: name2, + start: end, + end, + data: { + value: value4, + size: value4, + rating, + nodeIds: nodes ? nodes.map((node3) => record.mirror.getId(node3)) : void 0, + attributions + } + }; +} +__name(getWebVital, "getWebVital"); +function setupPerformanceObserver(replay) { + function addPerformanceEntry(entry) { + if (!replay.performanceEntries.includes(entry)) { + replay.performanceEntries.push(entry); + } + } + __name(addPerformanceEntry, "addPerformanceEntry"); + function onEntries({ entries }) { + entries.forEach(addPerformanceEntry); + } + __name(onEntries, "onEntries"); + const clearCallbacks = []; + ["navigation", "paint", "resource"].forEach((type) => { + clearCallbacks.push(addPerformanceInstrumentationHandler(type, onEntries)); + }); + clearCallbacks.push( + addLcpInstrumentationHandler(webVitalHandler(getLargestContentfulPaint, replay)), + addClsInstrumentationHandler(webVitalHandler(getCumulativeLayoutShift, replay)), + addFidInstrumentationHandler(webVitalHandler(getFirstInputDelay, replay)), + addInpInstrumentationHandler(webVitalHandler(getInteractionToNextPaint, replay)) + ); + return () => { + clearCallbacks.forEach((clearCallback) => clearCallback()); + }; +} +__name(setupPerformanceObserver, "setupPerformanceObserver"); +const DEBUG_BUILD$2 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +const r$3 = `var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(t,e){for(var i=new n(31),a=0;a<31;++a)i[a]=e+=1<>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,a=0,s=new n(r);a>h]=l}else for(o=new n(i),a=0;a>15-t[a]);return o},g=new t(288);for(c=0;c<144;++c)g[c]=8;for(c=144;c<256;++c)g[c]=9;for(c=256;c<280;++c)g[c]=7;for(c=280;c<288;++c)g[c]=8;var w=new t(32);for(c=0;c<32;++c)w[c]=5;var p=d(g,9,0),y=d(w,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],a=0;ad&&(d=o[a].s);var g=new n(d+1),w=A(i[c-1],g,0);if(w>e){a=0;var p=0,y=w-e,m=1<e))break;p+=m-(1<>=y;p>0;){var M=o[a].s;g[M]=0&&p;--a){var E=o[a].s;g[E]==e&&(--g[E],++p)}w=e}return{t:new t(g),l:w}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,a=t[0],s=1,o=function(t){e[i++]=t},f=1;f<=r;++f)if(t[f]==a&&f!=r)++s;else{if(!a&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(a),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(a);s=1,a=t[f]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var a=0;a4&&!H[a[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(f,g)+T(h,w)+l,X=T(f,M)+T(h,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=p,P=g,Q=y,R=w;for(B=0;B255){_(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;_(r,m,Q[et]),m+=R[et],et>3&&(_(r,m,rt>>5&8191),m+=i[et])}else _(r,m,N[rt]),m+=P[rt]}return _(r,m,N[256]),m+P[256]},C=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e>>8;t=r},d:function(){return~t}}},L=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,a=0|r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},O=function(a,s,o,f,u){if(!u&&(u={l:1},s.dictionary)){var c=s.dictionary.subarray(-32768),v=new t(c.length+a.length);v.set(c),v.set(a,c.length),a=v,u.w=c.length}return function(a,s,o,f,u,c){var v=c.z||a.length,d=new t(f+v+5*(1+Math.ceil(v/7e3))+u),g=d.subarray(f,d.length-u),w=c.l,p=7&(c.r||0);if(s){p&&(g[0]=c.r>>3);for(var y=C[s-1],M=y>>13,E=8191&y,z=(1<7e3||q>24576)&&(N>423||!w)){p=U(a,g,0,F,I,S,O,q,G,j-G,p),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(a[j+Q]==a[j+Q-W]){for(var $=0;$Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;Pnt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|h[Q]<<18|l[R];var it=31&h[Q],at=31&l[R];O+=e[it]+i[at],++I[257+it],++S[at],B=j+Q,++L}else F[q++]=a[j],++I[a[j]]}}for(j=Math.max(j,B);j=v&&(g[p/8|0]=w,st=v),p=k(g,p+1,a.subarray(j,st))}c.i=v}return b(d,0,f+m(p)+u)}(a,null==s.level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+s.mem,o,f,u)},j=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},q=function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&j(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}},B=function(t){return 10+(t.filename?t.filename.length+1:0)},G=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(O(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;a&&(this.b.set(n.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(a),32768),this.s.z=n.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n}();var H=function(){function t(t,n){this.c=L(),this.v=1,G.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),G.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=O(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=L();i.p(n.dictionary),j(t,2,i.d())}}(r,this.o),this.v=0),n&&j(r,r.length-4,this.c.d()),this.ondata(r,n)},t}(),J="undefined"!=typeof TextEncoder&&new TextEncoder,K="undefined"!=typeof TextDecoder&&new TextDecoder;try{K.decode(F,{stream:!0})}catch(t){}var N=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(P(t),this.d=n||!1)},t}();function P(n,r){if(J)return J.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),a=0,s=function(t){i[a++]=t},o=0;oi.length){var f=new t(a+8+(e-o<<1));f.set(i),i=f}var h=n.charCodeAt(o);h<128||r?s(h):h<2048?(s(192|h>>6),s(128|63&h)):h>55295&&h<57344?(s(240|(h=65536+(1047552&h)|1023&n.charCodeAt(++o))>>18),s(128|h>>12&63),s(128|h>>6&63),s(128|63&h)):(s(224|h>>12),s(128|h>>6&63),s(128|63&h))}return b(i,0,a)}function Q(t){return function(t,n){n||(n={});var r=S(),e=t.length;r.p(t);var i=O(t,n,B(n),8),a=i.length;return q(i,n),j(i,a-8,r.d()),j(i,a-4,e),i}(P(t))}const R=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(const r of t)n+=r.length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n{this._deflatedData.push(t)},this.stream=new N(((t,n)=>{this.deflate.push(t,n)})),this.stream.push("[")}},V={clear:()=>{R.clear()},addEvent:t=>R.addEvent(t),finish:()=>R.finish(),compress:t=>Q(t)};addEventListener("message",(function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in V&&"function"==typeof V[n])try{const t=V[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});`; +function e$1() { + const e2 = new Blob([r$3]); + return URL.createObjectURL(e2); +} +__name(e$1, "e$1"); +const CONSOLE_LEVELS = ["info", "warn", "error", "log"]; +const PREFIX$1 = "[Replay] "; +function _addBreadcrumb(message3, level = "info") { + addBreadcrumb( + { + category: "console", + data: { + logger: "replay" + }, + level, + message: `${PREFIX$1}${message3}` + }, + { level } + ); +} +__name(_addBreadcrumb, "_addBreadcrumb"); +function makeReplayLogger() { + let _capture = false; + let _trace = false; + const _logger = { + exception: /* @__PURE__ */ __name(() => void 0, "exception"), + infoTick: /* @__PURE__ */ __name(() => void 0, "infoTick"), + setConfig: /* @__PURE__ */ __name((opts) => { + _capture = opts.captureExceptions; + _trace = opts.traceInternals; + }, "setConfig") + }; + if (DEBUG_BUILD$2) { + CONSOLE_LEVELS.forEach((name2) => { + _logger[name2] = (...args) => { + logger$2[name2](PREFIX$1, ...args); + if (_trace) { + _addBreadcrumb(args.join(""), severityLevelFromString(name2)); + } + }; + }); + _logger.exception = (error2, ...message3) => { + if (message3.length && _logger.error) { + _logger.error(...message3); + } + logger$2.error(PREFIX$1, error2); + if (_capture) { + captureException(error2); + } else if (_trace) { + _addBreadcrumb(error2, "error"); + } + }; + _logger.infoTick = (...args) => { + logger$2.info(PREFIX$1, ...args); + if (_trace) { + setTimeout(() => _addBreadcrumb(args[0]), 0); + } + }; + } else { + CONSOLE_LEVELS.forEach((name2) => { + _logger[name2] = () => void 0; + }); + } + return _logger; +} +__name(makeReplayLogger, "makeReplayLogger"); +const logger$1 = makeReplayLogger(); +class EventBufferSizeExceededError extends Error { + static { + __name(this, "EventBufferSizeExceededError"); + } + constructor() { + super(`Event buffer exceeded maximum size of ${REPLAY_MAX_EVENT_BUFFER_SIZE}.`); + } +} +class EventBufferArray { + static { + __name(this, "EventBufferArray"); + } + /** All the events that are buffered to be sent. */ + /** @inheritdoc */ + /** @inheritdoc */ + constructor() { + this.events = []; + this._totalSize = 0; + this.hasCheckout = false; + this.waitForCheckout = false; + } + /** @inheritdoc */ + get hasEvents() { + return this.events.length > 0; + } + /** @inheritdoc */ + get type() { + return "sync"; + } + /** @inheritdoc */ + destroy() { + this.events = []; + } + /** @inheritdoc */ + async addEvent(event) { + const eventSize = JSON.stringify(event).length; + this._totalSize += eventSize; + if (this._totalSize > REPLAY_MAX_EVENT_BUFFER_SIZE) { + throw new EventBufferSizeExceededError(); + } + this.events.push(event); + } + /** @inheritdoc */ + finish() { + return new Promise((resolve2) => { + const eventsRet = this.events; + this.clear(); + resolve2(JSON.stringify(eventsRet)); + }); + } + /** @inheritdoc */ + clear() { + this.events = []; + this._totalSize = 0; + this.hasCheckout = false; + } + /** @inheritdoc */ + getEarliestTimestamp() { + const timestamp2 = this.events.map((event) => event.timestamp).sort()[0]; + if (!timestamp2) { + return null; + } + return timestampToMs(timestamp2); + } +} +class WorkerHandler { + static { + __name(this, "WorkerHandler"); + } + constructor(worker) { + this._worker = worker; + this._id = 0; + } + /** + * Ensure the worker is ready (or not). + * This will either resolve when the worker is ready, or reject if an error occurred. + */ + ensureReady() { + if (this._ensureReadyPromise) { + return this._ensureReadyPromise; + } + this._ensureReadyPromise = new Promise((resolve2, reject3) => { + this._worker.addEventListener( + "message", + ({ data: data25 }) => { + if (data25.success) { + resolve2(); + } else { + reject3(); + } + }, + { once: true } + ); + this._worker.addEventListener( + "error", + (error2) => { + reject3(error2); + }, + { once: true } + ); + }); + return this._ensureReadyPromise; + } + /** + * Destroy the worker. + */ + destroy() { + DEBUG_BUILD$2 && logger$1.info("Destroying compression worker"); + this._worker.terminate(); + } + /** + * Post message to worker and wait for response before resolving promise. + */ + postMessage(method, arg) { + const id3 = this._getAndIncrementId(); + return new Promise((resolve2, reject3) => { + const listener = /* @__PURE__ */ __name(({ data: data25 }) => { + const response = data25; + if (response.method !== method) { + return; + } + if (response.id !== id3) { + return; + } + this._worker.removeEventListener("message", listener); + if (!response.success) { + DEBUG_BUILD$2 && logger$1.error("Error in compression worker: ", response.response); + reject3(new Error("Error in compression worker")); + return; + } + resolve2(response.response); + }, "listener"); + this._worker.addEventListener("message", listener); + this._worker.postMessage({ id: id3, method, arg }); + }); + } + /** Get the current ID and increment it for the next call. */ + _getAndIncrementId() { + return this._id++; + } +} +class EventBufferCompressionWorker { + static { + __name(this, "EventBufferCompressionWorker"); + } + /** @inheritdoc */ + /** @inheritdoc */ + constructor(worker) { + this._worker = new WorkerHandler(worker); + this._earliestTimestamp = null; + this._totalSize = 0; + this.hasCheckout = false; + this.waitForCheckout = false; + } + /** @inheritdoc */ + get hasEvents() { + return !!this._earliestTimestamp; + } + /** @inheritdoc */ + get type() { + return "worker"; + } + /** + * Ensure the worker is ready (or not). + * This will either resolve when the worker is ready, or reject if an error occurred. + */ + ensureReady() { + return this._worker.ensureReady(); + } + /** + * Destroy the event buffer. + */ + destroy() { + this._worker.destroy(); + } + /** + * Add an event to the event buffer. + * + * Returns true if event was successfully received and processed by worker. + */ + addEvent(event) { + const timestamp2 = timestampToMs(event.timestamp); + if (!this._earliestTimestamp || timestamp2 < this._earliestTimestamp) { + this._earliestTimestamp = timestamp2; + } + const data25 = JSON.stringify(event); + this._totalSize += data25.length; + if (this._totalSize > REPLAY_MAX_EVENT_BUFFER_SIZE) { + return Promise.reject(new EventBufferSizeExceededError()); + } + return this._sendEventToWorker(data25); + } + /** + * Finish the event buffer and return the compressed data. + */ + finish() { + return this._finishRequest(); + } + /** @inheritdoc */ + clear() { + this._earliestTimestamp = null; + this._totalSize = 0; + this.hasCheckout = false; + this._worker.postMessage("clear").then(null, (e2) => { + DEBUG_BUILD$2 && logger$1.exception(e2, 'Sending "clear" message to worker failed', e2); + }); + } + /** @inheritdoc */ + getEarliestTimestamp() { + return this._earliestTimestamp; + } + /** + * Send the event to the worker. + */ + _sendEventToWorker(data25) { + return this._worker.postMessage("addEvent", data25); + } + /** + * Finish the request and return the compressed data from the worker. + */ + async _finishRequest() { + const response = await this._worker.postMessage("finish"); + this._earliestTimestamp = null; + this._totalSize = 0; + return response; + } +} +class EventBufferProxy { + static { + __name(this, "EventBufferProxy"); + } + constructor(worker) { + this._fallback = new EventBufferArray(); + this._compression = new EventBufferCompressionWorker(worker); + this._used = this._fallback; + this._ensureWorkerIsLoadedPromise = this._ensureWorkerIsLoaded(); + } + /** @inheritdoc */ + get waitForCheckout() { + return this._used.waitForCheckout; + } + /** @inheritdoc */ + get type() { + return this._used.type; + } + /** @inheritDoc */ + get hasEvents() { + return this._used.hasEvents; + } + /** @inheritdoc */ + get hasCheckout() { + return this._used.hasCheckout; + } + /** @inheritdoc */ + set hasCheckout(value4) { + this._used.hasCheckout = value4; + } + /** @inheritdoc */ + // eslint-disable-next-line @typescript-eslint/adjacent-overload-signatures + set waitForCheckout(value4) { + this._used.waitForCheckout = value4; + } + /** @inheritDoc */ + destroy() { + this._fallback.destroy(); + this._compression.destroy(); + } + /** @inheritdoc */ + clear() { + return this._used.clear(); + } + /** @inheritdoc */ + getEarliestTimestamp() { + return this._used.getEarliestTimestamp(); + } + /** + * Add an event to the event buffer. + * + * Returns true if event was successfully added. + */ + addEvent(event) { + return this._used.addEvent(event); + } + /** @inheritDoc */ + async finish() { + await this.ensureWorkerIsLoaded(); + return this._used.finish(); + } + /** Ensure the worker has loaded. */ + ensureWorkerIsLoaded() { + return this._ensureWorkerIsLoadedPromise; + } + /** Actually check if the worker has been loaded. */ + async _ensureWorkerIsLoaded() { + try { + await this._compression.ensureReady(); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to load the compression worker, falling back to simple buffer"); + return; + } + await this._switchToCompressionWorker(); + } + /** Switch the used buffer to the compression worker. */ + async _switchToCompressionWorker() { + const { events: events2, hasCheckout, waitForCheckout } = this._fallback; + const addEventPromises = []; + for (const event of events2) { + addEventPromises.push(this._compression.addEvent(event)); + } + this._compression.hasCheckout = hasCheckout; + this._compression.waitForCheckout = waitForCheckout; + this._used = this._compression; + try { + await Promise.all(addEventPromises); + this._fallback.clear(); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to add events when switching buffers."); + } + } +} +function createEventBuffer({ + useCompression, + workerUrl: customWorkerUrl +}) { + if (useCompression && // eslint-disable-next-line no-restricted-globals + window.Worker) { + const worker = _loadWorker(customWorkerUrl); + if (worker) { + return worker; + } + } + DEBUG_BUILD$2 && logger$1.info("Using simple buffer"); + return new EventBufferArray(); +} +__name(createEventBuffer, "createEventBuffer"); +function _loadWorker(customWorkerUrl) { + try { + const workerUrl = customWorkerUrl || _getWorkerUrl(); + if (!workerUrl) { + return; + } + DEBUG_BUILD$2 && logger$1.info(`Using compression worker${customWorkerUrl ? ` from ${customWorkerUrl}` : ""}`); + const worker = new Worker(workerUrl); + return new EventBufferProxy(worker); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to create compression worker"); + } +} +__name(_loadWorker, "_loadWorker"); +function _getWorkerUrl() { + if (typeof __SENTRY_EXCLUDE_REPLAY_WORKER__ === "undefined" || !__SENTRY_EXCLUDE_REPLAY_WORKER__) { + return e$1(); + } + return ""; +} +__name(_getWorkerUrl, "_getWorkerUrl"); +function hasSessionStorage() { + try { + return "sessionStorage" in WINDOW$1 && !!WINDOW$1.sessionStorage; + } catch (e2) { + return false; + } +} +__name(hasSessionStorage, "hasSessionStorage"); +function clearSession(replay) { + deleteSession(); + replay.session = void 0; +} +__name(clearSession, "clearSession"); +function deleteSession() { + if (!hasSessionStorage()) { + return; + } + try { + WINDOW$1.sessionStorage.removeItem(REPLAY_SESSION_KEY); + } catch (e2) { + } +} +__name(deleteSession, "deleteSession"); +function isSampled(sampleRate) { + if (sampleRate === void 0) { + return false; + } + return Math.random() < sampleRate; +} +__name(isSampled, "isSampled"); +function makeSession(session) { + const now2 = Date.now(); + const id3 = session.id || uuid4(); + const started = session.started || now2; + const lastActivity = session.lastActivity || now2; + const segmentId = session.segmentId || 0; + const sampled = session.sampled; + const previousSessionId = session.previousSessionId; + return { + id: id3, + started, + lastActivity, + segmentId, + sampled, + previousSessionId + }; +} +__name(makeSession, "makeSession"); +function saveSession(session) { + if (!hasSessionStorage()) { + return; + } + try { + WINDOW$1.sessionStorage.setItem(REPLAY_SESSION_KEY, JSON.stringify(session)); + } catch (e2) { + } +} +__name(saveSession, "saveSession"); +function getSessionSampleType(sessionSampleRate, allowBuffering) { + return isSampled(sessionSampleRate) ? "session" : allowBuffering ? "buffer" : false; +} +__name(getSessionSampleType, "getSessionSampleType"); +function createSession({ sessionSampleRate, allowBuffering, stickySession = false }, { previousSessionId } = {}) { + const sampled = getSessionSampleType(sessionSampleRate, allowBuffering); + const session = makeSession({ + sampled, + previousSessionId + }); + if (stickySession) { + saveSession(session); + } + return session; +} +__name(createSession, "createSession"); +function fetchSession() { + if (!hasSessionStorage()) { + return null; + } + try { + const sessionStringFromStorage = WINDOW$1.sessionStorage.getItem(REPLAY_SESSION_KEY); + if (!sessionStringFromStorage) { + return null; + } + const sessionObj = JSON.parse(sessionStringFromStorage); + DEBUG_BUILD$2 && logger$1.infoTick("Loading existing session"); + return makeSession(sessionObj); + } catch (e2) { + return null; + } +} +__name(fetchSession, "fetchSession"); +function isExpired(initialTime, expiry, targetTime = +/* @__PURE__ */ new Date()) { + if (initialTime === null || expiry === void 0 || expiry < 0) { + return true; + } + if (expiry === 0) { + return false; + } + return initialTime + expiry <= targetTime; +} +__name(isExpired, "isExpired"); +function isSessionExpired(session, { + maxReplayDuration, + sessionIdleExpire, + targetTime = Date.now() +}) { + return ( + // First, check that maximum session length has not been exceeded + isExpired(session.started, maxReplayDuration, targetTime) || // check that the idle timeout has not been exceeded (i.e. user has + // performed an action within the last `sessionIdleExpire` ms) + isExpired(session.lastActivity, sessionIdleExpire, targetTime) + ); +} +__name(isSessionExpired, "isSessionExpired"); +function shouldRefreshSession(session, { sessionIdleExpire, maxReplayDuration }) { + if (!isSessionExpired(session, { sessionIdleExpire, maxReplayDuration })) { + return false; + } + if (session.sampled === "buffer" && session.segmentId === 0) { + return false; + } + return true; +} +__name(shouldRefreshSession, "shouldRefreshSession"); +function loadOrCreateSession({ + sessionIdleExpire, + maxReplayDuration, + previousSessionId +}, sessionOptions) { + const existingSession = sessionOptions.stickySession && fetchSession(); + if (!existingSession) { + DEBUG_BUILD$2 && logger$1.infoTick("Creating new session"); + return createSession(sessionOptions, { previousSessionId }); + } + if (!shouldRefreshSession(existingSession, { sessionIdleExpire, maxReplayDuration })) { + return existingSession; + } + DEBUG_BUILD$2 && logger$1.infoTick("Session in sessionStorage is expired, creating new one..."); + return createSession(sessionOptions, { previousSessionId: existingSession.id }); +} +__name(loadOrCreateSession, "loadOrCreateSession"); +function isCustomEvent(event) { + return event.type === EventType.Custom; +} +__name(isCustomEvent, "isCustomEvent"); +function addEventSync(replay, event, isCheckout) { + if (!shouldAddEvent(replay, event)) { + return false; + } + _addEvent(replay, event, isCheckout); + return true; +} +__name(addEventSync, "addEventSync"); +function addEvent(replay, event, isCheckout) { + if (!shouldAddEvent(replay, event)) { + return Promise.resolve(null); + } + return _addEvent(replay, event, isCheckout); +} +__name(addEvent, "addEvent"); +async function _addEvent(replay, event, isCheckout) { + const { eventBuffer } = replay; + if (!eventBuffer || eventBuffer.waitForCheckout && !isCheckout) { + return null; + } + const isBufferMode = replay.recordingMode === "buffer"; + try { + if (isCheckout && isBufferMode) { + eventBuffer.clear(); + } + if (isCheckout) { + eventBuffer.hasCheckout = true; + eventBuffer.waitForCheckout = false; + } + const replayOptions = replay.getOptions(); + const eventAfterPossibleCallback = maybeApplyCallback(event, replayOptions.beforeAddRecordingEvent); + if (!eventAfterPossibleCallback) { + return; + } + return await eventBuffer.addEvent(eventAfterPossibleCallback); + } catch (error2) { + const isExceeded = error2 && error2 instanceof EventBufferSizeExceededError; + const reason = isExceeded ? "addEventSizeExceeded" : "addEvent"; + if (isExceeded && isBufferMode) { + eventBuffer.clear(); + eventBuffer.waitForCheckout = true; + return null; + } + replay.handleException(error2); + await replay.stop({ reason }); + const client = getClient(); + if (client) { + client.recordDroppedEvent("internal_sdk_error", "replay"); + } + } +} +__name(_addEvent, "_addEvent"); +function shouldAddEvent(replay, event) { + if (!replay.eventBuffer || replay.isPaused() || !replay.isEnabled()) { + return false; + } + const timestampInMs = timestampToMs(event.timestamp); + if (timestampInMs + replay.timeouts.sessionIdlePause < Date.now()) { + return false; + } + if (timestampInMs > replay.getContext().initialTimestamp + replay.getOptions().maxReplayDuration) { + DEBUG_BUILD$2 && logger$1.infoTick(`Skipping event with timestamp ${timestampInMs} because it is after maxReplayDuration`); + return false; + } + return true; +} +__name(shouldAddEvent, "shouldAddEvent"); +function maybeApplyCallback(event, callback) { + try { + if (typeof callback === "function" && isCustomEvent(event)) { + return callback(event); + } + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."); + return null; + } + return event; +} +__name(maybeApplyCallback, "maybeApplyCallback"); +function isErrorEvent(event) { + return !event.type; +} +__name(isErrorEvent, "isErrorEvent"); +function isTransactionEvent(event) { + return event.type === "transaction"; +} +__name(isTransactionEvent, "isTransactionEvent"); +function isReplayEvent(event) { + return event.type === "replay_event"; +} +__name(isReplayEvent, "isReplayEvent"); +function isFeedbackEvent(event) { + return event.type === "feedback"; +} +__name(isFeedbackEvent, "isFeedbackEvent"); +function handleAfterSendEvent(replay) { + return (event, sendResponse) => { + if (!replay.isEnabled() || !isErrorEvent(event) && !isTransactionEvent(event)) { + return; + } + const statusCode = sendResponse && sendResponse.statusCode; + if (!statusCode || statusCode < 200 || statusCode >= 300) { + return; + } + if (isTransactionEvent(event)) { + handleTransactionEvent(replay, event); + return; + } + handleErrorEvent(replay, event); + }; +} +__name(handleAfterSendEvent, "handleAfterSendEvent"); +function handleTransactionEvent(replay, event) { + const replayContext = replay.getContext(); + if (event.contexts && event.contexts.trace && event.contexts.trace.trace_id && replayContext.traceIds.size < 100) { + replayContext.traceIds.add(event.contexts.trace.trace_id); + } +} +__name(handleTransactionEvent, "handleTransactionEvent"); +function handleErrorEvent(replay, event) { + const replayContext = replay.getContext(); + if (event.event_id && replayContext.errorIds.size < 100) { + replayContext.errorIds.add(event.event_id); + } + if (replay.recordingMode !== "buffer" || !event.tags || !event.tags.replayId) { + return; + } + const { beforeErrorSampling } = replay.getOptions(); + if (typeof beforeErrorSampling === "function" && !beforeErrorSampling(event)) { + return; + } + setTimeout$3(async () => { + try { + await replay.sendBufferedReplayOrFlush(); + } catch (err) { + replay.handleException(err); + } + }); +} +__name(handleErrorEvent, "handleErrorEvent"); +function handleBeforeSendEvent(replay) { + return (event) => { + if (!replay.isEnabled() || !isErrorEvent(event)) { + return; + } + handleHydrationError(replay, event); + }; +} +__name(handleBeforeSendEvent, "handleBeforeSendEvent"); +function handleHydrationError(replay, event) { + const exceptionValue = event.exception && event.exception.values && event.exception.values[0] && event.exception.values[0].value; + if (typeof exceptionValue !== "string") { + return; + } + if ( + // Only matches errors in production builds of react-dom + // Example https://reactjs.org/docs/error-decoder.html?invariant=423 + // With newer React versions, the messages changed to a different website https://react.dev/errors/418 + exceptionValue.match( + /(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/ + ) || // Development builds of react-dom + // Error 1: Hydration failed because the initial UI does not match what was rendered on the server. + // Error 2: Text content does not match server-rendered HTML. Warning: Text content did not match. + exceptionValue.match(/(does not match server-rendered HTML|Hydration failed because)/i) + ) { + const breadcrumb = createBreadcrumb({ + category: "replay.hydrate-error", + data: { + url: getLocationHref() + } + }); + addBreadcrumbEvent(replay, breadcrumb); + } +} +__name(handleHydrationError, "handleHydrationError"); +function handleBreadcrumbs(replay) { + const client = getClient(); + if (!client) { + return; + } + client.on("beforeAddBreadcrumb", (breadcrumb) => beforeAddBreadcrumb(replay, breadcrumb)); +} +__name(handleBreadcrumbs, "handleBreadcrumbs"); +function beforeAddBreadcrumb(replay, breadcrumb) { + if (!replay.isEnabled() || !isBreadcrumbWithCategory(breadcrumb)) { + return; + } + const result = normalizeBreadcrumb(breadcrumb); + if (result) { + addBreadcrumbEvent(replay, result); + } +} +__name(beforeAddBreadcrumb, "beforeAddBreadcrumb"); +function normalizeBreadcrumb(breadcrumb) { + if (!isBreadcrumbWithCategory(breadcrumb) || [ + // fetch & xhr are handled separately,in handleNetworkBreadcrumbs + "fetch", + "xhr", + // These two are breadcrumbs for emitted sentry events, we don't care about them + "sentry.event", + "sentry.transaction" + ].includes(breadcrumb.category) || // We capture UI breadcrumbs separately + breadcrumb.category.startsWith("ui.")) { + return null; + } + if (breadcrumb.category === "console") { + return normalizeConsoleBreadcrumb(breadcrumb); + } + return createBreadcrumb(breadcrumb); +} +__name(normalizeBreadcrumb, "normalizeBreadcrumb"); +function normalizeConsoleBreadcrumb(breadcrumb) { + const args = breadcrumb.data && breadcrumb.data.arguments; + if (!Array.isArray(args) || args.length === 0) { + return createBreadcrumb(breadcrumb); + } + let isTruncated = false; + const normalizedArgs = args.map((arg) => { + if (!arg) { + return arg; + } + if (typeof arg === "string") { + if (arg.length > CONSOLE_ARG_MAX_SIZE) { + isTruncated = true; + return `${arg.slice(0, CONSOLE_ARG_MAX_SIZE)}…`; + } + return arg; + } + if (typeof arg === "object") { + try { + const normalizedArg = normalize$2(arg, 7); + const stringified = JSON.stringify(normalizedArg); + if (stringified.length > CONSOLE_ARG_MAX_SIZE) { + isTruncated = true; + return `${JSON.stringify(normalizedArg, null, 2).slice(0, CONSOLE_ARG_MAX_SIZE)}…`; + } + return normalizedArg; + } catch (e2) { + } + } + return arg; + }); + return createBreadcrumb({ + ...breadcrumb, + data: { + ...breadcrumb.data, + arguments: normalizedArgs, + ...isTruncated ? { _meta: { warnings: ["CONSOLE_ARG_TRUNCATED"] } } : {} + } + }); +} +__name(normalizeConsoleBreadcrumb, "normalizeConsoleBreadcrumb"); +function isBreadcrumbWithCategory(breadcrumb) { + return !!breadcrumb.category; +} +__name(isBreadcrumbWithCategory, "isBreadcrumbWithCategory"); +function isRrwebError(event, hint) { + if (event.type || !event.exception || !event.exception.values || !event.exception.values.length) { + return false; + } + if (hint.originalException && hint.originalException.__rrweb__) { + return true; + } + return false; +} +__name(isRrwebError, "isRrwebError"); +function resetReplayIdOnDynamicSamplingContext() { + const dsc = getCurrentScope$1().getPropagationContext().dsc; + if (dsc) { + delete dsc.replay_id; + } + const activeSpan = getActiveSpan(); + if (activeSpan) { + const dsc2 = getDynamicSamplingContextFromSpan(activeSpan); + delete dsc2.replay_id; + } +} +__name(resetReplayIdOnDynamicSamplingContext, "resetReplayIdOnDynamicSamplingContext"); +function addFeedbackBreadcrumb(replay, event) { + replay.triggerUserActivity(); + replay.addUpdate(() => { + if (!event.timestamp) { + return true; + } + replay.throttledAddEvent({ + type: EventType.Custom, + timestamp: event.timestamp * 1e3, + data: { + tag: "breadcrumb", + payload: { + timestamp: event.timestamp, + type: "default", + category: "sentry.feedback", + data: { + feedbackId: event.event_id + } + } + } + }); + return false; + }); +} +__name(addFeedbackBreadcrumb, "addFeedbackBreadcrumb"); +function shouldSampleForBufferEvent(replay, event) { + if (replay.recordingMode !== "buffer") { + return false; + } + if (event.message === UNABLE_TO_SEND_REPLAY) { + return false; + } + if (!event.exception || event.type) { + return false; + } + return isSampled(replay.getOptions().errorSampleRate); +} +__name(shouldSampleForBufferEvent, "shouldSampleForBufferEvent"); +function handleGlobalEventListener(replay) { + return Object.assign( + (event, hint) => { + if (!replay.isEnabled() || replay.isPaused()) { + return event; + } + if (isReplayEvent(event)) { + delete event.breadcrumbs; + return event; + } + if (!isErrorEvent(event) && !isTransactionEvent(event) && !isFeedbackEvent(event)) { + return event; + } + const isSessionActive = replay.checkAndHandleExpiredSession(); + if (!isSessionActive) { + resetReplayIdOnDynamicSamplingContext(); + return event; + } + if (isFeedbackEvent(event)) { + replay.flush(); + event.contexts.feedback.replay_id = replay.getSessionId(); + addFeedbackBreadcrumb(replay, event); + return event; + } + if (isRrwebError(event, hint) && !replay.getOptions()._experiments.captureExceptions) { + DEBUG_BUILD$2 && logger$1.log("Ignoring error from rrweb internals", event); + return null; + } + const isErrorEventSampled = shouldSampleForBufferEvent(replay, event); + const shouldTagReplayId = isErrorEventSampled || replay.recordingMode === "session"; + if (shouldTagReplayId) { + event.tags = { ...event.tags, replayId: replay.getSessionId() }; + } + return event; + }, + { id: "Replay" } + ); +} +__name(handleGlobalEventListener, "handleGlobalEventListener"); +function createPerformanceSpans(replay, entries) { + return entries.map(({ type, start: start2, end, name: name2, data: data25 }) => { + const response = replay.throttledAddEvent({ + type: EventType.Custom, + timestamp: start2, + data: { + tag: "performanceSpan", + payload: { + op: type, + description: name2, + startTimestamp: start2, + endTimestamp: end, + data: data25 + } + } + }); + return typeof response === "string" ? Promise.resolve(null) : response; + }); +} +__name(createPerformanceSpans, "createPerformanceSpans"); +function handleHistory(handlerData) { + const { from: from2, to } = handlerData; + const now2 = Date.now() / 1e3; + return { + type: "navigation.push", + start: now2, + end: now2, + name: to, + data: { + previous: from2 + } + }; +} +__name(handleHistory, "handleHistory"); +function handleHistorySpanListener(replay) { + return (handlerData) => { + if (!replay.isEnabled()) { + return; + } + const result = handleHistory(handlerData); + if (result === null) { + return; + } + replay.getContext().urls.push(result.name); + replay.triggerUserActivity(); + replay.addUpdate(() => { + createPerformanceSpans(replay, [result]); + return false; + }); + }; +} +__name(handleHistorySpanListener, "handleHistorySpanListener"); +function shouldFilterRequest(replay, url) { + if (DEBUG_BUILD$2 && replay.getOptions()._experiments.traceInternals) { + return false; + } + return isSentryRequestUrl(url, getClient()); +} +__name(shouldFilterRequest, "shouldFilterRequest"); +function addNetworkBreadcrumb(replay, result) { + if (!replay.isEnabled()) { + return; + } + if (result === null) { + return; + } + if (shouldFilterRequest(replay, result.name)) { + return; + } + replay.addUpdate(() => { + createPerformanceSpans(replay, [result]); + return true; + }); +} +__name(addNetworkBreadcrumb, "addNetworkBreadcrumb"); +function getBodySize(body) { + if (!body) { + return void 0; + } + const textEncoder = new TextEncoder(); + try { + if (typeof body === "string") { + return textEncoder.encode(body).length; + } + if (body instanceof URLSearchParams) { + return textEncoder.encode(body.toString()).length; + } + if (body instanceof FormData) { + const formDataStr = _serializeFormData(body); + return textEncoder.encode(formDataStr).length; + } + if (body instanceof Blob) { + return body.size; + } + if (body instanceof ArrayBuffer) { + return body.byteLength; + } + } catch (e2) { + } + return void 0; +} +__name(getBodySize, "getBodySize"); +function parseContentLengthHeader(header3) { + if (!header3) { + return void 0; + } + const size2 = parseInt(header3, 10); + return isNaN(size2) ? void 0 : size2; +} +__name(parseContentLengthHeader, "parseContentLengthHeader"); +function getBodyString(body) { + try { + if (typeof body === "string") { + return [body]; + } + if (body instanceof URLSearchParams) { + return [body.toString()]; + } + if (body instanceof FormData) { + return [_serializeFormData(body)]; + } + if (!body) { + return [void 0]; + } + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to serialize body", body); + return [void 0, "BODY_PARSE_ERROR"]; + } + DEBUG_BUILD$2 && logger$1.info("Skipping network body because of body type", body); + return [void 0, "UNPARSEABLE_BODY_TYPE"]; +} +__name(getBodyString, "getBodyString"); +function mergeWarning(info, warning) { + if (!info) { + return { + headers: {}, + size: void 0, + _meta: { + warnings: [warning] + } + }; + } + const newMeta = { ...info._meta }; + const existingWarnings = newMeta.warnings || []; + newMeta.warnings = [...existingWarnings, warning]; + info._meta = newMeta; + return info; +} +__name(mergeWarning, "mergeWarning"); +function makeNetworkReplayBreadcrumb(type, data25) { + if (!data25) { + return null; + } + const { startTimestamp, endTimestamp, url, method, statusCode, request, response } = data25; + const result = { + type, + start: startTimestamp / 1e3, + end: endTimestamp / 1e3, + name: url, + data: dropUndefinedKeys({ + method, + statusCode, + request, + response + }) + }; + return result; +} +__name(makeNetworkReplayBreadcrumb, "makeNetworkReplayBreadcrumb"); +function buildSkippedNetworkRequestOrResponse(bodySize) { + return { + headers: {}, + size: bodySize, + _meta: { + warnings: ["URL_SKIPPED"] + } + }; +} +__name(buildSkippedNetworkRequestOrResponse, "buildSkippedNetworkRequestOrResponse"); +function buildNetworkRequestOrResponse(headers, bodySize, body) { + if (!bodySize && Object.keys(headers).length === 0) { + return void 0; + } + if (!bodySize) { + return { + headers + }; + } + if (!body) { + return { + headers, + size: bodySize + }; + } + const info = { + headers, + size: bodySize + }; + const { body: normalizedBody, warnings } = normalizeNetworkBody(body); + info.body = normalizedBody; + if (warnings && warnings.length > 0) { + info._meta = { + warnings + }; + } + return info; +} +__name(buildNetworkRequestOrResponse, "buildNetworkRequestOrResponse"); +function getAllowedHeaders(headers, allowedHeaders) { + return Object.entries(headers).reduce((filteredHeaders, [key, value4]) => { + const normalizedKey = key.toLowerCase(); + if (allowedHeaders.includes(normalizedKey) && headers[key]) { + filteredHeaders[normalizedKey] = value4; + } + return filteredHeaders; + }, {}); +} +__name(getAllowedHeaders, "getAllowedHeaders"); +function _serializeFormData(formData) { + return new URLSearchParams(formData).toString(); +} +__name(_serializeFormData, "_serializeFormData"); +function normalizeNetworkBody(body) { + if (!body || typeof body !== "string") { + return { + body + }; + } + const exceedsSizeLimit = body.length > NETWORK_BODY_MAX_SIZE; + const isProbablyJson = _strIsProbablyJson(body); + if (exceedsSizeLimit) { + const truncatedBody = body.slice(0, NETWORK_BODY_MAX_SIZE); + if (isProbablyJson) { + return { + body: truncatedBody, + warnings: ["MAYBE_JSON_TRUNCATED"] + }; + } + return { + body: `${truncatedBody}…`, + warnings: ["TEXT_TRUNCATED"] + }; + } + if (isProbablyJson) { + try { + const jsonBody = JSON.parse(body); + return { + body: jsonBody + }; + } catch (e2) { + } + } + return { + body + }; +} +__name(normalizeNetworkBody, "normalizeNetworkBody"); +function _strIsProbablyJson(str) { + const first2 = str[0]; + const last = str[str.length - 1]; + return first2 === "[" && last === "]" || first2 === "{" && last === "}"; +} +__name(_strIsProbablyJson, "_strIsProbablyJson"); +function urlMatches(url, urls) { + const fullUrl = getFullUrl(url); + return stringMatchesSomePattern(fullUrl, urls); +} +__name(urlMatches, "urlMatches"); +function getFullUrl(url, baseURI = WINDOW$1.document.baseURI) { + if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith(WINDOW$1.location.origin)) { + return url; + } + const fixedUrl = new URL(url, baseURI); + if (fixedUrl.origin !== new URL(baseURI).origin) { + return url; + } + const fullUrl = fixedUrl.href; + if (!url.endsWith("/") && fullUrl.endsWith("/")) { + return fullUrl.slice(0, -1); + } + return fullUrl; +} +__name(getFullUrl, "getFullUrl"); +async function captureFetchBreadcrumbToReplay(breadcrumb, hint, options4) { + try { + const data25 = await _prepareFetchData(breadcrumb, hint, options4); + const result = makeNetworkReplayBreadcrumb("resource.fetch", data25); + addNetworkBreadcrumb(options4.replay, result); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to capture fetch breadcrumb"); + } +} +__name(captureFetchBreadcrumbToReplay, "captureFetchBreadcrumbToReplay"); +function enrichFetchBreadcrumb(breadcrumb, hint) { + const { input, response } = hint; + const body = input ? _getFetchRequestArgBody(input) : void 0; + const reqSize = getBodySize(body); + const resSize = response ? parseContentLengthHeader(response.headers.get("content-length")) : void 0; + if (reqSize !== void 0) { + breadcrumb.data.request_body_size = reqSize; + } + if (resSize !== void 0) { + breadcrumb.data.response_body_size = resSize; + } +} +__name(enrichFetchBreadcrumb, "enrichFetchBreadcrumb"); +async function _prepareFetchData(breadcrumb, hint, options4) { + const now2 = Date.now(); + const { startTimestamp = now2, endTimestamp = now2 } = hint; + const { + url, + method, + status_code: statusCode = 0, + request_body_size: requestBodySize, + response_body_size: responseBodySize + } = breadcrumb.data; + const captureDetails = urlMatches(url, options4.networkDetailAllowUrls) && !urlMatches(url, options4.networkDetailDenyUrls); + const request = captureDetails ? _getRequestInfo(options4, hint.input, requestBodySize) : buildSkippedNetworkRequestOrResponse(requestBodySize); + const response = await _getResponseInfo(captureDetails, options4, hint.response, responseBodySize); + return { + startTimestamp, + endTimestamp, + url, + method, + statusCode, + request, + response + }; +} +__name(_prepareFetchData, "_prepareFetchData"); +function _getRequestInfo({ networkCaptureBodies, networkRequestHeaders }, input, requestBodySize) { + const headers = input ? getRequestHeaders(input, networkRequestHeaders) : {}; + if (!networkCaptureBodies) { + return buildNetworkRequestOrResponse(headers, requestBodySize, void 0); + } + const requestBody = _getFetchRequestArgBody(input); + const [bodyStr, warning] = getBodyString(requestBody); + const data25 = buildNetworkRequestOrResponse(headers, requestBodySize, bodyStr); + if (warning) { + return mergeWarning(data25, warning); + } + return data25; +} +__name(_getRequestInfo, "_getRequestInfo"); +async function _getResponseInfo(captureDetails, { + networkCaptureBodies, + networkResponseHeaders +}, response, responseBodySize) { + if (!captureDetails && responseBodySize !== void 0) { + return buildSkippedNetworkRequestOrResponse(responseBodySize); + } + const headers = response ? getAllHeaders(response.headers, networkResponseHeaders) : {}; + if (!response || !networkCaptureBodies && responseBodySize !== void 0) { + return buildNetworkRequestOrResponse(headers, responseBodySize, void 0); + } + const [bodyText, warning] = await _parseFetchResponseBody(response); + const result = getResponseData(bodyText, { + networkCaptureBodies, + responseBodySize, + captureDetails, + headers + }); + if (warning) { + return mergeWarning(result, warning); + } + return result; +} +__name(_getResponseInfo, "_getResponseInfo"); +function getResponseData(bodyText, { + networkCaptureBodies, + responseBodySize, + captureDetails, + headers +}) { + try { + const size2 = bodyText && bodyText.length && responseBodySize === void 0 ? getBodySize(bodyText) : responseBodySize; + if (!captureDetails) { + return buildSkippedNetworkRequestOrResponse(size2); + } + if (networkCaptureBodies) { + return buildNetworkRequestOrResponse(headers, size2, bodyText); + } + return buildNetworkRequestOrResponse(headers, size2, void 0); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to serialize response body"); + return buildNetworkRequestOrResponse(headers, responseBodySize, void 0); + } +} +__name(getResponseData, "getResponseData"); +async function _parseFetchResponseBody(response) { + const res = _tryCloneResponse(response); + if (!res) { + return [void 0, "BODY_PARSE_ERROR"]; + } + try { + const text2 = await _tryGetResponseText(res); + return [text2]; + } catch (error2) { + if (error2 instanceof Error && error2.message.indexOf("Timeout") > -1) { + DEBUG_BUILD$2 && logger$1.warn("Parsing text body from response timed out"); + return [void 0, "BODY_PARSE_TIMEOUT"]; + } + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to get text body from response"); + return [void 0, "BODY_PARSE_ERROR"]; + } +} +__name(_parseFetchResponseBody, "_parseFetchResponseBody"); +function _getFetchRequestArgBody(fetchArgs = []) { + if (fetchArgs.length !== 2 || typeof fetchArgs[1] !== "object") { + return void 0; + } + return fetchArgs[1].body; +} +__name(_getFetchRequestArgBody, "_getFetchRequestArgBody"); +function getAllHeaders(headers, allowedHeaders) { + const allHeaders = {}; + allowedHeaders.forEach((header3) => { + if (headers.get(header3)) { + allHeaders[header3] = headers.get(header3); + } + }); + return allHeaders; +} +__name(getAllHeaders, "getAllHeaders"); +function getRequestHeaders(fetchArgs, allowedHeaders) { + if (fetchArgs.length === 1 && typeof fetchArgs[0] !== "string") { + return getHeadersFromOptions(fetchArgs[0], allowedHeaders); + } + if (fetchArgs.length === 2) { + return getHeadersFromOptions(fetchArgs[1], allowedHeaders); + } + return {}; +} +__name(getRequestHeaders, "getRequestHeaders"); +function getHeadersFromOptions(input, allowedHeaders) { + if (!input) { + return {}; + } + const headers = input.headers; + if (!headers) { + return {}; + } + if (headers instanceof Headers) { + return getAllHeaders(headers, allowedHeaders); + } + if (Array.isArray(headers)) { + return {}; + } + return getAllowedHeaders(headers, allowedHeaders); +} +__name(getHeadersFromOptions, "getHeadersFromOptions"); +function _tryCloneResponse(response) { + try { + return response.clone(); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to clone response body"); + } +} +__name(_tryCloneResponse, "_tryCloneResponse"); +function _tryGetResponseText(response) { + return new Promise((resolve2, reject3) => { + const timeout = setTimeout$3(() => reject3(new Error("Timeout while trying to read response body")), 500); + _getResponseText(response).then( + (txt) => resolve2(txt), + (reason) => reject3(reason) + ).finally(() => clearTimeout(timeout)); + }); +} +__name(_tryGetResponseText, "_tryGetResponseText"); +async function _getResponseText(response) { + return await response.text(); +} +__name(_getResponseText, "_getResponseText"); +async function captureXhrBreadcrumbToReplay(breadcrumb, hint, options4) { + try { + const data25 = _prepareXhrData(breadcrumb, hint, options4); + const result = makeNetworkReplayBreadcrumb("resource.xhr", data25); + addNetworkBreadcrumb(options4.replay, result); + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to capture xhr breadcrumb"); + } +} +__name(captureXhrBreadcrumbToReplay, "captureXhrBreadcrumbToReplay"); +function enrichXhrBreadcrumb(breadcrumb, hint) { + const { xhr, input } = hint; + if (!xhr) { + return; + } + const reqSize = getBodySize(input); + const resSize = xhr.getResponseHeader("content-length") ? parseContentLengthHeader(xhr.getResponseHeader("content-length")) : _getBodySize(xhr.response, xhr.responseType); + if (reqSize !== void 0) { + breadcrumb.data.request_body_size = reqSize; + } + if (resSize !== void 0) { + breadcrumb.data.response_body_size = resSize; + } +} +__name(enrichXhrBreadcrumb, "enrichXhrBreadcrumb"); +function _prepareXhrData(breadcrumb, hint, options4) { + const now2 = Date.now(); + const { startTimestamp = now2, endTimestamp = now2, input, xhr } = hint; + const { + url, + method, + status_code: statusCode = 0, + request_body_size: requestBodySize, + response_body_size: responseBodySize + } = breadcrumb.data; + if (!url) { + return null; + } + if (!xhr || !urlMatches(url, options4.networkDetailAllowUrls) || urlMatches(url, options4.networkDetailDenyUrls)) { + const request2 = buildSkippedNetworkRequestOrResponse(requestBodySize); + const response2 = buildSkippedNetworkRequestOrResponse(responseBodySize); + return { + startTimestamp, + endTimestamp, + url, + method, + statusCode, + request: request2, + response: response2 + }; + } + const xhrInfo = xhr[SENTRY_XHR_DATA_KEY]; + const networkRequestHeaders = xhrInfo ? getAllowedHeaders(xhrInfo.request_headers, options4.networkRequestHeaders) : {}; + const networkResponseHeaders = getAllowedHeaders(getResponseHeaders(xhr), options4.networkResponseHeaders); + const [requestBody, requestWarning] = options4.networkCaptureBodies ? getBodyString(input) : [void 0]; + const [responseBody, responseWarning] = options4.networkCaptureBodies ? _getXhrResponseBody(xhr) : [void 0]; + const request = buildNetworkRequestOrResponse(networkRequestHeaders, requestBodySize, requestBody); + const response = buildNetworkRequestOrResponse(networkResponseHeaders, responseBodySize, responseBody); + return { + startTimestamp, + endTimestamp, + url, + method, + statusCode, + request: requestWarning ? mergeWarning(request, requestWarning) : request, + response: responseWarning ? mergeWarning(response, responseWarning) : response + }; +} +__name(_prepareXhrData, "_prepareXhrData"); +function getResponseHeaders(xhr) { + const headers = xhr.getAllResponseHeaders(); + if (!headers) { + return {}; + } + return headers.split("\r\n").reduce((acc, line) => { + const [key, value4] = line.split(": "); + if (value4) { + acc[key.toLowerCase()] = value4; + } + return acc; + }, {}); +} +__name(getResponseHeaders, "getResponseHeaders"); +function _getXhrResponseBody(xhr) { + const errors2 = []; + try { + return [xhr.responseText]; + } catch (e2) { + errors2.push(e2); + } + try { + return _parseXhrResponse(xhr.response, xhr.responseType); + } catch (e2) { + errors2.push(e2); + } + DEBUG_BUILD$2 && logger$1.warn("Failed to get xhr response body", ...errors2); + return [void 0]; +} +__name(_getXhrResponseBody, "_getXhrResponseBody"); +function _parseXhrResponse(body, responseType) { + try { + if (typeof body === "string") { + return [body]; + } + if (body instanceof Document) { + return [body.body.outerHTML]; + } + if (responseType === "json" && body && typeof body === "object") { + return [JSON.stringify(body)]; + } + if (!body) { + return [void 0]; + } + } catch (error2) { + DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to serialize body", body); + return [void 0, "BODY_PARSE_ERROR"]; + } + DEBUG_BUILD$2 && logger$1.info("Skipping network body because of body type", body); + return [void 0, "UNPARSEABLE_BODY_TYPE"]; +} +__name(_parseXhrResponse, "_parseXhrResponse"); +function _getBodySize(body, responseType) { + try { + const bodyStr = responseType === "json" && body && typeof body === "object" ? JSON.stringify(body) : body; + return getBodySize(bodyStr); + } catch (e2) { + return void 0; + } +} +__name(_getBodySize, "_getBodySize"); +function handleNetworkBreadcrumbs(replay) { + const client = getClient(); + try { + const { + networkDetailAllowUrls, + networkDetailDenyUrls, + networkCaptureBodies, + networkRequestHeaders, + networkResponseHeaders + } = replay.getOptions(); + const options4 = { + replay, + networkDetailAllowUrls, + networkDetailDenyUrls, + networkCaptureBodies, + networkRequestHeaders, + networkResponseHeaders + }; + if (client) { + client.on("beforeAddBreadcrumb", (breadcrumb, hint) => beforeAddNetworkBreadcrumb(options4, breadcrumb, hint)); + } + } catch (e2) { + } +} +__name(handleNetworkBreadcrumbs, "handleNetworkBreadcrumbs"); +function beforeAddNetworkBreadcrumb(options4, breadcrumb, hint) { + if (!breadcrumb.data) { + return; + } + try { + if (_isXhrBreadcrumb(breadcrumb) && _isXhrHint(hint)) { + enrichXhrBreadcrumb(breadcrumb, hint); + captureXhrBreadcrumbToReplay(breadcrumb, hint, options4); + } + if (_isFetchBreadcrumb(breadcrumb) && _isFetchHint(hint)) { + enrichFetchBreadcrumb(breadcrumb, hint); + captureFetchBreadcrumbToReplay(breadcrumb, hint, options4); + } + } catch (e2) { + DEBUG_BUILD$2 && logger$1.exception(e2, "Error when enriching network breadcrumb"); + } +} +__name(beforeAddNetworkBreadcrumb, "beforeAddNetworkBreadcrumb"); +function _isXhrBreadcrumb(breadcrumb) { + return breadcrumb.category === "xhr"; +} +__name(_isXhrBreadcrumb, "_isXhrBreadcrumb"); +function _isFetchBreadcrumb(breadcrumb) { + return breadcrumb.category === "fetch"; +} +__name(_isFetchBreadcrumb, "_isFetchBreadcrumb"); +function _isXhrHint(hint) { + return hint && hint.xhr; +} +__name(_isXhrHint, "_isXhrHint"); +function _isFetchHint(hint) { + return hint && hint.response; +} +__name(_isFetchHint, "_isFetchHint"); +function addGlobalListeners(replay) { + const client = getClient(); + addClickKeypressInstrumentationHandler(handleDomListener(replay)); + addHistoryInstrumentationHandler(handleHistorySpanListener(replay)); + handleBreadcrumbs(replay); + handleNetworkBreadcrumbs(replay); + const eventProcessor = handleGlobalEventListener(replay); + addEventProcessor(eventProcessor); + if (client) { + client.on("beforeSendEvent", handleBeforeSendEvent(replay)); + client.on("afterSendEvent", handleAfterSendEvent(replay)); + client.on("createDsc", (dsc) => { + const replayId = replay.getSessionId(); + if (replayId && replay.isEnabled() && replay.recordingMode === "session") { + const isSessionActive = replay.checkAndHandleExpiredSession(); + if (isSessionActive) { + dsc.replay_id = replayId; + } + } + }); + client.on("spanStart", (span) => { + replay.lastActiveSpan = span; + }); + client.on("spanEnd", (span) => { + replay.lastActiveSpan = span; + }); + client.on("beforeSendFeedback", (feedbackEvent, options4) => { + const replayId = replay.getSessionId(); + if (options4 && options4.includeReplay && replay.isEnabled() && replayId) { + if (feedbackEvent.contexts && feedbackEvent.contexts.feedback) { + feedbackEvent.contexts.feedback.replay_id = replayId; + } + } + }); + } +} +__name(addGlobalListeners, "addGlobalListeners"); +async function addMemoryEntry(replay) { + try { + return Promise.all( + createPerformanceSpans(replay, [ + // @ts-expect-error memory doesn't exist on type Performance as the API is non-standard (we check that it exists above) + createMemoryEntry(WINDOW$1.performance.memory) + ]) + ); + } catch (error2) { + return []; + } +} +__name(addMemoryEntry, "addMemoryEntry"); +function createMemoryEntry(memoryEntry) { + const { jsHeapSizeLimit, totalJSHeapSize, usedJSHeapSize } = memoryEntry; + const time = Date.now() / 1e3; + return { + type: "memory", + name: "memory", + start: time, + end: time, + data: { + memory: { + jsHeapSizeLimit, + totalJSHeapSize, + usedJSHeapSize + } + } + }; +} +__name(createMemoryEntry, "createMemoryEntry"); +function debounce(func, wait, options4) { + let callbackReturnValue; + let timerId; + let maxTimerId; + const maxWait = options4 && options4.maxWait ? Math.max(options4.maxWait, wait) : 0; + function invokeFunc() { + cancelTimers(); + callbackReturnValue = func(); + return callbackReturnValue; + } + __name(invokeFunc, "invokeFunc"); + function cancelTimers() { + timerId !== void 0 && clearTimeout(timerId); + maxTimerId !== void 0 && clearTimeout(maxTimerId); + timerId = maxTimerId = void 0; + } + __name(cancelTimers, "cancelTimers"); + function flush2() { + if (timerId !== void 0 || maxTimerId !== void 0) { + return invokeFunc(); + } + return callbackReturnValue; + } + __name(flush2, "flush"); + function debounced() { + if (timerId) { + clearTimeout(timerId); + } + timerId = setTimeout$3(invokeFunc, wait); + if (maxWait && maxTimerId === void 0) { + maxTimerId = setTimeout$3(invokeFunc, maxWait); + } + return callbackReturnValue; + } + __name(debounced, "debounced"); + debounced.cancel = cancelTimers; + debounced.flush = flush2; + return debounced; +} +__name(debounce, "debounce"); +function getHandleRecordingEmit(replay) { + let hadFirstEvent = false; + return (event, _isCheckout) => { + if (!replay.checkAndHandleExpiredSession()) { + DEBUG_BUILD$2 && logger$1.warn("Received replay event after session expired."); + return; + } + const isCheckout = _isCheckout || !hadFirstEvent; + hadFirstEvent = true; + if (replay.clickDetector) { + updateClickDetectorForRecordingEvent(replay.clickDetector, event); + } + replay.addUpdate(() => { + if (replay.recordingMode === "buffer" && isCheckout) { + replay.setInitialState(); + } + if (!addEventSync(replay, event, isCheckout)) { + return true; + } + if (!isCheckout) { + return false; + } + const session = replay.session; + addSettingsEvent(replay, isCheckout); + if (replay.recordingMode === "buffer" && session && replay.eventBuffer) { + const earliestEvent = replay.eventBuffer.getEarliestTimestamp(); + if (earliestEvent) { + DEBUG_BUILD$2 && logger$1.info(`Updating session start time to earliest event in buffer to ${new Date(earliestEvent)}`); + session.started = earliestEvent; + if (replay.getOptions().stickySession) { + saveSession(session); + } + } + } + if (session && session.previousSessionId) { + return true; + } + if (replay.recordingMode === "session") { + void replay.flush(); + } + return true; + }); + }; +} +__name(getHandleRecordingEmit, "getHandleRecordingEmit"); +function createOptionsEvent(replay) { + const options4 = replay.getOptions(); + return { + type: EventType.Custom, + timestamp: Date.now(), + data: { + tag: "options", + payload: { + shouldRecordCanvas: replay.isRecordingCanvas(), + sessionSampleRate: options4.sessionSampleRate, + errorSampleRate: options4.errorSampleRate, + useCompressionOption: options4.useCompression, + blockAllMedia: options4.blockAllMedia, + maskAllText: options4.maskAllText, + maskAllInputs: options4.maskAllInputs, + useCompression: replay.eventBuffer ? replay.eventBuffer.type === "worker" : false, + networkDetailHasUrls: options4.networkDetailAllowUrls.length > 0, + networkCaptureBodies: options4.networkCaptureBodies, + networkRequestHasHeaders: options4.networkRequestHeaders.length > 0, + networkResponseHasHeaders: options4.networkResponseHeaders.length > 0 + } + } + }; +} +__name(createOptionsEvent, "createOptionsEvent"); +function addSettingsEvent(replay, isCheckout) { + if (!isCheckout || !replay.session || replay.session.segmentId !== 0) { + return; + } + addEventSync(replay, createOptionsEvent(replay), false); +} +__name(addSettingsEvent, "addSettingsEvent"); +function createReplayEnvelope(replayEvent, recordingData, dsn, tunnel) { + return createEnvelope( + createEventEnvelopeHeaders(replayEvent, getSdkMetadataForEnvelopeHeader(replayEvent), tunnel, dsn), + [ + [{ type: "replay_event" }, replayEvent], + [ + { + type: "replay_recording", + // If string then we need to encode to UTF8, otherwise will have + // wrong size. TextEncoder has similar browser support to + // MutationObserver, although it does not accept IE11. + length: typeof recordingData === "string" ? new TextEncoder().encode(recordingData).length : recordingData.length + }, + recordingData + ] + ] + ); +} +__name(createReplayEnvelope, "createReplayEnvelope"); +function prepareRecordingData({ + recordingData, + headers +}) { + let payloadWithSequence; + const replayHeaders = `${JSON.stringify(headers)} +`; + if (typeof recordingData === "string") { + payloadWithSequence = `${replayHeaders}${recordingData}`; + } else { + const enc = new TextEncoder(); + const sequence = enc.encode(replayHeaders); + payloadWithSequence = new Uint8Array(sequence.length + recordingData.length); + payloadWithSequence.set(sequence); + payloadWithSequence.set(recordingData, sequence.length); + } + return payloadWithSequence; +} +__name(prepareRecordingData, "prepareRecordingData"); +async function prepareReplayEvent({ + client, + scope, + replayId: event_id, + event +}) { + const integrations = typeof client._integrations === "object" && client._integrations !== null && !Array.isArray(client._integrations) ? Object.keys(client._integrations) : void 0; + const eventHint = { event_id, integrations }; + client.emit("preprocessEvent", event, eventHint); + const preparedEvent = await prepareEvent( + client.getOptions(), + event, + eventHint, + scope, + client, + getIsolationScope() + ); + if (!preparedEvent) { + return null; + } + preparedEvent.platform = preparedEvent.platform || "javascript"; + const metadata = client.getSdkMetadata(); + const { name: name2, version: version2 } = metadata && metadata.sdk || {}; + preparedEvent.sdk = { + ...preparedEvent.sdk, + name: name2 || "sentry.javascript.unknown", + version: version2 || "0.0.0" + }; + return preparedEvent; +} +__name(prepareReplayEvent, "prepareReplayEvent"); +async function sendReplayRequest({ + recordingData, + replayId, + segmentId: segment_id, + eventContext, + timestamp: timestamp2, + session +}) { + const preparedRecordingData = prepareRecordingData({ + recordingData, + headers: { + segment_id + } + }); + const { urls, errorIds, traceIds, initialTimestamp } = eventContext; + const client = getClient(); + const scope = getCurrentScope$1(); + const transport = client && client.getTransport(); + const dsn = client && client.getDsn(); + if (!client || !transport || !dsn || !session.sampled) { + return resolvedSyncPromise({}); + } + const baseEvent = { + type: REPLAY_EVENT_NAME, + replay_start_timestamp: initialTimestamp / 1e3, + timestamp: timestamp2 / 1e3, + error_ids: errorIds, + trace_ids: traceIds, + urls, + replay_id: replayId, + segment_id, + replay_type: session.sampled + }; + const replayEvent = await prepareReplayEvent({ scope, client, replayId, event: baseEvent }); + if (!replayEvent) { + client.recordDroppedEvent("event_processor", "replay", baseEvent); + DEBUG_BUILD$2 && logger$1.info("An event processor returned `null`, will not send event."); + return resolvedSyncPromise({}); + } + delete replayEvent.sdkProcessingMetadata; + const envelope = createReplayEnvelope(replayEvent, preparedRecordingData, dsn, client.getOptions().tunnel); + let response; + try { + response = await transport.send(envelope); + } catch (err) { + const error2 = new Error(UNABLE_TO_SEND_REPLAY); + try { + error2.cause = err; + } catch (e2) { + } + throw error2; + } + if (typeof response.statusCode === "number" && (response.statusCode < 200 || response.statusCode >= 300)) { + throw new TransportStatusCodeError(response.statusCode); + } + const rateLimits = updateRateLimits({}, response); + if (isRateLimited(rateLimits, "replay")) { + throw new RateLimitError(rateLimits); + } + return response; +} +__name(sendReplayRequest, "sendReplayRequest"); +class TransportStatusCodeError extends Error { + static { + __name(this, "TransportStatusCodeError"); + } + constructor(statusCode) { + super(`Transport returned status code ${statusCode}`); + } +} +class RateLimitError extends Error { + static { + __name(this, "RateLimitError"); + } + constructor(rateLimits) { + super("Rate limit hit"); + this.rateLimits = rateLimits; + } +} +async function sendReplay(replayData, retryConfig = { + count: 0, + interval: RETRY_BASE_INTERVAL +}) { + const { recordingData, onError } = replayData; + if (!recordingData.length) { + return; + } + try { + await sendReplayRequest(replayData); + return true; + } catch (err) { + if (err instanceof TransportStatusCodeError || err instanceof RateLimitError) { + throw err; + } + setContext("Replays", { + _retryCount: retryConfig.count + }); + if (onError) { + onError(err); + } + if (retryConfig.count >= RETRY_MAX_COUNT) { + const error2 = new Error(`${UNABLE_TO_SEND_REPLAY} - max retries exceeded`); + try { + error2.cause = err; + } catch (e2) { + } + throw error2; + } + retryConfig.interval *= ++retryConfig.count; + return new Promise((resolve2, reject3) => { + setTimeout$3(async () => { + try { + await sendReplay(replayData, retryConfig); + resolve2(true); + } catch (err2) { + reject3(err2); + } + }, retryConfig.interval); + }); + } +} +__name(sendReplay, "sendReplay"); +const THROTTLED = "__THROTTLED"; +const SKIPPED = "__SKIPPED"; +function throttle$2(fn, maxCount, durationSeconds) { + const counter = /* @__PURE__ */ new Map(); + const _cleanup = /* @__PURE__ */ __name((now2) => { + const threshold = now2 - durationSeconds; + counter.forEach((_value, key) => { + if (key < threshold) { + counter.delete(key); + } + }); + }, "_cleanup"); + const _getTotalCount = /* @__PURE__ */ __name(() => { + return [...counter.values()].reduce((a2, b2) => a2 + b2, 0); + }, "_getTotalCount"); + let isThrottled = false; + return (...rest) => { + const now2 = Math.floor(Date.now() / 1e3); + _cleanup(now2); + if (_getTotalCount() >= maxCount) { + const wasThrottled = isThrottled; + isThrottled = true; + return wasThrottled ? SKIPPED : THROTTLED; + } + isThrottled = false; + const count = counter.get(now2) || 0; + counter.set(now2, count + 1); + return fn(...rest); + }; +} +__name(throttle$2, "throttle$2"); +class ReplayContainer { + static { + __name(this, "ReplayContainer"); + } + /** + * Recording can happen in one of two modes: + * - session: Record the whole session, sending it continuously + * - buffer: Always keep the last 60s of recording, requires: + * - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs + * - or calling `flush()` to send the replay + */ + /** + * The current or last active span. + * This is only available when performance is enabled. + */ + /** + * These are here so we can overwrite them in tests etc. + * @hidden + */ + /** The replay has to be manually started, because no sample rate (neither session or error) was provided. */ + /** + * Options to pass to `rrweb.record()` + */ + /** + * Timestamp of the last user activity. This lives across sessions. + */ + /** + * Is the integration currently active? + */ + /** + * Paused is a state where: + * - DOM Recording is not listening at all + * - Nothing will be added to event buffer (e.g. core SDK events) + */ + /** + * Have we attached listeners to the core SDK? + * Note we have to track this as there is no way to remove instrumentation handlers. + */ + /** + * Function to stop recording + */ + /** + * Internal use for canvas recording options + */ + constructor({ + options: options4, + recordingOptions + }) { + ReplayContainer.prototype.__init.call(this); + ReplayContainer.prototype.__init2.call(this); + ReplayContainer.prototype.__init3.call(this); + ReplayContainer.prototype.__init4.call(this); + ReplayContainer.prototype.__init5.call(this); + ReplayContainer.prototype.__init6.call(this); + this.eventBuffer = null; + this.performanceEntries = []; + this.replayPerformanceEntries = []; + this.recordingMode = "session"; + this.timeouts = { + sessionIdlePause: SESSION_IDLE_PAUSE_DURATION, + sessionIdleExpire: SESSION_IDLE_EXPIRE_DURATION + }; + this._lastActivity = Date.now(); + this._isEnabled = false; + this._isPaused = false; + this._requiresManualStart = false; + this._hasInitializedCoreListeners = false; + this._context = { + errorIds: /* @__PURE__ */ new Set(), + traceIds: /* @__PURE__ */ new Set(), + urls: [], + initialTimestamp: Date.now(), + initialUrl: "" + }; + this._recordingOptions = recordingOptions; + this._options = options4; + this._debouncedFlush = debounce(() => this._flush(), this._options.flushMinDelay, { + maxWait: this._options.flushMaxDelay + }); + this._throttledAddEvent = throttle$2( + (event, isCheckout) => addEvent(this, event, isCheckout), + // Max 300 events... + 300, + // ... per 5s + 5 + ); + const { slowClickTimeout, slowClickIgnoreSelectors } = this.getOptions(); + const slowClickConfig = slowClickTimeout ? { + threshold: Math.min(SLOW_CLICK_THRESHOLD, slowClickTimeout), + timeout: slowClickTimeout, + scrollTimeout: SLOW_CLICK_SCROLL_TIMEOUT, + ignoreSelector: slowClickIgnoreSelectors ? slowClickIgnoreSelectors.join(",") : "" + } : void 0; + if (slowClickConfig) { + this.clickDetector = new ClickDetector(this, slowClickConfig); + } + if (DEBUG_BUILD$2) { + const experiments = options4._experiments; + logger$1.setConfig({ + captureExceptions: !!experiments.captureExceptions, + traceInternals: !!experiments.traceInternals + }); + } + } + /** Get the event context. */ + getContext() { + return this._context; + } + /** If recording is currently enabled. */ + isEnabled() { + return this._isEnabled; + } + /** If recording is currently paused. */ + isPaused() { + return this._isPaused; + } + /** + * Determine if canvas recording is enabled + */ + isRecordingCanvas() { + return Boolean(this._canvas); + } + /** Get the replay integration options. */ + getOptions() { + return this._options; + } + /** A wrapper to conditionally capture exceptions. */ + handleException(error2) { + DEBUG_BUILD$2 && logger$1.exception(error2); + if (this._options.onError) { + this._options.onError(error2); + } + } + /** + * Initializes the plugin based on sampling configuration. Should not be + * called outside of constructor. + */ + initializeSampling(previousSessionId) { + const { errorSampleRate, sessionSampleRate } = this._options; + const requiresManualStart = errorSampleRate <= 0 && sessionSampleRate <= 0; + this._requiresManualStart = requiresManualStart; + if (requiresManualStart) { + return; + } + this._initializeSessionForSampling(previousSessionId); + if (!this.session) { + DEBUG_BUILD$2 && logger$1.exception(new Error("Unable to initialize and create session")); + return; + } + if (this.session.sampled === false) { + return; + } + this.recordingMode = this.session.sampled === "buffer" && this.session.segmentId === 0 ? "buffer" : "session"; + DEBUG_BUILD$2 && logger$1.infoTick(`Starting replay in ${this.recordingMode} mode`); + this._initializeRecording(); + } + /** + * Start a replay regardless of sampling rate. Calling this will always + * create a new session. Will log a message if replay is already in progress. + * + * Creates or loads a session, attaches listeners to varying events (DOM, + * _performanceObserver, Recording, Sentry SDK, etc) + */ + start() { + if (this._isEnabled && this.recordingMode === "session") { + DEBUG_BUILD$2 && logger$1.info("Recording is already in progress"); + return; + } + if (this._isEnabled && this.recordingMode === "buffer") { + DEBUG_BUILD$2 && logger$1.info("Buffering is in progress, call `flush()` to save the replay"); + return; + } + DEBUG_BUILD$2 && logger$1.infoTick("Starting replay in session mode"); + this._updateUserActivity(); + const session = loadOrCreateSession( + { + maxReplayDuration: this._options.maxReplayDuration, + sessionIdleExpire: this.timeouts.sessionIdleExpire + }, + { + stickySession: this._options.stickySession, + // This is intentional: create a new session-based replay when calling `start()` + sessionSampleRate: 1, + allowBuffering: false + } + ); + this.session = session; + this._initializeRecording(); + } + /** + * Start replay buffering. Buffers until `flush()` is called or, if + * `replaysOnErrorSampleRate` > 0, an error occurs. + */ + startBuffering() { + if (this._isEnabled) { + DEBUG_BUILD$2 && logger$1.info("Buffering is in progress, call `flush()` to save the replay"); + return; + } + DEBUG_BUILD$2 && logger$1.infoTick("Starting replay in buffer mode"); + const session = loadOrCreateSession( + { + sessionIdleExpire: this.timeouts.sessionIdleExpire, + maxReplayDuration: this._options.maxReplayDuration + }, + { + stickySession: this._options.stickySession, + sessionSampleRate: 0, + allowBuffering: true + } + ); + this.session = session; + this.recordingMode = "buffer"; + this._initializeRecording(); + } + /** + * Start recording. + * + * Note that this will cause a new DOM checkout + */ + startRecording() { + try { + const canvasOptions = this._canvas; + this._stopRecording = record({ + ...this._recordingOptions, + // When running in error sampling mode, we need to overwrite `checkoutEveryNms` + // Without this, it would record forever, until an error happens, which we don't want + // instead, we'll always keep the last 60 seconds of replay before an error happened + ...this.recordingMode === "buffer" ? { checkoutEveryNms: BUFFER_CHECKOUT_TIME } : ( + // Otherwise, use experimental option w/ min checkout time of 6 minutes + // This is to improve playback seeking as there could potentially be + // less mutations to process in the worse cases. + // + // checkout by "N" events is probably ideal, but means we have less + // control about the number of checkouts we make (which generally + // increases replay size) + this._options._experiments.continuousCheckout && { + // Minimum checkout time is 6 minutes + checkoutEveryNms: Math.max(36e4, this._options._experiments.continuousCheckout) + } + ), + emit: getHandleRecordingEmit(this), + onMutation: this._onMutationHandler, + ...canvasOptions ? { + recordCanvas: canvasOptions.recordCanvas, + getCanvasManager: canvasOptions.getCanvasManager, + sampling: canvasOptions.sampling, + dataURLOptions: canvasOptions.dataURLOptions + } : {} + }); + } catch (err) { + this.handleException(err); + } + } + /** + * Stops the recording, if it was running. + * + * Returns true if it was previously stopped, or is now stopped, + * otherwise false. + */ + stopRecording() { + try { + if (this._stopRecording) { + this._stopRecording(); + this._stopRecording = void 0; + } + return true; + } catch (err) { + this.handleException(err); + return false; + } + } + /** + * Currently, this needs to be manually called (e.g. for tests). Sentry SDK + * does not support a teardown + */ + async stop({ forceFlush = false, reason } = {}) { + if (!this._isEnabled) { + return; + } + this._isEnabled = false; + try { + DEBUG_BUILD$2 && logger$1.info(`Stopping Replay${reason ? ` triggered by ${reason}` : ""}`); + resetReplayIdOnDynamicSamplingContext(); + this._removeListeners(); + this.stopRecording(); + this._debouncedFlush.cancel(); + if (forceFlush) { + await this._flush({ force: true }); + } + this.eventBuffer && this.eventBuffer.destroy(); + this.eventBuffer = null; + clearSession(this); + } catch (err) { + this.handleException(err); + } + } + /** + * Pause some replay functionality. See comments for `_isPaused`. + * This differs from stop as this only stops DOM recording, it is + * not as thorough of a shutdown as `stop()`. + */ + pause() { + if (this._isPaused) { + return; + } + this._isPaused = true; + this.stopRecording(); + DEBUG_BUILD$2 && logger$1.info("Pausing replay"); + } + /** + * Resumes recording, see notes for `pause(). + * + * Note that calling `startRecording()` here will cause a + * new DOM checkout.` + */ + resume() { + if (!this._isPaused || !this._checkSession()) { + return; + } + this._isPaused = false; + this.startRecording(); + DEBUG_BUILD$2 && logger$1.info("Resuming replay"); + } + /** + * If not in "session" recording mode, flush event buffer which will create a new replay. + * Unless `continueRecording` is false, the replay will continue to record and + * behave as a "session"-based replay. + * + * Otherwise, queue up a flush. + */ + async sendBufferedReplayOrFlush({ continueRecording = true } = {}) { + if (this.recordingMode === "session") { + return this.flushImmediate(); + } + const activityTime = Date.now(); + DEBUG_BUILD$2 && logger$1.info("Converting buffer to session"); + await this.flushImmediate(); + const hasStoppedRecording = this.stopRecording(); + if (!continueRecording || !hasStoppedRecording) { + return; + } + if (this.recordingMode === "session") { + return; + } + this.recordingMode = "session"; + if (this.session) { + this._updateUserActivity(activityTime); + this._updateSessionActivity(activityTime); + this._maybeSaveSession(); + } + this.startRecording(); + } + /** + * We want to batch uploads of replay events. Save events only if + * `` milliseconds have elapsed since the last event + * *OR* if `` milliseconds have elapsed. + * + * Accepts a callback to perform side-effects and returns true to stop batch + * processing and hand back control to caller. + */ + addUpdate(cb) { + const cbResult = cb(); + if (this.recordingMode === "buffer") { + return; + } + if (cbResult === true) { + return; + } + this._debouncedFlush(); + } + /** + * Updates the user activity timestamp and resumes recording. This should be + * called in an event handler for a user action that we consider as the user + * being "active" (e.g. a mouse click). + */ + triggerUserActivity() { + this._updateUserActivity(); + if (!this._stopRecording) { + if (!this._checkSession()) { + return; + } + this.resume(); + return; + } + this.checkAndHandleExpiredSession(); + this._updateSessionActivity(); + } + /** + * Updates the user activity timestamp *without* resuming + * recording. Some user events (e.g. keydown) can be create + * low-value replays that only contain the keypress as a + * breadcrumb. Instead this would require other events to + * create a new replay after a session has expired. + */ + updateUserActivity() { + this._updateUserActivity(); + this._updateSessionActivity(); + } + /** + * Only flush if `this.recordingMode === 'session'` + */ + conditionalFlush() { + if (this.recordingMode === "buffer") { + return Promise.resolve(); + } + return this.flushImmediate(); + } + /** + * Flush using debounce flush + */ + flush() { + return this._debouncedFlush(); + } + /** + * Always flush via `_debouncedFlush` so that we do not have flushes triggered + * from calling both `flush` and `_debouncedFlush`. Otherwise, there could be + * cases of multiple flushes happening closely together. + */ + flushImmediate() { + this._debouncedFlush(); + return this._debouncedFlush.flush(); + } + /** + * Cancels queued up flushes. + */ + cancelFlush() { + this._debouncedFlush.cancel(); + } + /** Get the current session (=replay) ID */ + getSessionId() { + return this.session && this.session.id; + } + /** + * Checks if recording should be stopped due to user inactivity. Otherwise + * check if session is expired and create a new session if so. Triggers a new + * full snapshot on new session. + * + * Returns true if session is not expired, false otherwise. + * @hidden + */ + checkAndHandleExpiredSession() { + if (this._lastActivity && isExpired(this._lastActivity, this.timeouts.sessionIdlePause) && this.session && this.session.sampled === "session") { + this.pause(); + return; + } + if (!this._checkSession()) { + return false; + } + return true; + } + /** + * Capture some initial state that can change throughout the lifespan of the + * replay. This is required because otherwise they would be captured at the + * first flush. + */ + setInitialState() { + const urlPath = `${WINDOW$1.location.pathname}${WINDOW$1.location.hash}${WINDOW$1.location.search}`; + const url = `${WINDOW$1.location.origin}${urlPath}`; + this.performanceEntries = []; + this.replayPerformanceEntries = []; + this._clearContext(); + this._context.initialUrl = url; + this._context.initialTimestamp = Date.now(); + this._context.urls.push(url); + } + /** + * Add a breadcrumb event, that may be throttled. + * If it was throttled, we add a custom breadcrumb to indicate that. + */ + throttledAddEvent(event, isCheckout) { + const res = this._throttledAddEvent(event, isCheckout); + if (res === THROTTLED) { + const breadcrumb = createBreadcrumb({ + category: "replay.throttled" + }); + this.addUpdate(() => { + return !addEventSync(this, { + type: ReplayEventTypeCustom, + timestamp: breadcrumb.timestamp || 0, + data: { + tag: "breadcrumb", + payload: breadcrumb, + metric: true + } + }); + }); + } + return res; + } + /** + * This will get the parametrized route name of the current page. + * This is only available if performance is enabled, and if an instrumented router is used. + */ + getCurrentRoute() { + const lastActiveSpan = this.lastActiveSpan || getActiveSpan(); + const lastRootSpan = lastActiveSpan && getRootSpan(lastActiveSpan); + const attributes = lastRootSpan && spanToJSON(lastRootSpan).data || {}; + const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; + if (!lastRootSpan || !source || !["route", "custom"].includes(source)) { + return void 0; + } + return spanToJSON(lastRootSpan).description; + } + /** + * Initialize and start all listeners to varying events (DOM, + * Performance Observer, Recording, Sentry SDK, etc) + */ + _initializeRecording() { + this.setInitialState(); + this._updateSessionActivity(); + this.eventBuffer = createEventBuffer({ + useCompression: this._options.useCompression, + workerUrl: this._options.workerUrl + }); + this._removeListeners(); + this._addListeners(); + this._isEnabled = true; + this._isPaused = false; + this.startRecording(); + } + /** + * Loads (or refreshes) the current session. + */ + _initializeSessionForSampling(previousSessionId) { + const allowBuffering = this._options.errorSampleRate > 0; + const session = loadOrCreateSession( + { + sessionIdleExpire: this.timeouts.sessionIdleExpire, + maxReplayDuration: this._options.maxReplayDuration, + previousSessionId + }, + { + stickySession: this._options.stickySession, + sessionSampleRate: this._options.sessionSampleRate, + allowBuffering + } + ); + this.session = session; + } + /** + * Checks and potentially refreshes the current session. + * Returns false if session is not recorded. + */ + _checkSession() { + if (!this.session) { + return false; + } + const currentSession = this.session; + if (shouldRefreshSession(currentSession, { + sessionIdleExpire: this.timeouts.sessionIdleExpire, + maxReplayDuration: this._options.maxReplayDuration + })) { + this._refreshSession(currentSession); + return false; + } + return true; + } + /** + * Refresh a session with a new one. + * This stops the current session (without forcing a flush, as that would never work since we are expired), + * and then does a new sampling based on the refreshed session. + */ + async _refreshSession(session) { + if (!this._isEnabled) { + return; + } + await this.stop({ reason: "refresh session" }); + this.initializeSampling(session.id); + } + /** + * Adds listeners to record events for the replay + */ + _addListeners() { + try { + WINDOW$1.document.addEventListener("visibilitychange", this._handleVisibilityChange); + WINDOW$1.addEventListener("blur", this._handleWindowBlur); + WINDOW$1.addEventListener("focus", this._handleWindowFocus); + WINDOW$1.addEventListener("keydown", this._handleKeyboardEvent); + if (this.clickDetector) { + this.clickDetector.addListeners(); + } + if (!this._hasInitializedCoreListeners) { + addGlobalListeners(this); + this._hasInitializedCoreListeners = true; + } + } catch (err) { + this.handleException(err); + } + this._performanceCleanupCallback = setupPerformanceObserver(this); + } + /** + * Cleans up listeners that were created in `_addListeners` + */ + _removeListeners() { + try { + WINDOW$1.document.removeEventListener("visibilitychange", this._handleVisibilityChange); + WINDOW$1.removeEventListener("blur", this._handleWindowBlur); + WINDOW$1.removeEventListener("focus", this._handleWindowFocus); + WINDOW$1.removeEventListener("keydown", this._handleKeyboardEvent); + if (this.clickDetector) { + this.clickDetector.removeListeners(); + } + if (this._performanceCleanupCallback) { + this._performanceCleanupCallback(); + } + } catch (err) { + this.handleException(err); + } + } + /** + * Handle when visibility of the page content changes. Opening a new tab will + * cause the state to change to hidden because of content of current page will + * be hidden. Likewise, moving a different window to cover the contents of the + * page will also trigger a change to a hidden state. + */ + __init() { + this._handleVisibilityChange = () => { + if (WINDOW$1.document.visibilityState === "visible") { + this._doChangeToForegroundTasks(); + } else { + this._doChangeToBackgroundTasks(); + } + }; + } + /** + * Handle when page is blurred + */ + __init2() { + this._handleWindowBlur = () => { + const breadcrumb = createBreadcrumb({ + category: "ui.blur" + }); + this._doChangeToBackgroundTasks(breadcrumb); + }; + } + /** + * Handle when page is focused + */ + __init3() { + this._handleWindowFocus = () => { + const breadcrumb = createBreadcrumb({ + category: "ui.focus" + }); + this._doChangeToForegroundTasks(breadcrumb); + }; + } + /** Ensure page remains active when a key is pressed. */ + __init4() { + this._handleKeyboardEvent = (event) => { + handleKeyboardEvent(this, event); + }; + } + /** + * Tasks to run when we consider a page to be hidden (via blurring and/or visibility) + */ + _doChangeToBackgroundTasks(breadcrumb) { + if (!this.session) { + return; + } + const expired = isSessionExpired(this.session, { + maxReplayDuration: this._options.maxReplayDuration, + sessionIdleExpire: this.timeouts.sessionIdleExpire + }); + if (expired) { + return; + } + if (breadcrumb) { + this._createCustomBreadcrumb(breadcrumb); + } + void this.conditionalFlush(); + } + /** + * Tasks to run when we consider a page to be visible (via focus and/or visibility) + */ + _doChangeToForegroundTasks(breadcrumb) { + if (!this.session) { + return; + } + const isSessionActive = this.checkAndHandleExpiredSession(); + if (!isSessionActive) { + DEBUG_BUILD$2 && logger$1.info("Document has become active, but session has expired"); + return; + } + if (breadcrumb) { + this._createCustomBreadcrumb(breadcrumb); + } + } + /** + * Update user activity (across session lifespans) + */ + _updateUserActivity(_lastActivity = Date.now()) { + this._lastActivity = _lastActivity; + } + /** + * Updates the session's last activity timestamp + */ + _updateSessionActivity(_lastActivity = Date.now()) { + if (this.session) { + this.session.lastActivity = _lastActivity; + this._maybeSaveSession(); + } + } + /** + * Helper to create (and buffer) a replay breadcrumb from a core SDK breadcrumb + */ + _createCustomBreadcrumb(breadcrumb) { + this.addUpdate(() => { + this.throttledAddEvent({ + type: EventType.Custom, + timestamp: breadcrumb.timestamp || 0, + data: { + tag: "breadcrumb", + payload: breadcrumb + } + }); + }); + } + /** + * Observed performance events are added to `this.performanceEntries`. These + * are included in the replay event before it is finished and sent to Sentry. + */ + _addPerformanceEntries() { + let performanceEntries = createPerformanceEntries(this.performanceEntries).concat(this.replayPerformanceEntries); + this.performanceEntries = []; + this.replayPerformanceEntries = []; + if (this._requiresManualStart) { + const initialTimestampInSeconds = this._context.initialTimestamp / 1e3; + performanceEntries = performanceEntries.filter((entry) => entry.start >= initialTimestampInSeconds); + } + return Promise.all(createPerformanceSpans(this, performanceEntries)); + } + /** + * Clear _context + */ + _clearContext() { + this._context.errorIds.clear(); + this._context.traceIds.clear(); + this._context.urls = []; + } + /** Update the initial timestamp based on the buffer content. */ + _updateInitialTimestampFromEventBuffer() { + const { session, eventBuffer } = this; + if (!session || !eventBuffer || this._requiresManualStart) { + return; + } + if (session.segmentId) { + return; + } + const earliestEvent = eventBuffer.getEarliestTimestamp(); + if (earliestEvent && earliestEvent < this._context.initialTimestamp) { + this._context.initialTimestamp = earliestEvent; + } + } + /** + * Return and clear _context + */ + _popEventContext() { + const _context = { + initialTimestamp: this._context.initialTimestamp, + initialUrl: this._context.initialUrl, + errorIds: Array.from(this._context.errorIds), + traceIds: Array.from(this._context.traceIds), + urls: this._context.urls + }; + this._clearContext(); + return _context; + } + /** + * Flushes replay event buffer to Sentry. + * + * Performance events are only added right before flushing - this is + * due to the buffered performance observer events. + * + * Should never be called directly, only by `flush` + */ + async _runFlush() { + const replayId = this.getSessionId(); + if (!this.session || !this.eventBuffer || !replayId) { + DEBUG_BUILD$2 && logger$1.error("No session or eventBuffer found to flush."); + return; + } + await this._addPerformanceEntries(); + if (!this.eventBuffer || !this.eventBuffer.hasEvents) { + return; + } + await addMemoryEntry(this); + if (!this.eventBuffer) { + return; + } + if (replayId !== this.getSessionId()) { + return; + } + try { + this._updateInitialTimestampFromEventBuffer(); + const timestamp2 = Date.now(); + if (timestamp2 - this._context.initialTimestamp > this._options.maxReplayDuration + 3e4) { + throw new Error("Session is too long, not sending replay"); + } + const eventContext = this._popEventContext(); + const segmentId = this.session.segmentId++; + this._maybeSaveSession(); + const recordingData = await this.eventBuffer.finish(); + await sendReplay({ + replayId, + recordingData, + segmentId, + eventContext, + session: this.session, + timestamp: timestamp2, + onError: /* @__PURE__ */ __name((err) => this.handleException(err), "onError") + }); + } catch (err) { + this.handleException(err); + this.stop({ reason: "sendReplay" }); + const client = getClient(); + if (client) { + const dropReason = err instanceof RateLimitError ? "ratelimit_backoff" : "send_error"; + client.recordDroppedEvent(dropReason, "replay"); + } + } + } + /** + * Flush recording data to Sentry. Creates a lock so that only a single flush + * can be active at a time. Do not call this directly. + */ + __init5() { + this._flush = async ({ + force = false + } = {}) => { + if (!this._isEnabled && !force) { + return; + } + if (!this.checkAndHandleExpiredSession()) { + DEBUG_BUILD$2 && logger$1.error("Attempting to finish replay event after session expired."); + return; + } + if (!this.session) { + return; + } + const start2 = this.session.started; + const now2 = Date.now(); + const duration = now2 - start2; + this._debouncedFlush.cancel(); + const tooShort = duration < this._options.minReplayDuration; + const tooLong = duration > this._options.maxReplayDuration + 5e3; + if (tooShort || tooLong) { + DEBUG_BUILD$2 && logger$1.info( + `Session duration (${Math.floor(duration / 1e3)}s) is too ${tooShort ? "short" : "long"}, not sending replay.` + ); + if (tooShort) { + this._debouncedFlush(); + } + return; + } + const eventBuffer = this.eventBuffer; + if (eventBuffer && this.session.segmentId === 0 && !eventBuffer.hasCheckout) { + DEBUG_BUILD$2 && logger$1.info("Flushing initial segment without checkout."); + } + const _flushInProgress = !!this._flushLock; + if (!this._flushLock) { + this._flushLock = this._runFlush(); + } + try { + await this._flushLock; + } catch (err) { + this.handleException(err); + } finally { + this._flushLock = void 0; + if (_flushInProgress) { + this._debouncedFlush(); + } + } + }; + } + /** Save the session, if it is sticky */ + _maybeSaveSession() { + if (this.session && this._options.stickySession) { + saveSession(this.session); + } + } + /** Handler for rrweb.record.onMutation */ + __init6() { + this._onMutationHandler = (mutations) => { + const count = mutations.length; + const mutationLimit = this._options.mutationLimit; + const mutationBreadcrumbLimit = this._options.mutationBreadcrumbLimit; + const overMutationLimit = mutationLimit && count > mutationLimit; + if (count > mutationBreadcrumbLimit || overMutationLimit) { + const breadcrumb = createBreadcrumb({ + category: "replay.mutations", + data: { + count, + limit: overMutationLimit + } + }); + this._createCustomBreadcrumb(breadcrumb); + } + if (overMutationLimit) { + this.stop({ reason: "mutationLimit", forceFlush: this.recordingMode === "session" }); + return false; + } + return true; + }; + } +} +function getOption(selectors, defaultSelectors) { + return [ + ...selectors, + // sentry defaults + ...defaultSelectors + ].join(","); +} +__name(getOption, "getOption"); +function getPrivacyOptions({ mask: mask3, unmask, block: block3, unblock: unblock2, ignore }) { + const defaultBlockedElements = ["base", "iframe[srcdoc]:not([src])"]; + const maskSelector = getOption(mask3, [".sentry-mask", "[data-sentry-mask]"]); + const unmaskSelector = getOption(unmask, []); + const options4 = { + // We are making the decision to make text and input selectors the same + maskTextSelector: maskSelector, + unmaskTextSelector: unmaskSelector, + blockSelector: getOption(block3, [".sentry-block", "[data-sentry-block]", ...defaultBlockedElements]), + unblockSelector: getOption(unblock2, []), + ignoreSelector: getOption(ignore, [".sentry-ignore", "[data-sentry-ignore]", 'input[type="file"]']) + }; + return options4; +} +__name(getPrivacyOptions, "getPrivacyOptions"); +function maskAttribute({ + el, + key, + maskAttributes, + maskAllText, + privacyOptions, + value: value4 +}) { + if (!maskAllText) { + return value4; + } + if (privacyOptions.unmaskTextSelector && el.matches(privacyOptions.unmaskTextSelector)) { + return value4; + } + if (maskAttributes.includes(key) || // Need to mask `value` attribute for `` if it's a button-like + // type + key === "value" && el.tagName === "INPUT" && ["submit", "button"].includes(el.getAttribute("type") || "")) { + return value4.replace(/[\S]/g, "*"); + } + return value4; +} +__name(maskAttribute, "maskAttribute"); +const MEDIA_SELECTORS = 'img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]'; +const DEFAULT_NETWORK_HEADERS = ["content-length", "content-type", "accept"]; +let _initialized = false; +const replayIntegration = /* @__PURE__ */ __name((options4) => { + return new Replay(options4); +}, "replayIntegration"); +class Replay { + static { + __name(this, "Replay"); + } + /** + * @inheritDoc + */ + static __initStatic() { + this.id = "Replay"; + } + /** + * @inheritDoc + */ + /** + * Options to pass to `rrweb.record()` + */ + /** + * Initial options passed to the replay integration, merged with default values. + * Note: `sessionSampleRate` and `errorSampleRate` are not required here, as they + * can only be finally set when setupOnce() is called. + * + * @private + */ + constructor({ + flushMinDelay = DEFAULT_FLUSH_MIN_DELAY, + flushMaxDelay = DEFAULT_FLUSH_MAX_DELAY, + minReplayDuration = MIN_REPLAY_DURATION, + maxReplayDuration = MAX_REPLAY_DURATION, + stickySession = true, + useCompression = true, + workerUrl, + _experiments = {}, + maskAllText = true, + maskAllInputs = true, + blockAllMedia = true, + mutationBreadcrumbLimit = 750, + mutationLimit = 1e4, + slowClickTimeout = 7e3, + slowClickIgnoreSelectors = [], + networkDetailAllowUrls = [], + networkDetailDenyUrls = [], + networkCaptureBodies = true, + networkRequestHeaders = [], + networkResponseHeaders = [], + mask: mask3 = [], + maskAttributes = ["title", "placeholder"], + unmask = [], + block: block3 = [], + unblock: unblock2 = [], + ignore = [], + maskFn, + beforeAddRecordingEvent, + beforeErrorSampling, + onError + } = {}) { + this.name = Replay.id; + const privacyOptions = getPrivacyOptions({ + mask: mask3, + unmask, + block: block3, + unblock: unblock2, + ignore + }); + this._recordingOptions = { + maskAllInputs, + maskAllText, + maskInputOptions: { password: true }, + maskTextFn: maskFn, + maskInputFn: maskFn, + maskAttributeFn: /* @__PURE__ */ __name((key, value4, el) => maskAttribute({ + maskAttributes, + maskAllText, + privacyOptions, + key, + value: value4, + el + }), "maskAttributeFn"), + ...privacyOptions, + // Our defaults + slimDOMOptions: "all", + inlineStylesheet: true, + // Disable inline images as it will increase segment/replay size + inlineImages: false, + // collect fonts, but be aware that `sentry.io` needs to be an allowed + // origin for playback + collectFonts: true, + errorHandler: /* @__PURE__ */ __name((err) => { + try { + err.__rrweb__ = true; + } catch (error2) { + } + }, "errorHandler") + }; + this._initialOptions = { + flushMinDelay, + flushMaxDelay, + minReplayDuration: Math.min(minReplayDuration, MIN_REPLAY_DURATION_LIMIT), + maxReplayDuration: Math.min(maxReplayDuration, MAX_REPLAY_DURATION), + stickySession, + useCompression, + workerUrl, + blockAllMedia, + maskAllInputs, + maskAllText, + mutationBreadcrumbLimit, + mutationLimit, + slowClickTimeout, + slowClickIgnoreSelectors, + networkDetailAllowUrls, + networkDetailDenyUrls, + networkCaptureBodies, + networkRequestHeaders: _getMergedNetworkHeaders(networkRequestHeaders), + networkResponseHeaders: _getMergedNetworkHeaders(networkResponseHeaders), + beforeAddRecordingEvent, + beforeErrorSampling, + onError, + _experiments + }; + if (this._initialOptions.blockAllMedia) { + this._recordingOptions.blockSelector = !this._recordingOptions.blockSelector ? MEDIA_SELECTORS : `${this._recordingOptions.blockSelector},${MEDIA_SELECTORS}`; + } + if (this._isInitialized && isBrowser$1()) { + throw new Error("Multiple Sentry Session Replay instances are not supported"); + } + this._isInitialized = true; + } + /** If replay has already been initialized */ + get _isInitialized() { + return _initialized; + } + /** Update _isInitialized */ + set _isInitialized(value4) { + _initialized = value4; + } + /** + * Setup and initialize replay container + */ + afterAllSetup(client) { + if (!isBrowser$1() || this._replay) { + return; + } + this._setup(client); + this._initialize(client); + } + /** + * Start a replay regardless of sampling rate. Calling this will always + * create a new session. Will log a message if replay is already in progress. + * + * Creates or loads a session, attaches listeners to varying events (DOM, + * PerformanceObserver, Recording, Sentry SDK, etc) + */ + start() { + if (!this._replay) { + return; + } + this._replay.start(); + } + /** + * Start replay buffering. Buffers until `flush()` is called or, if + * `replaysOnErrorSampleRate` > 0, until an error occurs. + */ + startBuffering() { + if (!this._replay) { + return; + } + this._replay.startBuffering(); + } + /** + * Currently, this needs to be manually called (e.g. for tests). Sentry SDK + * does not support a teardown + */ + stop() { + if (!this._replay) { + return Promise.resolve(); + } + return this._replay.stop({ forceFlush: this._replay.recordingMode === "session" }); + } + /** + * If not in "session" recording mode, flush event buffer which will create a new replay. + * If replay is not enabled, a new session replay is started. + * Unless `continueRecording` is false, the replay will continue to record and + * behave as a "session"-based replay. + * + * Otherwise, queue up a flush. + */ + flush(options4) { + if (!this._replay) { + return Promise.resolve(); + } + if (!this._replay.isEnabled()) { + this._replay.start(); + return Promise.resolve(); + } + return this._replay.sendBufferedReplayOrFlush(options4); + } + /** + * Get the current session ID. + */ + getReplayId() { + if (!this._replay || !this._replay.isEnabled()) { + return; + } + return this._replay.getSessionId(); + } + /** + * Get the current recording mode. This can be either `session` or `buffer`. + * + * `session`: Recording the whole session, sending it continuously + * `buffer`: Always keeping the last 60s of recording, requires: + * - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs + * - or calling `flush()` to send the replay + */ + getRecordingMode() { + if (!this._replay || !this._replay.isEnabled()) { + return; + } + return this._replay.recordingMode; + } + /** + * Initializes replay. + */ + _initialize(client) { + if (!this._replay) { + return; + } + this._maybeLoadFromReplayCanvasIntegration(client); + this._replay.initializeSampling(); + } + /** Setup the integration. */ + _setup(client) { + const finalOptions = loadReplayOptionsFromClient(this._initialOptions, client); + this._replay = new ReplayContainer({ + options: finalOptions, + recordingOptions: this._recordingOptions + }); + } + /** Get canvas options from ReplayCanvas integration, if it is also added. */ + _maybeLoadFromReplayCanvasIntegration(client) { + try { + const canvasIntegration = client.getIntegrationByName("ReplayCanvas"); + if (!canvasIntegration) { + return; + } + this._replay["_canvas"] = canvasIntegration.getOptions(); + } catch (e2) { + } + } +} +Replay.__initStatic(); +function loadReplayOptionsFromClient(initialOptions, client) { + const opt = client.getOptions(); + const finalOptions = { + sessionSampleRate: 0, + errorSampleRate: 0, + ...dropUndefinedKeys(initialOptions) + }; + const replaysSessionSampleRate = parseSampleRate(opt.replaysSessionSampleRate); + const replaysOnErrorSampleRate = parseSampleRate(opt.replaysOnErrorSampleRate); + if (replaysSessionSampleRate == null && replaysOnErrorSampleRate == null) { + consoleSandbox(() => { + console.warn( + "Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set." + ); + }); + } + if (replaysSessionSampleRate != null) { + finalOptions.sessionSampleRate = replaysSessionSampleRate; + } + if (replaysOnErrorSampleRate != null) { + finalOptions.errorSampleRate = replaysOnErrorSampleRate; + } + return finalOptions; +} +__name(loadReplayOptionsFromClient, "loadReplayOptionsFromClient"); +function _getMergedNetworkHeaders(headers) { + return [...DEFAULT_NETWORK_HEADERS, ...headers.map((header3) => header3.toLowerCase())]; +} +__name(_getMergedNetworkHeaders, "_getMergedNetworkHeaders"); +function getReplay() { + const client = getClient(); + return client && client.getIntegrationByName("Replay"); +} +__name(getReplay, "getReplay"); +var NodeType$2; +(function(NodeType3) { + NodeType3[NodeType3["Document"] = 0] = "Document"; + NodeType3[NodeType3["DocumentType"] = 1] = "DocumentType"; + NodeType3[NodeType3["Element"] = 2] = "Element"; + NodeType3[NodeType3["Text"] = 3] = "Text"; + NodeType3[NodeType3["CDATA"] = 4] = "CDATA"; + NodeType3[NodeType3["Comment"] = 5] = "Comment"; +})(NodeType$2 || (NodeType$2 = {})); +function elementClassMatchesRegex(el, regex2) { + for (let eIndex = el.classList.length; eIndex--; ) { + const className = el.classList[eIndex]; + if (regex2.test(className)) { + return true; + } + } + return false; +} +__name(elementClassMatchesRegex, "elementClassMatchesRegex"); +function distanceToMatch(node3, matchPredicate, limit = Infinity, distance2 = 0) { + if (!node3) + return -1; + if (node3.nodeType !== node3.ELEMENT_NODE) + return -1; + if (distance2 > limit) + return -1; + if (matchPredicate(node3)) + return distance2; + return distanceToMatch(node3.parentNode, matchPredicate, limit, distance2 + 1); +} +__name(distanceToMatch, "distanceToMatch"); +function createMatchPredicate(className, selector) { + return (node3) => { + const el = node3; + if (el === null) + return false; + try { + if (className) { + if (typeof className === "string") { + if (el.matches(`.${className}`)) + return true; + } else if (elementClassMatchesRegex(el, className)) { + return true; + } + } + if (selector && el.matches(selector)) + return true; + return false; + } catch (e2) { + return false; + } + }; +} +__name(createMatchPredicate, "createMatchPredicate"); +const DEPARTED_MIRROR_ACCESS_WARNING = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording."; +let _mirror = { + map: {}, + getId() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING); + return -1; + }, + getNode() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING); + return null; + }, + removeNodeFromMap() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING); + }, + has() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING); + return false; + }, + reset() { + console.error(DEPARTED_MIRROR_ACCESS_WARNING); + } +}; +if (typeof window !== "undefined" && window.Proxy && window.Reflect) { + _mirror = new Proxy(_mirror, { + get(target, prop2, receiver) { + if (prop2 === "map") { + console.error(DEPARTED_MIRROR_ACCESS_WARNING); + } + return Reflect.get(target, prop2, receiver); + } + }); +} +function hookSetter(target, key, d2, isRevoked, win = window) { + const original = win.Object.getOwnPropertyDescriptor(target, key); + win.Object.defineProperty(target, key, isRevoked ? d2 : { + set(value4) { + setTimeout$1(() => { + d2.set.call(this, value4); + }, 0); + if (original && original.set) { + original.set.call(this, value4); + } + } + }); + return () => hookSetter(target, key, original || {}, true); +} +__name(hookSetter, "hookSetter"); +function patch$1(source, name2, replacement) { + try { + if (!(name2 in source)) { + return () => { + }; + } + const original = source[name2]; + const wrapped = replacement(original); + if (typeof wrapped === "function") { + wrapped.prototype = wrapped.prototype || {}; + Object.defineProperties(wrapped, { + __rrweb_original__: { + enumerable: false, + value: original + } + }); + } + source[name2] = wrapped; + return () => { + source[name2] = original; + }; + } catch (e2) { + return () => { + }; + } +} +__name(patch$1, "patch$1"); +if (!/[1-9][0-9]{12}/.test(Date.now().toString())) ; +function closestElementOfNode(node3) { + if (!node3) { + return null; + } + const el = node3.nodeType === node3.ELEMENT_NODE ? node3 : node3.parentElement; + return el; +} +__name(closestElementOfNode, "closestElementOfNode"); +function isBlocked(node3, blockClass, blockSelector, unblockSelector, checkAncestors) { + if (!node3) { + return false; + } + const el = closestElementOfNode(node3); + if (!el) { + return false; + } + const blockedPredicate = createMatchPredicate(blockClass, blockSelector); + const blockDistance = distanceToMatch(el, blockedPredicate); + let unblockDistance = -1; + if (blockDistance < 0) { + return false; + } + if (unblockSelector) { + unblockDistance = distanceToMatch(el, createMatchPredicate(null, unblockSelector)); + } + if (blockDistance > -1 && unblockDistance < 0) { + return true; + } + return blockDistance < unblockDistance; +} +__name(isBlocked, "isBlocked"); +const cachedImplementations = {}; +function getImplementation(name2) { + const cached = cachedImplementations[name2]; + if (cached) { + return cached; + } + const document2 = window.document; + let impl = window[name2]; + if (document2 && typeof document2.createElement === "function") { + try { + const sandbox = document2.createElement("iframe"); + sandbox.hidden = true; + document2.head.appendChild(sandbox); + const contentWindow = sandbox.contentWindow; + if (contentWindow && contentWindow[name2]) { + impl = contentWindow[name2]; + } + document2.head.removeChild(sandbox); + } catch (e2) { + } + } + return cachedImplementations[name2] = impl.bind(window); +} +__name(getImplementation, "getImplementation"); +function onRequestAnimationFrame(...rest) { + return getImplementation("requestAnimationFrame")(...rest); +} +__name(onRequestAnimationFrame, "onRequestAnimationFrame"); +function setTimeout$1(...rest) { + return getImplementation("setTimeout")(...rest); +} +__name(setTimeout$1, "setTimeout$1"); +var CanvasContext = /* @__PURE__ */ ((CanvasContext2) => { + CanvasContext2[CanvasContext2["2D"] = 0] = "2D"; + CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL"; + CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2"; + return CanvasContext2; +})(CanvasContext || {}); +let errorHandler; +function registerErrorHandler(handler6) { + errorHandler = handler6; +} +__name(registerErrorHandler, "registerErrorHandler"); +const callbackWrapper = /* @__PURE__ */ __name((cb) => { + if (!errorHandler) { + return cb; + } + const rrwebWrapped = /* @__PURE__ */ __name((...rest) => { + try { + return cb(...rest); + } catch (error2) { + if (errorHandler && errorHandler(error2) === true) { + return () => { + }; + } + throw error2; + } + }, "rrwebWrapped"); + return rrwebWrapped; +}, "callbackWrapper"); +var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256); +for (var i$3 = 0; i$3 < chars.length; i$3++) { + lookup[chars.charCodeAt(i$3)] = i$3; +} +var encode$5 = /* @__PURE__ */ __name(function(arraybuffer) { + var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = ""; + for (i2 = 0; i2 < len; i2 += 3) { + base64 += chars[bytes[i2] >> 2]; + base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4]; + base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6]; + base64 += chars[bytes[i2 + 2] & 63]; + } + if (len % 3 === 2) { + base64 = base64.substring(0, base64.length - 1) + "="; + } else if (len % 3 === 1) { + base64 = base64.substring(0, base64.length - 2) + "=="; + } + return base64; +}, "encode$5"); +const canvasVarMap = /* @__PURE__ */ new Map(); +function variableListFor(ctx, ctor) { + let contextMap = canvasVarMap.get(ctx); + if (!contextMap) { + contextMap = /* @__PURE__ */ new Map(); + canvasVarMap.set(ctx, contextMap); + } + if (!contextMap.has(ctor)) { + contextMap.set(ctor, []); + } + return contextMap.get(ctor); +} +__name(variableListFor, "variableListFor"); +const saveWebGLVar = /* @__PURE__ */ __name((value4, win, ctx) => { + if (!value4 || !(isInstanceOfWebGLObject(value4, win) || typeof value4 === "object")) + return; + const name2 = value4.constructor.name; + const list2 = variableListFor(ctx, name2); + let index2 = list2.indexOf(value4); + if (index2 === -1) { + index2 = list2.length; + list2.push(value4); + } + return index2; +}, "saveWebGLVar"); +function serializeArg(value4, win, ctx) { + if (value4 instanceof Array) { + return value4.map((arg) => serializeArg(arg, win, ctx)); + } else if (value4 === null) { + return value4; + } else if (value4 instanceof Float32Array || value4 instanceof Float64Array || value4 instanceof Int32Array || value4 instanceof Uint32Array || value4 instanceof Uint8Array || value4 instanceof Uint16Array || value4 instanceof Int16Array || value4 instanceof Int8Array || value4 instanceof Uint8ClampedArray) { + const name2 = value4.constructor.name; + return { + rr_type: name2, + args: [Object.values(value4)] + }; + } else if (value4 instanceof ArrayBuffer) { + const name2 = value4.constructor.name; + const base64 = encode$5(value4); + return { + rr_type: name2, + base64 + }; + } else if (value4 instanceof DataView) { + const name2 = value4.constructor.name; + return { + rr_type: name2, + args: [ + serializeArg(value4.buffer, win, ctx), + value4.byteOffset, + value4.byteLength + ] + }; + } else if (value4 instanceof HTMLImageElement) { + const name2 = value4.constructor.name; + const { src } = value4; + return { + rr_type: name2, + src + }; + } else if (value4 instanceof HTMLCanvasElement) { + const name2 = "HTMLImageElement"; + const src = value4.toDataURL(); + return { + rr_type: name2, + src + }; + } else if (value4 instanceof ImageData) { + const name2 = value4.constructor.name; + return { + rr_type: name2, + args: [serializeArg(value4.data, win, ctx), value4.width, value4.height] + }; + } else if (isInstanceOfWebGLObject(value4, win) || typeof value4 === "object") { + const name2 = value4.constructor.name; + const index2 = saveWebGLVar(value4, win, ctx); + return { + rr_type: name2, + index: index2 + }; + } + return value4; +} +__name(serializeArg, "serializeArg"); +const serializeArgs = /* @__PURE__ */ __name((args, win, ctx) => { + return args.map((arg) => serializeArg(arg, win, ctx)); +}, "serializeArgs"); +const isInstanceOfWebGLObject = /* @__PURE__ */ __name((value4, win) => { + const webGLConstructorNames = [ + "WebGLActiveInfo", + "WebGLBuffer", + "WebGLFramebuffer", + "WebGLProgram", + "WebGLRenderbuffer", + "WebGLShader", + "WebGLShaderPrecisionFormat", + "WebGLTexture", + "WebGLUniformLocation", + "WebGLVertexArrayObject", + "WebGLVertexArrayObjectOES" + ]; + const supportedWebGLConstructorNames = webGLConstructorNames.filter((name2) => typeof win[name2] === "function"); + return Boolean(supportedWebGLConstructorNames.find((name2) => value4 instanceof win[name2])); +}, "isInstanceOfWebGLObject"); +function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector, unblockSelector) { + const handlers2 = []; + const props2D = Object.getOwnPropertyNames(win.CanvasRenderingContext2D.prototype); + for (const prop2 of props2D) { + try { + if (typeof win.CanvasRenderingContext2D.prototype[prop2] !== "function") { + continue; + } + const restoreHandler = patch$1(win.CanvasRenderingContext2D.prototype, prop2, function(original) { + return function(...args) { + if (!isBlocked(this.canvas, blockClass, blockSelector, unblockSelector, true)) { + setTimeout$1(() => { + const recordArgs = serializeArgs(args, win, this); + cb(this.canvas, { + type: CanvasContext["2D"], + property: prop2, + args: recordArgs + }); + }, 0); + } + return original.apply(this, args); + }; + }); + handlers2.push(restoreHandler); + } catch (e2) { + const hookHandler = hookSetter(win.CanvasRenderingContext2D.prototype, prop2, { + set(v2) { + cb(this.canvas, { + type: CanvasContext["2D"], + property: prop2, + args: [v2], + setter: true + }); + } + }); + handlers2.push(hookHandler); + } + } + return () => { + handlers2.forEach((h2) => h2()); + }; +} +__name(initCanvas2DMutationObserver, "initCanvas2DMutationObserver"); +function getNormalizedContextName(contextType) { + return contextType === "experimental-webgl" ? "webgl" : contextType; +} +__name(getNormalizedContextName, "getNormalizedContextName"); +function initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, setPreserveDrawingBufferToTrue) { + const handlers2 = []; + try { + const restoreHandler = patch$1(win.HTMLCanvasElement.prototype, "getContext", function(original) { + return function(contextType, ...args) { + if (!isBlocked(this, blockClass, blockSelector, unblockSelector, true)) { + const ctxName = getNormalizedContextName(contextType); + if (!("__context" in this)) + this.__context = ctxName; + if (setPreserveDrawingBufferToTrue && ["webgl", "webgl2"].includes(ctxName)) { + if (args[0] && typeof args[0] === "object") { + const contextAttributes = args[0]; + if (!contextAttributes.preserveDrawingBuffer) { + contextAttributes.preserveDrawingBuffer = true; + } + } else { + args.splice(0, 1, { + preserveDrawingBuffer: true + }); + } + } + } + return original.apply(this, [contextType, ...args]); + }; + }); + handlers2.push(restoreHandler); + } catch (e2) { + console.error("failed to patch HTMLCanvasElement.prototype.getContext"); + } + return () => { + handlers2.forEach((h2) => h2()); + }; +} +__name(initCanvasContextObserver, "initCanvasContextObserver"); +function patchGLPrototype(prototype2, type, cb, blockClass, blockSelector, unblockSelector, mirror2, win) { + const handlers2 = []; + const props = Object.getOwnPropertyNames(prototype2); + for (const prop2 of props) { + if ([ + "isContextLost", + "canvas", + "drawingBufferWidth", + "drawingBufferHeight" + ].includes(prop2)) { + continue; + } + try { + if (typeof prototype2[prop2] !== "function") { + continue; + } + const restoreHandler = patch$1(prototype2, prop2, function(original) { + return function(...args) { + const result = original.apply(this, args); + saveWebGLVar(result, win, this); + if ("tagName" in this.canvas && !isBlocked(this.canvas, blockClass, blockSelector, unblockSelector, true)) { + const recordArgs = serializeArgs(args, win, this); + const mutation = { + type, + property: prop2, + args: recordArgs + }; + cb(this.canvas, mutation); + } + return result; + }; + }); + handlers2.push(restoreHandler); + } catch (e2) { + const hookHandler = hookSetter(prototype2, prop2, { + set(v2) { + cb(this.canvas, { + type, + property: prop2, + args: [v2], + setter: true + }); + } + }); + handlers2.push(hookHandler); + } + } + return handlers2; +} +__name(patchGLPrototype, "patchGLPrototype"); +function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector, unblockSelector, mirror2) { + const handlers2 = []; + handlers2.push(...patchGLPrototype(win.WebGLRenderingContext.prototype, CanvasContext.WebGL, cb, blockClass, blockSelector, unblockSelector, mirror2, win)); + if (typeof win.WebGL2RenderingContext !== "undefined") { + handlers2.push(...patchGLPrototype(win.WebGL2RenderingContext.prototype, CanvasContext.WebGL2, cb, blockClass, blockSelector, unblockSelector, mirror2, win)); + } + return () => { + handlers2.forEach((h2) => h2()); + }; +} +__name(initCanvasWebGLMutationObserver, "initCanvasWebGLMutationObserver"); +var r$2 = `for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<64;a++)t[e.charCodeAt(a)]=a;var n=function(t){var a,n=new Uint8Array(t),r=n.length,s="";for(a=0;a>2],s+=e[(3&n[a])<<4|n[a+1]>>4],s+=e[(15&n[a+1])<<2|n[a+2]>>6],s+=e[63&n[a+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const r=new Map,s=new Map;const i=self;i.onmessage=async function(e){if(!("OffscreenCanvas"in globalThis))return i.postMessage({id:e.data.id});{const{id:t,bitmap:a,width:o,height:f,maxCanvasSize:c,dataURLOptions:g}=e.data,u=async function(e,t,a){const r=e+"-"+t;if("OffscreenCanvas"in globalThis){if(s.has(r))return s.get(r);const i=new OffscreenCanvas(e,t);i.getContext("2d");const o=await i.convertToBlob(a),f=await o.arrayBuffer(),c=n(f);return s.set(r,c),c}return""}(o,f,g),[h,d]=function(e,t,a){if(!a)return[e,t];const[n,r]=a;if(e<=n&&t<=r)return[e,t];let s=e,i=t;return s>n&&(i=Math.floor(n*t/e),s=n),i>r&&(s=Math.floor(r*e/t),i=r),[s,i]}(o,f,c),l=new OffscreenCanvas(h,d),w=l.getContext("bitmaprenderer"),p=h===o&&d===f?a:await createImageBitmap(a,{resizeWidth:h,resizeHeight:d,resizeQuality:"low"});w.transferFromImageBitmap(p),a.close();const y=await l.convertToBlob(g),v=y.type,b=await y.arrayBuffer(),m=n(b);if(p.close(),!r.has(t)&&await u===m)return r.set(t,m),i.postMessage({id:t});if(r.get(t)===m)return i.postMessage({id:t});i.postMessage({id:t,type:v,base64:m,width:o,height:f}),r.set(t,m)}};`; +function t$2() { + const t2 = new Blob([r$2]); + return URL.createObjectURL(t2); +} +__name(t$2, "t$2"); +class CanvasManager { + static { + __name(this, "CanvasManager"); + } + reset() { + this.pendingCanvasMutations.clear(); + this.restoreHandlers.forEach((handler6) => { + try { + handler6(); + } catch (e2) { + } + }); + this.restoreHandlers = []; + this.windowsSet = /* @__PURE__ */ new WeakSet(); + this.windows = []; + this.shadowDoms = /* @__PURE__ */ new Set(); + _optionalChain([this, "access", (_2) => _2.worker, "optionalAccess", (_2) => _2.terminate, "call", (_3) => _3()]); + this.worker = null; + this.snapshotInProgressMap = /* @__PURE__ */ new Map(); + } + freeze() { + this.frozen = true; + } + unfreeze() { + this.frozen = false; + } + lock() { + this.locked = true; + } + unlock() { + this.locked = false; + } + constructor(options4) { + this.pendingCanvasMutations = /* @__PURE__ */ new Map(); + this.rafStamps = { latestId: 0, invokeId: null }; + this.shadowDoms = /* @__PURE__ */ new Set(); + this.windowsSet = /* @__PURE__ */ new WeakSet(); + this.windows = []; + this.restoreHandlers = []; + this.frozen = false; + this.locked = false; + this.snapshotInProgressMap = /* @__PURE__ */ new Map(); + this.worker = null; + this.processMutation = (target, mutation) => { + const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId; + if (newFrame || !this.rafStamps.invokeId) + this.rafStamps.invokeId = this.rafStamps.latestId; + if (!this.pendingCanvasMutations.has(target)) { + this.pendingCanvasMutations.set(target, []); + } + this.pendingCanvasMutations.get(target).push(mutation); + }; + const { sampling = "all", win, blockClass, blockSelector, unblockSelector, maxCanvasSize, recordCanvas, dataURLOptions, errorHandler: errorHandler2 } = options4; + this.mutationCb = options4.mutationCb; + this.mirror = options4.mirror; + this.options = options4; + if (errorHandler2) { + registerErrorHandler(errorHandler2); + } + if (recordCanvas && typeof sampling === "number" || options4.enableManualSnapshot) { + this.worker = this.initFPSWorker(); + } + this.addWindow(win); + if (options4.enableManualSnapshot) { + return; + } + callbackWrapper(() => { + if (recordCanvas && sampling === "all") { + this.startRAFTimestamping(); + this.startPendingCanvasMutationFlusher(); + } + if (recordCanvas && typeof sampling === "number") { + this.initCanvasFPSObserver(sampling, blockClass, blockSelector, unblockSelector, maxCanvasSize, { + dataURLOptions + }); + } + })(); + } + addWindow(win) { + const { sampling = "all", blockClass, blockSelector, unblockSelector, recordCanvas, enableManualSnapshot } = this.options; + if (this.windowsSet.has(win)) + return; + if (enableManualSnapshot) { + this.windowsSet.add(win); + this.windows.push(new WeakRef(win)); + return; + } + callbackWrapper(() => { + if (recordCanvas && sampling === "all") { + this.initCanvasMutationObserver(win, blockClass, blockSelector, unblockSelector); + } + if (recordCanvas && typeof sampling === "number") { + const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, true); + this.restoreHandlers.push(() => { + canvasContextReset(); + }); + } + })(); + this.windowsSet.add(win); + this.windows.push(new WeakRef(win)); + } + addShadowRoot(shadowRoot) { + this.shadowDoms.add(new WeakRef(shadowRoot)); + } + resetShadowRoots() { + this.shadowDoms = /* @__PURE__ */ new Set(); + } + initFPSWorker() { + const worker = new Worker(t$2()); + worker.onmessage = (e2) => { + const data25 = e2.data; + const { id: id3 } = data25; + this.snapshotInProgressMap.set(id3, false); + if (!("base64" in data25)) + return; + const { base64, type, width: width2, height } = data25; + this.mutationCb({ + id: id3, + type: CanvasContext["2D"], + commands: [ + { + property: "clearRect", + args: [0, 0, width2, height] + }, + { + property: "drawImage", + args: [ + { + rr_type: "ImageBitmap", + args: [ + { + rr_type: "Blob", + data: [{ rr_type: "ArrayBuffer", base64 }], + type + } + ] + }, + 0, + 0, + width2, + height + ] + } + ] + }); + }; + return worker; + } + initCanvasFPSObserver(fps, blockClass, blockSelector, unblockSelector, maxCanvasSize, options4) { + const rafId = this.takeSnapshot(false, fps, blockClass, blockSelector, unblockSelector, maxCanvasSize, options4.dataURLOptions); + this.restoreHandlers.push(() => { + cancelAnimationFrame(rafId); + }); + } + initCanvasMutationObserver(win, blockClass, blockSelector, unblockSelector) { + const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, false); + const canvas2DReset = initCanvas2DMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector, unblockSelector); + const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector, unblockSelector, this.mirror); + this.restoreHandlers.push(() => { + canvasContextReset(); + canvas2DReset(); + canvasWebGL1and2Reset(); + }); + } + snapshot(canvasElement) { + const { options: options4 } = this; + const rafId = this.takeSnapshot(true, options4.sampling === "all" ? 2 : options4.sampling || 2, options4.blockClass, options4.blockSelector, options4.unblockSelector, options4.maxCanvasSize, options4.dataURLOptions, canvasElement); + this.restoreHandlers.push(() => { + cancelAnimationFrame(rafId); + }); + } + takeSnapshot(isManualSnapshot, fps, blockClass, blockSelector, unblockSelector, maxCanvasSize, dataURLOptions, canvasElement) { + const timeBetweenSnapshots = 1e3 / fps; + let lastSnapshotTime = 0; + let rafId; + const getCanvas = /* @__PURE__ */ __name((canvasElement2) => { + if (canvasElement2) { + return [canvasElement2]; + } + const matchedCanvas = []; + const searchCanvas = /* @__PURE__ */ __name((root27) => { + root27.querySelectorAll("canvas").forEach((canvas) => { + if (!isBlocked(canvas, blockClass, blockSelector, unblockSelector)) { + matchedCanvas.push(canvas); + } + }); + }, "searchCanvas"); + for (const item3 of this.windows) { + const window2 = item3.deref(); + if (window2) { + searchCanvas(window2.document); + } + } + for (const item3 of this.shadowDoms) { + const shadowRoot = item3.deref(); + if (shadowRoot) { + searchCanvas(shadowRoot); + } + } + return matchedCanvas; + }, "getCanvas"); + const takeCanvasSnapshots = /* @__PURE__ */ __name((timestamp2) => { + if (!this.windows.length) { + return; + } + if (lastSnapshotTime && timestamp2 - lastSnapshotTime < timeBetweenSnapshots) { + rafId = onRequestAnimationFrame(takeCanvasSnapshots); + return; + } + lastSnapshotTime = timestamp2; + getCanvas(canvasElement).forEach((canvas) => { + if (!this.mirror.hasNode(canvas)) { + return; + } + const id3 = this.mirror.getId(canvas); + if (this.snapshotInProgressMap.get(id3)) + return; + if (!canvas.width || !canvas.height) + return; + this.snapshotInProgressMap.set(id3, true); + if (!isManualSnapshot && ["webgl", "webgl2"].includes(canvas.__context)) { + const context = canvas.getContext(canvas.__context); + if (_optionalChain([context, "optionalAccess", (_4) => _4.getContextAttributes, "call", (_5) => _5(), "optionalAccess", (_6) => _6.preserveDrawingBuffer]) === false) { + context.clear(context.COLOR_BUFFER_BIT); + } + } + createImageBitmap(canvas).then((bitmap) => { + _optionalChain([this, "access", (_7) => _7.worker, "optionalAccess", (_8) => _8.postMessage, "call", (_9) => _9({ + id: id3, + bitmap, + width: canvas.width, + height: canvas.height, + dataURLOptions, + maxCanvasSize + }, [bitmap])]); + }).catch((error2) => { + callbackWrapper(() => { + throw error2; + })(); + }); + }); + if (!isManualSnapshot) { + rafId = onRequestAnimationFrame(takeCanvasSnapshots); + } + }, "takeCanvasSnapshots"); + rafId = onRequestAnimationFrame(takeCanvasSnapshots); + return rafId; + } + startPendingCanvasMutationFlusher() { + onRequestAnimationFrame(() => this.flushPendingCanvasMutations()); + } + startRAFTimestamping() { + const setLatestRAFTimestamp = /* @__PURE__ */ __name((timestamp2) => { + this.rafStamps.latestId = timestamp2; + onRequestAnimationFrame(setLatestRAFTimestamp); + }, "setLatestRAFTimestamp"); + onRequestAnimationFrame(setLatestRAFTimestamp); + } + flushPendingCanvasMutations() { + this.pendingCanvasMutations.forEach((values, canvas) => { + const id3 = this.mirror.getId(canvas); + this.flushPendingCanvasMutationFor(canvas, id3); + }); + onRequestAnimationFrame(() => this.flushPendingCanvasMutations()); + } + flushPendingCanvasMutationFor(canvas, id3) { + if (this.frozen || this.locked) { + return; + } + const valuesWithType = this.pendingCanvasMutations.get(canvas); + if (!valuesWithType || id3 === -1) + return; + const values = valuesWithType.map((value4) => { + const { type: type2, ...rest } = value4; + return rest; + }); + const { type } = valuesWithType[0]; + this.mutationCb({ id: id3, type, commands: values }); + this.pendingCanvasMutations.delete(canvas); + } +} +const CANVAS_QUALITY = { + low: { + sampling: { + canvas: 1 + }, + dataURLOptions: { + type: "image/webp", + quality: 0.25 + } + }, + medium: { + sampling: { + canvas: 2 + }, + dataURLOptions: { + type: "image/webp", + quality: 0.4 + } + }, + high: { + sampling: { + canvas: 4 + }, + dataURLOptions: { + type: "image/webp", + quality: 0.5 + } + } +}; +const INTEGRATION_NAME$3 = "ReplayCanvas"; +const DEFAULT_MAX_CANVAS_SIZE = 1280; +const _replayCanvasIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const [maxCanvasWidth, maxCanvasHeight] = options4.maxCanvasSize || []; + const _canvasOptions = { + quality: options4.quality || "medium", + enableManualSnapshot: options4.enableManualSnapshot, + maxCanvasSize: [ + maxCanvasWidth ? Math.min(maxCanvasWidth, DEFAULT_MAX_CANVAS_SIZE) : DEFAULT_MAX_CANVAS_SIZE, + maxCanvasHeight ? Math.min(maxCanvasHeight, DEFAULT_MAX_CANVAS_SIZE) : DEFAULT_MAX_CANVAS_SIZE + ] + }; + let canvasManagerResolve; + const _canvasManager = new Promise((resolve2) => canvasManagerResolve = resolve2); + return { + name: INTEGRATION_NAME$3, + getOptions() { + const { quality, enableManualSnapshot, maxCanvasSize } = _canvasOptions; + return { + enableManualSnapshot, + recordCanvas: true, + getCanvasManager: /* @__PURE__ */ __name((getCanvasManagerOptions) => { + const manager = new CanvasManager({ + ...getCanvasManagerOptions, + enableManualSnapshot, + maxCanvasSize, + errorHandler: /* @__PURE__ */ __name((err) => { + try { + if (typeof err === "object") { + err.__rrweb__ = true; + } + } catch (error2) { + } + }, "errorHandler") + }); + canvasManagerResolve(manager); + return manager; + }, "getCanvasManager"), + ...CANVAS_QUALITY[quality || "medium"] || CANVAS_QUALITY.medium + }; + }, + async snapshot(canvasElement) { + const canvasManager = await _canvasManager; + canvasManager.snapshot(canvasElement); + } + }; +}, "_replayCanvasIntegration"); +const replayCanvasIntegration = defineIntegration( + _replayCanvasIntegration +); +const WINDOW = GLOBAL_OBJ; +const DOCUMENT = WINDOW.document; +const NAVIGATOR = WINDOW.navigator; +const TRIGGER_LABEL = "Report a Bug"; +const CANCEL_BUTTON_LABEL = "Cancel"; +const SUBMIT_BUTTON_LABEL = "Send Bug Report"; +const CONFIRM_BUTTON_LABEL = "Confirm"; +const FORM_TITLE = "Report a Bug"; +const EMAIL_PLACEHOLDER = "your.email@example.org"; +const EMAIL_LABEL = "Email"; +const MESSAGE_PLACEHOLDER = "What's the bug? What did you expect?"; +const MESSAGE_LABEL = "Description"; +const NAME_PLACEHOLDER = "Your Name"; +const NAME_LABEL = "Name"; +const SUCCESS_MESSAGE_TEXT = "Thank you for your report!"; +const IS_REQUIRED_LABEL = "(required)"; +const ADD_SCREENSHOT_LABEL = "Add a screenshot"; +const REMOVE_SCREENSHOT_LABEL = "Remove screenshot"; +const FEEDBACK_WIDGET_SOURCE = "widget"; +const FEEDBACK_API_SOURCE = "api"; +const SUCCESS_MESSAGE_TIMEOUT = 5e3; +const sendFeedback = /* @__PURE__ */ __name((params, hint = { includeReplay: true }) => { + if (!params.message) { + throw new Error("Unable to submit feedback with empty message"); + } + const client = getClient(); + if (!client) { + throw new Error("No client setup, cannot send feedback."); + } + if (params.tags && Object.keys(params.tags).length) { + getCurrentScope$1().setTags(params.tags); + } + const eventId = captureFeedback( + { + source: FEEDBACK_API_SOURCE, + url: getLocationHref(), + ...params + }, + hint + ); + return new Promise((resolve2, reject3) => { + const timeout = setTimeout(() => reject3("Unable to determine if Feedback was correctly sent."), 5e3); + const cleanup = client.on("afterSendEvent", (event, response) => { + if (event.event_id !== eventId) { + return; + } + clearTimeout(timeout); + cleanup(); + if (response && typeof response.statusCode === "number" && response.statusCode >= 200 && response.statusCode < 300) { + return resolve2(eventId); + } + if (response && typeof response.statusCode === "number" && response.statusCode === 0) { + return reject3( + "Unable to send Feedback. This is because of network issues, or because you are using an ad-blocker." + ); + } + if (response && typeof response.statusCode === "number" && response.statusCode === 403) { + return reject3( + "Unable to send Feedback. This could be because this domain is not in your list of allowed domains." + ); + } + return reject3( + "Unable to send Feedback. This could be because of network issues, or because you are using an ad-blocker" + ); + }); + }); +}, "sendFeedback"); +const DEBUG_BUILD$1 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +function isScreenshotSupported() { + if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(NAVIGATOR.userAgent)) { + return false; + } + if (/Macintosh/i.test(NAVIGATOR.userAgent) && NAVIGATOR.maxTouchPoints && NAVIGATOR.maxTouchPoints > 1) { + return false; + } + if (!isSecureContext) { + return false; + } + return true; +} +__name(isScreenshotSupported, "isScreenshotSupported"); +function mergeOptions$2(defaultOptions2, optionOverrides) { + return { + ...defaultOptions2, + ...optionOverrides, + tags: { + ...defaultOptions2.tags, + ...optionOverrides.tags + }, + onFormOpen: /* @__PURE__ */ __name(() => { + optionOverrides.onFormOpen && optionOverrides.onFormOpen(); + defaultOptions2.onFormOpen && defaultOptions2.onFormOpen(); + }, "onFormOpen"), + onFormClose: /* @__PURE__ */ __name(() => { + optionOverrides.onFormClose && optionOverrides.onFormClose(); + defaultOptions2.onFormClose && defaultOptions2.onFormClose(); + }, "onFormClose"), + onSubmitSuccess: /* @__PURE__ */ __name((data25) => { + optionOverrides.onSubmitSuccess && optionOverrides.onSubmitSuccess(data25); + defaultOptions2.onSubmitSuccess && defaultOptions2.onSubmitSuccess(data25); + }, "onSubmitSuccess"), + onSubmitError: /* @__PURE__ */ __name((error2) => { + optionOverrides.onSubmitError && optionOverrides.onSubmitError(error2); + defaultOptions2.onSubmitError && defaultOptions2.onSubmitError(error2); + }, "onSubmitError"), + onFormSubmitted: /* @__PURE__ */ __name(() => { + optionOverrides.onFormSubmitted && optionOverrides.onFormSubmitted(); + defaultOptions2.onFormSubmitted && defaultOptions2.onFormSubmitted(); + }, "onFormSubmitted"), + themeDark: { + ...defaultOptions2.themeDark, + ...optionOverrides.themeDark + }, + themeLight: { + ...defaultOptions2.themeLight, + ...optionOverrides.themeLight + } + }; +} +__name(mergeOptions$2, "mergeOptions$2"); +function createActorStyles(styleNonce) { + const style2 = DOCUMENT.createElement("style"); + style2.textContent = ` +.widget__actor { + position: fixed; + z-index: var(--z-index); + margin: var(--page-margin); + inset: var(--actor-inset); + + display: flex; + align-items: center; + gap: 8px; + padding: 16px; + + font-family: inherit; + font-size: var(--font-size); + font-weight: 600; + line-height: 1.14em; + text-decoration: none; + + background: var(--actor-background, var(--background)); + border-radius: var(--actor-border-radius, 1.7em/50%); + border: var(--actor-border, var(--border)); + box-shadow: var(--actor-box-shadow, var(--box-shadow)); + color: var(--actor-color, var(--foreground)); + fill: var(--actor-color, var(--foreground)); + cursor: pointer; + opacity: 1; + transition: transform 0.2s ease-in-out; + transform: translate(0, 0) scale(1); +} +.widget__actor[aria-hidden="true"] { + opacity: 0; + pointer-events: none; + visibility: hidden; + transform: translate(0, 16px) scale(0.98); +} + +.widget__actor:hover { + background: var(--actor-hover-background, var(--background)); + filter: var(--interactive-filter); +} + +.widget__actor svg { + width: 1.14em; + height: 1.14em; +} + +@media (max-width: 600px) { + .widget__actor span { + display: none; + } +} +`; + if (styleNonce) { + style2.setAttribute("nonce", styleNonce); + } + return style2; +} +__name(createActorStyles, "createActorStyles"); +function setAttributesNS(el, attributes) { + Object.entries(attributes).forEach(([key, val]) => { + el.setAttributeNS(null, key, val); + }); + return el; +} +__name(setAttributesNS, "setAttributesNS"); +const SIZE$1 = 20; +const XMLNS$2 = "http://www.w3.org/2000/svg"; +function FeedbackIcon() { + const createElementNS = /* @__PURE__ */ __name((tagName) => WINDOW.document.createElementNS(XMLNS$2, tagName), "createElementNS"); + const svg = setAttributesNS(createElementNS("svg"), { + width: `${SIZE$1}`, + height: `${SIZE$1}`, + viewBox: `0 0 ${SIZE$1} ${SIZE$1}`, + fill: "var(--actor-color, var(--foreground))" + }); + const g2 = setAttributesNS(createElementNS("g"), { + clipPath: "url(#clip0_57_80)" + }); + const path = setAttributesNS(createElementNS("path"), { + ["fill-rule"]: "evenodd", + ["clip-rule"]: "evenodd", + d: "M15.6622 15H12.3997C12.2129 14.9959 12.031 14.9396 11.8747 14.8375L8.04965 12.2H7.49956V19.1C7.4875 19.3348 7.3888 19.5568 7.22256 19.723C7.05632 19.8892 6.83435 19.9879 6.59956 20H2.04956C1.80193 19.9968 1.56535 19.8969 1.39023 19.7218C1.21511 19.5467 1.1153 19.3101 1.11206 19.0625V12.2H0.949652C0.824431 12.2017 0.700142 12.1783 0.584123 12.1311C0.468104 12.084 0.362708 12.014 0.274155 11.9255C0.185602 11.8369 0.115689 11.7315 0.0685419 11.6155C0.0213952 11.4995 -0.00202913 11.3752 -0.00034808 11.25V3.75C-0.00900498 3.62067 0.0092504 3.49095 0.0532651 3.36904C0.0972798 3.24712 0.166097 3.13566 0.255372 3.04168C0.344646 2.94771 0.452437 2.87327 0.571937 2.82307C0.691437 2.77286 0.82005 2.74798 0.949652 2.75H8.04965L11.8747 0.1625C12.031 0.0603649 12.2129 0.00407221 12.3997 0H15.6622C15.9098 0.00323746 16.1464 0.103049 16.3215 0.278167C16.4966 0.453286 16.5964 0.689866 16.5997 0.9375V3.25269C17.3969 3.42959 18.1345 3.83026 18.7211 4.41679C19.5322 5.22788 19.9878 6.32796 19.9878 7.47502C19.9878 8.62209 19.5322 9.72217 18.7211 10.5333C18.1345 11.1198 17.3969 11.5205 16.5997 11.6974V14.0125C16.6047 14.1393 16.5842 14.2659 16.5395 14.3847C16.4948 14.5035 16.4268 14.6121 16.3394 14.7042C16.252 14.7962 16.147 14.8698 16.0307 14.9206C15.9144 14.9714 15.7891 14.9984 15.6622 15ZM1.89695 10.325H1.88715V4.625H8.33715C8.52423 4.62301 8.70666 4.56654 8.86215 4.4625L12.6872 1.875H14.7247V13.125H12.6872L8.86215 10.4875C8.70666 10.3835 8.52423 10.327 8.33715 10.325H2.20217C2.15205 10.3167 2.10102 10.3125 2.04956 10.3125C1.9981 10.3125 1.94708 10.3167 1.89695 10.325ZM2.98706 12.2V18.1625H5.66206V12.2H2.98706ZM16.5997 9.93612V5.01393C16.6536 5.02355 16.7072 5.03495 16.7605 5.04814C17.1202 5.13709 17.4556 5.30487 17.7425 5.53934C18.0293 5.77381 18.2605 6.06912 18.4192 6.40389C18.578 6.73866 18.6603 7.10452 18.6603 7.47502C18.6603 7.84552 18.578 8.21139 18.4192 8.54616C18.2605 8.88093 18.0293 9.17624 17.7425 9.41071C17.4556 9.64518 17.1202 9.81296 16.7605 9.90191C16.7072 9.91509 16.6536 9.9265 16.5997 9.93612Z" + }); + svg.appendChild(g2).appendChild(path); + const speakerDefs = createElementNS("defs"); + const speakerClipPathDef = setAttributesNS(createElementNS("clipPath"), { + id: "clip0_57_80" + }); + const speakerRect = setAttributesNS(createElementNS("rect"), { + width: `${SIZE$1}`, + height: `${SIZE$1}`, + fill: "white" + }); + speakerClipPathDef.appendChild(speakerRect); + speakerDefs.appendChild(speakerClipPathDef); + svg.appendChild(speakerDefs).appendChild(speakerClipPathDef).appendChild(speakerRect); + return svg; +} +__name(FeedbackIcon, "FeedbackIcon"); +function Actor({ triggerLabel, triggerAriaLabel, shadow, styleNonce }) { + const el = DOCUMENT.createElement("button"); + el.type = "button"; + el.className = "widget__actor"; + el.ariaHidden = "false"; + el.ariaLabel = triggerAriaLabel || triggerLabel || TRIGGER_LABEL; + el.appendChild(FeedbackIcon()); + if (triggerLabel) { + const label5 = DOCUMENT.createElement("span"); + label5.appendChild(DOCUMENT.createTextNode(triggerLabel)); + el.appendChild(label5); + } + const style2 = createActorStyles(styleNonce); + return { + el, + appendToDom() { + shadow.appendChild(style2); + shadow.appendChild(el); + }, + removeFromDom() { + shadow.removeChild(el); + shadow.removeChild(style2); + }, + show() { + el.ariaHidden = "false"; + }, + hide() { + el.ariaHidden = "true"; + } + }; +} +__name(Actor, "Actor"); +const PURPLE = "rgba(88, 74, 192, 1)"; +const DEFAULT_LIGHT = { + foreground: "#2b2233", + background: "#ffffff", + accentForeground: "white", + accentBackground: PURPLE, + successColor: "#268d75", + errorColor: "#df3338", + border: "1.5px solid rgba(41, 35, 47, 0.13)", + boxShadow: "0px 4px 24px 0px rgba(43, 34, 51, 0.12)", + outline: "1px auto var(--accent-background)", + interactiveFilter: "brightness(95%)" +}; +const DEFAULT_DARK = { + foreground: "#ebe6ef", + background: "#29232f", + accentForeground: "white", + accentBackground: PURPLE, + successColor: "#2da98c", + errorColor: "#f55459", + border: "1.5px solid rgba(235, 230, 239, 0.15)", + boxShadow: "0px 4px 24px 0px rgba(43, 34, 51, 0.12)", + outline: "1px auto var(--accent-background)", + interactiveFilter: "brightness(150%)" +}; +function getThemedCssVariables(theme42) { + return ` + --foreground: ${theme42.foreground}; + --background: ${theme42.background}; + --accent-foreground: ${theme42.accentForeground}; + --accent-background: ${theme42.accentBackground}; + --success-color: ${theme42.successColor}; + --error-color: ${theme42.errorColor}; + --border: ${theme42.border}; + --box-shadow: ${theme42.boxShadow}; + --outline: ${theme42.outline}; + --interactive-filter: ${theme42.interactiveFilter}; + `; +} +__name(getThemedCssVariables, "getThemedCssVariables"); +function createMainStyles({ + colorScheme, + themeDark, + themeLight, + styleNonce +}) { + const style2 = DOCUMENT.createElement("style"); + style2.textContent = ` +:host { + --font-family: system-ui, 'Helvetica Neue', Arial, sans-serif; + --font-size: 14px; + --z-index: 100000; + + --page-margin: 16px; + --inset: auto 0 0 auto; + --actor-inset: var(--inset); + + font-family: var(--font-family); + font-size: var(--font-size); + + ${colorScheme !== "system" ? "color-scheme: only light;" : ""} + + ${getThemedCssVariables( + colorScheme === "dark" ? { ...DEFAULT_DARK, ...themeDark } : { ...DEFAULT_LIGHT, ...themeLight } + )} +} + +${colorScheme === "system" ? ` +@media (prefers-color-scheme: dark) { + :host { + ${getThemedCssVariables({ ...DEFAULT_DARK, ...themeDark })} + } +}` : ""} +} +`; + if (styleNonce) { + style2.setAttribute("nonce", styleNonce); + } + return style2; +} +__name(createMainStyles, "createMainStyles"); +const buildFeedbackIntegration = /* @__PURE__ */ __name(({ + lazyLoadIntegration: lazyLoadIntegration2, + getModalIntegration, + getScreenshotIntegration +}) => { + const feedbackIntegration = /* @__PURE__ */ __name(({ + // FeedbackGeneralConfiguration + id: id3 = "sentry-feedback", + autoInject = true, + showBranding = true, + isEmailRequired = false, + isNameRequired = false, + showEmail = true, + showName = true, + enableScreenshot = true, + useSentryUser = { + email: "email", + name: "username" + }, + tags, + styleNonce, + scriptNonce, + // FeedbackThemeConfiguration + colorScheme = "system", + themeLight = {}, + themeDark = {}, + // FeedbackTextConfiguration + addScreenshotButtonLabel = ADD_SCREENSHOT_LABEL, + cancelButtonLabel = CANCEL_BUTTON_LABEL, + confirmButtonLabel = CONFIRM_BUTTON_LABEL, + emailLabel = EMAIL_LABEL, + emailPlaceholder = EMAIL_PLACEHOLDER, + formTitle = FORM_TITLE, + isRequiredLabel = IS_REQUIRED_LABEL, + messageLabel = MESSAGE_LABEL, + messagePlaceholder = MESSAGE_PLACEHOLDER, + nameLabel = NAME_LABEL, + namePlaceholder = NAME_PLACEHOLDER, + removeScreenshotButtonLabel = REMOVE_SCREENSHOT_LABEL, + submitButtonLabel = SUBMIT_BUTTON_LABEL, + successMessageText = SUCCESS_MESSAGE_TEXT, + triggerLabel = TRIGGER_LABEL, + triggerAriaLabel = "", + // FeedbackCallbacks + onFormOpen, + onFormClose, + onSubmitSuccess, + onSubmitError, + onFormSubmitted + } = {}) => { + const _options = { + id: id3, + autoInject, + showBranding, + isEmailRequired, + isNameRequired, + showEmail, + showName, + enableScreenshot, + useSentryUser, + tags, + styleNonce, + scriptNonce, + colorScheme, + themeDark, + themeLight, + triggerLabel, + triggerAriaLabel, + cancelButtonLabel, + submitButtonLabel, + confirmButtonLabel, + formTitle, + emailLabel, + emailPlaceholder, + messageLabel, + messagePlaceholder, + nameLabel, + namePlaceholder, + successMessageText, + isRequiredLabel, + addScreenshotButtonLabel, + removeScreenshotButtonLabel, + onFormClose, + onFormOpen, + onSubmitError, + onSubmitSuccess, + onFormSubmitted + }; + let _shadow = null; + let _subscriptions = []; + const _createShadow = /* @__PURE__ */ __name((options4) => { + if (!_shadow) { + const host = DOCUMENT.createElement("div"); + host.id = String(options4.id); + DOCUMENT.body.appendChild(host); + _shadow = host.attachShadow({ mode: "open" }); + _shadow.appendChild(createMainStyles(options4)); + } + return _shadow; + }, "_createShadow"); + const _loadAndRenderDialog = /* @__PURE__ */ __name(async (options4) => { + const screenshotRequired = options4.enableScreenshot && isScreenshotSupported(); + let modalIntegration; + let screenshotIntegration; + try { + const modalIntegrationFn = getModalIntegration ? getModalIntegration() : await lazyLoadIntegration2("feedbackModalIntegration", scriptNonce); + modalIntegration = modalIntegrationFn(); + addIntegration(modalIntegration); + } catch (e2) { + DEBUG_BUILD$1 && logger$2.error( + "[Feedback] Error when trying to load feedback integrations. Try using `feedbackSyncIntegration` in your `Sentry.init`." + ); + throw new Error("[Feedback] Missing feedback modal integration!"); + } + try { + const screenshotIntegrationFn = screenshotRequired ? getScreenshotIntegration ? getScreenshotIntegration() : await lazyLoadIntegration2("feedbackScreenshotIntegration", scriptNonce) : void 0; + if (screenshotIntegrationFn) { + screenshotIntegration = screenshotIntegrationFn(); + addIntegration(screenshotIntegration); + } + } catch (e2) { + DEBUG_BUILD$1 && logger$2.error("[Feedback] Missing feedback screenshot integration. Proceeding without screenshots."); + } + const dialog = modalIntegration.createDialog({ + options: { + ...options4, + onFormClose: /* @__PURE__ */ __name(() => { + dialog && dialog.close(); + options4.onFormClose && options4.onFormClose(); + }, "onFormClose"), + onFormSubmitted: /* @__PURE__ */ __name(() => { + dialog && dialog.close(); + options4.onFormSubmitted && options4.onFormSubmitted(); + }, "onFormSubmitted") + }, + screenshotIntegration, + sendFeedback, + shadow: _createShadow(options4) + }); + return dialog; + }, "_loadAndRenderDialog"); + const _attachTo = /* @__PURE__ */ __name((el, optionOverrides = {}) => { + const mergedOptions = mergeOptions$2(_options, optionOverrides); + const targetEl = typeof el === "string" ? DOCUMENT.querySelector(el) : typeof el.addEventListener === "function" ? el : null; + if (!targetEl) { + DEBUG_BUILD$1 && logger$2.error("[Feedback] Unable to attach to target element"); + throw new Error("Unable to attach to target element"); + } + let dialog = null; + const handleClick2 = /* @__PURE__ */ __name(async () => { + if (!dialog) { + dialog = await _loadAndRenderDialog({ + ...mergedOptions, + onFormSubmitted: /* @__PURE__ */ __name(() => { + dialog && dialog.removeFromDom(); + mergedOptions.onFormSubmitted && mergedOptions.onFormSubmitted(); + }, "onFormSubmitted") + }); + } + dialog.appendToDom(); + dialog.open(); + }, "handleClick"); + targetEl.addEventListener("click", handleClick2); + const unsubscribe = /* @__PURE__ */ __name(() => { + _subscriptions = _subscriptions.filter((sub) => sub !== unsubscribe); + dialog && dialog.removeFromDom(); + dialog = null; + targetEl.removeEventListener("click", handleClick2); + }, "unsubscribe"); + _subscriptions.push(unsubscribe); + return unsubscribe; + }, "_attachTo"); + const _createActor = /* @__PURE__ */ __name((optionOverrides = {}) => { + const mergedOptions = mergeOptions$2(_options, optionOverrides); + const shadow = _createShadow(mergedOptions); + const actor = Actor({ + triggerLabel: mergedOptions.triggerLabel, + triggerAriaLabel: mergedOptions.triggerAriaLabel, + shadow, + styleNonce + }); + _attachTo(actor.el, { + ...mergedOptions, + onFormOpen() { + actor.hide(); + }, + onFormClose() { + actor.show(); + }, + onFormSubmitted() { + actor.show(); + } + }); + return actor; + }, "_createActor"); + return { + name: "Feedback", + setupOnce() { + if (!isBrowser$1() || !_options.autoInject) { + return; + } + if (DOCUMENT.readyState === "loading") { + DOCUMENT.addEventListener("DOMContentLoaded", () => _createActor().appendToDom()); + } else { + _createActor().appendToDom(); + } + }, + /** + * Adds click listener to the element to open a feedback dialog + * + * The returned function can be used to remove the click listener + */ + attachTo: _attachTo, + /** + * Creates a new widget which is composed of a Button which triggers a Dialog. + * Accepts partial options to override any options passed to constructor. + */ + createWidget(optionOverrides = {}) { + const actor = _createActor(mergeOptions$2(_options, optionOverrides)); + actor.appendToDom(); + return actor; + }, + /** + * Creates a new Form which you can + * Accepts partial options to override any options passed to constructor. + */ + async createForm(optionOverrides = {}) { + return _loadAndRenderDialog(mergeOptions$2(_options, optionOverrides)); + }, + /** + * Removes the Feedback integration (including host, shadow DOM, and all widgets) + */ + remove() { + if (_shadow) { + _shadow.parentElement && _shadow.parentElement.remove(); + _shadow = null; + } + _subscriptions.forEach((sub) => sub()); + _subscriptions = []; + } + }; + }, "feedbackIntegration"); + return feedbackIntegration; +}, "buildFeedbackIntegration"); +function getFeedback() { + const client = getClient(); + return client && client.getIntegrationByName("Feedback"); +} +__name(getFeedback, "getFeedback"); +var n, l$1, u$1, i$1, o$1, r$1, f$1, c$1 = {}, s$1 = [], a$1 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, h$1 = Array.isArray; +function v$1(n2, l2) { + for (var u2 in l2) n2[u2] = l2[u2]; + return n2; +} +__name(v$1, "v$1"); +function p$1(n2) { + var l2 = n2.parentNode; + l2 && l2.removeChild(n2); +} +__name(p$1, "p$1"); +function y$1(l2, u2, t2) { + var i2, o2, r2, f2 = {}; + for (r2 in u2) "key" == r2 ? i2 = u2[r2] : "ref" == r2 ? o2 = u2[r2] : f2[r2] = u2[r2]; + if (arguments.length > 2 && (f2.children = arguments.length > 3 ? n.call(arguments, 2) : t2), "function" == typeof l2 && null != l2.defaultProps) for (r2 in l2.defaultProps) void 0 === f2[r2] && (f2[r2] = l2.defaultProps[r2]); + return d$1(l2, f2, i2, o2, null); +} +__name(y$1, "y$1"); +function d$1(n2, t2, i2, o2, r2) { + var f2 = { type: n2, props: t2, key: i2, ref: o2, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: null == r2 ? ++u$1 : r2, __i: -1, __u: 0 }; + return null == r2 && null != l$1.vnode && l$1.vnode(f2), f2; +} +__name(d$1, "d$1"); +function g$1$1(n2) { + return n2.children; +} +__name(g$1$1, "g$1$1"); +function b$1(n2, l2) { + this.props = n2, this.context = l2; +} +__name(b$1, "b$1"); +function m$1(n2, l2) { + if (null == l2) return n2.__ ? m$1(n2.__, n2.__i + 1) : null; + for (var u2; l2 < n2.__k.length; l2++) if (null != (u2 = n2.__k[l2]) && null != u2.__e) return u2.__e; + return "function" == typeof n2.type ? m$1(n2) : null; +} +__name(m$1, "m$1"); +function w$1(n2, u2, t2) { + var i2, o2 = n2.__v, r2 = o2.__e, f2 = n2.__P; + if (f2) return (i2 = v$1({}, o2)).__v = o2.__v + 1, l$1.vnode && l$1.vnode(i2), M(f2, i2, o2, n2.__n, void 0 !== f2.ownerSVGElement, 32 & o2.__u ? [r2] : null, u2, null == r2 ? m$1(o2) : r2, !!(32 & o2.__u), t2), i2.__.__k[i2.__i] = i2, i2.__d = void 0, i2.__e != r2 && k$1(i2), i2; +} +__name(w$1, "w$1"); +function k$1(n2) { + var l2, u2; + if (null != (n2 = n2.__) && null != n2.__c) { + for (n2.__e = n2.__c.base = null, l2 = 0; l2 < n2.__k.length; l2++) if (null != (u2 = n2.__k[l2]) && null != u2.__e) { + n2.__e = n2.__c.base = u2.__e; + break; + } + return k$1(n2); + } +} +__name(k$1, "k$1"); +function x$1(n2) { + (!n2.__d && (n2.__d = true) && i$1.push(n2) && !C$1.__r++ || o$1 !== l$1.debounceRendering) && ((o$1 = l$1.debounceRendering) || r$1)(C$1); +} +__name(x$1, "x$1"); +function C$1() { + var n2, u2, t2, o2 = [], r2 = []; + for (i$1.sort(f$1); n2 = i$1.shift(); ) n2.__d && (t2 = i$1.length, u2 = w$1(n2, o2, r2) || u2, 0 === t2 || i$1.length > t2 ? (j$1(o2, u2, r2), r2.length = o2.length = 0, u2 = void 0, i$1.sort(f$1)) : u2 && l$1.__c && l$1.__c(u2, s$1)); + u2 && j$1(o2, u2, r2), C$1.__r = 0; +} +__name(C$1, "C$1"); +function P$1(n2, l2, u2, t2, i2, o2, r2, f2, e2, a2, h2) { + var v2, p2, y2, d2, _2, g2 = t2 && t2.__k || s$1, b2 = l2.length; + for (u2.__d = e2, S(u2, l2, g2), e2 = u2.__d, v2 = 0; v2 < b2; v2++) null != (y2 = u2.__k[v2]) && "boolean" != typeof y2 && "function" != typeof y2 && (p2 = -1 === y2.__i ? c$1 : g2[y2.__i] || c$1, y2.__i = v2, M(n2, y2, p2, i2, o2, r2, f2, e2, a2, h2), d2 = y2.__e, y2.ref && p2.ref != y2.ref && (p2.ref && N(p2.ref, null, y2), h2.push(y2.ref, y2.__c || d2, y2)), null == _2 && null != d2 && (_2 = d2), 65536 & y2.__u || p2.__k === y2.__k ? e2 = $(y2, e2, n2) : "function" == typeof y2.type && void 0 !== y2.__d ? e2 = y2.__d : d2 && (e2 = d2.nextSibling), y2.__d = void 0, y2.__u &= -196609); + u2.__d = e2, u2.__e = _2; +} +__name(P$1, "P$1"); +function S(n2, l2, u2) { + var t2, i2, o2, r2, f2, e2 = l2.length, c2 = u2.length, s2 = c2, a2 = 0; + for (n2.__k = [], t2 = 0; t2 < e2; t2++) null != (i2 = n2.__k[t2] = null == (i2 = l2[t2]) || "boolean" == typeof i2 || "function" == typeof i2 ? null : "string" == typeof i2 || "number" == typeof i2 || "bigint" == typeof i2 || i2.constructor == String ? d$1(null, i2, null, null, i2) : h$1(i2) ? d$1(g$1$1, { children: i2 }, null, null, null) : void 0 === i2.constructor && i2.__b > 0 ? d$1(i2.type, i2.props, i2.key, i2.ref ? i2.ref : null, i2.__v) : i2) ? (i2.__ = n2, i2.__b = n2.__b + 1, f2 = I(i2, u2, r2 = t2 + a2, s2), i2.__i = f2, o2 = null, -1 !== f2 && (s2--, (o2 = u2[f2]) && (o2.__u |= 131072)), null == o2 || null === o2.__v ? (-1 == f2 && a2--, "function" != typeof i2.type && (i2.__u |= 65536)) : f2 !== r2 && (f2 === r2 + 1 ? a2++ : f2 > r2 ? s2 > e2 - r2 ? a2 += f2 - r2 : a2-- : a2 = f2 < r2 && f2 == r2 - 1 ? f2 - r2 : 0, f2 !== t2 + a2 && (i2.__u |= 65536))) : (o2 = u2[t2]) && null == o2.key && o2.__e && (o2.__e == n2.__d && (n2.__d = m$1(o2)), O(o2, o2, false), u2[t2] = null, s2--); + if (s2) for (t2 = 0; t2 < c2; t2++) null != (o2 = u2[t2]) && 0 == (131072 & o2.__u) && (o2.__e == n2.__d && (n2.__d = m$1(o2)), O(o2, o2)); +} +__name(S, "S"); +function $(n2, l2, u2) { + var t2, i2; + if ("function" == typeof n2.type) { + for (t2 = n2.__k, i2 = 0; t2 && i2 < t2.length; i2++) t2[i2] && (t2[i2].__ = n2, l2 = $(t2[i2], l2, u2)); + return l2; + } + n2.__e != l2 && (u2.insertBefore(n2.__e, l2 || null), l2 = n2.__e); + do { + l2 = l2 && l2.nextSibling; + } while (null != l2 && 8 === l2.nodeType); + return l2; +} +__name($, "$"); +function I(n2, l2, u2, t2) { + var i2 = n2.key, o2 = n2.type, r2 = u2 - 1, f2 = u2 + 1, e2 = l2[u2]; + if (null === e2 || e2 && i2 == e2.key && o2 === e2.type) return u2; + if (t2 > (null != e2 && 0 == (131072 & e2.__u) ? 1 : 0)) for (; r2 >= 0 || f2 < l2.length; ) { + if (r2 >= 0) { + if ((e2 = l2[r2]) && 0 == (131072 & e2.__u) && i2 == e2.key && o2 === e2.type) return r2; + r2--; + } + if (f2 < l2.length) { + if ((e2 = l2[f2]) && 0 == (131072 & e2.__u) && i2 == e2.key && o2 === e2.type) return f2; + f2++; + } + } + return -1; +} +__name(I, "I"); +function T$1(n2, l2, u2) { + "-" === l2[0] ? n2.setProperty(l2, null == u2 ? "" : u2) : n2[l2] = null == u2 ? "" : "number" != typeof u2 || a$1.test(l2) ? u2 : u2 + "px"; +} +__name(T$1, "T$1"); +function A$1(n2, l2, u2, t2, i2) { + var o2; + n: if ("style" === l2) if ("string" == typeof u2) n2.style.cssText = u2; + else { + if ("string" == typeof t2 && (n2.style.cssText = t2 = ""), t2) for (l2 in t2) u2 && l2 in u2 || T$1(n2.style, l2, ""); + if (u2) for (l2 in u2) t2 && u2[l2] === t2[l2] || T$1(n2.style, l2, u2[l2]); + } + else if ("o" === l2[0] && "n" === l2[1]) o2 = l2 !== (l2 = l2.replace(/(PointerCapture)$|Capture$/i, "$1")), l2 = l2.toLowerCase() in n2 ? l2.toLowerCase().slice(2) : l2.slice(2), n2.l || (n2.l = {}), n2.l[l2 + o2] = u2, u2 ? t2 ? u2.u = t2.u : (u2.u = Date.now(), n2.addEventListener(l2, o2 ? L : D$1, o2)) : n2.removeEventListener(l2, o2 ? L : D$1, o2); + else { + if (i2) l2 = l2.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); + else if ("width" !== l2 && "height" !== l2 && "href" !== l2 && "list" !== l2 && "form" !== l2 && "tabIndex" !== l2 && "download" !== l2 && "rowSpan" !== l2 && "colSpan" !== l2 && "role" !== l2 && l2 in n2) try { + n2[l2] = null == u2 ? "" : u2; + break n; + } catch (n3) { + } + "function" == typeof u2 || (null == u2 || false === u2 && "-" !== l2[4] ? n2.removeAttribute(l2) : n2.setAttribute(l2, u2)); + } +} +__name(A$1, "A$1"); +function D$1(n2) { + if (this.l) { + var u2 = this.l[n2.type + false]; + if (n2.t) { + if (n2.t <= u2.u) return; + } else n2.t = Date.now(); + return u2(l$1.event ? l$1.event(n2) : n2); + } +} +__name(D$1, "D$1"); +function L(n2) { + if (this.l) return this.l[n2.type + true](l$1.event ? l$1.event(n2) : n2); +} +__name(L, "L"); +function M(n2, u2, t2, i2, o2, r2, f2, e2, c2, s2) { + var a2, p2, y2, d2, _2, m2, w2, k2, x2, C2, S2, $2, H, I2, T2, A2 = u2.type; + if (void 0 !== u2.constructor) return null; + 128 & t2.__u && (c2 = !!(32 & t2.__u), r2 = [e2 = u2.__e = t2.__e]), (a2 = l$1.__b) && a2(u2); + n: if ("function" == typeof A2) try { + if (k2 = u2.props, x2 = (a2 = A2.contextType) && i2[a2.__c], C2 = a2 ? x2 ? x2.props.value : a2.__ : i2, t2.__c ? w2 = (p2 = u2.__c = t2.__c).__ = p2.__E : ("prototype" in A2 && A2.prototype.render ? u2.__c = p2 = new A2(k2, C2) : (u2.__c = p2 = new b$1(k2, C2), p2.constructor = A2, p2.render = q$1), x2 && x2.sub(p2), p2.props = k2, p2.state || (p2.state = {}), p2.context = C2, p2.__n = i2, y2 = p2.__d = true, p2.__h = [], p2._sb = []), null == p2.__s && (p2.__s = p2.state), null != A2.getDerivedStateFromProps && (p2.__s == p2.state && (p2.__s = v$1({}, p2.__s)), v$1(p2.__s, A2.getDerivedStateFromProps(k2, p2.__s))), d2 = p2.props, _2 = p2.state, p2.__v = u2, y2) null == A2.getDerivedStateFromProps && null != p2.componentWillMount && p2.componentWillMount(), null != p2.componentDidMount && p2.__h.push(p2.componentDidMount); + else { + if (null == A2.getDerivedStateFromProps && k2 !== d2 && null != p2.componentWillReceiveProps && p2.componentWillReceiveProps(k2, C2), !p2.__e && (null != p2.shouldComponentUpdate && false === p2.shouldComponentUpdate(k2, p2.__s, C2) || u2.__v === t2.__v)) { + for (u2.__v !== t2.__v && (p2.props = k2, p2.state = p2.__s, p2.__d = false), u2.__e = t2.__e, u2.__k = t2.__k, u2.__k.forEach(function(n3) { + n3 && (n3.__ = u2); + }), S2 = 0; S2 < p2._sb.length; S2++) p2.__h.push(p2._sb[S2]); + p2._sb = [], p2.__h.length && f2.push(p2); + break n; + } + null != p2.componentWillUpdate && p2.componentWillUpdate(k2, p2.__s, C2), null != p2.componentDidUpdate && p2.__h.push(function() { + p2.componentDidUpdate(d2, _2, m2); + }); + } + if (p2.context = C2, p2.props = k2, p2.__P = n2, p2.__e = false, $2 = l$1.__r, H = 0, "prototype" in A2 && A2.prototype.render) { + for (p2.state = p2.__s, p2.__d = false, $2 && $2(u2), a2 = p2.render(p2.props, p2.state, p2.context), I2 = 0; I2 < p2._sb.length; I2++) p2.__h.push(p2._sb[I2]); + p2._sb = []; + } else do { + p2.__d = false, $2 && $2(u2), a2 = p2.render(p2.props, p2.state, p2.context), p2.state = p2.__s; + } while (p2.__d && ++H < 25); + p2.state = p2.__s, null != p2.getChildContext && (i2 = v$1(v$1({}, i2), p2.getChildContext())), y2 || null == p2.getSnapshotBeforeUpdate || (m2 = p2.getSnapshotBeforeUpdate(d2, _2)), P$1(n2, h$1(T2 = null != a2 && a2.type === g$1$1 && null == a2.key ? a2.props.children : a2) ? T2 : [T2], u2, t2, i2, o2, r2, f2, e2, c2, s2), p2.base = u2.__e, u2.__u &= -161, p2.__h.length && f2.push(p2), w2 && (p2.__E = p2.__ = null); + } catch (n3) { + u2.__v = null, c2 || null != r2 ? (u2.__e = e2, u2.__u |= c2 ? 160 : 32, r2[r2.indexOf(e2)] = null) : (u2.__e = t2.__e, u2.__k = t2.__k), l$1.__e(n3, u2, t2); + } + else null == r2 && u2.__v === t2.__v ? (u2.__k = t2.__k, u2.__e = t2.__e) : u2.__e = z$1(t2.__e, u2, t2, i2, o2, r2, f2, c2, s2); + (a2 = l$1.diffed) && a2(u2); +} +__name(M, "M"); +function j$1(n2, u2, t2) { + for (var i2 = 0; i2 < t2.length; i2++) N(t2[i2], t2[++i2], t2[++i2]); + l$1.__c && l$1.__c(u2, n2), n2.some(function(u3) { + try { + n2 = u3.__h, u3.__h = [], n2.some(function(n3) { + n3.call(u3); + }); + } catch (n3) { + l$1.__e(n3, u3.__v); + } + }); +} +__name(j$1, "j$1"); +function z$1(l2, u2, t2, i2, o2, r2, f2, e2, s2) { + var a2, v2, y2, d2, _2, g2, b2, w2 = t2.props, k2 = u2.props, x2 = u2.type; + if ("svg" === x2 && (o2 = true), null != r2) { + for (a2 = 0; a2 < r2.length; a2++) if ((_2 = r2[a2]) && "setAttribute" in _2 == !!x2 && (x2 ? _2.localName === x2 : 3 === _2.nodeType)) { + l2 = _2, r2[a2] = null; + break; + } + } + if (null == l2) { + if (null === x2) return document.createTextNode(k2); + l2 = o2 ? document.createElementNS("http://www.w3.org/2000/svg", x2) : document.createElement(x2, k2.is && k2), r2 = null, e2 = false; + } + if (null === x2) w2 === k2 || e2 && l2.data === k2 || (l2.data = k2); + else { + if (r2 = r2 && n.call(l2.childNodes), w2 = t2.props || c$1, !e2 && null != r2) for (w2 = {}, a2 = 0; a2 < l2.attributes.length; a2++) w2[(_2 = l2.attributes[a2]).name] = _2.value; + for (a2 in w2) _2 = w2[a2], "children" == a2 || ("dangerouslySetInnerHTML" == a2 ? y2 = _2 : "key" === a2 || a2 in k2 || A$1(l2, a2, null, _2, o2)); + for (a2 in k2) _2 = k2[a2], "children" == a2 ? d2 = _2 : "dangerouslySetInnerHTML" == a2 ? v2 = _2 : "value" == a2 ? g2 = _2 : "checked" == a2 ? b2 = _2 : "key" === a2 || e2 && "function" != typeof _2 || w2[a2] === _2 || A$1(l2, a2, _2, w2[a2], o2); + if (v2) e2 || y2 && (v2.__html === y2.__html || v2.__html === l2.innerHTML) || (l2.innerHTML = v2.__html), u2.__k = []; + else if (y2 && (l2.innerHTML = ""), P$1(l2, h$1(d2) ? d2 : [d2], u2, t2, i2, o2 && "foreignObject" !== x2, r2, f2, r2 ? r2[0] : t2.__k && m$1(t2, 0), e2, s2), null != r2) for (a2 = r2.length; a2--; ) null != r2[a2] && p$1(r2[a2]); + e2 || (a2 = "value", void 0 !== g2 && (g2 !== l2[a2] || "progress" === x2 && !g2 || "option" === x2 && g2 !== w2[a2]) && A$1(l2, a2, g2, w2[a2], false), a2 = "checked", void 0 !== b2 && b2 !== l2[a2] && A$1(l2, a2, b2, w2[a2], false)); + } + return l2; +} +__name(z$1, "z$1"); +function N(n2, u2, t2) { + try { + "function" == typeof n2 ? n2(u2) : n2.current = u2; + } catch (n3) { + l$1.__e(n3, t2); + } +} +__name(N, "N"); +function O(n2, u2, t2) { + var i2, o2; + if (l$1.unmount && l$1.unmount(n2), (i2 = n2.ref) && (i2.current && i2.current !== n2.__e || N(i2, null, u2)), null != (i2 = n2.__c)) { + if (i2.componentWillUnmount) try { + i2.componentWillUnmount(); + } catch (n3) { + l$1.__e(n3, u2); + } + i2.base = i2.__P = null, n2.__c = void 0; + } + if (i2 = n2.__k) for (o2 = 0; o2 < i2.length; o2++) i2[o2] && O(i2[o2], u2, t2 || "function" != typeof n2.type); + t2 || null == n2.__e || p$1(n2.__e), n2.__ = n2.__e = n2.__d = void 0; +} +__name(O, "O"); +function q$1(n2, l2, u2) { + return this.constructor(n2, u2); +} +__name(q$1, "q$1"); +function B$1(u2, t2, i2) { + var o2, r2, f2, e2; + l$1.__ && l$1.__(u2, t2), r2 = (o2 = "function" == typeof i2) ? null : t2.__k, f2 = [], e2 = [], M(t2, u2 = (!o2 && i2 || t2).__k = y$1(g$1$1, null, [u2]), r2 || c$1, c$1, void 0 !== t2.ownerSVGElement, !o2 && i2 ? [i2] : r2 ? null : t2.firstChild ? n.call(t2.childNodes) : null, f2, !o2 && i2 ? i2 : r2 ? r2.__e : t2.firstChild, o2, e2), u2.__d = void 0, j$1(f2, u2, e2); +} +__name(B$1, "B$1"); +n = s$1.slice, l$1 = { __e: /* @__PURE__ */ __name(function(n2, l2, u2, t2) { + for (var i2, o2, r2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try { + if ((o2 = i2.constructor) && null != o2.getDerivedStateFromError && (i2.setState(o2.getDerivedStateFromError(n2)), r2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, t2 || {}), r2 = i2.__d), r2) return i2.__E = i2; + } catch (l3) { + n2 = l3; + } + throw n2; +}, "__e") }, u$1 = 0, b$1.prototype.setState = function(n2, l2) { + var u2; + u2 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = v$1({}, this.state), "function" == typeof n2 && (n2 = n2(v$1({}, u2), this.props)), n2 && v$1(u2, n2), null != n2 && this.__v && (l2 && this._sb.push(l2), x$1(this)); +}, b$1.prototype.forceUpdate = function(n2) { + this.__v && (this.__e = true, n2 && this.__h.push(n2), x$1(this)); +}, b$1.prototype.render = g$1$1, i$1 = [], r$1 = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, f$1 = /* @__PURE__ */ __name(function(n2, l2) { + return n2.__v.__b - l2.__v.__b; +}, "f$1"), C$1.__r = 0; +var t$1, r, u, i$2, o = 0, f = [], c = [], e = l$1, a = e.__b, v = e.__r, l = e.diffed, m = e.__c, s = e.unmount, d = e.__; +function h$2(n2, t2) { + e.__h && e.__h(r, n2, o || t2), o = 0; + var u2 = r.__H || (r.__H = { __: [], __h: [] }); + return n2 >= u2.__.length && u2.__.push({ __V: c }), u2.__[n2]; +} +__name(h$2, "h$2"); +function p$2(n2) { + return o = 1, y(D, n2); +} +__name(p$2, "p$2"); +function y(n2, u2, i2) { + var o2 = h$2(t$1++, 2); + if (o2.t = n2, !o2.__c && (o2.__ = [i2 ? i2(u2) : D(void 0, u2), function(n3) { + var t2 = o2.__N ? o2.__N[0] : o2.__[0], r2 = o2.t(t2, n3); + t2 !== r2 && (o2.__N = [r2, o2.__[1]], o2.__c.setState({})); + }], o2.__c = r, !r.u)) { + var f2 = /* @__PURE__ */ __name(function(n3, t2, r2) { + if (!o2.__c.__H) return true; + var u3 = o2.__c.__H.__.filter(function(n4) { + return !!n4.__c; + }); + if (u3.every(function(n4) { + return !n4.__N; + })) return !c2 || c2.call(this, n3, t2, r2); + var i3 = false; + return u3.forEach(function(n4) { + if (n4.__N) { + var t3 = n4.__[0]; + n4.__ = n4.__N, n4.__N = void 0, t3 !== n4.__[0] && (i3 = true); + } + }), !(!i3 && o2.__c.props === n3) && (!c2 || c2.call(this, n3, t2, r2)); + }, "f"); + r.u = true; + var c2 = r.shouldComponentUpdate, e2 = r.componentWillUpdate; + r.componentWillUpdate = function(n3, t2, r2) { + if (this.__e) { + var u3 = c2; + c2 = void 0, f2(n3, t2, r2), c2 = u3; + } + e2 && e2.call(this, n3, t2, r2); + }, r.shouldComponentUpdate = f2; + } + return o2.__N || o2.__; +} +__name(y, "y"); +function _$1(n2, u2) { + var i2 = h$2(t$1++, 3); + !e.__s && C(i2.__H, u2) && (i2.__ = n2, i2.i = u2, r.__H.__h.push(i2)); +} +__name(_$1, "_$1"); +function A(n2, u2) { + var i2 = h$2(t$1++, 4); + !e.__s && C(i2.__H, u2) && (i2.__ = n2, i2.i = u2, r.__h.push(i2)); +} +__name(A, "A"); +function F(n2) { + return o = 5, q(function() { + return { current: n2 }; + }, []); +} +__name(F, "F"); +function T(n2, t2, r2) { + o = 6, A(function() { + return "function" == typeof n2 ? (n2(t2()), function() { + return n2(null); + }) : n2 ? (n2.current = t2(), function() { + return n2.current = null; + }) : void 0; + }, null == r2 ? r2 : r2.concat(n2)); +} +__name(T, "T"); +function q(n2, r2) { + var u2 = h$2(t$1++, 7); + return C(u2.__H, r2) ? (u2.__V = n2(), u2.i = r2, u2.__h = n2, u2.__V) : u2.__; +} +__name(q, "q"); +function x(n2, t2) { + return o = 8, q(function() { + return n2; + }, t2); +} +__name(x, "x"); +function P$2(n2) { + var u2 = r.context[n2.__c], i2 = h$2(t$1++, 9); + return i2.c = n2, u2 ? (null == i2.__ && (i2.__ = true, u2.sub(r)), u2.props.value) : n2.__; +} +__name(P$2, "P$2"); +function V(n2, t2) { + e.useDebugValue && e.useDebugValue(t2 ? t2(n2) : n2); +} +__name(V, "V"); +function b(n2) { + var u2 = h$2(t$1++, 10), i2 = p$2(); + return u2.__ = n2, r.componentDidCatch || (r.componentDidCatch = function(n3, t2) { + u2.__ && u2.__(n3, t2), i2[1](n3); + }), [i2[0], function() { + i2[1](void 0); + }]; +} +__name(b, "b"); +function g$6() { + var n2 = h$2(t$1++, 11); + if (!n2.__) { + for (var u2 = r.__v; null !== u2 && !u2.__m && null !== u2.__; ) u2 = u2.__; + var i2 = u2.__m || (u2.__m = [0, 0]); + n2.__ = "P" + i2[0] + "-" + i2[1]++; + } + return n2.__; +} +__name(g$6, "g$6"); +function j() { + for (var n2; n2 = f.shift(); ) if (n2.__P && n2.__H) try { + n2.__H.__h.forEach(z$2), n2.__H.__h.forEach(B), n2.__H.__h = []; + } catch (t2) { + n2.__H.__h = [], e.__e(t2, n2.__v); + } +} +__name(j, "j"); +e.__b = function(n2) { + r = null, a && a(n2); +}, e.__ = function(n2, t2) { + t2.__k && t2.__k.__m && (n2.__m = t2.__k.__m), d && d(n2, t2); +}, e.__r = function(n2) { + v && v(n2), t$1 = 0; + var i2 = (r = n2.__c).__H; + i2 && (u === r ? (i2.__h = [], r.__h = [], i2.__.forEach(function(n3) { + n3.__N && (n3.__ = n3.__N), n3.__V = c, n3.__N = n3.i = void 0; + })) : (i2.__h.forEach(z$2), i2.__h.forEach(B), i2.__h = [], t$1 = 0)), u = r; +}, e.diffed = function(n2) { + l && l(n2); + var t2 = n2.__c; + t2 && t2.__H && (t2.__H.__h.length && (1 !== f.push(t2) && i$2 === e.requestAnimationFrame || ((i$2 = e.requestAnimationFrame) || w)(j)), t2.__H.__.forEach(function(n3) { + n3.i && (n3.__H = n3.i), n3.__V !== c && (n3.__ = n3.__V), n3.i = void 0, n3.__V = c; + })), u = r = null; +}, e.__c = function(n2, t2) { + t2.some(function(n3) { + try { + n3.__h.forEach(z$2), n3.__h = n3.__h.filter(function(n4) { + return !n4.__ || B(n4); + }); + } catch (r2) { + t2.some(function(n4) { + n4.__h && (n4.__h = []); + }), t2 = [], e.__e(r2, n3.__v); + } + }), m && m(n2, t2); +}, e.unmount = function(n2) { + s && s(n2); + var t2, r2 = n2.__c; + r2 && r2.__H && (r2.__H.__.forEach(function(n3) { + try { + z$2(n3); + } catch (n4) { + t2 = n4; + } + }), r2.__H = void 0, t2 && e.__e(t2, r2.__v)); +}; +var k = "function" == typeof requestAnimationFrame; +function w(n2) { + var t2, r2 = /* @__PURE__ */ __name(function() { + clearTimeout(u2), k && cancelAnimationFrame(t2), setTimeout(n2); + }, "r"), u2 = setTimeout(r2, 100); + k && (t2 = requestAnimationFrame(r2)); +} +__name(w, "w"); +function z$2(n2) { + var t2 = r, u2 = n2.__c; + "function" == typeof u2 && (n2.__c = void 0, u2()), r = t2; +} +__name(z$2, "z$2"); +function B(n2) { + var t2 = r; + n2.__c = n2.__(), r = t2; +} +__name(B, "B"); +function C(n2, t2) { + return !n2 || n2.length !== t2.length || t2.some(function(t3, r2) { + return t3 !== n2[r2]; + }); +} +__name(C, "C"); +function D(n2, t2) { + return "function" == typeof t2 ? t2(n2) : t2; +} +__name(D, "D"); +const hooks = { + __proto__: null, + useCallback: x, + useContext: P$2, + useDebugValue: V, + useEffect: _$1, + useErrorBoundary: b, + useId: g$6, + useImperativeHandle: T, + useLayoutEffect: A, + useMemo: q, + useReducer: y, + useRef: F, + useState: p$2 +}; +const XMLNS$1 = "http://www.w3.org/2000/svg"; +function SentryLogo() { + const createElementNS = /* @__PURE__ */ __name((tagName) => DOCUMENT.createElementNS(XMLNS$1, tagName), "createElementNS"); + const svg = setAttributesNS(createElementNS("svg"), { + width: "32", + height: "30", + viewBox: "0 0 72 66", + fill: "inherit" + }); + const path = setAttributesNS(createElementNS("path"), { + transform: "translate(11, 11)", + d: "M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z" + }); + svg.appendChild(path); + return svg; +} +__name(SentryLogo, "SentryLogo"); +function DialogHeader({ options: options4 }) { + const logoHtml = q(() => ({ __html: SentryLogo().outerHTML }), []); + return y$1( + "h2", + { class: "dialog__header" }, + y$1("span", { class: "dialog__title" }, options4.formTitle), + options4.showBranding ? y$1( + "a", + { + class: "brand-link", + target: "_blank", + href: "https://sentry.io/welcome/", + title: "Powered by Sentry", + rel: "noopener noreferrer", + dangerouslySetInnerHTML: logoHtml + } + ) : null + ); +} +__name(DialogHeader, "DialogHeader"); +function getMissingFields(feedback, props) { + const emptyFields = []; + if (props.isNameRequired && !feedback.name) { + emptyFields.push(props.nameLabel); + } + if (props.isEmailRequired && !feedback.email) { + emptyFields.push(props.emailLabel); + } + if (!feedback.message) { + emptyFields.push(props.messageLabel); + } + return emptyFields; +} +__name(getMissingFields, "getMissingFields"); +function retrieveStringValue(formData, key) { + const value4 = formData.get(key); + if (typeof value4 === "string") { + return value4.trim(); + } + return ""; +} +__name(retrieveStringValue, "retrieveStringValue"); +function Form({ + options: options4, + defaultEmail, + defaultName, + onFormClose, + onSubmit, + onSubmitSuccess, + onSubmitError, + showEmail, + showName, + screenshotInput +}) { + const { + tags, + addScreenshotButtonLabel, + removeScreenshotButtonLabel, + cancelButtonLabel, + emailLabel, + emailPlaceholder, + isEmailRequired, + isNameRequired, + messageLabel, + messagePlaceholder, + nameLabel, + namePlaceholder, + submitButtonLabel, + isRequiredLabel + } = options4; + const [error2, setError] = p$2(null); + const [showScreenshotInput, setShowScreenshotInput] = p$2(false); + const ScreenshotInputComponent = screenshotInput && screenshotInput.input; + const [screenshotError, setScreenshotError] = p$2(null); + const onScreenshotError = x((error3) => { + setScreenshotError(error3); + setShowScreenshotInput(false); + }, []); + const hasAllRequiredFields = x( + (data25) => { + const missingFields = getMissingFields(data25, { + emailLabel, + isEmailRequired, + isNameRequired, + messageLabel, + nameLabel + }); + if (missingFields.length > 0) { + setError(`Please enter in the following required fields: ${missingFields.join(", ")}`); + } else { + setError(null); + } + return missingFields.length === 0; + }, + [emailLabel, isEmailRequired, isNameRequired, messageLabel, nameLabel] + ); + const handleSubmit = x( + async (e2) => { + try { + e2.preventDefault(); + if (!(e2.target instanceof HTMLFormElement)) { + return; + } + const formData = new FormData(e2.target); + const attachment = await (screenshotInput && showScreenshotInput ? screenshotInput.value() : void 0); + const data25 = { + name: retrieveStringValue(formData, "name"), + email: retrieveStringValue(formData, "email"), + message: retrieveStringValue(formData, "message"), + attachments: attachment ? [attachment] : void 0 + }; + if (!hasAllRequiredFields(data25)) { + return; + } + try { + await onSubmit( + { + name: data25.name, + email: data25.email, + message: data25.message, + source: FEEDBACK_WIDGET_SOURCE, + tags + }, + { attachments: data25.attachments } + ); + onSubmitSuccess(data25); + } catch (error3) { + DEBUG_BUILD$1 && logger$2.error(error3); + setError(error3); + onSubmitError(error3); + } + } catch (e22) { + } + }, + [screenshotInput && showScreenshotInput, onSubmitSuccess, onSubmitError] + ); + return y$1( + "form", + { class: "form", onSubmit: handleSubmit }, + ScreenshotInputComponent && showScreenshotInput ? y$1(ScreenshotInputComponent, { onError: onScreenshotError }) : null, + y$1( + "div", + { class: "form__right", "data-sentry-feedback": true }, + y$1( + "div", + { class: "form__top" }, + error2 ? y$1("div", { class: "form__error-container" }, error2) : null, + showName ? y$1( + "label", + { for: "name", class: "form__label" }, + y$1(LabelText, { label: nameLabel, isRequiredLabel, isRequired: isNameRequired }), + y$1( + "input", + { + class: "form__input", + defaultValue: defaultName, + id: "name", + name: "name", + placeholder: namePlaceholder, + required: isNameRequired, + type: "text" + } + ) + ) : y$1("input", { "aria-hidden": true, value: defaultName, name: "name", type: "hidden" }), + showEmail ? y$1( + "label", + { for: "email", class: "form__label" }, + y$1(LabelText, { label: emailLabel, isRequiredLabel, isRequired: isEmailRequired }), + y$1( + "input", + { + class: "form__input", + defaultValue: defaultEmail, + id: "email", + name: "email", + placeholder: emailPlaceholder, + required: isEmailRequired, + type: "email" + } + ) + ) : y$1("input", { "aria-hidden": true, value: defaultEmail, name: "email", type: "hidden" }), + y$1( + "label", + { for: "message", class: "form__label" }, + y$1(LabelText, { label: messageLabel, isRequiredLabel, isRequired: true }), + y$1( + "textarea", + { + autoFocus: true, + class: "form__input form__input--textarea", + id: "message", + name: "message", + placeholder: messagePlaceholder, + required: true, + rows: 5 + } + ) + ), + ScreenshotInputComponent ? y$1( + "label", + { for: "screenshot", class: "form__label" }, + y$1( + "button", + { + class: "btn btn--default", + type: "button", + onClick: /* @__PURE__ */ __name(() => { + setScreenshotError(null); + setShowScreenshotInput((prev2) => !prev2); + }, "onClick") + }, + showScreenshotInput ? removeScreenshotButtonLabel : addScreenshotButtonLabel + ), + screenshotError ? y$1("div", { class: "form__error-container" }, screenshotError.message) : null + ) : null + ), + y$1( + "div", + { class: "btn-group" }, + y$1( + "button", + { class: "btn btn--primary", type: "submit" }, + submitButtonLabel + ), + y$1( + "button", + { class: "btn btn--default", type: "button", onClick: onFormClose }, + cancelButtonLabel + ) + ) + ) + ); +} +__name(Form, "Form"); +function LabelText({ + label: label5, + isRequired, + isRequiredLabel +}) { + return y$1( + "span", + { class: "form__label__text" }, + label5, + isRequired && y$1("span", { class: "form__label__text--required" }, isRequiredLabel) + ); +} +__name(LabelText, "LabelText"); +const WIDTH = 16; +const HEIGHT = 17; +const XMLNS = "http://www.w3.org/2000/svg"; +function SuccessIcon() { + const createElementNS = /* @__PURE__ */ __name((tagName) => WINDOW.document.createElementNS(XMLNS, tagName), "createElementNS"); + const svg = setAttributesNS(createElementNS("svg"), { + width: `${WIDTH}`, + height: `${HEIGHT}`, + viewBox: `0 0 ${WIDTH} ${HEIGHT}`, + fill: "inherit" + }); + const g2 = setAttributesNS(createElementNS("g"), { + clipPath: "url(#clip0_57_156)" + }); + const path2 = setAttributesNS(createElementNS("path"), { + ["fill-rule"]: "evenodd", + ["clip-rule"]: "evenodd", + d: "M3.55544 15.1518C4.87103 16.0308 6.41775 16.5 8 16.5C10.1217 16.5 12.1566 15.6571 13.6569 14.1569C15.1571 12.6566 16 10.6217 16 8.5C16 6.91775 15.5308 5.37103 14.6518 4.05544C13.7727 2.73985 12.5233 1.71447 11.0615 1.10897C9.59966 0.503466 7.99113 0.34504 6.43928 0.653721C4.88743 0.962403 3.46197 1.72433 2.34315 2.84315C1.22433 3.96197 0.462403 5.38743 0.153721 6.93928C-0.15496 8.49113 0.00346625 10.0997 0.608967 11.5615C1.21447 13.0233 2.23985 14.2727 3.55544 15.1518ZM4.40546 3.1204C5.46945 2.40946 6.72036 2.03 8 2.03C9.71595 2.03 11.3616 2.71166 12.575 3.92502C13.7883 5.13838 14.47 6.78405 14.47 8.5C14.47 9.77965 14.0905 11.0306 13.3796 12.0945C12.6687 13.1585 11.6582 13.9878 10.476 14.4775C9.29373 14.9672 7.99283 15.0953 6.73777 14.8457C5.48271 14.596 4.32987 13.9798 3.42502 13.075C2.52018 12.1701 1.90397 11.0173 1.65432 9.76224C1.40468 8.50718 1.5328 7.20628 2.0225 6.02404C2.5122 4.8418 3.34148 3.83133 4.40546 3.1204Z" + }); + const path = setAttributesNS(createElementNS("path"), { + d: "M6.68775 12.4297C6.78586 12.4745 6.89218 12.4984 7 12.5C7.11275 12.4955 7.22315 12.4664 7.32337 12.4145C7.4236 12.3627 7.51121 12.2894 7.58 12.2L12 5.63999C12.0848 5.47724 12.1071 5.28902 12.0625 5.11098C12.0178 4.93294 11.9095 4.77744 11.7579 4.67392C11.6064 4.57041 11.4221 4.52608 11.24 4.54931C11.0579 4.57254 10.8907 4.66173 10.77 4.79999L6.88 10.57L5.13 8.56999C5.06508 8.49566 4.98613 8.43488 4.89768 8.39111C4.80922 8.34735 4.713 8.32148 4.61453 8.31498C4.51605 8.30847 4.41727 8.32147 4.32382 8.35322C4.23038 8.38497 4.14413 8.43484 4.07 8.49999C3.92511 8.63217 3.83692 8.81523 3.82387 9.01092C3.81083 9.2066 3.87393 9.39976 4 9.54999L6.43 12.24C6.50187 12.3204 6.58964 12.385 6.68775 12.4297Z" + }); + svg.appendChild(g2).append(path, path2); + const speakerDefs = createElementNS("defs"); + const speakerClipPathDef = setAttributesNS(createElementNS("clipPath"), { + id: "clip0_57_156" + }); + const speakerRect = setAttributesNS(createElementNS("rect"), { + width: `${WIDTH}`, + height: `${WIDTH}`, + fill: "white", + transform: "translate(0 0.5)" + }); + speakerClipPathDef.appendChild(speakerRect); + speakerDefs.appendChild(speakerClipPathDef); + svg.appendChild(speakerDefs).appendChild(speakerClipPathDef).appendChild(speakerRect); + return svg; +} +__name(SuccessIcon, "SuccessIcon"); +function Dialog({ open: open2, onFormSubmitted, ...props }) { + const options4 = props.options; + const successIconHtml = q(() => ({ __html: SuccessIcon().outerHTML }), []); + const [timeoutId, setTimeoutId] = p$2(null); + const handleOnSuccessClick = x(() => { + if (timeoutId) { + clearTimeout(timeoutId); + setTimeoutId(null); + } + onFormSubmitted(); + }, [timeoutId]); + const onSubmitSuccess = x( + (data25) => { + props.onSubmitSuccess(data25); + setTimeoutId( + setTimeout(() => { + onFormSubmitted(); + setTimeoutId(null); + }, SUCCESS_MESSAGE_TIMEOUT) + ); + }, + [onFormSubmitted] + ); + return y$1( + g$1$1, + null, + timeoutId ? y$1( + "div", + { class: "success__position", onClick: handleOnSuccessClick }, + y$1( + "div", + { class: "success__content" }, + options4.successMessageText, + y$1("span", { class: "success__icon", dangerouslySetInnerHTML: successIconHtml }) + ) + ) : y$1( + "dialog", + { class: "dialog", onClick: options4.onFormClose, open: open2 }, + y$1( + "div", + { class: "dialog__position" }, + y$1( + "div", + { + class: "dialog__content", + onClick: /* @__PURE__ */ __name((e2) => { + e2.stopPropagation(); + }, "onClick") + }, + y$1(DialogHeader, { options: options4 }), + y$1(Form, { ...props, onSubmitSuccess }) + ) + ) + ) + ); +} +__name(Dialog, "Dialog"); +const DIALOG = ` +.dialog { + position: fixed; + z-index: var(--z-index); + margin: 0; + inset: 0; + + display: flex; + align-items: center; + justify-content: center; + padding: 0; + height: 100vh; + width: 100vw; + + color: var(--dialog-color, var(--foreground)); + fill: var(--dialog-color, var(--foreground)); + line-height: 1.75em; + + background-color: rgba(0, 0, 0, 0.05); + border: none; + inset: 0; + opacity: 1; + transition: opacity 0.2s ease-in-out; +} + +.dialog__position { + position: fixed; + z-index: var(--z-index); + inset: var(--dialog-inset); + padding: var(--page-margin); + display: flex; + max-height: calc(100vh - (2 * var(--page-margin))); +} +@media (max-width: 600px) { + .dialog__position { + inset: var(--page-margin); + padding: 0; + } +} + +.dialog__position:has(.editor) { + inset: var(--page-margin); + padding: 0; +} + +.dialog:not([open]) { + opacity: 0; + pointer-events: none; + visibility: hidden; +} +.dialog:not([open]) .dialog__content { + transform: translate(0, -16px) scale(0.98); +} + +.dialog__content { + display: flex; + flex-direction: column; + gap: 16px; + padding: var(--dialog-padding, 24px); + max-width: 100%; + width: 100%; + max-height: 100%; + overflow: auto; + + background: var(--dialog-background, var(--background)); + border-radius: var(--dialog-border-radius, 20px); + border: var(--dialog-border, var(--border)); + box-shadow: var(--dialog-box-shadow, var(--box-shadow)); + transform: translate(0, 0) scale(1); + transition: transform 0.2s ease-in-out; +} + +`; +const DIALOG_HEADER = ` +.dialog__header { + display: flex; + gap: 4px; + justify-content: space-between; + font-weight: var(--dialog-header-weight, 600); + margin: 0; +} +.dialog__title { + align-self: center; + width: var(--form-width, 272px); +} + +@media (max-width: 600px) { + .dialog__title { + width: auto; + } +} + +.dialog__position:has(.editor) .dialog__title { + width: auto; +} + + +.brand-link { + display: inline-flex; +} +.brand-link:focus-visible { + outline: var(--outline); +} +`; +const FORM = ` +.form { + display: flex; + overflow: auto; + flex-direction: row; + gap: 16px; + flex: 1 0; +} + +.form__right { + flex: 0 0 auto; + display: flex; + overflow: auto; + flex-direction: column; + justify-content: space-between; + gap: 20px; + width: var(--form-width, 100%); +} + +.dialog__position:has(.editor) .form__right { + width: var(--form-width, 272px); +} + +.form__top { + display: flex; + flex-direction: column; + gap: 8px; +} + +.form__error-container { + color: var(--error-color); + fill: var(--error-color); +} + +.form__label { + display: flex; + flex-direction: column; + gap: 4px; + margin: 0px; +} + +.form__label__text { + display: flex; + gap: 4px; + align-items: center; +} + +.form__label__text--required { + font-size: 0.85em; +} + +.form__input { + font-family: inherit; + line-height: inherit; + background: transparent; + box-sizing: border-box; + border: var(--input-border, var(--border)); + border-radius: var(--input-border-radius, 6px); + color: var(--input-color, inherit); + fill: var(--input-color, inherit); + font-size: var(--input-font-size, inherit); + font-weight: var(--input-font-weight, 500); + padding: 6px 12px; +} + +.form__input::placeholder { + opacity: 0.65; + color: var(--input-placeholder-color, inherit); + filter: var(--interactive-filter); +} + +.form__input:focus-visible { + outline: var(--input-focus-outline, var(--outline)); +} + +.form__input--textarea { + font-family: inherit; + resize: vertical; +} + +.error { + color: var(--error-color); + fill: var(--error-color); +} +`; +const BUTTON = ` +.btn-group { + display: grid; + gap: 8px; +} + +.btn { + line-height: inherit; + border: var(--button-border, var(--border)); + border-radius: var(--button-border-radius, 6px); + cursor: pointer; + font-family: inherit; + font-size: var(--button-font-size, inherit); + font-weight: var(--button-font-weight, 600); + padding: var(--button-padding, 6px 16px); +} +.btn[disabled] { + opacity: 0.6; + pointer-events: none; +} + +.btn--primary { + color: var(--button-primary-color, var(--accent-foreground)); + fill: var(--button-primary-color, var(--accent-foreground)); + background: var(--button-primary-background, var(--accent-background)); + border: var(--button-primary-border, var(--border)); + border-radius: var(--button-primary-border-radius, 6px); + font-weight: var(--button-primary-font-weight, 500); +} +.btn--primary:hover { + color: var(--button-primary-hover-color, var(--accent-foreground)); + fill: var(--button-primary-hover-color, var(--accent-foreground)); + background: var(--button-primary-hover-background, var(--accent-background)); + filter: var(--interactive-filter); +} +.btn--primary:focus-visible { + background: var(--button-primary-hover-background, var(--accent-background)); + filter: var(--interactive-filter); + outline: var(--button-primary-focus-outline, var(--outline)); +} + +.btn--default { + color: var(--button-color, var(--foreground)); + fill: var(--button-color, var(--foreground)); + background: var(--button-background, var(--background)); + border: var(--button-border, var(--border)); + border-radius: var(--button-border-radius, 6px); + font-weight: var(--button-font-weight, 500); +} +.btn--default:hover { + color: var(--button-color, var(--foreground)); + fill: var(--button-color, var(--foreground)); + background: var(--button-hover-background, var(--background)); + filter: var(--interactive-filter); +} +.btn--default:focus-visible { + background: var(--button-hover-background, var(--background)); + filter: var(--interactive-filter); + outline: var(--button-focus-outline, var(--outline)); +} +`; +const SUCCESS = ` +.success__position { + position: fixed; + inset: var(--dialog-inset); + padding: var(--page-margin); + z-index: var(--z-index); +} +.success__content { + background: var(--success-background, var(--background)); + border: var(--success-border, var(--border)); + border-radius: var(--success-border-radius, 1.7em/50%); + box-shadow: var(--success-box-shadow, var(--box-shadow)); + font-weight: var(--success-font-weight, 600); + color: var(--success-color); + fill: var(--success-color); + padding: 12px 24px; + line-height: 1.75em; + + display: grid; + align-items: center; + grid-auto-flow: column; + gap: 6px; + cursor: default; +} + +.success__icon { + display: flex; +} +`; +function createDialogStyles(styleNonce) { + const style2 = DOCUMENT.createElement("style"); + style2.textContent = ` +:host { + --dialog-inset: var(--inset); +} + +${DIALOG} +${DIALOG_HEADER} +${FORM} +${BUTTON} +${SUCCESS} +`; + if (styleNonce) { + style2.setAttribute("nonce", styleNonce); + } + return style2; +} +__name(createDialogStyles, "createDialogStyles"); +function getUser() { + const currentUser = getCurrentScope$1().getUser(); + const isolationUser = getIsolationScope().getUser(); + const globalUser = getGlobalScope().getUser(); + if (currentUser && Object.keys(currentUser).length) { + return currentUser; + } + if (isolationUser && Object.keys(isolationUser).length) { + return isolationUser; + } + return globalUser; +} +__name(getUser, "getUser"); +const feedbackModalIntegration = /* @__PURE__ */ __name(() => { + return { + name: "FeedbackModal", + // eslint-disable-next-line @typescript-eslint/no-empty-function + setupOnce() { + }, + createDialog: /* @__PURE__ */ __name(({ options: options4, screenshotIntegration, sendFeedback: sendFeedback2, shadow }) => { + const shadowRoot = shadow; + const userKey = options4.useSentryUser; + const user = getUser(); + const el = DOCUMENT.createElement("div"); + const style2 = createDialogStyles(options4.styleNonce); + let originalOverflow = ""; + const dialog = { + get el() { + return el; + }, + appendToDom() { + if (!shadowRoot.contains(style2) && !shadowRoot.contains(el)) { + shadowRoot.appendChild(style2); + shadowRoot.appendChild(el); + } + }, + removeFromDom() { + shadowRoot.removeChild(el); + shadowRoot.removeChild(style2); + DOCUMENT.body.style.overflow = originalOverflow; + }, + open() { + renderContent(true); + options4.onFormOpen && options4.onFormOpen(); + originalOverflow = DOCUMENT.body.style.overflow; + DOCUMENT.body.style.overflow = "hidden"; + }, + close() { + renderContent(false); + DOCUMENT.body.style.overflow = originalOverflow; + } + }; + const screenshotInput = screenshotIntegration && screenshotIntegration.createInput({ h: y$1, hooks, dialog, options: options4 }); + const renderContent = /* @__PURE__ */ __name((open2) => { + B$1( + y$1( + Dialog, + { + options: options4, + screenshotInput, + showName: options4.showName || options4.isNameRequired, + showEmail: options4.showEmail || options4.isEmailRequired, + defaultName: userKey && user && user[userKey.name] || "", + defaultEmail: userKey && user && user[userKey.email] || "", + onFormClose: /* @__PURE__ */ __name(() => { + renderContent(false); + options4.onFormClose && options4.onFormClose(); + }, "onFormClose"), + onSubmit: sendFeedback2, + onSubmitSuccess: /* @__PURE__ */ __name((data25) => { + renderContent(false); + options4.onSubmitSuccess && options4.onSubmitSuccess(data25); + }, "onSubmitSuccess"), + onSubmitError: /* @__PURE__ */ __name((error2) => { + options4.onSubmitError && options4.onSubmitError(error2); + }, "onSubmitError"), + onFormSubmitted: /* @__PURE__ */ __name(() => { + options4.onFormSubmitted && options4.onFormSubmitted(); + }, "onFormSubmitted"), + open: open2 + } + ), + el + ); + }, "renderContent"); + return dialog; + }, "createDialog") + }; +}, "feedbackModalIntegration"); +function CropCornerFactory({ + h: h2 + // eslint-disable-line @typescript-eslint/no-unused-vars +}) { + return /* @__PURE__ */ __name(function CropCorner({ + top, + left, + corner, + onGrabButton + }) { + return h2( + "button", + { + class: `editor__crop-corner editor__crop-corner--${corner} `, + style: { + top, + left + }, + onMouseDown: /* @__PURE__ */ __name((e2) => { + e2.preventDefault(); + onGrabButton(e2, corner); + }, "onMouseDown"), + onClick: /* @__PURE__ */ __name((e2) => { + e2.preventDefault(); + }, "onClick") + } + ); + }, "CropCorner"); +} +__name(CropCornerFactory, "CropCornerFactory"); +function createScreenshotInputStyles(styleNonce) { + const style2 = DOCUMENT.createElement("style"); + const surface200 = "#1A141F"; + const gray100 = "#302735"; + style2.textContent = ` +.editor { + padding: 10px; + padding-top: 65px; + padding-bottom: 65px; + flex-grow: 1; + + background-color: ${surface200}; + background-image: repeating-linear-gradient( + -145deg, + transparent, + transparent 8px, + ${surface200} 8px, + ${surface200} 11px + ), + repeating-linear-gradient( + -45deg, + transparent, + transparent 15px, + ${gray100} 15px, + ${gray100} 16px + ); +} + +.editor__canvas-container { + width: 100%; + height: 100%; + position: relative; + display: flex; + align-items: center; + justify-content: center; +} + +.editor__canvas-container canvas { + object-fit: contain; + position: relative; +} + +.editor__crop-btn-group { + padding: 8px; + gap: 8px; + border-radius: var(--menu-border-radius, 6px); + background: var(--button-primary-background, var(--background)); + width: 175px; + position: absolute; +} + +.editor__crop-corner { + width: 30px; + height: 30px; + position: absolute; + background: none; + border: 3px solid #ffffff; +} + +.editor__crop-corner--top-left { + cursor: nwse-resize; + border-right: none; + border-bottom: none; +} +.editor__crop-corner--top-right { + cursor: nesw-resize; + border-left: none; + border-bottom: none; +} +.editor__crop-corner--bottom-left { + cursor: nesw-resize; + border-right: none; + border-top: none; +} +.editor__crop-corner--bottom-right { + cursor: nwse-resize; + border-left: none; + border-top: none; +} +`; + if (styleNonce) { + style2.setAttribute("nonce", styleNonce); + } + return style2; +} +__name(createScreenshotInputStyles, "createScreenshotInputStyles"); +function useTakeScreenshotFactory({ hooks: hooks2 }) { + return /* @__PURE__ */ __name(function useTakeScreenshot({ onBeforeScreenshot, onScreenshot, onAfterScreenshot, onError }) { + hooks2.useEffect(() => { + const takeScreenshot = /* @__PURE__ */ __name(async () => { + onBeforeScreenshot(); + const stream = await NAVIGATOR.mediaDevices.getDisplayMedia({ + video: { + width: WINDOW.innerWidth * WINDOW.devicePixelRatio, + height: WINDOW.innerHeight * WINDOW.devicePixelRatio + }, + audio: false, + // @ts-expect-error experimental flags: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia#prefercurrenttab + monitorTypeSurfaces: "exclude", + preferCurrentTab: true, + selfBrowserSurface: "include", + surfaceSwitching: "exclude" + }); + const video = DOCUMENT.createElement("video"); + await new Promise((resolve2, reject3) => { + video.srcObject = stream; + video.onloadedmetadata = () => { + onScreenshot(video); + stream.getTracks().forEach((track2) => track2.stop()); + resolve2(); + }; + video.play().catch(reject3); + }); + onAfterScreenshot(); + }, "takeScreenshot"); + takeScreenshot().catch(onError); + }, []); + }, "useTakeScreenshot"); +} +__name(useTakeScreenshotFactory, "useTakeScreenshotFactory"); +const CROP_BUTTON_SIZE = 30; +const CROP_BUTTON_BORDER = 3; +const CROP_BUTTON_OFFSET = CROP_BUTTON_SIZE + CROP_BUTTON_BORDER; +const DPI = WINDOW.devicePixelRatio; +const constructRect = /* @__PURE__ */ __name((box) => { + return { + x: Math.min(box.startX, box.endX), + y: Math.min(box.startY, box.endY), + width: Math.abs(box.startX - box.endX), + height: Math.abs(box.startY - box.endY) + }; +}, "constructRect"); +const getContainedSize = /* @__PURE__ */ __name((img) => { + const imgClientHeight = img.clientHeight; + const imgClientWidth = img.clientWidth; + const ratio = img.width / img.height; + let width2 = imgClientHeight * ratio; + let height = imgClientHeight; + if (width2 > imgClientWidth) { + width2 = imgClientWidth; + height = imgClientWidth / ratio; + } + const x2 = (imgClientWidth - width2) / 2; + const y2 = (imgClientHeight - height) / 2; + return { startX: x2, startY: y2, endX: width2 + x2, endY: height + y2 }; +}, "getContainedSize"); +function ScreenshotEditorFactory({ + h: h2, + hooks: hooks2, + imageBuffer, + dialog, + options: options4 +}) { + const useTakeScreenshot = useTakeScreenshotFactory({ hooks: hooks2 }); + return /* @__PURE__ */ __name(function ScreenshotEditor({ onError }) { + const styles = hooks2.useMemo(() => ({ __html: createScreenshotInputStyles(options4.styleNonce).innerText }), []); + const CropCorner = CropCornerFactory({ h: h2 }); + const canvasContainerRef = hooks2.useRef(null); + const cropContainerRef = hooks2.useRef(null); + const croppingRef = hooks2.useRef(null); + const [croppingRect, setCroppingRect] = hooks2.useState({ startX: 0, startY: 0, endX: 0, endY: 0 }); + const [confirmCrop, setConfirmCrop] = hooks2.useState(false); + const [isResizing, setIsResizing] = hooks2.useState(false); + hooks2.useEffect(() => { + WINDOW.addEventListener("resize", resizeCropper, false); + }, []); + function resizeCropper() { + const cropper = croppingRef.current; + const imageDimensions = constructRect(getContainedSize(imageBuffer)); + if (cropper) { + cropper.width = imageDimensions.width * DPI; + cropper.height = imageDimensions.height * DPI; + cropper.style.width = `${imageDimensions.width}px`; + cropper.style.height = `${imageDimensions.height}px`; + const ctx = cropper.getContext("2d"); + if (ctx) { + ctx.scale(DPI, DPI); + } + } + const cropButton = cropContainerRef.current; + if (cropButton) { + cropButton.style.width = `${imageDimensions.width}px`; + cropButton.style.height = `${imageDimensions.height}px`; + } + setCroppingRect({ startX: 0, startY: 0, endX: imageDimensions.width, endY: imageDimensions.height }); + } + __name(resizeCropper, "resizeCropper"); + hooks2.useEffect(() => { + const cropper = croppingRef.current; + if (!cropper) { + return; + } + const ctx = cropper.getContext("2d"); + if (!ctx) { + return; + } + const imageDimensions = constructRect(getContainedSize(imageBuffer)); + const croppingBox = constructRect(croppingRect); + ctx.clearRect(0, 0, imageDimensions.width, imageDimensions.height); + ctx.fillStyle = "rgba(0, 0, 0, 0.5)"; + ctx.fillRect(0, 0, imageDimensions.width, imageDimensions.height); + ctx.clearRect(croppingBox.x, croppingBox.y, croppingBox.width, croppingBox.height); + ctx.strokeStyle = "#ffffff"; + ctx.lineWidth = 3; + ctx.strokeRect(croppingBox.x + 1, croppingBox.y + 1, croppingBox.width - 2, croppingBox.height - 2); + ctx.strokeStyle = "#000000"; + ctx.lineWidth = 1; + ctx.strokeRect(croppingBox.x + 3, croppingBox.y + 3, croppingBox.width - 6, croppingBox.height - 6); + }, [croppingRect]); + function onGrabButton(e2, corner) { + setConfirmCrop(false); + setIsResizing(true); + const handleMouseMove2 = makeHandleMouseMove(corner); + const handleMouseUp = /* @__PURE__ */ __name(() => { + DOCUMENT.removeEventListener("mousemove", handleMouseMove2); + DOCUMENT.removeEventListener("mouseup", handleMouseUp); + setConfirmCrop(true); + setIsResizing(false); + }, "handleMouseUp"); + DOCUMENT.addEventListener("mouseup", handleMouseUp); + DOCUMENT.addEventListener("mousemove", handleMouseMove2); + } + __name(onGrabButton, "onGrabButton"); + const makeHandleMouseMove = hooks2.useCallback((corner) => { + return function(e2) { + if (!croppingRef.current) { + return; + } + const cropCanvas = croppingRef.current; + const cropBoundingRect = cropCanvas.getBoundingClientRect(); + const mouseX = e2.clientX - cropBoundingRect.x; + const mouseY = e2.clientY - cropBoundingRect.y; + switch (corner) { + case "top-left": + setCroppingRect((prev2) => ({ + ...prev2, + startX: Math.min(Math.max(0, mouseX), prev2.endX - CROP_BUTTON_OFFSET), + startY: Math.min(Math.max(0, mouseY), prev2.endY - CROP_BUTTON_OFFSET) + })); + break; + case "top-right": + setCroppingRect((prev2) => ({ + ...prev2, + endX: Math.max(Math.min(mouseX, cropCanvas.width / DPI), prev2.startX + CROP_BUTTON_OFFSET), + startY: Math.min(Math.max(0, mouseY), prev2.endY - CROP_BUTTON_OFFSET) + })); + break; + case "bottom-left": + setCroppingRect((prev2) => ({ + ...prev2, + startX: Math.min(Math.max(0, mouseX), prev2.endX - CROP_BUTTON_OFFSET), + endY: Math.max(Math.min(mouseY, cropCanvas.height / DPI), prev2.startY + CROP_BUTTON_OFFSET) + })); + break; + case "bottom-right": + setCroppingRect((prev2) => ({ + ...prev2, + endX: Math.max(Math.min(mouseX, cropCanvas.width / DPI), prev2.startX + CROP_BUTTON_OFFSET), + endY: Math.max(Math.min(mouseY, cropCanvas.height / DPI), prev2.startY + CROP_BUTTON_OFFSET) + })); + break; + } + }; + }, []); + const initialPositionRef = hooks2.useRef({ initialX: 0, initialY: 0 }); + function onDragStart2(e2) { + if (isResizing) return; + initialPositionRef.current = { initialX: e2.clientX, initialY: e2.clientY }; + const handleMouseMove2 = /* @__PURE__ */ __name((moveEvent) => { + const cropCanvas = croppingRef.current; + if (!cropCanvas) return; + const deltaX = moveEvent.clientX - initialPositionRef.current.initialX; + const deltaY = moveEvent.clientY - initialPositionRef.current.initialY; + setCroppingRect((prev2) => { + const newStartX = Math.max( + 0, + Math.min(prev2.startX + deltaX, cropCanvas.width / DPI - (prev2.endX - prev2.startX)) + ); + const newStartY = Math.max( + 0, + Math.min(prev2.startY + deltaY, cropCanvas.height / DPI - (prev2.endY - prev2.startY)) + ); + const newEndX = newStartX + (prev2.endX - prev2.startX); + const newEndY = newStartY + (prev2.endY - prev2.startY); + initialPositionRef.current.initialX = moveEvent.clientX; + initialPositionRef.current.initialY = moveEvent.clientY; + return { + startX: newStartX, + startY: newStartY, + endX: newEndX, + endY: newEndY + }; + }); + }, "handleMouseMove"); + const handleMouseUp = /* @__PURE__ */ __name(() => { + DOCUMENT.removeEventListener("mousemove", handleMouseMove2); + DOCUMENT.removeEventListener("mouseup", handleMouseUp); + }, "handleMouseUp"); + DOCUMENT.addEventListener("mousemove", handleMouseMove2); + DOCUMENT.addEventListener("mouseup", handleMouseUp); + } + __name(onDragStart2, "onDragStart"); + function submit() { + const cutoutCanvas = DOCUMENT.createElement("canvas"); + const imageBox = constructRect(getContainedSize(imageBuffer)); + const croppingBox = constructRect(croppingRect); + cutoutCanvas.width = croppingBox.width * DPI; + cutoutCanvas.height = croppingBox.height * DPI; + const cutoutCtx = cutoutCanvas.getContext("2d"); + if (cutoutCtx && imageBuffer) { + cutoutCtx.drawImage( + imageBuffer, + croppingBox.x / imageBox.width * imageBuffer.width, + croppingBox.y / imageBox.height * imageBuffer.height, + croppingBox.width / imageBox.width * imageBuffer.width, + croppingBox.height / imageBox.height * imageBuffer.height, + 0, + 0, + cutoutCanvas.width, + cutoutCanvas.height + ); + } + const ctx = imageBuffer.getContext("2d"); + if (ctx) { + ctx.clearRect(0, 0, imageBuffer.width, imageBuffer.height); + imageBuffer.width = cutoutCanvas.width; + imageBuffer.height = cutoutCanvas.height; + imageBuffer.style.width = `${croppingBox.width}px`; + imageBuffer.style.height = `${croppingBox.height}px`; + ctx.drawImage(cutoutCanvas, 0, 0); + resizeCropper(); + } + } + __name(submit, "submit"); + useTakeScreenshot({ + onBeforeScreenshot: hooks2.useCallback(() => { + dialog.el.style.display = "none"; + }, []), + onScreenshot: hooks2.useCallback( + (imageSource) => { + const context = imageBuffer.getContext("2d"); + if (!context) { + throw new Error("Could not get canvas context"); + } + imageBuffer.width = imageSource.videoWidth; + imageBuffer.height = imageSource.videoHeight; + imageBuffer.style.width = "100%"; + imageBuffer.style.height = "100%"; + context.drawImage(imageSource, 0, 0); + }, + [imageBuffer] + ), + onAfterScreenshot: hooks2.useCallback(() => { + dialog.el.style.display = "block"; + const container = canvasContainerRef.current; + container && container.appendChild(imageBuffer); + resizeCropper(); + }, []), + onError: hooks2.useCallback((error2) => { + dialog.el.style.display = "block"; + onError(error2); + }, []) + }); + return h2( + "div", + { class: "editor" }, + h2("style", { nonce: options4.styleNonce, dangerouslySetInnerHTML: styles }), + h2( + "div", + { class: "editor__canvas-container", ref: canvasContainerRef }, + h2( + "div", + { class: "editor__crop-container", style: { position: "absolute", zIndex: 1 }, ref: cropContainerRef }, + h2( + "canvas", + { + onMouseDown: onDragStart2, + style: { position: "absolute", cursor: confirmCrop ? "move" : "auto" }, + ref: croppingRef + } + ), + h2( + CropCorner, + { + left: croppingRect.startX - CROP_BUTTON_BORDER, + top: croppingRect.startY - CROP_BUTTON_BORDER, + onGrabButton, + corner: "top-left" + } + ), + h2( + CropCorner, + { + left: croppingRect.endX - CROP_BUTTON_SIZE + CROP_BUTTON_BORDER, + top: croppingRect.startY - CROP_BUTTON_BORDER, + onGrabButton, + corner: "top-right" + } + ), + h2( + CropCorner, + { + left: croppingRect.startX - CROP_BUTTON_BORDER, + top: croppingRect.endY - CROP_BUTTON_SIZE + CROP_BUTTON_BORDER, + onGrabButton, + corner: "bottom-left" + } + ), + h2( + CropCorner, + { + left: croppingRect.endX - CROP_BUTTON_SIZE + CROP_BUTTON_BORDER, + top: croppingRect.endY - CROP_BUTTON_SIZE + CROP_BUTTON_BORDER, + onGrabButton, + corner: "bottom-right" + } + ), + h2( + "div", + { + style: { + left: Math.max(0, croppingRect.endX - 191), + top: Math.max(0, croppingRect.endY + 8), + display: confirmCrop ? "flex" : "none" + }, + class: "editor__crop-btn-group" + }, + h2( + "button", + { + onClick: /* @__PURE__ */ __name((e2) => { + e2.preventDefault(); + if (croppingRef.current) { + setCroppingRect({ + startX: 0, + startY: 0, + endX: croppingRef.current.width / DPI, + endY: croppingRef.current.height / DPI + }); + } + setConfirmCrop(false); + }, "onClick"), + class: "btn btn--default" + }, + options4.cancelButtonLabel + ), + h2( + "button", + { + onClick: /* @__PURE__ */ __name((e2) => { + e2.preventDefault(); + submit(); + setConfirmCrop(false); + }, "onClick"), + class: "btn btn--primary" + }, + options4.confirmButtonLabel + ) + ) + ) + ) + ); + }, "ScreenshotEditor"); +} +__name(ScreenshotEditorFactory, "ScreenshotEditorFactory"); +const feedbackScreenshotIntegration = /* @__PURE__ */ __name(() => { + return { + name: "FeedbackScreenshot", + // eslint-disable-next-line @typescript-eslint/no-empty-function + setupOnce() { + }, + createInput: /* @__PURE__ */ __name(({ h: h2, hooks: hooks2, dialog, options: options4 }) => { + const imageBuffer = DOCUMENT.createElement("canvas"); + return { + input: ScreenshotEditorFactory({ + h: h2, + hooks: hooks2, + imageBuffer, + dialog, + options: options4 + }), + // eslint-disable-line @typescript-eslint/no-explicit-any + value: /* @__PURE__ */ __name(async () => { + const blob = await new Promise((resolve2) => { + imageBuffer.toBlob(resolve2, "image/png"); + }); + if (blob) { + const data25 = new Uint8Array(await blob.arrayBuffer()); + const attachment = { + data: data25, + filename: "screenshot.png", + contentType: "application/png" + // attachmentType?: string; + }; + return attachment; + } + return void 0; + }, "value") + }; + }, "createInput") + }; +}, "feedbackScreenshotIntegration"); +const feedbackAsyncIntegration = buildFeedbackIntegration({ + lazyLoadIntegration +}); +const feedbackSyncIntegration = buildFeedbackIntegration({ + getModalIntegration: /* @__PURE__ */ __name(() => feedbackModalIntegration, "getModalIntegration"), + getScreenshotIntegration: /* @__PURE__ */ __name(() => feedbackScreenshotIntegration, "getScreenshotIntegration") +}); +function increment(name2, value4 = 1, data25) { + metrics$1.increment(BrowserMetricsAggregator, name2, value4, data25); +} +__name(increment, "increment"); +function distribution(name2, value4, data25) { + metrics$1.distribution(BrowserMetricsAggregator, name2, value4, data25); +} +__name(distribution, "distribution"); +function set$5(name2, value4, data25) { + metrics$1.set(BrowserMetricsAggregator, name2, value4, data25); +} +__name(set$5, "set$5"); +function gauge(name2, value4, data25) { + metrics$1.gauge(BrowserMetricsAggregator, name2, value4, data25); +} +__name(gauge, "gauge"); +function timing(name2, value4, unit = "second", data25) { + return metrics$1.timing(BrowserMetricsAggregator, name2, value4, unit, data25); +} +__name(timing, "timing"); +const metrics = { + increment, + distribution, + set: set$5, + gauge, + timing +}; +const responseToSpanId = /* @__PURE__ */ new WeakMap(); +const spanIdToEndTimestamp = /* @__PURE__ */ new Map(); +const defaultRequestInstrumentationOptions = { + traceFetch: true, + traceXHR: true, + enableHTTPTimings: true, + trackFetchStreamPerformance: false +}; +function instrumentOutgoingRequests(client, _options) { + const { + traceFetch, + traceXHR, + trackFetchStreamPerformance, + shouldCreateSpanForRequest, + enableHTTPTimings, + tracePropagationTargets + } = { + traceFetch: defaultRequestInstrumentationOptions.traceFetch, + traceXHR: defaultRequestInstrumentationOptions.traceXHR, + trackFetchStreamPerformance: defaultRequestInstrumentationOptions.trackFetchStreamPerformance, + ..._options + }; + const shouldCreateSpan = typeof shouldCreateSpanForRequest === "function" ? shouldCreateSpanForRequest : (_2) => true; + const shouldAttachHeadersWithTargets = /* @__PURE__ */ __name((url) => shouldAttachHeaders(url, tracePropagationTargets), "shouldAttachHeadersWithTargets"); + const spans = {}; + if (traceFetch) { + client.addEventProcessor((event) => { + if (event.type === "transaction" && event.spans) { + event.spans.forEach((span) => { + if (span.op === "http.client") { + const updatedTimestamp = spanIdToEndTimestamp.get(span.span_id); + if (updatedTimestamp) { + span.timestamp = updatedTimestamp / 1e3; + spanIdToEndTimestamp.delete(span.span_id); + } + } + }); + } + return event; + }); + if (trackFetchStreamPerformance) { + addFetchEndInstrumentationHandler((handlerData) => { + if (handlerData.response) { + const span = responseToSpanId.get(handlerData.response); + if (span && handlerData.endTimestamp) { + spanIdToEndTimestamp.set(span, handlerData.endTimestamp); + } + } + }); + } + addFetchInstrumentationHandler((handlerData) => { + const createdSpan = instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans); + if (handlerData.response && handlerData.fetchData.__span) { + responseToSpanId.set(handlerData.response, handlerData.fetchData.__span); + } + if (createdSpan) { + const fullUrl = getFullURL(handlerData.fetchData.url); + const host = fullUrl ? parseUrl$1(fullUrl).host : void 0; + createdSpan.setAttributes({ + "http.url": fullUrl, + "server.address": host + }); + } + if (enableHTTPTimings && createdSpan) { + addHTTPTimings(createdSpan); + } + }); + } + if (traceXHR) { + addXhrInstrumentationHandler((handlerData) => { + const createdSpan = xhrCallback(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans); + if (enableHTTPTimings && createdSpan) { + addHTTPTimings(createdSpan); + } + }); + } +} +__name(instrumentOutgoingRequests, "instrumentOutgoingRequests"); +function isPerformanceResourceTiming(entry) { + return entry.entryType === "resource" && "initiatorType" in entry && typeof entry.nextHopProtocol === "string" && (entry.initiatorType === "fetch" || entry.initiatorType === "xmlhttprequest"); +} +__name(isPerformanceResourceTiming, "isPerformanceResourceTiming"); +function addHTTPTimings(span) { + const { url } = spanToJSON(span).data || {}; + if (!url || typeof url !== "string") { + return; + } + const cleanup = addPerformanceInstrumentationHandler("resource", ({ entries }) => { + entries.forEach((entry) => { + if (isPerformanceResourceTiming(entry) && entry.name.endsWith(url)) { + const spanData = resourceTimingEntryToSpanData(entry); + spanData.forEach((data25) => span.setAttribute(...data25)); + setTimeout(cleanup); + } + }); + }); +} +__name(addHTTPTimings, "addHTTPTimings"); +function extractNetworkProtocol(nextHopProtocol) { + let name2 = "unknown"; + let version2 = "unknown"; + let _name = ""; + for (const char of nextHopProtocol) { + if (char === "/") { + [name2, version2] = nextHopProtocol.split("/"); + break; + } + if (!isNaN(Number(char))) { + name2 = _name === "h" ? "http" : _name; + version2 = nextHopProtocol.split(_name)[1]; + break; + } + _name += char; + } + if (_name === nextHopProtocol) { + name2 = _name; + } + return { name: name2, version: version2 }; +} +__name(extractNetworkProtocol, "extractNetworkProtocol"); +function getAbsoluteTime(time = 0) { + return ((browserPerformanceTimeOrigin || performance.timeOrigin) + time) / 1e3; +} +__name(getAbsoluteTime, "getAbsoluteTime"); +function resourceTimingEntryToSpanData(resourceTiming) { + const { name: name2, version: version2 } = extractNetworkProtocol(resourceTiming.nextHopProtocol); + const timingSpanData = []; + timingSpanData.push(["network.protocol.version", version2], ["network.protocol.name", name2]); + if (!browserPerformanceTimeOrigin) { + return timingSpanData; + } + return [ + ...timingSpanData, + ["http.request.redirect_start", getAbsoluteTime(resourceTiming.redirectStart)], + ["http.request.fetch_start", getAbsoluteTime(resourceTiming.fetchStart)], + ["http.request.domain_lookup_start", getAbsoluteTime(resourceTiming.domainLookupStart)], + ["http.request.domain_lookup_end", getAbsoluteTime(resourceTiming.domainLookupEnd)], + ["http.request.connect_start", getAbsoluteTime(resourceTiming.connectStart)], + ["http.request.secure_connection_start", getAbsoluteTime(resourceTiming.secureConnectionStart)], + ["http.request.connection_end", getAbsoluteTime(resourceTiming.connectEnd)], + ["http.request.request_start", getAbsoluteTime(resourceTiming.requestStart)], + ["http.request.response_start", getAbsoluteTime(resourceTiming.responseStart)], + ["http.request.response_end", getAbsoluteTime(resourceTiming.responseEnd)] + ]; +} +__name(resourceTimingEntryToSpanData, "resourceTimingEntryToSpanData"); +function shouldAttachHeaders(targetUrl, tracePropagationTargets) { + const href = WINDOW$5.location && WINDOW$5.location.href; + if (!href) { + const isRelativeSameOriginRequest = !!targetUrl.match(/^\/(?!\/)/); + if (!tracePropagationTargets) { + return isRelativeSameOriginRequest; + } else { + return stringMatchesSomePattern(targetUrl, tracePropagationTargets); + } + } else { + let resolvedUrl; + let currentOrigin; + try { + resolvedUrl = new URL(targetUrl, href); + currentOrigin = new URL(href).origin; + } catch (e2) { + return false; + } + const isSameOriginRequest = resolvedUrl.origin === currentOrigin; + if (!tracePropagationTargets) { + return isSameOriginRequest; + } else { + return stringMatchesSomePattern(resolvedUrl.toString(), tracePropagationTargets) || isSameOriginRequest && stringMatchesSomePattern(resolvedUrl.pathname, tracePropagationTargets); + } + } +} +__name(shouldAttachHeaders, "shouldAttachHeaders"); +function xhrCallback(handlerData, shouldCreateSpan, shouldAttachHeaders2, spans) { + const xhr = handlerData.xhr; + const sentryXhrData = xhr && xhr[SENTRY_XHR_DATA_KEY]; + if (!xhr || xhr.__sentry_own_request__ || !sentryXhrData) { + return void 0; + } + const shouldCreateSpanResult = hasTracingEnabled() && shouldCreateSpan(sentryXhrData.url); + if (handlerData.endTimestamp && shouldCreateSpanResult) { + const spanId = xhr.__sentry_xhr_span_id__; + if (!spanId) return; + const span2 = spans[spanId]; + if (span2 && sentryXhrData.status_code !== void 0) { + setHttpStatus(span2, sentryXhrData.status_code); + span2.end(); + delete spans[spanId]; + } + return void 0; + } + const fullUrl = getFullURL(sentryXhrData.url); + const host = fullUrl ? parseUrl$1(fullUrl).host : void 0; + const hasParent = !!getActiveSpan(); + const span = shouldCreateSpanResult && hasParent ? startInactiveSpan({ + name: `${sentryXhrData.method} ${sentryXhrData.url}`, + attributes: { + type: "xhr", + "http.method": sentryXhrData.method, + "http.url": fullUrl, + url: sentryXhrData.url, + "server.address": host, + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.browser", + [SEMANTIC_ATTRIBUTE_SENTRY_OP]: "http.client" + } + }) : new SentryNonRecordingSpan(); + xhr.__sentry_xhr_span_id__ = span.spanContext().spanId; + spans[xhr.__sentry_xhr_span_id__] = span; + if (shouldAttachHeaders2(sentryXhrData.url)) { + addTracingHeadersToXhrRequest( + xhr, + // If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction), + // we do not want to use the span as base for the trace headers, + // which means that the headers will be generated from the scope and the sampling decision is deferred + hasTracingEnabled() && hasParent ? span : void 0 + ); + } + return span; +} +__name(xhrCallback, "xhrCallback"); +function addTracingHeadersToXhrRequest(xhr, span) { + const { "sentry-trace": sentryTrace, baggage } = getTraceData({ span }); + if (sentryTrace) { + setHeaderOnXhr(xhr, sentryTrace, baggage); + } +} +__name(addTracingHeadersToXhrRequest, "addTracingHeadersToXhrRequest"); +function setHeaderOnXhr(xhr, sentryTraceHeader, sentryBaggageHeader) { + try { + xhr.setRequestHeader("sentry-trace", sentryTraceHeader); + if (sentryBaggageHeader) { + xhr.setRequestHeader("baggage", sentryBaggageHeader); + } + } catch (_2) { + } +} +__name(setHeaderOnXhr, "setHeaderOnXhr"); +function getFullURL(url) { + try { + const parsed = new URL(url, WINDOW$5.location.origin); + return parsed.href; + } catch (e2) { + return void 0; + } +} +__name(getFullURL, "getFullURL"); +function registerBackgroundTabDetection() { + if (WINDOW$5 && WINDOW$5.document) { + WINDOW$5.document.addEventListener("visibilitychange", () => { + const activeSpan = getActiveSpan(); + if (!activeSpan) { + return; + } + const rootSpan = getRootSpan(activeSpan); + if (WINDOW$5.document.hidden && rootSpan) { + const cancelledStatus = "cancelled"; + const { op, status } = spanToJSON(rootSpan); + if (DEBUG_BUILD$4) { + logger$2.log(`[Tracing] Transaction: ${cancelledStatus} -> since tab moved to the background, op: ${op}`); + } + if (!status) { + rootSpan.setStatus({ code: SPAN_STATUS_ERROR, message: cancelledStatus }); + } + rootSpan.setAttribute("sentry.cancellation_reason", "document.hidden"); + rootSpan.end(); + } + }); + } else { + DEBUG_BUILD$4 && logger$2.warn("[Tracing] Could not set up background tab detection due to lack of global document"); + } +} +__name(registerBackgroundTabDetection, "registerBackgroundTabDetection"); +const BROWSER_TRACING_INTEGRATION_ID = "BrowserTracing"; +const DEFAULT_BROWSER_TRACING_OPTIONS = { + ...TRACING_DEFAULTS, + instrumentNavigation: true, + instrumentPageLoad: true, + markBackgroundSpan: true, + enableLongTask: true, + enableLongAnimationFrame: true, + enableInp: true, + _experiments: {}, + ...defaultRequestInstrumentationOptions +}; +const browserTracingIntegration$1 = /* @__PURE__ */ __name((_options = {}) => { + registerSpanErrorInstrumentation(); + const { + enableInp, + enableLongTask, + enableLongAnimationFrame, + _experiments: { enableInteractions, enableStandaloneClsSpans }, + beforeStartSpan, + idleTimeout, + finalTimeout, + childSpanTimeout, + markBackgroundSpan, + traceFetch, + traceXHR, + trackFetchStreamPerformance, + shouldCreateSpanForRequest, + enableHTTPTimings, + instrumentPageLoad, + instrumentNavigation + } = { + ...DEFAULT_BROWSER_TRACING_OPTIONS, + ..._options + }; + const _collectWebVitals = startTrackingWebVitals({ recordClsStandaloneSpans: enableStandaloneClsSpans || false }); + if (enableInp) { + startTrackingINP(); + } + if (enableLongAnimationFrame && GLOBAL_OBJ.PerformanceObserver && PerformanceObserver.supportedEntryTypes && PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")) { + startTrackingLongAnimationFrames(); + } else if (enableLongTask) { + startTrackingLongTasks(); + } + if (enableInteractions) { + startTrackingInteractions(); + } + const latestRoute = { + name: void 0, + source: void 0 + }; + function _createRouteSpan(client, startSpanOptions) { + const isPageloadTransaction = startSpanOptions.op === "pageload"; + const finalStartSpanOptions = beforeStartSpan ? beforeStartSpan(startSpanOptions) : startSpanOptions; + const attributes = finalStartSpanOptions.attributes || {}; + if (startSpanOptions.name !== finalStartSpanOptions.name) { + attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = "custom"; + finalStartSpanOptions.attributes = attributes; + } + latestRoute.name = finalStartSpanOptions.name; + latestRoute.source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; + const idleSpan = startIdleSpan(finalStartSpanOptions, { + idleTimeout, + finalTimeout, + childSpanTimeout, + // should wait for finish signal if it's a pageload transaction + disableAutoFinish: isPageloadTransaction, + beforeSpanEnd: /* @__PURE__ */ __name((span) => { + _collectWebVitals(); + addPerformanceEntries(span, { recordClsOnPageloadSpan: !enableStandaloneClsSpans }); + }, "beforeSpanEnd") + }); + function emitFinish() { + if (["interactive", "complete"].includes(WINDOW$5.document.readyState)) { + client.emit("idleSpanEnableAutoFinish", idleSpan); + } + } + __name(emitFinish, "emitFinish"); + if (isPageloadTransaction && WINDOW$5.document) { + WINDOW$5.document.addEventListener("readystatechange", () => { + emitFinish(); + }); + emitFinish(); + } + return idleSpan; + } + __name(_createRouteSpan, "_createRouteSpan"); + return { + name: BROWSER_TRACING_INTEGRATION_ID, + afterAllSetup(client) { + let activeSpan; + let startingUrl = WINDOW$5.location && WINDOW$5.location.href; + function maybeEndActiveSpan() { + if (activeSpan && !spanToJSON(activeSpan).timestamp) { + DEBUG_BUILD$4 && logger$2.log(`[Tracing] Finishing current active span with op: ${spanToJSON(activeSpan).op}`); + activeSpan.end(); + } + } + __name(maybeEndActiveSpan, "maybeEndActiveSpan"); + client.on("startNavigationSpan", (startSpanOptions) => { + if (getClient() !== client) { + return; + } + maybeEndActiveSpan(); + activeSpan = _createRouteSpan(client, { + op: "navigation", + ...startSpanOptions + }); + }); + client.on("startPageLoadSpan", (startSpanOptions, traceOptions = {}) => { + if (getClient() !== client) { + return; + } + maybeEndActiveSpan(); + const sentryTrace = traceOptions.sentryTrace || getMetaContent("sentry-trace"); + const baggage = traceOptions.baggage || getMetaContent("baggage"); + const propagationContext = propagationContextFromHeaders(sentryTrace, baggage); + getCurrentScope$1().setPropagationContext(propagationContext); + activeSpan = _createRouteSpan(client, { + op: "pageload", + ...startSpanOptions + }); + }); + client.on("spanEnd", (span) => { + const op = spanToJSON(span).op; + if (span !== getRootSpan(span) || op !== "navigation" && op !== "pageload") { + return; + } + const scope = getCurrentScope$1(); + const oldPropagationContext = scope.getPropagationContext(); + scope.setPropagationContext({ + ...oldPropagationContext, + sampled: oldPropagationContext.sampled !== void 0 ? oldPropagationContext.sampled : spanIsSampled(span), + dsc: oldPropagationContext.dsc || getDynamicSamplingContextFromSpan(span) + }); + }); + if (WINDOW$5.location) { + if (instrumentPageLoad) { + startBrowserTracingPageLoadSpan(client, { + name: WINDOW$5.location.pathname, + // pageload should always start at timeOrigin (and needs to be in s, not ms) + startTime: browserPerformanceTimeOrigin ? browserPerformanceTimeOrigin / 1e3 : void 0, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "url", + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.pageload.browser" + } + }); + } + if (instrumentNavigation) { + addHistoryInstrumentationHandler(({ to, from: from2 }) => { + if (from2 === void 0 && startingUrl && startingUrl.indexOf(to) !== -1) { + startingUrl = void 0; + return; + } + if (from2 !== to) { + startingUrl = void 0; + startBrowserTracingNavigationSpan(client, { + name: WINDOW$5.location.pathname, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "url", + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.navigation.browser" + } + }); + } + }); + } + } + if (markBackgroundSpan) { + registerBackgroundTabDetection(); + } + if (enableInteractions) { + registerInteractionListener(idleTimeout, finalTimeout, childSpanTimeout, latestRoute); + } + if (enableInp) { + registerInpInteractionListener(); + } + instrumentOutgoingRequests(client, { + traceFetch, + traceXHR, + trackFetchStreamPerformance, + tracePropagationTargets: client.getOptions().tracePropagationTargets, + shouldCreateSpanForRequest, + enableHTTPTimings + }); + } + }; +}, "browserTracingIntegration$1"); +function startBrowserTracingPageLoadSpan(client, spanOptions, traceOptions) { + client.emit("startPageLoadSpan", spanOptions, traceOptions); + getCurrentScope$1().setTransactionName(spanOptions.name); + const span = getActiveSpan(); + const op = span && spanToJSON(span).op; + return op === "pageload" ? span : void 0; +} +__name(startBrowserTracingPageLoadSpan, "startBrowserTracingPageLoadSpan"); +function startBrowserTracingNavigationSpan(client, spanOptions) { + getIsolationScope().setPropagationContext({ traceId: generateTraceId() }); + getCurrentScope$1().setPropagationContext({ traceId: generateTraceId() }); + client.emit("startNavigationSpan", spanOptions); + getCurrentScope$1().setTransactionName(spanOptions.name); + const span = getActiveSpan(); + const op = span && spanToJSON(span).op; + return op === "navigation" ? span : void 0; +} +__name(startBrowserTracingNavigationSpan, "startBrowserTracingNavigationSpan"); +function getMetaContent(metaName) { + const metaTag = getDomElement(`meta[name=${metaName}]`); + return metaTag ? metaTag.getAttribute("content") : void 0; +} +__name(getMetaContent, "getMetaContent"); +function registerInteractionListener(idleTimeout, finalTimeout, childSpanTimeout, latestRoute) { + let inflightInteractionSpan; + const registerInteractionTransaction = /* @__PURE__ */ __name(() => { + const op = "ui.action.click"; + const activeSpan = getActiveSpan(); + const rootSpan = activeSpan && getRootSpan(activeSpan); + if (rootSpan) { + const currentRootSpanOp = spanToJSON(rootSpan).op; + if (["navigation", "pageload"].includes(currentRootSpanOp)) { + DEBUG_BUILD$4 && logger$2.warn(`[Tracing] Did not create ${op} span because a pageload or navigation span is in progress.`); + return void 0; + } + } + if (inflightInteractionSpan) { + inflightInteractionSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, "interactionInterrupted"); + inflightInteractionSpan.end(); + inflightInteractionSpan = void 0; + } + if (!latestRoute.name) { + DEBUG_BUILD$4 && logger$2.warn(`[Tracing] Did not create ${op} transaction because _latestRouteName is missing.`); + return void 0; + } + inflightInteractionSpan = startIdleSpan( + { + name: latestRoute.name, + op, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: latestRoute.source || "url" + } + }, + { + idleTimeout, + finalTimeout, + childSpanTimeout + } + ); + }, "registerInteractionTransaction"); + if (WINDOW$5.document) { + addEventListener("click", registerInteractionTransaction, { once: false, capture: true }); + } +} +__name(registerInteractionListener, "registerInteractionListener"); +function promisifyRequest(request) { + return new Promise((resolve2, reject3) => { + request.oncomplete = request.onsuccess = () => resolve2(request.result); + request.onabort = request.onerror = () => reject3(request.error); + }); +} +__name(promisifyRequest, "promisifyRequest"); +function createStore(dbName, storeName) { + const request = indexedDB.open(dbName); + request.onupgradeneeded = () => request.result.createObjectStore(storeName); + const dbp = promisifyRequest(request); + return (callback) => dbp.then((db) => callback(db.transaction(storeName, "readwrite").objectStore(storeName))); +} +__name(createStore, "createStore"); +function keys$7(store) { + return promisifyRequest(store.getAllKeys()); +} +__name(keys$7, "keys$7"); +function push(store, value4, maxQueueSize) { + return store((store2) => { + return keys$7(store2).then((keys2) => { + if (keys2.length >= maxQueueSize) { + return; + } + store2.put(value4, Math.max(...keys2, 0) + 1); + return promisifyRequest(store2.transaction); + }); + }); +} +__name(push, "push"); +function unshift(store, value4, maxQueueSize) { + return store((store2) => { + return keys$7(store2).then((keys2) => { + if (keys2.length >= maxQueueSize) { + return; + } + store2.put(value4, Math.min(...keys2, 0) - 1); + return promisifyRequest(store2.transaction); + }); + }); +} +__name(unshift, "unshift"); +function shift$1(store) { + return store((store2) => { + return keys$7(store2).then((keys2) => { + const firstKey = keys2[0]; + if (firstKey == null) { + return void 0; + } + return promisifyRequest(store2.get(firstKey)).then((value4) => { + store2.delete(firstKey); + return promisifyRequest(store2.transaction).then(() => value4); + }); + }); + }); +} +__name(shift$1, "shift$1"); +function createIndexedDbStore(options4) { + let store; + function getStore() { + if (store == void 0) { + store = createStore(options4.dbName || "sentry-offline", options4.storeName || "queue"); + } + return store; + } + __name(getStore, "getStore"); + return { + push: /* @__PURE__ */ __name(async (env) => { + try { + const serialized = await serializeEnvelope(env); + await push(getStore(), serialized, options4.maxQueueSize || 30); + } catch (_2) { + } + }, "push"), + unshift: /* @__PURE__ */ __name(async (env) => { + try { + const serialized = await serializeEnvelope(env); + await unshift(getStore(), serialized, options4.maxQueueSize || 30); + } catch (_2) { + } + }, "unshift"), + shift: /* @__PURE__ */ __name(async () => { + try { + const deserialized = await shift$1(getStore()); + if (deserialized) { + return parseEnvelope(deserialized); + } + } catch (_2) { + } + return void 0; + }, "shift") + }; +} +__name(createIndexedDbStore, "createIndexedDbStore"); +function makeIndexedDbOfflineTransport(createTransport2) { + return (options4) => createTransport2({ ...options4, createStore: createIndexedDbStore }); +} +__name(makeIndexedDbOfflineTransport, "makeIndexedDbOfflineTransport"); +function makeBrowserOfflineTransport(createTransport2 = makeFetchTransport) { + return makeIndexedDbOfflineTransport(makeOfflineTransport(createTransport2)); +} +__name(makeBrowserOfflineTransport, "makeBrowserOfflineTransport"); +const MS_TO_NS = 1e6; +const THREAD_ID_STRING = String(0); +const THREAD_NAME = "main"; +let OS_PLATFORM = ""; +let OS_PLATFORM_VERSION = ""; +let OS_ARCH = ""; +let OS_BROWSER = WINDOW$5.navigator && WINDOW$5.navigator.userAgent || ""; +let OS_MODEL = ""; +const OS_LOCALE = WINDOW$5.navigator && WINDOW$5.navigator.language || WINDOW$5.navigator && WINDOW$5.navigator.languages && WINDOW$5.navigator.languages[0] || ""; +function isUserAgentData(data25) { + return typeof data25 === "object" && data25 !== null && "getHighEntropyValues" in data25; +} +__name(isUserAgentData, "isUserAgentData"); +const userAgentData = WINDOW$5.navigator && WINDOW$5.navigator.userAgentData; +if (isUserAgentData(userAgentData)) { + userAgentData.getHighEntropyValues(["architecture", "model", "platform", "platformVersion", "fullVersionList"]).then((ua) => { + OS_PLATFORM = ua.platform || ""; + OS_ARCH = ua.architecture || ""; + OS_MODEL = ua.model || ""; + OS_PLATFORM_VERSION = ua.platformVersion || ""; + if (ua.fullVersionList && ua.fullVersionList.length > 0) { + const firstUa = ua.fullVersionList[ua.fullVersionList.length - 1]; + OS_BROWSER = `${firstUa.brand} ${firstUa.version}`; + } + }).catch((e2) => void 0); +} +function isProcessedJSSelfProfile(profile) { + return !("thread_metadata" in profile); +} +__name(isProcessedJSSelfProfile, "isProcessedJSSelfProfile"); +function enrichWithThreadInformation(profile) { + if (!isProcessedJSSelfProfile(profile)) { + return profile; + } + return convertJSSelfProfileToSampledFormat(profile); +} +__name(enrichWithThreadInformation, "enrichWithThreadInformation"); +function getTraceId(event) { + const traceId = event && event.contexts && event.contexts["trace"] && event.contexts["trace"]["trace_id"]; + if (typeof traceId === "string" && traceId.length !== 32) { + if (DEBUG_BUILD$4) { + logger$2.log(`[Profiling] Invalid traceId: ${traceId} on profiled event`); + } + } + if (typeof traceId !== "string") { + return ""; + } + return traceId; +} +__name(getTraceId, "getTraceId"); +function createProfilePayload(profile_id, start_timestamp, processed_profile, event) { + if (event.type !== "transaction") { + throw new TypeError("Profiling events may only be attached to transactions, this should never occur."); + } + if (processed_profile === void 0 || processed_profile === null) { + throw new TypeError( + `Cannot construct profiling event envelope without a valid profile. Got ${processed_profile} instead.` + ); + } + const traceId = getTraceId(event); + const enrichedThreadProfile = enrichWithThreadInformation(processed_profile); + const transactionStartMs = start_timestamp ? start_timestamp : typeof event.start_timestamp === "number" ? event.start_timestamp * 1e3 : timestampInSeconds() * 1e3; + const transactionEndMs = typeof event.timestamp === "number" ? event.timestamp * 1e3 : timestampInSeconds() * 1e3; + const profile = { + event_id: profile_id, + timestamp: new Date(transactionStartMs).toISOString(), + platform: "javascript", + version: "1", + release: event.release || "", + environment: event.environment || DEFAULT_ENVIRONMENT, + runtime: { + name: "javascript", + version: WINDOW$5.navigator.userAgent + }, + os: { + name: OS_PLATFORM, + version: OS_PLATFORM_VERSION, + build_number: OS_BROWSER + }, + device: { + locale: OS_LOCALE, + model: OS_MODEL, + manufacturer: OS_BROWSER, + architecture: OS_ARCH, + is_emulator: false + }, + debug_meta: { + images: applyDebugMetadata(processed_profile.resources) + }, + profile: enrichedThreadProfile, + transactions: [ + { + name: event.transaction || "", + id: event.event_id || uuid4(), + trace_id: traceId, + active_thread_id: THREAD_ID_STRING, + relative_start_ns: "0", + relative_end_ns: ((transactionEndMs - transactionStartMs) * 1e6).toFixed(0) + } + ] + }; + return profile; +} +__name(createProfilePayload, "createProfilePayload"); +function isAutomatedPageLoadSpan(span) { + return spanToJSON(span).op === "pageload"; +} +__name(isAutomatedPageLoadSpan, "isAutomatedPageLoadSpan"); +function convertJSSelfProfileToSampledFormat(input) { + let EMPTY_STACK_ID = void 0; + let STACK_ID = 0; + const profile = { + samples: [], + stacks: [], + frames: [], + thread_metadata: { + [THREAD_ID_STRING]: { name: THREAD_NAME } + } + }; + const firstSample = input.samples[0]; + if (!firstSample) { + return profile; + } + const start2 = firstSample.timestamp; + const origin2 = typeof performance.timeOrigin === "number" ? performance.timeOrigin : browserPerformanceTimeOrigin || 0; + const adjustForOriginChange = origin2 - (browserPerformanceTimeOrigin || origin2); + input.samples.forEach((jsSample, i2) => { + if (jsSample.stackId === void 0) { + if (EMPTY_STACK_ID === void 0) { + EMPTY_STACK_ID = STACK_ID; + profile.stacks[EMPTY_STACK_ID] = []; + STACK_ID++; + } + profile["samples"][i2] = { + // convert ms timestamp to ns + elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start2) * MS_TO_NS).toFixed(0), + stack_id: EMPTY_STACK_ID, + thread_id: THREAD_ID_STRING + }; + return; + } + let stackTop = input.stacks[jsSample.stackId]; + const stack2 = []; + while (stackTop) { + stack2.push(stackTop.frameId); + const frame = input.frames[stackTop.frameId]; + if (frame && profile.frames[stackTop.frameId] === void 0) { + profile.frames[stackTop.frameId] = { + function: frame.name, + abs_path: typeof frame.resourceId === "number" ? input.resources[frame.resourceId] : void 0, + lineno: frame.line, + colno: frame.column + }; + } + stackTop = stackTop.parentId === void 0 ? void 0 : input.stacks[stackTop.parentId]; + } + const sample = { + // convert ms timestamp to ns + elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start2) * MS_TO_NS).toFixed(0), + stack_id: STACK_ID, + thread_id: THREAD_ID_STRING + }; + profile["stacks"][STACK_ID] = stack2; + profile["samples"][i2] = sample; + STACK_ID++; + }); + return profile; +} +__name(convertJSSelfProfileToSampledFormat, "convertJSSelfProfileToSampledFormat"); +function addProfilesToEnvelope(envelope, profiles) { + if (!profiles.length) { + return envelope; + } + for (const profile of profiles) { + envelope[1].push([{ type: "profile" }, profile]); + } + return envelope; +} +__name(addProfilesToEnvelope, "addProfilesToEnvelope"); +function findProfiledTransactionsFromEnvelope(envelope) { + const events2 = []; + forEachEnvelopeItem(envelope, (item3, type) => { + if (type !== "transaction") { + return; + } + for (let j2 = 1; j2 < item3.length; j2++) { + const event = item3[j2]; + if (event && event.contexts && event.contexts["profile"] && event.contexts["profile"]["profile_id"]) { + events2.push(item3[j2]); + } + } + }); + return events2; +} +__name(findProfiledTransactionsFromEnvelope, "findProfiledTransactionsFromEnvelope"); +function applyDebugMetadata(resource_paths) { + const client = getClient(); + const options4 = client && client.getOptions(); + const stackParser = options4 && options4.stackParser; + if (!stackParser) { + return []; + } + return getDebugImagesForResources(stackParser, resource_paths); +} +__name(applyDebugMetadata, "applyDebugMetadata"); +function isValidSampleRate(rate) { + if (typeof rate !== "number" && typeof rate !== "boolean" || typeof rate === "number" && isNaN(rate)) { + DEBUG_BUILD$4 && logger$2.warn( + `[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify( + rate + )} of type ${JSON.stringify(typeof rate)}.` + ); + return false; + } + if (rate === true || rate === false) { + return true; + } + if (rate < 0 || rate > 1) { + DEBUG_BUILD$4 && logger$2.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`); + return false; + } + return true; +} +__name(isValidSampleRate, "isValidSampleRate"); +function isValidProfile(profile) { + if (profile.samples.length < 2) { + if (DEBUG_BUILD$4) { + logger$2.log("[Profiling] Discarding profile because it contains less than 2 samples"); + } + return false; + } + if (!profile.frames.length) { + if (DEBUG_BUILD$4) { + logger$2.log("[Profiling] Discarding profile because it contains no frames"); + } + return false; + } + return true; +} +__name(isValidProfile, "isValidProfile"); +let PROFILING_CONSTRUCTOR_FAILED = false; +const MAX_PROFILE_DURATION_MS = 3e4; +function isJSProfilerSupported(maybeProfiler) { + return typeof maybeProfiler === "function"; +} +__name(isJSProfilerSupported, "isJSProfilerSupported"); +function startJSSelfProfile() { + const JSProfilerConstructor = WINDOW$5.Profiler; + if (!isJSProfilerSupported(JSProfilerConstructor)) { + if (DEBUG_BUILD$4) { + logger$2.log( + "[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object." + ); + } + return; + } + const samplingIntervalMS = 10; + const maxSamples = Math.floor(MAX_PROFILE_DURATION_MS / samplingIntervalMS); + try { + return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples }); + } catch (e2) { + if (DEBUG_BUILD$4) { + logger$2.log( + "[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header." + ); + logger$2.log("[Profiling] Disabling profiling for current user session."); + } + PROFILING_CONSTRUCTOR_FAILED = true; + } + return; +} +__name(startJSSelfProfile, "startJSSelfProfile"); +function shouldProfileSpan(span) { + if (PROFILING_CONSTRUCTOR_FAILED) { + if (DEBUG_BUILD$4) { + logger$2.log("[Profiling] Profiling has been disabled for the duration of the current user session."); + } + return false; + } + if (!span.isRecording()) { + if (DEBUG_BUILD$4) { + logger$2.log("[Profiling] Discarding profile because transaction was not sampled."); + } + return false; + } + const client = getClient(); + const options4 = client && client.getOptions(); + if (!options4) { + DEBUG_BUILD$4 && logger$2.log("[Profiling] Profiling disabled, no options found."); + return false; + } + const profilesSampleRate = options4.profilesSampleRate; + if (!isValidSampleRate(profilesSampleRate)) { + DEBUG_BUILD$4 && logger$2.warn("[Profiling] Discarding profile because of invalid sample rate."); + return false; + } + if (!profilesSampleRate) { + DEBUG_BUILD$4 && logger$2.log( + "[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0" + ); + return false; + } + const sampled = profilesSampleRate === true ? true : Math.random() < profilesSampleRate; + if (!sampled) { + DEBUG_BUILD$4 && logger$2.log( + `[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number( + profilesSampleRate + )})` + ); + return false; + } + return true; +} +__name(shouldProfileSpan, "shouldProfileSpan"); +function createProfilingEvent(profile_id, start_timestamp, profile, event) { + if (!isValidProfile(profile)) { + return null; + } + return createProfilePayload(profile_id, start_timestamp, profile, event); +} +__name(createProfilingEvent, "createProfilingEvent"); +const PROFILE_MAP = /* @__PURE__ */ new Map(); +function getActiveProfilesCount() { + return PROFILE_MAP.size; +} +__name(getActiveProfilesCount, "getActiveProfilesCount"); +function takeProfileFromGlobalCache(profile_id) { + const profile = PROFILE_MAP.get(profile_id); + if (profile) { + PROFILE_MAP.delete(profile_id); + } + return profile; +} +__name(takeProfileFromGlobalCache, "takeProfileFromGlobalCache"); +function addProfileToGlobalCache(profile_id, profile) { + PROFILE_MAP.set(profile_id, profile); + if (PROFILE_MAP.size > 30) { + const last = PROFILE_MAP.keys().next().value; + PROFILE_MAP.delete(last); + } +} +__name(addProfileToGlobalCache, "addProfileToGlobalCache"); +function startProfileForSpan(span) { + let startTimestamp; + if (isAutomatedPageLoadSpan(span)) { + startTimestamp = timestampInSeconds() * 1e3; + } + const profiler2 = startJSSelfProfile(); + if (!profiler2) { + return; + } + if (DEBUG_BUILD$4) { + logger$2.log(`[Profiling] started profiling span: ${spanToJSON(span).description}`); + } + const profileId = uuid4(); + getCurrentScope$1().setContext("profile", { + profile_id: profileId, + start_timestamp: startTimestamp + }); + async function onProfileHandler() { + if (!span) { + return; + } + if (!profiler2) { + return; + } + return profiler2.stop().then((profile) => { + if (maxDurationTimeoutID) { + WINDOW$5.clearTimeout(maxDurationTimeoutID); + maxDurationTimeoutID = void 0; + } + if (DEBUG_BUILD$4) { + logger$2.log(`[Profiling] stopped profiling of span: ${spanToJSON(span).description}`); + } + if (!profile) { + if (DEBUG_BUILD$4) { + logger$2.log( + `[Profiling] profiler returned null profile for: ${spanToJSON(span).description}`, + "this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started" + ); + } + return; + } + addProfileToGlobalCache(profileId, profile); + }).catch((error2) => { + if (DEBUG_BUILD$4) { + logger$2.log("[Profiling] error while stopping profiler:", error2); + } + }); + } + __name(onProfileHandler, "onProfileHandler"); + let maxDurationTimeoutID = WINDOW$5.setTimeout(() => { + if (DEBUG_BUILD$4) { + logger$2.log("[Profiling] max profile duration elapsed, stopping profiling for:", spanToJSON(span).description); + } + onProfileHandler(); + }, MAX_PROFILE_DURATION_MS); + const originalEnd = span.end.bind(span); + function profilingWrappedSpanEnd() { + if (!span) { + return originalEnd(); + } + void onProfileHandler().then( + () => { + originalEnd(); + }, + () => { + originalEnd(); + } + ); + return span; + } + __name(profilingWrappedSpanEnd, "profilingWrappedSpanEnd"); + span.end = profilingWrappedSpanEnd; +} +__name(startProfileForSpan, "startProfileForSpan"); +const INTEGRATION_NAME$2 = "BrowserProfiling"; +const _browserProfilingIntegration = /* @__PURE__ */ __name(() => { + return { + name: INTEGRATION_NAME$2, + setup(client) { + const activeSpan = getActiveSpan(); + const rootSpan = activeSpan && getRootSpan(activeSpan); + if (rootSpan && isAutomatedPageLoadSpan(rootSpan)) { + if (shouldProfileSpan(rootSpan)) { + startProfileForSpan(rootSpan); + } + } + client.on("spanStart", (span) => { + if (span === getRootSpan(span) && shouldProfileSpan(span)) { + startProfileForSpan(span); + } + }); + client.on("beforeEnvelope", (envelope) => { + if (!getActiveProfilesCount()) { + return; + } + const profiledTransactionEvents = findProfiledTransactionsFromEnvelope(envelope); + if (!profiledTransactionEvents.length) { + return; + } + const profilesToAddToEnvelope = []; + for (const profiledTransaction of profiledTransactionEvents) { + const context = profiledTransaction && profiledTransaction.contexts; + const profile_id = context && context["profile"] && context["profile"]["profile_id"]; + const start_timestamp = context && context["profile"] && context["profile"]["start_timestamp"]; + if (typeof profile_id !== "string") { + DEBUG_BUILD$4 && logger$2.log("[Profiling] cannot find profile for a span without a profile context"); + continue; + } + if (!profile_id) { + DEBUG_BUILD$4 && logger$2.log("[Profiling] cannot find profile for a span without a profile context"); + continue; + } + if (context && context["profile"]) { + delete context.profile; + } + const profile = takeProfileFromGlobalCache(profile_id); + if (!profile) { + DEBUG_BUILD$4 && logger$2.log(`[Profiling] Could not retrieve profile for span: ${profile_id}`); + continue; + } + const profileEvent = createProfilingEvent( + profile_id, + start_timestamp, + profile, + profiledTransaction + ); + if (profileEvent) { + profilesToAddToEnvelope.push(profileEvent); + } + } + addProfilesToEnvelope(envelope, profilesToAddToEnvelope); + }); + } + }; +}, "_browserProfilingIntegration"); +const browserProfilingIntegration = defineIntegration(_browserProfilingIntegration); +const INTEGRATION_NAME$1 = "SpotlightBrowser"; +const _spotlightIntegration = /* @__PURE__ */ __name((options4 = {}) => { + const sidecarUrl = options4.sidecarUrl || "http://localhost:8969/stream"; + return { + name: INTEGRATION_NAME$1, + setup: /* @__PURE__ */ __name(() => { + DEBUG_BUILD$4 && logger$2.log("Using Sidecar URL", sidecarUrl); + }, "setup"), + // We don't want to send interaction transactions/root spans created from + // clicks within Spotlight to Sentry. Neither do we want them to be sent to + // spotlight. + processEvent: /* @__PURE__ */ __name((event) => isSpotlightInteraction(event) ? null : event, "processEvent"), + afterAllSetup: /* @__PURE__ */ __name((client) => { + setupSidecarForwarding(client, sidecarUrl); + }, "afterAllSetup") + }; +}, "_spotlightIntegration"); +function setupSidecarForwarding(client, sidecarUrl) { + const makeFetch = getNativeImplementation("fetch"); + let failCount = 0; + client.on("beforeEnvelope", (envelope) => { + if (failCount > 3) { + logger$2.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:", failCount); + return; + } + makeFetch(sidecarUrl, { + method: "POST", + body: serializeEnvelope(envelope), + headers: { + "Content-Type": "application/x-sentry-envelope" + }, + mode: "cors" + }).then( + (res) => { + if (res.status >= 200 && res.status < 400) { + failCount = 0; + } + }, + (err) => { + failCount++; + logger$2.error( + "Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/", + err + ); + } + ); + }); +} +__name(setupSidecarForwarding, "setupSidecarForwarding"); +const spotlightBrowserIntegration = defineIntegration(_spotlightIntegration); +function isSpotlightInteraction(event) { + return Boolean( + event.type === "transaction" && event.spans && event.contexts && event.contexts.trace && event.contexts.trace.op === "ui.action.click" && event.spans.some(({ description }) => description && description.includes("#sentry-spotlight")) + ); +} +__name(isSpotlightInteraction, "isSpotlightInteraction"); +const FLAG_BUFFER_SIZE = 100; +function copyFlagsFromScopeToEvent(event) { + const scope = getCurrentScope$1(); + const flagContext = scope.getScopeData().contexts.flags; + const flagBuffer = flagContext ? flagContext.values : []; + if (!flagBuffer.length) { + return event; + } + if (event.contexts === void 0) { + event.contexts = {}; + } + event.contexts.flags = { values: [...flagBuffer] }; + return event; +} +__name(copyFlagsFromScopeToEvent, "copyFlagsFromScopeToEvent"); +function insertFlagToScope(name2, value4, maxSize = FLAG_BUFFER_SIZE) { + const scopeContexts = getCurrentScope$1().getScopeData().contexts; + if (!scopeContexts.flags) { + scopeContexts.flags = { values: [] }; + } + const flags = scopeContexts.flags.values; + insertToFlagBuffer(flags, name2, value4, maxSize); +} +__name(insertFlagToScope, "insertFlagToScope"); +function insertToFlagBuffer(flags, name2, value4, maxSize) { + if (typeof value4 !== "boolean") { + return; + } + if (flags.length > maxSize) { + DEBUG_BUILD$4 && logger$2.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${maxSize}`); + return; + } + const index2 = flags.findIndex((f2) => f2.flag === name2); + if (index2 !== -1) { + flags.splice(index2, 1); + } + if (flags.length === maxSize) { + flags.shift(); + } + flags.push({ + flag: name2, + result: value4 + }); +} +__name(insertToFlagBuffer, "insertToFlagBuffer"); +const featureFlagsIntegration = defineIntegration(() => { + return { + name: "FeatureFlags", + processEvent(event, _hint, _client) { + return copyFlagsFromScopeToEvent(event); + }, + addFeatureFlag(name2, value4) { + insertFlagToScope(name2, value4); + } + }; +}); +const launchDarklyIntegration = defineIntegration(() => { + return { + name: "LaunchDarkly", + processEvent(event, _hint, _client) { + return copyFlagsFromScopeToEvent(event); + } + }; +}); +function buildLaunchDarklyFlagUsedHandler() { + return { + name: "sentry-flag-auditor", + type: "flag-used", + synchronous: true, + /** + * Handle a flag evaluation by storing its name and value on the current scope. + */ + method: /* @__PURE__ */ __name((flagKey, flagDetail, _context) => { + insertFlagToScope(flagKey, flagDetail.value); + }, "method") + }; +} +__name(buildLaunchDarklyFlagUsedHandler, "buildLaunchDarklyFlagUsedHandler"); +const openFeatureIntegration = defineIntegration(() => { + return { + name: "OpenFeature", + processEvent(event, _hint, _client) { + return copyFlagsFromScopeToEvent(event); + } + }; +}); +class OpenFeatureIntegrationHook { + static { + __name(this, "OpenFeatureIntegrationHook"); + } + /** + * Successful evaluation result. + */ + after(_hookContext, evaluationDetails) { + insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value); + } + /** + * On error evaluation result. + */ + error(hookContext, _error, _hookHints) { + insertFlagToScope(hookContext.flagKey, hookContext.defaultValue); + } +} +const DEFAULT_HOOKS = ["activate", "mount", "update"]; +const DEBUG_BUILD = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; +const classifyRE$1 = /(?:^|[-_])(\w)/g; +const classify$1 = /* @__PURE__ */ __name((str) => str.replace(classifyRE$1, (c2) => c2.toUpperCase()).replace(/[-_]/g, ""), "classify$1"); +const ROOT_COMPONENT_NAME = ""; +const ANONYMOUS_COMPONENT_NAME = ""; +const repeat = /* @__PURE__ */ __name((str, n2) => { + return str.repeat(n2); +}, "repeat"); +const formatComponentName$1 = /* @__PURE__ */ __name((vm, includeFile) => { + if (!vm) { + return ANONYMOUS_COMPONENT_NAME; + } + if (vm.$root === vm) { + return ROOT_COMPONENT_NAME; + } + if (!vm.$options) { + return ANONYMOUS_COMPONENT_NAME; + } + const options4 = vm.$options; + let name2 = options4.name || options4._componentTag || options4.__name; + const file = options4.__file; + if (!name2 && file) { + const match2 = file.match(/([^/\\]+)\.vue$/); + if (match2) { + name2 = match2[1]; + } + } + return (name2 ? `<${classify$1(name2)}>` : ANONYMOUS_COMPONENT_NAME) + (file && includeFile !== false ? ` at ${file}` : ""); +}, "formatComponentName$1"); +const generateComponentTrace = /* @__PURE__ */ __name((vm) => { + if (vm && (vm._isVue || vm.__isVue) && vm.$parent) { + const tree = []; + let currentRecursiveSequence = 0; + while (vm) { + if (tree.length > 0) { + const last = tree[tree.length - 1]; + if (last.constructor === vm.constructor) { + currentRecursiveSequence++; + vm = vm.$parent; + continue; + } else if (currentRecursiveSequence > 0) { + tree[tree.length - 1] = [last, currentRecursiveSequence]; + currentRecursiveSequence = 0; + } + } + tree.push(vm); + vm = vm.$parent; + } + const formattedTree = tree.map( + (vm2, i2) => `${(i2 === 0 ? "---> " : repeat(" ", 5 + i2 * 2)) + (Array.isArray(vm2) ? `${formatComponentName$1(vm2[0])}... (${vm2[1]} recursive calls)` : formatComponentName$1(vm2))}` + ).join("\n"); + return ` + +found in + +${formattedTree}`; + } + return ` + +(found in ${formatComponentName$1(vm)})`; +}, "generateComponentTrace"); +const attachErrorHandler = /* @__PURE__ */ __name((app2, options4) => { + const { errorHandler: originalErrorHandler, warnHandler, silent } = app2.config; + app2.config.errorHandler = (error2, vm, lifecycleHook) => { + const componentName = formatComponentName$1(vm, false); + const trace = vm ? generateComponentTrace(vm) : ""; + const metadata = { + componentName, + lifecycleHook, + trace + }; + if (options4.attachProps && vm) { + if (vm.$options && vm.$options.propsData) { + metadata.propsData = vm.$options.propsData; + } else if (vm.$props) { + metadata.propsData = vm.$props; + } + } + setTimeout(() => { + captureException(error2, { + captureContext: { contexts: { vue: metadata } }, + mechanism: { handled: false } + }); + }); + if (typeof originalErrorHandler === "function" && app2.config.errorHandler) { + originalErrorHandler.call(app2, error2, vm, lifecycleHook); + } + if (options4.logErrors) { + const hasConsole = typeof console !== "undefined"; + const message3 = `Error in ${lifecycleHook}: "${error2 && error2.toString()}"`; + if (warnHandler) { + warnHandler.call(null, message3, vm, trace); + } else if (hasConsole && !silent) { + consoleSandbox(() => { + console.error(`[Vue warn]: ${message3}${trace}`); + }); + } + } + }; +}, "attachErrorHandler"); +const VUE_OP = "ui.vue"; +const HOOKS = { + activate: ["activated", "deactivated"], + create: ["beforeCreate", "created"], + // Vue 3 + unmount: ["beforeUnmount", "unmounted"], + // Vue 2 + destroy: ["beforeDestroy", "destroyed"], + mount: ["beforeMount", "mounted"], + update: ["beforeUpdate", "updated"] +}; +function finishRootSpan(vm, timestamp2, timeout) { + if (vm.$_sentryRootSpanTimer) { + clearTimeout(vm.$_sentryRootSpanTimer); + } + vm.$_sentryRootSpanTimer = setTimeout(() => { + if (vm.$root && vm.$root.$_sentryRootSpan) { + vm.$root.$_sentryRootSpan.end(timestamp2); + vm.$root.$_sentryRootSpan = void 0; + } + }, timeout); +} +__name(finishRootSpan, "finishRootSpan"); +function findTrackComponent(trackComponents, formattedName) { + function extractComponentName(name2) { + return name2.replace(/^<([^\s]*)>(?: at [^\s]*)?$/, "$1"); + } + __name(extractComponentName, "extractComponentName"); + const isMatched = trackComponents.some((compo) => { + return extractComponentName(formattedName) === extractComponentName(compo); + }); + return isMatched; +} +__name(findTrackComponent, "findTrackComponent"); +const createTracingMixins = /* @__PURE__ */ __name((options4) => { + const hooks2 = (options4.hooks || []).concat(DEFAULT_HOOKS).filter((value4, index2, self2) => self2.indexOf(value4) === index2); + const mixins = {}; + for (const operation of hooks2) { + const internalHooks = HOOKS[operation]; + if (!internalHooks) { + DEBUG_BUILD && logger$2.warn(`Unknown hook: ${operation}`); + continue; + } + for (const internalHook of internalHooks) { + mixins[internalHook] = function() { + const isRoot = this.$root === this; + if (isRoot) { + this.$_sentryRootSpan = this.$_sentryRootSpan || startInactiveSpan({ + name: "Application Render", + op: `${VUE_OP}.render`, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.vue" + }, + onlyIfParent: true + }); + } + const name2 = formatComponentName$1(this, false); + const shouldTrack2 = Array.isArray(options4.trackComponents) ? findTrackComponent(options4.trackComponents, name2) : options4.trackComponents; + if (!isRoot && !shouldTrack2) { + return; + } + this.$_sentrySpans = this.$_sentrySpans || {}; + if (internalHook == internalHooks[0]) { + const activeSpan = this.$root && this.$root.$_sentryRootSpan || getActiveSpan(); + if (activeSpan) { + const oldSpan = this.$_sentrySpans[operation]; + if (oldSpan) { + oldSpan.end(); + } + this.$_sentrySpans[operation] = startInactiveSpan({ + name: `Vue ${name2}`, + op: `${VUE_OP}.${operation}`, + attributes: { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.vue" + }, + // UI spans should only be created if there is an active root span (transaction) + onlyIfParent: true + }); + } + } else { + const span = this.$_sentrySpans[operation]; + if (!span) return; + span.end(); + finishRootSpan(this, timestampInSeconds(), options4.timeout); + } + }; + } + } + return mixins; +}, "createTracingMixins"); +const globalWithVue = GLOBAL_OBJ; +const DEFAULT_CONFIG = { + Vue: globalWithVue.Vue, + attachProps: true, + logErrors: true, + attachErrorHandler: true, + hooks: DEFAULT_HOOKS, + timeout: 2e3, + trackComponents: false +}; +const INTEGRATION_NAME = "Vue"; +const vueIntegration = defineIntegration((integrationOptions = {}) => { + return { + name: INTEGRATION_NAME, + setup(client) { + const options4 = { ...DEFAULT_CONFIG, ...client.getOptions(), ...integrationOptions }; + if (!options4.Vue && !options4.app) { + consoleSandbox(() => { + console.warn( + "[@sentry/vue]: Misconfigured SDK. Vue specific errors will not be captured. Update your `Sentry.init` call with an appropriate config option: `app` (Application Instance - Vue 3) or `Vue` (Vue Constructor - Vue 2)." + ); + }); + return; + } + if (options4.app) { + const apps = Array.isArray(options4.app) ? options4.app : [options4.app]; + apps.forEach((app2) => vueInit(app2, options4)); + } else if (options4.Vue) { + vueInit(options4.Vue, options4); + } + } + }; +}); +const vueInit = /* @__PURE__ */ __name((app2, options4) => { + if (DEBUG_BUILD) { + const appWithInstance = app2; + const isMounted = appWithInstance._instance && appWithInstance._instance.isMounted; + if (isMounted === true) { + consoleSandbox(() => { + console.warn( + "[@sentry/vue]: Misconfigured SDK. Vue app is already mounted. Make sure to call `app.mount()` after `Sentry.init()`." + ); + }); + } + } + if (options4.attachErrorHandler) { + attachErrorHandler(app2, options4); + } + if (hasTracingEnabled(options4)) { + app2.mixin( + createTracingMixins({ + ...options4, + // eslint-disable-next-line deprecation/deprecation + ...options4.tracingOptions + }) + ); + } +}, "vueInit"); +function init$3(config2 = {}) { + const options4 = { + _metadata: { + sdk: { + name: "sentry.javascript.vue", + packages: [ + { + name: "npm:@sentry/vue", + version: SDK_VERSION + } + ], + version: SDK_VERSION + } + }, + defaultIntegrations: [...getDefaultIntegrations(config2), vueIntegration()], + ...config2 + }; + return init$4(options4); +} +__name(init$3, "init$3"); +function instrumentVueRouter(router2, options4, startNavigationSpanFn) { + let isFirstPageLoad = true; + router2.onError((error2) => captureException(error2, { mechanism: { handled: false } })); + router2.beforeEach((to, from2, next2) => { + const isPageLoadNavigation = from2.name == null && from2.matched.length === 0 || from2.name === void 0 && isFirstPageLoad; + if (isFirstPageLoad) { + isFirstPageLoad = false; + } + const attributes = { + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.navigation.vue" + }; + for (const key of Object.keys(to.params)) { + attributes[`params.${key}`] = to.params[key]; + } + for (const key of Object.keys(to.query)) { + const value4 = to.query[key]; + if (value4) { + attributes[`query.${key}`] = value4; + } + } + let spanName = to.path; + let transactionSource = "url"; + if (to.name && options4.routeLabel !== "path") { + spanName = to.name.toString(); + transactionSource = "custom"; + } else if (to.matched.length > 0) { + const lastIndex2 = to.matched.length - 1; + spanName = to.matched[lastIndex2].path; + transactionSource = "route"; + } + getCurrentScope$1().setTransactionName(spanName); + if (options4.instrumentPageLoad && isPageLoadNavigation) { + const activeRootSpan = getActiveRootSpan(); + if (activeRootSpan) { + const existingAttributes = spanToJSON(activeRootSpan).data || {}; + if (existingAttributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] !== "custom") { + activeRootSpan.updateName(spanName); + activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, transactionSource); + } + activeRootSpan.setAttributes({ + ...attributes, + [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.pageload.vue" + }); + } + } + if (options4.instrumentNavigation && !isPageLoadNavigation) { + attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = transactionSource; + attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = "auto.navigation.vue"; + startNavigationSpanFn({ + name: spanName, + op: "navigation", + attributes + }); + } + if (next2) { + next2(); + } + }); +} +__name(instrumentVueRouter, "instrumentVueRouter"); +function getActiveRootSpan() { + const span = getActiveSpan(); + const rootSpan = span && getRootSpan(span); + if (!rootSpan) { + return void 0; + } + const op = spanToJSON(rootSpan).op; + return op === "navigation" || op === "pageload" ? rootSpan : void 0; +} +__name(getActiveRootSpan, "getActiveRootSpan"); +function browserTracingIntegration(options4 = {}) { + if (!options4.router) { + return browserTracingIntegration$1(options4); + } + const integration = browserTracingIntegration$1({ + ...options4, + instrumentNavigation: false + }); + const { router: router2, instrumentNavigation = true, instrumentPageLoad = true, routeLabel = "name" } = options4; + return { + ...integration, + afterAllSetup(client) { + integration.afterAllSetup(client); + const startNavigationSpan = /* @__PURE__ */ __name((options5) => { + startBrowserTracingNavigationSpan(client, options5); + }, "startNavigationSpan"); + instrumentVueRouter(router2, { routeLabel, instrumentNavigation, instrumentPageLoad }, startNavigationSpan); + } + }; +} +__name(browserTracingIntegration, "browserTracingIntegration"); +const createSentryPiniaPlugin = /* @__PURE__ */ __name((options4 = { + attachPiniaState: true, + addBreadcrumbs: true, + actionTransformer: /* @__PURE__ */ __name((action) => action, "actionTransformer"), + stateTransformer: /* @__PURE__ */ __name((state) => state, "stateTransformer") +}) => { + const plugin = /* @__PURE__ */ __name(({ store }) => { + options4.attachPiniaState !== false && getGlobalScope().addEventProcessor((event, hint) => { + try { + const timestamp2 = (/* @__PURE__ */ new Date()).toTimeString().split(" ")[0]; + const filename = `pinia_state_${store.$id}_${timestamp2}.json`; + hint.attachments = [ + ...hint.attachments || [], + { + filename, + data: JSON.stringify(store.$state) + } + ]; + } catch (_2) { + } + return event; + }); + store.$onAction((context) => { + context.after(() => { + const transformedActionName = options4.actionTransformer ? options4.actionTransformer(context.name) : context.name; + if (typeof transformedActionName !== "undefined" && transformedActionName !== null && options4.addBreadcrumbs !== false) { + addBreadcrumb({ + category: "action", + message: transformedActionName, + level: "info" + }); + } + const transformedState = options4.stateTransformer ? options4.stateTransformer(store.$state) : store.$state; + const scope = getCurrentScope$1(); + const currentState = scope.getScopeData().contexts.state; + if (typeof transformedState !== "undefined" && transformedState !== null) { + const client = getClient(); + const options5 = client && client.getOptions(); + const normalizationDepth = options5 && options5.normalizeDepth || 3; + const piniaStateContext = { type: "pinia", value: transformedState }; + const newState = { + ...currentState || {}, + state: piniaStateContext + }; + addNonEnumerableProperty( + newState, + "__sentry_override_normalization_depth__", + 3 + // 3 layers for `state.value.transformedState + normalizationDepth + // rest for the actual state + ); + scope.setContext("state", newState); + } else { + scope.setContext("state", { + ...currentState || {}, + state: { type: "pinia", value: "undefined" } + }); + } + }); + }); + }, "plugin"); + return plugin; +}, "createSentryPiniaPlugin"); /** * @vue/shared v3.4.31 * (c) 2018-present Yuxi (Evan) You and Vue contributors @@ -6000,22 +31385,22 @@ const remove$1 = /* @__PURE__ */ __name((arr, el) => { arr.splice(i2, 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$4 = 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 hasOwnProperty$d = Object.prototype.hasOwnProperty; +const hasOwn$3 = /* @__PURE__ */ __name((val, key) => hasOwnProperty$d.call(val, key), "hasOwn$3"); +const isArray$9 = Array.isArray; +const isMap$3 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Map]", "isMap$3"); +const isSet$3 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Set]", "isSet$3"); const isDate$2 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Date]", "isDate$2"); const isRegExp$4 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object RegExp]", "isRegExp$4"); -const isFunction$4 = /* @__PURE__ */ __name((val) => typeof val === "function", "isFunction$4"); +const isFunction$8 = /* @__PURE__ */ __name((val) => typeof val === "function", "isFunction$8"); const isString$7 = /* @__PURE__ */ __name((val) => typeof val === "string", "isString$7"); 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 isObject$d = /* @__PURE__ */ __name((val) => val !== null && typeof val === "object", "isObject$d"); const isPromise$1 = /* @__PURE__ */ __name((val) => { - return (isObject$6(val) || isFunction$4(val)) && isFunction$4(val.then) && isFunction$4(val.catch); + return (isObject$d(val) || isFunction$8(val)) && isFunction$8(val.then) && isFunction$8(val.catch); }, "isPromise$1"); -const objectToString$1 = Object.prototype.toString; -const toTypeString$1 = /* @__PURE__ */ __name((value4) => objectToString$1.call(value4), "toTypeString$1"); +const objectToString$3 = Object.prototype.toString; +const toTypeString$1 = /* @__PURE__ */ __name((value4) => objectToString$3.call(value4), "toTypeString$1"); const toRawType = /* @__PURE__ */ __name((value4) => { return toTypeString$1(value4).slice(8, -1); }, "toRawType"); @@ -6037,7 +31422,7 @@ const cacheStringFunction$1 = /* @__PURE__ */ __name((fn) => { }, "cacheStringFunction$1"); const camelizeRE$1 = /-(\w)/g; const camelize$1 = cacheStringFunction$1((str) => { - return str.replace(camelizeRE$1, (_2, c) => c ? c.toUpperCase() : ""); + return str.replace(camelizeRE$1, (_2, c2) => c2 ? c2.toUpperCase() : ""); }); const hyphenateRE$1 = /\B([A-Z])/g; const hyphenate$1 = cacheStringFunction$1( @@ -6047,8 +31432,8 @@ 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 s2 = str ? `on${capitalize$1(str)}` : ``; + return s2; }); const hasChanged = /* @__PURE__ */ __name((value4, oldValue2) => !Object.is(value4, oldValue2), "hasChanged"); const invokeArrayFns = /* @__PURE__ */ __name((fns, ...arg) => { @@ -6065,12 +31450,12 @@ const def = /* @__PURE__ */ __name((obj, key, value4, writable = false) => { }); }, "def"); const looseToNumber = /* @__PURE__ */ __name((val) => { - const n = parseFloat(val); - return isNaN(n) ? val : n; + const n2 = parseFloat(val); + return isNaN(n2) ? val : n2; }, "looseToNumber"); const toNumber = /* @__PURE__ */ __name((val) => { - const n = isString$7(val) ? Number(val) : NaN; - return isNaN(n) ? val : n; + const n2 = isString$7(val) ? Number(val) : NaN; + return isNaN(n2) ? val : n2; }, "toNumber"); let _globalThis$1; const getGlobalThis$1 = /* @__PURE__ */ __name(() => { @@ -6180,22 +31565,22 @@ function generateCodeFrame$1(source, start2 = 0, end = source.length) { for (let i2 = 0; i2 < lines.length; i2++) { count += lines[i2].length + (newlineSequences[i2] && newlineSequences[i2].length || 0); if (count >= start2) { - for (let j = i2 - range; j <= i2 + range || end > count; j++) { - if (j < 0 || j >= lines.length) continue; - const line = j + 1; + for (let j2 = i2 - range; j2 <= i2 + range || end > count; j2++) { + if (j2 < 0 || j2 >= lines.length) continue; + const line = j2 + 1; res.push( - `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` + `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j2]}` ); - const lineLength = lines[j].length; - const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; - if (j === i2) { + const lineLength = lines[j2].length; + const newLineSeqLength = newlineSequences[j2] && newlineSequences[j2].length || 0; + if (j2 === i2) { 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 > i2) { + } else if (j2 > i2) { if (end > count) { const length = Math.max(Math.min(end - count, lineLength), 1); res.push(` | ` + "^".repeat(length)); @@ -6210,7 +31595,7 @@ function generateCodeFrame$1(source, start2 = 0, end = source.length) { } __name(generateCodeFrame$1, "generateCodeFrame$1"); function normalizeStyle(value4) { - if (isArray$4(value4)) { + if (isArray$9(value4)) { const res = {}; for (let i2 = 0; i2 < value4.length; i2++) { const item3 = value4[i2]; @@ -6222,7 +31607,7 @@ function normalizeStyle(value4) { } } return res; - } else if (isString$7(value4) || isObject$6(value4)) { + } else if (isString$7(value4) || isObject$d(value4)) { return value4; } } @@ -6260,14 +31645,14 @@ function normalizeClass(value4) { let res = ""; if (isString$7(value4)) { res = value4; - } else if (isArray$4(value4)) { + } else if (isArray$9(value4)) { for (let i2 = 0; i2 < value4.length; i2++) { const normalized = normalizeClass(value4[i2]); if (normalized) { res += normalized + " "; } } - } else if (isObject$6(value4)) { + } else if (isObject$d(value4)) { for (const name2 in value4) { if (value4[name2]) { res += name2 + " "; @@ -6384,52 +31769,52 @@ function escapeHtmlComment(src) { return src.replace(commentStripRE, ""); } __name(escapeHtmlComment, "escapeHtmlComment"); -function looseCompareArrays(a, b) { - if (a.length !== b.length) return false; +function looseCompareArrays(a2, b2) { + if (a2.length !== b2.length) return false; let equal = true; - for (let i2 = 0; equal && i2 < a.length; i2++) { - equal = looseEqual(a[i2], b[i2]); + for (let i2 = 0; equal && i2 < a2.length; i2++) { + equal = looseEqual(a2[i2], b2[i2]); } return equal; } __name(looseCompareArrays, "looseCompareArrays"); -function looseEqual(a, b) { - if (a === b) return true; - let aValidType = isDate$2(a); - let bValidType = isDate$2(b); +function looseEqual(a2, b2) { + if (a2 === b2) return true; + let aValidType = isDate$2(a2); + let bValidType = isDate$2(b2); if (aValidType || bValidType) { - return aValidType && bValidType ? a.getTime() === b.getTime() : false; + return aValidType && bValidType ? a2.getTime() === b2.getTime() : false; } - aValidType = isSymbol$1(a); - bValidType = isSymbol$1(b); + aValidType = isSymbol$1(a2); + bValidType = isSymbol$1(b2); if (aValidType || bValidType) { - return a === b; + return a2 === b2; } - aValidType = isArray$4(a); - bValidType = isArray$4(b); + aValidType = isArray$9(a2); + bValidType = isArray$9(b2); if (aValidType || bValidType) { - return aValidType && bValidType ? looseCompareArrays(a, b) : false; + return aValidType && bValidType ? looseCompareArrays(a2, b2) : false; } - aValidType = isObject$6(a); - bValidType = isObject$6(b); + aValidType = isObject$d(a2); + bValidType = isObject$d(b2); if (aValidType || bValidType) { if (!aValidType || !bValidType) { return false; } - const aKeysCount = Object.keys(a).length; - const bKeysCount = Object.keys(b).length; + const aKeysCount = Object.keys(a2).length; + const bKeysCount = Object.keys(b2).length; if (aKeysCount !== bKeysCount) { return false; } - for (const key in a) { - const aHasKey = a.hasOwnProperty(key); - const bHasKey = b.hasOwnProperty(key); - if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { + for (const key in a2) { + const aHasKey = a2.hasOwnProperty(key); + const bHasKey = b2.hasOwnProperty(key); + if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a2[key], b2[key])) { return false; } } } - return String(a) === String(b); + return String(a2) === String(b2); } __name(looseEqual, "looseEqual"); function looseIndexOf(arr, val) { @@ -6440,12 +31825,12 @@ const isRef$1 = /* @__PURE__ */ __name((val) => { return !!(val && val.__v_isRef === true); }, "isRef$1"); const toDisplayString$1 = /* @__PURE__ */ __name((val) => { - return isString$7(val) ? val : val == null ? "" : isArray$4(val) || isObject$6(val) && (val.toString === objectToString$1 || !isFunction$4(val.toString)) ? isRef$1(val) ? toDisplayString$1(val.value) : JSON.stringify(val, replacer, 2) : String(val); + return isString$7(val) ? val : val == null ? "" : isArray$9(val) || isObject$d(val) && (val.toString === objectToString$3 || !isFunction$8(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)) { + } else if (isMap$3(val)) { return { [`Map(${val.size})`]: [...val.entries()].reduce( (entries, [key, val2], i2) => { @@ -6455,13 +31840,13 @@ const replacer = /* @__PURE__ */ __name((_key, val) => { {} ) }; - } else if (isSet(val)) { + } else if (isSet$3(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$4(val) && !isPlainObject$4(val)) { + } else if (isObject$d(val) && !isArray$9(val) && !isPlainObject$4(val)) { return String(val); } return val; @@ -6532,15 +31917,15 @@ class EffectScope { } stop(fromParent) { if (this._active) { - let i2, l; - for (i2 = 0, l = this.effects.length; i2 < l; i2++) { + let i2, l2; + for (i2 = 0, l2 = this.effects.length; i2 < l2; i2++) { this.effects[i2].stop(); } - for (i2 = 0, l = this.cleanups.length; i2 < l; i2++) { + for (i2 = 0, l2 = this.cleanups.length; i2 < l2; i2++) { this.cleanups[i2](); } if (this.scopes) { - for (i2 = 0, l = this.scopes.length; i2 < l; i2++) { + for (i2 = 0, l2 = this.scopes.length; i2 < l2; i2++) { this.scopes[i2].stop(true); } } @@ -6816,7 +32201,7 @@ function trigger(target, type, key, newValue2, oldValue2, oldTarget) { let deps = []; if (type === "clear") { deps = [...depsMap.values()]; - } else if (key === "length" && isArray$4(target)) { + } else if (key === "length" && isArray$9(target)) { const newLength = Number(newValue2); depsMap.forEach((dep, key2) => { if (key2 === "length" || !isSymbol$1(key2) && key2 >= newLength) { @@ -6829,9 +32214,9 @@ function trigger(target, type, key, newValue2, oldValue2, oldTarget) { } switch (type) { case "add": - if (!isArray$4(target)) { + if (!isArray$9(target)) { deps.push(depsMap.get(ITERATE_KEY)); - if (isMap(target)) { + if (isMap$3(target)) { deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); } } else if (isIntegerKey(key)) { @@ -6839,15 +32224,15 @@ function trigger(target, type, key, newValue2, oldValue2, oldTarget) { } break; case "delete": - if (!isArray$4(target)) { + if (!isArray$9(target)) { deps.push(depsMap.get(ITERATE_KEY)); - if (isMap(target)) { + if (isMap$3(target)) { deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); } } break; case "set": - if (isMap(target)) { + if (isMap$3(target)) { deps.push(depsMap.get(ITERATE_KEY)); } break; @@ -6888,7 +32273,7 @@ function createArrayInstrumentations() { ["includes", "indexOf", "lastIndexOf"].forEach((key) => { instrumentations[key] = function(...args) { const arr = toRaw(this); - for (let i2 = 0, l = this.length; i2 < l; i2++) { + for (let i2 = 0, l2 = this.length; i2 < l2; i2++) { track(arr, "get", i2 + ""); } const res = arr[key](...args); @@ -6912,13 +32297,13 @@ function createArrayInstrumentations() { return instrumentations; } __name(createArrayInstrumentations, "createArrayInstrumentations"); -function hasOwnProperty$2(key) { +function hasOwnProperty$c(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"); +__name(hasOwnProperty$c, "hasOwnProperty$c"); class BaseReactiveHandler { static { __name(this, "BaseReactiveHandler"); @@ -6943,13 +32328,13 @@ class BaseReactiveHandler { } return; } - const targetIsArray = isArray$4(target); + const targetIsArray = isArray$9(target); if (!isReadonly2) { if (targetIsArray && hasOwn$3(arrayInstrumentations, key)) { return Reflect.get(arrayInstrumentations, key, receiver); } if (key === "hasOwnProperty") { - return hasOwnProperty$2; + return hasOwnProperty$c; } } const res = Reflect.get(target, key, receiver); @@ -6965,7 +32350,7 @@ class BaseReactiveHandler { if (isRef(res)) { return targetIsArray && isIntegerKey(key) ? res : res.value; } - if (isObject$6(res)) { + if (isObject$d(res)) { return isReadonly2 ? readonly(res) : reactive(res); } return res; @@ -6986,7 +32371,7 @@ class MutableReactiveHandler extends BaseReactiveHandler { oldValue2 = toRaw(oldValue2); value4 = toRaw(value4); } - if (!isArray$4(target) && isRef(oldValue2) && !isRef(value4)) { + if (!isArray$9(target) && isRef(oldValue2) && !isRef(value4)) { if (isOldValueReadonly) { return false; } else { @@ -6995,7 +32380,7 @@ class MutableReactiveHandler extends BaseReactiveHandler { } } } - const hadKey = isArray$4(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn$3(target, key); + const hadKey = isArray$9(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn$3(target, key); const result = Reflect.set(target, key, value4, receiver); if (target === toRaw(receiver)) { if (!hadKey) { @@ -7026,7 +32411,7 @@ class MutableReactiveHandler extends BaseReactiveHandler { track( target, "iterate", - isArray$4(target) ? "length" : ITERATE_KEY + isArray$9(target) ? "length" : ITERATE_KEY ); return Reflect.ownKeys(target); } @@ -7159,7 +32544,7 @@ __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 oldTarget = false ? isMap$3(target) ? new Map(target) : new Set(target) : void 0; const result = target.clear(); if (hadItems) { trigger(target, "clear", void 0, void 0, oldTarget); @@ -7184,7 +32569,7 @@ function createIterableMethod(method, isReadonly2, isShallow2) { return function(...args) { const target = this["__v_raw"]; const rawTarget = toRaw(target); - const targetIsMap = isMap(rawTarget); + const targetIsMap = isMap$3(rawTarget); const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; const isKeyOnly = method === "keys" && targetIsMap; const innerIterator = target[method](...args); @@ -7422,7 +32807,7 @@ function shallowReadonly(target) { } __name(shallowReadonly, "shallowReadonly"); function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { - if (!isObject$6(target)) { + if (!isObject$d(target)) { if (false) { warn$4( `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String( @@ -7482,8 +32867,8 @@ function markRaw(value4) { return value4; } __name(markRaw, "markRaw"); -const toReactive$1 = /* @__PURE__ */ __name((value4) => isObject$6(value4) ? reactive(value4) : value4, "toReactive$1"); -const toReadonly = /* @__PURE__ */ __name((value4) => isObject$6(value4) ? readonly(value4) : value4, "toReadonly"); +const toReactive$1 = /* @__PURE__ */ __name((value4) => isObject$d(value4) ? reactive(value4) : value4, "toReactive$1"); +const toReadonly = /* @__PURE__ */ __name((value4) => isObject$d(value4) ? readonly(value4) : value4, "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 { @@ -7537,7 +32922,7 @@ getter: `, this.getter); function computed$1(getterOrOptions, debugOptions, isSSR = false) { let getter; let setter; - const onlyGetter = isFunction$4(getterOrOptions); + const onlyGetter = isFunction$8(getterOrOptions); if (onlyGetter) { getter = getterOrOptions; setter = false ? () => { @@ -7592,8 +32977,8 @@ function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) { } } __name(triggerRefValue, "triggerRefValue"); -function isRef(r) { - return !!(r && r.__v_isRef === true); +function isRef(r2) { + return !!(r2 && r2.__v_isRef === true); } __name(isRef, "isRef"); function ref(value4) { @@ -7646,7 +33031,7 @@ function unref(ref2) { } __name(unref, "unref"); function toValue$1(source) { - return isFunction$4(source) ? source() : unref(source); + return isFunction$8(source) ? source() : unref(source); } __name(toValue$1, "toValue$1"); const shallowUnwrapHandlers = { @@ -7694,7 +33079,7 @@ function toRefs$1(object) { if (false) { warn$4(`toRefs() expects a reactive object but received a plain one.`); } - const ret = isArray$4(object) ? new Array(object.length) : {}; + const ret = isArray$9(object) ? new Array(object.length) : {}; for (const key in object) { ret[key] = propertyToRef(object, key); } @@ -7738,9 +33123,9 @@ class GetterRefImpl { function toRef$1(source, key, defaultValue) { if (isRef(source)) { return source; - } else if (isFunction$4(source)) { + } else if (isFunction$8(source)) { return new GetterRefImpl(source); - } else if (isObject$6(source) && arguments.length > 1) { + } else if (isObject$d(source) && arguments.length > 1) { return propertyToRef(source, key, defaultValue); } else { return ref(source); @@ -7797,9 +33182,9 @@ function warn$1$1(msg, ...args) { 11, [ // eslint-disable-next-line no-restricted-syntax - msg + args.map((a) => { + msg + args.map((a2) => { var _a2, _b; - return (_b = (_a2 = a.toString) == null ? void 0 : _a2.call(a)) != null ? _b : JSON.stringify(a); + return (_b = (_a2 = a2.toString) == null ? void 0 : _a2.call(a2)) != null ? _b : JSON.stringify(a2); }).join(""), instance && instance.proxy, trace.map( @@ -7884,7 +33269,7 @@ function formatProp(key, value4, raw) { } else if (isRef(value4)) { value4 = formatProp(key, toRaw(value4.value), true); return raw ? value4 : [`${key}=Ref<`, value4, `>`]; - } else if (isFunction$4(value4)) { + } else if (isFunction$8(value4)) { return [`${key}=fn${value4.name ? `<${value4.name}>` : ``}`]; } else { value4 = toRaw(value4); @@ -7975,7 +33360,7 @@ function callWithErrorHandling(fn, instance, type, args) { } __name(callWithErrorHandling, "callWithErrorHandling"); function callWithAsyncErrorHandling(fn, instance, type, args) { - if (isFunction$4(fn)) { + if (isFunction$8(fn)) { const res = callWithErrorHandling(fn, instance, type, args); if (res && isPromise$1(res)) { res.catch((err) => { @@ -7984,7 +33369,7 @@ function callWithAsyncErrorHandling(fn, instance, type, args) { } return res; } - if (isArray$4(fn)) { + if (isArray$9(fn)) { const values = []; for (let i2 = 0; i2 < fn.length; i2++) { values.push(callWithAsyncErrorHandling(fn[i2], instance, type, args)); @@ -8110,7 +33495,7 @@ function invalidateJob(job) { } __name(invalidateJob, "invalidateJob"); function queuePostFlushCb(cb) { - if (!isArray$4(cb)) { + if (!isArray$9(cb)) { if (!activePostFlushCbs || !activePostFlushCbs.includes( cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex @@ -8146,7 +33531,7 @@ __name(flushPreFlushCbs, "flushPreFlushCbs"); function flushPostFlushCbs(seen2) { if (pendingPostFlushCbs.length) { const deduped = [...new Set(pendingPostFlushCbs)].sort( - (a, b) => getId(a) - getId(b) + (a2, b2) => getId(a2) - getId(b2) ); pendingPostFlushCbs.length = 0; if (activePostFlushCbs) { @@ -8170,11 +33555,11 @@ function flushPostFlushCbs(seen2) { } __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); +const comparator = /* @__PURE__ */ __name((a2, b2) => { + const diff2 = getId(a2) - getId(b2); if (diff2 === 0) { - if (a.pre && !b.pre) return -1; - if (b.pre && !a.pre) return 1; + if (a2.pre && !b2.pre) return -1; + if (b2.pre && !a2.pre) return 1; } return diff2; }, "comparator"); @@ -8240,12 +33625,12 @@ if (false) { const map$1 = /* @__PURE__ */ new Map(); function registerHMR(instance) { const id3 = instance.type.__hmrId; - let record = map$1.get(id3); - if (!record) { + let record2 = map$1.get(id3); + if (!record2) { createRecord(id3, instance.type); - record = map$1.get(id3); + record2 = map$1.get(id3); } - record.instances.add(instance); + record2.instances.add(instance); } __name(registerHMR, "registerHMR"); function unregisterHMR(instance) { @@ -8268,12 +33653,12 @@ function normalizeClassComponent(component) { } __name(normalizeClassComponent, "normalizeClassComponent"); function rerender(id3, newRender) { - const record = map$1.get(id3); - if (!record) { + const record2 = map$1.get(id3); + if (!record2) { return; } - record.initialDef.render = newRender; - [...record.instances].forEach((instance) => { + record2.initialDef.render = newRender; + [...record2.instances].forEach((instance) => { if (newRender) { instance.render = newRender; normalizeClassComponent(instance.type).render = newRender; @@ -8287,15 +33672,15 @@ function rerender(id3, newRender) { } __name(rerender, "rerender"); function reload(id3, newComp) { - const record = map$1.get(id3); - if (!record) return; + const record2 = map$1.get(id3); + if (!record2) return; newComp = normalizeClassComponent(newComp); - updateComponentDef(record.initialDef, newComp); - const instances = [...record.instances]; + updateComponentDef(record2.initialDef, newComp); + const instances = [...record2.instances]; for (const instance of instances) { const oldComp = normalizeClassComponent(instance.type); if (!hmrDirtyComponents.has(oldComp)) { - if (oldComp !== record.initialDef) { + if (oldComp !== record2.initialDef) { updateComponentDef(oldComp, newComp); } hmrDirtyComponents.add(oldComp); @@ -8484,7 +33869,7 @@ function emit(instance, event, ...rawArgs) { } } else { const validator3 = emitsOptions[event]; - if (isFunction$4(validator3)) { + if (isFunction$8(validator3)) { const isValid2 = validator3(...rawArgs); if (!isValid2) { warn$1$1( @@ -8502,7 +33887,7 @@ function emit(instance, event, ...rawArgs) { const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`; const { number: number2, trim: trim2 } = props[modifiersKey] || EMPTY_OBJ; if (trim2) { - args = rawArgs.map((a) => isString$7(a) ? a.trim() : a); + args = rawArgs.map((a2) => isString$7(a2) ? a2.trim() : a2); } if (number2) { args = rawArgs.map(looseToNumber); @@ -8564,7 +33949,7 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) { const raw = comp.emits; let normalized = {}; let hasExtends = false; - if (!isFunction$4(comp)) { + if (!isFunction$8(comp)) { const extendEmits = /* @__PURE__ */ __name((raw2) => { const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); if (normalizedFromExtend) { @@ -8583,17 +33968,17 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) { } } if (!raw && !hasExtends) { - if (isObject$6(comp)) { + if (isObject$d(comp)) { cache2.set(comp, null); } return null; } - if (isArray$4(raw)) { + if (isArray$9(raw)) { raw.forEach((key) => normalized[key] = null); } else { extend$1(normalized, raw); } - if (isObject$6(comp)) { + if (isObject$d(comp)) { cache2.set(comp, normalized); } return normalized; @@ -8673,7 +34058,7 @@ function renderComponentRoot(instance) { render: render2, renderCache, props, - data: data24, + data: data25, setupState, ctx, inheritAttrs @@ -8704,7 +34089,7 @@ function renderComponentRoot(instance) { renderCache, false ? shallowReadonly(props) : props, setupState, - data24, + data25, ctx ) ); @@ -8737,14 +34122,14 @@ function renderComponentRoot(instance) { handleError(err, instance, 1); result = createVNode(Comment); } - let root24 = result; + let root27 = result; let setRoot = void 0; if (false) { - [root24, setRoot] = getChildRoot(result); + [root27, setRoot] = getChildRoot(result); } if (fallthroughAttrs && inheritAttrs !== false) { const keys2 = Object.keys(fallthroughAttrs); - const { shapeFlag } = root24; + const { shapeFlag } = root27; if (keys2.length) { if (shapeFlag & (1 | 6)) { if (propsOptions && keys2.some(isModelListener)) { @@ -8753,12 +34138,12 @@ function renderComponentRoot(instance) { propsOptions ); } - root24 = cloneVNode(root24, fallthroughAttrs, false, true); + root27 = cloneVNode(root27, fallthroughAttrs, false, true); } else if (false) { const allAttrs = Object.keys(attrs4); const eventAttrs = []; const extraAttrs = []; - for (let i2 = 0, l = allAttrs.length; i2 < l; i2++) { + for (let i2 = 0, l2 = allAttrs.length; i2 < l2; i2++) { const key = allAttrs[i2]; if (isOn(key)) { if (!isModelListener(key)) { @@ -8787,8 +34172,8 @@ function renderComponentRoot(instance) { `Runtime directive used on component with non-element root node. The directives will not function as intended.` ); } - root24 = cloneVNode(root24, null, false, true); - root24.dirs = root24.dirs ? root24.dirs.concat(vnode.dirs) : vnode.dirs; + root27 = cloneVNode(root27, null, false, true); + root27.dirs = root27.dirs ? root27.dirs.concat(vnode.dirs) : vnode.dirs; } if (vnode.transition) { if (false) { @@ -8796,12 +34181,12 @@ function renderComponentRoot(instance) { `Component inside renders non-element root node that cannot be animated.` ); } - root24.transition = vnode.transition; + root27.transition = vnode.transition; } if (false) { - setRoot(root24); + setRoot(root27); } else { - result = root24; + result = root27; } setCurrentRenderingInstance(prev2); return result; @@ -8937,11 +34322,11 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) { __name(hasPropsChanged, "hasPropsChanged"); function updateHOCHostEl({ vnode, parent }, el) { while (parent) { - const root24 = parent.subTree; - if (root24.suspense && root24.suspense.activeBranch === vnode) { - root24.el = vnode.el; + const root27 = parent.subTree; + if (root27.suspense && root27.suspense.activeBranch === vnode) { + root27.el = vnode.el; } - if (root24 === vnode) { + if (root27 === vnode) { (vnode = parent.vnode).el = el; parent = parent.parent; } else { @@ -9056,7 +34441,7 @@ const SuspenseImpl = { const Suspense = SuspenseImpl; function triggerEvent(vnode, name2) { const eventListener = vnode.props && vnode.props[name2]; - if (isFunction$4(eventListener)) { + if (isFunction$8(eventListener)) { eventListener(); } } @@ -9549,38 +34934,38 @@ function normalizeSuspenseChildren(vnode) { vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); } __name(normalizeSuspenseChildren, "normalizeSuspenseChildren"); -function normalizeSuspenseSlot(s) { +function normalizeSuspenseSlot(s2) { let block3; - if (isFunction$4(s)) { - const trackBlock = isBlockTreeEnabled && s._c; + if (isFunction$8(s2)) { + const trackBlock = isBlockTreeEnabled && s2._c; if (trackBlock) { - s._d = false; + s2._d = false; openBlock(); } - s = s(); + s2 = s2(); if (trackBlock) { - s._d = true; + s2._d = true; block3 = currentBlock; closeBlock(); } } - if (isArray$4(s)) { - const singleChild = filterSingleRoot(s); + if (isArray$9(s2)) { + const singleChild = filterSingleRoot(s2); if (false) { warn$1$1(` slots expect a single root node.`); } - s = singleChild; + s2 = singleChild; } - s = normalizeVNode(s); - if (block3 && !s.dynamicChildren) { - s.dynamicChildren = block3.filter((c) => c !== s); + s2 = normalizeVNode(s2); + if (block3 && !s2.dynamicChildren) { + s2.dynamicChildren = block3.filter((c2) => c2 !== s2); } - return s; + return s2; } __name(normalizeSuspenseSlot, "normalizeSuspenseSlot"); function queueEffectWithSuspense(fn, suspense) { if (suspense && suspense.pendingBranch) { - if (isArray$4(fn)) { + if (isArray$9(fn)) { suspense.effects.push(...fn); } else { suspense.effects.push(fn); @@ -9612,7 +34997,7 @@ function isVNodeSuspensible(vnode) { __name(isVNodeSuspensible, "isVNodeSuspensible"); function injectHook(type, hook, target = currentInstance, prepend2 = false) { if (target) { - const hooks = target[type] || (target[type] = []); + const hooks2 = target[type] || (target[type] = []); const wrappedHook = hook.__weh || (hook.__weh = (...args) => { pauseTracking(); const reset2 = setCurrentInstance(target); @@ -9622,9 +35007,9 @@ function injectHook(type, hook, target = currentInstance, prepend2 = false) { return res; }); if (prepend2) { - hooks.unshift(wrappedHook); + hooks2.unshift(wrappedHook); } else { - hooks.push(wrappedHook); + hooks2.push(wrappedHook); } return wrappedHook; } else if (false) { @@ -9672,7 +35057,7 @@ function withDirectives(vnode, directives) { for (let i2 = 0; i2 < directives.length; i2++) { let [dir, value4, arg, modifiers2 = EMPTY_OBJ] = directives[i2]; if (dir) { - if (isFunction$4(dir)) { + if (isFunction$8(dir)) { dir = { mounted: dir, updated: dir @@ -9719,9 +35104,9 @@ __name(invokeDirectiveHook, "invokeDirectiveHook"); function renderList(source, renderItem, cache2, index2) { let ret; const cached = cache2 && cache2[index2]; - if (isArray$4(source) || isString$7(source)) { + if (isArray$9(source) || isString$7(source)) { ret = new Array(source.length); - for (let i2 = 0, l = source.length; i2 < l; i2++) { + for (let i2 = 0, l2 = source.length; i2 < l2; i2++) { ret[i2] = renderItem(source[i2], i2, void 0, cached && cached[i2]); } } else if (typeof source === "number") { @@ -9732,7 +35117,7 @@ function renderList(source, renderItem, cache2, index2) { for (let i2 = 0; i2 < source; i2++) { ret[i2] = renderItem(i2 + 1, i2, void 0, cached && cached[i2]); } - } else if (isObject$6(source)) { + } else if (isObject$d(source)) { if (source[Symbol.iterator]) { ret = Array.from( source, @@ -9741,7 +35126,7 @@ function renderList(source, renderItem, cache2, index2) { } else { const keys2 = Object.keys(source); ret = new Array(keys2.length); - for (let i2 = 0, l = keys2.length; i2 < l; i2++) { + for (let i2 = 0, l2 = keys2.length; i2 < l2; i2++) { const key = keys2[i2]; ret[i2] = renderItem(source[key], key, i2, cached && cached[i2]); } @@ -9758,9 +35143,9 @@ __name(renderList, "renderList"); function createSlots(slots, dynamicSlots) { for (let i2 = 0; i2 < dynamicSlots.length; i2++) { const slot = dynamicSlots[i2]; - if (isArray$4(slot)) { - for (let j = 0; j < slot.length; j++) { - slots[slot[j].name] = slot[j].fn; + if (isArray$9(slot)) { + for (let j2 = 0; j2 < slot.length; j2++) { + slots[slot[j2].name] = slot[j2].fn; } } else if (slot) { slots[slot.name] = slot.key ? (...args) => { @@ -9776,7 +35161,7 @@ __name(createSlots, "createSlots"); /*! #__NO_SIDE_EFFECTS__ */ // @__NO_SIDE_EFFECTS__ function defineComponent(options4, extraOptions) { - return isFunction$4(options4) ? ( + return isFunction$8(options4) ? ( // #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: options4.name }, extraOptions, { setup: options4 }))() @@ -9787,7 +35172,7 @@ const isAsyncWrapper = /* @__PURE__ */ __name((i2) => !!i2.type.__asyncLoader, " /*! #__NO_SIDE_EFFECTS__ */ // @__NO_SIDE_EFFECTS__ function defineAsyncComponent(source) { - if (isFunction$4(source)) { + if (isFunction$8(source)) { source = { loader: source }; } const { @@ -10016,19 +35401,19 @@ const PublicInstanceProxyHandlers = { if (key === "__v_skip") { return true; } - const { ctx, setupState, data: data24, props, accessCache, type, appContext } = instance; + const { ctx, setupState, data: data25, props, accessCache, type, appContext } = instance; if (false) { return true; } let normalizedProps; if (key[0] !== "$") { - const n = accessCache[key]; - if (n !== void 0) { - switch (n) { + const n2 = accessCache[key]; + if (n2 !== void 0) { + switch (n2) { case 1: return setupState[key]; case 2: - return data24[key]; + return data25[key]; case 4: return ctx[key]; case 3: @@ -10037,9 +35422,9 @@ const PublicInstanceProxyHandlers = { } else if (hasSetupBinding(setupState, key)) { accessCache[key] = 1; return setupState[key]; - } else if (data24 !== EMPTY_OBJ && hasOwn$3(data24, key)) { + } else if (data25 !== EMPTY_OBJ && hasOwn$3(data25, key)) { accessCache[key] = 2; - return data24[key]; + return data25[key]; } else if ( // only cache other properties when instance has declared (thus stable) // props @@ -10079,7 +35464,7 @@ const PublicInstanceProxyHandlers = { return globalProperties[key]; } } else if (false) { - if (data24 !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn$3(data24, key)) { + if (data25 !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn$3(data25, key)) { warn$1$1( `Property ${JSON.stringify( key @@ -10093,15 +35478,15 @@ const PublicInstanceProxyHandlers = { } }, set({ _: instance }, key, value4) { - const { data: data24, setupState, ctx } = instance; + const { data: data25, setupState, ctx } = instance; if (hasSetupBinding(setupState, key)) { setupState[key] = value4; return true; } else if (false) { warn$1$1(`Cannot mutate - + +
From ebf038d4faa1232ce90ca45ee124942bf7f1a6d0 Mon Sep 17 00:00:00 2001 From: Sergii Dymchenko Date: Sun, 19 Jan 2025 01:54:32 -0800 Subject: [PATCH 031/478] Use `torch.special.expm1` (#6388) * Use `torch.special.expm1` This function provides greater precision than `exp(x) - 1` for small values of `x`. Found with TorchFix https://github.com/pytorch-labs/torchfix/ * Use non-alias --- comfy/k_diffusion/sampling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index 13ae272fd..87a522b76 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -40,7 +40,7 @@ def get_sigmas_polyexponential(n, sigma_min, sigma_max, rho=1., device='cpu'): def get_sigmas_vp(n, beta_d=19.9, beta_min=0.1, eps_s=1e-3, device='cpu'): """Constructs a continuous VP noise schedule.""" t = torch.linspace(1, eps_s, n, device=device) - sigmas = torch.sqrt(torch.exp(beta_d * t ** 2 / 2 + beta_min * t) - 1) + sigmas = torch.sqrt(torch.special.expm1(beta_d * t ** 2 / 2 + beta_min * t)) return append_zero(sigmas) From a00e1489d2249ebf619a698fcac7c21c7669a50a Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 19 Jan 2025 06:01:56 -0500 Subject: [PATCH 032/478] LatentBatch fix for video latents --- comfy_extras/nodes_latent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy_extras/nodes_latent.py b/comfy_extras/nodes_latent.py index af2736818..d266cd293 100644 --- a/comfy_extras/nodes_latent.py +++ b/comfy_extras/nodes_latent.py @@ -117,7 +117,7 @@ class LatentBatch: s2 = samples2["samples"] if s1.shape[1:] != s2.shape[1:]: - s2 = comfy.utils.common_upscale(s2, s1.shape[3], s1.shape[2], "bilinear", "center") + s2 = comfy.utils.common_upscale(s2, s1.shape[-1], s1.shape[-2], "bilinear", "center") s = torch.cat((s1, s2), dim=0) samples_out["samples"] = s samples_out["batch_index"] = samples1.get("batch_index", [x for x in range(0, s1.shape[0])]) + samples2.get("batch_index", [x for x in range(0, s2.shape[0])]) From d8a7a3277923f4690d77983c121d08e3870f0acb Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 20 Jan 2025 03:44:13 -0500 Subject: [PATCH 033/478] Cleanup old TODO. --- comfy/model_base.py | 8 +++++++- comfy/sampler_helpers.py | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index 7625b7126..c9f6bd02b 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -148,7 +148,9 @@ class BaseModel(torch.nn.Module): xc = xc.to(dtype) t = self.model_sampling.timestep(t).float() - context = context.to(dtype) + if context is not None: + context = context.to(dtype) + extra_conds = {} for o in kwargs: extra = kwargs[o] @@ -549,6 +551,10 @@ class SD_X4Upscaler(BaseModel): out['c_concat'] = comfy.conds.CONDNoiseShape(image) out['y'] = comfy.conds.CONDRegular(noise_level) + + cross_attn = kwargs.get("cross_attn", None) + if cross_attn is not None: + out['c_crossattn'] = comfy.conds.CONDCrossAttn(cross_attn) return out class IP2P: diff --git a/comfy/sampler_helpers.py b/comfy/sampler_helpers.py index b70e5e636..92ec7ca7a 100644 --- a/comfy/sampler_helpers.py +++ b/comfy/sampler_helpers.py @@ -58,7 +58,6 @@ def convert_cond(cond): temp = c[1].copy() model_conds = temp.get("model_conds", {}) if c[0] is not None: - model_conds["c_crossattn"] = comfy.conds.CONDCrossAttn(c[0]) #TODO: remove temp["cross_attn"] = c[0] temp["model_conds"] = model_conds temp["uuid"] = uuid.uuid4() From fb2ad645a3a374bb1d0a5e6be2d9dff481cf4cfb Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 20 Jan 2025 14:50:24 -0500 Subject: [PATCH 034/478] Add FluxDisableGuidance node to disable using the guidance embed. --- comfy/ldm/flux/model.py | 7 +++---- comfy/ldm/hunyuan_video/model.py | 7 +++---- comfy/model_base.py | 10 ++++++++-- comfy_extras/nodes_flux.py | 19 +++++++++++++++++++ 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/comfy/ldm/flux/model.py b/comfy/ldm/flux/model.py index dead87de8..cc34f7585 100644 --- a/comfy/ldm/flux/model.py +++ b/comfy/ldm/flux/model.py @@ -109,9 +109,8 @@ class Flux(nn.Module): img = self.img_in(img) vec = self.time_in(timestep_embedding(timesteps, 256).to(img.dtype)) if self.params.guidance_embed: - if guidance is None: - raise ValueError("Didn't get guidance strength for guidance distilled model.") - vec = vec + self.guidance_in(timestep_embedding(guidance, 256).to(img.dtype)) + if guidance is not None: + vec = vec + self.guidance_in(timestep_embedding(guidance, 256).to(img.dtype)) vec = vec + self.vector_in(y[:,:self.params.vec_in_dim]) txt = self.txt_in(txt) @@ -186,7 +185,7 @@ class Flux(nn.Module): img = self.final_layer(img, vec) # (N, T, patch_size ** 2 * out_channels) return img - def forward(self, x, timestep, context, y, guidance, control=None, transformer_options={}, **kwargs): + def forward(self, x, timestep, context, y, guidance=None, control=None, transformer_options={}, **kwargs): bs, c, h, w = x.shape patch_size = self.patch_size x = comfy.ldm.common_dit.pad_to_patch_size(x, (patch_size, patch_size)) diff --git a/comfy/ldm/hunyuan_video/model.py b/comfy/ldm/hunyuan_video/model.py index d6d854089..fc3a67444 100644 --- a/comfy/ldm/hunyuan_video/model.py +++ b/comfy/ldm/hunyuan_video/model.py @@ -240,9 +240,8 @@ class HunyuanVideo(nn.Module): vec = vec + self.vector_in(y[:, :self.params.vec_in_dim]) if self.params.guidance_embed: - if guidance is None: - raise ValueError("Didn't get guidance strength for guidance distilled model.") - vec = vec + self.guidance_in(timestep_embedding(guidance, 256).to(img.dtype)) + if guidance is not None: + vec = vec + self.guidance_in(timestep_embedding(guidance, 256).to(img.dtype)) if txt_mask is not None and not torch.is_floating_point(txt_mask): txt_mask = (txt_mask - 1).to(img.dtype) * torch.finfo(img.dtype).max @@ -314,7 +313,7 @@ class HunyuanVideo(nn.Module): img = img.reshape(initial_shape) return img - def forward(self, x, timestep, context, y, guidance, attention_mask=None, control=None, transformer_options={}, **kwargs): + def forward(self, x, timestep, context, y, guidance=None, attention_mask=None, control=None, transformer_options={}, **kwargs): bs, c, t, h, w = x.shape patch_size = self.patch_size t_len = ((t + (patch_size[0] // 2)) // patch_size[0]) diff --git a/comfy/model_base.py b/comfy/model_base.py index c9f6bd02b..cd05bbdfe 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -812,7 +812,10 @@ class Flux(BaseModel): (h_tok, w_tok) = (math.ceil(shape[2] / self.diffusion_model.patch_size), math.ceil(shape[3] / self.diffusion_model.patch_size)) attention_mask = utils.upscale_dit_mask(attention_mask, mask_ref_size, (h_tok, w_tok)) out['attention_mask'] = comfy.conds.CONDRegular(attention_mask) - out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor([kwargs.get("guidance", 3.5)])) + + guidance = kwargs.get("guidance", 3.5) + if guidance is not None: + out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor([guidance])) return out class GenmoMochi(BaseModel): @@ -869,7 +872,10 @@ class HunyuanVideo(BaseModel): cross_attn = kwargs.get("cross_attn", None) if cross_attn is not None: out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) - out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor([kwargs.get("guidance", 6.0)])) + + guidance = kwargs.get("guidance", 6.0) + if guidance is not None: + out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor([guidance])) return out class CosmosVideo(BaseModel): diff --git a/comfy_extras/nodes_flux.py b/comfy_extras/nodes_flux.py index 2ae23f735..ad6c15f37 100644 --- a/comfy_extras/nodes_flux.py +++ b/comfy_extras/nodes_flux.py @@ -38,7 +38,26 @@ class FluxGuidance: return (c, ) +class FluxDisableGuidance: + @classmethod + def INPUT_TYPES(s): + return {"required": { + "conditioning": ("CONDITIONING", ), + }} + + RETURN_TYPES = ("CONDITIONING",) + FUNCTION = "append" + + CATEGORY = "advanced/conditioning/flux" + DESCRIPTION = "This node completely disables the guidance embed on Flux and Flux like models" + + def append(self, conditioning): + c = node_helpers.conditioning_set_values(conditioning, {"guidance": None}) + return (c, ) + + NODE_CLASS_MAPPINGS = { "CLIPTextEncodeFlux": CLIPTextEncodeFlux, "FluxGuidance": FluxGuidance, + "FluxDisableGuidance": FluxDisableGuidance, } From d303cb53415f87f499c2e07a7a2d98d4c22365ec Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 21 Jan 2025 08:57:04 -0500 Subject: [PATCH 035/478] Add missing case to CLIPLoader. --- nodes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nodes.py b/nodes.py index cfd7dd8a4..ef51994ef 100644 --- a/nodes.py +++ b/nodes.py @@ -937,6 +937,8 @@ class CLIPLoader: clip_type = comfy.sd.CLIPType.LTXV elif type == "pixart": clip_type = comfy.sd.CLIPType.PIXART + elif type == "cosmos": + clip_type = comfy.sd.CLIPType.COSMOS else: clip_type = comfy.sd.CLIPType.STABLE_DIFFUSION From e857dd48b810a36a14dc1a6fa93ec930f4e75ee6 Mon Sep 17 00:00:00 2001 From: chaObserv <154517000+chaObserv@users.noreply.github.com> Date: Wed, 22 Jan 2025 18:29:40 +0800 Subject: [PATCH 036/478] Add gradient estimation sampler (#6554) --- comfy/k_diffusion/sampling.py | 23 +++++++++++++++++++++++ comfy/samplers.py | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index 87a522b76..2c0d18320 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -1336,3 +1336,26 @@ def sample_res_multistep(model, x, sigmas, extra_args=None, callback=None, disab @torch.no_grad() def sample_res_multistep_cfg_pp(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1., noise_sampler=None): return res_multistep(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, s_churn=s_churn, s_tmin=s_tmin, s_tmax=s_tmax, s_noise=s_noise, noise_sampler=noise_sampler, cfg_pp=True) + +@torch.no_grad() +def sample_gradient_estimation(model, x, sigmas, extra_args=None, callback=None, disable=None, ge_gamma=2.): + """Gradient-estimation sampler. Paper: https://openreview.net/pdf?id=o2ND9v0CeK""" + extra_args = {} if extra_args is None else extra_args + s_in = x.new_ones([x.shape[0]]) + old_d = None + + for i in trange(len(sigmas) - 1, disable=disable): + denoised = model(x, sigmas[i] * s_in, **extra_args) + d = to_d(x, sigmas[i], denoised) + if callback is not None: + callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigmas[i], 'denoised': denoised}) + dt = sigmas[i + 1] - sigmas[i] + if i == 0: + # Euler method + x = x + d * dt + else: + # Gradient estimation + d_bar = ge_gamma * d + (1 - ge_gamma) * old_d + x = x + d_bar * dt + old_d = d + return x diff --git a/comfy/samplers.py b/comfy/samplers.py index d281ecc19..3b66091ef 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -686,7 +686,7 @@ class Sampler: KSAMPLER_NAMES = ["euler", "euler_cfg_pp", "euler_ancestral", "euler_ancestral_cfg_pp", "heun", "heunpp2","dpm_2", "dpm_2_ancestral", "lms", "dpm_fast", "dpm_adaptive", "dpmpp_2s_ancestral", "dpmpp_2s_ancestral_cfg_pp", "dpmpp_sde", "dpmpp_sde_gpu", "dpmpp_2m", "dpmpp_2m_cfg_pp", "dpmpp_2m_sde", "dpmpp_2m_sde_gpu", "dpmpp_3m_sde", "dpmpp_3m_sde_gpu", "ddpm", "lcm", - "ipndm", "ipndm_v", "deis", "res_multistep", "res_multistep_cfg_pp"] + "ipndm", "ipndm_v", "deis", "res_multistep", "res_multistep_cfg_pp", "gradient_estimation"] class KSAMPLER(Sampler): def __init__(self, sampler_function, extra_options={}, inpaint_options={}): From a7fe0a94dee08754f97b0171e15c1f2271aa37be Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 22 Jan 2025 06:37:46 -0500 Subject: [PATCH 037/478] Refactor and fixes for video latents. --- comfy_extras/nodes_latent.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/comfy_extras/nodes_latent.py b/comfy_extras/nodes_latent.py index d266cd293..f33ed1bee 100644 --- a/comfy_extras/nodes_latent.py +++ b/comfy_extras/nodes_latent.py @@ -2,10 +2,14 @@ import comfy.utils import comfy_extras.nodes_post_processing import torch -def reshape_latent_to(target_shape, latent): + +def reshape_latent_to(target_shape, latent, repeat_batch=True): if latent.shape[1:] != target_shape[1:]: - latent = comfy.utils.common_upscale(latent, target_shape[3], target_shape[2], "bilinear", "center") - return comfy.utils.repeat_to_batch_size(latent, target_shape[0]) + latent = comfy.utils.common_upscale(latent, target_shape[-1], target_shape[-2], "bilinear", "center") + if repeat_batch: + return comfy.utils.repeat_to_batch_size(latent, target_shape[0]) + else: + return latent class LatentAdd: @@ -116,8 +120,7 @@ class LatentBatch: s1 = samples1["samples"] s2 = samples2["samples"] - if s1.shape[1:] != s2.shape[1:]: - s2 = comfy.utils.common_upscale(s2, s1.shape[-1], s1.shape[-2], "bilinear", "center") + s2 = reshape_latent_to(s1.shape, s2, repeat_batch=False) s = torch.cat((s1, s2), dim=0) samples_out["samples"] = s samples_out["batch_index"] = samples1.get("batch_index", [x for x in range(0, s1.shape[0])]) + samples2.get("batch_index", [x for x in range(0, s2.shape[0])]) From d6bbe8c40f28446738cd2687a9a13310a3189f1a Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 22 Jan 2025 17:04:30 -0500 Subject: [PATCH 038/478] Remove support for python 3.8. --- comfy/conds.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/conds.py b/comfy/conds.py index 660690af8..73be3b1e0 100644 --- a/comfy/conds.py +++ b/comfy/conds.py @@ -46,7 +46,7 @@ class CONDCrossAttn(CONDRegular): if s1[0] != s2[0] or s1[2] != s2[2]: #these 2 cases should not happen return False - mult_min = lcm(s1[1], s2[1]) + mult_min = math.lcm(s1[1], s2[1]) diff = mult_min // min(s1[1], s2[1]) if diff > 4: #arbitrary limit on the padding because it's probably going to impact performance negatively if it's too much return False @@ -57,7 +57,7 @@ class CONDCrossAttn(CONDRegular): crossattn_max_len = self.cond.shape[1] for x in others: c = x.cond - crossattn_max_len = lcm(crossattn_max_len, c.shape[1]) + crossattn_max_len = math.lcm(crossattn_max_len, c.shape[1]) conds.append(c) out = [] From a058f520901e97855104fb0fece2ec3e85bb57ac Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 22 Jan 2025 17:15:45 -0500 Subject: [PATCH 039/478] [i18n] Add /i18n endpoint to provide all custom node translations (#6558) * [i18n] Add /i18n endpoint to provide all custom node translations * Sort glob result for deterministic ordering * Update comment --- app/custom_node_manager.py | 120 +++++++++++++++-- .../app_test/custom_node_manager_test.py | 121 +++++++++++++++++- tests-unit/utils/json_util_test.py | 71 ++++++++++ utils/json_util.py | 26 ++++ 4 files changed, 321 insertions(+), 17 deletions(-) create mode 100644 tests-unit/utils/json_util_test.py create mode 100644 utils/json_util.py diff --git a/app/custom_node_manager.py b/app/custom_node_manager.py index 7f9f645cd..42b0d75ba 100644 --- a/app/custom_node_manager.py +++ b/app/custom_node_manager.py @@ -4,12 +4,93 @@ import os import folder_paths import glob from aiohttp import web +import json +import logging +from functools import lru_cache + +from utils.json_util import merge_json_recursive + + +# Extra locale files to load into main.json +EXTRA_LOCALE_FILES = [ + "nodeDefs.json", + "commands.json", + "settings.json", +] + + +def safe_load_json_file(file_path: str) -> dict: + if not os.path.exists(file_path): + return {} + + try: + with open(file_path, "r", encoding="utf-8") as f: + return json.load(f) + except json.JSONDecodeError: + logging.error(f"Error loading {file_path}") + return {} + class CustomNodeManager: - """ - Placeholder to refactor the custom node management features from ComfyUI-Manager. - Currently it only contains the custom workflow templates feature. - """ + @lru_cache(maxsize=1) + def build_translations(self): + """Load all custom nodes translations during initialization. Translations are + expected to be loaded from `locales/` folder. + + The folder structure is expected to be the following: + - custom_nodes/ + - custom_node_1/ + - locales/ + - en/ + - main.json + - commands.json + - settings.json + + returned translations are expected to be in the following format: + { + "en": { + "nodeDefs": {...}, + "commands": {...}, + "settings": {...}, + ...{other main.json keys} + } + } + """ + + translations = {} + + for folder in folder_paths.get_folder_paths("custom_nodes"): + # Sort glob results for deterministic ordering + for custom_node_dir in sorted(glob.glob(os.path.join(folder, "*/"))): + locales_dir = os.path.join(custom_node_dir, "locales") + if not os.path.exists(locales_dir): + continue + + for lang_dir in glob.glob(os.path.join(locales_dir, "*/")): + lang_code = os.path.basename(os.path.dirname(lang_dir)) + + if lang_code not in translations: + translations[lang_code] = {} + + # Load main.json + main_file = os.path.join(lang_dir, "main.json") + node_translations = safe_load_json_file(main_file) + + # Load extra locale files + for extra_file in EXTRA_LOCALE_FILES: + extra_file_path = os.path.join(lang_dir, extra_file) + key = extra_file.split(".")[0] + json_data = safe_load_json_file(extra_file_path) + if json_data: + node_translations[key] = json_data + + if node_translations: + translations[lang_code] = merge_json_recursive( + translations[lang_code], node_translations + ) + + return translations + def add_routes(self, routes, webapp, loadedModules): @routes.get("/workflow_templates") @@ -18,17 +99,36 @@ class CustomNodeManager: files = [ file for folder in folder_paths.get_folder_paths("custom_nodes") - for file in glob.glob(os.path.join(folder, '*/example_workflows/*.json')) + for file in glob.glob( + os.path.join(folder, "*/example_workflows/*.json") + ) ] - workflow_templates_dict = {} # custom_nodes folder name -> example workflow names + workflow_templates_dict = ( + {} + ) # custom_nodes folder name -> example workflow names for file in files: - custom_nodes_name = os.path.basename(os.path.dirname(os.path.dirname(file))) + custom_nodes_name = os.path.basename( + os.path.dirname(os.path.dirname(file)) + ) workflow_name = os.path.splitext(os.path.basename(file))[0] - workflow_templates_dict.setdefault(custom_nodes_name, []).append(workflow_name) + workflow_templates_dict.setdefault(custom_nodes_name, []).append( + workflow_name + ) return web.json_response(workflow_templates_dict) # Serve workflow templates from custom nodes. for module_name, module_dir in loadedModules: - workflows_dir = os.path.join(module_dir, 'example_workflows') + workflows_dir = os.path.join(module_dir, "example_workflows") if os.path.exists(workflows_dir): - webapp.add_routes([web.static('/api/workflow_templates/' + module_name, workflows_dir)]) + webapp.add_routes( + [ + web.static( + "/api/workflow_templates/" + module_name, workflows_dir + ) + ] + ) + + @routes.get("/i18n") + async def get_i18n(request): + """Returns translations from all custom nodes' locales folders.""" + return web.json_response(self.build_translations()) diff --git a/tests-unit/app_test/custom_node_manager_test.py b/tests-unit/app_test/custom_node_manager_test.py index 89598de84..b61e25e54 100644 --- a/tests-unit/app_test/custom_node_manager_test.py +++ b/tests-unit/app_test/custom_node_manager_test.py @@ -2,39 +2,146 @@ import pytest from aiohttp import web from unittest.mock import patch from app.custom_node_manager import CustomNodeManager +import json pytestmark = ( pytest.mark.asyncio ) # This applies the asyncio mark to all test functions in the module + @pytest.fixture def custom_node_manager(): return CustomNodeManager() + @pytest.fixture def app(custom_node_manager): app = web.Application() routes = web.RouteTableDef() - custom_node_manager.add_routes(routes, app, [("ComfyUI-TestExtension1", "ComfyUI-TestExtension1")]) + custom_node_manager.add_routes( + routes, app, [("ComfyUI-TestExtension1", "ComfyUI-TestExtension1")] + ) app.add_routes(routes) return app + async def test_get_workflow_templates(aiohttp_client, app, tmp_path): client = await aiohttp_client(app) # Setup temporary custom nodes file structure with 1 workflow file custom_nodes_dir = tmp_path / "custom_nodes" - example_workflows_dir = custom_nodes_dir / "ComfyUI-TestExtension1" / "example_workflows" + example_workflows_dir = ( + custom_nodes_dir / "ComfyUI-TestExtension1" / "example_workflows" + ) example_workflows_dir.mkdir(parents=True) template_file = example_workflows_dir / "workflow1.json" - template_file.write_text('') + template_file.write_text("") - with patch('folder_paths.folder_names_and_paths', { - 'custom_nodes': ([str(custom_nodes_dir)], None) - }): - response = await client.get('/workflow_templates') + with patch( + "folder_paths.folder_names_and_paths", + {"custom_nodes": ([str(custom_nodes_dir)], None)}, + ): + response = await client.get("/workflow_templates") assert response.status == 200 workflows_dict = await response.json() assert isinstance(workflows_dict, dict) assert "ComfyUI-TestExtension1" in workflows_dict assert isinstance(workflows_dict["ComfyUI-TestExtension1"], list) assert workflows_dict["ComfyUI-TestExtension1"][0] == "workflow1" + + +async def test_build_translations_empty_when_no_locales(custom_node_manager, tmp_path): + custom_nodes_dir = tmp_path / "custom_nodes" + custom_nodes_dir.mkdir(parents=True) + + with patch("folder_paths.get_folder_paths", return_value=[str(custom_nodes_dir)]): + translations = custom_node_manager.build_translations() + assert translations == {} + + +async def test_build_translations_loads_all_files(custom_node_manager, tmp_path): + # Setup test directory structure + custom_nodes_dir = tmp_path / "custom_nodes" / "test-extension" + locales_dir = custom_nodes_dir / "locales" / "en" + locales_dir.mkdir(parents=True) + + # Create test translation files + main_content = {"title": "Test Extension"} + (locales_dir / "main.json").write_text(json.dumps(main_content)) + + node_defs = {"node1": "Node 1"} + (locales_dir / "nodeDefs.json").write_text(json.dumps(node_defs)) + + commands = {"cmd1": "Command 1"} + (locales_dir / "commands.json").write_text(json.dumps(commands)) + + settings = {"setting1": "Setting 1"} + (locales_dir / "settings.json").write_text(json.dumps(settings)) + + with patch( + "folder_paths.get_folder_paths", return_value=[tmp_path / "custom_nodes"] + ): + translations = custom_node_manager.build_translations() + + assert translations == { + "en": { + "title": "Test Extension", + "nodeDefs": {"node1": "Node 1"}, + "commands": {"cmd1": "Command 1"}, + "settings": {"setting1": "Setting 1"}, + } + } + + +async def test_build_translations_handles_invalid_json(custom_node_manager, tmp_path): + # Setup test directory structure + custom_nodes_dir = tmp_path / "custom_nodes" / "test-extension" + locales_dir = custom_nodes_dir / "locales" / "en" + locales_dir.mkdir(parents=True) + + # Create valid main.json + main_content = {"title": "Test Extension"} + (locales_dir / "main.json").write_text(json.dumps(main_content)) + + # Create invalid JSON file + (locales_dir / "nodeDefs.json").write_text("invalid json{") + + with patch( + "folder_paths.get_folder_paths", return_value=[tmp_path / "custom_nodes"] + ): + translations = custom_node_manager.build_translations() + + assert translations == { + "en": { + "title": "Test Extension", + } + } + + +async def test_build_translations_merges_multiple_extensions( + custom_node_manager, tmp_path +): + # Setup test directory structure for two extensions + custom_nodes_dir = tmp_path / "custom_nodes" + ext1_dir = custom_nodes_dir / "extension1" / "locales" / "en" + ext2_dir = custom_nodes_dir / "extension2" / "locales" / "en" + ext1_dir.mkdir(parents=True) + ext2_dir.mkdir(parents=True) + + # Create translation files for extension 1 + ext1_main = {"title": "Extension 1", "shared": "Original"} + (ext1_dir / "main.json").write_text(json.dumps(ext1_main)) + + # Create translation files for extension 2 + ext2_main = {"description": "Extension 2", "shared": "Override"} + (ext2_dir / "main.json").write_text(json.dumps(ext2_main)) + + with patch("folder_paths.get_folder_paths", return_value=[str(custom_nodes_dir)]): + translations = custom_node_manager.build_translations() + + assert translations == { + "en": { + "title": "Extension 1", + "description": "Extension 2", + "shared": "Override", # Second extension should override first + } + } diff --git a/tests-unit/utils/json_util_test.py b/tests-unit/utils/json_util_test.py new file mode 100644 index 000000000..d3089d8d1 --- /dev/null +++ b/tests-unit/utils/json_util_test.py @@ -0,0 +1,71 @@ +from utils.json_util import merge_json_recursive + + +def test_merge_simple_dicts(): + base = {"a": 1, "b": 2} + update = {"b": 3, "c": 4} + expected = {"a": 1, "b": 3, "c": 4} + assert merge_json_recursive(base, update) == expected + + +def test_merge_nested_dicts(): + base = {"a": {"x": 1, "y": 2}, "b": 3} + update = {"a": {"y": 4, "z": 5}} + expected = {"a": {"x": 1, "y": 4, "z": 5}, "b": 3} + assert merge_json_recursive(base, update) == expected + + +def test_merge_lists(): + base = {"a": [1, 2], "b": 3} + update = {"a": [3, 4]} + expected = {"a": [1, 2, 3, 4], "b": 3} + assert merge_json_recursive(base, update) == expected + + +def test_merge_nested_lists(): + base = {"a": {"x": [1, 2]}} + update = {"a": {"x": [3, 4]}} + expected = {"a": {"x": [1, 2, 3, 4]}} + assert merge_json_recursive(base, update) == expected + + +def test_merge_mixed_types(): + base = {"a": [1, 2], "b": {"x": 1}} + update = {"a": [3], "b": {"y": 2}} + expected = {"a": [1, 2, 3], "b": {"x": 1, "y": 2}} + assert merge_json_recursive(base, update) == expected + + +def test_merge_overwrite_non_dict(): + base = {"a": 1} + update = {"a": {"x": 2}} + expected = {"a": {"x": 2}} + assert merge_json_recursive(base, update) == expected + + +def test_merge_empty_dicts(): + base = {} + update = {"a": 1} + expected = {"a": 1} + assert merge_json_recursive(base, update) == expected + + +def test_merge_none_values(): + base = {"a": None} + update = {"a": {"x": 1}} + expected = {"a": {"x": 1}} + assert merge_json_recursive(base, update) == expected + + +def test_merge_different_types(): + base = {"a": [1, 2]} + update = {"a": "string"} + expected = {"a": "string"} + assert merge_json_recursive(base, update) == expected + + +def test_merge_complex_nested(): + base = {"a": [1, 2], "b": {"x": [3, 4], "y": {"p": 1}}} + update = {"a": [5], "b": {"x": [6], "y": {"q": 2}}} + expected = {"a": [1, 2, 5], "b": {"x": [3, 4, 6], "y": {"p": 1, "q": 2}}} + assert merge_json_recursive(base, update) == expected diff --git a/utils/json_util.py b/utils/json_util.py new file mode 100644 index 000000000..da45af4f7 --- /dev/null +++ b/utils/json_util.py @@ -0,0 +1,26 @@ +def merge_json_recursive(base, update): + """Recursively merge two JSON-like objects. + - Dictionaries are merged recursively + - Lists are concatenated + - Other types are overwritten by the update value + + Args: + base: Base JSON-like object + update: Update JSON-like object to merge into base + + Returns: + Merged JSON-like object + """ + if not isinstance(base, dict) or not isinstance(update, dict): + if isinstance(base, list) and isinstance(update, list): + return base + update + return update + + merged = base.copy() + for key, value in update.items(): + if key in merged: + merged[key] = merge_json_recursive(merged[key], value) + else: + merged[key] = value + + return merged From ca69b41ceea43f076a8ce0ee97cb7c767cc37914 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 22 Jan 2025 17:16:54 -0500 Subject: [PATCH 040/478] Add utils/ to web server developer codeowner (#6570) --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/CODEOWNERS b/CODEOWNERS index 814d1ecdc..77da0b7ed 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -15,6 +15,7 @@ # Python web server /api_server/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata /app/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata +/utils/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata # Frontend assets /web/ @huchenlei @webfiltered @pythongosssss @yoland68 @robinjhuang From f3566f08949e80afb7a2cffa092494a37c9b10db Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Wed, 22 Jan 2025 17:23:51 -0500 Subject: [PATCH 041/478] remove some params from load 3d node (#6436) --- comfy_extras/nodes_load_3d.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/comfy_extras/nodes_load_3d.py b/comfy_extras/nodes_load_3d.py index 3560ab78a..436131aba 100644 --- a/comfy_extras/nodes_load_3d.py +++ b/comfy_extras/nodes_load_3d.py @@ -19,9 +19,6 @@ class Load3D(): "image": ("LOAD_3D", {}), "width": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), - "show_grid": ([True, False],), - "camera_type": (["perspective", "orthographic"],), - "view": (["front", "right", "top", "isometric"],), "material": (["original", "normal", "wireframe", "depth"],), "bg_color": ("STRING", {"default": "#000000", "multiline": False}), "light_intensity": ("INT", {"default": 10, "min": 1, "max": 20, "step": 1}), @@ -69,9 +66,6 @@ class Load3DAnimation(): "image": ("LOAD_3D_ANIMATION", {}), "width": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), - "show_grid": ([True, False],), - "camera_type": (["perspective", "orthographic"],), - "view": (["front", "right", "top", "isometric"],), "material": (["original", "normal", "wireframe", "depth"],), "bg_color": ("STRING", {"default": "#000000", "multiline": False}), "light_intensity": ("INT", {"default": 10, "min": 1, "max": 20, "step": 1}), @@ -109,9 +103,6 @@ class Preview3D(): def INPUT_TYPES(s): return {"required": { "model_file": ("STRING", {"default": "", "multiline": False}), - "show_grid": ([True, False],), - "camera_type": (["perspective", "orthographic"],), - "view": (["front", "right", "top", "isometric"],), "material": (["original", "normal", "wireframe", "depth"],), "bg_color": ("STRING", {"default": "#000000", "multiline": False}), "light_intensity": ("INT", {"default": 10, "min": 1, "max": 20, "step": 1}), From dfa2b6d129a5f81f4b1920e47e66329966c620d6 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Thu, 23 Jan 2025 05:54:09 -0500 Subject: [PATCH 042/478] Remove unused function lcm in conds.py (#6572) --- comfy/conds.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/comfy/conds.py b/comfy/conds.py index 73be3b1e0..211fb8d57 100644 --- a/comfy/conds.py +++ b/comfy/conds.py @@ -3,9 +3,6 @@ import math import comfy.utils -def lcm(a, b): #TODO: eventually replace by math.lcm (added in python3.9) - return abs(a*b) // math.gcd(a, b) - class CONDRegular: def __init__(self, cond): self.cond = cond From 96e2a45193cc74cb8dbc39c717619ace7c848018 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 23 Jan 2025 05:56:23 -0500 Subject: [PATCH 043/478] Remove useless code. --- comfy/ldm/modules/diffusionmodules/model.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/comfy/ldm/modules/diffusionmodules/model.py b/comfy/ldm/modules/diffusionmodules/model.py index 303147a98..3bf83a7e2 100644 --- a/comfy/ldm/modules/diffusionmodules/model.py +++ b/comfy/ldm/modules/diffusionmodules/model.py @@ -702,9 +702,6 @@ class Decoder(nn.Module): padding=1) def forward(self, z, **kwargs): - #assert z.shape[1:] == self.z_shape[1:] - self.last_z_shape = z.shape - # timestep embedding temb = None From ce557cfb88ffd1e92cad88e123862398a94e08e6 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Thu, 23 Jan 2025 21:57:41 +1100 Subject: [PATCH 044/478] Remove redundant code (#6576) --- folder_paths.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/folder_paths.py b/folder_paths.py index 3542d2edf..616a0d6a5 100644 --- a/folder_paths.py +++ b/folder_paths.py @@ -39,10 +39,10 @@ folder_names_and_paths["photomaker"] = ([os.path.join(models_dir, "photomaker")] folder_names_and_paths["classifiers"] = ([os.path.join(models_dir, "classifiers")], {""}) -output_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "output") -temp_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "temp") -input_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "input") -user_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "user") +output_directory = os.path.join(base_path, "output") +temp_directory = os.path.join(base_path, "temp") +input_directory = os.path.join(base_path, "input") +user_directory = os.path.join(base_path, "user") filename_list_cache: dict[str, tuple[list[str], dict[str, float], float]] = {} From 14ca5f5a10ba4e75cc54e34dc55bfb08c6baf21c Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 24 Jan 2025 06:15:05 -0500 Subject: [PATCH 045/478] Remove useless code. --- comfy/diffusers_convert.py | 103 +------------------------------------ 1 file changed, 2 insertions(+), 101 deletions(-) diff --git a/comfy/diffusers_convert.py b/comfy/diffusers_convert.py index 26e8d96d5..fb9495348 100644 --- a/comfy/diffusers_convert.py +++ b/comfy/diffusers_convert.py @@ -4,105 +4,6 @@ import logging # conversion code from https://github.com/huggingface/diffusers/blob/main/scripts/convert_diffusers_to_original_stable_diffusion.py -# =================# -# UNet Conversion # -# =================# - -unet_conversion_map = [ - # (stable-diffusion, HF Diffusers) - ("time_embed.0.weight", "time_embedding.linear_1.weight"), - ("time_embed.0.bias", "time_embedding.linear_1.bias"), - ("time_embed.2.weight", "time_embedding.linear_2.weight"), - ("time_embed.2.bias", "time_embedding.linear_2.bias"), - ("input_blocks.0.0.weight", "conv_in.weight"), - ("input_blocks.0.0.bias", "conv_in.bias"), - ("out.0.weight", "conv_norm_out.weight"), - ("out.0.bias", "conv_norm_out.bias"), - ("out.2.weight", "conv_out.weight"), - ("out.2.bias", "conv_out.bias"), -] - -unet_conversion_map_resnet = [ - # (stable-diffusion, HF Diffusers) - ("in_layers.0", "norm1"), - ("in_layers.2", "conv1"), - ("out_layers.0", "norm2"), - ("out_layers.3", "conv2"), - ("emb_layers.1", "time_emb_proj"), - ("skip_connection", "conv_shortcut"), -] - -unet_conversion_map_layer = [] -# hardcoded number of downblocks and resnets/attentions... -# would need smarter logic for other networks. -for i in range(4): - # loop over downblocks/upblocks - - for j in range(2): - # loop over resnets/attentions for downblocks - hf_down_res_prefix = f"down_blocks.{i}.resnets.{j}." - sd_down_res_prefix = f"input_blocks.{3 * i + j + 1}.0." - unet_conversion_map_layer.append((sd_down_res_prefix, hf_down_res_prefix)) - - if i < 3: - # no attention layers in down_blocks.3 - hf_down_atn_prefix = f"down_blocks.{i}.attentions.{j}." - sd_down_atn_prefix = f"input_blocks.{3 * i + j + 1}.1." - unet_conversion_map_layer.append((sd_down_atn_prefix, hf_down_atn_prefix)) - - for j in range(3): - # loop over resnets/attentions for upblocks - hf_up_res_prefix = f"up_blocks.{i}.resnets.{j}." - sd_up_res_prefix = f"output_blocks.{3 * i + j}.0." - unet_conversion_map_layer.append((sd_up_res_prefix, hf_up_res_prefix)) - - if i > 0: - # no attention layers in up_blocks.0 - hf_up_atn_prefix = f"up_blocks.{i}.attentions.{j}." - sd_up_atn_prefix = f"output_blocks.{3 * i + j}.1." - unet_conversion_map_layer.append((sd_up_atn_prefix, hf_up_atn_prefix)) - - if i < 3: - # no downsample in down_blocks.3 - hf_downsample_prefix = f"down_blocks.{i}.downsamplers.0.conv." - sd_downsample_prefix = f"input_blocks.{3 * (i + 1)}.0.op." - unet_conversion_map_layer.append((sd_downsample_prefix, hf_downsample_prefix)) - - # no upsample in up_blocks.3 - hf_upsample_prefix = f"up_blocks.{i}.upsamplers.0." - sd_upsample_prefix = f"output_blocks.{3 * i + 2}.{1 if i == 0 else 2}." - unet_conversion_map_layer.append((sd_upsample_prefix, hf_upsample_prefix)) - -hf_mid_atn_prefix = "mid_block.attentions.0." -sd_mid_atn_prefix = "middle_block.1." -unet_conversion_map_layer.append((sd_mid_atn_prefix, hf_mid_atn_prefix)) - -for j in range(2): - hf_mid_res_prefix = f"mid_block.resnets.{j}." - sd_mid_res_prefix = f"middle_block.{2 * j}." - unet_conversion_map_layer.append((sd_mid_res_prefix, hf_mid_res_prefix)) - - -def convert_unet_state_dict(unet_state_dict): - # buyer beware: this is a *brittle* function, - # and correct output requires that all of these pieces interact in - # the exact order in which I have arranged them. - mapping = {k: k for k in unet_state_dict.keys()} - for sd_name, hf_name in unet_conversion_map: - mapping[hf_name] = sd_name - for k, v in mapping.items(): - if "resnets" in k: - for sd_part, hf_part in unet_conversion_map_resnet: - v = v.replace(hf_part, sd_part) - mapping[k] = v - for k, v in mapping.items(): - for sd_part, hf_part in unet_conversion_map_layer: - v = v.replace(hf_part, sd_part) - mapping[k] = v - new_state_dict = {v: unet_state_dict[k] for k, v in mapping.items()} - return new_state_dict - - # ================# # VAE Conversion # # ================# @@ -213,6 +114,7 @@ textenc_pattern = re.compile("|".join(protected.keys())) # Ordering is from https://github.com/pytorch/pytorch/blob/master/test/cpp/api/modules.cpp code2idx = {"q": 0, "k": 1, "v": 2} + # This function exists because at the time of writing torch.cat can't do fp8 with cuda def cat_tensors(tensors): x = 0 @@ -229,6 +131,7 @@ def cat_tensors(tensors): return out + def convert_text_enc_state_dict_v20(text_enc_dict, prefix=""): new_state_dict = {} capture_qkv_weight = {} @@ -284,5 +187,3 @@ def convert_text_enc_state_dict_v20(text_enc_dict, prefix=""): def convert_text_enc_state_dict(text_enc_dict): return text_enc_dict - - From 7fbf4b72fe3b23d9ff8f21e0f9a254d032f2f9d0 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 24 Jan 2025 06:15:38 -0500 Subject: [PATCH 046/478] Update nightly pytorch ROCm command in Readme. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fd21f5624..ab589f4e0 100644 --- a/README.md +++ b/README.md @@ -154,9 +154,9 @@ AMD users can install rocm and pytorch with pip if you don't have it already ins ```pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.2``` -This is the command to install the nightly with ROCm 6.2 which might have some performance improvements: +This is the command to install the nightly with ROCm 6.3 which might have some performance improvements: -```pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.2.4``` +```pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.3``` ### Intel GPUs (Windows and Linux) From 6d217403469f7e9b69867d431f27326a62f9248e Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 25 Jan 2025 15:03:57 -0500 Subject: [PATCH 047/478] Print ComfyUI version. --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index c5c9f4e09..f6510c90a 100644 --- a/main.py +++ b/main.py @@ -138,6 +138,8 @@ import server from server import BinaryEventTypes import nodes import comfy.model_management +import comfyui_version + def cuda_malloc_warning(): device = comfy.model_management.get_torch_device() @@ -292,6 +294,7 @@ def start_comfyui(asyncio_loop=None): if __name__ == "__main__": # Running directly, just start ComfyUI. + logging.info("ComfyUI version: {}".format(comfyui_version.__version__)) event_loop, _, start_all_func = start_comfyui() try: event_loop.run_until_complete(start_all_func()) From 67feb05299284355983bd5105b9aa8e6143b84c9 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 25 Jan 2025 19:04:53 -0500 Subject: [PATCH 048/478] Remove redundant code. --- comfy/model_management.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index f6dfc18b0..cd7389c42 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -535,14 +535,11 @@ def load_models_gpu(models, memory_required=0, force_patch_weights=False, minimu vram_set_state = vram_state lowvram_model_memory = 0 if lowvram_available and (vram_set_state == VRAMState.LOW_VRAM or vram_set_state == VRAMState.NORMAL_VRAM) and not force_full_load: - model_size = loaded_model.model_memory_required(torch_dev) loaded_memory = loaded_model.model_loaded_memory() current_free_mem = get_free_memory(torch_dev) + loaded_memory lowvram_model_memory = max(64 * 1024 * 1024, (current_free_mem - minimum_memory_required), min(current_free_mem * MIN_WEIGHT_MEMORY_RATIO, current_free_mem - minimum_inference_memory())) lowvram_model_memory = max(0.1, lowvram_model_memory - loaded_memory) - if model_size <= lowvram_model_memory: #only switch to lowvram if really necessary - lowvram_model_memory = 0 if vram_set_state == VRAMState.NO_VRAM: lowvram_model_memory = 0.1 From 4f011b9a0041e4600de117679bf6c9870f66dcc9 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 26 Jan 2025 06:04:57 -0500 Subject: [PATCH 049/478] Better CLIPTextEncode error when clip input is None. --- nodes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nodes.py b/nodes.py index ef51994ef..968f0f9ad 100644 --- a/nodes.py +++ b/nodes.py @@ -63,6 +63,8 @@ class CLIPTextEncode(ComfyNodeABC): DESCRIPTION = "Encodes a text prompt using a CLIP model into an embedding that can be used to guide the diffusion model towards generating specific images." def encode(self, clip, text): + if clip is None: + raise RuntimeError("ERROR: clip input is invalid: None\n\nIf the clip is from a checkpoint loader node your checkpoint does not contain a valid clip or text encoder model.") tokens = clip.tokenize(text) return (clip.encode_from_tokens_scheduled(tokens), ) From 255edf22463f597a1e136091e0f5cbbbe5f400a4 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 27 Jan 2025 05:26:51 -0500 Subject: [PATCH 050/478] Lower minimum ratio of loaded weights on Nvidia. --- comfy/model_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index cd7389c42..225a83e05 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -218,7 +218,7 @@ def is_amd(): MIN_WEIGHT_MEMORY_RATIO = 0.4 if is_nvidia(): - MIN_WEIGHT_MEMORY_RATIO = 0.2 + MIN_WEIGHT_MEMORY_RATIO = 0.1 ENABLE_PYTORCH_ATTENTION = False if args.use_pytorch_cross_attention: From 1210d094c711cb798ee1ce0198eedc2925a247b5 Mon Sep 17 00:00:00 2001 From: Bradley Reynolds Date: Tue, 28 Jan 2025 07:22:54 -0600 Subject: [PATCH 051/478] Convert `latents_ubyte` to 8-bit unsigned int before converting to CPU (#6300) * Convert latents_ubyte to 8-bit unsigned int before converting to CPU * Only convert to unint8 if directml_enabled --- latent_preview.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/latent_preview.py b/latent_preview.py index 07f9cc68e..95d3cb733 100644 --- a/latent_preview.py +++ b/latent_preview.py @@ -12,7 +12,10 @@ MAX_PREVIEW_RESOLUTION = args.preview_size def preview_to_image(latent_image): latents_ubyte = (((latent_image + 1.0) / 2.0).clamp(0, 1) # change scale from -1..1 to 0..1 .mul(0xFF) # to 0..255 - ).to(device="cpu", dtype=torch.uint8, non_blocking=comfy.model_management.device_supports_non_blocking(latent_image.device)) + ) + if comfy.model_management.directml_enabled: + latents_ubyte = latents_ubyte.to(dtype=torch.uint8) + latents_ubyte = latents_ubyte.to(device="cpu", dtype=torch.uint8, non_blocking=comfy.model_management.device_supports_non_blocking(latent_image.device)) return Image.fromarray(latents_ubyte.numpy()) From 13fd4d6e45128f3aed95ee66151353e84daf2d13 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 28 Jan 2025 09:41:09 -0500 Subject: [PATCH 052/478] More friendly error messages for corrupted safetensors files. --- comfy/utils.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/comfy/utils.py b/comfy/utils.py index b35062824..c901347c4 100644 --- a/comfy/utils.py +++ b/comfy/utils.py @@ -50,7 +50,16 @@ def load_torch_file(ckpt, safe_load=False, device=None): if device is None: device = torch.device("cpu") if ckpt.lower().endswith(".safetensors") or ckpt.lower().endswith(".sft"): - sd = safetensors.torch.load_file(ckpt, device=device.type) + try: + sd = safetensors.torch.load_file(ckpt, device=device.type) + except Exception as e: + if len(e.args) > 0: + message = e.args[0] + if "HeaderTooLarge" in message: + raise ValueError("{}\n\nFile path: {}\n\nThe safetensors file is corrupt or invalid. Make sure this is actually a safetensors file and not a ckpt or pt or other filetype.".format(message, ckpt)) + if "MetadataIncompleteBuffer" in message: + raise ValueError("{}\n\nFile path: {}\n\nThe safetensors file is incomplete. Check the file size and make sure you have copied/downloaded it correctly.".format(message, ckpt)) + raise e else: if safe_load or ALWAYS_SAFE_LOAD: pl_sd = torch.load(ckpt, map_location=device, weights_only=True) From 222f48c0f2d6e4c1da490ccc378bda26d6f9391a Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Thu, 30 Jan 2025 00:06:28 +1100 Subject: [PATCH 053/478] Allow changing folder_paths.base_path via command line argument. (#6600) * Reimpl. CLI arg directly inside folder_paths. * Update tests to use CLI arg mocking. * Revert last-minute refactor. * Fix test state polution. --- comfy/cli_args.py | 9 +-- folder_paths.py | 10 ++- tests-unit/comfy_test/folder_path_test.py | 74 +++++++++++++++++++++-- 3 files changed, 83 insertions(+), 10 deletions(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 812798bf8..f31d59411 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -43,10 +43,11 @@ parser.add_argument("--tls-certfile", type=str, help="Path to TLS (SSL) certific parser.add_argument("--enable-cors-header", type=str, default=None, metavar="ORIGIN", nargs="?", const="*", help="Enable CORS (Cross-Origin Resource Sharing) with optional origin or allow all with default '*'.") parser.add_argument("--max-upload-size", type=float, default=100, help="Set the maximum upload size in MB.") +parser.add_argument("--base-directory", type=str, default=None, help="Set the ComfyUI base directory for models, custom_nodes, input, output, temp, and user directories.") parser.add_argument("--extra-model-paths-config", type=str, default=None, metavar="PATH", nargs='+', action='append', help="Load one or more extra_model_paths.yaml files.") -parser.add_argument("--output-directory", type=str, default=None, help="Set the ComfyUI output directory.") -parser.add_argument("--temp-directory", type=str, default=None, help="Set the ComfyUI temp directory (default is in the ComfyUI directory).") -parser.add_argument("--input-directory", type=str, default=None, help="Set the ComfyUI input directory.") +parser.add_argument("--output-directory", type=str, default=None, help="Set the ComfyUI output directory. Overrides --base-directory.") +parser.add_argument("--temp-directory", type=str, default=None, help="Set the ComfyUI temp directory (default is in the ComfyUI directory). Overrides --base-directory.") +parser.add_argument("--input-directory", type=str, default=None, help="Set the ComfyUI input directory. Overrides --base-directory.") parser.add_argument("--auto-launch", action="store_true", help="Automatically launch ComfyUI in the default browser.") parser.add_argument("--disable-auto-launch", action="store_true", help="Disable auto launching the browser.") parser.add_argument("--cuda-device", type=int, default=None, metavar="DEVICE_ID", help="Set the id of the cuda device this instance will use.") @@ -176,7 +177,7 @@ parser.add_argument( help="The local filesystem path to the directory where the frontend is located. Overrides --front-end-version.", ) -parser.add_argument("--user-directory", type=is_valid_directory, default=None, help="Set the ComfyUI user directory with an absolute path.") +parser.add_argument("--user-directory", type=is_valid_directory, default=None, help="Set the ComfyUI user directory with an absolute path. Overrides --base-directory.") if comfy.options.args_parsing: args = parser.parse_args() diff --git a/folder_paths.py b/folder_paths.py index 616a0d6a5..4344fb187 100644 --- a/folder_paths.py +++ b/folder_paths.py @@ -7,11 +7,19 @@ import logging from typing import Literal from collections.abc import Collection +from comfy.cli_args import args + supported_pt_extensions: set[str] = {'.ckpt', '.pt', '.bin', '.pth', '.safetensors', '.pkl', '.sft'} folder_names_and_paths: dict[str, tuple[list[str], set[str]]] = {} -base_path = os.path.dirname(os.path.realpath(__file__)) +# --base-directory - Resets all default paths configured in folder_paths with a new base path +if args.base_directory: + base_path = os.path.abspath(args.base_directory) + logging.info(f"Setting base directory to: {base_path}") +else: + base_path = os.path.dirname(os.path.realpath(__file__)) + models_dir = os.path.join(base_path, "models") folder_names_and_paths["checkpoints"] = ([os.path.join(models_dir, "checkpoints")], supported_pt_extensions) folder_names_and_paths["configs"] = ([os.path.join(models_dir, "configs")], [".yaml"]) diff --git a/tests-unit/comfy_test/folder_path_test.py b/tests-unit/comfy_test/folder_path_test.py index f8173cdcc..775e15c36 100644 --- a/tests-unit/comfy_test/folder_path_test.py +++ b/tests-unit/comfy_test/folder_path_test.py @@ -1,19 +1,23 @@ ### 🗻 This file is created through the spirit of Mount Fuji at its peak # TODO(yoland): clean up this after I get back down +import sys import pytest import os import tempfile from unittest.mock import patch +from importlib import reload import folder_paths +import comfy.cli_args +from comfy.options import enable_args_parsing +enable_args_parsing() + @pytest.fixture() def clear_folder_paths(): - # Clear the global dictionary before each test to ensure isolation - original = folder_paths.folder_names_and_paths.copy() - folder_paths.folder_names_and_paths.clear() + # Reload the module after each test to ensure isolation yield - folder_paths.folder_names_and_paths = original + reload(folder_paths) @pytest.fixture def temp_dir(): @@ -21,7 +25,21 @@ def temp_dir(): yield tmpdirname -def test_get_directory_by_type(): +@pytest.fixture +def set_base_dir(): + def _set_base_dir(base_dir): + # Mock CLI args + with patch.object(sys, 'argv', ["main.py", "--base-directory", base_dir]): + reload(comfy.cli_args) + reload(folder_paths) + yield _set_base_dir + # Reload the modules after each test to ensure isolation + with patch.object(sys, 'argv', ["main.py"]): + reload(comfy.cli_args) + reload(folder_paths) + + +def test_get_directory_by_type(clear_folder_paths): test_dir = "/test/dir" folder_paths.set_output_directory(test_dir) assert folder_paths.get_directory_by_type("output") == test_dir @@ -96,3 +114,49 @@ def test_get_save_image_path(temp_dir): assert counter == 1 assert subfolder == "" assert filename_prefix == "test" + + +def test_base_path_changes(set_base_dir): + test_dir = os.path.abspath("/test/dir") + set_base_dir(test_dir) + + assert folder_paths.base_path == test_dir + assert folder_paths.models_dir == os.path.join(test_dir, "models") + assert folder_paths.input_directory == os.path.join(test_dir, "input") + assert folder_paths.output_directory == os.path.join(test_dir, "output") + assert folder_paths.temp_directory == os.path.join(test_dir, "temp") + assert folder_paths.user_directory == os.path.join(test_dir, "user") + + assert os.path.join(test_dir, "custom_nodes") in folder_paths.get_folder_paths("custom_nodes") + + for name in ["checkpoints", "loras", "vae", "configs", "embeddings", "controlnet", "classifiers"]: + assert folder_paths.get_folder_paths(name)[0] == os.path.join(test_dir, "models", name) + + +def test_base_path_change_clears_old(set_base_dir): + test_dir = os.path.abspath("/test/dir") + set_base_dir(test_dir) + + assert len(folder_paths.get_folder_paths("custom_nodes")) == 1 + + single_model_paths = [ + "checkpoints", + "loras", + "vae", + "configs", + "clip_vision", + "style_models", + "diffusers", + "vae_approx", + "gligen", + "upscale_models", + "embeddings", + "hypernetworks", + "photomaker", + "classifiers", + ] + for name in single_model_paths: + assert len(folder_paths.get_folder_paths(name)) == 1 + + for name in ["controlnet", "diffusion_models", "text_encoders"]: + assert len(folder_paths.get_folder_paths(name)) == 2 From 6ff2e4d55002cca7ed836dfb39fdf0c82a7f615a Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 29 Jan 2025 08:08:01 -0500 Subject: [PATCH 054/478] Remove logging call added in last commit. This is called before the logging is set up so it messes up some things. --- folder_paths.py | 1 - 1 file changed, 1 deletion(-) diff --git a/folder_paths.py b/folder_paths.py index 4344fb187..3d8f61d4a 100644 --- a/folder_paths.py +++ b/folder_paths.py @@ -16,7 +16,6 @@ folder_names_and_paths: dict[str, tuple[list[str], set[str]]] = {} # --base-directory - Resets all default paths configured in folder_paths with a new base path if args.base_directory: base_path = os.path.abspath(args.base_directory) - logging.info(f"Setting base directory to: {base_path}") else: base_path = os.path.dirname(os.path.realpath(__file__)) From 537c27cbf3c68c1a6dbf8f4bad7a8ce29fccc6da Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 29 Jan 2025 08:13:33 -0500 Subject: [PATCH 055/478] Bump default cuda version in standalone package to 126. --- .github/workflows/stable-release.yml | 2 +- .github/workflows/windows_release_dependencies.yml | 2 +- .github/workflows/windows_release_package.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.yml index 4a5ba58f6..9de458b1e 100644 --- a/.github/workflows/stable-release.yml +++ b/.github/workflows/stable-release.yml @@ -12,7 +12,7 @@ on: description: 'CUDA version' required: true type: string - default: "124" + default: "126" python_minor: description: 'Python minor version' required: true diff --git a/.github/workflows/windows_release_dependencies.yml b/.github/workflows/windows_release_dependencies.yml index 6c7937ae2..afbbb7afe 100644 --- a/.github/workflows/windows_release_dependencies.yml +++ b/.github/workflows/windows_release_dependencies.yml @@ -17,7 +17,7 @@ on: description: 'cuda version' required: true type: string - default: "124" + default: "126" python_minor: description: 'python minor version' diff --git a/.github/workflows/windows_release_package.yml b/.github/workflows/windows_release_package.yml index 24f928ee0..b68400177 100644 --- a/.github/workflows/windows_release_package.yml +++ b/.github/workflows/windows_release_package.yml @@ -7,7 +7,7 @@ on: description: 'cuda version' required: true type: string - default: "124" + default: "126" python_minor: description: 'python minor version' From f9230bd35750cc70b0189a052185d5bd9ba78302 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 29 Jan 2025 15:54:13 -0500 Subject: [PATCH 056/478] Update the python version in some workflows. --- .github/workflows/test-build.yml | 2 +- .github/workflows/test-unit.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 865e1ec25..419873ad8 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index b3a4b4ea0..78c918031 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.12' - name: Install requirements run: | python -m pip install --upgrade pip From ef85058e977f886c88d4a30b819708b1168f39a4 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 29 Jan 2025 16:07:12 -0500 Subject: [PATCH 057/478] Bump ComfyUI version to v0.3.13 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 411243f6c..ca3c0f581 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.12" +__version__ = "0.3.13" diff --git a/pyproject.toml b/pyproject.toml index 0198d1b08..da2c43c00 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.12" +version = "0.3.13" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 2f98c243603aaf461eda72b86e447c1b047623c2 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 30 Jan 2025 02:12:43 -0500 Subject: [PATCH 058/478] Update Readme with link to instruction for Nvidia 50 series. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ab589f4e0..311dbb294 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,8 @@ Simply download, extract with [7-Zip](https://7-zip.org) and run. Make sure you If you have trouble extracting it, right click the file -> properties -> unblock +If you have a 50 series Blackwell card like a 5090 or 5080 see [this discussion thread](https://github.com/comfyanonymous/ComfyUI/discussions/6643) + #### How do I share models between another UI and ComfyUI? See the [Config file](extra_model_paths.yaml.example) to set the search paths for models. In the standalone windows build you can find this file in the ComfyUI directory. Rename this file to extra_model_paths.yaml and edit it with your favorite text editor. @@ -186,7 +188,7 @@ Additional discussion and help can be found [here](https://github.com/comfyanony Nvidia users should install stable pytorch using this command: -```pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu124``` +```pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu126``` This is the command to install pytorch nightly instead which might have performance improvements: From 8d8dc9a262bfee9f7eb3a2fc381b79a69274f225 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 30 Jan 2025 06:49:52 -0500 Subject: [PATCH 059/478] Allow batch of different sigmas when noise scaling. --- comfy/model_sampling.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/comfy/model_sampling.py b/comfy/model_sampling.py index 4370516b9..ff27b09a8 100644 --- a/comfy/model_sampling.py +++ b/comfy/model_sampling.py @@ -31,6 +31,7 @@ class EPS: return model_input - model_output * sigma def noise_scaling(self, sigma, noise, latent_image, max_denoise=False): + sigma = sigma.view(sigma.shape[:1] + (1,) * (noise.ndim - 1)) if max_denoise: noise = noise * torch.sqrt(1.0 + sigma ** 2.0) else: @@ -61,9 +62,11 @@ class CONST: return model_input - model_output * sigma def noise_scaling(self, sigma, noise, latent_image, max_denoise=False): + sigma = sigma.view(sigma.shape[:1] + (1,) * (noise.ndim - 1)) return sigma * noise + (1.0 - sigma) * latent_image def inverse_noise_scaling(self, sigma, latent): + sigma = sigma.view(sigma.shape[:1] + (1,) * (latent.ndim - 1)) return latent / (1.0 - sigma) class ModelSamplingDiscrete(torch.nn.Module): From 541dc08547338e3476c4b11c2329df6da3f499e4 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 31 Jan 2025 08:35:48 -0500 Subject: [PATCH 060/478] Update Readme. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 311dbb294..84ac02eb3 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ To run it on services like paperspace, kaggle or colab you can use my [Jupyter N ## Manual Install (Windows, Linux) -Note that some dependencies do not yet support python 3.13 so using 3.12 is recommended. +python 3.13 is supported but using 3.12 is recommended because some custom nodes and their dependencies might not support it yet. Git clone this repo. @@ -154,7 +154,7 @@ Put your VAE in: models/vae ### AMD GPUs (Linux only) AMD users can install rocm and pytorch with pip if you don't have it already installed, this is the command to install the stable version: -```pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.2``` +```pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.2.4``` This is the command to install the nightly with ROCm 6.3 which might have some performance improvements: From 669e0497ea39c58fd2a3d4ae8cca92c9f8d3ca28 Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Sat, 1 Feb 2025 03:07:37 +0900 Subject: [PATCH 061/478] Update frontend to v1.8.12 (#6662) Co-authored-by: huchenlei <20929282+huchenlei@users.noreply.github.com> --- ...QMaVFP.js => BaseViewTemplate-Cof5Ihf_.js} | 9 +- ...6AjGZr.js => DesktopStartView-DTiwKLp6.js} | 6 +- ...PK_vYgU.js => DownloadGitView-At9xRwC5.js} | 6 +- ...3jWrm6Zi.js => ExtensionPanel-C_ZBlIyE.js} | 8 +- ...ew-CqZ3opAX.css => GraphView-CVCdiww1.css} | 12 +- web/assets/GraphView-DKrBTQLe.js | 4682 ++ web/assets/InstallView-By3hC1fC.js | 1319 - web/assets/InstallView-C6tMsokB.js | 945 + ...-CxhfFC8Y.css => InstallView-DbJ2cGfL.css} | 10 +- ...6O16W_1.js => KeybindingPanel-BbfXtVg1.js} | 13 +- web/assets/MaintenanceView-Bj5_Vr6o.css | 87 + web/assets/MaintenanceView-D3drnrFc.js | 26033 +++++++++ ...js => ManualConfigurationView-CtZMj_n_.js} | 7 +- ...u4nr.js => MetricsConsentView-Df03LOI_.js} | 8 +- ...8_xWgH.js => NotSupportedView-BRtvC5Gx.js} | 46 +- ...xQzi.css => NotSupportedView-RFx6eCkN.css} | 4 +- ...0HFlz.js => ServerConfigPanel-C2nrpEEV.js} | 28 +- ...8wfE1MS.js => ServerStartView-M5VckhgZ.js} | 7 +- ...CXmVKOeK.js => UserSelectView-DNnNy-AZ.js} | 33 +- ...ew-C8whKl15.js => WelcomeView-Nvn1jaCx.js} | 7 +- .../{index-je62U6DH.js => index-BPn8eYlx.js} | 983 +- ...raphView-CDDCHVO0.js => index-BWow9lpT.js} | 5268 +- web/assets/index-Bm1HvJhs.js | 539 + ...{index-Cf-n7v0V.css => index-C1Hb_Yo9.css} | 256 +- .../{index-DpF-ptbJ.js => index-CdHVC5qq.js} | 635 +- .../{index-QvfM__ze.js => index-CmVtQCAR.js} | 43895 +++++++++------- web/assets/index-I0brO37W.js | 27 + web/assets/index-Q1cQr26V.js | 29 - ...1En5n.js => keybindingService-CqSjCYw-.js} | 4 +- ...e3xlV.js => serverConfigStore-BUvaGcxp.js} | 4 +- web/assets/uvMirrors-B-HKMf6X.js | 16 + web/index.html | 4 +- web/templates/default.json | 6 +- 33 files changed, 59571 insertions(+), 25365 deletions(-) rename web/assets/{BaseViewTemplate-BhQMaVFP.js => BaseViewTemplate-Cof5Ihf_.js} (72%) rename web/assets/{DesktopStartView-le6AjGZr.js => DesktopStartView-DTiwKLp6.js} (63%) rename web/assets/{DownloadGitView-rPK_vYgU.js => DownloadGitView-At9xRwC5.js} (87%) rename web/assets/{ExtensionPanel-3jWrm6Zi.js => ExtensionPanel-C_ZBlIyE.js} (91%) rename web/assets/{GraphView-CqZ3opAX.css => GraphView-CVCdiww1.css} (96%) create mode 100644 web/assets/GraphView-DKrBTQLe.js delete mode 100644 web/assets/InstallView-By3hC1fC.js create mode 100644 web/assets/InstallView-C6tMsokB.js rename web/assets/{InstallView-CxhfFC8Y.css => InstallView-DbJ2cGfL.css} (93%) rename web/assets/{KeybindingPanel-D6O16W_1.js => KeybindingPanel-BbfXtVg1.js} (91%) create mode 100644 web/assets/MaintenanceView-Bj5_Vr6o.css create mode 100644 web/assets/MaintenanceView-D3drnrFc.js rename web/assets/{ManualConfigurationView-enyqGo0M.js => ManualConfigurationView-CtZMj_n_.js} (85%) rename web/assets/{MetricsConsentView-lSfLu4nr.js => MetricsConsentView-Df03LOI_.js} (87%) rename web/assets/{NotSupportedView-Vc8_xWgH.js => NotSupportedView-BRtvC5Gx.js} (64%) rename web/assets/{NotSupportedView-DQerxQzi.css => NotSupportedView-RFx6eCkN.css} (87%) rename web/assets/{ServerConfigPanel-B-w0HFlz.js => ServerConfigPanel-C2nrpEEV.js} (86%) rename web/assets/{ServerStartView-48wfE1MS.js => ServerStartView-M5VckhgZ.js} (85%) rename web/assets/{UserSelectView-CXmVKOeK.js => UserSelectView-DNnNy-AZ.js} (72%) rename web/assets/{WelcomeView-C8whKl15.js => WelcomeView-Nvn1jaCx.js} (73%) rename web/assets/{index-je62U6DH.js => index-BPn8eYlx.js} (98%) rename web/assets/{GraphView-CDDCHVO0.js => index-BWow9lpT.js} (51%) create mode 100644 web/assets/index-Bm1HvJhs.js rename web/assets/{index-Cf-n7v0V.css => index-C1Hb_Yo9.css} (95%) rename web/assets/{index-DpF-ptbJ.js => index-CdHVC5qq.js} (86%) rename web/assets/{index-QvfM__ze.js => index-CmVtQCAR.js} (90%) create mode 100644 web/assets/index-I0brO37W.js delete mode 100644 web/assets/index-Q1cQr26V.js rename web/assets/{keybindingService-Cak1En5n.js => keybindingService-CqSjCYw-.js} (96%) rename web/assets/{serverConfigStore-DCme3xlV.js => serverConfigStore-BUvaGcxp.js} (95%) create mode 100644 web/assets/uvMirrors-B-HKMf6X.js diff --git a/web/assets/BaseViewTemplate-BhQMaVFP.js b/web/assets/BaseViewTemplate-Cof5Ihf_.js similarity index 72% rename from web/assets/BaseViewTemplate-BhQMaVFP.js rename to web/assets/BaseViewTemplate-Cof5Ihf_.js index af2f3028c..592bb1129 100644 --- a/web/assets/BaseViewTemplate-BhQMaVFP.js +++ b/web/assets/BaseViewTemplate-Cof5Ihf_.js @@ -1,4 +1,4 @@ -import { d as defineComponent, ad as ref, t as onMounted, bT as isElectron, bV as electronAPI, af as nextTick, o as openBlock, f as createElementBlock, i as withDirectives, v as vShow, m as createBaseVNode, M as renderSlot, V as normalizeClass } from "./index-QvfM__ze.js"; +import { d as defineComponent, U as ref, p as onMounted, b4 as isElectron, W as nextTick, b5 as electronAPI, o as openBlock, f as createElementBlock, i as withDirectives, v as vShow, j as unref, b6 as isNativeWindow, m as createBaseVNode, A as renderSlot, ai as normalizeClass } from "./index-CmVtQCAR.js"; const _hoisted_1 = { class: "flex-grow w-full flex items-center justify-center overflow-auto" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "BaseViewTemplate", @@ -16,11 +16,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ symbolColor: "#171717" }; const topMenuRef = ref(null); - const isNativeWindow = ref(false); onMounted(async () => { if (isElectron()) { - const windowStyle = await electronAPI().Config.getWindowStyle(); - isNativeWindow.value = windowStyle === "custom"; await nextTick(); electronAPI().changeTheme({ ...props.dark ? darkTheme : lightTheme, @@ -39,7 +36,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ ref: topMenuRef, class: "app-drag w-full h-[var(--comfy-topbar-height)]" }, null, 512), [ - [vShow, isNativeWindow.value] + [vShow, unref(isNativeWindow)()] ]), createBaseVNode("div", _hoisted_1, [ renderSlot(_ctx.$slots, "default") @@ -51,4 +48,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as _ }; -//# sourceMappingURL=BaseViewTemplate-BhQMaVFP.js.map +//# sourceMappingURL=BaseViewTemplate-Cof5Ihf_.js.map diff --git a/web/assets/DesktopStartView-le6AjGZr.js b/web/assets/DesktopStartView-DTiwKLp6.js similarity index 63% rename from web/assets/DesktopStartView-le6AjGZr.js rename to web/assets/DesktopStartView-DTiwKLp6.js index 41a212f3a..bff52ac02 100644 --- a/web/assets/DesktopStartView-le6AjGZr.js +++ b/web/assets/DesktopStartView-DTiwKLp6.js @@ -1,5 +1,5 @@ -import { d as defineComponent, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, k as createVNode, j as unref, ch as script } from "./index-QvfM__ze.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; +import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, k as createVNode, j as unref, bz as script } from "./index-CmVtQCAR.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.js"; const _hoisted_1 = { class: "max-w-screen-sm w-screen p-8" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "DesktopStartView", @@ -19,4 +19,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=DesktopStartView-le6AjGZr.js.map +//# sourceMappingURL=DesktopStartView-DTiwKLp6.js.map diff --git a/web/assets/DownloadGitView-rPK_vYgU.js b/web/assets/DownloadGitView-At9xRwC5.js similarity index 87% rename from web/assets/DownloadGitView-rPK_vYgU.js rename to web/assets/DownloadGitView-At9xRwC5.js index c286da355..4a43918d5 100644 --- a/web/assets/DownloadGitView-rPK_vYgU.js +++ b/web/assets/DownloadGitView-At9xRwC5.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, j as unref, l as script, c2 as useRouter } from "./index-QvfM__ze.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; +import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, be as useRouter } from "./index-CmVtQCAR.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.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" }; @@ -55,4 +55,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=DownloadGitView-rPK_vYgU.js.map +//# sourceMappingURL=DownloadGitView-At9xRwC5.js.map diff --git a/web/assets/ExtensionPanel-3jWrm6Zi.js b/web/assets/ExtensionPanel-C_ZBlIyE.js similarity index 91% rename from web/assets/ExtensionPanel-3jWrm6Zi.js rename to web/assets/ExtensionPanel-C_ZBlIyE.js index 3c580dd1b..6d3034e06 100644 --- a/web/assets/ExtensionPanel-3jWrm6Zi.js +++ b/web/assets/ExtensionPanel-C_ZBlIyE.js @@ -1,8 +1,8 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, ad as ref, cu as FilterMatchMode, cz as useExtensionStore, a as useSettingStore, t as onMounted, c as computed, o as openBlock, J as createBlock, P as withCtx, k as createVNode, cv as SearchBox, j as unref, c6 as script, m as createBaseVNode, f as createElementBlock, I as renderList, Z as toDisplayString, aG as createTextVNode, H as Fragment, l as script$1, L as createCommentVNode, aK as script$3, b8 as script$4, cc as script$5, cw as _sfc_main$1 } from "./index-QvfM__ze.js"; -import { s as script$2, a as script$6 } from "./index-DpF-ptbJ.js"; -import "./index-Q1cQr26V.js"; +import { d as defineComponent, U as ref, dl as FilterMatchMode, dr as useExtensionStore, a as useSettingStore, p as onMounted, c as computed, o as openBlock, y as createBlock, z as withCtx, k as createVNode, dm as SearchBox, j as unref, bj as script, m as createBaseVNode, f as createElementBlock, D as renderList, E as toDisplayString, a7 as createTextVNode, F as Fragment, l as script$1, B as createCommentVNode, a4 as script$3, ax as script$4, bn as script$5, dn as _sfc_main$1 } from "./index-CmVtQCAR.js"; +import { g as script$2, h as script$6 } from "./index-CdHVC5qq.js"; +import "./index-I0brO37W.js"; const _hoisted_1 = { class: "flex justify-end" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "ExtensionPanel", @@ -179,4 +179,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ExtensionPanel-3jWrm6Zi.js.map +//# sourceMappingURL=ExtensionPanel-C_ZBlIyE.js.map diff --git a/web/assets/GraphView-CqZ3opAX.css b/web/assets/GraphView-CVCdiww1.css similarity index 96% rename from web/assets/GraphView-CqZ3opAX.css rename to web/assets/GraphView-CVCdiww1.css index f735c8386..765b2a0e7 100644 --- a/web/assets/GraphView-CqZ3opAX.css +++ b/web/assets/GraphView-CVCdiww1.css @@ -230,7 +230,7 @@ border-bottom-left-radius: 0; } -.comfyui-queue-button[data-v-e9044686] .p-splitbutton-dropdown { +.comfyui-queue-button[data-v-91a628af] .p-splitbutton-dropdown { border-top-right-radius: 0; border-bottom-right-radius: 0; } @@ -275,7 +275,7 @@ border-style: solid; } -.comfyui-menu[data-v-6e35440f] { +.comfyui-menu[data-v-929e7543] { width: 100vw; height: var(--comfy-topbar-height); background: var(--comfy-menu-bg); @@ -288,16 +288,16 @@ order: 0; grid-column: 1/-1; } -.comfyui-menu.dropzone[data-v-6e35440f] { +.comfyui-menu.dropzone[data-v-929e7543] { background: var(--p-highlight-background); } -.comfyui-menu.dropzone-active[data-v-6e35440f] { +.comfyui-menu.dropzone-active[data-v-929e7543] { background: var(--p-highlight-background-focus); } -[data-v-6e35440f] .p-menubar-item-label { +[data-v-929e7543] .p-menubar-item-label { line-height: revert; } -.comfyui-logo[data-v-6e35440f] { +.comfyui-logo[data-v-929e7543] { font-size: 1.2em; -webkit-user-select: none; -moz-user-select: none; diff --git a/web/assets/GraphView-DKrBTQLe.js b/web/assets/GraphView-DKrBTQLe.js new file mode 100644 index 000000000..495f54fe9 --- /dev/null +++ b/web/assets/GraphView-DKrBTQLe.js @@ -0,0 +1,4682 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +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 createVNode, s as showNativeMenu, l as script, m as createBaseVNode, n as normalizeStyle, _ as _export_sfc, p as onMounted, q as onBeforeUnmount, t as useSidebarTabStore, x as useBottomPanelStore, y as createBlock, z as withCtx, A as renderSlot, B as createCommentVNode, C as resolveDynamicComponent, F as Fragment, D as renderList, E as toDisplayString, G as script$5, H as markRaw, I as defineStore, J as shallowRef, K as useI18n, L as useCommandStore, M as LiteGraph, N as useColorPaletteStore, O as watch, P as useNodeDefStore, Q as BadgePosition, R as LGraphBadge, S as _, T as NodeBadgeMode, U as ref, V as useEventListener, W as nextTick, X as st, Y as normalizeI18nKey, Z as LGraphGroup, $ as LGraphNode, a0 as EditableText, a1 as useNodeFrequencyStore, a2 as useNodeBookmarkStore, a3 as highlightQuery, a4 as script$8, a5 as formatNumberWithSuffix, a6 as NodeSourceType, a7 as createTextVNode, a8 as script$9, a9 as NodePreview, aa as NodeSearchFilter, ab as script$a, ac as SearchFilterChip, ad as useLitegraphService, ae as storeToRefs, af as isRef, ag as toRaw, ah as LinkReleaseTriggerAction, ai as normalizeClass, aj as useUserStore, ak as useDialogStore, al as SettingDialogHeader, am as SettingDialogContent, an as useKeybindingStore, ao as Teleport, ap as usePragmaticDraggable, aq as usePragmaticDroppable, ar as withModifiers, as as mergeProps, at as useWorkflowService, au as useWorkflowBookmarkStore, av as script$c, aw as script$d, ax as script$e, ay as LinkMarkerShape, az as useModelToNodeStore, aA as ComfyNodeDefImpl, aB as ComfyModelDef, aC as LGraph, aD as LLink, aE as DragAndScale, aF as LGraphCanvas, aG as ContextMenu, aH as api, aI as getStorageValue, aJ as useModelStore, aK as setStorageValue, aL as CanvasPointer, aM as IS_CONTROL_WIDGET, aN as updateControlWidgetLabel, aO as useColorPaletteService, aP as ChangeTracker, aQ as i18n, aR as useToast, aS as useToastStore, aT as useQueueSettingsStore, aU as script$g, aV as useQueuePendingTaskCountStore, aW as useLocalStorage, aX as useDraggable, aY as watchDebounced, aZ as inject, a_ as useElementBounding, a$ as script$i, b0 as lodashExports, b1 as useEventBus, b2 as useMenuItemStore, b3 as provide, b4 as isElectron, b5 as electronAPI, b6 as isNativeWindow, b7 as useDialogService, b8 as LGraphEventMode, b9 as useQueueStore, ba as DEFAULT_DARK_COLOR_PALETTE, bb as DEFAULT_LIGHT_COLOR_PALETTE, bc as t, bd as useErrorHandling } from "./index-CmVtQCAR.js"; +import { s as script$1, a as script$2, b as script$3, c as script$4, d as script$6, e as script$7, f as script$b, g as script$f, h as script$h, i as script$j } from "./index-BWow9lpT.js"; +import { u as useKeybindingService } from "./keybindingService-CqSjCYw-.js"; +import { u as useServerConfigStore } from "./serverConfigStore-BUvaGcxp.js"; +import "./index-I0brO37W.js"; +const DEFAULT_TITLE = "ComfyUI"; +const TITLE_SUFFIX = " - ComfyUI"; +const _sfc_main$u = /* @__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 _hoisted_1$j = { class: "window-actions-spacer" }; +const _sfc_main$t = /* @__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(), createElementBlock("div", { + class: "comfy-menu-hamburger no-drag", + style: normalizeStyle(positionCSS.value) + }, [ + withDirectives(createVNode(unref(script), { + icon: "pi pi-bars", + severity: "secondary", + text: "", + size: "large", + "aria-label": _ctx.$t("menu.showMenu"), + "aria-live": "assertive", + onClick: exitFocusMode, + onContextmenu: unref(showNativeMenu) + }, null, 8, ["aria-label", "onContextmenu"]), [ + [_directive_tooltip, { value: _ctx.$t("menu.showMenu"), showDelay: 300 }] + ]), + withDirectives(createBaseVNode("div", _hoisted_1$j, null, 512), [ + [vShow, menuSetting.value !== "Bottom"] + ]) + ], 4)), [ + [vShow, unref(workspaceState).focusMode] + ]); + }; + } +}); +const MenuHamburger = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-7ed57d1a"]]); +const _sfc_main$s = /* @__PURE__ */ defineComponent({ + __name: "UnloadWindowConfirmDialog", + setup(__props) { + const settingStore = useSettingStore(); + const workflowStore = useWorkflowStore(); + const handleBeforeUnload = /* @__PURE__ */ __name((event) => { + if (settingStore.get("Comfy.Window.UnloadConfirmation") && workflowStore.modifiedWorkflows.length > 0) { + 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 _sfc_main$r = /* @__PURE__ */ defineComponent({ + __name: "LiteGraphCanvasSplitterOverlay", + setup(__props) { + const settingStore = useSettingStore(); + const sidebarLocation = computed( + () => settingStore.get("Comfy.Sidebar.Location") + ); + const sidebarPanelVisible = computed( + () => useSidebarTabStore().activeSidebarTab !== null + ); + const bottomPanelVisible = computed( + () => useBottomPanelStore().bottomPanelVisible + ); + const activeSidebarTabId = computed( + () => useSidebarTabStore().activeSidebarTabId + ); + return (_ctx, _cache) => { + return openBlock(), createBlock(unref(script$2), { + class: "splitter-overlay-root splitter-overlay", + "pt:gutter": sidebarPanelVisible.value ? "" : "hidden", + key: activeSidebarTabId.value, + stateKey: activeSidebarTabId.value, + stateStorage: "local" + }, { + default: withCtx(() => [ + sidebarLocation.value === "left" ? withDirectives((openBlock(), createBlock(unref(script$1), { + key: 0, + class: "side-bar-panel", + minSize: 10, + size: 20 + }, { + default: withCtx(() => [ + renderSlot(_ctx.$slots, "side-bar-panel", {}, void 0, true) + ]), + _: 3 + }, 512)), [ + [vShow, sidebarPanelVisible.value] + ]) : createCommentVNode("", true), + createVNode(unref(script$1), { size: 100 }, { + default: withCtx(() => [ + createVNode(unref(script$2), { + class: "splitter-overlay max-w-full", + layout: "vertical", + "pt:gutter": bottomPanelVisible.value ? "" : "hidden", + stateKey: "bottom-panel-splitter", + stateStorage: "local" + }, { + default: withCtx(() => [ + createVNode(unref(script$1), { class: "graph-canvas-panel relative" }, { + default: withCtx(() => [ + renderSlot(_ctx.$slots, "graph-canvas-panel", {}, void 0, true) + ]), + _: 3 + }), + withDirectives(createVNode(unref(script$1), { class: "bottom-panel" }, { + default: withCtx(() => [ + renderSlot(_ctx.$slots, "bottom-panel", {}, void 0, true) + ]), + _: 3 + }, 512), [ + [vShow, bottomPanelVisible.value] + ]) + ]), + _: 3 + }, 8, ["pt:gutter"]) + ]), + _: 3 + }), + sidebarLocation.value === "right" ? withDirectives((openBlock(), createBlock(unref(script$1), { + key: 1, + class: "side-bar-panel", + minSize: 10, + size: 20 + }, { + default: withCtx(() => [ + renderSlot(_ctx.$slots, "side-bar-panel", {}, void 0, true) + ]), + _: 3 + }, 512)), [ + [vShow, sidebarPanelVisible.value] + ]) : createCommentVNode("", true) + ]), + _: 3 + }, 8, ["pt:gutter", "stateKey"]); + }; + } +}); +const LiteGraphCanvasSplitterOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-e50caa15"]]); +const _sfc_main$q = /* @__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$i = { class: "flex flex-col h-full" }; +const _hoisted_2$6 = { class: "w-full flex justify-between" }; +const _hoisted_3$5 = { class: "tabs-container" }; +const _hoisted_4$1 = { class: "font-bold" }; +const _hoisted_5$1 = { class: "flex-grow h-0" }; +const _sfc_main$p = /* @__PURE__ */ defineComponent({ + __name: "BottomPanel", + setup(__props) { + const bottomPanelStore = useBottomPanelStore(); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", _hoisted_1$i, [ + createVNode(unref(script$5), { + value: unref(bottomPanelStore).activeBottomPanelTabId, + "onUpdate:value": _cache[1] || (_cache[1] = ($event) => unref(bottomPanelStore).activeBottomPanelTabId = $event) + }, { + default: withCtx(() => [ + createVNode(unref(script$3), { "pt:tabList": "border-none" }, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_2$6, [ + createBaseVNode("div", _hoisted_3$5, [ + (openBlock(true), createElementBlock(Fragment, null, renderList(unref(bottomPanelStore).bottomPanelTabs, (tab) => { + return openBlock(), createBlock(unref(script$4), { + key: tab.id, + value: tab.id, + class: "p-3 border-none" + }, { + default: withCtx(() => [ + createBaseVNode("span", _hoisted_4$1, toDisplayString(tab.title.toUpperCase()), 1) + ]), + _: 2 + }, 1032, ["value"]); + }), 128)) + ]), + createVNode(unref(script), { + 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$1, [ + unref(bottomPanelStore).bottomPanelVisible && unref(bottomPanelStore).activeBottomPanelTab ? (openBlock(), createBlock(_sfc_main$q, { + key: 0, + extension: unref(bottomPanelStore).activeBottomPanelTab + }, null, 8, ["extension"])) : createCommentVNode("", true) + ]) + ]); + }; + } +}); +const _hoisted_1$h = { + viewBox: "0 0 1024 1024", + width: "1.2em", + height: "1.2em" +}; +function render$7(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$h, _cache[0] || (_cache[0] = [ + 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) + ])); +} +__name(render$7, "render$7"); +const __unplugin_components_1$2 = markRaw({ name: "simple-line-icons-cursor", render: render$7 }); +const _hoisted_1$g = { + viewBox: "0 0 24 24", + width: "1.2em", + height: "1.2em" +}; +function render$6(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$g, _cache[0] || (_cache[0] = [ + 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) + ])); +} +__name(render$6, "render$6"); +const __unplugin_components_0$2 = markRaw({ name: "material-symbols-pan-tool-outline", render: render$6 }); +const useTitleEditorStore = defineStore("titleEditor", () => { + const titleEditorTarget = shallowRef(null); + return { + titleEditorTarget + }; +}); +const useCanvasStore = defineStore("canvas", () => { + const canvas = shallowRef(null); + return { + canvas + }; +}); +const _sfc_main$o = /* @__PURE__ */ defineComponent({ + __name: "GraphCanvasMenu", + setup(__props) { + const { t: t2 } = useI18n(); + const commandStore = useCommandStore(); + const canvasStore = useCanvasStore(); + const settingStore = useSettingStore(); + const linkHidden = computed( + () => settingStore.get("Comfy.LinkRenderMode") === LiteGraph.HIDDEN_LINK + ); + let interval = null; + const repeat = /* @__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$6), { class: "p-buttongroup-vertical absolute bottom-[10px] right-[10px] z-[1000] pointer-events-auto" }, { + default: withCtx(() => [ + withDirectives(createVNode(unref(script), { + severity: "secondary", + icon: "pi pi-plus", + "aria-label": _ctx.$t("graphCanvasMenu.zoomIn"), + onMousedown: _cache[0] || (_cache[0] = ($event) => repeat("Comfy.Canvas.ZoomIn")), + onMouseup: stopRepeat + }, null, 8, ["aria-label"]), [ + [ + _directive_tooltip, + unref(t2)("graphCanvasMenu.zoomIn"), + void 0, + { left: true } + ] + ]), + withDirectives(createVNode(unref(script), { + severity: "secondary", + icon: "pi pi-minus", + "aria-label": _ctx.$t("graphCanvasMenu.zoomOut"), + onMousedown: _cache[1] || (_cache[1] = ($event) => repeat("Comfy.Canvas.ZoomOut")), + onMouseup: stopRepeat + }, null, 8, ["aria-label"]), [ + [ + _directive_tooltip, + unref(t2)("graphCanvasMenu.zoomOut"), + void 0, + { left: true } + ] + ]), + withDirectives(createVNode(unref(script), { + severity: "secondary", + icon: "pi pi-expand", + "aria-label": _ctx.$t("graphCanvasMenu.fitView"), + onClick: _cache[2] || (_cache[2] = () => unref(commandStore).execute("Comfy.Canvas.FitView")) + }, null, 8, ["aria-label"]), [ + [ + _directive_tooltip, + unref(t2)("graphCanvasMenu.fitView"), + void 0, + { left: true } + ] + ]), + withDirectives((openBlock(), createBlock(unref(script), { + severity: "secondary", + "aria-label": unref(t2)( + "graphCanvasMenu." + (unref(canvasStore).canvas?.read_only ? "panMode" : "selectMode") + ), + 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 + }, 8, ["aria-label"])), [ + [ + _directive_tooltip, + unref(t2)( + "graphCanvasMenu." + (unref(canvasStore).canvas?.read_only ? "panMode" : "selectMode") + ) + " (Space)", + void 0, + { left: true } + ] + ]), + withDirectives(createVNode(unref(script), { + severity: "secondary", + icon: linkHidden.value ? "pi pi-eye-slash" : "pi pi-eye", + "aria-label": _ctx.$t("graphCanvasMenu.toggleLinkVisibility"), + onClick: _cache[4] || (_cache[4] = () => unref(commandStore).execute("Comfy.Canvas.ToggleLinkVisibility")), + "data-testid": "toggle-link-visibility-button" + }, null, 8, ["icon", "aria-label"]), [ + [ + _directive_tooltip, + unref(t2)("graphCanvasMenu.toggleLinkVisibility"), + void 0, + { left: true } + ] + ]) + ]), + _: 1 + }); + }; + } +}); +const GraphCanvasMenu = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-cb8f9a1a"]]); +const _sfc_main$n = /* @__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$m = /* @__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$m, [["__scopeId", "data-v-46859edf"]]); +const _sfc_main$l = /* @__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$l, [["__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); + } + } +} +const _sfc_main$k = { + name: "AutoCompletePlus", + extends: script$7, + emits: ["focused-option-changed"], + data() { + return { + // Flag to determine if IME is active + isComposing: false + }; + }, + mounted() { + if (typeof script$7.mounted === "function") { + script$7.mounted.call(this); + } + const inputEl = this.$el.querySelector("input"); + if (inputEl) { + inputEl.addEventListener("compositionstart", () => { + this.isComposing = true; + }); + inputEl.addEventListener("compositionend", () => { + this.isComposing = false; + }); + } + this.$watch( + () => this.focusedOptionIndex, + (newVal, oldVal) => { + this.$emit("focused-option-changed", newVal); + } + ); + }, + methods: { + // Override onKeyDown to block Enter when IME is active + onKeyDown(event) { + if (event.key === "Enter" && this.isComposing) { + event.preventDefault(); + event.stopPropagation(); + return; + } + script$7.methods.onKeyDown.call(this, event); + } + } +}; +const _hoisted_1$f = { class: "option-container flex justify-between items-center px-2 py-0 cursor-pointer overflow-hidden w-full" }; +const _hoisted_2$5 = { class: "option-display-name font-semibold flex flex-col" }; +const _hoisted_3$4 = { key: 0 }; +const _hoisted_4 = ["innerHTML"]; +const _hoisted_5 = ["innerHTML"]; +const _hoisted_6 = { + key: 0, + class: "option-category font-light text-sm text-muted overflow-hidden text-ellipsis whitespace-nowrap" +}; +const _hoisted_7 = { class: "option-badges" }; +const _sfc_main$j = /* @__PURE__ */ defineComponent({ + __name: "NodeSearchItem", + props: { + nodeDef: {}, + currentQuery: {} + }, + setup(__props) { + const settingStore = useSettingStore(); + const showCategory = computed( + () => settingStore.get("Comfy.NodeSearchBoxImpl.ShowCategory") + ); + const showIdName = computed( + () => settingStore.get("Comfy.NodeSearchBoxImpl.ShowIdName") + ); + const showNodeFrequency = computed( + () => settingStore.get("Comfy.NodeSearchBoxImpl.ShowNodeFrequency") + ); + const nodeFrequencyStore = useNodeFrequencyStore(); + const nodeFrequency = computed( + () => nodeFrequencyStore.getNodeFrequency(props.nodeDef) + ); + const nodeBookmarkStore = useNodeBookmarkStore(); + const isBookmarked = computed( + () => nodeBookmarkStore.isBookmarked(props.nodeDef) + ); + const props = __props; + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", _hoisted_1$f, [ + createBaseVNode("div", _hoisted_2$5, [ + createBaseVNode("div", null, [ + isBookmarked.value ? (openBlock(), createElementBlock("span", _hoisted_3$4, _cache[0] || (_cache[0] = [ + createBaseVNode("i", { class: "pi pi-bookmark-fill text-sm mr-1" }, null, -1) + ]))) : createCommentVNode("", true), + createBaseVNode("span", { + innerHTML: unref(highlightQuery)(_ctx.nodeDef.display_name, _ctx.currentQuery) + }, null, 8, _hoisted_4), + _cache[1] || (_cache[1] = createBaseVNode("span", null, " ", -1)), + showIdName.value ? (openBlock(), createBlock(unref(script$8), { + key: 1, + severity: "secondary" + }, { + default: withCtx(() => [ + createBaseVNode("span", { + innerHTML: unref(highlightQuery)(_ctx.nodeDef.name, _ctx.currentQuery) + }, null, 8, _hoisted_5) + ]), + _: 1 + })) : createCommentVNode("", true) + ]), + showCategory.value ? (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(_ctx.nodeDef.category.replaceAll("/", " > ")), 1)) : createCommentVNode("", true) + ]), + createBaseVNode("div", _hoisted_7, [ + _ctx.nodeDef.experimental ? (openBlock(), createBlock(unref(script$8), { + key: 0, + value: _ctx.$t("g.experimental"), + severity: "primary" + }, null, 8, ["value"])) : createCommentVNode("", true), + _ctx.nodeDef.deprecated ? (openBlock(), createBlock(unref(script$8), { + key: 1, + value: _ctx.$t("g.deprecated"), + severity: "danger" + }, null, 8, ["value"])) : createCommentVNode("", true), + showNodeFrequency.value && nodeFrequency.value > 0 ? (openBlock(), createBlock(unref(script$8), { + 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$9), { + key: 3, + class: "text-sm font-light" + }, { + default: withCtx(() => [ + createTextVNode(toDisplayString(_ctx.nodeDef.nodeSource.displayText), 1) + ]), + _: 1 + })) : createCommentVNode("", true) + ]) + ]); + }; + } +}); +const NodeSearchItem = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-fd0a74bd"]]); +const _hoisted_1$e = { class: "comfy-vue-node-search-container flex justify-center items-center w-full min-w-96 pointer-events-auto" }; +const _hoisted_2$4 = { + key: 0, + class: "comfy-vue-node-preview-container absolute left-[-350px] top-[50px]" +}; +const _hoisted_3$3 = { class: "_dialog-body" }; +const _sfc_main$i = /* @__PURE__ */ defineComponent({ + __name: "NodeSearchBox", + props: { + filters: {}, + searchLimit: { default: 64 } + }, + emits: ["addFilter", "removeFilter", "addNode"], + setup(__props, { emit: __emit }) { + const settingStore = useSettingStore(); + const { t: t2 } = useI18n(); + const enableNodePreview = computed( + () => settingStore.get("Comfy.NodeSearchBoxImpl.NodePreview") + ); + const props = __props; + const nodeSearchFilterVisible = ref(false); + const inputId = `comfy-vue-node-search-box-input-${Math.random()}`; + const suggestions = ref([]); + const hoveredSuggestion = ref(null); + const currentQuery = ref(""); + const placeholder = computed(() => { + return props.filters.length === 0 ? t2("g.searchNodes") + "..." : ""; + }); + const nodeDefStore = useNodeDefStore(); + const nodeFrequencyStore = useNodeFrequencyStore(); + const search = /* @__PURE__ */ __name((query) => { + const queryIsEmpty = query === "" && props.filters.length === 0; + currentQuery.value = query; + suggestions.value = queryIsEmpty ? nodeFrequencyStore.topNodeDefs : [ + ...nodeDefStore.nodeSearchService.searchNode(query, props.filters, { + limit: props.searchLimit + }) + ]; + }, "search"); + const emit = __emit; + let inputElement = null; + const reFocusInput = /* @__PURE__ */ __name(() => { + inputElement ??= document.getElementById(inputId); + if (inputElement) { + inputElement.blur(); + nextTick(() => inputElement?.focus()); + } + }, "reFocusInput"); + onMounted(reFocusInput); + const onAddFilter = /* @__PURE__ */ __name((filterAndValue) => { + nodeSearchFilterVisible.value = false; + emit("addFilter", filterAndValue); + }, "onAddFilter"); + const onRemoveFilter = /* @__PURE__ */ __name((event, filterAndValue) => { + event.stopPropagation(); + event.preventDefault(); + emit("removeFilter", filterAndValue); + reFocusInput(); + }, "onRemoveFilter"); + const setHoverSuggestion = /* @__PURE__ */ __name((index) => { + if (index === -1) { + hoveredSuggestion.value = null; + return; + } + const value = suggestions.value[index]; + hoveredSuggestion.value = value; + }, "setHoverSuggestion"); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", _hoisted_1$e, [ + enableNodePreview.value ? (openBlock(), createElementBlock("div", _hoisted_2$4, [ + hoveredSuggestion.value ? (openBlock(), createBlock(NodePreview, { + nodeDef: hoveredSuggestion.value, + key: hoveredSuggestion.value?.name || "" + }, null, 8, ["nodeDef"])) : createCommentVNode("", true) + ])) : createCommentVNode("", true), + createVNode(unref(script), { + icon: "pi pi-filter", + severity: "secondary", + class: "filter-button z-10", + onClick: _cache[0] || (_cache[0] = ($event) => nodeSearchFilterVisible.value = true) + }), + createVNode(unref(script$a), { + visible: nodeSearchFilterVisible.value, + "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => nodeSearchFilterVisible.value = $event), + class: "min-w-96", + "dismissable-mask": "", + modal: "", + onHide: reFocusInput + }, { + header: withCtx(() => _cache[5] || (_cache[5] = [ + createBaseVNode("h3", null, "Add node filter condition", -1) + ])), + default: withCtx(() => [ + createBaseVNode("div", _hoisted_3$3, [ + createVNode(NodeSearchFilter, { onAddFilter }) + ]) + ]), + _: 1 + }, 8, ["visible"]), + createVNode(_sfc_main$k, { + "model-value": props.filters, + class: "comfy-vue-node-search-box z-10 flex-grow", + scrollHeight: "40vh", + placeholder: placeholder.value, + "input-id": inputId, + "append-to": "self", + suggestions: suggestions.value, + "min-length": 0, + delay: 100, + loading: !unref(nodeFrequencyStore).isLoaded, + onComplete: _cache[2] || (_cache[2] = ($event) => search($event.query)), + onOptionSelect: _cache[3] || (_cache[3] = ($event) => emit("addNode", $event.value)), + onFocusedOptionChanged: _cache[4] || (_cache[4] = ($event) => setHoverSuggestion($event)), + "complete-on-focus": "", + "auto-option-focus": "", + "force-selection": "", + multiple: "", + optionLabel: "display_name" + }, { + option: withCtx(({ option }) => [ + createVNode(NodeSearchItem, { + nodeDef: option, + currentQuery: currentQuery.value + }, null, 8, ["nodeDef", "currentQuery"]) + ]), + chip: withCtx(({ value }) => [ + Array.isArray(value) && value.length === 2 ? (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"])) : createCommentVNode("", true) + ]), + _: 1 + }, 8, ["model-value", "placeholder", "suggestions", "loading"]) + ]); + }; + } +}); +const _sfc_main$h = /* @__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 litegraphService.getCanvasCenter(); + } + const originalEvent = triggerEvent.value.detail.originalEvent; + return [originalEvent.canvasX, originalEvent.canvasY]; + }, "getNewNodeLocation"); + const nodeFilters = ref([]); + const addFilter = /* @__PURE__ */ __name((filter) => { + nodeFilters.value.push(filter); + }, "addFilter"); + const removeFilter = /* @__PURE__ */ __name((filter) => { + nodeFilters.value = nodeFilters.value.filter( + (f) => toRaw(f) !== toRaw(filter) + ); + }, "removeFilter"); + const clearFilters = /* @__PURE__ */ __name(() => { + nodeFilters.value = []; + }, "clearFilters"); + const closeDialog = /* @__PURE__ */ __name(() => { + visible.value = false; + }, "closeDialog"); + const addNode = /* @__PURE__ */ __name((nodeDef) => { + const node = litegraphService.addNodeOnGraph(nodeDef, { + pos: getNewNodeLocation() + }); + const eventDetail = triggerEvent.value?.detail; + if (eventDetail && eventDetail.subType === "empty-release") { + eventDetail.linkReleaseContext.links.forEach((link) => { + ConnectingLinkImpl.createFromPlainObject(link).connectTo(node); + }); + } + window.setTimeout(() => { + closeDialog(); + }, 100); + }, "addNode"); + const newSearchBoxEnabled = computed( + () => settingStore.get("Comfy.NodeSearchBoxImpl") === "default" + ); + const showSearchBox = /* @__PURE__ */ __name((e) => { + const detail = e.detail; + if (newSearchBoxEnabled.value) { + if (detail.originalEvent?.pointerType === "touch") { + setTimeout(() => { + showNewSearchBox(e); + }, 128); + } else { + showNewSearchBox(e); + } + } else { + canvasStore.canvas.showSearchBox(detail.originalEvent); + } + }, "showSearchBox"); + const nodeDefStore = useNodeDefStore(); + const showNewSearchBox = /* @__PURE__ */ __name((e) => { + if (e.detail.subType === "empty-release") { + const links = e.detail.linkReleaseContext.links; + if (links.length === 0) { + console.warn("Empty release with no links! This should never happen"); + return; + } + const firstLink = ConnectingLinkImpl.createFromPlainObject(links[0]); + const filter = nodeDefStore.nodeSearchService.getFilterById( + firstLink.releaseSlotType + ); + const dataType = firstLink.type.toString(); + addFilter([filter, dataType]); + } + visible.value = true; + triggerEvent.value = e; + dismissable.value = false; + setTimeout(() => { + dismissable.value = true; + }, 300); + }, "showNewSearchBox"); + const showContextMenu = /* @__PURE__ */ __name((e) => { + if (e.detail.subType !== "empty-release") { + return; + } + const links = e.detail.linkReleaseContext.links; + if (links.length === 0) { + console.warn("Empty release with no links! This should never happen"); + return; + } + const firstLink = ConnectingLinkImpl.createFromPlainObject(links[0]); + const mouseEvent = e.detail.originalEvent; + const commonOptions = { + e: mouseEvent, + allow_searchbox: true, + showSearchBox: /* @__PURE__ */ __name(() => showSearchBox(e), "showSearchBox") + }; + const connectionOptions = firstLink.output ? { + nodeFrom: firstLink.node, + slotFrom: firstLink.output, + afterRerouteId: firstLink.afterRerouteId + } : { + nodeTo: firstLink.node, + slotTo: firstLink.input, + afterRerouteId: firstLink.afterRerouteId + }; + canvasStore.canvas.showConnectionMenu({ + ...connectionOptions, + ...commonOptions + }); + }, "showContextMenu"); + const canvasStore = useCanvasStore(); + watchEffect(() => { + if (canvasStore.canvas) { + LiteGraph.release_link_on_empty_shows_menu = false; + canvasStore.canvas.allow_searchbox = false; + } + }); + const canvasEventHandler = /* @__PURE__ */ __name((e) => { + if (e.detail.subType === "empty-double-click") { + showSearchBox(e); + } else if (e.detail.subType === "empty-release") { + handleCanvasEmptyRelease(e); + } else if (e.detail.subType === "group-double-click") { + const group = e.detail.group; + const [x, y] = group.pos; + const relativeY = e.detail.originalEvent.canvasY - y; + if (relativeY > group.titleHeight) { + showSearchBox(e); + } + } + }, "canvasEventHandler"); + const linkReleaseAction = computed(() => { + return settingStore.get("Comfy.LinkRelease.Action"); + }); + const linkReleaseActionShift = computed(() => { + return settingStore.get("Comfy.LinkRelease.ActionShift"); + }); + const handleCanvasEmptyRelease = /* @__PURE__ */ __name((e) => { + const detail = e.detail; + const shiftPressed = detail.originalEvent.shiftKey; + const action = shiftPressed ? linkReleaseActionShift.value : linkReleaseAction.value; + switch (action) { + case LinkReleaseTriggerAction.SEARCH_BOX: + showSearchBox(e); + break; + case LinkReleaseTriggerAction.CONTEXT_MENU: + showContextMenu(e); + break; + case LinkReleaseTriggerAction.NO_ACTION: + default: + break; + } + }, "handleCanvasEmptyRelease"); + useEventListener(document, "litegraph:canvas", canvasEventHandler); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", null, [ + createVNode(unref(script$a), { + visible: unref(visible), + "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => isRef(visible) ? visible.value = $event : null), + modal: "", + "dismissable-mask": dismissable.value, + onHide: clearFilters, + pt: { + root: { + class: "invisible-dialog-root", + role: "search" + }, + mask: { class: "node-search-box-dialog-mask" }, + transition: { + enterFromClass: "opacity-0 scale-75", + // 100ms is the duration of the transition in the dialog component + enterActiveClass: "transition-all duration-100 ease-out", + leaveActiveClass: "transition-all duration-100 ease-in", + leaveToClass: "opacity-0 scale-75" + } + } + }, { + container: withCtx(() => [ + createVNode(_sfc_main$i, { + filters: nodeFilters.value, + onAddFilter: addFilter, + onRemoveFilter: removeFilter, + onAddNode: addNode + }, null, 8, ["filters"]) + ]), + _: 1 + }, 8, ["visible", "dismissable-mask"]) + ]); + }; + } +}); +const _sfc_main$g = /* @__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 shouldShowBadge = computed(() => !!overlayValue.value); + return (_ctx, _cache) => { + const _directive_tooltip = resolveDirective("tooltip"); + return withDirectives((openBlock(), createBlock(unref(script), { + 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$b), { + 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 }] + ]); + }; + } +}); +const SidebarIcon = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-6ab4daa6"]]); +const _sfc_main$f = /* @__PURE__ */ defineComponent({ + __name: "SidebarLogoutIcon", + setup(__props) { + const { t: t2 } = useI18n(); + const userStore = useUserStore(); + const tooltip = computed( + () => `${t2("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$e = /* @__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$d = /* @__PURE__ */ defineComponent({ + __name: "SidebarThemeToggleIcon", + setup(__props) { + const colorPaletteStore = useColorPaletteStore(); + const icon = computed( + () => colorPaletteStore.completedActivePalette.light_theme ? "pi pi-sun" : "pi pi-moon" + ); + 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 _hoisted_1$d = { class: "side-tool-bar-end" }; +const _hoisted_2$3 = { + key: 0, + class: "sidebar-content-container h-full overflow-y-auto overflow-x-hidden" +}; +const _sfc_main$c = /* @__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((item) => { + workspaceStore.sidebarTab.toggleSidebarTab(item.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", { "small-sidebar": isSmall.value }]) + }, [ + (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$d, [ + unref(userStore).isMultiUserServer ? (openBlock(), createBlock(_sfc_main$f, { key: 0 })) : createCommentVNode("", true), + createVNode(_sfc_main$d), + createVNode(_sfc_main$e) + ]) + ], 2) + ], 8, ["to"])), + selectedTab.value ? (openBlock(), createElementBlock("div", _hoisted_2$3, [ + createVNode(_sfc_main$q, { extension: selectedTab.value }, null, 8, ["extension"]) + ])) : createCommentVNode("", true) + ], 64); + }; + } +}); +const SideToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-33cac83a"]]); +const _hoisted_1$c = { class: "workflow-label text-sm max-w-[150px] truncate inline-block" }; +const _hoisted_2$2 = { class: "relative" }; +const _hoisted_3$2 = { + key: 0, + class: "status-indicator" +}; +const _sfc_main$b = /* @__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((option) => { + closeWorkflows([option]); + }, "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$c, [ + createTextVNode(toDisplayString(_ctx.workflowOption.workflow.filename), 1) + ])), [ + [ + _directive_tooltip, + _ctx.workflowOption.workflow.key, + void 0, + { bottom: true } + ] + ]), + createBaseVNode("div", _hoisted_2$2, [ + !unref(workspaceStore).shiftDown && (_ctx.workflowOption.workflow.isModified || !_ctx.workflowOption.workflow.isPersisted) ? (openBlock(), createElementBlock("span", _hoisted_3$2, "•")) : createCommentVNode("", true), + createVNode(unref(script), { + 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$b, [["__scopeId", "data-v-8d011a31"]]); +const _hoisted_1$b = { class: "workflow-tabs-container flex flex-row max-w-full h-full" }; +const _sfc_main$a = /* @__PURE__ */ defineComponent({ + __name: "WorkflowTabs", + props: { + class: {} + }, + setup(__props) { + const props = __props; + const { t: t2 } = useI18n(); + const workspaceStore = useWorkspaceStore(); + const workflowStore = useWorkflowStore(); + const workflowService = useWorkflowService(); + const workflowBookmarkStore = useWorkflowBookmarkStore(); + 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((option) => { + if (!option) { + return; + } + if (selectedWorkflow.value?.value === option.value) { + return; + } + workflowService.openWorkflow(option.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((option) => { + closeWorkflows([option]); + }, "onCloseWorkflow"); + const showContextMenu = /* @__PURE__ */ __name((event, option) => { + rightClickedTab.value = option; + 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: t2("tabMenu.duplicateTab"), + command: /* @__PURE__ */ __name(() => { + workflowService.duplicateWorkflow(tab.workflow); + }, "command") + }, + { + separator: true + }, + { + label: t2("tabMenu.closeTab"), + command: /* @__PURE__ */ __name(() => onCloseWorkflow(tab), "command") + }, + { + label: t2("tabMenu.closeTabsToLeft"), + command: /* @__PURE__ */ __name(() => closeWorkflows(options.value.slice(0, index)), "command"), + disabled: index <= 0 + }, + { + label: t2("tabMenu.closeTabsToRight"), + command: /* @__PURE__ */ __name(() => closeWorkflows(options.value.slice(index + 1)), "command"), + disabled: index === options.value.length - 1 + }, + { + label: t2("tabMenu.closeOtherTabs"), + command: /* @__PURE__ */ __name(() => closeWorkflows([ + ...options.value.slice(index + 1), + ...options.value.slice(0, index) + ]), "command"), + disabled: options.value.length <= 1 + }, + { + label: workflowBookmarkStore.isBookmarked(tab.workflow.path) ? t2("tabMenu.removeFromBookmarks") : t2("tabMenu.addToBookmarks"), + command: /* @__PURE__ */ __name(() => workflowBookmarkStore.toggleBookmarked(tab.workflow.path), "command"), + disabled: tab.workflow.isTemporary + } + ]; + }); + const commandStore = useCommandStore(); + const handleWheel = /* @__PURE__ */ __name((event) => { + const scrollElement = event.currentTarget; + const scrollAmount = event.deltaX || event.deltaY; + scrollElement.scroll({ + left: scrollElement.scrollLeft + scrollAmount + }); + }, "handleWheel"); + return (_ctx, _cache) => { + const _directive_tooltip = resolveDirective("tooltip"); + return openBlock(), createElementBlock("div", _hoisted_1$b, [ + createVNode(unref(script$d), { + class: "overflow-hidden no-drag", + "pt:content": { + class: "p-0 w-full", + onwheel: handleWheel + }, + "pt:barX": "h-1" + }, { + default: withCtx(() => [ + createVNode(unref(script$c), { + class: normalizeClass(["workflow-tabs bg-transparent", props.class]), + modelValue: selectedWorkflow.value, + "onUpdate:modelValue": onWorkflowChange, + options: options.value, + optionLabel: "label", + dataKey: "value" + }, { + option: withCtx(({ option }) => [ + createVNode(WorkflowTab, { + onContextmenu: /* @__PURE__ */ __name(($event) => showContextMenu($event, option), "onContextmenu"), + onMouseup: withModifiers(($event) => onCloseWorkflow(option), ["middle"]), + "workflow-option": option + }, null, 8, ["onContextmenu", "onMouseup", "workflow-option"]) + ]), + _: 1 + }, 8, ["class", "modelValue", "options"]) + ]), + _: 1 + }, 8, ["pt:content"]), + withDirectives(createVNode(unref(script), { + class: "new-blank-workflow-button flex-shrink-0 no-drag", + icon: "pi pi-plus", + text: "", + severity: "secondary", + "aria-label": _ctx.$t("sideToolbar.newBlankWorkflow"), + onClick: _cache[0] || (_cache[0] = () => unref(commandStore).execute("Comfy.NewBlankWorkflow")) + }, null, 8, ["aria-label"]), [ + [_directive_tooltip, { value: _ctx.$t("sideToolbar.newBlankWorkflow"), showDelay: 300 }] + ]), + createVNode(unref(script$e), { + ref_key: "menu", + ref: menu, + model: contextMenuItems.value + }, null, 8, ["model"]) + ]); + }; + } +}); +const WorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-54fadc45"]]); +const _hoisted_1$a = { class: "absolute top-0 left-0 w-auto max-w-full pointer-events-auto" }; +const _sfc_main$9 = /* @__PURE__ */ defineComponent({ + __name: "SecondRowWorkflowTabs", + setup(__props) { + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", _hoisted_1$a, [ + createVNode(WorkflowTabs) + ]); + }; + } +}); +const SecondRowWorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-38831d8e"]]); +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"], + // Default to small if the window is less than 1536px(2xl) wide. + defaultValue: /* @__PURE__ */ __name(() => window.innerWidth < 1536 ? "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: true, + 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: true, + versionModified: "1.7.12" + }, + { + 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.None + }, + { + 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", "Topbar (2nd-row)"], + // Default to topbar (2nd-row) if the window is less than 1536px(2xl) wide. + defaultValue: /* @__PURE__ */ __name(() => window.innerWidth < 1536 ? "Topbar (2nd-row)" : "Topbar", "defaultValue") + }, + { + 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", + versionModified: "1.7.3", + migrateDeprecatedValue: /* @__PURE__ */ __name((value) => { + return value.map((keybinding) => { + if (keybinding["targetSelector"] === "#graph-canvas") { + keybinding["targetElementId"] = "graph-canvas"; + } + return keybinding; + }); + }, "migrateDeprecatedValue") + }, + { + 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" + }, + { + id: "Comfy.TutorialCompleted", + name: "Tutorial completed", + type: "hidden", + defaultValue: false, + versionAdded: "1.8.7" + }, + { + id: "LiteGraph.ContextMenu.Scaling", + name: "Scale node combo widget menus (lists) when zoomed in", + defaultValue: false, + type: "boolean", + versionAdded: "1.8.8" + } +]; +const useCanvasDrop = /* @__PURE__ */ __name((canvasRef) => { + const modelToNodeStore = useModelToNodeStore(); + const litegraphService = useLitegraphService(); + usePragmaticDroppable(() => canvasRef.value, { + getDropEffect: /* @__PURE__ */ __name((args) => args.source.data.type === "tree-explorer-node" ? "copy" : "move", "getDropEffect"), + onDrop: /* @__PURE__ */ __name((event) => { + const loc = event.location.current.input; + const dndData = event.source.data; + if (dndData.type === "tree-explorer-node") { + const node = dndData.data; + if (node.data instanceof ComfyNodeDefImpl) { + const nodeDef = node.data; + const pos = app.clientPosToCanvasPos([ + loc.clientX, + loc.clientY + LiteGraph.NODE_TITLE_HEIGHT + ]); + litegraphService.addNodeOnGraph(nodeDef, { pos }); + } else if (node.data instanceof ComfyModelDef) { + const model = node.data; + const pos = app.clientPosToCanvasPos([loc.clientX, loc.clientY]); + const nodeAtPos = app.graph.getNodeOnPos(pos[0], pos[1]); + let targetProvider = null; + let targetGraphNode = null; + if (nodeAtPos) { + const providers = modelToNodeStore.getAllNodeProviders( + model.directory + ); + for (const provider of providers) { + if (provider.nodeDef.name === nodeAtPos.comfyClass) { + targetGraphNode = nodeAtPos; + targetProvider = provider; + } + } + } + if (!targetGraphNode) { + const provider = modelToNodeStore.getNodeProvider(model.directory); + if (provider) { + targetGraphNode = litegraphService.addNodeOnGraph( + provider.nodeDef, + { + pos + } + ); + targetProvider = provider; + } + } + if (targetGraphNode) { + const widget = targetGraphNode.widgets?.find( + (widget2) => widget2.name === targetProvider?.key + ); + if (widget) { + widget.value = model.file_name; + } + } + } + } + }, "onDrop") + }); +}, "useCanvasDrop"); +const useGlobalLitegraph = /* @__PURE__ */ __name(() => { + window["LiteGraph"] = LiteGraph; + window["LGraph"] = LGraph; + window["LLink"] = LLink; + window["LGraphNode"] = LGraphNode; + window["LGraphGroup"] = LGraphGroup; + window["DragAndScale"] = DragAndScale; + window["LGraphCanvas"] = LGraphCanvas; + window["ContextMenu"] = ContextMenu; + window["LGraphBadge"] = LGraphBadge; +}, "useGlobalLitegraph"); +function useWorkflowPersistence() { + const workflowStore = useWorkflowStore(); + const settingStore = useSettingStore(); + const persistCurrentWorkflow = /* @__PURE__ */ __name(() => { + const workflow = JSON.stringify(app.serializeGraph()); + localStorage.setItem("workflow", workflow); + if (api.clientId) { + sessionStorage.setItem(`workflow:${api.clientId}`, workflow); + } + }, "persistCurrentWorkflow"); + const loadWorkflowFromStorage = /* @__PURE__ */ __name(async (json, workflowName) => { + if (!json) return false; + const workflow = JSON.parse(json); + await app.loadGraphData(workflow, true, true, workflowName); + return true; + }, "loadWorkflowFromStorage"); + const loadPreviousWorkflowFromStorage = /* @__PURE__ */ __name(async () => { + const workflowName = getStorageValue("Comfy.PreviousWorkflow"); + const clientId = api.initialClientId ?? api.clientId; + if (clientId) { + const sessionWorkflow = sessionStorage.getItem(`workflow:${clientId}`); + if (await loadWorkflowFromStorage(sessionWorkflow, workflowName)) { + return true; + } + } + const localWorkflow = localStorage.getItem("workflow"); + return await loadWorkflowFromStorage(localWorkflow, workflowName); + }, "loadPreviousWorkflowFromStorage"); + const loadDefaultWorkflow = /* @__PURE__ */ __name(async () => { + if (!settingStore.get("Comfy.TutorialCompleted")) { + await settingStore.set("Comfy.TutorialCompleted", true); + await useModelStore().loadModelFolders(); + await useWorkflowService().loadTutorialWorkflow(); + } else { + await app.loadGraphData(); + } + }, "loadDefaultWorkflow"); + const restorePreviousWorkflow = /* @__PURE__ */ __name(async () => { + try { + const restored = await loadPreviousWorkflowFromStorage(); + if (!restored) { + await loadDefaultWorkflow(); + } + } catch (err) { + console.error("Error loading previous workflow", err); + await loadDefaultWorkflow(); + } + }, "restorePreviousWorkflow"); + watchEffect(() => { + if (workflowStore.activeWorkflow) { + const workflow = workflowStore.activeWorkflow; + setStorageValue("Comfy.PreviousWorkflow", workflow.key); + persistCurrentWorkflow(); + } + }); + api.addEventListener("graphChanged", persistCurrentWorkflow); + const openWorkflows = computed(() => workflowStore.openWorkflows); + const activeWorkflow = computed(() => workflowStore.activeWorkflow); + const restoreState = computed( + () => { + if (!openWorkflows.value || !activeWorkflow.value) { + return { paths: [], activeIndex: -1 }; + } + const paths = openWorkflows.value.filter((workflow) => workflow?.isPersisted && !workflow.isModified).map((workflow) => workflow.path); + const activeIndex = openWorkflows.value.findIndex( + (workflow) => workflow.path === activeWorkflow.value?.path + ); + return { paths, activeIndex }; + } + ); + const storedWorkflows = JSON.parse( + getStorageValue("Comfy.OpenWorkflowsPaths") || "[]" + ); + const storedActiveIndex = JSON.parse( + getStorageValue("Comfy.ActiveWorkflowIndex") || "-1" + ); + watch(restoreState, ({ paths, activeIndex }) => { + setStorageValue("Comfy.OpenWorkflowsPaths", JSON.stringify(paths)); + setStorageValue("Comfy.ActiveWorkflowIndex", JSON.stringify(activeIndex)); + }); + const restoreWorkflowTabsState = /* @__PURE__ */ __name(() => { + const isRestorable = storedWorkflows?.length > 0 && storedActiveIndex >= 0; + if (isRestorable) { + workflowStore.openWorkflowsInBackground({ + left: storedWorkflows.slice(0, storedActiveIndex), + right: storedWorkflows.slice(storedActiveIndex) + }); + } + }, "restoreWorkflowTabsState"); + return { + restorePreviousWorkflow, + restoreWorkflowTabsState + }; +} +__name(useWorkflowPersistence, "useWorkflowPersistence"); +const _sfc_main$8 = /* @__PURE__ */ defineComponent({ + __name: "GraphCanvas", + emits: ["ready"], + setup(__props, { emit: __emit }) { + const emit = __emit; + const canvasRef = ref(null); + const settingStore = useSettingStore(); + const nodeDefStore = useNodeDefStore(); + const workspaceStore = useWorkspaceStore(); + const canvasStore = useCanvasStore(); + const betaMenuEnabled = computed( + () => settingStore.get("Comfy.UseNewMenu") !== "Disabled" + ); + const workflowTabsPosition = computed( + () => settingStore.get("Comfy.Workflow.WorkflowTabsPosition") + ); + const canvasMenuEnabled = computed( + () => settingStore.get("Comfy.Graph.CanvasMenu") + ); + const tooltipEnabled = computed(() => settingStore.get("Comfy.EnableTooltips")); + watchEffect(() => { + const canvasInfoEnabled = settingStore.get("Comfy.Graph.CanvasInfo"); + if (canvasStore.canvas) { + canvasStore.canvas.show_info = canvasInfoEnabled; + } + }); + watchEffect(() => { + const zoomSpeed = settingStore.get("Comfy.Graph.ZoomSpeed"); + if (canvasStore.canvas) { + canvasStore.canvas.zoom_speed = zoomSpeed; + } + }); + watchEffect(() => { + LiteGraph.snaps_for_comfy = settingStore.get("Comfy.Node.AutoSnapLinkToSlot"); + }); + watchEffect(() => { + LiteGraph.snap_highlights_node = settingStore.get( + "Comfy.Node.SnapHighlightsNode" + ); + }); + watchEffect(() => { + LGraphNode.keepAllLinksOnBypass = settingStore.get( + "Comfy.Node.BypassAllLinksOnDelete" + ); + }); + watchEffect(() => { + LiteGraph.middle_click_slot_add_default_node = settingStore.get( + "Comfy.Node.MiddleClickRerouteNode" + ); + }); + watchEffect(() => { + nodeDefStore.showDeprecated = settingStore.get("Comfy.Node.ShowDeprecated"); + }); + watchEffect(() => { + nodeDefStore.showExperimental = settingStore.get( + "Comfy.Node.ShowExperimental" + ); + }); + watchEffect(() => { + const spellcheckEnabled = settingStore.get("Comfy.TextareaWidget.Spellcheck"); + const textareas = document.querySelectorAll("textarea.comfy-multiline-input"); + textareas.forEach((textarea) => { + textarea.spellcheck = spellcheckEnabled; + textarea.focus(); + textarea.blur(); + }); + }); + watchEffect(() => { + const linkRenderMode = settingStore.get("Comfy.LinkRenderMode"); + if (canvasStore.canvas) { + canvasStore.canvas.links_render_mode = linkRenderMode; + canvasStore.canvas.setDirty( + /* fg */ + false, + /* bg */ + true + ); + } + }); + watchEffect(() => { + const linkMarkerShape = settingStore.get("Comfy.Graph.LinkMarkers"); + const { canvas } = canvasStore; + if (canvas) { + canvas.linkMarkerShape = linkMarkerShape; + canvas.setDirty(false, true); + } + }); + watchEffect(() => { + const reroutesEnabled = settingStore.get("Comfy.RerouteBeta"); + const { canvas } = canvasStore; + if (canvas) { + canvas.reroutesEnabled = reroutesEnabled; + canvas.setDirty(false, true); + } + }); + watchEffect(() => { + const maximumFps = settingStore.get("LiteGraph.Canvas.MaximumFps"); + const { canvas } = canvasStore; + if (canvas) canvas.maximumFps = maximumFps; + }); + watchEffect(() => { + CanvasPointer.doubleClickTime = settingStore.get( + "Comfy.Pointer.DoubleClickTime" + ); + }); + watchEffect(() => { + CanvasPointer.bufferTime = settingStore.get("Comfy.Pointer.ClickBufferTime"); + }); + watchEffect(() => { + CanvasPointer.maxClickDrift = settingStore.get("Comfy.Pointer.ClickDrift"); + }); + watchEffect(() => { + LiteGraph.CANVAS_GRID_SIZE = settingStore.get("Comfy.SnapToGrid.GridSize"); + }); + watchEffect(() => { + LiteGraph.alwaysSnapToGrid = settingStore.get("pysssss.SnapToGrid"); + }); + 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); + } + ); + const colorPaletteService = useColorPaletteService(); + const colorPaletteStore = useColorPaletteStore(); + watch( + [() => canvasStore.canvas, () => settingStore.get("Comfy.ColorPalette")], + ([canvas, currentPaletteId]) => { + if (!canvas) return; + colorPaletteService.loadColorPalette(currentPaletteId); + } + ); + watch( + () => colorPaletteStore.activePaletteId, + (newValue) => { + settingStore.set("Comfy.ColorPalette", newValue); + } + ); + watchEffect(() => { + LiteGraph.context_menu_scaling = settingStore.get( + "LiteGraph.ContextMenu.Scaling" + ); + }); + const loadCustomNodesI18n = /* @__PURE__ */ __name(async () => { + try { + const i18nData = await api.getCustomNodesI18n(); + Object.entries(i18nData).forEach(([locale, message]) => { + i18n.global.mergeLocaleMessage(locale, message); + }); + } catch (error) { + console.error("Failed to load custom nodes i18n", error); + } + }, "loadCustomNodesI18n"); + const comfyAppReady = ref(false); + const workflowPersistence = useWorkflowPersistence(); + useCanvasDrop(canvasRef); + onMounted(async () => { + useGlobalLitegraph(); + app.vueAppReady = true; + workspaceStore.spinner = true; + ChangeTracker.init(app); + await loadCustomNodesI18n(); + 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; + workspaceStore.spinner = false; + window["app"] = app; + window["graph"] = app.graph; + comfyAppReady.value = true; + colorPaletteStore.customPalettes = settingStore.get( + "Comfy.CustomColorPalettes" + ); + await workflowPersistence.restorePreviousWorkflow(); + workflowPersistence.restoreWorkflowTabsState(); + watch( + () => settingStore.get("Comfy.Locale"), + async () => { + await useCommandStore().execute("Comfy.RefreshNodeDefinitions"); + useWorkflowService().reloadCurrentWorkflow(); + } + ); + emit("ready"); + }); + return (_ctx, _cache) => { + return openBlock(), createElementBlock(Fragment, null, [ + (openBlock(), createBlock(Teleport, { to: ".graph-canvas-container" }, [ + comfyAppReady.value && betaMenuEnabled.value && !unref(workspaceStore).focusMode ? (openBlock(), createBlock(LiteGraphCanvasSplitterOverlay, { key: 0 }, { + "side-bar-panel": withCtx(() => [ + createVNode(SideToolbar) + ]), + "bottom-panel": withCtx(() => [ + createVNode(_sfc_main$p) + ]), + "graph-canvas-panel": withCtx(() => [ + workflowTabsPosition.value === "Topbar (2nd-row)" ? (openBlock(), createBlock(SecondRowWorkflowTabs, { key: 0 })) : createCommentVNode("", true), + canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { key: 1 })) : createCommentVNode("", true) + ]), + _: 1 + })) : createCommentVNode("", true), + createVNode(TitleEditor), + !betaMenuEnabled.value && canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { key: 1 })) : createCommentVNode("", true), + createBaseVNode("canvas", { + ref_key: "canvasRef", + ref: canvasRef, + id: "graph-canvas", + tabindex: "1" + }, null, 512) + ])), + createVNode(_sfc_main$h), + tooltipEnabled.value ? (openBlock(), createBlock(NodeTooltip, { key: 0 })) : createCommentVNode("", true), + createVNode(_sfc_main$n) + ], 64); + }; + } +}); +const _sfc_main$7 = /* @__PURE__ */ defineComponent({ + __name: "GlobalToast", + setup(__props) { + const toast = useToast(); + const toastStore = useToastStore(); + const settingStore = useSettingStore(); + watch( + () => toastStore.messagesToAdd, + (newMessages) => { + if (newMessages.length === 0) { + return; + } + newMessages.forEach((message) => { + toast.add(message); + }); + toastStore.messagesToAdd = []; + }, + { deep: true } + ); + watch( + () => toastStore.messagesToRemove, + (messagesToRemove) => { + if (messagesToRemove.length === 0) { + return; + } + messagesToRemove.forEach((message) => { + toast.remove(message); + }); + toastStore.messagesToRemove = []; + }, + { deep: true } + ); + watch( + () => toastStore.removeAllRequested, + (requested) => { + if (requested) { + toast.removeAllGroups(); + toastStore.removeAllRequested = false; + } + } + ); + function updateToastPosition() { + const styleElement = document.getElementById("dynamic-toast-style") || createStyleElement(); + const rect = document.querySelector(".graph-canvas-container").getBoundingClientRect(); + styleElement.textContent = ` + .p-toast.p-component.p-toast-top-right { + top: ${rect.top + 20}px !important; + right: ${window.innerWidth - (rect.left + rect.width) + 20}px !important; + } + `; + } + __name(updateToastPosition, "updateToastPosition"); + function createStyleElement() { + const style = document.createElement("style"); + style.id = "dynamic-toast-style"; + document.head.appendChild(style); + return style; + } + __name(createStyleElement, "createStyleElement"); + watch( + () => settingStore.get("Comfy.UseNewMenu"), + () => nextTick(updateToastPosition), + { immediate: true } + ); + watch( + () => settingStore.get("Comfy.Sidebar.Location"), + () => nextTick(updateToastPosition), + { immediate: true } + ); + return (_ctx, _cache) => { + return openBlock(), createBlock(unref(script$f)); + }; + } +}); +const _hoisted_1$9 = { + viewBox: "0 0 24 24", + width: "1.2em", + height: "1.2em" +}; +function render$5(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$9, _cache[0] || (_cache[0] = [ + createBaseVNode("path", { + fill: "none", + stroke: "currentColor", + "stroke-linecap": "round", + "stroke-linejoin": "round", + "stroke-width": "2", + d: "M6 4v16m4-16l10 8l-10 8z" + }, null, -1) + ])); +} +__name(render$5, "render$5"); +const __unplugin_components_3 = markRaw({ name: "lucide-step-forward", render: render$5 }); +const _hoisted_1$8 = { + viewBox: "0 0 24 24", + width: "1.2em", + height: "1.2em" +}; +function render$4(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$8, _cache[0] || (_cache[0] = [ + createBaseVNode("path", { + fill: "none", + stroke: "currentColor", + "stroke-linecap": "round", + "stroke-linejoin": "round", + "stroke-width": "2", + d: "m13 19l9-7l-9-7zM2 19l9-7l-9-7z" + }, null, -1) + ])); +} +__name(render$4, "render$4"); +const __unplugin_components_2 = markRaw({ name: "lucide-fast-forward", render: render$4 }); +const _hoisted_1$7 = { + viewBox: "0 0 24 24", + width: "1.2em", + height: "1.2em" +}; +function render$3(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$7, _cache[0] || (_cache[0] = [ + createBaseVNode("path", { + fill: "none", + stroke: "currentColor", + "stroke-linecap": "round", + "stroke-linejoin": "round", + "stroke-width": "2", + d: "m6 3l14 9l-14 9z" + }, null, -1) + ])); +} +__name(render$3, "render$3"); +const __unplugin_components_1$1 = markRaw({ name: "lucide-play", render: render$3 }); +const _hoisted_1$6 = { + viewBox: "0 0 24 24", + width: "1.2em", + height: "1.2em" +}; +function render$2(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$6, _cache[0] || (_cache[0] = [ + createBaseVNode("g", { + fill: "none", + stroke: "currentColor", + "stroke-linecap": "round", + "stroke-linejoin": "round", + "stroke-width": "2" + }, [ + createBaseVNode("path", { d: "M16 12H3m13 6H3m7-12H3m18 12V8a2 2 0 0 0-2-2h-5" }), + createBaseVNode("path", { d: "m16 8l-2-2l2-2" }) + ], -1) + ])); +} +__name(render$2, "render$2"); +const __unplugin_components_0$1 = markRaw({ name: "lucide-list-start", render: render$2 }); +const _hoisted_1$5 = ["aria-label"]; +const minQueueCount = 1; +const _sfc_main$6 = /* @__PURE__ */ defineComponent({ + __name: "BatchCountEdit", + props: { + class: { default: "" } + }, + setup(__props) { + const props = __props; + const queueSettingsStore = useQueueSettingsStore(); + const { batchCount } = storeToRefs(queueSettingsStore); + const settingStore = useSettingStore(); + const maxQueueCount = computed( + () => settingStore.get("Comfy.QueueButton.BatchCountLimit") + ); + const handleClick = /* @__PURE__ */ __name((increment) => { + let newCount; + if (increment) { + const originalCount = batchCount.value - 1; + newCount = Math.min(originalCount * 2, maxQueueCount.value); + } else { + const originalCount = batchCount.value + 1; + newCount = Math.floor(originalCount / 2); + } + batchCount.value = newCount; + }, "handleClick"); + return (_ctx, _cache) => { + const _directive_tooltip = resolveDirective("tooltip"); + return withDirectives((openBlock(), createElementBlock("div", { + class: normalizeClass(["batch-count", props.class]), + "aria-label": _ctx.$t("menu.batchCount") + }, [ + createVNode(unref(script$g), { + class: "w-14", + modelValue: unref(batchCount), + "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(batchCount) ? batchCount.value = $event : null), + min: minQueueCount, + max: maxQueueCount.value, + fluid: "", + showButtons: "", + pt: { + incrementButton: { + class: "w-6", + onmousedown: /* @__PURE__ */ __name(() => { + handleClick(true); + }, "onmousedown") + }, + decrementButton: { + class: "w-6", + onmousedown: /* @__PURE__ */ __name(() => { + handleClick(false); + }, "onmousedown") + } + } + }, null, 8, ["modelValue", "max", "pt"]) + ], 10, _hoisted_1$5)), [ + [ + _directive_tooltip, + _ctx.$t("menu.batchCount"), + void 0, + { bottom: true } + ] + ]); + }; + } +}); +const BatchCountEdit = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-26957f1f"]]); +const _hoisted_1$4 = { class: "queue-button-group flex" }; +const _sfc_main$5 = /* @__PURE__ */ defineComponent({ + __name: "ComfyQueueButton", + setup(__props) { + const workspaceStore = useWorkspaceStore(); + const queueCountStore = storeToRefs(useQueuePendingTaskCountStore()); + const { mode: queueMode } = storeToRefs(useQueueSettingsStore()); + const { t: t2 } = useI18n(); + const queueModeMenuItemLookup = computed(() => ({ + disabled: { + key: "disabled", + label: t2("menu.queue"), + tooltip: t2("menu.disabledTooltip"), + command: /* @__PURE__ */ __name(() => { + queueMode.value = "disabled"; + }, "command") + }, + instant: { + key: "instant", + label: `${t2("menu.queue")} (${t2("menu.instant")})`, + tooltip: t2("menu.instantTooltip"), + command: /* @__PURE__ */ __name(() => { + queueMode.value = "instant"; + }, "command") + }, + change: { + key: "change", + label: `${t2("menu.queue")} (${t2("menu.onChange")})`, + tooltip: t2("menu.onChangeTooltip"), + command: /* @__PURE__ */ __name(() => { + queueMode.value = "change"; + }, "command") + } + })); + const activeQueueModeMenuItem = computed( + () => queueModeMenuItemLookup.value[queueMode.value] + ); + const queueModeMenuItems = computed( + () => Object.values(queueModeMenuItemLookup.value) + ); + const executingPrompt = computed(() => !!queueCountStore.count.value); + const hasPendingTasks = computed(() => queueCountStore.count.value > 1); + const commandStore = useCommandStore(); + const queuePrompt = /* @__PURE__ */ __name((e) => { + const commandId = e.shiftKey ? "Comfy.QueuePromptFront" : "Comfy.QueuePrompt"; + commandStore.execute(commandId); + }, "queuePrompt"); + return (_ctx, _cache) => { + const _component_i_lucide58list_start = __unplugin_components_0$1; + const _component_i_lucide58play = __unplugin_components_1$1; + 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$4, [ + withDirectives((openBlock(), createBlock(unref(script$h), { + class: "comfyui-queue-button", + label: activeQueueModeMenuItem.value.label, + severity: "primary", + size: "small", + onClick: queuePrompt, + model: queueModeMenuItems.value, + "data-testid": "queue-button" + }, { + icon: withCtx(() => [ + 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 }) => [ + withDirectives(createVNode(unref(script), { + label: String(item.label), + icon: item.icon, + severity: item.key === unref(queueMode) ? "primary" : "secondary", + size: "small", + text: "" + }, null, 8, ["label", "icon", "severity"]), [ + [_directive_tooltip, item.tooltip] + ]) + ]), + _: 1 + }, 8, ["label", "model"])), [ + [ + _directive_tooltip, + unref(workspaceStore).shiftDown ? _ctx.$t("menu.queueWorkflowFront") : _ctx.$t("menu.queueWorkflow"), + void 0, + { bottom: true } + ] + ]), + createVNode(BatchCountEdit), + createVNode(unref(script$6), { class: "execution-actions flex flex-nowrap" }, { + default: withCtx(() => [ + withDirectives(createVNode(unref(script), { + icon: "pi pi-times", + severity: executingPrompt.value ? "danger" : "secondary", + disabled: !executingPrompt.value, + text: "", + "aria-label": _ctx.$t("menu.interrupt"), + onClick: _cache[0] || (_cache[0] = () => unref(commandStore).execute("Comfy.Interrupt")) + }, null, 8, ["severity", "disabled", "aria-label"]), [ + [ + _directive_tooltip, + _ctx.$t("menu.interrupt"), + void 0, + { bottom: true } + ] + ]), + withDirectives(createVNode(unref(script), { + icon: "pi pi-stop", + severity: hasPendingTasks.value ? "danger" : "secondary", + disabled: !hasPendingTasks.value, + text: "", + "aria-label": _ctx.$t("sideToolbar.queueTab.clearPendingTasks"), + onClick: _cache[1] || (_cache[1] = () => unref(commandStore).execute("Comfy.ClearPendingTasks")) + }, null, 8, ["severity", "disabled", "aria-label"]), [ + [ + _directive_tooltip, + _ctx.$t("sideToolbar.queueTab.clearPendingTasks"), + void 0, + { bottom: true } + ] + ]) + ]), + _: 1 + }) + ]); + }; + } +}); +const ComfyQueueButton = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-91a628af"]]); +const overlapThreshold = 20; +const _sfc_main$4 = /* @__PURE__ */ defineComponent({ + __name: "ComfyActionbar", + setup(__props) { + const settingsStore = useSettingStore(); + const visible = computed( + () => settingsStore.get("Comfy.UseNewMenu") !== "Disabled" + ); + const panelRef = ref(null); + const dragHandleRef = ref(null); + const isDocked = useLocalStorage("Comfy.MenuPosition.Docked", false); + const storedPosition = useLocalStorage("Comfy.MenuPosition.Floating", { + x: 0, + y: 0 + }); + const { + x, + y, + style, + isDragging + } = useDraggable(panelRef, { + initialValue: { x: 0, y: 0 }, + handle: dragHandleRef, + containerElement: document.body + }); + watchDebounced( + [x, y], + ([newX, newY]) => { + storedPosition.value = { x: newX, y: newY }; + }, + { debounce: 300 } + ); + const setInitialPosition = /* @__PURE__ */ __name(() => { + if (x.value !== 0 || y.value !== 0) { + return; + } + if (storedPosition.value.x !== 0 || storedPosition.value.y !== 0) { + x.value = storedPosition.value.x; + y.value = storedPosition.value.y; + captureLastDragState(); + return; + } + if (panelRef.value) { + const screenWidth = window.innerWidth; + const screenHeight = window.innerHeight; + const menuWidth = panelRef.value.offsetWidth; + const menuHeight = panelRef.value.offsetHeight; + if (menuWidth === 0 || menuHeight === 0) { + return; + } + x.value = (screenWidth - menuWidth) / 2; + y.value = screenHeight - menuHeight - 10; + captureLastDragState(); + } + }, "setInitialPosition"); + onMounted(setInitialPosition); + watch(visible, (newVisible) => { + if (newVisible) { + nextTick(setInitialPosition); + } + }); + const lastDragState = ref({ + x: x.value, + y: y.value, + windowWidth: window.innerWidth, + windowHeight: window.innerHeight + }); + const captureLastDragState = /* @__PURE__ */ __name(() => { + lastDragState.value = { + x: x.value, + y: y.value, + windowWidth: window.innerWidth, + windowHeight: window.innerHeight + }; + }, "captureLastDragState"); + watch( + isDragging, + (newIsDragging) => { + if (!newIsDragging) { + captureLastDragState(); + } + }, + { immediate: true } + ); + const adjustMenuPosition = /* @__PURE__ */ __name(() => { + if (panelRef.value) { + const screenWidth = window.innerWidth; + const screenHeight = window.innerHeight; + const menuWidth = panelRef.value.offsetWidth; + const menuHeight = panelRef.value.offsetHeight; + const distanceLeft = lastDragState.value.x; + const distanceRight = lastDragState.value.windowWidth - (lastDragState.value.x + menuWidth); + const distanceTop = lastDragState.value.y; + const distanceBottom = lastDragState.value.windowHeight - (lastDragState.value.y + menuHeight); + const distances = [ + { edge: "left", distance: distanceLeft }, + { edge: "right", distance: distanceRight }, + { edge: "top", distance: distanceTop }, + { edge: "bottom", distance: distanceBottom } + ]; + const closestEdge = distances.reduce( + (min, curr) => curr.distance < min.distance ? curr : min + ); + const verticalRatio = lastDragState.value.y / lastDragState.value.windowHeight; + const horizontalRatio = lastDragState.value.x / lastDragState.value.windowWidth; + if (closestEdge.edge === "left") { + x.value = closestEdge.distance; + y.value = verticalRatio * screenHeight; + } else if (closestEdge.edge === "right") { + x.value = screenWidth - menuWidth - closestEdge.distance; + y.value = verticalRatio * screenHeight; + } else if (closestEdge.edge === "top") { + x.value = horizontalRatio * screenWidth; + y.value = closestEdge.distance; + } else { + x.value = horizontalRatio * screenWidth; + y.value = screenHeight - menuHeight - closestEdge.distance; + } + x.value = lodashExports.clamp(x.value, 0, screenWidth - menuWidth); + y.value = lodashExports.clamp(y.value, 0, screenHeight - menuHeight); + } + }, "adjustMenuPosition"); + useEventListener(window, "resize", adjustMenuPosition); + const topMenuRef = inject("topMenuRef"); + const topMenuBounds = useElementBounding(topMenuRef); + const isOverlappingWithTopMenu = computed(() => { + if (!panelRef.value) { + return false; + } + const { height } = panelRef.value.getBoundingClientRect(); + const actionbarBottom = y.value + height; + const topMenuBottom = topMenuBounds.bottom.value; + const overlapPixels = Math.min(actionbarBottom, topMenuBottom) - Math.max(y.value, topMenuBounds.top.value); + return overlapPixels > overlapThreshold; + }); + watch(isDragging, (newIsDragging) => { + if (!newIsDragging) { + isDocked.value = isOverlappingWithTopMenu.value; + } else { + isDocked.value = false; + } + }); + const eventBus = useEventBus("topMenu"); + watch([isDragging, isOverlappingWithTopMenu], ([dragging, overlapping]) => { + eventBus.emit("updateHighlight", { + isDragging: dragging, + isOverlapping: overlapping + }); + }); + return (_ctx, _cache) => { + return openBlock(), createBlock(unref(script$i), { + class: normalizeClass(["actionbar w-fit", { "is-dragging": unref(isDragging), "is-docked": unref(isDocked) }]), + style: normalizeStyle(unref(style)) + }, { + default: withCtx(() => [ + createBaseVNode("div", { + class: "actionbar-content flex items-center", + ref_key: "panelRef", + ref: panelRef + }, [ + createBaseVNode("span", { + class: "drag-handle cursor-move mr-2 p-0!", + ref_key: "dragHandleRef", + ref: dragHandleRef + }, null, 512), + createVNode(ComfyQueueButton) + ], 512) + ]), + _: 1 + }, 8, ["style", "class"]); + }; + } +}); +const Actionbar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-915e5456"]]); +const _hoisted_1$3 = { + viewBox: "0 0 24 24", + width: "1.2em", + height: "1.2em" +}; +function render$1(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$3, _cache[0] || (_cache[0] = [ + 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) + ])); +} +__name(render$1, "render$1"); +const __unplugin_components_1 = markRaw({ name: "material-symbols-dock-to-bottom-outline", render: render$1 }); +const _hoisted_1$2 = { + viewBox: "0 0 24 24", + width: "1.2em", + height: "1.2em" +}; +function render(_ctx, _cache) { + return openBlock(), createElementBlock("svg", _hoisted_1$2, _cache[0] || (_cache[0] = [ + 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) + ])); +} +__name(render, "render"); +const __unplugin_components_0 = markRaw({ name: "material-symbols-dock-to-bottom", render }); +const _sfc_main$3 = /* @__PURE__ */ defineComponent({ + __name: "BottomPanelToggleButton", + setup(__props) { + const bottomPanelStore = useBottomPanelStore(); + return (_ctx, _cache) => { + 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), { + severity: "secondary", + text: "", + "aria-label": _ctx.$t("menu.toggleBottomPanel"), + onClick: unref(bottomPanelStore).toggleBottomPanel + }, { + icon: withCtx(() => [ + unref(bottomPanelStore).bottomPanelVisible ? (openBlock(), createBlock(_component_i_material_symbols58dock_to_bottom, { key: 0 })) : (openBlock(), createBlock(_component_i_material_symbols58dock_to_bottom_outline, { key: 1 })) + ]), + _: 1 + }, 8, ["aria-label", "onClick"])), [ + [vShow, unref(bottomPanelStore).bottomPanelTabs.length > 0], + [_directive_tooltip, { value: _ctx.$t("menu.toggleBottomPanel"), showDelay: 300 }] + ]); + }; + } +}); +const _hoisted_1$1 = ["href"]; +const _hoisted_2$1 = { class: "p-menubar-item-label" }; +const _hoisted_3$1 = { + key: 1, + class: "ml-auto border border-surface rounded text-muted text-xs text-nowrap p-1 keybinding-tag" +}; +const _sfc_main$2 = /* @__PURE__ */ defineComponent({ + __name: "CommandMenubar", + setup(__props) { + const settingStore = useSettingStore(); + const dropdownDirection = computed( + () => settingStore.get("Comfy.UseNewMenu") === "Top" ? "down" : "up" + ); + const menuItemsStore = useMenuItemStore(); + const { t: t2 } = useI18n(); + const translateMenuItem = /* @__PURE__ */ __name((item) => { + const label = typeof item.label === "function" ? item.label() : item.label; + const translatedLabel = label ? t2(`menuLabels.${normalizeI18nKey(label)}`, label) : void 0; + return { + ...item, + label: translatedLabel, + items: item.items?.map(translateMenuItem) + }; + }, "translateMenuItem"); + const translatedItems = computed( + () => menuItemsStore.menuItems.map(translateMenuItem) + ); + return (_ctx, _cache) => { + return openBlock(), createBlock(unref(script$j), { + 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, props }) => [ + createBaseVNode("a", mergeProps({ class: "p-menubar-item-link" }, props.action, { + href: item.url, + target: "_blank" + }), [ + item.icon ? (openBlock(), createElementBlock("span", { + key: 0, + class: normalizeClass(["p-menubar-item-icon", item.icon]) + }, null, 2)) : createCommentVNode("", true), + createBaseVNode("span", _hoisted_2$1, toDisplayString(item.label), 1), + item?.comfyCommand?.keybinding ? (openBlock(), createElementBlock("span", _hoisted_3$1, toDisplayString(item.comfyCommand.keybinding.combo.toString()), 1)) : createCommentVNode("", true) + ], 16, _hoisted_1$1) + ]), + _: 1 + }, 8, ["model", "pt"]); + }; + } +}); +const CommandMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-56df69d2"]]); +const _hoisted_1 = { class: "flex-grow min-w-0 app-drag h-full" }; +const _hoisted_2 = { class: "window-actions-spacer flex-shrink-0" }; +const _hoisted_3 = { class: "fixed top-0 left-0 app-drag w-full h-[var(--comfy-topbar-height)]" }; +const _sfc_main$1 = /* @__PURE__ */ defineComponent({ + __name: "TopMenubar", + setup(__props) { + const workspaceState = useWorkspaceStore(); + const settingStore = useSettingStore(); + const workflowTabsPosition = computed( + () => settingStore.get("Comfy.Workflow.WorkflowTabsPosition") + ); + const menuSetting = computed(() => settingStore.get("Comfy.UseNewMenu")); + const betaMenuEnabled = computed(() => menuSetting.value !== "Disabled"); + const teleportTarget = computed( + () => settingStore.get("Comfy.UseNewMenu") === "Top" ? ".comfyui-body-top" : ".comfyui-body-bottom" + ); + const showTopMenu = computed( + () => betaMenuEnabled.value && !workspaceState.focusMode + ); + const menuRight = ref(null); + onMounted(() => { + if (menuRight.value) { + menuRight.value.appendChild(app.menu.element); + } + }); + const topMenuRef = ref(null); + provide("topMenuRef", topMenuRef); + const eventBus = useEventBus("topMenu"); + const isDropZone = ref(false); + const isDroppable = ref(false); + eventBus.on((event, payload) => { + if (event === "updateHighlight") { + isDropZone.value = payload.isDragging; + isDroppable.value = payload.isOverlapping && payload.isDragging; + } + }); + onMounted(() => { + if (isElectron()) { + electronAPI().changeTheme({ + height: topMenuRef.value.getBoundingClientRect().height + }); + } + }); + return (_ctx, _cache) => { + const _directive_tooltip = resolveDirective("tooltip"); + return openBlock(), createElementBlock(Fragment, null, [ + (openBlock(), createBlock(Teleport, { to: teleportTarget.value }, [ + withDirectives(createBaseVNode("div", { + ref_key: "topMenuRef", + ref: topMenuRef, + class: normalizeClass(["comfyui-menu flex items-center", { dropzone: isDropZone.value, "dropzone-active": isDroppable.value }]) + }, [ + _cache[1] || (_cache[1] = createBaseVNode("h1", { class: "comfyui-logo mx-2 app-drag" }, "ComfyUI", -1)), + createVNode(CommandMenubar), + createBaseVNode("div", _hoisted_1, [ + workflowTabsPosition.value === "Topbar" ? (openBlock(), createBlock(WorkflowTabs, { key: 0 })) : createCommentVNode("", true) + ]), + createBaseVNode("div", { + class: "comfyui-menu-right", + ref_key: "menuRight", + ref: menuRight + }, null, 512), + createVNode(Actionbar), + createVNode(_sfc_main$3, { class: "flex-shrink-0" }), + withDirectives(createVNode(unref(script), { + class: "flex-shrink-0", + icon: "pi pi-bars", + severity: "secondary", + text: "", + "aria-label": _ctx.$t("menu.hideMenu"), + onClick: _cache[0] || (_cache[0] = ($event) => unref(workspaceState).focusMode = true), + onContextmenu: unref(showNativeMenu) + }, null, 8, ["aria-label", "onContextmenu"]), [ + [_directive_tooltip, { value: _ctx.$t("menu.hideMenu"), showDelay: 300 }] + ]), + withDirectives(createBaseVNode("div", _hoisted_2, null, 512), [ + [vShow, menuSetting.value !== "Bottom"] + ]) + ], 2), [ + [vShow, showTopMenu.value] + ]) + ], 8, ["to"])), + withDirectives(createBaseVNode("div", _hoisted_3, null, 512), [ + [vShow, unref(isNativeWindow)() && !showTopMenu.value] + ]) + ], 64); + }; + } +}); +const TopMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-929e7543"]]); +var LatentPreviewMethod = /* @__PURE__ */ ((LatentPreviewMethod2) => { + LatentPreviewMethod2["NoPreviews"] = "none"; + LatentPreviewMethod2["Auto"] = "auto"; + LatentPreviewMethod2["Latent2RGB"] = "latent2rgb"; + LatentPreviewMethod2["TAESD"] = "taesd"; + return LatentPreviewMethod2; +})(LatentPreviewMethod || {}); +var LogLevel = /* @__PURE__ */ ((LogLevel2) => { + LogLevel2["DEBUG"] = "DEBUG"; + LogLevel2["INFO"] = "INFO"; + LogLevel2["WARNING"] = "WARNING"; + LogLevel2["ERROR"] = "ERROR"; + LogLevel2["CRITICAL"] = "CRITICAL"; + return LogLevel2; +})(LogLevel || {}); +var HashFunction = /* @__PURE__ */ ((HashFunction2) => { + HashFunction2["MD5"] = "md5"; + HashFunction2["SHA1"] = "sha1"; + HashFunction2["SHA256"] = "sha256"; + HashFunction2["SHA512"] = "sha512"; + return HashFunction2; +})(HashFunction || {}); +var AutoLaunch = /* @__PURE__ */ ((AutoLaunch2) => { + AutoLaunch2["Auto"] = "auto"; + AutoLaunch2["Disable"] = "disable"; + AutoLaunch2["Enable"] = "enable"; + return AutoLaunch2; +})(AutoLaunch || {}); +var CudaMalloc = /* @__PURE__ */ ((CudaMalloc2) => { + CudaMalloc2["Auto"] = "auto"; + CudaMalloc2["Disable"] = "disable"; + CudaMalloc2["Enable"] = "enable"; + return CudaMalloc2; +})(CudaMalloc || {}); +var FloatingPointPrecision = /* @__PURE__ */ ((FloatingPointPrecision2) => { + FloatingPointPrecision2["AUTO"] = "auto"; + FloatingPointPrecision2["FP64"] = "fp64"; + FloatingPointPrecision2["FP32"] = "fp32"; + FloatingPointPrecision2["FP16"] = "fp16"; + FloatingPointPrecision2["BF16"] = "bf16"; + FloatingPointPrecision2["FP8E4M3FN"] = "fp8_e4m3fn"; + FloatingPointPrecision2["FP8E5M2"] = "fp8_e5m2"; + return FloatingPointPrecision2; +})(FloatingPointPrecision || {}); +var CrossAttentionMethod = /* @__PURE__ */ ((CrossAttentionMethod2) => { + CrossAttentionMethod2["Auto"] = "auto"; + CrossAttentionMethod2["Split"] = "split"; + CrossAttentionMethod2["Quad"] = "quad"; + CrossAttentionMethod2["Pytorch"] = "pytorch"; + return CrossAttentionMethod2; +})(CrossAttentionMethod || {}); +var VramManagement = /* @__PURE__ */ ((VramManagement2) => { + VramManagement2["Auto"] = "auto"; + VramManagement2["GPUOnly"] = "gpu-only"; + VramManagement2["HighVram"] = "highvram"; + VramManagement2["NormalVram"] = "normalvram"; + VramManagement2["LowVram"] = "lowvram"; + VramManagement2["NoVram"] = "novram"; + VramManagement2["CPU"] = "cpu"; + return VramManagement2; +})(VramManagement || {}); +const WEB_ONLY_CONFIG_ITEMS = [ + // Launch behavior + { + id: "auto-launch", + name: "Automatically opens in the browser on startup", + category: ["Launch"], + type: "combo", + options: Object.values(AutoLaunch), + defaultValue: AutoLaunch.Auto, + getValue: /* @__PURE__ */ __name((value) => { + switch (value) { + case AutoLaunch.Auto: + return {}; + case AutoLaunch.Enable: + return { + ["auto-launch"]: true + }; + case AutoLaunch.Disable: + return { + ["disable-auto-launch"]: true + }; + } + }, "getValue") + } +]; +const SERVER_CONFIG_ITEMS = [ + // Network settings + { + id: "listen", + name: "Host: The IP address to listen on", + category: ["Network"], + type: "text", + defaultValue: "127.0.0.1" + }, + { + id: "port", + name: "Port: The port to listen on", + category: ["Network"], + type: "number", + // The default launch port for desktop app is 8000 instead of 8188. + defaultValue: 8e3 + }, + { + id: "tls-keyfile", + name: "TLS Key File: Path to TLS key file for HTTPS", + category: ["Network"], + type: "text", + defaultValue: "" + }, + { + id: "tls-certfile", + name: "TLS Certificate File: Path to TLS certificate file for HTTPS", + category: ["Network"], + type: "text", + defaultValue: "" + }, + { + id: "enable-cors-header", + name: 'Enable CORS header: Use "*" for all origins or specify domain', + category: ["Network"], + type: "text", + defaultValue: "" + }, + { + id: "max-upload-size", + name: "Maximum upload size (MB)", + category: ["Network"], + type: "number", + defaultValue: 100 + }, + // CUDA settings + { + id: "cuda-device", + name: "CUDA device index to use", + category: ["CUDA"], + type: "number", + defaultValue: null + }, + { + id: "cuda-malloc", + name: "Use CUDA malloc for memory allocation", + category: ["CUDA"], + type: "combo", + options: Object.values(CudaMalloc), + defaultValue: CudaMalloc.Auto, + getValue: /* @__PURE__ */ __name((value) => { + switch (value) { + case CudaMalloc.Auto: + return {}; + case CudaMalloc.Enable: + return { + ["cuda-malloc"]: true + }; + case CudaMalloc.Disable: + return { + ["disable-cuda-malloc"]: true + }; + } + }, "getValue") + }, + // Precision settings + { + id: "global-precision", + name: "Global floating point precision", + category: ["Inference"], + type: "combo", + options: [ + FloatingPointPrecision.AUTO, + FloatingPointPrecision.FP32, + FloatingPointPrecision.FP16 + ], + defaultValue: FloatingPointPrecision.AUTO, + tooltip: "Global floating point precision", + getValue: /* @__PURE__ */ __name((value) => { + switch (value) { + case FloatingPointPrecision.AUTO: + return {}; + case FloatingPointPrecision.FP32: + return { + ["force-fp32"]: true + }; + case FloatingPointPrecision.FP16: + return { + ["force-fp16"]: true + }; + default: + return {}; + } + }, "getValue") + }, + // UNET precision + { + id: "unet-precision", + name: "UNET precision", + category: ["Inference"], + type: "combo", + options: [ + FloatingPointPrecision.AUTO, + FloatingPointPrecision.FP64, + FloatingPointPrecision.FP32, + FloatingPointPrecision.FP16, + FloatingPointPrecision.BF16, + FloatingPointPrecision.FP8E4M3FN, + FloatingPointPrecision.FP8E5M2 + ], + defaultValue: FloatingPointPrecision.AUTO, + tooltip: "UNET precision", + getValue: /* @__PURE__ */ __name((value) => { + switch (value) { + case FloatingPointPrecision.AUTO: + return {}; + default: + return { + [`${value.toLowerCase()}-unet`]: true + }; + } + }, "getValue") + }, + // VAE settings + { + id: "vae-precision", + name: "VAE precision", + category: ["Inference"], + type: "combo", + options: [ + FloatingPointPrecision.AUTO, + FloatingPointPrecision.FP16, + FloatingPointPrecision.FP32, + FloatingPointPrecision.BF16 + ], + defaultValue: FloatingPointPrecision.AUTO, + tooltip: "VAE precision", + getValue: /* @__PURE__ */ __name((value) => { + switch (value) { + case FloatingPointPrecision.AUTO: + return {}; + default: + return { + [`${value.toLowerCase()}-vae`]: true + }; + } + }, "getValue") + }, + { + id: "cpu-vae", + name: "Run VAE on CPU", + category: ["Inference"], + type: "boolean", + defaultValue: false + }, + // Text Encoder settings + { + id: "text-encoder-precision", + name: "Text Encoder precision", + category: ["Inference"], + type: "combo", + options: [ + FloatingPointPrecision.AUTO, + FloatingPointPrecision.FP8E4M3FN, + FloatingPointPrecision.FP8E5M2, + FloatingPointPrecision.FP16, + FloatingPointPrecision.FP32 + ], + defaultValue: FloatingPointPrecision.AUTO, + tooltip: "Text Encoder precision", + getValue: /* @__PURE__ */ __name((value) => { + switch (value) { + case FloatingPointPrecision.AUTO: + return {}; + default: + return { + [`${value.toLowerCase()}-text-enc`]: true + }; + } + }, "getValue") + }, + // Memory and performance settings + { + id: "force-channels-last", + name: "Force channels-last memory format", + category: ["Memory"], + type: "boolean", + defaultValue: false + }, + { + id: "directml", + name: "DirectML device index", + category: ["Memory"], + type: "number", + defaultValue: null + }, + { + id: "disable-ipex-optimize", + name: "Disable IPEX optimization", + category: ["Memory"], + type: "boolean", + defaultValue: false + }, + // Preview settings + { + id: "preview-method", + name: "Method used for latent previews", + category: ["Preview"], + type: "combo", + options: Object.values(LatentPreviewMethod), + defaultValue: LatentPreviewMethod.NoPreviews + }, + { + id: "preview-size", + name: "Size of preview images", + category: ["Preview"], + type: "slider", + defaultValue: 512, + attrs: { + min: 128, + max: 2048, + step: 128 + } + }, + // Cache settings + { + id: "cache-classic", + name: "Use classic cache system", + category: ["Cache"], + type: "boolean", + defaultValue: false + }, + { + id: "cache-lru", + name: "Use LRU caching with a maximum of N node results cached.", + category: ["Cache"], + type: "number", + defaultValue: null, + tooltip: "May use more RAM/VRAM." + }, + // Attention settings + { + id: "cross-attention-method", + name: "Cross attention method", + category: ["Attention"], + type: "combo", + options: Object.values(CrossAttentionMethod), + defaultValue: CrossAttentionMethod.Auto, + getValue: /* @__PURE__ */ __name((value) => { + switch (value) { + case CrossAttentionMethod.Auto: + return {}; + default: + return { + [`use-${value.toLowerCase()}-cross-attention`]: true + }; + } + }, "getValue") + }, + { + id: "disable-xformers", + name: "Disable xFormers optimization", + type: "boolean", + defaultValue: false + }, + { + id: "force-upcast-attention", + name: "Force attention upcast", + category: ["Attention"], + type: "boolean", + defaultValue: false + }, + { + id: "dont-upcast-attention", + name: "Prevent attention upcast", + category: ["Attention"], + type: "boolean", + defaultValue: false + }, + // VRAM management + { + id: "vram-management", + name: "VRAM management mode", + category: ["Memory"], + type: "combo", + options: Object.values(VramManagement), + defaultValue: VramManagement.Auto, + getValue: /* @__PURE__ */ __name((value) => { + switch (value) { + case VramManagement.Auto: + return {}; + default: + return { + [value]: true + }; + } + }, "getValue") + }, + { + id: "reserve-vram", + name: "Reserved VRAM (GB)", + category: ["Memory"], + type: "number", + defaultValue: null, + tooltip: "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." + }, + // Misc settings + { + id: "default-hashing-function", + name: "Default hashing function for model files", + type: "combo", + options: Object.values(HashFunction), + defaultValue: HashFunction.SHA256 + }, + { + id: "disable-smart-memory", + name: "Disable smart memory management", + tooltip: "Force ComfyUI to aggressively offload to regular ram instead of keeping models in vram when it can.", + category: ["Memory"], + type: "boolean", + defaultValue: false + }, + { + id: "deterministic", + name: "Make pytorch use slower deterministic algorithms when it can.", + type: "boolean", + defaultValue: false, + tooltip: "Note that this might not make images deterministic in all cases." + }, + { + id: "fast", + name: "Enable some untested and potentially quality deteriorating optimizations.", + type: "boolean", + defaultValue: false + }, + { + id: "dont-print-server", + name: "Don't print server output to console.", + type: "boolean", + defaultValue: false + }, + { + id: "disable-metadata", + name: "Disable saving prompt metadata in files.", + type: "boolean", + defaultValue: false + }, + { + id: "disable-all-custom-nodes", + name: "Disable loading all custom nodes.", + type: "boolean", + defaultValue: false + }, + { + id: "log-level", + name: "Logging verbosity level", + type: "combo", + options: Object.values(LogLevel), + defaultValue: LogLevel.INFO, + getValue: /* @__PURE__ */ __name((value) => { + return { + verbose: value + }; + }, "getValue") + }, + // Directories + { + id: "input-directory", + name: "Input directory", + category: ["Directories"], + type: "text", + defaultValue: "" + }, + { + id: "output-directory", + name: "Output directory", + category: ["Directories"], + type: "text", + defaultValue: "" + } +]; +function useCoreCommands() { + const workflowService = useWorkflowService(); + const workflowStore = useWorkflowStore(); + const dialogService = useDialogService(); + const colorPaletteStore = useColorPaletteStore(); + const getTracker = /* @__PURE__ */ __name(() => workflowStore.activeWorkflow?.changeTracker, "getTracker"); + const getSelectedNodes = /* @__PURE__ */ __name(() => { + const selectedNodes = app.canvas.selected_nodes; + const result = []; + if (selectedNodes) { + for (const i in selectedNodes) { + const node = selectedNodes[i]; + result.push(node); + } + } + return result; + }, "getSelectedNodes"); + const toggleSelectedNodesMode = /* @__PURE__ */ __name((mode) => { + getSelectedNodes().forEach((node) => { + if (node.mode === mode) { + node.mode = LGraphEventMode.ALWAYS; + } else { + node.mode = mode; + } + }); + }, "toggleSelectedNodesMode"); + return [ + { + id: "Comfy.NewBlankWorkflow", + icon: "pi pi-plus", + label: "New Blank Workflow", + menubarLabel: "New", + function: /* @__PURE__ */ __name(() => workflowService.loadBlankWorkflow(), "function") + }, + { + id: "Comfy.OpenWorkflow", + icon: "pi pi-folder-open", + label: "Open Workflow", + menubarLabel: "Open", + function: /* @__PURE__ */ __name(() => { + app.ui.loadFile(); + }, "function") + }, + { + id: "Comfy.LoadDefaultWorkflow", + icon: "pi pi-code", + label: "Load Default Workflow", + function: /* @__PURE__ */ __name(() => workflowService.loadDefaultWorkflow(), "function") + }, + { + id: "Comfy.SaveWorkflow", + icon: "pi pi-save", + label: "Save Workflow", + menubarLabel: "Save", + function: /* @__PURE__ */ __name(async () => { + const workflow = useWorkflowStore().activeWorkflow; + if (!workflow) return; + await workflowService.saveWorkflow(workflow); + }, "function") + }, + { + id: "Comfy.SaveWorkflowAs", + icon: "pi pi-save", + label: "Save Workflow As", + menubarLabel: "Save As", + function: /* @__PURE__ */ __name(async () => { + const workflow = useWorkflowStore().activeWorkflow; + if (!workflow) return; + await workflowService.saveWorkflowAs(workflow); + }, "function") + }, + { + id: "Comfy.ExportWorkflow", + icon: "pi pi-download", + label: "Export Workflow", + menubarLabel: "Export", + function: /* @__PURE__ */ __name(() => { + workflowService.exportWorkflow("workflow", "workflow"); + }, "function") + }, + { + id: "Comfy.ExportWorkflowAPI", + icon: "pi pi-download", + label: "Export Workflow (API Format)", + menubarLabel: "Export (API)", + function: /* @__PURE__ */ __name(() => { + workflowService.exportWorkflow("workflow_api", "output"); + }, "function") + }, + { + id: "Comfy.Undo", + icon: "pi pi-undo", + label: "Undo", + function: /* @__PURE__ */ __name(async () => { + await getTracker()?.undo?.(); + }, "function") + }, + { + id: "Comfy.Redo", + icon: "pi pi-refresh", + label: "Redo", + function: /* @__PURE__ */ __name(async () => { + await getTracker()?.redo?.(); + }, "function") + }, + { + id: "Comfy.ClearWorkflow", + icon: "pi pi-trash", + label: "Clear Workflow", + function: /* @__PURE__ */ __name(() => { + const settingStore = useSettingStore(); + if (!settingStore.get("Comfy.ComfirmClear") || confirm("Clear workflow?")) { + app.clean(); + app.graph.clear(); + api.dispatchCustomEvent("graphCleared"); + } + }, "function") + }, + { + id: "Comfy.Canvas.ResetView", + icon: "pi pi-expand", + label: "Reset View", + function: /* @__PURE__ */ __name(() => { + app.resetView(); + }, "function") + }, + { + id: "Comfy.OpenClipspace", + icon: "pi pi-clipboard", + label: "Clipspace", + function: /* @__PURE__ */ __name(() => { + app.openClipspace(); + }, "function") + }, + { + id: "Comfy.RefreshNodeDefinitions", + icon: "pi pi-refresh", + label: "Refresh Node Definitions", + function: /* @__PURE__ */ __name(async () => { + await app.refreshComboInNodes(); + }, "function") + }, + { + id: "Comfy.Interrupt", + icon: "pi pi-stop", + label: "Interrupt", + function: /* @__PURE__ */ __name(async () => { + await api.interrupt(); + useToastStore().add({ + severity: "info", + summary: "Interrupted", + detail: "Execution has been interrupted", + life: 1e3 + }); + }, "function") + }, + { + id: "Comfy.ClearPendingTasks", + icon: "pi pi-stop", + label: "Clear Pending Tasks", + function: /* @__PURE__ */ __name(async () => { + await useQueueStore().clear(["queue"]); + useToastStore().add({ + severity: "info", + summary: "Confirmed", + detail: "Pending tasks deleted", + life: 3e3 + }); + }, "function") + }, + { + id: "Comfy.BrowseTemplates", + icon: "pi pi-folder-open", + label: "Browse Templates", + function: /* @__PURE__ */ __name(() => { + dialogService.showTemplateWorkflowsDialog(); + }, "function") + }, + { + id: "Comfy.Canvas.ZoomIn", + icon: "pi pi-plus", + label: "Zoom In", + function: /* @__PURE__ */ __name(() => { + const ds = app.canvas.ds; + ds.changeScale( + ds.scale * 1.1, + ds.element ? [ds.element.width / 2, ds.element.height / 2] : void 0 + ); + app.canvas.setDirty(true, true); + }, "function") + }, + { + id: "Comfy.Canvas.ZoomOut", + icon: "pi pi-minus", + label: "Zoom Out", + function: /* @__PURE__ */ __name(() => { + const ds = app.canvas.ds; + ds.changeScale( + ds.scale / 1.1, + ds.element ? [ds.element.width / 2, ds.element.height / 2] : void 0 + ); + app.canvas.setDirty(true, true); + }, "function") + }, + { + id: "Comfy.Canvas.FitView", + icon: "pi pi-expand", + label: "Fit view to selected nodes", + function: /* @__PURE__ */ __name(() => { + if (app.canvas.empty) { + useToastStore().add({ + severity: "error", + summary: "Empty canvas", + life: 3e3 + }); + return; + } + app.canvas.fitViewToSelectionAnimated(); + }, "function") + }, + { + id: "Comfy.Canvas.ToggleLock", + icon: "pi pi-lock", + label: "Canvas Toggle Lock", + function: /* @__PURE__ */ __name(() => { + app.canvas["read_only"] = !app.canvas["read_only"]; + }, "function") + }, + { + id: "Comfy.Canvas.ToggleLinkVisibility", + icon: "pi pi-eye", + label: "Canvas Toggle Link Visibility", + versionAdded: "1.3.6", + function: (() => { + const settingStore = useSettingStore(); + let lastLinksRenderMode = LiteGraph.SPLINE_LINK; + return () => { + const currentMode = settingStore.get("Comfy.LinkRenderMode"); + if (currentMode === LiteGraph.HIDDEN_LINK) { + settingStore.set("Comfy.LinkRenderMode", lastLinksRenderMode); + } else { + lastLinksRenderMode = currentMode; + settingStore.set("Comfy.LinkRenderMode", LiteGraph.HIDDEN_LINK); + } + }; + })() + }, + { + id: "Comfy.QueuePrompt", + icon: "pi pi-play", + label: "Queue Prompt", + versionAdded: "1.3.7", + function: /* @__PURE__ */ __name(() => { + const batchCount = useQueueSettingsStore().batchCount; + app.queuePrompt(0, batchCount); + }, "function") + }, + { + id: "Comfy.QueuePromptFront", + icon: "pi pi-play", + label: "Queue Prompt (Front)", + versionAdded: "1.3.7", + function: /* @__PURE__ */ __name(() => { + const batchCount = useQueueSettingsStore().batchCount; + app.queuePrompt(-1, batchCount); + }, "function") + }, + { + id: "Comfy.ShowSettingsDialog", + icon: "pi pi-cog", + label: "Show Settings Dialog", + versionAdded: "1.3.7", + function: /* @__PURE__ */ __name(() => { + dialogService.showSettingsDialog(); + }, "function") + }, + { + id: "Comfy.Graph.GroupSelectedNodes", + icon: "pi pi-sitemap", + label: "Group Selected Nodes", + versionAdded: "1.3.7", + function: /* @__PURE__ */ __name(() => { + const { canvas } = app; + if (!canvas.selectedItems?.size) { + useToastStore().add({ + severity: "error", + summary: "Nothing to group", + detail: "Please select the nodes (or other groups) to create a group for", + life: 3e3 + }); + return; + } + const group = new LGraphGroup(); + const padding = useSettingStore().get( + "Comfy.GroupSelectedNodes.Padding" + ); + group.resizeTo(canvas.selectedItems, padding); + canvas.graph.add(group); + useTitleEditorStore().titleEditorTarget = group; + }, "function") + }, + { + id: "Workspace.NextOpenedWorkflow", + icon: "pi pi-step-forward", + label: "Next Opened Workflow", + versionAdded: "1.3.9", + function: /* @__PURE__ */ __name(() => { + workflowService.loadNextOpenedWorkflow(); + }, "function") + }, + { + id: "Workspace.PreviousOpenedWorkflow", + icon: "pi pi-step-backward", + label: "Previous Opened Workflow", + versionAdded: "1.3.9", + function: /* @__PURE__ */ __name(() => { + workflowService.loadPreviousOpenedWorkflow(); + }, "function") + }, + { + id: "Comfy.Canvas.ToggleSelectedNodes.Mute", + icon: "pi pi-volume-off", + label: "Mute/Unmute Selected Nodes", + versionAdded: "1.3.11", + function: /* @__PURE__ */ __name(() => { + toggleSelectedNodesMode(LGraphEventMode.NEVER); + }, "function") + }, + { + id: "Comfy.Canvas.ToggleSelectedNodes.Bypass", + icon: "pi pi-shield", + label: "Bypass/Unbypass Selected Nodes", + versionAdded: "1.3.11", + function: /* @__PURE__ */ __name(() => { + toggleSelectedNodesMode(LGraphEventMode.BYPASS); + }, "function") + }, + { + id: "Comfy.Canvas.ToggleSelectedNodes.Pin", + icon: "pi pi-pin", + label: "Pin/Unpin Selected Nodes", + versionAdded: "1.3.11", + function: /* @__PURE__ */ __name(() => { + getSelectedNodes().forEach((node) => { + node.pin(!node.pinned); + }); + }, "function") + }, + { + id: "Comfy.Canvas.ToggleSelected.Pin", + icon: "pi pi-pin", + label: "Pin/Unpin Selected Items", + versionAdded: "1.3.33", + function: /* @__PURE__ */ __name(() => { + for (const item of app.canvas.selectedItems) { + if (item instanceof LGraphNode || item instanceof LGraphGroup) { + item.pin(!item.pinned); + } + } + }, "function") + }, + { + id: "Comfy.Canvas.ToggleSelectedNodes.Collapse", + icon: "pi pi-minus", + label: "Collapse/Expand Selected Nodes", + versionAdded: "1.3.11", + function: /* @__PURE__ */ __name(() => { + getSelectedNodes().forEach((node) => { + node.collapse(); + }); + }, "function") + }, + { + id: "Comfy.ToggleTheme", + icon: "pi pi-moon", + label: "Toggle Theme (Dark/Light)", + versionAdded: "1.3.12", + function: (() => { + let previousDarkTheme = DEFAULT_DARK_COLOR_PALETTE.id; + let previousLightTheme = DEFAULT_LIGHT_COLOR_PALETTE.id; + return () => { + const settingStore = useSettingStore(); + const theme = colorPaletteStore.completedActivePalette; + if (theme.light_theme) { + previousLightTheme = theme.id; + settingStore.set("Comfy.ColorPalette", previousDarkTheme); + } else { + previousDarkTheme = theme.id; + settingStore.set("Comfy.ColorPalette", previousLightTheme); + } + }; + })() + }, + { + id: "Workspace.ToggleBottomPanel", + icon: "pi pi-list", + label: "Toggle Bottom Panel", + versionAdded: "1.3.22", + function: /* @__PURE__ */ __name(() => { + useBottomPanelStore().toggleBottomPanel(); + }, "function") + }, + { + id: "Workspace.ToggleFocusMode", + icon: "pi pi-eye", + label: "Toggle Focus Mode", + versionAdded: "1.3.27", + function: /* @__PURE__ */ __name(() => { + useWorkspaceStore().toggleFocusMode(); + }, "function") + }, + { + id: "Comfy.Graph.FitGroupToContents", + icon: "pi pi-expand", + label: "Fit Group To Contents", + versionAdded: "1.4.9", + function: /* @__PURE__ */ __name(() => { + for (const group of app.canvas.selectedItems) { + if (group instanceof LGraphGroup) { + group.recomputeInsideNodes(); + const padding = useSettingStore().get( + "Comfy.GroupSelectedNodes.Padding" + ); + group.resizeTo(group.children, padding); + app.graph.change(); + } + } + }, "function") + }, + { + id: "Comfy.Help.OpenComfyUIIssues", + icon: "pi pi-github", + label: "Open ComfyUI Issues", + menubarLabel: "ComfyUI Issues", + versionAdded: "1.5.5", + function: /* @__PURE__ */ __name(() => { + window.open( + "https://github.com/comfyanonymous/ComfyUI/issues", + "_blank" + ); + }, "function") + }, + { + id: "Comfy.Help.OpenComfyUIDocs", + icon: "pi pi-info-circle", + label: "Open ComfyUI Docs", + menubarLabel: "ComfyUI Docs", + versionAdded: "1.5.5", + function: /* @__PURE__ */ __name(() => { + window.open("https://docs.comfy.org/", "_blank"); + }, "function") + }, + { + id: "Comfy.Help.OpenComfyOrgDiscord", + icon: "pi pi-discord", + label: "Open Comfy-Org Discord", + menubarLabel: "Comfy-Org Discord", + versionAdded: "1.5.5", + function: /* @__PURE__ */ __name(() => { + window.open("https://www.comfy.org/discord", "_blank"); + }, "function") + }, + { + id: "Workspace.SearchBox.Toggle", + icon: "pi pi-search", + label: "Toggle Search Box", + versionAdded: "1.5.7", + 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") + }, + { + id: "Workspace.CloseWorkflow", + icon: "pi pi-times", + label: "Close Current Workflow", + versionAdded: "1.7.3", + function: /* @__PURE__ */ __name(() => { + if (workflowStore.activeWorkflow) + workflowService.closeWorkflow(workflowStore.activeWorkflow); + }, "function") + }, + { + id: "Comfy.Feedback", + icon: "pi pi-megaphone", + label: "Give Feedback", + versionAdded: "1.8.2", + function: /* @__PURE__ */ __name(() => { + dialogService.showIssueReportDialog({ + title: t("g.feedback"), + subtitle: t("issueReport.feedbackTitle"), + panelProps: { + errorType: "Feedback", + defaultFields: ["SystemStats", "Settings"] + } + }); + }, "function") + }, + { + id: "Comfy.Help.OpenComfyUIForum", + icon: "pi pi-comments", + label: "Open ComfyUI Forum", + menubarLabel: "ComfyUI Forum", + versionAdded: "1.8.2", + function: /* @__PURE__ */ __name(() => { + window.open("https://forum.comfy.org/", "_blank"); + }, "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) { + setupAutoQueueHandler(); + const { t: t2 } = useI18n(); + const toast = useToast(); + const settingStore = useSettingStore(); + const executionStore = useExecutionStore(); + const colorPaletteStore = useColorPaletteStore(); + const queueStore = useQueueStore(); + watch( + () => colorPaletteStore.completedActivePalette, + (newTheme) => { + const DARK_THEME_CLASS = "dark-theme"; + if (newTheme.light_theme) { + document.body.classList.remove(DARK_THEME_CLASS); + } else { + document.body.classList.add(DARK_THEME_CLASS); + } + if (isElectron()) { + electronAPI().changeTheme({ + color: "rgba(0, 0, 0, 0)", + symbolColor: newTheme.colors.comfy_base["input-text"] + }); + } + }, + { immediate: true } + ); + if (isElectron()) { + watch( + () => queueStore.tasks, + (newTasks, oldTasks) => { + const oldRunningTaskIds = new Set( + oldTasks.filter((task) => task.isRunning).map((task) => task.promptId) + ); + newTasks.filter( + (task) => oldRunningTaskIds.has(task.promptId) && task.isHistory + ).forEach((task) => { + electronAPI().Events.incrementUserProperty( + `execution:${task.displayStatus.toLowerCase()}`, + 1 + ); + electronAPI().Events.trackEvent("execution", { + status: task.displayStatus.toLowerCase() + }); + }); + }, + { deep: true } + ); + } + watchEffect(() => { + const fontSize = settingStore.get("Comfy.TextareaWidget.FontSize"); + document.documentElement.style.setProperty( + "--comfy-textarea-font-size", + `${fontSize}px` + ); + }); + watchEffect(() => { + const padding = settingStore.get("Comfy.TreeExplorer.ItemPadding"); + document.documentElement.style.setProperty( + "--comfy-tree-explorer-item-padding", + `${padding}px` + ); + }); + watchEffect(() => { + const locale = settingStore.get("Comfy.Locale"); + if (locale) { + i18n.global.locale.value = locale; + } + }); + watchEffect(() => { + const useNewMenu = settingStore.get("Comfy.UseNewMenu"); + if (useNewMenu === "Disabled") { + app.ui.menuContainer.style.setProperty("display", "block"); + app.ui.restoreMenuPosition(); + } else { + app.ui.menuContainer.style.setProperty("display", "none"); + } + }); + watchEffect(() => { + queueStore.maxHistoryItems = settingStore.get("Comfy.Queue.MaxHistoryItems"); + }); + const init = /* @__PURE__ */ __name(() => { + const coreCommands = useCoreCommands(); + useCommandStore().registerCommands(coreCommands); + useMenuItemStore().registerCoreMenuCommands(); + useKeybindingService().registerCoreKeybindings(); + useSidebarTabStore().registerCoreSidebarTabs(); + useBottomPanelStore().registerCoreBottomPanelTabs(); + app.extensionManager = useWorkspaceStore(); + }, "init"); + const queuePendingTaskCountStore = useQueuePendingTaskCountStore(); + const onStatus = /* @__PURE__ */ __name(async (e) => { + queuePendingTaskCountStore.update(e); + await queueStore.update(); + }, "onStatus"); + const reconnectingMessage = { + severity: "error", + summary: t2("g.reconnecting") + }; + const onReconnecting = /* @__PURE__ */ __name(() => { + toast.remove(reconnectingMessage); + toast.add(reconnectingMessage); + }, "onReconnecting"); + const onReconnected = /* @__PURE__ */ __name(() => { + toast.remove(reconnectingMessage); + toast.add({ + severity: "success", + summary: t2("g.reconnected"), + life: 2e3 + }); + }, "onReconnected"); + onMounted(() => { + api.addEventListener("status", onStatus); + api.addEventListener("reconnecting", onReconnecting); + api.addEventListener("reconnected", onReconnected); + executionStore.bindExecutionEvents(); + try { + init(); + } catch (e) { + console.error("Failed to init ComfyUI frontend", e); + } + }); + onBeforeUnmount(() => { + api.removeEventListener("status", onStatus); + api.removeEventListener("reconnecting", onReconnecting); + api.removeEventListener("reconnected", onReconnected); + executionStore.unbindExecutionEvents(); + }); + useEventListener(window, "keydown", useKeybindingService().keybindHandler); + const { wrapWithErrorHandling, wrapWithErrorHandlingAsync } = useErrorHandling(); + const onGraphReady = /* @__PURE__ */ __name(() => { + requestIdleCallback( + () => { + wrapWithErrorHandling(useKeybindingService().registerUserKeybindings)(); + wrapWithErrorHandling(useServerConfigStore().loadServerConfig)( + SERVER_CONFIG_ITEMS, + settingStore.get("Comfy.Server.ServerConfigValues") + ); + wrapWithErrorHandlingAsync(useModelStore().loadModelFolders)(); + wrapWithErrorHandlingAsync(useNodeFrequencyStore().loadNodeFrequencies)(); + useNodeDefStore().nodeSearchService.endsWithFilterStartSequence(""); + }, + { timeout: 1e3 } + ); + }, "onGraphReady"); + return (_ctx, _cache) => { + return openBlock(), createElementBlock(Fragment, null, [ + createVNode(TopMenubar), + createVNode(_sfc_main$8, { onReady: onGraphReady }), + createVNode(_sfc_main$7), + !unref(isElectron)() ? (openBlock(), createBlock(_sfc_main$s, { key: 0 })) : createCommentVNode("", true), + createVNode(_sfc_main$u), + createVNode(MenuHamburger) + ], 64); + }; + } +}); +export { + _sfc_main as default +}; +//# sourceMappingURL=GraphView-DKrBTQLe.js.map diff --git a/web/assets/InstallView-By3hC1fC.js b/web/assets/InstallView-By3hC1fC.js deleted file mode 100644 index 4262b2646..000000000 --- a/web/assets/InstallView-By3hC1fC.js +++ /dev/null @@ -1,1319 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -import { B as BaseStyle, y as script$6, o as openBlock, f as createElementBlock, G as mergeProps, c9 as findIndexInList, ca as find, aD as resolveComponent, J as createBlock, K as resolveDynamicComponent, P as withCtx, m as createBaseVNode, Z as toDisplayString, M as renderSlot, L as createCommentVNode, V as normalizeClass, R as findSingle, H as Fragment, aE as Transition, i as withDirectives, v as vShow, am as UniqueComponentId, d as defineComponent, ad as ref, cb as useModel, k as createVNode, j as unref, cc as script$7, c4 as script$8, b3 as withModifiers, aP as script$9, a3 as useI18n, c as computed, aK as script$a, aG as createTextVNode, p as pushScopeId, q as popScopeId, bV as electronAPI, _ as _export_sfc, t as onMounted, r as resolveDirective, ax as script$b, cd as script$c, ce as script$d, l as script$e, c6 as script$f, cf as MigrationItems, w as watchEffect, I as renderList, cg as script$g, c2 as useRouter, aU as toRaw } from "./index-QvfM__ze.js"; -import { _ as _sfc_main$5 } from "./BaseViewTemplate-BhQMaVFP.js"; -var classes$4 = { - root: /* @__PURE__ */ __name(function root(_ref) { - var instance = _ref.instance; - return ["p-step", { - "p-step-active": instance.active, - "p-disabled": instance.isStepDisabled - }]; - }, "root"), - header: "p-step-header", - number: "p-step-number", - title: "p-step-title" -}; -var StepStyle = BaseStyle.extend({ - name: "step", - classes: classes$4 -}); -var script$2$2 = { - name: "StepperSeparator", - hostName: "Stepper", - "extends": script$6 -}; -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$2, "render$1$2"); -script$2$2.render = render$1$2; -var script$1$4 = { - name: "BaseStep", - "extends": script$6, - props: { - value: { - type: [String, Number], - "default": void 0 - }, - disabled: { - type: Boolean, - "default": false - }, - asChild: { - type: Boolean, - "default": false - }, - as: { - type: [String, Object], - "default": "DIV" - } - }, - style: StepStyle, - provide: /* @__PURE__ */ __name(function provide() { - return { - $pcStep: this, - $parentInstance: this - }; - }, "provide") -}; -var script$5 = { - name: "Step", - "extends": script$1$4, - inheritAttrs: false, - inject: { - $pcStepper: { - "default": null - }, - $pcStepList: { - "default": null - }, - $pcStepItem: { - "default": null - } - }, - data: /* @__PURE__ */ __name(function data() { - return { - isSeparatorVisible: false - }; - }, "data"), - 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; - this.isSeparatorVisible = index !== stepLen - 1; - } - }, "mounted"), - methods: { - getPTOptions: /* @__PURE__ */ __name(function getPTOptions(key) { - var _ptm = key === "root" ? this.ptmi : this.ptm; - return _ptm(key, { - context: { - active: this.active, - disabled: this.isStepDisabled - } - }); - }, "getPTOptions"), - onStepClick: /* @__PURE__ */ __name(function onStepClick() { - this.$pcStepper.updateValue(this.activeValue); - }, "onStepClick") - }, - computed: { - active: /* @__PURE__ */ __name(function active() { - return this.$pcStepper.isStepActive(this.activeValue); - }, "active"), - activeValue: /* @__PURE__ */ __name(function activeValue() { - 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 isStepDisabled() { - return !this.active && (this.$pcStepper.isStepDisabled() || this.disabled); - }, "isStepDisabled"), - id: /* @__PURE__ */ __name(function id() { - var _this$$pcStepper; - return "".concat((_this$$pcStepper = this.$pcStepper) === null || _this$$pcStepper === void 0 ? void 0 : _this$$pcStepper.id, "_step_").concat(this.activeValue); - }, "id"), - ariaControls: /* @__PURE__ */ __name(function ariaControls() { - var _this$$pcStepper2; - return "".concat((_this$$pcStepper2 = this.$pcStepper) === null || _this$$pcStepper2 === void 0 ? void 0 : _this$$pcStepper2.id, "_steppanel_").concat(this.activeValue); - }, "ariaControls"), - a11yAttrs: /* @__PURE__ */ __name(function a11yAttrs() { - return { - root: { - role: "presentation", - "aria-current": this.active ? "step" : void 0, - "data-pc-name": "step", - "data-pc-section": "root", - "data-p-disabled": this.disabled, - "data-p-active": this.active - }, - header: { - id: this.id, - role: "tab", - taindex: this.disabled ? -1 : void 0, - "aria-controls": this.ariaControls, - "data-pc-section": "header", - disabled: this.disabled, - onClick: this.onStepClick - } - }; - }, "a11yAttrs") - }, - components: { - StepperSeparator: script$2$2 - } -}; -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, - "class": _ctx.cx("root"), - "aria-current": $options.active ? "step" : void 0, - role: "presentation", - "data-p-active": $options.active, - "data-p-disabled": $options.isStepDisabled - }, $options.getPTOptions("root")), { - "default": withCtx(function() { - return [createBaseVNode("button", mergeProps({ - id: $options.id, - "class": _ctx.cx("header"), - role: "tab", - type: "button", - tabindex: $options.isStepDisabled ? -1 : void 0, - "aria-controls": $options.ariaControls, - disabled: $options.isStepDisabled, - onClick: _cache[0] || (_cache[0] = function() { - return $options.onStepClick && $options.onStepClick.apply($options, arguments); - }) - }, $options.getPTOptions("header")), [createBaseVNode("span", mergeProps({ - "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$5), $data.isSeparatorVisible ? (openBlock(), createBlock(_component_StepperSeparator, { - key: 0 - })) : createCommentVNode("", true)]; - }), - _: 3 - }, 16, ["class", "aria-current", "data-p-active", "data-p-disabled"])) : renderSlot(_ctx.$slots, "default", { - key: 1, - "class": normalizeClass(_ctx.cx("root")), - active: $options.active, - value: _ctx.value, - a11yAttrs: $options.a11yAttrs, - activateCallback: $options.onStepClick - }); -} -__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 - }]; - }, "root"), - content: "p-steppanel-content" -}; -var StepPanelStyle = BaseStyle.extend({ - name: "steppanel", - classes: classes$2 -}); -var script$2$1 = { - name: "StepperSeparator", - hostName: "Stepper", - "extends": script$6 -}; -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$1, "render$1$1"); -script$2$1.render = render$1$1; -var script$1$2 = { - name: "BaseStepPanel", - "extends": script$6, - props: { - value: { - type: [String, Number], - "default": void 0 - }, - asChild: { - type: Boolean, - "default": false - }, - as: { - type: [String, Object], - "default": "DIV" - } - }, - style: StepPanelStyle, - provide: /* @__PURE__ */ __name(function provide3() { - return { - $pcStepPanel: this, - $parentInstance: this - }; - }, "provide") -}; -var script$3 = { - name: "StepPanel", - "extends": script$1$2, - inheritAttrs: false, - inject: { - $pcStepper: { - "default": null - }, - $pcStepItem: { - "default": null - }, - $pcStepList: { - "default": null - } - }, - data: /* @__PURE__ */ __name(function data2() { - return { - isSeparatorVisible: false - }; - }, "data"), - mounted: /* @__PURE__ */ __name(function mounted2() { - if (this.$el) { - var _this$$pcStepItem, _this$$pcStepList; - var stepElements = find(this.$pcStepper.$el, '[data-pc-name="step"]'); - 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"]'); - var stepPanelIndex = findIndexInList(stepPanelEl, stepElements); - this.isSeparatorVisible = this.isVertical && stepPanelIndex !== stepElements.length - 1; - } - }, "mounted"), - methods: { - getPTOptions: /* @__PURE__ */ __name(function getPTOptions2(key) { - var _ptm = key === "root" ? this.ptmi : this.ptm; - return _ptm(key, { - context: { - active: this.active - } - }); - }, "getPTOptions"), - updateValue: /* @__PURE__ */ __name(function updateValue(val) { - this.$pcStepper.updateValue(val); - }, "updateValue") - }, - computed: { - active: /* @__PURE__ */ __name(function active2() { - var _this$$pcStepItem2, _this$$pcStepper; - var activeValue3 = !!this.$pcStepItem ? (_this$$pcStepItem2 = this.$pcStepItem) === null || _this$$pcStepItem2 === void 0 ? void 0 : _this$$pcStepItem2.value : this.value; - return activeValue3 === ((_this$$pcStepper = this.$pcStepper) === null || _this$$pcStepper === void 0 ? void 0 : _this$$pcStepper.d_value); - }, "active"), - isVertical: /* @__PURE__ */ __name(function isVertical() { - return !!this.$pcStepItem; - }, "isVertical"), - activeValue: /* @__PURE__ */ __name(function activeValue2() { - var _this$$pcStepItem3; - return this.isVertical ? (_this$$pcStepItem3 = this.$pcStepItem) === null || _this$$pcStepItem3 === void 0 ? void 0 : _this$$pcStepItem3.value : this.value; - }, "activeValue"), - id: /* @__PURE__ */ __name(function id2() { - var _this$$pcStepper2; - return "".concat((_this$$pcStepper2 = this.$pcStepper) === null || _this$$pcStepper2 === void 0 ? void 0 : _this$$pcStepper2.id, "_steppanel_").concat(this.activeValue); - }, "id"), - ariaControls: /* @__PURE__ */ __name(function ariaControls2() { - var _this$$pcStepper3; - return "".concat((_this$$pcStepper3 = this.$pcStepper) === null || _this$$pcStepper3 === void 0 ? void 0 : _this$$pcStepper3.id, "_step_").concat(this.activeValue); - }, "ariaControls"), - a11yAttrs: /* @__PURE__ */ __name(function a11yAttrs2() { - return { - id: this.id, - role: "tabpanel", - "aria-controls": this.ariaControls, - "data-pc-name": "steppanel", - "data-p-active": this.active - }; - }, "a11yAttrs") - }, - components: { - StepperSeparator: script$2$1 - } -}; -function render$2(_ctx, _cache, $props, $setup, $data, $options) { - var _component_StepperSeparator = resolveComponent("StepperSeparator"); - return $options.isVertical ? (openBlock(), createElementBlock(Fragment, { - key: 0 - }, [!_ctx.asChild ? (openBlock(), createBlock(Transition, mergeProps({ - key: 0, - name: "p-toggleable-content" - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ - id: $options.id, - "class": _ctx.cx("root"), - role: "tabpanel", - "aria-controls": $options.ariaControls - }, $options.getPTOptions("root")), { - "default": withCtx(function() { - return [$data.isSeparatorVisible ? (openBlock(), createBlock(_component_StepperSeparator, { - key: 0 - })) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("content") - }, $options.getPTOptions("content")), [renderSlot(_ctx.$slots, "default", { - active: $options.active, - activateCallback: /* @__PURE__ */ __name(function activateCallback(val) { - return $options.updateValue(val); - }, "activateCallback") - })], 16)]; - }), - _: 3 - }, 16, ["id", "class", "aria-controls"])), [[vShow, $options.active]])]; - }), - _: 3 - }, 16)) : renderSlot(_ctx.$slots, "default", { - key: 1, - active: $options.active, - a11yAttrs: $options.a11yAttrs, - activateCallback: /* @__PURE__ */ __name(function activateCallback(val) { - return $options.updateValue(val); - }, "activateCallback") - })], 64)) : (openBlock(), createElementBlock(Fragment, { - key: 1 - }, [!_ctx.asChild ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ - key: 0, - id: $options.id, - "class": _ctx.cx("root"), - role: "tabpanel", - "aria-controls": $options.ariaControls - }, $options.getPTOptions("root")), { - "default": withCtx(function() { - return [renderSlot(_ctx.$slots, "default", { - active: $options.active, - activateCallback: /* @__PURE__ */ __name(function activateCallback(val) { - return $options.updateValue(val); - }, "activateCallback") - })]; - }), - _: 3 - }, 16, ["id", "class", "aria-controls"])), [[vShow, $options.active]]) : _ctx.asChild && $options.active ? renderSlot(_ctx.$slots, "default", { - key: 1, - active: $options.active, - a11yAttrs: $options.a11yAttrs, - activateCallback: /* @__PURE__ */ __name(function activateCallback(val) { - return $options.updateValue(val); - }, "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$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 _hoisted_19 = { class: "mt-4" }; -const _hoisted_20 = { - href: "https://comfy.org/privacy", - target: "_blank", - class: "text-blue-400 hover:text-blue-300 underline" -}; -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.collect.errorReports")), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.collect.systemInfo")), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t( - "install.settings.dataCollectionDialog.collect.userJourneyEvents" - )), 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.doNotCollect.personalInformation" - )), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t( - "install.settings.dataCollectionDialog.doNotCollect.workflowContents" - )), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t( - "install.settings.dataCollectionDialog.doNotCollect.fileSystemInformation" - )), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t( - "install.settings.dataCollectionDialog.doNotCollect.customNodeConfigurations" - )), 1) - ]), - createBaseVNode("div", _hoisted_19, [ - createBaseVNode("a", _hoisted_20, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.viewFullPolicy")), 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 _withScopeId$1 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-79125ff6"), n = n(), popScopeId(), n), "_withScopeId$1"); -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: "m-1 text-neutral-400" }; -const _hoisted_5$2 = /* @__PURE__ */ _withScopeId$1(() => /* @__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__ */ _withScopeId$1(() => /* @__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__ */ _withScopeId$1(() => /* @__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 GpuPicker = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-79125ff6"]]); -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 }, - "installPathModifiers": {}, - "pathError": { required: true }, - "pathErrorModifiers": {} - }, - emits: ["update:installPath", "update:pathError"], - setup(__props) { - 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(); - onMounted(async () => { - const paths = await electron.getSystemPaths(); - appData.value = paths.appData; - appPath.value = paths.appPath; - installPath.value = paths.defaultInstallPath; - await validatePath(paths.defaultInstallPath); - }); - const validatePath = /* @__PURE__ */ __name(async (path) => { - try { - pathError.value = ""; - pathExists.value = false; - const validation = await electron.validateInstallPath(path); - if (!validation.isValid) { - 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"); - } - }, "validatePath"); - const browsePath = /* @__PURE__ */ __name(async () => { - try { - const result = await electron.showDirectoryPicker(); - if (result) { - installPath.value = result; - await validatePath(result); - } - } catch (error) { - pathError.value = t("install.failedToSelectDirectory"); - } - }, "browsePath"); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - 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$b), { - modelValue: installPath.value, - "onUpdate:modelValue": [ - _cache[0] || (_cache[0] = ($event) => installPath.value = $event), - validatePath - ], - class: normalizeClass(["w-full", { "p-invalid": pathError.value }]) - }, null, 8, ["modelValue", "class"]), - withDirectives(createVNode(unref(script$c), { class: "pi pi-info-circle" }, null, 512), [ - [_directive_tooltip, _ctx.$t("install.installLocationTooltip")] - ]) - ]), - _: 1 - }), - createVNode(unref(script$e), { - icon: "pi pi-folder", - onClick: browsePath, - class: "w-12" - }) - ]), - pathError.value ? (openBlock(), createBlock(unref(script$f), { - key: 0, - 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$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, [ - _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")] - ]) - ]) - ]) - ]) - ]); - }; - } -}); -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 = { 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$1 = /* @__PURE__ */ defineComponent({ - __name: "MigrationPicker", - props: { - "sourcePath": { required: false }, - "sourcePathModifiers": {}, - "migrationItemIds": { - required: false - }, - "migrationItemIdsModifiers": {} - }, - emits: ["update:sourcePath", "update:migrationItemIds"], - setup(__props) { - const { t } = useI18n(); - const electron = electronAPI(); - const sourcePath = useModel(__props, "sourcePath"); - const migrationItemIds = useModel(__props, "migrationItemIds"); - const migrationItems = ref( - MigrationItems.map((item) => ({ - ...item, - selected: true - })) - ); - const pathError = ref(""); - const isValidSource = computed( - () => sourcePath.value !== "" && pathError.value === "" - ); - const validateSource = /* @__PURE__ */ __name(async (sourcePath2) => { - if (!sourcePath2) { - pathError.value = ""; - return; - } - try { - pathError.value = ""; - const validation = await electron.validateComfyUISource(sourcePath2); - if (!validation.isValid) pathError.value = validation.error; - } catch (error) { - console.error(error); - pathError.value = t("install.pathValidationFailed"); - } - }, "validateSource"); - const browsePath = /* @__PURE__ */ __name(async () => { - try { - const result = await electron.showDirectoryPicker(); - if (result) { - sourcePath.value = result; - await validateSource(result); - } - } catch (error) { - console.error(error); - pathError.value = t("install.failedToSelectDirectory"); - } - }, "browsePath"); - watchEffect(() => { - migrationItemIds.value = migrationItems.value.filter((item) => item.selected).map((item) => item.id); - }); - return (_ctx, _cache) => { - 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), - validateSource - ], - placeholder: "Select existing ComfyUI installation (optional)", - class: normalizeClass(["flex-1", { "p-invalid": pathError.value }]) - }, null, 8, ["modelValue", "class"]), - createVNode(unref(script$e), { - icon: "pi pi-folder", - onClick: browsePath, - class: "w-12" - }) - ]), - pathError.value ? (openBlock(), createBlock(unref(script$f), { - key: 0, - severity: "error" - }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(pathError.value), 1) - ]), - _: 1 - })) : createCommentVNode("", true) - ]), - 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$g), { - modelValue: item.selected, - "onUpdate:modelValue": /* @__PURE__ */ __name(($event) => item.selected = $event, "onUpdate:modelValue"), - inputId: item.id, - binary: true, - onClick: _cache[1] || (_cache[1] = withModifiers(() => { - }, ["stop"])) - }, null, 8, ["modelValue", "onUpdate:modelValue", "inputId"]), - createBaseVNode("div", null, [ - createBaseVNode("label", { - for: item.id, - class: "text-neutral-200 font-medium" - }, toDisplayString(item.label), 9, _hoisted_10), - createBaseVNode("p", _hoisted_11, toDisplayString(item.description), 1) - ]) - ], 8, _hoisted_9); - }), 128)) - ]) - ])) : (openBlock(), createElementBlock("div", _hoisted_12, toDisplayString(_ctx.$t("install.migrationOptional")), 1)) - ]); - }; - } -}); -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-0a97b0ae"), 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 handleStepChange = /* @__PURE__ */ __name((value2) => { - setHighestStep(value2); - electronAPI().Events.trackEvent("install_stepper_change", { - step: value2 - }); - }, "handleStepChange"); - 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 = { - installPath: installPath.value, - autoUpdate: autoUpdate.value, - allowMetrics: allowMetrics.value, - migrationSourcePath: migrationSourcePath.value, - 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; - } - electronAPI().Events.trackEvent("install_stepper_change", { - step: "0", - gpu: detectedGpu - }); - }); - return (_ctx, _cache) => { - return openBlock(), createBlock(_sfc_main$5, { dark: "" }, { - default: withCtx(() => [ - createVNode(unref(script), { - class: "h-full p-8 2xl:p-16", - value: "0", - "onUpdate:value": handleStepChange - }, { - 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(GpuPicker, { - 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-0a97b0ae"]]); -export { - InstallView as default -}; -//# sourceMappingURL=InstallView-By3hC1fC.js.map diff --git a/web/assets/InstallView-C6tMsokB.js b/web/assets/InstallView-C6tMsokB.js new file mode 100644 index 000000000..461781854 --- /dev/null +++ b/web/assets/InstallView-C6tMsokB.js @@ -0,0 +1,945 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { d as defineComponent, U as ref, bm as useModel, o as openBlock, f as createElementBlock, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, bn as script, bh as script$1, ar as withModifiers, z as withCtx, ab as script$2, K as useI18n, c as computed, ai as normalizeClass, B as createCommentVNode, a4 as script$3, a7 as createTextVNode, b5 as electronAPI, _ as _export_sfc, p as onMounted, r as resolveDirective, bg as script$4, i as withDirectives, bo as script$5, bp as script$6, l as script$7, y as createBlock, bj as script$8, bq as MigrationItems, w as watchEffect, F as Fragment, D as renderList, br as script$9, bs as mergeModels, bt as ValidationState, Y as normalizeI18nKey, O as watch, bu as checkMirrorReachable, bv as _sfc_main$7, bw as mergeValidationStates, bc as t, a$ as script$a, bx as CUDA_TORCH_URL, by as NIGHTLY_CPU_TORCH_URL, be as useRouter, ag as toRaw } from "./index-CmVtQCAR.js"; +import { s as script$b, a as script$c, b as script$d, c as script$e, d as script$f } from "./index-Bm1HvJhs.js"; +import { P as PYTHON_MIRROR, a as PYPI_MIRROR } from "./uvMirrors-B-HKMf6X.js"; +import { _ as _sfc_main$8 } from "./BaseViewTemplate-Cof5Ihf_.js"; +const _hoisted_1$5 = { class: "flex flex-col gap-6 w-[600px]" }; +const _hoisted_2$5 = { class: "flex flex-col gap-4" }; +const _hoisted_3$5 = { class: "text-2xl font-semibold text-neutral-100" }; +const _hoisted_4$5 = { 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$1 = { class: "text-sm text-neutral-400 mt-1" }; +const _hoisted_14$1 = { 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 _hoisted_19 = { class: "mt-4" }; +const _hoisted_20 = { + href: "https://comfy.org/privacy", + target: "_blank", + class: "text-blue-400 hover:text-blue-300 underline" +}; +const _sfc_main$6 = /* @__PURE__ */ defineComponent({ + __name: "DesktopSettingsConfiguration", + props: { + "autoUpdate": { type: Boolean, ...{ required: true } }, + "autoUpdateModifiers": {}, + "allowMetrics": { type: Boolean, ...{ 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$5, [ + createBaseVNode("div", _hoisted_2$5, [ + createBaseVNode("h2", _hoisted_3$5, toDisplayString(_ctx.$t("install.desktopAppSettings")), 1), + createBaseVNode("p", _hoisted_4$5, 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), { + modelValue: autoUpdate.value, + "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => autoUpdate.value = $event) + }, null, 8, ["modelValue"]) + ]), + createVNode(unref(script$1)), + 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$1, 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), { + modelValue: allowMetrics.value, + "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => allowMetrics.value = $event) + }, null, 8, ["modelValue"]) + ]) + ]), + createVNode(unref(script$2), { + 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$1, [ + 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.collect.errorReports")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.collect.systemInfo")), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t( + "install.settings.dataCollectionDialog.collect.userJourneyEvents" + )), 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.doNotCollect.personalInformation" + )), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t( + "install.settings.dataCollectionDialog.doNotCollect.workflowContents" + )), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t( + "install.settings.dataCollectionDialog.doNotCollect.fileSystemInformation" + )), 1), + createBaseVNode("li", null, toDisplayString(_ctx.$t( + "install.settings.dataCollectionDialog.doNotCollect.customNodeConfigurations" + )), 1) + ]), + createBaseVNode("div", _hoisted_19, [ + createBaseVNode("a", _hoisted_20, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.viewFullPolicy")), 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$4 = { class: "flex flex-col gap-6 w-[600px] h-[30rem] select-none" }; +const _hoisted_2$4 = { class: "grow flex flex-col gap-4 text-neutral-300" }; +const _hoisted_3$4 = { class: "text-2xl font-semibold text-neutral-100" }; +const _hoisted_4$4 = { class: "m-1 text-neutral-400" }; +const _hoisted_5$2 = { + key: 0, + class: "m-1" +}; +const _hoisted_6$2 = { + key: 1, + class: "m-1" +}; +const _hoisted_7$2 = { + key: 2, + class: "text-neutral-300" +}; +const _hoisted_8$2 = { class: "m-1" }; +const _hoisted_9$2 = { key: 3 }; +const _hoisted_10$2 = { class: "m-1" }; +const _hoisted_11$2 = { class: "m-1" }; +const _hoisted_12$2 = { + for: "cpu-mode", + class: "select-none" +}; +const _sfc_main$5 = /* @__PURE__ */ defineComponent({ + __name: "GpuPicker", + props: { + "device": { + required: true + }, + "deviceModifiers": {} + }, + emits: ["update:device"], + setup(__props) { + const { t: t2 } = useI18n(); + const cpuMode = computed({ + get: /* @__PURE__ */ __name(() => selected.value === "cpu", "get"), + set: /* @__PURE__ */ __name((value) => { + selected.value = value ? "cpu" : null; + }, "set") + }); + const selected = useModel(__props, "device"); + const electron = electronAPI(); + const platform = electron.getPlatform(); + const pickGpu = /* @__PURE__ */ __name((value) => { + const newValue = selected.value === value ? null : value; + selected.value = newValue; + }, "pickGpu"); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", _hoisted_1$4, [ + createBaseVNode("div", _hoisted_2$4, [ + createBaseVNode("h2", _hoisted_3$4, toDisplayString(_ctx.$t("install.gpuSelection.selectGpu")), 1), + createBaseVNode("p", _hoisted_4$4, 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")) + }, _cache[4] || (_cache[4] = [ + createBaseVNode("img", { + class: "m-12", + alt: "NVIDIA logo", + width: "196", + height: "32", + src: _imports_0 + }, null, -1) + ]), 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")) + }, _cache[5] || (_cache[5] = [ + createBaseVNode("img", { + class: "rounded-lg hover-brighten", + alt: "Apple Metal Performance Shaders Logo", + width: "292", + ratio: "", + src: _imports_1 + }, null, -1) + ]), 2)) : createCommentVNode("", true), + createBaseVNode("div", { + class: normalizeClass(["gpu-button", { selected: selected.value === "unsupported" }]), + role: "button", + onClick: _cache[2] || (_cache[2] = ($event) => pickGpu("unsupported")) + }, _cache[6] || (_cache[6] = [ + createBaseVNode("img", { + class: "m-12", + alt: "Manual configuration", + width: "196", + src: _imports_2 + }, null, -1) + ]), 2) + ], 2), + selected.value === "nvidia" ? (openBlock(), createElementBlock("p", _hoisted_5$2, [ + createVNode(unref(script$3), { + 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_6$2, [ + createVNode(unref(script$3), { + 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_7$2, [ + createBaseVNode("p", _hoisted_8$2, [ + createVNode(unref(script$3), { + icon: "pi pi-exclamation-triangle", + severity: "warn", + value: unref(t2)("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_9$2, [ + createBaseVNode("p", _hoisted_10$2, [ + createVNode(unref(script$3), { + icon: "pi pi-exclamation-triangle", + severity: "warn", + value: unref(t2)("icon.exclamation-triangle") + }, null, 8, ["value"]), + createTextVNode(" " + toDisplayString(_ctx.$t("install.gpuSelection.cpuModeDescription")), 1) + ]), + createBaseVNode("p", _hoisted_11$2, 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), { + 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_12$2, toDisplayString(_ctx.$t("install.gpuSelection.enableCpuMode")), 1) + ], 2) + ]); + }; + } +}); +const GpuPicker = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-79125ff6"]]); +const _hoisted_1$3 = { class: "flex flex-col gap-6 w-[600px]" }; +const _hoisted_2$3 = { class: "flex flex-col gap-4" }; +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$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 = { class: "text-neutral-200" }; +const _hoisted_11$1 = { class: "pi pi-info-circle" }; +const _hoisted_12$1 = { class: "flex items-center gap-2" }; +const _hoisted_13 = { class: "text-neutral-200" }; +const _hoisted_14 = { class: "pi pi-info-circle" }; +const _sfc_main$4 = /* @__PURE__ */ defineComponent({ + __name: "InstallLocationPicker", + props: { + "installPath": { required: true }, + "installPathModifiers": {}, + "pathError": { required: true }, + "pathErrorModifiers": {} + }, + emits: ["update:installPath", "update:pathError"], + setup(__props) { + const { t: t2 } = useI18n(); + const installPath = useModel(__props, "installPath"); + const pathError = useModel(__props, "pathError"); + const pathExists = ref(false); + const appData = ref(""); + const appPath = ref(""); + const electron = electronAPI(); + onMounted(async () => { + const paths = await electron.getSystemPaths(); + appData.value = paths.appData; + appPath.value = paths.appPath; + installPath.value = paths.defaultInstallPath; + await validatePath(paths.defaultInstallPath); + }); + const validatePath = /* @__PURE__ */ __name(async (path) => { + try { + pathError.value = ""; + pathExists.value = false; + const validation = await electron.validateInstallPath(path); + if (!validation.isValid) { + const errors = []; + if (validation.cannotWrite) errors.push(t2("install.cannotWrite")); + if (validation.freeSpace < validation.requiredSpace) { + const requiredGB = validation.requiredSpace / 1024 / 1024 / 1024; + errors.push(`${t2("install.insufficientFreeSpace")}: ${requiredGB} GB`); + } + if (validation.parentMissing) errors.push(t2("install.parentMissing")); + if (validation.error) + errors.push(`${t2("install.unhandledError")}: ${validation.error}`); + pathError.value = errors.join("\n"); + } + if (validation.exists) pathExists.value = true; + } catch (error) { + pathError.value = t2("install.pathValidationFailed"); + } + }, "validatePath"); + const browsePath = /* @__PURE__ */ __name(async () => { + try { + const result = await electron.showDirectoryPicker(); + if (result) { + installPath.value = result; + await validatePath(result); + } + } catch (error) { + pathError.value = t2("install.failedToSelectDirectory"); + } + }, "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$1, [ + createVNode(unref(script$6), { class: "flex-1" }, { + default: withCtx(() => [ + createVNode(unref(script$4), { + modelValue: installPath.value, + "onUpdate:modelValue": [ + _cache[0] || (_cache[0] = ($event) => installPath.value = $event), + validatePath + ], + class: normalizeClass(["w-full", { "p-invalid": pathError.value }]) + }, null, 8, ["modelValue", "class"]), + withDirectives(createVNode(unref(script$5), { class: "pi pi-info-circle" }, null, 512), [ + [_directive_tooltip, _ctx.$t("install.installLocationTooltip")] + ]) + ]), + _: 1 + }), + createVNode(unref(script$7), { + icon: "pi pi-folder", + onClick: browsePath, + class: "w-12" + }) + ]), + pathError.value ? (openBlock(), createBlock(unref(script$8), { + key: 0, + severity: "error", + class: "whitespace-pre-line" + }, { + default: withCtx(() => [ + createTextVNode(toDisplayString(pathError.value), 1) + ]), + _: 1 + })) : createCommentVNode("", true), + pathExists.value ? (openBlock(), createBlock(unref(script$8), { + key: 1, + severity: "warn" + }, { + default: withCtx(() => [ + createTextVNode(toDisplayString(_ctx.$t("install.pathExists")), 1) + ]), + _: 1 + })) : createCommentVNode("", true) + ]), + 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, [ + _cache[1] || (_cache[1] = createBaseVNode("i", { class: "pi pi-folder text-neutral-400" }, null, -1)), + _cache[2] || (_cache[2] = createBaseVNode("span", { class: "text-neutral-400" }, "App Data:", -1)), + createBaseVNode("span", _hoisted_10$1, toDisplayString(appData.value), 1), + withDirectives(createBaseVNode("span", _hoisted_11$1, null, 512), [ + [_directive_tooltip, _ctx.$t("install.appDataLocationTooltip")] + ]) + ]), + createBaseVNode("div", _hoisted_12$1, [ + _cache[3] || (_cache[3] = createBaseVNode("i", { class: "pi pi-desktop text-neutral-400" }, null, -1)), + _cache[4] || (_cache[4] = createBaseVNode("span", { class: "text-neutral-400" }, "App Path:", -1)), + createBaseVNode("span", _hoisted_13, toDisplayString(appPath.value), 1), + withDirectives(createBaseVNode("span", _hoisted_14, null, 512), [ + [_directive_tooltip, _ctx.$t("install.appPathLocationTooltip")] + ]) + ]) + ]) + ]) + ]); + }; + } +}); +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 = { 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 = { 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$3 = /* @__PURE__ */ defineComponent({ + __name: "MigrationPicker", + props: { + "sourcePath": { required: false }, + "sourcePathModifiers": {}, + "migrationItemIds": { + required: false + }, + "migrationItemIdsModifiers": {} + }, + emits: ["update:sourcePath", "update:migrationItemIds"], + setup(__props) { + const { t: t2 } = useI18n(); + const electron = electronAPI(); + const sourcePath = useModel(__props, "sourcePath"); + const migrationItemIds = useModel(__props, "migrationItemIds"); + const migrationItems = ref( + MigrationItems.map((item) => ({ + ...item, + selected: true + })) + ); + const pathError = ref(""); + const isValidSource = computed( + () => sourcePath.value !== "" && pathError.value === "" + ); + const validateSource = /* @__PURE__ */ __name(async (sourcePath2) => { + if (!sourcePath2) { + pathError.value = ""; + return; + } + try { + pathError.value = ""; + const validation = await electron.validateComfyUISource(sourcePath2); + if (!validation.isValid) pathError.value = validation.error; + } catch (error) { + console.error(error); + pathError.value = t2("install.pathValidationFailed"); + } + }, "validateSource"); + const browsePath = /* @__PURE__ */ __name(async () => { + try { + const result = await electron.showDirectoryPicker(); + if (result) { + sourcePath.value = result; + await validateSource(result); + } + } catch (error) { + console.error(error); + pathError.value = t2("install.failedToSelectDirectory"); + } + }, "browsePath"); + watchEffect(() => { + 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, [ + createVNode(unref(script$4), { + modelValue: sourcePath.value, + "onUpdate:modelValue": [ + _cache[0] || (_cache[0] = ($event) => sourcePath.value = $event), + validateSource + ], + placeholder: "Select existing ComfyUI installation (optional)", + class: normalizeClass(["flex-1", { "p-invalid": pathError.value }]) + }, null, 8, ["modelValue", "class"]), + createVNode(unref(script$7), { + icon: "pi pi-folder", + onClick: browsePath, + class: "w-12" + }) + ]), + pathError.value ? (openBlock(), createBlock(unref(script$8), { + key: 0, + severity: "error" + }, { + default: withCtx(() => [ + createTextVNode(toDisplayString(pathError.value), 1) + ]), + _: 1 + })) : createCommentVNode("", true) + ]), + 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$9), { + modelValue: item.selected, + "onUpdate:modelValue": /* @__PURE__ */ __name(($event) => item.selected = $event, "onUpdate:modelValue"), + inputId: item.id, + binary: true, + onClick: _cache[1] || (_cache[1] = withModifiers(() => { + }, ["stop"])) + }, null, 8, ["modelValue", "onUpdate:modelValue", "inputId"]), + createBaseVNode("div", null, [ + createBaseVNode("label", { + for: item.id, + class: "text-neutral-200 font-medium" + }, toDisplayString(item.label), 9, _hoisted_10), + createBaseVNode("p", _hoisted_11, toDisplayString(item.description), 1) + ]) + ], 8, _hoisted_9); + }), 128)) + ]) + ])) : (openBlock(), createElementBlock("div", _hoisted_12, toDisplayString(_ctx.$t("install.migrationOptional")), 1)) + ]); + }; + } +}); +const _hoisted_1$1 = { class: "flex flex-col items-center gap-4" }; +const _hoisted_2$1 = { class: "w-full" }; +const _hoisted_3$1 = { class: "text-lg font-medium text-neutral-100" }; +const _hoisted_4$1 = { class: "text-sm text-neutral-400 mt-1" }; +const _sfc_main$2 = /* @__PURE__ */ defineComponent({ + __name: "MirrorItem", + props: /* @__PURE__ */ mergeModels({ + item: {} + }, { + "modelValue": { required: true }, + "modelModifiers": {} + }), + emits: /* @__PURE__ */ mergeModels(["state-change"], ["update:modelValue"]), + setup(__props, { emit: __emit }) { + const emit = __emit; + const modelValue = useModel(__props, "modelValue"); + const validationState = ref(ValidationState.IDLE); + const normalizedSettingId = computed(() => { + return normalizeI18nKey(__props.item.settingId); + }); + onMounted(() => { + modelValue.value = __props.item.mirror; + }); + watch(validationState, (newState) => { + emit("state-change", newState); + if (newState === ValidationState.INVALID && modelValue.value === __props.item.mirror) { + modelValue.value = __props.item.fallbackMirror; + } + }); + return (_ctx, _cache) => { + const _component_UrlInput = _sfc_main$7; + return openBlock(), createElementBlock("div", _hoisted_1$1, [ + createBaseVNode("div", _hoisted_2$1, [ + createBaseVNode("h3", _hoisted_3$1, toDisplayString(_ctx.$t(`settings.${normalizedSettingId.value}.name`)), 1), + createBaseVNode("p", _hoisted_4$1, toDisplayString(_ctx.$t(`settings.${normalizedSettingId.value}.tooltip`)), 1) + ]), + createVNode(_component_UrlInput, { + modelValue: modelValue.value, + "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event), + "validate-url-fn": /* @__PURE__ */ __name((mirror) => unref(checkMirrorReachable)(mirror + (_ctx.item.validationPathSuffix ?? "")), "validate-url-fn"), + onStateChange: _cache[1] || (_cache[1] = ($event) => validationState.value = $event) + }, null, 8, ["modelValue", "validate-url-fn"]) + ]); + }; + } +}); +const _sfc_main$1 = /* @__PURE__ */ defineComponent({ + __name: "MirrorsConfiguration", + props: /* @__PURE__ */ mergeModels({ + device: {} + }, { + "pythonMirror": { required: true }, + "pythonMirrorModifiers": {}, + "pypiMirror": { required: true }, + "pypiMirrorModifiers": {}, + "torchMirror": { required: true }, + "torchMirrorModifiers": {} + }), + emits: ["update:pythonMirror", "update:pypiMirror", "update:torchMirror"], + setup(__props) { + const showMirrorInputs = ref(false); + const pythonMirror = useModel(__props, "pythonMirror"); + const pypiMirror = useModel(__props, "pypiMirror"); + const torchMirror = useModel(__props, "torchMirror"); + const getTorchMirrorItem = /* @__PURE__ */ __name((device) => { + const settingId = "Comfy-Desktop.UV.TorchInstallMirror"; + switch (device) { + case "mps": + return { + settingId, + mirror: NIGHTLY_CPU_TORCH_URL, + fallbackMirror: NIGHTLY_CPU_TORCH_URL + }; + case "nvidia": + return { + settingId, + mirror: CUDA_TORCH_URL, + fallbackMirror: CUDA_TORCH_URL + }; + case "cpu": + default: + return { + settingId, + mirror: PYPI_MIRROR.mirror, + fallbackMirror: PYPI_MIRROR.fallbackMirror + }; + } + }, "getTorchMirrorItem"); + const mirrors = computed(() => [ + [PYTHON_MIRROR, pythonMirror], + [PYPI_MIRROR, pypiMirror], + [getTorchMirrorItem(__props.device), torchMirror] + ]); + const validationStates = ref( + mirrors.value.map(() => ValidationState.IDLE) + ); + const validationState = computed(() => { + return mergeValidationStates(validationStates.value); + }); + const validationStateTooltip = computed(() => { + switch (validationState.value) { + case ValidationState.INVALID: + return t("install.settings.mirrorsUnreachable"); + case ValidationState.VALID: + return t("install.settings.mirrorsReachable"); + default: + return t("install.settings.checkingMirrors"); + } + }); + return (_ctx, _cache) => { + const _directive_tooltip = resolveDirective("tooltip"); + return openBlock(), createBlock(unref(script$a), { + header: _ctx.$t("install.settings.mirrorSettings"), + toggleable: "", + collapsed: !showMirrorInputs.value, + "pt:root": "bg-neutral-800 border-none w-[600px]" + }, { + icons: withCtx(() => [ + withDirectives(createBaseVNode("i", { + class: normalizeClass({ + "pi pi-spin pi-spinner text-neutral-400": validationState.value === unref(ValidationState).LOADING, + "pi pi-check text-green-500": validationState.value === unref(ValidationState).VALID, + "pi pi-times text-red-500": validationState.value === unref(ValidationState).INVALID + }) + }, null, 2), [ + [_directive_tooltip, validationStateTooltip.value] + ]) + ]), + default: withCtx(() => [ + (openBlock(true), createElementBlock(Fragment, null, renderList(mirrors.value, ([item, modelValue], index) => { + return openBlock(), createElementBlock(Fragment, { + key: item.settingId + item.mirror + }, [ + index > 0 ? (openBlock(), createBlock(unref(script$1), { key: 0 })) : createCommentVNode("", true), + createVNode(_sfc_main$2, { + item, + modelValue: modelValue.value, + "onUpdate:modelValue": /* @__PURE__ */ __name(($event) => modelValue.value = $event, "onUpdate:modelValue"), + onStateChange: /* @__PURE__ */ __name(($event) => validationStates.value[index] = $event, "onStateChange") + }, null, 8, ["item", "modelValue", "onUpdate:modelValue", "onStateChange"]) + ], 64); + }), 128)) + ]), + _: 1 + }, 8, ["header", "collapsed"]); + }; + } +}); +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 mt-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 pythonMirror = ref(""); + const pypiMirror = ref(""); + const torchMirror = ref(""); + const highestStep = ref(0); + const handleStepChange = /* @__PURE__ */ __name((value) => { + setHighestStep(value); + electronAPI().Events.trackEvent("install_stepper_change", { + step: value + }); + }, "handleStepChange"); + const setHighestStep = /* @__PURE__ */ __name((value) => { + const int = typeof value === "number" ? value : parseInt(value, 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 = { + installPath: installPath.value, + autoUpdate: autoUpdate.value, + allowMetrics: allowMetrics.value, + migrationSourcePath: migrationSourcePath.value, + migrationItemIds: toRaw(migrationItemIds.value), + pythonMirror: pythonMirror.value, + pypiMirror: pypiMirror.value, + torchMirror: torchMirror.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; + } + electronAPI().Events.trackEvent("install_stepper_change", { + step: "0", + gpu: detectedGpu + }); + }); + return (_ctx, _cache) => { + return openBlock(), createBlock(_sfc_main$8, { dark: "" }, { + default: withCtx(() => [ + createVNode(unref(script$f), { + class: "h-full p-8 2xl:p-16", + value: "0", + "onUpdate:value": handleStepChange + }, { + default: withCtx(() => [ + createVNode(unref(script$b), { class: "select-none" }, { + default: withCtx(() => [ + createVNode(unref(script$c), { value: "0" }, { + default: withCtx(() => [ + createTextVNode(toDisplayString(_ctx.$t("install.gpu")), 1) + ]), + _: 1 + }), + createVNode(unref(script$c), { + value: "1", + disabled: noGpu.value + }, { + default: withCtx(() => [ + createTextVNode(toDisplayString(_ctx.$t("install.installLocation")), 1) + ]), + _: 1 + }, 8, ["disabled"]), + createVNode(unref(script$c), { + 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$c), { + 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$d), null, { + default: withCtx(() => [ + createVNode(unref(script$e), { value: "0" }, { + default: withCtx(({ activateCallback }) => [ + createVNode(GpuPicker, { + device: device.value, + "onUpdate:device": _cache[0] || (_cache[0] = ($event) => device.value = $event) + }, null, 8, ["device"]), + createBaseVNode("div", _hoisted_1, [ + createVNode(unref(script$7), { + 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$e), { value: "1" }, { + default: withCtx(({ activateCallback }) => [ + createVNode(_sfc_main$4, { + 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$7), { + 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$7), { + 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$e), { value: "2" }, { + default: withCtx(({ activateCallback }) => [ + createVNode(_sfc_main$3, { + 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$7), { + 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$7), { + 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$e), { value: "3" }, { + default: withCtx(({ activateCallback }) => [ + createVNode(_sfc_main$6, { + 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"]), + createVNode(_sfc_main$1, { + device: device.value, + pythonMirror: pythonMirror.value, + "onUpdate:pythonMirror": _cache[7] || (_cache[7] = ($event) => pythonMirror.value = $event), + pypiMirror: pypiMirror.value, + "onUpdate:pypiMirror": _cache[8] || (_cache[8] = ($event) => pypiMirror.value = $event), + torchMirror: torchMirror.value, + "onUpdate:torchMirror": _cache[9] || (_cache[9] = ($event) => torchMirror.value = $event), + class: "mt-6" + }, null, 8, ["device", "pythonMirror", "pypiMirror", "torchMirror"]), + createBaseVNode("div", _hoisted_4, [ + createVNode(unref(script$7), { + 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$7), { + label: _ctx.$t("g.install"), + icon: "pi pi-check", + iconPos: "right", + disabled: hasError.value, + onClick: _cache[10] || (_cache[10] = ($event) => install()) + }, null, 8, ["label", "disabled"]) + ]) + ]), + _: 1 + }) + ]), + _: 1 + }) + ]), + _: 1 + }) + ]), + _: 1 + }); + }; + } +}); +const InstallView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cd6731d2"]]); +export { + InstallView as default +}; +//# sourceMappingURL=InstallView-C6tMsokB.js.map diff --git a/web/assets/InstallView-CxhfFC8Y.css b/web/assets/InstallView-DbJ2cGfL.css similarity index 93% rename from web/assets/InstallView-CxhfFC8Y.css rename to web/assets/InstallView-DbJ2cGfL.css index a406c8695..5bbebb809 100644 --- a/web/assets/InstallView-CxhfFC8Y.css +++ b/web/assets/InstallView-DbJ2cGfL.css @@ -2,11 +2,13 @@ .p-tag[data-v-79125ff6] { --p-tag-gap: 0.5rem; } -.hover-brighten[data-v-79125ff6] { +.hover-brighten { +&[data-v-79125ff6] { 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; + } &[data-v-79125ff6]:hover { filter: brightness(107%) contrast(105%); box-shadow: 0 0 0.25rem #ffffff79; @@ -20,7 +22,7 @@ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; } -div.selected[data-v-79125ff6] { +div.selected { .gpu-button[data-v-79125ff6]:not(.selected) { opacity: 0.5; } @@ -46,7 +48,7 @@ div.selected[data-v-79125ff6] { .gpu-button[data-v-79125ff6]:hover { --tw-bg-opacity: 0.75; } -.gpu-button[data-v-79125ff6] { +.gpu-button { &.selected[data-v-79125ff6] { --tw-bg-opacity: 1; background-color: rgb(64 64 64 / var(--tw-bg-opacity)); @@ -74,6 +76,6 @@ div.selected[data-v-79125ff6] { text-align: center; } -[data-v-0a97b0ae] .p-steppanel { +[data-v-cd6731d2] .p-steppanel { background-color: transparent } diff --git a/web/assets/KeybindingPanel-D6O16W_1.js b/web/assets/KeybindingPanel-BbfXtVg1.js similarity index 91% rename from web/assets/KeybindingPanel-D6O16W_1.js rename to web/assets/KeybindingPanel-BbfXtVg1.js index b0fbfd845..1cff94939 100644 --- a/web/assets/KeybindingPanel-D6O16W_1.js +++ b/web/assets/KeybindingPanel-BbfXtVg1.js @@ -1,9 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, H as Fragment, I as renderList, k as createVNode, P as withCtx, aG as createTextVNode, Z as toDisplayString, j as unref, aK as script, L as createCommentVNode, ad as ref, cu as FilterMatchMode, a$ as useKeybindingStore, a4 as useCommandStore, a3 as useI18n, ah as normalizeI18nKey, w as watchEffect, bz as useToast, r as resolveDirective, J as createBlock, cv as SearchBox, m as createBaseVNode, l as script$2, ax as script$4, b3 as withModifiers, c6 as script$5, aP as script$6, i as withDirectives, cw as _sfc_main$2, p as pushScopeId, q as popScopeId, cx as KeyComboImpl, cy as KeybindingImpl, _ as _export_sfc } from "./index-QvfM__ze.js"; -import { s as script$1, a as script$3 } from "./index-DpF-ptbJ.js"; -import { u as useKeybindingService } from "./keybindingService-Cak1En5n.js"; -import "./index-Q1cQr26V.js"; +import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, D as renderList, k as createVNode, z as withCtx, a7 as createTextVNode, E as toDisplayString, j as unref, a4 as script, B as createCommentVNode, U as ref, dl as FilterMatchMode, an as useKeybindingStore, L as useCommandStore, K as useI18n, Y as normalizeI18nKey, w as watchEffect, aR as useToast, r as resolveDirective, y as createBlock, dm as SearchBox, m as createBaseVNode, l as script$2, bg as script$4, ar as withModifiers, bj as script$5, ab as script$6, i as withDirectives, dn as _sfc_main$2, dp as KeyComboImpl, dq as KeybindingImpl, _ as _export_sfc } from "./index-CmVtQCAR.js"; +import { g as script$1, h as script$3 } from "./index-CdHVC5qq.js"; +import { u as useKeybindingService } from "./keybindingService-CqSjCYw-.js"; +import "./index-I0brO37W.js"; const _hoisted_1$1 = { key: 0, class: "px-2" @@ -36,7 +36,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ }; } }); -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 }; @@ -247,7 +246,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ severity: "error" }, { default: withCtx(() => [ - createTextVNode(" Keybinding already exists on "), + _cache[3] || (_cache[3] = createTextVNode(" Keybinding already exists on ")), createVNode(unref(script), { severity: "secondary", value: existingKeybindingOnCombo.value.commandId @@ -280,4 +279,4 @@ const KeybindingPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { KeybindingPanel as default }; -//# sourceMappingURL=KeybindingPanel-D6O16W_1.js.map +//# sourceMappingURL=KeybindingPanel-BbfXtVg1.js.map diff --git a/web/assets/MaintenanceView-Bj5_Vr6o.css b/web/assets/MaintenanceView-Bj5_Vr6o.css new file mode 100644 index 000000000..22e37c41d --- /dev/null +++ b/web/assets/MaintenanceView-Bj5_Vr6o.css @@ -0,0 +1,87 @@ + +.task-card-ok[data-v-c3bd7658] { + + position: absolute; + + right: -1rem; + + bottom: -1rem; + + grid-column: 1 / -1; + + grid-row: 1 / -1; + + --tw-text-opacity: 1; + + color: rgb(150 206 76 / var(--tw-text-opacity)); + + opacity: 1; + + transition-property: opacity; + + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + + transition-duration: 150ms; + + font-size: 4rem; + text-shadow: 0.25rem 0 0.5rem black; + z-index: 10; +} +.p-card { +&[data-v-c3bd7658] { + + transition-property: opacity; + + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + + transition-duration: 150ms; + + --p-card-background: var(--p-button-secondary-background); + opacity: 0.9; + } +&.opacity-65[data-v-c3bd7658] { + opacity: 0.4; +} +&[data-v-c3bd7658]:hover { + opacity: 1; +} +} +[data-v-c3bd7658] .p-card-header { + z-index: 0; +} +[data-v-c3bd7658] .p-card-body { + z-index: 1; + flex-grow: 1; + justify-content: space-between; +} +.task-div { +> i[data-v-c3bd7658] { + pointer-events: none; +} +&:hover > i[data-v-c3bd7658] { + opacity: 0.2; +} +} + +[data-v-74b78f7d] .p-tag { + --p-tag-gap: 0.375rem; +} +.backspan[data-v-74b78f7d]::before { + position: absolute; + margin: 0px; + color: var(--p-text-muted-color); + font-family: 'primeicons'; + top: -2rem; + right: -2rem; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + display: inline-block; + -webkit-font-smoothing: antialiased; + opacity: 0.02; + font-size: min(14rem, 90vw); + z-index: 0; +} diff --git a/web/assets/MaintenanceView-D3drnrFc.js b/web/assets/MaintenanceView-D3drnrFc.js new file mode 100644 index 000000000..e54bc0276 --- /dev/null +++ b/web/assets/MaintenanceView-D3drnrFc.js @@ -0,0 +1,26033 @@ +var __defProp = Object.defineProperty; +var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); +import { bA as BaseStyle, bB as script$1d, bC as ZIndex, bD as addClass, bE as focus, bF as blockBodyScroll, bG as unblockBodyScroll, bH as FocusTrap, l as script$1e, bI as script$1f, bJ as script$1g, bK as resolveComponent, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, f as createElementBlock, as as mergeProps, k as createVNode, bL as Transition, i as withDirectives, A as renderSlot, F as Fragment, m as createBaseVNode, ai as normalizeClass, E as toDisplayString, B as createCommentVNode, C as resolveDynamicComponent, d as defineComponent, bs as mergeModels, bm as useModel, v as vShow, j as unref, bM as script$1h, c as computed, bN as PrimeIcons, bc as t, a4 as script$1i, aZ as inject, bO as findSingle, bP as getAttribute, bQ as script$1j, bR as script$1k, bS as Ripple, bT as UniqueComponentId, bU as script$1l, D as renderList, bV as BaseDirective, bW as removeClass, bX as createElement, bY as hasClass, bZ as script$1m, b_ as script$1n, b$ as addStyle, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, c2 as relativePosition, c3 as getOuterWidth, c4 as absolutePosition, c5 as find, c6 as getIndex, c7 as getFocusableElements, c8 as OverlayEventBus, c9 as setAttribute, ca as localeComparator, bg as script$1o, cb as script$1p, n as normalizeStyle, a7 as createTextVNode, bf as withKeys, cc as resolveFieldData, cd as isNotEmpty, ce as equals, cf as script$1q, cg as isString, ch as isPrintableCharacter, ci as isEmpty, cj as findLastIndex, ck as script$1r, cl as script$1s, cm as uuid, a8 as script$1t, cn as sort, co as createSlots, cp as EventBus, H as markRaw, cq as resolve, cr as Tooltip, bi as script$1v, ab as script$1w, cs as script$1x, ct as script$1y, cu as script$1z, bz as script$1A, bj as script$1B, cv as normalizeProps, cw as isAttributeEquals, cx as guardReactiveProps, cy as setCSSProperty, cz as $dt, cA as script$1D, cB as script$1F, cC as getUserAgent, bn as script$1G, cD as script$1H, cE as getFirstFocusableElement, cF as getLastFocusableElement, cG as FilterService, br as script$1J, cH as script$1K, bp as script$1L, bo as script$1M, cI as script$1N, cJ as findIndexInList, cK as scrollInView, cL as script$1O, cM as script$1P, cN as script$1Q, cO as findLast, cP as getWindowScrollTop, cQ as getWidth, cR as getOffset, cS as vModelText, cT as script$1U, ar as withModifiers, cU as getVNodeProp, cV as getNextElementSibling, cW as getPreviousElementSibling, cX as isClickable, cY as _default, cZ as clearSelection, c_ as isRTL, b5 as electronAPI, I as defineStore, U as ref, c$ as useTimeout, O as watch, d0 as script$1Y, _ as _export_sfc, aR as useToast, d1 as useConfirm, bh as script$1Z, d2 as script$1_, p as onMounted, d3 as onUnmounted, av as script$1$, af as isRef, bl as BaseTerminal } from "./index-CmVtQCAR.js"; +import { j as script$1C, k as script$1E, g as script$20 } from "./index-BWow9lpT.js"; +import { s as script$1u, a as script$1R, b as script$1S, c as script$1T, d as script$1V, e as script$1W, f as script$1X } from "./index-CdHVC5qq.js"; +import { s as script$1I } from "./index-I0brO37W.js"; +import "./index-Bm1HvJhs.js"; +import { _ as _sfc_main$7 } from "./BaseViewTemplate-Cof5Ihf_.js"; +var theme$D = /* @__PURE__ */ __name(function theme(_ref) { + var dt = _ref.dt; + return "\n.p-drawer {\n display: flex;\n flex-direction: column;\n transform: translate3d(0px, 0px, 0px);\n position: relative;\n transition: transform 0.3s;\n background: ".concat(dt("drawer.background"), ";\n color: ").concat(dt("drawer.color"), ";\n border: 1px solid ").concat(dt("drawer.border.color"), ";\n box-shadow: ").concat(dt("drawer.shadow"), ";\n}\n\n.p-drawer-content {\n overflow-y: auto;\n flex-grow: 1;\n padding: ").concat(dt("drawer.content.padding"), ";\n}\n\n.p-drawer-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-shrink: 0;\n padding: ").concat(dt("drawer.header.padding"), ";\n}\n\n.p-drawer-footer {\n padding: ").concat(dt("drawer.footer.padding"), ";\n}\n\n.p-drawer-title {\n font-weight: ").concat(dt("drawer.title.font.weight"), ";\n font-size: ").concat(dt("drawer.title.font.size"), ";\n}\n\n.p-drawer-full .p-drawer {\n transition: none;\n transform: none;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n border-width: 1px;\n}\n\n.p-drawer-left .p-drawer-enter-from,\n.p-drawer-left .p-drawer-leave-to {\n transform: translateX(-100%);\n}\n\n.p-drawer-right .p-drawer-enter-from,\n.p-drawer-right .p-drawer-leave-to {\n transform: translateX(100%);\n}\n\n.p-drawer-top .p-drawer-enter-from,\n.p-drawer-top .p-drawer-leave-to {\n transform: translateY(-100%);\n}\n\n.p-drawer-bottom .p-drawer-enter-from,\n.p-drawer-bottom .p-drawer-leave-to {\n transform: translateY(100%);\n}\n\n.p-drawer-full .p-drawer-enter-from,\n.p-drawer-full .p-drawer-leave-to {\n opacity: 0;\n}\n\n.p-drawer-full .p-drawer-enter-active,\n.p-drawer-full .p-drawer-leave-active {\n transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n.p-drawer-left .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-end-width: 1px;\n}\n\n.p-drawer-right .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-start-width: 1px;\n}\n\n.p-drawer-top .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-end-width: 1px;\n}\n\n.p-drawer-bottom .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-start-width: 1px;\n}\n\n.p-drawer-left .p-drawer-content,\n.p-drawer-right .p-drawer-content,\n.p-drawer-top .p-drawer-content,\n.p-drawer-bottom .p-drawer-content {\n width: 100%;\n height: 100%;\n}\n\n.p-drawer-open {\n display: flex;\n}\n\n.p-drawer-mask:dir(rtl) {\n flex-direction: row-reverse;\n}\n"); +}, "theme"); +var inlineStyles$9 = { + mask: /* @__PURE__ */ __name(function mask(_ref2) { + var position = _ref2.position, modal = _ref2.modal; + return { + position: "fixed", + height: "100%", + width: "100%", + left: 0, + top: 0, + display: "flex", + justifyContent: position === "left" ? "flex-start" : position === "right" ? "flex-end" : "center", + alignItems: position === "top" ? "flex-start" : position === "bottom" ? "flex-end" : "center", + pointerEvents: modal ? "auto" : "none" + }; + }, "mask"), + root: { + pointerEvents: "auto" + } +}; +var classes$M = { + mask: /* @__PURE__ */ __name(function mask2(_ref3) { + var instance = _ref3.instance, props = _ref3.props; + var positions = ["left", "right", "top", "bottom"]; + var pos = positions.find(function(item8) { + return item8 === props.position; + }); + return ["p-drawer-mask", { + "p-overlay-mask p-overlay-mask-enter": props.modal, + "p-drawer-open": instance.containerVisible, + "p-drawer-full": instance.fullScreen + }, pos ? "p-drawer-".concat(pos) : ""]; + }, "mask"), + root: /* @__PURE__ */ __name(function root(_ref4) { + var instance = _ref4.instance; + return ["p-drawer p-component", { + "p-drawer-full": instance.fullScreen + }]; + }, "root"), + header: "p-drawer-header", + title: "p-drawer-title", + pcCloseButton: "p-drawer-close-button", + content: "p-drawer-content", + footer: "p-drawer-footer" +}; +var DrawerStyle = BaseStyle.extend({ + name: "drawer", + theme: theme$D, + classes: classes$M, + inlineStyles: inlineStyles$9 +}); +var script$1$O = { + name: "BaseDrawer", + "extends": script$1d, + props: { + visible: { + type: Boolean, + "default": false + }, + position: { + type: String, + "default": "left" + }, + header: { + type: null, + "default": null + }, + baseZIndex: { + type: Number, + "default": 0 + }, + autoZIndex: { + type: Boolean, + "default": true + }, + dismissable: { + type: Boolean, + "default": true + }, + showCloseIcon: { + type: Boolean, + "default": true + }, + closeButtonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default2() { + return { + severity: "secondary", + text: true, + rounded: true + }; + }, "_default") + }, + closeIcon: { + type: String, + "default": void 0 + }, + modal: { + type: Boolean, + "default": true + }, + blockScroll: { + type: Boolean, + "default": false + } + }, + style: DrawerStyle, + provide: /* @__PURE__ */ __name(function provide() { + return { + $pcDrawer: this, + $parentInstance: this + }; + }, "provide") +}; +var script$1c = { + name: "Drawer", + "extends": script$1$O, + inheritAttrs: false, + emits: ["update:visible", "show", "after-show", "hide", "after-hide"], + data: /* @__PURE__ */ __name(function data() { + return { + containerVisible: this.visible + }; + }, "data"), + container: null, + mask: null, + content: null, + headerContainer: null, + footerContainer: null, + closeButton: null, + outsideClickListener: null, + documentKeydownListener: null, + watch: { + dismissable: /* @__PURE__ */ __name(function dismissable(newValue) { + if (newValue) { + this.enableDocumentSettings(); + } else { + this.disableDocumentSettings(); + } + }, "dismissable") + }, + updated: /* @__PURE__ */ __name(function updated() { + if (this.visible) { + this.containerVisible = this.visible; + } + }, "updated"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount() { + this.disableDocumentSettings(); + if (this.mask && this.autoZIndex) { + ZIndex.clear(this.mask); + } + this.container = null; + this.mask = null; + }, "beforeUnmount"), + methods: { + hide: /* @__PURE__ */ __name(function hide() { + this.$emit("update:visible", false); + }, "hide"), + onEnter: /* @__PURE__ */ __name(function onEnter() { + this.$emit("show"); + this.focus(); + this.bindDocumentKeyDownListener(); + if (this.autoZIndex) { + ZIndex.set("modal", this.mask, this.baseZIndex || this.$primevue.config.zIndex.modal); + } + }, "onEnter"), + onAfterEnter: /* @__PURE__ */ __name(function onAfterEnter() { + this.enableDocumentSettings(); + this.$emit("after-show"); + }, "onAfterEnter"), + onBeforeLeave: /* @__PURE__ */ __name(function onBeforeLeave() { + if (this.modal) { + !this.isUnstyled && addClass(this.mask, "p-overlay-mask-leave"); + } + }, "onBeforeLeave"), + onLeave: /* @__PURE__ */ __name(function onLeave() { + this.$emit("hide"); + }, "onLeave"), + onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave() { + if (this.autoZIndex) { + ZIndex.clear(this.mask); + } + this.unbindDocumentKeyDownListener(); + this.containerVisible = false; + this.disableDocumentSettings(); + this.$emit("after-hide"); + }, "onAfterLeave"), + onMaskClick: /* @__PURE__ */ __name(function onMaskClick(event2) { + if (this.dismissable && this.modal && this.mask === event2.target) { + this.hide(); + } + }, "onMaskClick"), + focus: /* @__PURE__ */ __name(function focus$1() { + var findFocusableElement = /* @__PURE__ */ __name(function findFocusableElement2(container) { + return container && container.querySelector("[autofocus]"); + }, "findFocusableElement"); + var focusTarget = this.$slots.header && findFocusableElement(this.headerContainer); + if (!focusTarget) { + focusTarget = this.$slots["default"] && findFocusableElement(this.container); + if (!focusTarget) { + focusTarget = this.$slots.footer && findFocusableElement(this.footerContainer); + if (!focusTarget) { + focusTarget = this.closeButton; + } + } + } + focusTarget && focus(focusTarget); + }, "focus$1"), + enableDocumentSettings: /* @__PURE__ */ __name(function enableDocumentSettings() { + if (this.dismissable && !this.modal) { + this.bindOutsideClickListener(); + } + if (this.blockScroll) { + blockBodyScroll(); + } + }, "enableDocumentSettings"), + disableDocumentSettings: /* @__PURE__ */ __name(function disableDocumentSettings() { + this.unbindOutsideClickListener(); + if (this.blockScroll) { + unblockBodyScroll(); + } + }, "disableDocumentSettings"), + onKeydown: /* @__PURE__ */ __name(function onKeydown(event2) { + if (event2.code === "Escape") { + this.hide(); + } + }, "onKeydown"), + containerRef: /* @__PURE__ */ __name(function containerRef(el) { + this.container = el; + }, "containerRef"), + maskRef: /* @__PURE__ */ __name(function maskRef(el) { + this.mask = el; + }, "maskRef"), + contentRef: /* @__PURE__ */ __name(function contentRef(el) { + this.content = el; + }, "contentRef"), + headerContainerRef: /* @__PURE__ */ __name(function headerContainerRef(el) { + this.headerContainer = el; + }, "headerContainerRef"), + footerContainerRef: /* @__PURE__ */ __name(function footerContainerRef(el) { + this.footerContainer = el; + }, "footerContainerRef"), + closeButtonRef: /* @__PURE__ */ __name(function closeButtonRef(el) { + this.closeButton = el ? el.$el : void 0; + }, "closeButtonRef"), + bindDocumentKeyDownListener: /* @__PURE__ */ __name(function bindDocumentKeyDownListener() { + if (!this.documentKeydownListener) { + this.documentKeydownListener = this.onKeydown; + document.addEventListener("keydown", this.documentKeydownListener); + } + }, "bindDocumentKeyDownListener"), + unbindDocumentKeyDownListener: /* @__PURE__ */ __name(function unbindDocumentKeyDownListener() { + if (this.documentKeydownListener) { + document.removeEventListener("keydown", this.documentKeydownListener); + this.documentKeydownListener = null; + } + }, "unbindDocumentKeyDownListener"), + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener() { + var _this = this; + if (!this.outsideClickListener) { + this.outsideClickListener = function(event2) { + if (_this.isOutsideClicked(event2)) { + _this.hide(); + } + }; + document.addEventListener("click", this.outsideClickListener); + } + }, "bindOutsideClickListener"), + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener() { + if (this.outsideClickListener) { + document.removeEventListener("click", this.outsideClickListener); + this.outsideClickListener = null; + } + }, "unbindOutsideClickListener"), + isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked(event2) { + return this.container && !this.container.contains(event2.target); + }, "isOutsideClicked") + }, + computed: { + fullScreen: /* @__PURE__ */ __name(function fullScreen() { + return this.position === "full"; + }, "fullScreen"), + closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : void 0; + }, "closeAriaLabel") + }, + directives: { + focustrap: FocusTrap + }, + components: { + Button: script$1e, + Portal: script$1f, + TimesIcon: script$1g + } +}; +var _hoisted_1$v = ["aria-modal"]; +function render$13(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Button = resolveComponent("Button"); + var _component_Portal = resolveComponent("Portal"); + var _directive_focustrap = resolveDirective("focustrap"); + return openBlock(), createBlock(_component_Portal, null, { + "default": withCtx(function() { + return [$data.containerVisible ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: $options.maskRef, + onMousedown: _cache[0] || (_cache[0] = function() { + return $options.onMaskClick && $options.onMaskClick.apply($options, arguments); + }), + "class": _ctx.cx("mask"), + style: _ctx.sx("mask", true, { + position: _ctx.position, + modal: _ctx.modal + }) + }, _ctx.ptm("mask")), [createVNode(Transition, mergeProps({ + name: "p-drawer", + onEnter: $options.onEnter, + onAfterEnter: $options.onAfterEnter, + onBeforeLeave: $options.onBeforeLeave, + onLeave: $options.onLeave, + onAfterLeave: $options.onAfterLeave, + appear: "" + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [_ctx.visible ? withDirectives((openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: $options.containerRef, + "class": _ctx.cx("root"), + style: _ctx.sx("root"), + role: "complementary", + "aria-modal": _ctx.modal + }, _ctx.ptmi("root")), [_ctx.$slots.container ? renderSlot(_ctx.$slots, "container", { + key: 0, + closeCallback: $options.hide + }) : (openBlock(), createElementBlock(Fragment, { + key: 1 + }, [createBaseVNode("div", mergeProps({ + ref: $options.headerContainerRef, + "class": _ctx.cx("header") + }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header", { + "class": normalizeClass(_ctx.cx("title")) + }, function() { + return [_ctx.header ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("title") + }, _ctx.ptm("title")), toDisplayString(_ctx.header), 17)) : createCommentVNode("", true)]; + }), _ctx.showCloseIcon ? (openBlock(), createBlock(_component_Button, mergeProps({ + key: 0, + ref: $options.closeButtonRef, + type: "button", + "class": _ctx.cx("pcCloseButton"), + "aria-label": $options.closeAriaLabel, + unstyled: _ctx.unstyled, + onClick: $options.hide + }, _ctx.closeButtonProps, { + pt: _ctx.ptm("pcCloseButton"), + "data-pc-group-section": "iconcontainer" + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "closeicon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon ? "span" : "TimesIcon"), mergeProps({ + "class": [_ctx.closeIcon, slotProps["class"]] + }, _ctx.ptm("pcCloseButton")["icon"]), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "aria-label", "unstyled", "onClick", "pt"])) : createCommentVNode("", true)], 16), createBaseVNode("div", mergeProps({ + ref: $options.contentRef, + "class": _ctx.cx("content") + }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: $options.footerContainerRef, + "class": _ctx.cx("footer") + }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true)], 64))], 16, _hoisted_1$v)), [[_directive_focustrap]]) : createCommentVNode("", true)]; + }), + _: 3 + }, 16, ["onEnter", "onAfterEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])], 16)) : createCommentVNode("", true)]; + }), + _: 3 + }); +} +__name(render$13, "render$13"); +script$1c.render = render$13; +const _sfc_main$6 = /* @__PURE__ */ defineComponent({ + __name: "RefreshButton", + props: /* @__PURE__ */ mergeModels({ + outlined: { type: Boolean, default: true }, + disabled: { type: Boolean }, + severity: { default: "secondary" } + }, { + "modelValue": { type: Boolean, ...{ required: true } }, + "modelModifiers": {} + }), + emits: /* @__PURE__ */ mergeModels(["refresh"], ["update:modelValue"]), + setup(__props) { + const props = __props; + const active3 = useModel(__props, "modelValue"); + return (_ctx, _cache) => { + return openBlock(), createBlock(unref(script$1e), { + class: "relative p-button-icon-only", + outlined: props.outlined, + severity: props.severity, + disabled: active3.value || props.disabled, + onClick: _cache[0] || (_cache[0] = (event2) => _ctx.$emit("refresh", event2)) + }, { + default: withCtx(() => [ + createBaseVNode("span", { + class: normalizeClass(["p-button-icon pi pi-refresh transition-all", { "opacity-0": active3.value }]), + "data-pc-section": "icon" + }, null, 2), + _cache[1] || (_cache[1] = createBaseVNode("span", { + class: "p-button-label", + "data-pc-section": "label" + }, " ", -1)), + withDirectives(createVNode(unref(script$1h), { class: "absolute w-1/2 h-1/2" }, null, 512), [ + [vShow, active3.value] + ]) + ]), + _: 1 + }, 8, ["outlined", "severity", "disabled"]); + }; + } +}); +const _sfc_main$5 = /* @__PURE__ */ defineComponent({ + __name: "StatusTag", + props: { + error: { type: Boolean }, + refreshing: { type: Boolean } + }, + setup(__props) { + const props = __props; + const icon2 = computed(() => { + if (props.refreshing) return PrimeIcons.QUESTION; + if (props.error) return PrimeIcons.TIMES; + return PrimeIcons.CHECK; + }); + const severity = computed(() => { + if (props.refreshing) return "info"; + if (props.error) return "danger"; + return "success"; + }); + const value2 = computed(() => { + if (props.refreshing) return t("maintenance.refreshing"); + if (props.error) return t("g.error"); + return t("maintenance.OK"); + }); + return (_ctx, _cache) => { + return openBlock(), createBlock(unref(script$1i), { + icon: icon2.value, + severity: severity.value, + value: value2.value + }, null, 8, ["icon", "severity", "value"]); + }; + } +}); +var PrimeVueDialogSymbol = Symbol(); +function useDialog() { + var PrimeVueDialog = inject(PrimeVueDialogSymbol); + if (!PrimeVueDialog) { + throw new Error("No PrimeVue Dialog provided!"); + } + return PrimeVueDialog; +} +__name(useDialog, "useDialog"); +var classes$L = { + root: "p-accordioncontent", + content: "p-accordioncontent-content" +}; +var AccordionContentStyle = BaseStyle.extend({ + name: "accordioncontent", + classes: classes$L +}); +var script$1$N = { + name: "BaseAccordionContent", + "extends": script$1d, + props: { + as: { + type: [String, Object], + "default": "DIV" + }, + asChild: { + type: Boolean, + "default": false + } + }, + style: AccordionContentStyle, + provide: /* @__PURE__ */ __name(function provide2() { + return { + $pcAccordionContent: this, + $parentInstance: this + }; + }, "provide") +}; +var script$1b = { + name: "AccordionContent", + "extends": script$1$N, + inheritAttrs: false, + inject: ["$pcAccordion", "$pcAccordionPanel"], + computed: { + id: /* @__PURE__ */ __name(function id() { + return "".concat(this.$pcAccordion.id, "_accordioncontent_").concat(this.$pcAccordionPanel.value); + }, "id"), + ariaLabelledby: /* @__PURE__ */ __name(function ariaLabelledby() { + return "".concat(this.$pcAccordion.id, "_accordionheader_").concat(this.$pcAccordionPanel.value); + }, "ariaLabelledby"), + attrs: /* @__PURE__ */ __name(function attrs() { + return mergeProps(this.a11yAttrs, this.ptmi("root", this.ptParams)); + }, "attrs"), + a11yAttrs: /* @__PURE__ */ __name(function a11yAttrs() { + return { + id: this.id, + role: "region", + "aria-labelledby": this.ariaLabelledby, + "data-pc-name": "accordioncontent", + "data-p-active": this.$pcAccordionPanel.active + }; + }, "a11yAttrs"), + ptParams: /* @__PURE__ */ __name(function ptParams() { + return { + context: { + active: this.$pcAccordionPanel.active + } + }; + }, "ptParams") + } +}; +function render$12(_ctx, _cache, $props, $setup, $data, $options) { + return !_ctx.asChild ? (openBlock(), createBlock(Transition, mergeProps({ + key: 0, + name: "p-toggleable-content" + }, _ctx.ptm("transition", $options.ptParams)), { + "default": withCtx(function() { + return [($options.$pcAccordion.lazy ? $options.$pcAccordionPanel.active : true) ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ + key: 0, + "class": _ctx.cx("root") + }, $options.attrs), { + "default": withCtx(function() { + return [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("content") + }, _ctx.ptm("content", $options.ptParams)), [renderSlot(_ctx.$slots, "default")], 16)]; + }), + _: 3 + }, 16, ["class"])), [[vShow, $options.$pcAccordion.lazy ? true : $options.$pcAccordionPanel.active]]) : createCommentVNode("", true)]; + }), + _: 3 + }, 16)) : renderSlot(_ctx.$slots, "default", { + key: 1, + "class": normalizeClass(_ctx.cx("root")), + active: $options.$pcAccordionPanel.active, + a11yAttrs: $options.a11yAttrs + }); +} +__name(render$12, "render$12"); +script$1b.render = render$12; +var classes$K = { + root: "p-accordionheader", + toggleicon: "p-accordionheader-toggle-icon" +}; +var AccordionHeaderStyle = BaseStyle.extend({ + name: "accordionheader", + classes: classes$K +}); +var script$1$M = { + name: "BaseAccordionHeader", + "extends": script$1d, + props: { + as: { + type: [String, Object], + "default": "BUTTON" + }, + asChild: { + type: Boolean, + "default": false + } + }, + style: AccordionHeaderStyle, + provide: /* @__PURE__ */ __name(function provide3() { + return { + $pcAccordionHeader: this, + $parentInstance: this + }; + }, "provide") +}; +var script$1a = { + name: "AccordionHeader", + "extends": script$1$M, + inheritAttrs: false, + inject: ["$pcAccordion", "$pcAccordionPanel"], + methods: { + onFocus: /* @__PURE__ */ __name(function onFocus() { + this.$pcAccordion.selectOnFocus && this.changeActiveValue(); + }, "onFocus"), + onClick: /* @__PURE__ */ __name(function onClick() { + this.changeActiveValue(); + }, "onClick"), + onKeydown: /* @__PURE__ */ __name(function onKeydown2(event2) { + switch (event2.code) { + case "ArrowDown": + this.onArrowDownKey(event2); + break; + case "ArrowUp": + this.onArrowUpKey(event2); + break; + case "Home": + this.onHomeKey(event2); + break; + case "End": + this.onEndKey(event2); + break; + case "Enter": + case "NumpadEnter": + case "Space": + this.onEnterKey(event2); + break; + } + }, "onKeydown"), + onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey(event2) { + var nextPanel = this.findNextPanel(this.findPanel(event2.currentTarget)); + nextPanel ? this.changeFocusedPanel(event2, nextPanel) : this.onHomeKey(event2); + event2.preventDefault(); + }, "onArrowDownKey"), + onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey(event2) { + var prevPanel = this.findPrevPanel(this.findPanel(event2.currentTarget)); + prevPanel ? this.changeFocusedPanel(event2, prevPanel) : this.onEndKey(event2); + event2.preventDefault(); + }, "onArrowUpKey"), + onHomeKey: /* @__PURE__ */ __name(function onHomeKey(event2) { + var firstPanel = this.findFirstPanel(); + this.changeFocusedPanel(event2, firstPanel); + event2.preventDefault(); + }, "onHomeKey"), + onEndKey: /* @__PURE__ */ __name(function onEndKey(event2) { + var lastPanel = this.findLastPanel(); + this.changeFocusedPanel(event2, lastPanel); + event2.preventDefault(); + }, "onEndKey"), + onEnterKey: /* @__PURE__ */ __name(function onEnterKey(event2) { + this.changeActiveValue(); + event2.preventDefault(); + }, "onEnterKey"), + findPanel: /* @__PURE__ */ __name(function findPanel(headerElement) { + return headerElement === null || headerElement === void 0 ? void 0 : headerElement.closest('[data-pc-name="accordionpanel"]'); + }, "findPanel"), + findHeader: /* @__PURE__ */ __name(function findHeader(panelElement) { + return findSingle(panelElement, '[data-pc-name="accordionheader"]'); + }, "findHeader"), + findNextPanel: /* @__PURE__ */ __name(function findNextPanel(panelElement) { + var selfCheck = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + var element = selfCheck ? panelElement : panelElement.nextElementSibling; + return element ? getAttribute(element, "data-p-disabled") ? this.findNextPanel(element) : this.findHeader(element) : null; + }, "findNextPanel"), + findPrevPanel: /* @__PURE__ */ __name(function findPrevPanel(panelElement) { + var selfCheck = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + var element = selfCheck ? panelElement : panelElement.previousElementSibling; + return element ? getAttribute(element, "data-p-disabled") ? this.findPrevPanel(element) : this.findHeader(element) : null; + }, "findPrevPanel"), + findFirstPanel: /* @__PURE__ */ __name(function findFirstPanel() { + return this.findNextPanel(this.$pcAccordion.$el.firstElementChild, true); + }, "findFirstPanel"), + findLastPanel: /* @__PURE__ */ __name(function findLastPanel() { + return this.findPrevPanel(this.$pcAccordion.$el.lastElementChild, true); + }, "findLastPanel"), + changeActiveValue: /* @__PURE__ */ __name(function changeActiveValue() { + this.$pcAccordion.updateValue(this.$pcAccordionPanel.value); + }, "changeActiveValue"), + changeFocusedPanel: /* @__PURE__ */ __name(function changeFocusedPanel(event2, element) { + focus(this.findHeader(element)); + }, "changeFocusedPanel") + }, + computed: { + id: /* @__PURE__ */ __name(function id2() { + return "".concat(this.$pcAccordion.id, "_accordionheader_").concat(this.$pcAccordionPanel.value); + }, "id"), + ariaControls: /* @__PURE__ */ __name(function ariaControls() { + return "".concat(this.$pcAccordion.id, "_accordioncontent_").concat(this.$pcAccordionPanel.value); + }, "ariaControls"), + attrs: /* @__PURE__ */ __name(function attrs2() { + 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.$pcAccordionPanel.disabled + } : void 0; + }, "asAttrs"), + a11yAttrs: /* @__PURE__ */ __name(function a11yAttrs2() { + return { + id: this.id, + tabindex: this.$pcAccordion.tabindex, + "aria-expanded": this.$pcAccordionPanel.active, + "aria-controls": this.ariaControls, + "data-pc-name": "accordionheader", + "data-p-disabled": this.$pcAccordionPanel.disabled, + "data-p-active": this.$pcAccordionPanel.active, + onFocus: this.onFocus, + onKeydown: this.onKeydown + }; + }, "a11yAttrs"), + ptParams: /* @__PURE__ */ __name(function ptParams2() { + return { + context: { + active: this.$pcAccordionPanel.active + } + }; + }, "ptParams") + }, + components: { + ChevronUpIcon: script$1j, + ChevronDownIcon: script$1k + }, + directives: { + ripple: Ripple + } +}; +function render$11(_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", { + active: $options.$pcAccordionPanel.active + }), renderSlot(_ctx.$slots, "toggleicon", { + active: $options.$pcAccordionPanel.active, + "class": normalizeClass(_ctx.cx("toggleicon")) + }, function() { + return [$options.$pcAccordionPanel.active ? (openBlock(), createBlock(resolveDynamicComponent($options.$pcAccordion.$slots.collapseicon ? $options.$pcAccordion.$slots.collapseicon : $options.$pcAccordion.collapseIcon ? "span" : "ChevronDownIcon"), mergeProps({ + key: 0, + "class": [$options.$pcAccordion.collapseIcon, _ctx.cx("toggleicon")], + "aria-hidden": "true" + }, _ctx.ptm("toggleicon", $options.ptParams)), null, 16, ["class"])) : (openBlock(), createBlock(resolveDynamicComponent($options.$pcAccordion.$slots.expandicon ? $options.$pcAccordion.$slots.expandicon : $options.$pcAccordion.expandIcon ? "span" : "ChevronUpIcon"), mergeProps({ + key: 1, + "class": [$options.$pcAccordion.expandIcon, _ctx.cx("toggleicon")], + "aria-hidden": "true" + }, _ctx.ptm("toggleicon", $options.ptParams)), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "onClick"])), [[_directive_ripple]]) : renderSlot(_ctx.$slots, "default", { + key: 1, + "class": normalizeClass(_ctx.cx("root")), + active: $options.$pcAccordionPanel.active, + a11yAttrs: $options.a11yAttrs, + onClick: $options.onClick + }); +} +__name(render$11, "render$11"); +script$1a.render = render$11; +var classes$J = { + root: /* @__PURE__ */ __name(function root2(_ref) { + var instance = _ref.instance, props = _ref.props; + return ["p-accordionpanel", { + "p-accordionpanel-active": instance.active, + "p-disabled": props.disabled + }]; + }, "root") +}; +var AccordionPanelStyle = BaseStyle.extend({ + name: "accordionpanel", + classes: classes$J +}); +var script$1$L = { + name: "BaseAccordionPanel", + "extends": script$1d, + props: { + value: { + type: [String, Number], + "default": void 0 + }, + disabled: { + type: Boolean, + "default": false + }, + as: { + type: [String, Object], + "default": "DIV" + }, + asChild: { + type: Boolean, + "default": false + } + }, + style: AccordionPanelStyle, + provide: /* @__PURE__ */ __name(function provide4() { + return { + $pcAccordionPanel: this, + $parentInstance: this + }; + }, "provide") +}; +var script$19 = { + name: "AccordionPanel", + "extends": script$1$L, + inheritAttrs: false, + inject: ["$pcAccordion"], + computed: { + active: /* @__PURE__ */ __name(function active() { + return this.$pcAccordion.isItemActive(this.value); + }, "active"), + attrs: /* @__PURE__ */ __name(function attrs3() { + return mergeProps(this.a11yAttrs, this.ptmi("root", this.ptParams)); + }, "attrs"), + a11yAttrs: /* @__PURE__ */ __name(function a11yAttrs3() { + return { + "data-pc-name": "accordionpanel", + "data-p-disabled": this.disabled, + "data-p-active": this.active + }; + }, "a11yAttrs"), + ptParams: /* @__PURE__ */ __name(function ptParams3() { + return { + context: { + active: this.active + } + }; + }, "ptParams") + } +}; +function render$10(_ctx, _cache, $props, $setup, $data, $options) { + return !_ctx.asChild ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ + key: 0, + "class": _ctx.cx("root") + }, $options.attrs), { + "default": withCtx(function() { + return [renderSlot(_ctx.$slots, "default")]; + }), + _: 3 + }, 16, ["class"])) : renderSlot(_ctx.$slots, "default", { + key: 1, + "class": normalizeClass(_ctx.cx("root")), + active: $options.active, + a11yAttrs: $options.a11yAttrs + }); +} +__name(render$10, "render$10"); +script$19.render = render$10; +var theme$C = /* @__PURE__ */ __name(function theme2(_ref) { + var dt = _ref.dt; + return "\n.p-accordionpanel {\n display: flex;\n flex-direction: column;\n border-style: solid;\n border-width: ".concat(dt("accordion.panel.border.width"), ";\n border-color: ").concat(dt("accordion.panel.border.color"), ";\n}\n\n.p-accordionheader {\n all: unset;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: ").concat(dt("accordion.header.padding"), ";\n color: ").concat(dt("accordion.header.color"), ";\n background: ").concat(dt("accordion.header.background"), ";\n border-style: solid;\n border-width: ").concat(dt("accordion.header.border.width"), ";\n border-color: ").concat(dt("accordion.header.border.color"), ";\n font-weight: ").concat(dt("accordion.header.font.weight"), ";\n border-radius: ").concat(dt("accordion.header.border.radius"), ";\n transition: background ").concat(dt("accordion.transition.duration"), "; color ").concat(dt("accordion.transition.duration"), "color ").concat(dt("accordion.transition.duration"), ", outline-color ").concat(dt("accordion.transition.duration"), ", box-shadow ").concat(dt("accordion.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-accordionpanel:first-child > .p-accordionheader {\n border-width: ").concat(dt("accordion.header.first.border.width"), ";\n border-start-start-radius: ").concat(dt("accordion.header.first.top.border.radius"), ";\n border-start-end-radius: ").concat(dt("accordion.header.first.top.border.radius"), ";\n}\n\n.p-accordionpanel:last-child > .p-accordionheader {\n border-end-start-radius: ").concat(dt("accordion.header.last.bottom.border.radius"), ";\n border-end-end-radius: ").concat(dt("accordion.header.last.bottom.border.radius"), ";\n}\n\n.p-accordionpanel:last-child.p-accordionpanel-active > .p-accordionheader {\n border-end-start-radius: ").concat(dt("accordion.header.last.active.bottom.border.radius"), ";\n border-end-end-radius: ").concat(dt("accordion.header.last.active.bottom.border.radius"), ";\n}\n\n.p-accordionheader-toggle-icon {\n color: ").concat(dt("accordion.header.toggle.icon.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled) .p-accordionheader:focus-visible {\n box-shadow: ").concat(dt("accordion.header.focus.ring.shadow"), ";\n outline: ").concat(dt("accordion.header.focus.ring.width"), " ").concat(dt("accordion.header.focus.ring.style"), " ").concat(dt("accordion.header.focus.ring.color"), ";\n outline-offset: ").concat(dt("accordion.header.focus.ring.offset"), ";\n}\n\n.p-accordionpanel:not(.p-accordionpanel-active):not(.p-disabled) > .p-accordionheader:hover {\n background: ").concat(dt("accordion.header.hover.background"), ";\n color: ").concat(dt("accordion.header.hover.color"), ";\n}\n\n.p-accordionpanel:not(.p-accordionpanel-active):not(.p-disabled) .p-accordionheader:hover .p-accordionheader-toggle-icon {\n color: ").concat(dt("accordion.header.toggle.icon.hover.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled).p-accordionpanel-active > .p-accordionheader {\n background: ").concat(dt("accordion.header.active.background"), ";\n color: ").concat(dt("accordion.header.active.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled).p-accordionpanel-active > .p-accordionheader .p-accordionheader-toggle-icon {\n color: ").concat(dt("accordion.header.toggle.icon.active.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled).p-accordionpanel-active > .p-accordionheader:hover {\n background: ").concat(dt("accordion.header.active.hover.background"), ";\n color: ").concat(dt("accordion.header.active.hover.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled).p-accordionpanel-active > .p-accordionheader:hover .p-accordionheader-toggle-icon {\n color: ").concat(dt("accordion.header.toggle.icon.active.hover.color"), ";\n}\n\n.p-accordioncontent-content {\n border-style: solid;\n border-width: ").concat(dt("accordion.content.border.width"), ";\n border-color: ").concat(dt("accordion.content.border.color"), ";\n background-color: ").concat(dt("accordion.content.background"), ";\n color: ").concat(dt("accordion.content.color"), ";\n padding: ").concat(dt("accordion.content.padding"), ";\n}\n"); +}, "theme"); +var classes$I = { + root: "p-accordion p-component" +}; +var AccordionStyle = BaseStyle.extend({ + name: "accordion", + theme: theme$C, + classes: classes$I +}); +var script$1$K = { + name: "BaseAccordion", + "extends": script$1d, + props: { + value: { + type: [String, Number, Array], + "default": void 0 + }, + multiple: { + type: Boolean, + "default": false + }, + lazy: { + type: Boolean, + "default": false + }, + tabindex: { + type: Number, + "default": 0 + }, + selectOnFocus: { + type: Boolean, + "default": false + }, + expandIcon: { + type: String, + "default": void 0 + }, + collapseIcon: { + type: String, + "default": void 0 + }, + // @deprecated since v4. + activeIndex: { + type: [Number, Array], + "default": null + } + }, + style: AccordionStyle, + provide: /* @__PURE__ */ __name(function provide5() { + return { + $pcAccordion: this, + $parentInstance: this + }; + }, "provide") +}; +var script$18 = { + name: "Accordion", + "extends": script$1$K, + inheritAttrs: false, + emits: ["update:value", "update:activeIndex", "tab-open", "tab-close", "tab-click"], + data: /* @__PURE__ */ __name(function data2() { + 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"), + activeIndex: { + immediate: true, + handler: /* @__PURE__ */ __name(function handler(newValue) { + if (this.hasAccordionTab) { + this.d_value = this.multiple ? newValue === null || newValue === void 0 ? void 0 : newValue.map(String) : newValue === null || newValue === void 0 ? void 0 : newValue.toString(); + } + }, "handler") + } + }, + mounted: /* @__PURE__ */ __name(function mounted() { + this.id = this.id || UniqueComponentId(); + }, "mounted"), + methods: { + isItemActive: /* @__PURE__ */ __name(function isItemActive(value2) { + var _this$d_value; + return this.multiple ? (_this$d_value = this.d_value) === null || _this$d_value === void 0 ? void 0 : _this$d_value.includes(value2) : this.d_value === value2; + }, "isItemActive"), + updateValue: /* @__PURE__ */ __name(function updateValue(newValue) { + var _this$d_value2; + var active3 = this.isItemActive(newValue); + if (this.multiple) { + if (active3) { + this.d_value = this.d_value.filter(function(v) { + return v !== newValue; + }); + } else { + if (this.d_value) this.d_value.push(newValue); + else this.d_value = [newValue]; + } + } else { + this.d_value = active3 ? null : newValue; + } + this.$emit("update:value", this.d_value); + this.$emit("update:activeIndex", this.multiple ? (_this$d_value2 = this.d_value) === null || _this$d_value2 === void 0 ? void 0 : _this$d_value2.map(Number) : Number(this.d_value)); + this.$emit(active3 ? "tab-close" : "tab-open", { + originalEvent: void 0, + index: Number(newValue) + }); + }, "updateValue"), + // @deprecated since v4. Use new structure instead. + isAccordionTab: /* @__PURE__ */ __name(function isAccordionTab(child) { + return child.type.name === "AccordionTab"; + }, "isAccordionTab"), + getTabProp: /* @__PURE__ */ __name(function getTabProp(tab, name4) { + return tab.props ? tab.props[name4] : void 0; + }, "getTabProp"), + getKey: /* @__PURE__ */ __name(function getKey(tab, index) { + return this.getTabProp(tab, "header") || index; + }, "getKey"), + getHeaderPT: /* @__PURE__ */ __name(function getHeaderPT(tab, index) { + var _this = this; + return { + root: mergeProps({ + onClick: /* @__PURE__ */ __name(function onClick11(event2) { + return _this.onTabClick(event2, index); + }, "onClick") + }, this.getTabProp(tab, "headerProps"), this.getTabPT(tab, "header", index)), + toggleicon: mergeProps(this.getTabProp(tab, "headeractionprops"), this.getTabPT(tab, "headeraction", index)) + }; + }, "getHeaderPT"), + getContentPT: /* @__PURE__ */ __name(function getContentPT(tab, index) { + return { + root: mergeProps(this.getTabProp(tab, "contentProps"), this.getTabPT(tab, "toggleablecontent", index)), + transition: this.getTabPT(tab, "transition", index), + content: this.getTabPT(tab, "content", index) + }; + }, "getContentPT"), + getTabPT: /* @__PURE__ */ __name(function getTabPT(tab, key, index) { + var count = this.tabs.length; + var tabMetaData = { + props: tab.props || {}, + parent: { + instance: this, + props: this.$props, + state: this.$data + }, + context: { + index, + count, + first: index === 0, + last: index === count - 1, + active: this.isItemActive("".concat(index)) + } + }; + return mergeProps(this.ptm("accordiontab.".concat(key), tabMetaData), this.ptmo(this.getTabProp(tab, "pt"), key, tabMetaData)); + }, "getTabPT"), + onTabClick: /* @__PURE__ */ __name(function onTabClick(event2, index) { + this.$emit("tab-click", { + originalEvent: event2, + index + }); + }, "onTabClick") + }, + computed: { + // @deprecated since v4. + tabs: /* @__PURE__ */ __name(function tabs() { + var _this2 = this; + return this.$slots["default"]().reduce(function(tabs2, child) { + if (_this2.isAccordionTab(child)) { + tabs2.push(child); + } else if (child.children && child.children instanceof Array) { + child.children.forEach(function(nestedChild) { + if (_this2.isAccordionTab(nestedChild)) { + tabs2.push(nestedChild); + } + }); + } + return tabs2; + }, []); + }, "tabs"), + hasAccordionTab: /* @__PURE__ */ __name(function hasAccordionTab() { + return this.tabs.length; + }, "hasAccordionTab") + }, + components: { + AccordionPanel: script$19, + AccordionHeader: script$1a, + AccordionContent: script$1b, + ChevronUpIcon: script$1j, + ChevronRightIcon: script$1l + } +}; +function render$$(_ctx, _cache, $props, $setup, $data, $options) { + var _component_AccordionHeader = resolveComponent("AccordionHeader"); + var _component_AccordionContent = resolveComponent("AccordionContent"); + var _component_AccordionPanel = resolveComponent("AccordionPanel"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [$options.hasAccordionTab ? (openBlock(true), createElementBlock(Fragment, { + key: 0 + }, renderList($options.tabs, function(tab, i) { + return openBlock(), createBlock(_component_AccordionPanel, { + key: $options.getKey(tab, i), + value: "".concat(i), + pt: { + root: $options.getTabPT(tab, "root", i) + }, + disabled: $options.getTabProp(tab, "disabled") + }, { + "default": withCtx(function() { + return [createVNode(_component_AccordionHeader, { + "class": normalizeClass($options.getTabProp(tab, "headerClass")), + pt: $options.getHeaderPT(tab, i) + }, { + toggleicon: withCtx(function(slotProps) { + return [slotProps.active ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.collapseicon ? _ctx.$slots.collapseicon : _ctx.collapseIcon ? "span" : "ChevronDownIcon"), mergeProps({ + key: 0, + "class": [_ctx.collapseIcon, slotProps["class"]], + "aria-hidden": "true", + ref_for: true + }, $options.getTabPT(tab, "headericon", i)), null, 16, ["class"])) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.expandicon ? _ctx.$slots.expandicon : _ctx.expandIcon ? "span" : "ChevronUpIcon"), mergeProps({ + key: 1, + "class": [_ctx.expandIcon, slotProps["class"]], + "aria-hidden": "true", + ref_for: true + }, $options.getTabPT(tab, "headericon", i)), null, 16, ["class"]))]; + }), + "default": withCtx(function() { + return [tab.children && tab.children.headericon ? (openBlock(), createBlock(resolveDynamicComponent(tab.children.headericon), { + key: 0, + isTabActive: $options.isItemActive("".concat(i)), + active: $options.isItemActive("".concat(i)), + index: i + }, null, 8, ["isTabActive", "active", "index"])) : createCommentVNode("", true), tab.props && tab.props.header ? (openBlock(), createElementBlock("span", mergeProps({ + key: 1, + ref_for: true + }, $options.getTabPT(tab, "headertitle", i)), toDisplayString(tab.props.header), 17)) : createCommentVNode("", true), tab.children && tab.children.header ? (openBlock(), createBlock(resolveDynamicComponent(tab.children.header), { + key: 2 + })) : createCommentVNode("", true)]; + }), + _: 2 + }, 1032, ["class", "pt"]), createVNode(_component_AccordionContent, { + pt: $options.getContentPT(tab, i) + }, { + "default": withCtx(function() { + return [(openBlock(), createBlock(resolveDynamicComponent(tab)))]; + }), + _: 2 + }, 1032, ["pt"])]; + }), + _: 2 + }, 1032, ["value", "pt", "disabled"]); + }), 128)) : renderSlot(_ctx.$slots, "default", { + key: 1 + })], 16); +} +__name(render$$, "render$$"); +script$18.render = render$$; +var AccordionTabStyle = BaseStyle.extend({ + name: "accordiontab" +}); +var script$1$J = { + name: "BaseAccordionTab", + "extends": script$1d, + props: { + header: null, + headerStyle: null, + headerClass: null, + headerProps: null, + headerActionProps: null, + contentStyle: null, + contentClass: null, + contentProps: null, + disabled: Boolean + }, + style: AccordionTabStyle, + provide: /* @__PURE__ */ __name(function provide6() { + return { + $pcAccordionTab: this, + $parentInstance: this + }; + }, "provide") +}; +var script$17 = { + name: "AccordionTab", + "extends": script$1$J, + inheritAttrs: false, + mounted: /* @__PURE__ */ __name(function mounted2() { + console.warn("Deprecated since v4. Use the new structure of Accordion instead."); + }, "mounted") +}; +function render$_(_ctx, _cache, $props, $setup, $data, $options) { + return renderSlot(_ctx.$slots, "default"); +} +__name(render$_, "render$_"); +script$17.render = render$_; +var AnimateOnScrollStyle = BaseStyle.extend({ + name: "animateonscroll-directive" +}); +var BaseAnimateOnScroll = BaseDirective.extend({ + style: AnimateOnScrollStyle +}); +function _typeof$n(o) { + "@babel/helpers - typeof"; + return _typeof$n = "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$n(o); +} +__name(_typeof$n, "_typeof$n"); +function ownKeys$k(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$k, "ownKeys$k"); +function _objectSpread$k(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$k(Object(t2), true).forEach(function(r2) { + _defineProperty$l(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$k(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$k, "_objectSpread$k"); +function _defineProperty$l(e, r, t2) { + return (r = _toPropertyKey$l(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$l, "_defineProperty$l"); +function _toPropertyKey$l(t2) { + var i = _toPrimitive$l(t2, "string"); + return "symbol" == _typeof$n(i) ? i : i + ""; +} +__name(_toPropertyKey$l, "_toPropertyKey$l"); +function _toPrimitive$l(t2, r) { + if ("object" != _typeof$n(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$n(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$l, "_toPrimitive$l"); +function _slicedToArray$1(r, e) { + return _arrayWithHoles$1(r) || _iterableToArrayLimit$1(r, e) || _unsupportedIterableToArray$f(r, e) || _nonIterableRest$1(); +} +__name(_slicedToArray$1, "_slicedToArray$1"); +function _nonIterableRest$1() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableRest$1, "_nonIterableRest$1"); +function _unsupportedIterableToArray$f(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$f(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$f(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$f, "_unsupportedIterableToArray$f"); +function _arrayLikeToArray$f(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; +} +__name(_arrayLikeToArray$f, "_arrayLikeToArray$f"); +function _iterableToArrayLimit$1(r, l) { + var t2 = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (null != t2) { + var e, n, i, u, a = [], f = true, o = false; + try { + if (i = (t2 = t2.call(r)).next, 0 === l) ; + else for (; !(f = (e = i.call(t2)).done) && (a.push(e.value), a.length !== l); f = true) ; + } catch (r2) { + o = true, n = r2; + } finally { + try { + if (!f && null != t2["return"] && (u = t2["return"](), Object(u) !== u)) return; + } finally { + if (o) throw n; + } + } + return a; + } +} +__name(_iterableToArrayLimit$1, "_iterableToArrayLimit$1"); +function _arrayWithHoles$1(r) { + if (Array.isArray(r)) return r; +} +__name(_arrayWithHoles$1, "_arrayWithHoles$1"); +var AnimateOnScroll = BaseAnimateOnScroll.extend("animateonscroll", { + created: /* @__PURE__ */ __name(function created() { + this.$value = this.$value || {}; + this.$el.style.opacity = this.$value.enterClass ? "0" : ""; + }, "created"), + mounted: /* @__PURE__ */ __name(function mounted3() { + this.$el.setAttribute("data-pd-animateonscroll", true); + this.bindIntersectionObserver(); + }, "mounted"), + unmounted: /* @__PURE__ */ __name(function unmounted() { + this.unbindAnimationEvents(); + this.unbindIntersectionObserver(); + }, "unmounted"), + observer: void 0, + resetObserver: void 0, + isObserverActive: false, + animationState: void 0, + animationEndListener: void 0, + methods: { + bindAnimationEvents: /* @__PURE__ */ __name(function bindAnimationEvents() { + var _this = this; + if (!this.animationEndListener) { + this.animationEndListener = function() { + removeClass(_this.$el, [_this.$value.enterClass, _this.$value.leaveClass]); + !_this.$modifiers.once && _this.resetObserver.observe(_this.$el); + _this.unbindAnimationEvents(); + }; + this.$el.addEventListener("animationend", this.animationEndListener); + } + }, "bindAnimationEvents"), + bindIntersectionObserver: /* @__PURE__ */ __name(function bindIntersectionObserver() { + var _this2 = this; + var _this$$value = this.$value, root35 = _this$$value.root, rootMargin = _this$$value.rootMargin, _this$$value$threshol = _this$$value.threshold, threshold = _this$$value$threshol === void 0 ? 0.5 : _this$$value$threshol; + var options4 = { + root: root35, + rootMargin, + threshold + }; + this.observer = new IntersectionObserver(function(_ref) { + var _ref2 = _slicedToArray$1(_ref, 1), entry = _ref2[0]; + if (_this2.isObserverActive) { + if (entry.boundingClientRect.top > 0) { + entry.isIntersecting ? _this2.enter() : _this2.leave(); + } + } else if (entry.isIntersecting) { + _this2.enter(); + } + _this2.isObserverActive = true; + }, options4); + setTimeout(function() { + return _this2.observer.observe(_this2.$el); + }, 0); + this.resetObserver = new IntersectionObserver(function(_ref3) { + var _ref4 = _slicedToArray$1(_ref3, 1), entry = _ref4[0]; + if (entry.boundingClientRect.top > 0 && !entry.isIntersecting) { + _this2.$el.style.opacity = _this2.$value.enterClass ? "0" : ""; + removeClass(_this2.$el, [_this2.$value.enterClass, _this2.$value.leaveClass]); + _this2.resetObserver.unobserve(_this2.$el); + } + _this2.animationState = void 0; + }, _objectSpread$k(_objectSpread$k({}, options4), {}, { + threshold: 0 + })); + }, "bindIntersectionObserver"), + enter: /* @__PURE__ */ __name(function enter() { + if (this.animationState !== "enter" && this.$value.enterClass) { + this.$el.style.opacity = ""; + removeClass(this.$el, this.$value.leaveClass); + addClass(this.$el, this.$value.enterClass); + this.$modifiers.once && this.unbindIntersectionObserver(this.$el); + this.bindAnimationEvents(); + this.animationState = "enter"; + } + }, "enter"), + leave: /* @__PURE__ */ __name(function leave() { + if (this.animationState !== "leave" && this.$value.leaveClass) { + this.$el.style.opacity = this.$value.enterClass ? "0" : ""; + removeClass(this.$el, this.$value.enterClass); + addClass(this.$el, this.$value.leaveClass); + this.bindAnimationEvents(); + this.animationState = "leave"; + } + }, "leave"), + unbindAnimationEvents: /* @__PURE__ */ __name(function unbindAnimationEvents() { + if (this.animationEndListener) { + this.$el.removeEventListener("animationend", this.animationEndListener); + this.animationEndListener = void 0; + } + }, "unbindAnimationEvents"), + unbindIntersectionObserver: /* @__PURE__ */ __name(function unbindIntersectionObserver() { + var _this$observer, _this$resetObserver; + (_this$observer = this.observer) === null || _this$observer === void 0 || _this$observer.unobserve(this.$el); + (_this$resetObserver = this.resetObserver) === null || _this$resetObserver === void 0 || _this$resetObserver.unobserve(this.$el); + this.isObserverActive = false; + }, "unbindIntersectionObserver") + } +}); +var theme$B = /* @__PURE__ */ __name(function theme3(_ref) { + var dt = _ref.dt; + return "\n.p-avatar {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: ".concat(dt("avatar.width"), ";\n height: ").concat(dt("avatar.height"), ";\n font-size: ").concat(dt("avatar.font.size"), ";\n background: ").concat(dt("avatar.background"), ";\n color: ").concat(dt("avatar.color"), ";\n border-radius: ").concat(dt("avatar.border.radius"), ";\n}\n\n.p-avatar-image {\n background: transparent;\n}\n\n.p-avatar-circle {\n border-radius: 50%;\n}\n\n.p-avatar-circle img {\n border-radius: 50%;\n}\n\n.p-avatar-icon {\n font-size: ").concat(dt("avatar.icon.size"), ";\n width: ").concat(dt("avatar.icon.size"), ";\n height: ").concat(dt("avatar.icon.size"), ";\n}\n\n.p-avatar img {\n width: 100%;\n height: 100%;\n}\n\n.p-avatar-lg {\n width: ").concat(dt("avatar.lg.width"), ";\n height: ").concat(dt("avatar.lg.width"), ";\n font-size: ").concat(dt("avatar.lg.font.size"), ";\n}\n\n.p-avatar-lg .p-avatar-icon {\n font-size: ").concat(dt("avatar.lg.icon.size"), ";\n width: ").concat(dt("avatar.lg.icon.size"), ";\n height: ").concat(dt("avatar.lg.icon.size"), ";\n}\n\n.p-avatar-xl {\n width: ").concat(dt("avatar.xl.width"), ";\n height: ").concat(dt("avatar.xl.width"), ";\n font-size: ").concat(dt("avatar.xl.font.size"), ";\n}\n\n.p-avatar-xl .p-avatar-icon {\n font-size: ").concat(dt("avatar.xl.icon.size"), ";\n width: ").concat(dt("avatar.xl.icon.size"), ";\n height: ").concat(dt("avatar.xl.icon.size"), ";\n}\n\n.p-avatar-group {\n display: flex;\n align-items: center;\n}\n\n.p-avatar-group .p-avatar + .p-avatar {\n margin-inline-start: ").concat(dt("avatar.group.offset"), ";\n}\n\n.p-avatar-group .p-avatar {\n border: 2px solid ").concat(dt("avatar.group.border.color"), ";\n}\n\n.p-avatar-group .p-avatar-lg + .p-avatar-lg {\n margin-inline-start: ").concat(dt("avatar.lg.group.offset"), ";\n}\n\n.p-avatar-group .p-avatar-xl + .p-avatar-xl {\n margin-inline-start: ").concat(dt("avatar.xl.group.offset"), ";\n}\n"); +}, "theme"); +var classes$H = { + root: /* @__PURE__ */ __name(function root3(_ref2) { + var props = _ref2.props; + return ["p-avatar p-component", { + "p-avatar-image": props.image != null, + "p-avatar-circle": props.shape === "circle", + "p-avatar-lg": props.size === "large", + "p-avatar-xl": props.size === "xlarge" + }]; + }, "root"), + label: "p-avatar-label", + icon: "p-avatar-icon" +}; +var AvatarStyle = BaseStyle.extend({ + name: "avatar", + theme: theme$B, + classes: classes$H +}); +var script$1$I = { + name: "BaseAvatar", + "extends": script$1d, + props: { + label: { + type: String, + "default": null + }, + icon: { + type: String, + "default": null + }, + image: { + type: String, + "default": null + }, + size: { + type: String, + "default": "normal" + }, + shape: { + type: String, + "default": "square" + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + } + }, + style: AvatarStyle, + provide: /* @__PURE__ */ __name(function provide7() { + return { + $pcAvatar: this, + $parentInstance: this + }; + }, "provide") +}; +var script$16 = { + name: "Avatar", + "extends": script$1$I, + inheritAttrs: false, + emits: ["error"], + methods: { + onError: /* @__PURE__ */ __name(function onError(event2) { + this.$emit("error", event2); + }, "onError") + } +}; +var _hoisted_1$u = ["aria-labelledby", "aria-label"]; +var _hoisted_2$m = ["src", "alt"]; +function render$Z(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root"), + "aria-labelledby": _ctx.ariaLabelledby, + "aria-label": _ctx.ariaLabel + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default", {}, function() { + return [_ctx.label ? (openBlock(), createElementBlock("span", mergeProps({ + key: 0, + "class": _ctx.cx("label") + }, _ctx.ptm("label")), toDisplayString(_ctx.label), 17)) : _ctx.$slots.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.icon), { + key: 1, + "class": normalizeClass(_ctx.cx("icon")) + }, null, 8, ["class"])) : _ctx.icon ? (openBlock(), createElementBlock("span", mergeProps({ + key: 2, + "class": [_ctx.cx("icon"), _ctx.icon] + }, _ctx.ptm("icon")), null, 16)) : _ctx.image ? (openBlock(), createElementBlock("img", mergeProps({ + key: 3, + src: _ctx.image, + alt: _ctx.ariaLabel, + onError: _cache[0] || (_cache[0] = function() { + return $options.onError && $options.onError.apply($options, arguments); + }) + }, _ctx.ptm("image")), null, 16, _hoisted_2$m)) : createCommentVNode("", true)]; + })], 16, _hoisted_1$u); +} +__name(render$Z, "render$Z"); +script$16.render = render$Z; +var classes$G = { + root: "p-avatar-group p-component" +}; +var AvatarGroupStyle = BaseStyle.extend({ + name: "avatargroup", + classes: classes$G +}); +var script$1$H = { + name: "BaseAvatarGroup", + "extends": script$1d, + style: AvatarGroupStyle, + provide: /* @__PURE__ */ __name(function provide8() { + return { + $pcAvatarGroup: this, + $parentInstance: this + }; + }, "provide") +}; +var script$15 = { + name: "AvatarGroup", + "extends": script$1$H, + inheritAttrs: false +}; +function render$Y(_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$Y, "render$Y"); +script$15.render = render$Y; +var classes$F = { + root: "p-badge p-component" +}; +var BadgeDirectiveStyle = BaseStyle.extend({ + name: "badge-directive", + classes: classes$F +}); +var BaseBadgeDirective = BaseDirective.extend({ + style: BadgeDirectiveStyle +}); +function _typeof$m(o) { + "@babel/helpers - typeof"; + return _typeof$m = "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$m(o); +} +__name(_typeof$m, "_typeof$m"); +function ownKeys$j(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$j, "ownKeys$j"); +function _objectSpread$j(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$j(Object(t2), true).forEach(function(r2) { + _defineProperty$k(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$j(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$j, "_objectSpread$j"); +function _defineProperty$k(e, r, t2) { + return (r = _toPropertyKey$k(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$k, "_defineProperty$k"); +function _toPropertyKey$k(t2) { + var i = _toPrimitive$k(t2, "string"); + return "symbol" == _typeof$m(i) ? i : i + ""; +} +__name(_toPropertyKey$k, "_toPropertyKey$k"); +function _toPrimitive$k(t2, r) { + if ("object" != _typeof$m(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$m(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$k, "_toPrimitive$k"); +var BadgeDirective = BaseBadgeDirective.extend("badge", { + mounted: /* @__PURE__ */ __name(function mounted4(el, binding) { + console.warn("Deprecated since v4. Use OverlayBadge component instead."); + var id4 = UniqueComponentId() + "_badge"; + var badge = createElement("span", _defineProperty$k(_defineProperty$k({ + id: id4, + "class": !this.isUnstyled() && this.cx("root") + }, this.$attrSelector, ""), "p-bind", this.ptm("root", { + context: _objectSpread$j(_objectSpread$j({}, binding.modifiers), {}, { + nogutter: String(binding.value).length === 1, + dot: binding.value == null + }) + }))); + el.$_pbadgeId = badge.getAttribute("id"); + for (var modifier in binding.modifiers) { + !this.isUnstyled() && addClass(badge, "p-badge-" + modifier); + } + if (binding.value != null) { + if (_typeof$m(binding.value) === "object") el.$_badgeValue = binding.value.value; + else el.$_badgeValue = binding.value; + badge.appendChild(document.createTextNode(el.$_badgeValue)); + if (String(el.$_badgeValue).length === 1 && !this.isUnstyled()) { + !this.isUnstyled() && addClass(badge, "p-badge-circle"); + } + } else { + !this.isUnstyled() && addClass(badge, "p-badge-dot"); + } + el.setAttribute("data-pd-badge", true); + !this.isUnstyled() && addClass(el, "p-overlay-badge"); + el.setAttribute("data-p-overlay-badge", "true"); + el.appendChild(badge); + this.$el = badge; + }, "mounted"), + updated: /* @__PURE__ */ __name(function updated2(el, binding) { + !this.isUnstyled() && addClass(el, "p-overlay-badge"); + el.setAttribute("data-p-overlay-badge", "true"); + if (binding.oldValue !== binding.value) { + var badge = document.getElementById(el.$_pbadgeId); + if (_typeof$m(binding.value) === "object") el.$_badgeValue = binding.value.value; + else el.$_badgeValue = binding.value; + if (!this.isUnstyled()) { + if (el.$_badgeValue) { + if (hasClass(badge, "p-badge-dot")) removeClass(badge, "p-badge-dot"); + if (el.$_badgeValue.length === 1) addClass(badge, "p-badge-circle"); + else removeClass(badge, "p-badge-circle"); + } else if (!el.$_badgeValue && !hasClass(badge, "p-badge-dot")) { + addClass(badge, "p-badge-dot"); + } + } + badge.innerHTML = ""; + badge.appendChild(document.createTextNode(el.$_badgeValue)); + } + }, "updated") +}); +var theme$A = /* @__PURE__ */ __name(function theme4(_ref) { + var dt = _ref.dt; + return "\n.p-breadcrumb {\n background: ".concat(dt("breadcrumb.background"), ";\n padding: ").concat(dt("breadcrumb.padding"), ";\n overflow-x: auto;\n}\n\n.p-breadcrumb-list {\n margin: 0;\n padding: 0;\n list-style-type: none;\n display: flex;\n align-items: center;\n flex-wrap: nowrap;\n gap: ").concat(dt("breadcrumb.gap"), ";\n}\n\n.p-breadcrumb-separator {\n display: flex;\n align-items: center;\n color: ").concat(dt("breadcrumb.separator.color"), ";\n}\n\n.p-breadcrumb-separator-icon:dir(rtl) {\n transform: rotate(180deg);\n}\n\n.p-breadcrumb::-webkit-scrollbar {\n display: none;\n}\n\n.p-breadcrumb-item-link {\n text-decoration: none;\n display: flex;\n align-items: center;\n gap: ").concat(dt("breadcrumb.item.gap"), ";\n transition: background ").concat(dt("breadcrumb.transition.duration"), ", color ").concat(dt("breadcrumb.transition.duration"), ", outline-color ").concat(dt("breadcrumb.transition.duration"), ", box-shadow ").concat(dt("breadcrumb.transition.duration"), ";\n border-radius: ").concat(dt("breadcrumb.item.border.radius"), ";\n outline-color: transparent;\n color: ").concat(dt("breadcrumb.item.color"), ";\n}\n\n.p-breadcrumb-item-link:focus-visible {\n box-shadow: ").concat(dt("breadcrumb.item.focus.ring.shadow"), ";\n outline: ").concat(dt("breadcrumb.item.focus.ring.width"), " ").concat(dt("breadcrumb.item.focus.ring.style"), " ").concat(dt("breadcrumb.item.focus.ring.color"), ";\n outline-offset: ").concat(dt("breadcrumb.item.focus.ring.offset"), ";\n}\n\n.p-breadcrumb-item-link:hover .p-breadcrumb-item-label {\n color: ").concat(dt("breadcrumb.item.hover.color"), ";\n}\n\n.p-breadcrumb-item-label {\n transition: inherit;\n}\n\n.p-breadcrumb-item-icon {\n color: ").concat(dt("breadcrumb.item.icon.color"), ";\n transition: inherit;\n}\n\n.p-breadcrumb-item-link:hover .p-breadcrumb-item-icon {\n color: ").concat(dt("breadcrumb.item.icon.hover.color"), ";\n}\n"); +}, "theme"); +var classes$E = { + root: "p-breadcrumb p-component", + list: "p-breadcrumb-list", + homeItem: "p-breadcrumb-home-item", + separator: "p-breadcrumb-separator", + separatorIcon: "p-breadcrumb-separator-icon", + item: /* @__PURE__ */ __name(function item(_ref2) { + var instance = _ref2.instance; + return ["p-breadcrumb-item", { + "p-disabled": instance.disabled() + }]; + }, "item"), + itemLink: "p-breadcrumb-item-link", + itemIcon: "p-breadcrumb-item-icon", + itemLabel: "p-breadcrumb-item-label" +}; +var BreadcrumbStyle = BaseStyle.extend({ + name: "breadcrumb", + theme: theme$A, + classes: classes$E +}); +var script$2$9 = { + name: "BaseBreadcrumb", + "extends": script$1d, + props: { + model: { + type: Array, + "default": null + }, + home: { + type: null, + "default": null + } + }, + style: BreadcrumbStyle, + provide: /* @__PURE__ */ __name(function provide9() { + return { + $pcBreadcrumb: this, + $parentInstance: this + }; + }, "provide") +}; +var script$1$G = { + name: "BreadcrumbItem", + hostName: "Breadcrumb", + "extends": script$1d, + props: { + item: null, + templates: null, + index: null + }, + methods: { + onClick: /* @__PURE__ */ __name(function onClick2(event2) { + if (this.item.command) { + this.item.command({ + originalEvent: event2, + item: this.item + }); + } + }, "onClick"), + visible: /* @__PURE__ */ __name(function visible() { + return typeof this.item.visible === "function" ? this.item.visible() : this.item.visible !== false; + }, "visible"), + disabled: /* @__PURE__ */ __name(function disabled() { + return typeof this.item.disabled === "function" ? this.item.disabled() : this.item.disabled; + }, "disabled"), + label: /* @__PURE__ */ __name(function label() { + return typeof this.item.label === "function" ? this.item.label() : this.item.label; + }, "label"), + isCurrentUrl: /* @__PURE__ */ __name(function isCurrentUrl() { + var _this$item = this.item, to = _this$item.to, url = _this$item.url; + var lastPath = typeof window !== "undefined" ? window.location.pathname : ""; + return to === lastPath || url === lastPath ? "page" : void 0; + }, "isCurrentUrl") + }, + computed: { + ptmOptions: /* @__PURE__ */ __name(function ptmOptions() { + return { + context: { + item: this.item, + index: this.index + } + }; + }, "ptmOptions"), + getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps() { + var _this = this; + return { + action: mergeProps({ + "class": this.cx("itemLink"), + "aria-current": this.isCurrentUrl(), + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return _this.onClick($event); + }, "onClick") + }, this.ptm("itemLink", this.ptmOptions)), + icon: mergeProps({ + "class": [this.cx("icon"), this.item.icon] + }, this.ptm("icon", this.ptmOptions)), + label: mergeProps({ + "class": this.cx("label") + }, this.ptm("label", this.ptmOptions)) + }; + }, "getMenuItemProps") + } +}; +var _hoisted_1$t = ["href", "target", "aria-current"]; +function render$1$9(_ctx, _cache, $props, $setup, $data, $options) { + return $options.visible() ? (openBlock(), createElementBlock("li", mergeProps({ + key: 0, + "class": [_ctx.cx("item"), $props.item["class"]] + }, _ctx.ptm("item", $options.ptmOptions)), [!$props.templates.item ? (openBlock(), createElementBlock("a", mergeProps({ + key: 0, + href: $props.item.url || "#", + "class": _ctx.cx("itemLink"), + target: $props.item.target, + "aria-current": $options.isCurrentUrl(), + onClick: _cache[0] || (_cache[0] = function() { + return $options.onClick && $options.onClick.apply($options, arguments); + }) + }, _ctx.ptm("itemLink", $options.ptmOptions)), [$props.templates && $props.templates.itemicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.itemicon), { + key: 0, + item: $props.item, + "class": normalizeClass(_ctx.cx("itemIcon", $options.ptmOptions)) + }, null, 8, ["item", "class"])) : $props.item.icon ? (openBlock(), createElementBlock("span", mergeProps({ + key: 1, + "class": [_ctx.cx("itemIcon"), $props.item.icon] + }, _ctx.ptm("itemIcon", $options.ptmOptions)), null, 16)) : createCommentVNode("", true), $props.item.label ? (openBlock(), createElementBlock("span", mergeProps({ + key: 2, + "class": _ctx.cx("itemLabel") + }, _ctx.ptm("itemLabel", $options.ptmOptions)), toDisplayString($options.label()), 17)) : createCommentVNode("", true)], 16, _hoisted_1$t)) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { + key: 1, + item: $props.item, + label: $options.label(), + props: $options.getMenuItemProps + }, null, 8, ["item", "label", "props"]))], 16)) : createCommentVNode("", true); +} +__name(render$1$9, "render$1$9"); +script$1$G.render = render$1$9; +var script$14 = { + name: "Breadcrumb", + "extends": script$2$9, + inheritAttrs: false, + components: { + BreadcrumbItem: script$1$G, + ChevronRightIcon: script$1l + } +}; +function render$X(_ctx, _cache, $props, $setup, $data, $options) { + var _component_BreadcrumbItem = resolveComponent("BreadcrumbItem"); + var _component_ChevronRightIcon = resolveComponent("ChevronRightIcon"); + return openBlock(), createElementBlock("nav", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [createBaseVNode("ol", mergeProps({ + "class": _ctx.cx("list") + }, _ctx.ptm("list")), [_ctx.home ? (openBlock(), createBlock(_component_BreadcrumbItem, mergeProps({ + key: 0, + item: _ctx.home, + "class": _ctx.cx("homeItem"), + templates: _ctx.$slots, + pt: _ctx.pt, + unstyled: _ctx.unstyled + }, _ctx.ptm("homeItem")), null, 16, ["item", "class", "templates", "pt", "unstyled"])) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model, function(item8, i) { + return openBlock(), createElementBlock(Fragment, { + key: item8.label + "_" + i + }, [_ctx.home || i !== 0 ? (openBlock(), createElementBlock("li", mergeProps({ + key: 0, + "class": _ctx.cx("separator"), + ref_for: true + }, _ctx.ptm("separator")), [renderSlot(_ctx.$slots, "separator", {}, function() { + return [createVNode(_component_ChevronRightIcon, mergeProps({ + "aria-hidden": "true", + "class": _ctx.cx("separatorIcon"), + ref_for: true + }, _ctx.ptm("separatorIcon")), null, 16, ["class"])]; + })], 16)) : createCommentVNode("", true), createVNode(_component_BreadcrumbItem, { + item: item8, + index: i, + templates: _ctx.$slots, + pt: _ctx.pt, + unstyled: _ctx.unstyled + }, null, 8, ["item", "index", "templates", "pt", "unstyled"])], 64); + }), 128))], 16)], 16); +} +__name(render$X, "render$X"); +script$14.render = render$X; +var script$13 = { + name: "CalendarIcon", + "extends": script$1m +}; +function render$W(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + d: "M10.7838 1.51351H9.83783V0.567568C9.83783 0.417039 9.77804 0.272676 9.6716 0.166237C9.56516 0.0597971 9.42079 0 9.27027 0C9.11974 0 8.97538 0.0597971 8.86894 0.166237C8.7625 0.272676 8.7027 0.417039 8.7027 0.567568V1.51351H5.29729V0.567568C5.29729 0.417039 5.2375 0.272676 5.13106 0.166237C5.02462 0.0597971 4.88025 0 4.72973 0C4.5792 0 4.43484 0.0597971 4.3284 0.166237C4.22196 0.272676 4.16216 0.417039 4.16216 0.567568V1.51351H3.21621C2.66428 1.51351 2.13494 1.73277 1.74467 2.12305C1.35439 2.51333 1.13513 3.04266 1.13513 3.59459V11.9189C1.13513 12.4709 1.35439 13.0002 1.74467 13.3905C2.13494 13.7807 2.66428 14 3.21621 14H10.7838C11.3357 14 11.865 13.7807 12.2553 13.3905C12.6456 13.0002 12.8649 12.4709 12.8649 11.9189V3.59459C12.8649 3.04266 12.6456 2.51333 12.2553 2.12305C11.865 1.73277 11.3357 1.51351 10.7838 1.51351ZM3.21621 2.64865H4.16216V3.59459C4.16216 3.74512 4.22196 3.88949 4.3284 3.99593C4.43484 4.10237 4.5792 4.16216 4.72973 4.16216C4.88025 4.16216 5.02462 4.10237 5.13106 3.99593C5.2375 3.88949 5.29729 3.74512 5.29729 3.59459V2.64865H8.7027V3.59459C8.7027 3.74512 8.7625 3.88949 8.86894 3.99593C8.97538 4.10237 9.11974 4.16216 9.27027 4.16216C9.42079 4.16216 9.56516 4.10237 9.6716 3.99593C9.77804 3.88949 9.83783 3.74512 9.83783 3.59459V2.64865H10.7838C11.0347 2.64865 11.2753 2.74831 11.4527 2.92571C11.6301 3.10311 11.7297 3.34371 11.7297 3.59459V5.67568H2.27027V3.59459C2.27027 3.34371 2.36993 3.10311 2.54733 2.92571C2.72473 2.74831 2.96533 2.64865 3.21621 2.64865ZM10.7838 12.8649H3.21621C2.96533 12.8649 2.72473 12.7652 2.54733 12.5878C2.36993 12.4104 2.27027 12.1698 2.27027 11.9189V6.81081H11.7297V11.9189C11.7297 12.1698 11.6301 12.4104 11.4527 12.5878C11.2753 12.7652 11.0347 12.8649 10.7838 12.8649Z", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$W, "render$W"); +script$13.render = render$W; +var theme$z = /* @__PURE__ */ __name(function theme5(_ref) { + var dt = _ref.dt; + return "\n.p-datepicker {\n display: inline-flex;\n max-width: 100%;\n}\n\n.p-datepicker-input {\n flex: 1 1 auto;\n width: 1%;\n}\n\n.p-datepicker:has(.p-datepicker-dropdown) .p-datepicker-input {\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n}\n\n.p-datepicker-dropdown {\n cursor: pointer;\n display: inline-flex;\n user-select: none;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n width: ".concat(dt("datepicker.dropdown.width"), ";\n border-start-end-radius: ").concat(dt("datepicker.dropdown.border.radius"), ";\n border-end-end-radius: ").concat(dt("datepicker.dropdown.border.radius"), ";\n background: ").concat(dt("datepicker.dropdown.background"), ";\n border: 1px solid ").concat(dt("datepicker.dropdown.border.color"), ";\n border-inline-start: 0 none;\n color: ").concat(dt("datepicker.dropdown.color"), ";\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-datepicker-dropdown:not(:disabled):hover {\n background: ").concat(dt("datepicker.dropdown.hover.background"), ";\n border-color: ").concat(dt("datepicker.dropdown.hover.border.color"), ";\n color: ").concat(dt("datepicker.dropdown.hover.color"), ";\n}\n\n.p-datepicker-dropdown:not(:disabled):active {\n background: ").concat(dt("datepicker.dropdown.active.background"), ";\n border-color: ").concat(dt("datepicker.dropdown.active.border.color"), ";\n color: ").concat(dt("datepicker.dropdown.active.color"), ";\n}\n\n.p-datepicker-dropdown:focus-visible {\n box-shadow: ").concat(dt("datepicker.dropdown.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.dropdown.focus.ring.width"), " ").concat(dt("datepicker.dropdown.focus.ring.style"), " ").concat(dt("datepicker.dropdown.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.dropdown.focus.ring.offset"), ";\n}\n\n.p-datepicker:has(.p-datepicker-input-icon-container) {\n position: relative;\n}\n\n.p-datepicker:has(.p-datepicker-input-icon-container) .p-datepicker-input {\n padding-inline-end: calc((").concat(dt("form.field.padding.x"), " * 2) + ").concat(dt("icon.size"), ");\n}\n\n.p-datepicker-input-icon-container {\n cursor: pointer;\n position: absolute;\n top: 50%;\n inset-inline-end: ").concat(dt("form.field.padding.x"), ";\n margin-block-start: calc(-1 * (").concat(dt("icon.size"), " / 2));\n color: ").concat(dt("datepicker.input.icon.color"), ";\n line-height: 1;\n}\n\n.p-datepicker-fluid {\n display: flex;\n}\n\n.p-datepicker-fluid .p-datepicker-input {\n width: 1%;\n}\n\n.p-datepicker .p-datepicker-panel {\n min-width: 100%;\n}\n\n.p-datepicker-panel {\n width: auto;\n padding: ").concat(dt("datepicker.panel.padding"), ";\n background: ").concat(dt("datepicker.panel.background"), ";\n color: ").concat(dt("datepicker.panel.color"), ";\n border: 1px solid ").concat(dt("datepicker.panel.border.color"), ";\n border-radius: ").concat(dt("datepicker.panel.border.radius"), ";\n box-shadow: ").concat(dt("datepicker.panel.shadow"), ";\n}\n\n.p-datepicker-panel-inline {\n display: inline-block;\n overflow-x: auto;\n box-shadow: none;\n}\n\n.p-datepicker-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: ").concat(dt("datepicker.header.padding"), ";\n background: ").concat(dt("datepicker.header.background"), ";\n color: ").concat(dt("datepicker.header.color"), ";\n border-block-end: 1px solid ").concat(dt("datepicker.header.border.color"), ";\n}\n\n.p-datepicker-next-button:dir(rtl) {\n order: -1;\n}\n\n.p-datepicker-prev-button:dir(rtl) {\n order: 1;\n}\n\n.p-datepicker-title {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ").concat(dt("datepicker.title.gap"), ";\n font-weight: ").concat(dt("datepicker.title.font.weight"), ";\n}\n\n.p-datepicker-select-year,\n.p-datepicker-select-month {\n border: none;\n background: transparent;\n margin: 0;\n cursor: pointer;\n font-weight: inherit;\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ", box-shadow ").concat(dt("datepicker.transition.duration"), ";\n}\n\n.p-datepicker-select-month {\n padding: ").concat(dt("datepicker.select.month.padding"), ";\n color: ").concat(dt("datepicker.select.month.color"), ";\n border-radius: ").concat(dt("datepicker.select.month.border.radius"), ";\n}\n\n.p-datepicker-select-year {\n padding: ").concat(dt("datepicker.select.year.padding"), ";\n color: ").concat(dt("datepicker.select.year.color"), ";\n border-radius: ").concat(dt("datepicker.select.year.border.radius"), ";\n}\n\n.p-datepicker-select-month:enabled:hover {\n background: ").concat(dt("datepicker.select.month.hover.background"), ";\n color: ").concat(dt("datepicker.select.month.hover.color"), ";\n}\n\n.p-datepicker-select-year:enabled:hover {\n background: ").concat(dt("datepicker.select.year.hover.background"), ";\n color: ").concat(dt("datepicker.select.year.hover.color"), ";\n}\n\n.p-datepicker-select-month:focus-visible,\n.p-datepicker-select-year:focus-visible {\n box-shadow: ").concat(dt("datepicker.date.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.date.focus.ring.width"), " ").concat(dt("datepicker.date.focus.ring.style"), " ").concat(dt("datepicker.date.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.date.focus.ring.offset"), ";\n}\n\n.p-datepicker-calendar-container {\n display: flex;\n}\n\n.p-datepicker-calendar-container .p-datepicker-calendar {\n flex: 1 1 auto;\n border-inline-start: 1px solid ").concat(dt("datepicker.group.border.color"), ";\n padding-inline-end: ").concat(dt("datepicker.group.gap"), ";\n padding-inline-start: ").concat(dt("datepicker.group.gap"), ";\n}\n\n.p-datepicker-calendar-container .p-datepicker-calendar:first-child {\n padding-inline-start: 0;\n border-inline-start: 0 none;\n}\n\n.p-datepicker-calendar-container .p-datepicker-calendar:last-child {\n padding-inline-end: 0;\n}\n\n.p-datepicker-day-view {\n width: 100%;\n border-collapse: collapse;\n font-size: 1rem;\n margin: ").concat(dt("datepicker.day.view.margin"), ";\n}\n\n.p-datepicker-weekday-cell {\n padding: ").concat(dt("datepicker.week.day.padding"), ";\n}\n\n.p-datepicker-weekday {\n font-weight: ").concat(dt("datepicker.week.day.font.weight"), ";\n color: ").concat(dt("datepicker.week.day.color"), ";\n}\n\n.p-datepicker-day-cell {\n padding: ").concat(dt("datepicker.date.padding"), ";\n}\n\n.p-datepicker-day {\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n margin: 0 auto;\n overflow: hidden;\n position: relative;\n width: ").concat(dt("datepicker.date.width"), ";\n height: ").concat(dt("datepicker.date.height"), ";\n border-radius: ").concat(dt("datepicker.date.border.radius"), ";\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", box-shadow ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ";\n border: 1px solid transparent;\n outline-color: transparent;\n color: ").concat(dt("datepicker.date.color"), ";\n}\n\n.p-datepicker-day:not(.p-datepicker-day-selected):not(.p-disabled):hover {\n background: ").concat(dt("datepicker.date.hover.background"), ";\n color: ").concat(dt("datepicker.date.hover.color"), ";\n}\n\n.p-datepicker-day:focus-visible {\n box-shadow: ").concat(dt("datepicker.date.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.date.focus.ring.width"), " ").concat(dt("datepicker.date.focus.ring.style"), " ").concat(dt("datepicker.date.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.date.focus.ring.offset"), ";\n}\n\n.p-datepicker-day-selected {\n background: ").concat(dt("datepicker.date.selected.background"), ";\n color: ").concat(dt("datepicker.date.selected.color"), ";\n}\n\n.p-datepicker-day-selected-range {\n background: ").concat(dt("datepicker.date.range.selected.background"), ";\n color: ").concat(dt("datepicker.date.range.selected.color"), ";\n}\n\n.p-datepicker-today > .p-datepicker-day {\n background: ").concat(dt("datepicker.today.background"), ";\n color: ").concat(dt("datepicker.today.color"), ";\n}\n\n.p-datepicker-today > .p-datepicker-day-selected {\n background: ").concat(dt("datepicker.date.selected.background"), ";\n color: ").concat(dt("datepicker.date.selected.color"), ";\n}\n\n.p-datepicker-today > .p-datepicker-day-selected-range {\n background: ").concat(dt("datepicker.date.range.selected.background"), ";\n color: ").concat(dt("datepicker.date.range.selected.color"), ";\n}\n\n.p-datepicker-weeknumber {\n text-align: center;\n}\n\n.p-datepicker-month-view {\n margin: ").concat(dt("datepicker.month.view.margin"), ";\n}\n\n.p-datepicker-month {\n width: 33.3%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n overflow: hidden;\n position: relative;\n padding: ").concat(dt("datepicker.month.padding"), ";\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", box-shadow ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ";\n border-radius: ").concat(dt("datepicker.month.border.radius"), ";\n outline-color: transparent;\n color: ").concat(dt("datepicker.date.color"), ";\n}\n\n.p-datepicker-month:not(.p-disabled):not(.p-datepicker-month-selected):hover {\n color: ").concat(dt("datepicker.date.hover.color"), ";\n background: ").concat(dt("datepicker.date.hover.background"), ";\n}\n\n.p-datepicker-month-selected {\n color: ").concat(dt("datepicker.date.selected.color"), ";\n background: ").concat(dt("datepicker.date.selected.background"), ";\n}\n\n.p-datepicker-month:not(.p-disabled):focus-visible {\n box-shadow: ").concat(dt("datepicker.date.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.date.focus.ring.width"), " ").concat(dt("datepicker.date.focus.ring.style"), " ").concat(dt("datepicker.date.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.date.focus.ring.offset"), ";\n}\n\n.p-datepicker-year-view {\n margin: ").concat(dt("datepicker.year.view.margin"), ";\n}\n\n.p-datepicker-year {\n width: 50%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n overflow: hidden;\n position: relative;\n padding: ").concat(dt("datepicker.year.padding"), ";\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", box-shadow ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ";\n border-radius: ").concat(dt("datepicker.year.border.radius"), ";\n outline-color: transparent;\n color: ").concat(dt("datepicker.date.color"), ";\n}\n\n.p-datepicker-year:not(.p-disabled):not(.p-datepicker-year-selected):hover {\n color: ").concat(dt("datepicker.date.hover.color"), ";\n background: ").concat(dt("datepicker.date.hover.background"), ";\n}\n\n.p-datepicker-year-selected {\n color: ").concat(dt("datepicker.date.selected.color"), ";\n background: ").concat(dt("datepicker.date.selected.background"), ";\n}\n\n.p-datepicker-year:not(.p-disabled):focus-visible {\n box-shadow: ").concat(dt("datepicker.date.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.date.focus.ring.width"), " ").concat(dt("datepicker.date.focus.ring.style"), " ").concat(dt("datepicker.date.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.date.focus.ring.offset"), ";\n}\n\n.p-datepicker-buttonbar {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: ").concat(dt("datepicker.buttonbar.padding"), ";\n border-block-start: 1px solid ").concat(dt("datepicker.buttonbar.border.color"), ";\n}\n\n.p-datepicker-buttonbar .p-button {\n width: auto;\n}\n\n.p-datepicker-time-picker {\n display: flex;\n justify-content: center;\n align-items: center;\n border-block-start: 1px solid ").concat(dt("datepicker.time.picker.border.color"), ";\n padding: 0;\n gap: ").concat(dt("datepicker.time.picker.gap"), ";\n}\n\n.p-datepicker-calendar-container + .p-datepicker-time-picker {\n padding: ").concat(dt("datepicker.time.picker.padding"), ";\n}\n\n.p-datepicker-time-picker > div {\n display: flex;\n align-items: center;\n flex-direction: column;\n gap: ").concat(dt("datepicker.time.picker.button.gap"), ";\n}\n\n.p-datepicker-time-picker span {\n font-size: 1rem;\n}\n\n.p-datepicker-timeonly .p-datepicker-time-picker {\n border-block-start: 0 none;\n}\n\n.p-datepicker:has(.p-inputtext-sm) .p-datepicker-dropdown {\n width: ").concat(dt("datepicker.dropdown.sm.width"), ";\n}\n\n.p-datepicker:has(.p-inputtext-sm) .p-datepicker-dropdown .p-icon,\n.p-datepicker:has(.p-inputtext-sm) .p-datepicker-input-icon {\n font-size: ").concat(dt("form.field.sm.font.size"), ";\n width: ").concat(dt("form.field.sm.font.size"), ";\n height: ").concat(dt("form.field.sm.font.size"), ";\n}\n\n.p-datepicker:has(.p-inputtext-lg) .p-datepicker-dropdown {\n width: ").concat(dt("datepicker.dropdown.lg.width"), ";\n}\n\n.p-datepicker:has(.p-inputtext-lg) .p-datepicker-dropdown .p-icon,\n.p-datepicker:has(.p-inputtext-lg) .p-datepicker-input-icon {\n font-size: ").concat(dt("form.field.lg.font.size"), ";\n width: ").concat(dt("form.field.lg.font.size"), ";\n height: ").concat(dt("form.field.lg.font.size"), ";\n}\n"); +}, "theme"); +var inlineStyles$8 = { + root: /* @__PURE__ */ __name(function root4(_ref2) { + var props = _ref2.props; + return { + position: props.appendTo === "self" ? "relative" : void 0 + }; + }, "root") +}; +var classes$D = { + root: /* @__PURE__ */ __name(function root5(_ref3) { + var instance = _ref3.instance, state = _ref3.state; + return ["p-datepicker p-component p-inputwrapper", { + "p-invalid": instance.$invalid, + "p-inputwrapper-filled": instance.$filled, + "p-inputwrapper-focus": state.focused || state.overlayVisible, + "p-focus": state.focused || state.overlayVisible, + "p-datepicker-fluid": instance.$fluid + }]; + }, "root"), + pcInputText: "p-datepicker-input", + dropdown: "p-datepicker-dropdown", + inputIconContainer: "p-datepicker-input-icon-container", + inputIcon: "p-datepicker-input-icon", + panel: /* @__PURE__ */ __name(function panel(_ref4) { + var props = _ref4.props; + return ["p-datepicker-panel p-component", { + "p-datepicker-panel-inline": props.inline, + "p-disabled": props.disabled, + "p-datepicker-timeonly": props.timeOnly + }]; + }, "panel"), + calendarContainer: "p-datepicker-calendar-container", + calendar: "p-datepicker-calendar", + header: "p-datepicker-header", + pcPrevButton: "p-datepicker-prev-button", + title: "p-datepicker-title", + selectMonth: "p-datepicker-select-month", + selectYear: "p-datepicker-select-year", + decade: "p-datepicker-decade", + pcNextButton: "p-datepicker-next-button", + dayView: "p-datepicker-day-view", + weekHeader: "p-datepicker-weekheader p-disabled", + weekNumber: "p-datepicker-weeknumber", + weekLabelContainer: "p-datepicker-weeklabel-container p-disabled", + weekDayCell: "p-datepicker-weekday-cell", + weekDay: "p-datepicker-weekday", + dayCell: /* @__PURE__ */ __name(function dayCell(_ref5) { + var date = _ref5.date; + return ["p-datepicker-day-cell", { + "p-datepicker-other-month": date.otherMonth, + "p-datepicker-today": date.today + }]; + }, "dayCell"), + day: /* @__PURE__ */ __name(function day(_ref6) { + var instance = _ref6.instance, props = _ref6.props, date = _ref6.date; + var selectedDayClass = ""; + if (instance.isRangeSelection() && instance.isSelected(date) && date.selectable) { + selectedDayClass = instance.isDateEquals(props.modelValue[0], date) || instance.isDateEquals(props.modelValue[1], date) ? "p-datepicker-day-selected" : "p-datepicker-day-selected-range"; + } + return ["p-datepicker-day", { + "p-datepicker-day-selected": !instance.isRangeSelection() && instance.isSelected(date) && date.selectable, + "p-disabled": props.disabled || !date.selectable + }, selectedDayClass]; + }, "day"), + monthView: "p-datepicker-month-view", + month: /* @__PURE__ */ __name(function month(_ref7) { + var instance = _ref7.instance, props = _ref7.props, _month = _ref7.month, index = _ref7.index; + return ["p-datepicker-month", { + "p-datepicker-month-selected": instance.isMonthSelected(index), + "p-disabled": props.disabled || !_month.selectable + }]; + }, "month"), + yearView: "p-datepicker-year-view", + year: /* @__PURE__ */ __name(function year(_ref8) { + var instance = _ref8.instance, props = _ref8.props, _year = _ref8.year; + return ["p-datepicker-year", { + "p-datepicker-year-selected": instance.isYearSelected(_year.value), + "p-disabled": props.disabled || !_year.selectable + }]; + }, "year"), + timePicker: "p-datepicker-time-picker", + hourPicker: "p-datepicker-hour-picker", + pcIncrementButton: "p-datepicker-increment-button", + pcDecrementButton: "p-datepicker-decrement-button", + separator: "p-datepicker-separator", + minutePicker: "p-datepicker-minute-picker", + secondPicker: "p-datepicker-second-picker", + ampmPicker: "p-datepicker-ampm-picker", + buttonbar: "p-datepicker-buttonbar", + pcTodayButton: "p-datepicker-today-button", + pcClearButton: "p-datepicker-clear-button" +}; +var DatePickerStyle = BaseStyle.extend({ + name: "datepicker", + theme: theme$z, + classes: classes$D, + inlineStyles: inlineStyles$8 +}); +var script$1$F = { + name: "BaseDatePicker", + "extends": script$1n, + props: { + selectionMode: { + type: String, + "default": "single" + }, + dateFormat: { + type: String, + "default": null + }, + inline: { + type: Boolean, + "default": false + }, + showOtherMonths: { + type: Boolean, + "default": true + }, + selectOtherMonths: { + type: Boolean, + "default": false + }, + showIcon: { + type: Boolean, + "default": false + }, + iconDisplay: { + type: String, + "default": "button" + }, + icon: { + type: String, + "default": void 0 + }, + prevIcon: { + type: String, + "default": void 0 + }, + nextIcon: { + type: String, + "default": void 0 + }, + incrementIcon: { + type: String, + "default": void 0 + }, + decrementIcon: { + type: String, + "default": void 0 + }, + numberOfMonths: { + type: Number, + "default": 1 + }, + responsiveOptions: Array, + breakpoint: { + type: String, + "default": "769px" + }, + view: { + type: String, + "default": "date" + }, + minDate: { + type: Date, + value: null + }, + maxDate: { + type: Date, + value: null + }, + disabledDates: { + type: Array, + value: null + }, + disabledDays: { + type: Array, + value: null + }, + maxDateCount: { + type: Number, + value: null + }, + showOnFocus: { + type: Boolean, + "default": true + }, + autoZIndex: { + type: Boolean, + "default": true + }, + baseZIndex: { + type: Number, + "default": 0 + }, + showButtonBar: { + type: Boolean, + "default": false + }, + shortYearCutoff: { + type: String, + "default": "+10" + }, + showTime: { + type: Boolean, + "default": false + }, + timeOnly: { + type: Boolean, + "default": false + }, + hourFormat: { + type: String, + "default": "24" + }, + stepHour: { + type: Number, + "default": 1 + }, + stepMinute: { + type: Number, + "default": 1 + }, + stepSecond: { + type: Number, + "default": 1 + }, + showSeconds: { + type: Boolean, + "default": false + }, + hideOnDateTimeSelect: { + type: Boolean, + "default": false + }, + hideOnRangeSelection: { + type: Boolean, + "default": false + }, + timeSeparator: { + type: String, + "default": ":" + }, + showWeek: { + type: Boolean, + "default": false + }, + manualInput: { + type: Boolean, + "default": true + }, + appendTo: { + type: [String, Object], + "default": "body" + }, + readonly: { + type: Boolean, + "default": false + }, + placeholder: { + type: String, + "default": null + }, + id: { + type: String, + "default": null + }, + inputId: { + type: String, + "default": null + }, + inputClass: { + type: [String, Object], + "default": null + }, + inputStyle: { + type: Object, + "default": null + }, + panelClass: { + type: [String, Object], + "default": null + }, + panelStyle: { + type: Object, + "default": null + }, + todayButtonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default3() { + return { + severity: "secondary", + text: true, + size: "small" + }; + }, "_default") + }, + clearButtonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default4() { + return { + severity: "secondary", + text: true, + size: "small" + }; + }, "_default") + }, + navigatorButtonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default5() { + return { + severity: "secondary", + text: true, + rounded: true + }; + }, "_default") + }, + timepickerButtonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default6() { + return { + severity: "secondary", + text: true, + rounded: true + }; + }, "_default") + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + } + }, + style: DatePickerStyle, + provide: /* @__PURE__ */ __name(function provide10() { + return { + $pcDatePicker: this, + $parentInstance: this + }; + }, "provide") +}; +function _typeof$l(o) { + "@babel/helpers - typeof"; + return _typeof$l = "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$l(o); +} +__name(_typeof$l, "_typeof$l"); +function _toConsumableArray$d(r) { + return _arrayWithoutHoles$d(r) || _iterableToArray$d(r) || _unsupportedIterableToArray$e(r) || _nonIterableSpread$d(); +} +__name(_toConsumableArray$d, "_toConsumableArray$d"); +function _nonIterableSpread$d() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableSpread$d, "_nonIterableSpread$d"); +function _iterableToArray$d(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray$d, "_iterableToArray$d"); +function _arrayWithoutHoles$d(r) { + if (Array.isArray(r)) return _arrayLikeToArray$e(r); +} +__name(_arrayWithoutHoles$d, "_arrayWithoutHoles$d"); +function _createForOfIteratorHelper$4(r, e) { + var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (!t2) { + if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$e(r)) || e) { + t2 && (r = t2); + var _n = 0, F = /* @__PURE__ */ __name(function F2() { + }, "F"); + return { s: F, n: /* @__PURE__ */ __name(function n() { + return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; + }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { + throw r2; + }, "e"), 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 = true, u = false; + return { s: /* @__PURE__ */ __name(function s() { + t2 = t2.call(r); + }, "s"), n: /* @__PURE__ */ __name(function n() { + var r2 = t2.next(); + return a = r2.done, r2; + }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { + u = true, o = r2; + }, "e"), f: /* @__PURE__ */ __name(function f() { + try { + a || null == t2["return"] || t2["return"](); + } finally { + if (u) throw o; + } + }, "f") }; +} +__name(_createForOfIteratorHelper$4, "_createForOfIteratorHelper$4"); +function _unsupportedIterableToArray$e(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$e(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$e(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$e, "_unsupportedIterableToArray$e"); +function _arrayLikeToArray$e(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; +} +__name(_arrayLikeToArray$e, "_arrayLikeToArray$e"); +var script$12 = { + name: "DatePicker", + "extends": script$1$F, + inheritAttrs: false, + emits: ["show", "hide", "input", "month-change", "year-change", "date-select", "today-click", "clear-click", "focus", "blur", "keydown"], + inject: { + $pcFluid: { + "default": null + } + }, + navigationState: null, + timePickerChange: false, + scrollHandler: null, + outsideClickListener: null, + resizeListener: null, + matchMediaListener: null, + overlay: null, + input: null, + previousButton: null, + nextButton: null, + timePickerTimer: null, + preventFocus: false, + typeUpdate: false, + data: /* @__PURE__ */ __name(function data3() { + return { + d_id: this.id, + currentMonth: null, + currentYear: null, + currentHour: null, + currentMinute: null, + currentSecond: null, + pm: null, + focused: false, + overlayVisible: false, + currentView: this.view, + query: null, + queryMatches: false + }; + }, "data"), + watch: { + id: /* @__PURE__ */ __name(function id3(newValue) { + this.d_id = newValue || UniqueComponentId(); + }, "id"), + modelValue: /* @__PURE__ */ __name(function modelValue(newValue) { + this.updateCurrentMetaData(); + if (!this.typeUpdate && !this.inline && this.input) { + this.input.value = this.inputFieldValue; + } + this.typeUpdate = false; + }, "modelValue"), + showTime: /* @__PURE__ */ __name(function showTime() { + this.updateCurrentMetaData(); + }, "showTime"), + minDate: /* @__PURE__ */ __name(function minDate() { + this.updateCurrentMetaData(); + }, "minDate"), + maxDate: /* @__PURE__ */ __name(function maxDate() { + this.updateCurrentMetaData(); + }, "maxDate"), + months: /* @__PURE__ */ __name(function months() { + if (this.overlay) { + if (!this.focused) { + if (this.inline) { + this.preventFocus = true; + } + setTimeout(this.updateFocus, 0); + } + } + }, "months"), + numberOfMonths: /* @__PURE__ */ __name(function numberOfMonths() { + this.destroyResponsiveStyleElement(); + this.createResponsiveStyle(); + }, "numberOfMonths"), + responsiveOptions: /* @__PURE__ */ __name(function responsiveOptions() { + this.destroyResponsiveStyleElement(); + this.createResponsiveStyle(); + }, "responsiveOptions"), + currentView: /* @__PURE__ */ __name(function currentView() { + var _this = this; + Promise.resolve(null).then(function() { + return _this.alignOverlay(); + }); + }, "currentView"), + view: /* @__PURE__ */ __name(function view(newValue) { + this.currentView = newValue; + }, "view") + }, + created: /* @__PURE__ */ __name(function created2() { + this.updateCurrentMetaData(); + }, "created"), + mounted: /* @__PURE__ */ __name(function mounted5() { + this.d_id = this.d_id || UniqueComponentId(); + this.createResponsiveStyle(); + this.bindMatchMediaListener(); + if (this.inline) { + if (!this.disabled) { + this.preventFocus = true; + this.initFocusableCell(); + } + } else { + this.input.value = this.inputFieldValue; + } + }, "mounted"), + updated: /* @__PURE__ */ __name(function updated3() { + if (this.overlay) { + this.preventFocus = true; + setTimeout(this.updateFocus, 0); + } + if (this.input && this.selectionStart != null && this.selectionEnd != null) { + this.input.selectionStart = this.selectionStart; + this.input.selectionEnd = this.selectionEnd; + this.selectionStart = null; + this.selectionEnd = null; + } + }, "updated"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount2() { + if (this.timePickerTimer) { + clearTimeout(this.timePickerTimer); + } + this.destroyResponsiveStyleElement(); + this.unbindOutsideClickListener(); + this.unbindResizeListener(); + this.unbindMatchMediaListener(); + if (this.scrollHandler) { + this.scrollHandler.destroy(); + this.scrollHandler = null; + } + if (this.overlay && this.autoZIndex) { + ZIndex.clear(this.overlay); + } + this.overlay = null; + }, "beforeUnmount"), + methods: { + isComparable: /* @__PURE__ */ __name(function isComparable() { + return this.d_value != null && typeof this.d_value !== "string"; + }, "isComparable"), + isSelected: /* @__PURE__ */ __name(function isSelected(dateMeta) { + if (!this.isComparable()) { + return false; + } + if (this.d_value) { + if (this.isSingleSelection()) { + return this.isDateEquals(this.d_value, dateMeta); + } else if (this.isMultipleSelection()) { + var selected3 = false; + var _iterator = _createForOfIteratorHelper$4(this.d_value), _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + var date = _step.value; + selected3 = this.isDateEquals(date, dateMeta); + if (selected3) { + break; + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + return selected3; + } else if (this.isRangeSelection()) { + if (this.d_value[1]) return this.isDateEquals(this.d_value[0], dateMeta) || this.isDateEquals(this.d_value[1], dateMeta) || this.isDateBetween(this.d_value[0], this.d_value[1], dateMeta); + else { + return this.isDateEquals(this.d_value[0], dateMeta); + } + } + } + return false; + }, "isSelected"), + isMonthSelected: /* @__PURE__ */ __name(function isMonthSelected(month2) { + var _this2 = this; + if (!this.isComparable()) return false; + if (this.isMultipleSelection()) { + return this.d_value.some(function(currentValue) { + return currentValue.getMonth() === month2 && currentValue.getFullYear() === _this2.currentYear; + }); + } else if (this.isRangeSelection()) { + if (!this.d_value[1]) { + var _this$d_value$, _this$d_value$2; + return ((_this$d_value$ = this.d_value[0]) === null || _this$d_value$ === void 0 ? void 0 : _this$d_value$.getFullYear()) === this.currentYear && ((_this$d_value$2 = this.d_value[0]) === null || _this$d_value$2 === void 0 ? void 0 : _this$d_value$2.getMonth()) === month2; + } else { + var currentDate = new Date(this.currentYear, month2, 1); + var startDate = new Date(this.d_value[0].getFullYear(), this.d_value[0].getMonth(), 1); + var endDate = new Date(this.d_value[1].getFullYear(), this.d_value[1].getMonth(), 1); + return currentDate >= startDate && currentDate <= endDate; + } + } else { + return this.d_value.getMonth() === month2 && this.d_value.getFullYear() === this.currentYear; + } + }, "isMonthSelected"), + isYearSelected: /* @__PURE__ */ __name(function isYearSelected(year2) { + if (!this.isComparable()) return false; + if (this.isMultipleSelection()) { + return this.d_value.some(function(currentValue) { + return currentValue.getFullYear() === year2; + }); + } else if (this.isRangeSelection()) { + var start = this.d_value[0] ? this.d_value[0].getFullYear() : null; + var end = this.d_value[1] ? this.d_value[1].getFullYear() : null; + return start === year2 || end === year2 || start < year2 && end > year2; + } else { + return this.d_value.getFullYear() === year2; + } + }, "isYearSelected"), + isDateEquals: /* @__PURE__ */ __name(function isDateEquals(value2, dateMeta) { + if (value2) return value2.getDate() === dateMeta.day && value2.getMonth() === dateMeta.month && value2.getFullYear() === dateMeta.year; + else return false; + }, "isDateEquals"), + isDateBetween: /* @__PURE__ */ __name(function isDateBetween(start, end, dateMeta) { + var between = false; + if (start && end) { + var date = new Date(dateMeta.year, dateMeta.month, dateMeta.day); + return start.getTime() <= date.getTime() && end.getTime() >= date.getTime(); + } + return between; + }, "isDateBetween"), + getFirstDayOfMonthIndex: /* @__PURE__ */ __name(function getFirstDayOfMonthIndex(month2, year2) { + var day2 = /* @__PURE__ */ new Date(); + day2.setDate(1); + day2.setMonth(month2); + day2.setFullYear(year2); + var dayIndex = day2.getDay() + this.sundayIndex; + return dayIndex >= 7 ? dayIndex - 7 : dayIndex; + }, "getFirstDayOfMonthIndex"), + getDaysCountInMonth: /* @__PURE__ */ __name(function getDaysCountInMonth(month2, year2) { + return 32 - this.daylightSavingAdjust(new Date(year2, month2, 32)).getDate(); + }, "getDaysCountInMonth"), + getDaysCountInPrevMonth: /* @__PURE__ */ __name(function getDaysCountInPrevMonth(month2, year2) { + var prev = this.getPreviousMonthAndYear(month2, year2); + return this.getDaysCountInMonth(prev.month, prev.year); + }, "getDaysCountInPrevMonth"), + getPreviousMonthAndYear: /* @__PURE__ */ __name(function getPreviousMonthAndYear(month2, year2) { + var m, y; + if (month2 === 0) { + m = 11; + y = year2 - 1; + } else { + m = month2 - 1; + y = year2; + } + return { + month: m, + year: y + }; + }, "getPreviousMonthAndYear"), + getNextMonthAndYear: /* @__PURE__ */ __name(function getNextMonthAndYear(month2, year2) { + var m, y; + if (month2 === 11) { + m = 0; + y = year2 + 1; + } else { + m = month2 + 1; + y = year2; + } + return { + month: m, + year: y + }; + }, "getNextMonthAndYear"), + daylightSavingAdjust: /* @__PURE__ */ __name(function daylightSavingAdjust(date) { + if (!date) { + return null; + } + date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); + return date; + }, "daylightSavingAdjust"), + isToday: /* @__PURE__ */ __name(function isToday(today, day2, month2, year2) { + return today.getDate() === day2 && today.getMonth() === month2 && today.getFullYear() === year2; + }, "isToday"), + isSelectable: /* @__PURE__ */ __name(function isSelectable(day2, month2, year2, otherMonth) { + var validMin = true; + var validMax = true; + var validDate = true; + var validDay = true; + if (otherMonth && !this.selectOtherMonths) { + return false; + } + if (this.minDate) { + if (this.minDate.getFullYear() > year2) { + validMin = false; + } else if (this.minDate.getFullYear() === year2) { + if (this.minDate.getMonth() > month2) { + validMin = false; + } else if (this.minDate.getMonth() === month2) { + if (this.minDate.getDate() > day2) { + validMin = false; + } + } + } + } + if (this.maxDate) { + if (this.maxDate.getFullYear() < year2) { + validMax = false; + } else if (this.maxDate.getFullYear() === year2) { + if (this.maxDate.getMonth() < month2) { + validMax = false; + } else if (this.maxDate.getMonth() === month2) { + if (this.maxDate.getDate() < day2) { + validMax = false; + } + } + } + } + if (this.disabledDates) { + validDate = !this.isDateDisabled(day2, month2, year2); + } + if (this.disabledDays) { + validDay = !this.isDayDisabled(day2, month2, year2); + } + return validMin && validMax && validDate && validDay; + }, "isSelectable"), + onOverlayEnter: /* @__PURE__ */ __name(function onOverlayEnter(el) { + var styles = !this.inline ? { + position: "absolute", + top: "0", + left: "0" + } : void 0; + addStyle(el, styles); + if (this.autoZIndex) { + ZIndex.set("overlay", el, this.baseZIndex || this.$primevue.config.zIndex.overlay); + } + this.alignOverlay(); + this.$emit("show"); + }, "onOverlayEnter"), + onOverlayEnterComplete: /* @__PURE__ */ __name(function onOverlayEnterComplete() { + this.bindOutsideClickListener(); + this.bindScrollListener(); + this.bindResizeListener(); + }, "onOverlayEnterComplete"), + onOverlayAfterLeave: /* @__PURE__ */ __name(function onOverlayAfterLeave(el) { + if (this.autoZIndex) { + ZIndex.clear(el); + } + }, "onOverlayAfterLeave"), + onOverlayLeave: /* @__PURE__ */ __name(function onOverlayLeave() { + this.currentView = this.view; + this.unbindOutsideClickListener(); + this.unbindScrollListener(); + this.unbindResizeListener(); + this.$emit("hide"); + this.overlay = null; + }, "onOverlayLeave"), + onPrevButtonClick: /* @__PURE__ */ __name(function onPrevButtonClick(event2) { + this.navigationState = { + backward: true, + button: true + }; + this.navBackward(event2); + }, "onPrevButtonClick"), + onNextButtonClick: /* @__PURE__ */ __name(function onNextButtonClick(event2) { + this.navigationState = { + backward: false, + button: true + }; + this.navForward(event2); + }, "onNextButtonClick"), + navBackward: /* @__PURE__ */ __name(function navBackward(event2) { + event2.preventDefault(); + if (!this.isEnabled()) { + return; + } + if (this.currentView === "month") { + this.decrementYear(); + this.$emit("year-change", { + month: this.currentMonth, + year: this.currentYear + }); + } else if (this.currentView === "year") { + this.decrementDecade(); + } else { + if (event2.shiftKey) { + this.decrementYear(); + } else { + if (this.currentMonth === 0) { + this.currentMonth = 11; + this.decrementYear(); + } else { + this.currentMonth--; + } + this.$emit("month-change", { + month: this.currentMonth + 1, + year: this.currentYear + }); + } + } + }, "navBackward"), + navForward: /* @__PURE__ */ __name(function navForward(event2) { + event2.preventDefault(); + if (!this.isEnabled()) { + return; + } + if (this.currentView === "month") { + this.incrementYear(); + this.$emit("year-change", { + month: this.currentMonth, + year: this.currentYear + }); + } else if (this.currentView === "year") { + this.incrementDecade(); + } else { + if (event2.shiftKey) { + this.incrementYear(); + } else { + if (this.currentMonth === 11) { + this.currentMonth = 0; + this.incrementYear(); + } else { + this.currentMonth++; + } + this.$emit("month-change", { + month: this.currentMonth + 1, + year: this.currentYear + }); + } + } + }, "navForward"), + decrementYear: /* @__PURE__ */ __name(function decrementYear() { + this.currentYear--; + }, "decrementYear"), + decrementDecade: /* @__PURE__ */ __name(function decrementDecade() { + this.currentYear = this.currentYear - 10; + }, "decrementDecade"), + incrementYear: /* @__PURE__ */ __name(function incrementYear() { + this.currentYear++; + }, "incrementYear"), + incrementDecade: /* @__PURE__ */ __name(function incrementDecade() { + this.currentYear = this.currentYear + 10; + }, "incrementDecade"), + switchToMonthView: /* @__PURE__ */ __name(function switchToMonthView(event2) { + this.currentView = "month"; + setTimeout(this.updateFocus, 0); + event2.preventDefault(); + }, "switchToMonthView"), + switchToYearView: /* @__PURE__ */ __name(function switchToYearView(event2) { + this.currentView = "year"; + setTimeout(this.updateFocus, 0); + event2.preventDefault(); + }, "switchToYearView"), + isEnabled: /* @__PURE__ */ __name(function isEnabled() { + return !this.disabled && !this.readonly; + }, "isEnabled"), + updateCurrentTimeMeta: /* @__PURE__ */ __name(function updateCurrentTimeMeta(date) { + var currentHour = date.getHours(); + if (this.hourFormat === "12") { + this.pm = currentHour > 11; + if (currentHour >= 12) currentHour = currentHour == 12 ? 12 : currentHour - 12; + } + this.currentHour = Math.floor(currentHour / this.stepHour) * this.stepHour; + this.currentMinute = Math.floor(date.getMinutes() / this.stepMinute) * this.stepMinute; + this.currentSecond = Math.floor(date.getSeconds() / this.stepSecond) * this.stepSecond; + }, "updateCurrentTimeMeta"), + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener2() { + var _this3 = this; + if (!this.outsideClickListener) { + this.outsideClickListener = function(event2) { + if (_this3.overlayVisible && _this3.isOutsideClicked(event2)) { + _this3.overlayVisible = false; + } + }; + document.addEventListener("mousedown", this.outsideClickListener); + } + }, "bindOutsideClickListener"), + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener2() { + if (this.outsideClickListener) { + document.removeEventListener("mousedown", this.outsideClickListener); + this.outsideClickListener = null; + } + }, "unbindOutsideClickListener"), + bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener() { + var _this4 = this; + if (!this.scrollHandler) { + this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, function() { + if (_this4.overlayVisible) { + _this4.overlayVisible = false; + } + }); + } + this.scrollHandler.bindScrollListener(); + }, "bindScrollListener"), + unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener() { + if (this.scrollHandler) { + this.scrollHandler.unbindScrollListener(); + } + }, "unbindScrollListener"), + bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener() { + var _this5 = this; + if (!this.resizeListener) { + this.resizeListener = function() { + if (_this5.overlayVisible && !isTouchDevice()) { + _this5.overlayVisible = false; + } + }; + window.addEventListener("resize", this.resizeListener); + } + }, "bindResizeListener"), + unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener() { + if (this.resizeListener) { + window.removeEventListener("resize", this.resizeListener); + this.resizeListener = null; + } + }, "unbindResizeListener"), + bindMatchMediaListener: /* @__PURE__ */ __name(function bindMatchMediaListener() { + var _this6 = this; + if (!this.matchMediaListener) { + var query = matchMedia("(max-width: ".concat(this.breakpoint, ")")); + this.query = query; + this.queryMatches = query.matches; + this.matchMediaListener = function() { + _this6.queryMatches = query.matches; + _this6.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"), + isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked2(event2) { + return !(this.$el.isSameNode(event2.target) || this.isNavIconClicked(event2) || this.$el.contains(event2.target) || this.overlay && this.overlay.contains(event2.target)); + }, "isOutsideClicked"), + isNavIconClicked: /* @__PURE__ */ __name(function isNavIconClicked(event2) { + return this.previousButton && (this.previousButton.isSameNode(event2.target) || this.previousButton.contains(event2.target)) || this.nextButton && (this.nextButton.isSameNode(event2.target) || this.nextButton.contains(event2.target)); + }, "isNavIconClicked"), + alignOverlay: /* @__PURE__ */ __name(function alignOverlay() { + if (this.overlay) { + if (this.appendTo === "self" || this.inline) { + relativePosition(this.overlay, this.$el); + } else { + if (this.view === "date") { + this.overlay.style.width = getOuterWidth(this.overlay) + "px"; + this.overlay.style.minWidth = getOuterWidth(this.$el) + "px"; + } else { + this.overlay.style.width = getOuterWidth(this.$el) + "px"; + } + absolutePosition(this.overlay, this.$el); + } + } + }, "alignOverlay"), + onButtonClick: /* @__PURE__ */ __name(function onButtonClick() { + if (this.isEnabled()) { + if (!this.overlayVisible) { + this.input.focus(); + this.overlayVisible = true; + } else { + this.overlayVisible = false; + } + } + }, "onButtonClick"), + isDateDisabled: /* @__PURE__ */ __name(function isDateDisabled(day2, month2, year2) { + if (this.disabledDates) { + var _iterator2 = _createForOfIteratorHelper$4(this.disabledDates), _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { + var disabledDate = _step2.value; + if (disabledDate.getFullYear() === year2 && disabledDate.getMonth() === month2 && disabledDate.getDate() === day2) { + return true; + } + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + } + return false; + }, "isDateDisabled"), + isDayDisabled: /* @__PURE__ */ __name(function isDayDisabled(day2, month2, year2) { + if (this.disabledDays) { + var weekday = new Date(year2, month2, day2); + var weekdayNumber = weekday.getDay(); + return this.disabledDays.indexOf(weekdayNumber) !== -1; + } + return false; + }, "isDayDisabled"), + onMonthDropdownChange: /* @__PURE__ */ __name(function onMonthDropdownChange(value2) { + this.currentMonth = parseInt(value2); + this.$emit("month-change", { + month: this.currentMonth + 1, + year: this.currentYear + }); + }, "onMonthDropdownChange"), + onYearDropdownChange: /* @__PURE__ */ __name(function onYearDropdownChange(value2) { + this.currentYear = parseInt(value2); + this.$emit("year-change", { + month: this.currentMonth + 1, + year: this.currentYear + }); + }, "onYearDropdownChange"), + onDateSelect: /* @__PURE__ */ __name(function onDateSelect(event2, dateMeta) { + var _this7 = this; + if (this.disabled || !dateMeta.selectable) { + return; + } + find(this.overlay, 'table td span:not([data-p-disabled="true"])').forEach(function(cell) { + return cell.tabIndex = -1; + }); + if (event2) { + event2.currentTarget.focus(); + } + if (this.isMultipleSelection() && this.isSelected(dateMeta)) { + var newValue = this.d_value.filter(function(date) { + return !_this7.isDateEquals(date, dateMeta); + }); + this.updateModel(newValue); + } else { + if (this.shouldSelectDate(dateMeta)) { + if (dateMeta.otherMonth) { + this.currentMonth = dateMeta.month; + this.currentYear = dateMeta.year; + this.selectDate(dateMeta); + } else { + this.selectDate(dateMeta); + } + } + } + if (this.isSingleSelection() && (!this.showTime || this.hideOnDateTimeSelect)) { + if (this.input) { + this.input.focus(); + } + setTimeout(function() { + _this7.overlayVisible = false; + }, 150); + } + }, "onDateSelect"), + selectDate: /* @__PURE__ */ __name(function selectDate(dateMeta) { + var _this8 = this; + var date = new Date(dateMeta.year, dateMeta.month, dateMeta.day); + if (this.showTime) { + this.hourFormat === "12" && this.currentHour !== 12 && this.pm ? date.setHours(this.currentHour + 12) : date.setHours(this.currentHour); + date.setMinutes(this.currentMinute); + date.setSeconds(this.currentSecond); + } + if (this.minDate && this.minDate > date) { + date = this.minDate; + this.currentHour = date.getHours(); + this.currentMinute = date.getMinutes(); + this.currentSecond = date.getSeconds(); + } + if (this.maxDate && this.maxDate < date) { + date = this.maxDate; + this.currentHour = date.getHours(); + this.currentMinute = date.getMinutes(); + this.currentSecond = date.getSeconds(); + } + var modelVal = null; + if (this.isSingleSelection()) { + modelVal = date; + } else if (this.isMultipleSelection()) { + modelVal = this.d_value ? [].concat(_toConsumableArray$d(this.d_value), [date]) : [date]; + } else if (this.isRangeSelection()) { + if (this.d_value && this.d_value.length) { + var startDate = this.d_value[0]; + var endDate = this.d_value[1]; + if (!endDate && date.getTime() >= startDate.getTime()) { + endDate = date; + } else { + startDate = date; + endDate = null; + } + modelVal = [startDate, endDate]; + } else { + modelVal = [date, null]; + } + } + if (modelVal !== null) { + this.updateModel(modelVal); + } + if (this.isRangeSelection() && this.hideOnRangeSelection && modelVal[1] !== null) { + setTimeout(function() { + _this8.overlayVisible = false; + }, 150); + } + this.$emit("date-select", date); + }, "selectDate"), + updateModel: /* @__PURE__ */ __name(function updateModel(value2) { + this.writeValue(value2); + }, "updateModel"), + shouldSelectDate: /* @__PURE__ */ __name(function shouldSelectDate() { + if (this.isMultipleSelection()) return this.maxDateCount != null ? this.maxDateCount > (this.d_value ? this.d_value.length : 0) : true; + else return true; + }, "shouldSelectDate"), + isSingleSelection: /* @__PURE__ */ __name(function isSingleSelection() { + return this.selectionMode === "single"; + }, "isSingleSelection"), + isRangeSelection: /* @__PURE__ */ __name(function isRangeSelection() { + return this.selectionMode === "range"; + }, "isRangeSelection"), + isMultipleSelection: /* @__PURE__ */ __name(function isMultipleSelection() { + return this.selectionMode === "multiple"; + }, "isMultipleSelection"), + formatValue: /* @__PURE__ */ __name(function formatValue(value2) { + if (typeof value2 === "string") { + return this.dateFormat ? this.formatDate(new Date(value2), this.dateFormat) : value2; + } + var formattedValue = ""; + if (value2) { + try { + if (this.isSingleSelection()) { + formattedValue = this.formatDateTime(value2); + } else if (this.isMultipleSelection()) { + for (var i = 0; i < value2.length; i++) { + var dateAsString = this.formatDateTime(value2[i]); + formattedValue += dateAsString; + if (i !== value2.length - 1) { + formattedValue += ", "; + } + } + } else if (this.isRangeSelection()) { + if (value2 && value2.length) { + var startDate = value2[0]; + var endDate = value2[1]; + formattedValue = this.formatDateTime(startDate); + if (endDate) { + formattedValue += " - " + this.formatDateTime(endDate); + } + } + } + } catch (err) { + formattedValue = value2; + } + } + return formattedValue; + }, "formatValue"), + formatDateTime: /* @__PURE__ */ __name(function formatDateTime(date) { + var formattedValue = null; + if (date) { + if (this.timeOnly) { + formattedValue = this.formatTime(date); + } else { + formattedValue = this.formatDate(date, this.datePattern); + if (this.showTime) { + formattedValue += " " + this.formatTime(date); + } + } + } + return formattedValue; + }, "formatDateTime"), + formatDate: /* @__PURE__ */ __name(function formatDate(date, format) { + if (!date) { + return ""; + } + var iFormat; + var lookAhead = /* @__PURE__ */ __name(function lookAhead2(match) { + var matches = iFormat + 1 < format.length && format.charAt(iFormat + 1) === match; + if (matches) { + iFormat++; + } + return matches; + }, "lookAhead"), formatNumber = /* @__PURE__ */ __name(function formatNumber2(match, value2, len) { + var num = "" + value2; + if (lookAhead(match)) { + while (num.length < len) { + num = "0" + num; + } + } + return num; + }, "formatNumber"), formatName = /* @__PURE__ */ __name(function formatName2(match, value2, shortNames, longNames) { + return lookAhead(match) ? longNames[value2] : shortNames[value2]; + }, "formatName"); + var output = ""; + var literal = false; + if (date) { + for (iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) { + if (format.charAt(iFormat) === "'" && !lookAhead("'")) { + literal = false; + } else { + output += format.charAt(iFormat); + } + } else { + switch (format.charAt(iFormat)) { + case "d": + output += formatNumber("d", date.getDate(), 2); + break; + case "D": + output += formatName("D", date.getDay(), this.$primevue.config.locale.dayNamesShort, this.$primevue.config.locale.dayNames); + break; + case "o": + output += formatNumber("o", Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 864e5), 3); + break; + case "m": + output += formatNumber("m", date.getMonth() + 1, 2); + break; + case "M": + output += formatName("M", date.getMonth(), this.$primevue.config.locale.monthNamesShort, this.$primevue.config.locale.monthNames); + break; + case "y": + output += lookAhead("y") ? date.getFullYear() : (date.getFullYear() % 100 < 10 ? "0" : "") + date.getFullYear() % 100; + break; + case "@": + output += date.getTime(); + break; + case "!": + output += date.getTime() * 1e4 + this.ticksTo1970; + break; + case "'": + if (lookAhead("'")) { + output += "'"; + } else { + literal = true; + } + break; + default: + output += format.charAt(iFormat); + } + } + } + } + return output; + }, "formatDate"), + formatTime: /* @__PURE__ */ __name(function formatTime(date) { + if (!date) { + return ""; + } + var output = ""; + var hours = date.getHours(); + var minutes = date.getMinutes(); + var seconds = date.getSeconds(); + if (this.hourFormat === "12" && hours > 11 && hours !== 12) { + hours -= 12; + } + if (this.hourFormat === "12") { + output += hours === 0 ? 12 : hours < 10 ? "0" + hours : hours; + } else { + output += hours < 10 ? "0" + hours : hours; + } + output += ":"; + output += minutes < 10 ? "0" + minutes : minutes; + if (this.showSeconds) { + output += ":"; + output += seconds < 10 ? "0" + seconds : seconds; + } + if (this.hourFormat === "12") { + output += date.getHours() > 11 ? " ".concat(this.$primevue.config.locale.pm) : " ".concat(this.$primevue.config.locale.am); + } + return output; + }, "formatTime"), + onTodayButtonClick: /* @__PURE__ */ __name(function onTodayButtonClick(event2) { + var date = /* @__PURE__ */ new Date(); + var dateMeta = { + day: date.getDate(), + month: date.getMonth(), + year: date.getFullYear(), + otherMonth: date.getMonth() !== this.currentMonth || date.getFullYear() !== this.currentYear, + today: true, + selectable: true + }; + this.onDateSelect(null, dateMeta); + this.$emit("today-click", date); + event2.preventDefault(); + }, "onTodayButtonClick"), + onClearButtonClick: /* @__PURE__ */ __name(function onClearButtonClick(event2) { + this.updateModel(null); + this.overlayVisible = false; + this.$emit("clear-click", event2); + event2.preventDefault(); + }, "onClearButtonClick"), + onTimePickerElementMouseDown: /* @__PURE__ */ __name(function onTimePickerElementMouseDown(event2, type, direction) { + if (this.isEnabled()) { + this.repeat(event2, null, type, direction); + event2.preventDefault(); + } + }, "onTimePickerElementMouseDown"), + onTimePickerElementMouseUp: /* @__PURE__ */ __name(function onTimePickerElementMouseUp(event2) { + if (this.isEnabled()) { + this.clearTimePickerTimer(); + this.updateModelTime(); + event2.preventDefault(); + } + }, "onTimePickerElementMouseUp"), + onTimePickerElementMouseLeave: /* @__PURE__ */ __name(function onTimePickerElementMouseLeave() { + this.clearTimePickerTimer(); + }, "onTimePickerElementMouseLeave"), + repeat: /* @__PURE__ */ __name(function repeat(event2, interval, type, direction) { + var _this9 = this; + var i = interval || 500; + this.clearTimePickerTimer(); + this.timePickerTimer = setTimeout(function() { + _this9.repeat(event2, 100, type, direction); + }, i); + switch (type) { + case 0: + if (direction === 1) this.incrementHour(event2); + else this.decrementHour(event2); + break; + case 1: + if (direction === 1) this.incrementMinute(event2); + else this.decrementMinute(event2); + break; + case 2: + if (direction === 1) this.incrementSecond(event2); + else this.decrementSecond(event2); + break; + } + }, "repeat"), + convertTo24Hour: /* @__PURE__ */ __name(function convertTo24Hour(hours, pm) { + if (this.hourFormat == "12") { + if (hours === 12) { + return pm ? 12 : 0; + } else { + return pm ? hours + 12 : hours; + } + } + return hours; + }, "convertTo24Hour"), + validateTime: /* @__PURE__ */ __name(function validateTime(hour, minute, second, pm) { + var value2 = this.isComparable() ? this.d_value : this.viewDate; + var convertedHour = this.convertTo24Hour(hour, pm); + if (this.isRangeSelection()) { + value2 = this.d_value[1] || this.d_value[0]; + } + if (this.isMultipleSelection()) { + value2 = this.d_value[this.d_value.length - 1]; + } + var valueDateString = value2 ? value2.toDateString() : null; + if (this.minDate && valueDateString && this.minDate.toDateString() === valueDateString) { + if (this.minDate.getHours() > convertedHour) { + return false; + } + if (this.minDate.getHours() === convertedHour) { + if (this.minDate.getMinutes() > minute) { + return false; + } + if (this.minDate.getMinutes() === minute) { + if (this.minDate.getSeconds() > second) { + return false; + } + } + } + } + if (this.maxDate && valueDateString && this.maxDate.toDateString() === valueDateString) { + if (this.maxDate.getHours() < convertedHour) { + return false; + } + if (this.maxDate.getHours() === convertedHour) { + if (this.maxDate.getMinutes() < minute) { + return false; + } + if (this.maxDate.getMinutes() === minute) { + if (this.maxDate.getSeconds() < second) { + return false; + } + } + } + } + return true; + }, "validateTime"), + incrementHour: /* @__PURE__ */ __name(function incrementHour(event2) { + var prevHour = this.currentHour; + var newHour = this.currentHour + Number(this.stepHour); + var newPM = this.pm; + if (this.hourFormat == "24") newHour = newHour >= 24 ? newHour - 24 : newHour; + else if (this.hourFormat == "12") { + if (prevHour < 12 && newHour > 11) { + newPM = !this.pm; + } + newHour = newHour >= 13 ? newHour - 12 : newHour; + } + if (this.validateTime(newHour, this.currentMinute, this.currentSecond, newPM)) { + this.currentHour = newHour; + this.pm = newPM; + } + event2.preventDefault(); + }, "incrementHour"), + decrementHour: /* @__PURE__ */ __name(function decrementHour(event2) { + var newHour = this.currentHour - this.stepHour; + var newPM = this.pm; + if (this.hourFormat == "24") newHour = newHour < 0 ? 24 + newHour : newHour; + else if (this.hourFormat == "12") { + if (this.currentHour === 12) { + newPM = !this.pm; + } + newHour = newHour <= 0 ? 12 + newHour : newHour; + } + if (this.validateTime(newHour, this.currentMinute, this.currentSecond, newPM)) { + this.currentHour = newHour; + this.pm = newPM; + } + event2.preventDefault(); + }, "decrementHour"), + incrementMinute: /* @__PURE__ */ __name(function incrementMinute(event2) { + var newMinute = this.currentMinute + Number(this.stepMinute); + if (this.validateTime(this.currentHour, newMinute, this.currentSecond, this.pm)) { + this.currentMinute = newMinute > 59 ? newMinute - 60 : newMinute; + } + event2.preventDefault(); + }, "incrementMinute"), + decrementMinute: /* @__PURE__ */ __name(function decrementMinute(event2) { + var newMinute = this.currentMinute - this.stepMinute; + newMinute = newMinute < 0 ? 60 + newMinute : newMinute; + if (this.validateTime(this.currentHour, newMinute, this.currentSecond, this.pm)) { + this.currentMinute = newMinute; + } + event2.preventDefault(); + }, "decrementMinute"), + incrementSecond: /* @__PURE__ */ __name(function incrementSecond(event2) { + var newSecond = this.currentSecond + Number(this.stepSecond); + if (this.validateTime(this.currentHour, this.currentMinute, newSecond, this.pm)) { + this.currentSecond = newSecond > 59 ? newSecond - 60 : newSecond; + } + event2.preventDefault(); + }, "incrementSecond"), + decrementSecond: /* @__PURE__ */ __name(function decrementSecond(event2) { + var newSecond = this.currentSecond - this.stepSecond; + newSecond = newSecond < 0 ? 60 + newSecond : newSecond; + if (this.validateTime(this.currentHour, this.currentMinute, newSecond, this.pm)) { + this.currentSecond = newSecond; + } + event2.preventDefault(); + }, "decrementSecond"), + updateModelTime: /* @__PURE__ */ __name(function updateModelTime() { + var _this10 = this; + this.timePickerChange = true; + var value2 = this.isComparable() ? this.d_value : this.viewDate; + if (this.isRangeSelection()) { + value2 = this.d_value[1] || this.d_value[0]; + } + if (this.isMultipleSelection()) { + value2 = this.d_value[this.d_value.length - 1]; + } + value2 = value2 ? new Date(value2.getTime()) : /* @__PURE__ */ new Date(); + if (this.hourFormat == "12") { + if (this.currentHour === 12) value2.setHours(this.pm ? 12 : 0); + else value2.setHours(this.pm ? this.currentHour + 12 : this.currentHour); + } else { + value2.setHours(this.currentHour); + } + value2.setMinutes(this.currentMinute); + value2.setSeconds(this.currentSecond); + if (this.isRangeSelection()) { + if (this.d_value[1]) value2 = [this.d_value[0], value2]; + else value2 = [value2, null]; + } + if (this.isMultipleSelection()) { + value2 = [].concat(_toConsumableArray$d(this.d_value.slice(0, -1)), [value2]); + } + this.updateModel(value2); + this.$emit("date-select", value2); + setTimeout(function() { + return _this10.timePickerChange = false; + }, 0); + }, "updateModelTime"), + toggleAMPM: /* @__PURE__ */ __name(function toggleAMPM(event2) { + var validHour = this.validateTime(this.currentHour, this.currentMinute, this.currentSecond, !this.pm); + if (!validHour && (this.maxDate || this.minDate)) return; + this.pm = !this.pm; + this.updateModelTime(); + event2.preventDefault(); + }, "toggleAMPM"), + clearTimePickerTimer: /* @__PURE__ */ __name(function clearTimePickerTimer() { + if (this.timePickerTimer) { + clearInterval(this.timePickerTimer); + } + }, "clearTimePickerTimer"), + onMonthSelect: /* @__PURE__ */ __name(function onMonthSelect(event2, _ref) { + _ref.month; + var index = _ref.index; + if (this.view === "month") { + this.onDateSelect(event2, { + year: this.currentYear, + month: index, + day: 1, + selectable: true + }); + } else { + this.currentMonth = index; + this.currentView = "date"; + this.$emit("month-change", { + month: this.currentMonth + 1, + year: this.currentYear + }); + } + setTimeout(this.updateFocus, 0); + }, "onMonthSelect"), + onYearSelect: /* @__PURE__ */ __name(function onYearSelect(event2, year2) { + if (this.view === "year") { + this.onDateSelect(event2, { + year: year2.value, + month: 0, + day: 1, + selectable: true + }); + } else { + this.currentYear = year2.value; + this.currentView = "month"; + this.$emit("year-change", { + month: this.currentMonth + 1, + year: this.currentYear + }); + } + setTimeout(this.updateFocus, 0); + }, "onYearSelect"), + updateCurrentMetaData: /* @__PURE__ */ __name(function updateCurrentMetaData() { + var viewDate2 = this.viewDate; + this.currentMonth = viewDate2.getMonth(); + this.currentYear = viewDate2.getFullYear(); + if (this.showTime || this.timeOnly) { + this.updateCurrentTimeMeta(viewDate2); + } + }, "updateCurrentMetaData"), + isValidSelection: /* @__PURE__ */ __name(function isValidSelection(value2) { + var _this11 = this; + if (value2 == null) { + return true; + } + var isValid = true; + if (this.isSingleSelection()) { + if (!this.isSelectable(value2.getDate(), value2.getMonth(), value2.getFullYear(), false)) { + isValid = false; + } + } else if (value2.every(function(v) { + return _this11.isSelectable(v.getDate(), v.getMonth(), v.getFullYear(), false); + })) { + if (this.isRangeSelection()) { + isValid = value2.length > 1 && value2[1] >= value2[0]; + } + } + return isValid; + }, "isValidSelection"), + parseValue: /* @__PURE__ */ __name(function parseValue(text) { + if (!text || text.trim().length === 0) { + return null; + } + var value2; + if (this.isSingleSelection()) { + value2 = this.parseDateTime(text); + } else if (this.isMultipleSelection()) { + var tokens = text.split(","); + value2 = []; + var _iterator3 = _createForOfIteratorHelper$4(tokens), _step3; + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { + var token = _step3.value; + value2.push(this.parseDateTime(token.trim())); + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + } else if (this.isRangeSelection()) { + var _tokens = text.split(" - "); + value2 = []; + for (var i = 0; i < _tokens.length; i++) { + value2[i] = this.parseDateTime(_tokens[i].trim()); + } + } + return value2; + }, "parseValue"), + parseDateTime: /* @__PURE__ */ __name(function parseDateTime(text) { + var date; + var parts = text.split(" "); + if (this.timeOnly) { + date = /* @__PURE__ */ new Date(); + this.populateTime(date, parts[0], parts[1]); + } else { + var dateFormat = this.datePattern; + if (this.showTime) { + date = this.parseDate(parts[0], dateFormat); + this.populateTime(date, parts[1], parts[2]); + } else { + date = this.parseDate(text, dateFormat); + } + } + return date; + }, "parseDateTime"), + populateTime: /* @__PURE__ */ __name(function populateTime(value2, timeString, ampm) { + if (this.hourFormat == "12" && !ampm) { + throw "Invalid Time"; + } + this.pm = ampm === this.$primevue.config.locale.pm || ampm === this.$primevue.config.locale.pm.toLowerCase(); + var time = this.parseTime(timeString); + value2.setHours(time.hour); + value2.setMinutes(time.minute); + value2.setSeconds(time.second); + }, "populateTime"), + parseTime: /* @__PURE__ */ __name(function parseTime(value2) { + var tokens = value2.split(":"); + var validTokenLength = this.showSeconds ? 3 : 2; + var regex = /^[0-9][0-9]$/; + if (tokens.length !== validTokenLength || !tokens[0].match(regex) || !tokens[1].match(regex) || this.showSeconds && !tokens[2].match(regex)) { + throw "Invalid time"; + } + var h = parseInt(tokens[0]); + var m = parseInt(tokens[1]); + var s = this.showSeconds ? parseInt(tokens[2]) : null; + if (isNaN(h) || isNaN(m) || h > 23 || m > 59 || this.hourFormat == "12" && h > 12 || this.showSeconds && (isNaN(s) || s > 59)) { + throw "Invalid time"; + } else { + if (this.hourFormat == "12" && h !== 12 && this.pm) { + h += 12; + } else if (this.hourFormat == "12" && h == 12 && !this.pm) { + h = 0; + } + return { + hour: h, + minute: m, + second: s + }; + } + }, "parseTime"), + parseDate: /* @__PURE__ */ __name(function parseDate(value2, format) { + if (format == null || value2 == null) { + throw "Invalid arguments"; + } + value2 = _typeof$l(value2) === "object" ? value2.toString() : value2 + ""; + if (value2 === "") { + return null; + } + var iFormat, dim, extra, iValue = 0, shortYearCutoff = typeof this.shortYearCutoff !== "string" ? this.shortYearCutoff : (/* @__PURE__ */ new Date()).getFullYear() % 100 + parseInt(this.shortYearCutoff, 10), year2 = -1, month2 = -1, day2 = -1, doy = -1, literal = false, date, lookAhead = /* @__PURE__ */ __name(function lookAhead2(match) { + var matches = iFormat + 1 < format.length && format.charAt(iFormat + 1) === match; + if (matches) { + iFormat++; + } + return matches; + }, "lookAhead"), getNumber = /* @__PURE__ */ __name(function getNumber2(match) { + var isDoubled = lookAhead(match), size = match === "@" ? 14 : match === "!" ? 20 : match === "y" && isDoubled ? 4 : match === "o" ? 3 : 2, minSize = match === "y" ? size : 1, digits = new RegExp("^\\d{" + minSize + "," + size + "}"), num = value2.substring(iValue).match(digits); + if (!num) { + throw "Missing number at position " + iValue; + } + iValue += num[0].length; + return parseInt(num[0], 10); + }, "getNumber"), getName = /* @__PURE__ */ __name(function getName2(match, shortNames, longNames) { + var index = -1; + var arr = lookAhead(match) ? longNames : shortNames; + var names = []; + for (var i = 0; i < arr.length; i++) { + names.push([i, arr[i]]); + } + names.sort(function(a, b) { + return -(a[1].length - b[1].length); + }); + for (var _i = 0; _i < names.length; _i++) { + var name4 = names[_i][1]; + if (value2.substr(iValue, name4.length).toLowerCase() === name4.toLowerCase()) { + index = names[_i][0]; + iValue += name4.length; + break; + } + } + if (index !== -1) { + return index + 1; + } else { + throw "Unknown name at position " + iValue; + } + }, "getName"), checkLiteral = /* @__PURE__ */ __name(function checkLiteral2() { + if (value2.charAt(iValue) !== format.charAt(iFormat)) { + throw "Unexpected literal at position " + iValue; + } + iValue++; + }, "checkLiteral"); + if (this.currentView === "month") { + day2 = 1; + } + if (this.currentView === "year") { + day2 = 1; + month2 = 1; + } + for (iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) { + if (format.charAt(iFormat) === "'" && !lookAhead("'")) { + literal = false; + } else { + checkLiteral(); + } + } else { + switch (format.charAt(iFormat)) { + case "d": + day2 = getNumber("d"); + break; + case "D": + getName("D", this.$primevue.config.locale.dayNamesShort, this.$primevue.config.locale.dayNames); + break; + case "o": + doy = getNumber("o"); + break; + case "m": + month2 = getNumber("m"); + break; + case "M": + month2 = getName("M", this.$primevue.config.locale.monthNamesShort, this.$primevue.config.locale.monthNames); + break; + case "y": + year2 = getNumber("y"); + break; + case "@": + date = new Date(getNumber("@")); + year2 = date.getFullYear(); + month2 = date.getMonth() + 1; + day2 = date.getDate(); + break; + case "!": + date = new Date((getNumber("!") - this.ticksTo1970) / 1e4); + year2 = date.getFullYear(); + month2 = date.getMonth() + 1; + day2 = date.getDate(); + break; + case "'": + if (lookAhead("'")) { + checkLiteral(); + } else { + literal = true; + } + break; + default: + checkLiteral(); + } + } + } + if (iValue < value2.length) { + extra = value2.substr(iValue); + if (!/^\s+/.test(extra)) { + throw "Extra/unparsed characters found in date: " + extra; + } + } + if (year2 === -1) { + year2 = (/* @__PURE__ */ new Date()).getFullYear(); + } else if (year2 < 100) { + year2 += (/* @__PURE__ */ new Date()).getFullYear() - (/* @__PURE__ */ new Date()).getFullYear() % 100 + (year2 <= shortYearCutoff ? 0 : -100); + } + if (doy > -1) { + month2 = 1; + day2 = doy; + do { + dim = this.getDaysCountInMonth(year2, month2 - 1); + if (day2 <= dim) { + break; + } + month2++; + day2 -= dim; + } while (true); + } + date = this.daylightSavingAdjust(new Date(year2, month2 - 1, day2)); + if (date.getFullYear() !== year2 || date.getMonth() + 1 !== month2 || date.getDate() !== day2) { + throw "Invalid date"; + } + return date; + }, "parseDate"), + getWeekNumber: /* @__PURE__ */ __name(function getWeekNumber(date) { + var checkDate = new Date(date.getTime()); + checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); + var time = checkDate.getTime(); + checkDate.setMonth(0); + checkDate.setDate(1); + return Math.floor(Math.round((time - checkDate.getTime()) / 864e5) / 7) + 1; + }, "getWeekNumber"), + onDateCellKeydown: /* @__PURE__ */ __name(function onDateCellKeydown(event2, date, groupIndex) { + var cellContent = event2.currentTarget; + var cell = cellContent.parentElement; + var cellIndex = getIndex(cell); + switch (event2.code) { + case "ArrowDown": { + cellContent.tabIndex = "-1"; + var nextRow = cell.parentElement.nextElementSibling; + if (nextRow) { + var tableRowIndex = getIndex(cell.parentElement); + var tableRows = Array.from(cell.parentElement.parentElement.children); + var nextTableRows = tableRows.slice(tableRowIndex + 1); + var hasNextFocusableDate = nextTableRows.find(function(el) { + var focusCell2 = el.children[cellIndex].children[0]; + return !getAttribute(focusCell2, "data-p-disabled"); + }); + if (hasNextFocusableDate) { + var focusCell = hasNextFocusableDate.children[cellIndex].children[0]; + focusCell.tabIndex = "0"; + focusCell.focus(); + } else { + this.navigationState = { + backward: false + }; + this.navForward(event2); + } + } else { + this.navigationState = { + backward: false + }; + this.navForward(event2); + } + event2.preventDefault(); + break; + } + case "ArrowUp": { + cellContent.tabIndex = "-1"; + if (event2.altKey) { + this.overlayVisible = false; + this.focused = true; + } else { + var prevRow = cell.parentElement.previousElementSibling; + if (prevRow) { + var _tableRowIndex = getIndex(cell.parentElement); + var _tableRows = Array.from(cell.parentElement.parentElement.children); + var prevTableRows = _tableRows.slice(0, _tableRowIndex).reverse(); + var _hasNextFocusableDate = prevTableRows.find(function(el) { + var focusCell2 = el.children[cellIndex].children[0]; + return !getAttribute(focusCell2, "data-p-disabled"); + }); + if (_hasNextFocusableDate) { + var _focusCell = _hasNextFocusableDate.children[cellIndex].children[0]; + _focusCell.tabIndex = "0"; + _focusCell.focus(); + } else { + this.navigationState = { + backward: true + }; + this.navBackward(event2); + } + } else { + this.navigationState = { + backward: true + }; + this.navBackward(event2); + } + } + event2.preventDefault(); + break; + } + case "ArrowLeft": { + cellContent.tabIndex = "-1"; + var prevCell = cell.previousElementSibling; + if (prevCell) { + var cells = Array.from(cell.parentElement.children); + var prevCells = cells.slice(0, cellIndex).reverse(); + var _hasNextFocusableDate2 = prevCells.find(function(el) { + var focusCell2 = el.children[0]; + return !getAttribute(focusCell2, "data-p-disabled"); + }); + if (_hasNextFocusableDate2) { + var _focusCell2 = _hasNextFocusableDate2.children[0]; + _focusCell2.tabIndex = "0"; + _focusCell2.focus(); + } else { + this.navigateToMonth(event2, true, groupIndex); + } + } else { + this.navigateToMonth(event2, true, groupIndex); + } + event2.preventDefault(); + break; + } + case "ArrowRight": { + cellContent.tabIndex = "-1"; + var nextCell = cell.nextElementSibling; + if (nextCell) { + var _cells = Array.from(cell.parentElement.children); + var nextCells = _cells.slice(cellIndex + 1); + var _hasNextFocusableDate3 = nextCells.find(function(el) { + var focusCell2 = el.children[0]; + return !getAttribute(focusCell2, "data-p-disabled"); + }); + if (_hasNextFocusableDate3) { + var _focusCell3 = _hasNextFocusableDate3.children[0]; + _focusCell3.tabIndex = "0"; + _focusCell3.focus(); + } else { + this.navigateToMonth(event2, false, groupIndex); + } + } else { + this.navigateToMonth(event2, false, groupIndex); + } + event2.preventDefault(); + break; + } + case "Enter": + case "NumpadEnter": + case "Space": { + this.onDateSelect(event2, date); + event2.preventDefault(); + break; + } + case "Escape": { + this.overlayVisible = false; + event2.preventDefault(); + break; + } + case "Tab": { + if (!this.inline) { + this.trapFocus(event2); + } + break; + } + case "Home": { + cellContent.tabIndex = "-1"; + var currentRow = cell.parentElement; + var _focusCell4 = currentRow.children[0].children[0]; + if (getAttribute(_focusCell4, "data-p-disabled")) { + this.navigateToMonth(event2, true, groupIndex); + } else { + _focusCell4.tabIndex = "0"; + _focusCell4.focus(); + } + event2.preventDefault(); + break; + } + case "End": { + cellContent.tabIndex = "-1"; + var _currentRow = cell.parentElement; + var _focusCell5 = _currentRow.children[_currentRow.children.length - 1].children[0]; + if (getAttribute(_focusCell5, "data-p-disabled")) { + this.navigateToMonth(event2, false, groupIndex); + } else { + _focusCell5.tabIndex = "0"; + _focusCell5.focus(); + } + event2.preventDefault(); + break; + } + case "PageUp": { + cellContent.tabIndex = "-1"; + if (event2.shiftKey) { + this.navigationState = { + backward: true + }; + this.navBackward(event2); + } else this.navigateToMonth(event2, true, groupIndex); + event2.preventDefault(); + break; + } + case "PageDown": { + cellContent.tabIndex = "-1"; + if (event2.shiftKey) { + this.navigationState = { + backward: false + }; + this.navForward(event2); + } else this.navigateToMonth(event2, false, groupIndex); + event2.preventDefault(); + break; + } + } + }, "onDateCellKeydown"), + navigateToMonth: /* @__PURE__ */ __name(function navigateToMonth(event2, prev, groupIndex) { + if (prev) { + if (this.numberOfMonths === 1 || groupIndex === 0) { + this.navigationState = { + backward: true + }; + this.navBackward(event2); + } else { + var prevMonthContainer = this.overlay.children[groupIndex - 1]; + var cells = find(prevMonthContainer, 'table td span:not([data-p-disabled="true"]):not([data-p-ink="true"])'); + var focusCell = cells[cells.length - 1]; + focusCell.tabIndex = "0"; + focusCell.focus(); + } + } else { + if (this.numberOfMonths === 1 || groupIndex === this.numberOfMonths - 1) { + this.navigationState = { + backward: false + }; + this.navForward(event2); + } else { + var nextMonthContainer = this.overlay.children[groupIndex + 1]; + var _focusCell6 = findSingle(nextMonthContainer, 'table td span:not([data-p-disabled="true"]):not([data-p-ink="true"])'); + _focusCell6.tabIndex = "0"; + _focusCell6.focus(); + } + } + }, "navigateToMonth"), + onMonthCellKeydown: /* @__PURE__ */ __name(function onMonthCellKeydown(event2, index) { + var cell = event2.currentTarget; + switch (event2.code) { + case "ArrowUp": + case "ArrowDown": { + cell.tabIndex = "-1"; + var cells = cell.parentElement.children; + var cellIndex = getIndex(cell); + var nextCell = cells[event2.code === "ArrowDown" ? cellIndex + 3 : cellIndex - 3]; + if (nextCell) { + nextCell.tabIndex = "0"; + nextCell.focus(); + } + event2.preventDefault(); + break; + } + case "ArrowLeft": { + cell.tabIndex = "-1"; + var prevCell = cell.previousElementSibling; + if (prevCell) { + prevCell.tabIndex = "0"; + prevCell.focus(); + } else { + this.navigationState = { + backward: true + }; + this.navBackward(event2); + } + event2.preventDefault(); + break; + } + case "ArrowRight": { + cell.tabIndex = "-1"; + var _nextCell = cell.nextElementSibling; + if (_nextCell) { + _nextCell.tabIndex = "0"; + _nextCell.focus(); + } else { + this.navigationState = { + backward: false + }; + this.navForward(event2); + } + event2.preventDefault(); + break; + } + case "PageUp": { + if (event2.shiftKey) return; + this.navigationState = { + backward: true + }; + this.navBackward(event2); + break; + } + case "PageDown": { + if (event2.shiftKey) return; + this.navigationState = { + backward: false + }; + this.navForward(event2); + break; + } + case "Enter": + case "NumpadEnter": + case "Space": { + this.onMonthSelect(event2, index); + event2.preventDefault(); + break; + } + case "Escape": { + this.overlayVisible = false; + event2.preventDefault(); + break; + } + case "Tab": { + this.trapFocus(event2); + break; + } + } + }, "onMonthCellKeydown"), + onYearCellKeydown: /* @__PURE__ */ __name(function onYearCellKeydown(event2, index) { + var cell = event2.currentTarget; + switch (event2.code) { + case "ArrowUp": + case "ArrowDown": { + cell.tabIndex = "-1"; + var cells = cell.parentElement.children; + var cellIndex = getIndex(cell); + var nextCell = cells[event2.code === "ArrowDown" ? cellIndex + 2 : cellIndex - 2]; + if (nextCell) { + nextCell.tabIndex = "0"; + nextCell.focus(); + } + event2.preventDefault(); + break; + } + case "ArrowLeft": { + cell.tabIndex = "-1"; + var prevCell = cell.previousElementSibling; + if (prevCell) { + prevCell.tabIndex = "0"; + prevCell.focus(); + } else { + this.navigationState = { + backward: true + }; + this.navBackward(event2); + } + event2.preventDefault(); + break; + } + case "ArrowRight": { + cell.tabIndex = "-1"; + var _nextCell2 = cell.nextElementSibling; + if (_nextCell2) { + _nextCell2.tabIndex = "0"; + _nextCell2.focus(); + } else { + this.navigationState = { + backward: false + }; + this.navForward(event2); + } + event2.preventDefault(); + break; + } + case "PageUp": { + if (event2.shiftKey) return; + this.navigationState = { + backward: true + }; + this.navBackward(event2); + break; + } + case "PageDown": { + if (event2.shiftKey) return; + this.navigationState = { + backward: false + }; + this.navForward(event2); + break; + } + case "Enter": + case "NumpadEnter": + case "Space": { + this.onYearSelect(event2, index); + event2.preventDefault(); + break; + } + case "Escape": { + this.overlayVisible = false; + event2.preventDefault(); + break; + } + case "Tab": { + this.trapFocus(event2); + break; + } + } + }, "onYearCellKeydown"), + updateFocus: /* @__PURE__ */ __name(function updateFocus() { + var cell; + if (this.navigationState) { + if (this.navigationState.button) { + this.initFocusableCell(); + if (this.navigationState.backward) this.previousButton.focus(); + else this.nextButton.focus(); + } else { + if (this.navigationState.backward) { + var cells; + if (this.currentView === "month") { + cells = find(this.overlay, '[data-pc-section="monthview"] [data-pc-section="month"]:not([data-p-disabled="true"])'); + } else if (this.currentView === "year") { + cells = find(this.overlay, '[data-pc-section="yearview"] [data-pc-section="year"]:not([data-p-disabled="true"])'); + } else { + cells = find(this.overlay, 'table td span:not([data-p-disabled="true"]):not([data-p-ink="true"])'); + } + if (cells && cells.length > 0) { + cell = cells[cells.length - 1]; + } + } else { + if (this.currentView === "month") { + cell = findSingle(this.overlay, '[data-pc-section="monthview"] [data-pc-section="month"]:not([data-p-disabled="true"])'); + } else if (this.currentView === "year") { + cell = findSingle(this.overlay, '[data-pc-section="yearview"] [data-pc-section="year"]:not([data-p-disabled="true"])'); + } else { + cell = findSingle(this.overlay, 'table td span:not([data-p-disabled="true"]):not([data-p-ink="true"])'); + } + } + if (cell) { + cell.tabIndex = "0"; + cell.focus(); + } + } + this.navigationState = null; + } else { + this.initFocusableCell(); + } + }, "updateFocus"), + initFocusableCell: /* @__PURE__ */ __name(function initFocusableCell() { + var cell; + if (this.currentView === "month") { + var cells = find(this.overlay, '[data-pc-section="monthview"] [data-pc-section="month"]'); + var selectedCell = findSingle(this.overlay, '[data-pc-section="monthview"] [data-pc-section="month"][data-p-selected="true"]'); + cells.forEach(function(cell2) { + return cell2.tabIndex = -1; + }); + cell = selectedCell || cells[0]; + } else if (this.currentView === "year") { + var _cells2 = find(this.overlay, '[data-pc-section="yearview"] [data-pc-section="year"]'); + var _selectedCell = findSingle(this.overlay, '[data-pc-section="yearview"] [data-pc-section="year"][data-p-selected="true"]'); + _cells2.forEach(function(cell2) { + return cell2.tabIndex = -1; + }); + cell = _selectedCell || _cells2[0]; + } else { + cell = findSingle(this.overlay, 'span[data-p-selected="true"]'); + if (!cell) { + var todayCell = findSingle(this.overlay, 'td[data-p-today="true"] span:not([data-p-disabled="true"]):not([data-p-ink="true"])'); + if (todayCell) cell = todayCell; + else cell = findSingle(this.overlay, '.p-datepicker-calendar td span:not([data-p-disabled="true"]):not([data-p-ink="true"])'); + } + } + if (cell) { + cell.tabIndex = "0"; + this.preventFocus = false; + } + }, "initFocusableCell"), + trapFocus: /* @__PURE__ */ __name(function trapFocus(event2) { + event2.preventDefault(); + var focusableElements = getFocusableElements(this.overlay); + if (focusableElements && focusableElements.length > 0) { + if (!document.activeElement) { + focusableElements[0].focus(); + } else { + var focusedIndex = focusableElements.indexOf(document.activeElement); + if (event2.shiftKey) { + if (focusedIndex === -1 || focusedIndex === 0) focusableElements[focusableElements.length - 1].focus(); + else focusableElements[focusedIndex - 1].focus(); + } else { + if (focusedIndex === -1) { + if (this.timeOnly) { + focusableElements[0].focus(); + } else { + var spanIndex = null; + for (var i = 0; i < focusableElements.length; i++) { + if (focusableElements[i].tagName === "SPAN") { + spanIndex = i; + break; + } + } + focusableElements[spanIndex].focus(); + } + } else if (focusedIndex === focusableElements.length - 1) focusableElements[0].focus(); + else focusableElements[focusedIndex + 1].focus(); + } + } + } + }, "trapFocus"), + onContainerButtonKeydown: /* @__PURE__ */ __name(function onContainerButtonKeydown(event2) { + switch (event2.code) { + case "Tab": + this.trapFocus(event2); + break; + case "Escape": + this.overlayVisible = false; + event2.preventDefault(); + break; + } + this.$emit("keydown", event2); + }, "onContainerButtonKeydown"), + onInput: /* @__PURE__ */ __name(function onInput(event2) { + try { + this.selectionStart = this.input.selectionStart; + this.selectionEnd = this.input.selectionEnd; + var value2 = this.parseValue(event2.target.value); + if (this.isValidSelection(value2)) { + this.typeUpdate = true; + this.updateModel(value2); + this.updateCurrentMetaData(); + } + } catch (err) { + } + this.$emit("input", event2); + }, "onInput"), + onInputClick: /* @__PURE__ */ __name(function onInputClick() { + if (this.showOnFocus && this.isEnabled() && !this.overlayVisible) { + this.overlayVisible = true; + } + }, "onInputClick"), + onFocus: /* @__PURE__ */ __name(function onFocus2(event2) { + if (this.showOnFocus && this.isEnabled()) { + this.overlayVisible = true; + } + this.focused = true; + this.$emit("focus", event2); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur(event2) { + var _this$formField$onBlu, _this$formField; + this.$emit("blur", { + originalEvent: event2, + value: event2.target.value + }); + (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField); + this.focused = false; + event2.target.value = this.formatValue(this.d_value); + }, "onBlur"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown(event2) { + if (event2.code === "ArrowDown" && this.overlay) { + this.trapFocus(event2); + } else if (event2.code === "ArrowDown" && !this.overlay) { + this.overlayVisible = true; + } else if (event2.code === "Escape") { + if (this.overlayVisible) { + this.overlayVisible = false; + event2.preventDefault(); + } + } else if (event2.code === "Tab") { + if (this.overlay) { + getFocusableElements(this.overlay).forEach(function(el) { + return el.tabIndex = "-1"; + }); + } + if (this.overlayVisible) { + this.overlayVisible = false; + } + } else if (event2.code === "Enter") { + var _event$target$value; + if (this.manualInput && event2.target.value !== null && ((_event$target$value = event2.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.trim()) !== "") { + try { + var value2 = this.parseValue(event2.target.value); + if (this.isValidSelection(value2)) { + this.overlayVisible = false; + } + } catch (err) { + } + } + this.$emit("keydown", event2); + } + }, "onKeyDown"), + overlayRef: /* @__PURE__ */ __name(function overlayRef(el) { + this.overlay = el; + }, "overlayRef"), + inputRef: /* @__PURE__ */ __name(function inputRef(el) { + this.input = el ? el.$el : void 0; + }, "inputRef"), + previousButtonRef: /* @__PURE__ */ __name(function previousButtonRef(el) { + this.previousButton = el ? el.$el : void 0; + }, "previousButtonRef"), + nextButtonRef: /* @__PURE__ */ __name(function nextButtonRef(el) { + this.nextButton = el ? el.$el : void 0; + }, "nextButtonRef"), + getMonthName: /* @__PURE__ */ __name(function getMonthName(index) { + return this.$primevue.config.locale.monthNames[index]; + }, "getMonthName"), + getYear: /* @__PURE__ */ __name(function getYear(month2) { + return this.currentView === "month" ? this.currentYear : month2.year; + }, "getYear"), + onOverlayClick: /* @__PURE__ */ __name(function onOverlayClick(event2) { + event2.stopPropagation(); + if (!this.inline) { + OverlayEventBus.emit("overlay-click", { + originalEvent: event2, + target: this.$el + }); + } + }, "onOverlayClick"), + onOverlayKeyDown: /* @__PURE__ */ __name(function onOverlayKeyDown(event2) { + switch (event2.code) { + case "Escape": + if (!this.inline) { + this.input.focus(); + this.overlayVisible = false; + } + break; + } + }, "onOverlayKeyDown"), + onOverlayMouseUp: /* @__PURE__ */ __name(function onOverlayMouseUp(event2) { + this.onOverlayClick(event2); + }, "onOverlayMouseUp"), + createResponsiveStyle: /* @__PURE__ */ __name(function createResponsiveStyle() { + if (this.numberOfMonths > 1 && this.responsiveOptions && !this.isUnstyled) { + if (!this.responsiveStyleElement) { + var _this$$primevue; + this.responsiveStyleElement = document.createElement("style"); + this.responsiveStyleElement.type = "text/css"; + setAttribute(this.responsiveStyleElement, "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); + document.body.appendChild(this.responsiveStyleElement); + } + var innerHTML = ""; + if (this.responsiveOptions) { + var comparer = localeComparator(); + var responsiveOptions2 = _toConsumableArray$d(this.responsiveOptions).filter(function(o) { + return !!(o.breakpoint && o.numMonths); + }).sort(function(o1, o2) { + return -1 * comparer(o1.breakpoint, o2.breakpoint); + }); + for (var i = 0; i < responsiveOptions2.length; i++) { + var _responsiveOptions$i = responsiveOptions2[i], breakpoint2 = _responsiveOptions$i.breakpoint, numMonths = _responsiveOptions$i.numMonths; + var styles = "\n .p-datepicker-panel[".concat(this.$attrSelector, "] .p-datepicker-calendar:nth-child(").concat(numMonths, ") .p-datepicker-next-button {\n display: inline-flex;\n }\n "); + for (var j = numMonths; j < this.numberOfMonths; j++) { + styles += "\n .p-datepicker-panel[".concat(this.$attrSelector, "] .p-datepicker-calendar:nth-child(").concat(j + 1, ") {\n display: none;\n }\n "); + } + innerHTML += "\n @media screen and (max-width: ".concat(breakpoint2, ") {\n ").concat(styles, "\n }\n "); + } + } + this.responsiveStyleElement.innerHTML = innerHTML; + } + }, "createResponsiveStyle"), + destroyResponsiveStyleElement: /* @__PURE__ */ __name(function destroyResponsiveStyleElement() { + if (this.responsiveStyleElement) { + this.responsiveStyleElement.remove(); + this.responsiveStyleElement = null; + } + }, "destroyResponsiveStyleElement") + }, + computed: { + viewDate: /* @__PURE__ */ __name(function viewDate() { + var propValue = this.d_value; + if (propValue && Array.isArray(propValue)) { + if (this.isRangeSelection()) { + propValue = this.inline ? propValue[0] : propValue[1] || propValue[0]; + } else if (this.isMultipleSelection()) { + propValue = propValue[propValue.length - 1]; + } + } + if (propValue && typeof propValue !== "string") { + return propValue; + } else { + var today = /* @__PURE__ */ new Date(); + if (this.maxDate && this.maxDate < today) { + return this.maxDate; + } + if (this.minDate && this.minDate > today) { + return this.minDate; + } + return today; + } + }, "viewDate"), + inputFieldValue: /* @__PURE__ */ __name(function inputFieldValue() { + return this.formatValue(this.d_value); + }, "inputFieldValue"), + months: /* @__PURE__ */ __name(function months2() { + var months3 = []; + for (var i = 0; i < this.numberOfMonths; i++) { + var month2 = this.currentMonth + i; + var year2 = this.currentYear; + if (month2 > 11) { + month2 = month2 % 11 - 1; + year2 = year2 + 1; + } + var dates = []; + var firstDay = this.getFirstDayOfMonthIndex(month2, year2); + var daysLength = this.getDaysCountInMonth(month2, year2); + var prevMonthDaysLength = this.getDaysCountInPrevMonth(month2, year2); + var dayNo = 1; + var today = /* @__PURE__ */ new Date(); + var weekNumbers = []; + var monthRows = Math.ceil((daysLength + firstDay) / 7); + for (var _i2 = 0; _i2 < monthRows; _i2++) { + var week = []; + if (_i2 == 0) { + for (var j = prevMonthDaysLength - firstDay + 1; j <= prevMonthDaysLength; j++) { + var prev = this.getPreviousMonthAndYear(month2, year2); + week.push({ + day: j, + month: prev.month, + year: prev.year, + otherMonth: true, + today: this.isToday(today, j, prev.month, prev.year), + selectable: this.isSelectable(j, prev.month, prev.year, true) + }); + } + var remainingDaysLength = 7 - week.length; + for (var _j = 0; _j < remainingDaysLength; _j++) { + week.push({ + day: dayNo, + month: month2, + year: year2, + today: this.isToday(today, dayNo, month2, year2), + selectable: this.isSelectable(dayNo, month2, year2, false) + }); + dayNo++; + } + } else { + for (var _j2 = 0; _j2 < 7; _j2++) { + if (dayNo > daysLength) { + var next = this.getNextMonthAndYear(month2, year2); + week.push({ + day: dayNo - daysLength, + month: next.month, + year: next.year, + otherMonth: true, + today: this.isToday(today, dayNo - daysLength, next.month, next.year), + selectable: this.isSelectable(dayNo - daysLength, next.month, next.year, true) + }); + } else { + week.push({ + day: dayNo, + month: month2, + year: year2, + today: this.isToday(today, dayNo, month2, year2), + selectable: this.isSelectable(dayNo, month2, year2, false) + }); + } + dayNo++; + } + } + if (this.showWeek) { + weekNumbers.push(this.getWeekNumber(new Date(week[0].year, week[0].month, week[0].day))); + } + dates.push(week); + } + months3.push({ + month: month2, + year: year2, + dates, + weekNumbers + }); + } + return months3; + }, "months"), + weekDays: /* @__PURE__ */ __name(function weekDays() { + var weekDays2 = []; + var dayIndex = this.$primevue.config.locale.firstDayOfWeek; + for (var i = 0; i < 7; i++) { + weekDays2.push(this.$primevue.config.locale.dayNamesMin[dayIndex]); + dayIndex = dayIndex == 6 ? 0 : ++dayIndex; + } + return weekDays2; + }, "weekDays"), + ticksTo1970: /* @__PURE__ */ __name(function ticksTo1970() { + return ((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + Math.floor(1970 / 400)) * 24 * 60 * 60 * 1e7; + }, "ticksTo1970"), + sundayIndex: /* @__PURE__ */ __name(function sundayIndex() { + return this.$primevue.config.locale.firstDayOfWeek > 0 ? 7 - this.$primevue.config.locale.firstDayOfWeek : 0; + }, "sundayIndex"), + datePattern: /* @__PURE__ */ __name(function datePattern() { + return this.dateFormat || this.$primevue.config.locale.dateFormat; + }, "datePattern"), + monthPickerValues: /* @__PURE__ */ __name(function monthPickerValues() { + var _this12 = this; + var monthPickerValues2 = []; + var isSelectableMonth = /* @__PURE__ */ __name(function isSelectableMonth2(baseMonth) { + if (_this12.minDate) { + var minMonth = _this12.minDate.getMonth(); + var minYear = _this12.minDate.getFullYear(); + if (_this12.currentYear < minYear || _this12.currentYear === minYear && baseMonth < minMonth) { + return false; + } + } + if (_this12.maxDate) { + var maxMonth = _this12.maxDate.getMonth(); + var maxYear = _this12.maxDate.getFullYear(); + if (_this12.currentYear > maxYear || _this12.currentYear === maxYear && baseMonth > maxMonth) { + return false; + } + } + return true; + }, "isSelectableMonth"); + for (var i = 0; i <= 11; i++) { + monthPickerValues2.push({ + value: this.$primevue.config.locale.monthNamesShort[i], + selectable: isSelectableMonth(i) + }); + } + return monthPickerValues2; + }, "monthPickerValues"), + yearPickerValues: /* @__PURE__ */ __name(function yearPickerValues() { + var _this13 = this; + var yearPickerValues2 = []; + var base = this.currentYear - this.currentYear % 10; + var isSelectableYear = /* @__PURE__ */ __name(function isSelectableYear2(baseYear) { + if (_this13.minDate) { + if (_this13.minDate.getFullYear() > baseYear) return false; + } + if (_this13.maxDate) { + if (_this13.maxDate.getFullYear() < baseYear) return false; + } + return true; + }, "isSelectableYear"); + for (var i = 0; i < 10; i++) { + yearPickerValues2.push({ + value: base + i, + selectable: isSelectableYear(base + i) + }); + } + return yearPickerValues2; + }, "yearPickerValues"), + formattedCurrentHour: /* @__PURE__ */ __name(function formattedCurrentHour() { + if (this.currentHour == 0 && this.hourFormat == "12") { + return this.currentHour + 12; + } + return this.currentHour < 10 ? "0" + this.currentHour : this.currentHour; + }, "formattedCurrentHour"), + formattedCurrentMinute: /* @__PURE__ */ __name(function formattedCurrentMinute() { + return this.currentMinute < 10 ? "0" + this.currentMinute : this.currentMinute; + }, "formattedCurrentMinute"), + formattedCurrentSecond: /* @__PURE__ */ __name(function formattedCurrentSecond() { + return this.currentSecond < 10 ? "0" + this.currentSecond : this.currentSecond; + }, "formattedCurrentSecond"), + todayLabel: /* @__PURE__ */ __name(function todayLabel() { + return this.$primevue.config.locale.today; + }, "todayLabel"), + clearLabel: /* @__PURE__ */ __name(function clearLabel() { + return this.$primevue.config.locale.clear; + }, "clearLabel"), + weekHeaderLabel: /* @__PURE__ */ __name(function weekHeaderLabel() { + return this.$primevue.config.locale.weekHeader; + }, "weekHeaderLabel"), + monthNames: /* @__PURE__ */ __name(function monthNames() { + return this.$primevue.config.locale.monthNames; + }, "monthNames"), + switchViewButtonDisabled: /* @__PURE__ */ __name(function switchViewButtonDisabled() { + return this.numberOfMonths > 1 || this.disabled; + }, "switchViewButtonDisabled"), + panelId: /* @__PURE__ */ __name(function panelId() { + return this.d_id + "_panel"; + }, "panelId") + }, + components: { + InputText: script$1o, + Button: script$1e, + Portal: script$1f, + CalendarIcon: script$13, + ChevronLeftIcon: script$1p, + ChevronRightIcon: script$1l, + ChevronUpIcon: script$1j, + ChevronDownIcon: script$1k + }, + directives: { + ripple: Ripple + } +}; +var _hoisted_1$s = ["id"]; +var _hoisted_2$l = ["disabled", "aria-label", "aria-expanded", "aria-controls"]; +var _hoisted_3$h = ["id", "role", "aria-modal", "aria-label"]; +var _hoisted_4$9 = ["disabled", "aria-label"]; +var _hoisted_5$4 = ["disabled", "aria-label"]; +var _hoisted_6$2 = ["disabled", "aria-label"]; +var _hoisted_7$2 = ["disabled", "aria-label"]; +var _hoisted_8$1 = ["data-p-disabled"]; +var _hoisted_9 = ["abbr"]; +var _hoisted_10 = ["data-p-disabled"]; +var _hoisted_11 = ["aria-label", "data-p-today", "data-p-other-month"]; +var _hoisted_12 = ["onClick", "onKeydown", "aria-selected", "aria-disabled", "data-p-disabled", "data-p-selected"]; +var _hoisted_13 = ["onClick", "onKeydown", "data-p-disabled", "data-p-selected"]; +var _hoisted_14 = ["onClick", "onKeydown", "data-p-disabled", "data-p-selected"]; +function render$V(_ctx, _cache, $props, $setup, $data, $options) { + var _component_InputText = resolveComponent("InputText"); + var _component_Button = resolveComponent("Button"); + var _component_Portal = resolveComponent("Portal"); + var _directive_ripple = resolveDirective("ripple"); + return openBlock(), createElementBlock("span", mergeProps({ + ref: "container", + id: $data.d_id, + "class": _ctx.cx("root"), + style: _ctx.sx("root") + }, _ctx.ptmi("root")), [!_ctx.inline ? (openBlock(), createBlock(_component_InputText, { + key: 0, + ref: $options.inputRef, + id: _ctx.inputId, + role: "combobox", + "class": normalizeClass([_ctx.inputClass, _ctx.cx("pcInputText")]), + style: normalizeStyle(_ctx.inputStyle), + defaultValue: $options.inputFieldValue, + placeholder: _ctx.placeholder, + name: _ctx.name, + size: _ctx.size, + invalid: _ctx.invalid, + variant: _ctx.variant, + fluid: _ctx.fluid, + unstyled: _ctx.unstyled, + autocomplete: "off", + "aria-autocomplete": "none", + "aria-haspopup": "dialog", + "aria-expanded": $data.overlayVisible, + "aria-controls": $options.panelId, + "aria-labelledby": _ctx.ariaLabelledby, + "aria-label": _ctx.ariaLabel, + inputmode: "none", + disabled: _ctx.disabled, + readonly: !_ctx.manualInput || _ctx.readonly, + tabindex: 0, + onInput: $options.onInput, + onClick: $options.onInputClick, + onFocus: $options.onFocus, + onBlur: $options.onBlur, + onKeydown: $options.onKeyDown, + pt: _ctx.ptm("pcInputText") + }, null, 8, ["id", "class", "style", "defaultValue", "placeholder", "name", "size", "invalid", "variant", "fluid", "unstyled", "aria-expanded", "aria-controls", "aria-labelledby", "aria-label", "disabled", "readonly", "onInput", "onClick", "onFocus", "onBlur", "onKeydown", "pt"])) : createCommentVNode("", true), _ctx.showIcon && _ctx.iconDisplay === "button" && !_ctx.inline ? renderSlot(_ctx.$slots, "dropdownbutton", { + key: 1, + toggleCallback: $options.onButtonClick + }, function() { + return [createBaseVNode("button", mergeProps({ + "class": _ctx.cx("dropdown"), + disabled: _ctx.disabled, + onClick: _cache[0] || (_cache[0] = function() { + return $options.onButtonClick && $options.onButtonClick.apply($options, arguments); + }), + type: "button", + "aria-label": _ctx.$primevue.config.locale.chooseDate, + "aria-haspopup": "dialog", + "aria-expanded": $data.overlayVisible, + "aria-controls": $options.panelId + }, _ctx.ptm("dropdown")), [renderSlot(_ctx.$slots, "dropdownicon", { + "class": normalizeClass(_ctx.icon) + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon ? "span" : "CalendarIcon"), mergeProps({ + "class": _ctx.icon + }, _ctx.ptm("dropdownIcon")), null, 16, ["class"]))]; + })], 16, _hoisted_2$l)]; + }) : _ctx.showIcon && _ctx.iconDisplay === "input" && !_ctx.inline ? (openBlock(), createElementBlock(Fragment, { + key: 2 + }, [_ctx.$slots.inputicon || _ctx.showIcon ? (openBlock(), createElementBlock("span", mergeProps({ + key: 0, + "class": _ctx.cx("inputIconContainer") + }, _ctx.ptm("inputIconContainer")), [renderSlot(_ctx.$slots, "inputicon", { + "class": normalizeClass(_ctx.cx("inputIcon")), + clickCallback: $options.onButtonClick + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon ? "i" : "CalendarIcon"), mergeProps({ + "class": [_ctx.icon, _ctx.cx("inputIcon")], + onClick: $options.onButtonClick + }, _ctx.ptm("inputicon")), null, 16, ["class", "onClick"]))]; + })], 16)) : createCommentVNode("", true)], 64)) : createCommentVNode("", true), createVNode(_component_Portal, { + appendTo: _ctx.appendTo, + disabled: _ctx.inline + }, { + "default": withCtx(function() { + return [createVNode(Transition, mergeProps({ + name: "p-connected-overlay", + onEnter: _cache[58] || (_cache[58] = function($event) { + return $options.onOverlayEnter($event); + }), + onAfterEnter: $options.onOverlayEnterComplete, + onAfterLeave: $options.onOverlayAfterLeave, + onLeave: $options.onOverlayLeave + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [_ctx.inline || $data.overlayVisible ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: $options.overlayRef, + id: $options.panelId, + "class": [_ctx.cx("panel"), _ctx.panelClass], + style: _ctx.panelStyle, + role: _ctx.inline ? null : "dialog", + "aria-modal": _ctx.inline ? null : "true", + "aria-label": _ctx.$primevue.config.locale.chooseDate, + onClick: _cache[55] || (_cache[55] = function() { + return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); + }), + onKeydown: _cache[56] || (_cache[56] = function() { + return $options.onOverlayKeyDown && $options.onOverlayKeyDown.apply($options, arguments); + }), + onMouseup: _cache[57] || (_cache[57] = function() { + return $options.onOverlayMouseUp && $options.onOverlayMouseUp.apply($options, arguments); + }) + }, _ctx.ptm("panel")), [!_ctx.timeOnly ? (openBlock(), createElementBlock(Fragment, { + key: 0 + }, [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("calendarContainer") + }, _ctx.ptm("calendarContainer")), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.months, function(month2, groupIndex) { + return openBlock(), createElementBlock("div", mergeProps({ + key: month2.month + month2.year, + "class": _ctx.cx("calendar"), + ref_for: true + }, _ctx.ptm("calendar")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("header"), + ref_for: true + }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header"), withDirectives(createVNode(_component_Button, mergeProps({ + ref_for: true, + ref: $options.previousButtonRef, + "class": _ctx.cx("pcPrevButton"), + disabled: _ctx.disabled, + "aria-label": $data.currentView === "year" ? _ctx.$primevue.config.locale.prevDecade : $data.currentView === "month" ? _ctx.$primevue.config.locale.prevYear : _ctx.$primevue.config.locale.prevMonth, + unstyled: _ctx.unstyled, + onClick: $options.onPrevButtonClick, + onKeydown: $options.onContainerButtonKeydown + }, _ctx.navigatorButtonProps, { + pt: _ctx.ptm("pcPrevButton"), + "data-pc-group-section": "navigator" + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "previcon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.prevIcon ? "span" : "ChevronLeftIcon"), mergeProps({ + "class": [_ctx.prevIcon, slotProps["class"]], + ref_for: true + }, _ctx.ptm("pcPrevButton")["icon"]), null, 16, ["class"]))]; + })]; + }), + _: 2 + }, 1040, ["class", "disabled", "aria-label", "unstyled", "onClick", "onKeydown", "pt"]), [[vShow, groupIndex === 0]]), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("title"), + ref_for: true + }, _ctx.ptm("title")), [_ctx.$primevue.config.locale.showMonthAfterYear ? (openBlock(), createElementBlock(Fragment, { + key: 0 + }, [$data.currentView !== "year" ? (openBlock(), createElementBlock("button", mergeProps({ + key: 0, + type: "button", + onClick: _cache[1] || (_cache[1] = function() { + return $options.switchToYearView && $options.switchToYearView.apply($options, arguments); + }), + onKeydown: _cache[2] || (_cache[2] = function() { + return $options.onContainerButtonKeydown && $options.onContainerButtonKeydown.apply($options, arguments); + }), + "class": _ctx.cx("selectYear"), + disabled: $options.switchViewButtonDisabled, + "aria-label": _ctx.$primevue.config.locale.chooseYear, + ref_for: true + }, _ctx.ptm("selectYear"), { + "data-pc-group-section": "view" + }), toDisplayString($options.getYear(month2)), 17, _hoisted_4$9)) : createCommentVNode("", true), $data.currentView === "date" ? (openBlock(), createElementBlock("button", mergeProps({ + key: 1, + type: "button", + onClick: _cache[3] || (_cache[3] = function() { + return $options.switchToMonthView && $options.switchToMonthView.apply($options, arguments); + }), + onKeydown: _cache[4] || (_cache[4] = function() { + return $options.onContainerButtonKeydown && $options.onContainerButtonKeydown.apply($options, arguments); + }), + "class": _ctx.cx("selectMonth"), + disabled: $options.switchViewButtonDisabled, + "aria-label": _ctx.$primevue.config.locale.chooseMonth, + ref_for: true + }, _ctx.ptm("selectMonth"), { + "data-pc-group-section": "view" + }), toDisplayString($options.getMonthName(month2.month)), 17, _hoisted_5$4)) : createCommentVNode("", true)], 64)) : (openBlock(), createElementBlock(Fragment, { + key: 1 + }, [$data.currentView === "date" ? (openBlock(), createElementBlock("button", mergeProps({ + key: 0, + type: "button", + onClick: _cache[5] || (_cache[5] = function() { + return $options.switchToMonthView && $options.switchToMonthView.apply($options, arguments); + }), + onKeydown: _cache[6] || (_cache[6] = function() { + return $options.onContainerButtonKeydown && $options.onContainerButtonKeydown.apply($options, arguments); + }), + "class": _ctx.cx("selectMonth"), + disabled: $options.switchViewButtonDisabled, + "aria-label": _ctx.$primevue.config.locale.chooseMonth, + ref_for: true + }, _ctx.ptm("selectMonth"), { + "data-pc-group-section": "view" + }), toDisplayString($options.getMonthName(month2.month)), 17, _hoisted_6$2)) : createCommentVNode("", true), $data.currentView !== "year" ? (openBlock(), createElementBlock("button", mergeProps({ + key: 1, + type: "button", + onClick: _cache[7] || (_cache[7] = function() { + return $options.switchToYearView && $options.switchToYearView.apply($options, arguments); + }), + onKeydown: _cache[8] || (_cache[8] = function() { + return $options.onContainerButtonKeydown && $options.onContainerButtonKeydown.apply($options, arguments); + }), + "class": _ctx.cx("selectYear"), + disabled: $options.switchViewButtonDisabled, + "aria-label": _ctx.$primevue.config.locale.chooseYear, + ref_for: true + }, _ctx.ptm("selectYear"), { + "data-pc-group-section": "view" + }), toDisplayString($options.getYear(month2)), 17, _hoisted_7$2)) : createCommentVNode("", true)], 64)), $data.currentView === "year" ? (openBlock(), createElementBlock("span", mergeProps({ + key: 2, + "class": _ctx.cx("decade"), + ref_for: true + }, _ctx.ptm("decade")), [renderSlot(_ctx.$slots, "decade", { + years: $options.yearPickerValues + }, function() { + return [createTextVNode(toDisplayString($options.yearPickerValues[0].value) + " - " + toDisplayString($options.yearPickerValues[$options.yearPickerValues.length - 1].value), 1)]; + })], 16)) : createCommentVNode("", true)], 16), withDirectives(createVNode(_component_Button, mergeProps({ + ref_for: true, + ref: $options.nextButtonRef, + "class": _ctx.cx("pcNextButton"), + disabled: _ctx.disabled, + "aria-label": $data.currentView === "year" ? _ctx.$primevue.config.locale.nextDecade : $data.currentView === "month" ? _ctx.$primevue.config.locale.nextYear : _ctx.$primevue.config.locale.nextMonth, + unstyled: _ctx.unstyled, + onClick: $options.onNextButtonClick, + onKeydown: $options.onContainerButtonKeydown + }, _ctx.navigatorButtonProps, { + pt: _ctx.ptm("pcNextButton"), + "data-pc-group-section": "navigator" + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "nexticon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.nextIcon ? "span" : "ChevronRightIcon"), mergeProps({ + "class": [_ctx.nextIcon, slotProps["class"]], + ref_for: true + }, _ctx.ptm("pcNextButton")["icon"]), null, 16, ["class"]))]; + })]; + }), + _: 2 + }, 1040, ["class", "disabled", "aria-label", "unstyled", "onClick", "onKeydown", "pt"]), [[vShow, _ctx.numberOfMonths === 1 ? true : groupIndex === _ctx.numberOfMonths - 1]])], 16), $data.currentView === "date" ? (openBlock(), createElementBlock("table", mergeProps({ + key: 0, + "class": _ctx.cx("dayView"), + role: "grid", + ref_for: true + }, _ctx.ptm("dayView")), [createBaseVNode("thead", mergeProps({ + ref_for: true + }, _ctx.ptm("tableHeader")), [createBaseVNode("tr", mergeProps({ + ref_for: true + }, _ctx.ptm("tableHeaderRow")), [_ctx.showWeek ? (openBlock(), createElementBlock("th", mergeProps({ + key: 0, + scope: "col", + "class": _ctx.cx("weekHeader"), + ref_for: true + }, _ctx.ptm("weekHeader", { + context: { + disabled: _ctx.showWeek + } + }), { + "data-p-disabled": _ctx.showWeek, + "data-pc-group-section": "tableheadercell" + }), [renderSlot(_ctx.$slots, "weekheaderlabel", {}, function() { + return [createBaseVNode("span", mergeProps({ + ref_for: true + }, _ctx.ptm("weekHeaderLabel", { + context: { + disabled: _ctx.showWeek + } + }), { + "data-pc-group-section": "tableheadercelllabel" + }), toDisplayString($options.weekHeaderLabel), 17)]; + })], 16, _hoisted_8$1)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList($options.weekDays, function(weekDay) { + return openBlock(), createElementBlock("th", mergeProps({ + key: weekDay, + scope: "col", + abbr: weekDay, + ref_for: true + }, _ctx.ptm("tableHeaderCell"), { + "data-pc-group-section": "tableheadercell", + "class": _ctx.cx("weekDayCell") + }), [createBaseVNode("span", mergeProps({ + "class": _ctx.cx("weekDay"), + ref_for: true + }, _ctx.ptm("weekDay"), { + "data-pc-group-section": "tableheadercelllabel" + }), toDisplayString(weekDay), 17)], 16, _hoisted_9); + }), 128))], 16)], 16), createBaseVNode("tbody", mergeProps({ + ref_for: true + }, _ctx.ptm("tableBody")), [(openBlock(true), createElementBlock(Fragment, null, renderList(month2.dates, function(week, i) { + return openBlock(), createElementBlock("tr", mergeProps({ + key: week[0].day + "" + week[0].month, + ref_for: true + }, _ctx.ptm("tableBodyRow")), [_ctx.showWeek ? (openBlock(), createElementBlock("td", mergeProps({ + key: 0, + "class": _ctx.cx("weekNumber"), + ref_for: true + }, _ctx.ptm("weekNumber"), { + "data-pc-group-section": "tablebodycell" + }), [createBaseVNode("span", mergeProps({ + "class": _ctx.cx("weekLabelContainer"), + ref_for: true + }, _ctx.ptm("weekLabelContainer", { + context: { + disabled: _ctx.showWeek + } + }), { + "data-p-disabled": _ctx.showWeek, + "data-pc-group-section": "tablebodycelllabel" + }), [renderSlot(_ctx.$slots, "weeklabel", { + weekNumber: month2.weekNumbers[i] + }, function() { + return [month2.weekNumbers[i] < 10 ? (openBlock(), createElementBlock("span", mergeProps({ + key: 0, + style: { + "visibility": "hidden" + }, + ref_for: true + }, _ctx.ptm("weekLabel")), "0", 16)) : createCommentVNode("", true), createTextVNode(" " + toDisplayString(month2.weekNumbers[i]), 1)]; + })], 16, _hoisted_10)], 16)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(week, function(date) { + return openBlock(), createElementBlock("td", mergeProps({ + key: date.day + "" + date.month, + "aria-label": date.day, + "class": _ctx.cx("dayCell", { + date + }), + ref_for: true + }, _ctx.ptm("dayCell", { + context: { + date, + today: date.today, + otherMonth: date.otherMonth, + selected: $options.isSelected(date), + disabled: !date.selectable + } + }), { + "data-p-today": date.today, + "data-p-other-month": date.otherMonth, + "data-pc-group-section": "tablebodycell" + }), [_ctx.showOtherMonths || !date.otherMonth ? withDirectives((openBlock(), createElementBlock("span", mergeProps({ + key: 0, + "class": _ctx.cx("day", { + date + }), + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return $options.onDateSelect($event, date); + }, "onClick"), + draggable: "false", + onKeydown: /* @__PURE__ */ __name(function onKeydown6($event) { + return $options.onDateCellKeydown($event, date, groupIndex); + }, "onKeydown"), + "aria-selected": $options.isSelected(date), + "aria-disabled": !date.selectable, + ref_for: true + }, _ctx.ptm("day", { + context: { + date, + today: date.today, + otherMonth: date.otherMonth, + selected: $options.isSelected(date), + disabled: !date.selectable + } + }), { + "data-p-disabled": !date.selectable, + "data-p-selected": $options.isSelected(date), + "data-pc-group-section": "tablebodycelllabel" + }), [renderSlot(_ctx.$slots, "date", { + date + }, function() { + return [createTextVNode(toDisplayString(date.day), 1)]; + })], 16, _hoisted_12)), [[_directive_ripple]]) : createCommentVNode("", true), $options.isSelected(date) ? (openBlock(), createElementBlock("div", mergeProps({ + key: 1, + "class": "p-hidden-accessible", + "aria-live": "polite", + ref_for: true + }, _ctx.ptm("hiddenSelectedDay"), { + "data-p-hidden-accessible": true + }), toDisplayString(date.day), 17)) : createCommentVNode("", true)], 16, _hoisted_11); + }), 128))], 16); + }), 128))], 16)], 16)) : createCommentVNode("", true)], 16); + }), 128))], 16), $data.currentView === "month" ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("monthView") + }, _ctx.ptm("monthView")), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.monthPickerValues, function(m, i) { + return withDirectives((openBlock(), createElementBlock("span", mergeProps({ + key: m, + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return $options.onMonthSelect($event, { + month: m, + index: i + }); + }, "onClick"), + onKeydown: /* @__PURE__ */ __name(function onKeydown6($event) { + return $options.onMonthCellKeydown($event, { + month: m, + index: i + }); + }, "onKeydown"), + "class": _ctx.cx("month", { + month: m, + index: i + }), + ref_for: true + }, _ctx.ptm("month", { + context: { + month: m, + monthIndex: i, + selected: $options.isMonthSelected(i), + disabled: !m.selectable + } + }), { + "data-p-disabled": !m.selectable, + "data-p-selected": $options.isMonthSelected(i) + }), [createTextVNode(toDisplayString(m.value) + " ", 1), $options.isMonthSelected(i) ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": "p-hidden-accessible", + "aria-live": "polite", + ref_for: true + }, _ctx.ptm("hiddenMonth"), { + "data-p-hidden-accessible": true + }), toDisplayString(m.value), 17)) : createCommentVNode("", true)], 16, _hoisted_13)), [[_directive_ripple]]); + }), 128))], 16)) : createCommentVNode("", true), $data.currentView === "year" ? (openBlock(), createElementBlock("div", mergeProps({ + key: 1, + "class": _ctx.cx("yearView") + }, _ctx.ptm("yearView")), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.yearPickerValues, function(y) { + return withDirectives((openBlock(), createElementBlock("span", mergeProps({ + key: y.value, + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return $options.onYearSelect($event, y); + }, "onClick"), + onKeydown: /* @__PURE__ */ __name(function onKeydown6($event) { + return $options.onYearCellKeydown($event, y); + }, "onKeydown"), + "class": _ctx.cx("year", { + year: y + }), + ref_for: true + }, _ctx.ptm("year", { + context: { + year: y, + selected: $options.isYearSelected(y.value), + disabled: !y.selectable + } + }), { + "data-p-disabled": !y.selectable, + "data-p-selected": $options.isYearSelected(y.value) + }), [createTextVNode(toDisplayString(y.value) + " ", 1), $options.isYearSelected(y.value) ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": "p-hidden-accessible", + "aria-live": "polite", + ref_for: true + }, _ctx.ptm("hiddenYear"), { + "data-p-hidden-accessible": true + }), toDisplayString(y.value), 17)) : createCommentVNode("", true)], 16, _hoisted_14)), [[_directive_ripple]]); + }), 128))], 16)) : createCommentVNode("", true)], 64)) : createCommentVNode("", true), (_ctx.showTime || _ctx.timeOnly) && $data.currentView === "date" ? (openBlock(), createElementBlock("div", mergeProps({ + key: 1, + "class": _ctx.cx("timePicker") + }, _ctx.ptm("timePicker")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("hourPicker") + }, _ctx.ptm("hourPicker"), { + "data-pc-group-section": "timepickerContainer" + }), [createVNode(_component_Button, mergeProps({ + "class": _ctx.cx("pcIncrementButton"), + "aria-label": _ctx.$primevue.config.locale.nextHour, + unstyled: _ctx.unstyled, + onMousedown: _cache[9] || (_cache[9] = function($event) { + return $options.onTimePickerElementMouseDown($event, 0, 1); + }), + onMouseup: _cache[10] || (_cache[10] = function($event) { + return $options.onTimePickerElementMouseUp($event); + }), + onKeydown: [$options.onContainerButtonKeydown, _cache[12] || (_cache[12] = withKeys(function($event) { + return $options.onTimePickerElementMouseDown($event, 0, 1); + }, ["enter"])), _cache[13] || (_cache[13] = withKeys(function($event) { + return $options.onTimePickerElementMouseDown($event, 0, 1); + }, ["space"]))], + onMouseleave: _cache[11] || (_cache[11] = function($event) { + return $options.onTimePickerElementMouseLeave(); + }), + onKeyup: [_cache[14] || (_cache[14] = withKeys(function($event) { + return $options.onTimePickerElementMouseUp($event); + }, ["enter"])), _cache[15] || (_cache[15] = withKeys(function($event) { + return $options.onTimePickerElementMouseUp($event); + }, ["space"]))] + }, _ctx.timepickerButtonProps, { + pt: _ctx.ptm("pcIncrementButton"), + "data-pc-group-section": "timepickerbutton" + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "incrementicon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.incrementIcon ? "span" : "ChevronUpIcon"), mergeProps({ + "class": [_ctx.incrementIcon, slotProps["class"]] + }, _ctx.ptm("pcIncrementButton")["icon"], { + "data-pc-group-section": "timepickerlabel" + }), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "aria-label", "unstyled", "onKeydown", "pt"]), createBaseVNode("span", mergeProps(_ctx.ptm("hour"), { + "data-pc-group-section": "timepickerlabel" + }), toDisplayString($options.formattedCurrentHour), 17), createVNode(_component_Button, mergeProps({ + "class": _ctx.cx("pcDecrementButton"), + "aria-label": _ctx.$primevue.config.locale.prevHour, + unstyled: _ctx.unstyled, + onMousedown: _cache[16] || (_cache[16] = function($event) { + return $options.onTimePickerElementMouseDown($event, 0, -1); + }), + onMouseup: _cache[17] || (_cache[17] = function($event) { + return $options.onTimePickerElementMouseUp($event); + }), + onKeydown: [$options.onContainerButtonKeydown, _cache[19] || (_cache[19] = withKeys(function($event) { + return $options.onTimePickerElementMouseDown($event, 0, -1); + }, ["enter"])), _cache[20] || (_cache[20] = withKeys(function($event) { + return $options.onTimePickerElementMouseDown($event, 0, -1); + }, ["space"]))], + onMouseleave: _cache[18] || (_cache[18] = function($event) { + return $options.onTimePickerElementMouseLeave(); + }), + onKeyup: [_cache[21] || (_cache[21] = withKeys(function($event) { + return $options.onTimePickerElementMouseUp($event); + }, ["enter"])), _cache[22] || (_cache[22] = withKeys(function($event) { + return $options.onTimePickerElementMouseUp($event); + }, ["space"]))] + }, _ctx.timepickerButtonProps, { + pt: _ctx.ptm("pcDecrementButton"), + "data-pc-group-section": "timepickerbutton" + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "decrementicon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.decrementIcon ? "span" : "ChevronDownIcon"), mergeProps({ + "class": [_ctx.decrementIcon, slotProps["class"]] + }, _ctx.ptm("pcDecrementButton")["icon"], { + "data-pc-group-section": "timepickerlabel" + }), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "aria-label", "unstyled", "onKeydown", "pt"])], 16), createBaseVNode("div", mergeProps(_ctx.ptm("separatorContainer"), { + "data-pc-group-section": "timepickerContainer" + }), [createBaseVNode("span", mergeProps(_ctx.ptm("separator"), { + "data-pc-group-section": "timepickerlabel" + }), toDisplayString(_ctx.timeSeparator), 17)], 16), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("minutePicker") + }, _ctx.ptm("minutePicker"), { + "data-pc-group-section": "timepickerContainer" + }), [createVNode(_component_Button, mergeProps({ + "class": _ctx.cx("pcIncrementButton"), + "aria-label": _ctx.$primevue.config.locale.nextMinute, + disabled: _ctx.disabled, + unstyled: _ctx.unstyled, + onMousedown: _cache[23] || (_cache[23] = function($event) { + return $options.onTimePickerElementMouseDown($event, 1, 1); + }), + onMouseup: _cache[24] || (_cache[24] = function($event) { + return $options.onTimePickerElementMouseUp($event); + }), + onKeydown: [$options.onContainerButtonKeydown, _cache[26] || (_cache[26] = withKeys(function($event) { + return $options.onTimePickerElementMouseDown($event, 1, 1); + }, ["enter"])), _cache[27] || (_cache[27] = withKeys(function($event) { + return $options.onTimePickerElementMouseDown($event, 1, 1); + }, ["space"]))], + onMouseleave: _cache[25] || (_cache[25] = function($event) { + return $options.onTimePickerElementMouseLeave(); + }), + onKeyup: [_cache[28] || (_cache[28] = withKeys(function($event) { + return $options.onTimePickerElementMouseUp($event); + }, ["enter"])), _cache[29] || (_cache[29] = withKeys(function($event) { + return $options.onTimePickerElementMouseUp($event); + }, ["space"]))] + }, _ctx.timepickerButtonProps, { + pt: _ctx.ptm("pcIncrementButton"), + "data-pc-group-section": "timepickerbutton" + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "incrementicon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.incrementIcon ? "span" : "ChevronUpIcon"), mergeProps({ + "class": [_ctx.incrementIcon, slotProps["class"]] + }, _ctx.ptm("pcIncrementButton")["icon"], { + "data-pc-group-section": "timepickerlabel" + }), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "aria-label", "disabled", "unstyled", "onKeydown", "pt"]), createBaseVNode("span", mergeProps(_ctx.ptm("minute"), { + "data-pc-group-section": "timepickerlabel" + }), toDisplayString($options.formattedCurrentMinute), 17), createVNode(_component_Button, mergeProps({ + "class": _ctx.cx("pcDecrementButton"), + "aria-label": _ctx.$primevue.config.locale.prevMinute, + disabled: _ctx.disabled, + onMousedown: _cache[30] || (_cache[30] = function($event) { + return $options.onTimePickerElementMouseDown($event, 1, -1); + }), + onMouseup: _cache[31] || (_cache[31] = function($event) { + return $options.onTimePickerElementMouseUp($event); + }), + onKeydown: [$options.onContainerButtonKeydown, _cache[33] || (_cache[33] = withKeys(function($event) { + return $options.onTimePickerElementMouseDown($event, 1, -1); + }, ["enter"])), _cache[34] || (_cache[34] = withKeys(function($event) { + return $options.onTimePickerElementMouseDown($event, 1, -1); + }, ["space"]))], + onMouseleave: _cache[32] || (_cache[32] = function($event) { + return $options.onTimePickerElementMouseLeave(); + }), + onKeyup: [_cache[35] || (_cache[35] = withKeys(function($event) { + return $options.onTimePickerElementMouseUp($event); + }, ["enter"])), _cache[36] || (_cache[36] = withKeys(function($event) { + return $options.onTimePickerElementMouseUp($event); + }, ["space"]))] + }, _ctx.timepickerButtonProps, { + pt: _ctx.ptm("pcDecrementButton"), + "data-pc-group-section": "timepickerbutton" + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "decrementicon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.decrementIcon ? "span" : "ChevronDownIcon"), mergeProps({ + "class": [_ctx.decrementIcon, slotProps["class"]] + }, _ctx.ptm("pcDecrementButton")["icon"], { + "data-pc-group-section": "timepickerlabel" + }), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "aria-label", "disabled", "onKeydown", "pt"])], 16), _ctx.showSeconds ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("separatorContainer") + }, _ctx.ptm("separatorContainer"), { + "data-pc-group-section": "timepickerContainer" + }), [createBaseVNode("span", mergeProps(_ctx.ptm("separator"), { + "data-pc-group-section": "timepickerlabel" + }), toDisplayString(_ctx.timeSeparator), 17)], 16)) : createCommentVNode("", true), _ctx.showSeconds ? (openBlock(), createElementBlock("div", mergeProps({ + key: 1, + "class": _ctx.cx("secondPicker") + }, _ctx.ptm("secondPicker"), { + "data-pc-group-section": "timepickerContainer" + }), [createVNode(_component_Button, mergeProps({ + "class": _ctx.cx("pcIncrementButton"), + "aria-label": _ctx.$primevue.config.locale.nextSecond, + disabled: _ctx.disabled, + unstyled: _ctx.unstyled, + onMousedown: _cache[37] || (_cache[37] = function($event) { + return $options.onTimePickerElementMouseDown($event, 2, 1); + }), + onMouseup: _cache[38] || (_cache[38] = function($event) { + return $options.onTimePickerElementMouseUp($event); + }), + onKeydown: [$options.onContainerButtonKeydown, _cache[40] || (_cache[40] = withKeys(function($event) { + return $options.onTimePickerElementMouseDown($event, 2, 1); + }, ["enter"])), _cache[41] || (_cache[41] = withKeys(function($event) { + return $options.onTimePickerElementMouseDown($event, 2, 1); + }, ["space"]))], + onMouseleave: _cache[39] || (_cache[39] = function($event) { + return $options.onTimePickerElementMouseLeave(); + }), + onKeyup: [_cache[42] || (_cache[42] = withKeys(function($event) { + return $options.onTimePickerElementMouseUp($event); + }, ["enter"])), _cache[43] || (_cache[43] = withKeys(function($event) { + return $options.onTimePickerElementMouseUp($event); + }, ["space"]))] + }, _ctx.timepickerButtonProps, { + pt: _ctx.ptm("pcIncrementButton"), + "data-pc-group-section": "timepickerbutton" + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "incrementicon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.incrementIcon ? "span" : "ChevronUpIcon"), mergeProps({ + "class": [_ctx.incrementIcon, slotProps["class"]] + }, _ctx.ptm("pcIncrementButton")["icon"], { + "data-pc-group-section": "timepickerlabel" + }), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "aria-label", "disabled", "unstyled", "onKeydown", "pt"]), createBaseVNode("span", mergeProps(_ctx.ptm("second"), { + "data-pc-group-section": "timepickerlabel" + }), toDisplayString($options.formattedCurrentSecond), 17), createVNode(_component_Button, mergeProps({ + "class": _ctx.cx("pcDecrementButton"), + "aria-label": _ctx.$primevue.config.locale.prevSecond, + disabled: _ctx.disabled, + unstyled: _ctx.unstyled, + onMousedown: _cache[44] || (_cache[44] = function($event) { + return $options.onTimePickerElementMouseDown($event, 2, -1); + }), + onMouseup: _cache[45] || (_cache[45] = function($event) { + return $options.onTimePickerElementMouseUp($event); + }), + onKeydown: [$options.onContainerButtonKeydown, _cache[47] || (_cache[47] = withKeys(function($event) { + return $options.onTimePickerElementMouseDown($event, 2, -1); + }, ["enter"])), _cache[48] || (_cache[48] = withKeys(function($event) { + return $options.onTimePickerElementMouseDown($event, 2, -1); + }, ["space"]))], + onMouseleave: _cache[46] || (_cache[46] = function($event) { + return $options.onTimePickerElementMouseLeave(); + }), + onKeyup: [_cache[49] || (_cache[49] = withKeys(function($event) { + return $options.onTimePickerElementMouseUp($event); + }, ["enter"])), _cache[50] || (_cache[50] = withKeys(function($event) { + return $options.onTimePickerElementMouseUp($event); + }, ["space"]))] + }, _ctx.timepickerButtonProps, { + pt: _ctx.ptm("pcDecrementButton"), + "data-pc-group-section": "timepickerbutton" + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "decrementicon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.decrementIcon ? "span" : "ChevronDownIcon"), mergeProps({ + "class": [_ctx.decrementIcon, slotProps["class"]] + }, _ctx.ptm("pcDecrementButton")["icon"], { + "data-pc-group-section": "timepickerlabel" + }), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "aria-label", "disabled", "unstyled", "onKeydown", "pt"])], 16)) : createCommentVNode("", true), _ctx.hourFormat == "12" ? (openBlock(), createElementBlock("div", mergeProps({ + key: 2, + "class": _ctx.cx("separatorContainer") + }, _ctx.ptm("separatorContainer"), { + "data-pc-group-section": "timepickerContainer" + }), [createBaseVNode("span", mergeProps(_ctx.ptm("separator"), { + "data-pc-group-section": "timepickerlabel" + }), toDisplayString(_ctx.timeSeparator), 17)], 16)) : createCommentVNode("", true), _ctx.hourFormat == "12" ? (openBlock(), createElementBlock("div", mergeProps({ + key: 3, + "class": _ctx.cx("ampmPicker") + }, _ctx.ptm("ampmPicker")), [createVNode(_component_Button, mergeProps({ + "class": _ctx.cx("pcIncrementButton"), + "aria-label": _ctx.$primevue.config.locale.am, + disabled: _ctx.disabled, + unstyled: _ctx.unstyled, + onClick: _cache[51] || (_cache[51] = function($event) { + return $options.toggleAMPM($event); + }), + onKeydown: $options.onContainerButtonKeydown + }, _ctx.timepickerButtonProps, { + pt: _ctx.ptm("pcIncrementButton"), + "data-pc-group-section": "timepickerbutton" + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "incrementicon", { + "class": normalizeClass(_ctx.cx("incrementIcon")) + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.incrementIcon ? "span" : "ChevronUpIcon"), mergeProps({ + "class": [_ctx.cx("incrementIcon"), slotProps["class"]] + }, _ctx.ptm("pcIncrementButton")["icon"], { + "data-pc-group-section": "timepickerlabel" + }), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "aria-label", "disabled", "unstyled", "onKeydown", "pt"]), createBaseVNode("span", mergeProps(_ctx.ptm("ampm"), { + "data-pc-group-section": "timepickerlabel" + }), toDisplayString($data.pm ? _ctx.$primevue.config.locale.pm : _ctx.$primevue.config.locale.am), 17), createVNode(_component_Button, mergeProps({ + "class": _ctx.cx("pcDecrementButton"), + "aria-label": _ctx.$primevue.config.locale.pm, + disabled: _ctx.disabled, + onClick: _cache[52] || (_cache[52] = function($event) { + return $options.toggleAMPM($event); + }), + onKeydown: $options.onContainerButtonKeydown + }, _ctx.timepickerButtonProps, { + pt: _ctx.ptm("pcDecrementButton"), + "data-pc-group-section": "timepickerbutton" + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "decrementicon", { + "class": normalizeClass(_ctx.cx("decrementIcon")) + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.decrementIcon ? "span" : "ChevronDownIcon"), mergeProps({ + "class": [_ctx.cx("decrementIcon"), slotProps["class"]] + }, _ctx.ptm("pcDecrementButton")["icon"], { + "data-pc-group-section": "timepickerlabel" + }), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "aria-label", "disabled", "onKeydown", "pt"])], 16)) : createCommentVNode("", true)], 16)) : createCommentVNode("", true), _ctx.showButtonBar ? (openBlock(), createElementBlock("div", mergeProps({ + key: 2, + "class": _ctx.cx("buttonbar") + }, _ctx.ptm("buttonbar")), [createVNode(_component_Button, mergeProps({ + label: $options.todayLabel, + onClick: _cache[53] || (_cache[53] = function($event) { + return $options.onTodayButtonClick($event); + }), + "class": _ctx.cx("pcTodayButton"), + unstyled: _ctx.unstyled, + onKeydown: $options.onContainerButtonKeydown + }, _ctx.todayButtonProps, { + pt: _ctx.ptm("pcTodayButton"), + "data-pc-group-section": "button" + }), null, 16, ["label", "class", "unstyled", "onKeydown", "pt"]), createVNode(_component_Button, mergeProps({ + label: $options.clearLabel, + onClick: _cache[54] || (_cache[54] = function($event) { + return $options.onClearButtonClick($event); + }), + "class": _ctx.cx("pcClearButton"), + unstyled: _ctx.unstyled, + onKeydown: $options.onContainerButtonKeydown + }, _ctx.clearButtonProps, { + pt: _ctx.ptm("pcClearButton"), + "data-pc-group-section": "button" + }), null, 16, ["label", "class", "unstyled", "onKeydown", "pt"])], 16)) : createCommentVNode("", true), renderSlot(_ctx.$slots, "footer")], 16, _hoisted_3$h)) : createCommentVNode("", true)]; + }), + _: 3 + }, 16, ["onAfterEnter", "onAfterLeave", "onLeave"])]; + }), + _: 3 + }, 8, ["appendTo", "disabled"])], 16, _hoisted_1$s); +} +__name(render$V, "render$V"); +script$12.render = render$V; +var script$11 = { + name: "Calendar", + "extends": script$12, + mounted: /* @__PURE__ */ __name(function mounted6() { + console.warn("Deprecated since v4. Use DatePicker component instead."); + }, "mounted") +}; +var CalendarStyle = BaseStyle.extend({ + name: "calendar" +}); +var theme$y = /* @__PURE__ */ __name(function theme6(_ref) { + var dt = _ref.dt; + return "\n.p-cascadeselect {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n background: ".concat(dt("cascadeselect.background"), ";\n border: 1px solid ").concat(dt("cascadeselect.border.color"), ";\n transition: background ").concat(dt("cascadeselect.transition.duration"), ", color ").concat(dt("cascadeselect.transition.duration"), ", border-color ").concat(dt("cascadeselect.transition.duration"), ", outline-color ").concat(dt("cascadeselect.transition.duration"), ", box-shadow ").concat(dt("cascadeselect.transition.duration"), ";\n border-radius: ").concat(dt("cascadeselect.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("cascadeselect.shadow"), ";\n}\n\n.p-cascadeselect:not(.p-disabled):hover {\n border-color: ").concat(dt("cascadeselect.hover.border.color"), ";\n}\n\n.p-cascadeselect:not(.p-disabled).p-focus {\n border-color: ").concat(dt("cascadeselect.focus.border.color"), ";\n box-shadow: ").concat(dt("cascadeselect.focus.ring.shadow"), ";\n outline: ").concat(dt("cascadeselect.focus.ring.width"), " ").concat(dt("cascadeselect.focus.ring.style"), " ").concat(dt("cascadeselect.focus.ring.color"), ";\n outline-offset: ").concat(dt("cascadeselect.focus.ring.offset"), ";\n}\n\n.p-cascadeselect.p-variant-filled {\n background: ").concat(dt("cascadeselect.filled.background"), ";\n}\n\n.p-cascadeselect.p-variant-filled:not(.p-disabled):hover {\n background: ").concat(dt("cascadeselect.filled.hover.background"), ";\n}\n\n.p-cascadeselect.p-variant-filled.p-focus {\n background: ").concat(dt("cascadeselect.filled.focus.background"), ";\n}\n\n.p-cascadeselect.p-invalid {\n border-color: ").concat(dt("cascadeselect.invalid.border.color"), ";\n}\n\n.p-cascadeselect.p-disabled {\n opacity: 1;\n background: ").concat(dt("cascadeselect.disabled.background"), ";\n}\n\n.p-cascadeselect-dropdown {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n background: transparent;\n color: ").concat(dt("cascadeselect.dropdown.color"), ";\n width: ").concat(dt("cascadeselect.dropdown.width"), ";\n border-start-end-radius: ").concat(dt("border.radius.md"), ";\n border-end-end-radius: ").concat(dt("border.radius.md"), ";\n}\n\n.p-cascadeselect-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n color: ").concat(dt("cascadeselect.clear.icon.color"), ";\n inset-inline-end: ").concat(dt("cascadeselect.dropdown.width"), ";\n}\n\n.p-cascadeselect-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n padding: ").concat(dt("cascadeselect.padding.y"), " ").concat(dt("cascadeselect.padding.x"), ";\n background: transparent;\n border: 0 none;\n outline: 0 none;\n}\n\n.p-cascadeselect-label.p-placeholder {\n color: ").concat(dt("cascadeselect.placeholder.color"), ";\n}\n\n.p-cascadeselect.p-invalid .p-cascadeselect-label.p-placeholder {\n color: ").concat(dt("cascadeselect.invalid.placeholder.color"), ";\n}\n\n.p-cascadeselect.p-disabled .p-cascadeselect-label {\n color: ").concat(dt("cascadeselect.disabled.color"), ";\n}\n\n.p-cascadeselect-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\n\n.p-cascadeselect-fluid {\n display: flex;\n}\n\n.p-cascadeselect-fluid .p-cascadeselect-label {\n width: 1%;\n}\n\n.p-cascadeselect-overlay {\n background: ").concat(dt("cascadeselect.overlay.background"), ";\n color: ").concat(dt("cascadeselect.overlay.color"), ";\n border: 1px solid ").concat(dt("cascadeselect.overlay.border.color"), ";\n border-radius: ").concat(dt("cascadeselect.overlay.border.radius"), ";\n box-shadow: ").concat(dt("cascadeselect.overlay.shadow"), ";\n}\n\n.p-cascadeselect .p-cascadeselect-overlay {\n min-width: 100%;\n}\n\n.p-cascadeselect-option-list {\n display: none;\n min-width: 100%;\n position: absolute;\n z-index: 1;\n}\n\n.p-cascadeselect-list {\n min-width: 100%;\n margin: 0;\n padding: 0;\n list-style-type: none;\n padding: ").concat(dt("cascadeselect.list.padding"), ";\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("cascadeselect.list.gap"), ";\n}\n\n.p-cascadeselect-option {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n border: 0 none;\n color: ").concat(dt("cascadeselect.option.color"), ";\n background: transparent;\n border-radius: ").concat(dt("cascadeselect.option.border.radius"), ";\n}\n\n.p-cascadeselect-option-active {\n overflow: visible;\n}\n\n.p-cascadeselect-option-active > .p-cascadeselect-option-content {\n background: ").concat(dt("cascadeselect.option.focus.background"), ";\n color: ").concat(dt("cascadeselect.option.focus.color"), ";\n}\n\n.p-cascadeselect-option:not(.p-cascadeselect-option-selected):not(.p-disabled).p-focus > .p-cascadeselect-option-content {\n background: ").concat(dt("cascadeselect.option.focus.background"), ";\n color: ").concat(dt("cascadeselect.option.focus.color"), ";\n}\n\n.p-cascadeselect-option:not(.p-cascadeselect-option-selected):not(.p-disabled).p-focus > .p-cascadeselect-option-content > .p-cascadeselect-group-icon-container > .p-cascadeselect-group-icon {\n color: ").concat(dt("cascadeselect.option.icon.focus.color"), ";\n}\n\n.p-cascadeselect-option-selected > .p-cascadeselect-option-content {\n background: ").concat(dt("cascadeselect.option.selected.background"), ";\n color: ").concat(dt("cascadeselect.option.selected.color"), ";\n}\n\n.p-cascadeselect-option-selected.p-focus > .p-cascadeselect-option-content {\n background: ").concat(dt("cascadeselect.option.selected.focus.background"), ";\n color: ").concat(dt("cascadeselect.option.selected.focus.color"), ";\n}\n\n.p-cascadeselect-option-active > .p-cascadeselect-option-list {\n inset-inline-start: 100%;\n inset-block-start: 0;\n}\n\n.p-cascadeselect-option-content {\n display: flex;\n align-items: center;\n justify-content: space-between;\n overflow: hidden;\n position: relative;\n padding: ").concat(dt("cascadeselect.option.padding"), ";\n border-radius: ").concat(dt("cascadeselect.option.border.radius"), ";\n transition: background ").concat(dt("cascadeselect.transition.duration"), ", color ").concat(dt("cascadeselect.transition.duration"), ", border-color ").concat(dt("cascadeselect.transition.duration"), ", box-shadow ").concat(dt("cascadeselect.transition.duration"), ", outline-color ").concat(dt("cascadeselect.transition.duration"), ";\n}\n\n.p-cascadeselect-group-icon {\n font-size: ").concat(dt("cascadeselect.option.icon.size"), ";\n width: ").concat(dt("cascadeselect.option.icon.size"), ";\n height: ").concat(dt("cascadeselect.option.icon.size"), ";\n color: ").concat(dt("cascadeselect.option.icon.color"), ";\n}\n\n.p-cascadeselect-group-icon:dir(rtl) {\n transform: rotate(180deg);\n}\n\n.p-cascadeselect-mobile-active .p-cascadeselect-option-list {\n position: static;\n box-shadow: none;\n border: 0 none;\n padding-inline-start: ").concat(dt("tieredmenu.submenu.mobile.indent"), ";\n padding-inline-end: 0;\n}\n\n.p-cascadeselect-mobile-active .p-cascadeselect-group-icon {\n transition: transform 0.2s;\n transform: rotate(90deg);\n}\n\n.p-cascadeselect-mobile-active .p-cascadeselect-option-active > .p-cascadeselect-option-content .p-cascadeselect-group-icon {\n transform: rotate(-90deg);\n}\n\n.p-cascadeselect-sm .p-cascadeselect-label {\n font-size: ").concat(dt("cascadeselect.sm.font.size"), ";\n padding-block: ").concat(dt("cascadeselect.sm.padding.y"), ";\n padding-inline: ").concat(dt("cascadeselect.sm.padding.x"), ";\n}\n\n.p-cascadeselect-sm .p-cascadeselect-dropdown .p-icon {\n font-size: ").concat(dt("cascadeselect.sm.font.size"), ";\n width: ").concat(dt("cascadeselect.sm.font.size"), ";\n height: ").concat(dt("cascadeselect.sm.font.size"), ";\n}\n\n.p-cascadeselect-lg .p-cascadeselect-label {\n font-size: ").concat(dt("cascadeselect.lg.font.size"), ";\n padding-block: ").concat(dt("cascadeselect.lg.padding.y"), ";\n padding-inline: ").concat(dt("cascadeselect.lg.padding.x"), ";\n}\n\n.p-cascadeselect-lg .p-cascadeselect-dropdown .p-icon {\n font-size: ").concat(dt("cascadeselect.lg.font.size"), ";\n width: ").concat(dt("cascadeselect.lg.font.size"), ";\n height: ").concat(dt("cascadeselect.lg.font.size"), ";\n}\n"); +}, "theme"); +var inlineStyles$7 = { + root: /* @__PURE__ */ __name(function root6(_ref2) { + var props = _ref2.props; + return { + position: props.appendTo === "self" ? "relative" : void 0 + }; + }, "root") +}; +var classes$C = { + root: /* @__PURE__ */ __name(function root7(_ref3) { + var instance = _ref3.instance, props = _ref3.props; + return ["p-cascadeselect p-component p-inputwrapper", { + "p-cascadeselect-mobile": instance.queryMatches, + "p-disabled": props.disabled, + "p-invalid": instance.$invalid, + "p-variant-filled": instance.$variant === "filled", + "p-focus": instance.focused, + "p-inputwrapper-filled": instance.$filled, + "p-inputwrapper-focus": instance.focused || instance.overlayVisible, + "p-cascadeselect-open": instance.overlayVisible, + "p-cascadeselect-fluid": instance.$fluid, + "p-cascadeselect-sm p-inputfield-sm": props.size === "small", + "p-cascadeselect-lg p-inputfield-lg": props.size === "large" + }]; + }, "root"), + label: /* @__PURE__ */ __name(function label2(_ref4) { + var instance = _ref4.instance, props = _ref4.props; + return ["p-cascadeselect-label", { + "p-placeholder": instance.label === props.placeholder, + "p-cascadeselect-label-empty": !instance.$slots["value"] && (instance.label === "p-emptylabel" || instance.label.length === 0) + }]; + }, "label"), + clearIcon: "p-cascadeselect-clear-icon", + dropdown: "p-cascadeselect-dropdown", + loadingIcon: "p-cascadeselect-loading-icon", + dropdownIcon: "p-cascadeselect-dropdown-icon", + overlay: /* @__PURE__ */ __name(function overlay(_ref5) { + var instance = _ref5.instance; + return ["p-cascadeselect-overlay p-component", { + "p-cascadeselect-mobile-active": instance.queryMatches + }]; + }, "overlay"), + listContainer: "p-cascadeselect-list-container", + list: "p-cascadeselect-list", + option: /* @__PURE__ */ __name(function option(_ref6) { + var instance = _ref6.instance, processedOption = _ref6.processedOption; + return ["p-cascadeselect-option", { + "p-cascadeselect-option-active": instance.isOptionActive(processedOption), + "p-cascadeselect-option-selected": instance.isOptionSelected(processedOption), + "p-focus": instance.isOptionFocused(processedOption), + "p-disabled": instance.isOptionDisabled(processedOption) + }]; + }, "option"), + optionContent: "p-cascadeselect-option-content", + optionText: "p-cascadeselect-option-text", + groupIconContainer: "p-cascadeselect-group-icon-container", + groupIcon: "p-cascadeselect-group-icon", + optionList: "p-cascadeselect-overlay p-cascadeselect-option-list" +}; +var CascadeSelectStyle = BaseStyle.extend({ + name: "cascadeselect", + theme: theme$y, + classes: classes$C, + inlineStyles: inlineStyles$7 +}); +var script$2$8 = { + name: "BaseCascadeSelect", + "extends": script$1n, + props: { + options: Array, + optionLabel: null, + optionValue: null, + optionDisabled: null, + optionGroupLabel: null, + optionGroupChildren: null, + placeholder: String, + breakpoint: { + type: String, + "default": "960px" + }, + dataKey: null, + showClear: { + type: Boolean, + "default": false + }, + clearIcon: { + type: String, + "default": void 0 + }, + inputId: { + type: String, + "default": null + }, + inputClass: { + type: [String, Object], + "default": null + }, + inputStyle: { + type: Object, + "default": null + }, + inputProps: { + type: null, + "default": null + }, + panelClass: { + type: [String, Object], + "default": null + }, + panelStyle: { + type: Object, + "default": null + }, + panelProps: { + type: null, + "default": null + }, + overlayClass: { + type: [String, Object], + "default": null + }, + overlayStyle: { + type: Object, + "default": null + }, + overlayProps: { + type: null, + "default": null + }, + appendTo: { + type: [String, Object], + "default": "body" + }, + loading: { + type: Boolean, + "default": false + }, + dropdownIcon: { + type: String, + "default": void 0 + }, + loadingIcon: { + type: String, + "default": void 0 + }, + optionGroupIcon: { + type: String, + "default": void 0 + }, + autoOptionFocus: { + type: Boolean, + "default": false + }, + selectOnFocus: { + type: Boolean, + "default": false + }, + focusOnHover: { + type: Boolean, + "default": true + }, + searchLocale: { + type: String, + "default": void 0 + }, + searchMessage: { + type: String, + "default": null + }, + selectionMessage: { + type: String, + "default": null + }, + emptySelectionMessage: { + type: String, + "default": null + }, + emptySearchMessage: { + type: String, + "default": null + }, + emptyMessage: { + type: String, + "default": null + }, + tabindex: { + type: Number, + "default": 0 + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + } + }, + style: CascadeSelectStyle, + provide: /* @__PURE__ */ __name(function provide11() { + return { + $pcCascadeSelect: this, + $parentInstance: this + }; + }, "provide") +}; +var script$1$E = { + name: "CascadeSelectSub", + hostName: "CascadeSelect", + "extends": script$1d, + emits: ["option-change", "option-focus-change", "option-focus-enter-change"], + container: null, + props: { + selectId: String, + focusedOptionId: String, + options: Array, + optionLabel: String, + optionValue: String, + optionDisabled: null, + optionGroupIcon: String, + optionGroupLabel: String, + optionGroupChildren: { + type: [String, Array], + "default": null + }, + activeOptionPath: Array, + level: Number, + templates: null, + value: null + }, + methods: { + getOptionId: /* @__PURE__ */ __name(function getOptionId(processedOption) { + return "".concat(this.selectId, "_").concat(processedOption.key); + }, "getOptionId"), + getOptionLabel: /* @__PURE__ */ __name(function getOptionLabel(processedOption) { + return this.optionLabel ? resolveFieldData(processedOption.option, this.optionLabel) : processedOption.option; + }, "getOptionLabel"), + getOptionValue: /* @__PURE__ */ __name(function getOptionValue(processedOption) { + return this.optionValue ? resolveFieldData(processedOption.option, this.optionValue) : processedOption.option; + }, "getOptionValue"), + getPTOptions: /* @__PURE__ */ __name(function getPTOptions(processedOption, index, key) { + return this.ptm(key, { + context: { + option: processedOption, + index, + level: this.level, + optionGroup: this.isOptionGroup(processedOption), + active: this.isOptionActive(processedOption), + focused: this.isOptionFocused(processedOption), + disabled: this.isOptionDisabled(processedOption) + } + }); + }, "getPTOptions"), + isOptionDisabled: /* @__PURE__ */ __name(function isOptionDisabled(processedOption) { + return this.optionDisabled ? resolveFieldData(processedOption.option, this.optionDisabled) : false; + }, "isOptionDisabled"), + getOptionGroupLabel: /* @__PURE__ */ __name(function getOptionGroupLabel(processedOption) { + return this.optionGroupLabel ? resolveFieldData(processedOption.option, this.optionGroupLabel) : null; + }, "getOptionGroupLabel"), + getOptionGroupChildren: /* @__PURE__ */ __name(function getOptionGroupChildren(processedOption) { + return processedOption.children; + }, "getOptionGroupChildren"), + isOptionGroup: /* @__PURE__ */ __name(function isOptionGroup(processedOption) { + return isNotEmpty(processedOption.children); + }, "isOptionGroup"), + isOptionSelected: /* @__PURE__ */ __name(function isOptionSelected(processedOption) { + return equals(this.value, processedOption === null || processedOption === void 0 ? void 0 : processedOption.option); + }, "isOptionSelected"), + isOptionActive: /* @__PURE__ */ __name(function isOptionActive(processedOption) { + return this.activeOptionPath.some(function(path) { + return path.key === processedOption.key; + }); + }, "isOptionActive"), + isOptionFocused: /* @__PURE__ */ __name(function isOptionFocused(processedOption) { + return this.focusedOptionId === this.getOptionId(processedOption); + }, "isOptionFocused"), + getOptionLabelToRender: /* @__PURE__ */ __name(function getOptionLabelToRender(processedOption) { + return this.isOptionGroup(processedOption) ? this.getOptionGroupLabel(processedOption) : this.getOptionLabel(processedOption); + }, "getOptionLabelToRender"), + onOptionClick: /* @__PURE__ */ __name(function onOptionClick(event2, processedOption) { + this.$emit("option-change", { + originalEvent: event2, + processedOption, + isFocus: true + }); + }, "onOptionClick"), + onOptionMouseEnter: /* @__PURE__ */ __name(function onOptionMouseEnter(event2, processedOption) { + this.$emit("option-focus-enter-change", { + originalEvent: event2, + processedOption + }); + }, "onOptionMouseEnter"), + onOptionMouseMove: /* @__PURE__ */ __name(function onOptionMouseMove(event2, processedOption) { + this.$emit("option-focus-change", { + originalEvent: event2, + processedOption + }); + }, "onOptionMouseMove"), + containerRef: /* @__PURE__ */ __name(function containerRef2(el) { + this.container = el; + }, "containerRef"), + listAriaLabel: /* @__PURE__ */ __name(function listAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.listLabel : void 0; + }, "listAriaLabel") + }, + directives: { + ripple: Ripple + }, + components: { + AngleRightIcon: script$1q + } +}; +var _hoisted_1$1$6 = ["id", "aria-label", "aria-selected", "aria-expanded", "aria-level", "aria-setsize", "aria-posinset", "data-p-option-group", "data-p-active", "data-p-focus", "data-p-disabled"]; +var _hoisted_2$k = ["onClick", "onMouseenter", "onMousemove"]; +function render$1$8(_ctx, _cache, $props, $setup, $data, $options) { + var _component_AngleRightIcon = resolveComponent("AngleRightIcon"); + var _component_CascadeSelectSub = resolveComponent("CascadeSelectSub", true); + var _directive_ripple = resolveDirective("ripple"); + return openBlock(), createElementBlock("ul", mergeProps({ + ref: $options.containerRef, + "class": _ctx.cx("list") + }, $props.level === 0 ? _ctx.ptm("list") : _ctx.ptm("optionList")), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.options, function(processedOption, index) { + return openBlock(), createElementBlock("li", mergeProps({ + key: $options.getOptionLabelToRender(processedOption), + id: $options.getOptionId(processedOption), + "class": _ctx.cx("option", { + processedOption + }), + role: "treeitem", + "aria-label": $options.getOptionLabelToRender(processedOption), + "aria-selected": $options.isOptionGroup(processedOption) ? void 0 : $options.isOptionSelected(processedOption), + "aria-expanded": $options.isOptionGroup(processedOption) ? $options.isOptionActive(processedOption) : void 0, + "aria-level": $props.level + 1, + "aria-setsize": $props.options.length, + "aria-posinset": index + 1, + ref_for: true + }, $options.getPTOptions(processedOption, index, "option"), { + "data-p-option-group": $options.isOptionGroup(processedOption), + "data-p-active": $options.isOptionActive(processedOption), + "data-p-focus": $options.isOptionFocused(processedOption), + "data-p-disabled": $options.isOptionDisabled(processedOption) + }), [withDirectives((openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("optionContent"), + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return $options.onOptionClick($event, processedOption); + }, "onClick"), + onMouseenter: /* @__PURE__ */ __name(function onMouseenter($event) { + return $options.onOptionMouseEnter($event, processedOption); + }, "onMouseenter"), + onMousemove: /* @__PURE__ */ __name(function onMousemove($event) { + return $options.onOptionMouseMove($event, processedOption); + }, "onMousemove"), + ref_for: true + }, $options.getPTOptions(processedOption, index, "optionContent")), [$props.templates["option"] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates["option"]), { + key: 0, + option: processedOption.option, + selected: $options.isOptionGroup(processedOption) ? false : $options.isOptionSelected(processedOption) + }, null, 8, ["option", "selected"])) : (openBlock(), createElementBlock("span", mergeProps({ + key: 1, + "class": _ctx.cx("optionText"), + ref_for: true + }, $options.getPTOptions(processedOption, index, "optionText")), toDisplayString($options.getOptionLabelToRender(processedOption)), 17)), $options.isOptionGroup(processedOption) ? (openBlock(), createElementBlock("span", { + key: 2, + "class": normalizeClass(_ctx.cx("groupIconContainer")) + }, [$props.templates["optiongroupicon"] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates["optiongroupicon"]), { + key: 0, + "class": normalizeClass(_ctx.cx("groupIcon")) + }, null, 8, ["class"])) : $props.optionGroupIcon ? (openBlock(), createElementBlock("span", mergeProps({ + key: 1, + "class": [_ctx.cx("groupIcon"), $props.optionGroupIcon], + "aria-hidden": "true", + ref_for: true + }, $options.getPTOptions(processedOption, index, "groupIcon")), null, 16)) : (openBlock(), createBlock(_component_AngleRightIcon, mergeProps({ + key: 2, + "class": _ctx.cx("groupIcon"), + "aria-hidden": "true", + ref_for: true + }, $options.getPTOptions(processedOption, index, "groupIcon")), null, 16, ["class"]))], 2)) : createCommentVNode("", true)], 16, _hoisted_2$k)), [[_directive_ripple]]), $options.isOptionGroup(processedOption) && $options.isOptionActive(processedOption) ? (openBlock(), createBlock(_component_CascadeSelectSub, { + key: 0, + role: "group", + "class": normalizeClass(_ctx.cx("optionList")), + selectId: $props.selectId, + focusedOptionId: $props.focusedOptionId, + options: $options.getOptionGroupChildren(processedOption), + activeOptionPath: $props.activeOptionPath, + level: $props.level + 1, + templates: $props.templates, + optionLabel: $props.optionLabel, + optionValue: $props.optionValue, + optionDisabled: $props.optionDisabled, + optionGroupIcon: $props.optionGroupIcon, + optionGroupLabel: $props.optionGroupLabel, + optionGroupChildren: $props.optionGroupChildren, + value: $props.value, + onOptionChange: _cache[0] || (_cache[0] = function($event) { + return _ctx.$emit("option-change", $event); + }), + onOptionFocusChange: _cache[1] || (_cache[1] = function($event) { + return _ctx.$emit("option-focus-change", $event); + }), + onOptionFocusEnterChange: _cache[2] || (_cache[2] = function($event) { + return _ctx.$emit("option-focus-enter-change", $event); + }), + pt: _ctx.pt, + unstyled: _ctx.unstyled + }, null, 8, ["class", "selectId", "focusedOptionId", "options", "activeOptionPath", "level", "templates", "optionLabel", "optionValue", "optionDisabled", "optionGroupIcon", "optionGroupLabel", "optionGroupChildren", "value", "pt", "unstyled"])) : createCommentVNode("", true)], 16, _hoisted_1$1$6); + }), 128))], 16); +} +__name(render$1$8, "render$1$8"); +script$1$E.render = render$1$8; +function _typeof$1$3(o) { + "@babel/helpers - typeof"; + return _typeof$1$3 = "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$1$3(o); +} +__name(_typeof$1$3, "_typeof$1$3"); +function ownKeys$1$2(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$1$2, "ownKeys$1$2"); +function _objectSpread$1$2(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$1$2(Object(t2), true).forEach(function(r2) { + _defineProperty$1$3(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$1$2(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$1$2, "_objectSpread$1$2"); +function _defineProperty$1$3(e, r, t2) { + return (r = _toPropertyKey$1$3(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$1$3, "_defineProperty$1$3"); +function _toPropertyKey$1$3(t2) { + var i = _toPrimitive$1$3(t2, "string"); + return "symbol" == _typeof$1$3(i) ? i : i + ""; +} +__name(_toPropertyKey$1$3, "_toPropertyKey$1$3"); +function _toPrimitive$1$3(t2, r) { + if ("object" != _typeof$1$3(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$1$3(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$1$3, "_toPrimitive$1$3"); +var script$10 = { + name: "CascadeSelect", + "extends": script$2$8, + inheritAttrs: false, + emits: ["change", "focus", "blur", "click", "group-change", "before-show", "before-hide", "hide", "show"], + outsideClickListener: null, + matchMediaListener: null, + scrollHandler: null, + resizeListener: null, + overlay: null, + searchTimeout: null, + searchValue: null, + data: /* @__PURE__ */ __name(function data4() { + return { + id: this.$attrs.id, + clicked: false, + focused: false, + focusedOptionInfo: { + index: -1, + level: 0, + parentKey: "" + }, + activeOptionPath: [], + overlayVisible: false, + dirty: false, + mobileActive: false, + query: null, + queryMatches: false + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId2(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId"), + options: /* @__PURE__ */ __name(function options() { + this.autoUpdateModel(); + }, "options") + }, + mounted: /* @__PURE__ */ __name(function mounted7() { + this.id = this.id || UniqueComponentId(); + this.autoUpdateModel(); + this.bindMatchMediaListener(); + }, "mounted"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount3() { + this.unbindOutsideClickListener(); + this.unbindResizeListener(); + this.unbindMatchMediaListener(); + if (this.scrollHandler) { + this.scrollHandler.destroy(); + this.scrollHandler = null; + } + if (this.overlay) { + ZIndex.clear(this.overlay); + this.overlay = null; + } + if (this.mobileActive) { + this.mobileActive = false; + } + }, "beforeUnmount"), + methods: { + getOptionLabel: /* @__PURE__ */ __name(function getOptionLabel2(option4) { + return this.optionLabel ? resolveFieldData(option4, this.optionLabel) : option4; + }, "getOptionLabel"), + getOptionValue: /* @__PURE__ */ __name(function getOptionValue2(option4) { + return this.optionValue ? resolveFieldData(option4, this.optionValue) : option4; + }, "getOptionValue"), + isOptionDisabled: /* @__PURE__ */ __name(function isOptionDisabled2(option4) { + return this.optionDisabled ? resolveFieldData(option4, this.optionDisabled) : false; + }, "isOptionDisabled"), + getOptionGroupLabel: /* @__PURE__ */ __name(function getOptionGroupLabel2(optionGroup) { + return this.optionGroupLabel ? resolveFieldData(optionGroup, this.optionGroupLabel) : null; + }, "getOptionGroupLabel"), + getOptionGroupChildren: /* @__PURE__ */ __name(function getOptionGroupChildren2(optionGroup, level) { + return isString(this.optionGroupChildren) ? resolveFieldData(optionGroup, this.optionGroupChildren) : resolveFieldData(optionGroup, this.optionGroupChildren[level]); + }, "getOptionGroupChildren"), + isOptionGroup: /* @__PURE__ */ __name(function isOptionGroup2(option4, level) { + return Object.prototype.hasOwnProperty.call(option4, this.optionGroupChildren[level]); + }, "isOptionGroup"), + getProccessedOptionLabel: /* @__PURE__ */ __name(function getProccessedOptionLabel() { + var processedOption = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + var grouped = this.isProccessedOptionGroup(processedOption); + return grouped ? this.getOptionGroupLabel(processedOption.option, processedOption.level) : this.getOptionLabel(processedOption.option); + }, "getProccessedOptionLabel"), + isProccessedOptionGroup: /* @__PURE__ */ __name(function isProccessedOptionGroup(processedOption) { + return isNotEmpty(processedOption === null || processedOption === void 0 ? void 0 : processedOption.children); + }, "isProccessedOptionGroup"), + show: /* @__PURE__ */ __name(function show(isFocus) { + this.$emit("before-show"); + this.overlayVisible = true; + this.activeOptionPath = this.$filled ? this.findOptionPathByValue(this.d_value) : this.activeOptionPath; + if (this.$filled && isNotEmpty(this.activeOptionPath)) { + var processedOption = this.activeOptionPath[this.activeOptionPath.length - 1]; + this.focusedOptionInfo = { + index: processedOption.index, + level: processedOption.level, + parentKey: processedOption.parentKey + }; + } else { + this.focusedOptionInfo = { + index: this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : this.findSelectedOptionIndex(), + level: 0, + parentKey: "" + }; + } + isFocus && focus(this.$refs.focusInput); + }, "show"), + hide: /* @__PURE__ */ __name(function hide2(isFocus) { + var _this = this; + var _hide = /* @__PURE__ */ __name(function _hide2() { + _this.$emit("before-hide"); + _this.overlayVisible = false; + _this.clicked = false; + _this.activeOptionPath = []; + _this.focusedOptionInfo = { + index: -1, + level: 0, + parentKey: "" + }; + isFocus && focus(_this.$refs.focusInput); + }, "_hide"); + setTimeout(function() { + _hide(); + }, 0); + }, "hide"), + onFocus: /* @__PURE__ */ __name(function onFocus3(event2) { + if (this.disabled) { + return; + } + this.focused = true; + this.$emit("focus", event2); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur2(event2) { + var _this$formField$onBlu, _this$formField; + this.focused = false; + this.focusedOptionInfo = { + index: -1, + level: 0, + parentKey: "" + }; + this.searchValue = ""; + this.$emit("blur", event2); + (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField); + }, "onBlur"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown2(event2) { + if (this.disabled || this.loading) { + event2.preventDefault(); + return; + } + var metaKey = event2.metaKey || event2.ctrlKey; + switch (event2.code) { + case "ArrowDown": + this.onArrowDownKey(event2); + break; + case "ArrowUp": + this.onArrowUpKey(event2); + break; + case "ArrowLeft": + this.onArrowLeftKey(event2); + break; + case "ArrowRight": + this.onArrowRightKey(event2); + break; + case "Home": + this.onHomeKey(event2); + break; + case "End": + this.onEndKey(event2); + break; + case "Space": + this.onSpaceKey(event2); + break; + case "Enter": + case "NumpadEnter": + this.onEnterKey(event2); + break; + case "Escape": + this.onEscapeKey(event2); + break; + case "Tab": + this.onTabKey(event2); + break; + case "PageDown": + case "PageUp": + case "Backspace": + case "ShiftLeft": + case "ShiftRight": + break; + default: + if (!metaKey && isPrintableCharacter(event2.key)) { + !this.overlayVisible && this.show(); + this.searchOptions(event2, event2.key); + } + break; + } + this.clicked = false; + }, "onKeyDown"), + onOptionChange: /* @__PURE__ */ __name(function onOptionChange(event2) { + var processedOption = event2.processedOption, type = event2.type; + if (isEmpty(processedOption)) return; + var index = processedOption.index, key = processedOption.key, level = processedOption.level, parentKey = processedOption.parentKey, children = processedOption.children; + var grouped = isNotEmpty(children); + var activeOptionPath = this.activeOptionPath.filter(function(p) { + return p.parentKey !== parentKey && p.parentKey !== key; + }); + this.focusedOptionInfo = { + index, + level, + parentKey + }; + if (type == "hover" && this.queryMatches) { + return; + } + if (grouped) { + activeOptionPath.push(processedOption); + } + this.activeOptionPath = activeOptionPath; + }, "onOptionChange"), + onOptionClick: /* @__PURE__ */ __name(function onOptionClick2(event2) { + var originalEvent = event2.originalEvent, processedOption = event2.processedOption, isFocus = event2.isFocus, isHide = event2.isHide, preventSelection = event2.preventSelection; + var index = processedOption.index, key = processedOption.key, level = processedOption.level, parentKey = processedOption.parentKey; + var grouped = this.isProccessedOptionGroup(processedOption); + var selected3 = this.isSelected(processedOption); + if (selected3) { + this.activeOptionPath = this.activeOptionPath.filter(function(p) { + return key !== p.key && key.startsWith(p.key); + }); + this.focusedOptionInfo = { + index, + level, + parentKey + }; + } else { + if (grouped) { + this.onOptionChange(event2); + this.onOptionGroupSelect(originalEvent, processedOption); + } else { + var activeOptionPath = this.activeOptionPath.filter(function(p) { + return p.parentKey !== parentKey; + }); + activeOptionPath.push(processedOption); + this.focusedOptionInfo = { + index, + level, + parentKey + }; + if (!preventSelection || (processedOption === null || processedOption === void 0 ? void 0 : processedOption.children.length) !== 0) { + this.activeOptionPath = activeOptionPath; + this.onOptionSelect(originalEvent, processedOption, isHide); + } + } + } + isFocus && focus(this.$refs.focusInput); + }, "onOptionClick"), + onOptionMouseEnter: /* @__PURE__ */ __name(function onOptionMouseEnter2(event2) { + if (this.focusOnHover) { + if (this.dirty || !this.dirty && isNotEmpty(this.d_value)) { + this.onOptionChange(_objectSpread$1$2(_objectSpread$1$2({}, event2), {}, { + type: "hover" + })); + } else if (!this.dirty && event2.processedOption.level === 0) { + this.onOptionClick(_objectSpread$1$2(_objectSpread$1$2({}, event2), {}, { + type: "hover" + })); + } + } + }, "onOptionMouseEnter"), + onOptionMouseMove: /* @__PURE__ */ __name(function onOptionMouseMove2(event2) { + if (this.focused && this.focusOnHover) { + this.changeFocusedOptionIndex(event2, event2.processedOption.index); + } + }, "onOptionMouseMove"), + onOptionSelect: /* @__PURE__ */ __name(function onOptionSelect(event2, processedOption) { + var isHide = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true; + var value2 = this.getOptionValue(processedOption === null || processedOption === void 0 ? void 0 : processedOption.option); + this.activeOptionPath.forEach(function(p) { + return p.selected = true; + }); + this.updateModel(event2, value2); + isHide && this.hide(true); + }, "onOptionSelect"), + onOptionGroupSelect: /* @__PURE__ */ __name(function onOptionGroupSelect(event2, processedOption) { + this.dirty = true; + this.$emit("group-change", { + originalEvent: event2, + value: processedOption.option + }); + }, "onOptionGroupSelect"), + onContainerClick: /* @__PURE__ */ __name(function onContainerClick(event2) { + if (this.disabled || this.loading) { + return; + } + if (event2.target.getAttribute("data-pc-section") === "clearicon" || event2.target.closest('[data-pc-section="clearicon"]')) { + return; + } else if (!this.overlay || !this.overlay.contains(event2.target)) { + this.overlayVisible ? this.hide() : this.show(); + focus(this.$refs.focusInput); + } + this.clicked = true; + this.$emit("click", event2); + }, "onContainerClick"), + onClearClick: /* @__PURE__ */ __name(function onClearClick(event2) { + this.updateModel(event2, null); + }, "onClearClick"), + onOverlayClick: /* @__PURE__ */ __name(function onOverlayClick2(event2) { + OverlayEventBus.emit("overlay-click", { + originalEvent: event2, + target: this.$el + }); + }, "onOverlayClick"), + onOverlayKeyDown: /* @__PURE__ */ __name(function onOverlayKeyDown2(event2) { + switch (event2.code) { + case "Escape": + this.onEscapeKey(event2); + break; + } + }, "onOverlayKeyDown"), + onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey2(event2) { + if (!this.overlayVisible) { + this.show(); + } else { + var optionIndex = this.focusedOptionInfo.index !== -1 ? this.findNextOptionIndex(this.focusedOptionInfo.index) : this.clicked ? this.findFirstOptionIndex() : this.findFirstFocusedOptionIndex(); + this.changeFocusedOptionIndex(event2, optionIndex, true); + } + event2.preventDefault(); + }, "onArrowDownKey"), + onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey2(event2) { + if (event2.altKey) { + if (this.focusedOptionInfo.index !== -1) { + var processedOption = this.visibleOptions[this.focusedOptionInfo.index]; + var grouped = this.isProccessedOptionGroup(processedOption); + !grouped && this.onOptionChange({ + originalEvent: event2, + processedOption + }); + } + this.overlayVisible && this.hide(); + event2.preventDefault(); + } else { + var optionIndex = this.focusedOptionInfo.index !== -1 ? this.findPrevOptionIndex(this.focusedOptionInfo.index) : this.clicked ? this.findLastOptionIndex() : this.findLastFocusedOptionIndex(); + this.changeFocusedOptionIndex(event2, optionIndex, true); + !this.overlayVisible && this.show(); + event2.preventDefault(); + } + }, "onArrowUpKey"), + onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey(event2) { + var _this2 = this; + if (this.overlayVisible) { + var processedOption = this.visibleOptions[this.focusedOptionInfo.index]; + var parentOption = this.activeOptionPath.find(function(p) { + return p.key === (processedOption === null || processedOption === void 0 ? void 0 : processedOption.parentKey); + }); + var matched = this.focusedOptionInfo.parentKey === "" || parentOption && parentOption.key === this.focusedOptionInfo.parentKey; + var root35 = isEmpty(processedOption === null || processedOption === void 0 ? void 0 : processedOption.parent); + if (matched) { + this.activeOptionPath = this.activeOptionPath.filter(function(p) { + return p.parentKey !== _this2.focusedOptionInfo.parentKey; + }); + } + if (!root35) { + this.focusedOptionInfo = { + index: -1, + parentKey: parentOption ? parentOption.parentKey : "" + }; + this.searchValue = ""; + this.onArrowDownKey(event2); + } + event2.preventDefault(); + } + }, "onArrowLeftKey"), + onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey(event2) { + if (this.overlayVisible) { + var processedOption = this.visibleOptions[this.focusedOptionInfo.index]; + var grouped = this.isProccessedOptionGroup(processedOption); + if (grouped) { + var matched = this.activeOptionPath.some(function(p) { + return (processedOption === null || processedOption === void 0 ? void 0 : processedOption.key) === p.key; + }); + if (matched) { + this.focusedOptionInfo = { + index: -1, + parentKey: processedOption === null || processedOption === void 0 ? void 0 : processedOption.key + }; + this.searchValue = ""; + this.onArrowDownKey(event2); + } else { + this.onOptionChange({ + originalEvent: event2, + processedOption + }); + } + } + event2.preventDefault(); + } + }, "onArrowRightKey"), + onHomeKey: /* @__PURE__ */ __name(function onHomeKey2(event2) { + this.changeFocusedOptionIndex(event2, this.findFirstOptionIndex()); + !this.overlayVisible && this.show(); + event2.preventDefault(); + }, "onHomeKey"), + onEndKey: /* @__PURE__ */ __name(function onEndKey2(event2) { + this.changeFocusedOptionIndex(event2, this.findLastOptionIndex()); + !this.overlayVisible && this.show(); + event2.preventDefault(); + }, "onEndKey"), + onEnterKey: /* @__PURE__ */ __name(function onEnterKey2(event2) { + if (!this.overlayVisible) { + this.focusedOptionInfo.index !== -1; + this.onArrowDownKey(event2); + } else { + if (this.focusedOptionInfo.index !== -1) { + var processedOption = this.visibleOptions[this.focusedOptionInfo.index]; + var grouped = this.isProccessedOptionGroup(processedOption); + this.onOptionClick({ + originalEvent: event2, + processedOption, + preventSelection: false + }); + !grouped && this.hide(); + } + } + event2.preventDefault(); + }, "onEnterKey"), + onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey(event2) { + this.onEnterKey(event2); + }, "onSpaceKey"), + onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey(event2) { + this.overlayVisible && this.hide(true); + event2.preventDefault(); + }, "onEscapeKey"), + onTabKey: /* @__PURE__ */ __name(function onTabKey(event2) { + if (this.focusedOptionInfo.index !== -1) { + var processedOption = this.visibleOptions[this.focusedOptionInfo.index]; + var grouped = this.isProccessedOptionGroup(processedOption); + !grouped && this.onOptionChange({ + originalEvent: event2, + processedOption + }); + } + this.overlayVisible && this.hide(); + }, "onTabKey"), + onOverlayEnter: /* @__PURE__ */ __name(function onOverlayEnter2(el) { + ZIndex.set("overlay", el, this.$primevue.config.zIndex.overlay); + addStyle(el, { + position: "absolute", + top: "0", + left: "0" + }); + this.alignOverlay(); + this.scrollInView(); + }, "onOverlayEnter"), + onOverlayAfterEnter: /* @__PURE__ */ __name(function onOverlayAfterEnter() { + this.bindOutsideClickListener(); + this.bindScrollListener(); + this.bindResizeListener(); + this.$emit("show"); + }, "onOverlayAfterEnter"), + onOverlayLeave: /* @__PURE__ */ __name(function onOverlayLeave2() { + this.unbindOutsideClickListener(); + this.unbindScrollListener(); + this.unbindResizeListener(); + this.$emit("hide"); + this.overlay = null; + this.dirty = false; + }, "onOverlayLeave"), + onOverlayAfterLeave: /* @__PURE__ */ __name(function onOverlayAfterLeave2(el) { + ZIndex.clear(el); + }, "onOverlayAfterLeave"), + alignOverlay: /* @__PURE__ */ __name(function alignOverlay2() { + if (this.appendTo === "self") { + relativePosition(this.overlay, this.$el); + } else { + this.overlay.style.minWidth = getOuterWidth(this.$el) + "px"; + absolutePosition(this.overlay, this.$el); + } + }, "alignOverlay"), + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener3() { + var _this3 = this; + if (!this.outsideClickListener) { + this.outsideClickListener = function(event2) { + if (_this3.overlayVisible && _this3.overlay && !_this3.$el.contains(event2.target) && !_this3.overlay.contains(event2.target)) { + _this3.hide(); + } + }; + document.addEventListener("click", this.outsideClickListener); + } + }, "bindOutsideClickListener"), + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener3() { + if (this.outsideClickListener) { + document.removeEventListener("click", this.outsideClickListener); + this.outsideClickListener = null; + } + }, "unbindOutsideClickListener"), + bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener2() { + var _this4 = this; + if (!this.scrollHandler) { + this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, function() { + if (_this4.overlayVisible) { + _this4.hide(); + } + }); + } + this.scrollHandler.bindScrollListener(); + }, "bindScrollListener"), + unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener2() { + if (this.scrollHandler) { + this.scrollHandler.unbindScrollListener(); + } + }, "unbindScrollListener"), + bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener2() { + var _this5 = this; + if (!this.resizeListener) { + this.resizeListener = function() { + if (_this5.overlayVisible && !isTouchDevice()) { + _this5.hide(); + } + }; + 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 bindMatchMediaListener2() { + var _this6 = this; + if (!this.matchMediaListener) { + var query = matchMedia("(max-width: ".concat(this.breakpoint, ")")); + this.query = query; + this.queryMatches = query.matches; + this.matchMediaListener = function() { + _this6.queryMatches = query.matches; + _this6.mobileActive = false; + }; + this.query.addEventListener("change", this.matchMediaListener); + } + }, "bindMatchMediaListener"), + unbindMatchMediaListener: /* @__PURE__ */ __name(function unbindMatchMediaListener2() { + if (this.matchMediaListener) { + this.query.removeEventListener("change", this.matchMediaListener); + this.matchMediaListener = null; + } + }, "unbindMatchMediaListener"), + isOptionMatched: /* @__PURE__ */ __name(function isOptionMatched(processedOption) { + var _this$getProccessedOp; + return this.isValidOption(processedOption) && ((_this$getProccessedOp = this.getProccessedOptionLabel(processedOption)) === null || _this$getProccessedOp === void 0 ? void 0 : _this$getProccessedOp.toLocaleLowerCase(this.searchLocale).startsWith(this.searchValue.toLocaleLowerCase(this.searchLocale))); + }, "isOptionMatched"), + isValidOption: /* @__PURE__ */ __name(function isValidOption(processedOption) { + return isNotEmpty(processedOption) && !this.isOptionDisabled(processedOption.option); + }, "isValidOption"), + isValidSelectedOption: /* @__PURE__ */ __name(function isValidSelectedOption(processedOption) { + return this.isValidOption(processedOption) && this.isSelected(processedOption); + }, "isValidSelectedOption"), + isSelected: /* @__PURE__ */ __name(function isSelected2(processedOption) { + return this.activeOptionPath.some(function(p) { + return p.key === processedOption.key; + }); + }, "isSelected"), + findFirstOptionIndex: /* @__PURE__ */ __name(function findFirstOptionIndex() { + var _this7 = this; + return this.visibleOptions.findIndex(function(processedOption) { + return _this7.isValidOption(processedOption); + }); + }, "findFirstOptionIndex"), + findLastOptionIndex: /* @__PURE__ */ __name(function findLastOptionIndex() { + var _this8 = this; + return findLastIndex(this.visibleOptions, function(processedOption) { + return _this8.isValidOption(processedOption); + }); + }, "findLastOptionIndex"), + findNextOptionIndex: /* @__PURE__ */ __name(function findNextOptionIndex(index) { + var _this9 = this; + var matchedOptionIndex = index < this.visibleOptions.length - 1 ? this.visibleOptions.slice(index + 1).findIndex(function(processedOption) { + return _this9.isValidOption(processedOption); + }) : -1; + return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index; + }, "findNextOptionIndex"), + findPrevOptionIndex: /* @__PURE__ */ __name(function findPrevOptionIndex(index) { + var _this10 = this; + var matchedOptionIndex = index > 0 ? findLastIndex(this.visibleOptions.slice(0, index), function(processedOption) { + return _this10.isValidOption(processedOption); + }) : -1; + return matchedOptionIndex > -1 ? matchedOptionIndex : index; + }, "findPrevOptionIndex"), + findSelectedOptionIndex: /* @__PURE__ */ __name(function findSelectedOptionIndex() { + var _this11 = this; + return this.visibleOptions.findIndex(function(processedOption) { + return _this11.isValidSelectedOption(processedOption); + }); + }, "findSelectedOptionIndex"), + findFirstFocusedOptionIndex: /* @__PURE__ */ __name(function findFirstFocusedOptionIndex() { + var selectedIndex = this.findSelectedOptionIndex(); + return selectedIndex < 0 ? this.findFirstOptionIndex() : selectedIndex; + }, "findFirstFocusedOptionIndex"), + findLastFocusedOptionIndex: /* @__PURE__ */ __name(function findLastFocusedOptionIndex() { + var selectedIndex = this.findSelectedOptionIndex(); + return selectedIndex < 0 ? this.findLastOptionIndex() : selectedIndex; + }, "findLastFocusedOptionIndex"), + findOptionPathByValue: /* @__PURE__ */ __name(function findOptionPathByValue(value2, processedOptions2) { + var level = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; + processedOptions2 = processedOptions2 || level === 0 && this.processedOptions; + if (!processedOptions2) return null; + if (isEmpty(value2)) return []; + for (var i = 0; i < processedOptions2.length; i++) { + var processedOption = processedOptions2[i]; + if (equals(value2, this.getOptionValue(processedOption.option), this.equalityKey)) { + return [processedOption]; + } + var matchedOptions = this.findOptionPathByValue(value2, processedOption.children, level + 1); + if (matchedOptions) { + matchedOptions.unshift(processedOption); + return matchedOptions; + } + } + }, "findOptionPathByValue"), + searchOptions: /* @__PURE__ */ __name(function searchOptions(event2, _char) { + var _this12 = this; + this.searchValue = (this.searchValue || "") + _char; + var optionIndex = -1; + var matched = false; + if (isNotEmpty(this.searchValue)) { + if (this.focusedOptionInfo.index !== -1) { + optionIndex = this.visibleOptions.slice(this.focusedOptionInfo.index).findIndex(function(processedOption) { + return _this12.isOptionMatched(processedOption); + }); + optionIndex = optionIndex === -1 ? this.visibleOptions.slice(0, this.focusedOptionInfo.index).findIndex(function(processedOption) { + return _this12.isOptionMatched(processedOption); + }) : optionIndex + this.focusedOptionInfo.index; + } else { + optionIndex = this.visibleOptions.findIndex(function(processedOption) { + return _this12.isOptionMatched(processedOption); + }); + } + if (optionIndex !== -1) { + matched = true; + } + if (optionIndex === -1 && this.focusedOptionInfo.index === -1) { + optionIndex = this.findFirstFocusedOptionIndex(); + } + if (optionIndex !== -1) { + this.changeFocusedOptionIndex(event2, optionIndex); + } + } + if (this.searchTimeout) { + clearTimeout(this.searchTimeout); + } + this.searchTimeout = setTimeout(function() { + _this12.searchValue = ""; + _this12.searchTimeout = null; + }, 500); + return matched; + }, "searchOptions"), + changeFocusedOptionIndex: /* @__PURE__ */ __name(function changeFocusedOptionIndex(event2, index, preventSelection) { + if (this.focusedOptionInfo.index !== index) { + this.focusedOptionInfo.index = index; + this.scrollInView(); + if (this.focusOnHover) { + this.onOptionClick({ + originalEvent: event2, + processedOption: this.visibleOptions[index], + isHide: false, + preventSelection + }); + } + if (this.selectOnFocus) { + this.onOptionChange({ + originalEvent: event2, + processedOption: this.visibleOptions[index], + isHide: false + }); + } + } + }, "changeFocusedOptionIndex"), + scrollInView: /* @__PURE__ */ __name(function scrollInView2() { + var _this13 = this; + var index = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : -1; + this.$nextTick(function() { + var id4 = index !== -1 ? "".concat(_this13.id, "_").concat(index) : _this13.focusedOptionId; + var element = findSingle(_this13.list, 'li[id="'.concat(id4, '"]')); + if (element) { + element.scrollIntoView && element.scrollIntoView({ + block: "nearest", + inline: "start" + }); + } + }); + }, "scrollInView"), + autoUpdateModel: /* @__PURE__ */ __name(function autoUpdateModel() { + if (this.selectOnFocus && this.autoOptionFocus && !this.$filled) { + this.focusedOptionInfo.index = this.findFirstFocusedOptionIndex(); + this.onOptionChange({ + processedOption: this.visibleOptions[this.focusedOptionInfo.index], + isHide: false + }); + !this.overlayVisible && (this.focusedOptionInfo = { + index: -1, + level: 0, + parentKey: "" + }); + } + }, "autoUpdateModel"), + updateModel: /* @__PURE__ */ __name(function updateModel2(event2, value2) { + this.writeValue(value2, event2); + this.$emit("change", { + originalEvent: event2, + value: value2 + }); + }, "updateModel"), + createProcessedOptions: /* @__PURE__ */ __name(function createProcessedOptions(options4) { + 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 processedOptions2 = []; + options4 && options4.forEach(function(option4, index) { + var key = (parentKey !== "" ? parentKey + "_" : "") + index; + var newOption = { + option: option4, + index, + level, + key, + parent, + parentKey + }; + newOption["children"] = _this14.createProcessedOptions(_this14.getOptionGroupChildren(option4, level), level + 1, newOption, key); + processedOptions2.push(newOption); + }); + return processedOptions2; + }, "createProcessedOptions"), + overlayRef: /* @__PURE__ */ __name(function overlayRef2(el) { + this.overlay = el; + }, "overlayRef") + }, + computed: { + // @deprecated use $filled instead. + hasSelectedOption: /* @__PURE__ */ __name(function hasSelectedOption() { + return this.$filled; + }, "hasSelectedOption"), + label: /* @__PURE__ */ __name(function label3() { + var label12 = this.placeholder || "p-emptylabel"; + if (this.$filled) { + var activeOptionPath = this.findOptionPathByValue(this.d_value); + var processedOption = isNotEmpty(activeOptionPath) ? activeOptionPath[activeOptionPath.length - 1] : null; + return processedOption ? this.getOptionLabel(processedOption.option) : label12; + } + return label12; + }, "label"), + processedOptions: /* @__PURE__ */ __name(function processedOptions() { + return this.createProcessedOptions(this.options || []); + }, "processedOptions"), + visibleOptions: /* @__PURE__ */ __name(function visibleOptions() { + var _this15 = this; + var processedOption = this.activeOptionPath.find(function(p) { + return p.key === _this15.focusedOptionInfo.parentKey; + }); + return processedOption ? processedOption.children : this.processedOptions; + }, "visibleOptions"), + equalityKey: /* @__PURE__ */ __name(function equalityKey() { + return this.optionValue ? null : this.dataKey; + }, "equalityKey"), + searchResultMessageText: /* @__PURE__ */ __name(function searchResultMessageText() { + return isNotEmpty(this.visibleOptions) ? this.searchMessageText.replaceAll("{0}", this.visibleOptions.length) : this.emptySearchMessageText; + }, "searchResultMessageText"), + searchMessageText: /* @__PURE__ */ __name(function searchMessageText() { + return this.searchMessage || this.$primevue.config.locale.searchMessage || ""; + }, "searchMessageText"), + emptySearchMessageText: /* @__PURE__ */ __name(function emptySearchMessageText() { + return this.emptySearchMessage || this.$primevue.config.locale.emptySearchMessage || ""; + }, "emptySearchMessageText"), + emptyMessageText: /* @__PURE__ */ __name(function emptyMessageText() { + return this.emptyMessage || this.$primevue.config.locale.emptyMessage || ""; + }, "emptyMessageText"), + selectionMessageText: /* @__PURE__ */ __name(function selectionMessageText() { + return this.selectionMessage || this.$primevue.config.locale.selectionMessage || ""; + }, "selectionMessageText"), + emptySelectionMessageText: /* @__PURE__ */ __name(function emptySelectionMessageText() { + return this.emptySelectionMessage || this.$primevue.config.locale.emptySelectionMessage || ""; + }, "emptySelectionMessageText"), + selectedMessageText: /* @__PURE__ */ __name(function selectedMessageText() { + return this.$filled ? this.selectionMessageText.replaceAll("{0}", "1") : this.emptySelectionMessageText; + }, "selectedMessageText"), + focusedOptionId: /* @__PURE__ */ __name(function focusedOptionId() { + return this.focusedOptionInfo.index !== -1 ? "".concat(this.id).concat(isNotEmpty(this.focusedOptionInfo.parentKey) ? "_" + this.focusedOptionInfo.parentKey : "", "_").concat(this.focusedOptionInfo.index) : null; + }, "focusedOptionId"), + isClearIconVisible: /* @__PURE__ */ __name(function isClearIconVisible() { + return this.showClear && this.d_value != null && isNotEmpty(this.options); + }, "isClearIconVisible") + }, + components: { + CascadeSelectSub: script$1$E, + Portal: script$1f, + ChevronDownIcon: script$1k, + SpinnerIcon: script$1r, + AngleRightIcon: script$1q, + TimesIcon: script$1g + } +}; +function _typeof$k(o) { + "@babel/helpers - typeof"; + return _typeof$k = "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$k(o); +} +__name(_typeof$k, "_typeof$k"); +function ownKeys$i(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$i, "ownKeys$i"); +function _objectSpread$i(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$i(Object(t2), true).forEach(function(r2) { + _defineProperty$j(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$i(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$i, "_objectSpread$i"); +function _defineProperty$j(e, r, t2) { + return (r = _toPropertyKey$j(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$j, "_defineProperty$j"); +function _toPropertyKey$j(t2) { + var i = _toPrimitive$j(t2, "string"); + return "symbol" == _typeof$k(i) ? i : i + ""; +} +__name(_toPropertyKey$j, "_toPropertyKey$j"); +function _toPrimitive$j(t2, r) { + if ("object" != _typeof$k(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$k(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$j, "_toPrimitive$j"); +var _hoisted_1$r = ["id", "disabled", "placeholder", "tabindex", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-invalid"]; +function render$U(_ctx, _cache, $props, $setup, $data, $options) { + var _component_SpinnerIcon = resolveComponent("SpinnerIcon"); + var _component_CascadeSelectSub = resolveComponent("CascadeSelectSub"); + var _component_Portal = resolveComponent("Portal"); + return openBlock(), createElementBlock("div", mergeProps({ + ref: "container", + "class": _ctx.cx("root"), + style: _ctx.sx("root"), + onClick: _cache[5] || (_cache[5] = function($event) { + return $options.onContainerClick($event); + }) + }, _ctx.ptmi("root")), [createBaseVNode("div", mergeProps({ + "class": "p-hidden-accessible" + }, _ctx.ptm("hiddenInputContainer"), { + "data-p-hidden-accessible": true + }), [createBaseVNode("input", mergeProps({ + ref: "focusInput", + id: _ctx.inputId, + type: "text", + "class": _ctx.inputClass, + style: _ctx.inputStyle, + readonly: "", + disabled: _ctx.disabled, + placeholder: _ctx.placeholder, + tabindex: !_ctx.disabled ? _ctx.tabindex : -1, + role: "combobox", + "aria-label": _ctx.ariaLabel, + "aria-labelledby": _ctx.ariaLabelledby, + "aria-haspopup": "tree", + "aria-expanded": $data.overlayVisible, + "aria-controls": $data.id + "_tree", + "aria-activedescendant": $data.focused ? $options.focusedOptionId : void 0, + "aria-invalid": _ctx.invalid || void 0, + onFocus: _cache[0] || (_cache[0] = function() { + return $options.onFocus && $options.onFocus.apply($options, arguments); + }), + onBlur: _cache[1] || (_cache[1] = function() { + return $options.onBlur && $options.onBlur.apply($options, arguments); + }), + onKeydown: _cache[2] || (_cache[2] = function() { + return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); + }) + }, _objectSpread$i(_objectSpread$i({}, _ctx.inputProps), _ctx.ptm("hiddenInput"))), null, 16, _hoisted_1$r)], 16), createBaseVNode("span", mergeProps({ + "class": _ctx.cx("label") + }, _ctx.ptm("label")), [renderSlot(_ctx.$slots, "value", { + value: _ctx.d_value, + placeholder: _ctx.placeholder + }, function() { + return [createTextVNode(toDisplayString($options.label), 1)]; + })], 16), $options.isClearIconVisible ? renderSlot(_ctx.$slots, "clearicon", { + key: 0, + "class": normalizeClass(_ctx.cx("clearIcon")), + clearCallback: $options.onClearClick + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon ? "i" : "TimesIcon"), mergeProps({ + ref: "clearIcon", + "class": [_ctx.cx("clearIcon"), _ctx.clearIcon], + onClick: $options.onClearClick + }, _ctx.ptm("clearIcon"), { + "data-pc-section": "clearicon" + }), null, 16, ["class", "onClick"]))]; + }) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("dropdown"), + role: "button", + tabindex: "-1" + }, _ctx.ptm("dropdown")), [_ctx.loading ? renderSlot(_ctx.$slots, "loadingicon", { + key: 0, + "class": normalizeClass(_ctx.cx("loadingIcon")) + }, function() { + return [_ctx.loadingIcon ? (openBlock(), createElementBlock("span", mergeProps({ + key: 0, + "class": [_ctx.cx("loadingIcon"), "pi-spin", _ctx.loadingIcon], + "aria-hidden": "true" + }, _ctx.ptm("loadingIcon")), null, 16)) : (openBlock(), createBlock(_component_SpinnerIcon, mergeProps({ + key: 1, + "class": _ctx.cx("loadingIcon"), + spin: "", + "aria-hidden": "true" + }, _ctx.ptm("loadingIcon")), null, 16, ["class"]))]; + }) : renderSlot(_ctx.$slots, "dropdownicon", { + key: 1, + "class": normalizeClass(_ctx.cx("dropdownIcon")) + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.dropdownIcon ? "span" : "ChevronDownIcon"), mergeProps({ + "class": [_ctx.cx("dropdownIcon"), _ctx.dropdownIcon], + "aria-hidden": "true" + }, _ctx.ptm("dropdownIcon")), null, 16, ["class"]))]; + })], 16), createBaseVNode("span", mergeProps({ + role: "status", + "aria-live": "polite", + "class": "p-hidden-accessible" + }, _ctx.ptm("hiddenSearchResult"), { + "data-p-hidden-accessible": true + }), toDisplayString($options.searchResultMessageText), 17), createVNode(_component_Portal, { + appendTo: _ctx.appendTo + }, { + "default": withCtx(function() { + return [createVNode(Transition, mergeProps({ + name: "p-connected-overlay", + onEnter: $options.onOverlayEnter, + onAfterEnter: $options.onOverlayAfterEnter, + onLeave: $options.onOverlayLeave, + onAfterLeave: $options.onOverlayAfterLeave + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [$data.overlayVisible ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: $options.overlayRef, + "class": [_ctx.cx("overlay"), _ctx.panelClass, _ctx.overlayClass], + style: [_ctx.panelStyle, _ctx.overlayStyle], + onClick: _cache[3] || (_cache[3] = function() { + return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); + }), + onKeydown: _cache[4] || (_cache[4] = function() { + return $options.onOverlayKeyDown && $options.onOverlayKeyDown.apply($options, arguments); + }) + }, _objectSpread$i(_objectSpread$i(_objectSpread$i({}, _ctx.panelProps), _ctx.overlayProps), _ctx.ptm("overlay"))), [renderSlot(_ctx.$slots, "header", { + value: _ctx.d_value, + options: _ctx.options + }), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("listContainer") + }, _ctx.ptm("listContainer")), [createVNode(_component_CascadeSelectSub, { + id: $data.id + "_tree", + role: "tree", + "aria-orientation": "horizontal", + selectId: $data.id, + focusedOptionId: $data.focused ? $options.focusedOptionId : void 0, + options: $options.processedOptions, + activeOptionPath: $data.activeOptionPath, + level: 0, + templates: _ctx.$slots, + optionLabel: _ctx.optionLabel, + optionValue: _ctx.optionValue, + optionDisabled: _ctx.optionDisabled, + optionGroupIcon: _ctx.optionGroupIcon, + optionGroupLabel: _ctx.optionGroupLabel, + optionGroupChildren: _ctx.optionGroupChildren, + value: _ctx.d_value, + onOptionChange: $options.onOptionClick, + onOptionFocusChange: $options.onOptionMouseMove, + onOptionFocusEnterChange: $options.onOptionMouseEnter, + pt: _ctx.pt, + unstyled: _ctx.unstyled + }, null, 8, ["id", "selectId", "focusedOptionId", "options", "activeOptionPath", "templates", "optionLabel", "optionValue", "optionDisabled", "optionGroupIcon", "optionGroupLabel", "optionGroupChildren", "value", "onOptionChange", "onOptionFocusChange", "onOptionFocusEnterChange", "pt", "unstyled"])], 16), createBaseVNode("span", mergeProps({ + role: "status", + "aria-live": "polite", + "class": "p-hidden-accessible" + }, _ctx.ptm("hiddenSelectedMessage"), { + "data-p-hidden-accessible": true + }), toDisplayString($options.selectedMessageText), 17), renderSlot(_ctx.$slots, "footer", { + value: _ctx.d_value, + options: _ctx.options + })], 16)) : createCommentVNode("", true)]; + }), + _: 3 + }, 16, ["onEnter", "onAfterEnter", "onLeave", "onAfterLeave"])]; + }), + _: 3 + }, 8, ["appendTo"])], 16); +} +__name(render$U, "render$U"); +script$10.render = render$U; +var theme$x = /* @__PURE__ */ __name(function theme7(_ref) { + _ref.dt; + return "\n.p-checkbox-group {\n display: inline-flex;\n}\n"; +}, "theme"); +var classes$B = { + root: "p-checkbox-group p-component" +}; +var CheckboxGroupStyle = BaseStyle.extend({ + name: "checkboxgroup", + theme: theme$x, + classes: classes$B +}); +var script$1$D = { + name: "BaseCheckboxGroup", + "extends": script$1s, + style: CheckboxGroupStyle, + provide: /* @__PURE__ */ __name(function provide12() { + return { + $pcCheckboxGroup: this, + $parentInstance: this + }; + }, "provide") +}; +var script$$ = { + name: "CheckboxGroup", + "extends": script$1$D, + inheritAttrs: false, + data: /* @__PURE__ */ __name(function data5() { + return { + groupName: this.name + }; + }, "data"), + watch: { + name: /* @__PURE__ */ __name(function name(newValue) { + this.groupName = newValue || uuid("checkbox-group-"); + }, "name") + }, + mounted: /* @__PURE__ */ __name(function mounted8() { + this.groupName = this.groupName || uuid("checkbox-group-"); + }, "mounted") +}; +function render$T(_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$T, "render$T"); +script$$.render = render$T; +var theme$w = /* @__PURE__ */ __name(function theme8(_ref) { + var dt = _ref.dt; + return "\n.p-inputchips {\n display: inline-flex;\n}\n\n.p-inputchips-input {\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("inputchips.padding.y"), " / 2) ").concat(dt("inputchips.padding.x"), ";\n gap: calc(").concat(dt("inputchips.padding.y"), " / 2);\n color: ").concat(dt("inputchips.color"), ";\n background: ").concat(dt("inputchips.background"), ";\n border: 1px solid ").concat(dt("inputchips.border.color"), ";\n border-radius: ").concat(dt("inputchips.border.radius"), ";\n width: 100%;\n transition: background ").concat(dt("inputchips.transition.duration"), ", color ").concat(dt("inputchips.transition.duration"), ", border-color ").concat(dt("inputchips.transition.duration"), ", outline-color ").concat(dt("inputchips.transition.duration"), ", box-shadow ").concat(dt("inputchips.transition.duration"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("inputchips.shadow"), ";\n}\n\n.p-inputchips:not(.p-disabled):hover .p-inputchips-input {\n border-color: ").concat(dt("inputchips.hover.border.color"), ";\n}\n\n.p-inputchips:not(.p-disabled).p-focus .p-inputchips-input {\n border-color: ").concat(dt("inputchips.focus.border.color"), ";\n box-shadow: ").concat(dt("inputchips.focus.ring.shadow"), ";\n outline: ").concat(dt("inputchips.focus.ring.width"), " ").concat(dt("inputchips.focus.ring.style"), " ").concat(dt("inputchips.focus.ring.color"), ";\n outline-offset: ").concat(dt("inputchips.focus.ring.offset"), ";\n}\n\n.p-inputchips.p-invalid .p-inputchips-input {\n border-color: ").concat(dt("inputchips.invalid.border.color"), ";\n}\n\n.p-variant-filled.p-inputchips-input {\n background: ").concat(dt("inputchips.filled.background"), ";\n}\n\n.p-inputchips:not(.p-disabled).p-focus .p-variant-filled.p-inputchips-input {\n background: ").concat(dt("inputchips.filled.focus.background"), ";\n}\n\n.p-inputchips.p-disabled .p-inputchips-input {\n opacity: 1;\n background: ").concat(dt("inputchips.disabled.background"), ";\n color: ").concat(dt("inputchips.disabled.color"), ";\n}\n\n.p-inputchips-chip.p-chip {\n padding-top: calc(").concat(dt("inputchips.padding.y"), " / 2);\n padding-bottom: calc(").concat(dt("inputchips.padding.y"), " / 2);\n border-radius: ").concat(dt("inputchips.chip.border.radius"), ";\n transition: background ").concat(dt("inputchips.transition.duration"), ", color ").concat(dt("inputchips.transition.duration"), ";\n}\n\n.p-inputchips-chip-item.p-focus .p-inputchips-chip {\n background: ").concat(dt("inputchips.chip.focus.background"), ";\n color: ").concat(dt("inputchips.chip.focus.color"), ";\n}\n\n.p-inputchips-input:has(.p-inputchips-chip) {\n padding-left: calc(").concat(dt("inputchips.padding.y"), " / 2);\n padding-right: calc(").concat(dt("inputchips.padding.y"), " / 2);\n}\n\n.p-inputchips-input-item {\n flex: 1 1 auto;\n display: inline-flex;\n padding-top: calc(").concat(dt("inputchips.padding.y"), " / 2);\n padding-bottom: calc(").concat(dt("inputchips.padding.y"), " / 2);\n}\n\n.p-inputchips-input-item 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-inputchips-input-item input::placeholder {\n color: ").concat(dt("inputchips.placeholder.color"), ";\n}\n"); +}, "theme"); +var classes$A = { + root: /* @__PURE__ */ __name(function root8(_ref2) { + var instance = _ref2.instance, props = _ref2.props; + return ["p-inputchips p-component p-inputwrapper", { + "p-disabled": props.disabled, + "p-invalid": props.invalid, + "p-focus": instance.focused, + "p-inputwrapper-filled": props.modelValue && props.modelValue.length || instance.inputValue && instance.inputValue.length, + "p-inputwrapper-focus": instance.focused + }]; + }, "root"), + input: /* @__PURE__ */ __name(function input(_ref3) { + var props = _ref3.props, instance = _ref3.instance; + return ["p-inputchips-input", { + "p-variant-filled": props.variant ? props.variant === "filled" : instance.$primevue.config.inputStyle === "filled" || instance.$primevue.config.inputVariant === "filled" + }]; + }, "input"), + chipItem: /* @__PURE__ */ __name(function chipItem(_ref4) { + var state = _ref4.state, index = _ref4.index; + return ["p-inputchips-chip-item", { + "p-focus": state.focusedIndex === index + }]; + }, "chipItem"), + pcChip: "p-inputchips-chip", + chipIcon: "p-inputchips-chip-icon", + inputItem: "p-inputchips-input-item" +}; +var InputChipsStyle = BaseStyle.extend({ + name: "inputchips", + theme: theme$w, + classes: classes$A +}); +var script$1$C = { + name: "BaseInputChips", + "extends": script$1d, + props: { + modelValue: { + type: Array, + "default": null + }, + max: { + type: Number, + "default": null + }, + separator: { + type: [String, Object], + "default": null + }, + addOnBlur: { + type: Boolean, + "default": null + }, + allowDuplicate: { + type: Boolean, + "default": true + }, + placeholder: { + type: String, + "default": null + }, + variant: { + type: String, + "default": null + }, + invalid: { + type: Boolean, + "default": false + }, + disabled: { + type: Boolean, + "default": false + }, + inputId: { + type: String, + "default": null + }, + inputClass: { + type: [String, Object], + "default": null + }, + inputStyle: { + type: Object, + "default": null + }, + inputProps: { + type: null, + "default": null + }, + removeTokenIcon: { + type: String, + "default": void 0 + }, + chipIcon: { + type: String, + "default": void 0 + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + } + }, + style: InputChipsStyle, + provide: /* @__PURE__ */ __name(function provide13() { + return { + $pcInputChips: this, + $parentInstance: this + }; + }, "provide") +}; +function _toConsumableArray$c(r) { + return _arrayWithoutHoles$c(r) || _iterableToArray$c(r) || _unsupportedIterableToArray$d(r) || _nonIterableSpread$c(); +} +__name(_toConsumableArray$c, "_toConsumableArray$c"); +function _nonIterableSpread$c() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableSpread$c, "_nonIterableSpread$c"); +function _unsupportedIterableToArray$d(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$d(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$d(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$d, "_unsupportedIterableToArray$d"); +function _iterableToArray$c(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray$c, "_iterableToArray$c"); +function _arrayWithoutHoles$c(r) { + if (Array.isArray(r)) return _arrayLikeToArray$d(r); +} +__name(_arrayWithoutHoles$c, "_arrayWithoutHoles$c"); +function _arrayLikeToArray$d(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; +} +__name(_arrayLikeToArray$d, "_arrayLikeToArray$d"); +var script$_ = { + name: "InputChips", + "extends": script$1$C, + inheritAttrs: false, + emits: ["update:modelValue", "add", "remove", "focus", "blur"], + data: /* @__PURE__ */ __name(function data6() { + return { + id: this.$attrs.id, + inputValue: null, + focused: false, + focusedIndex: null + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId3(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId") + }, + mounted: /* @__PURE__ */ __name(function mounted9() { + console.warn("Deprecated since v4. Use AutoComplete component instead with its typeahead property."); + this.id = this.id || UniqueComponentId(); + }, "mounted"), + methods: { + onWrapperClick: /* @__PURE__ */ __name(function onWrapperClick() { + this.$refs.input.focus(); + }, "onWrapperClick"), + onInput: /* @__PURE__ */ __name(function onInput2(event2) { + this.inputValue = event2.target.value; + this.focusedIndex = null; + }, "onInput"), + onFocus: /* @__PURE__ */ __name(function onFocus4(event2) { + this.focused = true; + this.focusedIndex = null; + this.$emit("focus", event2); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur3(event2) { + this.focused = false; + this.focusedIndex = null; + if (this.addOnBlur) { + this.addItem(event2, event2.target.value, false); + } + this.$emit("blur", event2); + }, "onBlur"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown3(event2) { + var inputValue = event2.target.value; + switch (event2.code) { + case "Backspace": + if (inputValue.length === 0 && this.modelValue && this.modelValue.length > 0) { + if (this.focusedIndex !== null) { + this.removeItem(event2, this.focusedIndex); + } else this.removeItem(event2, this.modelValue.length - 1); + } + break; + case "Enter": + case "NumpadEnter": + if (inputValue && inputValue.trim().length && !this.maxedOut) { + this.addItem(event2, inputValue, true); + } + break; + case "ArrowLeft": + if (inputValue.length === 0 && this.modelValue && this.modelValue.length > 0) { + this.$refs.container.focus(); + } + break; + case "ArrowRight": + event2.stopPropagation(); + break; + default: + if (this.separator) { + if (this.separator === event2.key || event2.key.match(this.separator)) { + this.addItem(event2, inputValue, true); + } + } + break; + } + }, "onKeyDown"), + onPaste: /* @__PURE__ */ __name(function onPaste(event2) { + var _this = this; + if (this.separator) { + var separator = this.separator.replace("\\n", "\n").replace("\\r", "\r").replace("\\t", " "); + var pastedData = (event2.clipboardData || window["clipboardData"]).getData("Text"); + if (pastedData) { + var value2 = this.modelValue || []; + var pastedValues = pastedData.split(separator); + pastedValues = pastedValues.filter(function(val) { + return _this.allowDuplicate || value2.indexOf(val) === -1; + }); + value2 = [].concat(_toConsumableArray$c(value2), _toConsumableArray$c(pastedValues)); + this.updateModel(event2, value2, true); + } + } + }, "onPaste"), + onContainerFocus: /* @__PURE__ */ __name(function onContainerFocus() { + this.focused = true; + }, "onContainerFocus"), + onContainerBlur: /* @__PURE__ */ __name(function onContainerBlur() { + this.focusedIndex = -1; + this.focused = false; + }, "onContainerBlur"), + onContainerKeyDown: /* @__PURE__ */ __name(function onContainerKeyDown(event2) { + switch (event2.code) { + case "ArrowLeft": + this.onArrowLeftKeyOn(event2); + break; + case "ArrowRight": + this.onArrowRightKeyOn(event2); + break; + case "Backspace": + this.onBackspaceKeyOn(event2); + break; + } + }, "onContainerKeyDown"), + onArrowLeftKeyOn: /* @__PURE__ */ __name(function onArrowLeftKeyOn() { + if (this.inputValue.length === 0 && this.modelValue && this.modelValue.length > 0) { + this.focusedIndex = this.focusedIndex === null ? this.modelValue.length - 1 : this.focusedIndex - 1; + if (this.focusedIndex < 0) this.focusedIndex = 0; + } + }, "onArrowLeftKeyOn"), + onArrowRightKeyOn: /* @__PURE__ */ __name(function onArrowRightKeyOn() { + if (this.inputValue.length === 0 && this.modelValue && this.modelValue.length > 0) { + if (this.focusedIndex === this.modelValue.length - 1) { + this.focusedIndex = null; + this.$refs.input.focus(); + } else { + this.focusedIndex++; + } + } + }, "onArrowRightKeyOn"), + onBackspaceKeyOn: /* @__PURE__ */ __name(function onBackspaceKeyOn(event2) { + if (this.focusedIndex !== null) { + this.removeItem(event2, this.focusedIndex); + } + }, "onBackspaceKeyOn"), + updateModel: /* @__PURE__ */ __name(function updateModel3(event2, value2, preventDefault) { + var _this2 = this; + this.$emit("update:modelValue", value2); + this.$emit("add", { + originalEvent: event2, + value: value2 + }); + this.$refs.input.value = ""; + this.inputValue = ""; + setTimeout(function() { + _this2.maxedOut && (_this2.focused = false); + }, 0); + if (preventDefault) { + event2.preventDefault(); + } + }, "updateModel"), + addItem: /* @__PURE__ */ __name(function addItem(event2, item8, preventDefault) { + if (item8 && item8.trim().length) { + var value2 = this.modelValue ? _toConsumableArray$c(this.modelValue) : []; + if (this.allowDuplicate || value2.indexOf(item8) === -1) { + value2.push(item8); + this.updateModel(event2, value2, preventDefault); + } + } + }, "addItem"), + removeItem: /* @__PURE__ */ __name(function removeItem(event2, index) { + if (this.disabled) { + return; + } + var values = _toConsumableArray$c(this.modelValue); + var removedItem = values.splice(index, 1); + this.focusedIndex = null; + this.$refs.input.focus(); + this.$emit("update:modelValue", values); + this.$emit("remove", { + originalEvent: event2, + value: removedItem + }); + }, "removeItem") + }, + computed: { + maxedOut: /* @__PURE__ */ __name(function maxedOut() { + return this.max && this.modelValue && this.max === this.modelValue.length; + }, "maxedOut"), + focusedOptionId: /* @__PURE__ */ __name(function focusedOptionId2() { + return this.focusedIndex !== null ? "".concat(this.id, "_inputchips_item_").concat(this.focusedIndex) : null; + }, "focusedOptionId") + }, + components: { + Chip: script$1t + } +}; +function _typeof$j(o) { + "@babel/helpers - typeof"; + return _typeof$j = "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$j(o); +} +__name(_typeof$j, "_typeof$j"); +function ownKeys$h(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$h, "ownKeys$h"); +function _objectSpread$h(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$h(Object(t2), true).forEach(function(r2) { + _defineProperty$i(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$h(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$h, "_objectSpread$h"); +function _defineProperty$i(e, r, t2) { + return (r = _toPropertyKey$i(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$i, "_defineProperty$i"); +function _toPropertyKey$i(t2) { + var i = _toPrimitive$i(t2, "string"); + return "symbol" == _typeof$j(i) ? i : i + ""; +} +__name(_toPropertyKey$i, "_toPropertyKey$i"); +function _toPrimitive$i(t2, r) { + if ("object" != _typeof$j(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$j(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$i, "_toPrimitive$i"); +var _hoisted_1$q = ["aria-labelledby", "aria-label", "aria-activedescendant"]; +var _hoisted_2$j = ["id", "aria-label", "aria-setsize", "aria-posinset", "data-p-focused"]; +var _hoisted_3$g = ["id", "disabled", "placeholder", "aria-invalid"]; +function render$S(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Chip = resolveComponent("Chip"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [createBaseVNode("ul", mergeProps({ + ref: "container", + "class": _ctx.cx("input"), + tabindex: "-1", + role: "listbox", + "aria-orientation": "horizontal", + "aria-labelledby": _ctx.ariaLabelledby, + "aria-label": _ctx.ariaLabel, + "aria-activedescendant": $data.focused ? $options.focusedOptionId : void 0, + onClick: _cache[5] || (_cache[5] = function($event) { + return $options.onWrapperClick(); + }), + onFocus: _cache[6] || (_cache[6] = function() { + return $options.onContainerFocus && $options.onContainerFocus.apply($options, arguments); + }), + onBlur: _cache[7] || (_cache[7] = function() { + return $options.onContainerBlur && $options.onContainerBlur.apply($options, arguments); + }), + onKeydown: _cache[8] || (_cache[8] = function() { + return $options.onContainerKeyDown && $options.onContainerKeyDown.apply($options, arguments); + }) + }, _ctx.ptm("input")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.modelValue, function(val, i) { + return openBlock(), createElementBlock("li", mergeProps({ + key: "".concat(i, "_").concat(val), + id: $data.id + "_inputchips_item_" + i, + role: "option", + "class": _ctx.cx("chipItem", { + index: i + }), + "aria-label": val, + "aria-selected": true, + "aria-setsize": _ctx.modelValue.length, + "aria-posinset": i + 1, + ref_for: true + }, _ctx.ptm("chipItem"), { + "data-p-focused": $data.focusedIndex === i + }), [renderSlot(_ctx.$slots, "chip", { + "class": normalizeClass(_ctx.cx("pcChip")), + index: i, + value: val, + removeCallback: /* @__PURE__ */ __name(function removeCallback(event2) { + return _ctx.removeOption(event2, i); + }, "removeCallback") + }, function() { + return [createVNode(_component_Chip, { + "class": normalizeClass(_ctx.cx("pcChip")), + label: val, + removeIcon: _ctx.chipIcon || _ctx.removeTokenIcon, + removable: "", + unstyled: _ctx.unstyled, + onRemove: /* @__PURE__ */ __name(function onRemove($event) { + return $options.removeItem($event, i); + }, "onRemove"), + pt: _ctx.ptm("pcChip") + }, { + removeicon: withCtx(function() { + return [renderSlot(_ctx.$slots, _ctx.$slots.chipicon ? "chipicon" : "removetokenicon", { + "class": normalizeClass(_ctx.cx("chipIcon")), + index: i, + removeCallback: /* @__PURE__ */ __name(function removeCallback(event2) { + return $options.removeItem(event2, i); + }, "removeCallback") + })]; + }), + _: 2 + }, 1032, ["class", "label", "removeIcon", "unstyled", "onRemove", "pt"])]; + })], 16, _hoisted_2$j); + }), 128)), createBaseVNode("li", mergeProps({ + "class": _ctx.cx("inputItem"), + role: "option" + }, _ctx.ptm("inputItem")), [createBaseVNode("input", mergeProps({ + ref: "input", + id: _ctx.inputId, + type: "text", + "class": _ctx.inputClass, + style: _ctx.inputStyle, + disabled: _ctx.disabled || $options.maxedOut, + placeholder: _ctx.placeholder, + "aria-invalid": _ctx.invalid || void 0, + onFocus: _cache[0] || (_cache[0] = function($event) { + return $options.onFocus($event); + }), + onBlur: _cache[1] || (_cache[1] = function($event) { + return $options.onBlur($event); + }), + onInput: _cache[2] || (_cache[2] = function() { + return $options.onInput && $options.onInput.apply($options, arguments); + }), + onKeydown: _cache[3] || (_cache[3] = function($event) { + return $options.onKeyDown($event); + }), + onPaste: _cache[4] || (_cache[4] = function($event) { + return $options.onPaste($event); + }) + }, _objectSpread$h(_objectSpread$h({}, _ctx.inputProps), _ctx.ptm("inputItemField"))), null, 16, _hoisted_3$g)], 16)], 16, _hoisted_1$q)], 16); +} +__name(render$S, "render$S"); +script$_.render = render$S; +var script$Z = { + name: "Chips", + "extends": script$_, + mounted: /* @__PURE__ */ __name(function mounted10() { + console.warn("Deprecated since v4. Use InputChips component instead."); + }, "mounted") +}; +var ChipsStyle = BaseStyle.extend({ + name: "chips" +}); +var ColumnGroupStyle = BaseStyle.extend({ + name: "columngroup" +}); +var script$1$B = { + name: "BaseColumnGroup", + "extends": script$1d, + props: { + type: { + type: String, + "default": null + } + }, + style: ColumnGroupStyle, + provide: /* @__PURE__ */ __name(function provide14() { + return { + $pcColumnGroup: this, + $parentInstance: this + }; + }, "provide") +}; +var script$Y = { + name: "ColumnGroup", + "extends": script$1$B, + inheritAttrs: false, + inject: ["$columnGroups"], + mounted: /* @__PURE__ */ __name(function mounted11() { + var _this$$columnGroups; + (_this$$columnGroups = this.$columnGroups) === null || _this$$columnGroups === void 0 || _this$$columnGroups.add(this.$); + }, "mounted"), + unmounted: /* @__PURE__ */ __name(function unmounted2() { + var _this$$columnGroups2; + (_this$$columnGroups2 = this.$columnGroups) === null || _this$$columnGroups2 === void 0 || _this$$columnGroups2["delete"](this.$); + }, "unmounted"), + render: /* @__PURE__ */ __name(function render() { + return null; + }, "render") +}; +var theme$v = /* @__PURE__ */ __name(function theme9(_ref) { + var dt = _ref.dt; + return "\n.p-dataview {\n border-color: ".concat(dt("dataview.border.color"), ";\n border-width: ").concat(dt("dataview.border.width"), ";\n border-style: solid;\n border-radius: ").concat(dt("dataview.border.radius"), ";\n padding: ").concat(dt("dataview.padding"), ";\n}\n\n.p-dataview-header {\n background: ").concat(dt("dataview.header.background"), ";\n color: ").concat(dt("dataview.header.color"), ";\n border-color: ").concat(dt("dataview.header.border.color"), ";\n border-width: ").concat(dt("dataview.header.border.width"), ";\n border-style: solid;\n padding: ").concat(dt("dataview.header.padding"), ";\n border-radius: ").concat(dt("dataview.header.border.radius"), ";\n}\n\n.p-dataview-content {\n background: ").concat(dt("dataview.content.background"), ";\n border-color: ").concat(dt("dataview.content.border.color"), ";\n border-width: ").concat(dt("dataview.content.border.width"), ";\n border-style: solid;\n color: ").concat(dt("dataview.content.color"), ";\n padding: ").concat(dt("dataview.content.padding"), ";\n border-radius: ").concat(dt("dataview.content.border.radius"), ";\n}\n\n.p-dataview-footer {\n background: ").concat(dt("dataview.footer.background"), ";\n color: ").concat(dt("dataview.footer.color"), ";\n border-color: ").concat(dt("dataview.footer.border.color"), ";\n border-width: ").concat(dt("dataview.footer.border.width"), ";\n border-style: solid;\n padding: ").concat(dt("dataview.footer.padding"), ";\n border-radius: ").concat(dt("dataview.footer.border.radius"), ";\n}\n\n.p-dataview-paginator-top {\n border-width: ").concat(dt("dataview.paginator.top.border.width"), ";\n border-color: ").concat(dt("dataview.paginator.top.border.color"), ";\n border-style: solid;\n}\n\n.p-dataview-paginator-bottom {\n border-width: ").concat(dt("dataview.paginator.bottom.border.width"), ";\n border-color: ").concat(dt("dataview.paginator.bottom.border.color"), ";\n border-style: solid;\n}\n"); +}, "theme"); +var classes$z = { + root: /* @__PURE__ */ __name(function root9(_ref2) { + var props = _ref2.props; + return ["p-dataview p-component", { + "p-dataview-list": props.layout === "list", + "p-dataview-grid": props.layout === "grid" + }]; + }, "root"), + header: "p-dataview-header", + pcPaginator: /* @__PURE__ */ __name(function pcPaginator(_ref3) { + var position = _ref3.position; + return "p-dataview-paginator-" + position; + }, "pcPaginator"), + content: "p-dataview-content", + emptyMessage: "p-dataview-empty-message", + // TODO: remove? + footer: "p-dataview-footer" +}; +var DataViewStyle = BaseStyle.extend({ + name: "dataview", + theme: theme$v, + classes: classes$z +}); +var script$1$A = { + name: "BaseDataView", + "extends": script$1d, + props: { + value: { + type: Array, + "default": null + }, + layout: { + type: String, + "default": "list" + }, + rows: { + type: Number, + "default": 0 + }, + first: { + type: Number, + "default": 0 + }, + totalRecords: { + type: Number, + "default": 0 + }, + paginator: { + type: Boolean, + "default": false + }, + paginatorPosition: { + type: String, + "default": "bottom" + }, + alwaysShowPaginator: { + type: Boolean, + "default": true + }, + paginatorTemplate: { + type: String, + "default": "FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown" + }, + pageLinkSize: { + type: Number, + "default": 5 + }, + rowsPerPageOptions: { + type: Array, + "default": null + }, + currentPageReportTemplate: { + type: String, + "default": "({currentPage} of {totalPages})" + }, + sortField: { + type: [String, Function], + "default": null + }, + sortOrder: { + type: Number, + "default": null + }, + lazy: { + type: Boolean, + "default": false + }, + dataKey: { + type: String, + "default": null + } + }, + style: DataViewStyle, + provide: /* @__PURE__ */ __name(function provide15() { + return { + $pcDataView: this, + $parentInstance: this + }; + }, "provide") +}; +function _toConsumableArray$b(r) { + return _arrayWithoutHoles$b(r) || _iterableToArray$b(r) || _unsupportedIterableToArray$c(r) || _nonIterableSpread$b(); +} +__name(_toConsumableArray$b, "_toConsumableArray$b"); +function _nonIterableSpread$b() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableSpread$b, "_nonIterableSpread$b"); +function _unsupportedIterableToArray$c(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$c(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$c(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$c, "_unsupportedIterableToArray$c"); +function _iterableToArray$b(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray$b, "_iterableToArray$b"); +function _arrayWithoutHoles$b(r) { + if (Array.isArray(r)) return _arrayLikeToArray$c(r); +} +__name(_arrayWithoutHoles$b, "_arrayWithoutHoles$b"); +function _arrayLikeToArray$c(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; +} +__name(_arrayLikeToArray$c, "_arrayLikeToArray$c"); +var script$X = { + name: "DataView", + "extends": script$1$A, + inheritAttrs: false, + emits: ["update:first", "update:rows", "page"], + data: /* @__PURE__ */ __name(function data7() { + return { + d_first: this.first, + d_rows: this.rows + }; + }, "data"), + watch: { + first: /* @__PURE__ */ __name(function first(newValue) { + this.d_first = newValue; + }, "first"), + rows: /* @__PURE__ */ __name(function rows(newValue) { + this.d_rows = newValue; + }, "rows"), + sortField: /* @__PURE__ */ __name(function sortField() { + this.resetPage(); + }, "sortField"), + sortOrder: /* @__PURE__ */ __name(function sortOrder() { + this.resetPage(); + }, "sortOrder") + }, + methods: { + getKey: /* @__PURE__ */ __name(function getKey2(item8, index) { + return this.dataKey ? resolveFieldData(item8, this.dataKey) : index; + }, "getKey"), + onPage: /* @__PURE__ */ __name(function onPage(event2) { + this.d_first = event2.first; + this.d_rows = event2.rows; + this.$emit("update:first", this.d_first); + this.$emit("update:rows", this.d_rows); + this.$emit("page", event2); + }, "onPage"), + sort: /* @__PURE__ */ __name(function sort$1() { + var _this = this; + if (this.value) { + var value2 = _toConsumableArray$b(this.value); + var comparer = localeComparator(); + value2.sort(function(data1, data210) { + var value1 = resolveFieldData(data1, _this.sortField); + var value22 = resolveFieldData(data210, _this.sortField); + return sort(value1, value22, _this.sortOrder, comparer); + }); + return value2; + } else { + return null; + } + }, "sort$1"), + resetPage: /* @__PURE__ */ __name(function resetPage() { + this.d_first = 0; + this.$emit("update:first", this.d_first); + }, "resetPage") + }, + computed: { + getTotalRecords: /* @__PURE__ */ __name(function getTotalRecords() { + if (this.totalRecords) return this.totalRecords; + else return this.value ? this.value.length : 0; + }, "getTotalRecords"), + empty: /* @__PURE__ */ __name(function empty() { + return !this.value || this.value.length === 0; + }, "empty"), + emptyMessageText: /* @__PURE__ */ __name(function emptyMessageText2() { + var _this$$primevue$confi; + return ((_this$$primevue$confi = this.$primevue.config) === null || _this$$primevue$confi === void 0 || (_this$$primevue$confi = _this$$primevue$confi.locale) === null || _this$$primevue$confi === void 0 ? void 0 : _this$$primevue$confi.emptyMessage) || ""; + }, "emptyMessageText"), + paginatorTop: /* @__PURE__ */ __name(function paginatorTop() { + return this.paginator && (this.paginatorPosition !== "bottom" || this.paginatorPosition === "both"); + }, "paginatorTop"), + paginatorBottom: /* @__PURE__ */ __name(function paginatorBottom() { + return this.paginator && (this.paginatorPosition !== "top" || this.paginatorPosition === "both"); + }, "paginatorBottom"), + items: /* @__PURE__ */ __name(function items() { + if (this.value && this.value.length) { + var data41 = this.value; + if (data41 && data41.length && this.sortField) { + data41 = this.sort(); + } + if (this.paginator) { + var first3 = this.lazy ? 0 : this.d_first; + return data41.slice(first3, first3 + this.d_rows); + } else { + return data41; + } + } else { + return null; + } + }, "items") + }, + components: { + DVPaginator: script$1u + } +}; +function render$R(_ctx, _cache, $props, $setup, $data, $options) { + var _component_DVPaginator = resolveComponent("DVPaginator"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [_ctx.$slots.header ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("header") + }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header")], 16)) : createCommentVNode("", true), $options.paginatorTop ? (openBlock(), createBlock(_component_DVPaginator, { + key: 1, + rows: $data.d_rows, + first: $data.d_first, + totalRecords: $options.getTotalRecords, + pageLinkSize: _ctx.pageLinkSize, + template: _ctx.paginatorTemplate, + rowsPerPageOptions: _ctx.rowsPerPageOptions, + currentPageReportTemplate: _ctx.currentPageReportTemplate, + "class": normalizeClass(_ctx.cx("pcPaginator", { + position: "top" + })), + alwaysShow: _ctx.alwaysShowPaginator, + onPage: _cache[0] || (_cache[0] = function($event) { + return $options.onPage($event); + }), + unstyled: _ctx.unstyled, + pt: _ctx.ptm("pcPaginator") + }, createSlots({ + _: 2 + }, [_ctx.$slots.paginatorcontainer ? { + name: "container", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorcontainer", { + first: slotProps.first, + last: slotProps.last, + rows: slotProps.rows, + page: slotProps.page, + pageCount: slotProps.pageCount, + totalRecords: slotProps.totalRecords, + firstPageCallback: slotProps.firstPageCallback, + lastPageCallback: slotProps.lastPageCallback, + prevPageCallback: slotProps.prevPageCallback, + nextPageCallback: slotProps.nextPageCallback, + rowChangeCallback: slotProps.rowChangeCallback + })]; + }), + key: "0" + } : void 0, _ctx.$slots.paginatorstart ? { + name: "start", + fn: withCtx(function() { + return [renderSlot(_ctx.$slots, "paginatorstart")]; + }), + key: "1" + } : void 0, _ctx.$slots.paginatorend ? { + name: "end", + fn: withCtx(function() { + return [renderSlot(_ctx.$slots, "paginatorend")]; + }), + key: "2" + } : void 0]), 1032, ["rows", "first", "totalRecords", "pageLinkSize", "template", "rowsPerPageOptions", "currentPageReportTemplate", "class", "alwaysShow", "unstyled", "pt"])) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("content") + }, _ctx.ptm("content")), [!$options.empty ? (openBlock(), createElementBlock(Fragment, { + key: 0 + }, [_ctx.$slots.list && _ctx.layout === "list" ? renderSlot(_ctx.$slots, "list", { + key: 0, + items: $options.items + }) : createCommentVNode("", true), _ctx.$slots.grid && _ctx.layout === "grid" ? renderSlot(_ctx.$slots, "grid", { + key: 1, + items: $options.items + }) : createCommentVNode("", true)], 64)) : (openBlock(), createElementBlock("div", mergeProps({ + key: 1, + "class": _ctx.cx("emptyMessage") + }, _ctx.ptm("emptyMessage")), [renderSlot(_ctx.$slots, "empty", { + layout: _ctx.layout + }, function() { + return [createTextVNode(toDisplayString($options.emptyMessageText), 1)]; + })], 16))], 16), $options.paginatorBottom ? (openBlock(), createBlock(_component_DVPaginator, { + key: 2, + rows: $data.d_rows, + first: $data.d_first, + totalRecords: $options.getTotalRecords, + pageLinkSize: _ctx.pageLinkSize, + template: _ctx.paginatorTemplate, + rowsPerPageOptions: _ctx.rowsPerPageOptions, + currentPageReportTemplate: _ctx.currentPageReportTemplate, + "class": normalizeClass(_ctx.cx("pcPaginator", { + position: "bottom" + })), + alwaysShow: _ctx.alwaysShowPaginator, + onPage: _cache[1] || (_cache[1] = function($event) { + return $options.onPage($event); + }), + unstyled: _ctx.unstyled, + pt: _ctx.ptm("pcPaginator") + }, createSlots({ + _: 2 + }, [_ctx.$slots.paginatorcontainer ? { + name: "container", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorcontainer", { + first: slotProps.first, + last: slotProps.last, + rows: slotProps.rows, + page: slotProps.page, + pageCount: slotProps.pageCount, + totalRecords: slotProps.totalRecords, + firstPageCallback: slotProps.firstPageCallback, + lastPageCallback: slotProps.lastPageCallback, + prevPageCallback: slotProps.prevPageCallback, + nextPageCallback: slotProps.nextPageCallback, + rowChangeCallback: slotProps.rowChangeCallback + })]; + }), + key: "0" + } : void 0, _ctx.$slots.paginatorstart ? { + name: "start", + fn: withCtx(function() { + return [renderSlot(_ctx.$slots, "paginatorstart")]; + }), + key: "1" + } : void 0, _ctx.$slots.paginatorend ? { + name: "end", + fn: withCtx(function() { + return [renderSlot(_ctx.$slots, "paginatorend")]; + }), + key: "2" + } : void 0]), 1032, ["rows", "first", "totalRecords", "pageLinkSize", "template", "rowsPerPageOptions", "currentPageReportTemplate", "class", "alwaysShow", "unstyled", "pt"])) : createCommentVNode("", true), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", mergeProps({ + key: 3, + "class": _ctx.cx("footer") + }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true)], 16); +} +__name(render$R, "render$R"); +script$X.render = render$R; +var DeferredContentStyle = BaseStyle.extend({ + name: "deferredcontent" +}); +var script$W = { + name: "DeferredContent", + "extends": script$1d, + inheritAttrs: false, + emits: ["load"], + style: DeferredContentStyle, + data: /* @__PURE__ */ __name(function data8() { + return { + loaded: false + }; + }, "data"), + mounted: /* @__PURE__ */ __name(function mounted12() { + if (!this.loaded) { + if (this.shouldLoad()) this.load(); + else this.bindScrollListener(); + } + }, "mounted"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount4() { + this.unbindScrollListener(); + }, "beforeUnmount"), + methods: { + bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener3() { + var _this = this; + this.documentScrollListener = function() { + if (_this.shouldLoad()) { + _this.load(); + _this.unbindScrollListener(); + } + }; + window.addEventListener("scroll", this.documentScrollListener); + }, "bindScrollListener"), + unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener3() { + if (this.documentScrollListener) { + window.removeEventListener("scroll", this.documentScrollListener); + this.documentScrollListener = null; + } + }, "unbindScrollListener"), + shouldLoad: /* @__PURE__ */ __name(function shouldLoad() { + if (this.loaded) { + return false; + } else { + var rect = this.$refs.container.getBoundingClientRect(); + var docElement = document.documentElement; + var winHeight = docElement.clientHeight; + return winHeight >= rect.top; + } + }, "shouldLoad"), + load: /* @__PURE__ */ __name(function load(event2) { + this.loaded = true; + this.$emit("load", event2); + }, "load") + } +}; +function render$Q(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + ref: "container" + }, _ctx.ptmi("root")), [$data.loaded ? renderSlot(_ctx.$slots, "default", { + key: 0 + }) : createCommentVNode("", true)], 16); +} +__name(render$Q, "render$Q"); +script$W.render = render$Q; +var DynamicDialogEventBus = EventBus(); +var DialogService = { + install: /* @__PURE__ */ __name(function install(app) { + var DialogService2 = { + open: /* @__PURE__ */ __name(function open2(content, options4) { + var instance = { + content: content && markRaw(content), + options: options4 || {}, + data: options4 && options4.data, + close: /* @__PURE__ */ __name(function close2(params) { + DynamicDialogEventBus.emit("close", { + instance, + params + }); + }, "close") + }; + DynamicDialogEventBus.emit("open", { + instance + }); + return instance; + }, "open") + }; + app.config.globalProperties.$dialog = DialogService2; + app.provide(PrimeVueDialogSymbol, DialogService2); + }, "install") +}; +var theme$u = /* @__PURE__ */ __name(function theme10(_ref) { + var dt = _ref.dt; + return "\n.p-dock {\n position: absolute;\n z-index: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\n.p-dock-list-container {\n display: flex;\n pointer-events: auto;\n background: ".concat(dt("dock.background"), ";\n border: 1px solid ").concat(dt("dock.border.color"), ";\n padding: ").concat(dt("dock.padding"), ";\n border-radius: ").concat(dt("dock.border.radius"), ";\n}\n\n.p-dock-list {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n align-items: center;\n justify-content: center;\n outline: 0 none;\n}\n\n.p-dock-item {\n transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n will-change: transform;\n padding: ").concat(dt("dock.item.padding"), ";\n border-radius: ").concat(dt("dock.item.border.radius"), ";\n}\n\n.p-dock-item.p-focus {\n box-shadow: ").concat(dt("dock.item.focus.ring.shadow"), ";\n outline: ").concat(dt("dock.item.focus.ring.width"), " ").concat(dt("dock.item.focus.ring.style"), " ").concat(dt("dock.item.focus.ring.color"), ";\n outline-offset: ").concat(dt("dock.item.focus.ring.offset"), ";\n}\n\n.p-dock-item-link {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: relative;\n overflow: hidden;\n cursor: default;\n width: ").concat(dt("dock.item.size"), ";\n height: ").concat(dt("dock.item.size"), ";\n}\n\n.p-dock-top {\n left: 0;\n top: 0;\n width: 100%;\n}\n\n.p-dock-bottom {\n left: 0;\n bottom: 0;\n width: 100%;\n}\n\n.p-dock-right {\n right: 0;\n top: 0;\n height: 100%;\n}\n\n.p-dock-right .p-dock-list {\n flex-direction: column;\n}\n\n.p-dock-left {\n left: 0;\n top: 0;\n height: 100%;\n}\n\n.p-dock-left .p-dock-list {\n flex-direction: column;\n}\n\n.p-dock-mobile.p-dock-top .p-dock-list-container,\n.p-dock-mobile.p-dock-bottom .p-dock-list-container {\n overflow-x: auto;\n width: 100%;\n}\n\n.p-dock-mobile.p-dock-top .p-dock-list-container .p-dock-list,\n.p-dock-mobile.p-dock-bottom .p-dock-list-container .p-dock-list {\n margin: 0 auto;\n}\n\n.p-dock-mobile.p-dock-left .p-dock-list-container,\n.p-dock-mobile.p-dock-right .p-dock-list-container {\n overflow-y: auto;\n height: 100%;\n}\n\n.p-dock-mobile.p-dock-left .p-dock-list-container .p-dock-list,\n.p-dock-mobile.p-dock-right .p-dock-list-container .p-dock-list {\n margin: auto 0;\n}\n\n.p-dock-mobile .p-dock-list .p-dock-item {\n transform: none;\n margin: 0;\n}\n"); +}, "theme"); +var classes$y = { + root: /* @__PURE__ */ __name(function root10(_ref2) { + var instance = _ref2.instance, props = _ref2.props; + return ["p-dock p-component", "p-dock-".concat(props.position), { + "p-dock-mobile": instance.queryMatches + }]; + }, "root"), + listContainer: "p-dock-list-container", + list: "p-dock-list", + item: /* @__PURE__ */ __name(function item2(_ref3) { + var instance = _ref3.instance, processedItem = _ref3.processedItem, id4 = _ref3.id; + return ["p-dock-item", { + "p-focus": instance.isItemActive(id4), + "p-disabled": instance.disabled(processedItem) + }]; + }, "item"), + itemContent: "p-dock-item-content", + itemLink: "p-dock-item-link", + itemIcon: "p-dock-item-icon" +}; +var DockStyle = BaseStyle.extend({ + name: "dock", + theme: theme$u, + classes: classes$y +}); +var script$2$7 = { + name: "BaseDock", + "extends": script$1d, + props: { + position: { + type: String, + "default": "bottom" + }, + model: null, + "class": null, + style: null, + tooltipOptions: null, + menuId: { + type: String, + "default": null + }, + tabindex: { + type: Number, + "default": 0 + }, + breakpoint: { + type: String, + "default": "960px" + }, + ariaLabel: { + type: String, + "default": null + }, + ariaLabelledby: { + type: String, + "default": null + } + }, + style: DockStyle, + provide: /* @__PURE__ */ __name(function provide16() { + return { + $pcDock: this, + $parentInstance: this + }; + }, "provide") +}; +function _toConsumableArray$a(r) { + return _arrayWithoutHoles$a(r) || _iterableToArray$a(r) || _unsupportedIterableToArray$b(r) || _nonIterableSpread$a(); +} +__name(_toConsumableArray$a, "_toConsumableArray$a"); +function _nonIterableSpread$a() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableSpread$a, "_nonIterableSpread$a"); +function _unsupportedIterableToArray$b(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$b(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$b(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$b, "_unsupportedIterableToArray$b"); +function _iterableToArray$a(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray$a, "_iterableToArray$a"); +function _arrayWithoutHoles$a(r) { + if (Array.isArray(r)) return _arrayLikeToArray$b(r); +} +__name(_arrayWithoutHoles$a, "_arrayWithoutHoles$a"); +function _arrayLikeToArray$b(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; +} +__name(_arrayLikeToArray$b, "_arrayLikeToArray$b"); +var script$1$z = { + name: "DockSub", + hostName: "Dock", + "extends": script$1d, + emits: ["focus", "blur"], + props: { + position: { + type: String, + "default": "bottom" + }, + model: { + type: Array, + "default": null + }, + templates: { + type: null, + "default": null + }, + tooltipOptions: null, + menuId: { + type: String, + "default": null + }, + tabindex: { + type: Number, + "default": 0 + }, + ariaLabel: { + type: String, + "default": null + }, + ariaLabelledby: { + type: String, + "default": null + } + }, + data: /* @__PURE__ */ __name(function data9() { + return { + id: this.menuId, + currentIndex: -3, + focused: false, + focusedOptionIndex: -1 + }; + }, "data"), + watch: { + menuId: /* @__PURE__ */ __name(function menuId(newValue) { + this.id = newValue || UniqueComponentId(); + }, "menuId") + }, + mounted: /* @__PURE__ */ __name(function mounted13() { + this.id = this.id || UniqueComponentId(); + }, "mounted"), + methods: { + getItemId: /* @__PURE__ */ __name(function getItemId(index) { + return "".concat(this.id, "_").concat(index); + }, "getItemId"), + getItemProp: /* @__PURE__ */ __name(function getItemProp(processedItem, name4) { + return processedItem && processedItem.item ? resolve(processedItem.item[name4]) : void 0; + }, "getItemProp"), + getPTOptions: /* @__PURE__ */ __name(function getPTOptions2(key, item8, index) { + return this.ptm(key, { + context: { + index, + item: item8, + active: this.isItemActive(this.getItemId(index)) + } + }); + }, "getPTOptions"), + isSameMenuItem: /* @__PURE__ */ __name(function isSameMenuItem(event2) { + return event2.currentTarget && (event2.currentTarget.isSameNode(event2.target) || event2.currentTarget.isSameNode(event2.target.closest('[data-pc-section="item"]'))); + }, "isSameMenuItem"), + isItemActive: /* @__PURE__ */ __name(function isItemActive2(id4) { + return id4 === this.focusedOptionIndex; + }, "isItemActive"), + onListMouseLeave: /* @__PURE__ */ __name(function onListMouseLeave() { + this.currentIndex = -3; + }, "onListMouseLeave"), + onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter(index) { + this.currentIndex = index; + }, "onItemMouseEnter"), + onItemClick: /* @__PURE__ */ __name(function onItemClick(event2, processedItem) { + if (this.isSameMenuItem(event2)) { + var command = this.getItemProp(processedItem, "command"); + command && command({ + originalEvent: event2, + item: processedItem.item + }); + } + }, "onItemClick"), + onListFocus: /* @__PURE__ */ __name(function onListFocus(event2) { + this.focused = true; + this.changeFocusedOptionIndex(0); + this.$emit("focus", event2); + }, "onListFocus"), + onListBlur: /* @__PURE__ */ __name(function onListBlur(event2) { + this.focused = false; + this.focusedOptionIndex = -1; + this.$emit("blur", event2); + }, "onListBlur"), + onListKeyDown: /* @__PURE__ */ __name(function onListKeyDown(event2) { + switch (event2.code) { + case "ArrowDown": { + if (this.position === "left" || this.position === "right") this.onArrowDownKey(); + event2.preventDefault(); + break; + } + case "ArrowUp": { + if (this.position === "left" || this.position === "right") this.onArrowUpKey(); + event2.preventDefault(); + break; + } + case "ArrowRight": { + if (this.position === "top" || this.position === "bottom") this.onArrowDownKey(); + event2.preventDefault(); + break; + } + case "ArrowLeft": { + if (this.position === "top" || this.position === "bottom") this.onArrowUpKey(); + event2.preventDefault(); + break; + } + case "Home": { + this.onHomeKey(); + event2.preventDefault(); + break; + } + case "End": { + this.onEndKey(); + event2.preventDefault(); + break; + } + case "Enter": + case "NumpadEnter": + case "Space": { + this.onSpaceKey(event2); + event2.preventDefault(); + break; + } + } + }, "onListKeyDown"), + onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey3() { + var optionIndex = this.findNextOptionIndex(this.focusedOptionIndex); + this.changeFocusedOptionIndex(optionIndex); + }, "onArrowDownKey"), + onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey3() { + var optionIndex = this.findPrevOptionIndex(this.focusedOptionIndex); + this.changeFocusedOptionIndex(optionIndex); + }, "onArrowUpKey"), + onHomeKey: /* @__PURE__ */ __name(function onHomeKey3() { + this.changeFocusedOptionIndex(0); + }, "onHomeKey"), + onEndKey: /* @__PURE__ */ __name(function onEndKey3() { + this.changeFocusedOptionIndex(find(this.$refs.list, 'li[data-pc-section="item"][data-p-disabled="false"]').length - 1); + }, "onEndKey"), + onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey2() { + var element = findSingle(this.$refs.list, 'li[id="'.concat("".concat(this.focusedOptionIndex), '"]')); + var anchorElement = element && findSingle(element, '[data-pc-section="itemlink"]'); + anchorElement ? anchorElement.click() : element && element.click(); + }, "onSpaceKey"), + findNextOptionIndex: /* @__PURE__ */ __name(function findNextOptionIndex2(index) { + var menuitems = find(this.$refs.list, 'li[data-pc-section="item"][data-p-disabled="false"]'); + var matchedOptionIndex = _toConsumableArray$a(menuitems).findIndex(function(link) { + return link.id === index; + }); + return matchedOptionIndex > -1 ? matchedOptionIndex + 1 : 0; + }, "findNextOptionIndex"), + findPrevOptionIndex: /* @__PURE__ */ __name(function findPrevOptionIndex2(index) { + var menuitems = find(this.$refs.list, 'li[data-pc-section="item"][data-p-disabled="false"]'); + var matchedOptionIndex = _toConsumableArray$a(menuitems).findIndex(function(link) { + return link.id === index; + }); + return matchedOptionIndex > -1 ? matchedOptionIndex - 1 : 0; + }, "findPrevOptionIndex"), + changeFocusedOptionIndex: /* @__PURE__ */ __name(function changeFocusedOptionIndex2(index) { + var menuitems = find(this.$refs.list, 'li[data-pc-section="item"][data-p-disabled="false"]'); + var order = index >= menuitems.length ? menuitems.length - 1 : index < 0 ? 0 : index; + this.focusedOptionIndex = menuitems[order].getAttribute("id"); + }, "changeFocusedOptionIndex"), + disabled: /* @__PURE__ */ __name(function disabled2(item8) { + return typeof item8.disabled === "function" ? item8.disabled() : item8.disabled; + }, "disabled"), + getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps2(item8, index) { + return { + action: mergeProps({ + tabindex: -1, + "class": this.cx("itemLink") + }, this.getPTOptions("itemLink", item8, index)), + icon: mergeProps({ + "class": [this.cx("itemIcon"), item8.icon] + }, this.getPTOptions("itemIcon", item8, index)) + }; + }, "getMenuItemProps") + }, + computed: { + focusedOptionId: /* @__PURE__ */ __name(function focusedOptionId3() { + return this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : null; + }, "focusedOptionId") + }, + directives: { + ripple: Ripple, + tooltip: Tooltip + } +}; +var _hoisted_1$p = ["id", "aria-orientation", "aria-activedescendant", "tabindex", "aria-label", "aria-labelledby"]; +var _hoisted_2$i = ["id", "aria-label", "aria-disabled", "onClick", "onMouseenter", "data-p-focused", "data-p-disabled"]; +var _hoisted_3$f = ["href", "target"]; +function render$1$7(_ctx, _cache, $props, $setup, $data, $options) { + var _directive_ripple = resolveDirective("ripple"); + var _directive_tooltip = resolveDirective("tooltip"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("listContainer") + }, _ctx.ptm("listContainer")), [createBaseVNode("ul", mergeProps({ + ref: "list", + id: $data.id, + "class": _ctx.cx("list"), + role: "menu", + "aria-orientation": $props.position === "bottom" || $props.position === "top" ? "horizontal" : "vertical", + "aria-activedescendant": $data.focused ? $options.focusedOptionId : void 0, + tabindex: $props.tabindex, + "aria-label": $props.ariaLabel, + "aria-labelledby": $props.ariaLabelledby, + onFocus: _cache[0] || (_cache[0] = function() { + return $options.onListFocus && $options.onListFocus.apply($options, arguments); + }), + onBlur: _cache[1] || (_cache[1] = function() { + return $options.onListBlur && $options.onListBlur.apply($options, arguments); + }), + onKeydown: _cache[2] || (_cache[2] = function() { + return $options.onListKeyDown && $options.onListKeyDown.apply($options, arguments); + }), + onMouseleave: _cache[3] || (_cache[3] = function() { + return $options.onListMouseLeave && $options.onListMouseLeave.apply($options, arguments); + }) + }, _ctx.ptm("list")), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.model, function(processedItem, index) { + return openBlock(), createElementBlock("li", mergeProps({ + key: index, + id: $options.getItemId(index), + "class": _ctx.cx("item", { + processedItem, + id: $options.getItemId(index) + }), + role: "menuitem", + "aria-label": processedItem.label, + "aria-disabled": $options.disabled(processedItem), + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return $options.onItemClick($event, processedItem); + }, "onClick"), + onMouseenter: /* @__PURE__ */ __name(function onMouseenter($event) { + return $options.onItemMouseEnter(index); + }, "onMouseenter"), + ref_for: true + }, $options.getPTOptions("item", processedItem, index), { + "data-p-focused": $options.isItemActive($options.getItemId(index)), + "data-p-disabled": $options.disabled(processedItem) || false + }), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("itemContent"), + ref_for: true + }, $options.getPTOptions("itemContent", processedItem, index)), [!$props.templates["item"] ? withDirectives((openBlock(), createElementBlock("a", mergeProps({ + key: 0, + href: processedItem.url, + "class": _ctx.cx("itemLink"), + target: processedItem.target, + tabindex: "-1", + "aria-hidden": "true", + ref_for: true + }, $options.getPTOptions("itemLink", processedItem, index)), [!$props.templates["icon"] && !$props.templates["itemicon"] ? withDirectives((openBlock(), createElementBlock("span", mergeProps({ + key: 0, + "class": [_ctx.cx("itemIcon"), processedItem.icon], + ref_for: true + }, $options.getPTOptions("itemIcon", processedItem, index)), null, 16)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates["icon"] || $props.templates["itemicon"]), { + key: 1, + item: processedItem, + "class": normalizeClass(_ctx.cx("itemIcon")) + }, null, 8, ["item", "class"]))], 16, _hoisted_3$f)), [[_directive_tooltip, { + value: processedItem.label, + disabled: !$props.tooltipOptions + }, $props.tooltipOptions]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates["item"]), { + key: 1, + item: processedItem, + index, + label: processedItem.label, + props: $options.getMenuItemProps(processedItem, index) + }, null, 8, ["item", "index", "label", "props"]))], 16)], 16, _hoisted_2$i); + }), 128))], 16, _hoisted_1$p)], 16); +} +__name(render$1$7, "render$1$7"); +script$1$z.render = render$1$7; +var script$V = { + name: "Dock", + "extends": script$2$7, + inheritAttrs: false, + matchMediaListener: null, + data: /* @__PURE__ */ __name(function data10() { + return { + query: null, + queryMatches: false + }; + }, "data"), + mounted: /* @__PURE__ */ __name(function mounted14() { + this.bindMatchMediaListener(); + }, "mounted"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount5() { + this.unbindMatchMediaListener(); + }, "beforeUnmount"), + methods: { + bindMatchMediaListener: /* @__PURE__ */ __name(function bindMatchMediaListener3() { + var _this = this; + if (!this.matchMediaListener) { + var query = matchMedia("(max-width: ".concat(this.breakpoint, ")")); + this.query = query; + this.queryMatches = query.matches; + this.matchMediaListener = function() { + _this.queryMatches = query.matches; + _this.mobileActive = false; + }; + this.query.addEventListener("change", this.matchMediaListener); + } + }, "bindMatchMediaListener"), + unbindMatchMediaListener: /* @__PURE__ */ __name(function unbindMatchMediaListener3() { + if (this.matchMediaListener) { + this.query.removeEventListener("change", this.matchMediaListener); + this.matchMediaListener = null; + } + }, "unbindMatchMediaListener") + }, + computed: { + containerClass: /* @__PURE__ */ __name(function containerClass() { + return [this["class"], this.cx("root")]; + }, "containerClass") + }, + components: { + DockSub: script$1$z + } +}; +function render$P(_ctx, _cache, $props, $setup, $data, $options) { + var _component_DockSub = resolveComponent("DockSub"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": $options.containerClass, + style: _ctx.style + }, _ctx.ptmi("root")), [createVNode(_component_DockSub, { + model: _ctx.model, + templates: _ctx.$slots, + tooltipOptions: _ctx.tooltipOptions, + position: _ctx.position, + menuId: _ctx.menuId, + "aria-label": _ctx.ariaLabel, + "aria-labelledby": _ctx.ariaLabelledby, + tabindex: _ctx.tabindex, + pt: _ctx.pt, + unstyled: _ctx.unstyled + }, null, 8, ["model", "templates", "tooltipOptions", "position", "menuId", "aria-label", "aria-labelledby", "tabindex", "pt", "unstyled"])], 16); +} +__name(render$P, "render$P"); +script$V.render = render$P; +var script$U = { + name: "Dropdown", + "extends": script$1v, + mounted: /* @__PURE__ */ __name(function mounted15() { + console.warn("Deprecated since v4. Use Select component instead."); + }, "mounted") +}; +var DropdownStyle = BaseStyle.extend({ + name: "dropdown" +}); +var DynamicDialogStyle = BaseStyle.extend({ + name: "dynamicdialog" +}); +var script$1$y = { + name: "BaseDynamicDialog", + "extends": script$1d, + props: {}, + style: DynamicDialogStyle, + provide: /* @__PURE__ */ __name(function provide17() { + return { + $pcDynamicDialog: this, + $parentInstance: this + }; + }, "provide") +}; +var script$T = { + name: "DynamicDialog", + "extends": script$1$y, + inheritAttrs: false, + data: /* @__PURE__ */ __name(function data11() { + return { + instanceMap: {} + }; + }, "data"), + openListener: null, + closeListener: null, + currentInstance: null, + mounted: /* @__PURE__ */ __name(function mounted16() { + var _this = this; + this.openListener = function(_ref) { + var instance = _ref.instance; + var key = UniqueComponentId() + "_dynamic_dialog"; + instance.visible = true; + instance.key = key; + _this.instanceMap[key] = instance; + }; + this.closeListener = function(_ref2) { + var instance = _ref2.instance, params = _ref2.params; + var key = instance.key; + var currentInstance = _this.instanceMap[key]; + if (currentInstance) { + currentInstance.visible = false; + currentInstance.options.onClose && currentInstance.options.onClose({ + data: params, + type: "config-close" + }); + _this.currentInstance = currentInstance; + } + }; + DynamicDialogEventBus.on("open", this.openListener); + DynamicDialogEventBus.on("close", this.closeListener); + }, "mounted"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount6() { + DynamicDialogEventBus.off("open", this.openListener); + DynamicDialogEventBus.off("close", this.closeListener); + }, "beforeUnmount"), + methods: { + onDialogHide: /* @__PURE__ */ __name(function onDialogHide(instance) { + !this.currentInstance && instance.options.onClose && instance.options.onClose({ + type: "dialog-close" + }); + delete this.instanceMap[instance.key]; + }, "onDialogHide"), + onDialogAfterHide: /* @__PURE__ */ __name(function onDialogAfterHide() { + this.currentInstance && delete this.currentInstance; + this.currentInstance = null; + }, "onDialogAfterHide"), + getTemplateItems: /* @__PURE__ */ __name(function getTemplateItems(template) { + return Array.isArray(template) ? template : [template]; + }, "getTemplateItems") + }, + components: { + DDialog: script$1w + } +}; +function render$O(_ctx, _cache, $props, $setup, $data, $options) { + var _component_DDialog = resolveComponent("DDialog"); + return openBlock(true), createElementBlock(Fragment, null, renderList($data.instanceMap, function(instance, key) { + return openBlock(), createBlock(_component_DDialog, mergeProps({ + key, + visible: instance.visible, + "onUpdate:visible": /* @__PURE__ */ __name(function onUpdateVisible($event) { + return instance.visible = $event; + }, "onUpdateVisible"), + _instance: instance, + ref_for: true + }, instance.options.props, { + onHide: /* @__PURE__ */ __name(function onHide($event) { + return $options.onDialogHide(instance); + }, "onHide"), + onAfterHide: $options.onDialogAfterHide + }), createSlots({ + "default": withCtx(function() { + return [(openBlock(), createBlock(resolveDynamicComponent(instance.content), mergeProps({ + ref_for: true + }, instance.options.emits), null, 16))]; + }), + _: 2 + }, [instance.options.templates && instance.options.templates.header ? { + name: "header", + fn: withCtx(function() { + return [(openBlock(true), createElementBlock(Fragment, null, renderList($options.getTemplateItems(instance.options.templates.header), function(header2, index) { + return openBlock(), createBlock(resolveDynamicComponent(header2), mergeProps({ + key: index + "_header", + ref_for: true + }, instance.options.emits), null, 16); + }), 128))]; + }), + key: "0" + } : void 0, instance.options.templates && instance.options.templates.footer ? { + name: "footer", + fn: withCtx(function() { + return [(openBlock(true), createElementBlock(Fragment, null, renderList($options.getTemplateItems(instance.options.templates.footer), function(footer, index) { + return openBlock(), createBlock(resolveDynamicComponent(footer), mergeProps({ + key: index + "_footer", + ref_for: true + }, instance.options.emits), null, 16); + }), 128))]; + }), + key: "1" + } : void 0]), 1040, ["visible", "onUpdate:visible", "_instance", "onHide", "onAfterHide"]); + }), 128); +} +__name(render$O, "render$O"); +script$T.render = render$O; +var theme$t = /* @__PURE__ */ __name(function theme11(_ref) { + var dt = _ref.dt; + return "\n.p-fieldset {\n background: ".concat(dt("fieldset.background"), ";\n border: 1px solid ").concat(dt("fieldset.border.color"), ";\n border-radius: ").concat(dt("fieldset.border.radius"), ";\n color: ").concat(dt("fieldset.color"), ";\n padding: ").concat(dt("fieldset.padding"), ";\n margin: 0;\n}\n\n.p-fieldset-legend {\n background: ").concat(dt("fieldset.legend.background"), ";\n border-radius: ").concat(dt("fieldset.legend.border.radius"), ";\n border-width: ").concat(dt("fieldset.legend.border.width"), ";\n border-style: solid;\n border-color: ").concat(dt("fieldset.legend.border.color"), ";\n padding: ").concat(dt("fieldset.legend.padding"), ";\n transition: background ").concat(dt("fieldset.transition.duration"), ", color ").concat(dt("fieldset.transition.duration"), ", outline-color ").concat(dt("fieldset.transition.duration"), ", box-shadow ").concat(dt("fieldset.transition.duration"), ";\n}\n\n.p-fieldset-toggleable > .p-fieldset-legend {\n padding: 0;\n}\n\n.p-fieldset-toggle-button {\n cursor: pointer;\n user-select: none;\n overflow: hidden;\n position: relative;\n text-decoration: none;\n display: flex;\n gap: ").concat(dt("fieldset.legend.gap"), ";\n align-items: center;\n justify-content: center;\n padding: ").concat(dt("fieldset.legend.padding"), ";\n background: transparent;\n border: 0 none;\n border-radius: ").concat(dt("fieldset.legend.border.radius"), ";\n transition: background ").concat(dt("fieldset.transition.duration"), ", color ").concat(dt("fieldset.transition.duration"), ", outline-color ").concat(dt("fieldset.transition.duration"), ", box-shadow ").concat(dt("fieldset.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-fieldset-legend-label {\n font-weight: ").concat(dt("fieldset.legend.font.weight"), ";\n}\n\n.p-fieldset-toggle-button:focus-visible {\n box-shadow: ").concat(dt("fieldset.legend.focus.ring.shadow"), ";\n outline: ").concat(dt("fieldset.legend.focus.ring.width"), " ").concat(dt("fieldset.legend.focus.ring.style"), " ").concat(dt("fieldset.legend.focus.ring.color"), ";\n outline-offset: ").concat(dt("fieldset.legend.focus.ring.offset"), ";\n}\n\n.p-fieldset-toggleable > .p-fieldset-legend:hover {\n color: ").concat(dt("fieldset.legend.hover.color"), ";\n background: ").concat(dt("fieldset.legend.hover.background"), ";\n}\n\n.p-fieldset-toggle-icon {\n color: ").concat(dt("fieldset.toggle.icon.color"), ";\n transition: color ").concat(dt("fieldset.transition.duration"), ";\n}\n\n.p-fieldset-toggleable > .p-fieldset-legend:hover .p-fieldset-toggle-icon {\n color: ").concat(dt("fieldset.toggle.icon.hover.color"), ";\n}\n\n.p-fieldset .p-fieldset-content {\n padding: ").concat(dt("fieldset.content.padding"), ";\n}\n"); +}, "theme"); +var classes$x = { + root: /* @__PURE__ */ __name(function root11(_ref2) { + var props = _ref2.props; + return ["p-fieldset p-component", { + "p-fieldset-toggleable": props.toggleable + }]; + }, "root"), + legend: "p-fieldset-legend", + legendLabel: "p-fieldset-legend-label", + toggleButton: "p-fieldset-toggle-button", + toggleIcon: "p-fieldset-toggle-icon", + contentContainer: "p-fieldset-content-container", + content: "p-fieldset-content" +}; +var FieldsetStyle = BaseStyle.extend({ + name: "fieldset", + theme: theme$t, + classes: classes$x +}); +var script$1$x = { + name: "BaseFieldset", + "extends": script$1d, + props: { + legend: String, + toggleable: Boolean, + collapsed: Boolean, + toggleButtonProps: { + type: null, + "default": null + } + }, + style: FieldsetStyle, + provide: /* @__PURE__ */ __name(function provide18() { + return { + $pcFieldset: this, + $parentInstance: this + }; + }, "provide") +}; +var script$S = { + name: "Fieldset", + "extends": script$1$x, + inheritAttrs: false, + emits: ["update:collapsed", "toggle"], + data: /* @__PURE__ */ __name(function data12() { + return { + id: this.$attrs.id, + d_collapsed: this.collapsed + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId4(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId"), + collapsed: /* @__PURE__ */ __name(function collapsed(newValue) { + this.d_collapsed = newValue; + }, "collapsed") + }, + mounted: /* @__PURE__ */ __name(function mounted17() { + this.id = this.id || UniqueComponentId(); + }, "mounted"), + methods: { + toggle: /* @__PURE__ */ __name(function toggle(event2) { + this.d_collapsed = !this.d_collapsed; + this.$emit("update:collapsed", this.d_collapsed); + this.$emit("toggle", { + originalEvent: event2, + value: this.d_collapsed + }); + }, "toggle"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown4(event2) { + if (event2.code === "Enter" || event2.code === "NumpadEnter" || event2.code === "Space") { + this.toggle(event2); + event2.preventDefault(); + } + }, "onKeyDown") + }, + computed: { + buttonAriaLabel: /* @__PURE__ */ __name(function buttonAriaLabel() { + return this.toggleButtonProps && this.toggleButtonProps.ariaLabel ? this.toggleButtonProps.ariaLabel : this.legend; + }, "buttonAriaLabel") + }, + directives: { + ripple: Ripple + }, + components: { + PlusIcon: script$1x, + MinusIcon: script$1y + } +}; +function _typeof$i(o) { + "@babel/helpers - typeof"; + return _typeof$i = "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$i(o); +} +__name(_typeof$i, "_typeof$i"); +function ownKeys$g(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$g, "ownKeys$g"); +function _objectSpread$g(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$g(Object(t2), true).forEach(function(r2) { + _defineProperty$h(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$g(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$g, "_objectSpread$g"); +function _defineProperty$h(e, r, t2) { + return (r = _toPropertyKey$h(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$h, "_defineProperty$h"); +function _toPropertyKey$h(t2) { + var i = _toPrimitive$h(t2, "string"); + return "symbol" == _typeof$i(i) ? i : i + ""; +} +__name(_toPropertyKey$h, "_toPropertyKey$h"); +function _toPrimitive$h(t2, r) { + if ("object" != _typeof$i(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$i(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$h, "_toPrimitive$h"); +var _hoisted_1$o = ["id"]; +var _hoisted_2$h = ["id", "aria-controls", "aria-expanded", "aria-label"]; +var _hoisted_3$e = ["id", "aria-labelledby"]; +function render$N(_ctx, _cache, $props, $setup, $data, $options) { + var _directive_ripple = resolveDirective("ripple"); + return openBlock(), createElementBlock("fieldset", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [createBaseVNode("legend", mergeProps({ + "class": _ctx.cx("legend") + }, _ctx.ptm("legend")), [renderSlot(_ctx.$slots, "legend", { + toggleCallback: $options.toggle + }, function() { + return [!_ctx.toggleable ? (openBlock(), createElementBlock("span", mergeProps({ + key: 0, + id: $data.id + "_header", + "class": _ctx.cx("legendLabel") + }, _ctx.ptm("legendLabel")), toDisplayString(_ctx.legend), 17, _hoisted_1$o)) : createCommentVNode("", true), _ctx.toggleable ? withDirectives((openBlock(), createElementBlock("button", mergeProps({ + key: 1, + id: $data.id + "_header", + type: "button", + "aria-controls": $data.id + "_content", + "aria-expanded": !$data.d_collapsed, + "aria-label": $options.buttonAriaLabel, + "class": _ctx.cx("toggleButton"), + onClick: _cache[0] || (_cache[0] = function() { + return $options.toggle && $options.toggle.apply($options, arguments); + }), + onKeydown: _cache[1] || (_cache[1] = function() { + return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); + }) + }, _objectSpread$g(_objectSpread$g({}, _ctx.toggleButtonProps), _ctx.ptm("toggleButton"))), [renderSlot(_ctx.$slots, _ctx.$slots.toggleicon ? "toggleicon" : "togglericon", { + collapsed: $data.d_collapsed, + "class": normalizeClass(_ctx.cx("toggleIcon")) + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent($data.d_collapsed ? "PlusIcon" : "MinusIcon"), mergeProps({ + "class": _ctx.cx("toggleIcon") + }, _ctx.ptm("toggleIcon")), null, 16, ["class"]))]; + }), createBaseVNode("span", mergeProps({ + "class": _ctx.cx("legendLabel") + }, _ctx.ptm("legendLabel")), toDisplayString(_ctx.legend), 17)], 16, _hoisted_2$h)), [[_directive_ripple]]) : createCommentVNode("", true)]; + })], 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)], 16, _hoisted_3$e), [[vShow, !$data.d_collapsed]])]; + }), + _: 3 + }, 16)], 16); +} +__name(render$N, "render$N"); +script$S.render = render$N; +var script$R = { + name: "UploadIcon", + "extends": script$1m +}; +function render$M(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M6.58942 9.82197C6.70165 9.93405 6.85328 9.99793 7.012 10C7.17071 9.99793 7.32234 9.93405 7.43458 9.82197C7.54681 9.7099 7.61079 9.55849 7.61286 9.4V2.04798L9.79204 4.22402C9.84752 4.28011 9.91365 4.32457 9.98657 4.35479C10.0595 4.38502 10.1377 4.40039 10.2167 4.40002C10.2956 4.40039 10.3738 4.38502 10.4467 4.35479C10.5197 4.32457 10.5858 4.28011 10.6413 4.22402C10.7538 4.11152 10.817 3.95902 10.817 3.80002C10.817 3.64102 10.7538 3.48852 10.6413 3.37602L7.45127 0.190618C7.44656 0.185584 7.44176 0.180622 7.43687 0.175736C7.32419 0.063214 7.17136 0 7.012 0C6.85264 0 6.69981 0.063214 6.58712 0.175736C6.58181 0.181045 6.5766 0.186443 6.5715 0.191927L3.38282 3.37602C3.27669 3.48976 3.2189 3.6402 3.22165 3.79564C3.2244 3.95108 3.28746 4.09939 3.39755 4.20932C3.50764 4.31925 3.65616 4.38222 3.81182 4.38496C3.96749 4.3877 4.11814 4.33001 4.23204 4.22402L6.41113 2.04807V9.4C6.41321 9.55849 6.47718 9.7099 6.58942 9.82197ZM11.9952 14H2.02883C1.751 13.9887 1.47813 13.9228 1.22584 13.8061C0.973545 13.6894 0.746779 13.5241 0.558517 13.3197C0.370254 13.1154 0.22419 12.876 0.128681 12.6152C0.0331723 12.3545 -0.00990605 12.0775 0.0019109 11.8V9.40005C0.0019109 9.24092 0.065216 9.08831 0.1779 8.97579C0.290584 8.86326 0.443416 8.80005 0.602775 8.80005C0.762134 8.80005 0.914966 8.86326 1.02765 8.97579C1.14033 9.08831 1.20364 9.24092 1.20364 9.40005V11.8C1.18295 12.0376 1.25463 12.274 1.40379 12.4602C1.55296 12.6463 1.76817 12.7681 2.00479 12.8H11.9952C12.2318 12.7681 12.447 12.6463 12.5962 12.4602C12.7453 12.274 12.817 12.0376 12.7963 11.8V9.40005C12.7963 9.24092 12.8596 9.08831 12.9723 8.97579C13.085 8.86326 13.2378 8.80005 13.3972 8.80005C13.5565 8.80005 13.7094 8.86326 13.8221 8.97579C13.9347 9.08831 13.998 9.24092 13.998 9.40005V11.8C14.022 12.3563 13.8251 12.8996 13.45 13.3116C13.0749 13.7236 12.552 13.971 11.9952 14Z", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$M, "render$M"); +script$R.render = render$M; +var theme$s = /* @__PURE__ */ __name(function theme12(_ref) { + var dt = _ref.dt; + return '\n.p-fileupload input[type="file"] {\n display: none;\n}\n\n.p-fileupload-advanced {\n border: 1px solid '.concat(dt("fileupload.border.color"), ";\n border-radius: ").concat(dt("fileupload.border.radius"), ";\n background: ").concat(dt("fileupload.background"), ";\n color: ").concat(dt("fileupload.color"), ";\n}\n\n.p-fileupload-header {\n display: flex;\n align-items: center;\n padding: ").concat(dt("fileupload.header.padding"), ";\n background: ").concat(dt("fileupload.header.background"), ";\n color: ").concat(dt("fileupload.header.color"), ";\n border-style: solid;\n border-width: ").concat(dt("fileupload.header.border.width"), ";\n border-color: ").concat(dt("fileupload.header.border.color"), ";\n border-radius: ").concat(dt("fileupload.header.border.radius"), ";\n gap: ").concat(dt("fileupload.header.gap"), ";\n}\n\n.p-fileupload-content {\n border: 1px solid transparent;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("fileupload.content.gap"), ";\n transition: border-color ").concat(dt("fileupload.transition.duration"), ";\n padding: ").concat(dt("fileupload.content.padding"), ";\n}\n\n.p-fileupload-content .p-progressbar {\n width: 100%;\n height: ").concat(dt("fileupload.progressbar.height"), ";\n}\n\n.p-fileupload-file-list {\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("fileupload.filelist.gap"), ";\n}\n\n.p-fileupload-file {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n padding: ").concat(dt("fileupload.file.padding"), ";\n border-block-end: 1px solid ").concat(dt("fileupload.file.border.color"), ";\n gap: ").concat(dt("fileupload.file.gap"), ";\n}\n\n.p-fileupload-file:last-child {\n border-block-end: 0;\n}\n\n.p-fileupload-file-info {\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("fileupload.file.info.gap"), ";\n}\n\n.p-fileupload-file-thumbnail {\n flex-shrink: 0;\n}\n\n.p-fileupload-file-actions {\n margin-inline-start: auto;\n}\n\n.p-fileupload-highlight {\n border: 1px dashed ").concat(dt("fileupload.content.highlight.border.color"), ";\n}\n\n.p-fileupload-basic {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n gap: ").concat(dt("fileupload.basic.gap"), ";\n}\n"); +}, "theme"); +var classes$w = { + root: /* @__PURE__ */ __name(function root12(_ref2) { + var props = _ref2.props; + return ["p-fileupload p-fileupload-".concat(props.mode, " p-component")]; + }, "root"), + header: "p-fileupload-header", + pcChooseButton: "p-fileupload-choose-button", + pcUploadButton: "p-fileupload-upload-button", + pcCancelButton: "p-fileupload-cancel-button", + content: "p-fileupload-content", + fileList: "p-fileupload-file-list", + file: "p-fileupload-file", + fileThumbnail: "p-fileupload-file-thumbnail", + fileInfo: "p-fileupload-file-info", + fileName: "p-fileupload-file-name", + fileSize: "p-fileupload-file-size", + pcFileBadge: "p-fileupload-file-badge", + fileActions: "p-fileupload-file-actions", + pcFileRemoveButton: "p-fileupload-file-remove-button" +}; +var FileUploadStyle = BaseStyle.extend({ + name: "fileupload", + theme: theme$s, + classes: classes$w +}); +var script$2$6 = { + name: "BaseFileUpload", + "extends": script$1d, + props: { + name: { + type: String, + "default": null + }, + url: { + type: String, + "default": null + }, + mode: { + type: String, + "default": "advanced" + }, + multiple: { + type: Boolean, + "default": false + }, + accept: { + type: String, + "default": null + }, + disabled: { + type: Boolean, + "default": false + }, + auto: { + type: Boolean, + "default": false + }, + maxFileSize: { + type: Number, + "default": null + }, + invalidFileSizeMessage: { + type: String, + "default": "{0}: Invalid file size, file size should be smaller than {1}." + }, + invalidFileTypeMessage: { + type: String, + "default": "{0}: Invalid file type, allowed file types: {1}." + }, + fileLimit: { + type: Number, + "default": null + }, + invalidFileLimitMessage: { + type: String, + "default": "Maximum number of files exceeded, limit is {0} at most." + }, + withCredentials: { + type: Boolean, + "default": false + }, + previewWidth: { + type: Number, + "default": 50 + }, + chooseLabel: { + type: String, + "default": null + }, + uploadLabel: { + type: String, + "default": null + }, + cancelLabel: { + type: String, + "default": null + }, + customUpload: { + type: Boolean, + "default": false + }, + showUploadButton: { + type: Boolean, + "default": true + }, + showCancelButton: { + type: Boolean, + "default": true + }, + chooseIcon: { + type: String, + "default": void 0 + }, + uploadIcon: { + type: String, + "default": void 0 + }, + cancelIcon: { + type: String, + "default": void 0 + }, + style: null, + "class": null, + chooseButtonProps: { + type: null, + "default": null + }, + uploadButtonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default7() { + return { + severity: "secondary" + }; + }, "_default") + }, + cancelButtonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default8() { + return { + severity: "secondary" + }; + }, "_default") + } + }, + style: FileUploadStyle, + provide: /* @__PURE__ */ __name(function provide19() { + return { + $pcFileUpload: this, + $parentInstance: this + }; + }, "provide") +}; +var script$1$w = { + name: "FileContent", + hostName: "FileUpload", + "extends": script$1d, + emits: ["remove"], + props: { + files: { + type: Array, + "default": /* @__PURE__ */ __name(function _default9() { + return []; + }, "_default") + }, + badgeSeverity: { + type: String, + "default": "warn" + }, + badgeValue: { + type: String, + "default": null + }, + previewWidth: { + type: Number, + "default": 50 + }, + templates: { + type: null, + "default": null + } + }, + methods: { + formatSize: /* @__PURE__ */ __name(function formatSize(bytes) { + var _this$$primevue$confi; + var k = 1024; + var dm = 3; + var sizes = ((_this$$primevue$confi = this.$primevue.config.locale) === null || _this$$primevue$confi === void 0 ? void 0 : _this$$primevue$confi.fileSizeTypes) || ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; + if (bytes === 0) { + return "0 ".concat(sizes[0]); + } + var i = Math.floor(Math.log(bytes) / Math.log(k)); + var formattedSize = parseFloat((bytes / Math.pow(k, i)).toFixed(dm)); + return "".concat(formattedSize, " ").concat(sizes[i]); + }, "formatSize") + }, + components: { + Button: script$1e, + Badge: script$1z, + TimesIcon: script$1g + } +}; +var _hoisted_1$1$5 = ["alt", "src", "width"]; +function render$1$6(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Badge = resolveComponent("Badge"); + var _component_TimesIcon = resolveComponent("TimesIcon"); + var _component_Button = resolveComponent("Button"); + return openBlock(true), createElementBlock(Fragment, null, renderList($props.files, function(file, index) { + return openBlock(), createElementBlock("div", mergeProps({ + key: file.name + file.type + file.size, + "class": _ctx.cx("file"), + ref_for: true + }, _ctx.ptm("file")), [createBaseVNode("img", mergeProps({ + role: "presentation", + "class": _ctx.cx("fileThumbnail"), + alt: file.name, + src: file.objectURL, + width: $props.previewWidth, + ref_for: true + }, _ctx.ptm("fileThumbnail")), null, 16, _hoisted_1$1$5), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("fileInfo"), + ref_for: true + }, _ctx.ptm("fileInfo")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("fileName"), + ref_for: true + }, _ctx.ptm("fileName")), toDisplayString(file.name), 17), createBaseVNode("span", mergeProps({ + "class": _ctx.cx("fileSize"), + ref_for: true + }, _ctx.ptm("fileSize")), toDisplayString($options.formatSize(file.size)), 17)], 16), createVNode(_component_Badge, { + value: $props.badgeValue, + "class": normalizeClass(_ctx.cx("pcFileBadge")), + severity: $props.badgeSeverity, + unstyled: _ctx.unstyled, + pt: _ctx.ptm("pcFileBadge") + }, null, 8, ["value", "class", "severity", "unstyled", "pt"]), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("fileActions"), + ref_for: true + }, _ctx.ptm("fileActions")), [createVNode(_component_Button, { + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return _ctx.$emit("remove", index); + }, "onClick"), + text: "", + rounded: "", + severity: "danger", + "class": normalizeClass(_ctx.cx("pcFileRemoveButton")), + unstyled: _ctx.unstyled, + pt: _ctx.ptm("pcFileRemoveButton") + }, { + icon: withCtx(function(iconProps) { + return [$props.templates.fileremoveicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.fileremoveicon), { + key: 0, + "class": normalizeClass(iconProps["class"]), + file, + index + }, null, 8, ["class", "file", "index"])) : (openBlock(), createBlock(_component_TimesIcon, mergeProps({ + key: 1, + "class": iconProps["class"], + "aria-hidden": "true", + ref_for: true + }, _ctx.ptm("pcFileRemoveButton")["icon"]), null, 16, ["class"]))]; + }), + _: 2 + }, 1032, ["onClick", "class", "unstyled", "pt"])], 16)], 16); + }), 128); +} +__name(render$1$6, "render$1$6"); +script$1$w.render = render$1$6; +function _toConsumableArray$9(r) { + return _arrayWithoutHoles$9(r) || _iterableToArray$9(r) || _unsupportedIterableToArray$a(r) || _nonIterableSpread$9(); +} +__name(_toConsumableArray$9, "_toConsumableArray$9"); +function _nonIterableSpread$9() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableSpread$9, "_nonIterableSpread$9"); +function _iterableToArray$9(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray$9, "_iterableToArray$9"); +function _arrayWithoutHoles$9(r) { + if (Array.isArray(r)) return _arrayLikeToArray$a(r); +} +__name(_arrayWithoutHoles$9, "_arrayWithoutHoles$9"); +function _createForOfIteratorHelper$3(r, e) { + var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (!t2) { + if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$a(r)) || e) { + t2 && (r = t2); + var _n = 0, F = /* @__PURE__ */ __name(function F2() { + }, "F"); + return { s: F, n: /* @__PURE__ */ __name(function n() { + return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; + }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { + throw r2; + }, "e"), 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 = true, u = false; + return { s: /* @__PURE__ */ __name(function s() { + t2 = t2.call(r); + }, "s"), n: /* @__PURE__ */ __name(function n() { + var r2 = t2.next(); + return a = r2.done, r2; + }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { + u = true, o = r2; + }, "e"), f: /* @__PURE__ */ __name(function f() { + try { + a || null == t2["return"] || t2["return"](); + } finally { + if (u) throw o; + } + }, "f") }; +} +__name(_createForOfIteratorHelper$3, "_createForOfIteratorHelper$3"); +function _unsupportedIterableToArray$a(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$a(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$a(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$a, "_unsupportedIterableToArray$a"); +function _arrayLikeToArray$a(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; +} +__name(_arrayLikeToArray$a, "_arrayLikeToArray$a"); +var script$Q = { + name: "FileUpload", + "extends": script$2$6, + inheritAttrs: false, + emits: ["select", "uploader", "before-upload", "progress", "upload", "error", "before-send", "clear", "remove", "remove-uploaded-file"], + duplicateIEEvent: false, + data: /* @__PURE__ */ __name(function data13() { + return { + uploadedFileCount: 0, + files: [], + messages: [], + focused: false, + progress: null, + uploadedFiles: [] + }; + }, "data"), + methods: { + upload: /* @__PURE__ */ __name(function upload() { + if (this.hasFiles) this.uploader(); + }, "upload"), + onBasicUploaderClick: /* @__PURE__ */ __name(function onBasicUploaderClick(event2) { + if (event2.button === 0) this.$refs.fileInput.click(); + }, "onBasicUploaderClick"), + onFileSelect: /* @__PURE__ */ __name(function onFileSelect(event2) { + if (event2.type !== "drop" && this.isIE11() && this.duplicateIEEvent) { + this.duplicateIEEvent = false; + return; + } + if (this.isBasic && this.hasFiles) { + this.files = []; + } + this.messages = []; + this.files = this.files || []; + var files = event2.dataTransfer ? event2.dataTransfer.files : event2.target.files; + var _iterator = _createForOfIteratorHelper$3(files), _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + var file = _step.value; + if (!this.isFileSelected(file) && !this.isFileLimitExceeded()) { + if (this.validate(file)) { + if (this.isImage(file)) { + file.objectURL = window.URL.createObjectURL(file); + } + this.files.push(file); + } + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + this.$emit("select", { + originalEvent: event2, + files: this.files + }); + if (this.fileLimit) { + this.checkFileLimit(); + } + if (this.auto && this.hasFiles && !this.isFileLimitExceeded()) { + this.uploader(); + } + if (event2.type !== "drop" && this.isIE11()) { + this.clearIEInput(); + } else { + this.clearInputElement(); + } + }, "onFileSelect"), + choose: /* @__PURE__ */ __name(function choose() { + this.$refs.fileInput.click(); + }, "choose"), + uploader: /* @__PURE__ */ __name(function uploader() { + var _this = this; + if (this.customUpload) { + if (this.fileLimit) { + this.uploadedFileCount += this.files.length; + } + this.$emit("uploader", { + files: this.files + }); + this.clear(); + } else { + var xhr = new XMLHttpRequest(); + var formData = new FormData(); + this.$emit("before-upload", { + xhr, + formData + }); + var _iterator2 = _createForOfIteratorHelper$3(this.files), _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { + var file = _step2.value; + formData.append(this.name, file, file.name); + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + xhr.upload.addEventListener("progress", function(event2) { + if (event2.lengthComputable) { + _this.progress = Math.round(event2.loaded * 100 / event2.total); + } + _this.$emit("progress", { + originalEvent: event2, + progress: _this.progress + }); + }); + xhr.onreadystatechange = function() { + if (xhr.readyState === 4) { + var _this$uploadedFiles; + _this.progress = 0; + if (xhr.status >= 200 && xhr.status < 300) { + if (_this.fileLimit) { + _this.uploadedFileCount += _this.files.length; + } + _this.$emit("upload", { + xhr, + files: _this.files + }); + } else { + _this.$emit("error", { + xhr, + files: _this.files + }); + } + (_this$uploadedFiles = _this.uploadedFiles).push.apply(_this$uploadedFiles, _toConsumableArray$9(_this.files)); + _this.clear(); + } + }; + xhr.open("POST", this.url, true); + this.$emit("before-send", { + xhr, + formData + }); + xhr.withCredentials = this.withCredentials; + xhr.send(formData); + } + }, "uploader"), + clear: /* @__PURE__ */ __name(function clear() { + this.files = []; + this.messages = null; + this.$emit("clear"); + if (this.isAdvanced) { + this.clearInputElement(); + } + }, "clear"), + onFocus: /* @__PURE__ */ __name(function onFocus5() { + this.focused = true; + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur4() { + this.focused = false; + }, "onBlur"), + isFileSelected: /* @__PURE__ */ __name(function isFileSelected(file) { + if (this.files && this.files.length) { + var _iterator3 = _createForOfIteratorHelper$3(this.files), _step3; + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { + var sFile = _step3.value; + if (sFile.name + sFile.type + sFile.size === file.name + file.type + file.size) return true; + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + } + return false; + }, "isFileSelected"), + isIE11: /* @__PURE__ */ __name(function isIE11() { + return !!window["MSInputMethodContext"] && !!document["documentMode"]; + }, "isIE11"), + validate: /* @__PURE__ */ __name(function validate(file) { + if (this.accept && !this.isFileTypeValid(file)) { + this.messages.push(this.invalidFileTypeMessage.replace("{0}", file.name).replace("{1}", this.accept)); + return false; + } + if (this.maxFileSize && file.size > this.maxFileSize) { + this.messages.push(this.invalidFileSizeMessage.replace("{0}", file.name).replace("{1}", this.formatSize(this.maxFileSize))); + return false; + } + return true; + }, "validate"), + isFileTypeValid: /* @__PURE__ */ __name(function isFileTypeValid(file) { + var acceptableTypes = this.accept.split(",").map(function(type2) { + return type2.trim(); + }); + var _iterator4 = _createForOfIteratorHelper$3(acceptableTypes), _step4; + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) { + var type = _step4.value; + var acceptable = this.isWildcard(type) ? this.getTypeClass(file.type) === this.getTypeClass(type) : file.type == type || this.getFileExtension(file).toLowerCase() === type.toLowerCase(); + if (acceptable) { + return true; + } + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + return false; + }, "isFileTypeValid"), + getTypeClass: /* @__PURE__ */ __name(function getTypeClass(fileType) { + return fileType.substring(0, fileType.indexOf("/")); + }, "getTypeClass"), + isWildcard: /* @__PURE__ */ __name(function isWildcard(fileType) { + return fileType.indexOf("*") !== -1; + }, "isWildcard"), + getFileExtension: /* @__PURE__ */ __name(function getFileExtension(file) { + return "." + file.name.split(".").pop(); + }, "getFileExtension"), + isImage: /* @__PURE__ */ __name(function isImage(file) { + return /^image\//.test(file.type); + }, "isImage"), + onDragEnter: /* @__PURE__ */ __name(function onDragEnter(event2) { + if (!this.disabled) { + event2.stopPropagation(); + event2.preventDefault(); + } + }, "onDragEnter"), + onDragOver: /* @__PURE__ */ __name(function onDragOver(event2) { + if (!this.disabled) { + !this.isUnstyled && addClass(this.$refs.content, "p-fileupload-highlight"); + this.$refs.content.setAttribute("data-p-highlight", true); + event2.stopPropagation(); + event2.preventDefault(); + } + }, "onDragOver"), + onDragLeave: /* @__PURE__ */ __name(function onDragLeave() { + if (!this.disabled) { + !this.isUnstyled && removeClass(this.$refs.content, "p-fileupload-highlight"); + this.$refs.content.setAttribute("data-p-highlight", false); + } + }, "onDragLeave"), + onDrop: /* @__PURE__ */ __name(function onDrop(event2) { + if (!this.disabled) { + !this.isUnstyled && removeClass(this.$refs.content, "p-fileupload-highlight"); + this.$refs.content.setAttribute("data-p-highlight", false); + event2.stopPropagation(); + event2.preventDefault(); + var files = event2.dataTransfer ? event2.dataTransfer.files : event2.target.files; + var allowDrop = this.multiple || files && files.length === 1; + if (allowDrop) { + this.onFileSelect(event2); + } + } + }, "onDrop"), + remove: /* @__PURE__ */ __name(function remove(index) { + this.clearInputElement(); + var removedFile = this.files.splice(index, 1)[0]; + this.files = _toConsumableArray$9(this.files); + this.$emit("remove", { + file: removedFile, + files: this.files + }); + }, "remove"), + removeUploadedFile: /* @__PURE__ */ __name(function removeUploadedFile(index) { + var removedFile = this.uploadedFiles.splice(index, 1)[0]; + this.uploadedFiles = _toConsumableArray$9(this.uploadedFiles); + this.$emit("remove-uploaded-file", { + file: removedFile, + files: this.uploadedFiles + }); + }, "removeUploadedFile"), + clearInputElement: /* @__PURE__ */ __name(function clearInputElement() { + this.$refs.fileInput.value = ""; + }, "clearInputElement"), + clearIEInput: /* @__PURE__ */ __name(function clearIEInput() { + if (this.$refs.fileInput) { + this.duplicateIEEvent = true; + this.$refs.fileInput.value = ""; + } + }, "clearIEInput"), + formatSize: /* @__PURE__ */ __name(function formatSize2(bytes) { + var _this$$primevue$confi; + var k = 1024; + var dm = 3; + var sizes = ((_this$$primevue$confi = this.$primevue.config.locale) === null || _this$$primevue$confi === void 0 ? void 0 : _this$$primevue$confi.fileSizeTypes) || ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; + if (bytes === 0) { + return "0 ".concat(sizes[0]); + } + var i = Math.floor(Math.log(bytes) / Math.log(k)); + var formattedSize = parseFloat((bytes / Math.pow(k, i)).toFixed(dm)); + return "".concat(formattedSize, " ").concat(sizes[i]); + }, "formatSize"), + isFileLimitExceeded: /* @__PURE__ */ __name(function isFileLimitExceeded() { + if (this.fileLimit && this.fileLimit <= this.files.length + this.uploadedFileCount && this.focused) { + this.focused = false; + } + return this.fileLimit && this.fileLimit < this.files.length + this.uploadedFileCount; + }, "isFileLimitExceeded"), + checkFileLimit: /* @__PURE__ */ __name(function checkFileLimit() { + if (this.isFileLimitExceeded()) { + this.messages.push(this.invalidFileLimitMessage.replace("{0}", this.fileLimit.toString())); + } + }, "checkFileLimit"), + onMessageClose: /* @__PURE__ */ __name(function onMessageClose() { + this.messages = null; + }, "onMessageClose") + }, + computed: { + isAdvanced: /* @__PURE__ */ __name(function isAdvanced() { + return this.mode === "advanced"; + }, "isAdvanced"), + isBasic: /* @__PURE__ */ __name(function isBasic() { + return this.mode === "basic"; + }, "isBasic"), + chooseButtonClass: /* @__PURE__ */ __name(function chooseButtonClass() { + return [this.cx("pcChooseButton"), this["class"]]; + }, "chooseButtonClass"), + basicFileChosenLabel: /* @__PURE__ */ __name(function basicFileChosenLabel() { + var _this$$primevue$confi3; + if (this.auto) return this.chooseButtonLabel; + else if (this.hasFiles) { + var _this$$primevue$confi2; + if (this.files && this.files.length === 1) return this.files[0].name; + return (_this$$primevue$confi2 = this.$primevue.config.locale) === null || _this$$primevue$confi2 === void 0 || (_this$$primevue$confi2 = _this$$primevue$confi2.fileChosenMessage) === null || _this$$primevue$confi2 === void 0 ? void 0 : _this$$primevue$confi2.replace("{0}", this.files.length); + } + return ((_this$$primevue$confi3 = this.$primevue.config.locale) === null || _this$$primevue$confi3 === void 0 ? void 0 : _this$$primevue$confi3.noFileChosenMessage) || ""; + }, "basicFileChosenLabel"), + hasFiles: /* @__PURE__ */ __name(function hasFiles() { + return this.files && this.files.length > 0; + }, "hasFiles"), + hasUploadedFiles: /* @__PURE__ */ __name(function hasUploadedFiles() { + return this.uploadedFiles && this.uploadedFiles.length > 0; + }, "hasUploadedFiles"), + chooseDisabled: /* @__PURE__ */ __name(function chooseDisabled() { + return this.disabled || this.fileLimit && this.fileLimit <= this.files.length + this.uploadedFileCount; + }, "chooseDisabled"), + uploadDisabled: /* @__PURE__ */ __name(function uploadDisabled() { + return this.disabled || !this.hasFiles || this.fileLimit && this.fileLimit < this.files.length; + }, "uploadDisabled"), + cancelDisabled: /* @__PURE__ */ __name(function cancelDisabled() { + return this.disabled || !this.hasFiles; + }, "cancelDisabled"), + chooseButtonLabel: /* @__PURE__ */ __name(function chooseButtonLabel() { + return this.chooseLabel || this.$primevue.config.locale.choose; + }, "chooseButtonLabel"), + uploadButtonLabel: /* @__PURE__ */ __name(function uploadButtonLabel() { + return this.uploadLabel || this.$primevue.config.locale.upload; + }, "uploadButtonLabel"), + cancelButtonLabel: /* @__PURE__ */ __name(function cancelButtonLabel() { + return this.cancelLabel || this.$primevue.config.locale.cancel; + }, "cancelButtonLabel"), + completedLabel: /* @__PURE__ */ __name(function completedLabel() { + return this.$primevue.config.locale.completed; + }, "completedLabel"), + pendingLabel: /* @__PURE__ */ __name(function pendingLabel() { + return this.$primevue.config.locale.pending; + }, "pendingLabel") + }, + components: { + Button: script$1e, + ProgressBar: script$1A, + Message: script$1B, + FileContent: script$1$w, + PlusIcon: script$1x, + UploadIcon: script$R, + TimesIcon: script$1g + }, + directives: { + ripple: Ripple + } +}; +var _hoisted_1$n = ["multiple", "accept", "disabled"]; +var _hoisted_2$g = ["files"]; +var _hoisted_3$d = ["accept", "disabled", "multiple"]; +function render$L(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Button = resolveComponent("Button"); + var _component_ProgressBar = resolveComponent("ProgressBar"); + var _component_Message = resolveComponent("Message"); + var _component_FileContent = resolveComponent("FileContent"); + return $options.isAdvanced ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [createBaseVNode("input", mergeProps({ + ref: "fileInput", + type: "file", + onChange: _cache[0] || (_cache[0] = function() { + return $options.onFileSelect && $options.onFileSelect.apply($options, arguments); + }), + multiple: _ctx.multiple, + accept: _ctx.accept, + disabled: $options.chooseDisabled + }, _ctx.ptm("input")), null, 16, _hoisted_1$n), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("header") + }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header", { + files: $data.files, + uploadedFiles: $data.uploadedFiles, + chooseCallback: $options.choose, + uploadCallback: $options.uploader, + clearCallback: $options.clear + }, function() { + return [createVNode(_component_Button, mergeProps({ + label: $options.chooseButtonLabel, + "class": $options.chooseButtonClass, + style: _ctx.style, + disabled: _ctx.disabled, + unstyled: _ctx.unstyled, + onClick: $options.choose, + onKeydown: withKeys($options.choose, ["enter"]), + onFocus: $options.onFocus, + onBlur: $options.onBlur + }, _ctx.chooseButtonProps, { + pt: _ctx.ptm("pcChooseButton") + }), { + icon: withCtx(function(iconProps) { + return [renderSlot(_ctx.$slots, "chooseicon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.chooseIcon ? "span" : "PlusIcon"), mergeProps({ + "class": [iconProps["class"], _ctx.chooseIcon], + "aria-hidden": "true" + }, _ctx.ptm("pcChooseButton")["icon"]), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["label", "class", "style", "disabled", "unstyled", "onClick", "onKeydown", "onFocus", "onBlur", "pt"]), _ctx.showUploadButton ? (openBlock(), createBlock(_component_Button, mergeProps({ + key: 0, + "class": _ctx.cx("pcUploadButton"), + label: $options.uploadButtonLabel, + onClick: $options.uploader, + disabled: $options.uploadDisabled, + unstyled: _ctx.unstyled + }, _ctx.uploadButtonProps, { + pt: _ctx.ptm("pcUploadButton") + }), { + icon: withCtx(function(iconProps) { + return [renderSlot(_ctx.$slots, "uploadicon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.uploadIcon ? "span" : "UploadIcon"), mergeProps({ + "class": [iconProps["class"], _ctx.uploadIcon], + "aria-hidden": "true" + }, _ctx.ptm("pcUploadButton")["icon"], { + "data-pc-section": "uploadbuttonicon" + }), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "label", "onClick", "disabled", "unstyled", "pt"])) : createCommentVNode("", true), _ctx.showCancelButton ? (openBlock(), createBlock(_component_Button, mergeProps({ + key: 1, + "class": _ctx.cx("pcCancelButton"), + label: $options.cancelButtonLabel, + onClick: $options.clear, + disabled: $options.cancelDisabled, + unstyled: _ctx.unstyled + }, _ctx.cancelButtonProps, { + pt: _ctx.ptm("pcCancelButton") + }), { + icon: withCtx(function(iconProps) { + return [renderSlot(_ctx.$slots, "cancelicon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.cancelIcon ? "span" : "TimesIcon"), mergeProps({ + "class": [iconProps["class"], _ctx.cancelIcon], + "aria-hidden": "true" + }, _ctx.ptm("pcCancelButton")["icon"], { + "data-pc-section": "cancelbuttonicon" + }), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "label", "onClick", "disabled", "unstyled", "pt"])) : createCommentVNode("", true)]; + })], 16), createBaseVNode("div", mergeProps({ + ref: "content", + "class": _ctx.cx("content"), + onDragenter: _cache[1] || (_cache[1] = function() { + return $options.onDragEnter && $options.onDragEnter.apply($options, arguments); + }), + onDragover: _cache[2] || (_cache[2] = function() { + return $options.onDragOver && $options.onDragOver.apply($options, arguments); + }), + onDragleave: _cache[3] || (_cache[3] = function() { + return $options.onDragLeave && $options.onDragLeave.apply($options, arguments); + }), + onDrop: _cache[4] || (_cache[4] = function() { + return $options.onDrop && $options.onDrop.apply($options, arguments); + }) + }, _ctx.ptm("content"), { + "data-p-highlight": false + }), [renderSlot(_ctx.$slots, "content", { + files: $data.files, + uploadedFiles: $data.uploadedFiles, + removeUploadedFileCallback: $options.removeUploadedFile, + removeFileCallback: $options.remove, + progress: $data.progress, + messages: $data.messages + }, function() { + return [$options.hasFiles ? (openBlock(), createBlock(_component_ProgressBar, { + key: 0, + value: $data.progress, + showValue: false, + unstyled: _ctx.unstyled, + pt: _ctx.ptm("pcProgressbar") + }, null, 8, ["value", "unstyled", "pt"])) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList($data.messages, function(msg) { + return openBlock(), createBlock(_component_Message, { + key: msg, + severity: "error", + onClose: $options.onMessageClose, + unstyled: _ctx.unstyled, + pt: _ctx.ptm("pcMessage") + }, { + "default": withCtx(function() { + return [createTextVNode(toDisplayString(msg), 1)]; + }), + _: 2 + }, 1032, ["onClose", "unstyled", "pt"]); + }), 128)), $options.hasFiles ? (openBlock(), createElementBlock("div", { + key: 1, + "class": normalizeClass(_ctx.cx("fileList")) + }, [createVNode(_component_FileContent, { + files: $data.files, + onRemove: $options.remove, + badgeValue: $options.pendingLabel, + previewWidth: _ctx.previewWidth, + templates: _ctx.$slots, + unstyled: _ctx.unstyled, + pt: _ctx.pt + }, null, 8, ["files", "onRemove", "badgeValue", "previewWidth", "templates", "unstyled", "pt"])], 2)) : createCommentVNode("", true), $options.hasUploadedFiles ? (openBlock(), createElementBlock("div", { + key: 2, + "class": normalizeClass(_ctx.cx("fileList")) + }, [createVNode(_component_FileContent, { + files: $data.uploadedFiles, + onRemove: $options.removeUploadedFile, + badgeValue: $options.completedLabel, + badgeSeverity: "success", + previewWidth: _ctx.previewWidth, + templates: _ctx.$slots, + unstyled: _ctx.unstyled, + pt: _ctx.pt + }, null, 8, ["files", "onRemove", "badgeValue", "previewWidth", "templates", "unstyled", "pt"])], 2)) : createCommentVNode("", true)]; + }), _ctx.$slots.empty && !$options.hasFiles && !$options.hasUploadedFiles ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ + key: 0 + }, _ctx.ptm("empty"))), [renderSlot(_ctx.$slots, "empty")], 16)) : createCommentVNode("", true)], 16)], 16)) : $options.isBasic ? (openBlock(), createElementBlock("div", mergeProps({ + key: 1, + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [(openBlock(true), createElementBlock(Fragment, null, renderList($data.messages, function(msg) { + return openBlock(), createBlock(_component_Message, { + key: msg, + severity: "error", + onClose: $options.onMessageClose, + unstyled: _ctx.unstyled, + pt: _ctx.ptm("pcMessage") + }, { + "default": withCtx(function() { + return [createTextVNode(toDisplayString(msg), 1)]; + }), + _: 2 + }, 1032, ["onClose", "unstyled", "pt"]); + }), 128)), createVNode(_component_Button, mergeProps({ + label: $options.chooseButtonLabel, + "class": $options.chooseButtonClass, + style: _ctx.style, + disabled: _ctx.disabled, + unstyled: _ctx.unstyled, + onMouseup: $options.onBasicUploaderClick, + onKeydown: withKeys($options.choose, ["enter"]), + onFocus: $options.onFocus, + onBlur: $options.onBlur + }, _ctx.chooseButtonProps, { + pt: _ctx.ptm("pcChooseButton") + }), { + icon: withCtx(function(iconProps) { + return [renderSlot(_ctx.$slots, "chooseicon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.chooseIcon ? "span" : "PlusIcon"), mergeProps({ + "class": [iconProps["class"], _ctx.chooseIcon], + "aria-hidden": "true" + }, _ctx.ptm("pcChooseButton")["icon"]), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["label", "class", "style", "disabled", "unstyled", "onMouseup", "onKeydown", "onFocus", "onBlur", "pt"]), !_ctx.auto ? renderSlot(_ctx.$slots, "filelabel", { + key: 0, + "class": normalizeClass(_ctx.cx("filelabel")) + }, function() { + return [createBaseVNode("span", { + "class": normalizeClass(_ctx.cx("filelabel")), + files: $data.files + }, toDisplayString($options.basicFileChosenLabel), 11, _hoisted_2$g)]; + }) : createCommentVNode("", true), createBaseVNode("input", mergeProps({ + ref: "fileInput", + type: "file", + accept: _ctx.accept, + disabled: _ctx.disabled, + multiple: _ctx.multiple, + onChange: _cache[5] || (_cache[5] = function() { + return $options.onFileSelect && $options.onFileSelect.apply($options, arguments); + }), + onFocus: _cache[6] || (_cache[6] = function() { + return $options.onFocus && $options.onFocus.apply($options, arguments); + }), + onBlur: _cache[7] || (_cache[7] = function() { + return $options.onBlur && $options.onBlur.apply($options, arguments); + }) + }, _ctx.ptm("input")), null, 16, _hoisted_3$d)], 16)) : createCommentVNode("", true); +} +__name(render$L, "render$L"); +script$Q.render = render$L; +var classes$v = { + root: "p-fluid" +}; +var FluidStyle = BaseStyle.extend({ + name: "fluid", + classes: classes$v +}); +var script$1$v = { + name: "BaseFluid", + "extends": script$1d, + style: FluidStyle, + provide: /* @__PURE__ */ __name(function provide20() { + return { + $pcFluid: this, + $parentInstance: this + }; + }, "provide") +}; +var script$P = { + name: "Fluid", + "extends": script$1$v, + inheritAttrs: false +}; +function render$K(_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$K, "render$K"); +script$P.render = render$K; +var theme$r = /* @__PURE__ */ __name(function theme13(_ref) { + var dt = _ref.dt; + return "\n.p-iftalabel {\n display: block;\n position: relative;\n}\n\n.p-iftalabel label {\n position: absolute;\n pointer-events: none;\n top: ".concat(dt("iftalabel.top"), ";\n transition-property: all;\n transition-timing-function: ease;\n line-height: 1;\n font-size: ").concat(dt("iftalabel.font.size"), ";\n font-weight: ").concat(dt("iftalabel.font.weight"), ";\n inset-inline-start: ").concat(dt("iftalabel.position.x"), ";\n color: ").concat(dt("iftalabel.color"), ";\n transition-duration: ").concat(dt("iftalabel.transition.duration"), ";\n}\n\n.p-iftalabel .p-inputtext,\n.p-iftalabel .p-textarea,\n.p-iftalabel .p-select-label,\n.p-iftalabel .p-multiselect-label,\n.p-iftalabel .p-autocomplete-input-multiple,\n.p-iftalabel .p-cascadeselect-label,\n.p-iftalabel .p-treeselect-label {\n padding-block-start: ").concat(dt("iftalabel.input.padding.top"), ";\n padding-block-end: ").concat(dt("iftalabel.input.padding.bottom"), ";\n}\n\n.p-iftalabel:has(.p-invalid) label {\n color: ").concat(dt("iftalabel.invalid.color"), ";\n}\n\n.p-iftalabel:has(input:focus) label,\n.p-iftalabel:has(input:-webkit-autofill) label,\n.p-iftalabel:has(textarea:focus) label,\n.p-iftalabel:has(.p-inputwrapper-focus) label {\n color: ").concat(dt("iftalabel.focus.color"), ";\n}\n\n.p-iftalabel .p-inputicon {\n top: ").concat(dt("iftalabel.input.padding.top"), ";\n transform: translateY(25%);\n margin-top: 0;\n}\n"); +}, "theme"); +var classes$u = { + root: "p-iftalabel" +}; +var IftaLabelStyle = BaseStyle.extend({ + name: "iftalabel", + theme: theme$r, + classes: classes$u +}); +var script$1$u = { + name: "BaseIftaLabel", + "extends": script$1d, + style: IftaLabelStyle, + provide: /* @__PURE__ */ __name(function provide21() { + return { + $pcIftaLabel: this, + $parentInstance: this + }; + }, "provide") +}; +var script$O = { + name: "IftaLabel", + "extends": script$1$u, + inheritAttrs: false +}; +function render$J(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("span", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16); +} +__name(render$J, "render$J"); +script$O.render = render$J; +var script$N = { + name: "EyeIcon", + "extends": script$1m +}; +function render$I(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M0.0535499 7.25213C0.208567 7.59162 2.40413 12.4 7 12.4C11.5959 12.4 13.7914 7.59162 13.9465 7.25213C13.9487 7.2471 13.9506 7.24304 13.952 7.24001C13.9837 7.16396 14 7.08239 14 7.00001C14 6.91762 13.9837 6.83605 13.952 6.76001C13.9506 6.75697 13.9487 6.75292 13.9465 6.74788C13.7914 6.4084 11.5959 1.60001 7 1.60001C2.40413 1.60001 0.208567 6.40839 0.0535499 6.74788C0.0512519 6.75292 0.0494023 6.75697 0.048 6.76001C0.0163137 6.83605 0 6.91762 0 7.00001C0 7.08239 0.0163137 7.16396 0.048 7.24001C0.0494023 7.24304 0.0512519 7.2471 0.0535499 7.25213ZM7 11.2C3.664 11.2 1.736 7.92001 1.264 7.00001C1.736 6.08001 3.664 2.80001 7 2.80001C10.336 2.80001 12.264 6.08001 12.736 7.00001C12.264 7.92001 10.336 11.2 7 11.2ZM5.55551 9.16182C5.98308 9.44751 6.48576 9.6 7 9.6C7.68891 9.59789 8.349 9.32328 8.83614 8.83614C9.32328 8.349 9.59789 7.68891 9.59999 7C9.59999 6.48576 9.44751 5.98308 9.16182 5.55551C8.87612 5.12794 8.47006 4.7947 7.99497 4.59791C7.51988 4.40112 6.99711 4.34963 6.49276 4.44995C5.98841 4.55027 5.52513 4.7979 5.16152 5.16152C4.7979 5.52513 4.55027 5.98841 4.44995 6.49276C4.34963 6.99711 4.40112 7.51988 4.59791 7.99497C4.7947 8.47006 5.12794 8.87612 5.55551 9.16182ZM6.2222 5.83594C6.45243 5.6821 6.7231 5.6 7 5.6C7.37065 5.6021 7.72553 5.75027 7.98762 6.01237C8.24972 6.27446 8.39789 6.62934 8.4 7C8.4 7.27689 8.31789 7.54756 8.16405 7.77779C8.01022 8.00802 7.79157 8.18746 7.53575 8.29343C7.27994 8.39939 6.99844 8.42711 6.72687 8.37309C6.4553 8.31908 6.20584 8.18574 6.01005 7.98994C5.81425 7.79415 5.68091 7.54469 5.6269 7.27312C5.57288 7.00155 5.6006 6.72006 5.70656 6.46424C5.81253 6.20842 5.99197 5.98977 6.2222 5.83594Z", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$I, "render$I"); +script$N.render = render$I; +var script$M = { + name: "RefreshIcon", + "extends": script$1m +}; +function render$H(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M6.77051 5.96336C6.84324 5.99355 6.92127 6.00891 7.00002 6.00854C7.07877 6.00891 7.1568 5.99355 7.22953 5.96336C7.30226 5.93317 7.36823 5.88876 7.42357 5.83273L9.82101 3.43529C9.93325 3.32291 9.99629 3.17058 9.99629 3.01175C9.99629 2.85292 9.93325 2.70058 9.82101 2.5882L7.42357 0.190763C7.3687 0.131876 7.30253 0.0846451 7.22901 0.0518865C7.15549 0.019128 7.07612 0.00151319 6.99564 9.32772e-05C6.91517 -0.00132663 6.83523 0.0134773 6.7606 0.0436218C6.68597 0.0737664 6.61817 0.118634 6.56126 0.175548C6.50435 0.232462 6.45948 0.300257 6.42933 0.374888C6.39919 0.449519 6.38439 0.529456 6.38581 0.609933C6.38722 0.690409 6.40484 0.769775 6.4376 0.843296C6.47036 0.916817 6.51759 0.982986 6.57647 1.03786L7.95103 2.41241H6.99998C5.46337 2.41241 3.98969 3.02283 2.90314 4.10938C1.81659 5.19593 1.20618 6.66961 1.20618 8.20622C1.20618 9.74283 1.81659 11.2165 2.90314 12.3031C3.98969 13.3896 5.46337 14 6.99998 14C8.53595 13.9979 10.0084 13.3868 11.0945 12.3007C12.1806 11.2146 12.7917 9.74218 12.7938 8.20622C12.7938 8.04726 12.7306 7.89481 12.6182 7.78241C12.5058 7.67001 12.3534 7.60686 12.1944 7.60686C12.0355 7.60686 11.883 7.67001 11.7706 7.78241C11.6582 7.89481 11.5951 8.04726 11.5951 8.20622C11.5951 9.11504 11.3256 10.0035 10.8207 10.7591C10.3157 11.5148 9.59809 12.1037 8.75845 12.4515C7.9188 12.7993 6.99489 12.8903 6.10353 12.713C5.21217 12.5357 4.3934 12.0981 3.75077 11.4554C3.10813 10.8128 2.67049 9.99404 2.49319 9.10268C2.31589 8.21132 2.40688 7.2874 2.75468 6.44776C3.10247 5.60811 3.69143 4.89046 4.44709 4.38554C5.20275 3.88063 6.09116 3.61113 6.99998 3.61113H7.95098L6.57647 4.98564C6.46423 5.09802 6.40119 5.25035 6.40119 5.40918C6.40119 5.56801 6.46423 5.72035 6.57647 5.83273C6.63181 5.88876 6.69778 5.93317 6.77051 5.96336Z", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$H, "render$H"); +script$M.render = render$H; +var script$L = { + name: "SearchMinusIcon", + "extends": script$1m +}; +function render$G(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M6.0208 12.0411C4.83005 12.0411 3.66604 11.688 2.67596 11.0265C1.68589 10.3649 0.914216 9.42464 0.458534 8.32452C0.00285271 7.22441 -0.116374 6.01388 0.11593 4.84601C0.348235 3.67813 0.921637 2.60537 1.76363 1.76338C2.60562 0.921393 3.67838 0.34799 4.84625 0.115686C6.01412 -0.116618 7.22466 0.00260857 8.32477 0.45829C9.42488 0.913972 10.3652 1.68564 11.0267 2.67572C11.6883 3.66579 12.0414 4.8298 12.0414 6.02056C12.0395 7.41563 11.5542 8.76029 10.6783 9.8305L13.8244 12.9765C13.9367 13.089 13.9997 13.2414 13.9997 13.4003C13.9997 13.5592 13.9367 13.7116 13.8244 13.8241C13.769 13.8801 13.703 13.9245 13.6302 13.9548C13.5575 13.985 13.4794 14.0003 13.4006 14C13.3218 14.0003 13.2437 13.985 13.171 13.9548C13.0982 13.9245 13.0322 13.8801 12.9768 13.8241L9.83082 10.678C8.76059 11.5539 7.4159 12.0393 6.0208 12.0411ZM6.0208 1.20731C5.07199 1.20731 4.14449 1.48867 3.35559 2.0158C2.56669 2.54292 1.95181 3.29215 1.58872 4.16874C1.22562 5.04532 1.13062 6.00989 1.31572 6.94046C1.50083 7.87104 1.95772 8.72583 2.62863 9.39674C3.29954 10.0676 4.15433 10.5245 5.0849 10.7096C6.01548 10.8947 6.98005 10.7997 7.85663 10.4367C8.73322 10.0736 9.48244 9.45868 10.0096 8.66978C10.5367 7.88088 10.8181 6.95337 10.8181 6.00457C10.8181 4.73226 10.3126 3.51206 9.41297 2.6124C8.51331 1.71274 7.29311 1.20731 6.0208 1.20731ZM4.00591 6.60422H8.00362C8.16266 6.60422 8.31518 6.54104 8.42764 6.42859C8.5401 6.31613 8.60328 6.1636 8.60328 6.00456C8.60328 5.84553 8.5401 5.693 8.42764 5.58054C8.31518 5.46809 8.16266 5.40491 8.00362 5.40491H4.00591C3.84687 5.40491 3.69434 5.46809 3.58189 5.58054C3.46943 5.693 3.40625 5.84553 3.40625 6.00456C3.40625 6.1636 3.46943 6.31613 3.58189 6.42859C3.69434 6.54104 3.84687 6.60422 4.00591 6.60422Z", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$G, "render$G"); +script$L.render = render$G; +var script$K = { + name: "SearchPlusIcon", + "extends": script$1m +}; +function render$F(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M2.67596 11.0265C3.66604 11.688 4.83005 12.0411 6.0208 12.0411C6.81143 12.0411 7.59432 11.8854 8.32477 11.5828C8.86999 11.357 9.37802 11.0526 9.83311 10.6803L12.9768 13.8241C13.0322 13.8801 13.0982 13.9245 13.171 13.9548C13.2437 13.985 13.3218 14.0003 13.4006 14C13.4794 14.0003 13.5575 13.985 13.6302 13.9548C13.703 13.9245 13.769 13.8801 13.8244 13.8241C13.9367 13.7116 13.9997 13.5592 13.9997 13.4003C13.9997 13.2414 13.9367 13.089 13.8244 12.9765L10.6806 9.8328C11.0529 9.37773 11.3572 8.86972 11.5831 8.32452C11.8856 7.59408 12.0414 6.81119 12.0414 6.02056C12.0414 4.8298 11.6883 3.66579 11.0267 2.67572C10.3652 1.68564 9.42488 0.913972 8.32477 0.45829C7.22466 0.00260857 6.01412 -0.116618 4.84625 0.115686C3.67838 0.34799 2.60562 0.921393 1.76363 1.76338C0.921637 2.60537 0.348235 3.67813 0.11593 4.84601C-0.116374 6.01388 0.00285271 7.22441 0.458534 8.32452C0.914216 9.42464 1.68589 10.3649 2.67596 11.0265ZM3.35559 2.0158C4.14449 1.48867 5.07199 1.20731 6.0208 1.20731C7.29311 1.20731 8.51331 1.71274 9.41297 2.6124C10.3126 3.51206 10.8181 4.73226 10.8181 6.00457C10.8181 6.95337 10.5367 7.88088 10.0096 8.66978C9.48244 9.45868 8.73322 10.0736 7.85663 10.4367C6.98005 10.7997 6.01548 10.8947 5.0849 10.7096C4.15433 10.5245 3.29954 10.0676 2.62863 9.39674C1.95772 8.72583 1.50083 7.87104 1.31572 6.94046C1.13062 6.00989 1.22562 5.04532 1.58872 4.16874C1.95181 3.29215 2.56669 2.54292 3.35559 2.0158ZM6.00481 8.60309C5.84641 8.60102 5.69509 8.53718 5.58308 8.42517C5.47107 8.31316 5.40722 8.16183 5.40515 8.00344V6.60422H4.00591C3.84687 6.60422 3.69434 6.54104 3.58189 6.42859C3.46943 6.31613 3.40625 6.1636 3.40625 6.00456C3.40625 5.84553 3.46943 5.693 3.58189 5.58054C3.69434 5.46809 3.84687 5.40491 4.00591 5.40491H5.40515V4.00572C5.40515 3.84668 5.46833 3.69416 5.58079 3.5817C5.69324 3.46924 5.84577 3.40607 6.00481 3.40607C6.16385 3.40607 6.31637 3.46924 6.42883 3.5817C6.54129 3.69416 6.60447 3.84668 6.60447 4.00572V5.40491H8.00362C8.16266 5.40491 8.31518 5.46809 8.42764 5.58054C8.5401 5.693 8.60328 5.84553 8.60328 6.00456C8.60328 6.1636 8.5401 6.31613 8.42764 6.42859C8.31518 6.54104 8.16266 6.60422 8.00362 6.60422H6.60447V8.00344C6.60239 8.16183 6.53855 8.31316 6.42654 8.42517C6.31453 8.53718 6.1632 8.60102 6.00481 8.60309Z", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$F, "render$F"); +script$K.render = render$F; +var script$J = { + name: "UndoIcon", + "extends": script$1m +}; +function render$E(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M6.77042 5.96336C6.84315 5.99355 6.92118 6.00891 6.99993 6.00854C7.07868 6.00891 7.15671 5.99355 7.22944 5.96336C7.30217 5.93317 7.36814 5.88876 7.42348 5.83273C7.53572 5.72035 7.59876 5.56801 7.59876 5.40918C7.59876 5.25035 7.53572 5.09802 7.42348 4.98564L6.04897 3.61113H6.99998C7.9088 3.61113 8.79722 3.88063 9.55288 4.38554C10.3085 4.89046 10.8975 5.60811 11.2453 6.44776C11.5931 7.2874 11.6841 8.21132 11.5068 9.10268C11.3295 9.99404 10.8918 10.8128 10.2492 11.4554C9.60657 12.0981 8.7878 12.5357 7.89644 12.713C7.00508 12.8903 6.08116 12.7993 5.24152 12.4515C4.40188 12.1037 3.68422 11.5148 3.17931 10.7591C2.67439 10.0035 2.4049 9.11504 2.4049 8.20622C2.4049 8.04726 2.34175 7.89481 2.22935 7.78241C2.11695 7.67001 1.9645 7.60686 1.80554 7.60686C1.64658 7.60686 1.49413 7.67001 1.38172 7.78241C1.26932 7.89481 1.20618 8.04726 1.20618 8.20622C1.20829 9.74218 1.81939 11.2146 2.90548 12.3007C3.99157 13.3868 5.46402 13.9979 6.99998 14C8.5366 14 10.0103 13.3896 11.0968 12.3031C12.1834 11.2165 12.7938 9.74283 12.7938 8.20622C12.7938 6.66961 12.1834 5.19593 11.0968 4.10938C10.0103 3.02283 8.5366 2.41241 6.99998 2.41241H6.04892L7.42348 1.03786C7.48236 0.982986 7.5296 0.916817 7.56235 0.843296C7.59511 0.769775 7.61273 0.690409 7.61415 0.609933C7.61557 0.529456 7.60076 0.449519 7.57062 0.374888C7.54047 0.300257 7.49561 0.232462 7.43869 0.175548C7.38178 0.118634 7.31398 0.0737664 7.23935 0.0436218C7.16472 0.0134773 7.08478 -0.00132663 7.00431 9.32772e-05C6.92383 0.00151319 6.84447 0.019128 6.77095 0.0518865C6.69742 0.0846451 6.63126 0.131876 6.57638 0.190763L4.17895 2.5882C4.06671 2.70058 4.00366 2.85292 4.00366 3.01175C4.00366 3.17058 4.06671 3.32291 4.17895 3.43529L6.57638 5.83273C6.63172 5.88876 6.69769 5.93317 6.77042 5.96336Z", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$E, "render$E"); +script$J.render = render$E; +var theme$q = /* @__PURE__ */ __name(function theme14(_ref) { + var dt = _ref.dt; + return "\n.p-image-mask {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-image-preview {\n position: relative;\n display: inline-flex;\n line-height: 0;\n}\n\n.p-image-preview-mask {\n position: absolute;\n inset-inline-start: 0;\n inset-block-start: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0;\n transition: opacity 0.3s;\n border: 0 none;\n padding: 0;\n cursor: pointer;\n background: transparent;\n color: ".concat(dt("image.preview.mask.color"), ";\n transition: background ").concat(dt("image.transition.duration"), ";\n}\n\n.p-image-preview:hover > .p-image-preview-mask {\n opacity: 1;\n cursor: pointer;\n background: ").concat(dt("image.preview.mask.background"), ";\n}\n\n.p-image-preview-icon {\n font-size: ").concat(dt("image.preview.icon.size"), ";\n width: ").concat(dt("image.preview.icon.size"), ";\n height: ").concat(dt("image.preview.icon.size"), ";\n}\n\n.p-image-toolbar {\n position: absolute;\n inset-block-start: ").concat(dt("image.toolbar.position.top"), ";\n inset-inline-end: ").concat(dt("image.toolbar.position.right"), ";\n inset-inline-start: ").concat(dt("image.toolbar.position.left"), ";\n inset-block-end: ").concat(dt("image.toolbar.position.bottom"), ";\n display: flex;\n z-index: 1;\n padding: ").concat(dt("image.toolbar.padding"), ";\n background: ").concat(dt("image.toolbar.background"), ";\n backdrop-filter: blur(").concat(dt("image.toolbar.blur"), ");\n border-color: ").concat(dt("image.toolbar.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("image.toolbar.border.width"), ";\n border-radius: ").concat(dt("image.toolbar.border.radius"), ";\n gap: ").concat(dt("image.toolbar.gap"), ";\n}\n\n.p-image-action {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n color: ").concat(dt("image.action.color"), ";\n background: transparent;\n width: ").concat(dt("image.action.size"), ";\n height: ").concat(dt("image.action.size"), ";\n margin: 0;\n padding: 0;\n border: 0 none;\n cursor: pointer;\n user-select: none;\n border-radius: ").concat(dt("image.action.border.radius"), ";\n outline-color: transparent;\n transition: background ").concat(dt("image.transition.duration"), ", color ").concat(dt("image.transition.duration"), ", outline-color ").concat(dt("image.transition.duration"), ", box-shadow ").concat(dt("image.transition.duration"), ";\n}\n\n.p-image-action:hover {\n color: ").concat(dt("image.action.hover.color"), ";\n background: ").concat(dt("image.action.hover.background"), ";\n}\n\n.p-image-action:focus-visible {\n box-shadow: ").concat(dt("image.action.focus.ring.shadow"), ";\n outline: ").concat(dt("image.action.focus.ring.width"), " ").concat(dt("image.action.focus.ring.style"), " ").concat(dt("image.action.focus.ring.color"), ";\n outline-offset: ").concat(dt("image.action.focus.ring.offset"), ";\n}\n\n.p-image-action .p-icon {\n font-size: ").concat(dt("image.action.icon.size"), ";\n width: ").concat(dt("image.action.icon.size"), ";\n height: ").concat(dt("image.action.icon.size"), ";\n}\n\n.p-image-action.p-disabled {\n pointer-events: auto;\n}\n\n.p-image-original {\n transition: transform 0.15s;\n max-width: 100vw;\n max-height: 100vh;\n}\n\n.p-image-original-enter-active {\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n}\n\n.p-image-original-leave-active {\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n.p-image-original-enter-from,\n.p-image-original-leave-to {\n opacity: 0;\n transform: scale(0.7);\n}\n"); +}, "theme"); +var classes$t = { + root: /* @__PURE__ */ __name(function root13(_ref2) { + var props = _ref2.props; + return ["p-image p-component", { + "p-image-preview": props.preview + }]; + }, "root"), + previewMask: "p-image-preview-mask", + previewIcon: "p-image-preview-icon", + mask: "p-image-mask p-overlay-mask p-overlay-mask-enter", + toolbar: "p-image-toolbar", + rotateRightButton: "p-image-action p-image-rotate-right-button", + rotateLeftButton: "p-image-action p-image-rotate-left-button", + zoomOutButton: /* @__PURE__ */ __name(function zoomOutButton(_ref3) { + var instance = _ref3.instance; + return ["p-image-action p-image-zoom-out-button", { + "p-disabled": instance.isZoomOutDisabled + }]; + }, "zoomOutButton"), + zoomInButton: /* @__PURE__ */ __name(function zoomInButton(_ref4) { + var instance = _ref4.instance; + return ["p-image-action p-image-zoom-in-button", { + "p-disabled": instance.isZoomInDisabled + }]; + }, "zoomInButton"), + closeButton: "p-image-action p-image-close-button", + original: "p-image-original" +}; +var ImageStyle = BaseStyle.extend({ + name: "image", + theme: theme$q, + classes: classes$t +}); +var script$1$t = { + name: "BaseImage", + "extends": script$1d, + props: { + preview: { + type: Boolean, + "default": false + }, + "class": { + type: null, + "default": null + }, + style: { + type: null, + "default": null + }, + imageStyle: { + type: null, + "default": null + }, + imageClass: { + type: null, + "default": null + }, + previewButtonProps: { + type: null, + "default": null + }, + indicatorIcon: { + type: String, + "default": void 0 + }, + previewIcon: { + type: String, + "default": void 0 + }, + zoomInDisabled: { + type: Boolean, + "default": false + }, + zoomOutDisabled: { + type: Boolean, + "default": false + } + }, + style: ImageStyle, + provide: /* @__PURE__ */ __name(function provide22() { + return { + $pcImage: this, + $parentInstance: this + }; + }, "provide") +}; +var script$I = { + name: "Image", + "extends": script$1$t, + inheritAttrs: false, + emits: ["show", "hide", "error"], + mask: null, + data: /* @__PURE__ */ __name(function data14() { + return { + maskVisible: false, + previewVisible: false, + rotate: 0, + scale: 1 + }; + }, "data"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount7() { + if (this.mask) { + ZIndex.clear(this.container); + } + }, "beforeUnmount"), + methods: { + maskRef: /* @__PURE__ */ __name(function maskRef2(el) { + this.mask = el; + }, "maskRef"), + toolbarRef: /* @__PURE__ */ __name(function toolbarRef(el) { + this.toolbarRef = el; + }, "toolbarRef"), + onImageClick: /* @__PURE__ */ __name(function onImageClick() { + var _this = this; + if (this.preview) { + blockBodyScroll(); + this.maskVisible = true; + setTimeout(function() { + _this.previewVisible = true; + }, 25); + } + }, "onImageClick"), + onPreviewImageClick: /* @__PURE__ */ __name(function onPreviewImageClick() { + this.previewClick = true; + }, "onPreviewImageClick"), + onMaskClick: /* @__PURE__ */ __name(function onMaskClick2(event2) { + var isBarActionsClicked = isAttributeEquals(event2.target, "data-pc-section-group", "action") || event2.target.closest('[data-pc-section-group="action"]'); + if (!this.previewClick && !isBarActionsClicked) { + this.previewVisible = false; + this.rotate = 0; + this.scale = 1; + } + this.previewClick = false; + }, "onMaskClick"), + onMaskKeydown: /* @__PURE__ */ __name(function onMaskKeydown(event2) { + var _this2 = this; + switch (event2.code) { + case "Escape": + this.hidePreview(); + setTimeout(function() { + focus(_this2.$refs.previewButton); + }, 200); + event2.preventDefault(); + break; + } + }, "onMaskKeydown"), + onError: /* @__PURE__ */ __name(function onError2() { + this.$emit("error"); + }, "onError"), + rotateRight: /* @__PURE__ */ __name(function rotateRight() { + this.rotate += 90; + this.previewClick = true; + }, "rotateRight"), + rotateLeft: /* @__PURE__ */ __name(function rotateLeft() { + this.rotate -= 90; + this.previewClick = true; + }, "rotateLeft"), + zoomIn: /* @__PURE__ */ __name(function zoomIn() { + this.scale = this.scale + 0.1; + this.previewClick = true; + }, "zoomIn"), + zoomOut: /* @__PURE__ */ __name(function zoomOut() { + this.scale = this.scale - 0.1; + this.previewClick = true; + }, "zoomOut"), + onBeforeEnter: /* @__PURE__ */ __name(function onBeforeEnter() { + ZIndex.set("modal", this.mask, this.$primevue.config.zIndex.modal); + }, "onBeforeEnter"), + onEnter: /* @__PURE__ */ __name(function onEnter2() { + this.focus(); + this.$emit("show"); + }, "onEnter"), + onBeforeLeave: /* @__PURE__ */ __name(function onBeforeLeave2() { + !this.isUnstyled && addClass(this.mask, "p-overlay-mask-leave"); + }, "onBeforeLeave"), + onLeave: /* @__PURE__ */ __name(function onLeave2() { + unblockBodyScroll(); + this.$emit("hide"); + }, "onLeave"), + onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave2(el) { + ZIndex.clear(el); + this.maskVisible = false; + }, "onAfterLeave"), + focus: /* @__PURE__ */ __name(function focus2() { + var focusTarget = this.mask.querySelector("[autofocus]"); + if (focusTarget) { + focusTarget.focus(); + } + }, "focus"), + hidePreview: /* @__PURE__ */ __name(function hidePreview() { + this.previewVisible = false; + this.rotate = 0; + this.scale = 1; + unblockBodyScroll(); + }, "hidePreview") + }, + computed: { + containerClass: /* @__PURE__ */ __name(function containerClass2() { + return [this.cx("root"), this["class"]]; + }, "containerClass"), + rotateClass: /* @__PURE__ */ __name(function rotateClass() { + return "p-image-preview-rotate-" + this.rotate; + }, "rotateClass"), + imagePreviewStyle: /* @__PURE__ */ __name(function imagePreviewStyle() { + return { + transform: "rotate(" + this.rotate + "deg) scale(" + this.scale + ")" + }; + }, "imagePreviewStyle"), + isZoomInDisabled: /* @__PURE__ */ __name(function isZoomInDisabled() { + return this.zoomInDisabled || this.scale >= 1.5; + }, "isZoomInDisabled"), + isZoomOutDisabled: /* @__PURE__ */ __name(function isZoomOutDisabled() { + return this.zoomOutDisabled || this.scale <= 0.5; + }, "isZoomOutDisabled"), + rightAriaLabel: /* @__PURE__ */ __name(function rightAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.rotateRight : void 0; + }, "rightAriaLabel"), + leftAriaLabel: /* @__PURE__ */ __name(function leftAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.rotateLeft : void 0; + }, "leftAriaLabel"), + zoomInAriaLabel: /* @__PURE__ */ __name(function zoomInAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.zoomIn : void 0; + }, "zoomInAriaLabel"), + zoomOutAriaLabel: /* @__PURE__ */ __name(function zoomOutAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.zoomOut : void 0; + }, "zoomOutAriaLabel"), + zoomImageAriaLabel: /* @__PURE__ */ __name(function zoomImageAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.zoomImage : void 0; + }, "zoomImageAriaLabel"), + closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel2() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : void 0; + }, "closeAriaLabel") + }, + components: { + Portal: script$1f, + EyeIcon: script$N, + RefreshIcon: script$M, + UndoIcon: script$J, + SearchMinusIcon: script$L, + SearchPlusIcon: script$K, + TimesIcon: script$1g + }, + directives: { + focustrap: FocusTrap + } +}; +function _typeof$h(o) { + "@babel/helpers - typeof"; + return _typeof$h = "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$h(o); +} +__name(_typeof$h, "_typeof$h"); +function ownKeys$f(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$f, "ownKeys$f"); +function _objectSpread$f(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$f(Object(t2), true).forEach(function(r2) { + _defineProperty$g(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$f(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$f, "_objectSpread$f"); +function _defineProperty$g(e, r, t2) { + return (r = _toPropertyKey$g(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$g, "_defineProperty$g"); +function _toPropertyKey$g(t2) { + var i = _toPrimitive$g(t2, "string"); + return "symbol" == _typeof$h(i) ? i : i + ""; +} +__name(_toPropertyKey$g, "_toPropertyKey$g"); +function _toPrimitive$g(t2, r) { + if ("object" != _typeof$h(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$h(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$g, "_toPrimitive$g"); +var _hoisted_1$m = ["aria-label"]; +var _hoisted_2$f = ["aria-modal"]; +var _hoisted_3$c = ["aria-label"]; +var _hoisted_4$8 = ["aria-label"]; +var _hoisted_5$3 = ["disabled", "aria-label"]; +var _hoisted_6$1 = ["disabled", "aria-label"]; +var _hoisted_7$1 = ["aria-label"]; +var _hoisted_8 = ["src"]; +function render$D(_ctx, _cache, $props, $setup, $data, $options) { + var _component_RefreshIcon = resolveComponent("RefreshIcon"); + var _component_UndoIcon = resolveComponent("UndoIcon"); + var _component_SearchMinusIcon = resolveComponent("SearchMinusIcon"); + var _component_SearchPlusIcon = resolveComponent("SearchPlusIcon"); + var _component_TimesIcon = resolveComponent("TimesIcon"); + var _component_Portal = resolveComponent("Portal"); + var _directive_focustrap = resolveDirective("focustrap"); + return openBlock(), createElementBlock("span", mergeProps({ + "class": $options.containerClass, + style: _ctx.style + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "image", { + errorCallback: $options.onError + }, function() { + return [createBaseVNode("img", mergeProps({ + style: _ctx.imageStyle, + "class": _ctx.imageClass, + onError: _cache[0] || (_cache[0] = function() { + return $options.onError && $options.onError.apply($options, arguments); + }) + }, _objectSpread$f(_objectSpread$f({}, _ctx.$attrs), _ctx.ptm("image"))), null, 16)]; + }), _ctx.preview ? (openBlock(), createElementBlock("button", mergeProps({ + key: 0, + ref: "previewButton", + "aria-label": $options.zoomImageAriaLabel, + type: "button", + "class": _ctx.cx("previewMask"), + onClick: _cache[1] || (_cache[1] = function() { + return $options.onImageClick && $options.onImageClick.apply($options, arguments); + }) + }, _objectSpread$f(_objectSpread$f({}, _ctx.previewButtonProps), _ctx.ptm("previewMask"))), [renderSlot(_ctx.$slots, _ctx.$slots.previewicon ? "previewicon" : "indicatoricon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.previewIcon || _ctx.indicatorIcon ? "i" : "EyeIcon"), mergeProps({ + "class": _ctx.cx("previewIcon") + }, _ctx.ptm("previewIcon")), null, 16, ["class"]))]; + })], 16, _hoisted_1$m)) : createCommentVNode("", true), createVNode(_component_Portal, null, { + "default": withCtx(function() { + return [$data.maskVisible ? withDirectives((openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: $options.maskRef, + role: "dialog", + "class": _ctx.cx("mask"), + "aria-modal": $data.maskVisible, + onClick: _cache[8] || (_cache[8] = function() { + return $options.onMaskClick && $options.onMaskClick.apply($options, arguments); + }), + onKeydown: _cache[9] || (_cache[9] = function() { + return $options.onMaskKeydown && $options.onMaskKeydown.apply($options, arguments); + }) + }, _ctx.ptm("mask")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("toolbar") + }, _ctx.ptm("toolbar")), [createBaseVNode("button", mergeProps({ + "class": _ctx.cx("rotateRightButton"), + onClick: _cache[2] || (_cache[2] = function() { + return $options.rotateRight && $options.rotateRight.apply($options, arguments); + }), + type: "button", + "aria-label": $options.rightAriaLabel + }, _ctx.ptm("rotateRightButton"), { + "data-pc-group-section": "action" + }), [renderSlot(_ctx.$slots, "refresh", {}, function() { + return [createVNode(_component_RefreshIcon, normalizeProps(guardReactiveProps(_ctx.ptm("rotateRightIcon"))), null, 16)]; + })], 16, _hoisted_3$c), createBaseVNode("button", mergeProps({ + "class": _ctx.cx("rotateLeftButton"), + onClick: _cache[3] || (_cache[3] = function() { + return $options.rotateLeft && $options.rotateLeft.apply($options, arguments); + }), + type: "button", + "aria-label": $options.leftAriaLabel + }, _ctx.ptm("rotateLeftButton"), { + "data-pc-group-section": "action" + }), [renderSlot(_ctx.$slots, "undo", {}, function() { + return [createVNode(_component_UndoIcon, normalizeProps(guardReactiveProps(_ctx.ptm("rotateLeftIcon"))), null, 16)]; + })], 16, _hoisted_4$8), createBaseVNode("button", mergeProps({ + "class": _ctx.cx("zoomOutButton"), + onClick: _cache[4] || (_cache[4] = function() { + return $options.zoomOut && $options.zoomOut.apply($options, arguments); + }), + type: "button", + disabled: $options.isZoomOutDisabled, + "aria-label": $options.zoomOutAriaLabel + }, _ctx.ptm("zoomOutButton"), { + "data-pc-group-section": "action" + }), [renderSlot(_ctx.$slots, "zoomout", {}, function() { + return [createVNode(_component_SearchMinusIcon, normalizeProps(guardReactiveProps(_ctx.ptm("zoomOutIcon"))), null, 16)]; + })], 16, _hoisted_5$3), createBaseVNode("button", mergeProps({ + "class": _ctx.cx("zoomInButton"), + onClick: _cache[5] || (_cache[5] = function() { + return $options.zoomIn && $options.zoomIn.apply($options, arguments); + }), + type: "button", + disabled: $options.isZoomInDisabled, + "aria-label": $options.zoomInAriaLabel + }, _ctx.ptm("zoomInButton"), { + "data-pc-group-section": "action" + }), [renderSlot(_ctx.$slots, "zoomin", {}, function() { + return [createVNode(_component_SearchPlusIcon, normalizeProps(guardReactiveProps(_ctx.ptm("zoomInIcon"))), null, 16)]; + })], 16, _hoisted_6$1), createBaseVNode("button", mergeProps({ + "class": _ctx.cx("closeButton"), + type: "button", + onClick: _cache[6] || (_cache[6] = function() { + return $options.hidePreview && $options.hidePreview.apply($options, arguments); + }), + "aria-label": $options.closeAriaLabel, + autofocus: "" + }, _ctx.ptm("closeButton"), { + "data-pc-group-section": "action" + }), [renderSlot(_ctx.$slots, "close", {}, function() { + return [createVNode(_component_TimesIcon, normalizeProps(guardReactiveProps(_ctx.ptm("closeIcon"))), null, 16)]; + })], 16, _hoisted_7$1)], 16), createVNode(Transition, mergeProps({ + name: "p-image-original", + onBeforeEnter: $options.onBeforeEnter, + onEnter: $options.onEnter, + onLeave: $options.onLeave, + onBeforeLeave: $options.onBeforeLeave, + onAfterLeave: $options.onAfterLeave + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [$data.previewVisible ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ + key: 0 + }, _ctx.ptm("originalContainer"))), [renderSlot(_ctx.$slots, _ctx.$slots.original ? "original" : "preview", { + "class": normalizeClass(_ctx.cx("original")), + style: normalizeStyle($options.imagePreviewStyle), + previewCallback: $options.onPreviewImageClick + }, function() { + return [createBaseVNode("img", mergeProps({ + src: _ctx.$attrs.src, + "class": _ctx.cx("original"), + style: $options.imagePreviewStyle, + onClick: _cache[7] || (_cache[7] = function() { + return $options.onPreviewImageClick && $options.onPreviewImageClick.apply($options, arguments); + }) + }, _ctx.ptm("original")), null, 16, _hoisted_8)]; + })], 16)) : createCommentVNode("", true)]; + }), + _: 3 + }, 16, ["onBeforeEnter", "onEnter", "onLeave", "onBeforeLeave", "onAfterLeave"])], 16, _hoisted_2$f)), [[_directive_focustrap]]) : createCommentVNode("", true)]; + }), + _: 3 + })], 16); +} +__name(render$D, "render$D"); +script$I.render = render$D; +var theme$p = /* @__PURE__ */ __name(function theme15(_ref) { + var dt = _ref.dt; + return "\n.p-imagecompare {\n position: relative;\n overflow: hidden;\n width: 100%;\n aspect-ratio: 16 / 9;\n}\n\n.p-imagecompare img {\n width: 100%;\n height: 100%;\n position: absolute;\n}\n\n.p-imagecompare img + img {\n clip-path: polygon(0 0, ".concat(dt("imagecompare.scope.x", "50%"), " 0, ").concat(dt("imagecompare.scope.x", "50%"), " 100%, 0 100%);\n}\n\n.p-imagecompare:dir(rtl) img + img {\n clip-path: polygon(calc(100% - ").concat(dt("imagecompare.scope.x", "50%"), ") 0, 100% 0, 100% 100%, calc(100% - ").concat(dt("imagecompare.scope.x", "50%"), ") 100%);\n}\n\n.p-imagecompare-slider {\n position: relative;\n -webkit-appearance: none;\n width: calc(100% + ").concat(dt("imagecompare.handle.size"), ");\n height: 100%;\n margin-inline-start: calc(-1 * calc(").concat(dt("imagecompare.handle.size"), " / 2));\n background-color: transparent;\n outline: none;\n transition: all ").concat(dt("imagecompare.handle.transition.duration"), ";\n}\n\n.p-imagecompare-slider::-webkit-slider-thumb {\n -webkit-appearance: none;\n height: ").concat(dt("imagecompare.handle.size"), ";\n width: ").concat(dt("imagecompare.handle.size"), ";\n background: ").concat(dt("imagecompare.handle.background"), ";\n border: ").concat(dt("imagecompare.handle.border.width"), " solid ").concat(dt("imagecompare.handle.border.color"), ";\n border-radius: ").concat(dt("imagecompare.handle.border.radius"), ";\n background-size: contain;\n cursor: ew-resize;\n transition: all ").concat(dt("imagecompare.handle.transition.duration"), ";\n}\n\n.p-imagecompare-slider::-moz-range-thumb {\n height: ").concat(dt("imagecompare.handle.size"), ";\n width: ").concat(dt("imagecompare.handle.size"), ";\n background: ").concat(dt("imagecompare.handle.background"), ";\n border: ").concat(dt("imagecompare.handle.border.width"), " ").concat(dt("imagecompare.handle.border.style"), " ").concat(dt("imagecompare.handle.border.color"), ";\n border-radius: ").concat(dt("imagecompare.handle.border.radius"), ";\n background-size: contain;\n cursor: ew-resize;\n}\n\n.p-imagecompare-slider:focus-visible::-webkit-slider-thumb {\n box-shadow: ").concat(dt("imagecompare.handle.focus.ring.shadow"), ";\n outline: ").concat(dt("imagecompare.handle.focus.ring.width"), " ").concat(dt("imagecompare.handle.focus.ring.style"), " ").concat(dt("imagecompare.handle.focus.ring.color"), ";\n outline-offset: ").concat(dt("imagecompare.handle.focus.ring.offset"), ";\n}\n\n.p-imagecompare-slider:focus-visible::-moz-range-thumb {\n box-shadow: ").concat(dt("imagecompare.handle.focus.ring.shadow"), ";\n outline: ").concat(dt("imagecompare.handle.focus.ring.width"), " ").concat(dt("imagecompare.handle.focus.ring.style"), " ").concat(dt("imagecompare.handle.focus.ring.color"), ";\n outline-offset: ").concat(dt("imagecompare.handle.focus.ring.offset"), ";\n}\n\n.p-imagecompare-slider:hover {\n width: calc(100% + ").concat(dt("imagecompare.handle.hover.size"), ");\n margin-inline-start: calc(-1 * calc(").concat(dt("imagecompare.handle.hover.size"), " / 2));\n}\n\n.p-imagecompare-slider:hover::-webkit-slider-thumb {\n background: ").concat(dt("imagecompare.handle.hover.background"), ";\n border-color: ").concat(dt("imagecompare.handle.hover.border.color"), ";\n height: ").concat(dt("imagecompare.handle.hover.size"), ";\n width: ").concat(dt("imagecompare.handle.hover.size"), ";\n}\n\n.p-imagecompare-slider:hover::-moz-range-thumb {\n background: ").concat(dt("imagecompare.handle.hover.background"), ";\n border-color: ").concat(dt("imagecompare.handle.hover.border.color"), ";\n height: ").concat(dt("imagecompare.handle.hover.size"), ";\n width: ").concat(dt("imagecompare.handle.hover.size"), ";\n}\n"); +}, "theme"); +var classes$s = { + root: "p-imagecompare", + slider: "p-imagecompare-slider" +}; +var ImageCompareStyle = BaseStyle.extend({ + name: "imagecompare", + theme: theme$p, + classes: classes$s +}); +var script$1$s = { + name: "BaseImageCompare", + "extends": script$1d, + props: { + tabindex: { + type: Number, + "default": 0 + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + } + }, + style: ImageCompareStyle, + provide: /* @__PURE__ */ __name(function provide23() { + return { + $pcImageCompare: this, + $parentInstance: this + }; + }, "provide") +}; +var script$H = { + name: "ImageCompare", + "extends": script$1$s, + methods: { + onSlide: /* @__PURE__ */ __name(function onSlide(event2) { + var value2 = event2.target.value; + var image = event2.target.previousElementSibling; + setCSSProperty(image, $dt("imagecompare.scope.x").name, "".concat(value2, "%")); + }, "onSlide") + } +}; +var _hoisted_1$l = ["aria-labelledby", "aria-label"]; +function render$C(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root"), + "aria-labelledby": _ctx.ariaLabelledby, + "aria-label": _ctx.ariaLabel + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "left"), renderSlot(_ctx.$slots, "right"), createBaseVNode("input", mergeProps({ + type: "range", + min: "0", + max: "100", + value: "50", + onInput: _cache[0] || (_cache[0] = function() { + return $options.onSlide && $options.onSlide.apply($options, arguments); + }), + "class": _ctx.cx("slider") + }, _ctx.ptm("slider")), null, 16)], 16, _hoisted_1$l); +} +__name(render$C, "render$C"); +script$H.render = render$C; +var theme$o = /* @__PURE__ */ __name(function theme16(_ref) { + var dt = _ref.dt; + return "\n.p-inlinemessage {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: ".concat(dt("inlinemessage.padding"), ";\n border-radius: ").concat(dt("inlinemessage.border.radius"), ";\n gap: ").concat(dt("inlinemessage.gap"), ";\n}\n\n.p-inlinemessage-text {\n font-weight: ").concat(dt("inlinemessage.text.font.weight"), ";\n}\n\n.p-inlinemessage-icon {\n flex-shrink: 0;\n font-size: ").concat(dt("inlinemessage.icon.size"), ";\n width: ").concat(dt("inlinemessage.icon.size"), ";\n height: ").concat(dt("inlinemessage.icon.size"), ";\n}\n\n.p-inlinemessage-icon-only .p-inlinemessage-text {\n visibility: hidden;\n width: 0;\n}\n\n.p-inlinemessage-info {\n background: ").concat(dt("inlinemessage.info.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.info.border.color"), ";\n color: ").concat(dt("inlinemessage.info.color"), ";\n box-shadow: ").concat(dt("inlinemessage.info.shadow"), ";\n}\n\n.p-inlinemessage-info .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.info.color"), ";\n}\n\n.p-inlinemessage-success {\n background: ").concat(dt("inlinemessage.success.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.success.border.color"), ";\n color: ").concat(dt("inlinemessage.success.color"), ";\n box-shadow: ").concat(dt("inlinemessage.success.shadow"), ";\n}\n\n.p-inlinemessage-success .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.success.color"), ";\n}\n\n.p-inlinemessage-warn {\n background: ").concat(dt("inlinemessage.warn.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.warn.border.color"), ";\n color: ").concat(dt("inlinemessage.warn.color"), ";\n box-shadow: ").concat(dt("inlinemessage.warn.shadow"), ";\n}\n\n.p-inlinemessage-warn .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.warn.color"), ";\n}\n\n.p-inlinemessage-error {\n background: ").concat(dt("inlinemessage.error.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.error.border.color"), ";\n color: ").concat(dt("inlinemessage.error.color"), ";\n box-shadow: ").concat(dt("inlinemessage.error.shadow"), ";\n}\n\n.p-inlinemessage-error .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.error.color"), ";\n}\n\n.p-inlinemessage-secondary {\n background: ").concat(dt("inlinemessage.secondary.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.secondary.border.color"), ";\n color: ").concat(dt("inlinemessage.secondary.color"), ";\n box-shadow: ").concat(dt("inlinemessage.secondary.shadow"), ";\n}\n\n.p-inlinemessage-secondary .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.secondary.color"), ";\n}\n\n.p-inlinemessage-contrast {\n background: ").concat(dt("inlinemessage.contrast.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.contrast.border.color"), ";\n color: ").concat(dt("inlinemessage.contrast.color"), ";\n box-shadow: ").concat(dt("inlinemessage.contrast.shadow"), ";\n}\n\n.p-inlinemessage-contrast .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.contrast.color"), ";\n}\n"); +}, "theme"); +var classes$r = { + root: /* @__PURE__ */ __name(function root14(_ref2) { + var props = _ref2.props, instance = _ref2.instance; + return ["p-inlinemessage p-component p-inlinemessage-" + props.severity, { + "p-inlinemessage-icon-only": !instance.$slots["default"] + }]; + }, "root"), + icon: /* @__PURE__ */ __name(function icon(_ref3) { + var props = _ref3.props; + return ["p-inlinemessage-icon", props.icon]; + }, "icon"), + text: "p-inlinemessage-text" +}; +var InlineMessageStyle = BaseStyle.extend({ + name: "inlinemessage", + theme: theme$o, + classes: classes$r +}); +var script$1$r = { + name: "BaseInlineMessage", + "extends": script$1d, + props: { + severity: { + type: String, + "default": "error" + }, + icon: { + type: String, + "default": void 0 + } + }, + style: InlineMessageStyle, + provide: /* @__PURE__ */ __name(function provide24() { + return { + $pcInlineMessage: this, + $parentInstance: this + }; + }, "provide") +}; +var script$G = { + name: "InlineMessage", + "extends": script$1$r, + inheritAttrs: false, + timeout: null, + data: /* @__PURE__ */ __name(function data15() { + return { + visible: true + }; + }, "data"), + mounted: /* @__PURE__ */ __name(function mounted18() { + var _this = this; + if (!this.sticky) { + setTimeout(function() { + _this.visible = false; + }, this.life); + } + }, "mounted"), + computed: { + iconComponent: /* @__PURE__ */ __name(function iconComponent() { + return { + info: script$1C, + success: script$1D, + warn: script$1E, + error: script$1F + }[this.severity]; + }, "iconComponent") + } +}; +function render$B(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + role: "alert", + "aria-live": "assertive", + "aria-atomic": "true", + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "icon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon ? "span" : $options.iconComponent), mergeProps({ + "class": _ctx.cx("icon") + }, _ctx.ptm("icon")), null, 16, ["class"]))]; + }), _ctx.$slots["default"] ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("text") + }, _ctx.ptm("text")), [renderSlot(_ctx.$slots, "default")], 16)) : createCommentVNode("", true)], 16); +} +__name(render$B, "render$B"); +script$G.render = render$B; +var theme$n = /* @__PURE__ */ __name(function theme17(_ref) { + var dt = _ref.dt; + return "\n.p-inplace-display {\n display: inline-block;\n cursor: pointer;\n border: 1px solid transparent;\n padding: ".concat(dt("inplace.padding"), ";\n border-radius: ").concat(dt("inplace.border.radius"), ";\n transition: background ").concat(dt("inplace.transition.duration"), ", color ").concat(dt("inplace.transition.duration"), ", outline-color ").concat(dt("inplace.transition.duration"), ", box-shadow ").concat(dt("inplace.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-inplace-display:not(.p-disabled):hover {\n background: ").concat(dt("inplace.display.hover.background"), ";\n color: ").concat(dt("inplace.display.hover.color"), ";\n}\n\n.p-inplace-display:focus-visible {\n box-shadow: ").concat(dt("inplace.focus.ring.shadow"), ";\n outline: ").concat(dt("inplace.focus.ring.width"), " ").concat(dt("inplace.focus.ring.style"), " ").concat(dt("inplace.focus.ring.color"), ";\n outline-offset: ").concat(dt("inplace.focus.ring.offset"), ";\n}\n\n.p-inplace-content {\n display: block;\n}\n"); +}, "theme"); +var classes$q = { + root: "p-inplace p-component", + display: /* @__PURE__ */ __name(function display(_ref2) { + var props = _ref2.props; + return ["p-inplace-display", { + "p-disabled": props.disabled + }]; + }, "display"), + content: "p-inplace-content" +}; +var InplaceStyle = BaseStyle.extend({ + name: "inplace", + theme: theme$n, + classes: classes$q +}); +var script$1$q = { + name: "BaseInplace", + "extends": script$1d, + props: { + active: { + type: Boolean, + "default": false + }, + disabled: { + type: Boolean, + "default": false + }, + displayProps: { + type: null, + "default": null + } + }, + style: InplaceStyle, + provide: /* @__PURE__ */ __name(function provide25() { + return { + $pcInplace: this, + $parentInstance: this + }; + }, "provide") +}; +var script$F = { + name: "Inplace", + "extends": script$1$q, + inheritAttrs: false, + emits: ["open", "close", "update:active"], + data: /* @__PURE__ */ __name(function data16() { + return { + d_active: this.active + }; + }, "data"), + watch: { + active: /* @__PURE__ */ __name(function active2(newValue) { + this.d_active = newValue; + }, "active") + }, + methods: { + open: /* @__PURE__ */ __name(function open(event2) { + if (this.disabled) { + return; + } + this.d_active = true; + this.$emit("open", event2); + this.$emit("update:active", true); + }, "open"), + close: /* @__PURE__ */ __name(function close(event2) { + var _this = this; + this.d_active = false; + this.$emit("close", event2); + this.$emit("update:active", false); + setTimeout(function() { + _this.$refs.display.focus(); + }, 0); + }, "close") + } +}; +function _typeof$g(o) { + "@babel/helpers - typeof"; + return _typeof$g = "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$g(o); +} +__name(_typeof$g, "_typeof$g"); +function ownKeys$e(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$e, "ownKeys$e"); +function _objectSpread$e(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$e(Object(t2), true).forEach(function(r2) { + _defineProperty$f(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$e(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$e, "_objectSpread$e"); +function _defineProperty$f(e, r, t2) { + return (r = _toPropertyKey$f(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$f, "_defineProperty$f"); +function _toPropertyKey$f(t2) { + var i = _toPrimitive$f(t2, "string"); + return "symbol" == _typeof$g(i) ? i : i + ""; +} +__name(_toPropertyKey$f, "_toPropertyKey$f"); +function _toPrimitive$f(t2, r) { + if ("object" != _typeof$g(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$g(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$f, "_toPrimitive$f"); +var _hoisted_1$k = ["tabindex"]; +function render$A(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root"), + "aria-live": "polite" + }, _ctx.ptmi("root")), [!$data.d_active ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: "display", + "class": _ctx.cx("display"), + tabindex: _ctx.$attrs.tabindex || "0", + role: "button", + onClick: _cache[0] || (_cache[0] = function() { + return $options.open && $options.open.apply($options, arguments); + }), + onKeydown: _cache[1] || (_cache[1] = withKeys(function() { + return $options.open && $options.open.apply($options, arguments); + }, ["enter"])) + }, _objectSpread$e(_objectSpread$e({}, _ctx.displayProps), _ctx.ptm("display"))), [renderSlot(_ctx.$slots, "display")], 16, _hoisted_1$k)) : (openBlock(), createElementBlock("div", mergeProps({ + key: 1, + "class": _ctx.cx("content") + }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "content", { + closeCallback: $options.close + })], 16))], 16); +} +__name(render$A, "render$A"); +script$F.render = render$A; +var theme$m = /* @__PURE__ */ __name(function theme18(_ref) { + var dt = _ref.dt; + return "\n.p-inputgroup,\n.p-inputgroup .p-iconfield,\n.p-inputgroup .p-floatlabel,\n.p-inputgroup .p-iftalabel {\n display: flex;\n align-items: stretch;\n width: 100%;\n}\n\n.p-inputgroup .p-inputtext,\n.p-inputgroup .p-inputwrapper {\n flex: 1 1 auto;\n width: 1%;\n}\n\n.p-inputgroupaddon {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: ".concat(dt("inputgroup.addon.padding"), ";\n background: ").concat(dt("inputgroup.addon.background"), ";\n color: ").concat(dt("inputgroup.addon.color"), ";\n border-block-start: 1px solid ").concat(dt("inputgroup.addon.border.color"), ";\n border-block-end: 1px solid ").concat(dt("inputgroup.addon.border.color"), ";\n min-width: ").concat(dt("inputgroup.addon.min.width"), ";\n}\n\n.p-inputgroupaddon:first-child,\n.p-inputgroupaddon + .p-inputgroupaddon {\n border-inline-start: 1px solid ").concat(dt("inputgroup.addon.border.color"), ";\n}\n\n.p-inputgroupaddon:last-child {\n border-inline-end: 1px solid ").concat(dt("inputgroup.addon.border.color"), ";\n}\n\n.p-inputgroupaddon:has(.p-button) {\n padding: 0;\n overflow: hidden;\n}\n\n.p-inputgroupaddon .p-button {\n border-radius: 0;\n}\n\n.p-inputgroup > .p-component,\n.p-inputgroup > .p-inputwrapper > .p-component,\n.p-inputgroup > .p-iconfield > .p-component,\n.p-inputgroup > .p-floatlabel > .p-component,\n.p-inputgroup > .p-floatlabel > .p-inputwrapper > .p-component,\n.p-inputgroup > .p-iftalabel > .p-component,\n.p-inputgroup > .p-iftalabel > .p-inputwrapper > .p-component {\n border-radius: 0;\n margin: 0;\n}\n\n.p-inputgroupaddon:first-child,\n.p-inputgroup > .p-component:first-child,\n.p-inputgroup > .p-inputwrapper:first-child > .p-component,\n.p-inputgroup > .p-iconfield:first-child > .p-component,\n.p-inputgroup > .p-floatlabel:first-child > .p-component,\n.p-inputgroup > .p-floatlabel:first-child > .p-inputwrapper > .p-component,\n.p-inputgroup > .p-iftalabel:first-child > .p-component,\n.p-inputgroup > .p-iftalabel:first-child > .p-inputwrapper > .p-component {\n border-start-start-radius: ").concat(dt("inputgroup.addon.border.radius"), ";\n border-end-start-radius: ").concat(dt("inputgroup.addon.border.radius"), ";\n}\n\n.p-inputgroupaddon:last-child,\n.p-inputgroup > .p-component:last-child,\n.p-inputgroup > .p-inputwrapper:last-child > .p-component,\n.p-inputgroup > .p-iconfield:last-child > .p-component,\n.p-inputgroup > .p-floatlabel:last-child > .p-component,\n.p-inputgroup > .p-floatlabel:last-child > .p-inputwrapper > .p-component,\n.p-inputgroup > .p-iftalabel:last-child > .p-component,\n.p-inputgroup > .p-iftalabel:last-child > .p-inputwrapper > .p-component {\n border-start-end-radius: ").concat(dt("inputgroup.addon.border.radius"), ";\n border-end-end-radius: ").concat(dt("inputgroup.addon.border.radius"), ";\n}\n\n.p-inputgroup .p-component:focus,\n.p-inputgroup .p-component.p-focus,\n.p-inputgroup .p-inputwrapper-focus,\n.p-inputgroup .p-component:focus ~ label,\n.p-inputgroup .p-component.p-focus ~ label,\n.p-inputgroup .p-inputwrapper-focus ~ label {\n z-index: 1;\n}\n\n.p-inputgroup > .p-button:not(.p-button-icon-only) {\n width: auto;\n}\n\n.p-inputgroup .p-iconfield + .p-iconfield .p-inputtext {\n border-inline-start: 0;\n}\n"); +}, "theme"); +var classes$p = { + root: "p-inputgroup" +}; +var InputGroupStyle = BaseStyle.extend({ + name: "inputgroup", + theme: theme$m, + classes: classes$p +}); +var script$1$p = { + name: "BaseInputGroup", + "extends": script$1d, + style: InputGroupStyle, + provide: /* @__PURE__ */ __name(function provide26() { + return { + $pcInputGroup: this, + $parentInstance: this + }; + }, "provide") +}; +var script$E = { + name: "InputGroup", + "extends": script$1$p, + inheritAttrs: false +}; +function render$z(_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$z, "render$z"); +script$E.render = render$z; +var classes$o = { + root: "p-inputgroupaddon" +}; +var InputGroupAddonStyle = BaseStyle.extend({ + name: "inputgroupaddon", + classes: classes$o +}); +var script$1$o = { + name: "BaseInputGroupAddon", + "extends": script$1d, + style: InputGroupAddonStyle, + provide: /* @__PURE__ */ __name(function provide27() { + return { + $pcInputGroupAddon: this, + $parentInstance: this + }; + }, "provide") +}; +var script$D = { + name: "InputGroupAddon", + "extends": script$1$o, + inheritAttrs: false +}; +function render$y(_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$y, "render$y"); +script$D.render = render$y; +var classes$n = { + root: /* @__PURE__ */ __name(function root15(_ref) { + var instance = _ref.instance; + return ["p-inputmask", { + "p-filled": instance.$filled + }]; + }, "root") +}; +var InputMaskStyle = BaseStyle.extend({ + name: "inputmask", + classes: classes$n +}); +var script$1$n = { + name: "BaseInputMask", + "extends": script$1n, + props: { + slotChar: { + type: String, + "default": "_" + }, + id: { + type: String, + "default": null + }, + "class": { + type: [String, Object], + "default": null + }, + mask: { + type: String, + "default": null + }, + placeholder: { + type: String, + "default": null + }, + autoClear: { + type: Boolean, + "default": true + }, + unmask: { + type: Boolean, + "default": false + }, + readonly: { + type: Boolean, + "default": false + } + }, + style: InputMaskStyle, + provide: /* @__PURE__ */ __name(function provide28() { + return { + $pcInputMask: this, + $parentInstance: this + }; + }, "provide") +}; +var script$C = { + name: "InputMask", + "extends": script$1$n, + inheritAttrs: false, + emits: ["focus", "blur", "keydown", "complete", "keypress", "paste"], + inject: { + $pcFluid: { + "default": null + } + }, + data: /* @__PURE__ */ __name(function data17() { + return { + currentVal: "" + }; + }, "data"), + watch: { + mask: /* @__PURE__ */ __name(function mask3(newMask, oldMask) { + if (oldMask !== newMask) { + this.initMask(); + } + }, "mask") + }, + mounted: /* @__PURE__ */ __name(function mounted19() { + this.initMask(); + }, "mounted"), + updated: /* @__PURE__ */ __name(function updated4() { + if (this.isValueUpdated()) { + this.updateValue(); + } + }, "updated"), + methods: { + onInput: /* @__PURE__ */ __name(function onInput3(event2) { + if (!event2.isComposing) { + if (this.androidChrome) this.handleAndroidInput(event2); + else this.handleInputChange(event2); + this.updateModelValue(event2.target.value); + } + }, "onInput"), + onFocus: /* @__PURE__ */ __name(function onFocus6(event2) { + var _this = this; + if (this.readonly) { + return; + } + this.focus = true; + clearTimeout(this.caretTimeoutId); + var pos; + this.focusText = this.$el.value; + pos = this.checkVal(); + this.caretTimeoutId = setTimeout(function() { + if (_this.$el !== document.activeElement) { + return; + } + _this.writeBuffer(); + if (pos === _this.mask.replace("?", "").length) { + _this.caret(0, pos); + } else { + _this.caret(pos); + } + }, 10); + this.$emit("focus", event2); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur5(event2) { + var _this$formField$onBlu, _this$formField; + this.focus = false; + this.checkVal(); + this.updateModelValue(event2.target.value); + if (this.$el.value !== this.focusText) { + var e = document.createEvent("HTMLEvents"); + e.initEvent("change", true, false); + this.$el.dispatchEvent(e); + } + this.$emit("blur", event2); + (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField, event2); + }, "onBlur"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown5(event2) { + if (this.readonly) { + return; + } + var k = event2.code, pos, begin, end; + var iPhone = /iphone/i.test(getUserAgent()); + this.oldVal = this.$el.value; + if (k === "Backspace" || k === "Delete" || iPhone && k === "Escape") { + pos = this.caret(); + begin = pos.begin; + end = pos.end; + if (end - begin === 0) { + begin = k !== "Delete" ? this.seekPrev(begin) : end = this.seekNext(begin - 1); + end = k === "Delete" ? this.seekNext(end) : end; + } + this.clearBuffer(begin, end); + this.shiftL(begin, end - 1); + this.updateModelValue(event2.target.value); + event2.preventDefault(); + } else if (k === "Enter") { + this.$el.blur(); + this.updateModelValue(event2.target.value); + } else if (k === "Escape") { + this.$el.value = this.focusText; + this.caret(0, this.checkVal()); + this.updateModelValue(event2.target.value); + event2.preventDefault(); + } + this.$emit("keydown", event2); + }, "onKeyDown"), + onKeyPress: /* @__PURE__ */ __name(function onKeyPress(event2) { + var _this2 = this; + if (this.readonly) { + return; + } + var k = event2.code, pos = this.caret(), p, c, next, completed; + if (event2.ctrlKey || event2.altKey || event2.metaKey || event2.shiftKey || event2.key === "CapsLock" || event2.key === "Escape" || event2.key === "Tab") { + return; + } else if (k && k !== "Enter") { + if (pos.end - pos.begin !== 0) { + this.clearBuffer(pos.begin, pos.end); + this.shiftL(pos.begin, pos.end - 1); + } + p = this.seekNext(pos.begin - 1); + if (p < this.len) { + c = event2.key; + if (this.tests[p].test(c)) { + this.shiftR(p); + this.buffer[p] = c; + this.writeBuffer(); + next = this.seekNext(p); + if (/android/i.test(getUserAgent())) { + var proxy = /* @__PURE__ */ __name(function proxy2() { + _this2.caret(next); + }, "proxy"); + setTimeout(proxy, 0); + } else { + this.caret(next); + } + if (pos.begin <= this.lastRequiredNonMaskPos) { + completed = this.isCompleted(); + } + } + } + event2.preventDefault(); + } + this.updateModelValue(event2.target.value); + if (completed) { + this.$emit("complete", event2); + } + this.$emit("keypress", event2); + }, "onKeyPress"), + onPaste: /* @__PURE__ */ __name(function onPaste2(event2) { + this.handleInputChange(event2); + this.$emit("paste", event2); + }, "onPaste"), + caret: /* @__PURE__ */ __name(function caret(first3, last) { + var range, begin, end; + if (!this.$el.offsetParent || this.$el !== document.activeElement) { + return; + } + if (typeof first3 === "number") { + begin = first3; + end = typeof last === "number" ? last : begin; + if (this.$el.setSelectionRange) { + this.$el.setSelectionRange(begin, end); + } else if (this.$el["createTextRange"]) { + range = this.$el["createTextRange"](); + range.collapse(true); + range.moveEnd("character", end); + range.moveStart("character", begin); + range.select(); + } + } else { + if (this.$el.setSelectionRange) { + begin = this.$el.selectionStart; + end = this.$el.selectionEnd; + } else if (document["selection"] && document["selection"].createRange) { + range = document["selection"].createRange(); + begin = 0 - range.duplicate().moveStart("character", -1e5); + end = begin + range.text.length; + } + return { + begin, + end + }; + } + }, "caret"), + isCompleted: /* @__PURE__ */ __name(function isCompleted() { + for (var i = this.firstNonMaskPos; i <= this.lastRequiredNonMaskPos; i++) { + if (this.tests[i] && this.buffer[i] === this.getPlaceholder(i)) { + return false; + } + } + return true; + }, "isCompleted"), + getPlaceholder: /* @__PURE__ */ __name(function getPlaceholder(i) { + if (i < this.slotChar.length) { + return this.slotChar.charAt(i); + } + return this.slotChar.charAt(0); + }, "getPlaceholder"), + seekNext: /* @__PURE__ */ __name(function seekNext(pos) { + while (++pos < this.len && !this.tests[pos]) ; + return pos; + }, "seekNext"), + seekPrev: /* @__PURE__ */ __name(function seekPrev(pos) { + while (--pos >= 0 && !this.tests[pos]) ; + return pos; + }, "seekPrev"), + shiftL: /* @__PURE__ */ __name(function shiftL(begin, end) { + var i, j; + if (begin < 0) { + return; + } + for (i = begin, j = this.seekNext(end); i < this.len; i++) { + if (this.tests[i]) { + if (j < this.len && this.tests[i].test(this.buffer[j])) { + this.buffer[i] = this.buffer[j]; + this.buffer[j] = this.getPlaceholder(j); + } else { + break; + } + j = this.seekNext(j); + } + } + this.writeBuffer(); + this.caret(Math.max(this.firstNonMaskPos, begin)); + }, "shiftL"), + shiftR: /* @__PURE__ */ __name(function shiftR(pos) { + var i, c, j, t2; + for (i = pos, c = this.getPlaceholder(pos); i < this.len; i++) { + if (this.tests[i]) { + j = this.seekNext(i); + t2 = this.buffer[i]; + this.buffer[i] = c; + if (j < this.len && this.tests[j].test(t2)) { + c = t2; + } else { + break; + } + } + } + }, "shiftR"), + handleAndroidInput: /* @__PURE__ */ __name(function handleAndroidInput(event2) { + var curVal = this.$el.value; + var pos = this.caret(); + if (this.oldVal && this.oldVal.length && this.oldVal.length > curVal.length) { + this.checkVal(true); + while (pos.begin > 0 && !this.tests[pos.begin - 1]) pos.begin--; + if (pos.begin === 0) { + while (pos.begin < this.firstNonMaskPos && !this.tests[pos.begin]) pos.begin++; + } + this.caret(pos.begin, pos.begin); + } else { + this.checkVal(true); + while (pos.begin < this.len && !this.tests[pos.begin]) pos.begin++; + this.caret(pos.begin, pos.begin); + } + if (this.isCompleted()) { + this.$emit("complete", event2); + } + }, "handleAndroidInput"), + clearBuffer: /* @__PURE__ */ __name(function clearBuffer(start, end) { + var i; + for (i = start; i < end && i < this.len; i++) { + if (this.tests[i]) { + this.buffer[i] = this.getPlaceholder(i); + } + } + }, "clearBuffer"), + writeBuffer: /* @__PURE__ */ __name(function writeBuffer() { + this.$el.value = this.buffer.join(""); + }, "writeBuffer"), + checkVal: /* @__PURE__ */ __name(function checkVal(allow) { + this.isValueChecked = true; + var test = this.$el.value, lastMatch = -1, i, c, pos; + for (i = 0, pos = 0; i < this.len; i++) { + if (this.tests[i]) { + this.buffer[i] = this.getPlaceholder(i); + while (pos++ < test.length) { + c = test.charAt(pos - 1); + if (this.tests[i].test(c)) { + this.buffer[i] = c; + lastMatch = i; + break; + } + } + if (pos > test.length) { + this.clearBuffer(i + 1, this.len); + break; + } + } else { + if (this.buffer[i] === test.charAt(pos)) { + pos++; + } + if (i < this.partialPosition) { + lastMatch = i; + } + } + } + if (allow) { + this.writeBuffer(); + } else if (lastMatch + 1 < this.partialPosition) { + if (this.autoClear || this.buffer.join("") === this.defaultBuffer) { + if (this.$el.value) this.$el.value = ""; + this.clearBuffer(0, this.len); + } else { + this.writeBuffer(); + } + } else { + this.writeBuffer(); + this.$el.value = this.$el.value.substring(0, lastMatch + 1); + } + return this.partialPosition ? i : this.firstNonMaskPos; + }, "checkVal"), + handleInputChange: /* @__PURE__ */ __name(function handleInputChange(event2) { + var isPasteEvent = event2.type === "paste"; + if (this.readonly || isPasteEvent) { + return; + } + var pos = this.checkVal(true); + this.caret(pos); + this.updateModelValue(event2.target.value); + if (this.isCompleted()) { + this.$emit("complete", event2); + } + }, "handleInputChange"), + getUnmaskedValue: /* @__PURE__ */ __name(function getUnmaskedValue() { + var unmaskedBuffer = []; + for (var i = 0; i < this.buffer.length; i++) { + var c = this.buffer[i]; + if (this.tests[i] && c !== this.getPlaceholder(i)) { + unmaskedBuffer.push(c); + } + } + return unmaskedBuffer.join(""); + }, "getUnmaskedValue"), + updateModelValue: /* @__PURE__ */ __name(function updateModelValue(value2) { + if (this.currentVal === value2) return; + var val = this.unmask ? this.getUnmaskedValue() : value2; + this.currentVal = value2; + this.writeValue(this.defaultBuffer !== val ? val : ""); + }, "updateModelValue"), + updateValue: /* @__PURE__ */ __name(function updateValue2() { + var _this3 = this; + var updateModel8 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; + if (this.$el) { + if (this.d_value == null) { + this.$el.value = ""; + updateModel8 && this.updateModelValue(""); + } else { + this.$el.value = this.d_value; + this.checkVal(); + setTimeout(function() { + if (_this3.$el) { + _this3.writeBuffer(); + _this3.checkVal(); + if (updateModel8) _this3.updateModelValue(_this3.$el.value); + } + }, 10); + } + this.focusText = this.$el.value; + } + }, "updateValue"), + initMask: /* @__PURE__ */ __name(function initMask() { + this.tests = []; + this.partialPosition = this.mask.length; + this.len = this.mask.length; + this.firstNonMaskPos = null; + this.defs = { + 9: "[0-9]", + a: "[A-Za-z]", + "*": "[A-Za-z0-9]" + }; + var ua = getUserAgent(); + this.androidChrome = /chrome/i.test(ua) && /android/i.test(ua); + var maskTokens = this.mask.split(""); + for (var i = 0; i < maskTokens.length; i++) { + var c = maskTokens[i]; + if (c === "?") { + this.len--; + this.partialPosition = i; + } else if (this.defs[c]) { + this.tests.push(new RegExp(this.defs[c])); + if (this.firstNonMaskPos === null) { + this.firstNonMaskPos = this.tests.length - 1; + } + if (i < this.partialPosition) { + this.lastRequiredNonMaskPos = this.tests.length - 1; + } + } else { + this.tests.push(null); + } + } + this.buffer = []; + for (var _i = 0; _i < maskTokens.length; _i++) { + var _c = maskTokens[_i]; + if (_c !== "?") { + if (this.defs[_c]) this.buffer.push(this.getPlaceholder(_i)); + else this.buffer.push(_c); + } + } + this.defaultBuffer = this.buffer.join(""); + this.updateValue(false); + }, "initMask"), + isValueUpdated: /* @__PURE__ */ __name(function isValueUpdated() { + return this.unmask ? this.d_value != this.getUnmaskedValue() : this.defaultBuffer !== this.$el.value && this.$el.value !== this.d_value; + }, "isValueUpdated") + }, + computed: { + inputClass: /* @__PURE__ */ __name(function inputClass() { + return [this.cx("root"), this["class"]]; + }, "inputClass"), + rootPTOptions: /* @__PURE__ */ __name(function rootPTOptions() { + return { + root: mergeProps(this.ptm("pcInputText", this.ptmParams), this.ptmi("root", this.ptmParams)) + }; + }, "rootPTOptions"), + ptmParams: /* @__PURE__ */ __name(function ptmParams() { + return { + context: { + filled: this.$filled + } + }; + }, "ptmParams") + }, + components: { + InputText: script$1o + } +}; +function render$x(_ctx, _cache, $props, $setup, $data, $options) { + var _component_InputText = resolveComponent("InputText"); + return openBlock(), createBlock(_component_InputText, { + id: _ctx.id, + value: $data.currentVal, + "class": normalizeClass($options.inputClass), + readonly: _ctx.readonly, + disabled: _ctx.disabled, + invalid: _ctx.invalid, + size: _ctx.size, + name: _ctx.name, + variant: _ctx.variant, + placeholder: _ctx.placeholder, + fluid: _ctx.$fluid, + unstyled: _ctx.unstyled, + onInput: $options.onInput, + onCompositionend: $options.onInput, + onFocus: $options.onFocus, + onBlur: $options.onBlur, + onKeydown: $options.onKeyDown, + onKeypress: $options.onKeyPress, + onPaste: $options.onPaste, + pt: $options.rootPTOptions + }, null, 8, ["id", "value", "class", "readonly", "disabled", "invalid", "size", "name", "variant", "placeholder", "fluid", "unstyled", "onInput", "onCompositionend", "onFocus", "onBlur", "onKeydown", "onKeypress", "onPaste", "pt"]); +} +__name(render$x, "render$x"); +script$C.render = render$x; +var theme$l = /* @__PURE__ */ __name(function theme19(_ref) { + var dt = _ref.dt; + return "\n.p-inputotp {\n display: flex;\n align-items: center;\n gap: ".concat(dt("inputotp.gap"), ";\n}\n\n.p-inputotp-input {\n text-align: center;\n width: ").concat(dt("inputotp.input.width"), ";\n}\n\n.p-inputotp-input.p-inputtext-sm {\n text-align: center;\n width: ").concat(dt("inputotp.input.sm.width"), ";\n}\n\n.p-inputotp-input.p-inputtext-lg {\n text-align: center;\n width: ").concat(dt("inputotp.input.lg.width"), ";\n}\n"); +}, "theme"); +var classes$m = { + root: "p-inputotp p-component", + pcInputText: "p-inputotp-input" +}; +var InputOtpStyle = BaseStyle.extend({ + name: "inputotp", + theme: theme$l, + classes: classes$m +}); +var script$1$m = { + name: "BaseInputOtp", + "extends": script$1n, + props: { + readonly: { + type: Boolean, + "default": false + }, + tabindex: { + type: Number, + "default": null + }, + length: { + type: Number, + "default": 4 + }, + mask: { + type: Boolean, + "default": false + }, + integerOnly: { + type: Boolean, + "default": false + } + }, + style: InputOtpStyle, + provide: /* @__PURE__ */ __name(function provide29() { + return { + $pcInputOtp: this, + $parentInstance: this + }; + }, "provide") +}; +var script$B = { + name: "InputOtp", + "extends": script$1$m, + inheritAttrs: false, + emits: ["change", "focus", "blur"], + data: /* @__PURE__ */ __name(function data18() { + return { + tokens: [] + }; + }, "data"), + watch: { + modelValue: { + immediate: true, + handler: /* @__PURE__ */ __name(function handler2(newValue) { + this.tokens = newValue ? newValue.split("") : new Array(this.length); + }, "handler") + } + }, + methods: { + getTemplateAttrs: /* @__PURE__ */ __name(function getTemplateAttrs(index) { + return { + value: this.tokens[index] + }; + }, "getTemplateAttrs"), + getTemplateEvents: /* @__PURE__ */ __name(function getTemplateEvents(index) { + var _this = this; + return { + input: /* @__PURE__ */ __name(function input2(event2) { + return _this.onInput(event2, index); + }, "input"), + keydown: /* @__PURE__ */ __name(function keydown(event2) { + return _this.onKeyDown(event2); + }, "keydown"), + focus: /* @__PURE__ */ __name(function focus4(event2) { + return _this.onFocus(event2); + }, "focus"), + blur: /* @__PURE__ */ __name(function blur(event2) { + return _this.onBlur(event2); + }, "blur"), + paste: /* @__PURE__ */ __name(function paste(event2) { + return _this.onPaste(event2); + }, "paste") + }; + }, "getTemplateEvents"), + onInput: /* @__PURE__ */ __name(function onInput4(event2, index) { + this.tokens[index] = event2.target.value; + this.updateModel(event2); + if (event2.inputType === "deleteContentBackward") { + this.moveToPrev(event2); + } else if (event2.inputType === "insertText" || event2.inputType === "deleteContentForward" || isTouchDevice() && event2 instanceof CustomEvent) { + this.moveToNext(event2); + } + }, "onInput"), + updateModel: /* @__PURE__ */ __name(function updateModel4(event2) { + var newValue = this.tokens.join(""); + this.writeValue(newValue, event2); + this.$emit("change", { + originalEvent: event2, + value: newValue + }); + }, "updateModel"), + moveToPrev: /* @__PURE__ */ __name(function moveToPrev(event2) { + var prevInput = this.findPrevInput(event2.target); + if (prevInput) { + prevInput.focus(); + prevInput.select(); + } + }, "moveToPrev"), + moveToNext: /* @__PURE__ */ __name(function moveToNext(event2) { + var nextInput = this.findNextInput(event2.target); + if (nextInput) { + nextInput.focus(); + nextInput.select(); + } + }, "moveToNext"), + findNextInput: /* @__PURE__ */ __name(function findNextInput(element) { + var nextElement = element.nextElementSibling; + if (!nextElement) return; + return nextElement.nodeName === "INPUT" ? nextElement : this.findNextInput(nextElement); + }, "findNextInput"), + findPrevInput: /* @__PURE__ */ __name(function findPrevInput(element) { + var prevElement = element.previousElementSibling; + if (!prevElement) return; + return prevElement.nodeName === "INPUT" ? prevElement : this.findPrevInput(prevElement); + }, "findPrevInput"), + onFocus: /* @__PURE__ */ __name(function onFocus7(event2) { + event2.target.select(); + this.$emit("focus", event2); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur6(event2) { + this.$emit("blur", event2); + }, "onBlur"), + onClick: /* @__PURE__ */ __name(function onClick3(event2) { + setTimeout(function() { + return event2.target.select(); + }, 1); + }, "onClick"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown6(event2) { + if (event2.ctrlKey || event2.metaKey) { + return; + } + switch (event2.code) { + case "ArrowLeft": + this.moveToPrev(event2); + event2.preventDefault(); + break; + case "ArrowUp": + case "ArrowDown": + event2.preventDefault(); + break; + case "Backspace": + if (event2.target.value.length === 0) { + this.moveToPrev(event2); + event2.preventDefault(); + } + break; + case "ArrowRight": + this.moveToNext(event2); + event2.preventDefault(); + break; + case "Enter": + case "NumpadEnter": + case "Tab": + break; + default: + if (this.integerOnly && !(event2.code !== "Space" && Number(event2.key) >= 0 && Number(event2.key) <= 9) || this.tokens.join("").length >= this.length && event2.code !== "Delete") { + event2.preventDefault(); + } + break; + } + }, "onKeyDown"), + onPaste: /* @__PURE__ */ __name(function onPaste3(event2) { + var paste = event2.clipboardData.getData("text"); + if (paste.length) { + var pastedCode = paste.substring(0, this.length); + if (!this.integerOnly || !isNaN(pastedCode)) { + this.tokens = pastedCode.split(""); + this.updateModel(event2); + } + } + event2.preventDefault(); + }, "onPaste") + }, + computed: { + inputMode: /* @__PURE__ */ __name(function inputMode() { + return this.integerOnly ? "numeric" : "text"; + }, "inputMode"), + inputType: /* @__PURE__ */ __name(function inputType() { + return this.mask ? "password" : "text"; + }, "inputType") + }, + components: { + OtpInputText: script$1o + } +}; +function render$w(_ctx, _cache, $props, $setup, $data, $options) { + var _component_OtpInputText = resolveComponent("OtpInputText"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.length, function(i) { + return renderSlot(_ctx.$slots, "default", { + key: i, + events: $options.getTemplateEvents(i - 1), + attrs: $options.getTemplateAttrs(i - 1), + index: i + }, function() { + return [createVNode(_component_OtpInputText, { + value: $data.tokens[i - 1], + type: $options.inputType, + "class": normalizeClass(_ctx.cx("pcInputText")), + name: _ctx.$formName, + inputmode: $options.inputMode, + variant: _ctx.variant, + readonly: _ctx.readonly, + disabled: _ctx.disabled, + size: _ctx.size, + invalid: _ctx.invalid, + tabindex: _ctx.tabindex, + unstyled: _ctx.unstyled, + onInput: /* @__PURE__ */ __name(function onInput6($event) { + return $options.onInput($event, i - 1); + }, "onInput"), + onFocus: _cache[0] || (_cache[0] = function($event) { + return $options.onFocus($event); + }), + onBlur: _cache[1] || (_cache[1] = function($event) { + return $options.onBlur($event); + }), + onPaste: _cache[2] || (_cache[2] = function($event) { + return $options.onPaste($event); + }), + onKeydown: _cache[3] || (_cache[3] = function($event) { + return $options.onKeyDown($event); + }), + onClick: _cache[4] || (_cache[4] = function($event) { + return $options.onClick($event); + }), + pt: _ctx.ptm("pcInputText") + }, null, 8, ["value", "type", "class", "name", "inputmode", "variant", "readonly", "disabled", "size", "invalid", "tabindex", "unstyled", "onInput", "pt"])]; + }); + }), 128))], 16); +} +__name(render$w, "render$w"); +script$B.render = render$w; +var script$A = { + name: "InputSwitch", + "extends": script$1G, + mounted: /* @__PURE__ */ __name(function mounted20() { + console.warn("Deprecated since v4. Use ToggleSwitch component instead."); + }, "mounted") +}; +var InputSwitchStyle = BaseStyle.extend({ + name: "inputswitch" +}); +var KeyFilterStyle = BaseStyle.extend({ + name: "keyfilter-directive" +}); +var BaseKeyFilter = BaseDirective.extend({ + style: KeyFilterStyle +}); +function _toConsumableArray$8(r) { + return _arrayWithoutHoles$8(r) || _iterableToArray$8(r) || _unsupportedIterableToArray$9(r) || _nonIterableSpread$8(); +} +__name(_toConsumableArray$8, "_toConsumableArray$8"); +function _nonIterableSpread$8() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableSpread$8, "_nonIterableSpread$8"); +function _unsupportedIterableToArray$9(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$9(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$9(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$9, "_unsupportedIterableToArray$9"); +function _iterableToArray$8(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray$8, "_iterableToArray$8"); +function _arrayWithoutHoles$8(r) { + if (Array.isArray(r)) return _arrayLikeToArray$9(r); +} +__name(_arrayWithoutHoles$8, "_arrayWithoutHoles$8"); +function _arrayLikeToArray$9(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; +} +__name(_arrayLikeToArray$9, "_arrayLikeToArray$9"); +function _typeof$f(o) { + "@babel/helpers - typeof"; + return _typeof$f = "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$f(o); +} +__name(_typeof$f, "_typeof$f"); +var KeyFilter = BaseKeyFilter.extend("keyfilter", { + beforeMount: /* @__PURE__ */ __name(function beforeMount(el, options4) { + var target = this.getTarget(el); + if (!target) return; + target.$_pkeyfilterModifier = this.getModifiers(options4); + if (_typeof$f(options4.value)) { + var _options$value, _options$value2; + target.$_pkeyfilterPattern = ((_options$value = options4.value) === null || _options$value === void 0 ? void 0 : _options$value.pattern) || options4.value; + target.$_pkeyfilterValidateOnly = ((_options$value2 = options4.value) === null || _options$value2 === void 0 ? void 0 : _options$value2.validateOnly) || false; + } + this.bindEvents(target); + target.setAttribute("data-pd-keyfilter", true); + }, "beforeMount"), + updated: /* @__PURE__ */ __name(function updated5(el, options4) { + var target = this.getTarget(el); + if (!target) return; + target.$_pkeyfilterModifier = this.getModifiers(options4); + this.unbindEvents(el, options4); + if (_typeof$f(options4.value)) { + var _options$value3, _options$value4; + target.$_pkeyfilterPattern = ((_options$value3 = options4.value) === null || _options$value3 === void 0 ? void 0 : _options$value3.pattern) || options4.value; + target.$_pkeyfilterValidateOnly = ((_options$value4 = options4.value) === null || _options$value4 === void 0 ? void 0 : _options$value4.validateOnly) || false; + } + this.bindEvents(target); + }, "updated"), + unmounted: /* @__PURE__ */ __name(function unmounted3(el, options4) { + this.unbindEvents(el, options4); + }, "unmounted"), + DEFAULT_PATTERNS: { + pint: /[\d]/, + "int": /[\d\-]/, + pnum: /[\d\.]/, + money: /[\d\.\s,]/, + num: /[\d\-\.]/, + hex: /[0-9a-f]/i, + email: /[a-z0-9_\.\-@]/i, + alpha: /[a-z_]/i, + alphanum: /[a-z0-9_]/i + }, + methods: { + getTarget: /* @__PURE__ */ __name(function getTarget(el) { + return isAttributeEquals(el, "data-pc-name", "inputtext") || isAttributeEquals(el, "data-pc-name", "textarea") ? el : null; + }, "getTarget"), + getModifiers: /* @__PURE__ */ __name(function getModifiers(options4) { + if (options4.modifiers && Object.keys(options4.modifiers).length) { + return Object.keys(options4.modifiers)[Object.keys.length - 1]; + } + return ""; + }, "getModifiers"), + getRegex: /* @__PURE__ */ __name(function getRegex(target) { + return target.$_pkeyfilterPattern ? target.$_pkeyfilterPattern : target.$_pkeyfilterModifier ? this.DEFAULT_PATTERNS[target.$_pkeyfilterModifier] : /./; + }, "getRegex"), + bindEvents: /* @__PURE__ */ __name(function bindEvents(el) { + var _this = this; + el.$_keyfilterKeydownEvent = function(event2) { + return _this.onKeydown(event2, el); + }; + el.$_keyfilterPasteEvent = function(event2) { + return _this.onPaste(event2, el); + }; + el.addEventListener("keypress", el.$_keyfilterKeydownEvent); + el.addEventListener("paste", el.$_keyfilterPasteEvent); + }, "bindEvents"), + unbindEvents: /* @__PURE__ */ __name(function unbindEvents(el) { + el.removeEventListener("keypress", el.$_keyfilterKeydownEvent); + el.removeEventListener("paste", el.$_keyfilterPasteEvent); + el.$_keyfilterKeydownEvent = null; + el.$_keyfilterPasteEvent = null; + }, "unbindEvents"), + onKeydown: /* @__PURE__ */ __name(function onKeydown3(event2, target) { + if (event2.ctrlKey || event2.altKey || event2.metaKey || event2.key === "Tab") { + return; + } + var regex = this.getRegex(target); + if (regex === "") { + return; + } + var testKey = "".concat(event2.key); + if (target.$_pkeyfilterValidateOnly) { + testKey = "".concat(event2.target.value).concat(event2.key); + } + if (!regex.test(testKey)) { + event2.preventDefault(); + } + }, "onKeydown"), + onPaste: /* @__PURE__ */ __name(function onPaste4(event2, target) { + var regex = this.getRegex(target); + if (regex === "") { + return; + } + var clipboard = event2.clipboardData.getData("text"); + var testKey = ""; + _toConsumableArray$8(clipboard).forEach(function(c) { + if (target.$_pkeyfilterValidateOnly) { + testKey += c; + } else { + testKey = c; + } + if (!regex.test(testKey)) { + event2.preventDefault(); + return false; + } + }); + }, "onPaste") + } +}); +var theme$k = /* @__PURE__ */ __name(function theme20(_ref) { + var dt = _ref.dt; + return "\n.p-knob-range {\n fill: none;\n transition: stroke 0.1s ease-in;\n}\n\n.p-knob-value {\n animation-name: p-knob-dash-frame;\n animation-fill-mode: forwards;\n fill: none;\n}\n\n.p-knob-text {\n font-size: 1.3rem;\n text-align: center;\n}\n\n.p-knob svg {\n border-radius: 50%;\n outline-color: transparent;\n transition: background ".concat(dt("knob.transition.duration"), ", color ").concat(dt("knob.transition.duration"), ", outline-color ").concat(dt("knob.transition.duration"), ", box-shadow ").concat(dt("knob.transition.duration"), ";\n}\n\n.p-knob svg:focus-visible {\n box-shadow: ").concat(dt("knob.focus.ring.shadow"), ";\n outline: ").concat(dt("knob.focus.ring.width"), " ").concat(dt("knob.focus.ring.style"), " ").concat(dt("knob.focus.ring.color"), ";\n outline-offset: ").concat(dt("knob.focus.ring.offset"), ";\n}\n\n@keyframes p-knob-dash-frame {\n 100% {\n stroke-dashoffset: 0;\n }\n}\n"); +}, "theme"); +var classes$l = { + root: /* @__PURE__ */ __name(function root16(_ref2) { + var instance = _ref2.instance, props = _ref2.props; + return ["p-knob p-component", { + "p-disabled": props.disabled, + "p-invalid": instance.$invalid + }]; + }, "root"), + range: "p-knob-range", + value: "p-knob-value", + text: "p-knob-text" +}; +var KnobStyle = BaseStyle.extend({ + name: "knob", + theme: theme$k, + classes: classes$l +}); +var script$1$l = { + name: "BaseKnob", + "extends": script$1s, + props: { + size: { + type: Number, + "default": 100 + }, + readonly: { + type: Boolean, + "default": false + }, + step: { + type: Number, + "default": 1 + }, + min: { + type: Number, + "default": 0 + }, + max: { + type: Number, + "default": 100 + }, + valueColor: { + type: String, + "default": /* @__PURE__ */ __name(function _default10() { + return $dt("knob.value.background").variable; + }, "_default") + }, + rangeColor: { + type: String, + "default": /* @__PURE__ */ __name(function _default11() { + return $dt("knob.range.background").variable; + }, "_default") + }, + textColor: { + type: String, + "default": /* @__PURE__ */ __name(function _default12() { + return $dt("knob.text.color").variable; + }, "_default") + }, + strokeWidth: { + type: Number, + "default": 14 + }, + showValue: { + type: Boolean, + "default": true + }, + valueTemplate: { + type: [String, Function], + "default": "{value}" + }, + tabindex: { + type: Number, + "default": 0 + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + } + }, + style: KnobStyle, + provide: /* @__PURE__ */ __name(function provide30() { + return { + $pcKnob: this, + $parentInstance: this + }; + }, "provide") +}; +var Math_PI$1 = 3.14159265358979; +var script$z = { + name: "Knob", + "extends": script$1$l, + inheritAttrs: false, + emits: ["change"], + data: /* @__PURE__ */ __name(function data19() { + return { + radius: 40, + midX: 50, + midY: 50, + minRadians: 4 * Math_PI$1 / 3, + maxRadians: -Math_PI$1 / 3 + }; + }, "data"), + methods: { + updateValueByOffset: /* @__PURE__ */ __name(function updateValueByOffset(offsetX, offsetY) { + var dx = offsetX - this.size / 2; + var dy = this.size / 2 - offsetY; + var angle = Math.atan2(dy, dx); + var start = -Math_PI$1 / 2 - Math_PI$1 / 6; + this.updateModel(angle, start); + }, "updateValueByOffset"), + updateModel: /* @__PURE__ */ __name(function updateModel5(angle, start) { + var mappedValue; + if (angle > this.maxRadians) mappedValue = this.mapRange(angle, this.minRadians, this.maxRadians, this.min, this.max); + else if (angle < start) mappedValue = this.mapRange(angle + 2 * Math_PI$1, this.minRadians, this.maxRadians, this.min, this.max); + else return; + var newValue = Math.round((mappedValue - this.min) / this.step) * this.step + this.min; + this.writeValue(newValue); + this.$emit("change", newValue); + }, "updateModel"), + updateModelValue: /* @__PURE__ */ __name(function updateModelValue2(newValue) { + if (newValue > this.max) this.writeValue(this.max); + else if (newValue < this.min) this.writeValue(this.min); + else this.writeValue(newValue); + }, "updateModelValue"), + mapRange: /* @__PURE__ */ __name(function mapRange(x, inMin, inMax, outMin, outMax) { + return (x - inMin) * (outMax - outMin) / (inMax - inMin) + outMin; + }, "mapRange"), + onClick: /* @__PURE__ */ __name(function onClick4(event2) { + if (!this.disabled && !this.readonly) { + this.updateValueByOffset(event2.offsetX, event2.offsetY); + } + }, "onClick"), + onBlur: /* @__PURE__ */ __name(function onBlur7(event2) { + var _this$formField$onBlu, _this$formField; + (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField, event2); + }, "onBlur"), + onMouseDown: /* @__PURE__ */ __name(function onMouseDown(event2) { + if (!this.disabled && !this.readonly) { + window.addEventListener("mousemove", this.onMouseMove); + window.addEventListener("mouseup", this.onMouseUp); + event2.preventDefault(); + } + }, "onMouseDown"), + onMouseUp: /* @__PURE__ */ __name(function onMouseUp(event2) { + if (!this.disabled && !this.readonly) { + window.removeEventListener("mousemove", this.onMouseMove); + window.removeEventListener("mouseup", this.onMouseUp); + event2.preventDefault(); + } + }, "onMouseUp"), + onTouchStart: /* @__PURE__ */ __name(function onTouchStart(event2) { + if (!this.disabled && !this.readonly) { + window.addEventListener("touchmove", this.onTouchMove); + window.addEventListener("touchend", this.onTouchEnd); + event2.preventDefault(); + } + }, "onTouchStart"), + onTouchEnd: /* @__PURE__ */ __name(function onTouchEnd(event2) { + if (!this.disabled && !this.readonly) { + window.removeEventListener("touchmove", this.onTouchMove); + window.removeEventListener("touchend", this.onTouchEnd); + event2.preventDefault(); + } + }, "onTouchEnd"), + onMouseMove: /* @__PURE__ */ __name(function onMouseMove(event2) { + if (!this.disabled && !this.readonly) { + this.updateValueByOffset(event2.offsetX, event2.offsetY); + event2.preventDefault(); + } + }, "onMouseMove"), + onTouchMove: /* @__PURE__ */ __name(function onTouchMove(event2) { + if (!this.disabled && !this.readonly && event2.touches.length == 1) { + var rect = this.$el.getBoundingClientRect(); + var touch = event2.targetTouches.item(0); + var offsetX = touch.clientX - rect.left; + var offsetY = touch.clientY - rect.top; + this.updateValueByOffset(offsetX, offsetY); + } + }, "onTouchMove"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown7(event2) { + if (!this.disabled && !this.readonly) { + switch (event2.code) { + case "ArrowRight": + case "ArrowUp": { + event2.preventDefault(); + this.updateModelValue(this.d_value + this.step); + break; + } + case "ArrowLeft": + case "ArrowDown": { + event2.preventDefault(); + this.updateModelValue(this.d_value - this.step); + break; + } + case "Home": { + event2.preventDefault(); + this.writeValue(this.min); + break; + } + case "End": { + event2.preventDefault(); + this.writeValue(this.max); + break; + } + case "PageUp": { + event2.preventDefault(); + this.updateModelValue(this.d_value + 10); + break; + } + case "PageDown": { + event2.preventDefault(); + this.updateModelValue(this.d_value - 10); + break; + } + } + } + }, "onKeyDown") + }, + computed: { + rangePath: /* @__PURE__ */ __name(function rangePath() { + return "M ".concat(this.minX, " ").concat(this.minY, " A ").concat(this.radius, " ").concat(this.radius, " 0 1 1 ").concat(this.maxX, " ").concat(this.maxY); + }, "rangePath"), + valuePath: /* @__PURE__ */ __name(function valuePath() { + return "M ".concat(this.zeroX, " ").concat(this.zeroY, " A ").concat(this.radius, " ").concat(this.radius, " 0 ").concat(this.largeArc, " ").concat(this.sweep, " ").concat(this.valueX, " ").concat(this.valueY); + }, "valuePath"), + zeroRadians: /* @__PURE__ */ __name(function zeroRadians() { + if (this.min > 0 && this.max > 0) return this.mapRange(this.min, this.min, this.max, this.minRadians, this.maxRadians); + else return this.mapRange(0, this.min, this.max, this.minRadians, this.maxRadians); + }, "zeroRadians"), + valueRadians: /* @__PURE__ */ __name(function valueRadians() { + return this.mapRange(this.d_value, this.min, this.max, this.minRadians, this.maxRadians); + }, "valueRadians"), + minX: /* @__PURE__ */ __name(function minX() { + return this.midX + Math.cos(this.minRadians) * this.radius; + }, "minX"), + minY: /* @__PURE__ */ __name(function minY() { + return this.midY - Math.sin(this.minRadians) * this.radius; + }, "minY"), + maxX: /* @__PURE__ */ __name(function maxX() { + return this.midX + Math.cos(this.maxRadians) * this.radius; + }, "maxX"), + maxY: /* @__PURE__ */ __name(function maxY() { + return this.midY - Math.sin(this.maxRadians) * this.radius; + }, "maxY"), + zeroX: /* @__PURE__ */ __name(function zeroX() { + return this.midX + Math.cos(this.zeroRadians) * this.radius; + }, "zeroX"), + zeroY: /* @__PURE__ */ __name(function zeroY() { + return this.midY - Math.sin(this.zeroRadians) * this.radius; + }, "zeroY"), + valueX: /* @__PURE__ */ __name(function valueX() { + return this.midX + Math.cos(this.valueRadians) * this.radius; + }, "valueX"), + valueY: /* @__PURE__ */ __name(function valueY() { + return this.midY - Math.sin(this.valueRadians) * this.radius; + }, "valueY"), + largeArc: /* @__PURE__ */ __name(function largeArc() { + return Math.abs(this.zeroRadians - this.valueRadians) < Math_PI$1 ? 0 : 1; + }, "largeArc"), + sweep: /* @__PURE__ */ __name(function sweep() { + return this.valueRadians > this.zeroRadians ? 0 : 1; + }, "sweep"), + valueToDisplay: /* @__PURE__ */ __name(function valueToDisplay() { + if (typeof this.valueTemplate === "string") { + return this.valueTemplate.replace(/{value}/g, this.d_value); + } else { + return this.valueTemplate(this.d_value); + } + }, "valueToDisplay") + } +}; +var _hoisted_1$j = ["width", "height", "tabindex", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-labelledby", "aria-label"]; +var _hoisted_2$e = ["d", "stroke-width", "stroke"]; +var _hoisted_3$b = ["d", "stroke-width", "stroke"]; +var _hoisted_4$7 = ["fill"]; +function render$v(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [(openBlock(), createElementBlock("svg", mergeProps({ + viewBox: "0 0 100 100", + role: "slider", + width: _ctx.size, + height: _ctx.size, + tabindex: _ctx.readonly || _ctx.disabled ? -1 : _ctx.tabindex, + "aria-valuemin": _ctx.min, + "aria-valuemax": _ctx.max, + "aria-valuenow": _ctx.d_value, + "aria-labelledby": _ctx.ariaLabelledby, + "aria-label": _ctx.ariaLabel, + onClick: _cache[0] || (_cache[0] = function() { + return $options.onClick && $options.onClick.apply($options, arguments); + }), + onBlur: _cache[1] || (_cache[1] = function() { + return $options.onBlur && $options.onBlur.apply($options, arguments); + }), + onKeydown: _cache[2] || (_cache[2] = function() { + return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); + }), + onMousedown: _cache[3] || (_cache[3] = function() { + return $options.onMouseDown && $options.onMouseDown.apply($options, arguments); + }), + onMouseup: _cache[4] || (_cache[4] = function() { + return $options.onMouseUp && $options.onMouseUp.apply($options, arguments); + }), + onTouchstartPassive: _cache[5] || (_cache[5] = function() { + return $options.onTouchStart && $options.onTouchStart.apply($options, arguments); + }), + onTouchend: _cache[6] || (_cache[6] = function() { + return $options.onTouchEnd && $options.onTouchEnd.apply($options, arguments); + }) + }, _ctx.ptm("svg")), [createBaseVNode("path", mergeProps({ + d: $options.rangePath, + "stroke-width": _ctx.strokeWidth, + stroke: _ctx.rangeColor, + "class": _ctx.cx("range") + }, _ctx.ptm("range")), null, 16, _hoisted_2$e), createBaseVNode("path", mergeProps({ + d: $options.valuePath, + "stroke-width": _ctx.strokeWidth, + stroke: _ctx.valueColor, + "class": _ctx.cx("value") + }, _ctx.ptm("value")), null, 16, _hoisted_3$b), _ctx.showValue ? (openBlock(), createElementBlock("text", mergeProps({ + key: 0, + x: 50, + y: 57, + "text-anchor": "middle", + fill: _ctx.textColor, + "class": _ctx.cx("text") + }, _ctx.ptm("text")), toDisplayString($options.valueToDisplay), 17, _hoisted_4$7)) : createCommentVNode("", true)], 16, _hoisted_1$j))], 16); +} +__name(render$v, "render$v"); +script$z.render = render$v; +var theme$j = /* @__PURE__ */ __name(function theme21(_ref) { + var dt = _ref.dt; + return "\n.p-megamenu {\n position: relative;\n display: flex;\n align-items: center;\n background: ".concat(dt("megamenu.background"), ";\n border: 1px solid ").concat(dt("megamenu.border.color"), ";\n border-radius: ").concat(dt("megamenu.border.radius"), ";\n color: ").concat(dt("megamenu.color"), ";\n gap: ").concat(dt("megamenu.gap"), ";\n}\n\n.p-megamenu-start,\n.p-megamenu-end {\n display: flex;\n align-items: center;\n}\n\n.p-megamenu-root-list {\n margin: 0;\n padding: 0;\n list-style: none;\n outline: 0 none;\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n gap: ").concat(dt("megamenu.gap"), ";\n}\n\n.p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content {\n border-radius: ").concat(dt("megamenu.base.item.border.radius"), ";\n}\n\n.p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content > .p-megamenu-item-link {\n padding: ").concat(dt("megamenu.base.item.padding"), ";\n}\n\n.p-megamenu-item-content {\n transition: background ").concat(dt("megamenu.transition.duration"), ", color ").concat(dt("megamenu.transition.duration"), ";\n border-radius: ").concat(dt("megamenu.item.border.radius"), ";\n color: ").concat(dt("megamenu.item.color"), ";\n}\n\n.p-megamenu-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("megamenu.item.padding"), ";\n gap: ").concat(dt("megamenu.item.gap"), ";\n user-select: none;\n outline: 0 none;\n}\n\n.p-megamenu-item-label {\n line-height: 1;\n}\n\n.p-megamenu-item-icon {\n color: ").concat(dt("megamenu.item.icon.color"), ";\n}\n\n.p-megamenu-submenu-icon {\n color: ").concat(dt("megamenu.submenu.icon.color"), ";\n font-size: ").concat(dt("megamenu.submenu.icon.size"), ";\n width: ").concat(dt("megamenu.submenu.icon.size"), ";\n height: ").concat(dt("megamenu.submenu.icon.size"), ";\n}\n\n.p-megamenu-item.p-focus > .p-megamenu-item-content {\n color: ").concat(dt("megamenu.item.focus.color"), ";\n background: ").concat(dt("megamenu.item.focus.background"), ";\n}\n\n.p-megamenu-item.p-focus > .p-megamenu-item-content .p-megamenu-item-icon {\n color: ").concat(dt("megamenu.item.icon.focus.color"), ";\n}\n\n.p-megamenu-item.p-focus > .p-megamenu-item-content .p-megamenu-submenu-icon {\n color: ").concat(dt("megamenu.submenu.icon.focus.color"), ";\n}\n\n.p-megamenu-item:not(.p-disabled) > .p-megamenu-item-content:hover {\n color: ").concat(dt("megamenu.item.focus.color"), ";\n background: ").concat(dt("megamenu.item.focus.background"), ";\n}\n\n.p-megamenu-item:not(.p-disabled) > .p-megamenu-item-content:hover .p-megamenu-item-icon {\n color: ").concat(dt("megamenu.item.icon.focus.color"), ";\n}\n\n.p-megamenu-item:not(.p-disabled) > .p-megamenu-item-content:hover .p-megamenu-submenu-icon {\n color: ").concat(dt("megamenu.submenu.icon.focus.color"), ";\n}\n\n.p-megamenu-item-active > .p-megamenu-item-content {\n color: ").concat(dt("megamenu.item.active.color"), ";\n background: ").concat(dt("megamenu.item.active.background"), ";\n}\n\n.p-megamenu-item-active > .p-megamenu-item-content .p-megamenu-item-icon {\n color: ").concat(dt("megamenu.item.icon.active.color"), ";\n}\n\n.p-megamenu-item-active > .p-megamenu-item-content .p-megamenu-submenu-icon {\n color: ").concat(dt("megamenu.submenu.icon.active.color"), ";\n}\n\n.p-megamenu-overlay {\n display: none;\n position: absolute;\n width: auto;\n z-index: 1;\n left: 0;\n min-width: 100%;\n padding: ").concat(dt("megamenu.overlay.padding"), ";\n background: ").concat(dt("megamenu.overlay.background"), ";\n color: ").concat(dt("megamenu.overlay.color"), ";\n border: 1px solid ").concat(dt("megamenu.overlay.border.color"), ";\n border-radius: ").concat(dt("megamenu.overlay.border.radius"), ";\n box-shadow: ").concat(dt("megamenu.overlay.shadow"), ";\n}\n\n.p-megamenu-overlay:dir(rtl) {\n left: auto;\n right: 0;\n}\n\n.p-megamenu-root-list > .p-megamenu-item-active > .p-megamenu-overlay {\n display: block;\n}\n\n.p-megamenu-submenu {\n margin: 0;\n list-style: none;\n padding: ").concat(dt("megamenu.submenu.padding"), ";\n min-width: 12.5rem;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("megamenu.submenu.gap"), "\n}\n\n.p-megamenu-submenu-label {\n padding: ").concat(dt("megamenu.submenu.label.padding"), ";\n color: ").concat(dt("megamenu.submenu.label.color"), ";\n font-weight: ").concat(dt("megamenu.submenu.label.font.weight"), ";\n background: ").concat(dt("megamenu.submenu.label.background"), ";\n}\n\n.p-megamenu-separator {\n border-block-start: 1px solid ").concat(dt("megamenu.separator.border.color"), ";\n}\n\n.p-megamenu-horizontal {\n align-items: center;\n padding: ").concat(dt("megamenu.horizontal.orientation.padding"), ";\n}\n\n.p-megamenu-horizontal .p-megamenu-root-list {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: ").concat(dt("megamenu.horizontal.orientation.gap"), ";\n}\n\n.p-megamenu-horizontal .p-megamenu-end {\n margin-left: auto;\n align-self: center;\n}\n\n.p-megamenu-horizontal .p-megamenu-end:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\n}\n\n.p-megamenu-vertical {\n display: inline-flex;\n min-width: 12.5rem;\n flex-direction: column;\n align-items: stretch;\n padding: ").concat(dt("megamenu.vertical.orientation.padding"), ";\n}\n\n.p-megamenu-vertical .p-megamenu-root-list {\n align-items: stretch;\n flex-direction: column;\n gap: ").concat(dt("megamenu.vertical.orientation.gap"), ";\n}\n\n.p-megamenu-vertical .p-megamenu-root-list > .p-megamenu-item-active > .p-megamenu-overlay {\n left: 100%;\n top: 0;\n}\n\n.p-megamenu-vertical .p-megamenu-root-list > .p-megamenu-item-active > .p-megamenu-overlay:dir(rtl) {\n left: auto;\n right: 100%;\n}\n\n.p-megamenu-vertical .p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content .p-megamenu-submenu-icon {\n margin-left: auto;\n}\n\n.p-megamenu-vertical .p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content .p-megamenu-submenu-icon:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\n transform: rotate(180deg);\n}\n\n.p-megamenu-grid {\n display: flex;\n}\n\n.p-megamenu-col-2,\n.p-megamenu-col-3,\n.p-megamenu-col-4,\n.p-megamenu-col-6,\n.p-megamenu-col-12 {\n flex: 0 0 auto;\n padding: ").concat(dt("megamenu.overlay.gap"), ";\n}\n\n.p-megamenu-col-2 {\n width: 16.6667%;\n}\n\n.p-megamenu-col-3 {\n width: 25%;\n}\n\n.p-megamenu-col-4 {\n width: 33.3333%;\n}\n\n.p-megamenu-col-6 {\n width: 50%;\n}\n\n.p-megamenu-col-12 {\n width: 100%;\n}\n\n.p-megamenu-button {\n display: none;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n width: ").concat(dt("megamenu.mobile.button.size"), ";\n height: ").concat(dt("megamenu.mobile.button.size"), ";\n position: relative;\n color: ").concat(dt("megamenu.mobile.button.color"), ";\n border: 0 none;\n background: transparent;\n border-radius: ").concat(dt("megamenu.mobile.button.border.radius"), ";\n transition: background ").concat(dt("megamenu.transition.duration"), ", color ").concat(dt("megamenu.transition.duration"), ", outline-color ").concat(dt("megamenu.transition.duration"), ", box-shadow ").concat(dt("megamenu.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-megamenu-button:hover {\n color: ").concat(dt("megamenu.mobile.button.hover.color"), ";\n background: ").concat(dt("megamenu.mobile.button.hover.background"), ";\n}\n\n.p-megamenu-button:focus-visible {\n box-shadow: ").concat(dt("megamenu.mobile.button.focus.ring.shadow"), ";\n outline: ").concat(dt("megamenu.mobile.button.focus.ring.width"), " ").concat(dt("megamenu.mobile.button.focus.ring.style"), " ").concat(dt("megamenu.mobile.button.focus.ring.color"), ";\n outline-offset: ").concat(dt("megamenu.mobile.button.focus.ring.offset"), ";\n}\n\n.p-megamenu-mobile {\n display: flex;\n}\n\n.p-megamenu-mobile .p-megamenu-button {\n display: flex;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list {\n position: absolute;\n display: none;\n flex-direction: column;\n top: 100%;\n left: 0;\n z-index: 1;\n width: 100%;\n padding: ").concat(dt("megamenu.submenu.padding"), ";\n gap: ").concat(dt("megamenu.submenu.gap"), ";\n background: ").concat(dt("megamenu.overlay.background"), ";\n border: 1px solid ").concat(dt("megamenu.overlay.border.color"), ";\n box-shadow: ").concat(dt("megamenu.overlay.shadow"), ";\n}\n\n.p-megamenu-mobile .p-megamenu-root-list:dir(rtl) {\n left: auto;\n right: 0;\n}\n\n.p-megamenu-mobile-active .p-megamenu-root-list {\n display: block;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list .p-megamenu-item {\n width: 100%;\n position: static;\n}\n\n.p-megamenu-mobile .p-megamenu-overlay {\n position: static;\n border: 0 none;\n border-radius: 0;\n box-shadow: none;\n}\n\n.p-megamenu-mobile .p-megamenu-grid {\n flex-wrap: wrap;\n overflow: auto;\n max-height: 90%;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content .p-megamenu-submenu-icon {\n margin-left: auto;\n transition: transform 0.2s;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content .p-megamenu-submenu-icon:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list > .p-megamenu-item-active > .p-megamenu-item-content .p-megamenu-submenu-icon {\n transform: rotate(-180deg);\n}\n"); +}, "theme"); +var inlineStyles$6 = { + rootList: /* @__PURE__ */ __name(function rootList(_ref2) { + var props = _ref2.props; + return { + "max-height": props.scrollHeight, + overflow: "auto" + }; + }, "rootList") +}; +var classes$k = { + root: /* @__PURE__ */ __name(function root17(_ref3) { + var instance = _ref3.instance; + return ["p-megamenu p-component", { + "p-megamenu-mobile": instance.queryMatches, + "p-megamenu-mobile-active": instance.mobileActive, + "p-megamenu-horizontal": instance.horizontal, + "p-megamenu-vertical": instance.vertical + }]; + }, "root"), + start: "p-megamenu-start", + button: "p-megamenu-button", + rootList: "p-megamenu-root-list", + submenuLabel: /* @__PURE__ */ __name(function submenuLabel(_ref4) { + var instance = _ref4.instance, processedItem = _ref4.processedItem; + return ["p-megamenu-submenu-label", { + "p-disabled": instance.isItemDisabled(processedItem) + }]; + }, "submenuLabel"), + item: /* @__PURE__ */ __name(function item3(_ref5) { + var instance = _ref5.instance, processedItem = _ref5.processedItem; + return ["p-megamenu-item", { + "p-megamenu-item-active": instance.isItemActive(processedItem), + "p-focus": instance.isItemFocused(processedItem), + "p-disabled": instance.isItemDisabled(processedItem) + }]; + }, "item"), + itemContent: "p-megamenu-item-content", + itemLink: "p-megamenu-item-link", + itemIcon: "p-megamenu-item-icon", + itemLabel: "p-megamenu-item-label", + submenuIcon: "p-megamenu-submenu-icon", + overlay: "p-megamenu-overlay", + grid: "p-megamenu-grid", + column: /* @__PURE__ */ __name(function column(_ref6) { + var instance = _ref6.instance, processedItem = _ref6.processedItem; + var length = instance.isItemGroup(processedItem) ? processedItem.items.length : 0; + var columnClass; + if (instance.$parentInstance.queryMatches) columnClass = "p-megamenu-col-12"; + else { + switch (length) { + case 2: + columnClass = "p-megamenu-col-6"; + break; + case 3: + columnClass = "p-megamenu-col-4"; + break; + case 4: + columnClass = "p-megamenu-col-3"; + break; + case 6: + columnClass = "p-megamenu-col-2"; + break; + default: + columnClass = "p-megamenu-col-12"; + break; + } + } + return columnClass; + }, "column"), + submenu: "p-megamenu-submenu", + separator: "p-megamenu-separator", + end: "p-megamenu-end" +}; +var MegaMenuStyle = BaseStyle.extend({ + name: "megamenu", + theme: theme$j, + classes: classes$k, + inlineStyles: inlineStyles$6 +}); +var script$2$5 = { + name: "BaseMegaMenu", + "extends": script$1d, + props: { + model: { + type: Array, + "default": null + }, + orientation: { + type: String, + "default": "horizontal" + }, + breakpoint: { + type: String, + "default": "960px" + }, + disabled: { + type: Boolean, + "default": false + }, + tabindex: { + type: Number, + "default": 0 + }, + scrollHeight: { + type: String, + "default": "20rem" + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + } + }, + style: MegaMenuStyle, + provide: /* @__PURE__ */ __name(function provide31() { + return { + $pcMegaMenu: this, + $parentInstance: this + }; + }, "provide") +}; +var script$1$k = { + name: "MegaMenuSub", + hostName: "MegaMenu", + "extends": script$1d, + emits: ["item-click", "item-mouseenter"], + props: { + menuId: { + type: String, + "default": null + }, + focusedItemId: { + type: String, + "default": null + }, + horizontal: { + type: Boolean, + "default": false + }, + submenu: { + type: Object, + "default": null + }, + mobileActive: { + type: Boolean, + "default": false + }, + items: { + type: Array, + "default": null + }, + level: { + type: Number, + "default": 0 + }, + templates: { + type: Object, + "default": null + }, + activeItem: { + type: Object, + "default": null + }, + tabindex: { + type: Number, + "default": 0 + } + }, + methods: { + getSubListId: /* @__PURE__ */ __name(function getSubListId(processedItem) { + return "".concat(this.getItemId(processedItem), "_list"); + }, "getSubListId"), + getSubListKey: /* @__PURE__ */ __name(function getSubListKey(processedItem) { + return this.getSubListId(processedItem); + }, "getSubListKey"), + getItemId: /* @__PURE__ */ __name(function getItemId2(processedItem) { + return "".concat(this.menuId, "_").concat(processedItem.key); + }, "getItemId"), + getItemKey: /* @__PURE__ */ __name(function getItemKey(processedItem) { + return this.getItemId(processedItem); + }, "getItemKey"), + getItemProp: /* @__PURE__ */ __name(function getItemProp2(processedItem, name4, params) { + return processedItem && processedItem.item ? resolve(processedItem.item[name4], params) : void 0; + }, "getItemProp"), + getItemLabel: /* @__PURE__ */ __name(function getItemLabel(processedItem) { + return this.getItemProp(processedItem, "label"); + }, "getItemLabel"), + getPTOptions: /* @__PURE__ */ __name(function getPTOptions3(processedItem, index, key) { + return this.ptm(key, { + context: { + item: processedItem.item, + index, + active: this.isItemActive(processedItem), + focused: this.isItemFocused(processedItem), + disabled: this.isItemDisabled(processedItem) + } + }); + }, "getPTOptions"), + isItemActive: /* @__PURE__ */ __name(function isItemActive3(processedItem) { + return isNotEmpty(this.activeItem) ? this.activeItem.key === processedItem.key : false; + }, "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 onItemClick2(event2, processedItem) { + this.getItemProp(processedItem, "command", { + originalEvent: event2, + item: processedItem.item + }); + this.$emit("item-click", { + originalEvent: event2, + processedItem, + isFocus: true + }); + }, "onItemClick"), + onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter2(event2, processedItem) { + this.$emit("item-mouseenter", { + originalEvent: event2, + processedItem + }); + }, "onItemMouseEnter"), + 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 getAriaPosInset(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 getMenuItemProps3(processedItem, index) { + return { + action: mergeProps({ + "class": this.cx("itemLink"), + tabindex: -1 + }, 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("label") + }, this.getPTOptions(processedItem, index, "label")), + submenuicon: mergeProps({ + "class": this.cx("submenuIcon") + }, this.getPTOptions(processedItem, index, "submenuIcon")) + }; + }, "getMenuItemProps") + }, + components: { + AngleRightIcon: script$1q, + AngleDownIcon: script$1H + }, + directives: { + ripple: Ripple + } +}; +var _hoisted_1$1$4 = ["tabindex"]; +var _hoisted_2$1$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$a = ["onClick", "onMouseenter"]; +var _hoisted_4$6 = ["href", "target"]; +var _hoisted_5$2 = ["id"]; +function render$1$5(_ctx, _cache, $props, $setup, $data, $options) { + var _component_MegaMenuSub = resolveComponent("MegaMenuSub", true); + var _directive_ripple = resolveDirective("ripple"); + return openBlock(), createElementBlock("ul", mergeProps({ + "class": $props.level === 0 ? _ctx.cx("rootList") : _ctx.cx("submenu"), + tabindex: $props.tabindex + }, $props.level === 0 ? _ctx.ptm("rootList") : _ctx.ptm("submenu")), [$props.submenu ? (openBlock(), createElementBlock("li", mergeProps({ + key: 0, + "class": [_ctx.cx("submenuLabel", { + submenu: $props.submenu + }), $options.getItemProp($props.submenu, "class")], + style: $options.getItemProp($props.submenu, "style"), + role: "presentation" + }, _ctx.ptm("submenuLabel")), toDisplayString($options.getItemLabel($props.submenu)), 17)) : createCommentVNode("", true), (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 onClick11($event) { + return $options.onItemClick($event, processedItem); + }, "onClick"), + onMouseenter: /* @__PURE__ */ __name(function onMouseenter($event) { + return $options.onItemMouseEnter($event, processedItem); + }, "onMouseenter"), + 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({ + "class": _ctx.cx("itemLabel"), + ref_for: true + }, $options.getPTOptions(processedItem, index, "itemLabel")), toDisplayString($options.getItemLabel(processedItem)), 17), $options.isItemGroup(processedItem) ? (openBlock(), createElementBlock(Fragment, { + key: 2 + }, [$props.templates.submenuicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.submenuicon), mergeProps({ + key: 0, + active: $options.isItemActive(processedItem), + "class": _ctx.cx("submenuIcon"), + ref_for: true + }, $options.getPTOptions(processedItem, index, "submenuIcon")), null, 16, ["active", "class"])) : (openBlock(), createBlock(resolveDynamicComponent($props.horizontal || $props.mobileActive ? "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_4$6)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { + key: 1, + item: processedItem.item, + hasSubmenu: $options.isItemGroup(processedItem), + label: $options.getItemLabel(processedItem), + props: $options.getMenuItemProps(processedItem, index) + }, null, 8, ["item", "hasSubmenu", "label", "props"]))], 16, _hoisted_3$a), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("overlay"), + ref_for: true + }, _ctx.ptm("overlay")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("grid"), + ref_for: true + }, _ctx.ptm("grid")), [(openBlock(true), createElementBlock(Fragment, null, renderList(processedItem.items, function(col) { + return openBlock(), createElementBlock("div", mergeProps({ + key: $options.getItemKey(col), + "class": _ctx.cx("column", { + processedItem + }), + ref_for: true + }, _ctx.ptm("column")), [(openBlock(true), createElementBlock(Fragment, null, renderList(col, function(submenu) { + return openBlock(), createBlock(_component_MegaMenuSub, { + key: $options.getSubListKey(submenu), + id: $options.getSubListId(submenu), + style: normalizeStyle(_ctx.sx("submenu", true, { + processedItem + })), + role: "menu", + menuId: $props.menuId, + focusedItemId: $props.focusedItemId, + submenu, + items: submenu.items, + templates: $props.templates, + level: $props.level + 1, + mobileActive: $props.mobileActive, + 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); + }) + }, null, 8, ["id", "style", "menuId", "focusedItemId", "submenu", "items", "templates", "level", "mobileActive", "pt", "unstyled"]); + }), 128))], 16); + }), 128))], 16)], 16)) : createCommentVNode("", true)], 16, _hoisted_2$1$3)) : 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$2)) : createCommentVNode("", true)], 64); + }), 128))], 16, _hoisted_1$1$4); +} +__name(render$1$5, "render$1$5"); +script$1$k.render = render$1$5; +var script$y = { + name: "MegaMenu", + "extends": script$2$5, + inheritAttrs: false, + emits: ["focus", "blur"], + outsideClickListener: null, + resizeListener: null, + matchMediaListener: null, + container: null, + menubar: null, + searchTimeout: null, + searchValue: null, + data: /* @__PURE__ */ __name(function data20() { + return { + id: this.$attrs.id, + mobileActive: false, + focused: false, + focusedItemInfo: { + index: -1, + key: "", + parentKey: "" + }, + activeItem: null, + dirty: false, + query: null, + queryMatches: false + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId5(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId"), + activeItem: /* @__PURE__ */ __name(function activeItem(newItem) { + if (isNotEmpty(newItem)) { + this.bindOutsideClickListener(); + this.bindResizeListener(); + } else { + this.unbindOutsideClickListener(); + this.unbindResizeListener(); + } + }, "activeItem") + }, + mounted: /* @__PURE__ */ __name(function mounted21() { + this.id = this.id || UniqueComponentId(); + this.bindMatchMediaListener(); + }, "mounted"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount8() { + this.mobileActive = false; + this.unbindOutsideClickListener(); + this.unbindResizeListener(); + this.unbindMatchMediaListener(); + }, "beforeUnmount"), + methods: { + getItemProp: /* @__PURE__ */ __name(function getItemProp3(item8, name4) { + return item8 ? resolve(item8[name4]) : void 0; + }, "getItemProp"), + getItemLabel: /* @__PURE__ */ __name(function getItemLabel2(item8) { + return this.getItemProp(item8, "label"); + }, "getItemLabel"), + isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled2(item8) { + return this.getItemProp(item8, "disabled"); + }, "isItemDisabled"), + isItemVisible: /* @__PURE__ */ __name(function isItemVisible2(item8) { + return this.getItemProp(item8, "visible") !== false; + }, "isItemVisible"), + isItemGroup: /* @__PURE__ */ __name(function isItemGroup2(item8) { + return isNotEmpty(this.getItemProp(item8, "items")); + }, "isItemGroup"), + isItemSeparator: /* @__PURE__ */ __name(function isItemSeparator(item8) { + return this.getItemProp(item8, "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 toggle2(event2) { + 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(); + event2.preventDefault(); + }, "toggle"), + show: /* @__PURE__ */ __name(function show2() { + this.focusedItemInfo = { + index: this.findFirstFocusedItemIndex(), + level: 0, + parentKey: "" + }; + focus(this.menubar); + }, "show"), + hide: /* @__PURE__ */ __name(function hide3(event2, isFocus) { + var _this2 = this; + if (this.mobileActive) { + this.mobileActive = false; + setTimeout(function() { + focus(_this2.$refs.menubutton, { + preventScroll: true + }); + }, 1); + } + this.activeItem = null; + this.focusedItemInfo = { + index: -1, + key: "", + parentKey: "" + }; + isFocus && focus(this.menubar); + this.dirty = false; + }, "hide"), + onFocus: /* @__PURE__ */ __name(function onFocus8(event2) { + this.focused = true; + if (this.focusedItemInfo.index === -1) { + var index = this.findFirstFocusedItemIndex(); + var processedItem = this.findVisibleItem(index); + this.focusedItemInfo = { + index, + key: processedItem.key, + parentKey: processedItem.parentKey + }; + } + this.$emit("focus", event2); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur8(event2) { + this.focused = false; + this.focusedItemInfo = { + index: -1, + key: "", + parentKey: "" + }; + this.searchValue = ""; + this.dirty = false; + this.$emit("blur", event2); + }, "onBlur"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown8(event2) { + if (this.disabled) { + event2.preventDefault(); + return; + } + var metaKey = event2.metaKey || event2.ctrlKey; + switch (event2.code) { + case "ArrowDown": + this.onArrowDownKey(event2); + break; + case "ArrowUp": + this.onArrowUpKey(event2); + break; + case "ArrowLeft": + this.onArrowLeftKey(event2); + break; + case "ArrowRight": + this.onArrowRightKey(event2); + break; + case "Home": + this.onHomeKey(event2); + break; + case "End": + this.onEndKey(event2); + break; + case "Space": + this.onSpaceKey(event2); + break; + case "Enter": + case "NumpadEnter": + this.onEnterKey(event2); + break; + case "Escape": + this.onEscapeKey(event2); + break; + case "Tab": + this.onTabKey(event2); + break; + case "PageDown": + case "PageUp": + case "Backspace": + case "ShiftLeft": + case "ShiftRight": + break; + default: + if (!metaKey && isPrintableCharacter(event2.key)) { + this.searchItems(event2, event2.key); + } + break; + } + }, "onKeyDown"), + onItemChange: /* @__PURE__ */ __name(function onItemChange(event2) { + var processedItem = event2.processedItem, isFocus = event2.isFocus; + if (isEmpty(processedItem)) return; + var index = processedItem.index, key = processedItem.key, parentKey = processedItem.parentKey, items2 = processedItem.items; + var grouped = isNotEmpty(items2); + grouped && (this.activeItem = processedItem); + this.focusedItemInfo = { + index, + key, + parentKey + }; + grouped && (this.dirty = true); + isFocus && focus(this.menubar); + }, "onItemChange"), + onItemClick: /* @__PURE__ */ __name(function onItemClick3(event2) { + var originalEvent = event2.originalEvent, processedItem = event2.processedItem; + var grouped = this.isProccessedItemGroup(processedItem); + var root35 = isEmpty(processedItem.parent); + var selected3 = this.isSelected(processedItem); + if (selected3) { + var index = processedItem.index, key = processedItem.key, parentKey = processedItem.parentKey; + this.activeItem = null; + this.focusedItemInfo = { + index, + key, + parentKey + }; + this.dirty = !root35; + if (!this.mobileActive) { + focus(this.menubar, { + preventScroll: true + }); + } + } else { + if (grouped) { + this.onItemChange(event2); + } else { + this.hide(originalEvent); + } + } + }, "onItemClick"), + onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter3(event2) { + if (!this.mobileActive && this.dirty) { + this.onItemChange(event2); + } + }, "onItemMouseEnter"), + menuButtonClick: /* @__PURE__ */ __name(function menuButtonClick(event2) { + this.toggle(event2); + }, "menuButtonClick"), + menuButtonKeydown: /* @__PURE__ */ __name(function menuButtonKeydown(event2) { + (event2.code === "Enter" || event2.code === "NumpadEnter" || event2.code === "Space") && this.menuButtonClick(event2); + }, "menuButtonKeydown"), + onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey4(event2) { + if (this.horizontal) { + if (isNotEmpty(this.activeItem) && this.activeItem.key === this.focusedItemInfo.key) { + this.focusedItemInfo = { + index: -1, + key: "", + parentKey: this.activeItem.key + }; + } else { + var processedItem = this.findVisibleItem(this.focusedItemInfo.index); + var grouped = this.isProccessedItemGroup(processedItem); + if (grouped) { + this.onItemChange({ + originalEvent: event2, + processedItem + }); + this.focusedItemInfo = { + index: -1, + key: processedItem.key, + parentKey: processedItem.parentKey + }; + this.searchValue = ""; + } + } + } + var itemIndex = this.focusedItemInfo.index !== -1 ? this.findNextItemIndex(this.focusedItemInfo.index) : this.findFirstFocusedItemIndex(); + this.changeFocusedItemInfo(event2, itemIndex); + event2.preventDefault(); + }, "onArrowDownKey"), + onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey4(event2) { + if (event2.altKey && this.horizontal) { + if (this.focusedItemInfo.index !== -1) { + var processedItem = this.findVisibleItem(this.focusedItemInfo.index); + var grouped = this.isProccessedItemGroup(processedItem); + if (!grouped && isNotEmpty(this.activeItem)) { + if (this.focusedItemInfo.index === 0) { + this.focusedItemInfo = { + index: this.activeItem.index, + key: this.activeItem.key, + parentKey: this.activeItem.parentKey + }; + this.activeItem = null; + } else { + this.changeFocusedItemInfo(event2, this.findFirstItemIndex()); + } + } + } + event2.preventDefault(); + } else { + var itemIndex = this.focusedItemInfo.index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo.index) : this.findLastFocusedItemIndex(); + this.changeFocusedItemInfo(event2, itemIndex); + event2.preventDefault(); + } + }, "onArrowUpKey"), + onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey2(event2) { + var processedItem = this.findVisibleItem(this.focusedItemInfo.index); + var grouped = this.isProccessedItemGroup(processedItem); + if (grouped) { + if (this.horizontal) { + var itemIndex = this.focusedItemInfo.index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo.index) : this.findLastFocusedItemIndex(); + this.changeFocusedItemInfo(event2, itemIndex); + } + } else { + if (this.vertical && isNotEmpty(this.activeItem)) { + if (processedItem.columnIndex === 0) { + this.focusedItemInfo = { + index: this.activeItem.index, + key: this.activeItem.key, + parentKey: this.activeItem.parentKey + }; + this.activeItem = null; + } + } + var columnIndex = processedItem.columnIndex - 1; + var _itemIndex = this.visibleItems.findIndex(function(item8) { + return item8.columnIndex === columnIndex; + }); + _itemIndex !== -1 && this.changeFocusedItemInfo(event2, _itemIndex); + } + event2.preventDefault(); + }, "onArrowLeftKey"), + onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey2(event2) { + var processedItem = this.findVisibleItem(this.focusedItemInfo.index); + var grouped = this.isProccessedItemGroup(processedItem); + if (grouped) { + if (this.vertical) { + if (isNotEmpty(this.activeItem) && this.activeItem.key === processedItem.key) { + this.focusedItemInfo = { + index: -1, + key: "", + parentKey: this.activeItem.key + }; + } else { + var _processedItem = this.findVisibleItem(this.focusedItemInfo.index); + var _grouped = this.isProccessedItemGroup(_processedItem); + if (_grouped) { + this.onItemChange({ + originalEvent: event2, + processedItem: _processedItem + }); + this.focusedItemInfo = { + index: -1, + key: _processedItem.key, + parentKey: _processedItem.parentKey + }; + this.searchValue = ""; + } + } + } + var itemIndex = this.focusedItemInfo.index !== -1 ? this.findNextItemIndex(this.focusedItemInfo.index) : this.findFirstFocusedItemIndex(); + this.changeFocusedItemInfo(event2, itemIndex); + } else { + var columnIndex = processedItem.columnIndex + 1; + var _itemIndex2 = this.visibleItems.findIndex(function(item8) { + return item8.columnIndex === columnIndex; + }); + _itemIndex2 !== -1 && this.changeFocusedItemInfo(event2, _itemIndex2); + } + event2.preventDefault(); + }, "onArrowRightKey"), + onHomeKey: /* @__PURE__ */ __name(function onHomeKey4(event2) { + this.changeFocusedItemInfo(event2, this.findFirstItemIndex()); + event2.preventDefault(); + }, "onHomeKey"), + onEndKey: /* @__PURE__ */ __name(function onEndKey4(event2) { + this.changeFocusedItemInfo(event2, this.findLastItemIndex()); + event2.preventDefault(); + }, "onEndKey"), + onEnterKey: /* @__PURE__ */ __name(function onEnterKey3(event2) { + 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.changeFocusedItemInfo(event2, this.findFirstFocusedItemIndex()); + } + event2.preventDefault(); + }, "onEnterKey"), + onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey3(event2) { + this.onEnterKey(event2); + }, "onSpaceKey"), + onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey2(event2) { + if (isNotEmpty(this.activeItem)) { + this.focusedItemInfo = { + index: this.activeItem.index, + key: this.activeItem.key + }; + this.activeItem = null; + } + event2.preventDefault(); + }, "onEscapeKey"), + onTabKey: /* @__PURE__ */ __name(function onTabKey2(event2) { + if (this.focusedItemInfo.index !== -1) { + var processedItem = this.findVisibleItem(this.focusedItemInfo.index); + var grouped = this.isProccessedItemGroup(processedItem); + !grouped && this.onItemChange({ + originalEvent: event2, + processedItem + }); + } + this.hide(); + }, "onTabKey"), + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener4() { + var _this3 = this; + if (!this.outsideClickListener) { + this.outsideClickListener = function(event2) { + var isOutsideContainer = _this3.container && !_this3.container.contains(event2.target); + var isOutsideTarget = !(_this3.target && (_this3.target === event2.target || _this3.target.contains(event2.target))); + if (isOutsideContainer && isOutsideTarget) { + _this3.hide(); + } + }; + document.addEventListener("click", this.outsideClickListener); + } + }, "bindOutsideClickListener"), + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener4() { + if (this.outsideClickListener) { + document.removeEventListener("click", this.outsideClickListener); + this.outsideClickListener = null; + } + }, "unbindOutsideClickListener"), + bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener3() { + var _this4 = this; + if (!this.resizeListener) { + this.resizeListener = function(event2) { + if (!isTouchDevice()) { + _this4.hide(event2, true); + } + _this4.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 bindMatchMediaListener4() { + var _this5 = this; + if (!this.matchMediaListener) { + var query = matchMedia("(max-width: ".concat(this.breakpoint, ")")); + this.query = query; + this.queryMatches = query.matches; + this.matchMediaListener = function() { + _this5.queryMatches = query.matches; + _this5.mobileActive = false; + }; + this.query.addEventListener("change", this.matchMediaListener); + } + }, "bindMatchMediaListener"), + unbindMatchMediaListener: /* @__PURE__ */ __name(function unbindMatchMediaListener4() { + 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 isSelected3(processedItem) { + return isNotEmpty(this.activeItem) ? this.activeItem.key === processedItem.key : false; + }, "isSelected"), + findFirstItemIndex: /* @__PURE__ */ __name(function findFirstItemIndex() { + var _this6 = this; + return this.visibleItems.findIndex(function(processedItem) { + return _this6.isValidItem(processedItem); + }); + }, "findFirstItemIndex"), + findLastItemIndex: /* @__PURE__ */ __name(function findLastItemIndex() { + var _this7 = this; + return findLastIndex(this.visibleItems, function(processedItem) { + return _this7.isValidItem(processedItem); + }); + }, "findLastItemIndex"), + findNextItemIndex: /* @__PURE__ */ __name(function findNextItemIndex(index) { + var _this8 = this; + var matchedItemIndex = index < this.visibleItems.length - 1 ? this.visibleItems.slice(index + 1).findIndex(function(processedItem) { + return _this8.isValidItem(processedItem); + }) : -1; + return matchedItemIndex > -1 ? matchedItemIndex + index + 1 : index; + }, "findNextItemIndex"), + findPrevItemIndex: /* @__PURE__ */ __name(function findPrevItemIndex(index) { + var _this9 = this; + var matchedItemIndex = index > 0 ? findLastIndex(this.visibleItems.slice(0, index), function(processedItem) { + return _this9.isValidItem(processedItem); + }) : -1; + return matchedItemIndex > -1 ? matchedItemIndex : index; + }, "findPrevItemIndex"), + findSelectedItemIndex: /* @__PURE__ */ __name(function findSelectedItemIndex() { + var _this10 = this; + return this.visibleItems.findIndex(function(processedItem) { + return _this10.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"), + findVisibleItem: /* @__PURE__ */ __name(function findVisibleItem(index) { + return isNotEmpty(this.visibleItems) ? this.visibleItems[index] : null; + }, "findVisibleItem"), + searchItems: /* @__PURE__ */ __name(function searchItems(event2, _char) { + var _this11 = 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 _this11.isItemMatched(processedItem); + }); + itemIndex = itemIndex === -1 ? this.visibleItems.slice(0, this.focusedItemInfo.index).findIndex(function(processedItem) { + return _this11.isItemMatched(processedItem); + }) : itemIndex + this.focusedItemInfo.index; + } else { + itemIndex = this.visibleItems.findIndex(function(processedItem) { + return _this11.isItemMatched(processedItem); + }); + } + if (itemIndex !== -1) { + matched = true; + } + if (itemIndex === -1 && this.focusedItemInfo.index === -1) { + itemIndex = this.findFirstFocusedItemIndex(); + } + if (itemIndex !== -1) { + this.changeFocusedItemInfo(event2, itemIndex); + } + if (this.searchTimeout) { + clearTimeout(this.searchTimeout); + } + this.searchTimeout = setTimeout(function() { + _this11.searchValue = ""; + _this11.searchTimeout = null; + }, 500); + return matched; + }, "searchItems"), + changeFocusedItemInfo: /* @__PURE__ */ __name(function changeFocusedItemInfo(event2, index) { + var processedItem = this.findVisibleItem(index); + this.focusedItemInfo.index = index; + this.focusedItemInfo.key = isNotEmpty(processedItem) ? processedItem.key : ""; + this.scrollInView(); + }, "changeFocusedItemInfo"), + scrollInView: /* @__PURE__ */ __name(function scrollInView3() { + var index = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : -1; + var id4 = index !== -1 ? "".concat(this.id, "_").concat(index) : this.focusedItemId; + var element; + if (id4 === null && this.queryMatches) { + element = this.$refs.menubutton; + } else { + element = findSingle(this.menubar, 'li[id="'.concat(id4, '"]')); + } + if (element) { + element.scrollIntoView && element.scrollIntoView({ + block: "nearest", + inline: "nearest", + behavior: "smooth" + }); + } + }, "scrollInView"), + createProcessedItems: /* @__PURE__ */ __name(function createProcessedItems(items2) { + var _this12 = 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 columnIndex = arguments.length > 4 ? arguments[4] : void 0; + var processedItems3 = []; + items2 && items2.forEach(function(item8, index) { + var key = (parentKey !== "" ? parentKey + "_" : "") + (columnIndex !== void 0 ? columnIndex + "_" : "") + index; + var newItem = { + item: item8, + index, + level, + key, + parent, + parentKey, + columnIndex: columnIndex !== void 0 ? columnIndex : parent.columnIndex !== void 0 ? parent.columnIndex : index + }; + newItem["items"] = level === 0 && item8.items && item8.items.length > 0 ? item8.items.map(function(_items, _index) { + return _this12.createProcessedItems(_items, level + 1, newItem, key, _index); + }) : _this12.createProcessedItems(item8.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 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 processedItem = isNotEmpty(this.activeItem) ? this.activeItem : null; + return processedItem && processedItem.key === this.focusedItemInfo.parentKey ? processedItem.items.reduce(function(items2, col) { + col.forEach(function(submenu) { + submenu.items.forEach(function(a) { + items2.push(a); + }); + }); + return items2; + }, []) : this.processedItems; + }, "visibleItems"), + horizontal: /* @__PURE__ */ __name(function horizontal() { + return this.orientation === "horizontal"; + }, "horizontal"), + vertical: /* @__PURE__ */ __name(function vertical() { + return this.orientation === "vertical"; + }, "vertical"), + focusedItemId: /* @__PURE__ */ __name(function focusedItemId() { + return isNotEmpty(this.focusedItemInfo.key) ? "".concat(this.id, "_").concat(this.focusedItemInfo.key) : null; + }, "focusedItemId") + }, + components: { + MegaMenuSub: script$1$k, + BarsIcon: script$1I + } +}; +var _hoisted_1$i = ["id"]; +var _hoisted_2$d = ["aria-haspopup", "aria-expanded", "aria-controls", "aria-label"]; +function render$u(_ctx, _cache, $props, $setup, $data, $options) { + var _component_BarsIcon = resolveComponent("BarsIcon"); + var _component_MegaMenuSub = resolveComponent("MegaMenuSub"); + return openBlock(), createElementBlock("div", mergeProps({ + ref: $options.containerRef, + id: $data.id, + "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(event2) { + return $options.menuButtonClick(event2); + }, "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); + }) + }, _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_2$d)) : createCommentVNode("", true)]; + }), createVNode(_component_MegaMenuSub, { + ref: $options.menubarRef, + id: $data.id + "_list", + tabindex: !_ctx.disabled ? _ctx.tabindex : -1, + role: "menubar", + "aria-label": _ctx.ariaLabel, + "aria-labelledby": _ctx.ariaLabelledby, + "aria-disabled": _ctx.disabled || void 0, + "aria-orientation": _ctx.orientation, + "aria-activedescendant": $data.focused ? $options.focusedItemId : void 0, + menuId: $data.id, + focusedItemId: $data.focused ? $options.focusedItemId : void 0, + items: $options.processedItems, + horizontal: $options.horizontal, + templates: _ctx.$slots, + activeItem: $data.activeItem, + mobileActive: $data.mobileActive, + level: 0, + style: normalizeStyle(_ctx.sx("rootList")), + pt: _ctx.pt, + unstyled: _ctx.unstyled, + onFocus: $options.onFocus, + onBlur: $options.onBlur, + onKeydown: $options.onKeyDown, + onItemClick: $options.onItemClick, + onItemMouseenter: $options.onItemMouseEnter + }, null, 8, ["id", "tabindex", "aria-label", "aria-labelledby", "aria-disabled", "aria-orientation", "aria-activedescendant", "menuId", "focusedItemId", "items", "horizontal", "templates", "activeItem", "mobileActive", "style", "pt", "unstyled", "onFocus", "onBlur", "onKeydown", "onItemClick", "onItemMouseenter"]), _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$i); +} +__name(render$u, "render$u"); +script$y.render = render$u; +var theme$i = /* @__PURE__ */ __name(function theme22(_ref) { + var dt = _ref.dt; + return "\n.p-menu {\n background: ".concat(dt("menu.background"), ";\n color: ").concat(dt("menu.color"), ";\n border: 1px solid ").concat(dt("menu.border.color"), ";\n border-radius: ").concat(dt("menu.border.radius"), ";\n min-width: 12.5rem;\n}\n\n.p-menu-list {\n margin: 0;\n padding: ").concat(dt("menu.list.padding"), ";\n outline: 0 none;\n list-style: none;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("menu.list.gap"), ";\n}\n\n.p-menu-item-content {\n transition: background ").concat(dt("menu.transition.duration"), ", color ").concat(dt("menu.transition.duration"), ";\n border-radius: ").concat(dt("menu.item.border.radius"), ";\n color: ").concat(dt("menu.item.color"), ";\n}\n\n.p-menu-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("menu.item.padding"), ";\n gap: ").concat(dt("menu.item.gap"), ";\n user-select: none;\n outline: 0 none;\n}\n\n.p-menu-item-label {\n line-height: 1;\n}\n\n.p-menu-item-icon {\n color: ").concat(dt("menu.item.icon.color"), ";\n}\n\n.p-menu-item.p-focus .p-menu-item-content {\n color: ").concat(dt("menu.item.focus.color"), ";\n background: ").concat(dt("menu.item.focus.background"), ";\n}\n\n.p-menu-item.p-focus .p-menu-item-icon {\n color: ").concat(dt("menu.item.icon.focus.color"), ";\n}\n\n.p-menu-item:not(.p-disabled) .p-menu-item-content:hover {\n color: ").concat(dt("menu.item.focus.color"), ";\n background: ").concat(dt("menu.item.focus.background"), ";\n}\n\n.p-menu-item:not(.p-disabled) .p-menu-item-content:hover .p-menu-item-icon {\n color: ").concat(dt("menu.item.icon.focus.color"), ";\n}\n\n.p-menu-overlay {\n box-shadow: ").concat(dt("menu.shadow"), ";\n}\n\n.p-menu-submenu-label {\n background: ").concat(dt("menu.submenu.label.background"), ";\n padding: ").concat(dt("menu.submenu.label.padding"), ";\n color: ").concat(dt("menu.submenu.label.color"), ";\n font-weight: ").concat(dt("menu.submenu.label.font.weight"), ";\n}\n\n.p-menu-separator {\n border-block-start: 1px solid ").concat(dt("menu.separator.border.color"), ";\n}\n"); +}, "theme"); +var classes$j = { + root: /* @__PURE__ */ __name(function root18(_ref2) { + var props = _ref2.props; + return ["p-menu p-component", { + "p-menu-overlay": props.popup + }]; + }, "root"), + start: "p-menu-start", + list: "p-menu-list", + submenuLabel: "p-menu-submenu-label", + separator: "p-menu-separator", + end: "p-menu-end", + item: /* @__PURE__ */ __name(function item4(_ref3) { + var instance = _ref3.instance; + return ["p-menu-item", { + "p-focus": instance.id === instance.focusedOptionId, + "p-disabled": instance.disabled() + }]; + }, "item"), + itemContent: "p-menu-item-content", + itemLink: "p-menu-item-link", + itemIcon: "p-menu-item-icon", + itemLabel: "p-menu-item-label" +}; +var MenuStyle = BaseStyle.extend({ + name: "menu", + theme: theme$i, + classes: classes$j +}); +var script$2$4 = { + name: "BaseMenu", + "extends": script$1d, + props: { + popup: { + type: Boolean, + "default": false + }, + model: { + type: Array, + "default": null + }, + appendTo: { + type: [String, Object], + "default": "body" + }, + autoZIndex: { + type: Boolean, + "default": true + }, + baseZIndex: { + type: Number, + "default": 0 + }, + tabindex: { + type: Number, + "default": 0 + }, + ariaLabel: { + type: String, + "default": null + }, + ariaLabelledby: { + type: String, + "default": null + } + }, + style: MenuStyle, + provide: /* @__PURE__ */ __name(function provide32() { + return { + $pcMenu: this, + $parentInstance: this + }; + }, "provide") +}; +var script$1$j = { + name: "Menuitem", + hostName: "Menu", + "extends": script$1d, + inheritAttrs: false, + emits: ["item-click", "item-mousemove"], + props: { + item: null, + templates: null, + id: null, + focusedOptionId: null, + index: null + }, + methods: { + getItemProp: /* @__PURE__ */ __name(function getItemProp4(processedItem, name4) { + return processedItem && processedItem.item ? resolve(processedItem.item[name4]) : void 0; + }, "getItemProp"), + getPTOptions: /* @__PURE__ */ __name(function getPTOptions4(key) { + return this.ptm(key, { + context: { + item: this.item, + index: this.index, + focused: this.isItemFocused(), + disabled: this.disabled() + } + }); + }, "getPTOptions"), + isItemFocused: /* @__PURE__ */ __name(function isItemFocused2() { + return this.focusedOptionId === this.id; + }, "isItemFocused"), + onItemClick: /* @__PURE__ */ __name(function onItemClick4(event2) { + var command = this.getItemProp(this.item, "command"); + command && command({ + originalEvent: event2, + item: this.item.item + }); + this.$emit("item-click", { + originalEvent: event2, + item: this.item, + id: this.id + }); + }, "onItemClick"), + onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove(event2) { + this.$emit("item-mousemove", { + originalEvent: event2, + item: this.item, + id: this.id + }); + }, "onItemMouseMove"), + visible: /* @__PURE__ */ __name(function visible2() { + return typeof this.item.visible === "function" ? this.item.visible() : this.item.visible !== false; + }, "visible"), + disabled: /* @__PURE__ */ __name(function disabled3() { + return typeof this.item.disabled === "function" ? this.item.disabled() : this.item.disabled; + }, "disabled"), + label: /* @__PURE__ */ __name(function label4() { + return typeof this.item.label === "function" ? this.item.label() : this.item.label; + }, "label"), + getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps4(item8) { + return { + action: mergeProps({ + "class": this.cx("itemLink"), + tabindex: "-1" + }, this.getPTOptions("itemLink")), + icon: mergeProps({ + "class": [this.cx("itemIcon"), item8.icon] + }, this.getPTOptions("itemIcon")), + label: mergeProps({ + "class": this.cx("itemLabel") + }, this.getPTOptions("itemLabel")) + }; + }, "getMenuItemProps") + }, + directives: { + ripple: Ripple + } +}; +var _hoisted_1$1$3 = ["id", "aria-label", "aria-disabled", "data-p-focused", "data-p-disabled"]; +var _hoisted_2$1$2 = ["href", "target"]; +function render$1$4(_ctx, _cache, $props, $setup, $data, $options) { + var _directive_ripple = resolveDirective("ripple"); + return $options.visible() ? (openBlock(), createElementBlock("li", mergeProps({ + key: 0, + id: $props.id, + "class": [_ctx.cx("item"), $props.item["class"]], + role: "menuitem", + style: $props.item.style, + "aria-label": $options.label(), + "aria-disabled": $options.disabled() + }, $options.getPTOptions("item"), { + "data-p-focused": $options.isItemFocused(), + "data-p-disabled": $options.disabled() || false + }), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("itemContent"), + onClick: _cache[0] || (_cache[0] = function($event) { + return $options.onItemClick($event); + }), + onMousemove: _cache[1] || (_cache[1] = function($event) { + return $options.onItemMouseMove($event); + }) + }, $options.getPTOptions("itemContent")), [!$props.templates.item ? withDirectives((openBlock(), createElementBlock("a", mergeProps({ + key: 0, + href: $props.item.url, + "class": _ctx.cx("itemLink"), + target: $props.item.target, + tabindex: "-1" + }, $options.getPTOptions("itemLink")), [$props.templates.itemicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.itemicon), { + key: 0, + item: $props.item, + "class": normalizeClass(_ctx.cx("itemIcon")) + }, null, 8, ["item", "class"])) : $props.item.icon ? (openBlock(), createElementBlock("span", mergeProps({ + key: 1, + "class": [_ctx.cx("itemIcon"), $props.item.icon] + }, $options.getPTOptions("itemIcon")), null, 16)) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ + "class": _ctx.cx("itemLabel") + }, $options.getPTOptions("itemLabel")), toDisplayString($options.label()), 17)], 16, _hoisted_2$1$2)), [[_directive_ripple]]) : $props.templates.item ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { + key: 1, + item: $props.item, + label: $options.label(), + props: $options.getMenuItemProps($props.item) + }, null, 8, ["item", "label", "props"])) : createCommentVNode("", true)], 16)], 16, _hoisted_1$1$3)) : createCommentVNode("", true); +} +__name(render$1$4, "render$1$4"); +script$1$j.render = render$1$4; +function _toConsumableArray$7(r) { + return _arrayWithoutHoles$7(r) || _iterableToArray$7(r) || _unsupportedIterableToArray$8(r) || _nonIterableSpread$7(); +} +__name(_toConsumableArray$7, "_toConsumableArray$7"); +function _nonIterableSpread$7() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableSpread$7, "_nonIterableSpread$7"); +function _unsupportedIterableToArray$8(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$8(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$8(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$8, "_unsupportedIterableToArray$8"); +function _iterableToArray$7(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray$7, "_iterableToArray$7"); +function _arrayWithoutHoles$7(r) { + if (Array.isArray(r)) return _arrayLikeToArray$8(r); +} +__name(_arrayWithoutHoles$7, "_arrayWithoutHoles$7"); +function _arrayLikeToArray$8(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; +} +__name(_arrayLikeToArray$8, "_arrayLikeToArray$8"); +var script$x = { + name: "Menu", + "extends": script$2$4, + inheritAttrs: false, + emits: ["show", "hide", "focus", "blur"], + data: /* @__PURE__ */ __name(function data21() { + return { + id: this.$attrs.id, + overlayVisible: false, + focused: false, + focusedOptionIndex: -1, + selectedOptionIndex: -1 + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId6(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId") + }, + target: null, + outsideClickListener: null, + scrollHandler: null, + resizeListener: null, + container: null, + list: null, + mounted: /* @__PURE__ */ __name(function mounted22() { + this.id = this.id || UniqueComponentId(); + if (!this.popup) { + this.bindResizeListener(); + this.bindOutsideClickListener(); + } + }, "mounted"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount9() { + this.unbindResizeListener(); + this.unbindOutsideClickListener(); + if (this.scrollHandler) { + this.scrollHandler.destroy(); + this.scrollHandler = null; + } + this.target = null; + if (this.container && this.autoZIndex) { + ZIndex.clear(this.container); + } + this.container = null; + }, "beforeUnmount"), + methods: { + itemClick: /* @__PURE__ */ __name(function itemClick(event2) { + var item8 = event2.item; + if (this.disabled(item8)) { + return; + } + if (item8.command) { + item8.command(event2); + } + if (this.overlayVisible) this.hide(); + if (!this.popup && this.focusedOptionIndex !== event2.id) { + this.focusedOptionIndex = event2.id; + } + }, "itemClick"), + itemMouseMove: /* @__PURE__ */ __name(function itemMouseMove(event2) { + if (this.focused) { + this.focusedOptionIndex = event2.id; + } + }, "itemMouseMove"), + onListFocus: /* @__PURE__ */ __name(function onListFocus2(event2) { + this.focused = true; + !this.popup && this.changeFocusedOptionIndex(0); + this.$emit("focus", event2); + }, "onListFocus"), + onListBlur: /* @__PURE__ */ __name(function onListBlur2(event2) { + this.focused = false; + this.focusedOptionIndex = -1; + this.$emit("blur", event2); + }, "onListBlur"), + onListKeyDown: /* @__PURE__ */ __name(function onListKeyDown2(event2) { + switch (event2.code) { + case "ArrowDown": + this.onArrowDownKey(event2); + break; + case "ArrowUp": + this.onArrowUpKey(event2); + break; + case "Home": + this.onHomeKey(event2); + break; + case "End": + this.onEndKey(event2); + break; + case "Enter": + case "NumpadEnter": + this.onEnterKey(event2); + break; + case "Space": + this.onSpaceKey(event2); + break; + case "Escape": + if (this.popup) { + focus(this.target); + this.hide(); + } + case "Tab": + this.overlayVisible && this.hide(); + break; + } + }, "onListKeyDown"), + onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey5(event2) { + var optionIndex = this.findNextOptionIndex(this.focusedOptionIndex); + this.changeFocusedOptionIndex(optionIndex); + event2.preventDefault(); + }, "onArrowDownKey"), + onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey5(event2) { + if (event2.altKey && this.popup) { + focus(this.target); + this.hide(); + event2.preventDefault(); + } else { + var optionIndex = this.findPrevOptionIndex(this.focusedOptionIndex); + this.changeFocusedOptionIndex(optionIndex); + event2.preventDefault(); + } + }, "onArrowUpKey"), + onHomeKey: /* @__PURE__ */ __name(function onHomeKey5(event2) { + this.changeFocusedOptionIndex(0); + event2.preventDefault(); + }, "onHomeKey"), + onEndKey: /* @__PURE__ */ __name(function onEndKey5(event2) { + this.changeFocusedOptionIndex(find(this.container, 'li[data-pc-section="item"][data-p-disabled="false"]').length - 1); + event2.preventDefault(); + }, "onEndKey"), + onEnterKey: /* @__PURE__ */ __name(function onEnterKey4(event2) { + var element = findSingle(this.list, 'li[id="'.concat("".concat(this.focusedOptionIndex), '"]')); + var anchorElement = element && findSingle(element, 'a[data-pc-section="itemlink"]'); + this.popup && focus(this.target); + anchorElement ? anchorElement.click() : element && element.click(); + event2.preventDefault(); + }, "onEnterKey"), + onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey4(event2) { + this.onEnterKey(event2); + }, "onSpaceKey"), + findNextOptionIndex: /* @__PURE__ */ __name(function findNextOptionIndex3(index) { + var links = find(this.container, 'li[data-pc-section="item"][data-p-disabled="false"]'); + var matchedOptionIndex = _toConsumableArray$7(links).findIndex(function(link) { + return link.id === index; + }); + return matchedOptionIndex > -1 ? matchedOptionIndex + 1 : 0; + }, "findNextOptionIndex"), + findPrevOptionIndex: /* @__PURE__ */ __name(function findPrevOptionIndex3(index) { + var links = find(this.container, 'li[data-pc-section="item"][data-p-disabled="false"]'); + var matchedOptionIndex = _toConsumableArray$7(links).findIndex(function(link) { + return link.id === index; + }); + return matchedOptionIndex > -1 ? matchedOptionIndex - 1 : 0; + }, "findPrevOptionIndex"), + changeFocusedOptionIndex: /* @__PURE__ */ __name(function changeFocusedOptionIndex3(index) { + var links = find(this.container, 'li[data-pc-section="item"][data-p-disabled="false"]'); + var order = index >= links.length ? links.length - 1 : index < 0 ? 0 : index; + order > -1 && (this.focusedOptionIndex = links[order].getAttribute("id")); + }, "changeFocusedOptionIndex"), + toggle: /* @__PURE__ */ __name(function toggle3(event2) { + if (this.overlayVisible) this.hide(); + else this.show(event2); + }, "toggle"), + show: /* @__PURE__ */ __name(function show3(event2) { + this.overlayVisible = true; + this.target = event2.currentTarget; + }, "show"), + hide: /* @__PURE__ */ __name(function hide4() { + this.overlayVisible = false; + this.target = null; + }, "hide"), + onEnter: /* @__PURE__ */ __name(function onEnter3(el) { + addStyle(el, { + position: "absolute", + top: "0", + left: "0" + }); + this.alignOverlay(); + this.bindOutsideClickListener(); + this.bindResizeListener(); + this.bindScrollListener(); + if (this.autoZIndex) { + ZIndex.set("menu", el, this.baseZIndex + this.$primevue.config.zIndex.menu); + } + if (this.popup) { + focus(this.list); + } + this.$emit("show"); + }, "onEnter"), + onLeave: /* @__PURE__ */ __name(function onLeave3() { + this.unbindOutsideClickListener(); + this.unbindResizeListener(); + this.unbindScrollListener(); + this.$emit("hide"); + }, "onLeave"), + onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave3(el) { + if (this.autoZIndex) { + ZIndex.clear(el); + } + }, "onAfterLeave"), + alignOverlay: /* @__PURE__ */ __name(function alignOverlay3() { + absolutePosition(this.container, this.target); + var targetWidth = getOuterWidth(this.target); + if (targetWidth > getOuterWidth(this.container)) { + this.container.style.minWidth = getOuterWidth(this.target) + "px"; + } + }, "alignOverlay"), + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener5() { + var _this = this; + if (!this.outsideClickListener) { + this.outsideClickListener = function(event2) { + var isOutsideContainer = _this.container && !_this.container.contains(event2.target); + var isOutsideTarget = !(_this.target && (_this.target === event2.target || _this.target.contains(event2.target))); + if (_this.overlayVisible && isOutsideContainer && isOutsideTarget) { + _this.hide(); + } else if (!_this.popup && isOutsideContainer && isOutsideTarget) { + _this.focusedOptionIndex = -1; + } + }; + document.addEventListener("click", this.outsideClickListener); + } + }, "bindOutsideClickListener"), + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener5() { + if (this.outsideClickListener) { + document.removeEventListener("click", this.outsideClickListener); + this.outsideClickListener = null; + } + }, "unbindOutsideClickListener"), + bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener4() { + var _this2 = this; + if (!this.scrollHandler) { + this.scrollHandler = new ConnectedOverlayScrollHandler(this.target, function() { + if (_this2.overlayVisible) { + _this2.hide(); + } + }); + } + this.scrollHandler.bindScrollListener(); + }, "bindScrollListener"), + unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener4() { + if (this.scrollHandler) { + this.scrollHandler.unbindScrollListener(); + } + }, "unbindScrollListener"), + bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener4() { + var _this3 = this; + if (!this.resizeListener) { + this.resizeListener = function() { + if (_this3.overlayVisible && !isTouchDevice()) { + _this3.hide(); + } + }; + window.addEventListener("resize", this.resizeListener); + } + }, "bindResizeListener"), + unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener4() { + if (this.resizeListener) { + window.removeEventListener("resize", this.resizeListener); + this.resizeListener = null; + } + }, "unbindResizeListener"), + visible: /* @__PURE__ */ __name(function visible3(item8) { + return typeof item8.visible === "function" ? item8.visible() : item8.visible !== false; + }, "visible"), + disabled: /* @__PURE__ */ __name(function disabled4(item8) { + return typeof item8.disabled === "function" ? item8.disabled() : item8.disabled; + }, "disabled"), + label: /* @__PURE__ */ __name(function label5(item8) { + return typeof item8.label === "function" ? item8.label() : item8.label; + }, "label"), + onOverlayClick: /* @__PURE__ */ __name(function onOverlayClick3(event2) { + OverlayEventBus.emit("overlay-click", { + originalEvent: event2, + target: this.target + }); + }, "onOverlayClick"), + containerRef: /* @__PURE__ */ __name(function containerRef4(el) { + this.container = el; + }, "containerRef"), + listRef: /* @__PURE__ */ __name(function listRef(el) { + this.list = el; + }, "listRef") + }, + computed: { + focusedOptionId: /* @__PURE__ */ __name(function focusedOptionId4() { + return this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : null; + }, "focusedOptionId") + }, + components: { + PVMenuitem: script$1$j, + Portal: script$1f + } +}; +var _hoisted_1$h = ["id"]; +var _hoisted_2$c = ["id", "tabindex", "aria-activedescendant", "aria-label", "aria-labelledby"]; +var _hoisted_3$9 = ["id"]; +function render$t(_ctx, _cache, $props, $setup, $data, $options) { + var _component_PVMenuitem = resolveComponent("PVMenuitem"); + var _component_Portal = resolveComponent("Portal"); + return openBlock(), createBlock(_component_Portal, { + appendTo: _ctx.appendTo, + disabled: !_ctx.popup + }, { + "default": withCtx(function() { + return [createVNode(Transition, mergeProps({ + name: "p-connected-overlay", + onEnter: $options.onEnter, + onLeave: $options.onLeave, + onAfterLeave: $options.onAfterLeave + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [(_ctx.popup ? $data.overlayVisible : true) ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: $options.containerRef, + id: $data.id, + "class": _ctx.cx("root"), + onClick: _cache[3] || (_cache[3] = function() { + return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); + }) + }, _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), createBaseVNode("ul", mergeProps({ + ref: $options.listRef, + id: $data.id + "_list", + "class": _ctx.cx("list"), + role: "menu", + tabindex: _ctx.tabindex, + "aria-activedescendant": $data.focused ? $options.focusedOptionId : void 0, + "aria-label": _ctx.ariaLabel, + "aria-labelledby": _ctx.ariaLabelledby, + onFocus: _cache[0] || (_cache[0] = function() { + return $options.onListFocus && $options.onListFocus.apply($options, arguments); + }), + onBlur: _cache[1] || (_cache[1] = function() { + return $options.onListBlur && $options.onListBlur.apply($options, arguments); + }), + onKeydown: _cache[2] || (_cache[2] = function() { + return $options.onListKeyDown && $options.onListKeyDown.apply($options, arguments); + }) + }, _ctx.ptm("list")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model, function(item8, i) { + return openBlock(), createElementBlock(Fragment, { + key: $options.label(item8) + i.toString() + }, [item8.items && $options.visible(item8) && !item8.separator ? (openBlock(), createElementBlock(Fragment, { + key: 0 + }, [item8.items ? (openBlock(), createElementBlock("li", mergeProps({ + key: 0, + id: $data.id + "_" + i, + "class": [_ctx.cx("submenuLabel"), item8["class"]], + role: "none", + ref_for: true + }, _ctx.ptm("submenuLabel")), [renderSlot(_ctx.$slots, _ctx.$slots.submenulabel ? "submenulabel" : "submenuheader", { + item: item8 + }, function() { + return [createTextVNode(toDisplayString($options.label(item8)), 1)]; + })], 16, _hoisted_3$9)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(item8.items, function(child, j) { + return openBlock(), createElementBlock(Fragment, { + key: child.label + i + "_" + j + }, [$options.visible(child) && !child.separator ? (openBlock(), createBlock(_component_PVMenuitem, { + key: 0, + id: $data.id + "_" + i + "_" + j, + item: child, + templates: _ctx.$slots, + focusedOptionId: $options.focusedOptionId, + unstyled: _ctx.unstyled, + onItemClick: $options.itemClick, + onItemMousemove: $options.itemMouseMove, + pt: _ctx.pt + }, null, 8, ["id", "item", "templates", "focusedOptionId", "unstyled", "onItemClick", "onItemMousemove", "pt"])) : $options.visible(child) && child.separator ? (openBlock(), createElementBlock("li", mergeProps({ + key: "separator" + i + j, + "class": [_ctx.cx("separator"), item8["class"]], + style: child.style, + role: "separator", + ref_for: true + }, _ctx.ptm("separator")), null, 16)) : createCommentVNode("", true)], 64); + }), 128))], 64)) : $options.visible(item8) && item8.separator ? (openBlock(), createElementBlock("li", mergeProps({ + key: "separator" + i.toString(), + "class": [_ctx.cx("separator"), item8["class"]], + style: item8.style, + role: "separator", + ref_for: true + }, _ctx.ptm("separator")), null, 16)) : (openBlock(), createBlock(_component_PVMenuitem, { + key: $options.label(item8) + i.toString(), + id: $data.id + "_" + i, + item: item8, + index: i, + templates: _ctx.$slots, + focusedOptionId: $options.focusedOptionId, + unstyled: _ctx.unstyled, + onItemClick: $options.itemClick, + onItemMousemove: $options.itemMouseMove, + pt: _ctx.pt + }, null, 8, ["id", "item", "index", "templates", "focusedOptionId", "unstyled", "onItemClick", "onItemMousemove", "pt"]))], 64); + }), 128))], 16, _hoisted_2$c), _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$h)) : createCommentVNode("", true)]; + }), + _: 3 + }, 16, ["onEnter", "onLeave", "onAfterLeave"])]; + }), + _: 3 + }, 8, ["appendTo", "disabled"]); +} +__name(render$t, "render$t"); +script$x.render = render$t; +var theme$h = /* @__PURE__ */ __name(function theme23(_ref) { + var dt = _ref.dt; + return "\n.p-metergroup {\n display: flex;\n gap: ".concat(dt("metergroup.gap"), ";\n}\n\n.p-metergroup-meters {\n display: flex;\n background: ").concat(dt("metergroup.meters.background"), ";\n border-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n\n.p-metergroup-label-list {\n display: flex;\n flex-wrap: wrap;\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n\n.p-metergroup-label {\n display: inline-flex;\n align-items: center;\n gap: ").concat(dt("metergroup.label.gap"), ";\n}\n\n.p-metergroup-label-marker {\n display: inline-flex;\n width: ").concat(dt("metergroup.label.marker.size"), ";\n height: ").concat(dt("metergroup.label.marker.size"), ";\n border-radius: 100%;\n}\n\n.p-metergroup-label-icon {\n font-size: ").concat(dt("metergroup.label.icon.size"), ";\n width: ").concat(dt("metergroup.label.icon.size"), ";\n height: ").concat(dt("metergroup.label.icon.size"), ";\n}\n\n.p-metergroup-horizontal {\n flex-direction: column;\n}\n\n.p-metergroup-label-list-horizontal {\n gap: ").concat(dt("metergroup.label.list.horizontal.gap"), ";\n}\n\n.p-metergroup-horizontal .p-metergroup-meters {\n height: ").concat(dt("metergroup.meters.size"), ";\n}\n\n.p-metergroup-horizontal .p-metergroup-meter:first-of-type {\n border-start-start-radius: ").concat(dt("metergroup.border.radius"), ";\n border-end-start-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n\n.p-metergroup-horizontal .p-metergroup-meter:last-of-type {\n border-start-end-radius: ").concat(dt("metergroup.border.radius"), ";\n border-end-end-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n\n.p-metergroup-vertical {\n flex-direction: row;\n}\n\n.p-metergroup-label-list-vertical {\n flex-direction: column;\n gap: ").concat(dt("metergroup.label.list.vertical.gap"), ";\n}\n\n.p-metergroup-vertical .p-metergroup-meters {\n flex-direction: column;\n width: ").concat(dt("metergroup.meters.size"), ";\n height: 100%;\n}\n\n.p-metergroup-vertical .p-metergroup-label-list {\n align-items: flex-start;\n}\n\n.p-metergroup-vertical .p-metergroup-meter:first-of-type {\n border-start-start-radius: ").concat(dt("metergroup.border.radius"), ";\n border-start-end-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n\n.p-metergroup-vertical .p-metergroup-meter:last-of-type {\n border-end-start-radius: ").concat(dt("metergroup.border.radius"), ";\n border-end-end-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n"); +}, "theme"); +var classes$i = { + root: /* @__PURE__ */ __name(function root19(_ref2) { + var props = _ref2.props; + return ["p-metergroup p-component", { + "p-metergroup-horizontal": props.orientation === "horizontal", + "p-metergroup-vertical": props.orientation === "vertical" + }]; + }, "root"), + meters: "p-metergroup-meters", + meter: "p-metergroup-meter", + labelList: /* @__PURE__ */ __name(function labelList(_ref3) { + var props = _ref3.props; + return ["p-metergroup-label-list", { + "p-metergroup-label-list-vertical": props.labelOrientation === "vertical", + "p-metergroup-label-list-horizontal": props.labelOrientation === "horizontal" + }]; + }, "labelList"), + label: "p-metergroup-label", + labelIcon: "p-metergroup-label-icon", + labelMarker: "p-metergroup-label-marker", + labelText: "p-metergroup-label-text" +}; +var MeterGroupStyle = BaseStyle.extend({ + name: "metergroup", + theme: theme$h, + classes: classes$i +}); +var script$2$3 = { + name: "MeterGroup", + "extends": script$1d, + props: { + value: { + type: Array, + "default": null + }, + min: { + type: Number, + "default": 0 + }, + max: { + type: Number, + "default": 100 + }, + orientation: { + type: String, + "default": "horizontal" + }, + labelPosition: { + type: String, + "default": "end" + }, + labelOrientation: { + type: String, + "default": "horizontal" + } + }, + style: MeterGroupStyle, + provide: /* @__PURE__ */ __name(function provide33() { + return { + $pcMeterGroup: this, + $parentInstance: this + }; + }, "provide") +}; +var script$1$i = { + name: "MeterGroupLabel", + hostName: "MeterGroup", + "extends": script$1d, + inheritAttrs: false, + props: { + value: { + type: Array, + "default": null + }, + labelPosition: { + type: String, + "default": "end" + }, + labelOrientation: { + type: String, + "default": "horizontal" + } + } +}; +function render$1$3(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("ol", mergeProps({ + "class": _ctx.cx("labelList") + }, _ctx.ptm("labelList")), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.value, function(val, index) { + return openBlock(), createElementBlock("li", mergeProps({ + key: index + "_label", + "class": _ctx.cx("label"), + ref_for: true + }, _ctx.ptm("label")), [renderSlot(_ctx.$slots, "icon", { + value: val, + "class": normalizeClass(_ctx.cx("labelIcon")) + }, function() { + return [val.icon ? (openBlock(), createElementBlock("i", mergeProps({ + key: 0, + "class": [val.icon, _ctx.cx("labelIcon")], + style: { + color: val.color + }, + ref_for: true + }, _ctx.ptm("labelIcon")), null, 16)) : (openBlock(), createElementBlock("span", mergeProps({ + key: 1, + "class": _ctx.cx("labelMarker"), + style: { + backgroundColor: val.color + }, + ref_for: true + }, _ctx.ptm("labelMarker")), null, 16))]; + }), createBaseVNode("span", mergeProps({ + "class": _ctx.cx("labelText"), + ref_for: true + }, _ctx.ptm("labelText")), toDisplayString(val.label) + " (" + toDisplayString(_ctx.$parentInstance.percentValue(val.value)) + ")", 17)], 16); + }), 128))], 16); +} +__name(render$1$3, "render$1$3"); +script$1$i.render = render$1$3; +var script$w = { + name: "MeterGroup", + "extends": script$2$3, + inheritAttrs: false, + methods: { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions5(key, value2, index) { + return this.ptm(key, { + context: { + value: value2, + index + } + }); + }, "getPTOptions"), + percent: /* @__PURE__ */ __name(function percent() { + var meter = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0; + var percentOfItem = (meter - this.min) / (this.max - this.min) * 100; + return Math.round(Math.max(0, Math.min(100, percentOfItem))); + }, "percent"), + percentValue: /* @__PURE__ */ __name(function percentValue(meter) { + return this.percent(meter) + "%"; + }, "percentValue"), + meterCalculatedStyles: /* @__PURE__ */ __name(function meterCalculatedStyles(val) { + return { + backgroundColor: val.color, + width: this.orientation === "horizontal" && this.percentValue(val.value), + height: this.orientation === "vertical" && this.percentValue(val.value) + }; + }, "meterCalculatedStyles") + }, + computed: { + totalPercent: /* @__PURE__ */ __name(function totalPercent() { + return this.percent(this.value.reduce(function(total, val) { + return total + val.value; + }, 0)); + }, "totalPercent"), + percentages: /* @__PURE__ */ __name(function percentages() { + var sum = 0; + var sumsArray = []; + this.value.forEach(function(item8) { + sum += item8.value; + sumsArray.push(sum); + }); + return sumsArray; + }, "percentages") + }, + components: { + MeterGroupLabel: script$1$i + } +}; +var _hoisted_1$g = ["aria-valuemin", "aria-valuemax", "aria-valuenow"]; +function render$s(_ctx, _cache, $props, $setup, $data, $options) { + var _component_MeterGroupLabel = resolveComponent("MeterGroupLabel"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root"), + role: "meter", + "aria-valuemin": _ctx.min, + "aria-valuemax": _ctx.max, + "aria-valuenow": $options.totalPercent + }, _ctx.ptmi("root")), [_ctx.labelPosition === "start" ? renderSlot(_ctx.$slots, "label", { + key: 0, + value: _ctx.value, + totalPercent: $options.totalPercent, + percentages: $options.percentages + }, function() { + return [createVNode(_component_MeterGroupLabel, { + value: _ctx.value, + labelPosition: _ctx.labelPosition, + labelOrientation: _ctx.labelOrientation, + unstyled: _ctx.unstyled, + pt: _ctx.pt + }, null, 8, ["value", "labelPosition", "labelOrientation", "unstyled", "pt"])]; + }) : createCommentVNode("", true), renderSlot(_ctx.$slots, "start", { + value: _ctx.value, + totalPercent: $options.totalPercent, + percentages: $options.percentages + }), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("meters") + }, _ctx.ptm("meters")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.value, function(val, index) { + return renderSlot(_ctx.$slots, "meter", { + key: index, + value: val, + index, + "class": normalizeClass(_ctx.cx("meter")), + orientation: _ctx.orientation, + size: $options.percentValue(val.value), + totalPercent: $options.totalPercent + }, function() { + return [$options.percent(val.value) ? (openBlock(), createElementBlock("span", mergeProps({ + key: 0, + "class": _ctx.cx("meter"), + style: $options.meterCalculatedStyles(val), + ref_for: true + }, $options.getPTOptions("meter", val, index)), null, 16)) : createCommentVNode("", true)]; + }); + }), 128))], 16), renderSlot(_ctx.$slots, "end", { + value: _ctx.value, + totalPercent: $options.totalPercent, + percentages: $options.percentages + }), _ctx.labelPosition === "end" ? renderSlot(_ctx.$slots, "label", { + key: 1, + value: _ctx.value, + totalPercent: $options.totalPercent, + percentages: $options.percentages + }, function() { + return [createVNode(_component_MeterGroupLabel, { + value: _ctx.value, + labelPosition: _ctx.labelPosition, + labelOrientation: _ctx.labelOrientation, + unstyled: _ctx.unstyled, + pt: _ctx.pt + }, null, 8, ["value", "labelPosition", "labelOrientation", "unstyled", "pt"])]; + }) : createCommentVNode("", true)], 16, _hoisted_1$g); +} +__name(render$s, "render$s"); +script$w.render = render$s; +var theme$g = /* @__PURE__ */ __name(function theme24(_ref) { + var dt = _ref.dt; + return "\n.p-multiselect {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n background: ".concat(dt("multiselect.background"), ";\n border: 1px solid ").concat(dt("multiselect.border.color"), ";\n transition: background ").concat(dt("multiselect.transition.duration"), ", color ").concat(dt("multiselect.transition.duration"), ", border-color ").concat(dt("multiselect.transition.duration"), ", outline-color ").concat(dt("multiselect.transition.duration"), ", box-shadow ").concat(dt("multiselect.transition.duration"), ";\n border-radius: ").concat(dt("multiselect.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("multiselect.shadow"), ";\n}\n\n.p-multiselect:not(.p-disabled):hover {\n border-color: ").concat(dt("multiselect.hover.border.color"), ";\n}\n\n.p-multiselect:not(.p-disabled).p-focus {\n border-color: ").concat(dt("multiselect.focus.border.color"), ";\n box-shadow: ").concat(dt("multiselect.focus.ring.shadow"), ";\n outline: ").concat(dt("multiselect.focus.ring.width"), " ").concat(dt("multiselect.focus.ring.style"), " ").concat(dt("multiselect.focus.ring.color"), ";\n outline-offset: ").concat(dt("multiselect.focus.ring.offset"), ";\n}\n\n.p-multiselect.p-variant-filled {\n background: ").concat(dt("multiselect.filled.background"), ";\n}\n\n.p-multiselect.p-variant-filled:not(.p-disabled):hover {\n background: ").concat(dt("multiselect.filled.hover.background"), ";\n}\n\n.p-multiselect.p-variant-filled.p-focus {\n background: ").concat(dt("multiselect.filled.focus.background"), ";\n}\n\n.p-multiselect.p-invalid {\n border-color: ").concat(dt("multiselect.invalid.border.color"), ";\n}\n\n.p-multiselect.p-disabled {\n opacity: 1;\n background: ").concat(dt("multiselect.disabled.background"), ";\n}\n\n.p-multiselect-dropdown {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n background: transparent;\n color: ").concat(dt("multiselect.dropdown.color"), ";\n width: ").concat(dt("multiselect.dropdown.width"), ";\n border-start-end-radius: ").concat(dt("multiselect.border.radius"), ";\n border-end-end-radius: ").concat(dt("multiselect.border.radius"), ";\n}\n\n.p-multiselect-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n color: ").concat(dt("multiselect.clear.icon.color"), ";\n inset-inline-end: ").concat(dt("multiselect.dropdown.width"), ";\n}\n\n.p-multiselect-label-container {\n overflow: hidden;\n flex: 1 1 auto;\n cursor: pointer;\n}\n\n.p-multiselect-label {\n display: flex;\n align-items: center;\n gap: calc(").concat(dt("multiselect.padding.y"), " / 2);\n white-space: nowrap;\n cursor: pointer;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: ").concat(dt("multiselect.padding.y"), " ").concat(dt("multiselect.padding.x"), ";\n color: ").concat(dt("multiselect.color"), ";\n}\n\n.p-multiselect-label.p-placeholder {\n color: ").concat(dt("multiselect.placeholder.color"), ";\n}\n\n.p-multiselect.p-invalid .p-multiselect-label.p-placeholder {\n color: ").concat(dt("multiselect.invalid.placeholder.color"), ";\n}\n\n.p-multiselect.p-disabled .p-multiselect-label {\n color: ").concat(dt("multiselect.disabled.color"), ";\n}\n\n.p-multiselect-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\n\n.p-multiselect .p-multiselect-overlay {\n min-width: 100%;\n}\n\n.p-multiselect-overlay {\n position: absolute;\n top: 0;\n left: 0;\n background: ").concat(dt("multiselect.overlay.background"), ";\n color: ").concat(dt("multiselect.overlay.color"), ";\n border: 1px solid ").concat(dt("multiselect.overlay.border.color"), ";\n border-radius: ").concat(dt("multiselect.overlay.border.radius"), ";\n box-shadow: ").concat(dt("multiselect.overlay.shadow"), ";\n}\n\n.p-multiselect-header {\n display: flex;\n align-items: center;\n padding: ").concat(dt("multiselect.list.header.padding"), ";\n}\n\n.p-multiselect-header .p-checkbox {\n margin-inline-end: ").concat(dt("multiselect.option.gap"), ";\n}\n\n.p-multiselect-filter-container {\n flex: 1 1 auto;\n}\n\n.p-multiselect-filter {\n width: 100%;\n}\n\n.p-multiselect-list-container {\n overflow: auto;\n}\n\n.p-multiselect-list {\n margin: 0;\n padding: 0;\n list-style-type: none;\n padding: ").concat(dt("multiselect.list.padding"), ";\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("multiselect.list.gap"), ";\n}\n\n.p-multiselect-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 gap: ").concat(dt("multiselect.option.gap"), ";\n padding: ").concat(dt("multiselect.option.padding"), ";\n border: 0 none;\n color: ").concat(dt("multiselect.option.color"), ";\n background: transparent;\n transition: background ").concat(dt("multiselect.transition.duration"), ", color ").concat(dt("multiselect.transition.duration"), ", border-color ").concat(dt("multiselect.transition.duration"), ", box-shadow ").concat(dt("multiselect.transition.duration"), ", outline-color ").concat(dt("multiselect.transition.duration"), ";\n border-radius: ").concat(dt("multiselect.option.border.radius"), ";\n}\n\n.p-multiselect-option:not(.p-multiselect-option-selected):not(.p-disabled).p-focus {\n background: ").concat(dt("multiselect.option.focus.background"), ";\n color: ").concat(dt("multiselect.option.focus.color"), ";\n}\n\n.p-multiselect-option.p-multiselect-option-selected {\n background: ").concat(dt("multiselect.option.selected.background"), ";\n color: ").concat(dt("multiselect.option.selected.color"), ";\n}\n\n.p-multiselect-option.p-multiselect-option-selected.p-focus {\n background: ").concat(dt("multiselect.option.selected.focus.background"), ";\n color: ").concat(dt("multiselect.option.selected.focus.color"), ";\n}\n\n.p-multiselect-option-group {\n cursor: auto;\n margin: 0;\n padding: ").concat(dt("multiselect.option.group.padding"), ";\n background: ").concat(dt("multiselect.option.group.background"), ";\n color: ").concat(dt("multiselect.option.group.color"), ";\n font-weight: ").concat(dt("multiselect.option.group.font.weight"), ";\n}\n\n.p-multiselect-empty-message {\n padding: ").concat(dt("multiselect.empty.message.padding"), ";\n}\n\n.p-multiselect-label .p-chip {\n padding-block-start: calc(").concat(dt("multiselect.padding.y"), " / 2);\n padding-block-end: calc(").concat(dt("multiselect.padding.y"), " / 2);\n border-radius: ").concat(dt("multiselect.chip.border.radius"), ";\n}\n\n.p-multiselect-label:has(.p-chip) {\n padding: calc(").concat(dt("multiselect.padding.y"), " / 2) calc(").concat(dt("multiselect.padding.x"), " / 2);\n}\n\n.p-multiselect-fluid {\n display: flex;\n width: 100%;\n}\n\n.p-multiselect-sm .p-multiselect-label {\n font-size: ").concat(dt("multiselect.sm.font.size"), ";\n padding-block: ").concat(dt("multiselect.sm.padding.y"), ";\n padding-inline: ").concat(dt("multiselect.sm.padding.x"), ";\n}\n\n.p-multiselect-sm .p-multiselect-dropdown .p-icon {\n font-size: ").concat(dt("multiselect.sm.font.size"), ";\n width: ").concat(dt("multiselect.sm.font.size"), ";\n height: ").concat(dt("multiselect.sm.font.size"), ";\n}\n\n.p-multiselect-lg .p-multiselect-label {\n font-size: ").concat(dt("multiselect.lg.font.size"), ";\n padding-block: ").concat(dt("multiselect.lg.padding.y"), ";\n padding-inline: ").concat(dt("multiselect.lg.padding.x"), ";\n}\n\n.p-multiselect-lg .p-multiselect-dropdown .p-icon {\n font-size: ").concat(dt("multiselect.lg.font.size"), ";\n width: ").concat(dt("multiselect.lg.font.size"), ";\n height: ").concat(dt("multiselect.lg.font.size"), ";\n}\n"); +}, "theme"); +var inlineStyles$5 = { + root: /* @__PURE__ */ __name(function root20(_ref2) { + var props = _ref2.props; + return { + position: props.appendTo === "self" ? "relative" : void 0 + }; + }, "root") +}; +var classes$h = { + root: /* @__PURE__ */ __name(function root21(_ref3) { + var instance = _ref3.instance, props = _ref3.props; + return ["p-multiselect p-component p-inputwrapper", { + "p-multiselect-display-chip": props.display === "chip", + "p-disabled": props.disabled, + "p-invalid": instance.$invalid, + "p-variant-filled": instance.$variant === "filled", + "p-focus": instance.focused, + "p-inputwrapper-filled": instance.$filled, + "p-inputwrapper-focus": instance.focused || instance.overlayVisible, + "p-multiselect-open": instance.overlayVisible, + "p-multiselect-fluid": instance.$fluid, + "p-multiselect-sm p-inputfield-sm": props.size === "small", + "p-multiselect-lg p-inputfield-lg": props.size === "large" + }]; + }, "root"), + labelContainer: "p-multiselect-label-container", + label: /* @__PURE__ */ __name(function label6(_ref4) { + var instance = _ref4.instance, props = _ref4.props; + return ["p-multiselect-label", { + "p-placeholder": instance.label === props.placeholder, + "p-multiselect-label-empty": !props.placeholder && (!props.modelValue || props.modelValue.length === 0) + }]; + }, "label"), + clearIcon: "p-multiselect-clear-icon", + chipItem: "p-multiselect-chip-item", + pcChip: "p-multiselect-chip", + chipIcon: "p-multiselect-chip-icon", + dropdown: "p-multiselect-dropdown", + loadingIcon: "p-multiselect-loading-icon", + dropdownIcon: "p-multiselect-dropdown-icon", + overlay: "p-multiselect-overlay p-component", + header: "p-multiselect-header", + pcFilterContainer: "p-multiselect-filter-container", + pcFilter: "p-multiselect-filter", + listContainer: "p-multiselect-list-container", + list: "p-multiselect-list", + optionGroup: "p-multiselect-option-group", + option: /* @__PURE__ */ __name(function option2(_ref5) { + var instance = _ref5.instance, _option = _ref5.option, index = _ref5.index, getItemOptions = _ref5.getItemOptions, props = _ref5.props; + return ["p-multiselect-option", { + "p-multiselect-option-selected": instance.isSelected(_option) && props.highlightOnSelect, + "p-focus": instance.focusedOptionIndex === instance.getOptionIndex(index, getItemOptions), + "p-disabled": instance.isOptionDisabled(_option) + }]; + }, "option"), + emptyMessage: "p-multiselect-empty-message" +}; +var MultiSelectStyle = BaseStyle.extend({ + name: "multiselect", + theme: theme$g, + classes: classes$h, + inlineStyles: inlineStyles$5 +}); +var script$1$h = { + name: "BaseMultiSelect", + "extends": script$1n, + props: { + options: Array, + optionLabel: null, + optionValue: null, + optionDisabled: null, + optionGroupLabel: null, + optionGroupChildren: null, + scrollHeight: { + type: String, + "default": "14rem" + }, + placeholder: String, + inputId: { + type: String, + "default": null + }, + panelClass: { + type: String, + "default": null + }, + panelStyle: { + type: null, + "default": null + }, + overlayClass: { + type: String, + "default": null + }, + overlayStyle: { + type: null, + "default": null + }, + dataKey: null, + showClear: { + type: Boolean, + "default": false + }, + clearIcon: { + type: String, + "default": void 0 + }, + resetFilterOnClear: { + type: Boolean, + "default": false + }, + filter: Boolean, + filterPlaceholder: String, + filterLocale: String, + filterMatchMode: { + type: String, + "default": "contains" + }, + filterFields: { + type: Array, + "default": null + }, + appendTo: { + type: [String, Object], + "default": "body" + }, + display: { + type: String, + "default": "comma" + }, + selectedItemsLabel: { + type: String, + "default": null + }, + maxSelectedLabels: { + type: Number, + "default": null + }, + selectionLimit: { + type: Number, + "default": null + }, + showToggleAll: { + type: Boolean, + "default": true + }, + loading: { + type: Boolean, + "default": false + }, + checkboxIcon: { + type: String, + "default": void 0 + }, + dropdownIcon: { + type: String, + "default": void 0 + }, + filterIcon: { + type: String, + "default": void 0 + }, + loadingIcon: { + type: String, + "default": void 0 + }, + removeTokenIcon: { + type: String, + "default": void 0 + }, + chipIcon: { + type: String, + "default": void 0 + }, + selectAll: { + type: Boolean, + "default": null + }, + resetFilterOnHide: { + type: Boolean, + "default": false + }, + virtualScrollerOptions: { + type: Object, + "default": null + }, + autoOptionFocus: { + type: Boolean, + "default": false + }, + autoFilterFocus: { + type: Boolean, + "default": false + }, + focusOnHover: { + type: Boolean, + "default": true + }, + highlightOnSelect: { + type: Boolean, + "default": false + }, + filterMessage: { + type: String, + "default": null + }, + selectionMessage: { + type: String, + "default": null + }, + emptySelectionMessage: { + type: String, + "default": null + }, + emptyFilterMessage: { + type: String, + "default": null + }, + emptyMessage: { + type: String, + "default": null + }, + tabindex: { + type: Number, + "default": 0 + }, + ariaLabel: { + type: String, + "default": null + }, + ariaLabelledby: { + type: String, + "default": null + } + }, + style: MultiSelectStyle, + provide: /* @__PURE__ */ __name(function provide34() { + return { + $pcMultiSelect: this, + $parentInstance: this + }; + }, "provide") +}; +function _typeof$1$2(o) { + "@babel/helpers - typeof"; + return _typeof$1$2 = "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$1$2(o); +} +__name(_typeof$1$2, "_typeof$1$2"); +function ownKeys$d(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$d, "ownKeys$d"); +function _objectSpread$d(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$d(Object(t2), true).forEach(function(r2) { + _defineProperty$1$2(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$d(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$d, "_objectSpread$d"); +function _defineProperty$1$2(e, r, t2) { + return (r = _toPropertyKey$1$2(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$1$2, "_defineProperty$1$2"); +function _toPropertyKey$1$2(t2) { + var i = _toPrimitive$1$2(t2, "string"); + return "symbol" == _typeof$1$2(i) ? i : i + ""; +} +__name(_toPropertyKey$1$2, "_toPropertyKey$1$2"); +function _toPrimitive$1$2(t2, r) { + if ("object" != _typeof$1$2(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$1$2(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$1$2, "_toPrimitive$1$2"); +function _toConsumableArray$6(r) { + return _arrayWithoutHoles$6(r) || _iterableToArray$6(r) || _unsupportedIterableToArray$7(r) || _nonIterableSpread$6(); +} +__name(_toConsumableArray$6, "_toConsumableArray$6"); +function _nonIterableSpread$6() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableSpread$6, "_nonIterableSpread$6"); +function _unsupportedIterableToArray$7(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$7(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$7(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$7, "_unsupportedIterableToArray$7"); +function _iterableToArray$6(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray$6, "_iterableToArray$6"); +function _arrayWithoutHoles$6(r) { + if (Array.isArray(r)) return _arrayLikeToArray$7(r); +} +__name(_arrayWithoutHoles$6, "_arrayWithoutHoles$6"); +function _arrayLikeToArray$7(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; +} +__name(_arrayLikeToArray$7, "_arrayLikeToArray$7"); +var script$v = { + name: "MultiSelect", + "extends": script$1$h, + inheritAttrs: false, + emits: ["change", "focus", "blur", "before-show", "before-hide", "show", "hide", "filter", "selectall-change"], + inject: { + $pcFluid: { + "default": null + } + }, + outsideClickListener: null, + scrollHandler: null, + resizeListener: null, + overlay: null, + list: null, + virtualScroller: null, + startRangeIndex: -1, + searchTimeout: null, + searchValue: "", + selectOnFocus: false, + data: /* @__PURE__ */ __name(function data22() { + return { + id: this.$attrs.id, + clicked: false, + focused: false, + focusedOptionIndex: -1, + filterValue: null, + overlayVisible: false + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId7(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId"), + options: /* @__PURE__ */ __name(function options2() { + this.autoUpdateModel(); + }, "options") + }, + mounted: /* @__PURE__ */ __name(function mounted23() { + this.id = this.id || UniqueComponentId(); + this.autoUpdateModel(); + }, "mounted"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount10() { + this.unbindOutsideClickListener(); + this.unbindResizeListener(); + if (this.scrollHandler) { + this.scrollHandler.destroy(); + this.scrollHandler = null; + } + if (this.overlay) { + ZIndex.clear(this.overlay); + this.overlay = null; + } + }, "beforeUnmount"), + methods: { + getOptionIndex: /* @__PURE__ */ __name(function getOptionIndex(index, fn) { + return this.virtualScrollerDisabled ? index : fn && fn(index)["index"]; + }, "getOptionIndex"), + getOptionLabel: /* @__PURE__ */ __name(function getOptionLabel3(option4) { + return this.optionLabel ? resolveFieldData(option4, this.optionLabel) : option4; + }, "getOptionLabel"), + getOptionValue: /* @__PURE__ */ __name(function getOptionValue3(option4) { + return this.optionValue ? resolveFieldData(option4, this.optionValue) : option4; + }, "getOptionValue"), + getOptionRenderKey: /* @__PURE__ */ __name(function getOptionRenderKey(option4, index) { + return this.dataKey ? resolveFieldData(option4, this.dataKey) : this.getOptionLabel(option4) + "_".concat(index); + }, "getOptionRenderKey"), + getHeaderCheckboxPTOptions: /* @__PURE__ */ __name(function getHeaderCheckboxPTOptions(key) { + return this.ptm(key, { + context: { + selected: this.allSelected + } + }); + }, "getHeaderCheckboxPTOptions"), + getCheckboxPTOptions: /* @__PURE__ */ __name(function getCheckboxPTOptions(option4, itemOptions, index, key) { + return this.ptm(key, { + context: { + selected: this.isSelected(option4), + focused: this.focusedOptionIndex === this.getOptionIndex(index, itemOptions), + disabled: this.isOptionDisabled(option4) + } + }); + }, "getCheckboxPTOptions"), + isOptionDisabled: /* @__PURE__ */ __name(function isOptionDisabled3(option4) { + if (this.maxSelectionLimitReached && !this.isSelected(option4)) { + return true; + } + return this.optionDisabled ? resolveFieldData(option4, this.optionDisabled) : false; + }, "isOptionDisabled"), + isOptionGroup: /* @__PURE__ */ __name(function isOptionGroup3(option4) { + return this.optionGroupLabel && option4.optionGroup && option4.group; + }, "isOptionGroup"), + getOptionGroupLabel: /* @__PURE__ */ __name(function getOptionGroupLabel3(optionGroup) { + return resolveFieldData(optionGroup, this.optionGroupLabel); + }, "getOptionGroupLabel"), + getOptionGroupChildren: /* @__PURE__ */ __name(function getOptionGroupChildren3(optionGroup) { + return resolveFieldData(optionGroup, this.optionGroupChildren); + }, "getOptionGroupChildren"), + getAriaPosInset: /* @__PURE__ */ __name(function getAriaPosInset2(index) { + var _this = this; + return (this.optionGroupLabel ? index - this.visibleOptions.slice(0, index).filter(function(option4) { + return _this.isOptionGroup(option4); + }).length : index) + 1; + }, "getAriaPosInset"), + show: /* @__PURE__ */ __name(function show4(isFocus) { + this.$emit("before-show"); + this.overlayVisible = true; + this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : this.findSelectedOptionIndex(); + isFocus && focus(this.$refs.focusInput); + }, "show"), + hide: /* @__PURE__ */ __name(function hide5(isFocus) { + var _this2 = this; + var _hide = /* @__PURE__ */ __name(function _hide2() { + _this2.$emit("before-hide"); + _this2.overlayVisible = false; + _this2.clicked = false; + _this2.focusedOptionIndex = -1; + _this2.searchValue = ""; + _this2.resetFilterOnHide && (_this2.filterValue = null); + isFocus && focus(_this2.$refs.focusInput); + }, "_hide"); + setTimeout(function() { + _hide(); + }, 0); + }, "hide"), + onFocus: /* @__PURE__ */ __name(function onFocus9(event2) { + if (this.disabled) { + return; + } + this.focused = true; + if (this.overlayVisible) { + this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : this.findSelectedOptionIndex(); + this.scrollInView(this.focusedOptionIndex); + } + this.$emit("focus", event2); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur9(event2) { + var _this$formField$onBlu, _this$formField; + this.clicked = false; + this.focused = false; + this.focusedOptionIndex = -1; + this.searchValue = ""; + this.$emit("blur", event2); + (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField); + }, "onBlur"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown9(event2) { + var _this3 = this; + if (this.disabled) { + event2.preventDefault(); + return; + } + var metaKey = event2.metaKey || event2.ctrlKey; + switch (event2.code) { + case "ArrowDown": + this.onArrowDownKey(event2); + break; + case "ArrowUp": + this.onArrowUpKey(event2); + break; + case "Home": + this.onHomeKey(event2); + break; + case "End": + this.onEndKey(event2); + break; + case "PageDown": + this.onPageDownKey(event2); + break; + case "PageUp": + this.onPageUpKey(event2); + break; + case "Enter": + case "NumpadEnter": + case "Space": + this.onEnterKey(event2); + break; + case "Escape": + this.onEscapeKey(event2); + break; + case "Tab": + this.onTabKey(event2); + break; + case "ShiftLeft": + case "ShiftRight": + this.onShiftKey(event2); + break; + default: + if (event2.code === "KeyA" && metaKey) { + var value2 = this.visibleOptions.filter(function(option4) { + return _this3.isValidOption(option4); + }).map(function(option4) { + return _this3.getOptionValue(option4); + }); + this.updateModel(event2, value2); + event2.preventDefault(); + break; + } + if (!metaKey && isPrintableCharacter(event2.key)) { + !this.overlayVisible && this.show(); + this.searchOptions(event2); + event2.preventDefault(); + } + break; + } + this.clicked = false; + }, "onKeyDown"), + onContainerClick: /* @__PURE__ */ __name(function onContainerClick2(event2) { + if (this.disabled || this.loading) { + return; + } + if (event2.target.tagName === "INPUT" || event2.target.getAttribute("data-pc-section") === "clearicon" || event2.target.closest('[data-pc-section="clearicon"]')) { + return; + } else if (!this.overlay || !this.overlay.contains(event2.target)) { + this.overlayVisible ? this.hide(true) : this.show(true); + } + this.clicked = true; + }, "onContainerClick"), + onClearClick: /* @__PURE__ */ __name(function onClearClick2(event2) { + this.updateModel(event2, null); + this.resetFilterOnClear && (this.filterValue = null); + }, "onClearClick"), + onFirstHiddenFocus: /* @__PURE__ */ __name(function onFirstHiddenFocus(event2) { + var focusableEl = event2.relatedTarget === this.$refs.focusInput ? getFirstFocusableElement(this.overlay, ':not([data-p-hidden-focusable="true"])') : this.$refs.focusInput; + focus(focusableEl); + }, "onFirstHiddenFocus"), + onLastHiddenFocus: /* @__PURE__ */ __name(function onLastHiddenFocus(event2) { + var focusableEl = event2.relatedTarget === this.$refs.focusInput ? getLastFocusableElement(this.overlay, ':not([data-p-hidden-focusable="true"])') : this.$refs.focusInput; + focus(focusableEl); + }, "onLastHiddenFocus"), + onOptionSelect: /* @__PURE__ */ __name(function onOptionSelect2(event2, option4) { + var _this4 = this; + var index = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1; + var isFocus = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false; + if (this.disabled || this.isOptionDisabled(option4)) { + return; + } + var selected3 = this.isSelected(option4); + var value2 = null; + if (selected3) value2 = this.d_value.filter(function(val) { + return !equals(val, _this4.getOptionValue(option4), _this4.equalityKey); + }); + else value2 = [].concat(_toConsumableArray$6(this.d_value || []), [this.getOptionValue(option4)]); + this.updateModel(event2, value2); + index !== -1 && (this.focusedOptionIndex = index); + isFocus && focus(this.$refs.focusInput); + }, "onOptionSelect"), + onOptionMouseMove: /* @__PURE__ */ __name(function onOptionMouseMove3(event2, index) { + if (this.focusOnHover) { + this.changeFocusedOptionIndex(event2, index); + } + }, "onOptionMouseMove"), + onOptionSelectRange: /* @__PURE__ */ __name(function onOptionSelectRange(event2) { + var _this5 = this; + var start = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -1; + var end = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1; + start === -1 && (start = this.findNearestSelectedOptionIndex(end, true)); + end === -1 && (end = this.findNearestSelectedOptionIndex(start)); + if (start !== -1 && end !== -1) { + var rangeStart = Math.min(start, end); + var rangeEnd = Math.max(start, end); + var value2 = this.visibleOptions.slice(rangeStart, rangeEnd + 1).filter(function(option4) { + return _this5.isValidOption(option4); + }).map(function(option4) { + return _this5.getOptionValue(option4); + }); + this.updateModel(event2, value2); + } + }, "onOptionSelectRange"), + onFilterChange: /* @__PURE__ */ __name(function onFilterChange(event2) { + var value2 = event2.target.value; + this.filterValue = value2; + this.focusedOptionIndex = -1; + this.$emit("filter", { + originalEvent: event2, + value: value2 + }); + !this.virtualScrollerDisabled && this.virtualScroller.scrollToIndex(0); + }, "onFilterChange"), + onFilterKeyDown: /* @__PURE__ */ __name(function onFilterKeyDown(event2) { + switch (event2.code) { + case "ArrowDown": + this.onArrowDownKey(event2); + break; + case "ArrowUp": + this.onArrowUpKey(event2, true); + break; + case "ArrowLeft": + case "ArrowRight": + this.onArrowLeftKey(event2, true); + break; + case "Home": + this.onHomeKey(event2, true); + break; + case "End": + this.onEndKey(event2, true); + break; + case "Enter": + case "NumpadEnter": + this.onEnterKey(event2); + break; + case "Escape": + this.onEscapeKey(event2); + break; + case "Tab": + this.onTabKey(event2, true); + break; + } + }, "onFilterKeyDown"), + onFilterBlur: /* @__PURE__ */ __name(function onFilterBlur() { + this.focusedOptionIndex = -1; + }, "onFilterBlur"), + onFilterUpdated: /* @__PURE__ */ __name(function onFilterUpdated() { + if (this.overlayVisible) { + this.alignOverlay(); + } + }, "onFilterUpdated"), + onOverlayClick: /* @__PURE__ */ __name(function onOverlayClick4(event2) { + OverlayEventBus.emit("overlay-click", { + originalEvent: event2, + target: this.$el + }); + }, "onOverlayClick"), + onOverlayKeyDown: /* @__PURE__ */ __name(function onOverlayKeyDown3(event2) { + switch (event2.code) { + case "Escape": + this.onEscapeKey(event2); + break; + } + }, "onOverlayKeyDown"), + onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey6(event2) { + if (!this.overlayVisible) { + this.show(); + } else { + var optionIndex = this.focusedOptionIndex !== -1 ? this.findNextOptionIndex(this.focusedOptionIndex) : this.clicked ? this.findFirstOptionIndex() : this.findFirstFocusedOptionIndex(); + if (event2.shiftKey) { + this.onOptionSelectRange(event2, this.startRangeIndex, optionIndex); + } + this.changeFocusedOptionIndex(event2, optionIndex); + } + event2.preventDefault(); + }, "onArrowDownKey"), + onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey6(event2) { + var pressedInInputText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + if (event2.altKey && !pressedInInputText) { + if (this.focusedOptionIndex !== -1) { + this.onOptionSelect(event2, this.visibleOptions[this.focusedOptionIndex]); + } + this.overlayVisible && this.hide(); + event2.preventDefault(); + } else { + var optionIndex = this.focusedOptionIndex !== -1 ? this.findPrevOptionIndex(this.focusedOptionIndex) : this.clicked ? this.findLastOptionIndex() : this.findLastFocusedOptionIndex(); + if (event2.shiftKey) { + this.onOptionSelectRange(event2, optionIndex, this.startRangeIndex); + } + this.changeFocusedOptionIndex(event2, optionIndex); + !this.overlayVisible && this.show(); + event2.preventDefault(); + } + }, "onArrowUpKey"), + onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey3(event2) { + var pressedInInputText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + pressedInInputText && (this.focusedOptionIndex = -1); + }, "onArrowLeftKey"), + onHomeKey: /* @__PURE__ */ __name(function onHomeKey6(event2) { + var pressedInInputText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + if (pressedInInputText) { + var target = event2.currentTarget; + if (event2.shiftKey) { + target.setSelectionRange(0, event2.target.selectionStart); + } else { + target.setSelectionRange(0, 0); + this.focusedOptionIndex = -1; + } + } else { + var metaKey = event2.metaKey || event2.ctrlKey; + var optionIndex = this.findFirstOptionIndex(); + if (event2.shiftKey && metaKey) { + this.onOptionSelectRange(event2, optionIndex, this.startRangeIndex); + } + this.changeFocusedOptionIndex(event2, optionIndex); + !this.overlayVisible && this.show(); + } + event2.preventDefault(); + }, "onHomeKey"), + onEndKey: /* @__PURE__ */ __name(function onEndKey6(event2) { + var pressedInInputText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + if (pressedInInputText) { + var target = event2.currentTarget; + if (event2.shiftKey) { + target.setSelectionRange(event2.target.selectionStart, target.value.length); + } else { + var len = target.value.length; + target.setSelectionRange(len, len); + this.focusedOptionIndex = -1; + } + } else { + var metaKey = event2.metaKey || event2.ctrlKey; + var optionIndex = this.findLastOptionIndex(); + if (event2.shiftKey && metaKey) { + this.onOptionSelectRange(event2, this.startRangeIndex, optionIndex); + } + this.changeFocusedOptionIndex(event2, optionIndex); + !this.overlayVisible && this.show(); + } + event2.preventDefault(); + }, "onEndKey"), + onPageUpKey: /* @__PURE__ */ __name(function onPageUpKey(event2) { + this.scrollInView(0); + event2.preventDefault(); + }, "onPageUpKey"), + onPageDownKey: /* @__PURE__ */ __name(function onPageDownKey(event2) { + this.scrollInView(this.visibleOptions.length - 1); + event2.preventDefault(); + }, "onPageDownKey"), + onEnterKey: /* @__PURE__ */ __name(function onEnterKey5(event2) { + if (!this.overlayVisible) { + this.focusedOptionIndex = -1; + this.onArrowDownKey(event2); + } else { + if (this.focusedOptionIndex !== -1) { + if (event2.shiftKey) this.onOptionSelectRange(event2, this.focusedOptionIndex); + else this.onOptionSelect(event2, this.visibleOptions[this.focusedOptionIndex]); + } + } + event2.preventDefault(); + }, "onEnterKey"), + onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey3(event2) { + this.overlayVisible && this.hide(true); + event2.preventDefault(); + }, "onEscapeKey"), + onTabKey: /* @__PURE__ */ __name(function onTabKey3(event2) { + var pressedInInputText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + if (!pressedInInputText) { + if (this.overlayVisible && this.hasFocusableElements()) { + focus(event2.shiftKey ? this.$refs.lastHiddenFocusableElementOnOverlay : this.$refs.firstHiddenFocusableElementOnOverlay); + event2.preventDefault(); + } else { + if (this.focusedOptionIndex !== -1) { + this.onOptionSelect(event2, this.visibleOptions[this.focusedOptionIndex]); + } + this.overlayVisible && this.hide(this.filter); + } + } + }, "onTabKey"), + onShiftKey: /* @__PURE__ */ __name(function onShiftKey() { + this.startRangeIndex = this.focusedOptionIndex; + }, "onShiftKey"), + onOverlayEnter: /* @__PURE__ */ __name(function onOverlayEnter3(el) { + ZIndex.set("overlay", el, this.$primevue.config.zIndex.overlay); + addStyle(el, { + position: "absolute", + top: "0", + left: "0" + }); + this.alignOverlay(); + this.scrollInView(); + this.autoFilterFocus && focus(this.$refs.filterInput.$el); + }, "onOverlayEnter"), + onOverlayAfterEnter: /* @__PURE__ */ __name(function onOverlayAfterEnter2() { + this.bindOutsideClickListener(); + this.bindScrollListener(); + this.bindResizeListener(); + this.$emit("show"); + }, "onOverlayAfterEnter"), + onOverlayLeave: /* @__PURE__ */ __name(function onOverlayLeave3() { + this.unbindOutsideClickListener(); + this.unbindScrollListener(); + this.unbindResizeListener(); + this.$emit("hide"); + this.overlay = null; + }, "onOverlayLeave"), + onOverlayAfterLeave: /* @__PURE__ */ __name(function onOverlayAfterLeave3(el) { + ZIndex.clear(el); + }, "onOverlayAfterLeave"), + alignOverlay: /* @__PURE__ */ __name(function alignOverlay4() { + if (this.appendTo === "self") { + relativePosition(this.overlay, this.$el); + } else { + this.overlay.style.minWidth = getOuterWidth(this.$el) + "px"; + absolutePosition(this.overlay, this.$el); + } + }, "alignOverlay"), + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener6() { + var _this6 = this; + if (!this.outsideClickListener) { + this.outsideClickListener = function(event2) { + if (_this6.overlayVisible && _this6.isOutsideClicked(event2)) { + _this6.hide(); + } + }; + document.addEventListener("click", this.outsideClickListener); + } + }, "bindOutsideClickListener"), + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener6() { + if (this.outsideClickListener) { + document.removeEventListener("click", this.outsideClickListener); + this.outsideClickListener = null; + } + }, "unbindOutsideClickListener"), + bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener5() { + var _this7 = this; + if (!this.scrollHandler) { + this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, function() { + if (_this7.overlayVisible) { + _this7.hide(); + } + }); + } + this.scrollHandler.bindScrollListener(); + }, "bindScrollListener"), + unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener5() { + if (this.scrollHandler) { + this.scrollHandler.unbindScrollListener(); + } + }, "unbindScrollListener"), + bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener5() { + var _this8 = this; + if (!this.resizeListener) { + this.resizeListener = function() { + if (_this8.overlayVisible && !isTouchDevice()) { + _this8.hide(); + } + }; + window.addEventListener("resize", this.resizeListener); + } + }, "bindResizeListener"), + unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener5() { + if (this.resizeListener) { + window.removeEventListener("resize", this.resizeListener); + this.resizeListener = null; + } + }, "unbindResizeListener"), + isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked3(event2) { + return !(this.$el.isSameNode(event2.target) || this.$el.contains(event2.target) || this.overlay && this.overlay.contains(event2.target)); + }, "isOutsideClicked"), + getLabelByValue: /* @__PURE__ */ __name(function getLabelByValue(value2) { + var _this9 = this; + var options4 = this.optionGroupLabel ? this.flatOptions(this.options) : this.options || []; + var matchedOption = options4.find(function(option4) { + return !_this9.isOptionGroup(option4) && equals(_this9.getOptionValue(option4), value2, _this9.equalityKey); + }); + return matchedOption ? this.getOptionLabel(matchedOption) : null; + }, "getLabelByValue"), + getSelectedItemsLabel: /* @__PURE__ */ __name(function getSelectedItemsLabel() { + var pattern = /{(.*?)}/; + var selectedItemsLabel = this.selectedItemsLabel || this.$primevue.config.locale.selectionMessage; + if (pattern.test(selectedItemsLabel)) { + return selectedItemsLabel.replace(selectedItemsLabel.match(pattern)[0], this.d_value.length + ""); + } + return selectedItemsLabel; + }, "getSelectedItemsLabel"), + onToggleAll: /* @__PURE__ */ __name(function onToggleAll(event2) { + var _this10 = this; + if (this.selectAll !== null) { + this.$emit("selectall-change", { + originalEvent: event2, + checked: !this.allSelected + }); + } else { + var value2 = this.allSelected ? [] : this.visibleOptions.filter(function(option4) { + return _this10.isValidOption(option4); + }).map(function(option4) { + return _this10.getOptionValue(option4); + }); + this.updateModel(event2, value2); + } + }, "onToggleAll"), + removeOption: /* @__PURE__ */ __name(function removeOption(event2, optionValue) { + var _this11 = this; + event2.stopPropagation(); + var value2 = this.d_value.filter(function(val) { + return !equals(val, optionValue, _this11.equalityKey); + }); + this.updateModel(event2, value2); + }, "removeOption"), + clearFilter: /* @__PURE__ */ __name(function clearFilter() { + this.filterValue = null; + }, "clearFilter"), + hasFocusableElements: /* @__PURE__ */ __name(function hasFocusableElements() { + return getFocusableElements(this.overlay, ':not([data-p-hidden-focusable="true"])').length > 0; + }, "hasFocusableElements"), + isOptionMatched: /* @__PURE__ */ __name(function isOptionMatched2(option4) { + var _this$getOptionLabel; + return this.isValidOption(option4) && typeof this.getOptionLabel(option4) === "string" && ((_this$getOptionLabel = this.getOptionLabel(option4)) === null || _this$getOptionLabel === void 0 ? void 0 : _this$getOptionLabel.toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))); + }, "isOptionMatched"), + isValidOption: /* @__PURE__ */ __name(function isValidOption2(option4) { + return isNotEmpty(option4) && !(this.isOptionDisabled(option4) || this.isOptionGroup(option4)); + }, "isValidOption"), + isValidSelectedOption: /* @__PURE__ */ __name(function isValidSelectedOption2(option4) { + return this.isValidOption(option4) && this.isSelected(option4); + }, "isValidSelectedOption"), + isEquals: /* @__PURE__ */ __name(function isEquals(value1, value2) { + return equals(value1, value2, this.equalityKey); + }, "isEquals"), + isSelected: /* @__PURE__ */ __name(function isSelected4(option4) { + var _this12 = this; + var optionValue = this.getOptionValue(option4); + return (this.d_value || []).some(function(value2) { + return _this12.isEquals(value2, optionValue); + }); + }, "isSelected"), + findFirstOptionIndex: /* @__PURE__ */ __name(function findFirstOptionIndex2() { + var _this13 = this; + return this.visibleOptions.findIndex(function(option4) { + return _this13.isValidOption(option4); + }); + }, "findFirstOptionIndex"), + findLastOptionIndex: /* @__PURE__ */ __name(function findLastOptionIndex2() { + var _this14 = this; + return findLastIndex(this.visibleOptions, function(option4) { + return _this14.isValidOption(option4); + }); + }, "findLastOptionIndex"), + findNextOptionIndex: /* @__PURE__ */ __name(function findNextOptionIndex4(index) { + var _this15 = this; + var matchedOptionIndex = index < this.visibleOptions.length - 1 ? this.visibleOptions.slice(index + 1).findIndex(function(option4) { + return _this15.isValidOption(option4); + }) : -1; + return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index; + }, "findNextOptionIndex"), + findPrevOptionIndex: /* @__PURE__ */ __name(function findPrevOptionIndex4(index) { + var _this16 = this; + var matchedOptionIndex = index > 0 ? findLastIndex(this.visibleOptions.slice(0, index), function(option4) { + return _this16.isValidOption(option4); + }) : -1; + return matchedOptionIndex > -1 ? matchedOptionIndex : index; + }, "findPrevOptionIndex"), + findSelectedOptionIndex: /* @__PURE__ */ __name(function findSelectedOptionIndex2() { + var _this17 = this; + if (this.$filled) { + var _loop = /* @__PURE__ */ __name(function _loop2() { + var value2 = _this17.d_value[index]; + var matchedOptionIndex = _this17.visibleOptions.findIndex(function(option4) { + return _this17.isValidSelectedOption(option4) && _this17.isEquals(value2, _this17.getOptionValue(option4)); + }); + if (matchedOptionIndex > -1) return { + v: matchedOptionIndex + }; + }, "_loop"), _ret; + for (var index = this.d_value.length - 1; index >= 0; index--) { + _ret = _loop(); + if (_ret) return _ret.v; + } + } + return -1; + }, "findSelectedOptionIndex"), + findFirstSelectedOptionIndex: /* @__PURE__ */ __name(function findFirstSelectedOptionIndex() { + var _this18 = this; + return this.$filled ? this.visibleOptions.findIndex(function(option4) { + return _this18.isValidSelectedOption(option4); + }) : -1; + }, "findFirstSelectedOptionIndex"), + findLastSelectedOptionIndex: /* @__PURE__ */ __name(function findLastSelectedOptionIndex() { + var _this19 = this; + return this.$filled ? findLastIndex(this.visibleOptions, function(option4) { + return _this19.isValidSelectedOption(option4); + }) : -1; + }, "findLastSelectedOptionIndex"), + findNextSelectedOptionIndex: /* @__PURE__ */ __name(function findNextSelectedOptionIndex(index) { + var _this20 = this; + var matchedOptionIndex = this.$filled && index < this.visibleOptions.length - 1 ? this.visibleOptions.slice(index + 1).findIndex(function(option4) { + return _this20.isValidSelectedOption(option4); + }) : -1; + return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : -1; + }, "findNextSelectedOptionIndex"), + findPrevSelectedOptionIndex: /* @__PURE__ */ __name(function findPrevSelectedOptionIndex(index) { + var _this21 = this; + var matchedOptionIndex = this.$filled && index > 0 ? findLastIndex(this.visibleOptions.slice(0, index), function(option4) { + return _this21.isValidSelectedOption(option4); + }) : -1; + return matchedOptionIndex > -1 ? matchedOptionIndex : -1; + }, "findPrevSelectedOptionIndex"), + findNearestSelectedOptionIndex: /* @__PURE__ */ __name(function findNearestSelectedOptionIndex(index) { + var firstCheckUp = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + var matchedOptionIndex = -1; + if (this.$filled) { + if (firstCheckUp) { + matchedOptionIndex = this.findPrevSelectedOptionIndex(index); + matchedOptionIndex = matchedOptionIndex === -1 ? this.findNextSelectedOptionIndex(index) : matchedOptionIndex; + } else { + matchedOptionIndex = this.findNextSelectedOptionIndex(index); + matchedOptionIndex = matchedOptionIndex === -1 ? this.findPrevSelectedOptionIndex(index) : matchedOptionIndex; + } + } + return matchedOptionIndex > -1 ? matchedOptionIndex : index; + }, "findNearestSelectedOptionIndex"), + findFirstFocusedOptionIndex: /* @__PURE__ */ __name(function findFirstFocusedOptionIndex2() { + var selectedIndex = this.findSelectedOptionIndex(); + return selectedIndex < 0 ? this.findFirstOptionIndex() : selectedIndex; + }, "findFirstFocusedOptionIndex"), + findLastFocusedOptionIndex: /* @__PURE__ */ __name(function findLastFocusedOptionIndex2() { + var selectedIndex = this.findSelectedOptionIndex(); + return selectedIndex < 0 ? this.findLastOptionIndex() : selectedIndex; + }, "findLastFocusedOptionIndex"), + searchOptions: /* @__PURE__ */ __name(function searchOptions2(event2) { + var _this22 = this; + this.searchValue = (this.searchValue || "") + event2.key; + var optionIndex = -1; + if (isNotEmpty(this.searchValue)) { + if (this.focusedOptionIndex !== -1) { + optionIndex = this.visibleOptions.slice(this.focusedOptionIndex).findIndex(function(option4) { + return _this22.isOptionMatched(option4); + }); + optionIndex = optionIndex === -1 ? this.visibleOptions.slice(0, this.focusedOptionIndex).findIndex(function(option4) { + return _this22.isOptionMatched(option4); + }) : optionIndex + this.focusedOptionIndex; + } else { + optionIndex = this.visibleOptions.findIndex(function(option4) { + return _this22.isOptionMatched(option4); + }); + } + if (optionIndex === -1 && this.focusedOptionIndex === -1) { + optionIndex = this.findFirstFocusedOptionIndex(); + } + if (optionIndex !== -1) { + this.changeFocusedOptionIndex(event2, optionIndex); + } + } + if (this.searchTimeout) { + clearTimeout(this.searchTimeout); + } + this.searchTimeout = setTimeout(function() { + _this22.searchValue = ""; + _this22.searchTimeout = null; + }, 500); + }, "searchOptions"), + changeFocusedOptionIndex: /* @__PURE__ */ __name(function changeFocusedOptionIndex4(event2, index) { + if (this.focusedOptionIndex !== index) { + this.focusedOptionIndex = index; + this.scrollInView(); + if (this.selectOnFocus) { + this.onOptionSelect(event2, this.visibleOptions[index]); + } + } + }, "changeFocusedOptionIndex"), + scrollInView: /* @__PURE__ */ __name(function scrollInView4() { + var _this23 = this; + var index = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : -1; + this.$nextTick(function() { + var id4 = index !== -1 ? "".concat(_this23.id, "_").concat(index) : _this23.focusedOptionId; + var element = findSingle(_this23.list, 'li[id="'.concat(id4, '"]')); + if (element) { + element.scrollIntoView && element.scrollIntoView({ + block: "nearest", + inline: "nearest" + }); + } else if (!_this23.virtualScrollerDisabled) { + _this23.virtualScroller && _this23.virtualScroller.scrollToIndex(index !== -1 ? index : _this23.focusedOptionIndex); + } + }); + }, "scrollInView"), + autoUpdateModel: /* @__PURE__ */ __name(function autoUpdateModel2() { + if (this.selectOnFocus && this.autoOptionFocus && !this.$filled) { + this.focusedOptionIndex = this.findFirstFocusedOptionIndex(); + var value2 = this.getOptionValue(this.visibleOptions[this.focusedOptionIndex]); + this.updateModel(null, [value2]); + } + }, "autoUpdateModel"), + updateModel: /* @__PURE__ */ __name(function updateModel6(event2, value2) { + this.writeValue(value2, event2); + this.$emit("change", { + originalEvent: event2, + value: value2 + }); + }, "updateModel"), + flatOptions: /* @__PURE__ */ __name(function flatOptions(options4) { + var _this24 = this; + return (options4 || []).reduce(function(result, option4, index) { + result.push({ + optionGroup: option4, + group: true, + index + }); + var optionGroupChildren = _this24.getOptionGroupChildren(option4); + optionGroupChildren && optionGroupChildren.forEach(function(o) { + return result.push(o); + }); + return result; + }, []); + }, "flatOptions"), + overlayRef: /* @__PURE__ */ __name(function overlayRef3(el) { + this.overlay = el; + }, "overlayRef"), + listRef: /* @__PURE__ */ __name(function listRef2(el, contentRef2) { + this.list = el; + contentRef2 && contentRef2(el); + }, "listRef"), + virtualScrollerRef: /* @__PURE__ */ __name(function virtualScrollerRef(el) { + this.virtualScroller = el; + }, "virtualScrollerRef") + }, + computed: { + visibleOptions: /* @__PURE__ */ __name(function visibleOptions2() { + var _this25 = this; + var options4 = this.optionGroupLabel ? this.flatOptions(this.options) : this.options || []; + if (this.filterValue) { + var filteredOptions = FilterService.filter(options4, this.searchFields, this.filterValue, this.filterMatchMode, this.filterLocale); + if (this.optionGroupLabel) { + var optionGroups = this.options || []; + var filtered = []; + optionGroups.forEach(function(group) { + var groupChildren = _this25.getOptionGroupChildren(group); + var filteredItems = groupChildren.filter(function(item8) { + return filteredOptions.includes(item8); + }); + if (filteredItems.length > 0) filtered.push(_objectSpread$d(_objectSpread$d({}, group), {}, _defineProperty$1$2({}, typeof _this25.optionGroupChildren === "string" ? _this25.optionGroupChildren : "items", _toConsumableArray$6(filteredItems)))); + }); + return this.flatOptions(filtered); + } + return filteredOptions; + } + return options4; + }, "visibleOptions"), + label: /* @__PURE__ */ __name(function label7() { + var label12; + if (this.d_value && this.d_value.length) { + if (isNotEmpty(this.maxSelectedLabels) && this.d_value.length > this.maxSelectedLabels) { + return this.getSelectedItemsLabel(); + } else { + label12 = ""; + for (var i = 0; i < this.d_value.length; i++) { + if (i !== 0) { + label12 += ", "; + } + label12 += this.getLabelByValue(this.d_value[i]); + } + } + } else { + label12 = this.placeholder; + } + return label12; + }, "label"), + chipSelectedItems: /* @__PURE__ */ __name(function chipSelectedItems() { + return isNotEmpty(this.maxSelectedLabels) && this.d_value && this.d_value.length > this.maxSelectedLabels; + }, "chipSelectedItems"), + allSelected: /* @__PURE__ */ __name(function allSelected() { + var _this26 = this; + return this.selectAll !== null ? this.selectAll : isNotEmpty(this.visibleOptions) && this.visibleOptions.every(function(option4) { + return _this26.isOptionGroup(option4) || _this26.isOptionDisabled(option4) || _this26.isSelected(option4); + }); + }, "allSelected"), + // @deprecated use $filled instead. + hasSelectedOption: /* @__PURE__ */ __name(function hasSelectedOption2() { + return this.$filled; + }, "hasSelectedOption"), + equalityKey: /* @__PURE__ */ __name(function equalityKey2() { + return this.optionValue ? null : this.dataKey; + }, "equalityKey"), + searchFields: /* @__PURE__ */ __name(function searchFields() { + return this.filterFields || [this.optionLabel]; + }, "searchFields"), + maxSelectionLimitReached: /* @__PURE__ */ __name(function maxSelectionLimitReached() { + return this.selectionLimit && this.d_value && this.d_value.length === this.selectionLimit; + }, "maxSelectionLimitReached"), + filterResultMessageText: /* @__PURE__ */ __name(function filterResultMessageText() { + return isNotEmpty(this.visibleOptions) ? this.filterMessageText.replaceAll("{0}", this.visibleOptions.length) : this.emptyFilterMessageText; + }, "filterResultMessageText"), + filterMessageText: /* @__PURE__ */ __name(function filterMessageText() { + return this.filterMessage || this.$primevue.config.locale.searchMessage || ""; + }, "filterMessageText"), + emptyFilterMessageText: /* @__PURE__ */ __name(function emptyFilterMessageText() { + return this.emptyFilterMessage || this.$primevue.config.locale.emptySearchMessage || this.$primevue.config.locale.emptyFilterMessage || ""; + }, "emptyFilterMessageText"), + emptyMessageText: /* @__PURE__ */ __name(function emptyMessageText3() { + return this.emptyMessage || this.$primevue.config.locale.emptyMessage || ""; + }, "emptyMessageText"), + selectionMessageText: /* @__PURE__ */ __name(function selectionMessageText2() { + return this.selectionMessage || this.$primevue.config.locale.selectionMessage || ""; + }, "selectionMessageText"), + emptySelectionMessageText: /* @__PURE__ */ __name(function emptySelectionMessageText2() { + return this.emptySelectionMessage || this.$primevue.config.locale.emptySelectionMessage || ""; + }, "emptySelectionMessageText"), + selectedMessageText: /* @__PURE__ */ __name(function selectedMessageText2() { + return this.$filled ? this.selectionMessageText.replaceAll("{0}", this.d_value.length) : this.emptySelectionMessageText; + }, "selectedMessageText"), + focusedOptionId: /* @__PURE__ */ __name(function focusedOptionId5() { + return this.focusedOptionIndex !== -1 ? "".concat(this.id, "_").concat(this.focusedOptionIndex) : null; + }, "focusedOptionId"), + ariaSetSize: /* @__PURE__ */ __name(function ariaSetSize() { + var _this27 = this; + return this.visibleOptions.filter(function(option4) { + return !_this27.isOptionGroup(option4); + }).length; + }, "ariaSetSize"), + toggleAllAriaLabel: /* @__PURE__ */ __name(function toggleAllAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria[this.allSelected ? "selectAll" : "unselectAll"] : void 0; + }, "toggleAllAriaLabel"), + listAriaLabel: /* @__PURE__ */ __name(function listAriaLabel2() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.listLabel : void 0; + }, "listAriaLabel"), + virtualScrollerDisabled: /* @__PURE__ */ __name(function virtualScrollerDisabled() { + return !this.virtualScrollerOptions; + }, "virtualScrollerDisabled"), + hasFluid: /* @__PURE__ */ __name(function hasFluid() { + return isEmpty(this.fluid) ? !!this.$pcFluid : this.fluid; + }, "hasFluid"), + isClearIconVisible: /* @__PURE__ */ __name(function isClearIconVisible2() { + return this.showClear && this.d_value != null && isNotEmpty(this.options); + }, "isClearIconVisible") + }, + directives: { + ripple: Ripple + }, + components: { + InputText: script$1o, + Checkbox: script$1J, + VirtualScroller: script$1K, + Portal: script$1f, + Chip: script$1t, + IconField: script$1L, + InputIcon: script$1M, + TimesIcon: script$1g, + SearchIcon: script$1N, + ChevronDownIcon: script$1k, + SpinnerIcon: script$1r, + CheckIcon: script$1D + } +}; +function _typeof$e(o) { + "@babel/helpers - typeof"; + return _typeof$e = "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$e(o); +} +__name(_typeof$e, "_typeof$e"); +function _defineProperty$e(e, r, t2) { + return (r = _toPropertyKey$e(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$e, "_defineProperty$e"); +function _toPropertyKey$e(t2) { + var i = _toPrimitive$e(t2, "string"); + return "symbol" == _typeof$e(i) ? i : i + ""; +} +__name(_toPropertyKey$e, "_toPropertyKey$e"); +function _toPrimitive$e(t2, r) { + if ("object" != _typeof$e(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$e(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$e, "_toPrimitive$e"); +var _hoisted_1$f = ["id", "disabled", "placeholder", "tabindex", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-invalid"]; +var _hoisted_2$b = { + key: 0 +}; +var _hoisted_3$8 = ["id", "aria-label"]; +var _hoisted_4$5 = ["id"]; +var _hoisted_5$1 = ["id", "aria-label", "aria-selected", "aria-disabled", "aria-setsize", "aria-posinset", "onClick", "onMousemove", "data-p-selected", "data-p-focused", "data-p-disabled"]; +function render$r(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Chip = resolveComponent("Chip"); + var _component_SpinnerIcon = resolveComponent("SpinnerIcon"); + var _component_Checkbox = resolveComponent("Checkbox"); + var _component_InputText = resolveComponent("InputText"); + var _component_SearchIcon = resolveComponent("SearchIcon"); + var _component_InputIcon = resolveComponent("InputIcon"); + var _component_IconField = resolveComponent("IconField"); + var _component_VirtualScroller = resolveComponent("VirtualScroller"); + var _component_Portal = resolveComponent("Portal"); + var _directive_ripple = resolveDirective("ripple"); + return openBlock(), createElementBlock("div", mergeProps({ + ref: "container", + "class": _ctx.cx("root"), + style: _ctx.sx("root"), + onClick: _cache[7] || (_cache[7] = function() { + return $options.onContainerClick && $options.onContainerClick.apply($options, arguments); + }) + }, _ctx.ptmi("root")), [createBaseVNode("div", mergeProps({ + "class": "p-hidden-accessible" + }, _ctx.ptm("hiddenInputContainer"), { + "data-p-hidden-accessible": true + }), [createBaseVNode("input", mergeProps({ + ref: "focusInput", + id: _ctx.inputId, + type: "text", + readonly: "", + disabled: _ctx.disabled, + placeholder: _ctx.placeholder, + tabindex: !_ctx.disabled ? _ctx.tabindex : -1, + role: "combobox", + "aria-label": _ctx.ariaLabel, + "aria-labelledby": _ctx.ariaLabelledby, + "aria-haspopup": "listbox", + "aria-expanded": $data.overlayVisible, + "aria-controls": $data.id + "_list", + "aria-activedescendant": $data.focused ? $options.focusedOptionId : void 0, + "aria-invalid": _ctx.invalid || void 0, + onFocus: _cache[0] || (_cache[0] = function() { + return $options.onFocus && $options.onFocus.apply($options, arguments); + }), + onBlur: _cache[1] || (_cache[1] = function() { + return $options.onBlur && $options.onBlur.apply($options, arguments); + }), + onKeydown: _cache[2] || (_cache[2] = function() { + return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); + }) + }, _ctx.ptm("hiddenInput")), null, 16, _hoisted_1$f)], 16), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("labelContainer") + }, _ctx.ptm("labelContainer")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("label") + }, _ctx.ptm("label")), [renderSlot(_ctx.$slots, "value", { + value: _ctx.d_value, + placeholder: _ctx.placeholder + }, function() { + return [_ctx.display === "comma" ? (openBlock(), createElementBlock(Fragment, { + key: 0 + }, [createTextVNode(toDisplayString($options.label || "empty"), 1)], 64)) : _ctx.display === "chip" ? (openBlock(), createElementBlock(Fragment, { + key: 1 + }, [$options.chipSelectedItems ? (openBlock(), createElementBlock("span", _hoisted_2$b, toDisplayString($options.label), 1)) : (openBlock(true), createElementBlock(Fragment, { + key: 1 + }, renderList(_ctx.d_value, function(item8) { + return openBlock(), createElementBlock("span", mergeProps({ + key: $options.getLabelByValue(item8), + "class": _ctx.cx("chipItem"), + ref_for: true + }, _ctx.ptm("chipItem")), [renderSlot(_ctx.$slots, "chip", { + value: item8, + removeCallback: /* @__PURE__ */ __name(function removeCallback(event2) { + return $options.removeOption(event2, item8); + }, "removeCallback") + }, function() { + return [createVNode(_component_Chip, { + "class": normalizeClass(_ctx.cx("pcChip")), + label: $options.getLabelByValue(item8), + removeIcon: _ctx.chipIcon || _ctx.removeTokenIcon, + removable: "", + unstyled: _ctx.unstyled, + onRemove: /* @__PURE__ */ __name(function onRemove($event) { + return $options.removeOption($event, item8); + }, "onRemove"), + pt: _ctx.ptm("pcChip") + }, { + removeicon: withCtx(function() { + return [renderSlot(_ctx.$slots, _ctx.$slots.chipicon ? "chipicon" : "removetokenicon", { + "class": normalizeClass(_ctx.cx("chipIcon")), + item: item8, + removeCallback: /* @__PURE__ */ __name(function removeCallback(event2) { + return $options.removeOption(event2, item8); + }, "removeCallback") + })]; + }), + _: 2 + }, 1032, ["class", "label", "removeIcon", "unstyled", "onRemove", "pt"])]; + })], 16); + }), 128)), !_ctx.d_value || _ctx.d_value.length === 0 ? (openBlock(), createElementBlock(Fragment, { + key: 2 + }, [createTextVNode(toDisplayString(_ctx.placeholder || "empty"), 1)], 64)) : createCommentVNode("", true)], 64)) : createCommentVNode("", true)]; + })], 16)], 16), $options.isClearIconVisible ? renderSlot(_ctx.$slots, "clearicon", { + key: 0, + "class": normalizeClass(_ctx.cx("clearIcon")), + clearCallback: $options.onClearClick + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon ? "i" : "TimesIcon"), mergeProps({ + ref: "clearIcon", + "class": [_ctx.cx("clearIcon"), _ctx.clearIcon], + onClick: $options.onClearClick + }, _ctx.ptm("clearIcon"), { + "data-pc-section": "clearicon" + }), null, 16, ["class", "onClick"]))]; + }) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("dropdown") + }, _ctx.ptm("dropdown")), [_ctx.loading ? renderSlot(_ctx.$slots, "loadingicon", { + key: 0, + "class": normalizeClass(_ctx.cx("loadingIcon")) + }, function() { + return [_ctx.loadingIcon ? (openBlock(), createElementBlock("span", mergeProps({ + key: 0, + "class": [_ctx.cx("loadingIcon"), "pi-spin", _ctx.loadingIcon], + "aria-hidden": "true" + }, _ctx.ptm("loadingIcon")), null, 16)) : (openBlock(), createBlock(_component_SpinnerIcon, mergeProps({ + key: 1, + "class": _ctx.cx("loadingIcon"), + spin: "", + "aria-hidden": "true" + }, _ctx.ptm("loadingIcon")), null, 16, ["class"]))]; + }) : renderSlot(_ctx.$slots, "dropdownicon", { + key: 1, + "class": normalizeClass(_ctx.cx("dropdownIcon")) + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.dropdownIcon ? "span" : "ChevronDownIcon"), mergeProps({ + "class": [_ctx.cx("dropdownIcon"), _ctx.dropdownIcon], + "aria-hidden": "true" + }, _ctx.ptm("dropdownIcon")), null, 16, ["class"]))]; + })], 16), createVNode(_component_Portal, { + appendTo: _ctx.appendTo + }, { + "default": withCtx(function() { + return [createVNode(Transition, mergeProps({ + name: "p-connected-overlay", + onEnter: $options.onOverlayEnter, + onAfterEnter: $options.onOverlayAfterEnter, + onLeave: $options.onOverlayLeave, + onAfterLeave: $options.onOverlayAfterLeave + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [$data.overlayVisible ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: $options.overlayRef, + style: [_ctx.panelStyle, _ctx.overlayStyle], + "class": [_ctx.cx("overlay"), _ctx.panelClass, _ctx.overlayClass], + onClick: _cache[5] || (_cache[5] = function() { + return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); + }), + onKeydown: _cache[6] || (_cache[6] = function() { + return $options.onOverlayKeyDown && $options.onOverlayKeyDown.apply($options, arguments); + }) + }, _ctx.ptm("overlay")), [createBaseVNode("span", mergeProps({ + ref: "firstHiddenFocusableElementOnOverlay", + role: "presentation", + "aria-hidden": "true", + "class": "p-hidden-accessible p-hidden-focusable", + tabindex: 0, + onFocus: _cache[3] || (_cache[3] = function() { + return $options.onFirstHiddenFocus && $options.onFirstHiddenFocus.apply($options, arguments); + }) + }, _ctx.ptm("hiddenFirstFocusableEl"), { + "data-p-hidden-accessible": true, + "data-p-hidden-focusable": true + }), null, 16), renderSlot(_ctx.$slots, "header", { + value: _ctx.d_value, + options: $options.visibleOptions + }), _ctx.showToggleAll && _ctx.selectionLimit == null || _ctx.filter ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("header") + }, _ctx.ptm("header")), [_ctx.showToggleAll && _ctx.selectionLimit == null ? (openBlock(), createBlock(_component_Checkbox, { + key: 0, + modelValue: $options.allSelected, + binary: true, + disabled: _ctx.disabled, + variant: _ctx.variant, + "aria-label": $options.toggleAllAriaLabel, + onChange: $options.onToggleAll, + unstyled: _ctx.unstyled, + pt: $options.getHeaderCheckboxPTOptions("pcHeaderCheckbox") + }, { + icon: withCtx(function(slotProps) { + return [_ctx.$slots.headercheckboxicon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.headercheckboxicon), { + key: 0, + checked: slotProps.checked, + "class": normalizeClass(slotProps["class"]) + }, null, 8, ["checked", "class"])) : slotProps.checked ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.checkboxIcon ? "span" : "CheckIcon"), mergeProps({ + key: 1, + "class": [slotProps["class"], _defineProperty$e({}, _ctx.checkboxIcon, slotProps.checked)] + }, $options.getHeaderCheckboxPTOptions("pcHeaderCheckbox.icon")), null, 16, ["class"])) : createCommentVNode("", true)]; + }), + _: 1 + }, 8, ["modelValue", "disabled", "variant", "aria-label", "onChange", "unstyled", "pt"])) : createCommentVNode("", true), _ctx.filter ? (openBlock(), createBlock(_component_IconField, { + key: 1, + "class": normalizeClass(_ctx.cx("pcFilterContainer")), + unstyled: _ctx.unstyled, + pt: _ctx.ptm("pcFilterContainer") + }, { + "default": withCtx(function() { + return [createVNode(_component_InputText, { + ref: "filterInput", + value: $data.filterValue, + onVnodeMounted: $options.onFilterUpdated, + onVnodeUpdated: $options.onFilterUpdated, + "class": normalizeClass(_ctx.cx("pcFilter")), + placeholder: _ctx.filterPlaceholder, + disabled: _ctx.disabled, + variant: _ctx.variant, + unstyled: _ctx.unstyled, + role: "searchbox", + autocomplete: "off", + "aria-owns": $data.id + "_list", + "aria-activedescendant": $options.focusedOptionId, + onKeydown: $options.onFilterKeyDown, + onBlur: $options.onFilterBlur, + onInput: $options.onFilterChange, + pt: _ctx.ptm("pcFilter") + }, null, 8, ["value", "onVnodeMounted", "onVnodeUpdated", "class", "placeholder", "disabled", "variant", "unstyled", "aria-owns", "aria-activedescendant", "onKeydown", "onBlur", "onInput", "pt"]), createVNode(_component_InputIcon, { + unstyled: _ctx.unstyled, + pt: _ctx.ptm("pcFilterIconContainer") + }, { + "default": withCtx(function() { + return [renderSlot(_ctx.$slots, "filtericon", {}, function() { + return [_ctx.filterIcon ? (openBlock(), createElementBlock("span", mergeProps({ + key: 0, + "class": _ctx.filterIcon + }, _ctx.ptm("filterIcon")), null, 16)) : (openBlock(), createBlock(_component_SearchIcon, normalizeProps(mergeProps({ + key: 1 + }, _ctx.ptm("filterIcon"))), null, 16))]; + })]; + }), + _: 3 + }, 8, ["unstyled", "pt"])]; + }), + _: 3 + }, 8, ["class", "unstyled", "pt"])) : createCommentVNode("", true), _ctx.filter ? (openBlock(), createElementBlock("span", mergeProps({ + key: 2, + role: "status", + "aria-live": "polite", + "class": "p-hidden-accessible" + }, _ctx.ptm("hiddenFilterResult"), { + "data-p-hidden-accessible": true + }), toDisplayString($options.filterResultMessageText), 17)) : createCommentVNode("", true)], 16)) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("listContainer"), + style: { + "max-height": $options.virtualScrollerDisabled ? _ctx.scrollHeight : "" + } + }, _ctx.ptm("listContainer")), [createVNode(_component_VirtualScroller, mergeProps({ + ref: $options.virtualScrollerRef + }, _ctx.virtualScrollerOptions, { + items: $options.visibleOptions, + style: { + height: _ctx.scrollHeight + }, + tabindex: -1, + disabled: $options.virtualScrollerDisabled, + pt: _ctx.ptm("virtualScroller") + }), createSlots({ + content: withCtx(function(_ref2) { + var styleClass = _ref2.styleClass, contentRef2 = _ref2.contentRef, items2 = _ref2.items, getItemOptions = _ref2.getItemOptions, contentStyle = _ref2.contentStyle, itemSize = _ref2.itemSize; + return [createBaseVNode("ul", mergeProps({ + ref: /* @__PURE__ */ __name(function ref2(el) { + return $options.listRef(el, contentRef2); + }, "ref"), + id: $data.id + "_list", + "class": [_ctx.cx("list"), styleClass], + style: contentStyle, + role: "listbox", + "aria-multiselectable": "true", + "aria-label": $options.listAriaLabel + }, _ctx.ptm("list")), [(openBlock(true), createElementBlock(Fragment, null, renderList(items2, function(option4, i) { + return openBlock(), createElementBlock(Fragment, { + key: $options.getOptionRenderKey(option4, $options.getOptionIndex(i, getItemOptions)) + }, [$options.isOptionGroup(option4) ? (openBlock(), createElementBlock("li", mergeProps({ + key: 0, + id: $data.id + "_" + $options.getOptionIndex(i, getItemOptions), + style: { + height: itemSize ? itemSize + "px" : void 0 + }, + "class": _ctx.cx("optionGroup"), + role: "option", + ref_for: true + }, _ctx.ptm("optionGroup")), [renderSlot(_ctx.$slots, "optiongroup", { + option: option4.optionGroup, + index: $options.getOptionIndex(i, getItemOptions) + }, function() { + return [createTextVNode(toDisplayString($options.getOptionGroupLabel(option4.optionGroup)), 1)]; + })], 16, _hoisted_4$5)) : withDirectives((openBlock(), createElementBlock("li", mergeProps({ + key: 1, + id: $data.id + "_" + $options.getOptionIndex(i, getItemOptions), + style: { + height: itemSize ? itemSize + "px" : void 0 + }, + "class": _ctx.cx("option", { + option: option4, + index: i, + getItemOptions + }), + role: "option", + "aria-label": $options.getOptionLabel(option4), + "aria-selected": $options.isSelected(option4), + "aria-disabled": $options.isOptionDisabled(option4), + "aria-setsize": $options.ariaSetSize, + "aria-posinset": $options.getAriaPosInset($options.getOptionIndex(i, getItemOptions)), + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return $options.onOptionSelect($event, option4, $options.getOptionIndex(i, getItemOptions), true); + }, "onClick"), + onMousemove: /* @__PURE__ */ __name(function onMousemove($event) { + return $options.onOptionMouseMove($event, $options.getOptionIndex(i, getItemOptions)); + }, "onMousemove"), + ref_for: true + }, $options.getCheckboxPTOptions(option4, getItemOptions, i, "option"), { + "data-p-selected": $options.isSelected(option4), + "data-p-focused": $data.focusedOptionIndex === $options.getOptionIndex(i, getItemOptions), + "data-p-disabled": $options.isOptionDisabled(option4) + }), [createVNode(_component_Checkbox, { + defaultValue: $options.isSelected(option4), + binary: true, + tabindex: -1, + variant: _ctx.variant, + unstyled: _ctx.unstyled, + pt: $options.getCheckboxPTOptions(option4, getItemOptions, i, "pcOptionCheckbox") + }, { + icon: withCtx(function(slotProps) { + return [_ctx.$slots.optioncheckboxicon || _ctx.$slots.itemcheckboxicon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.optioncheckboxicon || _ctx.$slots.itemcheckboxicon), { + key: 0, + checked: slotProps.checked, + "class": normalizeClass(slotProps["class"]) + }, null, 8, ["checked", "class"])) : slotProps.checked ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.checkboxIcon ? "span" : "CheckIcon"), mergeProps({ + key: 1, + "class": [slotProps["class"], _defineProperty$e({}, _ctx.checkboxIcon, slotProps.checked)], + ref_for: true + }, $options.getCheckboxPTOptions(option4, getItemOptions, i, "pcOptionCheckbox.icon")), null, 16, ["class"])) : createCommentVNode("", true)]; + }), + _: 2 + }, 1032, ["defaultValue", "variant", "unstyled", "pt"]), renderSlot(_ctx.$slots, "option", { + option: option4, + selected: $options.isSelected(option4), + index: $options.getOptionIndex(i, getItemOptions) + }, function() { + return [createBaseVNode("span", mergeProps({ + ref_for: true + }, _ctx.ptm("optionLabel")), toDisplayString($options.getOptionLabel(option4)), 17)]; + })], 16, _hoisted_5$1)), [[_directive_ripple]])], 64); + }), 128)), $data.filterValue && (!items2 || items2 && items2.length === 0) ? (openBlock(), createElementBlock("li", mergeProps({ + key: 0, + "class": _ctx.cx("emptyMessage"), + role: "option" + }, _ctx.ptm("emptyMessage")), [renderSlot(_ctx.$slots, "emptyfilter", {}, function() { + return [createTextVNode(toDisplayString($options.emptyFilterMessageText), 1)]; + })], 16)) : !_ctx.options || _ctx.options && _ctx.options.length === 0 ? (openBlock(), createElementBlock("li", mergeProps({ + key: 1, + "class": _ctx.cx("emptyMessage"), + role: "option" + }, _ctx.ptm("emptyMessage")), [renderSlot(_ctx.$slots, "empty", {}, function() { + return [createTextVNode(toDisplayString($options.emptyMessageText), 1)]; + })], 16)) : createCommentVNode("", true)], 16, _hoisted_3$8)]; + }), + _: 2 + }, [_ctx.$slots.loader ? { + name: "loader", + fn: withCtx(function(_ref4) { + var options4 = _ref4.options; + return [renderSlot(_ctx.$slots, "loader", { + options: options4 + })]; + }), + key: "0" + } : void 0]), 1040, ["items", "style", "disabled", "pt"])], 16), renderSlot(_ctx.$slots, "footer", { + value: _ctx.d_value, + options: $options.visibleOptions + }), !_ctx.options || _ctx.options && _ctx.options.length === 0 ? (openBlock(), createElementBlock("span", mergeProps({ + key: 1, + role: "status", + "aria-live": "polite", + "class": "p-hidden-accessible" + }, _ctx.ptm("hiddenEmptyMessage"), { + "data-p-hidden-accessible": true + }), toDisplayString($options.emptyMessageText), 17)) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ + role: "status", + "aria-live": "polite", + "class": "p-hidden-accessible" + }, _ctx.ptm("hiddenSelectedMessage"), { + "data-p-hidden-accessible": true + }), toDisplayString($options.selectedMessageText), 17), createBaseVNode("span", mergeProps({ + ref: "lastHiddenFocusableElementOnOverlay", + role: "presentation", + "aria-hidden": "true", + "class": "p-hidden-accessible p-hidden-focusable", + tabindex: 0, + onFocus: _cache[4] || (_cache[4] = function() { + return $options.onLastHiddenFocus && $options.onLastHiddenFocus.apply($options, arguments); + }) + }, _ctx.ptm("hiddenLastFocusableEl"), { + "data-p-hidden-accessible": true, + "data-p-hidden-focusable": true + }), null, 16)], 16)) : createCommentVNode("", true)]; + }), + _: 3 + }, 16, ["onEnter", "onAfterEnter", "onLeave", "onAfterLeave"])]; + }), + _: 3 + }, 8, ["appendTo"])], 16); +} +__name(render$r, "render$r"); +script$v.render = render$r; +var script$u = { + name: "AngleDoubleDownIcon", + "extends": script$1m +}; +function render$q(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M6.70786 6.59831C6.80043 6.63674 6.89974 6.65629 6.99997 6.65581C7.19621 6.64081 7.37877 6.54953 7.50853 6.40153L11.0685 2.8416C11.1364 2.69925 11.1586 2.53932 11.132 2.38384C11.1053 2.22837 11.0311 2.08498 10.9195 1.97343C10.808 1.86188 10.6646 1.78766 10.5091 1.76099C10.3536 1.73431 10.1937 1.75649 10.0513 1.82448L6.99997 4.87585L3.9486 1.82448C3.80625 1.75649 3.64632 1.73431 3.49084 1.76099C3.33536 1.78766 3.19197 1.86188 3.08043 1.97343C2.96888 2.08498 2.89466 2.22837 2.86798 2.38384C2.84131 2.53932 2.86349 2.69925 2.93147 2.8416L6.46089 6.43205C6.53132 6.50336 6.61528 6.55989 6.70786 6.59831ZM6.70786 12.1925C6.80043 12.2309 6.89974 12.2505 6.99997 12.25C7.10241 12.2465 7.20306 12.2222 7.29575 12.1785C7.38845 12.1348 7.47124 12.0726 7.53905 11.9957L11.0685 8.46629C11.1614 8.32292 11.2036 8.15249 11.1881 7.98233C11.1727 7.81216 11.1005 7.6521 10.9833 7.52781C10.866 7.40353 10.7104 7.3222 10.5415 7.29688C10.3725 7.27155 10.1999 7.30369 10.0513 7.38814L6.99997 10.4395L3.9486 7.38814C3.80006 7.30369 3.62747 7.27155 3.45849 7.29688C3.28951 7.3222 3.13393 7.40353 3.01667 7.52781C2.89942 7.6521 2.82729 7.81216 2.81184 7.98233C2.79639 8.15249 2.83852 8.32292 2.93148 8.46629L6.4609 12.0262C6.53133 12.0975 6.61529 12.1541 6.70786 12.1925Z", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$q, "render$q"); +script$u.render = render$q; +var script$t = { + name: "AngleDoubleUpIcon", + "extends": script$1m +}; +function render$p(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M10.1504 6.67719C10.2417 6.71508 10.3396 6.73436 10.4385 6.73389C10.6338 6.74289 10.8249 6.67441 10.97 6.54334C11.1109 6.4023 11.19 6.21112 11.19 6.01178C11.19 5.81245 11.1109 5.62127 10.97 5.48023L7.45977 1.96998C7.31873 1.82912 7.12755 1.75 6.92821 1.75C6.72888 1.75 6.5377 1.82912 6.39666 1.96998L2.9165 5.45014C2.83353 5.58905 2.79755 5.751 2.81392 5.91196C2.83028 6.07293 2.89811 6.22433 3.00734 6.34369C3.11656 6.46306 3.26137 6.54402 3.42025 6.57456C3.57914 6.60511 3.74364 6.5836 3.88934 6.51325L6.89813 3.50446L9.90691 6.51325C9.97636 6.58357 10.0592 6.6393 10.1504 6.67719ZM9.93702 11.9993C10.065 12.1452 10.245 12.2352 10.4385 12.25C10.632 12.2352 10.812 12.1452 10.9399 11.9993C11.0633 11.8614 11.1315 11.6828 11.1315 11.4978C11.1315 11.3128 11.0633 11.1342 10.9399 10.9963L7.48987 7.48609C7.34883 7.34523 7.15765 7.26611 6.95832 7.26611C6.75899 7.26611 6.5678 7.34523 6.42677 7.48609L2.91652 10.9963C2.84948 11.1367 2.82761 11.2944 2.85391 11.4477C2.88022 11.601 2.9534 11.7424 3.06339 11.8524C3.17338 11.9624 3.31477 12.0356 3.46808 12.0619C3.62139 12.0882 3.77908 12.0663 3.91945 11.9993L6.92823 8.99048L9.93702 11.9993Z", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$p, "render$p"); +script$t.render = render$p; +var theme$f = /* @__PURE__ */ __name(function theme25(_ref) { + var dt = _ref.dt; + return "\n.p-orderlist {\n display: flex;\n gap: ".concat(dt("orderlist.gap"), ";\n}\n\n.p-orderlist-controls {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: ").concat(dt("orderlist.controls.gap"), ";\n}\n"); +}, "theme"); +var classes$g = { + root: "p-orderlist p-component", + controls: "p-orderlist-controls" +}; +var OrderListStyle = BaseStyle.extend({ + name: "orderlist", + theme: theme$f, + classes: classes$g +}); +var script$1$g = { + name: "BaseOrderList", + "extends": script$1d, + props: { + modelValue: { + type: Array, + "default": null + }, + selection: { + type: Array, + "default": null + }, + dataKey: { + type: String, + "default": null + }, + listStyle: { + type: null, + "default": null + }, + metaKeySelection: { + type: Boolean, + "default": false + }, + autoOptionFocus: { + type: Boolean, + "default": true + }, + focusOnHover: { + type: Boolean, + "default": true + }, + responsive: { + type: Boolean, + "default": true + }, + breakpoint: { + type: String, + "default": "960px" + }, + striped: { + type: Boolean, + "default": false + }, + scrollHeight: { + type: String, + "default": "14rem" + }, + buttonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default13() { + return { + severity: "secondary" + }; + }, "_default") + }, + moveUpButtonProps: { + type: null, + "default": null + }, + moveTopButtonProps: { + type: null, + "default": null + }, + moveDownButtonProps: { + type: null, + "default": null + }, + moveBottomButtonProps: { + type: null, + "default": null + }, + tabindex: { + type: Number, + "default": 0 + }, + disabled: { + type: Boolean, + "default": false + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + } + }, + style: OrderListStyle, + provide: /* @__PURE__ */ __name(function provide35() { + return { + $pcOrderList: this, + $parentInstance: this + }; + }, "provide") +}; +function _toConsumableArray$5(r) { + return _arrayWithoutHoles$5(r) || _iterableToArray$5(r) || _unsupportedIterableToArray$6(r) || _nonIterableSpread$5(); +} +__name(_toConsumableArray$5, "_toConsumableArray$5"); +function _nonIterableSpread$5() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableSpread$5, "_nonIterableSpread$5"); +function _unsupportedIterableToArray$6(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$6(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$6(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$6, "_unsupportedIterableToArray$6"); +function _iterableToArray$5(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray$5, "_iterableToArray$5"); +function _arrayWithoutHoles$5(r) { + if (Array.isArray(r)) return _arrayLikeToArray$6(r); +} +__name(_arrayWithoutHoles$5, "_arrayWithoutHoles$5"); +function _arrayLikeToArray$6(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; +} +__name(_arrayLikeToArray$6, "_arrayLikeToArray$6"); +var script$s = { + name: "OrderList", + "extends": script$1$g, + inheritAttrs: false, + emits: ["update:modelValue", "reorder", "update:selection", "selection-change", "focus", "blur"], + itemTouched: false, + reorderDirection: null, + styleElement: null, + list: null, + data: /* @__PURE__ */ __name(function data23() { + return { + id: this.$attrs.id, + d_selection: this.selection + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId8(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId") + }, + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount11() { + this.destroyStyle(); + }, "beforeUnmount"), + updated: /* @__PURE__ */ __name(function updated6() { + if (this.reorderDirection) { + this.updateListScroll(); + this.reorderDirection = null; + } + }, "updated"), + mounted: /* @__PURE__ */ __name(function mounted24() { + this.id = this.id || UniqueComponentId(); + if (this.responsive) { + this.createStyle(); + } + }, "mounted"), + methods: { + updateSelection: /* @__PURE__ */ __name(function updateSelection(event2) { + this.$emit("update:selection", this.d_selection); + this.$emit("selection-change", { + originalEvent: event2, + value: this.d_selection + }); + }, "updateSelection"), + onChangeSelection: /* @__PURE__ */ __name(function onChangeSelection(params) { + this.d_selection = params.value; + this.updateSelection(params.event); + }, "onChangeSelection"), + onListFocus: /* @__PURE__ */ __name(function onListFocus3(event2) { + this.$emit("focus", event2); + }, "onListFocus"), + onListBlur: /* @__PURE__ */ __name(function onListBlur3(event2) { + this.$emit("blur", event2); + }, "onListBlur"), + onReorderUpdate: /* @__PURE__ */ __name(function onReorderUpdate(event2, value2) { + this.$emit("update:modelValue", value2); + this.$emit("reorder", { + originalEvent: event2, + value: value2, + direction: this.reorderDirection + }); + }, "onReorderUpdate"), + moveUp: /* @__PURE__ */ __name(function moveUp(event2) { + if (this.d_selection) { + var value2 = _toConsumableArray$5(this.modelValue); + for (var i = 0; i < this.d_selection.length; i++) { + var selectedItem = this.d_selection[i]; + var selectedItemIndex = findIndexInList(selectedItem, value2); + if (selectedItemIndex !== 0) { + var movedItem = value2[selectedItemIndex]; + var temp = value2[selectedItemIndex - 1]; + value2[selectedItemIndex - 1] = movedItem; + value2[selectedItemIndex] = temp; + } else { + break; + } + } + this.reorderDirection = "up"; + this.onReorderUpdate(event2, value2); + } + }, "moveUp"), + moveTop: /* @__PURE__ */ __name(function moveTop(event2) { + if (this.d_selection) { + var value2 = _toConsumableArray$5(this.modelValue); + for (var i = 0; i < this.d_selection.length; i++) { + var selectedItem = this.d_selection[i]; + var selectedItemIndex = findIndexInList(selectedItem, value2); + if (selectedItemIndex !== 0) { + var movedItem = value2.splice(selectedItemIndex, 1)[0]; + value2.unshift(movedItem); + } else { + break; + } + } + this.reorderDirection = "top"; + this.onReorderUpdate(event2, value2); + } + }, "moveTop"), + moveDown: /* @__PURE__ */ __name(function moveDown(event2) { + if (this.d_selection) { + var value2 = _toConsumableArray$5(this.modelValue); + for (var i = this.d_selection.length - 1; i >= 0; i--) { + var selectedItem = this.d_selection[i]; + var selectedItemIndex = findIndexInList(selectedItem, value2); + if (selectedItemIndex !== value2.length - 1) { + var movedItem = value2[selectedItemIndex]; + var temp = value2[selectedItemIndex + 1]; + value2[selectedItemIndex + 1] = movedItem; + value2[selectedItemIndex] = temp; + } else { + break; + } + } + this.reorderDirection = "down"; + this.onReorderUpdate(event2, value2); + } + }, "moveDown"), + moveBottom: /* @__PURE__ */ __name(function moveBottom(event2) { + if (this.d_selection) { + var value2 = _toConsumableArray$5(this.modelValue); + for (var i = this.d_selection.length - 1; i >= 0; i--) { + var selectedItem = this.d_selection[i]; + var selectedItemIndex = findIndexInList(selectedItem, value2); + if (selectedItemIndex !== value2.length - 1) { + var movedItem = value2.splice(selectedItemIndex, 1)[0]; + value2.push(movedItem); + } else { + break; + } + } + this.reorderDirection = "bottom"; + this.onReorderUpdate(event2, value2); + } + }, "moveBottom"), + updateListScroll: /* @__PURE__ */ __name(function updateListScroll() { + this.list = findSingle(this.$refs.listbox.$el, '[data-pc-section="list"]'); + var listItems = find(this.list, '[data-pc-section="item"][data-p-selected="true"]'); + if (listItems && listItems.length) { + switch (this.reorderDirection) { + case "up": + scrollInView(this.list, listItems[0]); + break; + case "top": + this.list.scrollTop = 0; + break; + case "down": + scrollInView(this.list, listItems[listItems.length - 1]); + break; + case "bottom": + this.list.scrollTop = this.list.scrollHeight; + break; + } + } + }, "updateListScroll"), + createStyle: /* @__PURE__ */ __name(function createStyle() { + if (!this.styleElement && !this.isUnstyled) { + var _this$$primevue; + this.styleElement = document.createElement("style"); + this.styleElement.type = "text/css"; + 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); + document.head.appendChild(this.styleElement); + var innerHTML = "\n@media screen and (max-width: ".concat(this.breakpoint, ") {\n .p-orderlist[").concat(this.$attrSelector, "] {\n flex-direction: column;\n }\n\n .p-orderlist[").concat(this.$attrSelector, "] .p-orderlist-controls {\n flex-direction: row;\n }\n}\n"); + this.styleElement.innerHTML = innerHTML; + } + }, "createStyle"), + destroyStyle: /* @__PURE__ */ __name(function destroyStyle() { + if (this.styleElement) { + document.head.removeChild(this.styleElement); + this.styleElement = null; + } + }, "destroyStyle"), + moveDisabled: /* @__PURE__ */ __name(function moveDisabled() { + return this.disabled ? true : !this.d_selection || !this.d_selection.length ? true : false; + }, "moveDisabled") + }, + computed: { + moveUpAriaLabel: /* @__PURE__ */ __name(function moveUpAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveUp : void 0; + }, "moveUpAriaLabel"), + moveTopAriaLabel: /* @__PURE__ */ __name(function moveTopAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveTop : void 0; + }, "moveTopAriaLabel"), + moveDownAriaLabel: /* @__PURE__ */ __name(function moveDownAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveDown : void 0; + }, "moveDownAriaLabel"), + moveBottomAriaLabel: /* @__PURE__ */ __name(function moveBottomAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveBottom : void 0; + }, "moveBottomAriaLabel"), + hasSelectedOption: /* @__PURE__ */ __name(function hasSelectedOption3() { + return isNotEmpty(this.d_selection); + }, "hasSelectedOption") + }, + components: { + Listbox: script$1O, + Button: script$1e, + AngleUpIcon: script$1P, + AngleDownIcon: script$1H, + AngleDoubleUpIcon: script$t, + AngleDoubleDownIcon: script$u + }, + directives: { + ripple: Ripple + } +}; +function _typeof$d(o) { + "@babel/helpers - typeof"; + return _typeof$d = "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$d(o); +} +__name(_typeof$d, "_typeof$d"); +function ownKeys$c(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$c, "ownKeys$c"); +function _objectSpread$c(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$c(Object(t2), true).forEach(function(r2) { + _defineProperty$d(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$c(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$c, "_objectSpread$c"); +function _defineProperty$d(e, r, t2) { + return (r = _toPropertyKey$d(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$d, "_defineProperty$d"); +function _toPropertyKey$d(t2) { + var i = _toPrimitive$d(t2, "string"); + return "symbol" == _typeof$d(i) ? i : i + ""; +} +__name(_toPropertyKey$d, "_toPropertyKey$d"); +function _toPrimitive$d(t2, r) { + if ("object" != _typeof$d(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$d(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$d, "_toPrimitive$d"); +function render$o(_ctx, _cache, $props, $setup, $data, $options) { + var _component_AngleUpIcon = resolveComponent("AngleUpIcon"); + var _component_Button = resolveComponent("Button"); + var _component_AngleDoubleUpIcon = resolveComponent("AngleDoubleUpIcon"); + var _component_AngleDownIcon = resolveComponent("AngleDownIcon"); + var _component_AngleDoubleDownIcon = resolveComponent("AngleDoubleDownIcon"); + var _component_Listbox = resolveComponent("Listbox"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("controls") + }, _ctx.ptm("controls")), [renderSlot(_ctx.$slots, "controlsstart"), createVNode(_component_Button, mergeProps({ + onClick: $options.moveUp, + "aria-label": $options.moveUpAriaLabel, + disabled: $options.moveDisabled() + }, _objectSpread$c(_objectSpread$c({}, _ctx.buttonProps), _ctx.moveUpButtonProps), { + pt: _ctx.ptm("pcMoveUpButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "moveupicon", {}, function() { + return [createVNode(_component_AngleUpIcon, mergeProps(_ctx.ptm("pcMoveUpButton")["icon"], { + "data-pc-section": "moveupicon" + }), null, 16)]; + })]; + }), + _: 3 + }, 16, ["onClick", "aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ + onClick: $options.moveTop, + "aria-label": $options.moveTopAriaLabel, + disabled: $options.moveDisabled() + }, _objectSpread$c(_objectSpread$c({}, _ctx.buttonProps), _ctx.moveTopButtonProps), { + pt: _ctx.ptm("pcMoveTopButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "movetopicon", {}, function() { + return [createVNode(_component_AngleDoubleUpIcon, mergeProps(_ctx.ptm("pcMoveTopButton")["icon"], { + "data-pc-section": "movetopicon" + }), null, 16)]; + })]; + }), + _: 3 + }, 16, ["onClick", "aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ + onClick: $options.moveDown, + "aria-label": $options.moveDownAriaLabel, + disabled: $options.moveDisabled() + }, _objectSpread$c(_objectSpread$c({}, _ctx.buttonProps), _ctx.moveDownButtonProps), { + pt: _ctx.ptm("pcMoveDownButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "movedownicon", {}, function() { + return [createVNode(_component_AngleDownIcon, mergeProps(_ctx.ptm("pcMoveDownButton")["icon"], { + "data-pc-section": "movedownicon" + }), null, 16)]; + })]; + }), + _: 3 + }, 16, ["onClick", "aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ + onClick: $options.moveBottom, + "aria-label": $options.moveBottomAriaLabel, + disabled: $options.moveDisabled() + }, _objectSpread$c(_objectSpread$c({}, _ctx.buttonProps), _ctx.moveBottomButtonProps), { + pt: _ctx.ptm("pcMoveBottomButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "movebottomicon", {}, function() { + return [createVNode(_component_AngleDoubleDownIcon, mergeProps(_ctx.ptm("pcMoveBottomButton")["icon"], { + "data-pc-section": "movebottomicon" + }), null, 16)]; + })]; + }), + _: 3 + }, 16, ["onClick", "aria-label", "disabled", "pt", "unstyled"]), renderSlot(_ctx.$slots, "controlsend")], 16), createVNode(_component_Listbox, { + ref: "listbox", + id: $data.id, + modelValue: $data.d_selection, + options: _ctx.modelValue, + multiple: "", + metaKeySelection: _ctx.metaKeySelection, + listStyle: _ctx.listStyle, + scrollHeight: _ctx.scrollHeight, + tabindex: _ctx.tabindex, + dataKey: _ctx.dataKey, + autoOptionFocus: _ctx.autoOptionFocus, + focusOnHover: _ctx.focusOnHover, + striped: _ctx.striped, + disabled: _ctx.disabled, + ariaLabel: _ctx.ariaLabel, + ariaLabelledby: _ctx.ariaLabelledby, + pt: _ctx.ptm("pcListbox"), + unstyled: _ctx.unstyled, + onFocus: $options.onListFocus, + onBlur: $options.onListBlur, + onChange: $options.onChangeSelection + }, createSlots({ + option: withCtx(function(_ref) { + var option4 = _ref.option, selected3 = _ref.selected, index = _ref.index; + return [renderSlot(_ctx.$slots, _ctx.$slots.option ? "option" : "item", { + item: option4, + option: option4, + selected: selected3, + index + })]; + }), + _: 2 + }, [_ctx.$slots.header ? { + name: "header", + fn: withCtx(function() { + return [renderSlot(_ctx.$slots, "header")]; + }), + key: "0" + } : void 0]), 1032, ["id", "modelValue", "options", "metaKeySelection", "listStyle", "scrollHeight", "tabindex", "dataKey", "autoOptionFocus", "focusOnHover", "striped", "disabled", "ariaLabel", "ariaLabelledby", "pt", "unstyled", "onFocus", "onBlur", "onChange"])], 16); +} +__name(render$o, "render$o"); +script$s.render = render$o; +var theme$e = /* @__PURE__ */ __name(function theme26(_ref) { + var dt = _ref.dt; + return "\n.p-organizationchart-table {\n border-spacing: 0;\n border-collapse: separate;\n margin: 0 auto;\n}\n\n.p-organizationchart-table > tbody > tr > td {\n text-align: center;\n vertical-align: top;\n padding: 0 ".concat(dt("organizationchart.gutter"), ";\n}\n\n.p-organizationchart-node {\n display: inline-block;\n position: relative;\n border: 1px solid ").concat(dt("organizationchart.node.border.color"), ";\n background: ").concat(dt("organizationchart.node.background"), ";\n color: ").concat(dt("organizationchart.node.color"), ";\n padding: ").concat(dt("organizationchart.node.padding"), ";\n border-radius: ").concat(dt("organizationchart.node.border.radius"), ";\n transition: background ").concat(dt("organizationchart.transition.duration"), ", border-color ").concat(dt("organizationchart.transition.duration"), ", color ").concat(dt("organizationchart.transition.duration"), ", box-shadow ").concat(dt("organizationchart.transition.duration"), ";\n}\n\n.p-organizationchart-node:has(.p-organizationchart-node-toggle-button) {\n padding: ").concat(dt("organizationchart.node.toggleable.padding"), ";\n}\n\n.p-organizationchart-node.p-organizationchart-node-selectable:not(.p-organizationchart-node-selected):hover {\n background: ").concat(dt("organizationchart.node.hover.background"), ";\n color: ").concat(dt("organizationchart.node.hover.color"), ";\n}\n\n.p-organizationchart-node-selected {\n background: ").concat(dt("organizationchart.node.selected.background"), ";\n color: ").concat(dt("organizationchart.node.selected.color"), ";\n}\n\n.p-organizationchart-node-toggle-button {\n position: absolute;\n inset-block-end: calc(-1 * calc(").concat(dt("organizationchart.node.toggle.button.size"), " / 2));\n margin-inline-start: calc(-1 * calc(").concat(dt("organizationchart.node.toggle.button.size"), " / 2));\n z-index: 2;\n inset-inline-start: 50%;\n user-select: none;\n cursor: pointer;\n width: ").concat(dt("organizationchart.node.toggle.button.size"), ";\n height: ").concat(dt("organizationchart.node.toggle.button.size"), ";\n text-decoration: none;\n background: ").concat(dt("organizationchart.node.toggle.button.background"), ";\n color: ").concat(dt("organizationchart.node.toggle.button.color"), ";\n border-radius: ").concat(dt("organizationchart.node.toggle.button.border.radius"), ";\n border: 1px solid ").concat(dt("organizationchart.node.toggle.button.border.color"), ";\n display: inline-flex;\n justify-content: center;\n align-items: center;\n outline-color: transparent;\n transition: background ").concat(dt("organizationchart.transition.duration"), ", color ").concat(dt("organizationchart.transition.duration"), ", border-color ").concat(dt("organizationchart.transition.duration"), ", outline-color ").concat(dt("organizationchart.transition.duration"), ", box-shadow ").concat(dt("organizationchart.transition.duration"), ";\n}\n\n.p-organizationchart-node-toggle-button:hover {\n background: ").concat(dt("organizationchart.node.toggle.button.hover.background"), ";\n color: ").concat(dt("organizationchart.node.toggle.button.hover.color"), ";\n}\n\n.p-organizationchart-node-toggle-button:focus-visible {\n box-shadow: ").concat(dt("breadcrumb.item.focus.ring.shadow"), ";\n outline: ").concat(dt("breadcrumb.item.focus.ring.width"), " ").concat(dt("breadcrumb.item.focus.ring.style"), " ").concat(dt("breadcrumb.item.focus.ring.color"), ";\n outline-offset: ").concat(dt("breadcrumb.item.focus.ring.offset"), ";\n}\n\n.p-organizationchart-node-toggle-button-icon {\n position: relative;\n inset-block-start: 1px;\n}\n\n.p-organizationchart-connector-down {\n margin: 0 auto;\n height: ").concat(dt("organizationchart.connector.height"), ";\n width: 1px;\n background: ").concat(dt("organizationchart.connector.color"), ";\n}\n\n.p-organizationchart-connector-right {\n border-radius: 0;\n}\n\n.p-organizationchart-connector-left {\n border-radius: 0;\n border-inline-end: 1px solid ").concat(dt("organizationchart.connector.color"), ";\n}\n\n.p-organizationchart-connector-top {\n border-block-start: 1px solid ").concat(dt("organizationchart.connector.color"), ";\n}\n\n.p-organizationchart-node-selectable {\n cursor: pointer;\n}\n\n.p-organizationchart-connectors :nth-child(1 of .p-organizationchart-connector-left) {\n border-inline-end: 0 none;\n}\n\n.p-organizationchart-connectors :nth-last-child(1 of .p-organizationchart-connector-left) {\n border-start-end-radius: ").concat(dt("organizationchart.connector.border.radius"), ";\n}\n\n.p-organizationchart-connectors :nth-child(1 of .p-organizationchart-connector-right) {\n border-inline-start: 1px solid ").concat(dt("organizationchart.connector.color"), ";\n border-start-start-radius: ").concat(dt("organizationchart.connector.border.radius"), ";\n}\n"); +}, "theme"); +var classes$f = { + root: "p-organizationchart p-component", + table: "p-organizationchart-table", + node: /* @__PURE__ */ __name(function node(_ref2) { + var instance = _ref2.instance; + return ["p-organizationchart-node", { + "p-organizationchart-node-selectable": instance.selectable, + "p-organizationchart-node-selected": instance.selected + }]; + }, "node"), + nodeToggleButton: "p-organizationchart-node-toggle-button", + nodeToggleButtonIcon: "p-organizationchart-node-toggle-button-icon", + connectors: "p-organizationchart-connectors", + connectorDown: "p-organizationchart-connector-down", + connectorLeft: /* @__PURE__ */ __name(function connectorLeft(_ref3) { + var index = _ref3.index; + return ["p-organizationchart-connector-left", { + "p-organizationchart-connector-top": !(index === 0) + }]; + }, "connectorLeft"), + connectorRight: /* @__PURE__ */ __name(function connectorRight(_ref4) { + var props = _ref4.props, index = _ref4.index; + return ["p-organizationchart-connector-right", { + "p-organizationchart-connector-top": !(index === props.node.children.length - 1) + }]; + }, "connectorRight"), + nodeChildren: "p-organizationchart-node-children" +}; +var OrganizationChartStyle = BaseStyle.extend({ + name: "organizationchart", + theme: theme$e, + classes: classes$f +}); +var script$2$2 = { + name: "BaseOrganizationChart", + "extends": script$1d, + props: { + value: { + type: null, + "default": null + }, + selectionKeys: { + type: null, + "default": null + }, + selectionMode: { + type: String, + "default": null + }, + collapsible: { + type: Boolean, + "default": false + }, + collapsedKeys: { + type: null, + "default": null + } + }, + style: OrganizationChartStyle, + provide: /* @__PURE__ */ __name(function provide36() { + return { + $pcOrganizationChart: this, + $parentInstance: this + }; + }, "provide") +}; +var script$1$f = { + name: "OrganizationChartNode", + hostName: "OrganizationChart", + "extends": script$1d, + emits: ["node-click", "node-toggle"], + props: { + node: { + type: null, + "default": null + }, + templates: { + type: null, + "default": null + }, + collapsible: { + type: Boolean, + "default": false + }, + collapsedKeys: { + type: null, + "default": null + }, + selectionKeys: { + type: null, + "default": null + }, + selectionMode: { + type: String, + "default": null + } + }, + methods: { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions6(key) { + return this.ptm(key, { + context: { + expanded: this.expanded, + selectable: this.selectable, + selected: this.selected, + toggleable: this.toggleable, + active: this.selected + } + }); + }, "getPTOptions"), + getNodeOptions: /* @__PURE__ */ __name(function getNodeOptions(lineTop, key) { + return this.ptm(key, { + context: { + lineTop + } + }); + }, "getNodeOptions"), + onNodeClick: /* @__PURE__ */ __name(function onNodeClick(event2) { + if (isAttributeEquals(event2.target, "data-pc-section", "nodetogglebutton") || isAttributeEquals(event2.target, "data-pc-section", "nodetogglebuttonicon")) { + return; + } + if (this.selectionMode) { + this.$emit("node-click", this.node); + } + }, "onNodeClick"), + onChildNodeClick: /* @__PURE__ */ __name(function onChildNodeClick(node2) { + this.$emit("node-click", node2); + }, "onChildNodeClick"), + toggleNode: /* @__PURE__ */ __name(function toggleNode() { + this.$emit("node-toggle", this.node); + }, "toggleNode"), + onChildNodeToggle: /* @__PURE__ */ __name(function onChildNodeToggle(node2) { + this.$emit("node-toggle", node2); + }, "onChildNodeToggle"), + onKeydown: /* @__PURE__ */ __name(function onKeydown4(event2) { + if (event2.code === "Enter" || event2.code === "NumpadEnter" || event2.code === "Space") { + this.toggleNode(); + event2.preventDefault(); + } + }, "onKeydown") + }, + computed: { + leaf: /* @__PURE__ */ __name(function leaf() { + return this.node.leaf === false ? false : !(this.node.children && this.node.children.length); + }, "leaf"), + colspan: /* @__PURE__ */ __name(function colspan() { + return this.node.children && this.node.children.length ? this.node.children.length * 2 : null; + }, "colspan"), + childStyle: /* @__PURE__ */ __name(function childStyle() { + return { + visibility: !this.leaf && this.expanded ? "inherit" : "hidden" + }; + }, "childStyle"), + expanded: /* @__PURE__ */ __name(function expanded() { + return this.collapsedKeys[this.node.key] === void 0; + }, "expanded"), + selectable: /* @__PURE__ */ __name(function selectable() { + return this.selectionMode && this.node.selectable !== false; + }, "selectable"), + selected: /* @__PURE__ */ __name(function selected() { + return this.selectable && this.selectionKeys && this.selectionKeys[this.node.key] === true; + }, "selected"), + toggleable: /* @__PURE__ */ __name(function toggleable() { + return this.collapsible && this.node.collapsible !== false && !this.leaf; + }, "toggleable") + }, + components: { + ChevronDownIcon: script$1k, + ChevronUpIcon: script$1j + } +}; +var _hoisted_1$e = ["colspan"]; +var _hoisted_2$a = ["colspan"]; +var _hoisted_3$7 = ["colspan"]; +function render$1$2(_ctx, _cache, $props, $setup, $data, $options) { + var _component_OrganizationChartNode = resolveComponent("OrganizationChartNode", true); + return openBlock(), createElementBlock("table", mergeProps({ + "class": _ctx.cx("table") + }, _ctx.ptm("table")), [createBaseVNode("tbody", normalizeProps(guardReactiveProps(_ctx.ptm("body"))), [$props.node ? (openBlock(), createElementBlock("tr", normalizeProps(mergeProps({ + key: 0 + }, _ctx.ptm("row"))), [createBaseVNode("td", mergeProps({ + colspan: $options.colspan + }, _ctx.ptm("cell")), [createBaseVNode("div", mergeProps({ + "class": [_ctx.cx("node"), $props.node.styleClass], + onClick: _cache[2] || (_cache[2] = function() { + return $options.onNodeClick && $options.onNodeClick.apply($options, arguments); + }) + }, $options.getPTOptions("node")), [(openBlock(), createBlock(resolveDynamicComponent($props.templates[$props.node.type] || $props.templates["default"]), { + node: $props.node + }, null, 8, ["node"])), $options.toggleable ? (openBlock(), createElementBlock("a", mergeProps({ + key: 0, + tabindex: "0", + "class": _ctx.cx("nodeToggleButton"), + onClick: _cache[0] || (_cache[0] = function() { + return $options.toggleNode && $options.toggleNode.apply($options, arguments); + }), + onKeydown: _cache[1] || (_cache[1] = function() { + return $options.onKeydown && $options.onKeydown.apply($options, arguments); + }) + }, $options.getPTOptions("nodeToggleButton")), [$props.templates.toggleicon || $props.templates.togglericon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.toggleicon || $props.templates.togglericon), mergeProps({ + key: 0, + expanded: $options.expanded, + "class": _ctx.cx("nodeToggleButtonIcon") + }, $options.getPTOptions("nodeToggleButtonIcon")), null, 16, ["expanded", "class"])) : (openBlock(), createBlock(resolveDynamicComponent($options.expanded ? "ChevronDownIcon" : "ChevronUpIcon"), mergeProps({ + key: 1, + "class": _ctx.cx("nodeToggleButtonIcon") + }, $options.getPTOptions("nodeToggleButtonIcon")), null, 16, ["class"]))], 16)) : createCommentVNode("", true)], 16)], 16, _hoisted_1$e)], 16)) : createCommentVNode("", true), createBaseVNode("tr", mergeProps({ + style: $options.childStyle, + "class": _ctx.cx("connectors") + }, _ctx.ptm("connectors")), [createBaseVNode("td", mergeProps({ + colspan: $options.colspan + }, _ctx.ptm("lineCell")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("connectorDown") + }, _ctx.ptm("connectorDown")), null, 16)], 16, _hoisted_2$a)], 16), createBaseVNode("tr", mergeProps({ + style: $options.childStyle, + "class": _ctx.cx("connectors") + }, _ctx.ptm("connectors")), [$props.node.children && $props.node.children.length === 1 ? (openBlock(), createElementBlock("td", mergeProps({ + key: 0, + colspan: $options.colspan + }, _ctx.ptm("lineCell")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("connectorDown") + }, _ctx.ptm("connectorDown")), null, 16)], 16, _hoisted_3$7)) : createCommentVNode("", true), $props.node.children && $props.node.children.length > 1 ? (openBlock(true), createElementBlock(Fragment, { + key: 1 + }, renderList($props.node.children, function(child, i) { + return openBlock(), createElementBlock(Fragment, { + key: child.key + }, [createBaseVNode("td", mergeProps({ + "class": _ctx.cx("connectorLeft", { + index: i + }), + ref_for: true + }, $options.getNodeOptions(!(i === 0), "connectorLeft")), " ", 16), createBaseVNode("td", mergeProps({ + "class": _ctx.cx("connectorRight", { + index: i + }), + ref_for: true + }, $options.getNodeOptions(!(i === $props.node.children.length - 1), "connectorRight")), " ", 16)], 64); + }), 128)) : createCommentVNode("", true)], 16), createBaseVNode("tr", mergeProps({ + style: $options.childStyle, + "class": _ctx.cx("nodeChildren") + }, _ctx.ptm("nodeChildren")), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.node.children, function(child) { + return openBlock(), createElementBlock("td", mergeProps({ + key: child.key, + colspan: "2", + ref_for: true + }, _ctx.ptm("nodeCell")), [createVNode(_component_OrganizationChartNode, { + node: child, + templates: $props.templates, + collapsedKeys: $props.collapsedKeys, + onNodeToggle: $options.onChildNodeToggle, + collapsible: $props.collapsible, + selectionMode: $props.selectionMode, + selectionKeys: $props.selectionKeys, + onNodeClick: $options.onChildNodeClick, + pt: _ctx.pt, + unstyled: _ctx.unstyled + }, null, 8, ["node", "templates", "collapsedKeys", "onNodeToggle", "collapsible", "selectionMode", "selectionKeys", "onNodeClick", "pt", "unstyled"])], 16); + }), 128))], 16)], 16)], 16); +} +__name(render$1$2, "render$1$2"); +script$1$f.render = render$1$2; +function _typeof$c(o) { + "@babel/helpers - typeof"; + return _typeof$c = "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$c(o); +} +__name(_typeof$c, "_typeof$c"); +function ownKeys$b(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$b, "ownKeys$b"); +function _objectSpread$b(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$b(Object(t2), true).forEach(function(r2) { + _defineProperty$c(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$b(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$b, "_objectSpread$b"); +function _defineProperty$c(e, r, t2) { + return (r = _toPropertyKey$c(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$c, "_defineProperty$c"); +function _toPropertyKey$c(t2) { + var i = _toPrimitive$c(t2, "string"); + return "symbol" == _typeof$c(i) ? i : i + ""; +} +__name(_toPropertyKey$c, "_toPropertyKey$c"); +function _toPrimitive$c(t2, r) { + if ("object" != _typeof$c(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$c(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$c, "_toPrimitive$c"); +var script$r = { + name: "OrganizationChart", + "extends": script$2$2, + inheritAttrs: false, + emits: ["node-unselect", "node-select", "update:selectionKeys", "node-expand", "node-collapse", "update:collapsedKeys"], + data: /* @__PURE__ */ __name(function data24() { + return { + d_collapsedKeys: this.collapsedKeys || {} + }; + }, "data"), + watch: { + collapsedKeys: /* @__PURE__ */ __name(function collapsedKeys(newValue) { + this.d_collapsedKeys = newValue; + }, "collapsedKeys") + }, + methods: { + onNodeClick: /* @__PURE__ */ __name(function onNodeClick2(node2) { + var key = node2.key; + if (this.selectionMode) { + var _selectionKeys = this.selectionKeys ? _objectSpread$b({}, this.selectionKeys) : {}; + if (_selectionKeys[key]) { + delete _selectionKeys[key]; + this.$emit("node-unselect", node2); + } else { + if (this.selectionMode === "single") { + _selectionKeys = {}; + } + _selectionKeys[key] = true; + this.$emit("node-select", node2); + } + this.$emit("update:selectionKeys", _selectionKeys); + } + }, "onNodeClick"), + onNodeToggle: /* @__PURE__ */ __name(function onNodeToggle(node2) { + var key = node2.key; + if (this.d_collapsedKeys[key]) { + delete this.d_collapsedKeys[key]; + this.$emit("node-expand", node2); + } else { + this.d_collapsedKeys[key] = true; + this.$emit("node-collapse", node2); + } + this.d_collapsedKeys = _objectSpread$b({}, this.d_collapsedKeys); + this.$emit("update:collapsedKeys", this.d_collapsedKeys); + }, "onNodeToggle") + }, + components: { + OrganizationChartNode: script$1$f + } +}; +function render$n(_ctx, _cache, $props, $setup, $data, $options) { + var _component_OrganizationChartNode = resolveComponent("OrganizationChartNode"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [createVNode(_component_OrganizationChartNode, { + node: _ctx.value, + templates: _ctx.$slots, + onNodeToggle: $options.onNodeToggle, + collapsedKeys: $data.d_collapsedKeys, + collapsible: _ctx.collapsible, + onNodeClick: $options.onNodeClick, + selectionMode: _ctx.selectionMode, + selectionKeys: _ctx.selectionKeys, + pt: _ctx.pt, + unstyled: _ctx.unstyled + }, null, 8, ["node", "templates", "onNodeToggle", "collapsedKeys", "collapsible", "onNodeClick", "selectionMode", "selectionKeys", "pt", "unstyled"])], 16); +} +__name(render$n, "render$n"); +script$r.render = render$n; +var script$q = { + name: "OverlayPanel", + "extends": script$1Q, + mounted: /* @__PURE__ */ __name(function mounted25() { + console.warn("Deprecated since v4. Use Popover component instead."); + }, "mounted") +}; +var OverlayPanelStyle = BaseStyle.extend({ + name: "overlaypanel" +}); +var theme$d = /* @__PURE__ */ __name(function theme27(_ref) { + var dt = _ref.dt; + return "\n.p-panelmenu {\n display: flex;\n flex-direction: column;\n gap: ".concat(dt("panelmenu.gap"), ";\n}\n\n.p-panelmenu-panel {\n background: ").concat(dt("panelmenu.panel.background"), ";\n border-width: ").concat(dt("panelmenu.panel.border.width"), ";\n border-style: solid;\n border-color: ").concat(dt("panelmenu.panel.border.color"), ";\n color: ").concat(dt("panelmenu.panel.color"), ";\n border-radius: ").concat(dt("panelmenu.panel.border.radius"), ";\n padding: ").concat(dt("panelmenu.panel.padding"), ";\n}\n\n.p-panelmenu-panel:first-child {\n border-width: ").concat(dt("panelmenu.panel.first.border.width"), ";\n border-start-start-radius: ").concat(dt("panelmenu.panel.first.top.border.radius"), ";\n border-start-end-radius: ").concat(dt("panelmenu.panel.first.top.border.radius"), ";\n}\n\n.p-panelmenu-panel:last-child {\n border-width: ").concat(dt("panelmenu.panel.last.border.width"), ";\n border-end-start-radius: ").concat(dt("panelmenu.panel.last.bottom.border.radius"), ";\n border-end-end-radius: ").concat(dt("panelmenu.panel.last.bottom.border.radius"), ";\n}\n\n.p-panelmenu-header {\n outline: 0 none;\n}\n\n.p-panelmenu-header-content {\n border-radius: ").concat(dt("panelmenu.item.border.radius"), ";\n transition: background ").concat(dt("panelmenu.transition.duration"), ", color ").concat(dt("panelmenu.transition.duration"), ", outline-color ").concat(dt("panelmenu.transition.duration"), ", box-shadow ").concat(dt("panelmenu.transition.duration"), ";\n outline-color: transparent;\n color: ").concat(dt("panelmenu.item.color"), ";\n}\n\n.p-panelmenu-header-link {\n display: flex;\n gap: ").concat(dt("panelmenu.item.gap"), ";\n padding: ").concat(dt("panelmenu.item.padding"), ";\n align-items: center;\n user-select: none;\n cursor: pointer;\n position: relative;\n text-decoration: none;\n color: inherit;\n}\n\n.p-panelmenu-header-icon,\n.p-panelmenu-item-icon {\n color: ").concat(dt("panelmenu.item.icon.color"), ";\n}\n\n.p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.color"), ";\n}\n\n.p-panelmenu-submenu-icon:dir(rtl) {\n transform: rotate(180deg);\n}\n\n.p-panelmenu-header:not(.p-disabled):focus-visible .p-panelmenu-header-content {\n background: ").concat(dt("panelmenu.item.focus.background"), ";\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled):focus-visible .p-panelmenu-header-content .p-panelmenu-header-icon {\n color: ").concat(dt("panelmenu.item.icon.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled):focus-visible .p-panelmenu-header-content .p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled) .p-panelmenu-header-content:hover {\n background: ").concat(dt("panelmenu.item.focus.background"), ";\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled) .p-panelmenu-header-content:hover .p-panelmenu-header-icon {\n color: ").concat(dt("panelmenu.item.icon.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled) .p-panelmenu-header-content:hover .p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.focus.color"), ";\n}\n\n.p-panelmenu-submenu {\n margin: 0;\n padding: 0 0 0 ").concat(dt("panelmenu.submenu.indent"), ";\n outline: 0;\n list-style: none;\n}\n\n.p-panelmenu-submenu:dir(rtl) {\n padding: 0 ").concat(dt("panelmenu.submenu.indent"), " 0 0;\n}\n\n.p-panelmenu-item-link {\n display: flex;\n gap: ").concat(dt("panelmenu.item.gap"), ";\n padding: ").concat(dt("panelmenu.item.padding"), ";\n align-items: center;\n user-select: none;\n cursor: pointer;\n text-decoration: none;\n color: inherit;\n position: relative;\n overflow: hidden;\n}\n\n.p-panelmenu-item-label {\n line-height: 1;\n}\n\n.p-panelmenu-item-content {\n border-radius: ").concat(dt("panelmenu.item.border.radius"), ";\n transition: background ").concat(dt("panelmenu.transition.duration"), ", color ").concat(dt("panelmenu.transition.duration"), ", outline-color ").concat(dt("panelmenu.transition.duration"), ", box-shadow ").concat(dt("panelmenu.transition.duration"), ";\n color: ").concat(dt("panelmenu.item.color"), ";\n outline-color: transparent;\n}\n\n.p-panelmenu-item.p-focus > .p-panelmenu-item-content {\n background: ").concat(dt("panelmenu.item.focus.background"), ";\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-item.p-focus > .p-panelmenu-item-content .p-panelmenu-item-icon {\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-item.p-focus > .p-panelmenu-item-content .p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.focus.color"), ";\n}\n\n.p-panelmenu-item:not(.p-disabled) > .p-panelmenu-item-content:hover {\n background: ").concat(dt("panelmenu.item.focus.background"), ";\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-item:not(.p-disabled) > .p-panelmenu-item-content:hover .p-panelmenu-item-icon {\n color: ").concat(dt("panelmenu.item.icon.focus.color"), ";\n}\n\n.p-panelmenu-item:not(.p-disabled) > .p-panelmenu-item-content:hover .p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.focus.color"), ";\n}\n"); +}, "theme"); +var classes$e = { + root: "p-panelmenu p-component", + panel: "p-panelmenu-panel", + header: /* @__PURE__ */ __name(function header(_ref2) { + var instance = _ref2.instance, item8 = _ref2.item; + return ["p-panelmenu-header", { + "p-panelmenu-header-active": instance.isItemActive(item8) && !!item8.items, + "p-disabled": instance.isItemDisabled(item8) + }]; + }, "header"), + headerContent: "p-panelmenu-header-content", + headerLink: "p-panelmenu-header-link", + headerIcon: "p-panelmenu-header-icon", + headerLabel: "p-panelmenu-header-label", + contentContainer: "p-panelmenu-content-container", + content: "p-panelmenu-content", + rootList: "p-panelmenu-root-list", + item: /* @__PURE__ */ __name(function item5(_ref3) { + var instance = _ref3.instance, processedItem = _ref3.processedItem; + return ["p-panelmenu-item", { + "p-focus": instance.isItemFocused(processedItem), + "p-disabled": instance.isItemDisabled(processedItem) + }]; + }, "item"), + itemContent: "p-panelmenu-item-content", + itemLink: "p-panelmenu-item-link", + itemIcon: "p-panelmenu-item-icon", + itemLabel: "p-panelmenu-item-label", + submenuIcon: "p-panelmenu-submenu-icon", + submenu: "p-panelmenu-submenu", + separator: "p-menuitem-separator" +}; +var PanelMenuStyle = BaseStyle.extend({ + name: "panelmenu", + theme: theme$d, + classes: classes$e +}); +var script$3$1 = { + name: "BasePanelMenu", + "extends": script$1d, + props: { + model: { + type: Array, + "default": null + }, + expandedKeys: { + type: Object, + "default": null + }, + multiple: { + type: Boolean, + "default": false + }, + tabindex: { + type: Number, + "default": 0 + } + }, + style: PanelMenuStyle, + provide: /* @__PURE__ */ __name(function provide37() { + return { + $pcPanelMenu: this, + $parentInstance: this + }; + }, "provide") +}; +var script$2$1 = { + name: "PanelMenuSub", + hostName: "PanelMenu", + "extends": script$1d, + emits: ["item-toggle", "item-mousemove"], + props: { + panelId: { + type: String, + "default": null + }, + focusedItemId: { + type: String, + "default": null + }, + items: { + type: Array, + "default": null + }, + level: { + type: Number, + "default": 0 + }, + templates: { + type: Object, + "default": null + }, + activeItemPath: { + type: Object, + "default": null + }, + tabindex: { + type: Number, + "default": -1 + } + }, + methods: { + getItemId: /* @__PURE__ */ __name(function getItemId3(processedItem) { + return "".concat(this.panelId, "_").concat(processedItem.key); + }, "getItemId"), + getItemKey: /* @__PURE__ */ __name(function getItemKey2(processedItem) { + return this.getItemId(processedItem); + }, "getItemKey"), + getItemProp: /* @__PURE__ */ __name(function getItemProp5(processedItem, name4, params) { + return processedItem && processedItem.item ? resolve(processedItem.item[name4], params) : void 0; + }, "getItemProp"), + getItemLabel: /* @__PURE__ */ __name(function getItemLabel3(processedItem) { + return this.getItemProp(processedItem, "label"); + }, "getItemLabel"), + getPTOptions: /* @__PURE__ */ __name(function getPTOptions7(key, processedItem, index) { + return this.ptm(key, { + context: { + item: processedItem.item, + index, + active: this.isItemActive(processedItem), + focused: this.isItemFocused(processedItem), + disabled: this.isItemDisabled(processedItem) + } + }); + }, "getPTOptions"), + isItemActive: /* @__PURE__ */ __name(function isItemActive4(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 isItemFocused3(processedItem) { + return this.focusedItemId === this.getItemId(processedItem); + }, "isItemFocused"), + isItemGroup: /* @__PURE__ */ __name(function isItemGroup3(processedItem) { + return isNotEmpty(processedItem.items); + }, "isItemGroup"), + onItemClick: /* @__PURE__ */ __name(function onItemClick5(event2, processedItem) { + this.getItemProp(processedItem, "command", { + originalEvent: event2, + item: processedItem.item + }); + this.$emit("item-toggle", { + processedItem, + expanded: !this.isItemActive(processedItem) + }); + }, "onItemClick"), + onItemToggle: /* @__PURE__ */ __name(function onItemToggle(event2) { + this.$emit("item-toggle", event2); + }, "onItemToggle"), + onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove2(event2, processedItem) { + this.$emit("item-mousemove", { + originalEvent: event2, + processedItem + }); + }, "onItemMouseMove"), + getAriaSetSize: /* @__PURE__ */ __name(function getAriaSetSize2() { + 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) { + 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 getMenuItemProps5(processedItem, index) { + return { + action: mergeProps({ + "class": this.cx("itemLink"), + tabindex: -1 + }, this.getPTOptions("itemLink", processedItem, index)), + icon: mergeProps({ + "class": [this.cx("itemIcon"), this.getItemProp(processedItem, "icon")] + }, this.getPTOptions("itemIcon", processedItem, index)), + label: mergeProps({ + "class": this.cx("itemLabel") + }, this.getPTOptions("itemLabel", processedItem, index)), + submenuicon: mergeProps({ + "class": this.cx("submenuIcon") + }, this.getPTOptions("submenuicon", processedItem, index)) + }; + }, "getMenuItemProps") + }, + components: { + ChevronRightIcon: script$1l, + ChevronDownIcon: script$1k + }, + directives: { + ripple: Ripple + } +}; +var _hoisted_1$1$2 = ["tabindex"]; +var _hoisted_2$1$1 = ["id", "aria-label", "aria-expanded", "aria-level", "aria-setsize", "aria-posinset", "data-p-focused", "data-p-disabled"]; +var _hoisted_3$1$1 = ["onClick", "onMousemove"]; +var _hoisted_4$1$1 = ["href", "target"]; +function render$2$1(_ctx, _cache, $props, $setup, $data, $options) { + var _component_PanelMenuSub = resolveComponent("PanelMenuSub", true); + var _directive_ripple = resolveDirective("ripple"); + return openBlock(), createElementBlock("ul", { + "class": normalizeClass(_ctx.cx("submenu")), + tabindex: $props.tabindex + }, [(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), + "class": [_ctx.cx("item", { + processedItem + }), $options.getItemProp(processedItem, "class")], + style: $options.getItemProp(processedItem, "style"), + role: "treeitem", + "aria-label": $options.getItemLabel(processedItem), + "aria-expanded": $options.isItemGroup(processedItem) ? $options.isItemActive(processedItem) : void 0, + "aria-level": $props.level + 1, + "aria-setsize": $options.getAriaSetSize(), + "aria-posinset": $options.getAriaPosInset(index), + ref_for: true + }, $options.getPTOptions("item", processedItem, index), { + "data-p-focused": $options.isItemFocused(processedItem), + "data-p-disabled": $options.isItemDisabled(processedItem) + }), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("itemContent"), + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return $options.onItemClick($event, processedItem); + }, "onClick"), + onMousemove: /* @__PURE__ */ __name(function onMousemove($event) { + return $options.onItemMouseMove($event, processedItem); + }, "onMousemove"), + ref_for: true + }, $options.getPTOptions("itemContent", processedItem, index)), [!$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("itemLink", processedItem, index)), [$options.isItemGroup(processedItem) ? (openBlock(), createElementBlock(Fragment, { + key: 0 + }, [$props.templates.submenuicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.submenuicon), mergeProps({ + key: 0, + "class": _ctx.cx("submenuIcon"), + active: $options.isItemActive(processedItem), + ref_for: true + }, $options.getPTOptions("submenuIcon", processedItem, index)), null, 16, ["class", "active"])) : (openBlock(), createBlock(resolveDynamicComponent($options.isItemActive(processedItem) ? "ChevronDownIcon" : "ChevronRightIcon"), mergeProps({ + key: 1, + "class": _ctx.cx("submenuIcon"), + ref_for: true + }, $options.getPTOptions("submenuIcon", processedItem, index)), null, 16, ["class"]))], 64)) : createCommentVNode("", true), $props.templates.itemicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.itemicon), { + key: 1, + item: processedItem.item, + "class": normalizeClass(_ctx.cx("itemIcon")) + }, null, 8, ["item", "class"])) : $options.getItemProp(processedItem, "icon") ? (openBlock(), createElementBlock("span", mergeProps({ + key: 2, + "class": [_ctx.cx("itemIcon"), $options.getItemProp(processedItem, "icon")], + ref_for: true + }, $options.getPTOptions("itemIcon", processedItem, index)), null, 16)) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ + "class": _ctx.cx("itemLabel"), + ref_for: true + }, $options.getPTOptions("itemLabel", processedItem, index)), toDisplayString($options.getItemLabel(processedItem)), 17)], 16, _hoisted_4$1$1)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { + key: 1, + item: processedItem.item, + root: false, + active: $options.isItemActive(processedItem), + hasSubmenu: $options.isItemGroup(processedItem), + label: $options.getItemLabel(processedItem), + props: $options.getMenuItemProps(processedItem, index) + }, null, 8, ["item", "active", "hasSubmenu", "label", "props"]))], 16, _hoisted_3$1$1), createVNode(Transition, mergeProps({ + name: "p-toggleable-content", + ref_for: true + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [withDirectives(createBaseVNode("div", mergeProps({ + "class": _ctx.cx("contentContainer"), + ref_for: true + }, _ctx.ptm("contentContainer")), [$options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_PanelMenuSub, mergeProps({ + key: 0, + id: $options.getItemId(processedItem) + "_list", + role: "group", + panelId: $props.panelId, + focusedItemId: $props.focusedItemId, + items: processedItem.items, + level: $props.level + 1, + templates: $props.templates, + activeItemPath: $props.activeItemPath, + onItemToggle: $options.onItemToggle, + onItemMousemove: _cache[0] || (_cache[0] = function($event) { + return _ctx.$emit("item-mousemove", $event); + }), + pt: _ctx.pt, + unstyled: _ctx.unstyled, + ref_for: true + }, _ctx.ptm("submenu")), null, 16, ["id", "panelId", "focusedItemId", "items", "level", "templates", "activeItemPath", "onItemToggle", "pt", "unstyled"])) : createCommentVNode("", true)], 16), [[vShow, $options.isItemActive(processedItem)]])]; + }), + _: 2 + }, 1040)], 16, _hoisted_2$1$1)) : createCommentVNode("", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ + key: 1, + style: $options.getItemProp(processedItem, "style"), + "class": [_ctx.cx("separator"), $options.getItemProp(processedItem, "class")], + role: "separator", + ref_for: true + }, _ctx.ptm("separator")), null, 16)) : createCommentVNode("", true)], 64); + }), 128))], 10, _hoisted_1$1$2); +} +__name(render$2$1, "render$2$1"); +script$2$1.render = render$2$1; +function _slicedToArray(r, e) { + return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$5(r, e) || _nonIterableRest(); +} +__name(_slicedToArray, "_slicedToArray"); +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableRest, "_nonIterableRest"); +function _unsupportedIterableToArray$5(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$5(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$5(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$5, "_unsupportedIterableToArray$5"); +function _arrayLikeToArray$5(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; +} +__name(_arrayLikeToArray$5, "_arrayLikeToArray$5"); +function _iterableToArrayLimit(r, l) { + var t2 = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (null != t2) { + var e, n, i, u, a = [], f = true, o = false; + try { + if (i = (t2 = t2.call(r)).next, 0 === l) ; + else for (; !(f = (e = i.call(t2)).done) && (a.push(e.value), a.length !== l); f = true) ; + } catch (r2) { + o = true, n = r2; + } finally { + try { + if (!f && null != t2["return"] && (u = t2["return"](), Object(u) !== u)) return; + } finally { + if (o) throw n; + } + } + return a; + } +} +__name(_iterableToArrayLimit, "_iterableToArrayLimit"); +function _arrayWithHoles(r) { + if (Array.isArray(r)) return r; +} +__name(_arrayWithHoles, "_arrayWithHoles"); +var script$1$e = { + name: "PanelMenuList", + hostName: "PanelMenu", + "extends": script$1d, + emits: ["item-toggle", "header-focus"], + props: { + panelId: { + type: String, + "default": null + }, + items: { + type: Array, + "default": null + }, + templates: { + type: Object, + "default": null + }, + expandedKeys: { + type: Object, + "default": null + } + }, + searchTimeout: null, + searchValue: null, + data: /* @__PURE__ */ __name(function data25() { + return { + focused: false, + focusedItem: null, + activeItemPath: [] + }; + }, "data"), + watch: { + expandedKeys: /* @__PURE__ */ __name(function expandedKeys(newValue) { + this.autoUpdateActiveItemPath(newValue); + }, "expandedKeys") + }, + mounted: /* @__PURE__ */ __name(function mounted26() { + this.autoUpdateActiveItemPath(this.expandedKeys); + }, "mounted"), + methods: { + getItemProp: /* @__PURE__ */ __name(function getItemProp6(processedItem, name4) { + return processedItem && processedItem.item ? resolve(processedItem.item[name4]) : void 0; + }, "getItemProp"), + getItemLabel: /* @__PURE__ */ __name(function getItemLabel4(processedItem) { + return this.getItemProp(processedItem, "label"); + }, "getItemLabel"), + isItemVisible: /* @__PURE__ */ __name(function isItemVisible4(processedItem) { + return this.getItemProp(processedItem, "visible") !== false; + }, "isItemVisible"), + isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled4(processedItem) { + return this.getItemProp(processedItem, "disabled"); + }, "isItemDisabled"), + isItemActive: /* @__PURE__ */ __name(function isItemActive5(processedItem) { + return this.activeItemPath.some(function(path) { + return path.key === processedItem.parentKey; + }); + }, "isItemActive"), + isItemGroup: /* @__PURE__ */ __name(function isItemGroup4(processedItem) { + return isNotEmpty(processedItem.items); + }, "isItemGroup"), + onFocus: /* @__PURE__ */ __name(function onFocus10(event2) { + this.focused = true; + this.focusedItem = this.focusedItem || (this.isElementInPanel(event2, event2.relatedTarget) ? this.findFirstItem() : this.findLastItem()); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur10() { + this.focused = false; + this.focusedItem = null; + this.searchValue = ""; + }, "onBlur"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown10(event2) { + var metaKey = event2.metaKey || event2.ctrlKey; + switch (event2.code) { + case "ArrowDown": + this.onArrowDownKey(event2); + break; + case "ArrowUp": + this.onArrowUpKey(event2); + break; + case "ArrowLeft": + this.onArrowLeftKey(event2); + break; + case "ArrowRight": + this.onArrowRightKey(event2); + break; + case "Home": + this.onHomeKey(event2); + break; + case "End": + this.onEndKey(event2); + break; + case "Space": + this.onSpaceKey(event2); + break; + case "Enter": + case "NumpadEnter": + this.onEnterKey(event2); + break; + case "Escape": + case "Tab": + case "PageDown": + case "PageUp": + case "Backspace": + case "ShiftLeft": + case "ShiftRight": + break; + default: + if (!metaKey && isPrintableCharacter(event2.key)) { + this.searchItems(event2, event2.key); + } + break; + } + }, "onKeyDown"), + onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey7(event2) { + var processedItem = isNotEmpty(this.focusedItem) ? this.findNextItem(this.focusedItem) : this.findFirstItem(); + this.changeFocusedItem({ + originalEvent: event2, + processedItem, + focusOnNext: true + }); + event2.preventDefault(); + }, "onArrowDownKey"), + onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey7(event2) { + var processedItem = isNotEmpty(this.focusedItem) ? this.findPrevItem(this.focusedItem) : this.findLastItem(); + this.changeFocusedItem({ + originalEvent: event2, + processedItem, + selfCheck: true + }); + event2.preventDefault(); + }, "onArrowUpKey"), + onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey4(event2) { + var _this = this; + if (isNotEmpty(this.focusedItem)) { + var matched = this.activeItemPath.some(function(p) { + return p.key === _this.focusedItem.key; + }); + if (matched) { + this.activeItemPath = this.activeItemPath.filter(function(p) { + return p.key !== _this.focusedItem.key; + }); + } else { + this.focusedItem = isNotEmpty(this.focusedItem.parent) ? this.focusedItem.parent : this.focusedItem; + } + event2.preventDefault(); + } + }, "onArrowLeftKey"), + onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey3(event2) { + var _this2 = this; + if (isNotEmpty(this.focusedItem)) { + var grouped = this.isItemGroup(this.focusedItem); + if (grouped) { + var matched = this.activeItemPath.some(function(p) { + return p.key === _this2.focusedItem.key; + }); + if (matched) { + this.onArrowDownKey(event2); + } else { + this.activeItemPath = this.activeItemPath.filter(function(p) { + return p.parentKey !== _this2.focusedItem.parentKey; + }); + this.activeItemPath.push(this.focusedItem); + } + } + event2.preventDefault(); + } + }, "onArrowRightKey"), + onHomeKey: /* @__PURE__ */ __name(function onHomeKey7(event2) { + this.changeFocusedItem({ + originalEvent: event2, + processedItem: this.findFirstItem(), + allowHeaderFocus: false + }); + event2.preventDefault(); + }, "onHomeKey"), + onEndKey: /* @__PURE__ */ __name(function onEndKey7(event2) { + this.changeFocusedItem({ + originalEvent: event2, + processedItem: this.findLastItem(), + focusOnNext: true, + allowHeaderFocus: false + }); + event2.preventDefault(); + }, "onEndKey"), + onEnterKey: /* @__PURE__ */ __name(function onEnterKey6(event2) { + if (isNotEmpty(this.focusedItem)) { + var element = findSingle(this.$el, 'li[id="'.concat("".concat(this.focusedItemId), '"]')); + var anchorElement = element && (findSingle(element, '[data-pc-section="itemlink"]') || findSingle(element, "a,button")); + anchorElement ? anchorElement.click() : element && element.click(); + } + event2.preventDefault(); + }, "onEnterKey"), + onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey5(event2) { + this.onEnterKey(event2); + }, "onSpaceKey"), + onItemToggle: /* @__PURE__ */ __name(function onItemToggle2(event2) { + var processedItem = event2.processedItem, expanded3 = event2.expanded; + if (this.expandedKeys) { + this.$emit("item-toggle", { + item: processedItem.item, + expanded: expanded3 + }); + } else { + this.activeItemPath = this.activeItemPath.filter(function(p) { + return p.parentKey !== processedItem.parentKey; + }); + expanded3 && this.activeItemPath.push(processedItem); + } + this.focusedItem = processedItem; + focus(this.$el); + }, "onItemToggle"), + onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove3(event2) { + if (this.focused) { + this.focusedItem = event2.processedItem; + } + }, "onItemMouseMove"), + isElementInPanel: /* @__PURE__ */ __name(function isElementInPanel(event2, element) { + var panel2 = event2.currentTarget.closest('[data-pc-section="panel"]'); + return panel2 && panel2.contains(element); + }, "isElementInPanel"), + isItemMatched: /* @__PURE__ */ __name(function isItemMatched2(processedItem) { + var _this$getItemLabel; + return this.isValidItem(processedItem) && ((_this$getItemLabel = this.getItemLabel(processedItem)) === null || _this$getItemLabel === void 0 ? void 0 : _this$getItemLabel.toLocaleLowerCase(this.searchLocale).startsWith(this.searchValue.toLocaleLowerCase(this.searchLocale))); + }, "isItemMatched"), + isVisibleItem: /* @__PURE__ */ __name(function isVisibleItem(processedItem) { + return !!processedItem && (processedItem.level === 0 || this.isItemActive(processedItem)) && this.isItemVisible(processedItem); + }, "isVisibleItem"), + isValidItem: /* @__PURE__ */ __name(function isValidItem2(processedItem) { + return !!processedItem && !this.isItemDisabled(processedItem) && !this.getItemProp(processedItem, "separator"); + }, "isValidItem"), + findFirstItem: /* @__PURE__ */ __name(function findFirstItem() { + var _this3 = this; + return this.visibleItems.find(function(processedItem) { + return _this3.isValidItem(processedItem); + }); + }, "findFirstItem"), + findLastItem: /* @__PURE__ */ __name(function findLastItem() { + var _this4 = this; + return findLast(this.visibleItems, function(processedItem) { + return _this4.isValidItem(processedItem); + }); + }, "findLastItem"), + findNextItem: /* @__PURE__ */ __name(function findNextItem(processedItem) { + var _this5 = this; + var index = this.visibleItems.findIndex(function(item8) { + return item8.key === processedItem.key; + }); + var matchedItem = index < this.visibleItems.length - 1 ? this.visibleItems.slice(index + 1).find(function(pItem) { + return _this5.isValidItem(pItem); + }) : void 0; + return matchedItem || processedItem; + }, "findNextItem"), + findPrevItem: /* @__PURE__ */ __name(function findPrevItem(processedItem) { + var _this6 = this; + var index = this.visibleItems.findIndex(function(item8) { + return item8.key === processedItem.key; + }); + var matchedItem = index > 0 ? findLast(this.visibleItems.slice(0, index), function(pItem) { + return _this6.isValidItem(pItem); + }) : void 0; + return matchedItem || processedItem; + }, "findPrevItem"), + searchItems: /* @__PURE__ */ __name(function searchItems2(event2, _char) { + var _this7 = this; + this.searchValue = (this.searchValue || "") + _char; + var matchedItem = null; + var matched = false; + if (isNotEmpty(this.focusedItem)) { + var focusedItemIndex = this.visibleItems.findIndex(function(processedItem) { + return processedItem.key === _this7.focusedItem.key; + }); + matchedItem = this.visibleItems.slice(focusedItemIndex).find(function(processedItem) { + return _this7.isItemMatched(processedItem); + }); + matchedItem = isEmpty(matchedItem) ? this.visibleItems.slice(0, focusedItemIndex).find(function(processedItem) { + return _this7.isItemMatched(processedItem); + }) : matchedItem; + } else { + matchedItem = this.visibleItems.find(function(processedItem) { + return _this7.isItemMatched(processedItem); + }); + } + if (isNotEmpty(matchedItem)) { + matched = true; + } + if (isEmpty(matchedItem) && isEmpty(this.focusedItem)) { + matchedItem = this.findFirstItem(); + } + if (isNotEmpty(matchedItem)) { + this.changeFocusedItem({ + originalEvent: event2, + processedItem: matchedItem, + allowHeaderFocus: false + }); + } + if (this.searchTimeout) { + clearTimeout(this.searchTimeout); + } + this.searchTimeout = setTimeout(function() { + _this7.searchValue = ""; + _this7.searchTimeout = null; + }, 500); + return matched; + }, "searchItems"), + changeFocusedItem: /* @__PURE__ */ __name(function changeFocusedItem(event2) { + var originalEvent = event2.originalEvent, processedItem = event2.processedItem, focusOnNext = event2.focusOnNext, selfCheck = event2.selfCheck, _event$allowHeaderFoc = event2.allowHeaderFocus, allowHeaderFocus = _event$allowHeaderFoc === void 0 ? true : _event$allowHeaderFoc; + if (isNotEmpty(this.focusedItem) && this.focusedItem.key !== processedItem.key) { + this.focusedItem = processedItem; + this.scrollInView(); + } else if (allowHeaderFocus) { + this.$emit("header-focus", { + originalEvent, + focusOnNext, + selfCheck + }); + } + }, "changeFocusedItem"), + scrollInView: /* @__PURE__ */ __name(function scrollInView5() { + var element = findSingle(this.$el, 'li[id="'.concat("".concat(this.focusedItemId), '"]')); + if (element) { + element.scrollIntoView && element.scrollIntoView({ + block: "nearest", + inline: "start" + }); + } + }, "scrollInView"), + autoUpdateActiveItemPath: /* @__PURE__ */ __name(function autoUpdateActiveItemPath(expandedKeys4) { + var _this8 = this; + this.activeItemPath = Object.entries(expandedKeys4 || {}).reduce(function(acc, _ref) { + var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], val = _ref2[1]; + if (val) { + var processedItem = _this8.findProcessedItemByItemKey(key); + processedItem && acc.push(processedItem); + } + return acc; + }, []); + }, "autoUpdateActiveItemPath"), + findProcessedItemByItemKey: /* @__PURE__ */ __name(function findProcessedItemByItemKey(key, processedItems3) { + var level = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; + processedItems3 = processedItems3 || level === 0 && this.processedItems; + if (!processedItems3) return null; + for (var i = 0; i < processedItems3.length; i++) { + var processedItem = processedItems3[i]; + if (this.getItemProp(processedItem, "key") === key) return processedItem; + var matchedItem = this.findProcessedItemByItemKey(key, processedItem.items, level + 1); + if (matchedItem) return matchedItem; + } + }, "findProcessedItemByItemKey"), + createProcessedItems: /* @__PURE__ */ __name(function createProcessedItems2(items2) { + var _this9 = 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 = []; + items2 && items2.forEach(function(item8, index) { + var key = (parentKey !== "" ? parentKey + "_" : "") + index; + var newItem = { + item: item8, + index, + level, + key, + parent, + parentKey + }; + newItem["items"] = _this9.createProcessedItems(item8.items, level + 1, newItem, key); + processedItems3.push(newItem); + }); + return processedItems3; + }, "createProcessedItems"), + flatItems: /* @__PURE__ */ __name(function flatItems(processedItems3) { + var _this10 = this; + var processedFlattenItems = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; + processedItems3 && processedItems3.forEach(function(processedItem) { + if (_this10.isVisibleItem(processedItem)) { + processedFlattenItems.push(processedItem); + _this10.flatItems(processedItem.items, processedFlattenItems); + } + }); + return processedFlattenItems; + }, "flatItems") + }, + computed: { + processedItems: /* @__PURE__ */ __name(function processedItems2() { + return this.createProcessedItems(this.items || []); + }, "processedItems"), + visibleItems: /* @__PURE__ */ __name(function visibleItems2() { + return this.flatItems(this.processedItems); + }, "visibleItems"), + focusedItemId: /* @__PURE__ */ __name(function focusedItemId2() { + return isNotEmpty(this.focusedItem) ? "".concat(this.panelId, "_").concat(this.focusedItem.key) : null; + }, "focusedItemId") + }, + components: { + PanelMenuSub: script$2$1 + } +}; +function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { + var _component_PanelMenuSub = resolveComponent("PanelMenuSub"); + return openBlock(), createBlock(_component_PanelMenuSub, mergeProps({ + id: $props.panelId + "_list", + "class": _ctx.cx("rootList"), + role: "tree", + tabindex: -1, + "aria-activedescendant": $data.focused ? $options.focusedItemId : void 0, + panelId: $props.panelId, + focusedItemId: $data.focused ? $options.focusedItemId : void 0, + items: $options.processedItems, + templates: $props.templates, + activeItemPath: $data.activeItemPath, + onFocus: $options.onFocus, + onBlur: $options.onBlur, + onKeydown: $options.onKeyDown, + onItemToggle: $options.onItemToggle, + onItemMousemove: $options.onItemMouseMove, + pt: _ctx.pt, + unstyled: _ctx.unstyled + }, _ctx.ptm("rootList")), null, 16, ["id", "class", "aria-activedescendant", "panelId", "focusedItemId", "items", "templates", "activeItemPath", "onFocus", "onBlur", "onKeydown", "onItemToggle", "onItemMousemove", "pt", "unstyled"]); +} +__name(render$1$1, "render$1$1"); +script$1$e.render = render$1$1; +function _typeof$b(o) { + "@babel/helpers - typeof"; + return _typeof$b = "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$b(o); +} +__name(_typeof$b, "_typeof$b"); +function ownKeys$a(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$a, "ownKeys$a"); +function _objectSpread$a(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$a(Object(t2), true).forEach(function(r2) { + _defineProperty$b(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$a(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$a, "_objectSpread$a"); +function _defineProperty$b(e, r, t2) { + return (r = _toPropertyKey$b(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$b, "_defineProperty$b"); +function _toPropertyKey$b(t2) { + var i = _toPrimitive$b(t2, "string"); + return "symbol" == _typeof$b(i) ? i : i + ""; +} +__name(_toPropertyKey$b, "_toPropertyKey$b"); +function _toPrimitive$b(t2, r) { + if ("object" != _typeof$b(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$b(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$b, "_toPrimitive$b"); +var script$p = { + name: "PanelMenu", + "extends": script$3$1, + inheritAttrs: false, + emits: ["update:expandedKeys", "panel-open", "panel-close"], + data: /* @__PURE__ */ __name(function data26() { + return { + id: this.$attrs.id, + activeItem: null, + activeItems: [] + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId9(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId") + }, + mounted: /* @__PURE__ */ __name(function mounted27() { + this.id = this.id || UniqueComponentId(); + }, "mounted"), + methods: { + getItemProp: /* @__PURE__ */ __name(function getItemProp7(item8, name4) { + return item8 ? resolve(item8[name4]) : void 0; + }, "getItemProp"), + getItemLabel: /* @__PURE__ */ __name(function getItemLabel5(item8) { + return this.getItemProp(item8, "label"); + }, "getItemLabel"), + getPTOptions: /* @__PURE__ */ __name(function getPTOptions8(key, item8, index) { + return this.ptm(key, { + context: { + index, + active: this.isItemActive(item8), + focused: this.isItemFocused(item8), + disabled: this.isItemDisabled(item8) + } + }); + }, "getPTOptions"), + isItemActive: /* @__PURE__ */ __name(function isItemActive6(item8) { + return this.expandedKeys ? this.expandedKeys[this.getItemProp(item8, "key")] : this.multiple ? this.activeItems.some(function(subItem) { + return equals(item8, subItem); + }) : equals(item8, this.activeItem); + }, "isItemActive"), + isItemVisible: /* @__PURE__ */ __name(function isItemVisible5(item8) { + return this.getItemProp(item8, "visible") !== false; + }, "isItemVisible"), + isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled5(item8) { + return this.getItemProp(item8, "disabled"); + }, "isItemDisabled"), + isItemFocused: /* @__PURE__ */ __name(function isItemFocused4(item8) { + return equals(item8, this.activeItem); + }, "isItemFocused"), + isItemGroup: /* @__PURE__ */ __name(function isItemGroup5(item8) { + return isNotEmpty(item8.items); + }, "isItemGroup"), + getPanelId: /* @__PURE__ */ __name(function getPanelId(index) { + return "".concat(this.id, "_").concat(index); + }, "getPanelId"), + getPanelKey: /* @__PURE__ */ __name(function getPanelKey(index) { + return this.getPanelId(index); + }, "getPanelKey"), + getHeaderId: /* @__PURE__ */ __name(function getHeaderId(index) { + return "".concat(this.getPanelId(index), "_header"); + }, "getHeaderId"), + getContentId: /* @__PURE__ */ __name(function getContentId(index) { + return "".concat(this.getPanelId(index), "_content"); + }, "getContentId"), + onHeaderClick: /* @__PURE__ */ __name(function onHeaderClick(event2, item8) { + if (this.isItemDisabled(item8)) { + event2.preventDefault(); + return; + } + if (item8.command) { + item8.command({ + originalEvent: event2, + item: item8 + }); + } + this.changeActiveItem(event2, item8); + focus(event2.currentTarget); + }, "onHeaderClick"), + onHeaderKeyDown: /* @__PURE__ */ __name(function onHeaderKeyDown(event2, item8) { + switch (event2.code) { + case "ArrowDown": + this.onHeaderArrowDownKey(event2); + break; + case "ArrowUp": + this.onHeaderArrowUpKey(event2); + break; + case "Home": + this.onHeaderHomeKey(event2); + break; + case "End": + this.onHeaderEndKey(event2); + break; + case "Enter": + case "NumpadEnter": + case "Space": + this.onHeaderEnterKey(event2, item8); + break; + } + }, "onHeaderKeyDown"), + onHeaderArrowDownKey: /* @__PURE__ */ __name(function onHeaderArrowDownKey(event2) { + var rootList2 = getAttribute(event2.currentTarget, "data-p-active") === true ? findSingle(event2.currentTarget.nextElementSibling, '[data-pc-section="rootlist"]') : null; + rootList2 ? focus(rootList2) : this.updateFocusedHeader({ + originalEvent: event2, + focusOnNext: true + }); + event2.preventDefault(); + }, "onHeaderArrowDownKey"), + onHeaderArrowUpKey: /* @__PURE__ */ __name(function onHeaderArrowUpKey(event2) { + var prevHeader = this.findPrevHeader(event2.currentTarget.parentElement) || this.findLastHeader(); + var rootList2 = getAttribute(prevHeader, "data-p-active") === true ? findSingle(prevHeader.nextElementSibling, '[data-pc-section="rootlist"]') : null; + rootList2 ? focus(rootList2) : this.updateFocusedHeader({ + originalEvent: event2, + focusOnNext: false + }); + event2.preventDefault(); + }, "onHeaderArrowUpKey"), + onHeaderHomeKey: /* @__PURE__ */ __name(function onHeaderHomeKey(event2) { + this.changeFocusedHeader(event2, this.findFirstHeader()); + event2.preventDefault(); + }, "onHeaderHomeKey"), + onHeaderEndKey: /* @__PURE__ */ __name(function onHeaderEndKey(event2) { + this.changeFocusedHeader(event2, this.findLastHeader()); + event2.preventDefault(); + }, "onHeaderEndKey"), + onHeaderEnterKey: /* @__PURE__ */ __name(function onHeaderEnterKey(event2, item8) { + var headerAction = findSingle(event2.currentTarget, '[data-pc-section="headerlink"]'); + headerAction ? headerAction.click() : this.onHeaderClick(event2, item8); + event2.preventDefault(); + }, "onHeaderEnterKey"), + findNextHeader: /* @__PURE__ */ __name(function findNextHeader(panelElement) { + var selfCheck = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + var nextPanelElement = selfCheck ? panelElement : panelElement.nextElementSibling; + var headerElement = findSingle(nextPanelElement, '[data-pc-section="header"]'); + return headerElement ? getAttribute(headerElement, "data-p-disabled") ? this.findNextHeader(headerElement.parentElement) : headerElement : null; + }, "findNextHeader"), + findPrevHeader: /* @__PURE__ */ __name(function findPrevHeader(panelElement) { + var selfCheck = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + var prevPanelElement = selfCheck ? panelElement : panelElement.previousElementSibling; + var headerElement = findSingle(prevPanelElement, '[data-pc-section="header"]'); + return headerElement ? getAttribute(headerElement, "data-p-disabled") ? this.findPrevHeader(headerElement.parentElement) : headerElement : null; + }, "findPrevHeader"), + findFirstHeader: /* @__PURE__ */ __name(function findFirstHeader() { + return this.findNextHeader(this.$el.firstElementChild, true); + }, "findFirstHeader"), + findLastHeader: /* @__PURE__ */ __name(function findLastHeader() { + return this.findPrevHeader(this.$el.lastElementChild, true); + }, "findLastHeader"), + updateFocusedHeader: /* @__PURE__ */ __name(function updateFocusedHeader(event2) { + var originalEvent = event2.originalEvent, focusOnNext = event2.focusOnNext, selfCheck = event2.selfCheck; + var panelElement = originalEvent.currentTarget.closest('[data-pc-section="panel"]'); + var header2 = selfCheck ? findSingle(panelElement, '[data-pc-section="header"]') : focusOnNext ? this.findNextHeader(panelElement) : this.findPrevHeader(panelElement); + header2 ? this.changeFocusedHeader(originalEvent, header2) : focusOnNext ? this.onHeaderHomeKey(originalEvent) : this.onHeaderEndKey(originalEvent); + }, "updateFocusedHeader"), + changeActiveItem: /* @__PURE__ */ __name(function changeActiveItem(event2, item8) { + var selfActive = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false; + if (!this.isItemDisabled(item8)) { + var active3 = this.isItemActive(item8); + var eventName = !active3 ? "panel-open" : "panel-close"; + this.activeItem = selfActive ? item8 : this.activeItem && equals(item8, this.activeItem) ? null : item8; + if (this.multiple) { + if (this.activeItems.some(function(subItem) { + return equals(item8, subItem); + })) { + this.activeItems = this.activeItems.filter(function(subItem) { + return !equals(item8, subItem); + }); + } else { + this.activeItems.push(item8); + } + } + this.changeExpandedKeys({ + item: item8, + expanded: !active3 + }); + this.$emit(eventName, { + originalEvent: event2, + item: item8 + }); + } + }, "changeActiveItem"), + changeExpandedKeys: /* @__PURE__ */ __name(function changeExpandedKeys(_ref) { + var item8 = _ref.item, _ref$expanded = _ref.expanded, expanded3 = _ref$expanded === void 0 ? false : _ref$expanded; + if (this.expandedKeys) { + var _keys = _objectSpread$a({}, this.expandedKeys); + if (expanded3) _keys[item8.key] = true; + else delete _keys[item8.key]; + this.$emit("update:expandedKeys", _keys); + } + }, "changeExpandedKeys"), + changeFocusedHeader: /* @__PURE__ */ __name(function changeFocusedHeader(event2, element) { + element && focus(element); + }, "changeFocusedHeader"), + getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps6(item8, index) { + return { + icon: mergeProps({ + "class": [this.cx("headerIcon"), this.getItemProp(item8, "icon")] + }, this.getPTOptions("headerIcon", item8, index)), + label: mergeProps({ + "class": this.cx("headerLabel") + }, this.getPTOptions("headerLabel", item8, index)) + }; + }, "getMenuItemProps") + }, + components: { + PanelMenuList: script$1$e, + ChevronRightIcon: script$1l, + ChevronDownIcon: script$1k + } +}; +var _hoisted_1$d = ["id"]; +var _hoisted_2$9 = ["id", "tabindex", "aria-label", "aria-expanded", "aria-controls", "aria-disabled", "onClick", "onKeydown", "data-p-active", "data-p-disabled"]; +var _hoisted_3$6 = ["href"]; +var _hoisted_4$4 = ["id", "aria-labelledby"]; +function render$m(_ctx, _cache, $props, $setup, $data, $options) { + var _component_PanelMenuList = resolveComponent("PanelMenuList"); + return openBlock(), createElementBlock("div", mergeProps({ + id: $data.id, + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model, function(item8, index) { + return openBlock(), createElementBlock(Fragment, { + key: $options.getPanelKey(index) + }, [$options.isItemVisible(item8) ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + style: $options.getItemProp(item8, "style"), + "class": [_ctx.cx("panel"), $options.getItemProp(item8, "class")], + ref_for: true + }, _ctx.ptm("panel")), [createBaseVNode("div", mergeProps({ + id: $options.getHeaderId(index), + "class": [_ctx.cx("header", { + item: item8 + }), $options.getItemProp(item8, "headerClass")], + tabindex: $options.isItemDisabled(item8) ? -1 : _ctx.tabindex, + role: "button", + "aria-label": $options.getItemLabel(item8), + "aria-expanded": $options.isItemActive(item8), + "aria-controls": $options.getContentId(index), + "aria-disabled": $options.isItemDisabled(item8), + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return $options.onHeaderClick($event, item8); + }, "onClick"), + onKeydown: /* @__PURE__ */ __name(function onKeydown6($event) { + return $options.onHeaderKeyDown($event, item8); + }, "onKeydown"), + ref_for: true + }, $options.getPTOptions("header", item8, index), { + "data-p-active": $options.isItemActive(item8), + "data-p-disabled": $options.isItemDisabled(item8) + }), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("headerContent"), + ref_for: true + }, $options.getPTOptions("headerContent", item8, index)), [!_ctx.$slots.item ? (openBlock(), createElementBlock("a", mergeProps({ + key: 0, + href: $options.getItemProp(item8, "url"), + "class": _ctx.cx("headerLink"), + tabindex: -1, + ref_for: true + }, $options.getPTOptions("headerLink", item8, index)), [$options.getItemProp(item8, "items") ? renderSlot(_ctx.$slots, "submenuicon", { + key: 0, + active: $options.isItemActive(item8) + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent($options.isItemActive(item8) ? "ChevronDownIcon" : "ChevronRightIcon"), mergeProps({ + "class": _ctx.cx("submenuIcon"), + ref_for: true + }, $options.getPTOptions("submenuIcon", item8, index)), null, 16, ["class"]))]; + }) : createCommentVNode("", true), _ctx.$slots.headericon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.headericon), { + key: 1, + item: item8, + "class": normalizeClass([_ctx.cx("headerIcon"), $options.getItemProp(item8, "icon")]) + }, null, 8, ["item", "class"])) : $options.getItemProp(item8, "icon") ? (openBlock(), createElementBlock("span", mergeProps({ + key: 2, + "class": [_ctx.cx("headerIcon"), $options.getItemProp(item8, "icon")], + ref_for: true + }, $options.getPTOptions("headerIcon", item8, index)), null, 16)) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ + "class": _ctx.cx("headerLabel"), + ref_for: true + }, $options.getPTOptions("headerLabel", item8, index)), toDisplayString($options.getItemLabel(item8)), 17)], 16, _hoisted_3$6)) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.item), { + key: 1, + item: item8, + root: true, + active: $options.isItemActive(item8), + hasSubmenu: $options.isItemGroup(item8), + label: $options.getItemLabel(item8), + props: $options.getMenuItemProps(item8, index) + }, null, 8, ["item", "active", "hasSubmenu", "label", "props"]))], 16)], 16, _hoisted_2$9), createVNode(Transition, mergeProps({ + name: "p-toggleable-content", + ref_for: true + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [withDirectives(createBaseVNode("div", mergeProps({ + id: $options.getContentId(index), + "class": _ctx.cx("contentContainer"), + role: "region", + "aria-labelledby": $options.getHeaderId(index), + ref_for: true + }, _ctx.ptm("contentContainer")), [$options.getItemProp(item8, "items") ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("content"), + ref_for: true + }, _ctx.ptm("content")), [createVNode(_component_PanelMenuList, { + panelId: $options.getPanelId(index), + items: $options.getItemProp(item8, "items"), + templates: _ctx.$slots, + expandedKeys: _ctx.expandedKeys, + onItemToggle: $options.changeExpandedKeys, + onHeaderFocus: $options.updateFocusedHeader, + pt: _ctx.pt, + unstyled: _ctx.unstyled + }, null, 8, ["panelId", "items", "templates", "expandedKeys", "onItemToggle", "onHeaderFocus", "pt", "unstyled"])], 16)) : createCommentVNode("", true)], 16, _hoisted_4$4), [[vShow, $options.isItemActive(item8)]])]; + }), + _: 2 + }, 1040)], 16)) : createCommentVNode("", true)], 64); + }), 128))], 16, _hoisted_1$d); +} +__name(render$m, "render$m"); +script$p.render = render$m; +var script$o = { + name: "EyeSlashIcon", + "extends": script$1m +}; +function render$l(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M13.9414 6.74792C13.9437 6.75295 13.9455 6.757 13.9469 6.76003C13.982 6.8394 14.0001 6.9252 14.0001 7.01195C14.0001 7.0987 13.982 7.1845 13.9469 7.26386C13.6004 8.00059 13.1711 8.69549 12.6674 9.33515C12.6115 9.4071 12.54 9.46538 12.4582 9.50556C12.3765 9.54574 12.2866 9.56678 12.1955 9.56707C12.0834 9.56671 11.9737 9.53496 11.8788 9.47541C11.7838 9.41586 11.7074 9.3309 11.6583 9.23015C11.6092 9.12941 11.5893 9.01691 11.6008 8.90543C11.6124 8.79394 11.6549 8.68793 11.7237 8.5994C12.1065 8.09726 12.4437 7.56199 12.7313 6.99995C12.2595 6.08027 10.3402 2.8014 6.99732 2.8014C6.63723 2.80218 6.27816 2.83969 5.92569 2.91336C5.77666 2.93304 5.62568 2.89606 5.50263 2.80972C5.37958 2.72337 5.29344 2.59398 5.26125 2.44714C5.22907 2.30031 5.2532 2.14674 5.32885 2.01685C5.40451 1.88696 5.52618 1.79021 5.66978 1.74576C6.10574 1.64961 6.55089 1.60134 6.99732 1.60181C11.5916 1.60181 13.7864 6.40856 13.9414 6.74792ZM2.20333 1.61685C2.35871 1.61411 2.5091 1.67179 2.6228 1.77774L12.2195 11.3744C12.3318 11.4869 12.3949 11.6393 12.3949 11.7983C12.3949 11.9572 12.3318 12.1097 12.2195 12.2221C12.107 12.3345 11.9546 12.3976 11.7956 12.3976C11.6367 12.3976 11.4842 12.3345 11.3718 12.2221L10.5081 11.3584C9.46549 12.0426 8.24432 12.4042 6.99729 12.3981C2.403 12.3981 0.208197 7.59135 0.0532336 7.25198C0.0509364 7.24694 0.0490875 7.2429 0.0476856 7.23986C0.0162332 7.16518 3.05176e-05 7.08497 3.05176e-05 7.00394C3.05176e-05 6.92291 0.0162332 6.8427 0.0476856 6.76802C0.631261 5.47831 1.46902 4.31959 2.51084 3.36119L1.77509 2.62545C1.66914 2.51175 1.61146 2.36136 1.61421 2.20597C1.61695 2.05059 1.6799 1.90233 1.78979 1.79244C1.89968 1.68254 2.04794 1.6196 2.20333 1.61685ZM7.45314 8.35147L5.68574 6.57609V6.5361C5.5872 6.78938 5.56498 7.06597 5.62183 7.33173C5.67868 7.59749 5.8121 7.84078 6.00563 8.03158C6.19567 8.21043 6.43052 8.33458 6.68533 8.39089C6.94014 8.44721 7.20543 8.43359 7.45314 8.35147ZM1.26327 6.99994C1.7351 7.91163 3.64645 11.1985 6.99729 11.1985C7.9267 11.2048 8.8408 10.9618 9.64438 10.4947L8.35682 9.20718C7.86027 9.51441 7.27449 9.64491 6.69448 9.57752C6.11446 9.51014 5.57421 9.24881 5.16131 8.83592C4.74842 8.42303 4.4871 7.88277 4.41971 7.30276C4.35232 6.72274 4.48282 6.13697 4.79005 5.64041L3.35855 4.2089C2.4954 5.00336 1.78523 5.94935 1.26327 6.99994Z", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$l, "render$l"); +script$o.render = render$l; +var theme$c = /* @__PURE__ */ __name(function theme28(_ref) { + var dt = _ref.dt; + return "\n.p-password {\n display: inline-flex;\n position: relative;\n}\n\n.p-password .p-password-overlay {\n min-width: 100%;\n}\n\n.p-password-meter {\n height: ".concat(dt("password.meter.height"), ";\n background: ").concat(dt("password.meter.background"), ";\n border-radius: ").concat(dt("password.meter.border.radius"), ";\n}\n\n.p-password-meter-label {\n height: 100%;\n width: 0;\n transition: width 1s ease-in-out;\n border-radius: ").concat(dt("password.meter.border.radius"), ";\n}\n\n.p-password-meter-weak {\n background: ").concat(dt("password.strength.weak.background"), ";\n}\n\n.p-password-meter-medium {\n background: ").concat(dt("password.strength.medium.background"), ";\n}\n\n.p-password-meter-strong {\n background: ").concat(dt("password.strength.strong.background"), ";\n}\n\n.p-password-fluid {\n display: flex;\n}\n\n.p-password-fluid .p-password-input {\n width: 100%;\n}\n\n.p-password-input::-ms-reveal,\n.p-password-input::-ms-clear {\n display: none;\n}\n\n.p-password-overlay {\n padding: ").concat(dt("password.overlay.padding"), ";\n background: ").concat(dt("password.overlay.background"), ";\n color: ").concat(dt("password.overlay.color"), ";\n border: 1px solid ").concat(dt("password.overlay.border.color"), ";\n box-shadow: ").concat(dt("password.overlay.shadow"), ";\n border-radius: ").concat(dt("password.overlay.border.radius"), ";\n}\n\n.p-password-content {\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("password.content.gap"), ";\n}\n\n.p-password-toggle-mask-icon {\n inset-inline-end: ").concat(dt("form.field.padding.x"), ";\n color: ").concat(dt("password.icon.color"), ";\n position: absolute;\n top: 50%;\n margin-top: calc(-1 * calc(").concat(dt("icon.size"), " / 2));\n width: ").concat(dt("icon.size"), ";\n height: ").concat(dt("icon.size"), ";\n}\n\n.p-password:has(.p-password-toggle-mask-icon) .p-password-input {\n padding-inline-end: calc((").concat(dt("form.field.padding.x"), " * 2) + ").concat(dt("icon.size"), ");\n}\n"); +}, "theme"); +var inlineStyles$4 = { + root: /* @__PURE__ */ __name(function root22(_ref2) { + var props = _ref2.props; + return { + position: props.appendTo === "self" ? "relative" : void 0 + }; + }, "root") +}; +var classes$d = { + root: /* @__PURE__ */ __name(function root23(_ref3) { + var instance = _ref3.instance; + return ["p-password p-component p-inputwrapper", { + "p-inputwrapper-filled": instance.$filled, + "p-inputwrapper-focus": instance.focused, + "p-password-fluid": instance.$fluid + }]; + }, "root"), + pcInputText: "p-password-input", + maskIcon: "p-password-toggle-mask-icon p-password-mask-icon", + unmaskIcon: "p-password-toggle-mask-icon p-password-unmask-icon", + overlay: "p-password-overlay p-component", + content: "p-password-content", + meter: "p-password-meter", + meterLabel: /* @__PURE__ */ __name(function meterLabel(_ref4) { + var instance = _ref4.instance; + return "p-password-meter-label ".concat(instance.meter ? "p-password-meter-" + instance.meter.strength : ""); + }, "meterLabel"), + meterText: "p-password-meter-text" +}; +var PasswordStyle = BaseStyle.extend({ + name: "password", + theme: theme$c, + classes: classes$d, + inlineStyles: inlineStyles$4 +}); +var script$1$d = { + name: "BasePassword", + "extends": script$1n, + props: { + promptLabel: { + type: String, + "default": null + }, + mediumRegex: { + type: [String, RegExp], + "default": "^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})" + // eslint-disable-line + }, + strongRegex: { + type: [String, RegExp], + "default": "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{8,})" + // eslint-disable-line + }, + weakLabel: { + type: String, + "default": null + }, + mediumLabel: { + type: String, + "default": null + }, + strongLabel: { + type: String, + "default": null + }, + feedback: { + type: Boolean, + "default": true + }, + appendTo: { + type: [String, Object], + "default": "body" + }, + toggleMask: { + type: Boolean, + "default": false + }, + hideIcon: { + type: String, + "default": void 0 + }, + maskIcon: { + type: String, + "default": void 0 + }, + showIcon: { + type: String, + "default": void 0 + }, + unmaskIcon: { + type: String, + "default": void 0 + }, + disabled: { + type: Boolean, + "default": false + }, + placeholder: { + type: String, + "default": null + }, + required: { + type: Boolean, + "default": false + }, + inputId: { + type: String, + "default": null + }, + inputClass: { + type: [String, Object], + "default": null + }, + inputStyle: { + type: Object, + "default": null + }, + inputProps: { + type: null, + "default": null + }, + panelId: { + type: String, + "default": null + }, + panelClass: { + type: [String, Object], + "default": null + }, + panelStyle: { + type: Object, + "default": null + }, + panelProps: { + type: null, + "default": null + }, + overlayId: { + type: String, + "default": null + }, + overlayClass: { + type: [String, Object], + "default": null + }, + overlayStyle: { + type: Object, + "default": null + }, + overlayProps: { + type: null, + "default": null + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + }, + autofocus: { + type: Boolean, + "default": null + } + }, + style: PasswordStyle, + provide: /* @__PURE__ */ __name(function provide38() { + return { + $pcPassword: this, + $parentInstance: this + }; + }, "provide") +}; +var script$n = { + name: "Password", + "extends": script$1$d, + inheritAttrs: false, + emits: ["change", "focus", "blur", "invalid"], + inject: { + $pcFluid: { + "default": null + } + }, + data: /* @__PURE__ */ __name(function data27() { + return { + id: this.$attrs.id, + overlayVisible: false, + meter: null, + infoText: null, + focused: false, + unmasked: false + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId10(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId") + }, + mediumCheckRegExp: null, + strongCheckRegExp: null, + resizeListener: null, + scrollHandler: null, + overlay: null, + mounted: /* @__PURE__ */ __name(function mounted28() { + this.id = this.id || UniqueComponentId(); + this.infoText = this.promptText; + this.mediumCheckRegExp = new RegExp(this.mediumRegex); + this.strongCheckRegExp = new RegExp(this.strongRegex); + }, "mounted"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount12() { + this.unbindResizeListener(); + if (this.scrollHandler) { + this.scrollHandler.destroy(); + this.scrollHandler = null; + } + if (this.overlay) { + ZIndex.clear(this.overlay); + this.overlay = null; + } + }, "beforeUnmount"), + methods: { + onOverlayEnter: /* @__PURE__ */ __name(function onOverlayEnter4(el) { + ZIndex.set("overlay", el, this.$primevue.config.zIndex.overlay); + addStyle(el, { + position: "absolute", + top: "0", + left: "0" + }); + this.alignOverlay(); + this.bindScrollListener(); + this.bindResizeListener(); + }, "onOverlayEnter"), + onOverlayLeave: /* @__PURE__ */ __name(function onOverlayLeave4() { + this.unbindScrollListener(); + this.unbindResizeListener(); + this.overlay = null; + }, "onOverlayLeave"), + onOverlayAfterLeave: /* @__PURE__ */ __name(function onOverlayAfterLeave4(el) { + ZIndex.clear(el); + }, "onOverlayAfterLeave"), + alignOverlay: /* @__PURE__ */ __name(function alignOverlay5() { + if (this.appendTo === "self") { + relativePosition(this.overlay, this.$refs.input.$el); + } else { + this.overlay.style.minWidth = getOuterWidth(this.$refs.input.$el) + "px"; + absolutePosition(this.overlay, this.$refs.input.$el); + } + }, "alignOverlay"), + testStrength: /* @__PURE__ */ __name(function testStrength(str) { + var level = 0; + if (this.strongCheckRegExp.test(str)) level = 3; + else if (this.mediumCheckRegExp.test(str)) level = 2; + else if (str.length) level = 1; + return level; + }, "testStrength"), + onInput: /* @__PURE__ */ __name(function onInput5(event2) { + this.writeValue(event2.target.value, event2); + this.$emit("change", event2); + }, "onInput"), + onFocus: /* @__PURE__ */ __name(function onFocus11(event2) { + this.focused = true; + if (this.feedback) { + this.setPasswordMeter(this.d_value); + this.overlayVisible = true; + } + this.$emit("focus", event2); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur11(event2) { + this.focused = false; + if (this.feedback) { + this.overlayVisible = false; + } + this.$emit("blur", event2); + }, "onBlur"), + onKeyUp: /* @__PURE__ */ __name(function onKeyUp(event2) { + if (this.feedback) { + var value2 = event2.target.value; + var _this$checkPasswordSt = this.checkPasswordStrength(value2), meter = _this$checkPasswordSt.meter, label12 = _this$checkPasswordSt.label; + this.meter = meter; + this.infoText = label12; + if (event2.code === "Escape") { + this.overlayVisible && (this.overlayVisible = false); + return; + } + if (!this.overlayVisible) { + this.overlayVisible = true; + } + } + }, "onKeyUp"), + setPasswordMeter: /* @__PURE__ */ __name(function setPasswordMeter() { + if (!this.d_value) { + this.meter = null; + this.infoText = this.promptText; + return; + } + var _this$checkPasswordSt2 = this.checkPasswordStrength(this.d_value), meter = _this$checkPasswordSt2.meter, label12 = _this$checkPasswordSt2.label; + this.meter = meter; + this.infoText = label12; + if (!this.overlayVisible) { + this.overlayVisible = true; + } + }, "setPasswordMeter"), + checkPasswordStrength: /* @__PURE__ */ __name(function checkPasswordStrength(value2) { + var label12 = null; + var meter = null; + switch (this.testStrength(value2)) { + case 1: + label12 = this.weakText; + meter = { + strength: "weak", + width: "33.33%" + }; + break; + case 2: + label12 = this.mediumText; + meter = { + strength: "medium", + width: "66.66%" + }; + break; + case 3: + label12 = this.strongText; + meter = { + strength: "strong", + width: "100%" + }; + break; + default: + label12 = this.promptText; + meter = null; + break; + } + return { + label: label12, + meter + }; + }, "checkPasswordStrength"), + onInvalid: /* @__PURE__ */ __name(function onInvalid(event2) { + this.$emit("invalid", event2); + }, "onInvalid"), + bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener6() { + var _this = this; + if (!this.scrollHandler) { + this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.input.$el, function() { + if (_this.overlayVisible) { + _this.overlayVisible = false; + } + }); + } + this.scrollHandler.bindScrollListener(); + }, "bindScrollListener"), + unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener6() { + if (this.scrollHandler) { + this.scrollHandler.unbindScrollListener(); + } + }, "unbindScrollListener"), + bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener6() { + var _this2 = this; + if (!this.resizeListener) { + this.resizeListener = function() { + if (_this2.overlayVisible && !isTouchDevice()) { + _this2.overlayVisible = false; + } + }; + window.addEventListener("resize", this.resizeListener); + } + }, "bindResizeListener"), + unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener6() { + if (this.resizeListener) { + window.removeEventListener("resize", this.resizeListener); + this.resizeListener = null; + } + }, "unbindResizeListener"), + overlayRef: /* @__PURE__ */ __name(function overlayRef4(el) { + this.overlay = el; + }, "overlayRef"), + onMaskToggle: /* @__PURE__ */ __name(function onMaskToggle() { + this.unmasked = !this.unmasked; + }, "onMaskToggle"), + onOverlayClick: /* @__PURE__ */ __name(function onOverlayClick5(event2) { + OverlayEventBus.emit("overlay-click", { + originalEvent: event2, + target: this.$el + }); + }, "onOverlayClick") + }, + computed: { + inputType: /* @__PURE__ */ __name(function inputType2() { + return this.unmasked ? "text" : "password"; + }, "inputType"), + weakText: /* @__PURE__ */ __name(function weakText() { + return this.weakLabel || this.$primevue.config.locale.weak; + }, "weakText"), + mediumText: /* @__PURE__ */ __name(function mediumText() { + return this.mediumLabel || this.$primevue.config.locale.medium; + }, "mediumText"), + strongText: /* @__PURE__ */ __name(function strongText() { + return this.strongLabel || this.$primevue.config.locale.strong; + }, "strongText"), + promptText: /* @__PURE__ */ __name(function promptText() { + return this.promptLabel || this.$primevue.config.locale.passwordPrompt; + }, "promptText"), + overlayUniqueId: /* @__PURE__ */ __name(function overlayUniqueId() { + return this.id + "_overlay"; + }, "overlayUniqueId") + }, + components: { + InputText: script$1o, + Portal: script$1f, + EyeSlashIcon: script$o, + EyeIcon: script$N + } +}; +function _typeof$a(o) { + "@babel/helpers - typeof"; + return _typeof$a = "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$a(o); +} +__name(_typeof$a, "_typeof$a"); +function ownKeys$9(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$9, "ownKeys$9"); +function _objectSpread$9(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$9(Object(t2), true).forEach(function(r2) { + _defineProperty$a(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$9(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$9, "_objectSpread$9"); +function _defineProperty$a(e, r, t2) { + return (r = _toPropertyKey$a(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$a, "_defineProperty$a"); +function _toPropertyKey$a(t2) { + var i = _toPrimitive$a(t2, "string"); + return "symbol" == _typeof$a(i) ? i : i + ""; +} +__name(_toPropertyKey$a, "_toPropertyKey$a"); +function _toPrimitive$a(t2, r) { + if ("object" != _typeof$a(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$a(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$a, "_toPrimitive$a"); +var _hoisted_1$c = ["id"]; +function render$k(_ctx, _cache, $props, $setup, $data, $options) { + var _component_InputText = resolveComponent("InputText"); + var _component_Portal = resolveComponent("Portal"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root"), + style: _ctx.sx("root") + }, _ctx.ptmi("root")), [createVNode(_component_InputText, mergeProps({ + ref: "input", + id: _ctx.inputId, + type: $options.inputType, + "class": [_ctx.cx("pcInputText"), _ctx.inputClass], + style: _ctx.inputStyle, + value: _ctx.d_value, + name: _ctx.$formName, + "aria-labelledby": _ctx.ariaLabelledby, + "aria-label": _ctx.ariaLabel, + "aria-controls": _ctx.overlayProps && _ctx.overlayProps.id || _ctx.overlayId || _ctx.panelProps && _ctx.panelProps.id || _ctx.panelId || $options.overlayUniqueId, + "aria-expanded": $data.overlayVisible, + "aria-haspopup": true, + placeholder: _ctx.placeholder, + required: _ctx.required, + fluid: _ctx.fluid, + disabled: _ctx.disabled, + variant: _ctx.variant, + invalid: _ctx.invalid, + size: _ctx.size, + autofocus: _ctx.autofocus, + onInput: $options.onInput, + onFocus: $options.onFocus, + onBlur: $options.onBlur, + onKeyup: $options.onKeyUp, + onInvalid: $options.onInvalid + }, _ctx.inputProps, { + pt: _ctx.ptm("pcInputText"), + unstyled: _ctx.unstyled + }), null, 16, ["id", "type", "class", "style", "value", "name", "aria-labelledby", "aria-label", "aria-controls", "aria-expanded", "placeholder", "required", "fluid", "disabled", "variant", "invalid", "size", "autofocus", "onInput", "onFocus", "onBlur", "onKeyup", "onInvalid", "pt", "unstyled"]), _ctx.toggleMask && $data.unmasked ? renderSlot(_ctx.$slots, _ctx.$slots.maskicon ? "maskicon" : "hideicon", { + key: 0, + toggleCallback: $options.onMaskToggle + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.maskIcon ? "i" : "EyeSlashIcon"), mergeProps({ + "class": [_ctx.cx("maskIcon"), _ctx.maskIcon], + onClick: $options.onMaskToggle + }, _ctx.ptm("maskIcon")), null, 16, ["class", "onClick"]))]; + }) : createCommentVNode("", true), _ctx.toggleMask && !$data.unmasked ? renderSlot(_ctx.$slots, _ctx.$slots.unmaskicon ? "unmaskicon" : "showicon", { + key: 1, + toggleCallback: $options.onMaskToggle + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.unmaskIcon ? "i" : "EyeIcon"), mergeProps({ + "class": [_ctx.cx("unmaskIcon"), _ctx.unmaskIcon], + onClick: $options.onMaskToggle + }, _ctx.ptm("unmaskIcon")), null, 16, ["class", "onClick"]))]; + }) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ + "class": "p-hidden-accessible", + "aria-live": "polite" + }, _ctx.ptm("hiddenAccesible"), { + "data-p-hidden-accessible": true + }), toDisplayString($data.infoText), 17), createVNode(_component_Portal, { + appendTo: _ctx.appendTo + }, { + "default": withCtx(function() { + return [createVNode(Transition, mergeProps({ + name: "p-connected-overlay", + onEnter: $options.onOverlayEnter, + onLeave: $options.onOverlayLeave, + onAfterLeave: $options.onOverlayAfterLeave + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [$data.overlayVisible ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: $options.overlayRef, + id: _ctx.overlayId || _ctx.panelId || $options.overlayUniqueId, + "class": [_ctx.cx("overlay"), _ctx.panelClass, _ctx.overlayClass], + style: [_ctx.overlayStyle, _ctx.panelStyle], + onClick: _cache[0] || (_cache[0] = function() { + return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); + }) + }, _objectSpread$9(_objectSpread$9(_objectSpread$9({}, _ctx.panelProps), _ctx.overlayProps), _ctx.ptm("overlay"))), [renderSlot(_ctx.$slots, "header"), renderSlot(_ctx.$slots, "content", {}, function() { + return [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("content") + }, _ctx.ptm("content")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("meter") + }, _ctx.ptm("meter")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("meterLabel"), + style: { + width: $data.meter ? $data.meter.width : "" + } + }, _ctx.ptm("meterLabel")), null, 16)], 16), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("meterText") + }, _ctx.ptm("meterText")), toDisplayString($data.infoText), 17)], 16)]; + }), renderSlot(_ctx.$slots, "footer")], 16, _hoisted_1$c)) : createCommentVNode("", true)]; + }), + _: 3 + }, 16, ["onEnter", "onLeave", "onAfterLeave"])]; + }), + _: 3 + }, 8, ["appendTo"])], 16); +} +__name(render$k, "render$k"); +script$n.render = render$k; +var theme$b = /* @__PURE__ */ __name(function theme29(_ref) { + var dt = _ref.dt; + return "\n.p-picklist {\n display: flex;\n gap: ".concat(dt("picklist.gap"), ";\n}\n\n.p-picklist-controls {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: ").concat(dt("picklist.controls.gap"), ";\n}\n\n.p-picklist-list-container {\n flex: 1 1 50%;\n}\n\n.p-picklist .p-listbox {\n height: 100%;\n}\n"); +}, "theme"); +var classes$c = { + root: "p-picklist p-component", + sourceControls: "p-picklist-controls p-picklist-source-controls", + sourceListContainer: "p-picklist-list-container p-picklist-source-list-container", + transferControls: "p-picklist-controls p-picklist-transfer-controls", + targetListContainer: "p-picklist-list-container p-picklist-target-list-container", + targetControls: "p-picklist-controls p-picklist-target-controls" +}; +var PickListStyle = BaseStyle.extend({ + name: "picklist", + theme: theme$b, + classes: classes$c +}); +var script$1$c = { + name: "BasePickList", + "extends": script$1d, + props: { + modelValue: { + type: Array, + "default": /* @__PURE__ */ __name(function _default14() { + return [[], []]; + }, "_default") + }, + selection: { + type: Array, + "default": /* @__PURE__ */ __name(function _default15() { + return [[], []]; + }, "_default") + }, + dataKey: { + type: String, + "default": null + }, + listStyle: { + type: null, + "default": null + }, + metaKeySelection: { + type: Boolean, + "default": false + }, + autoOptionFocus: { + type: Boolean, + "default": true + }, + focusOnHover: { + type: Boolean, + "default": true + }, + responsive: { + type: Boolean, + "default": true + }, + breakpoint: { + type: String, + "default": "960px" + }, + striped: { + type: Boolean, + "default": false + }, + scrollHeight: { + type: String, + "default": "14rem" + }, + showSourceControls: { + type: Boolean, + "default": true + }, + showTargetControls: { + type: Boolean, + "default": true + }, + buttonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default16() { + return { + severity: "secondary" + }; + }, "_default") + }, + moveUpButtonProps: { + type: null, + "default": null + }, + moveTopButtonProps: { + type: null, + "default": null + }, + moveDownButtonProps: { + type: null, + "default": null + }, + moveBottomButtonProps: { + type: null, + "default": null + }, + moveToTargetProps: { + type: null, + "default": null + }, + moveAllToTargetProps: { + type: null, + "default": null + }, + moveToSourceProps: { + type: null, + "default": null + }, + moveAllToSourceProps: { + type: null, + "default": null + }, + tabindex: { + type: Number, + "default": 0 + }, + disabled: { + type: Boolean, + "default": false + } + }, + style: PickListStyle, + provide: /* @__PURE__ */ __name(function provide39() { + return { + $pcPickList: this, + $parentInstance: this + }; + }, "provide") +}; +function _toConsumableArray$4(r) { + return _arrayWithoutHoles$4(r) || _iterableToArray$4(r) || _unsupportedIterableToArray$4(r) || _nonIterableSpread$4(); +} +__name(_toConsumableArray$4, "_toConsumableArray$4"); +function _nonIterableSpread$4() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableSpread$4, "_nonIterableSpread$4"); +function _unsupportedIterableToArray$4(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$4(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$4(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$4, "_unsupportedIterableToArray$4"); +function _iterableToArray$4(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray$4, "_iterableToArray$4"); +function _arrayWithoutHoles$4(r) { + if (Array.isArray(r)) return _arrayLikeToArray$4(r); +} +__name(_arrayWithoutHoles$4, "_arrayWithoutHoles$4"); +function _arrayLikeToArray$4(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; +} +__name(_arrayLikeToArray$4, "_arrayLikeToArray$4"); +var script$m = { + name: "PickList", + "extends": script$1$c, + inheritAttrs: false, + emits: ["update:modelValue", "reorder", "update:selection", "selection-change", "move-to-target", "move-to-source", "move-all-to-target", "move-all-to-source", "focus", "blur"], + itemTouched: false, + reorderDirection: null, + styleElement: null, + media: null, + mediaChangeListener: null, + data: /* @__PURE__ */ __name(function data28() { + return { + id: this.$attrs.id, + d_selection: this.selection, + viewChanged: false + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId11(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId"), + selection: /* @__PURE__ */ __name(function selection(newValue) { + this.d_selection = newValue; + }, "selection"), + breakpoint: /* @__PURE__ */ __name(function breakpoint() { + this.destroyMedia(); + this.initMedia(); + }, "breakpoint") + }, + updated: /* @__PURE__ */ __name(function updated7() { + if (this.reorderDirection) { + this.updateListScroll(this.$refs.sourceList.$el); + this.updateListScroll(this.$refs.targetList.$el); + this.reorderDirection = null; + } + }, "updated"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount13() { + this.destroyStyle(); + this.destroyMedia(); + }, "beforeUnmount"), + mounted: /* @__PURE__ */ __name(function mounted29() { + this.id = this.id || UniqueComponentId(); + if (this.responsive) { + this.createStyle(); + this.initMedia(); + } + }, "mounted"), + methods: { + updateSelection: /* @__PURE__ */ __name(function updateSelection2(event2) { + this.$emit("update:selection", this.d_selection); + this.$emit("selection-change", { + originalEvent: event2, + value: this.d_selection + }); + }, "updateSelection"), + onChangeSelection: /* @__PURE__ */ __name(function onChangeSelection2(params, listIndex) { + this.d_selection[listIndex] = params.value; + this.updateSelection(params.event); + }, "onChangeSelection"), + onListFocus: /* @__PURE__ */ __name(function onListFocus4(event2, listType) { + this.$emit("focus", event2, listType); + }, "onListFocus"), + onListBlur: /* @__PURE__ */ __name(function onListBlur4(event2, listType) { + this.$emit("blur", event2, listType); + }, "onListBlur"), + onReorderUpdate: /* @__PURE__ */ __name(function onReorderUpdate2(event2, value2, listIndex) { + this.$emit("update:modelValue", value2); + this.$emit("reorder", { + originalEvent: event2, + value: value2, + direction: this.reorderDirection, + listIndex + }); + }, "onReorderUpdate"), + onItemDblClick: /* @__PURE__ */ __name(function onItemDblClick(event2, listIndex) { + if (listIndex === 0) this.moveToTarget({ + event: event2.originalEvent + }); + else if (listIndex === 1) this.moveToSource({ + event: event2.originalEvent + }); + }, "onItemDblClick"), + moveUp: /* @__PURE__ */ __name(function moveUp2(event2, listIndex) { + if (this.d_selection && this.d_selection[listIndex]) { + var valueList = _toConsumableArray$4(this.modelValue[listIndex]); + var selectionList = this.d_selection[listIndex]; + for (var i = 0; i < selectionList.length; i++) { + var selectedItem = selectionList[i]; + var selectedItemIndex = findIndexInList(selectedItem, valueList); + if (selectedItemIndex !== 0) { + var movedItem = valueList[selectedItemIndex]; + var temp = valueList[selectedItemIndex - 1]; + valueList[selectedItemIndex - 1] = movedItem; + valueList[selectedItemIndex] = temp; + } else { + break; + } + } + var value2 = _toConsumableArray$4(this.modelValue); + value2[listIndex] = valueList; + this.reorderDirection = "up"; + this.onReorderUpdate(event2, value2, listIndex); + } + }, "moveUp"), + moveTop: /* @__PURE__ */ __name(function moveTop2(event2, listIndex) { + if (this.d_selection) { + var valueList = _toConsumableArray$4(this.modelValue[listIndex]); + var selectionList = this.d_selection[listIndex]; + for (var i = 0; i < selectionList.length; i++) { + var selectedItem = selectionList[i]; + var selectedItemIndex = findIndexInList(selectedItem, valueList); + if (selectedItemIndex !== 0) { + var movedItem = valueList.splice(selectedItemIndex, 1)[0]; + valueList.unshift(movedItem); + } else { + break; + } + } + var value2 = _toConsumableArray$4(this.modelValue); + value2[listIndex] = valueList; + this.reorderDirection = "top"; + this.onReorderUpdate(event2, value2, listIndex); + } + }, "moveTop"), + moveDown: /* @__PURE__ */ __name(function moveDown2(event2, listIndex) { + if (this.d_selection) { + var valueList = _toConsumableArray$4(this.modelValue[listIndex]); + var selectionList = this.d_selection[listIndex]; + for (var i = selectionList.length - 1; i >= 0; i--) { + var selectedItem = selectionList[i]; + var selectedItemIndex = findIndexInList(selectedItem, valueList); + if (selectedItemIndex !== valueList.length - 1) { + var movedItem = valueList[selectedItemIndex]; + var temp = valueList[selectedItemIndex + 1]; + valueList[selectedItemIndex + 1] = movedItem; + valueList[selectedItemIndex] = temp; + } else { + break; + } + } + var value2 = _toConsumableArray$4(this.modelValue); + value2[listIndex] = valueList; + this.reorderDirection = "down"; + this.onReorderUpdate(event2, value2, listIndex); + } + }, "moveDown"), + moveBottom: /* @__PURE__ */ __name(function moveBottom2(event2, listIndex) { + if (this.d_selection) { + var valueList = _toConsumableArray$4(this.modelValue[listIndex]); + var selectionList = this.d_selection[listIndex]; + for (var i = selectionList.length - 1; i >= 0; i--) { + var selectedItem = selectionList[i]; + var selectedItemIndex = findIndexInList(selectedItem, valueList); + if (selectedItemIndex !== valueList.length - 1) { + var movedItem = valueList.splice(selectedItemIndex, 1)[0]; + valueList.push(movedItem); + } else { + break; + } + } + var value2 = _toConsumableArray$4(this.modelValue); + value2[listIndex] = valueList; + this.reorderDirection = "bottom"; + this.onReorderUpdate(event2, value2, listIndex); + } + }, "moveBottom"), + moveToTarget: /* @__PURE__ */ __name(function moveToTarget(event2) { + var selection2 = this.d_selection && this.d_selection[0] ? this.d_selection[0] : null; + var sourceList2 = _toConsumableArray$4(this.modelValue[0]); + var targetList2 = _toConsumableArray$4(this.modelValue[1]); + if (selection2) { + for (var i = 0; i < selection2.length; i++) { + var selectedItem = selection2[i]; + if (findIndexInList(selectedItem, targetList2) == -1) { + targetList2.push(sourceList2.splice(findIndexInList(selectedItem, sourceList2), 1)[0]); + } + } + var value2 = _toConsumableArray$4(this.modelValue); + value2[0] = sourceList2; + value2[1] = targetList2; + this.$emit("update:modelValue", value2); + this.$emit("move-to-target", { + originalEvent: event2, + items: _toConsumableArray$4(new Set(selection2)) + }); + this.d_selection[0] = []; + this.updateSelection(event2); + } + }, "moveToTarget"), + moveAllToTarget: /* @__PURE__ */ __name(function moveAllToTarget(event2) { + if (this.modelValue[0]) { + var sourceList2 = _toConsumableArray$4(this.modelValue[0]); + var targetList2 = _toConsumableArray$4(this.modelValue[1]); + this.$emit("move-all-to-target", { + originalEvent: event2, + items: sourceList2 + }); + targetList2 = [].concat(_toConsumableArray$4(targetList2), _toConsumableArray$4(sourceList2)); + sourceList2 = []; + var value2 = _toConsumableArray$4(this.modelValue); + value2[0] = sourceList2; + value2[1] = targetList2; + this.$emit("update:modelValue", value2); + this.d_selection = [[], []]; + this.updateSelection(event2); + } + }, "moveAllToTarget"), + moveToSource: /* @__PURE__ */ __name(function moveToSource(event2) { + var selection2 = this.d_selection && this.d_selection[1] ? this.d_selection[1] : null; + var sourceList2 = _toConsumableArray$4(this.modelValue[0]); + var targetList2 = _toConsumableArray$4(this.modelValue[1]); + if (selection2) { + for (var i = 0; i < selection2.length; i++) { + var selectedItem = selection2[i]; + if (findIndexInList(selectedItem, sourceList2) == -1) { + sourceList2.push(targetList2.splice(findIndexInList(selectedItem, targetList2), 1)[0]); + } + } + var value2 = _toConsumableArray$4(this.modelValue); + value2[0] = sourceList2; + value2[1] = targetList2; + this.$emit("update:modelValue", value2); + this.$emit("move-to-source", { + originalEvent: event2, + items: _toConsumableArray$4(new Set(selection2)) + }); + this.d_selection[1] = []; + this.updateSelection(event2); + } + }, "moveToSource"), + moveAllToSource: /* @__PURE__ */ __name(function moveAllToSource(event2) { + if (this.modelValue[1]) { + var sourceList2 = _toConsumableArray$4(this.modelValue[0]); + var targetList2 = _toConsumableArray$4(this.modelValue[1]); + this.$emit("move-all-to-source", { + originalEvent: event2, + items: targetList2 + }); + sourceList2 = [].concat(_toConsumableArray$4(sourceList2), _toConsumableArray$4(targetList2)); + targetList2 = []; + var value2 = _toConsumableArray$4(this.modelValue); + value2[0] = sourceList2; + value2[1] = targetList2; + this.$emit("update:modelValue", value2); + this.d_selection = [[], []]; + this.updateSelection(event2); + } + }, "moveAllToSource"), + onItemClick: /* @__PURE__ */ __name(function onItemClick6(event2, item8, index, listIndex) { + var listType = listIndex === 0 ? "sourceList" : "targetList"; + this.itemTouched = false; + var selectionList = this.d_selection[listIndex]; + var selectedIndex = findIndexInList(item8, selectionList); + var selected3 = selectedIndex != -1; + var metaSelection = this.itemTouched ? false : this.metaKeySelection; + var selectedId = find(this.$refs[listType].$el, '[data-pc-section="item"]')[index].getAttribute("id"); + this.focusedOptionIndex = selectedId; + var _selection; + if (metaSelection) { + var metaKey = event2.metaKey || event2.ctrlKey; + if (selected3 && metaKey) { + _selection = selectionList.filter(function(val, index2) { + return index2 !== selectedIndex; + }); + } else { + _selection = metaKey ? selectionList ? _toConsumableArray$4(selectionList) : [] : []; + _selection.push(item8); + } + } else { + if (selected3) { + _selection = selectionList.filter(function(val, index2) { + return index2 !== selectedIndex; + }); + } else { + _selection = selectionList ? _toConsumableArray$4(selectionList) : []; + _selection.push(item8); + } + } + var newSelection = _toConsumableArray$4(this.d_selection); + newSelection[listIndex] = _selection; + this.d_selection = newSelection; + this.updateSelection(event2); + }, "onItemClick"), + updateListScroll: /* @__PURE__ */ __name(function updateListScroll2(listElement) { + var listItems = find(listElement, '[data-pc-section="item"][data-p-selected="true"]'); + if (listItems && listItems.length) { + switch (this.reorderDirection) { + case "up": + scrollInView(listElement, listItems[0]); + break; + case "top": + listElement.scrollTop = 0; + break; + case "down": + scrollInView(listElement, listItems[listItems.length - 1]); + break; + case "bottom": + listElement.scrollTop = listElement.scrollHeight; + break; + } + } + }, "updateListScroll"), + initMedia: /* @__PURE__ */ __name(function initMedia() { + this.media = window.matchMedia("(max-width: ".concat(this.breakpoint, ")")); + this.viewChanged = this.media.matches; + this.bindMediaChangeListener(); + }, "initMedia"), + destroyMedia: /* @__PURE__ */ __name(function destroyMedia() { + this.unbindMediaChangeListener(); + }, "destroyMedia"), + bindMediaChangeListener: /* @__PURE__ */ __name(function bindMediaChangeListener() { + var _this = this; + if (this.media && !this.mediaChangeListener) { + this.mediaChangeListener = function(event2) { + _this.viewChanged = event2.matches; + }; + this.media.addEventListener("change", this.mediaChangeListener); + } + }, "bindMediaChangeListener"), + unbindMediaChangeListener: /* @__PURE__ */ __name(function unbindMediaChangeListener() { + if (this.media && this.mediaChangeListener) { + this.media.removeEventListener("change", this.mediaChangeListener); + this.mediaChangeListener = null; + } + }, "unbindMediaChangeListener"), + createStyle: /* @__PURE__ */ __name(function createStyle2() { + if (!this.styleElement && !this.isUnstyled) { + var _this$$primevue; + this.styleElement = document.createElement("style"); + this.styleElement.type = "text/css"; + 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); + document.head.appendChild(this.styleElement); + var innerHTML = "\n@media screen and (max-width: ".concat(this.breakpoint, ") {\n .p-picklist[").concat(this.$attrSelector, "] {\n flex-direction: column;\n }\n\n .p-picklist[").concat(this.$attrSelector, "] .p-picklist-controls {\n flex-direction: row;\n }\n}\n"); + this.styleElement.innerHTML = innerHTML; + } + }, "createStyle"), + destroyStyle: /* @__PURE__ */ __name(function destroyStyle2() { + if (this.styleElement) { + document.head.removeChild(this.styleElement); + this.styleElement = null; + } + }, "destroyStyle"), + moveDisabled: /* @__PURE__ */ __name(function moveDisabled2(index) { + return this.disabled ? true : this.d_selection && (!this.d_selection[index] || !this.d_selection[index].length) ? true : false; + }, "moveDisabled"), + moveAllDisabled: /* @__PURE__ */ __name(function moveAllDisabled(list2) { + return this.disabled ? true : isEmpty(this[list2]); + }, "moveAllDisabled") + }, + computed: { + idSource: /* @__PURE__ */ __name(function idSource() { + return "".concat(this.id, "_source"); + }, "idSource"), + idTarget: /* @__PURE__ */ __name(function idTarget() { + return "".concat(this.id, "_target"); + }, "idTarget"), + sourceList: /* @__PURE__ */ __name(function sourceList() { + return this.modelValue && this.modelValue[0] ? this.modelValue[0] : null; + }, "sourceList"), + targetList: /* @__PURE__ */ __name(function targetList() { + return this.modelValue && this.modelValue[1] ? this.modelValue[1] : null; + }, "targetList"), + moveUpAriaLabel: /* @__PURE__ */ __name(function moveUpAriaLabel2() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveUp : void 0; + }, "moveUpAriaLabel"), + moveTopAriaLabel: /* @__PURE__ */ __name(function moveTopAriaLabel2() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveTop : void 0; + }, "moveTopAriaLabel"), + moveDownAriaLabel: /* @__PURE__ */ __name(function moveDownAriaLabel2() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveDown : void 0; + }, "moveDownAriaLabel"), + moveBottomAriaLabel: /* @__PURE__ */ __name(function moveBottomAriaLabel2() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveBottom : void 0; + }, "moveBottomAriaLabel"), + moveToTargetAriaLabel: /* @__PURE__ */ __name(function moveToTargetAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveToTarget : void 0; + }, "moveToTargetAriaLabel"), + moveAllToTargetAriaLabel: /* @__PURE__ */ __name(function moveAllToTargetAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveAllToTarget : void 0; + }, "moveAllToTargetAriaLabel"), + moveToSourceAriaLabel: /* @__PURE__ */ __name(function moveToSourceAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveToSource : void 0; + }, "moveToSourceAriaLabel"), + moveAllToSourceAriaLabel: /* @__PURE__ */ __name(function moveAllToSourceAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveAllToSource : void 0; + }, "moveAllToSourceAriaLabel") + }, + components: { + Listbox: script$1O, + Button: script$1e, + AngleRightIcon: script$1q, + AngleLeftIcon: script$1R, + AngleDownIcon: script$1H, + AngleUpIcon: script$1P, + AngleDoubleRightIcon: script$1S, + AngleDoubleLeftIcon: script$1T, + AngleDoubleDownIcon: script$u, + AngleDoubleUpIcon: script$t + }, + directives: { + ripple: Ripple + } +}; +function _typeof$9(o) { + "@babel/helpers - typeof"; + return _typeof$9 = "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$9(o); +} +__name(_typeof$9, "_typeof$9"); +function ownKeys$8(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$8, "ownKeys$8"); +function _objectSpread$8(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$8(Object(t2), true).forEach(function(r2) { + _defineProperty$9(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$8(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$8, "_objectSpread$8"); +function _defineProperty$9(e, r, t2) { + return (r = _toPropertyKey$9(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$9, "_defineProperty$9"); +function _toPropertyKey$9(t2) { + var i = _toPrimitive$9(t2, "string"); + return "symbol" == _typeof$9(i) ? i : i + ""; +} +__name(_toPropertyKey$9, "_toPropertyKey$9"); +function _toPrimitive$9(t2, r) { + if ("object" != _typeof$9(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$9(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$9, "_toPrimitive$9"); +function render$j(_ctx, _cache, $props, $setup, $data, $options) { + var _component_AngleUpIcon = resolveComponent("AngleUpIcon"); + var _component_Button = resolveComponent("Button"); + var _component_AngleDoubleUpIcon = resolveComponent("AngleDoubleUpIcon"); + var _component_AngleDownIcon = resolveComponent("AngleDownIcon"); + var _component_AngleDoubleDownIcon = resolveComponent("AngleDoubleDownIcon"); + var _component_Listbox = resolveComponent("Listbox"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [_ctx.showSourceControls ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("sourceControls") + }, _ctx.ptm("sourceControls"), { + "data-pc-group-section": "controls" + }), [renderSlot(_ctx.$slots, "sourcecontrolsstart"), createVNode(_component_Button, mergeProps({ + "aria-label": $options.moveUpAriaLabel, + disabled: $options.moveDisabled(0), + onClick: _cache[0] || (_cache[0] = function($event) { + return $options.moveUp($event, 0); + }) + }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveUpButtonProps), { + pt: _ctx.ptm("pcSourceMoveUpButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "moveupicon", {}, function() { + return [createVNode(_component_AngleUpIcon, mergeProps(_ctx.ptm("pcSourceMoveUpButton")["icon"], { + "data-pc-section": "moveupicon" + }), null, 16)]; + })]; + }), + _: 3 + }, 16, ["aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ + "aria-label": $options.moveTopAriaLabel, + disabled: $options.moveDisabled(0), + onClick: _cache[1] || (_cache[1] = function($event) { + return $options.moveTop($event, 0); + }) + }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveTopButtonProps), { + pt: _ctx.ptm("pcSourceMoveTopButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "movetopicon", {}, function() { + return [createVNode(_component_AngleDoubleUpIcon, mergeProps(_ctx.ptm("pcSourceMoveTopButton")["icon"], { + "data-pc-section": "movetopicon" + }), null, 16)]; + })]; + }), + _: 3 + }, 16, ["aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ + "aria-label": $options.moveDownAriaLabel, + disabled: $options.moveDisabled(0), + onClick: _cache[2] || (_cache[2] = function($event) { + return $options.moveDown($event, 0); + }) + }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveDownButtonProps), { + pt: _ctx.ptm("pcSourceMoveDownButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "movedownicon", {}, function() { + return [createVNode(_component_AngleDownIcon, mergeProps(_ctx.ptm("pcSourceMoveDownButton")["icon"], { + "data-pc-section": "movedownicon" + }), null, 16)]; + })]; + }), + _: 3 + }, 16, ["aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ + "aria-label": $options.moveBottomAriaLabel, + disabled: $options.moveDisabled(0), + onClick: _cache[3] || (_cache[3] = function($event) { + return $options.moveBottom($event, 0); + }) + }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveBottomButtonProps), { + pt: _ctx.ptm("pcSourceMoveBottomButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "movebottomicon", {}, function() { + return [createVNode(_component_AngleDoubleDownIcon, mergeProps(_ctx.ptm("pcSourceMoveBottomButton")["icon"], { + "data-pc-section": "movebottomicon" + }), null, 16)]; + })]; + }), + _: 3 + }, 16, ["aria-label", "disabled", "pt", "unstyled"]), renderSlot(_ctx.$slots, "sourcecontrolsend")], 16)) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("sourceListContainer") + }, _ctx.ptm("sourceListContainer"), { + "data-pc-group-section": "listcontainer" + }), [createVNode(_component_Listbox, { + ref: "sourceList", + id: $options.idSource + "_list", + modelValue: $data.d_selection[0], + options: $options.sourceList, + multiple: "", + metaKeySelection: _ctx.metaKeySelection, + listStyle: _ctx.listStyle, + scrollHeight: _ctx.scrollHeight, + tabindex: $options.sourceList && $options.sourceList.length > 0 ? _ctx.tabindex : -1, + dataKey: _ctx.dataKey, + autoOptionFocus: _ctx.autoOptionFocus, + focusOnHover: _ctx.focusOnHover, + striped: _ctx.striped, + disabled: _ctx.disabled, + pt: _ctx.ptm("pcListbox"), + unstyled: _ctx.unstyled, + onFocus: _cache[4] || (_cache[4] = function($event) { + return $options.onListFocus($event, "sourceList"); + }), + onBlur: _cache[5] || (_cache[5] = function($event) { + return $options.onListBlur($event, "sourceList"); + }), + onChange: _cache[6] || (_cache[6] = function($event) { + return $options.onChangeSelection($event, 0); + }), + onItemDblclick: _cache[7] || (_cache[7] = function($event) { + return $options.onItemDblClick($event, 0); + }), + "data-pc-group-section": "list" + }, createSlots({ + option: withCtx(function(_ref) { + var option4 = _ref.option, selected3 = _ref.selected, index = _ref.index; + return [renderSlot(_ctx.$slots, _ctx.$slots.option ? "option" : "item", { + item: option4, + option: option4, + selected: selected3, + index + })]; + }), + _: 2 + }, [_ctx.$slots.sourceheader ? { + name: "header", + fn: withCtx(function() { + return [renderSlot(_ctx.$slots, "sourceheader")]; + }), + key: "0" + } : void 0]), 1032, ["id", "modelValue", "options", "metaKeySelection", "listStyle", "scrollHeight", "tabindex", "dataKey", "autoOptionFocus", "focusOnHover", "striped", "disabled", "pt", "unstyled"])], 16), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("transferControls") + }, _ctx.ptm("transferControls"), { + "data-pc-group-section": "controls" + }), [renderSlot(_ctx.$slots, "movecontrolsstart"), createVNode(_component_Button, mergeProps({ + "aria-label": $options.moveToTargetAriaLabel, + onClick: $options.moveToTarget, + disabled: $options.moveDisabled(0) + }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveToTargetProps), { + pt: _ctx.ptm("pcMoveToTargetButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "movetotargeticon", { + viewChanged: $data.viewChanged + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent($data.viewChanged ? "AngleDownIcon" : "AngleRightIcon"), mergeProps(_ctx.ptm("pcMoveToTargetButton")["icon"], { + "data-pc-section": "movetotargeticon" + }), null, 16))]; + })]; + }), + _: 3 + }, 16, ["aria-label", "onClick", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ + "aria-label": $options.moveAllToTargetAriaLabel, + onClick: $options.moveAllToTarget, + disabled: $options.moveAllDisabled("sourceList") + }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveAllToTargetProps), { + pt: _ctx.ptm("pcMoveAllToTargetButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "movealltotargeticon", { + viewChanged: $data.viewChanged + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent($data.viewChanged ? "AngleDoubleDownIcon" : "AngleDoubleRightIcon"), mergeProps(_ctx.ptm("pcMoveAllToTargetButton")["icon"], { + "data-pc-section": "movealltotargeticon" + }), null, 16))]; + })]; + }), + _: 3 + }, 16, ["aria-label", "onClick", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ + "aria-label": $options.moveToSourceAriaLabel, + onClick: $options.moveToSource, + disabled: $options.moveDisabled(1) + }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveToSourceProps), { + pt: _ctx.ptm("pcMoveToSourceButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "movetosourceicon", { + viewChanged: $data.viewChanged + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent($data.viewChanged ? "AngleUpIcon" : "AngleLeftIcon"), mergeProps(_ctx.ptm("pcMoveToSourceButton")["icon"], { + "data-pc-section": "movetosourceicon" + }), null, 16))]; + })]; + }), + _: 3 + }, 16, ["aria-label", "onClick", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ + "aria-label": $options.moveAllToSourceAriaLabel, + onClick: $options.moveAllToSource, + disabled: $options.moveAllDisabled("targetList") + }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveAllToSourceProps), { + pt: _ctx.ptm("pcMoveAllToSourceButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "movealltosourceicon", { + viewChanged: $data.viewChanged + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent($data.viewChanged ? "AngleDoubleUpIcon" : "AngleDoubleLeftIcon"), mergeProps(_ctx.ptm("pcMoveAllToSourceButton")["icon"], { + "data-pc-section": "movealltosourceicon" + }), null, 16))]; + })]; + }), + _: 3 + }, 16, ["aria-label", "onClick", "disabled", "pt", "unstyled"]), renderSlot(_ctx.$slots, "movecontrolsend")], 16), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("targetListContainer") + }, _ctx.ptm("targetListContainer"), { + "data-pc-group-section": "listcontainer" + }), [createVNode(_component_Listbox, { + ref: "targetList", + id: $options.idTarget + "_list", + modelValue: $data.d_selection[1], + options: $options.targetList, + multiple: "", + metaKeySelection: _ctx.metaKeySelection, + listStyle: _ctx.listStyle, + scrollHeight: _ctx.scrollHeight, + tabindex: $options.targetList && $options.targetList.length > 0 ? _ctx.tabindex : -1, + dataKey: _ctx.dataKey, + autoOptionFocus: _ctx.autoOptionFocus, + focusOnHover: _ctx.focusOnHover, + striped: _ctx.striped, + disabled: _ctx.disabled, + pt: _ctx.ptm("pcListbox"), + unstyled: _ctx.unstyled, + onFocus: _cache[8] || (_cache[8] = function($event) { + return $options.onListFocus($event, "targetList"); + }), + onBlur: _cache[9] || (_cache[9] = function($event) { + return $options.onListBlur($event, "targetList"); + }), + onChange: _cache[10] || (_cache[10] = function($event) { + return $options.onChangeSelection($event, 1); + }), + onItemDblclick: _cache[11] || (_cache[11] = function($event) { + return $options.onItemDblClick($event, 1); + }), + "data-pc-group-section": "list" + }, createSlots({ + option: withCtx(function(_ref2) { + var option4 = _ref2.option, selected3 = _ref2.selected, index = _ref2.index; + return [renderSlot(_ctx.$slots, _ctx.$slots.option ? "option" : "item", { + item: option4, + option: option4, + selected: selected3, + index + })]; + }), + _: 2 + }, [_ctx.$slots.targetheader ? { + name: "header", + fn: withCtx(function() { + return [renderSlot(_ctx.$slots, "targetheader")]; + }), + key: "0" + } : void 0]), 1032, ["id", "modelValue", "options", "metaKeySelection", "listStyle", "scrollHeight", "tabindex", "dataKey", "autoOptionFocus", "focusOnHover", "striped", "disabled", "pt", "unstyled"])], 16), _ctx.showTargetControls ? (openBlock(), createElementBlock("div", mergeProps({ + key: 1, + "class": _ctx.cx("targetControls") + }, _ctx.ptm("targetControls"), { + "data-pc-group-section": "controls" + }), [renderSlot(_ctx.$slots, "targetcontrolsstart"), createVNode(_component_Button, mergeProps({ + "aria-label": $options.moveUpAriaLabel, + disabled: $options.moveDisabled(1), + onClick: _cache[12] || (_cache[12] = function($event) { + return $options.moveUp($event, 1); + }) + }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveUpButtonProps), { + pt: _ctx.ptm("pcTargetMoveUpButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "moveupicon", {}, function() { + return [createVNode(_component_AngleUpIcon, mergeProps(_ctx.ptm("pcTargetMoveUpButton")["icon"], { + "data-pc-section": "moveupicon" + }), null, 16)]; + })]; + }), + _: 3 + }, 16, ["aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ + "aria-label": $options.moveTopAriaLabel, + disabled: $options.moveDisabled(1), + onClick: _cache[13] || (_cache[13] = function($event) { + return $options.moveTop($event, 1); + }) + }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveTopButtonProps), { + pt: _ctx.ptm("pcTargetMoveTopButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "movetopicon", {}, function() { + return [createVNode(_component_AngleDoubleUpIcon, mergeProps(_ctx.ptm("pcTargetMoveTopButton")["icon"], { + "data-pc-section": "movetopicon" + }), null, 16)]; + })]; + }), + _: 3 + }, 16, ["aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ + "aria-label": $options.moveDownAriaLabel, + disabled: $options.moveDisabled(1), + onClick: _cache[14] || (_cache[14] = function($event) { + return $options.moveDown($event, 1); + }) + }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveDownButtonProps), { + pt: _ctx.ptm("pcTargetMoveDownButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "movedownicon", {}, function() { + return [createVNode(_component_AngleDownIcon, mergeProps(_ctx.ptm("pcTargetMoveDownButton")["icon"], { + "data-pc-section": "movedownicon" + }), null, 16)]; + })]; + }), + _: 3 + }, 16, ["aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ + "aria-label": $options.moveBottomAriaLabel, + disabled: $options.moveDisabled(1), + onClick: _cache[15] || (_cache[15] = function($event) { + return $options.moveBottom($event, 1); + }) + }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveBottomButtonProps), { + pt: _ctx.ptm("pcTargetMoveBottomButton"), + unstyled: _ctx.unstyled + }), { + icon: withCtx(function() { + return [renderSlot(_ctx.$slots, "movebottomicon", {}, function() { + return [createVNode(_component_AngleDoubleDownIcon, mergeProps(_ctx.ptm("pcTargetMoveBottomButton")["icon"], { + "data-pc-section": "movebottomicon" + }), null, 16)]; + })]; + }), + _: 3 + }, 16, ["aria-label", "disabled", "pt", "unstyled"]), renderSlot(_ctx.$slots, "targetcontrolsend")], 16)) : createCommentVNode("", true)], 16); +} +__name(render$j, "render$j"); +script$m.render = render$j; +var PortalStyle = BaseStyle.extend({ + name: "portal" +}); +var theme$a = /* @__PURE__ */ __name(function theme30(_ref) { + _ref.dt; + return "\n.p-radiobutton-group {\n display: inline-flex;\n}\n"; +}, "theme"); +var classes$b = { + root: "p-radiobutton-group p-component" +}; +var RadioButtonGroupStyle = BaseStyle.extend({ + name: "radiobuttongroup", + theme: theme$a, + classes: classes$b +}); +var script$1$b = { + name: "BaseRadioButtonGroup", + "extends": script$1s, + style: RadioButtonGroupStyle, + provide: /* @__PURE__ */ __name(function provide40() { + return { + $pcRadioButtonGroup: this, + $parentInstance: this + }; + }, "provide") +}; +var script$l = { + name: "RadioButtonGroup", + "extends": script$1$b, + inheritAttrs: false, + data: /* @__PURE__ */ __name(function data29() { + return { + groupName: this.name + }; + }, "data"), + watch: { + name: /* @__PURE__ */ __name(function name2(newValue) { + this.groupName = newValue || uuid("radiobutton-group-"); + }, "name") + }, + mounted: /* @__PURE__ */ __name(function mounted30() { + this.groupName = this.groupName || uuid("radiobutton-group-"); + }, "mounted") +}; +function render$i(_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$i, "render$i"); +script$l.render = render$i; +var script$k = { + name: "BanIcon", + "extends": script$1m +}; +function render$h(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + d: "M7 0C5.61553 0 4.26215 0.410543 3.11101 1.17971C1.95987 1.94888 1.06266 3.04213 0.532846 4.32122C0.00303296 5.6003 -0.13559 7.00776 0.134506 8.36563C0.404603 9.7235 1.07129 10.9708 2.05026 11.9497C3.02922 12.9287 4.2765 13.5954 5.63437 13.8655C6.99224 14.1356 8.3997 13.997 9.67879 13.4672C10.9579 12.9373 12.0511 12.0401 12.8203 10.889C13.5895 9.73785 14 8.38447 14 7C14 5.14348 13.2625 3.36301 11.9497 2.05025C10.637 0.737498 8.85652 0 7 0ZM1.16667 7C1.16549 5.65478 1.63303 4.35118 2.48889 3.31333L10.6867 11.5111C9.83309 12.2112 8.79816 12.6544 7.70243 12.789C6.60669 12.9236 5.49527 12.744 4.49764 12.2713C3.50001 11.7986 2.65724 11.0521 2.06751 10.1188C1.47778 9.18558 1.16537 8.10397 1.16667 7ZM11.5111 10.6867L3.31334 2.48889C4.43144 1.57388 5.84966 1.10701 7.29265 1.1789C8.73565 1.2508 10.1004 1.85633 11.1221 2.87795C12.1437 3.89956 12.7492 5.26435 12.8211 6.70735C12.893 8.15034 12.4261 9.56856 11.5111 10.6867Z", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$h, "render$h"); +script$k.render = render$h; +var script$j = { + name: "StarIcon", + "extends": script$1m +}; +function render$g(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + d: "M10.9741 13.6721C10.8806 13.6719 10.7886 13.6483 10.7066 13.6033L7.00002 11.6545L3.29345 13.6033C3.19926 13.6539 3.09281 13.6771 2.98612 13.6703C2.87943 13.6636 2.77676 13.6271 2.6897 13.5651C2.60277 13.5014 2.53529 13.4147 2.4948 13.3148C2.45431 13.215 2.44241 13.1058 2.46042 12.9995L3.17881 8.87264L0.167699 5.95324C0.0922333 5.8777 0.039368 5.78258 0.0150625 5.67861C-0.00924303 5.57463 -0.00402231 5.46594 0.030136 5.36477C0.0621323 5.26323 0.122141 5.17278 0.203259 5.10383C0.284377 5.03488 0.383311 4.99023 0.488681 4.97501L4.63087 4.37126L6.48797 0.618832C6.54083 0.530159 6.61581 0.456732 6.70556 0.405741C6.79532 0.35475 6.89678 0.327942 7.00002 0.327942C7.10325 0.327942 7.20471 0.35475 7.29447 0.405741C7.38422 0.456732 7.4592 0.530159 7.51206 0.618832L9.36916 4.37126L13.5114 4.97501C13.6167 4.99023 13.7157 5.03488 13.7968 5.10383C13.8779 5.17278 13.9379 5.26323 13.9699 5.36477C14.0041 5.46594 14.0093 5.57463 13.985 5.67861C13.9607 5.78258 13.9078 5.8777 13.8323 5.95324L10.8212 8.87264L11.532 12.9995C11.55 13.1058 11.5381 13.215 11.4976 13.3148C11.4571 13.4147 11.3896 13.5014 11.3027 13.5651C11.2059 13.632 11.0917 13.6692 10.9741 13.6721ZM7.00002 10.4393C7.09251 10.4404 7.18371 10.4613 7.2675 10.5005L10.2098 12.029L9.65193 8.75036C9.6368 8.6584 9.64343 8.56418 9.6713 8.47526C9.69918 8.38633 9.74751 8.30518 9.81242 8.23832L12.1969 5.94559L8.90298 5.45648C8.81188 5.44198 8.72555 5.406 8.65113 5.35152C8.57671 5.29703 8.51633 5.2256 8.475 5.14314L7.00002 2.1626L5.52503 5.15078C5.4837 5.23324 5.42332 5.30467 5.3489 5.35916C5.27448 5.41365 5.18815 5.44963 5.09705 5.46412L1.80318 5.94559L4.18761 8.23832C4.25252 8.30518 4.30085 8.38633 4.32873 8.47526C4.3566 8.56418 4.36323 8.6584 4.3481 8.75036L3.7902 12.0519L6.73253 10.5234C6.81451 10.4762 6.9058 10.4475 7.00002 10.4393Z", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$g, "render$g"); +script$j.render = render$g; +var script$i = { + name: "StarFillIcon", + "extends": script$1m +}; +function render$f(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + d: "M13.9718 5.36453C13.9398 5.26298 13.8798 5.17252 13.7986 5.10356C13.7175 5.0346 13.6186 4.98994 13.5132 4.97472L9.37043 4.37088L7.51307 0.617955C7.46021 0.529271 7.38522 0.455834 7.29545 0.404836C7.20568 0.353838 7.1042 0.327026 7.00096 0.327026C6.89771 0.327026 6.79624 0.353838 6.70647 0.404836C6.6167 0.455834 6.54171 0.529271 6.48885 0.617955L4.63149 4.37088L0.488746 4.97472C0.383363 4.98994 0.284416 5.0346 0.203286 5.10356C0.122157 5.17252 0.0621407 5.26298 0.03014 5.36453C-0.00402286 5.46571 -0.00924428 5.57442 0.0150645 5.67841C0.0393733 5.7824 0.0922457 5.87753 0.167722 5.95308L3.17924 8.87287L2.4684 13.0003C2.45038 13.1066 2.46229 13.2158 2.50278 13.3157C2.54328 13.4156 2.61077 13.5022 2.6977 13.5659C2.78477 13.628 2.88746 13.6644 2.99416 13.6712C3.10087 13.678 3.20733 13.6547 3.30153 13.6042L7.00096 11.6551L10.708 13.6042C10.79 13.6491 10.882 13.6728 10.9755 13.673C11.0958 13.6716 11.2129 13.6343 11.3119 13.5659C11.3988 13.5022 11.4663 13.4156 11.5068 13.3157C11.5473 13.2158 11.5592 13.1066 11.5412 13.0003L10.8227 8.87287L13.8266 5.95308C13.9033 5.87835 13.9577 5.7836 13.9833 5.67957C14.009 5.57554 14.005 5.4664 13.9718 5.36453Z", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$f, "render$f"); +script$i.render = render$f; +var theme$9 = /* @__PURE__ */ __name(function theme31(_ref) { + var dt = _ref.dt; + return "\n.p-rating {\n position: relative;\n display: flex;\n align-items: center;\n gap: ".concat(dt("rating.gap"), ";\n}\n\n.p-rating-option {\n display: inline-flex;\n align-items: center;\n cursor: pointer;\n outline-color: transparent;\n border-radius: 50%;\n transition: background ").concat(dt("rating.transition.duration"), ", color ").concat(dt("rating.transition.duration"), ", border-color ").concat(dt("rating.transition.duration"), ", outline-color ").concat(dt("rating.transition.duration"), ", box-shadow ").concat(dt("rating.transition.duration"), ";\n}\n\n.p-rating-option.p-focus-visible {\n box-shadow: ").concat(dt("rating.focus.ring.shadow"), ";\n outline: ").concat(dt("rating.focus.ring.width"), " ").concat(dt("rating.focus.ring.style"), " ").concat(dt("rating.focus.ring.color"), ";\n outline-offset: ").concat(dt("rating.focus.ring.offset"), ";\n}\n\n.p-rating-icon {\n color: ").concat(dt("rating.icon.color"), ";\n transition: background ").concat(dt("rating.transition.duration"), ", color ").concat(dt("rating.transition.duration"), ", border-color ").concat(dt("rating.transition.duration"), ", outline-color ").concat(dt("rating.transition.duration"), ", box-shadow ").concat(dt("rating.transition.duration"), ";\n font-size: ").concat(dt("rating.icon.size"), ";\n width: ").concat(dt("rating.icon.size"), ";\n height: ").concat(dt("rating.icon.size"), ";\n}\n\n.p-rating:not(.p-disabled):not(.p-readonly) .p-rating-option:hover .p-rating-icon {\n color: ").concat(dt("rating.icon.hover.color"), ";\n}\n\n.p-rating-option-active .p-rating-icon {\n color: ").concat(dt("rating.icon.active.color"), ";\n}\n\n.p-rating-icon.p-invalid { /* @todo */\n stroke: ").concat(dt("rating.invalid.icon.color"), ";\n}\n"); +}, "theme"); +var classes$a = { + root: /* @__PURE__ */ __name(function root24(_ref2) { + var props = _ref2.props; + return ["p-rating", { + "p-readonly": props.readonly, + "p-disabled": props.disabled + }]; + }, "root"), + option: /* @__PURE__ */ __name(function option3(_ref3) { + var instance = _ref3.instance, value2 = _ref3.value; + return ["p-rating-option", { + "p-rating-option-active": value2 <= instance.d_value, + "p-focus-visible": value2 === instance.focusedOptionIndex && instance.isFocusVisibleItem + }]; + }, "option"), + onIcon: /* @__PURE__ */ __name(function onIcon(_ref4) { + var instance = _ref4.instance; + return ["p-rating-icon p-rating-on-icon", { + "p-invalid": instance.$invalid + }]; + }, "onIcon"), + offIcon: /* @__PURE__ */ __name(function offIcon(_ref5) { + var instance = _ref5.instance; + return ["p-rating-icon p-rating-off-icon", { + "p-invalid": instance.$invalid + }]; + }, "offIcon") +}; +var RatingStyle = BaseStyle.extend({ + name: "rating", + theme: theme$9, + classes: classes$a +}); +var script$1$a = { + name: "BaseRating", + "extends": script$1s, + props: { + readonly: { + type: Boolean, + "default": false + }, + stars: { + type: Number, + "default": 5 + }, + onIcon: { + type: String, + "default": void 0 + }, + offIcon: { + type: String, + "default": void 0 + } + }, + style: RatingStyle, + provide: /* @__PURE__ */ __name(function provide41() { + return { + $pcRating: this, + $parentInstance: this + }; + }, "provide") +}; +var script$h = { + name: "Rating", + "extends": script$1$a, + inheritAttrs: false, + emits: ["change", "focus", "blur"], + data: /* @__PURE__ */ __name(function data30() { + return { + d_name: this.name, + focusedOptionIndex: -1, + isFocusVisibleItem: true + }; + }, "data"), + watch: { + name: /* @__PURE__ */ __name(function name3(newValue) { + this.d_name = newValue || UniqueComponentId(); + }, "name") + }, + mounted: /* @__PURE__ */ __name(function mounted31() { + this.d_name = this.d_name || UniqueComponentId(); + }, "mounted"), + methods: { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions9(key, value2) { + return this.ptm(key, { + context: { + active: value2 <= this.d_value, + focused: value2 === this.focusedOptionIndex + } + }); + }, "getPTOptions"), + onOptionClick: /* @__PURE__ */ __name(function onOptionClick3(event2, value2) { + if (!this.readonly && !this.disabled) { + this.onOptionSelect(event2, value2); + this.isFocusVisibleItem = false; + var firstFocusableEl = getFirstFocusableElement(event2.currentTarget); + firstFocusableEl && focus(firstFocusableEl); + } + }, "onOptionClick"), + onFocus: /* @__PURE__ */ __name(function onFocus12(event2, value2) { + this.focusedOptionIndex = value2; + this.$emit("focus", event2); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur12(event2) { + var _this$formField$onBlu, _this$formField; + this.focusedOptionIndex = -1; + this.$emit("blur", event2); + (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField); + }, "onBlur"), + onChange: /* @__PURE__ */ __name(function onChange(event2, value2) { + this.onOptionSelect(event2, value2); + this.isFocusVisibleItem = true; + }, "onChange"), + onOptionSelect: /* @__PURE__ */ __name(function onOptionSelect3(event2, value2) { + if (this.focusedOptionIndex === value2 || this.d_value === value2) { + this.focusedOptionIndex = -1; + this.updateModel(event2, null); + } else { + this.focusedOptionIndex = value2; + this.updateModel(event2, value2 || null); + } + }, "onOptionSelect"), + updateModel: /* @__PURE__ */ __name(function updateModel7(event2, value2) { + this.writeValue(value2, event2); + this.$emit("change", { + originalEvent: event2, + value: value2 + }); + }, "updateModel"), + starAriaLabel: /* @__PURE__ */ __name(function starAriaLabel(value2) { + return value2 === 1 ? this.$primevue.config.locale.aria.star : this.$primevue.config.locale.aria.stars.replace(/{star}/g, value2); + }, "starAriaLabel") + }, + components: { + StarFillIcon: script$i, + StarIcon: script$j, + BanIcon: script$k + } +}; +var _hoisted_1$b = ["onClick", "data-p-active", "data-p-focused"]; +var _hoisted_2$8 = ["value", "name", "checked", "disabled", "readonly", "aria-label", "onFocus", "onChange"]; +function render$e(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.stars, function(value2) { + return openBlock(), createElementBlock("div", mergeProps({ + key: value2, + "class": _ctx.cx("option", { + value: value2 + }), + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return $options.onOptionClick($event, value2); + }, "onClick"), + ref_for: true + }, $options.getPTOptions("option", value2), { + "data-p-active": value2 <= _ctx.d_value, + "data-p-focused": value2 === $data.focusedOptionIndex + }), [createBaseVNode("span", mergeProps({ + "class": "p-hidden-accessible", + ref_for: true + }, _ctx.ptm("hiddenOptionInputContainer"), { + "data-p-hidden-accessible": true + }), [createBaseVNode("input", mergeProps({ + type: "radio", + value: value2, + name: $data.d_name, + checked: _ctx.d_value === value2, + disabled: _ctx.disabled, + readonly: _ctx.readonly, + "aria-label": $options.starAriaLabel(value2), + onFocus: /* @__PURE__ */ __name(function onFocus15($event) { + return $options.onFocus($event, value2); + }, "onFocus"), + onBlur: _cache[0] || (_cache[0] = function() { + return $options.onBlur && $options.onBlur.apply($options, arguments); + }), + onChange: /* @__PURE__ */ __name(function onChange2($event) { + return $options.onChange($event, value2); + }, "onChange"), + ref_for: true + }, _ctx.ptm("hiddenOptionInput")), null, 16, _hoisted_2$8)], 16), value2 <= _ctx.d_value ? renderSlot(_ctx.$slots, "onicon", { + key: 0, + value: value2, + "class": normalizeClass(_ctx.cx("onIcon")) + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.onIcon ? "span" : "StarFillIcon"), mergeProps({ + "class": [_ctx.cx("onIcon"), _ctx.onIcon], + ref_for: true + }, _ctx.ptm("onIcon")), null, 16, ["class"]))]; + }) : renderSlot(_ctx.$slots, "officon", { + key: 1, + value: value2, + "class": normalizeClass(_ctx.cx("offIcon")) + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.offIcon ? "span" : "StarIcon"), mergeProps({ + "class": [_ctx.cx("offIcon"), _ctx.offIcon], + ref_for: true + }, _ctx.ptm("offIcon")), null, 16, ["class"]))]; + })], 16, _hoisted_1$b); + }), 128))], 16); +} +__name(render$e, "render$e"); +script$h.render = render$e; +var script$g = { + name: "Row", + "extends": script$1d, + inject: ["$rows"], + mounted: /* @__PURE__ */ __name(function mounted32() { + var _this$$rows; + (_this$$rows = this.$rows) === null || _this$$rows === void 0 || _this$$rows.add(this.$); + }, "mounted"), + unmounted: /* @__PURE__ */ __name(function unmounted4() { + var _this$$rows2; + (_this$$rows2 = this.$rows) === null || _this$$rows2 === void 0 || _this$$rows2["delete"](this.$); + }, "unmounted"), + render: /* @__PURE__ */ __name(function render2() { + return null; + }, "render") +}; +var RowStyle = BaseStyle.extend({ + name: "row" +}); +var theme$8 = /* @__PURE__ */ __name(function theme32(_ref) { + _ref.dt; + return "\n.p-scrolltop.p-button {\n position: fixed !important;\n inset-block-end: 20px;\n inset-inline-end: 20px;\n}\n\n.p-scrolltop-sticky.p-button {\n position: sticky !important;\n display: flex;\n margin-inline-start: auto;\n}\n\n.p-scrolltop-enter-from {\n opacity: 0;\n}\n\n.p-scrolltop-enter-active {\n transition: opacity 0.15s;\n}\n\n.p-scrolltop.p-scrolltop-leave-to {\n opacity: 0;\n}\n\n.p-scrolltop-leave-active {\n transition: opacity 0.15s;\n}\n"; +}, "theme"); +var classes$9 = { + root: /* @__PURE__ */ __name(function root25(_ref2) { + var props = _ref2.props; + return ["p-scrolltop", { + "p-scrolltop-sticky": props.target !== "window" + }]; + }, "root"), + icon: "p-scrolltop-icon" +}; +var ScrollTopStyle = BaseStyle.extend({ + name: "scrolltop", + theme: theme$8, + classes: classes$9 +}); +var script$1$9 = { + name: "BaseScrollTop", + "extends": script$1d, + props: { + target: { + type: String, + "default": "window" + }, + threshold: { + type: Number, + "default": 400 + }, + icon: { + type: String, + "default": void 0 + }, + behavior: { + type: String, + "default": "smooth" + }, + buttonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default17() { + return { + rounded: true + }; + }, "_default") + } + }, + style: ScrollTopStyle, + provide: /* @__PURE__ */ __name(function provide42() { + return { + $pcScrollTop: this, + $parentInstance: this + }; + }, "provide") +}; +var script$f = { + name: "ScrollTop", + "extends": script$1$9, + inheritAttrs: false, + scrollListener: null, + container: null, + data: /* @__PURE__ */ __name(function data31() { + return { + visible: false + }; + }, "data"), + mounted: /* @__PURE__ */ __name(function mounted33() { + if (this.target === "window") this.bindDocumentScrollListener(); + else if (this.target === "parent") this.bindParentScrollListener(); + }, "mounted"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount14() { + if (this.target === "window") this.unbindDocumentScrollListener(); + else if (this.target === "parent") this.unbindParentScrollListener(); + if (this.container) { + ZIndex.clear(this.container); + this.overlay = null; + } + }, "beforeUnmount"), + methods: { + onClick: /* @__PURE__ */ __name(function onClick5() { + var scrollElement = this.target === "window" ? window : this.$el.parentElement; + scrollElement.scroll({ + top: 0, + behavior: this.behavior + }); + }, "onClick"), + checkVisibility: /* @__PURE__ */ __name(function checkVisibility(scrollY) { + if (scrollY > this.threshold) this.visible = true; + else this.visible = false; + }, "checkVisibility"), + bindParentScrollListener: /* @__PURE__ */ __name(function bindParentScrollListener() { + var _this = this; + this.scrollListener = function() { + _this.checkVisibility(_this.$el.parentElement.scrollTop); + }; + this.$el.parentElement.addEventListener("scroll", this.scrollListener); + }, "bindParentScrollListener"), + bindDocumentScrollListener: /* @__PURE__ */ __name(function bindDocumentScrollListener() { + var _this2 = this; + this.scrollListener = function() { + _this2.checkVisibility(getWindowScrollTop()); + }; + window.addEventListener("scroll", this.scrollListener); + }, "bindDocumentScrollListener"), + unbindParentScrollListener: /* @__PURE__ */ __name(function unbindParentScrollListener() { + if (this.scrollListener) { + this.$el.parentElement.removeEventListener("scroll", this.scrollListener); + this.scrollListener = null; + } + }, "unbindParentScrollListener"), + unbindDocumentScrollListener: /* @__PURE__ */ __name(function unbindDocumentScrollListener() { + if (this.scrollListener) { + window.removeEventListener("scroll", this.scrollListener); + this.scrollListener = null; + } + }, "unbindDocumentScrollListener"), + onEnter: /* @__PURE__ */ __name(function onEnter4(el) { + ZIndex.set("overlay", el, this.$primevue.config.zIndex.overlay); + }, "onEnter"), + onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave4(el) { + ZIndex.clear(el); + }, "onAfterLeave"), + containerRef: /* @__PURE__ */ __name(function containerRef5(el) { + this.container = el ? el.$el : void 0; + }, "containerRef") + }, + computed: { + scrollTopAriaLabel: /* @__PURE__ */ __name(function scrollTopAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.scrollTop : void 0; + }, "scrollTopAriaLabel") + }, + components: { + ChevronUpIcon: script$1j, + Button: script$1e + } +}; +function render$d(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Button = resolveComponent("Button"); + return openBlock(), createBlock(Transition, mergeProps({ + name: "p-scrolltop", + appear: "", + onEnter: $options.onEnter, + onAfterLeave: $options.onAfterLeave + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [$data.visible ? (openBlock(), createBlock(_component_Button, mergeProps({ + key: 0, + ref: $options.containerRef, + "class": _ctx.cx("root"), + onClick: $options.onClick, + "aria-label": $options.scrollTopAriaLabel, + unstyled: _ctx.unstyled + }, _ctx.buttonProps, { + pt: _ctx.pt + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "icon", { + "class": normalizeClass(_ctx.cx("icon")) + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon ? "span" : "ChevronUpIcon"), mergeProps({ + "class": [_ctx.cx("icon"), _ctx.icon, slotProps["class"]] + }, _ctx.ptm("icon")), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "onClick", "aria-label", "unstyled", "pt"])) : createCommentVNode("", true)]; + }), + _: 3 + }, 16, ["onEnter", "onAfterLeave"]); +} +__name(render$d, "render$d"); +script$f.render = render$d; +var script$e = { + name: "Sidebar", + "extends": script$1c, + mounted: /* @__PURE__ */ __name(function mounted34() { + console.warn("Deprecated since v4. Use Drawer component instead."); + }, "mounted") +}; +var SidebarStyle = BaseStyle.extend({ + name: "sidebar" +}); +var theme$7 = /* @__PURE__ */ __name(function theme33(_ref) { + var dt = _ref.dt; + return "\n.p-skeleton {\n overflow: hidden;\n background: ".concat(dt("skeleton.background"), ";\n border-radius: ").concat(dt("skeleton.border.radius"), ';\n}\n\n.p-skeleton::after {\n content: "";\n animation: p-skeleton-animation 1.2s infinite;\n height: 100%;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n transform: translateX(-100%);\n z-index: 1;\n background: linear-gradient(90deg, rgba(255, 255, 255, 0), ').concat(dt("skeleton.animation.background"), ", rgba(255, 255, 255, 0));\n}\n\n[dir='rtl'] .p-skeleton::after {\n animation-name: p-skeleton-animation-rtl;\n}\n\n.p-skeleton-circle {\n border-radius: 50%;\n}\n\n.p-skeleton-animation-none::after {\n animation: none;\n}\n\n@keyframes p-skeleton-animation {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(100%);\n }\n}\n\n@keyframes p-skeleton-animation-rtl {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(-100%);\n }\n}\n"); +}, "theme"); +var inlineStyles$3 = { + root: { + position: "relative" + } +}; +var classes$8 = { + root: /* @__PURE__ */ __name(function root26(_ref2) { + var props = _ref2.props; + return ["p-skeleton p-component", { + "p-skeleton-circle": props.shape === "circle", + "p-skeleton-animation-none": props.animation === "none" + }]; + }, "root") +}; +var SkeletonStyle = BaseStyle.extend({ + name: "skeleton", + theme: theme$7, + classes: classes$8, + inlineStyles: inlineStyles$3 +}); +var script$1$8 = { + name: "BaseSkeleton", + "extends": script$1d, + props: { + shape: { + type: String, + "default": "rectangle" + }, + size: { + type: String, + "default": null + }, + width: { + type: String, + "default": "100%" + }, + height: { + type: String, + "default": "1rem" + }, + borderRadius: { + type: String, + "default": null + }, + animation: { + type: String, + "default": "wave" + } + }, + style: SkeletonStyle, + provide: /* @__PURE__ */ __name(function provide43() { + return { + $pcSkeleton: this, + $parentInstance: this + }; + }, "provide") +}; +var script$d = { + name: "Skeleton", + "extends": script$1$8, + inheritAttrs: false, + computed: { + containerStyle: /* @__PURE__ */ __name(function containerStyle() { + if (this.size) return { + width: this.size, + height: this.size, + borderRadius: this.borderRadius + }; + else return { + width: this.width, + height: this.height, + borderRadius: this.borderRadius + }; + }, "containerStyle") + } +}; +function render$c(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root"), + style: [_ctx.sx("root"), $options.containerStyle], + "aria-hidden": "true" + }, _ctx.ptmi("root")), null, 16); +} +__name(render$c, "render$c"); +script$d.render = render$c; +function _typeof$8(o) { + "@babel/helpers - typeof"; + return _typeof$8 = "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$8(o); +} +__name(_typeof$8, "_typeof$8"); +function _defineProperty$8(e, r, t2) { + return (r = _toPropertyKey$8(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$8, "_defineProperty$8"); +function _toPropertyKey$8(t2) { + var i = _toPrimitive$8(t2, "string"); + return "symbol" == _typeof$8(i) ? i : i + ""; +} +__name(_toPropertyKey$8, "_toPropertyKey$8"); +function _toPrimitive$8(t2, r) { + if ("object" != _typeof$8(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$8(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$8, "_toPrimitive$8"); +var theme$6 = /* @__PURE__ */ __name(function theme34(_ref) { + var dt = _ref.dt; + return "\n.p-speeddial {\n position: static;\n display: flex;\n gap: ".concat(dt("speeddial.gap"), ";\n}\n\n.p-speeddial-button {\n z-index: 1;\n}\n\n.p-speeddial-button.p-speeddial-rotate {\n transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, background ").concat(dt("speeddial.transition.duration"), ", color ").concat(dt("speeddial.transition.duration"), ", border-color ").concat(dt("speeddial.transition.duration"), ",\n box-shadow ").concat(dt("speeddial.transition.duration"), ", outline-color ").concat(dt("speeddial.transition.duration"), ";\n will-change: transform;\n}\n\n.p-speeddial-list {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: inset-block-start 0s linear ").concat(dt("speeddial.transition.duration"), ";\n pointer-events: none;\n outline: 0 none;\n z-index: 2;\n gap: ").concat(dt("speeddial.gap"), ";\n}\n\n.p-speeddial-item {\n transform: scale(0);\n opacity: 0;\n transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, opacity 0.8s;\n will-change: transform;\n}\n\n.p-speeddial-circle .p-speeddial-item,\n.p-speeddial-semi-circle .p-speeddial-item,\n.p-speeddial-quarter-circle .p-speeddial-item {\n position: absolute;\n}\n\n.p-speeddial-mask {\n position: absolute;\n inset-inline-start: 0;\n inset-block-start: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n background: ").concat(dt("mask.background"), ";\n border-radius: 6px;\n transition: opacity 150ms;\n}\n\n.p-speeddial-mask-visible {\n pointer-events: none;\n opacity: 1;\n transition: opacity 150ms;\n}\n\n.p-speeddial-open .p-speeddial-list {\n pointer-events: auto;\n}\n\n.p-speeddial-open .p-speeddial-item {\n transform: scale(1);\n opacity: 1;\n}\n\n.p-speeddial-open .p-speeddial-rotate {\n transform: rotate(45deg);\n}\n"); +}, "theme"); +var inlineStyles$2 = { + root: /* @__PURE__ */ __name(function root27(_ref2) { + var props = _ref2.props; + return { + alignItems: (props.direction === "up" || props.direction === "down") && "center", + justifyContent: (props.direction === "left" || props.direction === "right") && "center", + flexDirection: props.direction === "up" ? "column-reverse" : props.direction === "down" ? "column" : props.direction === "left" ? "row-reverse" : props.direction === "right" ? "row" : null + }; + }, "root"), + list: /* @__PURE__ */ __name(function list(_ref3) { + var props = _ref3.props; + return { + flexDirection: props.direction === "up" ? "column-reverse" : props.direction === "down" ? "column" : props.direction === "left" ? "row-reverse" : props.direction === "right" ? "row" : null + }; + }, "list") +}; +var classes$7 = { + root: /* @__PURE__ */ __name(function root28(_ref4) { + var instance = _ref4.instance, props = _ref4.props; + return ["p-speeddial p-component p-speeddial-".concat(props.type), _defineProperty$8(_defineProperty$8(_defineProperty$8({}, "p-speeddial-direction-".concat(props.direction), props.type !== "circle"), "p-speeddial-open", instance.d_visible), "p-disabled", props.disabled)]; + }, "root"), + pcButton: /* @__PURE__ */ __name(function pcButton(_ref6) { + var props = _ref6.props; + return ["p-speeddial-button", { + "p-speeddial-rotate": props.rotateAnimation && !props.hideIcon + }]; + }, "pcButton"), + list: "p-speeddial-list", + item: "p-speeddial-item", + action: "p-speeddial-action", + actionIcon: "p-speeddial-action-icon", + mask: /* @__PURE__ */ __name(function mask4(_ref7) { + var instance = _ref7.instance; + return ["p-speeddial-mask", { + "p-speeddial-mask-visible": instance.d_visible + }]; + }, "mask") +}; +var SpeedDialStyle = BaseStyle.extend({ + name: "speeddial", + theme: theme$6, + classes: classes$7, + inlineStyles: inlineStyles$2 +}); +var script$1$7 = { + name: "BaseSpeedDial", + "extends": script$1d, + props: { + model: null, + visible: { + type: Boolean, + "default": false + }, + direction: { + type: String, + "default": "up" + }, + transitionDelay: { + type: Number, + "default": 30 + }, + type: { + type: String, + "default": "linear" + }, + radius: { + type: Number, + "default": 0 + }, + mask: { + type: Boolean, + "default": false + }, + disabled: { + type: Boolean, + "default": false + }, + hideOnClickOutside: { + type: Boolean, + "default": true + }, + buttonClass: null, + maskStyle: null, + maskClass: null, + showIcon: { + type: String, + "default": void 0 + }, + hideIcon: { + type: String, + "default": void 0 + }, + rotateAnimation: { + type: Boolean, + "default": true + }, + tooltipOptions: null, + style: null, + "class": null, + buttonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default18() { + return { + rounded: true + }; + }, "_default") + }, + actionButtonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default19() { + return { + severity: "secondary", + rounded: true, + size: "small" + }; + }, "_default") + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + } + }, + style: SpeedDialStyle, + provide: /* @__PURE__ */ __name(function provide44() { + return { + $pcSpeedDial: this, + $parentInstance: this + }; + }, "provide") +}; +function _typeof$7(o) { + "@babel/helpers - typeof"; + return _typeof$7 = "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$7(o); +} +__name(_typeof$7, "_typeof$7"); +function ownKeys$7(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$7, "ownKeys$7"); +function _objectSpread$7(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$7(Object(t2), true).forEach(function(r2) { + _defineProperty$7(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$7(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$7, "_objectSpread$7"); +function _defineProperty$7(e, r, t2) { + return (r = _toPropertyKey$7(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$7, "_defineProperty$7"); +function _toPropertyKey$7(t2) { + var i = _toPrimitive$7(t2, "string"); + return "symbol" == _typeof$7(i) ? i : i + ""; +} +__name(_toPropertyKey$7, "_toPropertyKey$7"); +function _toPrimitive$7(t2, r) { + if ("object" != _typeof$7(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$7(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$7, "_toPrimitive$7"); +function _toConsumableArray$3(r) { + return _arrayWithoutHoles$3(r) || _iterableToArray$3(r) || _unsupportedIterableToArray$3(r) || _nonIterableSpread$3(); +} +__name(_toConsumableArray$3, "_toConsumableArray$3"); +function _nonIterableSpread$3() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableSpread$3, "_nonIterableSpread$3"); +function _unsupportedIterableToArray$3(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$3(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$3(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$3, "_unsupportedIterableToArray$3"); +function _iterableToArray$3(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray$3, "_iterableToArray$3"); +function _arrayWithoutHoles$3(r) { + if (Array.isArray(r)) return _arrayLikeToArray$3(r); +} +__name(_arrayWithoutHoles$3, "_arrayWithoutHoles$3"); +function _arrayLikeToArray$3(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; +} +__name(_arrayLikeToArray$3, "_arrayLikeToArray$3"); +var Math_PI = 3.14159265358979; +var script$c = { + name: "SpeedDial", + "extends": script$1$7, + inheritAttrs: false, + emits: ["click", "show", "hide", "focus", "blur"], + documentClickListener: null, + container: null, + list: null, + data: /* @__PURE__ */ __name(function data32() { + return { + id: this.$attrs.id, + d_visible: this.visible, + isItemClicked: false, + focused: false, + focusedOptionIndex: -1 + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId12(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId"), + visible: /* @__PURE__ */ __name(function visible4(newValue) { + this.d_visible = newValue; + }, "visible") + }, + mounted: /* @__PURE__ */ __name(function mounted35() { + this.id = this.id || UniqueComponentId(); + if (this.type !== "linear") { + var button = findSingle(this.container, '[data-pc-name="pcbutton"]'); + var firstItem = findSingle(this.list, '[data-pc-section="item"]'); + if (button && firstItem) { + var wDiff = Math.abs(button.offsetWidth - firstItem.offsetWidth); + var hDiff = Math.abs(button.offsetHeight - firstItem.offsetHeight); + this.list.style.setProperty($dt("item.diff.x").name, "".concat(wDiff / 2, "px")); + this.list.style.setProperty($dt("item.diff.y").name, "".concat(hDiff / 2, "px")); + } + } + if (this.hideOnClickOutside) { + this.bindDocumentClickListener(); + } + }, "mounted"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount15() { + this.unbindDocumentClickListener(); + }, "beforeUnmount"), + methods: { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions10(id4, key) { + return this.ptm(key, { + context: { + active: this.isItemActive(id4), + hidden: !this.d_visible + } + }); + }, "getPTOptions"), + onFocus: /* @__PURE__ */ __name(function onFocus13(event2) { + this.$emit("focus", event2); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur13(event2) { + this.focusedOptionIndex = -1; + this.$emit("blur", event2); + }, "onBlur"), + onItemClick: /* @__PURE__ */ __name(function onItemClick7(e, item8) { + if (item8.command) { + item8.command({ + originalEvent: e, + item: item8 + }); + } + this.hide(); + this.isItemClicked = true; + e.preventDefault(); + }, "onItemClick"), + onClick: /* @__PURE__ */ __name(function onClick6(event2) { + this.d_visible ? this.hide() : this.show(); + this.isItemClicked = true; + this.$emit("click", event2); + }, "onClick"), + show: /* @__PURE__ */ __name(function show5() { + this.d_visible = true; + this.$emit("show"); + }, "show"), + hide: /* @__PURE__ */ __name(function hide6() { + this.d_visible = false; + this.$emit("hide"); + }, "hide"), + calculateTransitionDelay: /* @__PURE__ */ __name(function calculateTransitionDelay(index) { + var length = this.model.length; + var visible7 = this.d_visible; + return (visible7 ? index : length - index - 1) * this.transitionDelay; + }, "calculateTransitionDelay"), + onTogglerKeydown: /* @__PURE__ */ __name(function onTogglerKeydown(event2) { + switch (event2.code) { + case "ArrowDown": + case "ArrowLeft": + this.onTogglerArrowDown(event2); + break; + case "ArrowUp": + case "ArrowRight": + this.onTogglerArrowUp(event2); + break; + case "Escape": + this.onEscapeKey(); + break; + } + }, "onTogglerKeydown"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown11(event2) { + switch (event2.code) { + case "ArrowDown": + this.onArrowDown(event2); + break; + case "ArrowUp": + this.onArrowUp(event2); + break; + case "ArrowLeft": + this.onArrowLeft(event2); + break; + case "ArrowRight": + this.onArrowRight(event2); + break; + case "Enter": + case "NumpadEnter": + case "Space": + this.onEnterKey(event2); + break; + case "Escape": + this.onEscapeKey(event2); + break; + case "Home": + this.onHomeKey(event2); + break; + case "End": + this.onEndKey(event2); + break; + } + }, "onKeyDown"), + onTogglerArrowUp: /* @__PURE__ */ __name(function onTogglerArrowUp(event2) { + this.show(); + this.navigatePrevItem(event2); + event2.preventDefault(); + }, "onTogglerArrowUp"), + onTogglerArrowDown: /* @__PURE__ */ __name(function onTogglerArrowDown(event2) { + this.show(); + this.navigateNextItem(event2); + event2.preventDefault(); + }, "onTogglerArrowDown"), + onEnterKey: /* @__PURE__ */ __name(function onEnterKey7(event2) { + var _this = this; + var items2 = find(this.container, '[data-pc-section="item"]'); + var itemIndex = _toConsumableArray$3(items2).findIndex(function(item8) { + return item8.id === _this.focusedOptionIndex; + }); + var buttonEl = findSingle(this.container, "button"); + this.onItemClick(event2, this.model[itemIndex]); + this.onBlur(event2); + buttonEl && focus(buttonEl); + }, "onEnterKey"), + onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey4() { + this.hide(); + var buttonEl = findSingle(this.container, "button"); + buttonEl && focus(buttonEl); + }, "onEscapeKey"), + onArrowUp: /* @__PURE__ */ __name(function onArrowUp(event2) { + if (this.direction === "down") { + this.navigatePrevItem(event2); + } else { + this.navigateNextItem(event2); + } + }, "onArrowUp"), + onArrowDown: /* @__PURE__ */ __name(function onArrowDown(event2) { + if (this.direction === "down") { + this.navigateNextItem(event2); + } else { + this.navigatePrevItem(event2); + } + }, "onArrowDown"), + onArrowLeft: /* @__PURE__ */ __name(function onArrowLeft(event2) { + var leftValidDirections = ["left", "up-right", "down-left"]; + var rightValidDirections = ["right", "up-left", "down-right"]; + if (leftValidDirections.includes(this.direction)) { + this.navigateNextItem(event2); + } else if (rightValidDirections.includes(this.direction)) { + this.navigatePrevItem(event2); + } else { + this.navigatePrevItem(event2); + } + }, "onArrowLeft"), + onArrowRight: /* @__PURE__ */ __name(function onArrowRight(event2) { + var leftValidDirections = ["left", "up-right", "down-left"]; + var rightValidDirections = ["right", "up-left", "down-right"]; + if (leftValidDirections.includes(this.direction)) { + this.navigatePrevItem(event2); + } else if (rightValidDirections.includes(this.direction)) { + this.navigateNextItem(event2); + } else { + this.navigateNextItem(event2); + } + }, "onArrowRight"), + onEndKey: /* @__PURE__ */ __name(function onEndKey8(event2) { + event2.preventDefault(); + this.focusedOptionIndex = -1; + this.navigatePrevItem(event2); + }, "onEndKey"), + onHomeKey: /* @__PURE__ */ __name(function onHomeKey8(event2) { + event2.preventDefault(); + this.focusedOptionIndex = -1; + this.navigateNextItem(event2); + }, "onHomeKey"), + navigateNextItem: /* @__PURE__ */ __name(function navigateNextItem(event2) { + var optionIndex = this.findNextOptionIndex(this.focusedOptionIndex); + this.changeFocusedOptionIndex(optionIndex); + event2.preventDefault(); + }, "navigateNextItem"), + navigatePrevItem: /* @__PURE__ */ __name(function navigatePrevItem(event2) { + var optionIndex = this.findPrevOptionIndex(this.focusedOptionIndex); + this.changeFocusedOptionIndex(optionIndex); + event2.preventDefault(); + }, "navigatePrevItem"), + changeFocusedOptionIndex: /* @__PURE__ */ __name(function changeFocusedOptionIndex5(index) { + var items2 = find(this.container, '[data-pc-section="item"]'); + var filteredItems = _toConsumableArray$3(items2).filter(function(item8) { + return !hasClass(findSingle(item8, "a"), "p-disabled"); + }); + if (filteredItems[index]) { + this.focusedOptionIndex = filteredItems[index].getAttribute("id"); + var buttonEl = findSingle(filteredItems[index], '[type="button"]'); + buttonEl && focus(buttonEl); + } + }, "changeFocusedOptionIndex"), + findPrevOptionIndex: /* @__PURE__ */ __name(function findPrevOptionIndex5(index) { + var items2 = find(this.container, '[data-pc-section="item"]'); + var filteredItems = _toConsumableArray$3(items2).filter(function(item8) { + return !hasClass(findSingle(item8, "a"), "p-disabled"); + }); + var newIndex = index === -1 ? filteredItems[filteredItems.length - 1].id : index; + var matchedOptionIndex = filteredItems.findIndex(function(link) { + return link.getAttribute("id") === newIndex; + }); + matchedOptionIndex = index === -1 ? filteredItems.length - 1 : matchedOptionIndex - 1; + return matchedOptionIndex; + }, "findPrevOptionIndex"), + findNextOptionIndex: /* @__PURE__ */ __name(function findNextOptionIndex5(index) { + var items2 = find(this.container, '[data-pc-section="item"]'); + var filteredItems = _toConsumableArray$3(items2).filter(function(item8) { + return !hasClass(findSingle(item8, "a"), "p-disabled"); + }); + var newIndex = index === -1 ? filteredItems[0].id : index; + var matchedOptionIndex = filteredItems.findIndex(function(link) { + return link.getAttribute("id") === newIndex; + }); + matchedOptionIndex = index === -1 ? 0 : matchedOptionIndex + 1; + return matchedOptionIndex; + }, "findNextOptionIndex"), + calculatePointStyle: /* @__PURE__ */ __name(function calculatePointStyle(index) { + var type = this.type; + if (type !== "linear") { + var length = this.model.length; + var radius = this.radius || length * 20; + if (type === "circle") { + var step = 2 * Math_PI / length; + return { + left: "calc(".concat(radius * Math.cos(step * index), "px + ").concat($dt("item.diff.x", "0px").variable, ")"), + top: "calc(".concat(radius * Math.sin(step * index), "px + ").concat($dt("item.diff.y", "0px").variable, ")") + }; + } else if (type === "semi-circle") { + var direction = this.direction; + var _step = Math_PI / (length - 1); + var x = "calc(".concat(radius * Math.cos(_step * index), "px + ").concat($dt("item.diff.x", "0px").variable, ")"); + var y = "calc(".concat(radius * Math.sin(_step * index), "px + ").concat($dt("item.diff.y", "0px").variable, ")"); + if (direction === "up") { + return { + left: x, + bottom: y + }; + } else if (direction === "down") { + return { + left: x, + top: y + }; + } else if (direction === "left") { + return { + right: y, + top: x + }; + } else if (direction === "right") { + return { + left: y, + top: x + }; + } + } else if (type === "quarter-circle") { + var _direction = this.direction; + var _step2 = Math_PI / (2 * (length - 1)); + var _x = "calc(".concat(radius * Math.cos(_step2 * index), "px + ").concat($dt("item.diff.x", "0px").variable, ")"); + var _y = "calc(".concat(radius * Math.sin(_step2 * index), "px + ").concat($dt("item.diff.y", "0px").variable, ")"); + if (_direction === "up-left") { + return { + right: _x, + bottom: _y + }; + } else if (_direction === "up-right") { + return { + left: _x, + bottom: _y + }; + } else if (_direction === "down-left") { + return { + right: _y, + top: _x + }; + } else if (_direction === "down-right") { + return { + left: _y, + top: _x + }; + } + } + } + return {}; + }, "calculatePointStyle"), + getItemStyle: /* @__PURE__ */ __name(function getItemStyle(index) { + var transitionDelay = this.calculateTransitionDelay(index); + var pointStyle = this.calculatePointStyle(index); + return _objectSpread$7({ + transitionDelay: "".concat(transitionDelay, "ms") + }, pointStyle); + }, "getItemStyle"), + bindDocumentClickListener: /* @__PURE__ */ __name(function bindDocumentClickListener() { + var _this2 = this; + if (!this.documentClickListener) { + this.documentClickListener = function(event2) { + if (_this2.d_visible && _this2.isOutsideClicked(event2)) { + _this2.hide(); + } + _this2.isItemClicked = false; + }; + document.addEventListener("click", this.documentClickListener); + } + }, "bindDocumentClickListener"), + unbindDocumentClickListener: /* @__PURE__ */ __name(function unbindDocumentClickListener() { + if (this.documentClickListener) { + document.removeEventListener("click", this.documentClickListener); + this.documentClickListener = null; + } + }, "unbindDocumentClickListener"), + isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked4(event2) { + return this.container && !(this.container.isSameNode(event2.target) || this.container.contains(event2.target) || this.isItemClicked); + }, "isOutsideClicked"), + isItemVisible: /* @__PURE__ */ __name(function isItemVisible6(item8) { + return typeof item8.visible === "function" ? item8.visible() : item8.visible !== false; + }, "isItemVisible"), + isItemActive: /* @__PURE__ */ __name(function isItemActive7(id4) { + return id4 === this.focusedOptionId; + }, "isItemActive"), + containerRef: /* @__PURE__ */ __name(function containerRef6(el) { + this.container = el; + }, "containerRef"), + listRef: /* @__PURE__ */ __name(function listRef3(el) { + this.list = el; + }, "listRef") + }, + computed: { + containerClass: /* @__PURE__ */ __name(function containerClass3() { + return [this.cx("root"), this["class"]]; + }, "containerClass"), + focusedOptionId: /* @__PURE__ */ __name(function focusedOptionId6() { + return this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : null; + }, "focusedOptionId") + }, + components: { + Button: script$1e, + PlusIcon: script$1x + }, + directives: { + ripple: Ripple, + tooltip: Tooltip + } +}; +var _hoisted_1$a = ["id"]; +var _hoisted_2$7 = ["id", "data-p-active"]; +function render$b(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Button = resolveComponent("Button"); + var _directive_tooltip = resolveDirective("tooltip"); + return openBlock(), createElementBlock(Fragment, null, [createBaseVNode("div", mergeProps({ + ref: $options.containerRef, + "class": $options.containerClass, + style: [_ctx.style, _ctx.sx("root")] + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "button", { + visible: $data.d_visible, + toggleCallback: $options.onClick + }, function() { + return [createVNode(_component_Button, mergeProps({ + "class": [_ctx.cx("pcButton"), _ctx.buttonClass], + disabled: _ctx.disabled, + "aria-expanded": $data.d_visible, + "aria-haspopup": true, + "aria-controls": $data.id + "_list", + "aria-label": _ctx.ariaLabel, + "aria-labelledby": _ctx.ariaLabelledby, + unstyled: _ctx.unstyled, + onClick: _cache[0] || (_cache[0] = function($event) { + return $options.onClick($event); + }), + onKeydown: $options.onTogglerKeydown + }, _ctx.buttonProps, { + pt: _ctx.ptm("pcButton") + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "icon", { + visible: $data.d_visible + }, function() { + return [$data.d_visible && !!_ctx.hideIcon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.hideIcon ? "span" : "PlusIcon"), mergeProps({ + key: 0, + "class": [_ctx.hideIcon, slotProps["class"]] + }, _ctx.ptm("pcButton")["icon"], { + "data-pc-section": "icon" + }), null, 16, ["class"])) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.showIcon ? "span" : "PlusIcon"), mergeProps({ + key: 1, + "class": [$data.d_visible && !!_ctx.hideIcon ? _ctx.hideIcon : _ctx.showIcon, slotProps["class"]] + }, _ctx.ptm("pcButton")["icon"], { + "data-pc-section": "icon" + }), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "disabled", "aria-expanded", "aria-controls", "aria-label", "aria-labelledby", "unstyled", "onKeydown", "pt"])]; + }), createBaseVNode("ul", mergeProps({ + ref: $options.listRef, + id: $data.id + "_list", + "class": _ctx.cx("list"), + style: _ctx.sx("list"), + role: "menu", + tabindex: "-1", + onFocus: _cache[1] || (_cache[1] = function() { + return $options.onFocus && $options.onFocus.apply($options, arguments); + }), + onBlur: _cache[2] || (_cache[2] = function() { + return $options.onBlur && $options.onBlur.apply($options, arguments); + }), + onKeydown: _cache[3] || (_cache[3] = function() { + return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); + }) + }, _ctx.ptm("list")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model, function(item8, index) { + return openBlock(), createElementBlock(Fragment, { + key: index + }, [$options.isItemVisible(item8) ? (openBlock(), createElementBlock("li", mergeProps({ + key: 0, + id: "".concat($data.id, "_").concat(index), + "class": _ctx.cx("item", { + id: "".concat($data.id, "_").concat(index) + }), + style: $options.getItemStyle(index), + role: "none", + "data-p-active": $options.isItemActive("".concat($data.id, "_").concat(index)), + ref_for: true + }, $options.getPTOptions("".concat($data.id, "_").concat(index), "item")), [!_ctx.$slots.item ? withDirectives((openBlock(), createBlock(_component_Button, mergeProps({ + key: 0, + tabindex: -1, + role: "menuitem", + "class": _ctx.cx("pcAction", { + item: item8 + }), + "aria-label": item8.label, + disabled: _ctx.disabled, + unstyled: _ctx.unstyled, + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return $options.onItemClick($event, item8); + }, "onClick"), + ref_for: true + }, _ctx.actionButtonProps, { + pt: $options.getPTOptions("".concat($data.id, "_").concat(index), "pcAction") + }), createSlots({ + _: 2 + }, [item8.icon ? { + name: "icon", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "itemicon", { + item: item8, + "class": normalizeClass(slotProps["class"]) + }, function() { + return [createBaseVNode("span", mergeProps({ + "class": [item8.icon, slotProps["class"]], + ref_for: true + }, $options.getPTOptions("".concat($data.id, "_").concat(index), "actionIcon")), null, 16)]; + })]; + }), + key: "0" + } : void 0]), 1040, ["class", "aria-label", "disabled", "unstyled", "onClick", "pt"])), [[_directive_tooltip, { + value: item8.label, + disabled: !_ctx.tooltipOptions + }, _ctx.tooltipOptions]]) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.item), { + key: 1, + item: item8, + onClick: /* @__PURE__ */ __name(function onClick11(event2) { + return $options.onItemClick(event2, item8); + }, "onClick"), + toggleCallback: /* @__PURE__ */ __name(function toggleCallback(event2) { + return $options.onItemClick(event2, item8); + }, "toggleCallback") + }, null, 8, ["item", "onClick", "toggleCallback"]))], 16, _hoisted_2$7)) : createCommentVNode("", true)], 64); + }), 128))], 16, _hoisted_1$a)], 16), _ctx.mask ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": [_ctx.cx("mask"), _ctx.maskClass], + style: _ctx.maskStyle + }, _ctx.ptm("mask")), null, 16)) : createCommentVNode("", true)], 64); +} +__name(render$b, "render$b"); +script$c.render = render$b; +var classes$6 = { + root: /* @__PURE__ */ __name(function root29(_ref) { + var instance = _ref.instance; + return ["p-stepitem", { + "p-stepitem-active": instance.isActive + }]; + }, "root") +}; +var StepItemStyle = BaseStyle.extend({ + name: "stepitem", + classes: classes$6 +}); +var script$1$6 = { + name: "BaseStepItem", + "extends": script$1d, + props: { + value: { + type: [String, Number], + "default": void 0 + } + }, + style: StepItemStyle, + provide: /* @__PURE__ */ __name(function provide45() { + return { + $pcStepItem: this, + $parentInstance: this + }; + }, "provide") +}; +var script$b = { + name: "StepItem", + "extends": script$1$6, + inheritAttrs: false, + inject: ["$pcStepper"], + computed: { + isActive: /* @__PURE__ */ __name(function isActive() { + var _this$$pcStepper; + return ((_this$$pcStepper = this.$pcStepper) === null || _this$$pcStepper === void 0 ? void 0 : _this$$pcStepper.d_value) === this.value; + }, "isActive") + } +}; +var _hoisted_1$9 = ["data-p-active"]; +function render$a(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root"), + "data-p-active": $options.isActive + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$9); +} +__name(render$a, "render$a"); +script$b.render = render$a; +var theme$5 = /* @__PURE__ */ __name(function theme35(_ref) { + var dt = _ref.dt; + return '\n.p-steps {\n position: relative;\n}\n\n.p-steps-list {\n padding: 0;\n margin: 0;\n list-style-type: none;\n display: flex;\n}\n\n.p-steps-item {\n position: relative;\n display: flex;\n justify-content: center;\n flex: 1 1 auto;\n}\n\n.p-steps-item.p-disabled,\n.p-steps-item.p-disabled * {\n opacity: 1;\n pointer-events: auto;\n user-select: auto;\n cursor: auto;\n}\n\n.p-steps-item:before {\n content: " ";\n border-top: 2px solid '.concat(dt("steps.separator.background"), ";\n width: 100%;\n top: 50%;\n left: 0;\n display: block;\n position: absolute;\n margin-top: calc(-1rem + 1px);\n}\n\n.p-steps-item:first-child::before {\n width: calc(50% + 1rem);\n transform: translateX(100%);\n}\n\n.p-steps-item:last-child::before {\n width: 50%;\n}\n\n.p-steps-item-link {\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n overflow: hidden;\n text-decoration: none;\n transition: outline-color ").concat(dt("steps.transition.duration"), ", box-shadow ").concat(dt("steps.transition.duration"), ";\n border-radius: ").concat(dt("steps.item.link.border.radius"), ";\n outline-color: transparent;\n gap: ").concat(dt("steps.item.link.gap"), ";\n}\n\n.p-steps-item-link:not(.p-disabled):focus-visible {\n box-shadow: ").concat(dt("steps.item.link.focus.ring.shadow"), ";\n outline: ").concat(dt("steps.item.link.focus.ring.width"), " ").concat(dt("steps.item.link.focus.ring.style"), " ").concat(dt("steps.item.link.focus.ring.color"), ";\n outline-offset: ").concat(dt("steps.item.link.focus.ring.offset"), ";\n}\n\n.p-steps-item-label {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n color: ").concat(dt("steps.item.label.color"), ";\n display: block;\n font-weight: ").concat(dt("steps.item.label.font.weight"), ";\n}\n\n.p-steps-item-number {\n display: flex;\n align-items: center;\n justify-content: center;\n color: ").concat(dt("steps.item.number.color"), ";\n border: 2px solid ").concat(dt("steps.item.number.border.color"), ";\n background: ").concat(dt("steps.item.number.background"), ";\n min-width: ").concat(dt("steps.item.number.size"), ";\n height: ").concat(dt("steps.item.number.size"), ";\n line-height: ").concat(dt("steps.item.number.size"), ";\n font-size: ").concat(dt("steps.item.number.font.size"), ";\n z-index: 1;\n border-radius: ").concat(dt("steps.item.number.border.radius"), ";\n position: relative;\n font-weight: ").concat(dt("steps.item.number.font.weight"), ';\n}\n\n.p-steps-item-number::after {\n content: " ";\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: ').concat(dt("steps.item.number.border.radius"), ";\n box-shadow: ").concat(dt("steps.item.number.shadow"), ";\n}\n\n.p-steps:not(.p-readonly) .p-steps-item {\n cursor: pointer;\n}\n\n.p-steps-item-active .p-steps-item-number {\n background: ").concat(dt("steps.item.number.active.background"), ";\n border-color: ").concat(dt("steps.item.number.active.border.color"), ";\n color: ").concat(dt("steps.item.number.active.color"), ";\n}\n\n.p-steps-item-active .p-steps-item-label {\n color: ").concat(dt("steps.item.label.active.color"), ";\n}\n"); +}, "theme"); +var classes$5 = { + root: /* @__PURE__ */ __name(function root30(_ref2) { + var props = _ref2.props; + return ["p-steps p-component", { + "p-readonly": props.readonly + }]; + }, "root"), + list: "p-steps-list", + item: /* @__PURE__ */ __name(function item6(_ref3) { + var instance = _ref3.instance, _item = _ref3.item, index = _ref3.index; + return ["p-steps-item", { + "p-steps-item-active": instance.isActive(index), + "p-disabled": instance.isItemDisabled(_item, index) + }]; + }, "item"), + itemLink: "p-steps-item-link", + itemNumber: "p-steps-item-number", + itemLabel: "p-steps-item-label" +}; +var StepsStyle = BaseStyle.extend({ + name: "steps", + theme: theme$5, + classes: classes$5 +}); +var script$1$5 = { + name: "BaseSteps", + "extends": script$1d, + props: { + id: { + type: String + }, + model: { + type: Array, + "default": null + }, + readonly: { + type: Boolean, + "default": true + }, + activeStep: { + type: Number, + "default": 0 + } + }, + style: StepsStyle, + provide: /* @__PURE__ */ __name(function provide46() { + return { + $pcSteps: this, + $parentInstance: this + }; + }, "provide") +}; +var script$a = { + name: "Steps", + "extends": script$1$5, + inheritAttrs: false, + emits: ["update:activeStep", "step-change"], + data: /* @__PURE__ */ __name(function data33() { + return { + d_activeStep: this.activeStep + }; + }, "data"), + watch: { + activeStep: /* @__PURE__ */ __name(function activeStep(newValue) { + this.d_activeStep = newValue; + }, "activeStep") + }, + mounted: /* @__PURE__ */ __name(function mounted36() { + var firstItem = this.findFirstItem(); + firstItem && (firstItem.tabIndex = "0"); + }, "mounted"), + methods: { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions11(key, item8, index) { + return this.ptm(key, { + context: { + item: item8, + index, + active: this.isActive(index), + disabled: this.isItemDisabled(item8, index) + } + }); + }, "getPTOptions"), + onItemClick: /* @__PURE__ */ __name(function onItemClick8(event2, item8, index) { + if (this.disabled(item8) || this.readonly) { + event2.preventDefault(); + return; + } + if (item8.command) { + item8.command({ + originalEvent: event2, + item: item8 + }); + } + if (index !== this.d_activeStep) { + this.d_activeStep = index; + this.$emit("update:activeStep", this.d_activeStep); + } + this.$emit("step-change", { + originalEvent: event2, + index + }); + }, "onItemClick"), + onItemKeydown: /* @__PURE__ */ __name(function onItemKeydown(event2, item8) { + switch (event2.code) { + case "ArrowRight": { + this.navigateToNextItem(event2.target); + event2.preventDefault(); + break; + } + case "ArrowLeft": { + this.navigateToPrevItem(event2.target); + event2.preventDefault(); + break; + } + case "Home": { + this.navigateToFirstItem(event2.target); + event2.preventDefault(); + break; + } + case "End": { + this.navigateToLastItem(event2.target); + event2.preventDefault(); + break; + } + case "Tab": + break; + case "Enter": + case "NumpadEnter": + case "Space": { + this.onItemClick(event2, item8); + event2.preventDefault(); + break; + } + } + }, "onItemKeydown"), + navigateToNextItem: /* @__PURE__ */ __name(function navigateToNextItem(target) { + var nextItem = this.findNextItem(target); + nextItem && this.setFocusToMenuitem(target, nextItem); + }, "navigateToNextItem"), + navigateToPrevItem: /* @__PURE__ */ __name(function navigateToPrevItem(target) { + var prevItem = this.findPrevItem(target); + prevItem && this.setFocusToMenuitem(target, prevItem); + }, "navigateToPrevItem"), + navigateToFirstItem: /* @__PURE__ */ __name(function navigateToFirstItem(target) { + var firstItem = this.findFirstItem(target); + firstItem && this.setFocusToMenuitem(target, firstItem); + }, "navigateToFirstItem"), + navigateToLastItem: /* @__PURE__ */ __name(function navigateToLastItem(target) { + var lastItem = this.findLastItem(target); + lastItem && this.setFocusToMenuitem(target, lastItem); + }, "navigateToLastItem"), + findNextItem: /* @__PURE__ */ __name(function findNextItem2(item8) { + var nextItem = item8.parentElement.nextElementSibling; + return nextItem ? nextItem.children[0] : null; + }, "findNextItem"), + findPrevItem: /* @__PURE__ */ __name(function findPrevItem2(item8) { + var prevItem = item8.parentElement.previousElementSibling; + return prevItem ? prevItem.children[0] : null; + }, "findPrevItem"), + findFirstItem: /* @__PURE__ */ __name(function findFirstItem2() { + var firstSibling = findSingle(this.$refs.list, '[data-pc-section="item"]'); + return firstSibling ? firstSibling.children[0] : null; + }, "findFirstItem"), + findLastItem: /* @__PURE__ */ __name(function findLastItem2() { + var siblings = find(this.$refs.list, '[data-pc-section="item"]'); + return siblings ? siblings[siblings.length - 1].children[0] : null; + }, "findLastItem"), + setFocusToMenuitem: /* @__PURE__ */ __name(function setFocusToMenuitem(target, focusableItem) { + target.tabIndex = "-1"; + focusableItem.tabIndex = "0"; + focusableItem.focus(); + }, "setFocusToMenuitem"), + isActive: /* @__PURE__ */ __name(function isActive2(index) { + return index === this.d_activeStep; + }, "isActive"), + isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled6(item8, index) { + return this.disabled(item8) || this.readonly && !this.isActive(index); + }, "isItemDisabled"), + visible: /* @__PURE__ */ __name(function visible5(item8) { + return typeof item8.visible === "function" ? item8.visible() : item8.visible !== false; + }, "visible"), + disabled: /* @__PURE__ */ __name(function disabled5(item8) { + return typeof item8.disabled === "function" ? item8.disabled() : item8.disabled; + }, "disabled"), + label: /* @__PURE__ */ __name(function label8(item8) { + return typeof item8.label === "function" ? item8.label() : item8.label; + }, "label"), + getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps7(item8, index) { + var _this = this; + return { + action: mergeProps({ + "class": this.cx("itemLink"), + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return _this.onItemClick($event, item8); + }, "onClick"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown15($event) { + return _this.onItemKeydown($event, item8); + }, "onKeyDown") + }, this.getPTOptions("itemLink", item8, index)), + step: mergeProps({ + "class": this.cx("itemNumber") + }, this.getPTOptions("itemNumber", item8, index)), + label: mergeProps({ + "class": this.cx("itemLabel") + }, this.getPTOptions("itemLabel", item8, index)) + }; + }, "getMenuItemProps") + } +}; +var _hoisted_1$8 = ["id"]; +var _hoisted_2$6 = ["aria-current", "onClick", "onKeydown", "data-p-active", "data-p-disabled"]; +function render$9(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("nav", mergeProps({ + id: _ctx.id, + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [createBaseVNode("ol", mergeProps({ + ref: "list", + "class": _ctx.cx("list") + }, _ctx.ptm("list")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model, function(item8, index) { + return openBlock(), createElementBlock(Fragment, { + key: $options.label(item8) + "_" + index.toString() + }, [$options.visible(item8) ? (openBlock(), createElementBlock("li", mergeProps({ + key: 0, + "class": [_ctx.cx("item", { + item: item8, + index + }), item8["class"]], + style: item8.style, + "aria-current": $options.isActive(index) ? "step" : void 0, + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return $options.onItemClick($event, item8, index); + }, "onClick"), + onKeydown: /* @__PURE__ */ __name(function onKeydown6($event) { + return $options.onItemKeydown($event, item8, index); + }, "onKeydown"), + ref_for: true + }, $options.getPTOptions("item", item8, index), { + "data-p-active": $options.isActive(index), + "data-p-disabled": $options.isItemDisabled(item8, index) + }), [!_ctx.$slots.item ? (openBlock(), createElementBlock("span", mergeProps({ + key: 0, + "class": _ctx.cx("itemLink"), + ref_for: true + }, $options.getPTOptions("itemLink", item8, index)), [createBaseVNode("span", mergeProps({ + "class": _ctx.cx("itemNumber"), + ref_for: true + }, $options.getPTOptions("itemNumber", item8, index)), toDisplayString(index + 1), 17), createBaseVNode("span", mergeProps({ + "class": _ctx.cx("itemLabel"), + ref_for: true + }, $options.getPTOptions("itemLabel", item8, index)), toDisplayString($options.label(item8)), 17)], 16)) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.item), { + key: 1, + item: item8, + index, + active: index === $data.d_activeStep, + label: $options.label(item8), + props: $options.getMenuItemProps(item8, index) + }, null, 8, ["item", "index", "active", "label", "props"]))], 16, _hoisted_2$6)) : createCommentVNode("", true)], 64); + }), 128))], 16)], 16, _hoisted_1$8); +} +__name(render$9, "render$9"); +script$a.render = render$9; +var StyleClassStyle = BaseStyle.extend({ + name: "styleclass-directive" +}); +var BaseStyleClass = BaseDirective.extend({ + style: StyleClassStyle +}); +var StyleClass = BaseStyleClass.extend("styleclass", { + mounted: /* @__PURE__ */ __name(function mounted37(el, binding) { + el.setAttribute("data-pd-styleclass", true); + this.bind(el, binding); + }, "mounted"), + unmounted: /* @__PURE__ */ __name(function unmounted5(el) { + this.unbind(el); + }, "unmounted"), + methods: { + bind: /* @__PURE__ */ __name(function bind(el, binding) { + var _this = this; + var target = this.resolveTarget(el, binding); + this.$el = target; + el.$_pstyleclass_clicklistener = function() { + if (binding.value.toggleClass) { + if (hasClass(target, binding.value.toggleClass)) removeClass(target, binding.value.toggleClass); + else addClass(target, binding.value.toggleClass); + } else { + if (target.offsetParent === null) _this.enter(target, el, binding); + else _this.leave(target, binding); + } + }; + el.addEventListener("click", el.$_pstyleclass_clicklistener); + }, "bind"), + unbind: /* @__PURE__ */ __name(function unbind(el) { + if (el.$_pstyleclass_clicklistener) { + el.removeEventListener("click", el.$_pstyleclass_clicklistener); + el.$_pstyleclass_clicklistener = null; + } + this.unbindDocumentListener(el); + }, "unbind"), + enter: /* @__PURE__ */ __name(function enter2(target, el, binding) { + if (binding.value.enterActiveClass) { + if (!target.$_pstyleclass_animating) { + target.$_pstyleclass_animating = true; + if (binding.value.enterActiveClass.includes("slidedown")) { + target.style.height = "0px"; + removeClass(target, binding.value.hiddenClass || binding.value.enterFromClass); + target.style.maxHeight = target.scrollHeight + "px"; + addClass(target, binding.value.hiddenClass || binding.value.enterActiveClass); + target.style.height = ""; + } + addClass(target, binding.value.enterActiveClass); + if (binding.value.enterFromClass) { + removeClass(target, binding.value.enterFromClass); + } + target.$p_styleclass_enterlistener = function() { + removeClass(target, binding.value.enterActiveClass); + if (binding.value.enterToClass) { + addClass(target, binding.value.enterToClass); + } + target.removeEventListener("animationend", target.$p_styleclass_enterlistener); + if (binding.value.enterActiveClass.includes("slidedown")) { + target.style.maxHeight = ""; + } + target.$_pstyleclass_animating = false; + }; + target.addEventListener("animationend", target.$p_styleclass_enterlistener); + } + } else { + if (binding.value.enterFromClass) { + removeClass(target, binding.value.enterFromClass); + } + if (binding.value.enterToClass) { + addClass(target, binding.value.enterToClass); + } + } + if (binding.value.hideOnOutsideClick) { + this.bindDocumentListener(target, el, binding); + } + }, "enter"), + leave: /* @__PURE__ */ __name(function leave2(target, binding) { + if (binding.value.leaveActiveClass) { + if (!target.$_pstyleclass_animating) { + target.$_pstyleclass_animating = true; + addClass(target, binding.value.leaveActiveClass); + if (binding.value.leaveFromClass) { + removeClass(target, binding.value.leaveFromClass); + } + target.$p_styleclass_leavelistener = function() { + removeClass(target, binding.value.leaveActiveClass); + if (binding.value.leaveToClass) { + addClass(target, binding.value.leaveToClass); + } + target.removeEventListener("animationend", target.$p_styleclass_leavelistener); + target.$_pstyleclass_animating = false; + }; + target.addEventListener("animationend", target.$p_styleclass_leavelistener); + } + } else { + if (binding.value.leaveFromClass) { + removeClass(target, binding.value.leaveFromClass); + } + if (binding.value.leaveToClass) { + addClass(target, binding.value.leaveToClass); + } + } + if (binding.value.hideOnOutsideClick) { + this.unbindDocumentListener(target); + } + }, "leave"), + resolveTarget: /* @__PURE__ */ __name(function resolveTarget(el, binding) { + switch (binding.value.selector) { + case "@next": + return el.nextElementSibling; + case "@prev": + return el.previousElementSibling; + case "@parent": + return el.parentElement; + case "@grandparent": + return el.parentElement.parentElement; + default: + return document.querySelector(binding.value.selector); + } + }, "resolveTarget"), + bindDocumentListener: /* @__PURE__ */ __name(function bindDocumentListener(target, el, binding) { + var _this2 = this; + if (!target.$p_styleclass_documentlistener) { + target.$p_styleclass_documentlistener = function(event2) { + if (!_this2.isVisible(target) || getComputedStyle(target).getPropertyValue("position") === "static") { + _this2.unbindDocumentListener(target); + } else if (_this2.isOutsideClick(event2, target, el)) { + _this2.leave(target, binding); + } + }; + target.ownerDocument.addEventListener("click", target.$p_styleclass_documentlistener); + } + }, "bindDocumentListener"), + unbindDocumentListener: /* @__PURE__ */ __name(function unbindDocumentListener(target) { + if (target.$p_styleclass_documentlistener) { + target.ownerDocument.removeEventListener("click", target.$p_styleclass_documentlistener); + target.$p_styleclass_documentlistener = null; + } + }, "unbindDocumentListener"), + isVisible: /* @__PURE__ */ __name(function isVisible(target) { + return target.offsetParent !== null; + }, "isVisible"), + isOutsideClick: /* @__PURE__ */ __name(function isOutsideClick(event2, target, el) { + return !el.isSameNode(event2.target) && !el.contains(event2.target) && !target.contains(event2.target); + }, "isOutsideClick") + } +}); +var theme$4 = /* @__PURE__ */ __name(function theme36(_ref) { + var dt = _ref.dt; + return "\n.p-tabmenu {\n overflow-x: auto;\n}\n\n.p-tabmenu-tablist {\n display: flex;\n margin: 0;\n padding: 0;\n list-style-type: none;\n background: ".concat(dt("tabmenu.tablist.background"), ";\n border-style: solid;\n border-color: ").concat(dt("tabmenu.tablist.border.color"), ";\n border-width: ").concat(dt("tabmenu.tablist.border.width"), ";\n position: relative;\n}\n\n.p-tabmenu-item-link {\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 background: ").concat(dt("tabmenu.item.background"), ";\n border-style: solid;\n border-width: ").concat(dt("tabmenu.item.border.width"), ";\n border-color: ").concat(dt("tabmenu.item.border.color"), ";\n color: ").concat(dt("tabmenu.item.color"), ";\n padding: ").concat(dt("tabmenu.item.padding"), ";\n font-weight: ").concat(dt("tabmenu.item.font.weight"), ";\n transition: background ").concat(dt("tabmenu.transition.duration"), ", border-color ").concat(dt("tabmenu.transition.duration"), ", color ").concat(dt("tabmenu.transition.duration"), ", outline-color ").concat(dt("tabmenu.transition.duration"), ", box-shadow ").concat(dt("tabmenu.transition.duration"), ";\n margin: ").concat(dt("tabmenu.item.margin"), ";\n outline-color: transparent;\n gap: ").concat(dt("tabmenu.item.gap"), ";\n}\n\n.p-tabmenu-item-link:focus-visible {\n z-index: 1;\n box-shadow: ").concat(dt("tabmenu.item.focus.ring.shadow"), ";\n outline: ").concat(dt("tabmenu.item.focus.ring.width"), " ").concat(dt("tabmenu.item.focus.ring.style"), " ").concat(dt("tabmenu.item.focus.ring.color"), ";\n outline-offset: ").concat(dt("tabmenu.item.focus.ring.offset"), ";\n}\n\n.p-tabmenu-item-icon {\n color: ").concat(dt("tabmenu.item.icon.color"), ";\n transition: background ").concat(dt("tabmenu.transition.duration"), ", border-color ").concat(dt("tabmenu.transition.duration"), ", color ").concat(dt("tabmenu.transition.duration"), ", outline-color ").concat(dt("tabmenu.transition.duration"), ", box-shadow ").concat(dt("tabmenu.transition.duration"), ";\n}\n\n.p-tabmenu-item-label {\n line-height: 1;\n}\n\n.p-tabmenu-item:not(.p-tabmenu-item-active):not(.p-disabled):hover .p-tabmenu-item-link {\n background: ").concat(dt("tabmenu.item.hover.background"), ";\n border-color: ").concat(dt("tabmenu.item.hover.border.color"), ";\n color: ").concat(dt("tabmenu.item.hover.color"), ";\n}\n\n.p-tabmenu-item:not(.p-tabmenu-item-active):not(.p-disabled):hover .p-tabmenu-item-icon {\n color: ").concat(dt("tabmenu.item.icon.hover.color"), ";\n}\n\n.p-tabmenu-item-active .p-tabmenu-item-link {\n background: ").concat(dt("tabmenu.item.active.background"), ";\n border-color: ").concat(dt("tabmenu.item.active.border.color"), ";\n color: ").concat(dt("tabmenu.item.active.color"), ";\n}\n\n.p-tabmenu-item-active .p-tabmenu-item-icon {\n color: ").concat(dt("tabmenu.item.icon.active.color"), ";\n}\n\n.p-tabmenu-active-bar {\n z-index: 1;\n display: block;\n position: absolute;\n bottom: ").concat(dt("tabmenu.active.bar.bottom"), ";\n height: ").concat(dt("tabmenu.active.bar.height"), ";\n background: ").concat(dt("tabmenu.active.bar.background"), ";\n transition: 250ms cubic-bezier(0.35, 0, 0.25, 1);\n}\n\n.p-tabmenu::-webkit-scrollbar {\n display: none;\n}\n"); +}, "theme"); +var classes$4 = { + root: "p-tabmenu p-component", + tablist: "p-tabmenu-tablist", + item: /* @__PURE__ */ __name(function item7(_ref2) { + var instance = _ref2.instance, index = _ref2.index, _item = _ref2.item; + return ["p-tabmenu-item", { + "p-tabmenu-item-active": instance.d_activeIndex === index, + "p-disabled": instance.disabled(_item) + }]; + }, "item"), + itemLink: "p-tabmenu-item-link", + itemIcon: "p-tabmenu-item-icon", + itemLabel: "p-tabmenu-item-label", + activeBar: "p-tabmenu-active-bar" +}; +var TabMenuStyle = BaseStyle.extend({ + name: "tabmenu", + theme: theme$4, + classes: classes$4 +}); +var script$1$4 = { + name: "BaseTabMenu", + "extends": script$1d, + props: { + model: { + type: Array, + "default": null + }, + activeIndex: { + type: Number, + "default": 0 + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + } + }, + style: TabMenuStyle, + provide: /* @__PURE__ */ __name(function provide47() { + return { + $pcTabMenu: this, + $parentInstance: this + }; + }, "provide") +}; +var script$9 = { + name: "TabMenu", + "extends": script$1$4, + inheritAttrs: false, + emits: ["update:activeIndex", "tab-change"], + data: /* @__PURE__ */ __name(function data34() { + return { + d_activeIndex: this.activeIndex + }; + }, "data"), + watch: { + activeIndex: { + flush: "post", + handler: /* @__PURE__ */ __name(function handler3(newValue) { + this.d_activeIndex = newValue; + this.updateInkBar(); + }, "handler") + } + }, + mounted: /* @__PURE__ */ __name(function mounted38() { + var _this = this; + this.$nextTick(function() { + _this.updateInkBar(); + }); + var activeItem2 = this.findActiveItem(); + activeItem2 && (activeItem2.tabIndex = "0"); + }, "mounted"), + updated: /* @__PURE__ */ __name(function updated8() { + this.updateInkBar(); + }, "updated"), + methods: { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions12(key, item8, index) { + return this.ptm(key, { + context: { + item: item8, + index + } + }); + }, "getPTOptions"), + onItemClick: /* @__PURE__ */ __name(function onItemClick9(event2, item8, index) { + if (this.disabled(item8)) { + event2.preventDefault(); + return; + } + if (item8.command) { + item8.command({ + originalEvent: event2, + item: item8 + }); + } + if (index !== this.d_activeIndex) { + this.d_activeIndex = index; + this.$emit("update:activeIndex", this.d_activeIndex); + } + this.$emit("tab-change", { + originalEvent: event2, + index + }); + }, "onItemClick"), + onKeydownItem: /* @__PURE__ */ __name(function onKeydownItem(event2, item8, index) { + switch (event2.code) { + case "ArrowRight": { + this.navigateToNextItem(event2.target); + event2.preventDefault(); + break; + } + case "ArrowLeft": { + this.navigateToPrevItem(event2.target); + event2.preventDefault(); + break; + } + case "Home": { + this.navigateToFirstItem(event2.target); + event2.preventDefault(); + break; + } + case "End": { + this.navigateToLastItem(event2.target); + event2.preventDefault(); + break; + } + case "Space": + case "NumpadEnter": + case "Enter": { + this.onItemClick(event2, item8, index); + event2.preventDefault(); + break; + } + case "Tab": { + this.onTabKey(); + break; + } + } + }, "onKeydownItem"), + navigateToNextItem: /* @__PURE__ */ __name(function navigateToNextItem2(target) { + var nextItem = this.findNextItem(target); + nextItem && this.setFocusToMenuitem(target, nextItem); + }, "navigateToNextItem"), + navigateToPrevItem: /* @__PURE__ */ __name(function navigateToPrevItem2(target) { + var prevItem = this.findPrevItem(target); + prevItem && this.setFocusToMenuitem(target, prevItem); + }, "navigateToPrevItem"), + navigateToFirstItem: /* @__PURE__ */ __name(function navigateToFirstItem2(target) { + var firstItem = this.findFirstItem(target); + firstItem && this.setFocusToMenuitem(target, firstItem); + }, "navigateToFirstItem"), + navigateToLastItem: /* @__PURE__ */ __name(function navigateToLastItem2(target) { + var lastItem = this.findLastItem(target); + lastItem && this.setFocusToMenuitem(target, lastItem); + }, "navigateToLastItem"), + findNextItem: /* @__PURE__ */ __name(function findNextItem3(item8) { + var nextItem = item8.parentElement.nextElementSibling; + return nextItem ? getAttribute(nextItem, "data-p-disabled") === true ? this.findNextItem(nextItem.children[0]) : nextItem.children[0] : null; + }, "findNextItem"), + findPrevItem: /* @__PURE__ */ __name(function findPrevItem3(item8) { + var prevItem = item8.parentElement.previousElementSibling; + return prevItem ? getAttribute(prevItem, "data-p-disabled") === true ? this.findPrevItem(prevItem.children[0]) : prevItem.children[0] : null; + }, "findPrevItem"), + findFirstItem: /* @__PURE__ */ __name(function findFirstItem3() { + var firstSibling = findSingle(this.$refs.nav, '[data-pc-section="item"][data-p-disabled="false"]'); + return firstSibling ? firstSibling.children[0] : null; + }, "findFirstItem"), + findLastItem: /* @__PURE__ */ __name(function findLastItem3() { + var siblings = find(this.$refs.nav, '[data-pc-section="item"][data-p-disabled="false"]'); + return siblings ? siblings[siblings.length - 1].children[0] : null; + }, "findLastItem"), + findActiveItem: /* @__PURE__ */ __name(function findActiveItem() { + var activeItem2 = findSingle(this.$refs.nav, '[data-pc-section="item"][data-p-disabled="false"][data-p-active="true"]'); + return activeItem2 ? activeItem2.children[0] : null; + }, "findActiveItem"), + setFocusToMenuitem: /* @__PURE__ */ __name(function setFocusToMenuitem2(target, focusableItem) { + target.tabIndex = "-1"; + focusableItem.tabIndex = "0"; + focusableItem.focus(); + }, "setFocusToMenuitem"), + onTabKey: /* @__PURE__ */ __name(function onTabKey4() { + var activeItem2 = findSingle(this.$refs.nav, '[data-pc-section="item"][data-p-disabled="false"][data-p-active="true"]'); + var focusedItem = findSingle(this.$refs.nav, '[data-pc-section="itemlink"][tabindex="0"]'); + if (focusedItem !== activeItem2.children[0]) { + activeItem2 && (activeItem2.children[0].tabIndex = "0"); + focusedItem.tabIndex = "-1"; + } + }, "onTabKey"), + visible: /* @__PURE__ */ __name(function visible6(item8) { + return typeof item8.visible === "function" ? item8.visible() : item8.visible !== false; + }, "visible"), + disabled: /* @__PURE__ */ __name(function disabled6(item8) { + return typeof item8.disabled === "function" ? item8.disabled() : item8.disabled === true; + }, "disabled"), + label: /* @__PURE__ */ __name(function label9(item8) { + return typeof item8.label === "function" ? item8.label() : item8.label; + }, "label"), + updateInkBar: /* @__PURE__ */ __name(function updateInkBar() { + var tabs2 = this.$refs.nav.children; + var inkHighlighted = false; + for (var i = 0; i < tabs2.length; i++) { + var tab = tabs2[i]; + if (getAttribute(tab, "data-p-active")) { + this.$refs.inkbar.style.width = getWidth(tab) + "px"; + this.$refs.inkbar.style.left = getOffset(tab).left - getOffset(this.$refs.nav).left + "px"; + inkHighlighted = true; + } + } + if (!inkHighlighted) { + this.$refs.inkbar.style.width = "0px"; + this.$refs.inkbar.style.left = "0px"; + } + }, "updateInkBar"), + getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps8(item8, index) { + var _this2 = this; + return { + action: mergeProps({ + "class": this.cx("itemLink"), + tabindex: -1, + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return _this2.onItemClick($event, item8, index); + }, "onClick"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown15($event) { + return _this2.onKeydownItem($event, item8, index); + }, "onKeyDown") + }, this.getPTOptions("itemLink", item8, index)), + icon: mergeProps({ + "class": [this.cx("itemIcon"), item8.icon] + }, this.getPTOptions("itemIcon", item8, index)), + label: mergeProps({ + "class": this.cx("itemLabel") + }, this.getPTOptions("itemLabel", item8, index)) + }; + }, "getMenuItemProps") + }, + directives: { + ripple: Ripple + } +}; +var _hoisted_1$7 = ["aria-labelledby", "aria-label"]; +var _hoisted_2$5 = ["onClick", "onKeydown", "data-p-active", "data-p-disabled"]; +var _hoisted_3$5 = ["href", "target", "aria-label", "aria-disabled"]; +function render$8(_ctx, _cache, $props, $setup, $data, $options) { + var _directive_ripple = resolveDirective("ripple"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [createBaseVNode("ul", mergeProps({ + ref: "nav", + "class": _ctx.cx("tablist"), + role: "menubar", + "aria-labelledby": _ctx.ariaLabelledby, + "aria-label": _ctx.ariaLabel + }, _ctx.ptm("tablist")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model, function(item8, i) { + return openBlock(), createElementBlock(Fragment, { + key: $options.label(item8) + "_" + i.toString() + }, [$options.visible(item8) ? (openBlock(), createElementBlock("li", mergeProps({ + key: 0, + ref_for: true, + ref: "tab", + "class": [_ctx.cx("item", { + item: item8, + index: i + }), item8["class"]], + role: "presentation", + onClick: /* @__PURE__ */ __name(function onClick11($event) { + return $options.onItemClick($event, item8, i); + }, "onClick"), + onKeydown: /* @__PURE__ */ __name(function onKeydown6($event) { + return $options.onKeydownItem($event, item8, i); + }, "onKeydown") + }, $options.getPTOptions("item", item8, i), { + "data-p-active": $data.d_activeIndex === i, + "data-p-disabled": $options.disabled(item8) + }), [!_ctx.$slots.item ? withDirectives((openBlock(), createElementBlock("a", mergeProps({ + key: 0, + ref_for: true, + ref: "tabLink", + role: "menuitem", + href: item8.url, + "class": _ctx.cx("itemLink"), + target: item8.target, + "aria-label": $options.label(item8), + "aria-disabled": $options.disabled(item8), + tabindex: -1 + }, $options.getPTOptions("itemLink", item8, i)), [_ctx.$slots.itemicon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.itemicon), { + key: 0, + item: item8, + "class": normalizeClass(_ctx.cx("itemIcon")) + }, null, 8, ["item", "class"])) : item8.icon ? (openBlock(), createElementBlock("span", mergeProps({ + key: 1, + "class": [_ctx.cx("itemIcon"), item8.icon], + ref_for: true + }, $options.getPTOptions("itemIcon", item8, i)), null, 16)) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ + "class": _ctx.cx("itemLabel"), + ref_for: true + }, $options.getPTOptions("itemLabel", item8, i)), toDisplayString($options.label(item8)), 17)], 16, _hoisted_3$5)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.item), { + key: 1, + item: item8, + index: i, + active: i === $data.d_activeIndex, + label: $options.label(item8), + props: $options.getMenuItemProps(item8, i) + }, null, 8, ["item", "index", "active", "label", "props"]))], 16, _hoisted_2$5)) : createCommentVNode("", true)], 64); + }), 128)), createBaseVNode("li", mergeProps({ + ref: "inkbar", + role: "none", + "class": _ctx.cx("activeBar") + }, _ctx.ptm("activeBar")), null, 16)], 16, _hoisted_1$7)], 16); +} +__name(render$8, "render$8"); +script$9.render = render$8; +var TerminalService = EventBus(); +var theme$3 = /* @__PURE__ */ __name(function theme37(_ref) { + var dt = _ref.dt; + return "\n.p-terminal {\n height: ".concat(dt("terminal.height"), ";\n overflow: auto;\n background: ").concat(dt("terminal.background"), ";\n color: ").concat(dt("terminal.color"), ";\n border: 1px solid ").concat(dt("terminal.border.color"), ";\n padding: ").concat(dt("terminal.padding"), ";\n border-radius: ").concat(dt("terminal.border.radius"), ";\n}\n\n.p-terminal-prompt {\n display: flex;\n align-items: center;\n}\n\n.p-terminal-prompt-value {\n flex: 1 1 auto;\n border: 0 none;\n background: transparent;\n color: inherit;\n padding: 0;\n outline: 0 none;\n font-family: inherit;\n font-feature-settings: inherit;\n font-size: 1rem;\n}\n\n.p-terminal-prompt-label {\n margin-inline-end: ").concat(dt("terminal.prompt.gap"), ";\n}\n\n.p-terminal-input::-ms-clear {\n display: none;\n}\n\n.p-terminal-command-response {\n margin: ").concat(dt("terminal.command.response.margin"), ";\n}\n"); +}, "theme"); +var classes$3 = { + root: "p-terminal p-component", + welcomeMessage: "p-terminal-welcome-message", + commandList: "p-terminal-command-list", + command: "p-terminal-command", + commandValue: "p-terminal-command-value", + commandResponse: "p-terminal-command-response", + prompt: "p-terminal-prompt", + promptLabel: "p-terminal-prompt-label", + promptValue: "p-terminal-prompt-value" +}; +var TerminalStyle = BaseStyle.extend({ + name: "terminal", + theme: theme$3, + classes: classes$3 +}); +var script$1$3 = { + name: "BaseTerminal", + "extends": script$1d, + props: { + welcomeMessage: { + type: String, + "default": null + }, + prompt: { + type: String, + "default": null + } + }, + style: TerminalStyle, + provide: /* @__PURE__ */ __name(function provide48() { + return { + $pcTerminal: this, + $parentInstance: this + }; + }, "provide") +}; +var script$8 = { + name: "Terminal", + "extends": script$1$3, + inheritAttrs: false, + data: /* @__PURE__ */ __name(function data35() { + return { + commandText: null, + commands: [] + }; + }, "data"), + mounted: /* @__PURE__ */ __name(function mounted39() { + TerminalService.on("response", this.responseListener); + this.$refs.input.focus(); + }, "mounted"), + updated: /* @__PURE__ */ __name(function updated9() { + this.$el.scrollTop = this.$el.scrollHeight; + }, "updated"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount16() { + TerminalService.off("response", this.responseListener); + }, "beforeUnmount"), + methods: { + onClick: /* @__PURE__ */ __name(function onClick7() { + this.$refs.input.focus(); + }, "onClick"), + onKeydown: /* @__PURE__ */ __name(function onKeydown5(event2) { + if (event2.key === "Enter" && this.commandText) { + this.commands.push({ + text: this.commandText + }); + TerminalService.emit("command", this.commandText); + this.commandText = ""; + } + }, "onKeydown"), + responseListener: /* @__PURE__ */ __name(function responseListener(response) { + this.commands[this.commands.length - 1].response = response; + }, "responseListener") + } +}; +function render$7(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root"), + onClick: _cache[2] || (_cache[2] = function() { + return $options.onClick && $options.onClick.apply($options, arguments); + }) + }, _ctx.ptmi("root")), [_ctx.welcomeMessage ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("welcomeMessage") + }, _ctx.ptm("welcomeMessage")), toDisplayString(_ctx.welcomeMessage), 17)) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("commandList") + }, _ctx.ptm("content")), [(openBlock(true), createElementBlock(Fragment, null, renderList($data.commands, function(command, i) { + return openBlock(), createElementBlock("div", mergeProps({ + key: command.text + i.toString(), + "class": _ctx.cx("command"), + ref_for: true + }, _ctx.ptm("commands")), [createBaseVNode("span", mergeProps({ + "class": _ctx.cx("promptLabel"), + ref_for: true + }, _ctx.ptm("prompt")), toDisplayString(_ctx.prompt), 17), createBaseVNode("span", mergeProps({ + "class": _ctx.cx("commandValue"), + ref_for: true + }, _ctx.ptm("command")), toDisplayString(command.text), 17), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("commandResponse"), + "aria-live": "polite", + ref_for: true + }, _ctx.ptm("response")), toDisplayString(command.response), 17)], 16); + }), 128))], 16), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("prompt") + }, _ctx.ptm("container")), [createBaseVNode("span", mergeProps({ + "class": _ctx.cx("promptLabel") + }, _ctx.ptm("prompt")), toDisplayString(_ctx.prompt), 17), withDirectives(createBaseVNode("input", mergeProps({ + ref: "input", + "onUpdate:modelValue": _cache[0] || (_cache[0] = function($event) { + return $data.commandText = $event; + }), + "class": _ctx.cx("promptValue"), + type: "text", + autocomplete: "off", + onKeydown: _cache[1] || (_cache[1] = function() { + return $options.onKeydown && $options.onKeydown.apply($options, arguments); + }) + }, _ctx.ptm("commandText")), null, 16), [[vModelText, $data.commandText]])], 16)], 16); +} +__name(render$7, "render$7"); +script$8.render = render$7; +var theme$2 = /* @__PURE__ */ __name(function theme38(_ref) { + var dt = _ref.dt; + return "\n.p-timeline {\n display: flex;\n flex-grow: 1;\n flex-direction: column;\n direction: ltr;\n}\n\n.p-timeline-left .p-timeline-event-opposite {\n text-align: right;\n}\n\n.p-timeline-left .p-timeline-event-content {\n text-align: left;\n}\n\n.p-timeline-right .p-timeline-event {\n flex-direction: row-reverse;\n}\n\n.p-timeline-right .p-timeline-event-opposite {\n text-align: left;\n}\n\n.p-timeline-right .p-timeline-event-content {\n text-align: right;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) {\n flex-direction: row-reverse;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(odd) .p-timeline-event-opposite {\n text-align: right;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(odd) .p-timeline-event-content {\n text-align: left;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) .p-timeline-event-opposite {\n text-align: left;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) .p-timeline-event-content {\n text-align: right;\n}\n\n.p-timeline-vertical .p-timeline-event-opposite,\n.p-timeline-vertical .p-timeline-event-content {\n padding: ".concat(dt("timeline.vertical.event.content.padding"), ";\n}\n\n.p-timeline-vertical .p-timeline-event-connector {\n width: ").concat(dt("timeline.event.connector.size"), ";\n}\n\n.p-timeline-event {\n display: flex;\n position: relative;\n min-height: ").concat(dt("timeline.event.min.height"), ";\n}\n\n.p-timeline-event:last-child {\n min-height: 0;\n}\n\n.p-timeline-event-opposite {\n flex: 1;\n}\n\n.p-timeline-event-content {\n flex: 1;\n}\n\n.p-timeline-event-separator {\n flex: 0;\n display: flex;\n align-items: center;\n flex-direction: column;\n}\n\n.p-timeline-event-marker {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: relative;\n align-self: baseline;\n border-width: ").concat(dt("timeline.event.marker.border.width"), ";\n border-style: solid;\n border-color: ").concat(dt("timeline.event.marker.border.color"), ";\n border-radius: ").concat(dt("timeline.event.marker.border.radius"), ";\n width: ").concat(dt("timeline.event.marker.size"), ";\n height: ").concat(dt("timeline.event.marker.size"), ";\n background: ").concat(dt("timeline.event.marker.background"), ';\n}\n\n.p-timeline-event-marker::before {\n content: " ";\n border-radius: ').concat(dt("timeline.event.marker.content.border.radius"), ";\n width: ").concat(dt("timeline.event.marker.content.size"), ";\n height:").concat(dt("timeline.event.marker.content.size"), ";\n background: ").concat(dt("timeline.event.marker.content.background"), ';\n}\n\n.p-timeline-event-marker::after {\n content: " ";\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: ').concat(dt("timeline.event.marker.border.radius"), ";\n box-shadow: ").concat(dt("timeline.event.marker.content.inset.shadow"), ";\n}\n\n.p-timeline-event-connector {\n flex-grow: 1;\n background: ").concat(dt("timeline.event.connector.color"), ";\n}\n\n.p-timeline-horizontal {\n flex-direction: row;\n}\n\n.p-timeline-horizontal .p-timeline-event {\n flex-direction: column;\n flex: 1;\n}\n\n.p-timeline-horizontal .p-timeline-event:last-child {\n flex: 0;\n}\n\n.p-timeline-horizontal .p-timeline-event-separator {\n flex-direction: row;\n}\n\n.p-timeline-horizontal .p-timeline-event-connector {\n width: 100%;\n height: ").concat(dt("timeline.event.connector.size"), ";\n}\n\n.p-timeline-horizontal .p-timeline-event-opposite,\n.p-timeline-horizontal .p-timeline-event-content {\n padding: ").concat(dt("timeline.horizontal.event.content.padding"), ";\n}\n\n.p-timeline-horizontal.p-timeline-alternate .p-timeline-event:nth-child(even) {\n flex-direction: column-reverse;\n}\n\n.p-timeline-bottom .p-timeline-event {\n flex-direction: column-reverse;\n}\n"); +}, "theme"); +var classes$2 = { + root: /* @__PURE__ */ __name(function root31(_ref2) { + var props = _ref2.props; + return ["p-timeline p-component", "p-timeline-" + props.align, "p-timeline-" + props.layout]; + }, "root"), + event: "p-timeline-event", + eventOpposite: "p-timeline-event-opposite", + eventSeparator: "p-timeline-event-separator", + eventMarker: "p-timeline-event-marker", + eventConnector: "p-timeline-event-connector", + eventContent: "p-timeline-event-content" +}; +var TimelineStyle = BaseStyle.extend({ + name: "timeline", + theme: theme$2, + classes: classes$2 +}); +var script$1$2 = { + name: "BaseTimeline", + "extends": script$1d, + props: { + value: null, + align: { + mode: String, + "default": "left" + }, + layout: { + mode: String, + "default": "vertical" + }, + dataKey: null + }, + style: TimelineStyle, + provide: /* @__PURE__ */ __name(function provide49() { + return { + $pcTimeline: this, + $parentInstance: this + }; + }, "provide") +}; +var script$7 = { + name: "Timeline", + "extends": script$1$2, + inheritAttrs: false, + methods: { + getKey: /* @__PURE__ */ __name(function getKey3(item8, index) { + return this.dataKey ? resolveFieldData(item8, this.dataKey) : index; + }, "getKey"), + getPTOptions: /* @__PURE__ */ __name(function getPTOptions13(key, index) { + return this.ptm(key, { + context: { + index, + count: this.value.length + } + }); + }, "getPTOptions") + } +}; +function render$6(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.value, function(item8, index) { + return openBlock(), createElementBlock("div", mergeProps({ + key: $options.getKey(item8, index), + "class": _ctx.cx("event"), + ref_for: true + }, $options.getPTOptions("event", index)), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("eventOpposite", { + index + }), + ref_for: true + }, $options.getPTOptions("eventOpposite", index)), [renderSlot(_ctx.$slots, "opposite", { + item: item8, + index + })], 16), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("eventSeparator"), + ref_for: true + }, $options.getPTOptions("eventSeparator", index)), [renderSlot(_ctx.$slots, "marker", { + item: item8, + index + }, function() { + return [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("eventMarker"), + ref_for: true + }, $options.getPTOptions("eventMarker", index)), null, 16)]; + }), index !== _ctx.value.length - 1 ? renderSlot(_ctx.$slots, "connector", { + key: 0, + item: item8, + index + }, function() { + return [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("eventConnector"), + ref_for: true + }, $options.getPTOptions("eventConnector", index)), null, 16)]; + }) : createCommentVNode("", true)], 16), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("eventContent"), + ref_for: true + }, $options.getPTOptions("eventContent", index)), [renderSlot(_ctx.$slots, "content", { + item: item8, + index + })], 16)], 16); + }), 128))], 16); +} +__name(render$6, "render$6"); +script$7.render = render$6; +var theme$1 = /* @__PURE__ */ __name(function theme39(_ref) { + var dt = _ref.dt; + return "\n.p-treeselect {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n background: ".concat(dt("treeselect.background"), ";\n border: 1px solid ").concat(dt("treeselect.border.color"), ";\n transition: background ").concat(dt("treeselect.transition.duration"), ", color ").concat(dt("treeselect.transition.duration"), ", border-color ").concat(dt("treeselect.transition.duration"), ", outline-color ").concat(dt("treeselect.transition.duration"), ", box-shadow ").concat(dt("treeselect.transition.duration"), ";\n border-radius: ").concat(dt("treeselect.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("treeselect.shadow"), ";\n}\n\n.p-treeselect:not(.p-disabled):hover {\n border-color: ").concat(dt("treeselect.hover.border.color"), ";\n}\n\n.p-treeselect:not(.p-disabled).p-focus {\n border-color: ").concat(dt("treeselect.focus.border.color"), ";\n box-shadow: ").concat(dt("treeselect.focus.ring.shadow"), ";\n outline: ").concat(dt("treeselect.focus.ring.width"), " ").concat(dt("treeselect.focus.ring.style"), " ").concat(dt("treeselect.focus.ring.color"), ";\n outline-offset: ").concat(dt("treeselect.focus.ring.offset"), ";\n}\n\n.p-treeselect.p-variant-filled {\n background: ").concat(dt("treeselect.filled.background"), ";\n}\n\n.p-treeselect.p-variant-filled:not(.p-disabled):hover {\n background: ").concat(dt("treeselect.filled.hover.background"), ";\n}\n\n.p-treeselect.p-variant-filled.p-focus {\n background: ").concat(dt("treeselect.filled.focus.background"), ";\n}\n\n.p-treeselect.p-invalid {\n border-color: ").concat(dt("treeselect.invalid.border.color"), ";\n}\n\n.p-treeselect.p-disabled {\n opacity: 1;\n background: ").concat(dt("treeselect.disabled.background"), ";\n}\n\n.p-treeselect-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n color: ").concat(dt("treeselect.clear.icon.color"), ";\n inset-inline-end: ").concat(dt("treeselect.dropdown.width"), ";\n}\n\n.p-treeselect-dropdown {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n background: transparent;\n color: ").concat(dt("treeselect.dropdown.color"), ";\n width: ").concat(dt("treeselect.dropdown.width"), ";\n border-start-end-radius: ").concat(dt("border.radius.md"), ";\n border-end-end-radius: ").concat(dt("border.radius.md"), ";\n}\n\n.p-treeselect-label-container {\n overflow: hidden;\n flex: 1 1 auto;\n cursor: pointer;\n}\n\n.p-treeselect-label {\n display: flex;\n align-items: center;\n gap: calc(").concat(dt("treeselect.padding.y"), " / 2);\n white-space: nowrap;\n cursor: pointer;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: ").concat(dt("treeselect.padding.y"), " ").concat(dt("treeselect.padding.x"), ";\n color: ").concat(dt("treeselect.color"), ";\n}\n\n.p-treeselect-label.p-placeholder {\n color: ").concat(dt("treeselect.placeholder.color"), ";\n}\n\n.p-treeselect.p-invalid .p-treeselect-label.p-placeholder {\n color: ").concat(dt("treeselect.invalid.placeholder.color"), ";\n}\n\n.p-treeselect.p-disabled .p-treeselect-label {\n color: ").concat(dt("treeselect.disabled.color"), ";\n}\n\n.p-treeselect-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\n\n.p-treeselect .p-treeselect-overlay {\n min-width: 100%;\n}\n\n.p-treeselect-overlay {\n position: absolute;\n top: 0;\n left: 0;\n background: ").concat(dt("treeselect.overlay.background"), ";\n color: ").concat(dt("treeselect.overlay.color"), ";\n border: 1px solid ").concat(dt("treeselect.overlay.border.color"), ";\n border-radius: ").concat(dt("treeselect.overlay.border.radius"), ";\n box-shadow: ").concat(dt("treeselect.overlay.shadow"), ";\n overflow: hidden;\n}\n\n.p-treeselect-tree-container {\n overflow: auto;\n}\n\n.p-treeselect-empty-message {\n padding: ").concat(dt("treeselect.empty.message.padding"), ";\n background: transparent;\n}\n\n.p-treeselect-fluid {\n display: flex;\n}\n\n.p-treeselect-overlay .p-tree {\n padding: ").concat(dt("treeselect.tree.padding"), ";\n}\n\n.p-treeselect-overlay .p-tree-loading {\n min-height: 3rem;\n}\n\n.p-treeselect-label .p-chip {\n padding-block-start: calc(").concat(dt("treeselect.padding.y"), " / 2);\n padding-block-end: calc(").concat(dt("treeselect.padding.y"), " / 2);\n border-radius: ").concat(dt("treeselect.chip.border.radius"), ";\n}\n\n.p-treeselect-label:has(.p-chip) {\n padding: calc(").concat(dt("treeselect.padding.y"), " / 2) calc(").concat(dt("treeselect.padding.x"), " / 2);\n}\n\n.p-treeselect-sm .p-treeselect-label {\n font-size: ").concat(dt("treeselect.sm.font.size"), ";\n padding-block: ").concat(dt("treeselect.sm.padding.y"), ";\n padding-inline: ").concat(dt("treeselect.sm.padding.x"), ";\n}\n\n.p-treeselect-sm .p-treeselect-dropdown .p-icon {\n font-size: ").concat(dt("treeselect.sm.font.size"), ";\n width: ").concat(dt("treeselect.sm.font.size"), ";\n height: ").concat(dt("treeselect.sm.font.size"), ";\n}\n\n.p-treeselect-lg .p-treeselect-label {\n font-size: ").concat(dt("treeselect.lg.font.size"), ";\n padding-block: ").concat(dt("treeselect.lg.padding.y"), ";\n padding-inline: ").concat(dt("treeselect.lg.padding.x"), ";\n}\n\n.p-treeselect-lg .p-treeselect-dropdown .p-icon {\n font-size: ").concat(dt("treeselect.lg.font.size"), ";\n width: ").concat(dt("treeselect.lg.font.size"), ";\n height: ").concat(dt("treeselect.lg.font.size"), ";\n}\n"); +}, "theme"); +var inlineStyles$1 = { + root: /* @__PURE__ */ __name(function root32(_ref2) { + var props = _ref2.props; + return { + position: props.appendTo === "self" ? "relative" : void 0 + }; + }, "root") +}; +var classes$1 = { + root: /* @__PURE__ */ __name(function root33(_ref3) { + var instance = _ref3.instance, props = _ref3.props; + return ["p-treeselect p-component p-inputwrapper", { + "p-treeselect-display-chip": props.display === "chip", + "p-disabled": props.disabled, + "p-invalid": instance.$invalid, + "p-focus": instance.focused, + "p-variant-filled": instance.$variant === "filled", + "p-inputwrapper-filled": instance.$filled, + "p-inputwrapper-focus": instance.focused || instance.overlayVisible, + "p-treeselect-open": instance.overlayVisible, + "p-treeselect-fluid": instance.$fluid, + "p-treeselect-sm p-inputfield-sm": props.size === "small", + "p-treeselect-lg p-inputfield-lg": props.size === "large" + }]; + }, "root"), + labelContainer: "p-treeselect-label-container", + label: /* @__PURE__ */ __name(function label10(_ref4) { + var instance = _ref4.instance, props = _ref4.props; + return ["p-treeselect-label", { + "p-placeholder": instance.label === props.placeholder, + "p-treeselect-label-empty": !props.placeholder && instance.emptyValue + }]; + }, "label"), + clearIcon: "p-treeselect-clear-icon", + chip: "p-treeselect-chip-item", + pcChip: "p-treeselect-chip", + dropdown: "p-treeselect-dropdown", + dropdownIcon: "p-treeselect-dropdown-icon", + panel: "p-treeselect-overlay p-component", + treeContainer: "p-treeselect-tree-container", + emptyMessage: "p-treeselect-empty-message" +}; +var TreeSelectStyle = BaseStyle.extend({ + name: "treeselect", + theme: theme$1, + classes: classes$1, + inlineStyles: inlineStyles$1 +}); +var script$1$1 = { + name: "BaseTreeSelect", + "extends": script$1n, + props: { + options: Array, + scrollHeight: { + type: String, + "default": "20rem" + }, + placeholder: { + type: String, + "default": null + }, + tabindex: { + type: Number, + "default": null + }, + selectionMode: { + type: String, + "default": "single" + }, + selectedItemsLabel: { + type: String, + "default": null + }, + maxSelectedLabels: { + type: Number, + "default": null + }, + appendTo: { + type: [String, Object], + "default": "body" + }, + emptyMessage: { + type: String, + "default": null + }, + display: { + type: String, + "default": "comma" + }, + metaKeySelection: { + type: Boolean, + "default": false + }, + loading: { + type: Boolean, + "default": false + }, + loadingIcon: { + type: String, + "default": void 0 + }, + loadingMode: { + type: String, + "default": "mask" + }, + showClear: { + type: Boolean, + "default": false + }, + clearIcon: { + type: String, + "default": void 0 + }, + filter: { + type: Boolean, + "default": false + }, + filterBy: { + type: [String, Function], + "default": "label" + }, + filterMode: { + type: String, + "default": "lenient" + }, + filterPlaceholder: { + type: String, + "default": null + }, + filterLocale: { + type: String, + "default": void 0 + }, + inputId: { + type: String, + "default": null + }, + inputClass: { + type: [String, Object], + "default": null + }, + inputStyle: { + type: Object, + "default": null + }, + inputProps: { + type: null, + "default": null + }, + panelClass: { + type: [String, Object], + "default": null + }, + panelProps: { + type: null, + "default": null + }, + ariaLabelledby: { + type: String, + "default": null + }, + ariaLabel: { + type: String, + "default": null + }, + expandedKeys: { + type: null, + "default": null + } + }, + style: TreeSelectStyle, + provide: /* @__PURE__ */ __name(function provide50() { + return { + $pcTreeSelect: this, + $parentInstance: this + }; + }, "provide") +}; +function _typeof$1$1(o) { + "@babel/helpers - typeof"; + return _typeof$1$1 = "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$1$1(o); +} +__name(_typeof$1$1, "_typeof$1$1"); +function ownKeys$1$1(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$1$1, "ownKeys$1$1"); +function _objectSpread$1$1(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$1$1(Object(t2), true).forEach(function(r2) { + _defineProperty$1$1(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$1$1(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$1$1, "_objectSpread$1$1"); +function _defineProperty$1$1(e, r, t2) { + return (r = _toPropertyKey$1$1(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$1$1, "_defineProperty$1$1"); +function _toPropertyKey$1$1(t2) { + var i = _toPrimitive$1$1(t2, "string"); + return "symbol" == _typeof$1$1(i) ? i : i + ""; +} +__name(_toPropertyKey$1$1, "_toPropertyKey$1$1"); +function _toPrimitive$1$1(t2, r) { + if ("object" != _typeof$1$1(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$1$1(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$1$1, "_toPrimitive$1$1"); +function _createForOfIteratorHelper$2(r, e) { + var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (!t2) { + if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$2(r)) || e) { + t2 && (r = t2); + var _n = 0, F = /* @__PURE__ */ __name(function F2() { + }, "F"); + return { s: F, n: /* @__PURE__ */ __name(function n() { + return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; + }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { + throw r2; + }, "e"), 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 = true, u = false; + return { s: /* @__PURE__ */ __name(function s() { + t2 = t2.call(r); + }, "s"), n: /* @__PURE__ */ __name(function n() { + var r2 = t2.next(); + return a = r2.done, r2; + }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { + u = true, o = r2; + }, "e"), f: /* @__PURE__ */ __name(function f() { + try { + a || null == t2["return"] || t2["return"](); + } finally { + if (u) throw o; + } + }, "f") }; +} +__name(_createForOfIteratorHelper$2, "_createForOfIteratorHelper$2"); +function _toConsumableArray$2(r) { + return _arrayWithoutHoles$2(r) || _iterableToArray$2(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread$2(); +} +__name(_toConsumableArray$2, "_toConsumableArray$2"); +function _nonIterableSpread$2() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableSpread$2, "_nonIterableSpread$2"); +function _unsupportedIterableToArray$2(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$2(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$2(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$2, "_unsupportedIterableToArray$2"); +function _iterableToArray$2(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray$2, "_iterableToArray$2"); +function _arrayWithoutHoles$2(r) { + if (Array.isArray(r)) return _arrayLikeToArray$2(r); +} +__name(_arrayWithoutHoles$2, "_arrayWithoutHoles$2"); +function _arrayLikeToArray$2(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; +} +__name(_arrayLikeToArray$2, "_arrayLikeToArray$2"); +var script$6 = { + name: "TreeSelect", + "extends": script$1$1, + inheritAttrs: false, + emits: ["before-show", "before-hide", "change", "show", "hide", "node-select", "node-unselect", "node-expand", "node-collapse", "focus", "blur", "update:expandedKeys"], + inject: { + $pcFluid: { + "default": null + } + }, + data: /* @__PURE__ */ __name(function data36() { + return { + id: this.$attrs.id, + focused: false, + overlayVisible: false, + d_expandedKeys: this.expandedKeys || {} + }; + }, "data"), + watch: { + "$attrs.id": /* @__PURE__ */ __name(function $attrsId13(newValue) { + this.id = newValue || UniqueComponentId(); + }, "$attrsId"), + modelValue: { + handler: /* @__PURE__ */ __name(function handler4() { + if (!this.selfChange) { + this.updateTreeState(); + } + this.selfChange = false; + }, "handler"), + immediate: true + }, + options: /* @__PURE__ */ __name(function options3() { + this.updateTreeState(); + }, "options"), + expandedKeys: /* @__PURE__ */ __name(function expandedKeys2(value2) { + this.d_expandedKeys = value2; + }, "expandedKeys") + }, + outsideClickListener: null, + resizeListener: null, + scrollHandler: null, + overlay: null, + selfChange: false, + selfClick: false, + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount17() { + this.unbindOutsideClickListener(); + this.unbindResizeListener(); + if (this.scrollHandler) { + this.scrollHandler.destroy(); + this.scrollHandler = null; + } + if (this.overlay) { + ZIndex.clear(this.overlay); + this.overlay = null; + } + }, "beforeUnmount"), + mounted: /* @__PURE__ */ __name(function mounted40() { + this.id = this.id || UniqueComponentId(); + this.updateTreeState(); + }, "mounted"), + methods: { + show: /* @__PURE__ */ __name(function show6() { + this.$emit("before-show"); + this.overlayVisible = true; + }, "show"), + hide: /* @__PURE__ */ __name(function hide7() { + this.$emit("before-hide"); + this.overlayVisible = false; + this.$refs.focusInput.focus(); + }, "hide"), + onFocus: /* @__PURE__ */ __name(function onFocus14(event2) { + this.focused = true; + this.$emit("focus", event2); + }, "onFocus"), + onBlur: /* @__PURE__ */ __name(function onBlur14(event2) { + var _this$formField$onBlu, _this$formField; + this.focused = false; + this.$emit("blur", event2); + (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField); + }, "onBlur"), + onClick: /* @__PURE__ */ __name(function onClick8(event2) { + if (this.disabled) { + return; + } + if (event2.target.tagName === "INPUT" || event2.target.getAttribute("data-pc-section") === "clearicon" || event2.target.closest('[data-pc-section="clearicon"]')) { + return; + } else if (!this.overlay || !this.overlay.contains(event2.target)) { + if (this.overlayVisible) this.hide(); + else this.show(); + focus(this.$refs.focusInput); + } + }, "onClick"), + onClearClick: /* @__PURE__ */ __name(function onClearClick3() { + this.onSelectionChange(null); + }, "onClearClick"), + onSelectionChange: /* @__PURE__ */ __name(function onSelectionChange(keys) { + this.selfChange = true; + this.writeValue(keys); + this.$emit("change", keys); + }, "onSelectionChange"), + onNodeSelect: /* @__PURE__ */ __name(function onNodeSelect(node2) { + this.$emit("node-select", node2); + if (this.selectionMode === "single") { + this.hide(); + } + }, "onNodeSelect"), + onNodeUnselect: /* @__PURE__ */ __name(function onNodeUnselect(node2) { + this.$emit("node-unselect", node2); + }, "onNodeUnselect"), + onNodeToggle: /* @__PURE__ */ __name(function onNodeToggle2(keys) { + this.d_expandedKeys = keys; + this.$emit("update:expandedKeys", this.d_expandedKeys); + }, "onNodeToggle"), + getSelectedItemsLabel: /* @__PURE__ */ __name(function getSelectedItemsLabel2() { + var pattern = /{(.*?)}/; + var selectedItemsLabel = this.selectedItemsLabel || this.$primevue.config.locale.selectionMessage; + if (pattern.test(selectedItemsLabel)) { + return selectedItemsLabel.replace(selectedItemsLabel.match(pattern)[0], Object.keys(this.d_value).length + ""); + } + return selectedItemsLabel; + }, "getSelectedItemsLabel"), + onFirstHiddenFocus: /* @__PURE__ */ __name(function onFirstHiddenFocus2(event2) { + var focusableEl = event2.relatedTarget === this.$refs.focusInput ? getFirstFocusableElement(this.overlay, ':not([data-p-hidden-focusable="true"])') : this.$refs.focusInput; + focus(focusableEl); + }, "onFirstHiddenFocus"), + onLastHiddenFocus: /* @__PURE__ */ __name(function onLastHiddenFocus2(event2) { + var focusableEl = event2.relatedTarget === this.$refs.focusInput ? getLastFocusableElement(this.overlay, ':not([data-p-hidden-focusable="true"])') : this.$refs.focusInput; + focus(focusableEl); + }, "onLastHiddenFocus"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown12(event2) { + switch (event2.code) { + case "ArrowDown": + this.onArrowDownKey(event2); + break; + case "Space": + case "Enter": + case "NumpadEnter": + this.onEnterKey(event2); + break; + case "Escape": + this.onEscapeKey(event2); + break; + case "Tab": + this.onTabKey(event2); + break; + } + }, "onKeyDown"), + onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey8(event2) { + var _this = this; + if (this.overlayVisible) return; + this.show(); + this.$nextTick(function() { + var treeNodeEl = find(_this.$refs.tree.$el, '[data-pc-section="treeitem"]'); + var focusedElement = _toConsumableArray$2(treeNodeEl).find(function(item8) { + return item8.getAttribute("tabindex") === "0"; + }); + focus(focusedElement); + }); + event2.preventDefault(); + }, "onArrowDownKey"), + onEnterKey: /* @__PURE__ */ __name(function onEnterKey8(event2) { + if (this.overlayVisible) { + this.hide(); + } else { + this.onArrowDownKey(event2); + } + event2.preventDefault(); + }, "onEnterKey"), + onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey5(event2) { + if (this.overlayVisible) { + this.hide(); + event2.preventDefault(); + } + }, "onEscapeKey"), + onTabKey: /* @__PURE__ */ __name(function onTabKey5(event2) { + var pressedInInputText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + if (!pressedInInputText) { + if (this.overlayVisible && this.hasFocusableElements()) { + focus(this.$refs.firstHiddenFocusableElementOnOverlay); + event2.preventDefault(); + } + } + }, "onTabKey"), + hasFocusableElements: /* @__PURE__ */ __name(function hasFocusableElements2() { + return getFocusableElements(this.overlay, ':not([data-p-hidden-focusable="true"])').length > 0; + }, "hasFocusableElements"), + onOverlayEnter: /* @__PURE__ */ __name(function onOverlayEnter5(el) { + ZIndex.set("overlay", el, this.$primevue.config.zIndex.overlay); + addStyle(el, { + position: "absolute", + top: "0", + left: "0" + }); + this.alignOverlay(); + this.focus(); + }, "onOverlayEnter"), + onOverlayAfterEnter: /* @__PURE__ */ __name(function onOverlayAfterEnter3() { + this.bindOutsideClickListener(); + this.bindScrollListener(); + this.bindResizeListener(); + this.scrollValueInView(); + this.$emit("show"); + }, "onOverlayAfterEnter"), + onOverlayLeave: /* @__PURE__ */ __name(function onOverlayLeave5() { + this.unbindOutsideClickListener(); + this.unbindScrollListener(); + this.unbindResizeListener(); + this.$emit("hide"); + this.overlay = null; + }, "onOverlayLeave"), + onOverlayAfterLeave: /* @__PURE__ */ __name(function onOverlayAfterLeave5(el) { + ZIndex.clear(el); + }, "onOverlayAfterLeave"), + focus: /* @__PURE__ */ __name(function focus3() { + var focusableElements = getFocusableElements(this.overlay); + if (focusableElements && focusableElements.length > 0) { + focusableElements[0].focus(); + } + }, "focus"), + alignOverlay: /* @__PURE__ */ __name(function alignOverlay6() { + if (this.appendTo === "self") { + relativePosition(this.overlay, this.$el); + } else { + this.overlay.style.minWidth = getOuterWidth(this.$el) + "px"; + absolutePosition(this.overlay, this.$el); + } + }, "alignOverlay"), + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener7() { + var _this2 = this; + if (!this.outsideClickListener) { + this.outsideClickListener = function(event2) { + if (_this2.overlayVisible && !_this2.selfClick && _this2.isOutsideClicked(event2)) { + _this2.hide(); + } + _this2.selfClick = false; + }; + document.addEventListener("click", this.outsideClickListener); + } + }, "bindOutsideClickListener"), + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener7() { + if (this.outsideClickListener) { + document.removeEventListener("click", this.outsideClickListener); + this.outsideClickListener = null; + } + }, "unbindOutsideClickListener"), + bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener7() { + var _this3 = this; + if (!this.scrollHandler) { + this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, function() { + if (_this3.overlayVisible) { + _this3.hide(); + } + }); + } + this.scrollHandler.bindScrollListener(); + }, "bindScrollListener"), + unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener7() { + if (this.scrollHandler) { + this.scrollHandler.unbindScrollListener(); + } + }, "unbindScrollListener"), + bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener7() { + var _this4 = this; + if (!this.resizeListener) { + this.resizeListener = function() { + if (_this4.overlayVisible && !isTouchDevice()) { + _this4.hide(); + } + }; + window.addEventListener("resize", this.resizeListener); + } + }, "bindResizeListener"), + unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener7() { + if (this.resizeListener) { + window.removeEventListener("resize", this.resizeListener); + this.resizeListener = null; + } + }, "unbindResizeListener"), + isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked5(event2) { + return !(this.$el.isSameNode(event2.target) || this.$el.contains(event2.target) || this.overlay && this.overlay.contains(event2.target)); + }, "isOutsideClicked"), + overlayRef: /* @__PURE__ */ __name(function overlayRef5(el) { + this.overlay = el; + }, "overlayRef"), + onOverlayClick: /* @__PURE__ */ __name(function onOverlayClick6(event2) { + OverlayEventBus.emit("overlay-click", { + originalEvent: event2, + target: this.$el + }); + this.selfClick = true; + }, "onOverlayClick"), + onOverlayKeydown: /* @__PURE__ */ __name(function onOverlayKeydown(event2) { + if (event2.code === "Escape") this.hide(); + }, "onOverlayKeydown"), + findSelectedNodes: /* @__PURE__ */ __name(function findSelectedNodes(node2, keys, selectedNodes2) { + if (node2) { + if (this.isSelected(node2, keys)) { + selectedNodes2.push(node2); + delete keys[node2.key]; + } + if (Object.keys(keys).length && node2.children) { + var _iterator = _createForOfIteratorHelper$2(node2.children), _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + var childNode = _step.value; + this.findSelectedNodes(childNode, keys, selectedNodes2); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + } + } else { + var _iterator2 = _createForOfIteratorHelper$2(this.options), _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { + var _childNode = _step2.value; + this.findSelectedNodes(_childNode, keys, selectedNodes2); + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + } + }, "findSelectedNodes"), + isSelected: /* @__PURE__ */ __name(function isSelected5(node2, keys) { + return this.selectionMode === "checkbox" ? keys[node2.key] && keys[node2.key].checked : keys[node2.key]; + }, "isSelected"), + updateTreeState: /* @__PURE__ */ __name(function updateTreeState() { + var keys = _objectSpread$1$1({}, this.d_value); + if (keys && this.options) { + this.updateTreeBranchState(null, null, keys); + } + }, "updateTreeState"), + updateTreeBranchState: /* @__PURE__ */ __name(function updateTreeBranchState(node2, path, keys) { + if (node2) { + if (this.isSelected(node2, keys)) { + this.expandPath(path); + delete keys[node2.key]; + } + if (Object.keys(keys).length && node2.children) { + var _iterator3 = _createForOfIteratorHelper$2(node2.children), _step3; + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { + var childNode = _step3.value; + path.push(node2.key); + this.updateTreeBranchState(childNode, path, keys); + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + } + } else { + var _iterator4 = _createForOfIteratorHelper$2(this.options), _step4; + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) { + var _childNode2 = _step4.value; + this.updateTreeBranchState(_childNode2, [], keys); + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + } + }, "updateTreeBranchState"), + expandPath: /* @__PURE__ */ __name(function expandPath(path) { + if (path.length > 0) { + var _iterator5 = _createForOfIteratorHelper$2(path), _step5; + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done; ) { + var key = _step5.value; + this.d_expandedKeys[key] = true; + } + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); + } + this.d_expandedKeys = _objectSpread$1$1({}, this.d_expandedKeys); + this.$emit("update:expandedKeys", this.d_expandedKeys); + } + }, "expandPath"), + scrollValueInView: /* @__PURE__ */ __name(function scrollValueInView() { + if (this.overlay) { + var selectedItem = findSingle(this.overlay, '[data-p-selected="true"]'); + if (selectedItem) { + selectedItem.scrollIntoView({ + block: "nearest", + inline: "start" + }); + } + } + }, "scrollValueInView") + }, + computed: { + selectedNodes: /* @__PURE__ */ __name(function selectedNodes() { + var selectedNodes2 = []; + if (this.d_value && this.options) { + var keys = _objectSpread$1$1({}, this.d_value); + this.findSelectedNodes(null, keys, selectedNodes2); + } + return selectedNodes2; + }, "selectedNodes"), + label: /* @__PURE__ */ __name(function label11() { + var value2 = this.selectedNodes; + var label12; + if (value2.length) { + if (isNotEmpty(this.maxSelectedLabels) && value2.length > this.maxSelectedLabels) { + label12 = this.getSelectedItemsLabel(); + } else { + label12 = value2.map(function(node2) { + return node2.label; + }).join(", "); + } + } else { + label12 = this.placeholder; + } + return label12; + }, "label"), + chipSelectedItems: /* @__PURE__ */ __name(function chipSelectedItems2() { + return isNotEmpty(this.maxSelectedLabels) && this.d_value && Object.keys(this.d_value).length > this.maxSelectedLabels; + }, "chipSelectedItems"), + emptyMessageText: /* @__PURE__ */ __name(function emptyMessageText4() { + return this.emptyMessage || this.$primevue.config.locale.emptyMessage; + }, "emptyMessageText"), + emptyValue: /* @__PURE__ */ __name(function emptyValue() { + return !this.$filled; + }, "emptyValue"), + emptyOptions: /* @__PURE__ */ __name(function emptyOptions() { + return !this.options || this.options.length === 0; + }, "emptyOptions"), + listId: /* @__PURE__ */ __name(function listId() { + return this.id + "_list"; + }, "listId"), + hasFluid: /* @__PURE__ */ __name(function hasFluid2() { + return isEmpty(this.fluid) ? !!this.$pcFluid : this.fluid; + }, "hasFluid"), + isClearIconVisible: /* @__PURE__ */ __name(function isClearIconVisible3() { + return this.showClear && this.d_value != null && isNotEmpty(this.options); + }, "isClearIconVisible") + }, + components: { + TSTree: script$1U, + Chip: script$1t, + Portal: script$1f, + ChevronDownIcon: script$1k, + TimesIcon: script$1g + }, + directives: { + ripple: Ripple + } +}; +function _typeof$6(o) { + "@babel/helpers - typeof"; + return _typeof$6 = "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$6(o); +} +__name(_typeof$6, "_typeof$6"); +function ownKeys$6(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$6, "ownKeys$6"); +function _objectSpread$6(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$6(Object(t2), true).forEach(function(r2) { + _defineProperty$6(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$6(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$6, "_objectSpread$6"); +function _defineProperty$6(e, r, t2) { + return (r = _toPropertyKey$6(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$6, "_defineProperty$6"); +function _toPropertyKey$6(t2) { + var i = _toPrimitive$6(t2, "string"); + return "symbol" == _typeof$6(i) ? i : i + ""; +} +__name(_toPropertyKey$6, "_toPropertyKey$6"); +function _toPrimitive$6(t2, r) { + if ("object" != _typeof$6(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$6(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$6, "_toPrimitive$6"); +var _hoisted_1$6 = ["id", "disabled", "tabindex", "aria-labelledby", "aria-label", "aria-expanded", "aria-controls"]; +var _hoisted_2$4 = { + key: 0 +}; +var _hoisted_3$4 = ["aria-expanded"]; +function render$5(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Chip = resolveComponent("Chip"); + var _component_TSTree = resolveComponent("TSTree"); + var _component_Portal = resolveComponent("Portal"); + return openBlock(), createElementBlock("div", mergeProps({ + ref: "container", + "class": _ctx.cx("root"), + style: _ctx.sx("root"), + onClick: _cache[10] || (_cache[10] = function() { + return $options.onClick && $options.onClick.apply($options, arguments); + }) + }, _ctx.ptmi("root")), [createBaseVNode("div", mergeProps({ + "class": "p-hidden-accessible" + }, _ctx.ptm("hiddenInputContainer"), { + "data-p-hidden-accessible": true + }), [createBaseVNode("input", mergeProps({ + ref: "focusInput", + id: _ctx.inputId, + type: "text", + role: "combobox", + "class": _ctx.inputClass, + style: _ctx.inputStyle, + readonly: "", + disabled: _ctx.disabled, + tabindex: !_ctx.disabled ? _ctx.tabindex : -1, + "aria-labelledby": _ctx.ariaLabelledby, + "aria-label": _ctx.ariaLabel, + "aria-haspopup": "tree", + "aria-expanded": $data.overlayVisible, + "aria-controls": $options.listId, + onFocus: _cache[0] || (_cache[0] = function($event) { + return $options.onFocus($event); + }), + onBlur: _cache[1] || (_cache[1] = function($event) { + return $options.onBlur($event); + }), + onKeydown: _cache[2] || (_cache[2] = function($event) { + return $options.onKeyDown($event); + }) + }, _objectSpread$6(_objectSpread$6({}, _ctx.inputProps), _ctx.ptm("hiddenInput"))), null, 16, _hoisted_1$6)], 16), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("labelContainer") + }, _ctx.ptm("labelContainer")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("label") + }, _ctx.ptm("label")), [renderSlot(_ctx.$slots, "value", { + value: $options.selectedNodes, + placeholder: _ctx.placeholder + }, function() { + return [_ctx.display === "comma" ? (openBlock(), createElementBlock(Fragment, { + key: 0 + }, [createTextVNode(toDisplayString($options.label || "empty"), 1)], 64)) : _ctx.display === "chip" ? (openBlock(), createElementBlock(Fragment, { + key: 1 + }, [$options.chipSelectedItems ? (openBlock(), createElementBlock("span", _hoisted_2$4, toDisplayString($options.label), 1)) : (openBlock(), createElementBlock(Fragment, { + key: 1 + }, [(openBlock(true), createElementBlock(Fragment, null, renderList($options.selectedNodes, function(node2) { + return openBlock(), createElementBlock("div", mergeProps({ + key: node2.key, + "class": _ctx.cx("chipItem"), + ref_for: true + }, _ctx.ptm("chipItem")), [createVNode(_component_Chip, { + "class": normalizeClass(_ctx.cx("pcChip")), + label: node2.label, + unstyled: _ctx.unstyled, + pt: _ctx.ptm("pcChip") + }, null, 8, ["class", "label", "unstyled", "pt"])], 16); + }), 128)), $options.emptyValue ? (openBlock(), createElementBlock(Fragment, { + key: 0 + }, [createTextVNode(toDisplayString(_ctx.placeholder || "empty"), 1)], 64)) : createCommentVNode("", true)], 64))], 64)) : createCommentVNode("", true)]; + })], 16)], 16), $options.isClearIconVisible ? renderSlot(_ctx.$slots, "clearicon", { + key: 0, + "class": normalizeClass(_ctx.cx("clearIcon")), + clearCallback: $options.onClearClick + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon ? "i" : "TimesIcon"), mergeProps({ + ref: "clearIcon", + "class": [_ctx.cx("clearIcon"), _ctx.clearIcon], + onClick: $options.onClearClick + }, _ctx.ptm("clearIcon"), { + "data-pc-section": "clearicon" + }), null, 16, ["class", "onClick"]))]; + }) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("dropdown"), + role: "button", + "aria-haspopup": "tree", + "aria-expanded": $data.overlayVisible + }, _ctx.ptm("dropdown")), [renderSlot(_ctx.$slots, _ctx.$slots.dropdownicon ? "dropdownicon" : "triggericon", { + "class": normalizeClass(_ctx.cx("dropdownIcon")) + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent("ChevronDownIcon"), mergeProps({ + "class": _ctx.cx("dropdownIcon") + }, _ctx.ptm("dropdownIcon")), null, 16, ["class"]))]; + })], 16, _hoisted_3$4), createVNode(_component_Portal, { + appendTo: _ctx.appendTo + }, { + "default": withCtx(function() { + return [createVNode(Transition, mergeProps({ + name: "p-connected-overlay", + onEnter: $options.onOverlayEnter, + onAfterEnter: $options.onOverlayAfterEnter, + onLeave: $options.onOverlayLeave, + onAfterLeave: $options.onOverlayAfterLeave + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [$data.overlayVisible ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: $options.overlayRef, + onClick: _cache[8] || (_cache[8] = function() { + return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); + }), + "class": [_ctx.cx("panel"), _ctx.panelClass], + onKeydown: _cache[9] || (_cache[9] = function() { + return $options.onOverlayKeydown && $options.onOverlayKeydown.apply($options, arguments); + }) + }, _objectSpread$6(_objectSpread$6({}, _ctx.panelProps), _ctx.ptm("panel"))), [createBaseVNode("span", mergeProps({ + ref: "firstHiddenFocusableElementOnOverlay", + role: "presentation", + "class": "p-hidden-accessible p-hidden-focusable", + tabindex: 0, + onFocus: _cache[3] || (_cache[3] = function() { + return $options.onFirstHiddenFocus && $options.onFirstHiddenFocus.apply($options, arguments); + }) + }, _ctx.ptm("hiddenFirstFocusableEl"), { + "data-p-hidden-accessible": true, + "data-p-hidden-focusable": true + }), null, 16), renderSlot(_ctx.$slots, "header", { + value: _ctx.d_value, + options: _ctx.options + }), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("treeContainer"), + style: { + "max-height": _ctx.scrollHeight + } + }, _ctx.ptm("treeContainer")), [createVNode(_component_TSTree, { + ref: "tree", + id: $options.listId, + value: _ctx.options, + selectionMode: _ctx.selectionMode, + loading: _ctx.loading, + loadingIcon: _ctx.loadingIcon, + loadingMode: _ctx.loadingMode, + filter: _ctx.filter, + filterBy: _ctx.filterBy, + filterMode: _ctx.filterMode, + filterPlaceholder: _ctx.filterPlaceholder, + filterLocale: _ctx.filterLocale, + "onUpdate:selectionKeys": $options.onSelectionChange, + selectionKeys: _ctx.d_value, + expandedKeys: $data.d_expandedKeys, + "onUpdate:expandedKeys": $options.onNodeToggle, + metaKeySelection: _ctx.metaKeySelection, + onNodeExpand: _cache[4] || (_cache[4] = function($event) { + return _ctx.$emit("node-expand", $event); + }), + onNodeCollapse: _cache[5] || (_cache[5] = function($event) { + return _ctx.$emit("node-collapse", $event); + }), + onNodeSelect: $options.onNodeSelect, + onNodeUnselect: $options.onNodeUnselect, + onClick: _cache[6] || (_cache[6] = withModifiers(function() { + }, ["stop"])), + level: 0, + unstyled: _ctx.unstyled, + pt: _ctx.ptm("pcTree") + }, createSlots({ + _: 2 + }, [_ctx.$slots.option ? { + name: "default", + fn: withCtx(function(optionSlotProps) { + return [renderSlot(_ctx.$slots, "option", { + node: optionSlotProps.node, + expanded: optionSlotProps.expanded, + selected: optionSlotProps.selected + })]; + }), + key: "0" + } : void 0, _ctx.$slots.itemtoggleicon ? { + name: "toggleicon", + fn: withCtx(function(iconSlotProps) { + return [renderSlot(_ctx.$slots, "itemtoggleicon", { + node: iconSlotProps.node, + expanded: iconSlotProps.expanded, + "class": normalizeClass(iconSlotProps["class"]) + })]; + }), + key: "1" + } : _ctx.$slots.itemtogglericon ? { + name: "togglericon", + fn: withCtx(function(iconSlotProps) { + return [renderSlot(_ctx.$slots, "itemtogglericon", { + node: iconSlotProps.node, + expanded: iconSlotProps.expanded, + "class": normalizeClass(iconSlotProps["class"]) + })]; + }), + key: "2" + } : void 0, _ctx.$slots.itemcheckboxicon ? { + name: "checkboxicon", + fn: withCtx(function(iconSlotProps) { + return [renderSlot(_ctx.$slots, "itemcheckboxicon", { + checked: iconSlotProps.checked, + partialChecked: iconSlotProps.partialChecked, + "class": normalizeClass(iconSlotProps["class"]) + })]; + }), + key: "3" + } : void 0]), 1032, ["id", "value", "selectionMode", "loading", "loadingIcon", "loadingMode", "filter", "filterBy", "filterMode", "filterPlaceholder", "filterLocale", "onUpdate:selectionKeys", "selectionKeys", "expandedKeys", "onUpdate:expandedKeys", "metaKeySelection", "onNodeSelect", "onNodeUnselect", "unstyled", "pt"]), $options.emptyOptions && !_ctx.loading ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("emptyMessage") + }, _ctx.ptm("emptyMessage")), [renderSlot(_ctx.$slots, "empty", {}, function() { + return [createTextVNode(toDisplayString($options.emptyMessageText), 1)]; + })], 16)) : createCommentVNode("", true)], 16), renderSlot(_ctx.$slots, "footer", { + value: _ctx.d_value, + options: _ctx.options + }), createBaseVNode("span", mergeProps({ + ref: "lastHiddenFocusableElementOnOverlay", + role: "presentation", + "class": "p-hidden-accessible p-hidden-focusable", + tabindex: 0, + onFocus: _cache[7] || (_cache[7] = function() { + return $options.onLastHiddenFocus && $options.onLastHiddenFocus.apply($options, arguments); + }) + }, _ctx.ptm("hiddenLastFocusableEl"), { + "data-p-hidden-accessible": true, + "data-p-hidden-focusable": true + }), null, 16)], 16)) : createCommentVNode("", true)]; + }), + _: 3 + }, 16, ["onEnter", "onAfterEnter", "onLeave", "onAfterLeave"])]; + }), + _: 3 + }, 8, ["appendTo"])], 16); +} +__name(render$5, "render$5"); +script$6.render = render$5; +var theme40 = /* @__PURE__ */ __name(function theme41(_ref) { + var dt = _ref.dt; + return "\n.p-treetable {\n position: relative;\n}\n\n.p-treetable-table {\n border-spacing: 0;\n border-collapse: separate;\n width: 100%;\n}\n\n.p-treetable-scrollable > .p-treetable-table-container {\n position: relative;\n}\n\n.p-treetable-scrollable-table > .p-treetable-thead {\n inset-block-start: 0;\n z-index: 1;\n}\n\n.p-treetable-scrollable-table > .p-treetable-frozen-tbody {\n position: sticky;\n z-index: 1;\n}\n\n.p-treetable-scrollable-table > .p-treetable-tfoot {\n inset-block-end: 0;\n z-index: 1;\n}\n\n.p-treetable-scrollable .p-treetable-frozen-column {\n position: sticky;\n background: ".concat(dt("treetable.header.cell.background"), ";\n}\n\n.p-treetable-scrollable th.p-treetable-frozen-column {\n z-index: 1;\n}\n\n.p-treetable-scrollable > .p-treetable-table-container > .p-treetable-table > .p-treetable-thead {\n background: ").concat(dt("treetable.header.cell.background"), ";\n}\n\n.p-treetable-scrollable > .p-treetable-table-container > .p-treetable-table > .p-treetable-tfoot {\n background: ").concat(dt("treetable.footer.cell.background"), ";\n}\n\n.p-treetable-flex-scrollable {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n.p-treetable-flex-scrollable > .p-treetable-table-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n height: 100%;\n}\n\n.p-treetable-scrollable-table > .p-treetable-tbody > .p-treetable-row-group-header {\n position: sticky;\n z-index: 1;\n}\n\n.p-treetable-resizable-table > .p-treetable-thead > tr > th,\n.p-treetable-resizable-table > .p-treetable-tfoot > tr > td,\n.p-treetable-resizable-table > .p-treetable-tbody > tr > td {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.p-treetable-resizable-table > .p-treetable-thead > tr > th.p-treetable-resizable-column:not(.p-treetable-frozen-column) {\n background-clip: padding-box;\n position: relative;\n}\n\n.p-treetable-resizable-table-fit > .p-treetable-thead > tr > th.p-treetable-resizable-column:last-child .p-treetable-column-resizer {\n display: none;\n}\n\n.p-treetable-column-resizer {\n display: block;\n position: absolute;\n inset-block-start: 0;\n inset-inline-end: 0;\n margin: 0;\n width: ").concat(dt("treetable.column.resizer.width"), ";\n height: 100%;\n padding: 0;\n cursor: col-resize;\n border: 1px solid transparent;\n}\n\n.p-treetable-column-header-content {\n display: flex;\n align-items: center;\n gap: ").concat(dt("treetable.header.cell.gap"), ";\n}\n\n.p-treetable-column-resize-indicator {\n width: ").concat(dt("treetable.resize.indicator.width"), ";\n position: absolute;\n z-index: 10;\n display: none;\n background: ").concat(dt("treetable.resize.indicator.color"), ";\n}\n\n.p-treetable-mask {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 2;\n}\n\n.p-treetable-paginator-top {\n border-color: ").concat(dt("treetable.paginator.top.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("treetable.paginator.top.border.width"), ";\n}\n\n.p-treetable-paginator-bottom {\n border-color: ").concat(dt("treetable.paginator.bottom.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("treetable.paginator.bottom.border.width"), ";\n}\n\n.p-treetable-header {\n background: ").concat(dt("treetable.header.background"), ";\n color: ").concat(dt("treetable.header.color"), ";\n border-color: ").concat(dt("treetable.header.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("treetable.header.border.width"), ";\n padding: ").concat(dt("treetable.header.padding"), ";\n}\n\n.p-treetable-footer {\n background: ").concat(dt("treetable.footer.background"), ";\n color: ").concat(dt("treetable.footer.color"), ";\n border-color: ").concat(dt("treetable.footer.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("treetable.footer.border.width"), ";\n padding: ").concat(dt("treetable.footer.padding"), ";\n}\n\n.p-treetable-header-cell {\n padding: ").concat(dt("treetable.header.cell.padding"), ";\n background: ").concat(dt("treetable.header.cell.background"), ";\n border-color: ").concat(dt("treetable.header.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n color: ").concat(dt("treetable.header.cell.color"), ";\n font-weight: normal;\n text-align: start;\n transition: background ").concat(dt("treetable.transition.duration"), ", color ").concat(dt("treetable.transition.duration"), ", border-color ").concat(dt("treetable.transition.duration"), ",\n outline-color ").concat(dt("treetable.transition.duration"), ", box-shadow ").concat(dt("treetable.transition.duration"), ";\n}\n\n.p-treetable-column-title {\n font-weight: ").concat(dt("treetable.column.title.font.weight"), ";\n}\n\n.p-treetable-tbody > tr {\n outline-color: transparent;\n background: ").concat(dt("treetable.row.background"), ";\n color: ").concat(dt("treetable.row.color"), ";\n transition: background ").concat(dt("treetable.transition.duration"), ", color ").concat(dt("treetable.transition.duration"), ", border-color ").concat(dt("treetable.transition.duration"), ",\n outline-color ").concat(dt("treetable.transition.duration"), ", box-shadow ").concat(dt("treetable.transition.duration"), ";\n}\n\n.p-treetable-tbody > tr > td {\n text-align: start;\n border-color: ").concat(dt("treetable.body.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n padding: ").concat(dt("treetable.body.cell.padding"), ";\n}\n\n.p-treetable-hoverable .p-treetable-tbody > tr:not(.p-treetable-row-selected):hover {\n background: ").concat(dt("treetable.row.hover.background"), ";\n color: ").concat(dt("treetable.row.hover.color"), ";\n}\n\n.p-treetable-tbody > tr.p-treetable-row-selected {\n background: ").concat(dt("treetable.row.selected.background"), ";\n color: ").concat(dt("treetable.row.selected.color"), ";\n}\n\n.p-treetable-tbody > tr:has(+ .p-treetable-row-selected) > td {\n border-block-end-color: ").concat(dt("treetable.body.cell.selected.border.color"), ";\n}\n\n.p-treetable-tbody > tr.p-treetable-row-selected > td {\n border-block-end-color: ").concat(dt("treetable.body.cell.selected.border.color"), ";\n}\n\n.p-treetable-tbody > tr:focus-visible,\n.p-treetable-tbody > tr.p-treetable-contextmenu-row-selected {\n box-shadow: ").concat(dt("treetable.row.focus.ring.shadow"), ";\n outline: ").concat(dt("treetable.row.focus.ring.width"), " ").concat(dt("treetable.row.focus.ring.style"), " ").concat(dt("treetable.row.focus.ring.color"), ";\n outline-offset: ").concat(dt("treetable.row.focus.ring.offset"), ";\n}\n\n.p-treetable-tfoot > tr > td {\n text-align: start;\n padding: ").concat(dt("treetable.footer.cell.padding"), ";\n border-color: ").concat(dt("treetable.footer.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n color: ").concat(dt("treetable.footer.cell.color"), ";\n background: ").concat(dt("treetable.footer.cell.background"), ";\n}\n\n.p-treetable-column-footer {\n font-weight: ").concat(dt("treetable.column.footer.font.weight"), ";\n}\n\n.p-treetable-sortable-column {\n cursor: pointer;\n user-select: none;\n outline-color: transparent;\n}\n\n.p-treetable-column-title,\n.p-treetable-sort-icon,\n.p-treetable-sort-badge {\n vertical-align: middle;\n}\n\n.p-treetable-sort-icon {\n color: ").concat(dt("treetable.sort.icon.color"), ";\n font-size: ").concat(dt("treetable.sort.icon.size"), ";\n width: ").concat(dt("treetable.sort.icon.size"), ";\n height: ").concat(dt("treetable.sort.icon.size"), ";\n transition: color ").concat(dt("treetable.transition.duration"), ";\n}\n\n.p-treetable-sortable-column:not(.p-treetable-column-sorted):hover {\n background: ").concat(dt("treetable.header.cell.hover.background"), ";\n color: ").concat(dt("treetable.header.cell.hover.color"), ";\n}\n\n.p-treetable-sortable-column:not(.p-treetable-column-sorted):hover .p-treetable-sort-icon {\n color: ").concat(dt("treetable.sort.icon.hover.color"), ";\n}\n\n.p-treetable-column-sorted {\n background: ").concat(dt("treetable.header.cell.selected.background"), ";\n color: ").concat(dt("treetable.header.cell.selected.color"), ";\n}\n\n.p-treetable-column-sorted .p-treetable-sort-icon {\n color: ").concat(dt("treetable.header.cell.selected.color"), ";\n}\n\n.p-treetable-sortable-column:focus-visible {\n box-shadow: ").concat(dt("treetable.header.cell.focus.ring.shadow"), ";\n outline: ").concat(dt("treetable.header.cell.focus.ring.width"), " ").concat(dt("treetable.header.cell.focus.ring.style"), " ").concat(dt("treetable.header.cell.focus.ring.color"), ";\n outline-offset: ").concat(dt("treetable.header.cell.focus.ring.offset"), ";\n}\n\n.p-treetable-hoverable .p-treetable-selectable-row {\n cursor: pointer;\n}\n\n.p-treetable-loading-icon {\n font-size: ").concat(dt("treetable.loading.icon.size"), ";\n width: ").concat(dt("treetable.loading.icon.size"), ";\n height: ").concat(dt("treetable.loading.icon.size"), ";\n}\n\n.p-treetable-gridlines .p-treetable-header {\n border-width: 1px 1px 0 1px;\n}\n\n.p-treetable-gridlines .p-treetable-footer {\n border-width: 0 1px 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-paginator-top {\n border-width: 1px 1px 0 1px;\n}\n\n.p-treetable-gridlines .p-treetable-paginator-bottom {\n border-width: 0 1px 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-thead > tr > th {\n border-width: 1px 0 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-thead > tr > th:last-child {\n border-width: 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tbody > tr > td {\n border-width: 1px 0 0 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tbody > tr > td:last-child {\n border-width: 1px 1px 0 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tbody > tr:last-child > td {\n border-width: 1px 0 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tbody > tr:last-child > td:last-child {\n border-width: 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tfoot > tr > td {\n border-width: 1px 0 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tfoot > tr > td:last-child {\n border-width: 1px 1px 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines .p-treetable-thead + .p-treetable-tfoot > tr > td {\n border-width: 0 0 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines .p-treetable-thead + .p-treetable-tfoot > tr > td:last-child {\n border-width: 0 1px 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines:has(.p-treetable-thead):has(.p-treetable-tbody) .p-treetable-tbody > tr > td {\n border-width: 0 0 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines:has(.p-treetable-thead):has(.p-treetable-tbody) .p-treetable-tbody > tr > td:last-child {\n border-width: 0 1px 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines:has(.p-treetable-tbody):has(.p-treetable-tfoot) .p-treetable-tbody > tr:last-child > td {\n border-width: 0 0 0 1px;\n}\n\n.p-treetable.p-treetable-gridlines:has(.p-treetable-tbody):has(.p-treetable-tfoot) .p-treetable-tbody > tr:last-child > td:last-child {\n border-width: 0 1px 0 1px;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-header {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-thead > tr > th {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-tbody > tr > td {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-tfoot > tr > td {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-footer {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-header {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-thead > tr > th {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-tbody > tr > td {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-tfoot > tr > td {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-footer {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable-body-cell-content {\n display: flex;\n align-items: center;\n gap: ").concat(dt("treetable.body.cell.gap"), ";\n}\n\n.p-treetable-tbody > tr.p-treetable-row-selected .p-treetable-node-toggle-button {\n color: inherit;\n}\n\n.p-treetable-node-toggle-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n width: ").concat(dt("treetable.node.toggle.button.size"), ";\n height: ").concat(dt("treetable.node.toggle.button.size"), ";\n color: ").concat(dt("treetable.node.toggle.button.color"), ";\n border: 0 none;\n background: transparent;\n cursor: pointer;\n border-radius: ").concat(dt("treetable.node.toggle.button.border.radius"), ";\n transition: background ").concat(dt("treetable.transition.duration"), ", color ").concat(dt("treetable.transition.duration"), ", border-color ").concat(dt("treetable.transition.duration"), ",\n outline-color ").concat(dt("treetable.transition.duration"), ", box-shadow ").concat(dt("treetable.transition.duration"), ";\n outline-color: transparent;\n user-select: none;\n}\n\n.p-treetable-node-toggle-button:enabled:hover {\n color: ").concat(dt("treetable.node.toggle.button.hover.color"), ";\n background: ").concat(dt("treetable.node.toggle.button.hover.background"), ";\n}\n\n.p-treetable-tbody > tr.p-treetable-row-selected .p-treetable-node-toggle-button:hover {\n background: ").concat(dt("treetable.node.toggle.button.selected.hover.background"), ";\n color: ").concat(dt("treetable.node.toggle.button.selected.hover.color"), ";\n}\n\n.p-treetable-node-toggle-button:focus-visible {\n box-shadow: ").concat(dt("treetable.node.toggle.button.focus.ring.shadow"), ";\n outline: ").concat(dt("treetable.node.toggle.button.focus.ring.width"), " ").concat(dt("treetable.node.toggle.button.focus.ring.style"), " ").concat(dt("treetable.node.toggle.button.focus.ring.color"), ";\n outline-offset: ").concat(dt("treetable.node.toggle.button.focus.ring.offset"), ";\n}\n\n.p-treetable-node-toggle-icon:dir(rtl) {\n transform: rotate(180deg);\n}\n"); +}, "theme"); +var classes = { + root: /* @__PURE__ */ __name(function root34(_ref2) { + var instance = _ref2.instance, props = _ref2.props; + return ["p-treetable p-component", { + "p-treetable-hoverable": props.rowHover || instance.rowSelectionMode, + "p-treetable-resizable": props.resizableColumns, + "p-treetable-resizable-fit": props.resizableColumns && props.columnResizeMode === "fit", + "p-treetable-scrollable": props.scrollable, + "p-treetable-flex-scrollable": props.scrollable && props.scrollHeight === "flex", + "p-treetable-gridlines": props.showGridlines, + "p-treetable-sm": props.size === "small", + "p-treetable-lg": props.size === "large" + }]; + }, "root"), + loading: "p-treetable-loading", + //TODO: required? + mask: "p-treetable-mask p-overlay-mask", + loadingIcon: "p-treetable-loading-icon", + header: "p-treetable-header", + paginator: /* @__PURE__ */ __name(function paginator(_ref3) { + var position = _ref3.position; + return "p-treetable-paginator-" + position; + }, "paginator"), + tableContainer: "p-treetable-table-container", + table: /* @__PURE__ */ __name(function table(_ref4) { + var props = _ref4.props; + return ["p-treetable-table", { + "p-treetable-scrollable-table": props.scrollable, + "p-treetable-resizable-table": props.resizableColumns, + "p-treetable-resizable-table-fit": props.resizableColumns && props.columnResizeMode === "fit" + }]; + }, "table"), + thead: "p-treetable-thead", + headerCell: /* @__PURE__ */ __name(function headerCell(_ref5) { + var instance = _ref5.instance, props = _ref5.props, context = _ref5.context; + return ["p-treetable-header-cell", { + "p-treetable-sortable-column": instance.columnProp("sortable"), + "p-treetable-resizable-column": props.resizableColumns, + "p-treetable-column-sorted": context === null || context === void 0 ? void 0 : context.sorted, + "p-treetable-frozen-column": instance.columnProp("frozen") + }]; + }, "headerCell"), + columnResizer: "p-treetable-column-resizer", + columnHeaderContent: "p-treetable-column-header-content", + columnTitle: "p-treetable-column-title", + sortIcon: "p-treetable-sort-icon", + pcSortBadge: "p-treetable-sort-badge", + tbody: "p-treetable-tbody", + row: /* @__PURE__ */ __name(function row(_ref6) { + var props = _ref6.props, instance = _ref6.instance; + return [{ + "p-treetable-row-selected": instance.selected, + "p-treetable-contextmenu-row-selected": props.contextMenuSelection && instance.isSelectedWithContextMenu + }]; + }, "row"), + bodyCell: /* @__PURE__ */ __name(function bodyCell(_ref7) { + var instance = _ref7.instance; + return [{ + "p-treetable-frozen-column": instance.columnProp("frozen") + }]; + }, "bodyCell"), + bodyCellContent: /* @__PURE__ */ __name(function bodyCellContent(_ref8) { + var instance = _ref8.instance; + return ["p-treetable-body-cell-content", { + "p-treetable-body-cell-content-expander": instance.columnProp("expander") + }]; + }, "bodyCellContent"), + nodeToggleButton: "p-treetable-node-toggle-button", + nodeToggleIcon: "p-treetable-node-toggle-icon", + pcNodeCheckbox: "p-treetable-node-checkbox", + emptyMessage: "p-treetable-empty-message", + tfoot: "p-treetable-tfoot", + footerCell: /* @__PURE__ */ __name(function footerCell(_ref9) { + var instance = _ref9.instance; + return [{ + "p-treetable-frozen-column": instance.columnProp("frozen") + }]; + }, "footerCell"), + footer: "p-treetable-footer", + columnResizeIndicator: "p-treetable-column-resize-indicator" +}; +var inlineStyles = { + tableContainer: { + overflow: "auto" + }, + thead: { + position: "sticky" + }, + tfoot: { + position: "sticky" + } +}; +var TreeTableStyle = BaseStyle.extend({ + name: "treetable", + theme: theme40, + classes, + inlineStyles +}); +var script$5 = { + name: "BaseTreeTable", + "extends": script$1d, + props: { + value: { + type: null, + "default": null + }, + dataKey: { + type: [String, Function], + "default": "key" + }, + expandedKeys: { + type: null, + "default": null + }, + selectionKeys: { + type: null, + "default": null + }, + selectionMode: { + type: String, + "default": null + }, + metaKeySelection: { + type: Boolean, + "default": false + }, + contextMenu: { + type: Boolean, + "default": false + }, + contextMenuSelection: { + type: Object, + "default": null + }, + rows: { + type: Number, + "default": 0 + }, + first: { + type: Number, + "default": 0 + }, + totalRecords: { + type: Number, + "default": 0 + }, + paginator: { + type: Boolean, + "default": false + }, + paginatorPosition: { + type: String, + "default": "bottom" + }, + alwaysShowPaginator: { + type: Boolean, + "default": true + }, + paginatorTemplate: { + type: String, + "default": "FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown" + }, + pageLinkSize: { + type: Number, + "default": 5 + }, + rowsPerPageOptions: { + type: Array, + "default": null + }, + currentPageReportTemplate: { + type: String, + "default": "({currentPage} of {totalPages})" + }, + lazy: { + type: Boolean, + "default": false + }, + loading: { + type: Boolean, + "default": false + }, + loadingIcon: { + type: String, + "default": void 0 + }, + loadingMode: { + type: String, + "default": "mask" + }, + rowHover: { + type: Boolean, + "default": false + }, + autoLayout: { + type: Boolean, + "default": false + }, + sortField: { + type: [String, Function], + "default": null + }, + sortOrder: { + type: Number, + "default": null + }, + defaultSortOrder: { + type: Number, + "default": 1 + }, + multiSortMeta: { + type: Array, + "default": null + }, + sortMode: { + type: String, + "default": "single" + }, + removableSort: { + type: Boolean, + "default": false + }, + filters: { + type: Object, + "default": null + }, + filterMode: { + type: String, + "default": "lenient" + }, + filterLocale: { + type: String, + "default": void 0 + }, + resizableColumns: { + type: Boolean, + "default": false + }, + columnResizeMode: { + type: String, + "default": "fit" + }, + indentation: { + type: Number, + "default": 1 + }, + showGridlines: { + type: Boolean, + "default": false + }, + scrollable: { + type: Boolean, + "default": false + }, + scrollHeight: { + type: String, + "default": null + }, + size: { + type: String, + "default": null + }, + tableStyle: { + type: null, + "default": null + }, + tableClass: { + type: [String, Object], + "default": null + }, + tableProps: { + type: Object, + "default": null + } + }, + style: TreeTableStyle, + provide: /* @__PURE__ */ __name(function provide51() { + return { + $pcTreeTable: this, + $parentInstance: this + }; + }, "provide") +}; +var script$4 = { + name: "FooterCell", + hostName: "TreeTable", + "extends": script$1d, + props: { + column: { + type: Object, + "default": null + }, + index: { + type: Number, + "default": null + } + }, + data: /* @__PURE__ */ __name(function data37() { + return { + styleObject: {} + }; + }, "data"), + mounted: /* @__PURE__ */ __name(function mounted41() { + if (this.columnProp("frozen")) { + this.updateStickyPosition(); + } + }, "mounted"), + updated: /* @__PURE__ */ __name(function updated10() { + if (this.columnProp("frozen")) { + this.updateStickyPosition(); + } + }, "updated"), + methods: { + columnProp: /* @__PURE__ */ __name(function columnProp(prop) { + return getVNodeProp(this.column, prop); + }, "columnProp"), + getColumnPT: /* @__PURE__ */ __name(function getColumnPT(key) { + var _this$$parentInstance; + var columnMetaData = { + props: this.column.props, + parent: { + instance: this, + props: this.$props, + state: this.$data + }, + context: { + index: this.index, + frozen: this.columnProp("frozen"), + size: (_this$$parentInstance = this.$parentInstance) === null || _this$$parentInstance === void 0 ? void 0 : _this$$parentInstance.size + } + }; + return mergeProps(this.ptm("column.".concat(key), { + column: columnMetaData + }), this.ptm("column.".concat(key), columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData)); + }, "getColumnPT"), + getColumnProp: /* @__PURE__ */ __name(function getColumnProp() { + return this.column.props && this.column.props.pt ? this.column.props.pt : void 0; + }, "getColumnProp"), + updateStickyPosition: /* @__PURE__ */ __name(function updateStickyPosition() { + if (this.columnProp("frozen")) { + var align = this.columnProp("alignFrozen"); + if (align === "right") { + var pos = 0; + var next = getNextElementSibling(this.$el, '[data-p-frozen-column="true"]'); + if (next) { + pos = getOuterWidth(next) + parseFloat(next.style.right || 0); + } + this.styleObject.insetInlineEnd = pos + "px"; + } else { + var _pos = 0; + var prev = getPreviousElementSibling(this.$el, '[data-p-frozen-column="true"]'); + if (prev) { + _pos = getOuterWidth(prev) + parseFloat(prev.style.left || 0); + } + this.styleObject.insetInlineStart = _pos + "px"; + } + } + }, "updateStickyPosition") + }, + computed: { + containerClass: /* @__PURE__ */ __name(function containerClass4() { + return [this.columnProp("footerClass"), this.columnProp("class"), this.cx("footerCell")]; + }, "containerClass"), + containerStyle: /* @__PURE__ */ __name(function containerStyle2() { + var bodyStyle = this.columnProp("footerStyle"); + var columnStyle = this.columnProp("style"); + return this.columnProp("frozen") ? [columnStyle, bodyStyle, this.styleObject] : [columnStyle, bodyStyle]; + }, "containerStyle") + } +}; +function _typeof$5(o) { + "@babel/helpers - typeof"; + return _typeof$5 = "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$5(o); +} +__name(_typeof$5, "_typeof$5"); +function ownKeys$5(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$5, "ownKeys$5"); +function _objectSpread$5(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$5(Object(t2), true).forEach(function(r2) { + _defineProperty$5(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$5(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$5, "_objectSpread$5"); +function _defineProperty$5(e, r, t2) { + return (r = _toPropertyKey$5(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$5, "_defineProperty$5"); +function _toPropertyKey$5(t2) { + var i = _toPrimitive$5(t2, "string"); + return "symbol" == _typeof$5(i) ? i : i + ""; +} +__name(_toPropertyKey$5, "_toPropertyKey$5"); +function _toPrimitive$5(t2, r) { + if ("object" != _typeof$5(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$5(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$5, "_toPrimitive$5"); +var _hoisted_1$4 = ["data-p-frozen-column"]; +function render$4(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("td", mergeProps({ + style: $options.containerStyle, + "class": $options.containerClass, + role: "cell" + }, _objectSpread$5(_objectSpread$5({}, $options.getColumnPT("root")), $options.getColumnPT("footerCell")), { + "data-p-frozen-column": $options.columnProp("frozen") + }), [$props.column.children && $props.column.children.footer ? (openBlock(), createBlock(resolveDynamicComponent($props.column.children.footer), { + key: 0, + column: $props.column + }, null, 8, ["column"])) : createCommentVNode("", true), $options.columnProp("footer") ? (openBlock(), createElementBlock("span", mergeProps({ + key: 1, + "class": _ctx.cx("columnFooter") + }, $options.getColumnPT("columnFooter")), toDisplayString($options.columnProp("footer")), 17)) : createCommentVNode("", true)], 16, _hoisted_1$4); +} +__name(render$4, "render$4"); +script$4.render = render$4; +var script$3 = { + name: "HeaderCell", + hostName: "TreeTable", + "extends": script$1d, + emits: ["column-click", "column-resizestart"], + props: { + column: { + type: Object, + "default": null + }, + resizableColumns: { + type: Boolean, + "default": false + }, + sortField: { + type: [String, Function], + "default": null + }, + sortOrder: { + type: Number, + "default": null + }, + multiSortMeta: { + type: Array, + "default": null + }, + sortMode: { + type: String, + "default": "single" + }, + index: { + type: Number, + "default": null + } + }, + data: /* @__PURE__ */ __name(function data38() { + return { + styleObject: {} + }; + }, "data"), + mounted: /* @__PURE__ */ __name(function mounted42() { + if (this.columnProp("frozen")) { + this.updateStickyPosition(); + } + }, "mounted"), + updated: /* @__PURE__ */ __name(function updated11() { + if (this.columnProp("frozen")) { + this.updateStickyPosition(); + } + }, "updated"), + methods: { + columnProp: /* @__PURE__ */ __name(function columnProp2(prop) { + return getVNodeProp(this.column, prop); + }, "columnProp"), + getColumnPT: /* @__PURE__ */ __name(function getColumnPT2(key) { + var _this$$parentInstance; + var columnMetaData = { + props: this.column.props, + parent: { + instance: this, + props: this.$props, + state: this.$data + }, + context: { + index: this.index, + sorted: this.isColumnSorted(), + frozen: this.$parentInstance.scrollable && this.columnProp("frozen"), + resizable: this.resizableColumns, + scrollable: this.$parentInstance.scrollable, + showGridlines: this.$parentInstance.showGridlines, + size: (_this$$parentInstance = this.$parentInstance) === null || _this$$parentInstance === void 0 ? void 0 : _this$$parentInstance.size + } + }; + return mergeProps(this.ptm("column.".concat(key), { + column: columnMetaData + }), this.ptm("column.".concat(key), columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData)); + }, "getColumnPT"), + getColumnProp: /* @__PURE__ */ __name(function getColumnProp2() { + return this.column.props && this.column.props.pt ? this.column.props.pt : void 0; + }, "getColumnProp"), + updateStickyPosition: /* @__PURE__ */ __name(function updateStickyPosition2() { + if (this.columnProp("frozen")) { + var align = this.columnProp("alignFrozen"); + if (align === "right") { + var pos = 0; + var next = getNextElementSibling(this.$el, '[data-p-frozen-column="true"]'); + if (next) { + pos = getOuterWidth(next) + parseFloat(next.style.right || 0); + } + this.styleObject.insetInlineEnd = pos + "px"; + } else { + var _pos = 0; + var prev = getPreviousElementSibling(this.$el, '[data-p-frozen-column="true"]'); + if (prev) { + _pos = getOuterWidth(prev) + parseFloat(prev.style.left || 0); + } + this.styleObject.insetInlineStart = _pos + "px"; + } + var filterRow = this.$el.parentElement.nextElementSibling; + if (filterRow) { + var index = getIndex(this.$el); + filterRow.children[index].style.left = this.styleObject.left; + filterRow.children[index].style.right = this.styleObject.right; + } + } + }, "updateStickyPosition"), + onClick: /* @__PURE__ */ __name(function onClick9(event2) { + this.$emit("column-click", { + originalEvent: event2, + column: this.column + }); + }, "onClick"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown13(event2) { + if ((event2.code === "Enter" || event2.code === "NumpadEnter" || event2.code === "Space") && event2.currentTarget.nodeName === "TH" && getAttribute(event2.currentTarget, "data-p-sortable-column")) { + this.$emit("column-click", { + originalEvent: event2, + column: this.column + }); + event2.preventDefault(); + } + }, "onKeyDown"), + onResizeStart: /* @__PURE__ */ __name(function onResizeStart(event2) { + this.$emit("column-resizestart", event2); + }, "onResizeStart"), + getMultiSortMetaIndex: /* @__PURE__ */ __name(function getMultiSortMetaIndex() { + var index = -1; + for (var i = 0; i < this.multiSortMeta.length; i++) { + var meta = this.multiSortMeta[i]; + if (meta.field === this.columnProp("field") || meta.field === this.columnProp("sortField")) { + index = i; + break; + } + } + return index; + }, "getMultiSortMetaIndex"), + isMultiSorted: /* @__PURE__ */ __name(function isMultiSorted() { + return this.columnProp("sortable") && this.getMultiSortMetaIndex() > -1; + }, "isMultiSorted"), + isColumnSorted: /* @__PURE__ */ __name(function isColumnSorted() { + return this.sortMode === "single" ? this.sortField && (this.sortField === this.columnProp("field") || this.sortField === this.columnProp("sortField")) : this.isMultiSorted(); + }, "isColumnSorted") + }, + computed: { + containerClass: /* @__PURE__ */ __name(function containerClass5() { + return [this.columnProp("headerClass"), this.columnProp("class"), this.cx("headerCell")]; + }, "containerClass"), + containerStyle: /* @__PURE__ */ __name(function containerStyle3() { + var headerStyle = this.columnProp("headerStyle"); + var columnStyle = this.columnProp("style"); + return this.columnProp("frozen") ? [columnStyle, headerStyle, this.styleObject] : [columnStyle, headerStyle]; + }, "containerStyle"), + sortState: /* @__PURE__ */ __name(function sortState() { + var sorted2 = false; + var sortOrder3 = null; + if (this.sortMode === "single") { + sorted2 = this.sortField && (this.sortField === this.columnProp("field") || this.sortField === this.columnProp("sortField")); + sortOrder3 = sorted2 ? this.sortOrder : 0; + } else if (this.sortMode === "multiple") { + var metaIndex = this.getMultiSortMetaIndex(); + if (metaIndex > -1) { + sorted2 = true; + sortOrder3 = this.multiSortMeta[metaIndex].order; + } + } + return { + sorted: sorted2, + sortOrder: sortOrder3 + }; + }, "sortState"), + sortableColumnIcon: /* @__PURE__ */ __name(function sortableColumnIcon() { + var _this$sortState = this.sortState, sorted2 = _this$sortState.sorted, sortOrder3 = _this$sortState.sortOrder; + if (!sorted2) return script$1V; + else if (sorted2 && sortOrder3 > 0) return script$1W; + else if (sorted2 && sortOrder3 < 0) return script$1X; + return null; + }, "sortableColumnIcon"), + ariaSort: /* @__PURE__ */ __name(function ariaSort() { + if (this.columnProp("sortable")) { + var _this$sortState2 = this.sortState, sorted2 = _this$sortState2.sorted, sortOrder3 = _this$sortState2.sortOrder; + if (sorted2 && sortOrder3 < 0) return "descending"; + else if (sorted2 && sortOrder3 > 0) return "ascending"; + else return "none"; + } else { + return null; + } + }, "ariaSort") + }, + components: { + Badge: script$1z, + SortAltIcon: script$1V, + SortAmountUpAltIcon: script$1W, + SortAmountDownIcon: script$1X + } +}; +function _typeof$4(o) { + "@babel/helpers - typeof"; + return _typeof$4 = "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$4(o); +} +__name(_typeof$4, "_typeof$4"); +function ownKeys$4(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$4, "ownKeys$4"); +function _objectSpread$4(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$4(Object(t2), true).forEach(function(r2) { + _defineProperty$4(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$4(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$4, "_objectSpread$4"); +function _defineProperty$4(e, r, t2) { + return (r = _toPropertyKey$4(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$4, "_defineProperty$4"); +function _toPropertyKey$4(t2) { + var i = _toPrimitive$4(t2, "string"); + return "symbol" == _typeof$4(i) ? i : i + ""; +} +__name(_toPropertyKey$4, "_toPropertyKey$4"); +function _toPrimitive$4(t2, r) { + if ("object" != _typeof$4(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$4(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$4, "_toPrimitive$4"); +var _hoisted_1$3$1 = ["tabindex", "aria-sort", "data-p-sortable-column", "data-p-resizable-column", "data-p-sorted", "data-p-frozen-column"]; +function render$3(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Badge = resolveComponent("Badge"); + return openBlock(), createElementBlock("th", mergeProps({ + "class": $options.containerClass, + style: [$options.containerStyle], + onClick: _cache[1] || (_cache[1] = function() { + return $options.onClick && $options.onClick.apply($options, arguments); + }), + onKeydown: _cache[2] || (_cache[2] = function() { + return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); + }), + tabindex: $options.columnProp("sortable") ? "0" : null, + "aria-sort": $options.ariaSort, + role: "columnheader" + }, _objectSpread$4(_objectSpread$4({}, $options.getColumnPT("root")), $options.getColumnPT("headerCell")), { + "data-p-sortable-column": $options.columnProp("sortable"), + "data-p-resizable-column": $props.resizableColumns, + "data-p-sorted": $options.isColumnSorted(), + "data-p-frozen-column": $options.columnProp("frozen") + }), [$props.resizableColumns && !$options.columnProp("frozen") ? (openBlock(), createElementBlock("span", mergeProps({ + key: 0, + "class": _ctx.cx("columnResizer"), + onMousedown: _cache[0] || (_cache[0] = function() { + return $options.onResizeStart && $options.onResizeStart.apply($options, arguments); + }) + }, $options.getColumnPT("columnResizer")), null, 16)) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("columnHeaderContent") + }, $options.getColumnPT("columnHeaderContent")), [$props.column.children && $props.column.children.header ? (openBlock(), createBlock(resolveDynamicComponent($props.column.children.header), { + key: 0, + column: $props.column + }, null, 8, ["column"])) : createCommentVNode("", true), $options.columnProp("header") ? (openBlock(), createElementBlock("span", mergeProps({ + key: 1, + "class": _ctx.cx("columnTitle") + }, $options.getColumnPT("columnTitle")), toDisplayString($options.columnProp("header")), 17)) : createCommentVNode("", true), $options.columnProp("sortable") ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ + key: 2 + }, $options.getColumnPT("sort"))), [(openBlock(), createBlock(resolveDynamicComponent($props.column.children && $props.column.children.sorticon || $options.sortableColumnIcon), mergeProps({ + sorted: $options.sortState.sorted, + sortOrder: $options.sortState.sortOrder, + "class": _ctx.cx("sortIcon") + }, $options.getColumnPT("sortIcon")), null, 16, ["sorted", "sortOrder", "class"]))], 16)) : createCommentVNode("", true), $options.isMultiSorted() ? (openBlock(), createBlock(_component_Badge, mergeProps({ + key: 3, + "class": _ctx.cx("pcSortBadge") + }, $options.getColumnPT("pcSortBadge"), { + value: $options.getMultiSortMetaIndex() + 1, + size: "small" + }), null, 16, ["class", "value"])) : createCommentVNode("", true)], 16)], 16, _hoisted_1$3$1); +} +__name(render$3, "render$3"); +script$3.render = render$3; +var script$2 = { + name: "BodyCell", + hostName: "TreeTable", + "extends": script$1d, + emits: ["node-toggle", "checkbox-toggle"], + props: { + node: { + type: Object, + "default": null + }, + column: { + type: Object, + "default": null + }, + level: { + type: Number, + "default": 0 + }, + indentation: { + type: Number, + "default": 1 + }, + leaf: { + type: Boolean, + "default": false + }, + expanded: { + type: Boolean, + "default": false + }, + selectionMode: { + type: String, + "default": null + }, + checked: { + type: Boolean, + "default": false + }, + partialChecked: { + type: Boolean, + "default": false + }, + templates: { + type: Object, + "default": null + }, + index: { + type: Number, + "default": null + }, + loadingMode: { + type: String, + "default": "mask" + } + }, + data: /* @__PURE__ */ __name(function data39() { + return { + styleObject: {} + }; + }, "data"), + mounted: /* @__PURE__ */ __name(function mounted43() { + if (this.columnProp("frozen")) { + this.updateStickyPosition(); + } + }, "mounted"), + updated: /* @__PURE__ */ __name(function updated12() { + if (this.columnProp("frozen")) { + this.updateStickyPosition(); + } + }, "updated"), + methods: { + toggle: /* @__PURE__ */ __name(function toggle4() { + this.$emit("node-toggle", this.node); + }, "toggle"), + columnProp: /* @__PURE__ */ __name(function columnProp3(prop) { + return getVNodeProp(this.column, prop); + }, "columnProp"), + getColumnPT: /* @__PURE__ */ __name(function getColumnPT3(key) { + var _this$$parentInstance; + var columnMetaData = { + props: this.column.props, + parent: { + instance: this, + props: this.$props, + state: this.$data + }, + context: { + index: this.index, + selectable: this.$parentInstance.rowHover || this.$parentInstance.rowSelectionMode, + selected: this.$parent.selected, + frozen: this.columnProp("frozen"), + scrollable: this.$parentInstance.scrollable, + showGridlines: this.$parentInstance.showGridlines, + size: (_this$$parentInstance = this.$parentInstance) === null || _this$$parentInstance === void 0 ? void 0 : _this$$parentInstance.size + } + }; + return mergeProps(this.ptm("column.".concat(key), { + column: columnMetaData + }), this.ptm("column.".concat(key), columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData)); + }, "getColumnPT"), + getColumnProp: /* @__PURE__ */ __name(function getColumnProp3() { + return this.column.props && this.column.props.pt ? this.column.props.pt : void 0; + }, "getColumnProp"), + getColumnCheckboxPT: /* @__PURE__ */ __name(function getColumnCheckboxPT(key) { + var columnMetaData = { + props: this.column.props, + parent: { + instance: this, + props: this.$props, + state: this.$data + }, + context: { + checked: this.checked, + partialChecked: this.partialChecked + } + }; + return mergeProps(this.ptm("column.".concat(key), { + column: columnMetaData + }), this.ptm("column.".concat(key), columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData)); + }, "getColumnCheckboxPT"), + updateStickyPosition: /* @__PURE__ */ __name(function updateStickyPosition3() { + if (this.columnProp("frozen")) { + var align = this.columnProp("alignFrozen"); + if (align === "right") { + var pos = 0; + var next = getNextElementSibling(this.$el, '[data-p-frozen-column="true"]'); + if (next) { + pos = getOuterWidth(next) + parseFloat(next.style.right || 0); + } + this.styleObject.insetInlineEnd = pos + "px"; + } else { + var _pos = 0; + var prev = getPreviousElementSibling(this.$el, '[data-p-frozen-column="true"]'); + if (prev) { + _pos = getOuterWidth(prev) + parseFloat(prev.style.left || 0); + } + this.styleObject.insetInlineStart = _pos + "px"; + } + } + }, "updateStickyPosition"), + resolveFieldData: /* @__PURE__ */ __name(function resolveFieldData$1(rowData, field) { + return resolveFieldData(rowData, field); + }, "resolveFieldData$1"), + toggleCheckbox: /* @__PURE__ */ __name(function toggleCheckbox() { + this.$emit("checkbox-toggle"); + }, "toggleCheckbox") + }, + computed: { + containerClass: /* @__PURE__ */ __name(function containerClass6() { + return [this.columnProp("bodyClass"), this.columnProp("class"), this.cx("bodyCell")]; + }, "containerClass"), + containerStyle: /* @__PURE__ */ __name(function containerStyle4() { + var bodyStyle = this.columnProp("bodyStyle"); + var columnStyle = this.columnProp("style"); + return this.columnProp("frozen") ? [columnStyle, bodyStyle, this.styleObject] : [columnStyle, bodyStyle]; + }, "containerStyle"), + togglerStyle: /* @__PURE__ */ __name(function togglerStyle() { + return { + marginLeft: this.level * this.indentation + "rem", + visibility: this.leaf ? "hidden" : "visible" + }; + }, "togglerStyle"), + checkboxSelectionMode: /* @__PURE__ */ __name(function checkboxSelectionMode() { + return this.selectionMode === "checkbox"; + }, "checkboxSelectionMode") + }, + components: { + Checkbox: script$1J, + ChevronRightIcon: script$1l, + ChevronDownIcon: script$1k, + CheckIcon: script$1D, + MinusIcon: script$1y, + SpinnerIcon: script$1r + }, + directives: { + ripple: Ripple + } +}; +function _typeof$3(o) { + "@babel/helpers - typeof"; + return _typeof$3 = "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$3(o); +} +__name(_typeof$3, "_typeof$3"); +function ownKeys$3(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$3, "ownKeys$3"); +function _objectSpread$3(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$3(Object(t2), true).forEach(function(r2) { + _defineProperty$3(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$3(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$3, "_objectSpread$3"); +function _defineProperty$3(e, r, t2) { + return (r = _toPropertyKey$3(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$3, "_defineProperty$3"); +function _toPropertyKey$3(t2) { + var i = _toPrimitive$3(t2, "string"); + return "symbol" == _typeof$3(i) ? i : i + ""; +} +__name(_toPropertyKey$3, "_toPropertyKey$3"); +function _toPrimitive$3(t2, r) { + if ("object" != _typeof$3(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$3(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$3, "_toPrimitive$3"); +var _hoisted_1$2$1 = ["data-p-frozen-column"]; +function render$2(_ctx, _cache, $props, $setup, $data, $options) { + var _component_SpinnerIcon = resolveComponent("SpinnerIcon"); + var _component_Checkbox = resolveComponent("Checkbox"); + var _directive_ripple = resolveDirective("ripple"); + return openBlock(), createElementBlock("td", mergeProps({ + style: $options.containerStyle, + "class": $options.containerClass, + role: "cell" + }, _objectSpread$3(_objectSpread$3({}, $options.getColumnPT("root")), $options.getColumnPT("bodyCell")), { + "data-p-frozen-column": $options.columnProp("frozen") + }), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("bodyCellContent") + }, $options.getColumnPT("bodyCellContent")), [$options.columnProp("expander") ? withDirectives((openBlock(), createElementBlock("button", mergeProps({ + key: 0, + type: "button", + "class": _ctx.cx("nodeToggleButton"), + onClick: _cache[0] || (_cache[0] = function() { + return $options.toggle && $options.toggle.apply($options, arguments); + }), + style: $options.togglerStyle, + tabindex: "-1" + }, $options.getColumnPT("nodeToggleButton"), { + "data-pc-group-section": "rowactionbutton" + }), [$props.node.loading && $props.loadingMode === "icon" ? (openBlock(), createElementBlock(Fragment, { + key: 0 + }, [$props.templates["nodetoggleicon"] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates["nodetoggleicon"]), { + key: 0 + })) : createCommentVNode("", true), $props.templates["nodetogglericon"] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates["nodetogglericon"]), { + key: 1 + })) : (openBlock(), createBlock(_component_SpinnerIcon, mergeProps({ + key: 2, + spin: "" + }, _ctx.ptm("nodetoggleicon")), null, 16))], 64)) : (openBlock(), createElementBlock(Fragment, { + key: 1 + }, [$props.column.children && $props.column.children.rowtoggleicon ? (openBlock(), createBlock(resolveDynamicComponent($props.column.children.rowtoggleicon), { + key: 0, + node: $props.node, + expanded: $props.expanded, + "class": normalizeClass(_ctx.cx("nodeToggleIcon")) + }, null, 8, ["node", "expanded", "class"])) : createCommentVNode("", true), $props.column.children && $props.column.children.rowtogglericon ? (openBlock(), createBlock(resolveDynamicComponent($props.column.children.rowtogglericon), { + key: 1, + node: $props.node, + expanded: $props.expanded, + "class": normalizeClass(_ctx.cx("nodeToggleIcon")) + }, null, 8, ["node", "expanded", "class"])) : $props.expanded ? (openBlock(), createBlock(resolveDynamicComponent($props.node.expandedIcon ? "span" : "ChevronDownIcon"), mergeProps({ + key: 2, + "class": _ctx.cx("nodeToggleIcon") + }, $options.getColumnPT("nodeToggleIcon")), null, 16, ["class"])) : (openBlock(), createBlock(resolveDynamicComponent($props.node.collapsedIcon ? "span" : "ChevronRightIcon"), mergeProps({ + key: 3, + "class": _ctx.cx("nodeToggleIcon") + }, $options.getColumnPT("nodeToggleIcon")), null, 16, ["class"]))], 64))], 16)), [[_directive_ripple]]) : createCommentVNode("", true), $options.checkboxSelectionMode && $options.columnProp("expander") ? (openBlock(), createBlock(_component_Checkbox, { + key: 1, + modelValue: $props.checked, + binary: true, + "class": normalizeClass(_ctx.cx("pcNodeCheckbox")), + disabled: $props.node.selectable === false, + onChange: $options.toggleCheckbox, + tabindex: -1, + indeterminate: $props.partialChecked, + unstyled: _ctx.unstyled, + pt: $options.getColumnCheckboxPT("pcNodeCheckbox"), + "data-p-partialchecked": $props.partialChecked + }, { + icon: withCtx(function(slotProps) { + return [$props.templates["checkboxicon"] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates["checkboxicon"]), { + key: 0, + checked: slotProps.checked, + partialChecked: $props.partialChecked, + "class": normalizeClass(slotProps["class"]) + }, null, 8, ["checked", "partialChecked", "class"])) : createCommentVNode("", true)]; + }), + _: 1 + }, 8, ["modelValue", "class", "disabled", "onChange", "indeterminate", "unstyled", "pt", "data-p-partialchecked"])) : createCommentVNode("", true), $props.column.children && $props.column.children.body ? (openBlock(), createBlock(resolveDynamicComponent($props.column.children.body), { + key: 2, + node: $props.node, + column: $props.column + }, null, 8, ["node", "column"])) : (openBlock(), createElementBlock(Fragment, { + key: 3 + }, [createTextVNode(toDisplayString($options.resolveFieldData($props.node.data, $options.columnProp("field"))), 1)], 64))], 16)], 16, _hoisted_1$2$1); +} +__name(render$2, "render$2"); +script$2.render = render$2; +function _typeof$2(o) { + "@babel/helpers - typeof"; + return _typeof$2 = "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$2(o); +} +__name(_typeof$2, "_typeof$2"); +function _createForOfIteratorHelper$1(r, e) { + var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (!t2) { + if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$1(r)) || e) { + t2 && (r = t2); + var _n = 0, F = /* @__PURE__ */ __name(function F2() { + }, "F"); + return { s: F, n: /* @__PURE__ */ __name(function n() { + return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; + }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { + throw r2; + }, "e"), 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 = true, u = false; + return { s: /* @__PURE__ */ __name(function s() { + t2 = t2.call(r); + }, "s"), n: /* @__PURE__ */ __name(function n() { + var r2 = t2.next(); + return a = r2.done, r2; + }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { + u = true, o = r2; + }, "e"), f: /* @__PURE__ */ __name(function f() { + try { + a || null == t2["return"] || t2["return"](); + } finally { + if (u) throw o; + } + }, "f") }; +} +__name(_createForOfIteratorHelper$1, "_createForOfIteratorHelper$1"); +function ownKeys$2(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$2, "ownKeys$2"); +function _objectSpread$2(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$2(Object(t2), true).forEach(function(r2) { + _defineProperty$2(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$2(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$2, "_objectSpread$2"); +function _defineProperty$2(e, r, t2) { + return (r = _toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$2, "_defineProperty$2"); +function _toPropertyKey$2(t2) { + var i = _toPrimitive$2(t2, "string"); + return "symbol" == _typeof$2(i) ? i : i + ""; +} +__name(_toPropertyKey$2, "_toPropertyKey$2"); +function _toPrimitive$2(t2, r) { + if ("object" != _typeof$2(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$2(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$2, "_toPrimitive$2"); +function _toConsumableArray$1(r) { + return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread$1(); +} +__name(_toConsumableArray$1, "_toConsumableArray$1"); +function _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."); +} +__name(_nonIterableSpread$1, "_nonIterableSpread$1"); +function _unsupportedIterableToArray$1(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray$1(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$1(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray$1, "_unsupportedIterableToArray$1"); +function _iterableToArray$1(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray$1, "_iterableToArray$1"); +function _arrayWithoutHoles$1(r) { + if (Array.isArray(r)) return _arrayLikeToArray$1(r); +} +__name(_arrayWithoutHoles$1, "_arrayWithoutHoles$1"); +function _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; +} +__name(_arrayLikeToArray$1, "_arrayLikeToArray$1"); +var script$1 = { + name: "TreeTableRow", + hostName: "TreeTable", + "extends": script$1d, + emits: ["node-click", "node-toggle", "checkbox-change", "nodeClick", "nodeToggle", "checkboxChange", "row-rightclick", "rowRightclick"], + props: { + node: { + type: null, + "default": null + }, + dataKey: { + type: [String, Function], + "default": "key" + }, + parentNode: { + type: null, + "default": null + }, + columns: { + type: null, + "default": null + }, + expandedKeys: { + type: null, + "default": null + }, + selectionKeys: { + type: null, + "default": null + }, + selectionMode: { + type: String, + "default": null + }, + level: { + type: Number, + "default": 0 + }, + indentation: { + type: Number, + "default": 1 + }, + tabindex: { + type: Number, + "default": -1 + }, + ariaSetSize: { + type: Number, + "default": null + }, + ariaPosInset: { + type: Number, + "default": null + }, + loadingMode: { + type: String, + "default": "mask" + }, + templates: { + type: Object, + "default": null + }, + contextMenu: { + type: Boolean, + "default": false + }, + contextMenuSelection: { + type: Object, + "default": null + } + }, + nodeTouched: false, + methods: { + columnProp: /* @__PURE__ */ __name(function columnProp4(col, prop) { + return getVNodeProp(col, prop); + }, "columnProp"), + toggle: /* @__PURE__ */ __name(function toggle5() { + this.$emit("node-toggle", this.node); + }, "toggle"), + onClick: /* @__PURE__ */ __name(function onClick10(event2) { + if (isClickable(event2.target) || getAttribute(event2.target, "data-pc-section") === "nodetogglebutton" || getAttribute(event2.target, "data-pc-section") === "nodetoggleicon" || event2.target.tagName === "path") { + return; + } + this.setTabIndexForSelectionMode(event2, this.nodeTouched); + this.$emit("node-click", { + originalEvent: event2, + nodeTouched: this.nodeTouched, + node: this.node + }); + this.nodeTouched = false; + }, "onClick"), + onRowRightClick: /* @__PURE__ */ __name(function onRowRightClick(event2) { + this.$emit("row-rightclick", { + originalEvent: event2, + node: this.node + }); + }, "onRowRightClick"), + onTouchEnd: /* @__PURE__ */ __name(function onTouchEnd2() { + this.nodeTouched = true; + }, "onTouchEnd"), + nodeKey: /* @__PURE__ */ __name(function nodeKey(node2) { + return resolveFieldData(node2, this.dataKey); + }, "nodeKey"), + onKeyDown: /* @__PURE__ */ __name(function onKeyDown14(event2, item8) { + switch (event2.code) { + case "ArrowDown": + this.onArrowDownKey(event2); + break; + case "ArrowUp": + this.onArrowUpKey(event2); + break; + case "ArrowLeft": + this.onArrowLeftKey(event2); + break; + case "ArrowRight": + this.onArrowRightKey(event2); + break; + case "Home": + this.onHomeKey(event2); + break; + case "End": + this.onEndKey(event2); + break; + case "Enter": + case "NumpadEnter": + case "Space": + if (!isClickable(event2.target)) { + this.onEnterKey(event2, item8); + } + break; + case "Tab": + this.onTabKey(event2); + break; + } + }, "onKeyDown"), + onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey9(event2) { + var nextElementSibling = event2.currentTarget.nextElementSibling; + nextElementSibling && this.focusRowChange(event2.currentTarget, nextElementSibling); + event2.preventDefault(); + }, "onArrowDownKey"), + onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey8(event2) { + var previousElementSibling = event2.currentTarget.previousElementSibling; + previousElementSibling && this.focusRowChange(event2.currentTarget, previousElementSibling); + event2.preventDefault(); + }, "onArrowUpKey"), + onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey4(event2) { + var _this = this; + var ishiddenIcon = findSingle(event2.currentTarget, "button").style.visibility === "hidden"; + var togglerElement = findSingle(this.$refs.node, '[data-pc-section="nodetogglebutton"]'); + if (ishiddenIcon) return; + !this.expanded && togglerElement.click(); + this.$nextTick(function() { + _this.onArrowDownKey(event2); + }); + event2.preventDefault(); + }, "onArrowRightKey"), + onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey5(event2) { + if (this.level === 0 && !this.expanded) { + return; + } + var currentTarget = event2.currentTarget; + var ishiddenIcon = findSingle(currentTarget, "button").style.visibility === "hidden"; + var togglerElement = findSingle(currentTarget, '[data-pc-section="nodetogglebutton"]'); + if (this.expanded && !ishiddenIcon) { + togglerElement.click(); + return; + } + var target = this.findBeforeClickableNode(currentTarget); + target && this.focusRowChange(currentTarget, target); + }, "onArrowLeftKey"), + onHomeKey: /* @__PURE__ */ __name(function onHomeKey9(event2) { + var findFirstElement = findSingle(event2.currentTarget.parentElement, 'tr[aria-level="'.concat(this.level + 1, '"]')); + findFirstElement && focus(findFirstElement); + event2.preventDefault(); + }, "onHomeKey"), + onEndKey: /* @__PURE__ */ __name(function onEndKey9(event2) { + var nodes = find(event2.currentTarget.parentElement, 'tr[aria-level="'.concat(this.level + 1, '"]')); + var findFirstElement = nodes[nodes.length - 1]; + focus(findFirstElement); + event2.preventDefault(); + }, "onEndKey"), + onEnterKey: /* @__PURE__ */ __name(function onEnterKey9(event2) { + event2.preventDefault(); + this.setTabIndexForSelectionMode(event2, this.nodeTouched); + if (this.selectionMode === "checkbox") { + this.toggleCheckbox(); + return; + } + this.$emit("node-click", { + originalEvent: event2, + nodeTouched: this.nodeTouched, + node: this.node + }); + this.nodeTouched = false; + }, "onEnterKey"), + onTabKey: /* @__PURE__ */ __name(function onTabKey6() { + var rows3 = _toConsumableArray$1(find(this.$refs.node.parentElement, "tr")); + var hasSelectedRow = rows3.some(function(row2) { + return getAttribute(row2, "data-p-selected") || row2.getAttribute("aria-checked") === "true"; + }); + rows3.forEach(function(row2) { + row2.tabIndex = -1; + }); + if (hasSelectedRow) { + var selectedNodes2 = rows3.filter(function(node2) { + return getAttribute(node2, "data-p-selected") || node2.getAttribute("aria-checked") === "true"; + }); + selectedNodes2[0].tabIndex = 0; + return; + } + rows3[0].tabIndex = 0; + }, "onTabKey"), + focusRowChange: /* @__PURE__ */ __name(function focusRowChange(firstFocusableRow, currentFocusedRow) { + firstFocusableRow.tabIndex = "-1"; + currentFocusedRow.tabIndex = "0"; + focus(currentFocusedRow); + }, "focusRowChange"), + findBeforeClickableNode: /* @__PURE__ */ __name(function findBeforeClickableNode(node2) { + var prevNode = node2.previousElementSibling; + if (prevNode) { + var prevNodeButton = prevNode.querySelector("button"); + if (prevNodeButton && prevNodeButton.style.visibility !== "hidden") { + return prevNode; + } + return this.findBeforeClickableNode(prevNode); + } + return null; + }, "findBeforeClickableNode"), + toggleCheckbox: /* @__PURE__ */ __name(function toggleCheckbox2() { + var _selectionKeys = this.selectionKeys ? _objectSpread$2({}, this.selectionKeys) : {}; + var _check = !this.checked; + this.propagateDown(this.node, _check, _selectionKeys); + this.$emit("checkbox-change", { + node: this.node, + check: _check, + selectionKeys: _selectionKeys + }); + }, "toggleCheckbox"), + propagateDown: /* @__PURE__ */ __name(function propagateDown(node2, check, selectionKeys) { + if (check) selectionKeys[this.nodeKey(node2)] = { + checked: true, + partialChecked: false + }; + else delete selectionKeys[this.nodeKey(node2)]; + if (node2.children && node2.children.length) { + var _iterator = _createForOfIteratorHelper$1(node2.children), _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + var child = _step.value; + this.propagateDown(child, check, selectionKeys); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + } + }, "propagateDown"), + propagateUp: /* @__PURE__ */ __name(function propagateUp(event2) { + var check = event2.check; + var _selectionKeys = _objectSpread$2({}, event2.selectionKeys); + var checkedChildCount = 0; + var childPartialSelected = false; + var _iterator2 = _createForOfIteratorHelper$1(this.node.children), _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { + var child = _step2.value; + if (_selectionKeys[this.nodeKey(child)] && _selectionKeys[this.nodeKey(child)].checked) checkedChildCount++; + else if (_selectionKeys[this.nodeKey(child)] && _selectionKeys[this.nodeKey(child)].partialChecked) childPartialSelected = true; + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + if (check && checkedChildCount === this.node.children.length) { + _selectionKeys[this.nodeKey(this.node)] = { + checked: true, + partialChecked: false + }; + } else { + if (!check) { + delete _selectionKeys[this.nodeKey(this.node)]; + } + if (childPartialSelected || checkedChildCount > 0 && checkedChildCount !== this.node.children.length) _selectionKeys[this.nodeKey(this.node)] = { + checked: false, + partialChecked: true + }; + else _selectionKeys[this.nodeKey(this.node)] = { + checked: false, + partialChecked: false + }; + } + this.$emit("checkbox-change", { + node: event2.node, + check: event2.check, + selectionKeys: _selectionKeys + }); + }, "propagateUp"), + onCheckboxChange: /* @__PURE__ */ __name(function onCheckboxChange(event2) { + var check = event2.check; + var _selectionKeys = _objectSpread$2({}, event2.selectionKeys); + var checkedChildCount = 0; + var childPartialSelected = false; + var _iterator3 = _createForOfIteratorHelper$1(this.node.children), _step3; + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { + var child = _step3.value; + if (_selectionKeys[this.nodeKey(child)] && _selectionKeys[this.nodeKey(child)].checked) checkedChildCount++; + else if (_selectionKeys[this.nodeKey(child)] && _selectionKeys[this.nodeKey(child)].partialChecked) childPartialSelected = true; + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + if (check && checkedChildCount === this.node.children.length) { + _selectionKeys[this.nodeKey(this.node)] = { + checked: true, + partialChecked: false + }; + } else { + if (!check) { + delete _selectionKeys[this.nodeKey(this.node)]; + } + if (childPartialSelected || checkedChildCount > 0 && checkedChildCount !== this.node.children.length) _selectionKeys[this.nodeKey(this.node)] = { + checked: false, + partialChecked: true + }; + else _selectionKeys[this.nodeKey(this.node)] = { + checked: false, + partialChecked: false + }; + } + this.$emit("checkbox-change", { + node: event2.node, + check: event2.check, + selectionKeys: _selectionKeys + }); + }, "onCheckboxChange"), + setTabIndexForSelectionMode: /* @__PURE__ */ __name(function setTabIndexForSelectionMode(event2, nodeTouched) { + if (this.selectionMode !== null) { + var elements = _toConsumableArray$1(find(this.$refs.node.parentElement, "tr")); + event2.currentTarget.tabIndex = nodeTouched === false ? -1 : 0; + if (elements.every(function(element) { + return element.tabIndex === -1; + })) { + elements[0].tabIndex = 0; + } + } + }, "setTabIndexForSelectionMode") + }, + computed: { + containerClass: /* @__PURE__ */ __name(function containerClass7() { + return [this.node.styleClass, this.cx("row")]; + }, "containerClass"), + expanded: /* @__PURE__ */ __name(function expanded2() { + return this.expandedKeys && this.expandedKeys[this.nodeKey(this.node)] === true; + }, "expanded"), + leaf: /* @__PURE__ */ __name(function leaf2() { + return this.node.leaf === false ? false : !(this.node.children && this.node.children.length); + }, "leaf"), + selected: /* @__PURE__ */ __name(function selected2() { + return this.selectionMode && this.selectionKeys ? this.selectionKeys[this.nodeKey(this.node)] === true : false; + }, "selected"), + isSelectedWithContextMenu: /* @__PURE__ */ __name(function isSelectedWithContextMenu() { + if (this.node && this.contextMenuSelection) { + return equals(this.node, this.contextMenuSelection, this.dataKey); + } + return false; + }, "isSelectedWithContextMenu"), + checked: /* @__PURE__ */ __name(function checked() { + return this.selectionKeys ? this.selectionKeys[this.nodeKey(this.node)] && this.selectionKeys[this.nodeKey(this.node)].checked : false; + }, "checked"), + partialChecked: /* @__PURE__ */ __name(function partialChecked() { + return this.selectionKeys ? this.selectionKeys[this.nodeKey(this.node)] && this.selectionKeys[this.nodeKey(this.node)].partialChecked : false; + }, "partialChecked"), + getAriaSelected: /* @__PURE__ */ __name(function getAriaSelected() { + return this.selectionMode === "single" || this.selectionMode === "multiple" ? this.selected : null; + }, "getAriaSelected"), + ptmOptions: /* @__PURE__ */ __name(function ptmOptions2() { + return { + context: { + selectable: this.$parentInstance.rowHover || this.$parentInstance.rowSelectionMode, + selected: this.selected, + scrollable: this.$parentInstance.scrollable + } + }; + }, "ptmOptions") + }, + components: { + TTBodyCell: script$2 + } +}; +var _hoisted_1$1$1 = ["tabindex", "aria-expanded", "aria-level", "aria-setsize", "aria-posinset", "aria-selected", "aria-checked", "data-p-selected", "data-p-selected-contextmenu"]; +function render$1(_ctx, _cache, $props, $setup, $data, $options) { + var _component_TTBodyCell = resolveComponent("TTBodyCell"); + var _component_TreeTableRow = resolveComponent("TreeTableRow", true); + return openBlock(), createElementBlock(Fragment, null, [createBaseVNode("tr", mergeProps({ + ref: "node", + "class": $options.containerClass, + style: $props.node.style, + tabindex: $props.tabindex, + role: "row", + "aria-expanded": $props.node.children && $props.node.children.length ? $options.expanded : void 0, + "aria-level": $props.level + 1, + "aria-setsize": $props.ariaSetSize, + "aria-posinset": $props.ariaPosInset, + "aria-selected": $options.getAriaSelected, + "aria-checked": $options.checked || void 0, + onClick: _cache[1] || (_cache[1] = function() { + return $options.onClick && $options.onClick.apply($options, arguments); + }), + onKeydown: _cache[2] || (_cache[2] = function() { + return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); + }), + onTouchend: _cache[3] || (_cache[3] = function() { + return $options.onTouchEnd && $options.onTouchEnd.apply($options, arguments); + }), + onContextmenu: _cache[4] || (_cache[4] = function() { + return $options.onRowRightClick && $options.onRowRightClick.apply($options, arguments); + }) + }, _ctx.ptm("row", $options.ptmOptions), { + "data-p-selected": $options.selected, + "data-p-selected-contextmenu": $props.contextMenuSelection && $options.isSelectedWithContextMenu + }), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.columns, function(col, i) { + return openBlock(), createElementBlock(Fragment, { + key: $options.columnProp(col, "columnKey") || $options.columnProp(col, "field") || i + }, [!$options.columnProp(col, "hidden") ? (openBlock(), createBlock(_component_TTBodyCell, { + key: 0, + column: col, + node: $props.node, + level: $props.level, + leaf: $options.leaf, + indentation: $props.indentation, + expanded: $options.expanded, + selectionMode: $props.selectionMode, + checked: $options.checked, + partialChecked: $options.partialChecked, + templates: $props.templates, + onNodeToggle: _cache[0] || (_cache[0] = function($event) { + return _ctx.$emit("node-toggle", $event); + }), + onCheckboxToggle: $options.toggleCheckbox, + index: i, + loadingMode: $props.loadingMode, + unstyled: _ctx.unstyled, + pt: _ctx.pt + }, null, 8, ["column", "node", "level", "leaf", "indentation", "expanded", "selectionMode", "checked", "partialChecked", "templates", "onCheckboxToggle", "index", "loadingMode", "unstyled", "pt"])) : createCommentVNode("", true)], 64); + }), 128))], 16, _hoisted_1$1$1), $options.expanded && $props.node.children && $props.node.children.length ? (openBlock(true), createElementBlock(Fragment, { + key: 0 + }, renderList($props.node.children, function(childNode) { + return openBlock(), createBlock(_component_TreeTableRow, { + key: $options.nodeKey(childNode), + dataKey: $props.dataKey, + columns: $props.columns, + node: childNode, + parentNode: $props.node, + level: $props.level + 1, + expandedKeys: $props.expandedKeys, + selectionMode: $props.selectionMode, + selectionKeys: $props.selectionKeys, + contextMenu: $props.contextMenu, + contextMenuSelection: $props.contextMenuSelection, + indentation: $props.indentation, + ariaPosInset: $props.node.children.indexOf(childNode) + 1, + ariaSetSize: $props.node.children.length, + templates: $props.templates, + onNodeToggle: _cache[5] || (_cache[5] = function($event) { + return _ctx.$emit("node-toggle", $event); + }), + onNodeClick: _cache[6] || (_cache[6] = function($event) { + return _ctx.$emit("node-click", $event); + }), + onRowRightclick: _cache[7] || (_cache[7] = function($event) { + return _ctx.$emit("row-rightclick", $event); + }), + onCheckboxChange: $options.onCheckboxChange, + unstyled: _ctx.unstyled, + pt: _ctx.pt + }, null, 8, ["dataKey", "columns", "node", "parentNode", "level", "expandedKeys", "selectionMode", "selectionKeys", "contextMenu", "contextMenuSelection", "indentation", "ariaPosInset", "ariaSetSize", "templates", "onCheckboxChange", "unstyled", "pt"]); + }), 128)) : createCommentVNode("", true)], 64); +} +__name(render$1, "render$1"); +script$1.render = render$1; +function _typeof$1(o) { + "@babel/helpers - typeof"; + return _typeof$1 = "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$1(o); +} +__name(_typeof$1, "_typeof$1"); +function _createForOfIteratorHelper(r, e) { + var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (!t2) { + if (Array.isArray(r) || (t2 = _unsupportedIterableToArray(r)) || e) { + t2 && (r = t2); + var _n = 0, F = /* @__PURE__ */ __name(function F2() { + }, "F"); + return { s: F, n: /* @__PURE__ */ __name(function n() { + return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; + }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { + throw r2; + }, "e"), 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 = true, u = false; + return { s: /* @__PURE__ */ __name(function s() { + t2 = t2.call(r); + }, "s"), n: /* @__PURE__ */ __name(function n() { + var r2 = t2.next(); + return a = r2.done, r2; + }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { + u = true, o = r2; + }, "e"), f: /* @__PURE__ */ __name(function f() { + try { + a || null == t2["return"] || t2["return"](); + } finally { + if (u) throw o; + } + }, "f") }; +} +__name(_createForOfIteratorHelper, "_createForOfIteratorHelper"); +function ownKeys$1(e, r) { + var t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys$1, "ownKeys$1"); +function _objectSpread$1(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$1(Object(t2), true).forEach(function(r2) { + _defineProperty$1(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$1(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread$1, "_objectSpread$1"); +function _defineProperty$1(e, r, t2) { + return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty$1, "_defineProperty$1"); +function _toPropertyKey$1(t2) { + var i = _toPrimitive$1(t2, "string"); + return "symbol" == _typeof$1(i) ? i : i + ""; +} +__name(_toPropertyKey$1, "_toPropertyKey$1"); +function _toPrimitive$1(t2, r) { + if ("object" != _typeof$1(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof$1(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive$1, "_toPrimitive$1"); +function _toConsumableArray(r) { + return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); +} +__name(_toConsumableArray, "_toConsumableArray"); +function _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."); +} +__name(_nonIterableSpread, "_nonIterableSpread"); +function _unsupportedIterableToArray(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray(r, a); + var t2 = {}.toString.call(r).slice(8, -1); + return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray(r, a) : void 0; + } +} +__name(_unsupportedIterableToArray, "_unsupportedIterableToArray"); +function _iterableToArray(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray, "_iterableToArray"); +function _arrayWithoutHoles(r) { + if (Array.isArray(r)) return _arrayLikeToArray(r); +} +__name(_arrayWithoutHoles, "_arrayWithoutHoles"); +function _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; +} +__name(_arrayLikeToArray, "_arrayLikeToArray"); +var script = { + name: "TreeTable", + "extends": script$5, + inheritAttrs: false, + emits: ["node-expand", "node-collapse", "update:expandedKeys", "update:selectionKeys", "node-select", "node-unselect", "update:first", "update:rows", "page", "update:sortField", "update:sortOrder", "update:multiSortMeta", "sort", "filter", "column-resize-end", "update:contextMenuSelection", "row-contextmenu"], + provide: /* @__PURE__ */ __name(function provide52() { + return { + $columns: this.d_columns + }; + }, "provide"), + data: /* @__PURE__ */ __name(function data40() { + return { + d_expandedKeys: this.expandedKeys || {}, + d_first: this.first, + d_rows: this.rows, + d_sortField: this.sortField, + d_sortOrder: this.sortOrder, + d_multiSortMeta: this.multiSortMeta ? _toConsumableArray(this.multiSortMeta) : [], + hasASelectedNode: false, + d_columns: new _default({ + type: "Column" + }) + }; + }, "data"), + documentColumnResizeListener: null, + documentColumnResizeEndListener: null, + lastResizeHelperX: null, + resizeColumnElement: null, + watch: { + expandedKeys: /* @__PURE__ */ __name(function expandedKeys3(newValue) { + this.d_expandedKeys = newValue; + }, "expandedKeys"), + first: /* @__PURE__ */ __name(function first2(newValue) { + this.d_first = newValue; + }, "first"), + rows: /* @__PURE__ */ __name(function rows2(newValue) { + this.d_rows = newValue; + }, "rows"), + sortField: /* @__PURE__ */ __name(function sortField2(newValue) { + this.d_sortField = newValue; + }, "sortField"), + sortOrder: /* @__PURE__ */ __name(function sortOrder2(newValue) { + this.d_sortOrder = newValue; + }, "sortOrder"), + multiSortMeta: /* @__PURE__ */ __name(function multiSortMeta(newValue) { + this.d_multiSortMeta = newValue; + }, "multiSortMeta") + }, + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount18() { + this.destroyStyleElement(); + this.d_columns.clear(); + }, "beforeUnmount"), + methods: { + columnProp: /* @__PURE__ */ __name(function columnProp5(col, prop) { + return getVNodeProp(col, prop); + }, "columnProp"), + ptHeaderCellOptions: /* @__PURE__ */ __name(function ptHeaderCellOptions(column2) { + return { + context: { + frozen: this.columnProp(column2, "frozen") + } + }; + }, "ptHeaderCellOptions"), + onNodeToggle: /* @__PURE__ */ __name(function onNodeToggle3(node2) { + var key = this.nodeKey(node2); + if (this.d_expandedKeys[key]) { + delete this.d_expandedKeys[key]; + this.$emit("node-collapse", node2); + } else { + this.d_expandedKeys[key] = true; + this.$emit("node-expand", node2); + } + this.d_expandedKeys = _objectSpread$1({}, this.d_expandedKeys); + this.$emit("update:expandedKeys", this.d_expandedKeys); + }, "onNodeToggle"), + onNodeClick: /* @__PURE__ */ __name(function onNodeClick3(event2) { + if (this.rowSelectionMode && event2.node.selectable !== false) { + var metaSelection = event2.nodeTouched ? false : this.metaKeySelection; + var _selectionKeys = metaSelection ? this.handleSelectionWithMetaKey(event2) : this.handleSelectionWithoutMetaKey(event2); + this.$emit("update:selectionKeys", _selectionKeys); + } + }, "onNodeClick"), + nodeKey: /* @__PURE__ */ __name(function nodeKey2(node2) { + return resolveFieldData(node2, this.dataKey); + }, "nodeKey"), + handleSelectionWithMetaKey: /* @__PURE__ */ __name(function handleSelectionWithMetaKey(event2) { + var originalEvent = event2.originalEvent; + var node2 = event2.node; + var nodeKey3 = this.nodeKey(node2); + var metaKey = originalEvent.metaKey || originalEvent.ctrlKey; + var selected3 = this.isNodeSelected(node2); + var _selectionKeys; + if (selected3 && metaKey) { + if (this.isSingleSelectionMode()) { + _selectionKeys = {}; + } else { + _selectionKeys = _objectSpread$1({}, this.selectionKeys); + delete _selectionKeys[nodeKey3]; + } + this.$emit("node-unselect", node2); + } else { + if (this.isSingleSelectionMode()) { + _selectionKeys = {}; + } else if (this.isMultipleSelectionMode()) { + _selectionKeys = !metaKey ? {} : this.selectionKeys ? _objectSpread$1({}, this.selectionKeys) : {}; + } + _selectionKeys[nodeKey3] = true; + this.$emit("node-select", node2); + } + return _selectionKeys; + }, "handleSelectionWithMetaKey"), + handleSelectionWithoutMetaKey: /* @__PURE__ */ __name(function handleSelectionWithoutMetaKey(event2) { + var node2 = event2.node; + var nodeKey3 = this.nodeKey(node2); + var selected3 = this.isNodeSelected(node2); + var _selectionKeys; + if (this.isSingleSelectionMode()) { + if (selected3) { + _selectionKeys = {}; + this.$emit("node-unselect", node2); + } else { + _selectionKeys = {}; + _selectionKeys[nodeKey3] = true; + this.$emit("node-select", node2); + } + } else { + if (selected3) { + _selectionKeys = _objectSpread$1({}, this.selectionKeys); + delete _selectionKeys[nodeKey3]; + this.$emit("node-unselect", node2); + } else { + _selectionKeys = this.selectionKeys ? _objectSpread$1({}, this.selectionKeys) : {}; + _selectionKeys[nodeKey3] = true; + this.$emit("node-select", node2); + } + } + return _selectionKeys; + }, "handleSelectionWithoutMetaKey"), + onCheckboxChange: /* @__PURE__ */ __name(function onCheckboxChange2(event2) { + this.$emit("update:selectionKeys", event2.selectionKeys); + if (event2.check) this.$emit("node-select", event2.node); + else this.$emit("node-unselect", event2.node); + }, "onCheckboxChange"), + onRowRightClick: /* @__PURE__ */ __name(function onRowRightClick2(event2) { + if (this.contextMenu) { + clearSelection(); + event2.originalEvent.target.focus(); + } + this.$emit("update:contextMenuSelection", event2.node); + this.$emit("row-contextmenu", event2); + }, "onRowRightClick"), + isSingleSelectionMode: /* @__PURE__ */ __name(function isSingleSelectionMode() { + return this.selectionMode === "single"; + }, "isSingleSelectionMode"), + isMultipleSelectionMode: /* @__PURE__ */ __name(function isMultipleSelectionMode() { + return this.selectionMode === "multiple"; + }, "isMultipleSelectionMode"), + onPage: /* @__PURE__ */ __name(function onPage2(event2) { + this.d_first = event2.first; + this.d_rows = event2.rows; + var pageEvent = this.createLazyLoadEvent(event2); + pageEvent.pageCount = event2.pageCount; + pageEvent.page = event2.page; + this.d_expandedKeys = {}; + this.$emit("update:expandedKeys", this.d_expandedKeys); + this.$emit("update:first", this.d_first); + this.$emit("update:rows", this.d_rows); + this.$emit("page", pageEvent); + }, "onPage"), + resetPage: /* @__PURE__ */ __name(function resetPage2() { + this.d_first = 0; + this.$emit("update:first", this.d_first); + }, "resetPage"), + getFilterColumnHeaderClass: /* @__PURE__ */ __name(function getFilterColumnHeaderClass(column2) { + return [this.cx("headerCell", { + column: column2 + }), this.columnProp(column2, "filterHeaderClass")]; + }, "getFilterColumnHeaderClass"), + onColumnHeaderClick: /* @__PURE__ */ __name(function onColumnHeaderClick(e) { + var event2 = e.originalEvent; + var column2 = e.column; + if (this.columnProp(column2, "sortable")) { + var targetNode = event2.target; + var columnField = this.columnProp(column2, "sortField") || this.columnProp(column2, "field"); + if (getAttribute(targetNode, "data-p-sortable-column") === true || getAttribute(targetNode, "data-pc-section") === "columntitle" || getAttribute(targetNode, "data-pc-section") === "columnheadercontent" || getAttribute(targetNode, "data-pc-section") === "sorticon" || getAttribute(targetNode.parentElement, "data-pc-section") === "sorticon" || getAttribute(targetNode.parentElement.parentElement, "data-pc-section") === "sorticon" || targetNode.closest('[data-p-sortable-column="true"]')) { + clearSelection(); + if (this.sortMode === "single") { + if (this.d_sortField === columnField) { + if (this.removableSort && this.d_sortOrder * -1 === this.defaultSortOrder) { + this.d_sortOrder = null; + this.d_sortField = null; + } else { + this.d_sortOrder = this.d_sortOrder * -1; + } + } else { + this.d_sortOrder = this.defaultSortOrder; + this.d_sortField = columnField; + } + this.$emit("update:sortField", this.d_sortField); + this.$emit("update:sortOrder", this.d_sortOrder); + this.resetPage(); + } else if (this.sortMode === "multiple") { + var metaKey = event2.metaKey || event2.ctrlKey; + if (!metaKey) { + this.d_multiSortMeta = this.d_multiSortMeta.filter(function(meta) { + return meta.field === columnField; + }); + } + this.addMultiSortField(columnField); + this.$emit("update:multiSortMeta", this.d_multiSortMeta); + } + this.$emit("sort", this.createLazyLoadEvent(event2)); + } + } + }, "onColumnHeaderClick"), + addMultiSortField: /* @__PURE__ */ __name(function addMultiSortField(field) { + var index = this.d_multiSortMeta.findIndex(function(meta) { + return meta.field === field; + }); + if (index >= 0) { + if (this.removableSort && this.d_multiSortMeta[index].order * -1 === this.defaultSortOrder) this.d_multiSortMeta.splice(index, 1); + else this.d_multiSortMeta[index] = { + field, + order: this.d_multiSortMeta[index].order * -1 + }; + } else { + this.d_multiSortMeta.push({ + field, + order: this.defaultSortOrder + }); + } + this.d_multiSortMeta = _toConsumableArray(this.d_multiSortMeta); + }, "addMultiSortField"), + sortSingle: /* @__PURE__ */ __name(function sortSingle(nodes) { + return this.sortNodesSingle(nodes); + }, "sortSingle"), + sortNodesSingle: /* @__PURE__ */ __name(function sortNodesSingle(nodes) { + var _this = this; + var _nodes = _toConsumableArray(nodes); + var comparer = localeComparator(); + _nodes.sort(function(node1, node2) { + var value1 = resolveFieldData(node1.data, _this.d_sortField); + var value2 = resolveFieldData(node2.data, _this.d_sortField); + return sort(value1, value2, _this.d_sortOrder, comparer); + }); + return _nodes; + }, "sortNodesSingle"), + sortMultiple: /* @__PURE__ */ __name(function sortMultiple(nodes) { + return this.sortNodesMultiple(nodes); + }, "sortMultiple"), + sortNodesMultiple: /* @__PURE__ */ __name(function sortNodesMultiple(nodes) { + var _this2 = this; + var _nodes = _toConsumableArray(nodes); + _nodes.sort(function(node1, node2) { + return _this2.multisortField(node1, node2, 0); + }); + return _nodes; + }, "sortNodesMultiple"), + multisortField: /* @__PURE__ */ __name(function multisortField(node1, node2, index) { + var value1 = resolveFieldData(node1.data, this.d_multiSortMeta[index].field); + var value2 = resolveFieldData(node2.data, this.d_multiSortMeta[index].field); + var comparer = localeComparator(); + if (value1 === value2) { + return this.d_multiSortMeta.length - 1 > index ? this.multisortField(node1, node2, index + 1) : 0; + } + return sort(value1, value2, this.d_multiSortMeta[index].order, comparer); + }, "multisortField"), + filter: /* @__PURE__ */ __name(function filter(value2) { + var filteredNodes = []; + var strict = this.filterMode === "strict"; + var _iterator = _createForOfIteratorHelper(value2), _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + var node2 = _step.value; + var copyNode = _objectSpread$1({}, node2); + var localMatch = true; + var globalMatch = false; + for (var j = 0; j < this.columns.length; j++) { + var col = this.columns[j]; + var filterField = this.columnProp(col, "filterField") || this.columnProp(col, "field"); + if (Object.prototype.hasOwnProperty.call(this.filters, filterField)) { + var filterMatchMode = this.columnProp(col, "filterMatchMode") || "startsWith"; + var filterValue = this.filters[filterField]; + var filterConstraint = FilterService.filters[filterMatchMode]; + var paramsWithoutNode = { + filterField, + filterValue, + filterConstraint, + strict + }; + if (strict && !(this.findFilteredNodes(copyNode, paramsWithoutNode) || this.isFilterMatched(copyNode, paramsWithoutNode)) || !strict && !(this.isFilterMatched(copyNode, paramsWithoutNode) || this.findFilteredNodes(copyNode, paramsWithoutNode))) { + localMatch = false; + } + if (!localMatch) { + break; + } + } + if (this.hasGlobalFilter() && !globalMatch) { + var copyNodeForGlobal = _objectSpread$1({}, copyNode); + var _filterValue = this.filters["global"]; + var _filterConstraint = FilterService.filters["contains"]; + var globalFilterParamsWithoutNode = { + filterField, + filterValue: _filterValue, + filterConstraint: _filterConstraint, + strict + }; + if (strict && (this.findFilteredNodes(copyNodeForGlobal, globalFilterParamsWithoutNode) || this.isFilterMatched(copyNodeForGlobal, globalFilterParamsWithoutNode)) || !strict && (this.isFilterMatched(copyNodeForGlobal, globalFilterParamsWithoutNode) || this.findFilteredNodes(copyNodeForGlobal, globalFilterParamsWithoutNode))) { + globalMatch = true; + copyNode = copyNodeForGlobal; + } + } + } + var matches = localMatch; + if (this.hasGlobalFilter()) { + matches = localMatch && globalMatch; + } + if (matches) { + filteredNodes.push(copyNode); + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + var filterEvent = this.createLazyLoadEvent(event); + filterEvent.filteredValue = filteredNodes; + this.$emit("filter", filterEvent); + return filteredNodes; + }, "filter"), + findFilteredNodes: /* @__PURE__ */ __name(function findFilteredNodes(node2, paramsWithoutNode) { + if (node2) { + var matched = false; + if (node2.children) { + var childNodes = _toConsumableArray(node2.children); + node2.children = []; + var _iterator2 = _createForOfIteratorHelper(childNodes), _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { + var childNode = _step2.value; + var copyChildNode = _objectSpread$1({}, childNode); + if (this.isFilterMatched(copyChildNode, paramsWithoutNode)) { + matched = true; + node2.children.push(copyChildNode); + } + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + } + if (matched) { + return true; + } + } + }, "findFilteredNodes"), + isFilterMatched: /* @__PURE__ */ __name(function isFilterMatched(node2, _ref) { + var filterField = _ref.filterField, filterValue = _ref.filterValue, filterConstraint = _ref.filterConstraint, strict = _ref.strict; + var matched = false; + var dataFieldValue = resolveFieldData(node2.data, filterField); + if (filterConstraint(dataFieldValue, filterValue, this.filterLocale)) { + matched = true; + } + if (!matched || strict && !this.isNodeLeaf(node2)) { + matched = this.findFilteredNodes(node2, { + filterField, + filterValue, + filterConstraint, + strict + }) || matched; + } + return matched; + }, "isFilterMatched"), + isNodeSelected: /* @__PURE__ */ __name(function isNodeSelected(node2) { + return this.selectionMode && this.selectionKeys ? this.selectionKeys[this.nodeKey(node2)] === true : false; + }, "isNodeSelected"), + isNodeLeaf: /* @__PURE__ */ __name(function isNodeLeaf(node2) { + return node2.leaf === false ? false : !(node2.children && node2.children.length); + }, "isNodeLeaf"), + createLazyLoadEvent: /* @__PURE__ */ __name(function createLazyLoadEvent(event2) { + var _this3 = this; + var filterMatchModes; + if (this.hasFilters()) { + filterMatchModes = {}; + this.columns.forEach(function(col) { + if (_this3.columnProp(col, "field")) { + filterMatchModes[col.props.field] = _this3.columnProp(col, "filterMatchMode"); + } + }); + } + return { + originalEvent: event2, + first: this.d_first, + rows: this.d_rows, + sortField: this.d_sortField, + sortOrder: this.d_sortOrder, + multiSortMeta: this.d_multiSortMeta, + filters: this.filters, + filterMatchModes + }; + }, "createLazyLoadEvent"), + onColumnResizeStart: /* @__PURE__ */ __name(function onColumnResizeStart(event2) { + var containerLeft = getOffset(this.$el).left; + this.resizeColumnElement = event2.target.parentElement; + this.columnResizing = true; + this.lastResizeHelperX = event2.pageX - containerLeft + this.$el.scrollLeft; + this.bindColumnResizeEvents(); + }, "onColumnResizeStart"), + onColumnResize: /* @__PURE__ */ __name(function onColumnResize(event2) { + var containerLeft = getOffset(this.$el).left; + this.$el.setAttribute("data-p-unselectable-text", "true"); + !this.isUnstyled && addStyle(this.$el, { + "user-select": "none" + }); + this.$refs.resizeHelper.style.height = this.$el.offsetHeight + "px"; + this.$refs.resizeHelper.style.top = "0px"; + this.$refs.resizeHelper.style.left = event2.pageX - containerLeft + this.$el.scrollLeft + "px"; + this.$refs.resizeHelper.style.display = "block"; + }, "onColumnResize"), + onColumnResizeEnd: /* @__PURE__ */ __name(function onColumnResizeEnd() { + var delta = isRTL(this.$el) ? this.lastResizeHelperX - this.$refs.resizeHelper.offsetLeft : this.$refs.resizeHelper.offsetLeft - this.lastResizeHelperX; + var columnWidth = this.resizeColumnElement.offsetWidth; + var newColumnWidth = columnWidth + delta; + var minWidth = this.resizeColumnElement.style.minWidth || 15; + if (columnWidth + delta > parseInt(minWidth, 10)) { + if (this.columnResizeMode === "fit") { + var nextColumn = this.resizeColumnElement.nextElementSibling; + var nextColumnWidth = nextColumn.offsetWidth - delta; + if (newColumnWidth > 15 && nextColumnWidth > 15) { + this.resizeTableCells(newColumnWidth, nextColumnWidth); + } + } else if (this.columnResizeMode === "expand") { + var tableWidth = this.$refs.table.offsetWidth + delta + "px"; + var updateTableWidth = /* @__PURE__ */ __name(function updateTableWidth2(el) { + !!el && (el.style.width = el.style.minWidth = tableWidth); + }, "updateTableWidth"); + this.resizeTableCells(newColumnWidth); + updateTableWidth(this.$refs.table); + } + this.$emit("column-resize-end", { + element: this.resizeColumnElement, + delta + }); + } + this.$refs.resizeHelper.style.display = "none"; + this.resizeColumn = null; + this.$el.removeAttribute("data-p-unselectable-text"); + !this.isUnstyled && (this.$el.style["user-select"] = ""); + this.unbindColumnResizeEvents(); + }, "onColumnResizeEnd"), + resizeTableCells: /* @__PURE__ */ __name(function resizeTableCells(newColumnWidth, nextColumnWidth) { + var colIndex = getIndex(this.resizeColumnElement); + var widths = []; + var headers = find(this.$refs.table, 'thead[data-pc-section="thead"] > tr > th'); + headers.forEach(function(header2) { + return widths.push(getOuterWidth(header2)); + }); + this.destroyStyleElement(); + this.createStyleElement(); + var innerHTML = ""; + var selector = '[data-pc-name="treetable"]['.concat(this.$attrSelector, '] > [data-pc-section="tablecontainer"] > table[data-pc-section="table"]'); + widths.forEach(function(width, index) { + var colWidth = index === colIndex ? newColumnWidth : nextColumnWidth && index === colIndex + 1 ? nextColumnWidth : width; + var style = "width: ".concat(colWidth, "px !important; max-width: ").concat(colWidth, "px !important"); + innerHTML += "\n ".concat(selector, ' > thead[data-pc-section="thead"] > tr > th:nth-child(').concat(index + 1, "),\n ").concat(selector, ' > tbody[data-pc-section="tbody"] > tr > td:nth-child(').concat(index + 1, "),\n ").concat(selector, ' > tfoot[data-pc-section="tfoot"] > tr > td:nth-child(').concat(index + 1, ") {\n ").concat(style, "\n }\n "); + }); + this.styleElement.innerHTML = innerHTML; + }, "resizeTableCells"), + bindColumnResizeEvents: /* @__PURE__ */ __name(function bindColumnResizeEvents() { + var _this4 = this; + if (!this.documentColumnResizeListener) { + this.documentColumnResizeListener = document.addEventListener("mousemove", function(event2) { + if (_this4.columnResizing) { + _this4.onColumnResize(event2); + } + }); + } + if (!this.documentColumnResizeEndListener) { + this.documentColumnResizeEndListener = document.addEventListener("mouseup", function() { + if (_this4.columnResizing) { + _this4.columnResizing = false; + _this4.onColumnResizeEnd(); + } + }); + } + }, "bindColumnResizeEvents"), + unbindColumnResizeEvents: /* @__PURE__ */ __name(function unbindColumnResizeEvents() { + if (this.documentColumnResizeListener) { + document.removeEventListener("document", this.documentColumnResizeListener); + this.documentColumnResizeListener = null; + } + if (this.documentColumnResizeEndListener) { + document.removeEventListener("document", this.documentColumnResizeEndListener); + this.documentColumnResizeEndListener = null; + } + }, "unbindColumnResizeEvents"), + onColumnKeyDown: /* @__PURE__ */ __name(function onColumnKeyDown(event2, col) { + if ((event2.code === "Enter" || event2.code === "NumpadEnter") && event2.currentTarget.nodeName === "TH" && getAttribute(event2.currentTarget, "data-p-sortable-column")) { + this.onColumnHeaderClick(event2, col); + } + }, "onColumnKeyDown"), + hasColumnFilter: /* @__PURE__ */ __name(function hasColumnFilter() { + if (this.columns) { + var _iterator3 = _createForOfIteratorHelper(this.columns), _step3; + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { + var col = _step3.value; + if (col.children && col.children.filter) { + return true; + } + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + } + return false; + }, "hasColumnFilter"), + hasFilters: /* @__PURE__ */ __name(function hasFilters() { + return this.filters && Object.keys(this.filters).length > 0 && this.filters.constructor === Object; + }, "hasFilters"), + hasGlobalFilter: /* @__PURE__ */ __name(function hasGlobalFilter() { + return this.filters && Object.prototype.hasOwnProperty.call(this.filters, "global"); + }, "hasGlobalFilter"), + getItemLabel: /* @__PURE__ */ __name(function getItemLabel6(node2) { + return node2.data.name; + }, "getItemLabel"), + createStyleElement: /* @__PURE__ */ __name(function createStyleElement() { + var _this$$primevue; + this.styleElement = document.createElement("style"); + this.styleElement.type = "text/css"; + 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); + document.head.appendChild(this.styleElement); + }, "createStyleElement"), + destroyStyleElement: /* @__PURE__ */ __name(function destroyStyleElement() { + if (this.styleElement) { + document.head.removeChild(this.styleElement); + this.styleElement = null; + } + }, "destroyStyleElement"), + setTabindex: /* @__PURE__ */ __name(function setTabindex(node2, index) { + if (this.isNodeSelected(node2)) { + this.hasASelectedNode = true; + return 0; + } + if (this.selectionMode) { + if (!this.isNodeSelected(node2) && index === 0 && !this.hasASelectedNode) return 0; + } else if (!this.selectionMode && index === 0) { + return 0; + } + return -1; + }, "setTabindex") + }, + computed: { + columns: /* @__PURE__ */ __name(function columns() { + return this.d_columns.get(this); + }, "columns"), + processedData: /* @__PURE__ */ __name(function processedData() { + if (this.lazy) { + return this.value; + } else { + if (this.value && this.value.length) { + var data41 = this.value; + if (this.sorted) { + if (this.sortMode === "single") data41 = this.sortSingle(data41); + else if (this.sortMode === "multiple") data41 = this.sortMultiple(data41); + } + if (this.hasFilters()) { + data41 = this.filter(data41); + } + return data41; + } else { + return null; + } + } + }, "processedData"), + dataToRender: /* @__PURE__ */ __name(function dataToRender() { + var data41 = this.processedData; + if (this.paginator) { + var first3 = this.lazy ? 0 : this.d_first; + return data41.slice(first3, first3 + this.d_rows); + } else { + return data41; + } + }, "dataToRender"), + empty: /* @__PURE__ */ __name(function empty2() { + var data41 = this.processedData; + return !data41 || data41.length === 0; + }, "empty"), + sorted: /* @__PURE__ */ __name(function sorted() { + return this.d_sortField || this.d_multiSortMeta && this.d_multiSortMeta.length > 0; + }, "sorted"), + hasFooter: /* @__PURE__ */ __name(function hasFooter() { + var hasFooter2 = false; + var _iterator4 = _createForOfIteratorHelper(this.columns), _step4; + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) { + var col = _step4.value; + if (this.columnProp(col, "footer") || col.children && col.children.footer) { + hasFooter2 = true; + break; + } + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + return hasFooter2; + }, "hasFooter"), + paginatorTop: /* @__PURE__ */ __name(function paginatorTop2() { + return this.paginator && (this.paginatorPosition !== "bottom" || this.paginatorPosition === "both"); + }, "paginatorTop"), + paginatorBottom: /* @__PURE__ */ __name(function paginatorBottom2() { + return this.paginator && (this.paginatorPosition !== "top" || this.paginatorPosition === "both"); + }, "paginatorBottom"), + singleSelectionMode: /* @__PURE__ */ __name(function singleSelectionMode() { + return this.selectionMode && this.selectionMode === "single"; + }, "singleSelectionMode"), + multipleSelectionMode: /* @__PURE__ */ __name(function multipleSelectionMode() { + return this.selectionMode && this.selectionMode === "multiple"; + }, "multipleSelectionMode"), + rowSelectionMode: /* @__PURE__ */ __name(function rowSelectionMode() { + return this.singleSelectionMode || this.multipleSelectionMode; + }, "rowSelectionMode"), + totalRecordsLength: /* @__PURE__ */ __name(function totalRecordsLength() { + if (this.lazy) { + return this.totalRecords; + } else { + var data41 = this.processedData; + return data41 ? data41.length : 0; + } + }, "totalRecordsLength") + }, + components: { + TTRow: script$1, + TTPaginator: script$1u, + TTHeaderCell: script$3, + TTFooterCell: script$4, + SpinnerIcon: script$1r + } +}; +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 t2 = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function(r2) { + return Object.getOwnPropertyDescriptor(e, r2).enumerable; + })), t2.push.apply(t2, o); + } + return t2; +} +__name(ownKeys, "ownKeys"); +function _objectSpread(e) { + for (var r = 1; r < arguments.length; r++) { + var t2 = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t2), true).forEach(function(r2) { + _defineProperty(e, r2, t2[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys(Object(t2)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); + }); + } + return e; +} +__name(_objectSpread, "_objectSpread"); +function _defineProperty(e, r, t2) { + return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; +} +__name(_defineProperty, "_defineProperty"); +function _toPropertyKey(t2) { + var i = _toPrimitive(t2, "string"); + return "symbol" == _typeof(i) ? i : i + ""; +} +__name(_toPropertyKey, "_toPropertyKey"); +function _toPrimitive(t2, r) { + if ("object" != _typeof(t2) || !t2) return t2; + var e = t2[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t2, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t2); +} +__name(_toPrimitive, "_toPrimitive"); +var _hoisted_1$5 = ["colspan"]; +function render3(_ctx, _cache, $props, $setup, $data, $options) { + var _component_TTPaginator = resolveComponent("TTPaginator"); + var _component_TTHeaderCell = resolveComponent("TTHeaderCell"); + var _component_TTRow = resolveComponent("TTRow"); + var _component_TTFooterCell = resolveComponent("TTFooterCell"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": _ctx.cx("root"), + "data-scrollselectors": ".p-treetable-scrollable-body" + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default"), _ctx.loading && _ctx.loadingMode === "mask" ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("loading") + }, _ctx.ptm("loading")), [createBaseVNode("div", mergeProps({ + "class": _ctx.cx("mask") + }, _ctx.ptm("mask")), [renderSlot(_ctx.$slots, "loadingicon", { + "class": normalizeClass(_ctx.cx("loadingIcon")) + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon ? "span" : "SpinnerIcon"), mergeProps({ + spin: "", + "class": [_ctx.cx("loadingIcon"), _ctx.loadingIcon] + }, _ctx.ptm("loadingIcon")), null, 16, ["class"]))]; + })], 16)], 16)) : createCommentVNode("", true), _ctx.$slots.header ? (openBlock(), createElementBlock("div", mergeProps({ + key: 1, + "class": _ctx.cx("header") + }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header")], 16)) : createCommentVNode("", true), $options.paginatorTop ? (openBlock(), createBlock(_component_TTPaginator, { + key: 2, + rows: $data.d_rows, + first: $data.d_first, + totalRecords: $options.totalRecordsLength, + pageLinkSize: _ctx.pageLinkSize, + template: _ctx.paginatorTemplate, + rowsPerPageOptions: _ctx.rowsPerPageOptions, + currentPageReportTemplate: _ctx.currentPageReportTemplate, + "class": normalizeClass(_ctx.cx("pcPaginator", { + position: "top" + })), + onPage: _cache[0] || (_cache[0] = function($event) { + return $options.onPage($event); + }), + alwaysShow: _ctx.alwaysShowPaginator, + unstyled: _ctx.unstyled, + pt: _ctx.ptm("pcPaginator") + }, createSlots({ + _: 2 + }, [_ctx.$slots.paginatorcontainer ? { + name: "container", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorcontainer", { + first: slotProps.first, + last: slotProps.last, + rows: slotProps.rows, + page: slotProps.page, + pageCount: slotProps.pageCount, + totalRecords: slotProps.totalRecords, + firstPageCallback: slotProps.firstPageCallback, + lastPageCallback: slotProps.lastPageCallback, + prevPageCallback: slotProps.prevPageCallback, + nextPageCallback: slotProps.nextPageCallback, + rowChangeCallback: slotProps.rowChangeCallback + })]; + }), + key: "0" + } : void 0, _ctx.$slots.paginatorstart ? { + name: "start", + fn: withCtx(function() { + return [renderSlot(_ctx.$slots, "paginatorstart")]; + }), + key: "1" + } : void 0, _ctx.$slots.paginatorend ? { + name: "end", + fn: withCtx(function() { + return [renderSlot(_ctx.$slots, "paginatorend")]; + }), + key: "2" + } : void 0, _ctx.$slots.paginatorfirstpagelinkicon ? { + name: "firstpagelinkicon", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorfirstpagelinkicon", { + "class": normalizeClass(slotProps["class"]) + })]; + }), + key: "3" + } : void 0, _ctx.$slots.paginatorprevpagelinkicon ? { + name: "prevpagelinkicon", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorprevpagelinkicon", { + "class": normalizeClass(slotProps["class"]) + })]; + }), + key: "4" + } : void 0, _ctx.$slots.paginatornextpagelinkicon ? { + name: "nextpagelinkicon", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatornextpagelinkicon", { + "class": normalizeClass(slotProps["class"]) + })]; + }), + key: "5" + } : void 0, _ctx.$slots.paginatorlastpagelinkicon ? { + name: "lastpagelinkicon", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorlastpagelinkicon", { + "class": normalizeClass(slotProps["class"]) + })]; + }), + key: "6" + } : void 0, _ctx.$slots.paginatorjumptopagedropdownicon ? { + name: "jumptopagedropdownicon", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorjumptopagedropdownicon", { + "class": normalizeClass(slotProps["class"]) + })]; + }), + key: "7" + } : void 0, _ctx.$slots.paginatorrowsperpagedropdownicon ? { + name: "rowsperpagedropdownicon", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorrowsperpagedropdownicon", { + "class": normalizeClass(slotProps["class"]) + })]; + }), + key: "8" + } : void 0]), 1032, ["rows", "first", "totalRecords", "pageLinkSize", "template", "rowsPerPageOptions", "currentPageReportTemplate", "class", "alwaysShow", "unstyled", "pt"])) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("tableContainer"), + style: [_ctx.sx("tableContainer"), { + maxHeight: _ctx.scrollHeight + }] + }, _ctx.ptm("tableContainer")), [createBaseVNode("table", mergeProps({ + ref: "table", + role: "table", + "class": [_ctx.cx("table"), _ctx.tableClass], + style: _ctx.tableStyle + }, _objectSpread(_objectSpread({}, _ctx.tableProps), _ctx.ptm("table"))), [createBaseVNode("thead", mergeProps({ + "class": _ctx.cx("thead"), + style: _ctx.sx("thead"), + role: "rowgroup" + }, _ctx.ptm("thead")), [createBaseVNode("tr", mergeProps({ + role: "row" + }, _ctx.ptm("headerRow")), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.columns, function(col, i) { + return openBlock(), createElementBlock(Fragment, { + key: $options.columnProp(col, "columnKey") || $options.columnProp(col, "field") || i + }, [!$options.columnProp(col, "hidden") ? (openBlock(), createBlock(_component_TTHeaderCell, { + key: 0, + column: col, + resizableColumns: _ctx.resizableColumns, + sortField: $data.d_sortField, + sortOrder: $data.d_sortOrder, + multiSortMeta: $data.d_multiSortMeta, + sortMode: _ctx.sortMode, + onColumnClick: _cache[1] || (_cache[1] = function($event) { + return $options.onColumnHeaderClick($event); + }), + onColumnResizestart: _cache[2] || (_cache[2] = function($event) { + return $options.onColumnResizeStart($event); + }), + index: i, + unstyled: _ctx.unstyled, + pt: _ctx.pt + }, null, 8, ["column", "resizableColumns", "sortField", "sortOrder", "multiSortMeta", "sortMode", "index", "unstyled", "pt"])) : createCommentVNode("", true)], 64); + }), 128))], 16), $options.hasColumnFilter() ? (openBlock(), createElementBlock("tr", normalizeProps(mergeProps({ + key: 0 + }, _ctx.ptm("headerRow"))), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.columns, function(col, i) { + return openBlock(), createElementBlock(Fragment, { + key: $options.columnProp(col, "columnKey") || $options.columnProp(col, "field") || i + }, [!$options.columnProp(col, "hidden") ? (openBlock(), createElementBlock("th", mergeProps({ + key: 0, + "class": $options.getFilterColumnHeaderClass(col), + style: [$options.columnProp(col, "style"), $options.columnProp(col, "filterHeaderStyle")], + ref_for: true + }, _ctx.ptm("headerCell", $options.ptHeaderCellOptions(col))), [col.children && col.children.filter ? (openBlock(), createBlock(resolveDynamicComponent(col.children.filter), { + key: 0, + column: col, + index: i + }, null, 8, ["column", "index"])) : createCommentVNode("", true)], 16)) : createCommentVNode("", true)], 64); + }), 128))], 16)) : createCommentVNode("", true)], 16), createBaseVNode("tbody", mergeProps({ + "class": _ctx.cx("tbody"), + role: "rowgroup" + }, _ctx.ptm("tbody")), [!$options.empty ? (openBlock(true), createElementBlock(Fragment, { + key: 0 + }, renderList($options.dataToRender, function(node2, index) { + return openBlock(), createBlock(_component_TTRow, { + key: $options.nodeKey(node2), + dataKey: _ctx.dataKey, + columns: $options.columns, + node: node2, + level: 0, + expandedKeys: $data.d_expandedKeys, + indentation: _ctx.indentation, + selectionMode: _ctx.selectionMode, + selectionKeys: _ctx.selectionKeys, + ariaSetSize: $options.dataToRender.length, + ariaPosInset: index + 1, + tabindex: $options.setTabindex(node2, index), + loadingMode: _ctx.loadingMode, + contextMenu: _ctx.contextMenu, + contextMenuSelection: _ctx.contextMenuSelection, + templates: _ctx.$slots, + onNodeToggle: $options.onNodeToggle, + onNodeClick: $options.onNodeClick, + onCheckboxChange: $options.onCheckboxChange, + onRowRightclick: _cache[3] || (_cache[3] = function($event) { + return $options.onRowRightClick($event); + }), + unstyled: _ctx.unstyled, + pt: _ctx.pt + }, null, 8, ["dataKey", "columns", "node", "expandedKeys", "indentation", "selectionMode", "selectionKeys", "ariaSetSize", "ariaPosInset", "tabindex", "loadingMode", "contextMenu", "contextMenuSelection", "templates", "onNodeToggle", "onNodeClick", "onCheckboxChange", "unstyled", "pt"]); + }), 128)) : (openBlock(), createElementBlock("tr", mergeProps({ + key: 1, + "class": _ctx.cx("emptyMessage") + }, _ctx.ptm("emptyMessage")), [createBaseVNode("td", mergeProps({ + colspan: $options.columns.length + }, _ctx.ptm("emptyMessageCell")), [renderSlot(_ctx.$slots, "empty")], 16, _hoisted_1$5)], 16))], 16), $options.hasFooter ? (openBlock(), createElementBlock("tfoot", mergeProps({ + key: 0, + "class": _ctx.cx("tfoot"), + style: _ctx.sx("tfoot"), + role: "rowgroup" + }, _ctx.ptm("tfoot")), [createBaseVNode("tr", mergeProps({ + role: "row" + }, _ctx.ptm("footerRow")), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.columns, function(col, i) { + return openBlock(), createElementBlock(Fragment, { + key: $options.columnProp(col, "columnKey") || $options.columnProp(col, "field") || i + }, [!$options.columnProp(col, "hidden") ? (openBlock(), createBlock(_component_TTFooterCell, { + key: 0, + column: col, + index: i, + unstyled: _ctx.unstyled, + pt: _ctx.pt + }, null, 8, ["column", "index", "unstyled", "pt"])) : createCommentVNode("", true)], 64); + }), 128))], 16)], 16)) : createCommentVNode("", true)], 16)], 16), $options.paginatorBottom ? (openBlock(), createBlock(_component_TTPaginator, { + key: 3, + rows: $data.d_rows, + first: $data.d_first, + totalRecords: $options.totalRecordsLength, + pageLinkSize: _ctx.pageLinkSize, + template: _ctx.paginatorTemplate, + rowsPerPageOptions: _ctx.rowsPerPageOptions, + currentPageReportTemplate: _ctx.currentPageReportTemplate, + "class": normalizeClass(_ctx.cx("pcPaginator", { + position: "bottom" + })), + onPage: _cache[4] || (_cache[4] = function($event) { + return $options.onPage($event); + }), + alwaysShow: _ctx.alwaysShowPaginator, + unstyled: _ctx.unstyled, + pt: _ctx.ptm("pcPaginator") + }, createSlots({ + _: 2 + }, [_ctx.$slots.paginatorcontainer ? { + name: "container", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorcontainer", { + first: slotProps.first, + last: slotProps.last, + rows: slotProps.rows, + page: slotProps.page, + pageCount: slotProps.pageCount, + totalRecords: slotProps.totalRecords, + firstPageCallback: slotProps.firstPageCallback, + lastPageCallback: slotProps.lastPageCallback, + prevPageCallback: slotProps.prevPageCallback, + nextPageCallback: slotProps.nextPageCallback, + rowChangeCallback: slotProps.rowChangeCallback + })]; + }), + key: "0" + } : void 0, _ctx.$slots.paginatorstart ? { + name: "start", + fn: withCtx(function() { + return [renderSlot(_ctx.$slots, "paginatorstart")]; + }), + key: "1" + } : void 0, _ctx.$slots.paginatorend ? { + name: "end", + fn: withCtx(function() { + return [renderSlot(_ctx.$slots, "paginatorend")]; + }), + key: "2" + } : void 0, _ctx.$slots.paginatorfirstpagelinkicon ? { + name: "firstpagelinkicon", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorfirstpagelinkicon", { + "class": normalizeClass(slotProps["class"]) + })]; + }), + key: "3" + } : void 0, _ctx.$slots.paginatorprevpagelinkicon ? { + name: "prevpagelinkicon", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorprevpagelinkicon", { + "class": normalizeClass(slotProps["class"]) + })]; + }), + key: "4" + } : void 0, _ctx.$slots.paginatornextpagelinkicon ? { + name: "nextpagelinkicon", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatornextpagelinkicon", { + "class": normalizeClass(slotProps["class"]) + })]; + }), + key: "5" + } : void 0, _ctx.$slots.paginatorlastpagelinkicon ? { + name: "lastpagelinkicon", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorlastpagelinkicon", { + "class": normalizeClass(slotProps["class"]) + })]; + }), + key: "6" + } : void 0, _ctx.$slots.paginatorjumptopagedropdownicon ? { + name: "jumptopagedropdownicon", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorjumptopagedropdownicon", { + "class": normalizeClass(slotProps["class"]) + })]; + }), + key: "7" + } : void 0, _ctx.$slots.paginatorrowsperpagedropdownicon ? { + name: "rowsperpagedropdownicon", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorrowsperpagedropdownicon", { + "class": normalizeClass(slotProps["class"]) + })]; + }), + key: "8" + } : void 0]), 1032, ["rows", "first", "totalRecords", "pageLinkSize", "template", "rowsPerPageOptions", "currentPageReportTemplate", "class", "alwaysShow", "unstyled", "pt"])) : createCommentVNode("", true), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", mergeProps({ + key: 4, + "class": _ctx.cx("footer") + }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + ref: "resizeHelper", + "class": _ctx.cx("columnResizeIndicator"), + style: { + "display": "none" + } + }, _ctx.ptm("columnResizeIndicator")), null, 16)], 16); +} +__name(render3, "render"); +script.render = render3; +const electron = electronAPI(); +const openUrl = /* @__PURE__ */ __name((url) => { + window.open(url, "_blank"); + return true; +}, "openUrl"); +const DESKTOP_MAINTENANCE_TASKS = [ + { + id: "basePath", + execute: /* @__PURE__ */ __name(async () => await electron.setBasePath(), "execute"), + name: "Base path", + shortDescription: "Change the application base path.", + errorDescription: "Unable to open the base path. Please select a new one.", + description: "The base path is the default location where ComfyUI stores data. It is the location fo the python environment, and may also contain models, custom nodes, and other extensions.", + isInstallationFix: true, + button: { + icon: PrimeIcons.QUESTION, + text: "Select" + } + }, + { + id: "git", + headerImg: "/assets/images/Git-Logo-White.svg", + execute: /* @__PURE__ */ __name(() => openUrl("https://git-scm.com/downloads/"), "execute"), + name: "Download git", + shortDescription: "Open the git download page.", + errorDescription: "Git is missing. Please download and install git, then restart ComfyUI Desktop.", + description: "Git is required to download and manage custom nodes and other extensions. This task opens the download page in your default browser, where you can download the latest version of git. Once you have installed git, please restart ComfyUI Desktop.", + button: { + icon: PrimeIcons.EXTERNAL_LINK, + text: "Download" + } + }, + { + id: "vcRedist", + execute: /* @__PURE__ */ __name(() => openUrl("https://aka.ms/vs/17/release/vc_redist.x64.exe"), "execute"), + name: "Download VC++ Redist", + shortDescription: "Download the latest VC++ Redistributable runtime.", + description: "The Visual C++ runtime libraries are required to run ComfyUI. You will need to download and install this file.", + button: { + icon: PrimeIcons.EXTERNAL_LINK, + text: "Download" + } + }, + { + id: "reinstall", + severity: "danger", + requireConfirm: true, + execute: /* @__PURE__ */ __name(async () => { + await electron.reinstall(); + return true; + }, "execute"), + name: "Reinstall ComfyUI", + shortDescription: "Deletes the desktop app config and load the welcome screen.", + description: "Delete the desktop app config, restart the app, and load the installation screen.", + confirmText: "Delete all saved config and reinstall?", + button: { + icon: PrimeIcons.EXCLAMATION_TRIANGLE, + text: "Reinstall" + } + }, + { + id: "pythonPackages", + requireConfirm: true, + execute: /* @__PURE__ */ __name(async () => { + try { + await electron.uv.installRequirements(); + return true; + } catch (error) { + return false; + } + }, "execute"), + name: "Install python packages", + shortDescription: "Installs the base python packages required to run ComfyUI.", + errorDescription: "Python packages that are required to run ComfyUI are not installed.", + description: "This will install the python packages required to run ComfyUI. This includes torch, torchvision, and other dependencies.", + usesTerminal: true, + isInstallationFix: true, + button: { + icon: PrimeIcons.DOWNLOAD, + text: "Install" + } + }, + { + id: "uv", + execute: /* @__PURE__ */ __name(() => openUrl("https://docs.astral.sh/uv/getting-started/installation/"), "execute"), + name: "uv executable", + shortDescription: "uv installs and maintains the python environment.", + description: "This will open the download page for Astral's uv tool. uv is used to install python and manage python packages.", + button: { + icon: "pi pi-asterisk", + text: "Download" + } + }, + { + id: "uvCache", + severity: "danger", + requireConfirm: true, + execute: /* @__PURE__ */ __name(async () => await electron.uv.clearCache(), "execute"), + name: "uv cache", + shortDescription: "Remove the Astral uv cache of python packages.", + description: "This will remove the uv cache directory and its contents. All downloaded python packages will need to be downloaded again.", + confirmText: "Delete uv cache of python packages?", + isInstallationFix: true, + button: { + icon: PrimeIcons.TRASH, + text: "Clear cache" + } + }, + { + id: "venvDirectory", + severity: "danger", + requireConfirm: true, + execute: /* @__PURE__ */ __name(async () => await electron.uv.resetVenv(), "execute"), + name: "Reset virtual environment", + shortDescription: "Remove and recreate the .venv directory. This removes all python packages.", + description: "The python environment is where ComfyUI installs python and python packages. It is used to run the ComfyUI server.", + confirmText: "Delete the .venv directory?", + usesTerminal: true, + isInstallationFix: true, + button: { + icon: PrimeIcons.FOLDER, + text: "Recreate" + } + } +]; +class MaintenanceTaskRunner { + static { + __name(this, "MaintenanceTaskRunner"); + } + constructor(task) { + this.task = task; + } + _state; + /** The current state of the task. Setter also controls {@link resolved} as a side-effect. */ + get state() { + return this._state; + } + /** Updates the task state and {@link resolved} status. */ + setState(value2) { + if (this._state === "error" && value2 === "OK") this.resolved = true; + if (value2 === "error") this.resolved &&= false; + this._state = value2; + } + /** `true` if the task has been resolved (was `error`, now `OK`). This is a side-effect of the {@link state} setter. */ + resolved; + /** Whether the task state is currently being refreshed. */ + refreshing; + /** Whether the task is currently running. */ + executing; + /** The error message that occurred when the task failed. */ + error; + update(update) { + const state = update[this.task.id]; + this.refreshing = state === void 0; + if (state) this.setState(state); + } + finaliseUpdate(update) { + this.refreshing = false; + this.setState(update[this.task.id] ?? "skipped"); + } + /** Wraps the execution of a maintenance task, updating state and rethrowing errors. */ + async execute(task) { + try { + this.executing = true; + const success = await task.execute(); + if (!success) return false; + this.error = void 0; + return true; + } catch (error) { + this.error = error?.message; + throw error; + } finally { + this.executing = false; + } + } +} +const useMaintenanceTaskStore = defineStore("maintenanceTask", () => { + const electron2 = electronAPI(); + const isRefreshing = ref(false); + const isRunningTerminalCommand = computed( + () => tasks.value.filter((task) => task.usesTerminal).some((task) => getRunner(task)?.executing) + ); + const isRunningInstallationFix = computed( + () => tasks.value.filter((task) => task.isInstallationFix).some((task) => getRunner(task)?.executing) + ); + const tasks = ref(DESKTOP_MAINTENANCE_TASKS); + const taskStates = ref( + new Map( + DESKTOP_MAINTENANCE_TASKS.map((x) => [x.id, new MaintenanceTaskRunner(x)]) + ) + ); + const anyErrors = computed( + () => tasks.value.some((task) => getRunner(task).state === "error") + ); + const getRunner = /* @__PURE__ */ __name((task) => taskStates.value.get(task.id), "getRunner"); + const processUpdate = /* @__PURE__ */ __name((validationUpdate) => { + const update = validationUpdate; + isRefreshing.value = true; + for (const task of tasks.value) { + getRunner(task).update(update); + } + if (!update.inProgress && isRefreshing.value) { + isRefreshing.value = false; + for (const task of tasks.value) { + getRunner(task).finaliseUpdate(update); + } + } + }, "processUpdate"); + const clearResolved = /* @__PURE__ */ __name(() => { + for (const task of tasks.value) { + getRunner(task).resolved &&= false; + } + }, "clearResolved"); + const refreshDesktopTasks = /* @__PURE__ */ __name(async () => { + isRefreshing.value = true; + console.log("Refreshing desktop tasks"); + await electron2.Validation.validateInstallation(processUpdate); + }, "refreshDesktopTasks"); + const execute = /* @__PURE__ */ __name(async (task) => { + return getRunner(task).execute(task); + }, "execute"); + return { + tasks, + isRefreshing, + isRunningTerminalCommand, + isRunningInstallationFix, + execute, + getRunner, + processUpdate, + clearResolved, + /** True if any tasks are in an error state. */ + anyErrors, + refreshDesktopTasks + }; +}); +function useMinLoadingDurationRef(value2, minDuration = 250) { + const current = ref(value2.value); + const { ready, start } = useTimeout(minDuration, { + controls: true, + immediate: false + }); + watch(value2, (newValue) => { + if (newValue && !current.value) start(); + current.value = newValue; + }); + return computed(() => current.value || !ready.value); +} +__name(useMinLoadingDurationRef, "useMinLoadingDurationRef"); +const _hoisted_1$3 = { + key: 0, + class: "pi pi-exclamation-triangle text-red-500 absolute m-2 top-0 -right-14 opacity-15", + style: { "font-size": "10rem" } +}; +const _hoisted_2$3 = ["src"]; +const _hoisted_3$3 = { class: "flex gap-4 mt-1" }; +const _hoisted_4$3 = { + key: 0, + class: "task-card-ok pi pi-check" +}; +const _sfc_main$4 = /* @__PURE__ */ defineComponent({ + __name: "TaskCard", + props: { + task: {} + }, + emits: ["execute"], + setup(__props) { + const taskStore = useMaintenanceTaskStore(); + const runner = computed(() => taskStore.getRunner(props.task)); + const props = __props; + const description = computed( + () => runner.value.state === "error" ? props.task.errorDescription ?? props.task.shortDescription : props.task.shortDescription + ); + const reactiveLoading = computed(() => runner.value.refreshing); + const reactiveExecuting = computed(() => runner.value.executing); + const isLoading = useMinLoadingDurationRef(reactiveLoading, 250); + const isExecuting = useMinLoadingDurationRef(reactiveExecuting, 250); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("div", { + class: normalizeClass(["task-div max-w-48 min-h-52 grid relative", { "opacity-75": unref(isLoading) }]) + }, [ + createVNode(unref(script$1Y), mergeProps({ + class: ["max-w-48 relative h-full overflow-hidden", { "opacity-65": runner.value.state !== "error" }] + }, (({ onClick: onClick11, ...rest }) => rest)(_ctx.$attrs)), { + header: withCtx(() => [ + runner.value.state === "error" ? (openBlock(), createElementBlock("i", _hoisted_1$3)) : createCommentVNode("", true), + _ctx.task.headerImg ? (openBlock(), createElementBlock("img", { + key: 1, + src: _ctx.task.headerImg, + class: "object-contain w-full h-full opacity-25 pt-4 px-4" + }, null, 8, _hoisted_2$3)) : createCommentVNode("", true) + ]), + title: withCtx(() => [ + createTextVNode(toDisplayString(_ctx.task.name), 1) + ]), + content: withCtx(() => [ + createTextVNode(toDisplayString(description.value), 1) + ]), + footer: withCtx(() => [ + createBaseVNode("div", _hoisted_3$3, [ + createVNode(unref(script$1e), { + icon: _ctx.task.button?.icon, + label: _ctx.task.button?.text, + class: "w-full", + raised: "", + "icon-pos": "right", + onClick: _cache[0] || (_cache[0] = (event2) => _ctx.$emit("execute", event2)), + loading: unref(isExecuting) + }, null, 8, ["icon", "label", "loading"]) + ]) + ]), + _: 1 + }, 16, ["class"]), + !unref(isLoading) && runner.value.state === "OK" ? (openBlock(), createElementBlock("i", _hoisted_4$3)) : createCommentVNode("", true) + ], 2); + }; + } +}); +const TaskCard = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-c3bd7658"]]); +const _sfc_main$3 = /* @__PURE__ */ defineComponent({ + __name: "TaskListStatusIcon", + props: { + state: {}, + loading: {} + }, + setup(__props) { + const tooltip = computed(() => { + if (props.state === "error") { + return t("g.error"); + } else if (props.state === "OK") { + return t("maintenance.OK"); + } else { + return t("maintenance.Skipped"); + } + }); + const cssClasses = computed(() => { + let classes2; + if (props.state === "error") { + classes2 = `${PrimeIcons.EXCLAMATION_TRIANGLE} text-red-500`; + } else if (props.state === "OK") { + classes2 = `${PrimeIcons.CHECK} text-green-500`; + } else { + classes2 = PrimeIcons.MINUS; + } + return `text-3xl pi ${classes2}`; + }); + const props = __props; + return (_ctx, _cache) => { + const _directive_tooltip = resolveDirective("tooltip"); + return !_ctx.state || _ctx.loading ? (openBlock(), createBlock(unref(script$1h), { + key: 0, + class: "h-8 w-8" + })) : withDirectives((openBlock(), createElementBlock("i", { + key: 1, + class: normalizeClass(cssClasses.value) + }, null, 2)), [ + [ + _directive_tooltip, + { value: tooltip.value, showDelay: 250 }, + void 0, + { top: true } + ] + ]); + }; + } +}); +const _hoisted_1$2 = { class: "text-center w-16" }; +const _hoisted_2$2 = { class: "inline-block" }; +const _hoisted_3$2 = { class: "whitespace-pre-line" }; +const _hoisted_4$2 = { class: "text-right px-4" }; +const _sfc_main$2 = /* @__PURE__ */ defineComponent({ + __name: "TaskListItem", + props: { + task: {} + }, + emits: ["execute"], + setup(__props) { + const taskStore = useMaintenanceTaskStore(); + const runner = computed(() => taskStore.getRunner(props.task)); + const props = __props; + const severity = computed( + () => runner.value.state === "error" || runner.value.state === "warning" ? "primary" : "secondary" + ); + const reactiveLoading = computed(() => runner.value.refreshing); + const reactiveExecuting = computed(() => runner.value.executing); + const isLoading = useMinLoadingDurationRef(reactiveLoading, 250); + const isExecuting = useMinLoadingDurationRef(reactiveExecuting, 250); + const infoPopover = ref(); + const toggle6 = /* @__PURE__ */ __name((event2) => { + infoPopover.value.toggle(event2); + }, "toggle"); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("tr", { + class: normalizeClass(["border-neutral-700 border-solid border-y", { + "opacity-50": runner.value.resolved, + "opacity-75": unref(isLoading) && runner.value.resolved + }]) + }, [ + createBaseVNode("td", _hoisted_1$2, [ + createVNode(_sfc_main$3, { + state: runner.value.state, + loading: unref(isLoading) + }, null, 8, ["state", "loading"]) + ]), + createBaseVNode("td", null, [ + createBaseVNode("p", _hoisted_2$2, toDisplayString(_ctx.task.name), 1), + createVNode(unref(script$1e), { + class: "inline-block mx-2", + type: "button", + icon: unref(PrimeIcons).INFO_CIRCLE, + severity: "secondary", + text: true, + onClick: toggle6 + }, null, 8, ["icon"]), + createVNode(unref(script$1Q), { + ref_key: "infoPopover", + ref: infoPopover, + class: "block m-1 max-w-64 min-w-32" + }, { + default: withCtx(() => [ + createBaseVNode("span", _hoisted_3$2, toDisplayString(_ctx.task.description), 1) + ]), + _: 1 + }, 512) + ]), + createBaseVNode("td", _hoisted_4$2, [ + createVNode(unref(script$1e), { + icon: _ctx.task.button?.icon, + label: _ctx.task.button?.text, + severity: severity.value, + "icon-pos": "right", + onClick: _cache[0] || (_cache[0] = (event2) => _ctx.$emit("execute", event2)), + loading: unref(isExecuting) + }, null, 8, ["icon", "label", "severity", "loading"]) + ]) + ], 2); + }; + } +}); +const _hoisted_1$1 = { class: "my-4" }; +const _hoisted_2$1 = { class: "text-neutral-400 w-full text-center" }; +const _hoisted_3$1 = { + key: 0, + class: "w-full border-collapse border-hidden" +}; +const _hoisted_4$1 = { + key: 1, + class: "flex flex-wrap justify-evenly gap-8 pad-y my-4" +}; +const _sfc_main$1 = /* @__PURE__ */ defineComponent({ + __name: "TaskListPanel", + props: { + displayAsList: {}, + filter: {}, + isRefreshing: { type: Boolean } + }, + setup(__props) { + const toast = useToast(); + const confirm = useConfirm(); + const taskStore = useMaintenanceTaskStore(); + const props = __props; + const executeTask = /* @__PURE__ */ __name(async (task) => { + let message; + try { + if (await taskStore.execute(task) === true) return; + message = t("maintenance.error.taskFailed"); + } catch (error) { + message = error?.message; + } + toast.add({ + severity: "error", + summary: t("maintenance.error.toastTitle"), + detail: message ?? t("maintenance.error.defaultDescription"), + life: 1e4 + }); + }, "executeTask"); + const confirmButton = /* @__PURE__ */ __name(async (event2, task) => { + if (!task.requireConfirm) { + await executeTask(task); + return; + } + confirm.require({ + target: event2.currentTarget, + message: task.confirmText ?? t("maintenance.confirmTitle"), + icon: "pi pi-exclamation-circle", + rejectProps: { + label: t("g.cancel"), + severity: "secondary", + outlined: true + }, + acceptProps: { + label: task.button?.text ?? t("g.save"), + severity: task.severity ?? "primary" + }, + // TODO: Not awaited. + accept: /* @__PURE__ */ __name(async () => { + await executeTask(task); + }, "accept") + }); + }, "confirmButton"); + return (_ctx, _cache) => { + return openBlock(), createElementBlock("section", _hoisted_1$1, [ + _ctx.filter.tasks.length === 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ + createVNode(unref(script$1Z)), + createBaseVNode("p", _hoisted_2$1, toDisplayString(_ctx.$t("maintenance.allOk")), 1) + ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [ + _ctx.displayAsList === unref(PrimeIcons).LIST ? (openBlock(), createElementBlock("table", _hoisted_3$1, [ + (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filter.tasks, (task) => { + return openBlock(), createBlock(_sfc_main$2, { + key: task.id, + task, + onExecute: /* @__PURE__ */ __name((event2) => confirmButton(event2, task), "onExecute") + }, null, 8, ["task", "onExecute"]); + }), 128)) + ])) : (openBlock(), createElementBlock("div", _hoisted_4$1, [ + (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filter.tasks, (task) => { + return openBlock(), createBlock(TaskCard, { + key: task.id, + task, + onExecute: /* @__PURE__ */ __name((event2) => confirmButton(event2, task), "onExecute") + }, null, 8, ["task", "onExecute"]); + }), 128)) + ])) + ], 64)), + createVNode(unref(script$1_)) + ]); + }; + } +}); +const _hoisted_1 = { class: "min-w-full min-h-full font-sans w-screen h-screen grid justify-around text-neutral-300 bg-neutral-900 dark-theme pointer-events-auto overflow-y-auto" }; +const _hoisted_2 = { class: "max-w-screen-sm w-screen m-8 relative" }; +const _hoisted_3 = { class: "w-full flex flex-wrap gap-4 items-center" }; +const _hoisted_4 = { class: "grow" }; +const _hoisted_5 = { class: "flex gap-4 items-center" }; +const _hoisted_6 = { class: "max-sm:hidden" }; +const _hoisted_7 = { class: "flex justify-between gap-4 flex-row" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "MaintenanceView", + setup(__props) { + const electron2 = electronAPI(); + const toast = useToast(); + const taskStore = useMaintenanceTaskStore(); + const { clearResolved, processUpdate, refreshDesktopTasks } = taskStore; + const terminalVisible = ref(false); + const reactiveIsRefreshing = computed(() => taskStore.isRefreshing); + const isRefreshing = useMinLoadingDurationRef(reactiveIsRefreshing, 250); + const anyErrors = computed(() => taskStore.anyErrors); + const displayAsList = ref(PrimeIcons.TH_LARGE); + const errorFilter = computed( + () => taskStore.tasks.filter((x) => { + const { state, resolved } = taskStore.getRunner(x); + return state === "error" || resolved; + }) + ); + const filterOptions = ref([ + { icon: PrimeIcons.FILTER_FILL, value: "All", tasks: taskStore.tasks }, + { icon: PrimeIcons.EXCLAMATION_TRIANGLE, value: "Errors", tasks: errorFilter } + ]); + const filter2 = ref(filterOptions.value[1]); + const completeValidation = /* @__PURE__ */ __name(async (alertOnFail = true) => { + const isValid = await electron2.Validation.complete(); + if (alertOnFail && !isValid) { + toast.add({ + severity: "error", + summary: "Error", + detail: "Unable to continue - errors remain", + life: 5e3 + }); + } + }, "completeValidation"); + const terminalCreated = /* @__PURE__ */ __name(({ terminal, useAutoSize }, root35) => { + useAutoSize({ root: root35, autoRows: true, autoCols: true }); + electron2.onLogMessage((message) => { + terminal.write(message); + }); + terminal.options.cursorBlink = false; + terminal.options.cursorStyle = "bar"; + terminal.options.cursorInactiveStyle = "bar"; + terminal.options.disableStdin = true; + }, "terminalCreated"); + const toggleConsoleDrawer = /* @__PURE__ */ __name(() => { + terminalVisible.value = !terminalVisible.value; + }, "toggleConsoleDrawer"); + watch( + () => taskStore.isRunningTerminalCommand, + (value2) => { + terminalVisible.value = value2; + } + ); + watch( + () => taskStore.isRunningInstallationFix, + (value2, oldValue) => { + if (!value2 && oldValue) completeValidation(false); + } + ); + onMounted(async () => { + electron2.Validation.onUpdate(processUpdate); + const update = await electron2.Validation.getStatus(); + processUpdate(update); + }); + onUnmounted(() => electron2.Validation.dispose()); + return (_ctx, _cache) => { + return openBlock(), createBlock(_sfc_main$7, { dark: "" }, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_1, [ + createBaseVNode("div", _hoisted_2, [ + _cache[6] || (_cache[6] = createBaseVNode("h1", { class: "backspan pi-wrench text-4xl font-bold" }, "Maintenance", -1)), + createBaseVNode("div", _hoisted_3, [ + createBaseVNode("span", _hoisted_4, [ + _cache[5] || (_cache[5] = createTextVNode(" Status: ")), + createVNode(_sfc_main$5, { + refreshing: unref(isRefreshing), + error: anyErrors.value + }, null, 8, ["refreshing", "error"]) + ]), + createBaseVNode("div", _hoisted_5, [ + createVNode(unref(script$1$), { + modelValue: displayAsList.value, + "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => displayAsList.value = $event), + options: [unref(PrimeIcons).LIST, unref(PrimeIcons).TH_LARGE], + "allow-empty": false + }, { + option: withCtx((opts) => [ + createBaseVNode("i", { + class: normalizeClass(opts.option) + }, null, 2) + ]), + _: 1 + }, 8, ["modelValue", "options"]), + createVNode(unref(script$1$), { + modelValue: filter2.value, + "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => filter2.value = $event), + options: filterOptions.value, + "allow-empty": false, + optionLabel: "value", + dataKey: "value", + "area-labelledby": "custom", + onChange: unref(clearResolved) + }, { + option: withCtx((opts) => [ + createBaseVNode("i", { + class: normalizeClass(opts.option.icon) + }, null, 2), + createBaseVNode("span", _hoisted_6, toDisplayString(opts.option.value), 1) + ]), + _: 1 + }, 8, ["modelValue", "options", "onChange"]), + createVNode(_sfc_main$6, { + modelValue: unref(isRefreshing), + "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(isRefreshing) ? isRefreshing.value = $event : null), + severity: "secondary", + onRefresh: unref(refreshDesktopTasks) + }, null, 8, ["modelValue", "onRefresh"]) + ]) + ]), + createVNode(_sfc_main$1, { + class: "border-neutral-700 border-solid border-x-0 border-y", + filter: filter2.value, + displayAsList: displayAsList.value, + isRefreshing: unref(isRefreshing) + }, null, 8, ["filter", "displayAsList", "isRefreshing"]), + createBaseVNode("div", _hoisted_7, [ + createVNode(unref(script$1e), { + label: "Console Logs", + icon: "pi pi-desktop", + "icon-pos": "left", + severity: "secondary", + onClick: toggleConsoleDrawer + }), + createVNode(unref(script$1e), { + label: "Continue", + icon: "pi pi-arrow-right", + "icon-pos": "left", + severity: anyErrors.value ? "secondary" : "primary", + onClick: _cache[3] || (_cache[3] = () => completeValidation()), + loading: unref(isRefreshing) + }, null, 8, ["severity", "loading"]) + ]) + ]), + createVNode(unref(script$1c), { + visible: terminalVisible.value, + "onUpdate:visible": _cache[4] || (_cache[4] = ($event) => terminalVisible.value = $event), + header: "Terminal", + position: "bottom", + style: { "height": "max(50vh, 34rem)" } + }, { + default: withCtx(() => [ + createVNode(BaseTerminal, { onCreated: terminalCreated }) + ]), + _: 1 + }, 8, ["visible"]), + createVNode(unref(script$20)) + ]) + ]), + _: 1 + }); + }; + } +}); +const MaintenanceView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-74b78f7d"]]); +export { + MaintenanceView as default +}; +//# sourceMappingURL=MaintenanceView-D3drnrFc.js.map diff --git a/web/assets/ManualConfigurationView-enyqGo0M.js b/web/assets/ManualConfigurationView-CtZMj_n_.js similarity index 85% rename from web/assets/ManualConfigurationView-enyqGo0M.js rename to web/assets/ManualConfigurationView-CtZMj_n_.js index 43131f52c..59a79f8f5 100644 --- a/web/assets/ManualConfigurationView-enyqGo0M.js +++ b/web/assets/ManualConfigurationView-CtZMj_n_.js @@ -1,8 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, a3 as useI18n, ad as ref, t as onMounted, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, j as unref, aK as script, bN as script$1, l as script$2, p as pushScopeId, q as popScopeId, bV as electronAPI, _ as _export_sfc } from "./index-QvfM__ze.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-dc169863"), n = n(), popScopeId(), n), "_withScopeId"); +import { d as defineComponent, K as useI18n, U as ref, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, a4 as script, a$ as script$1, l as script$2, b5 as electronAPI, _ as _export_sfc } from "./index-CmVtQCAR.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.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" }; @@ -72,4 +71,4 @@ const ManualConfigurationView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scop export { ManualConfigurationView as default }; -//# sourceMappingURL=ManualConfigurationView-enyqGo0M.js.map +//# sourceMappingURL=ManualConfigurationView-CtZMj_n_.js.map diff --git a/web/assets/MetricsConsentView-lSfLu4nr.js b/web/assets/MetricsConsentView-Df03LOI_.js similarity index 87% rename from web/assets/MetricsConsentView-lSfLu4nr.js rename to web/assets/MetricsConsentView-Df03LOI_.js index a53fdbb9c..db07875e9 100644 --- a/web/assets/MetricsConsentView-lSfLu4nr.js +++ b/web/assets/MetricsConsentView-Df03LOI_.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; -import { d as defineComponent, bz as useToast, a3 as useI18n, ad as ref, c2 as useRouter, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, aG as createTextVNode, k as createVNode, j as unref, cc as script, l as script$1, bV as electronAPI } from "./index-QvfM__ze.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.js"; +import { d as defineComponent, aR as useToast, K as useI18n, U as ref, be as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, a7 as createTextVNode, k as createVNode, j as unref, bn as script, l as script$1, b5 as electronAPI } from "./index-CmVtQCAR.js"; const _hoisted_1 = { class: "h-full p-8 2xl:p-16 flex flex-col items-center justify-center" }; const _hoisted_2 = { class: "bg-neutral-800 rounded-lg shadow-lg p-6 w-full max-w-[600px] flex flex-col gap-6" }; const _hoisted_3 = { class: "text-3xl font-semibold text-neutral-100" }; @@ -53,7 +53,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ createBaseVNode("p", _hoisted_5, [ createTextVNode(toDisplayString(_ctx.$t("install.moreInfo")) + " ", 1), createBaseVNode("a", _hoisted_6, toDisplayString(_ctx.$t("install.privacyPolicy")), 1), - createTextVNode(". ") + _cache[1] || (_cache[1] = createTextVNode(". ")) ]), createBaseVNode("div", _hoisted_7, [ createVNode(unref(script), { @@ -83,4 +83,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=MetricsConsentView-lSfLu4nr.js.map +//# sourceMappingURL=MetricsConsentView-Df03LOI_.js.map diff --git a/web/assets/NotSupportedView-Vc8_xWgH.js b/web/assets/NotSupportedView-BRtvC5Gx.js similarity index 64% rename from web/assets/NotSupportedView-Vc8_xWgH.js rename to web/assets/NotSupportedView-BRtvC5Gx.js index ebc712a47..20fd1a28e 100644 --- a/web/assets/NotSupportedView-Vc8_xWgH.js +++ b/web/assets/NotSupportedView-BRtvC5Gx.js @@ -1,22 +1,16 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, c2 as useRouter, r as resolveDirective, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, j as unref, l as script, i as withDirectives, p as pushScopeId, q as popScopeId, _ as _export_sfc } from "./index-QvfM__ze.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; +import { d as defineComponent, be as useRouter, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, i as withDirectives, _ as _export_sfc } from "./index-CmVtQCAR.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.js"; const _imports_0 = "" + new URL("images/sad_girl.png", import.meta.url).href; -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-ebb20958"), n = n(), popScopeId(), n), "_withScopeId"); const _hoisted_1 = { class: "sad-container" }; -const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__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 _hoisted_2 = { class: "no-drag sad-text flex items-center" }; +const _hoisted_3 = { class: "flex flex-col gap-8 p-8 min-w-110" }; +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 _sfc_main = /* @__PURE__ */ defineComponent({ __name: "NotSupportedView", setup(__props) { @@ -38,18 +32,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ 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, [ + _cache[0] || (_cache[0] = createBaseVNode("img", { + class: "sad-girl", + src: _imports_0, + alt: "Sad girl illustration" + }, null, -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_9, [ + createBaseVNode("div", _hoisted_8, [ createVNode(unref(script), { label: _ctx.$t("notSupported.learnMore"), icon: "pi pi-github", @@ -85,4 +83,4 @@ const NotSupportedView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", " export { NotSupportedView as default }; -//# sourceMappingURL=NotSupportedView-Vc8_xWgH.js.map +//# sourceMappingURL=NotSupportedView-BRtvC5Gx.js.map diff --git a/web/assets/NotSupportedView-DQerxQzi.css b/web/assets/NotSupportedView-RFx6eCkN.css similarity index 87% rename from web/assets/NotSupportedView-DQerxQzi.css rename to web/assets/NotSupportedView-RFx6eCkN.css index 3b90d2796..594783813 100644 --- a/web/assets/NotSupportedView-DQerxQzi.css +++ b/web/assets/NotSupportedView-RFx6eCkN.css @@ -1,9 +1,11 @@ -.sad-container[data-v-ebb20958] { +.sad-container { +&[data-v-ebb20958] { display: grid; align-items: center; justify-content: space-evenly; grid-template-columns: 25rem 1fr; +} &[data-v-ebb20958] > * { grid-row: 1; } diff --git a/web/assets/ServerConfigPanel-B-w0HFlz.js b/web/assets/ServerConfigPanel-C2nrpEEV.js similarity index 86% rename from web/assets/ServerConfigPanel-B-w0HFlz.js rename to web/assets/ServerConfigPanel-C2nrpEEV.js index d00cf672a..4993d68e5 100644 --- a/web/assets/ServerConfigPanel-B-w0HFlz.js +++ b/web/assets/ServerConfigPanel-C2nrpEEV.js @@ -1,25 +1,23 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { m as createBaseVNode, o as openBlock, f as createElementBlock, a0 as markRaw, d as defineComponent, a as useSettingStore, aS as storeToRefs, a7 as watch, cW as useCopyToClipboard, a3 as useI18n, J as createBlock, P as withCtx, j as unref, c6 as script, Z as toDisplayString, I as renderList, H as Fragment, k as createVNode, l as script$1, L as createCommentVNode, c4 as script$2, cX as FormItem, cw as _sfc_main$1, bV as electronAPI } from "./index-QvfM__ze.js"; -import { u as useServerConfigStore } from "./serverConfigStore-DCme3xlV.js"; +import { o as openBlock, f as createElementBlock, m as createBaseVNode, H as markRaw, d as defineComponent, a as useSettingStore, ae as storeToRefs, O as watch, dy as useCopyToClipboard, K as useI18n, y as createBlock, z as withCtx, j as unref, bj as script, E as toDisplayString, D as renderList, F as Fragment, k as createVNode, l as script$1, B as createCommentVNode, bh as script$2, dz as FormItem, dn as _sfc_main$1, b5 as electronAPI } from "./index-CmVtQCAR.js"; +import { u as useServerConfigStore } from "./serverConfigStore-BUvaGcxp.js"; const _hoisted_1$1 = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; -const _hoisted_2$1 = /* @__PURE__ */ createBaseVNode("path", { - fill: "none", - stroke: "currentColor", - "stroke-linecap": "round", - "stroke-linejoin": "round", - "stroke-width": "2", - d: "m4 17l6-6l-6-6m8 14h8" -}, null, -1); -const _hoisted_3$1 = [ - _hoisted_2$1 -]; function render(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$1, [..._hoisted_3$1]); + return openBlock(), createElementBlock("svg", _hoisted_1$1, _cache[0] || (_cache[0] = [ + createBaseVNode("path", { + fill: "none", + stroke: "currentColor", + "stroke-linecap": "round", + "stroke-linejoin": "round", + "stroke-width": "2", + d: "m4 17l6-6l-6-6m8 14h8" + }, null, -1) + ])); } __name(render, "render"); const __unplugin_components_0 = markRaw({ name: "lucide-terminal", render }); @@ -155,4 +153,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ServerConfigPanel-B-w0HFlz.js.map +//# sourceMappingURL=ServerConfigPanel-C2nrpEEV.js.map diff --git a/web/assets/ServerStartView-48wfE1MS.js b/web/assets/ServerStartView-M5VckhgZ.js similarity index 85% rename from web/assets/ServerStartView-48wfE1MS.js rename to web/assets/ServerStartView-M5VckhgZ.js index 4b74f5ad1..c19fa837e 100644 --- a/web/assets/ServerStartView-48wfE1MS.js +++ b/web/assets/ServerStartView-M5VckhgZ.js @@ -1,8 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, a3 as useI18n, ad as ref, c7 as ProgressStatus, t as onMounted, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, aG as createTextVNode, Z as toDisplayString, j as unref, f as createElementBlock, L as createCommentVNode, k as createVNode, l as script, i as withDirectives, v as vShow, c8 as BaseTerminal, p as pushScopeId, q as popScopeId, bV as electronAPI, _ as _export_sfc } from "./index-QvfM__ze.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-4140d62b"), n = n(), popScopeId(), n), "_withScopeId"); +import { d as defineComponent, K as useI18n, U as ref, bk as ProgressStatus, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, a7 as createTextVNode, E as toDisplayString, j as unref, f as createElementBlock, B as createCommentVNode, k as createVNode, l as script, i as withDirectives, v as vShow, bl as BaseTerminal, b5 as electronAPI, _ as _export_sfc } from "./index-CmVtQCAR.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.js"; const _hoisted_1 = { class: "flex flex-col w-full h-full items-center" }; const _hoisted_2 = { class: "text-2xl font-bold" }; const _hoisted_3 = { key: 0 }; @@ -98,4 +97,4 @@ const ServerStartView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { ServerStartView as default }; -//# sourceMappingURL=ServerStartView-48wfE1MS.js.map +//# sourceMappingURL=ServerStartView-M5VckhgZ.js.map diff --git a/web/assets/UserSelectView-CXmVKOeK.js b/web/assets/UserSelectView-DNnNy-AZ.js similarity index 72% rename from web/assets/UserSelectView-CXmVKOeK.js rename to web/assets/UserSelectView-DNnNy-AZ.js index 88b4d3f3d..88736e455 100644 --- a/web/assets/UserSelectView-CXmVKOeK.js +++ b/web/assets/UserSelectView-DNnNy-AZ.js @@ -1,18 +1,17 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, aX as useUserStore, c2 as useRouter, ad as ref, c as computed, t as onMounted, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, c3 as withKeys, j as unref, ax as script, c4 as script$1, c5 as script$2, c6 as script$3, aG as createTextVNode, L as createCommentVNode, l as script$4 } from "./index-QvfM__ze.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; +import { d as defineComponent, aj as useUserStore, be as useRouter, U as ref, c as computed, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, bf as withKeys, j as unref, bg as script, bh as script$1, bi as script$2, bj as script$3, a7 as createTextVNode, B as createCommentVNode, l as script$4 } from "./index-CmVtQCAR.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.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 _hoisted_2 = { class: "flex w-full flex-col items-center" }; +const _hoisted_3 = { class: "flex w-full flex-col gap-2" }; +const _hoisted_4 = { for: "new-user-input" }; +const _hoisted_5 = { class: "flex w-full flex-col gap-2" }; +const _hoisted_6 = { for: "existing-user-select" }; +const _hoisted_7 = { class: "mt-5" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "UserSelectView", setup(__props) { @@ -47,10 +46,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ 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), + _cache[2] || (_cache[2] = createBaseVNode("h1", { class: "my-2.5 mb-7 font-normal" }, "ComfyUI", -1)), + createBaseVNode("div", _hoisted_2, [ + createBaseVNode("div", _hoisted_3, [ + createBaseVNode("label", _hoisted_4, toDisplayString(_ctx.$t("userSelect.newUser")) + ":", 1), createVNode(unref(script), { id: "new-user-input", modelValue: newUsername.value, @@ -60,8 +59,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }, null, 8, ["modelValue", "placeholder"]) ]), createVNode(unref(script$1)), - createBaseVNode("div", _hoisted_6, [ - createBaseVNode("label", _hoisted_7, toDisplayString(_ctx.$t("userSelect.existingUser")) + ":", 1), + createBaseVNode("div", _hoisted_5, [ + createBaseVNode("label", _hoisted_6, toDisplayString(_ctx.$t("userSelect.existingUser")) + ":", 1), createVNode(unref(script$2), { modelValue: selectedUser.value, "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedUser.value = $event), @@ -82,7 +81,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ _: 1 })) : createCommentVNode("", true) ]), - createBaseVNode("footer", _hoisted_8, [ + createBaseVNode("footer", _hoisted_7, [ createVNode(unref(script$4), { label: _ctx.$t("userSelect.next"), onClick: login @@ -99,4 +98,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=UserSelectView-CXmVKOeK.js.map +//# sourceMappingURL=UserSelectView-DNnNy-AZ.js.map diff --git a/web/assets/WelcomeView-C8whKl15.js b/web/assets/WelcomeView-Nvn1jaCx.js similarity index 73% rename from web/assets/WelcomeView-C8whKl15.js rename to web/assets/WelcomeView-Nvn1jaCx.js index 7625ec43b..75b0d677a 100644 --- a/web/assets/WelcomeView-C8whKl15.js +++ b/web/assets/WelcomeView-Nvn1jaCx.js @@ -1,8 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, c2 as useRouter, o as openBlock, J as createBlock, P as withCtx, m as createBaseVNode, Z as toDisplayString, k as createVNode, j as unref, l as script, p as pushScopeId, q as popScopeId, _ as _export_sfc } from "./index-QvfM__ze.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BhQMaVFP.js"; -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-7dfaf74c"), n = n(), popScopeId(), n), "_withScopeId"); +import { d as defineComponent, be as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, _ as _export_sfc } from "./index-CmVtQCAR.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.js"; 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({ @@ -37,4 +36,4 @@ const WelcomeView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data- export { WelcomeView as default }; -//# sourceMappingURL=WelcomeView-C8whKl15.js.map +//# sourceMappingURL=WelcomeView-Nvn1jaCx.js.map diff --git a/web/assets/index-je62U6DH.js b/web/assets/index-BPn8eYlx.js similarity index 98% rename from web/assets/index-je62U6DH.js rename to web/assets/index-BPn8eYlx.js index 6acbfcc2c..8adb2181b 100644 --- a/web/assets/index-je62U6DH.js +++ b/web/assets/index-BPn8eYlx.js @@ -1,6 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { ci as ComfyDialog, cj as $el, ck as ComfyApp, h as app, a5 as LiteGraph, bl as LGraphCanvas, cl as useExtensionService, cm as processDynamicPrompt, bT as isElectron, bV as electronAPI, bW as useDialogService, cn as t, co as DraggableList, bA as useToastStore, aj as LGraphNode, cp as applyTextReplacements, cq as ComfyWidgets, cr as addValueControlWidgets, a8 as useNodeDefStore, cs as serialise, ct as deserialiseAndCreate, bh as api, a as useSettingStore, ai as LGraphGroup, af as nextTick, bO as lodashExports, bg as setStorageValue, bb as getStorageValue } from "./index-QvfM__ze.js"; +import { da as ComfyDialog, db as $el, dc as ComfyApp, h as app, M as LiteGraph, aF as LGraphCanvas, dd as useExtensionService, de as processDynamicPrompt, b4 as isElectron, b5 as electronAPI, b as useWorkflowStore, bu as checkMirrorReachable, b7 as useDialogService, bc as t, df as DraggableList, aS as useToastStore, $ as LGraphNode, dg as applyTextReplacements, dh as ComfyWidgets, di as addValueControlWidgets, P as useNodeDefStore, dj as serialise, dk as deserialiseAndCreate, aH as api, a as useSettingStore, Z as LGraphGroup, W as nextTick, b0 as lodashExports, aK as setStorageValue, aI as getStorageValue } from "./index-CmVtQCAR.js"; +import { P as PYTHON_MIRROR } from "./uvMirrors-B-HKMf6X.js"; class ClipspaceDialog extends ComfyDialog { static { __name(this, "ClipspaceDialog"); @@ -422,6 +423,7 @@ app.registerExtension({ if (!isElectron()) return; const electronAPI$1 = electronAPI(); const desktopAppVersion = await electronAPI$1.getElectronVersion(); + const workflowStore = useWorkflowStore(); const onChangeRestartApp = /* @__PURE__ */ __name((newValue, oldValue) => { if (oldValue !== void 0 && newValue !== oldValue) { electronAPI$1.restartApp("Restart ComfyUI to apply changes.", 1500); @@ -450,15 +452,49 @@ app.registerExtension({ id: "Comfy-Desktop.WindowStyle", category: ["Comfy-Desktop", "General", "Window Style"], name: "Window Style", - tooltip: "Choose custom option to hide the system title bar", + tooltip: "Custom: Replace the system title bar with ComfyUI's Top menu", type: "combo", experimental: true, defaultValue: "default", options: ["default", "custom"], onChange: /* @__PURE__ */ __name((newValue, oldValue) => { + if (!oldValue) return; electronAPI$1.Config.setWindowStyle(newValue); - onChangeRestartApp(newValue, oldValue); }, "onChange") + }, + { + id: "Comfy-Desktop.UV.PythonInstallMirror", + name: "Python Install Mirror", + tooltip: `Managed Python installations are downloaded from the Astral python-build-standalone project. This variable can be set to a mirror URL to use a different source for Python installations. The provided URL will replace https://github.com/astral-sh/python-build-standalone/releases/download in, e.g., https://github.com/astral-sh/python-build-standalone/releases/download/20240713/cpython-3.12.4%2B20240713-aarch64-apple-darwin-install_only.tar.gz. Distributions can be read from a local directory by using the file:// URL scheme.`, + type: "url", + defaultValue: "", + attrs: { + validateUrlFn(mirror) { + return checkMirrorReachable( + mirror + PYTHON_MIRROR.validationPathSuffix + ); + } + } + }, + { + id: "Comfy-Desktop.UV.PypiInstallMirror", + name: "Pypi Install Mirror", + tooltip: `Default pip install mirror`, + type: "url", + defaultValue: "", + attrs: { + validateUrlFn: checkMirrorReachable + } + }, + { + id: "Comfy-Desktop.UV.TorchInstallMirror", + name: "Torch Install Mirror", + tooltip: `Pip install mirror for pytorch`, + type: "url", + defaultValue: "", + attrs: { + validateUrlFn: checkMirrorReachable + } } ], commands: [ @@ -518,14 +554,6 @@ app.registerExtension({ 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", @@ -554,15 +582,28 @@ app.registerExtension({ function() { electronAPI$1.restartApp(); } + }, + { + id: "Comfy-Desktop.Quit", + label: "Quit", + icon: "pi pi-sign-out", + async function() { + if (workflowStore.modifiedWorkflows.length > 0) { + const confirmed = await useDialogService().confirm({ + message: t("desktopMenu.confirmQuit"), + title: t("desktopMenu.quit"), + type: "default" + }); + if (!confirmed) return; + } + electronAPI$1.quit(); + } } ], menuCommands: [ { path: ["Help"], - commands: [ - "Comfy-Desktop.OpenUserGuide", - "Comfy-Desktop.OpenFeedbackPage" - ] + commands: ["Comfy-Desktop.OpenUserGuide"] }, { path: ["Help"], @@ -584,6 +625,15 @@ app.registerExtension({ commands: ["Comfy-Desktop.Reinstall"] } ], + keybindings: [ + { + commandId: "Workspace.CloseWorkflow", + combo: { + key: "w", + ctrl: true + } + } + ], aboutPageBadges: [ { label: "ComfyUI_desktop v" + desktopAppVersion, @@ -1631,7 +1681,25 @@ app.registerExtension({ }; nodeType.prototype.getExtraMenuOptions = function(_, options) { const r = origGetExtraMenuOptions ? origGetExtraMenuOptions.apply(this, arguments) : void 0; + const getPointerCanvasPos = /* @__PURE__ */ __name(() => { + const pos = this.graph?.list_of_graphcanvas?.at(0)?.graph_mouse; + return pos ? { canvasX: pos[0], canvasY: pos[1] } : void 0; + }, "getPointerCanvasPos"); if (this.widgets) { + const { canvasX, canvasY } = getPointerCanvasPos(); + const widget = this.getWidgetOnPos(canvasX, canvasY); + if (widget && widget.type !== CONVERTED_TYPE) { + const config = getConfig.call(this, widget.name) ?? [ + widget.type, + widget.options || {} + ]; + if (isConvertibleWidget(widget, config)) { + options.push({ + content: `Convert ${widget.name} to input`, + callback: /* @__PURE__ */ __name(() => convertToInput(this, widget, config) && false, "callback") + }); + } + } let toInput = []; let toWidget = []; for (const w of this.widgets) { @@ -2126,14 +2194,22 @@ class GroupNodeConfig { let name = customConfig?.name ?? node.inputs?.find((inp) => inp.name === inputName)?.label ?? inputName; let key = name; let prefix = ""; - if (node.type === "PrimitiveNode" && node.title || name in seenInputs) { + seenInputs[key] = (seenInputs[key] ?? 0) + 1; + if (node.type === "PrimitiveNode" && node.title || seenInputs[name] > 1) { prefix = `${node.title ?? node.type} `; key = name = `${prefix}${inputName}`; - if (name in seenInputs) { - name = `${prefix}${seenInputs[name]} ${inputName}`; + seenInputs[name] = seenInputs[name] ?? 0; + let finalName; + if (seenInputs[name] > 0) { + prefix = `${node.title ?? node.type} `; + finalName = `${prefix} ${seenInputs[name] + 1} ${inputName}`; + } else { + prefix = `${node.title ?? node.type} `; + finalName = `${prefix}${inputName}`; } + seenInputs[name]++; + this.nodeDef.input.required[finalName] = config; } - seenInputs[key] = (seenInputs[key] ?? 1) + 1; if (inputName === "seed" || inputName === "noise_seed") { if (!extra) extra = {}; extra.control_after_generate = `${prefix}control_after_generate`; @@ -2307,23 +2383,20 @@ class GroupNodeConfig { }; this.nodeDef.output.push(def.output[outputId]); this.nodeDef.output_is_list.push(def.output_is_list[outputId]); - let label = customConfig?.name; + let label = customConfig?.name ?? // If no custom name, check if the definition provides an output name + def.output_name?.[outputId] ?? // If neither exist, fallback to the raw output type (e.g., "FLOAT", "INT") + def.output[outputId]; if (!label) { - label = def.output_name?.[outputId] ?? def.output[outputId]; - const output = node.outputs.find((o) => o.name === label); - if (output?.label) { - label = output.label; - } + const output = node.outputs.find((o) => o.name); + label = output?.label ?? "UnnamedOutput"; } let name = label; - if (name in seenOutputs) { - const prefix = `${node.title ?? node.type} `; - name = `${prefix}${label}`; - if (name in seenOutputs) { - name = `${prefix}${node.index} ${label}`; - } + const prefix = `${node.title ?? node.type} `; + name = `${prefix}${label}`; + if (seenOutputs[name]) { + name = `${prefix} ${seenOutputs[name] + 1} ${label}`; } - seenOutputs[name] = 1; + seenOutputs[name] = (seenOutputs[name] ?? 0) + 1; this.nodeDef.output_name.push(name); } } @@ -3248,6 +3321,194 @@ app.registerExtension({ }; } }); +class Load3dUtils { + static { + __name(this, "Load3dUtils"); + } + static async 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(); + } + static async uploadFile(load3d, file2, fileInput) { + let uploadPath; + try { + const body = new FormData(); + body.append("image", file2); + body.append("subfolder", "3d"); + 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; + uploadPath = path; + const modelUrl = api.apiURL( + this.getResourceURL(...this.splitFilePath(path), "input") + ); + await load3d.loadModel(modelUrl, file2.name); + const fileExt = file2.name.split(".").pop()?.toLowerCase(); + if (fileExt === "obj" && fileInput?.files) { + try { + const mtlFile = Array.from(fileInput.files).find( + (f) => f.name.toLowerCase().endsWith(".mtl") + ); + if (mtlFile) { + const mtlFormData = new FormData(); + mtlFormData.append("image", mtlFile); + mtlFormData.append("subfolder", "3d"); + await api.fetchApi("/upload/image", { + method: "POST", + body: mtlFormData + }); + } + } catch (mtlError) { + console.warn("Failed to upload MTL file:", mtlError); + } + } + } else { + useToastStore().addAlert(resp.status + " - " + resp.statusText); + } + } catch (error) { + console.error("Upload error:", error); + useToastStore().addAlert( + error instanceof Error ? error.message : "Upload failed" + ); + } + return uploadPath; + } + static splitFilePath(path) { + const folder_separator = path.lastIndexOf("/"); + if (folder_separator === -1) { + return ["", path]; + } + return [ + path.substring(0, folder_separator), + path.substring(folder_separator + 1) + ]; + } + static getResourceURL(subfolder, filename, type = "input") { + const params = [ + "filename=" + encodeURIComponent(filename), + "type=" + type, + "subfolder=" + subfolder, + app.getRandParam().substring(1) + ].join("&"); + return `/view?${params}`; + } +} +class Load3DConfiguration { + static { + __name(this, "Load3DConfiguration"); + } + constructor(load3d) { + this.load3d = load3d; + } + configure(loadFolder, modelWidget, material, lightIntensity, upDirection, fov2, cameraState, postModelUpdateFunc) { + this.setupModelHandling( + modelWidget, + loadFolder, + cameraState, + postModelUpdateFunc + ); + this.setupMaterial(material); + this.setupLighting(lightIntensity); + this.setupDirection(upDirection); + this.setupCamera(fov2); + this.setupDefaultProperties(); + } + setupModelHandling(modelWidget, loadFolder, cameraState, postModelUpdateFunc) { + const onModelWidgetUpdate = this.createModelUpdateHandler( + loadFolder, + cameraState, + postModelUpdateFunc + ); + if (modelWidget.value) { + onModelWidgetUpdate(modelWidget.value); + } + modelWidget.callback = onModelWidgetUpdate; + } + setupMaterial(material) { + material.callback = (value) => { + this.load3d.setMaterialMode(value); + }; + this.load3d.setMaterialMode( + material.value + ); + } + setupLighting(lightIntensity) { + lightIntensity.callback = (value) => { + this.load3d.setLightIntensity(value); + }; + this.load3d.setLightIntensity(lightIntensity.value); + } + setupDirection(upDirection) { + upDirection.callback = (value) => { + this.load3d.setUpDirection(value); + }; + this.load3d.setUpDirection( + upDirection.value + ); + } + setupCamera(fov2) { + fov2.callback = (value) => { + this.load3d.setFOV(value); + }; + this.load3d.setFOV(fov2.value); + } + setupDefaultProperties() { + const cameraType = this.load3d.loadNodeProperty( + "Camera Type", + "perspective" + ); + this.load3d.toggleCamera(cameraType); + const showGrid = this.load3d.loadNodeProperty("Show Grid", true); + this.load3d.toggleGrid(showGrid); + const bgColor = this.load3d.loadNodeProperty("Background Color", "#282828"); + this.load3d.setBackgroundColor(bgColor); + } + createModelUpdateHandler(loadFolder, cameraState, postModelUpdateFunc) { + let isFirstLoad = true; + return async (value) => { + if (!value) return; + const filename = value; + const modelUrl = api.apiURL( + Load3dUtils.getResourceURL( + ...Load3dUtils.splitFilePath(filename), + loadFolder + ) + ); + await this.load3d.loadModel(modelUrl, filename); + if (postModelUpdateFunc) { + postModelUpdateFunc(this.load3d); + } + if (isFirstLoad && cameraState && typeof cameraState === "object") { + try { + this.load3d.setCameraState(cameraState); + } catch (error) { + console.warn("Failed to restore camera state:", error); + } + isFirstLoad = false; + } + }; + } +} /** * @license * Copyright 2010-2024 Three.js Authors @@ -45950,76 +46211,6 @@ class STLLoader extends Loader { return isBinary(binData) ? parseBinary(binData) : parseASCII(ensureString(data)); } } -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(); - body.append("image", file2); - body.append("subfolder", "3d"); - 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; - uploadPath = path; - const modelUrl = api.apiURL( - getResourceURL$1(...splitFilePath$1(path), "input") - ); - await load3d.loadModel(modelUrl, file2.name); - const fileExt = file2.name.split(".").pop()?.toLowerCase(); - if (fileExt === "obj" && fileInput?.files) { - try { - const mtlFile = Array.from(fileInput.files).find( - (f) => f.name.toLowerCase().endsWith(".mtl") - ); - if (mtlFile) { - const mtlFormData = new FormData(); - mtlFormData.append("image", mtlFile); - mtlFormData.append("subfolder", "3d"); - await api.fetchApi("/upload/image", { - method: "POST", - body: mtlFormData - }); - } - } catch (mtlError) { - console.warn("Failed to upload MTL file:", mtlError); - } - } - } else { - useToastStore().addAlert(resp.status + " - " + resp.statusText); - } - } catch (error) { - console.error("Upload error:", error); - useToastStore().addAlert( - error instanceof Error ? error.message : "Upload failed" - ); - } - return uploadPath; -} -__name(uploadFile$1, "uploadFile$1"); class Load3d { static { __name(this, "Load3d"); @@ -46049,10 +46240,12 @@ class Load3d { materialMode = "original"; currentUpDirection = "original"; originalRotation = null; - viewHelper; - viewHelperContainer; - cameraSwitcherContainer; - gridSwitcherContainer; + viewHelper = {}; + viewHelperContainer = {}; + cameraSwitcherContainer = {}; + gridSwitcherContainer = {}; + node = {}; + bgColorInput = {}; constructor(container) { this.scene = new Scene(); this.perspectiveCamera = new PerspectiveCamera(75, 1, 0.1, 1e3); @@ -46081,6 +46274,9 @@ class Load3d { this.renderer.domElement ); this.controls.enableDamping = true; + this.controls.addEventListener("end", () => { + this.storeNodeProperty("Camera Info", this.getCameraState()); + }); this.gltfLoader = new GLTFLoader(); this.objLoader = new OBJLoader(); this.mtlLoader = new MTLLoader(); @@ -46112,9 +46308,24 @@ class Load3d { this.createViewHelper(container); this.createGridSwitcher(container); this.createCameraSwitcher(container); + this.createColorPicker(container); this.handleResize(); this.startAnimation(); } + setNode(node) { + this.node = node; + } + storeNodeProperty(name, value) { + if (this.node) { + this.node.properties[name] = value; + } + } + loadNodeProperty(name, defaultValue) { + if (!this.node || !this.node.properties || !(name in this.node.properties)) { + return defaultValue; + } + return this.node.properties[name]; + } createViewHelper(container) { this.viewHelperContainer = document.createElement("div"); this.viewHelperContainer.style.position = "absolute"; @@ -46216,6 +46427,42 @@ class Load3d { this.cameraSwitcherContainer.appendChild(cameraIcon); container.appendChild(this.cameraSwitcherContainer); } + createColorPicker(container) { + const colorPickerContainer = document.createElement("div"); + colorPickerContainer.style.position = "absolute"; + colorPickerContainer.style.top = "53px"; + colorPickerContainer.style.left = "3px"; + colorPickerContainer.style.width = "20px"; + colorPickerContainer.style.height = "20px"; + colorPickerContainer.style.cursor = "pointer"; + colorPickerContainer.style.alignItems = "center"; + colorPickerContainer.style.justifyContent = "center"; + colorPickerContainer.title = "Background Color"; + const colorInput = document.createElement("input"); + colorInput.type = "color"; + colorInput.style.opacity = "0"; + colorInput.style.position = "absolute"; + colorInput.style.width = "100%"; + colorInput.style.height = "100%"; + colorInput.style.cursor = "pointer"; + const colorIcon = document.createElement("div"); + colorIcon.innerHTML = ` + + + + + + `; + colorInput.addEventListener("input", (event) => { + const color = event.target.value; + this.setBackgroundColor(color); + this.storeNodeProperty("Background Color", color); + }); + this.bgColorInput = colorInput; + colorPickerContainer.appendChild(colorInput); + colorPickerContainer.appendChild(colorIcon); + container.appendChild(colorPickerContainer); + } setFOV(fov2) { if (this.activeCamera === this.perspectiveCamera) { this.perspectiveCamera.fov = fov2; @@ -46234,7 +46481,6 @@ class Load3d { } setCameraState(state) { if (this.activeCamera !== (state.cameraType === "perspective" ? this.perspectiveCamera : this.orthographicCamera)) { - this.toggleCamera(state.cameraType); } this.activeCamera.position.copy(state.position); this.controls.target.copy(state.target); @@ -46414,6 +46660,7 @@ class Load3d { this.viewHelperContainer ); this.viewHelper.center = this.controls.target; + this.storeNodeProperty("Camera Type", this.getCurrentCameraType()); this.handleResize(); } getCurrentCameraType() { @@ -46422,6 +46669,7 @@ class Load3d { toggleGrid(showGrid) { if (this.gridHelper) { this.gridHelper.visible = showGrid; + this.storeNodeProperty("Show Grid", showGrid); } } setLightIntensity(intensity) { @@ -46447,6 +46695,9 @@ class Load3d { const delta = this.clock.getDelta(); if (this.viewHelper.animating) { this.viewHelper.update(delta); + if (!this.viewHelper.animating) { + this.storeNodeProperty("Camera Info", this.getCameraState()); + } } this.renderer.clear(); this.controls.update(); @@ -46724,6 +46975,9 @@ class Load3d { setBackgroundColor(color) { this.renderer.setClearColor(new Color(color)); this.renderer.render(this.scene, this.activeCamera); + if (this.bgColorInput) { + this.bgColorInput.value = color; + } } } class Load3dAnimation extends Load3d { @@ -46736,8 +46990,143 @@ class Load3dAnimation extends Load3d { selectedAnimationIndex = 0; isAnimationPlaying = false; animationSpeed = 1; + playPauseContainer = {}; + animationSelect = {}; + speedSelect = {}; constructor(container) { super(container); + this.createPlayPauseButton(container); + this.createAnimationList(container); + this.createSpeedSelect(container); + } + createAnimationList(container) { + this.animationSelect = document.createElement("select"); + Object.assign(this.animationSelect.style, { + position: "absolute", + top: "3px", + left: "50%", + transform: "translateX(15px)", + width: "90px", + height: "20px", + backgroundColor: "rgba(0, 0, 0, 0.3)", + color: "white", + border: "none", + borderRadius: "4px", + fontSize: "12px", + padding: "0 8px", + cursor: "pointer", + display: "none", + outline: "none" + }); + this.animationSelect.addEventListener("mouseenter", () => { + this.animationSelect.style.backgroundColor = "rgba(0, 0, 0, 0.5)"; + }); + this.animationSelect.addEventListener("mouseleave", () => { + this.animationSelect.style.backgroundColor = "rgba(0, 0, 0, 0.3)"; + }); + this.animationSelect.addEventListener("change", (event) => { + const select = event.target; + this.updateSelectedAnimation(select.selectedIndex); + }); + container.appendChild(this.animationSelect); + } + updateAnimationList() { + this.animationSelect.innerHTML = ""; + this.animationClips.forEach((clip, index) => { + const option = document.createElement("option"); + option.value = index.toString(); + option.text = clip.name || `Animation ${index + 1}`; + option.selected = index === this.selectedAnimationIndex; + this.animationSelect.appendChild(option); + }); + } + createPlayPauseButton(container) { + this.playPauseContainer = document.createElement("div"); + this.playPauseContainer.style.position = "absolute"; + this.playPauseContainer.style.top = "3px"; + this.playPauseContainer.style.left = "50%"; + this.playPauseContainer.style.transform = "translateX(-50%)"; + this.playPauseContainer.style.width = "20px"; + this.playPauseContainer.style.height = "20px"; + this.playPauseContainer.style.cursor = "pointer"; + this.playPauseContainer.style.alignItems = "center"; + this.playPauseContainer.style.justifyContent = "center"; + const updateButtonState = /* @__PURE__ */ __name(() => { + const icon = this.playPauseContainer.querySelector("svg"); + if (icon) { + if (this.isAnimationPlaying) { + icon.innerHTML = ` + + `; + this.playPauseContainer.title = "Pause Animation"; + } else { + icon.innerHTML = ` + + `; + this.playPauseContainer.title = "Play Animation"; + } + } + }, "updateButtonState"); + const playIcon = document.createElement("div"); + playIcon.innerHTML = ` + + + + `; + this.playPauseContainer.addEventListener("mouseenter", () => { + this.playPauseContainer.style.backgroundColor = "rgba(0, 0, 0, 0.5)"; + }); + this.playPauseContainer.addEventListener("mouseleave", () => { + this.playPauseContainer.style.backgroundColor = "transparent"; + }); + this.playPauseContainer.addEventListener("click", (event) => { + event.stopPropagation(); + this.toggleAnimation(); + updateButtonState(); + }); + this.playPauseContainer.appendChild(playIcon); + container.appendChild(this.playPauseContainer); + this.playPauseContainer.style.display = "none"; + } + createSpeedSelect(container) { + this.speedSelect = document.createElement("select"); + Object.assign(this.speedSelect.style, { + position: "absolute", + top: "3px", + left: "50%", + transform: "translateX(-75px)", + width: "60px", + height: "20px", + backgroundColor: "rgba(0, 0, 0, 0.3)", + color: "white", + border: "none", + borderRadius: "4px", + fontSize: "12px", + padding: "0 8px", + cursor: "pointer", + display: "none", + outline: "none" + }); + const speeds = [0.1, 0.5, 1, 1.5, 2]; + speeds.forEach((speed) => { + const option = document.createElement("option"); + option.value = speed.toString(); + option.text = `${speed}x`; + option.selected = speed === 1; + this.speedSelect.appendChild(option); + }); + this.speedSelect.addEventListener("mouseenter", () => { + this.speedSelect.style.backgroundColor = "rgba(0, 0, 0, 0.5)"; + }); + this.speedSelect.addEventListener("mouseleave", () => { + this.speedSelect.style.backgroundColor = "rgba(0, 0, 0, 0.3)"; + }); + this.speedSelect.addEventListener("change", (event) => { + const select = event.target; + const newSpeed = parseFloat(select.value); + this.setAnimationSpeed(newSpeed); + }); + container.appendChild(this.speedSelect); } async setupModel(model) { await super.setupModel(model); @@ -46762,6 +47151,21 @@ class Load3dAnimation extends Load3d { this.updateSelectedAnimation(0); } } + if (this.animationClips.length > 0) { + this.playPauseContainer.style.display = "block"; + } else { + this.playPauseContainer.style.display = "none"; + } + if (this.animationClips.length > 0) { + this.playPauseContainer.style.display = "block"; + this.animationSelect.style.display = "block"; + this.speedSelect.style.display = "block"; + this.updateAnimationList(); + } else { + this.playPauseContainer.style.display = "none"; + this.animationSelect.style.display = "none"; + this.speedSelect.style.display = "none"; + } } setAnimationSpeed(speed) { this.animationSpeed = speed; @@ -46793,6 +47197,7 @@ class Load3dAnimation extends Load3d { action.paused = true; } this.animationActions = [action]; + this.updateAnimationList(); } clearModel() { if (this.currentAnimation) { @@ -46807,6 +47212,14 @@ class Load3dAnimation extends Load3d { this.isAnimationPlaying = false; this.animationSpeed = 1; super.clearModel(); + if (this.animationSelect) { + this.animationSelect.style.display = "none"; + this.animationSelect.innerHTML = ""; + } + if (this.speedSelect) { + this.speedSelect.style.display = "none"; + this.speedSelect.value = "1"; + } } getAnimationNames() { return this.animationClips.map((clip, index) => { @@ -46819,6 +47232,16 @@ class Load3dAnimation extends Load3d { return; } this.isAnimationPlaying = play ?? !this.isAnimationPlaying; + const icon = this.playPauseContainer.querySelector("svg"); + if (icon) { + if (this.isAnimationPlaying) { + icon.innerHTML = ''; + this.playPauseContainer.title = "Pause Animation"; + } else { + icon.innerHTML = ''; + this.playPauseContainer.title = "Play Animation"; + } + } this.animationActions.forEach((action) => { if (this.isAnimationPlaying) { action.paused = false; @@ -46842,101 +47265,16 @@ class Load3dAnimation extends Load3d { this.renderer.render(this.scene, this.activeCamera); if (this.viewHelper.animating) { this.viewHelper.update(delta); + if (!this.viewHelper.animating) { + this.storeNodeProperty("Camera Info", this.getCameraState()); + } } this.viewHelper.render(this.renderer); }, "animate"); animate(); } } -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"); -const load3dCSSCLASS = `display: flex; - flex-direction: column; - background: transparent; - flex: 1; - position: relative; - overflow: hidden;`; -const load3dCanvasCSSCLASS = `display: flex; - width: 100% !important; - height: 100% !important;`; const containerToLoad3D = /* @__PURE__ */ new Map(); -function configureLoad3D(load3d, loadFolder, modelWidget, 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$1(...splitFilePath$1(filename), loadFolder) - ); - await load3d.loadModel(modelUrl, filename); - load3d.setMaterialMode( - material.value - ); - load3d.setUpDirection( - upDirection.value - ); - if (postModelUpdateFunc) { - postModelUpdateFunc(load3d); - } - if (isFirstLoad && cameraState && typeof cameraState === "object") { - try { - load3d.setCameraState(cameraState); - } catch (error) { - console.warn("Failed to restore camera state:", error); - } - isFirstLoad = false; - } - }; - }, "createModelUpdateHandler"); - const onModelWidgetUpdate = createModelUpdateHandler(); - if (modelWidget.value) { - onModelWidgetUpdate(modelWidget.value); - } - modelWidget.callback = onModelWidgetUpdate; - material.callback = (value) => { - load3d.setMaterialMode(value); - }; - load3d.setMaterialMode(material.value); - load3d.setBackgroundColor(bgColor.value); - bgColor.callback = (value) => { - load3d.setBackgroundColor(value); - }; - load3d.setLightIntensity(lightIntensity.value); - lightIntensity.callback = (value) => { - load3d.setLightIntensity(value); - }; - upDirection.callback = (value) => { - load3d.setUpDirection(value); - }; - load3d.setUpDirection( - upDirection.value - ); - fov2.callback = (value) => { - load3d.setFOV(value); - }; - load3d.setFOV(fov2.value); -} -__name(configureLoad3D, "configureLoad3D"); app.registerExtension({ name: "Comfy.Load3D", getCustomWidgets(app2) { @@ -46974,7 +47312,7 @@ app.registerExtension({ const modelWidget = node.widgets?.find( (w) => w.name === "model_file" ); - const uploadPath = await uploadFile$1( + const uploadPath = await Load3dUtils.uploadFile( load3d, fileInput.files[0], fileInput @@ -47008,19 +47346,6 @@ app.registerExtension({ } }; }, - init() { - const style = document.createElement("style"); - style.innerText = ` - .comfy-load-3d { - ${load3dCSSCLASS} - } - - .comfy-load-3d canvas { - ${load3dCanvasCSSCLASS} - } - `; - document.head.appendChild(style); - }, async nodeCreated(node) { if (node.constructor.comfyClass !== "Load3D") return; const [oldWidth, oldHeight] = node.size; @@ -47029,11 +47354,11 @@ app.registerExtension({ const sceneWidget = node.widgets.find((w2) => w2.name === "image"); const container = sceneWidget.element; const load3d = containerToLoad3D.get(container.id); + load3d.setNode(node); const modelWidget = node.widgets.find( (w2) => w2.name === "model_file" ); const material = node.widgets.find((w2) => w2.name === "material"); - const bgColor = node.widgets.find((w2) => w2.name === "bg_color"); const lightIntensity = node.widgets.find( (w2) => w2.name === "light_intensity" ); @@ -47041,22 +47366,12 @@ app.registerExtension({ (w2) => w2.name === "up_direction" ); const fov2 = node.widgets.find((w2) => w2.name === "fov"); - let cameraState; - try { - const cameraInfo = node.properties["Camera Info"]; - if (cameraInfo && typeof cameraInfo === "string" && cameraInfo.trim() !== "") { - cameraState = JSON.parse(cameraInfo); - } - } catch (error) { - console.warn("Failed to parse camera state:", error); - cameraState = void 0; - } - configureLoad3D( - load3d, + let cameraState = node.properties["Camera Info"]; + const config = new Load3DConfiguration(load3d); + config.configure( "input", modelWidget, material, - bgColor, lightIntensity, upDirection, fov2, @@ -47065,14 +47380,14 @@ app.registerExtension({ 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()); + node.properties["Camera Info"] = load3d.getCameraState(); 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") + Load3dUtils.uploadTempImage(imageData, "scene"), + Load3dUtils.uploadTempImage(maskData, "scene_mask") ]); return { image: `threed/${data.name} [temp]`, @@ -47120,7 +47435,7 @@ app.registerExtension({ const modelWidget = node.widgets?.find( (w) => w.name === "model_file" ); - const uploadPath = await uploadFile$1( + const uploadPath = await Load3dUtils.uploadFile( load3d, fileInput.files[0], fileInput @@ -47147,70 +47462,13 @@ app.registerExtension({ if (modelWidget) { modelWidget.value = ""; } - const animationSelect2 = node.widgets?.find( - (w) => w.name === "animation" - ); - if (animationSelect2) { - animationSelect2.options.values = []; - animationSelect2.value = ""; - } - const speedSelect = node.widgets?.find( - (w) => w.name === "animation_speed" - ); - if (speedSelect) { - speedSelect.value = "1"; - } }); - node.addWidget( - "button", - "Play/Pause Animation", - "toggle_animation", - () => { - load3d.toggleAnimation(); - } - ); - const animationSelect = node.addWidget( - "combo", - "animation", - "", - () => "", - { - values: [] - } - ); - animationSelect.callback = (value) => { - const names = load3d.getAnimationNames(); - const index = names.indexOf(value); - if (index !== -1) { - const wasPlaying = load3d.isAnimationPlaying; - if (wasPlaying) { - load3d.toggleAnimation(false); - } - load3d.updateSelectedAnimation(index); - if (wasPlaying) { - load3d.toggleAnimation(true); - } - } - }; return { widget: node.addDOMWidget(inputName, "LOAD_3D_ANIMATION", container) }; } }; }, - init() { - const style = document.createElement("style"); - style.innerText = ` - .comfy-load-3d-animation { - ${load3dCSSCLASS} - } - - .comfy-load-3d-animation canvas { - ${load3dCanvasCSSCLASS} - } - `; - document.head.appendChild(style); - }, async nodeCreated(node) { if (node.constructor.comfyClass !== "Load3DAnimation") return; const [oldWidth, oldHeight] = node.size; @@ -47219,71 +47477,41 @@ app.registerExtension({ const sceneWidget = node.widgets.find((w2) => w2.name === "image"); const container = sceneWidget.element; const load3d = containerToLoad3D.get(container.id); + load3d.setNode(node); const modelWidget = node.widgets.find( (w2) => w2.name === "model_file" ); const material = node.widgets.find((w2) => w2.name === "material"); - const bgColor = node.widgets.find((w2) => w2.name === "bg_color"); const lightIntensity = node.widgets.find( (w2) => w2.name === "light_intensity" ); const upDirection = node.widgets.find( (w2) => w2.name === "up_direction" ); - const speedSelect = node.widgets.find( - (w2) => w2.name === "animation_speed" - ); - speedSelect.callback = (value) => { - const load3d2 = containerToLoad3D.get(container.id); - if (load3d2) { - load3d2.setAnimationSpeed(parseFloat(value)); - } - }; const fov2 = node.widgets.find((w2) => w2.name === "fov"); - let cameraState; - try { - const cameraInfo = node.properties["Camera Info"]; - if (cameraInfo && typeof cameraInfo === "string" && cameraInfo.trim() !== "") { - cameraState = JSON.parse(cameraInfo); - } - } catch (error) { - console.warn("Failed to parse camera state:", error); - cameraState = void 0; - } - configureLoad3D( - load3d, + let cameraState = node.properties["Camera Info"]; + const config = new Load3DConfiguration(load3d); + config.configure( "input", modelWidget, material, - bgColor, lightIntensity, upDirection, fov2, - cameraState, - (load3d2) => { - const animationLoad3d = load3d2; - const names = animationLoad3d.getAnimationNames(); - const animationSelect = node.widgets.find( - (w2) => w2.name === "animation" - ); - animationSelect.options.values = names; - if (names.length) { - animationSelect.value = names[0]; - } - } + 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()); + node.properties["Camera Info"] = load3d.getCameraState(); load3d.toggleAnimation(false); 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") + Load3dUtils.uploadTempImage(imageData, "scene"), + Load3dUtils.uploadTempImage(maskData, "scene_mask") ]); return { image: `threed/${data.name} [temp]`, @@ -47333,19 +47561,6 @@ app.registerExtension({ } }; }, - init() { - const style = document.createElement("style"); - style.innerText = ` - .comfy-preview-3d { - ${load3dCSSCLASS} - } - - .comfy-preview-3d canvas { - ${load3dCanvasCSSCLASS} - } - `; - document.head.appendChild(style); - }, async nodeCreated(node) { if (node.constructor.comfyClass !== "Preview3D") return; const [oldWidth, oldHeight] = node.size; @@ -47354,11 +47569,11 @@ app.registerExtension({ const sceneWidget = node.widgets.find((w) => w.name === "image"); const container = sceneWidget.element; const load3d = containerToLoad3D.get(container.id); + load3d.setNode(node); const modelWidget = node.widgets.find( (w) => w.name === "model_file" ); const material = node.widgets.find((w) => w.name === "material"); - const bgColor = node.widgets.find((w) => w.name === "bg_color"); const lightIntensity = node.widgets.find( (w) => w.name === "light_intensity" ); @@ -47376,12 +47591,100 @@ app.registerExtension({ useToastStore().addAlert(msg); } modelWidget.value = filePath.replaceAll("\\", "/"); - configureLoad3D( - load3d, + const config = new Load3DConfiguration(load3d); + config.configure( + "output", + modelWidget, + material, + lightIntensity, + upDirection, + fov2 + ); + }; + } +}); +app.registerExtension({ + name: "Comfy.Preview3DAnimation", + async beforeRegisterNodeDef(nodeType, nodeData) { + if ( + // @ts-expect-error ComfyNode + ["Preview3DAnimation"].includes(nodeType.comfyClass) + ) { + nodeData.input.required.image = ["PREVIEW_3D_ANIMATION"]; + } + }, + getCustomWidgets(app2) { + return { + PREVIEW_3D_ANIMATION(node, inputName) { + let load3dNode = app2.graph._nodes.filter( + (wi) => wi.type == "Preview3DAnimation" + ); + const container = document.createElement("div"); + container.id = `comfy-preview-3d-animation-${load3dNode.length}`; + container.classList.add("comfy-preview-3d-animation"); + const load3d = new Load3dAnimation(container); + containerToLoad3D.set(container.id, load3d); + node.onResize = function() { + if (load3d) { + load3d.handleResize(); + } + }; + const origOnRemoved = node.onRemoved; + node.onRemoved = function() { + if (load3d) { + load3d.remove(); + } + containerToLoad3D.delete(container.id); + origOnRemoved?.apply(this, []); + }; + node.onDrawBackground = function() { + load3d.renderer.domElement.hidden = this.flags.collapsed ?? false; + }; + return { + widget: node.addDOMWidget( + inputName, + "PREVIEW_3D_ANIMATION", + container + ) + }; + } + }; + }, + async nodeCreated(node) { + if (node.constructor.comfyClass !== "Preview3DAnimation") return; + const [oldWidth, oldHeight] = node.size; + node.setSize([Math.max(oldWidth, 300), Math.max(oldHeight, 550)]); + await nextTick(); + const sceneWidget = node.widgets.find((w) => w.name === "image"); + const container = sceneWidget.element; + const load3d = containerToLoad3D.get(container.id); + load3d.setNode(node); + const modelWidget = node.widgets.find( + (w) => w.name === "model_file" + ); + const material = node.widgets.find((w) => w.name === "material"); + const lightIntensity = node.widgets.find( + (w) => w.name === "light_intensity" + ); + const upDirection = node.widgets.find( + (w) => w.name === "up_direction" + ); + 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("\\", "/"); + const config = new Load3DConfiguration(load3d); + config.configure( "output", modelWidget, material, - bgColor, lightIntensity, upDirection, fov2 @@ -53546,4 +53849,4 @@ app.registerExtension({ }); } }); -//# sourceMappingURL=index-je62U6DH.js.map +//# sourceMappingURL=index-BPn8eYlx.js.map diff --git a/web/assets/GraphView-CDDCHVO0.js b/web/assets/index-BWow9lpT.js similarity index 51% rename from web/assets/GraphView-CDDCHVO0.js rename to web/assets/index-BWow9lpT.js index 34b0cd731..25679fc8e 100644 --- a/web/assets/GraphView-CDDCHVO0.js +++ b/web/assets/index-BWow9lpT.js @@ -1,122 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -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 createVNode, s as showNativeMenu, l as script$d, m as createBaseVNode, n as normalizeStyle, p as pushScopeId, q as popScopeId, _ as _export_sfc, t as onMounted, x as onBeforeUnmount, B as BaseStyle, y as script$e, z as getWidth, A as getHeight, C as getOuterWidth, D as getOuterHeight, E as getVNodeProp, F as isArray, G as mergeProps, H as Fragment, I as renderList, J as createBlock, K as resolveDynamicComponent, L as createCommentVNode, M as renderSlot, N as useSidebarTabStore, O as useBottomPanelStore, P as withCtx, Q as getAttribute, R as findSingle, S as focus, T as equals, U as Ripple, V as normalizeClass, W as getOffset, X as script$f, Y as script$g, Z as toDisplayString, $ as script$h, a0 as markRaw, a1 as defineStore, a2 as shallowRef, a3 as useI18n, a4 as useCommandStore, a5 as LiteGraph, a6 as useColorPaletteStore, a7 as watch, a8 as useNodeDefStore, a9 as BadgePosition, aa as LGraphBadge, ab as _, ac as NodeBadgeMode, ad as ref, ae as useEventListener, af as nextTick, ag as st, ah as normalizeI18nKey, ai as LGraphGroup, aj as LGraphNode, ak as EditableText, al as isNotEmpty, am as UniqueComponentId, an as ZIndex, ao as resolveFieldData, ap as OverlayEventBus, aq as isEmpty, ar as addStyle, as as relativePosition, at as absolutePosition, au as ConnectedOverlayScrollHandler, av as isTouchDevice, aw as findLastIndex, ax as script$i, ay as script$j, az as script$k, aA as script$l, aB as script$m, aC as script$n, aD as resolveComponent, aE as Transition, aF as createSlots, aG as createTextVNode, aH as useNodeFrequencyStore, aI as useNodeBookmarkStore, aJ as highlightQuery, aK as script$o, aL as formatNumberWithSuffix, aM as NodeSourceType, 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 usePragmaticDraggable, b2 as usePragmaticDroppable, b3 as withModifiers, b4 as useWorkflowService, b5 as useWorkflowBookmarkStore, b6 as script$r, b7 as script$s, b8 as script$t, b9 as LinkMarkerShape, ba as useModelToNodeStore, bb as getStorageValue, bc as CanvasPointer, bd as IS_CONTROL_WIDGET, be as updateControlWidgetLabel, bf as useColorPaletteService, bg as setStorageValue, bh as api, bi as LGraph, bj as LLink, bk as DragAndScale, bl as LGraphCanvas, bm as ContextMenu, bn as ChangeTracker, bo as ComfyNodeDefImpl, bp as ComfyModelDef, bq as script$u, br as script$v, bs as script$w, bt as script$x, bu as script$y, bv as normalizeProps, bw as ToastEventBus, bx as setAttribute, by as TransitionGroup, bz as useToast, bA as useToastStore, bB as resolve, bC as nestedPosition, bD as script$z, bE as isPrintableCharacter, bF as useQueueSettingsStore, bG as script$A, bH as useQueuePendingTaskCountStore, bI as useLocalStorage, bJ as useDraggable, bK as watchDebounced, bL as inject, bM as useElementBounding, bN as script$B, bO as lodashExports, bP as useEventBus, bQ as script$C, bR as guardReactiveProps, bS as useMenuItemStore, bT as isElectron, bU as provide, bV as electronAPI, bW as useDialogService, bX as LGraphEventMode, bY as useQueueStore, bZ as DEFAULT_DARK_COLOR_PALETTE, b_ as DEFAULT_LIGHT_COLOR_PALETTE, b$ as i18n, c0 as useErrorHandling, c1 as useModelStore } from "./index-QvfM__ze.js"; -import { s as script$D } from "./index-Q1cQr26V.js"; -import { u as useKeybindingService } from "./keybindingService-Cak1En5n.js"; -import { u as useServerConfigStore } from "./serverConfigStore-DCme3xlV.js"; -const DEFAULT_TITLE = "ComfyUI"; -const TITLE_SUFFIX = " - ComfyUI"; -const _sfc_main$u = /* @__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$9 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-7ed57d1a"), n = n(), popScopeId(), n), "_withScopeId$9"); -const _hoisted_1$q = { class: "window-actions-spacer" }; -const _sfc_main$t = /* @__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(), createElementBlock("div", { - class: "comfy-menu-hamburger no-drag", - style: normalizeStyle(positionCSS.value) - }, [ - withDirectives(createVNode(unref(script$d), { - icon: "pi pi-bars", - severity: "secondary", - text: "", - size: "large", - "aria-label": _ctx.$t("menu.showMenu"), - "aria-live": "assertive", - onClick: exitFocusMode, - onContextmenu: unref(showNativeMenu) - }, null, 8, ["aria-label", "onContextmenu"]), [ - [_directive_tooltip, { value: _ctx.$t("menu.showMenu"), showDelay: 300 }] - ]), - withDirectives(createBaseVNode("div", _hoisted_1$q, null, 512), [ - [vShow, menuSetting.value !== "Bottom"] - ]) - ], 4)), [ - [vShow, unref(workspaceState).focusMode] - ]); - }; - } -}); -const MenuHamburger = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-7ed57d1a"]]); -const _sfc_main$s = /* @__PURE__ */ defineComponent({ - __name: "UnloadWindowConfirmDialog", - setup(__props) { - const settingStore = useSettingStore(); - const workflowStore = useWorkflowStore(); - const handleBeforeUnload = /* @__PURE__ */ __name((event) => { - if (settingStore.get("Comfy.Window.UnloadConfirmation") && workflowStore.modifiedWorkflows.length > 0) { - 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"); - }; - } -}); +import { bA as BaseStyle, bB as script$f, cQ as getWidth, d4 as getHeight, c3 as getOuterWidth, d5 as getOuterHeight, c_ as isRTL, cU as getVNodeProp, d6 as isArray, o as openBlock, f as createElementBlock, as as mergeProps, F as Fragment, D as renderList, y as createBlock, C as resolveDynamicComponent, m as createBaseVNode, B as createCommentVNode, A as renderSlot, bP as getAttribute, bO as findSingle, bE as focus, ce as equals, bS as Ripple, r as resolveDirective, i as withDirectives, z as withCtx, ai as normalizeClass, cR as getOffset, cb as script$g, bU as script$h, cd as isNotEmpty, b_ as script$i, bT as UniqueComponentId, bC as ZIndex, cc as resolveFieldData, c8 as OverlayEventBus, ci as isEmpty, b$ as addStyle, c2 as relativePosition, c4 as absolutePosition, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, cj as findLastIndex, bg as script$j, cH as script$k, bI as script$l, bR as script$m, ck as script$n, a8 as script$o, bK as resolveComponent, n as normalizeStyle, k as createVNode, E as toDisplayString, bL as Transition, co as createSlots, a7 as createTextVNode, cu as script$p, bZ as script$q, cA as script$r, cB as script$s, bJ as script$t, cv as normalizeProps, d7 as ToastEventBus, c9 as setAttribute, d8 as TransitionGroup, cq as resolve, d9 as nestedPosition, cf as script$u, ch as isPrintableCharacter, l as script$v, cD as script$w, cx as guardReactiveProps } from "./index-CmVtQCAR.js"; +import { s as script$x } from "./index-I0brO37W.js"; 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"); @@ -148,7 +33,7 @@ var SplitterStyle = BaseStyle.extend({ }); var script$1$a = { name: "BaseSplitter", - "extends": script$e, + "extends": script$f, props: { layout: { type: String, @@ -172,7 +57,7 @@ var script$1$a = { } }, style: SplitterStyle, - provide: /* @__PURE__ */ __name(function provide2() { + provide: /* @__PURE__ */ __name(function provide() { return { $pcSplitter: this, $parentInstance: this @@ -209,7 +94,7 @@ function _arrayLikeToArray$2(r, a) { return n; } __name(_arrayLikeToArray$2, "_arrayLikeToArray$2"); -var script$c = { +var script$e = { name: "Splitter", "extends": script$1$a, inheritAttrs: false, @@ -235,27 +120,7 @@ var script$c = { }; }, "data"), mounted: /* @__PURE__ */ __name(function mounted() { - var _this = this; - if (this.panels && this.panels.length) { - var initialized = false; - if (this.isStateful()) { - initialized = this.restoreState(); - } - if (!initialized) { - var children = _toConsumableArray$2(this.$el.children).filter(function(child) { - return child.getAttribute("data-pc-name") === "splitterpanel"; - }); - var _panelSizes = []; - this.panels.map(function(panel, i) { - var panelInitialSize = panel.props && panel.props.size ? panel.props.size : null; - var panelSize = panelInitialSize || 100 / _this.panels.length; - _panelSizes[i] = panelSize; - children[i].style.flexBasis = "calc(" + panelSize + "% - " + (_this.panels.length - 1) * _this.gutterSize + "px)"; - }); - this.panelSizes = _panelSizes; - this.prevSize = parseFloat(_panelSizes[0]).toFixed(4); - } - } + this.initializePanels(); }, "mounted"), beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount() { this.clear(); @@ -265,6 +130,29 @@ var script$c = { isSplitterPanel: /* @__PURE__ */ __name(function isSplitterPanel(child) { return child.type.name === "SplitterPanel"; }, "isSplitterPanel"), + initializePanels: /* @__PURE__ */ __name(function initializePanels() { + var _this = this; + if (this.panels && this.panels.length) { + var initialized = false; + if (this.isStateful()) { + initialized = this.restoreState(); + } + if (!initialized) { + var children = _toConsumableArray$2(this.$el.children).filter(function(child) { + return child.getAttribute("data-pc-name") === "splitterpanel"; + }); + var _panelSizes = []; + this.panels.map(function(panel, i) { + var panelInitialSize = panel.props && panel.props.size ? panel.props.size : null; + var panelSize = panelInitialSize || 100 / _this.panels.length; + _panelSizes[i] = panelSize; + children[i].style.flexBasis = "calc(" + panelSize + "% - " + (_this.panels.length - 1) * _this.gutterSize + "px)"; + }); + this.panelSizes = _panelSizes; + this.prevSize = parseFloat(_panelSizes[0]).toFixed(4); + } + } + }, "initializePanels"), onResizeStart: /* @__PURE__ */ __name(function onResizeStart(event, index, isKeyDown) { this.gutterElement = event.currentTarget || event.target.parentElement; this.size = this.horizontal ? getWidth(this.$el) : getHeight(this.$el); @@ -300,8 +188,15 @@ var script$c = { newNextPanelSize = 100 * (this.nextPanelSize + step) / this.size; } } else { - 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; + if (this.horizontal) { + if (isRTL(this.$el)) { + newPos = (this.startPos - event.pageX) * 100 / this.size; + } else { + newPos = (event.pageX - this.startPos) * 100 / this.size; + } + } else { + newPos = (event.pageY - this.startPos) * 100 / this.size; + } newPrevPanelSize = this.prevPanelSize + newPos; newNextPanelSize = this.nextPanelSize - newPos; } @@ -512,7 +407,10 @@ var script$c = { return true; } return false; - }, "restoreState") + }, "restoreState"), + resetState: /* @__PURE__ */ __name(function resetState() { + this.initializePanels(); + }, "resetState") }, computed: { panels: /* @__PURE__ */ __name(function panels() { @@ -552,9 +450,9 @@ var script$c = { }, "getPTOptions") } }; -var _hoisted_1$p = ["onMousedown", "onTouchstart", "onTouchmove", "onTouchend"]; -var _hoisted_2$j = ["aria-orientation", "aria-valuenow", "onKeydown"]; -function render$j(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$7 = ["onMousedown", "onTouchstart", "onTouchmove", "onTouchend"]; +var _hoisted_2$4 = ["aria-orientation", "aria-valuenow", "onKeydown"]; +function render$d(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root"), style: _ctx.sx("root"), @@ -597,11 +495,11 @@ function render$j(_ctx, _cache, $props, $setup, $data, $options) { return $options.onGutterKeyDown($event, i); }, "onKeydown"), ref_for: true - }, _ctx.ptm("gutterHandle")), null, 16, _hoisted_2$j)], 16, _hoisted_1$p)) : createCommentVNode("", true)], 64); + }, _ctx.ptm("gutterHandle")), null, 16, _hoisted_2$4)], 16, _hoisted_1$7)) : createCommentVNode("", true)], 64); }), 128))], 16); } -__name(render$j, "render$j"); -script$c.render = render$j; +__name(render$d, "render$d"); +script$e.render = render$d; var classes$9 = { root: /* @__PURE__ */ __name(function root3(_ref) { var instance = _ref.instance; @@ -616,7 +514,7 @@ var SplitterPanelStyle = BaseStyle.extend({ }); var script$1$9 = { name: "BaseSplitterPanel", - "extends": script$e, + "extends": script$f, props: { size: { type: Number, @@ -628,14 +526,14 @@ var script$1$9 = { } }, style: SplitterPanelStyle, - provide: /* @__PURE__ */ __name(function provide3() { + provide: /* @__PURE__ */ __name(function provide2() { return { $pcSplitterPanel: this, $parentInstance: this }; }, "provide") }; -var script$b = { +var script$d = { name: "SplitterPanel", "extends": script$1$9, inheritAttrs: false, @@ -661,102 +559,14 @@ var script$b = { }, "getPTOptions") } }; -function render$i(_ctx, _cache, $props, $setup, $data, $options) { +function render$c(_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$i, "render$i"); -script$b.render = render$i; -const _sfc_main$r = /* @__PURE__ */ defineComponent({ - __name: "LiteGraphCanvasSplitterOverlay", - setup(__props) { - const settingStore = useSettingStore(); - const sidebarLocation = computed( - () => settingStore.get("Comfy.Sidebar.Location") - ); - const sidebarPanelVisible = computed( - () => useSidebarTabStore().activeSidebarTab !== null - ); - const bottomPanelVisible = computed( - () => useBottomPanelStore().bottomPanelVisible - ); - const activeSidebarTabId = computed( - () => useSidebarTabStore().activeSidebarTabId - ); - return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$c), { - class: "splitter-overlay-root splitter-overlay", - "pt:gutter": sidebarPanelVisible.value ? "" : "hidden", - key: activeSidebarTabId.value, - stateKey: activeSidebarTabId.value, - stateStorage: "local" - }, { - default: withCtx(() => [ - sidebarLocation.value === "left" ? withDirectives((openBlock(), createBlock(unref(script$b), { - key: 0, - class: "side-bar-panel", - minSize: 10, - size: 20 - }, { - default: withCtx(() => [ - renderSlot(_ctx.$slots, "side-bar-panel", {}, void 0, true) - ]), - _: 3 - }, 512)), [ - [vShow, sidebarPanelVisible.value] - ]) : createCommentVNode("", true), - createVNode(unref(script$b), { size: 100 }, { - default: withCtx(() => [ - createVNode(unref(script$c), { - class: "splitter-overlay max-w-full", - layout: "vertical", - "pt:gutter": bottomPanelVisible.value ? "" : "hidden", - stateKey: "bottom-panel-splitter", - stateStorage: "local" - }, { - default: withCtx(() => [ - 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$b), { class: "bottom-panel" }, { - default: withCtx(() => [ - renderSlot(_ctx.$slots, "bottom-panel", {}, void 0, true) - ]), - _: 3 - }, 512), [ - [vShow, bottomPanelVisible.value] - ]) - ]), - _: 3 - }, 8, ["pt:gutter"]) - ]), - _: 3 - }), - sidebarLocation.value === "right" ? withDirectives((openBlock(), createBlock(unref(script$b), { - key: 1, - class: "side-bar-panel", - minSize: 10, - size: 20 - }, { - default: withCtx(() => [ - renderSlot(_ctx.$slots, "side-bar-panel", {}, void 0, true) - ]), - _: 3 - }, 512)), [ - [vShow, sidebarPanelVisible.value] - ]) : createCommentVNode("", true) - ]), - _: 3 - }, 8, ["pt:gutter", "stateKey"]); - }; - } -}); -const LiteGraphCanvasSplitterOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-e50caa15"]]); +__name(render$c, "render$c"); +script$d.render = render$c; var classes$8 = { root: /* @__PURE__ */ __name(function root4(_ref) { var instance = _ref.instance, props = _ref.props; @@ -772,7 +582,7 @@ var TabStyle = BaseStyle.extend({ }); var script$1$8 = { name: "BaseTab", - "extends": script$e, + "extends": script$f, props: { value: { type: [String, Number], @@ -792,14 +602,14 @@ var script$1$8 = { } }, style: TabStyle, - provide: /* @__PURE__ */ __name(function provide4() { + provide: /* @__PURE__ */ __name(function provide3() { return { $pcTab: this, $parentInstance: this }; }, "provide") }; -var script$a = { +var script$c = { name: "Tab", "extends": script$1$8, inheritAttrs: false, @@ -948,7 +758,7 @@ var script$a = { ripple: Ripple } }; -function render$h(_ctx, _cache, $props, $setup, $data, $options) { +function render$b(_ctx, _cache, $props, $setup, $data, $options) { var _directive_ripple = resolveDirective("ripple"); return !_ctx.asChild ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ key: 0, @@ -967,8 +777,8 @@ function render$h(_ctx, _cache, $props, $setup, $data, $options) { onClick: $options.onClick }); } -__name(render$h, "render$h"); -script$a.render = render$h; +__name(render$b, "render$b"); +script$c.render = render$b; var classes$7 = { root: "p-tablist", content: /* @__PURE__ */ __name(function content(_ref) { @@ -988,17 +798,17 @@ var TabListStyle = BaseStyle.extend({ }); var script$1$7 = { name: "BaseTabList", - "extends": script$e, + "extends": script$f, props: {}, style: TabListStyle, - provide: /* @__PURE__ */ __name(function provide5() { + provide: /* @__PURE__ */ __name(function provide4() { return { $pcTabList: this, $parentInstance: this }; }, "provide") }; -var script$9 = { +var script$b = { name: "TabList", "extends": script$1$7, inheritAttrs: false, @@ -1044,16 +854,24 @@ var script$9 = { }, "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; + var buttonWidths = this.getVisibleButtonWidths(); + var width = getWidth(content2) - buttonWidths; + var currentScrollLeft = Math.abs(content2.scrollLeft); + var scrollStep = width * 0.8; + var targetScrollLeft = currentScrollLeft - scrollStep; + var scrollLeft = Math.max(targetScrollLeft, 0); + content2.scrollLeft = isRTL(content2) ? -1 * scrollLeft : scrollLeft; }, "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; + var buttonWidths = this.getVisibleButtonWidths(); + var width = getWidth(content2) - buttonWidths; + var currentScrollLeft = Math.abs(content2.scrollLeft); + var scrollStep = width * 0.8; + var targetScrollLeft = currentScrollLeft + scrollStep; + var maxScrollLeft = content2.scrollWidth - width; + var scrollLeft = Math.min(targetScrollLeft, maxScrollLeft); + content2.scrollLeft = isRTL(content2) ? -1 * scrollLeft : scrollLeft; }, "onNextButtonClick"), bindResizeObserver: /* @__PURE__ */ __name(function bindResizeObserver() { var _this2 = this; @@ -1080,7 +898,8 @@ var script$9 = { }, "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 scrollTop = content2.scrollTop, scrollWidth = content2.scrollWidth, scrollHeight = content2.scrollHeight, offsetWidth = content2.offsetWidth, offsetHeight = content2.offsetHeight; + var scrollLeft = Math.abs(content2.scrollLeft); var _ref = [getWidth(content2), getHeight(content2)], width = _ref[0], height = _ref[1]; if (this.$pcTabs.isVertical()) { this.isPrevButtonEnabled = scrollTop !== 0; @@ -1091,10 +910,12 @@ var script$9 = { } }, "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); + var _this$$refs3 = this.$refs, prevButton = _this$$refs3.prevButton, nextButton = _this$$refs3.nextButton; + var width = 0; + if (this.showNavigators) { + width = ((prevButton === null || prevButton === void 0 ? void 0 : prevButton.offsetWidth) || 0) + ((nextButton === null || nextButton === void 0 ? void 0 : nextButton.offsetWidth) || 0); + } + return width; }, "getVisibleButtonWidths") }, computed: { @@ -1115,17 +936,17 @@ var script$9 = { }, "nextButtonAriaLabel") }, components: { - ChevronLeftIcon: script$f, - ChevronRightIcon: script$g + ChevronLeftIcon: script$g, + ChevronRightIcon: script$h }, directives: { ripple: Ripple } }; -var _hoisted_1$o = ["aria-label", "tabindex"]; -var _hoisted_2$i = ["aria-orientation"]; -var _hoisted_3$h = ["aria-label", "tabindex"]; -function render$g(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$6 = ["aria-label", "tabindex"]; +var _hoisted_2$3 = ["aria-orientation"]; +var _hoisted_3$3 = ["aria-label", "tabindex"]; +function render$a(_ctx, _cache, $props, $setup, $data, $options) { var _directive_ripple = resolveDirective("ripple"); return openBlock(), createElementBlock("div", mergeProps({ ref: "list", @@ -1143,7 +964,7 @@ function render$g(_ctx, _cache, $props, $setup, $data, $options) { "data-pc-group-section": "navigator" }), [(openBlock(), createBlock(resolveDynamicComponent($options.templates.previcon || "ChevronLeftIcon"), mergeProps({ "aria-hidden": "true" - }, _ctx.ptm("prevIcon")), null, 16))], 16, _hoisted_1$o)), [[_directive_ripple]]) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + }, _ctx.ptm("prevIcon")), null, 16))], 16, _hoisted_1$6)), [[_directive_ripple]]) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ ref: "content", "class": _ctx.cx("content"), onScroll: _cache[1] || (_cache[1] = function() { @@ -1159,7 +980,7 @@ function render$g(_ctx, _cache, $props, $setup, $data, $options) { "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({ + }, _ctx.ptm("activeBar")), null, 16)], 16, _hoisted_2$3)], 16), $options.showNavigators && $data.isNextButtonEnabled ? withDirectives((openBlock(), createElementBlock("button", mergeProps({ key: 1, ref: "nextButton", "class": _ctx.cx("nextButton"), @@ -1172,134 +993,13 @@ function render$g(_ctx, _cache, $props, $setup, $data, $options) { "data-pc-group-section": "navigator" }), [(openBlock(), createBlock(resolveDynamicComponent($options.templates.nexticon || "ChevronRightIcon"), mergeProps({ "aria-hidden": "true" - }, _ctx.ptm("nextIcon")), null, 16))], 16, _hoisted_3$h)), [[_directive_ripple]]) : createCommentVNode("", true)], 16); + }, _ctx.ptm("nextIcon")), null, 16))], 16, _hoisted_3$3)), [[_directive_ripple]]) : createCommentVNode("", true)], 16); } -__name(render$g, "render$g"); -script$9.render = render$g; -const _sfc_main$q = /* @__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$n = { class: "flex flex-col h-full" }; -const _hoisted_2$h = { class: "w-full flex justify-between" }; -const _hoisted_3$g = { class: "tabs-container" }; -const _hoisted_4$6 = { class: "font-bold" }; -const _hoisted_5$4 = { class: "flex-grow h-0" }; -const _sfc_main$p = /* @__PURE__ */ defineComponent({ - __name: "BottomPanel", - setup(__props) { - const bottomPanelStore = useBottomPanelStore(); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$n, [ - 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$g, [ - (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$6, 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$q, { - key: 0, - extension: unref(bottomPanelStore).activeBottomPanelTab - }, null, 8, ["extension"])) : createCommentVNode("", true) - ]) - ]); - }; - } -}); -const _hoisted_1$m = { - 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$f = [ - _hoisted_2$g -]; -function render$f(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$m, [..._hoisted_3$f]); -} -__name(render$f, "render$f"); -const __unplugin_components_1$2 = markRaw({ name: "simple-line-icons-cursor", render: render$f }); -const _hoisted_1$l = { - 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$e = [ - _hoisted_2$f -]; -function render$e(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$l, [..._hoisted_3$e]); -} -__name(render$e, "render$e"); -const __unplugin_components_0$2 = markRaw({ name: "material-symbols-pan-tool-outline", render: render$e }); +__name(render$a, "render$a"); +script$b.render = render$a; 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"; + return "\n.p-buttongroup {\n display: inline-flex;\n}\n\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-inline-end: 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-start-end-radius: 0;\n border-end-end-radius: 0;\n}\n\n.p-buttongroup .p-button:last-of-type:not(:only-of-type) {\n border-start-start-radius: 0;\n border-end-start-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" @@ -1311,469 +1011,31 @@ var ButtonGroupStyle = BaseStyle.extend({ }); var script$1$6 = { name: "BaseButtonGroup", - "extends": script$e, + "extends": script$f, style: ButtonGroupStyle, - provide: /* @__PURE__ */ __name(function provide6() { + provide: /* @__PURE__ */ __name(function provide5() { return { $pcButtonGroup: this, $parentInstance: this }; }, "provide") }; -var script$8 = { +var script$a = { name: "ButtonGroup", "extends": script$1$6, inheritAttrs: false }; -function render$d(_ctx, _cache, $props, $setup, $data, $options) { +function render$9(_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$o = /* @__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", - "aria-label": _ctx.$t("graphCanvasMenu.zoomIn"), - onMousedown: _cache[0] || (_cache[0] = ($event) => repeat2("Comfy.Canvas.ZoomIn")), - onMouseup: stopRepeat - }, null, 8, ["aria-label"]), [ - [ - _directive_tooltip, - unref(t)("graphCanvasMenu.zoomIn"), - void 0, - { left: true } - ] - ]), - withDirectives(createVNode(unref(script$d), { - severity: "secondary", - icon: "pi pi-minus", - "aria-label": _ctx.$t("graphCanvasMenu.zoomOut"), - onMousedown: _cache[1] || (_cache[1] = ($event) => repeat2("Comfy.Canvas.ZoomOut")), - onMouseup: stopRepeat - }, null, 8, ["aria-label"]), [ - [ - _directive_tooltip, - unref(t)("graphCanvasMenu.zoomOut"), - void 0, - { left: true } - ] - ]), - withDirectives(createVNode(unref(script$d), { - severity: "secondary", - icon: "pi pi-expand", - "aria-label": _ctx.$t("graphCanvasMenu.fitView"), - onClick: _cache[2] || (_cache[2] = () => unref(commandStore).execute("Comfy.Canvas.FitView")) - }, null, 8, ["aria-label"]), [ - [ - _directive_tooltip, - unref(t)("graphCanvasMenu.fitView"), - void 0, - { left: true } - ] - ]), - withDirectives((openBlock(), createBlock(unref(script$d), { - severity: "secondary", - "aria-label": unref(t)( - "graphCanvasMenu." + (unref(canvasStore).canvas?.read_only ? "panMode" : "selectMode") - ), - 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 - }, 8, ["aria-label"])), [ - [ - _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", - "aria-label": _ctx.$t("graphCanvasMenu.toggleLinkVisibility"), - onClick: _cache[4] || (_cache[4] = () => unref(commandStore).execute("Comfy.Canvas.ToggleLinkVisibility")), - "data-testid": "toggle-link-visibility-button" - }, null, 8, ["icon", "aria-label"]), [ - [ - _directive_tooltip, - unref(t)("graphCanvasMenu.toggleLinkVisibility"), - void 0, - { left: true } - ] - ]) - ]), - _: 1 - }); - }; - } -}); -const GraphCanvasMenu = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-cb8f9a1a"]]); -const _sfc_main$n = /* @__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$m = /* @__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$m, [["__scopeId", "data-v-46859edf"]]); -const _sfc_main$l = /* @__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$l, [["__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); - } - } -} +__name(render$9, "render$9"); +script$a.render = render$9; 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"); + 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 inset-inline-end: ".concat(dt("autocomplete.padding.x"), ";\n}\n\n.p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-loader {\n inset-inline-end: 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-start-end-radius: 0;\n border-end-end-radius: 0;\n}\n\n.p-autocomplete-dropdown {\n cursor: pointer;\n display: inline-flex;\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-start-end-radius: ").concat(dt("autocomplete.dropdown.border.radius"), ";\n border-end-end-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-inline-start: 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 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-container {\n overflow: auto;\n}\n\n.p-autocomplete-list {\n margin: 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):hover .p-variant-filled.p-autocomplete-input-multiple {\n background: ").concat(dt("autocomplete.filled.hover.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-block-start: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n padding-block-end: 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-inline-start: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n padding-inline-end: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n}\n\n.p-autocomplete-chip-item.p-focus .p-autocomplete-chip {\n background: ").concat(dt("autocomplete.chip.focus.background"), ";\n color: ").concat(dt("autocomplete.chip.focus.color"), ";\n}\n\n.p-autocomplete-input-chip {\n flex: 1 1 auto;\n display: inline-flex;\n padding-block-start: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n padding-block-end: 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.p-invalid .p-autocomplete-input-chip input::placeholder {\n color: ").concat(dt("autocomplete.invalid.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.p-autocomplete:has(.p-inputtext-sm) .p-autocomplete-dropdown {\n width: ").concat(dt("autocomplete.dropdown.sm.width"), ";\n}\n\n.p-autocomplete:has(.p-inputtext-sm) .p-autocomplete-dropdown .p-icon {\n font-size: ").concat(dt("form.field.sm.font.size"), ";\n width: ").concat(dt("form.field.sm.font.size"), ";\n height: ").concat(dt("form.field.sm.font.size"), ";\n}\n\n.p-autocomplete:has(.p-inputtext-lg) .p-autocomplete-dropdown {\n width: ").concat(dt("autocomplete.dropdown.lg.width"), ";\n}\n\n.p-autocomplete:has(.p-inputtext-lg) .p-autocomplete-dropdown .p-icon {\n font-size: ").concat(dt("form.field.lg.font.size"), ";\n width: ").concat(dt("form.field.lg.font.size"), ";\n height: ").concat(dt("form.field.lg.font.size"), ";\n}\n"); }, "theme"); var inlineStyles$3 = { root: { @@ -1785,19 +1047,20 @@ var classes$5 = { var instance = _ref2.instance, props = _ref2.props; return ["p-autocomplete p-component p-inputwrapper", { "p-disabled": props.disabled, - "p-invalid": props.invalid, + "p-invalid": instance.$invalid, "p-focus": instance.focused, - "p-inputwrapper-filled": props.modelValue || isNotEmpty(instance.inputValue), + "p-inputwrapper-filled": instance.$filled || isNotEmpty(instance.inputValue), "p-inputwrapper-focus": instance.focused, "p-autocomplete-open": instance.overlayVisible, - "p-autocomplete-fluid": instance.hasFluid + "p-autocomplete-fluid": instance.$fluid }]; }, "root"), - pcInput: "p-autocomplete-input", + pcInputText: "p-autocomplete-input", inputMultiple: /* @__PURE__ */ __name(function inputMultiple(_ref3) { - var props = _ref3.props, instance = _ref3.instance; + _ref3.props; + var instance = _ref3.instance; return ["p-autocomplete-input-multiple", { - "p-variant-filled": props.variant ? props.variant === "filled" : instance.$primevue.config.inputStyle === "filled" || instance.$primevue.config.inputVariant === "filled" + "p-variant-filled": instance.$variant === "filled" }]; }, "inputMultiple"), chipItem: /* @__PURE__ */ __name(function chipItem(_ref4) { @@ -1812,6 +1075,7 @@ var classes$5 = { loader: "p-autocomplete-loader", dropdown: "p-autocomplete-dropdown", overlay: "p-autocomplete-overlay p-component", + listContainer: "p-autocomplete-list-container", list: "p-autocomplete-list", optionGroup: "p-autocomplete-option-group", option: /* @__PURE__ */ __name(function option(_ref5) { @@ -1832,9 +1096,8 @@ var AutoCompleteStyle = BaseStyle.extend({ }); var script$1$5 = { name: "BaseAutoComplete", - "extends": script$e, + "extends": script$i, props: { - modelValue: null, suggestions: { type: Array, "default": null @@ -1863,18 +1126,6 @@ var script$1$5 = { type: Boolean, "default": false }, - variant: { - type: String, - "default": null - }, - invalid: { - type: Boolean, - "default": false - }, - disabled: { - type: Boolean, - "default": false - }, placeholder: { type: String, "default": null @@ -1991,6 +1242,10 @@ var script$1$5 = { type: String, "default": null }, + showEmptyMessage: { + type: Boolean, + "default": true + }, tabindex: { type: Number, "default": 0 @@ -2006,14 +1261,10 @@ var script$1$5 = { ariaLabelledby: { type: String, "default": null - }, - fluid: { - type: Boolean, - "default": null } }, style: AutoCompleteStyle, - provide: /* @__PURE__ */ __name(function provide7() { + provide: /* @__PURE__ */ __name(function provide6() { return { $pcAutoComplete: this, $parentInstance: this @@ -2059,11 +1310,11 @@ function _arrayLikeToArray$1(r, a) { return n; } __name(_arrayLikeToArray$1, "_arrayLikeToArray$1"); -var script$7 = { +var script$9 = { name: "AutoComplete", "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"], + emits: ["change", "focus", "blur", "item-select", "item-unselect", "option-select", "option-unselect", "dropdown-click", "clear", "complete", "before-show", "before-hide", "show", "hide"], inject: { $pcFluid: { "default": null @@ -2096,6 +1347,7 @@ var script$7 = { this.show(); this.focusedOptionIndex = this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1; this.searching = false; + !this.showEmptyMessage && this.visibleOptions.length === 0 && this.hide(); } this.autoUpdateModel(); }, "suggestions") @@ -2171,12 +1423,13 @@ var script$7 = { hide: /* @__PURE__ */ __name(function hide(isFocus) { var _this2 = this; var _hide = /* @__PURE__ */ __name(function _hide2() { + var _this2$$refs$focusInp; _this2.$emit("before-hide"); _this2.dirty = isFocus; _this2.overlayVisible = false; _this2.clicked = false; _this2.focusedOptionIndex = -1; - isFocus && focus(_this2.multiple ? _this2.$refs.focusInput : _this2.$refs.focusInput.$el); + isFocus && focus(_this2.multiple ? _this2.$refs.focusInput : (_this2$$refs$focusInp = _this2.$refs.focusInput) === null || _this2$$refs$focusInp === void 0 ? void 0 : _this2$$refs$focusInp.$el); }, "_hide"); setTimeout(function() { _hide(); @@ -2198,10 +1451,12 @@ var script$7 = { this.$emit("focus", event); }, "onFocus"), onBlur: /* @__PURE__ */ __name(function onBlur(event) { + var _this$formField$onBlu, _this$formField; this.dirty = false; this.focused = false; this.focusedOptionIndex = -1; this.$emit("blur", event); + (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField); }, "onBlur"), onKeyDown: /* @__PURE__ */ __name(function onKeyDown(event) { if (this.disabled) { @@ -2325,7 +1580,7 @@ var script$7 = { }, "onMultipleContainerKeyDown"), onContainerClick: /* @__PURE__ */ __name(function onContainerClick(event) { this.clicked = true; - if (this.disabled || this.searching || this.loading || this.isInputClicked(event) || this.isDropdownClicked(event)) { + if (this.disabled || this.searching || this.loading || this.isDropdownClicked(event)) { return; } if (!this.overlay || !this.overlay.contains(event.target)) { @@ -2354,7 +1609,7 @@ var script$7 = { if (this.multiple) { this.$refs.focusInput.value = ""; if (!this.isSelected(option2)) { - this.updateModel(event, [].concat(_toConsumableArray$1(this.modelValue || []), [value])); + this.updateModel(event, [].concat(_toConsumableArray$1(this.d_value || []), [value])); } } else { this.updateModel(event, value); @@ -2415,9 +1670,9 @@ var script$7 = { var target = event.currentTarget; this.focusedOptionIndex = -1; if (this.multiple) { - if (isEmpty(target.value) && this.hasSelectedOption) { + if (isEmpty(target.value) && this.$filled) { focus(this.$refs.multiContainer); - this.focusedMultipleOptionIndex = this.modelValue.length; + this.focusedMultipleOptionIndex = this.d_value.length; } else { event.stopPropagation(); } @@ -2452,7 +1707,7 @@ var script$7 = { onEnterKey: /* @__PURE__ */ __name(function onEnterKey2(event) { if (!this.typeahead) { if (this.multiple) { - this.updateModel(event, [].concat(_toConsumableArray$1(this.modelValue || []), [event.target.value])); + this.updateModel(event, [].concat(_toConsumableArray$1(this.d_value || []), [event.target.value])); this.$refs.focusInput.value = ""; } } else { @@ -2466,6 +1721,7 @@ var script$7 = { this.hide(); } } + event.preventDefault(); }, "onEnterKey"), onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey(event) { this.overlayVisible && this.hide(true); @@ -2479,10 +1735,10 @@ var script$7 = { }, "onTabKey"), onBackspaceKey: /* @__PURE__ */ __name(function onBackspaceKey(event) { if (this.multiple) { - if (isNotEmpty(this.modelValue) && !this.$refs.focusInput.value) { - var removedValue = this.modelValue[this.modelValue.length - 1]; - var newValue = this.modelValue.slice(0, -1); - this.$emit("update:modelValue", newValue); + if (isNotEmpty(this.d_value) && !this.$refs.focusInput.value) { + var removedValue = this.d_value[this.d_value.length - 1]; + var newValue = this.d_value.slice(0, -1); + this.writeValue(newValue, event); this.$emit("item-unselect", { originalEvent: event, value: removedValue @@ -2500,7 +1756,7 @@ var script$7 = { }, "onArrowLeftKeyOnMultiple"), onArrowRightKeyOnMultiple: /* @__PURE__ */ __name(function onArrowRightKeyOnMultiple() { this.focusedMultipleOptionIndex++; - if (this.focusedMultipleOptionIndex > this.modelValue.length - 1) { + if (this.focusedMultipleOptionIndex > this.d_value.length - 1) { this.focusedMultipleOptionIndex = -1; focus(this.$refs.focusInput); } @@ -2620,9 +1876,9 @@ var script$7 = { isSelected: /* @__PURE__ */ __name(function isSelected(option2) { var _this8 = this; var optionValue = this.getOptionValue(option2); - return this.multiple ? (this.modelValue || []).some(function(value) { + return this.multiple ? (this.d_value || []).some(function(value) { return _this8.isEquals(value, optionValue); - }) : this.isEquals(this.modelValue, this.getOptionValue(option2)); + }) : this.isEquals(this.d_value, this.getOptionValue(option2)); }, "isSelected"), findFirstOptionIndex: /* @__PURE__ */ __name(function findFirstOptionIndex() { var _this9 = this; @@ -2652,7 +1908,7 @@ var script$7 = { }, "findPrevOptionIndex"), findSelectedOptionIndex: /* @__PURE__ */ __name(function findSelectedOptionIndex() { var _this13 = this; - return this.hasSelectedOption ? this.visibleOptions.findIndex(function(option2) { + return this.$filled ? this.visibleOptions.findIndex(function(option2) { return _this13.isValidSelectedOption(option2); }) : -1; }, "findSelectedOptionIndex"), @@ -2679,8 +1935,8 @@ var script$7 = { }, "search"), removeOption: /* @__PURE__ */ __name(function removeOption(event, index) { var _this14 = this; - var removedOption = this.modelValue[index]; - var value = this.modelValue.filter(function(_2, i) { + var removedOption = this.d_value[index]; + var value = this.d_value.filter(function(_, i) { return i !== index; }).map(function(option2) { return _this14.getOptionValue(option2); @@ -2723,13 +1979,13 @@ var script$7 = { }); }, "scrollInView"), autoUpdateModel: /* @__PURE__ */ __name(function autoUpdateModel() { - if (this.selectOnFocus && this.autoOptionFocus && !this.hasSelectedOption) { + if (this.selectOnFocus && this.autoOptionFocus && !this.$filled) { this.focusedOptionIndex = this.findFirstFocusedOptionIndex(); this.onOptionSelect(null, this.visibleOptions[this.focusedOptionIndex], false); } }, "autoUpdateModel"), updateModel: /* @__PURE__ */ __name(function updateModel(event, value) { - this.$emit("update:modelValue", value); + this.writeValue(value, event); this.$emit("change", { originalEvent: event, value @@ -2766,19 +2022,20 @@ var script$7 = { return this.optionGroupLabel ? this.flatOptions(this.suggestions) : this.suggestions || []; }, "visibleOptions"), inputValue: /* @__PURE__ */ __name(function inputValue() { - if (isNotEmpty(this.modelValue)) { - if (_typeof$1$1(this.modelValue) === "object") { - var label = this.getOptionLabel(this.modelValue); - return label != null ? label : this.modelValue; + if (this.$filled) { + if (_typeof$1$1(this.d_value) === "object") { + var label = this.getOptionLabel(this.d_value); + return label != null ? label : this.d_value; } else { - return this.modelValue; + return this.d_value; } } else { return ""; } }, "inputValue"), + // @deprecated use $filled instead. hasSelectedOption: /* @__PURE__ */ __name(function hasSelectedOption() { - return isNotEmpty(this.modelValue); + return this.$filled; }, "hasSelectedOption"), equalityKey: /* @__PURE__ */ __name(function equalityKey() { return this.dataKey; @@ -2799,7 +2056,7 @@ var script$7 = { return this.emptySelectionMessage || this.$primevue.config.locale.emptySelectionMessage || ""; }, "emptySelectionMessageText"), selectedMessageText: /* @__PURE__ */ __name(function selectedMessageText() { - return this.hasSelectedOption ? this.selectionMessageText.replaceAll("{0}", this.multiple ? this.modelValue.length : "1") : this.emptySelectionMessageText; + return this.$filled ? this.selectionMessageText.replaceAll("{0}", this.multiple ? this.d_value.length : "1") : this.emptySelectionMessageText; }, "selectedMessageText"), listAriaLabel: /* @__PURE__ */ __name(function listAriaLabel() { return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.listLabel : void 0; @@ -2821,18 +2078,15 @@ var script$7 = { }, "virtualScrollerDisabled"), panelId: /* @__PURE__ */ __name(function panelId() { return this.id + "_panel"; - }, "panelId"), - hasFluid: /* @__PURE__ */ __name(function hasFluid() { - return isEmpty(this.fluid) ? !!this.$pcFluid : this.fluid; - }, "hasFluid") + }, "panelId") }, components: { - InputText: script$i, - VirtualScroller: script$j, - Portal: script$k, - ChevronDownIcon: script$l, - SpinnerIcon: script$m, - Chip: script$n + InputText: script$j, + VirtualScroller: script$k, + Portal: script$l, + ChevronDownIcon: script$m, + SpinnerIcon: script$n, + Chip: script$o }, directives: { ripple: Ripple @@ -2890,15 +2144,15 @@ function _toPrimitive$4(t, r) { return ("string" === r ? String : Number)(t); } __name(_toPrimitive$4, "_toPrimitive$4"); -var _hoisted_1$k = ["aria-activedescendant"]; -var _hoisted_2$e = ["id", "aria-label", "aria-setsize", "aria-posinset"]; -var _hoisted_3$d = ["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_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$c(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$5 = ["aria-activedescendant"]; +var _hoisted_2$2 = ["id", "aria-label", "aria-setsize", "aria-posinset"]; +var _hoisted_3$2 = ["id", "placeholder", "tabindex", "disabled", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-invalid"]; +var _hoisted_4$2 = ["disabled", "aria-expanded", "aria-controls"]; +var _hoisted_5$2 = ["id"]; +var _hoisted_6$1 = ["id", "aria-label"]; +var _hoisted_7 = ["id"]; +var _hoisted_8 = ["id", "aria-label", "aria-selected", "aria-disabled", "aria-setsize", "aria-posinset", "onClick", "onMousemove", "data-p-selected", "data-p-focus", "data-p-disabled"]; +function render$8(_ctx, _cache, $props, $setup, $data, $options) { var _component_InputText = resolveComponent("InputText"); var _component_Chip = resolveComponent("Chip"); var _component_SpinnerIcon = resolveComponent("SpinnerIcon"); @@ -2917,13 +2171,15 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { ref: "focusInput", id: _ctx.inputId, type: "text", - "class": normalizeClass([_ctx.cx("pcInput"), _ctx.inputClass]), + name: _ctx.$formName, + "class": normalizeClass([_ctx.cx("pcInputText"), _ctx.inputClass]), style: normalizeStyle(_ctx.inputStyle), value: $options.inputValue, placeholder: _ctx.placeholder, tabindex: !_ctx.disabled ? _ctx.tabindex : -1, - fluid: $options.hasFluid, + fluid: _ctx.$fluid, disabled: _ctx.disabled, + size: _ctx.size, invalid: _ctx.invalid, variant: _ctx.variant, autocomplete: "off", @@ -2941,8 +2197,8 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { onInput: $options.onInput, onChange: $options.onChange, unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcInput") - }, 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({ + pt: _ctx.ptm("pcInputText") + }, null, 8, ["id", "name", "class", "style", "value", "placeholder", "tabindex", "fluid", "disabled", "size", "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({ key: 1, ref: "multiContainer", "class": _ctx.cx("inputMultiple"), @@ -2959,7 +2215,7 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { onKeydown: _cache[7] || (_cache[7] = function() { return $options.onMultipleContainerKeyDown && $options.onMultipleContainerKeyDown.apply($options, arguments); }) - }, _ctx.ptm("inputMultiple")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.modelValue, function(option2, i) { + }, _ctx.ptm("inputMultiple")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.d_value, function(option2, i) { return openBlock(), createElementBlock("li", mergeProps({ key: "".concat(i, "_").concat($options.getOptionLabel(option2)), id: $data.id + "_multiple_option_" + i, @@ -2969,7 +2225,7 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { role: "option", "aria-label": $options.getOptionLabel(option2), "aria-selected": true, - "aria-setsize": _ctx.modelValue.length, + "aria-setsize": _ctx.d_value.length, "aria-posinset": i + 1, ref_for: true }, _ctx.ptm("chipItem")), [renderSlot(_ctx.$slots, "chip", mergeProps({ @@ -3003,7 +2259,7 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { }), _: 2 }, 1032, ["class", "label", "removeIcon", "unstyled", "onRemove", "pt"])]; - })], 16, _hoisted_2$e); + })], 16, _hoisted_2$2); }), 128)), createBaseVNode("li", mergeProps({ "class": _ctx.cx("inputChip"), role: "option" @@ -3041,7 +2297,7 @@ function render$c(_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$d)], 16)], 16, _hoisted_1$k)) : createCommentVNode("", true), $data.searching || _ctx.loading ? renderSlot(_ctx.$slots, _ctx.$slots.loader ? "loader" : "loadingicon", { + }, _ctx.ptm("input")), null, 16, _hoisted_3$2)], 16)], 16, _hoisted_1$5)) : createCommentVNode("", true), $data.searching || _ctx.loading ? renderSlot(_ctx.$slots, _ctx.$slots.loader ? "loader" : "loadingicon", { key: 2, "class": normalizeClass(_ctx.cx("loader")) }, function() { @@ -3078,7 +2334,7 @@ function render$c(_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$2)) : createCommentVNode("", true)]; }), createBaseVNode("span", mergeProps({ role: "status", "aria-live": "polite", @@ -3102,9 +2358,7 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { ref: $options.overlayRef, id: $options.panelId, "class": [_ctx.cx("overlay"), _ctx.panelClass, _ctx.overlayClass], - style: _objectSpread$3(_objectSpread$3(_objectSpread$3({}, _ctx.panelStyle), _ctx.overlayStyle), {}, { - "max-height": $options.virtualScrollerDisabled ? _ctx.scrollHeight : "" - }), + style: _objectSpread$3(_objectSpread$3({}, _ctx.panelStyle), _ctx.overlayStyle), onClick: _cache[9] || (_cache[9] = function() { return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); }), @@ -3112,9 +2366,14 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { return $options.onOverlayKeyDown && $options.onOverlayKeyDown.apply($options, arguments); }) }, _ctx.ptm("overlay")), [renderSlot(_ctx.$slots, "header", { - value: _ctx.modelValue, + value: _ctx.d_value, suggestions: $options.visibleOptions - }), createVNode(_component_VirtualScroller, mergeProps({ + }), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("listContainer"), + style: { + "max-height": $options.virtualScrollerDisabled ? _ctx.scrollHeight : "" + } + }, _ctx.ptm("listContainer")), [createVNode(_component_VirtualScroller, mergeProps({ ref: $options.virtualScrollerRef }, _ctx.virtualScrollerOptions, { style: { @@ -3128,7 +2387,7 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { content: withCtx(function(_ref) { var styleClass = _ref.styleClass, contentRef = _ref.contentRef, items = _ref.items, getItemOptions = _ref.getItemOptions, contentStyle = _ref.contentStyle, itemSize = _ref.itemSize; return [createBaseVNode("ul", mergeProps({ - ref: /* @__PURE__ */ __name(function ref2(el) { + ref: /* @__PURE__ */ __name(function ref(el) { return $options.listRef(el, contentRef); }, "ref"), id: $data.id + "_list", @@ -3153,7 +2412,7 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { index: $options.getOptionIndex(i, getItemOptions) }, function() { return [createTextVNode(toDisplayString($options.getOptionGroupLabel(option2.optionGroup)), 1)]; - })], 16, _hoisted_7$1)) : withDirectives((openBlock(), createElementBlock("li", mergeProps({ + })], 16, _hoisted_7)) : withDirectives((openBlock(), createElementBlock("li", mergeProps({ key: 1, id: $data.id + "_" + $options.getOptionIndex(i, getItemOptions), style: { @@ -3185,14 +2444,14 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { index: $options.getOptionIndex(i, getItemOptions) }, function() { return [createTextVNode(toDisplayString($options.getOptionLabel(option2)), 1)]; - })], 16, _hoisted_8$1)), [[_directive_ripple]])], 64); - }), 128)), !items || items && items.length === 0 ? (openBlock(), createElementBlock("li", mergeProps({ + })], 16, _hoisted_8)), [[_directive_ripple]])], 64); + }), 128)), _ctx.showEmptyMessage && (!items || items && items.length === 0) ? (openBlock(), createElementBlock("li", mergeProps({ key: 0, "class": _ctx.cx("emptyMessage"), role: "option" }, _ctx.ptm("emptyMessage")), [renderSlot(_ctx.$slots, "empty", {}, function() { return [createTextVNode(toDisplayString($options.searchResultMessageText), 1)]; - })], 16)) : createCommentVNode("", true)], 16, _hoisted_6$2)]; + })], 16)) : createCommentVNode("", true)], 16, _hoisted_6$1)]; }), _: 2 }, [_ctx.$slots.loader ? { @@ -3204,8 +2463,8 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { })]; }), key: "0" - } : void 0]), 1040, ["style", "items", "disabled", "pt"]), renderSlot(_ctx.$slots, "footer", { - value: _ctx.modelValue, + } : void 0]), 1040, ["style", "items", "disabled", "pt"])], 16), renderSlot(_ctx.$slots, "footer", { + value: _ctx.d_value, suggestions: $options.visibleOptions }), createBaseVNode("span", mergeProps({ role: "status", @@ -3213,7 +2472,7 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { "class": "p-hidden-accessible" }, _ctx.ptm("hiddenSelectedMessage"), { "data-p-hidden-accessible": true - }), toDisplayString($options.selectedMessageText), 17)], 16, _hoisted_5$3)) : createCommentVNode("", true)]; + }), toDisplayString($options.selectedMessageText), 17)], 16, _hoisted_5$2)) : createCommentVNode("", true)]; }), _: 3 }, 16, ["onEnter", "onAfterEnter", "onLeave", "onAfterLeave"])]; @@ -3221,458 +2480,11 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { _: 3 }, 8, ["appendTo"])], 16); } -__name(render$c, "render$c"); -script$7.render = render$c; -const _sfc_main$k = { - name: "AutoCompletePlus", - extends: script$7, - emits: ["focused-option-changed"], - mounted() { - if (typeof script$7.mounted === "function") { - script$7.mounted.call(this); - } - this.$watch( - () => this.focusedOptionIndex, - (newVal, oldVal) => { - this.$emit("focused-option-changed", newVal); - } - ); - } -}; -const _withScopeId$8 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-fd0a74bd"), n = n(), popScopeId(), n), "_withScopeId$8"); -const _hoisted_1$j = { 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$c = { key: 0 }; -const _hoisted_4$4 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ createBaseVNode("i", { class: "pi pi-bookmark-fill text-sm mr-1" }, null, -1)); -const _hoisted_5$2 = [ - _hoisted_4$4 -]; -const _hoisted_6$1 = ["innerHTML"]; -const _hoisted_7 = /* @__PURE__ */ _withScopeId$8(() => /* @__PURE__ */ createBaseVNode("span", null, " ", -1)); -const _hoisted_8 = ["innerHTML"]; -const _hoisted_9 = { - key: 0, - class: "option-category font-light text-sm text-muted overflow-hidden text-ellipsis whitespace-nowrap" -}; -const _hoisted_10 = { class: "option-badges" }; -const _sfc_main$j = /* @__PURE__ */ defineComponent({ - __name: "NodeSearchItem", - props: { - nodeDef: {}, - currentQuery: {} - }, - setup(__props) { - const settingStore = useSettingStore(); - const showCategory = computed( - () => settingStore.get("Comfy.NodeSearchBoxImpl.ShowCategory") - ); - const showIdName = computed( - () => settingStore.get("Comfy.NodeSearchBoxImpl.ShowIdName") - ); - const showNodeFrequency = computed( - () => settingStore.get("Comfy.NodeSearchBoxImpl.ShowNodeFrequency") - ); - const nodeFrequencyStore = useNodeFrequencyStore(); - const nodeFrequency = computed( - () => nodeFrequencyStore.getNodeFrequency(props.nodeDef) - ); - const nodeBookmarkStore = useNodeBookmarkStore(); - const isBookmarked = computed( - () => nodeBookmarkStore.isBookmarked(props.nodeDef) - ); - const props = __props; - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$j, [ - createBaseVNode("div", _hoisted_2$d, [ - createBaseVNode("div", null, [ - isBookmarked.value ? (openBlock(), createElementBlock("span", _hoisted_3$c, _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$o), { - key: 1, - severity: "secondary" - }, { - default: withCtx(() => [ - createBaseVNode("span", { - innerHTML: unref(highlightQuery)(_ctx.nodeDef.name, _ctx.currentQuery) - }, null, 8, _hoisted_8) - ]), - _: 1 - })) : createCommentVNode("", true) - ]), - 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$o), { - key: 0, - value: _ctx.$t("g.experimental"), - severity: "primary" - }, null, 8, ["value"])) : createCommentVNode("", true), - _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$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$n), { - key: 3, - class: "text-sm font-light" - }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(_ctx.nodeDef.nodeSource.displayText), 1) - ]), - _: 1 - })) : createCommentVNode("", true) - ]) - ]); - }; - } -}); -const NodeSearchItem = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-fd0a74bd"]]); -const _hoisted_1$i = { 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$b = /* @__PURE__ */ createBaseVNode("h3", null, "Add node filter condition", -1); -const _hoisted_4$3 = { class: "_dialog-body" }; -const _sfc_main$i = /* @__PURE__ */ defineComponent({ - __name: "NodeSearchBox", - props: { - filters: {}, - searchLimit: { default: 64 } - }, - emits: ["addFilter", "removeFilter", "addNode"], - setup(__props, { emit: __emit }) { - const settingStore = useSettingStore(); - const { t } = useI18n(); - const enableNodePreview = computed( - () => settingStore.get("Comfy.NodeSearchBoxImpl.NodePreview") - ); - const props = __props; - const nodeSearchFilterVisible = ref(false); - const inputId = `comfy-vue-node-search-box-input-${Math.random()}`; - const suggestions2 = ref([]); - const hoveredSuggestion = ref(null); - const currentQuery = ref(""); - const placeholder = computed(() => { - return props.filters.length === 0 ? t("g.searchNodes") + "..." : ""; - }); - const nodeDefStore = useNodeDefStore(); - const nodeFrequencyStore = useNodeFrequencyStore(); - const search2 = /* @__PURE__ */ __name((query) => { - const queryIsEmpty = query === "" && props.filters.length === 0; - currentQuery.value = query; - suggestions2.value = queryIsEmpty ? nodeFrequencyStore.topNodeDefs : [ - ...nodeDefStore.nodeSearchService.searchNode(query, props.filters, { - limit: props.searchLimit - }) - ]; - }, "search"); - const emit = __emit; - let inputElement = null; - const reFocusInput = /* @__PURE__ */ __name(() => { - inputElement ??= document.getElementById(inputId); - if (inputElement) { - inputElement.blur(); - nextTick(() => inputElement?.focus()); - } - }, "reFocusInput"); - onMounted(reFocusInput); - const onAddFilter = /* @__PURE__ */ __name((filterAndValue) => { - nodeSearchFilterVisible.value = false; - emit("addFilter", filterAndValue); - }, "onAddFilter"); - const onRemoveFilter = /* @__PURE__ */ __name((event, filterAndValue) => { - event.stopPropagation(); - event.preventDefault(); - emit("removeFilter", filterAndValue); - reFocusInput(); - }, "onRemoveFilter"); - const setHoverSuggestion = /* @__PURE__ */ __name((index) => { - if (index === -1) { - hoveredSuggestion.value = null; - return; - } - const value = suggestions2.value[index]; - hoveredSuggestion.value = value; - }, "setHoverSuggestion"); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$i, [ - 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$d), { - icon: "pi pi-filter", - severity: "secondary", - class: "filter-button z-10", - onClick: _cache[0] || (_cache[0] = ($event) => nodeSearchFilterVisible.value = true) - }), - createVNode(unref(script$p), { - visible: nodeSearchFilterVisible.value, - "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => nodeSearchFilterVisible.value = $event), - class: "min-w-96", - "dismissable-mask": "", - modal: "", - onHide: reFocusInput - }, { - header: withCtx(() => [ - _hoisted_3$b - ]), - default: withCtx(() => [ - createBaseVNode("div", _hoisted_4$3, [ - createVNode(NodeSearchFilter, { onAddFilter }) - ]) - ]), - _: 1 - }, 8, ["visible"]), - createVNode(_sfc_main$k, { - "model-value": props.filters, - class: "comfy-vue-node-search-box z-10 flex-grow", - scrollHeight: "40vh", - placeholder: placeholder.value, - "input-id": inputId, - "append-to": "self", - suggestions: suggestions2.value, - "min-length": 0, - delay: 100, - loading: !unref(nodeFrequencyStore).isLoaded, - onComplete: _cache[2] || (_cache[2] = ($event) => search2($event.query)), - onOptionSelect: _cache[3] || (_cache[3] = ($event) => emit("addNode", $event.value)), - onFocusedOptionChanged: _cache[4] || (_cache[4] = ($event) => setHoverSuggestion($event)), - "complete-on-focus": "", - "auto-option-focus": "", - "force-selection": "", - multiple: "", - optionLabel: "display_name" - }, { - option: withCtx(({ option: option2 }) => [ - createVNode(NodeSearchItem, { - nodeDef: option2, - currentQuery: currentQuery.value - }, null, 8, ["nodeDef", "currentQuery"]) - ]), - chip: withCtx(({ value }) => [ - (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"])) - ]), - _: 1 - }, 8, ["model-value", "placeholder", "suggestions", "loading"]) - ]); - }; - } -}); -const _sfc_main$h = /* @__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 litegraphService.getCanvasCenter(); - } - const originalEvent = triggerEvent.value.detail.originalEvent; - return [originalEvent.canvasX, originalEvent.canvasY]; - }, "getNewNodeLocation"); - const nodeFilters = ref([]); - const addFilter = /* @__PURE__ */ __name((filter) => { - nodeFilters.value.push(filter); - }, "addFilter"); - const removeFilter = /* @__PURE__ */ __name((filter) => { - nodeFilters.value = nodeFilters.value.filter( - (f) => toRaw(f) !== toRaw(filter) - ); - }, "removeFilter"); - const clearFilters = /* @__PURE__ */ __name(() => { - nodeFilters.value = []; - }, "clearFilters"); - const closeDialog = /* @__PURE__ */ __name(() => { - visible.value = false; - }, "closeDialog"); - const addNode = /* @__PURE__ */ __name((nodeDef) => { - const node = litegraphService.addNodeOnGraph(nodeDef, { - pos: getNewNodeLocation() - }); - const eventDetail = triggerEvent.value?.detail; - if (eventDetail && eventDetail.subType === "empty-release") { - eventDetail.linkReleaseContext.links.forEach((link) => { - ConnectingLinkImpl.createFromPlainObject(link).connectTo(node); - }); - } - window.setTimeout(() => { - closeDialog(); - }, 100); - }, "addNode"); - const newSearchBoxEnabled = computed( - () => settingStore.get("Comfy.NodeSearchBoxImpl") === "default" - ); - const showSearchBox = /* @__PURE__ */ __name((e) => { - const detail = e.detail; - if (newSearchBoxEnabled.value) { - if (detail.originalEvent?.pointerType === "touch") { - setTimeout(() => { - showNewSearchBox(e); - }, 128); - } else { - showNewSearchBox(e); - } - } else { - canvasStore.canvas.showSearchBox(detail.originalEvent); - } - }, "showSearchBox"); - const nodeDefStore = useNodeDefStore(); - const showNewSearchBox = /* @__PURE__ */ __name((e) => { - if (e.detail.subType === "empty-release") { - const links = e.detail.linkReleaseContext.links; - if (links.length === 0) { - console.warn("Empty release with no links! This should never happen"); - return; - } - const firstLink = ConnectingLinkImpl.createFromPlainObject(links[0]); - const filter = nodeDefStore.nodeSearchService.getFilterById( - firstLink.releaseSlotType - ); - const dataType = firstLink.type.toString(); - addFilter([filter, dataType]); - } - visible.value = true; - triggerEvent.value = e; - dismissable.value = false; - setTimeout(() => { - dismissable.value = true; - }, 300); - }, "showNewSearchBox"); - const showContextMenu = /* @__PURE__ */ __name((e) => { - if (e.detail.subType !== "empty-release") { - return; - } - const links = e.detail.linkReleaseContext.links; - if (links.length === 0) { - console.warn("Empty release with no links! This should never happen"); - return; - } - const firstLink = ConnectingLinkImpl.createFromPlainObject(links[0]); - const mouseEvent = e.detail.originalEvent; - const commonOptions = { - e: mouseEvent, - allow_searchbox: true, - showSearchBox: /* @__PURE__ */ __name(() => showSearchBox(e), "showSearchBox") - }; - const connectionOptions = firstLink.output ? { - nodeFrom: firstLink.node, - slotFrom: firstLink.output, - afterRerouteId: firstLink.afterRerouteId - } : { - nodeTo: firstLink.node, - slotTo: firstLink.input, - afterRerouteId: firstLink.afterRerouteId - }; - canvasStore.canvas.showConnectionMenu({ - ...connectionOptions, - ...commonOptions - }); - }, "showContextMenu"); - const canvasStore = useCanvasStore(); - watchEffect(() => { - if (canvasStore.canvas) { - LiteGraph.release_link_on_empty_shows_menu = false; - canvasStore.canvas.allow_searchbox = false; - } - }); - const canvasEventHandler = /* @__PURE__ */ __name((e) => { - if (e.detail.subType === "empty-double-click") { - showSearchBox(e); - } else if (e.detail.subType === "empty-release") { - handleCanvasEmptyRelease(e); - } else if (e.detail.subType === "group-double-click") { - const group = e.detail.group; - const [x, y] = group.pos; - const relativeY = e.detail.originalEvent.canvasY - y; - if (relativeY > group.titleHeight) { - showSearchBox(e); - } - } - }, "canvasEventHandler"); - const linkReleaseAction = computed(() => { - return settingStore.get("Comfy.LinkRelease.Action"); - }); - const linkReleaseActionShift = computed(() => { - return settingStore.get("Comfy.LinkRelease.ActionShift"); - }); - const handleCanvasEmptyRelease = /* @__PURE__ */ __name((e) => { - const detail = e.detail; - const shiftPressed = detail.originalEvent.shiftKey; - const action = shiftPressed ? linkReleaseActionShift.value : linkReleaseAction.value; - switch (action) { - case LinkReleaseTriggerAction.SEARCH_BOX: - showSearchBox(e); - break; - case LinkReleaseTriggerAction.CONTEXT_MENU: - showContextMenu(e); - break; - case LinkReleaseTriggerAction.NO_ACTION: - default: - break; - } - }, "handleCanvasEmptyRelease"); - useEventListener(document, "litegraph:canvas", canvasEventHandler); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", null, [ - createVNode(unref(script$p), { - visible: unref(visible), - "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => isRef(visible) ? visible.value = $event : null), - modal: "", - "dismissable-mask": dismissable.value, - onHide: clearFilters, - pt: { - root: { - class: "invisible-dialog-root", - role: "search" - }, - mask: { class: "node-search-box-dialog-mask" }, - transition: { - enterFromClass: "opacity-0 scale-75", - // 100ms is the duration of the transition in the dialog component - enterActiveClass: "transition-all duration-100 ease-out", - leaveActiveClass: "transition-all duration-100 ease-in", - leaveToClass: "opacity-0 scale-75" - } - } - }, { - container: withCtx(() => [ - createVNode(_sfc_main$i, { - filters: nodeFilters.value, - onAddFilter: addFilter, - onRemoveFilter: removeFilter, - onAddNode: addNode - }, null, 8, ["filters"]) - ]), - _: 1 - }, 8, ["visible", "dismissable-mask"]) - ]); - }; - } -}); +__name(render$8, "render$8"); +script$9.render = render$8; 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"); + return "\n.p-overlaybadge {\n position: relative;\n}\n\n.p-overlaybadge .p-badge {\n position: absolute;\n inset-block-start: 0;\n inset-inline-end: 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.p-overlaybadge .p-badge:dir(rtl) {\n transform: translate(-50%, -50%);\n}\n"); }, "theme"); var classes$4 = { root: "p-overlaybadge" @@ -3684,24 +2496,24 @@ var OverlayBadgeStyle = BaseStyle.extend({ }); var script$1$4 = { name: "OverlayBadge", - "extends": script$q, + "extends": script$p, style: OverlayBadgeStyle, - provide: /* @__PURE__ */ __name(function provide8() { + provide: /* @__PURE__ */ __name(function provide7() { return { $pcOverlayBadge: this, $parentInstance: this }; }, "provide") }; -var script$6 = { +var script$8 = { name: "OverlayBadge", "extends": script$1$4, inheritAttrs: false, components: { - Badge: script$q + Badge: script$p } }; -function render$b(_ctx, _cache, $props, $setup, $data, $options) { +function render$7(_ctx, _cache, $props, $setup, $data, $options) { var _component_Badge = resolveComponent("Badge"); return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root") @@ -3709,1454 +2521,8 @@ function render$b(_ctx, _cache, $props, $setup, $data, $options) { pt: _ctx.ptm("pcBadge") }), null, 16, ["pt"])], 16); } -__name(render$b, "render$b"); -script$6.render = render$b; -const _sfc_main$g = /* @__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 shouldShowBadge = computed(() => !!overlayValue.value); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - 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 - }, { - 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 }] - ]); - }; - } -}); -const SidebarIcon = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-6ab4daa6"]]); -const _sfc_main$f = /* @__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$e = /* @__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$d = /* @__PURE__ */ defineComponent({ - __name: "SidebarThemeToggleIcon", - setup(__props) { - const colorPaletteStore = useColorPaletteStore(); - const icon = computed( - () => colorPaletteStore.completedActivePalette.light_theme ? "pi pi-sun" : "pi pi-moon" - ); - 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$7 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-33cac83a"), n = n(), popScopeId(), n), "_withScopeId$7"); -const _hoisted_1$h = { 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$c = /* @__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", { "small-sidebar": isSmall.value }]) - }, [ - (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$h, [ - unref(userStore).isMultiUserServer ? (openBlock(), createBlock(_sfc_main$f, { key: 0 })) : createCommentVNode("", true), - createVNode(_sfc_main$d), - createVNode(_sfc_main$e) - ]) - ], 2) - ], 8, ["to"])), - selectedTab.value ? (openBlock(), createElementBlock("div", _hoisted_2$b, [ - createVNode(_sfc_main$q, { extension: selectedTab.value }, null, 8, ["extension"]) - ])) : createCommentVNode("", true) - ], 64); - }; - } -}); -const SideToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-33cac83a"]]); -const _withScopeId$6 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-8d011a31"), n = n(), popScopeId(), n), "_withScopeId$6"); -const _hoisted_1$g = { class: "workflow-label text-sm max-w-[150px] truncate inline-block" }; -const _hoisted_2$a = { class: "relative" }; -const _hoisted_3$a = { - key: 0, - class: "status-indicator" -}; -const _sfc_main$b = /* @__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$g, [ - createTextVNode(toDisplayString(_ctx.workflowOption.workflow.filename), 1) - ])), [ - [ - _directive_tooltip, - _ctx.workflowOption.workflow.key, - void 0, - { bottom: true } - ] - ]), - createBaseVNode("div", _hoisted_2$a, [ - !unref(workspaceStore).shiftDown && (_ctx.workflowOption.workflow.isModified || !_ctx.workflowOption.workflow.isPersisted) ? (openBlock(), createElementBlock("span", _hoisted_3$a, "•")) : 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$b, [["__scopeId", "data-v-8d011a31"]]); -const _withScopeId$5 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-54fadc45"), n = n(), popScopeId(), n), "_withScopeId$5"); -const _hoisted_1$f = { class: "workflow-tabs-container flex flex-row max-w-full h-full" }; -const _sfc_main$a = /* @__PURE__ */ defineComponent({ - __name: "WorkflowTabs", - props: { - class: {} - }, - setup(__props) { - const props = __props; - const { t } = useI18n(); - const workspaceStore = useWorkspaceStore(); - const workflowStore = useWorkflowStore(); - const workflowService = useWorkflowService(); - const workflowBookmarkStore = useWorkflowBookmarkStore(); - 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 - }, - { - label: workflowBookmarkStore.isBookmarked(tab.workflow.path) ? t("tabMenu.removeFromBookmarks") : t("tabMenu.addToBookmarks"), - command: /* @__PURE__ */ __name(() => workflowBookmarkStore.toggleBookmarked(tab.workflow.path), "command"), - disabled: tab.workflow.isTemporary - } - ]; - }); - const commandStore = useCommandStore(); - const handleWheel = /* @__PURE__ */ __name((event) => { - const scrollElement = event.currentTarget; - const scrollAmount = event.deltaX || event.deltaY; - scrollElement.scroll({ - left: scrollElement.scrollLeft + scrollAmount - }); - }, "handleWheel"); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock("div", _hoisted_1$f, [ - createVNode(unref(script$s), { - class: "overflow-hidden no-drag", - "pt:content": { - class: "p-0 w-full", - onwheel: handleWheel - }, - "pt:barX": "h-1" - }, { - default: withCtx(() => [ - createVNode(unref(script$r), { - class: normalizeClass(["workflow-tabs bg-transparent", 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"]) - ]), - _: 1 - }, 8, ["pt:content"]), - withDirectives(createVNode(unref(script$d), { - class: "new-blank-workflow-button flex-shrink-0 no-drag", - icon: "pi pi-plus", - text: "", - severity: "secondary", - "aria-label": _ctx.$t("sideToolbar.newBlankWorkflow"), - onClick: _cache[0] || (_cache[0] = () => unref(commandStore).execute("Comfy.NewBlankWorkflow")) - }, null, 8, ["aria-label"]), [ - [_directive_tooltip, { value: _ctx.$t("sideToolbar.newBlankWorkflow"), showDelay: 300 }] - ]), - createVNode(unref(script$t), { - ref_key: "menu", - ref: menu, - model: contextMenuItems.value - }, null, 8, ["model"]) - ]); - }; - } -}); -const WorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-54fadc45"]]); -const _withScopeId$4 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-38831d8e"), n = n(), popScopeId(), n), "_withScopeId$4"); -const _hoisted_1$e = { class: "absolute top-0 left-0 w-auto max-w-full pointer-events-auto" }; -const _sfc_main$9 = /* @__PURE__ */ defineComponent({ - __name: "SecondRowWorkflowTabs", - setup(__props) { - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$e, [ - createVNode(WorkflowTabs) - ]); - }; - } -}); -const SecondRowWorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-38831d8e"]]); -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"], - // Default to small if the window is less than 1536px(2xl) wide. - defaultValue: /* @__PURE__ */ __name(() => window.innerWidth < 1536 ? "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: true, - versionModified: "1.7.12" - }, - { - 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", "Topbar (2nd-row)"], - // Default to topbar (2nd-row) if the window is less than 1536px(2xl) wide. - defaultValue: /* @__PURE__ */ __name(() => window.innerWidth < 1536 ? "Topbar (2nd-row)" : "Topbar", "defaultValue") - }, - { - 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", - versionModified: "1.7.3", - migrateDeprecatedValue: /* @__PURE__ */ __name((value) => { - return value.map((keybinding) => { - if (keybinding["targetSelector"] === "#graph-canvas") { - keybinding["targetElementId"] = "graph-canvas"; - } - return keybinding; - }); - }, "migrateDeprecatedValue") - }, - { - 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$8 = /* @__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(); - const canvasStore = useCanvasStore(); - const modelToNodeStore = useModelToNodeStore(); - const betaMenuEnabled = computed( - () => settingStore.get("Comfy.UseNewMenu") !== "Disabled" - ); - const workflowTabsPosition = computed( - () => settingStore.get("Comfy.Workflow.WorkflowTabsPosition") - ); - const canvasMenuEnabled = computed( - () => settingStore.get("Comfy.Graph.CanvasMenu") - ); - const tooltipEnabled = computed(() => settingStore.get("Comfy.EnableTooltips")); - const storedWorkflows = JSON.parse( - getStorageValue("Comfy.OpenWorkflowsPaths") || "[]" - ); - const storedActiveIndex = JSON.parse( - getStorageValue("Comfy.ActiveWorkflowIndex") || "-1" - ); - const openWorkflows = computed(() => workspaceStore?.workflow?.openWorkflows); - const activeWorkflow = computed(() => workspaceStore?.workflow?.activeWorkflow); - const restoreState2 = computed(() => { - if (!openWorkflows.value || !activeWorkflow.value) { - return { paths: [], activeIndex: -1 }; - } - const paths = openWorkflows.value.filter((workflow) => workflow?.isPersisted && !workflow.isModified).map((workflow) => workflow.path); - const activeIndex = openWorkflows.value.findIndex( - (workflow) => workflow.path === activeWorkflow.value?.path - ); - return { paths, activeIndex }; - }); - watchEffect(() => { - const canvasInfoEnabled = settingStore.get("Comfy.Graph.CanvasInfo"); - if (canvasStore.canvas) { - canvasStore.canvas.show_info = canvasInfoEnabled; - } - }); - watchEffect(() => { - const zoomSpeed = settingStore.get("Comfy.Graph.ZoomSpeed"); - if (canvasStore.canvas) { - canvasStore.canvas.zoom_speed = zoomSpeed; - } - }); - watchEffect(() => { - LiteGraph.snaps_for_comfy = settingStore.get("Comfy.Node.AutoSnapLinkToSlot"); - }); - watchEffect(() => { - LiteGraph.snap_highlights_node = settingStore.get( - "Comfy.Node.SnapHighlightsNode" - ); - }); - watchEffect(() => { - LGraphNode.keepAllLinksOnBypass = settingStore.get( - "Comfy.Node.BypassAllLinksOnDelete" - ); - }); - watchEffect(() => { - LiteGraph.middle_click_slot_add_default_node = settingStore.get( - "Comfy.Node.MiddleClickRerouteNode" - ); - }); - watchEffect(() => { - nodeDefStore.showDeprecated = settingStore.get("Comfy.Node.ShowDeprecated"); - }); - watchEffect(() => { - nodeDefStore.showExperimental = settingStore.get( - "Comfy.Node.ShowExperimental" - ); - }); - watchEffect(() => { - const spellcheckEnabled = settingStore.get("Comfy.TextareaWidget.Spellcheck"); - const textareas = document.querySelectorAll("textarea.comfy-multiline-input"); - textareas.forEach((textarea) => { - textarea.spellcheck = spellcheckEnabled; - textarea.focus(); - textarea.blur(); - }); - }); - watchEffect(() => { - const linkRenderMode = settingStore.get("Comfy.LinkRenderMode"); - if (canvasStore.canvas) { - canvasStore.canvas.links_render_mode = linkRenderMode; - canvasStore.canvas.setDirty( - /* fg */ - false, - /* bg */ - true - ); - } - }); - watchEffect(() => { - const linkMarkerShape = settingStore.get("Comfy.Graph.LinkMarkers"); - const { canvas } = canvasStore; - if (canvas) { - canvas.linkMarkerShape = linkMarkerShape; - canvas.setDirty(false, true); - } - }); - watchEffect(() => { - const reroutesEnabled = settingStore.get("Comfy.RerouteBeta"); - const { canvas } = canvasStore; - if (canvas) { - canvas.reroutesEnabled = reroutesEnabled; - canvas.setDirty(false, true); - } - }); - watchEffect(() => { - const maximumFps = settingStore.get("LiteGraph.Canvas.MaximumFps"); - const { canvas } = canvasStore; - if (canvas) canvas.maximumFps = maximumFps; - }); - watchEffect(() => { - CanvasPointer.doubleClickTime = settingStore.get( - "Comfy.Pointer.DoubleClickTime" - ); - }); - watchEffect(() => { - CanvasPointer.bufferTime = settingStore.get("Comfy.Pointer.ClickBufferTime"); - }); - watchEffect(() => { - CanvasPointer.maxClickDrift = settingStore.get("Comfy.Pointer.ClickDrift"); - }); - watchEffect(() => { - LiteGraph.CANVAS_GRID_SIZE = settingStore.get("Comfy.SnapToGrid.GridSize"); - }); - watchEffect(() => { - LiteGraph.alwaysSnapToGrid = settingStore.get("pysssss.SnapToGrid"); - }); - 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); - } - ); - const colorPaletteService = useColorPaletteService(); - const colorPaletteStore = useColorPaletteStore(); - watch( - [() => canvasStore.canvas, () => settingStore.get("Comfy.ColorPalette")], - ([canvas, currentPaletteId]) => { - if (!canvas) return; - colorPaletteService.loadColorPalette(currentPaletteId); - } - ); - watch( - () => colorPaletteStore.activePaletteId, - (newValue) => { - settingStore.set("Comfy.ColorPalette", newValue); - } - ); - const workflowStore = useWorkflowStore(); - const persistCurrentWorkflow = /* @__PURE__ */ __name(() => { - const workflow = JSON.stringify(app.serializeGraph()); - localStorage.setItem("workflow", workflow); - if (api.clientId) { - sessionStorage.setItem(`workflow:${api.clientId}`, workflow); - } - }, "persistCurrentWorkflow"); - watchEffect(() => { - if (workflowStore.activeWorkflow) { - const workflow = workflowStore.activeWorkflow; - setStorageValue("Comfy.PreviousWorkflow", workflow.key); - persistCurrentWorkflow(); - } - }); - api.addEventListener("graphChanged", persistCurrentWorkflow); - usePragmaticDroppable(() => canvasRef.value, { - onDrop: /* @__PURE__ */ __name((event) => { - const loc = event.location.current.input; - const dndData = event.source.data; - if (dndData.type === "tree-explorer-node") { - const node = dndData.data; - if (node.data instanceof ComfyNodeDefImpl) { - const nodeDef = node.data; - const pos = app.clientPosToCanvasPos([ - loc.clientX - 20, - loc.clientY - ]); - litegraphService.addNodeOnGraph(nodeDef, { pos }); - } else if (node.data instanceof ComfyModelDef) { - const model = node.data; - const pos = app.clientPosToCanvasPos([loc.clientX, loc.clientY]); - const nodeAtPos = app.graph.getNodeOnPos(pos[0], pos[1]); - let targetProvider = null; - let targetGraphNode = null; - if (nodeAtPos) { - const providers = modelToNodeStore.getAllNodeProviders( - model.directory - ); - for (const provider of providers) { - if (provider.nodeDef.name === nodeAtPos.comfyClass) { - targetGraphNode = nodeAtPos; - targetProvider = provider; - } - } - } - if (!targetGraphNode) { - const provider = modelToNodeStore.getNodeProvider(model.directory); - if (provider) { - targetGraphNode = litegraphService.addNodeOnGraph( - provider.nodeDef, - { - pos - } - ); - targetProvider = provider; - } - } - if (targetGraphNode) { - const widget = targetGraphNode.widgets.find( - (widget2) => widget2.name === targetProvider.key - ); - if (widget) { - widget.value = model.file_name; - } - } - } - } - }, "onDrop") - }); - const comfyAppReady = ref(false); - onMounted(async () => { - window["LiteGraph"] = LiteGraph; - window["LGraph"] = LGraph; - window["LLink"] = LLink; - window["LGraphNode"] = LGraphNode; - window["LGraphGroup"] = LGraphGroup; - window["DragAndScale"] = DragAndScale; - window["LGraphCanvas"] = LGraphCanvas; - window["ContextMenu"] = ContextMenu; - window["LGraphBadge"] = LGraphBadge; - 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; - workspaceStore.spinner = false; - window["app"] = app; - window["graph"] = app.graph; - comfyAppReady.value = true; - colorPaletteStore.customPalettes = settingStore.get( - "Comfy.CustomColorPalettes" - ); - const isRestorable = storedWorkflows?.length > 0 && storedActiveIndex >= 0; - if (isRestorable) - workflowStore.openWorkflowsInBackground({ - left: storedWorkflows.slice(0, storedActiveIndex), - right: storedWorkflows.slice(storedActiveIndex) - }); - watch(restoreState2, ({ paths, activeIndex }) => { - setStorageValue("Comfy.OpenWorkflowsPaths", JSON.stringify(paths)); - setStorageValue("Comfy.ActiveWorkflowIndex", JSON.stringify(activeIndex)); - }); - watch( - () => settingStore.get("Comfy.Locale"), - async () => { - await useCommandStore().execute("Comfy.RefreshNodeDefinitions"); - useWorkflowService().reloadCurrentWorkflow(); - } - ); - emit("ready"); - }); - return (_ctx, _cache) => { - return openBlock(), createElementBlock(Fragment, null, [ - (openBlock(), createBlock(Teleport, { to: ".graph-canvas-container" }, [ - comfyAppReady.value && betaMenuEnabled.value && !unref(workspaceStore).focusMode ? (openBlock(), createBlock(LiteGraphCanvasSplitterOverlay, { key: 0 }, { - "side-bar-panel": withCtx(() => [ - createVNode(SideToolbar) - ]), - "bottom-panel": withCtx(() => [ - createVNode(_sfc_main$p) - ]), - "graph-canvas-panel": withCtx(() => [ - workflowTabsPosition.value === "Topbar (2nd-row)" ? (openBlock(), createBlock(SecondRowWorkflowTabs, { key: 0 })) : createCommentVNode("", true), - canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { key: 1 })) : createCommentVNode("", true) - ]), - _: 1 - })) : createCommentVNode("", true), - createVNode(TitleEditor), - !betaMenuEnabled.value && canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { key: 1 })) : createCommentVNode("", true), - createBaseVNode("canvas", { - ref_key: "canvasRef", - ref: canvasRef, - id: "graph-canvas", - tabindex: "1" - }, null, 512) - ])), - createVNode(_sfc_main$h), - tooltipEnabled.value ? (openBlock(), createBlock(NodeTooltip, { key: 0 })) : createCommentVNode("", true), - createVNode(_sfc_main$n) - ], 64); - }; - } -}); +__name(render$7, "render$7"); +script$8.render = render$7; function _typeof$3(o) { "@babel/helpers - typeof"; return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { @@ -5188,7 +2554,7 @@ function _toPrimitive$3(t, r) { __name(_toPrimitive$3, "_toPrimitive$3"); 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"); + 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-close-button:dir(rtl) {\n margin: -25% 0 0 auto;\n left: -25%;\n right: auto;\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"); var inlineStyles$2 = { root: /* @__PURE__ */ __name(function root6(_ref2) { @@ -5235,9 +2601,53 @@ var ToastStyle = BaseStyle.extend({ classes: classes$3, inlineStyles: inlineStyles$2 }); +var script$7 = { + name: "ExclamationTriangleIcon", + "extends": script$q +}; +function render$6(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + 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", + fill: "currentColor" + }, null, -1), createBaseVNode("path", { + 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", + fill: "currentColor" + }, null, -1), createBaseVNode("path", { + 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", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$6, "render$6"); +script$7.render = render$6; +var script$6 = { + name: "InfoCircleIcon", + "extends": script$q +}; +function render$5(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + 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", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$5, "render$5"); +script$6.render = render$5; var script$2$2 = { name: "BaseToast", - "extends": script$e, + "extends": script$f, props: { group: { type: String, @@ -5285,7 +2695,7 @@ var script$2$2 = { } }, style: ToastStyle, - provide: /* @__PURE__ */ __name(function provide9() { + provide: /* @__PURE__ */ __name(function provide8() { return { $pcToast: this, $parentInstance: this @@ -5295,7 +2705,7 @@ var script$2$2 = { var script$1$3 = { name: "ToastMessage", hostName: "Toast", - "extends": script$e, + "extends": script$f, emits: ["close"], closeTimeout: null, props: { @@ -5367,10 +2777,10 @@ var script$1$3 = { computed: { iconComponent: /* @__PURE__ */ __name(function iconComponent() { return { - info: !this.infoIcon && script$u, - success: !this.successIcon && script$v, - warn: !this.warnIcon && script$w, - error: !this.errorIcon && script$x + info: !this.infoIcon && script$6, + success: !this.successIcon && script$r, + warn: !this.warnIcon && script$7, + error: !this.errorIcon && script$s }[this.message.severity]; }, "iconComponent"), closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel() { @@ -5378,11 +2788,11 @@ var script$1$3 = { }, "closeAriaLabel") }, components: { - TimesIcon: script$y, - InfoCircleIcon: script$u, - CheckIcon: script$v, - ExclamationTriangleIcon: script$w, - TimesCircleIcon: script$x + TimesIcon: script$t, + InfoCircleIcon: script$6, + CheckIcon: script$r, + ExclamationTriangleIcon: script$7, + TimesCircleIcon: script$s }, directives: { ripple: Ripple @@ -5440,7 +2850,7 @@ function _toPrimitive$1(t, r) { return ("string" === r ? String : Number)(t); } __name(_toPrimitive$1, "_toPrimitive$1"); -var _hoisted_1$d = ["aria-label"]; +var _hoisted_1$4 = ["aria-label"]; function render$1$2(_ctx, _cache, $props, $setup, $data, $options) { var _directive_ripple = resolveDirective("ripple"); return openBlock(), createElementBlock("div", mergeProps({ @@ -5480,7 +2890,7 @@ function render$1$2(_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$d)), [[_directive_ripple]])], 16)) : createCommentVNode("", true)], 16))], 16); + }, _ctx.ptm("closeIcon")), null, 16, ["class"]))], 16, _hoisted_1$4)), [[_directive_ripple]])], 16)) : createCommentVNode("", true)], 16))], 16); } __name(render$1$2, "render$1$2"); script$1$3.render = render$1$2; @@ -5583,7 +2993,6 @@ var script$5 = { this.messages = []; }, "onRemoveAllGroups"), onEnter: /* @__PURE__ */ __name(function onEnter() { - this.$refs.container.setAttribute(this.attributeSelector, ""); if (this.autoZIndex) { ZIndex.set("modal", this.$refs.container, this.baseZIndex || this.$primevue.config.zIndex.modal); } @@ -5609,7 +3018,7 @@ var script$5 = { for (var styleProp in this.breakpoints[breakpoint]) { breakpointStyle += styleProp + ":" + this.breakpoints[breakpoint][styleProp] + "!important;"; } - innerHTML += "\n @media screen and (max-width: ".concat(breakpoint, ") {\n .p-toast[").concat(this.attributeSelector, "] {\n ").concat(breakpointStyle, "\n }\n }\n "); + innerHTML += "\n @media screen and (max-width: ".concat(breakpoint, ") {\n .p-toast[").concat(this.$attrSelector, "] {\n ").concat(breakpointStyle, "\n }\n }\n "); } this.styleElement.innerHTML = innerHTML; } @@ -5621,14 +3030,9 @@ var script$5 = { } }, "destroyStyle") }, - computed: { - attributeSelector: /* @__PURE__ */ __name(function attributeSelector() { - return UniqueComponentId(); - }, "attributeSelector") - }, components: { ToastMessage: script$1$3, - Portal: script$k + Portal: script$l } }; function _typeof$2(o) { @@ -5683,7 +3087,7 @@ function _toPrimitive$2(t, r) { return ("string" === r ? String : Number)(t); } __name(_toPrimitive$2, "_toPrimitive$2"); -function render$a(_ctx, _cache, $props, $setup, $data, $options) { +function render$4(_ctx, _cache, $props, $setup, $data, $options) { var _component_ToastMessage = resolveComponent("ToastMessage"); var _component_Portal = resolveComponent("Portal"); return openBlock(), createBlock(_component_Portal, null, { @@ -5726,171 +3130,11 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) { _: 1 }); } -__name(render$a, "render$a"); -script$5.render = render$a; -const _sfc_main$7 = /* @__PURE__ */ defineComponent({ - __name: "GlobalToast", - setup(__props) { - const toast = useToast(); - const toastStore = useToastStore(); - const settingStore = useSettingStore(); - watch( - () => toastStore.messagesToAdd, - (newMessages) => { - if (newMessages.length === 0) { - return; - } - newMessages.forEach((message2) => { - toast.add(message2); - }); - toastStore.messagesToAdd = []; - }, - { deep: true } - ); - watch( - () => toastStore.messagesToRemove, - (messagesToRemove) => { - if (messagesToRemove.length === 0) { - return; - } - messagesToRemove.forEach((message2) => { - toast.remove(message2); - }); - toastStore.messagesToRemove = []; - }, - { deep: true } - ); - watch( - () => toastStore.removeAllRequested, - (requested) => { - if (requested) { - toast.removeAllGroups(); - toastStore.removeAllRequested = false; - } - } - ); - function updateToastPosition() { - const styleElement = document.getElementById("dynamic-toast-style") || createStyleElement(); - const rect = document.querySelector(".graph-canvas-container").getBoundingClientRect(); - styleElement.textContent = ` - .p-toast.p-component.p-toast-top-right { - top: ${rect.top + 20}px !important; - right: ${window.innerWidth - (rect.left + rect.width) + 20}px !important; - } - `; - } - __name(updateToastPosition, "updateToastPosition"); - function createStyleElement() { - const style = document.createElement("style"); - style.id = "dynamic-toast-style"; - document.head.appendChild(style); - return style; - } - __name(createStyleElement, "createStyleElement"); - watch( - () => settingStore.get("Comfy.UseNewMenu"), - () => nextTick(updateToastPosition), - { immediate: true } - ); - watch( - () => settingStore.get("Comfy.Sidebar.Location"), - () => nextTick(updateToastPosition), - { immediate: true } - ); - return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$5)); - }; - } -}); -const _hoisted_1$c = { - viewBox: "0 0 24 24", - width: "1.2em", - height: "1.2em" -}; -const _hoisted_2$9 = /* @__PURE__ */ createBaseVNode("path", { - fill: "none", - stroke: "currentColor", - "stroke-linecap": "round", - "stroke-linejoin": "round", - "stroke-width": "2", - d: "M6 4v16m4-16l10 8l-10 8z" -}, null, -1); -const _hoisted_3$9 = [ - _hoisted_2$9 -]; -function render$9(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$c, [..._hoisted_3$9]); -} -__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$8 = /* @__PURE__ */ createBaseVNode("path", { - fill: "none", - stroke: "currentColor", - "stroke-linecap": "round", - "stroke-linejoin": "round", - "stroke-width": "2", - d: "m13 19l9-7l-9-7zM2 19l9-7l-9-7z" -}, null, -1); -const _hoisted_3$8 = [ - _hoisted_2$8 -]; -function render$8(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$b, [..._hoisted_3$8]); -} -__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$7 = /* @__PURE__ */ createBaseVNode("path", { - fill: "none", - stroke: "currentColor", - "stroke-linecap": "round", - "stroke-linejoin": "round", - "stroke-width": "2", - d: "m6 3l14 9l-14 9z" -}, null, -1); -const _hoisted_3$7 = [ - _hoisted_2$7 -]; -function render$7(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$a, [..._hoisted_3$7]); -} -__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$6 = /* @__PURE__ */ createBaseVNode("g", { - fill: "none", - stroke: "currentColor", - "stroke-linecap": "round", - "stroke-linejoin": "round", - "stroke-width": "2" -}, [ - /* @__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$6 = [ - _hoisted_2$6 -]; -function render$6(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$9, [..._hoisted_3$6]); -} -__name(render$6, "render$6"); -const __unplugin_components_0$1 = markRaw({ name: "lucide-list-start", render: render$6 }); +__name(render$4, "render$4"); +script$5.render = render$4; 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"); + 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-submenu-icon:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\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-block-start: 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.p-tieredmenu-mobile .p-tieredmenu-submenu {\n position: static;\n box-shadow: none;\n border: 0 none;\n padding-inline-start: ").concat(dt("tieredmenu.submenu.mobile.indent"), ";\n padding-inline-end: 0;\n}\n\n.p-tieredmenu-mobile .p-tieredmenu-submenu:dir(rtl) {\n padding-inline-start: 0;\n padding-inline-end: ").concat(dt("tieredmenu.submenu.mobile.indent"), ";\n}\n\n.p-tieredmenu-mobile .p-tieredmenu-submenu-icon {\n transition: transform 0.2s;\n transform: rotate(90deg);\n}\n\n.p-tieredmenu-mobile .p-tieredmenu-item-active > .p-tieredmenu-item-content .p-tieredmenu-submenu-icon {\n transform: rotate(-90deg);\n}\n"); }, "theme"); var inlineStyles$1 = { submenu: /* @__PURE__ */ __name(function submenu(_ref2) { @@ -5902,10 +3146,10 @@ var inlineStyles$1 = { }; var classes$2 = { root: /* @__PURE__ */ __name(function root8(_ref3) { - _ref3.instance; - var props = _ref3.props; + var props = _ref3.props, instance = _ref3.instance; return ["p-tieredmenu p-component", { - "p-tieredmenu-overlay": props.popup + "p-tieredmenu-overlay": props.popup, + "p-tieredmenu-mobile": instance.queryMatches }]; }, "root"), start: "p-tieredmenu-start", @@ -5935,7 +3179,7 @@ var TieredMenuStyle = BaseStyle.extend({ }); var script$2$1 = { name: "BaseTieredMenu", - "extends": script$e, + "extends": script$f, props: { popup: { type: Boolean, @@ -5949,6 +3193,10 @@ var script$2$1 = { type: [String, Object], "default": "body" }, + breakpoint: { + type: String, + "default": "960px" + }, autoZIndex: { type: Boolean, "default": true @@ -5975,7 +3223,7 @@ var script$2$1 = { } }, style: TieredMenuStyle, - provide: /* @__PURE__ */ __name(function provide10() { + provide: /* @__PURE__ */ __name(function provide9() { return { $pcTieredMenu: this, $parentInstance: this @@ -5985,7 +3233,7 @@ var script$2$1 = { var script$1$2 = { name: "TieredMenuSub", hostName: "TieredMenu", - "extends": script$e, + "extends": script$f, emits: ["item-click", "item-mouseenter", "item-mousemove"], container: null, props: { @@ -6108,8 +3356,7 @@ var script$1$2 = { return { action: mergeProps({ "class": this.cx("itemLink"), - tabindex: -1, - "aria-hidden": true + tabindex: -1 }, this.getPTOptions(processedItem, index, "itemLink")), icon: mergeProps({ "class": [this.cx("itemIcon"), this.getItemProp(processedItem, "icon")] @@ -6127,16 +3374,16 @@ var script$1$2 = { }, "containerRef") }, components: { - AngleRightIcon: script$z + AngleRightIcon: script$u }, directives: { ripple: Ripple } }; -var _hoisted_1$1$2 = ["tabindex"]; -var _hoisted_2$5 = ["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$2 = ["href", "target"]; +var _hoisted_1$1$1 = ["tabindex"]; +var _hoisted_2$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_3$1 = ["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) { @@ -6148,12 +3395,11 @@ function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { onEnter: $options.onEnter }, _ctx.ptm("menu.transition")), { "default": withCtx(function() { - return [($props.level === 0 ? true : $props.visible) ? (openBlock(), createElementBlock("ul", mergeProps({ + return [($props.level === 0 ? true : $props.visible) ? (openBlock(), createElementBlock("ul", { key: 0, ref: $options.containerRef, - "class": $props.level === 0 ? _ctx.cx("rootList") : _ctx.cx("submenu"), tabindex: $props.tabindex - }, $props.level === 0 ? _ctx.ptm("rootList") : _ctx.ptm("submenu")), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.items, function(processedItem, index) { + }, [(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({ @@ -6218,18 +3464,19 @@ 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$2)), [[_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$5), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_TieredMenuSub, { + }, null, 8, ["item", "hasSubmenu", "label", "props"]))], 16, _hoisted_3$1), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_TieredMenuSub, mergeProps({ key: 0, id: $options.getItemId(processedItem) + "_list", - style: normalizeStyle(_ctx.sx("submenu", true, { + "class": _ctx.cx("submenu"), + style: _ctx.sx("submenu", true, { processedItem - })), + }), "aria-labelledby": $options.getItemLabelId(processedItem), role: "menu", menuId: $props.menuId, @@ -6249,8 +3496,9 @@ 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$5)) : createCommentVNode("", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ + }), + ref_for: true + }, _ctx.ptm("submenu")), null, 16, ["id", "class", "style", "aria-labelledby", "menuId", "focusedItemId", "items", "templates", "activeItemPath", "level", "visible", "pt", "unstyled"])) : createCommentVNode("", true)], 16, _hoisted_2$1)) : createCommentVNode("", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ key: 1, id: $options.getItemId(processedItem), style: $options.getItemProp(processedItem, "style"), @@ -6258,7 +3506,7 @@ 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$2)) : createCommentVNode("", true)]; + }), 128))], 8, _hoisted_1$1$1)) : createCommentVNode("", true)]; }), _: 1 }, 16, ["onEnter"]); @@ -6271,6 +3519,7 @@ var script$4 = { inheritAttrs: false, emits: ["focus", "blur", "before-show", "before-hide", "hide", "show"], outsideClickListener: null, + matchMediaListener: null, scrollHandler: null, resizeListener: null, target: null, @@ -6290,7 +3539,9 @@ var script$4 = { activeItemPath: [], visible: !this.popup, submenuVisible: false, - dirty: false + dirty: false, + query: null, + queryMatches: false }; }, "data"), watch: { @@ -6311,10 +3562,12 @@ var script$4 = { }, mounted: /* @__PURE__ */ __name(function mounted6() { this.id = this.id || UniqueComponentId(); + this.bindMatchMediaListener(); }, "mounted"), beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount6() { this.unbindOutsideClickListener(); this.unbindResizeListener(); + this.unbindMatchMediaListener(); if (this.scrollHandler) { this.scrollHandler.destroy(); this.scrollHandler = null; @@ -6449,7 +3702,7 @@ var script$4 = { break; } }, "onKeyDown"), - onItemChange: /* @__PURE__ */ __name(function onItemChange(event) { + onItemChange: /* @__PURE__ */ __name(function onItemChange(event, type) { 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; @@ -6466,9 +3719,12 @@ var script$4 = { level, parentKey }; - this.activeItemPath = activeItemPath3; grouped && (this.dirty = true); isFocus && focus(this.menubar); + if (type === "hover" && this.queryMatches) { + return; + } + this.activeItemPath = activeItemPath3; }, "onItemChange"), onOverlayClick: /* @__PURE__ */ __name(function onOverlayClick2(event) { OverlayEventBus.emit("overlay-click", { @@ -6508,7 +3764,7 @@ var script$4 = { }, "onItemClick"), onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter2(event) { if (this.dirty) { - this.onItemChange(event); + this.onItemChange(event, "hover"); } }, "onItemMouseEnter"), onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove2(event) { @@ -6713,6 +3969,24 @@ var script$4 = { this.resizeListener = null; } }, "unbindResizeListener"), + bindMatchMediaListener: /* @__PURE__ */ __name(function bindMatchMediaListener() { + var _this5 = this; + if (!this.matchMediaListener) { + var query = matchMedia("(max-width: ".concat(this.breakpoint, ")")); + this.query = query; + this.queryMatches = query.matches; + this.matchMediaListener = function() { + _this5.queryMatches = query.matches; + }; + 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())); @@ -6729,35 +4003,35 @@ var script$4 = { }); }, "isSelected"), findFirstItemIndex: /* @__PURE__ */ __name(function findFirstItemIndex() { - var _this5 = this; + var _this6 = this; return this.visibleItems.findIndex(function(processedItem) { - return _this5.isValidItem(processedItem); + return _this6.isValidItem(processedItem); }); }, "findFirstItemIndex"), findLastItemIndex: /* @__PURE__ */ __name(function findLastItemIndex() { - var _this6 = this; + var _this7 = this; return findLastIndex(this.visibleItems, function(processedItem) { - return _this6.isValidItem(processedItem); + return _this7.isValidItem(processedItem); }); }, "findLastItemIndex"), findNextItemIndex: /* @__PURE__ */ __name(function findNextItemIndex(index) { - var _this7 = this; + var _this8 = this; var matchedItemIndex = index < this.visibleItems.length - 1 ? this.visibleItems.slice(index + 1).findIndex(function(processedItem) { - return _this7.isValidItem(processedItem); + return _this8.isValidItem(processedItem); }) : -1; return matchedItemIndex > -1 ? matchedItemIndex + index + 1 : index; }, "findNextItemIndex"), findPrevItemIndex: /* @__PURE__ */ __name(function findPrevItemIndex(index) { - var _this8 = this; + var _this9 = this; var matchedItemIndex = index > 0 ? findLastIndex(this.visibleItems.slice(0, index), function(processedItem) { - return _this8.isValidItem(processedItem); + return _this9.isValidItem(processedItem); }) : -1; return matchedItemIndex > -1 ? matchedItemIndex : index; }, "findPrevItemIndex"), findSelectedItemIndex: /* @__PURE__ */ __name(function findSelectedItemIndex() { - var _this9 = this; + var _this10 = this; return this.visibleItems.findIndex(function(processedItem) { - return _this9.isValidSelectedItem(processedItem); + return _this10.isValidSelectedItem(processedItem); }); }, "findSelectedItemIndex"), findFirstFocusedItemIndex: /* @__PURE__ */ __name(function findFirstFocusedItemIndex() { @@ -6769,20 +4043,20 @@ var script$4 = { return selectedIndex < 0 ? this.findLastItemIndex() : selectedIndex; }, "findLastFocusedItemIndex"), searchItems: /* @__PURE__ */ __name(function searchItems(event, _char) { - var _this10 = this; + var _this11 = 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 _this10.isItemMatched(processedItem); + return _this11.isItemMatched(processedItem); }); itemIndex = itemIndex === -1 ? this.visibleItems.slice(0, this.focusedItemInfo.index).findIndex(function(processedItem) { - return _this10.isItemMatched(processedItem); + return _this11.isItemMatched(processedItem); }) : itemIndex + this.focusedItemInfo.index; } else { itemIndex = this.visibleItems.findIndex(function(processedItem) { - return _this10.isItemMatched(processedItem); + return _this11.isItemMatched(processedItem); }); } if (itemIndex !== -1) { @@ -6798,8 +4072,8 @@ var script$4 = { clearTimeout(this.searchTimeout); } this.searchTimeout = setTimeout(function() { - _this10.searchValue = ""; - _this10.searchTimeout = null; + _this11.searchValue = ""; + _this11.searchTimeout = null; }, 500); return matched; }, "searchItems"), @@ -6821,7 +4095,7 @@ var script$4 = { } }, "scrollInView"), createProcessedItems: /* @__PURE__ */ __name(function createProcessedItems(items) { - var _this11 = this; + var _this12 = 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] : ""; @@ -6836,7 +4110,7 @@ var script$4 = { parent, parentKey }; - newItem["items"] = _this11.createProcessedItems(item3.items, level + 1, newItem, key); + newItem["items"] = _this12.createProcessedItems(item3.items, level + 1, newItem, key); processedItems3.push(newItem); }); return processedItems3; @@ -6853,9 +4127,9 @@ var script$4 = { return this.createProcessedItems(this.model || []); }, "processedItems"), visibleItems: /* @__PURE__ */ __name(function visibleItems() { - var _this12 = this; + var _this13 = this; var processedItem = this.activeItemPath.find(function(p) { - return p.key === _this12.focusedItemInfo.parentKey; + return p.key === _this13.focusedItemInfo.parentKey; }); return processedItem ? processedItem.items : this.processedItems; }, "visibleItems"), @@ -6865,11 +4139,11 @@ var script$4 = { }, components: { TieredMenuSub: script$1$2, - Portal: script$k + Portal: script$l } }; -var _hoisted_1$8 = ["id"]; -function render$5(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$3 = ["id"]; +function render$3(_ctx, _cache, $props, $setup, $data, $options) { var _component_TieredMenuSub = resolveComponent("TieredMenuSub"); var _component_Portal = resolveComponent("Portal"); return openBlock(), createBlock(_component_Portal, { @@ -6896,9 +4170,10 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) { }, _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), createVNode(_component_TieredMenuSub, { + }, _ctx.ptm("start")), [renderSlot(_ctx.$slots, "start")], 16)) : createCommentVNode("", true), createVNode(_component_TieredMenuSub, mergeProps({ ref: $options.menubarRef, id: $data.id + "_list", + "class": _ctx.cx("rootList"), tabindex: !_ctx.disabled ? _ctx.tabindex : -1, role: "menubar", "aria-label": _ctx.ariaLabel, @@ -6921,10 +4196,10 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) { onItemClick: $options.onItemClick, onItemMouseenter: $options.onItemMouseEnter, onItemMousemove: $options.onItemMouseMove - }, 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({ + }, _ctx.ptm("rootList")), null, 16, ["id", "class", "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$8)) : createCommentVNode("", true)]; + }, _ctx.ptm("end")), [renderSlot(_ctx.$slots, "end")], 16)) : createCommentVNode("", true)], 16, _hoisted_1$3)) : createCommentVNode("", true)]; }), _: 3 }, 16, ["onEnter", "onAfterEnter", "onLeave", "onAfterLeave"])]; @@ -6932,11 +4207,11 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) { _: 3 }, 8, ["appendTo", "disabled"]); } -__name(render$5, "render$5"); -script$4.render = render$5; +__name(render$3, "render$3"); +script$4.render = render$3; 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"); + 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-start-end-radius: 0;\n border-end-end-radius: 0;\n border-inline-end: 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-inline-end: 0 none;\n}\n\n.p-splitbutton-dropdown {\n border-start-start-radius: 0;\n border-end-start-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-start-end-radius: ").concat(dt("splitbutton.rounded.border.radius"), ";\n border-end-end-radius: ").concat(dt("splitbutton.rounded.border.radius"), ";\n}\n\n.p-splitbutton-rounded .p-splitbutton-button {\n border-start-start-radius: ").concat(dt("splitbutton.rounded.border.radius"), ";\n border-end-start-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$1 = { root: /* @__PURE__ */ __name(function root9(_ref2) { @@ -6957,7 +4232,7 @@ var SplitButtonStyle = BaseStyle.extend({ }); var script$1$1 = { name: "BaseSplitButton", - "extends": script$e, + "extends": script$f, props: { label: { type: String, @@ -7045,7 +4320,7 @@ var script$1$1 = { } }, style: SplitButtonStyle, - provide: /* @__PURE__ */ __name(function provide11() { + provide: /* @__PURE__ */ __name(function provide10() { return { $pcSplitButton: this, $parentInstance: this @@ -7108,18 +4383,18 @@ var script$3 = { containerClass: /* @__PURE__ */ __name(function containerClass() { return [this.cx("root"), this["class"]]; }, "containerClass"), - hasFluid: /* @__PURE__ */ __name(function hasFluid2() { + hasFluid: /* @__PURE__ */ __name(function hasFluid() { return isEmpty(this.fluid) ? !!this.$pcFluid : this.fluid; }, "hasFluid") }, components: { - PVSButton: script$d, + PVSButton: script$v, PVSMenu: script$4, - ChevronDownIcon: script$l + ChevronDownIcon: script$m } }; -var _hoisted_1$7 = ["data-p-severity"]; -function render$4(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$2 = ["data-p-severity"]; +function render$2(_ctx, _cache, $props, $setup, $data, $options) { var _component_PVSButton = resolveComponent("PVSButton"); var _component_PVSMenu = resolveComponent("PVSMenu"); return openBlock(), createElementBlock("div", mergeProps({ @@ -7224,442 +4499,13 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) { })]; }), key: "1" - } : void 0]), 1032, ["id", "model", "autoZIndex", "baseZIndex", "appendTo", "unstyled", "pt"])], 16, _hoisted_1$7); -} -__name(render$4, "render$4"); -script$3.render = render$4; -const _withScopeId$3 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-26957f1f"), n = n(), popScopeId(), n), "_withScopeId$3"); -const _hoisted_1$6 = ["aria-label"]; -const minQueueCount = 1; -const _sfc_main$6 = /* @__PURE__ */ defineComponent({ - __name: "BatchCountEdit", - props: { - class: { default: "" } - }, - setup(__props) { - const props = __props; - const queueSettingsStore = useQueueSettingsStore(); - const { batchCount } = storeToRefs(queueSettingsStore); - const settingStore = useSettingStore(); - const maxQueueCount = computed( - () => settingStore.get("Comfy.QueueButton.BatchCountLimit") - ); - const handleClick = /* @__PURE__ */ __name((increment) => { - let newCount; - if (increment) { - const originalCount = batchCount.value - 1; - newCount = Math.min(originalCount * 2, maxQueueCount.value); - } else { - const originalCount = batchCount.value + 1; - newCount = Math.floor(originalCount / 2); - } - batchCount.value = newCount; - }, "handleClick"); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return withDirectives((openBlock(), createElementBlock("div", { - class: normalizeClass(["batch-count", props.class]), - "aria-label": _ctx.$t("menu.batchCount") - }, [ - createVNode(unref(script$A), { - class: "w-14", - modelValue: unref(batchCount), - "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(batchCount) ? batchCount.value = $event : null), - min: minQueueCount, - max: maxQueueCount.value, - fluid: "", - showButtons: "", - pt: { - incrementButton: { - class: "w-6", - onmousedown: /* @__PURE__ */ __name(() => { - handleClick(true); - }, "onmousedown") - }, - decrementButton: { - class: "w-6", - onmousedown: /* @__PURE__ */ __name(() => { - handleClick(false); - }, "onmousedown") - } - } - }, null, 8, ["modelValue", "max", "pt"]) - ], 10, _hoisted_1$6)), [ - [ - _directive_tooltip, - _ctx.$t("menu.batchCount"), - void 0, - { bottom: true } - ] - ]); - }; - } -}); -const BatchCountEdit = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-26957f1f"]]); -const _withScopeId$2 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-e9044686"), n = n(), popScopeId(), n), "_withScopeId$2"); -const _hoisted_1$5 = { class: "queue-button-group flex" }; -const _sfc_main$5 = /* @__PURE__ */ defineComponent({ - __name: "ComfyQueueButton", - setup(__props) { - const workspaceStore = useWorkspaceStore(); - const queueCountStore = storeToRefs(useQueuePendingTaskCountStore()); - const { mode: queueMode } = storeToRefs(useQueueSettingsStore()); - const { t } = useI18n(); - const queueModeMenuItemLookup = computed(() => ({ - disabled: { - key: "disabled", - label: t("menu.queue"), - tooltip: t("menu.disabledTooltip"), - command: /* @__PURE__ */ __name(() => { - queueMode.value = "disabled"; - }, "command") - }, - instant: { - key: "instant", - label: `${t("menu.queue")} (${t("menu.instant")})`, - tooltip: t("menu.instantTooltip"), - command: /* @__PURE__ */ __name(() => { - queueMode.value = "instant"; - }, "command") - }, - change: { - key: "change", - label: `${t("menu.queue")} (${t("menu.onChange")})`, - tooltip: t("menu.onChangeTooltip"), - command: /* @__PURE__ */ __name(() => { - queueMode.value = "change"; - }, "command") - } - })); - const activeQueueModeMenuItem = computed( - () => queueModeMenuItemLookup.value[queueMode.value] - ); - const queueModeMenuItems = computed( - () => Object.values(queueModeMenuItemLookup.value) - ); - const executingPrompt = computed(() => !!queueCountStore.count.value); - const hasPendingTasks = computed(() => queueCountStore.count.value > 1); - const commandStore = useCommandStore(); - const queuePrompt = /* @__PURE__ */ __name((e) => { - const commandId = e.shiftKey ? "Comfy.QueuePromptFront" : "Comfy.QueuePrompt"; - commandStore.execute(commandId); - }, "queuePrompt"); - return (_ctx, _cache) => { - const _component_i_lucide58list_start = __unplugin_components_0$1; - const _component_i_lucide58play = __unplugin_components_1$1; - 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$5, [ - withDirectives((openBlock(), createBlock(unref(script$3), { - class: "comfyui-queue-button", - label: activeQueueModeMenuItem.value.label, - severity: "primary", - size: "small", - onClick: queuePrompt, - model: queueModeMenuItems.value, - "data-testid": "queue-button" - }, { - icon: withCtx(() => [ - 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$d), { - label: item3.label, - icon: item3.icon, - severity: item3.key === unref(queueMode) ? "primary" : "secondary", - size: "small", - text: "" - }, null, 8, ["label", "icon", "severity"]), [ - [_directive_tooltip, item3.tooltip] - ]) - ]), - _: 1 - }, 8, ["label", "model"])), [ - [ - _directive_tooltip, - unref(workspaceStore).shiftDown ? _ctx.$t("menu.queueWorkflowFront") : _ctx.$t("menu.queueWorkflow"), - void 0, - { bottom: true } - ] - ]), - createVNode(BatchCountEdit), - createVNode(unref(script$8), { class: "execution-actions flex flex-nowrap" }, { - default: withCtx(() => [ - withDirectives(createVNode(unref(script$d), { - icon: "pi pi-times", - severity: executingPrompt.value ? "danger" : "secondary", - disabled: !executingPrompt.value, - text: "", - "aria-label": _ctx.$t("menu.interrupt"), - onClick: _cache[0] || (_cache[0] = () => unref(commandStore).execute("Comfy.Interrupt")) - }, null, 8, ["severity", "disabled", "aria-label"]), [ - [ - _directive_tooltip, - _ctx.$t("menu.interrupt"), - void 0, - { bottom: true } - ] - ]), - withDirectives(createVNode(unref(script$d), { - icon: "pi pi-stop", - severity: hasPendingTasks.value ? "danger" : "secondary", - disabled: !hasPendingTasks.value, - text: "", - "aria-label": _ctx.$t("sideToolbar.queueTab.clearPendingTasks"), - onClick: _cache[1] || (_cache[1] = () => unref(commandStore).execute("Comfy.ClearPendingTasks")) - }, null, 8, ["severity", "disabled", "aria-label"]), [ - [ - _directive_tooltip, - _ctx.$t("sideToolbar.queueTab.clearPendingTasks"), - void 0, - { bottom: true } - ] - ]) - ]), - _: 1 - }) - ]); - }; - } -}); -const ComfyQueueButton = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-e9044686"]]); -const overlapThreshold = 20; -const _sfc_main$4 = /* @__PURE__ */ defineComponent({ - __name: "ComfyActionbar", - setup(__props) { - const settingsStore = useSettingStore(); - const visible = computed( - () => settingsStore.get("Comfy.UseNewMenu") !== "Disabled" - ); - const panelRef = ref(null); - const dragHandleRef = ref(null); - const isDocked = useLocalStorage("Comfy.MenuPosition.Docked", false); - const storedPosition = useLocalStorage("Comfy.MenuPosition.Floating", { - x: 0, - y: 0 - }); - const { - x, - y, - style, - isDragging - } = useDraggable(panelRef, { - initialValue: { x: 0, y: 0 }, - handle: dragHandleRef, - containerElement: document.body - }); - watchDebounced( - [x, y], - ([newX, newY]) => { - storedPosition.value = { x: newX, y: newY }; - }, - { debounce: 300 } - ); - const setInitialPosition = /* @__PURE__ */ __name(() => { - if (x.value !== 0 || y.value !== 0) { - return; - } - if (storedPosition.value.x !== 0 || storedPosition.value.y !== 0) { - x.value = storedPosition.value.x; - y.value = storedPosition.value.y; - captureLastDragState(); - return; - } - if (panelRef.value) { - const screenWidth = window.innerWidth; - const screenHeight = window.innerHeight; - const menuWidth = panelRef.value.offsetWidth; - const menuHeight = panelRef.value.offsetHeight; - if (menuWidth === 0 || menuHeight === 0) { - return; - } - x.value = (screenWidth - menuWidth) / 2; - y.value = screenHeight - menuHeight - 10; - captureLastDragState(); - } - }, "setInitialPosition"); - onMounted(setInitialPosition); - watch(visible, (newVisible) => { - if (newVisible) { - nextTick(setInitialPosition); - } - }); - const lastDragState = ref({ - x: x.value, - y: y.value, - windowWidth: window.innerWidth, - windowHeight: window.innerHeight - }); - const captureLastDragState = /* @__PURE__ */ __name(() => { - lastDragState.value = { - x: x.value, - y: y.value, - windowWidth: window.innerWidth, - windowHeight: window.innerHeight - }; - }, "captureLastDragState"); - watch( - isDragging, - (newIsDragging) => { - if (!newIsDragging) { - captureLastDragState(); - } - }, - { immediate: true } - ); - const adjustMenuPosition = /* @__PURE__ */ __name(() => { - if (panelRef.value) { - const screenWidth = window.innerWidth; - const screenHeight = window.innerHeight; - const menuWidth = panelRef.value.offsetWidth; - const menuHeight = panelRef.value.offsetHeight; - const distanceLeft = lastDragState.value.x; - const distanceRight = lastDragState.value.windowWidth - (lastDragState.value.x + menuWidth); - const distanceTop = lastDragState.value.y; - const distanceBottom = lastDragState.value.windowHeight - (lastDragState.value.y + menuHeight); - const distances = [ - { edge: "left", distance: distanceLeft }, - { edge: "right", distance: distanceRight }, - { edge: "top", distance: distanceTop }, - { edge: "bottom", distance: distanceBottom } - ]; - const closestEdge = distances.reduce( - (min, curr) => curr.distance < min.distance ? curr : min - ); - const verticalRatio = lastDragState.value.y / lastDragState.value.windowHeight; - const horizontalRatio = lastDragState.value.x / lastDragState.value.windowWidth; - if (closestEdge.edge === "left") { - x.value = closestEdge.distance; - y.value = verticalRatio * screenHeight; - } else if (closestEdge.edge === "right") { - x.value = screenWidth - menuWidth - closestEdge.distance; - y.value = verticalRatio * screenHeight; - } else if (closestEdge.edge === "top") { - x.value = horizontalRatio * screenWidth; - y.value = closestEdge.distance; - } else { - x.value = horizontalRatio * screenWidth; - y.value = screenHeight - menuHeight - closestEdge.distance; - } - x.value = lodashExports.clamp(x.value, 0, screenWidth - menuWidth); - y.value = lodashExports.clamp(y.value, 0, screenHeight - menuHeight); - } - }, "adjustMenuPosition"); - useEventListener(window, "resize", adjustMenuPosition); - const topMenuRef = inject("topMenuRef"); - const topMenuBounds = useElementBounding(topMenuRef); - const isOverlappingWithTopMenu = computed(() => { - if (!panelRef.value) { - return false; - } - const { height } = panelRef.value.getBoundingClientRect(); - const actionbarBottom = y.value + height; - const topMenuBottom = topMenuBounds.bottom.value; - const overlapPixels = Math.min(actionbarBottom, topMenuBottom) - Math.max(y.value, topMenuBounds.top.value); - return overlapPixels > overlapThreshold; - }); - watch(isDragging, (newIsDragging) => { - if (!newIsDragging) { - isDocked.value = isOverlappingWithTopMenu.value; - } else { - isDocked.value = false; - } - }); - const eventBus = useEventBus("topMenu"); - watch([isDragging, isOverlappingWithTopMenu], ([dragging, overlapping]) => { - eventBus.emit("updateHighlight", { - isDragging: dragging, - isOverlapping: overlapping - }); - }); - return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$B), { - class: normalizeClass(["actionbar w-fit", { "is-dragging": unref(isDragging), "is-docked": unref(isDocked) }]), - style: normalizeStyle(unref(style)) - }, { - default: withCtx(() => [ - createBaseVNode("div", { - class: "actionbar-content flex items-center", - ref_key: "panelRef", - ref: panelRef - }, [ - createBaseVNode("span", { - class: "drag-handle cursor-move mr-2 p-0!", - ref_key: "dragHandleRef", - ref: dragHandleRef - }, null, 512), - createVNode(ComfyQueueButton) - ], 512) - ]), - _: 1 - }, 8, ["style", "class"]); - }; - } -}); -const Actionbar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-915e5456"]]); -const _hoisted_1$4 = { - viewBox: "0 0 24 24", - width: "1.2em", - height: "1.2em" -}; -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-5v3h14v-3zm0-2h14V5H5zm0 2v3z" -}, null, -1); -const _hoisted_3$4 = [ - _hoisted_2$4 -]; -function render$3(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$4, [..._hoisted_3$4]); -} -__name(render$3, "render$3"); -const __unplugin_components_1 = markRaw({ name: "material-symbols-dock-to-bottom-outline", render: render$3 }); -const _hoisted_1$3 = { - viewBox: "0 0 24 24", - width: "1.2em", - height: "1.2em" -}; -const _hoisted_2$3 = /* @__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$3 = [ - _hoisted_2$3 -]; -function render$2(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$3, [..._hoisted_3$3]); + } : void 0]), 1032, ["id", "model", "autoZIndex", "baseZIndex", "appendTo", "unstyled", "pt"])], 16, _hoisted_1$2); } __name(render$2, "render$2"); -const __unplugin_components_0 = markRaw({ name: "material-symbols-dock-to-bottom", render: render$2 }); -const _sfc_main$3 = /* @__PURE__ */ defineComponent({ - __name: "BottomPanelToggleButton", - setup(__props) { - const bottomPanelStore = useBottomPanelStore(); - return (_ctx, _cache) => { - 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$d), { - severity: "secondary", - text: "", - "aria-label": _ctx.$t("menu.toggleBottomPanel"), - onClick: unref(bottomPanelStore).toggleBottomPanel - }, { - icon: withCtx(() => [ - unref(bottomPanelStore).bottomPanelVisible ? (openBlock(), createBlock(_component_i_material_symbols58dock_to_bottom, { key: 0 })) : (openBlock(), createBlock(_component_i_material_symbols58dock_to_bottom_outline, { key: 1 })) - ]), - _: 1 - }, 8, ["aria-label", "onClick"])), [ - [vShow, unref(bottomPanelStore).bottomPanelTabs.length > 0], - [_directive_tooltip, { value: _ctx.$t("menu.toggleBottomPanel"), showDelay: 300 }] - ]); - }; - } -}); +script$3.render = render$2; 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"); + 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-submenu .p-menubar-submenu-icon:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\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.submenu.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-block-start: 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-end:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\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 flex-direction: column;\n top: 100%;\n left: 0;\n z-index: 1;\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 border-radius: ").concat(dt("menubar.submenu.border.radius"), ";\n gap: ").concat(dt("menubar.submenu.gap"), ";\n}\n\n.p-menubar-mobile .p-menubar-root-list:dir(rtl) {\n left: auto;\n right: 0;\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}\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-block-start: 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 > .p-menubar-item-content .p-menubar-submenu-icon:dir(rtl),\n.p-menubar-mobile .p-menubar-submenu-icon:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\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-inline-start: ").concat(dt("menubar.submenu.mobile.indent"), ";\n padding-inline-end: 0;\n}\n"); }, "theme"); var inlineStyles = { submenu: /* @__PURE__ */ __name(function submenu2(_ref2) { @@ -7705,7 +4551,7 @@ var MenubarStyle = BaseStyle.extend({ }); var script$2 = { name: "BaseMenubar", - "extends": script$e, + "extends": script$f, props: { model: { type: Array, @@ -7729,7 +4575,7 @@ var script$2 = { } }, style: MenubarStyle, - provide: /* @__PURE__ */ __name(function provide12() { + provide: /* @__PURE__ */ __name(function provide11() { return { $pcMenubar: this, $parentInstance: this @@ -7739,7 +4585,7 @@ var script$2 = { var script$1 = { name: "MenubarSub", hostName: "Menubar", - "extends": script$e, + "extends": script$f, emits: ["item-mouseenter", "item-click", "item-mousemove"], props: { items: { @@ -7855,8 +4701,7 @@ var script$1 = { return { action: mergeProps({ "class": this.cx("itemLink"), - tabindex: -1, - "aria-hidden": true + tabindex: -1 }, this.getPTOptions(processedItem, index, "itemLink")), icon: mergeProps({ "class": [this.cx("itemIcon"), this.getItemProp(processedItem, "icon")] @@ -7885,17 +4730,17 @@ var script$1 = { }, "getAriaSetSize") }, components: { - AngleRightIcon: script$z, - AngleDownIcon: script$C + AngleRightIcon: script$u, + AngleDownIcon: script$w }, 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$2 = ["onClick", "onMouseenter", "onMousemove"]; -var _hoisted_3$2 = ["href", "target"]; -var _hoisted_4$1 = ["id"]; +var _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"]; +var _hoisted_2 = ["onClick", "onMouseenter", "onMousemove"]; +var _hoisted_3 = ["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); @@ -7956,7 +4801,7 @@ function render$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_4$1), $options.getItemProp(processedItem, "items") ? (openBlock(), createElementBlock(Fragment, { + }, $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, @@ -7967,14 +4812,14 @@ function render$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_3$2)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { + }, $options.getPTOptions(processedItem, index, "submenuIcon")), null, 16, ["class"]))], 64)) : createCommentVNode("", true)], 16, _hoisted_3)), [[_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$2), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_MenubarSub, { + }, null, 8, ["item", "root", "hasSubmenu", "label", "props"]))], 16, _hoisted_2), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_MenubarSub, { key: 0, id: $options.getItemId(processedItem) + "_list", menuId: $props.menuId, @@ -8000,7 +4845,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) { 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({ + }, 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({ key: 1, id: $options.getItemId(processedItem), "class": [_ctx.cx("separator"), $options.getItemProp(processedItem, "class")], @@ -8193,7 +5038,7 @@ var script = { break; } }, "onKeyDown"), - onItemChange: /* @__PURE__ */ __name(function onItemChange2(event) { + onItemChange: /* @__PURE__ */ __name(function onItemChange2(event, type) { 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; @@ -8207,9 +5052,12 @@ var script = { level, parentKey }; - this.activeItemPath = activeItemPath3; grouped && (this.dirty = true); isFocus && focus(this.menubar); + if (type === "hover" && this.queryMatches) { + return; + } + this.activeItemPath = activeItemPath3; }, "onItemChange"), onItemClick: /* @__PURE__ */ __name(function onItemClick4(event) { var originalEvent = event.originalEvent, processedItem = event.processedItem; @@ -8244,7 +5092,7 @@ var script = { }, "onItemClick"), onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter4(event) { if (this.dirty) { - this.onItemChange(event); + this.onItemChange(event, "hover"); } }, "onItemMouseEnter"), onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove4(event) { @@ -8446,7 +5294,7 @@ var script = { this.resizeListener = null; } }, "unbindResizeListener"), - bindMatchMediaListener: /* @__PURE__ */ __name(function bindMatchMediaListener() { + bindMatchMediaListener: /* @__PURE__ */ __name(function bindMatchMediaListener2() { var _this7 = this; if (!this.matchMediaListener) { var query = matchMedia("(max-width: ".concat(this.breakpoint, ")")); @@ -8459,7 +5307,7 @@ var script = { this.query.addEventListener("change", this.matchMediaListener); } }, "bindMatchMediaListener"), - unbindMatchMediaListener: /* @__PURE__ */ __name(function unbindMatchMediaListener() { + unbindMatchMediaListener: /* @__PURE__ */ __name(function unbindMatchMediaListener2() { if (this.matchMediaListener) { this.query.removeEventListener("change", this.matchMediaListener); this.matchMediaListener = null; @@ -8617,7 +5465,7 @@ var script = { }, components: { MenubarSub: script$1, - BarsIcon: script$D + BarsIcon: script$x } }; function _typeof(o) { @@ -8672,7 +5520,7 @@ function _toPrimitive(t, r) { return ("string" === r ? String : Number)(t); } __name(_toPrimitive, "_toPrimitive"); -var _hoisted_1$2 = ["aria-haspopup", "aria-expanded", "aria-controls", "aria-label"]; +var _hoisted_1 = ["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"); @@ -8708,7 +5556,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { }) }, _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$2)) : createCommentVNode("", true)]; + })], 16, _hoisted_1)) : createCommentVNode("", true)]; }), createVNode(_component_MenubarSub, { ref: $options.menubarRef, id: $data.id + "_list", @@ -8740,1324 +5588,18 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { } __name(render, "render"); script.render = render; -const _withScopeId$1 = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-56df69d2"), n = n(), popScopeId(), n), "_withScopeId$1"); -const _hoisted_1$1 = ["href"]; -const _hoisted_2$1 = { class: "p-menubar-item-label" }; -const _hoisted_3$1 = { - key: 1, - class: "ml-auto border border-surface rounded text-muted text-xs text-nowrap p-1 keybinding-tag" -}; -const _sfc_main$2 = /* @__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$1, 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$1) - ]), - _: 1 - }, 8, ["model", "pt"]); - }; - } -}); -const CommandMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-56df69d2"]]); -const _withScopeId = /* @__PURE__ */ __name((n) => (pushScopeId("data-v-6e35440f"), n = n(), popScopeId(), n), "_withScopeId"); -const _hoisted_1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createBaseVNode("h1", { class: "comfyui-logo mx-2 app-drag" }, "ComfyUI", -1)); -const _hoisted_2 = { class: "flex-grow min-w-0 app-drag h-full" }; -const _hoisted_3 = { class: "window-actions-spacer flex-shrink-0" }; -const _hoisted_4 = { class: "fixed top-0 left-0 app-drag w-full h-[var(--comfy-topbar-height)]" }; -const _sfc_main$1 = /* @__PURE__ */ defineComponent({ - __name: "TopMenubar", - setup(__props) { - const workspaceState = useWorkspaceStore(); - const settingStore = useSettingStore(); - const workflowTabsPosition = computed( - () => settingStore.get("Comfy.Workflow.WorkflowTabsPosition") - ); - const menuSetting = computed(() => settingStore.get("Comfy.UseNewMenu")); - const betaMenuEnabled = computed(() => menuSetting.value !== "Disabled"); - const teleportTarget = computed( - () => settingStore.get("Comfy.UseNewMenu") === "Top" ? ".comfyui-body-top" : ".comfyui-body-bottom" - ); - const isNativeWindow = computed( - () => isElectron() && settingStore.get("Comfy-Desktop.WindowStyle") === "custom" - ); - const showTopMenu = computed( - () => betaMenuEnabled.value && !workspaceState.focusMode - ); - const menuRight = ref(null); - onMounted(() => { - if (menuRight.value) { - menuRight.value.appendChild(app.menu.element); - } - }); - const topMenuRef = ref(null); - provide("topMenuRef", topMenuRef); - const eventBus = useEventBus("topMenu"); - const isDropZone = ref(false); - const isDroppable = ref(false); - eventBus.on((event, payload) => { - if (event === "updateHighlight") { - isDropZone.value = payload.isDragging; - isDroppable.value = payload.isOverlapping && payload.isDragging; - } - }); - onMounted(() => { - if (isElectron()) { - electronAPI().changeTheme({ - height: topMenuRef.value.getBoundingClientRect().height - }); - } - }); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock(Fragment, null, [ - (openBlock(), createBlock(Teleport, { to: teleportTarget.value }, [ - withDirectives(createBaseVNode("div", { - ref_key: "topMenuRef", - ref: topMenuRef, - class: normalizeClass(["comfyui-menu flex items-center", { dropzone: isDropZone.value, "dropzone-active": isDroppable.value }]) - }, [ - _hoisted_1, - createVNode(CommandMenubar), - createBaseVNode("div", _hoisted_2, [ - workflowTabsPosition.value === "Topbar" ? (openBlock(), createBlock(WorkflowTabs, { key: 0 })) : createCommentVNode("", true) - ]), - createBaseVNode("div", { - class: "comfyui-menu-right", - ref_key: "menuRight", - ref: menuRight - }, null, 512), - createVNode(Actionbar), - createVNode(_sfc_main$3, { class: "flex-shrink-0" }), - withDirectives(createVNode(unref(script$d), { - class: "flex-shrink-0", - icon: "pi pi-bars", - severity: "secondary", - text: "", - "aria-label": _ctx.$t("menu.hideMenu"), - onClick: _cache[0] || (_cache[0] = ($event) => unref(workspaceState).focusMode = true), - onContextmenu: unref(showNativeMenu) - }, null, 8, ["aria-label", "onContextmenu"]), [ - [_directive_tooltip, { value: _ctx.$t("menu.hideMenu"), showDelay: 300 }] - ]), - withDirectives(createBaseVNode("div", _hoisted_3, null, 512), [ - [vShow, menuSetting.value !== "Bottom"] - ]) - ], 2), [ - [vShow, showTopMenu.value] - ]) - ], 8, ["to"])), - withDirectives(createBaseVNode("div", _hoisted_4, null, 512), [ - [vShow, isNativeWindow.value && !showTopMenu.value] - ]) - ], 64); - }; - } -}); -const TopMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-6e35440f"]]); -var LatentPreviewMethod = /* @__PURE__ */ ((LatentPreviewMethod2) => { - LatentPreviewMethod2["NoPreviews"] = "none"; - LatentPreviewMethod2["Auto"] = "auto"; - LatentPreviewMethod2["Latent2RGB"] = "latent2rgb"; - LatentPreviewMethod2["TAESD"] = "taesd"; - return LatentPreviewMethod2; -})(LatentPreviewMethod || {}); -var LogLevel = /* @__PURE__ */ ((LogLevel2) => { - LogLevel2["DEBUG"] = "DEBUG"; - LogLevel2["INFO"] = "INFO"; - LogLevel2["WARNING"] = "WARNING"; - LogLevel2["ERROR"] = "ERROR"; - LogLevel2["CRITICAL"] = "CRITICAL"; - return LogLevel2; -})(LogLevel || {}); -var HashFunction = /* @__PURE__ */ ((HashFunction2) => { - HashFunction2["MD5"] = "md5"; - HashFunction2["SHA1"] = "sha1"; - HashFunction2["SHA256"] = "sha256"; - HashFunction2["SHA512"] = "sha512"; - return HashFunction2; -})(HashFunction || {}); -var AutoLaunch = /* @__PURE__ */ ((AutoLaunch2) => { - AutoLaunch2["Auto"] = "auto"; - AutoLaunch2["Disable"] = "disable"; - AutoLaunch2["Enable"] = "enable"; - return AutoLaunch2; -})(AutoLaunch || {}); -var CudaMalloc = /* @__PURE__ */ ((CudaMalloc2) => { - CudaMalloc2["Auto"] = "auto"; - CudaMalloc2["Disable"] = "disable"; - CudaMalloc2["Enable"] = "enable"; - return CudaMalloc2; -})(CudaMalloc || {}); -var FloatingPointPrecision = /* @__PURE__ */ ((FloatingPointPrecision2) => { - FloatingPointPrecision2["AUTO"] = "auto"; - FloatingPointPrecision2["FP64"] = "fp64"; - FloatingPointPrecision2["FP32"] = "fp32"; - FloatingPointPrecision2["FP16"] = "fp16"; - FloatingPointPrecision2["BF16"] = "bf16"; - FloatingPointPrecision2["FP8E4M3FN"] = "fp8_e4m3fn"; - FloatingPointPrecision2["FP8E5M2"] = "fp8_e5m2"; - return FloatingPointPrecision2; -})(FloatingPointPrecision || {}); -var CrossAttentionMethod = /* @__PURE__ */ ((CrossAttentionMethod2) => { - CrossAttentionMethod2["Auto"] = "auto"; - CrossAttentionMethod2["Split"] = "split"; - CrossAttentionMethod2["Quad"] = "quad"; - CrossAttentionMethod2["Pytorch"] = "pytorch"; - return CrossAttentionMethod2; -})(CrossAttentionMethod || {}); -var VramManagement = /* @__PURE__ */ ((VramManagement2) => { - VramManagement2["Auto"] = "auto"; - VramManagement2["GPUOnly"] = "gpu-only"; - VramManagement2["HighVram"] = "highvram"; - VramManagement2["NormalVram"] = "normalvram"; - VramManagement2["LowVram"] = "lowvram"; - VramManagement2["NoVram"] = "novram"; - VramManagement2["CPU"] = "cpu"; - return VramManagement2; -})(VramManagement || {}); -const WEB_ONLY_CONFIG_ITEMS = [ - // Launch behavior - { - id: "auto-launch", - name: "Automatically opens in the browser on startup", - category: ["Launch"], - type: "combo", - options: Object.values(AutoLaunch), - defaultValue: AutoLaunch.Auto, - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case AutoLaunch.Auto: - return {}; - case AutoLaunch.Enable: - return { - ["auto-launch"]: true - }; - case AutoLaunch.Disable: - return { - ["disable-auto-launch"]: true - }; - } - }, "getValue") - } -]; -const SERVER_CONFIG_ITEMS = [ - // Network settings - { - id: "listen", - name: "Host: The IP address to listen on", - category: ["Network"], - type: "text", - defaultValue: "127.0.0.1" - }, - { - id: "port", - name: "Port: The port to listen on", - category: ["Network"], - type: "number", - // The default launch port for desktop app is 8000 instead of 8188. - defaultValue: 8e3 - }, - { - id: "tls-keyfile", - name: "TLS Key File: Path to TLS key file for HTTPS", - category: ["Network"], - type: "text", - defaultValue: "" - }, - { - id: "tls-certfile", - name: "TLS Certificate File: Path to TLS certificate file for HTTPS", - category: ["Network"], - type: "text", - defaultValue: "" - }, - { - id: "enable-cors-header", - name: 'Enable CORS header: Use "*" for all origins or specify domain', - category: ["Network"], - type: "text", - defaultValue: "" - }, - { - id: "max-upload-size", - name: "Maximum upload size (MB)", - category: ["Network"], - type: "number", - defaultValue: 100 - }, - // CUDA settings - { - id: "cuda-device", - name: "CUDA device index to use", - category: ["CUDA"], - type: "number", - defaultValue: null - }, - { - id: "cuda-malloc", - name: "Use CUDA malloc for memory allocation", - category: ["CUDA"], - type: "combo", - options: Object.values(CudaMalloc), - defaultValue: CudaMalloc.Auto, - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case CudaMalloc.Auto: - return {}; - case CudaMalloc.Enable: - return { - ["cuda-malloc"]: true - }; - case CudaMalloc.Disable: - return { - ["disable-cuda-malloc"]: true - }; - } - }, "getValue") - }, - // Precision settings - { - id: "global-precision", - name: "Global floating point precision", - category: ["Inference"], - type: "combo", - options: [ - FloatingPointPrecision.AUTO, - FloatingPointPrecision.FP32, - FloatingPointPrecision.FP16 - ], - defaultValue: FloatingPointPrecision.AUTO, - tooltip: "Global floating point precision", - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case FloatingPointPrecision.AUTO: - return {}; - case FloatingPointPrecision.FP32: - return { - ["force-fp32"]: true - }; - case FloatingPointPrecision.FP16: - return { - ["force-fp16"]: true - }; - default: - return {}; - } - }, "getValue") - }, - // UNET precision - { - id: "unet-precision", - name: "UNET precision", - category: ["Inference"], - type: "combo", - options: [ - FloatingPointPrecision.AUTO, - FloatingPointPrecision.FP64, - FloatingPointPrecision.FP32, - FloatingPointPrecision.FP16, - FloatingPointPrecision.BF16, - FloatingPointPrecision.FP8E4M3FN, - FloatingPointPrecision.FP8E5M2 - ], - defaultValue: FloatingPointPrecision.AUTO, - tooltip: "UNET precision", - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case FloatingPointPrecision.AUTO: - return {}; - default: - return { - [`${value.toLowerCase()}-unet`]: true - }; - } - }, "getValue") - }, - // VAE settings - { - id: "vae-precision", - name: "VAE precision", - category: ["Inference"], - type: "combo", - options: [ - FloatingPointPrecision.AUTO, - FloatingPointPrecision.FP16, - FloatingPointPrecision.FP32, - FloatingPointPrecision.BF16 - ], - defaultValue: FloatingPointPrecision.AUTO, - tooltip: "VAE precision", - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case FloatingPointPrecision.AUTO: - return {}; - default: - return { - [`${value.toLowerCase()}-vae`]: true - }; - } - }, "getValue") - }, - { - id: "cpu-vae", - name: "Run VAE on CPU", - category: ["Inference"], - type: "boolean", - defaultValue: false - }, - // Text Encoder settings - { - id: "text-encoder-precision", - name: "Text Encoder precision", - category: ["Inference"], - type: "combo", - options: [ - FloatingPointPrecision.AUTO, - FloatingPointPrecision.FP8E4M3FN, - FloatingPointPrecision.FP8E5M2, - FloatingPointPrecision.FP16, - FloatingPointPrecision.FP32 - ], - defaultValue: FloatingPointPrecision.AUTO, - tooltip: "Text Encoder precision", - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case FloatingPointPrecision.AUTO: - return {}; - default: - return { - [`${value.toLowerCase()}-text-enc`]: true - }; - } - }, "getValue") - }, - // Memory and performance settings - { - id: "force-channels-last", - name: "Force channels-last memory format", - category: ["Memory"], - type: "boolean", - defaultValue: false - }, - { - id: "directml", - name: "DirectML device index", - category: ["Memory"], - type: "number", - defaultValue: null - }, - { - id: "disable-ipex-optimize", - name: "Disable IPEX optimization", - category: ["Memory"], - type: "boolean", - defaultValue: false - }, - // Preview settings - { - id: "preview-method", - name: "Method used for latent previews", - category: ["Preview"], - type: "combo", - options: Object.values(LatentPreviewMethod), - defaultValue: LatentPreviewMethod.NoPreviews - }, - { - id: "preview-size", - name: "Size of preview images", - category: ["Preview"], - type: "slider", - defaultValue: 512, - attrs: { - min: 128, - max: 2048, - step: 128 - } - }, - // Cache settings - { - id: "cache-classic", - name: "Use classic cache system", - category: ["Cache"], - type: "boolean", - defaultValue: false - }, - { - id: "cache-lru", - name: "Use LRU caching with a maximum of N node results cached.", - category: ["Cache"], - type: "number", - defaultValue: null, - tooltip: "May use more RAM/VRAM." - }, - // Attention settings - { - id: "cross-attention-method", - name: "Cross attention method", - category: ["Attention"], - type: "combo", - options: Object.values(CrossAttentionMethod), - defaultValue: CrossAttentionMethod.Auto, - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case CrossAttentionMethod.Auto: - return {}; - default: - return { - [`use-${value.toLowerCase()}-cross-attention`]: true - }; - } - }, "getValue") - }, - { - id: "disable-xformers", - name: "Disable xFormers optimization", - type: "boolean", - defaultValue: false - }, - { - id: "force-upcast-attention", - name: "Force attention upcast", - category: ["Attention"], - type: "boolean", - defaultValue: false - }, - { - id: "dont-upcast-attention", - name: "Prevent attention upcast", - category: ["Attention"], - type: "boolean", - defaultValue: false - }, - // VRAM management - { - id: "vram-management", - name: "VRAM management mode", - category: ["Memory"], - type: "combo", - options: Object.values(VramManagement), - defaultValue: VramManagement.Auto, - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case VramManagement.Auto: - return {}; - default: - return { - [value]: true - }; - } - }, "getValue") - }, - { - id: "reserve-vram", - name: "Reserved VRAM (GB)", - category: ["Memory"], - type: "number", - defaultValue: null, - tooltip: "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." - }, - // Misc settings - { - id: "default-hashing-function", - name: "Default hashing function for model files", - type: "combo", - options: Object.values(HashFunction), - defaultValue: HashFunction.SHA256 - }, - { - id: "disable-smart-memory", - name: "Disable smart memory management", - tooltip: "Force ComfyUI to aggressively offload to regular ram instead of keeping models in vram when it can.", - category: ["Memory"], - type: "boolean", - defaultValue: false - }, - { - id: "deterministic", - name: "Make pytorch use slower deterministic algorithms when it can.", - type: "boolean", - defaultValue: false, - tooltip: "Note that this might not make images deterministic in all cases." - }, - { - id: "fast", - name: "Enable some untested and potentially quality deteriorating optimizations.", - type: "boolean", - defaultValue: false - }, - { - id: "dont-print-server", - name: "Don't print server output to console.", - type: "boolean", - defaultValue: false - }, - { - id: "disable-metadata", - name: "Disable saving prompt metadata in files.", - type: "boolean", - defaultValue: false - }, - { - id: "disable-all-custom-nodes", - name: "Disable loading all custom nodes.", - type: "boolean", - defaultValue: false - }, - { - id: "log-level", - name: "Logging verbosity level", - type: "combo", - options: Object.values(LogLevel), - defaultValue: LogLevel.INFO, - getValue: /* @__PURE__ */ __name((value) => { - return { - verbose: value - }; - }, "getValue") - }, - // Directories - { - id: "input-directory", - name: "Input directory", - category: ["Directories"], - type: "text", - defaultValue: "" - }, - { - id: "output-directory", - name: "Output directory", - category: ["Directories"], - type: "text", - defaultValue: "" - } -]; -function useCoreCommands() { - const workflowService = useWorkflowService(); - const workflowStore = useWorkflowStore(); - const dialogService = useDialogService(); - const colorPaletteStore = useColorPaletteStore(); - const getTracker = /* @__PURE__ */ __name(() => workflowStore.activeWorkflow?.changeTracker, "getTracker"); - const getSelectedNodes = /* @__PURE__ */ __name(() => { - const selectedNodes = app.canvas.selected_nodes; - const result = []; - if (selectedNodes) { - for (const i in selectedNodes) { - const node = selectedNodes[i]; - result.push(node); - } - } - return result; - }, "getSelectedNodes"); - const toggleSelectedNodesMode = /* @__PURE__ */ __name((mode) => { - getSelectedNodes().forEach((node) => { - if (node.mode === mode) { - node.mode = LGraphEventMode.ALWAYS; - } else { - node.mode = mode; - } - }); - }, "toggleSelectedNodesMode"); - return [ - { - id: "Comfy.NewBlankWorkflow", - icon: "pi pi-plus", - label: "New Blank Workflow", - menubarLabel: "New", - function: /* @__PURE__ */ __name(() => workflowService.loadBlankWorkflow(), "function") - }, - { - id: "Comfy.OpenWorkflow", - icon: "pi pi-folder-open", - label: "Open Workflow", - menubarLabel: "Open", - function: /* @__PURE__ */ __name(() => { - app.ui.loadFile(); - }, "function") - }, - { - id: "Comfy.LoadDefaultWorkflow", - icon: "pi pi-code", - label: "Load Default Workflow", - function: /* @__PURE__ */ __name(() => workflowService.loadDefaultWorkflow(), "function") - }, - { - id: "Comfy.SaveWorkflow", - icon: "pi pi-save", - label: "Save Workflow", - menubarLabel: "Save", - function: /* @__PURE__ */ __name(async () => { - const workflow = useWorkflowStore().activeWorkflow; - if (!workflow) return; - await workflowService.saveWorkflow(workflow); - }, "function") - }, - { - id: "Comfy.SaveWorkflowAs", - icon: "pi pi-save", - label: "Save Workflow As", - menubarLabel: "Save As", - function: /* @__PURE__ */ __name(async () => { - const workflow = useWorkflowStore().activeWorkflow; - if (!workflow) return; - await workflowService.saveWorkflowAs(workflow); - }, "function") - }, - { - id: "Comfy.ExportWorkflow", - icon: "pi pi-download", - label: "Export Workflow", - menubarLabel: "Export", - function: /* @__PURE__ */ __name(() => { - workflowService.exportWorkflow("workflow", "workflow"); - }, "function") - }, - { - id: "Comfy.ExportWorkflowAPI", - icon: "pi pi-download", - label: "Export Workflow (API Format)", - menubarLabel: "Export (API)", - function: /* @__PURE__ */ __name(() => { - workflowService.exportWorkflow("workflow_api", "output"); - }, "function") - }, - { - id: "Comfy.Undo", - icon: "pi pi-undo", - label: "Undo", - function: /* @__PURE__ */ __name(async () => { - await getTracker()?.undo?.(); - }, "function") - }, - { - id: "Comfy.Redo", - icon: "pi pi-refresh", - label: "Redo", - function: /* @__PURE__ */ __name(async () => { - await getTracker()?.redo?.(); - }, "function") - }, - { - id: "Comfy.ClearWorkflow", - icon: "pi pi-trash", - label: "Clear Workflow", - function: /* @__PURE__ */ __name(() => { - const settingStore = useSettingStore(); - if (!settingStore.get("Comfy.ComfirmClear") || confirm("Clear workflow?")) { - app.clean(); - app.graph.clear(); - api.dispatchCustomEvent("graphCleared"); - } - }, "function") - }, - { - id: "Comfy.Canvas.ResetView", - icon: "pi pi-expand", - label: "Reset View", - function: /* @__PURE__ */ __name(() => { - app.resetView(); - }, "function") - }, - { - id: "Comfy.OpenClipspace", - icon: "pi pi-clipboard", - label: "Clipspace", - function: /* @__PURE__ */ __name(() => { - app.openClipspace(); - }, "function") - }, - { - id: "Comfy.RefreshNodeDefinitions", - icon: "pi pi-refresh", - label: "Refresh Node Definitions", - function: /* @__PURE__ */ __name(async () => { - await app.refreshComboInNodes(); - }, "function") - }, - { - id: "Comfy.Interrupt", - icon: "pi pi-stop", - label: "Interrupt", - function: /* @__PURE__ */ __name(async () => { - await api.interrupt(); - useToastStore().add({ - severity: "info", - summary: "Interrupted", - detail: "Execution has been interrupted", - life: 1e3 - }); - }, "function") - }, - { - id: "Comfy.ClearPendingTasks", - icon: "pi pi-stop", - label: "Clear Pending Tasks", - function: /* @__PURE__ */ __name(async () => { - await useQueueStore().clear(["queue"]); - useToastStore().add({ - severity: "info", - summary: "Confirmed", - detail: "Pending tasks deleted", - life: 3e3 - }); - }, "function") - }, - { - id: "Comfy.BrowseTemplates", - icon: "pi pi-folder-open", - label: "Browse Templates", - function: /* @__PURE__ */ __name(() => { - dialogService.showTemplateWorkflowsDialog(); - }, "function") - }, - { - id: "Comfy.Canvas.ZoomIn", - icon: "pi pi-plus", - label: "Zoom In", - function: /* @__PURE__ */ __name(() => { - const ds = app.canvas.ds; - ds.changeScale( - ds.scale * 1.1, - ds.element ? [ds.element.width / 2, ds.element.height / 2] : void 0 - ); - app.canvas.setDirty(true, true); - }, "function") - }, - { - id: "Comfy.Canvas.ZoomOut", - icon: "pi pi-minus", - label: "Zoom Out", - function: /* @__PURE__ */ __name(() => { - const ds = app.canvas.ds; - ds.changeScale( - ds.scale / 1.1, - ds.element ? [ds.element.width / 2, ds.element.height / 2] : void 0 - ); - app.canvas.setDirty(true, true); - }, "function") - }, - { - id: "Comfy.Canvas.FitView", - icon: "pi pi-expand", - label: "Fit view to selected nodes", - function: /* @__PURE__ */ __name(() => { - if (app.canvas.empty) { - useToastStore().add({ - severity: "error", - summary: "Empty canvas", - life: 3e3 - }); - return; - } - app.canvas.fitViewToSelectionAnimated(); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleLock", - icon: "pi pi-lock", - label: "Canvas Toggle Lock", - function: /* @__PURE__ */ __name(() => { - app.canvas["read_only"] = !app.canvas["read_only"]; - }, "function") - }, - { - id: "Comfy.Canvas.ToggleLinkVisibility", - icon: "pi pi-eye", - label: "Canvas Toggle Link Visibility", - versionAdded: "1.3.6", - function: (() => { - const settingStore = useSettingStore(); - let lastLinksRenderMode = LiteGraph.SPLINE_LINK; - return () => { - const currentMode = settingStore.get("Comfy.LinkRenderMode"); - if (currentMode === LiteGraph.HIDDEN_LINK) { - settingStore.set("Comfy.LinkRenderMode", lastLinksRenderMode); - } else { - lastLinksRenderMode = currentMode; - settingStore.set("Comfy.LinkRenderMode", LiteGraph.HIDDEN_LINK); - } - }; - })() - }, - { - id: "Comfy.QueuePrompt", - icon: "pi pi-play", - label: "Queue Prompt", - versionAdded: "1.3.7", - function: /* @__PURE__ */ __name(() => { - const batchCount = useQueueSettingsStore().batchCount; - app.queuePrompt(0, batchCount); - }, "function") - }, - { - id: "Comfy.QueuePromptFront", - icon: "pi pi-play", - label: "Queue Prompt (Front)", - versionAdded: "1.3.7", - function: /* @__PURE__ */ __name(() => { - const batchCount = useQueueSettingsStore().batchCount; - app.queuePrompt(-1, batchCount); - }, "function") - }, - { - id: "Comfy.ShowSettingsDialog", - icon: "pi pi-cog", - label: "Show Settings Dialog", - versionAdded: "1.3.7", - function: /* @__PURE__ */ __name(() => { - dialogService.showSettingsDialog(); - }, "function") - }, - { - id: "Comfy.Graph.GroupSelectedNodes", - icon: "pi pi-sitemap", - label: "Group Selected Nodes", - versionAdded: "1.3.7", - function: /* @__PURE__ */ __name(() => { - const { canvas } = app; - if (!canvas.selectedItems?.size) { - useToastStore().add({ - severity: "error", - summary: "Nothing to group", - detail: "Please select the nodes (or other groups) to create a group for", - life: 3e3 - }); - return; - } - const group = new LGraphGroup(); - const padding = useSettingStore().get( - "Comfy.GroupSelectedNodes.Padding" - ); - group.resizeTo(canvas.selectedItems, padding); - canvas.graph.add(group); - useTitleEditorStore().titleEditorTarget = group; - }, "function") - }, - { - id: "Workspace.NextOpenedWorkflow", - icon: "pi pi-step-forward", - label: "Next Opened Workflow", - versionAdded: "1.3.9", - function: /* @__PURE__ */ __name(() => { - workflowService.loadNextOpenedWorkflow(); - }, "function") - }, - { - id: "Workspace.PreviousOpenedWorkflow", - icon: "pi pi-step-backward", - label: "Previous Opened Workflow", - versionAdded: "1.3.9", - function: /* @__PURE__ */ __name(() => { - workflowService.loadPreviousOpenedWorkflow(); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelectedNodes.Mute", - icon: "pi pi-volume-off", - label: "Mute/Unmute Selected Nodes", - versionAdded: "1.3.11", - function: /* @__PURE__ */ __name(() => { - toggleSelectedNodesMode(LGraphEventMode.NEVER); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelectedNodes.Bypass", - icon: "pi pi-shield", - label: "Bypass/Unbypass Selected Nodes", - versionAdded: "1.3.11", - function: /* @__PURE__ */ __name(() => { - toggleSelectedNodesMode(LGraphEventMode.BYPASS); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelectedNodes.Pin", - icon: "pi pi-pin", - label: "Pin/Unpin Selected Nodes", - versionAdded: "1.3.11", - function: /* @__PURE__ */ __name(() => { - getSelectedNodes().forEach((node) => { - node.pin(!node.pinned); - }); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelected.Pin", - icon: "pi pi-pin", - label: "Pin/Unpin Selected Items", - versionAdded: "1.3.33", - function: /* @__PURE__ */ __name(() => { - for (const item3 of app.canvas.selectedItems) { - if (item3 instanceof LGraphNode || item3 instanceof LGraphGroup) { - item3.pin(!item3.pinned); - } - } - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelectedNodes.Collapse", - icon: "pi pi-minus", - label: "Collapse/Expand Selected Nodes", - versionAdded: "1.3.11", - function: /* @__PURE__ */ __name(() => { - getSelectedNodes().forEach((node) => { - node.collapse(); - }); - }, "function") - }, - { - id: "Comfy.ToggleTheme", - icon: "pi pi-moon", - label: "Toggle Theme (Dark/Light)", - versionAdded: "1.3.12", - function: (() => { - let previousDarkTheme = DEFAULT_DARK_COLOR_PALETTE.id; - let previousLightTheme = DEFAULT_LIGHT_COLOR_PALETTE.id; - return () => { - const settingStore = useSettingStore(); - const theme10 = colorPaletteStore.completedActivePalette; - if (theme10.light_theme) { - previousLightTheme = theme10.id; - settingStore.set("Comfy.ColorPalette", previousDarkTheme); - } else { - previousDarkTheme = theme10.id; - settingStore.set("Comfy.ColorPalette", previousLightTheme); - } - }; - })() - }, - { - id: "Workspace.ToggleBottomPanel", - icon: "pi pi-list", - label: "Toggle Bottom Panel", - versionAdded: "1.3.22", - function: /* @__PURE__ */ __name(() => { - useBottomPanelStore().toggleBottomPanel(); - }, "function") - }, - { - id: "Workspace.ToggleFocusMode", - icon: "pi pi-eye", - label: "Toggle Focus Mode", - versionAdded: "1.3.27", - function: /* @__PURE__ */ __name(() => { - useWorkspaceStore().toggleFocusMode(); - }, "function") - }, - { - id: "Comfy.Graph.FitGroupToContents", - icon: "pi pi-expand", - label: "Fit Group To Contents", - versionAdded: "1.4.9", - function: /* @__PURE__ */ __name(() => { - for (const group of app.canvas.selectedItems) { - if (group instanceof LGraphGroup) { - group.recomputeInsideNodes(); - const padding = useSettingStore().get( - "Comfy.GroupSelectedNodes.Padding" - ); - group.resizeTo(group.children, padding); - app.graph.change(); - } - } - }, "function") - }, - { - id: "Comfy.Help.OpenComfyUIIssues", - icon: "pi pi-github", - label: "Open ComfyUI Issues", - menubarLabel: "ComfyUI Issues", - versionAdded: "1.5.5", - function: /* @__PURE__ */ __name(() => { - window.open( - "https://github.com/comfyanonymous/ComfyUI/issues", - "_blank" - ); - }, "function") - }, - { - id: "Comfy.Help.OpenComfyUIDocs", - icon: "pi pi-info-circle", - label: "Open ComfyUI Docs", - menubarLabel: "ComfyUI Docs", - versionAdded: "1.5.5", - function: /* @__PURE__ */ __name(() => { - window.open("https://docs.comfy.org/", "_blank"); - }, "function") - }, - { - id: "Comfy.Help.OpenComfyOrgDiscord", - icon: "pi pi-discord", - label: "Open Comfy-Org Discord", - menubarLabel: "Comfy-Org Discord", - versionAdded: "1.5.5", - function: /* @__PURE__ */ __name(() => { - window.open("https://www.comfy.org/discord", "_blank"); - }, "function") - }, - { - id: "Workspace.SearchBox.Toggle", - icon: "pi pi-search", - label: "Toggle Search Box", - versionAdded: "1.5.7", - 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") - }, - { - id: "Workspace.CloseWorkflow", - icon: "pi pi-times", - label: "Close Current Workflow", - versionAdded: "1.7.3", - function: /* @__PURE__ */ __name(() => { - if (workflowStore.activeWorkflow) - workflowService.closeWorkflow(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) { - setupAutoQueueHandler(); - const { t } = useI18n(); - const toast = useToast(); - const settingStore = useSettingStore(); - const executionStore = useExecutionStore(); - const colorPaletteStore = useColorPaletteStore(); - const queueStore = useQueueStore(); - watch( - () => colorPaletteStore.completedActivePalette, - (newTheme) => { - const DARK_THEME_CLASS = "dark-theme"; - if (newTheme.light_theme) { - document.body.classList.remove(DARK_THEME_CLASS); - } else { - document.body.classList.add(DARK_THEME_CLASS); - } - if (isElectron()) { - electronAPI().changeTheme({ - color: "rgba(0, 0, 0, 0)", - symbolColor: newTheme.colors.comfy_base["input-text"] - }); - } - }, - { immediate: true } - ); - if (isElectron()) { - watch( - () => queueStore.tasks, - (newTasks, oldTasks) => { - const oldRunningTaskIds = new Set( - oldTasks.filter((task) => task.isRunning).map((task) => task.promptId) - ); - newTasks.filter( - (task) => oldRunningTaskIds.has(task.promptId) && task.isHistory - ).forEach((task) => { - electronAPI().Events.incrementUserProperty( - `execution:${task.displayStatus.toLowerCase()}`, - 1 - ); - }); - }, - { deep: true } - ); - } - watchEffect(() => { - const fontSize = settingStore.get("Comfy.TextareaWidget.FontSize"); - document.documentElement.style.setProperty( - "--comfy-textarea-font-size", - `${fontSize}px` - ); - }); - watchEffect(() => { - const padding = settingStore.get("Comfy.TreeExplorer.ItemPadding"); - document.documentElement.style.setProperty( - "--comfy-tree-explorer-item-padding", - `${padding}px` - ); - }); - watchEffect(() => { - const locale = settingStore.get("Comfy.Locale"); - if (locale) { - i18n.global.locale.value = locale; - } - }); - watchEffect(() => { - const useNewMenu = settingStore.get("Comfy.UseNewMenu"); - if (useNewMenu === "Disabled") { - app.ui.menuContainer.style.setProperty("display", "block"); - app.ui.restoreMenuPosition(); - } else { - app.ui.menuContainer.style.setProperty("display", "none"); - } - }); - watchEffect(() => { - queueStore.maxHistoryItems = settingStore.get("Comfy.Queue.MaxHistoryItems"); - }); - const init = /* @__PURE__ */ __name(() => { - const coreCommands = useCoreCommands(); - useCommandStore().registerCommands(coreCommands); - useMenuItemStore().registerCoreMenuCommands(); - useKeybindingService().registerCoreKeybindings(); - useSidebarTabStore().registerCoreSidebarTabs(); - useBottomPanelStore().registerCoreBottomPanelTabs(); - app.extensionManager = useWorkspaceStore(); - }, "init"); - const queuePendingTaskCountStore = useQueuePendingTaskCountStore(); - const onStatus = /* @__PURE__ */ __name(async (e) => { - queuePendingTaskCountStore.update(e); - await queueStore.update(); - }, "onStatus"); - const reconnectingMessage = { - severity: "error", - summary: t("g.reconnecting") - }; - const onReconnecting = /* @__PURE__ */ __name(() => { - toast.remove(reconnectingMessage); - toast.add(reconnectingMessage); - }, "onReconnecting"); - const onReconnected = /* @__PURE__ */ __name(() => { - toast.remove(reconnectingMessage); - toast.add({ - severity: "success", - summary: t("g.reconnected"), - life: 2e3 - }); - }, "onReconnected"); - onMounted(() => { - api.addEventListener("status", onStatus); - api.addEventListener("reconnecting", onReconnecting); - api.addEventListener("reconnected", onReconnected); - executionStore.bindExecutionEvents(); - try { - init(); - } catch (e) { - console.error("Failed to init ComfyUI frontend", e); - } - }); - onBeforeUnmount(() => { - api.removeEventListener("status", onStatus); - api.removeEventListener("reconnecting", onReconnecting); - api.removeEventListener("reconnected", onReconnected); - executionStore.unbindExecutionEvents(); - }); - useEventListener(window, "keydown", useKeybindingService().keybindHandler); - const { wrapWithErrorHandling, wrapWithErrorHandlingAsync } = useErrorHandling(); - const onGraphReady = /* @__PURE__ */ __name(() => { - requestIdleCallback( - () => { - wrapWithErrorHandling(useKeybindingService().registerUserKeybindings)(); - wrapWithErrorHandling(useServerConfigStore().loadServerConfig)( - SERVER_CONFIG_ITEMS, - settingStore.get("Comfy.Server.ServerConfigValues") - ); - wrapWithErrorHandlingAsync(useModelStore().loadModelFolders)(); - wrapWithErrorHandlingAsync(useNodeFrequencyStore().loadNodeFrequencies)(); - useNodeDefStore().nodeSearchService.endsWithFilterStartSequence(""); - }, - { timeout: 1e3 } - ); - }, "onGraphReady"); - return (_ctx, _cache) => { - return openBlock(), createElementBlock(Fragment, null, [ - createVNode(TopMenubar), - createVNode(_sfc_main$8, { onReady: onGraphReady }), - createVNode(_sfc_main$7), - createVNode(_sfc_main$s), - createVNode(_sfc_main$u), - createVNode(MenuHamburger) - ], 64); - }; - } -}); export { - _sfc_main as default + script$e as a, + script$b as b, + script$c as c, + script$a as d, + script$9 as e, + script$8 as f, + script$5 as g, + script$3 as h, + script as i, + script$6 as j, + script$7 as k, + script$d as s }; -//# sourceMappingURL=GraphView-CDDCHVO0.js.map +//# sourceMappingURL=index-BWow9lpT.js.map diff --git a/web/assets/index-Bm1HvJhs.js b/web/assets/index-Bm1HvJhs.js new file mode 100644 index 000000000..1c1a50760 --- /dev/null +++ b/web/assets/index-Bm1HvJhs.js @@ -0,0 +1,539 @@ +var __defProp = Object.defineProperty; +var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); +import { bA as BaseStyle, bB as script$6, o as openBlock, f as createElementBlock, as as mergeProps, cJ as findIndexInList, c5 as find, bK as resolveComponent, y as createBlock, C as resolveDynamicComponent, z as withCtx, m as createBaseVNode, E as toDisplayString, A as renderSlot, B as createCommentVNode, ai as normalizeClass, bO as findSingle, F as Fragment, bL as Transition, i as withDirectives, v as vShow, bT as UniqueComponentId } from "./index-CmVtQCAR.js"; +var classes$4 = { + root: /* @__PURE__ */ __name(function root(_ref) { + var instance = _ref.instance; + return ["p-step", { + "p-step-active": instance.active, + "p-disabled": instance.isStepDisabled + }]; + }, "root"), + header: "p-step-header", + number: "p-step-number", + title: "p-step-title" +}; +var StepStyle = BaseStyle.extend({ + name: "step", + classes: classes$4 +}); +var script$2$2 = { + name: "StepperSeparator", + hostName: "Stepper", + "extends": script$6 +}; +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$2, "render$1$2"); +script$2$2.render = render$1$2; +var script$1$4 = { + name: "BaseStep", + "extends": script$6, + props: { + value: { + type: [String, Number], + "default": void 0 + }, + disabled: { + type: Boolean, + "default": false + }, + asChild: { + type: Boolean, + "default": false + }, + as: { + type: [String, Object], + "default": "DIV" + } + }, + style: StepStyle, + provide: /* @__PURE__ */ __name(function provide() { + return { + $pcStep: this, + $parentInstance: this + }; + }, "provide") +}; +var script$5 = { + name: "Step", + "extends": script$1$4, + inheritAttrs: false, + inject: { + $pcStepper: { + "default": null + }, + $pcStepList: { + "default": null + }, + $pcStepItem: { + "default": null + } + }, + data: /* @__PURE__ */ __name(function data() { + return { + isSeparatorVisible: false + }; + }, "data"), + 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; + this.isSeparatorVisible = index !== stepLen - 1; + } + }, "mounted"), + methods: { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions(key) { + var _ptm = key === "root" ? this.ptmi : this.ptm; + return _ptm(key, { + context: { + active: this.active, + disabled: this.isStepDisabled + } + }); + }, "getPTOptions"), + onStepClick: /* @__PURE__ */ __name(function onStepClick() { + this.$pcStepper.updateValue(this.activeValue); + }, "onStepClick") + }, + computed: { + active: /* @__PURE__ */ __name(function active() { + return this.$pcStepper.isStepActive(this.activeValue); + }, "active"), + activeValue: /* @__PURE__ */ __name(function activeValue() { + 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 isStepDisabled() { + return !this.active && (this.$pcStepper.isStepDisabled() || this.disabled); + }, "isStepDisabled"), + id: /* @__PURE__ */ __name(function id() { + var _this$$pcStepper; + return "".concat((_this$$pcStepper = this.$pcStepper) === null || _this$$pcStepper === void 0 ? void 0 : _this$$pcStepper.id, "_step_").concat(this.activeValue); + }, "id"), + ariaControls: /* @__PURE__ */ __name(function ariaControls() { + var _this$$pcStepper2; + return "".concat((_this$$pcStepper2 = this.$pcStepper) === null || _this$$pcStepper2 === void 0 ? void 0 : _this$$pcStepper2.id, "_steppanel_").concat(this.activeValue); + }, "ariaControls"), + a11yAttrs: /* @__PURE__ */ __name(function a11yAttrs() { + return { + root: { + role: "presentation", + "aria-current": this.active ? "step" : void 0, + "data-pc-name": "step", + "data-pc-section": "root", + "data-p-disabled": this.isStepDisabled, + "data-p-active": this.active + }, + header: { + id: this.id, + role: "tab", + taindex: this.disabled ? -1 : void 0, + "aria-controls": this.ariaControls, + "data-pc-section": "header", + disabled: this.isStepDisabled, + onClick: this.onStepClick + } + }; + }, "a11yAttrs") + }, + components: { + StepperSeparator: script$2$2 + } +}; +var _hoisted_1 = ["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, + "class": _ctx.cx("root"), + "aria-current": $options.active ? "step" : void 0, + role: "presentation", + "data-p-active": $options.active, + "data-p-disabled": $options.isStepDisabled + }, $options.getPTOptions("root")), { + "default": withCtx(function() { + return [createBaseVNode("button", mergeProps({ + id: $options.id, + "class": _ctx.cx("header"), + role: "tab", + type: "button", + tabindex: $options.isStepDisabled ? -1 : void 0, + "aria-controls": $options.ariaControls, + disabled: $options.isStepDisabled, + onClick: _cache[0] || (_cache[0] = function() { + return $options.onStepClick && $options.onStepClick.apply($options, arguments); + }) + }, $options.getPTOptions("header")), [createBaseVNode("span", mergeProps({ + "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), $data.isSeparatorVisible ? (openBlock(), createBlock(_component_StepperSeparator, { + key: 0 + })) : createCommentVNode("", true)]; + }), + _: 3 + }, 16, ["class", "aria-current", "data-p-active", "data-p-disabled"])) : renderSlot(_ctx.$slots, "default", { + key: 1, + "class": normalizeClass(_ctx.cx("root")), + active: $options.active, + value: _ctx.value, + a11yAttrs: $options.a11yAttrs, + activateCallback: $options.onStepClick + }); +} +__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 + }]; + }, "root"), + content: "p-steppanel-content" +}; +var StepPanelStyle = BaseStyle.extend({ + name: "steppanel", + classes: classes$2 +}); +var script$2$1 = { + name: "StepperSeparator", + hostName: "Stepper", + "extends": script$6 +}; +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$1, "render$1$1"); +script$2$1.render = render$1$1; +var script$1$2 = { + name: "BaseStepPanel", + "extends": script$6, + props: { + value: { + type: [String, Number], + "default": void 0 + }, + asChild: { + type: Boolean, + "default": false + }, + as: { + type: [String, Object], + "default": "DIV" + } + }, + style: StepPanelStyle, + provide: /* @__PURE__ */ __name(function provide3() { + return { + $pcStepPanel: this, + $parentInstance: this + }; + }, "provide") +}; +var script$3 = { + name: "StepPanel", + "extends": script$1$2, + inheritAttrs: false, + inject: { + $pcStepper: { + "default": null + }, + $pcStepItem: { + "default": null + }, + $pcStepList: { + "default": null + } + }, + data: /* @__PURE__ */ __name(function data2() { + return { + isSeparatorVisible: false + }; + }, "data"), + mounted: /* @__PURE__ */ __name(function mounted2() { + if (this.$el) { + var _this$$pcStepItem, _this$$pcStepList; + var stepElements = find(this.$pcStepper.$el, '[data-pc-name="step"]'); + 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"]'); + var stepPanelIndex = findIndexInList(stepPanelEl, stepElements); + this.isSeparatorVisible = this.isVertical && stepPanelIndex !== stepElements.length - 1; + } + }, "mounted"), + methods: { + getPTOptions: /* @__PURE__ */ __name(function getPTOptions2(key) { + var _ptm = key === "root" ? this.ptmi : this.ptm; + return _ptm(key, { + context: { + active: this.active + } + }); + }, "getPTOptions"), + updateValue: /* @__PURE__ */ __name(function updateValue(val) { + this.$pcStepper.updateValue(val); + }, "updateValue") + }, + computed: { + active: /* @__PURE__ */ __name(function active2() { + var _this$$pcStepItem2, _this$$pcStepper; + var activeValue3 = !!this.$pcStepItem ? (_this$$pcStepItem2 = this.$pcStepItem) === null || _this$$pcStepItem2 === void 0 ? void 0 : _this$$pcStepItem2.value : this.value; + return activeValue3 === ((_this$$pcStepper = this.$pcStepper) === null || _this$$pcStepper === void 0 ? void 0 : _this$$pcStepper.d_value); + }, "active"), + isVertical: /* @__PURE__ */ __name(function isVertical() { + return !!this.$pcStepItem; + }, "isVertical"), + activeValue: /* @__PURE__ */ __name(function activeValue2() { + var _this$$pcStepItem3; + return this.isVertical ? (_this$$pcStepItem3 = this.$pcStepItem) === null || _this$$pcStepItem3 === void 0 ? void 0 : _this$$pcStepItem3.value : this.value; + }, "activeValue"), + id: /* @__PURE__ */ __name(function id2() { + var _this$$pcStepper2; + return "".concat((_this$$pcStepper2 = this.$pcStepper) === null || _this$$pcStepper2 === void 0 ? void 0 : _this$$pcStepper2.id, "_steppanel_").concat(this.activeValue); + }, "id"), + ariaControls: /* @__PURE__ */ __name(function ariaControls2() { + var _this$$pcStepper3; + return "".concat((_this$$pcStepper3 = this.$pcStepper) === null || _this$$pcStepper3 === void 0 ? void 0 : _this$$pcStepper3.id, "_step_").concat(this.activeValue); + }, "ariaControls"), + a11yAttrs: /* @__PURE__ */ __name(function a11yAttrs2() { + return { + id: this.id, + role: "tabpanel", + "aria-controls": this.ariaControls, + "data-pc-name": "steppanel", + "data-p-active": this.active + }; + }, "a11yAttrs") + }, + components: { + StepperSeparator: script$2$1 + } +}; +function render$2(_ctx, _cache, $props, $setup, $data, $options) { + var _component_StepperSeparator = resolveComponent("StepperSeparator"); + return $options.isVertical ? (openBlock(), createElementBlock(Fragment, { + key: 0 + }, [!_ctx.asChild ? (openBlock(), createBlock(Transition, mergeProps({ + key: 0, + name: "p-toggleable-content" + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ + id: $options.id, + "class": _ctx.cx("root"), + role: "tabpanel", + "aria-controls": $options.ariaControls + }, $options.getPTOptions("root")), { + "default": withCtx(function() { + return [$data.isSeparatorVisible ? (openBlock(), createBlock(_component_StepperSeparator, { + key: 0 + })) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("content") + }, $options.getPTOptions("content")), [renderSlot(_ctx.$slots, "default", { + active: $options.active, + activateCallback: /* @__PURE__ */ __name(function activateCallback(val) { + return $options.updateValue(val); + }, "activateCallback") + })], 16)]; + }), + _: 3 + }, 16, ["id", "class", "aria-controls"])), [[vShow, $options.active]])]; + }), + _: 3 + }, 16)) : renderSlot(_ctx.$slots, "default", { + key: 1, + active: $options.active, + a11yAttrs: $options.a11yAttrs, + activateCallback: /* @__PURE__ */ __name(function activateCallback(val) { + return $options.updateValue(val); + }, "activateCallback") + })], 64)) : (openBlock(), createElementBlock(Fragment, { + key: 1 + }, [!_ctx.asChild ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ + key: 0, + id: $options.id, + "class": _ctx.cx("root"), + role: "tabpanel", + "aria-controls": $options.ariaControls + }, $options.getPTOptions("root")), { + "default": withCtx(function() { + return [renderSlot(_ctx.$slots, "default", { + active: $options.active, + activateCallback: /* @__PURE__ */ __name(function activateCallback(val) { + return $options.updateValue(val); + }, "activateCallback") + })]; + }), + _: 3 + }, 16, ["id", "class", "aria-controls"])), [[vShow, $options.active]]) : _ctx.asChild && $options.active ? renderSlot(_ctx.$slots, "default", { + key: 1, + active: $options.active, + a11yAttrs: $options.a11yAttrs, + activateCallback: /* @__PURE__ */ __name(function activateCallback(val) { + return $options.updateValue(val); + }, "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 margin-inline-start: 1rem;\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 .p-stepper-separator:dir(rtl) {\n left: calc(-9 * ").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; +export { + script$5 as a, + script$2 as b, + script$3 as c, + script as d, + script$4 as s +}; +//# sourceMappingURL=index-Bm1HvJhs.js.map diff --git a/web/assets/index-Cf-n7v0V.css b/web/assets/index-C1Hb_Yo9.css similarity index 95% rename from web/assets/index-Cf-n7v0V.css rename to web/assets/index-C1Hb_Yo9.css index b8e6a53ad..5e62328cf 100644 --- a/web/assets/index-Cf-n7v0V.css +++ b/web/assets/index-C1Hb_Yo9.css @@ -2101,6 +2101,15 @@ .inset-0{ inset: 0px; } + .-bottom-4{ + bottom: -1rem; + } + .-right-14{ + right: -3.5rem; + } + .-right-4{ + right: -1rem; + } .bottom-\[10px\]{ bottom: 10px; } @@ -2134,6 +2143,12 @@ .z-\[9999\]{ z-index: 9999; } + .col-span-full{ + grid-column: 1 / -1; + } + .row-span-full{ + grid-row: 1 / -1; + } .m-0{ margin: 0px; } @@ -2146,6 +2161,9 @@ .m-2{ margin: 0.5rem; } + .m-8{ + margin: 2rem; + } .mx-1{ margin-left: 0.25rem; margin-right: 0.25rem; @@ -2226,6 +2244,9 @@ .mt-5{ margin-top: 1.25rem; } + .mt-6{ + margin-top: 1.5rem; + } .block{ display: block; } @@ -2259,6 +2280,9 @@ .h-1{ height: 0.25rem; } + .h-1\/2{ + height: 50%; + } .h-16{ height: 4rem; } @@ -2268,6 +2292,9 @@ .h-64{ height: 16rem; } + .h-8{ + height: 2rem; + } .h-96{ height: 26rem; } @@ -2292,9 +2319,15 @@ .max-h-full{ max-height: 100%; } + .min-h-52{ + min-height: 13rem; + } .min-h-8{ min-height: 2rem; } + .min-h-full{ + min-height: 100%; + } .min-h-screen{ min-height: 100vh; } @@ -2356,15 +2389,24 @@ .min-w-110{ min-width: 32rem; } + .min-w-32{ + min-width: 8rem; + } .min-w-84{ min-width: 22rem; } .min-w-96{ min-width: 26rem; } + .min-w-full{ + min-width: 100%; + } .max-w-110{ max-width: 32rem; } + .max-w-48{ + max-width: 12rem; + } .max-w-64{ max-width: 16rem; } @@ -2395,6 +2437,9 @@ .grow{ flex-grow: 1; } + .border-collapse{ + border-collapse: collapse; + } .-translate-y-40{ --tw-translate-y: -10rem; transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); @@ -2463,9 +2508,15 @@ .justify-around{ justify-content: space-around; } + .justify-evenly{ + justify-content: space-evenly; + } .gap-0{ gap: 0px; } + .gap-1{ + gap: 0.25rem; + } .gap-2{ gap: 0.5rem; } @@ -2481,6 +2532,11 @@ .gap-8{ gap: 2rem; } + .space-x-1 > :not([hidden]) ~ :not([hidden]){ + --tw-space-x-reverse: 0; + margin-right: calc(0.25rem * var(--tw-space-x-reverse)); + margin-left: calc(0.25rem * calc(1 - var(--tw-space-x-reverse))); + } .space-y-1 > :not([hidden]) ~ :not([hidden]){ --tw-space-y-reverse: 0; margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse))); @@ -2528,9 +2584,6 @@ .whitespace-pre-line{ white-space: pre-line; } - .whitespace-pre-wrap{ - white-space: pre-wrap; - } .text-wrap{ text-wrap: wrap; } @@ -2560,6 +2613,10 @@ border-left-width: 0px; border-right-width: 0px; } + .border-y{ + border-top-width: 1px; + border-bottom-width: 1px; + } .border-b{ border-bottom-width: 1px; } @@ -2575,9 +2632,16 @@ .border-solid{ border-style: solid; } + .border-hidden{ + border-style: hidden; + } .border-none{ border-style: none; } + .border-neutral-700{ + --tw-border-opacity: 1; + border-color: rgb(64 64 64 / var(--tw-border-opacity)); + } .bg-\[var\(--comfy-menu-bg\)\]{ background-color: var(--comfy-menu-bg); } @@ -2732,6 +2796,9 @@ .text-center{ text-align: center; } + .text-right{ + text-align: right; + } .font-mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; } @@ -2832,18 +2899,34 @@ .no-underline{ text-decoration-line: none; } + .antialiased{ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } .opacity-0{ opacity: 0; } .opacity-100{ opacity: 1; } + .opacity-15{ + opacity: 0.15; + } + .opacity-25{ + opacity: 0.25; + } .opacity-40{ opacity: 0.4; } .opacity-50{ opacity: 0.5; } + .opacity-65{ + opacity: 0.65; + } + .opacity-75{ + opacity: 0.75; + } .shadow-lg{ --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color); @@ -2891,6 +2974,9 @@ .duration-100{ transition-duration: 100ms; } + .duration-200{ + transition-duration: 200ms; + } .duration-300{ transition-duration: 300ms; } @@ -3672,6 +3758,30 @@ audio.comfy-audio.empty-audio-widget { padding: var(--comfy-tree-explorer-item-padding) !important; } +/* Load3d styles */ +.comfy-load-3d, +.comfy-load-3d-animation, +.comfy-preview-3d, +.comfy-preview-3d-animation{ + display: flex; + flex-direction: column; + background: transparent; + flex: 1; + position: relative; + overflow: hidden; +} + +.comfy-load-3d canvas, +.comfy-load-3d-animation canvas, +.comfy-preview-3d canvas, +.comfy-preview-3d-animation canvas{ + display: flex; + width: 100% !important; + height: 100% !important; +} + +/* End of Load3d styles */ + /* [Desktop] Electron window specific styles */ .app-drag { app-region: drag; @@ -3699,6 +3809,42 @@ audio.comfy-audio.empty-audio-widget { .hover\:opacity-100:hover{ opacity: 1; } +@media (prefers-reduced-motion: no-preference){ + + .motion-safe\:w-0{ + width: 0px; + } + + .motion-safe\:opacity-0{ + opacity: 0; + } + + .group\/sidebar-tab:focus-within .motion-safe\:group-focus-within\/sidebar-tab\:w-auto{ + width: auto; + } + + .group\/sidebar-tab:focus-within .motion-safe\:group-focus-within\/sidebar-tab\:opacity-100{ + opacity: 1; + } + + .group\/sidebar-tab:hover .motion-safe\:group-hover\/sidebar-tab\:w-auto{ + width: auto; + } + + .group\/sidebar-tab:hover .motion-safe\:group-hover\/sidebar-tab\:opacity-100{ + opacity: 1; + } + + .group\/tree-node:hover .motion-safe\:group-hover\/tree-node\:opacity-100{ + opacity: 1; + } +} +@media not all and (min-width: 640px){ + + .max-sm\:hidden{ + display: none; + } +} @media (min-width: 768px){ .md\:flex{ @@ -3798,17 +3944,17 @@ audio.comfy-audio.empty-audio-widget { margin-bottom: 1rem; } -.comfy-error-report[data-v-09b72a20] { +.comfy-error-report[data-v-3faf7785] { display: flex; flex-direction: column; gap: 1rem; } -.action-container[data-v-09b72a20] { +.action-container[data-v-3faf7785] { display: flex; gap: 1rem; justify-content: flex-end; } -.wrapper-pre[data-v-09b72a20] { +.wrapper-pre[data-v-3faf7785] { white-space: pre-wrap; word-wrap: break-word; } @@ -3826,7 +3972,7 @@ audio.comfy-audio.empty-audio-widget { margin-left: auto; } -.comfy-missing-models[data-v-ebf9fccc] { +.comfy-missing-models[data-v-f8d63775] { max-height: 300px; overflow-y: auto; } @@ -3868,22 +4014,22 @@ audio.comfy-audio.empty-audio-widget { background-color: rgb(234 179 8 / var(--tw-bg-opacity)) } -[data-v-ba13476b] .p-inputtext { +[data-v-b3ab067d] .p-inputtext { --p-form-field-padding-x: 0.625rem; } -.p-button.p-inputicon[data-v-ba13476b] { +.p-button.p-inputicon[data-v-b3ab067d] { width: auto; border-style: none; padding: 0px; } -.form-input[data-v-e4e3022d] .input-slider .p-inputnumber input, -.form-input[data-v-e4e3022d] .input-slider .slider-part { +.form-input[data-v-1451da7b] .input-slider .p-inputnumber input, +.form-input[data-v-1451da7b] .input-slider .slider-part { width: 5rem } -.form-input[data-v-e4e3022d] .p-inputtext, -.form-input[data-v-e4e3022d] .p-select { +.form-input[data-v-1451da7b] .p-inputtext, +.form-input[data-v-1451da7b] .p-select { width: 11rem } @@ -4504,28 +4650,28 @@ audio.comfy-audio.empty-audio-widget { box-sizing: border-box; } -.tree-node[data-v-a6457774] { +.tree-node[data-v-654109c7] { width: 100%; display: flex; align-items: center; justify-content: space-between; } -.leaf-count-badge[data-v-a6457774] { +.leaf-count-badge[data-v-654109c7] { margin-left: 0.5rem; } -.node-content[data-v-a6457774] { +.node-content[data-v-654109c7] { display: flex; align-items: center; flex-grow: 1; } -.leaf-label[data-v-a6457774] { +.leaf-label[data-v-654109c7] { margin-left: 0.5rem; } -[data-v-a6457774] .editable-text span { +[data-v-654109c7] .editable-text span { word-break: break-all; } -[data-v-31d518da] .tree-explorer-node-label { +[data-v-976a6d58] .tree-explorer-node-label { width: 100%; display: flex; align-items: center; @@ -4538,10 +4684,10 @@ audio.comfy-audio.empty-audio-widget { * By setting the position to relative on the parent and using an absolutely positioned pseudo-element, * we can create a visual indicator for the drop target without affecting the layout of other elements. */ -[data-v-31d518da] .p-tree-node-content:has(.tree-folder) { +[data-v-976a6d58] .p-tree-node-content:has(.tree-folder) { position: relative; } -[data-v-31d518da] .p-tree-node-content:has(.tree-folder.can-drop)::after { +[data-v-976a6d58] .p-tree-node-content:has(.tree-folder.can-drop)::after { content: ''; position: absolute; top: 0; @@ -4552,21 +4698,21 @@ audio.comfy-audio.empty-audio-widget { pointer-events: none; } -[data-v-5e759e25] .p-toolbar-end .p-button { +[data-v-0061c432] .p-toolbar-end .p-button { padding-top: 0.25rem; padding-bottom: 0.25rem } @media (min-width: 1536px) { -[data-v-5e759e25] .p-toolbar-end .p-button { +[data-v-0061c432] .p-toolbar-end .p-button { padding-top: 0.5rem; padding-bottom: 0.5rem } } -[data-v-5e759e25] .p-toolbar-start { +[data-v-0061c432] .p-toolbar-start { min-width: 0px; @@ -4649,31 +4795,6 @@ audio.comfy-audio.empty-audio-widget { width: 16px; } -._content[data-v-c4279e6b] { - - display: flex; - - flex-direction: column -} -._content[data-v-c4279e6b] > :not([hidden]) ~ :not([hidden]) { - - --tw-space-y-reverse: 0; - - margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse))); - - margin-bottom: calc(0.5rem * var(--tw-space-y-reverse)) -} -._footer[data-v-c4279e6b] { - - display: flex; - - flex-direction: column; - - align-items: flex-end; - - padding-top: 1rem -} - .slot_row[data-v-d9792337] { padding: 2px; } @@ -4801,34 +4922,61 @@ audio.comfy-audio.empty-audio-widget { color: var(--error-text); } +._content[data-v-c4279e6b] { + + display: flex; + + flex-direction: column +} +._content[data-v-c4279e6b] > :not([hidden]) ~ :not([hidden]) { + + --tw-space-y-reverse: 0; + + margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse))); + + margin-bottom: calc(0.5rem * var(--tw-space-y-reverse)) +} +._footer[data-v-c4279e6b] { + + display: flex; + + flex-direction: column; + + align-items: flex-end; + + padding-top: 1rem +} + .node-lib-node-container[data-v-da9a8962] { height: 100%; width: 100% } -.p-selectbutton .p-button[data-v-05364174] { +.p-selectbutton .p-button[data-v-bd06e12b] { padding: 0.5rem; } -.p-selectbutton .p-button .pi[data-v-05364174] { +.p-selectbutton .p-button .pi[data-v-bd06e12b] { font-size: 1.5rem; } -.field[data-v-05364174] { +.field[data-v-bd06e12b] { display: flex; flex-direction: column; gap: 0.5rem; } -.color-picker-container[data-v-05364174] { +.color-picker-container[data-v-bd06e12b] { display: flex; align-items: center; gap: 0.5rem; } -.scroll-container[data-v-ad33a347] { +.scroll-container { +&[data-v-ad33a347] { height: 100%; overflow-y: auto; /* Firefox */ scrollbar-width: none; +} &[data-v-ad33a347]::-webkit-scrollbar { width: 1px; } diff --git a/web/assets/index-DpF-ptbJ.js b/web/assets/index-CdHVC5qq.js similarity index 86% rename from web/assets/index-DpF-ptbJ.js rename to web/assets/index-CdHVC5qq.js index 792856c66..f7678aece 100644 --- a/web/assets/index-DpF-ptbJ.js +++ b/web/assets/index-CdHVC5qq.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { B as BaseStyle, y as script$s, cA as script$t, m as createBaseVNode, o as openBlock, f as createElementBlock, G as mergeProps, Z as toDisplayString, U as Ripple, r as resolveDirective, i as withDirectives, J as createBlock, K as resolveDynamicComponent, c5 as script$u, aD as resolveComponent, V as normalizeClass, aF as createSlots, P as withCtx, bG as script$v, bD as script$w, H as Fragment, I as renderList, aG as createTextVNode, bx as setAttribute, am as UniqueComponentId, bv as normalizeProps, M as renderSlot, L as createCommentVNode, T as equals, br as script$x, cg as script$y, cB as getFirstFocusableElement, ap as OverlayEventBus, E as getVNodeProp, ao as resolveFieldData, cC as invokeElementMethod, Q as getAttribute, cD as getNextElementSibling, C as getOuterWidth, cE as getPreviousElementSibling, l as script$z, aA as script$A, Y as script$B, bu as script$D, al as isNotEmpty, b3 as withModifiers, D as getOuterHeight, cF as _default, an as ZIndex, S as focus, ar as addStyle, at as absolutePosition, au as ConnectedOverlayScrollHandler, av as isTouchDevice, cG as FilterOperator, az as script$E, cH as script$F, cI as FocusTrap, k as createVNode, aE as Transition, c3 as withKeys, cJ as getIndex, aW as script$G, cK as isClickable, cL as clearSelection, cM as localeComparator, cN as sort, cO as FilterService, cu as FilterMatchMode, R as findSingle, c9 as findIndexInList, ca as find, cP as exportCSV, W as getOffset, cQ as getHiddenElementOuterWidth, cR as getHiddenElementOuterHeight, cS as reorderArray, cT as getWindowScrollTop, cU as removeClass, cV as addClass, aq as isEmpty, ay as script$H, aB as script$I } from "./index-QvfM__ze.js"; -import { s as script$C } from "./index-Q1cQr26V.js"; +import { bA as BaseStyle, bB as script$s, bZ as script$t, o as openBlock, f as createElementBlock, as as mergeProps, m as createBaseVNode, E as toDisplayString, bS as Ripple, r as resolveDirective, i as withDirectives, y as createBlock, C as resolveDynamicComponent, bi as script$u, bK as resolveComponent, ai as normalizeClass, co as createSlots, z as withCtx, aU as script$v, cf as script$w, F as Fragment, D as renderList, a7 as createTextVNode, c9 as setAttribute, cv as normalizeProps, A as renderSlot, B as createCommentVNode, b_ as script$x, ce as equals, cA as script$y, br as script$z, cE as getFirstFocusableElement, c8 as OverlayEventBus, cU as getVNodeProp, cc as resolveFieldData, ds as invokeElementMethod, bP as getAttribute, cV as getNextElementSibling, c3 as getOuterWidth, cW as getPreviousElementSibling, l as script$A, bR as script$B, bU as script$C, bJ as script$E, cd as isNotEmpty, ar as withModifiers, d5 as getOuterHeight, bT as UniqueComponentId, cY as _default, bC as ZIndex, bE as focus, b$ as addStyle, c4 as absolutePosition, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, dt as FilterOperator, bI as script$F, cs as script$G, bH as FocusTrap, k as createVNode, bL as Transition, bf as withKeys, c6 as getIndex, cu as script$H, cX as isClickable, cZ as clearSelection, ca as localeComparator, cn as sort, cG as FilterService, dl as FilterMatchMode, bO as findSingle, cJ as findIndexInList, c5 as find, du as exportCSV, cR as getOffset, c_ as isRTL, dv as getHiddenElementOuterWidth, dw as getHiddenElementOuterHeight, dx as reorderArray, bW as removeClass, bD as addClass, ci as isEmpty, cH as script$I, ck as script$J } from "./index-CmVtQCAR.js"; +import { s as script$D } from "./index-I0brO37W.js"; var ColumnStyle = BaseStyle.extend({ name: "column" }); @@ -215,13 +215,6 @@ var script$q = { name: "ArrowDownIcon", "extends": script$t }; -var _hoisted_1$i = /* @__PURE__ */ createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M6.99994 14C6.91097 14.0004 6.82281 13.983 6.74064 13.9489C6.65843 13.9148 6.58387 13.8646 6.52133 13.8013L1.10198 8.38193C0.982318 8.25351 0.917175 8.08367 0.920272 7.90817C0.923368 7.73267 0.994462 7.56523 1.11858 7.44111C1.24269 7.317 1.41014 7.2459 1.58563 7.2428C1.76113 7.23971 1.93098 7.30485 2.0594 7.42451L6.32263 11.6877V0.677419C6.32263 0.497756 6.394 0.325452 6.52104 0.198411C6.64808 0.0713706 6.82039 0 7.00005 0C7.17971 0 7.35202 0.0713706 7.47906 0.198411C7.6061 0.325452 7.67747 0.497756 7.67747 0.677419V11.6877L11.9407 7.42451C12.0691 7.30485 12.2389 7.23971 12.4144 7.2428C12.5899 7.2459 12.7574 7.317 12.8815 7.44111C13.0056 7.56523 13.0767 7.73267 13.0798 7.90817C13.0829 8.08367 13.0178 8.25351 12.8981 8.38193L7.47875 13.8013C7.41621 13.8646 7.34164 13.9148 7.25944 13.9489C7.17727 13.983 7.08912 14.0004 7.00015 14C7.00012 14 7.00009 14 7.00005 14C7.00001 14 6.99998 14 6.99994 14Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$f = [_hoisted_1$i]; function render$p(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", @@ -229,7 +222,12 @@ function render$p(_ctx, _cache, $props, $setup, $data, $options) { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$f, 16); + }, _ctx.pti()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M6.99994 14C6.91097 14.0004 6.82281 13.983 6.74064 13.9489C6.65843 13.9148 6.58387 13.8646 6.52133 13.8013L1.10198 8.38193C0.982318 8.25351 0.917175 8.08367 0.920272 7.90817C0.923368 7.73267 0.994462 7.56523 1.11858 7.44111C1.24269 7.317 1.41014 7.2459 1.58563 7.2428C1.76113 7.23971 1.93098 7.30485 2.0594 7.42451L6.32263 11.6877V0.677419C6.32263 0.497756 6.394 0.325452 6.52104 0.198411C6.64808 0.0713706 6.82039 0 7.00005 0C7.17971 0 7.35202 0.0713706 7.47906 0.198411C7.6061 0.325452 7.67747 0.497756 7.67747 0.677419V11.6877L11.9407 7.42451C12.0691 7.30485 12.2389 7.23971 12.4144 7.2428C12.5899 7.2459 12.7574 7.317 12.8815 7.44111C13.0056 7.56523 13.0767 7.73267 13.0798 7.90817C13.0829 8.08367 13.0178 8.25351 12.8981 8.38193L7.47875 13.8013C7.41621 13.8646 7.34164 13.9148 7.25944 13.9489C7.17727 13.983 7.08912 14.0004 7.00015 14C7.00012 14 7.00009 14 7.00005 14C7.00001 14 6.99998 14 6.99994 14Z", + fill: "currentColor" + }, null, -1)]), 16); } __name(render$p, "render$p"); script$q.render = render$p; @@ -237,13 +235,6 @@ var script$p = { name: "ArrowUpIcon", "extends": script$t }; -var _hoisted_1$h = /* @__PURE__ */ createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M6.51551 13.799C6.64205 13.9255 6.813 13.9977 6.99193 14C7.17087 13.9977 7.34182 13.9255 7.46835 13.799C7.59489 13.6725 7.66701 13.5015 7.66935 13.3226V2.31233L11.9326 6.57554C11.9951 6.63887 12.0697 6.68907 12.1519 6.72319C12.2341 6.75731 12.3223 6.77467 12.4113 6.77425C12.5003 6.77467 12.5885 6.75731 12.6707 6.72319C12.7529 6.68907 12.8274 6.63887 12.89 6.57554C13.0168 6.44853 13.0881 6.27635 13.0881 6.09683C13.0881 5.91732 13.0168 5.74514 12.89 5.61812L7.48846 0.216594C7.48274 0.210436 7.4769 0.204374 7.47094 0.198411C7.3439 0.0713707 7.1716 0 6.99193 0C6.81227 0 6.63997 0.0713707 6.51293 0.198411C6.50704 0.204296 6.50128 0.210278 6.49563 0.216354L1.09386 5.61812C0.974201 5.74654 0.909057 5.91639 0.912154 6.09189C0.91525 6.26738 0.986345 6.43483 1.11046 6.55894C1.23457 6.68306 1.40202 6.75415 1.57752 6.75725C1.75302 6.76035 1.92286 6.6952 2.05128 6.57554L6.31451 2.31231V13.3226C6.31685 13.5015 6.38898 13.6725 6.51551 13.799Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$e = [_hoisted_1$h]; function render$o(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", @@ -251,7 +242,12 @@ function render$o(_ctx, _cache, $props, $setup, $data, $options) { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$e, 16); + }, _ctx.pti()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M6.51551 13.799C6.64205 13.9255 6.813 13.9977 6.99193 14C7.17087 13.9977 7.34182 13.9255 7.46835 13.799C7.59489 13.6725 7.66701 13.5015 7.66935 13.3226V2.31233L11.9326 6.57554C11.9951 6.63887 12.0697 6.68907 12.1519 6.72319C12.2341 6.75731 12.3223 6.77467 12.4113 6.77425C12.5003 6.77467 12.5885 6.75731 12.6707 6.72319C12.7529 6.68907 12.8274 6.63887 12.89 6.57554C13.0168 6.44853 13.0881 6.27635 13.0881 6.09683C13.0881 5.91732 13.0168 5.74514 12.89 5.61812L7.48846 0.216594C7.48274 0.210436 7.4769 0.204374 7.47094 0.198411C7.3439 0.0713707 7.1716 0 6.99193 0C6.81227 0 6.63997 0.0713707 6.51293 0.198411C6.50704 0.204296 6.50128 0.210278 6.49563 0.216354L1.09386 5.61812C0.974201 5.74654 0.909057 5.91639 0.912154 6.09189C0.91525 6.26738 0.986345 6.43483 1.11046 6.55894C1.23457 6.68306 1.40202 6.75415 1.57752 6.75725C1.75302 6.76035 1.92286 6.6952 2.05128 6.57554L6.31451 2.31231V13.3226C6.31685 13.5015 6.38898 13.6725 6.51551 13.799Z", + fill: "currentColor" + }, null, -1)]), 16); } __name(render$o, "render$o"); script$p.render = render$o; @@ -286,7 +282,7 @@ function _toPrimitive$b(t, r) { __name(_toPrimitive$b, "_toPrimitive$b"); var theme$2 = /* @__PURE__ */ __name(function theme(_ref) { var dt = _ref.dt; - return "\n.p-paginator {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-wrap: wrap;\n background: ".concat(dt("paginator.background"), ";\n color: ").concat(dt("paginator.color"), ";\n padding: ").concat(dt("paginator.padding"), ";\n border-radius: ").concat(dt("paginator.border.radius"), ";\n gap: ").concat(dt("paginator.gap"), ";\n}\n\n.p-paginator-content {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-wrap: wrap;\n gap: ").concat(dt("paginator.gap"), ";\n}\n\n.p-paginator-content-start {\n margin-right: auto;\n}\n\n.p-paginator-content-end {\n margin-left: auto;\n}\n\n.p-paginator-page,\n.p-paginator-next,\n.p-paginator-last,\n.p-paginator-first,\n.p-paginator-prev {\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n line-height: 1;\n user-select: none;\n overflow: hidden;\n position: relative;\n background: ").concat(dt("paginator.nav.button.background"), ";\n border: 0 none;\n color: ").concat(dt("paginator.nav.button.color"), ";\n min-width: ").concat(dt("paginator.nav.button.width"), ";\n height: ").concat(dt("paginator.nav.button.height"), ";\n transition: background ").concat(dt("paginator.transition.duration"), ", color ").concat(dt("paginator.transition.duration"), ", outline-color ").concat(dt("paginator.transition.duration"), ", box-shadow ").concat(dt("paginator.transition.duration"), ";\n border-radius: ").concat(dt("paginator.nav.button.border.radius"), ";\n padding: 0;\n margin: 0;\n}\n\n.p-paginator-page:focus-visible,\n.p-paginator-next:focus-visible,\n.p-paginator-last:focus-visible,\n.p-paginator-first:focus-visible,\n.p-paginator-prev:focus-visible {\n box-shadow: ").concat(dt("paginator.nav.button.focus.ring.shadow"), ";\n outline: ").concat(dt("paginator.nav.button.focus.ring.width"), " ").concat(dt("paginator.nav.button.focus.ring.style"), " ").concat(dt("paginator.nav.button.focus.ring.color"), ";\n outline-offset: ").concat(dt("paginator.nav.button.focus.ring.offset"), ";\n}\n\n.p-paginator-page:not(.p-disabled):not(.p-paginator-page-selected):hover,\n.p-paginator-first:not(.p-disabled):hover,\n.p-paginator-prev:not(.p-disabled):hover,\n.p-paginator-next:not(.p-disabled):hover,\n.p-paginator-last:not(.p-disabled):hover {\n background: ").concat(dt("paginator.nav.button.hover.background"), ";\n color: ").concat(dt("paginator.nav.button.hover.color"), ";\n}\n\n.p-paginator-page.p-paginator-page-selected {\n background: ").concat(dt("paginator.nav.button.selected.background"), ";\n color: ").concat(dt("paginator.nav.button.selected.color"), ";\n}\n\n.p-paginator-current {\n color: ").concat(dt("paginator.current.page.report.color"), ";\n}\n\n.p-paginator-pages {\n display: flex;\n align-items: center;\n gap: ").concat(dt("paginator.gap"), ";\n}\n\n.p-paginator-jtp-input .p-inputtext {\n max-width: ").concat(dt("paginator.jump.to.page.input.max.width"), ";\n}\n"); + return "\n.p-paginator {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-wrap: wrap;\n background: ".concat(dt("paginator.background"), ";\n color: ").concat(dt("paginator.color"), ";\n padding: ").concat(dt("paginator.padding"), ";\n border-radius: ").concat(dt("paginator.border.radius"), ";\n gap: ").concat(dt("paginator.gap"), ";\n}\n\n.p-paginator-content {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-wrap: wrap;\n gap: ").concat(dt("paginator.gap"), ";\n}\n\n.p-paginator-content-start {\n margin-inline-end: auto;\n}\n\n.p-paginator-content-end {\n margin-inline-start: auto;\n}\n\n.p-paginator-page,\n.p-paginator-next,\n.p-paginator-last,\n.p-paginator-first,\n.p-paginator-prev {\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n line-height: 1;\n user-select: none;\n overflow: hidden;\n position: relative;\n background: ").concat(dt("paginator.nav.button.background"), ";\n border: 0 none;\n color: ").concat(dt("paginator.nav.button.color"), ";\n min-width: ").concat(dt("paginator.nav.button.width"), ";\n height: ").concat(dt("paginator.nav.button.height"), ";\n transition: background ").concat(dt("paginator.transition.duration"), ", color ").concat(dt("paginator.transition.duration"), ", outline-color ").concat(dt("paginator.transition.duration"), ", box-shadow ").concat(dt("paginator.transition.duration"), ";\n border-radius: ").concat(dt("paginator.nav.button.border.radius"), ";\n padding: 0;\n margin: 0;\n}\n\n.p-paginator-page:focus-visible,\n.p-paginator-next:focus-visible,\n.p-paginator-last:focus-visible,\n.p-paginator-first:focus-visible,\n.p-paginator-prev:focus-visible {\n box-shadow: ").concat(dt("paginator.nav.button.focus.ring.shadow"), ";\n outline: ").concat(dt("paginator.nav.button.focus.ring.width"), " ").concat(dt("paginator.nav.button.focus.ring.style"), " ").concat(dt("paginator.nav.button.focus.ring.color"), ";\n outline-offset: ").concat(dt("paginator.nav.button.focus.ring.offset"), ";\n}\n\n.p-paginator-page:not(.p-disabled):not(.p-paginator-page-selected):hover,\n.p-paginator-first:not(.p-disabled):hover,\n.p-paginator-prev:not(.p-disabled):hover,\n.p-paginator-next:not(.p-disabled):hover,\n.p-paginator-last:not(.p-disabled):hover {\n background: ").concat(dt("paginator.nav.button.hover.background"), ";\n color: ").concat(dt("paginator.nav.button.hover.color"), ";\n}\n\n.p-paginator-page.p-paginator-page-selected {\n background: ").concat(dt("paginator.nav.button.selected.background"), ";\n color: ").concat(dt("paginator.nav.button.selected.color"), ";\n}\n\n.p-paginator-current {\n color: ").concat(dt("paginator.current.page.report.color"), ";\n}\n\n.p-paginator-pages {\n display: flex;\n align-items: center;\n gap: ").concat(dt("paginator.gap"), ";\n}\n\n.p-paginator-jtp-input .p-inputtext {\n max-width: ").concat(dt("paginator.jump.to.page.input.max.width"), ";\n}\n\n.p-paginator-first:dir(rtl),\n.p-paginator-prev:dir(rtl),\n.p-paginator-next:dir(rtl),\n.p-paginator-last:dir(rtl) {\n transform: rotate(180deg);\n}\n"); }, "theme"); var classes$2 = { paginator: /* @__PURE__ */ __name(function paginator(_ref2) { @@ -336,7 +332,7 @@ var classes$2 = { current: "p-paginator-current", pcRowPerPageDropdown: "p-paginator-rpp-dropdown", pcJumpToPageDropdown: "p-paginator-jtp-dropdown", - pcJumpToPageInput: "p-paginator-jtp-input" + pcJumpToPageInputText: "p-paginator-jtp-input" }; var PaginatorStyle = BaseStyle.extend({ name: "paginator", @@ -347,13 +343,6 @@ var script$o = { name: "AngleDoubleLeftIcon", "extends": script$t }; -var _hoisted_1$g = /* @__PURE__ */ createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M5.71602 11.164C5.80782 11.2021 5.9063 11.2215 6.00569 11.221C6.20216 11.2301 6.39427 11.1612 6.54025 11.0294C6.68191 10.8875 6.76148 10.6953 6.76148 10.4948C6.76148 10.2943 6.68191 10.1021 6.54025 9.96024L3.51441 6.9344L6.54025 3.90855C6.624 3.76126 6.65587 3.59011 6.63076 3.42254C6.60564 3.25498 6.525 3.10069 6.40175 2.98442C6.2785 2.86815 6.11978 2.79662 5.95104 2.7813C5.78229 2.76598 5.61329 2.80776 5.47112 2.89994L1.97123 6.39983C1.82957 6.54167 1.75 6.73393 1.75 6.9344C1.75 7.13486 1.82957 7.32712 1.97123 7.46896L5.47112 10.9991C5.54096 11.0698 5.62422 11.1259 5.71602 11.164ZM11.0488 10.9689C11.1775 11.1156 11.3585 11.2061 11.5531 11.221C11.7477 11.2061 11.9288 11.1156 12.0574 10.9689C12.1815 10.8302 12.25 10.6506 12.25 10.4645C12.25 10.2785 12.1815 10.0989 12.0574 9.96024L9.03158 6.93439L12.0574 3.90855C12.1248 3.76739 12.1468 3.60881 12.1204 3.45463C12.0939 3.30045 12.0203 3.15826 11.9097 3.04765C11.7991 2.93703 11.6569 2.86343 11.5027 2.83698C11.3486 2.81053 11.19 2.83252 11.0488 2.89994L7.51865 6.36957C7.37699 6.51141 7.29742 6.70367 7.29742 6.90414C7.29742 7.1046 7.37699 7.29686 7.51865 7.4387L11.0488 10.9689Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$d = [_hoisted_1$g]; function render$n(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", @@ -361,7 +350,12 @@ function render$n(_ctx, _cache, $props, $setup, $data, $options) { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$d, 16); + }, _ctx.pti()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M5.71602 11.164C5.80782 11.2021 5.9063 11.2215 6.00569 11.221C6.20216 11.2301 6.39427 11.1612 6.54025 11.0294C6.68191 10.8875 6.76148 10.6953 6.76148 10.4948C6.76148 10.2943 6.68191 10.1021 6.54025 9.96024L3.51441 6.9344L6.54025 3.90855C6.624 3.76126 6.65587 3.59011 6.63076 3.42254C6.60564 3.25498 6.525 3.10069 6.40175 2.98442C6.2785 2.86815 6.11978 2.79662 5.95104 2.7813C5.78229 2.76598 5.61329 2.80776 5.47112 2.89994L1.97123 6.39983C1.82957 6.54167 1.75 6.73393 1.75 6.9344C1.75 7.13486 1.82957 7.32712 1.97123 7.46896L5.47112 10.9991C5.54096 11.0698 5.62422 11.1259 5.71602 11.164ZM11.0488 10.9689C11.1775 11.1156 11.3585 11.2061 11.5531 11.221C11.7477 11.2061 11.9288 11.1156 12.0574 10.9689C12.1815 10.8302 12.25 10.6506 12.25 10.4645C12.25 10.2785 12.1815 10.0989 12.0574 9.96024L9.03158 6.93439L12.0574 3.90855C12.1248 3.76739 12.1468 3.60881 12.1204 3.45463C12.0939 3.30045 12.0203 3.15826 11.9097 3.04765C11.7991 2.93703 11.6569 2.86343 11.5027 2.83698C11.3486 2.81053 11.19 2.83252 11.0488 2.89994L7.51865 6.36957C7.37699 6.51141 7.29742 6.70367 7.29742 6.90414C7.29742 7.1046 7.37699 7.29686 7.51865 7.4387L11.0488 10.9689Z", + fill: "currentColor" + }, null, -1)]), 16); } __name(render$n, "render$n"); script$o.render = render$n; @@ -369,13 +363,6 @@ var script$n = { name: "AngleDoubleRightIcon", "extends": script$t }; -var _hoisted_1$f = /* @__PURE__ */ createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M7.68757 11.1451C7.7791 11.1831 7.8773 11.2024 7.9764 11.2019C8.07769 11.1985 8.17721 11.1745 8.26886 11.1312C8.36052 11.088 8.44238 11.0265 8.50943 10.9505L12.0294 7.49085C12.1707 7.34942 12.25 7.15771 12.25 6.95782C12.25 6.75794 12.1707 6.56622 12.0294 6.42479L8.50943 2.90479C8.37014 2.82159 8.20774 2.78551 8.04633 2.80192C7.88491 2.81833 7.73309 2.88635 7.6134 2.99588C7.4937 3.10541 7.41252 3.25061 7.38189 3.40994C7.35126 3.56927 7.37282 3.73423 7.44337 3.88033L10.4605 6.89748L7.44337 9.91463C7.30212 10.0561 7.22278 10.2478 7.22278 10.4477C7.22278 10.6475 7.30212 10.8393 7.44337 10.9807C7.51301 11.0512 7.59603 11.1071 7.68757 11.1451ZM1.94207 10.9505C2.07037 11.0968 2.25089 11.1871 2.44493 11.2019C2.63898 11.1871 2.81949 11.0968 2.94779 10.9505L6.46779 7.49085C6.60905 7.34942 6.68839 7.15771 6.68839 6.95782C6.68839 6.75793 6.60905 6.56622 6.46779 6.42479L2.94779 2.90479C2.80704 2.83757 2.6489 2.81563 2.49517 2.84201C2.34143 2.86839 2.19965 2.94178 2.08936 3.05207C1.97906 3.16237 1.90567 3.30415 1.8793 3.45788C1.85292 3.61162 1.87485 3.76975 1.94207 3.9105L4.95922 6.92765L1.94207 9.9448C1.81838 10.0831 1.75 10.2621 1.75 10.4477C1.75 10.6332 1.81838 10.8122 1.94207 10.9505Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$c = [_hoisted_1$f]; function render$m(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", @@ -383,7 +370,12 @@ function render$m(_ctx, _cache, $props, $setup, $data, $options) { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$c, 16); + }, _ctx.pti()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M7.68757 11.1451C7.7791 11.1831 7.8773 11.2024 7.9764 11.2019C8.07769 11.1985 8.17721 11.1745 8.26886 11.1312C8.36052 11.088 8.44238 11.0265 8.50943 10.9505L12.0294 7.49085C12.1707 7.34942 12.25 7.15771 12.25 6.95782C12.25 6.75794 12.1707 6.56622 12.0294 6.42479L8.50943 2.90479C8.37014 2.82159 8.20774 2.78551 8.04633 2.80192C7.88491 2.81833 7.73309 2.88635 7.6134 2.99588C7.4937 3.10541 7.41252 3.25061 7.38189 3.40994C7.35126 3.56927 7.37282 3.73423 7.44337 3.88033L10.4605 6.89748L7.44337 9.91463C7.30212 10.0561 7.22278 10.2478 7.22278 10.4477C7.22278 10.6475 7.30212 10.8393 7.44337 10.9807C7.51301 11.0512 7.59603 11.1071 7.68757 11.1451ZM1.94207 10.9505C2.07037 11.0968 2.25089 11.1871 2.44493 11.2019C2.63898 11.1871 2.81949 11.0968 2.94779 10.9505L6.46779 7.49085C6.60905 7.34942 6.68839 7.15771 6.68839 6.95782C6.68839 6.75793 6.60905 6.56622 6.46779 6.42479L2.94779 2.90479C2.80704 2.83757 2.6489 2.81563 2.49517 2.84201C2.34143 2.86839 2.19965 2.94178 2.08936 3.05207C1.97906 3.16237 1.90567 3.30415 1.8793 3.45788C1.85292 3.61162 1.87485 3.76975 1.94207 3.9105L4.95922 6.92765L1.94207 9.9448C1.81838 10.0831 1.75 10.2621 1.75 10.4477C1.75 10.6332 1.81838 10.8122 1.94207 10.9505Z", + fill: "currentColor" + }, null, -1)]), 16); } __name(render$m, "render$m"); script$n.render = render$m; @@ -391,11 +383,6 @@ var script$m = { name: "AngleLeftIcon", "extends": script$t }; -var _hoisted_1$e = /* @__PURE__ */ createBaseVNode("path", { - d: "M8.75 11.185C8.65146 11.1854 8.55381 11.1662 8.4628 11.1284C8.37179 11.0906 8.28924 11.0351 8.22 10.965L4.72 7.46496C4.57955 7.32433 4.50066 7.13371 4.50066 6.93496C4.50066 6.73621 4.57955 6.54558 4.72 6.40496L8.22 2.93496C8.36095 2.84357 8.52851 2.80215 8.69582 2.81733C8.86312 2.83252 9.02048 2.90344 9.14268 3.01872C9.26487 3.134 9.34483 3.28696 9.36973 3.4531C9.39463 3.61924 9.36303 3.78892 9.28 3.93496L6.28 6.93496L9.28 9.93496C9.42045 10.0756 9.49934 10.2662 9.49934 10.465C9.49934 10.6637 9.42045 10.8543 9.28 10.995C9.13526 11.1257 8.9448 11.1939 8.75 11.185Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$b = [_hoisted_1$e]; function render$l(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", @@ -403,7 +390,10 @@ function render$l(_ctx, _cache, $props, $setup, $data, $options) { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$b, 16); + }, _ctx.pti()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + d: "M8.75 11.185C8.65146 11.1854 8.55381 11.1662 8.4628 11.1284C8.37179 11.0906 8.28924 11.0351 8.22 10.965L4.72 7.46496C4.57955 7.32433 4.50066 7.13371 4.50066 6.93496C4.50066 6.73621 4.57955 6.54558 4.72 6.40496L8.22 2.93496C8.36095 2.84357 8.52851 2.80215 8.69582 2.81733C8.86312 2.83252 9.02048 2.90344 9.14268 3.01872C9.26487 3.134 9.34483 3.28696 9.36973 3.4531C9.39463 3.61924 9.36303 3.78892 9.28 3.93496L6.28 6.93496L9.28 9.93496C9.42045 10.0756 9.49934 10.2662 9.49934 10.465C9.49934 10.6637 9.42045 10.8543 9.28 10.995C9.13526 11.1257 8.9448 11.1939 8.75 11.185Z", + fill: "currentColor" + }, null, -1)]), 16); } __name(render$l, "render$l"); script$m.render = render$l; @@ -643,12 +633,12 @@ function render$6$1(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createBlock(_component_JTPInput, { ref: "jtpInput", modelValue: $data.d_page, - "class": normalizeClass(_ctx.cx("pcJumpToPageInput")), + "class": normalizeClass(_ctx.cx("pcJumpToPageInputText")), "aria-label": $options.inputArialabel, disabled: $props.disabled, "onUpdate:modelValue": $options.onChange, unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcJumpToPageInput") + pt: _ctx.ptm("pcJumpToPageInputText") }, null, 8, ["modelValue", "class", "aria-label", "disabled", "onUpdate:modelValue", "unstyled", "pt"]); } __name(render$6$1, "render$6$1"); @@ -763,7 +753,7 @@ var script$3$1 = { ripple: Ripple } }; -var _hoisted_1$d = ["aria-label", "aria-current", "onClick", "data-p-active"]; +var _hoisted_1$6 = ["aria-label", "aria-current", "onClick", "data-p-active"]; function render$3$1(_ctx, _cache, $props, $setup, $data, $options) { var _directive_ripple = resolveDirective("ripple"); return openBlock(), createElementBlock("span", mergeProps({ @@ -783,7 +773,7 @@ function render$3$1(_ctx, _cache, $props, $setup, $data, $options) { ref_for: true }, $options.getPTOptions(pageLink - 1, "page"), { "data-p-active": pageLink - 1 === $props.page - }), [createTextVNode(toDisplayString(pageLink), 1)], 16, _hoisted_1$d)), [[_directive_ripple]]); + }), [createTextVNode(toDisplayString(pageLink), 1)], 16, _hoisted_1$6)), [[_directive_ripple]]); }), 128))], 16); } __name(render$3$1, "render$3$1"); @@ -890,22 +880,6 @@ function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$1$1, "render$1$1"); script$1$2.render = render$1$1; -function _toConsumableArray$1(r) { - return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$3(r) || _nonIterableSpread$1(); -} -__name(_toConsumableArray$1, "_toConsumableArray$1"); -function _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."); -} -__name(_nonIterableSpread$1, "_nonIterableSpread$1"); -function _iterableToArray$1(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$1, "_iterableToArray$1"); -function _arrayWithoutHoles$1(r) { - if (Array.isArray(r)) return _arrayLikeToArray$3(r); -} -__name(_arrayWithoutHoles$1, "_arrayWithoutHoles$1"); function _typeof$b(o) { "@babel/helpers - typeof"; return _typeof$b = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { @@ -988,7 +962,6 @@ var script$l = { }, "totalRecords") }, mounted: /* @__PURE__ */ __name(function mounted2() { - this.setPaginatorAttribute(); this.createStyle(); }, "mounted"), methods: { @@ -1042,7 +1015,7 @@ var script$l = { this.styleElement = document.createElement("style"); this.styleElement.type = "text/css"; 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); - document.head.appendChild(this.styleElement); + document.body.appendChild(this.styleElement); var innerHTML = ""; var keys = Object.keys(this.template); var sortedBreakpoints = {}; @@ -1061,9 +1034,9 @@ var script$l = { } minValue = Object.entries(sortedBreakpoints)[index - 1] ? "and (min-width:".concat(calculatedMinValue, ")") : ""; if (key === "default") { - innerHTML += "\n @media screen ".concat(minValue, " {\n .paginator[").concat(this.attributeSelector, "],\n display: flex;\n }\n }\n "); + innerHTML += "\n @media screen ".concat(minValue, " {\n .p-paginator[").concat(this.$attrSelector, "],\n display: flex;\n }\n }\n "); } else { - innerHTML += "\n.paginator[".concat(this.attributeSelector, "], .p-paginator-").concat(key, " {\n display: none;\n}\n@media screen ").concat(minValue, " and (max-width: ").concat(key, ") {\n .paginator[").concat(this.attributeSelector, "], .p-paginator-").concat(key, " {\n display: flex;\n }\n .paginator[").concat(this.attributeSelector, "],\n .p-paginator-default{\n display: none;\n }\n}\n "); + innerHTML += "\n.p-paginator-".concat(key, " {\n display: none;\n}\n@media screen ").concat(minValue, " and (max-width: ").concat(key, ") {\n .p-paginator-").concat(key, " {\n display: flex;\n }\n\n .p-paginator-default{\n display: none;\n }\n}\n "); } } this.styleElement.innerHTML = innerHTML; @@ -1072,14 +1045,6 @@ var script$l = { hasBreakpoints: /* @__PURE__ */ __name(function hasBreakpoints() { return _typeof$b(this.template) === "object"; }, "hasBreakpoints"), - setPaginatorAttribute: /* @__PURE__ */ __name(function setPaginatorAttribute() { - var _this2 = this; - if (this.$refs.paginator && this.$refs.paginator.length >= 0) { - _toConsumableArray$1(this.$refs.paginator).forEach(function(el) { - el.setAttribute(_this2.attributeSelector, ""); - }); - } - }, "setPaginatorAttribute"), getAriaLabel: /* @__PURE__ */ __name(function getAriaLabel(labelType) { return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria[labelType] : void 0; }, "getAriaLabel") @@ -1148,9 +1113,9 @@ var script$l = { currentPage: /* @__PURE__ */ __name(function currentPage() { return this.pageCount > 0 ? this.page + 1 : 0; }, "currentPage"), - attributeSelector: /* @__PURE__ */ __name(function attributeSelector() { - return UniqueComponentId(); - }, "attributeSelector") + last: /* @__PURE__ */ __name(function last2() { + return Math.min(this.d_first + this.rows, this.totalRecords); + }, "last") }, components: { CurrentPageReport: script$9$1, @@ -1184,7 +1149,22 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) { "class": _ctx.cx("paginator", { key }) - }, _ctx.ptm("root")), [_ctx.$slots.start ? (openBlock(), createElementBlock("div", mergeProps({ + }, _ctx.ptm("root")), [_ctx.$slots.container ? renderSlot(_ctx.$slots, "container", { + key: 0, + first: $data.d_first + 1, + last: $options.last, + rows: $data.d_rows, + page: $options.page, + pageCount: $options.pageCount, + totalRecords: _ctx.totalRecords, + firstPageCallback: $options.changePageToFirst, + lastPageCallback: $options.changePageToLast, + prevPageCallback: $options.changePageToPrev, + nextPageCallback: $options.changePageToNext, + rowChangeCallback: $options.onRowChange + }) : (openBlock(), createElementBlock(Fragment, { + key: 1 + }, [_ctx.$slots.start ? (openBlock(), createElementBlock("div", mergeProps({ key: 0, "class": _ctx.cx("contentStart"), ref_for: true @@ -1298,14 +1278,14 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) { ref_for: true }, _ctx.ptm("contentEnd")), [renderSlot(_ctx.$slots, "end", { state: $options.currentState - })], 16)) : createCommentVNode("", true)], 16); + })], 16)) : createCommentVNode("", true)], 64))], 16); }), 128))], 16)) : createCommentVNode("", true); } __name(render$k, "render$k"); script$l.render = render$k; var theme$1 = /* @__PURE__ */ __name(function theme2(_ref) { var dt = _ref.dt; - return "\n.p-datatable {\n position: relative;\n}\n\n.p-datatable-table {\n border-spacing: 0;\n width: 100%;\n}\n\n.p-datatable-scrollable > .p-datatable-table-container {\n position: relative;\n}\n\n.p-datatable-scrollable-table > .p-datatable-thead {\n top: 0;\n z-index: 1;\n}\n\n.p-datatable-scrollable-table > .p-datatable-frozen-tbody {\n position: sticky;\n z-index: 1;\n}\n\n.p-datatable-scrollable-table>.p-datatable-tfoot {\n bottom: 0;\n z-index: 1;\n}\n\n.p-datatable-scrollable .p-datatable-frozen-column {\n position: sticky;\n background: ".concat(dt("datatable.header.cell.background"), ";\n}\n\n.p-datatable-scrollable th.p-datatable-frozen-column {\n z-index: 1;\n}\n\n.p-datatable-scrollable > .p-datatable-table-container > .p-datatable-table > .p-datatable-thead,\n.p-datatable-scrollable > .p-datatable-table-container > .p-virtualscroller > .p-datatable-table > .p-datatable-thead {\n background: ").concat(dt("datatable.header.cell.background"), ";\n}\n\n.p-datatable-scrollable > .p-datatable-table-container > .p-datatable-table > .p-datatable-tfoot,\n.p-datatable-scrollable > .p-datatable-table-container > .p-virtualscroller > .p-datatable-table > .p-datatable-tfoot {\n background: ").concat(dt("datatable.footer.cell.background"), ";\n}\n\n.p-datatable-flex-scrollable {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n.p-datatable-flex-scrollable > .p-datatable-table-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n height: 100%;\n}\n\n.p-datatable-scrollable-table > .p-datatable-tbody > .p-datatable-row-group-header {\n position: sticky;\n z-index: 1;\n}\n\n.p-datatable-resizable-table > .p-datatable-thead > tr > th,\n.p-datatable-resizable-table > .p-datatable-tfoot > tr > td,\n.p-datatable-resizable-table > .p-datatable-tbody > tr > td {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.p-datatable-resizable-table > .p-datatable-thead > tr > th.p-datatable-resizable-column:not(.p-datatable-frozen-column) {\n background-clip: padding-box;\n position: relative;\n}\n\n.p-datatable-resizable-table-fit > .p-datatable-thead > tr > th.p-datatable-resizable-column:last-child .p-datatable-column-resizer {\n display: none;\n}\n\n.p-datatable-column-resizer {\n display: block;\n position: absolute;\n top: 0;\n right: 0;\n margin: 0;\n width: ").concat(dt("datatable.column.resizer.width"), ";\n height: 100%;\n padding: 0px;\n cursor: col-resize;\n border: 1px solid transparent;\n}\n\n.p-datatable-column-header-content {\n display: flex;\n align-items: center;\n gap: ").concat(dt("datatable.header.cell.gap"), ";\n}\n\n.p-datatable-column-resize-indicator {\n width: ").concat(dt("datatable.resize.indicator.width"), ";\n position: absolute;\n z-index: 10;\n display: none;\n background: ").concat(dt("datatable.resize.indicator.color"), ";\n}\n\n.p-datatable-row-reorder-indicator-up,\n.p-datatable-row-reorder-indicator-down {\n position: absolute;\n display: none;\n}\n\n.p-datatable-reorderable-column,\n.p-datatable-reorderable-row-handle {\n cursor: move;\n}\n\n.p-datatable-mask {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 2;\n}\n\n.p-datatable-inline-filter {\n display: flex;\n align-items: center;\n width: 100%;\n gap: ").concat(dt("datatable.filter.inline.gap"), ";\n}\n\n.p-datatable-inline-filter .p-datatable-filter-element-container {\n flex: 1 1 auto;\n width: 1%;\n}\n\n.p-datatable-filter-overlay {\n background: ").concat(dt("datatable.filter.overlay.select.background"), ";\n color: ").concat(dt("datatable.filter.overlay.select.color"), ";\n border: 1px solid ").concat(dt("datatable.filter.overlay.select.border.color"), ";\n border-radius: ").concat(dt("datatable.filter.overlay.select.border.radius"), ";\n box-shadow: ").concat(dt("datatable.filter.overlay.select.shadow"), ";\n min-width: 12.5rem;\n}\n\n.p-datatable-filter-constraint-list {\n margin: 0;\n list-style: none;\n display: flex;\n flex-direction: column;\n padding: ").concat(dt("datatable.filter.constraint.list.padding"), ";\n gap: ").concat(dt("datatable.filter.constraint.list.gap"), ";\n}\n\n.p-datatable-filter-constraint {\n padding: ").concat(dt("datatable.filter.constraint.padding"), ";\n color: ").concat(dt("datatable.filter.constraint.color"), ";\n border-radius: ").concat(dt("datatable.filter.constraint.border.radius"), ";\n cursor: pointer;\n transition: background ").concat(dt("datatable.transition.duration"), ", color ").concat(dt("datatable.transition.duration"), ", border-color ").concat(dt("datatable.transition.duration"), ",\n box-shadow ").concat(dt("datatable.transition.duration"), ";\n}\n\n.p-datatable-filter-constraint-selected {\n background: ").concat(dt("datatable.filter.constraint.selected.background"), ";\n color: ").concat(dt("datatable.filter.constraint.selected.color"), ";\n}\n\n.p-datatable-filter-constraint:not(.p-datatable-filter-constraint-selected):not(.p-disabled):hover {\n background: ").concat(dt("datatable.filter.constraint.focus.background"), ";\n color: ").concat(dt("datatable.filter.constraint.focus.color"), ";\n}\n\n.p-datatable-filter-constraint:focus-visible {\n outline: 0 none;\n background: ").concat(dt("datatable.filter.constraint.focus.background"), ";\n color: ").concat(dt("datatable.filter.constraint.focus.color"), ";\n}\n\n.p-datatable-filter-constraint-selected:focus-visible {\n outline: 0 none;\n background: ").concat(dt("datatable.filter.constraint.selected.focus.background"), ";\n color: ").concat(dt("datatable.filter.constraint.selected.focus.color"), ";\n}\n\n.p-datatable-filter-constraint-separator {\n border-top: 1px solid ").concat(dt("datatable.filter.constraint.separator.border.color"), ";\n}\n\n.p-datatable-popover-filter {\n display: inline-flex;\n margin-left: auto;\n}\n\n.p-datatable-filter-overlay-popover {\n background: ").concat(dt("datatable.filter.overlay.popover.background"), ";\n color: ").concat(dt("datatable.filter.overlay.popover.color"), ";\n border: 1px solid ").concat(dt("datatable.filter.overlay.popover.border.color"), ";\n border-radius: ").concat(dt("datatable.filter.overlay.popover.border.radius"), ";\n box-shadow: ").concat(dt("datatable.filter.overlay.popover.shadow"), ";\n min-width: 12.5rem;\n padding: ").concat(dt("datatable.filter.overlay.popover.padding"), ";\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("datatable.filter.overlay.popover.gap"), ";\n}\n\n.p-datatable-filter-operator-dropdown {\n width: 100%;\n}\n\n.p-datatable-filter-rule-list,\n.p-datatable-filter-rule {\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("datatable.filter.overlay.popover.gap"), ";\n}\n\n.p-datatable-filter-rule {\n border-bottom: 1px solid ").concat(dt("datatable.filter.rule.border.color"), ";\n}\n\n.p-datatable-filter-rule:last-child {\n border-bottom: 0 none;\n}\n\n.p-datatable-filter-add-rule-button {\n width: 100%;\n}\n\n.p-datatable-filter-remove-button {\n width: 100%;\n}\n\n.p-datatable-filter-buttonbar {\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.p-datatable-virtualscroller-spacer {\n display: flex;\n}\n\n.p-datatable .p-virtualscroller .p-virtualscroller-loading {\n transform: none !important;\n min-height: 0;\n position: sticky;\n top: 0;\n left: 0;\n}\n\n.p-datatable-paginator-top {\n border-color: ").concat(dt("datatable.paginator.top.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("datatable.paginator.top.border.width"), ";\n}\n\n.p-datatable-paginator-bottom {\n border-color: ").concat(dt("datatable.paginator.bottom.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("datatable.paginator.bottom.border.width"), ";\n}\n\n.p-datatable-header {\n background: ").concat(dt("datatable.header.background"), ";\n color: ").concat(dt("datatable.header.color"), ";\n border-color: ").concat(dt("datatable.header.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("datatable.header.border.width"), ";\n padding: ").concat(dt("datatable.header.padding"), ";\n}\n\n.p-datatable-footer {\n background: ").concat(dt("datatable.footer.background"), ";\n color: ").concat(dt("datatable.footer.color"), ";\n border-color: ").concat(dt("datatable.footer.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("datatable.footer.border.width"), ";\n padding: ").concat(dt("datatable.footer.padding"), ";\n}\n\n.p-datatable-header-cell {\n padding: ").concat(dt("datatable.header.cell.padding"), ";\n background: ").concat(dt("datatable.header.cell.background"), ";\n border-color: ").concat(dt("datatable.header.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n color: ").concat(dt("datatable.header.cell.color"), ";\n font-weight: normal;\n text-align: left;\n transition: background ").concat(dt("datatable.transition.duration"), ", color ").concat(dt("datatable.transition.duration"), ", border-color ").concat(dt("datatable.transition.duration"), ",\n outline-color ").concat(dt("datatable.transition.duration"), ", box-shadow ").concat(dt("datatable.transition.duration"), ";\n}\n\n.p-datatable-column-title {\n font-weight: ").concat(dt("datatable.column.title.font.weight"), ";\n}\n\n.p-datatable-tbody > tr {\n outline-color: transparent;\n background: ").concat(dt("datatable.row.background"), ";\n color: ").concat(dt("datatable.row.color"), ";\n transition: background ").concat(dt("datatable.transition.duration"), ", color ").concat(dt("datatable.transition.duration"), ", border-color ").concat(dt("datatable.transition.duration"), ",\n outline-color ").concat(dt("datatable.transition.duration"), ", box-shadow ").concat(dt("datatable.transition.duration"), ";\n}\n\n.p-datatable-tbody > tr > td {\n text-align: left;\n border-color: ").concat(dt("datatable.body.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n padding: ").concat(dt("datatable.body.cell.padding"), ";\n}\n\n.p-datatable-hoverable .p-datatable-tbody > tr:not(.p-datatable-row-selected):hover {\n background: ").concat(dt("datatable.row.hover.background"), ";\n color: ").concat(dt("datatable.row.hover.color"), ";\n}\n\n.p-datatable-tbody > tr.p-datatable-row-selected {\n background: ").concat(dt("datatable.row.selected.background"), ";\n color: ").concat(dt("datatable.row.selected.color"), ";\n}\n\n.p-datatable-tbody > tr:has(+ .p-datatable-row-selected) > td {\n border-bottom-color: ").concat(dt("datatable.body.cell.selected.border.color"), ";\n}\n\n.p-datatable-tbody > tr.p-datatable-row-selected > td {\n border-bottom-color: ").concat(dt("datatable.body.cell.selected.border.color"), ";\n}\n\n.p-datatable-tbody > tr:focus-visible,\n.p-datatable-tbody > tr.p-datatable-contextmenu-row-selected {\n box-shadow: ").concat(dt("datatable.body.cell.focus.ring.shadow"), ";\n outline: ").concat(dt("datatable.body.cell.focus.ring.width"), " ").concat(dt("datatable.body.cell.focus.ring.style"), " ").concat(dt("datatable.body.cell.focus.ring.color"), ";\n outline-offset: ").concat(dt("datatable.body.cell.focus.ring.offset"), ";\n}\n\n.p-datatable-tfoot > tr > td {\n text-align: left;\n padding: ").concat(dt("datatable.footer.cell.padding"), ";\n border-color: ").concat(dt("datatable.footer.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n color: ").concat(dt("datatable.footer.cell.color"), ";\n background: ").concat(dt("datatable.footer.cell.background"), ";\n}\n\n.p-datatable-column-footer {\n font-weight: ").concat(dt("datatable.column.footer.font.weight"), ";\n}\n\n.p-datatable-sortable-column {\n cursor: pointer;\n user-select: none;\n outline-color: transparent;\n}\n\n.p-datatable-column-title,\n.p-datatable-sort-icon,\n.p-datatable-sort-badge {\n vertical-align: middle;\n}\n\n.p-datatable-sort-icon {\n color: ").concat(dt("datatable.sort.icon.color"), ";\n transition: color ").concat(dt("datatable.transition.duration"), ";\n}\n\n.p-datatable-sortable-column:not(.p-datatable-column-sorted):hover {\n background: ").concat(dt("datatable.header.cell.hover.background"), ";\n color: ").concat(dt("datatable.header.cell.hover.color"), ";\n}\n\n.p-datatable-sortable-column:not(.p-datatable-column-sorted):hover .p-datatable-sort-icon {\n color: ").concat(dt("datatable.sort.icon.hover.color"), ";\n}\n\n.p-datatable-column-sorted {\n background: ").concat(dt("datatable.header.cell.selected.background"), ";\n color: ").concat(dt("datatable.header.cell.selected.color"), ";\n}\n\n.p-datatable-column-sorted .p-datatable-sort-icon {\n color: ").concat(dt("datatable.header.cell.selected.color"), ";\n}\n\n.p-datatable-sortable-column:focus-visible {\n box-shadow: ").concat(dt("datatable.header.cell.focus.ring.shadow"), ";\n outline: ").concat(dt("datatable.header.cell.focus.ring.width"), " ").concat(dt("datatable.header.cell.focus.ring.style"), " ").concat(dt("datatable.header.cell.focus.ring.color"), ";\n outline-offset: ").concat(dt("datatable.header.cell.focus.ring.offset"), ";\n}\n\n.p-datatable-hoverable .p-datatable-selectable-row {\n cursor: pointer;\n}\n\n.p-datatable-tbody > tr.p-datatable-dragpoint-top > td {\n box-shadow: inset 0 2px 0 0 ").concat(dt("datatable.drop.point.color"), ";\n}\n\n.p-datatable-tbody > tr.p-datatable-dragpoint-bottom > td {\n box-shadow: inset 0 -2px 0 0 ").concat(dt("datatable.drop.point.color"), ";\n}\n\n.p-datatable-loading-icon {\n font-size: ").concat(dt("datatable.loading.icon.size"), ";\n width: ").concat(dt("datatable.loading.icon.size"), ";\n height: ").concat(dt("datatable.loading.icon.size"), ";\n}\n\n.p-datatable-gridlines .p-datatable-header {\n border-width: 1px 1px 0 1px;\n}\n\n.p-datatable-gridlines .p-datatable-footer {\n border-width: 0 1px 1px 1px;\n}\n\n.p-datatable-gridlines .p-datatable-paginator-top {\n border-width: 1px 1px 0 1px;\n}\n\n.p-datatable-gridlines .p-datatable-paginator-bottom {\n border-width: 0 1px 1px 1px;\n}\n\n.p-datatable-gridlines .p-datatable-thead > tr > th {\n border-width: 1px 0 1px 1px;\n}\n\n.p-datatable-gridlines .p-datatable-thead > tr > th:last-child {\n border-width: 1px;\n}\n\n.p-datatable-gridlines .p-datatable-tbody > tr > td {\n border-width: 1px 0 0 1px;\n}\n\n.p-datatable-gridlines .p-datatable-tbody > tr > td:last-child {\n border-width: 1px 1px 0 1px;\n}\n\np-datatable-gridlines .p-datatable-tbody > tr:last-child > td {\n border-width: 1px 0 1px 1px;\n}\n\n.p-datatable-gridlines .p-datatable-tbody > tr:last-child > td:last-child {\n border-width: 1px;\n}\n\n.p-datatable-gridlines .p-datatable-tfoot > tr > td {\n border-width: 1px 0 1px 1px;\n}\n\n.p-datatable-gridlines .p-datatable-tfoot > tr > td:last-child {\n border-width: 1px 1px 1px 1px;\n}\n\n.p-datatable.p-datatable-gridlines .p-datatable-thead + .p-datatable-tfoot > tr > td {\n border-width: 0 0 1px 1px;\n}\n\n.p-datatable.p-datatable-gridlines .p-datatable-thead + .p-datatable-tfoot > tr > td:last-child {\n border-width: 0 1px 1px 1px;\n}\n\n.p-datatable.p-datatable-gridlines:has(.p-datatable-thead):has(.p-datatable-tbody) .p-datatable-tbody > tr > td {\n border-width: 0 0 1px 1px;\n}\n\n.p-datatable.p-datatable-gridlines:has(.p-datatable-thead):has(.p-datatable-tbody) .p-datatable-tbody > tr > td:last-child {\n border-width: 0 1px 1px 1px;\n}\n\n.p-datatable.p-datatable-gridlines:has(.p-datatable-tbody):has(.p-datatable-tfoot) .p-datatable-tbody > tr:last-child > td {\n border-width: 0 0 0 1px;\n}\n\n.p-datatable.p-datatable-gridlines:has(.p-datatable-tbody):has(.p-datatable-tfoot) .p-datatable-tbody > tr:last-child > td:last-child {\n border-width: 0 1px 0 1px;\n}\n\n.p-datatable.p-datatable-striped .p-datatable-tbody > tr.p-row-odd {\n background: ").concat(dt("datatable.row.striped.background"), ";\n}\n\n.p-datatable.p-datatable-striped .p-datatable-tbody > tr.p-row-odd.p-datatable-row-selected {\n background: ").concat(dt("datatable.row.selected.background"), ";\n color: ").concat(dt("datatable.row.selected.color"), ";\n}\n\n.p-datatable.p-datatable-sm .p-datatable-header {\n padding: 0.375rem 0.5rem;\n}\n\n.p-datatable.p-datatable-sm .p-datatable-thead > tr > th {\n padding: 0.375rem 0.5rem;\n}\n\n.p-datatable.p-datatable-sm .p-datatable-tbody > tr > td {\n padding: 0.375rem 0.5rem;\n}\n\n.p-datatable.p-datatable-sm .p-datatable-tfoot > tr > td {\n padding: 0.375rem 0.5rem;\n}\n\n.p-datatable.p-datatable-sm .p-datatable-footer {\n padding: 0.375rem 0.5rem;\n}\n\n.p-datatable.p-datatable-lg .p-datatable-header {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-datatable.p-datatable-lg .p-datatable-thead > tr > th {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-datatable.p-datatable-lg .p-datatable-tbody>tr>td {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-datatable.p-datatable-lg .p-datatable-tfoot>tr>td {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-datatable.p-datatable-lg .p-datatable-footer {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-datatable-row-toggle-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n width: ").concat(dt("datatable.row.toggle.button.size"), ";\n height: ").concat(dt("datatable.row.toggle.button.size"), ";\n color: ").concat(dt("datatable.row.toggle.button.color"), ";\n border: 0 none;\n background: transparent;\n cursor: pointer;\n border-radius: ").concat(dt("datatable.row.toggle.button.border.radius"), ";\n transition: background ").concat(dt("datatable.transition.duration"), ", color ").concat(dt("datatable.transition.duration"), ", border-color ").concat(dt("datatable.transition.duration"), ",\n outline-color ").concat(dt("datatable.transition.duration"), ", box-shadow ").concat(dt("datatable.transition.duration"), ";\n outline-color: transparent;\n user-select: none;\n}\n\n.p-datatable-row-toggle-button:enabled:hover {\n color: ").concat(dt("datatable.row.toggle.button.hover.color"), ";\n background: ").concat(dt("datatable.row.toggle.button.hover.background"), ";\n}\n\n.p-datatable-tbody > tr.p-datatable-row-selected .p-datatable-row-toggle-button:hover {\n background: ").concat(dt("datatable.row.toggle.button.selected.hover.background"), ";\n ").concat(dt("datatable.row.toggle.button.selected.hover.color"), ";\n}\n\n.p-datatable-row-toggle-button:focus-visible {\n box-shadow: ").concat(dt("datatable.row.toggle.button.focus.ring.shadow"), ";\n outline: ").concat(dt("datatable.row.toggle.button.focus.ring.width"), " ").concat(dt("datatable.row.toggle.button.focus.ring.style"), " ").concat(dt("datatable.row.toggle.button.focus.ring.color"), ";\n outline-offset: ").concat(dt("datatable.row.toggle.button.focus.ring.offset"), ";\n}\n"); + return "\n.p-datatable {\n position: relative;\n}\n\n.p-datatable-table {\n border-spacing: 0;\n border-collapse: separate;\n width: 100%;\n}\n\n.p-datatable-scrollable > .p-datatable-table-container {\n position: relative;\n}\n\n.p-datatable-scrollable-table > .p-datatable-thead {\n inset-block-start: 0;\n z-index: 1;\n}\n\n.p-datatable-scrollable-table > .p-datatable-frozen-tbody {\n position: sticky;\n z-index: 1;\n}\n\n.p-datatable-scrollable-table > .p-datatable-tfoot {\n inset-block-end: 0;\n z-index: 1;\n}\n\n.p-datatable-scrollable .p-datatable-frozen-column {\n position: sticky;\n background: ".concat(dt("datatable.header.cell.background"), ";\n}\n\n.p-datatable-scrollable th.p-datatable-frozen-column {\n z-index: 1;\n}\n\n.p-datatable-scrollable > .p-datatable-table-container > .p-datatable-table > .p-datatable-thead,\n.p-datatable-scrollable > .p-datatable-table-container > .p-virtualscroller > .p-datatable-table > .p-datatable-thead {\n background: ").concat(dt("datatable.header.cell.background"), ";\n}\n\n.p-datatable-scrollable > .p-datatable-table-container > .p-datatable-table > .p-datatable-tfoot,\n.p-datatable-scrollable > .p-datatable-table-container > .p-virtualscroller > .p-datatable-table > .p-datatable-tfoot {\n background: ").concat(dt("datatable.footer.cell.background"), ";\n}\n\n.p-datatable-flex-scrollable {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n.p-datatable-flex-scrollable > .p-datatable-table-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n height: 100%;\n}\n\n.p-datatable-scrollable-table > .p-datatable-tbody > .p-datatable-row-group-header {\n position: sticky;\n z-index: 1;\n}\n\n.p-datatable-resizable-table > .p-datatable-thead > tr > th,\n.p-datatable-resizable-table > .p-datatable-tfoot > tr > td,\n.p-datatable-resizable-table > .p-datatable-tbody > tr > td {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.p-datatable-resizable-table > .p-datatable-thead > tr > th.p-datatable-resizable-column:not(.p-datatable-frozen-column) {\n background-clip: padding-box;\n position: relative;\n}\n\n.p-datatable-resizable-table-fit > .p-datatable-thead > tr > th.p-datatable-resizable-column:last-child .p-datatable-column-resizer {\n display: none;\n}\n\n.p-datatable-column-resizer {\n display: block;\n position: absolute;\n inset-block-start: 0;\n inset-inline-end: 0;\n margin: 0;\n width: ").concat(dt("datatable.column.resizer.width"), ";\n height: 100%;\n padding: 0;\n cursor: col-resize;\n border: 1px solid transparent;\n}\n\n.p-datatable-column-header-content {\n display: flex;\n align-items: center;\n gap: ").concat(dt("datatable.header.cell.gap"), ";\n}\n\n.p-datatable-column-resize-indicator {\n width: ").concat(dt("datatable.resize.indicator.width"), ";\n position: absolute;\n z-index: 10;\n display: none;\n background: ").concat(dt("datatable.resize.indicator.color"), ";\n}\n\n.p-datatable-row-reorder-indicator-up,\n.p-datatable-row-reorder-indicator-down {\n position: absolute;\n display: none;\n}\n\n.p-datatable-reorderable-column,\n.p-datatable-reorderable-row-handle {\n cursor: move;\n}\n\n.p-datatable-mask {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 2;\n}\n\n.p-datatable-inline-filter {\n display: flex;\n align-items: center;\n width: 100%;\n gap: ").concat(dt("datatable.filter.inline.gap"), ";\n}\n\n.p-datatable-inline-filter .p-datatable-filter-element-container {\n flex: 1 1 auto;\n width: 1%;\n}\n\n.p-datatable-filter-overlay {\n background: ").concat(dt("datatable.filter.overlay.select.background"), ";\n color: ").concat(dt("datatable.filter.overlay.select.color"), ";\n border: 1px solid ").concat(dt("datatable.filter.overlay.select.border.color"), ";\n border-radius: ").concat(dt("datatable.filter.overlay.select.border.radius"), ";\n box-shadow: ").concat(dt("datatable.filter.overlay.select.shadow"), ";\n min-width: 12.5rem;\n}\n\n.p-datatable-filter-constraint-list {\n margin: 0;\n list-style: none;\n display: flex;\n flex-direction: column;\n padding: ").concat(dt("datatable.filter.constraint.list.padding"), ";\n gap: ").concat(dt("datatable.filter.constraint.list.gap"), ";\n}\n\n.p-datatable-filter-constraint {\n padding: ").concat(dt("datatable.filter.constraint.padding"), ";\n color: ").concat(dt("datatable.filter.constraint.color"), ";\n border-radius: ").concat(dt("datatable.filter.constraint.border.radius"), ";\n cursor: pointer;\n transition: background ").concat(dt("datatable.transition.duration"), ", color ").concat(dt("datatable.transition.duration"), ", border-color ").concat(dt("datatable.transition.duration"), ",\n box-shadow ").concat(dt("datatable.transition.duration"), ";\n}\n\n.p-datatable-filter-constraint-selected {\n background: ").concat(dt("datatable.filter.constraint.selected.background"), ";\n color: ").concat(dt("datatable.filter.constraint.selected.color"), ";\n}\n\n.p-datatable-filter-constraint:not(.p-datatable-filter-constraint-selected):not(.p-disabled):hover {\n background: ").concat(dt("datatable.filter.constraint.focus.background"), ";\n color: ").concat(dt("datatable.filter.constraint.focus.color"), ";\n}\n\n.p-datatable-filter-constraint:focus-visible {\n outline: 0 none;\n background: ").concat(dt("datatable.filter.constraint.focus.background"), ";\n color: ").concat(dt("datatable.filter.constraint.focus.color"), ";\n}\n\n.p-datatable-filter-constraint-selected:focus-visible {\n outline: 0 none;\n background: ").concat(dt("datatable.filter.constraint.selected.focus.background"), ";\n color: ").concat(dt("datatable.filter.constraint.selected.focus.color"), ";\n}\n\n.p-datatable-filter-constraint-separator {\n border-block-start: 1px solid ").concat(dt("datatable.filter.constraint.separator.border.color"), ";\n}\n\n.p-datatable-popover-filter {\n display: inline-flex;\n margin-inline-start: auto;\n}\n\n.p-datatable-filter-overlay-popover {\n background: ").concat(dt("datatable.filter.overlay.popover.background"), ";\n color: ").concat(dt("datatable.filter.overlay.popover.color"), ";\n border: 1px solid ").concat(dt("datatable.filter.overlay.popover.border.color"), ";\n border-radius: ").concat(dt("datatable.filter.overlay.popover.border.radius"), ";\n box-shadow: ").concat(dt("datatable.filter.overlay.popover.shadow"), ";\n min-width: 12.5rem;\n padding: ").concat(dt("datatable.filter.overlay.popover.padding"), ";\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("datatable.filter.overlay.popover.gap"), ";\n}\n\n.p-datatable-filter-operator-dropdown {\n width: 100%;\n}\n\n.p-datatable-filter-rule-list,\n.p-datatable-filter-rule {\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("datatable.filter.overlay.popover.gap"), ";\n}\n\n.p-datatable-filter-rule {\n border-block-end: 1px solid ").concat(dt("datatable.filter.rule.border.color"), ";\n padding-bottom: ").concat(dt("datatable.filter.overlay.popover.gap"), ";\n}\n\n.p-datatable-filter-rule:last-child {\n border-block-end: 0 none;\n padding-bottom: 0;\n}\n\n.p-datatable-filter-add-rule-button {\n width: 100%;\n}\n\n.p-datatable-filter-remove-rule-button {\n width: 100%;\n}\n\n.p-datatable-filter-buttonbar {\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.p-datatable-virtualscroller-spacer {\n display: flex;\n}\n\n.p-datatable .p-virtualscroller .p-virtualscroller-loading {\n transform: none !important;\n min-height: 0;\n position: sticky;\n inset-block-start: 0;\n inset-inline-start: 0;\n}\n\n.p-datatable-paginator-top {\n border-color: ").concat(dt("datatable.paginator.top.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("datatable.paginator.top.border.width"), ";\n}\n\n.p-datatable-paginator-bottom {\n border-color: ").concat(dt("datatable.paginator.bottom.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("datatable.paginator.bottom.border.width"), ";\n}\n\n.p-datatable-header {\n background: ").concat(dt("datatable.header.background"), ";\n color: ").concat(dt("datatable.header.color"), ";\n border-color: ").concat(dt("datatable.header.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("datatable.header.border.width"), ";\n padding: ").concat(dt("datatable.header.padding"), ";\n}\n\n.p-datatable-footer {\n background: ").concat(dt("datatable.footer.background"), ";\n color: ").concat(dt("datatable.footer.color"), ";\n border-color: ").concat(dt("datatable.footer.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("datatable.footer.border.width"), ";\n padding: ").concat(dt("datatable.footer.padding"), ";\n}\n\n.p-datatable-header-cell {\n padding: ").concat(dt("datatable.header.cell.padding"), ";\n background: ").concat(dt("datatable.header.cell.background"), ";\n border-color: ").concat(dt("datatable.header.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n color: ").concat(dt("datatable.header.cell.color"), ";\n font-weight: normal;\n text-align: start;\n transition: background ").concat(dt("datatable.transition.duration"), ", color ").concat(dt("datatable.transition.duration"), ", border-color ").concat(dt("datatable.transition.duration"), ",\n outline-color ").concat(dt("datatable.transition.duration"), ", box-shadow ").concat(dt("datatable.transition.duration"), ";\n}\n\n.p-datatable-column-title {\n font-weight: ").concat(dt("datatable.column.title.font.weight"), ";\n}\n\n.p-datatable-tbody > tr {\n outline-color: transparent;\n background: ").concat(dt("datatable.row.background"), ";\n color: ").concat(dt("datatable.row.color"), ";\n transition: background ").concat(dt("datatable.transition.duration"), ", color ").concat(dt("datatable.transition.duration"), ", border-color ").concat(dt("datatable.transition.duration"), ",\n outline-color ").concat(dt("datatable.transition.duration"), ", box-shadow ").concat(dt("datatable.transition.duration"), ";\n}\n\n.p-datatable-tbody > tr > td {\n text-align: start;\n border-color: ").concat(dt("datatable.body.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n padding: ").concat(dt("datatable.body.cell.padding"), ";\n}\n\n.p-datatable-hoverable .p-datatable-tbody > tr:not(.p-datatable-row-selected):hover {\n background: ").concat(dt("datatable.row.hover.background"), ";\n color: ").concat(dt("datatable.row.hover.color"), ";\n}\n\n.p-datatable-tbody > tr.p-datatable-row-selected {\n background: ").concat(dt("datatable.row.selected.background"), ";\n color: ").concat(dt("datatable.row.selected.color"), ";\n}\n\n.p-datatable-tbody > tr:has(+ .p-datatable-row-selected) > td {\n border-block-end-color: ").concat(dt("datatable.body.cell.selected.border.color"), ";\n}\n\n.p-datatable-tbody > tr.p-datatable-row-selected > td {\n border-block-end-color: ").concat(dt("datatable.body.cell.selected.border.color"), ";\n}\n\n.p-datatable-tbody > tr:focus-visible,\n.p-datatable-tbody > tr.p-datatable-contextmenu-row-selected {\n box-shadow: ").concat(dt("datatable.row.focus.ring.shadow"), ";\n outline: ").concat(dt("datatable.row.focus.ring.width"), " ").concat(dt("datatable.row.focus.ring.style"), " ").concat(dt("datatable.row.focus.ring.color"), ";\n outline-offset: ").concat(dt("datatable.row.focus.ring.offset"), ";\n}\n\n.p-datatable-tfoot > tr > td {\n text-align: start;\n padding: ").concat(dt("datatable.footer.cell.padding"), ";\n border-color: ").concat(dt("datatable.footer.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n color: ").concat(dt("datatable.footer.cell.color"), ";\n background: ").concat(dt("datatable.footer.cell.background"), ";\n}\n\n.p-datatable-column-footer {\n font-weight: ").concat(dt("datatable.column.footer.font.weight"), ";\n}\n\n.p-datatable-sortable-column {\n cursor: pointer;\n user-select: none;\n outline-color: transparent;\n}\n\n.p-datatable-column-title,\n.p-datatable-sort-icon,\n.p-datatable-sort-badge {\n vertical-align: middle;\n}\n\n.p-datatable-sort-icon {\n color: ").concat(dt("datatable.sort.icon.color"), ";\n font-size: ").concat(dt("datatable.sort.icon.size"), ";\n width: ").concat(dt("datatable.sort.icon.size"), ";\n height: ").concat(dt("datatable.sort.icon.size"), ";\n transition: color ").concat(dt("datatable.transition.duration"), ";\n}\n\n.p-datatable-sortable-column:not(.p-datatable-column-sorted):hover {\n background: ").concat(dt("datatable.header.cell.hover.background"), ";\n color: ").concat(dt("datatable.header.cell.hover.color"), ";\n}\n\n.p-datatable-sortable-column:not(.p-datatable-column-sorted):hover .p-datatable-sort-icon {\n color: ").concat(dt("datatable.sort.icon.hover.color"), ";\n}\n\n.p-datatable-column-sorted {\n background: ").concat(dt("datatable.header.cell.selected.background"), ";\n color: ").concat(dt("datatable.header.cell.selected.color"), ";\n}\n\n.p-datatable-column-sorted .p-datatable-sort-icon {\n color: ").concat(dt("datatable.header.cell.selected.color"), ";\n}\n\n.p-datatable-sortable-column:focus-visible {\n box-shadow: ").concat(dt("datatable.header.cell.focus.ring.shadow"), ";\n outline: ").concat(dt("datatable.header.cell.focus.ring.width"), " ").concat(dt("datatable.header.cell.focus.ring.style"), " ").concat(dt("datatable.header.cell.focus.ring.color"), ";\n outline-offset: ").concat(dt("datatable.header.cell.focus.ring.offset"), ";\n}\n\n.p-datatable-hoverable .p-datatable-selectable-row {\n cursor: pointer;\n}\n\n.p-datatable-tbody > tr.p-datatable-dragpoint-top > td {\n box-shadow: inset 0 2px 0 0 ").concat(dt("datatable.drop.point.color"), ";\n}\n\n.p-datatable-tbody > tr.p-datatable-dragpoint-bottom > td {\n box-shadow: inset 0 -2px 0 0 ").concat(dt("datatable.drop.point.color"), ";\n}\n\n.p-datatable-loading-icon {\n font-size: ").concat(dt("datatable.loading.icon.size"), ";\n width: ").concat(dt("datatable.loading.icon.size"), ";\n height: ").concat(dt("datatable.loading.icon.size"), ";\n}\n\n.p-datatable-gridlines .p-datatable-header {\n border-width: 1px 1px 0 1px;\n}\n\n.p-datatable-gridlines .p-datatable-footer {\n border-width: 0 1px 1px 1px;\n}\n\n.p-datatable-gridlines .p-datatable-paginator-top {\n border-width: 1px 1px 0 1px;\n}\n\n.p-datatable-gridlines .p-datatable-paginator-bottom {\n border-width: 0 1px 1px 1px;\n}\n\n.p-datatable-gridlines .p-datatable-thead > tr > th {\n border-width: 1px 0 1px 1px;\n}\n\n.p-datatable-gridlines .p-datatable-thead > tr > th:last-child {\n border-width: 1px;\n}\n\n.p-datatable-gridlines .p-datatable-tbody > tr > td {\n border-width: 1px 0 0 1px;\n}\n\n.p-datatable-gridlines .p-datatable-tbody > tr > td:last-child {\n border-width: 1px 1px 0 1px;\n}\n\n.p-datatable-gridlines .p-datatable-tbody > tr:last-child > td {\n border-width: 1px 0 1px 1px;\n}\n\n.p-datatable-gridlines .p-datatable-tbody > tr:last-child > td:last-child {\n border-width: 1px;\n}\n\n.p-datatable-gridlines .p-datatable-tfoot > tr > td {\n border-width: 1px 0 1px 1px;\n}\n\n.p-datatable-gridlines .p-datatable-tfoot > tr > td:last-child {\n border-width: 1px 1px 1px 1px;\n}\n\n.p-datatable.p-datatable-gridlines .p-datatable-thead + .p-datatable-tfoot > tr > td {\n border-width: 0 0 1px 1px;\n}\n\n.p-datatable.p-datatable-gridlines .p-datatable-thead + .p-datatable-tfoot > tr > td:last-child {\n border-width: 0 1px 1px 1px;\n}\n\n.p-datatable.p-datatable-gridlines:has(.p-datatable-thead):has(.p-datatable-tbody) .p-datatable-tbody > tr > td {\n border-width: 0 0 1px 1px;\n}\n\n.p-datatable.p-datatable-gridlines:has(.p-datatable-thead):has(.p-datatable-tbody) .p-datatable-tbody > tr > td:last-child {\n border-width: 0 1px 1px 1px;\n}\n\n.p-datatable.p-datatable-gridlines:has(.p-datatable-tbody):has(.p-datatable-tfoot) .p-datatable-tbody > tr:last-child > td {\n border-width: 0 0 0 1px;\n}\n\n.p-datatable.p-datatable-gridlines:has(.p-datatable-tbody):has(.p-datatable-tfoot) .p-datatable-tbody > tr:last-child > td:last-child {\n border-width: 0 1px 0 1px;\n}\n\n.p-datatable.p-datatable-striped .p-datatable-tbody > tr.p-row-odd {\n background: ").concat(dt("datatable.row.striped.background"), ";\n}\n\n.p-datatable.p-datatable-striped .p-datatable-tbody > tr.p-row-odd.p-datatable-row-selected {\n background: ").concat(dt("datatable.row.selected.background"), ";\n color: ").concat(dt("datatable.row.selected.color"), ";\n}\n\n.p-datatable-striped.p-datatable-hoverable .p-datatable-tbody > tr:not(.p-datatable-row-selected):hover {\n background: ").concat(dt("datatable.row.hover.background"), ";\n color: ").concat(dt("datatable.row.hover.color"), ";\n}\n\n.p-datatable.p-datatable-sm .p-datatable-header {\n padding: 0.375rem 0.5rem;\n}\n\n.p-datatable.p-datatable-sm .p-datatable-thead > tr > th {\n padding: 0.375rem 0.5rem;\n}\n\n.p-datatable.p-datatable-sm .p-datatable-tbody > tr > td {\n padding: 0.375rem 0.5rem;\n}\n\n.p-datatable.p-datatable-sm .p-datatable-tfoot > tr > td {\n padding: 0.375rem 0.5rem;\n}\n\n.p-datatable.p-datatable-sm .p-datatable-footer {\n padding: 0.375rem 0.5rem;\n}\n\n.p-datatable.p-datatable-lg .p-datatable-header {\n padding: 1rem 1.25rem;\n}\n\n.p-datatable.p-datatable-lg .p-datatable-thead > tr > th {\n padding: 1rem 1.25rem;\n}\n\n.p-datatable.p-datatable-lg .p-datatable-tbody > tr > td {\n padding: 1rem 1.25rem;\n}\n\n.p-datatable.p-datatable-lg .p-datatable-tfoot > tr > td {\n padding: 1rem 1.25rem;\n}\n\n.p-datatable.p-datatable-lg .p-datatable-footer {\n padding: 1rem 1.25rem;\n}\n\n.p-datatable-row-toggle-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n width: ").concat(dt("datatable.row.toggle.button.size"), ";\n height: ").concat(dt("datatable.row.toggle.button.size"), ";\n color: ").concat(dt("datatable.row.toggle.button.color"), ";\n border: 0 none;\n background: transparent;\n cursor: pointer;\n border-radius: ").concat(dt("datatable.row.toggle.button.border.radius"), ";\n transition: background ").concat(dt("datatable.transition.duration"), ", color ").concat(dt("datatable.transition.duration"), ", border-color ").concat(dt("datatable.transition.duration"), ",\n outline-color ").concat(dt("datatable.transition.duration"), ", box-shadow ").concat(dt("datatable.transition.duration"), ";\n outline-color: transparent;\n user-select: none;\n}\n\n.p-datatable-row-toggle-button:enabled:hover {\n color: ").concat(dt("datatable.row.toggle.button.hover.color"), ";\n background: ").concat(dt("datatable.row.toggle.button.hover.background"), ";\n}\n\n.p-datatable-tbody > tr.p-datatable-row-selected .p-datatable-row-toggle-button:hover {\n background: ").concat(dt("datatable.row.toggle.button.selected.hover.background"), ";\n color: ").concat(dt("datatable.row.toggle.button.selected.hover.color"), ";\n}\n\n.p-datatable-row-toggle-button:focus-visible {\n box-shadow: ").concat(dt("datatable.row.toggle.button.focus.ring.shadow"), ";\n outline: ").concat(dt("datatable.row.toggle.button.focus.ring.width"), " ").concat(dt("datatable.row.toggle.button.focus.ring.style"), " ").concat(dt("datatable.row.toggle.button.focus.ring.color"), ";\n outline-offset: ").concat(dt("datatable.row.toggle.button.focus.ring.offset"), ";\n}\n\n.p-datatable-row-toggle-icon:dir(rtl) {\n transform: rotate(180deg);\n}\n"); }, "theme"); var classes$1 = { root: /* @__PURE__ */ __name(function root(_ref2) { @@ -1465,11 +1445,6 @@ var script$k = { name: "PencilIcon", "extends": script$t }; -var _hoisted_1$c = /* @__PURE__ */ createBaseVNode("path", { - d: "M0.609628 13.959C0.530658 13.9599 0.452305 13.9451 0.379077 13.9156C0.305849 13.8861 0.239191 13.8424 0.18294 13.787C0.118447 13.7234 0.0688234 13.6464 0.0376166 13.5614C0.00640987 13.4765 -0.00560954 13.3857 0.00241768 13.2956L0.25679 10.1501C0.267698 10.0041 0.331934 9.86709 0.437312 9.76516L9.51265 0.705715C10.0183 0.233014 10.6911 -0.0203041 11.3835 0.00127367C12.0714 0.00660201 12.7315 0.27311 13.2298 0.746671C13.7076 1.23651 13.9824 1.88848 13.9992 2.57201C14.0159 3.25554 13.7733 3.92015 13.32 4.4327L4.23648 13.5331C4.13482 13.6342 4.0017 13.6978 3.85903 13.7133L0.667067 14L0.609628 13.959ZM1.43018 10.4696L1.25787 12.714L3.50619 12.5092L12.4502 3.56444C12.6246 3.35841 12.7361 3.10674 12.7714 2.83933C12.8067 2.57193 12.7644 2.30002 12.6495 2.05591C12.5346 1.8118 12.3519 1.60575 12.1231 1.46224C11.8943 1.31873 11.6291 1.2438 11.3589 1.24633C11.1813 1.23508 11.0033 1.25975 10.8355 1.31887C10.6677 1.37798 10.5136 1.47033 10.3824 1.59036L1.43018 10.4696Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$a = [_hoisted_1$c]; function render$j(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", @@ -1477,13 +1452,16 @@ function render$j(_ctx, _cache, $props, $setup, $data, $options) { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$a, 16); + }, _ctx.pti()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + d: "M0.609628 13.959C0.530658 13.9599 0.452305 13.9451 0.379077 13.9156C0.305849 13.8861 0.239191 13.8424 0.18294 13.787C0.118447 13.7234 0.0688234 13.6464 0.0376166 13.5614C0.00640987 13.4765 -0.00560954 13.3857 0.00241768 13.2956L0.25679 10.1501C0.267698 10.0041 0.331934 9.86709 0.437312 9.76516L9.51265 0.705715C10.0183 0.233014 10.6911 -0.0203041 11.3835 0.00127367C12.0714 0.00660201 12.7315 0.27311 13.2298 0.746671C13.7076 1.23651 13.9824 1.88848 13.9992 2.57201C14.0159 3.25554 13.7733 3.92015 13.32 4.4327L4.23648 13.5331C4.13482 13.6342 4.0017 13.6978 3.85903 13.7133L0.667067 14L0.609628 13.959ZM1.43018 10.4696L1.25787 12.714L3.50619 12.5092L12.4502 3.56444C12.6246 3.35841 12.7361 3.10674 12.7714 2.83933C12.8067 2.57193 12.7644 2.30002 12.6495 2.05591C12.5346 1.8118 12.3519 1.60575 12.1231 1.46224C11.8943 1.31873 11.6291 1.2438 11.3589 1.24633C11.1813 1.23508 11.0033 1.25975 10.8355 1.31887C10.6677 1.37798 10.5136 1.47033 10.3824 1.59036L1.43018 10.4696Z", + fill: "currentColor" + }, null, -1)]), 16); } __name(render$j, "render$j"); script$k.render = render$j; var theme3 = /* @__PURE__ */ __name(function theme4(_ref) { var dt = _ref.dt; - return "\n.p-radiobutton {\n position: relative;\n display: inline-flex;\n user-select: none;\n vertical-align: bottom;\n width: ".concat(dt("radiobutton.width"), ";\n height: ").concat(dt("radiobutton.height"), ";\n}\n\n.p-radiobutton-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: 50%;\n}\n\n.p-radiobutton-box {\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n border: 1px solid ").concat(dt("radiobutton.border.color"), ";\n background: ").concat(dt("radiobutton.background"), ";\n width: ").concat(dt("radiobutton.width"), ";\n height: ").concat(dt("radiobutton.height"), ";\n transition: background ").concat(dt("radiobutton.transition.duration"), ", color ").concat(dt("radiobutton.transition.duration"), ", border-color ").concat(dt("radiobutton.transition.duration"), ", box-shadow ").concat(dt("radiobutton.transition.duration"), ", outline-color ").concat(dt("radiobutton.transition.duration"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("radiobutton.shadow"), ";\n}\n\n.p-radiobutton-icon {\n transition-duration: ").concat(dt("radiobutton.transition.duration"), ";\n background: transparent;\n font-size: ").concat(dt("radiobutton.icon.size"), ";\n width: ").concat(dt("radiobutton.icon.size"), ";\n height: ").concat(dt("radiobutton.icon.size"), ";\n border-radius: 50%;\n backface-visibility: hidden;\n transform: translateZ(0) scale(0.1);\n}\n\n.p-radiobutton:not(.p-disabled):has(.p-radiobutton-input:hover) .p-radiobutton-box {\n border-color: ").concat(dt("radiobutton.hover.border.color"), ";\n}\n\n.p-radiobutton-checked .p-radiobutton-box {\n border-color: ").concat(dt("radiobutton.checked.border.color"), ";\n background: ").concat(dt("radiobutton.checked.background"), ";\n}\n\n.p-radiobutton-checked .p-radiobutton-box .p-radiobutton-icon {\n background: ").concat(dt("radiobutton.icon.checked.color"), ";\n transform: translateZ(0) scale(1, 1);\n visibility: visible;\n}\n\n.p-radiobutton-checked:not(.p-disabled):has(.p-radiobutton-input:hover) .p-radiobutton-box {\n border-color: ").concat(dt("radiobutton.checked.hover.border.color"), ";\n background: ").concat(dt("radiobutton.checked.hover.background"), ";\n}\n\n.p-radiobutton:not(.p-disabled):has(.p-radiobutton-input:hover).p-radiobutton-checked .p-radiobutton-box .p-radiobutton-icon {\n background: ").concat(dt("radiobutton.icon.checked.hover.color"), ";\n}\n\n.p-radiobutton:not(.p-disabled):has(.p-radiobutton-input:focus-visible) .p-radiobutton-box {\n border-color: ").concat(dt("radiobutton.focus.border.color"), ";\n box-shadow: ").concat(dt("radiobutton.focus.ring.shadow"), ";\n outline: ").concat(dt("radiobutton.focus.ring.width"), " ").concat(dt("radiobutton.focus.ring.style"), " ").concat(dt("radiobutton.focus.ring.color"), ";\n outline-offset: ").concat(dt("radiobutton.focus.ring.offset"), ";\n}\n\n.p-radiobutton-checked:not(.p-disabled):has(.p-radiobutton-input:focus-visible) .p-radiobutton-box {\n border-color: ").concat(dt("radiobutton.checked.focus.border.color"), ";\n}\n\n.p-radiobutton.p-invalid > .p-radiobutton-box {\n border-color: ").concat(dt("radiobutton.invalid.border.color"), ";\n}\n\n.p-radiobutton.p-variant-filled .p-radiobutton-box {\n background: ").concat(dt("radiobutton.filled.background"), ";\n}\n\n.p-radiobutton.p-variant-filled.p-radiobutton-checked .p-radiobutton-box {\n background: ").concat(dt("radiobutton.checked.background"), ";\n}\n\n.p-radiobutton.p-variant-filled:not(.p-disabled):has(.p-radiobutton-input:hover).p-radiobutton-checked .p-radiobutton-box {\n background: ").concat(dt("radiobutton.checked.hover.background"), ";\n}\n\n.p-radiobutton.p-disabled {\n opacity: 1;\n}\n\n.p-radiobutton.p-disabled .p-radiobutton-box {\n background: ").concat(dt("radiobutton.disabled.background"), ";\n border-color: ").concat(dt("radiobutton.checked.disabled.border.color"), ";\n}\n\n.p-radiobutton-checked.p-disabled .p-radiobutton-box .p-radiobutton-icon {\n background: ").concat(dt("radiobutton.icon.disabled.color"), ";\n}\n"); + return "\n.p-radiobutton {\n position: relative;\n display: inline-flex;\n user-select: none;\n vertical-align: bottom;\n width: ".concat(dt("radiobutton.width"), ";\n height: ").concat(dt("radiobutton.height"), ";\n}\n\n.p-radiobutton-input {\n cursor: pointer;\n appearance: none;\n position: absolute;\n top: 0;\n inset-inline-start: 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: 50%;\n}\n\n.p-radiobutton-box {\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n border: 1px solid ").concat(dt("radiobutton.border.color"), ";\n background: ").concat(dt("radiobutton.background"), ";\n width: ").concat(dt("radiobutton.width"), ";\n height: ").concat(dt("radiobutton.height"), ";\n transition: background ").concat(dt("radiobutton.transition.duration"), ", color ").concat(dt("radiobutton.transition.duration"), ", border-color ").concat(dt("radiobutton.transition.duration"), ", box-shadow ").concat(dt("radiobutton.transition.duration"), ", outline-color ").concat(dt("radiobutton.transition.duration"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("radiobutton.shadow"), ";\n}\n\n.p-radiobutton-icon {\n transition-duration: ").concat(dt("radiobutton.transition.duration"), ";\n background: transparent;\n font-size: ").concat(dt("radiobutton.icon.size"), ";\n width: ").concat(dt("radiobutton.icon.size"), ";\n height: ").concat(dt("radiobutton.icon.size"), ";\n border-radius: 50%;\n backface-visibility: hidden;\n transform: translateZ(0) scale(0.1);\n}\n\n.p-radiobutton:not(.p-disabled):has(.p-radiobutton-input:hover) .p-radiobutton-box {\n border-color: ").concat(dt("radiobutton.hover.border.color"), ";\n}\n\n.p-radiobutton-checked .p-radiobutton-box {\n border-color: ").concat(dt("radiobutton.checked.border.color"), ";\n background: ").concat(dt("radiobutton.checked.background"), ";\n}\n\n.p-radiobutton-checked .p-radiobutton-box .p-radiobutton-icon {\n background: ").concat(dt("radiobutton.icon.checked.color"), ";\n transform: translateZ(0) scale(1, 1);\n visibility: visible;\n}\n\n.p-radiobutton-checked:not(.p-disabled):has(.p-radiobutton-input:hover) .p-radiobutton-box {\n border-color: ").concat(dt("radiobutton.checked.hover.border.color"), ";\n background: ").concat(dt("radiobutton.checked.hover.background"), ";\n}\n\n.p-radiobutton:not(.p-disabled):has(.p-radiobutton-input:hover).p-radiobutton-checked .p-radiobutton-box .p-radiobutton-icon {\n background: ").concat(dt("radiobutton.icon.checked.hover.color"), ";\n}\n\n.p-radiobutton:not(.p-disabled):has(.p-radiobutton-input:focus-visible) .p-radiobutton-box {\n border-color: ").concat(dt("radiobutton.focus.border.color"), ";\n box-shadow: ").concat(dt("radiobutton.focus.ring.shadow"), ";\n outline: ").concat(dt("radiobutton.focus.ring.width"), " ").concat(dt("radiobutton.focus.ring.style"), " ").concat(dt("radiobutton.focus.ring.color"), ";\n outline-offset: ").concat(dt("radiobutton.focus.ring.offset"), ";\n}\n\n.p-radiobutton-checked:not(.p-disabled):has(.p-radiobutton-input:focus-visible) .p-radiobutton-box {\n border-color: ").concat(dt("radiobutton.checked.focus.border.color"), ";\n}\n\n.p-radiobutton.p-invalid > .p-radiobutton-box {\n border-color: ").concat(dt("radiobutton.invalid.border.color"), ";\n}\n\n.p-radiobutton.p-variant-filled .p-radiobutton-box {\n background: ").concat(dt("radiobutton.filled.background"), ";\n}\n\n.p-radiobutton.p-variant-filled.p-radiobutton-checked .p-radiobutton-box {\n background: ").concat(dt("radiobutton.checked.background"), ";\n}\n\n.p-radiobutton.p-variant-filled:not(.p-disabled):has(.p-radiobutton-input:hover).p-radiobutton-checked .p-radiobutton-box {\n background: ").concat(dt("radiobutton.checked.hover.background"), ";\n}\n\n.p-radiobutton.p-disabled {\n opacity: 1;\n}\n\n.p-radiobutton.p-disabled .p-radiobutton-box {\n background: ").concat(dt("radiobutton.disabled.background"), ";\n border-color: ").concat(dt("radiobutton.checked.disabled.border.color"), ";\n}\n\n.p-radiobutton-checked.p-disabled .p-radiobutton-box .p-radiobutton-icon {\n background: ").concat(dt("radiobutton.icon.disabled.color"), ";\n}\n\n.p-radiobutton-sm,\n.p-radiobutton-sm .p-radiobutton-box {\n width: ").concat(dt("radiobutton.sm.width"), ";\n height: ").concat(dt("radiobutton.sm.height"), ";\n}\n\n.p-radiobutton-sm .p-radiobutton-icon {\n font-size: ").concat(dt("radiobutton.icon.sm.size"), ";\n width: ").concat(dt("radiobutton.icon.sm.size"), ";\n height: ").concat(dt("radiobutton.icon.sm.size"), ";\n}\n\n.p-radiobutton-lg,\n.p-radiobutton-lg .p-radiobutton-box {\n width: ").concat(dt("radiobutton.lg.width"), ";\n height: ").concat(dt("radiobutton.lg.height"), ";\n}\n\n.p-radiobutton-lg .p-radiobutton-icon {\n font-size: ").concat(dt("radiobutton.icon.lg.size"), ";\n width: ").concat(dt("radiobutton.icon.lg.size"), ";\n height: ").concat(dt("radiobutton.icon.lg.size"), ";\n}\n"); }, "theme"); var classes = { root: /* @__PURE__ */ __name(function root2(_ref2) { @@ -1491,8 +1469,10 @@ var classes = { return ["p-radiobutton p-component", { "p-radiobutton-checked": instance.checked, "p-disabled": props.disabled, - "p-invalid": props.invalid, - "p-variant-filled": props.variant ? props.variant === "filled" : instance.$primevue.config.inputStyle === "filled" || instance.$primevue.config.inputVariant === "filled" + "p-invalid": instance.$pcRadioButtonGroup ? instance.$pcRadioButtonGroup.$invalid : instance.$invalid, + "p-variant-filled": instance.$variant === "filled", + "p-radiobutton-sm p-inputfield-sm": props.size === "small", + "p-radiobutton-lg p-inputfield-lg": props.size === "large" }]; }, "root"), box: "p-radiobutton-box", @@ -1506,27 +1486,10 @@ var RadioButtonStyle = BaseStyle.extend({ }); var script$1$1 = { name: "BaseRadioButton", - "extends": script$s, + "extends": script$x, props: { value: null, - modelValue: null, binary: Boolean, - name: { - type: String, - "default": null - }, - variant: { - type: String, - "default": null - }, - invalid: { - type: Boolean, - "default": false - }, - disabled: { - type: Boolean, - "default": false - }, readonly: { type: Boolean, "default": false @@ -1568,7 +1531,12 @@ var script$j = { name: "RadioButton", "extends": script$1$1, inheritAttrs: false, - emits: ["update:modelValue", "change", "focus", "blur"], + emits: ["change", "focus", "blur"], + inject: { + $pcRadioButtonGroup: { + "default": void 0 + } + }, methods: { getPTOptions: /* @__PURE__ */ __name(function getPTOptions6(key) { var _ptm = key === "root" ? this.ptmi : this.ptm; @@ -1582,7 +1550,7 @@ var script$j = { onChange: /* @__PURE__ */ __name(function onChange4(event2) { if (!this.disabled && !this.readonly) { var newModelValue = this.binary ? !this.checked : this.value; - this.$emit("update:modelValue", newModelValue); + this.$pcRadioButtonGroup ? this.$pcRadioButtonGroup.writeValue(newModelValue, event2) : this.writeValue(newModelValue, event2); this.$emit("change", event2); } }, "onChange"), @@ -1590,17 +1558,23 @@ var script$j = { this.$emit("focus", event2); }, "onFocus"), onBlur: /* @__PURE__ */ __name(function onBlur(event2) { + var _this$formField$onBlu, _this$formField; this.$emit("blur", event2); + (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField, event2); }, "onBlur") }, computed: { + groupName: /* @__PURE__ */ __name(function groupName() { + return this.$pcRadioButtonGroup ? this.$pcRadioButtonGroup.groupName : this.$formName; + }, "groupName"), checked: /* @__PURE__ */ __name(function checked() { - return this.modelValue != null && (this.binary ? !!this.modelValue : equals(this.modelValue, this.value)); + var value = this.$pcRadioButtonGroup ? this.$pcRadioButtonGroup.d_value : this.d_value; + return value != null && (this.binary ? !!value : equals(value, this.value)); }, "checked") } }; -var _hoisted_1$b = ["data-p-checked", "data-p-disabled"]; -var _hoisted_2$9 = ["id", "value", "name", "checked", "tabindex", "disabled", "readonly", "aria-labelledby", "aria-label", "aria-invalid"]; +var _hoisted_1$5 = ["data-p-checked", "data-p-disabled"]; +var _hoisted_2$3 = ["id", "value", "name", "checked", "tabindex", "disabled", "readonly", "aria-labelledby", "aria-label", "aria-invalid"]; function render$i(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root") @@ -1613,7 +1587,7 @@ function render$i(_ctx, _cache, $props, $setup, $data, $options) { "class": [_ctx.cx("input"), _ctx.inputClass], style: _ctx.inputStyle, value: _ctx.value, - name: _ctx.name, + name: $options.groupName, checked: $options.checked, tabindex: _ctx.tabindex, disabled: _ctx.disabled, @@ -1630,11 +1604,11 @@ function render$i(_ctx, _cache, $props, $setup, $data, $options) { onChange: _cache[2] || (_cache[2] = function() { return $options.onChange && $options.onChange.apply($options, arguments); }) - }, $options.getPTOptions("input")), null, 16, _hoisted_2$9), createBaseVNode("div", mergeProps({ + }, $options.getPTOptions("input")), null, 16, _hoisted_2$3), createBaseVNode("div", mergeProps({ "class": _ctx.cx("box") }, $options.getPTOptions("box")), [createBaseVNode("div", mergeProps({ "class": _ctx.cx("icon") - }, $options.getPTOptions("icon")), null, 16)], 16)], 16, _hoisted_1$b); + }, $options.getPTOptions("icon")), null, 16)], 16)], 16, _hoisted_1$5); } __name(render$i, "render$i"); script$j.render = render$i; @@ -1642,11 +1616,6 @@ var script$i = { name: "FilterIcon", "extends": script$t }; -var _hoisted_1$a = /* @__PURE__ */ createBaseVNode("path", { - d: "M8.64708 14H5.35296C5.18981 13.9979 5.03395 13.9321 4.91858 13.8167C4.8032 13.7014 4.73745 13.5455 4.73531 13.3824V7L0.329431 0.98C0.259794 0.889466 0.217389 0.780968 0.20718 0.667208C0.19697 0.553448 0.219379 0.439133 0.271783 0.337647C0.324282 0.236453 0.403423 0.151519 0.500663 0.0920138C0.597903 0.0325088 0.709548 0.000692754 0.823548 0H13.1765C13.2905 0.000692754 13.4021 0.0325088 13.4994 0.0920138C13.5966 0.151519 13.6758 0.236453 13.7283 0.337647C13.7807 0.439133 13.8031 0.553448 13.7929 0.667208C13.7826 0.780968 13.7402 0.889466 13.6706 0.98L9.26472 7V13.3824C9.26259 13.5455 9.19683 13.7014 9.08146 13.8167C8.96609 13.9321 8.81022 13.9979 8.64708 14ZM5.97061 12.7647H8.02943V6.79412C8.02878 6.66289 8.07229 6.53527 8.15296 6.43177L11.9412 1.23529H2.05884L5.86355 6.43177C5.94422 6.53527 5.98773 6.66289 5.98708 6.79412L5.97061 12.7647Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$8 = [_hoisted_1$a]; function render$h(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", @@ -1654,7 +1623,10 @@ function render$h(_ctx, _cache, $props, $setup, $data, $options) { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$8, 16); + }, _ctx.pti()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + d: "M8.64708 14H5.35296C5.18981 13.9979 5.03395 13.9321 4.91858 13.8167C4.8032 13.7014 4.73745 13.5455 4.73531 13.3824V7L0.329431 0.98C0.259794 0.889466 0.217389 0.780968 0.20718 0.667208C0.19697 0.553448 0.219379 0.439133 0.271783 0.337647C0.324282 0.236453 0.403423 0.151519 0.500663 0.0920138C0.597903 0.0325088 0.709548 0.000692754 0.823548 0H13.1765C13.2905 0.000692754 13.4021 0.0325088 13.4994 0.0920138C13.5966 0.151519 13.6758 0.236453 13.7283 0.337647C13.7807 0.439133 13.8031 0.553448 13.7929 0.667208C13.7826 0.780968 13.7402 0.889466 13.6706 0.98L9.26472 7V13.3824C9.26259 13.5455 9.19683 13.7014 9.08146 13.8167C8.96609 13.9321 8.81022 13.9979 8.64708 14ZM5.97061 12.7647H8.02943V6.79412C8.02878 6.66289 8.07229 6.53527 8.15296 6.43177L11.9412 1.23529H2.05884L5.86355 6.43177C5.94422 6.53527 5.98773 6.66289 5.98708 6.79412L5.97061 12.7647Z", + fill: "currentColor" + }, null, -1)]), 16); } __name(render$h, "render$h"); script$i.render = render$h; @@ -1662,13 +1634,6 @@ var script$h = { name: "FilterSlashIcon", "extends": script$t }; -var _hoisted_1$9 = /* @__PURE__ */ createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M13.4994 0.0920138C13.5967 0.151519 13.6758 0.236453 13.7283 0.337647C13.7807 0.439133 13.8031 0.553448 13.7929 0.667208C13.7827 0.780968 13.7403 0.889466 13.6707 0.98L11.406 4.06823C11.3099 4.19928 11.1656 4.28679 11.005 4.3115C10.8444 4.33621 10.6805 4.2961 10.5495 4.2C10.4184 4.1039 10.3309 3.95967 10.3062 3.79905C10.2815 3.63843 10.3216 3.47458 10.4177 3.34353L11.9412 1.23529H7.41184C7.24803 1.23529 7.09093 1.17022 6.97509 1.05439C6.85926 0.938558 6.79419 0.781457 6.79419 0.617647C6.79419 0.453837 6.85926 0.296736 6.97509 0.180905C7.09093 0.0650733 7.24803 0 7.41184 0H13.1765C13.2905 0.000692754 13.4022 0.0325088 13.4994 0.0920138ZM4.20008 0.181168H4.24126L13.2013 9.03411C13.3169 9.14992 13.3819 9.3069 13.3819 9.47058C13.3819 9.63426 13.3169 9.79124 13.2013 9.90705C13.1445 9.96517 13.0766 10.0112 13.0016 10.0423C12.9266 10.0735 12.846 10.0891 12.7648 10.0882C12.6836 10.0886 12.6032 10.0728 12.5283 10.0417C12.4533 10.0106 12.3853 9.96479 12.3283 9.90705L9.3142 6.92587L9.26479 6.99999V13.3823C9.26265 13.5455 9.19689 13.7014 9.08152 13.8167C8.96615 13.9321 8.81029 13.9979 8.64714 14H5.35302C5.18987 13.9979 5.03401 13.9321 4.91864 13.8167C4.80327 13.7014 4.73751 13.5455 4.73537 13.3823V6.99999L0.329492 1.02117C0.259855 0.930634 0.21745 0.822137 0.207241 0.708376C0.197031 0.594616 0.21944 0.480301 0.271844 0.378815C0.324343 0.277621 0.403484 0.192687 0.500724 0.133182C0.597964 0.073677 0.709609 0.041861 0.823609 0.0411682H3.86243C3.92448 0.0461551 3.9855 0.060022 4.04361 0.0823446C4.10037 0.10735 4.15311 0.140655 4.20008 0.181168ZM8.02949 6.79411C8.02884 6.66289 8.07235 6.53526 8.15302 6.43176L8.42478 6.05293L3.55773 1.23529H2.0589L5.84714 6.43176C5.92781 6.53526 5.97132 6.66289 5.97067 6.79411V12.7647H8.02949V6.79411Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$7 = [_hoisted_1$9]; function render$g(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", @@ -1676,7 +1641,12 @@ function render$g(_ctx, _cache, $props, $setup, $data, $options) { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$7, 16); + }, _ctx.pti()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M13.4994 0.0920138C13.5967 0.151519 13.6758 0.236453 13.7283 0.337647C13.7807 0.439133 13.8031 0.553448 13.7929 0.667208C13.7827 0.780968 13.7403 0.889466 13.6707 0.98L11.406 4.06823C11.3099 4.19928 11.1656 4.28679 11.005 4.3115C10.8444 4.33621 10.6805 4.2961 10.5495 4.2C10.4184 4.1039 10.3309 3.95967 10.3062 3.79905C10.2815 3.63843 10.3216 3.47458 10.4177 3.34353L11.9412 1.23529H7.41184C7.24803 1.23529 7.09093 1.17022 6.97509 1.05439C6.85926 0.938558 6.79419 0.781457 6.79419 0.617647C6.79419 0.453837 6.85926 0.296736 6.97509 0.180905C7.09093 0.0650733 7.24803 0 7.41184 0H13.1765C13.2905 0.000692754 13.4022 0.0325088 13.4994 0.0920138ZM4.20008 0.181168H4.24126L13.2013 9.03411C13.3169 9.14992 13.3819 9.3069 13.3819 9.47058C13.3819 9.63426 13.3169 9.79124 13.2013 9.90705C13.1445 9.96517 13.0766 10.0112 13.0016 10.0423C12.9266 10.0735 12.846 10.0891 12.7648 10.0882C12.6836 10.0886 12.6032 10.0728 12.5283 10.0417C12.4533 10.0106 12.3853 9.96479 12.3283 9.90705L9.3142 6.92587L9.26479 6.99999V13.3823C9.26265 13.5455 9.19689 13.7014 9.08152 13.8167C8.96615 13.9321 8.81029 13.9979 8.64714 14H5.35302C5.18987 13.9979 5.03401 13.9321 4.91864 13.8167C4.80327 13.7014 4.73751 13.5455 4.73537 13.3823V6.99999L0.329492 1.02117C0.259855 0.930634 0.21745 0.822137 0.207241 0.708376C0.197031 0.594616 0.21944 0.480301 0.271844 0.378815C0.324343 0.277621 0.403484 0.192687 0.500724 0.133182C0.597964 0.073677 0.709609 0.041861 0.823609 0.0411682H3.86243C3.92448 0.0461551 3.9855 0.060022 4.04361 0.0823446C4.10037 0.10735 4.15311 0.140655 4.20008 0.181168ZM8.02949 6.79411C8.02884 6.66289 8.07235 6.53526 8.15302 6.43176L8.42478 6.05293L3.55773 1.23529H2.0589L5.84714 6.43176C5.92781 6.53526 5.97132 6.66289 5.97067 6.79411V12.7647H8.02949V6.79411Z", + fill: "currentColor" + }, null, -1)]), 16); } __name(render$g, "render$g"); script$h.render = render$g; @@ -1684,13 +1654,6 @@ var script$g = { name: "TrashIcon", "extends": script$t }; -var _hoisted_1$8 = /* @__PURE__ */ createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M3.44802 13.9955H10.552C10.8056 14.0129 11.06 13.9797 11.3006 13.898C11.5412 13.8163 11.7632 13.6877 11.9537 13.5196C12.1442 13.3515 12.2995 13.1473 12.4104 12.9188C12.5213 12.6903 12.5858 12.442 12.6 12.1884V4.36041H13.4C13.5591 4.36041 13.7117 4.29722 13.8243 4.18476C13.9368 4.07229 14 3.91976 14 3.76071C14 3.60166 13.9368 3.44912 13.8243 3.33666C13.7117 3.22419 13.5591 3.16101 13.4 3.16101H12.0537C12.0203 3.1557 11.9863 3.15299 11.952 3.15299C11.9178 3.15299 11.8838 3.1557 11.8503 3.16101H11.2285C11.2421 3.10893 11.2487 3.05513 11.248 3.00106V1.80966C11.2171 1.30262 10.9871 0.828306 10.608 0.48989C10.229 0.151475 9.73159 -0.0236625 9.22402 0.00257442H4.77602C4.27251 -0.0171866 3.78126 0.160868 3.40746 0.498617C3.03365 0.836366 2.807 1.30697 2.77602 1.80966V3.00106C2.77602 3.0556 2.78346 3.10936 2.79776 3.16101H0.6C0.521207 3.16101 0.443185 3.17652 0.37039 3.20666C0.297595 3.2368 0.231451 3.28097 0.175736 3.33666C0.120021 3.39235 0.0758251 3.45846 0.0456722 3.53121C0.0155194 3.60397 0 3.68196 0 3.76071C0 3.83946 0.0155194 3.91744 0.0456722 3.9902C0.0758251 4.06296 0.120021 4.12907 0.175736 4.18476C0.231451 4.24045 0.297595 4.28462 0.37039 4.31476C0.443185 4.3449 0.521207 4.36041 0.6 4.36041H1.40002V12.1884C1.41426 12.442 1.47871 12.6903 1.58965 12.9188C1.7006 13.1473 1.85582 13.3515 2.04633 13.5196C2.23683 13.6877 2.45882 13.8163 2.69944 13.898C2.94005 13.9797 3.1945 14.0129 3.44802 13.9955ZM2.60002 4.36041H11.304V12.1884C11.304 12.5163 10.952 12.7961 10.504 12.7961H3.40002C2.97602 12.7961 2.60002 12.5163 2.60002 12.1884V4.36041ZM3.95429 3.16101C3.96859 3.10936 3.97602 3.0556 3.97602 3.00106V1.80966C3.97602 1.48183 4.33602 1.20197 4.77602 1.20197H9.24802C9.66403 1.20197 10.048 1.48183 10.048 1.80966V3.00106C10.0473 3.05515 10.054 3.10896 10.0678 3.16101H3.95429ZM5.57571 10.997C5.41731 10.995 5.26597 10.9311 5.15395 10.8191C5.04193 10.7071 4.97808 10.5558 4.97601 10.3973V6.77517C4.97601 6.61612 5.0392 6.46359 5.15166 6.35112C5.26413 6.23866 5.41666 6.17548 5.57571 6.17548C5.73476 6.17548 5.8873 6.23866 5.99976 6.35112C6.11223 6.46359 6.17541 6.61612 6.17541 6.77517V10.3894C6.17647 10.4688 6.16174 10.5476 6.13208 10.6213C6.10241 10.695 6.05841 10.762 6.00261 10.8186C5.94682 10.8751 5.88035 10.92 5.80707 10.9506C5.73378 10.9813 5.65514 10.9971 5.57571 10.997ZM7.99968 10.8214C8.11215 10.9339 8.26468 10.997 8.42373 10.997C8.58351 10.9949 8.73604 10.93 8.84828 10.8163C8.96052 10.7025 9.02345 10.5491 9.02343 10.3894V6.77517C9.02343 6.61612 8.96025 6.46359 8.84778 6.35112C8.73532 6.23866 8.58278 6.17548 8.42373 6.17548C8.26468 6.17548 8.11215 6.23866 7.99968 6.35112C7.88722 6.46359 7.82404 6.61612 7.82404 6.77517V10.3973C7.82404 10.5564 7.88722 10.7089 7.99968 10.8214Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$6 = [_hoisted_1$8]; function render$f(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", @@ -1698,7 +1661,12 @@ function render$f(_ctx, _cache, $props, $setup, $data, $options) { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$6, 16); + }, _ctx.pti()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M3.44802 13.9955H10.552C10.8056 14.0129 11.06 13.9797 11.3006 13.898C11.5412 13.8163 11.7632 13.6877 11.9537 13.5196C12.1442 13.3515 12.2995 13.1473 12.4104 12.9188C12.5213 12.6903 12.5858 12.442 12.6 12.1884V4.36041H13.4C13.5591 4.36041 13.7117 4.29722 13.8243 4.18476C13.9368 4.07229 14 3.91976 14 3.76071C14 3.60166 13.9368 3.44912 13.8243 3.33666C13.7117 3.22419 13.5591 3.16101 13.4 3.16101H12.0537C12.0203 3.1557 11.9863 3.15299 11.952 3.15299C11.9178 3.15299 11.8838 3.1557 11.8503 3.16101H11.2285C11.2421 3.10893 11.2487 3.05513 11.248 3.00106V1.80966C11.2171 1.30262 10.9871 0.828306 10.608 0.48989C10.229 0.151475 9.73159 -0.0236625 9.22402 0.00257442H4.77602C4.27251 -0.0171866 3.78126 0.160868 3.40746 0.498617C3.03365 0.836366 2.807 1.30697 2.77602 1.80966V3.00106C2.77602 3.0556 2.78346 3.10936 2.79776 3.16101H0.6C0.521207 3.16101 0.443185 3.17652 0.37039 3.20666C0.297595 3.2368 0.231451 3.28097 0.175736 3.33666C0.120021 3.39235 0.0758251 3.45846 0.0456722 3.53121C0.0155194 3.60397 0 3.68196 0 3.76071C0 3.83946 0.0155194 3.91744 0.0456722 3.9902C0.0758251 4.06296 0.120021 4.12907 0.175736 4.18476C0.231451 4.24045 0.297595 4.28462 0.37039 4.31476C0.443185 4.3449 0.521207 4.36041 0.6 4.36041H1.40002V12.1884C1.41426 12.442 1.47871 12.6903 1.58965 12.9188C1.7006 13.1473 1.85582 13.3515 2.04633 13.5196C2.23683 13.6877 2.45882 13.8163 2.69944 13.898C2.94005 13.9797 3.1945 14.0129 3.44802 13.9955ZM2.60002 4.36041H11.304V12.1884C11.304 12.5163 10.952 12.7961 10.504 12.7961H3.40002C2.97602 12.7961 2.60002 12.5163 2.60002 12.1884V4.36041ZM3.95429 3.16101C3.96859 3.10936 3.97602 3.0556 3.97602 3.00106V1.80966C3.97602 1.48183 4.33602 1.20197 4.77602 1.20197H9.24802C9.66403 1.20197 10.048 1.48183 10.048 1.80966V3.00106C10.0473 3.05515 10.054 3.10896 10.0678 3.16101H3.95429ZM5.57571 10.997C5.41731 10.995 5.26597 10.9311 5.15395 10.8191C5.04193 10.7071 4.97808 10.5558 4.97601 10.3973V6.77517C4.97601 6.61612 5.0392 6.46359 5.15166 6.35112C5.26413 6.23866 5.41666 6.17548 5.57571 6.17548C5.73476 6.17548 5.8873 6.23866 5.99976 6.35112C6.11223 6.46359 6.17541 6.61612 6.17541 6.77517V10.3894C6.17647 10.4688 6.16174 10.5476 6.13208 10.6213C6.10241 10.695 6.05841 10.762 6.00261 10.8186C5.94682 10.8751 5.88035 10.92 5.80707 10.9506C5.73378 10.9813 5.65514 10.9971 5.57571 10.997ZM7.99968 10.8214C8.11215 10.9339 8.26468 10.997 8.42373 10.997C8.58351 10.9949 8.73604 10.93 8.84828 10.8163C8.96052 10.7025 9.02345 10.5491 9.02343 10.3894V6.77517C9.02343 6.61612 8.96025 6.46359 8.84778 6.35112C8.73532 6.23866 8.58278 6.17548 8.42373 6.17548C8.26468 6.17548 8.11215 6.23866 7.99968 6.35112C7.88722 6.46359 7.82404 6.61612 7.82404 6.77517V10.3973C7.82404 10.5564 7.88722 10.7089 7.99968 10.8214Z", + fill: "currentColor" + }, null, -1)]), 16); } __name(render$f, "render$f"); script$g.render = render$f; @@ -1706,23 +1674,6 @@ var script$f = { name: "SortAltIcon", "extends": script$t }; -var _hoisted_1$7 = /* @__PURE__ */ createBaseVNode("path", { - d: "M5.64515 3.61291C5.47353 3.61291 5.30192 3.54968 5.16644 3.4142L3.38708 1.63484L1.60773 3.4142C1.34579 3.67613 0.912244 3.67613 0.650309 3.4142C0.388374 3.15226 0.388374 2.71871 0.650309 2.45678L2.90837 0.198712C3.17031 -0.0632236 3.60386 -0.0632236 3.86579 0.198712L6.12386 2.45678C6.38579 2.71871 6.38579 3.15226 6.12386 3.4142C5.98837 3.54968 5.81676 3.61291 5.64515 3.61291Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$5 = /* @__PURE__ */ createBaseVNode("path", { - d: "M3.38714 14C3.01681 14 2.70972 13.6929 2.70972 13.3226V0.677419C2.70972 0.307097 3.01681 0 3.38714 0C3.75746 0 4.06456 0.307097 4.06456 0.677419V13.3226C4.06456 13.6929 3.75746 14 3.38714 14Z", - fill: "currentColor" -}, null, -1); -var _hoisted_3$1 = /* @__PURE__ */ createBaseVNode("path", { - d: "M10.6129 14C10.4413 14 10.2697 13.9368 10.1342 13.8013L7.87611 11.5432C7.61418 11.2813 7.61418 10.8477 7.87611 10.5858C8.13805 10.3239 8.5716 10.3239 8.83353 10.5858L10.6129 12.3652L12.3922 10.5858C12.6542 10.3239 13.0877 10.3239 13.3497 10.5858C13.6116 10.8477 13.6116 11.2813 13.3497 11.5432L11.0916 13.8013C10.9561 13.9368 10.7845 14 10.6129 14Z", - fill: "currentColor" -}, null, -1); -var _hoisted_4$1 = /* @__PURE__ */ createBaseVNode("path", { - d: "M10.6129 14C10.2426 14 9.93552 13.6929 9.93552 13.3226V0.677419C9.93552 0.307097 10.2426 0 10.6129 0C10.9833 0 11.2904 0.307097 11.2904 0.677419V13.3226C11.2904 13.6929 10.9832 14 10.6129 14Z", - fill: "currentColor" -}, null, -1); -var _hoisted_5$1 = [_hoisted_1$7, _hoisted_2$5, _hoisted_3$1, _hoisted_4$1]; function render$e(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", @@ -1730,7 +1681,19 @@ function render$e(_ctx, _cache, $props, $setup, $data, $options) { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_5$1, 16); + }, _ctx.pti()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + d: "M5.64515 3.61291C5.47353 3.61291 5.30192 3.54968 5.16644 3.4142L3.38708 1.63484L1.60773 3.4142C1.34579 3.67613 0.912244 3.67613 0.650309 3.4142C0.388374 3.15226 0.388374 2.71871 0.650309 2.45678L2.90837 0.198712C3.17031 -0.0632236 3.60386 -0.0632236 3.86579 0.198712L6.12386 2.45678C6.38579 2.71871 6.38579 3.15226 6.12386 3.4142C5.98837 3.54968 5.81676 3.61291 5.64515 3.61291Z", + fill: "currentColor" + }, null, -1), createBaseVNode("path", { + d: "M3.38714 14C3.01681 14 2.70972 13.6929 2.70972 13.3226V0.677419C2.70972 0.307097 3.01681 0 3.38714 0C3.75746 0 4.06456 0.307097 4.06456 0.677419V13.3226C4.06456 13.6929 3.75746 14 3.38714 14Z", + fill: "currentColor" + }, null, -1), createBaseVNode("path", { + d: "M10.6129 14C10.4413 14 10.2697 13.9368 10.1342 13.8013L7.87611 11.5432C7.61418 11.2813 7.61418 10.8477 7.87611 10.5858C8.13805 10.3239 8.5716 10.3239 8.83353 10.5858L10.6129 12.3652L12.3922 10.5858C12.6542 10.3239 13.0877 10.3239 13.3497 10.5858C13.6116 10.8477 13.6116 11.2813 13.3497 11.5432L11.0916 13.8013C10.9561 13.9368 10.7845 14 10.6129 14Z", + fill: "currentColor" + }, null, -1), createBaseVNode("path", { + d: "M10.6129 14C10.2426 14 9.93552 13.6929 9.93552 13.3226V0.677419C9.93552 0.307097 10.2426 0 10.6129 0C10.9833 0 11.2904 0.307097 11.2904 0.677419V13.3226C11.2904 13.6929 10.9832 14 10.6129 14Z", + fill: "currentColor" + }, null, -1)]), 16); } __name(render$e, "render$e"); script$f.render = render$e; @@ -1738,11 +1701,6 @@ var script$e = { name: "SortAmountDownIcon", "extends": script$t }; -var _hoisted_1$6 = /* @__PURE__ */ createBaseVNode("path", { - d: "M4.93953 10.5858L3.83759 11.6877V0.677419C3.83759 0.307097 3.53049 0 3.16017 0C2.78985 0 2.48275 0.307097 2.48275 0.677419V11.6877L1.38082 10.5858C1.11888 10.3239 0.685331 10.3239 0.423396 10.5858C0.16146 10.8477 0.16146 11.2813 0.423396 11.5432L2.68146 13.8013C2.74469 13.8645 2.81694 13.9097 2.89823 13.9458C2.97952 13.9819 3.06985 14 3.16017 14C3.25049 14 3.33178 13.9819 3.42211 13.9458C3.5034 13.9097 3.57565 13.8645 3.63888 13.8013L5.89694 11.5432C6.15888 11.2813 6.15888 10.8477 5.89694 10.5858C5.63501 10.3239 5.20146 10.3239 4.93953 10.5858ZM13.0957 0H7.22468C6.85436 0 6.54726 0.307097 6.54726 0.677419C6.54726 1.04774 6.85436 1.35484 7.22468 1.35484H13.0957C13.466 1.35484 13.7731 1.04774 13.7731 0.677419C13.7731 0.307097 13.466 0 13.0957 0ZM7.22468 5.41935H9.48275C9.85307 5.41935 10.1602 5.72645 10.1602 6.09677C10.1602 6.4671 9.85307 6.77419 9.48275 6.77419H7.22468C6.85436 6.77419 6.54726 6.4671 6.54726 6.09677C6.54726 5.72645 6.85436 5.41935 7.22468 5.41935ZM7.6763 8.12903H7.22468C6.85436 8.12903 6.54726 8.43613 6.54726 8.80645C6.54726 9.17677 6.85436 9.48387 7.22468 9.48387H7.6763C8.04662 9.48387 8.35372 9.17677 8.35372 8.80645C8.35372 8.43613 8.04662 8.12903 7.6763 8.12903ZM7.22468 2.70968H11.2892C11.6595 2.70968 11.9666 3.01677 11.9666 3.3871C11.9666 3.75742 11.6595 4.06452 11.2892 4.06452H7.22468C6.85436 4.06452 6.54726 3.75742 6.54726 3.3871C6.54726 3.01677 6.85436 2.70968 7.22468 2.70968Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$4 = [_hoisted_1$6]; function render$d(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", @@ -1750,7 +1708,10 @@ function render$d(_ctx, _cache, $props, $setup, $data, $options) { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$4, 16); + }, _ctx.pti()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + d: "M4.93953 10.5858L3.83759 11.6877V0.677419C3.83759 0.307097 3.53049 0 3.16017 0C2.78985 0 2.48275 0.307097 2.48275 0.677419V11.6877L1.38082 10.5858C1.11888 10.3239 0.685331 10.3239 0.423396 10.5858C0.16146 10.8477 0.16146 11.2813 0.423396 11.5432L2.68146 13.8013C2.74469 13.8645 2.81694 13.9097 2.89823 13.9458C2.97952 13.9819 3.06985 14 3.16017 14C3.25049 14 3.33178 13.9819 3.42211 13.9458C3.5034 13.9097 3.57565 13.8645 3.63888 13.8013L5.89694 11.5432C6.15888 11.2813 6.15888 10.8477 5.89694 10.5858C5.63501 10.3239 5.20146 10.3239 4.93953 10.5858ZM13.0957 0H7.22468C6.85436 0 6.54726 0.307097 6.54726 0.677419C6.54726 1.04774 6.85436 1.35484 7.22468 1.35484H13.0957C13.466 1.35484 13.7731 1.04774 13.7731 0.677419C13.7731 0.307097 13.466 0 13.0957 0ZM7.22468 5.41935H9.48275C9.85307 5.41935 10.1602 5.72645 10.1602 6.09677C10.1602 6.4671 9.85307 6.77419 9.48275 6.77419H7.22468C6.85436 6.77419 6.54726 6.4671 6.54726 6.09677C6.54726 5.72645 6.85436 5.41935 7.22468 5.41935ZM7.6763 8.12903H7.22468C6.85436 8.12903 6.54726 8.43613 6.54726 8.80645C6.54726 9.17677 6.85436 9.48387 7.22468 9.48387H7.6763C8.04662 9.48387 8.35372 9.17677 8.35372 8.80645C8.35372 8.43613 8.04662 8.12903 7.6763 8.12903ZM7.22468 2.70968H11.2892C11.6595 2.70968 11.9666 3.01677 11.9666 3.3871C11.9666 3.75742 11.6595 4.06452 11.2892 4.06452H7.22468C6.85436 4.06452 6.54726 3.75742 6.54726 3.3871C6.54726 3.01677 6.85436 2.70968 7.22468 2.70968Z", + fill: "currentColor" + }, null, -1)]), 16); } __name(render$d, "render$d"); script$e.render = render$d; @@ -1758,11 +1719,6 @@ var script$d = { name: "SortAmountUpAltIcon", "extends": script$t }; -var _hoisted_1$5 = /* @__PURE__ */ createBaseVNode("path", { - d: "M3.63435 0.19871C3.57113 0.135484 3.49887 0.0903226 3.41758 0.0541935C3.255 -0.0180645 3.06532 -0.0180645 2.90274 0.0541935C2.82145 0.0903226 2.74919 0.135484 2.68597 0.19871L0.427901 2.45677C0.165965 2.71871 0.165965 3.15226 0.427901 3.41419C0.689836 3.67613 1.12338 3.67613 1.38532 3.41419L2.48726 2.31226V13.3226C2.48726 13.6929 2.79435 14 3.16467 14C3.535 14 3.84209 13.6929 3.84209 13.3226V2.31226L4.94403 3.41419C5.07951 3.54968 5.25113 3.6129 5.42274 3.6129C5.59435 3.6129 5.76597 3.54968 5.90145 3.41419C6.16338 3.15226 6.16338 2.71871 5.90145 2.45677L3.64338 0.19871H3.63435ZM13.7685 13.3226C13.7685 12.9523 13.4615 12.6452 13.0911 12.6452H7.22016C6.84984 12.6452 6.54274 12.9523 6.54274 13.3226C6.54274 13.6929 6.84984 14 7.22016 14H13.0911C13.4615 14 13.7685 13.6929 13.7685 13.3226ZM7.22016 8.58064C6.84984 8.58064 6.54274 8.27355 6.54274 7.90323C6.54274 7.5329 6.84984 7.22581 7.22016 7.22581H9.47823C9.84855 7.22581 10.1556 7.5329 10.1556 7.90323C10.1556 8.27355 9.84855 8.58064 9.47823 8.58064H7.22016ZM7.22016 5.87097H7.67177C8.0421 5.87097 8.34919 5.56387 8.34919 5.19355C8.34919 4.82323 8.0421 4.51613 7.67177 4.51613H7.22016C6.84984 4.51613 6.54274 4.82323 6.54274 5.19355C6.54274 5.56387 6.84984 5.87097 7.22016 5.87097ZM11.2847 11.2903H7.22016C6.84984 11.2903 6.54274 10.9832 6.54274 10.6129C6.54274 10.2426 6.84984 9.93548 7.22016 9.93548H11.2847C11.655 9.93548 11.9621 10.2426 11.9621 10.6129C11.9621 10.9832 11.655 11.2903 11.2847 11.2903Z", - fill: "currentColor" -}, null, -1); -var _hoisted_2$3 = [_hoisted_1$5]; function render$c(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ width: "14", @@ -1770,7 +1726,10 @@ function render$c(_ctx, _cache, $props, $setup, $data, $options) { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" - }, _ctx.pti()), _hoisted_2$3, 16); + }, _ctx.pti()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + d: "M3.63435 0.19871C3.57113 0.135484 3.49887 0.0903226 3.41758 0.0541935C3.255 -0.0180645 3.06532 -0.0180645 2.90274 0.0541935C2.82145 0.0903226 2.74919 0.135484 2.68597 0.19871L0.427901 2.45677C0.165965 2.71871 0.165965 3.15226 0.427901 3.41419C0.689836 3.67613 1.12338 3.67613 1.38532 3.41419L2.48726 2.31226V13.3226C2.48726 13.6929 2.79435 14 3.16467 14C3.535 14 3.84209 13.6929 3.84209 13.3226V2.31226L4.94403 3.41419C5.07951 3.54968 5.25113 3.6129 5.42274 3.6129C5.59435 3.6129 5.76597 3.54968 5.90145 3.41419C6.16338 3.15226 6.16338 2.71871 5.90145 2.45677L3.64338 0.19871H3.63435ZM13.7685 13.3226C13.7685 12.9523 13.4615 12.6452 13.0911 12.6452H7.22016C6.84984 12.6452 6.54274 12.9523 6.54274 13.3226C6.54274 13.6929 6.84984 14 7.22016 14H13.0911C13.4615 14 13.7685 13.6929 13.7685 13.3226ZM7.22016 8.58064C6.84984 8.58064 6.54274 8.27355 6.54274 7.90323C6.54274 7.5329 6.84984 7.22581 7.22016 7.22581H9.47823C9.84855 7.22581 10.1556 7.5329 10.1556 7.90323C10.1556 8.27355 9.84855 8.58064 9.47823 8.58064H7.22016ZM7.22016 5.87097H7.67177C8.0421 5.87097 8.34919 5.56387 8.34919 5.19355C8.34919 4.82323 8.0421 4.51613 7.67177 4.51613H7.22016C6.84984 4.51613 6.54274 4.82323 6.54274 5.19355C6.54274 5.56387 6.84984 5.87097 7.22016 5.87097ZM11.2847 11.2903H7.22016C6.84984 11.2903 6.54274 10.9832 6.54274 10.6129C6.54274 10.2426 6.84984 9.93548 7.22016 9.93548H11.2847C11.655 9.93548 11.9621 10.2426 11.9621 10.6129C11.9621 10.9832 11.655 11.2903 11.2847 11.2903Z", + fill: "currentColor" + }, null, -1)]), 16); } __name(render$c, "render$c"); script$d.render = render$c; @@ -2010,6 +1969,10 @@ var script$c = { type: String, "default": "960px" }, + showHeaders: { + type: Boolean, + "default": true + }, showGridlines: { type: Boolean, "default": false @@ -2166,8 +2129,8 @@ var script$b = { }, "checkboxAriaLabel") }, components: { - CheckIcon: script$x, - Checkbox: script$y + CheckIcon: script$y, + Checkbox: script$z } }; function render$b(_ctx, _cache, $props, $setup, $data, $options) { @@ -2649,19 +2612,19 @@ var script$9 = { if (this.columnProp("frozen")) { var align = this.columnProp("alignFrozen"); if (align === "right") { - var right = 0; + var pos = 0; var next2 = getNextElementSibling(this.$el, '[data-p-frozen-column="true"]'); if (next2) { - right = getOuterWidth(next2) + parseFloat(next2.style.right || 0); + pos = getOuterWidth(next2) + parseFloat(next2.style.right || 0); } - this.styleObject.right = right + "px"; + this.styleObject.insetInlineEnd = pos + "px"; } else { - var left = 0; + var _pos = 0; var prev2 = getPreviousElementSibling(this.$el, '[data-p-frozen-column="true"]'); if (prev2) { - left = getOuterWidth(prev2) + parseFloat(prev2.style.left || 0); + _pos = getOuterWidth(prev2) + parseFloat(prev2.style.left || 0); } - this.styleObject.left = left + "px"; + this.styleObject.insetInlineStart = _pos + "px"; } } }, "updateStickyPosition"), @@ -2715,13 +2678,13 @@ var script$9 = { components: { DTRadioButton: script$a, DTCheckbox: script$b, - Button: script$z, - ChevronDownIcon: script$A, - ChevronRightIcon: script$B, - BarsIcon: script$C, + Button: script$A, + ChevronDownIcon: script$B, + ChevronRightIcon: script$C, + BarsIcon: script$D, PencilIcon: script$k, - CheckIcon: script$x, - TimesIcon: script$D + CheckIcon: script$y, + TimesIcon: script$E }, directives: { ripple: Ripple @@ -3548,8 +3511,8 @@ var script$8 = { }, components: { DTBodyCell: script$9, - ChevronDownIcon: script$A, - ChevronRightIcon: script$B + ChevronDownIcon: script$B, + ChevronRightIcon: script$C } }; function _typeof$8(o) { @@ -4078,8 +4041,10 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) { key: 1, empty: $props.empty, columns: $props.columns, - templates: $props.templates - }, null, 8, ["empty", "columns", "templates"]))], 16); + templates: $props.templates, + unstyled: _ctx.unstyled, + pt: _ctx.pt + }, null, 8, ["empty", "columns", "templates", "unstyled", "pt"]))], 16); } __name(render$7, "render$7"); script$7.render = render$7; @@ -4142,19 +4107,19 @@ var script$6 = { if (this.columnProp("frozen")) { var align = this.columnProp("alignFrozen"); if (align === "right") { - var right = 0; + var pos = 0; var next2 = getNextElementSibling(this.$el, '[data-p-frozen-column="true"]'); if (next2) { - right = getOuterWidth(next2) + parseFloat(next2.style.right || 0); + pos = getOuterWidth(next2) + parseFloat(next2.style.right || 0); } - this.styleObject.right = right + "px"; + this.styleObject.insetInlineEnd = pos + "px"; } else { - var left = 0; + var _pos = 0; var prev2 = getPreviousElementSibling(this.$el, '[data-p-frozen-column="true"]'); if (prev2) { - left = getOuterWidth(prev2) + parseFloat(prev2.style.left || 0); + _pos = getOuterWidth(prev2) + parseFloat(prev2.style.left || 0); } - this.styleObject.left = left + "px"; + this.styleObject.insetInlineStart = _pos + "px"; } } }, "updateStickyPosition") @@ -5098,12 +5063,12 @@ var script$4 = { }, components: { Select: script$u, - Button: script$z, - Portal: script$E, + Button: script$A, + Portal: script$F, FilterSlashIcon: script$h, FilterIcon: script$i, TrashIcon: script$g, - PlusIcon: script$F + PlusIcon: script$G }, directives: { focustrap: FocusTrap @@ -5457,8 +5422,8 @@ var script$3 = { }, "headerCheckboxAriaLabel") }, components: { - CheckIcon: script$x, - Checkbox: script$y + CheckIcon: script$y, + Checkbox: script$z } }; function render$3(_ctx, _cache, $props, $setup, $data, $options) { @@ -5470,6 +5435,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) { disabled: $props.disabled, "aria-label": $options.headerCheckboxAriaLabel, onChange: $options.onChange, + unstyled: _ctx.unstyled, pt: $options.getColumnPT("pcHeaderCheckbox") }, { icon: withCtx(function(slotProps) { @@ -5483,7 +5449,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) { }, $options.getColumnPT("pcHeaderCheckbox")["icon"]), null, 16, ["class"])) : createCommentVNode("", true)]; }), _: 1 - }, 8, ["modelValue", "disabled", "aria-label", "onChange", "pt"]); + }, 8, ["modelValue", "disabled", "aria-label", "onChange", "unstyled", "pt"]); } __name(render$3, "render$3"); script$3.render = render$3; @@ -5678,19 +5644,19 @@ var script$2 = { if (this.columnProp("frozen")) { var align = this.columnProp("alignFrozen"); if (align === "right") { - var right = 0; + var pos = 0; var next2 = getNextElementSibling(this.$el, '[data-p-frozen-column="true"]'); if (next2) { - right = getOuterWidth(next2) + parseFloat(next2.style.right || 0); + pos = getOuterWidth(next2) + parseFloat(next2.style.right || 0); } - this.styleObject.right = right + "px"; + this.styleObject.insetInlineEnd = pos + "px"; } else { - var left = 0; + var _pos = 0; var prev2 = getPreviousElementSibling(this.$el, '[data-p-frozen-column="true"]'); if (prev2) { - left = getOuterWidth(prev2) + parseFloat(prev2.style.left || 0); + _pos = getOuterWidth(prev2) + parseFloat(prev2.style.left || 0); } - this.styleObject.left = left + "px"; + this.styleObject.insetInlineStart = _pos + "px"; } var filterRow = this.$el.parentElement.nextElementSibling; if (filterRow) { @@ -5752,7 +5718,7 @@ var script$2 = { }, "ariaSort") }, components: { - Badge: script$G, + Badge: script$H, DTHeaderCheckbox: script$3, DTColumnFilter: script$4, SortAltIcon: script$f, @@ -6205,9 +6171,8 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) { role: "rowgroup" }, $props.columnGroup ? _objectSpread$2(_objectSpread$2({}, _ctx.ptm("thead", $options.ptmTHeadOptions)), $options.getColumnGroupPT("root")) : _ctx.ptm("thead", $options.ptmTHeadOptions), { "data-pc-section": "thead" - }), [!$props.columnGroup ? (openBlock(), createElementBlock(Fragment, { - key: 0 - }, [createBaseVNode("tr", mergeProps({ + }), [!$props.columnGroup ? (openBlock(), createElementBlock("tr", mergeProps({ + key: 0, role: "row" }, _ctx.ptm("headerRow")), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.columns, function(col, i) { return openBlock(), createElementBlock(Fragment, { @@ -6280,8 +6245,66 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) { unstyled: _ctx.unstyled, pt: _ctx.pt }, null, 8, ["column", "index", "groupRowsBy", "groupRowSortField", "reorderableColumns", "resizableColumns", "sortMode", "sortField", "sortOrder", "multiSortMeta", "allRowsSelected", "empty", "filters", "filterDisplay", "filtersStore", "filterInputProps", "filterButtonProps", "first", "unstyled", "pt"])) : createCommentVNode("", true)], 64); - }), 128))], 16), $props.filterDisplay === "row" ? (openBlock(), createElementBlock("tr", mergeProps({ - key: 0, + }), 128))], 16)) : (openBlock(true), createElementBlock(Fragment, { + key: 1 + }, renderList($options.getHeaderRows(), function(row2, i) { + return openBlock(), createElementBlock("tr", mergeProps({ + key: i, + role: "row", + ref_for: true + }, _objectSpread$2(_objectSpread$2({}, _ctx.ptm("headerRow")), $options.getRowPT(row2, "root", i))), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.getHeaderColumns(row2), function(col, j) { + return openBlock(), createElementBlock(Fragment, { + key: $options.columnProp(col, "columnKey") || $options.columnProp(col, "field") || j + }, [!$options.columnProp(col, "hidden") && ($props.rowGroupMode !== "subheader" || $props.groupRowsBy !== $options.columnProp(col, "field")) && typeof col.children !== "string" ? (openBlock(), createBlock(_component_DTHeaderCell, { + key: 0, + column: col, + onColumnClick: _cache[15] || (_cache[15] = function($event) { + return _ctx.$emit("column-click", $event); + }), + onColumnMousedown: _cache[16] || (_cache[16] = function($event) { + return _ctx.$emit("column-mousedown", $event); + }), + groupRowsBy: $props.groupRowsBy, + groupRowSortField: $props.groupRowSortField, + sortMode: $props.sortMode, + sortField: $props.sortField, + sortOrder: $props.sortOrder, + multiSortMeta: $props.multiSortMeta, + allRowsSelected: $props.allRowsSelected, + empty: $props.empty, + onCheckboxChange: _cache[17] || (_cache[17] = function($event) { + return _ctx.$emit("checkbox-change", $event); + }), + filters: $props.filters, + filterDisplay: $props.filterDisplay, + filtersStore: $props.filtersStore, + onFilterChange: _cache[18] || (_cache[18] = function($event) { + return _ctx.$emit("filter-change", $event); + }), + onFilterApply: _cache[19] || (_cache[19] = function($event) { + return _ctx.$emit("filter-apply"); + }), + onOperatorChange: _cache[20] || (_cache[20] = function($event) { + return _ctx.$emit("operator-change", $event); + }), + onMatchmodeChange: _cache[21] || (_cache[21] = function($event) { + return _ctx.$emit("matchmode-change", $event); + }), + onConstraintAdd: _cache[22] || (_cache[22] = function($event) { + return _ctx.$emit("constraint-add", $event); + }), + onConstraintRemove: _cache[23] || (_cache[23] = function($event) { + return _ctx.$emit("constraint-remove", $event); + }), + onApplyClick: _cache[24] || (_cache[24] = function($event) { + return _ctx.$emit("apply-click", $event); + }), + unstyled: _ctx.unstyled, + pt: _ctx.pt + }, null, 8, ["column", "groupRowsBy", "groupRowSortField", "sortMode", "sortField", "sortOrder", "multiSortMeta", "allRowsSelected", "empty", "filters", "filterDisplay", "filtersStore", "unstyled", "pt"])) : createCommentVNode("", true)], 64); + }), 128))], 16); + }), 128)), $props.filterDisplay === "row" ? (openBlock(), createElementBlock("tr", mergeProps({ + key: 2, role: "row" }, _ctx.ptm("headerRow")), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.columns, function(col, i) { return openBlock(), createElementBlock(Fragment, { @@ -6295,7 +6318,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) { key: 0, checked: $props.allRowsSelected, disabled: $props.empty, - onChange: _cache[15] || (_cache[15] = function($event) { + onChange: _cache[25] || (_cache[25] = function($event) { return _ctx.$emit("checkbox-change", $event); }), column: col, @@ -6320,10 +6343,10 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) { filtersStore: $props.filtersStore, filterInputProps: $props.filterInputProps, filterButtonProps: $props.filterButtonProps, - onFilterChange: _cache[16] || (_cache[16] = function($event) { + onFilterChange: _cache[26] || (_cache[26] = function($event) { return _ctx.$emit("filter-change", $event); }), - onFilterApply: _cache[17] || (_cache[17] = function($event) { + onFilterApply: _cache[27] || (_cache[27] = function($event) { return _ctx.$emit("filter-apply"); }), filterMenuStyle: $options.columnProp(col, "filterMenuStyle"), @@ -6335,84 +6358,26 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) { showAddButton: $options.columnProp(col, "showAddButton"), matchModeOptions: $options.columnProp(col, "filterMatchModeOptions"), maxConstraints: $options.columnProp(col, "maxConstraints"), - onOperatorChange: _cache[18] || (_cache[18] = function($event) { + onOperatorChange: _cache[28] || (_cache[28] = function($event) { return _ctx.$emit("operator-change", $event); }), - onMatchmodeChange: _cache[19] || (_cache[19] = function($event) { + onMatchmodeChange: _cache[29] || (_cache[29] = function($event) { return _ctx.$emit("matchmode-change", $event); }), - onConstraintAdd: _cache[20] || (_cache[20] = function($event) { + onConstraintAdd: _cache[30] || (_cache[30] = function($event) { return _ctx.$emit("constraint-add", $event); }), - onConstraintRemove: _cache[21] || (_cache[21] = function($event) { + onConstraintRemove: _cache[31] || (_cache[31] = function($event) { return _ctx.$emit("constraint-remove", $event); }), - onApplyClick: _cache[22] || (_cache[22] = function($event) { + onApplyClick: _cache[32] || (_cache[32] = function($event) { return _ctx.$emit("apply-click", $event); }), column: col, unstyled: _ctx.unstyled, pt: _ctx.pt }, null, 8, ["field", "type", "showMenu", "filterElement", "filterHeaderTemplate", "filterFooterTemplate", "filterClearTemplate", "filterApplyTemplate", "filterIconTemplate", "filterAddIconTemplate", "filterRemoveIconTemplate", "filterClearIconTemplate", "filters", "filtersStore", "filterInputProps", "filterButtonProps", "filterMenuStyle", "filterMenuClass", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "matchModeOptions", "maxConstraints", "column", "unstyled", "pt"])) : createCommentVNode("", true)], 16)) : createCommentVNode("", true)], 64); - }), 128))], 16)) : createCommentVNode("", true)], 64)) : (openBlock(true), createElementBlock(Fragment, { - key: 1 - }, renderList($options.getHeaderRows(), function(row2, i) { - return openBlock(), createElementBlock("tr", mergeProps({ - key: i, - role: "row", - ref_for: true - }, _objectSpread$2(_objectSpread$2({}, _ctx.ptm("headerRow")), $options.getRowPT(row2, "root", i))), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.getHeaderColumns(row2), function(col, j) { - return openBlock(), createElementBlock(Fragment, { - key: $options.columnProp(col, "columnKey") || $options.columnProp(col, "field") || j - }, [!$options.columnProp(col, "hidden") && ($props.rowGroupMode !== "subheader" || $props.groupRowsBy !== $options.columnProp(col, "field")) && typeof col.children !== "string" ? (openBlock(), createBlock(_component_DTHeaderCell, { - key: 0, - column: col, - onColumnClick: _cache[23] || (_cache[23] = function($event) { - return _ctx.$emit("column-click", $event); - }), - onColumnMousedown: _cache[24] || (_cache[24] = function($event) { - return _ctx.$emit("column-mousedown", $event); - }), - groupRowsBy: $props.groupRowsBy, - groupRowSortField: $props.groupRowSortField, - sortMode: $props.sortMode, - sortField: $props.sortField, - sortOrder: $props.sortOrder, - multiSortMeta: $props.multiSortMeta, - allRowsSelected: $props.allRowsSelected, - empty: $props.empty, - onCheckboxChange: _cache[25] || (_cache[25] = function($event) { - return _ctx.$emit("checkbox-change", $event); - }), - filters: $props.filters, - filterDisplay: $props.filterDisplay, - filtersStore: $props.filtersStore, - onFilterChange: _cache[26] || (_cache[26] = function($event) { - return _ctx.$emit("filter-change", $event); - }), - onFilterApply: _cache[27] || (_cache[27] = function($event) { - return _ctx.$emit("filter-apply"); - }), - onOperatorChange: _cache[28] || (_cache[28] = function($event) { - return _ctx.$emit("operator-change", $event); - }), - onMatchmodeChange: _cache[29] || (_cache[29] = function($event) { - return _ctx.$emit("matchmode-change", $event); - }), - onConstraintAdd: _cache[30] || (_cache[30] = function($event) { - return _ctx.$emit("constraint-add", $event); - }), - onConstraintRemove: _cache[31] || (_cache[31] = function($event) { - return _ctx.$emit("constraint-remove", $event); - }), - onApplyClick: _cache[32] || (_cache[32] = function($event) { - return _ctx.$emit("apply-click", $event); - }), - unstyled: _ctx.unstyled, - pt: _ctx.pt - }, null, 8, ["column", "groupRowsBy", "groupRowSortField", "sortMode", "sortField", "sortOrder", "multiSortMeta", "allRowsSelected", "empty", "filters", "filterDisplay", "filtersStore", "unstyled", "pt"])) : createCommentVNode("", true)], 64); - }), 128))], 16); - }), 128))], 16); + }), 128))], 16)) : createCommentVNode("", true)], 16); } __name(render$1, "render$1"); script$1.render = render$1; @@ -6677,7 +6642,6 @@ var script = { } }, mounted: /* @__PURE__ */ __name(function mounted8() { - this.$el.setAttribute(this.attributeSelector, ""); if (this.isStateful()) { this.restoreState(); this.resizableColumns && this.restoreColumnWidths(); @@ -7044,11 +7008,11 @@ var script = { } this.rowTouched = false; if (focusedItem) { - var _event$target, _event$target2, _event$target3; - if (((_event$target = event2.target) === null || _event$target === void 0 ? void 0 : _event$target.getAttribute("data-pc-section")) === "rowtoggleicon" || ((_event$target2 = event2.target) === null || _event$target2 === void 0 || (_event$target2 = _event$target2.parentElement) === null || _event$target2 === void 0 ? void 0 : _event$target2.getAttribute("data-pc-section")) === "rowtoggleicon") return; - var targetRow = (_event$target3 = event2.target) === null || _event$target3 === void 0 ? void 0 : _event$target3.closest('tr[data-p-selectable-row="true"]'); + var _event$target, _event$currentTarget; + if (((_event$target = event2.target) === null || _event$target === void 0 ? void 0 : _event$target.getAttribute("data-pc-section")) === "rowtoggleicon") return; + var targetRow = (_event$currentTarget = event2.currentTarget) === null || _event$currentTarget === void 0 ? void 0 : _event$currentTarget.closest('tr[data-p-selectable-row="true"]'); focusedItem.tabIndex = "-1"; - targetRow.tabIndex = "0"; + if (targetRow) targetRow.tabIndex = "0"; } }, "onRowClick"), onRowDblClick: /* @__PURE__ */ __name(function onRowDblClick2(e) { @@ -7467,7 +7431,7 @@ var script = { this.$refs.resizeHelper.style.display = "block"; }, "onColumnResize"), onColumnResizeEnd: /* @__PURE__ */ __name(function onColumnResizeEnd() { - var delta = this.$refs.resizeHelper.offsetLeft - this.lastResizeHelperX; + var delta = isRTL(this.$el) ? this.lastResizeHelperX - this.$refs.resizeHelper.offsetLeft : this.$refs.resizeHelper.offsetLeft - this.lastResizeHelperX; var columnWidth = this.resizeColumnElement.offsetWidth; var newColumnWidth = columnWidth + delta; var minWidth = this.resizeColumnElement.style.minWidth || 15; @@ -7516,7 +7480,7 @@ var script = { this.destroyStyleElement(); this.createStyleElement(); var innerHTML = ""; - var selector = '[data-pc-name="datatable"]['.concat(this.attributeSelector, '] > [data-pc-section="tablecontainer"] ').concat(this.virtualScrollerDisabled ? "" : '> [data-pc-name="virtualscroller"]', ' > table[data-pc-section="table"]'); + var selector = '[data-pc-name="datatable"]['.concat(this.$attrSelector, '] > [data-pc-section="tablecontainer"] ').concat(this.virtualScrollerDisabled ? "" : '> [data-pc-name="virtualscroller"]', ' > table[data-pc-section="table"]'); widths.forEach(function(width, index) { var colWidth = index === colIndex ? newColumnWidth : nextColumnWidth && index === colIndex + 1 ? nextColumnWidth : width; var style = "width: ".concat(colWidth, "px !important; max-width: ").concat(colWidth, "px !important"); @@ -7701,7 +7665,7 @@ var script = { var index = e.index; if (this.rowDragging && this.draggedRowIndex !== index) { var rowElement = event2.currentTarget; - var rowY = getOffset(rowElement).top + getWindowScrollTop(); + var rowY = getOffset(rowElement).top; var pageY = event2.pageY; var rowMidY = rowY + getOuterHeight(rowElement) / 2; var prevRowElement = rowElement.previousElementSibling; @@ -7924,7 +7888,7 @@ var script = { addColumnWidthStyles: /* @__PURE__ */ __name(function addColumnWidthStyles(widths) { this.createStyleElement(); var innerHTML = ""; - var selector = '[data-pc-name="datatable"]['.concat(this.attributeSelector, '] > [data-pc-section="tablecontainer"] ').concat(this.virtualScrollerDisabled ? "" : '> [data-pc-name="virtualscroller"]', ' > table[data-pc-section="table"]'); + var selector = '[data-pc-name="datatable"]['.concat(this.$attrSelector, '] > [data-pc-section="tablecontainer"] ').concat(this.virtualScrollerDisabled ? "" : '> [data-pc-name="virtualscroller"]', ' > table[data-pc-section="table"]'); widths.forEach(function(width, index) { var style = "width: ".concat(width, "px !important; max-width: ").concat(width, "px !important"); innerHTML += "\n ".concat(selector, ' > thead[data-pc-section="thead"] > tr > th:nth-child(').concat(index + 1, "),\n ").concat(selector, ' > tbody[data-pc-section="tbody"] > tr > td:nth-child(').concat(index + 1, "),\n ").concat(selector, ' > tfoot[data-pc-section="tfoot"] > tr > td:nth-child(').concat(index + 1, ") {\n ").concat(style, "\n }\n "); @@ -8162,9 +8126,6 @@ var script = { }); } }, "allRowsSelected"), - attributeSelector: /* @__PURE__ */ __name(function attributeSelector2() { - return UniqueComponentId(); - }, "attributeSelector"), groupRowSortField: /* @__PURE__ */ __name(function groupRowSortField() { return this.sortMode === "single" ? this.sortField : this.d_groupRowsSortMeta ? this.d_groupRowsSortMeta.field : null; }, "groupRowSortField"), @@ -8232,10 +8193,10 @@ var script = { DTTableHeader: script$1, DTTableBody: script$7, DTTableFooter: script$5, - DTVirtualScroller: script$H, + DTVirtualScroller: script$I, ArrowDownIcon: script$q, ArrowUpIcon: script$p, - SpinnerIcon: script$I + SpinnerIcon: script$J } }; function _typeof(o) { @@ -8340,18 +8301,36 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { pt: _ctx.ptm("pcPaginator") }, createSlots({ _: 2 - }, [_ctx.$slots.paginatorstart ? { + }, [_ctx.$slots.paginatorcontainer ? { + name: "container", + fn: withCtx(function() { + return [renderSlot(_ctx.$slots, "paginatorcontainer", { + first: _ctx.slotProps.first, + last: _ctx.slotProps.last, + rows: _ctx.slotProps.rows, + page: _ctx.slotProps.page, + pageCount: _ctx.slotProps.pageCount, + totalRecords: _ctx.slotProps.totalRecords, + firstPageCallback: _ctx.slotProps.firstPageCallback, + lastPageCallback: _ctx.slotProps.lastPageCallback, + prevPageCallback: _ctx.slotProps.prevPageCallback, + nextPageCallback: _ctx.slotProps.nextPageCallback, + rowChangeCallback: _ctx.slotProps.rowChangeCallback + })]; + }), + key: "0" + } : void 0, _ctx.$slots.paginatorstart ? { name: "start", fn: withCtx(function() { return [renderSlot(_ctx.$slots, "paginatorstart")]; }), - key: "0" + key: "1" } : void 0, _ctx.$slots.paginatorend ? { name: "end", fn: withCtx(function() { return [renderSlot(_ctx.$slots, "paginatorend")]; }), - key: "1" + key: "2" } : void 0, _ctx.$slots.paginatorfirstpagelinkicon ? { name: "firstpagelinkicon", fn: withCtx(function(slotProps) { @@ -8359,7 +8338,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { "class": normalizeClass(slotProps["class"]) })]; }), - key: "2" + key: "3" } : void 0, _ctx.$slots.paginatorprevpagelinkicon ? { name: "prevpagelinkicon", fn: withCtx(function(slotProps) { @@ -8367,7 +8346,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { "class": normalizeClass(slotProps["class"]) })]; }), - key: "3" + key: "4" } : void 0, _ctx.$slots.paginatornextpagelinkicon ? { name: "nextpagelinkicon", fn: withCtx(function(slotProps) { @@ -8375,7 +8354,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { "class": normalizeClass(slotProps["class"]) })]; }), - key: "4" + key: "5" } : void 0, _ctx.$slots.paginatorlastpagelinkicon ? { name: "lastpagelinkicon", fn: withCtx(function(slotProps) { @@ -8383,7 +8362,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { "class": normalizeClass(slotProps["class"]) })]; }), - key: "5" + key: "6" } : void 0, _ctx.$slots.paginatorjumptopagedropdownicon ? { name: "jumptopagedropdownicon", fn: withCtx(function(slotProps) { @@ -8391,7 +8370,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { "class": normalizeClass(slotProps["class"]) })]; }), - key: "6" + key: "7" } : void 0, _ctx.$slots.paginatorrowsperpagedropdownicon ? { name: "rowsperpagedropdownicon", fn: withCtx(function(slotProps) { @@ -8399,7 +8378,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { "class": normalizeClass(slotProps["class"]) })]; }), - key: "7" + key: "8" } : void 0]), 1032, ["rows", "first", "totalRecords", "pageLinkSize", "template", "rowsPerPageOptions", "currentPageReportTemplate", "class", "alwaysShow", "unstyled", "pt"])) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ "class": _ctx.cx("tableContainer"), style: [_ctx.sx("tableContainer"), { @@ -8427,7 +8406,8 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { role: "table", "class": [_ctx.cx("table"), _ctx.tableClass], style: [_ctx.tableStyle, slotProps.spacerStyle] - }, _objectSpread(_objectSpread({}, _ctx.tableProps), _ctx.ptm("table"))), [createVNode(_component_DTTableHeader, { + }, _objectSpread(_objectSpread({}, _ctx.tableProps), _ctx.ptm("table"))), [_ctx.showHeaders ? (openBlock(), createBlock(_component_DTTableHeader, { + key: 0, columnGroup: $options.headerColumnGroup, columns: slotProps.columns, rowGroupMode: _ctx.rowGroupMode, @@ -8475,8 +8455,8 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { }), unstyled: _ctx.unstyled, pt: _ctx.pt - }, null, 8, ["columnGroup", "columns", "rowGroupMode", "groupRowsBy", "groupRowSortField", "reorderableColumns", "resizableColumns", "allRowsSelected", "empty", "sortMode", "sortField", "sortOrder", "multiSortMeta", "filters", "filtersStore", "filterDisplay", "filterButtonProps", "filterInputProps", "first", "onFilterChange", "onFilterApply", "unstyled", "pt"]), _ctx.frozenValue ? (openBlock(), createBlock(_component_DTTableBody, { - key: 0, + }, null, 8, ["columnGroup", "columns", "rowGroupMode", "groupRowsBy", "groupRowSortField", "reorderableColumns", "resizableColumns", "allRowsSelected", "empty", "sortMode", "sortField", "sortOrder", "multiSortMeta", "filters", "filtersStore", "filterDisplay", "filterButtonProps", "filterInputProps", "first", "onFilterChange", "onFilterApply", "unstyled", "pt"])) : createCommentVNode("", true), _ctx.frozenValue ? (openBlock(), createBlock(_component_DTTableBody, { + key: 1, ref: "frozenBodyRef", value: _ctx.frozenValue, frozenRow: true, @@ -8657,7 +8637,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { unstyled: _ctx.unstyled, pt: _ctx.pt }, null, 8, ["value", "class", "columns", "empty", "first", "dataKey", "selection", "selectionKeys", "selectionMode", "contextMenu", "contextMenuSelection", "rowGroupMode", "groupRowsBy", "expandableRowGroups", "rowClass", "rowStyle", "editMode", "compareSelectionBy", "scrollable", "expandedRowIcon", "collapsedRowIcon", "expandedRows", "expandedRowGroups", "editingRows", "editingRowKeys", "templates", "editButtonProps", "virtualScrollerContentProps", "isVirtualScrollerDisabled", "onRowgroupToggle", "onRowTouchend", "onRowKeydown", "onRowMousedown", "editingMeta", "onEditingMetaChange", "unstyled", "pt"]), $options.hasSpacerStyle(slotProps.spacerStyle) ? (openBlock(), createElementBlock("tbody", mergeProps({ - key: 1, + key: 2, "class": _ctx.cx("virtualScrollerSpacer"), style: { height: "calc(".concat(slotProps.spacerStyle.height, " - ").concat(slotProps.rows.length * slotProps.itemSize, "px)") @@ -8689,18 +8669,36 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { pt: _ctx.ptm("pcPaginator") }, createSlots({ _: 2 - }, [_ctx.$slots.paginatorstart ? { + }, [_ctx.$slots.paginatorcontainer ? { + name: "container", + fn: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "paginatorcontainer", { + first: slotProps.first, + last: slotProps.last, + rows: slotProps.rows, + page: slotProps.page, + pageCount: slotProps.pageCount, + totalRecords: slotProps.totalRecords, + firstPageCallback: slotProps.firstPageCallback, + lastPageCallback: slotProps.lastPageCallback, + prevPageCallback: slotProps.prevPageCallback, + nextPageCallback: slotProps.nextPageCallback, + rowChangeCallback: slotProps.rowChangeCallback + })]; + }), + key: "0" + } : void 0, _ctx.$slots.paginatorstart ? { name: "start", fn: withCtx(function() { return [renderSlot(_ctx.$slots, "paginatorstart")]; }), - key: "0" + key: "1" } : void 0, _ctx.$slots.paginatorend ? { name: "end", fn: withCtx(function() { return [renderSlot(_ctx.$slots, "paginatorend")]; }), - key: "1" + key: "2" } : void 0, _ctx.$slots.paginatorfirstpagelinkicon ? { name: "firstpagelinkicon", fn: withCtx(function(slotProps) { @@ -8708,7 +8706,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { "class": normalizeClass(slotProps["class"]) })]; }), - key: "2" + key: "3" } : void 0, _ctx.$slots.paginatorprevpagelinkicon ? { name: "prevpagelinkicon", fn: withCtx(function(slotProps) { @@ -8716,7 +8714,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { "class": normalizeClass(slotProps["class"]) })]; }), - key: "3" + key: "4" } : void 0, _ctx.$slots.paginatornextpagelinkicon ? { name: "nextpagelinkicon", fn: withCtx(function(slotProps) { @@ -8724,7 +8722,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { "class": normalizeClass(slotProps["class"]) })]; }), - key: "4" + key: "5" } : void 0, _ctx.$slots.paginatorlastpagelinkicon ? { name: "lastpagelinkicon", fn: withCtx(function(slotProps) { @@ -8732,7 +8730,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { "class": normalizeClass(slotProps["class"]) })]; }), - key: "5" + key: "6" } : void 0, _ctx.$slots.paginatorjumptopagedropdownicon ? { name: "jumptopagedropdownicon", fn: withCtx(function(slotProps) { @@ -8740,7 +8738,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { "class": normalizeClass(slotProps["class"]) })]; }), - key: "6" + key: "7" } : void 0, _ctx.$slots.paginatorrowsperpagedropdownicon ? { name: "rowsperpagedropdownicon", fn: withCtx(function(slotProps) { @@ -8748,7 +8746,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { "class": normalizeClass(slotProps["class"]) })]; }), - key: "7" + key: "8" } : void 0]), 1032, ["rows", "first", "totalRecords", "pageLinkSize", "template", "rowsPerPageOptions", "currentPageReportTemplate", "class", "alwaysShow", "unstyled", "pt"])) : createCommentVNode("", true), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", mergeProps({ key: 4, "class": _ctx.cx("footer") @@ -8779,7 +8777,14 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) { __name(render2, "render"); script.render = render2; export { - script as a, - script$r as s + script$m as a, + script$n as b, + script$o as c, + script$f as d, + script$d as e, + script$e as f, + script$r as g, + script as h, + script$l as s }; -//# sourceMappingURL=index-DpF-ptbJ.js.map +//# sourceMappingURL=index-CdHVC5qq.js.map diff --git a/web/assets/index-QvfM__ze.js b/web/assets/index-CmVtQCAR.js similarity index 90% rename from web/assets/index-QvfM__ze.js rename to web/assets/index-CmVtQCAR.js index dc3143769..4d89b4a55 100644 --- a/web/assets/index-QvfM__ze.js +++ b/web/assets/index-CmVtQCAR.js @@ -1,6 +1,6 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-CDDCHVO0.js","./index-Q1cQr26V.js","./keybindingService-Cak1En5n.js","./serverConfigStore-DCme3xlV.js","./GraphView-CqZ3opAX.css","./UserSelectView-CXmVKOeK.js","./BaseViewTemplate-BhQMaVFP.js","./ServerStartView-48wfE1MS.js","./ServerStartView-CJiwVDQY.css","./InstallView-By3hC1fC.js","./InstallView-CxhfFC8Y.css","./WelcomeView-C8whKl15.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-Vc8_xWgH.js","./NotSupportedView-DQerxQzi.css","./DownloadGitView-rPK_vYgU.js","./ManualConfigurationView-enyqGo0M.js","./ManualConfigurationView-CsirlNfV.css","./MetricsConsentView-lSfLu4nr.js","./DesktopStartView-le6AjGZr.js","./KeybindingPanel-D6O16W_1.js","./index-DpF-ptbJ.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-3jWrm6Zi.js","./ServerConfigPanel-B-w0HFlz.js","./index-je62U6DH.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-DKrBTQLe.js","./index-BWow9lpT.js","./index-I0brO37W.js","./keybindingService-CqSjCYw-.js","./serverConfigStore-BUvaGcxp.js","./GraphView-CVCdiww1.css","./UserSelectView-DNnNy-AZ.js","./BaseViewTemplate-Cof5Ihf_.js","./ServerStartView-M5VckhgZ.js","./ServerStartView-CJiwVDQY.css","./InstallView-C6tMsokB.js","./index-Bm1HvJhs.js","./uvMirrors-B-HKMf6X.js","./InstallView-DbJ2cGfL.css","./WelcomeView-Nvn1jaCx.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-BRtvC5Gx.js","./NotSupportedView-RFx6eCkN.css","./DownloadGitView-At9xRwC5.js","./ManualConfigurationView-CtZMj_n_.js","./ManualConfigurationView-CsirlNfV.css","./MetricsConsentView-Df03LOI_.js","./DesktopStartView-DTiwKLp6.js","./MaintenanceView-D3drnrFc.js","./index-CdHVC5qq.js","./MaintenanceView-Bj5_Vr6o.css","./KeybindingPanel-BbfXtVg1.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-C_ZBlIyE.js","./ServerConfigPanel-C2nrpEEV.js","./index-BPn8eYlx.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); var __defProp2 = Object.defineProperty; -var __name = (target, value4) => __defProp2(target, "name", { value: value4, configurable: true }); +var __name = (target2, value4) => __defProp2(target2, "name", { value: value4, configurable: true }); (/* @__PURE__ */ __name(function polyfill2() { const relList = document.createElement("link").relList; if (relList && relList.supports && relList.supports("modulepreload")) { @@ -40,93 +40,97 @@ var __name = (target, value4) => __defProp2(target, "name", { value: value4, con } __name(processPreload, "processPreload"); }, "polyfill"))(); -var __defProp$2 = Object.defineProperty; -var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols; -var __hasOwnProp$1 = Object.prototype.hasOwnProperty; -var __propIsEnum$1 = Object.prototype.propertyIsEnumerable; -var __defNormalProp$2 = /* @__PURE__ */ __name((obj, key, value4) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value: value4 }) : obj[key] = value4, "__defNormalProp$2"); -var __spreadValues$1 = /* @__PURE__ */ __name((a2, b2) => { +var __defProp$7 = Object.defineProperty; +var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols; +var __hasOwnProp$6 = Object.prototype.hasOwnProperty; +var __propIsEnum$6 = Object.prototype.propertyIsEnumerable; +var __defNormalProp$7 = /* @__PURE__ */ __name((obj, key, value4) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value: value4 }) : obj[key] = value4, "__defNormalProp$7"); +var __spreadValues$6 = /* @__PURE__ */ __name((a2, b2) => { for (var prop2 in b2 || (b2 = {})) - if (__hasOwnProp$1.call(b2, prop2)) - __defNormalProp$2(a2, prop2, b2[prop2]); - if (__getOwnPropSymbols$1) - for (var prop2 of __getOwnPropSymbols$1(b2)) { - if (__propIsEnum$1.call(b2, prop2)) - __defNormalProp$2(a2, prop2, b2[prop2]); + if (__hasOwnProp$6.call(b2, prop2)) + __defNormalProp$7(a2, prop2, b2[prop2]); + if (__getOwnPropSymbols$6) + for (var prop2 of __getOwnPropSymbols$6(b2)) { + if (__propIsEnum$6.call(b2, prop2)) + __defNormalProp$7(a2, prop2, b2[prop2]); } return a2; -}, "__spreadValues$1"); -function isEmpty$1(value4) { +}, "__spreadValues$6"); +function isEmpty$3(value4) { return value4 === null || value4 === void 0 || value4 === "" || Array.isArray(value4) && value4.length === 0 || !(value4 instanceof Date) && typeof value4 === "object" && Object.keys(value4).length === 0; } -__name(isEmpty$1, "isEmpty$1"); -function compare$1(value1, value22, comparator2, order = 1) { +__name(isEmpty$3, "isEmpty$3"); +function compare$3(value1, value22, comparator, order = 1) { let result = -1; - const emptyValue1 = isEmpty$1(value1); - const emptyValue2 = isEmpty$1(value22); + const emptyValue1 = isEmpty$3(value1); + const emptyValue2 = isEmpty$3(value22); if (emptyValue1 && emptyValue2) result = 0; else if (emptyValue1) result = order; else if (emptyValue2) result = -order; - else if (typeof value1 === "string" && typeof value22 === "string") result = comparator2(value1, value22); + else if (typeof value1 === "string" && typeof value22 === "string") result = comparator(value1, value22); else result = value1 < value22 ? -1 : value1 > value22 ? 1 : 0; return result; } -__name(compare$1, "compare$1"); -function deepEquals(obj1, obj2) { +__name(compare$3, "compare$3"); +function _deepEquals$2(obj1, obj2, visited = /* @__PURE__ */ new WeakSet()) { if (obj1 === obj2) return true; - if (obj1 && obj2 && typeof obj1 == "object" && typeof obj2 == "object") { - var arrObj1 = Array.isArray(obj1), arrObj2 = Array.isArray(obj2), i2, length, key; - if (arrObj1 && arrObj2) { - length = obj1.length; - if (length != obj2.length) return false; - for (i2 = length; i2-- !== 0; ) if (!deepEquals(obj1[i2], obj2[i2])) return false; - return true; - } - if (arrObj1 != arrObj2) return false; - var dateObj1 = obj1 instanceof Date, dateObj2 = obj2 instanceof Date; - if (dateObj1 != dateObj2) return false; - if (dateObj1 && dateObj2) return obj1.getTime() == obj2.getTime(); - var regexpObj1 = obj1 instanceof RegExp, regexpObj2 = obj2 instanceof RegExp; - if (regexpObj1 != regexpObj2) return false; - if (regexpObj1 && regexpObj2) return obj1.toString() == obj2.toString(); - var keys2 = Object.keys(obj1); - length = keys2.length; - if (length !== Object.keys(obj2).length) return false; - for (i2 = length; i2-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(obj2, keys2[i2])) return false; - for (i2 = length; i2-- !== 0; ) { - key = keys2[i2]; - if (!deepEquals(obj1[key], obj2[key])) return false; - } + if (!obj1 || !obj2 || typeof obj1 !== "object" || typeof obj2 !== "object") return false; + if (visited.has(obj1) || visited.has(obj2)) return false; + visited.add(obj1).add(obj2); + let arrObj1 = Array.isArray(obj1), arrObj2 = Array.isArray(obj2), i2, length, key; + if (arrObj1 && arrObj2) { + length = obj1.length; + if (length != obj2.length) return false; + for (i2 = length; i2-- !== 0; ) if (!_deepEquals$2(obj1[i2], obj2[i2], visited)) return false; return true; } - return obj1 !== obj1 && obj2 !== obj2; + if (arrObj1 != arrObj2) return false; + let dateObj1 = obj1 instanceof Date, dateObj2 = obj2 instanceof Date; + if (dateObj1 != dateObj2) return false; + if (dateObj1 && dateObj2) return obj1.getTime() == obj2.getTime(); + let regexpObj1 = obj1 instanceof RegExp, regexpObj2 = obj2 instanceof RegExp; + if (regexpObj1 != regexpObj2) return false; + if (regexpObj1 && regexpObj2) return obj1.toString() == obj2.toString(); + let keys2 = Object.keys(obj1); + length = keys2.length; + if (length !== Object.keys(obj2).length) return false; + for (i2 = length; i2-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(obj2, keys2[i2])) return false; + for (i2 = length; i2-- !== 0; ) { + key = keys2[i2]; + if (!_deepEquals$2(obj1[key], obj2[key], visited)) return false; + } + return true; } -__name(deepEquals, "deepEquals"); -function isFunction$9(value4) { +__name(_deepEquals$2, "_deepEquals$2"); +function deepEquals$2(obj1, obj2) { + return _deepEquals$2(obj1, obj2); +} +__name(deepEquals$2, "deepEquals$2"); +function isFunction$d(value4) { return !!(value4 && value4.constructor && value4.call && value4.apply); } -__name(isFunction$9, "isFunction$9"); -function isNotEmpty(value4) { - return !isEmpty$1(value4); +__name(isFunction$d, "isFunction$d"); +function isNotEmpty$2(value4) { + return !isEmpty$3(value4); } -__name(isNotEmpty, "isNotEmpty"); -function resolveFieldData(data25, field) { - if (!data25 || !field) { +__name(isNotEmpty$2, "isNotEmpty$2"); +function resolveFieldData$2(data26, field2) { + if (!data26 || !field2) { return null; } try { - const value4 = data25[field]; - if (isNotEmpty(value4)) return value4; + const value4 = data26[field2]; + if (isNotEmpty$2(value4)) return value4; } catch (e2) { } - if (Object.keys(data25).length) { - if (isFunction$9(field)) { - return field(data25); - } else if (field.indexOf(".") === -1) { - return data25[field]; + if (Object.keys(data26).length) { + if (isFunction$d(field2)) { + return field2(data26); + } else if (field2.indexOf(".") === -1) { + return data26[field2]; } else { - let fields = field.split("."); - let value4 = data25; + let fields = field2.split("."); + let value4 = data26; for (let i2 = 0, len = fields.length; i2 < len; ++i2) { if (value4 == null) { return null; @@ -138,27 +142,27 @@ function resolveFieldData(data25, field) { } return null; } -__name(resolveFieldData, "resolveFieldData"); -function equals(obj1, obj2, field) { - if (field) return resolveFieldData(obj1, field) === resolveFieldData(obj2, field); - else return deepEquals(obj1, obj2); +__name(resolveFieldData$2, "resolveFieldData$2"); +function equals$2(obj1, obj2, field2) { + if (field2) return resolveFieldData$2(obj1, field2) === resolveFieldData$2(obj2, field2); + else return deepEquals$2(obj1, obj2); } -__name(equals, "equals"); -function contains(value4, list2) { +__name(equals$2, "equals$2"); +function contains$2(value4, list2) { if (value4 != null && list2 && list2.length) { for (let val of list2) { - if (equals(value4, val)) return true; + if (equals$2(value4, val)) return true; } } return false; } -__name(contains, "contains"); -function filter(value4, fields, filterValue) { +__name(contains$2, "contains$2"); +function filter$2(value4, fields, filterValue) { let filteredItems = []; if (value4) { for (let item3 of value4) { - for (let field of fields) { - if (String(resolveFieldData(item3, field)).toLowerCase().indexOf(filterValue.toLowerCase()) > -1) { + for (let field2 of fields) { + if (String(resolveFieldData$2(item3, field2)).toLowerCase().indexOf(filterValue.toLowerCase()) > -1) { filteredItems.push(item3); break; } @@ -167,8 +171,8 @@ function filter(value4, fields, filterValue) { } return filteredItems; } -__name(filter, "filter"); -function findIndexInList(value4, list2) { +__name(filter$2, "filter$2"); +function findIndexInList$2(value4, list2) { let index2 = -1; if (list2) { for (let i2 = 0; i2 < list2.length; i2++) { @@ -180,10 +184,10 @@ function findIndexInList(value4, list2) { } return index2; } -__name(findIndexInList, "findIndexInList"); -function findLast$1(arr, callback) { +__name(findIndexInList$2, "findIndexInList$2"); +function findLast$3(arr, callback) { let item3; - if (isNotEmpty(arr)) { + if (isNotEmpty$2(arr)) { try { item3 = arr.findLast(callback); } catch (e2) { @@ -192,10 +196,10 @@ function findLast$1(arr, callback) { } return item3; } -__name(findLast$1, "findLast$1"); -function findLastIndex(arr, callback) { +__name(findLast$3, "findLast$3"); +function findLastIndex$2(arr, callback) { let index2 = -1; - if (isNotEmpty(arr)) { + if (isNotEmpty$2(arr)) { try { index2 = arr.findLastIndex(callback); } catch (e2) { @@ -204,34 +208,34 @@ function findLastIndex(arr, callback) { } return index2; } -__name(findLastIndex, "findLastIndex"); -function isObject$e(value4, empty3 = true) { +__name(findLastIndex$2, "findLastIndex$2"); +function isObject$g(value4, empty3 = true) { return value4 instanceof Object && value4.constructor === Object && (empty3 || Object.keys(value4).length !== 0); } -__name(isObject$e, "isObject$e"); -function resolve$2(obj, ...params) { - return isFunction$9(obj) ? obj(...params) : obj; +__name(isObject$g, "isObject$g"); +function resolve$4(obj, ...params) { + return isFunction$d(obj) ? obj(...params) : obj; } -__name(resolve$2, "resolve$2"); -function isString$9(value4, empty3 = true) { +__name(resolve$4, "resolve$4"); +function isString$b(value4, empty3 = true) { return typeof value4 === "string" && (empty3 || value4 !== ""); } -__name(isString$9, "isString$9"); -function toFlatCase(str) { - return isString$9(str) ? str.replace(/(-|_)/g, "").toLowerCase() : str; +__name(isString$b, "isString$b"); +function toFlatCase$2(str) { + return isString$b(str) ? str.replace(/(-|_)/g, "").toLowerCase() : str; } -__name(toFlatCase, "toFlatCase"); -function getKeyValue(obj, key = "", params = {}) { - const fKeys = toFlatCase(key).split("."); +__name(toFlatCase$2, "toFlatCase$2"); +function getKeyValue$2(obj, key = "", params = {}) { + const fKeys = toFlatCase$2(key).split("."); const fKey = fKeys.shift(); - return fKey ? isObject$e(obj) ? getKeyValue(resolve$2(obj[Object.keys(obj).find((k2) => toFlatCase(k2) === fKey) || ""], params), fKeys.join("."), params) : void 0 : resolve$2(obj, params); + return fKey ? isObject$g(obj) ? getKeyValue$2(resolve$4(obj[Object.keys(obj).find((k2) => toFlatCase$2(k2) === fKey) || ""], params), fKeys.join("."), params) : void 0 : resolve$4(obj, params); } -__name(getKeyValue, "getKeyValue"); -function insertIntoOrderedArray(item3, index2, arr, sourceArr) { +__name(getKeyValue$2, "getKeyValue$2"); +function insertIntoOrderedArray$2(item3, index2, arr, sourceArr) { if (arr.length > 0) { let injected = false; for (let i2 = 0; i2 < arr.length; i2++) { - let currentItemIndex = findIndexInList(arr[i2], sourceArr); + let currentItemIndex = findIndexInList$2(arr[i2], sourceArr); if (currentItemIndex > index2) { arr.splice(i2, 0, item3); injected = true; @@ -245,28 +249,36 @@ function insertIntoOrderedArray(item3, index2, arr, sourceArr) { arr.push(item3); } } -__name(insertIntoOrderedArray, "insertIntoOrderedArray"); -function isArray$a(value4, empty3 = true) { +__name(insertIntoOrderedArray$2, "insertIntoOrderedArray$2"); +function isArray$c(value4, empty3 = true) { return Array.isArray(value4) && (empty3 || value4.length !== 0); } -__name(isArray$a, "isArray$a"); -function isDate$3(value4) { +__name(isArray$c, "isArray$c"); +function isDate$5(value4) { return value4 instanceof Date && value4.constructor === Date; } -__name(isDate$3, "isDate$3"); -function isNumber$5(value4) { - return isNotEmpty(value4) && !isNaN(value4); +__name(isDate$5, "isDate$5"); +function isLetter$3(char) { + return /^[a-zA-Z\u00C0-\u017F]$/.test(char); } -__name(isNumber$5, "isNumber$5"); -function isPrintableCharacter(char = "") { - return isNotEmpty(char) && char.length === 1 && !!char.match(/\S| /); +__name(isLetter$3, "isLetter$3"); +function isNumber$7(value4) { + return isNotEmpty$2(value4) && !isNaN(value4); } -__name(isPrintableCharacter, "isPrintableCharacter"); -function localeComparator() { +__name(isNumber$7, "isNumber$7"); +function isPrintableCharacter$2(char = "") { + return isNotEmpty$2(char) && char.length === 1 && !!char.match(/\S| /); +} +__name(isPrintableCharacter$2, "isPrintableCharacter$2"); +function isScalar$2(value4) { + return value4 != null && (typeof value4 === "string" || typeof value4 === "number" || typeof value4 === "bigint" || typeof value4 === "boolean"); +} +__name(isScalar$2, "isScalar$2"); +function localeComparator$2() { return new Intl.Collator(void 0, { numeric: true }).compare; } -__name(localeComparator, "localeComparator"); -function matchRegex(str, regex2) { +__name(localeComparator$2, "localeComparator$2"); +function matchRegex$2(str, regex2) { if (regex2) { const match2 = regex2.test(str); regex2.lastIndex = 0; @@ -274,13 +286,13 @@ function matchRegex(str, regex2) { } return false; } -__name(matchRegex, "matchRegex"); -function mergeKeys(...args) { - const _mergeKeys = /* @__PURE__ */ __name((target = {}, source = {}) => { - const mergedObj = __spreadValues$1({}, target); +__name(matchRegex$2, "matchRegex$2"); +function mergeKeys$2(...args) { + const _mergeKeys = /* @__PURE__ */ __name((target2 = {}, source = {}) => { + const mergedObj = __spreadValues$6({}, target2); Object.keys(source).forEach((key) => { - if (isObject$e(source[key]) && key in target && isObject$e(target[key])) { - mergedObj[key] = _mergeKeys(target[key], source[key]); + if (isObject$g(source[key]) && key in target2 && isObject$g(target2[key])) { + mergedObj[key] = _mergeKeys(target2[key], source[key]); } else { mergedObj[key] = source[key]; } @@ -289,27 +301,83 @@ function mergeKeys(...args) { }, "_mergeKeys"); return args.reduce((acc, obj, i2) => i2 === 0 ? obj : _mergeKeys(acc, obj), {}); } -__name(mergeKeys, "mergeKeys"); -function minifyCSS(css3) { - return css3 ? css3.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, "").replace(/ {2,}/g, " ").replace(/ ([{:}]) /g, "$1").replace(/([;,]) /g, "$1").replace(/ !/g, "!").replace(/: /g, ":") : css3; +__name(mergeKeys$2, "mergeKeys$2"); +function minifyCSS$2(css4) { + return css4 ? css4.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, "").replace(/ {2,}/g, " ").replace(/ ([{:}]) /g, "$1").replace(/([;,]) /g, "$1").replace(/ !/g, "!").replace(/: /g, ":") : css4; } -__name(minifyCSS, "minifyCSS"); -function nestedKeys(obj = {}, parentKey = "") { +__name(minifyCSS$2, "minifyCSS$2"); +function nestedKeys$2(obj = {}, parentKey = "") { return Object.entries(obj).reduce((o2, [key, value4]) => { const currentKey = parentKey ? `${parentKey}.${key}` : key; - isObject$e(value4) ? o2 = o2.concat(nestedKeys(value4, currentKey)) : o2.push(currentKey); + isObject$g(value4) ? o2 = o2.concat(nestedKeys$2(value4, currentKey)) : o2.push(currentKey); return o2; }, []); } -__name(nestedKeys, "nestedKeys"); -function removeAccents(str) { - if (str && str.search(/[\xC0-\xFF]/g) > -1) { - str = str.replace(/[\xC0-\xC5]/g, "A").replace(/[\xC6]/g, "AE").replace(/[\xC7]/g, "C").replace(/[\xC8-\xCB]/g, "E").replace(/[\xCC-\xCF]/g, "I").replace(/[\xD0]/g, "D").replace(/[\xD1]/g, "N").replace(/[\xD2-\xD6\xD8]/g, "O").replace(/[\xD9-\xDC]/g, "U").replace(/[\xDD]/g, "Y").replace(/[\xDE]/g, "P").replace(/[\xE0-\xE5]/g, "a").replace(/[\xE6]/g, "ae").replace(/[\xE7]/g, "c").replace(/[\xE8-\xEB]/g, "e").replace(/[\xEC-\xEF]/g, "i").replace(/[\xF1]/g, "n").replace(/[\xF2-\xF6\xF8]/g, "o").replace(/[\xF9-\xFC]/g, "u").replace(/[\xFE]/g, "p").replace(/[\xFD\xFF]/g, "y"); +__name(nestedKeys$2, "nestedKeys$2"); +function omit$3(obj, ...keys2) { + if (!isObject$g(obj)) return obj; + const copy2 = __spreadValues$6({}, obj); + keys2 == null ? void 0 : keys2.flat().forEach((key) => delete copy2[key]); + return copy2; +} +__name(omit$3, "omit$3"); +function removeAccents$2(str) { + const accentCheckRegex = /[\xC0-\xFF\u0100-\u017E]/; + if (str && accentCheckRegex.test(str)) { + const accentsMap = { + A: /[\xC0-\xC5\u0100\u0102\u0104]/g, + AE: /[\xC6]/g, + C: /[\xC7\u0106\u0108\u010A\u010C]/g, + D: /[\xD0\u010E\u0110]/g, + E: /[\xC8-\xCB\u0112\u0114\u0116\u0118\u011A]/g, + G: /[\u011C\u011E\u0120\u0122]/g, + H: /[\u0124\u0126]/g, + I: /[\xCC-\xCF\u0128\u012A\u012C\u012E\u0130]/g, + IJ: /[\u0132]/g, + J: /[\u0134]/g, + K: /[\u0136]/g, + L: /[\u0139\u013B\u013D\u013F\u0141]/g, + N: /[\xD1\u0143\u0145\u0147\u014A]/g, + O: /[\xD2-\xD6\xD8\u014C\u014E\u0150]/g, + OE: /[\u0152]/g, + R: /[\u0154\u0156\u0158]/g, + S: /[\u015A\u015C\u015E\u0160]/g, + T: /[\u0162\u0164\u0166]/g, + U: /[\xD9-\xDC\u0168\u016A\u016C\u016E\u0170\u0172]/g, + W: /[\u0174]/g, + Y: /[\xDD\u0176\u0178]/g, + Z: /[\u0179\u017B\u017D]/g, + a: /[\xE0-\xE5\u0101\u0103\u0105]/g, + ae: /[\xE6]/g, + c: /[\xE7\u0107\u0109\u010B\u010D]/g, + d: /[\u010F\u0111]/g, + e: /[\xE8-\xEB\u0113\u0115\u0117\u0119\u011B]/g, + g: /[\u011D\u011F\u0121\u0123]/g, + i: /[\xEC-\xEF\u0129\u012B\u012D\u012F\u0131]/g, + ij: /[\u0133]/g, + j: /[\u0135]/g, + k: /[\u0137,\u0138]/g, + l: /[\u013A\u013C\u013E\u0140\u0142]/g, + n: /[\xF1\u0144\u0146\u0148\u014B]/g, + p: /[\xFE]/g, + o: /[\xF2-\xF6\xF8\u014D\u014F\u0151]/g, + oe: /[\u0153]/g, + r: /[\u0155\u0157\u0159]/g, + s: /[\u015B\u015D\u015F\u0161]/g, + t: /[\u0163\u0165\u0167]/g, + u: /[\xF9-\xFC\u0169\u016B\u016D\u016F\u0171\u0173]/g, + w: /[\u0175]/g, + y: /[\xFD\xFF\u0177]/g, + z: /[\u017A\u017C\u017E]/g + }; + for (let key in accentsMap) { + str = str.replace(accentsMap[key], key); + } } return str; } -__name(removeAccents, "removeAccents"); -function reorderArray(value4, from2, to) { +__name(removeAccents$2, "removeAccents$2"); +function reorderArray$2(value4, from2, to) { if (value4 && from2 !== to) { if (to >= value4.length) { to %= value4.length; @@ -318,67 +386,78 @@ function reorderArray(value4, from2, to) { value4.splice(to, 0, value4.splice(from2, 1)[0]); } } -__name(reorderArray, "reorderArray"); -function sort(value1, value22, order = 1, comparator2, nullSortOrder = 1) { - const result = compare$1(value1, value22, comparator2, order); +__name(reorderArray$2, "reorderArray$2"); +function sort$2(value1, value22, order = 1, comparator, nullSortOrder = 1) { + const result = compare$3(value1, value22, comparator, order); let finalSortOrder = order; - if (isEmpty$1(value1) || isEmpty$1(value22)) { + if (isEmpty$3(value1) || isEmpty$3(value22)) { finalSortOrder = nullSortOrder === 1 ? order : nullSortOrder; } return finalSortOrder * result; } -__name(sort, "sort"); -function stringify(value4, indent = 2, currentIndent = 0) { +__name(sort$2, "sort$2"); +function stringify$2(value4, indent = 2, currentIndent = 0) { const currentIndentStr = " ".repeat(currentIndent); const nextIndentStr = " ".repeat(currentIndent + indent); - if (isArray$a(value4)) { - return "[" + value4.map((v2) => stringify(v2, indent, currentIndent + indent)).join(", ") + "]"; - } else if (isDate$3(value4)) { + if (isArray$c(value4)) { + return "[" + value4.map((v2) => stringify$2(v2, indent, currentIndent + indent)).join(", ") + "]"; + } else if (isDate$5(value4)) { return value4.toISOString(); - } else if (isFunction$9(value4)) { + } else if (isFunction$d(value4)) { return value4.toString(); - } else if (isObject$e(value4)) { - return "{\n" + Object.entries(value4).map(([k2, v2]) => `${nextIndentStr}${k2}: ${stringify(v2, indent, currentIndent + indent)}`).join(",\n") + ` + } else if (isObject$g(value4)) { + return "{\n" + Object.entries(value4).map(([k2, v2]) => `${nextIndentStr}${k2}: ${stringify$2(v2, indent, currentIndent + indent)}`).join(",\n") + ` ${currentIndentStr}}`; } else { return JSON.stringify(value4); } } -__name(stringify, "stringify"); -function toCapitalCase(str) { - return isString$9(str, false) ? str[0].toUpperCase() + str.slice(1) : str; +__name(stringify$2, "stringify$2"); +function toCapitalCase$2(str) { + return isString$b(str, false) ? str[0].toUpperCase() + str.slice(1) : str; } -__name(toCapitalCase, "toCapitalCase"); -function toKebabCase(str) { - return isString$9(str) ? str.replace(/(_)/g, "-").replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "-" + c2.toLowerCase()).toLowerCase() : str; +__name(toCapitalCase$2, "toCapitalCase$2"); +function toKebabCase$2(str) { + return isString$b(str) ? str.replace(/(_)/g, "-").replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "-" + c2.toLowerCase()).toLowerCase() : str; } -__name(toKebabCase, "toKebabCase"); -function toTokenKey$1(str) { - return isString$9(str) ? str.replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "." + c2.toLowerCase()).toLowerCase() : str; +__name(toKebabCase$2, "toKebabCase$2"); +function toTokenKey$4(str) { + return isString$b(str) ? str.replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "." + c2.toLowerCase()).toLowerCase() : str; } -__name(toTokenKey$1, "toTokenKey$1"); -function EventBus() { +__name(toTokenKey$4, "toTokenKey$4"); +function toValue$6(value4) { + if (value4 && typeof value4 === "object") { + if (value4.hasOwnProperty("current")) { + return value4.current; + } else if (value4.hasOwnProperty("value")) { + return value4.value; + } + } + return resolve$4(value4); +} +__name(toValue$6, "toValue$6"); +function EventBus$1() { const allHandlers = /* @__PURE__ */ new Map(); return { - on(type, handler6) { + on(type, handler12) { let handlers2 = allHandlers.get(type); - if (!handlers2) handlers2 = [handler6]; - else handlers2.push(handler6); + if (!handlers2) handlers2 = [handler12]; + else handlers2.push(handler12); allHandlers.set(type, handlers2); return this; }, - off(type, handler6) { + off(type, handler12) { let handlers2 = allHandlers.get(type); if (handlers2) { - handlers2.splice(handlers2.indexOf(handler6) >>> 0, 1); + handlers2.splice(handlers2.indexOf(handler12) >>> 0, 1); } return this; }, emit(type, evt) { let handlers2 = allHandlers.get(type); if (handlers2) { - handlers2.slice().map((handler6) => { - handler6(evt); + handlers2.slice().map((handler12) => { + handler12(evt); }); } }, @@ -387,215 +466,223 @@ function EventBus() { } }; } -__name(EventBus, "EventBus"); -var __defProp$1 = Object.defineProperty; -var __defProps = Object.defineProperties; -var __getOwnPropDescs = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols = Object.getOwnPropertySymbols; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __propIsEnum = Object.prototype.propertyIsEnumerable; -var __defNormalProp$1 = /* @__PURE__ */ __name((obj, key, value4) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value: value4 }) : obj[key] = value4, "__defNormalProp$1"); -var __spreadValues = /* @__PURE__ */ __name((a2, b2) => { +__name(EventBus$1, "EventBus$1"); +var __defProp$6 = Object.defineProperty; +var __defProps$1 = Object.defineProperties; +var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors; +var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols; +var __hasOwnProp$5 = Object.prototype.hasOwnProperty; +var __propIsEnum$5 = Object.prototype.propertyIsEnumerable; +var __defNormalProp$6 = /* @__PURE__ */ __name((obj, key, value4) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value: value4 }) : obj[key] = value4, "__defNormalProp$6"); +var __spreadValues$5 = /* @__PURE__ */ __name((a2, b2) => { for (var prop2 in b2 || (b2 = {})) - if (__hasOwnProp.call(b2, prop2)) - __defNormalProp$1(a2, prop2, b2[prop2]); - if (__getOwnPropSymbols) - for (var prop2 of __getOwnPropSymbols(b2)) { - if (__propIsEnum.call(b2, prop2)) - __defNormalProp$1(a2, prop2, b2[prop2]); + if (__hasOwnProp$5.call(b2, prop2)) + __defNormalProp$6(a2, prop2, b2[prop2]); + if (__getOwnPropSymbols$5) + for (var prop2 of __getOwnPropSymbols$5(b2)) { + if (__propIsEnum$5.call(b2, prop2)) + __defNormalProp$6(a2, prop2, b2[prop2]); } return a2; -}, "__spreadValues"); -var __spreadProps = /* @__PURE__ */ __name((a2, b2) => __defProps(a2, __getOwnPropDescs(b2)), "__spreadProps"); -var __objRest = /* @__PURE__ */ __name((source, exclude) => { - var target = {}; +}, "__spreadValues$5"); +var __spreadProps$1 = /* @__PURE__ */ __name((a2, b2) => __defProps$1(a2, __getOwnPropDescs$1(b2)), "__spreadProps$1"); +var __objRest$1 = /* @__PURE__ */ __name((source, exclude) => { + var target2 = {}; for (var prop2 in source) - if (__hasOwnProp.call(source, prop2) && exclude.indexOf(prop2) < 0) - target[prop2] = source[prop2]; - if (source != null && __getOwnPropSymbols) - for (var prop2 of __getOwnPropSymbols(source)) { - if (exclude.indexOf(prop2) < 0 && __propIsEnum.call(source, prop2)) - target[prop2] = source[prop2]; + if (__hasOwnProp$5.call(source, prop2) && exclude.indexOf(prop2) < 0) + target2[prop2] = source[prop2]; + if (source != null && __getOwnPropSymbols$5) + for (var prop2 of __getOwnPropSymbols$5(source)) { + if (exclude.indexOf(prop2) < 0 && __propIsEnum$5.call(source, prop2)) + target2[prop2] = source[prop2]; } - return target; -}, "__objRest"); -function definePreset(...presets) { - return mergeKeys(...presets); + return target2; +}, "__objRest$1"); +function definePreset$1(...presets) { + return mergeKeys$2(...presets); } -__name(definePreset, "definePreset"); -var ThemeService = EventBus(); -var service_default = ThemeService; -function toTokenKey(str) { - return isString$9(str) ? str.replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "." + c2.toLowerCase()).toLowerCase() : str; +__name(definePreset$1, "definePreset$1"); +var ThemeService$1 = EventBus$1(); +var service_default$1 = ThemeService$1; +function toTokenKey$3(str) { + return isString$b(str) ? str.replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "." + c2.toLowerCase()).toLowerCase() : str; } -__name(toTokenKey, "toTokenKey"); -function merge$2(value1, value22) { - if (isArray$a(value1)) { +__name(toTokenKey$3, "toTokenKey$3"); +function merge$3(value1, value22) { + if (isArray$c(value1)) { value1.push(...value22 || []); - } else if (isObject$e(value1)) { + } else if (isObject$g(value1)) { Object.assign(value1, value22); } } -__name(merge$2, "merge$2"); -function toValue$2(value4) { - return isObject$e(value4) && value4.hasOwnProperty("value") && value4.hasOwnProperty("type") ? value4.value : value4; +__name(merge$3, "merge$3"); +function toValue$5(value4) { + return isObject$g(value4) && value4.hasOwnProperty("value") && value4.hasOwnProperty("type") ? value4.value : value4; } -__name(toValue$2, "toValue$2"); -function toUnit(value4, variable = "") { +__name(toValue$5, "toValue$5"); +function toUnit$1(value4, variable = "") { const excludedProperties = ["opacity", "z-index", "line-height", "font-weight", "flex", "flex-grow", "flex-shrink", "order"]; if (!excludedProperties.some((property) => variable.endsWith(property))) { const val = `${value4}`.trim(); const valArr = val.split(" "); - return valArr.map((v2) => isNumber$5(v2) ? `${v2}px` : v2).join(" "); + return valArr.map((v2) => isNumber$7(v2) ? `${v2}px` : v2).join(" "); } return value4; } -__name(toUnit, "toUnit"); -function toNormalizePrefix(prefix2) { +__name(toUnit$1, "toUnit$1"); +function toNormalizePrefix$1(prefix2) { return prefix2.replaceAll(/ /g, "").replace(/[^\w]/g, "-"); } -__name(toNormalizePrefix, "toNormalizePrefix"); -function toNormalizeVariable(prefix2 = "", variable = "") { - return toNormalizePrefix(`${isString$9(prefix2, false) && isString$9(variable, false) ? `${prefix2}-` : prefix2}${variable}`); +__name(toNormalizePrefix$1, "toNormalizePrefix$1"); +function toNormalizeVariable$1(prefix2 = "", variable = "") { + return toNormalizePrefix$1(`${isString$b(prefix2, false) && isString$b(variable, false) ? `${prefix2}-` : prefix2}${variable}`); } -__name(toNormalizeVariable, "toNormalizeVariable"); -function getVariableName(prefix2 = "", variable = "") { - return `--${toNormalizeVariable(prefix2, variable)}`; +__name(toNormalizeVariable$1, "toNormalizeVariable$1"); +function getVariableName$1(prefix2 = "", variable = "") { + return `--${toNormalizeVariable$1(prefix2, variable)}`; } -__name(getVariableName, "getVariableName"); -function getVariableValue(value4, variable = "", prefix2 = "", excludedKeyRegexes = [], fallback) { - if (isString$9(value4)) { +__name(getVariableName$1, "getVariableName$1"); +function hasOddBraces$1(str = "") { + const openBraces = (str.match(/{/g) || []).length; + const closeBraces = (str.match(/}/g) || []).length; + return (openBraces + closeBraces) % 2 !== 0; +} +__name(hasOddBraces$1, "hasOddBraces$1"); +function getVariableValue$1(value4, variable = "", prefix2 = "", excludedKeyRegexes = [], fallback) { + if (isString$b(value4)) { const regex2 = /{([^}]*)}/g; const val = value4.trim(); - if (matchRegex(val, regex2)) { + if (hasOddBraces$1(val)) { + return void 0; + } else if (matchRegex$2(val, regex2)) { const _val = val.replaceAll(regex2, (v2) => { const path = v2.replace(/{|}/g, ""); - const keys2 = path.split(".").filter((_v) => !excludedKeyRegexes.some((_r) => matchRegex(_v, _r))); - return `var(${getVariableName(prefix2, toKebabCase(keys2.join("-")))}${isNotEmpty(fallback) ? `, ${fallback}` : ""})`; + const keys2 = path.split(".").filter((_v) => !excludedKeyRegexes.some((_r) => matchRegex$2(_v, _r))); + return `var(${getVariableName$1(prefix2, toKebabCase$2(keys2.join("-")))}${isNotEmpty$2(fallback) ? `, ${fallback}` : ""})`; }); const calculationRegex = /(\d+\s+[\+\-\*\/]\s+\d+)/g; const cleanedVarRegex = /var\([^)]+\)/g; - return matchRegex(_val.replace(cleanedVarRegex, "0"), calculationRegex) ? `calc(${_val})` : _val; + return matchRegex$2(_val.replace(cleanedVarRegex, "0"), calculationRegex) ? `calc(${_val})` : _val; } - return toUnit(val, variable); - } else if (isNumber$5(value4)) { - return toUnit(value4, variable); - } - return void 0; -} -__name(getVariableValue, "getVariableValue"); -function getComputedValue(obj = {}, value4) { - if (isString$9(value4)) { - const regex2 = /{([^}]*)}/g; - const val = value4.trim(); - return matchRegex(val, regex2) ? val.replaceAll(regex2, (v2) => getKeyValue(obj, v2.replace(/{|}/g, ""))) : val; - } else if (isNumber$5(value4)) { + return val; + } else if (isNumber$7(value4)) { return value4; } return void 0; } -__name(getComputedValue, "getComputedValue"); -function setProperty(properties, key, value4) { - if (isString$9(key, false)) { +__name(getVariableValue$1, "getVariableValue$1"); +function getComputedValue$1(obj = {}, value4) { + if (isString$b(value4)) { + const regex2 = /{([^}]*)}/g; + const val = value4.trim(); + return matchRegex$2(val, regex2) ? val.replaceAll(regex2, (v2) => getKeyValue$2(obj, v2.replace(/{|}/g, ""))) : val; + } else if (isNumber$7(value4)) { + return value4; + } + return void 0; +} +__name(getComputedValue$1, "getComputedValue$1"); +function setProperty$1(properties, key, value4) { + if (isString$b(key, false)) { properties.push(`${key}:${value4};`); } } -__name(setProperty, "setProperty"); -function getRule(selector, properties) { +__name(setProperty$1, "setProperty$1"); +function getRule$1(selector, properties) { if (selector) { return `${selector}{${properties}}`; } return ""; } -__name(getRule, "getRule"); -function normalizeColor(color2) { +__name(getRule$1, "getRule$1"); +function normalizeColor$1(color2) { if (color2.length === 4) { return `#${color2[1]}${color2[1]}${color2[2]}${color2[2]}${color2[3]}${color2[3]}`; } return color2; } -__name(normalizeColor, "normalizeColor"); -function hexToRgb$1(hex) { +__name(normalizeColor$1, "normalizeColor$1"); +function hexToRgb$2(hex) { var bigint = parseInt(hex.substring(1), 16); var r2 = bigint >> 16 & 255; var g2 = bigint >> 8 & 255; var b2 = bigint & 255; return { r: r2, g: g2, b: b2 }; } -__name(hexToRgb$1, "hexToRgb$1"); -function rgbToHex(r2, g2, b2) { +__name(hexToRgb$2, "hexToRgb$2"); +function rgbToHex$1(r2, g2, b2) { return `#${r2.toString(16).padStart(2, "0")}${g2.toString(16).padStart(2, "0")}${b2.toString(16).padStart(2, "0")}`; } -__name(rgbToHex, "rgbToHex"); -var mix_default = /* @__PURE__ */ __name((color1, color2, weight) => { - color1 = normalizeColor(color1); - color2 = normalizeColor(color2); +__name(rgbToHex$1, "rgbToHex$1"); +var mix_default$1 = /* @__PURE__ */ __name((color1, color2, weight) => { + color1 = normalizeColor$1(color1); + color2 = normalizeColor$1(color2); var p2 = weight / 100; var w2 = p2 * 2 - 1; var w1 = (w2 + 1) / 2; var w22 = 1 - w1; - var rgb1 = hexToRgb$1(color1); - var rgb2 = hexToRgb$1(color2); + var rgb1 = hexToRgb$2(color1); + var rgb2 = hexToRgb$2(color2); var r2 = Math.round(rgb1.r * w1 + rgb2.r * w22); var g2 = Math.round(rgb1.g * w1 + rgb2.g * w22); var b2 = Math.round(rgb1.b * w1 + rgb2.b * w22); - return rgbToHex(r2, g2, b2); -}, "mix_default"); -var shade_default = /* @__PURE__ */ __name((color2, percent) => mix_default("#000000", color2, percent), "shade_default"); -var tint_default = /* @__PURE__ */ __name((color2, percent) => mix_default("#ffffff", color2, percent), "tint_default"); -var scales = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]; -var palette_default = /* @__PURE__ */ __name((color2) => { + return rgbToHex$1(r2, g2, b2); +}, "mix_default$1"); +var shade_default$1 = /* @__PURE__ */ __name((color2, percent) => mix_default$1("#000000", color2, percent), "shade_default$1"); +var tint_default$1 = /* @__PURE__ */ __name((color2, percent) => mix_default$1("#ffffff", color2, percent), "tint_default$1"); +var scales$1 = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]; +var palette_default$1 = /* @__PURE__ */ __name((color2) => { if (/{([^}]*)}/g.test(color2)) { const token = color2.replace(/{|}/g, ""); - return scales.reduce((acc, scale) => (acc[scale] = `{${token}.${scale}}`, acc), {}); + return scales$1.reduce((acc, scale) => (acc[scale] = `{${token}.${scale}}`, acc), {}); } - return typeof color2 === "string" ? scales.reduce((acc, scale, i2) => (acc[scale] = i2 <= 5 ? tint_default(color2, (5 - i2) * 19) : shade_default(color2, (i2 - 5) * 15), acc), {}) : color2; -}, "palette_default"); -var $dt = /* @__PURE__ */ __name((tokenPath) => { + return typeof color2 === "string" ? scales$1.reduce((acc, scale, i2) => (acc[scale] = i2 <= 5 ? tint_default$1(color2, (5 - i2) * 19) : shade_default$1(color2, (i2 - 5) * 15), acc), {}) : color2; +}, "palette_default$1"); +var $dt$1 = /* @__PURE__ */ __name((tokenPath) => { var _a2; - const theme42 = config_default.getTheme(); - const variable = dtwt(theme42, tokenPath, void 0, "variable"); - const name2 = (_a2 = variable.match(/--[\w-]+/g)) == null ? void 0 : _a2[0]; - const value4 = dtwt(theme42, tokenPath, void 0, "value"); + const theme43 = config_default$1.getTheme(); + const variable = dtwt$1(theme43, tokenPath, void 0, "variable"); + const name2 = (_a2 = variable == null ? void 0 : variable.match(/--[\w-]+/g)) == null ? void 0 : _a2[0]; + const value4 = dtwt$1(theme43, tokenPath, void 0, "value"); return { name: name2, variable, value: value4 }; -}, "$dt"); -var dt = /* @__PURE__ */ __name((...args) => { - return dtwt(config_default.getTheme(), ...args); -}, "dt"); -var dtwt = /* @__PURE__ */ __name((theme42 = {}, tokenPath, fallback, type = "variable") => { +}, "$dt$1"); +var dt$1 = /* @__PURE__ */ __name((...args) => { + return dtwt$1(config_default$1.getTheme(), ...args); +}, "dt$1"); +var dtwt$1 = /* @__PURE__ */ __name((theme43 = {}, tokenPath, fallback, type) => { if (tokenPath) { - const { variable: VARIABLE, options: OPTIONS } = config_default.defaults || {}; - const { prefix: prefix2, transform: transform2 } = (theme42 == null ? void 0 : theme42.options) || OPTIONS || {}; + const { variable: VARIABLE, options: OPTIONS } = config_default$1.defaults || {}; + const { prefix: prefix2, transform: transform2 } = (theme43 == null ? void 0 : theme43.options) || OPTIONS || {}; const regex2 = /{([^}]*)}/g; - const token = matchRegex(tokenPath, regex2) ? tokenPath : `{${tokenPath}}`; - const isStrictTransform = type === "value" || transform2 === "strict"; - return isStrictTransform ? config_default.getTokenValue(tokenPath) : getVariableValue(token, void 0, prefix2, [VARIABLE.excludedKeyRegex], fallback); + const token = matchRegex$2(tokenPath, regex2) ? tokenPath : `{${tokenPath}}`; + const isStrictTransform = type === "value" || isEmpty$3(type) && transform2 === "strict"; + return isStrictTransform ? config_default$1.getTokenValue(tokenPath) : getVariableValue$1(token, void 0, prefix2, [VARIABLE.excludedKeyRegex], fallback); } return ""; -}, "dtwt"); -function css$2(style2) { - return resolve$2(style2, { dt }); +}, "dtwt$1"); +function css$5(style2) { + return resolve$4(style2, { dt: dt$1 }); } -__name(css$2, "css$2"); -var $t = /* @__PURE__ */ __name((theme42 = {}) => { - let { preset: _preset, options: _options } = theme42; +__name(css$5, "css$5"); +var $t$1 = /* @__PURE__ */ __name((theme43 = {}) => { + let { preset: _preset, options: _options } = theme43; return { preset(value4) { - _preset = _preset ? mergeKeys(_preset, value4) : value4; + _preset = _preset ? mergeKeys$2(_preset, value4) : value4; return this; }, options(value4) { - _options = _options ? __spreadValues(__spreadValues({}, _options), value4) : value4; + _options = _options ? __spreadValues$5(__spreadValues$5({}, _options), value4) : value4; return this; }, // features primaryPalette(primary) { const { semantic } = _preset || {}; - _preset = __spreadProps(__spreadValues({}, _preset), { semantic: __spreadProps(__spreadValues({}, semantic), { primary }) }); + _preset = __spreadProps$1(__spreadValues$5({}, _preset), { semantic: __spreadProps$1(__spreadValues$5({}, semantic), { primary }) }); return this; }, surfacePalette(surface) { @@ -605,66 +692,66 @@ var $t = /* @__PURE__ */ __name((theme42 = {}) => { const darkSurface = (surface == null ? void 0 : surface.hasOwnProperty("dark")) ? surface == null ? void 0 : surface.dark : surface; const newColorScheme = { colorScheme: { - light: __spreadValues(__spreadValues({}, (_a2 = semantic == null ? void 0 : semantic.colorScheme) == null ? void 0 : _a2.light), !!lightSurface && { surface: lightSurface }), - dark: __spreadValues(__spreadValues({}, (_b = semantic == null ? void 0 : semantic.colorScheme) == null ? void 0 : _b.dark), !!darkSurface && { surface: darkSurface }) + light: __spreadValues$5(__spreadValues$5({}, (_a2 = semantic == null ? void 0 : semantic.colorScheme) == null ? void 0 : _a2.light), !!lightSurface && { surface: lightSurface }), + dark: __spreadValues$5(__spreadValues$5({}, (_b = semantic == null ? void 0 : semantic.colorScheme) == null ? void 0 : _b.dark), !!darkSurface && { surface: darkSurface }) } }; - _preset = __spreadProps(__spreadValues({}, _preset), { semantic: __spreadValues(__spreadValues({}, semantic), newColorScheme) }); + _preset = __spreadProps$1(__spreadValues$5({}, _preset), { semantic: __spreadValues$5(__spreadValues$5({}, semantic), newColorScheme) }); return this; }, // actions define({ useDefaultPreset = false, useDefaultOptions = false } = {}) { return { - preset: useDefaultPreset ? config_default.getPreset() : _preset, - options: useDefaultOptions ? config_default.getOptions() : _options + preset: useDefaultPreset ? config_default$1.getPreset() : _preset, + options: useDefaultOptions ? config_default$1.getOptions() : _options }; }, update({ mergePresets = true, mergeOptions: mergeOptions2 = true } = {}) { const newTheme = { - preset: mergePresets ? mergeKeys(config_default.getPreset(), _preset) : _preset, - options: mergeOptions2 ? __spreadValues(__spreadValues({}, config_default.getOptions()), _options) : _options + preset: mergePresets ? mergeKeys$2(config_default$1.getPreset(), _preset) : _preset, + options: mergeOptions2 ? __spreadValues$5(__spreadValues$5({}, config_default$1.getOptions()), _options) : _options }; - config_default.setTheme(newTheme); + config_default$1.setTheme(newTheme); return newTheme; }, use(options4) { const newTheme = this.define(options4); - config_default.setTheme(newTheme); + config_default$1.setTheme(newTheme); return newTheme; } }; -}, "$t"); -function toVariables_default(theme42, options4 = {}) { - const VARIABLE = config_default.defaults.variable; +}, "$t$1"); +function toVariables_default$1(theme43, options4 = {}) { + const VARIABLE = config_default$1.defaults.variable; const { prefix: prefix2 = VARIABLE.prefix, selector = VARIABLE.selector, excludedKeyRegex = VARIABLE.excludedKeyRegex } = options4; const _toVariables = /* @__PURE__ */ __name((_theme, _prefix = "") => { return Object.entries(_theme).reduce( (acc, [key, value4]) => { - const px = matchRegex(key, excludedKeyRegex) ? toNormalizeVariable(_prefix) : toNormalizeVariable(_prefix, toKebabCase(key)); - const v2 = toValue$2(value4); - if (isObject$e(v2)) { + const px = matchRegex$2(key, excludedKeyRegex) ? toNormalizeVariable$1(_prefix) : toNormalizeVariable$1(_prefix, toKebabCase$2(key)); + const v2 = toValue$5(value4); + if (isObject$g(v2)) { const { variables: variables2, tokens: tokens2 } = _toVariables(v2, px); - merge$2(acc["tokens"], tokens2); - merge$2(acc["variables"], variables2); + merge$3(acc["tokens"], tokens2); + merge$3(acc["variables"], variables2); } else { acc["tokens"].push((prefix2 ? px.replace(`${prefix2}-`, "") : px).replaceAll("-", ".")); - setProperty(acc["variables"], getVariableName(px), getVariableValue(v2, px, prefix2, [excludedKeyRegex])); + setProperty$1(acc["variables"], getVariableName$1(px), getVariableValue$1(v2, px, prefix2, [excludedKeyRegex])); } return acc; }, { variables: [], tokens: [] } ); }, "_toVariables"); - const { variables, tokens } = _toVariables(theme42, prefix2); + const { variables, tokens } = _toVariables(theme43, prefix2); return { value: variables, tokens, declarations: variables.join(""), - css: getRule(selector, variables.join("")) + css: getRule$1(selector, variables.join("")) }; } -__name(toVariables_default, "toVariables_default"); -var themeUtils_default = { +__name(toVariables_default$1, "toVariables_default$1"); +var themeUtils_default$1 = { regex: { rules: { class: { @@ -705,31 +792,44 @@ var themeUtils_default = { }); } }, - _toVariables(theme42, options4) { - return toVariables_default(theme42, { prefix: options4 == null ? void 0 : options4.prefix }); + _toVariables(theme43, options4) { + return toVariables_default$1(theme43, { prefix: options4 == null ? void 0 : options4.prefix }); }, - getCommon({ name: name2 = "", theme: theme42 = {}, params, set: set3, defaults: defaults2 }) { - var _c, _d, _e, _f; - const { preset, options: options4 } = theme42; - let primitive_css, primitive_tokens, semantic_css, semantic_tokens; - if (isNotEmpty(preset)) { - const { primitive, semantic } = preset; - const _a2 = semantic || {}, { colorScheme } = _a2, sRest = __objRest(_a2, ["colorScheme"]); - const _b = colorScheme || {}, { dark: dark2 } = _b, csRest = __objRest(_b, ["dark"]); - const prim_var = isNotEmpty(primitive) ? this._toVariables({ primitive }, options4) : {}; - const sRest_var = isNotEmpty(sRest) ? this._toVariables({ semantic: sRest }, options4) : {}; - const csRest_var = isNotEmpty(csRest) ? this._toVariables({ light: csRest }, options4) : {}; - const dark_var = isNotEmpty(dark2) ? this._toVariables({ dark: dark2 }, options4) : {}; - const [prim_css, prim_tokens] = [(_c = prim_var.declarations) != null ? _c : "", prim_var.tokens]; - const [sRest_css, sRest_tokens] = [(_d = sRest_var.declarations) != null ? _d : "", sRest_var.tokens || []]; - const [csRest_css, csRest_tokens] = [(_e = csRest_var.declarations) != null ? _e : "", csRest_var.tokens || []]; - const [dark_css, dark_tokens] = [(_f = dark_var.declarations) != null ? _f : "", dark_var.tokens || []]; + getCommon({ name: name2 = "", theme: theme43 = {}, params, set: set3, defaults: defaults2 }) { + var _e, _f, _g, _h, _i, _j, _k; + const { preset, options: options4 } = theme43; + let primitive_css, primitive_tokens, semantic_css, semantic_tokens, global_css, global_tokens, style2; + if (isNotEmpty$2(preset) && options4.transform !== "strict") { + const { primitive, semantic, extend: extend5 } = preset; + const _a2 = semantic || {}, { colorScheme } = _a2, sRest = __objRest$1(_a2, ["colorScheme"]); + const _b = extend5 || {}, { colorScheme: eColorScheme } = _b, eRest = __objRest$1(_b, ["colorScheme"]); + const _c = colorScheme || {}, { dark: dark2 } = _c, csRest = __objRest$1(_c, ["dark"]); + const _d = eColorScheme || {}, { dark: eDark } = _d, ecsRest = __objRest$1(_d, ["dark"]); + const prim_var = isNotEmpty$2(primitive) ? this._toVariables({ primitive }, options4) : {}; + const sRest_var = isNotEmpty$2(sRest) ? this._toVariables({ semantic: sRest }, options4) : {}; + const csRest_var = isNotEmpty$2(csRest) ? this._toVariables({ light: csRest }, options4) : {}; + const csDark_var = isNotEmpty$2(dark2) ? this._toVariables({ dark: dark2 }, options4) : {}; + const eRest_var = isNotEmpty$2(eRest) ? this._toVariables({ semantic: eRest }, options4) : {}; + const ecsRest_var = isNotEmpty$2(ecsRest) ? this._toVariables({ light: ecsRest }, options4) : {}; + const ecsDark_var = isNotEmpty$2(eDark) ? this._toVariables({ dark: eDark }, options4) : {}; + const [prim_css, prim_tokens] = [(_e = prim_var.declarations) != null ? _e : "", prim_var.tokens]; + const [sRest_css, sRest_tokens] = [(_f = sRest_var.declarations) != null ? _f : "", sRest_var.tokens || []]; + const [csRest_css, csRest_tokens] = [(_g = csRest_var.declarations) != null ? _g : "", csRest_var.tokens || []]; + const [csDark_css, csDark_tokens] = [(_h = csDark_var.declarations) != null ? _h : "", csDark_var.tokens || []]; + const [eRest_css, eRest_tokens] = [(_i = eRest_var.declarations) != null ? _i : "", eRest_var.tokens || []]; + const [ecsRest_css, ecsRest_tokens] = [(_j = ecsRest_var.declarations) != null ? _j : "", ecsRest_var.tokens || []]; + const [ecsDark_css, ecsDark_tokens] = [(_k = ecsDark_var.declarations) != null ? _k : "", ecsDark_var.tokens || []]; primitive_css = this.transformCSS(name2, prim_css, "light", "variable", options4, set3, defaults2); primitive_tokens = prim_tokens; - const semantic_light_css = this.transformCSS(name2, `${sRest_css}${csRest_css}color-scheme:light`, "light", "variable", options4, set3, defaults2); - const semantic_dark_css = this.transformCSS(name2, `${dark_css}color-scheme:dark`, "dark", "variable", options4, set3, defaults2); + const semantic_light_css = this.transformCSS(name2, `${sRest_css}${csRest_css}`, "light", "variable", options4, set3, defaults2); + const semantic_dark_css = this.transformCSS(name2, `${csDark_css}`, "dark", "variable", options4, set3, defaults2); semantic_css = `${semantic_light_css}${semantic_dark_css}`; - semantic_tokens = [.../* @__PURE__ */ new Set([...sRest_tokens, ...csRest_tokens, ...dark_tokens])]; + semantic_tokens = [.../* @__PURE__ */ new Set([...sRest_tokens, ...csRest_tokens, ...csDark_tokens])]; + const global_light_css = this.transformCSS(name2, `${eRest_css}${ecsRest_css}color-scheme:light`, "light", "variable", options4, set3, defaults2); + const global_dark_css = this.transformCSS(name2, `${ecsDark_css}color-scheme:dark`, "dark", "variable", options4, set3, defaults2); + global_css = `${global_light_css}${global_dark_css}`; + global_tokens = [.../* @__PURE__ */ new Set([...eRest_tokens, ...ecsRest_tokens, ...ecsDark_tokens])]; + style2 = resolve$4(preset.css, { dt: dt$1 }); } return { primitive: { @@ -739,85 +839,103 @@ var themeUtils_default = { semantic: { css: semantic_css, tokens: semantic_tokens - } + }, + global: { + css: global_css, + tokens: global_tokens + }, + style: style2 }; }, getPreset({ name: name2 = "", preset = {}, options: options4, params, set: set3, defaults: defaults2, selector }) { - var _c, _d, _e; - const _name = name2.replace("-directive", ""); - const _a2 = preset, { colorScheme } = _a2, vRest = __objRest(_a2, ["colorScheme"]); - const _b = colorScheme || {}, { dark: dark2 } = _b, csRest = __objRest(_b, ["dark"]); - const vRest_var = isNotEmpty(vRest) ? this._toVariables({ [_name]: vRest }, options4) : {}; - const csRest_var = isNotEmpty(csRest) ? this._toVariables({ [_name]: csRest }, options4) : {}; - const dark_var = isNotEmpty(dark2) ? this._toVariables({ [_name]: dark2 }, options4) : {}; - const [vRest_css, vRest_tokens] = [(_c = vRest_var.declarations) != null ? _c : "", vRest_var.tokens || []]; - const [csRest_css, csRest_tokens] = [(_d = csRest_var.declarations) != null ? _d : "", csRest_var.tokens || []]; - const [dark_css, dark_tokens] = [(_e = dark_var.declarations) != null ? _e : "", dark_var.tokens || []]; - const tokens = [.../* @__PURE__ */ new Set([...vRest_tokens, ...csRest_tokens, ...dark_tokens])]; - const light_variable_css = this.transformCSS(_name, `${vRest_css}${csRest_css}`, "light", "variable", options4, set3, defaults2, selector); - const dark_variable_css = this.transformCSS(_name, dark_css, "dark", "variable", options4, set3, defaults2, selector); + var _e, _f, _g; + let p_css, p_tokens, p_style; + if (isNotEmpty$2(preset) && options4.transform !== "strict") { + const _name = name2.replace("-directive", ""); + const _a2 = preset, { colorScheme, extend: extend5, css: css22 } = _a2, vRest = __objRest$1(_a2, ["colorScheme", "extend", "css"]); + const _b = extend5 || {}, { colorScheme: eColorScheme } = _b, evRest = __objRest$1(_b, ["colorScheme"]); + const _c = colorScheme || {}, { dark: dark2 } = _c, csRest = __objRest$1(_c, ["dark"]); + const _d = eColorScheme || {}, { dark: ecsDark } = _d, ecsRest = __objRest$1(_d, ["dark"]); + const vRest_var = isNotEmpty$2(vRest) ? this._toVariables({ [_name]: __spreadValues$5(__spreadValues$5({}, vRest), evRest) }, options4) : {}; + const csRest_var = isNotEmpty$2(csRest) ? this._toVariables({ [_name]: __spreadValues$5(__spreadValues$5({}, csRest), ecsRest) }, options4) : {}; + const csDark_var = isNotEmpty$2(dark2) ? this._toVariables({ [_name]: __spreadValues$5(__spreadValues$5({}, dark2), ecsDark) }, options4) : {}; + const [vRest_css, vRest_tokens] = [(_e = vRest_var.declarations) != null ? _e : "", vRest_var.tokens || []]; + const [csRest_css, csRest_tokens] = [(_f = csRest_var.declarations) != null ? _f : "", csRest_var.tokens || []]; + const [csDark_css, csDark_tokens] = [(_g = csDark_var.declarations) != null ? _g : "", csDark_var.tokens || []]; + const light_variable_css = this.transformCSS(_name, `${vRest_css}${csRest_css}`, "light", "variable", options4, set3, defaults2, selector); + const dark_variable_css = this.transformCSS(_name, csDark_css, "dark", "variable", options4, set3, defaults2, selector); + p_css = `${light_variable_css}${dark_variable_css}`; + p_tokens = [.../* @__PURE__ */ new Set([...vRest_tokens, ...csRest_tokens, ...csDark_tokens])]; + p_style = resolve$4(css22, { dt: dt$1 }); + } return { - css: `${light_variable_css}${dark_variable_css}`, - tokens + css: p_css, + tokens: p_tokens, + style: p_style }; }, - getPresetC({ name: name2 = "", theme: theme42 = {}, params, set: set3, defaults: defaults2 }) { + getPresetC({ name: name2 = "", theme: theme43 = {}, params, set: set3, defaults: defaults2 }) { var _a2; - const { preset, options: options4 } = theme42; + const { preset, options: options4 } = theme43; const cPreset = (_a2 = preset == null ? void 0 : preset.components) == null ? void 0 : _a2[name2]; return this.getPreset({ name: name2, preset: cPreset, options: options4, params, set: set3, defaults: defaults2 }); }, - getPresetD({ name: name2 = "", theme: theme42 = {}, params, set: set3, defaults: defaults2 }) { + getPresetD({ name: name2 = "", theme: theme43 = {}, params, set: set3, defaults: defaults2 }) { var _a2; const dName = name2.replace("-directive", ""); - const { preset, options: options4 } = theme42; + const { preset, options: options4 } = theme43; const dPreset = (_a2 = preset == null ? void 0 : preset.directives) == null ? void 0 : _a2[dName]; return this.getPreset({ name: dName, preset: dPreset, options: options4, params, set: set3, defaults: defaults2 }); }, + applyDarkColorScheme(options4) { + return !(options4.darkModeSelector === "none" || options4.darkModeSelector === false); + }, getColorSchemeOption(options4, defaults2) { var _a2; - return this.regex.resolve((_a2 = options4.darkModeSelector) != null ? _a2 : defaults2.options.darkModeSelector); + return this.applyDarkColorScheme(options4) ? this.regex.resolve(options4.darkModeSelector === true ? defaults2.options.darkModeSelector : (_a2 = options4.darkModeSelector) != null ? _a2 : defaults2.options.darkModeSelector) : []; }, getLayerOrder(name2, options4 = {}, params, defaults2) { const { cssLayer } = options4; if (cssLayer) { - const order = resolve$2(cssLayer.order || "primeui", params); + const order = resolve$4(cssLayer.order || "primeui", params); return `@layer ${order}`; } return ""; }, - getCommonStyleSheet({ name: name2 = "", theme: theme42 = {}, params, props = {}, set: set3, defaults: defaults2 }) { - const common = this.getCommon({ name: name2, theme: theme42, params, set: set3, defaults: defaults2 }); + getCommonStyleSheet({ name: name2 = "", theme: theme43 = {}, params, props = {}, set: set3, defaults: defaults2 }) { + const common = this.getCommon({ name: name2, theme: theme43, params, set: set3, defaults: defaults2 }); const _props = Object.entries(props).reduce((acc, [k2, v2]) => acc.push(`${k2}="${v2}"`) && acc, []).join(" "); return Object.entries(common || {}).reduce((acc, [key, value4]) => { if (value4 == null ? void 0 : value4.css) { - const _css = minifyCSS(value4 == null ? void 0 : value4.css); + const _css = minifyCSS$2(value4 == null ? void 0 : value4.css); const id3 = `${key}-variables`; acc.push(``); } return acc; }, []).join(""); }, - getStyleSheet({ name: name2 = "", theme: theme42 = {}, params, props = {}, set: set3, defaults: defaults2 }) { + getStyleSheet({ name: name2 = "", theme: theme43 = {}, params, props = {}, set: set3, defaults: defaults2 }) { var _a2; - const options4 = { name: name2, theme: theme42, params, set: set3, defaults: defaults2 }; + const options4 = { name: name2, theme: theme43, params, set: set3, defaults: defaults2 }; const preset_css = (_a2 = name2.includes("-directive") ? this.getPresetD(options4) : this.getPresetC(options4)) == null ? void 0 : _a2.css; const _props = Object.entries(props).reduce((acc, [k2, v2]) => acc.push(`${k2}="${v2}"`) && acc, []).join(" "); - return preset_css ? `` : ""; + return preset_css ? `` : ""; }, createTokens(obj = {}, defaults2, parentKey = "", parentPath = "", tokens = {}) { Object.entries(obj).forEach(([key, value4]) => { - const currentKey = matchRegex(key, defaults2.variable.excludedKeyRegex) ? parentKey : parentKey ? `${parentKey}.${toTokenKey$1(key)}` : toTokenKey$1(key); + const currentKey = matchRegex$2(key, defaults2.variable.excludedKeyRegex) ? parentKey : parentKey ? `${parentKey}.${toTokenKey$4(key)}` : toTokenKey$4(key); const currentPath = parentPath ? `${parentPath}.${key}` : key; - if (isObject$e(value4)) { + if (isObject$g(value4)) { this.createTokens(value4, defaults2, currentKey, currentPath, tokens); } else { tokens[currentKey] || (tokens[currentKey] = { paths: [], computed(colorScheme, tokenPathMap = {}) { - if (colorScheme) { - const path = this.paths.find((p2) => p2.scheme === colorScheme) || this.paths.find((p2) => p2.scheme === "none"); - return path == null ? void 0 : path.computed(colorScheme, tokenPathMap["binding"]); + var _a2, _b; + if (this.paths.length === 1) { + return (_a2 = this.paths[0]) == null ? void 0 : _a2.computed(this.paths[0].scheme, tokenPathMap["binding"]); + } else if (colorScheme && colorScheme !== "none") { + return (_b = this.paths.find((p2) => p2.scheme === colorScheme)) == null ? void 0 : _b.computed(colorScheme, tokenPathMap["binding"]); } return this.paths.map((p2) => p2.computed(p2.scheme, tokenPathMap[p2.scheme])); } @@ -831,18 +949,19 @@ var themeUtils_default = { let computedValue = value4; tokenPathMap["name"] = this.path; tokenPathMap["binding"] || (tokenPathMap["binding"] = {}); - if (matchRegex(value4, regex2)) { + if (matchRegex$2(value4, regex2)) { const val = value4.trim(); const _val = val.replaceAll(regex2, (v2) => { - var _a2, _b; + var _a2; const path = v2.replace(/{|}/g, ""); - return (_b = (_a2 = tokens[path]) == null ? void 0 : _a2.computed(colorScheme, tokenPathMap)) == null ? void 0 : _b.value; + const computed2 = (_a2 = tokens[path]) == null ? void 0 : _a2.computed(colorScheme, tokenPathMap); + return isArray$c(computed2) && computed2.length === 2 ? `light-dark(${computed2[0].value},${computed2[1].value})` : computed2 == null ? void 0 : computed2.value; }); const calculationRegex = /(\d+\w*\s+[\+\-\*\/]\s+\d+\w*)/g; const cleanedVarRegex = /var\([^)]+\)/g; - computedValue = matchRegex(_val.replace(cleanedVarRegex, "0"), calculationRegex) ? `calc(${_val})` : _val; + computedValue = matchRegex$2(_val.replace(cleanedVarRegex, "0"), calculationRegex) ? `calc(${_val})` : _val; } - isEmpty$1(tokenPathMap["binding"]) && delete tokenPathMap["binding"]; + isEmpty$3(tokenPathMap["binding"]) && delete tokenPathMap["binding"]; return { colorScheme, path: this.path, @@ -859,38 +978,40 @@ var themeUtils_default = { var _a2; const normalizePath2 = /* @__PURE__ */ __name((str) => { const strArr = str.split("."); - return strArr.filter((s2) => !matchRegex(s2.toLowerCase(), defaults2.variable.excludedKeyRegex)).join("."); + return strArr.filter((s2) => !matchRegex$2(s2.toLowerCase(), defaults2.variable.excludedKeyRegex)).join("."); }, "normalizePath"); const token = normalizePath2(path); const colorScheme = path.includes("colorScheme.light") ? "light" : path.includes("colorScheme.dark") ? "dark" : void 0; const computedValues = [(_a2 = tokens[token]) == null ? void 0 : _a2.computed(colorScheme)].flat().filter((computed2) => computed2); return computedValues.length === 1 ? computedValues[0].value : computedValues.reduce((acc = {}, computed2) => { - const _a22 = computed2, { colorScheme: cs } = _a22, rest = __objRest(_a22, ["colorScheme"]); + const _a22 = computed2, { colorScheme: cs } = _a22, rest = __objRest$1(_a22, ["colorScheme"]); acc[cs] = rest; return acc; }, void 0); }, + getSelectorRule(selector1, selector2, type, css22) { + return type === "class" || type === "attr" ? getRule$1(isNotEmpty$2(selector2) ? `${selector1}${selector2},${selector1} ${selector2}` : selector1, css22) : getRule$1(selector1, isNotEmpty$2(selector2) ? getRule$1(selector2, css22) : css22); + }, transformCSS(name2, css22, mode2, type, options4 = {}, set3, defaults2, selector) { - if (isNotEmpty(css22)) { + if (isNotEmpty$2(css22)) { const { cssLayer } = options4; if (type !== "style") { const colorSchemeOption = this.getColorSchemeOption(options4, defaults2); - const _css = selector ? getRule(selector, css22) : css22; - css22 = mode2 === "dark" ? colorSchemeOption.reduce((acc, { selector: _selector }) => { - if (isNotEmpty(_selector)) { - acc += _selector.includes("[CSS]") ? _selector.replace("[CSS]", _css) : getRule(_selector, _css); + css22 = mode2 === "dark" ? colorSchemeOption.reduce((acc, { type: type2, selector: _selector }) => { + if (isNotEmpty$2(_selector)) { + acc += _selector.includes("[CSS]") ? _selector.replace("[CSS]", css22) : this.getSelectorRule(_selector, selector, type2, css22); } return acc; - }, "") : getRule(selector != null ? selector : ":root", css22); + }, "") : getRule$1(selector != null ? selector : ":root", css22); } if (cssLayer) { const layerOptions = { name: "primeui", order: "primeui" }; - isObject$e(cssLayer) && (layerOptions.name = resolve$2(cssLayer.name, { name: name2, type })); - if (isNotEmpty(layerOptions.name)) { - css22 = getRule(`@layer ${layerOptions.name}`, css22); + isObject$g(cssLayer) && (layerOptions.name = resolve$4(cssLayer.name, { name: name2, type })); + if (isNotEmpty$2(layerOptions.name)) { + css22 = getRule$1(`@layer ${layerOptions.name}`, css22); set3 == null ? void 0 : set3.layerNames(layerOptions.name); } } @@ -899,12 +1020,12 @@ var themeUtils_default = { return ""; } }; -var config_default = { +var config_default$1 = { defaults: { variable: { prefix: "p", selector: ":root", - excludedKeyRegex: /^(primitive|semantic|components|directives|variables|colorscheme|light|dark|common|root|states)$/gi + excludedKeyRegex: /^(primitive|semantic|components|directives|variables|colorscheme|light|dark|common|root|states|extend|css)$/gi }, options: { prefix: "p", @@ -918,12 +1039,12 @@ var config_default = { _loadingStyles: /* @__PURE__ */ new Set(), _tokens: {}, update(newValues = {}) { - const { theme: theme42 } = newValues; - if (theme42) { - this._theme = __spreadProps(__spreadValues({}, theme42), { - options: __spreadValues(__spreadValues({}, this.defaults.options), theme42.options) + const { theme: theme43 } = newValues; + if (theme43) { + this._theme = __spreadProps$1(__spreadValues$5({}, theme43), { + options: __spreadValues$5(__spreadValues$5({}, this.defaults.options), theme43.options) }); - this._tokens = themeUtils_default.createTokens(this.preset, this.defaults); + this._tokens = themeUtils_default$1.createTokens(this.preset, this.defaults); this.clearLoadedStyleNames(); } }, @@ -946,26 +1067,26 @@ var config_default = { }, setTheme(newValue2) { this.update({ theme: newValue2 }); - service_default.emit("theme:change", newValue2); + service_default$1.emit("theme:change", newValue2); }, getPreset() { return this.preset; }, setPreset(newValue2) { - this._theme = __spreadProps(__spreadValues({}, this.theme), { preset: newValue2 }); - this._tokens = themeUtils_default.createTokens(newValue2, this.defaults); + this._theme = __spreadProps$1(__spreadValues$5({}, this.theme), { preset: newValue2 }); + this._tokens = themeUtils_default$1.createTokens(newValue2, this.defaults); this.clearLoadedStyleNames(); - service_default.emit("preset:change", newValue2); - service_default.emit("theme:change", this.theme); + service_default$1.emit("preset:change", newValue2); + service_default$1.emit("theme:change", this.theme); }, getOptions() { return this.options; }, setOptions(newValue2) { - this._theme = __spreadProps(__spreadValues({}, this.theme), { options: newValue2 }); + this._theme = __spreadProps$1(__spreadValues$5({}, this.theme), { options: newValue2 }); this.clearLoadedStyleNames(); - service_default.emit("options:change", newValue2); - service_default.emit("theme:change", this.theme); + service_default$1.emit("options:change", newValue2); + service_default$1.emit("theme:change", this.theme); }, getLayerNames() { return [...this._layerNames]; @@ -989,34 +1110,34 @@ var config_default = { this._loadedStyleNames.clear(); }, getTokenValue(tokenPath) { - return themeUtils_default.getTokenValue(this.tokens, tokenPath, this.defaults); + return themeUtils_default$1.getTokenValue(this.tokens, tokenPath, this.defaults); }, getCommon(name2 = "", params) { - return themeUtils_default.getCommon({ name: name2, theme: this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }); + return themeUtils_default$1.getCommon({ name: name2, theme: this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }); }, getComponent(name2 = "", params) { const options4 = { name: name2, theme: this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }; - return themeUtils_default.getPresetC(options4); + return themeUtils_default$1.getPresetC(options4); }, getDirective(name2 = "", params) { const options4 = { name: name2, theme: this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }; - return themeUtils_default.getPresetD(options4); + return themeUtils_default$1.getPresetD(options4); }, getCustomPreset(name2 = "", preset, selector, params) { const options4 = { name: name2, preset, options: this.options, selector, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }; - return themeUtils_default.getPreset(options4); + return themeUtils_default$1.getPreset(options4); }, getLayerOrderCSS(name2 = "") { - return themeUtils_default.getLayerOrder(name2, this.options, { names: this.getLayerNames() }, this.defaults); + return themeUtils_default$1.getLayerOrder(name2, this.options, { names: this.getLayerNames() }, this.defaults); }, transformCSS(name2 = "", css22, type = "style", mode2) { - return themeUtils_default.transformCSS(name2, css22, mode2, type, this.options, { layerNames: this.setLayerNames.bind(this) }, this.defaults); + return themeUtils_default$1.transformCSS(name2, css22, mode2, type, this.options, { layerNames: this.setLayerNames.bind(this) }, this.defaults); }, getCommonStyleSheet(name2 = "", params, props = {}) { - return themeUtils_default.getCommonStyleSheet({ name: name2, theme: this.theme, params, props, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }); + return themeUtils_default$1.getCommonStyleSheet({ name: name2, theme: this.theme, params, props, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }); }, getStyleSheet(name2, params, props = {}) { - return themeUtils_default.getStyleSheet({ name: name2, theme: this.theme, params, props, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }); + return themeUtils_default$1.getStyleSheet({ name: name2, theme: this.theme, params, props, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }); }, onStyleMounted(name2) { this._loadingStyles.add(name2); @@ -1027,36 +1148,36 @@ var config_default = { onStyleLoaded(event, { name: name2 }) { if (this._loadingStyles.size) { this._loadingStyles.delete(name2); - service_default.emit(`theme:${name2}:load`, event); - !this._loadingStyles.size && service_default.emit("theme:load"); + service_default$1.emit(`theme:${name2}:load`, event); + !this._loadingStyles.size && service_default$1.emit("theme:load"); } } }; -function updatePreset(...presets) { - const newPreset = mergeKeys(config_default.getPreset(), ...presets); - config_default.setPreset(newPreset); +function updatePreset$1(...presets) { + const newPreset = mergeKeys$2(config_default$1.getPreset(), ...presets); + config_default$1.setPreset(newPreset); return newPreset; } -__name(updatePreset, "updatePreset"); -function updatePrimaryPalette(primary) { - return $t().primaryPalette(primary).update().preset; +__name(updatePreset$1, "updatePreset$1"); +function updatePrimaryPalette$1(primary) { + return $t$1().primaryPalette(primary).update().preset; } -__name(updatePrimaryPalette, "updatePrimaryPalette"); -function updateSurfacePalette(palette) { - return $t().surfacePalette(palette).update().preset; +__name(updatePrimaryPalette$1, "updatePrimaryPalette$1"); +function updateSurfacePalette$1(palette) { + return $t$1().surfacePalette(palette).update().preset; } -__name(updateSurfacePalette, "updateSurfacePalette"); -function usePreset(...presets) { - const newPreset = mergeKeys(...presets); - config_default.setPreset(newPreset); +__name(updateSurfacePalette$1, "updateSurfacePalette$1"); +function usePreset$1(...presets) { + const newPreset = mergeKeys$2(...presets); + config_default$1.setPreset(newPreset); return newPreset; } -__name(usePreset, "usePreset"); -function useTheme(theme42) { - return $t(theme42).update({ mergePresets: false }); +__name(usePreset$1, "usePreset$1"); +function useTheme$1(theme43) { + return $t$1(theme43).update({ mergePresets: false }); } -__name(useTheme, "useTheme"); -var index$1n = { +__name(useTheme$1, "useTheme$1"); +var index$1r = { root: { transitionDuration: "{transition.duration}" }, @@ -1081,7 +1202,7 @@ var index$1n = { width: "{focus.ring.width}", style: "{focus.ring.style}", color: "{focus.ring.color}", - offset: "{focus.ring.offset}", + offset: "-1px", shadow: "{focus.ring.shadow}" }, toggleIcon: { @@ -1107,11 +1228,12 @@ var index$1n = { padding: "0 1.125rem 1.125rem 1.125rem" } }; -var index$1m = { +var index$1q = { root: { background: "{form.field.background}", disabledBackground: "{form.field.disabled.background}", filledBackground: "{form.field.filled.background}", + filledHoverBackground: "{form.field.filled.hover.background}", filledFocusBackground: "{form.field.filled.focus.background}", borderColor: "{form.field.border.color}", hoverBorderColor: "{form.field.hover.border.color}", @@ -1120,6 +1242,7 @@ var index$1m = { color: "{form.field.color}", disabledColor: "{form.field.disabled.color}", placeholderColor: "{form.field.placeholder.color}", + invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", shadow: "{form.field.shadow}", paddingX: "{form.field.padding.x}", paddingY: "{form.field.padding.y}", @@ -1163,6 +1286,12 @@ var index$1m = { }, dropdown: { width: "2.5rem", + sm: { + width: "2rem" + }, + lg: { + width: "3rem" + }, borderColor: "{form.field.border.color}", hoverBorderColor: "{form.field.border.color}", activeBorderColor: "{form.field.border.color}", @@ -1183,6 +1312,10 @@ var index$1m = { }, colorScheme: { light: { + chip: { + focusBackground: "{surface.200}", + focusColor: "{surface.800}" + }, dropdown: { background: "{surface.100}", hoverBackground: "{surface.200}", @@ -1193,6 +1326,10 @@ var index$1m = { } }, dark: { + chip: { + focusBackground: "{surface.700}", + focusColor: "{surface.0}" + }, dropdown: { background: "{surface.800}", hoverBackground: "{surface.700}", @@ -1204,30 +1341,46 @@ var index$1m = { } } }; -var index$1l = { +var index$1p = { root: { width: "2rem", height: "2rem", fontSize: "1rem", background: "{content.border.color}", + color: "{content.color}", borderRadius: "{content.border.radius}" }, + icon: { + size: "1rem" + }, group: { borderColor: "{content.background}", - offset: "-1rem" + offset: "-0.75rem" }, lg: { width: "3rem", height: "3rem", - fontSize: "1.5rem" + fontSize: "1.5rem", + icon: { + size: "1.5rem" + }, + group: { + offset: "-1rem" + } }, xl: { width: "4rem", height: "4rem", - fontSize: "2rem" + fontSize: "2rem", + icon: { + size: "2rem" + }, + group: { + offset: "-1.5rem" + } } }; -var index$1k = { +var index$1o = { root: { borderRadius: "{border.radius.md}", padding: "0 0.5rem", @@ -1317,3933 +1470,7 @@ var index$1k = { } } }; -var index$1j = { - root: { - borderRadius: "{content.border.radius}" - } -}; -var index$1i = { - root: { - padding: "1rem", - background: "{content.background}", - gap: "0.5rem", - transitionDuration: "{transition.duration}" - }, - item: { - color: "{text.muted.color}", - hoverColor: "{text.color}", - borderRadius: "{content.border.radius}", - gap: "{navigation.item.gap}", - icon: { - color: "{navigation.item.icon.color}", - hoverColor: "{navigation.item.icon.focus.color}" - }, - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - separator: { - color: "{navigation.item.icon.color}" - } -}; -var index$1h = { - root: { - borderRadius: "{form.field.border.radius}", - roundedBorderRadius: "2rem", - gap: "0.5rem", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - iconOnlyWidth: "2.5rem", - sm: { - fontSize: "0.875rem", - paddingX: "0.625rem", - paddingY: "0.375rem" - }, - lg: { - fontSize: "1.125rem", - paddingX: "0.875rem", - paddingY: "0.625rem" - }, - label: { - fontWeight: "500" - }, - raisedShadow: "0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - offset: "{focus.ring.offset}" - }, - badgeSize: "1rem", - transitionDuration: "{form.field.transition.duration}" - }, - colorScheme: { - light: { - root: { - primary: { - background: "{primary.color}", - hoverBackground: "{primary.hover.color}", - activeBackground: "{primary.active.color}", - borderColor: "{primary.color}", - hoverBorderColor: "{primary.hover.color}", - activeBorderColor: "{primary.active.color}", - color: "{primary.contrast.color}", - hoverColor: "{primary.contrast.color}", - activeColor: "{primary.contrast.color}", - focusRing: { - color: "{primary.color}", - shadow: "none" - } - }, - secondary: { - background: "{surface.100}", - hoverBackground: "{surface.200}", - activeBackground: "{surface.300}", - borderColor: "{surface.100}", - hoverBorderColor: "{surface.200}", - activeBorderColor: "{surface.300}", - color: "{surface.600}", - hoverColor: "{surface.700}", - activeColor: "{surface.800}", - focusRing: { - color: "{surface.600}", - shadow: "none" - } - }, - info: { - background: "{sky.500}", - hoverBackground: "{sky.600}", - activeBackground: "{sky.700}", - borderColor: "{sky.500}", - hoverBorderColor: "{sky.600}", - activeBorderColor: "{sky.700}", - color: "#ffffff", - hoverColor: "#ffffff", - activeColor: "#ffffff", - focusRing: { - color: "{sky.500}", - shadow: "none" - } - }, - success: { - background: "{green.500}", - hoverBackground: "{green.600}", - activeBackground: "{green.700}", - borderColor: "{green.500}", - hoverBorderColor: "{green.600}", - activeBorderColor: "{green.700}", - color: "#ffffff", - hoverColor: "#ffffff", - activeColor: "#ffffff", - focusRing: { - color: "{green.500}", - shadow: "none" - } - }, - warn: { - background: "{orange.500}", - hoverBackground: "{orange.600}", - activeBackground: "{orange.700}", - borderColor: "{orange.500}", - hoverBorderColor: "{orange.600}", - activeBorderColor: "{orange.700}", - color: "#ffffff", - hoverColor: "#ffffff", - activeColor: "#ffffff", - focusRing: { - color: "{orange.500}", - shadow: "none" - } - }, - help: { - background: "{purple.500}", - hoverBackground: "{purple.600}", - activeBackground: "{purple.700}", - borderColor: "{purple.500}", - hoverBorderColor: "{purple.600}", - activeBorderColor: "{purple.700}", - color: "#ffffff", - hoverColor: "#ffffff", - activeColor: "#ffffff", - focusRing: { - color: "{purple.500}", - shadow: "none" - } - }, - danger: { - background: "{red.500}", - hoverBackground: "{red.600}", - activeBackground: "{red.700}", - borderColor: "{red.500}", - hoverBorderColor: "{red.600}", - activeBorderColor: "{red.700}", - color: "#ffffff", - hoverColor: "#ffffff", - activeColor: "#ffffff", - focusRing: { - color: "{red.500}", - shadow: "none" - } - }, - contrast: { - background: "{surface.950}", - hoverBackground: "{surface.900}", - activeBackground: "{surface.800}", - borderColor: "{surface.950}", - hoverBorderColor: "{surface.900}", - activeBorderColor: "{surface.800}", - color: "{surface.0}", - hoverColor: "{surface.0}", - activeColor: "{surface.0}", - focusRing: { - color: "{surface.950}", - shadow: "none" - } - } - }, - outlined: { - primary: { - hoverBackground: "{primary.50}", - activeBackground: "{primary.100}", - borderColor: "{primary.200}", - color: "{primary.color}" - }, - secondary: { - hoverBackground: "{surface.50}", - activeBackground: "{surface.100}", - borderColor: "{surface.200}", - color: "{surface.500}" - }, - success: { - hoverBackground: "{green.50}", - activeBackground: "{green.100}", - borderColor: "{green.200}", - color: "{green.500}" - }, - info: { - hoverBackground: "{sky.50}", - activeBackground: "{sky.100}", - borderColor: "{sky.200}", - color: "{sky.500}" - }, - warn: { - hoverBackground: "{orange.50}", - activeBackground: "{orange.100}", - borderColor: "{orange.200}", - color: "{orange.500}" - }, - help: { - hoverBackground: "{purple.50}", - activeBackground: "{purple.100}", - borderColor: "{purple.200}", - color: "{purple.500}" - }, - danger: { - hoverBackground: "{red.50}", - activeBackground: "{red.100}", - borderColor: "{red.200}", - color: "{red.500}" - }, - contrast: { - hoverBackground: "{surface.50}", - activeBackground: "{surface.100}", - borderColor: "{surface.700}", - color: "{surface.950}" - }, - plain: { - hoverBackground: "{surface.50}", - activeBackground: "{surface.100}", - borderColor: "{surface.200}", - color: "{surface.700}" - } - }, - text: { - primary: { - hoverBackground: "{primary.50}", - activeBackground: "{primary.100}", - color: "{primary.color}" - }, - secondary: { - hoverBackground: "{surface.50}", - activeBackground: "{surface.100}", - color: "{surface.500}" - }, - success: { - hoverBackground: "{green.50}", - activeBackground: "{green.100}", - color: "{green.500}" - }, - info: { - hoverBackground: "{sky.50}", - activeBackground: "{sky.100}", - color: "{sky.500}" - }, - warn: { - hoverBackground: "{orange.50}", - activeBackground: "{orange.100}", - color: "{orange.500}" - }, - help: { - hoverBackground: "{purple.50}", - activeBackground: "{purple.100}", - color: "{purple.500}" - }, - danger: { - hoverBackground: "{red.50}", - activeBackground: "{red.100}", - color: "{red.500}" - }, - plain: { - hoverBackground: "{surface.50}", - activeBackground: "{surface.100}", - color: "{surface.700}" - } - }, - link: { - color: "{primary.color}", - hoverColor: "{primary.color}", - activeColor: "{primary.color}" - } - }, - dark: { - root: { - primary: { - background: "{primary.color}", - hoverBackground: "{primary.hover.color}", - activeBackground: "{primary.active.color}", - borderColor: "{primary.color}", - hoverBorderColor: "{primary.hover.color}", - activeBorderColor: "{primary.active.color}", - color: "{primary.contrast.color}", - hoverColor: "{primary.contrast.color}", - activeColor: "{primary.contrast.color}", - focusRing: { - color: "{primary.color}", - shadow: "none" - } - }, - secondary: { - background: "{surface.800}", - hoverBackground: "{surface.700}", - activeBackground: "{surface.600}", - borderColor: "{surface.800}", - hoverBorderColor: "{surface.700}", - activeBorderColor: "{surface.600}", - color: "{surface.300}", - hoverColor: "{surface.200}", - activeColor: "{surface.100}", - focusRing: { - color: "{surface.300}", - shadow: "none" - } - }, - info: { - background: "{sky.400}", - hoverBackground: "{sky.300}", - activeBackground: "{sky.200}", - borderColor: "{sky.400}", - hoverBorderColor: "{sky.300}", - activeBorderColor: "{sky.200}", - color: "{sky.950}", - hoverColor: "{sky.950}", - activeColor: "{sky.950}", - focusRing: { - color: "{sky.400}", - shadow: "none" - } - }, - success: { - background: "{green.400}", - hoverBackground: "{green.300}", - activeBackground: "{green.200}", - borderColor: "{green.400}", - hoverBorderColor: "{green.300}", - activeBorderColor: "{green.200}", - color: "{green.950}", - hoverColor: "{green.950}", - activeColor: "{green.950}", - focusRing: { - color: "{green.400}", - shadow: "none" - } - }, - warn: { - background: "{orange.400}", - hoverBackground: "{orange.300}", - activeBackground: "{orange.200}", - borderColor: "{orange.400}", - hoverBorderColor: "{orange.300}", - activeBorderColor: "{orange.200}", - color: "{orange.950}", - hoverColor: "{orange.950}", - activeColor: "{orange.950}", - focusRing: { - color: "{orange.400}", - shadow: "none" - } - }, - help: { - background: "{purple.400}", - hoverBackground: "{purple.300}", - activeBackground: "{purple.200}", - borderColor: "{purple.400}", - hoverBorderColor: "{purple.300}", - activeBorderColor: "{purple.200}", - color: "{purple.950}", - hoverColor: "{purple.950}", - activeColor: "{purple.950}", - focusRing: { - color: "{purple.400}", - shadow: "none" - } - }, - danger: { - background: "{red.400}", - hoverBackground: "{red.300}", - activeBackground: "{red.200}", - borderColor: "{red.400}", - hoverBorderColor: "{red.300}", - activeBorderColor: "{red.200}", - color: "{red.950}", - hoverColor: "{red.950}", - activeColor: "{red.950}", - focusRing: { - color: "{red.400}", - shadow: "none" - } - }, - contrast: { - background: "{surface.0}", - hoverBackground: "{surface.100}", - activeBackground: "{surface.200}", - borderColor: "{surface.0}", - hoverBorderColor: "{surface.100}", - activeBorderColor: "{surface.200}", - color: "{surface.950}", - hoverColor: "{surface.950}", - activeColor: "{surface.950}", - focusRing: { - color: "{surface.0}", - shadow: "none" - } - } - }, - outlined: { - primary: { - hoverBackground: "color-mix(in srgb, {primary.color}, transparent 96%)", - activeBackground: "color-mix(in srgb, {primary.color}, transparent 84%)", - borderColor: "{primary.700}", - color: "{primary.color}" - }, - secondary: { - hoverBackground: "rgba(255,255,255,0.04)", - activeBackground: "rgba(255,255,255,0.16)", - borderColor: "{surface.700}", - color: "{surface.400}" - }, - success: { - hoverBackground: "color-mix(in srgb, {green.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {green.400}, transparent 84%)", - borderColor: "{green.700}", - color: "{green.400}" - }, - info: { - hoverBackground: "color-mix(in srgb, {sky.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {sky.400}, transparent 84%)", - borderColor: "{sky.700}", - color: "{sky.400}" - }, - warn: { - hoverBackground: "color-mix(in srgb, {orange.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {orange.400}, transparent 84%)", - borderColor: "{orange.700}", - color: "{orange.400}" - }, - help: { - hoverBackground: "color-mix(in srgb, {purple.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {purple.400}, transparent 84%)", - borderColor: "{purple.700}", - color: "{purple.400}" - }, - danger: { - hoverBackground: "color-mix(in srgb, {red.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {red.400}, transparent 84%)", - borderColor: "{red.700}", - color: "{red.400}" - }, - contrast: { - hoverBackground: "{surface.800}", - activeBackground: "{surface.700}", - borderColor: "{surface.500}", - color: "{surface.0}" - }, - plain: { - hoverBackground: "{surface.800}", - activeBackground: "{surface.700}", - borderColor: "{surface.600}", - color: "{surface.0}" - } - }, - text: { - primary: { - hoverBackground: "color-mix(in srgb, {primary.color}, transparent 96%)", - activeBackground: "color-mix(in srgb, {primary.color}, transparent 84%)", - color: "{primary.color}" - }, - secondary: { - hoverBackground: "{surface.800}", - activeBackground: "{surface.700}", - color: "{surface.400}" - }, - success: { - hoverBackground: "color-mix(in srgb, {green.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {green.400}, transparent 84%)", - color: "{green.400}" - }, - info: { - hoverBackground: "color-mix(in srgb, {sky.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {sky.400}, transparent 84%)", - color: "{sky.400}" - }, - warn: { - hoverBackground: "color-mix(in srgb, {orange.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {orange.400}, transparent 84%)", - color: "{orange.400}" - }, - help: { - hoverBackground: "color-mix(in srgb, {purple.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {purple.400}, transparent 84%)", - color: "{purple.400}" - }, - danger: { - hoverBackground: "color-mix(in srgb, {red.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {red.400}, transparent 84%)", - color: "{red.400}" - }, - plain: { - hoverBackground: "{surface.800}", - activeBackground: "{surface.700}", - color: "{surface.0}" - } - }, - link: { - color: "{primary.color}", - hoverColor: "{primary.color}", - activeColor: "{primary.color}" - } - } - } -}; -var index$1g = { - root: { - background: "{content.background}", - borderRadius: "{border.radius.xl}", - color: "{content.color}", - shadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)" - }, - body: { - padding: "1.25rem", - gap: "0.5rem" - }, - caption: { - gap: "0.5rem" - }, - title: { - fontSize: "1.25rem", - fontWeight: "500" - }, - subtitle: { - color: "{text.muted.color}" - } -}; -var index$1f = { - root: { - transitionDuration: "{transition.duration}" - }, - content: { - gap: "0.25rem" - }, - indicatorList: { - padding: "1rem", - gap: "0.5rem" - }, - indicator: { - width: "2rem", - height: "0.5rem", - borderRadius: "{content.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - colorScheme: { - light: { - indicator: { - background: "{surface.200}", - hoverBackground: "{surface.300}", - activeBackground: "{primary.color}" - } - }, - dark: { - indicator: { - background: "{surface.700}", - hoverBackground: "{surface.600}", - activeBackground: "{primary.color}" - } - } - } -}; -var index$1e = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}" - }, - dropdown: { - width: "2.5rem", - color: "{form.field.icon.color}" - }, - overlay: { - background: "{overlay.select.background}", - borderColor: "{overlay.select.border.color}", - borderRadius: "{overlay.select.border.radius}", - color: "{overlay.select.color}", - shadow: "{overlay.select.shadow}" - }, - list: { - padding: "{list.padding}", - gap: "{list.gap}" - }, - option: { - focusBackground: "{list.option.focus.background}", - selectedBackground: "{list.option.selected.background}", - selectedFocusBackground: "{list.option.selected.focus.background}", - color: "{list.option.color}", - focusColor: "{list.option.focus.color}", - selectedColor: "{list.option.selected.color}", - selectedFocusColor: "{list.option.selected.focus.color}", - padding: "{list.option.padding}", - borderRadius: "{list.option.border.radius}", - icon: { - color: "{list.option.icon.color}", - focusColor: "{list.option.icon.focus.color}", - size: "0.875rem" - } - } -}; -var index$1d = { - root: { - borderRadius: "{border.radius.sm}", - width: "1.25rem", - height: "1.25rem", - background: "{form.field.background}", - checkedBackground: "{primary.color}", - checkedHoverBackground: "{primary.hover.color}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.border.color}", - checkedBorderColor: "{primary.color}", - checkedHoverBorderColor: "{primary.hover.color}", - checkedFocusBorderColor: "{primary.color}", - checkedDisabledBorderColor: "{form.field.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - shadow: "{form.field.shadow}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}" - }, - icon: { - size: "0.875rem", - color: "{form.field.color}", - checkedColor: "{primary.contrast.color}", - checkedHoverColor: "{primary.contrast.color}", - disabledColor: "{form.field.disabled.color}" - } -}; -var index$1c = { - root: { - borderRadius: "16px", - paddingX: "0.75rem", - paddingY: "0.5rem", - gap: "0.5rem", - transitionDuration: "{transition.duration}" - }, - image: { - width: "2rem", - height: "2rem" - }, - icon: { - size: "1rem" - }, - removeIcon: { - size: "1rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - } - }, - colorScheme: { - light: { - root: { - background: "{surface.100}", - color: "{surface.800}" - }, - icon: { - color: "{surface.800}" - }, - removeIcon: { - color: "{surface.800}" - } - }, - dark: { - root: { - background: "{surface.800}", - color: "{surface.0}" - }, - icon: { - color: "{surface.0}" - }, - removeIcon: { - color: "{surface.0}" - } - } - } -}; -var index$1b = { - root: { - transitionDuration: "{transition.duration}" - }, - preview: { - width: "1.5rem", - height: "1.5rem", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - panel: { - shadow: "{overlay.popover.shadow}", - borderRadius: "{overlay.popover.borderRadius}" - }, - colorScheme: { - light: { - panel: { - background: "{surface.800}", - borderColor: "{surface.900}" - }, - handle: { - color: "{surface.0}" - } - }, - dark: { - panel: { - background: "{surface.900}", - borderColor: "{surface.700}" - }, - handle: { - color: "{surface.0}" - } - } - } -}; -var index$1a = { - icon: { - size: "2rem", - color: "{overlay.modal.color}" - }, - content: { - gap: "1rem" - } -}; -var index$19 = { - root: { - background: "{overlay.popover.background}", - borderColor: "{overlay.popover.border.color}", - color: "{overlay.popover.color}", - borderRadius: "{overlay.popover.border.radius}", - shadow: "{overlay.popover.shadow}", - gutter: "10px", - arrowOffset: "1.25rem" - }, - content: { - padding: "{overlay.popover.padding}", - gap: "1rem" - }, - icon: { - size: "1.5rem", - color: "{overlay.popover.color}" - }, - footer: { - gap: "0.5rem", - padding: "0 {overlay.popover.padding} {overlay.popover.padding} {overlay.popover.padding}" - } -}; -var index$18 = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}", - shadow: "{overlay.navigation.shadow}", - transitionDuration: "{transition.duration}" - }, - list: { - padding: "{navigation.list.padding}", - gap: "{navigation.list.gap}" - }, - item: { - focusBackground: "{navigation.item.focus.background}", - activeBackground: "{navigation.item.active.background}", - color: "{navigation.item.color}", - focusColor: "{navigation.item.focus.color}", - activeColor: "{navigation.item.active.color}", - padding: "{navigation.item.padding}", - borderRadius: "{navigation.item.border.radius}", - gap: "{navigation.item.gap}", - icon: { - color: "{navigation.item.icon.color}", - focusColor: "{navigation.item.icon.focus.color}", - activeColor: "{navigation.item.icon.active.color}" - } - }, - submenuIcon: { - size: "{navigation.submenu.icon.size}", - color: "{navigation.submenu.icon.color}", - focusColor: "{navigation.submenu.icon.focus.color}", - activeColor: "{navigation.submenu.icon.active.color}" - }, - separator: { - borderColor: "{content.border.color}" - } -}; -var index$17 = { - root: { - transitionDuration: "{transition.duration}" - }, - header: { - background: "{content.background}", - borderColor: "{datatable.border.color}", - color: "{content.color}", - borderWidth: "0 0 1px 0", - padding: "0.75rem 1rem" - }, - headerCell: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - borderColor: "{datatable.border.color}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - selectedColor: "{highlight.color}", - gap: "0.5rem", - padding: "0.75rem 1rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - } - }, - columnTitle: { - fontWeight: "600" - }, - row: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - selectedColor: "{highlight.color}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - } - }, - bodyCell: { - borderColor: "{datatable.border.color}", - padding: "0.75rem 1rem" - }, - footerCell: { - background: "{content.background}", - borderColor: "{datatable.border.color}", - color: "{content.color}", - padding: "0.75rem 1rem" - }, - columnFooter: { - fontWeight: "600" - }, - footer: { - background: "{content.background}", - borderColor: "{datatable.border.color}", - color: "{content.color}", - borderWidth: "0 0 1px 0", - padding: "0.75rem 1rem" - }, - dropPointColor: "{primary.color}", - columnResizerWidth: "0.5rem", - resizeIndicator: { - width: "1px", - color: "{primary.color}" - }, - sortIcon: { - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}" - }, - loadingIcon: { - size: "2rem" - }, - rowToggleButton: { - hoverBackground: "{content.hover.background}", - selectedHoverBackground: "{content.background}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - selectedHoverColor: "{primary.color}", - size: "1.75rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - filter: { - inlineGap: "0.5rem", - overlaySelect: { - background: "{overlay.select.background}", - borderColor: "{overlay.select.border.color}", - borderRadius: "{overlay.select.border.radius}", - color: "{overlay.select.color}", - shadow: "{overlay.select.shadow}" - }, - overlayPopover: { - background: "{overlay.popover.background}", - borderColor: "{overlay.popover.border.color}", - borderRadius: "{overlay.popover.border.radius}", - color: "{overlay.popover.color}", - shadow: "{overlay.popover.shadow}", - padding: "{overlay.popover.padding}", - gap: "0.5rem" - }, - rule: { - borderColor: "{content.border.color}" - }, - constraintList: { - padding: "{list.padding}", - gap: "{list.gap}" - }, - constraint: { - focusBackground: "{list.option.focus.background}", - selectedBackground: "{list.option.selected.background}", - selectedFocusBackground: "{list.option.selected.focus.background}", - color: "{list.option.color}", - focusColor: "{list.option.focus.color}", - selectedColor: "{list.option.selected.color}", - selectedFocusColor: "{list.option.selected.focus.color}", - separator: { - borderColor: "{content.border.color}" - }, - padding: "{list.option.padding}", - borderRadius: "{list.option.border.radius}" - } - }, - paginatorTop: { - borderColor: "{datatable.border.color}", - borderWidth: "0 0 1px 0" - }, - paginatorBottom: { - borderColor: "{datatable.border.color}", - borderWidth: "0 0 1px 0" - }, - colorScheme: { - light: { - root: { - borderColor: "{content.border.color}" - }, - row: { - stripedBackground: "{surface.50}" - }, - bodyCell: { - selectedBorderColor: "{primary.100}" - } - }, - dark: { - root: { - borderColor: "{surface.800}" - }, - row: { - stripedBackground: "{surface.950}" - }, - bodyCell: { - selectedBorderColor: "{primary.900}" - } - } - } -}; -var index$16 = { - root: { - borderColor: "transparent", - borderWidth: "0", - borderRadius: "0", - padding: "0" - }, - header: { - background: "{content.background}", - color: "{content.color}", - borderColor: "{content.border.color}", - borderWidth: "0 0 1px 0", - padding: "0.75rem 1rem", - borderRadius: "0" - }, - content: { - background: "{content.background}", - color: "{content.color}", - borderColor: "transparent", - borderWidth: "0", - padding: "0", - borderRadius: "0" - }, - footer: { - background: "{content.background}", - color: "{content.color}", - borderColor: "{content.border.color}", - borderWidth: "1px 0 0 0", - padding: "0.75rem 1rem", - borderRadius: "0" - }, - paginatorTop: { - borderColor: "{content.border.color}", - borderWidth: "0 0 1px 0" - }, - paginatorBottom: { - borderColor: "{content.border.color}", - borderWidth: "1px 0 0 0" - } -}; -var index$15 = { - root: { - transitionDuration: "{transition.duration}" - }, - panel: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}", - shadow: "{overlay.popover.shadow}", - padding: "{overlay.popover.padding}" - }, - header: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - padding: "0 0 0.5rem 0", - fontWeight: "500", - gap: "0.5rem" - }, - title: { - gap: "0.5rem", - fontWeight: "500" - }, - dropdown: { - width: "2.5rem", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.border.color}", - activeBorderColor: "{form.field.border.color}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - inputIcon: { - color: "{form.field.icon.color}" - }, - selectMonth: { - hoverBackground: "{content.hover.background}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - padding: "0.25rem 0.5rem", - borderRadius: "{content.border.radius}" - }, - selectYear: { - hoverBackground: "{content.hover.background}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - padding: "0.25rem 0.5rem", - borderRadius: "{content.border.radius}" - }, - group: { - borderColor: "{content.border.color}", - gap: "{overlay.popover.padding}" - }, - dayView: { - margin: "0.5rem 0 0 0" - }, - weekDay: { - padding: "0.25rem", - fontWeight: "500", - color: "{content.color}" - }, - date: { - hoverBackground: "{content.hover.background}", - selectedBackground: "{primary.color}", - rangeSelectedBackground: "{highlight.background}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - selectedColor: "{primary.contrast.color}", - rangeSelectedColor: "{highlight.color}", - width: "2rem", - height: "2rem", - borderRadius: "50%", - padding: "0.25rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - monthView: { - margin: "0.5rem 0 0 0" - }, - month: { - borderRadius: "{content.border.radius}" - }, - yearView: { - margin: "0.5rem 0 0 0" - }, - year: { - borderRadius: "{content.border.radius}" - }, - buttonbar: { - padding: "0.5rem 0 0 0", - borderColor: "{content.border.color}" - }, - timePicker: { - padding: "0.5rem 0 0 0", - borderColor: "{content.border.color}", - gap: "0.5rem", - buttonGap: "0.25rem" - }, - colorScheme: { - light: { - dropdown: { - background: "{surface.100}", - hoverBackground: "{surface.200}", - activeBackground: "{surface.300}", - color: "{surface.600}", - hoverColor: "{surface.700}", - activeColor: "{surface.800}" - }, - today: { - background: "{surface.200}", - color: "{surface.900}" - } - }, - dark: { - dropdown: { - background: "{surface.800}", - hoverBackground: "{surface.700}", - activeBackground: "{surface.600}", - color: "{surface.300}", - hoverColor: "{surface.200}", - activeColor: "{surface.100}" - }, - today: { - background: "{surface.700}", - color: "{surface.0}" - } - } - } -}; -var index$14 = { - root: { - background: "{overlay.modal.background}", - borderColor: "{overlay.modal.border.color}", - color: "{overlay.modal.color}", - borderRadius: "{overlay.modal.border.radius}", - shadow: "{overlay.modal.shadow}" - }, - header: { - padding: "{overlay.modal.padding}", - gap: "0.5rem" - }, - title: { - fontSize: "1.25rem", - fontWeight: "600" - }, - content: { - padding: "0 {overlay.modal.padding} {overlay.modal.padding} {overlay.modal.padding}" - }, - footer: { - padding: "0 {overlay.modal.padding} {overlay.modal.padding} {overlay.modal.padding}", - gap: "0.5rem" - } -}; -var index$13 = { - root: { - borderColor: "{content.border.color}" - }, - content: { - background: "{content.background}", - color: "{text.color}" - }, - horizontal: { - margin: "1rem 0", - padding: "0 1rem", - content: { - padding: "0 0.5rem" - } - }, - vertical: { - margin: "0 1rem", - padding: "0.5rem 0", - content: { - padding: "0.5rem 0" - } - } -}; -var index$12 = { - root: { - background: "rgba(255, 255, 255, 0.1)", - borderColor: "rgba(255, 255, 255, 0.2)", - padding: "0.5rem", - borderRadius: "{border.radius.xl}" - }, - item: { - borderRadius: "{content.border.radius}", - padding: "0.5rem", - size: "3rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - } -}; -var index$11 = { - root: { - background: "{overlay.modal.background}", - borderColor: "{overlay.modal.border.color}", - color: "{overlay.modal.color}", - borderRadius: "{overlay.modal.border.radius}", - shadow: "{overlay.modal.shadow}" - }, - header: { - padding: "{overlay.modal.padding}" - }, - title: { - fontSize: "1.5rem", - fontWeight: "600" - }, - content: { - padding: "0 {overlay.modal.padding} {overlay.modal.padding} {overlay.modal.padding}" - } -}; -var index$10 = { - toolbar: { - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}" - }, - toolbarItem: { - color: "{text.muted.color}", - hoverColor: "{text.color}", - activeColor: "{primary.color}" - }, - overlay: { - background: "{overlay.select.background}", - borderColor: "{overlay.select.border.color}", - borderRadius: "{overlay.select.border.radius}", - color: "{overlay.select.color}", - shadow: "{overlay.select.shadow}", - padding: "{list.padding}" - }, - overlayOption: { - focusBackground: "{list.option.focus.background}", - color: "{list.option.color}", - focusColor: "{list.option.focus.color}", - padding: "{list.option.padding}", - borderRadius: "{list.option.border.radius}" - }, - content: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}" - } -}; -var index$$ = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - color: "{content.color}", - padding: "0 1.125rem 1.125rem 1.125rem", - transitionDuration: "{transition.duration}" - }, - legend: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - borderRadius: "{content.border.radius}", - borderWidth: "1px", - borderColor: "transparent", - padding: "0.5rem 0.75rem", - gap: "0.5rem", - fontWeight: "600", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - toggleIcon: { - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}" - }, - content: { - padding: "0" - } -}; -var index$_ = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}", - transitionDuration: "{transition.duration}" - }, - header: { - background: "transparent", - color: "{text.color}", - padding: "1.125rem", - borderWidth: "0", - borderRadius: "0", - gap: "0.5rem" - }, - content: { - highlightBorderColor: "{primary.color}", - padding: "0 1.125rem 1.125rem 1.125rem" - }, - file: { - padding: "1rem", - gap: "1rem", - borderColor: "{content.border.color}", - info: { - gap: "0.5rem" - } - }, - progressbar: { - height: "0.25rem" - }, - basic: { - gap: "0.5rem" - } -}; -var index$Z = { - root: { - color: "{form.field.float.label.color}", - focusColor: "{form.field.float.label.focus.color}", - invalidColor: "{form.field.float.label.invalid.color}", - transitionDuration: "0.2s" - } -}; -var index$Y = { - root: { - borderWidth: "1px", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - transitionDuration: "{transition.duration}" - }, - navButton: { - background: "rgba(255, 255, 255, 0.1)", - hoverBackground: "rgba(255, 255, 255, 0.2)", - color: "{surface.100}", - hoverColor: "{surface.0}", - size: "3rem", - gutter: "0.5rem", - prev: { - borderRadius: "50%" - }, - next: { - borderRadius: "50%" - }, - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - navIcon: { - size: "1.5rem" - }, - thumbnailsContent: { - background: "{content.background}", - padding: "1rem 0.25rem" - }, - thumbnailNavButton: { - size: "2rem", - borderRadius: "{content.border.radius}", - gutter: "0.5rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - thumbnailNavButtonIcon: { - size: "1rem" - }, - caption: { - background: "rgba(0, 0, 0, 0.5)", - color: "{surface.100}", - padding: "1rem" - }, - indicatorList: { - gap: "0.5rem", - padding: "1rem" - }, - indicatorButton: { - width: "1rem", - height: "1rem", - activeBackground: "{primary.color}", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - insetIndicatorList: { - background: "rgba(0, 0, 0, 0.5)" - }, - insetIndicatorButton: { - background: "rgba(255, 255, 255, 0.4)", - hoverBackground: "rgba(255, 255, 255, 0.6)", - activeBackground: "rgba(255, 255, 255, 0.9)" - }, - mask: { - background: "{mask.background}", - color: "{mask.color}" - }, - closeButton: { - size: "3rem", - gutter: "0.5rem", - background: "rgba(255, 255, 255, 0.1)", - hoverBackground: "rgba(255, 255, 255, 0.2)", - color: "{surface.50}", - hoverColor: "{surface.0}", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - closeButtonIcon: { - size: "1.5rem" - }, - colorScheme: { - light: { - thumbnailNavButton: { - hoverBackground: "{surface.100}", - color: "{surface.600}", - hoverColor: "{surface.700}" - }, - indicatorButton: { - background: "{surface.200}", - hoverBackground: "{surface.300}" - } - }, - dark: { - thumbnailNavButton: { - hoverBackground: "{surface.700}", - color: "{surface.400}", - hoverColor: "{surface.0}" - }, - indicatorButton: { - background: "{surface.700}", - hoverBackground: "{surface.600}" - } - } - } -}; -var index$X = { - icon: { - color: "{form.field.icon.color}" - } -}; -var index$W = { - root: { - transitionDuration: "{transition.duration}" - }, - preview: { - icon: { - size: "1.5rem" - }, - mask: { - background: "{mask.background}", - color: "{mask.color}" - } - }, - toolbar: { - position: { - left: "auto", - right: "1rem", - top: "1rem", - bottom: "auto" - }, - blur: "8px", - background: "rgba(255,255,255,0.1)", - borderColor: "rgba(255,255,255,0.2)", - borderWidth: "1px", - borderRadius: "30px", - padding: ".5rem", - gap: "0.5rem" - }, - action: { - hoverBackground: "rgba(255,255,255,0.1)", - color: "{surface.50}", - hoverColor: "{surface.0}", - size: "3rem", - iconSize: "1.5rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - } -}; -var index$V = { - root: { - padding: "{form.field.padding.y} {form.field.padding.x}", - borderRadius: "{content.border.radius}", - gap: "0.5rem" - }, - text: { - fontWeight: "500" - }, - icon: { - size: "1rem" - }, - colorScheme: { - light: { - info: { - background: "color-mix(in srgb, {blue.50}, transparent 5%)", - borderColor: "{blue.200}", - color: "{blue.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)" - }, - success: { - background: "color-mix(in srgb, {green.50}, transparent 5%)", - borderColor: "{green.200}", - color: "{green.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)" - }, - warn: { - background: "color-mix(in srgb,{yellow.50}, transparent 5%)", - borderColor: "{yellow.200}", - color: "{yellow.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)" - }, - error: { - background: "color-mix(in srgb, {red.50}, transparent 5%)", - borderColor: "{red.200}", - color: "{red.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)" - }, - secondary: { - background: "{surface.100}", - borderColor: "{surface.200}", - color: "{surface.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)" - }, - contrast: { - background: "{surface.900}", - borderColor: "{surface.950}", - color: "{surface.50}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)" - } - }, - dark: { - info: { - background: "color-mix(in srgb, {blue.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {blue.700}, transparent 64%)", - color: "{blue.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)" - }, - success: { - background: "color-mix(in srgb, {green.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {green.700}, transparent 64%)", - color: "{green.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)" - }, - warn: { - background: "color-mix(in srgb, {yellow.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {yellow.700}, transparent 64%)", - color: "{yellow.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)" - }, - error: { - background: "color-mix(in srgb, {red.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {red.700}, transparent 64%)", - color: "{red.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)" - }, - secondary: { - background: "{surface.800}", - borderColor: "{surface.700}", - color: "{surface.300}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)" - }, - contrast: { - background: "{surface.0}", - borderColor: "{surface.100}", - color: "{surface.950}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)" - } - } - } -}; -var index$U = { - root: { - padding: "{form.field.padding.y} {form.field.padding.x}", - borderRadius: "{content.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - transitionDuration: "{transition.duration}" - }, - display: { - hoverBackground: "{content.hover.background}", - hoverColor: "{content.hover.color}" - } -}; -var index$T = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}" - }, - chip: { - borderRadius: "{border.radius.sm}" - }, - colorScheme: { - light: { - chip: { - focusBackground: "{surface.200}", - color: "{surface.800}" - } - }, - dark: { - chip: { - focusBackground: "{surface.700}", - color: "{surface.0}" - } - } - } -}; -var index$S = { - addon: { - background: "{form.field.background}", - borderColor: "{form.field.border.color}", - color: "{form.field.icon.color}", - borderRadius: "{form.field.border.radius}" - } -}; -var index$R = { - root: { - transitionDuration: "{transition.duration}" - }, - button: { - width: "2.5rem", - borderRadius: "{form.field.border.radius}", - verticalPadding: "{form.field.padding.y}" - }, - colorScheme: { - light: { - button: { - background: "transparent", - hoverBackground: "{surface.100}", - activeBackground: "{surface.200}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.border.color}", - activeBorderColor: "{form.field.border.color}", - color: "{surface.400}", - hoverColor: "{surface.500}", - activeColor: "{surface.600}" - } - }, - dark: { - button: { - background: "transparent", - hoverBackground: "{surface.800}", - activeBackground: "{surface.700}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.border.color}", - activeBorderColor: "{form.field.border.color}", - color: "{surface.400}", - hoverColor: "{surface.300}", - activeColor: "{surface.200}" - } - } - } -}; -var index$Q = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}", - sm: { - fontSize: "0.875rem", - paddingX: "0.625rem", - paddingY: "0.375rem" - }, - lg: { - fontSize: "1.125rem", - paddingX: "0.875rem", - paddingY: "0.625rem" - } - } -}; -var index$P = { - root: { - transitionDuration: "{transition.duration}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - value: { - background: "{primary.color}" - }, - range: { - background: "{content.border.color}" - }, - text: { - color: "{text.muted.color}" - } -}; -var index$O = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - shadow: "{form.field.shadow}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}" - }, - list: { - padding: "{list.padding}", - gap: "{list.gap}", - header: { - padding: "{list.header.padding}" - } - }, - option: { - focusBackground: "{list.option.focus.background}", - selectedBackground: "{list.option.selected.background}", - selectedFocusBackground: "{list.option.selected.focus.background}", - color: "{list.option.color}", - focusColor: "{list.option.focus.color}", - selectedColor: "{list.option.selected.color}", - selectedFocusColor: "{list.option.selected.focus.color}", - padding: "{list.option.padding}", - borderRadius: "{list.option.border.radius}" - }, - optionGroup: { - background: "{list.option.group.background}", - color: "{list.option.group.color}", - fontWeight: "{list.option.group.font.weight}", - padding: "{list.option.group.padding}" - }, - checkmark: { - color: "{list.option.color}", - gutterStart: "-0.375rem", - gutterEnd: "0.375rem" - }, - emptyMessage: { - padding: "{list.option.padding}" - }, - colorScheme: { - light: { - option: { - stripedBackground: "{surface.50}" - } - }, - dark: { - option: { - stripedBackground: "{surface.900}" - } - } - } -}; -var index$N = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - color: "{content.color}", - gap: "0.5rem", - verticalOrientation: { - padding: "{navigation.list.padding}", - gap: "0" - }, - horizontalOrientation: { - padding: "0.5rem 0.75rem" - }, - transitionDuration: "{transition.duration}" - }, - baseItem: { - borderRadius: "{content.border.radius}", - padding: "{navigation.item.padding}" - }, - item: { - focusBackground: "{navigation.item.focus.background}", - activeBackground: "{navigation.item.active.background}", - color: "{navigation.item.color}", - focusColor: "{navigation.item.focus.color}", - activeColor: "{navigation.item.active.color}", - padding: "{navigation.item.padding}", - borderRadius: "{navigation.item.border.radius}", - gap: "{navigation.item.gap}", - icon: { - color: "{navigation.item.icon.color}", - focusColor: "{navigation.item.icon.focus.color}", - activeColor: "{navigation.item.icon.active.color}" - } - }, - overlay: { - padding: "0", - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - color: "{content.color}", - shadow: "{overlay.navigation.shadow}", - gap: "0.5rem" - }, - submenu: { - padding: "{navigation.list.padding}", - gap: "{navigation.list.gap}" - }, - submenuLabel: { - padding: "{navigation.submenu.label.padding}", - fontWeight: "{navigation.submenu.label.font.weight}", - background: "{navigation.submenu.label.background.}", - color: "{navigation.submenu.label.color}" - }, - submenuIcon: { - size: "{navigation.submenu.icon.size}", - color: "{navigation.submenu.icon.color}", - focusColor: "{navigation.submenu.icon.focus.color}", - activeColor: "{navigation.submenu.icon.active.color}" - }, - separator: { - borderColor: "{content.border.color}" - }, - mobileButton: { - borderRadius: "50%", - size: "1.75rem", - color: "{text.muted.color}", - hoverColor: "{text.muted.hover.color}", - hoverBackground: "{content.hover.background}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - } -}; -var index$M = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}", - shadow: "{overlay.navigation.shadow}", - transitionDuration: "{transition.duration}" - }, - list: { - padding: "{navigation.list.padding}", - gap: "{navigation.list.gap}" - }, - item: { - focusBackground: "{navigation.item.focus.background}", - color: "{navigation.item.color}", - focusColor: "{navigation.item.focus.color}", - padding: "{navigation.item.padding}", - borderRadius: "{navigation.item.border.radius}", - gap: "{navigation.item.gap}", - icon: { - color: "{navigation.item.icon.color}", - focusColor: "{navigation.item.icon.focus.color}" - } - }, - submenuLabel: { - padding: "{navigation.submenu.label.padding}", - fontWeight: "{navigation.submenu.label.font.weight}", - background: "{navigation.submenu.label.background}", - color: "{navigation.submenu.label.color}" - }, - separator: { - borderColor: "{content.border.color}" - } -}; -var index$L = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - color: "{content.color}", - gap: "0.5rem", - padding: "0.5rem 0.75rem", - transitionDuration: "{transition.duration}" - }, - baseItem: { - borderRadius: "{content.border.radius}", - padding: "{navigation.item.padding}" - }, - item: { - focusBackground: "{navigation.item.focus.background}", - activeBackground: "{navigation.item.active.background}", - color: "{navigation.item.color}", - focusColor: "{navigation.item.focus.color}", - activeColor: "{navigation.item.active.color}", - padding: "{navigation.item.padding}", - borderRadius: "{navigation.item.border.radius}", - gap: "{navigation.item.gap}", - icon: { - color: "{navigation.item.icon.color}", - focusColor: "{navigation.item.icon.focus.color}", - activeColor: "{navigation.item.icon.active.color}" - } - }, - submenu: { - padding: "{navigation.list.padding}", - gap: "{navigation.list.gap}", - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - shadow: "{overlay.navigation.shadow}", - mobileIndent: "1rem" - }, - submenuIcon: { - size: "{navigation.submenu.icon.size}", - color: "{navigation.submenu.icon.color}", - focusColor: "{navigation.submenu.icon.focus.color}", - activeColor: "{navigation.submenu.icon.active.color}" - }, - separator: { - borderColor: "{content.border.color}" - }, - mobileButton: { - borderRadius: "50%", - size: "1.75rem", - color: "{text.muted.color}", - hoverColor: "{text.muted.hover.color}", - hoverBackground: "{content.hover.background}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - } -}; -var index$K = { - root: { - borderRadius: "{content.border.radius}", - borderWidth: "1px", - transitionDuration: "{transition.duration}" - }, - content: { - padding: "0.5rem 0.75rem", - gap: "0.5rem" - }, - text: { - fontSize: "1rem", - fontWeight: "500" - }, - icon: { - size: "1.125rem" - }, - closeButton: { - width: "1.75rem", - height: "1.75rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - offset: "{focus.ring.offset}" - } - }, - closeIcon: { - size: "1rem" - }, - colorScheme: { - light: { - info: { - background: "color-mix(in srgb, {blue.50}, transparent 5%)", - borderColor: "{blue.200}", - color: "{blue.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)", - closeButton: { - hoverBackground: "{blue.100}", - focusRing: { - color: "{blue.600}", - shadow: "none" - } - } - }, - success: { - background: "color-mix(in srgb, {green.50}, transparent 5%)", - borderColor: "{green.200}", - color: "{green.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)", - closeButton: { - hoverBackground: "{green.100}", - focusRing: { - color: "{green.600}", - shadow: "none" - } - } - }, - warn: { - background: "color-mix(in srgb,{yellow.50}, transparent 5%)", - borderColor: "{yellow.200}", - color: "{yellow.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)", - closeButton: { - hoverBackground: "{yellow.100}", - focusRing: { - color: "{yellow.600}", - shadow: "none" - } - } - }, - error: { - background: "color-mix(in srgb, {red.50}, transparent 5%)", - borderColor: "{red.200}", - color: "{red.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)", - closeButton: { - hoverBackground: "{red.100}", - focusRing: { - color: "{red.600}", - shadow: "none" - } - } - }, - secondary: { - background: "{surface.100}", - borderColor: "{surface.200}", - color: "{surface.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.200}", - focusRing: { - color: "{surface.600}", - shadow: "none" - } - } - }, - contrast: { - background: "{surface.900}", - borderColor: "{surface.950}", - color: "{surface.50}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.800}", - focusRing: { - color: "{surface.50}", - shadow: "none" - } - } - } - }, - dark: { - info: { - background: "color-mix(in srgb, {blue.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {blue.700}, transparent 64%)", - color: "{blue.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{blue.500}", - shadow: "none" - } - } - }, - success: { - background: "color-mix(in srgb, {green.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {green.700}, transparent 64%)", - color: "{green.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{green.500}", - shadow: "none" - } - } - }, - warn: { - background: "color-mix(in srgb, {yellow.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {yellow.700}, transparent 64%)", - color: "{yellow.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{yellow.500}", - shadow: "none" - } - } - }, - error: { - background: "color-mix(in srgb, {red.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {red.700}, transparent 64%)", - color: "{red.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{red.500}", - shadow: "none" - } - } - }, - secondary: { - background: "{surface.800}", - borderColor: "{surface.700}", - color: "{surface.300}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.700}", - focusRing: { - color: "{surface.300}", - shadow: "none" - } - } - }, - contrast: { - background: "{surface.0}", - borderColor: "{surface.100}", - color: "{surface.950}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.100}", - focusRing: { - color: "{surface.950}", - shadow: "none" - } - } - } - } - } -}; -var index$J = { - root: { - borderRadius: "{content.border.radius}", - gap: "1rem" - }, - meters: { - background: "{content.border.color}", - size: "0.5rem" - }, - label: { - gap: "0.5rem" - }, - labelMarker: { - size: "0.5rem" - }, - labelIcon: { - size: "1rem" - }, - labelList: { - verticalGap: "0.5rem", - horizontalGap: "1rem" - } -}; -var index$I = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}" - }, - dropdown: { - width: "2.5rem", - color: "{form.field.icon.color}" - }, - overlay: { - background: "{overlay.select.background}", - borderColor: "{overlay.select.border.color}", - borderRadius: "{overlay.select.border.radius}", - color: "{overlay.select.color}", - shadow: "{overlay.select.shadow}" - }, - list: { - padding: "{list.padding}", - gap: "{list.gap}", - header: { - padding: "{list.header.padding}" - } - }, - option: { - focusBackground: "{list.option.focus.background}", - selectedBackground: "{list.option.selected.background}", - selectedFocusBackground: "{list.option.selected.focus.background}", - color: "{list.option.color}", - focusColor: "{list.option.focus.color}", - selectedColor: "{list.option.selected.color}", - selectedFocusColor: "{list.option.selected.focus.color}", - padding: "{list.option.padding}", - borderRadius: "{list.option.border.radius}", - gap: "0.5rem" - }, - optionGroup: { - background: "{list.option.group.background}", - color: "{list.option.group.color}", - fontWeight: "{list.option.group.font.weight}", - padding: "{list.option.group.padding}" - }, - chip: { - borderRadius: "{border.radius.sm}" - }, - emptyMessage: { - padding: "{list.option.padding}" - } -}; -var index$H = { - root: { - gap: "1.125rem" - }, - controls: { - gap: "0.5rem" - } -}; -var index$G = { - root: { - gutter: "0.75rem", - transitionDuration: "{transition.duration}" - }, - node: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - selectedColor: "{highlight.color}", - hoverColor: "{content.hover.color}", - padding: "0.75rem 1rem", - toggleablePadding: "0.75rem 1rem 1.25rem 1rem", - borderRadius: "{content.border.radius}" - }, - nodeToggleButton: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - borderColor: "{content.border.color}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - size: "1.5rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - connector: { - color: "{content.border.color}", - borderRadius: "{content.border.radius}", - height: "24px" - } -}; -var index$F = { - root: { - outline: { - width: "2px", - color: "{content.background}" - } - } -}; -var index$E = { - root: { - padding: "0.5rem 1rem", - gap: "0.25rem", - borderRadius: "{content.border.radius}", - background: "{content.background}", - color: "{content.color}", - transitionDuration: "{transition.duration}" - }, - navButton: { - background: "transparent", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}", - selectedColor: "{highlight.color}", - width: "2.5rem", - height: "2.5rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - currentPageReport: { - color: "{text.muted.color}" - }, - jumpToPageInput: { - maxWidth: "2.5rem" - } -}; -var index$D = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}" - }, - header: { - background: "transparent", - color: "{text.color}", - padding: "1.125rem", - borderColor: "{content.border.color}", - borderWidth: "0", - borderRadius: "0" - }, - toggleableHeader: { - padding: "0.375rem 1.125rem" - }, - title: { - fontWeight: "600" - }, - content: { - padding: "0 1.125rem 1.125rem 1.125rem" - }, - footer: { - padding: "0 1.125rem 1.125rem 1.125rem" - } -}; -var index$C = { - root: { - gap: "0.5rem", - transitionDuration: "{transition.duration}" - }, - panel: { - background: "{content.background}", - borderColor: "{content.border.color}", - borderWidth: "1px", - color: "{content.color}", - padding: "0.25rem 0.25rem", - borderRadius: "{content.border.radius}", - first: { - borderWidth: "1px", - topBorderRadius: "{content.border.radius}" - }, - last: { - borderWidth: "1px", - bottomBorderRadius: "{content.border.radius}" - } - }, - item: { - focusBackground: "{navigation.item.focus.background}", - color: "{navigation.item.color}", - focusColor: "{navigation.item.focus.color}", - gap: "0.5rem", - padding: "{navigation.item.padding}", - borderRadius: "{content.border.radius}", - icon: { - color: "{navigation.item.icon.color}", - focusColor: "{navigation.item.icon.focus.color}" - } - }, - submenu: { - indent: "1rem" - }, - submenuIcon: { - color: "{navigation.submenu.icon.color}", - focusColor: "{navigation.submenu.icon.focus.color}" - } -}; -var index$B = { - meter: { - background: "{content.border.color}", - borderRadius: "{content.border.radius}", - height: ".75rem" - }, - icon: { - color: "{form.field.icon.color}" - }, - overlay: { - background: "{overlay.popover.background}", - borderColor: "{overlay.popover.border.color}", - borderRadius: "{overlay.popover.border.radius}", - color: "{overlay.popover.color}", - padding: "{overlay.popover.padding}", - shadow: "{overlay.popover.shadow}" - }, - content: { - gap: "0.5rem" - }, - colorScheme: { - light: { - strength: { - weakBackground: "{red.500}", - mediumBackground: "{amber.500}", - strongBackground: "{green.500}" - } - }, - dark: { - strength: { - weakBackground: "{red.400}", - mediumBackground: "{amber.400}", - strongBackground: "{green.400}" - } - } - } -}; -var index$A = { - root: { - gap: "1.125rem" - }, - controls: { - gap: "0.5rem" - } -}; -var index$z = { - root: { - background: "{overlay.popover.background}", - borderColor: "{overlay.popover.border.color}", - color: "{overlay.popover.color}", - borderRadius: "{overlay.popover.border.radius}", - shadow: "{overlay.popover.shadow}", - gutter: "10px", - arrowOffset: "1.25rem" - }, - content: { - padding: "{overlay.popover.padding}" - } -}; -var index$y = { - root: { - background: "{content.border.color}", - borderRadius: "{content.border.radius}", - height: "1.25rem" - }, - value: { - background: "{primary.color}" - }, - label: { - color: "{primary.contrast.color}", - fontSize: "0.75rem", - fontWeight: "600" - } -}; -var index$x = { - colorScheme: { - light: { - root: { - "color.1": "{red.500}", - "color.2": "{blue.500}", - "color.3": "{green.500}", - "color.4": "{yellow.500}" - } - }, - dark: { - root: { - "color.1": "{red.400}", - "color.2": "{blue.400}", - "color.3": "{green.400}", - "color.4": "{yellow.400}" - } - } - } -}; -var index$w = { - root: { - width: "1.25rem", - height: "1.25rem", - background: "{form.field.background}", - checkedBackground: "{primary.color}", - checkedHoverBackground: "{primary.hover.color}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.border.color}", - checkedBorderColor: "{primary.color}", - checkedHoverBorderColor: "{primary.hover.color}", - checkedFocusBorderColor: "{primary.color}", - checkedDisabledBorderColor: "{form.field.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - shadow: "{form.field.shadow}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}" - }, - icon: { - size: "0.75rem", - checkedColor: "{primary.contrast.color}", - checkedHoverColor: "{primary.contrast.color}", - disabledColor: "{form.field.disabled.color}" - } -}; -var index$v = { - root: { - gap: "0.25rem", - transitionDuration: "{transition.duration}" - }, - icon: { - size: "1rem", - color: "{text.muted.color}", - hoverColor: "{primary.color}", - activeColor: "{primary.color}" - } -}; -var index$u = { - colorScheme: { - light: { - root: { - background: "rgba(0,0,0,0.1)" - } - }, - dark: { - root: { - background: "rgba(255,255,255,0.3)" - } - } - } -}; -var index$t = { - root: { - transitionDuration: "{transition.duration}" - }, - bar: { - size: "9px", - borderRadius: "{border.radius.sm}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - colorScheme: { - light: { - bar: { - background: "{surface.100}" - } - }, - dark: { - bar: { - background: "{surface.800}" - } - } - } -}; -var index$s = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}" - }, - dropdown: { - width: "2.5rem", - color: "{form.field.icon.color}" - }, - overlay: { - background: "{overlay.select.background}", - borderColor: "{overlay.select.border.color}", - borderRadius: "{overlay.select.border.radius}", - color: "{overlay.select.color}", - shadow: "{overlay.select.shadow}" - }, - list: { - padding: "{list.padding}", - gap: "{list.gap}", - header: { - padding: "{list.header.padding}" - } - }, - option: { - focusBackground: "{list.option.focus.background}", - selectedBackground: "{list.option.selected.background}", - selectedFocusBackground: "{list.option.selected.focus.background}", - color: "{list.option.color}", - focusColor: "{list.option.focus.color}", - selectedColor: "{list.option.selected.color}", - selectedFocusColor: "{list.option.selected.focus.color}", - padding: "{list.option.padding}", - borderRadius: "{list.option.border.radius}" - }, - optionGroup: { - background: "{list.option.group.background}", - color: "{list.option.group.color}", - fontWeight: "{list.option.group.font.weight}", - padding: "{list.option.group.padding}" - }, - clearIcon: { - color: "{form.field.icon.color}" - }, - checkmark: { - color: "{list.option.color}", - gutterStart: "-0.375rem", - gutterEnd: "0.375rem" - }, - emptyMessage: { - padding: "{list.option.padding}" - } -}; -var index$r = { - root: { - borderRadius: "{form.field.border.radius}" - }, - colorScheme: { - light: { - root: { - invalidBorderColor: "{form.field.invalid.border.color}" - } - }, - dark: { - root: { - invalidBorderColor: "{form.field.invalid.border.color}" - } - } - } -}; -var index$q = { - root: { - borderRadius: "{content.border.radius}" - }, - colorScheme: { - light: { - root: { - background: "{surface.200}", - animationBackground: "rgba(255,255,255,0.4)" - } - }, - dark: { - root: { - background: "rgba(255, 255, 255, 0.06)", - animationBackground: "rgba(255, 255, 255, 0.04)" - } - } - } -}; -var index$p = { - root: { - transitionDuration: "{transition.duration}" - }, - track: { - background: "{content.border.color}", - borderRadius: "{content.border.radius}", - size: "3px" - }, - range: { - background: "{primary.color}" - }, - handle: { - width: "20px", - height: "20px", - borderRadius: "50%", - background: "{content.border.color}", - hoverBackground: "{content.border.color}", - content: { - borderRadius: "50%", - hoverBackground: "{content.background}", - width: "16px", - height: "16px", - shadow: "0px 0.5px 0px 0px rgba(0, 0, 0, 0.08), 0px 1px 1px 0px rgba(0, 0, 0, 0.14)" - }, - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - colorScheme: { - light: { - handle: { - contentBackground: "{surface.0}" - } - }, - dark: { - handle: { - contentBackground: "{surface.950}" - } - } - } -}; -var index$o = { - root: { - gap: "0.5rem", - transitionDuration: "{transition.duration}" - } -}; -var index$n = { - root: { - borderRadius: "{form.field.border.radius}", - roundedBorderRadius: "2rem", - raisedShadow: "0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)" - } -}; -var index$m = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - transitionDuration: "{transition.duration}" - }, - gutter: { - background: "{content.border.color}" - }, - handle: { - size: "24px", - background: "transparent", - borderRadius: "{content.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - } -}; -var index$l = { - root: { - transitionDuration: "{transition.duration}" - }, - separator: { - background: "{content.border.color}", - activeBackground: "{primary.color}", - margin: "0 0 0 1.625rem", - size: "2px" - }, - step: { - padding: "0.5rem", - gap: "1rem" - }, - stepHeader: { - padding: "0", - borderRadius: "{content.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - gap: "0.5rem" - }, - stepTitle: { - color: "{text.muted.color}", - activeColor: "{primary.color}", - fontWeight: "500" - }, - stepNumber: { - background: "{content.background}", - activeBackground: "{content.background}", - borderColor: "{content.border.color}", - activeBorderColor: "{content.border.color}", - color: "{text.muted.color}", - activeColor: "{primary.color}", - size: "2rem", - fontSize: "1.143rem", - fontWeight: "500", - borderRadius: "50%", - shadow: "0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12)" - }, - steppanels: { - padding: "0.875rem 0.5rem 1.125rem 0.5rem" - }, - steppanel: { - background: "{content.background}", - color: "{content.color}", - padding: "0 0 0 1rem" - } -}; -var index$k = { - root: { - transitionDuration: "{transition.duration}" - }, - separator: { - background: "{content.border.color}" - }, - itemLink: { - borderRadius: "{content.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - gap: "0.5rem" - }, - itemLabel: { - color: "{text.muted.color}", - activeColor: "{primary.color}", - fontWeight: "500" - }, - itemNumber: { - background: "{content.background}", - activeBackground: "{content.background}", - borderColor: "{content.border.color}", - activeBorderColor: "{content.border.color}", - color: "{text.muted.color}", - activeColor: "{primary.color}", - size: "2rem", - fontSize: "1.143rem", - fontWeight: "500", - borderRadius: "50%", - shadow: "0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12)" - } -}; -var index$j = { - root: { - transitionDuration: "{transition.duration}" - }, - tablist: { - borderWidth: "0 0 1px 0", - background: "{content.background}", - borderColor: "{content.border.color}" - }, - item: { - background: "transparent", - hoverBackground: "transparent", - activeBackground: "transparent", - borderWidth: "0 0 1px 0", - borderColor: "{content.border.color}", - hoverBorderColor: "{content.border.color}", - activeBorderColor: "{primary.color}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - activeColor: "{primary.color}", - padding: "1rem 1.125rem", - fontWeight: "600", - margin: "0 0 -1px 0", - gap: "0.5rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - itemIcon: { - color: "{text.muted.color}", - hoverColor: "{text.color}", - activeColor: "{primary.color}" - }, - activeBar: { - height: "1px", - bottom: "-1px", - background: "{primary.color}" - } -}; -var index$i = { - root: { - transitionDuration: "{transition.duration}" - }, - tablist: { - borderWidth: "0 0 1px 0", - background: "{content.background}", - borderColor: "{content.border.color}" - }, - tab: { - background: "transparent", - hoverBackground: "transparent", - activeBackground: "transparent", - borderWidth: "0 0 1px 0", - borderColor: "{content.border.color}", - hoverBorderColor: "{content.border.color}", - activeBorderColor: "{primary.color}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - activeColor: "{primary.color}", - padding: "1rem 1.125rem", - fontWeight: "600", - margin: "0 0 -1px 0", - gap: "0.5rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - } - }, - tabpanel: { - background: "{content.background}", - color: "{content.color}", - padding: "0.875rem 1.125rem 1.125rem 1.125rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "inset {focus.ring.shadow}" - } - }, - navButton: { - background: "{content.background}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - width: "2.5rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - } - }, - activeBar: { - height: "1px", - bottom: "-1px", - background: "{primary.color}" - }, - colorScheme: { - light: { - navButton: { - shadow: "0px 0px 10px 50px rgba(255, 255, 255, 0.6)" - } - }, - dark: { - navButton: { - shadow: "0px 0px 10px 50px color-mix(in srgb, {content.background}, transparent 50%)" - } - } - } -}; -var index$h = { - root: { - transitionDuration: "{transition.duration}" - }, - tabList: { - background: "{content.background}", - borderColor: "{content.border.color}" - }, - tab: { - borderColor: "{content.border.color}", - activeBorderColor: "{primary.color}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - activeColor: "{primary.color}" - }, - tabPanel: { - background: "{content.background}", - color: "{content.color}" - }, - navButton: { - background: "{content.background}", - color: "{text.muted.color}", - hoverColor: "{text.color}" - }, - colorScheme: { - light: { - navButton: { - shadow: "0px 0px 10px 50px rgba(255, 255, 255, 0.6)" - } - }, - dark: { - navButton: { - shadow: "0px 0px 10px 50px color-mix(in srgb, {content.background}, transparent 50%)" - } - } - } -}; -var index$g = { - root: { - fontSize: "0.875rem", - fontWeight: "700", - padding: "0.25rem 0.5rem", - gap: "0.25rem", - borderRadius: "{content.border.radius}", - roundedBorderRadius: "{border.radius.xl}" - }, - icon: { - size: "0.75rem" - }, - colorScheme: { - light: { - primary: { - background: "{primary.100}", - color: "{primary.700}" - }, - secondary: { - background: "{surface.100}", - color: "{surface.600}" - }, - success: { - background: "{green.100}", - color: "{green.700}" - }, - info: { - background: "{sky.100}", - color: "{sky.700}" - }, - warn: { - background: "{orange.100}", - color: "{orange.700}" - }, - danger: { - background: "{red.100}", - color: "{red.700}" - }, - contrast: { - background: "{surface.950}", - color: "{surface.0}" - } - }, - dark: { - primary: { - background: "color-mix(in srgb, {primary.500}, transparent 84%)", - color: "{primary.300}" - }, - secondary: { - background: "{surface.800}", - color: "{surface.300}" - }, - success: { - background: "color-mix(in srgb, {green.500}, transparent 84%)", - color: "{green.300}" - }, - info: { - background: "color-mix(in srgb, {sky.500}, transparent 84%)", - color: "{sky.300}" - }, - warn: { - background: "color-mix(in srgb, {orange.500}, transparent 84%)", - color: "{orange.300}" - }, - danger: { - background: "color-mix(in srgb, {red.500}, transparent 84%)", - color: "{red.300}" - }, - contrast: { - background: "{surface.0}", - color: "{surface.950}" - } - } - } -}; -var index$f = { - root: { - background: "{form.field.background}", - borderColor: "{form.field.border.color}", - color: "{form.field.color}", - height: "18rem", - padding: "{form.field.padding.y} {form.field.padding.x}", - borderRadius: "{form.field.border.radius}" - }, - prompt: { - gap: "0.25rem" - }, - commandResponse: { - margin: "2px 0" - } -}; -var index$e = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}" - } -}; -var index$d = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}", - shadow: "{overlay.navigation.shadow}", - transitionDuration: "{transition.duration}" - }, - list: { - padding: "{navigation.list.padding}", - gap: "{navigation.list.gap}" - }, - item: { - focusBackground: "{navigation.item.focus.background}", - activeBackground: "{navigation.item.active.background}", - color: "{navigation.item.color}", - focusColor: "{navigation.item.focus.color}", - activeColor: "{navigation.item.active.color}", - padding: "{navigation.item.padding}", - borderRadius: "{navigation.item.border.radius}", - gap: "{navigation.item.gap}", - icon: { - color: "{navigation.item.icon.color}", - focusColor: "{navigation.item.icon.focus.color}", - activeColor: "{navigation.item.icon.active.color}" - } - }, - submenuLabel: { - padding: "{navigation.submenu.label.padding}", - fontWeight: "{navigation.submenu.label.font.weight}", - background: "{navigation.submenu.label.background.}", - color: "{navigation.submenu.label.color}" - }, - submenuIcon: { - size: "{navigation.submenu.icon.size}", - color: "{navigation.submenu.icon.color}", - focusColor: "{navigation.submenu.icon.focus.color}", - activeColor: "{navigation.submenu.icon.active.color}" - }, - separator: { - borderColor: "{content.border.color}" - } -}; -var index$c = { - event: { - minHeight: "5rem" - }, - horizontal: { - eventContent: { - padding: "1rem 0" - } - }, - vertical: { - eventContent: { - padding: "0 1rem" - } - }, - eventMarker: { - size: "1.125rem", - borderRadius: "50%", - borderWidth: "2px", - background: "{content.background}", - borderColor: "{content.border.color}", - content: { - borderRadius: "50%", - size: "0.375rem", - background: "{primary.color}", - insetShadow: "0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12)" - } - }, - eventConnector: { - color: "{content.border.color}", - size: "2px" - } -}; -var index$b = { - root: { - width: "25rem", - borderRadius: "{content.border.radius}", - borderWidth: "1px", - transitionDuration: "{transition.duration}" - }, - icon: { - size: "1.125rem" - }, - content: { - padding: "{overlay.popover.padding}", - gap: "0.5rem" - }, - text: { - gap: "0.5rem" - }, - summary: { - fontWeight: "500", - fontSize: "1rem" - }, - detail: { - fontWeight: "500", - fontSize: "0.875rem" - }, - closeButton: { - width: "1.75rem", - height: "1.75rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - offset: "{focus.ring.offset}" - } - }, - closeIcon: { - size: "1rem" - }, - colorScheme: { - light: { - blur: "1.5px", - info: { - background: "color-mix(in srgb, {blue.50}, transparent 5%)", - borderColor: "{blue.200}", - color: "{blue.600}", - detailColor: "{surface.700}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)", - closeButton: { - hoverBackground: "{blue.100}", - focusRing: { - color: "{blue.600}", - shadow: "none" - } - } - }, - success: { - background: "color-mix(in srgb, {green.50}, transparent 5%)", - borderColor: "{green.200}", - color: "{green.600}", - detailColor: "{surface.700}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)", - closeButton: { - hoverBackground: "{green.100}", - focusRing: { - color: "{green.600}", - shadow: "none" - } - } - }, - warn: { - background: "color-mix(in srgb,{yellow.50}, transparent 5%)", - borderColor: "{yellow.200}", - color: "{yellow.600}", - detailColor: "{surface.700}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)", - closeButton: { - hoverBackground: "{yellow.100}", - focusRing: { - color: "{yellow.600}", - shadow: "none" - } - } - }, - error: { - background: "color-mix(in srgb, {red.50}, transparent 5%)", - borderColor: "{red.200}", - color: "{red.600}", - detailColor: "{surface.700}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)", - closeButton: { - hoverBackground: "{red.100}", - focusRing: { - color: "{red.600}", - shadow: "none" - } - } - }, - secondary: { - background: "{surface.100}", - borderColor: "{surface.200}", - color: "{surface.600}", - detailColor: "{surface.700}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.200}", - focusRing: { - color: "{surface.600}", - shadow: "none" - } - } - }, - contrast: { - background: "{surface.900}", - borderColor: "{surface.950}", - color: "{surface.50}", - detailColor: "{surface.0}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.800}", - focusRing: { - color: "{surface.50}", - shadow: "none" - } - } - } - }, - dark: { - blur: "10px", - info: { - background: "color-mix(in srgb, {blue.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {blue.700}, transparent 64%)", - color: "{blue.500}", - detailColor: "{surface.0}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{blue.500}", - shadow: "none" - } - } - }, - success: { - background: "color-mix(in srgb, {green.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {green.700}, transparent 64%)", - color: "{green.500}", - detailColor: "{surface.0}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{green.500}", - shadow: "none" - } - } - }, - warn: { - background: "color-mix(in srgb, {yellow.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {yellow.700}, transparent 64%)", - color: "{yellow.500}", - detailColor: "{surface.0}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{yellow.500}", - shadow: "none" - } - } - }, - error: { - background: "color-mix(in srgb, {red.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {red.700}, transparent 64%)", - color: "{red.500}", - detailColor: "{surface.0}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{red.500}", - shadow: "none" - } - } - }, - secondary: { - background: "{surface.800}", - borderColor: "{surface.700}", - color: "{surface.300}", - detailColor: "{surface.0}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.700}", - focusRing: { - color: "{surface.300}", - shadow: "none" - } - } - }, - contrast: { - background: "{surface.0}", - borderColor: "{surface.100}", - color: "{surface.950}", - detailColor: "{surface.950}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.100}", - focusRing: { - color: "{surface.950}", - shadow: "none" - } - } - } - } - } -}; -var index$a = { - root: { - padding: "0.5rem 1rem", - borderRadius: "{content.border.radius}", - gap: "0.5rem", - fontWeight: "500", - disabledBackground: "{form.field.disabled.background}", - disabledBorderColor: "{form.field.disabled.background}", - disabledColor: "{form.field.disabled.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}" - }, - icon: { - disabledColor: "{form.field.disabled.color}" - }, - content: { - left: "0.25rem", - top: "0.25rem", - checkedShadow: "0px 1px 2px 0px rgba(0, 0, 0, 0.02), 0px 1px 2px 0px rgba(0, 0, 0, 0.04)" - }, - colorScheme: { - light: { - root: { - background: "{surface.100}", - checkedBackground: "{surface.100}", - hoverBackground: "{surface.100}", - borderColor: "{surface.100}", - color: "{surface.500}", - hoverColor: "{surface.700}", - checkedColor: "{surface.900}", - checkedBorderColor: "{surface.100}" - }, - content: { - checkedBackground: "{surface.0}" - }, - icon: { - color: "{surface.500}", - hoverColor: "{surface.700}", - checkedColor: "{surface.900}" - } - }, - dark: { - root: { - background: "{surface.950}", - checkedBackground: "{surface.950}", - hoverBackground: "{surface.950}", - borderColor: "{surface.950}", - color: "{surface.400}", - hoverColor: "{surface.300}", - checkedColor: "{surface.0}", - checkedBorderColor: "{surface.950}" - }, - content: { - checkedBackground: "{surface.800}" - }, - icon: { - color: "{surface.400}", - hoverColor: "{surface.300}", - checkedColor: "{surface.0}" - } - } - } -}; -var index$9 = { - root: { - width: "2.5rem", - height: "1.5rem", - borderRadius: "30px", - gap: "0.25rem", - shadow: "{form.field.shadow}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - borderWidth: "1px", - borderColor: "transparent", - hoverBorderColor: "transparent", - checkedBorderColor: "transparent", - checkedHoverBorderColor: "transparent", - invalidBorderColor: "{form.field.invalid.border.color}", - transitionDuration: "{form.field.transition.duration}", - slideDuration: "0.2s", - disabledBackground: "{form.field.disabled.background}" - }, - handle: { - borderRadius: "50%", - size: "1rem", - disabledBackground: "{form.field.disabled.color}" - }, - colorScheme: { - light: { - root: { - background: "{surface.300}", - hoverBackground: "{surface.400}", - checkedBackground: "{primary.color}", - checkedHoverBackground: "{primary.hover.color}" - }, - handle: { - background: "{surface.0}", - hoverBackground: "{surface.0}", - checkedBackground: "{surface.0}", - checkedHoverBackground: "{surface.0}" - } - }, - dark: { - root: { - background: "{surface.700}", - hoverBackground: "{surface.600}", - checkedBackground: "{primary.color}", - checkedHoverBackground: "{primary.hover.color}" - }, - handle: { - background: "{surface.400}", - hoverBackground: "{surface.300}", - checkedBackground: "{surface.900}", - checkedHoverBackground: "{surface.900}" - } - } - } -}; -var index$8 = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - color: "{content.color}", - gap: "0.5rem", - padding: "0.75rem" - } -}; -var index$7 = { - root: { - maxWidth: "12.5rem", - gutter: "0.25rem", - shadow: "{overlay.popover.shadow}", - padding: "0.5rem 0.75rem", - borderRadius: "{overlay.popover.border.radius}" - }, - colorScheme: { - light: { - root: { - background: "{surface.700}", - color: "{surface.0}" - } - }, - dark: { - root: { - background: "{surface.700}", - color: "{surface.0}" - } - } - } -}; -var index$6 = { - root: { - background: "{content.background}", - color: "{content.color}", - padding: "1rem", - gap: "2px", - indent: "1rem", - transitionDuration: "{transition.duration}" - }, - node: { - padding: "0.25rem 0.5rem", - borderRadius: "{content.border.radius}", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - color: "{text.color}", - hoverColor: "{text.hover.color}", - selectedColor: "{highlight.color}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - }, - gap: "0.25rem" - }, - nodeIcon: { - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}", - selectedColor: "{highlight.color}" - }, - nodeToggleButton: { - borderRadius: "50%", - size: "1.75rem", - hoverBackground: "{content.hover.background}", - selectedHoverBackground: "{content.background}", - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}", - selectedHoverColor: "{primary.color}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - loadingIcon: { - size: "2rem" - } -}; -var index$5 = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}" - }, - dropdown: { - width: "2.5rem", - color: "{form.field.icon.color}" - }, - overlay: { - background: "{overlay.select.background}", - borderColor: "{overlay.select.border.color}", - borderRadius: "{overlay.select.border.radius}", - color: "{overlay.select.color}", - shadow: "{overlay.select.shadow}" - }, - tree: { - padding: "{list.padding}" - }, - emptyMessage: { - padding: "{list.option.padding}" - }, - chip: { - borderRadius: "{border.radius.sm}" - } -}; -var index$4 = { - root: { - transitionDuration: "{transition.duration}" - }, - header: { - background: "{content.background}", - borderColor: "{treetable.border.color}", - color: "{content.color}", - borderWidth: "0 0 1px 0", - padding: "0.75rem 1rem" - }, - headerCell: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - borderColor: "{treetable.border.color}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - selectedColor: "{highlight.color}", - gap: "0.5rem", - padding: "0.75rem 1rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - } - }, - columnTitle: { - fontWeight: "600" - }, - row: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - selectedColor: "{highlight.color}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - } - }, - bodyCell: { - borderColor: "{treetable.border.color}", - padding: "0.75rem 1rem", - gap: "0.5rem" - }, - footerCell: { - background: "{content.background}", - borderColor: "{treetable.border.color}", - color: "{content.color}", - padding: "0.75rem 1rem" - }, - columnFooter: { - fontWeight: "600" - }, - footer: { - background: "{content.background}", - borderColor: "{treetable.border.color}", - color: "{content.color}", - borderWidth: "0 0 1px 0", - padding: "0.75rem 1rem" - }, - columnResizerWidth: "0.5rem", - resizeIndicator: { - width: "1px", - color: "{primary.color}" - }, - sortIcon: { - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}" - }, - loadingIcon: { - size: "2rem" - }, - nodeToggleButton: { - hoverBackground: "{content.hover.background}", - selectedHoverBackground: "{content.background}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - selectedHoverColor: "{primary.color}", - size: "1.75rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - paginatorTop: { - borderColor: "{content.border.color}", - borderWidth: "0 0 1px 0" - }, - paginatorBottom: { - borderColor: "{content.border.color}", - borderWidth: "0 0 1px 0" - }, - colorScheme: { - light: { - root: { - borderColor: "{content.border.color}" - }, - bodyCell: { - selectedBorderColor: "{primary.100}" - } - }, - dark: { - root: { - borderColor: "{surface.800}" - }, - bodyCell: { - selectedBorderColor: "{primary.900}" - } - } - } -}; -var index$3 = { - loader: { - mask: { - background: "{content.background}", - color: "{text.muted.color}" - }, - icon: { - size: "2rem" - } - } -}; -var index$2 = { +var index$1n = { primitive: { borderRadius: { none: "0", @@ -5568,6 +1795,16 @@ var index$2 = { formField: { paddingX: "0.75rem", paddingY: "0.5rem", + sm: { + fontSize: "0.875rem", + paddingX: "0.625rem", + paddingY: "0.375rem" + }, + lg: { + fontSize: "1.125rem", + paddingX: "0.875rem", + paddingY: "0.625rem" + }, borderRadius: "{border.radius.md}", focusRing: { width: "0", @@ -5672,6 +1909,7 @@ var index$2 = { background: "{surface.0}", disabledBackground: "{surface.200}", filledBackground: "{surface.50}", + filledHoverBackground: "{surface.50}", filledFocusBackground: "{surface.50}", borderColor: "{surface.300}", hoverBorderColor: "{surface.400}", @@ -5680,9 +1918,11 @@ var index$2 = { color: "{surface.700}", disabledColor: "{surface.500}", placeholderColor: "{surface.500}", + invalidPlaceholderColor: "{red.600}", floatLabelColor: "{surface.500}", - floatLabelFocusColor: "{surface.500}", - floatLabelInvalidColor: "{red.400}", + floatLabelFocusColor: "{primary.600}", + floatLabelActiveColor: "{surface.500}", + floatLabelInvalidColor: "{form.field.invalid.placeholder.color}", iconColor: "{surface.400}", shadow: "0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgba(18, 18, 23, 0.05)" }, @@ -5794,17 +2034,20 @@ var index$2 = { background: "{surface.950}", disabledBackground: "{surface.700}", filledBackground: "{surface.800}", + filledHoverBackground: "{surface.800}", filledFocusBackground: "{surface.800}", - borderColor: "{surface.700}", - hoverBorderColor: "{surface.600}", + borderColor: "{surface.600}", + hoverBorderColor: "{surface.500}", focusBorderColor: "{primary.color}", invalidBorderColor: "{red.300}", color: "{surface.0}", disabledColor: "{surface.400}", placeholderColor: "{surface.400}", + invalidPlaceholderColor: "{red.400}", floatLabelColor: "{surface.400}", - floatLabelFocusColor: "{surface.400}", - floatLabelInvalidColor: "{red.300}", + floatLabelFocusColor: "{primary.color}", + floatLabelActiveColor: "{surface.400}", + floatLabelInvalidColor: "{form.field.invalid.placeholder.color}", iconColor: "{surface.400}", shadow: "0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgba(18, 18, 23, 0.05)" }, @@ -5882,43 +2125,4368 @@ var index$2 = { } } } + } +}; +var index$1m = { + root: { + borderRadius: "{content.border.radius}" + } +}; +var index$1l = { + root: { + padding: "1rem", + background: "{content.background}", + gap: "0.5rem", + transitionDuration: "{transition.duration}" }, + item: { + color: "{text.muted.color}", + hoverColor: "{text.color}", + borderRadius: "{content.border.radius}", + gap: "{navigation.item.gap}", + icon: { + color: "{navigation.item.icon.color}", + hoverColor: "{navigation.item.icon.focus.color}" + }, + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + separator: { + color: "{navigation.item.icon.color}" + } +}; +var index$1k = { + root: { + borderRadius: "{form.field.border.radius}", + roundedBorderRadius: "2rem", + gap: "0.5rem", + paddingX: "{form.field.padding.x}", + paddingY: "{form.field.padding.y}", + iconOnlyWidth: "2.5rem", + sm: { + fontSize: "{form.field.sm.font.size}", + paddingX: "{form.field.sm.padding.x}", + paddingY: "{form.field.sm.padding.y}" + }, + lg: { + fontSize: "{form.field.lg.font.size}", + paddingX: "{form.field.lg.padding.x}", + paddingY: "{form.field.lg.padding.y}" + }, + label: { + fontWeight: "500" + }, + raisedShadow: "0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + offset: "{focus.ring.offset}" + }, + badgeSize: "1rem", + transitionDuration: "{form.field.transition.duration}" + }, + colorScheme: { + light: { + root: { + primary: { + background: "{primary.color}", + hoverBackground: "{primary.hover.color}", + activeBackground: "{primary.active.color}", + borderColor: "{primary.color}", + hoverBorderColor: "{primary.hover.color}", + activeBorderColor: "{primary.active.color}", + color: "{primary.contrast.color}", + hoverColor: "{primary.contrast.color}", + activeColor: "{primary.contrast.color}", + focusRing: { + color: "{primary.color}", + shadow: "none" + } + }, + secondary: { + background: "{surface.100}", + hoverBackground: "{surface.200}", + activeBackground: "{surface.300}", + borderColor: "{surface.100}", + hoverBorderColor: "{surface.200}", + activeBorderColor: "{surface.300}", + color: "{surface.600}", + hoverColor: "{surface.700}", + activeColor: "{surface.800}", + focusRing: { + color: "{surface.600}", + shadow: "none" + } + }, + info: { + background: "{sky.500}", + hoverBackground: "{sky.600}", + activeBackground: "{sky.700}", + borderColor: "{sky.500}", + hoverBorderColor: "{sky.600}", + activeBorderColor: "{sky.700}", + color: "#ffffff", + hoverColor: "#ffffff", + activeColor: "#ffffff", + focusRing: { + color: "{sky.500}", + shadow: "none" + } + }, + success: { + background: "{green.500}", + hoverBackground: "{green.600}", + activeBackground: "{green.700}", + borderColor: "{green.500}", + hoverBorderColor: "{green.600}", + activeBorderColor: "{green.700}", + color: "#ffffff", + hoverColor: "#ffffff", + activeColor: "#ffffff", + focusRing: { + color: "{green.500}", + shadow: "none" + } + }, + warn: { + background: "{orange.500}", + hoverBackground: "{orange.600}", + activeBackground: "{orange.700}", + borderColor: "{orange.500}", + hoverBorderColor: "{orange.600}", + activeBorderColor: "{orange.700}", + color: "#ffffff", + hoverColor: "#ffffff", + activeColor: "#ffffff", + focusRing: { + color: "{orange.500}", + shadow: "none" + } + }, + help: { + background: "{purple.500}", + hoverBackground: "{purple.600}", + activeBackground: "{purple.700}", + borderColor: "{purple.500}", + hoverBorderColor: "{purple.600}", + activeBorderColor: "{purple.700}", + color: "#ffffff", + hoverColor: "#ffffff", + activeColor: "#ffffff", + focusRing: { + color: "{purple.500}", + shadow: "none" + } + }, + danger: { + background: "{red.500}", + hoverBackground: "{red.600}", + activeBackground: "{red.700}", + borderColor: "{red.500}", + hoverBorderColor: "{red.600}", + activeBorderColor: "{red.700}", + color: "#ffffff", + hoverColor: "#ffffff", + activeColor: "#ffffff", + focusRing: { + color: "{red.500}", + shadow: "none" + } + }, + contrast: { + background: "{surface.950}", + hoverBackground: "{surface.900}", + activeBackground: "{surface.800}", + borderColor: "{surface.950}", + hoverBorderColor: "{surface.900}", + activeBorderColor: "{surface.800}", + color: "{surface.0}", + hoverColor: "{surface.0}", + activeColor: "{surface.0}", + focusRing: { + color: "{surface.950}", + shadow: "none" + } + } + }, + outlined: { + primary: { + hoverBackground: "{primary.50}", + activeBackground: "{primary.100}", + borderColor: "{primary.200}", + color: "{primary.color}" + }, + secondary: { + hoverBackground: "{surface.50}", + activeBackground: "{surface.100}", + borderColor: "{surface.200}", + color: "{surface.500}" + }, + success: { + hoverBackground: "{green.50}", + activeBackground: "{green.100}", + borderColor: "{green.200}", + color: "{green.500}" + }, + info: { + hoverBackground: "{sky.50}", + activeBackground: "{sky.100}", + borderColor: "{sky.200}", + color: "{sky.500}" + }, + warn: { + hoverBackground: "{orange.50}", + activeBackground: "{orange.100}", + borderColor: "{orange.200}", + color: "{orange.500}" + }, + help: { + hoverBackground: "{purple.50}", + activeBackground: "{purple.100}", + borderColor: "{purple.200}", + color: "{purple.500}" + }, + danger: { + hoverBackground: "{red.50}", + activeBackground: "{red.100}", + borderColor: "{red.200}", + color: "{red.500}" + }, + contrast: { + hoverBackground: "{surface.50}", + activeBackground: "{surface.100}", + borderColor: "{surface.700}", + color: "{surface.950}" + }, + plain: { + hoverBackground: "{surface.50}", + activeBackground: "{surface.100}", + borderColor: "{surface.200}", + color: "{surface.700}" + } + }, + text: { + primary: { + hoverBackground: "{primary.50}", + activeBackground: "{primary.100}", + color: "{primary.color}" + }, + secondary: { + hoverBackground: "{surface.50}", + activeBackground: "{surface.100}", + color: "{surface.500}" + }, + success: { + hoverBackground: "{green.50}", + activeBackground: "{green.100}", + color: "{green.500}" + }, + info: { + hoverBackground: "{sky.50}", + activeBackground: "{sky.100}", + color: "{sky.500}" + }, + warn: { + hoverBackground: "{orange.50}", + activeBackground: "{orange.100}", + color: "{orange.500}" + }, + help: { + hoverBackground: "{purple.50}", + activeBackground: "{purple.100}", + color: "{purple.500}" + }, + danger: { + hoverBackground: "{red.50}", + activeBackground: "{red.100}", + color: "{red.500}" + }, + contrast: { + hoverBackground: "{surface.50}", + activeBackground: "{surface.100}", + color: "{surface.950}" + }, + plain: { + hoverBackground: "{surface.50}", + activeBackground: "{surface.100}", + color: "{surface.700}" + } + }, + link: { + color: "{primary.color}", + hoverColor: "{primary.color}", + activeColor: "{primary.color}" + } + }, + dark: { + root: { + primary: { + background: "{primary.color}", + hoverBackground: "{primary.hover.color}", + activeBackground: "{primary.active.color}", + borderColor: "{primary.color}", + hoverBorderColor: "{primary.hover.color}", + activeBorderColor: "{primary.active.color}", + color: "{primary.contrast.color}", + hoverColor: "{primary.contrast.color}", + activeColor: "{primary.contrast.color}", + focusRing: { + color: "{primary.color}", + shadow: "none" + } + }, + secondary: { + background: "{surface.800}", + hoverBackground: "{surface.700}", + activeBackground: "{surface.600}", + borderColor: "{surface.800}", + hoverBorderColor: "{surface.700}", + activeBorderColor: "{surface.600}", + color: "{surface.300}", + hoverColor: "{surface.200}", + activeColor: "{surface.100}", + focusRing: { + color: "{surface.300}", + shadow: "none" + } + }, + info: { + background: "{sky.400}", + hoverBackground: "{sky.300}", + activeBackground: "{sky.200}", + borderColor: "{sky.400}", + hoverBorderColor: "{sky.300}", + activeBorderColor: "{sky.200}", + color: "{sky.950}", + hoverColor: "{sky.950}", + activeColor: "{sky.950}", + focusRing: { + color: "{sky.400}", + shadow: "none" + } + }, + success: { + background: "{green.400}", + hoverBackground: "{green.300}", + activeBackground: "{green.200}", + borderColor: "{green.400}", + hoverBorderColor: "{green.300}", + activeBorderColor: "{green.200}", + color: "{green.950}", + hoverColor: "{green.950}", + activeColor: "{green.950}", + focusRing: { + color: "{green.400}", + shadow: "none" + } + }, + warn: { + background: "{orange.400}", + hoverBackground: "{orange.300}", + activeBackground: "{orange.200}", + borderColor: "{orange.400}", + hoverBorderColor: "{orange.300}", + activeBorderColor: "{orange.200}", + color: "{orange.950}", + hoverColor: "{orange.950}", + activeColor: "{orange.950}", + focusRing: { + color: "{orange.400}", + shadow: "none" + } + }, + help: { + background: "{purple.400}", + hoverBackground: "{purple.300}", + activeBackground: "{purple.200}", + borderColor: "{purple.400}", + hoverBorderColor: "{purple.300}", + activeBorderColor: "{purple.200}", + color: "{purple.950}", + hoverColor: "{purple.950}", + activeColor: "{purple.950}", + focusRing: { + color: "{purple.400}", + shadow: "none" + } + }, + danger: { + background: "{red.400}", + hoverBackground: "{red.300}", + activeBackground: "{red.200}", + borderColor: "{red.400}", + hoverBorderColor: "{red.300}", + activeBorderColor: "{red.200}", + color: "{red.950}", + hoverColor: "{red.950}", + activeColor: "{red.950}", + focusRing: { + color: "{red.400}", + shadow: "none" + } + }, + contrast: { + background: "{surface.0}", + hoverBackground: "{surface.100}", + activeBackground: "{surface.200}", + borderColor: "{surface.0}", + hoverBorderColor: "{surface.100}", + activeBorderColor: "{surface.200}", + color: "{surface.950}", + hoverColor: "{surface.950}", + activeColor: "{surface.950}", + focusRing: { + color: "{surface.0}", + shadow: "none" + } + } + }, + outlined: { + primary: { + hoverBackground: "color-mix(in srgb, {primary.color}, transparent 96%)", + activeBackground: "color-mix(in srgb, {primary.color}, transparent 84%)", + borderColor: "{primary.700}", + color: "{primary.color}" + }, + secondary: { + hoverBackground: "rgba(255,255,255,0.04)", + activeBackground: "rgba(255,255,255,0.16)", + borderColor: "{surface.700}", + color: "{surface.400}" + }, + success: { + hoverBackground: "color-mix(in srgb, {green.400}, transparent 96%)", + activeBackground: "color-mix(in srgb, {green.400}, transparent 84%)", + borderColor: "{green.700}", + color: "{green.400}" + }, + info: { + hoverBackground: "color-mix(in srgb, {sky.400}, transparent 96%)", + activeBackground: "color-mix(in srgb, {sky.400}, transparent 84%)", + borderColor: "{sky.700}", + color: "{sky.400}" + }, + warn: { + hoverBackground: "color-mix(in srgb, {orange.400}, transparent 96%)", + activeBackground: "color-mix(in srgb, {orange.400}, transparent 84%)", + borderColor: "{orange.700}", + color: "{orange.400}" + }, + help: { + hoverBackground: "color-mix(in srgb, {purple.400}, transparent 96%)", + activeBackground: "color-mix(in srgb, {purple.400}, transparent 84%)", + borderColor: "{purple.700}", + color: "{purple.400}" + }, + danger: { + hoverBackground: "color-mix(in srgb, {red.400}, transparent 96%)", + activeBackground: "color-mix(in srgb, {red.400}, transparent 84%)", + borderColor: "{red.700}", + color: "{red.400}" + }, + contrast: { + hoverBackground: "{surface.800}", + activeBackground: "{surface.700}", + borderColor: "{surface.500}", + color: "{surface.0}" + }, + plain: { + hoverBackground: "{surface.800}", + activeBackground: "{surface.700}", + borderColor: "{surface.600}", + color: "{surface.0}" + } + }, + text: { + primary: { + hoverBackground: "color-mix(in srgb, {primary.color}, transparent 96%)", + activeBackground: "color-mix(in srgb, {primary.color}, transparent 84%)", + color: "{primary.color}" + }, + secondary: { + hoverBackground: "{surface.800}", + activeBackground: "{surface.700}", + color: "{surface.400}" + }, + success: { + hoverBackground: "color-mix(in srgb, {green.400}, transparent 96%)", + activeBackground: "color-mix(in srgb, {green.400}, transparent 84%)", + color: "{green.400}" + }, + info: { + hoverBackground: "color-mix(in srgb, {sky.400}, transparent 96%)", + activeBackground: "color-mix(in srgb, {sky.400}, transparent 84%)", + color: "{sky.400}" + }, + warn: { + hoverBackground: "color-mix(in srgb, {orange.400}, transparent 96%)", + activeBackground: "color-mix(in srgb, {orange.400}, transparent 84%)", + color: "{orange.400}" + }, + help: { + hoverBackground: "color-mix(in srgb, {purple.400}, transparent 96%)", + activeBackground: "color-mix(in srgb, {purple.400}, transparent 84%)", + color: "{purple.400}" + }, + danger: { + hoverBackground: "color-mix(in srgb, {red.400}, transparent 96%)", + activeBackground: "color-mix(in srgb, {red.400}, transparent 84%)", + color: "{red.400}" + }, + contrast: { + hoverBackground: "{surface.800}", + activeBackground: "{surface.700}", + color: "{surface.0}" + }, + plain: { + hoverBackground: "{surface.800}", + activeBackground: "{surface.700}", + color: "{surface.0}" + } + }, + link: { + color: "{primary.color}", + hoverColor: "{primary.color}", + activeColor: "{primary.color}" + } + } + } +}; +var index$1j = { + root: { + background: "{content.background}", + borderRadius: "{border.radius.xl}", + color: "{content.color}", + shadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)" + }, + body: { + padding: "1.25rem", + gap: "0.5rem" + }, + caption: { + gap: "0.5rem" + }, + title: { + fontSize: "1.25rem", + fontWeight: "500" + }, + subtitle: { + color: "{text.muted.color}" + } +}; +var index$1i = { + root: { + transitionDuration: "{transition.duration}" + }, + content: { + gap: "0.25rem" + }, + indicatorList: { + padding: "1rem", + gap: "0.5rem" + }, + indicator: { + width: "2rem", + height: "0.5rem", + borderRadius: "{content.border.radius}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + colorScheme: { + light: { + indicator: { + background: "{surface.200}", + hoverBackground: "{surface.300}", + activeBackground: "{primary.color}" + } + }, + dark: { + indicator: { + background: "{surface.700}", + hoverBackground: "{surface.600}", + activeBackground: "{primary.color}" + } + } + } +}; +var index$1h = { + root: { + background: "{form.field.background}", + disabledBackground: "{form.field.disabled.background}", + filledBackground: "{form.field.filled.background}", + filledHoverBackground: "{form.field.filled.hover.background}", + filledFocusBackground: "{form.field.filled.focus.background}", + borderColor: "{form.field.border.color}", + hoverBorderColor: "{form.field.hover.border.color}", + focusBorderColor: "{form.field.focus.border.color}", + invalidBorderColor: "{form.field.invalid.border.color}", + color: "{form.field.color}", + disabledColor: "{form.field.disabled.color}", + placeholderColor: "{form.field.placeholder.color}", + invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", + shadow: "{form.field.shadow}", + paddingX: "{form.field.padding.x}", + paddingY: "{form.field.padding.y}", + borderRadius: "{form.field.border.radius}", + focusRing: { + width: "{form.field.focus.ring.width}", + style: "{form.field.focus.ring.style}", + color: "{form.field.focus.ring.color}", + offset: "{form.field.focus.ring.offset}", + shadow: "{form.field.focus.ring.shadow}" + }, + transitionDuration: "{form.field.transition.duration}", + sm: { + fontSize: "{form.field.sm.font.size}", + paddingX: "{form.field.sm.padding.x}", + paddingY: "{form.field.sm.padding.y}" + }, + lg: { + fontSize: "{form.field.lg.font.size}", + paddingX: "{form.field.lg.padding.x}", + paddingY: "{form.field.lg.padding.y}" + } + }, + dropdown: { + width: "2.5rem", + color: "{form.field.icon.color}" + }, + overlay: { + background: "{overlay.select.background}", + borderColor: "{overlay.select.border.color}", + borderRadius: "{overlay.select.border.radius}", + color: "{overlay.select.color}", + shadow: "{overlay.select.shadow}" + }, + list: { + padding: "{list.padding}", + gap: "{list.gap}", + mobileIndent: "1rem" + }, + option: { + focusBackground: "{list.option.focus.background}", + selectedBackground: "{list.option.selected.background}", + selectedFocusBackground: "{list.option.selected.focus.background}", + color: "{list.option.color}", + focusColor: "{list.option.focus.color}", + selectedColor: "{list.option.selected.color}", + selectedFocusColor: "{list.option.selected.focus.color}", + padding: "{list.option.padding}", + borderRadius: "{list.option.border.radius}", + icon: { + color: "{list.option.icon.color}", + focusColor: "{list.option.icon.focus.color}", + size: "0.875rem" + } + }, + clearIcon: { + color: "{form.field.icon.color}" + } +}; +var index$1g = { + root: { + borderRadius: "{border.radius.sm}", + width: "1.25rem", + height: "1.25rem", + background: "{form.field.background}", + checkedBackground: "{primary.color}", + checkedHoverBackground: "{primary.hover.color}", + disabledBackground: "{form.field.disabled.background}", + filledBackground: "{form.field.filled.background}", + borderColor: "{form.field.border.color}", + hoverBorderColor: "{form.field.hover.border.color}", + focusBorderColor: "{form.field.border.color}", + checkedBorderColor: "{primary.color}", + checkedHoverBorderColor: "{primary.hover.color}", + checkedFocusBorderColor: "{primary.color}", + checkedDisabledBorderColor: "{form.field.border.color}", + invalidBorderColor: "{form.field.invalid.border.color}", + shadow: "{form.field.shadow}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + }, + transitionDuration: "{form.field.transition.duration}", + sm: { + width: "1rem", + height: "1rem" + }, + lg: { + width: "1.5rem", + height: "1.5rem" + } + }, + icon: { + size: "0.875rem", + color: "{form.field.color}", + checkedColor: "{primary.contrast.color}", + checkedHoverColor: "{primary.contrast.color}", + disabledColor: "{form.field.disabled.color}", + sm: { + size: "0.75rem" + }, + lg: { + size: "1rem" + } + } +}; +var index$1f = { + root: { + borderRadius: "16px", + paddingX: "0.75rem", + paddingY: "0.5rem", + gap: "0.5rem", + transitionDuration: "{transition.duration}" + }, + image: { + width: "2rem", + height: "2rem" + }, + icon: { + size: "1rem" + }, + removeIcon: { + size: "1rem", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{form.field.focus.ring.shadow}" + } + }, + colorScheme: { + light: { + root: { + background: "{surface.100}", + color: "{surface.800}" + }, + icon: { + color: "{surface.800}" + }, + removeIcon: { + color: "{surface.800}" + } + }, + dark: { + root: { + background: "{surface.800}", + color: "{surface.0}" + }, + icon: { + color: "{surface.0}" + }, + removeIcon: { + color: "{surface.0}" + } + } + } +}; +var index$1e = { + root: { + transitionDuration: "{transition.duration}" + }, + preview: { + width: "1.5rem", + height: "1.5rem", + borderRadius: "{form.field.border.radius}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + panel: { + shadow: "{overlay.popover.shadow}", + borderRadius: "{overlay.popover.borderRadius}" + }, + colorScheme: { + light: { + panel: { + background: "{surface.800}", + borderColor: "{surface.900}" + }, + handle: { + color: "{surface.0}" + } + }, + dark: { + panel: { + background: "{surface.900}", + borderColor: "{surface.700}" + }, + handle: { + color: "{surface.0}" + } + } + } +}; +var index$1d = { + icon: { + size: "2rem", + color: "{overlay.modal.color}" + }, + content: { + gap: "1rem" + } +}; +var index$1c = { + root: { + background: "{overlay.popover.background}", + borderColor: "{overlay.popover.border.color}", + color: "{overlay.popover.color}", + borderRadius: "{overlay.popover.border.radius}", + shadow: "{overlay.popover.shadow}", + gutter: "10px", + arrowOffset: "1.25rem" + }, + content: { + padding: "{overlay.popover.padding}", + gap: "1rem" + }, + icon: { + size: "1.5rem", + color: "{overlay.popover.color}" + }, + footer: { + gap: "0.5rem", + padding: "0 {overlay.popover.padding} {overlay.popover.padding} {overlay.popover.padding}" + } +}; +var index$1b = { + root: { + background: "{content.background}", + borderColor: "{content.border.color}", + color: "{content.color}", + borderRadius: "{content.border.radius}", + shadow: "{overlay.navigation.shadow}", + transitionDuration: "{transition.duration}" + }, + list: { + padding: "{navigation.list.padding}", + gap: "{navigation.list.gap}" + }, + item: { + focusBackground: "{navigation.item.focus.background}", + activeBackground: "{navigation.item.active.background}", + color: "{navigation.item.color}", + focusColor: "{navigation.item.focus.color}", + activeColor: "{navigation.item.active.color}", + padding: "{navigation.item.padding}", + borderRadius: "{navigation.item.border.radius}", + gap: "{navigation.item.gap}", + icon: { + color: "{navigation.item.icon.color}", + focusColor: "{navigation.item.icon.focus.color}", + activeColor: "{navigation.item.icon.active.color}" + } + }, + submenu: { + mobileIndent: "1rem" + }, + submenuIcon: { + size: "{navigation.submenu.icon.size}", + color: "{navigation.submenu.icon.color}", + focusColor: "{navigation.submenu.icon.focus.color}", + activeColor: "{navigation.submenu.icon.active.color}" + }, + separator: { + borderColor: "{content.border.color}" + } +}; +var index$1a = { + root: { + transitionDuration: "{transition.duration}" + }, + header: { + background: "{content.background}", + borderColor: "{datatable.border.color}", + color: "{content.color}", + borderWidth: "0 0 1px 0", + padding: "0.75rem 1rem" + }, + headerCell: { + background: "{content.background}", + hoverBackground: "{content.hover.background}", + selectedBackground: "{highlight.background}", + borderColor: "{datatable.border.color}", + color: "{content.color}", + hoverColor: "{content.hover.color}", + selectedColor: "{highlight.color}", + gap: "0.5rem", + padding: "0.75rem 1rem", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "-1px", + shadow: "{focus.ring.shadow}" + } + }, + columnTitle: { + fontWeight: "600" + }, + row: { + background: "{content.background}", + hoverBackground: "{content.hover.background}", + selectedBackground: "{highlight.background}", + color: "{content.color}", + hoverColor: "{content.hover.color}", + selectedColor: "{highlight.color}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "-1px", + shadow: "{focus.ring.shadow}" + } + }, + bodyCell: { + borderColor: "{datatable.border.color}", + padding: "0.75rem 1rem" + }, + footerCell: { + background: "{content.background}", + borderColor: "{datatable.border.color}", + color: "{content.color}", + padding: "0.75rem 1rem" + }, + columnFooter: { + fontWeight: "600" + }, + footer: { + background: "{content.background}", + borderColor: "{datatable.border.color}", + color: "{content.color}", + borderWidth: "0 0 1px 0", + padding: "0.75rem 1rem" + }, + dropPoint: { + color: "{primary.color}" + }, + columnResizerWidth: "0.5rem", + resizeIndicator: { + width: "1px", + color: "{primary.color}" + }, + sortIcon: { + color: "{text.muted.color}", + hoverColor: "{text.hover.muted.color}", + size: "0.875rem" + }, + loadingIcon: { + size: "2rem" + }, + rowToggleButton: { + hoverBackground: "{content.hover.background}", + selectedHoverBackground: "{content.background}", + color: "{text.muted.color}", + hoverColor: "{text.color}", + selectedHoverColor: "{primary.color}", + size: "1.75rem", + borderRadius: "50%", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + filter: { + inlineGap: "0.5rem", + overlaySelect: { + background: "{overlay.select.background}", + borderColor: "{overlay.select.border.color}", + borderRadius: "{overlay.select.border.radius}", + color: "{overlay.select.color}", + shadow: "{overlay.select.shadow}" + }, + overlayPopover: { + background: "{overlay.popover.background}", + borderColor: "{overlay.popover.border.color}", + borderRadius: "{overlay.popover.border.radius}", + color: "{overlay.popover.color}", + shadow: "{overlay.popover.shadow}", + padding: "{overlay.popover.padding}", + gap: "0.5rem" + }, + rule: { + borderColor: "{content.border.color}" + }, + constraintList: { + padding: "{list.padding}", + gap: "{list.gap}" + }, + constraint: { + focusBackground: "{list.option.focus.background}", + selectedBackground: "{list.option.selected.background}", + selectedFocusBackground: "{list.option.selected.focus.background}", + color: "{list.option.color}", + focusColor: "{list.option.focus.color}", + selectedColor: "{list.option.selected.color}", + selectedFocusColor: "{list.option.selected.focus.color}", + separator: { + borderColor: "{content.border.color}" + }, + padding: "{list.option.padding}", + borderRadius: "{list.option.border.radius}" + } + }, + paginatorTop: { + borderColor: "{datatable.border.color}", + borderWidth: "0 0 1px 0" + }, + paginatorBottom: { + borderColor: "{datatable.border.color}", + borderWidth: "0 0 1px 0" + }, + colorScheme: { + light: { + root: { + borderColor: "{content.border.color}" + }, + row: { + stripedBackground: "{surface.50}" + }, + bodyCell: { + selectedBorderColor: "{primary.100}" + } + }, + dark: { + root: { + borderColor: "{surface.800}" + }, + row: { + stripedBackground: "{surface.950}" + }, + bodyCell: { + selectedBorderColor: "{primary.900}" + } + } + } +}; +var index$19 = { + root: { + borderColor: "transparent", + borderWidth: "0", + borderRadius: "0", + padding: "0" + }, + header: { + background: "{content.background}", + color: "{content.color}", + borderColor: "{content.border.color}", + borderWidth: "0 0 1px 0", + padding: "0.75rem 1rem", + borderRadius: "0" + }, + content: { + background: "{content.background}", + color: "{content.color}", + borderColor: "transparent", + borderWidth: "0", + padding: "0", + borderRadius: "0" + }, + footer: { + background: "{content.background}", + color: "{content.color}", + borderColor: "{content.border.color}", + borderWidth: "1px 0 0 0", + padding: "0.75rem 1rem", + borderRadius: "0" + }, + paginatorTop: { + borderColor: "{content.border.color}", + borderWidth: "0 0 1px 0" + }, + paginatorBottom: { + borderColor: "{content.border.color}", + borderWidth: "1px 0 0 0" + } +}; +var index$18 = { + root: { + transitionDuration: "{transition.duration}" + }, + panel: { + background: "{content.background}", + borderColor: "{content.border.color}", + color: "{content.color}", + borderRadius: "{content.border.radius}", + shadow: "{overlay.popover.shadow}", + padding: "{overlay.popover.padding}" + }, + header: { + background: "{content.background}", + borderColor: "{content.border.color}", + color: "{content.color}", + padding: "0 0 0.5rem 0" + }, + title: { + gap: "0.5rem", + fontWeight: "500" + }, + dropdown: { + width: "2.5rem", + sm: { + width: "2rem" + }, + lg: { + width: "3rem" + }, + borderColor: "{form.field.border.color}", + hoverBorderColor: "{form.field.border.color}", + activeBorderColor: "{form.field.border.color}", + borderRadius: "{form.field.border.radius}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + inputIcon: { + color: "{form.field.icon.color}" + }, + selectMonth: { + hoverBackground: "{content.hover.background}", + color: "{content.color}", + hoverColor: "{content.hover.color}", + padding: "0.25rem 0.5rem", + borderRadius: "{content.border.radius}" + }, + selectYear: { + hoverBackground: "{content.hover.background}", + color: "{content.color}", + hoverColor: "{content.hover.color}", + padding: "0.25rem 0.5rem", + borderRadius: "{content.border.radius}" + }, + group: { + borderColor: "{content.border.color}", + gap: "{overlay.popover.padding}" + }, + dayView: { + margin: "0.5rem 0 0 0" + }, + weekDay: { + padding: "0.25rem", + fontWeight: "500", + color: "{content.color}" + }, + date: { + hoverBackground: "{content.hover.background}", + selectedBackground: "{primary.color}", + rangeSelectedBackground: "{highlight.background}", + color: "{content.color}", + hoverColor: "{content.hover.color}", + selectedColor: "{primary.contrast.color}", + rangeSelectedColor: "{highlight.color}", + width: "2rem", + height: "2rem", + borderRadius: "50%", + padding: "0.25rem", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + monthView: { + margin: "0.5rem 0 0 0" + }, + month: { + padding: "0.375rem", + borderRadius: "{content.border.radius}" + }, + yearView: { + margin: "0.5rem 0 0 0" + }, + year: { + padding: "0.375rem", + borderRadius: "{content.border.radius}" + }, + buttonbar: { + padding: "0.5rem 0 0 0", + borderColor: "{content.border.color}" + }, + timePicker: { + padding: "0.5rem 0 0 0", + borderColor: "{content.border.color}", + gap: "0.5rem", + buttonGap: "0.25rem" + }, + colorScheme: { + light: { + dropdown: { + background: "{surface.100}", + hoverBackground: "{surface.200}", + activeBackground: "{surface.300}", + color: "{surface.600}", + hoverColor: "{surface.700}", + activeColor: "{surface.800}" + }, + today: { + background: "{surface.200}", + color: "{surface.900}" + } + }, + dark: { + dropdown: { + background: "{surface.800}", + hoverBackground: "{surface.700}", + activeBackground: "{surface.600}", + color: "{surface.300}", + hoverColor: "{surface.200}", + activeColor: "{surface.100}" + }, + today: { + background: "{surface.700}", + color: "{surface.0}" + } + } + } +}; +var index$17 = { + root: { + background: "{overlay.modal.background}", + borderColor: "{overlay.modal.border.color}", + color: "{overlay.modal.color}", + borderRadius: "{overlay.modal.border.radius}", + shadow: "{overlay.modal.shadow}" + }, + header: { + padding: "{overlay.modal.padding}", + gap: "0.5rem" + }, + title: { + fontSize: "1.25rem", + fontWeight: "600" + }, + content: { + padding: "0 {overlay.modal.padding} {overlay.modal.padding} {overlay.modal.padding}" + }, + footer: { + padding: "0 {overlay.modal.padding} {overlay.modal.padding} {overlay.modal.padding}", + gap: "0.5rem" + } +}; +var index$16 = { + root: { + borderColor: "{content.border.color}" + }, + content: { + background: "{content.background}", + color: "{text.color}" + }, + horizontal: { + margin: "1rem 0", + padding: "0 1rem", + content: { + padding: "0 0.5rem" + } + }, + vertical: { + margin: "0 1rem", + padding: "0.5rem 0", + content: { + padding: "0.5rem 0" + } + } +}; +var index$15 = { + root: { + background: "rgba(255, 255, 255, 0.1)", + borderColor: "rgba(255, 255, 255, 0.2)", + padding: "0.5rem", + borderRadius: "{border.radius.xl}" + }, + item: { + borderRadius: "{content.border.radius}", + padding: "0.5rem", + size: "3rem", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + } +}; +var index$14 = { + root: { + background: "{overlay.modal.background}", + borderColor: "{overlay.modal.border.color}", + color: "{overlay.modal.color}", + shadow: "{overlay.modal.shadow}" + }, + header: { + padding: "{overlay.modal.padding}" + }, + title: { + fontSize: "1.5rem", + fontWeight: "600" + }, + content: { + padding: "0 {overlay.modal.padding} {overlay.modal.padding} {overlay.modal.padding}" + }, + footer: { + padding: "{overlay.modal.padding}" + } +}; +var index$13 = { + toolbar: { + background: "{content.background}", + borderColor: "{content.border.color}", + borderRadius: "{content.border.radius}" + }, + toolbarItem: { + color: "{text.muted.color}", + hoverColor: "{text.color}", + activeColor: "{primary.color}" + }, + overlay: { + background: "{overlay.select.background}", + borderColor: "{overlay.select.border.color}", + borderRadius: "{overlay.select.border.radius}", + color: "{overlay.select.color}", + shadow: "{overlay.select.shadow}", + padding: "{list.padding}" + }, + overlayOption: { + focusBackground: "{list.option.focus.background}", + color: "{list.option.color}", + focusColor: "{list.option.focus.color}", + padding: "{list.option.padding}", + borderRadius: "{list.option.border.radius}" + }, + content: { + background: "{content.background}", + borderColor: "{content.border.color}", + color: "{content.color}", + borderRadius: "{content.border.radius}" + } +}; +var index$12 = { + root: { + background: "{content.background}", + borderColor: "{content.border.color}", + borderRadius: "{content.border.radius}", + color: "{content.color}", + padding: "0 1.125rem 1.125rem 1.125rem", + transitionDuration: "{transition.duration}" + }, + legend: { + background: "{content.background}", + hoverBackground: "{content.hover.background}", + color: "{content.color}", + hoverColor: "{content.hover.color}", + borderRadius: "{content.border.radius}", + borderWidth: "1px", + borderColor: "transparent", + padding: "0.5rem 0.75rem", + gap: "0.5rem", + fontWeight: "600", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + toggleIcon: { + color: "{text.muted.color}", + hoverColor: "{text.hover.muted.color}" + }, + content: { + padding: "0" + } +}; +var index$11 = { + root: { + background: "{content.background}", + borderColor: "{content.border.color}", + color: "{content.color}", + borderRadius: "{content.border.radius}", + transitionDuration: "{transition.duration}" + }, + header: { + background: "transparent", + color: "{text.color}", + padding: "1.125rem", + borderColor: "unset", + borderWidth: "0", + borderRadius: "0", + gap: "0.5rem" + }, + content: { + highlightBorderColor: "{primary.color}", + padding: "0 1.125rem 1.125rem 1.125rem", + gap: "1rem" + }, + file: { + padding: "1rem", + gap: "1rem", + borderColor: "{content.border.color}", + info: { + gap: "0.5rem" + } + }, + fileList: { + gap: "0.5rem" + }, + progressbar: { + height: "0.25rem" + }, + basic: { + gap: "0.5rem" + } +}; +var index$10 = { + root: { + color: "{form.field.float.label.color}", + focusColor: "{form.field.float.label.focus.color}", + activeColor: "{form.field.float.label.active.color}", + invalidColor: "{form.field.float.label.invalid.color}", + transitionDuration: "0.2s", + positionX: "{form.field.padding.x}", + positionY: "{form.field.padding.y}", + fontWeight: "500", + active: { + fontSize: "0.75rem", + fontWeight: "400" + } + }, + over: { + active: { + top: "-1.25rem" + } + }, + "in": { + input: { + paddingTop: "1.5rem", + paddingBottom: "{form.field.padding.y}" + }, + active: { + top: "{form.field.padding.y}" + } + }, + on: { + borderRadius: "{border.radius.xs}", + active: { + background: "{form.field.background}", + padding: "0 0.125rem" + } + } +}; +var index$$ = { + root: { + borderWidth: "1px", + borderColor: "{content.border.color}", + borderRadius: "{content.border.radius}", + transitionDuration: "{transition.duration}" + }, + navButton: { + background: "rgba(255, 255, 255, 0.1)", + hoverBackground: "rgba(255, 255, 255, 0.2)", + color: "{surface.100}", + hoverColor: "{surface.0}", + size: "3rem", + gutter: "0.5rem", + prev: { + borderRadius: "50%" + }, + next: { + borderRadius: "50%" + }, + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + navIcon: { + size: "1.5rem" + }, + thumbnailsContent: { + background: "{content.background}", + padding: "1rem 0.25rem" + }, + thumbnailNavButton: { + size: "2rem", + borderRadius: "{content.border.radius}", + gutter: "0.5rem", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + thumbnailNavButtonIcon: { + size: "1rem" + }, + caption: { + background: "rgba(0, 0, 0, 0.5)", + color: "{surface.100}", + padding: "1rem" + }, + indicatorList: { + gap: "0.5rem", + padding: "1rem" + }, + indicatorButton: { + width: "1rem", + height: "1rem", + activeBackground: "{primary.color}", + borderRadius: "50%", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + insetIndicatorList: { + background: "rgba(0, 0, 0, 0.5)" + }, + insetIndicatorButton: { + background: "rgba(255, 255, 255, 0.4)", + hoverBackground: "rgba(255, 255, 255, 0.6)", + activeBackground: "rgba(255, 255, 255, 0.9)" + }, + closeButton: { + size: "3rem", + gutter: "0.5rem", + background: "rgba(255, 255, 255, 0.1)", + hoverBackground: "rgba(255, 255, 255, 0.2)", + color: "{surface.50}", + hoverColor: "{surface.0}", + borderRadius: "50%", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + closeButtonIcon: { + size: "1.5rem" + }, + colorScheme: { + light: { + thumbnailNavButton: { + hoverBackground: "{surface.100}", + color: "{surface.600}", + hoverColor: "{surface.700}" + }, + indicatorButton: { + background: "{surface.200}", + hoverBackground: "{surface.300}" + } + }, + dark: { + thumbnailNavButton: { + hoverBackground: "{surface.700}", + color: "{surface.400}", + hoverColor: "{surface.0}" + }, + indicatorButton: { + background: "{surface.700}", + hoverBackground: "{surface.600}" + } + } + } +}; +var index$_ = { + icon: { + color: "{form.field.icon.color}" + } +}; +var index$Z = { + root: { + color: "{form.field.float.label.color}", + focusColor: "{form.field.float.label.focus.color}", + invalidColor: "{form.field.float.label.invalid.color}", + transitionDuration: "0.2s", + positionX: "{form.field.padding.x}", + top: "{form.field.padding.y}", + fontSize: "0.75rem", + fontWeight: "400" + }, + input: { + paddingTop: "1.5rem", + paddingBottom: "{form.field.padding.y}" + } +}; +var index$Y = { + root: { + transitionDuration: "{transition.duration}" + }, + preview: { + icon: { + size: "1.5rem" + }, + mask: { + background: "{mask.background}", + color: "{mask.color}" + } + }, + toolbar: { + position: { + left: "auto", + right: "1rem", + top: "1rem", + bottom: "auto" + }, + blur: "8px", + background: "rgba(255,255,255,0.1)", + borderColor: "rgba(255,255,255,0.2)", + borderWidth: "1px", + borderRadius: "30px", + padding: ".5rem", + gap: "0.5rem" + }, + action: { + hoverBackground: "rgba(255,255,255,0.1)", + color: "{surface.50}", + hoverColor: "{surface.0}", + size: "3rem", + iconSize: "1.5rem", + borderRadius: "50%", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + } +}; +var index$X = { + handle: { + size: "15px", + hoverSize: "30px", + background: "rgba(255,255,255,0.3)", + hoverBackground: "rgba(255,255,255,0.3)", + borderColor: "unset", + hoverBorderColor: "unset", + borderWidth: "0", + borderRadius: "50%", + transitionDuration: "{transition.duration}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "rgba(255,255,255,0.3)", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + } +}; +var index$W = { + root: { + padding: "{form.field.padding.y} {form.field.padding.x}", + borderRadius: "{content.border.radius}", + gap: "0.5rem" + }, + text: { + fontWeight: "500" + }, + icon: { + size: "1rem" + }, + colorScheme: { + light: { + info: { + background: "color-mix(in srgb, {blue.50}, transparent 5%)", + borderColor: "{blue.200}", + color: "{blue.600}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)" + }, + success: { + background: "color-mix(in srgb, {green.50}, transparent 5%)", + borderColor: "{green.200}", + color: "{green.600}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)" + }, + warn: { + background: "color-mix(in srgb,{yellow.50}, transparent 5%)", + borderColor: "{yellow.200}", + color: "{yellow.600}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)" + }, + error: { + background: "color-mix(in srgb, {red.50}, transparent 5%)", + borderColor: "{red.200}", + color: "{red.600}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)" + }, + secondary: { + background: "{surface.100}", + borderColor: "{surface.200}", + color: "{surface.600}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)" + }, + contrast: { + background: "{surface.900}", + borderColor: "{surface.950}", + color: "{surface.50}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)" + } + }, + dark: { + info: { + background: "color-mix(in srgb, {blue.500}, transparent 84%)", + borderColor: "color-mix(in srgb, {blue.700}, transparent 64%)", + color: "{blue.500}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)" + }, + success: { + background: "color-mix(in srgb, {green.500}, transparent 84%)", + borderColor: "color-mix(in srgb, {green.700}, transparent 64%)", + color: "{green.500}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)" + }, + warn: { + background: "color-mix(in srgb, {yellow.500}, transparent 84%)", + borderColor: "color-mix(in srgb, {yellow.700}, transparent 64%)", + color: "{yellow.500}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)" + }, + error: { + background: "color-mix(in srgb, {red.500}, transparent 84%)", + borderColor: "color-mix(in srgb, {red.700}, transparent 64%)", + color: "{red.500}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)" + }, + secondary: { + background: "{surface.800}", + borderColor: "{surface.700}", + color: "{surface.300}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)" + }, + contrast: { + background: "{surface.0}", + borderColor: "{surface.100}", + color: "{surface.950}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)" + } + } + } +}; +var index$V = { + root: { + padding: "{form.field.padding.y} {form.field.padding.x}", + borderRadius: "{content.border.radius}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + }, + transitionDuration: "{transition.duration}" + }, + display: { + hoverBackground: "{content.hover.background}", + hoverColor: "{content.hover.color}" + } +}; +var index$U = { + root: { + background: "{form.field.background}", + disabledBackground: "{form.field.disabled.background}", + filledBackground: "{form.field.filled.background}", + filledFocusBackground: "{form.field.filled.focus.background}", + borderColor: "{form.field.border.color}", + hoverBorderColor: "{form.field.hover.border.color}", + focusBorderColor: "{form.field.focus.border.color}", + invalidBorderColor: "{form.field.invalid.border.color}", + color: "{form.field.color}", + disabledColor: "{form.field.disabled.color}", + placeholderColor: "{form.field.placeholder.color}", + shadow: "{form.field.shadow}", + paddingX: "{form.field.padding.x}", + paddingY: "{form.field.padding.y}", + borderRadius: "{form.field.border.radius}", + focusRing: { + width: "{form.field.focus.ring.width}", + style: "{form.field.focus.ring.style}", + color: "{form.field.focus.ring.color}", + offset: "{form.field.focus.ring.offset}", + shadow: "{form.field.focus.ring.shadow}" + }, + transitionDuration: "{form.field.transition.duration}" + }, + chip: { + borderRadius: "{border.radius.sm}" + }, + colorScheme: { + light: { + chip: { + focusBackground: "{surface.200}", + color: "{surface.800}" + } + }, + dark: { + chip: { + focusBackground: "{surface.700}", + color: "{surface.0}" + } + } + } +}; +var index$T = { + addon: { + background: "{form.field.background}", + borderColor: "{form.field.border.color}", + color: "{form.field.icon.color}", + borderRadius: "{form.field.border.radius}", + padding: "0.5rem", + minWidth: "2.5rem" + } +}; +var index$S = { + root: { + transitionDuration: "{transition.duration}" + }, + button: { + width: "2.5rem", + borderRadius: "{form.field.border.radius}", + verticalPadding: "{form.field.padding.y}" + }, + colorScheme: { + light: { + button: { + background: "transparent", + hoverBackground: "{surface.100}", + activeBackground: "{surface.200}", + borderColor: "{form.field.border.color}", + hoverBorderColor: "{form.field.border.color}", + activeBorderColor: "{form.field.border.color}", + color: "{surface.400}", + hoverColor: "{surface.500}", + activeColor: "{surface.600}" + } + }, + dark: { + button: { + background: "transparent", + hoverBackground: "{surface.800}", + activeBackground: "{surface.700}", + borderColor: "{form.field.border.color}", + hoverBorderColor: "{form.field.border.color}", + activeBorderColor: "{form.field.border.color}", + color: "{surface.400}", + hoverColor: "{surface.300}", + activeColor: "{surface.200}" + } + } + } +}; +var index$R = { + root: { + gap: "0.5rem" + }, + input: { + width: "2.5rem", + sm: { + width: "2rem" + }, + lg: { + width: "3rem" + } + } +}; +var index$Q = { + root: { + background: "{form.field.background}", + disabledBackground: "{form.field.disabled.background}", + filledBackground: "{form.field.filled.background}", + filledHoverBackground: "{form.field.filled.hover.background}", + filledFocusBackground: "{form.field.filled.focus.background}", + borderColor: "{form.field.border.color}", + hoverBorderColor: "{form.field.hover.border.color}", + focusBorderColor: "{form.field.focus.border.color}", + invalidBorderColor: "{form.field.invalid.border.color}", + color: "{form.field.color}", + disabledColor: "{form.field.disabled.color}", + placeholderColor: "{form.field.placeholder.color}", + invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", + shadow: "{form.field.shadow}", + paddingX: "{form.field.padding.x}", + paddingY: "{form.field.padding.y}", + borderRadius: "{form.field.border.radius}", + focusRing: { + width: "{form.field.focus.ring.width}", + style: "{form.field.focus.ring.style}", + color: "{form.field.focus.ring.color}", + offset: "{form.field.focus.ring.offset}", + shadow: "{form.field.focus.ring.shadow}" + }, + transitionDuration: "{form.field.transition.duration}", + sm: { + fontSize: "{form.field.sm.font.size}", + paddingX: "{form.field.sm.padding.x}", + paddingY: "{form.field.sm.padding.y}" + }, + lg: { + fontSize: "{form.field.lg.font.size}", + paddingX: "{form.field.lg.padding.x}", + paddingY: "{form.field.lg.padding.y}" + } + } +}; +var index$P = { + root: { + transitionDuration: "{transition.duration}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + value: { + background: "{primary.color}" + }, + range: { + background: "{content.border.color}" + }, + text: { + color: "{text.muted.color}" + } +}; +var index$O = { + root: { + background: "{form.field.background}", + disabledBackground: "{form.field.disabled.background}", + borderColor: "{form.field.border.color}", + invalidBorderColor: "{form.field.invalid.border.color}", + color: "{form.field.color}", + disabledColor: "{form.field.disabled.color}", + shadow: "{form.field.shadow}", + borderRadius: "{form.field.border.radius}", + transitionDuration: "{form.field.transition.duration}" + }, + list: { + padding: "{list.padding}", + gap: "{list.gap}", + header: { + padding: "{list.header.padding}" + } + }, + option: { + focusBackground: "{list.option.focus.background}", + selectedBackground: "{list.option.selected.background}", + selectedFocusBackground: "{list.option.selected.focus.background}", + color: "{list.option.color}", + focusColor: "{list.option.focus.color}", + selectedColor: "{list.option.selected.color}", + selectedFocusColor: "{list.option.selected.focus.color}", + padding: "{list.option.padding}", + borderRadius: "{list.option.border.radius}" + }, + optionGroup: { + background: "{list.option.group.background}", + color: "{list.option.group.color}", + fontWeight: "{list.option.group.font.weight}", + padding: "{list.option.group.padding}" + }, + checkmark: { + color: "{list.option.color}", + gutterStart: "-0.375rem", + gutterEnd: "0.375rem" + }, + emptyMessage: { + padding: "{list.option.padding}" + }, + colorScheme: { + light: { + option: { + stripedBackground: "{surface.50}" + } + }, + dark: { + option: { + stripedBackground: "{surface.900}" + } + } + } +}; +var index$N = { + root: { + background: "{content.background}", + borderColor: "{content.border.color}", + borderRadius: "{content.border.radius}", + color: "{content.color}", + gap: "0.5rem", + verticalOrientation: { + padding: "{navigation.list.padding}", + gap: "{navigation.list.gap}" + }, + horizontalOrientation: { + padding: "0.5rem 0.75rem", + gap: "0.5rem" + }, + transitionDuration: "{transition.duration}" + }, + baseItem: { + borderRadius: "{content.border.radius}", + padding: "{navigation.item.padding}" + }, + item: { + focusBackground: "{navigation.item.focus.background}", + activeBackground: "{navigation.item.active.background}", + color: "{navigation.item.color}", + focusColor: "{navigation.item.focus.color}", + activeColor: "{navigation.item.active.color}", + padding: "{navigation.item.padding}", + borderRadius: "{navigation.item.border.radius}", + gap: "{navigation.item.gap}", + icon: { + color: "{navigation.item.icon.color}", + focusColor: "{navigation.item.icon.focus.color}", + activeColor: "{navigation.item.icon.active.color}" + } + }, + overlay: { + padding: "0", + background: "{content.background}", + borderColor: "{content.border.color}", + borderRadius: "{content.border.radius}", + color: "{content.color}", + shadow: "{overlay.navigation.shadow}", + gap: "0.5rem" + }, + submenu: { + padding: "{navigation.list.padding}", + gap: "{navigation.list.gap}" + }, + submenuLabel: { + padding: "{navigation.submenu.label.padding}", + fontWeight: "{navigation.submenu.label.font.weight}", + background: "{navigation.submenu.label.background.}", + color: "{navigation.submenu.label.color}" + }, + submenuIcon: { + size: "{navigation.submenu.icon.size}", + color: "{navigation.submenu.icon.color}", + focusColor: "{navigation.submenu.icon.focus.color}", + activeColor: "{navigation.submenu.icon.active.color}" + }, + separator: { + borderColor: "{content.border.color}" + }, + mobileButton: { + borderRadius: "50%", + size: "1.75rem", + color: "{text.muted.color}", + hoverColor: "{text.hover.muted.color}", + hoverBackground: "{content.hover.background}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + } +}; +var index$M = { + root: { + background: "{content.background}", + borderColor: "{content.border.color}", + color: "{content.color}", + borderRadius: "{content.border.radius}", + shadow: "{overlay.navigation.shadow}", + transitionDuration: "{transition.duration}" + }, + list: { + padding: "{navigation.list.padding}", + gap: "{navigation.list.gap}" + }, + item: { + focusBackground: "{navigation.item.focus.background}", + color: "{navigation.item.color}", + focusColor: "{navigation.item.focus.color}", + padding: "{navigation.item.padding}", + borderRadius: "{navigation.item.border.radius}", + gap: "{navigation.item.gap}", + icon: { + color: "{navigation.item.icon.color}", + focusColor: "{navigation.item.icon.focus.color}" + } + }, + submenuLabel: { + padding: "{navigation.submenu.label.padding}", + fontWeight: "{navigation.submenu.label.font.weight}", + background: "{navigation.submenu.label.background}", + color: "{navigation.submenu.label.color}" + }, + separator: { + borderColor: "{content.border.color}" + } +}; +var index$L = { + root: { + background: "{content.background}", + borderColor: "{content.border.color}", + borderRadius: "{content.border.radius}", + color: "{content.color}", + gap: "0.5rem", + padding: "0.5rem 0.75rem", + transitionDuration: "{transition.duration}" + }, + baseItem: { + borderRadius: "{content.border.radius}", + padding: "{navigation.item.padding}" + }, + item: { + focusBackground: "{navigation.item.focus.background}", + activeBackground: "{navigation.item.active.background}", + color: "{navigation.item.color}", + focusColor: "{navigation.item.focus.color}", + activeColor: "{navigation.item.active.color}", + padding: "{navigation.item.padding}", + borderRadius: "{navigation.item.border.radius}", + gap: "{navigation.item.gap}", + icon: { + color: "{navigation.item.icon.color}", + focusColor: "{navigation.item.icon.focus.color}", + activeColor: "{navigation.item.icon.active.color}" + } + }, + submenu: { + padding: "{navigation.list.padding}", + gap: "{navigation.list.gap}", + background: "{content.background}", + borderColor: "{content.border.color}", + borderRadius: "{content.border.radius}", + shadow: "{overlay.navigation.shadow}", + mobileIndent: "1rem", + icon: { + size: "{navigation.submenu.icon.size}", + color: "{navigation.submenu.icon.color}", + focusColor: "{navigation.submenu.icon.focus.color}", + activeColor: "{navigation.submenu.icon.active.color}" + } + }, + separator: { + borderColor: "{content.border.color}" + }, + mobileButton: { + borderRadius: "50%", + size: "1.75rem", + color: "{text.muted.color}", + hoverColor: "{text.hover.muted.color}", + hoverBackground: "{content.hover.background}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + } +}; +var index$K = { + root: { + borderRadius: "{content.border.radius}", + borderWidth: "1px", + transitionDuration: "{transition.duration}" + }, + content: { + padding: "0.5rem 0.75rem", + gap: "0.5rem", + sm: { + padding: "0.375rem 0.625rem" + }, + lg: { + padding: "0.625rem 0.875rem" + } + }, + text: { + fontSize: "1rem", + fontWeight: "500", + sm: { + fontSize: "0.875rem" + }, + lg: { + fontSize: "1.125rem" + } + }, + icon: { + size: "1.125rem", + sm: { + size: "1rem" + }, + lg: { + size: "1.25rem" + } + }, + closeButton: { + width: "1.75rem", + height: "1.75rem", + borderRadius: "50%", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + offset: "{focus.ring.offset}" + } + }, + closeIcon: { + size: "1rem", + sm: { + size: "0.875rem" + }, + lg: { + size: "1.125rem" + } + }, + outlined: { + root: { + borderWidth: "1px" + } + }, + simple: { + content: { + padding: "0" + } + }, + colorScheme: { + light: { + info: { + background: "color-mix(in srgb, {blue.50}, transparent 5%)", + borderColor: "{blue.200}", + color: "{blue.600}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)", + closeButton: { + hoverBackground: "{blue.100}", + focusRing: { + color: "{blue.600}", + shadow: "none" + } + }, + outlined: { + color: "{blue.600}", + borderColor: "{blue.600}" + }, + simple: { + color: "{blue.600}" + } + }, + success: { + background: "color-mix(in srgb, {green.50}, transparent 5%)", + borderColor: "{green.200}", + color: "{green.600}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)", + closeButton: { + hoverBackground: "{green.100}", + focusRing: { + color: "{green.600}", + shadow: "none" + } + }, + outlined: { + color: "{green.600}", + borderColor: "{green.600}" + }, + simple: { + color: "{green.600}" + } + }, + warn: { + background: "color-mix(in srgb,{yellow.50}, transparent 5%)", + borderColor: "{yellow.200}", + color: "{yellow.600}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)", + closeButton: { + hoverBackground: "{yellow.100}", + focusRing: { + color: "{yellow.600}", + shadow: "none" + } + }, + outlined: { + color: "{yellow.600}", + borderColor: "{yellow.600}" + }, + simple: { + color: "{yellow.600}" + } + }, + error: { + background: "color-mix(in srgb, {red.50}, transparent 5%)", + borderColor: "{red.200}", + color: "{red.600}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)", + closeButton: { + hoverBackground: "{red.100}", + focusRing: { + color: "{red.600}", + shadow: "none" + } + }, + outlined: { + color: "{red.600}", + borderColor: "{red.600}" + }, + simple: { + color: "{red.600}" + } + }, + secondary: { + background: "{surface.100}", + borderColor: "{surface.200}", + color: "{surface.600}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)", + closeButton: { + hoverBackground: "{surface.200}", + focusRing: { + color: "{surface.600}", + shadow: "none" + } + }, + outlined: { + color: "{surface.500}", + borderColor: "{surface.500}" + }, + simple: { + color: "{surface.500}" + } + }, + contrast: { + background: "{surface.900}", + borderColor: "{surface.950}", + color: "{surface.50}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)", + closeButton: { + hoverBackground: "{surface.800}", + focusRing: { + color: "{surface.50}", + shadow: "none" + } + }, + outlined: { + color: "{surface.950}", + borderColor: "{surface.950}" + }, + simple: { + color: "{surface.950}" + } + } + }, + dark: { + info: { + background: "color-mix(in srgb, {blue.500}, transparent 84%)", + borderColor: "color-mix(in srgb, {blue.700}, transparent 64%)", + color: "{blue.500}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)", + closeButton: { + hoverBackground: "rgba(255, 255, 255, 0.05)", + focusRing: { + color: "{blue.500}", + shadow: "none" + } + }, + outlined: { + color: "{blue.500}", + borderColor: "{blue.500}" + }, + simple: { + color: "{blue.500}" + } + }, + success: { + background: "color-mix(in srgb, {green.500}, transparent 84%)", + borderColor: "color-mix(in srgb, {green.700}, transparent 64%)", + color: "{green.500}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)", + closeButton: { + hoverBackground: "rgba(255, 255, 255, 0.05)", + focusRing: { + color: "{green.500}", + shadow: "none" + } + }, + outlined: { + color: "{green.500}", + borderColor: "{green.500}" + }, + simple: { + color: "{green.500}" + } + }, + warn: { + background: "color-mix(in srgb, {yellow.500}, transparent 84%)", + borderColor: "color-mix(in srgb, {yellow.700}, transparent 64%)", + color: "{yellow.500}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)", + closeButton: { + hoverBackground: "rgba(255, 255, 255, 0.05)", + focusRing: { + color: "{yellow.500}", + shadow: "none" + } + }, + outlined: { + color: "{yellow.500}", + borderColor: "{yellow.500}" + }, + simple: { + color: "{yellow.500}" + } + }, + error: { + background: "color-mix(in srgb, {red.500}, transparent 84%)", + borderColor: "color-mix(in srgb, {red.700}, transparent 64%)", + color: "{red.500}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)", + closeButton: { + hoverBackground: "rgba(255, 255, 255, 0.05)", + focusRing: { + color: "{red.500}", + shadow: "none" + } + }, + outlined: { + color: "{red.500}", + borderColor: "{red.500}" + }, + simple: { + color: "{red.500}" + } + }, + secondary: { + background: "{surface.800}", + borderColor: "{surface.700}", + color: "{surface.300}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)", + closeButton: { + hoverBackground: "{surface.700}", + focusRing: { + color: "{surface.300}", + shadow: "none" + } + }, + outlined: { + color: "{surface.400}", + borderColor: "{surface.400}" + }, + simple: { + color: "{surface.400}" + } + }, + contrast: { + background: "{surface.0}", + borderColor: "{surface.100}", + color: "{surface.950}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)", + closeButton: { + hoverBackground: "{surface.100}", + focusRing: { + color: "{surface.950}", + shadow: "none" + } + }, + outlined: { + color: "{surface.0}", + borderColor: "{surface.0}" + }, + simple: { + color: "{surface.0}" + } + } + } + } +}; +var index$J = { + root: { + borderRadius: "{content.border.radius}", + gap: "1rem" + }, + meters: { + background: "{content.border.color}", + size: "0.5rem" + }, + label: { + gap: "0.5rem" + }, + labelMarker: { + size: "0.5rem" + }, + labelIcon: { + size: "1rem" + }, + labelList: { + verticalGap: "0.5rem", + horizontalGap: "1rem" + } +}; +var index$I = { + root: { + background: "{form.field.background}", + disabledBackground: "{form.field.disabled.background}", + filledBackground: "{form.field.filled.background}", + filledHoverBackground: "{form.field.filled.hover.background}", + filledFocusBackground: "{form.field.filled.focus.background}", + borderColor: "{form.field.border.color}", + hoverBorderColor: "{form.field.hover.border.color}", + focusBorderColor: "{form.field.focus.border.color}", + invalidBorderColor: "{form.field.invalid.border.color}", + color: "{form.field.color}", + disabledColor: "{form.field.disabled.color}", + placeholderColor: "{form.field.placeholder.color}", + invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", + shadow: "{form.field.shadow}", + paddingX: "{form.field.padding.x}", + paddingY: "{form.field.padding.y}", + borderRadius: "{form.field.border.radius}", + focusRing: { + width: "{form.field.focus.ring.width}", + style: "{form.field.focus.ring.style}", + color: "{form.field.focus.ring.color}", + offset: "{form.field.focus.ring.offset}", + shadow: "{form.field.focus.ring.shadow}" + }, + transitionDuration: "{form.field.transition.duration}", + sm: { + fontSize: "{form.field.sm.font.size}", + paddingX: "{form.field.sm.padding.x}", + paddingY: "{form.field.sm.padding.y}" + }, + lg: { + fontSize: "{form.field.lg.font.size}", + paddingX: "{form.field.lg.padding.x}", + paddingY: "{form.field.lg.padding.y}" + } + }, + dropdown: { + width: "2.5rem", + color: "{form.field.icon.color}" + }, + overlay: { + background: "{overlay.select.background}", + borderColor: "{overlay.select.border.color}", + borderRadius: "{overlay.select.border.radius}", + color: "{overlay.select.color}", + shadow: "{overlay.select.shadow}" + }, + list: { + padding: "{list.padding}", + gap: "{list.gap}", + header: { + padding: "{list.header.padding}" + } + }, + option: { + focusBackground: "{list.option.focus.background}", + selectedBackground: "{list.option.selected.background}", + selectedFocusBackground: "{list.option.selected.focus.background}", + color: "{list.option.color}", + focusColor: "{list.option.focus.color}", + selectedColor: "{list.option.selected.color}", + selectedFocusColor: "{list.option.selected.focus.color}", + padding: "{list.option.padding}", + borderRadius: "{list.option.border.radius}", + gap: "0.5rem" + }, + optionGroup: { + background: "{list.option.group.background}", + color: "{list.option.group.color}", + fontWeight: "{list.option.group.font.weight}", + padding: "{list.option.group.padding}" + }, + clearIcon: { + color: "{form.field.icon.color}" + }, + chip: { + borderRadius: "{border.radius.sm}" + }, + emptyMessage: { + padding: "{list.option.padding}" + } +}; +var index$H = { + root: { + gap: "1.125rem" + }, + controls: { + gap: "0.5rem" + } +}; +var index$G = { + root: { + gutter: "0.75rem", + transitionDuration: "{transition.duration}" + }, + node: { + background: "{content.background}", + hoverBackground: "{content.hover.background}", + selectedBackground: "{highlight.background}", + borderColor: "{content.border.color}", + color: "{content.color}", + selectedColor: "{highlight.color}", + hoverColor: "{content.hover.color}", + padding: "0.75rem 1rem", + toggleablePadding: "0.75rem 1rem 1.25rem 1rem", + borderRadius: "{content.border.radius}" + }, + nodeToggleButton: { + background: "{content.background}", + hoverBackground: "{content.hover.background}", + borderColor: "{content.border.color}", + color: "{text.muted.color}", + hoverColor: "{text.color}", + size: "1.5rem", + borderRadius: "50%", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + connector: { + color: "{content.border.color}", + borderRadius: "{content.border.radius}", + height: "24px" + } +}; +var index$F = { + root: { + outline: { + width: "2px", + color: "{content.background}" + } + } +}; +var index$E = { + root: { + padding: "0.5rem 1rem", + gap: "0.25rem", + borderRadius: "{content.border.radius}", + background: "{content.background}", + color: "{content.color}", + transitionDuration: "{transition.duration}" + }, + navButton: { + background: "transparent", + hoverBackground: "{content.hover.background}", + selectedBackground: "{highlight.background}", + color: "{text.muted.color}", + hoverColor: "{text.hover.muted.color}", + selectedColor: "{highlight.color}", + width: "2.5rem", + height: "2.5rem", + borderRadius: "50%", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + currentPageReport: { + color: "{text.muted.color}" + }, + jumpToPageInput: { + maxWidth: "2.5rem" + } +}; +var index$D = { + root: { + background: "{content.background}", + borderColor: "{content.border.color}", + color: "{content.color}", + borderRadius: "{content.border.radius}" + }, + header: { + background: "transparent", + color: "{text.color}", + padding: "1.125rem", + borderColor: "{content.border.color}", + borderWidth: "0", + borderRadius: "0" + }, + toggleableHeader: { + padding: "0.375rem 1.125rem" + }, + title: { + fontWeight: "600" + }, + content: { + padding: "0 1.125rem 1.125rem 1.125rem" + }, + footer: { + padding: "0 1.125rem 1.125rem 1.125rem" + } +}; +var index$C = { + root: { + gap: "0.5rem", + transitionDuration: "{transition.duration}" + }, + panel: { + background: "{content.background}", + borderColor: "{content.border.color}", + borderWidth: "1px", + color: "{content.color}", + padding: "0.25rem 0.25rem", + borderRadius: "{content.border.radius}", + first: { + borderWidth: "1px", + topBorderRadius: "{content.border.radius}" + }, + last: { + borderWidth: "1px", + bottomBorderRadius: "{content.border.radius}" + } + }, + item: { + focusBackground: "{navigation.item.focus.background}", + color: "{navigation.item.color}", + focusColor: "{navigation.item.focus.color}", + gap: "0.5rem", + padding: "{navigation.item.padding}", + borderRadius: "{content.border.radius}", + icon: { + color: "{navigation.item.icon.color}", + focusColor: "{navigation.item.icon.focus.color}" + } + }, + submenu: { + indent: "1rem" + }, + submenuIcon: { + color: "{navigation.submenu.icon.color}", + focusColor: "{navigation.submenu.icon.focus.color}" + } +}; +var index$B = { + meter: { + background: "{content.border.color}", + borderRadius: "{content.border.radius}", + height: ".75rem" + }, + icon: { + color: "{form.field.icon.color}" + }, + overlay: { + background: "{overlay.popover.background}", + borderColor: "{overlay.popover.border.color}", + borderRadius: "{overlay.popover.border.radius}", + color: "{overlay.popover.color}", + padding: "{overlay.popover.padding}", + shadow: "{overlay.popover.shadow}" + }, + content: { + gap: "0.5rem" + }, + colorScheme: { + light: { + strength: { + weakBackground: "{red.500}", + mediumBackground: "{amber.500}", + strongBackground: "{green.500}" + } + }, + dark: { + strength: { + weakBackground: "{red.400}", + mediumBackground: "{amber.400}", + strongBackground: "{green.400}" + } + } + } +}; +var index$A = { + root: { + gap: "1.125rem" + }, + controls: { + gap: "0.5rem" + } +}; +var index$z = { + root: { + background: "{overlay.popover.background}", + borderColor: "{overlay.popover.border.color}", + color: "{overlay.popover.color}", + borderRadius: "{overlay.popover.border.radius}", + shadow: "{overlay.popover.shadow}", + gutter: "10px", + arrowOffset: "1.25rem" + }, + content: { + padding: "{overlay.popover.padding}" + } +}; +var index$y = { + root: { + background: "{content.border.color}", + borderRadius: "{content.border.radius}", + height: "1.25rem" + }, + value: { + background: "{primary.color}" + }, + label: { + color: "{primary.contrast.color}", + fontSize: "0.75rem", + fontWeight: "600" + } +}; +var index$x = { + colorScheme: { + light: { + root: { + "color.1": "{red.500}", + "color.2": "{blue.500}", + "color.3": "{green.500}", + "color.4": "{yellow.500}" + } + }, + dark: { + root: { + "color.1": "{red.400}", + "color.2": "{blue.400}", + "color.3": "{green.400}", + "color.4": "{yellow.400}" + } + } + } +}; +var index$w = { + root: { + width: "1.25rem", + height: "1.25rem", + background: "{form.field.background}", + checkedBackground: "{primary.color}", + checkedHoverBackground: "{primary.hover.color}", + disabledBackground: "{form.field.disabled.background}", + filledBackground: "{form.field.filled.background}", + borderColor: "{form.field.border.color}", + hoverBorderColor: "{form.field.hover.border.color}", + focusBorderColor: "{form.field.border.color}", + checkedBorderColor: "{primary.color}", + checkedHoverBorderColor: "{primary.hover.color}", + checkedFocusBorderColor: "{primary.color}", + checkedDisabledBorderColor: "{form.field.border.color}", + invalidBorderColor: "{form.field.invalid.border.color}", + shadow: "{form.field.shadow}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + }, + transitionDuration: "{form.field.transition.duration}", + sm: { + width: "1rem", + height: "1rem" + }, + lg: { + width: "1.5rem", + height: "1.5rem" + } + }, + icon: { + size: "0.75rem", + checkedColor: "{primary.contrast.color}", + checkedHoverColor: "{primary.contrast.color}", + disabledColor: "{form.field.disabled.color}", + sm: { + size: "0.5rem" + }, + lg: { + size: "1rem" + } + } +}; +var index$v = { + root: { + gap: "0.25rem", + transitionDuration: "{transition.duration}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + icon: { + size: "1rem", + color: "{text.muted.color}", + hoverColor: "{primary.color}", + activeColor: "{primary.color}" + } +}; +var index$u = { + colorScheme: { + light: { + root: { + background: "rgba(0,0,0,0.1)" + } + }, + dark: { + root: { + background: "rgba(255,255,255,0.3)" + } + } + } +}; +var index$t = { + root: { + transitionDuration: "{transition.duration}" + }, + bar: { + size: "9px", + borderRadius: "{border.radius.sm}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + colorScheme: { + light: { + bar: { + background: "{surface.100}" + } + }, + dark: { + bar: { + background: "{surface.800}" + } + } + } +}; +var index$s = { + root: { + background: "{form.field.background}", + disabledBackground: "{form.field.disabled.background}", + filledBackground: "{form.field.filled.background}", + filledHoverBackground: "{form.field.filled.hover.background}", + filledFocusBackground: "{form.field.filled.focus.background}", + borderColor: "{form.field.border.color}", + hoverBorderColor: "{form.field.hover.border.color}", + focusBorderColor: "{form.field.focus.border.color}", + invalidBorderColor: "{form.field.invalid.border.color}", + color: "{form.field.color}", + disabledColor: "{form.field.disabled.color}", + placeholderColor: "{form.field.placeholder.color}", + invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", + shadow: "{form.field.shadow}", + paddingX: "{form.field.padding.x}", + paddingY: "{form.field.padding.y}", + borderRadius: "{form.field.border.radius}", + focusRing: { + width: "{form.field.focus.ring.width}", + style: "{form.field.focus.ring.style}", + color: "{form.field.focus.ring.color}", + offset: "{form.field.focus.ring.offset}", + shadow: "{form.field.focus.ring.shadow}" + }, + transitionDuration: "{form.field.transition.duration}", + sm: { + fontSize: "{form.field.sm.font.size}", + paddingX: "{form.field.sm.padding.x}", + paddingY: "{form.field.sm.padding.y}" + }, + lg: { + fontSize: "{form.field.lg.font.size}", + paddingX: "{form.field.lg.padding.x}", + paddingY: "{form.field.lg.padding.y}" + } + }, + dropdown: { + width: "2.5rem", + color: "{form.field.icon.color}" + }, + overlay: { + background: "{overlay.select.background}", + borderColor: "{overlay.select.border.color}", + borderRadius: "{overlay.select.border.radius}", + color: "{overlay.select.color}", + shadow: "{overlay.select.shadow}" + }, + list: { + padding: "{list.padding}", + gap: "{list.gap}", + header: { + padding: "{list.header.padding}" + } + }, + option: { + focusBackground: "{list.option.focus.background}", + selectedBackground: "{list.option.selected.background}", + selectedFocusBackground: "{list.option.selected.focus.background}", + color: "{list.option.color}", + focusColor: "{list.option.focus.color}", + selectedColor: "{list.option.selected.color}", + selectedFocusColor: "{list.option.selected.focus.color}", + padding: "{list.option.padding}", + borderRadius: "{list.option.border.radius}" + }, + optionGroup: { + background: "{list.option.group.background}", + color: "{list.option.group.color}", + fontWeight: "{list.option.group.font.weight}", + padding: "{list.option.group.padding}" + }, + clearIcon: { + color: "{form.field.icon.color}" + }, + checkmark: { + color: "{list.option.color}", + gutterStart: "-0.375rem", + gutterEnd: "0.375rem" + }, + emptyMessage: { + padding: "{list.option.padding}" + } +}; +var index$r = { + root: { + borderRadius: "{form.field.border.radius}" + }, + colorScheme: { + light: { + root: { + invalidBorderColor: "{form.field.invalid.border.color}" + } + }, + dark: { + root: { + invalidBorderColor: "{form.field.invalid.border.color}" + } + } + } +}; +var index$q = { + root: { + borderRadius: "{content.border.radius}" + }, + colorScheme: { + light: { + root: { + background: "{surface.200}", + animationBackground: "rgba(255,255,255,0.4)" + } + }, + dark: { + root: { + background: "rgba(255, 255, 255, 0.06)", + animationBackground: "rgba(255, 255, 255, 0.04)" + } + } + } +}; +var index$p = { + root: { + transitionDuration: "{transition.duration}" + }, + track: { + background: "{content.border.color}", + borderRadius: "{content.border.radius}", + size: "3px" + }, + range: { + background: "{primary.color}" + }, + handle: { + width: "20px", + height: "20px", + borderRadius: "50%", + background: "{content.border.color}", + hoverBackground: "{content.border.color}", + content: { + borderRadius: "50%", + hoverBackground: "{content.background}", + width: "16px", + height: "16px", + shadow: "0px 0.5px 0px 0px rgba(0, 0, 0, 0.08), 0px 1px 1px 0px rgba(0, 0, 0, 0.14)" + }, + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + colorScheme: { + light: { + handle: { + contentBackground: "{surface.0}" + } + }, + dark: { + handle: { + contentBackground: "{surface.950}" + } + } + } +}; +var index$o = { + root: { + gap: "0.5rem", + transitionDuration: "{transition.duration}" + } +}; +var index$n = { + root: { + borderRadius: "{form.field.border.radius}", + roundedBorderRadius: "2rem", + raisedShadow: "0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)" + } +}; +var index$m = { + root: { + background: "{content.background}", + borderColor: "{content.border.color}", + color: "{content.color}", + transitionDuration: "{transition.duration}" + }, + gutter: { + background: "{content.border.color}" + }, + handle: { + size: "24px", + background: "transparent", + borderRadius: "{content.border.radius}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + } +}; +var index$l = { + root: { + transitionDuration: "{transition.duration}" + }, + separator: { + background: "{content.border.color}", + activeBackground: "{primary.color}", + margin: "0 0 0 1.625rem", + size: "2px" + }, + step: { + padding: "0.5rem", + gap: "1rem" + }, + stepHeader: { + padding: "0", + borderRadius: "{content.border.radius}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + }, + gap: "0.5rem" + }, + stepTitle: { + color: "{text.muted.color}", + activeColor: "{primary.color}", + fontWeight: "500" + }, + stepNumber: { + background: "{content.background}", + activeBackground: "{content.background}", + borderColor: "{content.border.color}", + activeBorderColor: "{content.border.color}", + color: "{text.muted.color}", + activeColor: "{primary.color}", + size: "2rem", + fontSize: "1.143rem", + fontWeight: "500", + borderRadius: "50%", + shadow: "0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12)" + }, + steppanels: { + padding: "0.875rem 0.5rem 1.125rem 0.5rem" + }, + steppanel: { + background: "{content.background}", + color: "{content.color}", + padding: "0", + indent: "1rem" + } +}; +var index$k = { + root: { + transitionDuration: "{transition.duration}" + }, + separator: { + background: "{content.border.color}" + }, + itemLink: { + borderRadius: "{content.border.radius}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + }, + gap: "0.5rem" + }, + itemLabel: { + color: "{text.muted.color}", + activeColor: "{primary.color}", + fontWeight: "500" + }, + itemNumber: { + background: "{content.background}", + activeBackground: "{content.background}", + borderColor: "{content.border.color}", + activeBorderColor: "{content.border.color}", + color: "{text.muted.color}", + activeColor: "{primary.color}", + size: "2rem", + fontSize: "1.143rem", + fontWeight: "500", + borderRadius: "50%", + shadow: "0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12)" + } +}; +var index$j = { + root: { + transitionDuration: "{transition.duration}" + }, + tablist: { + borderWidth: "0 0 1px 0", + background: "{content.background}", + borderColor: "{content.border.color}" + }, + item: { + background: "transparent", + hoverBackground: "transparent", + activeBackground: "transparent", + borderWidth: "0 0 1px 0", + borderColor: "{content.border.color}", + hoverBorderColor: "{content.border.color}", + activeBorderColor: "{primary.color}", + color: "{text.muted.color}", + hoverColor: "{text.color}", + activeColor: "{primary.color}", + padding: "1rem 1.125rem", + fontWeight: "600", + margin: "0 0 -1px 0", + gap: "0.5rem", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + itemIcon: { + color: "{text.muted.color}", + hoverColor: "{text.color}", + activeColor: "{primary.color}" + }, + activeBar: { + height: "1px", + bottom: "-1px", + background: "{primary.color}" + } +}; +var index$i = { + root: { + transitionDuration: "{transition.duration}" + }, + tablist: { + borderWidth: "0 0 1px 0", + background: "{content.background}", + borderColor: "{content.border.color}" + }, + tab: { + background: "transparent", + hoverBackground: "transparent", + activeBackground: "transparent", + borderWidth: "0 0 1px 0", + borderColor: "{content.border.color}", + hoverBorderColor: "{content.border.color}", + activeBorderColor: "{primary.color}", + color: "{text.muted.color}", + hoverColor: "{text.color}", + activeColor: "{primary.color}", + padding: "1rem 1.125rem", + fontWeight: "600", + margin: "0 0 -1px 0", + gap: "0.5rem", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "-1px", + shadow: "{focus.ring.shadow}" + } + }, + tabpanel: { + background: "{content.background}", + color: "{content.color}", + padding: "0.875rem 1.125rem 1.125rem 1.125rem", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "inset {focus.ring.shadow}" + } + }, + navButton: { + background: "{content.background}", + color: "{text.muted.color}", + hoverColor: "{text.color}", + width: "2.5rem", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "-1px", + shadow: "{focus.ring.shadow}" + } + }, + activeBar: { + height: "1px", + bottom: "-1px", + background: "{primary.color}" + }, + colorScheme: { + light: { + navButton: { + shadow: "0px 0px 10px 50px rgba(255, 255, 255, 0.6)" + } + }, + dark: { + navButton: { + shadow: "0px 0px 10px 50px color-mix(in srgb, {content.background}, transparent 50%)" + } + } + } +}; +var index$h = { + root: { + transitionDuration: "{transition.duration}" + }, + tabList: { + background: "{content.background}", + borderColor: "{content.border.color}" + }, + tab: { + borderColor: "{content.border.color}", + activeBorderColor: "{primary.color}", + color: "{text.muted.color}", + hoverColor: "{text.color}", + activeColor: "{primary.color}" + }, + tabPanel: { + background: "{content.background}", + color: "{content.color}" + }, + navButton: { + background: "{content.background}", + color: "{text.muted.color}", + hoverColor: "{text.color}" + }, + colorScheme: { + light: { + navButton: { + shadow: "0px 0px 10px 50px rgba(255, 255, 255, 0.6)" + } + }, + dark: { + navButton: { + shadow: "0px 0px 10px 50px color-mix(in srgb, {content.background}, transparent 50%)" + } + } + } +}; +var index$g = { + root: { + fontSize: "0.875rem", + fontWeight: "700", + padding: "0.25rem 0.5rem", + gap: "0.25rem", + borderRadius: "{content.border.radius}", + roundedBorderRadius: "{border.radius.xl}" + }, + icon: { + size: "0.75rem" + }, + colorScheme: { + light: { + primary: { + background: "{primary.100}", + color: "{primary.700}" + }, + secondary: { + background: "{surface.100}", + color: "{surface.600}" + }, + success: { + background: "{green.100}", + color: "{green.700}" + }, + info: { + background: "{sky.100}", + color: "{sky.700}" + }, + warn: { + background: "{orange.100}", + color: "{orange.700}" + }, + danger: { + background: "{red.100}", + color: "{red.700}" + }, + contrast: { + background: "{surface.950}", + color: "{surface.0}" + } + }, + dark: { + primary: { + background: "color-mix(in srgb, {primary.500}, transparent 84%)", + color: "{primary.300}" + }, + secondary: { + background: "{surface.800}", + color: "{surface.300}" + }, + success: { + background: "color-mix(in srgb, {green.500}, transparent 84%)", + color: "{green.300}" + }, + info: { + background: "color-mix(in srgb, {sky.500}, transparent 84%)", + color: "{sky.300}" + }, + warn: { + background: "color-mix(in srgb, {orange.500}, transparent 84%)", + color: "{orange.300}" + }, + danger: { + background: "color-mix(in srgb, {red.500}, transparent 84%)", + color: "{red.300}" + }, + contrast: { + background: "{surface.0}", + color: "{surface.950}" + } + } + } +}; +var index$f = { + root: { + background: "{form.field.background}", + borderColor: "{form.field.border.color}", + color: "{form.field.color}", + height: "18rem", + padding: "{form.field.padding.y} {form.field.padding.x}", + borderRadius: "{form.field.border.radius}" + }, + prompt: { + gap: "0.25rem" + }, + commandResponse: { + margin: "2px 0" + } +}; +var index$e = { + root: { + background: "{form.field.background}", + disabledBackground: "{form.field.disabled.background}", + filledBackground: "{form.field.filled.background}", + filledFocusBackground: "{form.field.filled.focus.background}", + borderColor: "{form.field.border.color}", + hoverBorderColor: "{form.field.hover.border.color}", + focusBorderColor: "{form.field.focus.border.color}", + invalidBorderColor: "{form.field.invalid.border.color}", + color: "{form.field.color}", + disabledColor: "{form.field.disabled.color}", + placeholderColor: "{form.field.placeholder.color}", + invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", + shadow: "{form.field.shadow}", + paddingX: "{form.field.padding.x}", + paddingY: "{form.field.padding.y}", + borderRadius: "{form.field.border.radius}", + focusRing: { + width: "{form.field.focus.ring.width}", + style: "{form.field.focus.ring.style}", + color: "{form.field.focus.ring.color}", + offset: "{form.field.focus.ring.offset}", + shadow: "{form.field.focus.ring.shadow}" + }, + transitionDuration: "{form.field.transition.duration}", + sm: { + fontSize: "{form.field.sm.font.size}", + paddingX: "{form.field.sm.padding.x}", + paddingY: "{form.field.sm.padding.y}" + }, + lg: { + fontSize: "{form.field.lg.font.size}", + paddingX: "{form.field.lg.padding.x}", + paddingY: "{form.field.lg.padding.y}" + } + } +}; +var index$d = { + root: { + background: "{content.background}", + borderColor: "{content.border.color}", + color: "{content.color}", + borderRadius: "{content.border.radius}", + shadow: "{overlay.navigation.shadow}", + transitionDuration: "{transition.duration}" + }, + list: { + padding: "{navigation.list.padding}", + gap: "{navigation.list.gap}" + }, + item: { + focusBackground: "{navigation.item.focus.background}", + activeBackground: "{navigation.item.active.background}", + color: "{navigation.item.color}", + focusColor: "{navigation.item.focus.color}", + activeColor: "{navigation.item.active.color}", + padding: "{navigation.item.padding}", + borderRadius: "{navigation.item.border.radius}", + gap: "{navigation.item.gap}", + icon: { + color: "{navigation.item.icon.color}", + focusColor: "{navigation.item.icon.focus.color}", + activeColor: "{navigation.item.icon.active.color}" + } + }, + submenu: { + mobileIndent: "1rem" + }, + submenuIcon: { + size: "{navigation.submenu.icon.size}", + color: "{navigation.submenu.icon.color}", + focusColor: "{navigation.submenu.icon.focus.color}", + activeColor: "{navigation.submenu.icon.active.color}" + }, + separator: { + borderColor: "{content.border.color}" + } +}; +var index$c = { + event: { + minHeight: "5rem" + }, + horizontal: { + eventContent: { + padding: "1rem 0" + } + }, + vertical: { + eventContent: { + padding: "0 1rem" + } + }, + eventMarker: { + size: "1.125rem", + borderRadius: "50%", + borderWidth: "2px", + background: "{content.background}", + borderColor: "{content.border.color}", + content: { + borderRadius: "50%", + size: "0.375rem", + background: "{primary.color}", + insetShadow: "0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12)" + } + }, + eventConnector: { + color: "{content.border.color}", + size: "2px" + } +}; +var index$b = { + root: { + width: "25rem", + borderRadius: "{content.border.radius}", + borderWidth: "1px", + transitionDuration: "{transition.duration}" + }, + icon: { + size: "1.125rem" + }, + content: { + padding: "{overlay.popover.padding}", + gap: "0.5rem" + }, + text: { + gap: "0.5rem" + }, + summary: { + fontWeight: "500", + fontSize: "1rem" + }, + detail: { + fontWeight: "500", + fontSize: "0.875rem" + }, + closeButton: { + width: "1.75rem", + height: "1.75rem", + borderRadius: "50%", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + offset: "{focus.ring.offset}" + } + }, + closeIcon: { + size: "1rem" + }, + colorScheme: { + light: { + blur: "1.5px", + info: { + background: "color-mix(in srgb, {blue.50}, transparent 5%)", + borderColor: "{blue.200}", + color: "{blue.600}", + detailColor: "{surface.700}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)", + closeButton: { + hoverBackground: "{blue.100}", + focusRing: { + color: "{blue.600}", + shadow: "none" + } + } + }, + success: { + background: "color-mix(in srgb, {green.50}, transparent 5%)", + borderColor: "{green.200}", + color: "{green.600}", + detailColor: "{surface.700}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)", + closeButton: { + hoverBackground: "{green.100}", + focusRing: { + color: "{green.600}", + shadow: "none" + } + } + }, + warn: { + background: "color-mix(in srgb,{yellow.50}, transparent 5%)", + borderColor: "{yellow.200}", + color: "{yellow.600}", + detailColor: "{surface.700}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)", + closeButton: { + hoverBackground: "{yellow.100}", + focusRing: { + color: "{yellow.600}", + shadow: "none" + } + } + }, + error: { + background: "color-mix(in srgb, {red.50}, transparent 5%)", + borderColor: "{red.200}", + color: "{red.600}", + detailColor: "{surface.700}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)", + closeButton: { + hoverBackground: "{red.100}", + focusRing: { + color: "{red.600}", + shadow: "none" + } + } + }, + secondary: { + background: "{surface.100}", + borderColor: "{surface.200}", + color: "{surface.600}", + detailColor: "{surface.700}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)", + closeButton: { + hoverBackground: "{surface.200}", + focusRing: { + color: "{surface.600}", + shadow: "none" + } + } + }, + contrast: { + background: "{surface.900}", + borderColor: "{surface.950}", + color: "{surface.50}", + detailColor: "{surface.0}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)", + closeButton: { + hoverBackground: "{surface.800}", + focusRing: { + color: "{surface.50}", + shadow: "none" + } + } + } + }, + dark: { + blur: "10px", + info: { + background: "color-mix(in srgb, {blue.500}, transparent 84%)", + borderColor: "color-mix(in srgb, {blue.700}, transparent 64%)", + color: "{blue.500}", + detailColor: "{surface.0}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)", + closeButton: { + hoverBackground: "rgba(255, 255, 255, 0.05)", + focusRing: { + color: "{blue.500}", + shadow: "none" + } + } + }, + success: { + background: "color-mix(in srgb, {green.500}, transparent 84%)", + borderColor: "color-mix(in srgb, {green.700}, transparent 64%)", + color: "{green.500}", + detailColor: "{surface.0}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)", + closeButton: { + hoverBackground: "rgba(255, 255, 255, 0.05)", + focusRing: { + color: "{green.500}", + shadow: "none" + } + } + }, + warn: { + background: "color-mix(in srgb, {yellow.500}, transparent 84%)", + borderColor: "color-mix(in srgb, {yellow.700}, transparent 64%)", + color: "{yellow.500}", + detailColor: "{surface.0}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)", + closeButton: { + hoverBackground: "rgba(255, 255, 255, 0.05)", + focusRing: { + color: "{yellow.500}", + shadow: "none" + } + } + }, + error: { + background: "color-mix(in srgb, {red.500}, transparent 84%)", + borderColor: "color-mix(in srgb, {red.700}, transparent 64%)", + color: "{red.500}", + detailColor: "{surface.0}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)", + closeButton: { + hoverBackground: "rgba(255, 255, 255, 0.05)", + focusRing: { + color: "{red.500}", + shadow: "none" + } + } + }, + secondary: { + background: "{surface.800}", + borderColor: "{surface.700}", + color: "{surface.300}", + detailColor: "{surface.0}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)", + closeButton: { + hoverBackground: "{surface.700}", + focusRing: { + color: "{surface.300}", + shadow: "none" + } + } + }, + contrast: { + background: "{surface.0}", + borderColor: "{surface.100}", + color: "{surface.950}", + detailColor: "{surface.950}", + shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)", + closeButton: { + hoverBackground: "{surface.100}", + focusRing: { + color: "{surface.950}", + shadow: "none" + } + } + } + } + } +}; +var index$a = { + root: { + padding: "0.5rem 1rem", + borderRadius: "{content.border.radius}", + gap: "0.5rem", + fontWeight: "500", + disabledBackground: "{form.field.disabled.background}", + disabledBorderColor: "{form.field.disabled.background}", + disabledColor: "{form.field.disabled.color}", + invalidBorderColor: "{form.field.invalid.border.color}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + }, + transitionDuration: "{form.field.transition.duration}", + sm: { + fontSize: "{form.field.sm.font.size}", + padding: "0.375rem 0.75rem" + }, + lg: { + fontSize: "{form.field.lg.font.size}", + padding: "0.625rem 1.25rem" + } + }, + icon: { + disabledColor: "{form.field.disabled.color}" + }, + content: { + left: "0.25rem", + top: "0.25rem", + checkedShadow: "0px 1px 2px 0px rgba(0, 0, 0, 0.02), 0px 1px 2px 0px rgba(0, 0, 0, 0.04)" + }, + colorScheme: { + light: { + root: { + background: "{surface.100}", + checkedBackground: "{surface.100}", + hoverBackground: "{surface.100}", + borderColor: "{surface.100}", + color: "{surface.500}", + hoverColor: "{surface.700}", + checkedColor: "{surface.900}", + checkedBorderColor: "{surface.100}" + }, + content: { + checkedBackground: "{surface.0}" + }, + icon: { + color: "{surface.500}", + hoverColor: "{surface.700}", + checkedColor: "{surface.900}" + } + }, + dark: { + root: { + background: "{surface.950}", + checkedBackground: "{surface.950}", + hoverBackground: "{surface.950}", + borderColor: "{surface.950}", + color: "{surface.400}", + hoverColor: "{surface.300}", + checkedColor: "{surface.0}", + checkedBorderColor: "{surface.950}" + }, + content: { + checkedBackground: "{surface.800}" + }, + icon: { + color: "{surface.400}", + hoverColor: "{surface.300}", + checkedColor: "{surface.0}" + } + } + } +}; +var index$9 = { + root: { + width: "2.5rem", + height: "1.5rem", + borderRadius: "30px", + gap: "0.25rem", + shadow: "{form.field.shadow}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + }, + borderWidth: "1px", + borderColor: "transparent", + hoverBorderColor: "transparent", + checkedBorderColor: "transparent", + checkedHoverBorderColor: "transparent", + invalidBorderColor: "{form.field.invalid.border.color}", + transitionDuration: "{form.field.transition.duration}", + slideDuration: "0.2s" + }, + handle: { + borderRadius: "50%", + size: "1rem" + }, + colorScheme: { + light: { + root: { + background: "{surface.300}", + disabledBackground: "{form.field.disabled.background}", + hoverBackground: "{surface.400}", + checkedBackground: "{primary.color}", + checkedHoverBackground: "{primary.hover.color}" + }, + handle: { + background: "{surface.0}", + disabledBackground: "{form.field.disabled.color}", + hoverBackground: "{surface.0}", + checkedBackground: "{surface.0}", + checkedHoverBackground: "{surface.0}", + color: "{text.muted.color}", + hoverColor: "{text.color}", + checkedColor: "{primary.color}", + checkedHoverColor: "{primary.hover.color}" + } + }, + dark: { + root: { + background: "{surface.700}", + disabledBackground: "{surface.600}", + hoverBackground: "{surface.600}", + checkedBackground: "{primary.color}", + checkedHoverBackground: "{primary.hover.color}" + }, + handle: { + background: "{surface.400}", + disabledBackground: "{surface.900}", + hoverBackground: "{surface.300}", + checkedBackground: "{surface.900}", + checkedHoverBackground: "{surface.900}", + color: "{surface.900}", + hoverColor: "{surface.800}", + checkedColor: "{primary.color}", + checkedHoverColor: "{primary.hover.color}" + } + } + } +}; +var index$8 = { + root: { + background: "{content.background}", + borderColor: "{content.border.color}", + borderRadius: "{content.border.radius}", + color: "{content.color}", + gap: "0.5rem", + padding: "0.75rem" + } +}; +var index$7 = { + root: { + maxWidth: "12.5rem", + gutter: "0.25rem", + shadow: "{overlay.popover.shadow}", + padding: "0.5rem 0.75rem", + borderRadius: "{overlay.popover.border.radius}" + }, + colorScheme: { + light: { + root: { + background: "{surface.700}", + color: "{surface.0}" + } + }, + dark: { + root: { + background: "{surface.700}", + color: "{surface.0}" + } + } + } +}; +var index$6 = { + root: { + background: "{content.background}", + color: "{content.color}", + padding: "1rem", + gap: "2px", + indent: "1rem", + transitionDuration: "{transition.duration}" + }, + node: { + padding: "0.25rem 0.5rem", + borderRadius: "{content.border.radius}", + hoverBackground: "{content.hover.background}", + selectedBackground: "{highlight.background}", + color: "{text.color}", + hoverColor: "{text.hover.color}", + selectedColor: "{highlight.color}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "-1px", + shadow: "{focus.ring.shadow}" + }, + gap: "0.25rem" + }, + nodeIcon: { + color: "{text.muted.color}", + hoverColor: "{text.hover.muted.color}", + selectedColor: "{highlight.color}" + }, + nodeToggleButton: { + borderRadius: "50%", + size: "1.75rem", + hoverBackground: "{content.hover.background}", + selectedHoverBackground: "{content.background}", + color: "{text.muted.color}", + hoverColor: "{text.hover.muted.color}", + selectedHoverColor: "{primary.color}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + loadingIcon: { + size: "2rem" + }, + filter: { + margin: "0 0 0.5rem 0" + } +}; +var index$5 = { + root: { + background: "{form.field.background}", + disabledBackground: "{form.field.disabled.background}", + filledBackground: "{form.field.filled.background}", + filledHoverBackground: "{form.field.filled.hover.background}", + filledFocusBackground: "{form.field.filled.focus.background}", + borderColor: "{form.field.border.color}", + hoverBorderColor: "{form.field.hover.border.color}", + focusBorderColor: "{form.field.focus.border.color}", + invalidBorderColor: "{form.field.invalid.border.color}", + color: "{form.field.color}", + disabledColor: "{form.field.disabled.color}", + placeholderColor: "{form.field.placeholder.color}", + invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", + shadow: "{form.field.shadow}", + paddingX: "{form.field.padding.x}", + paddingY: "{form.field.padding.y}", + borderRadius: "{form.field.border.radius}", + focusRing: { + width: "{form.field.focus.ring.width}", + style: "{form.field.focus.ring.style}", + color: "{form.field.focus.ring.color}", + offset: "{form.field.focus.ring.offset}", + shadow: "{form.field.focus.ring.shadow}" + }, + transitionDuration: "{form.field.transition.duration}", + sm: { + fontSize: "{form.field.sm.font.size}", + paddingX: "{form.field.sm.padding.x}", + paddingY: "{form.field.sm.padding.y}" + }, + lg: { + fontSize: "{form.field.lg.font.size}", + paddingX: "{form.field.lg.padding.x}", + paddingY: "{form.field.lg.padding.y}" + } + }, + dropdown: { + width: "2.5rem", + color: "{form.field.icon.color}" + }, + overlay: { + background: "{overlay.select.background}", + borderColor: "{overlay.select.border.color}", + borderRadius: "{overlay.select.border.radius}", + color: "{overlay.select.color}", + shadow: "{overlay.select.shadow}" + }, + tree: { + padding: "{list.padding}" + }, + clearIcon: { + color: "{form.field.icon.color}" + }, + emptyMessage: { + padding: "{list.option.padding}" + }, + chip: { + borderRadius: "{border.radius.sm}" + } +}; +var index$4 = { + root: { + transitionDuration: "{transition.duration}" + }, + header: { + background: "{content.background}", + borderColor: "{treetable.border.color}", + color: "{content.color}", + borderWidth: "0 0 1px 0", + padding: "0.75rem 1rem" + }, + headerCell: { + background: "{content.background}", + hoverBackground: "{content.hover.background}", + selectedBackground: "{highlight.background}", + borderColor: "{treetable.border.color}", + color: "{content.color}", + hoverColor: "{content.hover.color}", + selectedColor: "{highlight.color}", + gap: "0.5rem", + padding: "0.75rem 1rem", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "-1px", + shadow: "{focus.ring.shadow}" + } + }, + columnTitle: { + fontWeight: "600" + }, + row: { + background: "{content.background}", + hoverBackground: "{content.hover.background}", + selectedBackground: "{highlight.background}", + color: "{content.color}", + hoverColor: "{content.hover.color}", + selectedColor: "{highlight.color}", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "-1px", + shadow: "{focus.ring.shadow}" + } + }, + bodyCell: { + borderColor: "{treetable.border.color}", + padding: "0.75rem 1rem", + gap: "0.5rem" + }, + footerCell: { + background: "{content.background}", + borderColor: "{treetable.border.color}", + color: "{content.color}", + padding: "0.75rem 1rem" + }, + columnFooter: { + fontWeight: "600" + }, + footer: { + background: "{content.background}", + borderColor: "{treetable.border.color}", + color: "{content.color}", + borderWidth: "0 0 1px 0", + padding: "0.75rem 1rem" + }, + columnResizerWidth: "0.5rem", + resizeIndicator: { + width: "1px", + color: "{primary.color}" + }, + sortIcon: { + color: "{text.muted.color}", + hoverColor: "{text.hover.muted.color}", + size: "0.875rem" + }, + loadingIcon: { + size: "2rem" + }, + nodeToggleButton: { + hoverBackground: "{content.hover.background}", + selectedHoverBackground: "{content.background}", + color: "{text.muted.color}", + hoverColor: "{text.color}", + selectedHoverColor: "{primary.color}", + size: "1.75rem", + borderRadius: "50%", + focusRing: { + width: "{focus.ring.width}", + style: "{focus.ring.style}", + color: "{focus.ring.color}", + offset: "{focus.ring.offset}", + shadow: "{focus.ring.shadow}" + } + }, + paginatorTop: { + borderColor: "{content.border.color}", + borderWidth: "0 0 1px 0" + }, + paginatorBottom: { + borderColor: "{content.border.color}", + borderWidth: "0 0 1px 0" + }, + colorScheme: { + light: { + root: { + borderColor: "{content.border.color}" + }, + bodyCell: { + selectedBorderColor: "{primary.100}" + } + }, + dark: { + root: { + borderColor: "{surface.800}" + }, + bodyCell: { + selectedBorderColor: "{primary.900}" + } + } + } +}; +var index$3 = { + loader: { + mask: { + background: "{content.background}", + color: "{text.muted.color}" + }, + icon: { + size: "2rem" + } + } +}; +function _typeof$t(o2) { + "@babel/helpers - typeof"; + return _typeof$t = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$t(o2); +} +__name(_typeof$t, "_typeof$t"); +function ownKeys$r(e2, r2) { + var t2 = Object.keys(e2); + if (Object.getOwnPropertySymbols) { + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); + } + return t2; +} +__name(ownKeys$r, "ownKeys$r"); +function _objectSpread$r(e2) { + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$r(Object(t2), true).forEach(function(r3) { + _defineProperty$v(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$r(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); + }); + } + return e2; +} +__name(_objectSpread$r, "_objectSpread$r"); +function _defineProperty$v(e2, r2, t2) { + return (r2 = _toPropertyKey$s(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; +} +__name(_defineProperty$v, "_defineProperty$v"); +function _toPropertyKey$s(t2) { + var i2 = _toPrimitive$s(t2, "string"); + return "symbol" == _typeof$t(i2) ? i2 : i2 + ""; +} +__name(_toPropertyKey$s, "_toPropertyKey$s"); +function _toPrimitive$s(t2, r2) { + if ("object" != _typeof$t(t2) || !t2) return t2; + var e2 = t2[Symbol.toPrimitive]; + if (void 0 !== e2) { + var i2 = e2.call(t2, r2 || "default"); + if ("object" != _typeof$t(i2)) return i2; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r2 ? String : Number)(t2); +} +__name(_toPrimitive$s, "_toPrimitive$s"); +var index$2 = _objectSpread$r(_objectSpread$r({}, index$1n), {}, { components: { - accordion: index$1n, - autocomplete: index$1m, - avatar: index$1l, - badge: index$1k, - blockui: index$1j, - breadcrumb: index$1i, - button: index$1h, - datepicker: index$15, - card: index$1g, - carousel: index$1f, - cascadeselect: index$1e, - checkbox: index$1d, - chip: index$1c, - colorpicker: index$1b, - confirmdialog: index$1a, - confirmpopup: index$19, - contextmenu: index$18, - dataview: index$16, - datatable: index$17, - dialog: index$14, - divider: index$13, - dock: index$12, - drawer: index$11, - editor: index$10, - fieldset: index$$, - fileupload: index$_, - floatlabel: index$Z, - galleria: index$Y, - iconfield: index$X, - image: index$W, - inlinemessage: index$V, - inplace: index$U, - inputchips: index$T, - inputgroup: index$S, - inputnumber: index$R, + accordion: index$1r, + autocomplete: index$1q, + avatar: index$1p, + badge: index$1o, + blockui: index$1m, + breadcrumb: index$1l, + button: index$1k, + datepicker: index$18, + card: index$1j, + carousel: index$1i, + cascadeselect: index$1h, + checkbox: index$1g, + chip: index$1f, + colorpicker: index$1e, + confirmdialog: index$1d, + confirmpopup: index$1c, + contextmenu: index$1b, + dataview: index$19, + datatable: index$1a, + dialog: index$17, + divider: index$16, + dock: index$15, + drawer: index$14, + editor: index$13, + fieldset: index$12, + fileupload: index$11, + iftalabel: index$Z, + floatlabel: index$10, + galleria: index$$, + iconfield: index$_, + image: index$Y, + imagecompare: index$X, + inlinemessage: index$W, + inplace: index$V, + inputchips: index$U, + inputgroup: index$T, + inputnumber: index$S, + inputotp: index$R, inputtext: index$Q, knob: index$P, listbox: index$O, @@ -5972,7 +6540,7 @@ var index$2 = { tooltip: index$7, ripple: index$u } -}; +}); const DEBUG_BUILD$6 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; const SDK_VERSION = "8.48.0"; const GLOBAL_OBJ = globalThis; @@ -6144,9 +6712,9 @@ function getFramesFromEvent(event) { __name(getFramesFromEvent, "getFramesFromEvent"); const handlers$4 = {}; const instrumented$1 = {}; -function addHandler$1(type, handler6) { +function addHandler$1(type, handler12) { handlers$4[type] = handlers$4[type] || []; - handlers$4[type].push(handler6); + handlers$4[type].push(handler12); } __name(addHandler$1, "addHandler$1"); function resetInstrumentationHandlers() { @@ -6166,19 +6734,19 @@ function maybeInstrument(type, instrumentFn) { } } __name(maybeInstrument, "maybeInstrument"); -function triggerHandlers$1(type, data25) { +function triggerHandlers$1(type, data26) { const typeHandlers = type && handlers$4[type]; if (!typeHandlers) { return; } - for (const handler6 of typeHandlers) { + for (const handler12 of typeHandlers) { try { - handler6(data25); + handler12(data26); } catch (e2) { DEBUG_BUILD$5 && logger$2.error( `Error while triggering instrumentation handler. Type: ${type} -Name: ${getFunctionName(handler6)} +Name: ${getFunctionName(handler12)} Error:`, e2 ); @@ -6187,9 +6755,9 @@ Error:`, } __name(triggerHandlers$1, "triggerHandlers$1"); let _oldOnErrorHandler = null; -function addGlobalErrorInstrumentationHandler(handler6) { +function addGlobalErrorInstrumentationHandler(handler12) { const type = "error"; - addHandler$1(type, handler6); + addHandler$1(type, handler12); maybeInstrument(type, instrumentError); } __name(addGlobalErrorInstrumentationHandler, "addGlobalErrorInstrumentationHandler"); @@ -6213,9 +6781,9 @@ function instrumentError() { } __name(instrumentError, "instrumentError"); let _oldOnUnhandledRejectionHandler = null; -function addGlobalUnhandledRejectionInstrumentationHandler(handler6) { +function addGlobalUnhandledRejectionInstrumentationHandler(handler12) { const type = "unhandledrejection"; - addHandler$1(type, handler6); + addHandler$1(type, handler12); maybeInstrument(type, instrumentUnhandledRejection); } __name(addGlobalUnhandledRejectionInstrumentationHandler, "addGlobalUnhandledRejectionInstrumentationHandler"); @@ -6272,10 +6840,10 @@ function isDOMException(wat) { return isBuiltin(wat, "DOMException"); } __name(isDOMException, "isDOMException"); -function isString$8(wat) { +function isString$a(wat) { return isBuiltin(wat, "String"); } -__name(isString$8, "isString$8"); +__name(isString$a, "isString$a"); function isParameterizedString(wat) { return typeof wat === "object" && wat !== null && "__sentry_template_string__" in wat && "__sentry_template_values__" in wat; } @@ -6379,7 +6947,7 @@ function _htmlElementAsString(el, keyAttrs) { out.push(`#${elem.id}`); } const className = elem.className; - if (className && isString$8(className)) { + if (className && isString$a(className)) { const classes2 = className.split(/\s+/); for (const c2 of classes2) { out.push(`.${c2}`); @@ -6492,13 +7060,13 @@ function safeJoin(input, delimiter2) { } __name(safeJoin, "safeJoin"); function isMatchingPattern(value4, pattern, requireExactStringMatch = false) { - if (!isString$8(value4)) { + if (!isString$a(value4)) { return false; } if (isRegExp$5(pattern)) { return pattern.test(value4); } - if (isString$8(pattern)) { + if (isString$a(pattern)) { return requireExactStringMatch ? value4 === pattern : value4.includes(pattern); } return false; @@ -6578,9 +7146,9 @@ function convertToPlainObject(value4) { } } __name(convertToPlainObject, "convertToPlainObject"); -function serializeEventTarget(target) { +function serializeEventTarget(target2) { try { - return isElement$3(target) ? htmlTreeAsString(target) : Object.prototype.toString.call(target); + return isElement$3(target2) ? htmlTreeAsString(target2) : Object.prototype.toString.call(target2); } catch (_oO) { return ""; } @@ -6996,17 +7564,17 @@ class SyncPromise { } const cachedHandlers = this._handlers.slice(); this._handlers = []; - cachedHandlers.forEach((handler6) => { - if (handler6[0]) { + cachedHandlers.forEach((handler12) => { + if (handler12[0]) { return; } if (this._state === States.RESOLVED) { - handler6[1](this._value); + handler12[1](this._value); } if (this._state === States.REJECTED) { - handler6[2](this._value); + handler12[2](this._value); } - handler6[0] = true; + handler12[0] = true; }); }; } @@ -7132,7 +7700,7 @@ function generateSpanId() { return uuid4().substring(16); } __name(generateSpanId, "generateSpanId"); -function merge$1(initialObj, mergeObj, levels = 2) { +function merge$2(initialObj, mergeObj, levels = 2) { if (!mergeObj || typeof mergeObj !== "object" || levels <= 0) { return mergeObj; } @@ -7142,12 +7710,12 @@ function merge$1(initialObj, mergeObj, levels = 2) { const output = { ...initialObj }; for (const key in mergeObj) { if (Object.prototype.hasOwnProperty.call(mergeObj, key)) { - output[key] = merge$1(output[key], mergeObj[key], levels - 1); + output[key] = merge$2(output[key], mergeObj[key], levels - 1); } } return output; } -__name(merge$1, "merge$1"); +__name(merge$2, "merge$2"); const SCOPE_SPAN_FIELD = "_sentrySpan"; function _setSpanForScope(scope, span) { if (span) { @@ -7526,7 +8094,7 @@ class ScopeClass { * @inheritDoc */ setSDKProcessingMetadata(newData) { - this._sdkProcessingMetadata = merge$1(this._sdkProcessingMetadata, newData, 2); + this._sdkProcessingMetadata = merge$2(this._sdkProcessingMetadata, newData, 2); return this; } /** @@ -7973,7 +8541,7 @@ function dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext) { } __name(dynamicSamplingContextToSentryBaggageHeader, "dynamicSamplingContextToSentryBaggageHeader"); function parseBaggageHeader(baggageHeader) { - if (!baggageHeader || !isString$8(baggageHeader) && !Array.isArray(baggageHeader)) { + if (!baggageHeader || !isString$a(baggageHeader) && !Array.isArray(baggageHeader)) { return void 0; } if (Array.isArray(baggageHeader)) { @@ -8071,12 +8639,12 @@ const TRACE_FLAG_SAMPLED = 1; let hasShownSpanDropWarning = false; function spanToTransactionTraceContext(span) { const { spanId: span_id, traceId: trace_id } = span.spanContext(); - const { data: data25, op, parent_span_id, status, origin: origin2 } = spanToJSON(span); + const { data: data26, op, parent_span_id, status, origin: origin2 } = spanToJSON(span); return dropUndefinedKeys({ parent_span_id, span_id, trace_id, - data: data25, + data: data26, op, status, origin: origin2 @@ -9694,7 +10262,7 @@ function startIdleSpan(startSpanOptions, options4 = {}) { const previousActiveSpan = getActiveSpan(); const span = _startIdleSpan(startSpanOptions); span.end = new Proxy(span.end, { - apply(target, thisArg, args) { + apply(target2, thisArg, args) { if (beforeSpanEnd) { beforeSpanEnd(span); } @@ -9704,7 +10272,7 @@ function startIdleSpan(startSpanOptions, options4 = {}) { const spans = getSpanDescendants(span).filter((child) => child !== span); if (!spans.length) { onIdleSpanEnded(spanEndTimestamp); - return Reflect.apply(target, thisArg, [spanEndTimestamp, ...rest]); + return Reflect.apply(target2, thisArg, [spanEndTimestamp, ...rest]); } const childEndTimestamps = spans.map((span2) => spanToJSON(span2).timestamp).filter((timestamp3) => !!timestamp3); const latestSpanEndTimestamp = childEndTimestamps.length ? Math.max(...childEndTimestamps) : void 0; @@ -9714,7 +10282,7 @@ function startIdleSpan(startSpanOptions, options4 = {}) { Math.max(spanStartTimestamp || -Infinity, Math.min(spanEndTimestamp, latestSpanEndTimestamp || Infinity)) ); onIdleSpanEnded(endTimestamp); - return Reflect.apply(target, thisArg, [endTimestamp, ...rest]); + return Reflect.apply(target2, thisArg, [endTimestamp, ...rest]); } }); function _cancelIdleTimeout() { @@ -9929,9 +10497,9 @@ function getDebugImagesForResources(stackParser, resource_paths) { return images; } __name(getDebugImagesForResources, "getDebugImagesForResources"); -function applyScopeDataToEvent(event, data25) { - const { fingerprint, span, breadcrumbs, sdkProcessingMetadata } = data25; - applyDataToEvent(event, data25); +function applyScopeDataToEvent(event, data26) { + const { fingerprint, span, breadcrumbs, sdkProcessingMetadata } = data26; + applyDataToEvent(event, data26); if (span) { applySpanToEvent(event, span); } @@ -9940,7 +10508,7 @@ function applyScopeDataToEvent(event, data25) { applySdkMetadataToEvent(event, sdkProcessingMetadata); } __name(applyScopeDataToEvent, "applyScopeDataToEvent"); -function mergeScopeData(data25, mergeData) { +function mergeScopeData(data26, mergeData) { const { extra, tags, @@ -9956,41 +10524,41 @@ function mergeScopeData(data25, mergeData) { transactionName, span } = mergeData; - mergeAndOverwriteScopeData(data25, "extra", extra); - mergeAndOverwriteScopeData(data25, "tags", tags); - mergeAndOverwriteScopeData(data25, "user", user); - mergeAndOverwriteScopeData(data25, "contexts", contexts); - data25.sdkProcessingMetadata = merge$1(data25.sdkProcessingMetadata, sdkProcessingMetadata, 2); + mergeAndOverwriteScopeData(data26, "extra", extra); + mergeAndOverwriteScopeData(data26, "tags", tags); + mergeAndOverwriteScopeData(data26, "user", user); + mergeAndOverwriteScopeData(data26, "contexts", contexts); + data26.sdkProcessingMetadata = merge$2(data26.sdkProcessingMetadata, sdkProcessingMetadata, 2); if (level) { - data25.level = level; + data26.level = level; } if (transactionName) { - data25.transactionName = transactionName; + data26.transactionName = transactionName; } if (span) { - data25.span = span; + data26.span = span; } if (breadcrumbs.length) { - data25.breadcrumbs = [...data25.breadcrumbs, ...breadcrumbs]; + data26.breadcrumbs = [...data26.breadcrumbs, ...breadcrumbs]; } if (fingerprint.length) { - data25.fingerprint = [...data25.fingerprint, ...fingerprint]; + data26.fingerprint = [...data26.fingerprint, ...fingerprint]; } if (eventProcessors.length) { - data25.eventProcessors = [...data25.eventProcessors, ...eventProcessors]; + data26.eventProcessors = [...data26.eventProcessors, ...eventProcessors]; } if (attachments.length) { - data25.attachments = [...data25.attachments, ...attachments]; + data26.attachments = [...data26.attachments, ...attachments]; } - data25.propagationContext = { ...data25.propagationContext, ...propagationContext }; + data26.propagationContext = { ...data26.propagationContext, ...propagationContext }; } __name(mergeScopeData, "mergeScopeData"); -function mergeAndOverwriteScopeData(data25, prop2, mergeVal) { - data25[prop2] = merge$1(data25[prop2], mergeVal, 1); +function mergeAndOverwriteScopeData(data26, prop2, mergeVal) { + data26[prop2] = merge$2(data26[prop2], mergeVal, 1); } __name(mergeAndOverwriteScopeData, "mergeAndOverwriteScopeData"); -function applyDataToEvent(event, data25) { - const { extra, tags, user, contexts, level, transactionName } = data25; +function applyDataToEvent(event, data26) { + const { extra, tags, user, contexts, level, transactionName } = data26; const cleanedExtra = dropUndefinedKeys(extra); if (cleanedExtra && Object.keys(cleanedExtra).length) { event.extra = { ...cleanedExtra, ...event.extra }; @@ -10074,24 +10642,24 @@ function prepareEvent(options4, event, hint, scope, client, isolationScope) { addExceptionMechanism(prepared, hint.mechanism); } const clientEventProcessors = client ? client.getEventProcessors() : []; - const data25 = getGlobalScope().getScopeData(); + const data26 = getGlobalScope().getScopeData(); if (isolationScope) { const isolationData = isolationScope.getScopeData(); - mergeScopeData(data25, isolationData); + mergeScopeData(data26, isolationData); } if (finalScope) { const finalScopeData = finalScope.getScopeData(); - mergeScopeData(data25, finalScopeData); + mergeScopeData(data26, finalScopeData); } - const attachments = [...hint.attachments || [], ...data25.attachments]; + const attachments = [...hint.attachments || [], ...data26.attachments]; if (attachments.length) { hint.attachments = attachments; } - applyScopeDataToEvent(prepared, data25); + applyScopeDataToEvent(prepared, data26); const eventProcessors = [ ...clientEventProcessors, // Run scope event processors _after_ all other processors - ...data25.eventProcessors + ...data26.eventProcessors ]; const result = notifyEventProcessors(eventProcessors, prepared, hint); return result.then((evt) => { @@ -10444,7 +11012,7 @@ class SessionFlusher { __name(this, "SessionFlusher"); } // We adjust the type here to add the `unref()` part, as setInterval can technically return a number or a NodeJS.Timer - constructor(client, attrs4) { + constructor(client, attrs6) { this._client = client; this.flushTimeout = 60; this._pendingAggregates = /* @__PURE__ */ new Map(); @@ -10453,7 +11021,7 @@ class SessionFlusher { if (this._intervalId.unref) { this._intervalId.unref(); } - this._sessionAttrs = attrs4; + this._sessionAttrs = attrs6; } /** Checks if `pendingAggregates` has entries, and if it does flushes them by calling `sendSession` */ flush() { @@ -12747,7 +13315,7 @@ function extractRequestData(req, options4 = {}) { } const body = req.body; if (body !== void 0) { - const stringBody = isString$8(body) ? body : isPlainObject$5(body) ? JSON.stringify(normalize$2(body)) : truncate(`${body}`, 1024); + const stringBody = isString$a(body) ? body : isPlainObject$5(body) ? JSON.stringify(normalize$2(body)) : truncate(`${body}`, 1024); if (stringBody) { requestData.data = stringBody; } @@ -12898,7 +13466,7 @@ function httpRequestToRequestData(request) { const protocol = request.socket && request.socket.encrypted ? "https" : "http"; const originalUrl = request.url || ""; const absoluteUrl = originalUrl.startsWith(protocol) ? originalUrl : `${protocol}://${host}${originalUrl}`; - const data25 = request.body || void 0; + const data26 = request.body || void 0; const cookies2 = request.cookies; return dropUndefinedKeys({ url: absoluteUrl, @@ -12906,7 +13474,7 @@ function httpRequestToRequestData(request) { query_string: extractQueryParamsFromUrl(originalUrl), headers: headersToDict(headers), cookies: cookies2, - data: data25 + data: data26 }); } __name(httpRequestToRequestData, "httpRequestToRequestData"); @@ -13043,9 +13611,9 @@ function convertReqDataIntegrationOptsToAddReqDataOpts(integrationOptions) { }; } __name(convertReqDataIntegrationOptsToAddReqDataOpts, "convertReqDataIntegrationOptsToAddReqDataOpts"); -function addConsoleInstrumentationHandler(handler6) { +function addConsoleInstrumentationHandler(handler12) { const type = "console"; - addHandler$1(type, handler6); + addHandler$1(type, handler12); maybeInstrument(type, instrumentConsole); } __name(addConsoleInstrumentationHandler, "addConsoleInstrumentationHandler"); @@ -13381,7 +13949,7 @@ function splitPath(filename) { return parts2 ? parts2.slice(1) : []; } __name(splitPath, "splitPath"); -function resolve$1(...args) { +function resolve$3(...args) { let resolvedPath = ""; let resolvedAbsolute = false; for (let i2 = args.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) { @@ -13398,7 +13966,7 @@ function resolve$1(...args) { ).join("/"); return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; } -__name(resolve$1, "resolve$1"); +__name(resolve$3, "resolve$3"); function trim$1(arr) { let start2 = 0; for (; start2 < arr.length; start2++) { @@ -13419,8 +13987,8 @@ function trim$1(arr) { } __name(trim$1, "trim$1"); function relative(from2, to) { - from2 = resolve$1(from2).slice(1); - to = resolve$1(to).slice(1); + from2 = resolve$3(from2).slice(1); + to = resolve$3(to).slice(1); const fromParts = trim$1(from2.split("/")); const toParts = trim$1(to.split("/")); const length = Math.min(fromParts.length, toParts.length); @@ -13465,15 +14033,15 @@ function join$3(...args) { __name(join$3, "join$3"); function dirname(path) { const result = splitPath(path); - const root27 = result[0] || ""; + const root29 = result[0] || ""; let dir = result[1]; - if (!root27 && !dir) { + if (!root29 && !dir) { return "."; } if (dir) { dir = dir.slice(0, dir.length - 1); } - return root27 + dir; + return root29 + dir; } __name(dirname, "dirname"); function basename(path, ext) { @@ -13486,10 +14054,10 @@ function basename(path, ext) { __name(basename, "basename"); const INTEGRATION_NAME$d = "RewriteFrames"; const rewriteFramesIntegration = defineIntegration((options4 = {}) => { - const root27 = options4.root; + const root29 = options4.root; const prefix2 = options4.prefix || "app:///"; const isBrowser2 = "window" in GLOBAL_OBJ && GLOBAL_OBJ.window !== void 0; - const iteratee = options4.iteratee || generateIteratee({ isBrowser: isBrowser2, root: root27, prefix: prefix2 }); + const iteratee = options4.iteratee || generateIteratee({ isBrowser: isBrowser2, root: root29, prefix: prefix2 }); function _processExceptionsEvent(event) { try { return { @@ -13529,7 +14097,7 @@ const rewriteFramesIntegration = defineIntegration((options4 = {}) => { }); function generateIteratee({ isBrowser: isBrowser2, - root: root27, + root: root29, prefix: prefix2 }) { return (frame) => { @@ -13540,16 +14108,16 @@ function generateIteratee({ frame.filename.includes("\\") && !frame.filename.includes("/"); const startsWithSlash = /^\//.test(frame.filename); if (isBrowser2) { - if (root27) { + if (root29) { const oldFilename = frame.filename; - if (oldFilename.indexOf(root27) === 0) { - frame.filename = oldFilename.replace(root27, prefix2); + if (oldFilename.indexOf(root29) === 0) { + frame.filename = oldFilename.replace(root29, prefix2); } } } else { if (isWindowsFrame || startsWithSlash) { const filename = isWindowsFrame ? frame.filename.replace(/^[a-zA-Z]:/, "").replace(/\\/g, "/") : frame.filename; - const base2 = root27 ? relative(root27, filename) : basename(filename); + const base2 = root29 ? relative(root29, filename) : basename(filename); frame.filename = `${prefix2}${base2}`; } } @@ -13718,15 +14286,15 @@ function getMetricsAggregatorForClient$1(client, Aggregator) { return newAggregator; } __name(getMetricsAggregatorForClient$1, "getMetricsAggregatorForClient$1"); -function addToMetricsAggregator(Aggregator, metricType, name2, value4, data25 = {}) { - const client = data25.client || getClient(); +function addToMetricsAggregator(Aggregator, metricType, name2, value4, data26 = {}) { + const client = data26.client || getClient(); if (!client) { return; } const span = getActiveSpan(); const rootSpan = span ? getRootSpan(span) : void 0; const transactionName = rootSpan && spanToJSON(rootSpan).description; - const { unit, tags, timestamp: timestamp2 } = data25; + const { unit, tags, timestamp: timestamp2 } = data26; const { release, environment } = client.getOptions(); const metricTags = {}; if (release) { @@ -13743,15 +14311,15 @@ function addToMetricsAggregator(Aggregator, metricType, name2, value4, data25 = aggregator.add(metricType, name2, value4, unit, { ...metricTags, ...tags }, timestamp2); } __name(addToMetricsAggregator, "addToMetricsAggregator"); -function increment$2(aggregator, name2, value4 = 1, data25) { - addToMetricsAggregator(aggregator, COUNTER_METRIC_TYPE, name2, ensureNumber(value4), data25); +function increment$2(aggregator, name2, value4 = 1, data26) { + addToMetricsAggregator(aggregator, COUNTER_METRIC_TYPE, name2, ensureNumber(value4), data26); } __name(increment$2, "increment$2"); -function distribution$2(aggregator, name2, value4, data25) { - addToMetricsAggregator(aggregator, DISTRIBUTION_METRIC_TYPE, name2, ensureNumber(value4), data25); +function distribution$2(aggregator, name2, value4, data26) { + addToMetricsAggregator(aggregator, DISTRIBUTION_METRIC_TYPE, name2, ensureNumber(value4), data26); } __name(distribution$2, "distribution$2"); -function timing$2(aggregator, name2, value4, unit = "second", data25) { +function timing$2(aggregator, name2, value4, unit = "second", data26) { if (typeof value4 === "function") { const startTime = timestampInSeconds(); return startSpanManual( @@ -13769,28 +14337,28 @@ function timing$2(aggregator, name2, value4, unit = "second", data25) { () => { const endTime = timestampInSeconds(); const timeDiff = endTime - startTime; - distribution$2(aggregator, name2, timeDiff, { ...data25, unit: "second" }); + distribution$2(aggregator, name2, timeDiff, { ...data26, unit: "second" }); span.end(endTime); } ); } ); } - distribution$2(aggregator, name2, value4, { ...data25, unit }); + distribution$2(aggregator, name2, value4, { ...data26, unit }); } __name(timing$2, "timing$2"); -function set$7(aggregator, name2, value4, data25) { - addToMetricsAggregator(aggregator, SET_METRIC_TYPE, name2, value4, data25); +function set$6(aggregator, name2, value4, data26) { + addToMetricsAggregator(aggregator, SET_METRIC_TYPE, name2, value4, data26); } -__name(set$7, "set$7"); -function gauge$2(aggregator, name2, value4, data25) { - addToMetricsAggregator(aggregator, GAUGE_METRIC_TYPE, name2, ensureNumber(value4), data25); +__name(set$6, "set$6"); +function gauge$2(aggregator, name2, value4, data26) { + addToMetricsAggregator(aggregator, GAUGE_METRIC_TYPE, name2, ensureNumber(value4), data26); } __name(gauge$2, "gauge$2"); const metrics$1 = { increment: increment$2, distribution: distribution$2, - set: set$7, + set: set$6, gauge: gauge$2, timing: timing$2, /** @@ -14169,24 +14737,24 @@ class MetricsAggregator { } } } -function increment$1(name2, value4 = 1, data25) { - metrics$1.increment(MetricsAggregator, name2, value4, data25); +function increment$1(name2, value4 = 1, data26) { + metrics$1.increment(MetricsAggregator, name2, value4, data26); } __name(increment$1, "increment$1"); -function distribution$1(name2, value4, data25) { - metrics$1.distribution(MetricsAggregator, name2, value4, data25); +function distribution$1(name2, value4, data26) { + metrics$1.distribution(MetricsAggregator, name2, value4, data26); } __name(distribution$1, "distribution$1"); -function set$6(name2, value4, data25) { - metrics$1.set(MetricsAggregator, name2, value4, data25); +function set$5(name2, value4, data26) { + metrics$1.set(MetricsAggregator, name2, value4, data26); } -__name(set$6, "set$6"); -function gauge$1(name2, value4, data25) { - metrics$1.gauge(MetricsAggregator, name2, value4, data25); +__name(set$5, "set$5"); +function gauge$1(name2, value4, data26) { + metrics$1.gauge(MetricsAggregator, name2, value4, data26); } __name(gauge$1, "gauge$1"); -function timing$1(name2, value4, unit = "second", data25) { - return metrics$1.timing(MetricsAggregator, name2, value4, unit, data25); +function timing$1(name2, value4, unit = "second", data26) { + return metrics$1.timing(MetricsAggregator, name2, value4, unit, data26); } __name(timing$1, "timing$1"); function getMetricsAggregatorForClient(client) { @@ -14196,7 +14764,7 @@ __name(getMetricsAggregatorForClient, "getMetricsAggregatorForClient"); const metricsDefault = { increment: increment$1, distribution: distribution$1, - set: set$6, + set: set$5, gauge: gauge$1, timing: timing$1, /** @@ -14676,15 +15244,15 @@ function supportsReferrerPolicy() { } } __name(supportsReferrerPolicy, "supportsReferrerPolicy"); -function addFetchInstrumentationHandler(handler6, skipNativeFetchCheck) { +function addFetchInstrumentationHandler(handler12, skipNativeFetchCheck) { const type = "fetch"; - addHandler$1(type, handler6); + addHandler$1(type, handler12); maybeInstrument(type, () => instrumentFetch(void 0, skipNativeFetchCheck)); } __name(addFetchInstrumentationHandler, "addFetchInstrumentationHandler"); -function addFetchEndInstrumentationHandler(handler6) { +function addFetchEndInstrumentationHandler(handler12) { const type = "fetch-body-resolved"; - addHandler$1(type, handler6); + addHandler$1(type, handler12); maybeInstrument(type, () => instrumentFetch(streamHandler)); } __name(addFetchEndInstrumentationHandler, "addFetchEndInstrumentationHandler"); @@ -14957,12 +15525,12 @@ function _parseIntOrUndefined(input) { return parseInt(input || "", 10) || void 0; } __name(_parseIntOrUndefined, "_parseIntOrUndefined"); -function makeFifoCache(size2) { +function makeFifoCache(size) { let evictionOrder = []; let cache2 = {}; return { add(key, value4) { - while (evictionOrder.length >= size2) { + while (evictionOrder.length >= size) { const evictCandidate = evictionOrder.shift(); if (evictCandidate !== void 0) { delete cache2[evictCandidate]; @@ -16043,19 +16611,19 @@ function addPerformanceInstrumentationHandler(type, callback) { return getCleanupCallback(type, callback); } __name(addPerformanceInstrumentationHandler, "addPerformanceInstrumentationHandler"); -function triggerHandlers(type, data25) { +function triggerHandlers(type, data26) { const typeHandlers = handlers$3[type]; if (!typeHandlers || !typeHandlers.length) { return; } - for (const handler6 of typeHandlers) { + for (const handler12 of typeHandlers) { try { - handler6(data25); + handler12(data26); } catch (e2) { DEBUG_BUILD$3 && logger$2.error( `Error while triggering instrumentation handler. Type: ${type} -Name: ${getFunctionName(handler6)} +Name: ${getFunctionName(handler12)} Error:`, e2 ); @@ -16145,9 +16713,9 @@ function instrumentPerformanceObserver(type) { ); } __name(instrumentPerformanceObserver, "instrumentPerformanceObserver"); -function addHandler(type, handler6) { +function addHandler(type, handler12) { handlers$3[type] = handlers$3[type] || []; - handlers$3[type].push(handler6); + handlers$3[type].push(handler12); } __name(addHandler, "addHandler"); function getCleanupCallback(type, callback, stopListening) { @@ -16753,9 +17321,9 @@ const DEBOUNCE_DURATION = 1e3; let debounceTimerID; let lastCapturedEventType; let lastCapturedEventTargetId; -function addClickKeypressInstrumentationHandler(handler6) { +function addClickKeypressInstrumentationHandler(handler12) { const type = "dom"; - addHandler$1(type, handler6); + addHandler$1(type, handler12); maybeInstrument(type, instrumentDOM); } __name(addClickKeypressInstrumentationHandler, "addClickKeypressInstrumentationHandler"); @@ -16767,9 +17335,9 @@ function instrumentDOM() { const globalDOMEventHandler = makeDOMEventHandler(triggerDOMHandler, true); WINDOW$4.document.addEventListener("click", globalDOMEventHandler, false); WINDOW$4.document.addEventListener("keypress", globalDOMEventHandler, false); - ["EventTarget", "Node"].forEach((target) => { + ["EventTarget", "Node"].forEach((target2) => { const globalObject = WINDOW$4; - const targetObj = globalObject[target]; + const targetObj = globalObject[target2]; const proto = targetObj && targetObj.prototype; if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty("addEventListener")) { return; @@ -16781,9 +17349,9 @@ function instrumentDOM() { const handlers2 = this.__sentry_instrumentation_handlers__ = this.__sentry_instrumentation_handlers__ || {}; const handlerForType = handlers2[type] = handlers2[type] || { refCount: 0 }; if (!handlerForType.handler) { - const handler6 = makeDOMEventHandler(triggerDOMHandler); - handlerForType.handler = handler6; - originalAddEventListener.call(this, type, handler6, options4); + const handler12 = makeDOMEventHandler(triggerDOMHandler); + handlerForType.handler = handler12; + originalAddEventListener.call(this, type, handler12, options4); } handlerForType.refCount++; } catch (e2) { @@ -16835,38 +17403,38 @@ function isSimilarToLastCapturedEvent(event) { return true; } __name(isSimilarToLastCapturedEvent, "isSimilarToLastCapturedEvent"); -function shouldSkipDOMEvent(eventType, target) { +function shouldSkipDOMEvent(eventType, target2) { if (eventType !== "keypress") { return false; } - if (!target || !target.tagName) { + if (!target2 || !target2.tagName) { return true; } - if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) { + if (target2.tagName === "INPUT" || target2.tagName === "TEXTAREA" || target2.isContentEditable) { return false; } return true; } __name(shouldSkipDOMEvent, "shouldSkipDOMEvent"); -function makeDOMEventHandler(handler6, globalListener = false) { +function makeDOMEventHandler(handler12, globalListener = false) { return (event) => { if (!event || event["_sentryCaptured"]) { return; } - const target = getEventTarget$1(event); - if (shouldSkipDOMEvent(event.type, target)) { + const target2 = getEventTarget$1(event); + if (shouldSkipDOMEvent(event.type, target2)) { return; } addNonEnumerableProperty(event, "_sentryCaptured", true); - if (target && !target._sentryId) { - addNonEnumerableProperty(target, "_sentryId", uuid4()); + if (target2 && !target2._sentryId) { + addNonEnumerableProperty(target2, "_sentryId", uuid4()); } const name2 = event.type === "keypress" ? "input" : event.type; if (!isSimilarToLastCapturedEvent(event)) { const handlerData = { event, name: name2, global: globalListener }; - handler6(handlerData); + handler12(handlerData); lastCapturedEventType = event.type; - lastCapturedEventTargetId = target ? target._sentryId : void 0; + lastCapturedEventTargetId = target2 ? target2._sentryId : void 0; } clearTimeout(debounceTimerID); debounceTimerID = WINDOW$4.setTimeout(() => { @@ -16885,9 +17453,9 @@ function getEventTarget$1(event) { } __name(getEventTarget$1, "getEventTarget$1"); let lastHref; -function addHistoryInstrumentationHandler(handler6) { +function addHistoryInstrumentationHandler(handler12) { const type = "history"; - addHandler$1(type, handler6); + addHandler$1(type, handler12); maybeInstrument(type, instrumentHistory); } __name(addHistoryInstrumentationHandler, "addHistoryInstrumentationHandler"); @@ -16971,9 +17539,9 @@ function setTimeout$3(...rest) { } __name(setTimeout$3, "setTimeout$3"); const SENTRY_XHR_DATA_KEY = "__sentry_xhr_v3__"; -function addXhrInstrumentationHandler(handler6) { +function addXhrInstrumentationHandler(handler12) { const type = "xhr"; - addHandler$1(type, handler6); + addHandler$1(type, handler12); maybeInstrument(type, instrumentXHR); } __name(addXhrInstrumentationHandler, "addXhrInstrumentationHandler"); @@ -16986,7 +17554,7 @@ function instrumentXHR() { apply(originalOpen, xhrOpenThisArg, xhrOpenArgArray) { const virtualError = new Error(); const startTimestamp = timestampInSeconds() * 1e3; - const method = isString$8(xhrOpenArgArray[0]) ? xhrOpenArgArray[0].toUpperCase() : void 0; + const method = isString$a(xhrOpenArgArray[0]) ? xhrOpenArgArray[0].toUpperCase() : void 0; const url = parseUrl(xhrOpenArgArray[1]); if (!method || !url) { return originalOpen.apply(xhrOpenThisArg, xhrOpenArgArray); @@ -17032,7 +17600,7 @@ function instrumentXHR() { apply(originalSetRequestHeader, setRequestHeaderThisArg, setRequestHeaderArgArray) { const [header3, value4] = setRequestHeaderArgArray; const xhrInfo = setRequestHeaderThisArg[SENTRY_XHR_DATA_KEY]; - if (xhrInfo && isString$8(header3) && isString$8(value4)) { + if (xhrInfo && isString$a(header3) && isString$a(value4)) { xhrInfo.request_headers[header3.toLowerCase()] = value4; } return originalSetRequestHeader.apply(setRequestHeaderThisArg, setRequestHeaderArgArray); @@ -17061,7 +17629,7 @@ function instrumentXHR() { } __name(instrumentXHR, "instrumentXHR"); function parseUrl(url) { - if (isString$8(url)) { + if (isString$a(url)) { return url; } try { @@ -17391,7 +17959,7 @@ function _getDomBreadcrumbHandler(client, dom) { if (getClient() !== client) { return; } - let target; + let target2; let componentName; let keyAttrs = typeof dom === "object" ? dom.serializeAttribute : void 0; let maxStringLength = typeof dom === "object" && typeof dom.maxStringLength === "number" ? dom.maxStringLength : void 0; @@ -17407,17 +17975,17 @@ function _getDomBreadcrumbHandler(client, dom) { try { const event = handlerData.event; const element = _isEvent(event) ? event.target : event; - target = htmlTreeAsString(element, { keyAttrs, maxStringLength }); + target2 = htmlTreeAsString(element, { keyAttrs, maxStringLength }); componentName = getComponentName$1(element); } catch (e2) { - target = ""; + target2 = ""; } - if (target.length === 0) { + if (target2.length === 0) { return; } const breadcrumb = { category: `ui.${handlerData.name}`, - message: target + message: target2 }; if (componentName) { breadcrumb.data = { "ui.component_name": componentName }; @@ -17470,7 +18038,7 @@ function _getXhrBreadcrumbHandler(client) { return; } const { method, url, status_code, body } = sentryXhrData; - const data25 = { + const data26 = { method, url, status_code @@ -17485,7 +18053,7 @@ function _getXhrBreadcrumbHandler(client) { addBreadcrumb( { category: "xhr", - data: data25, + data: data26, type: "http", level }, @@ -17507,7 +18075,7 @@ function _getFetchBreadcrumbHandler(client) { return; } if (handlerData.error) { - const data25 = handlerData.fetchData; + const data26 = handlerData.fetchData; const hint = { data: handlerData.error, input: handlerData.args, @@ -17517,7 +18085,7 @@ function _getFetchBreadcrumbHandler(client) { addBreadcrumb( { category: "fetch", - data: data25, + data: data26, level: "error", type: "http" }, @@ -17525,7 +18093,7 @@ function _getFetchBreadcrumbHandler(client) { ); } else { const response = handlerData.response; - const data25 = { + const data26 = { ...handlerData.fetchData, status_code: response && response.status }; @@ -17535,11 +18103,11 @@ function _getFetchBreadcrumbHandler(client) { startTimestamp, endTimestamp }; - const level = getBreadcrumbLogLevelFromHttpStatusCode(data25.status_code); + const level = getBreadcrumbLogLevelFromHttpStatusCode(data26.status_code); addBreadcrumb( { category: "fetch", - data: data25, + data: data26, type: "http", level }, @@ -17711,9 +18279,9 @@ function _wrapXHR$1(originalSend) { }; } __name(_wrapXHR$1, "_wrapXHR$1"); -function _wrapEventTarget(target) { +function _wrapEventTarget(target2) { const globalObject = WINDOW$5; - const targetObj = globalObject[target]; + const targetObj = globalObject[target2]; const proto = targetObj && targetObj.prototype; if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty("addEventListener")) { return; @@ -17727,7 +18295,7 @@ function _wrapEventTarget(target) { data: { function: "handleEvent", handler: getFunctionName(fn), - target + target: target2 }, handled: false, type: "instrument" @@ -17743,7 +18311,7 @@ function _wrapEventTarget(target) { data: { function: "addEventListener", handler: getFunctionName(fn), - target + target: target2 }, handled: false, type: "instrument" @@ -17816,12 +18384,12 @@ const _globalHandlersIntegration = /* @__PURE__ */ __name((options4 = {}) => { }, "_globalHandlersIntegration"); const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration); function _installGlobalOnErrorHandler(client) { - addGlobalErrorInstrumentationHandler((data25) => { + addGlobalErrorInstrumentationHandler((data26) => { const { stackParser, attachStacktrace } = getOptions(); if (getClient() !== client || shouldIgnoreOnError()) { return; } - const { msg, url, line, column, error: error2 } = data25; + const { msg, url, line, column, error: error2 } = data26; const event = _enhanceEventWithInitialFrame( eventFromUnknownInput(stackParser, error2 || msg, void 0, attachStacktrace, false), url, @@ -17896,7 +18464,7 @@ function _enhanceEventWithInitialFrame(event, url, line, column) { const ev0sf = ev0s.frames = ev0s.frames || []; const colno = column; const lineno = line; - const filename = isString$8(url) && url.length > 0 ? url : getLocationHref(); + const filename = isString$a(url) && url.length > 0 ? url : getLocationHref(); if (ev0sf.length === 0) { ev0sf.push({ colno, @@ -18176,7 +18744,7 @@ const INTEGRATION_NAME$6 = "ReportingObserver"; const SETUP_CLIENTS = /* @__PURE__ */ new WeakMap(); const _reportingObserverIntegration = /* @__PURE__ */ __name((options4 = {}) => { const types = options4.types || ["crash", "deprecation", "intervention"]; - function handler6(reports) { + function handler12(reports) { if (!SETUP_CLIENTS.has(getClient())) { return; } @@ -18203,7 +18771,7 @@ const _reportingObserverIntegration = /* @__PURE__ */ __name((options4 = {}) => }); } } - __name(handler6, "handler"); + __name(handler12, "handler"); return { name: INTEGRATION_NAME$6, setupOnce() { @@ -18211,7 +18779,7 @@ const _reportingObserverIntegration = /* @__PURE__ */ __name((options4 = {}) => return; } const observer = new WINDOW$3.ReportingObserver( - handler6, + handler12, { buffered: true, types @@ -18349,12 +18917,12 @@ function _getXHRResponseHeaders(xhr) { }, {}); } __name(_getXHRResponseHeaders, "_getXHRResponseHeaders"); -function _isInGivenRequestTargets(failedRequestTargets, target) { +function _isInGivenRequestTargets(failedRequestTargets, target2) { return failedRequestTargets.some((givenRequestTarget) => { if (typeof givenRequestTarget === "string") { - return target.includes(givenRequestTarget); + return target2.includes(givenRequestTarget); } - return givenRequestTarget.test(target); + return givenRequestTarget.test(target2); }); } __name(_isInGivenRequestTargets, "_isInGivenRequestTargets"); @@ -18411,11 +18979,11 @@ function _shouldCaptureResponse(options4, status, url) { return _isInGivenStatusRanges(options4.failedRequestStatusCodes, status) && _isInGivenRequestTargets(options4.failedRequestTargets, url) && !isSentryRequestUrl(url, getClient()); } __name(_shouldCaptureResponse, "_shouldCaptureResponse"); -function _createEvent(data25) { +function _createEvent(data26) { const client = getClient(); - const virtualStackTrace = client && data25.error && data25.error instanceof Error ? data25.error.stack : void 0; + const virtualStackTrace = client && data26.error && data26.error instanceof Error ? data26.error.stack : void 0; const stack2 = virtualStackTrace && client ? client.getOptions().stackParser(virtualStackTrace, 0, 1) : void 0; - const message3 = `HTTP Client Error with status code: ${data25.status}`; + const message3 = `HTTP Client Error with status code: ${data26.status}`; const event = { message: message3, exception: { @@ -18428,17 +18996,17 @@ function _createEvent(data25) { ] }, request: { - url: data25.url, - method: data25.method, - headers: data25.requestHeaders, - cookies: data25.requestCookies + url: data26.url, + method: data26.method, + headers: data26.requestHeaders, + cookies: data26.requestCookies }, contexts: { response: { - status_code: data25.status, - headers: data25.responseHeaders, - cookies: data25.responseCookies, - body_size: _getResponseSizeFromHeaders(data25.responseHeaders) + status_code: data26.status, + headers: data26.responseHeaders, + cookies: data26.responseCookies, + body_size: _getResponseSizeFromHeaders(data26.responseHeaders) } } }; @@ -18569,10 +19137,10 @@ var NodeType$3; NodeType3[NodeType3["CDATA"] = 4] = "CDATA"; NodeType3[NodeType3["Comment"] = 5] = "Comment"; })(NodeType$3 || (NodeType$3 = {})); -function isElement$1(n2) { +function isElement$1$1(n2) { return n2.nodeType === n2.ELEMENT_NODE; } -__name(isElement$1, "isElement$1"); +__name(isElement$1$1, "isElement$1$1"); function isShadowRoot(n2) { const host = _optionalChain$5([n2, "optionalAccess", (_2) => _2.host]); return Boolean(_optionalChain$5([host, "optionalAccess", (_2) => _2.shadowRoot]) === n2); @@ -18831,11 +19399,11 @@ function getIframeContentDocument(iframe) { } } __name(getIframeContentDocument, "getIframeContentDocument"); -let _id$2 = 1; +let _id$3 = 1; const tagNameRegex = new RegExp("[^a-z0-9-_:]"); const IGNORED_NODE = -2; function genId() { - return _id$2++; + return _id$3++; } __name(genId, "genId"); function getValidTagName(element) { @@ -19596,7 +20164,7 @@ function serializeNodeWithId(n2, options4) { serializedNode.childNodes.push(serializedChildNode); } } - if (isElement$1(n2) && n2.shadowRoot) { + if (isElement$1$1(n2) && n2.shadowRoot) { for (const childN of Array.from(n2.shadowRoot.childNodes)) { const serializedChildNode = serializeNodeWithId(childN, bypassOptions); if (serializedChildNode) { @@ -19774,10 +20342,10 @@ function _optionalChain$4(ops) { return value4; } __name(_optionalChain$4, "_optionalChain$4"); -function on(type, fn, target = document) { +function on(type, fn, target2 = document) { const options4 = { capture: true, passive: true }; - target.addEventListener(type, fn, options4); - return () => target.removeEventListener(type, fn, options4); + target2.addEventListener(type, fn, options4); + return () => target2.removeEventListener(type, fn, options4); } __name(on, "on"); const DEPARTED_MIRROR_ACCESS_WARNING$1 = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording."; @@ -19804,11 +20372,11 @@ let _mirror$1 = { }; if (typeof window !== "undefined" && window.Proxy && window.Reflect) { _mirror$1 = new Proxy(_mirror$1, { - get(target, prop2, receiver) { + get(target2, prop2, receiver) { if (prop2 === "map") { console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); } - return Reflect.get(target, prop2, receiver); + return Reflect.get(target2, prop2, receiver); } }); } @@ -19839,9 +20407,9 @@ function throttle$1(func, wait, options4 = {}) { }; } __name(throttle$1, "throttle$1"); -function hookSetter$1(target, key, d2, isRevoked, win = window) { - const original = win.Object.getOwnPropertyDescriptor(target, key); - win.Object.defineProperty(target, key, isRevoked ? d2 : { +function hookSetter$1(target2, key, d2, isRevoked, win = window) { + const original = win.Object.getOwnPropertyDescriptor(target2, key); + win.Object.defineProperty(target2, key, isRevoked ? d2 : { set(value4) { setTimeout$1$1(() => { d2.set.call(this, value4); @@ -19851,7 +20419,7 @@ function hookSetter$1(target, key, d2, isRevoked, win = window) { } } }); - return () => hookSetter$1(target, key, original || {}, true); + return () => hookSetter$1(target2, key, original || {}, true); } __name(hookSetter$1, "hookSetter$1"); function patch$2(source, name2, replacement) { @@ -19944,21 +20512,21 @@ function isIgnored(n2, mirror2) { return mirror2.getId(n2) === IGNORED_NODE; } __name(isIgnored, "isIgnored"); -function isAncestorRemoved(target, mirror2) { - if (isShadowRoot(target)) { +function isAncestorRemoved(target2, mirror2) { + if (isShadowRoot(target2)) { return false; } - const id3 = mirror2.getId(target); + const id3 = mirror2.getId(target2); if (!mirror2.has(id3)) { return true; } - if (target.parentNode && target.parentNode.nodeType === target.DOCUMENT_NODE) { + if (target2.parentNode && target2.parentNode.nodeType === target2.DOCUMENT_NODE) { return false; } - if (!target.parentNode) { + if (!target2.parentNode) { return true; } - return isAncestorRemoved(target.parentNode, mirror2); + return isAncestorRemoved(target2.parentNode, mirror2); } __name(isAncestorRemoved, "isAncestorRemoved"); function legacy_isTouchEvent(event) { @@ -20519,13 +21087,13 @@ class MutationBuffer { break; } case "attributes": { - const target = m2.target; + const target2 = m2.target; let attributeName = m2.attributeName; let value4 = m2.target.getAttribute(attributeName); if (attributeName === "value") { - const type = getInputType(target); - const tagName = target.tagName; - value4 = getInputValue(target, tagName, type); + const type = getInputType(target2); + const tagName = target2.tagName; + value4 = getInputValue(target2, tagName, type); const isInputMasked = shouldMaskInput({ maskInputOptions: this.maskInputOptions, tagName, @@ -20534,7 +21102,7 @@ class MutationBuffer { const forceMask = needMaskingText(m2.target, this.maskTextClass, this.maskTextSelector, this.unmaskTextClass, this.unmaskTextSelector, isInputMasked); value4 = maskInputValue({ isMasked: forceMask, - element: target, + element: target2, value: value4, maskInputFn: this.maskInputFn }); @@ -20543,8 +21111,8 @@ class MutationBuffer { return; } let item3 = this.attributeMap.get(m2.target); - if (target.tagName === "IFRAME" && attributeName === "src" && !this.keepIframeSrcFn(value4)) { - const iframeDoc = getIFrameContentDocument(target); + if (target2.tagName === "IFRAME" && attributeName === "src" && !this.keepIframeSrcFn(value4)) { + const iframeDoc = getIFrameContentDocument(target2); if (!iframeDoc) { attributeName = "rr_src"; } else { @@ -20561,11 +21129,11 @@ class MutationBuffer { this.attributes.push(item3); this.attributeMap.set(m2.target, item3); } - if (attributeName === "type" && target.tagName === "INPUT" && (m2.oldValue || "").toLowerCase() === "password") { - target.setAttribute("data-rr-is-password", "true"); + if (attributeName === "type" && target2.tagName === "INPUT" && (m2.oldValue || "").toLowerCase() === "password") { + target2.setAttribute("data-rr-is-password", "true"); } - if (!ignoreAttribute(target.tagName, attributeName)) { - item3.attributes[attributeName] = transformAttribute(this.doc, toLowerCase(target.tagName), toLowerCase(attributeName), value4, target, this.maskAttributeFn); + if (!ignoreAttribute(target2.tagName, attributeName)) { + item3.attributes[attributeName] = transformAttribute(this.doc, toLowerCase(target2.tagName), toLowerCase(attributeName), value4, target2, this.maskAttributeFn); if (attributeName === "style") { if (!this.unattachedDoc) { try { @@ -20578,9 +21146,9 @@ class MutationBuffer { if (m2.oldValue) { old.setAttribute("style", m2.oldValue); } - for (const pname of Array.from(target.style)) { - const newValue2 = target.style.getPropertyValue(pname); - const newPriority = target.style.getPropertyPriority(pname); + for (const pname of Array.from(target2.style)) { + const newValue2 = target2.style.getPropertyValue(pname); + const newPriority = target2.style.getPropertyPriority(pname); if (newValue2 !== old.style.getPropertyValue(pname) || newPriority !== old.style.getPropertyPriority(pname)) { if (newPriority === "") { item3.styleDiff[pname] = newValue2; @@ -20592,7 +21160,7 @@ class MutationBuffer { } } for (const pname of Array.from(old.style)) { - if (target.style.getPropertyValue(pname) === "") { + if (target2.style.getPropertyValue(pname) === "") { item3.styleDiff[pname] = false; } } @@ -20631,7 +21199,7 @@ class MutationBuffer { } } }; - this.genAdds = (n2, target) => { + this.genAdds = (n2, target2) => { if (this.processedNodeManager.inOtherBuffer(n2, this)) return; if (this.addedSet.has(n2) || this.movedSet.has(n2)) @@ -20642,8 +21210,8 @@ class MutationBuffer { } this.movedSet.add(n2); let targetId = null; - if (target && this.mirror.hasNode(target)) { - targetId = this.mirror.getId(target); + if (target2 && this.mirror.hasNode(target2)) { + targetId = this.mirror.getId(target2); } if (targetId && targetId !== -1) { this.movedMap[moveKey(this.mirror.getId(n2), targetId)] = true; @@ -20762,8 +21330,8 @@ function _isAncestorInSet(set3, n2) { } __name(_isAncestorInSet, "_isAncestorInSet"); let errorHandler$1; -function registerErrorHandler$1(handler6) { - errorHandler$1 = handler6; +function registerErrorHandler$1(handler12) { + errorHandler$1 = handler12; } __name(registerErrorHandler$1, "registerErrorHandler$1"); function unregisterErrorHandler() { @@ -20870,7 +21438,7 @@ function initMoveObserver({ mousemoveCb, sampling, doc: doc2, mirror: mirror2 }) timeBaseline = null; }), callbackThreshold); const updatePosition = callbackWrapper$1(throttle$1(callbackWrapper$1((evt) => { - const target = getEventTarget(evt); + const target2 = getEventTarget(evt); const { clientX, clientY } = legacy_isTouchEvent(evt) ? evt.changedTouches[0] : evt; if (!timeBaseline) { timeBaseline = nowTimestamp(); @@ -20878,7 +21446,7 @@ function initMoveObserver({ mousemoveCb, sampling, doc: doc2, mirror: mirror2 }) positions.push({ x: clientX, y: clientY, - id: mirror2.getId(target), + id: mirror2.getId(target2), timeOffset: nowTimestamp() - timeBaseline }); wrappedCb(typeof DragEvent !== "undefined" && evt instanceof DragEvent ? IncrementalSource.Drag : evt instanceof MouseEvent ? IncrementalSource.MouseMove : IncrementalSource.TouchMove); @@ -20905,8 +21473,8 @@ function initMouseInteractionObserver({ mouseInteractionCb, doc: doc2, mirror: m let currentPointerType = null; const getHandler = /* @__PURE__ */ __name((eventKey) => { return (event) => { - const target = getEventTarget(event); - if (isBlocked$1(target, blockClass, blockSelector, unblockSelector, true)) { + const target2 = getEventTarget(event); + if (isBlocked$1(target2, blockClass, blockSelector, unblockSelector, true)) { return; } let pointerType = null; @@ -20946,7 +21514,7 @@ function initMouseInteractionObserver({ mouseInteractionCb, doc: doc2, mirror: m if (!e2) { return; } - const id3 = mirror2.getId(target); + const id3 = mirror2.getId(target2); const { clientX, clientY } = e2; callbackWrapper$1(mouseInteractionCb)({ type: MouseInteractions[thisEventKey], @@ -20959,7 +21527,7 @@ function initMouseInteractionObserver({ mouseInteractionCb, doc: doc2, mirror: m }, "getHandler"); Object.keys(MouseInteractions).filter((key) => Number.isNaN(Number(key)) && !key.endsWith("_Departed") && disableMap[key] !== false).forEach((eventKey) => { let eventName = toLowerCase(eventKey); - const handler6 = getHandler(eventKey); + const handler12 = getHandler(eventKey); if (window.PointerEvent) { switch (MouseInteractions[eventKey]) { case MouseInteractions.MouseDown: @@ -20971,7 +21539,7 @@ function initMouseInteractionObserver({ mouseInteractionCb, doc: doc2, mirror: m return; } } - handlers2.push(on(eventName, handler6, doc2)); + handlers2.push(on(eventName, handler12, doc2)); }); return callbackWrapper$1(() => { handlers2.forEach((h2) => h2()); @@ -20980,12 +21548,12 @@ function initMouseInteractionObserver({ mouseInteractionCb, doc: doc2, mirror: m __name(initMouseInteractionObserver, "initMouseInteractionObserver"); function initScrollObserver({ scrollCb, doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, sampling }) { const updatePosition = callbackWrapper$1(throttle$1(callbackWrapper$1((evt) => { - const target = getEventTarget(evt); - if (!target || isBlocked$1(target, blockClass, blockSelector, unblockSelector, true)) { + const target2 = getEventTarget(evt); + if (!target2 || isBlocked$1(target2, blockClass, blockSelector, unblockSelector, true)) { return; } - const id3 = mirror2.getId(target); - if (target === doc2 && doc2.defaultView) { + const id3 = mirror2.getId(target2); + if (target2 === doc2 && doc2.defaultView) { const scrollLeftTop = getWindowScroll(doc2.defaultView); scrollCb({ id: id3, @@ -20995,8 +21563,8 @@ function initScrollObserver({ scrollCb, doc: doc2, mirror: mirror2, blockClass, } else { scrollCb({ id: id3, - x: target.scrollLeft, - y: target.scrollTop + x: target2.scrollLeft, + y: target2.scrollTop }); } }), sampling.scroll || 100)); @@ -21025,19 +21593,19 @@ const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"]; const lastInputValueMap = /* @__PURE__ */ new WeakMap(); function initInputObserver({ inputCb, doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, ignoreClass, ignoreSelector, maskInputOptions, maskInputFn, sampling, userTriggeredOnInput, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector }) { function eventHandler(event) { - let target = getEventTarget(event); + let target2 = getEventTarget(event); const userTriggered = event.isTrusted; - const tagName = target && toUpperCase(target.tagName); + const tagName = target2 && toUpperCase(target2.tagName); if (tagName === "OPTION") - target = target.parentElement; - if (!target || !tagName || INPUT_TAGS.indexOf(tagName) < 0 || isBlocked$1(target, blockClass, blockSelector, unblockSelector, true)) { + target2 = target2.parentElement; + if (!target2 || !tagName || INPUT_TAGS.indexOf(tagName) < 0 || isBlocked$1(target2, blockClass, blockSelector, unblockSelector, true)) { return; } - const el = target; + const el = target2; if (el.classList.contains(ignoreClass) || ignoreSelector && el.matches(ignoreSelector)) { return; } - const type = getInputType(target); + const type = getInputType(target2); let text2 = getInputValue(el, tagName, type); let isChecked2 = false; const isInputMasked = shouldMaskInput({ @@ -21045,21 +21613,21 @@ function initInputObserver({ inputCb, doc: doc2, mirror: mirror2, blockClass, bl tagName, type }); - const forceMask = needMaskingText(target, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, isInputMasked); + const forceMask = needMaskingText(target2, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, isInputMasked); if (type === "radio" || type === "checkbox") { - isChecked2 = target.checked; + isChecked2 = target2.checked; } text2 = maskInputValue({ isMasked: forceMask, - element: target, + element: target2, value: text2, maskInputFn }); - cbWithDedup(target, userTriggeredOnInput ? { text: text2, isChecked: isChecked2, userTriggered } : { text: text2, isChecked: isChecked2 }); - const name2 = target.name; + cbWithDedup(target2, userTriggeredOnInput ? { text: text2, isChecked: isChecked2, userTriggered } : { text: text2, isChecked: isChecked2 }); + const name2 = target2.name; if (type === "radio" && name2 && isChecked2) { doc2.querySelectorAll(`input[type="radio"][name="${name2}"]`).forEach((el2) => { - if (el2 !== target) { + if (el2 !== target2) { const text3 = maskInputValue({ isMasked: forceMask, element: el2, @@ -21072,11 +21640,11 @@ function initInputObserver({ inputCb, doc: doc2, mirror: mirror2, blockClass, bl } } __name(eventHandler, "eventHandler"); - function cbWithDedup(target, v2) { - const lastInputValue = lastInputValueMap.get(target); + function cbWithDedup(target2, v2) { + const lastInputValue = lastInputValueMap.get(target2); if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) { - lastInputValueMap.set(target, v2); - const id3 = mirror2.getId(target); + lastInputValueMap.set(target2, v2); + const id3 = mirror2.getId(target2); callbackWrapper$1(inputCb)({ ...v2, id: id3 @@ -21155,7 +21723,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM } const insertRule = win.CSSStyleSheet.prototype.insertRule; win.CSSStyleSheet.prototype.insertRule = new Proxy(insertRule, { - apply: callbackWrapper$1((target, thisArg, argumentsList) => { + apply: callbackWrapper$1((target2, thisArg, argumentsList) => { const [rule, index2] = argumentsList; const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); if (id3 && id3 !== -1 || styleId && styleId !== -1) { @@ -21165,12 +21733,12 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM adds: [{ rule, index: index2 }] }); } - return target.apply(thisArg, argumentsList); + return target2.apply(thisArg, argumentsList); }) }); const deleteRule = win.CSSStyleSheet.prototype.deleteRule; win.CSSStyleSheet.prototype.deleteRule = new Proxy(deleteRule, { - apply: callbackWrapper$1((target, thisArg, argumentsList) => { + apply: callbackWrapper$1((target2, thisArg, argumentsList) => { const [index2] = argumentsList; const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); if (id3 && id3 !== -1 || styleId && styleId !== -1) { @@ -21180,14 +21748,14 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM removes: [{ index: index2 }] }); } - return target.apply(thisArg, argumentsList); + return target2.apply(thisArg, argumentsList); }) }); let replace2; if (win.CSSStyleSheet.prototype.replace) { replace2 = win.CSSStyleSheet.prototype.replace; win.CSSStyleSheet.prototype.replace = new Proxy(replace2, { - apply: callbackWrapper$1((target, thisArg, argumentsList) => { + apply: callbackWrapper$1((target2, thisArg, argumentsList) => { const [text2] = argumentsList; const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); if (id3 && id3 !== -1 || styleId && styleId !== -1) { @@ -21197,7 +21765,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM replace: text2 }); } - return target.apply(thisArg, argumentsList); + return target2.apply(thisArg, argumentsList); }) }); } @@ -21205,7 +21773,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM if (win.CSSStyleSheet.prototype.replaceSync) { replaceSync = win.CSSStyleSheet.prototype.replaceSync; win.CSSStyleSheet.prototype.replaceSync = new Proxy(replaceSync, { - apply: callbackWrapper$1((target, thisArg, argumentsList) => { + apply: callbackWrapper$1((target2, thisArg, argumentsList) => { const [text2] = argumentsList; const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); if (id3 && id3 !== -1 || styleId && styleId !== -1) { @@ -21215,7 +21783,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM replaceSync: text2 }); } - return target.apply(thisArg, argumentsList); + return target2.apply(thisArg, argumentsList); }) }); } @@ -21240,7 +21808,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM deleteRule: type.prototype.deleteRule }; type.prototype.insertRule = new Proxy(unmodifiedFunctions[typeKey].insertRule, { - apply: callbackWrapper$1((target, thisArg, argumentsList) => { + apply: callbackWrapper$1((target2, thisArg, argumentsList) => { const [rule, index2] = argumentsList; const { id: id3, styleId } = getIdAndStyleId(thisArg.parentStyleSheet, mirror2, stylesheetManager.styleMirror); if (id3 && id3 !== -1 || styleId && styleId !== -1) { @@ -21258,11 +21826,11 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM ] }); } - return target.apply(thisArg, argumentsList); + return target2.apply(thisArg, argumentsList); }) }); type.prototype.deleteRule = new Proxy(unmodifiedFunctions[typeKey].deleteRule, { - apply: callbackWrapper$1((target, thisArg, argumentsList) => { + apply: callbackWrapper$1((target2, thisArg, argumentsList) => { const [index2] = argumentsList; const { id: id3, styleId } = getIdAndStyleId(thisArg.parentStyleSheet, mirror2, stylesheetManager.styleMirror); if (id3 && id3 !== -1 || styleId && styleId !== -1) { @@ -21274,7 +21842,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM ] }); } - return target.apply(thisArg, argumentsList); + return target2.apply(thisArg, argumentsList); }) }); }); @@ -21331,7 +21899,7 @@ __name(initAdoptedStyleSheetObserver, "initAdoptedStyleSheetObserver"); function initStyleDeclarationObserver({ styleDeclarationCb, mirror: mirror2, ignoreCSSAttributes, stylesheetManager }, { win }) { const setProperty2 = win.CSSStyleDeclaration.prototype.setProperty; win.CSSStyleDeclaration.prototype.setProperty = new Proxy(setProperty2, { - apply: callbackWrapper$1((target, thisArg, argumentsList) => { + apply: callbackWrapper$1((target2, thisArg, argumentsList) => { const [property, value4, priority] = argumentsList; if (ignoreCSSAttributes.has(property)) { return setProperty2.apply(thisArg, [property, value4, priority]); @@ -21349,12 +21917,12 @@ function initStyleDeclarationObserver({ styleDeclarationCb, mirror: mirror2, ign index: getNestedCSSRulePositions(thisArg.parentRule) }); } - return target.apply(thisArg, argumentsList); + return target2.apply(thisArg, argumentsList); }) }); const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty; win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, { - apply: callbackWrapper$1((target, thisArg, argumentsList) => { + apply: callbackWrapper$1((target2, thisArg, argumentsList) => { const [property] = argumentsList; if (ignoreCSSAttributes.has(property)) { return removeProperty.apply(thisArg, [property]); @@ -21370,7 +21938,7 @@ function initStyleDeclarationObserver({ styleDeclarationCb, mirror: mirror2, ign index: getNestedCSSRulePositions(thisArg.parentRule) }); } - return target.apply(thisArg, argumentsList); + return target2.apply(thisArg, argumentsList); }) }); return callbackWrapper$1(() => { @@ -21380,15 +21948,15 @@ function initStyleDeclarationObserver({ styleDeclarationCb, mirror: mirror2, ign } __name(initStyleDeclarationObserver, "initStyleDeclarationObserver"); function initMediaInteractionObserver({ mediaInteractionCb, blockClass, blockSelector, unblockSelector, mirror: mirror2, sampling, doc: doc2 }) { - const handler6 = callbackWrapper$1((type) => throttle$1(callbackWrapper$1((event) => { - const target = getEventTarget(event); - if (!target || isBlocked$1(target, blockClass, blockSelector, unblockSelector, true)) { + const handler12 = callbackWrapper$1((type) => throttle$1(callbackWrapper$1((event) => { + const target2 = getEventTarget(event); + if (!target2 || isBlocked$1(target2, blockClass, blockSelector, unblockSelector, true)) { return; } - const { currentTime, volume, muted, playbackRate } = target; + const { currentTime, volume, muted, playbackRate } = target2; mediaInteractionCb({ type, - id: mirror2.getId(target), + id: mirror2.getId(target2), currentTime, volume, muted, @@ -21396,11 +21964,11 @@ function initMediaInteractionObserver({ mediaInteractionCb, blockClass, blockSel }); }), sampling.media || 500)); const handlers2 = [ - on("play", handler6(0), doc2), - on("pause", handler6(1), doc2), - on("seeked", handler6(2), doc2), - on("volumechange", handler6(3), doc2), - on("ratechange", handler6(4), doc2) + on("play", handler12(0), doc2), + on("pause", handler12(1), doc2), + on("seeked", handler12(2), doc2), + on("volumechange", handler12(3), doc2), + on("ratechange", handler12(4), doc2) ]; return callbackWrapper$1(() => { handlers2.forEach((h2) => h2()); @@ -21953,9 +22521,9 @@ class ShadowDomManager { })); } reset() { - this.restoreHandlers.forEach((handler6) => { + this.restoreHandlers.forEach((handler12) => { try { - handler6(); + handler12(); } catch (e2) { } }); @@ -22605,11 +23173,11 @@ function getClosestInteractive(element) { } __name(getClosestInteractive, "getClosestInteractive"); function getClickTargetNode(event) { - const target = getTargetNode(event); - if (!target || !(target instanceof Element)) { - return target; + const target2 = getTargetNode(event); + if (!target2 || !(target2 instanceof Element)) { + return target2; } - return getClosestInteractive(target); + return getClosestInteractive(target2); } __name(getClickTargetNode, "getClickTargetNode"); function getTargetNode(event) { @@ -22643,7 +23211,7 @@ function monkeyPatchWindowOpen() { return function(...args) { if (handlers$2) { try { - handlers$2.forEach((handler6) => handler6()); + handlers$2.forEach((handler12) => handler12()); } catch (e2) { } } @@ -22950,8 +23518,8 @@ const handleDomListener = /* @__PURE__ */ __name((replay) => { addBreadcrumbEvent(replay, result); }; }, "handleDomListener"); -function getBaseDomBreadcrumb(target, message3) { - const nodeId = record.mirror.getId(target); +function getBaseDomBreadcrumb(target2, message3) { + const nodeId = record.mirror.getId(target2); const node3 = nodeId && record.mirror.getNode(nodeId); const meta = node3 && record.mirror.getMeta(node3); const element = meta && isElement$2(meta) ? meta : null; @@ -22970,24 +23538,24 @@ function getBaseDomBreadcrumb(target, message3) { } __name(getBaseDomBreadcrumb, "getBaseDomBreadcrumb"); function handleDom(handlerData) { - const { target, message: message3 } = getDomTarget(handlerData); + const { target: target2, message: message3 } = getDomTarget(handlerData); return createBreadcrumb({ category: `ui.${handlerData.name}`, - ...getBaseDomBreadcrumb(target, message3) + ...getBaseDomBreadcrumb(target2, message3) }); } __name(handleDom, "handleDom"); function getDomTarget(handlerData) { const isClick = handlerData.name === "click"; let message3; - let target = null; + let target2 = null; try { - target = isClick ? getClickTargetNode(handlerData.event) : getTargetNode(handlerData.event); - message3 = htmlTreeAsString(target, { maxStringLength: 200 }) || ""; + target2 = isClick ? getClickTargetNode(handlerData.event) : getTargetNode(handlerData.event); + message3 = htmlTreeAsString(target2, { maxStringLength: 200 }) || ""; } catch (e2) { message3 = ""; } - return { target, message: message3 }; + return { target: target2, message: message3 }; } __name(getDomTarget, "getDomTarget"); function isElement$2(node3) { @@ -23007,8 +23575,8 @@ function handleKeyboardEvent(replay, event) { } __name(handleKeyboardEvent, "handleKeyboardEvent"); function getKeyboardBreadcrumb(event) { - const { metaKey, shiftKey, ctrlKey, altKey, key, target } = event; - if (!target || isInputElement(target) || !key) { + const { metaKey, shiftKey, ctrlKey, altKey, key, target: target2 } = event; + if (!target2 || isInputElement(target2) || !key) { return null; } const hasModifierKey = metaKey || ctrlKey || altKey; @@ -23016,8 +23584,8 @@ function getKeyboardBreadcrumb(event) { if (!hasModifierKey && isCharacterKey) { return null; } - const message3 = htmlTreeAsString(target, { maxStringLength: 200 }) || ""; - const baseBreadcrumb = getBaseDomBreadcrumb(target, message3); + const message3 = htmlTreeAsString(target2, { maxStringLength: 200 }) || ""; + const baseBreadcrumb = getBaseDomBreadcrumb(target2, message3); return createBreadcrumb({ category: "ui.keyDown", message: message3, @@ -23032,8 +23600,8 @@ function getKeyboardBreadcrumb(event) { }); } __name(getKeyboardBreadcrumb, "getKeyboardBreadcrumb"); -function isInputElement(target) { - return target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable; +function isInputElement(target2) { + return target2.tagName === "INPUT" || target2.tagName === "TEXTAREA" || target2.isContentEditable; } __name(isInputElement, "isInputElement"); const ENTRY_TYPES = { @@ -23387,8 +23955,8 @@ class WorkerHandler { this._ensureReadyPromise = new Promise((resolve2, reject3) => { this._worker.addEventListener( "message", - ({ data: data25 }) => { - if (data25.success) { + ({ data: data26 }) => { + if (data26.success) { resolve2(); } else { reject3(); @@ -23419,8 +23987,8 @@ class WorkerHandler { postMessage(method, arg) { const id3 = this._getAndIncrementId(); return new Promise((resolve2, reject3) => { - const listener = /* @__PURE__ */ __name(({ data: data25 }) => { - const response = data25; + const listener = /* @__PURE__ */ __name(({ data: data26 }) => { + const response = data26; if (response.method !== method) { return; } @@ -23488,12 +24056,12 @@ class EventBufferCompressionWorker { if (!this._earliestTimestamp || timestamp2 < this._earliestTimestamp) { this._earliestTimestamp = timestamp2; } - const data25 = JSON.stringify(event); - this._totalSize += data25.length; + const data26 = JSON.stringify(event); + this._totalSize += data26.length; if (this._totalSize > REPLAY_MAX_EVENT_BUFFER_SIZE) { return Promise.reject(new EventBufferSizeExceededError()); } - return this._sendEventToWorker(data25); + return this._sendEventToWorker(data26); } /** * Finish the event buffer and return the compressed data. @@ -23517,8 +24085,8 @@ class EventBufferCompressionWorker { /** * Send the event to the worker. */ - _sendEventToWorker(data25) { - return this._worker.postMessage("addEvent", data25); + _sendEventToWorker(data26) { + return this._worker.postMessage("addEvent", data26); } /** * Finish the request and return the compressed data from the worker. @@ -24160,7 +24728,7 @@ function handleGlobalEventListener(replay) { } __name(handleGlobalEventListener, "handleGlobalEventListener"); function createPerformanceSpans(replay, entries) { - return entries.map(({ type, start: start2, end, name: name2, data: data25 }) => { + return entries.map(({ type, start: start2, end, name: name2, data: data26 }) => { const response = replay.throttledAddEvent({ type: EventType.Custom, timestamp: start2, @@ -24171,7 +24739,7 @@ function createPerformanceSpans(replay, entries) { description: name2, startTimestamp: start2, endTimestamp: end, - data: data25 + data: data26 } } }); @@ -24265,8 +24833,8 @@ function parseContentLengthHeader(header3) { if (!header3) { return void 0; } - const size2 = parseInt(header3, 10); - return isNaN(size2) ? void 0 : size2; + const size = parseInt(header3, 10); + return isNaN(size) ? void 0 : size; } __name(parseContentLengthHeader, "parseContentLengthHeader"); function getBodyString(body) { @@ -24308,11 +24876,11 @@ function mergeWarning(info, warning) { return info; } __name(mergeWarning, "mergeWarning"); -function makeNetworkReplayBreadcrumb(type, data25) { - if (!data25) { +function makeNetworkReplayBreadcrumb(type, data26) { + if (!data26) { return null; } - const { startTimestamp, endTimestamp, url, method, statusCode, request, response } = data25; + const { startTimestamp, endTimestamp, url, method, statusCode, request, response } = data26; const result = { type, start: startTimestamp / 1e3, @@ -24444,8 +25012,8 @@ function getFullUrl(url, baseURI = WINDOW$1.document.baseURI) { __name(getFullUrl, "getFullUrl"); async function captureFetchBreadcrumbToReplay(breadcrumb, hint, options4) { try { - const data25 = await _prepareFetchData(breadcrumb, hint, options4); - const result = makeNetworkReplayBreadcrumb("resource.fetch", data25); + const data26 = await _prepareFetchData(breadcrumb, hint, options4); + const result = makeNetworkReplayBreadcrumb("resource.fetch", data26); addNetworkBreadcrumb(options4.replay, result); } catch (error2) { DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to capture fetch breadcrumb"); @@ -24496,11 +25064,11 @@ function _getRequestInfo({ networkCaptureBodies, networkRequestHeaders }, input, } const requestBody = _getFetchRequestArgBody(input); const [bodyStr, warning] = getBodyString(requestBody); - const data25 = buildNetworkRequestOrResponse(headers, requestBodySize, bodyStr); + const data26 = buildNetworkRequestOrResponse(headers, requestBodySize, bodyStr); if (warning) { - return mergeWarning(data25, warning); + return mergeWarning(data26, warning); } - return data25; + return data26; } __name(_getRequestInfo, "_getRequestInfo"); async function _getResponseInfo(captureDetails, { @@ -24534,14 +25102,14 @@ function getResponseData(bodyText, { headers }) { try { - const size2 = bodyText && bodyText.length && responseBodySize === void 0 ? getBodySize(bodyText) : responseBodySize; + const size = bodyText && bodyText.length && responseBodySize === void 0 ? getBodySize(bodyText) : responseBodySize; if (!captureDetails) { - return buildSkippedNetworkRequestOrResponse(size2); + return buildSkippedNetworkRequestOrResponse(size); } if (networkCaptureBodies) { - return buildNetworkRequestOrResponse(headers, size2, bodyText); + return buildNetworkRequestOrResponse(headers, size, bodyText); } - return buildNetworkRequestOrResponse(headers, size2, void 0); + return buildNetworkRequestOrResponse(headers, size, void 0); } catch (error2) { DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to serialize response body"); return buildNetworkRequestOrResponse(headers, responseBodySize, void 0); @@ -24634,8 +25202,8 @@ async function _getResponseText(response) { __name(_getResponseText, "_getResponseText"); async function captureXhrBreadcrumbToReplay(breadcrumb, hint, options4) { try { - const data25 = _prepareXhrData(breadcrumb, hint, options4); - const result = makeNetworkReplayBreadcrumb("resource.xhr", data25); + const data26 = _prepareXhrData(breadcrumb, hint, options4); + const result = makeNetworkReplayBreadcrumb("resource.xhr", data26); addNetworkBreadcrumb(options4.replay, result); } catch (error2) { DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to capture xhr breadcrumb"); @@ -26545,17 +27113,17 @@ let _mirror = { }; if (typeof window !== "undefined" && window.Proxy && window.Reflect) { _mirror = new Proxy(_mirror, { - get(target, prop2, receiver) { + get(target2, prop2, receiver) { if (prop2 === "map") { console.error(DEPARTED_MIRROR_ACCESS_WARNING); } - return Reflect.get(target, prop2, receiver); + return Reflect.get(target2, prop2, receiver); } }); } -function hookSetter(target, key, d2, isRevoked, win = window) { - const original = win.Object.getOwnPropertyDescriptor(target, key); - win.Object.defineProperty(target, key, isRevoked ? d2 : { +function hookSetter(target2, key, d2, isRevoked, win = window) { + const original = win.Object.getOwnPropertyDescriptor(target2, key); + win.Object.defineProperty(target2, key, isRevoked ? d2 : { set(value4) { setTimeout$1(() => { d2.set.call(this, value4); @@ -26565,7 +27133,7 @@ function hookSetter(target, key, d2, isRevoked, win = window) { } } }); - return () => hookSetter(target, key, original || {}, true); + return () => hookSetter(target2, key, original || {}, true); } __name(hookSetter, "hookSetter"); function patch$1(source, name2, replacement) { @@ -26666,8 +27234,8 @@ var CanvasContext = /* @__PURE__ */ ((CanvasContext2) => { return CanvasContext2; })(CanvasContext || {}); let errorHandler; -function registerErrorHandler(handler6) { - errorHandler = handler6; +function registerErrorHandler(handler12) { + errorHandler = handler12; } __name(registerErrorHandler, "registerErrorHandler"); const callbackWrapper = /* @__PURE__ */ __name((cb) => { @@ -26965,9 +27533,9 @@ class CanvasManager { } reset() { this.pendingCanvasMutations.clear(); - this.restoreHandlers.forEach((handler6) => { + this.restoreHandlers.forEach((handler12) => { try { - handler6(); + handler12(); } catch (e2) { } }); @@ -27002,14 +27570,14 @@ class CanvasManager { this.locked = false; this.snapshotInProgressMap = /* @__PURE__ */ new Map(); this.worker = null; - this.processMutation = (target, mutation) => { + this.processMutation = (target2, mutation) => { const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId; if (newFrame || !this.rafStamps.invokeId) this.rafStamps.invokeId = this.rafStamps.latestId; - if (!this.pendingCanvasMutations.has(target)) { - this.pendingCanvasMutations.set(target, []); + if (!this.pendingCanvasMutations.has(target2)) { + this.pendingCanvasMutations.set(target2, []); } - this.pendingCanvasMutations.get(target).push(mutation); + this.pendingCanvasMutations.get(target2).push(mutation); }; const { sampling = "all", win, blockClass, blockSelector, unblockSelector, maxCanvasSize, recordCanvas, dataURLOptions, errorHandler: errorHandler2 } = options4; this.mutationCb = options4.mutationCb; @@ -27069,12 +27637,12 @@ class CanvasManager { initFPSWorker() { const worker = new Worker(t$2()); worker.onmessage = (e2) => { - const data25 = e2.data; - const { id: id3 } = data25; + const data26 = e2.data; + const { id: id3 } = data26; this.snapshotInProgressMap.set(id3, false); - if (!("base64" in data25)) + if (!("base64" in data26)) return; - const { base64, type, width: width2, height } = data25; + const { base64, type, width: width2, height } = data26; this.mutationCb({ id: id3, type: CanvasContext["2D"], @@ -27139,8 +27707,8 @@ class CanvasManager { return [canvasElement2]; } const matchedCanvas = []; - const searchCanvas = /* @__PURE__ */ __name((root27) => { - root27.querySelectorAll("canvas").forEach((canvas) => { + const searchCanvas = /* @__PURE__ */ __name((root29) => { + root29.querySelectorAll("canvas").forEach((canvas) => { if (!isBlocked(canvas, blockClass, blockSelector, unblockSelector)) { matchedCanvas.push(canvas); } @@ -27416,9 +27984,9 @@ function mergeOptions$2(defaultOptions2, optionOverrides) { optionOverrides.onFormClose && optionOverrides.onFormClose(); defaultOptions2.onFormClose && defaultOptions2.onFormClose(); }, "onFormClose"), - onSubmitSuccess: /* @__PURE__ */ __name((data25) => { - optionOverrides.onSubmitSuccess && optionOverrides.onSubmitSuccess(data25); - defaultOptions2.onSubmitSuccess && defaultOptions2.onSubmitSuccess(data25); + onSubmitSuccess: /* @__PURE__ */ __name((data26) => { + optionOverrides.onSubmitSuccess && optionOverrides.onSubmitSuccess(data26); + defaultOptions2.onSubmitSuccess && defaultOptions2.onSubmitSuccess(data26); }, "onSubmitSuccess"), onSubmitError: /* @__PURE__ */ __name((error2) => { optionOverrides.onSubmitError && optionOverrides.onSubmitError(error2); @@ -27597,18 +28165,18 @@ const DEFAULT_DARK = { outline: "1px auto var(--accent-background)", interactiveFilter: "brightness(150%)" }; -function getThemedCssVariables(theme42) { +function getThemedCssVariables(theme43) { return ` - --foreground: ${theme42.foreground}; - --background: ${theme42.background}; - --accent-foreground: ${theme42.accentForeground}; - --accent-background: ${theme42.accentBackground}; - --success-color: ${theme42.successColor}; - --error-color: ${theme42.errorColor}; - --border: ${theme42.border}; - --box-shadow: ${theme42.boxShadow}; - --outline: ${theme42.outline}; - --interactive-filter: ${theme42.interactiveFilter}; + --foreground: ${theme43.foreground}; + --background: ${theme43.background}; + --accent-foreground: ${theme43.accentForeground}; + --accent-background: ${theme43.accentBackground}; + --success-color: ${theme43.successColor}; + --error-color: ${theme43.errorColor}; + --border: ${theme43.border}; + --box-shadow: ${theme43.boxShadow}; + --outline: ${theme43.outline}; + --interactive-filter: ${theme43.interactiveFilter}; `; } __name(getThemedCssVariables, "getThemedCssVariables"); @@ -28455,8 +29023,8 @@ function Form({ setShowScreenshotInput(false); }, []); const hasAllRequiredFields = x( - (data25) => { - const missingFields = getMissingFields(data25, { + (data26) => { + const missingFields = getMissingFields(data26, { emailLabel, isEmailRequired, isNameRequired, @@ -28481,27 +29049,27 @@ function Form({ } const formData = new FormData(e2.target); const attachment = await (screenshotInput && showScreenshotInput ? screenshotInput.value() : void 0); - const data25 = { + const data26 = { name: retrieveStringValue(formData, "name"), email: retrieveStringValue(formData, "email"), message: retrieveStringValue(formData, "message"), attachments: attachment ? [attachment] : void 0 }; - if (!hasAllRequiredFields(data25)) { + if (!hasAllRequiredFields(data26)) { return; } try { await onSubmit( { - name: data25.name, - email: data25.email, - message: data25.message, + name: data26.name, + email: data26.email, + message: data26.message, source: FEEDBACK_WIDGET_SOURCE, tags }, - { attachments: data25.attachments } + { attachments: data26.attachments } ); - onSubmitSuccess(data25); + onSubmitSuccess(data26); } catch (error3) { DEBUG_BUILD$1 && logger$2.error(error3); setError(error3); @@ -28674,8 +29242,8 @@ function Dialog({ open: open2, onFormSubmitted, ...props }) { onFormSubmitted(); }, [timeoutId]); const onSubmitSuccess = x( - (data25) => { - props.onSubmitSuccess(data25); + (data26) => { + props.onSubmitSuccess(data26); setTimeoutId( setTimeout(() => { onFormSubmitted(); @@ -29086,9 +29654,9 @@ const feedbackModalIntegration = /* @__PURE__ */ __name(() => { options4.onFormClose && options4.onFormClose(); }, "onFormClose"), onSubmit: sendFeedback2, - onSubmitSuccess: /* @__PURE__ */ __name((data25) => { + onSubmitSuccess: /* @__PURE__ */ __name((data26) => { renderContent(false); - options4.onSubmitSuccess && options4.onSubmitSuccess(data25); + options4.onSubmitSuccess && options4.onSubmitSuccess(data26); }, "onSubmitSuccess"), onSubmitError: /* @__PURE__ */ __name((error2) => { options4.onSubmitError && options4.onSubmitError(error2); @@ -29623,9 +30191,9 @@ const feedbackScreenshotIntegration = /* @__PURE__ */ __name(() => { imageBuffer.toBlob(resolve2, "image/png"); }); if (blob) { - const data25 = new Uint8Array(await blob.arrayBuffer()); + const data26 = new Uint8Array(await blob.arrayBuffer()); const attachment = { - data: data25, + data: data26, filename: "screenshot.png", contentType: "application/png" // attachmentType?: string; @@ -29645,30 +30213,30 @@ const feedbackSyncIntegration = buildFeedbackIntegration({ getModalIntegration: /* @__PURE__ */ __name(() => feedbackModalIntegration, "getModalIntegration"), getScreenshotIntegration: /* @__PURE__ */ __name(() => feedbackScreenshotIntegration, "getScreenshotIntegration") }); -function increment(name2, value4 = 1, data25) { - metrics$1.increment(BrowserMetricsAggregator, name2, value4, data25); +function increment(name2, value4 = 1, data26) { + metrics$1.increment(BrowserMetricsAggregator, name2, value4, data26); } __name(increment, "increment"); -function distribution(name2, value4, data25) { - metrics$1.distribution(BrowserMetricsAggregator, name2, value4, data25); +function distribution(name2, value4, data26) { + metrics$1.distribution(BrowserMetricsAggregator, name2, value4, data26); } __name(distribution, "distribution"); -function set$5(name2, value4, data25) { - metrics$1.set(BrowserMetricsAggregator, name2, value4, data25); +function set$4(name2, value4, data26) { + metrics$1.set(BrowserMetricsAggregator, name2, value4, data26); } -__name(set$5, "set$5"); -function gauge(name2, value4, data25) { - metrics$1.gauge(BrowserMetricsAggregator, name2, value4, data25); +__name(set$4, "set$4"); +function gauge(name2, value4, data26) { + metrics$1.gauge(BrowserMetricsAggregator, name2, value4, data26); } __name(gauge, "gauge"); -function timing(name2, value4, unit = "second", data25) { - return metrics$1.timing(BrowserMetricsAggregator, name2, value4, unit, data25); +function timing(name2, value4, unit = "second", data26) { + return metrics$1.timing(BrowserMetricsAggregator, name2, value4, unit, data26); } __name(timing, "timing"); const metrics = { increment, distribution, - set: set$5, + set: set$4, gauge, timing }; @@ -29763,7 +30331,7 @@ function addHTTPTimings(span) { entries.forEach((entry) => { if (isPerformanceResourceTiming(entry) && entry.name.endsWith(url)) { const spanData = resourceTimingEntryToSpanData(entry); - spanData.forEach((data25) => span.setAttribute(...data25)); + spanData.forEach((data26) => span.setAttribute(...data26)); setTimeout(cleanup); } }); @@ -30307,8 +30875,8 @@ let OS_ARCH = ""; let OS_BROWSER = WINDOW$5.navigator && WINDOW$5.navigator.userAgent || ""; let OS_MODEL = ""; const OS_LOCALE = WINDOW$5.navigator && WINDOW$5.navigator.language || WINDOW$5.navigator && WINDOW$5.navigator.languages && WINDOW$5.navigator.languages[0] || ""; -function isUserAgentData(data25) { - return typeof data25 === "object" && data25 !== null && "getHighEntropyValues" in data25; +function isUserAgentData(data26) { + return typeof data26 === "object" && data26 !== null && "getHighEntropyValues" in data26; } __name(isUserAgentData, "isUserAgentData"); const userAgentData = WINDOW$5.navigator && WINDOW$5.navigator.userAgentData; @@ -31359,15 +31927,16 @@ const createSentryPiniaPlugin = /* @__PURE__ */ __name((options4 = { return plugin; }, "createSentryPiniaPlugin"); /** -* @vue/shared v3.4.31 +* @vue/shared v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/ /*! #__NO_SIDE_EFFECTS__ */ // @__NO_SIDE_EFFECTS__ -function makeMap(str, expectsLowerCase) { - const set3 = new Set(str.split(",")); - return expectsLowerCase ? (val) => set3.has(val.toLowerCase()) : (val) => set3.has(val); +function makeMap(str) { + const map3 = /* @__PURE__ */ Object.create(null); + for (const key of str.split(",")) map3[key] = 1; + return (val) => val in map3; } __name(makeMap, "makeMap"); const EMPTY_OBJ = false ? Object.freeze({}) : {}; @@ -31379,25 +31948,25 @@ const isOn = /* @__PURE__ */ __name((key) => key.charCodeAt(0) === 111 && key.ch (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 remove$2 = /* @__PURE__ */ __name((arr, el) => { const i2 = arr.indexOf(el); if (i2 > -1) { arr.splice(i2, 1); } -}, "remove$1"); +}, "remove$2"); const hasOwnProperty$d = Object.prototype.hasOwnProperty; const hasOwn$3 = /* @__PURE__ */ __name((val, key) => hasOwnProperty$d.call(val, key), "hasOwn$3"); -const isArray$9 = Array.isArray; +const isArray$b = Array.isArray; const isMap$3 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Map]", "isMap$3"); const isSet$3 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Set]", "isSet$3"); -const isDate$2 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Date]", "isDate$2"); +const isDate$4 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Date]", "isDate$4"); const isRegExp$4 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object RegExp]", "isRegExp$4"); -const isFunction$8 = /* @__PURE__ */ __name((val) => typeof val === "function", "isFunction$8"); -const isString$7 = /* @__PURE__ */ __name((val) => typeof val === "string", "isString$7"); +const isFunction$c = /* @__PURE__ */ __name((val) => typeof val === "function", "isFunction$c"); +const isString$9 = /* @__PURE__ */ __name((val) => typeof val === "string", "isString$9"); const isSymbol$1 = /* @__PURE__ */ __name((val) => typeof val === "symbol", "isSymbol$1"); -const isObject$d = /* @__PURE__ */ __name((val) => val !== null && typeof val === "object", "isObject$d"); +const isObject$f = /* @__PURE__ */ __name((val) => val !== null && typeof val === "object", "isObject$f"); const isPromise$1 = /* @__PURE__ */ __name((val) => { - return (isObject$d(val) || isFunction$8(val)) && isFunction$8(val.then) && isFunction$8(val.catch); + return (isObject$f(val) || isFunction$c(val)) && isFunction$c(val.then) && isFunction$c(val.catch); }, "isPromise$1"); const objectToString$3 = Object.prototype.toString; const toTypeString$1 = /* @__PURE__ */ __name((value4) => objectToString$3.call(value4), "toTypeString$1"); @@ -31405,7 +31974,7 @@ const toRawType = /* @__PURE__ */ __name((value4) => { return toTypeString$1(value4).slice(8, -1); }, "toRawType"); const isPlainObject$4 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Object]", "isPlainObject$4"); -const isIntegerKey = /* @__PURE__ */ __name((key) => isString$7(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key, "isIntegerKey"); +const isIntegerKey = /* @__PURE__ */ __name((key) => isString$9(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" @@ -31421,9 +31990,11 @@ const cacheStringFunction$1 = /* @__PURE__ */ __name((fn) => { }; }, "cacheStringFunction$1"); const camelizeRE$1 = /-(\w)/g; -const camelize$1 = cacheStringFunction$1((str) => { - return str.replace(camelizeRE$1, (_2, c2) => c2 ? c2.toUpperCase() : ""); -}); +const camelize$1 = cacheStringFunction$1( + (str) => { + return str.replace(camelizeRE$1, (_2, c2) => c2 ? c2.toUpperCase() : ""); + } +); const hyphenateRE$1 = /\B([A-Z])/g; const hyphenate$1 = cacheStringFunction$1( (str) => str.replace(hyphenateRE$1, "-$1").toLowerCase() @@ -31431,10 +32002,12 @@ const hyphenate$1 = cacheStringFunction$1( const capitalize$1 = cacheStringFunction$1((str) => { return str.charAt(0).toUpperCase() + str.slice(1); }); -const toHandlerKey = cacheStringFunction$1((str) => { - const s2 = str ? `on${capitalize$1(str)}` : ``; - return s2; -}); +const toHandlerKey = cacheStringFunction$1( + (str) => { + const s2 = str ? `on${capitalize$1(str)}` : ``; + return s2; + } +); const hasChanged = /* @__PURE__ */ __name((value4, oldValue2) => !Object.is(value4, oldValue2), "hasChanged"); const invokeArrayFns = /* @__PURE__ */ __name((fns, ...arg) => { for (let i2 = 0; i2 < fns.length; i2++) { @@ -31454,7 +32027,7 @@ const looseToNumber = /* @__PURE__ */ __name((val) => { return isNaN(n2) ? val : n2; }, "looseToNumber"); const toNumber = /* @__PURE__ */ __name((val) => { - const n2 = isString$7(val) ? Number(val) : NaN; + const n2 = isString$9(val) ? Number(val) : NaN; return isNaN(n2) ? val : n2; }, "toNumber"); let _globalThis$1; @@ -31466,6 +32039,13 @@ function genPropsAccessExp(name2) { return identRE.test(name2) ? `__props.${name2}` : `__props[${JSON.stringify(name2)}]`; } __name(genPropsAccessExp, "genPropsAccessExp"); +function genCacheKey(source, options4) { + return source + JSON.stringify( + options4, + (_2, val) => typeof val === "function" ? val.toString() : val + ); +} +__name(genCacheKey, "genCacheKey"); const PatchFlags = { "TEXT": 1, "1": "TEXT", @@ -31491,8 +32071,8 @@ const PatchFlags = { "1024": "DYNAMIC_SLOTS", "DEV_ROOT_FRAGMENT": 2048, "2048": "DEV_ROOT_FRAGMENT", - "HOISTED": -1, - "-1": "HOISTED", + "CACHED": -1, + "-1": "CACHED", "BAIL": -2, "-2": "BAIL" }; @@ -31549,7 +32129,7 @@ const slotFlagsText = { [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 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,Symbol"; const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); const isGloballyWhitelisted = isGloballyAllowed; const range = 2; @@ -31595,11 +32175,11 @@ function generateCodeFrame$1(source, start2 = 0, end = source.length) { } __name(generateCodeFrame$1, "generateCodeFrame$1"); function normalizeStyle(value4) { - if (isArray$9(value4)) { + if (isArray$b(value4)) { const res = {}; for (let i2 = 0; i2 < value4.length; i2++) { const item3 = value4[i2]; - const normalized = isString$7(item3) ? parseStringStyle(item3) : normalizeStyle(item3); + const normalized = isString$9(item3) ? parseStringStyle(item3) : normalizeStyle(item3); if (normalized) { for (const key in normalized) { res[key] = normalized[key]; @@ -31607,7 +32187,7 @@ function normalizeStyle(value4) { } } return res; - } else if (isString$7(value4) || isObject$d(value4)) { + } else if (isString$9(value4) || isObject$f(value4)) { return value4; } } @@ -31627,13 +32207,12 @@ function parseStringStyle(cssText) { } __name(parseStringStyle, "parseStringStyle"); function stringifyStyle(styles) { + if (!styles) return ""; + if (isString$9(styles)) return styles; let ret = ""; - if (!styles || isString$7(styles)) { - return ret; - } for (const key in styles) { const value4 = styles[key]; - if (isString$7(value4) || typeof value4 === "number") { + if (isString$9(value4) || typeof value4 === "number") { const normalizedKey = key.startsWith(`--`) ? key : hyphenate$1(key); ret += `${normalizedKey}:${value4};`; } @@ -31643,16 +32222,16 @@ function stringifyStyle(styles) { __name(stringifyStyle, "stringifyStyle"); function normalizeClass(value4) { let res = ""; - if (isString$7(value4)) { + if (isString$9(value4)) { res = value4; - } else if (isArray$9(value4)) { + } else if (isArray$b(value4)) { for (let i2 = 0; i2 < value4.length; i2++) { const normalized = normalizeClass(value4[i2]); if (normalized) { res += normalized + " "; } } - } else if (isObject$d(value4)) { + } else if (isObject$f(value4)) { for (const name2 in value4) { if (value4[name2]) { res += name2 + " "; @@ -31665,7 +32244,7 @@ __name(normalizeClass, "normalizeClass"); function normalizeProps(props) { if (!props) return null; let { class: klass, style: style2 } = props; - if (klass && !isString$7(klass)) { + if (klass && !isString$9(klass)) { props.class = normalizeClass(klass); } if (style2) { @@ -31716,6 +32295,9 @@ const isKnownHtmlAttr = /* @__PURE__ */ makeMap( 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` ); +const isKnownMathMLAttr = /* @__PURE__ */ makeMap( + `accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns` +); function isRenderableAttrValue(value4) { if (value4 == null) { return false; @@ -31769,6 +32351,14 @@ function escapeHtmlComment(src) { return src.replace(commentStripRE, ""); } __name(escapeHtmlComment, "escapeHtmlComment"); +const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g; +function getEscapedCssVarName(key, doubleEscape) { + return key.replace( + cssVarNameEscapeSymbolsRE, + (s2) => doubleEscape ? s2 === '"' ? '\\\\\\"' : `\\\\${s2}` : `\\${s2}` + ); +} +__name(getEscapedCssVarName, "getEscapedCssVarName"); function looseCompareArrays(a2, b2) { if (a2.length !== b2.length) return false; let equal = true; @@ -31780,8 +32370,8 @@ function looseCompareArrays(a2, b2) { __name(looseCompareArrays, "looseCompareArrays"); function looseEqual(a2, b2) { if (a2 === b2) return true; - let aValidType = isDate$2(a2); - let bValidType = isDate$2(b2); + let aValidType = isDate$4(a2); + let bValidType = isDate$4(b2); if (aValidType || bValidType) { return aValidType && bValidType ? a2.getTime() === b2.getTime() : false; } @@ -31790,13 +32380,13 @@ function looseEqual(a2, b2) { if (aValidType || bValidType) { return a2 === b2; } - aValidType = isArray$9(a2); - bValidType = isArray$9(b2); + aValidType = isArray$b(a2); + bValidType = isArray$b(b2); if (aValidType || bValidType) { return aValidType && bValidType ? looseCompareArrays(a2, b2) : false; } - aValidType = isObject$d(a2); - bValidType = isObject$d(b2); + aValidType = isObject$f(a2); + bValidType = isObject$f(b2); if (aValidType || bValidType) { if (!aValidType || !bValidType) { return false; @@ -31822,10 +32412,10 @@ function looseIndexOf(arr, val) { } __name(looseIndexOf, "looseIndexOf"); const isRef$1 = /* @__PURE__ */ __name((val) => { - return !!(val && val.__v_isRef === true); + return !!(val && val["__v_isRef"] === true); }, "isRef$1"); const toDisplayString$1 = /* @__PURE__ */ __name((val) => { - return isString$7(val) ? val : val == null ? "" : isArray$9(val) || isObject$d(val) && (val.toString === objectToString$3 || !isFunction$8(val.toString)) ? isRef$1(val) ? toDisplayString$1(val.value) : JSON.stringify(val, replacer, 2) : String(val); + return isString$9(val) ? val : val == null ? "" : isArray$b(val) || isObject$f(val) && (val.toString === objectToString$3 || !isFunction$c(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)) { @@ -31846,7 +32436,7 @@ const replacer = /* @__PURE__ */ __name((_key, val) => { }; } else if (isSymbol$1(val)) { return stringifySymbol(val); - } else if (isObject$d(val) && !isArray$9(val) && !isPlainObject$4(val)) { + } else if (isObject$f(val) && !isArray$b(val) && !isPlainObject$4(val)) { return String(val); } return val; @@ -31860,7 +32450,7 @@ const stringifySymbol = /* @__PURE__ */ __name((v2, i2 = "") => { ); }, "stringifySymbol"); /** -* @vue/reactivity v3.4.31 +* @vue/reactivity v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/ @@ -31878,6 +32468,7 @@ class EffectScope { this._active = true; this.effects = []; this.cleanups = []; + this._isPaused = false; this.parent = activeEffectScope; if (!detached && activeEffectScope) { this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( @@ -31888,6 +32479,39 @@ class EffectScope { get active() { return this._active; } + pause() { + if (this._active) { + this._isPaused = true; + let i2, l2; + if (this.scopes) { + for (i2 = 0, l2 = this.scopes.length; i2 < l2; i2++) { + this.scopes[i2].pause(); + } + } + for (i2 = 0, l2 = this.effects.length; i2 < l2; i2++) { + this.effects[i2].pause(); + } + } + } + /** + * Resumes the effect scope, including all child scopes and effects. + */ + resume() { + if (this._active) { + if (this._isPaused) { + this._isPaused = false; + let i2, l2; + if (this.scopes) { + for (i2 = 0, l2 = this.scopes.length; i2 < l2; i2++) { + this.scopes[i2].resume(); + } + } + for (i2 = 0, l2 = this.effects.length; i2 < l2; i2++) { + this.effects[i2].resume(); + } + } + } + } run(fn) { if (this._active) { const currentEffectScope = activeEffectScope; @@ -31917,17 +32541,21 @@ class EffectScope { } stop(fromParent) { if (this._active) { + this._active = false; let i2, l2; for (i2 = 0, l2 = this.effects.length; i2 < l2; i2++) { this.effects[i2].stop(); } + this.effects.length = 0; for (i2 = 0, l2 = this.cleanups.length; i2 < l2; i2++) { this.cleanups[i2](); } + this.cleanups.length = 0; if (this.scopes) { for (i2 = 0, l2 = this.scopes.length; i2 < l2; i2++) { this.scopes[i2].stop(true); } + this.scopes.length = 0; } if (!this.detached && this.parent && !fromParent) { const last = this.parent.scopes.pop(); @@ -31937,7 +32565,6 @@ class EffectScope { } } this.parent = void 0; - this._active = false; } } } @@ -31945,17 +32572,11 @@ 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) { +function onScopeDispose(fn, failSilently = false) { if (activeEffectScope) { activeEffectScope.cleanups.push(fn); } else if (false) { @@ -31965,122 +32586,307 @@ function onScopeDispose(fn) { } } __name(onScopeDispose, "onScopeDispose"); -let activeEffect; +let activeSub; +const EffectFlags = { + "ACTIVE": 1, + "1": "ACTIVE", + "RUNNING": 2, + "2": "RUNNING", + "TRACKING": 4, + "4": "TRACKING", + "NOTIFIED": 8, + "8": "NOTIFIED", + "DIRTY": 16, + "16": "DIRTY", + "ALLOW_RECURSE": 32, + "32": "ALLOW_RECURSE", + "PAUSED": 64, + "64": "PAUSED" +}; +const pausedQueueEffects = /* @__PURE__ */ new WeakSet(); class ReactiveEffect { static { __name(this, "ReactiveEffect"); } - constructor(fn, trigger2, scheduler, scope) { + constructor(fn) { 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 i2 = 0; i2 < this._depsLength; i2++) { - const dep = this.deps[i2]; - if (dep.computed) { - triggerComputed(dep.computed); - if (this._dirtyLevel >= 4) { - break; - } - } - } - if (this._dirtyLevel === 1) { - this._dirtyLevel = 0; - } - resetTracking(); + this.deps = void 0; + this.depsTail = void 0; + this.flags = 1 | 4; + this.next = void 0; + this.cleanup = void 0; + this.scheduler = void 0; + if (activeEffectScope && activeEffectScope.active) { + activeEffectScope.effects.push(this); } - return this._dirtyLevel >= 4; } - set dirty(v2) { - this._dirtyLevel = v2 ? 4 : 0; + pause() { + this.flags |= 64; + } + resume() { + if (this.flags & 64) { + this.flags &= ~64; + if (pausedQueueEffects.has(this)) { + pausedQueueEffects.delete(this); + this.trigger(); + } + } + } + /** + * @internal + */ + notify() { + if (this.flags & 2 && !(this.flags & 32)) { + return; + } + if (!(this.flags & 8)) { + batch(this); + } } run() { - this._dirtyLevel = 0; - if (!this.active) { + if (!(this.flags & 1)) { return this.fn(); } - let lastShouldTrack = shouldTrack; - let lastEffect = activeEffect; + this.flags |= 2; + cleanupEffect(this); + prepareDeps(this); + const prevEffect = activeSub; + const prevShouldTrack = shouldTrack; + activeSub = this; + shouldTrack = true; try { - shouldTrack = true; - activeEffect = this; - this._runnings++; - preCleanupEffect(this); return this.fn(); } finally { - postCleanupEffect(this); - this._runnings--; - activeEffect = lastEffect; - shouldTrack = lastShouldTrack; + if (false) { + warn$4( + "Active effect was not restored correctly - this is likely a Vue internal bug." + ); + } + cleanupDeps(this); + activeSub = prevEffect; + shouldTrack = prevShouldTrack; + this.flags &= ~2; } } stop() { - if (this.active) { - preCleanupEffect(this); - postCleanupEffect(this); + if (this.flags & 1) { + for (let link2 = this.deps; link2; link2 = link2.nextDep) { + removeSub(link2); + } + this.deps = this.depsTail = void 0; + cleanupEffect(this); this.onStop && this.onStop(); - this.active = false; + this.flags &= ~1; } } -} -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 i2 = effect2._depsLength; i2 < effect2.deps.length; i2++) { - cleanupDepEffect(effect2.deps[i2], 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(); + trigger() { + if (this.flags & 64) { + pausedQueueEffects.add(this); + } else if (this.scheduler) { + this.scheduler(); + } else { + this.runIfDirty(); } } + /** + * @internal + */ + runIfDirty() { + if (isDirty$1(this)) { + this.run(); + } + } + get dirty() { + return isDirty$1(this); + } } -__name(cleanupDepEffect, "cleanupDepEffect"); +let batchDepth = 0; +let batchedSub; +let batchedComputed; +function batch(sub, isComputed2 = false) { + sub.flags |= 8; + if (isComputed2) { + sub.next = batchedComputed; + batchedComputed = sub; + return; + } + sub.next = batchedSub; + batchedSub = sub; +} +__name(batch, "batch"); +function startBatch() { + batchDepth++; +} +__name(startBatch, "startBatch"); +function endBatch() { + if (--batchDepth > 0) { + return; + } + if (batchedComputed) { + let e2 = batchedComputed; + batchedComputed = void 0; + while (e2) { + const next2 = e2.next; + e2.next = void 0; + e2.flags &= ~8; + e2 = next2; + } + } + let error2; + while (batchedSub) { + let e2 = batchedSub; + batchedSub = void 0; + while (e2) { + const next2 = e2.next; + e2.next = void 0; + e2.flags &= ~8; + if (e2.flags & 1) { + try { + ; + e2.trigger(); + } catch (err) { + if (!error2) error2 = err; + } + } + e2 = next2; + } + } + if (error2) throw error2; +} +__name(endBatch, "endBatch"); +function prepareDeps(sub) { + for (let link2 = sub.deps; link2; link2 = link2.nextDep) { + link2.version = -1; + link2.prevActiveLink = link2.dep.activeLink; + link2.dep.activeLink = link2; + } +} +__name(prepareDeps, "prepareDeps"); +function cleanupDeps(sub) { + let head; + let tail = sub.depsTail; + let link2 = tail; + while (link2) { + const prev2 = link2.prevDep; + if (link2.version === -1) { + if (link2 === tail) tail = prev2; + removeSub(link2); + removeDep(link2); + } else { + head = link2; + } + link2.dep.activeLink = link2.prevActiveLink; + link2.prevActiveLink = void 0; + link2 = prev2; + } + sub.deps = head; + sub.depsTail = tail; +} +__name(cleanupDeps, "cleanupDeps"); +function isDirty$1(sub) { + for (let link2 = sub.deps; link2; link2 = link2.nextDep) { + if (link2.dep.version !== link2.version || link2.dep.computed && (refreshComputed(link2.dep.computed) || link2.dep.version !== link2.version)) { + return true; + } + } + if (sub._dirty) { + return true; + } + return false; +} +__name(isDirty$1, "isDirty$1"); +function refreshComputed(computed2) { + if (computed2.flags & 4 && !(computed2.flags & 16)) { + return; + } + computed2.flags &= ~16; + if (computed2.globalVersion === globalVersion) { + return; + } + computed2.globalVersion = globalVersion; + const dep = computed2.dep; + computed2.flags |= 2; + if (dep.version > 0 && !computed2.isSSR && computed2.deps && !isDirty$1(computed2)) { + computed2.flags &= ~2; + return; + } + const prevSub = activeSub; + const prevShouldTrack = shouldTrack; + activeSub = computed2; + shouldTrack = true; + try { + prepareDeps(computed2); + const value4 = computed2.fn(computed2._value); + if (dep.version === 0 || hasChanged(value4, computed2._value)) { + computed2._value = value4; + dep.version++; + } + } catch (err) { + dep.version++; + throw err; + } finally { + activeSub = prevSub; + shouldTrack = prevShouldTrack; + cleanupDeps(computed2); + computed2.flags &= ~2; + } +} +__name(refreshComputed, "refreshComputed"); +function removeSub(link2, soft = false) { + const { dep, prevSub, nextSub } = link2; + if (prevSub) { + prevSub.nextSub = nextSub; + link2.prevSub = void 0; + } + if (nextSub) { + nextSub.prevSub = prevSub; + link2.nextSub = void 0; + } + if (false) { + dep.subsHead = nextSub; + } + if (dep.subs === link2) { + dep.subs = prevSub; + if (!prevSub && dep.computed) { + dep.computed.flags &= ~4; + for (let l2 = dep.computed.deps; l2; l2 = l2.nextDep) { + removeSub(l2, true); + } + } + } + if (!soft && !--dep.sc && dep.map) { + dep.map.delete(dep.key); + } +} +__name(removeSub, "removeSub"); +function removeDep(link2) { + const { prevDep, nextDep } = link2; + if (prevDep) { + prevDep.nextDep = nextDep; + link2.prevDep = void 0; + } + if (nextDep) { + nextDep.prevDep = prevDep; + link2.nextDep = void 0; + } +} +__name(removeDep, "removeDep"); function effect(fn, options4) { if (fn.effect instanceof ReactiveEffect) { fn = fn.effect.fn; } - const _effect = new ReactiveEffect(fn, NOOP, () => { - if (_effect.dirty) { - _effect.run(); - } - }); + const e2 = new ReactiveEffect(fn); if (options4) { - extend$1(_effect, options4); - if (options4.scope) recordEffectScope(_effect, options4.scope); + extend$1(e2, options4); } - if (!options4 || !options4.lazy) { - _effect.run(); + try { + e2.run(); + } catch (err) { + e2.stop(); + throw err; } - const runner = _effect.run.bind(_effect); - runner.effect = _effect; + const runner = e2.run.bind(e2); + runner.effect = e2; return runner; } __name(effect, "effect"); @@ -32089,7 +32895,6 @@ function stop(runner) { } __name(stop, "stop"); let shouldTrack = true; -let pauseScheduleStack = 0; const trackStack = []; function pauseTracking() { trackStack.push(shouldTrack); @@ -32106,197 +32911,454 @@ function resetTracking() { 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 _a2; - 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) { - (_a2 = effect2.onTrack) == null ? void 0 : _a2.call(effect2, extend$1({ effect: effect2 }, debuggerEventExtraInfo)); - } - } -} -__name(trackEffect, "trackEffect"); -const queueEffectSchedulers = []; -function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) { - var _a2; - 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) { - (_a2 = effect2.onTrigger) == null ? void 0 : _a2.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 +function onEffectCleanup(fn, failSilently = false) { + if (activeSub instanceof ReactiveEffect) { + activeSub.cleanup = fn; + } else if (false) { + warn$4( + `onEffectCleanup() was called when there was no active effect to associate with.` ); } } +__name(onEffectCleanup, "onEffectCleanup"); +function cleanupEffect(e2) { + const { cleanup } = e2; + e2.cleanup = void 0; + if (cleanup) { + const prevSub = activeSub; + activeSub = void 0; + try { + cleanup(); + } finally { + activeSub = prevSub; + } + } +} +__name(cleanupEffect, "cleanupEffect"); +let globalVersion = 0; +let Link$3 = class Link2 { + static { + __name(this, "Link"); + } + constructor(sub, dep) { + this.sub = sub; + this.dep = dep; + this.version = dep.version; + this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0; + } +}; +class Dep { + static { + __name(this, "Dep"); + } + constructor(computed2) { + this.computed = computed2; + this.version = 0; + this.activeLink = void 0; + this.subs = void 0; + this.map = void 0; + this.key = void 0; + this.sc = 0; + if (false) { + this.subsHead = void 0; + } + } + track(debugInfo) { + if (!activeSub || !shouldTrack || activeSub === this.computed) { + return; + } + let link2 = this.activeLink; + if (link2 === void 0 || link2.sub !== activeSub) { + link2 = this.activeLink = new Link$3(activeSub, this); + if (!activeSub.deps) { + activeSub.deps = activeSub.depsTail = link2; + } else { + link2.prevDep = activeSub.depsTail; + activeSub.depsTail.nextDep = link2; + activeSub.depsTail = link2; + } + addSub(link2); + } else if (link2.version === -1) { + link2.version = this.version; + if (link2.nextDep) { + const next2 = link2.nextDep; + next2.prevDep = link2.prevDep; + if (link2.prevDep) { + link2.prevDep.nextDep = next2; + } + link2.prevDep = activeSub.depsTail; + link2.nextDep = void 0; + activeSub.depsTail.nextDep = link2; + activeSub.depsTail = link2; + if (activeSub.deps === link2) { + activeSub.deps = next2; + } + } + } + if (false) { + activeSub.onTrack( + extend$1( + { + effect: activeSub + }, + debugInfo + ) + ); + } + return link2; + } + trigger(debugInfo) { + this.version++; + globalVersion++; + this.notify(debugInfo); + } + notify(debugInfo) { + startBatch(); + try { + if (false) { + for (let head = this.subsHead; head; head = head.nextSub) { + if (head.sub.onTrigger && !(head.sub.flags & 8)) { + head.sub.onTrigger( + extend$1( + { + effect: head.sub + }, + debugInfo + ) + ); + } + } + } + for (let link2 = this.subs; link2; link2 = link2.prevSub) { + if (link2.sub.notify()) { + ; + link2.sub.dep.notify(); + } + } + } finally { + endBatch(); + } + } +} +function addSub(link2) { + link2.dep.sc++; + if (link2.sub.flags & 4) { + const computed2 = link2.dep.computed; + if (computed2 && !link2.dep.subs) { + computed2.flags |= 4 | 16; + for (let l2 = computed2.deps; l2; l2 = l2.nextDep) { + addSub(l2); + } + } + const currentTail = link2.dep.subs; + if (currentTail !== link2) { + link2.prevSub = currentTail; + if (currentTail) currentTail.nextSub = link2; + } + if (false) { + link2.dep.subsHead = link2; + } + link2.dep.subs = link2; + } +} +__name(addSub, "addSub"); +const targetMap = /* @__PURE__ */ new WeakMap(); +const ITERATE_KEY = Symbol( + false ? "Object iterate" : "" +); +const MAP_KEY_ITERATE_KEY = Symbol( + false ? "Map keys iterate" : "" +); +const ARRAY_ITERATE_KEY = Symbol( + false ? "Array iterate" : "" +); +function track(target2, type, key) { + if (shouldTrack && activeSub) { + let depsMap = targetMap.get(target2); + if (!depsMap) { + targetMap.set(target2, depsMap = /* @__PURE__ */ new Map()); + } + let dep = depsMap.get(key); + if (!dep) { + depsMap.set(key, dep = new Dep()); + dep.map = depsMap; + dep.key = key; + } + if (false) { + dep.track({ + target: target2, + type, + key + }); + } else { + dep.track(); + } + } +} __name(track, "track"); -function trigger(target, type, key, newValue2, oldValue2, oldTarget) { - const depsMap = targetMap.get(target); +function trigger(target2, type, key, newValue2, oldValue2, oldTarget) { + const depsMap = targetMap.get(target2); if (!depsMap) { + globalVersion++; return; } - let deps = []; - if (type === "clear") { - deps = [...depsMap.values()]; - } else if (key === "length" && isArray$9(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$9(target)) { - deps.push(depsMap.get(ITERATE_KEY)); - if (isMap$3(target)) { - deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); - } - } else if (isIntegerKey(key)) { - deps.push(depsMap.get("length")); - } - break; - case "delete": - if (!isArray$9(target)) { - deps.push(depsMap.get(ITERATE_KEY)); - if (isMap$3(target)) { - deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); - } - } - break; - case "set": - if (isMap$3(target)) { - deps.push(depsMap.get(ITERATE_KEY)); - } - break; - } - } - pauseScheduling(); - for (const dep of deps) { + const run2 = /* @__PURE__ */ __name((dep) => { if (dep) { - triggerEffects( - dep, - 4, - false ? { - target, + if (false) { + dep.trigger({ + target: target2, type, key, newValue: newValue2, oldValue: oldValue2, oldTarget - } : void 0 - ); + }); + } else { + dep.trigger(); + } + } + }, "run"); + startBatch(); + if (type === "clear") { + depsMap.forEach(run2); + } else { + const targetIsArray = isArray$b(target2); + const isArrayIndex = targetIsArray && isIntegerKey(key); + if (targetIsArray && key === "length") { + const newLength = Number(newValue2); + depsMap.forEach((dep, key2) => { + if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol$1(key2) && key2 >= newLength) { + run2(dep); + } + }); + } else { + if (key !== void 0 || depsMap.has(void 0)) { + run2(depsMap.get(key)); + } + if (isArrayIndex) { + run2(depsMap.get(ARRAY_ITERATE_KEY)); + } + switch (type) { + case "add": + if (!targetIsArray) { + run2(depsMap.get(ITERATE_KEY)); + if (isMap$3(target2)) { + run2(depsMap.get(MAP_KEY_ITERATE_KEY)); + } + } else if (isArrayIndex) { + run2(depsMap.get("length")); + } + break; + case "delete": + if (!targetIsArray) { + run2(depsMap.get(ITERATE_KEY)); + if (isMap$3(target2)) { + run2(depsMap.get(MAP_KEY_ITERATE_KEY)); + } + } + break; + case "set": + if (isMap$3(target2)) { + run2(depsMap.get(ITERATE_KEY)); + } + break; + } } } - resetScheduling(); + endBatch(); } __name(trigger, "trigger"); function getDepFromReactive(object, key) { - const depsMap = targetMap.get(object); - return depsMap && depsMap.get(key); + const depMap = targetMap.get(object); + return depMap && depMap.get(key); } __name(getDepFromReactive, "getDepFromReactive"); +function reactiveReadArray(array) { + const raw = toRaw(array); + if (raw === array) return raw; + track(raw, "iterate", ARRAY_ITERATE_KEY); + return isShallow(array) ? raw : raw.map(toReactive$1); +} +__name(reactiveReadArray, "reactiveReadArray"); +function shallowReadArray(arr) { + track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY); + return arr; +} +__name(shallowReadArray, "shallowReadArray"); +const arrayInstrumentations = { + __proto__: null, + [Symbol.iterator]() { + return iterator(this, Symbol.iterator, toReactive$1); + }, + concat(...args) { + return reactiveReadArray(this).concat( + ...args.map((x2) => isArray$b(x2) ? reactiveReadArray(x2) : x2) + ); + }, + entries() { + return iterator(this, "entries", (value4) => { + value4[1] = toReactive$1(value4[1]); + return value4; + }); + }, + every(fn, thisArg) { + return apply$2(this, "every", fn, thisArg, void 0, arguments); + }, + filter(fn, thisArg) { + return apply$2(this, "filter", fn, thisArg, (v2) => v2.map(toReactive$1), arguments); + }, + find(fn, thisArg) { + return apply$2(this, "find", fn, thisArg, toReactive$1, arguments); + }, + findIndex(fn, thisArg) { + return apply$2(this, "findIndex", fn, thisArg, void 0, arguments); + }, + findLast(fn, thisArg) { + return apply$2(this, "findLast", fn, thisArg, toReactive$1, arguments); + }, + findLastIndex(fn, thisArg) { + return apply$2(this, "findLastIndex", fn, thisArg, void 0, arguments); + }, + // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement + forEach(fn, thisArg) { + return apply$2(this, "forEach", fn, thisArg, void 0, arguments); + }, + includes(...args) { + return searchProxy(this, "includes", args); + }, + indexOf(...args) { + return searchProxy(this, "indexOf", args); + }, + join(separator) { + return reactiveReadArray(this).join(separator); + }, + // keys() iterator only reads `length`, no optimisation required + lastIndexOf(...args) { + return searchProxy(this, "lastIndexOf", args); + }, + map(fn, thisArg) { + return apply$2(this, "map", fn, thisArg, void 0, arguments); + }, + pop() { + return noTracking(this, "pop"); + }, + push(...args) { + return noTracking(this, "push", args); + }, + reduce(fn, ...args) { + return reduce(this, "reduce", fn, args); + }, + reduceRight(fn, ...args) { + return reduce(this, "reduceRight", fn, args); + }, + shift() { + return noTracking(this, "shift"); + }, + // slice could use ARRAY_ITERATE but also seems to beg for range tracking + some(fn, thisArg) { + return apply$2(this, "some", fn, thisArg, void 0, arguments); + }, + splice(...args) { + return noTracking(this, "splice", args); + }, + toReversed() { + return reactiveReadArray(this).toReversed(); + }, + toSorted(comparer) { + return reactiveReadArray(this).toSorted(comparer); + }, + toSpliced(...args) { + return reactiveReadArray(this).toSpliced(...args); + }, + unshift(...args) { + return noTracking(this, "unshift", args); + }, + values() { + return iterator(this, "values", toReactive$1); + } +}; +function iterator(self2, method, wrapValue) { + const arr = shallowReadArray(self2); + const iter = arr[method](); + if (arr !== self2 && !isShallow(self2)) { + iter._next = iter.next; + iter.next = () => { + const result = iter._next(); + if (result.value) { + result.value = wrapValue(result.value); + } + return result; + }; + } + return iter; +} +__name(iterator, "iterator"); +const arrayProto$1 = Array.prototype; +function apply$2(self2, method, fn, thisArg, wrappedRetFn, args) { + const arr = shallowReadArray(self2); + const needsWrap = arr !== self2 && !isShallow(self2); + const methodFn = arr[method]; + if (methodFn !== arrayProto$1[method]) { + const result2 = methodFn.apply(self2, args); + return needsWrap ? toReactive$1(result2) : result2; + } + let wrappedFn = fn; + if (arr !== self2) { + if (needsWrap) { + wrappedFn = /* @__PURE__ */ __name(function(item3, index2) { + return fn.call(this, toReactive$1(item3), index2, self2); + }, "wrappedFn"); + } else if (fn.length > 2) { + wrappedFn = /* @__PURE__ */ __name(function(item3, index2) { + return fn.call(this, item3, index2, self2); + }, "wrappedFn"); + } + } + const result = methodFn.call(arr, wrappedFn, thisArg); + return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result; +} +__name(apply$2, "apply$2"); +function reduce(self2, method, fn, args) { + const arr = shallowReadArray(self2); + let wrappedFn = fn; + if (arr !== self2) { + if (!isShallow(self2)) { + wrappedFn = /* @__PURE__ */ __name(function(acc, item3, index2) { + return fn.call(this, acc, toReactive$1(item3), index2, self2); + }, "wrappedFn"); + } else if (fn.length > 3) { + wrappedFn = /* @__PURE__ */ __name(function(acc, item3, index2) { + return fn.call(this, acc, item3, index2, self2); + }, "wrappedFn"); + } + } + return arr[method](wrappedFn, ...args); +} +__name(reduce, "reduce"); +function searchProxy(self2, method, args) { + const arr = toRaw(self2); + track(arr, "iterate", ARRAY_ITERATE_KEY); + const res = arr[method](...args); + if ((res === -1 || res === false) && isProxy(args[0])) { + args[0] = toRaw(args[0]); + return arr[method](...args); + } + return res; +} +__name(searchProxy, "searchProxy"); +function noTracking(self2, method, args = []) { + pauseTracking(); + startBatch(); + const res = toRaw(self2)[method].apply(self2, args); + endBatch(); + resetTracking(); + return res; +} +__name(noTracking, "noTracking"); 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 i2 = 0, l2 = this.length; i2 < l2; i2++) { - track(arr, "get", i2 + ""); - } - 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$c(key) { if (!isSymbol$1(key)) key = String(key); const obj = toRaw(this); @@ -32312,7 +33374,8 @@ class BaseReactiveHandler { this._isReadonly = _isReadonly; this._isShallow = _isShallow; } - get(target, key, receiver) { + get(target2, key, receiver) { + if (key === "__v_skip") return target2["__v_skip"]; const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow; if (key === "__v_isReactive") { return !isReadonly2; @@ -32321,28 +33384,36 @@ class BaseReactiveHandler { } 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; + if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target2) || // receiver is not the reactive proxy, but has the same prototype + // this means the receiver is a user proxy of the reactive proxy + Object.getPrototypeOf(target2) === Object.getPrototypeOf(receiver)) { + return target2; } return; } - const targetIsArray = isArray$9(target); + const targetIsArray = isArray$b(target2); if (!isReadonly2) { - if (targetIsArray && hasOwn$3(arrayInstrumentations, key)) { - return Reflect.get(arrayInstrumentations, key, receiver); + let fn; + if (targetIsArray && (fn = arrayInstrumentations[key])) { + return fn; } if (key === "hasOwnProperty") { return hasOwnProperty$c; } } - const res = Reflect.get(target, key, receiver); + const res = Reflect.get( + target2, + key, + // if this is a proxy wrapping a ref, return methods using the raw ref + // as receiver so that we don't have to call `toRaw` on the ref in all + // its class methods + isRef(target2) ? target2 : receiver + ); if (isSymbol$1(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { return res; } if (!isReadonly2) { - track(target, "get", key); + track(target2, "get", key); } if (isShallow2) { return res; @@ -32350,7 +33421,7 @@ class BaseReactiveHandler { if (isRef(res)) { return targetIsArray && isIntegerKey(key) ? res : res.value; } - if (isObject$d(res)) { + if (isObject$f(res)) { return isReadonly2 ? readonly(res) : reactive(res); } return res; @@ -32363,15 +33434,15 @@ class MutableReactiveHandler extends BaseReactiveHandler { constructor(isShallow2 = false) { super(false, isShallow2); } - set(target, key, value4, receiver) { - let oldValue2 = target[key]; + set(target2, key, value4, receiver) { + let oldValue2 = target2[key]; if (!this._isShallow) { const isOldValueReadonly = isReadonly(oldValue2); if (!isShallow(value4) && !isReadonly(value4)) { oldValue2 = toRaw(oldValue2); value4 = toRaw(value4); } - if (!isArray$9(target) && isRef(oldValue2) && !isRef(value4)) { + if (!isArray$b(target2) && isRef(oldValue2) && !isRef(value4)) { if (isOldValueReadonly) { return false; } else { @@ -32380,40 +33451,45 @@ class MutableReactiveHandler extends BaseReactiveHandler { } } } - const hadKey = isArray$9(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn$3(target, key); - const result = Reflect.set(target, key, value4, receiver); - if (target === toRaw(receiver)) { + const hadKey = isArray$b(target2) && isIntegerKey(key) ? Number(key) < target2.length : hasOwn$3(target2, key); + const result = Reflect.set( + target2, + key, + value4, + isRef(target2) ? target2 : receiver + ); + if (target2 === toRaw(receiver)) { if (!hadKey) { - trigger(target, "add", key, value4); + trigger(target2, "add", key, value4); } else if (hasChanged(value4, oldValue2)) { - trigger(target, "set", key, value4, oldValue2); + trigger(target2, "set", key, value4, oldValue2); } } return result; } - deleteProperty(target, key) { - const hadKey = hasOwn$3(target, key); - const oldValue2 = target[key]; - const result = Reflect.deleteProperty(target, key); + deleteProperty(target2, key) { + const hadKey = hasOwn$3(target2, key); + const oldValue2 = target2[key]; + const result = Reflect.deleteProperty(target2, key); if (result && hadKey) { - trigger(target, "delete", key, void 0, oldValue2); + trigger(target2, "delete", key, void 0, oldValue2); } return result; } - has(target, key) { - const result = Reflect.has(target, key); + has(target2, key) { + const result = Reflect.has(target2, key); if (!isSymbol$1(key) || !builtInSymbols.has(key)) { - track(target, "has", key); + track(target2, "has", key); } return result; } - ownKeys(target) { + ownKeys(target2) { track( - target, + target2, "iterate", - isArray$9(target) ? "length" : ITERATE_KEY + isArray$b(target2) ? "length" : ITERATE_KEY ); - return Reflect.ownKeys(target); + return Reflect.ownKeys(target2); } } class ReadonlyReactiveHandler extends BaseReactiveHandler { @@ -32423,20 +33499,20 @@ class ReadonlyReactiveHandler extends BaseReactiveHandler { constructor(isShallow2 = false) { super(true, isShallow2); } - set(target, key) { + set(target2, key) { if (false) { warn$4( `Set operation on key "${String(key)}" failed: target is readonly.`, - target + target2 ); } return true; } - deleteProperty(target, key) { + deleteProperty(target2, key) { if (false) { warn$4( `Delete operation on key "${String(key)}" failed: target is readonly.`, - target + target2 ); } return true; @@ -32444,135 +33520,18 @@ class ReadonlyReactiveHandler extends BaseReactiveHandler { } const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); -const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler( - true -); +const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true); const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true); const toShallow = /* @__PURE__ */ __name((value4) => value4, "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 wrap2 = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive$1; - if (has2.call(rawTarget, key)) { - return wrap2(target.get(key)); - } else if (has2.call(rawTarget, rawKey)) { - return wrap2(target.get(rawKey)); - } else if (target !== rawTarget) { - target.get(key); - } -} -__name(get$3, "get$3"); -function has$1(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$1, "has$1"); -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$1(value4) { - value4 = toRaw(value4); - const target = toRaw(this); - const proto = getProto(target); - const hadKey = proto.has.call(target, value4); - if (!hadKey) { - target.add(value4); - trigger(target, "add", value4, value4); - } - return this; -} -__name(add$1, "add$1"); -function set$4(key, value4) { - value4 = toRaw(value4); - const target = toRaw(this); - const { has: has2, get: get22 } = 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 = get22.call(target, key); - target.set(key, value4); - if (!hadKey) { - trigger(target, "add", key, value4); - } else if (hasChanged(value4, oldValue2)) { - trigger(target, "set", key, value4, oldValue2); - } - return this; -} -__name(set$4, "set$4"); -function deleteEntry(key) { - const target = toRaw(this); - const { has: has2, get: get22 } = 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 = get22 ? get22.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$3(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 forEach3(callback, thisArg) { - const observed = this; - const target = observed["__v_raw"]; - const rawTarget = toRaw(target); - const wrap2 = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive$1; - !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY); - return target.forEach((value4, key) => { - return callback.call(thisArg, wrap2(value4), wrap2(key), observed); - }); - }, "forEach"); -} -__name(createForEach, "createForEach"); function createIterableMethod(method, isReadonly2, isShallow2) { return function(...args) { - const target = this["__v_raw"]; - const rawTarget = toRaw(target); + const target2 = this["__v_raw"]; + const rawTarget = toRaw(target2); const targetIsMap = isMap$3(rawTarget); const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; const isKeyOnly = method === "keys" && targetIsMap; - const innerIterator = target[method](...args); + const innerIterator = target2[method](...args); const wrap2 = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive$1; !isReadonly2 && track( rawTarget, @@ -32609,67 +33568,134 @@ function createReadonlyMethod(type) { }; } __name(createReadonlyMethod, "createReadonlyMethod"); -function createInstrumentations() { - const mutableInstrumentations2 = { +function createInstrumentations(readonly2, shallow) { + const instrumentations = { get(key) { - return get$3(this, key); + const target2 = this["__v_raw"]; + const rawTarget = toRaw(target2); + const rawKey = toRaw(key); + if (!readonly2) { + if (hasChanged(key, rawKey)) { + track(rawTarget, "get", key); + } + track(rawTarget, "get", rawKey); + } + const { has: has2 } = getProto(rawTarget); + const wrap2 = shallow ? toShallow : readonly2 ? toReadonly : toReactive$1; + if (has2.call(rawTarget, key)) { + return wrap2(target2.get(key)); + } else if (has2.call(rawTarget, rawKey)) { + return wrap2(target2.get(rawKey)); + } else if (target2 !== rawTarget) { + target2.get(key); + } }, get size() { - return size(this); - }, - has: has$1, - add: add$1, - 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: has$1, - add: add$1, - 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); + const target2 = this["__v_raw"]; + !readonly2 && track(toRaw(target2), "iterate", ITERATE_KEY); + return Reflect.get(target2, "size", target2); }, has(key) { - return has$1.call(this, key, true); + const target2 = this["__v_raw"]; + const rawTarget = toRaw(target2); + const rawKey = toRaw(key); + if (!readonly2) { + if (hasChanged(key, rawKey)) { + track(rawTarget, "has", key); + } + track(rawTarget, "has", rawKey); + } + return key === rawKey ? target2.has(key) : target2.has(key) || target2.has(rawKey); }, - 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$1.call(this, key, true); - }, - add: createReadonlyMethod("add"), - set: createReadonlyMethod("set"), - delete: createReadonlyMethod("delete"), - clear: createReadonlyMethod("clear"), - forEach: createForEach(true, true) + forEach(callback, thisArg) { + const observed = this; + const target2 = observed["__v_raw"]; + const rawTarget = toRaw(target2); + const wrap2 = shallow ? toShallow : readonly2 ? toReadonly : toReactive$1; + !readonly2 && track(rawTarget, "iterate", ITERATE_KEY); + return target2.forEach((value4, key) => { + return callback.call(thisArg, wrap2(value4), wrap2(key), observed); + }); + } }; + extend$1( + instrumentations, + readonly2 ? { + add: createReadonlyMethod("add"), + set: createReadonlyMethod("set"), + delete: createReadonlyMethod("delete"), + clear: createReadonlyMethod("clear") + } : { + add(value4) { + if (!shallow && !isShallow(value4) && !isReadonly(value4)) { + value4 = toRaw(value4); + } + const target2 = toRaw(this); + const proto = getProto(target2); + const hadKey = proto.has.call(target2, value4); + if (!hadKey) { + target2.add(value4); + trigger(target2, "add", value4, value4); + } + return this; + }, + set(key, value4) { + if (!shallow && !isShallow(value4) && !isReadonly(value4)) { + value4 = toRaw(value4); + } + const target2 = toRaw(this); + const { has: has2, get: get3 } = getProto(target2); + let hadKey = has2.call(target2, key); + if (!hadKey) { + key = toRaw(key); + hadKey = has2.call(target2, key); + } else if (false) { + checkIdentityKeys(target2, has2, key); + } + const oldValue2 = get3.call(target2, key); + target2.set(key, value4); + if (!hadKey) { + trigger(target2, "add", key, value4); + } else if (hasChanged(value4, oldValue2)) { + trigger(target2, "set", key, value4, oldValue2); + } + return this; + }, + delete(key) { + const target2 = toRaw(this); + const { has: has2, get: get3 } = getProto(target2); + let hadKey = has2.call(target2, key); + if (!hadKey) { + key = toRaw(key); + hadKey = has2.call(target2, key); + } else if (false) { + checkIdentityKeys(target2, has2, key); + } + const oldValue2 = get3 ? get3.call(target2, key) : void 0; + const result = target2.delete(key); + if (hadKey) { + trigger(target2, "delete", key, void 0, oldValue2); + } + return result; + }, + clear() { + const target2 = toRaw(this); + const hadItems = target2.size !== 0; + const oldTarget = false ? isMap$3(target2) ? new Map(target2) : new Set(target2) : void 0; + const result = target2.clear(); + if (hadItems) { + trigger( + target2, + "clear", + void 0, + void 0, + oldTarget + ); + } + return result; + } + } + ); const iteratorMethods = [ "keys", "values", @@ -32677,41 +33703,23 @@ function createInstrumentations() { 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 - ); + instrumentations[method] = createIterableMethod(method, readonly2, shallow); }); - return [ - mutableInstrumentations2, - readonlyInstrumentations2, - shallowInstrumentations2, - shallowReadonlyInstrumentations2 - ]; + return instrumentations; } __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) => { + const instrumentations = createInstrumentations(isReadonly2, shallow); + return (target2, key, receiver) => { if (key === "__v_isReactive") { return !isReadonly2; } else if (key === "__v_isReadonly") { return isReadonly2; } else if (key === "__v_raw") { - return target; + return target2; } return Reflect.get( - hasOwn$3(instrumentations, key) && key in target ? instrumentations : target, + hasOwn$3(instrumentations, key) && key in target2 ? instrumentations : target2, key, receiver ); @@ -32730,10 +33738,10 @@ const readonlyCollectionHandlers = { const shallowReadonlyCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(true, true) }; -function checkIdentityKeys(target, has2, key) { +function checkIdentityKeys(target2, has2, key) { const rawKey = toRaw(key); - if (rawKey !== key && has2.call(target, rawKey)) { - const type = toRawType(target); + if (rawKey !== key && has2.call(target2, rawKey)) { + const type = toRawType(target2); warn$4( `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.` ); @@ -32763,12 +33771,12 @@ function getTargetType(value4) { return value4["__v_skip"] || !Object.isExtensible(value4) ? 0 : targetTypeMap(toRawType(value4)); } __name(getTargetType, "getTargetType"); -function reactive(target) { - if (isReadonly(target)) { - return target; +function reactive(target2) { + if (isReadonly(target2)) { + return target2; } return createReactiveObject( - target, + target2, false, mutableHandlers, mutableCollectionHandlers, @@ -32776,9 +33784,9 @@ function reactive(target) { ); } __name(reactive, "reactive"); -function shallowReactive(target) { +function shallowReactive(target2) { return createReactiveObject( - target, + target2, false, shallowReactiveHandlers, shallowCollectionHandlers, @@ -32786,9 +33794,9 @@ function shallowReactive(target) { ); } __name(shallowReactive, "shallowReactive"); -function readonly(target) { +function readonly(target2) { return createReactiveObject( - target, + target2, true, readonlyHandlers, readonlyCollectionHandlers, @@ -32796,9 +33804,9 @@ function readonly(target) { ); } __name(readonly, "readonly"); -function shallowReadonly(target) { +function shallowReadonly(target2) { return createReactiveObject( - target, + target2, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, @@ -32806,33 +33814,33 @@ function shallowReadonly(target) { ); } __name(shallowReadonly, "shallowReadonly"); -function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { - if (!isObject$d(target)) { +function createReactiveObject(target2, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { + if (!isObject$f(target2)) { if (false) { warn$4( `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String( - target + target2 )}` ); } - return target; + return target2; } - if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { - return target; + if (target2["__v_raw"] && !(isReadonly2 && target2["__v_isReactive"])) { + return target2; } - const existingProxy = proxyMap.get(target); + const existingProxy = proxyMap.get(target2); if (existingProxy) { return existingProxy; } - const targetType = getTargetType(target); + const targetType = getTargetType(target2); if (targetType === 0) { - return target; + return target2; } const proxy = new Proxy( - target, + target2, targetType === 2 ? collectionHandlers : baseHandlers ); - proxyMap.set(target, proxy); + proxyMap.set(target2, proxy); return proxy; } __name(createReactiveObject, "createReactiveObject"); @@ -32861,124 +33869,16 @@ function toRaw(observed) { } __name(toRaw, "toRaw"); function markRaw(value4) { - if (Object.isExtensible(value4)) { + if (!hasOwn$3(value4, "__v_skip") && Object.isExtensible(value4)) { def(value4, "__v_skip", true); } return value4; } __name(markRaw, "markRaw"); -const toReactive$1 = /* @__PURE__ */ __name((value4) => isObject$d(value4) ? reactive(value4) : value4, "toReactive$1"); -const toReadonly = /* @__PURE__ */ __name((value4) => isObject$d(value4) ? readonly(value4) : value4, "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$4(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$8(getterOrOptions); - if (onlyGetter) { - getter = getterOrOptions; - setter = false ? () => { - warn$4("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 _a2; - if (shouldTrack && activeEffect) { - ref2 = toRaw(ref2); - trackEffect( - activeEffect, - (_a2 = ref2.dep) != null ? _a2 : 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"); +const toReactive$1 = /* @__PURE__ */ __name((value4) => isObject$f(value4) ? reactive(value4) : value4, "toReactive$1"); +const toReadonly = /* @__PURE__ */ __name((value4) => isObject$f(value4) ? readonly(value4) : value4, "toReadonly"); function isRef(r2) { - return !!(r2 && r2.__v_isRef === true); + return r2 ? r2["__v_isRef"] === true : false; } __name(isRef, "isRef"); function ref(value4) { @@ -33000,49 +33900,79 @@ class RefImpl { static { __name(this, "RefImpl"); } - constructor(value4, __v_isShallow) { - this.__v_isShallow = __v_isShallow; - this.dep = void 0; - this.__v_isRef = true; - this._rawValue = __v_isShallow ? value4 : toRaw(value4); - this._value = __v_isShallow ? value4 : toReactive$1(value4); + constructor(value4, isShallow2) { + this.dep = new Dep(); + this["__v_isRef"] = true; + this["__v_isShallow"] = false; + this._rawValue = isShallow2 ? value4 : toRaw(value4); + this._value = isShallow2 ? value4 : toReactive$1(value4); + this["__v_isShallow"] = isShallow2; } get value() { - trackRefValue(this); + if (false) { + this.dep.track({ + target: this, + type: "get", + key: "value" + }); + } else { + this.dep.track(); + } 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); + set value(newValue2) { + const oldValue2 = this._rawValue; + const useDirectValue = this["__v_isShallow"] || isShallow(newValue2) || isReadonly(newValue2); + newValue2 = useDirectValue ? newValue2 : toRaw(newValue2); + if (hasChanged(newValue2, oldValue2)) { + this._rawValue = newValue2; + this._value = useDirectValue ? newValue2 : toReactive$1(newValue2); + if (false) { + this.dep.trigger({ + target: this, + type: "set", + key: "value", + newValue: newValue2, + oldValue: oldValue2 + }); + } else { + this.dep.trigger(); + } } } } function triggerRef(ref2) { - triggerRefValue(ref2, 4, false ? ref2.value : void 0); + if (ref2.dep) { + if (false) { + ref2.dep.trigger({ + target: ref2, + type: "set", + key: "value", + newValue: ref2._value + }); + } else { + ref2.dep.trigger(); + } + } } __name(triggerRef, "triggerRef"); function unref(ref2) { return isRef(ref2) ? ref2.value : ref2; } __name(unref, "unref"); -function toValue$1(source) { - return isFunction$8(source) ? source() : unref(source); +function toValue$4(source) { + return isFunction$c(source) ? source() : unref(source); } -__name(toValue$1, "toValue$1"); +__name(toValue$4, "toValue$4"); const shallowUnwrapHandlers = { - get: /* @__PURE__ */ __name((target, key, receiver) => unref(Reflect.get(target, key, receiver)), "get"), - set: /* @__PURE__ */ __name((target, key, value4, receiver) => { - const oldValue2 = target[key]; + get: /* @__PURE__ */ __name((target2, key, receiver) => key === "__v_raw" ? target2 : unref(Reflect.get(target2, key, receiver)), "get"), + set: /* @__PURE__ */ __name((target2, key, value4, receiver) => { + const oldValue2 = target2[key]; if (isRef(oldValue2) && !isRef(value4)) { oldValue2.value = value4; return true; } else { - return Reflect.set(target, key, value4, receiver); + return Reflect.set(target2, key, value4, receiver); } }, "set") }; @@ -33055,17 +33985,15 @@ class CustomRefImpl { __name(this, "CustomRefImpl"); } constructor(factory) { - this.dep = void 0; - this.__v_isRef = true; - const { get: get22, set: set22 } = factory( - () => trackRefValue(this), - () => triggerRefValue(this) - ); - this._get = get22; - this._set = set22; + this["__v_isRef"] = true; + this._value = void 0; + const dep = this.dep = new Dep(); + const { get: get3, set: set3 } = factory(dep.track.bind(dep), dep.trigger.bind(dep)); + this._get = get3; + this._set = set3; } get value() { - return this._get(); + return this._value = this._get(); } set value(newVal) { this._set(newVal); @@ -33079,7 +34007,7 @@ function toRefs$1(object) { if (false) { warn$4(`toRefs() expects a reactive object but received a plain one.`); } - const ret = isArray$9(object) ? new Array(object.length) : {}; + const ret = isArray$b(object) ? new Array(object.length) : {}; for (const key in object) { ret[key] = propertyToRef(object, key); } @@ -33094,11 +34022,12 @@ class ObjectRefImpl { this._object = _object; this._key = _key; this._defaultValue = _defaultValue; - this.__v_isRef = true; + this["__v_isRef"] = true; + this._value = void 0; } get value() { const val = this._object[this._key]; - return val === void 0 ? this._defaultValue : val; + return this._value = val === void 0 ? this._defaultValue : val; } set value(newVal) { this._object[this._key] = newVal; @@ -33113,31 +34042,98 @@ class GetterRefImpl { } constructor(_getter) { this._getter = _getter; - this.__v_isRef = true; - this.__v_isReadonly = true; + this["__v_isRef"] = true; + this["__v_isReadonly"] = true; + this._value = void 0; } get value() { - return this._getter(); + return this._value = this._getter(); } } -function toRef$1(source, key, defaultValue) { +function toRef$1(source, key, defaultValue2) { if (isRef(source)) { return source; - } else if (isFunction$8(source)) { + } else if (isFunction$c(source)) { return new GetterRefImpl(source); - } else if (isObject$d(source) && arguments.length > 1) { - return propertyToRef(source, key, defaultValue); + } else if (isObject$f(source) && arguments.length > 1) { + return propertyToRef(source, key, defaultValue2); } else { return ref(source); } } __name(toRef$1, "toRef$1"); -function propertyToRef(source, key, defaultValue) { +function propertyToRef(source, key, defaultValue2) { const val = source[key]; - return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue); + return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue2); } __name(propertyToRef, "propertyToRef"); -const deferredComputed = computed$1; +class ComputedRefImpl { + static { + __name(this, "ComputedRefImpl"); + } + constructor(fn, setter, isSSR) { + this.fn = fn; + this.setter = setter; + this._value = void 0; + this.dep = new Dep(this); + this.__v_isRef = true; + this.deps = void 0; + this.depsTail = void 0; + this.flags = 16; + this.globalVersion = globalVersion - 1; + this.next = void 0; + this.effect = this; + this["__v_isReadonly"] = !setter; + this.isSSR = isSSR; + } + /** + * @internal + */ + notify() { + this.flags |= 16; + if (!(this.flags & 8) && // avoid infinite self recursion + activeSub !== this) { + batch(this, true); + return true; + } else if (false) ; + } + get value() { + const link2 = false ? this.dep.track({ + target: this, + type: "get", + key: "value" + }) : this.dep.track(); + refreshComputed(this); + if (link2) { + link2.version = this.dep.version; + } + return this._value; + } + set value(newValue2) { + if (this.setter) { + this.setter(newValue2); + } else if (false) { + warn$4("Write operation failed: computed value is readonly"); + } + } +} +function computed$1(getterOrOptions, debugOptions, isSSR = false) { + let getter; + let setter; + if (isFunction$c(getterOrOptions)) { + getter = getterOrOptions; + } else { + getter = getterOrOptions.get; + setter = getterOrOptions.set; + } + const cRef = new ComputedRefImpl(getter, setter, isSSR); + if (false) { + cRef.onTrack = debugOptions.onTrack; + cRef.onTrigger = debugOptions.onTrigger; + } + return cRef; +} +__name(computed$1, "computed$1"); const TrackOpTypes = { "GET": "get", "HAS": "has", @@ -33154,10 +34150,226 @@ const ReactiveFlags = { "IS_REACTIVE": "__v_isReactive", "IS_READONLY": "__v_isReadonly", "IS_SHALLOW": "__v_isShallow", - "RAW": "__v_raw" + "RAW": "__v_raw", + "IS_REF": "__v_isRef" }; +const WatchErrorCodes = { + "WATCH_GETTER": 2, + "2": "WATCH_GETTER", + "WATCH_CALLBACK": 3, + "3": "WATCH_CALLBACK", + "WATCH_CLEANUP": 4, + "4": "WATCH_CLEANUP" +}; +const INITIAL_WATCHER_VALUE = {}; +const cleanupMap = /* @__PURE__ */ new WeakMap(); +let activeWatcher = void 0; +function getCurrentWatcher() { + return activeWatcher; +} +__name(getCurrentWatcher, "getCurrentWatcher"); +function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) { + if (owner) { + let cleanups = cleanupMap.get(owner); + if (!cleanups) cleanupMap.set(owner, cleanups = []); + cleanups.push(cleanupFn); + } else if (false) { + warn$4( + `onWatcherCleanup() was called when there was no active watcher to associate with.` + ); + } +} +__name(onWatcherCleanup, "onWatcherCleanup"); +function watch$1(source, cb, options4 = EMPTY_OBJ) { + const { immediate, deep, once: once2, scheduler, augmentJob, call } = options4; + const warnInvalidSource = /* @__PURE__ */ __name((s2) => { + (options4.onWarn || warn$4)( + `Invalid watch source: `, + s2, + `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.` + ); + }, "warnInvalidSource"); + const reactiveGetter = /* @__PURE__ */ __name((source2) => { + if (deep) return source2; + if (isShallow(source2) || deep === false || deep === 0) + return traverse(source2, 1); + return traverse(source2); + }, "reactiveGetter"); + let effect2; + let getter; + let cleanup; + let boundCleanup; + let forceTrigger = false; + let isMultiSource = false; + if (isRef(source)) { + getter = /* @__PURE__ */ __name(() => source.value, "getter"); + forceTrigger = isShallow(source); + } else if (isReactive(source)) { + getter = /* @__PURE__ */ __name(() => reactiveGetter(source), "getter"); + forceTrigger = true; + } else if (isArray$b(source)) { + isMultiSource = true; + forceTrigger = source.some((s2) => isReactive(s2) || isShallow(s2)); + getter = /* @__PURE__ */ __name(() => source.map((s2) => { + if (isRef(s2)) { + return s2.value; + } else if (isReactive(s2)) { + return reactiveGetter(s2); + } else if (isFunction$c(s2)) { + return call ? call(s2, 2) : s2(); + } else { + } + }), "getter"); + } else if (isFunction$c(source)) { + if (cb) { + getter = call ? () => call(source, 2) : source; + } else { + getter = /* @__PURE__ */ __name(() => { + if (cleanup) { + pauseTracking(); + try { + cleanup(); + } finally { + resetTracking(); + } + } + const currentEffect = activeWatcher; + activeWatcher = effect2; + try { + return call ? call(source, 3, [boundCleanup]) : source(boundCleanup); + } finally { + activeWatcher = currentEffect; + } + }, "getter"); + } + } else { + getter = NOOP; + } + if (cb && deep) { + const baseGetter = getter; + const depth = deep === true ? Infinity : deep; + getter = /* @__PURE__ */ __name(() => traverse(baseGetter(), depth), "getter"); + } + const scope = getCurrentScope(); + const watchHandle = /* @__PURE__ */ __name(() => { + effect2.stop(); + if (scope && scope.active) { + remove$2(scope.effects, effect2); + } + }, "watchHandle"); + if (once2 && cb) { + const _cb = cb; + cb = /* @__PURE__ */ __name((...args) => { + _cb(...args); + watchHandle(); + }, "cb"); + } + let oldValue2 = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE; + const job = /* @__PURE__ */ __name((immediateFirstRun) => { + if (!(effect2.flags & 1) || !effect2.dirty && !immediateFirstRun) { + return; + } + if (cb) { + const newValue2 = effect2.run(); + if (deep || forceTrigger || (isMultiSource ? newValue2.some((v2, i2) => hasChanged(v2, oldValue2[i2])) : hasChanged(newValue2, oldValue2))) { + if (cleanup) { + cleanup(); + } + const currentWatcher = activeWatcher; + activeWatcher = effect2; + try { + const args = [ + newValue2, + // pass undefined as the old value when it's changed for the first time + oldValue2 === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue2[0] === INITIAL_WATCHER_VALUE ? [] : oldValue2, + boundCleanup + ]; + call ? call(cb, 3, args) : ( + // @ts-expect-error + cb(...args) + ); + oldValue2 = newValue2; + } finally { + activeWatcher = currentWatcher; + } + } + } else { + effect2.run(); + } + }, "job"); + if (augmentJob) { + augmentJob(job); + } + effect2 = new ReactiveEffect(getter); + effect2.scheduler = scheduler ? () => scheduler(job, false) : job; + boundCleanup = /* @__PURE__ */ __name((fn) => onWatcherCleanup(fn, false, effect2), "boundCleanup"); + cleanup = effect2.onStop = () => { + const cleanups = cleanupMap.get(effect2); + if (cleanups) { + if (call) { + call(cleanups, 4); + } else { + for (const cleanup2 of cleanups) cleanup2(); + } + cleanupMap.delete(effect2); + } + }; + if (false) { + effect2.onTrack = options4.onTrack; + effect2.onTrigger = options4.onTrigger; + } + if (cb) { + if (immediate) { + job(true); + } else { + oldValue2 = effect2.run(); + } + } else if (scheduler) { + scheduler(job.bind(null, true), true); + } else { + effect2.run(); + } + watchHandle.pause = effect2.pause.bind(effect2); + watchHandle.resume = effect2.resume.bind(effect2); + watchHandle.stop = watchHandle; + return watchHandle; +} +__name(watch$1, "watch$1"); +function traverse(value4, depth = Infinity, seen2) { + if (depth <= 0 || !isObject$f(value4) || value4["__v_skip"]) { + return value4; + } + seen2 = seen2 || /* @__PURE__ */ new Set(); + if (seen2.has(value4)) { + return value4; + } + seen2.add(value4); + depth--; + if (isRef(value4)) { + traverse(value4.value, depth, seen2); + } else if (isArray$b(value4)) { + for (let i2 = 0; i2 < value4.length; i2++) { + traverse(value4[i2], depth, seen2); + } + } else if (isSet$3(value4) || isMap$3(value4)) { + value4.forEach((v2) => { + traverse(v2, depth, seen2); + }); + } else if (isPlainObject$4(value4)) { + for (const key in value4) { + traverse(value4[key], depth, seen2); + } + for (const key of Object.getOwnPropertySymbols(value4)) { + if (Object.prototype.propertyIsEnumerable.call(value4, key)) { + traverse(value4[key], depth, seen2); + } + } + } + return value4; +} +__name(traverse, "traverse"); /** -* @vue/runtime-core v3.4.31 +* @vue/runtime-core v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/ @@ -33170,7 +34382,10 @@ function popWarningContext() { stack.pop(); } __name(popWarningContext, "popWarningContext"); +let isWarning = false; function warn$1$1(msg, ...args) { + if (isWarning) return; + isWarning = true; pauseTracking(); const instance = stack.length ? stack[stack.length - 1].component : null; const appWarnHandler = instance && instance.appContext.config.warnHandler; @@ -33203,6 +34418,7 @@ function warn$1$1(msg, ...args) { console.warn(...warnArgs); } resetTracking(); + isWarning = false; } __name(warn$1$1, "warn$1$1"); function getComponentTrace() { @@ -33261,7 +34477,7 @@ function formatProps(props) { } __name(formatProps, "formatProps"); function formatProp(key, value4, raw) { - if (isString$7(value4)) { + if (isString$9(value4)) { value4 = JSON.stringify(value4); return raw ? value4 : [`${key}=${value4}`]; } else if (typeof value4 === "number" || typeof value4 === "boolean" || value4 == null) { @@ -33269,7 +34485,7 @@ function formatProp(key, value4, raw) { } else if (isRef(value4)) { value4 = formatProp(key, toRaw(value4.value), true); return raw ? value4 : [`${key}=Ref<`, value4, `>`]; - } else if (isFunction$8(value4)) { + } else if (isFunction$c(value4)) { return [`${key}=fn${value4.name ? `<${value4.name}>` : ``}`]; } else { value4 = toRaw(value4); @@ -33293,12 +34509,6 @@ const ErrorCodes = { "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, @@ -33318,7 +34528,11 @@ const ErrorCodes = { "ASYNC_COMPONENT_LOADER": 13, "13": "ASYNC_COMPONENT_LOADER", "SCHEDULER": 14, - "14": "SCHEDULER" + "14": "SCHEDULER", + "COMPONENT_UPDATE": 15, + "15": "COMPONENT_UPDATE", + "APP_UNMOUNT_CLEANUP": 16, + "16": "APP_UNMOUNT_CLEANUP" }; const ErrorTypeStrings$1 = { ["sp"]: "serverPrefetch hook", @@ -33349,7 +34563,9 @@ const ErrorTypeStrings$1 = { [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 ." + [14]: "scheduler flush", + [15]: "component update", + [16]: "app unmount cleanup function" }; function callWithErrorHandling(fn, instance, type, args) { try { @@ -33360,7 +34576,7 @@ function callWithErrorHandling(fn, instance, type, args) { } __name(callWithErrorHandling, "callWithErrorHandling"); function callWithAsyncErrorHandling(fn, instance, type, args) { - if (isFunction$8(fn)) { + if (isFunction$c(fn)) { const res = callWithErrorHandling(fn, instance, type, args); if (res && isPromise$1(res)) { res.catch((err) => { @@ -33369,7 +34585,7 @@ function callWithAsyncErrorHandling(fn, instance, type, args) { } return res; } - if (isArray$9(fn)) { + if (isArray$b(fn)) { const values = []; for (let i2 = 0; i2 < fn.length; i2++) { values.push(callWithAsyncErrorHandling(fn[i2], instance, type, args)); @@ -33384,6 +34600,7 @@ function callWithAsyncErrorHandling(fn, instance, type, args) { __name(callWithAsyncErrorHandling, "callWithAsyncErrorHandling"); function handleError(err, instance, type, throwInDev = true) { const contextVNode = instance ? instance.vnode : null; + const { errorHandler: errorHandler2, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ; if (instance) { let cur = instance.parent; const exposedInstance = instance.proxy; @@ -33399,23 +34616,21 @@ function handleError(err, instance, type, throwInDev = true) { } cur = cur.parent; } - const appErrorHandler = instance.appContext.config.errorHandler; - if (appErrorHandler) { + if (errorHandler2) { pauseTracking(); - callWithErrorHandling( - appErrorHandler, - null, - 10, - [err, exposedInstance, errorInfo] - ); + callWithErrorHandling(errorHandler2, null, 10, [ + err, + exposedInstance, + errorInfo + ]); resetTracking(); return; } } - logError(err, type, contextVNode, throwInDev); + logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction); } __name(handleError, "handleError"); -function logError(err, type, contextVNode, throwInDev = true) { +function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) { if (false) { const info = ErrorTypeStrings$1[type]; if (contextVNode) { @@ -33430,15 +34645,15 @@ function logError(err, type, contextVNode, throwInDev = true) { } else { console.error(err); } + } else if (throwInProd) { + throw err; } else { console.error(err); } } __name(logError, "logError"); -let isFlushing = false; -let isFlushPending = false; const queue = []; -let flushIndex = 0; +let flushIndex = -1; const pendingPostFlushCbs = []; let activePostFlushCbs = null; let postFlushIndex = 0; @@ -33457,7 +34672,7 @@ function findInsertionIndex$1(id3) { const middle = start2 + end >>> 1; const middleJob = queue[middle]; const middleJobId = getId(middleJob); - if (middleJobId < id3 || middleJobId === id3 && middleJob.pre) { + if (middleJobId < id3 || middleJobId === id3 && middleJob.flags & 2) { start2 = middle + 1; } else { end = middle; @@ -33467,40 +34682,33 @@ function findInsertionIndex$1(id3) { } __name(findInsertionIndex$1, "findInsertionIndex$1"); function queueJob(job) { - if (!queue.length || !queue.includes( - job, - isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex - )) { - if (job.id == null) { + if (!(job.flags & 1)) { + const jobId = getId(job); + const lastJob = queue[queue.length - 1]; + if (!lastJob || // fast path when the job id is larger than the tail + !(job.flags & 2) && jobId >= getId(lastJob)) { queue.push(job); } else { - queue.splice(findInsertionIndex$1(job.id), 0, job); + queue.splice(findInsertionIndex$1(jobId), 0, job); } + job.flags |= 1; queueFlush(); } } __name(queueJob, "queueJob"); function queueFlush() { - if (!isFlushing && !isFlushPending) { - isFlushPending = true; + if (!currentFlushPromise) { currentFlushPromise = resolvedPromise.then(flushJobs); } } __name(queueFlush, "queueFlush"); -function invalidateJob(job) { - const i2 = queue.indexOf(job); - if (i2 > flushIndex) { - queue.splice(i2, 1); - } -} -__name(invalidateJob, "invalidateJob"); function queuePostFlushCb(cb) { - if (!isArray$9(cb)) { - if (!activePostFlushCbs || !activePostFlushCbs.includes( - cb, - cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex - )) { + if (!isArray$b(cb)) { + if (activePostFlushCbs && cb.id === -1) { + activePostFlushCbs.splice(postFlushIndex + 1, 0, cb); + } else if (!(cb.flags & 1)) { pendingPostFlushCbs.push(cb); + cb.flags |= 1; } } else { pendingPostFlushCbs.push(...cb); @@ -33508,13 +34716,13 @@ function queuePostFlushCb(cb) { queueFlush(); } __name(queuePostFlushCb, "queuePostFlushCb"); -function flushPreFlushCbs(instance, seen2, i2 = isFlushing ? flushIndex + 1 : 0) { +function flushPreFlushCbs(instance, seen2, i2 = flushIndex + 1) { if (false) { seen2 = seen2 || /* @__PURE__ */ new Map(); } for (; i2 < queue.length; i2++) { const cb = queue[i2]; - if (cb && cb.pre) { + if (cb && cb.flags & 2) { if (instance && cb.id !== instance.uid) { continue; } @@ -33523,7 +34731,13 @@ function flushPreFlushCbs(instance, seen2, i2 = isFlushing ? flushIndex + 1 : 0) } queue.splice(i2, 1); i2--; + if (cb.flags & 4) { + cb.flags &= ~1; + } cb(); + if (!(cb.flags & 4)) { + cb.flags &= ~1; + } } } } @@ -33547,45 +34761,53 @@ function flushPostFlushCbs(seen2) { if (false) { continue; } - if (cb.active !== false) cb(); + if (cb.flags & 4) { + cb.flags &= ~1; + } + if (!(cb.flags & 8)) cb(); + cb.flags &= ~1; } activePostFlushCbs = null; postFlushIndex = 0; } } __name(flushPostFlushCbs, "flushPostFlushCbs"); -const getId = /* @__PURE__ */ __name((job) => job.id == null ? Infinity : job.id, "getId"); -const comparator = /* @__PURE__ */ __name((a2, b2) => { - const diff2 = getId(a2) - getId(b2); - if (diff2 === 0) { - if (a2.pre && !b2.pre) return -1; - if (b2.pre && !a2.pre) return 1; - } - return diff2; -}, "comparator"); +const getId = /* @__PURE__ */ __name((job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id, "getId"); 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 (job && !(job.flags & 8)) { if (false) { continue; } - callWithErrorHandling(job, null, 14); + if (job.flags & 4) { + job.flags &= ~1; + } + callWithErrorHandling( + job, + job.i, + job.i ? 15 : 14 + ); + if (!(job.flags & 4)) { + job.flags &= ~1; + } } } } finally { - flushIndex = 0; + for (; flushIndex < queue.length; flushIndex++) { + const job = queue[flushIndex]; + if (job) { + job.flags &= ~1; + } + } + flushIndex = -1; queue.length = 0; flushPostFlushCbs(seen2); - isFlushing = false; currentFlushPromise = null; if (queue.length || pendingPostFlushCbs.length) { flushJobs(seen2); @@ -33594,27 +34816,23 @@ function 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); - } + const count = seen2.get(fn) || 0; + if (count > RECURSION_LIMIT) { + const instance = fn.i; + 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; } + seen2.set(fn, count + 1); + return false; } __name(checkRecursiveUpdates, "checkRecursiveUpdates"); let isHmrUpdating = false; -const hmrDirtyComponents = /* @__PURE__ */ new Set(); +const hmrDirtyComponents = /* @__PURE__ */ new Map(); if (false) { getGlobalThis$1().__VUE_HMR_RUNTIME__ = { createRecord: tryWrap(createRecord), @@ -33665,7 +34883,6 @@ function rerender(id3, newRender) { } instance.renderCache = []; isHmrUpdating = true; - instance.effect.dirty = true; instance.update(); isHmrUpdating = false; }); @@ -33677,26 +34894,30 @@ function reload(id3, newComp) { newComp = normalizeClassComponent(newComp); updateComponentDef(record2.initialDef, newComp); const instances = [...record2.instances]; - for (const instance of instances) { + for (let i2 = 0; i2 < instances.length; i2++) { + const instance = instances[i2]; const oldComp = normalizeClassComponent(instance.type); - if (!hmrDirtyComponents.has(oldComp)) { + let dirtyInstances = hmrDirtyComponents.get(oldComp); + if (!dirtyInstances) { if (oldComp !== record2.initialDef) { updateComponentDef(oldComp, newComp); } - hmrDirtyComponents.add(oldComp); + hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set()); } + dirtyInstances.add(instance); instance.appContext.propsCache.delete(instance.type); instance.appContext.emitsCache.delete(instance.type); instance.appContext.optionsCache.delete(instance.type); if (instance.ceReload) { - hmrDirtyComponents.add(oldComp); + dirtyInstances.add(instance); instance.ceReload(newComp.styles); - hmrDirtyComponents.delete(oldComp); + dirtyInstances.delete(instance); } else if (instance.parent) { - instance.parent.effect.dirty = true; queueJob(() => { + isHmrUpdating = true; instance.parent.update(); - hmrDirtyComponents.delete(oldComp); + isHmrUpdating = false; + dirtyInstances.delete(instance); }); } else if (instance.appContext.reload) { instance.appContext.reload(); @@ -33707,13 +34928,12 @@ function reload(id3, newComp) { "[HMR] Root or manually mounted instance modified. Full reload required." ); } + if (instance.root.ce && instance !== instance.root) { + instance.root.ce._removeChildStyle(oldComp); + } } queuePostFlushCb(() => { - for (const instance of instances) { - hmrDirtyComponents.delete( - normalizeClassComponent(instance.type) - ); - } + hmrDirtyComponents.clear(); }); } __name(reload, "reload"); @@ -33750,7 +34970,7 @@ function emit$1(event, ...args) { } } __name(emit$1, "emit$1"); -function setDevtoolsHook$1(hook, target) { +function setDevtoolsHook$1(hook, target2) { var _a2, _b; devtools$1 = hook; if (devtools$1) { @@ -33766,13 +34986,13 @@ function setDevtoolsHook$1(hook, target) { // eslint-disable-next-line no-restricted-syntax !((_b = (_a2 = window.navigator) == null ? void 0 : _a2.userAgent) == null ? void 0 : _b.includes("jsdom")) ) { - const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []; + const replay = target2.__VUE_DEVTOOLS_HOOK_REPLAY__ = target2.__VUE_DEVTOOLS_HOOK_REPLAY__ || []; replay.push((newHook) => { - setDevtoolsHook$1(newHook, target); + setDevtoolsHook$1(newHook, target2); }); setTimeout(() => { if (!devtools$1) { - target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null; + target2.__VUE_DEVTOOLS_HOOK_REPLAY__ = null; devtoolsNotInstalled = true; buffer = []; } @@ -33852,146 +35072,6 @@ function devtoolsComponentEmit(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$8(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((a2) => isString$7(a2) ? a2.trim() : a2); - } - 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$8(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$d(comp)) { - cache2.set(comp, null); - } - return null; - } - if (isArray$9(raw)) { - raw.forEach((key) => normalized[key] = null); - } else { - extend$1(normalized, raw); - } - if (isObject$d(comp)) { - cache2.set(comp, normalized); - } - return normalized; -} -__name(normalizeEmitsOptions, "normalizeEmitsOptions"); -function isEmitListener(options4, key) { - if (!options4 || !isOn(key)) { - return false; - } - key = key.slice(2).replace(/Once$/, ""); - return hasOwn$3(options4, key[0].toLowerCase() + key.slice(1)) || hasOwn$3(options4, hyphenate$1(key)) || hasOwn$3(options4, key); -} -__name(isEmitListener, "isEmitListener"); let currentRenderingInstance = null; let currentScopeId = null; function setCurrentRenderingInstance(instance) { @@ -34040,1008 +35120,6 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) { 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: attrs4, - emit: emit2, - render: render2, - renderCache, - props, - data: data25, - 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, - data25, - ctx - ) - ); - fallthroughAttrs = attrs4; - } else { - const render22 = Component; - if (false) { - markAttrsAccessed(); - } - result = normalizeVNode( - render22.length > 1 ? render22( - false ? shallowReadonly(props) : props, - false ? { - get attrs() { - markAttrsAccessed(); - return shallowReadonly(attrs4); - }, - slots, - emit: emit2 - } : { attrs: attrs4, slots, emit: emit2 } - ) : render22( - false ? shallowReadonly(props) : props, - null - ) - ); - fallthroughAttrs = Component.props ? attrs4 : getFunctionalFallthrough(attrs4); - } - } catch (err) { - blockStack.length = 0; - handleError(err, instance, 1); - result = createVNode(Comment); - } - let root27 = result; - let setRoot = void 0; - if (false) { - [root27, setRoot] = getChildRoot(result); - } - if (fallthroughAttrs && inheritAttrs !== false) { - const keys2 = Object.keys(fallthroughAttrs); - const { shapeFlag } = root27; - if (keys2.length) { - if (shapeFlag & (1 | 6)) { - if (propsOptions && keys2.some(isModelListener)) { - fallthroughAttrs = filterModelListeners( - fallthroughAttrs, - propsOptions - ); - } - root27 = cloneVNode(root27, fallthroughAttrs, false, true); - } else if (false) { - const allAttrs = Object.keys(attrs4); - const eventAttrs = []; - const extraAttrs = []; - for (let i2 = 0, l2 = allAttrs.length; i2 < l2; i2++) { - const key = allAttrs[i2]; - 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.` - ); - } - root27 = cloneVNode(root27, null, false, true); - root27.dirs = root27.dirs ? root27.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.` - ); - } - root27.transition = vnode.transition; - } - if (false) { - setRoot(root27); - } else { - result = root27; - } - 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 i2 = 0; i2 < children.length; i2++) { - const child = children[i2]; - 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((attrs4) => { - let res; - for (const key in attrs4) { - if (key === "class" || key === "style" || isOn(key)) { - (res || (res = {}))[key] = attrs4[key]; - } - } - return res; -}, "getFunctionalFallthrough"); -const filterModelListeners = /* @__PURE__ */ __name((attrs4, props) => { - const res = {}; - for (const key in attrs4) { - if (!isModelListener(key) || !(key.slice(9) in props)) { - res[key] = attrs4[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 i2 = 0; i2 < dynamicProps.length; i2++) { - const key = dynamicProps[i2]; - 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 i2 = 0; i2 < nextKeys.length; i2++) { - const key = nextKeys[i2]; - if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) { - return true; - } - } - return false; -} -__name(hasPropsChanged, "hasPropsChanged"); -function updateHOCHostEl({ vnode, parent }, el) { - while (parent) { - const root27 = parent.subTree; - if (root27.suspense && root27.suspense.activeBranch === vnode) { - root27.el = vnode.el; - } - if (root27 === vnode) { - (vnode = parent.vnode).el = el; - parent = parent.parent; - } else { - break; - } - } -} -__name(updateHOCHostEl, "updateHOCHostEl"); -const COMPONENTS = "components"; -const DIRECTIVES = "directives"; -function resolveComponent(name2, maybeSelfReference) { - return resolveAsset(COMPONENTS, name2, true, maybeSelfReference) || name2; -} -__name(resolveComponent, "resolveComponent"); -const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc"); -function resolveDynamicComponent(component) { - if (isString$7(component)) { - return resolveAsset(COMPONENTS, component, false) || component; - } else { - return component || NULL_DYNAMIC_COMPONENT; - } -} -__name(resolveDynamicComponent, "resolveDynamicComponent"); -function resolveDirective(name2) { - return resolveAsset(DIRECTIVES, name2); -} -__name(resolveDirective, "resolveDirective"); -function resolveAsset(type, name2, 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 === name2 || selfName === camelize$1(name2) || selfName === capitalize$1(camelize$1(name2)))) { - return Component; - } - } - const res = ( - // local registration - // check instance[type] first which is resolved for options API - resolve(instance[type] || Component[type], name2) || // global registration - resolve(instance.appContext[type], name2) - ); - 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)}: ${name2}${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(registry, name2) { - return registry && (registry[name2] || registry[camelize$1(name2)] || registry[capitalize$1(camelize$1(name2))]); -} -__name(resolve, "resolve"); -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, name2) { - const eventListener = vnode.props && vnode.props[name2]; - if (isFunction$8(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: parentNode2, 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 (parentNode2(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. - parentNode2(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(s2) { - let block3; - if (isFunction$8(s2)) { - const trackBlock = isBlockTreeEnabled && s2._c; - if (trackBlock) { - s2._d = false; - openBlock(); - } - s2 = s2(); - if (trackBlock) { - s2._d = true; - block3 = currentBlock; - closeBlock(); - } - } - if (isArray$9(s2)) { - const singleChild = filterSingleRoot(s2); - if (false) { - warn$1$1(` slots expect a single root node.`); - } - s2 = singleChild; - } - s2 = normalizeVNode(s2); - if (block3 && !s2.dynamicChildren) { - s2.dynamicChildren = block3.filter((c2) => c2 !== s2); - } - return s2; -} -__name(normalizeSuspenseSlot, "normalizeSuspenseSlot"); -function queueEffectWithSuspense(fn, suspense) { - if (suspense && suspense.pendingBranch) { - if (isArray$9(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, prepend2 = false) { - if (target) { - const hooks2 = target[type] || (target[type] = []); - const wrappedHook = hook.__weh || (hook.__weh = (...args) => { - pauseTracking(); - const reset2 = setCurrentInstance(target); - const res = callWithAsyncErrorHandling(hook, target, type, args); - reset2(); - resetTracking(); - return res; - }); - if (prepend2) { - hooks2.unshift(wrappedHook); - } else { - hooks2.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(name2) { if (isBuiltInDirective(name2)) { warn$1$1("Do not use built-in directive ids as custom directive id: " + name2); @@ -35057,7 +35135,7 @@ function withDirectives(vnode, directives) { for (let i2 = 0; i2 < directives.length; i2++) { let [dir, value4, arg, modifiers2 = EMPTY_OBJ] = directives[i2]; if (dir) { - if (isFunction$8(dir)) { + if (isFunction$c(dir)) { dir = { mounted: dir, updated: dir @@ -35101,1820 +35179,780 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name2) { } } __name(invokeDirectiveHook, "invokeDirectiveHook"); -function renderList(source, renderItem, cache2, index2) { - let ret; - const cached = cache2 && cache2[index2]; - if (isArray$9(source) || isString$7(source)) { - ret = new Array(source.length); - for (let i2 = 0, l2 = source.length; i2 < l2; i2++) { - ret[i2] = renderItem(source[i2], i2, void 0, cached && cached[i2]); - } - } 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 i2 = 0; i2 < source; i2++) { - ret[i2] = renderItem(i2 + 1, i2, void 0, cached && cached[i2]); - } - } else if (isObject$d(source)) { - if (source[Symbol.iterator]) { - ret = Array.from( - source, - (item3, i2) => renderItem(item3, i2, void 0, cached && cached[i2]) - ); +const TeleportEndKey = Symbol("_vte"); +const isTeleport = /* @__PURE__ */ __name((type) => type.__isTeleport, "isTeleport"); +const isTeleportDisabled = /* @__PURE__ */ __name((props) => props && (props.disabled || props.disabled === ""), "isTeleportDisabled"); +const isTeleportDeferred = /* @__PURE__ */ __name((props) => props && (props.defer || props.defer === ""), "isTeleportDeferred"); +const isTargetSVG = /* @__PURE__ */ __name((target2) => typeof SVGElement !== "undefined" && target2 instanceof SVGElement, "isTargetSVG"); +const isTargetMathML = /* @__PURE__ */ __name((target2) => typeof MathMLElement === "function" && target2 instanceof MathMLElement, "isTargetMathML"); +const resolveTarget = /* @__PURE__ */ __name((props, select) => { + const targetSelector = props && props.to; + if (isString$9(targetSelector)) { + if (!select) { + return null; } else { - const keys2 = Object.keys(source); - ret = new Array(keys2.length); - for (let i2 = 0, l2 = keys2.length; i2 < l2; i2++) { - const key = keys2[i2]; - ret[i2] = renderItem(source[key], key, i2, cached && cached[i2]); + const target2 = select(targetSelector); + if (false) { + warn$1$1( + `Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.` + ); } + return target2; } } else { - ret = []; + if (false) { + warn$1$1(`Invalid Teleport target: ${targetSelector}`); + } + return targetSelector; } - if (cache2) { - cache2[index2] = ret; +}, "resolveTarget"); +const TeleportImpl = { + name: "Teleport", + __isTeleport: true, + process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) { + const { + mc: mountChildren, + pc: patchChildren, + pbc: patchBlockChildren, + o: { insert: insert2, querySelector, createText, createComment } + } = internals; + const disabled2 = isTeleportDisabled(n2.props); + let { shapeFlag, children, dynamicChildren } = n2; + if (false) { + optimized = false; + dynamicChildren = null; + } + if (n1 == null) { + const placeholder = n2.el = false ? createComment("teleport start") : createText(""); + const mainAnchor = n2.anchor = false ? createComment("teleport end") : createText(""); + insert2(placeholder, container, anchor); + insert2(mainAnchor, container, anchor); + const mount2 = /* @__PURE__ */ __name((container2, anchor2) => { + if (shapeFlag & 16) { + if (parentComponent && parentComponent.isCE) { + parentComponent.ce._teleportTarget = container2; + } + mountChildren( + children, + container2, + anchor2, + parentComponent, + parentSuspense, + namespace, + slotScopeIds, + optimized + ); + } + }, "mount"); + const mountToTarget = /* @__PURE__ */ __name(() => { + const target2 = n2.target = resolveTarget(n2.props, querySelector); + const targetAnchor = prepareAnchor(target2, n2, createText, insert2); + if (target2) { + if (namespace !== "svg" && isTargetSVG(target2)) { + namespace = "svg"; + } else if (namespace !== "mathml" && isTargetMathML(target2)) { + namespace = "mathml"; + } + if (!disabled2) { + mount2(target2, targetAnchor); + updateCssVars(n2, false); + } + } else if (false) { + warn$1$1( + "Invalid Teleport target on mount:", + target2, + `(${typeof target2})` + ); + } + }, "mountToTarget"); + if (disabled2) { + mount2(container, mainAnchor); + updateCssVars(n2, true); + } + if (isTeleportDeferred(n2.props)) { + queuePostRenderEffect(() => { + mountToTarget(); + n2.el.__isMounted = true; + }, parentSuspense); + } else { + mountToTarget(); + } + } else { + if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) { + queuePostRenderEffect(() => { + TeleportImpl.process( + n1, + n2, + container, + anchor, + parentComponent, + parentSuspense, + namespace, + slotScopeIds, + optimized, + internals + ); + delete n1.el.__isMounted; + }, parentSuspense); + return; + } + n2.el = n1.el; + n2.targetStart = n1.targetStart; + const mainAnchor = n2.anchor = n1.anchor; + const target2 = n2.target = n1.target; + const targetAnchor = n2.targetAnchor = n1.targetAnchor; + const wasDisabled = isTeleportDisabled(n1.props); + const currentContainer = wasDisabled ? container : target2; + const currentAnchor = wasDisabled ? mainAnchor : targetAnchor; + if (namespace === "svg" || isTargetSVG(target2)) { + namespace = "svg"; + } else if (namespace === "mathml" || isTargetMathML(target2)) { + namespace = "mathml"; + } + if (dynamicChildren) { + patchBlockChildren( + n1.dynamicChildren, + dynamicChildren, + currentContainer, + parentComponent, + parentSuspense, + namespace, + slotScopeIds + ); + traverseStaticChildren(n1, n2, true); + } else if (!optimized) { + patchChildren( + n1, + n2, + currentContainer, + currentAnchor, + parentComponent, + parentSuspense, + namespace, + slotScopeIds, + false + ); + } + if (disabled2) { + if (!wasDisabled) { + moveTeleport( + n2, + container, + mainAnchor, + internals, + 1 + ); + } else { + if (n2.props && n1.props && n2.props.to !== n1.props.to) { + n2.props.to = n1.props.to; + } + } + } else { + if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) { + const nextTarget = n2.target = resolveTarget( + n2.props, + querySelector + ); + if (nextTarget) { + moveTeleport( + n2, + nextTarget, + null, + internals, + 0 + ); + } else if (false) { + warn$1$1( + "Invalid Teleport target on update:", + target2, + `(${typeof target2})` + ); + } + } else if (wasDisabled) { + moveTeleport( + n2, + target2, + targetAnchor, + internals, + 1 + ); + } + } + updateCssVars(n2, disabled2); + } + }, + remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) { + const { + shapeFlag, + children, + anchor, + targetStart, + targetAnchor, + target: target2, + props + } = vnode; + if (target2) { + hostRemove(targetStart); + hostRemove(targetAnchor); + } + doRemove && hostRemove(anchor); + if (shapeFlag & 16) { + const shouldRemove = doRemove || !isTeleportDisabled(props); + for (let i2 = 0; i2 < children.length; i2++) { + const child = children[i2]; + unmount( + child, + parentComponent, + parentSuspense, + shouldRemove, + !!child.dynamicChildren + ); + } + } + }, + move: moveTeleport, + hydrate: hydrateTeleport +}; +function moveTeleport(vnode, container, parentAnchor, { o: { insert: insert2 }, m: move }, moveType = 2) { + if (moveType === 0) { + insert2(vnode.targetAnchor, container, parentAnchor); + } + const { el, anchor, shapeFlag, children, props } = vnode; + const isReorder = moveType === 2; + if (isReorder) { + insert2(el, container, parentAnchor); + } + if (!isReorder || isTeleportDisabled(props)) { + if (shapeFlag & 16) { + for (let i2 = 0; i2 < children.length; i2++) { + move( + children[i2], + container, + parentAnchor, + 2 + ); + } + } + } + if (isReorder) { + insert2(anchor, container, parentAnchor); + } +} +__name(moveTeleport, "moveTeleport"); +function hydrateTeleport(node3, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, { + o: { nextSibling, parentNode: parentNode2, querySelector, insert: insert2, createText } +}, hydrateChildren) { + const target2 = vnode.target = resolveTarget( + vnode.props, + querySelector + ); + if (target2) { + const disabled2 = isTeleportDisabled(vnode.props); + const targetNode = target2._lpa || target2.firstChild; + if (vnode.shapeFlag & 16) { + if (disabled2) { + vnode.anchor = hydrateChildren( + nextSibling(node3), + vnode, + parentNode2(node3), + parentComponent, + parentSuspense, + slotScopeIds, + optimized + ); + vnode.targetStart = targetNode; + vnode.targetAnchor = targetNode && nextSibling(targetNode); + } else { + vnode.anchor = nextSibling(node3); + let targetAnchor = targetNode; + while (targetAnchor) { + if (targetAnchor && targetAnchor.nodeType === 8) { + if (targetAnchor.data === "teleport start anchor") { + vnode.targetStart = targetAnchor; + } else if (targetAnchor.data === "teleport anchor") { + vnode.targetAnchor = targetAnchor; + target2._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor); + break; + } + } + targetAnchor = nextSibling(targetAnchor); + } + if (!vnode.targetAnchor) { + prepareAnchor(target2, vnode, createText, insert2); + } + hydrateChildren( + targetNode && nextSibling(targetNode), + vnode, + target2, + parentComponent, + parentSuspense, + slotScopeIds, + optimized + ); + } + } + updateCssVars(vnode, disabled2); + } + return vnode.anchor && nextSibling(vnode.anchor); +} +__name(hydrateTeleport, "hydrateTeleport"); +const Teleport = TeleportImpl; +function updateCssVars(vnode, isDisabled) { + const ctx = vnode.ctx; + if (ctx && ctx.ut) { + let node3, anchor; + if (isDisabled) { + node3 = vnode.el; + anchor = vnode.anchor; + } else { + node3 = vnode.targetStart; + anchor = vnode.targetAnchor; + } + while (node3 && node3 !== anchor) { + if (node3.nodeType === 1) node3.setAttribute("data-v-owner", ctx.uid); + node3 = node3.nextSibling; + } + ctx.ut(); + } +} +__name(updateCssVars, "updateCssVars"); +function prepareAnchor(target2, vnode, createText, insert2) { + const targetStart = vnode.targetStart = createText(""); + const targetAnchor = vnode.targetAnchor = createText(""); + targetStart[TeleportEndKey] = targetAnchor; + if (target2) { + insert2(targetStart, target2); + insert2(targetAnchor, target2); + } + return targetAnchor; +} +__name(prepareAnchor, "prepareAnchor"); +const leaveCbKey = Symbol("_leaveCb"); +const enterCbKey$1 = Symbol("_enterCb"); +function useTransitionState() { + const state = { + isMounted: false, + isLeaving: false, + isUnmounting: false, + leavingVNodes: /* @__PURE__ */ new Map() + }; + onMounted(() => { + state.isMounted = true; + }); + onBeforeUnmount(() => { + state.isUnmounting = true; + }); + return state; +} +__name(useTransitionState, "useTransitionState"); +const TransitionHookValidator = [Function, Array]; +const BaseTransitionPropsValidators = { + mode: String, + appear: Boolean, + persisted: Boolean, + // enter + onBeforeEnter: TransitionHookValidator, + onEnter: TransitionHookValidator, + onAfterEnter: TransitionHookValidator, + onEnterCancelled: TransitionHookValidator, + // leave + onBeforeLeave: TransitionHookValidator, + onLeave: TransitionHookValidator, + onAfterLeave: TransitionHookValidator, + onLeaveCancelled: TransitionHookValidator, + // appear + onBeforeAppear: TransitionHookValidator, + onAppear: TransitionHookValidator, + onAfterAppear: TransitionHookValidator, + onAppearCancelled: TransitionHookValidator +}; +const recursiveGetSubtree = /* @__PURE__ */ __name((instance) => { + const subTree = instance.subTree; + return subTree.component ? recursiveGetSubtree(subTree.component) : subTree; +}, "recursiveGetSubtree"); +const BaseTransitionImpl = { + name: `BaseTransition`, + props: BaseTransitionPropsValidators, + setup(props, { slots }) { + const instance = getCurrentInstance(); + const state = useTransitionState(); + return () => { + const children = slots.default && getTransitionRawChildren(slots.default(), true); + if (!children || !children.length) { + return; + } + const child = findNonCommentChild(children); + const rawProps = toRaw(props); + const { mode: mode2 } = rawProps; + if (false) { + warn$1$1(`invalid mode: ${mode2}`); + } + if (state.isLeaving) { + return emptyPlaceholder(child); + } + const innerChild = getInnerChild$1(child); + if (!innerChild) { + return emptyPlaceholder(child); + } + let enterHooks = resolveTransitionHooks( + innerChild, + rawProps, + state, + instance, + // #11061, ensure enterHooks is fresh after clone + (hooks2) => enterHooks = hooks2 + ); + if (innerChild.type !== Comment) { + setTransitionHooks(innerChild, enterHooks); + } + let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree); + if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) { + let leavingHooks = resolveTransitionHooks( + oldInnerChild, + rawProps, + state, + instance + ); + setTransitionHooks(oldInnerChild, leavingHooks); + if (mode2 === "out-in" && innerChild.type !== Comment) { + state.isLeaving = true; + leavingHooks.afterLeave = () => { + state.isLeaving = false; + if (!(instance.job.flags & 8)) { + instance.update(); + } + delete leavingHooks.afterLeave; + oldInnerChild = void 0; + }; + return emptyPlaceholder(child); + } else if (mode2 === "in-out" && innerChild.type !== Comment) { + leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => { + const leavingVNodesCache = getLeavingNodesForType( + state, + oldInnerChild + ); + leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild; + el[leaveCbKey] = () => { + earlyRemove(); + el[leaveCbKey] = void 0; + delete enterHooks.delayedLeave; + oldInnerChild = void 0; + }; + enterHooks.delayedLeave = () => { + delayedLeave(); + delete enterHooks.delayedLeave; + oldInnerChild = void 0; + }; + }; + } else { + oldInnerChild = void 0; + } + } else if (oldInnerChild) { + oldInnerChild = void 0; + } + return child; + }; + } +}; +function findNonCommentChild(children) { + let child = children[0]; + if (children.length > 1) { + let hasFound = false; + for (const c2 of children) { + if (c2.type !== Comment) { + if (false) { + warn$1$1( + " can only be used on a single element or component. Use for lists." + ); + break; + } + child = c2; + hasFound = true; + if (true) break; + } + } + } + return child; +} +__name(findNonCommentChild, "findNonCommentChild"); +const BaseTransition = BaseTransitionImpl; +function getLeavingNodesForType(state, vnode) { + const { leavingVNodes } = state; + let leavingVNodesCache = leavingVNodes.get(vnode.type); + if (!leavingVNodesCache) { + leavingVNodesCache = /* @__PURE__ */ Object.create(null); + leavingVNodes.set(vnode.type, leavingVNodesCache); + } + return leavingVNodesCache; +} +__name(getLeavingNodesForType, "getLeavingNodesForType"); +function resolveTransitionHooks(vnode, props, state, instance, postClone) { + const { + appear, + mode: mode2, + persisted = false, + onBeforeEnter: onBeforeEnter2, + onEnter: onEnter7, + onAfterEnter: onAfterEnter4, + onEnterCancelled, + onBeforeLeave: onBeforeLeave3, + onLeave: onLeave5, + onAfterLeave: onAfterLeave6, + onLeaveCancelled, + onBeforeAppear, + onAppear, + onAfterAppear, + onAppearCancelled + } = props; + const key = String(vnode.key); + const leavingVNodesCache = getLeavingNodesForType(state, vnode); + const callHook2 = /* @__PURE__ */ __name((hook, args) => { + hook && callWithAsyncErrorHandling( + hook, + instance, + 9, + args + ); + }, "callHook2"); + const callAsyncHook = /* @__PURE__ */ __name((hook, args) => { + const done = args[1]; + callHook2(hook, args); + if (isArray$b(hook)) { + if (hook.every((hook2) => hook2.length <= 1)) done(); + } else if (hook.length <= 1) { + done(); + } + }, "callAsyncHook"); + const hooks2 = { + mode: mode2, + persisted, + beforeEnter(el) { + let hook = onBeforeEnter2; + if (!state.isMounted) { + if (appear) { + hook = onBeforeAppear || onBeforeEnter2; + } else { + return; + } + } + if (el[leaveCbKey]) { + el[leaveCbKey]( + true + /* cancelled */ + ); + } + const leavingVNode = leavingVNodesCache[key]; + if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) { + leavingVNode.el[leaveCbKey](); + } + callHook2(hook, [el]); + }, + enter(el) { + let hook = onEnter7; + let afterHook = onAfterEnter4; + let cancelHook = onEnterCancelled; + if (!state.isMounted) { + if (appear) { + hook = onAppear || onEnter7; + afterHook = onAfterAppear || onAfterEnter4; + cancelHook = onAppearCancelled || onEnterCancelled; + } else { + return; + } + } + let called = false; + const done = el[enterCbKey$1] = (cancelled) => { + if (called) return; + called = true; + if (cancelled) { + callHook2(cancelHook, [el]); + } else { + callHook2(afterHook, [el]); + } + if (hooks2.delayedLeave) { + hooks2.delayedLeave(); + } + el[enterCbKey$1] = void 0; + }; + if (hook) { + callAsyncHook(hook, [el, done]); + } else { + done(); + } + }, + leave(el, remove22) { + const key2 = String(vnode.key); + if (el[enterCbKey$1]) { + el[enterCbKey$1]( + true + /* cancelled */ + ); + } + if (state.isUnmounting) { + return remove22(); + } + callHook2(onBeforeLeave3, [el]); + let called = false; + const done = el[leaveCbKey] = (cancelled) => { + if (called) return; + called = true; + remove22(); + if (cancelled) { + callHook2(onLeaveCancelled, [el]); + } else { + callHook2(onAfterLeave6, [el]); + } + el[leaveCbKey] = void 0; + if (leavingVNodesCache[key2] === vnode) { + delete leavingVNodesCache[key2]; + } + }; + leavingVNodesCache[key2] = vnode; + if (onLeave5) { + callAsyncHook(onLeave5, [el, done]); + } else { + done(); + } + }, + clone(vnode2) { + const hooks22 = resolveTransitionHooks( + vnode2, + props, + state, + instance, + postClone + ); + if (postClone) postClone(hooks22); + return hooks22; + } + }; + return hooks2; +} +__name(resolveTransitionHooks, "resolveTransitionHooks"); +function emptyPlaceholder(vnode) { + if (isKeepAlive(vnode)) { + vnode = cloneVNode(vnode); + vnode.children = null; + return vnode; + } +} +__name(emptyPlaceholder, "emptyPlaceholder"); +function getInnerChild$1(vnode) { + if (!isKeepAlive(vnode)) { + if (isTeleport(vnode.type) && vnode.children) { + return findNonCommentChild(vnode.children); + } + return vnode; + } + if (false) { + return vnode.component.subTree; + } + const { shapeFlag, children } = vnode; + if (children) { + if (shapeFlag & 16) { + return children[0]; + } + if (shapeFlag & 32 && isFunction$c(children.default)) { + return children.default(); + } + } +} +__name(getInnerChild$1, "getInnerChild$1"); +function setTransitionHooks(vnode, hooks2) { + if (vnode.shapeFlag & 6 && vnode.component) { + vnode.transition = hooks2; + setTransitionHooks(vnode.component.subTree, hooks2); + } else if (vnode.shapeFlag & 128) { + vnode.ssContent.transition = hooks2.clone(vnode.ssContent); + vnode.ssFallback.transition = hooks2.clone(vnode.ssFallback); + } else { + vnode.transition = hooks2; + } +} +__name(setTransitionHooks, "setTransitionHooks"); +function getTransitionRawChildren(children, keepComment = false, parentKey) { + let ret = []; + let keyedFragmentCount = 0; + for (let i2 = 0; i2 < children.length; i2++) { + let child = children[i2]; + const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i2); + if (child.type === Fragment$1) { + if (child.patchFlag & 128) keyedFragmentCount++; + ret = ret.concat( + getTransitionRawChildren(child.children, keepComment, key) + ); + } else if (keepComment || child.type !== Comment) { + ret.push(key != null ? cloneVNode(child, { key }) : child); + } + } + if (keyedFragmentCount > 1) { + for (let i2 = 0; i2 < ret.length; i2++) { + ret[i2].patchFlag = -2; + } } return ret; } -__name(renderList, "renderList"); -function createSlots(slots, dynamicSlots) { - for (let i2 = 0; i2 < dynamicSlots.length; i2++) { - const slot = dynamicSlots[i2]; - if (isArray$9(slot)) { - for (let j2 = 0; j2 < slot.length; j2++) { - slots[slot[j2].name] = slot[j2].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"); +__name(getTransitionRawChildren, "getTransitionRawChildren"); /*! #__NO_SIDE_EFFECTS__ */ // @__NO_SIDE_EFFECTS__ function defineComponent(options4, extraOptions) { - return isFunction$8(options4) ? ( - // #8326: extend call and options.name access are considered side-effects + return isFunction$c(options4) ? ( + // #8236: 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: options4.name }, extraOptions, { setup: options4 }))() ) : options4; } __name(defineComponent, "defineComponent"); -const isAsyncWrapper = /* @__PURE__ */ __name((i2) => !!i2.type.__asyncLoader, "isAsyncWrapper"); -/*! #__NO_SIDE_EFFECTS__ */ -// @__NO_SIDE_EFFECTS__ -function defineAsyncComponent(source) { - if (isFunction$8(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 error2 = ref(); - const delayed = ref(!!delay); - if (delay) { - setTimeout(() => { - delayed.value = false; - }, delay); - } - if (timeout != null) { - setTimeout(() => { - if (!loaded.value && !error2.value) { - const err = new Error( - `Async component timed out after ${timeout}ms.` - ); - onError(err); - error2.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); - error2.value = err; - }); - return () => { - if (loaded.value && resolvedComp) { - return createInnerComp(resolvedComp, instance); - } else if (error2.value && errorComponent) { - return createVNode(errorComponent, { - error: error2.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, name2, props = {}, fallback, noSlotted) { - if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) { - if (name2 !== "default") props.name = name2; - return createVNode("slot", props, fallback && fallback()); - } - let slot = slots[name2]; - 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$1, - { - 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 || `_${name2}` - }, - 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$1 && !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((i2) => { - if (!i2) return null; - if (isStatefulComponent(i2)) return getComponentPublicInstance(i2); - return getPublicInstance(i2.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((i2) => i2, "$"), - $el: /* @__PURE__ */ __name((i2) => i2.vnode.el, "$el"), - $data: /* @__PURE__ */ __name((i2) => i2.data, "$data"), - $props: /* @__PURE__ */ __name((i2) => false ? shallowReadonly(i2.props) : i2.props, "$props"), - $attrs: /* @__PURE__ */ __name((i2) => false ? shallowReadonly(i2.attrs) : i2.attrs, "$attrs"), - $slots: /* @__PURE__ */ __name((i2) => false ? shallowReadonly(i2.slots) : i2.slots, "$slots"), - $refs: /* @__PURE__ */ __name((i2) => false ? shallowReadonly(i2.refs) : i2.refs, "$refs"), - $parent: /* @__PURE__ */ __name((i2) => getPublicInstance(i2.parent), "$parent"), - $root: /* @__PURE__ */ __name((i2) => getPublicInstance(i2.root), "$root"), - $emit: /* @__PURE__ */ __name((i2) => i2.emit, "$emit"), - $options: /* @__PURE__ */ __name((i2) => true ? resolveMergedOptions(i2) : i2.type, "$options"), - $forceUpdate: /* @__PURE__ */ __name((i2) => i2.f || (i2.f = () => { - i2.effect.dirty = true; - queueJob(i2.update); - }), "$forceUpdate"), - $nextTick: /* @__PURE__ */ __name((i2) => i2.n || (i2.n = nextTick.bind(i2.proxy)), "$nextTick"), - $watch: /* @__PURE__ */ __name((i2) => true ? instanceWatch.bind(i2) : 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: data25, props, accessCache, type, appContext } = instance; - if (false) { - return true; - } - let normalizedProps; - if (key[0] !== "$") { - const n2 = accessCache[key]; - if (n2 !== void 0) { - switch (n2) { - case 1: - return setupState[key]; - case 2: - return data25[key]; - case 4: - return ctx[key]; - case 3: - return props[key]; - } - } else if (hasSetupBinding(setupState, key)) { - accessCache[key] = 1; - return setupState[key]; - } else if (data25 !== EMPTY_OBJ && hasOwn$3(data25, key)) { - accessCache[key] = 2; - return data25[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 (data25 !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn$3(data25, 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, value4) { - const { data: data25, setupState, ctx } = instance; - if (hasSetupBinding(setupState, key)) { - setupState[key] = value4; - return true; - } else if (false) { - warn$1$1(`Cannot mutate - + +
diff --git a/web/templates/default.json b/web/templates/default.json index 657ac107c..5a97075d8 100644 --- a/web/templates/default.json +++ b/web/templates/default.json @@ -266,7 +266,7 @@ ], "properties": {}, "widgets_values": [ - "v1-5-pruned-emaonly.safetensors" + "v1-5-pruned-emaonly-fp16.safetensors" ] } ], @@ -349,8 +349,8 @@ "extra": {}, "version": 0.4, "models": [{ - "name": "v1-5-pruned-emaonly.safetensors", - "url": "https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive/resolve/main/v1-5-pruned-emaonly.safetensors?download=true", + "name": "v1-5-pruned-emaonly-fp16.safetensors", + "url": "https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive/resolve/main/v1-5-pruned-emaonly-fp16.safetensors?download=true", "directory": "checkpoints" }] } From 768e03586870726da6f92e69d5ebd40ce9497214 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Fri, 31 Jan 2025 13:09:07 -0500 Subject: [PATCH 062/478] Add node for preview 3d animation (#6594) * Add node for preview 3d animation * remove bg_color param * remove animation_speed param --- comfy_extras/nodes_load_3d.py | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/comfy_extras/nodes_load_3d.py b/comfy_extras/nodes_load_3d.py index 436131aba..3b969e45f 100644 --- a/comfy_extras/nodes_load_3d.py +++ b/comfy_extras/nodes_load_3d.py @@ -20,7 +20,6 @@ class Load3D(): "width": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "material": (["original", "normal", "wireframe", "depth"],), - "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}), @@ -67,10 +66,8 @@ class Load3DAnimation(): "width": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "material": (["original", "normal", "wireframe", "depth"],), - "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"],), - "animation_speed": (["0.1", "0.5", "1", "1.5", "2"], {"default": "1"}), "fov": ("INT", {"default": 75, "min": 10, "max": 150, "step": 1}), }} @@ -104,7 +101,28 @@ class Preview3D(): return {"required": { "model_file": ("STRING", {"default": "", "multiline": False}), "material": (["original", "normal", "wireframe", "depth"],), - "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 + RETURN_TYPES = () + + CATEGORY = "3d" + + FUNCTION = "process" + EXPERIMENTAL = True + + def process(self, model_file, **kwargs): + return {"ui": {"model_file": [model_file]}, "result": ()} + +class Preview3DAnimation(): + @classmethod + def INPUT_TYPES(s): + return {"required": { + "model_file": ("STRING", {"default": "", "multiline": False}), + "material": (["original", "normal", "wireframe", "depth"],), "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}), @@ -124,11 +142,13 @@ class Preview3D(): NODE_CLASS_MAPPINGS = { "Load3D": Load3D, "Load3DAnimation": Load3DAnimation, - "Preview3D": Preview3D + "Preview3D": Preview3D, + "Preview3DAnimation": Preview3DAnimation } NODE_DISPLAY_NAME_MAPPINGS = { "Load3D": "Load 3D", "Load3DAnimation": "Load 3D - Animation", - "Preview3D": "Preview 3D" + "Preview3D": "Preview 3D", + "Preview3DAnimation": "Preview 3D - Animation" } From 9e1d301129db2507e6681a83d845186802e4ba22 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 1 Feb 2025 06:35:22 -0500 Subject: [PATCH 063/478] Only use stable cascade lora format with cascade model. --- comfy/lora.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/comfy/lora.py b/comfy/lora.py index ec3da6f4c..bc9f3022a 100644 --- a/comfy/lora.py +++ b/comfy/lora.py @@ -307,7 +307,6 @@ def model_lora_keys_unet(model, key_map={}): if k.endswith(".weight"): key_lora = k[len("diffusion_model."):-len(".weight")].replace(".", "_") key_map["lora_unet_{}".format(key_lora)] = k - key_map["lora_prior_unet_{}".format(key_lora)] = k #cascade lora: TODO put lora key prefix in the model config key_map["{}".format(k[:-len(".weight")])] = k #generic lora format without any weird key names else: key_map["{}".format(k)] = k #generic lora format for not .weight without any weird key names @@ -327,6 +326,13 @@ def model_lora_keys_unet(model, key_map={}): diffusers_lora_key = diffusers_lora_key[:-2] key_map[diffusers_lora_key] = unet_key + if isinstance(model, comfy.model_base.StableCascade_C): + for k in sdk: + if k.startswith("diffusion_model."): + if k.endswith(".weight"): + key_lora = k[len("diffusion_model."):-len(".weight")].replace(".", "_") + key_map["lora_prior_unet_{}".format(key_lora)] = k + if isinstance(model, comfy.model_base.SD3): #Diffusers lora SD3 diffusers_keys = comfy.utils.mmdit_to_diffusers(model.model_config.unet_config, output_prefix="diffusion_model.") for k in diffusers_keys: From 24d6871e47f64464c49cabb90b55b037c71b0daf Mon Sep 17 00:00:00 2001 From: KarryCharon <49889381+KarryCharon@users.noreply.github.com> Date: Sun, 2 Feb 2025 22:24:55 +0800 Subject: [PATCH 064/478] add disable-compres-response-body cli args; add compress middleware; (#6672) --- comfy/cli_args.py | 2 ++ server.py | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index f31d59411..a92fc0dba 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -179,6 +179,8 @@ parser.add_argument( parser.add_argument("--user-directory", type=is_valid_directory, default=None, help="Set the ComfyUI user directory with an absolute path. Overrides --base-directory.") +parser.add_argument("--disable-compres-response-body", action="store_true", help="Disable compressing response body.") + if comfy.options.args_parsing: args = parser.parse_args() else: diff --git a/server.py b/server.py index 88c163fc7..7b8608479 100644 --- a/server.py +++ b/server.py @@ -52,6 +52,22 @@ async def cache_control(request: web.Request, handler): response.headers.setdefault('Cache-Control', 'no-cache') return response + +@web.middleware +async def compress_body(request: web.Request, handler): + accept_encoding = request.headers.get("Accept-Encoding", "") + response: web.Response = await handler(request) + if args.disable_compres_response_body: + return response + if not isinstance(response, web.Response): + return response + if response.content_type not in ["application/json", "text/plain"]: + return response + if response.body and "gzip" in accept_encoding: + response.enable_compression() + return response + + def create_cors_middleware(allowed_origin: str): @web.middleware async def cors_middleware(request: web.Request, handler): @@ -149,7 +165,7 @@ class PromptServer(): self.client_session:Optional[aiohttp.ClientSession] = None self.number = 0 - middlewares = [cache_control] + middlewares = [cache_control, compress_body] if args.enable_cors_header: middlewares.append(create_cors_middleware(args.enable_cors_header)) else: From 0a0df5f136a90b1f49c7752872efd949ea2350e8 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" <128333288+ltdrdata@users.noreply.github.com> Date: Sun, 2 Feb 2025 23:26:47 +0900 Subject: [PATCH 065/478] better guide message for sageattention (#6634) --- comfy/ldm/modules/attention.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.py index 44aec59a6..975faa21f 100644 --- a/comfy/ldm/modules/attention.py +++ b/comfy/ldm/modules/attention.py @@ -1,4 +1,6 @@ import math +import sys + import torch import torch.nn.functional as F from torch import nn, einsum @@ -16,7 +18,11 @@ if model_management.xformers_enabled(): import xformers.ops if model_management.sage_attention_enabled(): - from sageattention import sageattn + try: + from sageattention import sageattn + except ModuleNotFoundError: + logging.error(f"\n\nTo use the `--use-sage-attention` feature, the `sageattention` package must be installed first.\ncommand:\n\t{sys.executable} -m pip install sageattention") + exit(-1) from comfy.cli_args import args import comfy.ops From 44e19a28d3c4c130103fcd2a1e7be432b56c169c Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 2 Feb 2025 09:45:07 -0500 Subject: [PATCH 066/478] Use maximum negative value instead of -inf for masks in text encoders. This is probably more correct. --- comfy/clip_model.py | 4 ++-- comfy/text_encoders/bert.py | 2 +- comfy/text_encoders/t5.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/comfy/clip_model.py b/comfy/clip_model.py index 23ddea9c0..c48576028 100644 --- a/comfy/clip_model.py +++ b/comfy/clip_model.py @@ -102,9 +102,9 @@ class CLIPTextModel_(torch.nn.Module): mask = None if attention_mask is not None: mask = 1.0 - attention_mask.to(x.dtype).reshape((attention_mask.shape[0], 1, -1, attention_mask.shape[-1])).expand(attention_mask.shape[0], 1, attention_mask.shape[-1], attention_mask.shape[-1]) - mask = mask.masked_fill(mask.to(torch.bool), float("-inf")) + mask = mask.masked_fill(mask.to(torch.bool), -torch.finfo(x.dtype).max) - causal_mask = torch.empty(x.shape[1], x.shape[1], dtype=x.dtype, device=x.device).fill_(float("-inf")).triu_(1) + causal_mask = torch.empty(x.shape[1], x.shape[1], dtype=x.dtype, device=x.device).fill_(-torch.finfo(x.dtype).max).triu_(1) if mask is not None: mask += causal_mask else: diff --git a/comfy/text_encoders/bert.py b/comfy/text_encoders/bert.py index fc9bac1d2..d4edd5aa5 100644 --- a/comfy/text_encoders/bert.py +++ b/comfy/text_encoders/bert.py @@ -118,7 +118,7 @@ class BertModel_(torch.nn.Module): mask = None if attention_mask is not None: mask = 1.0 - attention_mask.to(x.dtype).reshape((attention_mask.shape[0], 1, -1, attention_mask.shape[-1])).expand(attention_mask.shape[0], 1, attention_mask.shape[-1], attention_mask.shape[-1]) - mask = mask.masked_fill(mask.to(torch.bool), float("-inf")) + mask = mask.masked_fill(mask.to(torch.bool), -torch.finfo(x.dtype).max) x, i = self.encoder(x, mask, intermediate_output) return x, i diff --git a/comfy/text_encoders/t5.py b/comfy/text_encoders/t5.py index 7405528e2..df2b5b5cd 100644 --- a/comfy/text_encoders/t5.py +++ b/comfy/text_encoders/t5.py @@ -203,7 +203,7 @@ class T5Stack(torch.nn.Module): mask = None if attention_mask is not None: mask = 1.0 - attention_mask.to(x.dtype).reshape((attention_mask.shape[0], 1, -1, attention_mask.shape[-1])).expand(attention_mask.shape[0], 1, attention_mask.shape[-1], attention_mask.shape[-1]) - mask = mask.masked_fill(mask.to(torch.bool), float("-inf")) + mask = mask.masked_fill(mask.to(torch.bool), -torch.finfo(x.dtype).max) intermediate = None optimized_attention = optimized_attention_for_device(x.device, mask=attention_mask is not None, small_input=True) From 932ae8d9ca71c856045be1bc17ba4d48f9aea891 Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Mon, 3 Feb 2025 07:54:44 +0900 Subject: [PATCH 067/478] Update frontend to v1.8.13 (#6682) Co-authored-by: huchenlei <20929282+huchenlei@users.noreply.github.com> --- ...f5Ihf_.js => BaseViewTemplate-v6omkdXg.js} | 4 +- ...iwKLp6.js => DesktopStartView-coDnSXEF.js} | 6 +-- ...t9xRwC5.js => DownloadGitView-3STu4yxt.js} | 6 +-- ...C_ZBlIyE.js => ExtensionPanel-GE0aOkbr.js} | 8 ++-- ...View-DKrBTQLe.js => GraphView-CUSGEqGS.js} | 12 +++--- ...ew-C6tMsokB.js => InstallView-DTDlVr0Z.js} | 8 ++-- ...bfXtVg1.js => KeybindingPanel-C0Nt6GXU.js} | 10 ++--- ...3drnrFc.js => MaintenanceView-B5Gl0Rrl.js} | 14 +++--- ...js => ManualConfigurationView-DueOvLuK.js} | 6 +-- ...LOI_.js => MetricsConsentView-DTQYUF4Z.js} | 6 +-- ...tvC5Gx.js => NotSupportedView-PDDrAb9U.js} | 6 +-- ...rpEEV.js => ServerConfigPanel-DnGhsuUV.js} | 6 +-- ...5VckhgZ.js => ServerStartView-yzYZ8gms.js} | 6 +-- ...DNnNy-AZ.js => UserSelectView-DeJDnrF0.js} | 6 +-- ...ew-Nvn1jaCx.js => WelcomeView-DkwLdayn.js} | 6 +-- .../{index-CmVtQCAR.js => index-4Hb32CNk.js} | 40 ++++++++--------- .../{index-BPn8eYlx.js => index-B4tExwG7.js} | 43 ++++++++----------- .../{index-BWow9lpT.js => index-D4CAJ2MK.js} | 6 +-- .../{index-I0brO37W.js => index-D6zf5KAf.js} | 4 +- .../{index-Bm1HvJhs.js => index-hkkV7N7e.js} | 4 +- .../{index-CdHVC5qq.js => index-nJubvliG.js} | 6 +-- ...jCYw-.js => keybindingService-BTNdTpfl.js} | 4 +- ...aGcxp.js => serverConfigStore-BYbZcbWj.js} | 4 +- web/index.html | 2 +- 24 files changed, 109 insertions(+), 114 deletions(-) rename web/assets/{BaseViewTemplate-Cof5Ihf_.js => BaseViewTemplate-v6omkdXg.js} (94%) rename web/assets/{DesktopStartView-DTiwKLp6.js => DesktopStartView-coDnSXEF.js} (79%) rename web/assets/{DownloadGitView-At9xRwC5.js => DownloadGitView-3STu4yxt.js} (94%) rename web/assets/{ExtensionPanel-C_ZBlIyE.js => ExtensionPanel-GE0aOkbr.js} (97%) rename web/assets/{GraphView-DKrBTQLe.js => GraphView-CUSGEqGS.js} (99%) rename web/assets/{InstallView-C6tMsokB.js => InstallView-DTDlVr0Z.js} (99%) rename web/assets/{KeybindingPanel-BbfXtVg1.js => KeybindingPanel-C0Nt6GXU.js} (97%) rename web/assets/{MaintenanceView-D3drnrFc.js => MaintenanceView-B5Gl0Rrl.js} (99%) rename web/assets/{ManualConfigurationView-CtZMj_n_.js => ManualConfigurationView-DueOvLuK.js} (95%) rename web/assets/{MetricsConsentView-Df03LOI_.js => MetricsConsentView-DTQYUF4Z.js} (95%) rename web/assets/{NotSupportedView-BRtvC5Gx.js => NotSupportedView-PDDrAb9U.js} (96%) rename web/assets/{ServerConfigPanel-C2nrpEEV.js => ServerConfigPanel-DnGhsuUV.js} (98%) rename web/assets/{ServerStartView-M5VckhgZ.js => ServerStartView-yzYZ8gms.js} (96%) rename web/assets/{UserSelectView-DNnNy-AZ.js => UserSelectView-DeJDnrF0.js} (97%) rename web/assets/{WelcomeView-Nvn1jaCx.js => WelcomeView-DkwLdayn.js} (91%) rename web/assets/{index-CmVtQCAR.js => index-4Hb32CNk.js} (99%) rename web/assets/{index-BPn8eYlx.js => index-B4tExwG7.js} (99%) rename web/assets/{index-BWow9lpT.js => index-D4CAJ2MK.js} (99%) rename web/assets/{index-I0brO37W.js => index-D6zf5KAf.js} (94%) rename web/assets/{index-Bm1HvJhs.js => index-hkkV7N7e.js} (99%) rename web/assets/{index-CdHVC5qq.js => index-nJubvliG.js} (99%) rename web/assets/{keybindingService-CqSjCYw-.js => keybindingService-BTNdTpfl.js} (98%) rename web/assets/{serverConfigStore-BUvaGcxp.js => serverConfigStore-BYbZcbWj.js} (97%) diff --git a/web/assets/BaseViewTemplate-Cof5Ihf_.js b/web/assets/BaseViewTemplate-v6omkdXg.js similarity index 94% rename from web/assets/BaseViewTemplate-Cof5Ihf_.js rename to web/assets/BaseViewTemplate-v6omkdXg.js index 592bb1129..bc21d9896 100644 --- a/web/assets/BaseViewTemplate-Cof5Ihf_.js +++ b/web/assets/BaseViewTemplate-v6omkdXg.js @@ -1,4 +1,4 @@ -import { d as defineComponent, U as ref, p as onMounted, b4 as isElectron, W as nextTick, b5 as electronAPI, o as openBlock, f as createElementBlock, i as withDirectives, v as vShow, j as unref, b6 as isNativeWindow, m as createBaseVNode, A as renderSlot, ai as normalizeClass } from "./index-CmVtQCAR.js"; +import { d as defineComponent, U as ref, p as onMounted, b4 as isElectron, W as nextTick, b5 as electronAPI, o as openBlock, f as createElementBlock, i as withDirectives, v as vShow, j as unref, b6 as isNativeWindow, m as createBaseVNode, A as renderSlot, ai as normalizeClass } from "./index-4Hb32CNk.js"; const _hoisted_1 = { class: "flex-grow w-full flex items-center justify-center overflow-auto" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "BaseViewTemplate", @@ -48,4 +48,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as _ }; -//# sourceMappingURL=BaseViewTemplate-Cof5Ihf_.js.map +//# sourceMappingURL=BaseViewTemplate-v6omkdXg.js.map diff --git a/web/assets/DesktopStartView-DTiwKLp6.js b/web/assets/DesktopStartView-coDnSXEF.js similarity index 79% rename from web/assets/DesktopStartView-DTiwKLp6.js rename to web/assets/DesktopStartView-coDnSXEF.js index bff52ac02..db8199854 100644 --- a/web/assets/DesktopStartView-DTiwKLp6.js +++ b/web/assets/DesktopStartView-coDnSXEF.js @@ -1,5 +1,5 @@ -import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, k as createVNode, j as unref, bz as script } from "./index-CmVtQCAR.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.js"; +import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, k as createVNode, j as unref, bz as script } from "./index-4Hb32CNk.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.js"; const _hoisted_1 = { class: "max-w-screen-sm w-screen p-8" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "DesktopStartView", @@ -19,4 +19,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=DesktopStartView-DTiwKLp6.js.map +//# sourceMappingURL=DesktopStartView-coDnSXEF.js.map diff --git a/web/assets/DownloadGitView-At9xRwC5.js b/web/assets/DownloadGitView-3STu4yxt.js similarity index 94% rename from web/assets/DownloadGitView-At9xRwC5.js rename to web/assets/DownloadGitView-3STu4yxt.js index 4a43918d5..be7ac0dfd 100644 --- a/web/assets/DownloadGitView-At9xRwC5.js +++ b/web/assets/DownloadGitView-3STu4yxt.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, be as useRouter } from "./index-CmVtQCAR.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.js"; +import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, be as useRouter } from "./index-4Hb32CNk.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.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" }; @@ -55,4 +55,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=DownloadGitView-At9xRwC5.js.map +//# sourceMappingURL=DownloadGitView-3STu4yxt.js.map diff --git a/web/assets/ExtensionPanel-C_ZBlIyE.js b/web/assets/ExtensionPanel-GE0aOkbr.js similarity index 97% rename from web/assets/ExtensionPanel-C_ZBlIyE.js rename to web/assets/ExtensionPanel-GE0aOkbr.js index 6d3034e06..8fa78029e 100644 --- a/web/assets/ExtensionPanel-C_ZBlIyE.js +++ b/web/assets/ExtensionPanel-GE0aOkbr.js @@ -1,8 +1,8 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, U as ref, dl as FilterMatchMode, dr as useExtensionStore, a as useSettingStore, p as onMounted, c as computed, o as openBlock, y as createBlock, z as withCtx, k as createVNode, dm as SearchBox, j as unref, bj as script, m as createBaseVNode, f as createElementBlock, D as renderList, E as toDisplayString, a7 as createTextVNode, F as Fragment, l as script$1, B as createCommentVNode, a4 as script$3, ax as script$4, bn as script$5, dn as _sfc_main$1 } from "./index-CmVtQCAR.js"; -import { g as script$2, h as script$6 } from "./index-CdHVC5qq.js"; -import "./index-I0brO37W.js"; +import { d as defineComponent, U as ref, dl as FilterMatchMode, dr as useExtensionStore, a as useSettingStore, p as onMounted, c as computed, o as openBlock, y as createBlock, z as withCtx, k as createVNode, dm as SearchBox, j as unref, bj as script, m as createBaseVNode, f as createElementBlock, D as renderList, E as toDisplayString, a7 as createTextVNode, F as Fragment, l as script$1, B as createCommentVNode, a4 as script$3, ax as script$4, bn as script$5, dn as _sfc_main$1 } from "./index-4Hb32CNk.js"; +import { g as script$2, h as script$6 } from "./index-nJubvliG.js"; +import "./index-D6zf5KAf.js"; const _hoisted_1 = { class: "flex justify-end" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "ExtensionPanel", @@ -179,4 +179,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ExtensionPanel-C_ZBlIyE.js.map +//# sourceMappingURL=ExtensionPanel-GE0aOkbr.js.map diff --git a/web/assets/GraphView-DKrBTQLe.js b/web/assets/GraphView-CUSGEqGS.js similarity index 99% rename from web/assets/GraphView-DKrBTQLe.js rename to web/assets/GraphView-CUSGEqGS.js index 495f54fe9..3291a439e 100644 --- a/web/assets/GraphView-DKrBTQLe.js +++ b/web/assets/GraphView-CUSGEqGS.js @@ -1,10 +1,10 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -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 createVNode, s as showNativeMenu, l as script, m as createBaseVNode, n as normalizeStyle, _ as _export_sfc, p as onMounted, q as onBeforeUnmount, t as useSidebarTabStore, x as useBottomPanelStore, y as createBlock, z as withCtx, A as renderSlot, B as createCommentVNode, C as resolveDynamicComponent, F as Fragment, D as renderList, E as toDisplayString, G as script$5, H as markRaw, I as defineStore, J as shallowRef, K as useI18n, L as useCommandStore, M as LiteGraph, N as useColorPaletteStore, O as watch, P as useNodeDefStore, Q as BadgePosition, R as LGraphBadge, S as _, T as NodeBadgeMode, U as ref, V as useEventListener, W as nextTick, X as st, Y as normalizeI18nKey, Z as LGraphGroup, $ as LGraphNode, a0 as EditableText, a1 as useNodeFrequencyStore, a2 as useNodeBookmarkStore, a3 as highlightQuery, a4 as script$8, a5 as formatNumberWithSuffix, a6 as NodeSourceType, a7 as createTextVNode, a8 as script$9, a9 as NodePreview, aa as NodeSearchFilter, ab as script$a, ac as SearchFilterChip, ad as useLitegraphService, ae as storeToRefs, af as isRef, ag as toRaw, ah as LinkReleaseTriggerAction, ai as normalizeClass, aj as useUserStore, ak as useDialogStore, al as SettingDialogHeader, am as SettingDialogContent, an as useKeybindingStore, ao as Teleport, ap as usePragmaticDraggable, aq as usePragmaticDroppable, ar as withModifiers, as as mergeProps, at as useWorkflowService, au as useWorkflowBookmarkStore, av as script$c, aw as script$d, ax as script$e, ay as LinkMarkerShape, az as useModelToNodeStore, aA as ComfyNodeDefImpl, aB as ComfyModelDef, aC as LGraph, aD as LLink, aE as DragAndScale, aF as LGraphCanvas, aG as ContextMenu, aH as api, aI as getStorageValue, aJ as useModelStore, aK as setStorageValue, aL as CanvasPointer, aM as IS_CONTROL_WIDGET, aN as updateControlWidgetLabel, aO as useColorPaletteService, aP as ChangeTracker, aQ as i18n, aR as useToast, aS as useToastStore, aT as useQueueSettingsStore, aU as script$g, aV as useQueuePendingTaskCountStore, aW as useLocalStorage, aX as useDraggable, aY as watchDebounced, aZ as inject, a_ as useElementBounding, a$ as script$i, b0 as lodashExports, b1 as useEventBus, b2 as useMenuItemStore, b3 as provide, b4 as isElectron, b5 as electronAPI, b6 as isNativeWindow, b7 as useDialogService, b8 as LGraphEventMode, b9 as useQueueStore, ba as DEFAULT_DARK_COLOR_PALETTE, bb as DEFAULT_LIGHT_COLOR_PALETTE, bc as t, bd as useErrorHandling } from "./index-CmVtQCAR.js"; -import { s as script$1, a as script$2, b as script$3, c as script$4, d as script$6, e as script$7, f as script$b, g as script$f, h as script$h, i as script$j } from "./index-BWow9lpT.js"; -import { u as useKeybindingService } from "./keybindingService-CqSjCYw-.js"; -import { u as useServerConfigStore } from "./serverConfigStore-BUvaGcxp.js"; -import "./index-I0brO37W.js"; +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 createVNode, s as showNativeMenu, l as script, m as createBaseVNode, n as normalizeStyle, _ as _export_sfc, p as onMounted, q as onBeforeUnmount, t as useSidebarTabStore, x as useBottomPanelStore, y as createBlock, z as withCtx, A as renderSlot, B as createCommentVNode, C as resolveDynamicComponent, F as Fragment, D as renderList, E as toDisplayString, G as script$5, H as markRaw, I as defineStore, J as shallowRef, K as useI18n, L as useCommandStore, M as LiteGraph, N as useColorPaletteStore, O as watch, P as useNodeDefStore, Q as BadgePosition, R as LGraphBadge, S as _, T as NodeBadgeMode, U as ref, V as useEventListener, W as nextTick, X as st, Y as normalizeI18nKey, Z as LGraphGroup, $ as LGraphNode, a0 as EditableText, a1 as useNodeFrequencyStore, a2 as useNodeBookmarkStore, a3 as highlightQuery, a4 as script$8, a5 as formatNumberWithSuffix, a6 as NodeSourceType, a7 as createTextVNode, a8 as script$9, a9 as NodePreview, aa as NodeSearchFilter, ab as script$a, ac as SearchFilterChip, ad as useLitegraphService, ae as storeToRefs, af as isRef, ag as toRaw, ah as LinkReleaseTriggerAction, ai as normalizeClass, aj as useUserStore, ak as useDialogStore, al as SettingDialogHeader, am as SettingDialogContent, an as useKeybindingStore, ao as Teleport, ap as usePragmaticDraggable, aq as usePragmaticDroppable, ar as withModifiers, as as mergeProps, at as useWorkflowService, au as useWorkflowBookmarkStore, av as script$c, aw as script$d, ax as script$e, ay as LinkMarkerShape, az as useModelToNodeStore, aA as ComfyNodeDefImpl, aB as ComfyModelDef, aC as LGraph, aD as LLink, aE as DragAndScale, aF as LGraphCanvas, aG as ContextMenu, aH as api, aI as getStorageValue, aJ as useModelStore, aK as setStorageValue, aL as CanvasPointer, aM as IS_CONTROL_WIDGET, aN as updateControlWidgetLabel, aO as useColorPaletteService, aP as ChangeTracker, aQ as i18n, aR as useToast, aS as useToastStore, aT as useQueueSettingsStore, aU as script$g, aV as useQueuePendingTaskCountStore, aW as useLocalStorage, aX as useDraggable, aY as watchDebounced, aZ as inject, a_ as useElementBounding, a$ as script$i, b0 as lodashExports, b1 as useEventBus, b2 as useMenuItemStore, b3 as provide, b4 as isElectron, b5 as electronAPI, b6 as isNativeWindow, b7 as useDialogService, b8 as LGraphEventMode, b9 as useQueueStore, ba as DEFAULT_DARK_COLOR_PALETTE, bb as DEFAULT_LIGHT_COLOR_PALETTE, bc as t, bd as useErrorHandling } from "./index-4Hb32CNk.js"; +import { s as script$1, a as script$2, b as script$3, c as script$4, d as script$6, e as script$7, f as script$b, g as script$f, h as script$h, i as script$j } from "./index-D4CAJ2MK.js"; +import { u as useKeybindingService } from "./keybindingService-BTNdTpfl.js"; +import { u as useServerConfigStore } from "./serverConfigStore-BYbZcbWj.js"; +import "./index-D6zf5KAf.js"; const DEFAULT_TITLE = "ComfyUI"; const TITLE_SUFFIX = " - ComfyUI"; const _sfc_main$u = /* @__PURE__ */ defineComponent({ @@ -4679,4 +4679,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=GraphView-DKrBTQLe.js.map +//# sourceMappingURL=GraphView-CUSGEqGS.js.map diff --git a/web/assets/InstallView-C6tMsokB.js b/web/assets/InstallView-DTDlVr0Z.js similarity index 99% rename from web/assets/InstallView-C6tMsokB.js rename to web/assets/InstallView-DTDlVr0Z.js index 461781854..380d7a9f1 100644 --- a/web/assets/InstallView-C6tMsokB.js +++ b/web/assets/InstallView-DTDlVr0Z.js @@ -1,9 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, U as ref, bm as useModel, o as openBlock, f as createElementBlock, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, bn as script, bh as script$1, ar as withModifiers, z as withCtx, ab as script$2, K as useI18n, c as computed, ai as normalizeClass, B as createCommentVNode, a4 as script$3, a7 as createTextVNode, b5 as electronAPI, _ as _export_sfc, p as onMounted, r as resolveDirective, bg as script$4, i as withDirectives, bo as script$5, bp as script$6, l as script$7, y as createBlock, bj as script$8, bq as MigrationItems, w as watchEffect, F as Fragment, D as renderList, br as script$9, bs as mergeModels, bt as ValidationState, Y as normalizeI18nKey, O as watch, bu as checkMirrorReachable, bv as _sfc_main$7, bw as mergeValidationStates, bc as t, a$ as script$a, bx as CUDA_TORCH_URL, by as NIGHTLY_CPU_TORCH_URL, be as useRouter, ag as toRaw } from "./index-CmVtQCAR.js"; -import { s as script$b, a as script$c, b as script$d, c as script$e, d as script$f } from "./index-Bm1HvJhs.js"; +import { d as defineComponent, U as ref, bm as useModel, o as openBlock, f as createElementBlock, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, bn as script, bh as script$1, ar as withModifiers, z as withCtx, ab as script$2, K as useI18n, c as computed, ai as normalizeClass, B as createCommentVNode, a4 as script$3, a7 as createTextVNode, b5 as electronAPI, _ as _export_sfc, p as onMounted, r as resolveDirective, bg as script$4, i as withDirectives, bo as script$5, bp as script$6, l as script$7, y as createBlock, bj as script$8, bq as MigrationItems, w as watchEffect, F as Fragment, D as renderList, br as script$9, bs as mergeModels, bt as ValidationState, Y as normalizeI18nKey, O as watch, bu as checkMirrorReachable, bv as _sfc_main$7, bw as mergeValidationStates, bc as t, a$ as script$a, bx as CUDA_TORCH_URL, by as NIGHTLY_CPU_TORCH_URL, be as useRouter, ag as toRaw } from "./index-4Hb32CNk.js"; +import { s as script$b, a as script$c, b as script$d, c as script$e, d as script$f } from "./index-hkkV7N7e.js"; import { P as PYTHON_MIRROR, a as PYPI_MIRROR } from "./uvMirrors-B-HKMf6X.js"; -import { _ as _sfc_main$8 } from "./BaseViewTemplate-Cof5Ihf_.js"; +import { _ as _sfc_main$8 } from "./BaseViewTemplate-v6omkdXg.js"; const _hoisted_1$5 = { class: "flex flex-col gap-6 w-[600px]" }; const _hoisted_2$5 = { class: "flex flex-col gap-4" }; const _hoisted_3$5 = { class: "text-2xl font-semibold text-neutral-100" }; @@ -942,4 +942,4 @@ const InstallView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data- export { InstallView as default }; -//# sourceMappingURL=InstallView-C6tMsokB.js.map +//# sourceMappingURL=InstallView-DTDlVr0Z.js.map diff --git a/web/assets/KeybindingPanel-BbfXtVg1.js b/web/assets/KeybindingPanel-C0Nt6GXU.js similarity index 97% rename from web/assets/KeybindingPanel-BbfXtVg1.js rename to web/assets/KeybindingPanel-C0Nt6GXU.js index 1cff94939..f791713bb 100644 --- a/web/assets/KeybindingPanel-BbfXtVg1.js +++ b/web/assets/KeybindingPanel-C0Nt6GXU.js @@ -1,9 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, D as renderList, k as createVNode, z as withCtx, a7 as createTextVNode, E as toDisplayString, j as unref, a4 as script, B as createCommentVNode, U as ref, dl as FilterMatchMode, an as useKeybindingStore, L as useCommandStore, K as useI18n, Y as normalizeI18nKey, w as watchEffect, aR as useToast, r as resolveDirective, y as createBlock, dm as SearchBox, m as createBaseVNode, l as script$2, bg as script$4, ar as withModifiers, bj as script$5, ab as script$6, i as withDirectives, dn as _sfc_main$2, dp as KeyComboImpl, dq as KeybindingImpl, _ as _export_sfc } from "./index-CmVtQCAR.js"; -import { g as script$1, h as script$3 } from "./index-CdHVC5qq.js"; -import { u as useKeybindingService } from "./keybindingService-CqSjCYw-.js"; -import "./index-I0brO37W.js"; +import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, D as renderList, k as createVNode, z as withCtx, a7 as createTextVNode, E as toDisplayString, j as unref, a4 as script, B as createCommentVNode, U as ref, dl as FilterMatchMode, an as useKeybindingStore, L as useCommandStore, K as useI18n, Y as normalizeI18nKey, w as watchEffect, aR as useToast, r as resolveDirective, y as createBlock, dm as SearchBox, m as createBaseVNode, l as script$2, bg as script$4, ar as withModifiers, bj as script$5, ab as script$6, i as withDirectives, dn as _sfc_main$2, dp as KeyComboImpl, dq as KeybindingImpl, _ as _export_sfc } from "./index-4Hb32CNk.js"; +import { g as script$1, h as script$3 } from "./index-nJubvliG.js"; +import { u as useKeybindingService } from "./keybindingService-BTNdTpfl.js"; +import "./index-D6zf5KAf.js"; const _hoisted_1$1 = { key: 0, class: "px-2" @@ -279,4 +279,4 @@ const KeybindingPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { KeybindingPanel as default }; -//# sourceMappingURL=KeybindingPanel-BbfXtVg1.js.map +//# sourceMappingURL=KeybindingPanel-C0Nt6GXU.js.map diff --git a/web/assets/MaintenanceView-D3drnrFc.js b/web/assets/MaintenanceView-B5Gl0Rrl.js similarity index 99% rename from web/assets/MaintenanceView-D3drnrFc.js rename to web/assets/MaintenanceView-B5Gl0Rrl.js index e54bc0276..4254e4e67 100644 --- a/web/assets/MaintenanceView-D3drnrFc.js +++ b/web/assets/MaintenanceView-B5Gl0Rrl.js @@ -1,11 +1,11 @@ var __defProp = Object.defineProperty; var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -import { bA as BaseStyle, bB as script$1d, bC as ZIndex, bD as addClass, bE as focus, bF as blockBodyScroll, bG as unblockBodyScroll, bH as FocusTrap, l as script$1e, bI as script$1f, bJ as script$1g, bK as resolveComponent, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, f as createElementBlock, as as mergeProps, k as createVNode, bL as Transition, i as withDirectives, A as renderSlot, F as Fragment, m as createBaseVNode, ai as normalizeClass, E as toDisplayString, B as createCommentVNode, C as resolveDynamicComponent, d as defineComponent, bs as mergeModels, bm as useModel, v as vShow, j as unref, bM as script$1h, c as computed, bN as PrimeIcons, bc as t, a4 as script$1i, aZ as inject, bO as findSingle, bP as getAttribute, bQ as script$1j, bR as script$1k, bS as Ripple, bT as UniqueComponentId, bU as script$1l, D as renderList, bV as BaseDirective, bW as removeClass, bX as createElement, bY as hasClass, bZ as script$1m, b_ as script$1n, b$ as addStyle, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, c2 as relativePosition, c3 as getOuterWidth, c4 as absolutePosition, c5 as find, c6 as getIndex, c7 as getFocusableElements, c8 as OverlayEventBus, c9 as setAttribute, ca as localeComparator, bg as script$1o, cb as script$1p, n as normalizeStyle, a7 as createTextVNode, bf as withKeys, cc as resolveFieldData, cd as isNotEmpty, ce as equals, cf as script$1q, cg as isString, ch as isPrintableCharacter, ci as isEmpty, cj as findLastIndex, ck as script$1r, cl as script$1s, cm as uuid, a8 as script$1t, cn as sort, co as createSlots, cp as EventBus, H as markRaw, cq as resolve, cr as Tooltip, bi as script$1v, ab as script$1w, cs as script$1x, ct as script$1y, cu as script$1z, bz as script$1A, bj as script$1B, cv as normalizeProps, cw as isAttributeEquals, cx as guardReactiveProps, cy as setCSSProperty, cz as $dt, cA as script$1D, cB as script$1F, cC as getUserAgent, bn as script$1G, cD as script$1H, cE as getFirstFocusableElement, cF as getLastFocusableElement, cG as FilterService, br as script$1J, cH as script$1K, bp as script$1L, bo as script$1M, cI as script$1N, cJ as findIndexInList, cK as scrollInView, cL as script$1O, cM as script$1P, cN as script$1Q, cO as findLast, cP as getWindowScrollTop, cQ as getWidth, cR as getOffset, cS as vModelText, cT as script$1U, ar as withModifiers, cU as getVNodeProp, cV as getNextElementSibling, cW as getPreviousElementSibling, cX as isClickable, cY as _default, cZ as clearSelection, c_ as isRTL, b5 as electronAPI, I as defineStore, U as ref, c$ as useTimeout, O as watch, d0 as script$1Y, _ as _export_sfc, aR as useToast, d1 as useConfirm, bh as script$1Z, d2 as script$1_, p as onMounted, d3 as onUnmounted, av as script$1$, af as isRef, bl as BaseTerminal } from "./index-CmVtQCAR.js"; -import { j as script$1C, k as script$1E, g as script$20 } from "./index-BWow9lpT.js"; -import { s as script$1u, a as script$1R, b as script$1S, c as script$1T, d as script$1V, e as script$1W, f as script$1X } from "./index-CdHVC5qq.js"; -import { s as script$1I } from "./index-I0brO37W.js"; -import "./index-Bm1HvJhs.js"; -import { _ as _sfc_main$7 } from "./BaseViewTemplate-Cof5Ihf_.js"; +import { bA as BaseStyle, bB as script$1d, bC as ZIndex, bD as addClass, bE as focus, bF as blockBodyScroll, bG as unblockBodyScroll, bH as FocusTrap, l as script$1e, bI as script$1f, bJ as script$1g, bK as resolveComponent, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, f as createElementBlock, as as mergeProps, k as createVNode, bL as Transition, i as withDirectives, A as renderSlot, F as Fragment, m as createBaseVNode, ai as normalizeClass, E as toDisplayString, B as createCommentVNode, C as resolveDynamicComponent, d as defineComponent, bs as mergeModels, bm as useModel, v as vShow, j as unref, bM as script$1h, c as computed, bN as PrimeIcons, bc as t, a4 as script$1i, aZ as inject, bO as findSingle, bP as getAttribute, bQ as script$1j, bR as script$1k, bS as Ripple, bT as UniqueComponentId, bU as script$1l, D as renderList, bV as BaseDirective, bW as removeClass, bX as createElement, bY as hasClass, bZ as script$1m, b_ as script$1n, b$ as addStyle, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, c2 as relativePosition, c3 as getOuterWidth, c4 as absolutePosition, c5 as find, c6 as getIndex, c7 as getFocusableElements, c8 as OverlayEventBus, c9 as setAttribute, ca as localeComparator, bg as script$1o, cb as script$1p, n as normalizeStyle, a7 as createTextVNode, bf as withKeys, cc as resolveFieldData, cd as isNotEmpty, ce as equals, cf as script$1q, cg as isString, ch as isPrintableCharacter, ci as isEmpty, cj as findLastIndex, ck as script$1r, cl as script$1s, cm as uuid, a8 as script$1t, cn as sort, co as createSlots, cp as EventBus, H as markRaw, cq as resolve, cr as Tooltip, bi as script$1v, ab as script$1w, cs as script$1x, ct as script$1y, cu as script$1z, bz as script$1A, bj as script$1B, cv as normalizeProps, cw as isAttributeEquals, cx as guardReactiveProps, cy as setCSSProperty, cz as $dt, cA as script$1D, cB as script$1F, cC as getUserAgent, bn as script$1G, cD as script$1H, cE as getFirstFocusableElement, cF as getLastFocusableElement, cG as FilterService, br as script$1J, cH as script$1K, bp as script$1L, bo as script$1M, cI as script$1N, cJ as findIndexInList, cK as scrollInView, cL as script$1O, cM as script$1P, cN as script$1Q, cO as findLast, cP as getWindowScrollTop, cQ as getWidth, cR as getOffset, cS as vModelText, cT as script$1U, ar as withModifiers, cU as getVNodeProp, cV as getNextElementSibling, cW as getPreviousElementSibling, cX as isClickable, cY as _default, cZ as clearSelection, c_ as isRTL, b5 as electronAPI, I as defineStore, U as ref, c$ as useTimeout, O as watch, d0 as script$1Y, _ as _export_sfc, aR as useToast, d1 as useConfirm, bh as script$1Z, d2 as script$1_, p as onMounted, d3 as onUnmounted, av as script$1$, af as isRef, bl as BaseTerminal } from "./index-4Hb32CNk.js"; +import { j as script$1C, k as script$1E, g as script$20 } from "./index-D4CAJ2MK.js"; +import { s as script$1u, a as script$1R, b as script$1S, c as script$1T, d as script$1V, e as script$1W, f as script$1X } from "./index-nJubvliG.js"; +import { s as script$1I } from "./index-D6zf5KAf.js"; +import "./index-hkkV7N7e.js"; +import { _ as _sfc_main$7 } from "./BaseViewTemplate-v6omkdXg.js"; var theme$D = /* @__PURE__ */ __name(function theme(_ref) { var dt = _ref.dt; return "\n.p-drawer {\n display: flex;\n flex-direction: column;\n transform: translate3d(0px, 0px, 0px);\n position: relative;\n transition: transform 0.3s;\n background: ".concat(dt("drawer.background"), ";\n color: ").concat(dt("drawer.color"), ";\n border: 1px solid ").concat(dt("drawer.border.color"), ";\n box-shadow: ").concat(dt("drawer.shadow"), ";\n}\n\n.p-drawer-content {\n overflow-y: auto;\n flex-grow: 1;\n padding: ").concat(dt("drawer.content.padding"), ";\n}\n\n.p-drawer-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-shrink: 0;\n padding: ").concat(dt("drawer.header.padding"), ";\n}\n\n.p-drawer-footer {\n padding: ").concat(dt("drawer.footer.padding"), ";\n}\n\n.p-drawer-title {\n font-weight: ").concat(dt("drawer.title.font.weight"), ";\n font-size: ").concat(dt("drawer.title.font.size"), ";\n}\n\n.p-drawer-full .p-drawer {\n transition: none;\n transform: none;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n border-width: 1px;\n}\n\n.p-drawer-left .p-drawer-enter-from,\n.p-drawer-left .p-drawer-leave-to {\n transform: translateX(-100%);\n}\n\n.p-drawer-right .p-drawer-enter-from,\n.p-drawer-right .p-drawer-leave-to {\n transform: translateX(100%);\n}\n\n.p-drawer-top .p-drawer-enter-from,\n.p-drawer-top .p-drawer-leave-to {\n transform: translateY(-100%);\n}\n\n.p-drawer-bottom .p-drawer-enter-from,\n.p-drawer-bottom .p-drawer-leave-to {\n transform: translateY(100%);\n}\n\n.p-drawer-full .p-drawer-enter-from,\n.p-drawer-full .p-drawer-leave-to {\n opacity: 0;\n}\n\n.p-drawer-full .p-drawer-enter-active,\n.p-drawer-full .p-drawer-leave-active {\n transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n.p-drawer-left .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-end-width: 1px;\n}\n\n.p-drawer-right .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-start-width: 1px;\n}\n\n.p-drawer-top .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-end-width: 1px;\n}\n\n.p-drawer-bottom .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-start-width: 1px;\n}\n\n.p-drawer-left .p-drawer-content,\n.p-drawer-right .p-drawer-content,\n.p-drawer-top .p-drawer-content,\n.p-drawer-bottom .p-drawer-content {\n width: 100%;\n height: 100%;\n}\n\n.p-drawer-open {\n display: flex;\n}\n\n.p-drawer-mask:dir(rtl) {\n flex-direction: row-reverse;\n}\n"); @@ -26030,4 +26030,4 @@ const MaintenanceView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { MaintenanceView as default }; -//# sourceMappingURL=MaintenanceView-D3drnrFc.js.map +//# sourceMappingURL=MaintenanceView-B5Gl0Rrl.js.map diff --git a/web/assets/ManualConfigurationView-CtZMj_n_.js b/web/assets/ManualConfigurationView-DueOvLuK.js similarity index 95% rename from web/assets/ManualConfigurationView-CtZMj_n_.js rename to web/assets/ManualConfigurationView-DueOvLuK.js index 59a79f8f5..383794c52 100644 --- a/web/assets/ManualConfigurationView-CtZMj_n_.js +++ b/web/assets/ManualConfigurationView-DueOvLuK.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, K as useI18n, U as ref, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, a4 as script, a$ as script$1, l as script$2, b5 as electronAPI, _ as _export_sfc } from "./index-CmVtQCAR.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.js"; +import { d as defineComponent, K as useI18n, U as ref, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, a4 as script, a$ as script$1, l as script$2, b5 as electronAPI, _ as _export_sfc } from "./index-4Hb32CNk.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.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" }; @@ -71,4 +71,4 @@ const ManualConfigurationView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scop export { ManualConfigurationView as default }; -//# sourceMappingURL=ManualConfigurationView-CtZMj_n_.js.map +//# sourceMappingURL=ManualConfigurationView-DueOvLuK.js.map diff --git a/web/assets/MetricsConsentView-Df03LOI_.js b/web/assets/MetricsConsentView-DTQYUF4Z.js similarity index 95% rename from web/assets/MetricsConsentView-Df03LOI_.js rename to web/assets/MetricsConsentView-DTQYUF4Z.js index db07875e9..564780ee6 100644 --- a/web/assets/MetricsConsentView-Df03LOI_.js +++ b/web/assets/MetricsConsentView-DTQYUF4Z.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.js"; -import { d as defineComponent, aR as useToast, K as useI18n, U as ref, be as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, a7 as createTextVNode, k as createVNode, j as unref, bn as script, l as script$1, b5 as electronAPI } from "./index-CmVtQCAR.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.js"; +import { d as defineComponent, aR as useToast, K as useI18n, U as ref, be as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, a7 as createTextVNode, k as createVNode, j as unref, bn as script, l as script$1, b5 as electronAPI } from "./index-4Hb32CNk.js"; const _hoisted_1 = { class: "h-full p-8 2xl:p-16 flex flex-col items-center justify-center" }; const _hoisted_2 = { class: "bg-neutral-800 rounded-lg shadow-lg p-6 w-full max-w-[600px] flex flex-col gap-6" }; const _hoisted_3 = { class: "text-3xl font-semibold text-neutral-100" }; @@ -83,4 +83,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=MetricsConsentView-Df03LOI_.js.map +//# sourceMappingURL=MetricsConsentView-DTQYUF4Z.js.map diff --git a/web/assets/NotSupportedView-BRtvC5Gx.js b/web/assets/NotSupportedView-PDDrAb9U.js similarity index 96% rename from web/assets/NotSupportedView-BRtvC5Gx.js rename to web/assets/NotSupportedView-PDDrAb9U.js index 20fd1a28e..0293bb6fe 100644 --- a/web/assets/NotSupportedView-BRtvC5Gx.js +++ b/web/assets/NotSupportedView-PDDrAb9U.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, be as useRouter, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, i as withDirectives, _ as _export_sfc } from "./index-CmVtQCAR.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.js"; +import { d as defineComponent, be as useRouter, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, i as withDirectives, _ as _export_sfc } from "./index-4Hb32CNk.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.js"; const _imports_0 = "" + new URL("images/sad_girl.png", import.meta.url).href; const _hoisted_1 = { class: "sad-container" }; const _hoisted_2 = { class: "no-drag sad-text flex items-center" }; @@ -83,4 +83,4 @@ const NotSupportedView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", " export { NotSupportedView as default }; -//# sourceMappingURL=NotSupportedView-BRtvC5Gx.js.map +//# sourceMappingURL=NotSupportedView-PDDrAb9U.js.map diff --git a/web/assets/ServerConfigPanel-C2nrpEEV.js b/web/assets/ServerConfigPanel-DnGhsuUV.js similarity index 98% rename from web/assets/ServerConfigPanel-C2nrpEEV.js rename to web/assets/ServerConfigPanel-DnGhsuUV.js index 4993d68e5..873f6ec76 100644 --- a/web/assets/ServerConfigPanel-C2nrpEEV.js +++ b/web/assets/ServerConfigPanel-DnGhsuUV.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { o as openBlock, f as createElementBlock, m as createBaseVNode, H as markRaw, d as defineComponent, a as useSettingStore, ae as storeToRefs, O as watch, dy as useCopyToClipboard, K as useI18n, y as createBlock, z as withCtx, j as unref, bj as script, E as toDisplayString, D as renderList, F as Fragment, k as createVNode, l as script$1, B as createCommentVNode, bh as script$2, dz as FormItem, dn as _sfc_main$1, b5 as electronAPI } from "./index-CmVtQCAR.js"; -import { u as useServerConfigStore } from "./serverConfigStore-BUvaGcxp.js"; +import { o as openBlock, f as createElementBlock, m as createBaseVNode, H as markRaw, d as defineComponent, a as useSettingStore, ae as storeToRefs, O as watch, dy as useCopyToClipboard, K as useI18n, y as createBlock, z as withCtx, j as unref, bj as script, E as toDisplayString, D as renderList, F as Fragment, k as createVNode, l as script$1, B as createCommentVNode, bh as script$2, dz as FormItem, dn as _sfc_main$1, b5 as electronAPI } from "./index-4Hb32CNk.js"; +import { u as useServerConfigStore } from "./serverConfigStore-BYbZcbWj.js"; const _hoisted_1$1 = { viewBox: "0 0 24 24", width: "1.2em", @@ -153,4 +153,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ServerConfigPanel-C2nrpEEV.js.map +//# sourceMappingURL=ServerConfigPanel-DnGhsuUV.js.map diff --git a/web/assets/ServerStartView-M5VckhgZ.js b/web/assets/ServerStartView-yzYZ8gms.js similarity index 96% rename from web/assets/ServerStartView-M5VckhgZ.js rename to web/assets/ServerStartView-yzYZ8gms.js index c19fa837e..18a6a63f1 100644 --- a/web/assets/ServerStartView-M5VckhgZ.js +++ b/web/assets/ServerStartView-yzYZ8gms.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, K as useI18n, U as ref, bk as ProgressStatus, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, a7 as createTextVNode, E as toDisplayString, j as unref, f as createElementBlock, B as createCommentVNode, k as createVNode, l as script, i as withDirectives, v as vShow, bl as BaseTerminal, b5 as electronAPI, _ as _export_sfc } from "./index-CmVtQCAR.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.js"; +import { d as defineComponent, K as useI18n, U as ref, bk as ProgressStatus, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, a7 as createTextVNode, E as toDisplayString, j as unref, f as createElementBlock, B as createCommentVNode, k as createVNode, l as script, i as withDirectives, v as vShow, bl as BaseTerminal, b5 as electronAPI, _ as _export_sfc } from "./index-4Hb32CNk.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.js"; const _hoisted_1 = { class: "flex flex-col w-full h-full items-center" }; const _hoisted_2 = { class: "text-2xl font-bold" }; const _hoisted_3 = { key: 0 }; @@ -97,4 +97,4 @@ const ServerStartView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { ServerStartView as default }; -//# sourceMappingURL=ServerStartView-M5VckhgZ.js.map +//# sourceMappingURL=ServerStartView-yzYZ8gms.js.map diff --git a/web/assets/UserSelectView-DNnNy-AZ.js b/web/assets/UserSelectView-DeJDnrF0.js similarity index 97% rename from web/assets/UserSelectView-DNnNy-AZ.js rename to web/assets/UserSelectView-DeJDnrF0.js index 88736e455..13504917d 100644 --- a/web/assets/UserSelectView-DNnNy-AZ.js +++ b/web/assets/UserSelectView-DeJDnrF0.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, aj as useUserStore, be as useRouter, U as ref, c as computed, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, bf as withKeys, j as unref, bg as script, bh as script$1, bi as script$2, bj as script$3, a7 as createTextVNode, B as createCommentVNode, l as script$4 } from "./index-CmVtQCAR.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.js"; +import { d as defineComponent, aj as useUserStore, be as useRouter, U as ref, c as computed, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, bf as withKeys, j as unref, bg as script, bh as script$1, bi as script$2, bj as script$3, a7 as createTextVNode, B as createCommentVNode, l as script$4 } from "./index-4Hb32CNk.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.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" @@ -98,4 +98,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=UserSelectView-DNnNy-AZ.js.map +//# sourceMappingURL=UserSelectView-DeJDnrF0.js.map diff --git a/web/assets/WelcomeView-Nvn1jaCx.js b/web/assets/WelcomeView-DkwLdayn.js similarity index 91% rename from web/assets/WelcomeView-Nvn1jaCx.js rename to web/assets/WelcomeView-DkwLdayn.js index 75b0d677a..95afcd734 100644 --- a/web/assets/WelcomeView-Nvn1jaCx.js +++ b/web/assets/WelcomeView-DkwLdayn.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, be as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, _ as _export_sfc } from "./index-CmVtQCAR.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cof5Ihf_.js"; +import { d as defineComponent, be as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, _ as _export_sfc } from "./index-4Hb32CNk.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.js"; 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({ @@ -36,4 +36,4 @@ const WelcomeView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data- export { WelcomeView as default }; -//# sourceMappingURL=WelcomeView-Nvn1jaCx.js.map +//# sourceMappingURL=WelcomeView-DkwLdayn.js.map diff --git a/web/assets/index-CmVtQCAR.js b/web/assets/index-4Hb32CNk.js similarity index 99% rename from web/assets/index-CmVtQCAR.js rename to web/assets/index-4Hb32CNk.js index 4d89b4a55..ba83b1a4c 100644 --- a/web/assets/index-CmVtQCAR.js +++ b/web/assets/index-4Hb32CNk.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-DKrBTQLe.js","./index-BWow9lpT.js","./index-I0brO37W.js","./keybindingService-CqSjCYw-.js","./serverConfigStore-BUvaGcxp.js","./GraphView-CVCdiww1.css","./UserSelectView-DNnNy-AZ.js","./BaseViewTemplate-Cof5Ihf_.js","./ServerStartView-M5VckhgZ.js","./ServerStartView-CJiwVDQY.css","./InstallView-C6tMsokB.js","./index-Bm1HvJhs.js","./uvMirrors-B-HKMf6X.js","./InstallView-DbJ2cGfL.css","./WelcomeView-Nvn1jaCx.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-BRtvC5Gx.js","./NotSupportedView-RFx6eCkN.css","./DownloadGitView-At9xRwC5.js","./ManualConfigurationView-CtZMj_n_.js","./ManualConfigurationView-CsirlNfV.css","./MetricsConsentView-Df03LOI_.js","./DesktopStartView-DTiwKLp6.js","./MaintenanceView-D3drnrFc.js","./index-CdHVC5qq.js","./MaintenanceView-Bj5_Vr6o.css","./KeybindingPanel-BbfXtVg1.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-C_ZBlIyE.js","./ServerConfigPanel-C2nrpEEV.js","./index-BPn8eYlx.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-CUSGEqGS.js","./index-D4CAJ2MK.js","./index-D6zf5KAf.js","./keybindingService-BTNdTpfl.js","./serverConfigStore-BYbZcbWj.js","./GraphView-CVCdiww1.css","./UserSelectView-DeJDnrF0.js","./BaseViewTemplate-v6omkdXg.js","./ServerStartView-yzYZ8gms.js","./ServerStartView-CJiwVDQY.css","./InstallView-DTDlVr0Z.js","./index-hkkV7N7e.js","./uvMirrors-B-HKMf6X.js","./InstallView-DbJ2cGfL.css","./WelcomeView-DkwLdayn.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-PDDrAb9U.js","./NotSupportedView-RFx6eCkN.css","./DownloadGitView-3STu4yxt.js","./ManualConfigurationView-DueOvLuK.js","./ManualConfigurationView-CsirlNfV.css","./MetricsConsentView-DTQYUF4Z.js","./DesktopStartView-coDnSXEF.js","./MaintenanceView-B5Gl0Rrl.js","./index-nJubvliG.js","./MaintenanceView-Bj5_Vr6o.css","./KeybindingPanel-C0Nt6GXU.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-GE0aOkbr.js","./ServerConfigPanel-DnGhsuUV.js","./index-B4tExwG7.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); var __defProp2 = Object.defineProperty; var __name = (target2, value4) => __defProp2(target2, "name", { value: value4, configurable: true }); (/* @__PURE__ */ __name(function polyfill2() { @@ -73523,7 +73523,7 @@ const router = createRouter({ { path: "", name: "GraphView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./GraphView-DKrBTQLe.js"), true ? __vite__mapDeps([0,1,2,3,4,5]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./GraphView-CUSGEqGS.js"), true ? __vite__mapDeps([0,1,2,3,4,5]) : void 0, import.meta.url), "component"), beforeEnter: /* @__PURE__ */ __name(async (to, from2, next2) => { const userStore = useUserStore(); await userStore.initialize(); @@ -73537,60 +73537,60 @@ const router = createRouter({ { path: "user-select", name: "UserSelectView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./UserSelectView-DNnNy-AZ.js"), true ? __vite__mapDeps([6,7]) : void 0, import.meta.url), "component") + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./UserSelectView-DeJDnrF0.js"), true ? __vite__mapDeps([6,7]) : void 0, import.meta.url), "component") }, { path: "server-start", name: "ServerStartView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ServerStartView-M5VckhgZ.js"), true ? __vite__mapDeps([8,7,9]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ServerStartView-yzYZ8gms.js"), true ? __vite__mapDeps([8,7,9]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "install", name: "InstallView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./InstallView-C6tMsokB.js"), true ? __vite__mapDeps([10,11,12,7,13]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./InstallView-DTDlVr0Z.js"), true ? __vite__mapDeps([10,11,12,7,13]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "welcome", name: "WelcomeView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./WelcomeView-Nvn1jaCx.js"), true ? __vite__mapDeps([14,7,15]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./WelcomeView-DkwLdayn.js"), true ? __vite__mapDeps([14,7,15]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "not-supported", name: "NotSupportedView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./NotSupportedView-BRtvC5Gx.js"), true ? __vite__mapDeps([16,7,17]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./NotSupportedView-PDDrAb9U.js"), true ? __vite__mapDeps([16,7,17]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "download-git", name: "DownloadGitView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DownloadGitView-At9xRwC5.js"), true ? __vite__mapDeps([18,7]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DownloadGitView-3STu4yxt.js"), true ? __vite__mapDeps([18,7]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "manual-configuration", name: "ManualConfigurationView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ManualConfigurationView-CtZMj_n_.js"), true ? __vite__mapDeps([19,7,20]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ManualConfigurationView-DueOvLuK.js"), true ? __vite__mapDeps([19,7,20]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "/metrics-consent", name: "MetricsConsentView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MetricsConsentView-Df03LOI_.js"), true ? __vite__mapDeps([21,7]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MetricsConsentView-DTQYUF4Z.js"), true ? __vite__mapDeps([21,7]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "desktop-start", name: "DesktopStartView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DesktopStartView-DTiwKLp6.js"), true ? __vite__mapDeps([22,7]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DesktopStartView-coDnSXEF.js"), true ? __vite__mapDeps([22,7]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "maintenance", name: "MaintenanceView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MaintenanceView-D3drnrFc.js"), true ? __vite__mapDeps([23,1,2,24,11,7,25]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MaintenanceView-B5Gl0Rrl.js"), true ? __vite__mapDeps([23,1,2,24,11,7,25]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess } ] @@ -85608,7 +85608,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({ }); const config$1 = { app_title: "ComfyUI", - app_version: "1.8.12" + app_version: "1.8.13" }; /*! * shared v9.13.1 @@ -153413,7 +153413,7 @@ const useSystemStatsStore = /* @__PURE__ */ defineStore("systemStats", () => { }; }); const useAboutPanelStore = /* @__PURE__ */ defineStore("aboutPanel", () => { - const frontendVersion = "1.8.12"; + const frontendVersion = "1.8.13"; const extensionStore = useExtensionStore(); const systemStatsStore = useSystemStatsStore(); const coreVersion = computed( @@ -158831,13 +158831,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({ setup(__props) { const props = __props; const KeybindingPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./KeybindingPanel-BbfXtVg1.js"), true ? __vite__mapDeps([26,24,2,3,27]) : void 0, import.meta.url) + () => __vitePreload(() => import("./KeybindingPanel-C0Nt6GXU.js"), true ? __vite__mapDeps([26,24,2,3,27]) : void 0, import.meta.url) ); const ExtensionPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./ExtensionPanel-C_ZBlIyE.js"), true ? __vite__mapDeps([28,24,2]) : void 0, import.meta.url) + () => __vitePreload(() => import("./ExtensionPanel-GE0aOkbr.js"), true ? __vite__mapDeps([28,24,2]) : void 0, import.meta.url) ); const ServerConfigPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./ServerConfigPanel-C2nrpEEV.js"), true ? __vite__mapDeps([29,4]) : void 0, import.meta.url) + () => __vitePreload(() => import("./ServerConfigPanel-DnGhsuUV.js"), true ? __vite__mapDeps([29,4]) : void 0, import.meta.url) ); const aboutPanelNode = { key: "about", @@ -199422,7 +199422,7 @@ const useExtensionService = /* @__PURE__ */ __name(() => { settingStore.get("Comfy.Extension.Disabled") ); const extensions = await api.getExtensions(); - await __vitePreload(() => import("./index-BPn8eYlx.js"), true ? __vite__mapDeps([30,12,31]) : void 0, import.meta.url); + await __vitePreload(() => import("./index-B4tExwG7.js"), true ? __vite__mapDeps([30,12,31]) : void 0, import.meta.url); extensionStore.captureCoreExtensions(); await Promise.all( extensions.filter((extension) => !extension.includes("extensions/core")).map(async (ext) => { @@ -219745,7 +219745,7 @@ init$3({ app, dsn: "https://e2d0c0bd392ffdce48e856c2a055f437@o4507954455314432.ingest.us.sentry.io/4508621568475136", enabled: true, - release: "1.8.12", + release: "1.8.13", integrations: [], autoSessionTracking: false, defaultIntegrations: false, @@ -220051,4 +220051,4 @@ export { createBlock as y, withCtx as z }; -//# sourceMappingURL=index-CmVtQCAR.js.map +//# sourceMappingURL=index-4Hb32CNk.js.map diff --git a/web/assets/index-BPn8eYlx.js b/web/assets/index-B4tExwG7.js similarity index 99% rename from web/assets/index-BPn8eYlx.js rename to web/assets/index-B4tExwG7.js index 8adb2181b..c27c17cd5 100644 --- a/web/assets/index-BPn8eYlx.js +++ b/web/assets/index-B4tExwG7.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { da as ComfyDialog, db as $el, dc as ComfyApp, h as app, M as LiteGraph, aF as LGraphCanvas, dd as useExtensionService, de as processDynamicPrompt, b4 as isElectron, b5 as electronAPI, b as useWorkflowStore, bu as checkMirrorReachable, b7 as useDialogService, bc as t, df as DraggableList, aS as useToastStore, $ as LGraphNode, dg as applyTextReplacements, dh as ComfyWidgets, di as addValueControlWidgets, P as useNodeDefStore, dj as serialise, dk as deserialiseAndCreate, aH as api, a as useSettingStore, Z as LGraphGroup, W as nextTick, b0 as lodashExports, aK as setStorageValue, aI as getStorageValue } from "./index-CmVtQCAR.js"; +import { da as ComfyDialog, db as $el, dc as ComfyApp, h as app, M as LiteGraph, aF as LGraphCanvas, dd as useExtensionService, de as processDynamicPrompt, b4 as isElectron, b5 as electronAPI, b as useWorkflowStore, bu as checkMirrorReachable, b7 as useDialogService, bc as t, df as DraggableList, aS as useToastStore, $ as LGraphNode, dg as applyTextReplacements, dh as ComfyWidgets, di as addValueControlWidgets, P as useNodeDefStore, dj as serialise, dk as deserialiseAndCreate, aH as api, a as useSettingStore, Z as LGraphGroup, W as nextTick, b0 as lodashExports, aK as setStorageValue, aI as getStorageValue } from "./index-4Hb32CNk.js"; import { P as PYTHON_MIRROR } from "./uvMirrors-B-HKMf6X.js"; class ClipspaceDialog extends ComfyDialog { static { @@ -2194,22 +2194,14 @@ class GroupNodeConfig { let name = customConfig?.name ?? node.inputs?.find((inp) => inp.name === inputName)?.label ?? inputName; let key = name; let prefix = ""; - seenInputs[key] = (seenInputs[key] ?? 0) + 1; - if (node.type === "PrimitiveNode" && node.title || seenInputs[name] > 1) { + if (node.type === "PrimitiveNode" && node.title || name in seenInputs) { prefix = `${node.title ?? node.type} `; key = name = `${prefix}${inputName}`; - seenInputs[name] = seenInputs[name] ?? 0; - let finalName; - if (seenInputs[name] > 0) { - prefix = `${node.title ?? node.type} `; - finalName = `${prefix} ${seenInputs[name] + 1} ${inputName}`; - } else { - prefix = `${node.title ?? node.type} `; - finalName = `${prefix}${inputName}`; + if (name in seenInputs) { + name = `${prefix}${seenInputs[name]} ${inputName}`; } - seenInputs[name]++; - this.nodeDef.input.required[finalName] = config; } + seenInputs[key] = (seenInputs[key] ?? 1) + 1; if (inputName === "seed" || inputName === "noise_seed") { if (!extra) extra = {}; extra.control_after_generate = `${prefix}control_after_generate`; @@ -2383,20 +2375,23 @@ class GroupNodeConfig { }; this.nodeDef.output.push(def.output[outputId]); this.nodeDef.output_is_list.push(def.output_is_list[outputId]); - let label = customConfig?.name ?? // If no custom name, check if the definition provides an output name - def.output_name?.[outputId] ?? // If neither exist, fallback to the raw output type (e.g., "FLOAT", "INT") - def.output[outputId]; + let label = customConfig?.name; if (!label) { - const output = node.outputs.find((o) => o.name); - label = output?.label ?? "UnnamedOutput"; + label = def.output_name?.[outputId] ?? def.output[outputId]; + const output = node.outputs.find((o) => o.name === label); + if (output?.label) { + label = output.label; + } } let name = label; - const prefix = `${node.title ?? node.type} `; - name = `${prefix}${label}`; - if (seenOutputs[name]) { - name = `${prefix} ${seenOutputs[name] + 1} ${label}`; + if (name in seenOutputs) { + const prefix = `${node.title ?? node.type} `; + name = `${prefix}${label}`; + if (name in seenOutputs) { + name = `${prefix}${node.index} ${label}`; + } } - seenOutputs[name] = (seenOutputs[name] ?? 0) + 1; + seenOutputs[name] = 1; this.nodeDef.output_name.push(name); } } @@ -53849,4 +53844,4 @@ app.registerExtension({ }); } }); -//# sourceMappingURL=index-BPn8eYlx.js.map +//# sourceMappingURL=index-B4tExwG7.js.map diff --git a/web/assets/index-BWow9lpT.js b/web/assets/index-D4CAJ2MK.js similarity index 99% rename from web/assets/index-BWow9lpT.js rename to web/assets/index-D4CAJ2MK.js index 25679fc8e..844ee64e4 100644 --- a/web/assets/index-BWow9lpT.js +++ b/web/assets/index-D4CAJ2MK.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bA as BaseStyle, bB as script$f, cQ as getWidth, d4 as getHeight, c3 as getOuterWidth, d5 as getOuterHeight, c_ as isRTL, cU as getVNodeProp, d6 as isArray, o as openBlock, f as createElementBlock, as as mergeProps, F as Fragment, D as renderList, y as createBlock, C as resolveDynamicComponent, m as createBaseVNode, B as createCommentVNode, A as renderSlot, bP as getAttribute, bO as findSingle, bE as focus, ce as equals, bS as Ripple, r as resolveDirective, i as withDirectives, z as withCtx, ai as normalizeClass, cR as getOffset, cb as script$g, bU as script$h, cd as isNotEmpty, b_ as script$i, bT as UniqueComponentId, bC as ZIndex, cc as resolveFieldData, c8 as OverlayEventBus, ci as isEmpty, b$ as addStyle, c2 as relativePosition, c4 as absolutePosition, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, cj as findLastIndex, bg as script$j, cH as script$k, bI as script$l, bR as script$m, ck as script$n, a8 as script$o, bK as resolveComponent, n as normalizeStyle, k as createVNode, E as toDisplayString, bL as Transition, co as createSlots, a7 as createTextVNode, cu as script$p, bZ as script$q, cA as script$r, cB as script$s, bJ as script$t, cv as normalizeProps, d7 as ToastEventBus, c9 as setAttribute, d8 as TransitionGroup, cq as resolve, d9 as nestedPosition, cf as script$u, ch as isPrintableCharacter, l as script$v, cD as script$w, cx as guardReactiveProps } from "./index-CmVtQCAR.js"; -import { s as script$x } from "./index-I0brO37W.js"; +import { bA as BaseStyle, bB as script$f, cQ as getWidth, d4 as getHeight, c3 as getOuterWidth, d5 as getOuterHeight, c_ as isRTL, cU as getVNodeProp, d6 as isArray, o as openBlock, f as createElementBlock, as as mergeProps, F as Fragment, D as renderList, y as createBlock, C as resolveDynamicComponent, m as createBaseVNode, B as createCommentVNode, A as renderSlot, bP as getAttribute, bO as findSingle, bE as focus, ce as equals, bS as Ripple, r as resolveDirective, i as withDirectives, z as withCtx, ai as normalizeClass, cR as getOffset, cb as script$g, bU as script$h, cd as isNotEmpty, b_ as script$i, bT as UniqueComponentId, bC as ZIndex, cc as resolveFieldData, c8 as OverlayEventBus, ci as isEmpty, b$ as addStyle, c2 as relativePosition, c4 as absolutePosition, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, cj as findLastIndex, bg as script$j, cH as script$k, bI as script$l, bR as script$m, ck as script$n, a8 as script$o, bK as resolveComponent, n as normalizeStyle, k as createVNode, E as toDisplayString, bL as Transition, co as createSlots, a7 as createTextVNode, cu as script$p, bZ as script$q, cA as script$r, cB as script$s, bJ as script$t, cv as normalizeProps, d7 as ToastEventBus, c9 as setAttribute, d8 as TransitionGroup, cq as resolve, d9 as nestedPosition, cf as script$u, ch as isPrintableCharacter, l as script$v, cD as script$w, cx as guardReactiveProps } from "./index-4Hb32CNk.js"; +import { s as script$x } from "./index-D6zf5KAf.js"; 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"); @@ -5602,4 +5602,4 @@ export { script$7 as k, script$d as s }; -//# sourceMappingURL=index-BWow9lpT.js.map +//# sourceMappingURL=index-D4CAJ2MK.js.map diff --git a/web/assets/index-I0brO37W.js b/web/assets/index-D6zf5KAf.js similarity index 94% rename from web/assets/index-I0brO37W.js rename to web/assets/index-D6zf5KAf.js index 6f1166641..819caaa2a 100644 --- a/web/assets/index-I0brO37W.js +++ b/web/assets/index-D6zf5KAf.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bZ as script$1, o as openBlock, f as createElementBlock, as as mergeProps, m as createBaseVNode } from "./index-CmVtQCAR.js"; +import { bZ as script$1, o as openBlock, f as createElementBlock, as as mergeProps, m as createBaseVNode } from "./index-4Hb32CNk.js"; var script = { name: "BarsIcon", "extends": script$1 @@ -24,4 +24,4 @@ script.render = render; export { script as s }; -//# sourceMappingURL=index-I0brO37W.js.map +//# sourceMappingURL=index-D6zf5KAf.js.map diff --git a/web/assets/index-Bm1HvJhs.js b/web/assets/index-hkkV7N7e.js similarity index 99% rename from web/assets/index-Bm1HvJhs.js rename to web/assets/index-hkkV7N7e.js index 1c1a50760..7152922d0 100644 --- a/web/assets/index-Bm1HvJhs.js +++ b/web/assets/index-hkkV7N7e.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -import { bA as BaseStyle, bB as script$6, o as openBlock, f as createElementBlock, as as mergeProps, cJ as findIndexInList, c5 as find, bK as resolveComponent, y as createBlock, C as resolveDynamicComponent, z as withCtx, m as createBaseVNode, E as toDisplayString, A as renderSlot, B as createCommentVNode, ai as normalizeClass, bO as findSingle, F as Fragment, bL as Transition, i as withDirectives, v as vShow, bT as UniqueComponentId } from "./index-CmVtQCAR.js"; +import { bA as BaseStyle, bB as script$6, o as openBlock, f as createElementBlock, as as mergeProps, cJ as findIndexInList, c5 as find, bK as resolveComponent, y as createBlock, C as resolveDynamicComponent, z as withCtx, m as createBaseVNode, E as toDisplayString, A as renderSlot, B as createCommentVNode, ai as normalizeClass, bO as findSingle, F as Fragment, bL as Transition, i as withDirectives, v as vShow, bT as UniqueComponentId } from "./index-4Hb32CNk.js"; var classes$4 = { root: /* @__PURE__ */ __name(function root(_ref) { var instance = _ref.instance; @@ -536,4 +536,4 @@ export { script as d, script$4 as s }; -//# sourceMappingURL=index-Bm1HvJhs.js.map +//# sourceMappingURL=index-hkkV7N7e.js.map diff --git a/web/assets/index-CdHVC5qq.js b/web/assets/index-nJubvliG.js similarity index 99% rename from web/assets/index-CdHVC5qq.js rename to web/assets/index-nJubvliG.js index f7678aece..3672a41b4 100644 --- a/web/assets/index-CdHVC5qq.js +++ b/web/assets/index-nJubvliG.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bA as BaseStyle, bB as script$s, bZ as script$t, o as openBlock, f as createElementBlock, as as mergeProps, m as createBaseVNode, E as toDisplayString, bS as Ripple, r as resolveDirective, i as withDirectives, y as createBlock, C as resolveDynamicComponent, bi as script$u, bK as resolveComponent, ai as normalizeClass, co as createSlots, z as withCtx, aU as script$v, cf as script$w, F as Fragment, D as renderList, a7 as createTextVNode, c9 as setAttribute, cv as normalizeProps, A as renderSlot, B as createCommentVNode, b_ as script$x, ce as equals, cA as script$y, br as script$z, cE as getFirstFocusableElement, c8 as OverlayEventBus, cU as getVNodeProp, cc as resolveFieldData, ds as invokeElementMethod, bP as getAttribute, cV as getNextElementSibling, c3 as getOuterWidth, cW as getPreviousElementSibling, l as script$A, bR as script$B, bU as script$C, bJ as script$E, cd as isNotEmpty, ar as withModifiers, d5 as getOuterHeight, bT as UniqueComponentId, cY as _default, bC as ZIndex, bE as focus, b$ as addStyle, c4 as absolutePosition, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, dt as FilterOperator, bI as script$F, cs as script$G, bH as FocusTrap, k as createVNode, bL as Transition, bf as withKeys, c6 as getIndex, cu as script$H, cX as isClickable, cZ as clearSelection, ca as localeComparator, cn as sort, cG as FilterService, dl as FilterMatchMode, bO as findSingle, cJ as findIndexInList, c5 as find, du as exportCSV, cR as getOffset, c_ as isRTL, dv as getHiddenElementOuterWidth, dw as getHiddenElementOuterHeight, dx as reorderArray, bW as removeClass, bD as addClass, ci as isEmpty, cH as script$I, ck as script$J } from "./index-CmVtQCAR.js"; -import { s as script$D } from "./index-I0brO37W.js"; +import { bA as BaseStyle, bB as script$s, bZ as script$t, o as openBlock, f as createElementBlock, as as mergeProps, m as createBaseVNode, E as toDisplayString, bS as Ripple, r as resolveDirective, i as withDirectives, y as createBlock, C as resolveDynamicComponent, bi as script$u, bK as resolveComponent, ai as normalizeClass, co as createSlots, z as withCtx, aU as script$v, cf as script$w, F as Fragment, D as renderList, a7 as createTextVNode, c9 as setAttribute, cv as normalizeProps, A as renderSlot, B as createCommentVNode, b_ as script$x, ce as equals, cA as script$y, br as script$z, cE as getFirstFocusableElement, c8 as OverlayEventBus, cU as getVNodeProp, cc as resolveFieldData, ds as invokeElementMethod, bP as getAttribute, cV as getNextElementSibling, c3 as getOuterWidth, cW as getPreviousElementSibling, l as script$A, bR as script$B, bU as script$C, bJ as script$E, cd as isNotEmpty, ar as withModifiers, d5 as getOuterHeight, bT as UniqueComponentId, cY as _default, bC as ZIndex, bE as focus, b$ as addStyle, c4 as absolutePosition, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, dt as FilterOperator, bI as script$F, cs as script$G, bH as FocusTrap, k as createVNode, bL as Transition, bf as withKeys, c6 as getIndex, cu as script$H, cX as isClickable, cZ as clearSelection, ca as localeComparator, cn as sort, cG as FilterService, dl as FilterMatchMode, bO as findSingle, cJ as findIndexInList, c5 as find, du as exportCSV, cR as getOffset, c_ as isRTL, dv as getHiddenElementOuterWidth, dw as getHiddenElementOuterHeight, dx as reorderArray, bW as removeClass, bD as addClass, ci as isEmpty, cH as script$I, ck as script$J } from "./index-4Hb32CNk.js"; +import { s as script$D } from "./index-D6zf5KAf.js"; var ColumnStyle = BaseStyle.extend({ name: "column" }); @@ -8787,4 +8787,4 @@ export { script as h, script$l as s }; -//# sourceMappingURL=index-CdHVC5qq.js.map +//# sourceMappingURL=index-nJubvliG.js.map diff --git a/web/assets/keybindingService-CqSjCYw-.js b/web/assets/keybindingService-BTNdTpfl.js similarity index 98% rename from web/assets/keybindingService-CqSjCYw-.js rename to web/assets/keybindingService-BTNdTpfl.js index fd9786b4a..a9c8bd67d 100644 --- a/web/assets/keybindingService-CqSjCYw-.js +++ b/web/assets/keybindingService-BTNdTpfl.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { an as useKeybindingStore, L as useCommandStore, a as useSettingStore, dp as KeyComboImpl, dq as KeybindingImpl } from "./index-CmVtQCAR.js"; +import { an as useKeybindingStore, L as useCommandStore, a as useSettingStore, dp as KeyComboImpl, dq as KeybindingImpl } from "./index-4Hb32CNk.js"; const CORE_KEYBINDINGS = [ { combo: { @@ -247,4 +247,4 @@ const useKeybindingService = /* @__PURE__ */ __name(() => { export { useKeybindingService as u }; -//# sourceMappingURL=keybindingService-CqSjCYw-.js.map +//# sourceMappingURL=keybindingService-BTNdTpfl.js.map diff --git a/web/assets/serverConfigStore-BUvaGcxp.js b/web/assets/serverConfigStore-BYbZcbWj.js similarity index 97% rename from web/assets/serverConfigStore-BUvaGcxp.js rename to web/assets/serverConfigStore-BYbZcbWj.js index a1fcb7d29..2c876288d 100644 --- a/web/assets/serverConfigStore-BUvaGcxp.js +++ b/web/assets/serverConfigStore-BYbZcbWj.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { I as defineStore, U as ref, c as computed } from "./index-CmVtQCAR.js"; +import { I as defineStore, U as ref, c as computed } from "./index-4Hb32CNk.js"; const useServerConfigStore = defineStore("serverConfig", () => { const serverConfigById = ref({}); const serverConfigs = computed(() => { @@ -87,4 +87,4 @@ const useServerConfigStore = defineStore("serverConfig", () => { export { useServerConfigStore as u }; -//# sourceMappingURL=serverConfigStore-BUvaGcxp.js.map +//# sourceMappingURL=serverConfigStore-BYbZcbWj.js.map diff --git a/web/index.html b/web/index.html index 1e99942b6..b62467005 100644 --- a/web/index.html +++ b/web/index.html @@ -6,7 +6,7 @@ - + From ed4d92b72161dd96480beb1b2838e5bae65ba56e Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 3 Feb 2025 03:31:39 -0500 Subject: [PATCH 068/478] Model merging nodes for cosmos. --- .../nodes_model_merging_model_specific.py | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/comfy_extras/nodes_model_merging_model_specific.py b/comfy_extras/nodes_model_merging_model_specific.py index 7cd8f98b2..3e37f70d4 100644 --- a/comfy_extras/nodes_model_merging_model_specific.py +++ b/comfy_extras/nodes_model_merging_model_specific.py @@ -196,6 +196,54 @@ class ModelMergeLTXV(comfy_extras.nodes_model_merging.ModelMergeBlocks): return {"required": arg_dict} +class ModelMergeCosmos7B(comfy_extras.nodes_model_merging.ModelMergeBlocks): + CATEGORY = "advanced/model_merging/model_specific" + + @classmethod + def INPUT_TYPES(s): + arg_dict = { "model1": ("MODEL",), + "model2": ("MODEL",)} + + argument = ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}) + + arg_dict["pos_embedder."] = argument + arg_dict["extra_pos_embedder."] = argument + arg_dict["x_embedder."] = argument + arg_dict["t_embedder."] = argument + arg_dict["affline_norm."] = argument + + + for i in range(28): + arg_dict["blocks.block{}.".format(i)] = argument + + arg_dict["final_layer."] = argument + + return {"required": arg_dict} + +class ModelMergeCosmos14B(comfy_extras.nodes_model_merging.ModelMergeBlocks): + CATEGORY = "advanced/model_merging/model_specific" + + @classmethod + def INPUT_TYPES(s): + arg_dict = { "model1": ("MODEL",), + "model2": ("MODEL",)} + + argument = ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}) + + arg_dict["pos_embedder."] = argument + arg_dict["extra_pos_embedder."] = argument + arg_dict["x_embedder."] = argument + arg_dict["t_embedder."] = argument + arg_dict["affline_norm."] = argument + + + for i in range(36): + arg_dict["blocks.block{}.".format(i)] = argument + + arg_dict["final_layer."] = argument + + return {"required": arg_dict} + NODE_CLASS_MAPPINGS = { "ModelMergeSD1": ModelMergeSD1, "ModelMergeSD2": ModelMergeSD1, #SD1 and SD2 have the same blocks @@ -206,4 +254,6 @@ NODE_CLASS_MAPPINGS = { "ModelMergeSD35_Large": ModelMergeSD35_Large, "ModelMergeMochiPreview": ModelMergeMochiPreview, "ModelMergeLTXV": ModelMergeLTXV, + "ModelMergeCosmos7B": ModelMergeCosmos7B, + "ModelMergeCosmos14B": ModelMergeCosmos14B, } From 8d88bfaff9bdf4ca70685c5c4d61d1b90b686a50 Mon Sep 17 00:00:00 2001 From: Raphael Walker Date: Mon, 3 Feb 2025 23:07:35 +0100 Subject: [PATCH 069/478] allow searching for new .pt2 extension, which can contain AOTI compiled modules (#6689) --- folder_paths.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folder_paths.py b/folder_paths.py index 3d8f61d4a..72c70f594 100644 --- a/folder_paths.py +++ b/folder_paths.py @@ -9,7 +9,7 @@ from collections.abc import Collection from comfy.cli_args import args -supported_pt_extensions: set[str] = {'.ckpt', '.pt', '.bin', '.pth', '.safetensors', '.pkl', '.sft'} +supported_pt_extensions: set[str] = {'.ckpt', '.pt', '.pt2', '.bin', '.pth', '.safetensors', '.pkl', '.sft'} folder_names_and_paths: dict[str, tuple[list[str], set[str]]] = {} From e5ea112a90ed5c22f0114dc29f5a9e7d8a897edf Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 4 Feb 2025 03:56:00 -0500 Subject: [PATCH 070/478] Support Lumina 2 model. --- comfy/ldm/lumina/model.py | 670 ++++++++++++++++++++ comfy/ldm/modules/diffusionmodules/mmdit.py | 2 +- comfy/model_base.py | 17 + comfy/model_detection.py | 17 +- comfy/sd.py | 11 +- comfy/sd1_clip.py | 17 +- comfy/supported_models.py | 32 +- comfy/text_encoders/llama.py | 132 +++- comfy/text_encoders/lumina2.py | 44 ++ comfy/text_encoders/spiece_tokenizer.py | 14 +- nodes.py | 4 +- 11 files changed, 921 insertions(+), 39 deletions(-) create mode 100644 comfy/ldm/lumina/model.py create mode 100644 comfy/text_encoders/lumina2.py diff --git a/comfy/ldm/lumina/model.py b/comfy/ldm/lumina/model.py new file mode 100644 index 000000000..24c6d80f2 --- /dev/null +++ b/comfy/ldm/lumina/model.py @@ -0,0 +1,670 @@ +# Code from: https://github.com/Alpha-VLLM/Lumina-Image-2.0/blob/main/models/model.py + +from typing import List, Optional, Tuple + +import torch +import torch.nn as nn +import torch.nn.functional as F + +from comfy.ldm.modules.diffusionmodules.mmdit import TimestepEmbedder, RMSNorm +from comfy.ldm.modules.attention import optimized_attention_masked + + +def modulate(x, scale): + return x * (1 + scale.unsqueeze(1)) + +############################################################################# +# Core NextDiT Model # +############################################################################# + + +class JointAttention(nn.Module): + """Multi-head attention module.""" + + def __init__( + self, + dim: int, + n_heads: int, + n_kv_heads: Optional[int], + qk_norm: bool, + operation_settings={}, + ): + """ + Initialize the Attention module. + + Args: + dim (int): Number of input dimensions. + n_heads (int): Number of heads. + n_kv_heads (Optional[int]): Number of kv heads, if using GQA. + + """ + super().__init__() + self.n_kv_heads = n_heads if n_kv_heads is None else n_kv_heads + self.n_local_heads = n_heads + self.n_local_kv_heads = self.n_kv_heads + self.n_rep = self.n_local_heads // self.n_local_kv_heads + self.head_dim = dim // n_heads + + self.qkv = operation_settings.get("operations").Linear( + dim, + (n_heads + self.n_kv_heads + self.n_kv_heads) * self.head_dim, + bias=False, + device=operation_settings.get("device"), + dtype=operation_settings.get("dtype"), + ) + self.out = operation_settings.get("operations").Linear( + n_heads * self.head_dim, + dim, + bias=False, + device=operation_settings.get("device"), + dtype=operation_settings.get("dtype"), + ) + + if qk_norm: + self.q_norm = RMSNorm(self.head_dim, elementwise_affine=True, **operation_settings) + self.k_norm = RMSNorm(self.head_dim, elementwise_affine=True, **operation_settings) + else: + self.q_norm = self.k_norm = nn.Identity() + + @staticmethod + def apply_rotary_emb( + x_in: torch.Tensor, + freqs_cis: torch.Tensor, + ) -> torch.Tensor: + """ + Apply rotary embeddings to input tensors using the given frequency + tensor. + + This function applies rotary embeddings to the given query 'xq' and + key 'xk' tensors using the provided frequency tensor 'freqs_cis'. The + input tensors are reshaped as complex numbers, and the frequency tensor + is reshaped for broadcasting compatibility. The resulting tensors + contain rotary embeddings and are returned as real tensors. + + Args: + x_in (torch.Tensor): Query or Key tensor to apply rotary embeddings. + freqs_cis (torch.Tensor): Precomputed frequency tensor for complex + exponentials. + + Returns: + Tuple[torch.Tensor, torch.Tensor]: Tuple of modified query tensor + and key tensor with rotary embeddings. + """ + + x = torch.view_as_complex(x_in.float().reshape(*x_in.shape[:-1], -1, 2)) + freqs_cis = freqs_cis.unsqueeze(2) + x_out = torch.view_as_real(x * freqs_cis).flatten(3) + return x_out.type_as(x_in) + + def forward( + self, + x: torch.Tensor, + x_mask: torch.Tensor, + freqs_cis: torch.Tensor, + ) -> torch.Tensor: + """ + + Args: + x: + x_mask: + freqs_cis: + + Returns: + + """ + bsz, seqlen, _ = x.shape + + xq, xk, xv = torch.split( + self.qkv(x), + [ + self.n_local_heads * self.head_dim, + self.n_local_kv_heads * self.head_dim, + self.n_local_kv_heads * self.head_dim, + ], + dim=-1, + ) + xq = xq.view(bsz, seqlen, self.n_local_heads, self.head_dim) + xk = xk.view(bsz, seqlen, self.n_local_kv_heads, self.head_dim) + xv = xv.view(bsz, seqlen, self.n_local_kv_heads, self.head_dim) + + xq = self.q_norm(xq) + xk = self.k_norm(xk) + xq = JointAttention.apply_rotary_emb(xq, freqs_cis=freqs_cis) + xk = JointAttention.apply_rotary_emb(xk, freqs_cis=freqs_cis) + + n_rep = self.n_local_heads // self.n_local_kv_heads + if n_rep >= 1: + xk = xk.unsqueeze(3).repeat(1, 1, 1, n_rep, 1).flatten(2, 3) + xv = xv.unsqueeze(3).repeat(1, 1, 1, n_rep, 1).flatten(2, 3) + output = optimized_attention_masked(xq.movedim(1, 2), xk.movedim(1, 2), xv.movedim(1, 2), self.n_local_heads, x_mask, skip_reshape=True) + + return self.out(output) + + +class FeedForward(nn.Module): + def __init__( + self, + dim: int, + hidden_dim: int, + multiple_of: int, + ffn_dim_multiplier: Optional[float], + operation_settings={}, + ): + """ + Initialize the FeedForward module. + + Args: + dim (int): Input dimension. + hidden_dim (int): Hidden dimension of the feedforward layer. + multiple_of (int): Value to ensure hidden dimension is a multiple + of this value. + ffn_dim_multiplier (float, optional): Custom multiplier for hidden + dimension. Defaults to None. + + """ + super().__init__() + # custom dim factor multiplier + if ffn_dim_multiplier is not None: + hidden_dim = int(ffn_dim_multiplier * hidden_dim) + hidden_dim = multiple_of * ((hidden_dim + multiple_of - 1) // multiple_of) + + self.w1 = operation_settings.get("operations").Linear( + dim, + hidden_dim, + bias=False, + device=operation_settings.get("device"), + dtype=operation_settings.get("dtype"), + ) + self.w2 = operation_settings.get("operations").Linear( + hidden_dim, + dim, + bias=False, + device=operation_settings.get("device"), + dtype=operation_settings.get("dtype"), + ) + self.w3 = operation_settings.get("operations").Linear( + dim, + hidden_dim, + bias=False, + device=operation_settings.get("device"), + dtype=operation_settings.get("dtype"), + ) + + # @torch.compile + def _forward_silu_gating(self, x1, x3): + return F.silu(x1) * x3 + + def forward(self, x): + return self.w2(self._forward_silu_gating(self.w1(x), self.w3(x))) + + +class JointTransformerBlock(nn.Module): + def __init__( + self, + layer_id: int, + dim: int, + n_heads: int, + n_kv_heads: int, + multiple_of: int, + ffn_dim_multiplier: float, + norm_eps: float, + qk_norm: bool, + modulation=True, + operation_settings={}, + ) -> None: + """ + Initialize a TransformerBlock. + + Args: + layer_id (int): Identifier for the layer. + dim (int): Embedding dimension of the input features. + n_heads (int): Number of attention heads. + n_kv_heads (Optional[int]): Number of attention heads in key and + value features (if using GQA), or set to None for the same as + query. + multiple_of (int): + ffn_dim_multiplier (float): + norm_eps (float): + + """ + super().__init__() + self.dim = dim + self.head_dim = dim // n_heads + self.attention = JointAttention(dim, n_heads, n_kv_heads, qk_norm, operation_settings=operation_settings) + self.feed_forward = FeedForward( + dim=dim, + hidden_dim=4 * dim, + multiple_of=multiple_of, + ffn_dim_multiplier=ffn_dim_multiplier, + operation_settings=operation_settings, + ) + self.layer_id = layer_id + self.attention_norm1 = RMSNorm(dim, eps=norm_eps, elementwise_affine=True, **operation_settings) + self.ffn_norm1 = RMSNorm(dim, eps=norm_eps, elementwise_affine=True, **operation_settings) + + self.attention_norm2 = RMSNorm(dim, eps=norm_eps, elementwise_affine=True, **operation_settings) + self.ffn_norm2 = RMSNorm(dim, eps=norm_eps, elementwise_affine=True, **operation_settings) + + self.modulation = modulation + if modulation: + self.adaLN_modulation = nn.Sequential( + nn.SiLU(), + operation_settings.get("operations").Linear( + min(dim, 1024), + 4 * dim, + bias=True, + device=operation_settings.get("device"), + dtype=operation_settings.get("dtype"), + ), + ) + + def forward( + self, + x: torch.Tensor, + x_mask: torch.Tensor, + freqs_cis: torch.Tensor, + adaln_input: Optional[torch.Tensor]=None, + ): + """ + Perform a forward pass through the TransformerBlock. + + Args: + x (torch.Tensor): Input tensor. + freqs_cis (torch.Tensor): Precomputed cosine and sine frequencies. + + Returns: + torch.Tensor: Output tensor after applying attention and + feedforward layers. + + """ + if self.modulation: + assert adaln_input is not None + scale_msa, gate_msa, scale_mlp, gate_mlp = self.adaLN_modulation(adaln_input).chunk(4, dim=1) + + x = x + gate_msa.unsqueeze(1).tanh() * self.attention_norm2( + self.attention( + modulate(self.attention_norm1(x), scale_msa), + x_mask, + freqs_cis, + ) + ) + x = x + gate_mlp.unsqueeze(1).tanh() * self.ffn_norm2( + self.feed_forward( + modulate(self.ffn_norm1(x), scale_mlp), + ) + ) + else: + assert adaln_input is None + x = x + self.attention_norm2( + self.attention( + self.attention_norm1(x), + x_mask, + freqs_cis, + ) + ) + x = x + self.ffn_norm2( + self.feed_forward( + self.ffn_norm1(x), + ) + ) + return x + + +class FinalLayer(nn.Module): + """ + The final layer of NextDiT. + """ + + def __init__(self, hidden_size, patch_size, out_channels, operation_settings={}): + super().__init__() + self.norm_final = operation_settings.get("operations").LayerNorm( + hidden_size, + elementwise_affine=False, + eps=1e-6, + device=operation_settings.get("device"), + dtype=operation_settings.get("dtype"), + ) + self.linear = operation_settings.get("operations").Linear( + hidden_size, + patch_size * patch_size * out_channels, + bias=True, + device=operation_settings.get("device"), + dtype=operation_settings.get("dtype"), + ) + + self.adaLN_modulation = nn.Sequential( + nn.SiLU(), + operation_settings.get("operations").Linear( + min(hidden_size, 1024), + hidden_size, + bias=True, + device=operation_settings.get("device"), + dtype=operation_settings.get("dtype"), + ), + ) + + def forward(self, x, c): + scale = self.adaLN_modulation(c) + x = modulate(self.norm_final(x), scale) + x = self.linear(x) + return x + + +class RopeEmbedder: + def __init__( + self, theta: float = 10000.0, axes_dims: List[int] = (16, 56, 56), axes_lens: List[int] = (1, 512, 512) + ): + super().__init__() + self.theta = theta + self.axes_dims = axes_dims + self.axes_lens = axes_lens + self.freqs_cis = NextDiT.precompute_freqs_cis(self.axes_dims, self.axes_lens, theta=self.theta) + + def __call__(self, ids: torch.Tensor): + self.freqs_cis = [freqs_cis.to(ids.device) for freqs_cis in self.freqs_cis] + result = [] + for i in range(len(self.axes_dims)): + index = ids[:, :, i:i+1].repeat(1, 1, self.freqs_cis[i].shape[-1]).to(torch.int64) + result.append(torch.gather(self.freqs_cis[i].unsqueeze(0).repeat(index.shape[0], 1, 1), dim=1, index=index)) + return torch.cat(result, dim=-1) + + +class NextDiT(nn.Module): + """ + Diffusion model with a Transformer backbone. + """ + + def __init__( + self, + patch_size: int = 2, + in_channels: int = 4, + dim: int = 4096, + n_layers: int = 32, + n_refiner_layers: int = 2, + n_heads: int = 32, + n_kv_heads: Optional[int] = None, + multiple_of: int = 256, + ffn_dim_multiplier: Optional[float] = None, + norm_eps: float = 1e-5, + qk_norm: bool = False, + cap_feat_dim: int = 5120, + axes_dims: List[int] = (16, 56, 56), + axes_lens: List[int] = (1, 512, 512), + image_model=None, + device=None, + dtype=None, + operations=None, + ) -> None: + super().__init__() + self.dtype = dtype + operation_settings = {"operations": operations, "device": device, "dtype": dtype} + self.in_channels = in_channels + self.out_channels = in_channels + self.patch_size = patch_size + + self.x_embedder = operation_settings.get("operations").Linear( + in_features=patch_size * patch_size * in_channels, + out_features=dim, + bias=True, + device=operation_settings.get("device"), + dtype=operation_settings.get("dtype"), + ) + + self.noise_refiner = nn.ModuleList( + [ + JointTransformerBlock( + layer_id, + dim, + n_heads, + n_kv_heads, + multiple_of, + ffn_dim_multiplier, + norm_eps, + qk_norm, + modulation=True, + operation_settings=operation_settings, + ) + for layer_id in range(n_refiner_layers) + ] + ) + self.context_refiner = nn.ModuleList( + [ + JointTransformerBlock( + layer_id, + dim, + n_heads, + n_kv_heads, + multiple_of, + ffn_dim_multiplier, + norm_eps, + qk_norm, + modulation=False, + operation_settings=operation_settings, + ) + for layer_id in range(n_refiner_layers) + ] + ) + + self.t_embedder = TimestepEmbedder(min(dim, 1024), **operation_settings) + self.cap_embedder = nn.Sequential( + RMSNorm(cap_feat_dim, eps=norm_eps, elementwise_affine=True, **operation_settings), + operation_settings.get("operations").Linear( + cap_feat_dim, + dim, + bias=True, + device=operation_settings.get("device"), + dtype=operation_settings.get("dtype"), + ), + ) + + self.layers = nn.ModuleList( + [ + JointTransformerBlock( + layer_id, + dim, + n_heads, + n_kv_heads, + multiple_of, + ffn_dim_multiplier, + norm_eps, + qk_norm, + operation_settings=operation_settings, + ) + for layer_id in range(n_layers) + ] + ) + self.norm_final = RMSNorm(dim, eps=norm_eps, elementwise_affine=True, **operation_settings) + self.final_layer = FinalLayer(dim, patch_size, self.out_channels, operation_settings=operation_settings) + + assert (dim // n_heads) == sum(axes_dims) + self.axes_dims = axes_dims + self.axes_lens = axes_lens + self.rope_embedder = RopeEmbedder(axes_dims=axes_dims, axes_lens=axes_lens) + self.dim = dim + self.n_heads = n_heads + + def unpatchify( + self, x: torch.Tensor, img_size: List[Tuple[int, int]], cap_size: List[int], return_tensor=False + ) -> List[torch.Tensor]: + """ + x: (N, T, patch_size**2 * C) + imgs: (N, H, W, C) + """ + pH = pW = self.patch_size + imgs = [] + for i in range(x.size(0)): + H, W = img_size[i] + begin = cap_size[i] + end = begin + (H // pH) * (W // pW) + imgs.append( + x[i][begin:end] + .view(H // pH, W // pW, pH, pW, self.out_channels) + .permute(4, 0, 2, 1, 3) + .flatten(3, 4) + .flatten(1, 2) + ) + + if return_tensor: + imgs = torch.stack(imgs, dim=0) + return imgs + + def patchify_and_embed( + self, x: List[torch.Tensor] | torch.Tensor, cap_feats: torch.Tensor, cap_mask: torch.Tensor, t: torch.Tensor, num_tokens + ) -> Tuple[torch.Tensor, torch.Tensor, List[Tuple[int, int]], List[int], torch.Tensor]: + bsz = len(x) + pH = pW = self.patch_size + device = x[0].device + dtype = x[0].dtype + + if cap_mask is not None: + l_effective_cap_len = cap_mask.sum(dim=1).tolist() + else: + l_effective_cap_len = [num_tokens] * bsz + + if cap_mask is not None and not torch.is_floating_point(cap_mask): + cap_mask = (cap_mask - 1).to(dtype) * torch.finfo(dtype).max + + img_sizes = [(img.size(1), img.size(2)) for img in x] + l_effective_img_len = [(H // pH) * (W // pW) for (H, W) in img_sizes] + + max_seq_len = max( + (cap_len+img_len for cap_len, img_len in zip(l_effective_cap_len, l_effective_img_len)) + ) + max_cap_len = max(l_effective_cap_len) + max_img_len = max(l_effective_img_len) + + position_ids = torch.zeros(bsz, max_seq_len, 3, dtype=torch.int32, device=device) + + for i in range(bsz): + cap_len = l_effective_cap_len[i] + img_len = l_effective_img_len[i] + H, W = img_sizes[i] + H_tokens, W_tokens = H // pH, W // pW + assert H_tokens * W_tokens == img_len + + position_ids[i, :cap_len, 0] = torch.arange(cap_len, dtype=torch.int32, device=device) + position_ids[i, cap_len:cap_len+img_len, 0] = cap_len + row_ids = torch.arange(H_tokens, dtype=torch.int32, device=device).view(-1, 1).repeat(1, W_tokens).flatten() + col_ids = torch.arange(W_tokens, dtype=torch.int32, device=device).view(1, -1).repeat(H_tokens, 1).flatten() + position_ids[i, cap_len:cap_len+img_len, 1] = row_ids + position_ids[i, cap_len:cap_len+img_len, 2] = col_ids + + freqs_cis = self.rope_embedder(position_ids) + + # build freqs_cis for cap and image individually + cap_freqs_cis_shape = list(freqs_cis.shape) + # cap_freqs_cis_shape[1] = max_cap_len + cap_freqs_cis_shape[1] = cap_feats.shape[1] + cap_freqs_cis = torch.zeros(*cap_freqs_cis_shape, device=device, dtype=freqs_cis.dtype) + + img_freqs_cis_shape = list(freqs_cis.shape) + img_freqs_cis_shape[1] = max_img_len + img_freqs_cis = torch.zeros(*img_freqs_cis_shape, device=device, dtype=freqs_cis.dtype) + + for i in range(bsz): + cap_len = l_effective_cap_len[i] + img_len = l_effective_img_len[i] + cap_freqs_cis[i, :cap_len] = freqs_cis[i, :cap_len] + img_freqs_cis[i, :img_len] = freqs_cis[i, cap_len:cap_len+img_len] + + # refine context + for layer in self.context_refiner: + cap_feats = layer(cap_feats, cap_mask, cap_freqs_cis) + + # refine image + flat_x = [] + for i in range(bsz): + img = x[i] + C, H, W = img.size() + img = img.view(C, H // pH, pH, W // pW, pW).permute(1, 3, 2, 4, 0).flatten(2).flatten(0, 1) + flat_x.append(img) + x = flat_x + padded_img_embed = torch.zeros(bsz, max_img_len, x[0].shape[-1], device=device, dtype=x[0].dtype) + padded_img_mask = torch.zeros(bsz, max_img_len, dtype=torch.bool, device=device) + for i in range(bsz): + padded_img_embed[i, :l_effective_img_len[i]] = x[i] + padded_img_mask[i, :l_effective_img_len[i]] = True + + padded_img_embed = self.x_embedder(padded_img_embed) + for layer in self.noise_refiner: + padded_img_embed = layer(padded_img_embed, padded_img_mask, img_freqs_cis, t) + + if cap_mask is not None: + mask = torch.zeros(bsz, max_seq_len, dtype=dtype, device=device) + mask[:, :max_cap_len] = cap_mask[:, :max_cap_len] + else: + mask = None + + padded_full_embed = torch.zeros(bsz, max_seq_len, self.dim, device=device, dtype=x[0].dtype) + for i in range(bsz): + cap_len = l_effective_cap_len[i] + img_len = l_effective_img_len[i] + + padded_full_embed[i, :cap_len] = cap_feats[i, :cap_len] + padded_full_embed[i, cap_len:cap_len+img_len] = padded_img_embed[i, :img_len] + + return padded_full_embed, mask, img_sizes, l_effective_cap_len, freqs_cis + + + # def forward(self, x, t, cap_feats, cap_mask): + def forward(self, x, timesteps, context, num_tokens, attention_mask=None, **kwargs): + t = 1.0 - timesteps + cap_feats = context + cap_mask = attention_mask + """ + Forward pass of NextDiT. + t: (N,) tensor of diffusion timesteps + y: (N,) tensor of text tokens/features + """ + + t = self.t_embedder(t, dtype=x.dtype) # (N, D) + adaln_input = t + + cap_feats = self.cap_embedder(cap_feats) # (N, L, D) # todo check if able to batchify w.o. redundant compute + + x_is_tensor = isinstance(x, torch.Tensor) + x, mask, img_size, cap_size, freqs_cis = self.patchify_and_embed(x, cap_feats, cap_mask, t, num_tokens) + freqs_cis = freqs_cis.to(x.device) + + for layer in self.layers: + x = layer(x, mask, freqs_cis, adaln_input) + + x = self.final_layer(x, adaln_input) + x = self.unpatchify(x, img_size, cap_size, return_tensor=x_is_tensor) + + return -x + + @staticmethod + def precompute_freqs_cis( + dim: List[int], + end: List[int], + theta: float = 10000.0, + ): + """ + Precompute the frequency tensor for complex exponentials (cis) with + given dimensions. + + This function calculates a frequency tensor with complex exponentials + using the given dimension 'dim' and the end index 'end'. The 'theta' + parameter scales the frequencies. The returned tensor contains complex + values in complex64 data type. + + Args: + dim (list): Dimension of the frequency tensor. + end (list): End index for precomputing frequencies. + theta (float, optional): Scaling factor for frequency computation. + Defaults to 10000.0. + + Returns: + torch.Tensor: Precomputed frequency tensor with complex + exponentials. + """ + freqs_cis = [] + for i, (d, e) in enumerate(zip(dim, end)): + freqs = 1.0 / (theta ** (torch.arange(0, d, 2, dtype=torch.float64, device="cpu") / d)) + timestep = torch.arange(e, device=freqs.device, dtype=torch.float64) + freqs = torch.outer(timestep, freqs).float() + freqs_cis_i = torch.polar(torch.ones_like(freqs), freqs).to(torch.complex64) # complex64 + freqs_cis.append(freqs_cis_i) + + return freqs_cis diff --git a/comfy/ldm/modules/diffusionmodules/mmdit.py b/comfy/ldm/modules/diffusionmodules/mmdit.py index e70f4431f..eaf3e73a4 100644 --- a/comfy/ldm/modules/diffusionmodules/mmdit.py +++ b/comfy/ldm/modules/diffusionmodules/mmdit.py @@ -321,7 +321,7 @@ class SelfAttention(nn.Module): class RMSNorm(torch.nn.Module): def __init__( - self, dim: int, elementwise_affine: bool = False, eps: float = 1e-6, device=None, dtype=None + self, dim: int, elementwise_affine: bool = False, eps: float = 1e-6, device=None, dtype=None, **kwargs ): """ Initialize the RMSNorm normalization layer. diff --git a/comfy/model_base.py b/comfy/model_base.py index cd05bbdfe..4d1b83a4a 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -34,6 +34,7 @@ import comfy.ldm.flux.model import comfy.ldm.lightricks.model import comfy.ldm.hunyuan_video.model import comfy.ldm.cosmos.model +import comfy.ldm.lumina.model import comfy.model_management import comfy.patcher_extension @@ -904,3 +905,19 @@ class CosmosVideo(BaseModel): latent_image = latent_image + noise latent_image = self.model_sampling.calculate_input(torch.tensor([sigma_noise_augmentation], device=latent_image.device, dtype=latent_image.dtype), latent_image) return latent_image * ((sigma ** 2 + self.model_sampling.sigma_data ** 2) ** 0.5) + +class Lumina2(BaseModel): + def __init__(self, model_config, model_type=ModelType.FLOW, device=None): + super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.lumina.model.NextDiT) + + def extra_conds(self, **kwargs): + out = super().extra_conds(**kwargs) + attention_mask = kwargs.get("attention_mask", None) + if attention_mask is not None: + if torch.numel(attention_mask) != attention_mask.sum(): + out['attention_mask'] = comfy.conds.CONDRegular(attention_mask) + out['num_tokens'] = comfy.conds.CONDConstant(max(1, torch.sum(attention_mask).item())) + cross_attn = kwargs.get("cross_attn", None) + if cross_attn is not None: + out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) + return out diff --git a/comfy/model_detection.py b/comfy/model_detection.py index ba96ebe85..2644dd0dc 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -239,7 +239,7 @@ def detect_unet_config(state_dict, key_prefix): dit_config["micro_condition"] = False return dit_config - if '{}blocks.block0.blocks.0.block.attn.to_q.0.weight'.format(key_prefix) in state_dict_keys: + if '{}blocks.block0.blocks.0.block.attn.to_q.0.weight'.format(key_prefix) in state_dict_keys: # Cosmos dit_config = {} dit_config["image_model"] = "cosmos" dit_config["max_img_h"] = 240 @@ -284,6 +284,21 @@ def detect_unet_config(state_dict, key_prefix): dit_config["extra_per_block_abs_pos_emb_type"] = "learnable" return dit_config + if '{}cap_embedder.1.weight'.format(key_prefix) in state_dict_keys: # Lumina 2 + dit_config = {} + dit_config["image_model"] = "lumina2" + dit_config["patch_size"] = 2 + dit_config["in_channels"] = 16 + dit_config["dim"] = 2304 + dit_config["cap_feat_dim"] = 2304 + dit_config["n_layers"] = 26 + dit_config["n_heads"] = 24 + dit_config["n_kv_heads"] = 8 + dit_config["qk_norm"] = True + dit_config["axes_dims"] = [32, 32, 32] + dit_config["axes_lens"] = [300, 512, 512] + return dit_config + if '{}input_blocks.0.0.weight'.format(key_prefix) not in state_dict_keys: return None diff --git a/comfy/sd.py b/comfy/sd.py index d7e89f726..eabf0bda0 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -36,6 +36,7 @@ import comfy.text_encoders.genmo import comfy.text_encoders.lt import comfy.text_encoders.hunyuan_video import comfy.text_encoders.cosmos +import comfy.text_encoders.lumina2 import comfy.model_patcher import comfy.lora @@ -657,6 +658,7 @@ class CLIPType(Enum): HUNYUAN_VIDEO = 9 PIXART = 10 COSMOS = 11 + LUMINA2 = 12 def load_clip(ckpt_paths, embedding_directory=None, clip_type=CLIPType.STABLE_DIFFUSION, model_options={}): @@ -675,6 +677,7 @@ class TEModel(Enum): T5_BASE = 6 LLAMA3_8 = 7 T5_XXL_OLD = 8 + GEMMA_2_2B = 9 def detect_te_model(sd): if "text_model.encoder.layers.30.mlp.fc1.weight" in sd: @@ -693,6 +696,8 @@ def detect_te_model(sd): return TEModel.T5_XXL_OLD if "encoder.block.0.layer.0.SelfAttention.k.weight" in sd: return TEModel.T5_BASE + if 'model.layers.0.post_feedforward_layernorm.weight' in sd: + return TEModel.GEMMA_2_2B if "model.layers.0.post_attention_layernorm.weight" in sd: return TEModel.LLAMA3_8 return None @@ -730,6 +735,7 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip if "text_projection" in clip_data[i]: clip_data[i]["text_projection.weight"] = clip_data[i]["text_projection"].transpose(0, 1) #old models saved with the CLIPSave node + tokenizer_data = {} clip_target = EmptyClass() clip_target.params = {} if len(clip_data) == 1: @@ -769,6 +775,10 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip elif te_model == TEModel.T5_BASE: clip_target.clip = comfy.text_encoders.sa_t5.SAT5Model clip_target.tokenizer = comfy.text_encoders.sa_t5.SAT5Tokenizer + elif te_model == TEModel.GEMMA_2_2B: + clip_target.clip = comfy.text_encoders.lumina2.te(**llama_detect(clip_data)) + clip_target.tokenizer = comfy.text_encoders.lumina2.LuminaTokenizer + tokenizer_data["spiece_model"] = clip_data[0].get("spiece_model", None) else: if clip_type == CLIPType.SD3: clip_target.clip = comfy.text_encoders.sd3_clip.sd3_clip(clip_l=True, clip_g=False, t5=False) @@ -798,7 +808,6 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip clip_target.tokenizer = comfy.text_encoders.sd3_clip.SD3Tokenizer parameters = 0 - tokenizer_data = {} for c in clip_data: parameters += comfy.utils.calculate_parameters(c) tokenizer_data, model_options = comfy.text_encoders.long_clipl.model_options_long_clip(c, tokenizer_data, model_options) diff --git a/comfy/sd1_clip.py b/comfy/sd1_clip.py index 85518afd9..d2457731d 100644 --- a/comfy/sd1_clip.py +++ b/comfy/sd1_clip.py @@ -421,10 +421,10 @@ def load_embed(embedding_name, embedding_directory, embedding_size, embed_key=No return embed_out class SDTokenizer: - def __init__(self, tokenizer_path=None, max_length=77, pad_with_end=True, embedding_directory=None, embedding_size=768, embedding_key='clip_l', tokenizer_class=CLIPTokenizer, has_start_token=True, has_end_token=True, pad_to_max_length=True, min_length=None, pad_token=None, end_token=None, tokenizer_data={}): + def __init__(self, tokenizer_path=None, max_length=77, pad_with_end=True, embedding_directory=None, embedding_size=768, embedding_key='clip_l', tokenizer_class=CLIPTokenizer, has_start_token=True, has_end_token=True, pad_to_max_length=True, min_length=None, pad_token=None, end_token=None, tokenizer_data={}, tokenizer_args={}): if tokenizer_path is None: tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "sd1_tokenizer") - self.tokenizer = tokenizer_class.from_pretrained(tokenizer_path) + self.tokenizer = tokenizer_class.from_pretrained(tokenizer_path, **tokenizer_args) self.max_length = max_length self.min_length = min_length self.end_token = None @@ -585,9 +585,14 @@ class SDTokenizer: return {} class SD1Tokenizer: - def __init__(self, embedding_directory=None, tokenizer_data={}, clip_name="l", tokenizer=SDTokenizer): - self.clip_name = clip_name - self.clip = "clip_{}".format(self.clip_name) + def __init__(self, embedding_directory=None, tokenizer_data={}, clip_name="l", tokenizer=SDTokenizer, name=None): + if name is not None: + self.clip_name = name + self.clip = "{}".format(self.clip_name) + else: + self.clip_name = clip_name + self.clip = "clip_{}".format(self.clip_name) + tokenizer = tokenizer_data.get("{}_tokenizer_class".format(self.clip), tokenizer) setattr(self, self.clip, tokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data)) @@ -600,7 +605,7 @@ class SD1Tokenizer: return getattr(self, self.clip).untokenize(token_weight_pair) def state_dict(self): - return {} + return getattr(self, self.clip).state_dict() class SD1CheckpointClipModel(SDClipModel): def __init__(self, device="cpu", dtype=None, model_options={}): diff --git a/comfy/supported_models.py b/comfy/supported_models.py index ff0bea418..7aa152480 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -15,6 +15,7 @@ import comfy.text_encoders.genmo import comfy.text_encoders.lt import comfy.text_encoders.hunyuan_video import comfy.text_encoders.cosmos +import comfy.text_encoders.lumina2 from . import supported_models_base from . import latent_formats @@ -865,6 +866,35 @@ class CosmosI2V(CosmosT2V): out = model_base.CosmosVideo(self, image_to_video=True, device=device) return out -models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideo, CosmosT2V, CosmosI2V] +class Lumina2(supported_models_base.BASE): + unet_config = { + "image_model": "lumina2", + } + + sampling_settings = { + "multiplier": 1.0, + "shift": 6.0, + } + + memory_usage_factor = 1.2 + + unet_extra_config = {} + latent_format = latent_formats.Flux + + supported_inference_dtypes = [torch.bfloat16, torch.float32] + + vae_key_prefix = ["vae."] + text_encoder_key_prefix = ["text_encoders."] + + def get_model(self, state_dict, prefix="", device=None): + out = model_base.Lumina2(self, device=device) + return out + + def clip_target(self, state_dict={}): + pref = self.text_encoder_key_prefix[0] + hunyuan_detect = comfy.text_encoders.hunyuan_video.llama_detect(state_dict, "{}gemma2_2b.transformer.".format(pref)) + return supported_models_base.ClipTarget(comfy.text_encoders.lumina2.LuminaTokenizer, comfy.text_encoders.lumina2.te(**hunyuan_detect)) + +models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2] models += [SVD_img2vid] diff --git a/comfy/text_encoders/llama.py b/comfy/text_encoders/llama.py index ad4b4623e..3f234015a 100644 --- a/comfy/text_encoders/llama.py +++ b/comfy/text_encoders/llama.py @@ -1,6 +1,5 @@ import torch import torch.nn as nn -import torch.nn.functional as F from dataclasses import dataclass from typing import Optional, Any @@ -21,15 +20,41 @@ class Llama2Config: max_position_embeddings: int = 8192 rms_norm_eps: float = 1e-5 rope_theta: float = 500000.0 + transformer_type: str = "llama" + head_dim = 128 + rms_norm_add = False + mlp_activation = "silu" + +@dataclass +class Gemma2_2B_Config: + vocab_size: int = 256000 + hidden_size: int = 2304 + intermediate_size: int = 9216 + num_hidden_layers: int = 26 + num_attention_heads: int = 8 + num_key_value_heads: int = 4 + max_position_embeddings: int = 8192 + rms_norm_eps: float = 1e-6 + rope_theta: float = 10000.0 + transformer_type: str = "gemma2" + head_dim = 256 + rms_norm_add = True + mlp_activation = "gelu_pytorch_tanh" class RMSNorm(nn.Module): - def __init__(self, dim: int, eps: float = 1e-5, device=None, dtype=None): + def __init__(self, dim: int, eps: float = 1e-5, add=False, device=None, dtype=None): super().__init__() self.eps = eps self.weight = nn.Parameter(torch.empty(dim, device=device, dtype=dtype)) + self.add = add def forward(self, x: torch.Tensor): - return comfy.ldm.common_dit.rms_norm(x, self.weight, self.eps) + w = self.weight + if self.add: + w = w + 1.0 + + return comfy.ldm.common_dit.rms_norm(x, w, self.eps) + def rotate_half(x): @@ -68,13 +93,15 @@ class Attention(nn.Module): self.num_heads = config.num_attention_heads self.num_kv_heads = config.num_key_value_heads self.hidden_size = config.hidden_size - self.head_dim = self.hidden_size // self.num_heads + + self.head_dim = config.head_dim + self.inner_size = self.num_heads * self.head_dim ops = ops or nn - self.q_proj = ops.Linear(config.hidden_size, config.hidden_size, bias=False, device=device, dtype=dtype) + self.q_proj = ops.Linear(config.hidden_size, self.inner_size, bias=False, device=device, dtype=dtype) self.k_proj = ops.Linear(config.hidden_size, self.num_kv_heads * self.head_dim, bias=False, device=device, dtype=dtype) self.v_proj = ops.Linear(config.hidden_size, self.num_kv_heads * self.head_dim, bias=False, device=device, dtype=dtype) - self.o_proj = ops.Linear(config.hidden_size, config.hidden_size, bias=False, device=device, dtype=dtype) + self.o_proj = ops.Linear(self.inner_size, config.hidden_size, bias=False, device=device, dtype=dtype) def forward( self, @@ -84,7 +111,6 @@ class Attention(nn.Module): optimized_attention=None, ): batch_size, seq_length, _ = hidden_states.shape - xq = self.q_proj(hidden_states) xk = self.k_proj(hidden_states) xv = self.v_proj(hidden_states) @@ -108,9 +134,13 @@ class MLP(nn.Module): self.gate_proj = ops.Linear(config.hidden_size, config.intermediate_size, bias=False, device=device, dtype=dtype) self.up_proj = ops.Linear(config.hidden_size, config.intermediate_size, bias=False, device=device, dtype=dtype) self.down_proj = ops.Linear(config.intermediate_size, config.hidden_size, bias=False, device=device, dtype=dtype) + if config.mlp_activation == "silu": + self.activation = torch.nn.functional.silu + elif config.mlp_activation == "gelu_pytorch_tanh": + self.activation = lambda a: torch.nn.functional.gelu(a, approximate="tanh") def forward(self, x): - return self.down_proj(F.silu(self.gate_proj(x)) * self.up_proj(x)) + return self.down_proj(self.activation(self.gate_proj(x)) * self.up_proj(x)) class TransformerBlock(nn.Module): def __init__(self, config: Llama2Config, device=None, dtype=None, ops: Any = None): @@ -146,6 +176,45 @@ class TransformerBlock(nn.Module): return x +class TransformerBlockGemma2(nn.Module): + def __init__(self, config: Llama2Config, device=None, dtype=None, ops: Any = None): + super().__init__() + self.self_attn = Attention(config, device=device, dtype=dtype, ops=ops) + self.mlp = MLP(config, device=device, dtype=dtype, ops=ops) + self.input_layernorm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps, add=config.rms_norm_add, device=device, dtype=dtype) + self.post_attention_layernorm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps, add=config.rms_norm_add, device=device, dtype=dtype) + self.pre_feedforward_layernorm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps, add=config.rms_norm_add, device=device, dtype=dtype) + self.post_feedforward_layernorm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps, add=config.rms_norm_add, device=device, dtype=dtype) + + def forward( + self, + x: torch.Tensor, + attention_mask: Optional[torch.Tensor] = None, + freqs_cis: Optional[torch.Tensor] = None, + optimized_attention=None, + ): + # Self Attention + residual = x + x = self.input_layernorm(x) + x = self.self_attn( + hidden_states=x, + attention_mask=attention_mask, + freqs_cis=freqs_cis, + optimized_attention=optimized_attention, + ) + + x = self.post_attention_layernorm(x) + x = residual + x + + # MLP + residual = x + x = self.pre_feedforward_layernorm(x) + x = self.mlp(x) + x = self.post_feedforward_layernorm(x) + x = residual + x + + return x + class Llama2_(nn.Module): def __init__(self, config, device=None, dtype=None, ops=None): super().__init__() @@ -158,17 +227,27 @@ class Llama2_(nn.Module): device=device, dtype=dtype ) + if self.config.transformer_type == "gemma2": + transformer = TransformerBlockGemma2 + self.normalize_in = True + else: + transformer = TransformerBlock + self.normalize_in = False + self.layers = nn.ModuleList([ - TransformerBlock(config, device=device, dtype=dtype, ops=ops) + transformer(config, device=device, dtype=dtype, ops=ops) for _ in range(config.num_hidden_layers) ]) - self.norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps, device=device, dtype=dtype) + self.norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps, add=config.rms_norm_add, device=device, dtype=dtype) # self.lm_head = ops.Linear(config.hidden_size, config.vocab_size, bias=False, device=device, dtype=dtype) def forward(self, x, attention_mask=None, intermediate_output=None, final_layer_norm_intermediate=True, dtype=None): x = self.embed_tokens(x, out_dtype=dtype) - freqs_cis = precompute_freqs_cis(self.config.hidden_size // self.config.num_attention_heads, + if self.normalize_in: + x *= self.config.hidden_size ** 0.5 + + freqs_cis = precompute_freqs_cis(self.config.head_dim, x.shape[1], self.config.rope_theta, device=x.device) @@ -206,16 +285,7 @@ class Llama2_(nn.Module): return x, intermediate - -class Llama2(torch.nn.Module): - def __init__(self, config_dict, dtype, device, operations): - super().__init__() - config = Llama2Config(**config_dict) - self.num_layers = config.num_hidden_layers - - self.model = Llama2_(config, device=device, dtype=dtype, ops=operations) - self.dtype = dtype - +class BaseLlama: def get_input_embeddings(self): return self.model.embed_tokens @@ -224,3 +294,23 @@ class Llama2(torch.nn.Module): def forward(self, input_ids, *args, **kwargs): return self.model(input_ids, *args, **kwargs) + + +class Llama2(BaseLlama, torch.nn.Module): + def __init__(self, config_dict, dtype, device, operations): + super().__init__() + config = Llama2Config(**config_dict) + self.num_layers = config.num_hidden_layers + + self.model = Llama2_(config, device=device, dtype=dtype, ops=operations) + self.dtype = dtype + + +class Gemma2_2B(BaseLlama, torch.nn.Module): + def __init__(self, config_dict, dtype, device, operations): + super().__init__() + config = Gemma2_2B_Config(**config_dict) + self.num_layers = config.num_hidden_layers + + self.model = Llama2_(config, device=device, dtype=dtype, ops=operations) + self.dtype = dtype diff --git a/comfy/text_encoders/lumina2.py b/comfy/text_encoders/lumina2.py new file mode 100644 index 000000000..166d13281 --- /dev/null +++ b/comfy/text_encoders/lumina2.py @@ -0,0 +1,44 @@ +from comfy import sd1_clip +from .spiece_tokenizer import SPieceTokenizer +import comfy.text_encoders.llama + + +class Gemma2BTokenizer(sd1_clip.SDTokenizer): + def __init__(self, embedding_directory=None, tokenizer_data={}): + tokenizer = tokenizer_data.get("spiece_model", None) + super().__init__(tokenizer, pad_with_end=False, embedding_size=2304, embedding_key='gemma2_2b', tokenizer_class=SPieceTokenizer, has_end_token=False, pad_to_max_length=False, max_length=99999999, min_length=1, tokenizer_args={"add_bos": True, "add_eos": False}) + + def state_dict(self): + return {"spiece_model": self.tokenizer.serialize_model()} + + +class LuminaTokenizer(sd1_clip.SD1Tokenizer): + def __init__(self, embedding_directory=None, tokenizer_data={}): + super().__init__(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data, name="gemma2_2b", tokenizer=Gemma2BTokenizer) + + +class Gemma2_2BModel(sd1_clip.SDClipModel): + def __init__(self, device="cpu", layer="hidden", layer_idx=-2, dtype=None, attention_mask=True, model_options={}): + llama_scaled_fp8 = model_options.get("llama_scaled_fp8", None) + if llama_scaled_fp8 is not None: + model_options = model_options.copy() + model_options["scaled_fp8"] = llama_scaled_fp8 + + super().__init__(device=device, layer=layer, layer_idx=layer_idx, textmodel_json_config={}, dtype=dtype, special_tokens={"start": 2, "pad": 0}, layer_norm_hidden_state=False, model_class=comfy.text_encoders.llama.Gemma2_2B, enable_attention_masks=attention_mask, return_attention_masks=attention_mask, model_options=model_options) + + +class LuminaModel(sd1_clip.SD1ClipModel): + def __init__(self, device="cpu", dtype=None, model_options={}): + super().__init__(device=device, dtype=dtype, name="gemma2_2b", clip_model=Gemma2_2BModel, model_options=model_options) + + +def te(dtype_llama=None, llama_scaled_fp8=None): + class LuminaTEModel_(LuminaModel): + def __init__(self, device="cpu", dtype=None, model_options={}): + if llama_scaled_fp8 is not None and "llama_scaled_fp8" not in model_options: + model_options = model_options.copy() + model_options["llama_scaled_fp8"] = llama_scaled_fp8 + if dtype_llama is not None: + dtype = dtype_llama + super().__init__(device=device, dtype=dtype, model_options=model_options) + return LuminaTEModel_ diff --git a/comfy/text_encoders/spiece_tokenizer.py b/comfy/text_encoders/spiece_tokenizer.py index cbaa99ba5..21df4f863 100644 --- a/comfy/text_encoders/spiece_tokenizer.py +++ b/comfy/text_encoders/spiece_tokenizer.py @@ -1,21 +1,21 @@ import torch class SPieceTokenizer: - add_eos = True - @staticmethod - def from_pretrained(path): - return SPieceTokenizer(path) + def from_pretrained(path, **kwargs): + return SPieceTokenizer(path, **kwargs) - def __init__(self, tokenizer_path): + def __init__(self, tokenizer_path, add_bos=False, add_eos=True): + self.add_bos = add_bos + self.add_eos = add_eos import sentencepiece if torch.is_tensor(tokenizer_path): tokenizer_path = tokenizer_path.numpy().tobytes() if isinstance(tokenizer_path, bytes): - self.tokenizer = sentencepiece.SentencePieceProcessor(model_proto=tokenizer_path, add_eos=self.add_eos) + self.tokenizer = sentencepiece.SentencePieceProcessor(model_proto=tokenizer_path, add_bos=self.add_bos, add_eos=self.add_eos) else: - self.tokenizer = sentencepiece.SentencePieceProcessor(model_file=tokenizer_path, add_eos=self.add_eos) + self.tokenizer = sentencepiece.SentencePieceProcessor(model_file=tokenizer_path, add_bos=self.add_bos, add_eos=self.add_eos) def get_vocab(self): out = {} diff --git a/nodes.py b/nodes.py index 968f0f9ad..ba9c4e4bb 100644 --- a/nodes.py +++ b/nodes.py @@ -914,7 +914,7 @@ class CLIPLoader: @classmethod def INPUT_TYPES(s): return {"required": { "clip_name": (folder_paths.get_filename_list("text_encoders"), ), - "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart", "cosmos"], ), + "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart", "cosmos", "lumina2"], ), }, "optional": { "device": (["default", "cpu"], {"advanced": True}), @@ -941,6 +941,8 @@ class CLIPLoader: clip_type = comfy.sd.CLIPType.PIXART elif type == "cosmos": clip_type = comfy.sd.CLIPType.COSMOS + elif type == "lumina2": + clip_type = comfy.sd.CLIPType.LUMINA2 else: clip_type = comfy.sd.CLIPType.STABLE_DIFFUSION From 3e880ac709d3a062a5d8027b861743c65e95ec5c Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 4 Feb 2025 04:20:56 -0500 Subject: [PATCH 071/478] Fix on python 3.9 --- comfy/ldm/lumina/model.py | 1 + 1 file changed, 1 insertion(+) diff --git a/comfy/ldm/lumina/model.py b/comfy/ldm/lumina/model.py index 24c6d80f2..4eb7164d1 100644 --- a/comfy/ldm/lumina/model.py +++ b/comfy/ldm/lumina/model.py @@ -1,4 +1,5 @@ # Code from: https://github.com/Alpha-VLLM/Lumina-Image-2.0/blob/main/models/model.py +from __future__ import annotations from typing import List, Optional, Tuple From 8ac2dddeed27b0ed2af4c271dcdf78d89d58b005 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 4 Feb 2025 06:50:37 -0500 Subject: [PATCH 072/478] Lower the default shift of lumina to reduce artifacts. --- comfy/supported_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 7aa152480..cdd2ba574 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -873,7 +873,7 @@ class Lumina2(supported_models_base.BASE): sampling_settings = { "multiplier": 1.0, - "shift": 6.0, + "shift": 3.0, } memory_usage_factor = 1.2 From 016b219dcca2431bb46dccc04bc85c764b76409a Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 4 Feb 2025 08:08:36 -0500 Subject: [PATCH 073/478] Add Lumina Image 2.0 to Readme. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 84ac02eb3..44f46a41a 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ This ui will let you design and execute advanced stable diffusion pipelines usin - [AuraFlow](https://comfyanonymous.github.io/ComfyUI_examples/aura_flow/) - [HunyuanDiT](https://comfyanonymous.github.io/ComfyUI_examples/hunyuan_dit/) - [Flux](https://comfyanonymous.github.io/ComfyUI_examples/flux/) + - [Lumina Image 2.0](https://comfyanonymous.github.io/ComfyUI_examples/lumina2/) - Video Models - [Stable Video Diffusion](https://comfyanonymous.github.io/ComfyUI_examples/video/) - [Mochi](https://comfyanonymous.github.io/ComfyUI_examples/mochi/) From a57d635c5f36c28c59ea6513878acde80e4df180 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 4 Feb 2025 21:48:11 -0500 Subject: [PATCH 074/478] Fix lumina 2 batches. --- comfy/ldm/lumina/model.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/comfy/ldm/lumina/model.py b/comfy/ldm/lumina/model.py index 4eb7164d1..e4b0d34a6 100644 --- a/comfy/ldm/lumina/model.py +++ b/comfy/ldm/lumina/model.py @@ -581,12 +581,13 @@ class NextDiT(nn.Module): flat_x.append(img) x = flat_x padded_img_embed = torch.zeros(bsz, max_img_len, x[0].shape[-1], device=device, dtype=x[0].dtype) - padded_img_mask = torch.zeros(bsz, max_img_len, dtype=torch.bool, device=device) + padded_img_mask = torch.zeros(bsz, max_img_len, dtype=dtype, device=device) for i in range(bsz): padded_img_embed[i, :l_effective_img_len[i]] = x[i] - padded_img_mask[i, :l_effective_img_len[i]] = True + padded_img_mask[i, l_effective_img_len[i]:] = -torch.finfo(dtype).max padded_img_embed = self.x_embedder(padded_img_embed) + padded_img_mask = padded_img_mask.unsqueeze(1) for layer in self.noise_refiner: padded_img_embed = layer(padded_img_embed, padded_img_mask, img_freqs_cis, t) From 60653004e534d1ef242406e5d208852ae8227a54 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Feb 2025 04:16:59 -0500 Subject: [PATCH 075/478] Use regular numbers for rope in lumina model. --- comfy/ldm/lumina/model.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/comfy/ldm/lumina/model.py b/comfy/ldm/lumina/model.py index e4b0d34a6..442a814c3 100644 --- a/comfy/ldm/lumina/model.py +++ b/comfy/ldm/lumina/model.py @@ -9,6 +9,7 @@ import torch.nn.functional as F from comfy.ldm.modules.diffusionmodules.mmdit import TimestepEmbedder, RMSNorm from comfy.ldm.modules.attention import optimized_attention_masked +from comfy.ldm.flux.layers import EmbedND def modulate(x, scale): @@ -92,10 +93,9 @@ class JointAttention(nn.Module): and key tensor with rotary embeddings. """ - x = torch.view_as_complex(x_in.float().reshape(*x_in.shape[:-1], -1, 2)) - freqs_cis = freqs_cis.unsqueeze(2) - x_out = torch.view_as_real(x * freqs_cis).flatten(3) - return x_out.type_as(x_in) + t_ = x_in.reshape(*x_in.shape[:-1], -1, 1, 2).float() + t_out = freqs_cis[..., 0] * t_[..., 0] + freqs_cis[..., 1] * t_[..., 1] + return t_out.reshape(*x_in.shape).type_as(x_in) def forward( self, @@ -130,6 +130,7 @@ class JointAttention(nn.Module): xq = self.q_norm(xq) xk = self.k_norm(xk) + xq = JointAttention.apply_rotary_emb(xq, freqs_cis=freqs_cis) xk = JointAttention.apply_rotary_emb(xk, freqs_cis=freqs_cis) @@ -480,7 +481,8 @@ class NextDiT(nn.Module): assert (dim // n_heads) == sum(axes_dims) self.axes_dims = axes_dims self.axes_lens = axes_lens - self.rope_embedder = RopeEmbedder(axes_dims=axes_dims, axes_lens=axes_lens) + # self.rope_embedder = RopeEmbedder(axes_dims=axes_dims, axes_lens=axes_lens) + self.rope_embedder = EmbedND(dim=dim // n_heads, theta=10000.0, axes_dim=axes_dims) self.dim = dim self.n_heads = n_heads @@ -550,7 +552,7 @@ class NextDiT(nn.Module): position_ids[i, cap_len:cap_len+img_len, 1] = row_ids position_ids[i, cap_len:cap_len+img_len, 2] = col_ids - freqs_cis = self.rope_embedder(position_ids) + freqs_cis = self.rope_embedder(position_ids).movedim(1, 2) # build freqs_cis for cap and image individually cap_freqs_cis_shape = list(freqs_cis.shape) From 94f21f93012173d8f1027bc5f59361cf200b8b37 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Feb 2025 04:32:47 -0500 Subject: [PATCH 076/478] Upcasting rope to fp32 seems to make no difference in this model. --- comfy/ldm/lumina/model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/comfy/ldm/lumina/model.py b/comfy/ldm/lumina/model.py index 442a814c3..ec4119722 100644 --- a/comfy/ldm/lumina/model.py +++ b/comfy/ldm/lumina/model.py @@ -93,9 +93,9 @@ class JointAttention(nn.Module): and key tensor with rotary embeddings. """ - t_ = x_in.reshape(*x_in.shape[:-1], -1, 1, 2).float() + t_ = x_in.reshape(*x_in.shape[:-1], -1, 1, 2) t_out = freqs_cis[..., 0] * t_[..., 0] + freqs_cis[..., 1] * t_[..., 1] - return t_out.reshape(*x_in.shape).type_as(x_in) + return t_out.reshape(*x_in.shape) def forward( self, @@ -552,7 +552,7 @@ class NextDiT(nn.Module): position_ids[i, cap_len:cap_len+img_len, 1] = row_ids position_ids[i, cap_len:cap_len+img_len, 2] = col_ids - freqs_cis = self.rope_embedder(position_ids).movedim(1, 2) + freqs_cis = self.rope_embedder(position_ids).movedim(1, 2).to(dtype) # build freqs_cis for cap and image individually cap_freqs_cis_shape = list(freqs_cis.shape) From 37cd44852976976c8a7b59ae87119ab5c1c118dd Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Feb 2025 14:49:52 -0500 Subject: [PATCH 077/478] Set the shift for Lumina back to 6. --- comfy/supported_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index cdd2ba574..7aa152480 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -873,7 +873,7 @@ class Lumina2(supported_models_base.BASE): sampling_settings = { "multiplier": 1.0, - "shift": 3.0, + "shift": 6.0, } memory_usage_factor = 1.2 From debabccb847b24e6be7cf69deb9c66026364cb04 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Feb 2025 15:47:46 -0500 Subject: [PATCH 078/478] Bump ComfyUI version to v0.3.14 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index ca3c0f581..6be6f59f0 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.13" +__version__ = "0.3.14" diff --git a/pyproject.toml b/pyproject.toml index da2c43c00..a450b9b0c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.13" +version = "0.3.14" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From f1059b0b82619cb43f1359f4bb4aee4495c17309 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 5 Feb 2025 18:48:36 -0500 Subject: [PATCH 079/478] Remove unused GET /files API endpoint (#6714) --- api_server/routes/internal/internal_routes.py | 19 +-- api_server/services/file_service.py | 13 -- .../server/routes/internal_routes_test.py | 115 ------------------ .../server/services/file_service_test.py | 54 -------- 4 files changed, 1 insertion(+), 200 deletions(-) delete mode 100644 api_server/services/file_service.py delete mode 100644 tests-unit/server/routes/internal_routes_test.py delete mode 100644 tests-unit/server/services/file_service_test.py diff --git a/api_server/routes/internal/internal_routes.py b/api_server/routes/internal/internal_routes.py index 8f74529ba..a66fe529b 100644 --- a/api_server/routes/internal/internal_routes.py +++ b/api_server/routes/internal/internal_routes.py @@ -1,7 +1,6 @@ from aiohttp import web from typing import Optional -from folder_paths import models_dir, user_directory, output_directory, folder_names_and_paths -from api_server.services.file_service import FileService +from folder_paths import folder_names_and_paths from api_server.services.terminal_service import TerminalService import app.logger @@ -15,26 +14,10 @@ class InternalRoutes: def __init__(self, prompt_server): self.routes: web.RouteTableDef = web.RouteTableDef() self._app: Optional[web.Application] = None - self.file_service = FileService({ - "models": models_dir, - "user": user_directory, - "output": output_directory - }) self.prompt_server = prompt_server self.terminal_service = TerminalService(prompt_server) def setup_routes(self): - @self.routes.get('/files') - async def list_files(request): - directory_key = request.query.get('directory', '') - try: - file_list = self.file_service.list_files(directory_key) - return web.json_response({"files": file_list}) - except ValueError as e: - return web.json_response({"error": str(e)}, status=400) - except Exception as e: - return web.json_response({"error": str(e)}, status=500) - @self.routes.get('/logs') async def get_logs(request): return web.json_response("".join([(l["t"] + " - " + l["m"]) for l in app.logger.get_logs()])) diff --git a/api_server/services/file_service.py b/api_server/services/file_service.py deleted file mode 100644 index 115edccd3..000000000 --- a/api_server/services/file_service.py +++ /dev/null @@ -1,13 +0,0 @@ -from typing import Dict, List, Optional -from api_server.utils.file_operations import FileSystemOperations, FileSystemItem - -class FileService: - def __init__(self, allowed_directories: Dict[str, str], file_system_ops: Optional[FileSystemOperations] = None): - self.allowed_directories: Dict[str, str] = allowed_directories - self.file_system_ops: FileSystemOperations = file_system_ops or FileSystemOperations() - - def list_files(self, directory_key: str) -> List[FileSystemItem]: - if directory_key not in self.allowed_directories: - raise ValueError("Invalid directory key") - directory_path: str = self.allowed_directories[directory_key] - return self.file_system_ops.walk_directory(directory_path) diff --git a/tests-unit/server/routes/internal_routes_test.py b/tests-unit/server/routes/internal_routes_test.py deleted file mode 100644 index 68c846652..000000000 --- a/tests-unit/server/routes/internal_routes_test.py +++ /dev/null @@ -1,115 +0,0 @@ -import pytest -from aiohttp import web -from unittest.mock import MagicMock, patch -from api_server.routes.internal.internal_routes import InternalRoutes -from api_server.services.file_service import FileService -from folder_paths import models_dir, user_directory, output_directory - - -@pytest.fixture -def internal_routes(): - return InternalRoutes(None) - -@pytest.fixture -def aiohttp_client_factory(aiohttp_client, internal_routes): - async def _get_client(): - app = internal_routes.get_app() - return await aiohttp_client(app) - return _get_client - -@pytest.mark.asyncio -async def test_list_files_valid_directory(aiohttp_client_factory, internal_routes): - mock_file_list = [ - {"name": "file1.txt", "path": "file1.txt", "type": "file", "size": 100}, - {"name": "dir1", "path": "dir1", "type": "directory"} - ] - internal_routes.file_service.list_files = MagicMock(return_value=mock_file_list) - client = await aiohttp_client_factory() - resp = await client.get('/files?directory=models') - assert resp.status == 200 - data = await resp.json() - assert 'files' in data - assert len(data['files']) == 2 - assert data['files'] == mock_file_list - - # Check other valid directories - resp = await client.get('/files?directory=user') - assert resp.status == 200 - resp = await client.get('/files?directory=output') - assert resp.status == 200 - -@pytest.mark.asyncio -async def test_list_files_invalid_directory(aiohttp_client_factory, internal_routes): - internal_routes.file_service.list_files = MagicMock(side_effect=ValueError("Invalid directory key")) - client = await aiohttp_client_factory() - resp = await client.get('/files?directory=invalid') - assert resp.status == 400 - data = await resp.json() - assert 'error' in data - assert data['error'] == "Invalid directory key" - -@pytest.mark.asyncio -async def test_list_files_exception(aiohttp_client_factory, internal_routes): - internal_routes.file_service.list_files = MagicMock(side_effect=Exception("Unexpected error")) - client = await aiohttp_client_factory() - resp = await client.get('/files?directory=models') - assert resp.status == 500 - data = await resp.json() - assert 'error' in data - assert data['error'] == "Unexpected error" - -@pytest.mark.asyncio -async def test_list_files_no_directory_param(aiohttp_client_factory, internal_routes): - mock_file_list = [] - internal_routes.file_service.list_files = MagicMock(return_value=mock_file_list) - client = await aiohttp_client_factory() - resp = await client.get('/files') - assert resp.status == 200 - data = await resp.json() - assert 'files' in data - assert len(data['files']) == 0 - -def test_setup_routes(internal_routes): - internal_routes.setup_routes() - routes = internal_routes.routes - assert any(route.method == 'GET' and str(route.path) == '/files' for route in routes) - -def test_get_app(internal_routes): - app = internal_routes.get_app() - assert isinstance(app, web.Application) - assert internal_routes._app is not None - -def test_get_app_reuse(internal_routes): - app1 = internal_routes.get_app() - app2 = internal_routes.get_app() - assert app1 is app2 - -@pytest.mark.asyncio -async def test_routes_added_to_app(aiohttp_client_factory, internal_routes): - client = await aiohttp_client_factory() - try: - resp = await client.get('/files') - print(f"Response received: status {resp.status}") # noqa: T201 - except Exception as e: - print(f"Exception occurred during GET request: {e}") # noqa: T201 - raise - - assert resp.status != 404, "Route /files does not exist" - -@pytest.mark.asyncio -async def test_file_service_initialization(): - with patch('api_server.routes.internal.internal_routes.FileService') as MockFileService: - # Create a mock instance - mock_file_service_instance = MagicMock(spec=FileService) - MockFileService.return_value = mock_file_service_instance - internal_routes = InternalRoutes(None) - - # Check if FileService was initialized with the correct parameters - MockFileService.assert_called_once_with({ - "models": models_dir, - "user": user_directory, - "output": output_directory - }) - - # Verify that the file_service attribute of InternalRoutes is set - assert internal_routes.file_service == mock_file_service_instance diff --git a/tests-unit/server/services/file_service_test.py b/tests-unit/server/services/file_service_test.py deleted file mode 100644 index 09c3efc9f..000000000 --- a/tests-unit/server/services/file_service_test.py +++ /dev/null @@ -1,54 +0,0 @@ -import pytest -from unittest.mock import MagicMock -from api_server.services.file_service import FileService - -@pytest.fixture -def mock_file_system_ops(): - return MagicMock() - -@pytest.fixture -def file_service(mock_file_system_ops): - allowed_directories = { - "models": "/path/to/models", - "user": "/path/to/user", - "output": "/path/to/output" - } - return FileService(allowed_directories, file_system_ops=mock_file_system_ops) - -def test_list_files_valid_directory(file_service, mock_file_system_ops): - mock_file_system_ops.walk_directory.return_value = [ - {"name": "file1.txt", "path": "file1.txt", "type": "file", "size": 100}, - {"name": "dir1", "path": "dir1", "type": "directory"} - ] - - result = file_service.list_files("models") - - assert len(result) == 2 - assert result[0]["name"] == "file1.txt" - assert result[1]["name"] == "dir1" - mock_file_system_ops.walk_directory.assert_called_once_with("/path/to/models") - -def test_list_files_invalid_directory(file_service): - # Does not support walking directories outside of the allowed directories - with pytest.raises(ValueError, match="Invalid directory key"): - file_service.list_files("invalid_key") - -def test_list_files_empty_directory(file_service, mock_file_system_ops): - mock_file_system_ops.walk_directory.return_value = [] - - result = file_service.list_files("models") - - assert len(result) == 0 - mock_file_system_ops.walk_directory.assert_called_once_with("/path/to/models") - -@pytest.mark.parametrize("directory_key", ["models", "user", "output"]) -def test_list_files_all_allowed_directories(file_service, mock_file_system_ops, directory_key): - mock_file_system_ops.walk_directory.return_value = [ - {"name": f"file_{directory_key}.txt", "path": f"file_{directory_key}.txt", "type": "file", "size": 100} - ] - - result = file_service.list_files(directory_key) - - assert len(result) == 1 - assert result[0]["name"] == f"file_{directory_key}.txt" - mock_file_system_ops.walk_directory.assert_called_once_with(f"/path/to/{directory_key}") From 14880e6dbabf3f367afd4f8b4546583136edd90b Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 6 Feb 2025 05:00:19 -0500 Subject: [PATCH 080/478] Remove some useless code. --- comfy/ldm/lumina/model.py | 55 --------------------------------------- 1 file changed, 55 deletions(-) diff --git a/comfy/ldm/lumina/model.py b/comfy/ldm/lumina/model.py index ec4119722..3292bd2f0 100644 --- a/comfy/ldm/lumina/model.py +++ b/comfy/ldm/lumina/model.py @@ -352,25 +352,6 @@ class FinalLayer(nn.Module): return x -class RopeEmbedder: - def __init__( - self, theta: float = 10000.0, axes_dims: List[int] = (16, 56, 56), axes_lens: List[int] = (1, 512, 512) - ): - super().__init__() - self.theta = theta - self.axes_dims = axes_dims - self.axes_lens = axes_lens - self.freqs_cis = NextDiT.precompute_freqs_cis(self.axes_dims, self.axes_lens, theta=self.theta) - - def __call__(self, ids: torch.Tensor): - self.freqs_cis = [freqs_cis.to(ids.device) for freqs_cis in self.freqs_cis] - result = [] - for i in range(len(self.axes_dims)): - index = ids[:, :, i:i+1].repeat(1, 1, self.freqs_cis[i].shape[-1]).to(torch.int64) - result.append(torch.gather(self.freqs_cis[i].unsqueeze(0).repeat(index.shape[0], 1, 1), dim=1, index=index)) - return torch.cat(result, dim=-1) - - class NextDiT(nn.Module): """ Diffusion model with a Transformer backbone. @@ -481,7 +462,6 @@ class NextDiT(nn.Module): assert (dim // n_heads) == sum(axes_dims) self.axes_dims = axes_dims self.axes_lens = axes_lens - # self.rope_embedder = RopeEmbedder(axes_dims=axes_dims, axes_lens=axes_lens) self.rope_embedder = EmbedND(dim=dim // n_heads, theta=10000.0, axes_dim=axes_dims) self.dim = dim self.n_heads = n_heads @@ -609,7 +589,6 @@ class NextDiT(nn.Module): return padded_full_embed, mask, img_sizes, l_effective_cap_len, freqs_cis - # def forward(self, x, t, cap_feats, cap_mask): def forward(self, x, timesteps, context, num_tokens, attention_mask=None, **kwargs): t = 1.0 - timesteps @@ -638,37 +617,3 @@ class NextDiT(nn.Module): return -x - @staticmethod - def precompute_freqs_cis( - dim: List[int], - end: List[int], - theta: float = 10000.0, - ): - """ - Precompute the frequency tensor for complex exponentials (cis) with - given dimensions. - - This function calculates a frequency tensor with complex exponentials - using the given dimension 'dim' and the end index 'end'. The 'theta' - parameter scales the frequencies. The returned tensor contains complex - values in complex64 data type. - - Args: - dim (list): Dimension of the frequency tensor. - end (list): End index for precomputing frequencies. - theta (float, optional): Scaling factor for frequency computation. - Defaults to 10000.0. - - Returns: - torch.Tensor: Precomputed frequency tensor with complex - exponentials. - """ - freqs_cis = [] - for i, (d, e) in enumerate(zip(dim, end)): - freqs = 1.0 / (theta ** (torch.arange(0, d, 2, dtype=torch.float64, device="cpu") / d)) - timestep = torch.arange(e, device=freqs.device, dtype=torch.float64) - freqs = torch.outer(timestep, freqs).float() - freqs_cis_i = torch.polar(torch.ones_like(freqs), freqs).to(torch.complex64) # complex64 - freqs_cis.append(freqs_cis_i) - - return freqs_cis From fca304debf5a4e6c71f8def10ac41cf69519fde3 Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Fri, 7 Feb 2025 00:43:10 +0900 Subject: [PATCH 081/478] Update frontend to v1.8.14 (#6724) Co-authored-by: huchenlei <20929282+huchenlei@users.noreply.github.com> --- ...omkdXg.js => BaseViewTemplate-Cz111_1A.js} | 4 +- ...DnSXEF.js => DesktopStartView-FKlxS2Lt.js} | 6 +-- ...STu4yxt.js => DownloadGitView-DVXUne-M.js} | 6 +-- ...GE0aOkbr.js => ExtensionPanel-iPOrhDVM.js} | 8 ++-- ...View-CUSGEqGS.js => GraphView-D9ZzDQZV.js} | 12 +++--- ...ew-DTDlVr0Z.js => InstallView-CVZcZZXJ.js} | 8 ++-- ...0Nt6GXU.js => KeybindingPanel-CeHhC2F4.js} | 10 ++--- ...5Gl0Rrl.js => MaintenanceView-Df7CHNWW.js} | 14 +++---- ...js => ManualConfigurationView-Cz0_f_T-.js} | 6 +-- ...UF4Z.js => MetricsConsentView-B5NlgqrS.js} | 6 +-- ...DrAb9U.js => NotSupportedView-BUpntA4x.js} | 6 +-- ...hsuUV.js => ServerConfigPanel-B1lI5M9c.js} | 6 +-- ...zYZ8gms.js => ServerStartView-BpH4TXPO.js} | 6 +-- ...DeJDnrF0.js => UserSelectView-wxa07xPk.js} | 6 +-- ...ew-DkwLdayn.js => WelcomeView-BrXELNIm.js} | 6 +-- .../{index-hkkV7N7e.js => index-BNlqgrYT.js} | 4 +- .../{index-B4tExwG7.js => index-BYzwFNH3.js} | 4 +- .../{index-nJubvliG.js => index-BapOFhAR.js} | 6 +-- .../{index-D4CAJ2MK.js => index-DKIv7atk.js} | 6 +-- .../{index-D6zf5KAf.js => index-DXE47DZl.js} | 4 +- .../{index-4Hb32CNk.js => index-DqqhYDnY.js} | 42 +++++++++---------- ...dTpfl.js => keybindingService-DEgCutrm.js} | 4 +- ...ZcbWj.js => serverConfigStore-Kb5DJVFt.js} | 4 +- web/index.html | 2 +- 24 files changed, 93 insertions(+), 93 deletions(-) rename web/assets/{BaseViewTemplate-v6omkdXg.js => BaseViewTemplate-Cz111_1A.js} (94%) rename web/assets/{DesktopStartView-coDnSXEF.js => DesktopStartView-FKlxS2Lt.js} (79%) rename web/assets/{DownloadGitView-3STu4yxt.js => DownloadGitView-DVXUne-M.js} (94%) rename web/assets/{ExtensionPanel-GE0aOkbr.js => ExtensionPanel-iPOrhDVM.js} (97%) rename web/assets/{GraphView-CUSGEqGS.js => GraphView-D9ZzDQZV.js} (99%) rename web/assets/{InstallView-DTDlVr0Z.js => InstallView-CVZcZZXJ.js} (99%) rename web/assets/{KeybindingPanel-C0Nt6GXU.js => KeybindingPanel-CeHhC2F4.js} (97%) rename web/assets/{MaintenanceView-B5Gl0Rrl.js => MaintenanceView-Df7CHNWW.js} (99%) rename web/assets/{ManualConfigurationView-DueOvLuK.js => ManualConfigurationView-Cz0_f_T-.js} (95%) rename web/assets/{MetricsConsentView-DTQYUF4Z.js => MetricsConsentView-B5NlgqrS.js} (95%) rename web/assets/{NotSupportedView-PDDrAb9U.js => NotSupportedView-BUpntA4x.js} (96%) rename web/assets/{ServerConfigPanel-DnGhsuUV.js => ServerConfigPanel-B1lI5M9c.js} (97%) rename web/assets/{ServerStartView-yzYZ8gms.js => ServerStartView-BpH4TXPO.js} (96%) rename web/assets/{UserSelectView-DeJDnrF0.js => UserSelectView-wxa07xPk.js} (97%) rename web/assets/{WelcomeView-DkwLdayn.js => WelcomeView-BrXELNIm.js} (91%) rename web/assets/{index-hkkV7N7e.js => index-BNlqgrYT.js} (99%) rename web/assets/{index-B4tExwG7.js => index-BYzwFNH3.js} (99%) rename web/assets/{index-nJubvliG.js => index-BapOFhAR.js} (99%) rename web/assets/{index-D4CAJ2MK.js => index-DKIv7atk.js} (99%) rename web/assets/{index-D6zf5KAf.js => index-DXE47DZl.js} (94%) rename web/assets/{index-4Hb32CNk.js => index-DqqhYDnY.js} (99%) rename web/assets/{keybindingService-BTNdTpfl.js => keybindingService-DEgCutrm.js} (98%) rename web/assets/{serverConfigStore-BYbZcbWj.js => serverConfigStore-Kb5DJVFt.js} (97%) diff --git a/web/assets/BaseViewTemplate-v6omkdXg.js b/web/assets/BaseViewTemplate-Cz111_1A.js similarity index 94% rename from web/assets/BaseViewTemplate-v6omkdXg.js rename to web/assets/BaseViewTemplate-Cz111_1A.js index bc21d9896..74515b87c 100644 --- a/web/assets/BaseViewTemplate-v6omkdXg.js +++ b/web/assets/BaseViewTemplate-Cz111_1A.js @@ -1,4 +1,4 @@ -import { d as defineComponent, U as ref, p as onMounted, b4 as isElectron, W as nextTick, b5 as electronAPI, o as openBlock, f as createElementBlock, i as withDirectives, v as vShow, j as unref, b6 as isNativeWindow, m as createBaseVNode, A as renderSlot, ai as normalizeClass } from "./index-4Hb32CNk.js"; +import { d as defineComponent, U as ref, p as onMounted, b4 as isElectron, W as nextTick, b5 as electronAPI, o as openBlock, f as createElementBlock, i as withDirectives, v as vShow, j as unref, b6 as isNativeWindow, m as createBaseVNode, A as renderSlot, ai as normalizeClass } from "./index-DqqhYDnY.js"; const _hoisted_1 = { class: "flex-grow w-full flex items-center justify-center overflow-auto" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "BaseViewTemplate", @@ -48,4 +48,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as _ }; -//# sourceMappingURL=BaseViewTemplate-v6omkdXg.js.map +//# sourceMappingURL=BaseViewTemplate-Cz111_1A.js.map diff --git a/web/assets/DesktopStartView-coDnSXEF.js b/web/assets/DesktopStartView-FKlxS2Lt.js similarity index 79% rename from web/assets/DesktopStartView-coDnSXEF.js rename to web/assets/DesktopStartView-FKlxS2Lt.js index db8199854..b8b847632 100644 --- a/web/assets/DesktopStartView-coDnSXEF.js +++ b/web/assets/DesktopStartView-FKlxS2Lt.js @@ -1,5 +1,5 @@ -import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, k as createVNode, j as unref, bz as script } from "./index-4Hb32CNk.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.js"; +import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, k as createVNode, j as unref, bz as script } from "./index-DqqhYDnY.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.js"; const _hoisted_1 = { class: "max-w-screen-sm w-screen p-8" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "DesktopStartView", @@ -19,4 +19,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=DesktopStartView-coDnSXEF.js.map +//# sourceMappingURL=DesktopStartView-FKlxS2Lt.js.map diff --git a/web/assets/DownloadGitView-3STu4yxt.js b/web/assets/DownloadGitView-DVXUne-M.js similarity index 94% rename from web/assets/DownloadGitView-3STu4yxt.js rename to web/assets/DownloadGitView-DVXUne-M.js index be7ac0dfd..9d879bd3e 100644 --- a/web/assets/DownloadGitView-3STu4yxt.js +++ b/web/assets/DownloadGitView-DVXUne-M.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, be as useRouter } from "./index-4Hb32CNk.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.js"; +import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, be as useRouter } from "./index-DqqhYDnY.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.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" }; @@ -55,4 +55,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=DownloadGitView-3STu4yxt.js.map +//# sourceMappingURL=DownloadGitView-DVXUne-M.js.map diff --git a/web/assets/ExtensionPanel-GE0aOkbr.js b/web/assets/ExtensionPanel-iPOrhDVM.js similarity index 97% rename from web/assets/ExtensionPanel-GE0aOkbr.js rename to web/assets/ExtensionPanel-iPOrhDVM.js index 8fa78029e..4f4660193 100644 --- a/web/assets/ExtensionPanel-GE0aOkbr.js +++ b/web/assets/ExtensionPanel-iPOrhDVM.js @@ -1,8 +1,8 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, U as ref, dl as FilterMatchMode, dr as useExtensionStore, a as useSettingStore, p as onMounted, c as computed, o as openBlock, y as createBlock, z as withCtx, k as createVNode, dm as SearchBox, j as unref, bj as script, m as createBaseVNode, f as createElementBlock, D as renderList, E as toDisplayString, a7 as createTextVNode, F as Fragment, l as script$1, B as createCommentVNode, a4 as script$3, ax as script$4, bn as script$5, dn as _sfc_main$1 } from "./index-4Hb32CNk.js"; -import { g as script$2, h as script$6 } from "./index-nJubvliG.js"; -import "./index-D6zf5KAf.js"; +import { d as defineComponent, U as ref, dl as FilterMatchMode, dr as useExtensionStore, a as useSettingStore, p as onMounted, c as computed, o as openBlock, y as createBlock, z as withCtx, k as createVNode, dm as SearchBox, j as unref, bj as script, m as createBaseVNode, f as createElementBlock, D as renderList, E as toDisplayString, a7 as createTextVNode, F as Fragment, l as script$1, B as createCommentVNode, a4 as script$3, ax as script$4, bn as script$5, dn as _sfc_main$1 } from "./index-DqqhYDnY.js"; +import { g as script$2, h as script$6 } from "./index-BapOFhAR.js"; +import "./index-DXE47DZl.js"; const _hoisted_1 = { class: "flex justify-end" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "ExtensionPanel", @@ -179,4 +179,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ExtensionPanel-GE0aOkbr.js.map +//# sourceMappingURL=ExtensionPanel-iPOrhDVM.js.map diff --git a/web/assets/GraphView-CUSGEqGS.js b/web/assets/GraphView-D9ZzDQZV.js similarity index 99% rename from web/assets/GraphView-CUSGEqGS.js rename to web/assets/GraphView-D9ZzDQZV.js index 3291a439e..5083b86f7 100644 --- a/web/assets/GraphView-CUSGEqGS.js +++ b/web/assets/GraphView-D9ZzDQZV.js @@ -1,10 +1,10 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -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 createVNode, s as showNativeMenu, l as script, m as createBaseVNode, n as normalizeStyle, _ as _export_sfc, p as onMounted, q as onBeforeUnmount, t as useSidebarTabStore, x as useBottomPanelStore, y as createBlock, z as withCtx, A as renderSlot, B as createCommentVNode, C as resolveDynamicComponent, F as Fragment, D as renderList, E as toDisplayString, G as script$5, H as markRaw, I as defineStore, J as shallowRef, K as useI18n, L as useCommandStore, M as LiteGraph, N as useColorPaletteStore, O as watch, P as useNodeDefStore, Q as BadgePosition, R as LGraphBadge, S as _, T as NodeBadgeMode, U as ref, V as useEventListener, W as nextTick, X as st, Y as normalizeI18nKey, Z as LGraphGroup, $ as LGraphNode, a0 as EditableText, a1 as useNodeFrequencyStore, a2 as useNodeBookmarkStore, a3 as highlightQuery, a4 as script$8, a5 as formatNumberWithSuffix, a6 as NodeSourceType, a7 as createTextVNode, a8 as script$9, a9 as NodePreview, aa as NodeSearchFilter, ab as script$a, ac as SearchFilterChip, ad as useLitegraphService, ae as storeToRefs, af as isRef, ag as toRaw, ah as LinkReleaseTriggerAction, ai as normalizeClass, aj as useUserStore, ak as useDialogStore, al as SettingDialogHeader, am as SettingDialogContent, an as useKeybindingStore, ao as Teleport, ap as usePragmaticDraggable, aq as usePragmaticDroppable, ar as withModifiers, as as mergeProps, at as useWorkflowService, au as useWorkflowBookmarkStore, av as script$c, aw as script$d, ax as script$e, ay as LinkMarkerShape, az as useModelToNodeStore, aA as ComfyNodeDefImpl, aB as ComfyModelDef, aC as LGraph, aD as LLink, aE as DragAndScale, aF as LGraphCanvas, aG as ContextMenu, aH as api, aI as getStorageValue, aJ as useModelStore, aK as setStorageValue, aL as CanvasPointer, aM as IS_CONTROL_WIDGET, aN as updateControlWidgetLabel, aO as useColorPaletteService, aP as ChangeTracker, aQ as i18n, aR as useToast, aS as useToastStore, aT as useQueueSettingsStore, aU as script$g, aV as useQueuePendingTaskCountStore, aW as useLocalStorage, aX as useDraggable, aY as watchDebounced, aZ as inject, a_ as useElementBounding, a$ as script$i, b0 as lodashExports, b1 as useEventBus, b2 as useMenuItemStore, b3 as provide, b4 as isElectron, b5 as electronAPI, b6 as isNativeWindow, b7 as useDialogService, b8 as LGraphEventMode, b9 as useQueueStore, ba as DEFAULT_DARK_COLOR_PALETTE, bb as DEFAULT_LIGHT_COLOR_PALETTE, bc as t, bd as useErrorHandling } from "./index-4Hb32CNk.js"; -import { s as script$1, a as script$2, b as script$3, c as script$4, d as script$6, e as script$7, f as script$b, g as script$f, h as script$h, i as script$j } from "./index-D4CAJ2MK.js"; -import { u as useKeybindingService } from "./keybindingService-BTNdTpfl.js"; -import { u as useServerConfigStore } from "./serverConfigStore-BYbZcbWj.js"; -import "./index-D6zf5KAf.js"; +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 createVNode, s as showNativeMenu, l as script, m as createBaseVNode, n as normalizeStyle, _ as _export_sfc, p as onMounted, q as onBeforeUnmount, t as useSidebarTabStore, x as useBottomPanelStore, y as createBlock, z as withCtx, A as renderSlot, B as createCommentVNode, C as resolveDynamicComponent, F as Fragment, D as renderList, E as toDisplayString, G as script$5, H as markRaw, I as defineStore, J as shallowRef, K as useI18n, L as useCommandStore, M as LiteGraph, N as useColorPaletteStore, O as watch, P as useNodeDefStore, Q as BadgePosition, R as LGraphBadge, S as _, T as NodeBadgeMode, U as ref, V as useEventListener, W as nextTick, X as st, Y as normalizeI18nKey, Z as LGraphGroup, $ as LGraphNode, a0 as EditableText, a1 as useNodeFrequencyStore, a2 as useNodeBookmarkStore, a3 as highlightQuery, a4 as script$8, a5 as formatNumberWithSuffix, a6 as NodeSourceType, a7 as createTextVNode, a8 as script$9, a9 as NodePreview, aa as NodeSearchFilter, ab as script$a, ac as SearchFilterChip, ad as useLitegraphService, ae as storeToRefs, af as isRef, ag as toRaw, ah as LinkReleaseTriggerAction, ai as normalizeClass, aj as useUserStore, ak as useDialogStore, al as SettingDialogHeader, am as SettingDialogContent, an as useKeybindingStore, ao as Teleport, ap as usePragmaticDraggable, aq as usePragmaticDroppable, ar as withModifiers, as as mergeProps, at as useWorkflowService, au as useWorkflowBookmarkStore, av as script$c, aw as script$d, ax as script$e, ay as LinkMarkerShape, az as useModelToNodeStore, aA as ComfyNodeDefImpl, aB as ComfyModelDef, aC as LGraph, aD as LLink, aE as DragAndScale, aF as LGraphCanvas, aG as ContextMenu, aH as api, aI as getStorageValue, aJ as useModelStore, aK as setStorageValue, aL as CanvasPointer, aM as IS_CONTROL_WIDGET, aN as updateControlWidgetLabel, aO as useColorPaletteService, aP as ChangeTracker, aQ as i18n, aR as useToast, aS as useToastStore, aT as useQueueSettingsStore, aU as script$g, aV as useQueuePendingTaskCountStore, aW as useLocalStorage, aX as useDraggable, aY as watchDebounced, aZ as inject, a_ as useElementBounding, a$ as script$i, b0 as lodashExports, b1 as useEventBus, b2 as useMenuItemStore, b3 as provide, b4 as isElectron, b5 as electronAPI, b6 as isNativeWindow, b7 as useDialogService, b8 as LGraphEventMode, b9 as useQueueStore, ba as DEFAULT_DARK_COLOR_PALETTE, bb as DEFAULT_LIGHT_COLOR_PALETTE, bc as t, bd as useErrorHandling } from "./index-DqqhYDnY.js"; +import { s as script$1, a as script$2, b as script$3, c as script$4, d as script$6, e as script$7, f as script$b, g as script$f, h as script$h, i as script$j } from "./index-DKIv7atk.js"; +import { u as useKeybindingService } from "./keybindingService-DEgCutrm.js"; +import { u as useServerConfigStore } from "./serverConfigStore-Kb5DJVFt.js"; +import "./index-DXE47DZl.js"; const DEFAULT_TITLE = "ComfyUI"; const TITLE_SUFFIX = " - ComfyUI"; const _sfc_main$u = /* @__PURE__ */ defineComponent({ @@ -4679,4 +4679,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=GraphView-CUSGEqGS.js.map +//# sourceMappingURL=GraphView-D9ZzDQZV.js.map diff --git a/web/assets/InstallView-DTDlVr0Z.js b/web/assets/InstallView-CVZcZZXJ.js similarity index 99% rename from web/assets/InstallView-DTDlVr0Z.js rename to web/assets/InstallView-CVZcZZXJ.js index 380d7a9f1..25d05f5f0 100644 --- a/web/assets/InstallView-DTDlVr0Z.js +++ b/web/assets/InstallView-CVZcZZXJ.js @@ -1,9 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, U as ref, bm as useModel, o as openBlock, f as createElementBlock, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, bn as script, bh as script$1, ar as withModifiers, z as withCtx, ab as script$2, K as useI18n, c as computed, ai as normalizeClass, B as createCommentVNode, a4 as script$3, a7 as createTextVNode, b5 as electronAPI, _ as _export_sfc, p as onMounted, r as resolveDirective, bg as script$4, i as withDirectives, bo as script$5, bp as script$6, l as script$7, y as createBlock, bj as script$8, bq as MigrationItems, w as watchEffect, F as Fragment, D as renderList, br as script$9, bs as mergeModels, bt as ValidationState, Y as normalizeI18nKey, O as watch, bu as checkMirrorReachable, bv as _sfc_main$7, bw as mergeValidationStates, bc as t, a$ as script$a, bx as CUDA_TORCH_URL, by as NIGHTLY_CPU_TORCH_URL, be as useRouter, ag as toRaw } from "./index-4Hb32CNk.js"; -import { s as script$b, a as script$c, b as script$d, c as script$e, d as script$f } from "./index-hkkV7N7e.js"; +import { d as defineComponent, U as ref, bm as useModel, o as openBlock, f as createElementBlock, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, bn as script, bh as script$1, ar as withModifiers, z as withCtx, ab as script$2, K as useI18n, c as computed, ai as normalizeClass, B as createCommentVNode, a4 as script$3, a7 as createTextVNode, b5 as electronAPI, _ as _export_sfc, p as onMounted, r as resolveDirective, bg as script$4, i as withDirectives, bo as script$5, bp as script$6, l as script$7, y as createBlock, bj as script$8, bq as MigrationItems, w as watchEffect, F as Fragment, D as renderList, br as script$9, bs as mergeModels, bt as ValidationState, Y as normalizeI18nKey, O as watch, bu as checkMirrorReachable, bv as _sfc_main$7, bw as mergeValidationStates, bc as t, a$ as script$a, bx as CUDA_TORCH_URL, by as NIGHTLY_CPU_TORCH_URL, be as useRouter, ag as toRaw } from "./index-DqqhYDnY.js"; +import { s as script$b, a as script$c, b as script$d, c as script$e, d as script$f } from "./index-BNlqgrYT.js"; import { P as PYTHON_MIRROR, a as PYPI_MIRROR } from "./uvMirrors-B-HKMf6X.js"; -import { _ as _sfc_main$8 } from "./BaseViewTemplate-v6omkdXg.js"; +import { _ as _sfc_main$8 } from "./BaseViewTemplate-Cz111_1A.js"; const _hoisted_1$5 = { class: "flex flex-col gap-6 w-[600px]" }; const _hoisted_2$5 = { class: "flex flex-col gap-4" }; const _hoisted_3$5 = { class: "text-2xl font-semibold text-neutral-100" }; @@ -942,4 +942,4 @@ const InstallView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data- export { InstallView as default }; -//# sourceMappingURL=InstallView-DTDlVr0Z.js.map +//# sourceMappingURL=InstallView-CVZcZZXJ.js.map diff --git a/web/assets/KeybindingPanel-C0Nt6GXU.js b/web/assets/KeybindingPanel-CeHhC2F4.js similarity index 97% rename from web/assets/KeybindingPanel-C0Nt6GXU.js rename to web/assets/KeybindingPanel-CeHhC2F4.js index f791713bb..c14bb7632 100644 --- a/web/assets/KeybindingPanel-C0Nt6GXU.js +++ b/web/assets/KeybindingPanel-CeHhC2F4.js @@ -1,9 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, D as renderList, k as createVNode, z as withCtx, a7 as createTextVNode, E as toDisplayString, j as unref, a4 as script, B as createCommentVNode, U as ref, dl as FilterMatchMode, an as useKeybindingStore, L as useCommandStore, K as useI18n, Y as normalizeI18nKey, w as watchEffect, aR as useToast, r as resolveDirective, y as createBlock, dm as SearchBox, m as createBaseVNode, l as script$2, bg as script$4, ar as withModifiers, bj as script$5, ab as script$6, i as withDirectives, dn as _sfc_main$2, dp as KeyComboImpl, dq as KeybindingImpl, _ as _export_sfc } from "./index-4Hb32CNk.js"; -import { g as script$1, h as script$3 } from "./index-nJubvliG.js"; -import { u as useKeybindingService } from "./keybindingService-BTNdTpfl.js"; -import "./index-D6zf5KAf.js"; +import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, D as renderList, k as createVNode, z as withCtx, a7 as createTextVNode, E as toDisplayString, j as unref, a4 as script, B as createCommentVNode, U as ref, dl as FilterMatchMode, an as useKeybindingStore, L as useCommandStore, K as useI18n, Y as normalizeI18nKey, w as watchEffect, aR as useToast, r as resolveDirective, y as createBlock, dm as SearchBox, m as createBaseVNode, l as script$2, bg as script$4, ar as withModifiers, bj as script$5, ab as script$6, i as withDirectives, dn as _sfc_main$2, dp as KeyComboImpl, dq as KeybindingImpl, _ as _export_sfc } from "./index-DqqhYDnY.js"; +import { g as script$1, h as script$3 } from "./index-BapOFhAR.js"; +import { u as useKeybindingService } from "./keybindingService-DEgCutrm.js"; +import "./index-DXE47DZl.js"; const _hoisted_1$1 = { key: 0, class: "px-2" @@ -279,4 +279,4 @@ const KeybindingPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { KeybindingPanel as default }; -//# sourceMappingURL=KeybindingPanel-C0Nt6GXU.js.map +//# sourceMappingURL=KeybindingPanel-CeHhC2F4.js.map diff --git a/web/assets/MaintenanceView-B5Gl0Rrl.js b/web/assets/MaintenanceView-Df7CHNWW.js similarity index 99% rename from web/assets/MaintenanceView-B5Gl0Rrl.js rename to web/assets/MaintenanceView-Df7CHNWW.js index 4254e4e67..88056ab28 100644 --- a/web/assets/MaintenanceView-B5Gl0Rrl.js +++ b/web/assets/MaintenanceView-Df7CHNWW.js @@ -1,11 +1,11 @@ var __defProp = Object.defineProperty; var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -import { bA as BaseStyle, bB as script$1d, bC as ZIndex, bD as addClass, bE as focus, bF as blockBodyScroll, bG as unblockBodyScroll, bH as FocusTrap, l as script$1e, bI as script$1f, bJ as script$1g, bK as resolveComponent, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, f as createElementBlock, as as mergeProps, k as createVNode, bL as Transition, i as withDirectives, A as renderSlot, F as Fragment, m as createBaseVNode, ai as normalizeClass, E as toDisplayString, B as createCommentVNode, C as resolveDynamicComponent, d as defineComponent, bs as mergeModels, bm as useModel, v as vShow, j as unref, bM as script$1h, c as computed, bN as PrimeIcons, bc as t, a4 as script$1i, aZ as inject, bO as findSingle, bP as getAttribute, bQ as script$1j, bR as script$1k, bS as Ripple, bT as UniqueComponentId, bU as script$1l, D as renderList, bV as BaseDirective, bW as removeClass, bX as createElement, bY as hasClass, bZ as script$1m, b_ as script$1n, b$ as addStyle, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, c2 as relativePosition, c3 as getOuterWidth, c4 as absolutePosition, c5 as find, c6 as getIndex, c7 as getFocusableElements, c8 as OverlayEventBus, c9 as setAttribute, ca as localeComparator, bg as script$1o, cb as script$1p, n as normalizeStyle, a7 as createTextVNode, bf as withKeys, cc as resolveFieldData, cd as isNotEmpty, ce as equals, cf as script$1q, cg as isString, ch as isPrintableCharacter, ci as isEmpty, cj as findLastIndex, ck as script$1r, cl as script$1s, cm as uuid, a8 as script$1t, cn as sort, co as createSlots, cp as EventBus, H as markRaw, cq as resolve, cr as Tooltip, bi as script$1v, ab as script$1w, cs as script$1x, ct as script$1y, cu as script$1z, bz as script$1A, bj as script$1B, cv as normalizeProps, cw as isAttributeEquals, cx as guardReactiveProps, cy as setCSSProperty, cz as $dt, cA as script$1D, cB as script$1F, cC as getUserAgent, bn as script$1G, cD as script$1H, cE as getFirstFocusableElement, cF as getLastFocusableElement, cG as FilterService, br as script$1J, cH as script$1K, bp as script$1L, bo as script$1M, cI as script$1N, cJ as findIndexInList, cK as scrollInView, cL as script$1O, cM as script$1P, cN as script$1Q, cO as findLast, cP as getWindowScrollTop, cQ as getWidth, cR as getOffset, cS as vModelText, cT as script$1U, ar as withModifiers, cU as getVNodeProp, cV as getNextElementSibling, cW as getPreviousElementSibling, cX as isClickable, cY as _default, cZ as clearSelection, c_ as isRTL, b5 as electronAPI, I as defineStore, U as ref, c$ as useTimeout, O as watch, d0 as script$1Y, _ as _export_sfc, aR as useToast, d1 as useConfirm, bh as script$1Z, d2 as script$1_, p as onMounted, d3 as onUnmounted, av as script$1$, af as isRef, bl as BaseTerminal } from "./index-4Hb32CNk.js"; -import { j as script$1C, k as script$1E, g as script$20 } from "./index-D4CAJ2MK.js"; -import { s as script$1u, a as script$1R, b as script$1S, c as script$1T, d as script$1V, e as script$1W, f as script$1X } from "./index-nJubvliG.js"; -import { s as script$1I } from "./index-D6zf5KAf.js"; -import "./index-hkkV7N7e.js"; -import { _ as _sfc_main$7 } from "./BaseViewTemplate-v6omkdXg.js"; +import { bA as BaseStyle, bB as script$1d, bC as ZIndex, bD as addClass, bE as focus, bF as blockBodyScroll, bG as unblockBodyScroll, bH as FocusTrap, l as script$1e, bI as script$1f, bJ as script$1g, bK as resolveComponent, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, f as createElementBlock, as as mergeProps, k as createVNode, bL as Transition, i as withDirectives, A as renderSlot, F as Fragment, m as createBaseVNode, ai as normalizeClass, E as toDisplayString, B as createCommentVNode, C as resolveDynamicComponent, d as defineComponent, bs as mergeModels, bm as useModel, v as vShow, j as unref, bM as script$1h, c as computed, bN as PrimeIcons, bc as t, a4 as script$1i, aZ as inject, bO as findSingle, bP as getAttribute, bQ as script$1j, bR as script$1k, bS as Ripple, bT as UniqueComponentId, bU as script$1l, D as renderList, bV as BaseDirective, bW as removeClass, bX as createElement, bY as hasClass, bZ as script$1m, b_ as script$1n, b$ as addStyle, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, c2 as relativePosition, c3 as getOuterWidth, c4 as absolutePosition, c5 as find, c6 as getIndex, c7 as getFocusableElements, c8 as OverlayEventBus, c9 as setAttribute, ca as localeComparator, bg as script$1o, cb as script$1p, n as normalizeStyle, a7 as createTextVNode, bf as withKeys, cc as resolveFieldData, cd as isNotEmpty, ce as equals, cf as script$1q, cg as isString, ch as isPrintableCharacter, ci as isEmpty, cj as findLastIndex, ck as script$1r, cl as script$1s, cm as uuid, a8 as script$1t, cn as sort, co as createSlots, cp as EventBus, H as markRaw, cq as resolve, cr as Tooltip, bi as script$1v, ab as script$1w, cs as script$1x, ct as script$1y, cu as script$1z, bz as script$1A, bj as script$1B, cv as normalizeProps, cw as isAttributeEquals, cx as guardReactiveProps, cy as setCSSProperty, cz as $dt, cA as script$1D, cB as script$1F, cC as getUserAgent, bn as script$1G, cD as script$1H, cE as getFirstFocusableElement, cF as getLastFocusableElement, cG as FilterService, br as script$1J, cH as script$1K, bp as script$1L, bo as script$1M, cI as script$1N, cJ as findIndexInList, cK as scrollInView, cL as script$1O, cM as script$1P, cN as script$1Q, cO as findLast, cP as getWindowScrollTop, cQ as getWidth, cR as getOffset, cS as vModelText, cT as script$1U, ar as withModifiers, cU as getVNodeProp, cV as getNextElementSibling, cW as getPreviousElementSibling, cX as isClickable, cY as _default, cZ as clearSelection, c_ as isRTL, b5 as electronAPI, I as defineStore, U as ref, c$ as useTimeout, O as watch, d0 as script$1Y, _ as _export_sfc, aR as useToast, d1 as useConfirm, bh as script$1Z, d2 as script$1_, p as onMounted, d3 as onUnmounted, av as script$1$, af as isRef, bl as BaseTerminal } from "./index-DqqhYDnY.js"; +import { j as script$1C, k as script$1E, g as script$20 } from "./index-DKIv7atk.js"; +import { s as script$1u, a as script$1R, b as script$1S, c as script$1T, d as script$1V, e as script$1W, f as script$1X } from "./index-BapOFhAR.js"; +import { s as script$1I } from "./index-DXE47DZl.js"; +import "./index-BNlqgrYT.js"; +import { _ as _sfc_main$7 } from "./BaseViewTemplate-Cz111_1A.js"; var theme$D = /* @__PURE__ */ __name(function theme(_ref) { var dt = _ref.dt; return "\n.p-drawer {\n display: flex;\n flex-direction: column;\n transform: translate3d(0px, 0px, 0px);\n position: relative;\n transition: transform 0.3s;\n background: ".concat(dt("drawer.background"), ";\n color: ").concat(dt("drawer.color"), ";\n border: 1px solid ").concat(dt("drawer.border.color"), ";\n box-shadow: ").concat(dt("drawer.shadow"), ";\n}\n\n.p-drawer-content {\n overflow-y: auto;\n flex-grow: 1;\n padding: ").concat(dt("drawer.content.padding"), ";\n}\n\n.p-drawer-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-shrink: 0;\n padding: ").concat(dt("drawer.header.padding"), ";\n}\n\n.p-drawer-footer {\n padding: ").concat(dt("drawer.footer.padding"), ";\n}\n\n.p-drawer-title {\n font-weight: ").concat(dt("drawer.title.font.weight"), ";\n font-size: ").concat(dt("drawer.title.font.size"), ";\n}\n\n.p-drawer-full .p-drawer {\n transition: none;\n transform: none;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n border-width: 1px;\n}\n\n.p-drawer-left .p-drawer-enter-from,\n.p-drawer-left .p-drawer-leave-to {\n transform: translateX(-100%);\n}\n\n.p-drawer-right .p-drawer-enter-from,\n.p-drawer-right .p-drawer-leave-to {\n transform: translateX(100%);\n}\n\n.p-drawer-top .p-drawer-enter-from,\n.p-drawer-top .p-drawer-leave-to {\n transform: translateY(-100%);\n}\n\n.p-drawer-bottom .p-drawer-enter-from,\n.p-drawer-bottom .p-drawer-leave-to {\n transform: translateY(100%);\n}\n\n.p-drawer-full .p-drawer-enter-from,\n.p-drawer-full .p-drawer-leave-to {\n opacity: 0;\n}\n\n.p-drawer-full .p-drawer-enter-active,\n.p-drawer-full .p-drawer-leave-active {\n transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n.p-drawer-left .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-end-width: 1px;\n}\n\n.p-drawer-right .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-start-width: 1px;\n}\n\n.p-drawer-top .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-end-width: 1px;\n}\n\n.p-drawer-bottom .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-start-width: 1px;\n}\n\n.p-drawer-left .p-drawer-content,\n.p-drawer-right .p-drawer-content,\n.p-drawer-top .p-drawer-content,\n.p-drawer-bottom .p-drawer-content {\n width: 100%;\n height: 100%;\n}\n\n.p-drawer-open {\n display: flex;\n}\n\n.p-drawer-mask:dir(rtl) {\n flex-direction: row-reverse;\n}\n"); @@ -26030,4 +26030,4 @@ const MaintenanceView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { MaintenanceView as default }; -//# sourceMappingURL=MaintenanceView-B5Gl0Rrl.js.map +//# sourceMappingURL=MaintenanceView-Df7CHNWW.js.map diff --git a/web/assets/ManualConfigurationView-DueOvLuK.js b/web/assets/ManualConfigurationView-Cz0_f_T-.js similarity index 95% rename from web/assets/ManualConfigurationView-DueOvLuK.js rename to web/assets/ManualConfigurationView-Cz0_f_T-.js index 383794c52..bd81747f1 100644 --- a/web/assets/ManualConfigurationView-DueOvLuK.js +++ b/web/assets/ManualConfigurationView-Cz0_f_T-.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, K as useI18n, U as ref, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, a4 as script, a$ as script$1, l as script$2, b5 as electronAPI, _ as _export_sfc } from "./index-4Hb32CNk.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.js"; +import { d as defineComponent, K as useI18n, U as ref, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, a4 as script, a$ as script$1, l as script$2, b5 as electronAPI, _ as _export_sfc } from "./index-DqqhYDnY.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.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" }; @@ -71,4 +71,4 @@ const ManualConfigurationView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scop export { ManualConfigurationView as default }; -//# sourceMappingURL=ManualConfigurationView-DueOvLuK.js.map +//# sourceMappingURL=ManualConfigurationView-Cz0_f_T-.js.map diff --git a/web/assets/MetricsConsentView-DTQYUF4Z.js b/web/assets/MetricsConsentView-B5NlgqrS.js similarity index 95% rename from web/assets/MetricsConsentView-DTQYUF4Z.js rename to web/assets/MetricsConsentView-B5NlgqrS.js index 564780ee6..73800290f 100644 --- a/web/assets/MetricsConsentView-DTQYUF4Z.js +++ b/web/assets/MetricsConsentView-B5NlgqrS.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.js"; -import { d as defineComponent, aR as useToast, K as useI18n, U as ref, be as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, a7 as createTextVNode, k as createVNode, j as unref, bn as script, l as script$1, b5 as electronAPI } from "./index-4Hb32CNk.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.js"; +import { d as defineComponent, aR as useToast, K as useI18n, U as ref, be as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, a7 as createTextVNode, k as createVNode, j as unref, bn as script, l as script$1, b5 as electronAPI } from "./index-DqqhYDnY.js"; const _hoisted_1 = { class: "h-full p-8 2xl:p-16 flex flex-col items-center justify-center" }; const _hoisted_2 = { class: "bg-neutral-800 rounded-lg shadow-lg p-6 w-full max-w-[600px] flex flex-col gap-6" }; const _hoisted_3 = { class: "text-3xl font-semibold text-neutral-100" }; @@ -83,4 +83,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=MetricsConsentView-DTQYUF4Z.js.map +//# sourceMappingURL=MetricsConsentView-B5NlgqrS.js.map diff --git a/web/assets/NotSupportedView-PDDrAb9U.js b/web/assets/NotSupportedView-BUpntA4x.js similarity index 96% rename from web/assets/NotSupportedView-PDDrAb9U.js rename to web/assets/NotSupportedView-BUpntA4x.js index 0293bb6fe..51a34c8a1 100644 --- a/web/assets/NotSupportedView-PDDrAb9U.js +++ b/web/assets/NotSupportedView-BUpntA4x.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, be as useRouter, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, i as withDirectives, _ as _export_sfc } from "./index-4Hb32CNk.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.js"; +import { d as defineComponent, be as useRouter, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, i as withDirectives, _ as _export_sfc } from "./index-DqqhYDnY.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.js"; const _imports_0 = "" + new URL("images/sad_girl.png", import.meta.url).href; const _hoisted_1 = { class: "sad-container" }; const _hoisted_2 = { class: "no-drag sad-text flex items-center" }; @@ -83,4 +83,4 @@ const NotSupportedView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", " export { NotSupportedView as default }; -//# sourceMappingURL=NotSupportedView-PDDrAb9U.js.map +//# sourceMappingURL=NotSupportedView-BUpntA4x.js.map diff --git a/web/assets/ServerConfigPanel-DnGhsuUV.js b/web/assets/ServerConfigPanel-B1lI5M9c.js similarity index 97% rename from web/assets/ServerConfigPanel-DnGhsuUV.js rename to web/assets/ServerConfigPanel-B1lI5M9c.js index 873f6ec76..6a8c27a8d 100644 --- a/web/assets/ServerConfigPanel-DnGhsuUV.js +++ b/web/assets/ServerConfigPanel-B1lI5M9c.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { o as openBlock, f as createElementBlock, m as createBaseVNode, H as markRaw, d as defineComponent, a as useSettingStore, ae as storeToRefs, O as watch, dy as useCopyToClipboard, K as useI18n, y as createBlock, z as withCtx, j as unref, bj as script, E as toDisplayString, D as renderList, F as Fragment, k as createVNode, l as script$1, B as createCommentVNode, bh as script$2, dz as FormItem, dn as _sfc_main$1, b5 as electronAPI } from "./index-4Hb32CNk.js"; -import { u as useServerConfigStore } from "./serverConfigStore-BYbZcbWj.js"; +import { o as openBlock, f as createElementBlock, m as createBaseVNode, H as markRaw, d as defineComponent, a as useSettingStore, ae as storeToRefs, O as watch, dy as useCopyToClipboard, K as useI18n, y as createBlock, z as withCtx, j as unref, bj as script, E as toDisplayString, D as renderList, F as Fragment, k as createVNode, l as script$1, B as createCommentVNode, bh as script$2, dz as FormItem, dn as _sfc_main$1, b5 as electronAPI } from "./index-DqqhYDnY.js"; +import { u as useServerConfigStore } from "./serverConfigStore-Kb5DJVFt.js"; const _hoisted_1$1 = { viewBox: "0 0 24 24", width: "1.2em", @@ -153,4 +153,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ServerConfigPanel-DnGhsuUV.js.map +//# sourceMappingURL=ServerConfigPanel-B1lI5M9c.js.map diff --git a/web/assets/ServerStartView-yzYZ8gms.js b/web/assets/ServerStartView-BpH4TXPO.js similarity index 96% rename from web/assets/ServerStartView-yzYZ8gms.js rename to web/assets/ServerStartView-BpH4TXPO.js index 18a6a63f1..6796222b9 100644 --- a/web/assets/ServerStartView-yzYZ8gms.js +++ b/web/assets/ServerStartView-BpH4TXPO.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, K as useI18n, U as ref, bk as ProgressStatus, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, a7 as createTextVNode, E as toDisplayString, j as unref, f as createElementBlock, B as createCommentVNode, k as createVNode, l as script, i as withDirectives, v as vShow, bl as BaseTerminal, b5 as electronAPI, _ as _export_sfc } from "./index-4Hb32CNk.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.js"; +import { d as defineComponent, K as useI18n, U as ref, bk as ProgressStatus, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, a7 as createTextVNode, E as toDisplayString, j as unref, f as createElementBlock, B as createCommentVNode, k as createVNode, l as script, i as withDirectives, v as vShow, bl as BaseTerminal, b5 as electronAPI, _ as _export_sfc } from "./index-DqqhYDnY.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.js"; const _hoisted_1 = { class: "flex flex-col w-full h-full items-center" }; const _hoisted_2 = { class: "text-2xl font-bold" }; const _hoisted_3 = { key: 0 }; @@ -97,4 +97,4 @@ const ServerStartView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { ServerStartView as default }; -//# sourceMappingURL=ServerStartView-yzYZ8gms.js.map +//# sourceMappingURL=ServerStartView-BpH4TXPO.js.map diff --git a/web/assets/UserSelectView-DeJDnrF0.js b/web/assets/UserSelectView-wxa07xPk.js similarity index 97% rename from web/assets/UserSelectView-DeJDnrF0.js rename to web/assets/UserSelectView-wxa07xPk.js index 13504917d..35f6c4a2d 100644 --- a/web/assets/UserSelectView-DeJDnrF0.js +++ b/web/assets/UserSelectView-wxa07xPk.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, aj as useUserStore, be as useRouter, U as ref, c as computed, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, bf as withKeys, j as unref, bg as script, bh as script$1, bi as script$2, bj as script$3, a7 as createTextVNode, B as createCommentVNode, l as script$4 } from "./index-4Hb32CNk.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.js"; +import { d as defineComponent, aj as useUserStore, be as useRouter, U as ref, c as computed, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, bf as withKeys, j as unref, bg as script, bh as script$1, bi as script$2, bj as script$3, a7 as createTextVNode, B as createCommentVNode, l as script$4 } from "./index-DqqhYDnY.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.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" @@ -98,4 +98,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=UserSelectView-DeJDnrF0.js.map +//# sourceMappingURL=UserSelectView-wxa07xPk.js.map diff --git a/web/assets/WelcomeView-DkwLdayn.js b/web/assets/WelcomeView-BrXELNIm.js similarity index 91% rename from web/assets/WelcomeView-DkwLdayn.js rename to web/assets/WelcomeView-BrXELNIm.js index 95afcd734..81bf8f2a7 100644 --- a/web/assets/WelcomeView-DkwLdayn.js +++ b/web/assets/WelcomeView-BrXELNIm.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, be as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, _ as _export_sfc } from "./index-4Hb32CNk.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-v6omkdXg.js"; +import { d as defineComponent, be as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, _ as _export_sfc } from "./index-DqqhYDnY.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.js"; 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({ @@ -36,4 +36,4 @@ const WelcomeView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data- export { WelcomeView as default }; -//# sourceMappingURL=WelcomeView-DkwLdayn.js.map +//# sourceMappingURL=WelcomeView-BrXELNIm.js.map diff --git a/web/assets/index-hkkV7N7e.js b/web/assets/index-BNlqgrYT.js similarity index 99% rename from web/assets/index-hkkV7N7e.js rename to web/assets/index-BNlqgrYT.js index 7152922d0..bc17d1c31 100644 --- a/web/assets/index-hkkV7N7e.js +++ b/web/assets/index-BNlqgrYT.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -import { bA as BaseStyle, bB as script$6, o as openBlock, f as createElementBlock, as as mergeProps, cJ as findIndexInList, c5 as find, bK as resolveComponent, y as createBlock, C as resolveDynamicComponent, z as withCtx, m as createBaseVNode, E as toDisplayString, A as renderSlot, B as createCommentVNode, ai as normalizeClass, bO as findSingle, F as Fragment, bL as Transition, i as withDirectives, v as vShow, bT as UniqueComponentId } from "./index-4Hb32CNk.js"; +import { bA as BaseStyle, bB as script$6, o as openBlock, f as createElementBlock, as as mergeProps, cJ as findIndexInList, c5 as find, bK as resolveComponent, y as createBlock, C as resolveDynamicComponent, z as withCtx, m as createBaseVNode, E as toDisplayString, A as renderSlot, B as createCommentVNode, ai as normalizeClass, bO as findSingle, F as Fragment, bL as Transition, i as withDirectives, v as vShow, bT as UniqueComponentId } from "./index-DqqhYDnY.js"; var classes$4 = { root: /* @__PURE__ */ __name(function root(_ref) { var instance = _ref.instance; @@ -536,4 +536,4 @@ export { script as d, script$4 as s }; -//# sourceMappingURL=index-hkkV7N7e.js.map +//# sourceMappingURL=index-BNlqgrYT.js.map diff --git a/web/assets/index-B4tExwG7.js b/web/assets/index-BYzwFNH3.js similarity index 99% rename from web/assets/index-B4tExwG7.js rename to web/assets/index-BYzwFNH3.js index c27c17cd5..0673ca94c 100644 --- a/web/assets/index-B4tExwG7.js +++ b/web/assets/index-BYzwFNH3.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { da as ComfyDialog, db as $el, dc as ComfyApp, h as app, M as LiteGraph, aF as LGraphCanvas, dd as useExtensionService, de as processDynamicPrompt, b4 as isElectron, b5 as electronAPI, b as useWorkflowStore, bu as checkMirrorReachable, b7 as useDialogService, bc as t, df as DraggableList, aS as useToastStore, $ as LGraphNode, dg as applyTextReplacements, dh as ComfyWidgets, di as addValueControlWidgets, P as useNodeDefStore, dj as serialise, dk as deserialiseAndCreate, aH as api, a as useSettingStore, Z as LGraphGroup, W as nextTick, b0 as lodashExports, aK as setStorageValue, aI as getStorageValue } from "./index-4Hb32CNk.js"; +import { da as ComfyDialog, db as $el, dc as ComfyApp, h as app, M as LiteGraph, aF as LGraphCanvas, dd as useExtensionService, de as processDynamicPrompt, b4 as isElectron, b5 as electronAPI, b as useWorkflowStore, bu as checkMirrorReachable, b7 as useDialogService, bc as t, df as DraggableList, aS as useToastStore, $ as LGraphNode, dg as applyTextReplacements, dh as ComfyWidgets, di as addValueControlWidgets, P as useNodeDefStore, dj as serialise, dk as deserialiseAndCreate, aH as api, a as useSettingStore, Z as LGraphGroup, W as nextTick, b0 as lodashExports, aK as setStorageValue, aI as getStorageValue } from "./index-DqqhYDnY.js"; import { P as PYTHON_MIRROR } from "./uvMirrors-B-HKMf6X.js"; class ClipspaceDialog extends ComfyDialog { static { @@ -53844,4 +53844,4 @@ app.registerExtension({ }); } }); -//# sourceMappingURL=index-B4tExwG7.js.map +//# sourceMappingURL=index-BYzwFNH3.js.map diff --git a/web/assets/index-nJubvliG.js b/web/assets/index-BapOFhAR.js similarity index 99% rename from web/assets/index-nJubvliG.js rename to web/assets/index-BapOFhAR.js index 3672a41b4..a8d556911 100644 --- a/web/assets/index-nJubvliG.js +++ b/web/assets/index-BapOFhAR.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bA as BaseStyle, bB as script$s, bZ as script$t, o as openBlock, f as createElementBlock, as as mergeProps, m as createBaseVNode, E as toDisplayString, bS as Ripple, r as resolveDirective, i as withDirectives, y as createBlock, C as resolveDynamicComponent, bi as script$u, bK as resolveComponent, ai as normalizeClass, co as createSlots, z as withCtx, aU as script$v, cf as script$w, F as Fragment, D as renderList, a7 as createTextVNode, c9 as setAttribute, cv as normalizeProps, A as renderSlot, B as createCommentVNode, b_ as script$x, ce as equals, cA as script$y, br as script$z, cE as getFirstFocusableElement, c8 as OverlayEventBus, cU as getVNodeProp, cc as resolveFieldData, ds as invokeElementMethod, bP as getAttribute, cV as getNextElementSibling, c3 as getOuterWidth, cW as getPreviousElementSibling, l as script$A, bR as script$B, bU as script$C, bJ as script$E, cd as isNotEmpty, ar as withModifiers, d5 as getOuterHeight, bT as UniqueComponentId, cY as _default, bC as ZIndex, bE as focus, b$ as addStyle, c4 as absolutePosition, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, dt as FilterOperator, bI as script$F, cs as script$G, bH as FocusTrap, k as createVNode, bL as Transition, bf as withKeys, c6 as getIndex, cu as script$H, cX as isClickable, cZ as clearSelection, ca as localeComparator, cn as sort, cG as FilterService, dl as FilterMatchMode, bO as findSingle, cJ as findIndexInList, c5 as find, du as exportCSV, cR as getOffset, c_ as isRTL, dv as getHiddenElementOuterWidth, dw as getHiddenElementOuterHeight, dx as reorderArray, bW as removeClass, bD as addClass, ci as isEmpty, cH as script$I, ck as script$J } from "./index-4Hb32CNk.js"; -import { s as script$D } from "./index-D6zf5KAf.js"; +import { bA as BaseStyle, bB as script$s, bZ as script$t, o as openBlock, f as createElementBlock, as as mergeProps, m as createBaseVNode, E as toDisplayString, bS as Ripple, r as resolveDirective, i as withDirectives, y as createBlock, C as resolveDynamicComponent, bi as script$u, bK as resolveComponent, ai as normalizeClass, co as createSlots, z as withCtx, aU as script$v, cf as script$w, F as Fragment, D as renderList, a7 as createTextVNode, c9 as setAttribute, cv as normalizeProps, A as renderSlot, B as createCommentVNode, b_ as script$x, ce as equals, cA as script$y, br as script$z, cE as getFirstFocusableElement, c8 as OverlayEventBus, cU as getVNodeProp, cc as resolveFieldData, ds as invokeElementMethod, bP as getAttribute, cV as getNextElementSibling, c3 as getOuterWidth, cW as getPreviousElementSibling, l as script$A, bR as script$B, bU as script$C, bJ as script$E, cd as isNotEmpty, ar as withModifiers, d5 as getOuterHeight, bT as UniqueComponentId, cY as _default, bC as ZIndex, bE as focus, b$ as addStyle, c4 as absolutePosition, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, dt as FilterOperator, bI as script$F, cs as script$G, bH as FocusTrap, k as createVNode, bL as Transition, bf as withKeys, c6 as getIndex, cu as script$H, cX as isClickable, cZ as clearSelection, ca as localeComparator, cn as sort, cG as FilterService, dl as FilterMatchMode, bO as findSingle, cJ as findIndexInList, c5 as find, du as exportCSV, cR as getOffset, c_ as isRTL, dv as getHiddenElementOuterWidth, dw as getHiddenElementOuterHeight, dx as reorderArray, bW as removeClass, bD as addClass, ci as isEmpty, cH as script$I, ck as script$J } from "./index-DqqhYDnY.js"; +import { s as script$D } from "./index-DXE47DZl.js"; var ColumnStyle = BaseStyle.extend({ name: "column" }); @@ -8787,4 +8787,4 @@ export { script as h, script$l as s }; -//# sourceMappingURL=index-nJubvliG.js.map +//# sourceMappingURL=index-BapOFhAR.js.map diff --git a/web/assets/index-D4CAJ2MK.js b/web/assets/index-DKIv7atk.js similarity index 99% rename from web/assets/index-D4CAJ2MK.js rename to web/assets/index-DKIv7atk.js index 844ee64e4..16d4a527b 100644 --- a/web/assets/index-D4CAJ2MK.js +++ b/web/assets/index-DKIv7atk.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bA as BaseStyle, bB as script$f, cQ as getWidth, d4 as getHeight, c3 as getOuterWidth, d5 as getOuterHeight, c_ as isRTL, cU as getVNodeProp, d6 as isArray, o as openBlock, f as createElementBlock, as as mergeProps, F as Fragment, D as renderList, y as createBlock, C as resolveDynamicComponent, m as createBaseVNode, B as createCommentVNode, A as renderSlot, bP as getAttribute, bO as findSingle, bE as focus, ce as equals, bS as Ripple, r as resolveDirective, i as withDirectives, z as withCtx, ai as normalizeClass, cR as getOffset, cb as script$g, bU as script$h, cd as isNotEmpty, b_ as script$i, bT as UniqueComponentId, bC as ZIndex, cc as resolveFieldData, c8 as OverlayEventBus, ci as isEmpty, b$ as addStyle, c2 as relativePosition, c4 as absolutePosition, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, cj as findLastIndex, bg as script$j, cH as script$k, bI as script$l, bR as script$m, ck as script$n, a8 as script$o, bK as resolveComponent, n as normalizeStyle, k as createVNode, E as toDisplayString, bL as Transition, co as createSlots, a7 as createTextVNode, cu as script$p, bZ as script$q, cA as script$r, cB as script$s, bJ as script$t, cv as normalizeProps, d7 as ToastEventBus, c9 as setAttribute, d8 as TransitionGroup, cq as resolve, d9 as nestedPosition, cf as script$u, ch as isPrintableCharacter, l as script$v, cD as script$w, cx as guardReactiveProps } from "./index-4Hb32CNk.js"; -import { s as script$x } from "./index-D6zf5KAf.js"; +import { bA as BaseStyle, bB as script$f, cQ as getWidth, d4 as getHeight, c3 as getOuterWidth, d5 as getOuterHeight, c_ as isRTL, cU as getVNodeProp, d6 as isArray, o as openBlock, f as createElementBlock, as as mergeProps, F as Fragment, D as renderList, y as createBlock, C as resolveDynamicComponent, m as createBaseVNode, B as createCommentVNode, A as renderSlot, bP as getAttribute, bO as findSingle, bE as focus, ce as equals, bS as Ripple, r as resolveDirective, i as withDirectives, z as withCtx, ai as normalizeClass, cR as getOffset, cb as script$g, bU as script$h, cd as isNotEmpty, b_ as script$i, bT as UniqueComponentId, bC as ZIndex, cc as resolveFieldData, c8 as OverlayEventBus, ci as isEmpty, b$ as addStyle, c2 as relativePosition, c4 as absolutePosition, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, cj as findLastIndex, bg as script$j, cH as script$k, bI as script$l, bR as script$m, ck as script$n, a8 as script$o, bK as resolveComponent, n as normalizeStyle, k as createVNode, E as toDisplayString, bL as Transition, co as createSlots, a7 as createTextVNode, cu as script$p, bZ as script$q, cA as script$r, cB as script$s, bJ as script$t, cv as normalizeProps, d7 as ToastEventBus, c9 as setAttribute, d8 as TransitionGroup, cq as resolve, d9 as nestedPosition, cf as script$u, ch as isPrintableCharacter, l as script$v, cD as script$w, cx as guardReactiveProps } from "./index-DqqhYDnY.js"; +import { s as script$x } from "./index-DXE47DZl.js"; 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"); @@ -5602,4 +5602,4 @@ export { script$7 as k, script$d as s }; -//# sourceMappingURL=index-D4CAJ2MK.js.map +//# sourceMappingURL=index-DKIv7atk.js.map diff --git a/web/assets/index-D6zf5KAf.js b/web/assets/index-DXE47DZl.js similarity index 94% rename from web/assets/index-D6zf5KAf.js rename to web/assets/index-DXE47DZl.js index 819caaa2a..b25616f6b 100644 --- a/web/assets/index-D6zf5KAf.js +++ b/web/assets/index-DXE47DZl.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bZ as script$1, o as openBlock, f as createElementBlock, as as mergeProps, m as createBaseVNode } from "./index-4Hb32CNk.js"; +import { bZ as script$1, o as openBlock, f as createElementBlock, as as mergeProps, m as createBaseVNode } from "./index-DqqhYDnY.js"; var script = { name: "BarsIcon", "extends": script$1 @@ -24,4 +24,4 @@ script.render = render; export { script as s }; -//# sourceMappingURL=index-D6zf5KAf.js.map +//# sourceMappingURL=index-DXE47DZl.js.map diff --git a/web/assets/index-4Hb32CNk.js b/web/assets/index-DqqhYDnY.js similarity index 99% rename from web/assets/index-4Hb32CNk.js rename to web/assets/index-DqqhYDnY.js index ba83b1a4c..07ca6f829 100644 --- a/web/assets/index-4Hb32CNk.js +++ b/web/assets/index-DqqhYDnY.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-CUSGEqGS.js","./index-D4CAJ2MK.js","./index-D6zf5KAf.js","./keybindingService-BTNdTpfl.js","./serverConfigStore-BYbZcbWj.js","./GraphView-CVCdiww1.css","./UserSelectView-DeJDnrF0.js","./BaseViewTemplate-v6omkdXg.js","./ServerStartView-yzYZ8gms.js","./ServerStartView-CJiwVDQY.css","./InstallView-DTDlVr0Z.js","./index-hkkV7N7e.js","./uvMirrors-B-HKMf6X.js","./InstallView-DbJ2cGfL.css","./WelcomeView-DkwLdayn.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-PDDrAb9U.js","./NotSupportedView-RFx6eCkN.css","./DownloadGitView-3STu4yxt.js","./ManualConfigurationView-DueOvLuK.js","./ManualConfigurationView-CsirlNfV.css","./MetricsConsentView-DTQYUF4Z.js","./DesktopStartView-coDnSXEF.js","./MaintenanceView-B5Gl0Rrl.js","./index-nJubvliG.js","./MaintenanceView-Bj5_Vr6o.css","./KeybindingPanel-C0Nt6GXU.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-GE0aOkbr.js","./ServerConfigPanel-DnGhsuUV.js","./index-B4tExwG7.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-D9ZzDQZV.js","./index-DKIv7atk.js","./index-DXE47DZl.js","./keybindingService-DEgCutrm.js","./serverConfigStore-Kb5DJVFt.js","./GraphView-CVCdiww1.css","./UserSelectView-wxa07xPk.js","./BaseViewTemplate-Cz111_1A.js","./ServerStartView-BpH4TXPO.js","./ServerStartView-CJiwVDQY.css","./InstallView-CVZcZZXJ.js","./index-BNlqgrYT.js","./uvMirrors-B-HKMf6X.js","./InstallView-DbJ2cGfL.css","./WelcomeView-BrXELNIm.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-BUpntA4x.js","./NotSupportedView-RFx6eCkN.css","./DownloadGitView-DVXUne-M.js","./ManualConfigurationView-Cz0_f_T-.js","./ManualConfigurationView-CsirlNfV.css","./MetricsConsentView-B5NlgqrS.js","./DesktopStartView-FKlxS2Lt.js","./MaintenanceView-Df7CHNWW.js","./index-BapOFhAR.js","./MaintenanceView-Bj5_Vr6o.css","./KeybindingPanel-CeHhC2F4.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-iPOrhDVM.js","./ServerConfigPanel-B1lI5M9c.js","./index-BYzwFNH3.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); var __defProp2 = Object.defineProperty; var __name = (target2, value4) => __defProp2(target2, "name", { value: value4, configurable: true }); (/* @__PURE__ */ __name(function polyfill2() { @@ -73523,7 +73523,7 @@ const router = createRouter({ { path: "", name: "GraphView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./GraphView-CUSGEqGS.js"), true ? __vite__mapDeps([0,1,2,3,4,5]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./GraphView-D9ZzDQZV.js"), true ? __vite__mapDeps([0,1,2,3,4,5]) : void 0, import.meta.url), "component"), beforeEnter: /* @__PURE__ */ __name(async (to, from2, next2) => { const userStore = useUserStore(); await userStore.initialize(); @@ -73537,60 +73537,60 @@ const router = createRouter({ { path: "user-select", name: "UserSelectView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./UserSelectView-DeJDnrF0.js"), true ? __vite__mapDeps([6,7]) : void 0, import.meta.url), "component") + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./UserSelectView-wxa07xPk.js"), true ? __vite__mapDeps([6,7]) : void 0, import.meta.url), "component") }, { path: "server-start", name: "ServerStartView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ServerStartView-yzYZ8gms.js"), true ? __vite__mapDeps([8,7,9]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ServerStartView-BpH4TXPO.js"), true ? __vite__mapDeps([8,7,9]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "install", name: "InstallView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./InstallView-DTDlVr0Z.js"), true ? __vite__mapDeps([10,11,12,7,13]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./InstallView-CVZcZZXJ.js"), true ? __vite__mapDeps([10,11,12,7,13]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "welcome", name: "WelcomeView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./WelcomeView-DkwLdayn.js"), true ? __vite__mapDeps([14,7,15]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./WelcomeView-BrXELNIm.js"), true ? __vite__mapDeps([14,7,15]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "not-supported", name: "NotSupportedView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./NotSupportedView-PDDrAb9U.js"), true ? __vite__mapDeps([16,7,17]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./NotSupportedView-BUpntA4x.js"), true ? __vite__mapDeps([16,7,17]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "download-git", name: "DownloadGitView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DownloadGitView-3STu4yxt.js"), true ? __vite__mapDeps([18,7]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DownloadGitView-DVXUne-M.js"), true ? __vite__mapDeps([18,7]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "manual-configuration", name: "ManualConfigurationView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ManualConfigurationView-DueOvLuK.js"), true ? __vite__mapDeps([19,7,20]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ManualConfigurationView-Cz0_f_T-.js"), true ? __vite__mapDeps([19,7,20]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "/metrics-consent", name: "MetricsConsentView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MetricsConsentView-DTQYUF4Z.js"), true ? __vite__mapDeps([21,7]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MetricsConsentView-B5NlgqrS.js"), true ? __vite__mapDeps([21,7]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "desktop-start", name: "DesktopStartView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DesktopStartView-coDnSXEF.js"), true ? __vite__mapDeps([22,7]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DesktopStartView-FKlxS2Lt.js"), true ? __vite__mapDeps([22,7]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "maintenance", name: "MaintenanceView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MaintenanceView-B5Gl0Rrl.js"), true ? __vite__mapDeps([23,1,2,24,11,7,25]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MaintenanceView-Df7CHNWW.js"), true ? __vite__mapDeps([23,1,2,24,11,7,25]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess } ] @@ -85608,7 +85608,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({ }); const config$1 = { app_title: "ComfyUI", - app_version: "1.8.13" + app_version: "1.8.14" }; /*! * shared v9.13.1 @@ -153413,7 +153413,7 @@ const useSystemStatsStore = /* @__PURE__ */ defineStore("systemStats", () => { }; }); const useAboutPanelStore = /* @__PURE__ */ defineStore("aboutPanel", () => { - const frontendVersion = "1.8.13"; + const frontendVersion = "1.8.14"; const extensionStore = useExtensionStore(); const systemStatsStore = useSystemStatsStore(); const coreVersion = computed( @@ -158831,13 +158831,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({ setup(__props) { const props = __props; const KeybindingPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./KeybindingPanel-C0Nt6GXU.js"), true ? __vite__mapDeps([26,24,2,3,27]) : void 0, import.meta.url) + () => __vitePreload(() => import("./KeybindingPanel-CeHhC2F4.js"), true ? __vite__mapDeps([26,24,2,3,27]) : void 0, import.meta.url) ); const ExtensionPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./ExtensionPanel-GE0aOkbr.js"), true ? __vite__mapDeps([28,24,2]) : void 0, import.meta.url) + () => __vitePreload(() => import("./ExtensionPanel-iPOrhDVM.js"), true ? __vite__mapDeps([28,24,2]) : void 0, import.meta.url) ); const ServerConfigPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./ServerConfigPanel-DnGhsuUV.js"), true ? __vite__mapDeps([29,4]) : void 0, import.meta.url) + () => __vitePreload(() => import("./ServerConfigPanel-B1lI5M9c.js"), true ? __vite__mapDeps([29,4]) : void 0, import.meta.url) ); const aboutPanelNode = { key: "about", @@ -199422,7 +199422,7 @@ const useExtensionService = /* @__PURE__ */ __name(() => { settingStore.get("Comfy.Extension.Disabled") ); const extensions = await api.getExtensions(); - await __vitePreload(() => import("./index-B4tExwG7.js"), true ? __vite__mapDeps([30,12,31]) : void 0, import.meta.url); + await __vitePreload(() => import("./index-BYzwFNH3.js"), true ? __vite__mapDeps([30,12,31]) : void 0, import.meta.url); extensionStore.captureCoreExtensions(); await Promise.all( extensions.filter((extension) => !extension.includes("extensions/core")).map(async (ext) => { @@ -207745,7 +207745,7 @@ class ComfyApp { if (e2.target instanceof HTMLTextAreaElement && e2.target.type === "textarea" || e2.target instanceof HTMLInputElement && e2.target.type === "text") { return; } - const isTargetInGraph = e2.target.classList.contains("litegraph") || e2.target.classList.contains("graph-canvas-container"); + const isTargetInGraph = e2.target.classList.contains("litegraph") || e2.target.classList.contains("graph-canvas-container") || e2.target.id === "graph-canvas"; if (isTargetInGraph && this.canvas.selected_nodes) { this.canvas.copyToClipboard(); e2.clipboardData.setData("text", " "); @@ -219745,7 +219745,7 @@ init$3({ app, dsn: "https://e2d0c0bd392ffdce48e856c2a055f437@o4507954455314432.ingest.us.sentry.io/4508621568475136", enabled: true, - release: "1.8.13", + release: "1.8.14", integrations: [], autoSessionTracking: false, defaultIntegrations: false, @@ -220051,4 +220051,4 @@ export { createBlock as y, withCtx as z }; -//# sourceMappingURL=index-4Hb32CNk.js.map +//# sourceMappingURL=index-DqqhYDnY.js.map diff --git a/web/assets/keybindingService-BTNdTpfl.js b/web/assets/keybindingService-DEgCutrm.js similarity index 98% rename from web/assets/keybindingService-BTNdTpfl.js rename to web/assets/keybindingService-DEgCutrm.js index a9c8bd67d..91a668b79 100644 --- a/web/assets/keybindingService-BTNdTpfl.js +++ b/web/assets/keybindingService-DEgCutrm.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { an as useKeybindingStore, L as useCommandStore, a as useSettingStore, dp as KeyComboImpl, dq as KeybindingImpl } from "./index-4Hb32CNk.js"; +import { an as useKeybindingStore, L as useCommandStore, a as useSettingStore, dp as KeyComboImpl, dq as KeybindingImpl } from "./index-DqqhYDnY.js"; const CORE_KEYBINDINGS = [ { combo: { @@ -247,4 +247,4 @@ const useKeybindingService = /* @__PURE__ */ __name(() => { export { useKeybindingService as u }; -//# sourceMappingURL=keybindingService-BTNdTpfl.js.map +//# sourceMappingURL=keybindingService-DEgCutrm.js.map diff --git a/web/assets/serverConfigStore-BYbZcbWj.js b/web/assets/serverConfigStore-Kb5DJVFt.js similarity index 97% rename from web/assets/serverConfigStore-BYbZcbWj.js rename to web/assets/serverConfigStore-Kb5DJVFt.js index 2c876288d..c1ff0646c 100644 --- a/web/assets/serverConfigStore-BYbZcbWj.js +++ b/web/assets/serverConfigStore-Kb5DJVFt.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { I as defineStore, U as ref, c as computed } from "./index-4Hb32CNk.js"; +import { I as defineStore, U as ref, c as computed } from "./index-DqqhYDnY.js"; const useServerConfigStore = defineStore("serverConfig", () => { const serverConfigById = ref({}); const serverConfigs = computed(() => { @@ -87,4 +87,4 @@ const useServerConfigStore = defineStore("serverConfig", () => { export { useServerConfigStore as u }; -//# sourceMappingURL=serverConfigStore-BYbZcbWj.js.map +//# sourceMappingURL=serverConfigStore-Kb5DJVFt.js.map diff --git a/web/index.html b/web/index.html index b62467005..c14633534 100644 --- a/web/index.html +++ b/web/index.html @@ -6,7 +6,7 @@ - + From b6951768c41fa69a870c022a3adbc349fc4f2ac1 Mon Sep 17 00:00:00 2001 From: Raphael Walker Date: Thu, 6 Feb 2025 22:51:16 +0100 Subject: [PATCH 082/478] fix a bug in the attn_masked redux code when using weight=1.0 (#6721) --- nodes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index ba9c4e4bb..9779d5fdb 100644 --- a/nodes.py +++ b/nodes.py @@ -1064,7 +1064,8 @@ class StyleModelApply: for t in conditioning: (txt, keys) = t keys = keys.copy() - if strength_type == "attn_bias" and strength != 1.0: + # even if the strength is 1.0 (i.e, no change), if there's already a mask, we have to add to it + if strength_type == "attn_bias" and strength != 1.0 and "attention_mask" not in keys: # math.log raises an error if the argument is zero # torch.log returns -inf, which is what we want attn_bias = torch.log(torch.Tensor([strength])) From 079eccc92a82b16727f9ff88da613e8b1f078eae Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 7 Feb 2025 03:29:12 -0500 Subject: [PATCH 083/478] Don't compress http response by default. Remove argument to disable it. Add new --enable-compress-response-body argument to enable it. --- comfy/cli_args.py | 2 +- server.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index a92fc0dba..ec8f92e8a 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -179,7 +179,7 @@ parser.add_argument( parser.add_argument("--user-directory", type=is_valid_directory, default=None, help="Set the ComfyUI user directory with an absolute path. Overrides --base-directory.") -parser.add_argument("--disable-compres-response-body", action="store_true", help="Disable compressing response body.") +parser.add_argument("--enable-compress-response-body", action="store_true", help="Enable compressing response body.") if comfy.options.args_parsing: args = parser.parse_args() diff --git a/server.py b/server.py index 7b8608479..1a79da7e2 100644 --- a/server.py +++ b/server.py @@ -57,8 +57,6 @@ async def cache_control(request: web.Request, handler): async def compress_body(request: web.Request, handler): accept_encoding = request.headers.get("Accept-Encoding", "") response: web.Response = await handler(request) - if args.disable_compres_response_body: - return response if not isinstance(response, web.Response): return response if response.content_type not in ["application/json", "text/plain"]: @@ -165,7 +163,10 @@ class PromptServer(): self.client_session:Optional[aiohttp.ClientSession] = None self.number = 0 - middlewares = [cache_control, compress_body] + middlewares = [cache_control] + if args.enable_compress_response_body: + middlewares.append(compress_body) + if args.enable_cors_header: middlewares.append(create_cors_middleware(args.enable_cors_header)) else: From 832e3f5ca3c357e527fdf811502357bd2798425e Mon Sep 17 00:00:00 2001 From: Raphael Walker Date: Fri, 7 Feb 2025 20:44:43 +0100 Subject: [PATCH 084/478] Fix another small bug in attention_bias redux (#6737) * fix a bug in the attn_masked redux code when using weight=1.0 * oh shit wait there was another bug --- nodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nodes.py b/nodes.py index 9779d5fdb..1d2b1f9ff 100644 --- a/nodes.py +++ b/nodes.py @@ -1065,10 +1065,10 @@ class StyleModelApply: (txt, keys) = t keys = keys.copy() # even if the strength is 1.0 (i.e, no change), if there's already a mask, we have to add to it - if strength_type == "attn_bias" and strength != 1.0 and "attention_mask" not in keys: + if "attention_mask" in keys or (strength_type == "attn_bias" and strength != 1.0): # math.log raises an error if the argument is zero # torch.log returns -inf, which is what we want - attn_bias = torch.log(torch.Tensor([strength])) + attn_bias = torch.log(torch.Tensor([strength if strength_type == "attn_bias" else 1.0])) # get the size of the mask image mask_ref_size = keys.get("attention_mask_img_shape", (1, 1)) n_ref = mask_ref_size[0] * mask_ref_size[1] From af93c8d1ee4be91f30ffd395ea6919e6f83923aa Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 8 Feb 2025 06:54:03 -0500 Subject: [PATCH 085/478] Document which text encoder to use for lumina 2. --- nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index 1d2b1f9ff..7defb60b7 100644 --- a/nodes.py +++ b/nodes.py @@ -924,7 +924,7 @@ class CLIPLoader: CATEGORY = "advanced/loaders" - DESCRIPTION = "[Recipes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5\ncosmos: old t5 xxl" + DESCRIPTION = "[Recipes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5\ncosmos: old t5 xxl\nlumina2: gemma 2 2B" def load_clip(self, clip_name, type="stable_diffusion", device="default"): if type == "stable_cascade": From 43a74c0de175933782e255e1d0443c413af7c6f3 Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Sat, 8 Feb 2025 17:00:56 -0500 Subject: [PATCH 086/478] Allow FP16 accumulation with `--fast` (#6453) Currently only applies to PyTorch nightly releases. (>=20250208) --- comfy/model_management.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/comfy/model_management.py b/comfy/model_management.py index 225a83e05..ca84f2064 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -241,6 +241,12 @@ if ENABLE_PYTORCH_ATTENTION: torch.backends.cuda.enable_flash_sdp(True) torch.backends.cuda.enable_mem_efficient_sdp(True) +try: + if is_nvidia() and args.fast: + torch.backends.cuda.matmul.allow_fp16_accumulation = True +except: + pass + try: if int(torch_version[0]) == 2 and int(torch_version[2]) >= 5: torch.backends.cuda.allow_fp16_bf16_reduction_math_sdp(True) From 3d06e1c5559daecac08b3c88fc5d080da96d54a3 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 8 Feb 2025 18:57:24 -0500 Subject: [PATCH 087/478] Make error more clear to user. --- comfy/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/utils.py b/comfy/utils.py index c901347c4..df7057c6a 100644 --- a/comfy/utils.py +++ b/comfy/utils.py @@ -58,7 +58,7 @@ def load_torch_file(ckpt, safe_load=False, device=None): if "HeaderTooLarge" in message: raise ValueError("{}\n\nFile path: {}\n\nThe safetensors file is corrupt or invalid. Make sure this is actually a safetensors file and not a ckpt or pt or other filetype.".format(message, ckpt)) if "MetadataIncompleteBuffer" in message: - raise ValueError("{}\n\nFile path: {}\n\nThe safetensors file is incomplete. Check the file size and make sure you have copied/downloaded it correctly.".format(message, ckpt)) + raise ValueError("{}\n\nFile path: {}\n\nThe safetensors file is corrupt/incomplete. Check the file size and make sure you have copied/downloaded it correctly.".format(message, ckpt)) raise e else: if safe_load or ALWAYS_SAFE_LOAD: From caeb27c3a545d44b9564156220e75fd0532ae3f3 Mon Sep 17 00:00:00 2001 From: Pam <42671363+pamparamm@users.noreply.github.com> Date: Sun, 9 Feb 2025 05:39:58 +0500 Subject: [PATCH 088/478] res_multistep: Fix cfgpp and add ancestral samplers (#6731) --- comfy/k_diffusion/sampling.py | 61 +++++++++++++++++++---------------- comfy/samplers.py | 3 +- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index 2c0d18320..456679989 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -1267,7 +1267,7 @@ def sample_dpmpp_2m_cfg_pp(model, x, sigmas, extra_args=None, callback=None, dis return x @torch.no_grad() -def res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1., noise_sampler=None, cfg_pp=False): +def res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None, s_noise=1., noise_sampler=None, eta=1., cfg_pp=False): extra_args = {} if extra_args is None else extra_args seed = extra_args.get("seed", None) noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler @@ -1289,53 +1289,60 @@ def res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None extra_args["model_options"] = comfy.model_patcher.set_model_options_post_cfg_function(model_options, post_cfg_function, disable_cfg1_optimization=True) for i in trange(len(sigmas) - 1, disable=disable): - if s_churn > 0: - gamma = min(s_churn / (len(sigmas) - 1), 2**0.5 - 1) if s_tmin <= sigmas[i] <= s_tmax else 0.0 - sigma_hat = sigmas[i] * (gamma + 1) - else: - gamma = 0 - sigma_hat = sigmas[i] - - if gamma > 0: - eps = torch.randn_like(x) * s_noise - x = x + eps * (sigma_hat**2 - sigmas[i] ** 2) ** 0.5 - denoised = model(x, sigma_hat * s_in, **extra_args) + denoised = model(x, sigmas[i] * s_in, **extra_args) + sigma_down, sigma_up = get_ancestral_step(sigmas[i], sigmas[i + 1], eta=eta) if callback is not None: - callback({"x": x, "i": i, "sigma": sigmas[i], "sigma_hat": sigma_hat, "denoised": denoised}) - if sigmas[i + 1] == 0 or old_denoised is None: + callback({"x": x, "i": i, "sigma": sigmas[i], "sigma_hat": sigmas[i], "denoised": denoised}) + if sigma_down == 0 or old_denoised is None: # Euler method if cfg_pp: - d = to_d(x, sigma_hat, uncond_denoised) - x = denoised + d * sigmas[i + 1] + d = to_d(x, sigmas[i], uncond_denoised) + x = denoised + d * sigma_down else: - d = to_d(x, sigma_hat, denoised) - dt = sigmas[i + 1] - sigma_hat + d = to_d(x, sigmas[i], denoised) + dt = sigma_down - sigmas[i] x = x + d * dt else: # Second order multistep method in https://arxiv.org/pdf/2308.02157 - t, t_next, t_prev = t_fn(sigmas[i]), t_fn(sigmas[i + 1]), t_fn(sigmas[i - 1]) + t, t_next, t_prev = t_fn(sigmas[i]), t_fn(sigma_down), t_fn(sigmas[i - 1]) h = t_next - t c2 = (t_prev - t) / h phi1_val, phi2_val = phi1_fn(-h), phi2_fn(-h) - b1 = torch.nan_to_num(phi1_val - 1.0 / c2 * phi2_val, nan=0.0) - b2 = torch.nan_to_num(1.0 / c2 * phi2_val, nan=0.0) + b1 = torch.nan_to_num(phi1_val - phi2_val / c2, nan=0.0) + b2 = torch.nan_to_num(phi2_val / c2, nan=0.0) if cfg_pp: x = x + (denoised - uncond_denoised) + x = sigma_fn(h) * x + h * (b1 * uncond_denoised + b2 * old_denoised) + else: + x = sigma_fn(h) * x + h * (b1 * denoised + b2 * old_denoised) - x = (sigma_fn(t_next) / sigma_fn(t)) * x + h * (b1 * denoised + b2 * old_denoised) + # Noise addition + if sigmas[i + 1] > 0: + x = x + noise_sampler(sigmas[i], sigmas[i + 1]) * s_noise * sigma_up - old_denoised = denoised + if cfg_pp: + old_denoised = uncond_denoised + else: + old_denoised = denoised return x @torch.no_grad() -def sample_res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1., noise_sampler=None): - return res_multistep(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, s_churn=s_churn, s_tmin=s_tmin, s_tmax=s_tmax, s_noise=s_noise, noise_sampler=noise_sampler, cfg_pp=False) +def sample_res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None, s_noise=1., noise_sampler=None): + return res_multistep(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, s_noise=s_noise, noise_sampler=noise_sampler, eta=0., cfg_pp=False) @torch.no_grad() -def sample_res_multistep_cfg_pp(model, x, sigmas, extra_args=None, callback=None, disable=None, s_churn=0., s_tmin=0., s_tmax=float('inf'), s_noise=1., noise_sampler=None): - return res_multistep(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, s_churn=s_churn, s_tmin=s_tmin, s_tmax=s_tmax, s_noise=s_noise, noise_sampler=noise_sampler, cfg_pp=True) +def sample_res_multistep_cfg_pp(model, x, sigmas, extra_args=None, callback=None, disable=None, s_noise=1., noise_sampler=None): + return res_multistep(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, s_noise=s_noise, noise_sampler=noise_sampler, eta=0., cfg_pp=True) + +@torch.no_grad() +def sample_res_multistep_ancestral(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None): + return res_multistep(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, s_noise=s_noise, noise_sampler=noise_sampler, eta=eta, cfg_pp=False) + +@torch.no_grad() +def sample_res_multistep_ancestral_cfg_pp(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None): + return res_multistep(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, s_noise=s_noise, noise_sampler=noise_sampler, eta=eta, cfg_pp=True) @torch.no_grad() def sample_gradient_estimation(model, x, sigmas, extra_args=None, callback=None, disable=None, ge_gamma=2.): diff --git a/comfy/samplers.py b/comfy/samplers.py index 3b66091ef..a1b4787ef 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -686,7 +686,8 @@ class Sampler: KSAMPLER_NAMES = ["euler", "euler_cfg_pp", "euler_ancestral", "euler_ancestral_cfg_pp", "heun", "heunpp2","dpm_2", "dpm_2_ancestral", "lms", "dpm_fast", "dpm_adaptive", "dpmpp_2s_ancestral", "dpmpp_2s_ancestral_cfg_pp", "dpmpp_sde", "dpmpp_sde_gpu", "dpmpp_2m", "dpmpp_2m_cfg_pp", "dpmpp_2m_sde", "dpmpp_2m_sde_gpu", "dpmpp_3m_sde", "dpmpp_3m_sde_gpu", "ddpm", "lcm", - "ipndm", "ipndm_v", "deis", "res_multistep", "res_multistep_cfg_pp", "gradient_estimation"] + "ipndm", "ipndm_v", "deis", "res_multistep", "res_multistep_cfg_pp", "res_multistep_ancestral", "res_multistep_ancestral_cfg_pp", + "gradient_estimation"] class KSAMPLER(Sampler): def __init__(self, sampler_function, extra_options={}, inpaint_options={}): From 095d8671476ebb7834d326ac31127cd5f3e27303 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 9 Feb 2025 07:01:38 -0500 Subject: [PATCH 089/478] Remove useless function. --- comfy/model_base.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index 4d1b83a4a..98f462b32 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -166,9 +166,6 @@ class BaseModel(torch.nn.Module): def get_dtype(self): return self.diffusion_model.dtype - def is_adm(self): - return self.adm_channels > 0 - def encode_adm(self, **kwargs): return None From 4027466c802d174d76347726d74de73c39acedb3 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 10 Feb 2025 00:24:20 -0500 Subject: [PATCH 090/478] Make lumina model work with any latent resolution. --- comfy/ldm/lumina/model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/comfy/ldm/lumina/model.py b/comfy/ldm/lumina/model.py index 3292bd2f0..ccd5d2c0e 100644 --- a/comfy/ldm/lumina/model.py +++ b/comfy/ldm/lumina/model.py @@ -6,6 +6,7 @@ from typing import List, Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F +import comfy.ldm.common_dit from comfy.ldm.modules.diffusionmodules.mmdit import TimestepEmbedder, RMSNorm from comfy.ldm.modules.attention import optimized_attention_masked @@ -594,6 +595,8 @@ class NextDiT(nn.Module): t = 1.0 - timesteps cap_feats = context cap_mask = attention_mask + bs, c, h, w = x.shape + x = comfy.ldm.common_dit.pad_to_patch_size(x, (self.patch_size, self.patch_size)) """ Forward pass of NextDiT. t: (N,) tensor of diffusion timesteps @@ -613,7 +616,7 @@ class NextDiT(nn.Module): x = layer(x, mask, freqs_cis, adaln_input) x = self.final_layer(x, adaln_input) - x = self.unpatchify(x, img_size, cap_size, return_tensor=x_is_tensor) + x = self.unpatchify(x, img_size, cap_size, return_tensor=x_is_tensor)[:,:,:h,:w] return -x From e57d2282d1e3a3e84b6c0a54a7a440e692ef432d Mon Sep 17 00:00:00 2001 From: bananasss00 Date: Tue, 11 Feb 2025 12:48:35 +0300 Subject: [PATCH 091/478] Fix incorrect Content-Type for WebP images (#6752) --- server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 1a79da7e2..76a99167d 100644 --- a/server.py +++ b/server.py @@ -150,7 +150,8 @@ class PromptServer(): PromptServer.instance = self mimetypes.init() - mimetypes.types_map['.js'] = 'application/javascript; charset=utf-8' + mimetypes.add_type('application/javascript; charset=utf-8', '.js') + mimetypes.add_type('image/webp', '.webp') self.user_manager = UserManager() self.model_file_manager = ModelFileManager() From af4b7c91be3402bec9d3538d1eb034895e5f6d3f Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 11 Feb 2025 08:31:46 -0500 Subject: [PATCH 092/478] Make --force-fp16 actually force the diffusion model to be fp16. --- comfy/cli_args.py | 3 +++ comfy/model_management.py | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index ec8f92e8a..a906ff1c0 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -191,3 +191,6 @@ if args.windows_standalone_build: if args.disable_auto_launch: args.auto_launch = False + +if args.force_fp16: + args.fp16_unet = True diff --git a/comfy/model_management.py b/comfy/model_management.py index ca84f2064..28083fbf9 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -262,15 +262,10 @@ elif args.highvram or args.gpu_only: vram_state = VRAMState.HIGH_VRAM FORCE_FP32 = False -FORCE_FP16 = False if args.force_fp32: logging.info("Forcing FP32, if this improves things please report it.") FORCE_FP32 = True -if args.force_fp16: - logging.info("Forcing FP16.") - FORCE_FP16 = True - if lowvram_available: if set_vram_to in (VRAMState.LOW_VRAM, VRAMState.NO_VRAM): vram_state = set_vram_to @@ -1003,7 +998,7 @@ def should_use_fp16(device=None, model_params=0, prioritize_performance=True, ma if is_device_cpu(device): return False - if FORCE_FP16: + if args.force_fp16: return True if FORCE_FP32: From b1242568178c922c3417938be5a3259d1c395da1 Mon Sep 17 00:00:00 2001 From: HishamC <140008308+hisham-hchowdhu@users.noreply.github.com> Date: Tue, 11 Feb 2025 14:11:32 -0800 Subject: [PATCH 093/478] Fix for running via DirectML (#6542) * Fix for running via DirectML Fix DirectML empty image generation issue with Flux1. add CPU fallback for unsupported path. Verified the model works on AMD GPUs * fix formating * update casual mask calculation --- comfy/clip_model.py | 6 +++++- comfy/ldm/flux/math.py | 2 +- comfy/model_management.py | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/comfy/clip_model.py b/comfy/clip_model.py index c48576028..0163c6fe7 100644 --- a/comfy/clip_model.py +++ b/comfy/clip_model.py @@ -104,7 +104,11 @@ class CLIPTextModel_(torch.nn.Module): mask = 1.0 - attention_mask.to(x.dtype).reshape((attention_mask.shape[0], 1, -1, attention_mask.shape[-1])).expand(attention_mask.shape[0], 1, attention_mask.shape[-1], attention_mask.shape[-1]) mask = mask.masked_fill(mask.to(torch.bool), -torch.finfo(x.dtype).max) - causal_mask = torch.empty(x.shape[1], x.shape[1], dtype=x.dtype, device=x.device).fill_(-torch.finfo(x.dtype).max).triu_(1) + if comfy.model_management.is_directml_enabled(): + causal_mask = torch.full((x.shape[1], x.shape[1]), -torch.finfo(x.dtype).max, dtype=x.dtype, device=x.device).triu_(1) + else: + causal_mask = torch.empty(x.shape[1], x.shape[1], dtype=x.dtype, device=x.device).fill_(float("-inf")).triu_(1) + if mask is not None: mask += causal_mask else: diff --git a/comfy/ldm/flux/math.py b/comfy/ldm/flux/math.py index b5960ffd3..36b67931c 100644 --- a/comfy/ldm/flux/math.py +++ b/comfy/ldm/flux/math.py @@ -22,7 +22,7 @@ def attention(q: Tensor, k: Tensor, v: Tensor, pe: Tensor, mask=None) -> Tensor: def rope(pos: Tensor, dim: int, theta: int) -> Tensor: assert dim % 2 == 0 - if comfy.model_management.is_device_mps(pos.device) or comfy.model_management.is_intel_xpu(): + if comfy.model_management.is_device_mps(pos.device) or comfy.model_management.is_intel_xpu() or comfy.model_management.is_directml_enabled(): device = torch.device("cpu") else: device = pos.device diff --git a/comfy/model_management.py b/comfy/model_management.py index 28083fbf9..29cd43b51 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -991,6 +991,13 @@ def is_device_mps(device): def is_device_cuda(device): return is_device_type(device, 'cuda') +def is_directml_enabled(): + global directml_enabled + if directml_enabled: + return True + + return False + def should_use_fp16(device=None, model_params=0, prioritize_performance=True, manual_cast=False): global directml_enabled From d9f0fcdb0cdfd8f6fd0ec2ee14ea332bb87fd504 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 11 Feb 2025 17:17:03 -0500 Subject: [PATCH 094/478] Cleanup. --- comfy/clip_model.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/comfy/clip_model.py b/comfy/clip_model.py index 0163c6fe7..cf5b58b62 100644 --- a/comfy/clip_model.py +++ b/comfy/clip_model.py @@ -104,10 +104,7 @@ class CLIPTextModel_(torch.nn.Module): mask = 1.0 - attention_mask.to(x.dtype).reshape((attention_mask.shape[0], 1, -1, attention_mask.shape[-1])).expand(attention_mask.shape[0], 1, attention_mask.shape[-1], attention_mask.shape[-1]) mask = mask.masked_fill(mask.to(torch.bool), -torch.finfo(x.dtype).max) - if comfy.model_management.is_directml_enabled(): - causal_mask = torch.full((x.shape[1], x.shape[1]), -torch.finfo(x.dtype).max, dtype=x.dtype, device=x.device).triu_(1) - else: - causal_mask = torch.empty(x.shape[1], x.shape[1], dtype=x.dtype, device=x.device).fill_(float("-inf")).triu_(1) + causal_mask = torch.full((x.shape[1], x.shape[1]), -torch.finfo(x.dtype).max, dtype=x.dtype, device=x.device).triu_(1) if mask is not None: mask += causal_mask From ab888e1e0b8a7558081713241172d0a38f837e16 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 12 Feb 2025 05:49:00 -0500 Subject: [PATCH 095/478] Add add_weight_wrapper function to model patcher. Functions can now easily be added to wrap/modify model weights. --- comfy/model_patcher.py | 61 ++++++++++++++++++++++++++++++++++-------- comfy/ops.py | 33 ++++++++++++----------- 2 files changed, 67 insertions(+), 27 deletions(-) diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py index 0501f7b38..aee0164c5 100644 --- a/comfy/model_patcher.py +++ b/comfy/model_patcher.py @@ -96,8 +96,28 @@ def wipe_lowvram_weight(m): if hasattr(m, "prev_comfy_cast_weights"): m.comfy_cast_weights = m.prev_comfy_cast_weights del m.prev_comfy_cast_weights - m.weight_function = None - m.bias_function = None + + if hasattr(m, "weight_function"): + m.weight_function = [] + + if hasattr(m, "bias_function"): + m.bias_function = [] + +def move_weight_functions(m, device): + if device is None: + return 0 + + memory = 0 + if hasattr(m, "weight_function"): + for f in m.weight_function: + if hasattr(f, "move_to"): + memory += f.move_to(device=device) + + if hasattr(m, "bias_function"): + for f in m.bias_function: + if hasattr(f, "move_to"): + memory += f.move_to(device=device) + return memory class LowVramPatch: def __init__(self, key, patches): @@ -192,6 +212,7 @@ class ModelPatcher: self.backup = {} self.object_patches = {} self.object_patches_backup = {} + self.weight_wrapper_patches = {} self.model_options = {"transformer_options":{}} self.model_size() self.load_device = load_device @@ -250,6 +271,7 @@ class ModelPatcher: n.patches_uuid = self.patches_uuid n.object_patches = self.object_patches.copy() + n.weight_wrapper_patches = self.weight_wrapper_patches.copy() n.model_options = copy.deepcopy(self.model_options) n.backup = self.backup n.object_patches_backup = self.object_patches_backup @@ -402,6 +424,10 @@ class ModelPatcher: def add_object_patch(self, name, obj): self.object_patches[name] = obj + def add_weight_wrapper(self, name, function): + self.weight_wrapper_patches[name] = self.weight_wrapper_patches.get(name, []) + [function] + self.patches_uuid = uuid.uuid4() + def get_model_object(self, name: str) -> torch.nn.Module: """Retrieves a nested attribute from an object using dot notation considering object patches. @@ -566,6 +592,9 @@ class ModelPatcher: lowvram_weight = False + weight_key = "{}.weight".format(n) + bias_key = "{}.bias".format(n) + if not full_load and hasattr(m, "comfy_cast_weights"): if mem_counter + module_mem >= lowvram_model_memory: lowvram_weight = True @@ -573,34 +602,42 @@ class ModelPatcher: if hasattr(m, "prev_comfy_cast_weights"): #Already lowvramed continue - weight_key = "{}.weight".format(n) - bias_key = "{}.bias".format(n) - if lowvram_weight: + if hasattr(m, "comfy_cast_weights"): + m.weight_function = [] + m.bias_function = [] + if weight_key in self.patches: if force_patch_weights: self.patch_weight_to_device(weight_key) else: - m.weight_function = LowVramPatch(weight_key, self.patches) + m.weight_function = [LowVramPatch(weight_key, self.patches)] patch_counter += 1 if bias_key in self.patches: if force_patch_weights: self.patch_weight_to_device(bias_key) else: - m.bias_function = LowVramPatch(bias_key, self.patches) + m.bias_function = [LowVramPatch(bias_key, self.patches)] patch_counter += 1 m.prev_comfy_cast_weights = m.comfy_cast_weights m.comfy_cast_weights = True else: if hasattr(m, "comfy_cast_weights"): - if m.comfy_cast_weights: - wipe_lowvram_weight(m) + wipe_lowvram_weight(m) if full_load or mem_counter + module_mem < lowvram_model_memory: mem_counter += module_mem load_completely.append((module_mem, n, m, params)) + if weight_key in self.weight_wrapper_patches: + m.weight_function.extend(self.weight_wrapper_patches[weight_key]) + + if bias_key in self.weight_wrapper_patches: + m.bias_function.extend(self.weight_wrapper_patches[bias_key]) + + mem_counter += move_weight_functions(m, device_to) + load_completely.sort(reverse=True) for x in load_completely: n = x[1] @@ -662,6 +699,7 @@ class ModelPatcher: self.unpatch_hooks() if self.model.model_lowvram: for m in self.model.modules(): + move_weight_functions(m, device_to) wipe_lowvram_weight(m) self.model.model_lowvram = False @@ -729,12 +767,13 @@ class ModelPatcher: bias_key = "{}.bias".format(n) if move_weight: m.to(device_to) + module_mem += move_weight_functions(m, device_to) if lowvram_possible: if weight_key in self.patches: - m.weight_function = LowVramPatch(weight_key, self.patches) + m.weight_function.append(LowVramPatch(weight_key, self.patches)) patch_counter += 1 if bias_key in self.patches: - m.bias_function = LowVramPatch(bias_key, self.patches) + m.bias_function.append(LowVramPatch(bias_key, self.patches)) patch_counter += 1 m.prev_comfy_cast_weights = m.comfy_cast_weights diff --git a/comfy/ops.py b/comfy/ops.py index 06be6b48b..30014477e 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -38,21 +38,23 @@ def cast_bias_weight(s, input=None, dtype=None, device=None, bias_dtype=None): bias = None non_blocking = comfy.model_management.device_supports_non_blocking(device) if s.bias is not None: - has_function = s.bias_function is not None + has_function = len(s.bias_function) > 0 bias = comfy.model_management.cast_to(s.bias, bias_dtype, device, non_blocking=non_blocking, copy=has_function) if has_function: - bias = s.bias_function(bias) + for f in s.bias_function: + bias = f(bias) - has_function = s.weight_function is not None + has_function = len(s.weight_function) > 0 weight = comfy.model_management.cast_to(s.weight, dtype, device, non_blocking=non_blocking, copy=has_function) if has_function: - weight = s.weight_function(weight) + for f in s.weight_function: + weight = f(weight) return weight, bias class CastWeightBiasOp: comfy_cast_weights = False - weight_function = None - bias_function = None + weight_function = [] + bias_function = [] class disable_weight_init: class Linear(torch.nn.Linear, CastWeightBiasOp): @@ -64,7 +66,7 @@ class disable_weight_init: return torch.nn.functional.linear(input, weight, bias) def forward(self, *args, **kwargs): - if self.comfy_cast_weights: + if self.comfy_cast_weights or len(self.weight_function) > 0 or len(self.bias_function) > 0: return self.forward_comfy_cast_weights(*args, **kwargs) else: return super().forward(*args, **kwargs) @@ -78,7 +80,7 @@ class disable_weight_init: return self._conv_forward(input, weight, bias) def forward(self, *args, **kwargs): - if self.comfy_cast_weights: + if self.comfy_cast_weights or len(self.weight_function) > 0 or len(self.bias_function) > 0: return self.forward_comfy_cast_weights(*args, **kwargs) else: return super().forward(*args, **kwargs) @@ -92,7 +94,7 @@ class disable_weight_init: return self._conv_forward(input, weight, bias) def forward(self, *args, **kwargs): - if self.comfy_cast_weights: + if self.comfy_cast_weights or len(self.weight_function) > 0 or len(self.bias_function) > 0: return self.forward_comfy_cast_weights(*args, **kwargs) else: return super().forward(*args, **kwargs) @@ -106,7 +108,7 @@ class disable_weight_init: return self._conv_forward(input, weight, bias) def forward(self, *args, **kwargs): - if self.comfy_cast_weights: + if self.comfy_cast_weights or len(self.weight_function) > 0 or len(self.bias_function) > 0: return self.forward_comfy_cast_weights(*args, **kwargs) else: return super().forward(*args, **kwargs) @@ -120,12 +122,11 @@ class disable_weight_init: return torch.nn.functional.group_norm(input, self.num_groups, weight, bias, self.eps) def forward(self, *args, **kwargs): - if self.comfy_cast_weights: + if self.comfy_cast_weights or len(self.weight_function) > 0 or len(self.bias_function) > 0: return self.forward_comfy_cast_weights(*args, **kwargs) else: return super().forward(*args, **kwargs) - class LayerNorm(torch.nn.LayerNorm, CastWeightBiasOp): def reset_parameters(self): return None @@ -139,7 +140,7 @@ class disable_weight_init: return torch.nn.functional.layer_norm(input, self.normalized_shape, weight, bias, self.eps) def forward(self, *args, **kwargs): - if self.comfy_cast_weights: + if self.comfy_cast_weights or len(self.weight_function) > 0 or len(self.bias_function) > 0: return self.forward_comfy_cast_weights(*args, **kwargs) else: return super().forward(*args, **kwargs) @@ -160,7 +161,7 @@ class disable_weight_init: output_padding, self.groups, self.dilation) def forward(self, *args, **kwargs): - if self.comfy_cast_weights: + if self.comfy_cast_weights or len(self.weight_function) > 0 or len(self.bias_function) > 0: return self.forward_comfy_cast_weights(*args, **kwargs) else: return super().forward(*args, **kwargs) @@ -181,7 +182,7 @@ class disable_weight_init: output_padding, self.groups, self.dilation) def forward(self, *args, **kwargs): - if self.comfy_cast_weights: + if self.comfy_cast_weights or len(self.weight_function) > 0 or len(self.bias_function) > 0: return self.forward_comfy_cast_weights(*args, **kwargs) else: return super().forward(*args, **kwargs) @@ -199,7 +200,7 @@ class disable_weight_init: return torch.nn.functional.embedding(input, weight, self.padding_idx, self.max_norm, self.norm_type, self.scale_grad_by_freq, self.sparse).to(dtype=output_dtype) def forward(self, *args, **kwargs): - if self.comfy_cast_weights: + if self.comfy_cast_weights or len(self.weight_function) > 0 or len(self.bias_function) > 0: return self.forward_comfy_cast_weights(*args, **kwargs) else: if "out_dtype" in kwargs: From 35740259de2798cf55098c231b7dab19f15e14da Mon Sep 17 00:00:00 2001 From: zhoufan2956 <78578838+zhoufan2956@users.noreply.github.com> Date: Wed, 12 Feb 2025 19:48:11 +0800 Subject: [PATCH 096/478] mix_ascend_bf16_infer_err (#6794) --- comfy/model_management.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/comfy/model_management.py b/comfy/model_management.py index 29cd43b51..cbf4c4ea6 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -1082,6 +1082,9 @@ def should_use_bf16(device=None, model_params=0, prioritize_performance=True, ma if is_intel_xpu(): return True + + if is_ascend_npu(): + return True props = torch.cuda.get_device_properties(device) if props.major >= 8: From 1d5d6586f300fa54802682802020aafb61bd31a3 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 12 Feb 2025 06:49:16 -0500 Subject: [PATCH 097/478] Fix ruff. --- comfy/model_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index cbf4c4ea6..f3d90c668 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -1082,7 +1082,7 @@ def should_use_bf16(device=None, model_params=0, prioritize_performance=True, ma if is_intel_xpu(): return True - + if is_ascend_npu(): return True From 8773ccf74d189c21916f2a025df04f7a26a446a8 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 13 Feb 2025 08:32:36 -0500 Subject: [PATCH 098/478] Better memory estimation for ROCm that support mem efficient attention. There is no way to check if the card actually supports it so it assumes that it does if you use --use-pytorch-cross-attention with yours. --- comfy/model_management.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/comfy/model_management.py b/comfy/model_management.py index f3d90c668..212ce9af2 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -909,6 +909,8 @@ def pytorch_attention_flash_attention(): return True if is_ascend_npu(): return True + if is_amd(): + return True #if you have pytorch attention enabled on AMD it probably supports at least mem efficient attention return False def mac_version(): From 019c7029ea324517ab88d7e61e79b739bc8f4e91 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 13 Feb 2025 20:34:03 -0500 Subject: [PATCH 099/478] Add a way to set a different compute dtype for the model at runtime. Currently only works for diffusion models. --- comfy/model_patcher.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py index aee0164c5..4dbe1b7aa 100644 --- a/comfy/model_patcher.py +++ b/comfy/model_patcher.py @@ -218,6 +218,7 @@ class ModelPatcher: self.load_device = load_device self.offload_device = offload_device self.weight_inplace_update = weight_inplace_update + self.force_cast_weights = False self.patches_uuid = uuid.uuid4() self.parent = None @@ -277,6 +278,8 @@ class ModelPatcher: n.object_patches_backup = self.object_patches_backup n.parent = self + n.force_cast_weights = self.force_cast_weights + # attachments n.attachments = {} for k in self.attachments: @@ -424,6 +427,12 @@ class ModelPatcher: def add_object_patch(self, name, obj): self.object_patches[name] = obj + def set_model_compute_dtype(self, dtype): + self.add_object_patch("manual_cast_dtype", dtype) + if dtype is not None: + self.force_cast_weights = True + self.patches_uuid = uuid.uuid4() #TODO: optimize by preventing a full model reload for this + def add_weight_wrapper(self, name, function): self.weight_wrapper_patches[name] = self.weight_wrapper_patches.get(name, []) + [function] self.patches_uuid = uuid.uuid4() @@ -602,6 +611,7 @@ class ModelPatcher: if hasattr(m, "prev_comfy_cast_weights"): #Already lowvramed continue + cast_weight = self.force_cast_weights if lowvram_weight: if hasattr(m, "comfy_cast_weights"): m.weight_function = [] @@ -620,8 +630,7 @@ class ModelPatcher: m.bias_function = [LowVramPatch(bias_key, self.patches)] patch_counter += 1 - m.prev_comfy_cast_weights = m.comfy_cast_weights - m.comfy_cast_weights = True + cast_weight = True else: if hasattr(m, "comfy_cast_weights"): wipe_lowvram_weight(m) @@ -630,6 +639,10 @@ class ModelPatcher: mem_counter += module_mem load_completely.append((module_mem, n, m, params)) + if cast_weight: + m.prev_comfy_cast_weights = m.comfy_cast_weights + m.comfy_cast_weights = True + if weight_key in self.weight_wrapper_patches: m.weight_function.extend(self.weight_wrapper_patches[weight_key]) @@ -766,6 +779,7 @@ class ModelPatcher: weight_key = "{}.weight".format(n) bias_key = "{}.bias".format(n) if move_weight: + cast_weight = self.force_cast_weights m.to(device_to) module_mem += move_weight_functions(m, device_to) if lowvram_possible: @@ -775,7 +789,9 @@ class ModelPatcher: if bias_key in self.patches: m.bias_function.append(LowVramPatch(bias_key, self.patches)) patch_counter += 1 + cast_weight = True + if cast_weight: m.prev_comfy_cast_weights = m.comfy_cast_weights m.comfy_cast_weights = True m.comfy_patched_weights = False From 042a905c3791e466327764b79748cf26738a4c26 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Thu, 13 Feb 2025 17:39:04 -0800 Subject: [PATCH 100/478] Open yaml files with utf-8 encoding for extra_model_paths.yaml (#6807) * Using utf-8 encoding for yaml files. * Fix test assertion. --- tests-unit/utils/extra_config_test.py | 2 +- utils/extra_config.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests-unit/utils/extra_config_test.py b/tests-unit/utils/extra_config_test.py index b23f5bd08..6d232079e 100644 --- a/tests-unit/utils/extra_config_test.py +++ b/tests-unit/utils/extra_config_test.py @@ -114,7 +114,7 @@ def test_load_extra_model_paths_expands_userpath( mock_yaml_safe_load.assert_called_once() # Check if open was called with the correct file path - mock_file.assert_called_once_with(dummy_yaml_file_name, 'r') + mock_file.assert_called_once_with(dummy_yaml_file_name, 'r', encoding='utf-8') @patch('builtins.open', new_callable=mock_open) diff --git a/utils/extra_config.py b/utils/extra_config.py index d7b592855..b7196e36f 100644 --- a/utils/extra_config.py +++ b/utils/extra_config.py @@ -4,7 +4,7 @@ import folder_paths import logging def load_extra_path_config(yaml_path): - with open(yaml_path, 'r') as stream: + with open(yaml_path, 'r', encoding='utf-8') as stream: config = yaml.safe_load(stream) yaml_dir = os.path.dirname(os.path.abspath(yaml_path)) for c in config: From d7b4bf21a2decf2cbbd6fd8b128c37d8fada15d6 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 14 Feb 2025 04:17:56 -0500 Subject: [PATCH 101/478] Auto enable mem efficient attention on gfx1100 on pytorch nightly 2.7 I'm not not sure which arches are supported yet. If you see improvements in memory usage while using --use-pytorch-cross-attention on your AMD GPU let me know and I will add it to the list. --- comfy/model_management.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/comfy/model_management.py b/comfy/model_management.py index 212ce9af2..dd8a2a28f 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -236,6 +236,19 @@ try: except: pass + +try: + if is_amd(): + arch = torch.cuda.get_device_properties(get_torch_device()).gcnArchName + logging.info("AMD arch: {}".format(arch)) + if args.use_split_cross_attention == False and args.use_quad_cross_attention == False: + if int(torch_version[0]) >= 2 and int(torch_version[2]) >= 7: # works on 2.6 but doesn't actually seem to improve much + if arch in ["gfx1100"]: #TODO: more arches + ENABLE_PYTORCH_ATTENTION = True +except: + pass + + if ENABLE_PYTORCH_ATTENTION: torch.backends.cuda.enable_math_sdp(True) torch.backends.cuda.enable_flash_sdp(True) From 1cd6cd608086a8ff8789b747b8d4f8b9273e576e Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 14 Feb 2025 05:42:14 -0500 Subject: [PATCH 102/478] Disable pytorch attention in VAE for AMD. --- comfy/ldm/modules/diffusionmodules/model.py | 2 +- comfy/model_management.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/comfy/ldm/modules/diffusionmodules/model.py b/comfy/ldm/modules/diffusionmodules/model.py index 3bf83a7e2..8162742cf 100644 --- a/comfy/ldm/modules/diffusionmodules/model.py +++ b/comfy/ldm/modules/diffusionmodules/model.py @@ -297,7 +297,7 @@ def vae_attention(): if model_management.xformers_enabled_vae(): logging.info("Using xformers attention in VAE") return xformers_attention - elif model_management.pytorch_attention_enabled(): + elif model_management.pytorch_attention_enabled_vae(): logging.info("Using pytorch attention in VAE") return pytorch_attention else: diff --git a/comfy/model_management.py b/comfy/model_management.py index dd8a2a28f..fb924f432 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -912,6 +912,11 @@ def pytorch_attention_enabled(): global ENABLE_PYTORCH_ATTENTION return ENABLE_PYTORCH_ATTENTION +def pytorch_attention_enabled_vae(): + if is_amd(): + return False # enabling pytorch attention on AMD currently causes crash when doing high res + return pytorch_attention_enabled() + def pytorch_attention_flash_attention(): global ENABLE_PYTORCH_ATTENTION if ENABLE_PYTORCH_ATTENTION: From 2e21122aab0a73b4d7006b4b0ead93291efd7fec Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 15 Feb 2025 04:15:37 -0500 Subject: [PATCH 103/478] Add a node to set the model compute dtype for debugging. --- comfy_extras/nodes_model_advanced.py | 21 +++++++++++++++++++++ node_helpers.py | 9 +++++++++ 2 files changed, 30 insertions(+) diff --git a/comfy_extras/nodes_model_advanced.py b/comfy_extras/nodes_model_advanced.py index 33f3face1..ceac5654b 100644 --- a/comfy_extras/nodes_model_advanced.py +++ b/comfy_extras/nodes_model_advanced.py @@ -3,6 +3,8 @@ import comfy.model_sampling import comfy.latent_formats import nodes import torch +import node_helpers + class LCM(comfy.model_sampling.EPS): def calculate_denoised(self, sigma, model_output, model_input): @@ -294,6 +296,24 @@ class RescaleCFG: m.set_model_sampler_cfg_function(rescale_cfg) return (m, ) +class ModelComputeDtype: + @classmethod + def INPUT_TYPES(s): + return {"required": { "model": ("MODEL",), + "dtype": (["default", "fp32", "fp16", "bf16"],), + }} + + RETURN_TYPES = ("MODEL",) + FUNCTION = "patch" + + CATEGORY = "advanced/debug/model" + + def patch(self, model, dtype): + m = model.clone() + m.set_model_compute_dtype(node_helpers.string_to_torch_dtype(dtype)) + return (m, ) + + NODE_CLASS_MAPPINGS = { "ModelSamplingDiscrete": ModelSamplingDiscrete, "ModelSamplingContinuousEDM": ModelSamplingContinuousEDM, @@ -303,4 +323,5 @@ NODE_CLASS_MAPPINGS = { "ModelSamplingAuraFlow": ModelSamplingAuraFlow, "ModelSamplingFlux": ModelSamplingFlux, "RescaleCFG": RescaleCFG, + "ModelComputeDtype": ModelComputeDtype, } diff --git a/node_helpers.py b/node_helpers.py index 4b38bfff8..48da3b099 100644 --- a/node_helpers.py +++ b/node_helpers.py @@ -1,4 +1,5 @@ import hashlib +import torch from comfy.cli_args import args @@ -35,3 +36,11 @@ def hasher(): "sha512": hashlib.sha512 } return hashfuncs[args.default_hashing_function] + +def string_to_torch_dtype(string): + if string == "fp32": + return torch.float32 + if string == "fp16": + return torch.float16 + if string == "bf16": + return torch.bfloat16 From b3d6ae15b303df46d303d31bc18a38eaa32ce00f Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Sat, 15 Feb 2025 18:32:47 +0900 Subject: [PATCH 104/478] Update frontend to v1.9.17 (#6814) Co-authored-by: huchenlei <20929282+huchenlei@users.noreply.github.com> --- ...111_1A.js => BaseViewTemplate-DlGljfEG.js} | 6 +- web/assets/DesktopStartView-B2BMUZxW.js | 19 + web/assets/DesktopStartView-FKlxS2Lt.js | 22 - web/assets/DesktopUpdateView-CxchaIvw.css | 20 + web/assets/DesktopUpdateView-DWsew03S.js | 58 + ...VXUne-M.js => DownloadGitView-SPK8AXQU.js} | 6 +- ...iPOrhDVM.js => ExtensionPanel-1HZtMFvH.js} | 8 +- ...ew-CVCdiww1.css => GraphView-Bo28XDd0.css} | 123 +- ...View-D9ZzDQZV.js => GraphView-CLFBgoGf.js} | 2127 ++-- ...ew-CVZcZZXJ.js => InstallView-x9XCq0hC.js} | 52 +- ...eHhC2F4.js => KeybindingPanel-BIrxefrS.js} | 26 +- web/assets/KeybindingPanel-CDYVPYDp.css | 8 + web/assets/KeybindingPanel-DvrUYZ4S.css | 8 - ...f7CHNWW.js => MaintenanceView-BUmTZX1d.js} | 1426 +-- ..._Vr6o.css => MaintenanceView-DEJCj8SR.css} | 4 +- ...js => ManualConfigurationView-D3on5kXY.js} | 6 +- ...gqrS.js => MetricsConsentView-DK20ednB.js} | 6 +- ...pntA4x.js => NotSupportedView-BzM0uuqA.js} | 6 +- ...I5M9c.js => ServerConfigPanel-D0jTW_iX.js} | 6 +- ...pH4TXPO.js => ServerStartView-BENqs5bD.js} | 8 +- ...wVDQY.css => ServerStartView-BZ7uhZHv.css} | 2 +- web/assets/TerminalOutputDrawer-BgTEspHP.js | 1061 ++ ...wxa07xPk.js => UserSelectView-CRPNAEVJ.js} | 6 +- ...ew-BrXELNIm.js => WelcomeView-Cvtvw05C.js} | 6 +- .../{index-BNlqgrYT.js => index-A-dAhghd.js} | 4 +- web/assets/index-B0BQ8jlU.js | 618 + .../{index-DXE47DZl.js => index-BTHx8UHZ.js} | 4 +- ...{index-C1Hb_Yo9.css => index-CBxvvAzM.css} | 343 +- .../{index-BYzwFNH3.js => index-D9D9jjLT.js} | 1239 +- .../{index-DKIv7atk.js => index-DSWvxALN.js} | 1032 +- .../{index-DqqhYDnY.js => index-DqXp9vW4.js} | 10596 +++++++++------- .../{index-BapOFhAR.js => index-KUUE4Ew8.js} | 6 +- ...Cutrm.js => keybindingService-DgS0S2M6.js} | 6 +- ...DJVFt.js => serverConfigStore-C8uoM7Sm.js} | 4 +- web/index.html | 4 +- web/scripts/domWidget.js | 2 + web/templates/image2image.json | 6 +- 37 files changed, 10547 insertions(+), 8337 deletions(-) rename web/assets/{BaseViewTemplate-Cz111_1A.js => BaseViewTemplate-DlGljfEG.js} (82%) create mode 100644 web/assets/DesktopStartView-B2BMUZxW.js delete mode 100644 web/assets/DesktopStartView-FKlxS2Lt.js create mode 100644 web/assets/DesktopUpdateView-CxchaIvw.css create mode 100644 web/assets/DesktopUpdateView-DWsew03S.js rename web/assets/{DownloadGitView-DVXUne-M.js => DownloadGitView-SPK8AXQU.js} (92%) rename web/assets/{ExtensionPanel-iPOrhDVM.js => ExtensionPanel-1HZtMFvH.js} (93%) rename web/assets/{GraphView-CVCdiww1.css => GraphView-Bo28XDd0.css} (65%) rename web/assets/{GraphView-D9ZzDQZV.js => GraphView-CLFBgoGf.js} (88%) rename web/assets/{InstallView-CVZcZZXJ.js => InstallView-x9XCq0hC.js} (95%) rename web/assets/{KeybindingPanel-CeHhC2F4.js => KeybindingPanel-BIrxefrS.js} (90%) create mode 100644 web/assets/KeybindingPanel-CDYVPYDp.css delete mode 100644 web/assets/KeybindingPanel-DvrUYZ4S.css rename web/assets/{MaintenanceView-Df7CHNWW.js => MaintenanceView-BUmTZX1d.js} (97%) rename web/assets/{MaintenanceView-Bj5_Vr6o.css => MaintenanceView-DEJCj8SR.css} (95%) rename web/assets/{ManualConfigurationView-Cz0_f_T-.js => ManualConfigurationView-D3on5kXY.js} (92%) rename web/assets/{MetricsConsentView-B5NlgqrS.js => MetricsConsentView-DK20ednB.js} (88%) rename web/assets/{NotSupportedView-BUpntA4x.js => NotSupportedView-BzM0uuqA.js} (95%) rename web/assets/{ServerConfigPanel-B1lI5M9c.js => ServerConfigPanel-D0jTW_iX.js} (94%) rename web/assets/{ServerStartView-BpH4TXPO.js => ServerStartView-BENqs5bD.js} (92%) rename web/assets/{ServerStartView-CJiwVDQY.css => ServerStartView-BZ7uhZHv.css} (64%) create mode 100644 web/assets/TerminalOutputDrawer-BgTEspHP.js rename web/assets/{UserSelectView-wxa07xPk.js => UserSelectView-CRPNAEVJ.js} (91%) rename web/assets/{WelcomeView-BrXELNIm.js => WelcomeView-Cvtvw05C.js} (87%) rename web/assets/{index-BNlqgrYT.js => index-A-dAhghd.js} (98%) create mode 100644 web/assets/index-B0BQ8jlU.js rename web/assets/{index-DXE47DZl.js => index-BTHx8UHZ.js} (91%) rename web/assets/{index-C1Hb_Yo9.css => index-CBxvvAzM.css} (92%) rename web/assets/{index-BYzwFNH3.js => index-D9D9jjLT.js} (98%) rename web/assets/{index-DKIv7atk.js => index-DSWvxALN.js} (85%) rename web/assets/{index-DqqhYDnY.js => index-DqXp9vW4.js} (97%) rename web/assets/{index-BapOFhAR.js => index-KUUE4Ew8.js} (99%) rename web/assets/{keybindingService-DEgCutrm.js => keybindingService-DgS0S2M6.js} (93%) rename web/assets/{serverConfigStore-Kb5DJVFt.js => serverConfigStore-C8uoM7Sm.js} (95%) create mode 100644 web/scripts/domWidget.js diff --git a/web/assets/BaseViewTemplate-Cz111_1A.js b/web/assets/BaseViewTemplate-DlGljfEG.js similarity index 82% rename from web/assets/BaseViewTemplate-Cz111_1A.js rename to web/assets/BaseViewTemplate-DlGljfEG.js index 74515b87c..9bf3787d3 100644 --- a/web/assets/BaseViewTemplate-Cz111_1A.js +++ b/web/assets/BaseViewTemplate-DlGljfEG.js @@ -1,4 +1,4 @@ -import { d as defineComponent, U as ref, p as onMounted, b4 as isElectron, W as nextTick, b5 as electronAPI, o as openBlock, f as createElementBlock, i as withDirectives, v as vShow, j as unref, b6 as isNativeWindow, m as createBaseVNode, A as renderSlot, ai as normalizeClass } from "./index-DqqhYDnY.js"; +import { d as defineComponent, T as ref, p as onMounted, b8 as isElectron, V as nextTick, b9 as electronAPI, o as openBlock, f as createElementBlock, i as withDirectives, v as vShow, j as unref, ba as isNativeWindow, m as createBaseVNode, A as renderSlot, aj as normalizeClass } from "./index-DqXp9vW4.js"; const _hoisted_1 = { class: "flex-grow w-full flex items-center justify-center overflow-auto" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "BaseViewTemplate", @@ -27,7 +27,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { - class: normalizeClass(["font-sans w-screen h-screen flex flex-col pointer-events-auto", [ + class: normalizeClass(["font-sans w-screen h-screen flex flex-col", [ props.dark ? "text-neutral-300 bg-neutral-900 dark-theme" : "text-neutral-900 bg-neutral-300" ]]) }, [ @@ -48,4 +48,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as _ }; -//# sourceMappingURL=BaseViewTemplate-Cz111_1A.js.map +//# sourceMappingURL=BaseViewTemplate-DlGljfEG.js.map diff --git a/web/assets/DesktopStartView-B2BMUZxW.js b/web/assets/DesktopStartView-B2BMUZxW.js new file mode 100644 index 000000000..7fdd14876 --- /dev/null +++ b/web/assets/DesktopStartView-B2BMUZxW.js @@ -0,0 +1,19 @@ +import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, k as createVNode, j as unref, bE as script } from "./index-DqXp9vW4.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.js"; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "DesktopStartView", + setup(__props) { + return (_ctx, _cache) => { + return openBlock(), createBlock(_sfc_main$1, { dark: "" }, { + default: withCtx(() => [ + createVNode(unref(script), { class: "m-8 w-48 h-48" }) + ]), + _: 1 + }); + }; + } +}); +export { + _sfc_main as default +}; +//# sourceMappingURL=DesktopStartView-B2BMUZxW.js.map diff --git a/web/assets/DesktopStartView-FKlxS2Lt.js b/web/assets/DesktopStartView-FKlxS2Lt.js deleted file mode 100644 index b8b847632..000000000 --- a/web/assets/DesktopStartView-FKlxS2Lt.js +++ /dev/null @@ -1,22 +0,0 @@ -import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, k as createVNode, j as unref, bz as script } from "./index-DqqhYDnY.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.js"; -const _hoisted_1 = { class: "max-w-screen-sm w-screen p-8" }; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "DesktopStartView", - setup(__props) { - return (_ctx, _cache) => { - return openBlock(), createBlock(_sfc_main$1, { dark: "" }, { - default: withCtx(() => [ - createBaseVNode("div", _hoisted_1, [ - createVNode(unref(script), { mode: "indeterminate" }) - ]) - ]), - _: 1 - }); - }; - } -}); -export { - _sfc_main as default -}; -//# sourceMappingURL=DesktopStartView-FKlxS2Lt.js.map diff --git a/web/assets/DesktopUpdateView-CxchaIvw.css b/web/assets/DesktopUpdateView-CxchaIvw.css new file mode 100644 index 000000000..e85cbfae6 --- /dev/null +++ b/web/assets/DesktopUpdateView-CxchaIvw.css @@ -0,0 +1,20 @@ + +.download-bg[data-v-8d77828d]::before { + position: absolute; + margin: 0px; + color: var(--p-text-muted-color); + font-family: 'primeicons'; + top: -2rem; + right: 2rem; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + display: inline-block; + -webkit-font-smoothing: antialiased; + opacity: 0.02; + font-size: min(14rem, 90vw); + z-index: 0 +} diff --git a/web/assets/DesktopUpdateView-DWsew03S.js b/web/assets/DesktopUpdateView-DWsew03S.js new file mode 100644 index 000000000..dec3d41f2 --- /dev/null +++ b/web/assets/DesktopUpdateView-DWsew03S.js @@ -0,0 +1,58 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { d as defineComponent, T as ref, d8 as onUnmounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, j as unref, bg as t, k as createVNode, bE as script, l as script$1, b9 as electronAPI, _ as _export_sfc } from "./index-DqXp9vW4.js"; +import { s as script$2 } from "./index-B0BQ8jlU.js"; +import { _ as _sfc_main$1 } from "./TerminalOutputDrawer-BgTEspHP.js"; +import { _ as _sfc_main$2 } from "./BaseViewTemplate-DlGljfEG.js"; +const _hoisted_1 = { class: "h-screen w-screen grid items-center justify-around overflow-y-auto" }; +const _hoisted_2 = { class: "relative m-8 text-center" }; +const _hoisted_3 = { class: "download-bg pi-download text-4xl font-bold" }; +const _hoisted_4 = { class: "m-8" }; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "DesktopUpdateView", + setup(__props) { + const electron = electronAPI(); + const terminalVisible = ref(false); + const toggleConsoleDrawer = /* @__PURE__ */ __name(() => { + terminalVisible.value = !terminalVisible.value; + }, "toggleConsoleDrawer"); + onUnmounted(() => electron.Validation.dispose()); + return (_ctx, _cache) => { + return openBlock(), createBlock(_sfc_main$2, { dark: "" }, { + default: withCtx(() => [ + createBaseVNode("div", _hoisted_1, [ + createBaseVNode("div", _hoisted_2, [ + createBaseVNode("h1", _hoisted_3, toDisplayString(unref(t)("desktopUpdate.title")), 1), + createBaseVNode("div", _hoisted_4, [ + createBaseVNode("span", null, toDisplayString(unref(t)("desktopUpdate.description")), 1) + ]), + createVNode(unref(script), { class: "m-8 w-48 h-48" }), + createVNode(unref(script$1), { + style: { "transform": "translateX(-50%)" }, + class: "fixed bottom-0 left-1/2 my-8", + label: unref(t)("maintenance.consoleLogs"), + icon: "pi pi-desktop", + "icon-pos": "left", + severity: "secondary", + onClick: toggleConsoleDrawer + }, null, 8, ["label"]), + createVNode(_sfc_main$1, { + modelValue: terminalVisible.value, + "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => terminalVisible.value = $event), + header: unref(t)("g.terminal"), + "default-message": unref(t)("desktopUpdate.terminalDefaultMessage") + }, null, 8, ["modelValue", "header", "default-message"]) + ]) + ]), + createVNode(unref(script$2)) + ]), + _: 1 + }); + }; + } +}); +const DesktopUpdateView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8d77828d"]]); +export { + DesktopUpdateView as default +}; +//# sourceMappingURL=DesktopUpdateView-DWsew03S.js.map diff --git a/web/assets/DownloadGitView-DVXUne-M.js b/web/assets/DownloadGitView-SPK8AXQU.js similarity index 92% rename from web/assets/DownloadGitView-DVXUne-M.js rename to web/assets/DownloadGitView-SPK8AXQU.js index 9d879bd3e..1b7d7e0c0 100644 --- a/web/assets/DownloadGitView-DVXUne-M.js +++ b/web/assets/DownloadGitView-SPK8AXQU.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, be as useRouter } from "./index-DqqhYDnY.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.js"; +import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, bi as useRouter } from "./index-DqXp9vW4.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.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" }; @@ -55,4 +55,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=DownloadGitView-DVXUne-M.js.map +//# sourceMappingURL=DownloadGitView-SPK8AXQU.js.map diff --git a/web/assets/ExtensionPanel-iPOrhDVM.js b/web/assets/ExtensionPanel-1HZtMFvH.js similarity index 93% rename from web/assets/ExtensionPanel-iPOrhDVM.js rename to web/assets/ExtensionPanel-1HZtMFvH.js index 4f4660193..99adb239b 100644 --- a/web/assets/ExtensionPanel-iPOrhDVM.js +++ b/web/assets/ExtensionPanel-1HZtMFvH.js @@ -1,8 +1,8 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, U as ref, dl as FilterMatchMode, dr as useExtensionStore, a as useSettingStore, p as onMounted, c as computed, o as openBlock, y as createBlock, z as withCtx, k as createVNode, dm as SearchBox, j as unref, bj as script, m as createBaseVNode, f as createElementBlock, D as renderList, E as toDisplayString, a7 as createTextVNode, F as Fragment, l as script$1, B as createCommentVNode, a4 as script$3, ax as script$4, bn as script$5, dn as _sfc_main$1 } from "./index-DqqhYDnY.js"; -import { g as script$2, h as script$6 } from "./index-BapOFhAR.js"; -import "./index-DXE47DZl.js"; +import { d as defineComponent, T as ref, dx as FilterMatchMode, dC as useExtensionStore, a as useSettingStore, p as onMounted, c as computed, o as openBlock, y as createBlock, z as withCtx, k as createVNode, dy as SearchBox, j as unref, bn as script, m as createBaseVNode, f as createElementBlock, D as renderList, E as toDisplayString, a8 as createTextVNode, F as Fragment, l as script$1, B as createCommentVNode, a5 as script$3, ay as script$4, br as script$5, dz as _sfc_main$1 } from "./index-DqXp9vW4.js"; +import { g as script$2, h as script$6 } from "./index-KUUE4Ew8.js"; +import "./index-BTHx8UHZ.js"; const _hoisted_1 = { class: "flex justify-end" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "ExtensionPanel", @@ -179,4 +179,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ExtensionPanel-iPOrhDVM.js.map +//# sourceMappingURL=ExtensionPanel-1HZtMFvH.js.map diff --git a/web/assets/GraphView-CVCdiww1.css b/web/assets/GraphView-Bo28XDd0.css similarity index 65% rename from web/assets/GraphView-CVCdiww1.css rename to web/assets/GraphView-Bo28XDd0.css index 765b2a0e7..aab80799b 100644 --- a/web/assets/GraphView-CVCdiww1.css +++ b/web/assets/GraphView-Bo28XDd0.css @@ -1,6 +1,5 @@ -.comfy-menu-hamburger[data-v-7ed57d1a] { - pointer-events: auto; +.comfy-menu-hamburger[data-v-82120b51] { position: fixed; z-index: 9999; display: flex; @@ -41,19 +40,19 @@ z-index: 999; } -.p-buttongroup-vertical[data-v-cb8f9a1a] { +.p-buttongroup-vertical[data-v-27a9500c] { 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-cb8f9a1a] { +.p-buttongroup-vertical .p-button[data-v-27a9500c] { margin: 0; border-radius: 0; } -.node-tooltip[data-v-46859edf] { +.node-tooltip[data-v-f03142eb] { background: var(--comfy-input-bg); border-radius: 5px; box-shadow: 0 0 5px rgba(0, 0, 0, 0.4); @@ -133,13 +132,11 @@ border-right: 4px solid var(--p-button-text-primary-color); } -.side-tool-bar-container[data-v-33cac83a] { +.side-tool-bar-container[data-v-04875455] { display: flex; flex-direction: column; align-items: center; - pointer-events: auto; - width: var(--sidebar-width); height: 100%; @@ -150,16 +147,16 @@ --sidebar-width: 4rem; --sidebar-icon-size: 1.5rem; } -.side-tool-bar-container.small-sidebar[data-v-33cac83a] { +.side-tool-bar-container.small-sidebar[data-v-04875455] { --sidebar-width: 2.5rem; --sidebar-icon-size: 1rem; } -.side-tool-bar-end[data-v-33cac83a] { +.side-tool-bar-end[data-v-04875455] { align-self: flex-end; margin-top: auto; } -.status-indicator[data-v-8d011a31] { +.status-indicator[data-v-fd6ae3af] { position: absolute; font-weight: 700; font-size: 1.5rem; @@ -221,7 +218,7 @@ border-radius: 0px } -[data-v-38831d8e] .workflow-tabs { +[data-v-6ab68035] .workflow-tabs { background-color: var(--comfy-menu-bg); } @@ -235,31 +232,36 @@ border-bottom-right-radius: 0; } -.actionbar[data-v-915e5456] { +.actionbar[data-v-ebd56d51] { pointer-events: all; position: fixed; z-index: 1000; } -.actionbar.is-docked[data-v-915e5456] { +.actionbar.is-docked[data-v-ebd56d51] { position: static; border-style: none; background-color: transparent; padding: 0px; } -.actionbar.is-dragging[data-v-915e5456] { +.actionbar.is-dragging[data-v-ebd56d51] { -webkit-user-select: none; -moz-user-select: none; user-select: none; } -[data-v-915e5456] .p-panel-content { +[data-v-ebd56d51] .p-panel-content { padding: 0.25rem; } -.is-docked[data-v-915e5456] .p-panel-content { +.is-docked[data-v-ebd56d51] .p-panel-content { padding: 0px; } -[data-v-915e5456] .p-panel-header { +[data-v-ebd56d51] .p-panel-header { display: none; } +.drag-handle[data-v-ebd56d51] { + height: -moz-max-content; + height: max-content; + width: 0.75rem; +} .top-menubar[data-v-56df69d2] .p-menubar-item-link svg { display: none; @@ -275,7 +277,7 @@ border-style: solid; } -.comfyui-menu[data-v-929e7543] { +.comfyui-menu[data-v-68d3b5b9] { width: 100vw; height: var(--comfy-topbar-height); background: var(--comfy-menu-bg); @@ -288,19 +290,94 @@ order: 0; grid-column: 1/-1; } -.comfyui-menu.dropzone[data-v-929e7543] { +.comfyui-menu.dropzone[data-v-68d3b5b9] { background: var(--p-highlight-background); } -.comfyui-menu.dropzone-active[data-v-929e7543] { +.comfyui-menu.dropzone-active[data-v-68d3b5b9] { background: var(--p-highlight-background-focus); } -[data-v-929e7543] .p-menubar-item-label { +[data-v-68d3b5b9] .p-menubar-item-label { line-height: revert; } -.comfyui-logo[data-v-929e7543] { +.comfyui-logo[data-v-68d3b5b9] { font-size: 1.2em; -webkit-user-select: none; -moz-user-select: none; user-select: none; cursor: default; } + +.comfyui-body[data-v-e89d9273] { + grid-template-columns: auto 1fr auto; + grid-template-rows: auto 1fr auto; +} + +/** + +------------------+------------------+------------------+ + | | + | .comfyui-body- | + | top | + | (spans all cols) | + | | + +------------------+------------------+------------------+ + | | | | + | .comfyui-body- | #graph-canvas | .comfyui-body- | + | left | | right | + | | | | + | | | | + +------------------+------------------+------------------+ + | | + | .comfyui-body- | + | bottom | + | (spans all cols) | + | | + +------------------+------------------+------------------+ +*/ +.comfyui-body-top[data-v-e89d9273] { + order: -5; + /* Span across all columns */ + grid-column: 1/-1; + /* Position at the first row */ + grid-row: 1; + /* Top menu bar dropdown needs to be above of graph canvas splitter overlay which is z-index: 999 */ + /* Top menu bar z-index needs to be higher than bottom menu bar z-index as by default + pysssss's image feed is located at body-bottom, and it can overlap with the queue button, which + is located in body-top. */ + z-index: 1001; + display: flex; + flex-direction: column; +} +.comfyui-body-left[data-v-e89d9273] { + order: -4; + /* Position in the first column */ + grid-column: 1; + /* Position below the top element */ + grid-row: 2; + z-index: 10; + display: flex; +} +.graph-canvas-container[data-v-e89d9273] { + width: 100%; + height: 100%; + order: -3; + grid-column: 2; + grid-row: 2; + position: relative; + overflow: hidden; +} +.comfyui-body-right[data-v-e89d9273] { + order: -2; + z-index: 10; + grid-column: 3; + grid-row: 2; +} +.comfyui-body-bottom[data-v-e89d9273] { + order: 4; + /* Span across all columns */ + grid-column: 1/-1; + grid-row: 3; + /* Bottom menu bar dropdown needs to be above of graph canvas splitter overlay which is z-index: 999 */ + z-index: 1000; + display: flex; + flex-direction: column; +} diff --git a/web/assets/GraphView-D9ZzDQZV.js b/web/assets/GraphView-CLFBgoGf.js similarity index 88% rename from web/assets/GraphView-D9ZzDQZV.js rename to web/assets/GraphView-CLFBgoGf.js index 5083b86f7..900a8cc86 100644 --- a/web/assets/GraphView-D9ZzDQZV.js +++ b/web/assets/GraphView-CLFBgoGf.js @@ -1,10 +1,11 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -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 createVNode, s as showNativeMenu, l as script, m as createBaseVNode, n as normalizeStyle, _ as _export_sfc, p as onMounted, q as onBeforeUnmount, t as useSidebarTabStore, x as useBottomPanelStore, y as createBlock, z as withCtx, A as renderSlot, B as createCommentVNode, C as resolveDynamicComponent, F as Fragment, D as renderList, E as toDisplayString, G as script$5, H as markRaw, I as defineStore, J as shallowRef, K as useI18n, L as useCommandStore, M as LiteGraph, N as useColorPaletteStore, O as watch, P as useNodeDefStore, Q as BadgePosition, R as LGraphBadge, S as _, T as NodeBadgeMode, U as ref, V as useEventListener, W as nextTick, X as st, Y as normalizeI18nKey, Z as LGraphGroup, $ as LGraphNode, a0 as EditableText, a1 as useNodeFrequencyStore, a2 as useNodeBookmarkStore, a3 as highlightQuery, a4 as script$8, a5 as formatNumberWithSuffix, a6 as NodeSourceType, a7 as createTextVNode, a8 as script$9, a9 as NodePreview, aa as NodeSearchFilter, ab as script$a, ac as SearchFilterChip, ad as useLitegraphService, ae as storeToRefs, af as isRef, ag as toRaw, ah as LinkReleaseTriggerAction, ai as normalizeClass, aj as useUserStore, ak as useDialogStore, al as SettingDialogHeader, am as SettingDialogContent, an as useKeybindingStore, ao as Teleport, ap as usePragmaticDraggable, aq as usePragmaticDroppable, ar as withModifiers, as as mergeProps, at as useWorkflowService, au as useWorkflowBookmarkStore, av as script$c, aw as script$d, ax as script$e, ay as LinkMarkerShape, az as useModelToNodeStore, aA as ComfyNodeDefImpl, aB as ComfyModelDef, aC as LGraph, aD as LLink, aE as DragAndScale, aF as LGraphCanvas, aG as ContextMenu, aH as api, aI as getStorageValue, aJ as useModelStore, aK as setStorageValue, aL as CanvasPointer, aM as IS_CONTROL_WIDGET, aN as updateControlWidgetLabel, aO as useColorPaletteService, aP as ChangeTracker, aQ as i18n, aR as useToast, aS as useToastStore, aT as useQueueSettingsStore, aU as script$g, aV as useQueuePendingTaskCountStore, aW as useLocalStorage, aX as useDraggable, aY as watchDebounced, aZ as inject, a_ as useElementBounding, a$ as script$i, b0 as lodashExports, b1 as useEventBus, b2 as useMenuItemStore, b3 as provide, b4 as isElectron, b5 as electronAPI, b6 as isNativeWindow, b7 as useDialogService, b8 as LGraphEventMode, b9 as useQueueStore, ba as DEFAULT_DARK_COLOR_PALETTE, bb as DEFAULT_LIGHT_COLOR_PALETTE, bc as t, bd as useErrorHandling } from "./index-DqqhYDnY.js"; -import { s as script$1, a as script$2, b as script$3, c as script$4, d as script$6, e as script$7, f as script$b, g as script$f, h as script$h, i as script$j } from "./index-DKIv7atk.js"; -import { u as useKeybindingService } from "./keybindingService-DEgCutrm.js"; -import { u as useServerConfigStore } from "./serverConfigStore-Kb5DJVFt.js"; -import "./index-DXE47DZl.js"; +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 createVNode, s as showNativeMenu, l as script, m as createBaseVNode, n as normalizeStyle, _ as _export_sfc, p as onMounted, q as onBeforeUnmount, t as useSidebarTabStore, x as useBottomPanelStore, y as createBlock, z as withCtx, A as renderSlot, B as createCommentVNode, C as resolveDynamicComponent, F as Fragment, D as renderList, E as toDisplayString, G as script$5, H as markRaw, I as useI18n, J as useCommandStore, K as useCanvasStore, L as LiteGraph, M as useColorPaletteStore, N as watch, O as useNodeDefStore, P as BadgePosition, Q as LGraphBadge, R as _, S as NodeBadgeMode, T as ref, U as useEventListener, V as nextTick, W as st, X as normalizeI18nKey, Y as useTitleEditorStore, Z as LGraphGroup, $ as LGraphNode, a0 as EditableText, a1 as defineStore, a2 as useNodeFrequencyStore, a3 as useNodeBookmarkStore, a4 as highlightQuery, a5 as script$8, a6 as formatNumberWithSuffix, a7 as NodeSourceType, a8 as createTextVNode, a9 as script$9, aa as NodePreview, ab as NodeSearchFilter, ac as script$a, ad as SearchFilterChip, ae as useLitegraphService, af as storeToRefs, ag as isRef, ah as toRaw, ai as LinkReleaseTriggerAction, aj as normalizeClass, ak as useUserStore, al as useDialogStore, am as SettingDialogHeader, an as SettingDialogContent, ao as useKeybindingStore, ap as Teleport, aq as usePragmaticDraggable, ar as usePragmaticDroppable, as as withModifiers, at as mergeProps, au as useWorkflowService, av as useWorkflowBookmarkStore, aw as script$c, ax as script$d, ay as script$e, az as useModelToNodeStore, aA as ComfyNodeDefImpl, aB as ComfyModelDef, aC as ComfyWorkflow, aD as LGraphCanvas, aE as te, aF as LGraph, aG as LLink, aH as DragAndScale, aI as ContextMenu, aJ as CanvasPointer, aK as isImageNode, aL as api, aM as getStorageValue, aN as useModelStore, aO as setStorageValue, aP as LinkMarkerShape, aQ as IS_CONTROL_WIDGET, aR as updateControlWidgetLabel, aS as useColorPaletteService, aT as ChangeTracker, aU as i18n, aV as useToast, aW as useToastStore, aX as useQueueSettingsStore, aY as script$g, aZ as useQueuePendingTaskCountStore, a_ as useLocalStorage, a$ as useDraggable, b0 as watchDebounced, b1 as inject, b2 as useElementBounding, b3 as script$i, b4 as lodashExports, b5 as useEventBus, b6 as useMenuItemStore, b7 as provide, b8 as isElectron, b9 as electronAPI, ba as isNativeWindow, bb as useDialogService, bc as LGraphEventMode, bd as useQueueStore, be as DEFAULT_DARK_COLOR_PALETTE, bf as DEFAULT_LIGHT_COLOR_PALETTE, bg as t, bh as useErrorHandling } from "./index-DqXp9vW4.js"; +import { s as script$1, a as script$2, b as script$3, c as script$4, d as script$6, e as script$7, f as script$b, g as script$h, h as script$j } from "./index-DSWvxALN.js"; +import { s as script$f } from "./index-B0BQ8jlU.js"; +import { u as useKeybindingService } from "./keybindingService-DgS0S2M6.js"; +import { u as useServerConfigStore } from "./serverConfigStore-C8uoM7Sm.js"; +import "./index-BTHx8UHZ.js"; const DEFAULT_TITLE = "ComfyUI"; const TITLE_SUFFIX = " - ComfyUI"; const _sfc_main$u = /* @__PURE__ */ defineComponent({ @@ -39,7 +40,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$j = { class: "window-actions-spacer" }; +const _hoisted_1$k = { class: "window-actions-spacer" }; const _sfc_main$t = /* @__PURE__ */ defineComponent({ __name: "MenuHamburger", setup(__props) { @@ -84,7 +85,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({ }, null, 8, ["aria-label", "onContextmenu"]), [ [_directive_tooltip, { value: _ctx.$t("menu.showMenu"), showDelay: 300 }] ]), - withDirectives(createBaseVNode("div", _hoisted_1$j, null, 512), [ + withDirectives(createBaseVNode("div", _hoisted_1$k, null, 512), [ [vShow, menuSetting.value !== "Bottom"] ]) ], 4)), [ @@ -93,7 +94,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({ }; } }); -const MenuHamburger = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-7ed57d1a"]]); +const MenuHamburger = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-82120b51"]]); const _sfc_main$s = /* @__PURE__ */ defineComponent({ __name: "UnloadWindowConfirmDialog", setup(__props) { @@ -234,17 +235,17 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$i = { class: "flex flex-col h-full" }; -const _hoisted_2$6 = { class: "w-full flex justify-between" }; -const _hoisted_3$5 = { class: "tabs-container" }; -const _hoisted_4$1 = { class: "font-bold" }; +const _hoisted_1$j = { class: "flex flex-col h-full" }; +const _hoisted_2$7 = { class: "w-full flex justify-between" }; +const _hoisted_3$6 = { class: "tabs-container" }; +const _hoisted_4$2 = { class: "font-bold" }; const _hoisted_5$1 = { class: "flex-grow h-0" }; const _sfc_main$p = /* @__PURE__ */ defineComponent({ __name: "BottomPanel", setup(__props) { const bottomPanelStore = useBottomPanelStore(); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$i, [ + return openBlock(), createElementBlock("div", _hoisted_1$j, [ createVNode(unref(script$5), { value: unref(bottomPanelStore).activeBottomPanelTabId, "onUpdate:value": _cache[1] || (_cache[1] = ($event) => unref(bottomPanelStore).activeBottomPanelTabId = $event) @@ -252,8 +253,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({ default: withCtx(() => [ createVNode(unref(script$3), { "pt:tabList": "border-none" }, { default: withCtx(() => [ - createBaseVNode("div", _hoisted_2$6, [ - createBaseVNode("div", _hoisted_3$5, [ + createBaseVNode("div", _hoisted_2$7, [ + createBaseVNode("div", _hoisted_3$6, [ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(bottomPanelStore).bottomPanelTabs, (tab) => { return openBlock(), createBlock(unref(script$4), { key: tab.id, @@ -261,7 +262,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({ class: "p-3 border-none" }, { default: withCtx(() => [ - createBaseVNode("span", _hoisted_4$1, toDisplayString(tab.title.toUpperCase()), 1) + createBaseVNode("span", _hoisted_4$2, toDisplayString(tab.title.toUpperCase()), 1) ]), _: 2 }, 1032, ["value"]); @@ -292,13 +293,13 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$h = { +const _hoisted_1$i = { viewBox: "0 0 1024 1024", width: "1.2em", height: "1.2em" }; function render$7(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$h, _cache[0] || (_cache[0] = [ + return openBlock(), createElementBlock("svg", _hoisted_1$i, _cache[0] || (_cache[0] = [ 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" @@ -307,13 +308,13 @@ function render$7(_ctx, _cache) { } __name(render$7, "render$7"); const __unplugin_components_1$2 = markRaw({ name: "simple-line-icons-cursor", render: render$7 }); -const _hoisted_1$g = { +const _hoisted_1$h = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; function render$6(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$g, _cache[0] || (_cache[0] = [ + return openBlock(), createElementBlock("svg", _hoisted_1$h, _cache[0] || (_cache[0] = [ 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" @@ -322,18 +323,6 @@ function render$6(_ctx, _cache) { } __name(render$6, "render$6"); const __unplugin_components_0$2 = markRaw({ name: "material-symbols-pan-tool-outline", render: render$6 }); -const useTitleEditorStore = defineStore("titleEditor", () => { - const titleEditorTarget = shallowRef(null); - return { - titleEditorTarget - }; -}); -const useCanvasStore = defineStore("canvas", () => { - const canvas = shallowRef(null); - return { - canvas - }; -}); const _sfc_main$o = /* @__PURE__ */ defineComponent({ __name: "GraphCanvasMenu", setup(__props) { @@ -361,7 +350,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ 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$6), { class: "p-buttongroup-vertical absolute bottom-[10px] right-[10px] z-[1000] pointer-events-auto" }, { + return openBlock(), createBlock(unref(script$6), { class: "p-buttongroup-vertical absolute bottom-[10px] right-[10px] z-[1000]" }, { default: withCtx(() => [ withDirectives(createVNode(unref(script), { severity: "secondary", @@ -445,7 +434,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ }; } }); -const GraphCanvasMenu = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-cb8f9a1a"]]); +const GraphCanvasMenu = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-27a9500c"]]); const _sfc_main$n = /* @__PURE__ */ defineComponent({ __name: "NodeBadge", setup(__props) { @@ -504,6 +493,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({ setup(__props) { let idleTimeout; const nodeDefStore = useNodeDefStore(); + const settingStore = useSettingStore(); const tooltipRef = ref(); const tooltipText = ref(""); const left = ref(); @@ -573,7 +563,10 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({ hideTooltip(); clearTimeout(idleTimeout); if (e.target.nodeName !== "CANVAS") return; - idleTimeout = window.setTimeout(onIdle, 500); + idleTimeout = window.setTimeout( + onIdle, + settingStore.get("LiteGraph.Node.TooltipDelay") + ); }, "onMouseMove"); useEventListener(window, "mousemove", onMouseMove); useEventListener(window, "click", hideTooltip); @@ -588,7 +581,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({ }; } }); -const NodeTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-46859edf"]]); +const NodeTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-f03142eb"]]); const _sfc_main$l = /* @__PURE__ */ defineComponent({ __name: "TitleEditor", setup(__props) { @@ -802,10 +795,10 @@ const _sfc_main$k = { } } }; -const _hoisted_1$f = { class: "option-container flex justify-between items-center px-2 py-0 cursor-pointer overflow-hidden w-full" }; -const _hoisted_2$5 = { class: "option-display-name font-semibold flex flex-col" }; -const _hoisted_3$4 = { key: 0 }; -const _hoisted_4 = ["innerHTML"]; +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$6 = { class: "option-display-name font-semibold flex flex-col" }; +const _hoisted_3$5 = { key: 0 }; +const _hoisted_4$1 = ["innerHTML"]; const _hoisted_5 = ["innerHTML"]; const _hoisted_6 = { key: 0, @@ -839,15 +832,15 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({ ); const props = __props; return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$f, [ - createBaseVNode("div", _hoisted_2$5, [ + return openBlock(), createElementBlock("div", _hoisted_1$g, [ + createBaseVNode("div", _hoisted_2$6, [ createBaseVNode("div", null, [ - isBookmarked.value ? (openBlock(), createElementBlock("span", _hoisted_3$4, _cache[0] || (_cache[0] = [ + isBookmarked.value ? (openBlock(), createElementBlock("span", _hoisted_3$5, _cache[0] || (_cache[0] = [ createBaseVNode("i", { class: "pi pi-bookmark-fill text-sm mr-1" }, null, -1) ]))) : createCommentVNode("", true), createBaseVNode("span", { innerHTML: unref(highlightQuery)(_ctx.nodeDef.display_name, _ctx.currentQuery) - }, null, 8, _hoisted_4), + }, null, 8, _hoisted_4$1), _cache[1] || (_cache[1] = createBaseVNode("span", null, " ", -1)), showIdName.value ? (openBlock(), createBlock(unref(script$8), { key: 1, @@ -894,12 +887,12 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({ } }); const NodeSearchItem = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-fd0a74bd"]]); -const _hoisted_1$e = { class: "comfy-vue-node-search-container flex justify-center items-center w-full min-w-96 pointer-events-auto" }; -const _hoisted_2$4 = { +const _hoisted_1$f = { class: "comfy-vue-node-search-container flex justify-center items-center w-full min-w-96" }; +const _hoisted_2$5 = { key: 0, class: "comfy-vue-node-preview-container absolute left-[-350px] top-[50px]" }; -const _hoisted_3$3 = { class: "_dialog-body" }; +const _hoisted_3$4 = { class: "_dialog-body" }; const _sfc_main$i = /* @__PURE__ */ defineComponent({ __name: "NodeSearchBox", props: { @@ -962,8 +955,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ hoveredSuggestion.value = value; }, "setHoverSuggestion"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$e, [ - enableNodePreview.value ? (openBlock(), createElementBlock("div", _hoisted_2$4, [ + return openBlock(), createElementBlock("div", _hoisted_1$f, [ + enableNodePreview.value ? (openBlock(), createElementBlock("div", _hoisted_2$5, [ hoveredSuggestion.value ? (openBlock(), createBlock(NodePreview, { nodeDef: hoveredSuggestion.value, key: hoveredSuggestion.value?.name || "" @@ -987,7 +980,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ createBaseVNode("h3", null, "Add node filter condition", -1) ])), default: withCtx(() => [ - createBaseVNode("div", _hoisted_3$3, [ + createBaseVNode("div", _hoisted_3$4, [ createVNode(NodeSearchFilter, { onAddFilter }) ]) ]), @@ -1354,8 +1347,8 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$d = { class: "side-tool-bar-end" }; -const _hoisted_2$3 = { +const _hoisted_1$e = { class: "side-tool-bar-end" }; +const _hoisted_2$4 = { key: 0, class: "sidebar-content-container h-full overflow-y-auto overflow-x-hidden" }; @@ -1400,24 +1393,24 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ onClick: /* @__PURE__ */ __name(($event) => onTabClick(tab), "onClick") }, null, 8, ["icon", "iconBadge", "tooltip", "selected", "class", "onClick"]); }), 128)), - createBaseVNode("div", _hoisted_1$d, [ + createBaseVNode("div", _hoisted_1$e, [ unref(userStore).isMultiUserServer ? (openBlock(), createBlock(_sfc_main$f, { key: 0 })) : createCommentVNode("", true), createVNode(_sfc_main$d), createVNode(_sfc_main$e) ]) ], 2) ], 8, ["to"])), - selectedTab.value ? (openBlock(), createElementBlock("div", _hoisted_2$3, [ + selectedTab.value ? (openBlock(), createElementBlock("div", _hoisted_2$4, [ createVNode(_sfc_main$q, { extension: selectedTab.value }, null, 8, ["extension"]) ])) : createCommentVNode("", true) ], 64); }; } }); -const SideToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-33cac83a"]]); -const _hoisted_1$c = { class: "workflow-label text-sm max-w-[150px] truncate inline-block" }; -const _hoisted_2$2 = { class: "relative" }; -const _hoisted_3$2 = { +const SideToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-04875455"]]); +const _hoisted_1$d = { class: "workflow-label text-sm max-w-[150px] truncate inline-block" }; +const _hoisted_2$3 = { class: "relative" }; +const _hoisted_3$3 = { key: 0, class: "status-indicator" }; @@ -1429,13 +1422,15 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ }, setup(__props) { const props = __props; + const { t: t2 } = useI18n(); 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 + warnIfUnsaved: !workspaceStore.shiftDown, + hint: t2("sideToolbar.workflowTab.dirtyCloseHint") })) { break; } @@ -1477,7 +1472,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ ref_key: "workflowTabRef", ref: workflowTabRef }, _ctx.$attrs), [ - withDirectives((openBlock(), createElementBlock("span", _hoisted_1$c, [ + withDirectives((openBlock(), createElementBlock("span", _hoisted_1$d, [ createTextVNode(toDisplayString(_ctx.workflowOption.workflow.filename), 1) ])), [ [ @@ -1487,8 +1482,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ { bottom: true } ] ]), - createBaseVNode("div", _hoisted_2$2, [ - !unref(workspaceStore).shiftDown && (_ctx.workflowOption.workflow.isModified || !_ctx.workflowOption.workflow.isPersisted) ? (openBlock(), createElementBlock("span", _hoisted_3$2, "•")) : createCommentVNode("", true), + createBaseVNode("div", _hoisted_2$3, [ + !unref(workspaceStore).shiftDown && (_ctx.workflowOption.workflow.isModified || !_ctx.workflowOption.workflow.isPersisted) ? (openBlock(), createElementBlock("span", _hoisted_3$3, "•")) : createCommentVNode("", true), createVNode(unref(script), { class: "close-button p-0 w-auto", icon: "pi pi-times", @@ -1502,8 +1497,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ }; } }); -const WorkflowTab = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-8d011a31"]]); -const _hoisted_1$b = { class: "workflow-tabs-container flex flex-row max-w-full h-full" }; +const WorkflowTab = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-fd6ae3af"]]); +const _hoisted_1$c = { class: "workflow-tabs-container flex flex-row max-w-full h-full" }; const _sfc_main$a = /* @__PURE__ */ defineComponent({ __name: "WorkflowTabs", props: { @@ -1606,7 +1601,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({ }, "handleWheel"); return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock("div", _hoisted_1$b, [ + return openBlock(), createElementBlock("div", _hoisted_1$c, [ createVNode(unref(script$d), { class: "overflow-hidden no-drag", "pt:content": { @@ -1656,18 +1651,448 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({ } }); const WorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-54fadc45"]]); -const _hoisted_1$a = { class: "absolute top-0 left-0 w-auto max-w-full pointer-events-auto" }; +const _hoisted_1$b = { class: "absolute top-0 left-0 w-auto max-w-full" }; const _sfc_main$9 = /* @__PURE__ */ defineComponent({ __name: "SecondRowWorkflowTabs", setup(__props) { return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$a, [ + return openBlock(), createElementBlock("div", _hoisted_1$b, [ createVNode(WorkflowTabs) ]); }; } }); -const SecondRowWorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-38831d8e"]]); +const SecondRowWorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-6ab68035"]]); +const useCanvasDrop = /* @__PURE__ */ __name((canvasRef) => { + const modelToNodeStore = useModelToNodeStore(); + const litegraphService = useLitegraphService(); + const workflowService = useWorkflowService(); + usePragmaticDroppable(() => canvasRef.value, { + getDropEffect: /* @__PURE__ */ __name((args) => args.source.data.type === "tree-explorer-node" ? "copy" : "move", "getDropEffect"), + onDrop: /* @__PURE__ */ __name((event) => { + const loc = event.location.current.input; + const dndData = event.source.data; + if (dndData.type === "tree-explorer-node") { + const node = dndData.data; + if (node.data instanceof ComfyNodeDefImpl) { + const nodeDef = node.data; + const pos = app.clientPosToCanvasPos([ + loc.clientX, + loc.clientY + LiteGraph.NODE_TITLE_HEIGHT + ]); + litegraphService.addNodeOnGraph(nodeDef, { pos }); + } else if (node.data instanceof ComfyModelDef) { + const model = node.data; + const pos = app.clientPosToCanvasPos([loc.clientX, loc.clientY]); + const nodeAtPos = app.graph.getNodeOnPos(pos[0], pos[1]); + let targetProvider = null; + let targetGraphNode = null; + if (nodeAtPos) { + const providers = modelToNodeStore.getAllNodeProviders( + model.directory + ); + for (const provider of providers) { + if (provider.nodeDef.name === nodeAtPos.comfyClass) { + targetGraphNode = nodeAtPos; + targetProvider = provider; + } + } + } + if (!targetGraphNode) { + const provider = modelToNodeStore.getNodeProvider(model.directory); + if (provider) { + targetGraphNode = litegraphService.addNodeOnGraph( + provider.nodeDef, + { + pos + } + ); + targetProvider = provider; + } + } + if (targetGraphNode) { + const widget = targetGraphNode.widgets?.find( + (widget2) => widget2.name === targetProvider?.key + ); + if (widget) { + widget.value = model.file_name; + } + } + } else if (node.data instanceof ComfyWorkflow) { + const workflow = node.data; + const position = app.clientPosToCanvasPos([ + loc.clientX, + loc.clientY + ]); + workflowService.insertWorkflow(workflow, { position }); + } + } + }, "onDrop") + }); +}, "useCanvasDrop"); +const useContextMenuTranslation = /* @__PURE__ */ __name(() => { + const f = LGraphCanvas.prototype.getCanvasMenuOptions; + const getCanvasCenterMenuOptions = /* @__PURE__ */ __name(function(...args) { + const res = f.apply(this, args); + for (const item of res) { + if (item?.content) { + item.content = st(`contextMenu.${item.content}`, item.content); + } + } + return res; + }, "getCanvasCenterMenuOptions"); + LGraphCanvas.prototype.getCanvasMenuOptions = getCanvasCenterMenuOptions; + function translateMenus(values, options) { + if (!values) return; + const reInput = /Convert (.*) to input/; + const reWidget = /Convert (.*) to widget/; + const cvt = st("contextMenu.Convert ", "Convert "); + const tinp = st("contextMenu. to input", " to input"); + const twgt = st("contextMenu. to widget", " to widget"); + for (const value of values) { + if (typeof value === "string") continue; + translateMenus(value?.submenu?.options, options); + if (!value?.content) { + continue; + } + if (te(`contextMenu.${value.content}`)) { + value.content = st(`contextMenu.${value.content}`, value.content); + } + const extraInfo = options.extra || options.parentMenu?.options?.extra; + const matchInput = value.content?.match(reInput); + if (matchInput) { + let match = matchInput[1]; + extraInfo?.inputs?.find((i) => { + if (i.name != match) return false; + match = i.label ? i.label : i.name; + }); + extraInfo?.widgets?.find((i) => { + if (i.name != match) return false; + match = i.label ? i.label : i.name; + }); + value.content = cvt + match + tinp; + continue; + } + const matchWidget = value.content?.match(reWidget); + if (matchWidget) { + let match = matchWidget[1]; + extraInfo?.inputs?.find((i) => { + if (i.name != match) return false; + match = i.label ? i.label : i.name; + }); + extraInfo?.widgets?.find((i) => { + if (i.name != match) return false; + match = i.label ? i.label : i.name; + }); + value.content = cvt + match + twgt; + continue; + } + } + } + __name(translateMenus, "translateMenus"); + const OriginalContextMenu = LiteGraph.ContextMenu; + function ContextMenu2(values, options) { + if (options.title) { + options.title = st( + `nodeDefs.${normalizeI18nKey(options.title)}.display_name`, + options.title + ); + } + translateMenus(values, options); + const ctx = new OriginalContextMenu(values, options); + return ctx; + } + __name(ContextMenu2, "ContextMenu"); + LiteGraph.ContextMenu = ContextMenu2; +}, "useContextMenuTranslation"); +const useCopy = /* @__PURE__ */ __name(() => { + const canvasStore = useCanvasStore(); + useEventListener(document, "copy", (e) => { + if (!(e.target instanceof Element)) { + return; + } + if (e.target instanceof HTMLTextAreaElement && e.target.type === "textarea" || e.target instanceof HTMLInputElement && e.target.type === "text") { + return; + } + const isTargetInGraph = e.target.classList.contains("litegraph") || e.target.classList.contains("graph-canvas-container") || e.target.id === "graph-canvas"; + const canvas = canvasStore.canvas; + if (isTargetInGraph && canvas?.selectedItems) { + canvas.copyToClipboard(); + e.clipboardData?.setData("text", " "); + e.preventDefault(); + e.stopImmediatePropagation(); + return false; + } + }); +}, "useCopy"); +const useGlobalLitegraph = /* @__PURE__ */ __name(() => { + window["LiteGraph"] = LiteGraph; + window["LGraph"] = LGraph; + window["LLink"] = LLink; + window["LGraphNode"] = LGraphNode; + window["LGraphGroup"] = LGraphGroup; + window["DragAndScale"] = DragAndScale; + window["LGraphCanvas"] = LGraphCanvas; + window["ContextMenu"] = ContextMenu; + window["LGraphBadge"] = LGraphBadge; +}, "useGlobalLitegraph"); +const useLitegraphSettings = /* @__PURE__ */ __name(() => { + const settingStore = useSettingStore(); + const canvasStore = useCanvasStore(); + watchEffect(() => { + const canvasInfoEnabled = settingStore.get("Comfy.Graph.CanvasInfo"); + if (canvasStore.canvas) { + canvasStore.canvas.show_info = canvasInfoEnabled; + } + }); + watchEffect(() => { + const zoomSpeed = settingStore.get("Comfy.Graph.ZoomSpeed"); + if (canvasStore.canvas) { + canvasStore.canvas.zoom_speed = zoomSpeed; + } + }); + watchEffect(() => { + LiteGraph.snaps_for_comfy = settingStore.get( + "Comfy.Node.AutoSnapLinkToSlot" + ); + }); + watchEffect(() => { + LiteGraph.snap_highlights_node = settingStore.get( + "Comfy.Node.SnapHighlightsNode" + ); + }); + watchEffect(() => { + LGraphNode.keepAllLinksOnBypass = settingStore.get( + "Comfy.Node.BypassAllLinksOnDelete" + ); + }); + watchEffect(() => { + LiteGraph.middle_click_slot_add_default_node = settingStore.get( + "Comfy.Node.MiddleClickRerouteNode" + ); + }); + watchEffect(() => { + const linkRenderMode = settingStore.get("Comfy.LinkRenderMode"); + if (canvasStore.canvas) { + canvasStore.canvas.links_render_mode = linkRenderMode; + canvasStore.canvas.setDirty( + /* fg */ + false, + /* bg */ + true + ); + } + }); + watchEffect(() => { + const lowQualityRenderingZoomThreshold = settingStore.get( + "LiteGraph.Canvas.LowQualityRenderingZoomThreshold" + ); + if (canvasStore.canvas) { + canvasStore.canvas.low_quality_zoom_threshold = lowQualityRenderingZoomThreshold; + canvasStore.canvas.setDirty( + /* fg */ + true, + /* bg */ + true + ); + } + }); + watchEffect(() => { + const linkMarkerShape = settingStore.get("Comfy.Graph.LinkMarkers"); + const { canvas } = canvasStore; + if (canvas) { + canvas.linkMarkerShape = linkMarkerShape; + canvas.setDirty(false, true); + } + }); + watchEffect(() => { + const reroutesEnabled = settingStore.get("Comfy.RerouteBeta"); + const { canvas } = canvasStore; + if (canvas) { + canvas.reroutesEnabled = reroutesEnabled; + canvas.setDirty(false, true); + } + }); + watchEffect(() => { + const maximumFps = settingStore.get("LiteGraph.Canvas.MaximumFps"); + const { canvas } = canvasStore; + if (canvas) canvas.maximumFps = maximumFps; + }); + watchEffect(() => { + const dragZoomEnabled = settingStore.get("Comfy.Graph.CtrlShiftZoom"); + const { canvas } = canvasStore; + if (canvas) canvas.dragZoomEnabled = dragZoomEnabled; + }); + watchEffect(() => { + CanvasPointer.doubleClickTime = settingStore.get( + "Comfy.Pointer.DoubleClickTime" + ); + }); + watchEffect(() => { + CanvasPointer.bufferTime = settingStore.get("Comfy.Pointer.ClickBufferTime"); + }); + watchEffect(() => { + CanvasPointer.maxClickDrift = settingStore.get("Comfy.Pointer.ClickDrift"); + }); + watchEffect(() => { + LiteGraph.CANVAS_GRID_SIZE = settingStore.get("Comfy.SnapToGrid.GridSize"); + }); + watchEffect(() => { + LiteGraph.alwaysSnapToGrid = settingStore.get("pysssss.SnapToGrid"); + }); + watchEffect(() => { + LiteGraph.context_menu_scaling = settingStore.get( + "LiteGraph.ContextMenu.Scaling" + ); + }); +}, "useLitegraphSettings"); +const usePaste = /* @__PURE__ */ __name(() => { + const workspaceStore = useWorkspaceStore(); + const canvasStore = useCanvasStore(); + useEventListener(document, "paste", async (e) => { + if (workspaceStore.shiftDown) return; + const canvas = canvasStore.canvas; + if (!canvas) return; + const graph = canvas.graph; + let data = e.clipboardData || window.clipboardData; + const items = data.items; + for (const item of items) { + if (item.type.startsWith("image/")) { + let imageNode = null; + const currentNode = canvas.current_node; + if (currentNode && currentNode.is_selected && isImageNode(currentNode)) { + imageNode = currentNode; + } + if (!imageNode) { + const newNode = LiteGraph.createNode("LoadImage"); + newNode.pos = [...canvas.graph_mouse]; + imageNode = graph.add(newNode) ?? null; + graph.change(); + } + const blob = item.getAsFile(); + imageNode?.pasteFile?.(blob); + return; + } + } + data = data.getData("text/plain"); + let workflow = null; + try { + data = data.slice(data.indexOf("{")); + workflow = JSON.parse(data); + } catch (err) { + try { + data = data.slice(data.indexOf("workflow\n")); + data = data.slice(data.indexOf("{")); + workflow = JSON.parse(data); + } catch (error) { + workflow = null; + } + } + if (workflow && workflow.version && workflow.nodes && workflow.extra) { + await app.loadGraphData(workflow); + } else { + if (e.target instanceof HTMLTextAreaElement && e.target.type === "textarea" || e.target instanceof HTMLInputElement && e.target.type === "text") { + return; + } + canvas.pasteFromClipboard(); + } + }); +}, "usePaste"); +function useWorkflowPersistence() { + const workflowStore = useWorkflowStore(); + const settingStore = useSettingStore(); + const persistCurrentWorkflow = /* @__PURE__ */ __name(() => { + const workflow = JSON.stringify(app.serializeGraph()); + localStorage.setItem("workflow", workflow); + if (api.clientId) { + sessionStorage.setItem(`workflow:${api.clientId}`, workflow); + } + }, "persistCurrentWorkflow"); + const loadWorkflowFromStorage = /* @__PURE__ */ __name(async (json, workflowName) => { + if (!json) return false; + const workflow = JSON.parse(json); + await app.loadGraphData(workflow, true, true, workflowName); + return true; + }, "loadWorkflowFromStorage"); + const loadPreviousWorkflowFromStorage = /* @__PURE__ */ __name(async () => { + const workflowName = getStorageValue("Comfy.PreviousWorkflow"); + const clientId = api.initialClientId ?? api.clientId; + if (clientId) { + const sessionWorkflow = sessionStorage.getItem(`workflow:${clientId}`); + if (await loadWorkflowFromStorage(sessionWorkflow, workflowName)) { + return true; + } + } + const localWorkflow = localStorage.getItem("workflow"); + return await loadWorkflowFromStorage(localWorkflow, workflowName); + }, "loadPreviousWorkflowFromStorage"); + const loadDefaultWorkflow = /* @__PURE__ */ __name(async () => { + if (!settingStore.get("Comfy.TutorialCompleted")) { + await settingStore.set("Comfy.TutorialCompleted", true); + await useModelStore().loadModelFolders(); + await useWorkflowService().loadTutorialWorkflow(); + } else { + await app.loadGraphData(); + } + }, "loadDefaultWorkflow"); + const restorePreviousWorkflow = /* @__PURE__ */ __name(async () => { + try { + const restored = await loadPreviousWorkflowFromStorage(); + if (!restored) { + await loadDefaultWorkflow(); + } + } catch (err) { + console.error("Error loading previous workflow", err); + await loadDefaultWorkflow(); + } + }, "restorePreviousWorkflow"); + watchEffect(() => { + if (workflowStore.activeWorkflow) { + const workflow = workflowStore.activeWorkflow; + setStorageValue("Comfy.PreviousWorkflow", workflow.key); + persistCurrentWorkflow(); + } + }); + api.addEventListener("graphChanged", persistCurrentWorkflow); + const openWorkflows = computed(() => workflowStore.openWorkflows); + const activeWorkflow = computed(() => workflowStore.activeWorkflow); + const restoreState = computed( + () => { + if (!openWorkflows.value || !activeWorkflow.value) { + return { paths: [], activeIndex: -1 }; + } + const paths = openWorkflows.value.filter((workflow) => workflow?.isPersisted && !workflow.isModified).map((workflow) => workflow.path); + const activeIndex = openWorkflows.value.findIndex( + (workflow) => workflow.path === activeWorkflow.value?.path + ); + return { paths, activeIndex }; + } + ); + const storedWorkflows = JSON.parse( + getStorageValue("Comfy.OpenWorkflowsPaths") || "[]" + ); + const storedActiveIndex = JSON.parse( + getStorageValue("Comfy.ActiveWorkflowIndex") || "-1" + ); + watch(restoreState, ({ paths, activeIndex }) => { + setStorageValue("Comfy.OpenWorkflowsPaths", JSON.stringify(paths)); + setStorageValue("Comfy.ActiveWorkflowIndex", JSON.stringify(activeIndex)); + }); + const restoreWorkflowTabsState = /* @__PURE__ */ __name(() => { + const isRestorable = storedWorkflows?.length > 0 && storedActiveIndex >= 0; + if (isRestorable) { + workflowStore.openWorkflowsInBackground({ + left: storedWorkflows.slice(0, storedActiveIndex), + right: storedWorkflows.slice(storedActiveIndex) + }); + } + }, "restoreWorkflowTabsState"); + return { + restorePreviousWorkflow, + restoreWorkflowTabsState + }; +} +__name(useWorkflowPersistence, "useWorkflowPersistence"); const CORE_SETTINGS = [ { id: "Comfy.Validation.Workflows", @@ -2018,6 +2443,18 @@ const CORE_SETTINGS = [ }, defaultValue: 0 }, + { + id: "LiteGraph.Node.TooltipDelay", + name: "Tooltip Delay", + type: "number", + attrs: { + min: 100, + max: 3e3, + step: 50 + }, + defaultValue: 500, + versionAdded: "1.9.0" + }, { id: "Comfy.EnableTooltips", category: ["LiteGraph", "Node", "EnableTooltips"], @@ -2296,7 +2733,7 @@ const CORE_SETTINGS = [ }, { id: "LiteGraph.Canvas.MaximumFps", - name: "Maxium FPS", + name: "Maximum 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: { @@ -2361,173 +2798,21 @@ const CORE_SETTINGS = [ defaultValue: false, type: "boolean", versionAdded: "1.8.8" + }, + { + id: "LiteGraph.Canvas.LowQualityRenderingZoomThreshold", + name: "Low quality rendering zoom threshold", + tooltip: "Render low quality shapes when zoomed out", + type: "slider", + attrs: { + min: 0.1, + max: 1, + step: 0.01 + }, + defaultValue: 0.6, + versionAdded: "1.9.1" } ]; -const useCanvasDrop = /* @__PURE__ */ __name((canvasRef) => { - const modelToNodeStore = useModelToNodeStore(); - const litegraphService = useLitegraphService(); - usePragmaticDroppable(() => canvasRef.value, { - getDropEffect: /* @__PURE__ */ __name((args) => args.source.data.type === "tree-explorer-node" ? "copy" : "move", "getDropEffect"), - onDrop: /* @__PURE__ */ __name((event) => { - const loc = event.location.current.input; - const dndData = event.source.data; - if (dndData.type === "tree-explorer-node") { - const node = dndData.data; - if (node.data instanceof ComfyNodeDefImpl) { - const nodeDef = node.data; - const pos = app.clientPosToCanvasPos([ - loc.clientX, - loc.clientY + LiteGraph.NODE_TITLE_HEIGHT - ]); - litegraphService.addNodeOnGraph(nodeDef, { pos }); - } else if (node.data instanceof ComfyModelDef) { - const model = node.data; - const pos = app.clientPosToCanvasPos([loc.clientX, loc.clientY]); - const nodeAtPos = app.graph.getNodeOnPos(pos[0], pos[1]); - let targetProvider = null; - let targetGraphNode = null; - if (nodeAtPos) { - const providers = modelToNodeStore.getAllNodeProviders( - model.directory - ); - for (const provider of providers) { - if (provider.nodeDef.name === nodeAtPos.comfyClass) { - targetGraphNode = nodeAtPos; - targetProvider = provider; - } - } - } - if (!targetGraphNode) { - const provider = modelToNodeStore.getNodeProvider(model.directory); - if (provider) { - targetGraphNode = litegraphService.addNodeOnGraph( - provider.nodeDef, - { - pos - } - ); - targetProvider = provider; - } - } - if (targetGraphNode) { - const widget = targetGraphNode.widgets?.find( - (widget2) => widget2.name === targetProvider?.key - ); - if (widget) { - widget.value = model.file_name; - } - } - } - } - }, "onDrop") - }); -}, "useCanvasDrop"); -const useGlobalLitegraph = /* @__PURE__ */ __name(() => { - window["LiteGraph"] = LiteGraph; - window["LGraph"] = LGraph; - window["LLink"] = LLink; - window["LGraphNode"] = LGraphNode; - window["LGraphGroup"] = LGraphGroup; - window["DragAndScale"] = DragAndScale; - window["LGraphCanvas"] = LGraphCanvas; - window["ContextMenu"] = ContextMenu; - window["LGraphBadge"] = LGraphBadge; -}, "useGlobalLitegraph"); -function useWorkflowPersistence() { - const workflowStore = useWorkflowStore(); - const settingStore = useSettingStore(); - const persistCurrentWorkflow = /* @__PURE__ */ __name(() => { - const workflow = JSON.stringify(app.serializeGraph()); - localStorage.setItem("workflow", workflow); - if (api.clientId) { - sessionStorage.setItem(`workflow:${api.clientId}`, workflow); - } - }, "persistCurrentWorkflow"); - const loadWorkflowFromStorage = /* @__PURE__ */ __name(async (json, workflowName) => { - if (!json) return false; - const workflow = JSON.parse(json); - await app.loadGraphData(workflow, true, true, workflowName); - return true; - }, "loadWorkflowFromStorage"); - const loadPreviousWorkflowFromStorage = /* @__PURE__ */ __name(async () => { - const workflowName = getStorageValue("Comfy.PreviousWorkflow"); - const clientId = api.initialClientId ?? api.clientId; - if (clientId) { - const sessionWorkflow = sessionStorage.getItem(`workflow:${clientId}`); - if (await loadWorkflowFromStorage(sessionWorkflow, workflowName)) { - return true; - } - } - const localWorkflow = localStorage.getItem("workflow"); - return await loadWorkflowFromStorage(localWorkflow, workflowName); - }, "loadPreviousWorkflowFromStorage"); - const loadDefaultWorkflow = /* @__PURE__ */ __name(async () => { - if (!settingStore.get("Comfy.TutorialCompleted")) { - await settingStore.set("Comfy.TutorialCompleted", true); - await useModelStore().loadModelFolders(); - await useWorkflowService().loadTutorialWorkflow(); - } else { - await app.loadGraphData(); - } - }, "loadDefaultWorkflow"); - const restorePreviousWorkflow = /* @__PURE__ */ __name(async () => { - try { - const restored = await loadPreviousWorkflowFromStorage(); - if (!restored) { - await loadDefaultWorkflow(); - } - } catch (err) { - console.error("Error loading previous workflow", err); - await loadDefaultWorkflow(); - } - }, "restorePreviousWorkflow"); - watchEffect(() => { - if (workflowStore.activeWorkflow) { - const workflow = workflowStore.activeWorkflow; - setStorageValue("Comfy.PreviousWorkflow", workflow.key); - persistCurrentWorkflow(); - } - }); - api.addEventListener("graphChanged", persistCurrentWorkflow); - const openWorkflows = computed(() => workflowStore.openWorkflows); - const activeWorkflow = computed(() => workflowStore.activeWorkflow); - const restoreState = computed( - () => { - if (!openWorkflows.value || !activeWorkflow.value) { - return { paths: [], activeIndex: -1 }; - } - const paths = openWorkflows.value.filter((workflow) => workflow?.isPersisted && !workflow.isModified).map((workflow) => workflow.path); - const activeIndex = openWorkflows.value.findIndex( - (workflow) => workflow.path === activeWorkflow.value?.path - ); - return { paths, activeIndex }; - } - ); - const storedWorkflows = JSON.parse( - getStorageValue("Comfy.OpenWorkflowsPaths") || "[]" - ); - const storedActiveIndex = JSON.parse( - getStorageValue("Comfy.ActiveWorkflowIndex") || "-1" - ); - watch(restoreState, ({ paths, activeIndex }) => { - setStorageValue("Comfy.OpenWorkflowsPaths", JSON.stringify(paths)); - setStorageValue("Comfy.ActiveWorkflowIndex", JSON.stringify(activeIndex)); - }); - const restoreWorkflowTabsState = /* @__PURE__ */ __name(() => { - const isRestorable = storedWorkflows?.length > 0 && storedActiveIndex >= 0; - if (isRestorable) { - workflowStore.openWorkflowsInBackground({ - left: storedWorkflows.slice(0, storedActiveIndex), - right: storedWorkflows.slice(storedActiveIndex) - }); - } - }, "restoreWorkflowTabsState"); - return { - restorePreviousWorkflow, - restoreWorkflowTabsState - }; -} -__name(useWorkflowPersistence, "useWorkflowPersistence"); const _sfc_main$8 = /* @__PURE__ */ defineComponent({ __name: "GraphCanvas", emits: ["ready"], @@ -2548,36 +2833,6 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({ () => settingStore.get("Comfy.Graph.CanvasMenu") ); const tooltipEnabled = computed(() => settingStore.get("Comfy.EnableTooltips")); - watchEffect(() => { - const canvasInfoEnabled = settingStore.get("Comfy.Graph.CanvasInfo"); - if (canvasStore.canvas) { - canvasStore.canvas.show_info = canvasInfoEnabled; - } - }); - watchEffect(() => { - const zoomSpeed = settingStore.get("Comfy.Graph.ZoomSpeed"); - if (canvasStore.canvas) { - canvasStore.canvas.zoom_speed = zoomSpeed; - } - }); - watchEffect(() => { - LiteGraph.snaps_for_comfy = settingStore.get("Comfy.Node.AutoSnapLinkToSlot"); - }); - watchEffect(() => { - LiteGraph.snap_highlights_node = settingStore.get( - "Comfy.Node.SnapHighlightsNode" - ); - }); - watchEffect(() => { - LGraphNode.keepAllLinksOnBypass = settingStore.get( - "Comfy.Node.BypassAllLinksOnDelete" - ); - }); - watchEffect(() => { - LiteGraph.middle_click_slot_add_default_node = settingStore.get( - "Comfy.Node.MiddleClickRerouteNode" - ); - }); watchEffect(() => { nodeDefStore.showDeprecated = settingStore.get("Comfy.Node.ShowDeprecated"); }); @@ -2595,56 +2850,6 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({ textarea.blur(); }); }); - watchEffect(() => { - const linkRenderMode = settingStore.get("Comfy.LinkRenderMode"); - if (canvasStore.canvas) { - canvasStore.canvas.links_render_mode = linkRenderMode; - canvasStore.canvas.setDirty( - /* fg */ - false, - /* bg */ - true - ); - } - }); - watchEffect(() => { - const linkMarkerShape = settingStore.get("Comfy.Graph.LinkMarkers"); - const { canvas } = canvasStore; - if (canvas) { - canvas.linkMarkerShape = linkMarkerShape; - canvas.setDirty(false, true); - } - }); - watchEffect(() => { - const reroutesEnabled = settingStore.get("Comfy.RerouteBeta"); - const { canvas } = canvasStore; - if (canvas) { - canvas.reroutesEnabled = reroutesEnabled; - canvas.setDirty(false, true); - } - }); - watchEffect(() => { - const maximumFps = settingStore.get("LiteGraph.Canvas.MaximumFps"); - const { canvas } = canvasStore; - if (canvas) canvas.maximumFps = maximumFps; - }); - watchEffect(() => { - CanvasPointer.doubleClickTime = settingStore.get( - "Comfy.Pointer.DoubleClickTime" - ); - }); - watchEffect(() => { - CanvasPointer.bufferTime = settingStore.get("Comfy.Pointer.ClickBufferTime"); - }); - watchEffect(() => { - CanvasPointer.maxClickDrift = settingStore.get("Comfy.Pointer.ClickDrift"); - }); - watchEffect(() => { - LiteGraph.CANVAS_GRID_SIZE = settingStore.get("Comfy.SnapToGrid.GridSize"); - }); - watchEffect(() => { - LiteGraph.alwaysSnapToGrid = settingStore.get("pysssss.SnapToGrid"); - }); watch( () => settingStore.get("Comfy.WidgetControlMode"), () => { @@ -2680,11 +2885,6 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({ settingStore.set("Comfy.ColorPalette", newValue); } ); - watchEffect(() => { - LiteGraph.context_menu_scaling = settingStore.get( - "LiteGraph.ContextMenu.Scaling" - ); - }); const loadCustomNodesI18n = /* @__PURE__ */ __name(async () => { try { const i18nData = await api.getCustomNodesI18n(); @@ -2698,8 +2898,12 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({ const comfyAppReady = ref(false); const workflowPersistence = useWorkflowPersistence(); useCanvasDrop(canvasRef); + useLitegraphSettings(); onMounted(async () => { useGlobalLitegraph(); + useContextMenuTranslation(); + useCopy(); + usePaste(); app.vueAppReady = true; workspaceStore.spinner = true; ChangeTracker.init(app); @@ -2731,31 +2935,36 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({ }); return (_ctx, _cache) => { return openBlock(), createElementBlock(Fragment, null, [ - (openBlock(), createBlock(Teleport, { to: ".graph-canvas-container" }, [ - comfyAppReady.value && betaMenuEnabled.value && !unref(workspaceStore).focusMode ? (openBlock(), createBlock(LiteGraphCanvasSplitterOverlay, { key: 0 }, { - "side-bar-panel": withCtx(() => [ - createVNode(SideToolbar) - ]), - "bottom-panel": withCtx(() => [ - createVNode(_sfc_main$p) - ]), - "graph-canvas-panel": withCtx(() => [ - workflowTabsPosition.value === "Topbar (2nd-row)" ? (openBlock(), createBlock(SecondRowWorkflowTabs, { key: 0 })) : createCommentVNode("", true), - canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { key: 1 })) : createCommentVNode("", true) - ]), - _: 1 - })) : createCommentVNode("", true), - createVNode(TitleEditor), - !betaMenuEnabled.value && canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { key: 1 })) : createCommentVNode("", true), - createBaseVNode("canvas", { - ref_key: "canvasRef", - ref: canvasRef, - id: "graph-canvas", - tabindex: "1" - }, null, 512) - ])), + comfyAppReady.value && betaMenuEnabled.value && !unref(workspaceStore).focusMode ? (openBlock(), createBlock(LiteGraphCanvasSplitterOverlay, { key: 0 }, { + "side-bar-panel": withCtx(() => [ + createVNode(SideToolbar) + ]), + "bottom-panel": withCtx(() => [ + createVNode(_sfc_main$p) + ]), + "graph-canvas-panel": withCtx(() => [ + workflowTabsPosition.value === "Topbar (2nd-row)" ? (openBlock(), createBlock(SecondRowWorkflowTabs, { + key: 0, + class: "pointer-events-auto" + })) : createCommentVNode("", true), + canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { + key: 1, + class: "pointer-events-auto" + })) : createCommentVNode("", true) + ]), + _: 1 + })) : createCommentVNode("", true), + createVNode(TitleEditor), + !betaMenuEnabled.value && canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { key: 1 })) : createCommentVNode("", true), + createBaseVNode("canvas", { + ref_key: "canvasRef", + ref: canvasRef, + id: "graph-canvas", + tabindex: "1", + class: "w-full h-full touch-none" + }, null, 512), createVNode(_sfc_main$h), - tooltipEnabled.value ? (openBlock(), createBlock(NodeTooltip, { key: 0 })) : createCommentVNode("", true), + tooltipEnabled.value ? (openBlock(), createBlock(NodeTooltip, { key: 2 })) : createCommentVNode("", true), createVNode(_sfc_main$n) ], 64); }; @@ -2835,13 +3044,13 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$9 = { +const _hoisted_1$a = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; function render$5(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$9, _cache[0] || (_cache[0] = [ + return openBlock(), createElementBlock("svg", _hoisted_1$a, _cache[0] || (_cache[0] = [ createBaseVNode("path", { fill: "none", stroke: "currentColor", @@ -2854,13 +3063,13 @@ function render$5(_ctx, _cache) { } __name(render$5, "render$5"); const __unplugin_components_3 = markRaw({ name: "lucide-step-forward", render: render$5 }); -const _hoisted_1$8 = { +const _hoisted_1$9 = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; function render$4(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$8, _cache[0] || (_cache[0] = [ + return openBlock(), createElementBlock("svg", _hoisted_1$9, _cache[0] || (_cache[0] = [ createBaseVNode("path", { fill: "none", stroke: "currentColor", @@ -2873,13 +3082,13 @@ function render$4(_ctx, _cache) { } __name(render$4, "render$4"); const __unplugin_components_2 = markRaw({ name: "lucide-fast-forward", render: render$4 }); -const _hoisted_1$7 = { +const _hoisted_1$8 = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; function render$3(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$7, _cache[0] || (_cache[0] = [ + return openBlock(), createElementBlock("svg", _hoisted_1$8, _cache[0] || (_cache[0] = [ createBaseVNode("path", { fill: "none", stroke: "currentColor", @@ -2892,13 +3101,13 @@ function render$3(_ctx, _cache) { } __name(render$3, "render$3"); const __unplugin_components_1$1 = markRaw({ name: "lucide-play", render: render$3 }); -const _hoisted_1$6 = { +const _hoisted_1$7 = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; function render$2(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$6, _cache[0] || (_cache[0] = [ + return openBlock(), createElementBlock("svg", _hoisted_1$7, _cache[0] || (_cache[0] = [ createBaseVNode("g", { fill: "none", stroke: "currentColor", @@ -2913,7 +3122,7 @@ function render$2(_ctx, _cache) { } __name(render$2, "render$2"); const __unplugin_components_0$1 = markRaw({ name: "lucide-list-start", render: render$2 }); -const _hoisted_1$5 = ["aria-label"]; +const _hoisted_1$6 = ["aria-label"]; const minQueueCount = 1; const _sfc_main$6 = /* @__PURE__ */ defineComponent({ __name: "BatchCountEdit", @@ -2968,7 +3177,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({ } } }, null, 8, ["modelValue", "max", "pt"]) - ], 10, _hoisted_1$5)), [ + ], 10, _hoisted_1$6)), [ [ _directive_tooltip, _ctx.$t("menu.batchCount"), @@ -2980,7 +3189,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({ } }); const BatchCountEdit = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-26957f1f"]]); -const _hoisted_1$4 = { class: "queue-button-group flex" }; +const _hoisted_1$5 = { class: "queue-button-group flex" }; const _sfc_main$5 = /* @__PURE__ */ defineComponent({ __name: "ComfyQueueButton", setup(__props) { @@ -3033,7 +3242,7 @@ const _sfc_main$5 = /* @__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$4, [ + return openBlock(), createElementBlock("div", _hoisted_1$5, [ withDirectives((openBlock(), createBlock(unref(script$h), { class: "comfyui-queue-button", label: activeQueueModeMenuItem.value.label, @@ -3263,7 +3472,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ }, { default: withCtx(() => [ createBaseVNode("div", { - class: "actionbar-content flex items-center", + class: "actionbar-content flex items-center select-none", ref_key: "panelRef", ref: panelRef }, [ @@ -3280,14 +3489,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ }; } }); -const Actionbar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-915e5456"]]); -const _hoisted_1$3 = { +const Actionbar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-ebd56d51"]]); +const _hoisted_1$4 = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; function render$1(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$3, _cache[0] || (_cache[0] = [ + return openBlock(), createElementBlock("svg", _hoisted_1$4, _cache[0] || (_cache[0] = [ 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" @@ -3296,13 +3505,13 @@ function render$1(_ctx, _cache) { } __name(render$1, "render$1"); const __unplugin_components_1 = markRaw({ name: "material-symbols-dock-to-bottom-outline", render: render$1 }); -const _hoisted_1$2 = { +const _hoisted_1$3 = { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em" }; function render(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$2, _cache[0] || (_cache[0] = [ + return openBlock(), createElementBlock("svg", _hoisted_1$3, _cache[0] || (_cache[0] = [ 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" @@ -3336,9 +3545,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1$1 = ["href"]; -const _hoisted_2$1 = { class: "p-menubar-item-label" }; -const _hoisted_3$1 = { +const _hoisted_1$2 = ["href"]; +const _hoisted_2$2 = { class: "p-menubar-item-label" }; +const _hoisted_3$2 = { key: 1, class: "ml-auto border border-surface rounded text-muted text-xs text-nowrap p-1 keybinding-tag" }; @@ -3382,9 +3591,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({ key: 0, class: normalizeClass(["p-menubar-item-icon", item.icon]) }, null, 2)) : createCommentVNode("", true), - createBaseVNode("span", _hoisted_2$1, toDisplayString(item.label), 1), - item?.comfyCommand?.keybinding ? (openBlock(), createElementBlock("span", _hoisted_3$1, toDisplayString(item.comfyCommand.keybinding.combo.toString()), 1)) : createCommentVNode("", true) - ], 16, _hoisted_1$1) + createBaseVNode("span", _hoisted_2$2, toDisplayString(item.label), 1), + item?.comfyCommand?.keybinding ? (openBlock(), createElementBlock("span", _hoisted_3$2, toDisplayString(item.comfyCommand.keybinding.combo.toString()), 1)) : createCommentVNode("", true) + ], 16, _hoisted_1$2) ]), _: 1 }, 8, ["model", "pt"]); @@ -3392,9 +3601,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({ } }); const CommandMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-56df69d2"]]); -const _hoisted_1 = { class: "flex-grow min-w-0 app-drag h-full" }; -const _hoisted_2 = { class: "window-actions-spacer flex-shrink-0" }; -const _hoisted_3 = { class: "fixed top-0 left-0 app-drag w-full h-[var(--comfy-topbar-height)]" }; +const _hoisted_1$1 = { class: "flex-grow min-w-0 app-drag h-full" }; +const _hoisted_2$1 = { class: "window-actions-spacer flex-shrink-0" }; +const _hoisted_3$1 = { class: "fixed top-0 left-0 app-drag w-full h-[var(--comfy-topbar-height)]" }; const _sfc_main$1 = /* @__PURE__ */ defineComponent({ __name: "TopMenubar", setup(__props) { @@ -3405,9 +3614,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ ); const menuSetting = computed(() => settingStore.get("Comfy.UseNewMenu")); const betaMenuEnabled = computed(() => menuSetting.value !== "Disabled"); - const teleportTarget = computed( - () => settingStore.get("Comfy.UseNewMenu") === "Top" ? ".comfyui-body-top" : ".comfyui-body-bottom" - ); const showTopMenu = computed( () => betaMenuEnabled.value && !workspaceState.focusMode ); @@ -3438,50 +3644,577 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); return openBlock(), createElementBlock(Fragment, null, [ - (openBlock(), createBlock(Teleport, { to: teleportTarget.value }, [ - withDirectives(createBaseVNode("div", { - ref_key: "topMenuRef", - ref: topMenuRef, - class: normalizeClass(["comfyui-menu flex items-center", { dropzone: isDropZone.value, "dropzone-active": isDroppable.value }]) - }, [ - _cache[1] || (_cache[1] = createBaseVNode("h1", { class: "comfyui-logo mx-2 app-drag" }, "ComfyUI", -1)), - createVNode(CommandMenubar), - createBaseVNode("div", _hoisted_1, [ - workflowTabsPosition.value === "Topbar" ? (openBlock(), createBlock(WorkflowTabs, { key: 0 })) : createCommentVNode("", true) - ]), - createBaseVNode("div", { - class: "comfyui-menu-right", - ref_key: "menuRight", - ref: menuRight - }, null, 512), - createVNode(Actionbar), - createVNode(_sfc_main$3, { class: "flex-shrink-0" }), - withDirectives(createVNode(unref(script), { - class: "flex-shrink-0", - icon: "pi pi-bars", - severity: "secondary", - text: "", - "aria-label": _ctx.$t("menu.hideMenu"), - onClick: _cache[0] || (_cache[0] = ($event) => unref(workspaceState).focusMode = true), - onContextmenu: unref(showNativeMenu) - }, null, 8, ["aria-label", "onContextmenu"]), [ - [_directive_tooltip, { value: _ctx.$t("menu.hideMenu"), showDelay: 300 }] - ]), - withDirectives(createBaseVNode("div", _hoisted_2, null, 512), [ - [vShow, menuSetting.value !== "Bottom"] - ]) - ], 2), [ - [vShow, showTopMenu.value] + withDirectives(createBaseVNode("div", { + ref_key: "topMenuRef", + ref: topMenuRef, + class: normalizeClass(["comfyui-menu flex items-center", { dropzone: isDropZone.value, "dropzone-active": isDroppable.value }]) + }, [ + _cache[1] || (_cache[1] = createBaseVNode("h1", { class: "comfyui-logo mx-2 app-drag" }, "ComfyUI", -1)), + createVNode(CommandMenubar), + createBaseVNode("div", _hoisted_1$1, [ + workflowTabsPosition.value === "Topbar" ? (openBlock(), createBlock(WorkflowTabs, { key: 0 })) : createCommentVNode("", true) + ]), + createBaseVNode("div", { + class: "comfyui-menu-right flex-shrink-0", + ref_key: "menuRight", + ref: menuRight + }, null, 512), + createVNode(Actionbar), + createVNode(_sfc_main$3, { class: "flex-shrink-0" }), + withDirectives(createVNode(unref(script), { + class: "flex-shrink-0", + icon: "pi pi-bars", + severity: "secondary", + text: "", + "aria-label": _ctx.$t("menu.hideMenu"), + onClick: _cache[0] || (_cache[0] = ($event) => unref(workspaceState).focusMode = true), + onContextmenu: unref(showNativeMenu) + }, null, 8, ["aria-label", "onContextmenu"]), [ + [_directive_tooltip, { value: _ctx.$t("menu.hideMenu"), showDelay: 300 }] + ]), + withDirectives(createBaseVNode("div", _hoisted_2$1, null, 512), [ + [vShow, menuSetting.value !== "Bottom"] ]) - ], 8, ["to"])), - withDirectives(createBaseVNode("div", _hoisted_3, null, 512), [ + ], 2), [ + [vShow, showTopMenu.value] + ]), + withDirectives(createBaseVNode("div", _hoisted_3$1, null, 512), [ [vShow, unref(isNativeWindow)() && !showTopMenu.value] ]) ], 64); }; } }); -const TopMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-929e7543"]]); +const TopMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-68d3b5b9"]]); +function useCoreCommands() { + const workflowService = useWorkflowService(); + const workflowStore = useWorkflowStore(); + const dialogService = useDialogService(); + const colorPaletteStore = useColorPaletteStore(); + const getTracker = /* @__PURE__ */ __name(() => workflowStore.activeWorkflow?.changeTracker, "getTracker"); + const getSelectedNodes = /* @__PURE__ */ __name(() => { + const selectedNodes = app.canvas.selected_nodes; + const result = []; + if (selectedNodes) { + for (const i in selectedNodes) { + const node = selectedNodes[i]; + result.push(node); + } + } + return result; + }, "getSelectedNodes"); + const toggleSelectedNodesMode = /* @__PURE__ */ __name((mode) => { + getSelectedNodes().forEach((node) => { + if (node.mode === mode) { + node.mode = LGraphEventMode.ALWAYS; + } else { + node.mode = mode; + } + }); + }, "toggleSelectedNodesMode"); + return [ + { + id: "Comfy.NewBlankWorkflow", + icon: "pi pi-plus", + label: "New Blank Workflow", + menubarLabel: "New", + function: /* @__PURE__ */ __name(() => workflowService.loadBlankWorkflow(), "function") + }, + { + id: "Comfy.OpenWorkflow", + icon: "pi pi-folder-open", + label: "Open Workflow", + menubarLabel: "Open", + function: /* @__PURE__ */ __name(() => { + app.ui.loadFile(); + }, "function") + }, + { + id: "Comfy.LoadDefaultWorkflow", + icon: "pi pi-code", + label: "Load Default Workflow", + function: /* @__PURE__ */ __name(() => workflowService.loadDefaultWorkflow(), "function") + }, + { + id: "Comfy.SaveWorkflow", + icon: "pi pi-save", + label: "Save Workflow", + menubarLabel: "Save", + function: /* @__PURE__ */ __name(async () => { + const workflow = useWorkflowStore().activeWorkflow; + if (!workflow) return; + await workflowService.saveWorkflow(workflow); + }, "function") + }, + { + id: "Comfy.SaveWorkflowAs", + icon: "pi pi-save", + label: "Save Workflow As", + menubarLabel: "Save As", + function: /* @__PURE__ */ __name(async () => { + const workflow = useWorkflowStore().activeWorkflow; + if (!workflow) return; + await workflowService.saveWorkflowAs(workflow); + }, "function") + }, + { + id: "Comfy.ExportWorkflow", + icon: "pi pi-download", + label: "Export Workflow", + menubarLabel: "Export", + function: /* @__PURE__ */ __name(() => { + workflowService.exportWorkflow("workflow", "workflow"); + }, "function") + }, + { + id: "Comfy.ExportWorkflowAPI", + icon: "pi pi-download", + label: "Export Workflow (API Format)", + menubarLabel: "Export (API)", + function: /* @__PURE__ */ __name(() => { + workflowService.exportWorkflow("workflow_api", "output"); + }, "function") + }, + { + id: "Comfy.Undo", + icon: "pi pi-undo", + label: "Undo", + function: /* @__PURE__ */ __name(async () => { + await getTracker()?.undo?.(); + }, "function") + }, + { + id: "Comfy.Redo", + icon: "pi pi-refresh", + label: "Redo", + function: /* @__PURE__ */ __name(async () => { + await getTracker()?.redo?.(); + }, "function") + }, + { + id: "Comfy.ClearWorkflow", + icon: "pi pi-trash", + label: "Clear Workflow", + function: /* @__PURE__ */ __name(() => { + const settingStore = useSettingStore(); + if (!settingStore.get("Comfy.ComfirmClear") || confirm("Clear workflow?")) { + app.clean(); + app.graph.clear(); + api.dispatchCustomEvent("graphCleared"); + } + }, "function") + }, + { + id: "Comfy.Canvas.ResetView", + icon: "pi pi-expand", + label: "Reset View", + function: /* @__PURE__ */ __name(() => { + useLitegraphService().resetView(); + }, "function") + }, + { + id: "Comfy.OpenClipspace", + icon: "pi pi-clipboard", + label: "Clipspace", + function: /* @__PURE__ */ __name(() => { + app.openClipspace(); + }, "function") + }, + { + id: "Comfy.RefreshNodeDefinitions", + icon: "pi pi-refresh", + label: "Refresh Node Definitions", + function: /* @__PURE__ */ __name(async () => { + await app.refreshComboInNodes(); + }, "function") + }, + { + id: "Comfy.Interrupt", + icon: "pi pi-stop", + label: "Interrupt", + function: /* @__PURE__ */ __name(async () => { + await api.interrupt(); + useToastStore().add({ + severity: "info", + summary: "Interrupted", + detail: "Execution has been interrupted", + life: 1e3 + }); + }, "function") + }, + { + id: "Comfy.ClearPendingTasks", + icon: "pi pi-stop", + label: "Clear Pending Tasks", + function: /* @__PURE__ */ __name(async () => { + await useQueueStore().clear(["queue"]); + useToastStore().add({ + severity: "info", + summary: "Confirmed", + detail: "Pending tasks deleted", + life: 3e3 + }); + }, "function") + }, + { + id: "Comfy.BrowseTemplates", + icon: "pi pi-folder-open", + label: "Browse Templates", + function: /* @__PURE__ */ __name(() => { + dialogService.showTemplateWorkflowsDialog(); + }, "function") + }, + { + id: "Comfy.Canvas.ZoomIn", + icon: "pi pi-plus", + label: "Zoom In", + function: /* @__PURE__ */ __name(() => { + const ds = app.canvas.ds; + ds.changeScale( + ds.scale * 1.1, + ds.element ? [ds.element.width / 2, ds.element.height / 2] : void 0 + ); + app.canvas.setDirty(true, true); + }, "function") + }, + { + id: "Comfy.Canvas.ZoomOut", + icon: "pi pi-minus", + label: "Zoom Out", + function: /* @__PURE__ */ __name(() => { + const ds = app.canvas.ds; + ds.changeScale( + ds.scale / 1.1, + ds.element ? [ds.element.width / 2, ds.element.height / 2] : void 0 + ); + app.canvas.setDirty(true, true); + }, "function") + }, + { + id: "Comfy.Canvas.FitView", + icon: "pi pi-expand", + label: "Fit view to selected nodes", + function: /* @__PURE__ */ __name(() => { + if (app.canvas.empty) { + useToastStore().add({ + severity: "error", + summary: "Empty canvas", + life: 3e3 + }); + return; + } + app.canvas.fitViewToSelectionAnimated(); + }, "function") + }, + { + id: "Comfy.Canvas.ToggleLock", + icon: "pi pi-lock", + label: "Canvas Toggle Lock", + function: /* @__PURE__ */ __name(() => { + app.canvas["read_only"] = !app.canvas["read_only"]; + }, "function") + }, + { + id: "Comfy.Canvas.ToggleLinkVisibility", + icon: "pi pi-eye", + label: "Canvas Toggle Link Visibility", + versionAdded: "1.3.6", + function: (() => { + const settingStore = useSettingStore(); + let lastLinksRenderMode = LiteGraph.SPLINE_LINK; + return () => { + const currentMode = settingStore.get("Comfy.LinkRenderMode"); + if (currentMode === LiteGraph.HIDDEN_LINK) { + settingStore.set("Comfy.LinkRenderMode", lastLinksRenderMode); + } else { + lastLinksRenderMode = currentMode; + settingStore.set("Comfy.LinkRenderMode", LiteGraph.HIDDEN_LINK); + } + }; + })() + }, + { + id: "Comfy.QueuePrompt", + icon: "pi pi-play", + label: "Queue Prompt", + versionAdded: "1.3.7", + function: /* @__PURE__ */ __name(() => { + const batchCount = useQueueSettingsStore().batchCount; + app.queuePrompt(0, batchCount); + }, "function") + }, + { + id: "Comfy.QueuePromptFront", + icon: "pi pi-play", + label: "Queue Prompt (Front)", + versionAdded: "1.3.7", + function: /* @__PURE__ */ __name(() => { + const batchCount = useQueueSettingsStore().batchCount; + app.queuePrompt(-1, batchCount); + }, "function") + }, + { + id: "Comfy.ShowSettingsDialog", + icon: "pi pi-cog", + label: "Show Settings Dialog", + versionAdded: "1.3.7", + function: /* @__PURE__ */ __name(() => { + dialogService.showSettingsDialog(); + }, "function") + }, + { + id: "Comfy.Graph.GroupSelectedNodes", + icon: "pi pi-sitemap", + label: "Group Selected Nodes", + versionAdded: "1.3.7", + function: /* @__PURE__ */ __name(() => { + const { canvas } = app; + if (!canvas.selectedItems?.size) { + useToastStore().add({ + severity: "error", + summary: "Nothing to group", + detail: "Please select the nodes (or other groups) to create a group for", + life: 3e3 + }); + return; + } + const group = new LGraphGroup(); + const padding = useSettingStore().get( + "Comfy.GroupSelectedNodes.Padding" + ); + group.resizeTo(canvas.selectedItems, padding); + canvas.graph.add(group); + useTitleEditorStore().titleEditorTarget = group; + }, "function") + }, + { + id: "Workspace.NextOpenedWorkflow", + icon: "pi pi-step-forward", + label: "Next Opened Workflow", + versionAdded: "1.3.9", + function: /* @__PURE__ */ __name(() => { + workflowService.loadNextOpenedWorkflow(); + }, "function") + }, + { + id: "Workspace.PreviousOpenedWorkflow", + icon: "pi pi-step-backward", + label: "Previous Opened Workflow", + versionAdded: "1.3.9", + function: /* @__PURE__ */ __name(() => { + workflowService.loadPreviousOpenedWorkflow(); + }, "function") + }, + { + id: "Comfy.Canvas.ToggleSelectedNodes.Mute", + icon: "pi pi-volume-off", + label: "Mute/Unmute Selected Nodes", + versionAdded: "1.3.11", + function: /* @__PURE__ */ __name(() => { + toggleSelectedNodesMode(LGraphEventMode.NEVER); + }, "function") + }, + { + id: "Comfy.Canvas.ToggleSelectedNodes.Bypass", + icon: "pi pi-shield", + label: "Bypass/Unbypass Selected Nodes", + versionAdded: "1.3.11", + function: /* @__PURE__ */ __name(() => { + toggleSelectedNodesMode(LGraphEventMode.BYPASS); + }, "function") + }, + { + id: "Comfy.Canvas.ToggleSelectedNodes.Pin", + icon: "pi pi-pin", + label: "Pin/Unpin Selected Nodes", + versionAdded: "1.3.11", + function: /* @__PURE__ */ __name(() => { + getSelectedNodes().forEach((node) => { + node.pin(!node.pinned); + }); + }, "function") + }, + { + id: "Comfy.Canvas.ToggleSelected.Pin", + icon: "pi pi-pin", + label: "Pin/Unpin Selected Items", + versionAdded: "1.3.33", + function: /* @__PURE__ */ __name(() => { + for (const item of app.canvas.selectedItems) { + if (item instanceof LGraphNode || item instanceof LGraphGroup) { + item.pin(!item.pinned); + } + } + }, "function") + }, + { + id: "Comfy.Canvas.ToggleSelectedNodes.Collapse", + icon: "pi pi-minus", + label: "Collapse/Expand Selected Nodes", + versionAdded: "1.3.11", + function: /* @__PURE__ */ __name(() => { + getSelectedNodes().forEach((node) => { + node.collapse(); + }); + }, "function") + }, + { + id: "Comfy.ToggleTheme", + icon: "pi pi-moon", + label: "Toggle Theme (Dark/Light)", + versionAdded: "1.3.12", + function: (() => { + let previousDarkTheme = DEFAULT_DARK_COLOR_PALETTE.id; + let previousLightTheme = DEFAULT_LIGHT_COLOR_PALETTE.id; + return () => { + const settingStore = useSettingStore(); + const theme = colorPaletteStore.completedActivePalette; + if (theme.light_theme) { + previousLightTheme = theme.id; + settingStore.set("Comfy.ColorPalette", previousDarkTheme); + } else { + previousDarkTheme = theme.id; + settingStore.set("Comfy.ColorPalette", previousLightTheme); + } + }; + })() + }, + { + id: "Workspace.ToggleBottomPanel", + icon: "pi pi-list", + label: "Toggle Bottom Panel", + versionAdded: "1.3.22", + function: /* @__PURE__ */ __name(() => { + useBottomPanelStore().toggleBottomPanel(); + }, "function") + }, + { + id: "Workspace.ToggleFocusMode", + icon: "pi pi-eye", + label: "Toggle Focus Mode", + versionAdded: "1.3.27", + function: /* @__PURE__ */ __name(() => { + useWorkspaceStore().toggleFocusMode(); + }, "function") + }, + { + id: "Comfy.Graph.FitGroupToContents", + icon: "pi pi-expand", + label: "Fit Group To Contents", + versionAdded: "1.4.9", + function: /* @__PURE__ */ __name(() => { + for (const group of app.canvas.selectedItems) { + if (group instanceof LGraphGroup) { + group.recomputeInsideNodes(); + const padding = useSettingStore().get( + "Comfy.GroupSelectedNodes.Padding" + ); + group.resizeTo(group.children, padding); + app.graph.change(); + } + } + }, "function") + }, + { + id: "Comfy.Help.OpenComfyUIIssues", + icon: "pi pi-github", + label: "Open ComfyUI Issues", + menubarLabel: "ComfyUI Issues", + versionAdded: "1.5.5", + function: /* @__PURE__ */ __name(() => { + window.open( + "https://github.com/comfyanonymous/ComfyUI/issues", + "_blank" + ); + }, "function") + }, + { + id: "Comfy.Help.OpenComfyUIDocs", + icon: "pi pi-info-circle", + label: "Open ComfyUI Docs", + menubarLabel: "ComfyUI Docs", + versionAdded: "1.5.5", + function: /* @__PURE__ */ __name(() => { + window.open("https://docs.comfy.org/", "_blank"); + }, "function") + }, + { + id: "Comfy.Help.OpenComfyOrgDiscord", + icon: "pi pi-discord", + label: "Open Comfy-Org Discord", + menubarLabel: "Comfy-Org Discord", + versionAdded: "1.5.5", + function: /* @__PURE__ */ __name(() => { + window.open("https://www.comfy.org/discord", "_blank"); + }, "function") + }, + { + id: "Workspace.SearchBox.Toggle", + icon: "pi pi-search", + label: "Toggle Search Box", + versionAdded: "1.5.7", + 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") + }, + { + id: "Workspace.CloseWorkflow", + icon: "pi pi-times", + label: "Close Current Workflow", + versionAdded: "1.7.3", + function: /* @__PURE__ */ __name(() => { + if (workflowStore.activeWorkflow) + workflowService.closeWorkflow(workflowStore.activeWorkflow); + }, "function") + }, + { + id: "Comfy.Feedback", + icon: "pi pi-megaphone", + label: "Give Feedback", + versionAdded: "1.8.2", + function: /* @__PURE__ */ __name(() => { + dialogService.showIssueReportDialog({ + title: t("g.feedback"), + subtitle: t("issueReport.feedbackTitle"), + panelProps: { + errorType: "Feedback", + defaultFields: ["SystemStats", "Settings"] + } + }); + }, "function") + }, + { + id: "Comfy.Help.OpenComfyUIForum", + icon: "pi pi-comments", + label: "Open ComfyUI Forum", + menubarLabel: "ComfyUI Forum", + versionAdded: "1.8.2", + function: /* @__PURE__ */ __name(() => { + window.open("https://forum.comfy.org/", "_blank"); + }, "function") + } + ]; +} +__name(useCoreCommands, "useCoreCommands"); var LatentPreviewMethod = /* @__PURE__ */ ((LatentPreviewMethod2) => { LatentPreviewMethod2["NoPreviews"] = "none"; LatentPreviewMethod2["Auto"] = "auto"; @@ -3959,535 +4692,6 @@ const SERVER_CONFIG_ITEMS = [ defaultValue: "" } ]; -function useCoreCommands() { - const workflowService = useWorkflowService(); - const workflowStore = useWorkflowStore(); - const dialogService = useDialogService(); - const colorPaletteStore = useColorPaletteStore(); - const getTracker = /* @__PURE__ */ __name(() => workflowStore.activeWorkflow?.changeTracker, "getTracker"); - const getSelectedNodes = /* @__PURE__ */ __name(() => { - const selectedNodes = app.canvas.selected_nodes; - const result = []; - if (selectedNodes) { - for (const i in selectedNodes) { - const node = selectedNodes[i]; - result.push(node); - } - } - return result; - }, "getSelectedNodes"); - const toggleSelectedNodesMode = /* @__PURE__ */ __name((mode) => { - getSelectedNodes().forEach((node) => { - if (node.mode === mode) { - node.mode = LGraphEventMode.ALWAYS; - } else { - node.mode = mode; - } - }); - }, "toggleSelectedNodesMode"); - return [ - { - id: "Comfy.NewBlankWorkflow", - icon: "pi pi-plus", - label: "New Blank Workflow", - menubarLabel: "New", - function: /* @__PURE__ */ __name(() => workflowService.loadBlankWorkflow(), "function") - }, - { - id: "Comfy.OpenWorkflow", - icon: "pi pi-folder-open", - label: "Open Workflow", - menubarLabel: "Open", - function: /* @__PURE__ */ __name(() => { - app.ui.loadFile(); - }, "function") - }, - { - id: "Comfy.LoadDefaultWorkflow", - icon: "pi pi-code", - label: "Load Default Workflow", - function: /* @__PURE__ */ __name(() => workflowService.loadDefaultWorkflow(), "function") - }, - { - id: "Comfy.SaveWorkflow", - icon: "pi pi-save", - label: "Save Workflow", - menubarLabel: "Save", - function: /* @__PURE__ */ __name(async () => { - const workflow = useWorkflowStore().activeWorkflow; - if (!workflow) return; - await workflowService.saveWorkflow(workflow); - }, "function") - }, - { - id: "Comfy.SaveWorkflowAs", - icon: "pi pi-save", - label: "Save Workflow As", - menubarLabel: "Save As", - function: /* @__PURE__ */ __name(async () => { - const workflow = useWorkflowStore().activeWorkflow; - if (!workflow) return; - await workflowService.saveWorkflowAs(workflow); - }, "function") - }, - { - id: "Comfy.ExportWorkflow", - icon: "pi pi-download", - label: "Export Workflow", - menubarLabel: "Export", - function: /* @__PURE__ */ __name(() => { - workflowService.exportWorkflow("workflow", "workflow"); - }, "function") - }, - { - id: "Comfy.ExportWorkflowAPI", - icon: "pi pi-download", - label: "Export Workflow (API Format)", - menubarLabel: "Export (API)", - function: /* @__PURE__ */ __name(() => { - workflowService.exportWorkflow("workflow_api", "output"); - }, "function") - }, - { - id: "Comfy.Undo", - icon: "pi pi-undo", - label: "Undo", - function: /* @__PURE__ */ __name(async () => { - await getTracker()?.undo?.(); - }, "function") - }, - { - id: "Comfy.Redo", - icon: "pi pi-refresh", - label: "Redo", - function: /* @__PURE__ */ __name(async () => { - await getTracker()?.redo?.(); - }, "function") - }, - { - id: "Comfy.ClearWorkflow", - icon: "pi pi-trash", - label: "Clear Workflow", - function: /* @__PURE__ */ __name(() => { - const settingStore = useSettingStore(); - if (!settingStore.get("Comfy.ComfirmClear") || confirm("Clear workflow?")) { - app.clean(); - app.graph.clear(); - api.dispatchCustomEvent("graphCleared"); - } - }, "function") - }, - { - id: "Comfy.Canvas.ResetView", - icon: "pi pi-expand", - label: "Reset View", - function: /* @__PURE__ */ __name(() => { - app.resetView(); - }, "function") - }, - { - id: "Comfy.OpenClipspace", - icon: "pi pi-clipboard", - label: "Clipspace", - function: /* @__PURE__ */ __name(() => { - app.openClipspace(); - }, "function") - }, - { - id: "Comfy.RefreshNodeDefinitions", - icon: "pi pi-refresh", - label: "Refresh Node Definitions", - function: /* @__PURE__ */ __name(async () => { - await app.refreshComboInNodes(); - }, "function") - }, - { - id: "Comfy.Interrupt", - icon: "pi pi-stop", - label: "Interrupt", - function: /* @__PURE__ */ __name(async () => { - await api.interrupt(); - useToastStore().add({ - severity: "info", - summary: "Interrupted", - detail: "Execution has been interrupted", - life: 1e3 - }); - }, "function") - }, - { - id: "Comfy.ClearPendingTasks", - icon: "pi pi-stop", - label: "Clear Pending Tasks", - function: /* @__PURE__ */ __name(async () => { - await useQueueStore().clear(["queue"]); - useToastStore().add({ - severity: "info", - summary: "Confirmed", - detail: "Pending tasks deleted", - life: 3e3 - }); - }, "function") - }, - { - id: "Comfy.BrowseTemplates", - icon: "pi pi-folder-open", - label: "Browse Templates", - function: /* @__PURE__ */ __name(() => { - dialogService.showTemplateWorkflowsDialog(); - }, "function") - }, - { - id: "Comfy.Canvas.ZoomIn", - icon: "pi pi-plus", - label: "Zoom In", - function: /* @__PURE__ */ __name(() => { - const ds = app.canvas.ds; - ds.changeScale( - ds.scale * 1.1, - ds.element ? [ds.element.width / 2, ds.element.height / 2] : void 0 - ); - app.canvas.setDirty(true, true); - }, "function") - }, - { - id: "Comfy.Canvas.ZoomOut", - icon: "pi pi-minus", - label: "Zoom Out", - function: /* @__PURE__ */ __name(() => { - const ds = app.canvas.ds; - ds.changeScale( - ds.scale / 1.1, - ds.element ? [ds.element.width / 2, ds.element.height / 2] : void 0 - ); - app.canvas.setDirty(true, true); - }, "function") - }, - { - id: "Comfy.Canvas.FitView", - icon: "pi pi-expand", - label: "Fit view to selected nodes", - function: /* @__PURE__ */ __name(() => { - if (app.canvas.empty) { - useToastStore().add({ - severity: "error", - summary: "Empty canvas", - life: 3e3 - }); - return; - } - app.canvas.fitViewToSelectionAnimated(); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleLock", - icon: "pi pi-lock", - label: "Canvas Toggle Lock", - function: /* @__PURE__ */ __name(() => { - app.canvas["read_only"] = !app.canvas["read_only"]; - }, "function") - }, - { - id: "Comfy.Canvas.ToggleLinkVisibility", - icon: "pi pi-eye", - label: "Canvas Toggle Link Visibility", - versionAdded: "1.3.6", - function: (() => { - const settingStore = useSettingStore(); - let lastLinksRenderMode = LiteGraph.SPLINE_LINK; - return () => { - const currentMode = settingStore.get("Comfy.LinkRenderMode"); - if (currentMode === LiteGraph.HIDDEN_LINK) { - settingStore.set("Comfy.LinkRenderMode", lastLinksRenderMode); - } else { - lastLinksRenderMode = currentMode; - settingStore.set("Comfy.LinkRenderMode", LiteGraph.HIDDEN_LINK); - } - }; - })() - }, - { - id: "Comfy.QueuePrompt", - icon: "pi pi-play", - label: "Queue Prompt", - versionAdded: "1.3.7", - function: /* @__PURE__ */ __name(() => { - const batchCount = useQueueSettingsStore().batchCount; - app.queuePrompt(0, batchCount); - }, "function") - }, - { - id: "Comfy.QueuePromptFront", - icon: "pi pi-play", - label: "Queue Prompt (Front)", - versionAdded: "1.3.7", - function: /* @__PURE__ */ __name(() => { - const batchCount = useQueueSettingsStore().batchCount; - app.queuePrompt(-1, batchCount); - }, "function") - }, - { - id: "Comfy.ShowSettingsDialog", - icon: "pi pi-cog", - label: "Show Settings Dialog", - versionAdded: "1.3.7", - function: /* @__PURE__ */ __name(() => { - dialogService.showSettingsDialog(); - }, "function") - }, - { - id: "Comfy.Graph.GroupSelectedNodes", - icon: "pi pi-sitemap", - label: "Group Selected Nodes", - versionAdded: "1.3.7", - function: /* @__PURE__ */ __name(() => { - const { canvas } = app; - if (!canvas.selectedItems?.size) { - useToastStore().add({ - severity: "error", - summary: "Nothing to group", - detail: "Please select the nodes (or other groups) to create a group for", - life: 3e3 - }); - return; - } - const group = new LGraphGroup(); - const padding = useSettingStore().get( - "Comfy.GroupSelectedNodes.Padding" - ); - group.resizeTo(canvas.selectedItems, padding); - canvas.graph.add(group); - useTitleEditorStore().titleEditorTarget = group; - }, "function") - }, - { - id: "Workspace.NextOpenedWorkflow", - icon: "pi pi-step-forward", - label: "Next Opened Workflow", - versionAdded: "1.3.9", - function: /* @__PURE__ */ __name(() => { - workflowService.loadNextOpenedWorkflow(); - }, "function") - }, - { - id: "Workspace.PreviousOpenedWorkflow", - icon: "pi pi-step-backward", - label: "Previous Opened Workflow", - versionAdded: "1.3.9", - function: /* @__PURE__ */ __name(() => { - workflowService.loadPreviousOpenedWorkflow(); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelectedNodes.Mute", - icon: "pi pi-volume-off", - label: "Mute/Unmute Selected Nodes", - versionAdded: "1.3.11", - function: /* @__PURE__ */ __name(() => { - toggleSelectedNodesMode(LGraphEventMode.NEVER); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelectedNodes.Bypass", - icon: "pi pi-shield", - label: "Bypass/Unbypass Selected Nodes", - versionAdded: "1.3.11", - function: /* @__PURE__ */ __name(() => { - toggleSelectedNodesMode(LGraphEventMode.BYPASS); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelectedNodes.Pin", - icon: "pi pi-pin", - label: "Pin/Unpin Selected Nodes", - versionAdded: "1.3.11", - function: /* @__PURE__ */ __name(() => { - getSelectedNodes().forEach((node) => { - node.pin(!node.pinned); - }); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelected.Pin", - icon: "pi pi-pin", - label: "Pin/Unpin Selected Items", - versionAdded: "1.3.33", - function: /* @__PURE__ */ __name(() => { - for (const item of app.canvas.selectedItems) { - if (item instanceof LGraphNode || item instanceof LGraphGroup) { - item.pin(!item.pinned); - } - } - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelectedNodes.Collapse", - icon: "pi pi-minus", - label: "Collapse/Expand Selected Nodes", - versionAdded: "1.3.11", - function: /* @__PURE__ */ __name(() => { - getSelectedNodes().forEach((node) => { - node.collapse(); - }); - }, "function") - }, - { - id: "Comfy.ToggleTheme", - icon: "pi pi-moon", - label: "Toggle Theme (Dark/Light)", - versionAdded: "1.3.12", - function: (() => { - let previousDarkTheme = DEFAULT_DARK_COLOR_PALETTE.id; - let previousLightTheme = DEFAULT_LIGHT_COLOR_PALETTE.id; - return () => { - const settingStore = useSettingStore(); - const theme = colorPaletteStore.completedActivePalette; - if (theme.light_theme) { - previousLightTheme = theme.id; - settingStore.set("Comfy.ColorPalette", previousDarkTheme); - } else { - previousDarkTheme = theme.id; - settingStore.set("Comfy.ColorPalette", previousLightTheme); - } - }; - })() - }, - { - id: "Workspace.ToggleBottomPanel", - icon: "pi pi-list", - label: "Toggle Bottom Panel", - versionAdded: "1.3.22", - function: /* @__PURE__ */ __name(() => { - useBottomPanelStore().toggleBottomPanel(); - }, "function") - }, - { - id: "Workspace.ToggleFocusMode", - icon: "pi pi-eye", - label: "Toggle Focus Mode", - versionAdded: "1.3.27", - function: /* @__PURE__ */ __name(() => { - useWorkspaceStore().toggleFocusMode(); - }, "function") - }, - { - id: "Comfy.Graph.FitGroupToContents", - icon: "pi pi-expand", - label: "Fit Group To Contents", - versionAdded: "1.4.9", - function: /* @__PURE__ */ __name(() => { - for (const group of app.canvas.selectedItems) { - if (group instanceof LGraphGroup) { - group.recomputeInsideNodes(); - const padding = useSettingStore().get( - "Comfy.GroupSelectedNodes.Padding" - ); - group.resizeTo(group.children, padding); - app.graph.change(); - } - } - }, "function") - }, - { - id: "Comfy.Help.OpenComfyUIIssues", - icon: "pi pi-github", - label: "Open ComfyUI Issues", - menubarLabel: "ComfyUI Issues", - versionAdded: "1.5.5", - function: /* @__PURE__ */ __name(() => { - window.open( - "https://github.com/comfyanonymous/ComfyUI/issues", - "_blank" - ); - }, "function") - }, - { - id: "Comfy.Help.OpenComfyUIDocs", - icon: "pi pi-info-circle", - label: "Open ComfyUI Docs", - menubarLabel: "ComfyUI Docs", - versionAdded: "1.5.5", - function: /* @__PURE__ */ __name(() => { - window.open("https://docs.comfy.org/", "_blank"); - }, "function") - }, - { - id: "Comfy.Help.OpenComfyOrgDiscord", - icon: "pi pi-discord", - label: "Open Comfy-Org Discord", - menubarLabel: "Comfy-Org Discord", - versionAdded: "1.5.5", - function: /* @__PURE__ */ __name(() => { - window.open("https://www.comfy.org/discord", "_blank"); - }, "function") - }, - { - id: "Workspace.SearchBox.Toggle", - icon: "pi pi-search", - label: "Toggle Search Box", - versionAdded: "1.5.7", - 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") - }, - { - id: "Workspace.CloseWorkflow", - icon: "pi pi-times", - label: "Close Current Workflow", - versionAdded: "1.7.3", - function: /* @__PURE__ */ __name(() => { - if (workflowStore.activeWorkflow) - workflowService.closeWorkflow(workflowStore.activeWorkflow); - }, "function") - }, - { - id: "Comfy.Feedback", - icon: "pi pi-megaphone", - label: "Give Feedback", - versionAdded: "1.8.2", - function: /* @__PURE__ */ __name(() => { - dialogService.showIssueReportDialog({ - title: t("g.feedback"), - subtitle: t("issueReport.feedbackTitle"), - panelProps: { - errorType: "Feedback", - defaultFields: ["SystemStats", "Settings"] - } - }); - }, "function") - }, - { - id: "Comfy.Help.OpenComfyUIForum", - icon: "pi pi-comments", - label: "Open ComfyUI Forum", - menubarLabel: "ComfyUI Forum", - versionAdded: "1.8.2", - function: /* @__PURE__ */ __name(() => { - window.open("https://forum.comfy.org/", "_blank"); - }, "function") - } - ]; -} -__name(useCoreCommands, "useCoreCommands"); function setupAutoQueueHandler() { const queueCountStore = useQueuePendingTaskCountStore(); const queueSettingsStore = useQueueSettingsStore(); @@ -4518,6 +4722,19 @@ function setupAutoQueueHandler() { ); } __name(setupAutoQueueHandler, "setupAutoQueueHandler"); +const _hoisted_1 = { class: "comfyui-body grid h-screen w-screen overflow-hidden" }; +const _hoisted_2 = { + class: "comfyui-body-top", + id: "comfyui-body-top" +}; +const _hoisted_3 = { + class: "comfyui-body-bottom", + id: "comfyui-body-bottom" +}; +const _hoisted_4 = { + class: "graph-canvas-container", + id: "graph-canvas-container" +}; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "GraphView", setup(__props) { @@ -4588,9 +4805,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ i18n.global.locale.value = locale; } }); + const useNewMenu = computed(() => { + return settingStore.get("Comfy.UseNewMenu"); + }); watchEffect(() => { - const useNewMenu = settingStore.get("Comfy.UseNewMenu"); - if (useNewMenu === "Disabled") { + if (useNewMenu.value === "Disabled") { app.ui.menuContainer.style.setProperty("display", "block"); app.ui.restoreMenuPosition(); } else { @@ -4666,8 +4885,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }, "onGraphReady"); return (_ctx, _cache) => { return openBlock(), createElementBlock(Fragment, null, [ - createVNode(TopMenubar), - createVNode(_sfc_main$8, { onReady: onGraphReady }), + createBaseVNode("div", _hoisted_1, [ + createBaseVNode("div", _hoisted_2, [ + useNewMenu.value === "Top" ? (openBlock(), createBlock(TopMenubar, { key: 0 })) : createCommentVNode("", true) + ]), + createBaseVNode("div", _hoisted_3, [ + useNewMenu.value === "Bottom" ? (openBlock(), createBlock(TopMenubar, { key: 0 })) : createCommentVNode("", true) + ]), + _cache[0] || (_cache[0] = createBaseVNode("div", { + class: "comfyui-body-left", + id: "comfyui-body-left" + }, null, -1)), + _cache[1] || (_cache[1] = createBaseVNode("div", { + class: "comfyui-body-right", + id: "comfyui-body-right" + }, null, -1)), + createBaseVNode("div", _hoisted_4, [ + createVNode(_sfc_main$8, { onReady: onGraphReady }) + ]) + ]), createVNode(_sfc_main$7), !unref(isElectron)() ? (openBlock(), createBlock(_sfc_main$s, { key: 0 })) : createCommentVNode("", true), createVNode(_sfc_main$u), @@ -4676,7 +4912,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }; } }); +const GraphView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e89d9273"]]); export { - _sfc_main as default + GraphView as default }; -//# sourceMappingURL=GraphView-D9ZzDQZV.js.map +//# sourceMappingURL=GraphView-CLFBgoGf.js.map diff --git a/web/assets/InstallView-CVZcZZXJ.js b/web/assets/InstallView-x9XCq0hC.js similarity index 95% rename from web/assets/InstallView-CVZcZZXJ.js rename to web/assets/InstallView-x9XCq0hC.js index 25d05f5f0..9487ebf27 100644 --- a/web/assets/InstallView-CVZcZZXJ.js +++ b/web/assets/InstallView-x9XCq0hC.js @@ -1,9 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, U as ref, bm as useModel, o as openBlock, f as createElementBlock, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, bn as script, bh as script$1, ar as withModifiers, z as withCtx, ab as script$2, K as useI18n, c as computed, ai as normalizeClass, B as createCommentVNode, a4 as script$3, a7 as createTextVNode, b5 as electronAPI, _ as _export_sfc, p as onMounted, r as resolveDirective, bg as script$4, i as withDirectives, bo as script$5, bp as script$6, l as script$7, y as createBlock, bj as script$8, bq as MigrationItems, w as watchEffect, F as Fragment, D as renderList, br as script$9, bs as mergeModels, bt as ValidationState, Y as normalizeI18nKey, O as watch, bu as checkMirrorReachable, bv as _sfc_main$7, bw as mergeValidationStates, bc as t, a$ as script$a, bx as CUDA_TORCH_URL, by as NIGHTLY_CPU_TORCH_URL, be as useRouter, ag as toRaw } from "./index-DqqhYDnY.js"; -import { s as script$b, a as script$c, b as script$d, c as script$e, d as script$f } from "./index-BNlqgrYT.js"; +import { d as defineComponent, T as ref, bq as useModel, o as openBlock, f as createElementBlock, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, br as script, bl as script$1, as as withModifiers, z as withCtx, ac as script$2, I as useI18n, c as computed, aj as normalizeClass, B as createCommentVNode, a5 as script$3, a8 as createTextVNode, b9 as electronAPI, _ as _export_sfc, p as onMounted, r as resolveDirective, bk as script$4, i as withDirectives, bs as script$5, bt as script$6, l as script$7, y as createBlock, bn as script$8, bu as MigrationItems, w as watchEffect, F as Fragment, D as renderList, bv as script$9, bw as mergeModels, bx as ValidationState, X as normalizeI18nKey, N as watch, by as checkMirrorReachable, bz as _sfc_main$7, bA as isInChina, bB as mergeValidationStates, bg as t, b3 as script$a, bC as CUDA_TORCH_URL, bD as NIGHTLY_CPU_TORCH_URL, bi as useRouter, ah as toRaw } from "./index-DqXp9vW4.js"; +import { s as script$b, a as script$c, b as script$d, c as script$e, d as script$f } from "./index-A-dAhghd.js"; import { P as PYTHON_MIRROR, a as PYPI_MIRROR } from "./uvMirrors-B-HKMf6X.js"; -import { _ as _sfc_main$8 } from "./BaseViewTemplate-Cz111_1A.js"; +import { _ as _sfc_main$8 } from "./BaseViewTemplate-DlGljfEG.js"; const _hoisted_1$5 = { class: "flex flex-col gap-6 w-[600px]" }; const _hoisted_2$5 = { class: "flex flex-col gap-4" }; const _hoisted_3$5 = { class: "text-2xl font-semibold text-neutral-100" }; @@ -314,6 +314,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ const pathExists = ref(false); const appData = ref(""); const appPath = ref(""); + const inputTouched = ref(false); const electron = electronAPI(); onMounted(async () => { const paths = await electron.getSystemPaths(); @@ -355,6 +356,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ pathError.value = t2("install.failedToSelectDirectory"); } }, "browsePath"); + const onFocus = /* @__PURE__ */ __name(() => { + if (!inputTouched.value) { + inputTouched.value = true; + return; + } + validatePath(installPath.value); + }, "onFocus"); return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); return openBlock(), createElementBlock("div", _hoisted_1$3, [ @@ -370,10 +378,16 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ _cache[0] || (_cache[0] = ($event) => installPath.value = $event), validatePath ], - class: normalizeClass(["w-full", { "p-invalid": pathError.value }]) + class: normalizeClass(["w-full", { "p-invalid": pathError.value }]), + onFocus }, null, 8, ["modelValue", "class"]), withDirectives(createVNode(unref(script$5), { class: "pi pi-info-circle" }, null, 512), [ - [_directive_tooltip, _ctx.$t("install.installLocationTooltip")] + [ + _directive_tooltip, + _ctx.$t("install.installLocationTooltip"), + void 0, + { top: true } + ] ]) ]), _: 1 @@ -595,13 +609,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({ } }); return (_ctx, _cache) => { - const _component_UrlInput = _sfc_main$7; return openBlock(), createElementBlock("div", _hoisted_1$1, [ createBaseVNode("div", _hoisted_2$1, [ createBaseVNode("h3", _hoisted_3$1, toDisplayString(_ctx.$t(`settings.${normalizedSettingId.value}.name`)), 1), createBaseVNode("p", _hoisted_4$1, toDisplayString(_ctx.$t(`settings.${normalizedSettingId.value}.tooltip`)), 1) ]), - createVNode(_component_UrlInput, { + createVNode(_sfc_main$7, { modelValue: modelValue.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event), "validate-url-fn": /* @__PURE__ */ __name((mirror) => unref(checkMirrorReachable)(mirror + (_ctx.item.validationPathSuffix ?? "")), "validate-url-fn"), @@ -653,11 +666,24 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ }; } }, "getTorchMirrorItem"); - const mirrors = computed(() => [ - [PYTHON_MIRROR, pythonMirror], - [PYPI_MIRROR, pypiMirror], - [getTorchMirrorItem(__props.device), torchMirror] - ]); + const userIsInChina = ref(false); + onMounted(async () => { + userIsInChina.value = await isInChina(); + }); + const useFallbackMirror = /* @__PURE__ */ __name((mirror) => ({ + ...mirror, + mirror: mirror.fallbackMirror + }), "useFallbackMirror"); + const mirrors = computed( + () => [ + [PYTHON_MIRROR, pythonMirror], + [PYPI_MIRROR, pypiMirror], + [getTorchMirrorItem(__props.device), torchMirror] + ].map(([item, modelValue]) => [ + userIsInChina.value ? useFallbackMirror(item) : item, + modelValue + ]) + ); const validationStates = ref( mirrors.value.map(() => ValidationState.IDLE) ); @@ -942,4 +968,4 @@ const InstallView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data- export { InstallView as default }; -//# sourceMappingURL=InstallView-CVZcZZXJ.js.map +//# sourceMappingURL=InstallView-x9XCq0hC.js.map diff --git a/web/assets/KeybindingPanel-CeHhC2F4.js b/web/assets/KeybindingPanel-BIrxefrS.js similarity index 90% rename from web/assets/KeybindingPanel-CeHhC2F4.js rename to web/assets/KeybindingPanel-BIrxefrS.js index c14bb7632..dc8d2ae3c 100644 --- a/web/assets/KeybindingPanel-CeHhC2F4.js +++ b/web/assets/KeybindingPanel-BIrxefrS.js @@ -1,9 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, D as renderList, k as createVNode, z as withCtx, a7 as createTextVNode, E as toDisplayString, j as unref, a4 as script, B as createCommentVNode, U as ref, dl as FilterMatchMode, an as useKeybindingStore, L as useCommandStore, K as useI18n, Y as normalizeI18nKey, w as watchEffect, aR as useToast, r as resolveDirective, y as createBlock, dm as SearchBox, m as createBaseVNode, l as script$2, bg as script$4, ar as withModifiers, bj as script$5, ab as script$6, i as withDirectives, dn as _sfc_main$2, dp as KeyComboImpl, dq as KeybindingImpl, _ as _export_sfc } from "./index-DqqhYDnY.js"; -import { g as script$1, h as script$3 } from "./index-BapOFhAR.js"; -import { u as useKeybindingService } from "./keybindingService-DEgCutrm.js"; -import "./index-DXE47DZl.js"; +import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, D as renderList, k as createVNode, z as withCtx, a8 as createTextVNode, E as toDisplayString, j as unref, a5 as script, B as createCommentVNode, T as ref, dx as FilterMatchMode, ao as useKeybindingStore, J as useCommandStore, I as useI18n, X as normalizeI18nKey, w as watchEffect, aV as useToast, r as resolveDirective, y as createBlock, dy as SearchBox, m as createBaseVNode, l as script$2, bk as script$4, as as withModifiers, bn as script$5, ac as script$6, i as withDirectives, dz as _sfc_main$2, dA as KeyComboImpl, dB as KeybindingImpl, _ as _export_sfc } from "./index-DqXp9vW4.js"; +import { g as script$1, h as script$3 } from "./index-KUUE4Ew8.js"; +import { u as useKeybindingService } from "./keybindingService-DgS0S2M6.js"; +import "./index-BTHx8UHZ.js"; const _hoisted_1$1 = { key: 0, class: "px-2" @@ -96,6 +96,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ } __name(removeKeybinding, "removeKeybinding"); function captureKeybinding(event) { + if (!event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) { + switch (event.key) { + case "Escape": + cancelEdit(); + return; + case "Enter": + saveKeybinding(); + return; + } + } const keyCombo = KeyComboImpl.fromEvent(event); newBindingKeyCombo.value = keyCombo; } @@ -151,7 +161,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ value: commandsData.value, selection: selectedCommandData.value, "onUpdate:selection": _cache[1] || (_cache[1] = ($event) => selectedCommandData.value = $event), - "global-filter-fields": ["id"], + "global-filter-fields": ["id", "label"], filters: filters.value, selectionMode: "single", stripedRows: "", @@ -216,7 +226,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ visible: editDialogVisible.value, "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => editDialogVisible.value = $event), modal: "", - header: currentEditingCommand.value?.id, + header: currentEditingCommand.value?.label, onHide: cancelEdit }, { footer: withCtx(() => [ @@ -275,8 +285,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }; } }); -const KeybindingPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2554ab36"]]); +const KeybindingPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8454e24f"]]); export { KeybindingPanel as default }; -//# sourceMappingURL=KeybindingPanel-CeHhC2F4.js.map +//# sourceMappingURL=KeybindingPanel-BIrxefrS.js.map diff --git a/web/assets/KeybindingPanel-CDYVPYDp.css b/web/assets/KeybindingPanel-CDYVPYDp.css new file mode 100644 index 000000000..2392e4f5c --- /dev/null +++ b/web/assets/KeybindingPanel-CDYVPYDp.css @@ -0,0 +1,8 @@ + +[data-v-8454e24f] .p-datatable-tbody > tr > td { + padding: 0.25rem; + min-height: 2rem +} +[data-v-8454e24f] .p-datatable-row-selected .actions,[data-v-8454e24f] .p-datatable-selectable-row:hover .actions { + visibility: visible +} diff --git a/web/assets/KeybindingPanel-DvrUYZ4S.css b/web/assets/KeybindingPanel-DvrUYZ4S.css deleted file mode 100644 index 8f714bcdb..000000000 --- a/web/assets/KeybindingPanel-DvrUYZ4S.css +++ /dev/null @@ -1,8 +0,0 @@ - -[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/MaintenanceView-Df7CHNWW.js b/web/assets/MaintenanceView-BUmTZX1d.js similarity index 97% rename from web/assets/MaintenanceView-Df7CHNWW.js rename to web/assets/MaintenanceView-BUmTZX1d.js index 88056ab28..f52e9b169 100644 --- a/web/assets/MaintenanceView-Df7CHNWW.js +++ b/web/assets/MaintenanceView-BUmTZX1d.js @@ -1,396 +1,13 @@ var __defProp = Object.defineProperty; var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -import { bA as BaseStyle, bB as script$1d, bC as ZIndex, bD as addClass, bE as focus, bF as blockBodyScroll, bG as unblockBodyScroll, bH as FocusTrap, l as script$1e, bI as script$1f, bJ as script$1g, bK as resolveComponent, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, f as createElementBlock, as as mergeProps, k as createVNode, bL as Transition, i as withDirectives, A as renderSlot, F as Fragment, m as createBaseVNode, ai as normalizeClass, E as toDisplayString, B as createCommentVNode, C as resolveDynamicComponent, d as defineComponent, bs as mergeModels, bm as useModel, v as vShow, j as unref, bM as script$1h, c as computed, bN as PrimeIcons, bc as t, a4 as script$1i, aZ as inject, bO as findSingle, bP as getAttribute, bQ as script$1j, bR as script$1k, bS as Ripple, bT as UniqueComponentId, bU as script$1l, D as renderList, bV as BaseDirective, bW as removeClass, bX as createElement, bY as hasClass, bZ as script$1m, b_ as script$1n, b$ as addStyle, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, c2 as relativePosition, c3 as getOuterWidth, c4 as absolutePosition, c5 as find, c6 as getIndex, c7 as getFocusableElements, c8 as OverlayEventBus, c9 as setAttribute, ca as localeComparator, bg as script$1o, cb as script$1p, n as normalizeStyle, a7 as createTextVNode, bf as withKeys, cc as resolveFieldData, cd as isNotEmpty, ce as equals, cf as script$1q, cg as isString, ch as isPrintableCharacter, ci as isEmpty, cj as findLastIndex, ck as script$1r, cl as script$1s, cm as uuid, a8 as script$1t, cn as sort, co as createSlots, cp as EventBus, H as markRaw, cq as resolve, cr as Tooltip, bi as script$1v, ab as script$1w, cs as script$1x, ct as script$1y, cu as script$1z, bz as script$1A, bj as script$1B, cv as normalizeProps, cw as isAttributeEquals, cx as guardReactiveProps, cy as setCSSProperty, cz as $dt, cA as script$1D, cB as script$1F, cC as getUserAgent, bn as script$1G, cD as script$1H, cE as getFirstFocusableElement, cF as getLastFocusableElement, cG as FilterService, br as script$1J, cH as script$1K, bp as script$1L, bo as script$1M, cI as script$1N, cJ as findIndexInList, cK as scrollInView, cL as script$1O, cM as script$1P, cN as script$1Q, cO as findLast, cP as getWindowScrollTop, cQ as getWidth, cR as getOffset, cS as vModelText, cT as script$1U, ar as withModifiers, cU as getVNodeProp, cV as getNextElementSibling, cW as getPreviousElementSibling, cX as isClickable, cY as _default, cZ as clearSelection, c_ as isRTL, b5 as electronAPI, I as defineStore, U as ref, c$ as useTimeout, O as watch, d0 as script$1Y, _ as _export_sfc, aR as useToast, d1 as useConfirm, bh as script$1Z, d2 as script$1_, p as onMounted, d3 as onUnmounted, av as script$1$, af as isRef, bl as BaseTerminal } from "./index-DqqhYDnY.js"; -import { j as script$1C, k as script$1E, g as script$20 } from "./index-DKIv7atk.js"; -import { s as script$1u, a as script$1R, b as script$1S, c as script$1T, d as script$1V, e as script$1W, f as script$1X } from "./index-BapOFhAR.js"; -import { s as script$1I } from "./index-DXE47DZl.js"; -import "./index-BNlqgrYT.js"; -import { _ as _sfc_main$7 } from "./BaseViewTemplate-Cz111_1A.js"; -var theme$D = /* @__PURE__ */ __name(function theme(_ref) { - var dt = _ref.dt; - return "\n.p-drawer {\n display: flex;\n flex-direction: column;\n transform: translate3d(0px, 0px, 0px);\n position: relative;\n transition: transform 0.3s;\n background: ".concat(dt("drawer.background"), ";\n color: ").concat(dt("drawer.color"), ";\n border: 1px solid ").concat(dt("drawer.border.color"), ";\n box-shadow: ").concat(dt("drawer.shadow"), ";\n}\n\n.p-drawer-content {\n overflow-y: auto;\n flex-grow: 1;\n padding: ").concat(dt("drawer.content.padding"), ";\n}\n\n.p-drawer-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-shrink: 0;\n padding: ").concat(dt("drawer.header.padding"), ";\n}\n\n.p-drawer-footer {\n padding: ").concat(dt("drawer.footer.padding"), ";\n}\n\n.p-drawer-title {\n font-weight: ").concat(dt("drawer.title.font.weight"), ";\n font-size: ").concat(dt("drawer.title.font.size"), ";\n}\n\n.p-drawer-full .p-drawer {\n transition: none;\n transform: none;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n border-width: 1px;\n}\n\n.p-drawer-left .p-drawer-enter-from,\n.p-drawer-left .p-drawer-leave-to {\n transform: translateX(-100%);\n}\n\n.p-drawer-right .p-drawer-enter-from,\n.p-drawer-right .p-drawer-leave-to {\n transform: translateX(100%);\n}\n\n.p-drawer-top .p-drawer-enter-from,\n.p-drawer-top .p-drawer-leave-to {\n transform: translateY(-100%);\n}\n\n.p-drawer-bottom .p-drawer-enter-from,\n.p-drawer-bottom .p-drawer-leave-to {\n transform: translateY(100%);\n}\n\n.p-drawer-full .p-drawer-enter-from,\n.p-drawer-full .p-drawer-leave-to {\n opacity: 0;\n}\n\n.p-drawer-full .p-drawer-enter-active,\n.p-drawer-full .p-drawer-leave-active {\n transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n.p-drawer-left .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-end-width: 1px;\n}\n\n.p-drawer-right .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-start-width: 1px;\n}\n\n.p-drawer-top .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-end-width: 1px;\n}\n\n.p-drawer-bottom .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-start-width: 1px;\n}\n\n.p-drawer-left .p-drawer-content,\n.p-drawer-right .p-drawer-content,\n.p-drawer-top .p-drawer-content,\n.p-drawer-bottom .p-drawer-content {\n width: 100%;\n height: 100%;\n}\n\n.p-drawer-open {\n display: flex;\n}\n\n.p-drawer-mask:dir(rtl) {\n flex-direction: row-reverse;\n}\n"); -}, "theme"); -var inlineStyles$9 = { - mask: /* @__PURE__ */ __name(function mask(_ref2) { - var position = _ref2.position, modal = _ref2.modal; - return { - position: "fixed", - height: "100%", - width: "100%", - left: 0, - top: 0, - display: "flex", - justifyContent: position === "left" ? "flex-start" : position === "right" ? "flex-end" : "center", - alignItems: position === "top" ? "flex-start" : position === "bottom" ? "flex-end" : "center", - pointerEvents: modal ? "auto" : "none" - }; - }, "mask"), - root: { - pointerEvents: "auto" - } -}; -var classes$M = { - mask: /* @__PURE__ */ __name(function mask2(_ref3) { - var instance = _ref3.instance, props = _ref3.props; - var positions = ["left", "right", "top", "bottom"]; - var pos = positions.find(function(item8) { - return item8 === props.position; - }); - return ["p-drawer-mask", { - "p-overlay-mask p-overlay-mask-enter": props.modal, - "p-drawer-open": instance.containerVisible, - "p-drawer-full": instance.fullScreen - }, pos ? "p-drawer-".concat(pos) : ""]; - }, "mask"), - root: /* @__PURE__ */ __name(function root(_ref4) { - var instance = _ref4.instance; - return ["p-drawer p-component", { - "p-drawer-full": instance.fullScreen - }]; - }, "root"), - header: "p-drawer-header", - title: "p-drawer-title", - pcCloseButton: "p-drawer-close-button", - content: "p-drawer-content", - footer: "p-drawer-footer" -}; -var DrawerStyle = BaseStyle.extend({ - name: "drawer", - theme: theme$D, - classes: classes$M, - inlineStyles: inlineStyles$9 -}); -var script$1$O = { - name: "BaseDrawer", - "extends": script$1d, - props: { - visible: { - type: Boolean, - "default": false - }, - position: { - type: String, - "default": "left" - }, - header: { - type: null, - "default": null - }, - baseZIndex: { - type: Number, - "default": 0 - }, - autoZIndex: { - type: Boolean, - "default": true - }, - dismissable: { - type: Boolean, - "default": true - }, - showCloseIcon: { - type: Boolean, - "default": true - }, - closeButtonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default2() { - return { - severity: "secondary", - text: true, - rounded: true - }; - }, "_default") - }, - closeIcon: { - type: String, - "default": void 0 - }, - modal: { - type: Boolean, - "default": true - }, - blockScroll: { - type: Boolean, - "default": false - } - }, - style: DrawerStyle, - provide: /* @__PURE__ */ __name(function provide() { - return { - $pcDrawer: this, - $parentInstance: this - }; - }, "provide") -}; -var script$1c = { - name: "Drawer", - "extends": script$1$O, - inheritAttrs: false, - emits: ["update:visible", "show", "after-show", "hide", "after-hide"], - data: /* @__PURE__ */ __name(function data() { - return { - containerVisible: this.visible - }; - }, "data"), - container: null, - mask: null, - content: null, - headerContainer: null, - footerContainer: null, - closeButton: null, - outsideClickListener: null, - documentKeydownListener: null, - watch: { - dismissable: /* @__PURE__ */ __name(function dismissable(newValue) { - if (newValue) { - this.enableDocumentSettings(); - } else { - this.disableDocumentSettings(); - } - }, "dismissable") - }, - updated: /* @__PURE__ */ __name(function updated() { - if (this.visible) { - this.containerVisible = this.visible; - } - }, "updated"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount() { - this.disableDocumentSettings(); - if (this.mask && this.autoZIndex) { - ZIndex.clear(this.mask); - } - this.container = null; - this.mask = null; - }, "beforeUnmount"), - methods: { - hide: /* @__PURE__ */ __name(function hide() { - this.$emit("update:visible", false); - }, "hide"), - onEnter: /* @__PURE__ */ __name(function onEnter() { - this.$emit("show"); - this.focus(); - this.bindDocumentKeyDownListener(); - if (this.autoZIndex) { - ZIndex.set("modal", this.mask, this.baseZIndex || this.$primevue.config.zIndex.modal); - } - }, "onEnter"), - onAfterEnter: /* @__PURE__ */ __name(function onAfterEnter() { - this.enableDocumentSettings(); - this.$emit("after-show"); - }, "onAfterEnter"), - onBeforeLeave: /* @__PURE__ */ __name(function onBeforeLeave() { - if (this.modal) { - !this.isUnstyled && addClass(this.mask, "p-overlay-mask-leave"); - } - }, "onBeforeLeave"), - onLeave: /* @__PURE__ */ __name(function onLeave() { - this.$emit("hide"); - }, "onLeave"), - onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave() { - if (this.autoZIndex) { - ZIndex.clear(this.mask); - } - this.unbindDocumentKeyDownListener(); - this.containerVisible = false; - this.disableDocumentSettings(); - this.$emit("after-hide"); - }, "onAfterLeave"), - onMaskClick: /* @__PURE__ */ __name(function onMaskClick(event2) { - if (this.dismissable && this.modal && this.mask === event2.target) { - this.hide(); - } - }, "onMaskClick"), - focus: /* @__PURE__ */ __name(function focus$1() { - var findFocusableElement = /* @__PURE__ */ __name(function findFocusableElement2(container) { - return container && container.querySelector("[autofocus]"); - }, "findFocusableElement"); - var focusTarget = this.$slots.header && findFocusableElement(this.headerContainer); - if (!focusTarget) { - focusTarget = this.$slots["default"] && findFocusableElement(this.container); - if (!focusTarget) { - focusTarget = this.$slots.footer && findFocusableElement(this.footerContainer); - if (!focusTarget) { - focusTarget = this.closeButton; - } - } - } - focusTarget && focus(focusTarget); - }, "focus$1"), - enableDocumentSettings: /* @__PURE__ */ __name(function enableDocumentSettings() { - if (this.dismissable && !this.modal) { - this.bindOutsideClickListener(); - } - if (this.blockScroll) { - blockBodyScroll(); - } - }, "enableDocumentSettings"), - disableDocumentSettings: /* @__PURE__ */ __name(function disableDocumentSettings() { - this.unbindOutsideClickListener(); - if (this.blockScroll) { - unblockBodyScroll(); - } - }, "disableDocumentSettings"), - onKeydown: /* @__PURE__ */ __name(function onKeydown(event2) { - if (event2.code === "Escape") { - this.hide(); - } - }, "onKeydown"), - containerRef: /* @__PURE__ */ __name(function containerRef(el) { - this.container = el; - }, "containerRef"), - maskRef: /* @__PURE__ */ __name(function maskRef(el) { - this.mask = el; - }, "maskRef"), - contentRef: /* @__PURE__ */ __name(function contentRef(el) { - this.content = el; - }, "contentRef"), - headerContainerRef: /* @__PURE__ */ __name(function headerContainerRef(el) { - this.headerContainer = el; - }, "headerContainerRef"), - footerContainerRef: /* @__PURE__ */ __name(function footerContainerRef(el) { - this.footerContainer = el; - }, "footerContainerRef"), - closeButtonRef: /* @__PURE__ */ __name(function closeButtonRef(el) { - this.closeButton = el ? el.$el : void 0; - }, "closeButtonRef"), - bindDocumentKeyDownListener: /* @__PURE__ */ __name(function bindDocumentKeyDownListener() { - if (!this.documentKeydownListener) { - this.documentKeydownListener = this.onKeydown; - document.addEventListener("keydown", this.documentKeydownListener); - } - }, "bindDocumentKeyDownListener"), - unbindDocumentKeyDownListener: /* @__PURE__ */ __name(function unbindDocumentKeyDownListener() { - if (this.documentKeydownListener) { - document.removeEventListener("keydown", this.documentKeydownListener); - this.documentKeydownListener = null; - } - }, "unbindDocumentKeyDownListener"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener() { - var _this = this; - if (!this.outsideClickListener) { - this.outsideClickListener = function(event2) { - if (_this.isOutsideClicked(event2)) { - _this.hide(); - } - }; - document.addEventListener("click", this.outsideClickListener); - } - }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener() { - if (this.outsideClickListener) { - document.removeEventListener("click", this.outsideClickListener); - this.outsideClickListener = null; - } - }, "unbindOutsideClickListener"), - isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked(event2) { - return this.container && !this.container.contains(event2.target); - }, "isOutsideClicked") - }, - computed: { - fullScreen: /* @__PURE__ */ __name(function fullScreen() { - return this.position === "full"; - }, "fullScreen"), - closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : void 0; - }, "closeAriaLabel") - }, - directives: { - focustrap: FocusTrap - }, - components: { - Button: script$1e, - Portal: script$1f, - TimesIcon: script$1g - } -}; -var _hoisted_1$v = ["aria-modal"]; -function render$13(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Button = resolveComponent("Button"); - var _component_Portal = resolveComponent("Portal"); - var _directive_focustrap = resolveDirective("focustrap"); - return openBlock(), createBlock(_component_Portal, null, { - "default": withCtx(function() { - return [$data.containerVisible ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: $options.maskRef, - onMousedown: _cache[0] || (_cache[0] = function() { - return $options.onMaskClick && $options.onMaskClick.apply($options, arguments); - }), - "class": _ctx.cx("mask"), - style: _ctx.sx("mask", true, { - position: _ctx.position, - modal: _ctx.modal - }) - }, _ctx.ptm("mask")), [createVNode(Transition, mergeProps({ - name: "p-drawer", - onEnter: $options.onEnter, - onAfterEnter: $options.onAfterEnter, - onBeforeLeave: $options.onBeforeLeave, - onLeave: $options.onLeave, - onAfterLeave: $options.onAfterLeave, - appear: "" - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [_ctx.visible ? withDirectives((openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: $options.containerRef, - "class": _ctx.cx("root"), - style: _ctx.sx("root"), - role: "complementary", - "aria-modal": _ctx.modal - }, _ctx.ptmi("root")), [_ctx.$slots.container ? renderSlot(_ctx.$slots, "container", { - key: 0, - closeCallback: $options.hide - }) : (openBlock(), createElementBlock(Fragment, { - key: 1 - }, [createBaseVNode("div", mergeProps({ - ref: $options.headerContainerRef, - "class": _ctx.cx("header") - }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header", { - "class": normalizeClass(_ctx.cx("title")) - }, function() { - return [_ctx.header ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("title") - }, _ctx.ptm("title")), toDisplayString(_ctx.header), 17)) : createCommentVNode("", true)]; - }), _ctx.showCloseIcon ? (openBlock(), createBlock(_component_Button, mergeProps({ - key: 0, - ref: $options.closeButtonRef, - type: "button", - "class": _ctx.cx("pcCloseButton"), - "aria-label": $options.closeAriaLabel, - unstyled: _ctx.unstyled, - onClick: $options.hide - }, _ctx.closeButtonProps, { - pt: _ctx.ptm("pcCloseButton"), - "data-pc-group-section": "iconcontainer" - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "closeicon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon ? "span" : "TimesIcon"), mergeProps({ - "class": [_ctx.closeIcon, slotProps["class"]] - }, _ctx.ptm("pcCloseButton")["icon"]), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "aria-label", "unstyled", "onClick", "pt"])) : createCommentVNode("", true)], 16), createBaseVNode("div", mergeProps({ - ref: $options.contentRef, - "class": _ctx.cx("content") - }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: $options.footerContainerRef, - "class": _ctx.cx("footer") - }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true)], 64))], 16, _hoisted_1$v)), [[_directive_focustrap]]) : createCommentVNode("", true)]; - }), - _: 3 - }, 16, ["onEnter", "onAfterEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])], 16)) : createCommentVNode("", true)]; - }), - _: 3 - }); -} -__name(render$13, "render$13"); -script$1c.render = render$13; +import { d as defineComponent, bw as mergeModels, bq as useModel, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, aj as normalizeClass, i as withDirectives, v as vShow, k as createVNode, j as unref, bE as script$1c, l as script$1d, c as computed, bF as PrimeIcons, bg as t, a5 as script$1e, b1 as inject, bG as BaseStyle, bH as script$1f, at as mergeProps, bI as Transition, C as resolveDynamicComponent, A as renderSlot, B as createCommentVNode, bJ as findSingle, bK as getAttribute, bL as focus, bM as script$1g, bN as script$1h, bO as Ripple, r as resolveDirective, bP as UniqueComponentId, bQ as script$1i, bR as resolveComponent, f as createElementBlock, F as Fragment, D as renderList, E as toDisplayString, bS as BaseDirective, bT as removeClass, bU as addClass, bV as createElement, bW as hasClass, bX as script$1j, bY as script$1k, bZ as ZIndex, b_ as addStyle, b$ as ConnectedOverlayScrollHandler, c0 as isTouchDevice, c1 as relativePosition, c2 as getOuterWidth, c3 as absolutePosition, c4 as find, c5 as getIndex, c6 as getFocusableElements, c7 as OverlayEventBus, c8 as setAttribute, c9 as localeComparator, bk as script$1l, ca as script$1m, cb as script$1n, n as normalizeStyle, a8 as createTextVNode, bj as withKeys, cc as resolveFieldData, cd as isNotEmpty, ce as equals, cf as script$1o, cg as isString, ch as isPrintableCharacter, ci as isEmpty, cj as findLastIndex, ck as script$1p, cl as script$1q, cm as script$1r, cn as uuid, a9 as script$1s, co as sort, cp as createSlots, cq as EventBus, H as markRaw, cr as resolve, cs as Tooltip, bm as script$1u, ac as script$1v, ct as script$1w, cu as script$1x, cv as script$1y, cw as script$1z, bn as script$1A, cx as normalizeProps, cy as blockBodyScroll, cz as isAttributeEquals, cA as unblockBodyScroll, cB as FocusTrap, cC as guardReactiveProps, cD as setCSSProperty, cE as $dt, cF as script$1C, cG as script$1E, cH as getUserAgent, br as script$1F, cI as script$1G, cJ as getFirstFocusableElement, cK as getLastFocusableElement, cL as FilterService, bv as script$1I, cM as script$1J, bt as script$1K, bs as script$1L, cN as script$1M, cO as findIndexInList, cP as scrollInView, cQ as script$1N, cR as script$1O, cS as script$1P, cT as findLast, cU as getWindowScrollTop, cV as getWidth, cW as getOffset, cX as vModelText, cY as script$1U, as as withModifiers, cZ as getVNodeProp, c_ as getNextElementSibling, c$ as getPreviousElementSibling, d0 as isClickable, d1 as _default, d2 as clearSelection, d3 as isRTL, b9 as electronAPI, a1 as defineStore, T as ref, d4 as useTimeout, N as watch, d5 as script$1Y, _ as _export_sfc, aV as useToast, d6 as useConfirm, bl as script$1Z, d7 as script$1_, p as onMounted, d8 as onUnmounted, aw as script$1$, ag as isRef } from "./index-DqXp9vW4.js"; +import { a as script$1B, b as script$1D, s as script$20 } from "./index-B0BQ8jlU.js"; +import "./index-DSWvxALN.js"; +import { s as script$1t, a as script$1Q, b as script$1R, c as script$1S, d as script$1V, e as script$1W, f as script$1X } from "./index-KUUE4Ew8.js"; +import { s as script$1T, _ as _sfc_main$7 } from "./TerminalOutputDrawer-BgTEspHP.js"; +import { s as script$1H } from "./index-BTHx8UHZ.js"; +import "./index-A-dAhghd.js"; +import { _ as _sfc_main$8 } from "./BaseViewTemplate-DlGljfEG.js"; const _sfc_main$6 = /* @__PURE__ */ defineComponent({ __name: "RefreshButton", props: /* @__PURE__ */ mergeModels({ @@ -406,7 +23,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({ const props = __props; const active3 = useModel(__props, "modelValue"); return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$1e), { + return openBlock(), createBlock(unref(script$1d), { class: "relative p-button-icon-only", outlined: props.outlined, severity: props.severity, @@ -422,7 +39,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({ class: "p-button-label", "data-pc-section": "label" }, " ", -1)), - withDirectives(createVNode(unref(script$1h), { class: "absolute w-1/2 h-1/2" }, null, 512), [ + withDirectives(createVNode(unref(script$1c), { class: "absolute w-1/2 h-1/2" }, null, 512), [ [vShow, active3.value] ]) ]), @@ -455,7 +72,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({ return t("maintenance.OK"); }); return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$1i), { + return openBlock(), createBlock(unref(script$1e), { icon: icon2.value, severity: severity.value, value: value2.value @@ -482,7 +99,7 @@ var AccordionContentStyle = BaseStyle.extend({ }); var script$1$N = { name: "BaseAccordionContent", - "extends": script$1d, + "extends": script$1f, props: { as: { type: [String, Object], @@ -494,7 +111,7 @@ var script$1$N = { } }, style: AccordionContentStyle, - provide: /* @__PURE__ */ __name(function provide2() { + provide: /* @__PURE__ */ __name(function provide() { return { $pcAccordionContent: this, $parentInstance: this @@ -572,7 +189,7 @@ var AccordionHeaderStyle = BaseStyle.extend({ }); var script$1$M = { name: "BaseAccordionHeader", - "extends": script$1d, + "extends": script$1f, props: { as: { type: [String, Object], @@ -584,7 +201,7 @@ var script$1$M = { } }, style: AccordionHeaderStyle, - provide: /* @__PURE__ */ __name(function provide3() { + provide: /* @__PURE__ */ __name(function provide2() { return { $pcAccordionHeader: this, $parentInstance: this @@ -603,7 +220,7 @@ var script$1a = { onClick: /* @__PURE__ */ __name(function onClick() { this.changeActiveValue(); }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown2(event2) { + onKeydown: /* @__PURE__ */ __name(function onKeydown(event2) { switch (event2.code) { case "ArrowDown": this.onArrowDownKey(event2); @@ -715,8 +332,8 @@ var script$1a = { }, "ptParams") }, components: { - ChevronUpIcon: script$1j, - ChevronDownIcon: script$1k + ChevronUpIcon: script$1g, + ChevronDownIcon: script$1h }, directives: { ripple: Ripple @@ -759,7 +376,7 @@ function render$11(_ctx, _cache, $props, $setup, $data, $options) { __name(render$11, "render$11"); script$1a.render = render$11; var classes$J = { - root: /* @__PURE__ */ __name(function root2(_ref) { + root: /* @__PURE__ */ __name(function root(_ref) { var instance = _ref.instance, props = _ref.props; return ["p-accordionpanel", { "p-accordionpanel-active": instance.active, @@ -773,7 +390,7 @@ var AccordionPanelStyle = BaseStyle.extend({ }); var script$1$L = { name: "BaseAccordionPanel", - "extends": script$1d, + "extends": script$1f, props: { value: { type: [String, Number], @@ -793,7 +410,7 @@ var script$1$L = { } }, style: AccordionPanelStyle, - provide: /* @__PURE__ */ __name(function provide4() { + provide: /* @__PURE__ */ __name(function provide3() { return { $pcAccordionPanel: this, $parentInstance: this @@ -846,7 +463,7 @@ function render$10(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$10, "render$10"); script$19.render = render$10; -var theme$C = /* @__PURE__ */ __name(function theme2(_ref) { +var theme$C = /* @__PURE__ */ __name(function theme(_ref) { var dt = _ref.dt; return "\n.p-accordionpanel {\n display: flex;\n flex-direction: column;\n border-style: solid;\n border-width: ".concat(dt("accordion.panel.border.width"), ";\n border-color: ").concat(dt("accordion.panel.border.color"), ";\n}\n\n.p-accordionheader {\n all: unset;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: ").concat(dt("accordion.header.padding"), ";\n color: ").concat(dt("accordion.header.color"), ";\n background: ").concat(dt("accordion.header.background"), ";\n border-style: solid;\n border-width: ").concat(dt("accordion.header.border.width"), ";\n border-color: ").concat(dt("accordion.header.border.color"), ";\n font-weight: ").concat(dt("accordion.header.font.weight"), ";\n border-radius: ").concat(dt("accordion.header.border.radius"), ";\n transition: background ").concat(dt("accordion.transition.duration"), "; color ").concat(dt("accordion.transition.duration"), "color ").concat(dt("accordion.transition.duration"), ", outline-color ").concat(dt("accordion.transition.duration"), ", box-shadow ").concat(dt("accordion.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-accordionpanel:first-child > .p-accordionheader {\n border-width: ").concat(dt("accordion.header.first.border.width"), ";\n border-start-start-radius: ").concat(dt("accordion.header.first.top.border.radius"), ";\n border-start-end-radius: ").concat(dt("accordion.header.first.top.border.radius"), ";\n}\n\n.p-accordionpanel:last-child > .p-accordionheader {\n border-end-start-radius: ").concat(dt("accordion.header.last.bottom.border.radius"), ";\n border-end-end-radius: ").concat(dt("accordion.header.last.bottom.border.radius"), ";\n}\n\n.p-accordionpanel:last-child.p-accordionpanel-active > .p-accordionheader {\n border-end-start-radius: ").concat(dt("accordion.header.last.active.bottom.border.radius"), ";\n border-end-end-radius: ").concat(dt("accordion.header.last.active.bottom.border.radius"), ";\n}\n\n.p-accordionheader-toggle-icon {\n color: ").concat(dt("accordion.header.toggle.icon.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled) .p-accordionheader:focus-visible {\n box-shadow: ").concat(dt("accordion.header.focus.ring.shadow"), ";\n outline: ").concat(dt("accordion.header.focus.ring.width"), " ").concat(dt("accordion.header.focus.ring.style"), " ").concat(dt("accordion.header.focus.ring.color"), ";\n outline-offset: ").concat(dt("accordion.header.focus.ring.offset"), ";\n}\n\n.p-accordionpanel:not(.p-accordionpanel-active):not(.p-disabled) > .p-accordionheader:hover {\n background: ").concat(dt("accordion.header.hover.background"), ";\n color: ").concat(dt("accordion.header.hover.color"), ";\n}\n\n.p-accordionpanel:not(.p-accordionpanel-active):not(.p-disabled) .p-accordionheader:hover .p-accordionheader-toggle-icon {\n color: ").concat(dt("accordion.header.toggle.icon.hover.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled).p-accordionpanel-active > .p-accordionheader {\n background: ").concat(dt("accordion.header.active.background"), ";\n color: ").concat(dt("accordion.header.active.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled).p-accordionpanel-active > .p-accordionheader .p-accordionheader-toggle-icon {\n color: ").concat(dt("accordion.header.toggle.icon.active.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled).p-accordionpanel-active > .p-accordionheader:hover {\n background: ").concat(dt("accordion.header.active.hover.background"), ";\n color: ").concat(dt("accordion.header.active.hover.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled).p-accordionpanel-active > .p-accordionheader:hover .p-accordionheader-toggle-icon {\n color: ").concat(dt("accordion.header.toggle.icon.active.hover.color"), ";\n}\n\n.p-accordioncontent-content {\n border-style: solid;\n border-width: ").concat(dt("accordion.content.border.width"), ";\n border-color: ").concat(dt("accordion.content.border.color"), ";\n background-color: ").concat(dt("accordion.content.background"), ";\n color: ").concat(dt("accordion.content.color"), ";\n padding: ").concat(dt("accordion.content.padding"), ";\n}\n"); }, "theme"); @@ -860,7 +477,7 @@ var AccordionStyle = BaseStyle.extend({ }); var script$1$K = { name: "BaseAccordion", - "extends": script$1d, + "extends": script$1f, props: { value: { type: [String, Number, Array], @@ -897,7 +514,7 @@ var script$1$K = { } }, style: AccordionStyle, - provide: /* @__PURE__ */ __name(function provide5() { + provide: /* @__PURE__ */ __name(function provide4() { return { $pcAccordion: this, $parentInstance: this @@ -909,7 +526,7 @@ var script$18 = { "extends": script$1$K, inheritAttrs: false, emits: ["update:value", "update:activeIndex", "tab-open", "tab-close", "tab-click"], - data: /* @__PURE__ */ __name(function data2() { + data: /* @__PURE__ */ __name(function data() { return { id: this.$attrs.id, d_value: this.value @@ -1040,8 +657,8 @@ var script$18 = { AccordionPanel: script$19, AccordionHeader: script$1a, AccordionContent: script$1b, - ChevronUpIcon: script$1j, - ChevronRightIcon: script$1l + ChevronUpIcon: script$1g, + ChevronRightIcon: script$1i } }; function render$$(_ctx, _cache, $props, $setup, $data, $options) { @@ -1115,7 +732,7 @@ var AccordionTabStyle = BaseStyle.extend({ }); var script$1$J = { name: "BaseAccordionTab", - "extends": script$1d, + "extends": script$1f, props: { header: null, headerStyle: null, @@ -1128,7 +745,7 @@ var script$1$J = { disabled: Boolean }, style: AccordionTabStyle, - provide: /* @__PURE__ */ __name(function provide6() { + provide: /* @__PURE__ */ __name(function provide5() { return { $pcAccordionTab: this, $parentInstance: this @@ -1284,9 +901,9 @@ var AnimateOnScroll = BaseAnimateOnScroll.extend("animateonscroll", { }, "bindAnimationEvents"), bindIntersectionObserver: /* @__PURE__ */ __name(function bindIntersectionObserver() { var _this2 = this; - var _this$$value = this.$value, root35 = _this$$value.root, rootMargin = _this$$value.rootMargin, _this$$value$threshol = _this$$value.threshold, threshold = _this$$value$threshol === void 0 ? 0.5 : _this$$value$threshol; + var _this$$value = this.$value, root34 = _this$$value.root, rootMargin = _this$$value.rootMargin, _this$$value$threshol = _this$$value.threshold, threshold = _this$$value$threshol === void 0 ? 0.5 : _this$$value$threshol; var options4 = { - root: root35, + root: root34, rootMargin, threshold }; @@ -1349,12 +966,12 @@ var AnimateOnScroll = BaseAnimateOnScroll.extend("animateonscroll", { }, "unbindIntersectionObserver") } }); -var theme$B = /* @__PURE__ */ __name(function theme3(_ref) { +var theme$B = /* @__PURE__ */ __name(function theme2(_ref) { var dt = _ref.dt; return "\n.p-avatar {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: ".concat(dt("avatar.width"), ";\n height: ").concat(dt("avatar.height"), ";\n font-size: ").concat(dt("avatar.font.size"), ";\n background: ").concat(dt("avatar.background"), ";\n color: ").concat(dt("avatar.color"), ";\n border-radius: ").concat(dt("avatar.border.radius"), ";\n}\n\n.p-avatar-image {\n background: transparent;\n}\n\n.p-avatar-circle {\n border-radius: 50%;\n}\n\n.p-avatar-circle img {\n border-radius: 50%;\n}\n\n.p-avatar-icon {\n font-size: ").concat(dt("avatar.icon.size"), ";\n width: ").concat(dt("avatar.icon.size"), ";\n height: ").concat(dt("avatar.icon.size"), ";\n}\n\n.p-avatar img {\n width: 100%;\n height: 100%;\n}\n\n.p-avatar-lg {\n width: ").concat(dt("avatar.lg.width"), ";\n height: ").concat(dt("avatar.lg.width"), ";\n font-size: ").concat(dt("avatar.lg.font.size"), ";\n}\n\n.p-avatar-lg .p-avatar-icon {\n font-size: ").concat(dt("avatar.lg.icon.size"), ";\n width: ").concat(dt("avatar.lg.icon.size"), ";\n height: ").concat(dt("avatar.lg.icon.size"), ";\n}\n\n.p-avatar-xl {\n width: ").concat(dt("avatar.xl.width"), ";\n height: ").concat(dt("avatar.xl.width"), ";\n font-size: ").concat(dt("avatar.xl.font.size"), ";\n}\n\n.p-avatar-xl .p-avatar-icon {\n font-size: ").concat(dt("avatar.xl.icon.size"), ";\n width: ").concat(dt("avatar.xl.icon.size"), ";\n height: ").concat(dt("avatar.xl.icon.size"), ";\n}\n\n.p-avatar-group {\n display: flex;\n align-items: center;\n}\n\n.p-avatar-group .p-avatar + .p-avatar {\n margin-inline-start: ").concat(dt("avatar.group.offset"), ";\n}\n\n.p-avatar-group .p-avatar {\n border: 2px solid ").concat(dt("avatar.group.border.color"), ";\n}\n\n.p-avatar-group .p-avatar-lg + .p-avatar-lg {\n margin-inline-start: ").concat(dt("avatar.lg.group.offset"), ";\n}\n\n.p-avatar-group .p-avatar-xl + .p-avatar-xl {\n margin-inline-start: ").concat(dt("avatar.xl.group.offset"), ";\n}\n"); }, "theme"); var classes$H = { - root: /* @__PURE__ */ __name(function root3(_ref2) { + root: /* @__PURE__ */ __name(function root2(_ref2) { var props = _ref2.props; return ["p-avatar p-component", { "p-avatar-image": props.image != null, @@ -1373,7 +990,7 @@ var AvatarStyle = BaseStyle.extend({ }); var script$1$I = { name: "BaseAvatar", - "extends": script$1d, + "extends": script$1f, props: { label: { type: String, @@ -1405,7 +1022,7 @@ var script$1$I = { } }, style: AvatarStyle, - provide: /* @__PURE__ */ __name(function provide7() { + provide: /* @__PURE__ */ __name(function provide6() { return { $pcAvatar: this, $parentInstance: this @@ -1461,9 +1078,9 @@ var AvatarGroupStyle = BaseStyle.extend({ }); var script$1$H = { name: "BaseAvatarGroup", - "extends": script$1d, + "extends": script$1f, style: AvatarGroupStyle, - provide: /* @__PURE__ */ __name(function provide8() { + provide: /* @__PURE__ */ __name(function provide7() { return { $pcAvatarGroup: this, $parentInstance: this @@ -1577,7 +1194,7 @@ var BadgeDirective = BaseBadgeDirective.extend("badge", { el.appendChild(badge); this.$el = badge; }, "mounted"), - updated: /* @__PURE__ */ __name(function updated2(el, binding) { + updated: /* @__PURE__ */ __name(function updated(el, binding) { !this.isUnstyled() && addClass(el, "p-overlay-badge"); el.setAttribute("data-p-overlay-badge", "true"); if (binding.oldValue !== binding.value) { @@ -1598,7 +1215,7 @@ var BadgeDirective = BaseBadgeDirective.extend("badge", { } }, "updated") }); -var theme$A = /* @__PURE__ */ __name(function theme4(_ref) { +var theme$A = /* @__PURE__ */ __name(function theme3(_ref) { var dt = _ref.dt; return "\n.p-breadcrumb {\n background: ".concat(dt("breadcrumb.background"), ";\n padding: ").concat(dt("breadcrumb.padding"), ";\n overflow-x: auto;\n}\n\n.p-breadcrumb-list {\n margin: 0;\n padding: 0;\n list-style-type: none;\n display: flex;\n align-items: center;\n flex-wrap: nowrap;\n gap: ").concat(dt("breadcrumb.gap"), ";\n}\n\n.p-breadcrumb-separator {\n display: flex;\n align-items: center;\n color: ").concat(dt("breadcrumb.separator.color"), ";\n}\n\n.p-breadcrumb-separator-icon:dir(rtl) {\n transform: rotate(180deg);\n}\n\n.p-breadcrumb::-webkit-scrollbar {\n display: none;\n}\n\n.p-breadcrumb-item-link {\n text-decoration: none;\n display: flex;\n align-items: center;\n gap: ").concat(dt("breadcrumb.item.gap"), ";\n transition: background ").concat(dt("breadcrumb.transition.duration"), ", color ").concat(dt("breadcrumb.transition.duration"), ", outline-color ").concat(dt("breadcrumb.transition.duration"), ", box-shadow ").concat(dt("breadcrumb.transition.duration"), ";\n border-radius: ").concat(dt("breadcrumb.item.border.radius"), ";\n outline-color: transparent;\n color: ").concat(dt("breadcrumb.item.color"), ";\n}\n\n.p-breadcrumb-item-link:focus-visible {\n box-shadow: ").concat(dt("breadcrumb.item.focus.ring.shadow"), ";\n outline: ").concat(dt("breadcrumb.item.focus.ring.width"), " ").concat(dt("breadcrumb.item.focus.ring.style"), " ").concat(dt("breadcrumb.item.focus.ring.color"), ";\n outline-offset: ").concat(dt("breadcrumb.item.focus.ring.offset"), ";\n}\n\n.p-breadcrumb-item-link:hover .p-breadcrumb-item-label {\n color: ").concat(dt("breadcrumb.item.hover.color"), ";\n}\n\n.p-breadcrumb-item-label {\n transition: inherit;\n}\n\n.p-breadcrumb-item-icon {\n color: ").concat(dt("breadcrumb.item.icon.color"), ";\n transition: inherit;\n}\n\n.p-breadcrumb-item-link:hover .p-breadcrumb-item-icon {\n color: ").concat(dt("breadcrumb.item.icon.hover.color"), ";\n}\n"); }, "theme"); @@ -1625,7 +1242,7 @@ var BreadcrumbStyle = BaseStyle.extend({ }); var script$2$9 = { name: "BaseBreadcrumb", - "extends": script$1d, + "extends": script$1f, props: { model: { type: Array, @@ -1637,7 +1254,7 @@ var script$2$9 = { } }, style: BreadcrumbStyle, - provide: /* @__PURE__ */ __name(function provide9() { + provide: /* @__PURE__ */ __name(function provide8() { return { $pcBreadcrumb: this, $parentInstance: this @@ -1647,7 +1264,7 @@ var script$2$9 = { var script$1$G = { name: "BreadcrumbItem", hostName: "Breadcrumb", - "extends": script$1d, + "extends": script$1f, props: { item: null, templates: null, @@ -1745,7 +1362,7 @@ var script$14 = { inheritAttrs: false, components: { BreadcrumbItem: script$1$G, - ChevronRightIcon: script$1l + ChevronRightIcon: script$1i } }; function render$X(_ctx, _cache, $props, $setup, $data, $options) { @@ -1788,7 +1405,7 @@ __name(render$X, "render$X"); script$14.render = render$X; var script$13 = { name: "CalendarIcon", - "extends": script$1m + "extends": script$1j }; function render$W(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ @@ -1804,12 +1421,12 @@ function render$W(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$W, "render$W"); script$13.render = render$W; -var theme$z = /* @__PURE__ */ __name(function theme5(_ref) { +var theme$z = /* @__PURE__ */ __name(function theme4(_ref) { var dt = _ref.dt; return "\n.p-datepicker {\n display: inline-flex;\n max-width: 100%;\n}\n\n.p-datepicker-input {\n flex: 1 1 auto;\n width: 1%;\n}\n\n.p-datepicker:has(.p-datepicker-dropdown) .p-datepicker-input {\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n}\n\n.p-datepicker-dropdown {\n cursor: pointer;\n display: inline-flex;\n user-select: none;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n width: ".concat(dt("datepicker.dropdown.width"), ";\n border-start-end-radius: ").concat(dt("datepicker.dropdown.border.radius"), ";\n border-end-end-radius: ").concat(dt("datepicker.dropdown.border.radius"), ";\n background: ").concat(dt("datepicker.dropdown.background"), ";\n border: 1px solid ").concat(dt("datepicker.dropdown.border.color"), ";\n border-inline-start: 0 none;\n color: ").concat(dt("datepicker.dropdown.color"), ";\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-datepicker-dropdown:not(:disabled):hover {\n background: ").concat(dt("datepicker.dropdown.hover.background"), ";\n border-color: ").concat(dt("datepicker.dropdown.hover.border.color"), ";\n color: ").concat(dt("datepicker.dropdown.hover.color"), ";\n}\n\n.p-datepicker-dropdown:not(:disabled):active {\n background: ").concat(dt("datepicker.dropdown.active.background"), ";\n border-color: ").concat(dt("datepicker.dropdown.active.border.color"), ";\n color: ").concat(dt("datepicker.dropdown.active.color"), ";\n}\n\n.p-datepicker-dropdown:focus-visible {\n box-shadow: ").concat(dt("datepicker.dropdown.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.dropdown.focus.ring.width"), " ").concat(dt("datepicker.dropdown.focus.ring.style"), " ").concat(dt("datepicker.dropdown.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.dropdown.focus.ring.offset"), ";\n}\n\n.p-datepicker:has(.p-datepicker-input-icon-container) {\n position: relative;\n}\n\n.p-datepicker:has(.p-datepicker-input-icon-container) .p-datepicker-input {\n padding-inline-end: calc((").concat(dt("form.field.padding.x"), " * 2) + ").concat(dt("icon.size"), ");\n}\n\n.p-datepicker-input-icon-container {\n cursor: pointer;\n position: absolute;\n top: 50%;\n inset-inline-end: ").concat(dt("form.field.padding.x"), ";\n margin-block-start: calc(-1 * (").concat(dt("icon.size"), " / 2));\n color: ").concat(dt("datepicker.input.icon.color"), ";\n line-height: 1;\n}\n\n.p-datepicker-fluid {\n display: flex;\n}\n\n.p-datepicker-fluid .p-datepicker-input {\n width: 1%;\n}\n\n.p-datepicker .p-datepicker-panel {\n min-width: 100%;\n}\n\n.p-datepicker-panel {\n width: auto;\n padding: ").concat(dt("datepicker.panel.padding"), ";\n background: ").concat(dt("datepicker.panel.background"), ";\n color: ").concat(dt("datepicker.panel.color"), ";\n border: 1px solid ").concat(dt("datepicker.panel.border.color"), ";\n border-radius: ").concat(dt("datepicker.panel.border.radius"), ";\n box-shadow: ").concat(dt("datepicker.panel.shadow"), ";\n}\n\n.p-datepicker-panel-inline {\n display: inline-block;\n overflow-x: auto;\n box-shadow: none;\n}\n\n.p-datepicker-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: ").concat(dt("datepicker.header.padding"), ";\n background: ").concat(dt("datepicker.header.background"), ";\n color: ").concat(dt("datepicker.header.color"), ";\n border-block-end: 1px solid ").concat(dt("datepicker.header.border.color"), ";\n}\n\n.p-datepicker-next-button:dir(rtl) {\n order: -1;\n}\n\n.p-datepicker-prev-button:dir(rtl) {\n order: 1;\n}\n\n.p-datepicker-title {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ").concat(dt("datepicker.title.gap"), ";\n font-weight: ").concat(dt("datepicker.title.font.weight"), ";\n}\n\n.p-datepicker-select-year,\n.p-datepicker-select-month {\n border: none;\n background: transparent;\n margin: 0;\n cursor: pointer;\n font-weight: inherit;\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ", box-shadow ").concat(dt("datepicker.transition.duration"), ";\n}\n\n.p-datepicker-select-month {\n padding: ").concat(dt("datepicker.select.month.padding"), ";\n color: ").concat(dt("datepicker.select.month.color"), ";\n border-radius: ").concat(dt("datepicker.select.month.border.radius"), ";\n}\n\n.p-datepicker-select-year {\n padding: ").concat(dt("datepicker.select.year.padding"), ";\n color: ").concat(dt("datepicker.select.year.color"), ";\n border-radius: ").concat(dt("datepicker.select.year.border.radius"), ";\n}\n\n.p-datepicker-select-month:enabled:hover {\n background: ").concat(dt("datepicker.select.month.hover.background"), ";\n color: ").concat(dt("datepicker.select.month.hover.color"), ";\n}\n\n.p-datepicker-select-year:enabled:hover {\n background: ").concat(dt("datepicker.select.year.hover.background"), ";\n color: ").concat(dt("datepicker.select.year.hover.color"), ";\n}\n\n.p-datepicker-select-month:focus-visible,\n.p-datepicker-select-year:focus-visible {\n box-shadow: ").concat(dt("datepicker.date.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.date.focus.ring.width"), " ").concat(dt("datepicker.date.focus.ring.style"), " ").concat(dt("datepicker.date.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.date.focus.ring.offset"), ";\n}\n\n.p-datepicker-calendar-container {\n display: flex;\n}\n\n.p-datepicker-calendar-container .p-datepicker-calendar {\n flex: 1 1 auto;\n border-inline-start: 1px solid ").concat(dt("datepicker.group.border.color"), ";\n padding-inline-end: ").concat(dt("datepicker.group.gap"), ";\n padding-inline-start: ").concat(dt("datepicker.group.gap"), ";\n}\n\n.p-datepicker-calendar-container .p-datepicker-calendar:first-child {\n padding-inline-start: 0;\n border-inline-start: 0 none;\n}\n\n.p-datepicker-calendar-container .p-datepicker-calendar:last-child {\n padding-inline-end: 0;\n}\n\n.p-datepicker-day-view {\n width: 100%;\n border-collapse: collapse;\n font-size: 1rem;\n margin: ").concat(dt("datepicker.day.view.margin"), ";\n}\n\n.p-datepicker-weekday-cell {\n padding: ").concat(dt("datepicker.week.day.padding"), ";\n}\n\n.p-datepicker-weekday {\n font-weight: ").concat(dt("datepicker.week.day.font.weight"), ";\n color: ").concat(dt("datepicker.week.day.color"), ";\n}\n\n.p-datepicker-day-cell {\n padding: ").concat(dt("datepicker.date.padding"), ";\n}\n\n.p-datepicker-day {\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n margin: 0 auto;\n overflow: hidden;\n position: relative;\n width: ").concat(dt("datepicker.date.width"), ";\n height: ").concat(dt("datepicker.date.height"), ";\n border-radius: ").concat(dt("datepicker.date.border.radius"), ";\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", box-shadow ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ";\n border: 1px solid transparent;\n outline-color: transparent;\n color: ").concat(dt("datepicker.date.color"), ";\n}\n\n.p-datepicker-day:not(.p-datepicker-day-selected):not(.p-disabled):hover {\n background: ").concat(dt("datepicker.date.hover.background"), ";\n color: ").concat(dt("datepicker.date.hover.color"), ";\n}\n\n.p-datepicker-day:focus-visible {\n box-shadow: ").concat(dt("datepicker.date.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.date.focus.ring.width"), " ").concat(dt("datepicker.date.focus.ring.style"), " ").concat(dt("datepicker.date.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.date.focus.ring.offset"), ";\n}\n\n.p-datepicker-day-selected {\n background: ").concat(dt("datepicker.date.selected.background"), ";\n color: ").concat(dt("datepicker.date.selected.color"), ";\n}\n\n.p-datepicker-day-selected-range {\n background: ").concat(dt("datepicker.date.range.selected.background"), ";\n color: ").concat(dt("datepicker.date.range.selected.color"), ";\n}\n\n.p-datepicker-today > .p-datepicker-day {\n background: ").concat(dt("datepicker.today.background"), ";\n color: ").concat(dt("datepicker.today.color"), ";\n}\n\n.p-datepicker-today > .p-datepicker-day-selected {\n background: ").concat(dt("datepicker.date.selected.background"), ";\n color: ").concat(dt("datepicker.date.selected.color"), ";\n}\n\n.p-datepicker-today > .p-datepicker-day-selected-range {\n background: ").concat(dt("datepicker.date.range.selected.background"), ";\n color: ").concat(dt("datepicker.date.range.selected.color"), ";\n}\n\n.p-datepicker-weeknumber {\n text-align: center;\n}\n\n.p-datepicker-month-view {\n margin: ").concat(dt("datepicker.month.view.margin"), ";\n}\n\n.p-datepicker-month {\n width: 33.3%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n overflow: hidden;\n position: relative;\n padding: ").concat(dt("datepicker.month.padding"), ";\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", box-shadow ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ";\n border-radius: ").concat(dt("datepicker.month.border.radius"), ";\n outline-color: transparent;\n color: ").concat(dt("datepicker.date.color"), ";\n}\n\n.p-datepicker-month:not(.p-disabled):not(.p-datepicker-month-selected):hover {\n color: ").concat(dt("datepicker.date.hover.color"), ";\n background: ").concat(dt("datepicker.date.hover.background"), ";\n}\n\n.p-datepicker-month-selected {\n color: ").concat(dt("datepicker.date.selected.color"), ";\n background: ").concat(dt("datepicker.date.selected.background"), ";\n}\n\n.p-datepicker-month:not(.p-disabled):focus-visible {\n box-shadow: ").concat(dt("datepicker.date.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.date.focus.ring.width"), " ").concat(dt("datepicker.date.focus.ring.style"), " ").concat(dt("datepicker.date.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.date.focus.ring.offset"), ";\n}\n\n.p-datepicker-year-view {\n margin: ").concat(dt("datepicker.year.view.margin"), ";\n}\n\n.p-datepicker-year {\n width: 50%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n overflow: hidden;\n position: relative;\n padding: ").concat(dt("datepicker.year.padding"), ";\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", box-shadow ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ";\n border-radius: ").concat(dt("datepicker.year.border.radius"), ";\n outline-color: transparent;\n color: ").concat(dt("datepicker.date.color"), ";\n}\n\n.p-datepicker-year:not(.p-disabled):not(.p-datepicker-year-selected):hover {\n color: ").concat(dt("datepicker.date.hover.color"), ";\n background: ").concat(dt("datepicker.date.hover.background"), ";\n}\n\n.p-datepicker-year-selected {\n color: ").concat(dt("datepicker.date.selected.color"), ";\n background: ").concat(dt("datepicker.date.selected.background"), ";\n}\n\n.p-datepicker-year:not(.p-disabled):focus-visible {\n box-shadow: ").concat(dt("datepicker.date.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.date.focus.ring.width"), " ").concat(dt("datepicker.date.focus.ring.style"), " ").concat(dt("datepicker.date.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.date.focus.ring.offset"), ";\n}\n\n.p-datepicker-buttonbar {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: ").concat(dt("datepicker.buttonbar.padding"), ";\n border-block-start: 1px solid ").concat(dt("datepicker.buttonbar.border.color"), ";\n}\n\n.p-datepicker-buttonbar .p-button {\n width: auto;\n}\n\n.p-datepicker-time-picker {\n display: flex;\n justify-content: center;\n align-items: center;\n border-block-start: 1px solid ").concat(dt("datepicker.time.picker.border.color"), ";\n padding: 0;\n gap: ").concat(dt("datepicker.time.picker.gap"), ";\n}\n\n.p-datepicker-calendar-container + .p-datepicker-time-picker {\n padding: ").concat(dt("datepicker.time.picker.padding"), ";\n}\n\n.p-datepicker-time-picker > div {\n display: flex;\n align-items: center;\n flex-direction: column;\n gap: ").concat(dt("datepicker.time.picker.button.gap"), ";\n}\n\n.p-datepicker-time-picker span {\n font-size: 1rem;\n}\n\n.p-datepicker-timeonly .p-datepicker-time-picker {\n border-block-start: 0 none;\n}\n\n.p-datepicker:has(.p-inputtext-sm) .p-datepicker-dropdown {\n width: ").concat(dt("datepicker.dropdown.sm.width"), ";\n}\n\n.p-datepicker:has(.p-inputtext-sm) .p-datepicker-dropdown .p-icon,\n.p-datepicker:has(.p-inputtext-sm) .p-datepicker-input-icon {\n font-size: ").concat(dt("form.field.sm.font.size"), ";\n width: ").concat(dt("form.field.sm.font.size"), ";\n height: ").concat(dt("form.field.sm.font.size"), ";\n}\n\n.p-datepicker:has(.p-inputtext-lg) .p-datepicker-dropdown {\n width: ").concat(dt("datepicker.dropdown.lg.width"), ";\n}\n\n.p-datepicker:has(.p-inputtext-lg) .p-datepicker-dropdown .p-icon,\n.p-datepicker:has(.p-inputtext-lg) .p-datepicker-input-icon {\n font-size: ").concat(dt("form.field.lg.font.size"), ";\n width: ").concat(dt("form.field.lg.font.size"), ";\n height: ").concat(dt("form.field.lg.font.size"), ";\n}\n"); }, "theme"); var inlineStyles$8 = { - root: /* @__PURE__ */ __name(function root4(_ref2) { + root: /* @__PURE__ */ __name(function root3(_ref2) { var props = _ref2.props; return { position: props.appendTo === "self" ? "relative" : void 0 @@ -1817,7 +1434,7 @@ var inlineStyles$8 = { }, "root") }; var classes$D = { - root: /* @__PURE__ */ __name(function root5(_ref3) { + root: /* @__PURE__ */ __name(function root4(_ref3) { var instance = _ref3.instance, state = _ref3.state; return ["p-datepicker p-component p-inputwrapper", { "p-invalid": instance.$invalid, @@ -1908,7 +1525,7 @@ var DatePickerStyle = BaseStyle.extend({ }); var script$1$F = { name: "BaseDatePicker", - "extends": script$1n, + "extends": script$1k, props: { selectionMode: { type: String, @@ -2097,7 +1714,7 @@ var script$1$F = { }, todayButtonProps: { type: Object, - "default": /* @__PURE__ */ __name(function _default3() { + "default": /* @__PURE__ */ __name(function _default2() { return { severity: "secondary", text: true, @@ -2107,7 +1724,7 @@ var script$1$F = { }, clearButtonProps: { type: Object, - "default": /* @__PURE__ */ __name(function _default4() { + "default": /* @__PURE__ */ __name(function _default3() { return { severity: "secondary", text: true, @@ -2117,7 +1734,7 @@ var script$1$F = { }, navigatorButtonProps: { type: Object, - "default": /* @__PURE__ */ __name(function _default5() { + "default": /* @__PURE__ */ __name(function _default4() { return { severity: "secondary", text: true, @@ -2127,7 +1744,7 @@ var script$1$F = { }, timepickerButtonProps: { type: Object, - "default": /* @__PURE__ */ __name(function _default6() { + "default": /* @__PURE__ */ __name(function _default5() { return { severity: "secondary", text: true, @@ -2145,7 +1762,7 @@ var script$1$F = { } }, style: DatePickerStyle, - provide: /* @__PURE__ */ __name(function provide10() { + provide: /* @__PURE__ */ __name(function provide9() { return { $pcDatePicker: this, $parentInstance: this @@ -2246,7 +1863,7 @@ var script$12 = { timePickerTimer: null, preventFocus: false, typeUpdate: false, - data: /* @__PURE__ */ __name(function data3() { + data: /* @__PURE__ */ __name(function data2() { return { d_id: this.id, currentMonth: null, @@ -2326,7 +1943,7 @@ var script$12 = { this.input.value = this.inputFieldValue; } }, "mounted"), - updated: /* @__PURE__ */ __name(function updated3() { + updated: /* @__PURE__ */ __name(function updated2() { if (this.overlay) { this.preventFocus = true; setTimeout(this.updateFocus, 0); @@ -2338,7 +1955,7 @@ var script$12 = { this.selectionEnd = null; } }, "updated"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount2() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount() { if (this.timePickerTimer) { clearTimeout(this.timePickerTimer); } @@ -2674,7 +2291,7 @@ var script$12 = { this.currentMinute = Math.floor(date.getMinutes() / this.stepMinute) * this.stepMinute; this.currentSecond = Math.floor(date.getSeconds() / this.stepSecond) * this.stepSecond; }, "updateCurrentTimeMeta"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener2() { + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener() { var _this3 = this; if (!this.outsideClickListener) { this.outsideClickListener = function(event2) { @@ -2685,7 +2302,7 @@ var script$12 = { document.addEventListener("mousedown", this.outsideClickListener); } }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener2() { + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener() { if (this.outsideClickListener) { document.removeEventListener("mousedown", this.outsideClickListener); this.outsideClickListener = null; @@ -2743,7 +2360,7 @@ var script$12 = { this.matchMediaListener = null; } }, "unbindMatchMediaListener"), - isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked2(event2) { + isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked(event2) { return !(this.$el.isSameNode(event2.target) || this.isNavIconClicked(event2) || this.$el.contains(event2.target) || this.overlay && this.overlay.contains(event2.target)); }, "isOutsideClicked"), isNavIconClicked: /* @__PURE__ */ __name(function isNavIconClicked(event2) { @@ -4405,14 +4022,14 @@ var script$12 = { }, "panelId") }, components: { - InputText: script$1o, - Button: script$1e, - Portal: script$1f, + InputText: script$1l, + Button: script$1d, + Portal: script$1m, CalendarIcon: script$13, - ChevronLeftIcon: script$1p, - ChevronRightIcon: script$1l, - ChevronUpIcon: script$1j, - ChevronDownIcon: script$1k + ChevronLeftIcon: script$1n, + ChevronRightIcon: script$1i, + ChevronUpIcon: script$1g, + ChevronDownIcon: script$1h }, directives: { ripple: Ripple @@ -4425,7 +4042,7 @@ var _hoisted_4$9 = ["disabled", "aria-label"]; var _hoisted_5$4 = ["disabled", "aria-label"]; var _hoisted_6$2 = ["disabled", "aria-label"]; var _hoisted_7$2 = ["disabled", "aria-label"]; -var _hoisted_8$1 = ["data-p-disabled"]; +var _hoisted_8$2 = ["data-p-disabled"]; var _hoisted_9 = ["abbr"]; var _hoisted_10 = ["data-p-disabled"]; var _hoisted_11 = ["aria-label", "data-p-today", "data-p-other-month"]; @@ -4704,7 +4321,7 @@ function render$V(_ctx, _cache, $props, $setup, $data, $options) { }), { "data-pc-group-section": "tableheadercelllabel" }), toDisplayString($options.weekHeaderLabel), 17)]; - })], 16, _hoisted_8$1)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList($options.weekDays, function(weekDay) { + })], 16, _hoisted_8$2)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList($options.weekDays, function(weekDay) { return openBlock(), createElementBlock("th", mergeProps({ key: weekDay, scope: "col", @@ -4780,7 +4397,7 @@ function render$V(_ctx, _cache, $props, $setup, $data, $options) { return $options.onDateSelect($event, date); }, "onClick"), draggable: "false", - onKeydown: /* @__PURE__ */ __name(function onKeydown6($event) { + onKeydown: /* @__PURE__ */ __name(function onKeydown5($event) { return $options.onDateCellKeydown($event, date, groupIndex); }, "onKeydown"), "aria-selected": $options.isSelected(date), @@ -4824,7 +4441,7 @@ function render$V(_ctx, _cache, $props, $setup, $data, $options) { index: i }); }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown6($event) { + onKeydown: /* @__PURE__ */ __name(function onKeydown5($event) { return $options.onMonthCellKeydown($event, { month: m, index: i @@ -4862,7 +4479,7 @@ function render$V(_ctx, _cache, $props, $setup, $data, $options) { onClick: /* @__PURE__ */ __name(function onClick11($event) { return $options.onYearSelect($event, y); }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown6($event) { + onKeydown: /* @__PURE__ */ __name(function onKeydown5($event) { return $options.onYearCellKeydown($event, y); }, "onKeydown"), "class": _ctx.cx("year", { @@ -5250,12 +4867,12 @@ var script$11 = { var CalendarStyle = BaseStyle.extend({ name: "calendar" }); -var theme$y = /* @__PURE__ */ __name(function theme6(_ref) { +var theme$y = /* @__PURE__ */ __name(function theme5(_ref) { var dt = _ref.dt; return "\n.p-cascadeselect {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n background: ".concat(dt("cascadeselect.background"), ";\n border: 1px solid ").concat(dt("cascadeselect.border.color"), ";\n transition: background ").concat(dt("cascadeselect.transition.duration"), ", color ").concat(dt("cascadeselect.transition.duration"), ", border-color ").concat(dt("cascadeselect.transition.duration"), ", outline-color ").concat(dt("cascadeselect.transition.duration"), ", box-shadow ").concat(dt("cascadeselect.transition.duration"), ";\n border-radius: ").concat(dt("cascadeselect.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("cascadeselect.shadow"), ";\n}\n\n.p-cascadeselect:not(.p-disabled):hover {\n border-color: ").concat(dt("cascadeselect.hover.border.color"), ";\n}\n\n.p-cascadeselect:not(.p-disabled).p-focus {\n border-color: ").concat(dt("cascadeselect.focus.border.color"), ";\n box-shadow: ").concat(dt("cascadeselect.focus.ring.shadow"), ";\n outline: ").concat(dt("cascadeselect.focus.ring.width"), " ").concat(dt("cascadeselect.focus.ring.style"), " ").concat(dt("cascadeselect.focus.ring.color"), ";\n outline-offset: ").concat(dt("cascadeselect.focus.ring.offset"), ";\n}\n\n.p-cascadeselect.p-variant-filled {\n background: ").concat(dt("cascadeselect.filled.background"), ";\n}\n\n.p-cascadeselect.p-variant-filled:not(.p-disabled):hover {\n background: ").concat(dt("cascadeselect.filled.hover.background"), ";\n}\n\n.p-cascadeselect.p-variant-filled.p-focus {\n background: ").concat(dt("cascadeselect.filled.focus.background"), ";\n}\n\n.p-cascadeselect.p-invalid {\n border-color: ").concat(dt("cascadeselect.invalid.border.color"), ";\n}\n\n.p-cascadeselect.p-disabled {\n opacity: 1;\n background: ").concat(dt("cascadeselect.disabled.background"), ";\n}\n\n.p-cascadeselect-dropdown {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n background: transparent;\n color: ").concat(dt("cascadeselect.dropdown.color"), ";\n width: ").concat(dt("cascadeselect.dropdown.width"), ";\n border-start-end-radius: ").concat(dt("border.radius.md"), ";\n border-end-end-radius: ").concat(dt("border.radius.md"), ";\n}\n\n.p-cascadeselect-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n color: ").concat(dt("cascadeselect.clear.icon.color"), ";\n inset-inline-end: ").concat(dt("cascadeselect.dropdown.width"), ";\n}\n\n.p-cascadeselect-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n padding: ").concat(dt("cascadeselect.padding.y"), " ").concat(dt("cascadeselect.padding.x"), ";\n background: transparent;\n border: 0 none;\n outline: 0 none;\n}\n\n.p-cascadeselect-label.p-placeholder {\n color: ").concat(dt("cascadeselect.placeholder.color"), ";\n}\n\n.p-cascadeselect.p-invalid .p-cascadeselect-label.p-placeholder {\n color: ").concat(dt("cascadeselect.invalid.placeholder.color"), ";\n}\n\n.p-cascadeselect.p-disabled .p-cascadeselect-label {\n color: ").concat(dt("cascadeselect.disabled.color"), ";\n}\n\n.p-cascadeselect-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\n\n.p-cascadeselect-fluid {\n display: flex;\n}\n\n.p-cascadeselect-fluid .p-cascadeselect-label {\n width: 1%;\n}\n\n.p-cascadeselect-overlay {\n background: ").concat(dt("cascadeselect.overlay.background"), ";\n color: ").concat(dt("cascadeselect.overlay.color"), ";\n border: 1px solid ").concat(dt("cascadeselect.overlay.border.color"), ";\n border-radius: ").concat(dt("cascadeselect.overlay.border.radius"), ";\n box-shadow: ").concat(dt("cascadeselect.overlay.shadow"), ";\n}\n\n.p-cascadeselect .p-cascadeselect-overlay {\n min-width: 100%;\n}\n\n.p-cascadeselect-option-list {\n display: none;\n min-width: 100%;\n position: absolute;\n z-index: 1;\n}\n\n.p-cascadeselect-list {\n min-width: 100%;\n margin: 0;\n padding: 0;\n list-style-type: none;\n padding: ").concat(dt("cascadeselect.list.padding"), ";\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("cascadeselect.list.gap"), ";\n}\n\n.p-cascadeselect-option {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n border: 0 none;\n color: ").concat(dt("cascadeselect.option.color"), ";\n background: transparent;\n border-radius: ").concat(dt("cascadeselect.option.border.radius"), ";\n}\n\n.p-cascadeselect-option-active {\n overflow: visible;\n}\n\n.p-cascadeselect-option-active > .p-cascadeselect-option-content {\n background: ").concat(dt("cascadeselect.option.focus.background"), ";\n color: ").concat(dt("cascadeselect.option.focus.color"), ";\n}\n\n.p-cascadeselect-option:not(.p-cascadeselect-option-selected):not(.p-disabled).p-focus > .p-cascadeselect-option-content {\n background: ").concat(dt("cascadeselect.option.focus.background"), ";\n color: ").concat(dt("cascadeselect.option.focus.color"), ";\n}\n\n.p-cascadeselect-option:not(.p-cascadeselect-option-selected):not(.p-disabled).p-focus > .p-cascadeselect-option-content > .p-cascadeselect-group-icon-container > .p-cascadeselect-group-icon {\n color: ").concat(dt("cascadeselect.option.icon.focus.color"), ";\n}\n\n.p-cascadeselect-option-selected > .p-cascadeselect-option-content {\n background: ").concat(dt("cascadeselect.option.selected.background"), ";\n color: ").concat(dt("cascadeselect.option.selected.color"), ";\n}\n\n.p-cascadeselect-option-selected.p-focus > .p-cascadeselect-option-content {\n background: ").concat(dt("cascadeselect.option.selected.focus.background"), ";\n color: ").concat(dt("cascadeselect.option.selected.focus.color"), ";\n}\n\n.p-cascadeselect-option-active > .p-cascadeselect-option-list {\n inset-inline-start: 100%;\n inset-block-start: 0;\n}\n\n.p-cascadeselect-option-content {\n display: flex;\n align-items: center;\n justify-content: space-between;\n overflow: hidden;\n position: relative;\n padding: ").concat(dt("cascadeselect.option.padding"), ";\n border-radius: ").concat(dt("cascadeselect.option.border.radius"), ";\n transition: background ").concat(dt("cascadeselect.transition.duration"), ", color ").concat(dt("cascadeselect.transition.duration"), ", border-color ").concat(dt("cascadeselect.transition.duration"), ", box-shadow ").concat(dt("cascadeselect.transition.duration"), ", outline-color ").concat(dt("cascadeselect.transition.duration"), ";\n}\n\n.p-cascadeselect-group-icon {\n font-size: ").concat(dt("cascadeselect.option.icon.size"), ";\n width: ").concat(dt("cascadeselect.option.icon.size"), ";\n height: ").concat(dt("cascadeselect.option.icon.size"), ";\n color: ").concat(dt("cascadeselect.option.icon.color"), ";\n}\n\n.p-cascadeselect-group-icon:dir(rtl) {\n transform: rotate(180deg);\n}\n\n.p-cascadeselect-mobile-active .p-cascadeselect-option-list {\n position: static;\n box-shadow: none;\n border: 0 none;\n padding-inline-start: ").concat(dt("tieredmenu.submenu.mobile.indent"), ";\n padding-inline-end: 0;\n}\n\n.p-cascadeselect-mobile-active .p-cascadeselect-group-icon {\n transition: transform 0.2s;\n transform: rotate(90deg);\n}\n\n.p-cascadeselect-mobile-active .p-cascadeselect-option-active > .p-cascadeselect-option-content .p-cascadeselect-group-icon {\n transform: rotate(-90deg);\n}\n\n.p-cascadeselect-sm .p-cascadeselect-label {\n font-size: ").concat(dt("cascadeselect.sm.font.size"), ";\n padding-block: ").concat(dt("cascadeselect.sm.padding.y"), ";\n padding-inline: ").concat(dt("cascadeselect.sm.padding.x"), ";\n}\n\n.p-cascadeselect-sm .p-cascadeselect-dropdown .p-icon {\n font-size: ").concat(dt("cascadeselect.sm.font.size"), ";\n width: ").concat(dt("cascadeselect.sm.font.size"), ";\n height: ").concat(dt("cascadeselect.sm.font.size"), ";\n}\n\n.p-cascadeselect-lg .p-cascadeselect-label {\n font-size: ").concat(dt("cascadeselect.lg.font.size"), ";\n padding-block: ").concat(dt("cascadeselect.lg.padding.y"), ";\n padding-inline: ").concat(dt("cascadeselect.lg.padding.x"), ";\n}\n\n.p-cascadeselect-lg .p-cascadeselect-dropdown .p-icon {\n font-size: ").concat(dt("cascadeselect.lg.font.size"), ";\n width: ").concat(dt("cascadeselect.lg.font.size"), ";\n height: ").concat(dt("cascadeselect.lg.font.size"), ";\n}\n"); }, "theme"); var inlineStyles$7 = { - root: /* @__PURE__ */ __name(function root6(_ref2) { + root: /* @__PURE__ */ __name(function root5(_ref2) { var props = _ref2.props; return { position: props.appendTo === "self" ? "relative" : void 0 @@ -5263,7 +4880,7 @@ var inlineStyles$7 = { }, "root") }; var classes$C = { - root: /* @__PURE__ */ __name(function root7(_ref3) { + root: /* @__PURE__ */ __name(function root6(_ref3) { var instance = _ref3.instance, props = _ref3.props; return ["p-cascadeselect p-component p-inputwrapper", { "p-cascadeselect-mobile": instance.queryMatches, @@ -5321,7 +4938,7 @@ var CascadeSelectStyle = BaseStyle.extend({ }); var script$2$8 = { name: "BaseCascadeSelect", - "extends": script$1n, + "extends": script$1k, props: { options: Array, optionLabel: null, @@ -5453,7 +5070,7 @@ var script$2$8 = { } }, style: CascadeSelectStyle, - provide: /* @__PURE__ */ __name(function provide11() { + provide: /* @__PURE__ */ __name(function provide10() { return { $pcCascadeSelect: this, $parentInstance: this @@ -5463,7 +5080,7 @@ var script$2$8 = { var script$1$E = { name: "CascadeSelectSub", hostName: "CascadeSelect", - "extends": script$1d, + "extends": script$1f, emits: ["option-change", "option-focus-change", "option-focus-enter-change"], container: null, props: { @@ -5552,7 +5169,7 @@ var script$1$E = { processedOption }); }, "onOptionMouseMove"), - containerRef: /* @__PURE__ */ __name(function containerRef2(el) { + containerRef: /* @__PURE__ */ __name(function containerRef(el) { this.container = el; }, "containerRef"), listAriaLabel: /* @__PURE__ */ __name(function listAriaLabel() { @@ -5563,7 +5180,7 @@ var script$1$E = { ripple: Ripple }, components: { - AngleRightIcon: script$1q + AngleRightIcon: script$1o } }; var _hoisted_1$1$6 = ["id", "aria-label", "aria-selected", "aria-expanded", "aria-level", "aria-setsize", "aria-posinset", "data-p-option-group", "data-p-active", "data-p-focus", "data-p-disabled"]; @@ -5728,7 +5345,7 @@ var script$10 = { overlay: null, searchTimeout: null, searchValue: null, - data: /* @__PURE__ */ __name(function data4() { + data: /* @__PURE__ */ __name(function data3() { return { id: this.$attrs.id, clicked: false, @@ -5759,7 +5376,7 @@ var script$10 = { this.autoUpdateModel(); this.bindMatchMediaListener(); }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount3() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount2() { this.unbindOutsideClickListener(); this.unbindResizeListener(); this.unbindMatchMediaListener(); @@ -5822,7 +5439,7 @@ var script$10 = { } isFocus && focus(this.$refs.focusInput); }, "show"), - hide: /* @__PURE__ */ __name(function hide2(isFocus) { + hide: /* @__PURE__ */ __name(function hide(isFocus) { var _this = this; var _hide = /* @__PURE__ */ __name(function _hide2() { _this.$emit("before-hide"); @@ -6068,13 +5685,13 @@ var script$10 = { return p.key === (processedOption === null || processedOption === void 0 ? void 0 : processedOption.parentKey); }); var matched = this.focusedOptionInfo.parentKey === "" || parentOption && parentOption.key === this.focusedOptionInfo.parentKey; - var root35 = isEmpty(processedOption === null || processedOption === void 0 ? void 0 : processedOption.parent); + var root34 = isEmpty(processedOption === null || processedOption === void 0 ? void 0 : processedOption.parent); if (matched) { this.activeOptionPath = this.activeOptionPath.filter(function(p) { return p.parentKey !== _this2.focusedOptionInfo.parentKey; }); } - if (!root35) { + if (!root34) { this.focusedOptionInfo = { index: -1, parentKey: parentOption ? parentOption.parentKey : "" @@ -6191,7 +5808,7 @@ var script$10 = { absolutePosition(this.overlay, this.$el); } }, "alignOverlay"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener3() { + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener2() { var _this3 = this; if (!this.outsideClickListener) { this.outsideClickListener = function(event2) { @@ -6202,7 +5819,7 @@ var script$10 = { 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; @@ -6507,11 +6124,11 @@ var script$10 = { }, components: { CascadeSelectSub: script$1$E, - Portal: script$1f, - ChevronDownIcon: script$1k, - SpinnerIcon: script$1r, - AngleRightIcon: script$1q, - TimesIcon: script$1g + Portal: script$1m, + ChevronDownIcon: script$1h, + SpinnerIcon: script$1p, + AngleRightIcon: script$1o, + TimesIcon: script$1q } }; function _typeof$k(o) { @@ -6729,7 +6346,7 @@ function render$U(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$U, "render$U"); script$10.render = render$U; -var theme$x = /* @__PURE__ */ __name(function theme7(_ref) { +var theme$x = /* @__PURE__ */ __name(function theme6(_ref) { _ref.dt; return "\n.p-checkbox-group {\n display: inline-flex;\n}\n"; }, "theme"); @@ -6743,9 +6360,9 @@ var CheckboxGroupStyle = BaseStyle.extend({ }); var script$1$D = { name: "BaseCheckboxGroup", - "extends": script$1s, + "extends": script$1r, style: CheckboxGroupStyle, - provide: /* @__PURE__ */ __name(function provide12() { + provide: /* @__PURE__ */ __name(function provide11() { return { $pcCheckboxGroup: this, $parentInstance: this @@ -6756,7 +6373,7 @@ var script$$ = { name: "CheckboxGroup", "extends": script$1$D, inheritAttrs: false, - data: /* @__PURE__ */ __name(function data5() { + data: /* @__PURE__ */ __name(function data4() { return { groupName: this.name }; @@ -6777,12 +6394,12 @@ function render$T(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$T, "render$T"); script$$.render = render$T; -var theme$w = /* @__PURE__ */ __name(function theme8(_ref) { +var theme$w = /* @__PURE__ */ __name(function theme7(_ref) { var dt = _ref.dt; return "\n.p-inputchips {\n display: inline-flex;\n}\n\n.p-inputchips-input {\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("inputchips.padding.y"), " / 2) ").concat(dt("inputchips.padding.x"), ";\n gap: calc(").concat(dt("inputchips.padding.y"), " / 2);\n color: ").concat(dt("inputchips.color"), ";\n background: ").concat(dt("inputchips.background"), ";\n border: 1px solid ").concat(dt("inputchips.border.color"), ";\n border-radius: ").concat(dt("inputchips.border.radius"), ";\n width: 100%;\n transition: background ").concat(dt("inputchips.transition.duration"), ", color ").concat(dt("inputchips.transition.duration"), ", border-color ").concat(dt("inputchips.transition.duration"), ", outline-color ").concat(dt("inputchips.transition.duration"), ", box-shadow ").concat(dt("inputchips.transition.duration"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("inputchips.shadow"), ";\n}\n\n.p-inputchips:not(.p-disabled):hover .p-inputchips-input {\n border-color: ").concat(dt("inputchips.hover.border.color"), ";\n}\n\n.p-inputchips:not(.p-disabled).p-focus .p-inputchips-input {\n border-color: ").concat(dt("inputchips.focus.border.color"), ";\n box-shadow: ").concat(dt("inputchips.focus.ring.shadow"), ";\n outline: ").concat(dt("inputchips.focus.ring.width"), " ").concat(dt("inputchips.focus.ring.style"), " ").concat(dt("inputchips.focus.ring.color"), ";\n outline-offset: ").concat(dt("inputchips.focus.ring.offset"), ";\n}\n\n.p-inputchips.p-invalid .p-inputchips-input {\n border-color: ").concat(dt("inputchips.invalid.border.color"), ";\n}\n\n.p-variant-filled.p-inputchips-input {\n background: ").concat(dt("inputchips.filled.background"), ";\n}\n\n.p-inputchips:not(.p-disabled).p-focus .p-variant-filled.p-inputchips-input {\n background: ").concat(dt("inputchips.filled.focus.background"), ";\n}\n\n.p-inputchips.p-disabled .p-inputchips-input {\n opacity: 1;\n background: ").concat(dt("inputchips.disabled.background"), ";\n color: ").concat(dt("inputchips.disabled.color"), ";\n}\n\n.p-inputchips-chip.p-chip {\n padding-top: calc(").concat(dt("inputchips.padding.y"), " / 2);\n padding-bottom: calc(").concat(dt("inputchips.padding.y"), " / 2);\n border-radius: ").concat(dt("inputchips.chip.border.radius"), ";\n transition: background ").concat(dt("inputchips.transition.duration"), ", color ").concat(dt("inputchips.transition.duration"), ";\n}\n\n.p-inputchips-chip-item.p-focus .p-inputchips-chip {\n background: ").concat(dt("inputchips.chip.focus.background"), ";\n color: ").concat(dt("inputchips.chip.focus.color"), ";\n}\n\n.p-inputchips-input:has(.p-inputchips-chip) {\n padding-left: calc(").concat(dt("inputchips.padding.y"), " / 2);\n padding-right: calc(").concat(dt("inputchips.padding.y"), " / 2);\n}\n\n.p-inputchips-input-item {\n flex: 1 1 auto;\n display: inline-flex;\n padding-top: calc(").concat(dt("inputchips.padding.y"), " / 2);\n padding-bottom: calc(").concat(dt("inputchips.padding.y"), " / 2);\n}\n\n.p-inputchips-input-item 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-inputchips-input-item input::placeholder {\n color: ").concat(dt("inputchips.placeholder.color"), ";\n}\n"); }, "theme"); var classes$A = { - root: /* @__PURE__ */ __name(function root8(_ref2) { + root: /* @__PURE__ */ __name(function root7(_ref2) { var instance = _ref2.instance, props = _ref2.props; return ["p-inputchips p-component p-inputwrapper", { "p-disabled": props.disabled, @@ -6815,7 +6432,7 @@ var InputChipsStyle = BaseStyle.extend({ }); var script$1$C = { name: "BaseInputChips", - "extends": script$1d, + "extends": script$1f, props: { modelValue: { type: Array, @@ -6887,7 +6504,7 @@ var script$1$C = { } }, style: InputChipsStyle, - provide: /* @__PURE__ */ __name(function provide13() { + provide: /* @__PURE__ */ __name(function provide12() { return { $pcInputChips: this, $parentInstance: this @@ -6929,7 +6546,7 @@ var script$_ = { "extends": script$1$C, inheritAttrs: false, emits: ["update:modelValue", "add", "remove", "focus", "blur"], - data: /* @__PURE__ */ __name(function data6() { + data: /* @__PURE__ */ __name(function data5() { return { id: this.$attrs.id, inputValue: null, @@ -7106,7 +6723,7 @@ var script$_ = { }, "focusedOptionId") }, components: { - Chip: script$1t + Chip: script$1s } }; function _typeof$j(o) { @@ -7281,7 +6898,7 @@ var ColumnGroupStyle = BaseStyle.extend({ }); var script$1$B = { name: "BaseColumnGroup", - "extends": script$1d, + "extends": script$1f, props: { type: { type: String, @@ -7289,7 +6906,7 @@ var script$1$B = { } }, style: ColumnGroupStyle, - provide: /* @__PURE__ */ __name(function provide14() { + provide: /* @__PURE__ */ __name(function provide13() { return { $pcColumnGroup: this, $parentInstance: this @@ -7313,12 +6930,12 @@ var script$Y = { return null; }, "render") }; -var theme$v = /* @__PURE__ */ __name(function theme9(_ref) { +var theme$v = /* @__PURE__ */ __name(function theme8(_ref) { var dt = _ref.dt; return "\n.p-dataview {\n border-color: ".concat(dt("dataview.border.color"), ";\n border-width: ").concat(dt("dataview.border.width"), ";\n border-style: solid;\n border-radius: ").concat(dt("dataview.border.radius"), ";\n padding: ").concat(dt("dataview.padding"), ";\n}\n\n.p-dataview-header {\n background: ").concat(dt("dataview.header.background"), ";\n color: ").concat(dt("dataview.header.color"), ";\n border-color: ").concat(dt("dataview.header.border.color"), ";\n border-width: ").concat(dt("dataview.header.border.width"), ";\n border-style: solid;\n padding: ").concat(dt("dataview.header.padding"), ";\n border-radius: ").concat(dt("dataview.header.border.radius"), ";\n}\n\n.p-dataview-content {\n background: ").concat(dt("dataview.content.background"), ";\n border-color: ").concat(dt("dataview.content.border.color"), ";\n border-width: ").concat(dt("dataview.content.border.width"), ";\n border-style: solid;\n color: ").concat(dt("dataview.content.color"), ";\n padding: ").concat(dt("dataview.content.padding"), ";\n border-radius: ").concat(dt("dataview.content.border.radius"), ";\n}\n\n.p-dataview-footer {\n background: ").concat(dt("dataview.footer.background"), ";\n color: ").concat(dt("dataview.footer.color"), ";\n border-color: ").concat(dt("dataview.footer.border.color"), ";\n border-width: ").concat(dt("dataview.footer.border.width"), ";\n border-style: solid;\n padding: ").concat(dt("dataview.footer.padding"), ";\n border-radius: ").concat(dt("dataview.footer.border.radius"), ";\n}\n\n.p-dataview-paginator-top {\n border-width: ").concat(dt("dataview.paginator.top.border.width"), ";\n border-color: ").concat(dt("dataview.paginator.top.border.color"), ";\n border-style: solid;\n}\n\n.p-dataview-paginator-bottom {\n border-width: ").concat(dt("dataview.paginator.bottom.border.width"), ";\n border-color: ").concat(dt("dataview.paginator.bottom.border.color"), ";\n border-style: solid;\n}\n"); }, "theme"); var classes$z = { - root: /* @__PURE__ */ __name(function root9(_ref2) { + root: /* @__PURE__ */ __name(function root8(_ref2) { var props = _ref2.props; return ["p-dataview p-component", { "p-dataview-list": props.layout === "list", @@ -7342,7 +6959,7 @@ var DataViewStyle = BaseStyle.extend({ }); var script$1$A = { name: "BaseDataView", - "extends": script$1d, + "extends": script$1f, props: { value: { type: Array, @@ -7410,7 +7027,7 @@ var script$1$A = { } }, style: DataViewStyle, - provide: /* @__PURE__ */ __name(function provide15() { + provide: /* @__PURE__ */ __name(function provide14() { return { $pcDataView: this, $parentInstance: this @@ -7452,7 +7069,7 @@ var script$X = { "extends": script$1$A, inheritAttrs: false, emits: ["update:first", "update:rows", "page"], - data: /* @__PURE__ */ __name(function data7() { + data: /* @__PURE__ */ __name(function data6() { return { d_first: this.first, d_rows: this.rows @@ -7523,15 +7140,15 @@ var script$X = { }, "paginatorBottom"), items: /* @__PURE__ */ __name(function items() { if (this.value && this.value.length) { - var data41 = this.value; - if (data41 && data41.length && this.sortField) { - data41 = this.sort(); + var data40 = this.value; + if (data40 && data40.length && this.sortField) { + data40 = this.sort(); } if (this.paginator) { var first3 = this.lazy ? 0 : this.d_first; - return data41.slice(first3, first3 + this.d_rows); + return data40.slice(first3, first3 + this.d_rows); } else { - return data41; + return data40; } } else { return null; @@ -7539,7 +7156,7 @@ var script$X = { }, "items") }, components: { - DVPaginator: script$1u + DVPaginator: script$1t } }; function render$R(_ctx, _cache, $props, $setup, $data, $options) { @@ -7678,11 +7295,11 @@ var DeferredContentStyle = BaseStyle.extend({ }); var script$W = { name: "DeferredContent", - "extends": script$1d, + "extends": script$1f, inheritAttrs: false, emits: ["load"], style: DeferredContentStyle, - data: /* @__PURE__ */ __name(function data8() { + data: /* @__PURE__ */ __name(function data7() { return { loaded: false }; @@ -7693,7 +7310,7 @@ var script$W = { else this.bindScrollListener(); } }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount4() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount3() { this.unbindScrollListener(); }, "beforeUnmount"), methods: { @@ -7764,12 +7381,12 @@ var DialogService = { app.provide(PrimeVueDialogSymbol, DialogService2); }, "install") }; -var theme$u = /* @__PURE__ */ __name(function theme10(_ref) { +var theme$u = /* @__PURE__ */ __name(function theme9(_ref) { var dt = _ref.dt; return "\n.p-dock {\n position: absolute;\n z-index: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\n.p-dock-list-container {\n display: flex;\n pointer-events: auto;\n background: ".concat(dt("dock.background"), ";\n border: 1px solid ").concat(dt("dock.border.color"), ";\n padding: ").concat(dt("dock.padding"), ";\n border-radius: ").concat(dt("dock.border.radius"), ";\n}\n\n.p-dock-list {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n align-items: center;\n justify-content: center;\n outline: 0 none;\n}\n\n.p-dock-item {\n transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n will-change: transform;\n padding: ").concat(dt("dock.item.padding"), ";\n border-radius: ").concat(dt("dock.item.border.radius"), ";\n}\n\n.p-dock-item.p-focus {\n box-shadow: ").concat(dt("dock.item.focus.ring.shadow"), ";\n outline: ").concat(dt("dock.item.focus.ring.width"), " ").concat(dt("dock.item.focus.ring.style"), " ").concat(dt("dock.item.focus.ring.color"), ";\n outline-offset: ").concat(dt("dock.item.focus.ring.offset"), ";\n}\n\n.p-dock-item-link {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: relative;\n overflow: hidden;\n cursor: default;\n width: ").concat(dt("dock.item.size"), ";\n height: ").concat(dt("dock.item.size"), ";\n}\n\n.p-dock-top {\n left: 0;\n top: 0;\n width: 100%;\n}\n\n.p-dock-bottom {\n left: 0;\n bottom: 0;\n width: 100%;\n}\n\n.p-dock-right {\n right: 0;\n top: 0;\n height: 100%;\n}\n\n.p-dock-right .p-dock-list {\n flex-direction: column;\n}\n\n.p-dock-left {\n left: 0;\n top: 0;\n height: 100%;\n}\n\n.p-dock-left .p-dock-list {\n flex-direction: column;\n}\n\n.p-dock-mobile.p-dock-top .p-dock-list-container,\n.p-dock-mobile.p-dock-bottom .p-dock-list-container {\n overflow-x: auto;\n width: 100%;\n}\n\n.p-dock-mobile.p-dock-top .p-dock-list-container .p-dock-list,\n.p-dock-mobile.p-dock-bottom .p-dock-list-container .p-dock-list {\n margin: 0 auto;\n}\n\n.p-dock-mobile.p-dock-left .p-dock-list-container,\n.p-dock-mobile.p-dock-right .p-dock-list-container {\n overflow-y: auto;\n height: 100%;\n}\n\n.p-dock-mobile.p-dock-left .p-dock-list-container .p-dock-list,\n.p-dock-mobile.p-dock-right .p-dock-list-container .p-dock-list {\n margin: auto 0;\n}\n\n.p-dock-mobile .p-dock-list .p-dock-item {\n transform: none;\n margin: 0;\n}\n"); }, "theme"); var classes$y = { - root: /* @__PURE__ */ __name(function root10(_ref2) { + root: /* @__PURE__ */ __name(function root9(_ref2) { var instance = _ref2.instance, props = _ref2.props; return ["p-dock p-component", "p-dock-".concat(props.position), { "p-dock-mobile": instance.queryMatches @@ -7795,7 +7412,7 @@ var DockStyle = BaseStyle.extend({ }); var script$2$7 = { name: "BaseDock", - "extends": script$1d, + "extends": script$1f, props: { position: { type: String, @@ -7827,7 +7444,7 @@ var script$2$7 = { } }, style: DockStyle, - provide: /* @__PURE__ */ __name(function provide16() { + provide: /* @__PURE__ */ __name(function provide15() { return { $pcDock: this, $parentInstance: this @@ -7867,7 +7484,7 @@ __name(_arrayLikeToArray$b, "_arrayLikeToArray$b"); var script$1$z = { name: "DockSub", hostName: "Dock", - "extends": script$1d, + "extends": script$1f, emits: ["focus", "blur"], props: { position: { @@ -7900,7 +7517,7 @@ var script$1$z = { "default": null } }, - data: /* @__PURE__ */ __name(function data9() { + data: /* @__PURE__ */ __name(function data8() { return { id: this.menuId, currentIndex: -3, @@ -8156,7 +7773,7 @@ var script$V = { "extends": script$2$7, inheritAttrs: false, matchMediaListener: null, - data: /* @__PURE__ */ __name(function data10() { + data: /* @__PURE__ */ __name(function data9() { return { query: null, queryMatches: false @@ -8165,7 +7782,7 @@ var script$V = { mounted: /* @__PURE__ */ __name(function mounted14() { this.bindMatchMediaListener(); }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount5() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount4() { this.unbindMatchMediaListener(); }, "beforeUnmount"), methods: { @@ -8220,7 +7837,7 @@ __name(render$P, "render$P"); script$V.render = render$P; var script$U = { name: "Dropdown", - "extends": script$1v, + "extends": script$1u, mounted: /* @__PURE__ */ __name(function mounted15() { console.warn("Deprecated since v4. Use Select component instead."); }, "mounted") @@ -8233,10 +7850,10 @@ var DynamicDialogStyle = BaseStyle.extend({ }); var script$1$y = { name: "BaseDynamicDialog", - "extends": script$1d, + "extends": script$1f, props: {}, style: DynamicDialogStyle, - provide: /* @__PURE__ */ __name(function provide17() { + provide: /* @__PURE__ */ __name(function provide16() { return { $pcDynamicDialog: this, $parentInstance: this @@ -8247,7 +7864,7 @@ var script$T = { name: "DynamicDialog", "extends": script$1$y, inheritAttrs: false, - data: /* @__PURE__ */ __name(function data11() { + data: /* @__PURE__ */ __name(function data10() { return { instanceMap: {} }; @@ -8280,7 +7897,7 @@ var script$T = { DynamicDialogEventBus.on("open", this.openListener); DynamicDialogEventBus.on("close", this.closeListener); }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount6() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount5() { DynamicDialogEventBus.off("open", this.openListener); DynamicDialogEventBus.off("close", this.closeListener); }, "beforeUnmount"), @@ -8300,7 +7917,7 @@ var script$T = { }, "getTemplateItems") }, components: { - DDialog: script$1w + DDialog: script$1v } }; function render$O(_ctx, _cache, $props, $setup, $data, $options) { @@ -8353,12 +7970,12 @@ function render$O(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$O, "render$O"); script$T.render = render$O; -var theme$t = /* @__PURE__ */ __name(function theme11(_ref) { +var theme$t = /* @__PURE__ */ __name(function theme10(_ref) { var dt = _ref.dt; return "\n.p-fieldset {\n background: ".concat(dt("fieldset.background"), ";\n border: 1px solid ").concat(dt("fieldset.border.color"), ";\n border-radius: ").concat(dt("fieldset.border.radius"), ";\n color: ").concat(dt("fieldset.color"), ";\n padding: ").concat(dt("fieldset.padding"), ";\n margin: 0;\n}\n\n.p-fieldset-legend {\n background: ").concat(dt("fieldset.legend.background"), ";\n border-radius: ").concat(dt("fieldset.legend.border.radius"), ";\n border-width: ").concat(dt("fieldset.legend.border.width"), ";\n border-style: solid;\n border-color: ").concat(dt("fieldset.legend.border.color"), ";\n padding: ").concat(dt("fieldset.legend.padding"), ";\n transition: background ").concat(dt("fieldset.transition.duration"), ", color ").concat(dt("fieldset.transition.duration"), ", outline-color ").concat(dt("fieldset.transition.duration"), ", box-shadow ").concat(dt("fieldset.transition.duration"), ";\n}\n\n.p-fieldset-toggleable > .p-fieldset-legend {\n padding: 0;\n}\n\n.p-fieldset-toggle-button {\n cursor: pointer;\n user-select: none;\n overflow: hidden;\n position: relative;\n text-decoration: none;\n display: flex;\n gap: ").concat(dt("fieldset.legend.gap"), ";\n align-items: center;\n justify-content: center;\n padding: ").concat(dt("fieldset.legend.padding"), ";\n background: transparent;\n border: 0 none;\n border-radius: ").concat(dt("fieldset.legend.border.radius"), ";\n transition: background ").concat(dt("fieldset.transition.duration"), ", color ").concat(dt("fieldset.transition.duration"), ", outline-color ").concat(dt("fieldset.transition.duration"), ", box-shadow ").concat(dt("fieldset.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-fieldset-legend-label {\n font-weight: ").concat(dt("fieldset.legend.font.weight"), ";\n}\n\n.p-fieldset-toggle-button:focus-visible {\n box-shadow: ").concat(dt("fieldset.legend.focus.ring.shadow"), ";\n outline: ").concat(dt("fieldset.legend.focus.ring.width"), " ").concat(dt("fieldset.legend.focus.ring.style"), " ").concat(dt("fieldset.legend.focus.ring.color"), ";\n outline-offset: ").concat(dt("fieldset.legend.focus.ring.offset"), ";\n}\n\n.p-fieldset-toggleable > .p-fieldset-legend:hover {\n color: ").concat(dt("fieldset.legend.hover.color"), ";\n background: ").concat(dt("fieldset.legend.hover.background"), ";\n}\n\n.p-fieldset-toggle-icon {\n color: ").concat(dt("fieldset.toggle.icon.color"), ";\n transition: color ").concat(dt("fieldset.transition.duration"), ";\n}\n\n.p-fieldset-toggleable > .p-fieldset-legend:hover .p-fieldset-toggle-icon {\n color: ").concat(dt("fieldset.toggle.icon.hover.color"), ";\n}\n\n.p-fieldset .p-fieldset-content {\n padding: ").concat(dt("fieldset.content.padding"), ";\n}\n"); }, "theme"); var classes$x = { - root: /* @__PURE__ */ __name(function root11(_ref2) { + root: /* @__PURE__ */ __name(function root10(_ref2) { var props = _ref2.props; return ["p-fieldset p-component", { "p-fieldset-toggleable": props.toggleable @@ -8378,7 +7995,7 @@ var FieldsetStyle = BaseStyle.extend({ }); var script$1$x = { name: "BaseFieldset", - "extends": script$1d, + "extends": script$1f, props: { legend: String, toggleable: Boolean, @@ -8389,7 +8006,7 @@ var script$1$x = { } }, style: FieldsetStyle, - provide: /* @__PURE__ */ __name(function provide18() { + provide: /* @__PURE__ */ __name(function provide17() { return { $pcFieldset: this, $parentInstance: this @@ -8401,7 +8018,7 @@ var script$S = { "extends": script$1$x, inheritAttrs: false, emits: ["update:collapsed", "toggle"], - data: /* @__PURE__ */ __name(function data12() { + data: /* @__PURE__ */ __name(function data11() { return { id: this.$attrs.id, d_collapsed: this.collapsed @@ -8443,8 +8060,8 @@ var script$S = { ripple: Ripple }, components: { - PlusIcon: script$1x, - MinusIcon: script$1y + PlusIcon: script$1w, + MinusIcon: script$1x } }; function _typeof$i(o) { @@ -8559,7 +8176,7 @@ __name(render$N, "render$N"); script$S.render = render$N; var script$R = { name: "UploadIcon", - "extends": script$1m + "extends": script$1j }; function render$M(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ @@ -8577,12 +8194,12 @@ function render$M(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$M, "render$M"); script$R.render = render$M; -var theme$s = /* @__PURE__ */ __name(function theme12(_ref) { +var theme$s = /* @__PURE__ */ __name(function theme11(_ref) { var dt = _ref.dt; return '\n.p-fileupload input[type="file"] {\n display: none;\n}\n\n.p-fileupload-advanced {\n border: 1px solid '.concat(dt("fileupload.border.color"), ";\n border-radius: ").concat(dt("fileupload.border.radius"), ";\n background: ").concat(dt("fileupload.background"), ";\n color: ").concat(dt("fileupload.color"), ";\n}\n\n.p-fileupload-header {\n display: flex;\n align-items: center;\n padding: ").concat(dt("fileupload.header.padding"), ";\n background: ").concat(dt("fileupload.header.background"), ";\n color: ").concat(dt("fileupload.header.color"), ";\n border-style: solid;\n border-width: ").concat(dt("fileupload.header.border.width"), ";\n border-color: ").concat(dt("fileupload.header.border.color"), ";\n border-radius: ").concat(dt("fileupload.header.border.radius"), ";\n gap: ").concat(dt("fileupload.header.gap"), ";\n}\n\n.p-fileupload-content {\n border: 1px solid transparent;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("fileupload.content.gap"), ";\n transition: border-color ").concat(dt("fileupload.transition.duration"), ";\n padding: ").concat(dt("fileupload.content.padding"), ";\n}\n\n.p-fileupload-content .p-progressbar {\n width: 100%;\n height: ").concat(dt("fileupload.progressbar.height"), ";\n}\n\n.p-fileupload-file-list {\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("fileupload.filelist.gap"), ";\n}\n\n.p-fileupload-file {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n padding: ").concat(dt("fileupload.file.padding"), ";\n border-block-end: 1px solid ").concat(dt("fileupload.file.border.color"), ";\n gap: ").concat(dt("fileupload.file.gap"), ";\n}\n\n.p-fileupload-file:last-child {\n border-block-end: 0;\n}\n\n.p-fileupload-file-info {\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("fileupload.file.info.gap"), ";\n}\n\n.p-fileupload-file-thumbnail {\n flex-shrink: 0;\n}\n\n.p-fileupload-file-actions {\n margin-inline-start: auto;\n}\n\n.p-fileupload-highlight {\n border: 1px dashed ").concat(dt("fileupload.content.highlight.border.color"), ";\n}\n\n.p-fileupload-basic {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n gap: ").concat(dt("fileupload.basic.gap"), ";\n}\n"); }, "theme"); var classes$w = { - root: /* @__PURE__ */ __name(function root12(_ref2) { + root: /* @__PURE__ */ __name(function root11(_ref2) { var props = _ref2.props; return ["p-fileupload p-fileupload-".concat(props.mode, " p-component")]; }, "root"), @@ -8608,7 +8225,7 @@ var FileUploadStyle = BaseStyle.extend({ }); var script$2$6 = { name: "BaseFileUpload", - "extends": script$1d, + "extends": script$1f, props: { name: { type: String, @@ -8710,7 +8327,7 @@ var script$2$6 = { }, uploadButtonProps: { type: Object, - "default": /* @__PURE__ */ __name(function _default7() { + "default": /* @__PURE__ */ __name(function _default6() { return { severity: "secondary" }; @@ -8718,7 +8335,7 @@ var script$2$6 = { }, cancelButtonProps: { type: Object, - "default": /* @__PURE__ */ __name(function _default8() { + "default": /* @__PURE__ */ __name(function _default7() { return { severity: "secondary" }; @@ -8726,7 +8343,7 @@ var script$2$6 = { } }, style: FileUploadStyle, - provide: /* @__PURE__ */ __name(function provide19() { + provide: /* @__PURE__ */ __name(function provide18() { return { $pcFileUpload: this, $parentInstance: this @@ -8736,12 +8353,12 @@ var script$2$6 = { var script$1$w = { name: "FileContent", hostName: "FileUpload", - "extends": script$1d, + "extends": script$1f, emits: ["remove"], props: { files: { type: Array, - "default": /* @__PURE__ */ __name(function _default9() { + "default": /* @__PURE__ */ __name(function _default8() { return []; }, "_default") }, @@ -8777,9 +8394,9 @@ var script$1$w = { }, "formatSize") }, components: { - Button: script$1e, - Badge: script$1z, - TimesIcon: script$1g + Button: script$1d, + Badge: script$1y, + TimesIcon: script$1q } }; var _hoisted_1$1$5 = ["alt", "src", "width"]; @@ -8915,7 +8532,7 @@ var script$Q = { inheritAttrs: false, emits: ["select", "uploader", "before-upload", "progress", "upload", "error", "before-send", "clear", "remove", "remove-uploaded-file"], duplicateIEEvent: false, - data: /* @__PURE__ */ __name(function data13() { + data: /* @__PURE__ */ __name(function data12() { return { uploadedFileCount: 0, files: [], @@ -9262,13 +8879,13 @@ var script$Q = { }, "pendingLabel") }, components: { - Button: script$1e, - ProgressBar: script$1A, - Message: script$1B, + Button: script$1d, + ProgressBar: script$1z, + Message: script$1A, FileContent: script$1$w, - PlusIcon: script$1x, + PlusIcon: script$1w, UploadIcon: script$R, - TimesIcon: script$1g + TimesIcon: script$1q }, directives: { ripple: Ripple @@ -9512,9 +9129,9 @@ var FluidStyle = BaseStyle.extend({ }); var script$1$v = { name: "BaseFluid", - "extends": script$1d, + "extends": script$1f, style: FluidStyle, - provide: /* @__PURE__ */ __name(function provide20() { + provide: /* @__PURE__ */ __name(function provide19() { return { $pcFluid: this, $parentInstance: this @@ -9533,7 +9150,7 @@ function render$K(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$K, "render$K"); script$P.render = render$K; -var theme$r = /* @__PURE__ */ __name(function theme13(_ref) { +var theme$r = /* @__PURE__ */ __name(function theme12(_ref) { var dt = _ref.dt; return "\n.p-iftalabel {\n display: block;\n position: relative;\n}\n\n.p-iftalabel label {\n position: absolute;\n pointer-events: none;\n top: ".concat(dt("iftalabel.top"), ";\n transition-property: all;\n transition-timing-function: ease;\n line-height: 1;\n font-size: ").concat(dt("iftalabel.font.size"), ";\n font-weight: ").concat(dt("iftalabel.font.weight"), ";\n inset-inline-start: ").concat(dt("iftalabel.position.x"), ";\n color: ").concat(dt("iftalabel.color"), ";\n transition-duration: ").concat(dt("iftalabel.transition.duration"), ";\n}\n\n.p-iftalabel .p-inputtext,\n.p-iftalabel .p-textarea,\n.p-iftalabel .p-select-label,\n.p-iftalabel .p-multiselect-label,\n.p-iftalabel .p-autocomplete-input-multiple,\n.p-iftalabel .p-cascadeselect-label,\n.p-iftalabel .p-treeselect-label {\n padding-block-start: ").concat(dt("iftalabel.input.padding.top"), ";\n padding-block-end: ").concat(dt("iftalabel.input.padding.bottom"), ";\n}\n\n.p-iftalabel:has(.p-invalid) label {\n color: ").concat(dt("iftalabel.invalid.color"), ";\n}\n\n.p-iftalabel:has(input:focus) label,\n.p-iftalabel:has(input:-webkit-autofill) label,\n.p-iftalabel:has(textarea:focus) label,\n.p-iftalabel:has(.p-inputwrapper-focus) label {\n color: ").concat(dt("iftalabel.focus.color"), ";\n}\n\n.p-iftalabel .p-inputicon {\n top: ").concat(dt("iftalabel.input.padding.top"), ";\n transform: translateY(25%);\n margin-top: 0;\n}\n"); }, "theme"); @@ -9547,9 +9164,9 @@ var IftaLabelStyle = BaseStyle.extend({ }); var script$1$u = { name: "BaseIftaLabel", - "extends": script$1d, + "extends": script$1f, style: IftaLabelStyle, - provide: /* @__PURE__ */ __name(function provide21() { + provide: /* @__PURE__ */ __name(function provide20() { return { $pcIftaLabel: this, $parentInstance: this @@ -9570,7 +9187,7 @@ __name(render$J, "render$J"); script$O.render = render$J; var script$N = { name: "EyeIcon", - "extends": script$1m + "extends": script$1j }; function render$I(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ @@ -9590,7 +9207,7 @@ __name(render$I, "render$I"); script$N.render = render$I; var script$M = { name: "RefreshIcon", - "extends": script$1m + "extends": script$1j }; function render$H(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ @@ -9610,7 +9227,7 @@ __name(render$H, "render$H"); script$M.render = render$H; var script$L = { name: "SearchMinusIcon", - "extends": script$1m + "extends": script$1j }; function render$G(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ @@ -9630,7 +9247,7 @@ __name(render$G, "render$G"); script$L.render = render$G; var script$K = { name: "SearchPlusIcon", - "extends": script$1m + "extends": script$1j }; function render$F(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ @@ -9650,7 +9267,7 @@ __name(render$F, "render$F"); script$K.render = render$F; var script$J = { name: "UndoIcon", - "extends": script$1m + "extends": script$1j }; function render$E(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ @@ -9668,12 +9285,12 @@ function render$E(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$E, "render$E"); script$J.render = render$E; -var theme$q = /* @__PURE__ */ __name(function theme14(_ref) { +var theme$q = /* @__PURE__ */ __name(function theme13(_ref) { var dt = _ref.dt; return "\n.p-image-mask {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-image-preview {\n position: relative;\n display: inline-flex;\n line-height: 0;\n}\n\n.p-image-preview-mask {\n position: absolute;\n inset-inline-start: 0;\n inset-block-start: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0;\n transition: opacity 0.3s;\n border: 0 none;\n padding: 0;\n cursor: pointer;\n background: transparent;\n color: ".concat(dt("image.preview.mask.color"), ";\n transition: background ").concat(dt("image.transition.duration"), ";\n}\n\n.p-image-preview:hover > .p-image-preview-mask {\n opacity: 1;\n cursor: pointer;\n background: ").concat(dt("image.preview.mask.background"), ";\n}\n\n.p-image-preview-icon {\n font-size: ").concat(dt("image.preview.icon.size"), ";\n width: ").concat(dt("image.preview.icon.size"), ";\n height: ").concat(dt("image.preview.icon.size"), ";\n}\n\n.p-image-toolbar {\n position: absolute;\n inset-block-start: ").concat(dt("image.toolbar.position.top"), ";\n inset-inline-end: ").concat(dt("image.toolbar.position.right"), ";\n inset-inline-start: ").concat(dt("image.toolbar.position.left"), ";\n inset-block-end: ").concat(dt("image.toolbar.position.bottom"), ";\n display: flex;\n z-index: 1;\n padding: ").concat(dt("image.toolbar.padding"), ";\n background: ").concat(dt("image.toolbar.background"), ";\n backdrop-filter: blur(").concat(dt("image.toolbar.blur"), ");\n border-color: ").concat(dt("image.toolbar.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("image.toolbar.border.width"), ";\n border-radius: ").concat(dt("image.toolbar.border.radius"), ";\n gap: ").concat(dt("image.toolbar.gap"), ";\n}\n\n.p-image-action {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n color: ").concat(dt("image.action.color"), ";\n background: transparent;\n width: ").concat(dt("image.action.size"), ";\n height: ").concat(dt("image.action.size"), ";\n margin: 0;\n padding: 0;\n border: 0 none;\n cursor: pointer;\n user-select: none;\n border-radius: ").concat(dt("image.action.border.radius"), ";\n outline-color: transparent;\n transition: background ").concat(dt("image.transition.duration"), ", color ").concat(dt("image.transition.duration"), ", outline-color ").concat(dt("image.transition.duration"), ", box-shadow ").concat(dt("image.transition.duration"), ";\n}\n\n.p-image-action:hover {\n color: ").concat(dt("image.action.hover.color"), ";\n background: ").concat(dt("image.action.hover.background"), ";\n}\n\n.p-image-action:focus-visible {\n box-shadow: ").concat(dt("image.action.focus.ring.shadow"), ";\n outline: ").concat(dt("image.action.focus.ring.width"), " ").concat(dt("image.action.focus.ring.style"), " ").concat(dt("image.action.focus.ring.color"), ";\n outline-offset: ").concat(dt("image.action.focus.ring.offset"), ";\n}\n\n.p-image-action .p-icon {\n font-size: ").concat(dt("image.action.icon.size"), ";\n width: ").concat(dt("image.action.icon.size"), ";\n height: ").concat(dt("image.action.icon.size"), ";\n}\n\n.p-image-action.p-disabled {\n pointer-events: auto;\n}\n\n.p-image-original {\n transition: transform 0.15s;\n max-width: 100vw;\n max-height: 100vh;\n}\n\n.p-image-original-enter-active {\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n}\n\n.p-image-original-leave-active {\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n.p-image-original-enter-from,\n.p-image-original-leave-to {\n opacity: 0;\n transform: scale(0.7);\n}\n"); }, "theme"); var classes$t = { - root: /* @__PURE__ */ __name(function root13(_ref2) { + root: /* @__PURE__ */ __name(function root12(_ref2) { var props = _ref2.props; return ["p-image p-component", { "p-image-preview": props.preview @@ -9707,7 +9324,7 @@ var ImageStyle = BaseStyle.extend({ }); var script$1$t = { name: "BaseImage", - "extends": script$1d, + "extends": script$1f, props: { preview: { type: Boolean, @@ -9751,7 +9368,7 @@ var script$1$t = { } }, style: ImageStyle, - provide: /* @__PURE__ */ __name(function provide22() { + provide: /* @__PURE__ */ __name(function provide21() { return { $pcImage: this, $parentInstance: this @@ -9764,7 +9381,7 @@ var script$I = { inheritAttrs: false, emits: ["show", "hide", "error"], mask: null, - data: /* @__PURE__ */ __name(function data14() { + data: /* @__PURE__ */ __name(function data13() { return { maskVisible: false, previewVisible: false, @@ -9772,13 +9389,13 @@ var script$I = { scale: 1 }; }, "data"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount7() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount6() { if (this.mask) { ZIndex.clear(this.container); } }, "beforeUnmount"), methods: { - maskRef: /* @__PURE__ */ __name(function maskRef2(el) { + maskRef: /* @__PURE__ */ __name(function maskRef(el) { this.mask = el; }, "maskRef"), toolbarRef: /* @__PURE__ */ __name(function toolbarRef(el) { @@ -9797,7 +9414,7 @@ var script$I = { onPreviewImageClick: /* @__PURE__ */ __name(function onPreviewImageClick() { this.previewClick = true; }, "onPreviewImageClick"), - onMaskClick: /* @__PURE__ */ __name(function onMaskClick2(event2) { + onMaskClick: /* @__PURE__ */ __name(function onMaskClick(event2) { var isBarActionsClicked = isAttributeEquals(event2.target, "data-pc-section-group", "action") || event2.target.closest('[data-pc-section-group="action"]'); if (!this.previewClick && !isBarActionsClicked) { this.previewVisible = false; @@ -9840,18 +9457,18 @@ var script$I = { onBeforeEnter: /* @__PURE__ */ __name(function onBeforeEnter() { ZIndex.set("modal", this.mask, this.$primevue.config.zIndex.modal); }, "onBeforeEnter"), - onEnter: /* @__PURE__ */ __name(function onEnter2() { + onEnter: /* @__PURE__ */ __name(function onEnter() { this.focus(); this.$emit("show"); }, "onEnter"), - onBeforeLeave: /* @__PURE__ */ __name(function onBeforeLeave2() { + onBeforeLeave: /* @__PURE__ */ __name(function onBeforeLeave() { !this.isUnstyled && addClass(this.mask, "p-overlay-mask-leave"); }, "onBeforeLeave"), - onLeave: /* @__PURE__ */ __name(function onLeave2() { + onLeave: /* @__PURE__ */ __name(function onLeave() { unblockBodyScroll(); this.$emit("hide"); }, "onLeave"), - onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave2(el) { + onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave(el) { ZIndex.clear(el); this.maskVisible = false; }, "onAfterLeave"), @@ -9901,18 +9518,18 @@ var script$I = { zoomImageAriaLabel: /* @__PURE__ */ __name(function zoomImageAriaLabel() { return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.zoomImage : void 0; }, "zoomImageAriaLabel"), - closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel2() { + closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel() { return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : void 0; }, "closeAriaLabel") }, components: { - Portal: script$1f, + Portal: script$1m, EyeIcon: script$N, RefreshIcon: script$M, UndoIcon: script$J, SearchMinusIcon: script$L, SearchPlusIcon: script$K, - TimesIcon: script$1g + TimesIcon: script$1q }, directives: { focustrap: FocusTrap @@ -9977,7 +9594,7 @@ var _hoisted_4$8 = ["aria-label"]; var _hoisted_5$3 = ["disabled", "aria-label"]; var _hoisted_6$1 = ["disabled", "aria-label"]; var _hoisted_7$1 = ["aria-label"]; -var _hoisted_8 = ["src"]; +var _hoisted_8$1 = ["src"]; function render$D(_ctx, _cache, $props, $setup, $data, $options) { var _component_RefreshIcon = resolveComponent("RefreshIcon"); var _component_UndoIcon = resolveComponent("UndoIcon"); @@ -10109,7 +9726,7 @@ function render$D(_ctx, _cache, $props, $setup, $data, $options) { onClick: _cache[7] || (_cache[7] = function() { return $options.onPreviewImageClick && $options.onPreviewImageClick.apply($options, arguments); }) - }, _ctx.ptm("original")), null, 16, _hoisted_8)]; + }, _ctx.ptm("original")), null, 16, _hoisted_8$1)]; })], 16)) : createCommentVNode("", true)]; }), _: 3 @@ -10120,7 +9737,7 @@ function render$D(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$D, "render$D"); script$I.render = render$D; -var theme$p = /* @__PURE__ */ __name(function theme15(_ref) { +var theme$p = /* @__PURE__ */ __name(function theme14(_ref) { var dt = _ref.dt; return "\n.p-imagecompare {\n position: relative;\n overflow: hidden;\n width: 100%;\n aspect-ratio: 16 / 9;\n}\n\n.p-imagecompare img {\n width: 100%;\n height: 100%;\n position: absolute;\n}\n\n.p-imagecompare img + img {\n clip-path: polygon(0 0, ".concat(dt("imagecompare.scope.x", "50%"), " 0, ").concat(dt("imagecompare.scope.x", "50%"), " 100%, 0 100%);\n}\n\n.p-imagecompare:dir(rtl) img + img {\n clip-path: polygon(calc(100% - ").concat(dt("imagecompare.scope.x", "50%"), ") 0, 100% 0, 100% 100%, calc(100% - ").concat(dt("imagecompare.scope.x", "50%"), ") 100%);\n}\n\n.p-imagecompare-slider {\n position: relative;\n -webkit-appearance: none;\n width: calc(100% + ").concat(dt("imagecompare.handle.size"), ");\n height: 100%;\n margin-inline-start: calc(-1 * calc(").concat(dt("imagecompare.handle.size"), " / 2));\n background-color: transparent;\n outline: none;\n transition: all ").concat(dt("imagecompare.handle.transition.duration"), ";\n}\n\n.p-imagecompare-slider::-webkit-slider-thumb {\n -webkit-appearance: none;\n height: ").concat(dt("imagecompare.handle.size"), ";\n width: ").concat(dt("imagecompare.handle.size"), ";\n background: ").concat(dt("imagecompare.handle.background"), ";\n border: ").concat(dt("imagecompare.handle.border.width"), " solid ").concat(dt("imagecompare.handle.border.color"), ";\n border-radius: ").concat(dt("imagecompare.handle.border.radius"), ";\n background-size: contain;\n cursor: ew-resize;\n transition: all ").concat(dt("imagecompare.handle.transition.duration"), ";\n}\n\n.p-imagecompare-slider::-moz-range-thumb {\n height: ").concat(dt("imagecompare.handle.size"), ";\n width: ").concat(dt("imagecompare.handle.size"), ";\n background: ").concat(dt("imagecompare.handle.background"), ";\n border: ").concat(dt("imagecompare.handle.border.width"), " ").concat(dt("imagecompare.handle.border.style"), " ").concat(dt("imagecompare.handle.border.color"), ";\n border-radius: ").concat(dt("imagecompare.handle.border.radius"), ";\n background-size: contain;\n cursor: ew-resize;\n}\n\n.p-imagecompare-slider:focus-visible::-webkit-slider-thumb {\n box-shadow: ").concat(dt("imagecompare.handle.focus.ring.shadow"), ";\n outline: ").concat(dt("imagecompare.handle.focus.ring.width"), " ").concat(dt("imagecompare.handle.focus.ring.style"), " ").concat(dt("imagecompare.handle.focus.ring.color"), ";\n outline-offset: ").concat(dt("imagecompare.handle.focus.ring.offset"), ";\n}\n\n.p-imagecompare-slider:focus-visible::-moz-range-thumb {\n box-shadow: ").concat(dt("imagecompare.handle.focus.ring.shadow"), ";\n outline: ").concat(dt("imagecompare.handle.focus.ring.width"), " ").concat(dt("imagecompare.handle.focus.ring.style"), " ").concat(dt("imagecompare.handle.focus.ring.color"), ";\n outline-offset: ").concat(dt("imagecompare.handle.focus.ring.offset"), ";\n}\n\n.p-imagecompare-slider:hover {\n width: calc(100% + ").concat(dt("imagecompare.handle.hover.size"), ");\n margin-inline-start: calc(-1 * calc(").concat(dt("imagecompare.handle.hover.size"), " / 2));\n}\n\n.p-imagecompare-slider:hover::-webkit-slider-thumb {\n background: ").concat(dt("imagecompare.handle.hover.background"), ";\n border-color: ").concat(dt("imagecompare.handle.hover.border.color"), ";\n height: ").concat(dt("imagecompare.handle.hover.size"), ";\n width: ").concat(dt("imagecompare.handle.hover.size"), ";\n}\n\n.p-imagecompare-slider:hover::-moz-range-thumb {\n background: ").concat(dt("imagecompare.handle.hover.background"), ";\n border-color: ").concat(dt("imagecompare.handle.hover.border.color"), ";\n height: ").concat(dt("imagecompare.handle.hover.size"), ";\n width: ").concat(dt("imagecompare.handle.hover.size"), ";\n}\n"); }, "theme"); @@ -10135,7 +9752,7 @@ var ImageCompareStyle = BaseStyle.extend({ }); var script$1$s = { name: "BaseImageCompare", - "extends": script$1d, + "extends": script$1f, props: { tabindex: { type: Number, @@ -10151,7 +9768,7 @@ var script$1$s = { } }, style: ImageCompareStyle, - provide: /* @__PURE__ */ __name(function provide23() { + provide: /* @__PURE__ */ __name(function provide22() { return { $pcImageCompare: this, $parentInstance: this @@ -10188,12 +9805,12 @@ function render$C(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$C, "render$C"); script$H.render = render$C; -var theme$o = /* @__PURE__ */ __name(function theme16(_ref) { +var theme$o = /* @__PURE__ */ __name(function theme15(_ref) { var dt = _ref.dt; return "\n.p-inlinemessage {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: ".concat(dt("inlinemessage.padding"), ";\n border-radius: ").concat(dt("inlinemessage.border.radius"), ";\n gap: ").concat(dt("inlinemessage.gap"), ";\n}\n\n.p-inlinemessage-text {\n font-weight: ").concat(dt("inlinemessage.text.font.weight"), ";\n}\n\n.p-inlinemessage-icon {\n flex-shrink: 0;\n font-size: ").concat(dt("inlinemessage.icon.size"), ";\n width: ").concat(dt("inlinemessage.icon.size"), ";\n height: ").concat(dt("inlinemessage.icon.size"), ";\n}\n\n.p-inlinemessage-icon-only .p-inlinemessage-text {\n visibility: hidden;\n width: 0;\n}\n\n.p-inlinemessage-info {\n background: ").concat(dt("inlinemessage.info.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.info.border.color"), ";\n color: ").concat(dt("inlinemessage.info.color"), ";\n box-shadow: ").concat(dt("inlinemessage.info.shadow"), ";\n}\n\n.p-inlinemessage-info .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.info.color"), ";\n}\n\n.p-inlinemessage-success {\n background: ").concat(dt("inlinemessage.success.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.success.border.color"), ";\n color: ").concat(dt("inlinemessage.success.color"), ";\n box-shadow: ").concat(dt("inlinemessage.success.shadow"), ";\n}\n\n.p-inlinemessage-success .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.success.color"), ";\n}\n\n.p-inlinemessage-warn {\n background: ").concat(dt("inlinemessage.warn.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.warn.border.color"), ";\n color: ").concat(dt("inlinemessage.warn.color"), ";\n box-shadow: ").concat(dt("inlinemessage.warn.shadow"), ";\n}\n\n.p-inlinemessage-warn .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.warn.color"), ";\n}\n\n.p-inlinemessage-error {\n background: ").concat(dt("inlinemessage.error.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.error.border.color"), ";\n color: ").concat(dt("inlinemessage.error.color"), ";\n box-shadow: ").concat(dt("inlinemessage.error.shadow"), ";\n}\n\n.p-inlinemessage-error .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.error.color"), ";\n}\n\n.p-inlinemessage-secondary {\n background: ").concat(dt("inlinemessage.secondary.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.secondary.border.color"), ";\n color: ").concat(dt("inlinemessage.secondary.color"), ";\n box-shadow: ").concat(dt("inlinemessage.secondary.shadow"), ";\n}\n\n.p-inlinemessage-secondary .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.secondary.color"), ";\n}\n\n.p-inlinemessage-contrast {\n background: ").concat(dt("inlinemessage.contrast.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.contrast.border.color"), ";\n color: ").concat(dt("inlinemessage.contrast.color"), ";\n box-shadow: ").concat(dt("inlinemessage.contrast.shadow"), ";\n}\n\n.p-inlinemessage-contrast .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.contrast.color"), ";\n}\n"); }, "theme"); var classes$r = { - root: /* @__PURE__ */ __name(function root14(_ref2) { + root: /* @__PURE__ */ __name(function root13(_ref2) { var props = _ref2.props, instance = _ref2.instance; return ["p-inlinemessage p-component p-inlinemessage-" + props.severity, { "p-inlinemessage-icon-only": !instance.$slots["default"] @@ -10212,7 +9829,7 @@ var InlineMessageStyle = BaseStyle.extend({ }); var script$1$r = { name: "BaseInlineMessage", - "extends": script$1d, + "extends": script$1f, props: { severity: { type: String, @@ -10224,7 +9841,7 @@ var script$1$r = { } }, style: InlineMessageStyle, - provide: /* @__PURE__ */ __name(function provide24() { + provide: /* @__PURE__ */ __name(function provide23() { return { $pcInlineMessage: this, $parentInstance: this @@ -10236,7 +9853,7 @@ var script$G = { "extends": script$1$r, inheritAttrs: false, timeout: null, - data: /* @__PURE__ */ __name(function data15() { + data: /* @__PURE__ */ __name(function data14() { return { visible: true }; @@ -10252,10 +9869,10 @@ var script$G = { computed: { iconComponent: /* @__PURE__ */ __name(function iconComponent() { return { - info: script$1C, - success: script$1D, - warn: script$1E, - error: script$1F + info: script$1B, + success: script$1C, + warn: script$1D, + error: script$1E }[this.severity]; }, "iconComponent") } @@ -10277,7 +9894,7 @@ function render$B(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$B, "render$B"); script$G.render = render$B; -var theme$n = /* @__PURE__ */ __name(function theme17(_ref) { +var theme$n = /* @__PURE__ */ __name(function theme16(_ref) { var dt = _ref.dt; return "\n.p-inplace-display {\n display: inline-block;\n cursor: pointer;\n border: 1px solid transparent;\n padding: ".concat(dt("inplace.padding"), ";\n border-radius: ").concat(dt("inplace.border.radius"), ";\n transition: background ").concat(dt("inplace.transition.duration"), ", color ").concat(dt("inplace.transition.duration"), ", outline-color ").concat(dt("inplace.transition.duration"), ", box-shadow ").concat(dt("inplace.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-inplace-display:not(.p-disabled):hover {\n background: ").concat(dt("inplace.display.hover.background"), ";\n color: ").concat(dt("inplace.display.hover.color"), ";\n}\n\n.p-inplace-display:focus-visible {\n box-shadow: ").concat(dt("inplace.focus.ring.shadow"), ";\n outline: ").concat(dt("inplace.focus.ring.width"), " ").concat(dt("inplace.focus.ring.style"), " ").concat(dt("inplace.focus.ring.color"), ";\n outline-offset: ").concat(dt("inplace.focus.ring.offset"), ";\n}\n\n.p-inplace-content {\n display: block;\n}\n"); }, "theme"); @@ -10298,7 +9915,7 @@ var InplaceStyle = BaseStyle.extend({ }); var script$1$q = { name: "BaseInplace", - "extends": script$1d, + "extends": script$1f, props: { active: { type: Boolean, @@ -10314,7 +9931,7 @@ var script$1$q = { } }, style: InplaceStyle, - provide: /* @__PURE__ */ __name(function provide25() { + provide: /* @__PURE__ */ __name(function provide24() { return { $pcInplace: this, $parentInstance: this @@ -10326,7 +9943,7 @@ var script$F = { "extends": script$1$q, inheritAttrs: false, emits: ["open", "close", "update:active"], - data: /* @__PURE__ */ __name(function data16() { + data: /* @__PURE__ */ __name(function data15() { return { d_active: this.active }; @@ -10434,7 +10051,7 @@ function render$A(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$A, "render$A"); script$F.render = render$A; -var theme$m = /* @__PURE__ */ __name(function theme18(_ref) { +var theme$m = /* @__PURE__ */ __name(function theme17(_ref) { var dt = _ref.dt; return "\n.p-inputgroup,\n.p-inputgroup .p-iconfield,\n.p-inputgroup .p-floatlabel,\n.p-inputgroup .p-iftalabel {\n display: flex;\n align-items: stretch;\n width: 100%;\n}\n\n.p-inputgroup .p-inputtext,\n.p-inputgroup .p-inputwrapper {\n flex: 1 1 auto;\n width: 1%;\n}\n\n.p-inputgroupaddon {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: ".concat(dt("inputgroup.addon.padding"), ";\n background: ").concat(dt("inputgroup.addon.background"), ";\n color: ").concat(dt("inputgroup.addon.color"), ";\n border-block-start: 1px solid ").concat(dt("inputgroup.addon.border.color"), ";\n border-block-end: 1px solid ").concat(dt("inputgroup.addon.border.color"), ";\n min-width: ").concat(dt("inputgroup.addon.min.width"), ";\n}\n\n.p-inputgroupaddon:first-child,\n.p-inputgroupaddon + .p-inputgroupaddon {\n border-inline-start: 1px solid ").concat(dt("inputgroup.addon.border.color"), ";\n}\n\n.p-inputgroupaddon:last-child {\n border-inline-end: 1px solid ").concat(dt("inputgroup.addon.border.color"), ";\n}\n\n.p-inputgroupaddon:has(.p-button) {\n padding: 0;\n overflow: hidden;\n}\n\n.p-inputgroupaddon .p-button {\n border-radius: 0;\n}\n\n.p-inputgroup > .p-component,\n.p-inputgroup > .p-inputwrapper > .p-component,\n.p-inputgroup > .p-iconfield > .p-component,\n.p-inputgroup > .p-floatlabel > .p-component,\n.p-inputgroup > .p-floatlabel > .p-inputwrapper > .p-component,\n.p-inputgroup > .p-iftalabel > .p-component,\n.p-inputgroup > .p-iftalabel > .p-inputwrapper > .p-component {\n border-radius: 0;\n margin: 0;\n}\n\n.p-inputgroupaddon:first-child,\n.p-inputgroup > .p-component:first-child,\n.p-inputgroup > .p-inputwrapper:first-child > .p-component,\n.p-inputgroup > .p-iconfield:first-child > .p-component,\n.p-inputgroup > .p-floatlabel:first-child > .p-component,\n.p-inputgroup > .p-floatlabel:first-child > .p-inputwrapper > .p-component,\n.p-inputgroup > .p-iftalabel:first-child > .p-component,\n.p-inputgroup > .p-iftalabel:first-child > .p-inputwrapper > .p-component {\n border-start-start-radius: ").concat(dt("inputgroup.addon.border.radius"), ";\n border-end-start-radius: ").concat(dt("inputgroup.addon.border.radius"), ";\n}\n\n.p-inputgroupaddon:last-child,\n.p-inputgroup > .p-component:last-child,\n.p-inputgroup > .p-inputwrapper:last-child > .p-component,\n.p-inputgroup > .p-iconfield:last-child > .p-component,\n.p-inputgroup > .p-floatlabel:last-child > .p-component,\n.p-inputgroup > .p-floatlabel:last-child > .p-inputwrapper > .p-component,\n.p-inputgroup > .p-iftalabel:last-child > .p-component,\n.p-inputgroup > .p-iftalabel:last-child > .p-inputwrapper > .p-component {\n border-start-end-radius: ").concat(dt("inputgroup.addon.border.radius"), ";\n border-end-end-radius: ").concat(dt("inputgroup.addon.border.radius"), ";\n}\n\n.p-inputgroup .p-component:focus,\n.p-inputgroup .p-component.p-focus,\n.p-inputgroup .p-inputwrapper-focus,\n.p-inputgroup .p-component:focus ~ label,\n.p-inputgroup .p-component.p-focus ~ label,\n.p-inputgroup .p-inputwrapper-focus ~ label {\n z-index: 1;\n}\n\n.p-inputgroup > .p-button:not(.p-button-icon-only) {\n width: auto;\n}\n\n.p-inputgroup .p-iconfield + .p-iconfield .p-inputtext {\n border-inline-start: 0;\n}\n"); }, "theme"); @@ -10448,9 +10065,9 @@ var InputGroupStyle = BaseStyle.extend({ }); var script$1$p = { name: "BaseInputGroup", - "extends": script$1d, + "extends": script$1f, style: InputGroupStyle, - provide: /* @__PURE__ */ __name(function provide26() { + provide: /* @__PURE__ */ __name(function provide25() { return { $pcInputGroup: this, $parentInstance: this @@ -10478,9 +10095,9 @@ var InputGroupAddonStyle = BaseStyle.extend({ }); var script$1$o = { name: "BaseInputGroupAddon", - "extends": script$1d, + "extends": script$1f, style: InputGroupAddonStyle, - provide: /* @__PURE__ */ __name(function provide27() { + provide: /* @__PURE__ */ __name(function provide26() { return { $pcInputGroupAddon: this, $parentInstance: this @@ -10500,7 +10117,7 @@ function render$y(_ctx, _cache, $props, $setup, $data, $options) { __name(render$y, "render$y"); script$D.render = render$y; var classes$n = { - root: /* @__PURE__ */ __name(function root15(_ref) { + root: /* @__PURE__ */ __name(function root14(_ref) { var instance = _ref.instance; return ["p-inputmask", { "p-filled": instance.$filled @@ -10513,7 +10130,7 @@ var InputMaskStyle = BaseStyle.extend({ }); var script$1$n = { name: "BaseInputMask", - "extends": script$1n, + "extends": script$1k, props: { slotChar: { type: String, @@ -10549,7 +10166,7 @@ var script$1$n = { } }, style: InputMaskStyle, - provide: /* @__PURE__ */ __name(function provide28() { + provide: /* @__PURE__ */ __name(function provide27() { return { $pcInputMask: this, $parentInstance: this @@ -10566,13 +10183,13 @@ var script$C = { "default": null } }, - data: /* @__PURE__ */ __name(function data17() { + data: /* @__PURE__ */ __name(function data16() { return { currentVal: "" }; }, "data"), watch: { - mask: /* @__PURE__ */ __name(function mask3(newMask, oldMask) { + mask: /* @__PURE__ */ __name(function mask(newMask, oldMask) { if (oldMask !== newMask) { this.initMask(); } @@ -10581,7 +10198,7 @@ var script$C = { mounted: /* @__PURE__ */ __name(function mounted19() { this.initMask(); }, "mounted"), - updated: /* @__PURE__ */ __name(function updated4() { + updated: /* @__PURE__ */ __name(function updated3() { if (this.isValueUpdated()) { this.updateValue(); } @@ -10978,7 +10595,7 @@ var script$C = { }, "ptmParams") }, components: { - InputText: script$1o + InputText: script$1l } }; function render$x(_ctx, _cache, $props, $setup, $data, $options) { @@ -11008,7 +10625,7 @@ function render$x(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$x, "render$x"); script$C.render = render$x; -var theme$l = /* @__PURE__ */ __name(function theme19(_ref) { +var theme$l = /* @__PURE__ */ __name(function theme18(_ref) { var dt = _ref.dt; return "\n.p-inputotp {\n display: flex;\n align-items: center;\n gap: ".concat(dt("inputotp.gap"), ";\n}\n\n.p-inputotp-input {\n text-align: center;\n width: ").concat(dt("inputotp.input.width"), ";\n}\n\n.p-inputotp-input.p-inputtext-sm {\n text-align: center;\n width: ").concat(dt("inputotp.input.sm.width"), ";\n}\n\n.p-inputotp-input.p-inputtext-lg {\n text-align: center;\n width: ").concat(dt("inputotp.input.lg.width"), ";\n}\n"); }, "theme"); @@ -11023,7 +10640,7 @@ var InputOtpStyle = BaseStyle.extend({ }); var script$1$m = { name: "BaseInputOtp", - "extends": script$1n, + "extends": script$1k, props: { readonly: { type: Boolean, @@ -11047,7 +10664,7 @@ var script$1$m = { } }, style: InputOtpStyle, - provide: /* @__PURE__ */ __name(function provide29() { + provide: /* @__PURE__ */ __name(function provide28() { return { $pcInputOtp: this, $parentInstance: this @@ -11059,7 +10676,7 @@ var script$B = { "extends": script$1$m, inheritAttrs: false, emits: ["change", "focus", "blur"], - data: /* @__PURE__ */ __name(function data18() { + data: /* @__PURE__ */ __name(function data17() { return { tokens: [] }; @@ -11206,7 +10823,7 @@ var script$B = { }, "inputType") }, components: { - OtpInputText: script$1o + OtpInputText: script$1l } }; function render$w(_ctx, _cache, $props, $setup, $data, $options) { @@ -11260,7 +10877,7 @@ __name(render$w, "render$w"); script$B.render = render$w; var script$A = { name: "InputSwitch", - "extends": script$1G, + "extends": script$1F, mounted: /* @__PURE__ */ __name(function mounted20() { console.warn("Deprecated since v4. Use ToggleSwitch component instead."); }, "mounted") @@ -11326,7 +10943,7 @@ var KeyFilter = BaseKeyFilter.extend("keyfilter", { this.bindEvents(target); target.setAttribute("data-pd-keyfilter", true); }, "beforeMount"), - updated: /* @__PURE__ */ __name(function updated5(el, options4) { + updated: /* @__PURE__ */ __name(function updated4(el, options4) { var target = this.getTarget(el); if (!target) return; target.$_pkeyfilterModifier = this.getModifiers(options4); @@ -11382,7 +10999,7 @@ var KeyFilter = BaseKeyFilter.extend("keyfilter", { el.$_keyfilterKeydownEvent = null; el.$_keyfilterPasteEvent = null; }, "unbindEvents"), - onKeydown: /* @__PURE__ */ __name(function onKeydown3(event2, target) { + onKeydown: /* @__PURE__ */ __name(function onKeydown2(event2, target) { if (event2.ctrlKey || event2.altKey || event2.metaKey || event2.key === "Tab") { return; } @@ -11419,12 +11036,12 @@ var KeyFilter = BaseKeyFilter.extend("keyfilter", { }, "onPaste") } }); -var theme$k = /* @__PURE__ */ __name(function theme20(_ref) { +var theme$k = /* @__PURE__ */ __name(function theme19(_ref) { var dt = _ref.dt; return "\n.p-knob-range {\n fill: none;\n transition: stroke 0.1s ease-in;\n}\n\n.p-knob-value {\n animation-name: p-knob-dash-frame;\n animation-fill-mode: forwards;\n fill: none;\n}\n\n.p-knob-text {\n font-size: 1.3rem;\n text-align: center;\n}\n\n.p-knob svg {\n border-radius: 50%;\n outline-color: transparent;\n transition: background ".concat(dt("knob.transition.duration"), ", color ").concat(dt("knob.transition.duration"), ", outline-color ").concat(dt("knob.transition.duration"), ", box-shadow ").concat(dt("knob.transition.duration"), ";\n}\n\n.p-knob svg:focus-visible {\n box-shadow: ").concat(dt("knob.focus.ring.shadow"), ";\n outline: ").concat(dt("knob.focus.ring.width"), " ").concat(dt("knob.focus.ring.style"), " ").concat(dt("knob.focus.ring.color"), ";\n outline-offset: ").concat(dt("knob.focus.ring.offset"), ";\n}\n\n@keyframes p-knob-dash-frame {\n 100% {\n stroke-dashoffset: 0;\n }\n}\n"); }, "theme"); var classes$l = { - root: /* @__PURE__ */ __name(function root16(_ref2) { + root: /* @__PURE__ */ __name(function root15(_ref2) { var instance = _ref2.instance, props = _ref2.props; return ["p-knob p-component", { "p-disabled": props.disabled, @@ -11442,7 +11059,7 @@ var KnobStyle = BaseStyle.extend({ }); var script$1$l = { name: "BaseKnob", - "extends": script$1s, + "extends": script$1r, props: { size: { type: Number, @@ -11466,19 +11083,19 @@ var script$1$l = { }, valueColor: { type: String, - "default": /* @__PURE__ */ __name(function _default10() { + "default": /* @__PURE__ */ __name(function _default9() { return $dt("knob.value.background").variable; }, "_default") }, rangeColor: { type: String, - "default": /* @__PURE__ */ __name(function _default11() { + "default": /* @__PURE__ */ __name(function _default10() { return $dt("knob.range.background").variable; }, "_default") }, textColor: { type: String, - "default": /* @__PURE__ */ __name(function _default12() { + "default": /* @__PURE__ */ __name(function _default11() { return $dt("knob.text.color").variable; }, "_default") }, @@ -11508,7 +11125,7 @@ var script$1$l = { } }, style: KnobStyle, - provide: /* @__PURE__ */ __name(function provide30() { + provide: /* @__PURE__ */ __name(function provide29() { return { $pcKnob: this, $parentInstance: this @@ -11521,7 +11138,7 @@ var script$z = { "extends": script$1$l, inheritAttrs: false, emits: ["change"], - data: /* @__PURE__ */ __name(function data19() { + data: /* @__PURE__ */ __name(function data18() { return { radius: 40, midX: 50, @@ -11759,7 +11376,7 @@ function render$v(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$v, "render$v"); script$z.render = render$v; -var theme$j = /* @__PURE__ */ __name(function theme21(_ref) { +var theme$j = /* @__PURE__ */ __name(function theme20(_ref) { var dt = _ref.dt; return "\n.p-megamenu {\n position: relative;\n display: flex;\n align-items: center;\n background: ".concat(dt("megamenu.background"), ";\n border: 1px solid ").concat(dt("megamenu.border.color"), ";\n border-radius: ").concat(dt("megamenu.border.radius"), ";\n color: ").concat(dt("megamenu.color"), ";\n gap: ").concat(dt("megamenu.gap"), ";\n}\n\n.p-megamenu-start,\n.p-megamenu-end {\n display: flex;\n align-items: center;\n}\n\n.p-megamenu-root-list {\n margin: 0;\n padding: 0;\n list-style: none;\n outline: 0 none;\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n gap: ").concat(dt("megamenu.gap"), ";\n}\n\n.p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content {\n border-radius: ").concat(dt("megamenu.base.item.border.radius"), ";\n}\n\n.p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content > .p-megamenu-item-link {\n padding: ").concat(dt("megamenu.base.item.padding"), ";\n}\n\n.p-megamenu-item-content {\n transition: background ").concat(dt("megamenu.transition.duration"), ", color ").concat(dt("megamenu.transition.duration"), ";\n border-radius: ").concat(dt("megamenu.item.border.radius"), ";\n color: ").concat(dt("megamenu.item.color"), ";\n}\n\n.p-megamenu-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("megamenu.item.padding"), ";\n gap: ").concat(dt("megamenu.item.gap"), ";\n user-select: none;\n outline: 0 none;\n}\n\n.p-megamenu-item-label {\n line-height: 1;\n}\n\n.p-megamenu-item-icon {\n color: ").concat(dt("megamenu.item.icon.color"), ";\n}\n\n.p-megamenu-submenu-icon {\n color: ").concat(dt("megamenu.submenu.icon.color"), ";\n font-size: ").concat(dt("megamenu.submenu.icon.size"), ";\n width: ").concat(dt("megamenu.submenu.icon.size"), ";\n height: ").concat(dt("megamenu.submenu.icon.size"), ";\n}\n\n.p-megamenu-item.p-focus > .p-megamenu-item-content {\n color: ").concat(dt("megamenu.item.focus.color"), ";\n background: ").concat(dt("megamenu.item.focus.background"), ";\n}\n\n.p-megamenu-item.p-focus > .p-megamenu-item-content .p-megamenu-item-icon {\n color: ").concat(dt("megamenu.item.icon.focus.color"), ";\n}\n\n.p-megamenu-item.p-focus > .p-megamenu-item-content .p-megamenu-submenu-icon {\n color: ").concat(dt("megamenu.submenu.icon.focus.color"), ";\n}\n\n.p-megamenu-item:not(.p-disabled) > .p-megamenu-item-content:hover {\n color: ").concat(dt("megamenu.item.focus.color"), ";\n background: ").concat(dt("megamenu.item.focus.background"), ";\n}\n\n.p-megamenu-item:not(.p-disabled) > .p-megamenu-item-content:hover .p-megamenu-item-icon {\n color: ").concat(dt("megamenu.item.icon.focus.color"), ";\n}\n\n.p-megamenu-item:not(.p-disabled) > .p-megamenu-item-content:hover .p-megamenu-submenu-icon {\n color: ").concat(dt("megamenu.submenu.icon.focus.color"), ";\n}\n\n.p-megamenu-item-active > .p-megamenu-item-content {\n color: ").concat(dt("megamenu.item.active.color"), ";\n background: ").concat(dt("megamenu.item.active.background"), ";\n}\n\n.p-megamenu-item-active > .p-megamenu-item-content .p-megamenu-item-icon {\n color: ").concat(dt("megamenu.item.icon.active.color"), ";\n}\n\n.p-megamenu-item-active > .p-megamenu-item-content .p-megamenu-submenu-icon {\n color: ").concat(dt("megamenu.submenu.icon.active.color"), ";\n}\n\n.p-megamenu-overlay {\n display: none;\n position: absolute;\n width: auto;\n z-index: 1;\n left: 0;\n min-width: 100%;\n padding: ").concat(dt("megamenu.overlay.padding"), ";\n background: ").concat(dt("megamenu.overlay.background"), ";\n color: ").concat(dt("megamenu.overlay.color"), ";\n border: 1px solid ").concat(dt("megamenu.overlay.border.color"), ";\n border-radius: ").concat(dt("megamenu.overlay.border.radius"), ";\n box-shadow: ").concat(dt("megamenu.overlay.shadow"), ";\n}\n\n.p-megamenu-overlay:dir(rtl) {\n left: auto;\n right: 0;\n}\n\n.p-megamenu-root-list > .p-megamenu-item-active > .p-megamenu-overlay {\n display: block;\n}\n\n.p-megamenu-submenu {\n margin: 0;\n list-style: none;\n padding: ").concat(dt("megamenu.submenu.padding"), ";\n min-width: 12.5rem;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("megamenu.submenu.gap"), "\n}\n\n.p-megamenu-submenu-label {\n padding: ").concat(dt("megamenu.submenu.label.padding"), ";\n color: ").concat(dt("megamenu.submenu.label.color"), ";\n font-weight: ").concat(dt("megamenu.submenu.label.font.weight"), ";\n background: ").concat(dt("megamenu.submenu.label.background"), ";\n}\n\n.p-megamenu-separator {\n border-block-start: 1px solid ").concat(dt("megamenu.separator.border.color"), ";\n}\n\n.p-megamenu-horizontal {\n align-items: center;\n padding: ").concat(dt("megamenu.horizontal.orientation.padding"), ";\n}\n\n.p-megamenu-horizontal .p-megamenu-root-list {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: ").concat(dt("megamenu.horizontal.orientation.gap"), ";\n}\n\n.p-megamenu-horizontal .p-megamenu-end {\n margin-left: auto;\n align-self: center;\n}\n\n.p-megamenu-horizontal .p-megamenu-end:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\n}\n\n.p-megamenu-vertical {\n display: inline-flex;\n min-width: 12.5rem;\n flex-direction: column;\n align-items: stretch;\n padding: ").concat(dt("megamenu.vertical.orientation.padding"), ";\n}\n\n.p-megamenu-vertical .p-megamenu-root-list {\n align-items: stretch;\n flex-direction: column;\n gap: ").concat(dt("megamenu.vertical.orientation.gap"), ";\n}\n\n.p-megamenu-vertical .p-megamenu-root-list > .p-megamenu-item-active > .p-megamenu-overlay {\n left: 100%;\n top: 0;\n}\n\n.p-megamenu-vertical .p-megamenu-root-list > .p-megamenu-item-active > .p-megamenu-overlay:dir(rtl) {\n left: auto;\n right: 100%;\n}\n\n.p-megamenu-vertical .p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content .p-megamenu-submenu-icon {\n margin-left: auto;\n}\n\n.p-megamenu-vertical .p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content .p-megamenu-submenu-icon:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\n transform: rotate(180deg);\n}\n\n.p-megamenu-grid {\n display: flex;\n}\n\n.p-megamenu-col-2,\n.p-megamenu-col-3,\n.p-megamenu-col-4,\n.p-megamenu-col-6,\n.p-megamenu-col-12 {\n flex: 0 0 auto;\n padding: ").concat(dt("megamenu.overlay.gap"), ";\n}\n\n.p-megamenu-col-2 {\n width: 16.6667%;\n}\n\n.p-megamenu-col-3 {\n width: 25%;\n}\n\n.p-megamenu-col-4 {\n width: 33.3333%;\n}\n\n.p-megamenu-col-6 {\n width: 50%;\n}\n\n.p-megamenu-col-12 {\n width: 100%;\n}\n\n.p-megamenu-button {\n display: none;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n width: ").concat(dt("megamenu.mobile.button.size"), ";\n height: ").concat(dt("megamenu.mobile.button.size"), ";\n position: relative;\n color: ").concat(dt("megamenu.mobile.button.color"), ";\n border: 0 none;\n background: transparent;\n border-radius: ").concat(dt("megamenu.mobile.button.border.radius"), ";\n transition: background ").concat(dt("megamenu.transition.duration"), ", color ").concat(dt("megamenu.transition.duration"), ", outline-color ").concat(dt("megamenu.transition.duration"), ", box-shadow ").concat(dt("megamenu.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-megamenu-button:hover {\n color: ").concat(dt("megamenu.mobile.button.hover.color"), ";\n background: ").concat(dt("megamenu.mobile.button.hover.background"), ";\n}\n\n.p-megamenu-button:focus-visible {\n box-shadow: ").concat(dt("megamenu.mobile.button.focus.ring.shadow"), ";\n outline: ").concat(dt("megamenu.mobile.button.focus.ring.width"), " ").concat(dt("megamenu.mobile.button.focus.ring.style"), " ").concat(dt("megamenu.mobile.button.focus.ring.color"), ";\n outline-offset: ").concat(dt("megamenu.mobile.button.focus.ring.offset"), ";\n}\n\n.p-megamenu-mobile {\n display: flex;\n}\n\n.p-megamenu-mobile .p-megamenu-button {\n display: flex;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list {\n position: absolute;\n display: none;\n flex-direction: column;\n top: 100%;\n left: 0;\n z-index: 1;\n width: 100%;\n padding: ").concat(dt("megamenu.submenu.padding"), ";\n gap: ").concat(dt("megamenu.submenu.gap"), ";\n background: ").concat(dt("megamenu.overlay.background"), ";\n border: 1px solid ").concat(dt("megamenu.overlay.border.color"), ";\n box-shadow: ").concat(dt("megamenu.overlay.shadow"), ";\n}\n\n.p-megamenu-mobile .p-megamenu-root-list:dir(rtl) {\n left: auto;\n right: 0;\n}\n\n.p-megamenu-mobile-active .p-megamenu-root-list {\n display: block;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list .p-megamenu-item {\n width: 100%;\n position: static;\n}\n\n.p-megamenu-mobile .p-megamenu-overlay {\n position: static;\n border: 0 none;\n border-radius: 0;\n box-shadow: none;\n}\n\n.p-megamenu-mobile .p-megamenu-grid {\n flex-wrap: wrap;\n overflow: auto;\n max-height: 90%;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content .p-megamenu-submenu-icon {\n margin-left: auto;\n transition: transform 0.2s;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content .p-megamenu-submenu-icon:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list > .p-megamenu-item-active > .p-megamenu-item-content .p-megamenu-submenu-icon {\n transform: rotate(-180deg);\n}\n"); }, "theme"); @@ -11773,7 +11390,7 @@ var inlineStyles$6 = { }, "rootList") }; var classes$k = { - root: /* @__PURE__ */ __name(function root17(_ref3) { + root: /* @__PURE__ */ __name(function root16(_ref3) { var instance = _ref3.instance; return ["p-megamenu p-component", { "p-megamenu-mobile": instance.queryMatches, @@ -11844,7 +11461,7 @@ var MegaMenuStyle = BaseStyle.extend({ }); var script$2$5 = { name: "BaseMegaMenu", - "extends": script$1d, + "extends": script$1f, props: { model: { type: Array, @@ -11880,7 +11497,7 @@ var script$2$5 = { } }, style: MegaMenuStyle, - provide: /* @__PURE__ */ __name(function provide31() { + provide: /* @__PURE__ */ __name(function provide30() { return { $pcMegaMenu: this, $parentInstance: this @@ -11890,7 +11507,7 @@ var script$2$5 = { var script$1$k = { name: "MegaMenuSub", hostName: "MegaMenu", - "extends": script$1d, + "extends": script$1f, emits: ["item-click", "item-mouseenter"], props: { menuId: { @@ -12027,8 +11644,8 @@ var script$1$k = { }, "getMenuItemProps") }, components: { - AngleRightIcon: script$1q, - AngleDownIcon: script$1H + AngleRightIcon: script$1o, + AngleDownIcon: script$1G }, directives: { ripple: Ripple @@ -12182,7 +11799,7 @@ var script$y = { menubar: null, searchTimeout: null, searchValue: null, - data: /* @__PURE__ */ __name(function data20() { + data: /* @__PURE__ */ __name(function data19() { return { id: this.$attrs.id, mobileActive: false, @@ -12216,7 +11833,7 @@ var script$y = { this.id = this.id || UniqueComponentId(); this.bindMatchMediaListener(); }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount8() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount7() { this.mobileActive = false; this.unbindOutsideClickListener(); this.unbindResizeListener(); @@ -12271,7 +11888,7 @@ var script$y = { }; focus(this.menubar); }, "show"), - hide: /* @__PURE__ */ __name(function hide3(event2, isFocus) { + hide: /* @__PURE__ */ __name(function hide2(event2, isFocus) { var _this2 = this; if (this.mobileActive) { this.mobileActive = false; @@ -12382,7 +11999,7 @@ var script$y = { onItemClick: /* @__PURE__ */ __name(function onItemClick3(event2) { var originalEvent = event2.originalEvent, processedItem = event2.processedItem; var grouped = this.isProccessedItemGroup(processedItem); - var root35 = isEmpty(processedItem.parent); + var root34 = isEmpty(processedItem.parent); var selected3 = this.isSelected(processedItem); if (selected3) { var index = processedItem.index, key = processedItem.key, parentKey = processedItem.parentKey; @@ -12392,7 +12009,7 @@ var script$y = { key, parentKey }; - this.dirty = !root35; + this.dirty = !root34; if (!this.mobileActive) { focus(this.menubar, { preventScroll: true @@ -12580,7 +12197,7 @@ var script$y = { } this.hide(); }, "onTabKey"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener4() { + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener3() { var _this3 = this; if (!this.outsideClickListener) { this.outsideClickListener = function(event2) { @@ -12593,7 +12210,7 @@ var script$y = { document.addEventListener("click", this.outsideClickListener); } }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener4() { + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener3() { if (this.outsideClickListener) { document.removeEventListener("click", this.outsideClickListener); this.outsideClickListener = null; @@ -12775,7 +12392,7 @@ var script$y = { }); return processedItems3; }, "createProcessedItems"), - containerRef: /* @__PURE__ */ __name(function containerRef3(el) { + containerRef: /* @__PURE__ */ __name(function containerRef2(el) { this.container = el; }, "containerRef"), menubarRef: /* @__PURE__ */ __name(function menubarRef(el) { @@ -12809,7 +12426,7 @@ var script$y = { }, components: { MegaMenuSub: script$1$k, - BarsIcon: script$1I + BarsIcon: script$1H } }; var _hoisted_1$i = ["id"]; @@ -12884,12 +12501,12 @@ function render$u(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$u, "render$u"); script$y.render = render$u; -var theme$i = /* @__PURE__ */ __name(function theme22(_ref) { +var theme$i = /* @__PURE__ */ __name(function theme21(_ref) { var dt = _ref.dt; return "\n.p-menu {\n background: ".concat(dt("menu.background"), ";\n color: ").concat(dt("menu.color"), ";\n border: 1px solid ").concat(dt("menu.border.color"), ";\n border-radius: ").concat(dt("menu.border.radius"), ";\n min-width: 12.5rem;\n}\n\n.p-menu-list {\n margin: 0;\n padding: ").concat(dt("menu.list.padding"), ";\n outline: 0 none;\n list-style: none;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("menu.list.gap"), ";\n}\n\n.p-menu-item-content {\n transition: background ").concat(dt("menu.transition.duration"), ", color ").concat(dt("menu.transition.duration"), ";\n border-radius: ").concat(dt("menu.item.border.radius"), ";\n color: ").concat(dt("menu.item.color"), ";\n}\n\n.p-menu-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("menu.item.padding"), ";\n gap: ").concat(dt("menu.item.gap"), ";\n user-select: none;\n outline: 0 none;\n}\n\n.p-menu-item-label {\n line-height: 1;\n}\n\n.p-menu-item-icon {\n color: ").concat(dt("menu.item.icon.color"), ";\n}\n\n.p-menu-item.p-focus .p-menu-item-content {\n color: ").concat(dt("menu.item.focus.color"), ";\n background: ").concat(dt("menu.item.focus.background"), ";\n}\n\n.p-menu-item.p-focus .p-menu-item-icon {\n color: ").concat(dt("menu.item.icon.focus.color"), ";\n}\n\n.p-menu-item:not(.p-disabled) .p-menu-item-content:hover {\n color: ").concat(dt("menu.item.focus.color"), ";\n background: ").concat(dt("menu.item.focus.background"), ";\n}\n\n.p-menu-item:not(.p-disabled) .p-menu-item-content:hover .p-menu-item-icon {\n color: ").concat(dt("menu.item.icon.focus.color"), ";\n}\n\n.p-menu-overlay {\n box-shadow: ").concat(dt("menu.shadow"), ";\n}\n\n.p-menu-submenu-label {\n background: ").concat(dt("menu.submenu.label.background"), ";\n padding: ").concat(dt("menu.submenu.label.padding"), ";\n color: ").concat(dt("menu.submenu.label.color"), ";\n font-weight: ").concat(dt("menu.submenu.label.font.weight"), ";\n}\n\n.p-menu-separator {\n border-block-start: 1px solid ").concat(dt("menu.separator.border.color"), ";\n}\n"); }, "theme"); var classes$j = { - root: /* @__PURE__ */ __name(function root18(_ref2) { + root: /* @__PURE__ */ __name(function root17(_ref2) { var props = _ref2.props; return ["p-menu p-component", { "p-menu-overlay": props.popup @@ -12919,7 +12536,7 @@ var MenuStyle = BaseStyle.extend({ }); var script$2$4 = { name: "BaseMenu", - "extends": script$1d, + "extends": script$1f, props: { popup: { type: Boolean, @@ -12955,7 +12572,7 @@ var script$2$4 = { } }, style: MenuStyle, - provide: /* @__PURE__ */ __name(function provide32() { + provide: /* @__PURE__ */ __name(function provide31() { return { $pcMenu: this, $parentInstance: this @@ -12965,7 +12582,7 @@ var script$2$4 = { var script$1$j = { name: "Menuitem", hostName: "Menu", - "extends": script$1d, + "extends": script$1f, inheritAttrs: false, emits: ["item-click", "item-mousemove"], props: { @@ -13121,7 +12738,7 @@ var script$x = { "extends": script$2$4, inheritAttrs: false, emits: ["show", "hide", "focus", "blur"], - data: /* @__PURE__ */ __name(function data21() { + data: /* @__PURE__ */ __name(function data20() { return { id: this.$attrs.id, overlayVisible: false, @@ -13148,7 +12765,7 @@ var script$x = { this.bindOutsideClickListener(); } }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount9() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount8() { this.unbindResizeListener(); this.unbindOutsideClickListener(); if (this.scrollHandler) { @@ -13282,11 +12899,11 @@ var script$x = { this.overlayVisible = true; this.target = event2.currentTarget; }, "show"), - hide: /* @__PURE__ */ __name(function hide4() { + hide: /* @__PURE__ */ __name(function hide3() { this.overlayVisible = false; this.target = null; }, "hide"), - onEnter: /* @__PURE__ */ __name(function onEnter3(el) { + onEnter: /* @__PURE__ */ __name(function onEnter2(el) { addStyle(el, { position: "absolute", top: "0", @@ -13304,13 +12921,13 @@ var script$x = { } this.$emit("show"); }, "onEnter"), - onLeave: /* @__PURE__ */ __name(function onLeave3() { + onLeave: /* @__PURE__ */ __name(function onLeave2() { this.unbindOutsideClickListener(); this.unbindResizeListener(); this.unbindScrollListener(); this.$emit("hide"); }, "onLeave"), - onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave3(el) { + onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave2(el) { if (this.autoZIndex) { ZIndex.clear(el); } @@ -13322,7 +12939,7 @@ var script$x = { this.container.style.minWidth = getOuterWidth(this.target) + "px"; } }, "alignOverlay"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener5() { + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener4() { var _this = this; if (!this.outsideClickListener) { this.outsideClickListener = function(event2) { @@ -13337,7 +12954,7 @@ var script$x = { document.addEventListener("click", this.outsideClickListener); } }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener5() { + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener4() { if (this.outsideClickListener) { document.removeEventListener("click", this.outsideClickListener); this.outsideClickListener = null; @@ -13391,7 +13008,7 @@ var script$x = { target: this.target }); }, "onOverlayClick"), - containerRef: /* @__PURE__ */ __name(function containerRef4(el) { + containerRef: /* @__PURE__ */ __name(function containerRef3(el) { this.container = el; }, "containerRef"), listRef: /* @__PURE__ */ __name(function listRef(el) { @@ -13405,7 +13022,7 @@ var script$x = { }, components: { PVMenuitem: script$1$j, - Portal: script$1f + Portal: script$1m } }; var _hoisted_1$h = ["id"]; @@ -13521,12 +13138,12 @@ function render$t(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$t, "render$t"); script$x.render = render$t; -var theme$h = /* @__PURE__ */ __name(function theme23(_ref) { +var theme$h = /* @__PURE__ */ __name(function theme22(_ref) { var dt = _ref.dt; return "\n.p-metergroup {\n display: flex;\n gap: ".concat(dt("metergroup.gap"), ";\n}\n\n.p-metergroup-meters {\n display: flex;\n background: ").concat(dt("metergroup.meters.background"), ";\n border-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n\n.p-metergroup-label-list {\n display: flex;\n flex-wrap: wrap;\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n\n.p-metergroup-label {\n display: inline-flex;\n align-items: center;\n gap: ").concat(dt("metergroup.label.gap"), ";\n}\n\n.p-metergroup-label-marker {\n display: inline-flex;\n width: ").concat(dt("metergroup.label.marker.size"), ";\n height: ").concat(dt("metergroup.label.marker.size"), ";\n border-radius: 100%;\n}\n\n.p-metergroup-label-icon {\n font-size: ").concat(dt("metergroup.label.icon.size"), ";\n width: ").concat(dt("metergroup.label.icon.size"), ";\n height: ").concat(dt("metergroup.label.icon.size"), ";\n}\n\n.p-metergroup-horizontal {\n flex-direction: column;\n}\n\n.p-metergroup-label-list-horizontal {\n gap: ").concat(dt("metergroup.label.list.horizontal.gap"), ";\n}\n\n.p-metergroup-horizontal .p-metergroup-meters {\n height: ").concat(dt("metergroup.meters.size"), ";\n}\n\n.p-metergroup-horizontal .p-metergroup-meter:first-of-type {\n border-start-start-radius: ").concat(dt("metergroup.border.radius"), ";\n border-end-start-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n\n.p-metergroup-horizontal .p-metergroup-meter:last-of-type {\n border-start-end-radius: ").concat(dt("metergroup.border.radius"), ";\n border-end-end-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n\n.p-metergroup-vertical {\n flex-direction: row;\n}\n\n.p-metergroup-label-list-vertical {\n flex-direction: column;\n gap: ").concat(dt("metergroup.label.list.vertical.gap"), ";\n}\n\n.p-metergroup-vertical .p-metergroup-meters {\n flex-direction: column;\n width: ").concat(dt("metergroup.meters.size"), ";\n height: 100%;\n}\n\n.p-metergroup-vertical .p-metergroup-label-list {\n align-items: flex-start;\n}\n\n.p-metergroup-vertical .p-metergroup-meter:first-of-type {\n border-start-start-radius: ").concat(dt("metergroup.border.radius"), ";\n border-start-end-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n\n.p-metergroup-vertical .p-metergroup-meter:last-of-type {\n border-end-start-radius: ").concat(dt("metergroup.border.radius"), ";\n border-end-end-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n"); }, "theme"); var classes$i = { - root: /* @__PURE__ */ __name(function root19(_ref2) { + root: /* @__PURE__ */ __name(function root18(_ref2) { var props = _ref2.props; return ["p-metergroup p-component", { "p-metergroup-horizontal": props.orientation === "horizontal", @@ -13554,7 +13171,7 @@ var MeterGroupStyle = BaseStyle.extend({ }); var script$2$3 = { name: "MeterGroup", - "extends": script$1d, + "extends": script$1f, props: { value: { type: Array, @@ -13582,7 +13199,7 @@ var script$2$3 = { } }, style: MeterGroupStyle, - provide: /* @__PURE__ */ __name(function provide33() { + provide: /* @__PURE__ */ __name(function provide32() { return { $pcMeterGroup: this, $parentInstance: this @@ -13592,7 +13209,7 @@ var script$2$3 = { var script$1$i = { name: "MeterGroupLabel", hostName: "MeterGroup", - "extends": script$1d, + "extends": script$1f, inheritAttrs: false, props: { value: { @@ -13759,12 +13376,12 @@ function render$s(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$s, "render$s"); script$w.render = render$s; -var theme$g = /* @__PURE__ */ __name(function theme24(_ref) { +var theme$g = /* @__PURE__ */ __name(function theme23(_ref) { var dt = _ref.dt; return "\n.p-multiselect {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n background: ".concat(dt("multiselect.background"), ";\n border: 1px solid ").concat(dt("multiselect.border.color"), ";\n transition: background ").concat(dt("multiselect.transition.duration"), ", color ").concat(dt("multiselect.transition.duration"), ", border-color ").concat(dt("multiselect.transition.duration"), ", outline-color ").concat(dt("multiselect.transition.duration"), ", box-shadow ").concat(dt("multiselect.transition.duration"), ";\n border-radius: ").concat(dt("multiselect.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("multiselect.shadow"), ";\n}\n\n.p-multiselect:not(.p-disabled):hover {\n border-color: ").concat(dt("multiselect.hover.border.color"), ";\n}\n\n.p-multiselect:not(.p-disabled).p-focus {\n border-color: ").concat(dt("multiselect.focus.border.color"), ";\n box-shadow: ").concat(dt("multiselect.focus.ring.shadow"), ";\n outline: ").concat(dt("multiselect.focus.ring.width"), " ").concat(dt("multiselect.focus.ring.style"), " ").concat(dt("multiselect.focus.ring.color"), ";\n outline-offset: ").concat(dt("multiselect.focus.ring.offset"), ";\n}\n\n.p-multiselect.p-variant-filled {\n background: ").concat(dt("multiselect.filled.background"), ";\n}\n\n.p-multiselect.p-variant-filled:not(.p-disabled):hover {\n background: ").concat(dt("multiselect.filled.hover.background"), ";\n}\n\n.p-multiselect.p-variant-filled.p-focus {\n background: ").concat(dt("multiselect.filled.focus.background"), ";\n}\n\n.p-multiselect.p-invalid {\n border-color: ").concat(dt("multiselect.invalid.border.color"), ";\n}\n\n.p-multiselect.p-disabled {\n opacity: 1;\n background: ").concat(dt("multiselect.disabled.background"), ";\n}\n\n.p-multiselect-dropdown {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n background: transparent;\n color: ").concat(dt("multiselect.dropdown.color"), ";\n width: ").concat(dt("multiselect.dropdown.width"), ";\n border-start-end-radius: ").concat(dt("multiselect.border.radius"), ";\n border-end-end-radius: ").concat(dt("multiselect.border.radius"), ";\n}\n\n.p-multiselect-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n color: ").concat(dt("multiselect.clear.icon.color"), ";\n inset-inline-end: ").concat(dt("multiselect.dropdown.width"), ";\n}\n\n.p-multiselect-label-container {\n overflow: hidden;\n flex: 1 1 auto;\n cursor: pointer;\n}\n\n.p-multiselect-label {\n display: flex;\n align-items: center;\n gap: calc(").concat(dt("multiselect.padding.y"), " / 2);\n white-space: nowrap;\n cursor: pointer;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: ").concat(dt("multiselect.padding.y"), " ").concat(dt("multiselect.padding.x"), ";\n color: ").concat(dt("multiselect.color"), ";\n}\n\n.p-multiselect-label.p-placeholder {\n color: ").concat(dt("multiselect.placeholder.color"), ";\n}\n\n.p-multiselect.p-invalid .p-multiselect-label.p-placeholder {\n color: ").concat(dt("multiselect.invalid.placeholder.color"), ";\n}\n\n.p-multiselect.p-disabled .p-multiselect-label {\n color: ").concat(dt("multiselect.disabled.color"), ";\n}\n\n.p-multiselect-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\n\n.p-multiselect .p-multiselect-overlay {\n min-width: 100%;\n}\n\n.p-multiselect-overlay {\n position: absolute;\n top: 0;\n left: 0;\n background: ").concat(dt("multiselect.overlay.background"), ";\n color: ").concat(dt("multiselect.overlay.color"), ";\n border: 1px solid ").concat(dt("multiselect.overlay.border.color"), ";\n border-radius: ").concat(dt("multiselect.overlay.border.radius"), ";\n box-shadow: ").concat(dt("multiselect.overlay.shadow"), ";\n}\n\n.p-multiselect-header {\n display: flex;\n align-items: center;\n padding: ").concat(dt("multiselect.list.header.padding"), ";\n}\n\n.p-multiselect-header .p-checkbox {\n margin-inline-end: ").concat(dt("multiselect.option.gap"), ";\n}\n\n.p-multiselect-filter-container {\n flex: 1 1 auto;\n}\n\n.p-multiselect-filter {\n width: 100%;\n}\n\n.p-multiselect-list-container {\n overflow: auto;\n}\n\n.p-multiselect-list {\n margin: 0;\n padding: 0;\n list-style-type: none;\n padding: ").concat(dt("multiselect.list.padding"), ";\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("multiselect.list.gap"), ";\n}\n\n.p-multiselect-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 gap: ").concat(dt("multiselect.option.gap"), ";\n padding: ").concat(dt("multiselect.option.padding"), ";\n border: 0 none;\n color: ").concat(dt("multiselect.option.color"), ";\n background: transparent;\n transition: background ").concat(dt("multiselect.transition.duration"), ", color ").concat(dt("multiselect.transition.duration"), ", border-color ").concat(dt("multiselect.transition.duration"), ", box-shadow ").concat(dt("multiselect.transition.duration"), ", outline-color ").concat(dt("multiselect.transition.duration"), ";\n border-radius: ").concat(dt("multiselect.option.border.radius"), ";\n}\n\n.p-multiselect-option:not(.p-multiselect-option-selected):not(.p-disabled).p-focus {\n background: ").concat(dt("multiselect.option.focus.background"), ";\n color: ").concat(dt("multiselect.option.focus.color"), ";\n}\n\n.p-multiselect-option.p-multiselect-option-selected {\n background: ").concat(dt("multiselect.option.selected.background"), ";\n color: ").concat(dt("multiselect.option.selected.color"), ";\n}\n\n.p-multiselect-option.p-multiselect-option-selected.p-focus {\n background: ").concat(dt("multiselect.option.selected.focus.background"), ";\n color: ").concat(dt("multiselect.option.selected.focus.color"), ";\n}\n\n.p-multiselect-option-group {\n cursor: auto;\n margin: 0;\n padding: ").concat(dt("multiselect.option.group.padding"), ";\n background: ").concat(dt("multiselect.option.group.background"), ";\n color: ").concat(dt("multiselect.option.group.color"), ";\n font-weight: ").concat(dt("multiselect.option.group.font.weight"), ";\n}\n\n.p-multiselect-empty-message {\n padding: ").concat(dt("multiselect.empty.message.padding"), ";\n}\n\n.p-multiselect-label .p-chip {\n padding-block-start: calc(").concat(dt("multiselect.padding.y"), " / 2);\n padding-block-end: calc(").concat(dt("multiselect.padding.y"), " / 2);\n border-radius: ").concat(dt("multiselect.chip.border.radius"), ";\n}\n\n.p-multiselect-label:has(.p-chip) {\n padding: calc(").concat(dt("multiselect.padding.y"), " / 2) calc(").concat(dt("multiselect.padding.x"), " / 2);\n}\n\n.p-multiselect-fluid {\n display: flex;\n width: 100%;\n}\n\n.p-multiselect-sm .p-multiselect-label {\n font-size: ").concat(dt("multiselect.sm.font.size"), ";\n padding-block: ").concat(dt("multiselect.sm.padding.y"), ";\n padding-inline: ").concat(dt("multiselect.sm.padding.x"), ";\n}\n\n.p-multiselect-sm .p-multiselect-dropdown .p-icon {\n font-size: ").concat(dt("multiselect.sm.font.size"), ";\n width: ").concat(dt("multiselect.sm.font.size"), ";\n height: ").concat(dt("multiselect.sm.font.size"), ";\n}\n\n.p-multiselect-lg .p-multiselect-label {\n font-size: ").concat(dt("multiselect.lg.font.size"), ";\n padding-block: ").concat(dt("multiselect.lg.padding.y"), ";\n padding-inline: ").concat(dt("multiselect.lg.padding.x"), ";\n}\n\n.p-multiselect-lg .p-multiselect-dropdown .p-icon {\n font-size: ").concat(dt("multiselect.lg.font.size"), ";\n width: ").concat(dt("multiselect.lg.font.size"), ";\n height: ").concat(dt("multiselect.lg.font.size"), ";\n}\n"); }, "theme"); var inlineStyles$5 = { - root: /* @__PURE__ */ __name(function root20(_ref2) { + root: /* @__PURE__ */ __name(function root19(_ref2) { var props = _ref2.props; return { position: props.appendTo === "self" ? "relative" : void 0 @@ -13772,7 +13389,7 @@ var inlineStyles$5 = { }, "root") }; var classes$h = { - root: /* @__PURE__ */ __name(function root21(_ref3) { + root: /* @__PURE__ */ __name(function root20(_ref3) { var instance = _ref3.instance, props = _ref3.props; return ["p-multiselect p-component p-inputwrapper", { "p-multiselect-display-chip": props.display === "chip", @@ -13828,7 +13445,7 @@ var MultiSelectStyle = BaseStyle.extend({ }); var script$1$h = { name: "BaseMultiSelect", - "extends": script$1n, + "extends": script$1k, props: { options: Array, optionLabel: null, @@ -13999,7 +13616,7 @@ var script$1$h = { } }, style: MultiSelectStyle, - provide: /* @__PURE__ */ __name(function provide34() { + provide: /* @__PURE__ */ __name(function provide33() { return { $pcMultiSelect: this, $parentInstance: this @@ -14108,7 +13725,7 @@ var script$v = { searchTimeout: null, searchValue: "", selectOnFocus: false, - data: /* @__PURE__ */ __name(function data22() { + data: /* @__PURE__ */ __name(function data21() { return { id: this.$attrs.id, clicked: false, @@ -14130,7 +13747,7 @@ var script$v = { this.id = this.id || UniqueComponentId(); this.autoUpdateModel(); }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount10() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount9() { this.unbindOutsideClickListener(); this.unbindResizeListener(); if (this.scrollHandler) { @@ -14198,7 +13815,7 @@ var script$v = { this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : this.findSelectedOptionIndex(); isFocus && focus(this.$refs.focusInput); }, "show"), - hide: /* @__PURE__ */ __name(function hide5(isFocus) { + hide: /* @__PURE__ */ __name(function hide4(isFocus) { var _this2 = this; var _hide = /* @__PURE__ */ __name(function _hide2() { _this2.$emit("before-hide"); @@ -14570,7 +14187,7 @@ var script$v = { absolutePosition(this.overlay, this.$el); } }, "alignOverlay"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener6() { + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener5() { var _this6 = this; if (!this.outsideClickListener) { this.outsideClickListener = function(event2) { @@ -14581,7 +14198,7 @@ var script$v = { document.addEventListener("click", this.outsideClickListener); } }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener6() { + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener5() { if (this.outsideClickListener) { document.removeEventListener("click", this.outsideClickListener); this.outsideClickListener = null; @@ -14620,7 +14237,7 @@ var script$v = { this.resizeListener = null; } }, "unbindResizeListener"), - isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked3(event2) { + isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked2(event2) { return !(this.$el.isSameNode(event2.target) || this.$el.contains(event2.target) || this.overlay && this.overlay.contains(event2.target)); }, "isOutsideClicked"), getLabelByValue: /* @__PURE__ */ __name(function getLabelByValue(value2) { @@ -14871,9 +14488,9 @@ var script$v = { overlayRef: /* @__PURE__ */ __name(function overlayRef3(el) { this.overlay = el; }, "overlayRef"), - listRef: /* @__PURE__ */ __name(function listRef2(el, contentRef2) { + listRef: /* @__PURE__ */ __name(function listRef2(el, contentRef) { this.list = el; - contentRef2 && contentRef2(el); + contentRef && contentRef(el); }, "listRef"), virtualScrollerRef: /* @__PURE__ */ __name(function virtualScrollerRef(el) { this.virtualScroller = el; @@ -14992,18 +14609,18 @@ var script$v = { ripple: Ripple }, components: { - InputText: script$1o, - Checkbox: script$1J, - VirtualScroller: script$1K, - Portal: script$1f, - Chip: script$1t, - IconField: script$1L, - InputIcon: script$1M, - TimesIcon: script$1g, - SearchIcon: script$1N, - ChevronDownIcon: script$1k, - SpinnerIcon: script$1r, - CheckIcon: script$1D + InputText: script$1l, + Checkbox: script$1I, + VirtualScroller: script$1J, + Portal: script$1m, + Chip: script$1s, + IconField: script$1K, + InputIcon: script$1L, + TimesIcon: script$1q, + SearchIcon: script$1M, + ChevronDownIcon: script$1h, + SpinnerIcon: script$1p, + CheckIcon: script$1C } }; function _typeof$e(o) { @@ -15306,10 +14923,10 @@ function render$r(_ctx, _cache, $props, $setup, $data, $options) { pt: _ctx.ptm("virtualScroller") }), createSlots({ content: withCtx(function(_ref2) { - var styleClass = _ref2.styleClass, contentRef2 = _ref2.contentRef, items2 = _ref2.items, getItemOptions = _ref2.getItemOptions, contentStyle = _ref2.contentStyle, itemSize = _ref2.itemSize; + var styleClass = _ref2.styleClass, contentRef = _ref2.contentRef, items2 = _ref2.items, getItemOptions = _ref2.getItemOptions, contentStyle = _ref2.contentStyle, itemSize = _ref2.itemSize; return [createBaseVNode("ul", mergeProps({ ref: /* @__PURE__ */ __name(function ref2(el) { - return $options.listRef(el, contentRef2); + return $options.listRef(el, contentRef); }, "ref"), id: $data.id + "_list", "class": [_ctx.cx("list"), styleClass], @@ -15455,7 +15072,7 @@ __name(render$r, "render$r"); script$v.render = render$r; var script$u = { name: "AngleDoubleDownIcon", - "extends": script$1m + "extends": script$1j }; function render$q(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ @@ -15475,7 +15092,7 @@ __name(render$q, "render$q"); script$u.render = render$q; var script$t = { name: "AngleDoubleUpIcon", - "extends": script$1m + "extends": script$1j }; function render$p(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ @@ -15493,7 +15110,7 @@ function render$p(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$p, "render$p"); script$t.render = render$p; -var theme$f = /* @__PURE__ */ __name(function theme25(_ref) { +var theme$f = /* @__PURE__ */ __name(function theme24(_ref) { var dt = _ref.dt; return "\n.p-orderlist {\n display: flex;\n gap: ".concat(dt("orderlist.gap"), ";\n}\n\n.p-orderlist-controls {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: ").concat(dt("orderlist.controls.gap"), ";\n}\n"); }, "theme"); @@ -15508,7 +15125,7 @@ var OrderListStyle = BaseStyle.extend({ }); var script$1$g = { name: "BaseOrderList", - "extends": script$1d, + "extends": script$1f, props: { modelValue: { type: Array, @@ -15556,7 +15173,7 @@ var script$1$g = { }, buttonProps: { type: Object, - "default": /* @__PURE__ */ __name(function _default13() { + "default": /* @__PURE__ */ __name(function _default12() { return { severity: "secondary" }; @@ -15596,7 +15213,7 @@ var script$1$g = { } }, style: OrderListStyle, - provide: /* @__PURE__ */ __name(function provide35() { + provide: /* @__PURE__ */ __name(function provide34() { return { $pcOrderList: this, $parentInstance: this @@ -15642,7 +15259,7 @@ var script$s = { reorderDirection: null, styleElement: null, list: null, - data: /* @__PURE__ */ __name(function data23() { + data: /* @__PURE__ */ __name(function data22() { return { id: this.$attrs.id, d_selection: this.selection @@ -15653,10 +15270,10 @@ var script$s = { this.id = newValue || UniqueComponentId(); }, "$attrsId") }, - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount11() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount10() { this.destroyStyle(); }, "beforeUnmount"), - updated: /* @__PURE__ */ __name(function updated6() { + updated: /* @__PURE__ */ __name(function updated5() { if (this.reorderDirection) { this.updateListScroll(); this.reorderDirection = null; @@ -15825,10 +15442,10 @@ var script$s = { }, "hasSelectedOption") }, components: { - Listbox: script$1O, - Button: script$1e, - AngleUpIcon: script$1P, - AngleDownIcon: script$1H, + Listbox: script$1N, + Button: script$1d, + AngleUpIcon: script$1O, + AngleDownIcon: script$1G, AngleDoubleUpIcon: script$t, AngleDoubleDownIcon: script$u }, @@ -16006,7 +15623,7 @@ function render$o(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$o, "render$o"); script$s.render = render$o; -var theme$e = /* @__PURE__ */ __name(function theme26(_ref) { +var theme$e = /* @__PURE__ */ __name(function theme25(_ref) { var dt = _ref.dt; return "\n.p-organizationchart-table {\n border-spacing: 0;\n border-collapse: separate;\n margin: 0 auto;\n}\n\n.p-organizationchart-table > tbody > tr > td {\n text-align: center;\n vertical-align: top;\n padding: 0 ".concat(dt("organizationchart.gutter"), ";\n}\n\n.p-organizationchart-node {\n display: inline-block;\n position: relative;\n border: 1px solid ").concat(dt("organizationchart.node.border.color"), ";\n background: ").concat(dt("organizationchart.node.background"), ";\n color: ").concat(dt("organizationchart.node.color"), ";\n padding: ").concat(dt("organizationchart.node.padding"), ";\n border-radius: ").concat(dt("organizationchart.node.border.radius"), ";\n transition: background ").concat(dt("organizationchart.transition.duration"), ", border-color ").concat(dt("organizationchart.transition.duration"), ", color ").concat(dt("organizationchart.transition.duration"), ", box-shadow ").concat(dt("organizationchart.transition.duration"), ";\n}\n\n.p-organizationchart-node:has(.p-organizationchart-node-toggle-button) {\n padding: ").concat(dt("organizationchart.node.toggleable.padding"), ";\n}\n\n.p-organizationchart-node.p-organizationchart-node-selectable:not(.p-organizationchart-node-selected):hover {\n background: ").concat(dt("organizationchart.node.hover.background"), ";\n color: ").concat(dt("organizationchart.node.hover.color"), ";\n}\n\n.p-organizationchart-node-selected {\n background: ").concat(dt("organizationchart.node.selected.background"), ";\n color: ").concat(dt("organizationchart.node.selected.color"), ";\n}\n\n.p-organizationchart-node-toggle-button {\n position: absolute;\n inset-block-end: calc(-1 * calc(").concat(dt("organizationchart.node.toggle.button.size"), " / 2));\n margin-inline-start: calc(-1 * calc(").concat(dt("organizationchart.node.toggle.button.size"), " / 2));\n z-index: 2;\n inset-inline-start: 50%;\n user-select: none;\n cursor: pointer;\n width: ").concat(dt("organizationchart.node.toggle.button.size"), ";\n height: ").concat(dt("organizationchart.node.toggle.button.size"), ";\n text-decoration: none;\n background: ").concat(dt("organizationchart.node.toggle.button.background"), ";\n color: ").concat(dt("organizationchart.node.toggle.button.color"), ";\n border-radius: ").concat(dt("organizationchart.node.toggle.button.border.radius"), ";\n border: 1px solid ").concat(dt("organizationchart.node.toggle.button.border.color"), ";\n display: inline-flex;\n justify-content: center;\n align-items: center;\n outline-color: transparent;\n transition: background ").concat(dt("organizationchart.transition.duration"), ", color ").concat(dt("organizationchart.transition.duration"), ", border-color ").concat(dt("organizationchart.transition.duration"), ", outline-color ").concat(dt("organizationchart.transition.duration"), ", box-shadow ").concat(dt("organizationchart.transition.duration"), ";\n}\n\n.p-organizationchart-node-toggle-button:hover {\n background: ").concat(dt("organizationchart.node.toggle.button.hover.background"), ";\n color: ").concat(dt("organizationchart.node.toggle.button.hover.color"), ";\n}\n\n.p-organizationchart-node-toggle-button:focus-visible {\n box-shadow: ").concat(dt("breadcrumb.item.focus.ring.shadow"), ";\n outline: ").concat(dt("breadcrumb.item.focus.ring.width"), " ").concat(dt("breadcrumb.item.focus.ring.style"), " ").concat(dt("breadcrumb.item.focus.ring.color"), ";\n outline-offset: ").concat(dt("breadcrumb.item.focus.ring.offset"), ";\n}\n\n.p-organizationchart-node-toggle-button-icon {\n position: relative;\n inset-block-start: 1px;\n}\n\n.p-organizationchart-connector-down {\n margin: 0 auto;\n height: ").concat(dt("organizationchart.connector.height"), ";\n width: 1px;\n background: ").concat(dt("organizationchart.connector.color"), ";\n}\n\n.p-organizationchart-connector-right {\n border-radius: 0;\n}\n\n.p-organizationchart-connector-left {\n border-radius: 0;\n border-inline-end: 1px solid ").concat(dt("organizationchart.connector.color"), ";\n}\n\n.p-organizationchart-connector-top {\n border-block-start: 1px solid ").concat(dt("organizationchart.connector.color"), ";\n}\n\n.p-organizationchart-node-selectable {\n cursor: pointer;\n}\n\n.p-organizationchart-connectors :nth-child(1 of .p-organizationchart-connector-left) {\n border-inline-end: 0 none;\n}\n\n.p-organizationchart-connectors :nth-last-child(1 of .p-organizationchart-connector-left) {\n border-start-end-radius: ").concat(dt("organizationchart.connector.border.radius"), ";\n}\n\n.p-organizationchart-connectors :nth-child(1 of .p-organizationchart-connector-right) {\n border-inline-start: 1px solid ").concat(dt("organizationchart.connector.color"), ";\n border-start-start-radius: ").concat(dt("organizationchart.connector.border.radius"), ";\n}\n"); }, "theme"); @@ -16045,7 +15662,7 @@ var OrganizationChartStyle = BaseStyle.extend({ }); var script$2$2 = { name: "BaseOrganizationChart", - "extends": script$1d, + "extends": script$1f, props: { value: { type: null, @@ -16069,7 +15686,7 @@ var script$2$2 = { } }, style: OrganizationChartStyle, - provide: /* @__PURE__ */ __name(function provide36() { + provide: /* @__PURE__ */ __name(function provide35() { return { $pcOrganizationChart: this, $parentInstance: this @@ -16079,7 +15696,7 @@ var script$2$2 = { var script$1$f = { name: "OrganizationChartNode", hostName: "OrganizationChart", - "extends": script$1d, + "extends": script$1f, emits: ["node-click", "node-toggle"], props: { node: { @@ -16143,7 +15760,7 @@ var script$1$f = { onChildNodeToggle: /* @__PURE__ */ __name(function onChildNodeToggle(node2) { this.$emit("node-toggle", node2); }, "onChildNodeToggle"), - onKeydown: /* @__PURE__ */ __name(function onKeydown4(event2) { + onKeydown: /* @__PURE__ */ __name(function onKeydown3(event2) { if (event2.code === "Enter" || event2.code === "NumpadEnter" || event2.code === "Space") { this.toggleNode(); event2.preventDefault(); @@ -16176,8 +15793,8 @@ var script$1$f = { }, "toggleable") }, components: { - ChevronDownIcon: script$1k, - ChevronUpIcon: script$1j + ChevronDownIcon: script$1h, + ChevronUpIcon: script$1g } }; var _hoisted_1$e = ["colspan"]; @@ -16327,7 +15944,7 @@ var script$r = { "extends": script$2$2, inheritAttrs: false, emits: ["node-unselect", "node-select", "update:selectionKeys", "node-expand", "node-collapse", "update:collapsedKeys"], - data: /* @__PURE__ */ __name(function data24() { + data: /* @__PURE__ */ __name(function data23() { return { d_collapsedKeys: this.collapsedKeys || {} }; @@ -16393,7 +16010,7 @@ __name(render$n, "render$n"); script$r.render = render$n; var script$q = { name: "OverlayPanel", - "extends": script$1Q, + "extends": script$1P, mounted: /* @__PURE__ */ __name(function mounted25() { console.warn("Deprecated since v4. Use Popover component instead."); }, "mounted") @@ -16401,7 +16018,7 @@ var script$q = { var OverlayPanelStyle = BaseStyle.extend({ name: "overlaypanel" }); -var theme$d = /* @__PURE__ */ __name(function theme27(_ref) { +var theme$d = /* @__PURE__ */ __name(function theme26(_ref) { var dt = _ref.dt; return "\n.p-panelmenu {\n display: flex;\n flex-direction: column;\n gap: ".concat(dt("panelmenu.gap"), ";\n}\n\n.p-panelmenu-panel {\n background: ").concat(dt("panelmenu.panel.background"), ";\n border-width: ").concat(dt("panelmenu.panel.border.width"), ";\n border-style: solid;\n border-color: ").concat(dt("panelmenu.panel.border.color"), ";\n color: ").concat(dt("panelmenu.panel.color"), ";\n border-radius: ").concat(dt("panelmenu.panel.border.radius"), ";\n padding: ").concat(dt("panelmenu.panel.padding"), ";\n}\n\n.p-panelmenu-panel:first-child {\n border-width: ").concat(dt("panelmenu.panel.first.border.width"), ";\n border-start-start-radius: ").concat(dt("panelmenu.panel.first.top.border.radius"), ";\n border-start-end-radius: ").concat(dt("panelmenu.panel.first.top.border.radius"), ";\n}\n\n.p-panelmenu-panel:last-child {\n border-width: ").concat(dt("panelmenu.panel.last.border.width"), ";\n border-end-start-radius: ").concat(dt("panelmenu.panel.last.bottom.border.radius"), ";\n border-end-end-radius: ").concat(dt("panelmenu.panel.last.bottom.border.radius"), ";\n}\n\n.p-panelmenu-header {\n outline: 0 none;\n}\n\n.p-panelmenu-header-content {\n border-radius: ").concat(dt("panelmenu.item.border.radius"), ";\n transition: background ").concat(dt("panelmenu.transition.duration"), ", color ").concat(dt("panelmenu.transition.duration"), ", outline-color ").concat(dt("panelmenu.transition.duration"), ", box-shadow ").concat(dt("panelmenu.transition.duration"), ";\n outline-color: transparent;\n color: ").concat(dt("panelmenu.item.color"), ";\n}\n\n.p-panelmenu-header-link {\n display: flex;\n gap: ").concat(dt("panelmenu.item.gap"), ";\n padding: ").concat(dt("panelmenu.item.padding"), ";\n align-items: center;\n user-select: none;\n cursor: pointer;\n position: relative;\n text-decoration: none;\n color: inherit;\n}\n\n.p-panelmenu-header-icon,\n.p-panelmenu-item-icon {\n color: ").concat(dt("panelmenu.item.icon.color"), ";\n}\n\n.p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.color"), ";\n}\n\n.p-panelmenu-submenu-icon:dir(rtl) {\n transform: rotate(180deg);\n}\n\n.p-panelmenu-header:not(.p-disabled):focus-visible .p-panelmenu-header-content {\n background: ").concat(dt("panelmenu.item.focus.background"), ";\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled):focus-visible .p-panelmenu-header-content .p-panelmenu-header-icon {\n color: ").concat(dt("panelmenu.item.icon.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled):focus-visible .p-panelmenu-header-content .p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled) .p-panelmenu-header-content:hover {\n background: ").concat(dt("panelmenu.item.focus.background"), ";\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled) .p-panelmenu-header-content:hover .p-panelmenu-header-icon {\n color: ").concat(dt("panelmenu.item.icon.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled) .p-panelmenu-header-content:hover .p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.focus.color"), ";\n}\n\n.p-panelmenu-submenu {\n margin: 0;\n padding: 0 0 0 ").concat(dt("panelmenu.submenu.indent"), ";\n outline: 0;\n list-style: none;\n}\n\n.p-panelmenu-submenu:dir(rtl) {\n padding: 0 ").concat(dt("panelmenu.submenu.indent"), " 0 0;\n}\n\n.p-panelmenu-item-link {\n display: flex;\n gap: ").concat(dt("panelmenu.item.gap"), ";\n padding: ").concat(dt("panelmenu.item.padding"), ";\n align-items: center;\n user-select: none;\n cursor: pointer;\n text-decoration: none;\n color: inherit;\n position: relative;\n overflow: hidden;\n}\n\n.p-panelmenu-item-label {\n line-height: 1;\n}\n\n.p-panelmenu-item-content {\n border-radius: ").concat(dt("panelmenu.item.border.radius"), ";\n transition: background ").concat(dt("panelmenu.transition.duration"), ", color ").concat(dt("panelmenu.transition.duration"), ", outline-color ").concat(dt("panelmenu.transition.duration"), ", box-shadow ").concat(dt("panelmenu.transition.duration"), ";\n color: ").concat(dt("panelmenu.item.color"), ";\n outline-color: transparent;\n}\n\n.p-panelmenu-item.p-focus > .p-panelmenu-item-content {\n background: ").concat(dt("panelmenu.item.focus.background"), ";\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-item.p-focus > .p-panelmenu-item-content .p-panelmenu-item-icon {\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-item.p-focus > .p-panelmenu-item-content .p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.focus.color"), ";\n}\n\n.p-panelmenu-item:not(.p-disabled) > .p-panelmenu-item-content:hover {\n background: ").concat(dt("panelmenu.item.focus.background"), ";\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-item:not(.p-disabled) > .p-panelmenu-item-content:hover .p-panelmenu-item-icon {\n color: ").concat(dt("panelmenu.item.icon.focus.color"), ";\n}\n\n.p-panelmenu-item:not(.p-disabled) > .p-panelmenu-item-content:hover .p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.focus.color"), ";\n}\n"); }, "theme"); @@ -16444,7 +16061,7 @@ var PanelMenuStyle = BaseStyle.extend({ }); var script$3$1 = { name: "BasePanelMenu", - "extends": script$1d, + "extends": script$1f, props: { model: { type: Array, @@ -16464,7 +16081,7 @@ var script$3$1 = { } }, style: PanelMenuStyle, - provide: /* @__PURE__ */ __name(function provide37() { + provide: /* @__PURE__ */ __name(function provide36() { return { $pcPanelMenu: this, $parentInstance: this @@ -16474,7 +16091,7 @@ var script$3$1 = { var script$2$1 = { name: "PanelMenuSub", hostName: "PanelMenu", - "extends": script$1d, + "extends": script$1f, emits: ["item-toggle", "item-mousemove"], props: { panelId: { @@ -16597,8 +16214,8 @@ var script$2$1 = { }, "getMenuItemProps") }, components: { - ChevronRightIcon: script$1l, - ChevronDownIcon: script$1k + ChevronRightIcon: script$1i, + ChevronDownIcon: script$1h }, directives: { ripple: Ripple @@ -16768,7 +16385,7 @@ __name(_arrayWithHoles, "_arrayWithHoles"); var script$1$e = { name: "PanelMenuList", hostName: "PanelMenu", - "extends": script$1d, + "extends": script$1f, emits: ["item-toggle", "header-focus"], props: { panelId: { @@ -16790,7 +16407,7 @@ var script$1$e = { }, searchTimeout: null, searchValue: null, - data: /* @__PURE__ */ __name(function data25() { + data: /* @__PURE__ */ __name(function data24() { return { focused: false, focusedItem: null, @@ -17242,7 +16859,7 @@ var script$p = { "extends": script$3$1, inheritAttrs: false, emits: ["update:expandedKeys", "panel-open", "panel-close"], - data: /* @__PURE__ */ __name(function data26() { + data: /* @__PURE__ */ __name(function data25() { return { id: this.$attrs.id, activeItem: null, @@ -17444,8 +17061,8 @@ var script$p = { }, components: { PanelMenuList: script$1$e, - ChevronRightIcon: script$1l, - ChevronDownIcon: script$1k + ChevronRightIcon: script$1i, + ChevronDownIcon: script$1h } }; var _hoisted_1$d = ["id"]; @@ -17479,7 +17096,7 @@ function render$m(_ctx, _cache, $props, $setup, $data, $options) { onClick: /* @__PURE__ */ __name(function onClick11($event) { return $options.onHeaderClick($event, item8); }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown6($event) { + onKeydown: /* @__PURE__ */ __name(function onKeydown5($event) { return $options.onHeaderKeyDown($event, item8); }, "onKeydown"), ref_for: true @@ -17556,7 +17173,7 @@ __name(render$m, "render$m"); script$p.render = render$m; var script$o = { name: "EyeSlashIcon", - "extends": script$1m + "extends": script$1j }; function render$l(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ @@ -17574,12 +17191,12 @@ function render$l(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$l, "render$l"); script$o.render = render$l; -var theme$c = /* @__PURE__ */ __name(function theme28(_ref) { +var theme$c = /* @__PURE__ */ __name(function theme27(_ref) { var dt = _ref.dt; return "\n.p-password {\n display: inline-flex;\n position: relative;\n}\n\n.p-password .p-password-overlay {\n min-width: 100%;\n}\n\n.p-password-meter {\n height: ".concat(dt("password.meter.height"), ";\n background: ").concat(dt("password.meter.background"), ";\n border-radius: ").concat(dt("password.meter.border.radius"), ";\n}\n\n.p-password-meter-label {\n height: 100%;\n width: 0;\n transition: width 1s ease-in-out;\n border-radius: ").concat(dt("password.meter.border.radius"), ";\n}\n\n.p-password-meter-weak {\n background: ").concat(dt("password.strength.weak.background"), ";\n}\n\n.p-password-meter-medium {\n background: ").concat(dt("password.strength.medium.background"), ";\n}\n\n.p-password-meter-strong {\n background: ").concat(dt("password.strength.strong.background"), ";\n}\n\n.p-password-fluid {\n display: flex;\n}\n\n.p-password-fluid .p-password-input {\n width: 100%;\n}\n\n.p-password-input::-ms-reveal,\n.p-password-input::-ms-clear {\n display: none;\n}\n\n.p-password-overlay {\n padding: ").concat(dt("password.overlay.padding"), ";\n background: ").concat(dt("password.overlay.background"), ";\n color: ").concat(dt("password.overlay.color"), ";\n border: 1px solid ").concat(dt("password.overlay.border.color"), ";\n box-shadow: ").concat(dt("password.overlay.shadow"), ";\n border-radius: ").concat(dt("password.overlay.border.radius"), ";\n}\n\n.p-password-content {\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("password.content.gap"), ";\n}\n\n.p-password-toggle-mask-icon {\n inset-inline-end: ").concat(dt("form.field.padding.x"), ";\n color: ").concat(dt("password.icon.color"), ";\n position: absolute;\n top: 50%;\n margin-top: calc(-1 * calc(").concat(dt("icon.size"), " / 2));\n width: ").concat(dt("icon.size"), ";\n height: ").concat(dt("icon.size"), ";\n}\n\n.p-password:has(.p-password-toggle-mask-icon) .p-password-input {\n padding-inline-end: calc((").concat(dt("form.field.padding.x"), " * 2) + ").concat(dt("icon.size"), ");\n}\n"); }, "theme"); var inlineStyles$4 = { - root: /* @__PURE__ */ __name(function root22(_ref2) { + root: /* @__PURE__ */ __name(function root21(_ref2) { var props = _ref2.props; return { position: props.appendTo === "self" ? "relative" : void 0 @@ -17587,7 +17204,7 @@ var inlineStyles$4 = { }, "root") }; var classes$d = { - root: /* @__PURE__ */ __name(function root23(_ref3) { + root: /* @__PURE__ */ __name(function root22(_ref3) { var instance = _ref3.instance; return ["p-password p-component p-inputwrapper", { "p-inputwrapper-filled": instance.$filled, @@ -17615,7 +17232,7 @@ var PasswordStyle = BaseStyle.extend({ }); var script$1$d = { name: "BasePassword", - "extends": script$1n, + "extends": script$1k, props: { promptLabel: { type: String, @@ -17745,7 +17362,7 @@ var script$1$d = { } }, style: PasswordStyle, - provide: /* @__PURE__ */ __name(function provide38() { + provide: /* @__PURE__ */ __name(function provide37() { return { $pcPassword: this, $parentInstance: this @@ -17762,7 +17379,7 @@ var script$n = { "default": null } }, - data: /* @__PURE__ */ __name(function data27() { + data: /* @__PURE__ */ __name(function data26() { return { id: this.$attrs.id, overlayVisible: false, @@ -17788,7 +17405,7 @@ var script$n = { this.mediumCheckRegExp = new RegExp(this.mediumRegex); this.strongCheckRegExp = new RegExp(this.strongRegex); }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount12() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount11() { this.unbindResizeListener(); if (this.scrollHandler) { this.scrollHandler.destroy(); @@ -17986,8 +17603,8 @@ var script$n = { }, "overlayUniqueId") }, components: { - InputText: script$1o, - Portal: script$1f, + InputText: script$1l, + Portal: script$1m, EyeSlashIcon: script$o, EyeIcon: script$N } @@ -18144,7 +17761,7 @@ function render$k(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$k, "render$k"); script$n.render = render$k; -var theme$b = /* @__PURE__ */ __name(function theme29(_ref) { +var theme$b = /* @__PURE__ */ __name(function theme28(_ref) { var dt = _ref.dt; return "\n.p-picklist {\n display: flex;\n gap: ".concat(dt("picklist.gap"), ";\n}\n\n.p-picklist-controls {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: ").concat(dt("picklist.controls.gap"), ";\n}\n\n.p-picklist-list-container {\n flex: 1 1 50%;\n}\n\n.p-picklist .p-listbox {\n height: 100%;\n}\n"); }, "theme"); @@ -18163,17 +17780,17 @@ var PickListStyle = BaseStyle.extend({ }); var script$1$c = { name: "BasePickList", - "extends": script$1d, + "extends": script$1f, props: { modelValue: { type: Array, - "default": /* @__PURE__ */ __name(function _default14() { + "default": /* @__PURE__ */ __name(function _default13() { return [[], []]; }, "_default") }, selection: { type: Array, - "default": /* @__PURE__ */ __name(function _default15() { + "default": /* @__PURE__ */ __name(function _default14() { return [[], []]; }, "_default") }, @@ -18223,7 +17840,7 @@ var script$1$c = { }, buttonProps: { type: Object, - "default": /* @__PURE__ */ __name(function _default16() { + "default": /* @__PURE__ */ __name(function _default15() { return { severity: "secondary" }; @@ -18271,7 +17888,7 @@ var script$1$c = { } }, style: PickListStyle, - provide: /* @__PURE__ */ __name(function provide39() { + provide: /* @__PURE__ */ __name(function provide38() { return { $pcPickList: this, $parentInstance: this @@ -18318,7 +17935,7 @@ var script$m = { styleElement: null, media: null, mediaChangeListener: null, - data: /* @__PURE__ */ __name(function data28() { + data: /* @__PURE__ */ __name(function data27() { return { id: this.$attrs.id, d_selection: this.selection, @@ -18337,14 +17954,14 @@ var script$m = { this.initMedia(); }, "breakpoint") }, - updated: /* @__PURE__ */ __name(function updated7() { + updated: /* @__PURE__ */ __name(function updated6() { if (this.reorderDirection) { this.updateListScroll(this.$refs.sourceList.$el); this.updateListScroll(this.$refs.targetList.$el); this.reorderDirection = null; } }, "updated"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount13() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount12() { this.destroyStyle(); this.destroyMedia(); }, "beforeUnmount"), @@ -18696,14 +18313,14 @@ var script$m = { }, "moveAllToSourceAriaLabel") }, components: { - Listbox: script$1O, - Button: script$1e, - AngleRightIcon: script$1q, - AngleLeftIcon: script$1R, - AngleDownIcon: script$1H, - AngleUpIcon: script$1P, - AngleDoubleRightIcon: script$1S, - AngleDoubleLeftIcon: script$1T, + Listbox: script$1N, + Button: script$1d, + AngleRightIcon: script$1o, + AngleLeftIcon: script$1Q, + AngleDownIcon: script$1G, + AngleUpIcon: script$1O, + AngleDoubleRightIcon: script$1R, + AngleDoubleLeftIcon: script$1S, AngleDoubleDownIcon: script$u, AngleDoubleUpIcon: script$t }, @@ -19111,7 +18728,7 @@ script$m.render = render$j; var PortalStyle = BaseStyle.extend({ name: "portal" }); -var theme$a = /* @__PURE__ */ __name(function theme30(_ref) { +var theme$a = /* @__PURE__ */ __name(function theme29(_ref) { _ref.dt; return "\n.p-radiobutton-group {\n display: inline-flex;\n}\n"; }, "theme"); @@ -19125,9 +18742,9 @@ var RadioButtonGroupStyle = BaseStyle.extend({ }); var script$1$b = { name: "BaseRadioButtonGroup", - "extends": script$1s, + "extends": script$1r, style: RadioButtonGroupStyle, - provide: /* @__PURE__ */ __name(function provide40() { + provide: /* @__PURE__ */ __name(function provide39() { return { $pcRadioButtonGroup: this, $parentInstance: this @@ -19138,7 +18755,7 @@ var script$l = { name: "RadioButtonGroup", "extends": script$1$b, inheritAttrs: false, - data: /* @__PURE__ */ __name(function data29() { + data: /* @__PURE__ */ __name(function data28() { return { groupName: this.name }; @@ -19161,7 +18778,7 @@ __name(render$i, "render$i"); script$l.render = render$i; var script$k = { name: "BanIcon", - "extends": script$1m + "extends": script$1j }; function render$h(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ @@ -19179,7 +18796,7 @@ __name(render$h, "render$h"); script$k.render = render$h; var script$j = { name: "StarIcon", - "extends": script$1m + "extends": script$1j }; function render$g(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ @@ -19197,7 +18814,7 @@ __name(render$g, "render$g"); script$j.render = render$g; var script$i = { name: "StarFillIcon", - "extends": script$1m + "extends": script$1j }; function render$f(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps({ @@ -19213,12 +18830,12 @@ function render$f(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$f, "render$f"); script$i.render = render$f; -var theme$9 = /* @__PURE__ */ __name(function theme31(_ref) { +var theme$9 = /* @__PURE__ */ __name(function theme30(_ref) { var dt = _ref.dt; return "\n.p-rating {\n position: relative;\n display: flex;\n align-items: center;\n gap: ".concat(dt("rating.gap"), ";\n}\n\n.p-rating-option {\n display: inline-flex;\n align-items: center;\n cursor: pointer;\n outline-color: transparent;\n border-radius: 50%;\n transition: background ").concat(dt("rating.transition.duration"), ", color ").concat(dt("rating.transition.duration"), ", border-color ").concat(dt("rating.transition.duration"), ", outline-color ").concat(dt("rating.transition.duration"), ", box-shadow ").concat(dt("rating.transition.duration"), ";\n}\n\n.p-rating-option.p-focus-visible {\n box-shadow: ").concat(dt("rating.focus.ring.shadow"), ";\n outline: ").concat(dt("rating.focus.ring.width"), " ").concat(dt("rating.focus.ring.style"), " ").concat(dt("rating.focus.ring.color"), ";\n outline-offset: ").concat(dt("rating.focus.ring.offset"), ";\n}\n\n.p-rating-icon {\n color: ").concat(dt("rating.icon.color"), ";\n transition: background ").concat(dt("rating.transition.duration"), ", color ").concat(dt("rating.transition.duration"), ", border-color ").concat(dt("rating.transition.duration"), ", outline-color ").concat(dt("rating.transition.duration"), ", box-shadow ").concat(dt("rating.transition.duration"), ";\n font-size: ").concat(dt("rating.icon.size"), ";\n width: ").concat(dt("rating.icon.size"), ";\n height: ").concat(dt("rating.icon.size"), ";\n}\n\n.p-rating:not(.p-disabled):not(.p-readonly) .p-rating-option:hover .p-rating-icon {\n color: ").concat(dt("rating.icon.hover.color"), ";\n}\n\n.p-rating-option-active .p-rating-icon {\n color: ").concat(dt("rating.icon.active.color"), ";\n}\n\n.p-rating-icon.p-invalid { /* @todo */\n stroke: ").concat(dt("rating.invalid.icon.color"), ";\n}\n"); }, "theme"); var classes$a = { - root: /* @__PURE__ */ __name(function root24(_ref2) { + root: /* @__PURE__ */ __name(function root23(_ref2) { var props = _ref2.props; return ["p-rating", { "p-readonly": props.readonly, @@ -19252,7 +18869,7 @@ var RatingStyle = BaseStyle.extend({ }); var script$1$a = { name: "BaseRating", - "extends": script$1s, + "extends": script$1r, props: { readonly: { type: Boolean, @@ -19272,7 +18889,7 @@ var script$1$a = { } }, style: RatingStyle, - provide: /* @__PURE__ */ __name(function provide41() { + provide: /* @__PURE__ */ __name(function provide40() { return { $pcRating: this, $parentInstance: this @@ -19284,7 +18901,7 @@ var script$h = { "extends": script$1$a, inheritAttrs: false, emits: ["change", "focus", "blur"], - data: /* @__PURE__ */ __name(function data30() { + data: /* @__PURE__ */ __name(function data29() { return { d_name: this.name, focusedOptionIndex: -1, @@ -19422,7 +19039,7 @@ __name(render$e, "render$e"); script$h.render = render$e; var script$g = { name: "Row", - "extends": script$1d, + "extends": script$1f, inject: ["$rows"], mounted: /* @__PURE__ */ __name(function mounted32() { var _this$$rows; @@ -19439,12 +19056,12 @@ var script$g = { var RowStyle = BaseStyle.extend({ name: "row" }); -var theme$8 = /* @__PURE__ */ __name(function theme32(_ref) { +var theme$8 = /* @__PURE__ */ __name(function theme31(_ref) { _ref.dt; return "\n.p-scrolltop.p-button {\n position: fixed !important;\n inset-block-end: 20px;\n inset-inline-end: 20px;\n}\n\n.p-scrolltop-sticky.p-button {\n position: sticky !important;\n display: flex;\n margin-inline-start: auto;\n}\n\n.p-scrolltop-enter-from {\n opacity: 0;\n}\n\n.p-scrolltop-enter-active {\n transition: opacity 0.15s;\n}\n\n.p-scrolltop.p-scrolltop-leave-to {\n opacity: 0;\n}\n\n.p-scrolltop-leave-active {\n transition: opacity 0.15s;\n}\n"; }, "theme"); var classes$9 = { - root: /* @__PURE__ */ __name(function root25(_ref2) { + root: /* @__PURE__ */ __name(function root24(_ref2) { var props = _ref2.props; return ["p-scrolltop", { "p-scrolltop-sticky": props.target !== "window" @@ -19459,7 +19076,7 @@ var ScrollTopStyle = BaseStyle.extend({ }); var script$1$9 = { name: "BaseScrollTop", - "extends": script$1d, + "extends": script$1f, props: { target: { type: String, @@ -19479,7 +19096,7 @@ var script$1$9 = { }, buttonProps: { type: Object, - "default": /* @__PURE__ */ __name(function _default17() { + "default": /* @__PURE__ */ __name(function _default16() { return { rounded: true }; @@ -19487,7 +19104,7 @@ var script$1$9 = { } }, style: ScrollTopStyle, - provide: /* @__PURE__ */ __name(function provide42() { + provide: /* @__PURE__ */ __name(function provide41() { return { $pcScrollTop: this, $parentInstance: this @@ -19500,7 +19117,7 @@ var script$f = { inheritAttrs: false, scrollListener: null, container: null, - data: /* @__PURE__ */ __name(function data31() { + data: /* @__PURE__ */ __name(function data30() { return { visible: false }; @@ -19509,7 +19126,7 @@ var script$f = { if (this.target === "window") this.bindDocumentScrollListener(); else if (this.target === "parent") this.bindParentScrollListener(); }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount14() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount13() { if (this.target === "window") this.unbindDocumentScrollListener(); else if (this.target === "parent") this.unbindParentScrollListener(); if (this.container) { @@ -19555,13 +19172,13 @@ var script$f = { this.scrollListener = null; } }, "unbindDocumentScrollListener"), - onEnter: /* @__PURE__ */ __name(function onEnter4(el) { + onEnter: /* @__PURE__ */ __name(function onEnter3(el) { ZIndex.set("overlay", el, this.$primevue.config.zIndex.overlay); }, "onEnter"), - onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave4(el) { + onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave3(el) { ZIndex.clear(el); }, "onAfterLeave"), - containerRef: /* @__PURE__ */ __name(function containerRef5(el) { + containerRef: /* @__PURE__ */ __name(function containerRef4(el) { this.container = el ? el.$el : void 0; }, "containerRef") }, @@ -19571,8 +19188,8 @@ var script$f = { }, "scrollTopAriaLabel") }, components: { - ChevronUpIcon: script$1j, - Button: script$1e + ChevronUpIcon: script$1g, + Button: script$1d } }; function render$d(_ctx, _cache, $props, $setup, $data, $options) { @@ -19613,7 +19230,7 @@ __name(render$d, "render$d"); script$f.render = render$d; var script$e = { name: "Sidebar", - "extends": script$1c, + "extends": script$1T, mounted: /* @__PURE__ */ __name(function mounted34() { console.warn("Deprecated since v4. Use Drawer component instead."); }, "mounted") @@ -19621,7 +19238,7 @@ var script$e = { var SidebarStyle = BaseStyle.extend({ name: "sidebar" }); -var theme$7 = /* @__PURE__ */ __name(function theme33(_ref) { +var theme$7 = /* @__PURE__ */ __name(function theme32(_ref) { var dt = _ref.dt; return "\n.p-skeleton {\n overflow: hidden;\n background: ".concat(dt("skeleton.background"), ";\n border-radius: ").concat(dt("skeleton.border.radius"), ';\n}\n\n.p-skeleton::after {\n content: "";\n animation: p-skeleton-animation 1.2s infinite;\n height: 100%;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n transform: translateX(-100%);\n z-index: 1;\n background: linear-gradient(90deg, rgba(255, 255, 255, 0), ').concat(dt("skeleton.animation.background"), ", rgba(255, 255, 255, 0));\n}\n\n[dir='rtl'] .p-skeleton::after {\n animation-name: p-skeleton-animation-rtl;\n}\n\n.p-skeleton-circle {\n border-radius: 50%;\n}\n\n.p-skeleton-animation-none::after {\n animation: none;\n}\n\n@keyframes p-skeleton-animation {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(100%);\n }\n}\n\n@keyframes p-skeleton-animation-rtl {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(-100%);\n }\n}\n"); }, "theme"); @@ -19631,7 +19248,7 @@ var inlineStyles$3 = { } }; var classes$8 = { - root: /* @__PURE__ */ __name(function root26(_ref2) { + root: /* @__PURE__ */ __name(function root25(_ref2) { var props = _ref2.props; return ["p-skeleton p-component", { "p-skeleton-circle": props.shape === "circle", @@ -19647,7 +19264,7 @@ var SkeletonStyle = BaseStyle.extend({ }); var script$1$8 = { name: "BaseSkeleton", - "extends": script$1d, + "extends": script$1f, props: { shape: { type: String, @@ -19675,7 +19292,7 @@ var script$1$8 = { } }, style: SkeletonStyle, - provide: /* @__PURE__ */ __name(function provide43() { + provide: /* @__PURE__ */ __name(function provide42() { return { $pcSkeleton: this, $parentInstance: this @@ -19739,12 +19356,12 @@ function _toPrimitive$8(t2, r) { return ("string" === r ? String : Number)(t2); } __name(_toPrimitive$8, "_toPrimitive$8"); -var theme$6 = /* @__PURE__ */ __name(function theme34(_ref) { +var theme$6 = /* @__PURE__ */ __name(function theme33(_ref) { var dt = _ref.dt; return "\n.p-speeddial {\n position: static;\n display: flex;\n gap: ".concat(dt("speeddial.gap"), ";\n}\n\n.p-speeddial-button {\n z-index: 1;\n}\n\n.p-speeddial-button.p-speeddial-rotate {\n transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, background ").concat(dt("speeddial.transition.duration"), ", color ").concat(dt("speeddial.transition.duration"), ", border-color ").concat(dt("speeddial.transition.duration"), ",\n box-shadow ").concat(dt("speeddial.transition.duration"), ", outline-color ").concat(dt("speeddial.transition.duration"), ";\n will-change: transform;\n}\n\n.p-speeddial-list {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: inset-block-start 0s linear ").concat(dt("speeddial.transition.duration"), ";\n pointer-events: none;\n outline: 0 none;\n z-index: 2;\n gap: ").concat(dt("speeddial.gap"), ";\n}\n\n.p-speeddial-item {\n transform: scale(0);\n opacity: 0;\n transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, opacity 0.8s;\n will-change: transform;\n}\n\n.p-speeddial-circle .p-speeddial-item,\n.p-speeddial-semi-circle .p-speeddial-item,\n.p-speeddial-quarter-circle .p-speeddial-item {\n position: absolute;\n}\n\n.p-speeddial-mask {\n position: absolute;\n inset-inline-start: 0;\n inset-block-start: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n background: ").concat(dt("mask.background"), ";\n border-radius: 6px;\n transition: opacity 150ms;\n}\n\n.p-speeddial-mask-visible {\n pointer-events: none;\n opacity: 1;\n transition: opacity 150ms;\n}\n\n.p-speeddial-open .p-speeddial-list {\n pointer-events: auto;\n}\n\n.p-speeddial-open .p-speeddial-item {\n transform: scale(1);\n opacity: 1;\n}\n\n.p-speeddial-open .p-speeddial-rotate {\n transform: rotate(45deg);\n}\n"); }, "theme"); var inlineStyles$2 = { - root: /* @__PURE__ */ __name(function root27(_ref2) { + root: /* @__PURE__ */ __name(function root26(_ref2) { var props = _ref2.props; return { alignItems: (props.direction === "up" || props.direction === "down") && "center", @@ -19760,7 +19377,7 @@ var inlineStyles$2 = { }, "list") }; var classes$7 = { - root: /* @__PURE__ */ __name(function root28(_ref4) { + root: /* @__PURE__ */ __name(function root27(_ref4) { var instance = _ref4.instance, props = _ref4.props; return ["p-speeddial p-component p-speeddial-".concat(props.type), _defineProperty$8(_defineProperty$8(_defineProperty$8({}, "p-speeddial-direction-".concat(props.direction), props.type !== "circle"), "p-speeddial-open", instance.d_visible), "p-disabled", props.disabled)]; }, "root"), @@ -19774,7 +19391,7 @@ var classes$7 = { item: "p-speeddial-item", action: "p-speeddial-action", actionIcon: "p-speeddial-action-icon", - mask: /* @__PURE__ */ __name(function mask4(_ref7) { + mask: /* @__PURE__ */ __name(function mask2(_ref7) { var instance = _ref7.instance; return ["p-speeddial-mask", { "p-speeddial-mask-visible": instance.d_visible @@ -19789,7 +19406,7 @@ var SpeedDialStyle = BaseStyle.extend({ }); var script$1$7 = { name: "BaseSpeedDial", - "extends": script$1d, + "extends": script$1f, props: { model: null, visible: { @@ -19844,7 +19461,7 @@ var script$1$7 = { "class": null, buttonProps: { type: Object, - "default": /* @__PURE__ */ __name(function _default18() { + "default": /* @__PURE__ */ __name(function _default17() { return { rounded: true }; @@ -19852,7 +19469,7 @@ var script$1$7 = { }, actionButtonProps: { type: Object, - "default": /* @__PURE__ */ __name(function _default19() { + "default": /* @__PURE__ */ __name(function _default18() { return { severity: "secondary", rounded: true, @@ -19870,7 +19487,7 @@ var script$1$7 = { } }, style: SpeedDialStyle, - provide: /* @__PURE__ */ __name(function provide44() { + provide: /* @__PURE__ */ __name(function provide43() { return { $pcSpeedDial: this, $parentInstance: this @@ -19968,7 +19585,7 @@ var script$c = { documentClickListener: null, container: null, list: null, - data: /* @__PURE__ */ __name(function data32() { + data: /* @__PURE__ */ __name(function data31() { return { id: this.$attrs.id, d_visible: this.visible, @@ -20001,7 +19618,7 @@ var script$c = { this.bindDocumentClickListener(); } }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount15() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount14() { this.unbindDocumentClickListener(); }, "beforeUnmount"), methods: { @@ -20040,7 +19657,7 @@ var script$c = { this.d_visible = true; this.$emit("show"); }, "show"), - hide: /* @__PURE__ */ __name(function hide6() { + hide: /* @__PURE__ */ __name(function hide5() { this.d_visible = false; this.$emit("hide"); }, "hide"), @@ -20303,7 +19920,7 @@ var script$c = { this.documentClickListener = null; } }, "unbindDocumentClickListener"), - isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked4(event2) { + isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked3(event2) { return this.container && !(this.container.isSameNode(event2.target) || this.container.contains(event2.target) || this.isItemClicked); }, "isOutsideClicked"), isItemVisible: /* @__PURE__ */ __name(function isItemVisible6(item8) { @@ -20312,7 +19929,7 @@ var script$c = { isItemActive: /* @__PURE__ */ __name(function isItemActive7(id4) { return id4 === this.focusedOptionId; }, "isItemActive"), - containerRef: /* @__PURE__ */ __name(function containerRef6(el) { + containerRef: /* @__PURE__ */ __name(function containerRef5(el) { this.container = el; }, "containerRef"), listRef: /* @__PURE__ */ __name(function listRef3(el) { @@ -20328,8 +19945,8 @@ var script$c = { }, "focusedOptionId") }, components: { - Button: script$1e, - PlusIcon: script$1x + Button: script$1d, + PlusIcon: script$1w }, directives: { ripple: Ripple, @@ -20467,7 +20084,7 @@ function render$b(_ctx, _cache, $props, $setup, $data, $options) { __name(render$b, "render$b"); script$c.render = render$b; var classes$6 = { - root: /* @__PURE__ */ __name(function root29(_ref) { + root: /* @__PURE__ */ __name(function root28(_ref) { var instance = _ref.instance; return ["p-stepitem", { "p-stepitem-active": instance.isActive @@ -20480,7 +20097,7 @@ var StepItemStyle = BaseStyle.extend({ }); var script$1$6 = { name: "BaseStepItem", - "extends": script$1d, + "extends": script$1f, props: { value: { type: [String, Number], @@ -20488,7 +20105,7 @@ var script$1$6 = { } }, style: StepItemStyle, - provide: /* @__PURE__ */ __name(function provide45() { + provide: /* @__PURE__ */ __name(function provide44() { return { $pcStepItem: this, $parentInstance: this @@ -20516,12 +20133,12 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$a, "render$a"); script$b.render = render$a; -var theme$5 = /* @__PURE__ */ __name(function theme35(_ref) { +var theme$5 = /* @__PURE__ */ __name(function theme34(_ref) { var dt = _ref.dt; return '\n.p-steps {\n position: relative;\n}\n\n.p-steps-list {\n padding: 0;\n margin: 0;\n list-style-type: none;\n display: flex;\n}\n\n.p-steps-item {\n position: relative;\n display: flex;\n justify-content: center;\n flex: 1 1 auto;\n}\n\n.p-steps-item.p-disabled,\n.p-steps-item.p-disabled * {\n opacity: 1;\n pointer-events: auto;\n user-select: auto;\n cursor: auto;\n}\n\n.p-steps-item:before {\n content: " ";\n border-top: 2px solid '.concat(dt("steps.separator.background"), ";\n width: 100%;\n top: 50%;\n left: 0;\n display: block;\n position: absolute;\n margin-top: calc(-1rem + 1px);\n}\n\n.p-steps-item:first-child::before {\n width: calc(50% + 1rem);\n transform: translateX(100%);\n}\n\n.p-steps-item:last-child::before {\n width: 50%;\n}\n\n.p-steps-item-link {\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n overflow: hidden;\n text-decoration: none;\n transition: outline-color ").concat(dt("steps.transition.duration"), ", box-shadow ").concat(dt("steps.transition.duration"), ";\n border-radius: ").concat(dt("steps.item.link.border.radius"), ";\n outline-color: transparent;\n gap: ").concat(dt("steps.item.link.gap"), ";\n}\n\n.p-steps-item-link:not(.p-disabled):focus-visible {\n box-shadow: ").concat(dt("steps.item.link.focus.ring.shadow"), ";\n outline: ").concat(dt("steps.item.link.focus.ring.width"), " ").concat(dt("steps.item.link.focus.ring.style"), " ").concat(dt("steps.item.link.focus.ring.color"), ";\n outline-offset: ").concat(dt("steps.item.link.focus.ring.offset"), ";\n}\n\n.p-steps-item-label {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n color: ").concat(dt("steps.item.label.color"), ";\n display: block;\n font-weight: ").concat(dt("steps.item.label.font.weight"), ";\n}\n\n.p-steps-item-number {\n display: flex;\n align-items: center;\n justify-content: center;\n color: ").concat(dt("steps.item.number.color"), ";\n border: 2px solid ").concat(dt("steps.item.number.border.color"), ";\n background: ").concat(dt("steps.item.number.background"), ";\n min-width: ").concat(dt("steps.item.number.size"), ";\n height: ").concat(dt("steps.item.number.size"), ";\n line-height: ").concat(dt("steps.item.number.size"), ";\n font-size: ").concat(dt("steps.item.number.font.size"), ";\n z-index: 1;\n border-radius: ").concat(dt("steps.item.number.border.radius"), ";\n position: relative;\n font-weight: ").concat(dt("steps.item.number.font.weight"), ';\n}\n\n.p-steps-item-number::after {\n content: " ";\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: ').concat(dt("steps.item.number.border.radius"), ";\n box-shadow: ").concat(dt("steps.item.number.shadow"), ";\n}\n\n.p-steps:not(.p-readonly) .p-steps-item {\n cursor: pointer;\n}\n\n.p-steps-item-active .p-steps-item-number {\n background: ").concat(dt("steps.item.number.active.background"), ";\n border-color: ").concat(dt("steps.item.number.active.border.color"), ";\n color: ").concat(dt("steps.item.number.active.color"), ";\n}\n\n.p-steps-item-active .p-steps-item-label {\n color: ").concat(dt("steps.item.label.active.color"), ";\n}\n"); }, "theme"); var classes$5 = { - root: /* @__PURE__ */ __name(function root30(_ref2) { + root: /* @__PURE__ */ __name(function root29(_ref2) { var props = _ref2.props; return ["p-steps p-component", { "p-readonly": props.readonly @@ -20546,7 +20163,7 @@ var StepsStyle = BaseStyle.extend({ }); var script$1$5 = { name: "BaseSteps", - "extends": script$1d, + "extends": script$1f, props: { id: { type: String @@ -20565,7 +20182,7 @@ var script$1$5 = { } }, style: StepsStyle, - provide: /* @__PURE__ */ __name(function provide46() { + provide: /* @__PURE__ */ __name(function provide45() { return { $pcSteps: this, $parentInstance: this @@ -20577,7 +20194,7 @@ var script$a = { "extends": script$1$5, inheritAttrs: false, emits: ["update:activeStep", "step-change"], - data: /* @__PURE__ */ __name(function data33() { + data: /* @__PURE__ */ __name(function data32() { return { d_activeStep: this.activeStep }; @@ -20752,7 +20369,7 @@ function render$9(_ctx, _cache, $props, $setup, $data, $options) { onClick: /* @__PURE__ */ __name(function onClick11($event) { return $options.onItemClick($event, item8, index); }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown6($event) { + onKeydown: /* @__PURE__ */ __name(function onKeydown5($event) { return $options.onItemKeydown($event, item8, index); }, "onKeydown"), ref_for: true @@ -20929,7 +20546,7 @@ var StyleClass = BaseStyleClass.extend("styleclass", { }, "isOutsideClick") } }); -var theme$4 = /* @__PURE__ */ __name(function theme36(_ref) { +var theme$4 = /* @__PURE__ */ __name(function theme35(_ref) { var dt = _ref.dt; return "\n.p-tabmenu {\n overflow-x: auto;\n}\n\n.p-tabmenu-tablist {\n display: flex;\n margin: 0;\n padding: 0;\n list-style-type: none;\n background: ".concat(dt("tabmenu.tablist.background"), ";\n border-style: solid;\n border-color: ").concat(dt("tabmenu.tablist.border.color"), ";\n border-width: ").concat(dt("tabmenu.tablist.border.width"), ";\n position: relative;\n}\n\n.p-tabmenu-item-link {\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 background: ").concat(dt("tabmenu.item.background"), ";\n border-style: solid;\n border-width: ").concat(dt("tabmenu.item.border.width"), ";\n border-color: ").concat(dt("tabmenu.item.border.color"), ";\n color: ").concat(dt("tabmenu.item.color"), ";\n padding: ").concat(dt("tabmenu.item.padding"), ";\n font-weight: ").concat(dt("tabmenu.item.font.weight"), ";\n transition: background ").concat(dt("tabmenu.transition.duration"), ", border-color ").concat(dt("tabmenu.transition.duration"), ", color ").concat(dt("tabmenu.transition.duration"), ", outline-color ").concat(dt("tabmenu.transition.duration"), ", box-shadow ").concat(dt("tabmenu.transition.duration"), ";\n margin: ").concat(dt("tabmenu.item.margin"), ";\n outline-color: transparent;\n gap: ").concat(dt("tabmenu.item.gap"), ";\n}\n\n.p-tabmenu-item-link:focus-visible {\n z-index: 1;\n box-shadow: ").concat(dt("tabmenu.item.focus.ring.shadow"), ";\n outline: ").concat(dt("tabmenu.item.focus.ring.width"), " ").concat(dt("tabmenu.item.focus.ring.style"), " ").concat(dt("tabmenu.item.focus.ring.color"), ";\n outline-offset: ").concat(dt("tabmenu.item.focus.ring.offset"), ";\n}\n\n.p-tabmenu-item-icon {\n color: ").concat(dt("tabmenu.item.icon.color"), ";\n transition: background ").concat(dt("tabmenu.transition.duration"), ", border-color ").concat(dt("tabmenu.transition.duration"), ", color ").concat(dt("tabmenu.transition.duration"), ", outline-color ").concat(dt("tabmenu.transition.duration"), ", box-shadow ").concat(dt("tabmenu.transition.duration"), ";\n}\n\n.p-tabmenu-item-label {\n line-height: 1;\n}\n\n.p-tabmenu-item:not(.p-tabmenu-item-active):not(.p-disabled):hover .p-tabmenu-item-link {\n background: ").concat(dt("tabmenu.item.hover.background"), ";\n border-color: ").concat(dt("tabmenu.item.hover.border.color"), ";\n color: ").concat(dt("tabmenu.item.hover.color"), ";\n}\n\n.p-tabmenu-item:not(.p-tabmenu-item-active):not(.p-disabled):hover .p-tabmenu-item-icon {\n color: ").concat(dt("tabmenu.item.icon.hover.color"), ";\n}\n\n.p-tabmenu-item-active .p-tabmenu-item-link {\n background: ").concat(dt("tabmenu.item.active.background"), ";\n border-color: ").concat(dt("tabmenu.item.active.border.color"), ";\n color: ").concat(dt("tabmenu.item.active.color"), ";\n}\n\n.p-tabmenu-item-active .p-tabmenu-item-icon {\n color: ").concat(dt("tabmenu.item.icon.active.color"), ";\n}\n\n.p-tabmenu-active-bar {\n z-index: 1;\n display: block;\n position: absolute;\n bottom: ").concat(dt("tabmenu.active.bar.bottom"), ";\n height: ").concat(dt("tabmenu.active.bar.height"), ";\n background: ").concat(dt("tabmenu.active.bar.background"), ";\n transition: 250ms cubic-bezier(0.35, 0, 0.25, 1);\n}\n\n.p-tabmenu::-webkit-scrollbar {\n display: none;\n}\n"); }, "theme"); @@ -20955,7 +20572,7 @@ var TabMenuStyle = BaseStyle.extend({ }); var script$1$4 = { name: "BaseTabMenu", - "extends": script$1d, + "extends": script$1f, props: { model: { type: Array, @@ -20975,7 +20592,7 @@ var script$1$4 = { } }, style: TabMenuStyle, - provide: /* @__PURE__ */ __name(function provide47() { + provide: /* @__PURE__ */ __name(function provide46() { return { $pcTabMenu: this, $parentInstance: this @@ -20987,7 +20604,7 @@ var script$9 = { "extends": script$1$4, inheritAttrs: false, emits: ["update:activeIndex", "tab-change"], - data: /* @__PURE__ */ __name(function data34() { + data: /* @__PURE__ */ __name(function data33() { return { d_activeIndex: this.activeIndex }; @@ -21009,7 +20626,7 @@ var script$9 = { var activeItem2 = this.findActiveItem(); activeItem2 && (activeItem2.tabIndex = "0"); }, "mounted"), - updated: /* @__PURE__ */ __name(function updated8() { + updated: /* @__PURE__ */ __name(function updated7() { this.updateInkBar(); }, "updated"), methods: { @@ -21204,7 +20821,7 @@ function render$8(_ctx, _cache, $props, $setup, $data, $options) { onClick: /* @__PURE__ */ __name(function onClick11($event) { return $options.onItemClick($event, item8, i); }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown6($event) { + onKeydown: /* @__PURE__ */ __name(function onKeydown5($event) { return $options.onKeydownItem($event, item8, i); }, "onKeydown") }, $options.getPTOptions("item", item8, i), { @@ -21249,7 +20866,7 @@ function render$8(_ctx, _cache, $props, $setup, $data, $options) { __name(render$8, "render$8"); script$9.render = render$8; var TerminalService = EventBus(); -var theme$3 = /* @__PURE__ */ __name(function theme37(_ref) { +var theme$3 = /* @__PURE__ */ __name(function theme36(_ref) { var dt = _ref.dt; return "\n.p-terminal {\n height: ".concat(dt("terminal.height"), ";\n overflow: auto;\n background: ").concat(dt("terminal.background"), ";\n color: ").concat(dt("terminal.color"), ";\n border: 1px solid ").concat(dt("terminal.border.color"), ";\n padding: ").concat(dt("terminal.padding"), ";\n border-radius: ").concat(dt("terminal.border.radius"), ";\n}\n\n.p-terminal-prompt {\n display: flex;\n align-items: center;\n}\n\n.p-terminal-prompt-value {\n flex: 1 1 auto;\n border: 0 none;\n background: transparent;\n color: inherit;\n padding: 0;\n outline: 0 none;\n font-family: inherit;\n font-feature-settings: inherit;\n font-size: 1rem;\n}\n\n.p-terminal-prompt-label {\n margin-inline-end: ").concat(dt("terminal.prompt.gap"), ";\n}\n\n.p-terminal-input::-ms-clear {\n display: none;\n}\n\n.p-terminal-command-response {\n margin: ").concat(dt("terminal.command.response.margin"), ";\n}\n"); }, "theme"); @@ -21271,7 +20888,7 @@ var TerminalStyle = BaseStyle.extend({ }); var script$1$3 = { name: "BaseTerminal", - "extends": script$1d, + "extends": script$1f, props: { welcomeMessage: { type: String, @@ -21283,7 +20900,7 @@ var script$1$3 = { } }, style: TerminalStyle, - provide: /* @__PURE__ */ __name(function provide48() { + provide: /* @__PURE__ */ __name(function provide47() { return { $pcTerminal: this, $parentInstance: this @@ -21294,7 +20911,7 @@ var script$8 = { name: "Terminal", "extends": script$1$3, inheritAttrs: false, - data: /* @__PURE__ */ __name(function data35() { + data: /* @__PURE__ */ __name(function data34() { return { commandText: null, commands: [] @@ -21304,17 +20921,17 @@ var script$8 = { TerminalService.on("response", this.responseListener); this.$refs.input.focus(); }, "mounted"), - updated: /* @__PURE__ */ __name(function updated9() { + updated: /* @__PURE__ */ __name(function updated8() { this.$el.scrollTop = this.$el.scrollHeight; }, "updated"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount16() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount15() { TerminalService.off("response", this.responseListener); }, "beforeUnmount"), methods: { onClick: /* @__PURE__ */ __name(function onClick7() { this.$refs.input.focus(); }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown5(event2) { + onKeydown: /* @__PURE__ */ __name(function onKeydown4(event2) { if (event2.key === "Enter" && this.commandText) { this.commands.push({ text: this.commandText @@ -21374,12 +20991,12 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$7, "render$7"); script$8.render = render$7; -var theme$2 = /* @__PURE__ */ __name(function theme38(_ref) { +var theme$2 = /* @__PURE__ */ __name(function theme37(_ref) { var dt = _ref.dt; return "\n.p-timeline {\n display: flex;\n flex-grow: 1;\n flex-direction: column;\n direction: ltr;\n}\n\n.p-timeline-left .p-timeline-event-opposite {\n text-align: right;\n}\n\n.p-timeline-left .p-timeline-event-content {\n text-align: left;\n}\n\n.p-timeline-right .p-timeline-event {\n flex-direction: row-reverse;\n}\n\n.p-timeline-right .p-timeline-event-opposite {\n text-align: left;\n}\n\n.p-timeline-right .p-timeline-event-content {\n text-align: right;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) {\n flex-direction: row-reverse;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(odd) .p-timeline-event-opposite {\n text-align: right;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(odd) .p-timeline-event-content {\n text-align: left;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) .p-timeline-event-opposite {\n text-align: left;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) .p-timeline-event-content {\n text-align: right;\n}\n\n.p-timeline-vertical .p-timeline-event-opposite,\n.p-timeline-vertical .p-timeline-event-content {\n padding: ".concat(dt("timeline.vertical.event.content.padding"), ";\n}\n\n.p-timeline-vertical .p-timeline-event-connector {\n width: ").concat(dt("timeline.event.connector.size"), ";\n}\n\n.p-timeline-event {\n display: flex;\n position: relative;\n min-height: ").concat(dt("timeline.event.min.height"), ";\n}\n\n.p-timeline-event:last-child {\n min-height: 0;\n}\n\n.p-timeline-event-opposite {\n flex: 1;\n}\n\n.p-timeline-event-content {\n flex: 1;\n}\n\n.p-timeline-event-separator {\n flex: 0;\n display: flex;\n align-items: center;\n flex-direction: column;\n}\n\n.p-timeline-event-marker {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: relative;\n align-self: baseline;\n border-width: ").concat(dt("timeline.event.marker.border.width"), ";\n border-style: solid;\n border-color: ").concat(dt("timeline.event.marker.border.color"), ";\n border-radius: ").concat(dt("timeline.event.marker.border.radius"), ";\n width: ").concat(dt("timeline.event.marker.size"), ";\n height: ").concat(dt("timeline.event.marker.size"), ";\n background: ").concat(dt("timeline.event.marker.background"), ';\n}\n\n.p-timeline-event-marker::before {\n content: " ";\n border-radius: ').concat(dt("timeline.event.marker.content.border.radius"), ";\n width: ").concat(dt("timeline.event.marker.content.size"), ";\n height:").concat(dt("timeline.event.marker.content.size"), ";\n background: ").concat(dt("timeline.event.marker.content.background"), ';\n}\n\n.p-timeline-event-marker::after {\n content: " ";\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: ').concat(dt("timeline.event.marker.border.radius"), ";\n box-shadow: ").concat(dt("timeline.event.marker.content.inset.shadow"), ";\n}\n\n.p-timeline-event-connector {\n flex-grow: 1;\n background: ").concat(dt("timeline.event.connector.color"), ";\n}\n\n.p-timeline-horizontal {\n flex-direction: row;\n}\n\n.p-timeline-horizontal .p-timeline-event {\n flex-direction: column;\n flex: 1;\n}\n\n.p-timeline-horizontal .p-timeline-event:last-child {\n flex: 0;\n}\n\n.p-timeline-horizontal .p-timeline-event-separator {\n flex-direction: row;\n}\n\n.p-timeline-horizontal .p-timeline-event-connector {\n width: 100%;\n height: ").concat(dt("timeline.event.connector.size"), ";\n}\n\n.p-timeline-horizontal .p-timeline-event-opposite,\n.p-timeline-horizontal .p-timeline-event-content {\n padding: ").concat(dt("timeline.horizontal.event.content.padding"), ";\n}\n\n.p-timeline-horizontal.p-timeline-alternate .p-timeline-event:nth-child(even) {\n flex-direction: column-reverse;\n}\n\n.p-timeline-bottom .p-timeline-event {\n flex-direction: column-reverse;\n}\n"); }, "theme"); var classes$2 = { - root: /* @__PURE__ */ __name(function root31(_ref2) { + root: /* @__PURE__ */ __name(function root30(_ref2) { var props = _ref2.props; return ["p-timeline p-component", "p-timeline-" + props.align, "p-timeline-" + props.layout]; }, "root"), @@ -21397,7 +21014,7 @@ var TimelineStyle = BaseStyle.extend({ }); var script$1$2 = { name: "BaseTimeline", - "extends": script$1d, + "extends": script$1f, props: { value: null, align: { @@ -21411,7 +21028,7 @@ var script$1$2 = { dataKey: null }, style: TimelineStyle, - provide: /* @__PURE__ */ __name(function provide49() { + provide: /* @__PURE__ */ __name(function provide48() { return { $pcTimeline: this, $parentInstance: this @@ -21483,12 +21100,12 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$6, "render$6"); script$7.render = render$6; -var theme$1 = /* @__PURE__ */ __name(function theme39(_ref) { +var theme$1 = /* @__PURE__ */ __name(function theme38(_ref) { var dt = _ref.dt; return "\n.p-treeselect {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n background: ".concat(dt("treeselect.background"), ";\n border: 1px solid ").concat(dt("treeselect.border.color"), ";\n transition: background ").concat(dt("treeselect.transition.duration"), ", color ").concat(dt("treeselect.transition.duration"), ", border-color ").concat(dt("treeselect.transition.duration"), ", outline-color ").concat(dt("treeselect.transition.duration"), ", box-shadow ").concat(dt("treeselect.transition.duration"), ";\n border-radius: ").concat(dt("treeselect.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("treeselect.shadow"), ";\n}\n\n.p-treeselect:not(.p-disabled):hover {\n border-color: ").concat(dt("treeselect.hover.border.color"), ";\n}\n\n.p-treeselect:not(.p-disabled).p-focus {\n border-color: ").concat(dt("treeselect.focus.border.color"), ";\n box-shadow: ").concat(dt("treeselect.focus.ring.shadow"), ";\n outline: ").concat(dt("treeselect.focus.ring.width"), " ").concat(dt("treeselect.focus.ring.style"), " ").concat(dt("treeselect.focus.ring.color"), ";\n outline-offset: ").concat(dt("treeselect.focus.ring.offset"), ";\n}\n\n.p-treeselect.p-variant-filled {\n background: ").concat(dt("treeselect.filled.background"), ";\n}\n\n.p-treeselect.p-variant-filled:not(.p-disabled):hover {\n background: ").concat(dt("treeselect.filled.hover.background"), ";\n}\n\n.p-treeselect.p-variant-filled.p-focus {\n background: ").concat(dt("treeselect.filled.focus.background"), ";\n}\n\n.p-treeselect.p-invalid {\n border-color: ").concat(dt("treeselect.invalid.border.color"), ";\n}\n\n.p-treeselect.p-disabled {\n opacity: 1;\n background: ").concat(dt("treeselect.disabled.background"), ";\n}\n\n.p-treeselect-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n color: ").concat(dt("treeselect.clear.icon.color"), ";\n inset-inline-end: ").concat(dt("treeselect.dropdown.width"), ";\n}\n\n.p-treeselect-dropdown {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n background: transparent;\n color: ").concat(dt("treeselect.dropdown.color"), ";\n width: ").concat(dt("treeselect.dropdown.width"), ";\n border-start-end-radius: ").concat(dt("border.radius.md"), ";\n border-end-end-radius: ").concat(dt("border.radius.md"), ";\n}\n\n.p-treeselect-label-container {\n overflow: hidden;\n flex: 1 1 auto;\n cursor: pointer;\n}\n\n.p-treeselect-label {\n display: flex;\n align-items: center;\n gap: calc(").concat(dt("treeselect.padding.y"), " / 2);\n white-space: nowrap;\n cursor: pointer;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: ").concat(dt("treeselect.padding.y"), " ").concat(dt("treeselect.padding.x"), ";\n color: ").concat(dt("treeselect.color"), ";\n}\n\n.p-treeselect-label.p-placeholder {\n color: ").concat(dt("treeselect.placeholder.color"), ";\n}\n\n.p-treeselect.p-invalid .p-treeselect-label.p-placeholder {\n color: ").concat(dt("treeselect.invalid.placeholder.color"), ";\n}\n\n.p-treeselect.p-disabled .p-treeselect-label {\n color: ").concat(dt("treeselect.disabled.color"), ";\n}\n\n.p-treeselect-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\n\n.p-treeselect .p-treeselect-overlay {\n min-width: 100%;\n}\n\n.p-treeselect-overlay {\n position: absolute;\n top: 0;\n left: 0;\n background: ").concat(dt("treeselect.overlay.background"), ";\n color: ").concat(dt("treeselect.overlay.color"), ";\n border: 1px solid ").concat(dt("treeselect.overlay.border.color"), ";\n border-radius: ").concat(dt("treeselect.overlay.border.radius"), ";\n box-shadow: ").concat(dt("treeselect.overlay.shadow"), ";\n overflow: hidden;\n}\n\n.p-treeselect-tree-container {\n overflow: auto;\n}\n\n.p-treeselect-empty-message {\n padding: ").concat(dt("treeselect.empty.message.padding"), ";\n background: transparent;\n}\n\n.p-treeselect-fluid {\n display: flex;\n}\n\n.p-treeselect-overlay .p-tree {\n padding: ").concat(dt("treeselect.tree.padding"), ";\n}\n\n.p-treeselect-overlay .p-tree-loading {\n min-height: 3rem;\n}\n\n.p-treeselect-label .p-chip {\n padding-block-start: calc(").concat(dt("treeselect.padding.y"), " / 2);\n padding-block-end: calc(").concat(dt("treeselect.padding.y"), " / 2);\n border-radius: ").concat(dt("treeselect.chip.border.radius"), ";\n}\n\n.p-treeselect-label:has(.p-chip) {\n padding: calc(").concat(dt("treeselect.padding.y"), " / 2) calc(").concat(dt("treeselect.padding.x"), " / 2);\n}\n\n.p-treeselect-sm .p-treeselect-label {\n font-size: ").concat(dt("treeselect.sm.font.size"), ";\n padding-block: ").concat(dt("treeselect.sm.padding.y"), ";\n padding-inline: ").concat(dt("treeselect.sm.padding.x"), ";\n}\n\n.p-treeselect-sm .p-treeselect-dropdown .p-icon {\n font-size: ").concat(dt("treeselect.sm.font.size"), ";\n width: ").concat(dt("treeselect.sm.font.size"), ";\n height: ").concat(dt("treeselect.sm.font.size"), ";\n}\n\n.p-treeselect-lg .p-treeselect-label {\n font-size: ").concat(dt("treeselect.lg.font.size"), ";\n padding-block: ").concat(dt("treeselect.lg.padding.y"), ";\n padding-inline: ").concat(dt("treeselect.lg.padding.x"), ";\n}\n\n.p-treeselect-lg .p-treeselect-dropdown .p-icon {\n font-size: ").concat(dt("treeselect.lg.font.size"), ";\n width: ").concat(dt("treeselect.lg.font.size"), ";\n height: ").concat(dt("treeselect.lg.font.size"), ";\n}\n"); }, "theme"); var inlineStyles$1 = { - root: /* @__PURE__ */ __name(function root32(_ref2) { + root: /* @__PURE__ */ __name(function root31(_ref2) { var props = _ref2.props; return { position: props.appendTo === "self" ? "relative" : void 0 @@ -21496,7 +21113,7 @@ var inlineStyles$1 = { }, "root") }; var classes$1 = { - root: /* @__PURE__ */ __name(function root33(_ref3) { + root: /* @__PURE__ */ __name(function root32(_ref3) { var instance = _ref3.instance, props = _ref3.props; return ["p-treeselect p-component p-inputwrapper", { "p-treeselect-display-chip": props.display === "chip", @@ -21537,7 +21154,7 @@ var TreeSelectStyle = BaseStyle.extend({ }); var script$1$1 = { name: "BaseTreeSelect", - "extends": script$1n, + "extends": script$1k, props: { options: Array, scrollHeight: { @@ -21658,7 +21275,7 @@ var script$1$1 = { } }, style: TreeSelectStyle, - provide: /* @__PURE__ */ __name(function provide50() { + provide: /* @__PURE__ */ __name(function provide49() { return { $pcTreeSelect: this, $parentInstance: this @@ -21789,7 +21406,7 @@ var script$6 = { "default": null } }, - data: /* @__PURE__ */ __name(function data36() { + data: /* @__PURE__ */ __name(function data35() { return { id: this.$attrs.id, focused: false, @@ -21823,7 +21440,7 @@ var script$6 = { overlay: null, selfChange: false, selfClick: false, - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount17() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount16() { this.unbindOutsideClickListener(); this.unbindResizeListener(); if (this.scrollHandler) { @@ -21844,7 +21461,7 @@ var script$6 = { this.$emit("before-show"); this.overlayVisible = true; }, "show"), - hide: /* @__PURE__ */ __name(function hide7() { + hide: /* @__PURE__ */ __name(function hide6() { this.$emit("before-hide"); this.overlayVisible = false; this.$refs.focusInput.focus(); @@ -22006,7 +21623,7 @@ var script$6 = { absolutePosition(this.overlay, this.$el); } }, "alignOverlay"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener7() { + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener6() { var _this2 = this; if (!this.outsideClickListener) { this.outsideClickListener = function(event2) { @@ -22018,7 +21635,7 @@ var script$6 = { document.addEventListener("click", this.outsideClickListener); } }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener7() { + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener6() { if (this.outsideClickListener) { document.removeEventListener("click", this.outsideClickListener); this.outsideClickListener = null; @@ -22057,7 +21674,7 @@ var script$6 = { this.resizeListener = null; } }, "unbindResizeListener"), - isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked5(event2) { + isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked4(event2) { return !(this.$el.isSameNode(event2.target) || this.$el.contains(event2.target) || this.overlay && this.overlay.contains(event2.target)); }, "isOutsideClicked"), overlayRef: /* @__PURE__ */ __name(function overlayRef5(el) { @@ -22227,10 +21844,10 @@ var script$6 = { }, components: { TSTree: script$1U, - Chip: script$1t, - Portal: script$1f, - ChevronDownIcon: script$1k, - TimesIcon: script$1g + Chip: script$1s, + Portal: script$1m, + ChevronDownIcon: script$1h, + TimesIcon: script$1q }, directives: { ripple: Ripple @@ -22526,12 +22143,12 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$5, "render$5"); script$6.render = render$5; -var theme40 = /* @__PURE__ */ __name(function theme41(_ref) { +var theme39 = /* @__PURE__ */ __name(function theme40(_ref) { var dt = _ref.dt; return "\n.p-treetable {\n position: relative;\n}\n\n.p-treetable-table {\n border-spacing: 0;\n border-collapse: separate;\n width: 100%;\n}\n\n.p-treetable-scrollable > .p-treetable-table-container {\n position: relative;\n}\n\n.p-treetable-scrollable-table > .p-treetable-thead {\n inset-block-start: 0;\n z-index: 1;\n}\n\n.p-treetable-scrollable-table > .p-treetable-frozen-tbody {\n position: sticky;\n z-index: 1;\n}\n\n.p-treetable-scrollable-table > .p-treetable-tfoot {\n inset-block-end: 0;\n z-index: 1;\n}\n\n.p-treetable-scrollable .p-treetable-frozen-column {\n position: sticky;\n background: ".concat(dt("treetable.header.cell.background"), ";\n}\n\n.p-treetable-scrollable th.p-treetable-frozen-column {\n z-index: 1;\n}\n\n.p-treetable-scrollable > .p-treetable-table-container > .p-treetable-table > .p-treetable-thead {\n background: ").concat(dt("treetable.header.cell.background"), ";\n}\n\n.p-treetable-scrollable > .p-treetable-table-container > .p-treetable-table > .p-treetable-tfoot {\n background: ").concat(dt("treetable.footer.cell.background"), ";\n}\n\n.p-treetable-flex-scrollable {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n.p-treetable-flex-scrollable > .p-treetable-table-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n height: 100%;\n}\n\n.p-treetable-scrollable-table > .p-treetable-tbody > .p-treetable-row-group-header {\n position: sticky;\n z-index: 1;\n}\n\n.p-treetable-resizable-table > .p-treetable-thead > tr > th,\n.p-treetable-resizable-table > .p-treetable-tfoot > tr > td,\n.p-treetable-resizable-table > .p-treetable-tbody > tr > td {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.p-treetable-resizable-table > .p-treetable-thead > tr > th.p-treetable-resizable-column:not(.p-treetable-frozen-column) {\n background-clip: padding-box;\n position: relative;\n}\n\n.p-treetable-resizable-table-fit > .p-treetable-thead > tr > th.p-treetable-resizable-column:last-child .p-treetable-column-resizer {\n display: none;\n}\n\n.p-treetable-column-resizer {\n display: block;\n position: absolute;\n inset-block-start: 0;\n inset-inline-end: 0;\n margin: 0;\n width: ").concat(dt("treetable.column.resizer.width"), ";\n height: 100%;\n padding: 0;\n cursor: col-resize;\n border: 1px solid transparent;\n}\n\n.p-treetable-column-header-content {\n display: flex;\n align-items: center;\n gap: ").concat(dt("treetable.header.cell.gap"), ";\n}\n\n.p-treetable-column-resize-indicator {\n width: ").concat(dt("treetable.resize.indicator.width"), ";\n position: absolute;\n z-index: 10;\n display: none;\n background: ").concat(dt("treetable.resize.indicator.color"), ";\n}\n\n.p-treetable-mask {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 2;\n}\n\n.p-treetable-paginator-top {\n border-color: ").concat(dt("treetable.paginator.top.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("treetable.paginator.top.border.width"), ";\n}\n\n.p-treetable-paginator-bottom {\n border-color: ").concat(dt("treetable.paginator.bottom.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("treetable.paginator.bottom.border.width"), ";\n}\n\n.p-treetable-header {\n background: ").concat(dt("treetable.header.background"), ";\n color: ").concat(dt("treetable.header.color"), ";\n border-color: ").concat(dt("treetable.header.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("treetable.header.border.width"), ";\n padding: ").concat(dt("treetable.header.padding"), ";\n}\n\n.p-treetable-footer {\n background: ").concat(dt("treetable.footer.background"), ";\n color: ").concat(dt("treetable.footer.color"), ";\n border-color: ").concat(dt("treetable.footer.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("treetable.footer.border.width"), ";\n padding: ").concat(dt("treetable.footer.padding"), ";\n}\n\n.p-treetable-header-cell {\n padding: ").concat(dt("treetable.header.cell.padding"), ";\n background: ").concat(dt("treetable.header.cell.background"), ";\n border-color: ").concat(dt("treetable.header.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n color: ").concat(dt("treetable.header.cell.color"), ";\n font-weight: normal;\n text-align: start;\n transition: background ").concat(dt("treetable.transition.duration"), ", color ").concat(dt("treetable.transition.duration"), ", border-color ").concat(dt("treetable.transition.duration"), ",\n outline-color ").concat(dt("treetable.transition.duration"), ", box-shadow ").concat(dt("treetable.transition.duration"), ";\n}\n\n.p-treetable-column-title {\n font-weight: ").concat(dt("treetable.column.title.font.weight"), ";\n}\n\n.p-treetable-tbody > tr {\n outline-color: transparent;\n background: ").concat(dt("treetable.row.background"), ";\n color: ").concat(dt("treetable.row.color"), ";\n transition: background ").concat(dt("treetable.transition.duration"), ", color ").concat(dt("treetable.transition.duration"), ", border-color ").concat(dt("treetable.transition.duration"), ",\n outline-color ").concat(dt("treetable.transition.duration"), ", box-shadow ").concat(dt("treetable.transition.duration"), ";\n}\n\n.p-treetable-tbody > tr > td {\n text-align: start;\n border-color: ").concat(dt("treetable.body.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n padding: ").concat(dt("treetable.body.cell.padding"), ";\n}\n\n.p-treetable-hoverable .p-treetable-tbody > tr:not(.p-treetable-row-selected):hover {\n background: ").concat(dt("treetable.row.hover.background"), ";\n color: ").concat(dt("treetable.row.hover.color"), ";\n}\n\n.p-treetable-tbody > tr.p-treetable-row-selected {\n background: ").concat(dt("treetable.row.selected.background"), ";\n color: ").concat(dt("treetable.row.selected.color"), ";\n}\n\n.p-treetable-tbody > tr:has(+ .p-treetable-row-selected) > td {\n border-block-end-color: ").concat(dt("treetable.body.cell.selected.border.color"), ";\n}\n\n.p-treetable-tbody > tr.p-treetable-row-selected > td {\n border-block-end-color: ").concat(dt("treetable.body.cell.selected.border.color"), ";\n}\n\n.p-treetable-tbody > tr:focus-visible,\n.p-treetable-tbody > tr.p-treetable-contextmenu-row-selected {\n box-shadow: ").concat(dt("treetable.row.focus.ring.shadow"), ";\n outline: ").concat(dt("treetable.row.focus.ring.width"), " ").concat(dt("treetable.row.focus.ring.style"), " ").concat(dt("treetable.row.focus.ring.color"), ";\n outline-offset: ").concat(dt("treetable.row.focus.ring.offset"), ";\n}\n\n.p-treetable-tfoot > tr > td {\n text-align: start;\n padding: ").concat(dt("treetable.footer.cell.padding"), ";\n border-color: ").concat(dt("treetable.footer.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n color: ").concat(dt("treetable.footer.cell.color"), ";\n background: ").concat(dt("treetable.footer.cell.background"), ";\n}\n\n.p-treetable-column-footer {\n font-weight: ").concat(dt("treetable.column.footer.font.weight"), ";\n}\n\n.p-treetable-sortable-column {\n cursor: pointer;\n user-select: none;\n outline-color: transparent;\n}\n\n.p-treetable-column-title,\n.p-treetable-sort-icon,\n.p-treetable-sort-badge {\n vertical-align: middle;\n}\n\n.p-treetable-sort-icon {\n color: ").concat(dt("treetable.sort.icon.color"), ";\n font-size: ").concat(dt("treetable.sort.icon.size"), ";\n width: ").concat(dt("treetable.sort.icon.size"), ";\n height: ").concat(dt("treetable.sort.icon.size"), ";\n transition: color ").concat(dt("treetable.transition.duration"), ";\n}\n\n.p-treetable-sortable-column:not(.p-treetable-column-sorted):hover {\n background: ").concat(dt("treetable.header.cell.hover.background"), ";\n color: ").concat(dt("treetable.header.cell.hover.color"), ";\n}\n\n.p-treetable-sortable-column:not(.p-treetable-column-sorted):hover .p-treetable-sort-icon {\n color: ").concat(dt("treetable.sort.icon.hover.color"), ";\n}\n\n.p-treetable-column-sorted {\n background: ").concat(dt("treetable.header.cell.selected.background"), ";\n color: ").concat(dt("treetable.header.cell.selected.color"), ";\n}\n\n.p-treetable-column-sorted .p-treetable-sort-icon {\n color: ").concat(dt("treetable.header.cell.selected.color"), ";\n}\n\n.p-treetable-sortable-column:focus-visible {\n box-shadow: ").concat(dt("treetable.header.cell.focus.ring.shadow"), ";\n outline: ").concat(dt("treetable.header.cell.focus.ring.width"), " ").concat(dt("treetable.header.cell.focus.ring.style"), " ").concat(dt("treetable.header.cell.focus.ring.color"), ";\n outline-offset: ").concat(dt("treetable.header.cell.focus.ring.offset"), ";\n}\n\n.p-treetable-hoverable .p-treetable-selectable-row {\n cursor: pointer;\n}\n\n.p-treetable-loading-icon {\n font-size: ").concat(dt("treetable.loading.icon.size"), ";\n width: ").concat(dt("treetable.loading.icon.size"), ";\n height: ").concat(dt("treetable.loading.icon.size"), ";\n}\n\n.p-treetable-gridlines .p-treetable-header {\n border-width: 1px 1px 0 1px;\n}\n\n.p-treetable-gridlines .p-treetable-footer {\n border-width: 0 1px 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-paginator-top {\n border-width: 1px 1px 0 1px;\n}\n\n.p-treetable-gridlines .p-treetable-paginator-bottom {\n border-width: 0 1px 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-thead > tr > th {\n border-width: 1px 0 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-thead > tr > th:last-child {\n border-width: 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tbody > tr > td {\n border-width: 1px 0 0 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tbody > tr > td:last-child {\n border-width: 1px 1px 0 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tbody > tr:last-child > td {\n border-width: 1px 0 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tbody > tr:last-child > td:last-child {\n border-width: 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tfoot > tr > td {\n border-width: 1px 0 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tfoot > tr > td:last-child {\n border-width: 1px 1px 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines .p-treetable-thead + .p-treetable-tfoot > tr > td {\n border-width: 0 0 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines .p-treetable-thead + .p-treetable-tfoot > tr > td:last-child {\n border-width: 0 1px 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines:has(.p-treetable-thead):has(.p-treetable-tbody) .p-treetable-tbody > tr > td {\n border-width: 0 0 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines:has(.p-treetable-thead):has(.p-treetable-tbody) .p-treetable-tbody > tr > td:last-child {\n border-width: 0 1px 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines:has(.p-treetable-tbody):has(.p-treetable-tfoot) .p-treetable-tbody > tr:last-child > td {\n border-width: 0 0 0 1px;\n}\n\n.p-treetable.p-treetable-gridlines:has(.p-treetable-tbody):has(.p-treetable-tfoot) .p-treetable-tbody > tr:last-child > td:last-child {\n border-width: 0 1px 0 1px;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-header {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-thead > tr > th {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-tbody > tr > td {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-tfoot > tr > td {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-footer {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-header {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-thead > tr > th {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-tbody > tr > td {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-tfoot > tr > td {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-footer {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable-body-cell-content {\n display: flex;\n align-items: center;\n gap: ").concat(dt("treetable.body.cell.gap"), ";\n}\n\n.p-treetable-tbody > tr.p-treetable-row-selected .p-treetable-node-toggle-button {\n color: inherit;\n}\n\n.p-treetable-node-toggle-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n width: ").concat(dt("treetable.node.toggle.button.size"), ";\n height: ").concat(dt("treetable.node.toggle.button.size"), ";\n color: ").concat(dt("treetable.node.toggle.button.color"), ";\n border: 0 none;\n background: transparent;\n cursor: pointer;\n border-radius: ").concat(dt("treetable.node.toggle.button.border.radius"), ";\n transition: background ").concat(dt("treetable.transition.duration"), ", color ").concat(dt("treetable.transition.duration"), ", border-color ").concat(dt("treetable.transition.duration"), ",\n outline-color ").concat(dt("treetable.transition.duration"), ", box-shadow ").concat(dt("treetable.transition.duration"), ";\n outline-color: transparent;\n user-select: none;\n}\n\n.p-treetable-node-toggle-button:enabled:hover {\n color: ").concat(dt("treetable.node.toggle.button.hover.color"), ";\n background: ").concat(dt("treetable.node.toggle.button.hover.background"), ";\n}\n\n.p-treetable-tbody > tr.p-treetable-row-selected .p-treetable-node-toggle-button:hover {\n background: ").concat(dt("treetable.node.toggle.button.selected.hover.background"), ";\n color: ").concat(dt("treetable.node.toggle.button.selected.hover.color"), ";\n}\n\n.p-treetable-node-toggle-button:focus-visible {\n box-shadow: ").concat(dt("treetable.node.toggle.button.focus.ring.shadow"), ";\n outline: ").concat(dt("treetable.node.toggle.button.focus.ring.width"), " ").concat(dt("treetable.node.toggle.button.focus.ring.style"), " ").concat(dt("treetable.node.toggle.button.focus.ring.color"), ";\n outline-offset: ").concat(dt("treetable.node.toggle.button.focus.ring.offset"), ";\n}\n\n.p-treetable-node-toggle-icon:dir(rtl) {\n transform: rotate(180deg);\n}\n"); }, "theme"); var classes = { - root: /* @__PURE__ */ __name(function root34(_ref2) { + root: /* @__PURE__ */ __name(function root33(_ref2) { var instance = _ref2.instance, props = _ref2.props; return ["p-treetable p-component", { "p-treetable-hoverable": props.rowHover || instance.rowSelectionMode, @@ -22624,13 +22241,13 @@ var inlineStyles = { }; var TreeTableStyle = BaseStyle.extend({ name: "treetable", - theme: theme40, + theme: theme39, classes, inlineStyles }); var script$5 = { name: "BaseTreeTable", - "extends": script$1d, + "extends": script$1f, props: { value: { type: null, @@ -22806,7 +22423,7 @@ var script$5 = { } }, style: TreeTableStyle, - provide: /* @__PURE__ */ __name(function provide51() { + provide: /* @__PURE__ */ __name(function provide50() { return { $pcTreeTable: this, $parentInstance: this @@ -22816,7 +22433,7 @@ var script$5 = { var script$4 = { name: "FooterCell", hostName: "TreeTable", - "extends": script$1d, + "extends": script$1f, props: { column: { type: Object, @@ -22827,7 +22444,7 @@ var script$4 = { "default": null } }, - data: /* @__PURE__ */ __name(function data37() { + data: /* @__PURE__ */ __name(function data36() { return { styleObject: {} }; @@ -22837,7 +22454,7 @@ var script$4 = { this.updateStickyPosition(); } }, "mounted"), - updated: /* @__PURE__ */ __name(function updated10() { + updated: /* @__PURE__ */ __name(function updated9() { if (this.columnProp("frozen")) { this.updateStickyPosition(); } @@ -22973,7 +22590,7 @@ script$4.render = render$4; var script$3 = { name: "HeaderCell", hostName: "TreeTable", - "extends": script$1d, + "extends": script$1f, emits: ["column-click", "column-resizestart"], props: { column: { @@ -23005,7 +22622,7 @@ var script$3 = { "default": null } }, - data: /* @__PURE__ */ __name(function data38() { + data: /* @__PURE__ */ __name(function data37() { return { styleObject: {} }; @@ -23015,7 +22632,7 @@ var script$3 = { this.updateStickyPosition(); } }, "mounted"), - updated: /* @__PURE__ */ __name(function updated11() { + updated: /* @__PURE__ */ __name(function updated10() { if (this.columnProp("frozen")) { this.updateStickyPosition(); } @@ -23158,7 +22775,7 @@ var script$3 = { }, "ariaSort") }, components: { - Badge: script$1z, + Badge: script$1y, SortAltIcon: script$1V, SortAmountUpAltIcon: script$1W, SortAmountDownIcon: script$1X @@ -23269,7 +22886,7 @@ script$3.render = render$3; var script$2 = { name: "BodyCell", hostName: "TreeTable", - "extends": script$1d, + "extends": script$1f, emits: ["node-toggle", "checkbox-toggle"], props: { node: { @@ -23321,7 +22938,7 @@ var script$2 = { "default": "mask" } }, - data: /* @__PURE__ */ __name(function data39() { + data: /* @__PURE__ */ __name(function data38() { return { styleObject: {} }; @@ -23331,7 +22948,7 @@ var script$2 = { this.updateStickyPosition(); } }, "mounted"), - updated: /* @__PURE__ */ __name(function updated12() { + updated: /* @__PURE__ */ __name(function updated11() { if (this.columnProp("frozen")) { this.updateStickyPosition(); } @@ -23433,12 +23050,12 @@ var script$2 = { }, "checkboxSelectionMode") }, components: { - Checkbox: script$1J, - ChevronRightIcon: script$1l, - ChevronDownIcon: script$1k, - CheckIcon: script$1D, - MinusIcon: script$1y, - SpinnerIcon: script$1r + Checkbox: script$1I, + ChevronRightIcon: script$1i, + ChevronDownIcon: script$1h, + CheckIcon: script$1C, + MinusIcon: script$1x, + SpinnerIcon: script$1p }, directives: { ripple: Ripple @@ -23696,7 +23313,7 @@ __name(_arrayLikeToArray$1, "_arrayLikeToArray$1"); var script$1 = { name: "TreeTableRow", hostName: "TreeTable", - "extends": script$1d, + "extends": script$1f, emits: ["node-click", "node-toggle", "checkbox-change", "nodeClick", "nodeToggle", "checkboxChange", "row-rightclick", "rowRightclick"], props: { node: { @@ -24297,12 +23914,12 @@ var script = { "extends": script$5, inheritAttrs: false, emits: ["node-expand", "node-collapse", "update:expandedKeys", "update:selectionKeys", "node-select", "node-unselect", "update:first", "update:rows", "page", "update:sortField", "update:sortOrder", "update:multiSortMeta", "sort", "filter", "column-resize-end", "update:contextMenuSelection", "row-contextmenu"], - provide: /* @__PURE__ */ __name(function provide52() { + provide: /* @__PURE__ */ __name(function provide51() { return { $columns: this.d_columns }; }, "provide"), - data: /* @__PURE__ */ __name(function data40() { + data: /* @__PURE__ */ __name(function data39() { return { d_expandedKeys: this.expandedKeys || {}, d_first: this.first, @@ -24340,7 +23957,7 @@ var script = { this.d_multiSortMeta = newValue; }, "multiSortMeta") }, - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount18() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount17() { this.destroyStyleElement(); this.d_columns.clear(); }, "beforeUnmount"), @@ -24857,32 +24474,32 @@ var script = { return this.value; } else { if (this.value && this.value.length) { - var data41 = this.value; + var data40 = this.value; if (this.sorted) { - if (this.sortMode === "single") data41 = this.sortSingle(data41); - else if (this.sortMode === "multiple") data41 = this.sortMultiple(data41); + if (this.sortMode === "single") data40 = this.sortSingle(data40); + else if (this.sortMode === "multiple") data40 = this.sortMultiple(data40); } if (this.hasFilters()) { - data41 = this.filter(data41); + data40 = this.filter(data40); } - return data41; + return data40; } else { return null; } } }, "processedData"), dataToRender: /* @__PURE__ */ __name(function dataToRender() { - var data41 = this.processedData; + var data40 = this.processedData; if (this.paginator) { var first3 = this.lazy ? 0 : this.d_first; - return data41.slice(first3, first3 + this.d_rows); + return data40.slice(first3, first3 + this.d_rows); } else { - return data41; + return data40; } }, "dataToRender"), empty: /* @__PURE__ */ __name(function empty2() { - var data41 = this.processedData; - return !data41 || data41.length === 0; + var data40 = this.processedData; + return !data40 || data40.length === 0; }, "empty"), sorted: /* @__PURE__ */ __name(function sorted() { return this.d_sortField || this.d_multiSortMeta && this.d_multiSortMeta.length > 0; @@ -24924,17 +24541,17 @@ var script = { if (this.lazy) { return this.totalRecords; } else { - var data41 = this.processedData; - return data41 ? data41.length : 0; + var data40 = this.processedData; + return data40 ? data40.length : 0; } }, "totalRecordsLength") }, components: { TTRow: script$1, - TTPaginator: script$1u, + TTPaginator: script$1t, TTHeaderCell: script$3, TTFooterCell: script$4, - SpinnerIcon: script$1r + SpinnerIcon: script$1p } }; function _typeof(o) { @@ -25514,7 +25131,7 @@ const useMaintenanceTaskStore = defineStore("maintenanceTask", () => { () => tasks.value.filter((task) => task.isInstallationFix).some((task) => getRunner(task)?.executing) ); const tasks = ref(DESKTOP_MAINTENANCE_TASKS); - const taskStates = ref( + const taskRunners = ref( new Map( DESKTOP_MAINTENANCE_TASKS.map((x) => [x.id, new MaintenanceTaskRunner(x)]) ) @@ -25522,7 +25139,7 @@ const useMaintenanceTaskStore = defineStore("maintenanceTask", () => { const anyErrors = computed( () => tasks.value.some((task) => getRunner(task).state === "error") ); - const getRunner = /* @__PURE__ */ __name((task) => taskStates.value.get(task.id), "getRunner"); + const getRunner = /* @__PURE__ */ __name((task) => taskRunners.value.get(task.id), "getRunner"); const processUpdate = /* @__PURE__ */ __name((validationUpdate) => { const update = validationUpdate; isRefreshing.value = true; @@ -25627,7 +25244,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({ ]), footer: withCtx(() => [ createBaseVNode("div", _hoisted_3$3, [ - createVNode(unref(script$1e), { + createVNode(unref(script$1d), { icon: _ctx.task.button?.icon, label: _ctx.task.button?.text, class: "w-full", @@ -25676,7 +25293,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({ const props = __props; return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); - return !_ctx.state || _ctx.loading ? (openBlock(), createBlock(unref(script$1h), { + return !_ctx.state || _ctx.loading ? (openBlock(), createBlock(unref(script$1c), { key: 0, class: "h-8 w-8" })) : withDirectives((openBlock(), createElementBlock("i", { @@ -25733,7 +25350,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({ ]), createBaseVNode("td", null, [ createBaseVNode("p", _hoisted_2$2, toDisplayString(_ctx.task.name), 1), - createVNode(unref(script$1e), { + createVNode(unref(script$1d), { class: "inline-block mx-2", type: "button", icon: unref(PrimeIcons).INFO_CIRCLE, @@ -25741,7 +25358,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({ text: true, onClick: toggle6 }, null, 8, ["icon"]), - createVNode(unref(script$1Q), { + createVNode(unref(script$1P), { ref_key: "infoPopover", ref: infoPopover, class: "block m-1 max-w-64 min-w-32" @@ -25753,7 +25370,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({ }, 512) ]), createBaseVNode("td", _hoisted_4$2, [ - createVNode(unref(script$1e), { + createVNode(unref(script$1d), { icon: _ctx.task.button?.icon, label: _ctx.task.button?.text, severity: severity.value, @@ -25856,13 +25473,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ }; } }); -const _hoisted_1 = { class: "min-w-full min-h-full font-sans w-screen h-screen grid justify-around text-neutral-300 bg-neutral-900 dark-theme pointer-events-auto overflow-y-auto" }; +const _hoisted_1 = { class: "min-w-full min-h-full font-sans w-screen h-screen grid justify-around text-neutral-300 bg-neutral-900 dark-theme overflow-y-auto" }; const _hoisted_2 = { class: "max-w-screen-sm w-screen m-8 relative" }; -const _hoisted_3 = { class: "w-full flex flex-wrap gap-4 items-center" }; -const _hoisted_4 = { class: "grow" }; -const _hoisted_5 = { class: "flex gap-4 items-center" }; -const _hoisted_6 = { class: "max-sm:hidden" }; -const _hoisted_7 = { class: "flex justify-between gap-4 flex-row" }; +const _hoisted_3 = { class: "backspan pi-wrench text-4xl font-bold" }; +const _hoisted_4 = { class: "w-full flex flex-wrap gap-4 items-center" }; +const _hoisted_5 = { class: "grow" }; +const _hoisted_6 = { class: "flex gap-4 items-center" }; +const _hoisted_7 = { class: "max-sm:hidden" }; +const _hoisted_8 = { class: "flex justify-between gap-4 flex-row" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "MaintenanceView", setup(__props) { @@ -25891,22 +25509,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ if (alertOnFail && !isValid) { toast.add({ severity: "error", - summary: "Error", - detail: "Unable to continue - errors remain", + summary: t("g.error"), + detail: t("maintenance.error.cannotContinue"), life: 5e3 }); } }, "completeValidation"); - const terminalCreated = /* @__PURE__ */ __name(({ terminal, useAutoSize }, root35) => { - useAutoSize({ root: root35, autoRows: true, autoCols: true }); - electron2.onLogMessage((message) => { - terminal.write(message); - }); - terminal.options.cursorBlink = false; - terminal.options.cursorStyle = "bar"; - terminal.options.cursorInactiveStyle = "bar"; - terminal.options.disableStdin = true; - }, "terminalCreated"); const toggleConsoleDrawer = /* @__PURE__ */ __name(() => { terminalVisible.value = !terminalVisible.value; }, "toggleConsoleDrawer"); @@ -25929,20 +25537,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }); onUnmounted(() => electron2.Validation.dispose()); return (_ctx, _cache) => { - return openBlock(), createBlock(_sfc_main$7, { dark: "" }, { + return openBlock(), createBlock(_sfc_main$8, { dark: "" }, { default: withCtx(() => [ createBaseVNode("div", _hoisted_1, [ createBaseVNode("div", _hoisted_2, [ - _cache[6] || (_cache[6] = createBaseVNode("h1", { class: "backspan pi-wrench text-4xl font-bold" }, "Maintenance", -1)), - createBaseVNode("div", _hoisted_3, [ - createBaseVNode("span", _hoisted_4, [ - _cache[5] || (_cache[5] = createTextVNode(" Status: ")), + createBaseVNode("h1", _hoisted_3, toDisplayString(unref(t)("maintenance.title")), 1), + createBaseVNode("div", _hoisted_4, [ + createBaseVNode("span", _hoisted_5, [ + createTextVNode(toDisplayString(unref(t)("maintenance.status")) + ": ", 1), createVNode(_sfc_main$5, { refreshing: unref(isRefreshing), error: anyErrors.value }, null, 8, ["refreshing", "error"]) ]), - createBaseVNode("div", _hoisted_5, [ + createBaseVNode("div", _hoisted_6, [ createVNode(unref(script$1$), { modelValue: displayAsList.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => displayAsList.value = $event), @@ -25970,7 +25578,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ createBaseVNode("i", { class: normalizeClass(opts.option.icon) }, null, 2), - createBaseVNode("span", _hoisted_6, toDisplayString(opts.option.value), 1) + createBaseVNode("span", _hoisted_7, toDisplayString(opts.option.value), 1) ]), _: 1 }, 8, ["modelValue", "options", "onChange"]), @@ -25988,36 +25596,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ displayAsList: displayAsList.value, isRefreshing: unref(isRefreshing) }, null, 8, ["filter", "displayAsList", "isRefreshing"]), - createBaseVNode("div", _hoisted_7, [ - createVNode(unref(script$1e), { - label: "Console Logs", + createBaseVNode("div", _hoisted_8, [ + createVNode(unref(script$1d), { + label: unref(t)("maintenance.consoleLogs"), icon: "pi pi-desktop", "icon-pos": "left", severity: "secondary", onClick: toggleConsoleDrawer - }), - createVNode(unref(script$1e), { - label: "Continue", + }, null, 8, ["label"]), + createVNode(unref(script$1d), { + label: unref(t)("g.continue"), icon: "pi pi-arrow-right", "icon-pos": "left", severity: anyErrors.value ? "secondary" : "primary", onClick: _cache[3] || (_cache[3] = () => completeValidation()), loading: unref(isRefreshing) - }, null, 8, ["severity", "loading"]) + }, null, 8, ["label", "severity", "loading"]) ]) ]), - createVNode(unref(script$1c), { - visible: terminalVisible.value, - "onUpdate:visible": _cache[4] || (_cache[4] = ($event) => terminalVisible.value = $event), - header: "Terminal", - position: "bottom", - style: { "height": "max(50vh, 34rem)" } - }, { - default: withCtx(() => [ - createVNode(BaseTerminal, { onCreated: terminalCreated }) - ]), - _: 1 - }, 8, ["visible"]), + createVNode(_sfc_main$7, { + modelValue: terminalVisible.value, + "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => terminalVisible.value = $event), + header: unref(t)("g.terminal"), + "default-message": unref(t)("maintenance.terminalDefaultMessage") + }, null, 8, ["modelValue", "header", "default-message"]), createVNode(unref(script$20)) ]) ]), @@ -26026,8 +25628,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }; } }); -const MaintenanceView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-74b78f7d"]]); +const MaintenanceView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-dd50a7dd"]]); export { MaintenanceView as default }; -//# sourceMappingURL=MaintenanceView-Df7CHNWW.js.map +//# sourceMappingURL=MaintenanceView-BUmTZX1d.js.map diff --git a/web/assets/MaintenanceView-Bj5_Vr6o.css b/web/assets/MaintenanceView-DEJCj8SR.css similarity index 95% rename from web/assets/MaintenanceView-Bj5_Vr6o.css rename to web/assets/MaintenanceView-DEJCj8SR.css index 22e37c41d..c12b64c90 100644 --- a/web/assets/MaintenanceView-Bj5_Vr6o.css +++ b/web/assets/MaintenanceView-DEJCj8SR.css @@ -63,10 +63,10 @@ } } -[data-v-74b78f7d] .p-tag { +[data-v-dd50a7dd] .p-tag { --p-tag-gap: 0.375rem; } -.backspan[data-v-74b78f7d]::before { +.backspan[data-v-dd50a7dd]::before { position: absolute; margin: 0px; color: var(--p-text-muted-color); diff --git a/web/assets/ManualConfigurationView-Cz0_f_T-.js b/web/assets/ManualConfigurationView-D3on5kXY.js similarity index 92% rename from web/assets/ManualConfigurationView-Cz0_f_T-.js rename to web/assets/ManualConfigurationView-D3on5kXY.js index bd81747f1..bcb4cdaa8 100644 --- a/web/assets/ManualConfigurationView-Cz0_f_T-.js +++ b/web/assets/ManualConfigurationView-D3on5kXY.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, K as useI18n, U as ref, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, a4 as script, a$ as script$1, l as script$2, b5 as electronAPI, _ as _export_sfc } from "./index-DqqhYDnY.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.js"; +import { d as defineComponent, I as useI18n, T as ref, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, a5 as script, b3 as script$1, l as script$2, b9 as electronAPI, _ as _export_sfc } from "./index-DqXp9vW4.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.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" }; @@ -71,4 +71,4 @@ const ManualConfigurationView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scop export { ManualConfigurationView as default }; -//# sourceMappingURL=ManualConfigurationView-Cz0_f_T-.js.map +//# sourceMappingURL=ManualConfigurationView-D3on5kXY.js.map diff --git a/web/assets/MetricsConsentView-B5NlgqrS.js b/web/assets/MetricsConsentView-DK20ednB.js similarity index 88% rename from web/assets/MetricsConsentView-B5NlgqrS.js rename to web/assets/MetricsConsentView-DK20ednB.js index 73800290f..e887d63b3 100644 --- a/web/assets/MetricsConsentView-B5NlgqrS.js +++ b/web/assets/MetricsConsentView-DK20ednB.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.js"; -import { d as defineComponent, aR as useToast, K as useI18n, U as ref, be as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, a7 as createTextVNode, k as createVNode, j as unref, bn as script, l as script$1, b5 as electronAPI } from "./index-DqqhYDnY.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.js"; +import { d as defineComponent, aV as useToast, I as useI18n, T as ref, bi as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, a8 as createTextVNode, k as createVNode, j as unref, br as script, l as script$1, b9 as electronAPI } from "./index-DqXp9vW4.js"; const _hoisted_1 = { class: "h-full p-8 2xl:p-16 flex flex-col items-center justify-center" }; const _hoisted_2 = { class: "bg-neutral-800 rounded-lg shadow-lg p-6 w-full max-w-[600px] flex flex-col gap-6" }; const _hoisted_3 = { class: "text-3xl font-semibold text-neutral-100" }; @@ -83,4 +83,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=MetricsConsentView-B5NlgqrS.js.map +//# sourceMappingURL=MetricsConsentView-DK20ednB.js.map diff --git a/web/assets/NotSupportedView-BUpntA4x.js b/web/assets/NotSupportedView-BzM0uuqA.js similarity index 95% rename from web/assets/NotSupportedView-BUpntA4x.js rename to web/assets/NotSupportedView-BzM0uuqA.js index 51a34c8a1..532b19abf 100644 --- a/web/assets/NotSupportedView-BUpntA4x.js +++ b/web/assets/NotSupportedView-BzM0uuqA.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, be as useRouter, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, i as withDirectives, _ as _export_sfc } from "./index-DqqhYDnY.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.js"; +import { d as defineComponent, bi as useRouter, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, i as withDirectives, _ as _export_sfc } from "./index-DqXp9vW4.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.js"; const _imports_0 = "" + new URL("images/sad_girl.png", import.meta.url).href; const _hoisted_1 = { class: "sad-container" }; const _hoisted_2 = { class: "no-drag sad-text flex items-center" }; @@ -83,4 +83,4 @@ const NotSupportedView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", " export { NotSupportedView as default }; -//# sourceMappingURL=NotSupportedView-BUpntA4x.js.map +//# sourceMappingURL=NotSupportedView-BzM0uuqA.js.map diff --git a/web/assets/ServerConfigPanel-B1lI5M9c.js b/web/assets/ServerConfigPanel-D0jTW_iX.js similarity index 94% rename from web/assets/ServerConfigPanel-B1lI5M9c.js rename to web/assets/ServerConfigPanel-D0jTW_iX.js index 6a8c27a8d..cd7194db4 100644 --- a/web/assets/ServerConfigPanel-B1lI5M9c.js +++ b/web/assets/ServerConfigPanel-D0jTW_iX.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { o as openBlock, f as createElementBlock, m as createBaseVNode, H as markRaw, d as defineComponent, a as useSettingStore, ae as storeToRefs, O as watch, dy as useCopyToClipboard, K as useI18n, y as createBlock, z as withCtx, j as unref, bj as script, E as toDisplayString, D as renderList, F as Fragment, k as createVNode, l as script$1, B as createCommentVNode, bh as script$2, dz as FormItem, dn as _sfc_main$1, b5 as electronAPI } from "./index-DqqhYDnY.js"; -import { u as useServerConfigStore } from "./serverConfigStore-Kb5DJVFt.js"; +import { o as openBlock, f as createElementBlock, m as createBaseVNode, H as markRaw, d as defineComponent, a as useSettingStore, af as storeToRefs, N as watch, dJ as useCopyToClipboard, I as useI18n, y as createBlock, z as withCtx, j as unref, bn as script, E as toDisplayString, D as renderList, F as Fragment, k as createVNode, l as script$1, B as createCommentVNode, bl as script$2, dK as FormItem, dz as _sfc_main$1, b9 as electronAPI } from "./index-DqXp9vW4.js"; +import { u as useServerConfigStore } from "./serverConfigStore-C8uoM7Sm.js"; const _hoisted_1$1 = { viewBox: "0 0 24 24", width: "1.2em", @@ -153,4 +153,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ServerConfigPanel-B1lI5M9c.js.map +//# sourceMappingURL=ServerConfigPanel-D0jTW_iX.js.map diff --git a/web/assets/ServerStartView-BpH4TXPO.js b/web/assets/ServerStartView-BENqs5bD.js similarity index 92% rename from web/assets/ServerStartView-BpH4TXPO.js rename to web/assets/ServerStartView-BENqs5bD.js index 6796222b9..2e154ee90 100644 --- a/web/assets/ServerStartView-BpH4TXPO.js +++ b/web/assets/ServerStartView-BENqs5bD.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, K as useI18n, U as ref, bk as ProgressStatus, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, a7 as createTextVNode, E as toDisplayString, j as unref, f as createElementBlock, B as createCommentVNode, k as createVNode, l as script, i as withDirectives, v as vShow, bl as BaseTerminal, b5 as electronAPI, _ as _export_sfc } from "./index-DqqhYDnY.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.js"; +import { d as defineComponent, I as useI18n, T as ref, bo as ProgressStatus, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, a8 as createTextVNode, E as toDisplayString, j as unref, f as createElementBlock, B as createCommentVNode, k as createVNode, l as script, i as withDirectives, v as vShow, bp as BaseTerminal, b9 as electronAPI, _ as _export_sfc } from "./index-DqXp9vW4.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.js"; const _hoisted_1 = { class: "flex flex-col w-full h-full items-center" }; const _hoisted_2 = { class: "text-2xl font-bold" }; const _hoisted_3 = { key: 0 }; @@ -93,8 +93,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ }; } }); -const ServerStartView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4140d62b"]]); +const ServerStartView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e6ba9633"]]); export { ServerStartView as default }; -//# sourceMappingURL=ServerStartView-BpH4TXPO.js.map +//# sourceMappingURL=ServerStartView-BENqs5bD.js.map diff --git a/web/assets/ServerStartView-CJiwVDQY.css b/web/assets/ServerStartView-BZ7uhZHv.css similarity index 64% rename from web/assets/ServerStartView-CJiwVDQY.css rename to web/assets/ServerStartView-BZ7uhZHv.css index 7d53a927c..778134b72 100644 --- a/web/assets/ServerStartView-CJiwVDQY.css +++ b/web/assets/ServerStartView-BZ7uhZHv.css @@ -1,5 +1,5 @@ -[data-v-4140d62b] .xterm-helper-textarea { +[data-v-e6ba9633] .xterm-helper-textarea { /* Hide this as it moves all over when uv is running */ display: none; } diff --git a/web/assets/TerminalOutputDrawer-BgTEspHP.js b/web/assets/TerminalOutputDrawer-BgTEspHP.js new file mode 100644 index 000000000..786fe62f1 --- /dev/null +++ b/web/assets/TerminalOutputDrawer-BgTEspHP.js @@ -0,0 +1,1061 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { bG as BaseStyle, bH as script$2, bZ as ZIndex, bU as addClass, bL as focus, cy as blockBodyScroll, cA as unblockBodyScroll, cB as FocusTrap, l as script$3, ca as script$4, cl as script$5, bR as resolveComponent, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, f as createElementBlock, at as mergeProps, k as createVNode, bI as Transition, i as withDirectives, A as renderSlot, F as Fragment, m as createBaseVNode, aj as normalizeClass, E as toDisplayString, B as createCommentVNode, C as resolveDynamicComponent, dd as commonjsGlobal, de as getDefaultExportFromCjs, H as markRaw, df as xtermExports, p as onMounted, d8 as onUnmounted, d as defineComponent, bw as mergeModels, bq as useModel, bp as BaseTerminal, j as unref, b9 as electronAPI } from "./index-DqXp9vW4.js"; +var theme = /* @__PURE__ */ __name(function theme2(_ref) { + var dt = _ref.dt; + return "\n.p-drawer {\n display: flex;\n flex-direction: column;\n transform: translate3d(0px, 0px, 0px);\n position: relative;\n transition: transform 0.3s;\n background: ".concat(dt("drawer.background"), ";\n color: ").concat(dt("drawer.color"), ";\n border: 1px solid ").concat(dt("drawer.border.color"), ";\n box-shadow: ").concat(dt("drawer.shadow"), ";\n}\n\n.p-drawer-content {\n overflow-y: auto;\n flex-grow: 1;\n padding: ").concat(dt("drawer.content.padding"), ";\n}\n\n.p-drawer-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-shrink: 0;\n padding: ").concat(dt("drawer.header.padding"), ";\n}\n\n.p-drawer-footer {\n padding: ").concat(dt("drawer.footer.padding"), ";\n}\n\n.p-drawer-title {\n font-weight: ").concat(dt("drawer.title.font.weight"), ";\n font-size: ").concat(dt("drawer.title.font.size"), ";\n}\n\n.p-drawer-full .p-drawer {\n transition: none;\n transform: none;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n border-width: 1px;\n}\n\n.p-drawer-left .p-drawer-enter-from,\n.p-drawer-left .p-drawer-leave-to {\n transform: translateX(-100%);\n}\n\n.p-drawer-right .p-drawer-enter-from,\n.p-drawer-right .p-drawer-leave-to {\n transform: translateX(100%);\n}\n\n.p-drawer-top .p-drawer-enter-from,\n.p-drawer-top .p-drawer-leave-to {\n transform: translateY(-100%);\n}\n\n.p-drawer-bottom .p-drawer-enter-from,\n.p-drawer-bottom .p-drawer-leave-to {\n transform: translateY(100%);\n}\n\n.p-drawer-full .p-drawer-enter-from,\n.p-drawer-full .p-drawer-leave-to {\n opacity: 0;\n}\n\n.p-drawer-full .p-drawer-enter-active,\n.p-drawer-full .p-drawer-leave-active {\n transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n.p-drawer-left .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-end-width: 1px;\n}\n\n.p-drawer-right .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-start-width: 1px;\n}\n\n.p-drawer-top .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-end-width: 1px;\n}\n\n.p-drawer-bottom .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-start-width: 1px;\n}\n\n.p-drawer-left .p-drawer-content,\n.p-drawer-right .p-drawer-content,\n.p-drawer-top .p-drawer-content,\n.p-drawer-bottom .p-drawer-content {\n width: 100%;\n height: 100%;\n}\n\n.p-drawer-open {\n display: flex;\n}\n\n.p-drawer-mask:dir(rtl) {\n flex-direction: row-reverse;\n}\n"); +}, "theme"); +var inlineStyles = { + mask: /* @__PURE__ */ __name(function mask(_ref2) { + var position = _ref2.position, modal = _ref2.modal; + return { + position: "fixed", + height: "100%", + width: "100%", + left: 0, + top: 0, + display: "flex", + justifyContent: position === "left" ? "flex-start" : position === "right" ? "flex-end" : "center", + alignItems: position === "top" ? "flex-start" : position === "bottom" ? "flex-end" : "center", + pointerEvents: modal ? "auto" : "none" + }; + }, "mask"), + root: { + pointerEvents: "auto" + } +}; +var classes = { + mask: /* @__PURE__ */ __name(function mask2(_ref3) { + var instance = _ref3.instance, props = _ref3.props; + var positions = ["left", "right", "top", "bottom"]; + var pos = positions.find(function(item) { + return item === props.position; + }); + return ["p-drawer-mask", { + "p-overlay-mask p-overlay-mask-enter": props.modal, + "p-drawer-open": instance.containerVisible, + "p-drawer-full": instance.fullScreen + }, pos ? "p-drawer-".concat(pos) : ""]; + }, "mask"), + root: /* @__PURE__ */ __name(function root(_ref4) { + var instance = _ref4.instance; + return ["p-drawer p-component", { + "p-drawer-full": instance.fullScreen + }]; + }, "root"), + header: "p-drawer-header", + title: "p-drawer-title", + pcCloseButton: "p-drawer-close-button", + content: "p-drawer-content", + footer: "p-drawer-footer" +}; +var DrawerStyle = BaseStyle.extend({ + name: "drawer", + theme, + classes, + inlineStyles +}); +var script$1 = { + name: "BaseDrawer", + "extends": script$2, + props: { + visible: { + type: Boolean, + "default": false + }, + position: { + type: String, + "default": "left" + }, + header: { + type: null, + "default": null + }, + baseZIndex: { + type: Number, + "default": 0 + }, + autoZIndex: { + type: Boolean, + "default": true + }, + dismissable: { + type: Boolean, + "default": true + }, + showCloseIcon: { + type: Boolean, + "default": true + }, + closeButtonProps: { + type: Object, + "default": /* @__PURE__ */ __name(function _default() { + return { + severity: "secondary", + text: true, + rounded: true + }; + }, "_default") + }, + closeIcon: { + type: String, + "default": void 0 + }, + modal: { + type: Boolean, + "default": true + }, + blockScroll: { + type: Boolean, + "default": false + } + }, + style: DrawerStyle, + provide: /* @__PURE__ */ __name(function provide() { + return { + $pcDrawer: this, + $parentInstance: this + }; + }, "provide") +}; +var script = { + name: "Drawer", + "extends": script$1, + inheritAttrs: false, + emits: ["update:visible", "show", "after-show", "hide", "after-hide"], + data: /* @__PURE__ */ __name(function data() { + return { + containerVisible: this.visible + }; + }, "data"), + container: null, + mask: null, + content: null, + headerContainer: null, + footerContainer: null, + closeButton: null, + outsideClickListener: null, + documentKeydownListener: null, + watch: { + dismissable: /* @__PURE__ */ __name(function dismissable(newValue) { + if (newValue) { + this.enableDocumentSettings(); + } else { + this.disableDocumentSettings(); + } + }, "dismissable") + }, + updated: /* @__PURE__ */ __name(function updated() { + if (this.visible) { + this.containerVisible = this.visible; + } + }, "updated"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount() { + this.disableDocumentSettings(); + if (this.mask && this.autoZIndex) { + ZIndex.clear(this.mask); + } + this.container = null; + this.mask = null; + }, "beforeUnmount"), + methods: { + hide: /* @__PURE__ */ __name(function hide() { + this.$emit("update:visible", false); + }, "hide"), + onEnter: /* @__PURE__ */ __name(function onEnter() { + this.$emit("show"); + this.focus(); + this.bindDocumentKeyDownListener(); + if (this.autoZIndex) { + ZIndex.set("modal", this.mask, this.baseZIndex || this.$primevue.config.zIndex.modal); + } + }, "onEnter"), + onAfterEnter: /* @__PURE__ */ __name(function onAfterEnter() { + this.enableDocumentSettings(); + this.$emit("after-show"); + }, "onAfterEnter"), + onBeforeLeave: /* @__PURE__ */ __name(function onBeforeLeave() { + if (this.modal) { + !this.isUnstyled && addClass(this.mask, "p-overlay-mask-leave"); + } + }, "onBeforeLeave"), + onLeave: /* @__PURE__ */ __name(function onLeave() { + this.$emit("hide"); + }, "onLeave"), + onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave() { + if (this.autoZIndex) { + ZIndex.clear(this.mask); + } + this.unbindDocumentKeyDownListener(); + this.containerVisible = false; + this.disableDocumentSettings(); + this.$emit("after-hide"); + }, "onAfterLeave"), + onMaskClick: /* @__PURE__ */ __name(function onMaskClick(event) { + if (this.dismissable && this.modal && this.mask === event.target) { + this.hide(); + } + }, "onMaskClick"), + focus: /* @__PURE__ */ __name(function focus$1() { + var findFocusableElement = /* @__PURE__ */ __name(function findFocusableElement2(container) { + return container && container.querySelector("[autofocus]"); + }, "findFocusableElement"); + var focusTarget = this.$slots.header && findFocusableElement(this.headerContainer); + if (!focusTarget) { + focusTarget = this.$slots["default"] && findFocusableElement(this.container); + if (!focusTarget) { + focusTarget = this.$slots.footer && findFocusableElement(this.footerContainer); + if (!focusTarget) { + focusTarget = this.closeButton; + } + } + } + focusTarget && focus(focusTarget); + }, "focus$1"), + enableDocumentSettings: /* @__PURE__ */ __name(function enableDocumentSettings() { + if (this.dismissable && !this.modal) { + this.bindOutsideClickListener(); + } + if (this.blockScroll) { + blockBodyScroll(); + } + }, "enableDocumentSettings"), + disableDocumentSettings: /* @__PURE__ */ __name(function disableDocumentSettings() { + this.unbindOutsideClickListener(); + if (this.blockScroll) { + unblockBodyScroll(); + } + }, "disableDocumentSettings"), + onKeydown: /* @__PURE__ */ __name(function onKeydown(event) { + if (event.code === "Escape") { + this.hide(); + } + }, "onKeydown"), + containerRef: /* @__PURE__ */ __name(function containerRef(el) { + this.container = el; + }, "containerRef"), + maskRef: /* @__PURE__ */ __name(function maskRef(el) { + this.mask = el; + }, "maskRef"), + contentRef: /* @__PURE__ */ __name(function contentRef(el) { + this.content = el; + }, "contentRef"), + headerContainerRef: /* @__PURE__ */ __name(function headerContainerRef(el) { + this.headerContainer = el; + }, "headerContainerRef"), + footerContainerRef: /* @__PURE__ */ __name(function footerContainerRef(el) { + this.footerContainer = el; + }, "footerContainerRef"), + closeButtonRef: /* @__PURE__ */ __name(function closeButtonRef(el) { + this.closeButton = el ? el.$el : void 0; + }, "closeButtonRef"), + bindDocumentKeyDownListener: /* @__PURE__ */ __name(function bindDocumentKeyDownListener() { + if (!this.documentKeydownListener) { + this.documentKeydownListener = this.onKeydown; + document.addEventListener("keydown", this.documentKeydownListener); + } + }, "bindDocumentKeyDownListener"), + unbindDocumentKeyDownListener: /* @__PURE__ */ __name(function unbindDocumentKeyDownListener() { + if (this.documentKeydownListener) { + document.removeEventListener("keydown", this.documentKeydownListener); + this.documentKeydownListener = null; + } + }, "unbindDocumentKeyDownListener"), + bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener() { + var _this = this; + if (!this.outsideClickListener) { + this.outsideClickListener = function(event) { + if (_this.isOutsideClicked(event)) { + _this.hide(); + } + }; + document.addEventListener("click", this.outsideClickListener); + } + }, "bindOutsideClickListener"), + unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener() { + if (this.outsideClickListener) { + document.removeEventListener("click", this.outsideClickListener); + this.outsideClickListener = null; + } + }, "unbindOutsideClickListener"), + isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked(event) { + return this.container && !this.container.contains(event.target); + }, "isOutsideClicked") + }, + computed: { + fullScreen: /* @__PURE__ */ __name(function fullScreen() { + return this.position === "full"; + }, "fullScreen"), + closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : void 0; + }, "closeAriaLabel") + }, + directives: { + focustrap: FocusTrap + }, + components: { + Button: script$3, + Portal: script$4, + TimesIcon: script$5 + } +}; +var _hoisted_1 = ["aria-modal"]; +function render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Button = resolveComponent("Button"); + var _component_Portal = resolveComponent("Portal"); + var _directive_focustrap = resolveDirective("focustrap"); + return openBlock(), createBlock(_component_Portal, null, { + "default": withCtx(function() { + return [$data.containerVisible ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: $options.maskRef, + onMousedown: _cache[0] || (_cache[0] = function() { + return $options.onMaskClick && $options.onMaskClick.apply($options, arguments); + }), + "class": _ctx.cx("mask"), + style: _ctx.sx("mask", true, { + position: _ctx.position, + modal: _ctx.modal + }) + }, _ctx.ptm("mask")), [createVNode(Transition, mergeProps({ + name: "p-drawer", + onEnter: $options.onEnter, + onAfterEnter: $options.onAfterEnter, + onBeforeLeave: $options.onBeforeLeave, + onLeave: $options.onLeave, + onAfterLeave: $options.onAfterLeave, + appear: "" + }, _ctx.ptm("transition")), { + "default": withCtx(function() { + return [_ctx.visible ? withDirectives((openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: $options.containerRef, + "class": _ctx.cx("root"), + style: _ctx.sx("root"), + role: "complementary", + "aria-modal": _ctx.modal + }, _ctx.ptmi("root")), [_ctx.$slots.container ? renderSlot(_ctx.$slots, "container", { + key: 0, + closeCallback: $options.hide + }) : (openBlock(), createElementBlock(Fragment, { + key: 1 + }, [createBaseVNode("div", mergeProps({ + ref: $options.headerContainerRef, + "class": _ctx.cx("header") + }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header", { + "class": normalizeClass(_ctx.cx("title")) + }, function() { + return [_ctx.header ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + "class": _ctx.cx("title") + }, _ctx.ptm("title")), toDisplayString(_ctx.header), 17)) : createCommentVNode("", true)]; + }), _ctx.showCloseIcon ? (openBlock(), createBlock(_component_Button, mergeProps({ + key: 0, + ref: $options.closeButtonRef, + type: "button", + "class": _ctx.cx("pcCloseButton"), + "aria-label": $options.closeAriaLabel, + unstyled: _ctx.unstyled, + onClick: $options.hide + }, _ctx.closeButtonProps, { + pt: _ctx.ptm("pcCloseButton"), + "data-pc-group-section": "iconcontainer" + }), { + icon: withCtx(function(slotProps) { + return [renderSlot(_ctx.$slots, "closeicon", {}, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon ? "span" : "TimesIcon"), mergeProps({ + "class": [_ctx.closeIcon, slotProps["class"]] + }, _ctx.ptm("pcCloseButton")["icon"]), null, 16, ["class"]))]; + })]; + }), + _: 3 + }, 16, ["class", "aria-label", "unstyled", "onClick", "pt"])) : createCommentVNode("", true)], 16), createBaseVNode("div", mergeProps({ + ref: $options.contentRef, + "class": _ctx.cx("content") + }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", mergeProps({ + key: 0, + ref: $options.footerContainerRef, + "class": _ctx.cx("footer") + }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true)], 64))], 16, _hoisted_1)), [[_directive_focustrap]]) : createCommentVNode("", true)]; + }), + _: 3 + }, 16, ["onEnter", "onAfterEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])], 16)) : createCommentVNode("", true)]; + }), + _: 3 + }); +} +__name(render, "render"); +script.render = render; +var addonSerialize$2 = { exports: {} }; +var addonSerialize = addonSerialize$2.exports; +(function(module, exports) { + !function(e, t) { + true ? module.exports = t() : false ? (void 0)([], t) : true ? exports.SerializeAddon = t() : e.SerializeAddon = t(); + }(commonjsGlobal, () => (() => { + "use strict"; + var e = { 930: (e2, t2, s2) => { + Object.defineProperty(t2, "__esModule", { value: true }), t2.ColorContrastCache = void 0; + const r2 = s2(485); + t2.ColorContrastCache = class { + constructor() { + this._color = new r2.TwoKeyMap(), this._css = new r2.TwoKeyMap(); + } + setCss(e3, t3, s3) { + this._css.set(e3, t3, s3); + } + getCss(e3, t3) { + return this._css.get(e3, t3); + } + setColor(e3, t3, s3) { + this._color.set(e3, t3, s3); + } + getColor(e3, t3) { + return this._color.get(e3, t3); + } + clear() { + this._color.clear(), this._css.clear(); + } + }; + }, 997: function(e2, t2, s2) { + var r2 = this && this.__decorate || function(e3, t3, s3, r3) { + var o2, i2 = arguments.length, n2 = i2 < 3 ? t3 : null === r3 ? r3 = Object.getOwnPropertyDescriptor(t3, s3) : r3; + if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n2 = Reflect.decorate(e3, t3, s3, r3); + else for (var l2 = e3.length - 1; l2 >= 0; l2--) (o2 = e3[l2]) && (n2 = (i2 < 3 ? o2(n2) : i2 > 3 ? o2(t3, s3, n2) : o2(t3, s3)) || n2); + return i2 > 3 && n2 && Object.defineProperty(t3, s3, n2), n2; + }, o = this && this.__param || function(e3, t3) { + return function(s3, r3) { + t3(s3, r3, e3); + }; + }; + Object.defineProperty(t2, "__esModule", { value: true }), t2.ThemeService = t2.DEFAULT_ANSI_COLORS = void 0; + const i = s2(930), n = s2(160), l = s2(345), a = s2(859), c = s2(97), h = n.css.toColor("#ffffff"), u = n.css.toColor("#000000"), _ = n.css.toColor("#ffffff"), d = n.css.toColor("#000000"), C = { css: "rgba(255, 255, 255, 0.3)", rgba: 4294967117 }; + t2.DEFAULT_ANSI_COLORS = Object.freeze((() => { + const e3 = [n.css.toColor("#2e3436"), n.css.toColor("#cc0000"), n.css.toColor("#4e9a06"), n.css.toColor("#c4a000"), n.css.toColor("#3465a4"), n.css.toColor("#75507b"), n.css.toColor("#06989a"), n.css.toColor("#d3d7cf"), n.css.toColor("#555753"), n.css.toColor("#ef2929"), n.css.toColor("#8ae234"), n.css.toColor("#fce94f"), n.css.toColor("#729fcf"), n.css.toColor("#ad7fa8"), n.css.toColor("#34e2e2"), n.css.toColor("#eeeeec")], t3 = [0, 95, 135, 175, 215, 255]; + for (let s3 = 0; s3 < 216; s3++) { + const r3 = t3[s3 / 36 % 6 | 0], o2 = t3[s3 / 6 % 6 | 0], i2 = t3[s3 % 6]; + e3.push({ css: n.channels.toCss(r3, o2, i2), rgba: n.channels.toRgba(r3, o2, i2) }); + } + for (let t4 = 0; t4 < 24; t4++) { + const s3 = 8 + 10 * t4; + e3.push({ css: n.channels.toCss(s3, s3, s3), rgba: n.channels.toRgba(s3, s3, s3) }); + } + return e3; + })()); + let f = t2.ThemeService = class extends a.Disposable { + get colors() { + return this._colors; + } + constructor(e3) { + super(), this._optionsService = e3, this._contrastCache = new i.ColorContrastCache(), this._halfContrastCache = new i.ColorContrastCache(), this._onChangeColors = this.register(new l.EventEmitter()), this.onChangeColors = this._onChangeColors.event, this._colors = { foreground: h, background: u, cursor: _, cursorAccent: d, selectionForeground: void 0, selectionBackgroundTransparent: C, selectionBackgroundOpaque: n.color.blend(u, C), selectionInactiveBackgroundTransparent: C, selectionInactiveBackgroundOpaque: n.color.blend(u, C), ansi: t2.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(e3 = {}) { + const s3 = this._colors; + if (s3.foreground = g(e3.foreground, h), s3.background = g(e3.background, u), s3.cursor = g(e3.cursor, _), s3.cursorAccent = g(e3.cursorAccent, d), s3.selectionBackgroundTransparent = g(e3.selectionBackground, C), s3.selectionBackgroundOpaque = n.color.blend(s3.background, s3.selectionBackgroundTransparent), s3.selectionInactiveBackgroundTransparent = g(e3.selectionInactiveBackground, s3.selectionBackgroundTransparent), s3.selectionInactiveBackgroundOpaque = n.color.blend(s3.background, s3.selectionInactiveBackgroundTransparent), s3.selectionForeground = e3.selectionForeground ? g(e3.selectionForeground, n.NULL_COLOR) : void 0, s3.selectionForeground === n.NULL_COLOR && (s3.selectionForeground = void 0), n.color.isOpaque(s3.selectionBackgroundTransparent)) { + const e4 = 0.3; + s3.selectionBackgroundTransparent = n.color.opacity(s3.selectionBackgroundTransparent, e4); + } + if (n.color.isOpaque(s3.selectionInactiveBackgroundTransparent)) { + const e4 = 0.3; + s3.selectionInactiveBackgroundTransparent = n.color.opacity(s3.selectionInactiveBackgroundTransparent, e4); + } + if (s3.ansi = t2.DEFAULT_ANSI_COLORS.slice(), s3.ansi[0] = g(e3.black, t2.DEFAULT_ANSI_COLORS[0]), s3.ansi[1] = g(e3.red, t2.DEFAULT_ANSI_COLORS[1]), s3.ansi[2] = g(e3.green, t2.DEFAULT_ANSI_COLORS[2]), s3.ansi[3] = g(e3.yellow, t2.DEFAULT_ANSI_COLORS[3]), s3.ansi[4] = g(e3.blue, t2.DEFAULT_ANSI_COLORS[4]), s3.ansi[5] = g(e3.magenta, t2.DEFAULT_ANSI_COLORS[5]), s3.ansi[6] = g(e3.cyan, t2.DEFAULT_ANSI_COLORS[6]), s3.ansi[7] = g(e3.white, t2.DEFAULT_ANSI_COLORS[7]), s3.ansi[8] = g(e3.brightBlack, t2.DEFAULT_ANSI_COLORS[8]), s3.ansi[9] = g(e3.brightRed, t2.DEFAULT_ANSI_COLORS[9]), s3.ansi[10] = g(e3.brightGreen, t2.DEFAULT_ANSI_COLORS[10]), s3.ansi[11] = g(e3.brightYellow, t2.DEFAULT_ANSI_COLORS[11]), s3.ansi[12] = g(e3.brightBlue, t2.DEFAULT_ANSI_COLORS[12]), s3.ansi[13] = g(e3.brightMagenta, t2.DEFAULT_ANSI_COLORS[13]), s3.ansi[14] = g(e3.brightCyan, t2.DEFAULT_ANSI_COLORS[14]), s3.ansi[15] = g(e3.brightWhite, t2.DEFAULT_ANSI_COLORS[15]), e3.extendedAnsi) { + const r3 = Math.min(s3.ansi.length - 16, e3.extendedAnsi.length); + for (let o2 = 0; o2 < r3; o2++) s3.ansi[o2 + 16] = g(e3.extendedAnsi[o2], t2.DEFAULT_ANSI_COLORS[o2 + 16]); + } + this._contrastCache.clear(), this._halfContrastCache.clear(), this._updateRestoreColors(), this._onChangeColors.fire(this.colors); + } + restoreColor(e3) { + this._restoreColor(e3), this._onChangeColors.fire(this.colors); + } + _restoreColor(e3) { + if (void 0 !== e3) switch (e3) { + case 256: + this._colors.foreground = this._restoreColors.foreground; + break; + case 257: + this._colors.background = this._restoreColors.background; + break; + case 258: + this._colors.cursor = this._restoreColors.cursor; + break; + default: + this._colors.ansi[e3] = this._restoreColors.ansi[e3]; + } + else for (let e4 = 0; e4 < this._restoreColors.ansi.length; ++e4) this._colors.ansi[e4] = this._restoreColors.ansi[e4]; + } + modifyColors(e3) { + e3(this._colors), this._onChangeColors.fire(this.colors); + } + _updateRestoreColors() { + this._restoreColors = { foreground: this._colors.foreground, background: this._colors.background, cursor: this._colors.cursor, ansi: this._colors.ansi.slice() }; + } + }; + function g(e3, t3) { + if (void 0 !== e3) try { + return n.css.toColor(e3); + } catch { + } + return t3; + } + __name(g, "g"); + t2.ThemeService = f = r2([o(0, c.IOptionsService)], f); + }, 160: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), t2.contrastRatio = t2.toPaddedHex = t2.rgba = t2.rgb = t2.css = t2.color = t2.channels = t2.NULL_COLOR = void 0; + let s2 = 0, r2 = 0, o = 0, i = 0; + var n, l, a, c, h; + function u(e3) { + const t3 = e3.toString(16); + return t3.length < 2 ? "0" + t3 : t3; + } + __name(u, "u"); + function _(e3, t3) { + return e3 < t3 ? (t3 + 0.05) / (e3 + 0.05) : (e3 + 0.05) / (t3 + 0.05); + } + __name(_, "_"); + t2.NULL_COLOR = { css: "#00000000", rgba: 0 }, function(e3) { + e3.toCss = function(e4, t3, s3, r3) { + return void 0 !== r3 ? `#${u(e4)}${u(t3)}${u(s3)}${u(r3)}` : `#${u(e4)}${u(t3)}${u(s3)}`; + }, e3.toRgba = function(e4, t3, s3, r3 = 255) { + return (e4 << 24 | t3 << 16 | s3 << 8 | r3) >>> 0; + }, e3.toColor = function(t3, s3, r3, o2) { + return { css: e3.toCss(t3, s3, r3, o2), rgba: e3.toRgba(t3, s3, r3, o2) }; + }; + }(n || (t2.channels = n = {})), function(e3) { + function t3(e4, t4) { + return i = Math.round(255 * t4), [s2, r2, o] = h.toChannels(e4.rgba), { css: n.toCss(s2, r2, o, i), rgba: n.toRgba(s2, r2, o, i) }; + } + __name(t3, "t"); + e3.blend = function(e4, t4) { + if (i = (255 & t4.rgba) / 255, 1 === i) return { css: t4.css, rgba: t4.rgba }; + const l2 = t4.rgba >> 24 & 255, a2 = t4.rgba >> 16 & 255, c2 = t4.rgba >> 8 & 255, h2 = e4.rgba >> 24 & 255, u2 = e4.rgba >> 16 & 255, _2 = e4.rgba >> 8 & 255; + return s2 = h2 + Math.round((l2 - h2) * i), r2 = u2 + Math.round((a2 - u2) * i), o = _2 + Math.round((c2 - _2) * i), { css: n.toCss(s2, r2, o), rgba: n.toRgba(s2, r2, o) }; + }, e3.isOpaque = function(e4) { + return 255 == (255 & e4.rgba); + }, e3.ensureContrastRatio = function(e4, t4, s3) { + const r3 = h.ensureContrastRatio(e4.rgba, t4.rgba, s3); + if (r3) return n.toColor(r3 >> 24 & 255, r3 >> 16 & 255, r3 >> 8 & 255); + }, e3.opaque = function(e4) { + const t4 = (255 | e4.rgba) >>> 0; + return [s2, r2, o] = h.toChannels(t4), { css: n.toCss(s2, r2, o), rgba: t4 }; + }, e3.opacity = t3, e3.multiplyOpacity = function(e4, s3) { + return i = 255 & e4.rgba, t3(e4, i * s3 / 255); + }, e3.toColorRGB = function(e4) { + return [e4.rgba >> 24 & 255, e4.rgba >> 16 & 255, e4.rgba >> 8 & 255]; + }; + }(l || (t2.color = l = {})), function(e3) { + let t3, l2; + try { + const e4 = document.createElement("canvas"); + e4.width = 1, e4.height = 1; + const s3 = e4.getContext("2d", { willReadFrequently: true }); + s3 && (t3 = s3, t3.globalCompositeOperation = "copy", l2 = t3.createLinearGradient(0, 0, 1, 1)); + } catch { + } + e3.toColor = function(e4) { + if (e4.match(/#[\da-f]{3,8}/i)) switch (e4.length) { + case 4: + return s2 = parseInt(e4.slice(1, 2).repeat(2), 16), r2 = parseInt(e4.slice(2, 3).repeat(2), 16), o = parseInt(e4.slice(3, 4).repeat(2), 16), n.toColor(s2, r2, o); + case 5: + return s2 = parseInt(e4.slice(1, 2).repeat(2), 16), r2 = parseInt(e4.slice(2, 3).repeat(2), 16), o = parseInt(e4.slice(3, 4).repeat(2), 16), i = parseInt(e4.slice(4, 5).repeat(2), 16), n.toColor(s2, r2, o, i); + case 7: + return { css: e4, rgba: (parseInt(e4.slice(1), 16) << 8 | 255) >>> 0 }; + case 9: + return { css: e4, rgba: parseInt(e4.slice(1), 16) >>> 0 }; + } + const a2 = e4.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/); + if (a2) return s2 = parseInt(a2[1]), r2 = parseInt(a2[2]), o = parseInt(a2[3]), i = Math.round(255 * (void 0 === a2[5] ? 1 : parseFloat(a2[5]))), n.toColor(s2, r2, o, i); + if (!t3 || !l2) throw new Error("css.toColor: Unsupported css format"); + if (t3.fillStyle = l2, t3.fillStyle = e4, "string" != typeof t3.fillStyle) throw new Error("css.toColor: Unsupported css format"); + if (t3.fillRect(0, 0, 1, 1), [s2, r2, o, i] = t3.getImageData(0, 0, 1, 1).data, 255 !== i) throw new Error("css.toColor: Unsupported css format"); + return { rgba: n.toRgba(s2, r2, o, i), css: e4 }; + }; + }(a || (t2.css = a = {})), function(e3) { + function t3(e4, t4, s3) { + const r3 = e4 / 255, o2 = t4 / 255, i2 = s3 / 255; + return 0.2126 * (r3 <= 0.03928 ? r3 / 12.92 : Math.pow((r3 + 0.055) / 1.055, 2.4)) + 0.7152 * (o2 <= 0.03928 ? o2 / 12.92 : Math.pow((o2 + 0.055) / 1.055, 2.4)) + 0.0722 * (i2 <= 0.03928 ? i2 / 12.92 : Math.pow((i2 + 0.055) / 1.055, 2.4)); + } + __name(t3, "t"); + e3.relativeLuminance = function(e4) { + return t3(e4 >> 16 & 255, e4 >> 8 & 255, 255 & e4); + }, e3.relativeLuminance2 = t3; + }(c || (t2.rgb = c = {})), function(e3) { + function t3(e4, t4, s3) { + const r3 = e4 >> 24 & 255, o2 = e4 >> 16 & 255, i2 = e4 >> 8 & 255; + let n2 = t4 >> 24 & 255, l3 = t4 >> 16 & 255, a2 = t4 >> 8 & 255, h2 = _(c.relativeLuminance2(n2, l3, a2), c.relativeLuminance2(r3, o2, i2)); + for (; h2 < s3 && (n2 > 0 || l3 > 0 || a2 > 0); ) n2 -= Math.max(0, Math.ceil(0.1 * n2)), l3 -= Math.max(0, Math.ceil(0.1 * l3)), a2 -= Math.max(0, Math.ceil(0.1 * a2)), h2 = _(c.relativeLuminance2(n2, l3, a2), c.relativeLuminance2(r3, o2, i2)); + return (n2 << 24 | l3 << 16 | a2 << 8 | 255) >>> 0; + } + __name(t3, "t"); + function l2(e4, t4, s3) { + const r3 = e4 >> 24 & 255, o2 = e4 >> 16 & 255, i2 = e4 >> 8 & 255; + let n2 = t4 >> 24 & 255, l3 = t4 >> 16 & 255, a2 = t4 >> 8 & 255, h2 = _(c.relativeLuminance2(n2, l3, a2), c.relativeLuminance2(r3, o2, i2)); + for (; h2 < s3 && (n2 < 255 || l3 < 255 || a2 < 255); ) n2 = Math.min(255, n2 + Math.ceil(0.1 * (255 - n2))), l3 = Math.min(255, l3 + Math.ceil(0.1 * (255 - l3))), a2 = Math.min(255, a2 + Math.ceil(0.1 * (255 - a2))), h2 = _(c.relativeLuminance2(n2, l3, a2), c.relativeLuminance2(r3, o2, i2)); + return (n2 << 24 | l3 << 16 | a2 << 8 | 255) >>> 0; + } + __name(l2, "l"); + e3.blend = function(e4, t4) { + if (i = (255 & t4) / 255, 1 === i) return t4; + const l3 = t4 >> 24 & 255, a2 = t4 >> 16 & 255, c2 = t4 >> 8 & 255, h2 = e4 >> 24 & 255, u2 = e4 >> 16 & 255, _2 = e4 >> 8 & 255; + return s2 = h2 + Math.round((l3 - h2) * i), r2 = u2 + Math.round((a2 - u2) * i), o = _2 + Math.round((c2 - _2) * i), n.toRgba(s2, r2, o); + }, e3.ensureContrastRatio = function(e4, s3, r3) { + const o2 = c.relativeLuminance(e4 >> 8), i2 = c.relativeLuminance(s3 >> 8); + if (_(o2, i2) < r3) { + if (i2 < o2) { + const i3 = t3(e4, s3, r3), n3 = _(o2, c.relativeLuminance(i3 >> 8)); + if (n3 < r3) { + const t4 = l2(e4, s3, r3); + return n3 > _(o2, c.relativeLuminance(t4 >> 8)) ? i3 : t4; + } + return i3; + } + const n2 = l2(e4, s3, r3), a2 = _(o2, c.relativeLuminance(n2 >> 8)); + if (a2 < r3) { + const i3 = t3(e4, s3, r3); + return a2 > _(o2, c.relativeLuminance(i3 >> 8)) ? n2 : i3; + } + return n2; + } + }, e3.reduceLuminance = t3, e3.increaseLuminance = l2, e3.toChannels = function(e4) { + return [e4 >> 24 & 255, e4 >> 16 & 255, e4 >> 8 & 255, 255 & e4]; + }; + }(h || (t2.rgba = h = {})), t2.toPaddedHex = u, t2.contrastRatio = _; + }, 345: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), t2.runAndSubscribe = t2.forwardEvent = t2.EventEmitter = void 0, t2.EventEmitter = class { + constructor() { + this._listeners = [], this._disposed = false; + } + get event() { + return this._event || (this._event = (e3) => (this._listeners.push(e3), { dispose: /* @__PURE__ */ __name(() => { + if (!this._disposed) { + for (let t3 = 0; t3 < this._listeners.length; t3++) if (this._listeners[t3] === e3) return void this._listeners.splice(t3, 1); + } + }, "dispose") })), this._event; + } + fire(e3, t3) { + const s2 = []; + for (let e4 = 0; e4 < this._listeners.length; e4++) s2.push(this._listeners[e4]); + for (let r2 = 0; r2 < s2.length; r2++) s2[r2].call(void 0, e3, t3); + } + dispose() { + this.clearListeners(), this._disposed = true; + } + clearListeners() { + this._listeners && (this._listeners.length = 0); + } + }, t2.forwardEvent = function(e3, t3) { + return e3((e4) => t3.fire(e4)); + }, t2.runAndSubscribe = function(e3, t3) { + return t3(void 0), e3((e4) => t3(e4)); + }; + }, 859: (e2, t2) => { + function s2(e3) { + for (const t3 of e3) t3.dispose(); + e3.length = 0; + } + __name(s2, "s"); + Object.defineProperty(t2, "__esModule", { value: true }), t2.getDisposeArrayDisposable = t2.disposeArray = t2.toDisposable = t2.MutableDisposable = t2.Disposable = void 0, t2.Disposable = class { + constructor() { + this._disposables = [], this._isDisposed = false; + } + dispose() { + this._isDisposed = true; + for (const e3 of this._disposables) e3.dispose(); + this._disposables.length = 0; + } + register(e3) { + return this._disposables.push(e3), e3; + } + unregister(e3) { + const t3 = this._disposables.indexOf(e3); + -1 !== t3 && this._disposables.splice(t3, 1); + } + }, t2.MutableDisposable = class { + constructor() { + this._isDisposed = false; + } + get value() { + return this._isDisposed ? void 0 : this._value; + } + set value(e3) { + this._isDisposed || e3 === this._value || (this._value?.dispose(), this._value = e3); + } + clear() { + this.value = void 0; + } + dispose() { + this._isDisposed = true, this._value?.dispose(), this._value = void 0; + } + }, t2.toDisposable = function(e3) { + return { dispose: e3 }; + }, t2.disposeArray = s2, t2.getDisposeArrayDisposable = function(e3) { + return { dispose: /* @__PURE__ */ __name(() => s2(e3), "dispose") }; + }; + }, 485: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), t2.FourKeyMap = t2.TwoKeyMap = void 0; + class s2 { + static { + __name(this, "s"); + } + constructor() { + this._data = {}; + } + set(e3, t3, s3) { + this._data[e3] || (this._data[e3] = {}), this._data[e3][t3] = s3; + } + get(e3, t3) { + return this._data[e3] ? this._data[e3][t3] : void 0; + } + clear() { + this._data = {}; + } + } + t2.TwoKeyMap = s2, t2.FourKeyMap = class { + constructor() { + this._data = new s2(); + } + set(e3, t3, r2, o, i) { + this._data.get(e3, t3) || this._data.set(e3, t3, new s2()), this._data.get(e3, t3).set(r2, o, i); + } + get(e3, t3, s3, r2) { + return this._data.get(e3, t3)?.get(s3, r2); + } + clear() { + this._data.clear(); + } + }; + }, 726: (e2, t2) => { + Object.defineProperty(t2, "__esModule", { value: true }), t2.createDecorator = t2.getServiceDependencies = t2.serviceRegistry = void 0; + const s2 = "di$target", r2 = "di$dependencies"; + t2.serviceRegistry = /* @__PURE__ */ new Map(), t2.getServiceDependencies = function(e3) { + return e3[r2] || []; + }, t2.createDecorator = function(e3) { + if (t2.serviceRegistry.has(e3)) return t2.serviceRegistry.get(e3); + const o = /* @__PURE__ */ __name(function(e4, t3, i) { + if (3 !== arguments.length) throw new Error("@IServiceName-decorator can only be used to decorate a parameter"); + !function(e5, t4, o2) { + t4[s2] === t4 ? t4[r2].push({ id: e5, index: o2 }) : (t4[r2] = [{ id: e5, index: o2 }], t4[s2] = t4); + }(o, e4, i); + }, "o"); + return o.toString = () => e3, t2.serviceRegistry.set(e3, o), o; + }; + }, 97: (e2, t2, s2) => { + Object.defineProperty(t2, "__esModule", { value: true }), t2.IDecorationService = t2.IUnicodeService = t2.IOscLinkService = t2.IOptionsService = t2.ILogService = t2.LogLevelEnum = t2.IInstantiationService = t2.ICharsetService = t2.ICoreService = t2.ICoreMouseService = t2.IBufferService = void 0; + const r2 = s2(726); + var o; + t2.IBufferService = (0, r2.createDecorator)("BufferService"), t2.ICoreMouseService = (0, r2.createDecorator)("CoreMouseService"), t2.ICoreService = (0, r2.createDecorator)("CoreService"), t2.ICharsetService = (0, r2.createDecorator)("CharsetService"), t2.IInstantiationService = (0, r2.createDecorator)("InstantiationService"), function(e3) { + e3[e3.TRACE = 0] = "TRACE", e3[e3.DEBUG = 1] = "DEBUG", e3[e3.INFO = 2] = "INFO", e3[e3.WARN = 3] = "WARN", e3[e3.ERROR = 4] = "ERROR", e3[e3.OFF = 5] = "OFF"; + }(o || (t2.LogLevelEnum = o = {})), t2.ILogService = (0, r2.createDecorator)("LogService"), t2.IOptionsService = (0, r2.createDecorator)("OptionsService"), t2.IOscLinkService = (0, r2.createDecorator)("OscLinkService"), t2.IUnicodeService = (0, r2.createDecorator)("UnicodeService"), t2.IDecorationService = (0, r2.createDecorator)("DecorationService"); + } }, t = {}; + function s(r2) { + var o = t[r2]; + if (void 0 !== o) return o.exports; + var i = t[r2] = { exports: {} }; + return e[r2].call(i.exports, i, i.exports, s), i.exports; + } + __name(s, "s"); + var r = {}; + return (() => { + var e2 = r; + Object.defineProperty(e2, "__esModule", { value: true }), e2.HTMLSerializeHandler = e2.SerializeAddon = void 0; + const t2 = s(997); + function o(e3, t3, s2) { + return Math.max(t3, Math.min(e3, s2)); + } + __name(o, "o"); + class i { + static { + __name(this, "i"); + } + constructor(e3) { + this._buffer = e3; + } + serialize(e3, t3) { + const s2 = this._buffer.getNullCell(), r2 = this._buffer.getNullCell(); + let o2 = s2; + const i2 = e3.start.y, n2 = e3.end.y, l2 = e3.start.x, a2 = e3.end.x; + this._beforeSerialize(n2 - i2, i2, n2); + for (let t4 = i2; t4 <= n2; t4++) { + const i3 = this._buffer.getLine(t4); + if (i3) { + const n3 = t4 === e3.start.y ? l2 : 0, c2 = t4 === e3.end.y ? a2 : i3.length; + for (let e4 = n3; e4 < c2; e4++) { + const n4 = i3.getCell(e4, o2 === s2 ? r2 : s2); + n4 ? (this._nextCell(n4, o2, t4, e4), o2 = n4) : console.warn(`Can't get cell at row=${t4}, col=${e4}`); + } + } + this._rowEnd(t4, t4 === n2); + } + return this._afterSerialize(), this._serializeString(t3); + } + _nextCell(e3, t3, s2, r2) { + } + _rowEnd(e3, t3) { + } + _beforeSerialize(e3, t3, s2) { + } + _afterSerialize() { + } + _serializeString(e3) { + return ""; + } + } + function n(e3, t3) { + return e3.getFgColorMode() === t3.getFgColorMode() && e3.getFgColor() === t3.getFgColor(); + } + __name(n, "n"); + function l(e3, t3) { + return e3.getBgColorMode() === t3.getBgColorMode() && e3.getBgColor() === t3.getBgColor(); + } + __name(l, "l"); + function a(e3, t3) { + return e3.isInverse() === t3.isInverse() && e3.isBold() === t3.isBold() && e3.isUnderline() === t3.isUnderline() && e3.isOverline() === t3.isOverline() && e3.isBlink() === t3.isBlink() && e3.isInvisible() === t3.isInvisible() && e3.isItalic() === t3.isItalic() && e3.isDim() === t3.isDim() && e3.isStrikethrough() === t3.isStrikethrough(); + } + __name(a, "a"); + class c extends i { + static { + __name(this, "c"); + } + constructor(e3, t3) { + super(e3), this._terminal = t3, this._rowIndex = 0, this._allRows = new Array(), this._allRowSeparators = new Array(), this._currentRow = "", this._nullCellCount = 0, this._cursorStyle = this._buffer.getNullCell(), this._cursorStyleRow = 0, this._cursorStyleCol = 0, this._backgroundCell = this._buffer.getNullCell(), this._firstRow = 0, this._lastCursorRow = 0, this._lastCursorCol = 0, this._lastContentCursorRow = 0, this._lastContentCursorCol = 0, this._thisRowLastChar = this._buffer.getNullCell(), this._thisRowLastSecondChar = this._buffer.getNullCell(), this._nextRowFirstChar = this._buffer.getNullCell(); + } + _beforeSerialize(e3, t3, s2) { + this._allRows = new Array(e3), this._lastContentCursorRow = t3, this._lastCursorRow = t3, this._firstRow = t3; + } + _rowEnd(e3, t3) { + this._nullCellCount > 0 && !l(this._cursorStyle, this._backgroundCell) && (this._currentRow += `\x1B[${this._nullCellCount}X`); + let s2 = ""; + if (!t3) { + e3 - this._firstRow >= this._terminal.rows && this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol, this._backgroundCell); + const t4 = this._buffer.getLine(e3), r2 = this._buffer.getLine(e3 + 1); + if (r2.isWrapped) { + s2 = ""; + const o2 = t4.getCell(t4.length - 1, this._thisRowLastChar), i2 = t4.getCell(t4.length - 2, this._thisRowLastSecondChar), n2 = r2.getCell(0, this._nextRowFirstChar), a2 = n2.getWidth() > 1; + let c2 = false; + (n2.getChars() && a2 ? this._nullCellCount <= 1 : this._nullCellCount <= 0) && ((o2.getChars() || 0 === o2.getWidth()) && l(o2, n2) && (c2 = true), a2 && (i2.getChars() || 0 === i2.getWidth()) && l(o2, n2) && l(i2, n2) && (c2 = true)), c2 || (s2 = "-".repeat(this._nullCellCount + 1), s2 += "\x1B[1D\x1B[1X", this._nullCellCount > 0 && (s2 += "\x1B[A", s2 += `\x1B[${t4.length - this._nullCellCount}C`, s2 += `\x1B[${this._nullCellCount}X`, s2 += `\x1B[${t4.length - this._nullCellCount}D`, s2 += "\x1B[B"), this._lastContentCursorRow = e3 + 1, this._lastContentCursorCol = 0, this._lastCursorRow = e3 + 1, this._lastCursorCol = 0); + } else s2 = "\r\n", this._lastCursorRow = e3 + 1, this._lastCursorCol = 0; + } + this._allRows[this._rowIndex] = this._currentRow, this._allRowSeparators[this._rowIndex++] = s2, this._currentRow = "", this._nullCellCount = 0; + } + _diffStyle(e3, t3) { + const s2 = [], r2 = !n(e3, t3), o2 = !l(e3, t3), i2 = !a(e3, t3); + if (r2 || o2 || i2) if (e3.isAttributeDefault()) t3.isAttributeDefault() || s2.push(0); + else { + if (r2) { + const t4 = e3.getFgColor(); + e3.isFgRGB() ? s2.push(38, 2, t4 >>> 16 & 255, t4 >>> 8 & 255, 255 & t4) : e3.isFgPalette() ? t4 >= 16 ? s2.push(38, 5, t4) : s2.push(8 & t4 ? 90 + (7 & t4) : 30 + (7 & t4)) : s2.push(39); + } + if (o2) { + const t4 = e3.getBgColor(); + e3.isBgRGB() ? s2.push(48, 2, t4 >>> 16 & 255, t4 >>> 8 & 255, 255 & t4) : e3.isBgPalette() ? t4 >= 16 ? s2.push(48, 5, t4) : s2.push(8 & t4 ? 100 + (7 & t4) : 40 + (7 & t4)) : s2.push(49); + } + i2 && (e3.isInverse() !== t3.isInverse() && s2.push(e3.isInverse() ? 7 : 27), e3.isBold() !== t3.isBold() && s2.push(e3.isBold() ? 1 : 22), e3.isUnderline() !== t3.isUnderline() && s2.push(e3.isUnderline() ? 4 : 24), e3.isOverline() !== t3.isOverline() && s2.push(e3.isOverline() ? 53 : 55), e3.isBlink() !== t3.isBlink() && s2.push(e3.isBlink() ? 5 : 25), e3.isInvisible() !== t3.isInvisible() && s2.push(e3.isInvisible() ? 8 : 28), e3.isItalic() !== t3.isItalic() && s2.push(e3.isItalic() ? 3 : 23), e3.isDim() !== t3.isDim() && s2.push(e3.isDim() ? 2 : 22), e3.isStrikethrough() !== t3.isStrikethrough() && s2.push(e3.isStrikethrough() ? 9 : 29)); + } + return s2; + } + _nextCell(e3, t3, s2, r2) { + if (0 === e3.getWidth()) return; + const o2 = "" === e3.getChars(), i2 = this._diffStyle(e3, this._cursorStyle); + if (o2 ? !l(this._cursorStyle, e3) : i2.length > 0) { + this._nullCellCount > 0 && (l(this._cursorStyle, this._backgroundCell) || (this._currentRow += `\x1B[${this._nullCellCount}X`), this._currentRow += `\x1B[${this._nullCellCount}C`, this._nullCellCount = 0), this._lastContentCursorRow = this._lastCursorRow = s2, this._lastContentCursorCol = this._lastCursorCol = r2, this._currentRow += `\x1B[${i2.join(";")}m`; + const e4 = this._buffer.getLine(s2); + void 0 !== e4 && (e4.getCell(r2, this._cursorStyle), this._cursorStyleRow = s2, this._cursorStyleCol = r2); + } + o2 ? this._nullCellCount += e3.getWidth() : (this._nullCellCount > 0 && (l(this._cursorStyle, this._backgroundCell) || (this._currentRow += `\x1B[${this._nullCellCount}X`), this._currentRow += `\x1B[${this._nullCellCount}C`, this._nullCellCount = 0), this._currentRow += e3.getChars(), this._lastContentCursorRow = this._lastCursorRow = s2, this._lastContentCursorCol = this._lastCursorCol = r2 + e3.getWidth()); + } + _serializeString(e3) { + let t3 = this._allRows.length; + this._buffer.length - this._firstRow <= this._terminal.rows && (t3 = this._lastContentCursorRow + 1 - this._firstRow, this._lastCursorCol = this._lastContentCursorCol, this._lastCursorRow = this._lastContentCursorRow); + let s2 = ""; + for (let e4 = 0; e4 < t3; e4++) s2 += this._allRows[e4], e4 + 1 < t3 && (s2 += this._allRowSeparators[e4]); + if (!e3) { + const e4 = this._buffer.baseY + this._buffer.cursorY, t4 = this._buffer.cursorX, o3 = /* @__PURE__ */ __name((e5) => { + e5 > 0 ? s2 += `\x1B[${e5}C` : e5 < 0 && (s2 += `\x1B[${-e5}D`); + }, "o"); + (e4 !== this._lastCursorRow || t4 !== this._lastCursorCol) && ((r2 = e4 - this._lastCursorRow) > 0 ? s2 += `\x1B[${r2}B` : r2 < 0 && (s2 += `\x1B[${-r2}A`), o3(t4 - this._lastCursorCol)); + } + var r2; + const o2 = this._terminal._core._inputHandler._curAttrData, i2 = this._diffStyle(o2, this._cursorStyle); + return i2.length > 0 && (s2 += `\x1B[${i2.join(";")}m`), s2; + } + } + e2.SerializeAddon = class { + activate(e3) { + this._terminal = e3; + } + _serializeBufferByScrollback(e3, t3, s2) { + const r2 = t3.length, i2 = void 0 === s2 ? r2 : o(s2 + e3.rows, 0, r2); + return this._serializeBufferByRange(e3, t3, { start: r2 - i2, end: r2 - 1 }, false); + } + _serializeBufferByRange(e3, t3, s2, r2) { + return new c(t3, e3).serialize({ start: { x: 0, y: "number" == typeof s2.start ? s2.start : s2.start.line }, end: { x: e3.cols, y: "number" == typeof s2.end ? s2.end : s2.end.line } }, r2); + } + _serializeBufferAsHTML(e3, t3) { + const s2 = e3.buffer.active, r2 = new h(s2, e3, t3); + if (!t3.onlySelection) { + const i3 = s2.length, n2 = t3.scrollback, l2 = void 0 === n2 ? i3 : o(n2 + e3.rows, 0, i3); + return r2.serialize({ start: { x: 0, y: i3 - l2 }, end: { x: e3.cols, y: i3 - 1 } }); + } + const i2 = this._terminal?.getSelectionPosition(); + return void 0 !== i2 ? r2.serialize({ start: { x: i2.start.x, y: i2.start.y }, end: { x: i2.end.x, y: i2.end.y } }) : ""; + } + _serializeModes(e3) { + let t3 = ""; + const s2 = e3.modes; + if (s2.applicationCursorKeysMode && (t3 += "\x1B[?1h"), s2.applicationKeypadMode && (t3 += "\x1B[?66h"), s2.bracketedPasteMode && (t3 += "\x1B[?2004h"), s2.insertMode && (t3 += "\x1B[4h"), s2.originMode && (t3 += "\x1B[?6h"), s2.reverseWraparoundMode && (t3 += "\x1B[?45h"), s2.sendFocusMode && (t3 += "\x1B[?1004h"), false === s2.wraparoundMode && (t3 += "\x1B[?7l"), "none" !== s2.mouseTrackingMode) switch (s2.mouseTrackingMode) { + case "x10": + t3 += "\x1B[?9h"; + break; + case "vt200": + t3 += "\x1B[?1000h"; + break; + case "drag": + t3 += "\x1B[?1002h"; + break; + case "any": + t3 += "\x1B[?1003h"; + } + return t3; + } + serialize(e3) { + if (!this._terminal) throw new Error("Cannot use addon until it has been loaded"); + let t3 = e3?.range ? this._serializeBufferByRange(this._terminal, this._terminal.buffer.normal, e3.range, true) : this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.normal, e3?.scrollback); + return e3?.excludeAltBuffer || "alternate" !== this._terminal.buffer.active.type || (t3 += `\x1B[?1049h\x1B[H${this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.alternate, void 0)}`), e3?.excludeModes || (t3 += this._serializeModes(this._terminal)), t3; + } + serializeAsHTML(e3) { + if (!this._terminal) throw new Error("Cannot use addon until it has been loaded"); + return this._serializeBufferAsHTML(this._terminal, e3 || {}); + } + dispose() { + } + }; + class h extends i { + static { + __name(this, "h"); + } + constructor(e3, s2, r2) { + super(e3), this._terminal = s2, this._options = r2, this._currentRow = "", this._htmlContent = "", s2._core._themeService ? this._ansiColors = s2._core._themeService.colors.ansi : this._ansiColors = t2.DEFAULT_ANSI_COLORS; + } + _padStart(e3, t3, s2) { + return t3 >>= 0, s2 = s2 ?? " ", e3.length > t3 ? e3 : ((t3 -= e3.length) > s2.length && (s2 += s2.repeat(t3 / s2.length)), s2.slice(0, t3) + e3); + } + _beforeSerialize(e3, t3, s2) { + this._htmlContent += "
";
+          let r2 = "#000000", o2 = "#ffffff";
+          this._options.includeGlobalBackground && (r2 = this._terminal.options.theme?.foreground ?? "#ffffff", o2 = this._terminal.options.theme?.background ?? "#000000");
+          const i2 = [];
+          i2.push("color: " + r2 + ";"), i2.push("background-color: " + o2 + ";"), i2.push("font-family: " + this._terminal.options.fontFamily + ";"), i2.push("font-size: " + this._terminal.options.fontSize + "px;"), this._htmlContent += "
"; + } + _afterSerialize() { + this._htmlContent += "
", this._htmlContent += "
"; + } + _rowEnd(e3, t3) { + this._htmlContent += "
" + this._currentRow + "
", this._currentRow = ""; + } + _getHexColor(e3, t3) { + const s2 = t3 ? e3.getFgColor() : e3.getBgColor(); + return (t3 ? e3.isFgRGB() : e3.isBgRGB()) ? "#" + [s2 >> 16 & 255, s2 >> 8 & 255, 255 & s2].map((e4) => this._padStart(e4.toString(16), 2, "0")).join("") : (t3 ? e3.isFgPalette() : e3.isBgPalette()) ? this._ansiColors[s2].css : void 0; + } + _diffStyle(e3, t3) { + const s2 = [], r2 = !n(e3, t3), o2 = !l(e3, t3), i2 = !a(e3, t3); + if (r2 || o2 || i2) { + const t4 = this._getHexColor(e3, true); + t4 && s2.push("color: " + t4 + ";"); + const r3 = this._getHexColor(e3, false); + return r3 && s2.push("background-color: " + r3 + ";"), e3.isInverse() && s2.push("color: #000000; background-color: #BFBFBF;"), e3.isBold() && s2.push("font-weight: bold;"), e3.isUnderline() && e3.isOverline() ? s2.push("text-decoration: overline underline;") : e3.isUnderline() ? s2.push("text-decoration: underline;") : e3.isOverline() && s2.push("text-decoration: overline;"), e3.isBlink() && s2.push("text-decoration: blink;"), e3.isInvisible() && s2.push("visibility: hidden;"), e3.isItalic() && s2.push("font-style: italic;"), e3.isDim() && s2.push("opacity: 0.5;"), e3.isStrikethrough() && s2.push("text-decoration: line-through;"), s2; + } + } + _nextCell(e3, t3, s2, r2) { + if (0 === e3.getWidth()) return; + const o2 = "" === e3.getChars(), i2 = this._diffStyle(e3, t3); + i2 && (this._currentRow += 0 === i2.length ? "" : ""), this._currentRow += o2 ? " " : e3.getChars(); + } + _serializeString() { + return this._htmlContent; + } + } + e2.HTMLSerializeHandler = h; + })(), r; + })()); +})(addonSerialize$2, addonSerialize$2.exports); +var addonSerializeExports = addonSerialize$2.exports; +const addonSerialize$1 = /* @__PURE__ */ getDefaultExportFromCjs(addonSerializeExports); +function useTerminalBuffer() { + const serializeAddon = new addonSerializeExports.SerializeAddon(); + const terminal = markRaw(new xtermExports.Terminal({ convertEol: true })); + const copyTo = /* @__PURE__ */ __name((destinationTerminal) => { + destinationTerminal.write(serializeAddon.serialize()); + }, "copyTo"); + const write = /* @__PURE__ */ __name((message) => terminal.write(message), "write"); + const serialize = /* @__PURE__ */ __name(() => serializeAddon.serialize(), "serialize"); + onMounted(() => { + terminal.loadAddon(serializeAddon); + }); + onUnmounted(() => { + terminal.dispose(); + }); + return { + copyTo, + serialize, + write + }; +} +__name(useTerminalBuffer, "useTerminalBuffer"); +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "TerminalOutputDrawer", + props: /* @__PURE__ */ mergeModels({ + header: {}, + defaultMessage: {} + }, { + "modelValue": { type: Boolean, ...{ required: true } }, + "modelModifiers": {} + }), + emits: ["update:modelValue"], + setup(__props) { + const terminalVisible = useModel(__props, "modelValue"); + const props = __props; + const electron = electronAPI(); + const buffer = useTerminalBuffer(); + let xterm = null; + const terminalCreated = /* @__PURE__ */ __name(({ terminal, useAutoSize }, root2) => { + xterm = terminal; + useAutoSize({ root: root2, autoRows: true, autoCols: true }); + terminal.write(props.defaultMessage); + buffer.copyTo(terminal); + terminal.options.cursorBlink = false; + terminal.options.cursorStyle = "bar"; + terminal.options.cursorInactiveStyle = "bar"; + terminal.options.disableStdin = true; + }, "terminalCreated"); + const terminalUnmounted = /* @__PURE__ */ __name(() => { + xterm = null; + }, "terminalUnmounted"); + onMounted(async () => { + electron.onLogMessage((message) => { + buffer.write(message); + xterm?.write(message); + }); + }); + return (_ctx, _cache) => { + return openBlock(), createBlock(unref(script), { + visible: terminalVisible.value, + "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => terminalVisible.value = $event), + header: _ctx.header, + position: "bottom", + style: { "height": "max(50vh, 34rem)" } + }, { + default: withCtx(() => [ + createVNode(BaseTerminal, { + onCreated: terminalCreated, + onUnmounted: terminalUnmounted + }) + ]), + _: 1 + }, 8, ["visible", "header"]); + }; + } +}); +export { + _sfc_main as _, + script as s +}; +//# sourceMappingURL=TerminalOutputDrawer-BgTEspHP.js.map diff --git a/web/assets/UserSelectView-wxa07xPk.js b/web/assets/UserSelectView-CRPNAEVJ.js similarity index 91% rename from web/assets/UserSelectView-wxa07xPk.js rename to web/assets/UserSelectView-CRPNAEVJ.js index 35f6c4a2d..d5d12bd6b 100644 --- a/web/assets/UserSelectView-wxa07xPk.js +++ b/web/assets/UserSelectView-CRPNAEVJ.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, aj as useUserStore, be as useRouter, U as ref, c as computed, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, bf as withKeys, j as unref, bg as script, bh as script$1, bi as script$2, bj as script$3, a7 as createTextVNode, B as createCommentVNode, l as script$4 } from "./index-DqqhYDnY.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.js"; +import { d as defineComponent, ak as useUserStore, bi as useRouter, T as ref, c as computed, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, bj as withKeys, j as unref, bk as script, bl as script$1, bm as script$2, bn as script$3, a8 as createTextVNode, B as createCommentVNode, l as script$4 } from "./index-DqXp9vW4.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.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" @@ -98,4 +98,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=UserSelectView-wxa07xPk.js.map +//# sourceMappingURL=UserSelectView-CRPNAEVJ.js.map diff --git a/web/assets/WelcomeView-BrXELNIm.js b/web/assets/WelcomeView-Cvtvw05C.js similarity index 87% rename from web/assets/WelcomeView-BrXELNIm.js rename to web/assets/WelcomeView-Cvtvw05C.js index 81bf8f2a7..20b087d94 100644 --- a/web/assets/WelcomeView-BrXELNIm.js +++ b/web/assets/WelcomeView-Cvtvw05C.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, be as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, _ as _export_sfc } from "./index-DqqhYDnY.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-Cz111_1A.js"; +import { d as defineComponent, bi as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, _ as _export_sfc } from "./index-DqXp9vW4.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.js"; 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({ @@ -36,4 +36,4 @@ const WelcomeView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data- export { WelcomeView as default }; -//# sourceMappingURL=WelcomeView-BrXELNIm.js.map +//# sourceMappingURL=WelcomeView-Cvtvw05C.js.map diff --git a/web/assets/index-BNlqgrYT.js b/web/assets/index-A-dAhghd.js similarity index 98% rename from web/assets/index-BNlqgrYT.js rename to web/assets/index-A-dAhghd.js index bc17d1c31..69e7290ff 100644 --- a/web/assets/index-BNlqgrYT.js +++ b/web/assets/index-A-dAhghd.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -import { bA as BaseStyle, bB as script$6, o as openBlock, f as createElementBlock, as as mergeProps, cJ as findIndexInList, c5 as find, bK as resolveComponent, y as createBlock, C as resolveDynamicComponent, z as withCtx, m as createBaseVNode, E as toDisplayString, A as renderSlot, B as createCommentVNode, ai as normalizeClass, bO as findSingle, F as Fragment, bL as Transition, i as withDirectives, v as vShow, bT as UniqueComponentId } from "./index-DqqhYDnY.js"; +import { bG as BaseStyle, bH as script$6, o as openBlock, f as createElementBlock, at as mergeProps, cO as findIndexInList, c4 as find, bR as resolveComponent, y as createBlock, C as resolveDynamicComponent, z as withCtx, m as createBaseVNode, E as toDisplayString, A as renderSlot, B as createCommentVNode, aj as normalizeClass, bJ as findSingle, F as Fragment, bI as Transition, i as withDirectives, v as vShow, bP as UniqueComponentId } from "./index-DqXp9vW4.js"; var classes$4 = { root: /* @__PURE__ */ __name(function root(_ref) { var instance = _ref.instance; @@ -536,4 +536,4 @@ export { script as d, script$4 as s }; -//# sourceMappingURL=index-BNlqgrYT.js.map +//# sourceMappingURL=index-A-dAhghd.js.map diff --git a/web/assets/index-B0BQ8jlU.js b/web/assets/index-B0BQ8jlU.js new file mode 100644 index 000000000..350e04eca --- /dev/null +++ b/web/assets/index-B0BQ8jlU.js @@ -0,0 +1,618 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +import { bG as BaseStyle, bX as script$5, o as openBlock, f as createElementBlock, at as mergeProps, m as createBaseVNode, bH as script$6, cF as script$7, cG as script$8, cl as script$9, bO as Ripple, r as resolveDirective, y as createBlock, C as resolveDynamicComponent, F as Fragment, E as toDisplayString, cx as normalizeProps, i as withDirectives, B as createCommentVNode, dg as ToastEventBus, bZ as ZIndex, ci as isEmpty, c8 as setAttribute, ca as script$a, bR as resolveComponent, z as withCtx, k as createVNode, dh as TransitionGroup, D as renderList } from "./index-DqXp9vW4.js"; +function _typeof$2(o) { + "@babel/helpers - typeof"; + return _typeof$2 = "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$2(o); +} +__name(_typeof$2, "_typeof$2"); +function _defineProperty$2(e, r, t) { + return (r = _toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; +} +__name(_defineProperty$2, "_defineProperty$2"); +function _toPropertyKey$2(t) { + var i = _toPrimitive$2(t, "string"); + return "symbol" == _typeof$2(i) ? i : i + ""; +} +__name(_toPropertyKey$2, "_toPropertyKey$2"); +function _toPrimitive$2(t, r) { + if ("object" != _typeof$2(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof$2(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} +__name(_toPrimitive$2, "_toPrimitive$2"); +var theme = /* @__PURE__ */ __name(function theme2(_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-close-button:dir(rtl) {\n margin: -25% 0 0 auto;\n left: -25%;\n right: auto;\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"); +var inlineStyles = { + root: /* @__PURE__ */ __name(function root(_ref2) { + var position = _ref2.position; + return { + position: "fixed", + top: position === "top-right" || position === "top-left" || position === "top-center" ? "20px" : position === "center" ? "50%" : null, + right: (position === "top-right" || position === "bottom-right") && "20px", + bottom: (position === "bottom-left" || position === "bottom-right" || position === "bottom-center") && "20px", + left: position === "top-left" || position === "bottom-left" ? "20px" : position === "center" || position === "top-center" || position === "bottom-center" ? "50%" : null + }; + }, "root") +}; +var classes = { + root: /* @__PURE__ */ __name(function root2(_ref3) { + var props = _ref3.props; + return ["p-toast p-component p-toast-" + props.position]; + }, "root"), + message: /* @__PURE__ */ __name(function message(_ref4) { + var props = _ref4.props; + return ["p-toast-message", { + "p-toast-message-info": props.message.severity === "info" || props.message.severity === void 0, + "p-toast-message-warn": props.message.severity === "warn", + "p-toast-message-error": props.message.severity === "error", + "p-toast-message-success": props.message.severity === "success", + "p-toast-message-secondary": props.message.severity === "secondary", + "p-toast-message-contrast": props.message.severity === "contrast" + }]; + }, "message"), + messageContent: "p-toast-message-content", + messageIcon: /* @__PURE__ */ __name(function messageIcon(_ref5) { + var props = _ref5.props; + return ["p-toast-message-icon", _defineProperty$2(_defineProperty$2(_defineProperty$2(_defineProperty$2({}, props.infoIcon, props.message.severity === "info"), props.warnIcon, props.message.severity === "warn"), props.errorIcon, props.message.severity === "error"), props.successIcon, props.message.severity === "success")]; + }, "messageIcon"), + messageText: "p-toast-message-text", + summary: "p-toast-summary", + detail: "p-toast-detail", + closeButton: "p-toast-close-button", + closeIcon: "p-toast-close-icon" +}; +var ToastStyle = BaseStyle.extend({ + name: "toast", + theme, + classes, + inlineStyles +}); +var script$4 = { + name: "ExclamationTriangleIcon", + "extends": script$5 +}; +function render$3(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + 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", + fill: "currentColor" + }, null, -1), createBaseVNode("path", { + 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", + fill: "currentColor" + }, null, -1), createBaseVNode("path", { + 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", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$3, "render$3"); +script$4.render = render$3; +var script$3 = { + name: "InfoCircleIcon", + "extends": script$5 +}; +function render$2(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { + "fill-rule": "evenodd", + "clip-rule": "evenodd", + 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", + fill: "currentColor" + }, null, -1)]), 16); +} +__name(render$2, "render$2"); +script$3.render = render$2; +var script$2 = { + name: "BaseToast", + "extends": script$6, + props: { + group: { + type: String, + "default": null + }, + position: { + type: String, + "default": "top-right" + }, + autoZIndex: { + type: Boolean, + "default": true + }, + baseZIndex: { + type: Number, + "default": 0 + }, + breakpoints: { + type: Object, + "default": null + }, + closeIcon: { + type: String, + "default": void 0 + }, + infoIcon: { + type: String, + "default": void 0 + }, + warnIcon: { + type: String, + "default": void 0 + }, + errorIcon: { + type: String, + "default": void 0 + }, + successIcon: { + type: String, + "default": void 0 + }, + closeButtonProps: { + type: null, + "default": null + } + }, + style: ToastStyle, + provide: /* @__PURE__ */ __name(function provide() { + return { + $pcToast: this, + $parentInstance: this + }; + }, "provide") +}; +var script$1 = { + name: "ToastMessage", + hostName: "Toast", + "extends": script$6, + emits: ["close"], + closeTimeout: null, + props: { + message: { + type: null, + "default": null + }, + templates: { + type: Object, + "default": null + }, + closeIcon: { + type: String, + "default": null + }, + infoIcon: { + type: String, + "default": null + }, + warnIcon: { + type: String, + "default": null + }, + errorIcon: { + type: String, + "default": null + }, + successIcon: { + type: String, + "default": null + }, + closeButtonProps: { + type: null, + "default": null + } + }, + mounted: /* @__PURE__ */ __name(function mounted() { + var _this = this; + if (this.message.life) { + this.closeTimeout = setTimeout(function() { + _this.close({ + message: _this.message, + type: "life-end" + }); + }, this.message.life); + } + }, "mounted"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount() { + this.clearCloseTimeout(); + }, "beforeUnmount"), + methods: { + close: /* @__PURE__ */ __name(function close(params) { + this.$emit("close", params); + }, "close"), + onCloseClick: /* @__PURE__ */ __name(function onCloseClick() { + this.clearCloseTimeout(); + this.close({ + message: this.message, + type: "close" + }); + }, "onCloseClick"), + clearCloseTimeout: /* @__PURE__ */ __name(function clearCloseTimeout() { + if (this.closeTimeout) { + clearTimeout(this.closeTimeout); + this.closeTimeout = null; + } + }, "clearCloseTimeout") + }, + computed: { + iconComponent: /* @__PURE__ */ __name(function iconComponent() { + return { + info: !this.infoIcon && script$3, + success: !this.successIcon && script$7, + warn: !this.warnIcon && script$4, + error: !this.errorIcon && script$8 + }[this.message.severity]; + }, "iconComponent"), + closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : void 0; + }, "closeAriaLabel") + }, + components: { + TimesIcon: script$9, + InfoCircleIcon: script$3, + CheckIcon: script$7, + ExclamationTriangleIcon: script$4, + TimesCircleIcon: script$8 + }, + directives: { + ripple: Ripple + } +}; +function _typeof$1(o) { + "@babel/helpers - typeof"; + return _typeof$1 = "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$1(o); +} +__name(_typeof$1, "_typeof$1"); +function ownKeys$1(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$1, "ownKeys$1"); +function _objectSpread$1(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys$1(Object(t), true).forEach(function(r2) { + _defineProperty$1(e, r2, t[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r2) { + Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); + }); + } + return e; +} +__name(_objectSpread$1, "_objectSpread$1"); +function _defineProperty$1(e, r, t) { + return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; +} +__name(_defineProperty$1, "_defineProperty$1"); +function _toPropertyKey$1(t) { + var i = _toPrimitive$1(t, "string"); + return "symbol" == _typeof$1(i) ? i : i + ""; +} +__name(_toPropertyKey$1, "_toPropertyKey$1"); +function _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); +} +__name(_toPrimitive$1, "_toPrimitive$1"); +var _hoisted_1 = ["aria-label"]; +function render$1(_ctx, _cache, $props, $setup, $data, $options) { + var _directive_ripple = resolveDirective("ripple"); + return openBlock(), createElementBlock("div", mergeProps({ + "class": [_ctx.cx("message"), $props.message.styleClass], + role: "alert", + "aria-live": "assertive", + "aria-atomic": "true" + }, _ctx.ptm("message")), [$props.templates.container ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.container), { + key: 0, + message: $props.message, + closeCallback: $options.onCloseClick + }, null, 8, ["message", "closeCallback"])) : (openBlock(), createElementBlock("div", mergeProps({ + key: 1, + "class": [_ctx.cx("messageContent"), $props.message.contentStyleClass] + }, _ctx.ptm("messageContent")), [!$props.templates.message ? (openBlock(), createElementBlock(Fragment, { + key: 0 + }, [(openBlock(), createBlock(resolveDynamicComponent($props.templates.messageicon ? $props.templates.messageicon : $props.templates.icon ? $props.templates.icon : $options.iconComponent && $options.iconComponent.name ? $options.iconComponent : "span"), mergeProps({ + "class": _ctx.cx("messageIcon") + }, _ctx.ptm("messageIcon")), null, 16, ["class"])), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("messageText") + }, _ctx.ptm("messageText")), [createBaseVNode("span", mergeProps({ + "class": _ctx.cx("summary") + }, _ctx.ptm("summary")), toDisplayString($props.message.summary), 17), createBaseVNode("div", mergeProps({ + "class": _ctx.cx("detail") + }, _ctx.ptm("detail")), toDisplayString($props.message.detail), 17)], 16)], 64)) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.message), { + key: 1, + message: $props.message + }, null, 8, ["message"])), $props.message.closable !== false ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ + key: 2 + }, _ctx.ptm("buttonContainer"))), [withDirectives((openBlock(), createElementBlock("button", mergeProps({ + "class": _ctx.cx("closeButton"), + type: "button", + "aria-label": $options.closeAriaLabel, + onClick: _cache[0] || (_cache[0] = function() { + return $options.onCloseClick && $options.onCloseClick.apply($options, arguments); + }), + 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)), [[_directive_ripple]])], 16)) : createCommentVNode("", true)], 16))], 16); +} +__name(render$1, "render$1"); +script$1.render = render$1; +function _toConsumableArray(r) { + return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); +} +__name(_toConsumableArray, "_toConsumableArray"); +function _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."); +} +__name(_nonIterableSpread, "_nonIterableSpread"); +function _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; + } +} +__name(_unsupportedIterableToArray, "_unsupportedIterableToArray"); +function _iterableToArray(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +__name(_iterableToArray, "_iterableToArray"); +function _arrayWithoutHoles(r) { + if (Array.isArray(r)) return _arrayLikeToArray(r); +} +__name(_arrayWithoutHoles, "_arrayWithoutHoles"); +function _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; +} +__name(_arrayLikeToArray, "_arrayLikeToArray"); +var messageIdx = 0; +var script = { + name: "Toast", + "extends": script$2, + inheritAttrs: false, + emits: ["close", "life-end"], + data: /* @__PURE__ */ __name(function data() { + return { + messages: [] + }; + }, "data"), + styleElement: null, + mounted: /* @__PURE__ */ __name(function mounted2() { + ToastEventBus.on("add", this.onAdd); + ToastEventBus.on("remove", this.onRemove); + ToastEventBus.on("remove-group", this.onRemoveGroup); + ToastEventBus.on("remove-all-groups", this.onRemoveAllGroups); + if (this.breakpoints) { + this.createStyle(); + } + }, "mounted"), + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount2() { + this.destroyStyle(); + if (this.$refs.container && this.autoZIndex) { + ZIndex.clear(this.$refs.container); + } + ToastEventBus.off("add", this.onAdd); + ToastEventBus.off("remove", this.onRemove); + ToastEventBus.off("remove-group", this.onRemoveGroup); + ToastEventBus.off("remove-all-groups", this.onRemoveAllGroups); + }, "beforeUnmount"), + methods: { + add: /* @__PURE__ */ __name(function add(message2) { + if (message2.id == null) { + message2.id = messageIdx++; + } + this.messages = [].concat(_toConsumableArray(this.messages), [message2]); + }, "add"), + remove: /* @__PURE__ */ __name(function remove(params) { + var index = this.messages.findIndex(function(m) { + return m.id === params.message.id; + }); + if (index !== -1) { + this.messages.splice(index, 1); + this.$emit(params.type, { + message: params.message + }); + } + }, "remove"), + onAdd: /* @__PURE__ */ __name(function onAdd(message2) { + if (this.group == message2.group) { + this.add(message2); + } + }, "onAdd"), + onRemove: /* @__PURE__ */ __name(function onRemove(message2) { + this.remove({ + message: message2, + type: "close" + }); + }, "onRemove"), + onRemoveGroup: /* @__PURE__ */ __name(function onRemoveGroup(group) { + if (this.group === group) { + this.messages = []; + } + }, "onRemoveGroup"), + onRemoveAllGroups: /* @__PURE__ */ __name(function onRemoveAllGroups() { + this.messages = []; + }, "onRemoveAllGroups"), + onEnter: /* @__PURE__ */ __name(function onEnter() { + if (this.autoZIndex) { + ZIndex.set("modal", this.$refs.container, this.baseZIndex || this.$primevue.config.zIndex.modal); + } + }, "onEnter"), + onLeave: /* @__PURE__ */ __name(function onLeave() { + var _this = this; + if (this.$refs.container && this.autoZIndex && isEmpty(this.messages)) { + setTimeout(function() { + ZIndex.clear(_this.$refs.container); + }, 200); + } + }, "onLeave"), + createStyle: /* @__PURE__ */ __name(function createStyle() { + if (!this.styleElement && !this.isUnstyled) { + var _this$$primevue; + this.styleElement = document.createElement("style"); + this.styleElement.type = "text/css"; + 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); + document.head.appendChild(this.styleElement); + var innerHTML = ""; + for (var breakpoint in this.breakpoints) { + var breakpointStyle = ""; + for (var styleProp in this.breakpoints[breakpoint]) { + breakpointStyle += styleProp + ":" + this.breakpoints[breakpoint][styleProp] + "!important;"; + } + innerHTML += "\n @media screen and (max-width: ".concat(breakpoint, ") {\n .p-toast[").concat(this.$attrSelector, "] {\n ").concat(breakpointStyle, "\n }\n }\n "); + } + this.styleElement.innerHTML = innerHTML; + } + }, "createStyle"), + destroyStyle: /* @__PURE__ */ __name(function destroyStyle() { + if (this.styleElement) { + document.head.removeChild(this.styleElement); + this.styleElement = null; + } + }, "destroyStyle") + }, + components: { + ToastMessage: script$1, + Portal: 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"); +function render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_ToastMessage = resolveComponent("ToastMessage"); + var _component_Portal = resolveComponent("Portal"); + return openBlock(), createBlock(_component_Portal, null, { + "default": withCtx(function() { + return [createBaseVNode("div", mergeProps({ + ref: "container", + "class": _ctx.cx("root"), + style: _ctx.sx("root", true, { + position: _ctx.position + }) + }, _ctx.ptmi("root")), [createVNode(TransitionGroup, mergeProps({ + name: "p-toast-message", + tag: "div", + onEnter: $options.onEnter, + onLeave: $options.onLeave + }, _objectSpread({}, _ctx.ptm("transition"))), { + "default": withCtx(function() { + return [(openBlock(true), createElementBlock(Fragment, null, renderList($data.messages, function(msg) { + return openBlock(), createBlock(_component_ToastMessage, { + key: msg.id, + message: msg, + templates: _ctx.$slots, + closeIcon: _ctx.closeIcon, + infoIcon: _ctx.infoIcon, + warnIcon: _ctx.warnIcon, + errorIcon: _ctx.errorIcon, + successIcon: _ctx.successIcon, + closeButtonProps: _ctx.closeButtonProps, + unstyled: _ctx.unstyled, + onClose: _cache[0] || (_cache[0] = function($event) { + return $options.remove($event); + }), + pt: _ctx.pt + }, null, 8, ["message", "templates", "closeIcon", "infoIcon", "warnIcon", "errorIcon", "successIcon", "closeButtonProps", "unstyled", "pt"]); + }), 128))]; + }), + _: 1 + }, 16, ["onEnter", "onLeave"])], 16)]; + }), + _: 1 + }); +} +__name(render, "render"); +script.render = render; +export { + script$3 as a, + script$4 as b, + script as s +}; +//# sourceMappingURL=index-B0BQ8jlU.js.map diff --git a/web/assets/index-DXE47DZl.js b/web/assets/index-BTHx8UHZ.js similarity index 91% rename from web/assets/index-DXE47DZl.js rename to web/assets/index-BTHx8UHZ.js index b25616f6b..71fd1e5d8 100644 --- a/web/assets/index-DXE47DZl.js +++ b/web/assets/index-BTHx8UHZ.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bZ as script$1, o as openBlock, f as createElementBlock, as as mergeProps, m as createBaseVNode } from "./index-DqqhYDnY.js"; +import { bX as script$1, o as openBlock, f as createElementBlock, at as mergeProps, m as createBaseVNode } from "./index-DqXp9vW4.js"; var script = { name: "BarsIcon", "extends": script$1 @@ -24,4 +24,4 @@ script.render = render; export { script as s }; -//# sourceMappingURL=index-DXE47DZl.js.map +//# sourceMappingURL=index-BTHx8UHZ.js.map diff --git a/web/assets/index-C1Hb_Yo9.css b/web/assets/index-CBxvvAzM.css similarity index 92% rename from web/assets/index-C1Hb_Yo9.css rename to web/assets/index-CBxvvAzM.css index 5e62328cf..7bcbd2ed6 100644 --- a/web/assets/index-C1Hb_Yo9.css +++ b/web/assets/index-CBxvvAzM.css @@ -306,6 +306,7 @@ .litegraph .dialog .dialog-footer { height: 50px; padding: 10px; + margin: 0; border-top: 1px solid #1a1a1a; } @@ -442,63 +443,6 @@ color: black; } -.litegraph .subgraph_property { - padding: 4px; -} - -.litegraph .subgraph_property:hover { - background-color: #333; -} - -.litegraph .subgraph_property.extra { - margin-top: 8px; -} - -.litegraph .subgraph_property span.name { - font-size: 1.3em; - padding-left: 4px; -} - -.litegraph .subgraph_property span.type { - opacity: 0.5; - margin-right: 20px; - padding-left: 4px; -} - -.litegraph .subgraph_property span.label { - display: inline-block; - width: 60px; - padding: 0px 10px; -} - -.litegraph .subgraph_property input { - width: 140px; - color: #999; - background-color: #1a1a1a; - border-radius: 4px; - border: 0; - margin-right: 10px; - padding: 4px; - padding-left: 10px; -} - -.litegraph .subgraph_property button { - background-color: #1c1c1c; - color: #aaa; - border: 0; - border-radius: 2px; - padding: 4px 10px; - cursor: pointer; -} - -.litegraph .subgraph_property.extra { - color: #ccc; -} - -.litegraph .subgraph_property.extra input { - background-color: #111; -} - .litegraph .bullet_icon { margin-left: 10px; border-radius: 10px; @@ -661,21 +605,6 @@ .litegraph .dialog .dialog-content { display: block; } -.litegraph .dialog .dialog-content .subgraph_property { - padding: 5px; -} -.litegraph .dialog .dialog-footer { - margin: 0; -} -.litegraph .dialog .dialog-footer .subgraph_property { - margin-top: 0; - display: flex; - align-items: center; - padding: 5px; -} -.litegraph .dialog .dialog-footer .subgraph_property .name { - flex: 1; -} .litegraph .graphdialog { display: flex; align-items: center; @@ -2110,6 +2039,9 @@ .-right-4{ right: -1rem; } + .bottom-0{ + bottom: 0px; + } .bottom-\[10px\]{ bottom: 10px; } @@ -2119,6 +2051,15 @@ .left-0{ left: 0px; } + .left-1\/2{ + left: 50%; + } + .left-12{ + left: 3rem; + } + .left-2{ + left: 0.5rem; + } .left-\[-350px\]{ left: -350px; } @@ -2128,6 +2069,9 @@ .top-0{ top: 0px; } + .top-2{ + top: 0.5rem; + } .top-\[50px\]{ top: 50px; } @@ -2137,6 +2081,9 @@ .z-10{ z-index: 10; } + .z-20{ + z-index: 20; + } .z-\[1000\]{ z-index: 1000; } @@ -2196,6 +2143,10 @@ margin-top: 1rem; margin-bottom: 1rem; } + .my-8{ + margin-top: 2rem; + margin-bottom: 2rem; + } .mb-2{ margin-bottom: 0.5rem; } @@ -2286,6 +2237,9 @@ .h-16{ height: 4rem; } + .h-48{ + height: 12rem; + } .h-6{ height: 1.5rem; } @@ -2331,6 +2285,9 @@ .min-h-screen{ min-height: 100vh; } + .w-0{ + width: 0px; + } .w-1\/2{ width: 50%; } @@ -2343,12 +2300,21 @@ .w-16{ width: 4rem; } + .w-24{ + width: 6rem; + } .w-28{ width: 7rem; } + .w-3{ + width: 0.75rem; + } .w-3\/12{ width: 25%; } + .w-32{ + width: 8rem; + } .w-44{ width: 11rem; } @@ -2458,6 +2424,9 @@ .cursor-pointer{ cursor: pointer; } + .touch-none{ + touch-action: none; + } .select-none{ -webkit-user-select: none; -moz-user-select: none; @@ -2893,6 +2862,10 @@ --tw-text-opacity: 1; color: rgb(239 68 68 / var(--tw-text-opacity)); } + .text-white{ + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)); + } .underline{ text-decoration-line: underline; } @@ -3035,8 +3008,6 @@ body { height: 100vh; margin: 0; overflow: hidden; - grid-template-columns: auto 1fr auto; - grid-template-rows: auto 1fr auto; background: var(--bg-color) var(--bg-img); color: var(--fg-color); min-height: -webkit-fill-available; @@ -3046,87 +3017,6 @@ body { font-family: Arial, sans-serif; } -/** - +------------------+------------------+------------------+ - | | - | .comfyui-body- | - | top | - | (spans all cols) | - | | - +------------------+------------------+------------------+ - | | | | - | .comfyui-body- | #graph-canvas | .comfyui-body- | - | left | | right | - | | | | - | | | | - +------------------+------------------+------------------+ - | | - | .comfyui-body- | - | bottom | - | (spans all cols) | - | | - +------------------+------------------+------------------+ -*/ - -.comfyui-body-top { - order: -5; - /* Span across all columns */ - grid-column: 1/-1; - /* Position at the first row */ - grid-row: 1; - /* Top menu bar dropdown needs to be above of graph canvas splitter overlay which is z-index: 999 */ - /* Top menu bar z-index needs to be higher than bottom menu bar z-index as by default - pysssss's image feed is located at body-bottom, and it can overlap with the queue button, which - is located in body-top. */ - z-index: 1001; - display: flex; - flex-direction: column; -} - -.comfyui-body-left { - order: -4; - /* Position in the first column */ - grid-column: 1; - /* Position below the top element */ - grid-row: 2; - z-index: 10; - display: flex; -} - -.graph-canvas-container { - width: 100%; - height: 100%; - order: -3; - grid-column: 2; - grid-row: 2; - position: relative; - overflow: hidden; -} - -#graph-canvas { - width: 100%; - height: 100%; - touch-action: none; -} - -.comfyui-body-right { - order: -2; - z-index: 10; - grid-column: 3; - grid-row: 2; -} - -.comfyui-body-bottom { - order: 4; - /* Span across all columns */ - grid-column: 1/-1; - grid-row: 3; - /* Bottom menu bar dropdown needs to be above of graph canvas splitter overlay which is z-index: 999 */ - z-index: 1000; - display: flex; - flex-direction: column; -} - .comfy-multiline-input { background-color: var(--comfy-input-bg); color: var(--input-text); @@ -3541,84 +3431,6 @@ dialog::backdrop { justify-content: center; } -#comfy-settings-dialog { - padding: 0; - width: 41rem; -} - -#comfy-settings-dialog tr > td:first-child { - text-align: right; -} - -#comfy-settings-dialog tbody button, -#comfy-settings-dialog table > button { - background-color: var(--bg-color); - border: 1px var(--border-color) solid; - border-radius: 0; - color: var(--input-text); - font-size: 1rem; - padding: 0.5rem; -} - -#comfy-settings-dialog button:hover { - background-color: var(--tr-odd-bg-color); -} - -/* General CSS for tables */ - -.comfy-table { - border-collapse: collapse; - color: var(--input-text); - font-family: Arial, sans-serif; - width: 100%; -} - -.comfy-table caption { - position: sticky; - top: 0; - background-color: var(--bg-color); - color: var(--input-text); - font-size: 1rem; - font-weight: bold; - padding: 8px; - text-align: center; - border-bottom: 1px solid var(--border-color); -} - -.comfy-table caption .comfy-btn { - position: absolute; - top: -2px; - right: 0; - bottom: 0; - cursor: pointer; - border: none; - height: 100%; - border-radius: 0; - aspect-ratio: 1/1; - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; - font-size: 20px; -} - -.comfy-table caption .comfy-btn:focus { - outline: none; -} - -.comfy-table tr:nth-child(even) { - background-color: var(--tr-even-bg-color); -} - -.comfy-table tr:nth-child(odd) { - background-color: var(--tr-odd-bg-color); -} - -.comfy-table td, -.comfy-table th { - border: 1px solid var(--border-color); - padding: 8px; -} - /* Context menu */ .litegraph .dialog { @@ -3718,24 +3530,6 @@ dialog::backdrop { will-change: transform; } -@media only screen and (max-width: 450px) { - #comfy-settings-dialog .comfy-table tbody { - display: grid; - } - #comfy-settings-dialog .comfy-table tr { - display: grid; - } - #comfy-settings-dialog tr > td:first-child { - text-align: center; - border-bottom: none; - padding-bottom: 0; - } - #comfy-settings-dialog tr > td:not(:first-child) { - text-align: center; - border-top: none; - } -} - audio.comfy-audio.empty-audio-widget { display: none; } @@ -3746,7 +3540,6 @@ audio.comfy-audio.empty-audio-widget { left: 0; width: 100%; height: 100%; - pointer-events: none; } /* Set auto complete panel's width as it is not accessible within vue-root */ @@ -3926,7 +3719,7 @@ audio.comfy-audio.empty-audio-widget { padding-top: 0px } -.prompt-dialog-content[data-v-3df70997] { +.prompt-dialog-content[data-v-4f1e3bbe] { white-space: pre-wrap; } @@ -3944,17 +3737,17 @@ audio.comfy-audio.empty-audio-widget { margin-bottom: 1rem; } -.comfy-error-report[data-v-3faf7785] { +.comfy-error-report[data-v-e5000be2] { display: flex; flex-direction: column; gap: 1rem; } -.action-container[data-v-3faf7785] { +.action-container[data-v-e5000be2] { display: flex; gap: 1rem; justify-content: flex-end; } -.wrapper-pre[data-v-3faf7785] { +.wrapper-pre[data-v-e5000be2] { white-space: pre-wrap; word-wrap: break-word; } @@ -4023,13 +3816,13 @@ audio.comfy-audio.empty-audio-widget { padding: 0px; } -.form-input[data-v-1451da7b] .input-slider .p-inputnumber input, -.form-input[data-v-1451da7b] .input-slider .slider-part { +.form-input[data-v-a29c257f] .input-slider .p-inputnumber input, +.form-input[data-v-a29c257f] .input-slider .slider-part { width: 5rem } -.form-input[data-v-1451da7b] .p-inputtext, -.form-input[data-v-1451da7b] .p-select { +.form-input[data-v-a29c257f] .p-inputtext, +.form-input[data-v-a29c257f] .p-select { width: 11rem } @@ -4319,26 +4112,26 @@ audio.comfy-audio.empty-audio-widget { position: relative; } -[data-v-250ab9af] .p-terminal .xterm { +[data-v-873a313f] .p-terminal .xterm { overflow-x: auto; } -[data-v-250ab9af] .p-terminal .xterm-screen { +[data-v-873a313f] .p-terminal .xterm-screen { background-color: black; overflow-y: hidden; } -[data-v-90a7f075] .p-terminal .xterm { +[data-v-14fef2e4] .p-terminal .xterm { overflow-x: auto; } -[data-v-90a7f075] .p-terminal .xterm-screen { +[data-v-14fef2e4] .p-terminal .xterm-screen { background-color: black; overflow-y: hidden; } -[data-v-03daf1c8] .p-terminal .xterm { +[data-v-cf0c7d52] .p-terminal .xterm { overflow-x: auto; } -[data-v-03daf1c8] .p-terminal .xterm-screen { +[data-v-cf0c7d52] .p-terminal .xterm-screen { background-color: black; overflow-y: hidden; } @@ -4650,28 +4443,28 @@ audio.comfy-audio.empty-audio-widget { box-sizing: border-box; } -.tree-node[data-v-654109c7] { +.tree-node[data-v-a945b5a8] { width: 100%; display: flex; align-items: center; justify-content: space-between; } -.leaf-count-badge[data-v-654109c7] { +.leaf-count-badge[data-v-a945b5a8] { margin-left: 0.5rem; } -.node-content[data-v-654109c7] { +.node-content[data-v-a945b5a8] { display: flex; align-items: center; flex-grow: 1; } -.leaf-label[data-v-654109c7] { +.leaf-label[data-v-a945b5a8] { margin-left: 0.5rem; } -[data-v-654109c7] .editable-text span { +[data-v-a945b5a8] .editable-text span { word-break: break-all; } -[data-v-976a6d58] .tree-explorer-node-label { +[data-v-e3a237e6] .tree-explorer-node-label { width: 100%; display: flex; align-items: center; @@ -4684,10 +4477,10 @@ audio.comfy-audio.empty-audio-widget { * By setting the position to relative on the parent and using an absolutely positioned pseudo-element, * we can create a visual indicator for the drop target without affecting the layout of other elements. */ -[data-v-976a6d58] .p-tree-node-content:has(.tree-folder) { +[data-v-e3a237e6] .p-tree-node-content:has(.tree-folder) { position: relative; } -[data-v-976a6d58] .p-tree-node-content:has(.tree-folder.can-drop)::after { +[data-v-e3a237e6] .p-tree-node-content:has(.tree-folder.can-drop)::after { content: ''; position: absolute; top: 0; @@ -4790,7 +4583,7 @@ audio.comfy-audio.empty-audio-widget { vertical-align: top; } -[data-v-0bb2ac55] .pi-fake-spacer { +[data-v-3be51840] .pi-fake-spacer { height: 1px; width: 16px; } diff --git a/web/assets/index-BYzwFNH3.js b/web/assets/index-D9D9jjLT.js similarity index 98% rename from web/assets/index-BYzwFNH3.js rename to web/assets/index-D9D9jjLT.js index 0673ca94c..22a3f2910 100644 --- a/web/assets/index-BYzwFNH3.js +++ b/web/assets/index-D9D9jjLT.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { da as ComfyDialog, db as $el, dc as ComfyApp, h as app, M as LiteGraph, aF as LGraphCanvas, dd as useExtensionService, de as processDynamicPrompt, b4 as isElectron, b5 as electronAPI, b as useWorkflowStore, bu as checkMirrorReachable, b7 as useDialogService, bc as t, df as DraggableList, aS as useToastStore, $ as LGraphNode, dg as applyTextReplacements, dh as ComfyWidgets, di as addValueControlWidgets, P as useNodeDefStore, dj as serialise, dk as deserialiseAndCreate, aH as api, a as useSettingStore, Z as LGraphGroup, W as nextTick, b0 as lodashExports, aK as setStorageValue, aI as getStorageValue } from "./index-DqqhYDnY.js"; +import { di as ComfyDialog, dj as $el, dk as ComfyApp, h as app, L as LiteGraph, aD as LGraphCanvas, dl as useExtensionService, dm as processDynamicPrompt, b8 as isElectron, b9 as electronAPI, b as useWorkflowStore, by as checkMirrorReachable, bb as useDialogService, bg as t, dn as DraggableList, aW as useToastStore, $ as LGraphNode, dp as applyTextReplacements, dq as ComfyWidgets, dr as addValueControlWidgets, O as useNodeDefStore, a as useSettingStore, ds as serialise, dt as deserialiseAndCreate, aL as api, Z as LGraphGroup, d as defineComponent, T as ref, p as onMounted, d8 as onUnmounted, r as resolveDirective, o as openBlock, f as createElementBlock, k as createVNode, j as unref, l as script, z as withCtx, i as withDirectives, m as createBaseVNode, y as createBlock, aj as normalizeClass, du as script$1, v as vShow, B as createCommentVNode, dv as createApp, cs as Tooltip, N as watch, bm as script$2, dw as PrimeVue, V as nextTick, b4 as lodashExports, aO as setStorageValue, aM as getStorageValue } from "./index-DqXp9vW4.js"; import { P as PYTHON_MIRROR } from "./uvMirrors-B-HKMf6X.js"; class ClipspaceDialog extends ComfyDialog { static { @@ -289,7 +289,7 @@ useExtensionService().registerExtension({ name: "Comfy.DynamicPrompts", nodeCreated(node) { if (node.widgets) { - const widgets = node.widgets.filter((n) => n.dynamicPrompts); + const widgets = node.widgets.filter((w) => w.dynamicPrompts); for (const widget of widgets) { widget.serializeValue = (workflowNode, widgetIndex) => { if (typeof widget.value !== "string") return widget.value; @@ -1627,17 +1627,16 @@ function mergeIfValid(output, config2, forceUpdate, recreateWidget, config1) { return { customConfig }; } __name(mergeIfValid, "mergeIfValid"); -let useConversionSubmenusSetting; app.registerExtension({ name: "Comfy.WidgetInputs", - init() { - useConversionSubmenusSetting = app.ui.settings.addSetting({ + settings: [ + { 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(); @@ -1679,6 +1678,17 @@ app.registerExtension({ convertToInput(this, widget, config); return true; }; + nodeType.prototype.getExtraSlotMenuOptions = function(slot) { + if (!slot.input || !slot.input.widget) return []; + const widget = this.widgets.find((w) => w.name === slot.input.widget.name); + if (!widget) return []; + return [ + { + content: `Convert to widget`, + callback: /* @__PURE__ */ __name(() => convertToWidget(this, widget), "callback") + } + ]; + }; nodeType.prototype.getExtraMenuOptions = function(_, options) { const r = origGetExtraMenuOptions ? origGetExtraMenuOptions.apply(this, arguments) : void 0; const getPointerCanvasPos = /* @__PURE__ */ __name(() => { @@ -1726,7 +1736,7 @@ app.registerExtension({ } } if (toInput.length) { - if (useConversionSubmenusSetting.value) { + if (useSettingStore().get("Comfy.NodeInputConversionSubmenus")) { options.push({ content: "Convert Widget to Input", submenu: { @@ -1738,7 +1748,7 @@ app.registerExtension({ } } if (toWidget.length) { - if (useConversionSubmenusSetting.value) { + if (useSettingStore().get("Comfy.NodeInputConversionSubmenus")) { options.push({ content: "Convert Input to Widget", submenu: { @@ -1801,10 +1811,7 @@ app.registerExtension({ 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) - ); + input.widget[GET_CONFIG] = () => getConfig.call(this, input.widget.name); const w = this.widgets.find((w2) => w2.name === input.widget.name); if (w) { hideWidget(this, w); @@ -3415,7 +3422,7 @@ class Load3DConfiguration { constructor(load3d) { this.load3d = load3d; } - configure(loadFolder, modelWidget, material, lightIntensity, upDirection, fov2, cameraState, postModelUpdateFunc) { + configure(loadFolder, modelWidget, material, upDirection, cameraState, width = null, height = null, postModelUpdateFunc) { this.setupModelHandling( modelWidget, loadFolder, @@ -3423,11 +3430,21 @@ class Load3DConfiguration { postModelUpdateFunc ); this.setupMaterial(material); - this.setupLighting(lightIntensity); this.setupDirection(upDirection); - this.setupCamera(fov2); + this.setupTargetSize(width, height); this.setupDefaultProperties(); } + setupTargetSize(width, height) { + if (width && height) { + this.load3d.setTargetSize(width.value, height.value); + width.callback = (value) => { + this.load3d.setTargetSize(value, height.value); + }; + height.callback = (value) => { + this.load3d.setTargetSize(width.value, value); + }; + } + } setupModelHandling(modelWidget, loadFolder, cameraState, postModelUpdateFunc) { const onModelWidgetUpdate = this.createModelUpdateHandler( loadFolder, @@ -3447,12 +3464,6 @@ class Load3DConfiguration { material.value ); } - setupLighting(lightIntensity) { - lightIntensity.callback = (value) => { - this.load3d.setLightIntensity(value); - }; - this.load3d.setLightIntensity(lightIntensity.value); - } setupDirection(upDirection) { upDirection.callback = (value) => { this.load3d.setUpDirection(value); @@ -3461,12 +3472,6 @@ class Load3DConfiguration { upDirection.value ); } - setupCamera(fov2) { - fov2.callback = (value) => { - this.load3d.setFOV(value); - }; - this.load3d.setFOV(fov2.value); - } setupDefaultProperties() { const cameraType = this.load3d.loadNodeProperty( "Camera Type", @@ -3477,6 +3482,10 @@ class Load3DConfiguration { this.load3d.toggleGrid(showGrid); const bgColor = this.load3d.loadNodeProperty("Background Color", "#282828"); this.load3d.setBackgroundColor(bgColor); + const lightIntensity = this.load3d.loadNodeProperty("Light Intensity", "5"); + this.load3d.setLightIntensity(lightIntensity); + const fov2 = this.load3d.loadNodeProperty("FOV", "75"); + this.load3d.setFOV(fov2); } createModelUpdateHandler(loadFolder, cameraState, postModelUpdateFunc) { let isFirstLoad = true; @@ -44141,7 +44150,7 @@ class GLTFParser { /** 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 ref2 = object.clone(); const updateMappings = /* @__PURE__ */ __name((original, clone) => { const mappings = this.associations.get(original); if (mappings != null) { @@ -44151,9 +44160,9 @@ class GLTFParser { updateMappings(child, clone.children[i]); } }, "updateMappings"); - updateMappings(object, ref); - ref.name += "_instance_" + cache.uses[index]++; - return ref; + updateMappings(object, ref2); + ref2.name += "_instance_" + cache.uses[index]++; + return ref2; } _invokeOne(func) { const extensions = Object.values(this.plugins); @@ -46206,6 +46215,259 @@ class STLLoader extends Loader { return isBinary(binData) ? parseBinary(binData) : parseASCII(ensureString(data)); } } +const _hoisted_1$1 = { class: "absolute top-2 left-2 flex flex-col gap-2 z-20" }; +const _hoisted_2$1 = { class: "pi pi-camera text-white text-lg" }; +const _hoisted_3 = { class: "pi pi-palette text-white text-lg" }; +const _hoisted_4 = ["value"]; +const _hoisted_5 = { + key: 0, + class: "relative" +}; +const _hoisted_6 = { class: "pi pi-sun text-white text-lg" }; +const _hoisted_7 = { + class: "absolute left-12 top-0 bg-black bg-opacity-50 p-4 rounded-lg shadow-lg", + style: { "width": "150px" } +}; +const _hoisted_8 = { + key: 1, + class: "relative" +}; +const _hoisted_9 = { class: "pi pi-expand text-white text-lg" }; +const _hoisted_10 = { + class: "absolute left-12 top-0 bg-black bg-opacity-50 p-4 rounded-lg shadow-lg", + style: { "width": "150px" } +}; +const _hoisted_11 = { key: 2 }; +const _sfc_main$1 = /* @__PURE__ */ defineComponent({ + __name: "Load3DControls", + props: { + backgroundColor: {}, + showGrid: { type: Boolean }, + showPreview: { type: Boolean }, + lightIntensity: {}, + showLightIntensityButton: { type: Boolean }, + fov: {}, + showFOVButton: { type: Boolean }, + showPreviewButton: { type: Boolean } + }, + emits: ["toggleCamera", "toggleGrid", "updateBackgroundColor", "updateLightIntensity", "updateFOV", "togglePreview"], + setup(__props, { expose: __expose, emit: __emit }) { + const props = __props; + const emit = __emit; + const backgroundColor = ref(props.backgroundColor); + const showGrid = ref(props.showGrid); + const showPreview = ref(props.showPreview); + const colorPickerRef = ref(null); + const lightIntensity = ref(props.lightIntensity); + const showLightIntensity = ref(false); + const showLightIntensityButton = ref(props.showLightIntensityButton); + const fov2 = ref(props.fov); + const showFOV = ref(false); + const showFOVButton = ref(props.showFOVButton); + const showPreviewButton = ref(props.showPreviewButton); + const toggleCamera = /* @__PURE__ */ __name(() => { + emit("toggleCamera"); + }, "toggleCamera"); + const toggleGrid = /* @__PURE__ */ __name(() => { + showGrid.value = !showGrid.value; + emit("toggleGrid", showGrid.value); + }, "toggleGrid"); + const togglePreview = /* @__PURE__ */ __name(() => { + showPreview.value = !showPreview.value; + emit("togglePreview", showPreview.value); + }, "togglePreview"); + const updateBackgroundColor = /* @__PURE__ */ __name((color) => { + emit("updateBackgroundColor", color); + }, "updateBackgroundColor"); + const openColorPicker = /* @__PURE__ */ __name(() => { + colorPickerRef.value?.click(); + }, "openColorPicker"); + const toggleLightIntensity = /* @__PURE__ */ __name(() => { + showLightIntensity.value = !showLightIntensity.value; + }, "toggleLightIntensity"); + const updateLightIntensity = /* @__PURE__ */ __name(() => { + emit("updateLightIntensity", lightIntensity.value); + }, "updateLightIntensity"); + const toggleFOV = /* @__PURE__ */ __name(() => { + showFOV.value = !showFOV.value; + }, "toggleFOV"); + const updateFOV = /* @__PURE__ */ __name(() => { + emit("updateFOV", fov2.value); + }, "updateFOV"); + const closeSlider = /* @__PURE__ */ __name((e) => { + const target = e.target; + if (!target.closest(".relative")) { + showLightIntensity.value = false; + showFOV.value = false; + } + }, "closeSlider"); + onMounted(() => { + document.addEventListener("click", closeSlider); + }); + onUnmounted(() => { + document.removeEventListener("click", closeSlider); + }); + __expose({ + backgroundColor, + showGrid, + lightIntensity, + showLightIntensityButton, + fov: fov2, + showFOVButton, + showPreviewButton + }); + return (_ctx, _cache2) => { + const _directive_tooltip = resolveDirective("tooltip"); + return openBlock(), createElementBlock("div", _hoisted_1$1, [ + createVNode(unref(script), { + class: "p-button-rounded p-button-text", + onClick: toggleCamera + }, { + default: withCtx(() => [ + withDirectives(createBaseVNode("i", _hoisted_2$1, null, 512), [ + [ + _directive_tooltip, + { value: unref(t)("load3d.switchCamera"), showDelay: 300 }, + void 0, + { right: true } + ] + ]) + ]), + _: 1 + }), + withDirectives((openBlock(), createBlock(unref(script), { + class: normalizeClass(["p-button-rounded p-button-text", { "p-button-outlined": showGrid.value }]), + onClick: toggleGrid + }, { + default: withCtx(() => _cache2[3] || (_cache2[3] = [ + createBaseVNode("i", { class: "pi pi-table text-white text-lg" }, null, -1) + ])), + _: 1 + }, 8, ["class"])), [ + [ + _directive_tooltip, + { value: unref(t)("load3d.showGrid"), showDelay: 300 }, + void 0, + { right: true } + ] + ]), + createVNode(unref(script), { + class: "p-button-rounded p-button-text", + onClick: openColorPicker + }, { + default: withCtx(() => [ + withDirectives(createBaseVNode("i", _hoisted_3, null, 512), [ + [ + _directive_tooltip, + { value: unref(t)("load3d.backgroundColor"), showDelay: 300 }, + void 0, + { right: true } + ] + ]), + createBaseVNode("input", { + type: "color", + ref_key: "colorPickerRef", + ref: colorPickerRef, + value: backgroundColor.value, + onInput: _cache2[0] || (_cache2[0] = ($event) => updateBackgroundColor($event.target.value)), + class: "absolute opacity-0 w-0 h-0 p-0 m-0 pointer-events-none" + }, null, 40, _hoisted_4) + ]), + _: 1 + }), + showLightIntensityButton.value ? (openBlock(), createElementBlock("div", _hoisted_5, [ + createVNode(unref(script), { + class: "p-button-rounded p-button-text", + onClick: toggleLightIntensity + }, { + default: withCtx(() => [ + withDirectives(createBaseVNode("i", _hoisted_6, null, 512), [ + [ + _directive_tooltip, + { + value: unref(t)("load3d.lightIntensity"), + showDelay: 300 + }, + void 0, + { right: true } + ] + ]) + ]), + _: 1 + }), + withDirectives(createBaseVNode("div", _hoisted_7, [ + createVNode(unref(script$1), { + modelValue: lightIntensity.value, + "onUpdate:modelValue": _cache2[1] || (_cache2[1] = ($event) => lightIntensity.value = $event), + class: "w-full", + onChange: updateLightIntensity, + min: 1, + max: 20, + step: 1 + }, null, 8, ["modelValue"]) + ], 512), [ + [vShow, showLightIntensity.value] + ]) + ])) : createCommentVNode("", true), + showFOVButton.value ? (openBlock(), createElementBlock("div", _hoisted_8, [ + createVNode(unref(script), { + class: "p-button-rounded p-button-text", + onClick: toggleFOV + }, { + default: withCtx(() => [ + withDirectives(createBaseVNode("i", _hoisted_9, null, 512), [ + [ + _directive_tooltip, + { value: unref(t)("load3d.fov"), showDelay: 300 }, + void 0, + { right: true } + ] + ]) + ]), + _: 1 + }), + withDirectives(createBaseVNode("div", _hoisted_10, [ + createVNode(unref(script$1), { + modelValue: fov2.value, + "onUpdate:modelValue": _cache2[2] || (_cache2[2] = ($event) => fov2.value = $event), + class: "w-full", + onChange: updateFOV, + min: 10, + max: 150, + step: 1 + }, null, 8, ["modelValue"]) + ], 512), [ + [vShow, showFOV.value] + ]) + ])) : createCommentVNode("", true), + showPreviewButton.value ? (openBlock(), createElementBlock("div", _hoisted_11, [ + createVNode(unref(script), { + class: "p-button-rounded p-button-text", + onClick: togglePreview + }, { + default: withCtx(() => [ + withDirectives(createBaseVNode("i", { + class: normalizeClass([ + "pi", + showPreview.value ? "pi-eye" : "pi-eye-slash", + "text-white text-lg" + ]) + }, null, 2), [ + [ + _directive_tooltip, + { value: unref(t)("load3d.previewOutput"), showDelay: 300 }, + void 0, + { right: true } + ] + ]) + ]), + _: 1 + }) + ])) : createCommentVNode("", true) + ]); + }; + } +}); class Load3d { static { __name(this, "Load3d"); @@ -46237,11 +46499,16 @@ class Load3d { originalRotation = null; viewHelper = {}; viewHelperContainer = {}; - cameraSwitcherContainer = {}; - gridSwitcherContainer = {}; + previewRenderer = null; + previewCamera = null; + previewContainer = {}; + targetWidth = 1024; + targetHeight = 1024; + showPreview = true; node = {}; - bgColorInput = {}; - constructor(container) { + controlsApp = null; + controlsContainer; + constructor(container, options = {}) { this.scene = new Scene(); this.perspectiveCamera = new PerspectiveCamera(75, 1, 0.1, 1e3); this.perspectiveCamera.position.set(5, 5, 5); @@ -46301,12 +46568,45 @@ class Load3d { }); this.standardMaterial = this.createSTLMaterial(); this.createViewHelper(container); - this.createGridSwitcher(container); - this.createCameraSwitcher(container); - this.createColorPicker(container); + if (options && options.createPreview) { + this.createCapturePreview(container); + } + this.controlsContainer = document.createElement("div"); + this.controlsContainer.style.position = "absolute"; + this.controlsContainer.style.top = "0"; + this.controlsContainer.style.left = "0"; + this.controlsContainer.style.width = "100%"; + this.controlsContainer.style.height = "100%"; + this.controlsContainer.style.pointerEvents = "none"; + this.controlsContainer.style.zIndex = "1"; + container.appendChild(this.controlsContainer); + this.mountControls(options); this.handleResize(); this.startAnimation(); } + mountControls(options = {}) { + const controlsMount = document.createElement("div"); + controlsMount.style.pointerEvents = "auto"; + this.controlsContainer.appendChild(controlsMount); + this.controlsApp = createApp(_sfc_main$1, { + backgroundColor: "#282828", + showGrid: true, + showPreview: options.createPreview, + lightIntensity: 5, + showLightIntensityButton: true, + fov: 75, + showFOVButton: true, + showPreviewButton: options.createPreview, + onToggleCamera: /* @__PURE__ */ __name(() => this.toggleCamera(), "onToggleCamera"), + onToggleGrid: /* @__PURE__ */ __name((show) => this.toggleGrid(show), "onToggleGrid"), + onTogglePreview: /* @__PURE__ */ __name((show) => this.togglePreview(show), "onTogglePreview"), + onUpdateBackgroundColor: /* @__PURE__ */ __name((color) => this.setBackgroundColor(color), "onUpdateBackgroundColor"), + onUpdateLightIntensity: /* @__PURE__ */ __name((lightIntensity) => this.setLightIntensity(lightIntensity), "onUpdateLightIntensity"), + onUpdateFOV: /* @__PURE__ */ __name((fov2) => this.setFOV(fov2), "onUpdateFOV") + }); + this.controlsApp.directive("tooltip", Tooltip); + this.controlsApp.mount(controlsMount); + } setNode(node) { this.node = node; } @@ -46321,6 +46621,79 @@ class Load3d { } return this.node.properties[name]; } + createCapturePreview(container) { + this.previewRenderer = new WebGLRenderer({ + alpha: true, + antialias: true + }); + this.previewRenderer.setSize(this.targetWidth, this.targetHeight); + this.previewRenderer.setClearColor(2631720); + this.previewContainer = document.createElement("div"); + this.previewContainer.style.cssText = ` + position: absolute; + right: 0px; + bottom: 0px; + background: rgba(0, 0, 0, 0.2); + display: block; + `; + this.previewContainer.appendChild(this.previewRenderer.domElement); + this.previewContainer.style.display = this.showPreview ? "block" : "none"; + container.appendChild(this.previewContainer); + } + updatePreviewRender() { + if (!this.previewRenderer || !this.previewContainer || !this.showPreview) + return; + if (!this.previewCamera || this.activeCamera instanceof PerspectiveCamera && !(this.previewCamera instanceof PerspectiveCamera) || this.activeCamera instanceof OrthographicCamera && !(this.previewCamera instanceof OrthographicCamera)) { + this.previewCamera = this.activeCamera.clone(); + } + this.previewCamera.position.copy(this.activeCamera.position); + this.previewCamera.rotation.copy(this.activeCamera.rotation); + const aspect2 = this.targetWidth / this.targetHeight; + if (this.activeCamera instanceof OrthographicCamera) { + const activeOrtho = this.activeCamera; + const previewOrtho = this.previewCamera; + const frustumHeight = (activeOrtho.top - activeOrtho.bottom) / activeOrtho.zoom; + const frustumWidth = frustumHeight * aspect2; + previewOrtho.top = frustumHeight / 2; + previewOrtho.left = -frustumWidth / 2; + previewOrtho.right = frustumWidth / 2; + previewOrtho.bottom = -frustumHeight / 2; + previewOrtho.zoom = 1; + previewOrtho.updateProjectionMatrix(); + } else { + ; + this.previewCamera.aspect = aspect2; + this.previewCamera.fov = this.activeCamera.fov; + } + this.previewCamera.lookAt(this.controls.target); + const previewWidth = 120; + const previewHeight = previewWidth * this.targetHeight / this.targetWidth; + this.previewRenderer.setSize(previewWidth, previewHeight, false); + this.previewRenderer.render(this.scene, this.previewCamera); + } + updatePreviewSize() { + if (!this.previewContainer) return; + const previewWidth = 120; + const previewHeight = previewWidth * this.targetHeight / this.targetWidth; + this.previewRenderer?.setSize(previewWidth, previewHeight, false); + } + setTargetSize(width, height) { + this.targetWidth = width; + this.targetHeight = height; + this.updatePreviewSize(); + if (this.previewRenderer && this.previewCamera) { + if (this.previewCamera instanceof PerspectiveCamera) { + this.previewCamera.aspect = width / height; + this.previewCamera.updateProjectionMatrix(); + } else if (this.previewCamera instanceof OrthographicCamera) { + const frustumSize = 10; + const aspect2 = width / height; + this.previewCamera.left = -frustumSize * aspect2 / 2; + this.previewCamera.right = frustumSize * aspect2 / 2; + this.previewCamera.updateProjectionMatrix(); + } + } + } createViewHelper(container) { this.viewHelperContainer = document.createElement("div"); this.viewHelperContainer.style.position = "absolute"; @@ -46342,127 +46715,17 @@ class Load3d { ); this.viewHelper.center = this.controls.target; } - createGridSwitcher(container) { - this.gridSwitcherContainer = document.createElement("div"); - this.gridSwitcherContainer.style.position = "absolute"; - this.gridSwitcherContainer.style.top = "28px"; - this.gridSwitcherContainer.style.left = "3px"; - this.gridSwitcherContainer.style.width = "20px"; - this.gridSwitcherContainer.style.height = "20px"; - this.gridSwitcherContainer.style.cursor = "pointer"; - this.gridSwitcherContainer.style.alignItems = "center"; - this.gridSwitcherContainer.style.justifyContent = "center"; - this.gridSwitcherContainer.style.transition = "background-color 0.2s"; - const gridIcon = document.createElement("div"); - gridIcon.innerHTML = ` - - - - - - - - `; - const updateButtonState = /* @__PURE__ */ __name(() => { - if (this.gridHelper.visible) { - this.gridSwitcherContainer.style.backgroundColor = "rgba(255, 255, 255, 0.2)"; - } else { - this.gridSwitcherContainer.style.backgroundColor = "transparent"; - } - }, "updateButtonState"); - updateButtonState(); - this.gridSwitcherContainer.addEventListener("mouseenter", () => { - if (!this.gridHelper.visible) { - this.gridSwitcherContainer.style.backgroundColor = "rgba(0, 0, 0, 0.5)"; - } - }); - this.gridSwitcherContainer.addEventListener("mouseleave", () => { - if (!this.gridHelper.visible) { - this.gridSwitcherContainer.style.backgroundColor = "transparent"; - } - }); - this.gridSwitcherContainer.title = "Toggle Grid"; - this.gridSwitcherContainer.addEventListener("click", (event) => { - event.stopPropagation(); - this.toggleGrid(!this.gridHelper.visible); - updateButtonState(); - }); - this.gridSwitcherContainer.appendChild(gridIcon); - container.appendChild(this.gridSwitcherContainer); - } - createCameraSwitcher(container) { - this.cameraSwitcherContainer = document.createElement("div"); - this.cameraSwitcherContainer.style.position = "absolute"; - this.cameraSwitcherContainer.style.top = "3px"; - this.cameraSwitcherContainer.style.left = "3px"; - this.cameraSwitcherContainer.style.width = "20px"; - this.cameraSwitcherContainer.style.height = "20px"; - this.cameraSwitcherContainer.style.cursor = "pointer"; - this.cameraSwitcherContainer.style.alignItems = "center"; - this.cameraSwitcherContainer.style.justifyContent = "center"; - const cameraIcon = document.createElement("div"); - cameraIcon.innerHTML = ` - - - - - - `; - this.cameraSwitcherContainer.addEventListener("mouseenter", () => { - this.cameraSwitcherContainer.style.backgroundColor = "rgba(0, 0, 0, 0.5)"; - }); - this.cameraSwitcherContainer.addEventListener("mouseleave", () => { - this.cameraSwitcherContainer.style.backgroundColor = "rgba(0, 0, 0, 0.3)"; - }); - this.cameraSwitcherContainer.title = "Switch Camera (Perspective/Orthographic)"; - this.cameraSwitcherContainer.addEventListener("click", (event) => { - event.stopPropagation(); - this.toggleCamera(); - }); - this.cameraSwitcherContainer.appendChild(cameraIcon); - container.appendChild(this.cameraSwitcherContainer); - } - createColorPicker(container) { - const colorPickerContainer = document.createElement("div"); - colorPickerContainer.style.position = "absolute"; - colorPickerContainer.style.top = "53px"; - colorPickerContainer.style.left = "3px"; - colorPickerContainer.style.width = "20px"; - colorPickerContainer.style.height = "20px"; - colorPickerContainer.style.cursor = "pointer"; - colorPickerContainer.style.alignItems = "center"; - colorPickerContainer.style.justifyContent = "center"; - colorPickerContainer.title = "Background Color"; - const colorInput = document.createElement("input"); - colorInput.type = "color"; - colorInput.style.opacity = "0"; - colorInput.style.position = "absolute"; - colorInput.style.width = "100%"; - colorInput.style.height = "100%"; - colorInput.style.cursor = "pointer"; - const colorIcon = document.createElement("div"); - colorIcon.innerHTML = ` - - - - - - `; - colorInput.addEventListener("input", (event) => { - const color = event.target.value; - this.setBackgroundColor(color); - this.storeNodeProperty("Background Color", color); - }); - this.bgColorInput = colorInput; - colorPickerContainer.appendChild(colorInput); - colorPickerContainer.appendChild(colorIcon); - container.appendChild(colorPickerContainer); - } setFOV(fov2) { if (this.activeCamera === this.perspectiveCamera) { this.perspectiveCamera.fov = fov2; this.perspectiveCamera.updateProjectionMatrix(); this.renderer.render(this.scene, this.activeCamera); + this.storeNodeProperty("FOV", fov2); + } + if (this.previewRenderer && this.previewCamera instanceof PerspectiveCamera) { + this.previewCamera.fov = fov2; + this.previewCamera.updateProjectionMatrix(); + this.previewRenderer.render(this.scene, this.previewCamera); } } getCameraState() { @@ -46475,8 +46738,6 @@ class Load3d { }; } setCameraState(state) { - if (this.activeCamera !== (state.cameraType === "perspective" ? this.perspectiveCamera : this.orthographicCamera)) { - } this.activeCamera.position.copy(state.position); this.controls.target.copy(state.target); if (this.activeCamera instanceof OrthographicCamera) { @@ -46522,6 +46783,9 @@ class Load3d { } setMaterialMode(mode) { this.materialMode = mode; + if (this.controlsApp?._instance?.exposed) { + this.controlsApp._instance.exposed.showLightIntensityButton.value = mode == "original"; + } if (this.currentModel) { if (mode === "depth") { this.renderer.outputColorSpace = LinearSRGBColorSpace; @@ -46641,6 +46905,10 @@ class Load3d { return; } } + if (this.previewCamera) { + this.previewCamera = null; + } + this.previewCamera = this.activeCamera.clone(); this.activeCamera.position.copy(position); this.activeCamera.rotation.copy(rotation); if (this.materialMode === "depth" && oldCamera !== this.activeCamera) { @@ -46655,8 +46923,12 @@ class Load3d { this.viewHelperContainer ); this.viewHelper.center = this.controls.target; + if (this.controlsApp?._instance?.exposed) { + this.controlsApp._instance.exposed.showFOVButton.value = this.getCurrentCameraType() == "perspective"; + } this.storeNodeProperty("Camera Type", this.getCurrentCameraType()); this.handleResize(); + this.updatePreviewRender(); } getCurrentCameraType() { return this.activeCamera === this.perspectiveCamera ? "perspective" : "orthographic"; @@ -46667,6 +46939,13 @@ class Load3d { this.storeNodeProperty("Show Grid", showGrid); } } + togglePreview(showPreview) { + if (this.previewRenderer) { + this.showPreview = showPreview; + this.previewContainer.style.display = this.showPreview ? "block" : "none"; + this.storeNodeProperty("Show Preview", showPreview); + } + } setLightIntensity(intensity) { this.lights.forEach((light) => { if (light instanceof DirectionalLight) { @@ -46683,10 +46962,14 @@ class Load3d { light.intensity = intensity * 0.5; } }); + this.storeNodeProperty("Light Intensity", intensity); } startAnimation() { const animate = /* @__PURE__ */ __name(() => { this.animationFrameId = requestAnimationFrame(animate); + if (this.showPreview) { + this.updatePreviewRender(); + } const delta = this.clock.getDelta(); if (this.viewHelper.animating) { this.viewHelper.update(delta); @@ -46764,6 +47047,10 @@ class Load3d { this.controls.dispose(); this.viewHelper.dispose(); this.renderer.dispose(); + if (this.controlsApp) { + this.controlsApp.unmount(); + this.controlsApp = null; + } this.renderer.domElement.remove(); this.scene.clear(); } @@ -46893,6 +47180,9 @@ class Load3d { this.renderer.toneMappingExposure = 1; this.handleResize(); } + refreshViewport() { + this.handleResize(); + } handleResize() { const parentElement = this.renderer?.domElement?.parentElement; if (!parentElement) { @@ -46914,6 +47204,7 @@ class Load3d { this.orthographicCamera.updateProjectionMatrix(); } this.renderer.setSize(width, height); + this.setTargetSize(this.targetWidth, this.targetHeight); } animate = /* @__PURE__ */ __name(() => { requestAnimationFrame(this.animate); @@ -46923,6 +47214,7 @@ class Load3d { captureScene(width, height) { return new Promise(async (resolve, reject) => { try { + this.updatePreviewSize(); const originalWidth = this.renderer.domElement.width; const originalHeight = this.renderer.domElement.height; const originalClearColor = this.renderer.getClearColor( @@ -46970,11 +47262,161 @@ class Load3d { setBackgroundColor(color) { this.renderer.setClearColor(new Color(color)); this.renderer.render(this.scene, this.activeCamera); - if (this.bgColorInput) { - this.bgColorInput.value = color; + if (this.controlsApp?._instance?.exposed) { + this.controlsApp._instance.exposed.backgroundColor.value = color; } + this.storeNodeProperty("Background Color", color); } } +const _hoisted_1 = { class: "absolute top-0 left-0 w-full h-full pointer-events-none" }; +const _hoisted_2 = { + key: 0, + class: "absolute top-0 left-0 w-full flex justify-center pt-2 gap-2 items-center z-10" +}; +const _sfc_main = /* @__PURE__ */ defineComponent({ + __name: "Load3DAnimationControls", + props: { + animations: {}, + playing: { type: Boolean }, + backgroundColor: {}, + showGrid: { type: Boolean }, + showPreview: { type: Boolean }, + lightIntensity: {}, + showLightIntensityButton: { type: Boolean }, + fov: {}, + showFOVButton: { type: Boolean }, + showPreviewButton: { type: Boolean } + }, + emits: ["toggleCamera", "toggleGrid", "togglePreview", "updateBackgroundColor", "togglePlay", "speedChange", "animationChange", "updateLightIntensity", "updateFOV"], + setup(__props, { expose: __expose, emit: __emit }) { + const props = __props; + const emit = __emit; + const animations = ref(props.animations); + const playing = ref(props.playing); + const selectedSpeed = ref(1); + const selectedAnimation = ref(0); + const backgroundColor = ref(props.backgroundColor); + const showGrid = ref(props.showGrid); + const showPreview = ref(props.showPreview); + const lightIntensity = ref(props.lightIntensity); + const showLightIntensityButton = ref(props.showLightIntensityButton); + const fov2 = ref(props.fov); + const showFOVButton = ref(props.showFOVButton); + const showPreviewButton = ref(props.showPreviewButton); + const load3dControlsRef = ref(null); + const speedOptions = [ + { name: "0.1x", value: 0.1 }, + { name: "0.5x", value: 0.5 }, + { name: "1x", value: 1 }, + { name: "1.5x", value: 1.5 }, + { name: "2x", value: 2 } + ]; + watch(backgroundColor, (newValue) => { + load3dControlsRef.value.backgroundColor = newValue; + }); + watch(showLightIntensityButton, (newValue) => { + load3dControlsRef.value.showLightIntensityButton = newValue; + }); + watch(showFOVButton, (newValue) => { + load3dControlsRef.value.showFOVButton = newValue; + }); + watch(showPreviewButton, (newValue) => { + load3dControlsRef.value.showPreviewButton = newValue; + }); + const onToggleCamera = /* @__PURE__ */ __name(() => { + emit("toggleCamera"); + }, "onToggleCamera"); + const onToggleGrid = /* @__PURE__ */ __name((value) => emit("toggleGrid", value), "onToggleGrid"); + const onTogglePreview = /* @__PURE__ */ __name((value) => { + emit("togglePreview", value); + }, "onTogglePreview"); + const onUpdateBackgroundColor = /* @__PURE__ */ __name((color) => emit("updateBackgroundColor", color), "onUpdateBackgroundColor"); + const onUpdateLightIntensity = /* @__PURE__ */ __name((lightIntensity2) => { + emit("updateLightIntensity", lightIntensity2); + }, "onUpdateLightIntensity"); + const onUpdateFOV = /* @__PURE__ */ __name((fov22) => { + emit("updateFOV", fov22); + }, "onUpdateFOV"); + const togglePlay = /* @__PURE__ */ __name(() => { + playing.value = !playing.value; + emit("togglePlay", playing.value); + }, "togglePlay"); + const speedChange = /* @__PURE__ */ __name(() => { + emit("speedChange", selectedSpeed.value); + }, "speedChange"); + const animationChange = /* @__PURE__ */ __name(() => { + emit("animationChange", selectedAnimation.value); + }, "animationChange"); + __expose({ + animations, + selectedAnimation, + playing, + backgroundColor, + showGrid, + lightIntensity, + showLightIntensityButton, + fov: fov2, + showFOVButton + }); + return (_ctx, _cache2) => { + return openBlock(), createElementBlock("div", _hoisted_1, [ + createVNode(_sfc_main$1, { + backgroundColor: backgroundColor.value, + showGrid: showGrid.value, + showPreview: showPreview.value, + lightIntensity: lightIntensity.value, + showLightIntensityButton: showLightIntensityButton.value, + fov: fov2.value, + showFOVButton: showFOVButton.value, + showPreviewButton: showPreviewButton.value, + onToggleCamera, + onToggleGrid, + onTogglePreview, + onUpdateBackgroundColor, + onUpdateLightIntensity, + onUpdateFOV, + ref_key: "load3dControlsRef", + ref: load3dControlsRef + }, null, 8, ["backgroundColor", "showGrid", "showPreview", "lightIntensity", "showLightIntensityButton", "fov", "showFOVButton", "showPreviewButton"]), + animations.value && animations.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_2, [ + createVNode(unref(script), { + class: "p-button-rounded p-button-text", + onClick: togglePlay + }, { + default: withCtx(() => [ + createBaseVNode("i", { + class: normalizeClass([ + "pi", + playing.value ? "pi-pause" : "pi-play", + "text-white text-lg" + ]) + }, null, 2) + ]), + _: 1 + }), + createVNode(unref(script$2), { + modelValue: selectedSpeed.value, + "onUpdate:modelValue": _cache2[0] || (_cache2[0] = ($event) => selectedSpeed.value = $event), + options: speedOptions, + optionLabel: "name", + optionValue: "value", + onChange: speedChange, + class: "w-24" + }, null, 8, ["modelValue"]), + createVNode(unref(script$2), { + modelValue: selectedAnimation.value, + "onUpdate:modelValue": _cache2[1] || (_cache2[1] = ($event) => selectedAnimation.value = $event), + options: animations.value, + optionLabel: "name", + optionValue: "index", + onChange: animationChange, + class: "w-32" + }, null, 8, ["modelValue", "options"]) + ])) : createCommentVNode("", true) + ]); + }; + } +}); class Load3dAnimation extends Load3d { static { __name(this, "Load3dAnimation"); @@ -46985,143 +47427,49 @@ class Load3dAnimation extends Load3d { selectedAnimationIndex = 0; isAnimationPlaying = false; animationSpeed = 1; - playPauseContainer = {}; - animationSelect = {}; - speedSelect = {}; - constructor(container) { - super(container); - this.createPlayPauseButton(container); - this.createAnimationList(container); - this.createSpeedSelect(container); + constructor(container, options = {}) { + super(container, options); } - createAnimationList(container) { - this.animationSelect = document.createElement("select"); - Object.assign(this.animationSelect.style, { - position: "absolute", - top: "3px", - left: "50%", - transform: "translateX(15px)", - width: "90px", - height: "20px", - backgroundColor: "rgba(0, 0, 0, 0.3)", - color: "white", - border: "none", - borderRadius: "4px", - fontSize: "12px", - padding: "0 8px", - cursor: "pointer", - display: "none", - outline: "none" + mountControls(options = {}) { + const controlsMount = document.createElement("div"); + controlsMount.style.pointerEvents = "auto"; + this.controlsContainer.appendChild(controlsMount); + this.controlsApp = createApp(_sfc_main, { + backgroundColor: "#282828", + showGrid: true, + showPreview: options.createPreview, + animations: [], + playing: false, + lightIntensity: 5, + showLightIntensityButton: true, + fov: 75, + showFOVButton: true, + showPreviewButton: options.createPreview, + onToggleCamera: /* @__PURE__ */ __name(() => this.toggleCamera(), "onToggleCamera"), + onToggleGrid: /* @__PURE__ */ __name((show) => this.toggleGrid(show), "onToggleGrid"), + onTogglePreview: /* @__PURE__ */ __name((show) => this.togglePreview(show), "onTogglePreview"), + onUpdateBackgroundColor: /* @__PURE__ */ __name((color) => this.setBackgroundColor(color), "onUpdateBackgroundColor"), + onTogglePlay: /* @__PURE__ */ __name((play) => this.toggleAnimation(play), "onTogglePlay"), + onSpeedChange: /* @__PURE__ */ __name((speed) => this.setAnimationSpeed(speed), "onSpeedChange"), + onAnimationChange: /* @__PURE__ */ __name((selectedAnimation) => this.updateSelectedAnimation(selectedAnimation), "onAnimationChange"), + onUpdateLightIntensity: /* @__PURE__ */ __name((lightIntensity) => this.setLightIntensity(lightIntensity), "onUpdateLightIntensity"), + onUpdateFOV: /* @__PURE__ */ __name((fov2) => this.setFOV(fov2), "onUpdateFOV") }); - this.animationSelect.addEventListener("mouseenter", () => { - this.animationSelect.style.backgroundColor = "rgba(0, 0, 0, 0.5)"; - }); - this.animationSelect.addEventListener("mouseleave", () => { - this.animationSelect.style.backgroundColor = "rgba(0, 0, 0, 0.3)"; - }); - this.animationSelect.addEventListener("change", (event) => { - const select = event.target; - this.updateSelectedAnimation(select.selectedIndex); - }); - container.appendChild(this.animationSelect); + this.controlsApp.use(PrimeVue); + this.controlsApp.directive("tooltip", Tooltip); + this.controlsApp.mount(controlsMount); } updateAnimationList() { - this.animationSelect.innerHTML = ""; - this.animationClips.forEach((clip, index) => { - const option = document.createElement("option"); - option.value = index.toString(); - option.text = clip.name || `Animation ${index + 1}`; - option.selected = index === this.selectedAnimationIndex; - this.animationSelect.appendChild(option); - }); - } - createPlayPauseButton(container) { - this.playPauseContainer = document.createElement("div"); - this.playPauseContainer.style.position = "absolute"; - this.playPauseContainer.style.top = "3px"; - this.playPauseContainer.style.left = "50%"; - this.playPauseContainer.style.transform = "translateX(-50%)"; - this.playPauseContainer.style.width = "20px"; - this.playPauseContainer.style.height = "20px"; - this.playPauseContainer.style.cursor = "pointer"; - this.playPauseContainer.style.alignItems = "center"; - this.playPauseContainer.style.justifyContent = "center"; - const updateButtonState = /* @__PURE__ */ __name(() => { - const icon = this.playPauseContainer.querySelector("svg"); - if (icon) { - if (this.isAnimationPlaying) { - icon.innerHTML = ` - - `; - this.playPauseContainer.title = "Pause Animation"; - } else { - icon.innerHTML = ` - - `; - this.playPauseContainer.title = "Play Animation"; - } + if (this.controlsApp?._instance?.exposed) { + if (this.animationClips.length > 0) { + this.controlsApp._instance.exposed.animations.value = this.animationClips.map((clip, index) => ({ + name: clip.name || `Animation ${index + 1}`, + index + })); + } else { + this.controlsApp._instance.exposed.animations.value = []; } - }, "updateButtonState"); - const playIcon = document.createElement("div"); - playIcon.innerHTML = ` - - - - `; - this.playPauseContainer.addEventListener("mouseenter", () => { - this.playPauseContainer.style.backgroundColor = "rgba(0, 0, 0, 0.5)"; - }); - this.playPauseContainer.addEventListener("mouseleave", () => { - this.playPauseContainer.style.backgroundColor = "transparent"; - }); - this.playPauseContainer.addEventListener("click", (event) => { - event.stopPropagation(); - this.toggleAnimation(); - updateButtonState(); - }); - this.playPauseContainer.appendChild(playIcon); - container.appendChild(this.playPauseContainer); - this.playPauseContainer.style.display = "none"; - } - createSpeedSelect(container) { - this.speedSelect = document.createElement("select"); - Object.assign(this.speedSelect.style, { - position: "absolute", - top: "3px", - left: "50%", - transform: "translateX(-75px)", - width: "60px", - height: "20px", - backgroundColor: "rgba(0, 0, 0, 0.3)", - color: "white", - border: "none", - borderRadius: "4px", - fontSize: "12px", - padding: "0 8px", - cursor: "pointer", - display: "none", - outline: "none" - }); - const speeds = [0.1, 0.5, 1, 1.5, 2]; - speeds.forEach((speed) => { - const option = document.createElement("option"); - option.value = speed.toString(); - option.text = `${speed}x`; - option.selected = speed === 1; - this.speedSelect.appendChild(option); - }); - this.speedSelect.addEventListener("mouseenter", () => { - this.speedSelect.style.backgroundColor = "rgba(0, 0, 0, 0.5)"; - }); - this.speedSelect.addEventListener("mouseleave", () => { - this.speedSelect.style.backgroundColor = "rgba(0, 0, 0, 0.3)"; - }); - this.speedSelect.addEventListener("change", (event) => { - const select = event.target; - const newSpeed = parseFloat(select.value); - this.setAnimationSpeed(newSpeed); - }); - container.appendChild(this.speedSelect); + } } async setupModel(model) { await super.setupModel(model); @@ -47146,21 +47494,7 @@ class Load3dAnimation extends Load3d { this.updateSelectedAnimation(0); } } - if (this.animationClips.length > 0) { - this.playPauseContainer.style.display = "block"; - } else { - this.playPauseContainer.style.display = "none"; - } - if (this.animationClips.length > 0) { - this.playPauseContainer.style.display = "block"; - this.animationSelect.style.display = "block"; - this.speedSelect.style.display = "block"; - this.updateAnimationList(); - } else { - this.playPauseContainer.style.display = "none"; - this.animationSelect.style.display = "none"; - this.speedSelect.style.display = "none"; - } + this.updateAnimationList(); } setAnimationSpeed(speed) { this.animationSpeed = speed; @@ -47192,7 +47526,9 @@ class Load3dAnimation extends Load3d { action.paused = true; } this.animationActions = [action]; - this.updateAnimationList(); + if (this.controlsApp?._instance?.exposed) { + this.controlsApp._instance.exposed.selectedAnimation.value = index; + } } clearModel() { if (this.currentAnimation) { @@ -47206,20 +47542,11 @@ class Load3dAnimation extends Load3d { this.selectedAnimationIndex = 0; this.isAnimationPlaying = false; this.animationSpeed = 1; + if (this.controlsApp?._instance?.exposed) { + this.controlsApp._instance.exposed.animations.value = []; + this.controlsApp._instance.exposed.selectedAnimation.value = 0; + } super.clearModel(); - if (this.animationSelect) { - this.animationSelect.style.display = "none"; - this.animationSelect.innerHTML = ""; - } - if (this.speedSelect) { - this.speedSelect.style.display = "none"; - this.speedSelect.value = "1"; - } - } - getAnimationNames() { - return this.animationClips.map((clip, index) => { - return clip.name || `Animation ${index + 1}`; - }); } toggleAnimation(play) { if (!this.currentAnimation || this.animationActions.length === 0) { @@ -47227,15 +47554,8 @@ class Load3dAnimation extends Load3d { return; } this.isAnimationPlaying = play ?? !this.isAnimationPlaying; - const icon = this.playPauseContainer.querySelector("svg"); - if (icon) { - if (this.isAnimationPlaying) { - icon.innerHTML = ''; - this.playPauseContainer.title = "Pause Animation"; - } else { - icon.innerHTML = ''; - this.playPauseContainer.title = "Play Animation"; - } + if (this.controlsApp?._instance?.exposed) { + this.controlsApp._instance.exposed.playing.value = this.isAnimationPlaying; } this.animationActions.forEach((action) => { if (this.isAnimationPlaying) { @@ -47251,6 +47571,9 @@ class Load3dAnimation extends Load3d { startAnimation() { const animate = /* @__PURE__ */ __name(() => { this.animationFrameId = requestAnimationFrame(animate); + if (this.showPreview) { + this.updatePreviewRender(); + } const delta = this.clock.getDelta(); if (this.currentAnimation && this.isAnimationPlaying) { this.currentAnimation.update(delta); @@ -47269,19 +47592,77 @@ class Load3dAnimation extends Load3d { animate(); } } -const containerToLoad3D = /* @__PURE__ */ new Map(); +class Load3dService { + static { + __name(this, "Load3dService"); + } + static instance; + nodeToLoad3dMap = /* @__PURE__ */ new Map(); + constructor() { + } + static getInstance() { + if (!Load3dService.instance) { + Load3dService.instance = new Load3dService(); + } + return Load3dService.instance; + } + registerLoad3d(node, container, type) { + if (this.nodeToLoad3dMap.has(node)) { + this.removeLoad3d(node); + } + const isAnimation = type.includes("Animation"); + const Load3dClass = isAnimation ? Load3dAnimation : Load3d; + const isPreview = type.includes("Preview"); + const instance = new Load3dClass(container, { createPreview: !isPreview }); + instance.setNode(node); + this.nodeToLoad3dMap.set(node, instance); + return instance; + } + getLoad3d(node) { + return this.nodeToLoad3dMap.get(node) || null; + } + getNodeByLoad3d(load3d) { + for (const [node, instance] of this.nodeToLoad3dMap) { + if (instance === load3d) { + return node; + } + } + return null; + } + removeLoad3d(node) { + const instance = this.nodeToLoad3dMap.get(node); + if (instance) { + instance.remove(); + this.nodeToLoad3dMap.delete(node); + } + } + clear() { + for (const [node] of this.nodeToLoad3dMap) { + this.removeLoad3d(node); + } + } +} +const useLoad3dService = /* @__PURE__ */ __name(() => { + return Load3dService.getInstance(); +}, "useLoad3dService"); app.registerExtension({ name: "Comfy.Load3D", getCustomWidgets(app2) { return { LOAD_3D(node, inputName) { - let load3dNode = app2.graph._nodes.filter((wi) => wi.type == "Load3D"); node.addProperty("Camera Info", ""); const container = document.createElement("div"); - container.id = `comfy-load-3d-${load3dNode.length}`; container.classList.add("comfy-load-3d"); - const load3d = new Load3d(container); - containerToLoad3D.set(container.id, load3d); + const load3d = useLoad3dService().registerLoad3d( + node, + container, + "Load3D" + ); + node.onMouseEnter = function() { + if (load3d) { + load3d.refreshViewport(); + } + }; node.onResize = function() { if (load3d) { load3d.handleResize(); @@ -47292,7 +47673,7 @@ app.registerExtension({ if (load3d) { load3d.remove(); } - containerToLoad3D.delete(container.id); + useLoad3dService().removeLoad3d(node); origOnRemoved?.apply(this, []); }; node.onDrawBackground = function() { @@ -47346,39 +47727,33 @@ app.registerExtension({ const [oldWidth, oldHeight] = node.size; node.setSize([Math.max(oldWidth, 300), Math.max(oldHeight, 600)]); await nextTick(); - const sceneWidget = node.widgets.find((w2) => w2.name === "image"); - const container = sceneWidget.element; - const load3d = containerToLoad3D.get(container.id); - load3d.setNode(node); + const sceneWidget = node.widgets.find((w) => w.name === "image"); + const load3d = useLoad3dService().getLoad3d(node); const modelWidget = node.widgets.find( - (w2) => w2.name === "model_file" - ); - const material = node.widgets.find((w2) => w2.name === "material"); - const lightIntensity = node.widgets.find( - (w2) => w2.name === "light_intensity" + (w) => w.name === "model_file" ); + const material = node.widgets.find((w) => w.name === "material"); const upDirection = node.widgets.find( - (w2) => w2.name === "up_direction" + (w) => w.name === "up_direction" ); - const fov2 = node.widgets.find((w2) => w2.name === "fov"); let cameraState = node.properties["Camera Info"]; const config = new Load3DConfiguration(load3d); + const width = node.widgets.find((w) => w.name === "width"); + const height = node.widgets.find((w) => w.name === "height"); config.configure( "input", modelWidget, material, - lightIntensity, upDirection, - fov2, - cameraState + cameraState, + width, + height ); - 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"] = load3d.getCameraState(); const { scene: imageData, mask: maskData } = await load3d.captureScene( - w.value, - h.value + width.value, + height.value ); const [data, dataMask] = await Promise.all([ Load3dUtils.uploadTempImage(imageData, "scene"), @@ -47396,15 +47771,19 @@ app.registerExtension({ getCustomWidgets(app2) { return { LOAD_3D_ANIMATION(node, inputName) { - let load3dNode = app2.graph._nodes.filter( - (wi) => wi.type == "Load3DAnimation" - ); node.addProperty("Camera Info", ""); const container = document.createElement("div"); - container.id = `comfy-load-3d-animation-${load3dNode.length}`; container.classList.add("comfy-load-3d-animation"); - const load3d = new Load3dAnimation(container); - containerToLoad3D.set(container.id, load3d); + const load3d = useLoad3dService().registerLoad3d( + node, + container, + "Load3DAnimation" + ); + node.onMouseEnter = function() { + if (load3d) { + load3d.refreshViewport(); + } + }; node.onResize = function() { if (load3d) { load3d.handleResize(); @@ -47415,7 +47794,7 @@ app.registerExtension({ if (load3d) { load3d.remove(); } - containerToLoad3D.delete(container.id); + useLoad3dService().removeLoad3d(node); origOnRemoved?.apply(this, []); }; node.onDrawBackground = function() { @@ -47467,42 +47846,36 @@ app.registerExtension({ async nodeCreated(node) { if (node.constructor.comfyClass !== "Load3DAnimation") return; const [oldWidth, oldHeight] = node.size; - node.setSize([Math.max(oldWidth, 300), Math.max(oldHeight, 700)]); + node.setSize([Math.max(oldWidth, 400), Math.max(oldHeight, 700)]); await nextTick(); - const sceneWidget = node.widgets.find((w2) => w2.name === "image"); - const container = sceneWidget.element; - const load3d = containerToLoad3D.get(container.id); - load3d.setNode(node); + const sceneWidget = node.widgets.find((w) => w.name === "image"); + const load3d = useLoad3dService().getLoad3d(node); const modelWidget = node.widgets.find( - (w2) => w2.name === "model_file" - ); - const material = node.widgets.find((w2) => w2.name === "material"); - const lightIntensity = node.widgets.find( - (w2) => w2.name === "light_intensity" + (w) => w.name === "model_file" ); + const material = node.widgets.find((w) => w.name === "material"); const upDirection = node.widgets.find( - (w2) => w2.name === "up_direction" + (w) => w.name === "up_direction" ); - const fov2 = node.widgets.find((w2) => w2.name === "fov"); let cameraState = node.properties["Camera Info"]; const config = new Load3DConfiguration(load3d); + const width = node.widgets.find((w) => w.name === "width"); + const height = node.widgets.find((w) => w.name === "height"); config.configure( "input", modelWidget, material, - lightIntensity, upDirection, - fov2, - cameraState + cameraState, + width, + height ); - 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"] = load3d.getCameraState(); load3d.toggleAnimation(false); const { scene: imageData, mask: maskData } = await load3d.captureScene( - w.value, - h.value + width.value, + height.value ); const [data, dataMask] = await Promise.all([ Load3dUtils.uploadTempImage(imageData, "scene"), @@ -47528,12 +47901,18 @@ app.registerExtension({ getCustomWidgets(app2) { return { PREVIEW_3D(node, inputName) { - let load3dNode = app2.graph._nodes.filter((wi) => wi.type == "Preview3D"); const container = document.createElement("div"); - container.id = `comfy-preview-3d-${load3dNode.length}`; container.classList.add("comfy-preview-3d"); - const load3d = new Load3d(container); - containerToLoad3D.set(container.id, load3d); + const load3d = useLoad3dService().registerLoad3d( + node, + container, + "Preview3D" + ); + node.onMouseEnter = function() { + if (load3d) { + load3d.refreshViewport(); + } + }; node.onResize = function() { if (load3d) { load3d.handleResize(); @@ -47544,7 +47923,7 @@ app.registerExtension({ if (load3d) { load3d.remove(); } - containerToLoad3D.delete(container.id); + useLoad3dService().removeLoad3d(node); origOnRemoved?.apply(this, []); }; node.onDrawBackground = function() { @@ -47559,23 +47938,16 @@ app.registerExtension({ async nodeCreated(node) { if (node.constructor.comfyClass !== "Preview3D") return; const [oldWidth, oldHeight] = node.size; - node.setSize([Math.max(oldWidth, 300), Math.max(oldHeight, 550)]); + node.setSize([Math.max(oldWidth, 400), Math.max(oldHeight, 550)]); await nextTick(); - const sceneWidget = node.widgets.find((w) => w.name === "image"); - const container = sceneWidget.element; - const load3d = containerToLoad3D.get(container.id); - load3d.setNode(node); + const load3d = useLoad3dService().getLoad3d(node); const modelWidget = node.widgets.find( (w) => w.name === "model_file" ); const material = node.widgets.find((w) => w.name === "material"); - const lightIntensity = node.widgets.find( - (w) => w.name === "light_intensity" - ); const upDirection = node.widgets.find( (w) => w.name === "up_direction" ); - const fov2 = node.widgets.find((w) => w.name === "fov"); const onExecuted = node.onExecuted; node.onExecuted = function(message) { onExecuted?.apply(this, arguments); @@ -47587,14 +47959,7 @@ app.registerExtension({ } modelWidget.value = filePath.replaceAll("\\", "/"); const config = new Load3DConfiguration(load3d); - config.configure( - "output", - modelWidget, - material, - lightIntensity, - upDirection, - fov2 - ); + config.configure("output", modelWidget, material, upDirection); }; } }); @@ -47611,14 +47976,18 @@ app.registerExtension({ getCustomWidgets(app2) { return { PREVIEW_3D_ANIMATION(node, inputName) { - let load3dNode = app2.graph._nodes.filter( - (wi) => wi.type == "Preview3DAnimation" - ); const container = document.createElement("div"); - container.id = `comfy-preview-3d-animation-${load3dNode.length}`; container.classList.add("comfy-preview-3d-animation"); - const load3d = new Load3dAnimation(container); - containerToLoad3D.set(container.id, load3d); + const load3d = useLoad3dService().registerLoad3d( + node, + container, + "Preview3DAnimation" + ); + node.onMouseEnter = function() { + if (load3d) { + load3d.refreshViewport(); + } + }; node.onResize = function() { if (load3d) { load3d.handleResize(); @@ -47629,7 +47998,7 @@ app.registerExtension({ if (load3d) { load3d.remove(); } - containerToLoad3D.delete(container.id); + useLoad3dService().removeLoad3d(node); origOnRemoved?.apply(this, []); }; node.onDrawBackground = function() { @@ -47650,21 +48019,14 @@ app.registerExtension({ const [oldWidth, oldHeight] = node.size; node.setSize([Math.max(oldWidth, 300), Math.max(oldHeight, 550)]); await nextTick(); - const sceneWidget = node.widgets.find((w) => w.name === "image"); - const container = sceneWidget.element; - const load3d = containerToLoad3D.get(container.id); - load3d.setNode(node); + const load3d = useLoad3dService().getLoad3d(node); const modelWidget = node.widgets.find( (w) => w.name === "model_file" ); const material = node.widgets.find((w) => w.name === "material"); - const lightIntensity = node.widgets.find( - (w) => w.name === "light_intensity" - ); const upDirection = node.widgets.find( (w) => w.name === "up_direction" ); - const fov2 = node.widgets.find((w) => w.name === "fov"); const onExecuted = node.onExecuted; node.onExecuted = function(message) { onExecuted?.apply(this, arguments); @@ -47676,14 +48038,7 @@ app.registerExtension({ } modelWidget.value = filePath.replaceAll("\\", "/"); const config = new Load3DConfiguration(load3d); - config.configure( - "output", - modelWidget, - material, - lightIntensity, - upDirection, - fov2 - ); + config.configure("output", modelWidget, material, upDirection); }; } }); @@ -53025,12 +53380,12 @@ app.registerExtension({ __name(this, "NoteNode"); } static category; + static collapsable; + static title_mode; 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) { @@ -53108,7 +53463,6 @@ app.registerExtension({ }; 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 !== "*") @@ -53191,7 +53545,6 @@ app.registerExtension({ 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) { @@ -53261,7 +53614,6 @@ app.registerExtension({ this.outputs[0].name = ""; } this.size = this.computeSize(); - this.applyOrientation(); app2.graph.setDirtyCanvas(true, true); }, "callback") }, @@ -53272,30 +53624,10 @@ app.registerExtension({ !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( @@ -53725,8 +54057,11 @@ app.registerExtension({ app.registerExtension({ name: "Comfy.UploadImage", beforeRegisterNodeDef(nodeType, nodeData) { - if (nodeData?.input?.required?.image?.[1]?.image_upload === true) { - nodeData.input.required.upload = ["IMAGEUPLOAD"]; + const imageInputSpec = nodeData?.input?.required?.image; + const config = imageInputSpec?.[1] ?? {}; + const { image_upload = false, image_folder = "input" } = config; + if (image_upload && nodeData?.input?.required) { + nodeData.input.required.upload = ["IMAGEUPLOAD", { image_folder }]; } } }); @@ -53844,4 +54179,4 @@ app.registerExtension({ }); } }); -//# sourceMappingURL=index-BYzwFNH3.js.map +//# sourceMappingURL=index-D9D9jjLT.js.map diff --git a/web/assets/index-DKIv7atk.js b/web/assets/index-DSWvxALN.js similarity index 85% rename from web/assets/index-DKIv7atk.js rename to web/assets/index-DSWvxALN.js index 16d4a527b..d7da709c2 100644 --- a/web/assets/index-DKIv7atk.js +++ b/web/assets/index-DSWvxALN.js @@ -1,12 +1,12 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bA as BaseStyle, bB as script$f, cQ as getWidth, d4 as getHeight, c3 as getOuterWidth, d5 as getOuterHeight, c_ as isRTL, cU as getVNodeProp, d6 as isArray, o as openBlock, f as createElementBlock, as as mergeProps, F as Fragment, D as renderList, y as createBlock, C as resolveDynamicComponent, m as createBaseVNode, B as createCommentVNode, A as renderSlot, bP as getAttribute, bO as findSingle, bE as focus, ce as equals, bS as Ripple, r as resolveDirective, i as withDirectives, z as withCtx, ai as normalizeClass, cR as getOffset, cb as script$g, bU as script$h, cd as isNotEmpty, b_ as script$i, bT as UniqueComponentId, bC as ZIndex, cc as resolveFieldData, c8 as OverlayEventBus, ci as isEmpty, b$ as addStyle, c2 as relativePosition, c4 as absolutePosition, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, cj as findLastIndex, bg as script$j, cH as script$k, bI as script$l, bR as script$m, ck as script$n, a8 as script$o, bK as resolveComponent, n as normalizeStyle, k as createVNode, E as toDisplayString, bL as Transition, co as createSlots, a7 as createTextVNode, cu as script$p, bZ as script$q, cA as script$r, cB as script$s, bJ as script$t, cv as normalizeProps, d7 as ToastEventBus, c9 as setAttribute, d8 as TransitionGroup, cq as resolve, d9 as nestedPosition, cf as script$u, ch as isPrintableCharacter, l as script$v, cD as script$w, cx as guardReactiveProps } from "./index-DqqhYDnY.js"; -import { s as script$x } from "./index-DXE47DZl.js"; -var theme$7 = /* @__PURE__ */ __name(function theme(_ref) { +import { bG as BaseStyle, bH as script$c, cV as getWidth, d9 as getHeight, c2 as getOuterWidth, da as getOuterHeight, d3 as isRTL, cZ as getVNodeProp, db as isArray, o as openBlock, f as createElementBlock, at as mergeProps, F as Fragment, D as renderList, y as createBlock, C as resolveDynamicComponent, m as createBaseVNode, B as createCommentVNode, A as renderSlot, bK as getAttribute, bJ as findSingle, bL as focus, ce as equals, bO as Ripple, r as resolveDirective, i as withDirectives, z as withCtx, aj as normalizeClass, cW as getOffset, cb as script$d, bQ as script$e, cd as isNotEmpty, bY as script$f, bP as UniqueComponentId, bZ as ZIndex, cc as resolveFieldData, c7 as OverlayEventBus, ci as isEmpty, b_ as addStyle, c1 as relativePosition, c3 as absolutePosition, b$ as ConnectedOverlayScrollHandler, c0 as isTouchDevice, cj as findLastIndex, bk as script$g, cM as script$h, ca as script$i, bN as script$j, ck as script$k, a9 as script$l, bR as resolveComponent, n as normalizeStyle, k as createVNode, E as toDisplayString, bI as Transition, cp as createSlots, a8 as createTextVNode, cv as script$m, cr as resolve, dc as nestedPosition, cf as script$n, ch as isPrintableCharacter, l as script$o, cI as script$p, cx as normalizeProps, cC as guardReactiveProps } from "./index-DqXp9vW4.js"; +import { s as script$q } from "./index-BTHx8UHZ.js"; +var theme$6 = /* @__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$a = { +var classes$9 = { root: /* @__PURE__ */ __name(function root(_ref2) { var props = _ref2.props; return ["p-splitter p-component", "p-splitter-" + props.layout]; @@ -14,7 +14,7 @@ var classes$a = { gutter: "p-splitter-gutter", gutterHandle: "p-splitter-gutter-handle" }; -var inlineStyles$4 = { +var inlineStyles$3 = { root: /* @__PURE__ */ __name(function root2(_ref3) { var props = _ref3.props; return [{ @@ -27,13 +27,13 @@ var inlineStyles$4 = { }; var SplitterStyle = BaseStyle.extend({ name: "splitter", - theme: theme$7, - classes: classes$a, - inlineStyles: inlineStyles$4 + theme: theme$6, + classes: classes$9, + inlineStyles: inlineStyles$3 }); -var script$1$a = { +var script$1$9 = { name: "BaseSplitter", - "extends": script$f, + "extends": script$c, props: { layout: { type: String, @@ -64,39 +64,39 @@ var script$1$a = { }; }, "provide") }; -function _toConsumableArray$2(r) { - return _arrayWithoutHoles$2(r) || _iterableToArray$2(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread$2(); +function _toConsumableArray$1(r) { + return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread$1(); } -__name(_toConsumableArray$2, "_toConsumableArray$2"); -function _nonIterableSpread$2() { +__name(_toConsumableArray$1, "_toConsumableArray$1"); +function _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."); } -__name(_nonIterableSpread$2, "_nonIterableSpread$2"); -function _unsupportedIterableToArray$2(r, a) { +__name(_nonIterableSpread$1, "_nonIterableSpread$1"); +function _unsupportedIterableToArray$1(r, a) { if (r) { - if ("string" == typeof r) return _arrayLikeToArray$2(r, a); + 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$2(r, a) : void 0; + 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; } } -__name(_unsupportedIterableToArray$2, "_unsupportedIterableToArray$2"); -function _iterableToArray$2(r) { +__name(_unsupportedIterableToArray$1, "_unsupportedIterableToArray$1"); +function _iterableToArray$1(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } -__name(_iterableToArray$2, "_iterableToArray$2"); -function _arrayWithoutHoles$2(r) { - if (Array.isArray(r)) return _arrayLikeToArray$2(r); +__name(_iterableToArray$1, "_iterableToArray$1"); +function _arrayWithoutHoles$1(r) { + if (Array.isArray(r)) return _arrayLikeToArray$1(r); } -__name(_arrayWithoutHoles$2, "_arrayWithoutHoles$2"); -function _arrayLikeToArray$2(r, a) { +__name(_arrayWithoutHoles$1, "_arrayWithoutHoles$1"); +function _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; } -__name(_arrayLikeToArray$2, "_arrayLikeToArray$2"); -var script$e = { +__name(_arrayLikeToArray$1, "_arrayLikeToArray$1"); +var script$b = { name: "Splitter", - "extends": script$1$a, + "extends": script$1$9, inheritAttrs: false, emits: ["resizestart", "resizeend", "resize"], dragging: false, @@ -138,7 +138,7 @@ var script$e = { initialized = this.restoreState(); } if (!initialized) { - var children = _toConsumableArray$2(this.$el.children).filter(function(child) { + var children = _toConsumableArray$1(this.$el.children).filter(function(child) { return child.getAttribute("data-pc-name") === "splitterpanel"; }); var _panelSizes = []; @@ -398,7 +398,7 @@ var script$e = { var stateString = storage.getItem(this.stateKey); if (stateString) { this.panelSizes = JSON.parse(stateString); - var children = _toConsumableArray$2(this.$el.children).filter(function(child) { + var children = _toConsumableArray$1(this.$el.children).filter(function(child) { return child.getAttribute("data-pc-name") === "splitterpanel"; }); children.forEach(function(child, i) { @@ -450,9 +450,9 @@ var script$e = { }, "getPTOptions") } }; -var _hoisted_1$7 = ["onMousedown", "onTouchstart", "onTouchmove", "onTouchend"]; +var _hoisted_1$6 = ["onMousedown", "onTouchstart", "onTouchmove", "onTouchend"]; var _hoisted_2$4 = ["aria-orientation", "aria-valuenow", "onKeydown"]; -function render$d(_ctx, _cache, $props, $setup, $data, $options) { +function render$a(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root"), style: _ctx.sx("root"), @@ -495,12 +495,12 @@ function render$d(_ctx, _cache, $props, $setup, $data, $options) { return $options.onGutterKeyDown($event, i); }, "onKeydown"), ref_for: true - }, _ctx.ptm("gutterHandle")), null, 16, _hoisted_2$4)], 16, _hoisted_1$7)) : createCommentVNode("", true)], 64); + }, _ctx.ptm("gutterHandle")), null, 16, _hoisted_2$4)], 16, _hoisted_1$6)) : createCommentVNode("", true)], 64); }), 128))], 16); } -__name(render$d, "render$d"); -script$e.render = render$d; -var classes$9 = { +__name(render$a, "render$a"); +script$b.render = render$a; +var classes$8 = { root: /* @__PURE__ */ __name(function root3(_ref) { var instance = _ref.instance; return ["p-splitterpanel", { @@ -510,11 +510,11 @@ var classes$9 = { }; var SplitterPanelStyle = BaseStyle.extend({ name: "splitterpanel", - classes: classes$9 + classes: classes$8 }); -var script$1$9 = { +var script$1$8 = { name: "BaseSplitterPanel", - "extends": script$f, + "extends": script$c, props: { size: { type: Number, @@ -533,9 +533,9 @@ var script$1$9 = { }; }, "provide") }; -var script$d = { +var script$a = { name: "SplitterPanel", - "extends": script$1$9, + "extends": script$1$8, inheritAttrs: false, data: /* @__PURE__ */ __name(function data2() { return { @@ -559,15 +559,15 @@ var script$d = { }, "getPTOptions") } }; -function render$c(_ctx, _cache, $props, $setup, $data, $options) { +function render$9(_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$c, "render$c"); -script$d.render = render$c; -var classes$8 = { +__name(render$9, "render$9"); +script$a.render = render$9; +var classes$7 = { root: /* @__PURE__ */ __name(function root4(_ref) { var instance = _ref.instance, props = _ref.props; return ["p-tab", { @@ -578,11 +578,11 @@ var classes$8 = { }; var TabStyle = BaseStyle.extend({ name: "tab", - classes: classes$8 + classes: classes$7 }); -var script$1$8 = { +var script$1$7 = { name: "BaseTab", - "extends": script$f, + "extends": script$c, props: { value: { type: [String, Number], @@ -609,9 +609,9 @@ var script$1$8 = { }; }, "provide") }; -var script$c = { +var script$9 = { name: "Tab", - "extends": script$1$8, + "extends": script$1$7, inheritAttrs: false, inject: ["$pcTabs", "$pcTabList"], methods: { @@ -758,7 +758,7 @@ var script$c = { ripple: Ripple } }; -function render$b(_ctx, _cache, $props, $setup, $data, $options) { +function render$8(_ctx, _cache, $props, $setup, $data, $options) { var _directive_ripple = resolveDirective("ripple"); return !_ctx.asChild ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ key: 0, @@ -777,9 +777,9 @@ function render$b(_ctx, _cache, $props, $setup, $data, $options) { onClick: $options.onClick }); } -__name(render$b, "render$b"); -script$c.render = render$b; -var classes$7 = { +__name(render$8, "render$8"); +script$9.render = render$8; +var classes$6 = { root: "p-tablist", content: /* @__PURE__ */ __name(function content(_ref) { var instance = _ref.instance; @@ -794,11 +794,11 @@ var classes$7 = { }; var TabListStyle = BaseStyle.extend({ name: "tablist", - classes: classes$7 + classes: classes$6 }); -var script$1$7 = { +var script$1$6 = { name: "BaseTabList", - "extends": script$f, + "extends": script$c, props: {}, style: TabListStyle, provide: /* @__PURE__ */ __name(function provide4() { @@ -808,9 +808,9 @@ var script$1$7 = { }; }, "provide") }; -var script$b = { +var script$8 = { name: "TabList", - "extends": script$1$7, + "extends": script$1$6, inheritAttrs: false, inject: ["$pcTabs"], data: /* @__PURE__ */ __name(function data3() { @@ -936,17 +936,17 @@ var script$b = { }, "nextButtonAriaLabel") }, components: { - ChevronLeftIcon: script$g, - ChevronRightIcon: script$h + ChevronLeftIcon: script$d, + ChevronRightIcon: script$e }, directives: { ripple: Ripple } }; -var _hoisted_1$6 = ["aria-label", "tabindex"]; +var _hoisted_1$5 = ["aria-label", "tabindex"]; var _hoisted_2$3 = ["aria-orientation"]; var _hoisted_3$3 = ["aria-label", "tabindex"]; -function render$a(_ctx, _cache, $props, $setup, $data, $options) { +function render$7(_ctx, _cache, $props, $setup, $data, $options) { var _directive_ripple = resolveDirective("ripple"); return openBlock(), createElementBlock("div", mergeProps({ ref: "list", @@ -964,7 +964,7 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) { "data-pc-group-section": "navigator" }), [(openBlock(), createBlock(resolveDynamicComponent($options.templates.previcon || "ChevronLeftIcon"), mergeProps({ "aria-hidden": "true" - }, _ctx.ptm("prevIcon")), null, 16))], 16, _hoisted_1$6)), [[_directive_ripple]]) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ + }, _ctx.ptm("prevIcon")), null, 16))], 16, _hoisted_1$5)), [[_directive_ripple]]) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ ref: "content", "class": _ctx.cx("content"), onScroll: _cache[1] || (_cache[1] = function() { @@ -995,23 +995,23 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) { "aria-hidden": "true" }, _ctx.ptm("nextIcon")), null, 16))], 16, _hoisted_3$3)), [[_directive_ripple]]) : createCommentVNode("", true)], 16); } -__name(render$a, "render$a"); -script$b.render = render$a; -var theme$6 = /* @__PURE__ */ __name(function theme2(_ref) { +__name(render$7, "render$7"); +script$8.render = render$7; +var theme$5 = /* @__PURE__ */ __name(function theme2(_ref) { _ref.dt; return "\n.p-buttongroup {\n display: inline-flex;\n}\n\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-inline-end: 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-start-end-radius: 0;\n border-end-end-radius: 0;\n}\n\n.p-buttongroup .p-button:last-of-type:not(:only-of-type) {\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n}\n\n.p-buttongroup .p-button:focus {\n position: relative;\n z-index: 1;\n}\n"; }, "theme"); -var classes$6 = { +var classes$5 = { root: "p-buttongroup p-component" }; var ButtonGroupStyle = BaseStyle.extend({ name: "buttongroup", - theme: theme$6, - classes: classes$6 + theme: theme$5, + classes: classes$5 }); -var script$1$6 = { +var script$1$5 = { name: "BaseButtonGroup", - "extends": script$f, + "extends": script$c, style: ButtonGroupStyle, provide: /* @__PURE__ */ __name(function provide5() { return { @@ -1020,29 +1020,29 @@ var script$1$6 = { }; }, "provide") }; -var script$a = { +var script$7 = { name: "ButtonGroup", - "extends": script$1$6, + "extends": script$1$5, inheritAttrs: false }; -function render$9(_ctx, _cache, $props, $setup, $data, $options) { +function render$6(_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$9, "render$9"); -script$a.render = render$9; -var theme$5 = /* @__PURE__ */ __name(function theme3(_ref) { +__name(render$6, "render$6"); +script$7.render = render$6; +var theme$4 = /* @__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 inset-inline-end: ".concat(dt("autocomplete.padding.x"), ";\n}\n\n.p-autocomplete:has(.p-autocomplete-dropdown) .p-autocomplete-loader {\n inset-inline-end: 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-start-end-radius: 0;\n border-end-end-radius: 0;\n}\n\n.p-autocomplete-dropdown {\n cursor: pointer;\n display: inline-flex;\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-start-end-radius: ").concat(dt("autocomplete.dropdown.border.radius"), ";\n border-end-end-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-inline-start: 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 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-container {\n overflow: auto;\n}\n\n.p-autocomplete-list {\n margin: 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):hover .p-variant-filled.p-autocomplete-input-multiple {\n background: ").concat(dt("autocomplete.filled.hover.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-block-start: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n padding-block-end: 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-inline-start: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n padding-inline-end: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n}\n\n.p-autocomplete-chip-item.p-focus .p-autocomplete-chip {\n background: ").concat(dt("autocomplete.chip.focus.background"), ";\n color: ").concat(dt("autocomplete.chip.focus.color"), ";\n}\n\n.p-autocomplete-input-chip {\n flex: 1 1 auto;\n display: inline-flex;\n padding-block-start: calc(").concat(dt("autocomplete.padding.y"), " / 2);\n padding-block-end: 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.p-invalid .p-autocomplete-input-chip input::placeholder {\n color: ").concat(dt("autocomplete.invalid.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.p-autocomplete:has(.p-inputtext-sm) .p-autocomplete-dropdown {\n width: ").concat(dt("autocomplete.dropdown.sm.width"), ";\n}\n\n.p-autocomplete:has(.p-inputtext-sm) .p-autocomplete-dropdown .p-icon {\n font-size: ").concat(dt("form.field.sm.font.size"), ";\n width: ").concat(dt("form.field.sm.font.size"), ";\n height: ").concat(dt("form.field.sm.font.size"), ";\n}\n\n.p-autocomplete:has(.p-inputtext-lg) .p-autocomplete-dropdown {\n width: ").concat(dt("autocomplete.dropdown.lg.width"), ";\n}\n\n.p-autocomplete:has(.p-inputtext-lg) .p-autocomplete-dropdown .p-icon {\n font-size: ").concat(dt("form.field.lg.font.size"), ";\n width: ").concat(dt("form.field.lg.font.size"), ";\n height: ").concat(dt("form.field.lg.font.size"), ";\n}\n"); }, "theme"); -var inlineStyles$3 = { +var inlineStyles$2 = { root: { position: "relative" } }; -var classes$5 = { +var classes$4 = { root: /* @__PURE__ */ __name(function root5(_ref2) { var instance = _ref2.instance, props = _ref2.props; return ["p-autocomplete p-component p-inputwrapper", { @@ -1090,13 +1090,13 @@ var classes$5 = { }; var AutoCompleteStyle = BaseStyle.extend({ name: "autocomplete", - theme: theme$5, - classes: classes$5, - inlineStyles: inlineStyles$3 + theme: theme$4, + classes: classes$4, + inlineStyles: inlineStyles$2 }); -var script$1$5 = { +var script$1$4 = { name: "BaseAutoComplete", - "extends": script$i, + "extends": script$f, props: { suggestions: { type: Array, @@ -1271,48 +1271,48 @@ var script$1$5 = { }; }, "provide") }; -function _typeof$1$1(o) { +function _typeof$1(o) { "@babel/helpers - typeof"; - return _typeof$1$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { + return _typeof$1 = "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$1$1(o); + }, _typeof$1(o); } -__name(_typeof$1$1, "_typeof$1$1"); -function _toConsumableArray$1(r) { - return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread$1(); +__name(_typeof$1, "_typeof$1"); +function _toConsumableArray(r) { + return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } -__name(_toConsumableArray$1, "_toConsumableArray$1"); -function _nonIterableSpread$1() { +__name(_toConsumableArray, "_toConsumableArray"); +function _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."); } -__name(_nonIterableSpread$1, "_nonIterableSpread$1"); -function _unsupportedIterableToArray$1(r, a) { +__name(_nonIterableSpread, "_nonIterableSpread"); +function _unsupportedIterableToArray(r, a) { if (r) { - if ("string" == typeof r) return _arrayLikeToArray$1(r, a); + 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$1(r, a) : void 0; + 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; } } -__name(_unsupportedIterableToArray$1, "_unsupportedIterableToArray$1"); -function _iterableToArray$1(r) { +__name(_unsupportedIterableToArray, "_unsupportedIterableToArray"); +function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } -__name(_iterableToArray$1, "_iterableToArray$1"); -function _arrayWithoutHoles$1(r) { - if (Array.isArray(r)) return _arrayLikeToArray$1(r); +__name(_iterableToArray, "_iterableToArray"); +function _arrayWithoutHoles(r) { + if (Array.isArray(r)) return _arrayLikeToArray(r); } -__name(_arrayWithoutHoles$1, "_arrayWithoutHoles$1"); -function _arrayLikeToArray$1(r, a) { +__name(_arrayWithoutHoles, "_arrayWithoutHoles"); +function _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; } -__name(_arrayLikeToArray$1, "_arrayLikeToArray$1"); -var script$9 = { +__name(_arrayLikeToArray, "_arrayLikeToArray"); +var script$6 = { name: "AutoComplete", - "extends": script$1$5, + "extends": script$1$4, inheritAttrs: false, emits: ["change", "focus", "blur", "item-select", "item-unselect", "option-select", "option-unselect", "dropdown-click", "clear", "complete", "before-show", "before-hide", "show", "hide"], inject: { @@ -1609,7 +1609,7 @@ var script$9 = { if (this.multiple) { this.$refs.focusInput.value = ""; if (!this.isSelected(option2)) { - this.updateModel(event, [].concat(_toConsumableArray$1(this.d_value || []), [value])); + this.updateModel(event, [].concat(_toConsumableArray(this.d_value || []), [value])); } } else { this.updateModel(event, value); @@ -1707,7 +1707,7 @@ var script$9 = { onEnterKey: /* @__PURE__ */ __name(function onEnterKey2(event) { if (!this.typeahead) { if (this.multiple) { - this.updateModel(event, [].concat(_toConsumableArray$1(this.d_value || []), [event.target.value])); + this.updateModel(event, [].concat(_toConsumableArray(this.d_value || []), [event.target.value])); this.$refs.focusInput.value = ""; } } else { @@ -2023,7 +2023,7 @@ var script$9 = { }, "visibleOptions"), inputValue: /* @__PURE__ */ __name(function inputValue() { if (this.$filled) { - if (_typeof$1$1(this.d_value) === "object") { + if (_typeof$1(this.d_value) === "object") { var label = this.getOptionLabel(this.d_value); return label != null ? label : this.d_value; } else { @@ -2081,27 +2081,27 @@ var script$9 = { }, "panelId") }, components: { - InputText: script$j, - VirtualScroller: script$k, - Portal: script$l, - ChevronDownIcon: script$m, - SpinnerIcon: script$n, - Chip: script$o + InputText: script$g, + VirtualScroller: script$h, + Portal: script$i, + ChevronDownIcon: script$j, + SpinnerIcon: script$k, + Chip: script$l }, directives: { ripple: Ripple } }; -function _typeof$4(o) { +function _typeof$2(o) { "@babel/helpers - typeof"; - return _typeof$4 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { + return _typeof$2 = "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$4(o); + }, _typeof$2(o); } -__name(_typeof$4, "_typeof$4"); -function ownKeys$3(e, r) { +__name(_typeof$2, "_typeof$2"); +function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); @@ -2111,40 +2111,40 @@ function ownKeys$3(e, r) { } return t; } -__name(ownKeys$3, "ownKeys$3"); -function _objectSpread$3(e) { +__name(ownKeys$1, "ownKeys$1"); +function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$3(Object(t), true).forEach(function(r2) { - _defineProperty$4(e, r2, t[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function(r2) { + r % 2 ? ownKeys$1(Object(t), true).forEach(function(r2) { + _defineProperty$1(e, r2, t[r2]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r2) { Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); }); } return e; } -__name(_objectSpread$3, "_objectSpread$3"); -function _defineProperty$4(e, r, t) { - return (r = _toPropertyKey$4(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; +__name(_objectSpread$1, "_objectSpread$1"); +function _defineProperty$1(e, r, t) { + return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; } -__name(_defineProperty$4, "_defineProperty$4"); -function _toPropertyKey$4(t) { - var i = _toPrimitive$4(t, "string"); - return "symbol" == _typeof$4(i) ? i : i + ""; +__name(_defineProperty$1, "_defineProperty$1"); +function _toPropertyKey$1(t) { + var i = _toPrimitive$1(t, "string"); + return "symbol" == _typeof$2(i) ? i : i + ""; } -__name(_toPropertyKey$4, "_toPropertyKey$4"); -function _toPrimitive$4(t, r) { - if ("object" != _typeof$4(t) || !t) return t; +__name(_toPropertyKey$1, "_toPropertyKey$1"); +function _toPrimitive$1(t, r) { + if ("object" != _typeof$2(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); - if ("object" != _typeof$4(i)) return i; + if ("object" != _typeof$2(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } -__name(_toPrimitive$4, "_toPrimitive$4"); -var _hoisted_1$5 = ["aria-activedescendant"]; +__name(_toPrimitive$1, "_toPrimitive$1"); +var _hoisted_1$4 = ["aria-activedescendant"]; var _hoisted_2$2 = ["id", "aria-label", "aria-setsize", "aria-posinset"]; var _hoisted_3$2 = ["id", "placeholder", "tabindex", "disabled", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-invalid"]; var _hoisted_4$2 = ["disabled", "aria-expanded", "aria-controls"]; @@ -2152,7 +2152,7 @@ var _hoisted_5$2 = ["id"]; var _hoisted_6$1 = ["id", "aria-label"]; var _hoisted_7 = ["id"]; var _hoisted_8 = ["id", "aria-label", "aria-selected", "aria-disabled", "aria-setsize", "aria-posinset", "onClick", "onMousemove", "data-p-selected", "data-p-focus", "data-p-disabled"]; -function render$8(_ctx, _cache, $props, $setup, $data, $options) { +function render$5(_ctx, _cache, $props, $setup, $data, $options) { var _component_InputText = resolveComponent("InputText"); var _component_Chip = resolveComponent("Chip"); var _component_SpinnerIcon = resolveComponent("SpinnerIcon"); @@ -2243,7 +2243,7 @@ function render$8(_ctx, _cache, $props, $setup, $data, $options) { removeIcon: _ctx.chipIcon || _ctx.removeTokenIcon, removable: "", unstyled: _ctx.unstyled, - onRemove: /* @__PURE__ */ __name(function onRemove2($event) { + onRemove: /* @__PURE__ */ __name(function onRemove($event) { return $options.removeOption($event, i); }, "onRemove"), pt: _ctx.ptm("pcChip") @@ -2297,7 +2297,7 @@ function render$8(_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$2)], 16)], 16, _hoisted_1$5)) : createCommentVNode("", true), $data.searching || _ctx.loading ? renderSlot(_ctx.$slots, _ctx.$slots.loader ? "loader" : "loadingicon", { + }, _ctx.ptm("input")), null, 16, _hoisted_3$2)], 16)], 16, _hoisted_1$4)) : createCommentVNode("", true), $data.searching || _ctx.loading ? renderSlot(_ctx.$slots, _ctx.$slots.loader ? "loader" : "loadingicon", { key: 2, "class": normalizeClass(_ctx.cx("loader")) }, function() { @@ -2358,7 +2358,7 @@ function render$8(_ctx, _cache, $props, $setup, $data, $options) { ref: $options.overlayRef, id: $options.panelId, "class": [_ctx.cx("overlay"), _ctx.panelClass, _ctx.overlayClass], - style: _objectSpread$3(_objectSpread$3({}, _ctx.panelStyle), _ctx.overlayStyle), + style: _objectSpread$1(_objectSpread$1({}, _ctx.panelStyle), _ctx.overlayStyle), onClick: _cache[9] || (_cache[9] = function() { return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); }), @@ -2480,23 +2480,23 @@ function render$8(_ctx, _cache, $props, $setup, $data, $options) { _: 3 }, 8, ["appendTo"])], 16); } -__name(render$8, "render$8"); -script$9.render = render$8; -var theme$4 = /* @__PURE__ */ __name(function theme4(_ref) { +__name(render$5, "render$5"); +script$6.render = render$5; +var theme$3 = /* @__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 inset-block-start: 0;\n inset-inline-end: 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.p-overlaybadge .p-badge:dir(rtl) {\n transform: translate(-50%, -50%);\n}\n"); }, "theme"); -var classes$4 = { +var classes$3 = { root: "p-overlaybadge" }; var OverlayBadgeStyle = BaseStyle.extend({ name: "overlaybadge", - theme: theme$4, - classes: classes$4 + theme: theme$3, + classes: classes$3 }); -var script$1$4 = { +var script$1$3 = { name: "OverlayBadge", - "extends": script$p, + "extends": script$m, style: OverlayBadgeStyle, provide: /* @__PURE__ */ __name(function provide7() { return { @@ -2505,15 +2505,15 @@ var script$1$4 = { }; }, "provide") }; -var script$8 = { +var script$5 = { name: "OverlayBadge", - "extends": script$1$4, + "extends": script$1$3, inheritAttrs: false, components: { - Badge: script$p + Badge: script$m } }; -function render$7(_ctx, _cache, $props, $setup, $data, $options) { +function render$4(_ctx, _cache, $props, $setup, $data, $options) { var _component_Badge = resolveComponent("Badge"); return openBlock(), createElementBlock("div", mergeProps({ "class": _ctx.cx("root") @@ -2521,618 +2521,9 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) { pt: _ctx.ptm("pcBadge") }), null, 16, ["pt"])], 16); } -__name(render$7, "render$7"); -script$8.render = render$7; -function _typeof$3(o) { - "@babel/helpers - typeof"; - return _typeof$3 = "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$3(o); -} -__name(_typeof$3, "_typeof$3"); -function _defineProperty$3(e, r, t) { - return (r = _toPropertyKey$3(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; -} -__name(_defineProperty$3, "_defineProperty$3"); -function _toPropertyKey$3(t) { - var i = _toPrimitive$3(t, "string"); - return "symbol" == _typeof$3(i) ? i : i + ""; -} -__name(_toPropertyKey$3, "_toPropertyKey$3"); -function _toPrimitive$3(t, r) { - if ("object" != _typeof$3(t) || !t) return t; - var e = t[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t, r || "default"); - if ("object" != _typeof$3(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t); -} -__name(_toPrimitive$3, "_toPrimitive$3"); -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-close-button:dir(rtl) {\n margin: -25% 0 0 auto;\n left: -25%;\n right: auto;\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"); -var inlineStyles$2 = { - root: /* @__PURE__ */ __name(function root6(_ref2) { - var position = _ref2.position; - return { - position: "fixed", - top: position === "top-right" || position === "top-left" || position === "top-center" ? "20px" : position === "center" ? "50%" : null, - right: (position === "top-right" || position === "bottom-right") && "20px", - bottom: (position === "bottom-left" || position === "bottom-right" || position === "bottom-center") && "20px", - left: position === "top-left" || position === "bottom-left" ? "20px" : position === "center" || position === "top-center" || position === "bottom-center" ? "50%" : null - }; - }, "root") -}; -var classes$3 = { - root: /* @__PURE__ */ __name(function root7(_ref3) { - var props = _ref3.props; - return ["p-toast p-component p-toast-" + props.position]; - }, "root"), - message: /* @__PURE__ */ __name(function message(_ref4) { - var props = _ref4.props; - return ["p-toast-message", { - "p-toast-message-info": props.message.severity === "info" || props.message.severity === void 0, - "p-toast-message-warn": props.message.severity === "warn", - "p-toast-message-error": props.message.severity === "error", - "p-toast-message-success": props.message.severity === "success", - "p-toast-message-secondary": props.message.severity === "secondary", - "p-toast-message-contrast": props.message.severity === "contrast" - }]; - }, "message"), - messageContent: "p-toast-message-content", - messageIcon: /* @__PURE__ */ __name(function messageIcon(_ref5) { - var props = _ref5.props; - return ["p-toast-message-icon", _defineProperty$3(_defineProperty$3(_defineProperty$3(_defineProperty$3({}, props.infoIcon, props.message.severity === "info"), props.warnIcon, props.message.severity === "warn"), props.errorIcon, props.message.severity === "error"), props.successIcon, props.message.severity === "success")]; - }, "messageIcon"), - messageText: "p-toast-message-text", - summary: "p-toast-summary", - detail: "p-toast-detail", - closeButton: "p-toast-close-button", - closeIcon: "p-toast-close-icon" -}; -var ToastStyle = BaseStyle.extend({ - name: "toast", - theme: theme$3, - classes: classes$3, - inlineStyles: inlineStyles$2 -}); -var script$7 = { - name: "ExclamationTriangleIcon", - "extends": script$q -}; -function render$6(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - 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", - fill: "currentColor" - }, null, -1), createBaseVNode("path", { - 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", - fill: "currentColor" - }, null, -1), createBaseVNode("path", { - 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", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$6, "render$6"); -script$7.render = render$6; -var script$6 = { - name: "InfoCircleIcon", - "extends": script$q -}; -function render$5(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - 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", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$5, "render$5"); -script$6.render = render$5; -var script$2$2 = { - name: "BaseToast", - "extends": script$f, - props: { - group: { - type: String, - "default": null - }, - position: { - type: String, - "default": "top-right" - }, - autoZIndex: { - type: Boolean, - "default": true - }, - baseZIndex: { - type: Number, - "default": 0 - }, - breakpoints: { - type: Object, - "default": null - }, - closeIcon: { - type: String, - "default": void 0 - }, - infoIcon: { - type: String, - "default": void 0 - }, - warnIcon: { - type: String, - "default": void 0 - }, - errorIcon: { - type: String, - "default": void 0 - }, - successIcon: { - type: String, - "default": void 0 - }, - closeButtonProps: { - type: null, - "default": null - } - }, - style: ToastStyle, - provide: /* @__PURE__ */ __name(function provide8() { - return { - $pcToast: this, - $parentInstance: this - }; - }, "provide") -}; -var script$1$3 = { - name: "ToastMessage", - hostName: "Toast", - "extends": script$f, - emits: ["close"], - closeTimeout: null, - props: { - message: { - type: null, - "default": null - }, - templates: { - type: Object, - "default": null - }, - closeIcon: { - type: String, - "default": null - }, - infoIcon: { - type: String, - "default": null - }, - warnIcon: { - type: String, - "default": null - }, - errorIcon: { - type: String, - "default": null - }, - successIcon: { - type: String, - "default": null - }, - closeButtonProps: { - type: null, - "default": null - } - }, - mounted: /* @__PURE__ */ __name(function mounted4() { - var _this = this; - if (this.message.life) { - this.closeTimeout = setTimeout(function() { - _this.close({ - message: _this.message, - type: "life-end" - }); - }, this.message.life); - } - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount4() { - this.clearCloseTimeout(); - }, "beforeUnmount"), - methods: { - close: /* @__PURE__ */ __name(function close(params) { - this.$emit("close", params); - }, "close"), - onCloseClick: /* @__PURE__ */ __name(function onCloseClick() { - this.clearCloseTimeout(); - this.close({ - message: this.message, - type: "close" - }); - }, "onCloseClick"), - clearCloseTimeout: /* @__PURE__ */ __name(function clearCloseTimeout() { - if (this.closeTimeout) { - clearTimeout(this.closeTimeout); - this.closeTimeout = null; - } - }, "clearCloseTimeout") - }, - computed: { - iconComponent: /* @__PURE__ */ __name(function iconComponent() { - return { - info: !this.infoIcon && script$6, - success: !this.successIcon && script$r, - warn: !this.warnIcon && script$7, - error: !this.errorIcon && script$s - }[this.message.severity]; - }, "iconComponent"), - closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : void 0; - }, "closeAriaLabel") - }, - components: { - TimesIcon: script$t, - InfoCircleIcon: script$6, - CheckIcon: script$r, - ExclamationTriangleIcon: script$7, - TimesCircleIcon: script$s - }, - directives: { - ripple: Ripple - } -}; -function _typeof$1(o) { - "@babel/helpers - typeof"; - return _typeof$1 = "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$1(o); -} -__name(_typeof$1, "_typeof$1"); -function ownKeys$1(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$1, "ownKeys$1"); -function _objectSpread$1(e) { - for (var r = 1; r < arguments.length; r++) { - var t = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$1(Object(t), true).forEach(function(r2) { - _defineProperty$1(e, r2, t[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); - }); - } - return e; -} -__name(_objectSpread$1, "_objectSpread$1"); -function _defineProperty$1(e, r, t) { - return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; -} -__name(_defineProperty$1, "_defineProperty$1"); -function _toPropertyKey$1(t) { - var i = _toPrimitive$1(t, "string"); - return "symbol" == _typeof$1(i) ? i : i + ""; -} -__name(_toPropertyKey$1, "_toPropertyKey$1"); -function _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); -} -__name(_toPrimitive$1, "_toPrimitive$1"); -var _hoisted_1$4 = ["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], - role: "alert", - "aria-live": "assertive", - "aria-atomic": "true" - }, _ctx.ptm("message")), [$props.templates.container ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.container), { - key: 0, - message: $props.message, - closeCallback: $options.onCloseClick - }, null, 8, ["message", "closeCallback"])) : (openBlock(), createElementBlock("div", mergeProps({ - key: 1, - "class": [_ctx.cx("messageContent"), $props.message.contentStyleClass] - }, _ctx.ptm("messageContent")), [!$props.templates.message ? (openBlock(), createElementBlock(Fragment, { - key: 0 - }, [(openBlock(), createBlock(resolveDynamicComponent($props.templates.messageicon ? $props.templates.messageicon : $props.templates.icon ? $props.templates.icon : $options.iconComponent && $options.iconComponent.name ? $options.iconComponent : "span"), mergeProps({ - "class": _ctx.cx("messageIcon") - }, _ctx.ptm("messageIcon")), null, 16, ["class"])), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("messageText") - }, _ctx.ptm("messageText")), [createBaseVNode("span", mergeProps({ - "class": _ctx.cx("summary") - }, _ctx.ptm("summary")), toDisplayString($props.message.summary), 17), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("detail") - }, _ctx.ptm("detail")), toDisplayString($props.message.detail), 17)], 16)], 64)) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.message), { - key: 1, - message: $props.message - }, null, 8, ["message"])), $props.message.closable !== false ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ - key: 2 - }, _ctx.ptm("buttonContainer"))), [withDirectives((openBlock(), createElementBlock("button", mergeProps({ - "class": _ctx.cx("closeButton"), - type: "button", - "aria-label": $options.closeAriaLabel, - onClick: _cache[0] || (_cache[0] = function() { - return $options.onCloseClick && $options.onCloseClick.apply($options, arguments); - }), - 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$4)), [[_directive_ripple]])], 16)) : createCommentVNode("", true)], 16))], 16); -} -__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(); -} -__name(_toConsumableArray, "_toConsumableArray"); -function _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."); -} -__name(_nonIterableSpread, "_nonIterableSpread"); -function _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; - } -} -__name(_unsupportedIterableToArray, "_unsupportedIterableToArray"); -function _iterableToArray(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray, "_iterableToArray"); -function _arrayWithoutHoles(r) { - if (Array.isArray(r)) return _arrayLikeToArray(r); -} -__name(_arrayWithoutHoles, "_arrayWithoutHoles"); -function _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; -} -__name(_arrayLikeToArray, "_arrayLikeToArray"); -var messageIdx = 0; -var script$5 = { - name: "Toast", - "extends": script$2$2, - inheritAttrs: false, - emits: ["close", "life-end"], - data: /* @__PURE__ */ __name(function data5() { - return { - messages: [] - }; - }, "data"), - styleElement: null, - mounted: /* @__PURE__ */ __name(function mounted5() { - ToastEventBus.on("add", this.onAdd); - ToastEventBus.on("remove", this.onRemove); - ToastEventBus.on("remove-group", this.onRemoveGroup); - ToastEventBus.on("remove-all-groups", this.onRemoveAllGroups); - if (this.breakpoints) { - this.createStyle(); - } - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount5() { - this.destroyStyle(); - if (this.$refs.container && this.autoZIndex) { - ZIndex.clear(this.$refs.container); - } - ToastEventBus.off("add", this.onAdd); - ToastEventBus.off("remove", this.onRemove); - ToastEventBus.off("remove-group", this.onRemoveGroup); - ToastEventBus.off("remove-all-groups", this.onRemoveAllGroups); - }, "beforeUnmount"), - methods: { - add: /* @__PURE__ */ __name(function add(message2) { - if (message2.id == null) { - message2.id = messageIdx++; - } - this.messages = [].concat(_toConsumableArray(this.messages), [message2]); - }, "add"), - remove: /* @__PURE__ */ __name(function remove(params) { - var index = this.messages.findIndex(function(m) { - return m.id === params.message.id; - }); - if (index !== -1) { - this.messages.splice(index, 1); - this.$emit(params.type, { - message: params.message - }); - } - }, "remove"), - onAdd: /* @__PURE__ */ __name(function onAdd(message2) { - if (this.group == message2.group) { - this.add(message2); - } - }, "onAdd"), - onRemove: /* @__PURE__ */ __name(function onRemove(message2) { - this.remove({ - message: message2, - type: "close" - }); - }, "onRemove"), - onRemoveGroup: /* @__PURE__ */ __name(function onRemoveGroup(group) { - if (this.group === group) { - this.messages = []; - } - }, "onRemoveGroup"), - onRemoveAllGroups: /* @__PURE__ */ __name(function onRemoveAllGroups() { - this.messages = []; - }, "onRemoveAllGroups"), - onEnter: /* @__PURE__ */ __name(function onEnter() { - if (this.autoZIndex) { - ZIndex.set("modal", this.$refs.container, this.baseZIndex || this.$primevue.config.zIndex.modal); - } - }, "onEnter"), - onLeave: /* @__PURE__ */ __name(function onLeave() { - var _this = this; - if (this.$refs.container && this.autoZIndex && isEmpty(this.messages)) { - setTimeout(function() { - ZIndex.clear(_this.$refs.container); - }, 200); - } - }, "onLeave"), - createStyle: /* @__PURE__ */ __name(function createStyle() { - if (!this.styleElement && !this.isUnstyled) { - var _this$$primevue; - this.styleElement = document.createElement("style"); - this.styleElement.type = "text/css"; - 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); - document.head.appendChild(this.styleElement); - var innerHTML = ""; - for (var breakpoint in this.breakpoints) { - var breakpointStyle = ""; - for (var styleProp in this.breakpoints[breakpoint]) { - breakpointStyle += styleProp + ":" + this.breakpoints[breakpoint][styleProp] + "!important;"; - } - innerHTML += "\n @media screen and (max-width: ".concat(breakpoint, ") {\n .p-toast[").concat(this.$attrSelector, "] {\n ").concat(breakpointStyle, "\n }\n }\n "); - } - this.styleElement.innerHTML = innerHTML; - } - }, "createStyle"), - destroyStyle: /* @__PURE__ */ __name(function destroyStyle() { - if (this.styleElement) { - document.head.removeChild(this.styleElement); - this.styleElement = null; - } - }, "destroyStyle") - }, - components: { - ToastMessage: script$1$3, - Portal: script$l - } -}; -function _typeof$2(o) { - "@babel/helpers - typeof"; - return _typeof$2 = "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$2(o); -} -__name(_typeof$2, "_typeof$2"); -function ownKeys$2(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$2, "ownKeys$2"); -function _objectSpread$2(e) { - for (var r = 1; r < arguments.length; r++) { - var t = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$2(Object(t), true).forEach(function(r2) { - _defineProperty$2(e, r2, t[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); - }); - } - return e; -} -__name(_objectSpread$2, "_objectSpread$2"); -function _defineProperty$2(e, r, t) { - return (r = _toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; -} -__name(_defineProperty$2, "_defineProperty$2"); -function _toPropertyKey$2(t) { - var i = _toPrimitive$2(t, "string"); - return "symbol" == _typeof$2(i) ? i : i + ""; -} -__name(_toPropertyKey$2, "_toPropertyKey$2"); -function _toPrimitive$2(t, r) { - if ("object" != _typeof$2(t) || !t) return t; - var e = t[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t, r || "default"); - if ("object" != _typeof$2(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t); -} -__name(_toPrimitive$2, "_toPrimitive$2"); -function render$4(_ctx, _cache, $props, $setup, $data, $options) { - var _component_ToastMessage = resolveComponent("ToastMessage"); - var _component_Portal = resolveComponent("Portal"); - return openBlock(), createBlock(_component_Portal, null, { - "default": withCtx(function() { - return [createBaseVNode("div", mergeProps({ - ref: "container", - "class": _ctx.cx("root"), - style: _ctx.sx("root", true, { - position: _ctx.position - }) - }, _ctx.ptmi("root")), [createVNode(TransitionGroup, mergeProps({ - name: "p-toast-message", - tag: "div", - onEnter: $options.onEnter, - onLeave: $options.onLeave - }, _objectSpread$2({}, _ctx.ptm("transition"))), { - "default": withCtx(function() { - return [(openBlock(true), createElementBlock(Fragment, null, renderList($data.messages, function(msg) { - return openBlock(), createBlock(_component_ToastMessage, { - key: msg.id, - message: msg, - templates: _ctx.$slots, - closeIcon: _ctx.closeIcon, - infoIcon: _ctx.infoIcon, - warnIcon: _ctx.warnIcon, - errorIcon: _ctx.errorIcon, - successIcon: _ctx.successIcon, - closeButtonProps: _ctx.closeButtonProps, - unstyled: _ctx.unstyled, - onClose: _cache[0] || (_cache[0] = function($event) { - return $options.remove($event); - }), - pt: _ctx.pt - }, null, 8, ["message", "templates", "closeIcon", "infoIcon", "warnIcon", "errorIcon", "successIcon", "closeButtonProps", "unstyled", "pt"]); - }), 128))]; - }), - _: 1 - }, 16, ["onEnter", "onLeave"])], 16)]; - }), - _: 1 - }); -} __name(render$4, "render$4"); script$5.render = render$4; -var theme$2 = /* @__PURE__ */ __name(function theme6(_ref) { +var theme$2 = /* @__PURE__ */ __name(function theme5(_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-submenu-icon:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\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-block-start: 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.p-tieredmenu-mobile .p-tieredmenu-submenu {\n position: static;\n box-shadow: none;\n border: 0 none;\n padding-inline-start: ").concat(dt("tieredmenu.submenu.mobile.indent"), ";\n padding-inline-end: 0;\n}\n\n.p-tieredmenu-mobile .p-tieredmenu-submenu:dir(rtl) {\n padding-inline-start: 0;\n padding-inline-end: ").concat(dt("tieredmenu.submenu.mobile.indent"), ";\n}\n\n.p-tieredmenu-mobile .p-tieredmenu-submenu-icon {\n transition: transform 0.2s;\n transform: rotate(90deg);\n}\n\n.p-tieredmenu-mobile .p-tieredmenu-item-active > .p-tieredmenu-item-content .p-tieredmenu-submenu-icon {\n transform: rotate(-90deg);\n}\n"); }, "theme"); @@ -3145,7 +2536,7 @@ var inlineStyles$1 = { }, "submenu") }; var classes$2 = { - root: /* @__PURE__ */ __name(function root8(_ref3) { + root: /* @__PURE__ */ __name(function root6(_ref3) { var props = _ref3.props, instance = _ref3.instance; return ["p-tieredmenu p-component", { "p-tieredmenu-overlay": props.popup, @@ -3179,7 +2570,7 @@ var TieredMenuStyle = BaseStyle.extend({ }); var script$2$1 = { name: "BaseTieredMenu", - "extends": script$f, + "extends": script$c, props: { popup: { type: Boolean, @@ -3223,7 +2614,7 @@ var script$2$1 = { } }, style: TieredMenuStyle, - provide: /* @__PURE__ */ __name(function provide9() { + provide: /* @__PURE__ */ __name(function provide8() { return { $pcTieredMenu: this, $parentInstance: this @@ -3233,7 +2624,7 @@ var script$2$1 = { var script$1$2 = { name: "TieredMenuSub", hostName: "TieredMenu", - "extends": script$f, + "extends": script$c, emits: ["item-click", "item-mouseenter", "item-mousemove"], container: null, props: { @@ -3314,7 +2705,7 @@ var script$1$2 = { isItemGroup: /* @__PURE__ */ __name(function isItemGroup(processedItem) { return isNotEmpty(processedItem.items); }, "isItemGroup"), - onEnter: /* @__PURE__ */ __name(function onEnter2() { + onEnter: /* @__PURE__ */ __name(function onEnter() { nestedPosition(this.container, this.level); }, "onEnter"), onItemClick: /* @__PURE__ */ __name(function onItemClick(event, processedItem) { @@ -3374,7 +2765,7 @@ var script$1$2 = { }, "containerRef") }, components: { - AngleRightIcon: script$u + AngleRightIcon: script$n }, directives: { ripple: Ripple @@ -3527,7 +2918,7 @@ var script$4 = { menubar: null, searchTimeout: null, searchValue: null, - data: /* @__PURE__ */ __name(function data6() { + data: /* @__PURE__ */ __name(function data5() { return { id: this.$attrs.id, focused: false, @@ -3560,11 +2951,11 @@ var script$4 = { } }, "activeItemPath") }, - mounted: /* @__PURE__ */ __name(function mounted6() { + mounted: /* @__PURE__ */ __name(function mounted4() { this.id = this.id || UniqueComponentId(); this.bindMatchMediaListener(); }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount6() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount4() { this.unbindOutsideClickListener(); this.unbindResizeListener(); this.unbindMatchMediaListener(); @@ -3735,7 +3126,7 @@ var script$4 = { onItemClick: /* @__PURE__ */ __name(function onItemClick2(event) { var originalEvent = event.originalEvent, processedItem = event.processedItem; var grouped = this.isProccessedItemGroup(processedItem); - var root11 = isEmpty(processedItem.parent); + var root9 = isEmpty(processedItem.parent); var selected = this.isSelected(processedItem); if (selected) { var index = processedItem.index, key = processedItem.key, level = processedItem.level, parentKey = processedItem.parentKey; @@ -3747,13 +3138,13 @@ var script$4 = { level, parentKey }; - this.dirty = !root11; + this.dirty = !root9; focus(this.menubar); } else { if (grouped) { this.onItemChange(event); } else { - var rootProcessedItem = root11 ? processedItem : this.activeItemPath.find(function(p) { + var rootProcessedItem = root9 ? processedItem : this.activeItemPath.find(function(p) { return p.parentKey === ""; }); this.hide(originalEvent); @@ -3801,8 +3192,8 @@ var script$4 = { var parentItem = this.activeItemPath.find(function(p) { return p.key === processedItem.parentKey; }); - var root11 = isEmpty(processedItem.parent); - if (!root11) { + var root9 = isEmpty(processedItem.parent); + if (!root9) { this.focusedItemInfo = { index: -1, parentKey: parentItem ? parentItem.parentKey : "" @@ -3880,7 +3271,7 @@ var script$4 = { } this.hide(); }, "onTabKey"), - onEnter: /* @__PURE__ */ __name(function onEnter3(el) { + onEnter: /* @__PURE__ */ __name(function onEnter2(el) { if (this.autoZIndex) { ZIndex.set("menu", el, this.baseZIndex + this.$primevue.config.zIndex.menu); } @@ -3899,7 +3290,7 @@ var script$4 = { this.bindResizeListener(); this.$emit("show"); }, "onAfterEnter"), - onLeave: /* @__PURE__ */ __name(function onLeave2() { + onLeave: /* @__PURE__ */ __name(function onLeave() { this.unbindOutsideClickListener(); this.unbindScrollListener(); this.unbindResizeListener(); @@ -4139,7 +3530,7 @@ var script$4 = { }, components: { TieredMenuSub: script$1$2, - Portal: script$l + Portal: script$i } }; var _hoisted_1$3 = ["id"]; @@ -4209,12 +3600,12 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$3, "render$3"); script$4.render = render$3; -var theme$1 = /* @__PURE__ */ __name(function theme7(_ref) { +var theme$1 = /* @__PURE__ */ __name(function theme6(_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-start-end-radius: 0;\n border-end-end-radius: 0;\n border-inline-end: 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-inline-end: 0 none;\n}\n\n.p-splitbutton-dropdown {\n border-start-start-radius: 0;\n border-end-start-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-start-end-radius: ").concat(dt("splitbutton.rounded.border.radius"), ";\n border-end-end-radius: ").concat(dt("splitbutton.rounded.border.radius"), ";\n}\n\n.p-splitbutton-rounded .p-splitbutton-button {\n border-start-start-radius: ").concat(dt("splitbutton.rounded.border.radius"), ";\n border-end-start-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$1 = { - root: /* @__PURE__ */ __name(function root9(_ref2) { + root: /* @__PURE__ */ __name(function root7(_ref2) { var instance = _ref2.instance, props = _ref2.props; return ["p-splitbutton p-component", { "p-splitbutton-raised": props.raised, @@ -4232,7 +3623,7 @@ var SplitButtonStyle = BaseStyle.extend({ }); var script$1$1 = { name: "BaseSplitButton", - "extends": script$f, + "extends": script$c, props: { label: { type: String, @@ -4320,7 +3711,7 @@ var script$1$1 = { } }, style: SplitButtonStyle, - provide: /* @__PURE__ */ __name(function provide10() { + provide: /* @__PURE__ */ __name(function provide9() { return { $pcSplitButton: this, $parentInstance: this @@ -4337,7 +3728,7 @@ var script$3 = { "default": null } }, - data: /* @__PURE__ */ __name(function data7() { + data: /* @__PURE__ */ __name(function data6() { return { id: this.$attrs.id, isExpanded: false @@ -4348,7 +3739,7 @@ var script$3 = { this.id = newValue || UniqueComponentId(); }, "$attrsId") }, - mounted: /* @__PURE__ */ __name(function mounted7() { + mounted: /* @__PURE__ */ __name(function mounted5() { var _this = this; this.id = this.id || UniqueComponentId(); this.$watch("$refs.menu.visible", function(newValue) { @@ -4388,9 +3779,9 @@ var script$3 = { }, "hasFluid") }, components: { - PVSButton: script$v, + PVSButton: script$o, PVSMenu: script$4, - ChevronDownIcon: script$m + ChevronDownIcon: script$j } }; var _hoisted_1$2 = ["data-p-severity"]; @@ -4503,7 +3894,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) { } __name(render$2, "render$2"); script$3.render = render$2; -var theme8 = /* @__PURE__ */ __name(function theme9(_ref) { +var theme7 = /* @__PURE__ */ __name(function theme8(_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-submenu .p-menubar-submenu-icon:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\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.submenu.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-block-start: 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-end:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\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 flex-direction: column;\n top: 100%;\n left: 0;\n z-index: 1;\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 border-radius: ").concat(dt("menubar.submenu.border.radius"), ";\n gap: ").concat(dt("menubar.submenu.gap"), ";\n}\n\n.p-menubar-mobile .p-menubar-root-list:dir(rtl) {\n left: auto;\n right: 0;\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}\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-block-start: 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 > .p-menubar-item-content .p-menubar-submenu-icon:dir(rtl),\n.p-menubar-mobile .p-menubar-submenu-icon:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\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-inline-start: ").concat(dt("menubar.submenu.mobile.indent"), ";\n padding-inline-end: 0;\n}\n"); }, "theme"); @@ -4516,7 +3907,7 @@ var inlineStyles = { }, "submenu") }; var classes = { - root: /* @__PURE__ */ __name(function root10(_ref3) { + root: /* @__PURE__ */ __name(function root8(_ref3) { var instance = _ref3.instance; return ["p-menubar p-component", { "p-menubar-mobile": instance.queryMatches, @@ -4545,13 +3936,13 @@ var classes = { }; var MenubarStyle = BaseStyle.extend({ name: "menubar", - theme: theme8, + theme: theme7, classes, inlineStyles }); var script$2 = { name: "BaseMenubar", - "extends": script$f, + "extends": script$c, props: { model: { type: Array, @@ -4575,7 +3966,7 @@ var script$2 = { } }, style: MenubarStyle, - provide: /* @__PURE__ */ __name(function provide11() { + provide: /* @__PURE__ */ __name(function provide10() { return { $pcMenubar: this, $parentInstance: this @@ -4585,7 +3976,7 @@ var script$2 = { var script$1 = { name: "MenubarSub", hostName: "Menubar", - "extends": script$f, + "extends": script$c, emits: ["item-mouseenter", "item-click", "item-mousemove"], props: { items: { @@ -4730,8 +4121,8 @@ var script$1 = { }, "getAriaSetSize") }, components: { - AngleRightIcon: script$u, - AngleDownIcon: script$w + AngleRightIcon: script$n, + AngleDownIcon: script$p }, directives: { ripple: Ripple @@ -4863,7 +4254,7 @@ var script = { inheritAttrs: false, emits: ["focus", "blur"], matchMediaListener: null, - data: /* @__PURE__ */ __name(function data8() { + data: /* @__PURE__ */ __name(function data7() { return { id: this.$attrs.id, mobileActive: false, @@ -4896,11 +4287,11 @@ var script = { outsideClickListener: null, container: null, menubar: null, - mounted: /* @__PURE__ */ __name(function mounted8() { + mounted: /* @__PURE__ */ __name(function mounted6() { this.id = this.id || UniqueComponentId(); this.bindMatchMediaListener(); }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount7() { + beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount5() { this.mobileActive = false; this.unbindOutsideClickListener(); this.unbindResizeListener(); @@ -5062,7 +4453,7 @@ var script = { onItemClick: /* @__PURE__ */ __name(function onItemClick4(event) { var originalEvent = event.originalEvent, processedItem = event.processedItem; var grouped = this.isProccessedItemGroup(processedItem); - var root11 = isEmpty(processedItem.parent); + var root9 = isEmpty(processedItem.parent); var selected = this.isSelected(processedItem); if (selected) { var index = processedItem.index, key = processedItem.key, level = processedItem.level, parentKey = processedItem.parentKey; @@ -5074,13 +4465,13 @@ var script = { level, parentKey }; - this.dirty = !root11; + this.dirty = !root9; focus(this.menubar); } else { if (grouped) { this.onItemChange(event); } else { - var rootProcessedItem = root11 ? processedItem : this.activeItemPath.find(function(p) { + var rootProcessedItem = root9 ? processedItem : this.activeItemPath.find(function(p) { return p.parentKey === ""; }); this.hide(originalEvent); @@ -5108,8 +4499,8 @@ var script = { }, "menuButtonKeydown"), onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey3(event) { var processedItem = this.visibleItems[this.focusedItemInfo.index]; - var root11 = processedItem ? isEmpty(processedItem.parent) : null; - if (root11) { + var root9 = processedItem ? isEmpty(processedItem.parent) : null; + if (root9) { var grouped = this.isProccessedItemGroup(processedItem); if (grouped) { this.onItemChange({ @@ -5131,8 +4522,8 @@ var script = { onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey3(event) { var _this3 = this; var processedItem = this.visibleItems[this.focusedItemInfo.index]; - var root11 = isEmpty(processedItem.parent); - if (root11) { + var root9 = isEmpty(processedItem.parent); + if (root9) { var grouped = this.isProccessedItemGroup(processedItem); if (grouped) { this.onItemChange({ @@ -5465,7 +4856,7 @@ var script = { }, components: { MenubarSub: script$1, - BarsIcon: script$x + BarsIcon: script$q } }; function _typeof(o) { @@ -5589,17 +4980,14 @@ function render(_ctx, _cache, $props, $setup, $data, $options) { __name(render, "render"); script.render = render; export { - script$e as a, - script$b as b, - script$c as c, - script$a as d, - script$9 as e, - script$8 as f, - script$5 as g, - script$3 as h, - script as i, - script$6 as j, - script$7 as k, - script$d as s + script$b as a, + script$8 as b, + script$9 as c, + script$7 as d, + script$6 as e, + script$5 as f, + script$3 as g, + script as h, + script$a as s }; -//# sourceMappingURL=index-DKIv7atk.js.map +//# sourceMappingURL=index-DSWvxALN.js.map diff --git a/web/assets/index-DqqhYDnY.js b/web/assets/index-DqXp9vW4.js similarity index 97% rename from web/assets/index-DqqhYDnY.js rename to web/assets/index-DqXp9vW4.js index 07ca6f829..46d800e22 100644 --- a/web/assets/index-DqqhYDnY.js +++ b/web/assets/index-DqXp9vW4.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-D9ZzDQZV.js","./index-DKIv7atk.js","./index-DXE47DZl.js","./keybindingService-DEgCutrm.js","./serverConfigStore-Kb5DJVFt.js","./GraphView-CVCdiww1.css","./UserSelectView-wxa07xPk.js","./BaseViewTemplate-Cz111_1A.js","./ServerStartView-BpH4TXPO.js","./ServerStartView-CJiwVDQY.css","./InstallView-CVZcZZXJ.js","./index-BNlqgrYT.js","./uvMirrors-B-HKMf6X.js","./InstallView-DbJ2cGfL.css","./WelcomeView-BrXELNIm.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-BUpntA4x.js","./NotSupportedView-RFx6eCkN.css","./DownloadGitView-DVXUne-M.js","./ManualConfigurationView-Cz0_f_T-.js","./ManualConfigurationView-CsirlNfV.css","./MetricsConsentView-B5NlgqrS.js","./DesktopStartView-FKlxS2Lt.js","./MaintenanceView-Df7CHNWW.js","./index-BapOFhAR.js","./MaintenanceView-Bj5_Vr6o.css","./KeybindingPanel-CeHhC2F4.js","./KeybindingPanel-DvrUYZ4S.css","./ExtensionPanel-iPOrhDVM.js","./ServerConfigPanel-B1lI5M9c.js","./index-BYzwFNH3.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-CLFBgoGf.js","./index-DSWvxALN.js","./index-BTHx8UHZ.js","./index-B0BQ8jlU.js","./keybindingService-DgS0S2M6.js","./serverConfigStore-C8uoM7Sm.js","./GraphView-Bo28XDd0.css","./UserSelectView-CRPNAEVJ.js","./BaseViewTemplate-DlGljfEG.js","./ServerStartView-BENqs5bD.js","./ServerStartView-BZ7uhZHv.css","./InstallView-x9XCq0hC.js","./index-A-dAhghd.js","./uvMirrors-B-HKMf6X.js","./InstallView-DbJ2cGfL.css","./WelcomeView-Cvtvw05C.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-BzM0uuqA.js","./NotSupportedView-RFx6eCkN.css","./DownloadGitView-SPK8AXQU.js","./ManualConfigurationView-D3on5kXY.js","./ManualConfigurationView-CsirlNfV.css","./MetricsConsentView-DK20ednB.js","./DesktopStartView-B2BMUZxW.js","./MaintenanceView-BUmTZX1d.js","./index-KUUE4Ew8.js","./TerminalOutputDrawer-BgTEspHP.js","./MaintenanceView-DEJCj8SR.css","./DesktopUpdateView-DWsew03S.js","./DesktopUpdateView-CxchaIvw.css","./KeybindingPanel-BIrxefrS.js","./KeybindingPanel-CDYVPYDp.css","./ExtensionPanel-1HZtMFvH.js","./ServerConfigPanel-D0jTW_iX.js","./index-D9D9jjLT.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); var __defProp2 = Object.defineProperty; var __name = (target2, value4) => __defProp2(target2, "name", { value: value4, configurable: true }); (/* @__PURE__ */ __name(function polyfill2() { @@ -10941,10 +10941,10 @@ async function close$1(timeout) { return Promise.resolve(false); } __name(close$1, "close$1"); -function isInitialized() { +function isInitialized$1() { return !!getClient(); } -__name(isInitialized, "isInitialized"); +__name(isInitialized$1, "isInitialized$1"); function isEnabled() { const client = getClient(); return !!client && client.getOptions().enabled !== false && !!client.getTransport(); @@ -19319,16 +19319,16 @@ function toUpperCase(str) { } __name(toUpperCase, "toUpperCase"); const ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__"; -function is2DCanvasBlank(canvas) { - const ctx = canvas.getContext("2d"); +function is2DCanvasBlank(canvas2) { + const ctx = canvas2.getContext("2d"); if (!ctx) return true; const chunkSize = 50; - for (let x2 = 0; x2 < canvas.width; x2 += chunkSize) { - for (let y2 = 0; y2 < canvas.height; y2 += chunkSize) { + for (let x2 = 0; x2 < canvas2.width; x2 += chunkSize) { + for (let y2 = 0; y2 < canvas2.height; y2 += chunkSize) { const getImageData = ctx.getImageData; const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData; - const pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x2, y2, Math.min(chunkSize, canvas.width - x2), Math.min(chunkSize, canvas.height - y2)).data.buffer); + const pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x2, y2, Math.min(chunkSize, canvas2.width - x2), Math.min(chunkSize, canvas2.height - y2)).data.buffer); if (pixelBuffer.some((pixel) => pixel !== 0)) return false; } @@ -19472,13 +19472,13 @@ function getAbsoluteSrcsetString(doc2, attributeValue) { if (attributeValue.trim() === "") { return attributeValue; } - let pos2 = 0; + let pos = 0; function collectCharacters(regEx) { let chars2; - const match2 = regEx.exec(attributeValue.substring(pos2)); + const match2 = regEx.exec(attributeValue.substring(pos)); if (match2) { chars2 = match2[0]; - pos2 += chars2.length; + pos += chars2.length; return chars2; } return ""; @@ -19487,7 +19487,7 @@ function getAbsoluteSrcsetString(doc2, attributeValue) { const output = []; while (true) { collectCharacters(SRCSET_COMMAS_OR_SPACES); - if (pos2 >= attributeValue.length) { + if (pos >= attributeValue.length) { break; } let url = collectCharacters(SRCSET_NOT_SPACES); @@ -19499,13 +19499,13 @@ function getAbsoluteSrcsetString(doc2, attributeValue) { url = absoluteToDoc(doc2, url); let inParens = false; while (true) { - const c2 = attributeValue.charAt(pos2); + const c2 = attributeValue.charAt(pos); if (c2 === "") { output.push((url + descriptorsStr).trim()); break; } else if (!inParens) { if (c2 === ",") { - pos2 += 1; + pos += 1; output.push((url + descriptorsStr).trim()); break; } else if (c2 === "(") { @@ -19517,7 +19517,7 @@ function getAbsoluteSrcsetString(doc2, attributeValue) { } } descriptorsStr += c2; - pos2 += 1; + pos += 1; } } } @@ -21686,17 +21686,17 @@ function initInputObserver({ inputCb, doc: doc2, mirror: mirror2, blockClass, bl __name(initInputObserver, "initInputObserver"); function getNestedCSSRulePositions(rule) { const positions = []; - function recurse(childRule, pos2) { + function recurse(childRule, pos) { if (hasNestedCSSRule("CSSGroupingRule") && childRule.parentRule instanceof CSSGroupingRule || hasNestedCSSRule("CSSMediaRule") && childRule.parentRule instanceof CSSMediaRule || hasNestedCSSRule("CSSSupportsRule") && childRule.parentRule instanceof CSSSupportsRule || hasNestedCSSRule("CSSConditionRule") && childRule.parentRule instanceof CSSConditionRule) { const rules = Array.from(childRule.parentRule.cssRules); const index2 = rules.indexOf(childRule); - pos2.unshift(index2); + pos.unshift(index2); } else if (childRule.parentStyleSheet) { const rules = Array.from(childRule.parentStyleSheet.cssRules); const index2 = rules.indexOf(childRule); - pos2.unshift(index2); + pos.unshift(index2); } - return pos2; + return pos; } __name(recurse, "recurse"); return recurse(rule, positions); @@ -23199,9 +23199,9 @@ function onWindowOpen(cb) { } handlers$2.push(cb); return () => { - const pos2 = handlers$2 ? handlers$2.indexOf(cb) : -1; - if (pos2 > -1) { - handlers$2.splice(pos2, 1); + const pos = handlers$2 ? handlers$2.indexOf(cb) : -1; + if (pos > -1) { + handlers$2.splice(pos, 1); } }; } @@ -23329,10 +23329,10 @@ class ClickDetector { } }); for (const click2 of timedOutClicks) { - const pos2 = this._clicks.indexOf(click2); - if (pos2 > -1) { + const pos = this._clicks.indexOf(click2); + if (pos > -1) { this._generateBreadcrumbs(click2); - this._clicks.splice(pos2, 1); + this._clicks.splice(pos, 1); } } if (this._clicks.length) { @@ -27708,9 +27708,9 @@ class CanvasManager { } const matchedCanvas = []; const searchCanvas = /* @__PURE__ */ __name((root29) => { - root29.querySelectorAll("canvas").forEach((canvas) => { - if (!isBlocked(canvas, blockClass, blockSelector, unblockSelector)) { - matchedCanvas.push(canvas); + root29.querySelectorAll("canvas").forEach((canvas2) => { + if (!isBlocked(canvas2, blockClass, blockSelector, unblockSelector)) { + matchedCanvas.push(canvas2); } }); }, "searchCanvas"); @@ -27737,28 +27737,28 @@ class CanvasManager { return; } lastSnapshotTime = timestamp2; - getCanvas(canvasElement).forEach((canvas) => { - if (!this.mirror.hasNode(canvas)) { + getCanvas(canvasElement).forEach((canvas2) => { + if (!this.mirror.hasNode(canvas2)) { return; } - const id3 = this.mirror.getId(canvas); + const id3 = this.mirror.getId(canvas2); if (this.snapshotInProgressMap.get(id3)) return; - if (!canvas.width || !canvas.height) + if (!canvas2.width || !canvas2.height) return; this.snapshotInProgressMap.set(id3, true); - if (!isManualSnapshot && ["webgl", "webgl2"].includes(canvas.__context)) { - const context = canvas.getContext(canvas.__context); + if (!isManualSnapshot && ["webgl", "webgl2"].includes(canvas2.__context)) { + const context = canvas2.getContext(canvas2.__context); if (_optionalChain([context, "optionalAccess", (_4) => _4.getContextAttributes, "call", (_5) => _5(), "optionalAccess", (_6) => _6.preserveDrawingBuffer]) === false) { context.clear(context.COLOR_BUFFER_BIT); } } - createImageBitmap(canvas).then((bitmap) => { + createImageBitmap(canvas2).then((bitmap) => { _optionalChain([this, "access", (_7) => _7.worker, "optionalAccess", (_8) => _8.postMessage, "call", (_9) => _9({ id: id3, bitmap, - width: canvas.width, - height: canvas.height, + width: canvas2.width, + height: canvas2.height, dataURLOptions, maxCanvasSize }, [bitmap])]); @@ -27786,17 +27786,17 @@ class CanvasManager { onRequestAnimationFrame(setLatestRAFTimestamp); } flushPendingCanvasMutations() { - this.pendingCanvasMutations.forEach((values, canvas) => { - const id3 = this.mirror.getId(canvas); - this.flushPendingCanvasMutationFor(canvas, id3); + this.pendingCanvasMutations.forEach((values, canvas2) => { + const id3 = this.mirror.getId(canvas2); + this.flushPendingCanvasMutationFor(canvas2, id3); }); onRequestAnimationFrame(() => this.flushPendingCanvasMutations()); } - flushPendingCanvasMutationFor(canvas, id3) { + flushPendingCanvasMutationFor(canvas2, id3) { if (this.frozen || this.locked) { return; } - const valuesWithType = this.pendingCanvasMutations.get(canvas); + const valuesWithType = this.pendingCanvasMutations.get(canvas2); if (!valuesWithType || id3 === -1) return; const values = valuesWithType.map((value4) => { @@ -27805,7 +27805,7 @@ class CanvasManager { }); const { type } = valuesWithType[0]; this.mutationCb({ id: id3, type, commands: values }); - this.pendingCanvasMutations.delete(canvas); + this.pendingCanvasMutations.delete(canvas2); } } const CANVAS_QUALITY = { @@ -32008,7 +32008,7 @@ const toHandlerKey = cacheStringFunction$1( return s2; } ); -const hasChanged = /* @__PURE__ */ __name((value4, oldValue2) => !Object.is(value4, oldValue2), "hasChanged"); +const hasChanged = /* @__PURE__ */ __name((value4, oldValue) => !Object.is(value4, oldValue), "hasChanged"); const invokeArrayFns = /* @__PURE__ */ __name((fns, ...arg) => { for (let i2 = 0; i2 < fns.length; i2++) { fns[i2](...arg); @@ -33096,7 +33096,7 @@ function track(target2, type, key) { } } __name(track, "track"); -function trigger(target2, type, key, newValue2, oldValue2, oldTarget) { +function trigger(target2, type, key, newValue2, oldValue, oldTarget) { const depsMap = targetMap.get(target2); if (!depsMap) { globalVersion++; @@ -33110,7 +33110,7 @@ function trigger(target2, type, key, newValue2, oldValue2, oldTarget) { type, key, newValue: newValue2, - oldValue: oldValue2, + oldValue, oldTarget }); } else { @@ -33435,18 +33435,18 @@ class MutableReactiveHandler extends BaseReactiveHandler { super(false, isShallow2); } set(target2, key, value4, receiver) { - let oldValue2 = target2[key]; + let oldValue = target2[key]; if (!this._isShallow) { - const isOldValueReadonly = isReadonly(oldValue2); + const isOldValueReadonly = isReadonly(oldValue); if (!isShallow(value4) && !isReadonly(value4)) { - oldValue2 = toRaw(oldValue2); + oldValue = toRaw(oldValue); value4 = toRaw(value4); } - if (!isArray$b(target2) && isRef(oldValue2) && !isRef(value4)) { + if (!isArray$b(target2) && isRef(oldValue) && !isRef(value4)) { if (isOldValueReadonly) { return false; } else { - oldValue2.value = value4; + oldValue.value = value4; return true; } } @@ -33461,18 +33461,18 @@ class MutableReactiveHandler extends BaseReactiveHandler { if (target2 === toRaw(receiver)) { if (!hadKey) { trigger(target2, "add", key, value4); - } else if (hasChanged(value4, oldValue2)) { - trigger(target2, "set", key, value4, oldValue2); + } else if (hasChanged(value4, oldValue)) { + trigger(target2, "set", key, value4, oldValue); } } return result; } deleteProperty(target2, key) { const hadKey = hasOwn$3(target2, key); - const oldValue2 = target2[key]; + const oldValue = target2[key]; const result = Reflect.deleteProperty(target2, key); if (result && hadKey) { - trigger(target2, "delete", key, void 0, oldValue2); + trigger(target2, "delete", key, void 0, oldValue); } return result; } @@ -33652,12 +33652,12 @@ function createInstrumentations(readonly2, shallow) { } else if (false) { checkIdentityKeys(target2, has2, key); } - const oldValue2 = get3.call(target2, key); + const oldValue = get3.call(target2, key); target2.set(key, value4); if (!hadKey) { trigger(target2, "add", key, value4); - } else if (hasChanged(value4, oldValue2)) { - trigger(target2, "set", key, value4, oldValue2); + } else if (hasChanged(value4, oldValue)) { + trigger(target2, "set", key, value4, oldValue); } return this; }, @@ -33671,10 +33671,10 @@ function createInstrumentations(readonly2, shallow) { } else if (false) { checkIdentityKeys(target2, has2, key); } - const oldValue2 = get3 ? get3.call(target2, key) : void 0; + const oldValue = get3 ? get3.call(target2, key) : void 0; const result = target2.delete(key); if (hadKey) { - trigger(target2, "delete", key, void 0, oldValue2); + trigger(target2, "delete", key, void 0, oldValue); } return result; }, @@ -33921,10 +33921,10 @@ class RefImpl { return this._value; } set value(newValue2) { - const oldValue2 = this._rawValue; + const oldValue = this._rawValue; const useDirectValue = this["__v_isShallow"] || isShallow(newValue2) || isReadonly(newValue2); newValue2 = useDirectValue ? newValue2 : toRaw(newValue2); - if (hasChanged(newValue2, oldValue2)) { + if (hasChanged(newValue2, oldValue)) { this._rawValue = newValue2; this._value = useDirectValue ? newValue2 : toReactive$1(newValue2); if (false) { @@ -33933,7 +33933,7 @@ class RefImpl { type: "set", key: "value", newValue: newValue2, - oldValue: oldValue2 + oldValue }); } else { this.dep.trigger(); @@ -33967,9 +33967,9 @@ __name(toValue$4, "toValue$4"); const shallowUnwrapHandlers = { get: /* @__PURE__ */ __name((target2, key, receiver) => key === "__v_raw" ? target2 : unref(Reflect.get(target2, key, receiver)), "get"), set: /* @__PURE__ */ __name((target2, key, value4, receiver) => { - const oldValue2 = target2[key]; - if (isRef(oldValue2) && !isRef(value4)) { - oldValue2.value = value4; + const oldValue = target2[key]; + if (isRef(oldValue) && !isRef(value4)) { + oldValue.value = value4; return true; } else { return Reflect.set(target2, key, value4, receiver); @@ -34264,14 +34264,14 @@ function watch$1(source, cb, options4 = EMPTY_OBJ) { watchHandle(); }, "cb"); } - let oldValue2 = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE; + let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE; const job = /* @__PURE__ */ __name((immediateFirstRun) => { if (!(effect2.flags & 1) || !effect2.dirty && !immediateFirstRun) { return; } if (cb) { const newValue2 = effect2.run(); - if (deep || forceTrigger || (isMultiSource ? newValue2.some((v2, i2) => hasChanged(v2, oldValue2[i2])) : hasChanged(newValue2, oldValue2))) { + if (deep || forceTrigger || (isMultiSource ? newValue2.some((v2, i2) => hasChanged(v2, oldValue[i2])) : hasChanged(newValue2, oldValue))) { if (cleanup) { cleanup(); } @@ -34281,14 +34281,14 @@ function watch$1(source, cb, options4 = EMPTY_OBJ) { const args = [ newValue2, // pass undefined as the old value when it's changed for the first time - oldValue2 === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue2[0] === INITIAL_WATCHER_VALUE ? [] : oldValue2, + oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, boundCleanup ]; call ? call(cb, 3, args) : ( // @ts-expect-error cb(...args) ); - oldValue2 = newValue2; + oldValue = newValue2; } finally { activeWatcher = currentWatcher; } @@ -34322,7 +34322,7 @@ function watch$1(source, cb, options4 = EMPTY_OBJ) { if (immediate) { job(true); } else { - oldValue2 = effect2.run(); + oldValue = effect2.run(); } } else if (scheduler) { scheduler(job.bind(null, true), true); @@ -43375,8 +43375,8 @@ const vShow = { transition.enter(el); } }, - updated(el, { value: value4, oldValue: oldValue2 }, { transition }) { - if (!value4 === !oldValue2) return; + updated(el, { value: value4, oldValue }, { transition }) { + if (!value4 === !oldValue) return; if (transition) { if (value4) { transition.beforeEnter(el); @@ -43616,13 +43616,13 @@ function patchDOMProp(el, key, value4, parentComponent, attrName) { const tag = el.tagName; if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally !tag.includes("-")) { - const oldValue2 = tag === "OPTION" ? el.getAttribute("value") || "" : el.value; + const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value; const newValue2 = value4 == null ? ( // #11647: value should be set as empty string for null and undefined, // but should be set as 'on'. el.type === "checkbox" ? "on" : "" ) : String(value4); - if (oldValue2 !== newValue2 || !("_value" in el)) { + if (oldValue !== newValue2 || !("_value" in el)) { el.value = newValue2; } if (value4 == null) { @@ -44433,7 +44433,7 @@ const vModelText = { mounted(el, { value: value4 }) { el.value = value4 == null ? "" : value4; }, - beforeUpdate(el, { value: value4, oldValue: oldValue2, modifiers: { lazy, trim: trim2, number: number2 } }, vnode) { + beforeUpdate(el, { value: value4, oldValue, modifiers: { lazy, trim: trim2, number: number2 } }, vnode) { el[assignKey] = getModelAssigner(vnode); if (el.composing) return; const elValue = (number2 || el.type === "number") && !/^0\d/.test(el.value) ? looseToNumber(el.value) : el.value; @@ -44442,7 +44442,7 @@ const vModelText = { return; } if (document.activeElement === el && el.type !== "range") { - if (lazy && value4 === oldValue2) { + if (lazy && value4 === oldValue) { return; } if (trim2 && el.value.trim() === newValue2) { @@ -44492,7 +44492,7 @@ const vModelCheckbox = { setChecked(el, binding, vnode); } }; -function setChecked(el, { value: value4, oldValue: oldValue2 }, vnode) { +function setChecked(el, { value: value4, oldValue }, vnode) { el._modelValue = value4; let checked4; if (isArray$b(value4)) { @@ -44500,7 +44500,7 @@ function setChecked(el, { value: value4, oldValue: oldValue2 }, vnode) { } else if (isSet$3(value4)) { checked4 = value4.has(vnode.props.value); } else { - if (value4 === oldValue2) return; + if (value4 === oldValue) return; checked4 = looseEqual(value4, getCheckboxValue(el, true)); } if (el.checked !== checked4) { @@ -44516,9 +44516,9 @@ const vModelRadio = { el[assignKey](getValue$3(el)); }); }, - beforeUpdate(el, { value: value4, oldValue: oldValue2 }, vnode) { + beforeUpdate(el, { value: value4, oldValue }, vnode) { el[assignKey] = getModelAssigner(vnode); - if (value4 !== oldValue2) { + if (value4 !== oldValue) { el.checked = looseEqual(value4, vnode.props.value); } } @@ -45887,7 +45887,7 @@ function addStoreToDevtools(app2, store) { }); }, true); store._customProperties.forEach((name2) => { - watch(() => unref(store[name2]), (newValue2, oldValue2) => { + watch(() => unref(store[name2]), (newValue2, oldValue) => { api2.notifyComponentUpdate(); api2.sendInspectorState(INSPECTOR_ID); if (isTimelineActive) { @@ -45899,7 +45899,7 @@ function addStoreToDevtools(app2, store) { subtitle: name2, data: { newValue: newValue2, - oldValue: oldValue2 + oldValue }, groupId: activeAction } @@ -48906,10 +48906,10 @@ function setupConfig(app2, PrimeVue2) { isThemeChanged.value = true; } }); - var stopConfigWatcher = watch(PrimeVue2.config, function(newValue2, oldValue2) { + var stopConfigWatcher = watch(PrimeVue2.config, function(newValue2, oldValue) { PrimeVueService.emit("config:change", { newValue: newValue2, - oldValue: oldValue2 + oldValue }); }, { immediate: true, @@ -48917,10 +48917,10 @@ function setupConfig(app2, PrimeVue2) { }); var stopRippleWatcher = watch(function() { return PrimeVue2.config.ripple; - }, function(newValue2, oldValue2) { + }, function(newValue2, oldValue) { PrimeVueService.emit("config:ripple:change", { newValue: newValue2, - oldValue: oldValue2 + oldValue }); }, { immediate: true, @@ -48928,7 +48928,7 @@ function setupConfig(app2, PrimeVue2) { }); var stopThemeWatcher = watch(function() { return PrimeVue2.config.theme; - }, function(newValue2, oldValue2) { + }, function(newValue2, oldValue) { if (!isThemeChanged.value) { config_default$1.setTheme(newValue2); } @@ -48938,7 +48938,7 @@ function setupConfig(app2, PrimeVue2) { isThemeChanged.value = false; PrimeVueService.emit("config:theme:change", { newValue: newValue2, - oldValue: oldValue2 + oldValue }); }, { immediate: true, @@ -48946,13 +48946,13 @@ function setupConfig(app2, PrimeVue2) { }); var stopUnstyledWatcher = watch(function() { return PrimeVue2.config.unstyled; - }, function(newValue2, oldValue2) { + }, function(newValue2, oldValue) { if (!newValue2 && PrimeVue2.config.theme) { loadCommonTheme(); } PrimeVueService.emit("config:unstyled:change", { newValue: newValue2, - oldValue: oldValue2 + oldValue }); }, { immediate: true, @@ -49659,14 +49659,14 @@ var BaseDirective = { watchers === null || watchers === void 0 || (_watchers$config = watchers["config"]) === null || _watchers$config === void 0 || _watchers$config.call(el.$instance, (_el$$instance11 = el.$instance) === null || _el$$instance11 === void 0 ? void 0 : _el$$instance11.$primevueConfig); PrimeVueService.on("config:change", function(_ref8) { var _watchers$config2; - var newValue2 = _ref8.newValue, oldValue2 = _ref8.oldValue; - return watchers === null || watchers === void 0 || (_watchers$config2 = watchers["config"]) === null || _watchers$config2 === void 0 ? void 0 : _watchers$config2.call(el.$instance, newValue2, oldValue2); + var newValue2 = _ref8.newValue, oldValue = _ref8.oldValue; + return watchers === null || watchers === void 0 || (_watchers$config2 = watchers["config"]) === null || _watchers$config2 === void 0 ? void 0 : _watchers$config2.call(el.$instance, newValue2, oldValue); }); watchers === null || watchers === void 0 || (_watchers$configRipp = watchers["config.ripple"]) === null || _watchers$configRipp === void 0 || _watchers$configRipp.call(el.$instance, (_el$$instance12 = el.$instance) === null || _el$$instance12 === void 0 || (_el$$instance12 = _el$$instance12.$primevueConfig) === null || _el$$instance12 === void 0 ? void 0 : _el$$instance12.ripple); PrimeVueService.on("config:ripple:change", function(_ref9) { var _watchers$configRipp2; - var newValue2 = _ref9.newValue, oldValue2 = _ref9.oldValue; - return watchers === null || watchers === void 0 || (_watchers$configRipp2 = watchers["config.ripple"]) === null || _watchers$configRipp2 === void 0 ? void 0 : _watchers$configRipp2.call(el.$instance, newValue2, oldValue2); + var newValue2 = _ref9.newValue, oldValue = _ref9.oldValue; + return watchers === null || watchers === void 0 || (_watchers$configRipp2 = watchers["config.ripple"]) === null || _watchers$configRipp2 === void 0 ? void 0 : _watchers$configRipp2.call(el.$instance, newValue2, oldValue); }); }, "handleWatch"); return { @@ -54831,12 +54831,12 @@ const streamChunk = /* @__PURE__ */ __name(function* (chunk, chunkSize) { yield chunk; return; } - let pos2 = 0; + let pos = 0; let end; - while (pos2 < len) { - end = pos2 + chunkSize; - yield chunk.slice(pos2, end); - pos2 = end; + while (pos < len) { + end = pos + chunkSize; + yield chunk.slice(pos, end); + pos = end; } }, "streamChunk"); const readBytes = /* @__PURE__ */ __name(async function* (iterable, chunkSize, encode2) { @@ -55879,10 +55879,10 @@ function createBounds(objects, padding = 10) { ]; } __name(createBounds, "createBounds"); -function snapPoint(pos2, snapTo) { +function snapPoint(pos, snapTo) { if (!snapTo) return false; - pos2[0] = snapTo * Math.round(pos2[0] / snapTo); - pos2[1] = snapTo * Math.round(pos2[1] / snapTo); + pos[0] = snapTo * Math.round(pos[0] / snapTo); + pos[1] = snapTo * Math.round(pos[1] / snapTo); return true; } __name(snapPoint, "snapPoint"); @@ -55897,10 +55897,10 @@ class Reroute { * @param pos Position in graph coordinates * @param linkIds Link IDs ({@link LLink.id}) of all links that use this reroute */ - constructor(id3, network, pos2, parentId, linkIds) { + constructor(id3, network, pos, parentId, linkIds) { this.id = id3; this.#network = new WeakRef(network); - this.update(parentId, pos2, linkIds); + this.update(parentId, pos, linkIds); this.linkIds ??= /* @__PURE__ */ new Set(); } static radius = 10; @@ -55976,9 +55976,9 @@ class Reroute { * @param pos The position of this reroute * @param linkIds All link IDs that pass through this reroute */ - update(parentId, pos2, linkIds) { + update(parentId, pos, linkIds) { this.parentId = parentId; - if (pos2) this.pos = pos2; + if (pos) this.pos = pos; if (linkIds) this.linkIds = new Set(linkIds); } /** @@ -56034,9 +56034,9 @@ class Reroute { /** @inheritdoc */ snapToGrid(snapTo) { if (!snapTo) return false; - const { pos: pos2 } = this; - pos2[0] = snapTo * Math.round(pos2[0] / snapTo); - pos2[1] = snapTo * Math.round(pos2[1] / snapTo); + const { pos } = this; + pos[0] = snapTo * Math.round(pos[0] / snapTo); + pos[1] = snapTo * Math.round(pos[1] / snapTo); return true; } calculateAngle(lastRenderTime, network, linkStart) { @@ -56049,9 +56049,9 @@ class Reroute { for (const linkId of linkIds) { const link2 = links.get(linkId); if (!link2) continue; - const pos2 = LLink.findNextReroute(network, link2, id3)?.pos ?? network.getNodeById(link2.target_id)?.getConnectionPos(true, link2.target_slot, this.#buffer); - if (!pos2) continue; - const angle = Math.atan2(pos2[1] - this.#pos[1], pos2[0] - this.#pos[0]); + const pos = LLink.findNextReroute(network, link2, id3)?.pos ?? network.getNodeById(link2.target_id)?.getConnectionPos(true, link2.target_slot, this.#buffer); + if (!pos) continue; + const angle = Math.atan2(pos[1] - this.#pos[1], pos[0] - this.#pos[0]); angles.push(angle); sum += angle; } @@ -56080,10 +56080,10 @@ class Reroute { * @remarks Leaves {@link ctx}.fillStyle, strokeStyle, and lineWidth dirty (perf.). */ draw(ctx) { - const { pos: pos2 } = this; + const { pos } = this; ctx.fillStyle = this._colour; ctx.beginPath(); - ctx.arc(pos2[0], pos2[1], Reroute.radius, 0, 2 * Math.PI); + ctx.arc(pos[0], pos[1], Reroute.radius, 0, 2 * Math.PI); ctx.fill(); ctx.lineWidth = Reroute.radius * 0.1; ctx.strokeStyle = "rgb(0,0,0,0.5)"; @@ -56091,13 +56091,13 @@ class Reroute { ctx.fillStyle = "#ffffff55"; ctx.strokeStyle = "rgb(0,0,0,0.3)"; ctx.beginPath(); - ctx.arc(pos2[0], pos2[1], Reroute.radius * 0.8, 0, 2 * Math.PI); + ctx.arc(pos[0], pos[1], Reroute.radius * 0.8, 0, 2 * Math.PI); ctx.fill(); ctx.stroke(); if (this.selected) { ctx.strokeStyle = "#fff"; ctx.beginPath(); - ctx.arc(pos2[0], pos2[1], Reroute.radius * 1.2, 0, 2 * Math.PI); + ctx.arc(pos[0], pos[1], Reroute.radius * 1.2, 0, 2 * Math.PI); ctx.stroke(); } } @@ -56178,6 +56178,900 @@ class LGraphBadge { ctx.fillStyle = fillStyle; } } +var SlotType = /* @__PURE__ */ ((SlotType2) => { + SlotType2["Array"] = "array"; + SlotType2[SlotType2["Event"] = -1] = "Event"; + return SlotType2; +})(SlotType || {}); +var SlotShape = ((SlotShape2) => { + SlotShape2[SlotShape2["Box"] = RenderShape.BOX] = "Box"; + SlotShape2[SlotShape2["Arrow"] = RenderShape.ARROW] = "Arrow"; + SlotShape2[SlotShape2["Grid"] = RenderShape.GRID] = "Grid"; + SlotShape2[SlotShape2["Circle"] = RenderShape.CIRCLE] = "Circle"; + SlotShape2[SlotShape2["HollowCircle"] = RenderShape.HollowCircle] = "HollowCircle"; + return SlotShape2; +})(SlotShape || {}); +var SlotDirection = ((SlotDirection2) => { + SlotDirection2[SlotDirection2["Up"] = LinkDirection.UP] = "Up"; + SlotDirection2[SlotDirection2["Right"] = LinkDirection.RIGHT] = "Right"; + SlotDirection2[SlotDirection2["Down"] = LinkDirection.DOWN] = "Down"; + SlotDirection2[SlotDirection2["Left"] = LinkDirection.LEFT] = "Left"; + return SlotDirection2; +})(SlotDirection || {}); +var LabelPosition = /* @__PURE__ */ ((LabelPosition2) => { + LabelPosition2["Left"] = "left"; + LabelPosition2["Right"] = "right"; + return LabelPosition2; +})(LabelPosition || {}); +function strokeShape(ctx, area, options22 = {}) { + const { + shape = RenderShape.BOX, + round_radius = LiteGraph.ROUND_RADIUS, + title_height = LiteGraph.NODE_TITLE_HEIGHT, + title_mode = TitleMode.NORMAL_TITLE, + colour = LiteGraph.NODE_BOX_OUTLINE_COLOR, + padding = 6, + collapsed: collapsed2 = false, + thickness = 1 + } = options22; + if (title_mode === TitleMode.TRANSPARENT_TITLE) { + area[1] -= title_height; + area[3] += title_height; + } + const { lineWidth, strokeStyle } = ctx; + ctx.lineWidth = thickness; + ctx.globalAlpha = 0.8; + ctx.strokeStyle = colour; + ctx.beginPath(); + const [x2, y2, width2, height] = area; + switch (shape) { + case RenderShape.BOX: { + ctx.rect( + x2 - padding, + y2 - padding, + width2 + 2 * padding, + height + 2 * padding + ); + break; + } + case RenderShape.ROUND: + case RenderShape.CARD: { + const radius = round_radius + padding; + const isCollapsed = shape === RenderShape.CARD && collapsed2; + const cornerRadii = isCollapsed || shape === RenderShape.ROUND ? [radius] : [radius, 2, radius, 2]; + ctx.roundRect( + x2 - padding, + y2 - padding, + width2 + 2 * padding, + height + 2 * padding, + cornerRadii + ); + break; + } + case RenderShape.CIRCLE: { + const centerX = x2 + width2 / 2; + const centerY = y2 + height / 2; + const radius = Math.max(width2, height) / 2 + padding; + ctx.arc(centerX, centerY, radius, 0, Math.PI * 2); + break; + } + } + ctx.stroke(); + ctx.lineWidth = lineWidth; + ctx.strokeStyle = strokeStyle; + ctx.globalAlpha = 1; +} +__name(strokeShape, "strokeShape"); +class NodeSlot { + static { + __name(this, "NodeSlot"); + } + name; + localized_name; + label; + type; + dir; + removable; + shape; + color_off; + color_on; + locked; + nameLocked; + pos; + widget; + constructor(slot) { + Object.assign(this, slot); + this.name = slot.name; + this.type = slot.type; + } + /** + * The label to display in the UI. + */ + get renderingLabel() { + return this.label || this.localized_name || this.name || ""; + } + connectedColor(context) { + return this.color_on || context.default_connection_color_byType[this.type] || context.default_connection_color.output_on; + } + disconnectedColor(context) { + return this.color_off || context.default_connection_color_byTypeOff[this.type] || context.default_connection_color_byType[this.type] || context.default_connection_color.output_off; + } + renderingColor(context) { + return this.isConnected() ? this.connectedColor(context) : this.disconnectedColor(context); + } + draw(ctx, options22) { + const { + pos, + colorContext, + labelColor = "#AAA", + labelPosition = LabelPosition.Right, + lowQuality = false, + renderText = true, + highlight = false, + doStroke: _doStroke = false + } = options22; + const originalFillStyle = ctx.fillStyle; + const originalStrokeStyle = ctx.strokeStyle; + const originalLineWidth = ctx.lineWidth; + const slot_type = this.type; + const slot_shape = slot_type === SlotType.Array ? SlotShape.Grid : this.shape; + ctx.beginPath(); + let doStroke = _doStroke; + let doFill = true; + ctx.fillStyle = this.renderingColor(colorContext); + ctx.lineWidth = 1; + if (slot_type === SlotType.Event || slot_shape === SlotShape.Box) { + ctx.rect(pos[0] - 6 + 0.5, pos[1] - 5 + 0.5, 14, 10); + } else if (slot_shape === SlotShape.Arrow) { + ctx.moveTo(pos[0] + 8, pos[1] + 0.5); + ctx.lineTo(pos[0] - 4, pos[1] + 6 + 0.5); + ctx.lineTo(pos[0] - 4, pos[1] - 6 + 0.5); + ctx.closePath(); + } else if (slot_shape === SlotShape.Grid) { + const gridSize = 3; + const cellSize = 2; + const spacing = 3; + for (let x2 = 0; x2 < gridSize; x2++) { + for (let y2 = 0; y2 < gridSize; y2++) { + ctx.rect( + pos[0] - 4 + x2 * spacing, + pos[1] - 4 + y2 * spacing, + cellSize, + cellSize + ); + } + } + doStroke = false; + } else { + if (lowQuality) { + ctx.rect(pos[0] - 4, pos[1] - 4, 8, 8); + } else { + let radius; + if (slot_shape === SlotShape.HollowCircle) { + doFill = false; + doStroke = true; + ctx.lineWidth = 3; + ctx.strokeStyle = ctx.fillStyle; + radius = highlight ? 4 : 3; + } else { + radius = highlight ? 5 : 4; + } + ctx.arc(pos[0], pos[1], radius, 0, Math.PI * 2); + } + } + if (doFill) ctx.fill(); + if (!lowQuality && doStroke) ctx.stroke(); + if (renderText) { + const text2 = this.renderingLabel; + if (text2) { + ctx.fillStyle = labelColor; + if (labelPosition === LabelPosition.Right) { + if (this.dir == LinkDirection.UP) { + ctx.fillText(text2, pos[0], pos[1] - 10); + } else { + ctx.fillText(text2, pos[0] + 10, pos[1] + 5); + } + } else { + if (this.dir == LinkDirection.DOWN) { + ctx.fillText(text2, pos[0], pos[1] - 8); + } else { + ctx.fillText(text2, pos[0] - 10, pos[1] + 5); + } + } + } + } + ctx.fillStyle = originalFillStyle; + ctx.strokeStyle = originalStrokeStyle; + ctx.lineWidth = originalLineWidth; + } + drawCollapsed(ctx, options22) { + const [x2, y2] = options22.pos; + const originalFillStyle = ctx.fillStyle; + ctx.fillStyle = "#686"; + ctx.beginPath(); + if (this.type === SlotType.Event || this.shape === RenderShape.BOX) { + ctx.rect(x2 - 7 + 0.5, y2 - 4, 14, 8); + } else if (this.shape === RenderShape.ARROW) { + const isInput = this instanceof NodeInputSlot; + if (isInput) { + ctx.moveTo(x2 + 8, y2); + ctx.lineTo(x2 - 4, y2 - 4); + ctx.lineTo(x2 - 4, y2 + 4); + } else { + ctx.moveTo(x2 + 6, y2); + ctx.lineTo(x2 - 6, y2 - 4); + ctx.lineTo(x2 - 6, y2 + 4); + } + ctx.closePath(); + } else { + ctx.arc(x2, y2, 4, 0, Math.PI * 2); + } + ctx.fill(); + ctx.fillStyle = originalFillStyle; + } +} +class NodeInputSlot extends NodeSlot { + static { + __name(this, "NodeInputSlot"); + } + link; + constructor(slot) { + super(slot); + this.link = slot.link; + } + isConnected() { + return this.link != null; + } + isValidTarget(link2) { + if (!link2) return true; + return !!link2.output && LiteGraph.isValidConnection(this.type, link2.output.type); + } + draw(ctx, options22) { + const originalTextAlign = ctx.textAlign; + ctx.textAlign = "left"; + super.draw(ctx, { + ...options22, + labelPosition: LabelPosition.Right, + doStroke: false + }); + ctx.textAlign = originalTextAlign; + } +} +class NodeOutputSlot extends NodeSlot { + static { + __name(this, "NodeOutputSlot"); + } + links; + _data; + slot_index; + constructor(slot) { + super(slot); + this.links = slot.links; + this._data = slot._data; + this.slot_index = slot.slot_index; + } + isValidTarget(link2) { + if (!link2) return true; + return !!link2.input && LiteGraph.isValidConnection(this.type, link2.input.type); + } + isConnected() { + return this.links != null && this.links.length > 0; + } + draw(ctx, options22) { + const originalTextAlign = ctx.textAlign; + const originalStrokeStyle = ctx.strokeStyle; + ctx.textAlign = "right"; + ctx.strokeStyle = "black"; + super.draw(ctx, { + ...options22, + labelPosition: LabelPosition.Left, + doStroke: true + }); + ctx.textAlign = originalTextAlign; + ctx.strokeStyle = originalStrokeStyle; + } +} +class BaseWidget { + static { + __name(this, "BaseWidget"); + } + linkedWidgets; + options; + marker; + label; + clicked; + name; + type; + value; + y; + last_y; + width; + disabled; + hidden; + advanced; + tooltip; + element; + constructor(widget) { + Object.assign(this, widget); + this.options = widget.options; + } + get outline_color() { + return this.advanced ? LiteGraph.WIDGET_ADVANCED_OUTLINE_COLOR : LiteGraph.WIDGET_OUTLINE_COLOR; + } + get background_color() { + return LiteGraph.WIDGET_BGCOLOR; + } + get height() { + return LiteGraph.NODE_WIDGET_HEIGHT; + } + get text_color() { + return LiteGraph.WIDGET_TEXT_COLOR; + } + get secondary_text_color() { + return LiteGraph.WIDGET_SECONDARY_TEXT_COLOR; + } + /** + * Handles the click event for the widget + * @param options - The options for handling the click event + */ + onClick(options22) { + } + /** + * Handles the drag event for the widget + * @param options - The options for handling the drag event + */ + onDrag(options22) { + } + /** + * Sets the value of the widget + * @param value - The value to set + * @param options - The options for setting the value + */ + setValue(value4, options22) { + const { node: node22, canvas: canvas2, e: e2 } = options22; + const oldValue = this.value; + const v2 = this.type === "number" ? Number(value4) : value4; + this.value = v2; + if (this.options?.property && node22.properties[this.options.property] !== void 0) { + node22.setProperty(this.options.property, v2); + } + const pos = canvas2.graph_mouse; + this.callback?.(this.value, canvas2, node22, pos, e2); + node22.onWidgetChanged?.(this.name ?? "", v2, oldValue, this); + if (node22.graph) node22.graph._version++; + } +} +class BooleanWidget extends BaseWidget { + static { + __name(this, "BooleanWidget"); + } + constructor(widget) { + super(widget); + this.type = "toggle"; + this.value = widget.value; + } + drawWidget(ctx, options22) { + const { y: y2, width: width2, show_text = true, margin = 15 } = options22; + const widget_width = width2; + const H = this.height; + ctx.textAlign = "left"; + ctx.strokeStyle = this.outline_color; + ctx.fillStyle = this.background_color; + ctx.beginPath(); + if (show_text) + ctx.roundRect(margin, y2, widget_width - margin * 2, H, [H * 0.5]); + else ctx.rect(margin, y2, widget_width - margin * 2, H); + ctx.fill(); + if (show_text && !this.disabled) ctx.stroke(); + ctx.fillStyle = this.value ? "#89A" : "#333"; + ctx.beginPath(); + ctx.arc( + widget_width - margin * 2, + y2 + H * 0.5, + H * 0.36, + 0, + Math.PI * 2 + ); + ctx.fill(); + if (show_text) { + ctx.fillStyle = this.secondary_text_color; + const label5 = this.label || this.name; + if (label5 != null) { + ctx.fillText(label5, margin * 2, y2 + H * 0.7); + } + ctx.fillStyle = this.value ? this.text_color : this.secondary_text_color; + ctx.textAlign = "right"; + ctx.fillText( + this.value ? this.options.on || "true" : this.options.off || "false", + widget_width - 40, + y2 + H * 0.7 + ); + } + } + onClick(options22) { + this.setValue(!this.value, options22); + } +} +class ButtonWidget extends BaseWidget { + static { + __name(this, "ButtonWidget"); + } + constructor(widget) { + super(widget); + this.type = "button"; + this.value = widget.value ?? ""; + } + /** + * Draws the widget + * @param ctx - The canvas context + * @param options - The options for drawing the widget + */ + drawWidget(ctx, options22) { + const originalTextAlign = ctx.textAlign; + const originalStrokeStyle = ctx.strokeStyle; + const originalFillStyle = ctx.fillStyle; + const { y: y2, width: width2, show_text = true, margin = 15 } = options22; + const widget_width = width2; + const H = this.height; + ctx.fillStyle = this.background_color; + if (this.clicked) { + ctx.fillStyle = "#AAA"; + this.clicked = false; + } + ctx.fillRect(margin, y2, widget_width - margin * 2, H); + if (show_text && !this.disabled) { + ctx.strokeStyle = this.outline_color; + ctx.strokeRect(margin, y2, widget_width - margin * 2, H); + } + if (show_text) { + ctx.textAlign = "center"; + ctx.fillStyle = this.text_color; + ctx.fillText( + this.label || this.name || "", + widget_width * 0.5, + y2 + H * 0.7 + ); + } + ctx.textAlign = originalTextAlign; + ctx.strokeStyle = originalStrokeStyle; + ctx.fillStyle = originalFillStyle; + } + onClick(options22) { + const { e: e2, node: node22, canvas: canvas2 } = options22; + const pos = canvas2.graph_mouse; + this.clicked = true; + canvas2.setDirty(true); + this.callback?.(this, canvas2, node22, pos, e2); + } +} +class ComboWidget extends BaseWidget { + static { + __name(this, "ComboWidget"); + } + constructor(widget) { + super(widget); + this.type = "combo"; + this.value = widget.value; + } + /** + * Draws the widget + * @param ctx - The canvas context + * @param options - The options for drawing the widget + */ + drawWidget(ctx, options22) { + const originalTextAlign = ctx.textAlign; + const originalStrokeStyle = ctx.strokeStyle; + const originalFillStyle = ctx.fillStyle; + const { y: y2, width: width2, show_text = true, margin = 15 } = options22; + const widget_width = width2; + const H = this.height; + ctx.textAlign = "left"; + ctx.strokeStyle = this.outline_color; + ctx.fillStyle = this.background_color; + ctx.beginPath(); + if (show_text) + ctx.roundRect(margin, y2, widget_width - margin * 2, H, [H * 0.5]); + else + ctx.rect(margin, y2, widget_width - margin * 2, H); + ctx.fill(); + if (show_text) { + if (!this.disabled) { + ctx.stroke(); + ctx.fillStyle = this.text_color; + ctx.beginPath(); + ctx.moveTo(margin + 16, y2 + 5); + ctx.lineTo(margin + 6, y2 + H * 0.5); + ctx.lineTo(margin + 16, y2 + H - 5); + ctx.fill(); + ctx.beginPath(); + ctx.moveTo(widget_width - margin - 16, y2 + 5); + ctx.lineTo(widget_width - margin - 6, y2 + H * 0.5); + ctx.lineTo(widget_width - margin - 16, y2 + H - 5); + ctx.fill(); + } + ctx.fillStyle = this.secondary_text_color; + const label5 = this.label || this.name; + if (label5 != null) { + ctx.fillText(label5, margin * 2 + 5, y2 + H * 0.7); + } + ctx.fillStyle = this.text_color; + ctx.textAlign = "right"; + let displayValue = typeof this.value === "number" ? String(this.value) : this.value; + if (this.options.values) { + let values = this.options.values; + if (typeof values === "function") { + values = values(); + } + if (values && !Array.isArray(values)) { + displayValue = values[this.value]; + } + } + const labelWidth = ctx.measureText(label5 || "").width + margin * 2; + const inputWidth = widget_width - margin * 4; + const availableWidth = inputWidth - labelWidth; + const textWidth = ctx.measureText(displayValue).width; + if (textWidth > availableWidth) { + const ELLIPSIS = "…"; + const ellipsisWidth = ctx.measureText(ELLIPSIS).width; + const charWidthAvg = ctx.measureText("a").width; + if (availableWidth <= ellipsisWidth) { + displayValue = "․"; + } else { + displayValue = `${displayValue}`; + const overflowWidth = textWidth + ellipsisWidth - availableWidth; + if (overflowWidth + charWidthAvg * 3 > availableWidth) { + const preciseRange = availableWidth + charWidthAvg * 3; + const preTruncateCt = Math.floor((preciseRange - ellipsisWidth) / charWidthAvg); + displayValue = displayValue.substr(0, preTruncateCt); + } + while (ctx.measureText(displayValue).width + ellipsisWidth > availableWidth) { + displayValue = displayValue.substr(0, displayValue.length - 1); + } + displayValue += ELLIPSIS; + } + } + ctx.fillText( + displayValue, + widget_width - margin * 2 - 20, + y2 + H * 0.7 + ); + } + ctx.textAlign = originalTextAlign; + ctx.strokeStyle = originalStrokeStyle; + ctx.fillStyle = originalFillStyle; + } + onClick(options22) { + const { e: e2, node: node22, canvas: canvas2 } = options22; + const x2 = e2.canvasX - node22.pos[0]; + const width2 = this.width || node22.size[0]; + const delta2 = x2 < 40 ? -1 : x2 > width2 - 40 ? 1 : 0; + let values = this.options.values; + if (typeof values === "function") { + values = values(this, node22); + } + const values_list = Array.isArray(values) ? values : Object.keys(values); + if (delta2) { + let index2 = -1; + canvas2.last_mouseclick = 0; + index2 = typeof values === "object" ? values_list.indexOf(String(this.value)) + delta2 : values_list.indexOf(this.value) + delta2; + if (index2 >= values_list.length) index2 = values_list.length - 1; + if (index2 < 0) index2 = 0; + this.setValue( + Array.isArray(values) ? values[index2] : index2, + { + e: e2, + node: node22, + canvas: canvas2 + } + ); + return; + } + const text_values = values != values_list ? Object.values(values) : values; + new LiteGraph.ContextMenu(text_values, { + scale: Math.max(1, canvas2.ds.scale), + event: e2, + className: "dark", + callback: /* @__PURE__ */ __name((value4) => { + this.setValue( + values != values_list ? text_values.indexOf(value4) : value4, + { + e: e2, + node: node22, + canvas: canvas2 + } + ); + }, "callback") + }); + } +} +class NumberWidget extends BaseWidget { + static { + __name(this, "NumberWidget"); + } + constructor(widget) { + super(widget); + this.type = "number"; + this.value = widget.value; + } + /** + * Draws the widget + * @param ctx - The canvas context + * @param options - The options for drawing the widget + */ + drawWidget(ctx, options22) { + const originalTextAlign = ctx.textAlign; + const originalStrokeStyle = ctx.strokeStyle; + const originalFillStyle = ctx.fillStyle; + const { y: y2, width: width2, show_text = true, margin = 15 } = options22; + const widget_width = width2; + const H = this.height; + ctx.textAlign = "left"; + ctx.strokeStyle = this.outline_color; + ctx.fillStyle = this.background_color; + ctx.beginPath(); + if (show_text) + ctx.roundRect(margin, y2, widget_width - margin * 2, H, [H * 0.5]); + else + ctx.rect(margin, y2, widget_width - margin * 2, H); + ctx.fill(); + if (show_text) { + if (!this.disabled) { + ctx.stroke(); + ctx.fillStyle = this.text_color; + ctx.beginPath(); + ctx.moveTo(margin + 16, y2 + 5); + ctx.lineTo(margin + 6, y2 + H * 0.5); + ctx.lineTo(margin + 16, y2 + H - 5); + ctx.fill(); + ctx.beginPath(); + ctx.moveTo(widget_width - margin - 16, y2 + 5); + ctx.lineTo(widget_width - margin - 6, y2 + H * 0.5); + ctx.lineTo(widget_width - margin - 16, y2 + H - 5); + ctx.fill(); + } + ctx.fillStyle = this.secondary_text_color; + const label5 = this.label || this.name; + if (label5 != null) { + ctx.fillText(label5, margin * 2 + 5, y2 + H * 0.7); + } + ctx.fillStyle = this.text_color; + ctx.textAlign = "right"; + ctx.fillText( + Number(this.value).toFixed( + this.options.precision !== void 0 ? this.options.precision : 3 + ), + widget_width - margin * 2 - 20, + y2 + H * 0.7 + ); + } + ctx.textAlign = originalTextAlign; + ctx.strokeStyle = originalStrokeStyle; + ctx.fillStyle = originalFillStyle; + } + onClick(options) { + const { e, node, canvas } = options; + const x = e.canvasX - node.pos[0]; + const width = this.width || node.size[0]; + const delta = x < 40 ? -1 : x > width - 40 ? 1 : 0; + if (delta) { + let newValue2 = this.value + delta * 0.1 * (this.options.step || 1); + if (this.options.min != null && newValue2 < this.options.min) { + newValue2 = this.options.min; + } + if (this.options.max != null && newValue2 > this.options.max) { + newValue2 = this.options.max; + } + if (newValue2 !== this.value) { + this.setValue(newValue2, { e, node, canvas }); + } + return; + } + canvas.prompt("Value", this.value, (v) => { + if (/^[0-9+\-*/()\s]+|\d+\.\d+$/.test(v)) { + try { + v = eval(v); + } catch { + } + } + const newValue = Number(v); + if (!isNaN(newValue)) { + this.setValue(newValue, { e, node, canvas }); + } + }, e); + } + /** + * Handles drag events for the number widget + * @param options - The options for handling the drag event + */ + onDrag(options22) { + const { e: e2, node: node22, canvas: canvas2 } = options22; + const width2 = this.width || node22.width; + const x2 = e2.canvasX - node22.pos[0]; + const delta2 = x2 < 40 ? -1 : x2 > width2 - 40 ? 1 : 0; + if (delta2 && (x2 > -3 && x2 < width2 + 3)) return; + let newValue2 = this.value; + if (e2.deltaX) newValue2 += e2.deltaX * 0.1 * (this.options.step || 1); + if (this.options.min != null && newValue2 < this.options.min) { + newValue2 = this.options.min; + } + if (this.options.max != null && newValue2 > this.options.max) { + newValue2 = this.options.max; + } + if (newValue2 !== this.value) { + this.setValue(newValue2, { e: e2, node: node22, canvas: canvas2 }); + } + } +} +class SliderWidget extends BaseWidget { + static { + __name(this, "SliderWidget"); + } + constructor(widget) { + super(widget); + this.type = "slider"; + this.value = widget.value; + this.options = widget.options; + } + /** + * Draws the widget + * @param ctx - The canvas context + * @param options - The options for drawing the widget + */ + drawWidget(ctx, options22) { + const originalTextAlign = ctx.textAlign; + const originalStrokeStyle = ctx.strokeStyle; + const originalFillStyle = ctx.fillStyle; + const { y: y2, width: widget_width, show_text = true, margin = 15 } = options22; + const H = this.height; + ctx.fillStyle = this.background_color; + ctx.fillRect(margin, y2, widget_width - margin * 2, H); + const range2 = this.options.max - this.options.min; + let nvalue = (this.value - this.options.min) / range2; + nvalue = clamp$1(nvalue, 0, 1); + ctx.fillStyle = this.options.slider_color ?? "#678"; + ctx.fillRect(margin, y2, nvalue * (widget_width - margin * 2), H); + if (show_text && !this.disabled) { + ctx.strokeStyle = this.outline_color; + ctx.strokeRect(margin, y2, widget_width - margin * 2, H); + } + if (this.marker != null) { + let marker_nvalue = (this.marker - this.options.min) / range2; + marker_nvalue = clamp$1(marker_nvalue, 0, 1); + ctx.fillStyle = this.options.marker_color ?? "#AA9"; + ctx.fillRect( + margin + marker_nvalue * (widget_width - margin * 2), + y2, + 2, + H + ); + } + if (show_text) { + ctx.textAlign = "center"; + ctx.fillStyle = this.text_color; + ctx.fillText( + (this.label || this.name) + " " + Number(this.value).toFixed( + this.options.precision != null ? this.options.precision : 3 + ), + widget_width * 0.5, + y2 + H * 0.7 + ); + } + ctx.textAlign = originalTextAlign; + ctx.strokeStyle = originalStrokeStyle; + ctx.fillStyle = originalFillStyle; + } + /** + * Handles click events for the slider widget + */ + onClick(options22) { + if (this.options.read_only) return; + const { e: e2, node: node22 } = options22; + const width2 = this.width || node22.size[0]; + const x2 = e2.canvasX - node22.pos[0]; + const slideFactor = clamp$1((x2 - 15) / (width2 - 30), 0, 1); + const newValue2 = this.options.min + (this.options.max - this.options.min) * slideFactor; + if (newValue2 !== this.value) { + this.setValue(newValue2, options22); + } + } + /** + * Handles drag events for the slider widget + */ + onDrag(options22) { + if (this.options.read_only) return false; + const { e: e2, node: node22 } = options22; + const width2 = this.width || node22.size[0]; + const x2 = e2.canvasX - node22.pos[0]; + const slideFactor = clamp$1((x2 - 15) / (width2 - 30), 0, 1); + const newValue2 = this.options.min + (this.options.max - this.options.min) * slideFactor; + if (newValue2 !== this.value) { + this.setValue(newValue2, options22); + } + } +} +class TextWidget extends BaseWidget { + static { + __name(this, "TextWidget"); + } + constructor(widget) { + super(widget); + this.type = widget.type; + this.value = widget.value?.toString() ?? ""; + } + /** + * Draws the widget + * @param ctx - The canvas context + * @param options - The options for drawing the widget + */ + drawWidget(ctx, options22) { + const originalTextAlign = ctx.textAlign; + const originalStrokeStyle = ctx.strokeStyle; + const originalFillStyle = ctx.fillStyle; + const { y: y2, width: width2, show_text = true, margin = 15 } = options22; + const widget_width = width2; + const H = this.height; + ctx.textAlign = "left"; + ctx.strokeStyle = this.outline_color; + ctx.fillStyle = this.background_color; + ctx.beginPath(); + if (show_text) + ctx.roundRect(margin, y2, widget_width - margin * 2, H, [H * 0.5]); + else + ctx.rect(margin, y2, widget_width - margin * 2, H); + ctx.fill(); + if (show_text) { + if (!this.disabled) ctx.stroke(); + ctx.save(); + ctx.beginPath(); + ctx.rect(margin, y2, widget_width - margin * 2, H); + ctx.clip(); + ctx.fillStyle = this.secondary_text_color; + const label5 = this.label || this.name; + if (label5 != null) { + ctx.fillText(label5, margin * 2, y2 + H * 0.7); + } + ctx.fillStyle = this.text_color; + ctx.textAlign = "right"; + ctx.fillText( + String(this.value).substr(0, 30), + // 30 chars max + widget_width - margin * 2, + y2 + H * 0.7 + ); + ctx.restore(); + } + ctx.textAlign = originalTextAlign; + ctx.strokeStyle = originalStrokeStyle; + ctx.fillStyle = originalFillStyle; + } + onClick(options22) { + const { e: e2, node: node22, canvas: canvas2 } = options22; + canvas2.prompt( + "Value", + this.value, + (v2) => { + if (v2 !== null) { + this.setValue(v2, { e: e2, node: node22, canvas: canvas2 }); + } + }, + e2, + this.options?.multiline ?? false + ); + } +} +const WIDGET_TYPE_MAP = { + button: ButtonWidget, + toggle: BooleanWidget, + slider: SliderWidget, + combo: ComboWidget, + number: NumberWidget, + string: TextWidget, + text: TextWidget +}; +function toClass(cls, obj) { + return obj instanceof cls ? obj : new cls(obj); +} +__name(toClass, "toClass"); class LGraphNode { static { __name(this, "LGraphNode"); @@ -56187,12 +57081,18 @@ class LGraphNode { static MAX_CONSOLE; static type; static category; - static supported_extensions; static filter; static skip_list; /** Default setting for {@link LGraphNode.connectInputToOutput}. @see {@link INodeFlags.keepAllLinksOnBypass} */ static keepAllLinksOnBypass = false; + /** The title text of the node. */ title; + /** + * The font style used to render the node's title text. + */ + get titleFontStyle() { + return `${LiteGraph.NODE_TEXT_SIZE}px Arial`; + } graph = null; id; type = null; @@ -56210,9 +57110,37 @@ class LGraphNode { mode; last_serialization; serialize_widgets; + /** + * The overridden fg color used to render the node. + * @see {@link renderingColor} + */ color; + /** + * The overridden bg color used to render the node. + * @see {@link renderingBgColor} + */ bgcolor; + /** + * The overridden box color used to render the node. + * @see {@link renderingBoxColor} + */ boxcolor; + /** The fg color used to render the node. */ + get renderingColor() { + return this.color || this.constructor.color || LiteGraph.NODE_DEFAULT_COLOR; + } + /** The bg color used to render the node. */ + get renderingBgColor() { + return this.bgcolor || this.constructor.bgcolor || LiteGraph.NODE_DEFAULT_BGCOLOR; + } + /** The box color used to render the node. */ + get renderingBoxColor() { + let colState = LiteGraph.node_box_coloured_by_mode && LiteGraph.NODE_MODES_COLORS[this.mode] ? LiteGraph.NODE_MODES_COLORS[this.mode] : void 0; + if (LiteGraph.node_box_coloured_when_on) { + colState = this.action_triggered ? "#FFF" : this.execute_triggered ? "#AAA" : colState; + } + return this.boxcolor || colState || LiteGraph.NODE_DEFAULT_BOXCOLOR; + } exec_version; action_call; execute_triggered; @@ -56223,13 +57151,14 @@ class LGraphNode { gotFocusAt; badges = []; badgePosition = BadgePosition.TopLeft; + /** + * The width of the node when collapsed. + * Updated by {@link LGraphCanvas.drawNode} + */ _collapsed_width; - horizontal; console; _level; _shape; - subgraph; - skip_subgraph_button; mouseOver; redraw_on_mouse; // Appears unused @@ -56285,6 +57214,12 @@ class LGraphNode { this._size[0] = value4[0]; this._size[1] = value4[1]; } + /** + * The size of the node used for rendering. + */ + get renderingSize() { + return this.flags.collapsed ? [this._collapsed_width, 0] : this._size; + } get shape() { return this._shape; } @@ -56309,12 +57244,21 @@ class LGraphNode { this._shape = v2; } } + /** + * The shape of the node used for rendering. @see {@link RenderShape} + */ + get renderingShape() { + return this._shape || this.constructor.shape || LiteGraph.NODE_DEFAULT_SHAPE; + } get is_selected() { return this.selected; } set is_selected(value4) { this.selected = value4; } + get title_mode() { + return this.constructor.title_mode ?? TitleMode.NORMAL_TITLE; + } constructor(title) { this.id = LiteGraph.use_uuids ? LiteGraph.uuidv4() : -1; this.title = title || "Unnamed"; @@ -56351,30 +57295,27 @@ class LGraphNode { if (!info.title) { this.title = this.constructor.title; } - if (this.inputs) { - for (let i2 = 0; i2 < this.inputs.length; ++i2) { - const input = this.inputs[i2]; - const link2 = this.graph ? this.graph._links.get(input.link) : null; - this.onConnectionsChange?.(NodeSlotType.INPUT, i2, true, link2, input); - this.onInputAdded?.(input); - } + this.inputs ??= []; + this.inputs = this.inputs.map((input) => toClass(NodeInputSlot, input)); + for (const [i2, input] of this.inputs.entries()) { + const link2 = this.graph ? this.graph._links.get(input.link) : null; + this.onConnectionsChange?.(NodeSlotType.INPUT, i2, true, link2, input); + this.onInputAdded?.(input); } - if (this.outputs) { - for (let i2 = 0; i2 < this.outputs.length; ++i2) { - const output = this.outputs[i2]; - if (!output.links) { - continue; - } - for (let j2 = 0; j2 < output.links.length; ++j2) { - const link2 = this.graph ? this.graph._links.get(output.links[j2]) : null; - this.onConnectionsChange?.(NodeSlotType.OUTPUT, i2, true, link2, output); - } - this.onOutputAdded?.(output); + this.outputs ??= []; + this.outputs = this.outputs.map((output) => toClass(NodeOutputSlot, output)); + for (const [i2, output] of this.outputs.entries()) { + if (!output.links) { + continue; } + for (const linkId of output.links) { + const link2 = this.graph ? this.graph._links.get(linkId) : null; + this.onConnectionsChange?.(NodeSlotType.OUTPUT, i2, true, link2, output); + } + this.onOutputAdded?.(output); } if (this.widgets) { - for (let i2 = 0; i2 < this.widgets.length; ++i2) { - const w2 = this.widgets[i2]; + for (const w2 of this.widgets) { if (!w2) continue; if (w2.options?.property && this.properties[w2.options.property] != void 0) w2.value = JSON.parse(JSON.stringify(this.properties[w2.options.property])); @@ -56709,10 +57650,10 @@ class LGraphNode { } return trigS; } - onAfterExecuteNode(param, options4) { + onAfterExecuteNode(param, options22) { const trigS = this.findOutputSlot("onExecuted"); if (trigS != -1) { - this.triggerSlot(trigS, param, null, options4); + this.triggerSlot(trigS, param, null, options22); } } changeMode(modeTo) { @@ -56738,46 +57679,46 @@ class LGraphNode { /** * Triggers the node code execution, place a boolean/counter to mark the node as being executed */ - doExecute(param, options4) { - options4 = options4 || {}; + doExecute(param, options22) { + options22 = options22 || {}; if (this.onExecute) { - options4.action_call ||= this.id + "_exec_" + Math.floor(Math.random() * 9999); + options22.action_call ||= this.id + "_exec_" + Math.floor(Math.random() * 9999); this.graph.nodes_executing[this.id] = true; - this.onExecute(param, options4); + this.onExecute(param, options22); this.graph.nodes_executing[this.id] = false; this.exec_version = this.graph.iteration; - if (options4?.action_call) { - this.action_call = options4.action_call; - this.graph.nodes_executedAction[this.id] = options4.action_call; + if (options22?.action_call) { + this.action_call = options22.action_call; + this.graph.nodes_executedAction[this.id] = options22.action_call; } } this.execute_triggered = 2; - this.onAfterExecuteNode?.(param, options4); + this.onAfterExecuteNode?.(param, options22); } /** * Triggers an action, wrapped by logics to control execution flow * @param action name */ - actionDo(action, param, options4) { - options4 = options4 || {}; + actionDo(action, param, options22) { + options22 = options22 || {}; if (this.onAction) { - options4.action_call ||= this.id + "_" + (action ? action : "action") + "_" + Math.floor(Math.random() * 9999); + options22.action_call ||= this.id + "_" + (action ? action : "action") + "_" + Math.floor(Math.random() * 9999); this.graph.nodes_actioning[this.id] = action ? action : "actioning"; - this.onAction(action, param, options4); + this.onAction(action, param, options22); this.graph.nodes_actioning[this.id] = false; - if (options4?.action_call) { - this.action_call = options4.action_call; - this.graph.nodes_executedAction[this.id] = options4.action_call; + if (options22?.action_call) { + this.action_call = options22.action_call; + this.graph.nodes_executedAction[this.id] = options22.action_call; } } this.action_triggered = 2; - this.onAfterExecuteNode?.(param, options4); + this.onAfterExecuteNode?.(param, options22); } /** * Triggers an event in this node, this will trigger any output with the same name * @param action name ( "on_play", ... ) if action is equivalent to false then the event is send to all */ - trigger(action, param, options4) { + trigger(action, param, options22) { if (!this.outputs || !this.outputs.length) { return; } @@ -56786,7 +57727,7 @@ class LGraphNode { const output = this.outputs[i2]; if (!output || output.type !== LiteGraph.EVENT || action && output.name != action) continue; - this.triggerSlot(i2, param, null, options4); + this.triggerSlot(i2, param, null, options22); } } /** @@ -56794,8 +57735,8 @@ class LGraphNode { * @param slot the index of the output slot * @param link_id [optional] in case you want to trigger and specific output link in a slot */ - triggerSlot(slot, param, link_id, options4) { - options4 = options4 || {}; + triggerSlot(slot, param, link_id, options22) { + options22 = options22 || {}; if (!this.outputs) return; if (slot == null) { console.error("slot must be a number"); @@ -56817,14 +57758,14 @@ class LGraphNode { const node22 = this.graph.getNodeById(link_info.target_id); if (!node22) continue; if (node22.mode === LGraphEventMode.ON_TRIGGER) { - if (!options4.action_call) - options4.action_call = this.id + "_trigg_" + Math.floor(Math.random() * 9999); - node22.doExecute?.(param, options4); + if (!options22.action_call) + options22.action_call = this.id + "_trigg_" + Math.floor(Math.random() * 9999); + node22.doExecute?.(param, options22); } else if (node22.onAction) { - if (!options4.action_call) - options4.action_call = this.id + "_act_" + Math.floor(Math.random() * 9999); + if (!options22.action_call) + options22.action_call = this.id + "_act_" + Math.floor(Math.random() * 9999); const target_connection = node22.inputs[link_info.target_slot]; - node22.actionDo(target_connection.name, param, options4); + node22.actionDo(target_connection.name, param, options22); } } } @@ -56882,7 +57823,7 @@ class LGraphNode { * @param extra_info this can be used to have special properties of an output (label, special color, position, etc) */ addOutput(name2, type, extra_info) { - const output = { name: name2, type, links: null }; + const output = new NodeOutputSlot({ name: name2, type, links: null }); if (extra_info) { for (const i2 in extra_info) { output[i2] = extra_info[i2]; @@ -56904,7 +57845,7 @@ class LGraphNode { addOutputs(array) { for (let i2 = 0; i2 < array.length; ++i2) { const info = array[i2]; - const o2 = { name: info[0], type: info[1], links: null }; + const o2 = new NodeOutputSlot({ name: info[0], type: info[1], links: null }); if (array[2]) { for (const j2 in info[2]) { o2[j2] = info[2][j2]; @@ -56945,7 +57886,7 @@ class LGraphNode { */ addInput(name2, type, extra_info) { type = type || 0; - const input = { name: name2, type, link: null }; + const input = new NodeInputSlot({ name: name2, type, link: null }); if (extra_info) { for (const i2 in extra_info) { input[i2] = extra_info[i2]; @@ -56966,7 +57907,7 @@ class LGraphNode { addInputs(array) { for (let i2 = 0; i2 < array.length; ++i2) { const info = array[i2]; - const o2 = { name: info[0], type: info[1], link: null }; + const o2 = new NodeInputSlot({ name: info[0], type: info[1], link: null }); if (array[2]) { for (const j2 in info[2]) { o2[j2] = info[2][j2]; @@ -57002,11 +57943,11 @@ class LGraphNode { * @param pos position of the connection inside the node * @param direction if is input or output */ - addConnection(name2, type, pos2, direction) { + addConnection(name2, type, pos, direction) { const o2 = { name: name2, type, - pos: pos2, + pos, direction, links: null }; @@ -57056,9 +57997,9 @@ class LGraphNode { let widgets_height = 0; if (this.widgets?.length) { for (let i2 = 0, l2 = this.widgets.length; i2 < l2; ++i2) { - const widget2 = this.widgets[i2]; - if (widget2.hidden || widget2.advanced && !this.showAdvanced) continue; - widgets_height += widget2.computeSize ? widget2.computeSize(size[0])[1] + 4 : LiteGraph.NODE_WIDGET_HEIGHT + 4; + const widget = this.widgets[i2]; + if (widget.hidden || widget.advanced && !this.showAdvanced) continue; + widgets_height += widget.computeSize ? widget.computeSize(size[0])[1] + 4 : LiteGraph.NODE_WIDGET_HEIGHT + 4; } widgets_height += 8; } @@ -57126,17 +58067,17 @@ class LGraphNode { * @param options the object that contains special properties of this widget * @returns the created widget object */ - addWidget(type, name2, value4, callback, options4) { + addWidget(type, name2, value4, callback, options22) { this.widgets ||= []; - if (!options4 && callback && typeof callback === "object") { - options4 = callback; + if (!options22 && callback && typeof callback === "object") { + options22 = callback; callback = null; } - if (options4 && typeof options4 === "string") - options4 = { property: options4 }; + if (options22 && typeof options22 === "string") + options22 = { property: options22 }; if (callback && typeof callback === "string") { - options4 ||= {}; - options4.property = callback; + options22 ||= {}; + options22.property = callback; callback = null; } if (callback && typeof callback !== "function") { @@ -57149,7 +58090,7 @@ class LGraphNode { name: name2, value: value4, callback, - options: options4 || {} + options: options22 || {} }; if (w2.options.y !== void 0) { w2.y = w2.options.y; @@ -57160,14 +58101,16 @@ class LGraphNode { if (type == "combo" && !w2.options.values) { throw "LiteGraph addWidget('combo',...) requires to pass values in options: { values:['red','blue'] }"; } - this.widgets.push(w2); + const widget = this.addCustomWidget(w2); this.setSize(this.computeSize()); - return w2; + return widget; } addCustomWidget(custom_widget) { this.widgets ||= []; - this.widgets.push(custom_widget); - return custom_widget; + const WidgetClass = WIDGET_TYPE_MAP[custom_widget.type]; + const widget = WidgetClass ? new WidgetClass(custom_widget) : custom_widget; + this.widgets.push(widget); + return widget; } move(deltaX, deltaY) { if (this.pinned) return; @@ -57183,7 +58126,7 @@ class LGraphNode { * @param pad Expands the area by this amount on each side. Default: 0 */ measure(out, pad = 0) { - const titleMode = this.constructor.title_mode; + const titleMode = this.title_mode; const renderTitle = titleMode != TitleMode.TRANSPARENT_TITLE && titleMode != TitleMode.NO_TITLE; const titleHeight = renderTitle ? LiteGraph.NODE_TITLE_HEIGHT : 0; out[0] = this.pos[0] - pad; @@ -57285,18 +58228,18 @@ class LGraphNode { * @returns The widget found, otherwise `null` */ getWidgetOnPos(canvasX, canvasY, includeDisabled = false) { - const { widgets, pos: pos2, size } = this; + const { widgets, pos, size } = this; if (!widgets?.length) return null; - const x2 = canvasX - pos2[0]; - const y2 = canvasY - pos2[1]; + const x2 = canvasX - pos[0]; + const y2 = canvasY - pos[1]; const nodeWidth = size[0]; - for (const widget2 of widgets) { - if (!widget2 || widget2.disabled && !includeDisabled || widget2.hidden || widget2.advanced && !this.showAdvanced) + for (const widget of widgets) { + if (!widget || widget.disabled && !includeDisabled || widget.hidden || widget.advanced && !this.showAdvanced) continue; - const h2 = widget2.computeSize ? widget2.computeSize(nodeWidth)[1] : LiteGraph.NODE_WIDGET_HEIGHT; - const w2 = widget2.width || nodeWidth; - if (widget2.last_y !== void 0 && isInRectangle(x2, y2, 6, widget2.last_y, w2 - 12, h2)) - return widget2; + const h2 = widget.computeSize ? widget.computeSize(nodeWidth)[1] : LiteGraph.NODE_WIDGET_HEIGHT; + const w2 = widget.width || nodeWidth; + if (widget.last_y !== void 0 && isInRectangle(x2, y2, 6, widget.last_y, w2 - 12, h2)) + return widget; } return null; } @@ -57328,12 +58271,12 @@ class LGraphNode { * Finds the next free slot * @param slots The slots to search, i.e. this.inputs or this.outputs */ - #findFreeSlot(slots, options4) { + #findFreeSlot(slots, options22) { const defaults2 = { returnObj: false, typesNotAccepted: [] }; - const opts = Object.assign(defaults2, options4 || {}); + const opts = Object.assign(defaults2, options22 || {}); const length = slots?.length; if (!(length > 0)) return -1; for (let i2 = 0; i2 < length; ++i2) { @@ -57423,18 +58366,18 @@ class LGraphNode { * @see {connectByType} * @see {connectByTypeOutput} */ - findConnectByTypeSlot(findInputs, node22, slotType, options4) { - if (options4 && typeof options4 === "object") { - if ("firstFreeIfInputGeneralInCase" in options4) options4.wildcardToTyped = !!options4.firstFreeIfInputGeneralInCase; - if ("firstFreeIfOutputGeneralInCase" in options4) options4.wildcardToTyped = !!options4.firstFreeIfOutputGeneralInCase; - if ("generalTypeInCase" in options4) options4.typedToWildcard = !!options4.generalTypeInCase; + findConnectByTypeSlot(findInputs, node22, slotType, options22) { + if (options22 && typeof options22 === "object") { + if ("firstFreeIfInputGeneralInCase" in options22) options22.wildcardToTyped = !!options22.firstFreeIfInputGeneralInCase; + if ("firstFreeIfOutputGeneralInCase" in options22) options22.wildcardToTyped = !!options22.firstFreeIfOutputGeneralInCase; + if ("generalTypeInCase" in options22) options22.typedToWildcard = !!options22.generalTypeInCase; } const optsDef = { createEventInCase: true, wildcardToTyped: true, typedToWildcard: true }; - const opts = Object.assign(optsDef, options4); + const opts = Object.assign(optsDef, options22); if (node22 && typeof node22 === "number") { node22 = this.graph.getNodeById(node22); } @@ -57789,13 +58732,8 @@ class LGraphNode { const offset = LiteGraph.NODE_SLOT_HEIGHT * 0.5; if (this.flags.collapsed) { const w2 = this._collapsed_width || LiteGraph.NODE_COLLAPSED_WIDTH; - if (this.horizontal) { - out[0] = this.pos[0] + w2 * 0.5; - out[1] = is_input ? this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT : this.pos[1]; - } else { - out[0] = is_input ? this.pos[0] : this.pos[0] + w2; - out[1] = this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT * 0.5; - } + out[0] = is_input ? this.pos[0] : this.pos[0] + w2; + out[1] = this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT * 0.5; return out; } if (is_input && slot_number == -1) { @@ -57812,11 +58750,6 @@ class LGraphNode { out[1] = this.pos[1] + this.outputs[slot_number].pos[1]; return out; } - if (this.horizontal) { - out[0] = this.pos[0] + (slot_number + 0.5) * (this.size[0] / num_slots); - out[1] = is_input ? this.pos[1] - LiteGraph.NODE_TITLE_HEIGHT : this.pos[1] + this.size[1]; - return out; - } out[0] = is_input ? this.pos[0] + offset : this.pos[0] + this.size[0] + 1 - offset; out[1] = this.pos[1] + (slot_number + 0.7) * LiteGraph.NODE_SLOT_HEIGHT + (this.constructor.slot_start_y || 0); return out; @@ -57920,8 +58853,12 @@ class LGraphNode { get width() { return this.collapsed ? this._collapsed_width || LiteGraph.NODE_COLLAPSED_WIDTH : this.size[0]; } + /** + * Returns the height of the node, including the title bar. + */ get height() { - return this.collapsed ? LiteGraph.NODE_COLLAPSED_HEIGHT : this.size[1]; + const bodyHeight = this.collapsed ? 0 : this.size[1]; + return LiteGraph.NODE_TITLE_HEIGHT + bodyHeight; } drawBadges(ctx, { gap = 2 } = {}) { const badgeInstances = this.badges.map((badge) => badge instanceof LGraphBadge ? badge : badge()); @@ -57933,6 +58870,168 @@ class LGraphNode { currentX += badge.getWidth(ctx) + gap; } } + /** + * Renders the node's title bar background + */ + drawTitleBarBackground(ctx, options22) { + const { + scale, + title_height = LiteGraph.NODE_TITLE_HEIGHT, + low_quality = false + } = options22; + const fgcolor = this.renderingColor; + const shape = this.renderingShape; + const size = this.renderingSize; + if (this.onDrawTitleBar) { + this.onDrawTitleBar(ctx, title_height, size, scale, fgcolor); + return; + } + if (this.title_mode === TitleMode.TRANSPARENT_TITLE) { + return; + } + if (this.collapsed) { + ctx.shadowColor = LiteGraph.DEFAULT_SHADOW_COLOR; + } + ctx.fillStyle = this.constructor.title_color || fgcolor; + ctx.beginPath(); + if (shape == RenderShape.BOX || low_quality) { + ctx.rect(0, -title_height, size[0], title_height); + } else if (shape == RenderShape.ROUND || shape == RenderShape.CARD) { + ctx.roundRect( + 0, + -title_height, + size[0], + title_height, + this.collapsed ? [LiteGraph.ROUND_RADIUS] : [LiteGraph.ROUND_RADIUS, LiteGraph.ROUND_RADIUS, 0, 0] + ); + } + ctx.fill(); + ctx.shadowColor = "transparent"; + } + /** + * Renders the node's title box, i.e. the dot in front of the title text that + * when clicked toggles the node's collapsed state. The term `title box` comes + * from the original LiteGraph implementation. + */ + drawTitleBox(ctx, options22) { + const { + scale, + low_quality = false, + title_height = LiteGraph.NODE_TITLE_HEIGHT, + box_size = 10 + } = options22; + const size = this.renderingSize; + const shape = this.renderingShape; + if (this.onDrawTitleBox) { + this.onDrawTitleBox(ctx, title_height, size, scale); + return; + } + if ([RenderShape.ROUND, RenderShape.CIRCLE, RenderShape.CARD].includes(shape)) { + if (low_quality) { + ctx.fillStyle = "black"; + ctx.beginPath(); + ctx.arc( + title_height * 0.5, + title_height * -0.5, + box_size * 0.5 + 1, + 0, + Math.PI * 2 + ); + ctx.fill(); + } + ctx.fillStyle = this.renderingBoxColor; + if (low_quality) + ctx.fillRect( + title_height * 0.5 - box_size * 0.5, + title_height * -0.5 - box_size * 0.5, + box_size, + box_size + ); + else { + ctx.beginPath(); + ctx.arc( + title_height * 0.5, + title_height * -0.5, + box_size * 0.5, + 0, + Math.PI * 2 + ); + ctx.fill(); + } + } else { + if (low_quality) { + ctx.fillStyle = "black"; + ctx.fillRect( + (title_height - box_size) * 0.5 - 1, + (title_height + box_size) * -0.5 - 1, + box_size + 2, + box_size + 2 + ); + } + ctx.fillStyle = this.renderingBoxColor; + ctx.fillRect( + (title_height - box_size) * 0.5, + (title_height + box_size) * -0.5, + box_size, + box_size + ); + } + } + /** + * Renders the node's title text. + */ + drawTitleText(ctx, options22) { + const { + scale, + default_title_color, + low_quality = false, + title_height = LiteGraph.NODE_TITLE_HEIGHT + } = options22; + const size = this.renderingSize; + const selected2 = this.selected; + if (this.onDrawTitleText) { + this.onDrawTitleText( + ctx, + title_height, + size, + scale, + this.titleFontStyle, + selected2 + ); + return; + } + if (low_quality) { + return; + } + ctx.font = this.titleFontStyle; + const rawTitle = this.getTitle() ?? `❌ ${this.type}`; + const title = String(rawTitle) + (this.pinned ? "📌" : ""); + if (title) { + if (selected2) { + ctx.fillStyle = LiteGraph.NODE_SELECTED_TITLE_COLOR; + } else { + ctx.fillStyle = this.constructor.title_text_color || default_title_color; + } + if (this.collapsed) { + ctx.textAlign = "left"; + ctx.fillText( + title.substr(0, 20), + // avoid urls too long + title_height, + // + measure.width * 0.5, + LiteGraph.NODE_TITLE_TEXT_Y - title_height + ); + ctx.textAlign = "left"; + } else { + ctx.textAlign = "left"; + ctx.fillText( + title, + title_height, + LiteGraph.NODE_TITLE_TEXT_Y - title_height + ); + } + } + } /** * Attempts to gracefully bypass this node in all of its connections by reconnecting all links. * @@ -57991,6 +59090,147 @@ class LGraphNode { } __name(bypassAllLinks, "bypassAllLinks"); } + drawWidgets(ctx, options22) { + if (!this.widgets) return; + const { y: y2, colorContext, linkOverWidget, linkOverWidgetType, lowQuality = false, editorAlpha = 1 } = options22; + let posY = y2; + if (this.widgets_up) { + posY = 2; + } + if (this.widgets_start_y != null) posY = this.widgets_start_y; + const width2 = this.size[0]; + const widgets = this.widgets; + posY += 2; + const H = LiteGraph.NODE_WIDGET_HEIGHT; + const show_text = !lowQuality; + ctx.save(); + ctx.globalAlpha = editorAlpha; + const margin = 15; + for (const w2 of widgets) { + if (w2.hidden || w2.advanced && !this.showAdvanced) continue; + const y22 = w2.y || posY; + const outline_color = w2.advanced ? LiteGraph.WIDGET_ADVANCED_OUTLINE_COLOR : LiteGraph.WIDGET_OUTLINE_COLOR; + if (w2 === linkOverWidget) { + new NodeInputSlot({ + name: "", + type: linkOverWidgetType, + link: 0 + }).draw(ctx, { pos: [10, y22 + 10], colorContext }); + } + w2.last_y = y22; + ctx.strokeStyle = outline_color; + ctx.fillStyle = "#222"; + ctx.textAlign = "left"; + if (w2.disabled) ctx.globalAlpha *= 0.5; + const widget_width = w2.width || width2; + const WidgetClass = WIDGET_TYPE_MAP[w2.type]; + if (WidgetClass) { + toClass(WidgetClass, w2).drawWidget(ctx, { y: y22, width: widget_width, show_text, margin }); + } else { + w2.draw?.(ctx, this, widget_width, y22, H); + } + posY += (w2.computeSize ? w2.computeSize(widget_width)[1] : H) + 4; + ctx.globalAlpha = editorAlpha; + } + ctx.restore(); + } + /** + * When {@link LGraphNode.collapsed} is `true`, this method draws the node's collapsed slots. + */ + drawCollapsedSlots(ctx) { + let input_slot = null; + let output_slot = null; + for (const slot of this.inputs ?? []) { + if (slot.link == null) { + continue; + } + input_slot = slot; + break; + } + for (const slot of this.outputs ?? []) { + if (!slot.links || !slot.links.length) { + continue; + } + output_slot = slot; + break; + } + if (input_slot) { + const x2 = 0; + const y2 = LiteGraph.NODE_TITLE_HEIGHT * -0.5; + toClass(NodeInputSlot, input_slot).drawCollapsed(ctx, { + pos: [x2, y2] + }); + } + if (output_slot) { + const x2 = this._collapsed_width; + const y2 = LiteGraph.NODE_TITLE_HEIGHT * -0.5; + toClass(NodeOutputSlot, output_slot).drawCollapsed(ctx, { + pos: [x2, y2] + }); + } + } + get highlightColor() { + return LiteGraph.NODE_TEXT_HIGHLIGHT_COLOR ?? LiteGraph.NODE_SELECTED_TITLE_COLOR ?? LiteGraph.NODE_TEXT_COLOR; + } + /** + * Draws the node's input and output slots. + * @returns The maximum y-coordinate of the slots. + * TODO: Calculate the bounding box of the slots and return it instead of the maximum y-coordinate. + */ + drawSlots(ctx, options22) { + const { colorContext, connectingLink, editorAlpha, lowQuality } = options22; + let max_y = 0; + const slot_pos = new Float32Array(2); + for (const [i2, input] of (this.inputs ?? []).entries()) { + const slot = toClass(NodeInputSlot, input); + const isValid2 = slot.isValidTarget(connectingLink); + const highlight = isValid2 && this.mouseOver?.inputId === i2; + const label_color = highlight ? this.highlightColor : LiteGraph.NODE_TEXT_COLOR; + ctx.globalAlpha = isValid2 ? editorAlpha : 0.4 * editorAlpha; + const pos = this.getConnectionPos( + true, + i2, + /* out= */ + slot_pos + ); + pos[0] -= this.pos[0]; + pos[1] -= this.pos[1]; + max_y = Math.max(max_y, pos[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5); + slot.draw(ctx, { + pos, + colorContext, + labelColor: label_color, + lowQuality, + renderText: !lowQuality, + highlight + }); + } + for (const [i2, output] of (this.outputs ?? []).entries()) { + const slot = toClass(NodeOutputSlot, output); + const isValid2 = slot.isValidTarget(connectingLink); + const highlight = isValid2 && this.mouseOver?.outputId === i2; + const label_color = highlight ? this.highlightColor : LiteGraph.NODE_TEXT_COLOR; + ctx.globalAlpha = isValid2 ? editorAlpha : 0.4 * editorAlpha; + const pos = this.getConnectionPos( + false, + i2, + /* out= */ + slot_pos + ); + pos[0] -= this.pos[0]; + pos[1] -= this.pos[1]; + max_y = Math.max(max_y, pos[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5); + slot.draw(ctx, { + pos, + colorContext, + labelColor: label_color, + lowQuality, + renderText: !lowQuality, + highlight + }); + } + return max_y; + } } class LGraphGroup { static { @@ -58121,7 +59361,7 @@ class LGraphGroup { ctx.textAlign = "left"; ctx.fillText(this.title + (this.pinned ? "📌" : ""), x2 + padding, y2 + font_size); if (LiteGraph.highlight_selected_group && this.selected) { - graphCanvas.strokeShape(ctx, this._bounding, { + strokeShape(ctx, this._bounding, { title_height: this.titleHeight, padding }); @@ -58235,117 +59475,6 @@ class LGraphGroup { isPointInside = LGraphNode.prototype.isPointInside; setDirtyCanvas = LGraphNode.prototype.setDirtyCanvas; } -var SlotType = /* @__PURE__ */ ((SlotType2) => { - SlotType2["Array"] = "array"; - SlotType2[SlotType2["Event"] = -1] = "Event"; - return SlotType2; -})(SlotType || {}); -var SlotShape = ((SlotShape2) => { - SlotShape2[SlotShape2["Box"] = RenderShape.BOX] = "Box"; - SlotShape2[SlotShape2["Arrow"] = RenderShape.ARROW] = "Arrow"; - SlotShape2[SlotShape2["Grid"] = RenderShape.GRID] = "Grid"; - SlotShape2[SlotShape2["Circle"] = RenderShape.CIRCLE] = "Circle"; - SlotShape2[SlotShape2["HollowCircle"] = RenderShape.HollowCircle] = "HollowCircle"; - return SlotShape2; -})(SlotShape || {}); -var SlotDirection = ((SlotDirection2) => { - SlotDirection2[SlotDirection2["Up"] = LinkDirection.UP] = "Up"; - SlotDirection2[SlotDirection2["Right"] = LinkDirection.RIGHT] = "Right"; - SlotDirection2[SlotDirection2["Down"] = LinkDirection.DOWN] = "Down"; - SlotDirection2[SlotDirection2["Left"] = LinkDirection.LEFT] = "Left"; - return SlotDirection2; -})(SlotDirection || {}); -var LabelPosition = /* @__PURE__ */ ((LabelPosition2) => { - LabelPosition2["Left"] = "left"; - LabelPosition2["Right"] = "right"; - return LabelPosition2; -})(LabelPosition || {}); -function drawSlot(ctx, slot, pos2, { - label_color = "#AAA", - label_position = "right", - horizontal: horizontal2 = false, - low_quality = false, - render_text = true, - do_stroke = false, - highlight = false -} = {}) { - const originalFillStyle = ctx.fillStyle; - const originalStrokeStyle = ctx.strokeStyle; - const originalLineWidth = ctx.lineWidth; - const slot_type = slot.type; - const slot_shape = slot_type === "array" ? SlotShape.Grid : slot.shape; - ctx.beginPath(); - let doStroke = do_stroke; - let doFill = true; - if (slot_type === -1 || slot_shape === SlotShape.Box) { - if (horizontal2) { - ctx.rect(pos2[0] - 5 + 0.5, pos2[1] - 8 + 0.5, 10, 14); - } else { - ctx.rect(pos2[0] - 6 + 0.5, pos2[1] - 5 + 0.5, 14, 10); - } - } else if (slot_shape === SlotShape.Arrow) { - ctx.moveTo(pos2[0] + 8, pos2[1] + 0.5); - ctx.lineTo(pos2[0] - 4, pos2[1] + 6 + 0.5); - ctx.lineTo(pos2[0] - 4, pos2[1] - 6 + 0.5); - ctx.closePath(); - } else if (slot_shape === SlotShape.Grid) { - const gridSize = 3; - const cellSize = 2; - const spacing = 3; - for (let x2 = 0; x2 < gridSize; x2++) { - for (let y2 = 0; y2 < gridSize; y2++) { - ctx.rect( - pos2[0] - 4 + x2 * spacing, - pos2[1] - 4 + y2 * spacing, - cellSize, - cellSize - ); - } - } - doStroke = false; - } else { - if (low_quality) { - ctx.rect(pos2[0] - 4, pos2[1] - 4, 8, 8); - } else { - let radius; - if (slot_shape === SlotShape.HollowCircle) { - doFill = false; - doStroke = true; - ctx.lineWidth = 3; - ctx.strokeStyle = ctx.fillStyle; - radius = highlight ? 4 : 3; - } else { - radius = highlight ? 5 : 4; - } - ctx.arc(pos2[0], pos2[1], radius, 0, Math.PI * 2); - } - } - if (doFill) ctx.fill(); - if (!low_quality && doStroke) ctx.stroke(); - if (render_text) { - const text2 = slot.label || slot.localized_name || slot.name; - if (text2) { - ctx.fillStyle = label_color; - if (label_position === "right") { - if (horizontal2 || slot.dir == LinkDirection.UP) { - ctx.fillText(text2, pos2[0], pos2[1] - 10); - } else { - ctx.fillText(text2, pos2[0] + 10, pos2[1] + 5); - } - } else { - if (horizontal2 || slot.dir == LinkDirection.DOWN) { - ctx.fillText(text2, pos2[0], pos2[1] - 8); - } else { - ctx.fillText(text2, pos2[0] - 10, pos2[1] + 5); - } - } - } - } - ctx.fillStyle = originalFillStyle; - ctx.strokeStyle = originalStrokeStyle; - ctx.lineWidth = originalLineWidth; -} -__name(drawSlot, "drawSlot"); class DragAndScale { static { __name(this, "DragAndScale"); @@ -58435,8 +59564,8 @@ class DragAndScale { if (!this.enabled) { return; } - const canvas = this.element; - const rect = canvas.getBoundingClientRect(); + const canvas2 = this.element; + const rect = canvas2.getBoundingClientRect(); const x2 = e2.clientX - rect.left; const y2 = e2.clientY - rect.top; e2.canvasx = x2; @@ -58449,7 +59578,7 @@ class DragAndScale { } if (e2.type == LiteGraph.pointerevents_method + "down" && is_inside) { this.dragging = true; - LiteGraph.pointerListenerRemove(canvas, "move", this._binded_mouse_callback); + LiteGraph.pointerListenerRemove(canvas2, "move", this._binded_mouse_callback); LiteGraph.pointerListenerAdd(document, "move", this._binded_mouse_callback); LiteGraph.pointerListenerAdd(document, "up", this._binded_mouse_callback); } else if (e2.type == LiteGraph.pointerevents_method + "move") { @@ -58464,7 +59593,7 @@ class DragAndScale { this.dragging = false; LiteGraph.pointerListenerRemove(document, "move", this._binded_mouse_callback); LiteGraph.pointerListenerRemove(document, "up", this._binded_mouse_callback); - LiteGraph.pointerListenerAdd(canvas, "move", this._binded_mouse_callback); + LiteGraph.pointerListenerAdd(canvas2, "move", this._binded_mouse_callback); } else if (is_inside && (e2.type == "mousewheel" || e2.type == "wheel" || e2.type == "DOMMouseScroll")) { e2.eventType = "mousewheel"; if (e2.type == "wheel") e2.wheel = -e2.deltaY; @@ -58484,16 +59613,16 @@ class DragAndScale { ctx.scale(this.scale, this.scale); ctx.translate(this.offset[0], this.offset[1]); } - convertOffsetToCanvas(pos2) { + convertOffsetToCanvas(pos) { return [ - (pos2[0] + this.offset[0]) * this.scale, - (pos2[1] + this.offset[1]) * this.scale + (pos[0] + this.offset[0]) * this.scale, + (pos[1] + this.offset[1]) * this.scale ]; } - convertCanvasToOffset(pos2, out) { + convertCanvasToOffset(pos, out) { out = out || [0, 0]; - out[0] = pos2[0] / this.scale - this.offset[0]; - out[1] = pos2[1] / this.scale - this.offset[1]; + out[0] = pos[0] / this.scale - this.offset[0]; + out[1] = pos[1] / this.scale - this.offset[1]; return out; } /** @deprecated Has not been kept up to date */ @@ -58512,13 +59641,15 @@ class DragAndScale { if (!this.element) return; const rect = this.element.getBoundingClientRect(); if (!rect) return; - zooming_center = zooming_center || [rect.width * 0.5, rect.height * 0.5]; - zooming_center[0] -= rect.x; - zooming_center[1] -= rect.y; - const center = this.convertCanvasToOffset(zooming_center); + zooming_center = zooming_center ?? [rect.width * 0.5, rect.height * 0.5]; + const normalizedCenter = [ + zooming_center[0] - rect.x, + zooming_center[1] - rect.y + ]; + const center = this.convertCanvasToOffset(normalizedCenter); this.scale = value4; if (Math.abs(this.scale - 1) < 0.01) this.scale = 1; - const new_center = this.convertCanvasToOffset(zooming_center); + const new_center = this.convertCanvasToOffset(normalizedCenter); const delta_offset = [ new_center[0] - center[0], new_center[1] - center[1] @@ -58914,6 +60045,9 @@ class LGraphCanvas { this.#updateCursorStyle(); } // #endregion Legacy accessors + /** + * @deprecated Use {@link LGraphNode.titleFontStyle} instead. + */ get title_text_font() { return `${LiteGraph.NODE_TEXT_SIZE}px Arial`; } @@ -58928,6 +60062,24 @@ class LGraphCanvas { set maximumFps(value4) { this.#maximumFrameGap = value4 > Number.EPSILON ? 1e3 / value4 : 0; } + /** + * @deprecated Use {@link LiteGraphGlobal.ROUND_RADIUS} instead. + */ + get round_radius() { + return LiteGraph.ROUND_RADIUS; + } + /** + * @deprecated Use {@link LiteGraphGlobal.ROUND_RADIUS} instead. + */ + set round_radius(value4) { + LiteGraph.ROUND_RADIUS = value4; + } + /** + * Render low quality when zoomed out. + */ + get low_quality() { + return this.ds.scale < this.low_quality_zoom_threshold; + } options; background_image; ds; @@ -58967,13 +60119,14 @@ class LGraphCanvas { render_connection_arrows; render_collapsed_slots; render_execution_order; - render_title_colored; render_link_tooltip; /** Controls whether reroutes are rendered at all. */ reroutesEnabled = false; /** Shape of the markers shown at the midpoint of links. Default: Circle */ linkMarkerShape = LinkMarkerShape.Circle; links_render_mode; + /** Zoom threshold for low quality rendering. Zoom below this threshold will render low quality. */ + low_quality_zoom_threshold = 0.6; /** mouse in canvas coordinates, where 0,0 is the top-left corner of the blue rectangle */ mouse; /** mouse in graph coordinates, where 0,0 is the top-left corner of the blue rectangle */ @@ -58989,7 +60142,6 @@ class LGraphCanvas { /** to render foreground objects (above nodes and connections) in the canvas affected by transform */ onDrawForeground; connections_width; - round_radius; /** The current node being drawn by {@link drawNode}. This should NOT be used to determine the currently selected node. See {@link selectedItems} */ current_node; /** used for widgets */ @@ -59035,7 +60187,6 @@ class LGraphCanvas { last_mouse = [0, 0]; last_mouseclick = 0; graph; - _graph_stack = null; canvas; bgcanvas; ctx; @@ -59076,6 +60227,10 @@ class LGraphCanvas { #snapToGrid; /** Set on keydown, keyup. @todo */ #shiftDown = false; + /** If true, enable drag zoom. Ctrl+Shift+Drag Up/Down: zoom canvas. */ + dragZoomEnabled = false; + /** The start position of the drag zoom. */ + #dragZoomStart = null; static active_node; onClear; /** called after moving a node @deprecated Does not handle multi-node move, and can return the wrong node. */ @@ -59100,9 +60255,9 @@ class LGraphCanvas { * @param graph The graph that owns this canvas. * @param options */ - constructor(canvas, graph, options4) { - options4 ||= {}; - this.options = options4; + constructor(canvas2, graph, options22) { + options22 ||= {}; + this.options = options22; this.background_image = LGraphCanvas.DEFAULT_BACKGROUND_IMAGE; this.ds = new DragAndScale(); this.pointer = new CanvasPointer(this.canvas); @@ -59156,7 +60311,6 @@ class LGraphCanvas { this.render_connection_arrows = false; this.render_collapsed_slots = true; this.render_execution_order = false; - this.render_title_colored = true; this.render_link_tooltip = true; this.links_render_mode = LinkRenderType.SPLINE_LINK; this.mouse = [0, 0]; @@ -59171,11 +60325,9 @@ class LGraphCanvas { this.onDrawLinkTooltip = null; this.onNodeMoved = null; this.onSelectionChange = null; - this.onConnectingChange = null; this.onBeforeChange = null; this.onAfterChange = null; this.connections_width = 3; - this.round_radius = 8; this.current_node = null; this.node_widget = null; this.over_link_center = null; @@ -59183,14 +60335,14 @@ class LGraphCanvas { this.visible_area = this.ds.visible_area; this.visible_links = []; this.connecting_links = null; - this.viewport = options4.viewport || null; + this.viewport = options22.viewport || null; graph?.attachCanvas(this); - this.setCanvas(canvas, options4.skip_events); + this.setCanvas(canvas2, options22.skip_events); this.clear(); - if (!options4.skip_render) { + if (!options22.skip_render) { this.startRendering(); } - this.autoresize = options4.autoresize; + this.autoresize = options22.autoresize; } static getFileExtension(url) { const question = url.indexOf("?"); @@ -59199,10 +60351,10 @@ class LGraphCanvas { return point === -1 ? "" : url.substring(point + 1).toLowerCase(); } static onGroupAdd(info, entry, mouse_event) { - const canvas = LGraphCanvas.active_canvas; + const canvas2 = LGraphCanvas.active_canvas; const group = new LiteGraph.LGraphGroup(); - group.pos = canvas.convertEventToCanvasOffset(mouse_event); - canvas.graph.add(group); + group.pos = canvas2.convertEventToCanvasOffset(mouse_event); + canvas2.graph.add(group); } /** * @deprecated Functionality moved to {@link getBoundaryNodes}. The new function returns null on failure, instead of an object with all null properties. @@ -59229,7 +60381,7 @@ class LGraphCanvas { alignNodes(Object.values(nodes), direction, align_to); LGraphCanvas.active_canvas.setDirty(true, true); } - static onNodeAlign(value4, options4, event, prev_menu, node22) { + static onNodeAlign(value4, options22, event, prev_menu, node22) { new LiteGraph.ContextMenu(["Top", "Bottom", "Left", "Right"], { event, callback: inner_clicked, @@ -59245,7 +60397,7 @@ class LGraphCanvas { } __name(inner_clicked, "inner_clicked"); } - static onGroupAlign(value4, options4, event, prev_menu) { + static onGroupAlign(value4, options22, event, prev_menu) { new LiteGraph.ContextMenu(["Top", "Bottom", "Left", "Right"], { event, callback: inner_clicked, @@ -59260,26 +60412,26 @@ class LGraphCanvas { } __name(inner_clicked, "inner_clicked"); } - static createDistributeMenu(value4, options4, event, prev_menu, node22) { + static createDistributeMenu(value4, options22, event, prev_menu, node22) { new LiteGraph.ContextMenu(["Vertically", "Horizontally"], { event, callback: inner_clicked, parentMenu: prev_menu }); function inner_clicked(value22) { - const canvas = LGraphCanvas.active_canvas; - distributeNodes(Object.values(canvas.selected_nodes), value22 === "Horizontally"); - canvas.setDirty(true, true); + const canvas2 = LGraphCanvas.active_canvas; + distributeNodes(Object.values(canvas2.selected_nodes), value22 === "Horizontally"); + canvas2.setDirty(true, true); } __name(inner_clicked, "inner_clicked"); } - static onMenuAdd(node22, options4, e2, prev_menu, callback) { - const canvas = LGraphCanvas.active_canvas; - const ref_window = canvas.getCanvasWindow(); - const graph = canvas.graph; + static onMenuAdd(node22, options22, e2, prev_menu, callback) { + const canvas2 = LGraphCanvas.active_canvas; + const ref_window = canvas2.getCanvasWindow(); + const graph = canvas2.graph; if (!graph) return; function inner_onMenuAdded(base_category, prev_menu2) { - const categories = LiteGraph.getNodeTypesCategories(canvas.filter || graph.filter).filter(function(category) { + const categories = LiteGraph.getNodeTypesCategories(canvas2.filter || graph.filter).filter(function(category) { return category.startsWith(base_category); }); const entries = []; @@ -59299,32 +60451,32 @@ class LGraphCanvas { value: category_path, content: name2, has_submenu: true, - callback: /* @__PURE__ */ __name(function(value4, event, mouseEvent, contextMenu) { - inner_onMenuAdded(value4.value, contextMenu); + callback: /* @__PURE__ */ __name(function(value4, event, mouseEvent, contextMenu2) { + inner_onMenuAdded(value4.value, contextMenu2); }, "callback") }); } }); const nodes = LiteGraph.getNodeTypesInCategory( base_category.slice(0, -1), - canvas.filter || graph.filter + canvas2.filter || graph.filter ); - nodes.map(function(node3) { - if (node3.skip_list) return; + nodes.map(function(node222) { + if (node222.skip_list) return; const entry = { - value: node3.type, - content: node3.title, + value: node222.type, + content: node222.title, has_submenu: false, - callback: /* @__PURE__ */ __name(function(value4, event, mouseEvent, contextMenu) { - const first_event = contextMenu.getFirstEvent(); - canvas.graph.beforeChange(); - const node4 = LiteGraph.createNode(value4.value); - if (node4) { - node4.pos = canvas.convertEventToCanvasOffset(first_event); - canvas.graph.add(node4); + callback: /* @__PURE__ */ __name(function(value4, event, mouseEvent, contextMenu2) { + const first_event = contextMenu2.getFirstEvent(); + canvas2.graph.beforeChange(); + const node3 = LiteGraph.createNode(value4.value); + if (node3) { + node3.pos = canvas2.convertEventToCanvasOffset(first_event); + canvas2.graph.add(node3); } - callback?.(node4); - canvas.graph.afterChange(); + callback?.(node3); + canvas2.graph.afterChange(); }, "callback") }; entries.push(entry); @@ -59340,16 +60492,16 @@ class LGraphCanvas { static onMenuNodeEdit() { } /** @param options Parameter is never used */ - static showMenuNodeOptionalInputs(v2, options4, e2, prev_menu, node22) { + static showMenuNodeOptionalInputs(v2, options22, e2, prev_menu, node22) { if (!node22) return; const that = this; - const canvas = LGraphCanvas.active_canvas; - const ref_window = canvas.getCanvasWindow(); - options4 = node22.onGetInputs ? node22.onGetInputs() : node22.optional_inputs; + const canvas2 = LGraphCanvas.active_canvas; + const ref_window = canvas2.getCanvasWindow(); + options22 = node22.onGetInputs ? node22.onGetInputs() : node22.optional_inputs; let entries = []; - if (options4) { - for (let i2 = 0; i2 < options4.length; i2++) { - const entry = options4[i2]; + if (options22) { + for (let i2 = 0; i2 < options22.length; i2++) { + const entry = options22[i2]; if (!entry) { entries.push(null); continue; @@ -59384,30 +60536,30 @@ class LGraphCanvas { // @ts-expect-error Unused param ref_window ); - function inner_clicked(v3, e3, prev2) { + function inner_clicked(v22, e22, prev2) { if (!node22) return; - v3.callback?.call(that, node22, v3, e3, prev2); - if (!v3.value) return; + v22.callback?.call(that, node22, v22, e22, prev2); + if (!v22.value) return; node22.graph.beforeChange(); - node22.addInput(v3.value[0], v3.value[1], v3.value[2]); - node22.onNodeInputAdd?.(v3.value); - canvas.setDirty(true, true); + node22.addInput(v22.value[0], v22.value[1], v22.value[2]); + node22.onNodeInputAdd?.(v22.value); + canvas2.setDirty(true, true); node22.graph.afterChange(); } __name(inner_clicked, "inner_clicked"); return false; } /** @param options Parameter is never used */ - static showMenuNodeOptionalOutputs(v2, options4, e2, prev_menu, node22) { + static showMenuNodeOptionalOutputs(v2, options22, e2, prev_menu, node22) { if (!node22) return; const that = this; - const canvas = LGraphCanvas.active_canvas; - const ref_window = canvas.getCanvasWindow(); - options4 = node22.onGetOutputs ? node22.onGetOutputs() : node22.optional_outputs; + const canvas2 = LGraphCanvas.active_canvas; + const ref_window = canvas2.getCanvasWindow(); + options22 = node22.onGetOutputs ? node22.onGetOutputs() : node22.optional_outputs; let entries = []; - if (options4) { - for (let i2 = 0; i2 < options4.length; i2++) { - const entry = options4[i2]; + if (options22) { + for (let i2 = 0; i2 < options22.length; i2++) { + const entry = options22[i2]; if (!entry) { entries.push(null); continue; @@ -59448,18 +60600,18 @@ class LGraphCanvas { // @ts-expect-error Unused ref_window ); - function inner_clicked(v3, e3, prev2) { + function inner_clicked(v22, e22, prev2) { if (!node22) return; - if (v3.callback) v3.callback.call(that, node22, v3, e3, prev2); - if (!v3.value) return; - const value4 = v3.value[1]; + if (v22.callback) v22.callback.call(that, node22, v22, e22, prev2); + if (!v22.value) return; + const value4 = v22.value[1]; if (value4 && (typeof value4 === "object" || Array.isArray(value4))) { const entries2 = []; for (const i2 in value4) { entries2.push({ content: i2, value: value4[i2] }); } new LiteGraph.ContextMenu(entries2, { - event: e3, + event: e22, callback: inner_clicked, parentMenu: prev_menu, node: node22 @@ -59468,19 +60620,19 @@ class LGraphCanvas { } const graph = node22.graph; graph.beforeChange(); - node22.addOutput(v3.value[0], v3.value[1], v3.value[2]); - node22.onNodeOutputAdd?.(v3.value); - canvas.setDirty(true, true); + node22.addOutput(v22.value[0], v22.value[1], v22.value[2]); + node22.onNodeOutputAdd?.(v22.value); + canvas2.setDirty(true, true); graph.afterChange(); } __name(inner_clicked, "inner_clicked"); return false; } /** @param value Parameter is never used */ - static onShowMenuNodeProperties(value4, options4, e2, prev_menu, node22) { + static onShowMenuNodeProperties(value4, options22, e2, prev_menu, node22) { if (!node22 || !node22.properties) return; - const canvas = LGraphCanvas.active_canvas; - const ref_window = canvas.getCanvasWindow(); + const canvas2 = LGraphCanvas.active_canvas; + const ref_window = canvas2.getCanvasWindow(); const entries = []; for (const i2 in node22.properties) { value4 = node22.properties[i2] !== void 0 ? node22.properties[i2] : " "; @@ -59513,7 +60665,7 @@ class LGraphCanvas { function inner_clicked(v2) { if (!node22) return; const rect = this.getBoundingClientRect(); - canvas.showEditPropertyValue(node22, v2.value, { + canvas2.showEditPropertyValue(node22, v2.value, { position: [rect.left, rect.top] }); } @@ -59525,24 +60677,24 @@ class LGraphCanvas { e2.innerText = str; return e2.innerHTML; } - static onMenuResizeNode(value4, options4, e2, menu2, node22) { + static onMenuResizeNode(value4, options22, e2, menu2, node22) { if (!node22) return; - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { - node3.size = node3.computeSize(); - node3.onResize?.(node3.size); + const fApplyMultiNode = /* @__PURE__ */ __name(function(node222) { + node222.size = node222.computeSize(); + node222.onResize?.(node222.size); }, "fApplyMultiNode"); - const canvas = LGraphCanvas.active_canvas; - if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { + const canvas2 = LGraphCanvas.active_canvas; + if (!canvas2.selected_nodes || Object.keys(canvas2.selected_nodes).length <= 1) { fApplyMultiNode(node22); } else { - for (const i2 in canvas.selected_nodes) { - fApplyMultiNode(canvas.selected_nodes[i2]); + for (const i2 in canvas2.selected_nodes) { + fApplyMultiNode(canvas2.selected_nodes[i2]); } } - canvas.setDirty(true, true); + canvas2.setDirty(true, true); } // TODO refactor :: this is used fot title but not for properties! - static onShowPropertyEditor(item3, options4, e2, menu2, node22) { + static onShowPropertyEditor(item3, options22, e2, menu2, node22) { const property = item3.property || "title"; const value4 = node22[property]; const dialog = document.createElement("div"); @@ -59560,21 +60712,21 @@ class LGraphCanvas { input.addEventListener("blur", function() { this.focus(); }); - input.addEventListener("keydown", function(e3) { + input.addEventListener("keydown", function(e22) { dialog.is_modified = true; - if (e3.keyCode == 27) { + if (e22.keyCode == 27) { dialog.close(); - } else if (e3.keyCode == 13) { + } else if (e22.keyCode == 13) { inner(); - } else if (e3.keyCode != 13 && e3.target.localName != "textarea") { + } else if (e22.keyCode != 13 && e22.target.localName != "textarea") { return; } - e3.preventDefault(); - e3.stopPropagation(); + e22.preventDefault(); + e22.stopPropagation(); }); } - const canvas = LGraphCanvas.active_canvas; - const canvasEl = canvas.canvas; + const canvas2 = LGraphCanvas.active_canvas; + const canvasEl = canvas2.canvas; const rect = canvasEl.getBoundingClientRect(); let offsetx = -20; let offsety = -20; @@ -59620,7 +60772,7 @@ class LGraphCanvas { } node22[property] = value22; dialog.parentNode?.removeChild(dialog); - canvas.setDirty(true, true); + canvas2.setDirty(true, true); } __name(setValue2, "setValue"); } @@ -59639,12 +60791,12 @@ class LGraphCanvas { return String(value4) + " (" + desc_value + ")"; } } - static onMenuNodeCollapse(value4, options4, e2, menu2, node22) { + static onMenuNodeCollapse(value4, options22, e2, menu2, node22) { node22.graph.beforeChange( /* ? */ ); - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { - node3.collapse(); + const fApplyMultiNode = /* @__PURE__ */ __name(function(node222) { + node222.collapse(); }, "fApplyMultiNode"); const graphcanvas = LGraphCanvas.active_canvas; if (!graphcanvas.selected_nodes || Object.keys(graphcanvas.selected_nodes).length <= 1) { @@ -59658,12 +60810,12 @@ class LGraphCanvas { /* ? */ ); } - static onMenuToggleAdvanced(value4, options4, e2, menu2, node22) { + static onMenuToggleAdvanced(value4, options22, e2, menu2, node22) { node22.graph.beforeChange( /* ? */ ); - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { - node3.toggleAdvanced(); + const fApplyMultiNode = /* @__PURE__ */ __name(function(node222) { + node222.toggleAdvanced(); }, "fApplyMultiNode"); const graphcanvas = LGraphCanvas.active_canvas; if (!graphcanvas.selected_nodes || Object.keys(graphcanvas.selected_nodes).length <= 1) { @@ -59677,9 +60829,9 @@ class LGraphCanvas { /* ? */ ); } - static onMenuNodePin(value4, options4, e2, menu2, node22) { + static onMenuNodePin(value4, options22, e2, menu2, node22) { } - static onMenuNodeMode(value4, options4, e2, menu2, node22) { + static onMenuNodeMode(value4, options22, e2, menu2, node22) { new LiteGraph.ContextMenu( LiteGraph.NODE_MODES, { event: e2, callback: inner_clicked, parentMenu: menu2, node: node22 } @@ -59687,12 +60839,12 @@ class LGraphCanvas { function inner_clicked(v2) { if (!node22) return; const kV = Object.values(LiteGraph.NODE_MODES).indexOf(v2); - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { + const fApplyMultiNode = /* @__PURE__ */ __name(function(node222) { if (kV >= 0 && LiteGraph.NODE_MODES[kV]) - node3.changeMode(kV); + node222.changeMode(kV); else { console.warn("unexpected mode: " + v2); - node3.changeMode(LGraphEventMode.ALWAYS); + node222.changeMode(LGraphEventMode.ALWAYS); } }, "fApplyMultiNode"); const graphcanvas = LGraphCanvas.active_canvas; @@ -59708,7 +60860,7 @@ class LGraphCanvas { return false; } /** @param value Parameter is never used */ - static onMenuNodeColors(value4, options4, e2, menu2, node22) { + static onMenuNodeColors(value4, options22, e2, menu2, node22) { if (!node22) throw "no node for color"; const values = []; values.push({ @@ -59732,33 +60884,33 @@ class LGraphCanvas { function inner_clicked(v2) { if (!node22) return; const color2 = v2.value ? LGraphCanvas.node_colors[v2.value] : null; - const fApplyColor = /* @__PURE__ */ __name(function(node3) { + const fApplyColor = /* @__PURE__ */ __name(function(node222) { if (color2) { - if (node3 instanceof LGraphGroup) { - node3.color = color2.groupcolor; + if (node222 instanceof LGraphGroup) { + node222.color = color2.groupcolor; } else { - node3.color = color2.color; - node3.bgcolor = color2.bgcolor; + node222.color = color2.color; + node222.bgcolor = color2.bgcolor; } } else { - delete node3.color; - delete node3.bgcolor; + delete node222.color; + delete node222.bgcolor; } }, "fApplyColor"); - const canvas = LGraphCanvas.active_canvas; - if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { + const canvas2 = LGraphCanvas.active_canvas; + if (!canvas2.selected_nodes || Object.keys(canvas2.selected_nodes).length <= 1) { fApplyColor(node22); } else { - for (const i2 in canvas.selected_nodes) { - fApplyColor(canvas.selected_nodes[i2]); + for (const i2 in canvas2.selected_nodes) { + fApplyColor(canvas2.selected_nodes[i2]); } } - canvas.setDirty(true, true); + canvas2.setDirty(true, true); } __name(inner_clicked, "inner_clicked"); return false; } - static onMenuNodeShapes(value4, options4, e2, menu2, node22) { + static onMenuNodeShapes(value4, options22, e2, menu2, node22) { if (!node22) throw "no node passed"; new LiteGraph.ContextMenu(LiteGraph.VALID_SHAPES, { event: e2, @@ -59771,82 +60923,69 @@ class LGraphCanvas { node22.graph.beforeChange( /* ? */ ); - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { - node3.shape = v2; + const fApplyMultiNode = /* @__PURE__ */ __name(function(node222) { + node222.shape = v2; }, "fApplyMultiNode"); - const canvas = LGraphCanvas.active_canvas; - if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { + const canvas2 = LGraphCanvas.active_canvas; + if (!canvas2.selected_nodes || Object.keys(canvas2.selected_nodes).length <= 1) { fApplyMultiNode(node22); } else { - for (const i2 in canvas.selected_nodes) { - fApplyMultiNode(canvas.selected_nodes[i2]); + for (const i2 in canvas2.selected_nodes) { + fApplyMultiNode(canvas2.selected_nodes[i2]); } } node22.graph.afterChange( /* ? */ ); - canvas.setDirty(true); + canvas2.setDirty(true); } __name(inner_clicked, "inner_clicked"); return false; } - static onMenuNodeRemove(value4, options4, e2, menu2, node22) { + static onMenuNodeRemove(value4, options22, e2, menu2, node22) { if (!node22) throw "no node passed"; const graph = node22.graph; graph.beforeChange(); - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3) { - if (node3.removable === false) return; - graph.remove(node3); + const fApplyMultiNode = /* @__PURE__ */ __name(function(node222) { + if (node222.removable === false) return; + graph.remove(node222); }, "fApplyMultiNode"); - const canvas = LGraphCanvas.active_canvas; - if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { + const canvas2 = LGraphCanvas.active_canvas; + if (!canvas2.selected_nodes || Object.keys(canvas2.selected_nodes).length <= 1) { fApplyMultiNode(node22); } else { - for (const i2 in canvas.selected_nodes) { - fApplyMultiNode(canvas.selected_nodes[i2]); + for (const i2 in canvas2.selected_nodes) { + fApplyMultiNode(canvas2.selected_nodes[i2]); } } graph.afterChange(); - canvas.setDirty(true, true); + canvas2.setDirty(true, true); } - static onMenuNodeToSubgraph(value4, options4, e2, menu2, node22) { - const graph = node22.graph; - const canvas = LGraphCanvas.active_canvas; - if (!canvas) return; - let nodes_list = Object.values(canvas.selected_nodes || {}); - if (!nodes_list.length) nodes_list = [node22]; - const subgraph_node = LiteGraph.createNode("graph/subgraph"); - subgraph_node.pos = node22.pos.concat(); - graph.add(subgraph_node); - subgraph_node.buildFromNodes(nodes_list); - canvas.deselectAll(); - canvas.setDirty(true, true); - } - static onMenuNodeClone(value4, options4, e2, menu2, node22) { + static onMenuNodeClone(value4, options22, e2, menu2, node22) { const graph = node22.graph; graph.beforeChange(); const newSelected = /* @__PURE__ */ new Set(); - const fApplyMultiNode = /* @__PURE__ */ __name(function(node3, newNodes) { - if (node3.clonable === false) return; - const newnode = node3.clone(); + const fApplyMultiNode = /* @__PURE__ */ __name(function(node222, newNodes) { + if (node222.clonable === false) return; + const newnode = node222.clone(); if (!newnode) return; - newnode.pos = [node3.pos[0] + 5, node3.pos[1] + 5]; - node3.graph.add(newnode); + newnode.pos = [node222.pos[0] + 5, node222.pos[1] + 5]; + node222.graph.add(newnode); newNodes.add(newnode); }, "fApplyMultiNode"); - const canvas = LGraphCanvas.active_canvas; - if (!canvas.selected_nodes || Object.keys(canvas.selected_nodes).length <= 1) { + const canvas2 = LGraphCanvas.active_canvas; + if (!canvas2.selected_nodes || Object.keys(canvas2.selected_nodes).length <= 1) { fApplyMultiNode(node22, newSelected); } else { - for (const i2 in canvas.selected_nodes) { - fApplyMultiNode(canvas.selected_nodes[i2], newSelected); + for (const i2 in canvas2.selected_nodes) { + fApplyMultiNode(canvas2.selected_nodes[i2], newSelected); } } if (newSelected.size) { - canvas.selectNodes([...newSelected]); + canvas2.selectNodes([...newSelected]); } graph.afterChange(); - canvas.setDirty(true, true); + canvas2.setDirty(true, true); } /** * clears all the data inside @@ -59888,15 +61027,8 @@ class LGraphCanvas { return; } graph.attachCanvas(this); - this._graph_stack &&= null; this.setDirty(true, true); } - /** - * @returns the top level graph (in case there are subgraphs open on the canvas) - */ - getTopGraph() { - return this._graph_stack.length ? this._graph_stack[0] : this.graph; - } /** * @returns the visually active graph (in case there are more in the stack) */ @@ -59909,13 +61041,13 @@ class LGraphCanvas { * @returns The canvas element * @throws If {@link canvas} is an element ID that does not belong to a valid HTML canvas element */ - #validateCanvas(canvas) { - if (typeof canvas === "string") { - const el = document.getElementById(canvas); + #validateCanvas(canvas2) { + if (typeof canvas2 === "string") { + const el = document.getElementById(canvas2); if (!(el instanceof HTMLCanvasElement)) throw "Error validating LiteGraph canvas: Canvas element not found"; return el; } - return canvas; + return canvas2; } /** * Sets the current HTML canvas element. @@ -59923,8 +61055,8 @@ class LGraphCanvas { * @param canvas The canvas element to assign, or its HTML element ID. If null or undefined, the current reference is cleared. * @param skip_events If true, events on the previous canvas will not be removed. Has no effect on the first invocation. */ - setCanvas(canvas, skip_events) { - const element = this.#validateCanvas(canvas); + setCanvas(canvas2, skip_events) { + const element = this.#validateCanvas(canvas2); if (element === this.canvas) return; if (!element && this.canvas && !skip_events) this.unbindEvents(); this.canvas = element; @@ -59973,7 +61105,7 @@ class LGraphCanvas { console.warn("LGraphCanvas: events already binded"); return; } - const canvas = this.canvas; + const canvas2 = this.canvas; const ref_window = this.getCanvasWindow(); const document2 = ref_window.document; this._mousedown_callback = this.processMouseDown.bind(this); @@ -59982,26 +61114,26 @@ class LGraphCanvas { this._mouseup_callback = this.processMouseUp.bind(this); this._mouseout_callback = this.processMouseOut.bind(this); this._mousecancel_callback = this.processMouseCancel.bind(this); - LiteGraph.pointerListenerAdd(canvas, "down", this._mousedown_callback, true); - canvas.addEventListener("mousewheel", this._mousewheel_callback, false); - LiteGraph.pointerListenerAdd(canvas, "up", this._mouseup_callback, true); - LiteGraph.pointerListenerAdd(canvas, "move", this._mousemove_callback); - canvas.addEventListener("pointerout", this._mouseout_callback); - canvas.addEventListener("pointercancel", this._mousecancel_callback, true); - canvas.addEventListener("contextmenu", this._doNothing); - canvas.addEventListener( + LiteGraph.pointerListenerAdd(canvas2, "down", this._mousedown_callback, true); + canvas2.addEventListener("mousewheel", this._mousewheel_callback, false); + LiteGraph.pointerListenerAdd(canvas2, "up", this._mouseup_callback, true); + LiteGraph.pointerListenerAdd(canvas2, "move", this._mousemove_callback); + canvas2.addEventListener("pointerout", this._mouseout_callback); + canvas2.addEventListener("pointercancel", this._mousecancel_callback, true); + canvas2.addEventListener("contextmenu", this._doNothing); + canvas2.addEventListener( "DOMMouseScroll", this._mousewheel_callback, false ); this._key_callback = this.processKey.bind(this); - canvas.addEventListener("keydown", this._key_callback, true); + canvas2.addEventListener("keydown", this._key_callback, true); document2.addEventListener("keyup", this._key_callback, true); this._ondrop_callback = this.processDrop.bind(this); - canvas.addEventListener("dragover", this._doNothing, false); - canvas.addEventListener("dragend", this._doNothing, false); - canvas.addEventListener("drop", this._ondrop_callback, false); - canvas.addEventListener("dragenter", this._doReturnTrue, false); + canvas2.addEventListener("dragover", this._doNothing, false); + canvas2.addEventListener("dragend", this._doNothing, false); + canvas2.addEventListener("drop", this._ondrop_callback, false); + canvas2.addEventListener("dragenter", this._doReturnTrue, false); this._events_binded = true; } /** @@ -60128,17 +61260,17 @@ class LGraphCanvas { const graphPos = this.graph_mouse; const x2 = graphPos[0] - node22.pos[0]; const y2 = graphPos[1] - node22.pos[1]; - for (const widget2 of node22.widgets) { - if (widget2.hidden || widget2.advanced && !node22.showAdvanced) continue; + for (const widget of node22.widgets) { + if (widget.hidden || widget.advanced && !node22.showAdvanced) continue; let widgetWidth, widgetHeight; - if (widget2.computeSize) { - [widgetWidth, widgetHeight] = widget2.computeSize(node22.size[0]); + if (widget.computeSize) { + [widgetWidth, widgetHeight] = widget.computeSize(node22.size[0]); } else { - widgetWidth = widget2.width || node22.size[0]; + widgetWidth = widget.width || node22.size[0]; widgetHeight = LiteGraph.NODE_WIDGET_HEIGHT; } - if (widget2.last_y !== void 0 && x2 >= 6 && x2 <= widgetWidth - 12 && y2 >= widget2.last_y && y2 <= widget2.last_y + widgetHeight) { - return widget2; + if (widget.last_y !== void 0 && x2 >= 6 && x2 <= widgetWidth - 12 && y2 >= widget.last_y && y2 <= widget.last_y + widgetHeight) { + return widget; } } return null; @@ -60167,9 +61299,13 @@ class LGraphCanvas { } } processMouseDown(e2) { - const { graph, pointer: pointer2 } = this; + if (this.dragZoomEnabled && e2.ctrlKey && e2.shiftKey && !e2.altKey && e2.buttons) { + this.#dragZoomStart = { pos: [e2.x, e2.y], scale: this.ds.scale }; + return; + } + const { graph, pointer } = this; this.adjustMouseEvent(e2); - if (e2.isPrimary) pointer2.down(e2); + if (e2.isPrimary) pointer.down(e2); if (this.set_canvas_dirty_on_mouse_event) this.dirty_canvas = true; if (!graph) return; const ref_window = this.getCanvasWindow(); @@ -60185,16 +61321,16 @@ class LGraphCanvas { this.graph_mouse[0] = e2.canvasX; this.graph_mouse[1] = e2.canvasY; this.last_click_position = [this.mouse[0], this.mouse[1]]; - pointer2.isDouble = pointer2.isDown && e2.isPrimary; - pointer2.isDown = true; + pointer.isDouble = pointer.isDown && e2.isPrimary; + pointer.isDown = true; this.canvas.focus(); LiteGraph.closeAllContextMenus(ref_window); if (this.onMouse?.(e2) == true) return; - if (e2.button === 0 && !pointer2.isDouble) { + if (e2.button === 0 && !pointer.isDouble) { this.#processPrimaryButton(e2, node22); } else if (e2.button === 1) { this.#processMiddleButton(e2, node22); - } else if ((e2.button === 2 || pointer2.isDouble) && this.allow_interaction && !this.read_only) { + } else if ((e2.button === 2 || pointer.isDouble) && this.allow_interaction && !this.read_only) { if (node22) this.processSelect(node22, e2, true); this.processContextMenu(node22, e2); } @@ -60209,7 +61345,7 @@ class LGraphCanvas { this.onMouseDown?.(e2); } #processPrimaryButton(e2, node22) { - const { pointer: pointer2, graph } = this; + const { pointer, graph } = this; const x2 = e2.canvasX; const y2 = e2.canvasY; const ctrlOrMeta = e2.ctrlKey || e2.metaKey; @@ -60219,17 +61355,17 @@ class LGraphCanvas { dragRect[1] = y2; dragRect[2] = 1; dragRect[3] = 1; - pointer2.onClick = (eUp) => { + pointer.onClick = (eUp) => { const clickedItem = node22 ?? (this.reroutesEnabled ? graph.getRerouteOnPos(eUp.canvasX, eUp.canvasY) : null) ?? graph.getGroupTitlebarOnPos(eUp.canvasX, eUp.canvasY); this.processSelect(clickedItem, eUp); }; - pointer2.onDragStart = () => this.dragging_rectangle = dragRect; - pointer2.onDragEnd = (upEvent2) => this.#handleMultiSelect(upEvent2, dragRect); - pointer2.finally = () => this.dragging_rectangle = null; + pointer.onDragStart = () => this.dragging_rectangle = dragRect; + pointer.onDragEnd = (upEvent) => this.#handleMultiSelect(upEvent, dragRect); + pointer.finally = () => this.dragging_rectangle = null; return; } if (this.read_only) { - pointer2.finally = () => this.dragging_canvas = false; + pointer.finally = () => this.dragging_canvas = false; this.dragging_canvas = true; return; } @@ -60241,11 +61377,11 @@ class LGraphCanvas { cloned.pos[0] += 5; cloned.pos[1] += 5; if (this.allow_dragnodes) { - pointer2.onDragStart = (pointer3) => { + pointer.onDragStart = (pointer2) => { graph.add(cloned, false); - this.#startDraggingItems(cloned, pointer3); + this.#startDraggingItems(cloned, pointer2); }; - pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); + pointer.onDragEnd = (e22) => this.#processDraggedItems(e22); } else { graph.beforeChange(); graph.add(cloned, false); @@ -60272,13 +61408,13 @@ class LGraphCanvas { afterRerouteId: reroute.id }; this.connecting_links = [connecting]; - pointer2.onDragStart = () => connecting.output = outputNode.outputs[slot]; + pointer.onDragStart = () => connecting.output = outputNode.outputs[slot]; this.dirty_bgcanvas = true; } - pointer2.onClick = () => this.processSelect(reroute, e2); - if (!pointer2.onDragStart) { - pointer2.onDragStart = (pointer3) => this.#startDraggingItems(reroute, pointer3, true); - pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); + pointer.onClick = () => this.processSelect(reroute, e2); + if (!pointer.onDragStart) { + pointer.onDragStart = (pointer2) => this.#startDraggingItems(reroute, pointer2, true); + pointer.onDragEnd = (e22) => this.#processDraggedItems(e22); } return; } @@ -60301,19 +61437,19 @@ class LGraphCanvas { }; this.connecting_links = [connecting]; if (linkSegment.parentId) connecting.afterRerouteId = linkSegment.parentId; - pointer2.onDragStart = () => connecting.output = originNode.outputs[slot]; + pointer.onDragStart = () => connecting.output = originNode.outputs[slot]; return; } else if (this.reroutesEnabled && e2.altKey && !e2.shiftKey) { const newReroute = graph.createReroute([x2, y2], linkSegment); - pointer2.onDragStart = (pointer3) => this.#startDraggingItems(newReroute, pointer3); - pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); + pointer.onDragStart = (pointer2) => this.#startDraggingItems(newReroute, pointer2); + pointer.onDragEnd = (e22) => this.#processDraggedItems(e22); return; } } else if (isInRectangle(x2, y2, centre[0] - 4, centre[1] - 4, 8, 8)) { this.ctx.lineWidth = lineWidth; - pointer2.onClick = () => this.showLinkMenu(linkSegment, e2); - pointer2.onDragStart = () => this.dragging_canvas = true; - pointer2.finally = () => this.dragging_canvas = false; + pointer.onClick = () => this.showLinkMenu(linkSegment, e2); + pointer.onDragStart = () => this.dragging_canvas = true; + pointer.finally = () => this.dragging_canvas = false; this.over_link_center = null; return; } @@ -60326,18 +61462,18 @@ class LGraphCanvas { const b2 = group.boundingRect; const offsetX = x2 - (b2[0] + b2[2]); const offsetY = y2 - (b2[1] + b2[3]); - pointer2.onDragStart = () => this.resizingGroup = group; - pointer2.onDrag = (eMove) => { + pointer.onDragStart = () => this.resizingGroup = group; + pointer.onDrag = (eMove) => { if (this.read_only) return; - const pos2 = [ + const pos = [ eMove.canvasX - group.pos[0] - offsetX, eMove.canvasY - group.pos[1] - offsetY ]; - snapPoint(pos2, this.#snapToGrid); - const resized = group.resize(pos2[0], pos2[1]); + snapPoint(pos, this.#snapToGrid); + const resized = group.resize(pos[0], pos[1]); if (resized) this.dirty_bgcanvas = true; }; - pointer2.finally = () => this.resizingGroup = null; + pointer.finally = () => this.resizingGroup = null; } else { const f2 = group.font_size || LiteGraph.DEFAULT_GROUP_FONT_SIZE; const headerHeight = f2 * 1.4; @@ -60349,15 +61485,15 @@ class LGraphCanvas { group.size[0], headerHeight )) { - pointer2.onClick = () => this.processSelect(group, e2); - pointer2.onDragStart = (pointer3) => { + pointer.onClick = () => this.processSelect(group, e2); + pointer.onDragStart = (pointer2) => { group.recomputeInsideNodes(); - this.#startDraggingItems(group, pointer3, true); + this.#startDraggingItems(group, pointer2, true); }; - pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); + pointer.onDragEnd = (e22) => this.#processDraggedItems(e22); } } - pointer2.onDoubleClick = () => { + pointer.onDoubleClick = () => { this.emitEvent({ subType: "group-double-click", originalEvent: e2, @@ -60365,7 +61501,7 @@ class LGraphCanvas { }); }; } else { - pointer2.onDoubleClick = () => { + pointer.onDoubleClick = () => { if (this.allow_searchbox) { this.showSearchBox(e2); e2.preventDefault(); @@ -60377,9 +61513,9 @@ class LGraphCanvas { }; } } - if (!pointer2.onDragStart && !pointer2.onClick && !pointer2.onDrag && this.allow_dragcanvas) { - pointer2.onClick = () => this.processSelect(null, e2); - pointer2.finally = () => this.dragging_canvas = false; + if (!pointer.onDragStart && !pointer.onClick && !pointer.onDrag && this.allow_dragcanvas) { + pointer.onClick = () => this.processSelect(null, e2); + pointer.finally = () => this.dragging_canvas = false; this.dragging_canvas = true; } } @@ -60390,16 +61526,16 @@ class LGraphCanvas { * @param node The node to process a click event for */ #processNodeClick(e2, ctrlOrMeta, node22) { - const { pointer: pointer2, graph } = this; + const { pointer, graph } = this; const x2 = e2.canvasX; const y2 = e2.canvasY; - pointer2.onClick = () => this.processSelect(node22, e2); + pointer.onClick = () => this.processSelect(node22, e2); if (!node22.flags.pinned) { this.bringToFront(node22); } const inCollapse = node22.isPointInCollapse(x2, y2); if (inCollapse) { - pointer2.onClick = () => { + pointer.onClick = () => { node22.collapse(); this.setDirty(true, true); }; @@ -60408,28 +61544,28 @@ class LGraphCanvas { const b2 = node22.boundingRect; const offsetX = x2 - (b2[0] + b2[2]); const offsetY = y2 - (b2[1] + b2[3]); - pointer2.onDragStart = () => { + pointer.onDragStart = () => { graph.beforeChange(); this.resizing_node = node22; }; - pointer2.onDrag = (eMove) => { + pointer.onDrag = (eMove) => { if (this.read_only) return; - const pos3 = [ + const pos2 = [ eMove.canvasX - node22.pos[0] - offsetX, eMove.canvasY - node22.pos[1] - offsetY ]; - snapPoint(pos3, this.#snapToGrid); + snapPoint(pos2, this.#snapToGrid); const min = node22.computeSize(); - pos3[0] = Math.max(min[0], pos3[0]); - pos3[1] = Math.max(min[1], pos3[1]); - node22.setSize(pos3); + pos2[0] = Math.max(min[0], pos2[0]); + pos2[1] = Math.max(min[1], pos2[1]); + node22.setSize(pos2); this.#dirty(); }; - pointer2.onDragEnd = (upEvent2) => { + pointer.onDragEnd = (upEvent) => { this.#dirty(); graph.afterChange(this.resizing_node); }; - pointer2.finally = () => this.resizing_node = null; + pointer.finally = () => this.resizing_node = null; this.canvas.style.cursor = "se-resize"; return; } @@ -60445,14 +61581,14 @@ class LGraphCanvas { const slot = link2.target_slot; const linked_node = graph._nodes_by_id[link2.target_id]; const input = linked_node.inputs[slot]; - const pos3 = linked_node.getConnectionPos(true, slot); + const pos2 = linked_node.getConnectionPos(true, slot); this.connecting_links.push({ node: linked_node, slot, input, output: null, - pos: pos3, - direction: node22.horizontal !== true ? LinkDirection.RIGHT : LinkDirection.CENTER + pos: pos2, + direction: LinkDirection.RIGHT }); } return; @@ -60476,8 +61612,8 @@ class LGraphCanvas { node22.disconnectOutput(i2); } } - pointer2.onDoubleClick = () => node22.onOutputDblClick?.(i2, e2); - pointer2.onClick = () => node22.onOutputClick?.(i2, e2); + pointer.onDoubleClick = () => node22.onOutputDblClick?.(i2, e2); + pointer.onClick = () => node22.onOutputClick?.(i2, e2); return; } } @@ -60487,8 +61623,8 @@ class LGraphCanvas { const input = node22.inputs[i2]; const link_pos = node22.getConnectionPos(true, i2); if (isInRectangle(x2, y2, link_pos[0] - 15, link_pos[1] - 10, 30, 20)) { - pointer2.onDoubleClick = () => node22.onInputDblClick?.(i2, e2); - pointer2.onClick = () => node22.onInputClick?.(i2, e2); + pointer.onDoubleClick = () => node22.onInputDblClick?.(i2, e2); + pointer.onClick = () => node22.onInputClick?.(i2, e2); if (input.link !== null) { const link_info = graph._links.get(input.link); const slot = link_info.origin_slot; @@ -60503,7 +61639,7 @@ class LGraphCanvas { pos: linked_node.getConnectionPos(false, slot) }; this.connecting_links = [connecting]; - pointer2.onDragStart = () => { + pointer.onDragStart = () => { if (this.allow_reconnect_links && !LiteGraph.click_do_break_link_to) node22.disconnectInput(i2); connecting.output = linked_node.outputs[slot]; @@ -60511,7 +61647,7 @@ class LGraphCanvas { this.dirty_bgcanvas = true; } } - if (!pointer2.onDragStart) { + if (!pointer.onDragStart) { const connecting = { node: node22, slot: i2, @@ -60519,7 +61655,7 @@ class LGraphCanvas { pos: link_pos }; this.connecting_links = [connecting]; - pointer2.onDragStart = () => connecting.input = input; + pointer.onDragStart = () => connecting.input = input; this.dirty_bgcanvas = true; } return; @@ -60527,17 +61663,17 @@ class LGraphCanvas { } } } - const pos2 = [x2 - node22.pos[0], y2 - node22.pos[1]]; - const widget2 = node22.getWidgetOnPos(x2, y2); - if (widget2) { - this.#processWidgetClick(e2, node22, widget2); - this.node_widget = [node22, widget2]; + const pos = [x2 - node22.pos[0], y2 - node22.pos[1]]; + const widget = node22.getWidgetOnPos(x2, y2); + if (widget) { + this.#processWidgetClick(e2, node22, widget); + this.node_widget = [node22, widget]; } else { - pointer2.onDoubleClick = () => { - if (pos2[1] < 0 && !inCollapse) { - node22.onNodeTitleDblClick?.(e2, pos2, this); + pointer.onDoubleClick = () => { + if (pos[1] < 0 && !inCollapse) { + node22.onNodeTitleDblClick?.(e2, pos, this); } - node22.onDblClick?.(e2, pos2, this); + node22.onDblClick?.(e2, pos, this); this.emitEvent({ subType: "node-double-click", originalEvent: e2, @@ -60545,167 +61681,54 @@ class LGraphCanvas { }); this.processNodeDblClicked(node22); }; - if (node22.onMouseDown?.(e2, pos2, this) || !this.allow_dragnodes) + if (node22.onMouseDown?.(e2, pos, this) || !this.allow_dragnodes) return; - pointer2.onDragStart = (pointer3) => this.#startDraggingItems(node22, pointer3, true); - pointer2.onDragEnd = (e3) => this.#processDraggedItems(e3); + pointer.onDragStart = (pointer2) => this.#startDraggingItems(node22, pointer2, true); + pointer.onDragEnd = (e22) => this.#processDraggedItems(e22); } this.dirty_canvas = true; } - #processWidgetClick(e, node, widget) { + #processWidgetClick(e2, node22, widget) { const { pointer } = this; if (typeof widget.onPointerDown === "function") { - const handled = widget.onPointerDown(pointer, node, this); + const handled = widget.onPointerDown(pointer, node22, this); if (handled) return; } - const width = widget.width || node.width; const oldValue = widget.value; const pos = this.graph_mouse; - const x = pos[0] - node.pos[0]; - const y = pos[1] - node.pos[1]; - switch (widget.type) { - case "button": - pointer.onClick = () => { - widget.callback?.(widget, this, node, pos, e); - widget.clicked = true; - this.dirty_canvas = true; - }; - break; - case "slider": { - if (widget.options.read_only) break; - pointer.onDrag = (eMove) => { - const x2 = eMove.canvasX - node.pos[0]; - const slideFactor = clamp$1((x2 - 15) / (width - 30), 0, 1); - widget.value = widget.options.min + (widget.options.max - widget.options.min) * slideFactor; - if (oldValue != widget.value) { - setWidgetValue(this, node, widget, widget.value); - } - this.dirty_canvas = true; - }; - break; + const x2 = pos[0] - node22.pos[0]; + const y2 = pos[1] - node22.pos[1]; + const WidgetClass = WIDGET_TYPE_MAP[widget.type]; + if (WidgetClass) { + const widgetInstance = toClass(WidgetClass, widget); + pointer.onClick = () => widgetInstance.onClick({ + e: e2, + node: node22, + canvas: this + }); + pointer.onDrag = (eMove) => widgetInstance.onDrag({ + e: eMove, + node: node22, + canvas: this + }); + } else { + if (widget.mouse) { + const result = widget.mouse(e2, [x2, y2], node22); + if (result != null) this.dirty_canvas = result; } - case "number": { - const delta = x < 40 ? -1 : x > width - 40 ? 1 : 0; - pointer.onClick = (upEvent) => { - let newValue = widget.value + delta * 0.1 * (widget.options.step || 1); - if (widget.options.min != null && newValue < widget.options.min) { - newValue = widget.options.min; - } - if (widget.options.max != null && newValue > widget.options.max) { - newValue = widget.options.max; - } - if (newValue !== widget.value) setWidgetValue(this, node, widget, newValue); - if (delta !== 0) return; - this.prompt("Value", widget.value, (v) => { - if (/^[0-9+\-*/()\s]+|\d+\.\d+$/.test(v)) { - try { - v = eval(v); - } catch { - } - } - widget.value = Number(v); - setWidgetValue(this, node, widget, widget.value); - }, e); - this.dirty_canvas = true; - }; - pointer.onDrag = (eMove) => { - const x2 = eMove.canvasX - node.pos[0]; - if (delta && (x2 > -3 && x2 < width + 3)) return; - let newValue2 = widget.value; - if (eMove.deltaX) newValue2 += eMove.deltaX * 0.1 * (widget.options.step || 1); - if (widget.options.min != null && newValue2 < widget.options.min) { - newValue2 = widget.options.min; - } - if (widget.options.max != null && newValue2 > widget.options.max) { - newValue2 = widget.options.max; - } - if (newValue2 !== widget.value) setWidgetValue(this, node, widget, newValue2); - }; - break; - } - case "combo": { - let values; - let values_list; - pointer.onClick = (upEvent2) => { - const delta2 = x < 40 ? -1 : x > width - 40 ? 1 : 0; - values = widget.options.values; - if (typeof values === "function") { - values = values(widget, node); - } - values_list = null; - values_list = Array.isArray(values) ? values : Object.keys(values); - if (delta2) { - let index2 = -1; - this.last_mouseclick = 0; - index2 = typeof values === "object" ? values_list.indexOf(String(widget.value)) + delta2 : values_list.indexOf(widget.value) + delta2; - if (index2 >= values_list.length) index2 = values_list.length - 1; - if (index2 < 0) index2 = 0; - widget.value = Array.isArray(values) ? values[index2] : index2; - if (oldValue != widget.value) setWidgetValue(this, node, widget, widget.value); - this.dirty_canvas = true; - return; - } - const text_values = values != values_list ? Object.values(values) : values; - new LiteGraph.ContextMenu(text_values, { - scale: Math.max(1, this.ds.scale), - event: e, - className: "dark", - callback: /* @__PURE__ */ __name((value4) => { - widget.value = values != values_list ? text_values.indexOf(value4) : value4; - setWidgetValue(this, node, widget, widget.value); - this.dirty_canvas = true; - return false; - }, "callback") - }); - }; - break; - } - case "toggle": - pointer.onClick = () => { - widget.value = !widget.value; - setWidgetValue(this, node, widget, widget.value); - }; - break; - case "string": - case "text": - pointer.onClick = () => this.prompt( - "Value", - widget.value, - (v2) => setWidgetValue(this, node, widget, v2), - e, - widget.options ? widget.options.multiline : false - ); - break; - default: - if (widget.mouse) { - const result = widget.mouse(e, [x, y], node); - if (result != null) this.dirty_canvas = result; - } - break; } if (oldValue != widget.value) { - node.onWidgetChanged?.(widget.name, widget.value, oldValue, widget); - node.graph._version++; + node22.onWidgetChanged?.(widget.name, widget.value, oldValue, widget); + node22.graph._version++; } pointer.finally = () => { if (widget.mouse) { const { eUp } = pointer; const { canvasX, canvasY } = eUp; - widget.mouse(eUp, [canvasX - node.pos[0], canvasY - node.pos[1]], node); + widget.mouse(eUp, [canvasX - node22.pos[0], canvasY - node22.pos[1]], node22); } this.node_widget = null; }; - function setWidgetValue(canvas, node22, widget2, value4) { - const v2 = widget2.type === "number" ? Number(value4) : value4; - widget2.value = v2; - if (widget2.options?.property && node22.properties[widget2.options.property] !== void 0) { - node22.setProperty(widget2.options.property, v2); - } - widget2.callback?.(widget2.value, canvas, node22, pos, e); - node22.onWidgetChanged?.(widget2.name, v2, oldValue, widget2); - node22.graph._version++; - } - __name(setWidgetValue, "setWidgetValue"); } /** * Pointer middle button click processing. Part of {@link processMouseDown}. @@ -60713,7 +61736,7 @@ class LGraphCanvas { * @param node The node to process a click event for */ #processMiddleButton(e2, node22) { - const { pointer: pointer2 } = this; + const { pointer } = this; if (LiteGraph.middle_click_slot_add_default_node && node22 && this.allow_interaction && !this.read_only && !this.connecting_links && !node22.flags.collapsed) { let mClikSlot = false; let mClikSlot_index = false; @@ -60749,7 +61772,7 @@ class LGraphCanvas { !mClikSlot_isOut ? node_bounding[0] : node_bounding[0] + node_bounding[2], e2.canvasY - 80 ]; - pointer2.onClick = () => this.createDefaultNodeForSlot({ + pointer.onClick = () => this.createDefaultNodeForSlot({ nodeFrom: !mClikSlot_isOut ? null : node22, slotFrom: !mClikSlot_isOut ? null : mClikSlot_index, nodeTo: !mClikSlot_isOut ? node22 : null, @@ -60762,14 +61785,29 @@ class LGraphCanvas { } } if (this.allow_dragcanvas) { - pointer2.onDragStart = () => this.dragging_canvas = true; - pointer2.finally = () => this.dragging_canvas = false; + pointer.onDragStart = () => this.dragging_canvas = true; + pointer.finally = () => this.dragging_canvas = false; } } + #processDragZoom(e2) { + if (!e2.buttons) { + this.#dragZoomStart = null; + return; + } + const deltaY = e2.y - this.#dragZoomStart.pos[1]; + const startScale = this.#dragZoomStart.scale; + const scale = startScale - deltaY / 100; + this.ds.changeScale(scale, this.#dragZoomStart.pos); + this.graph.change(); + } /** * Called when a mouse move event has to be processed */ processMouseMove(e2) { + if (this.dragZoomEnabled && e2.ctrlKey && e2.shiftKey && this.#dragZoomStart) { + this.#processDragZoom(e2); + return; + } if (this.autoresize) this.resize(); if (this.set_canvas_dirty_on_mouse_event) this.dirty_canvas = true; if (!this.graph) return; @@ -60792,11 +61830,11 @@ class LGraphCanvas { } e2.dragging = this.last_mouse_dragging; if (this.node_widget) { - const [node3, widget2] = this.node_widget; - if (widget2?.mouse) { - const x2 = e2.canvasX - node3.pos[0]; - const y2 = e2.canvasY - node3.pos[1]; - const result = widget2.mouse(e2, [x2, y2], node3); + const [node222, widget] = this.node_widget; + if (widget?.mouse) { + const x2 = e2.canvasX - node222.pos[0]; + const y2 = e2.canvasY - node222.pos[1]; + const result = widget.mouse(e2, [x2, y2], node222); if (result != null) this.dirty_canvas = result; } } @@ -60824,9 +61862,9 @@ class LGraphCanvas { if (node22) { underPointer |= CanvasItem.Node; if (node22.redraw_on_mouse) this.dirty_canvas = true; - const pos2 = [0, 0]; - const inputId = this.isOverNodeInput(node22, e2.canvasX, e2.canvasY, pos2); - const outputId = this.isOverNodeOutput(node22, e2.canvasX, e2.canvasY, pos2); + const pos = [0, 0]; + const inputId = this.isOverNodeInput(node22, e2.canvasX, e2.canvasY, pos); + const outputId = this.isOverNodeOutput(node22, e2.canvasX, e2.canvasY, pos); const overWidget = this.getWidgetAtCursor(node22); if (!node22.mouseOver) { node22.mouseOver = { @@ -60863,14 +61901,14 @@ class LGraphCanvas { if (!linkOverWidget) { const targetSlotId = firstLink.node.findConnectByTypeSlot(true, node22, firstLink.output.type); if (targetSlotId !== null && targetSlotId >= 0) { - node22.getConnectionPos(true, targetSlotId, pos2); - highlightPos = pos2; + node22.getConnectionPos(true, targetSlotId, pos); + highlightPos = pos; highlightInput = node22.inputs[targetSlotId]; } } } else if (inputId != -1 && node22.inputs[inputId] && LiteGraph.isValidConnection(firstLink.output.type, node22.inputs[inputId].type)) { if (inputId != -1 && node22.inputs[inputId] && LiteGraph.isValidConnection(firstLink.output.type, node22.inputs[inputId].type)) { - highlightPos = pos2; + highlightPos = pos; highlightInput = node22.inputs[inputId]; } } @@ -60878,12 +61916,12 @@ class LGraphCanvas { if (inputId === -1 && outputId === -1) { const targetSlotId = firstLink.node.findConnectByTypeSlot(false, node22, firstLink.input.type); if (targetSlotId !== null && targetSlotId >= 0) { - node22.getConnectionPos(false, targetSlotId, pos2); - highlightPos = pos2; + node22.getConnectionPos(false, targetSlotId, pos); + highlightPos = pos; } } else { if (outputId != -1 && node22.outputs[outputId] && LiteGraph.isValidConnection(firstLink.input.type, node22.outputs[outputId].type)) { - highlightPos = pos2; + highlightPos = pos; } } } @@ -60944,15 +61982,15 @@ class LGraphCanvas { * @param pointer The pointer event that initiated the drag, e.g. pointerdown * @param sticky If `true`, the item is added to the selection - see {@link processSelect} */ - #startDraggingItems(item3, pointer2, sticky = false) { + #startDraggingItems(item3, pointer, sticky = false) { this.emitBeforeChange(); this.graph.beforeChange(); - pointer2.finally = () => { + pointer.finally = () => { this.isDragging = false; this.graph.afterChange(); this.emitAfterChange(); }; - this.processSelect(item3, pointer2.eDown, sticky); + this.processSelect(item3, pointer.eDown, sticky); this.isDragging = true; } /** @@ -60972,16 +62010,16 @@ class LGraphCanvas { */ processMouseUp(e2) { if (e2.isPrimary === false) return; - const { graph, pointer: pointer2 } = this; + const { graph, pointer } = this; if (!graph) return; LGraphCanvas.active_canvas = this; this.adjustMouseEvent(e2); const now2 = LiteGraph.getTime(); e2.click_time = now2 - this.last_mouseclick; - const isClick = pointer2.up(e2); + const isClick = pointer.up(e2); if (isClick === true) { - pointer2.isDown = false; - pointer2.isDouble = false; + pointer.isDown = false; + pointer.isDouble = false; this.connecting_links = null; this.dragging_canvas = false; graph.change(); @@ -61081,8 +62119,8 @@ class LGraphCanvas { } else if (e2.button === 2) { this.dirty_canvas = true; } - pointer2.isDown = false; - pointer2.isDouble = false; + pointer.isDown = false; + pointer.isDouble = false; graph.change(); e2.stopPropagation(); e2.preventDefault(); @@ -61107,8 +62145,8 @@ class LGraphCanvas { if (!this.graph || !this.allow_dragcanvas) return; const delta2 = e2.wheelDeltaY ?? e2.detail * -60; this.adjustMouseEvent(e2); - const pos2 = [e2.clientX, e2.clientY]; - if (this.viewport && !isPointInRect(pos2, this.viewport)) return; + const pos = [e2.clientX, e2.clientY]; + if (this.viewport && !isPointInRect(pos, this.viewport)) return; let scale = this.ds.scale; if (delta2 > 0) scale *= this.zoom_speed; else if (delta2 < 0) scale *= 1 / this.zoom_speed; @@ -61126,26 +62164,15 @@ class LGraphCanvas { const input = node22.inputs[i2]; const link_pos = node22.getConnectionPos(true, i2); let is_inside = false; - if (node22.horizontal) { - is_inside = isInRectangle( - canvasx, - canvasy, - link_pos[0] - 5, - link_pos[1] - 10, - 10, - 20 - ); - } else { - const width2 = 20 + ((input.label?.length ?? input.localized_name?.length ?? input.name?.length) || 3) * 7; - is_inside = isInRectangle( - canvasx, - canvasy, - link_pos[0] - 10, - link_pos[1] - 10, - width2, - 20 - ); - } + const width2 = 20 + ((input.label?.length ?? input.localized_name?.length ?? input.name?.length) || 3) * 7; + is_inside = isInRectangle( + canvasx, + canvasy, + link_pos[0] - 10, + link_pos[1] - 10, + width2, + 20 + ); if (is_inside) { if (slot_pos) { slot_pos[0] = link_pos[0]; @@ -61164,26 +62191,14 @@ class LGraphCanvas { if (node22.outputs) { for (let i2 = 0, l2 = node22.outputs.length; i2 < l2; ++i2) { const link_pos = node22.getConnectionPos(false, i2); - let is_inside = false; - if (node22.horizontal) { - is_inside = isInRectangle( - canvasx, - canvasy, - link_pos[0] - 5, - link_pos[1] - 10, - 10, - 20 - ); - } else { - is_inside = isInRectangle( - canvasx, - canvasy, - link_pos[0] - 10, - link_pos[1] - 10, - 40, - 20 - ); - } + const is_inside = isInRectangle( + canvasx, + canvasy, + link_pos[0] - 10, + link_pos[1] - 10, + 40, + 20 + ); if (is_inside) { if (slot_pos) { slot_pos[0] = link_pos[0]; @@ -61224,7 +62239,7 @@ class LGraphCanvas { block_default = true; } } else if (e2.keyCode === 86 && (e2.metaKey || e2.ctrlKey)) { - this.pasteFromClipboard(e2.shiftKey); + this.pasteFromClipboard({ connectInputs: e2.shiftKey }); } else if (e2.keyCode == 46 || e2.keyCode == 8) { if (e2.target.localName != "input" && e2.target.localName != "textarea") { this.deleteSelected(); @@ -61312,7 +62327,11 @@ class LGraphCanvas { * Pastes the items from the canvas "clipbaord" - a local storage variable. * @param connectInputs If `true`, always attempt to connect inputs of pasted nodes - including to nodes that were not pasted. */ - _pasteFromClipboard(connectInputs = false) { + _pasteFromClipboard(options22 = {}) { + const { + connectInputs = false, + position: position3 = this.graph_mouse + } = options22; if (!LiteGraph.ctrl_shift_v_paste_connect_unselected_outputs && connectInputs) return; const data26 = localStorage.getItem("litegrapheditor_clipboard"); if (!data26) return; @@ -61395,17 +62414,17 @@ class LGraphCanvas { if (!reroute.validateLinks(graph.links)) graph.removeReroute(reroute.id); } for (const item3 of created4) { - item3.pos[0] += this.graph_mouse[0] - offsetX; - item3.pos[1] += this.graph_mouse[1] - offsetY; + item3.pos[0] += position3[0] - offsetX; + item3.pos[1] += position3[1] - offsetY; } this.selectItems(created4); graph.afterChange(); return results; } - pasteFromClipboard(isConnectUnselected = false) { + pasteFromClipboard(options22 = {}) { this.emitBeforeChange(); try { - this._pasteFromClipboard(isConnectUnselected); + this._pasteFromClipboard(options22); } finally { this.emitAfterChange(); } @@ -61420,8 +62439,8 @@ class LGraphCanvas { const y2 = e2.clientY; const is_inside = !this.viewport || isInRect(x2, y2, this.viewport); if (!is_inside) return; - const pos2 = [e2.canvasX, e2.canvasY]; - const node22 = this.graph ? this.graph.getNodeOnPos(pos2[0], pos2[1]) : null; + const pos = [e2.canvasX, e2.canvasY]; + const node22 = this.graph ? this.graph.getNodeOnPos(pos[0], pos[1]) : null; if (!node22) { const r2 = this.onDropItem?.(e2); if (!r2) this.checkDropItem(e2); @@ -61731,14 +62750,14 @@ class LGraphCanvas { /** * converts a coordinate from graph coordinates to canvas2D coordinates */ - convertOffsetToCanvas(pos2, out) { - return this.ds.convertOffsetToCanvas(pos2, out); + convertOffsetToCanvas(pos, out) { + return this.ds.convertOffsetToCanvas(pos, out); } /** * converts a coordinate from Canvas2D coordinates to graph space */ - convertCanvasToOffset(pos2, out) { - return this.ds.convertCanvasToOffset(pos2, out); + convertCanvasToOffset(pos, out) { + return this.ds.convertCanvasToOffset(pos, out); } // converts event coordinates from canvas2D to graph coordinates convertEventToCanvasOffset(e2) { @@ -61811,7 +62830,7 @@ class LGraphCanvas { } const ctx = this.ctx; if (!ctx) return; - const canvas = this.canvas; + const canvas2 = this.canvas; if (ctx.start2D && !this.viewport) { ctx.start2D(); ctx.restore(); @@ -61827,7 +62846,7 @@ class LGraphCanvas { this.#snapToGrid = this.#shiftDown || LiteGraph.alwaysSnapToGrid ? this.graph.getSnapToGridSize() : void 0; if (this.clear_background) { if (area) ctx.clearRect(area[0], area[1], area[2], area[3]); - else ctx.clearRect(0, 0, canvas.width, canvas.height); + else ctx.clearRect(0, 0, canvas2.width, canvas2.height); } if (this.bgcanvas == this.canvas) { this.drawBackCanvas(); @@ -61841,7 +62860,7 @@ class LGraphCanvas { this.bgcanvas.height / scale ); } - this.onRender?.(canvas, ctx); + this.onRender?.(canvas2, ctx); if (this.show_info) { this.renderInfo(ctx, area ? area[0] : 0, area ? area[1] : 0); } @@ -61874,9 +62893,9 @@ class LGraphCanvas { let connDir = connInOrOut?.dir; if (connDir == null) { if (link2.output) - connDir = link2.node.horizontal ? LinkDirection.DOWN : LinkDirection.RIGHT; + connDir = LinkDirection.RIGHT; else - connDir = link2.node.horizontal ? LinkDirection.UP : LinkDirection.LEFT; + connDir = LinkDirection.LEFT; } const connShape = connInOrOut?.shape; switch (connType) { @@ -61886,11 +62905,11 @@ class LGraphCanvas { default: link_color = LiteGraph.CONNECTING_LINK_COLOR; } - const pos2 = this.graph.reroutes.get(link2.afterRerouteId)?.pos ?? link2.pos; + const pos = this.graph.reroutes.get(link2.afterRerouteId)?.pos ?? link2.pos; const highlightPos = this.#getHighlightPosition(); this.renderLink( ctx, - pos2, + pos, highlightPos, null, false, @@ -61901,7 +62920,7 @@ class LGraphCanvas { ); ctx.beginPath(); if (connType === LiteGraph.EVENT || connShape === RenderShape.BOX) { - ctx.rect(pos2[0] - 6 + 0.5, pos2[1] - 5 + 0.5, 14, 10); + ctx.rect(pos[0] - 6 + 0.5, pos[1] - 5 + 0.5, 14, 10); ctx.fill(); ctx.beginPath(); ctx.rect( @@ -61911,12 +62930,12 @@ class LGraphCanvas { 10 ); } else if (connShape === RenderShape.ARROW) { - ctx.moveTo(pos2[0] + 8, pos2[1] + 0.5); - ctx.lineTo(pos2[0] - 4, pos2[1] + 6 + 0.5); - ctx.lineTo(pos2[0] - 4, pos2[1] - 6 + 0.5); + ctx.moveTo(pos[0] + 8, pos[1] + 0.5); + ctx.lineTo(pos[0] - 4, pos[1] + 6 + 0.5); + ctx.lineTo(pos[0] - 4, pos[1] - 6 + 0.5); ctx.closePath(); } else { - ctx.arc(pos2[0], pos2[1], 4, 0, Math.PI * 2); + ctx.arc(pos[0], pos[1], 4, 0, Math.PI * 2); ctx.fill(); ctx.beginPath(); ctx.arc(this.graph_mouse[0], this.graph_mouse[1], 4, 0, Math.PI * 2); @@ -61991,7 +63010,7 @@ class LGraphCanvas { const { strokeStyle, lineWidth } = ctx; const area = node22.boundingRect; const gap = 3; - const radius = this.round_radius + gap; + const radius = LiteGraph.ROUND_RADIUS + gap; const x2 = area[0] - gap; const y2 = area[1] - gap; const width2 = area[2] + gap * 2; @@ -62046,10 +63065,10 @@ class LGraphCanvas { * draws the back canvas (the one containing the background and the connections) */ drawBackCanvas() { - const canvas = this.bgcanvas; - if (canvas.width != this.canvas.width || canvas.height != this.canvas.height) { - canvas.width = this.canvas.width; - canvas.height = this.canvas.height; + const canvas2 = this.bgcanvas; + if (canvas2.width != this.canvas.width || canvas2.height != this.canvas.height) { + canvas2.width = this.canvas.width; + canvas2.height = this.canvas.height; } if (!this.bgctx) { this.bgctx = this.bgcanvas.getContext("2d"); @@ -62060,24 +63079,7 @@ class LGraphCanvas { if (this.clear_background) { ctx.clearRect(viewport[0], viewport[1], viewport[2], viewport[3]); } - if (this._graph_stack?.length) { - ctx.save(); - const subgraph_node = this.graph._subgraph_node; - ctx.strokeStyle = subgraph_node.bgcolor; - ctx.lineWidth = 10; - ctx.strokeRect(1, 1, canvas.width - 2, canvas.height - 2); - ctx.lineWidth = 1; - ctx.font = "40px Arial"; - ctx.textAlign = "center"; - ctx.fillStyle = subgraph_node.bgcolor || "#AAA"; - let title = ""; - for (let i2 = 1; i2 < this._graph_stack.length; ++i2) { - title += this._graph_stack[i2]._subgraph_node.getTitle() + " >> "; - } - ctx.fillText(title + subgraph_node.getTitle(), canvas.width * 0.5, 40); - ctx.restore(); - } - const bg_already_painted = this.onRenderBackground ? this.onRenderBackground(canvas, ctx) : false; + const bg_already_painted = this.onRenderBackground ? this.onRenderBackground(canvas2, ctx) : false; if (!this.viewport) { const scale = window.devicePixelRatio; ctx.restore(); @@ -62132,12 +63134,12 @@ class LGraphCanvas { ctx.imageSmoothingEnabled = true; } if (this.graph._groups.length) { - this.drawGroups(canvas, ctx); + this.drawGroups(canvas2, ctx); } this.onDrawBackground?.(ctx, this.visible_area); if (this.render_canvas_border) { ctx.strokeStyle = "#235"; - ctx.strokeRect(0, 0, canvas.width, canvas.height); + ctx.strokeRect(0, 0, canvas2.width, canvas2.height); } if (this.render_connections_shadows) { ctx.shadowColor = "#000"; @@ -62160,9 +63162,9 @@ class LGraphCanvas { */ drawNode(node22, ctx) { this.current_node = node22; - const color2 = node22.color || node22.constructor.color || LiteGraph.NODE_DEFAULT_COLOR; - const bgcolor = node22.bgcolor || node22.constructor.bgcolor || LiteGraph.NODE_DEFAULT_BGCOLOR; - const low_quality = this.ds.scale < 0.6; + const color2 = node22.renderingColor; + const bgcolor = node22.renderingBgColor; + const low_quality = this.low_quality; const editor_alpha = this.editor_alpha; ctx.globalAlpha = editor_alpha; if (this.render_shadows && !low_quality) { @@ -62178,7 +63180,6 @@ class LGraphCanvas { const shape = node22._shape || RenderShape.BOX; const size = LGraphCanvas.#temp_vec2; LGraphCanvas.#temp_vec2.set(node22.size); - const horizontal2 = node22.horizontal; if (node22.flags.collapsed) { ctx.font = this.inner_text_font; const title = node22.getTitle ? node22.getTitle() : node22.title; @@ -62217,152 +63218,19 @@ class LGraphCanvas { ctx.shadowColor = "transparent"; ctx.strokeStyle = LiteGraph.NODE_BOX_OUTLINE_COLOR; node22.onDrawForeground?.(ctx, this, this.canvas); - ctx.textAlign = horizontal2 ? "center" : "left"; ctx.font = this.inner_text_font; - const render_text = !low_quality; - const highlightColour = LiteGraph.NODE_TEXT_HIGHLIGHT_COLOR ?? LiteGraph.NODE_SELECTED_TITLE_COLOR ?? LiteGraph.NODE_TEXT_COLOR; - const out_slot = this.connecting_links?.[0]?.output; - const in_slot = this.connecting_links?.[0]?.input; - ctx.lineWidth = 1; - let max_y = 0; - const slot_pos = new Float32Array(2); - if (!node22.flags.collapsed) { - if (node22.inputs) { - for (let i2 = 0; i2 < node22.inputs.length; i2++) { - const slot = node22.inputs[i2]; - const slot_type = slot.type; - const isValid2 = !this.connecting_links || out_slot && LiteGraph.isValidConnection(slot.type, out_slot.type); - const highlight = isValid2 && node22.mouseOver?.inputId === i2; - const label_color = highlight ? highlightColour : LiteGraph.NODE_TEXT_COLOR; - ctx.globalAlpha = isValid2 ? editor_alpha : 0.4 * editor_alpha; - ctx.fillStyle = slot.link != null ? slot.color_on || this.default_connection_color_byType[slot_type] || this.default_connection_color.input_on : slot.color_off || this.default_connection_color_byTypeOff[slot_type] || this.default_connection_color_byType[slot_type] || this.default_connection_color.input_off; - const pos2 = node22.getConnectionPos(true, i2, slot_pos); - pos2[0] -= node22.pos[0]; - pos2[1] -= node22.pos[1]; - if (max_y < pos2[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5) { - max_y = pos2[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5; - } - drawSlot(ctx, slot, pos2, { - horizontal: horizontal2, - low_quality, - render_text, - label_color, - label_position: LabelPosition.Right, - // Input slot is not stroked. - do_stroke: false, - highlight - }); - } - } - ctx.textAlign = horizontal2 ? "center" : "right"; - ctx.strokeStyle = "black"; - if (node22.outputs) { - for (let i2 = 0; i2 < node22.outputs.length; i2++) { - const slot = node22.outputs[i2]; - const slot_type = slot.type; - const isValid2 = !this.connecting_links || in_slot && LiteGraph.isValidConnection(slot_type, in_slot.type); - const highlight = isValid2 && node22.mouseOver?.outputId === i2; - const label_color = highlight ? highlightColour : LiteGraph.NODE_TEXT_COLOR; - ctx.globalAlpha = isValid2 ? editor_alpha : 0.4 * editor_alpha; - const pos2 = node22.getConnectionPos(false, i2, slot_pos); - pos2[0] -= node22.pos[0]; - pos2[1] -= node22.pos[1]; - if (max_y < pos2[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5) { - max_y = pos2[1] + LiteGraph.NODE_SLOT_HEIGHT * 0.5; - } - ctx.fillStyle = slot.links && slot.links.length ? slot.color_on || this.default_connection_color_byType[slot_type] || this.default_connection_color.output_on : slot.color_off || this.default_connection_color_byTypeOff[slot_type] || this.default_connection_color_byType[slot_type] || this.default_connection_color.output_off; - drawSlot(ctx, slot, pos2, { - horizontal: horizontal2, - low_quality, - render_text, - label_color, - label_position: LabelPosition.Left, - do_stroke: true, - highlight - }); - } - } + if (!node22.collapsed) { + const max_y = node22.drawSlots(ctx, { + colorContext: this, + connectingLink: this.connecting_links?.[0], + editorAlpha: this.editor_alpha, + lowQuality: this.low_quality + }); ctx.textAlign = "left"; ctx.globalAlpha = 1; - if (node22.widgets) { - let widgets_y = max_y; - if (horizontal2 || node22.widgets_up) { - widgets_y = 2; - } - if (node22.widgets_start_y != null) widgets_y = node22.widgets_start_y; - this.drawNodeWidgets( - node22, - widgets_y, - ctx, - this.node_widget && this.node_widget[0] == node22 ? this.node_widget[1] : null - ); - } + this.drawNodeWidgets(node22, max_y, ctx); } else if (this.render_collapsed_slots) { - let input_slot = null; - let output_slot = null; - let slot; - if (node22.inputs) { - for (let i2 = 0; i2 < node22.inputs.length; i2++) { - slot = node22.inputs[i2]; - if (slot.link == null) { - continue; - } - input_slot = slot; - break; - } - } - if (node22.outputs) { - for (let i2 = 0; i2 < node22.outputs.length; i2++) { - slot = node22.outputs[i2]; - if (!slot.links || !slot.links.length) { - continue; - } - output_slot = slot; - } - } - if (input_slot) { - let x2 = 0; - let y2 = LiteGraph.NODE_TITLE_HEIGHT * -0.5; - if (horizontal2) { - x2 = node22._collapsed_width * 0.5; - y2 = -LiteGraph.NODE_TITLE_HEIGHT; - } - ctx.fillStyle = "#686"; - ctx.beginPath(); - if (slot.type === LiteGraph.EVENT || slot.shape === RenderShape.BOX) { - ctx.rect(x2 - 7 + 0.5, y2 - 4, 14, 8); - } else if (slot.shape === RenderShape.ARROW) { - ctx.moveTo(x2 + 8, y2); - ctx.lineTo(x2 + -4, y2 - 4); - ctx.lineTo(x2 + -4, y2 + 4); - ctx.closePath(); - } else { - ctx.arc(x2, y2, 4, 0, Math.PI * 2); - } - ctx.fill(); - } - if (output_slot) { - let x2 = node22._collapsed_width; - let y2 = LiteGraph.NODE_TITLE_HEIGHT * -0.5; - if (horizontal2) { - x2 = node22._collapsed_width * 0.5; - y2 = 0; - } - ctx.fillStyle = "#686"; - ctx.strokeStyle = "black"; - ctx.beginPath(); - if (slot.type === LiteGraph.EVENT || slot.shape === RenderShape.BOX) { - ctx.rect(x2 - 7 + 0.5, y2 - 4, 14, 8); - } else if (slot.shape === RenderShape.ARROW) { - ctx.moveTo(x2 + 6, y2); - ctx.lineTo(x2 - 6, y2 - 4); - ctx.lineTo(x2 - 6, y2 + 4); - ctx.closePath(); - } else { - ctx.arc(x2, y2, 4, 0, Math.PI * 2); - } - ctx.fill(); - } + node22.drawCollapsedSlots(ctx); } if (node22.clip_area) { ctx.restore(); @@ -62378,19 +63246,19 @@ class LGraphCanvas { * @todo Split tooltip from hover, so it can be drawn / eased separately */ drawLinkTooltip(ctx, link2) { - const pos2 = link2._pos; + const pos = link2._pos; ctx.fillStyle = "black"; ctx.beginPath(); if (this.linkMarkerShape === LinkMarkerShape.Arrow) { const transform2 = ctx.getTransform(); - ctx.translate(pos2[0], pos2[1]); + ctx.translate(pos[0], pos[1]); if (Number.isFinite(link2._centreAngle)) ctx.rotate(link2._centreAngle); ctx.moveTo(-2, -3); ctx.lineTo(4, 0); ctx.lineTo(-2, 3); ctx.setTransform(transform2); } else if (this.linkMarkerShape == null || this.linkMarkerShape === LinkMarkerShape.Circle) { - ctx.arc(pos2[0], pos2[1], 3, 0, Math.PI * 2); + ctx.arc(pos[0], pos[1], 3, 0, Math.PI * 2); } ctx.fill(); const data26 = link2.data; @@ -62419,15 +63287,15 @@ class LGraphCanvas { ctx.shadowBlur = 3; ctx.fillStyle = "#454"; ctx.beginPath(); - ctx.roundRect(pos2[0] - w2 * 0.5, pos2[1] - 15 - h2, w2, h2, [3]); - ctx.moveTo(pos2[0] - 10, pos2[1] - 15); - ctx.lineTo(pos2[0] + 10, pos2[1] - 15); - ctx.lineTo(pos2[0], pos2[1] - 5); + ctx.roundRect(pos[0] - w2 * 0.5, pos[1] - 15 - h2, w2, h2, [3]); + ctx.moveTo(pos[0] - 10, pos[1] - 15); + ctx.lineTo(pos[0] + 10, pos[1] - 15); + ctx.lineTo(pos[0], pos[1] - 5); ctx.fill(); ctx.shadowColor = "transparent"; ctx.textAlign = "center"; ctx.fillStyle = "#CEC"; - ctx.fillText(text2, pos2[0], pos2[1] - 15 - h2 * 0.3); + ctx.fillText(text2, pos[0], pos[1] - 15 - h2 * 0.3); } /** * Draws the shape of the given node on the canvas @@ -62442,10 +63310,10 @@ class LGraphCanvas { ctx.strokeStyle = fgcolor; ctx.fillStyle = LiteGraph.use_legacy_node_error_indicator ? "#F00" : bgcolor; const title_height = LiteGraph.NODE_TITLE_HEIGHT; - const low_quality = this.ds.scale < 0.5; + const low_quality = this.low_quality; const { collapsed: collapsed2 } = node22.flags; - const shape = node22._shape || node22.constructor.shape || LiteGraph.NODE_DEFAULT_SHAPE; - const { title_mode } = node22.constructor; + const shape = node22.renderingShape; + const title_mode = node22.title_mode; const render_title = title_mode == TitleMode.TRANSPARENT_TITLE || title_mode == TitleMode.NO_TITLE ? false : true; const area = LGraphCanvas.#tmp_area; node22.measure(area); @@ -62461,14 +63329,14 @@ class LGraphCanvas { area[1], area[2], area[3], - shape == RenderShape.CARD ? [this.round_radius, this.round_radius, 0, 0] : [this.round_radius] + shape == RenderShape.CARD ? [LiteGraph.ROUND_RADIUS, LiteGraph.ROUND_RADIUS, 0, 0] : [LiteGraph.ROUND_RADIUS] ); } else if (shape == RenderShape.CIRCLE) { ctx.arc(size[0] * 0.5, size[1] * 0.5, size[0] * 0.5, 0, Math.PI * 2); } ctx.fill(); if (node22.has_errors && !LiteGraph.use_legacy_node_error_indicator) { - this.strokeShape(ctx, area, { + strokeShape(ctx, area, { shape, title_mode, title_height, @@ -62484,161 +63352,29 @@ class LGraphCanvas { ctx.fillRect(0, -1, area[2], 2); } ctx.shadowColor = "transparent"; - node22.onDrawBackground?.(ctx, this, this.canvas, this.graph_mouse); + node22.onDrawBackground?.(ctx); if (render_title || title_mode == TitleMode.TRANSPARENT_TITLE) { - if (node22.onDrawTitleBar) { - node22.onDrawTitleBar(ctx, title_height, size, this.ds.scale, fgcolor); - } else if (title_mode != TitleMode.TRANSPARENT_TITLE && (node22.constructor.title_color || this.render_title_colored)) { - const title_color = node22.constructor.title_color || fgcolor; - if (collapsed2) { - ctx.shadowColor = LiteGraph.DEFAULT_SHADOW_COLOR; - } - ctx.fillStyle = title_color; - ctx.beginPath(); - if (shape == RenderShape.BOX || low_quality) { - ctx.rect(0, -title_height, size[0], title_height); - } else if (shape == RenderShape.ROUND || shape == RenderShape.CARD) { - ctx.roundRect( - 0, - -title_height, - size[0], - title_height, - collapsed2 ? [this.round_radius] : [this.round_radius, this.round_radius, 0, 0] - ); - } - ctx.fill(); - ctx.shadowColor = "transparent"; - } - let colState = LiteGraph.node_box_coloured_by_mode && LiteGraph.NODE_MODES_COLORS[node22.mode] ? LiteGraph.NODE_MODES_COLORS[node22.mode] : false; - if (LiteGraph.node_box_coloured_when_on) { - colState = node22.action_triggered ? "#FFF" : node22.execute_triggered ? "#AAA" : colState; - } - const box_size = 10; - if (node22.onDrawTitleBox) { - node22.onDrawTitleBox(ctx, title_height, size, this.ds.scale); - } else if (shape == RenderShape.ROUND || shape == RenderShape.CIRCLE || shape == RenderShape.CARD) { - if (low_quality) { - ctx.fillStyle = "black"; - ctx.beginPath(); - ctx.arc( - title_height * 0.5, - title_height * -0.5, - box_size * 0.5 + 1, - 0, - Math.PI * 2 - ); - ctx.fill(); - } - ctx.fillStyle = node22.boxcolor || colState || LiteGraph.NODE_DEFAULT_BOXCOLOR; - if (low_quality) - ctx.fillRect( - title_height * 0.5 - box_size * 0.5, - title_height * -0.5 - box_size * 0.5, - box_size, - box_size - ); - else { - ctx.beginPath(); - ctx.arc( - title_height * 0.5, - title_height * -0.5, - box_size * 0.5, - 0, - Math.PI * 2 - ); - ctx.fill(); - } - } else { - if (low_quality) { - ctx.fillStyle = "black"; - ctx.fillRect( - (title_height - box_size) * 0.5 - 1, - (title_height + box_size) * -0.5 - 1, - box_size + 2, - box_size + 2 - ); - } - ctx.fillStyle = node22.boxcolor || colState || LiteGraph.NODE_DEFAULT_BOXCOLOR; - ctx.fillRect( - (title_height - box_size) * 0.5, - (title_height + box_size) * -0.5, - box_size, - box_size - ); - } + node22.drawTitleBarBackground(ctx, { + scale: this.ds.scale, + low_quality + }); + node22.drawTitleBox(ctx, { + scale: this.ds.scale, + low_quality, + box_size: 10 + }); ctx.globalAlpha = old_alpha; - if (node22.onDrawTitleText) { - node22.onDrawTitleText( - ctx, - title_height, - size, - this.ds.scale, - this.title_text_font, - selected2 - ); - } - if (!low_quality) { - ctx.font = this.title_text_font; - const rawTitle = node22.getTitle() ?? `❌ ${node22.type}`; - const title = String(rawTitle) + (node22.pinned ? "📌" : ""); - if (title) { - if (selected2) { - ctx.fillStyle = LiteGraph.NODE_SELECTED_TITLE_COLOR; - } else { - ctx.fillStyle = node22.constructor.title_text_color || this.node_title_color; - } - if (collapsed2) { - ctx.textAlign = "left"; - ctx.fillText( - title.substr(0, 20), - // avoid urls too long - title_height, - // + measure.width * 0.5, - LiteGraph.NODE_TITLE_TEXT_Y - title_height - ); - ctx.textAlign = "left"; - } else { - ctx.textAlign = "left"; - ctx.fillText( - title, - title_height, - LiteGraph.NODE_TITLE_TEXT_Y - title_height - ); - } - } - } - if (!collapsed2 && node22.subgraph && !node22.skip_subgraph_button) { - const w2 = LiteGraph.NODE_TITLE_HEIGHT; - const x2 = node22.size[0] - w2; - const over = LiteGraph.isInsideRectangle( - this.graph_mouse[0] - node22.pos[0], - this.graph_mouse[1] - node22.pos[1], - x2 + 2, - -w2 + 2, - w2 - 4, - w2 - 4 - ); - ctx.fillStyle = over ? "#888" : "#555"; - if (shape == RenderShape.BOX || low_quality) { - ctx.fillRect(x2 + 2, -w2 + 2, w2 - 4, w2 - 4); - } else { - ctx.beginPath(); - ctx.roundRect(x2 + 2, -w2 + 2, w2 - 4, w2 - 4, [4]); - ctx.fill(); - } - ctx.fillStyle = "#333"; - ctx.beginPath(); - ctx.moveTo(x2 + w2 * 0.2, -w2 * 0.6); - ctx.lineTo(x2 + w2 * 0.8, -w2 * 0.6); - ctx.lineTo(x2 + w2 * 0.5, -w2 * 0.3); - ctx.fill(); - } + node22.drawTitleText(ctx, { + scale: this.ds.scale, + default_title_color: this.node_title_color, + low_quality + }); node22.onDrawTitle?.(ctx); } if (selected2) { node22.onBounding?.(area); const padding = node22.has_errors && !LiteGraph.use_legacy_node_error_indicator ? 20 : void 0; - this.strokeShape(ctx, area, { + strokeShape(ctx, area, { shape, title_height, title_mode, @@ -62649,75 +63385,6 @@ class LGraphCanvas { if (node22.execute_triggered > 0) node22.execute_triggered--; if (node22.action_triggered > 0) node22.action_triggered--; } - /** - * Draws only the path of a shape on the canvas, without filling. - * Used to draw indicators for node status, e.g. "selected". - * @param ctx The 2D context to draw on - * @param area The position and size of the shape to render - */ - strokeShape(ctx, area, { - /** The shape to render */ - shape = RenderShape.BOX, - /** Shape will extend above the Y-axis 0 by this amount */ - title_height = LiteGraph.NODE_TITLE_HEIGHT, - /** @deprecated This is node-specific: it should be removed entirely, and behaviour defined by the caller more explicitly */ - title_mode = TitleMode.NORMAL_TITLE, - /** The colour that should be drawn */ - colour = LiteGraph.NODE_BOX_OUTLINE_COLOR, - /** The distance between the edge of the {@link area} and the middle of the line */ - padding = 6, - /** @deprecated This is node-specific: it should be removed entirely, and behaviour defined by the caller more explicitly */ - collapsed: collapsed2 = false, - /** Thickness of the line drawn (`lineWidth`) */ - thickness = 1 - } = {}) { - if (title_mode === TitleMode.TRANSPARENT_TITLE) { - area[1] -= title_height; - area[3] += title_height; - } - const { lineWidth, strokeStyle } = ctx; - ctx.lineWidth = thickness; - ctx.globalAlpha = 0.8; - ctx.strokeStyle = colour; - ctx.beginPath(); - const [x2, y2, width2, height] = area; - switch (shape) { - case RenderShape.BOX: { - ctx.rect( - x2 - padding, - y2 - padding, - width2 + 2 * padding, - height + 2 * padding - ); - break; - } - case RenderShape.ROUND: - case RenderShape.CARD: { - const radius = this.round_radius + padding; - const isCollapsed = shape === RenderShape.CARD && collapsed2; - const cornerRadii = isCollapsed || shape === RenderShape.ROUND ? [radius] : [radius, 2, radius, 2]; - ctx.roundRect( - x2 - padding, - y2 - padding, - width2 + 2 * padding, - height + 2 * padding, - cornerRadii - ); - break; - } - case RenderShape.CIRCLE: { - const centerX = x2 + width2 / 2; - const centerY = y2 + height / 2; - const radius = Math.max(width2, height) / 2 + padding; - ctx.arc(centerX, centerY, radius, 0, Math.PI * 2); - break; - } - } - ctx.stroke(); - ctx.lineWidth = lineWidth; - ctx.strokeStyle = strokeStyle; - ctx.globalAlpha = 1; - } /** * Draws a snap guide for a {@link Positionable} item. * @@ -62732,9 +63399,9 @@ class LGraphCanvas { drawSnapGuide(ctx, item3, shape = RenderShape.ROUND) { const snapGuide = LGraphCanvas.#temp; snapGuide.set(item3.boundingRect); - const { pos: pos2 } = item3; - const offsetX = pos2[0] - snapGuide[0]; - const offsetY = pos2[1] - snapGuide[1]; + const { pos } = item3; + const offsetX = pos[0] - snapGuide[0]; + const offsetY = pos[1] - snapGuide[1]; snapGuide[0] += offsetX; snapGuide[1] += offsetY; snapPoint(snapGuide, this.#snapToGrid); @@ -62806,8 +63473,8 @@ class LGraphCanvas { const start_slot = start_node.outputs[outputId]; const end_slot = node22.inputs[i2]; if (!start_slot || !end_slot) continue; - const start_dir = start_slot.dir || (start_node.horizontal ? LinkDirection.DOWN : LinkDirection.RIGHT); - const end_dir = end_slot.dir || (node22.horizontal ? LinkDirection.UP : LinkDirection.LEFT); + const start_dir = start_slot.dir || LinkDirection.RIGHT; + const end_dir = end_slot.dir || LinkDirection.LEFT; if (reroutes.length) { let startControl; const l22 = reroutes.length; @@ -62916,7 +63583,7 @@ class LGraphCanvas { const startDir = start_dir || LinkDirection.RIGHT; const endDir = end_dir || LinkDirection.LEFT; const dist3 = this.links_render_mode == LinkRenderType.SPLINE_LINK && (!endControl || !startControl) ? distance(a2, b2) : null; - if (this.render_connections_border && this.ds.scale > 0.6) { + if (this.render_connections_border && !this.low_quality) { ctx.lineWidth = this.connections_width + 4; } ctx.lineJoin = "round"; @@ -62927,7 +63594,7 @@ class LGraphCanvas { if (linkSegment) linkSegment.path = path; const innerA = LGraphCanvas.#lTempA; const innerB = LGraphCanvas.#lTempB; - const pos2 = linkSegment?._pos ?? [0, 0]; + const pos = linkSegment?._pos ?? [0, 0]; for (let i2 = 0; i2 < num_sublines; i2 += 1) { const offsety = (i2 - (num_sublines - 1) * 0.5) * 5; innerA[0] = a2[0]; @@ -62956,13 +63623,13 @@ class LGraphCanvas { b2[0], b2[1] + offsety ); - findPointOnCurve(pos2, a2, b2, innerA, innerB, 0.5); + findPointOnCurve(pos, a2, b2, innerA, innerB, 0.5); if (linkSegment && this.linkMarkerShape === LinkMarkerShape.Arrow) { const justPastCentre = LGraphCanvas.#lTempC; findPointOnCurve(justPastCentre, a2, b2, innerA, innerB, 0.51); linkSegment._centreAngle = Math.atan2( - justPastCentre[1] - pos2[1], - justPastCentre[0] - pos2[0] + justPastCentre[1] - pos[1], + justPastCentre[0] - pos[0] ); } } else if (this.links_render_mode == LinkRenderType.LINEAR_LINK) { @@ -62999,8 +63666,8 @@ class LGraphCanvas { path.lineTo(innerA[0], innerA[1] + offsety); path.lineTo(innerB[0], innerB[1] + offsety); path.lineTo(b2[0], b2[1] + offsety); - pos2[0] = (innerA[0] + innerB[0]) * 0.5; - pos2[1] = (innerA[1] + innerB[1]) * 0.5; + pos[0] = (innerA[0] + innerB[0]) * 0.5; + pos[1] = (innerA[1] + innerB[1]) * 0.5; if (linkSegment && this.linkMarkerShape === LinkMarkerShape.Arrow) { linkSegment._centreAngle = Math.atan2( innerB[1] - innerA[1], @@ -63025,8 +63692,8 @@ class LGraphCanvas { path.lineTo(midX, innerB[1]); path.lineTo(innerB[0], innerB[1]); path.lineTo(b2[0], b2[1]); - pos2[0] = midX; - pos2[1] = (innerA[1] + innerB[1]) * 0.5; + pos[0] = midX; + pos[1] = (innerA[1] + innerB[1]) * 0.5; if (linkSegment && this.linkMarkerShape === LinkMarkerShape.Arrow) { const diff2 = innerB[1] - innerA[1]; if (Math.abs(diff2) < 4) linkSegment._centreAngle = 0; @@ -63037,7 +63704,7 @@ class LGraphCanvas { return; } } - if (this.render_connections_border && this.ds.scale > 0.6 && !skip_border) { + if (this.render_connections_border && !this.low_quality && !skip_border) { ctx.strokeStyle = "rgba(0,0,0,0.5)"; ctx.stroke(path); } @@ -63080,7 +63747,7 @@ class LGraphCanvas { ctx.beginPath(); if (this.linkMarkerShape === LinkMarkerShape.Arrow) { const transform2 = ctx.getTransform(); - ctx.translate(pos2[0], pos2[1]); + ctx.translate(pos[0], pos[1]); ctx.rotate(linkSegment._centreAngle); ctx.moveTo(-3.2, -5); ctx.lineTo(7, 0); @@ -63088,7 +63755,7 @@ class LGraphCanvas { ctx.fill(); ctx.setTransform(transform2); } else if (this.linkMarkerShape == null || this.linkMarkerShape === LinkMarkerShape.Circle) { - ctx.arc(pos2[0], pos2[1], 5, 0, Math.PI * 2); + ctx.arc(pos[0], pos[1], 5, 0, Math.PI * 2); } ctx.fill(); } @@ -63186,245 +63853,23 @@ class LGraphCanvas { } /** * draws the widgets stored inside a node + * @deprecated Use {@link LGraphNode.drawWidgets} instead. + * @note Currently there are extensions hijacking this function, so we cannot remove it. */ - drawNodeWidgets(node22, posY, ctx, active_widget) { - if (!node22.widgets || !node22.widgets.length) return 0; - const width2 = node22.size[0]; - const widgets = node22.widgets; - posY += 2; - const H = LiteGraph.NODE_WIDGET_HEIGHT; - const show_text = this.ds.scale > 0.5; - ctx.save(); - ctx.globalAlpha = this.editor_alpha; - const background_color = LiteGraph.WIDGET_BGCOLOR; - const text_color = LiteGraph.WIDGET_TEXT_COLOR; - const secondary_text_color = LiteGraph.WIDGET_SECONDARY_TEXT_COLOR; - const margin = 15; - for (let i2 = 0; i2 < widgets.length; ++i2) { - const w2 = widgets[i2]; - if (w2.hidden || w2.advanced && !node22.showAdvanced) continue; - const y2 = w2.y || posY; - const outline_color = w2.advanced ? LiteGraph.WIDGET_ADVANCED_OUTLINE_COLOR : LiteGraph.WIDGET_OUTLINE_COLOR; - if (w2 === this.link_over_widget) { - ctx.fillStyle = this.default_connection_color_byType[this.link_over_widget_type] || this.default_connection_color.input_on; - drawSlot(ctx, {}, [10, y2 + 10], {}); - } - w2.last_y = y2; - ctx.strokeStyle = outline_color; - ctx.fillStyle = "#222"; - ctx.textAlign = "left"; - if (w2.disabled) ctx.globalAlpha *= 0.5; - const widget_width = w2.width || width2; - switch (w2.type) { - case "button": - ctx.fillStyle = background_color; - if (w2.clicked) { - ctx.fillStyle = "#AAA"; - w2.clicked = false; - this.dirty_canvas = true; - } - ctx.fillRect(margin, y2, widget_width - margin * 2, H); - if (show_text && !w2.disabled) - ctx.strokeRect(margin, y2, widget_width - margin * 2, H); - if (show_text) { - ctx.textAlign = "center"; - ctx.fillStyle = text_color; - ctx.fillText(w2.label || w2.name, widget_width * 0.5, y2 + H * 0.7); - } - break; - case "toggle": - ctx.textAlign = "left"; - ctx.strokeStyle = outline_color; - ctx.fillStyle = background_color; - ctx.beginPath(); - if (show_text) - ctx.roundRect(margin, y2, widget_width - margin * 2, H, [H * 0.5]); - else ctx.rect(margin, y2, widget_width - margin * 2, H); - ctx.fill(); - if (show_text && !w2.disabled) ctx.stroke(); - ctx.fillStyle = w2.value ? "#89A" : "#333"; - ctx.beginPath(); - ctx.arc( - widget_width - margin * 2, - y2 + H * 0.5, - H * 0.36, - 0, - Math.PI * 2 - ); - ctx.fill(); - if (show_text) { - ctx.fillStyle = secondary_text_color; - const label5 = w2.label || w2.name; - if (label5 != null) { - ctx.fillText(label5, margin * 2, y2 + H * 0.7); - } - ctx.fillStyle = w2.value ? text_color : secondary_text_color; - ctx.textAlign = "right"; - ctx.fillText( - w2.value ? w2.options.on || "true" : w2.options.off || "false", - widget_width - 40, - y2 + H * 0.7 - ); - } - break; - case "slider": { - ctx.fillStyle = background_color; - ctx.fillRect(margin, y2, widget_width - margin * 2, H); - const range2 = w2.options.max - w2.options.min; - let nvalue = (w2.value - w2.options.min) / range2; - if (nvalue < 0) nvalue = 0; - if (nvalue > 1) nvalue = 1; - ctx.fillStyle = w2.options.hasOwnProperty("slider_color") ? w2.options.slider_color : active_widget == w2 ? "#89A" : "#678"; - ctx.fillRect(margin, y2, nvalue * (widget_width - margin * 2), H); - if (show_text && !w2.disabled) - ctx.strokeRect(margin, y2, widget_width - margin * 2, H); - if (w2.marker) { - let marker_nvalue = (w2.marker - w2.options.min) / range2; - if (marker_nvalue < 0) marker_nvalue = 0; - if (marker_nvalue > 1) marker_nvalue = 1; - ctx.fillStyle = w2.options.hasOwnProperty("marker_color") ? w2.options.marker_color : "#AA9"; - ctx.fillRect( - margin + marker_nvalue * (widget_width - margin * 2), - y2, - 2, - H - ); - } - if (show_text) { - ctx.textAlign = "center"; - ctx.fillStyle = text_color; - ctx.fillText( - (w2.label || w2.name) + " " + Number(w2.value).toFixed( - w2.options.precision != null ? w2.options.precision : 3 - ), - widget_width * 0.5, - y2 + H * 0.7 - ); - } - break; - } - case "number": - case "combo": - ctx.textAlign = "left"; - ctx.strokeStyle = outline_color; - ctx.fillStyle = background_color; - ctx.beginPath(); - if (show_text) - ctx.roundRect(margin, y2, widget_width - margin * 2, H, [H * 0.5]); - else ctx.rect(margin, y2, widget_width - margin * 2, H); - ctx.fill(); - if (show_text) { - if (!w2.disabled) ctx.stroke(); - ctx.fillStyle = text_color; - if (!w2.disabled) { - ctx.beginPath(); - ctx.moveTo(margin + 16, y2 + 5); - ctx.lineTo(margin + 6, y2 + H * 0.5); - ctx.lineTo(margin + 16, y2 + H - 5); - ctx.fill(); - ctx.beginPath(); - ctx.moveTo(widget_width - margin - 16, y2 + 5); - ctx.lineTo(widget_width - margin - 6, y2 + H * 0.5); - ctx.lineTo(widget_width - margin - 16, y2 + H - 5); - ctx.fill(); - } - ctx.fillStyle = secondary_text_color; - ctx.fillText(w2.label || w2.name, margin * 2 + 5, y2 + H * 0.7); - ctx.fillStyle = text_color; - ctx.textAlign = "right"; - if (w2.type == "number") { - ctx.fillText( - Number(w2.value).toFixed( - w2.options.precision !== void 0 ? w2.options.precision : 3 - ), - widget_width - margin * 2 - 20, - y2 + H * 0.7 - ); - } else { - let v2 = typeof w2.value === "number" ? String(w2.value) : w2.value; - if (w2.options.values) { - let values = w2.options.values; - if (typeof values === "function") - values = values(); - if (values && !Array.isArray(values)) - v2 = values[w2.value]; - } - const labelWidth = ctx.measureText(w2.label || w2.name).width + margin * 2; - const inputWidth = widget_width - margin * 4; - const availableWidth = inputWidth - labelWidth; - const textWidth = ctx.measureText(v2).width; - if (textWidth > availableWidth) { - const ELLIPSIS = "…"; - const ellipsisWidth = ctx.measureText(ELLIPSIS).width; - const charWidthAvg = ctx.measureText("a").width; - if (availableWidth <= ellipsisWidth) { - v2 = "․"; - } else { - v2 = `${v2}`; - const overflowWidth = textWidth + ellipsisWidth - availableWidth; - if (overflowWidth + charWidthAvg * 3 > availableWidth) { - const preciseRange = availableWidth + charWidthAvg * 3; - const preTruncateCt = Math.floor((preciseRange - ellipsisWidth) / charWidthAvg); - v2 = v2.substr(0, preTruncateCt); - } - while (ctx.measureText(v2).width + ellipsisWidth > availableWidth) { - v2 = v2.substr(0, v2.length - 1); - } - v2 += ELLIPSIS; - } - } - ctx.fillText( - v2, - widget_width - margin * 2 - 20, - y2 + H * 0.7 - ); - } - } - break; - case "string": - case "text": - ctx.textAlign = "left"; - ctx.strokeStyle = outline_color; - ctx.fillStyle = background_color; - ctx.beginPath(); - if (show_text) - ctx.roundRect(margin, y2, widget_width - margin * 2, H, [H * 0.5]); - else - ctx.rect(margin, y2, widget_width - margin * 2, H); - ctx.fill(); - if (show_text) { - if (!w2.disabled) ctx.stroke(); - ctx.save(); - ctx.beginPath(); - ctx.rect(margin, y2, widget_width - margin * 2, H); - ctx.clip(); - ctx.fillStyle = secondary_text_color; - const label5 = w2.label || w2.name; - if (label5 != null) ctx.fillText(label5, margin * 2, y2 + H * 0.7); - ctx.fillStyle = text_color; - ctx.textAlign = "right"; - ctx.fillText( - String(w2.value).substr(0, 30), - widget_width - margin * 2, - y2 + H * 0.7 - ); - ctx.restore(); - } - break; - default: - w2.draw?.(ctx, node22, widget_width, y2, H); - break; - } - posY += (w2.computeSize ? w2.computeSize(widget_width)[1] : H) + 4; - ctx.globalAlpha = this.editor_alpha; - } - ctx.restore(); - ctx.textAlign = "left"; + drawNodeWidgets(node22, posY, ctx) { + node22.drawWidgets(ctx, { + y: posY, + colorContext: this, + linkOverWidget: this.link_over_widget, + linkOverWidgetType: this.link_over_widget_type, + lowQuality: this.low_quality, + editorAlpha: this.editor_alpha + }); } /** * draws every group area in the background */ - drawGroups(canvas, ctx) { + drawGroups(canvas2, ctx) { if (!this.graph) return; const groups = this.graph._groups; ctx.save(); @@ -63477,18 +63922,18 @@ class LGraphCanvas { const { graph } = this; const node_left = graph.getNodeById(segment.origin_id); const fromType = node_left?.outputs?.[segment.origin_slot]?.type ?? "*"; - const options4 = ["Add Node", null, "Delete", null]; - if (this.reroutesEnabled) options4.splice(1, 0, "Add Reroute"); + const options22 = ["Add Node", null, "Delete", null]; + if (this.reroutesEnabled) options22.splice(1, 0, "Add Reroute"); const title = "data" in segment && segment.data != null ? segment.data.constructor.name : null; - const menu2 = new LiteGraph.ContextMenu(options4, { + const menu2 = new LiteGraph.ContextMenu(options22, { event: e2, title, callback: inner_clicked.bind(this) }); - function inner_clicked(v2, options22, e3) { + function inner_clicked(v2, options222, e22) { switch (v2) { case "Add Node": - LGraphCanvas.onMenuAdd(null, null, e3, menu2, function(node22) { + LGraphCanvas.onMenuAdd(null, null, e22, menu2, function(node22) { if (!node22.inputs?.length || !node22.outputs?.length) return; const options32 = this.reroutesEnabled ? { afterRerouteId: segment.parentId } : void 0; if (node_left.connectByType(segment.origin_slot, node22, fromType, options32)) { @@ -63497,8 +63942,8 @@ class LGraphCanvas { }); break; case "Add Reroute": { - this.adjustMouseEvent(e3); - graph.createReroute([e3.canvasX, e3.canvasY], segment); + this.adjustMouseEvent(e22); + graph.createReroute([e22.canvasX, e22.canvasY], segment); this.setDirty(false, true); break; } @@ -63659,28 +64104,28 @@ class LGraphCanvas { console.warn("Cant get slot information " + slotX); return; } - const options4 = ["Add Node", null]; + const options22 = ["Add Node", null]; if (opts.allow_searchbox) { - options4.push("Search"); - options4.push(null); + options22.push("Search"); + options22.push(null); } const fromSlotType = slotX.type == LiteGraph.EVENT ? "_event_" : slotX.type; const slotTypesDefault = isFrom ? LiteGraph.slot_types_default_out : LiteGraph.slot_types_default_in; if (slotTypesDefault?.[fromSlotType]) { if (typeof slotTypesDefault[fromSlotType] == "object") { for (const typeX in slotTypesDefault[fromSlotType]) { - options4.push(slotTypesDefault[fromSlotType][typeX]); + options22.push(slotTypesDefault[fromSlotType][typeX]); } } else { - options4.push(slotTypesDefault[fromSlotType]); + options22.push(slotTypesDefault[fromSlotType]); } } - const menu2 = new LiteGraph.ContextMenu(options4, { + const menu2 = new LiteGraph.ContextMenu(options22, { event: opts.e, title: (slotX && slotX.name != "" ? slotX.name + (fromSlotType ? " | " : "") : "") + (slotX && fromSlotType ? fromSlotType : ""), callback: inner_clicked }); - function inner_clicked(v2, options22, e2) { + function inner_clicked(v2, options222, e2) { switch (v2) { case "Add Node": LGraphCanvas.onMenuAdd(null, null, e2, menu2, function(node22) { @@ -63725,8 +64170,8 @@ class LGraphCanvas { } }; const graphcanvas = LGraphCanvas.active_canvas; - const canvas = graphcanvas.canvas; - canvas.parentNode.appendChild(dialog); + const canvas2 = graphcanvas.canvas; + canvas2.parentNode.appendChild(dialog); if (this.ds.scale > 1) dialog.style.transform = "scale(" + this.ds.scale + ")"; let dialogCloseTimer = null; let prevent_timeout = 0; @@ -63787,7 +64232,7 @@ class LGraphCanvas { that.setDirty(true); dialog.close(); }); - const rect = canvas.getBoundingClientRect(); + const rect = canvas2.getBoundingClientRect(); let offsetx = -20; let offsety = -20; if (rect) { @@ -63798,26 +64243,26 @@ class LGraphCanvas { dialog.style.left = event.clientX + offsetx + "px"; dialog.style.top = event.clientY + offsety + "px"; } else { - dialog.style.left = canvas.width * 0.5 + offsetx + "px"; - dialog.style.top = canvas.height * 0.5 + offsety + "px"; + dialog.style.left = canvas2.width * 0.5 + offsetx + "px"; + dialog.style.top = canvas2.height * 0.5 + offsety + "px"; } setTimeout(function() { input.focus(); const clickTime = Date.now(); function handleOutsideClick(e2) { - if (e2.target === canvas && Date.now() - clickTime > 256) { + if (e2.target === canvas2 && Date.now() - clickTime > 256) { dialog.close(); - canvas.parentNode.removeEventListener("click", handleOutsideClick); - canvas.parentNode.removeEventListener("touchend", handleOutsideClick); + canvas2.parentNode.removeEventListener("click", handleOutsideClick); + canvas2.parentNode.removeEventListener("touchend", handleOutsideClick); } } __name(handleOutsideClick, "handleOutsideClick"); - canvas.parentNode.addEventListener("click", handleOutsideClick); - canvas.parentNode.addEventListener("touchend", handleOutsideClick); + canvas2.parentNode.addEventListener("click", handleOutsideClick); + canvas2.parentNode.addEventListener("touchend", handleOutsideClick); }, 10); return dialog; } - showSearchBox(event, options4) { + showSearchBox(event, options22) { const def_options = { slot_from: null, node_from: null, @@ -63834,15 +64279,15 @@ class LGraphCanvas { show_all_if_empty: true, show_all_on_open: LiteGraph.search_show_all_on_open }; - options4 = Object.assign(def_options, options4 || {}); + options22 = Object.assign(def_options, options22 || {}); const that = this; const graphcanvas = LGraphCanvas.active_canvas; - const canvas = graphcanvas.canvas; - const root_document = canvas.ownerDocument || document; + const canvas2 = graphcanvas.canvas; + const root_document = canvas2.ownerDocument || document; const dialog = document.createElement("div"); dialog.className = "litegraph litesearchbox graphdialog rounded"; dialog.innerHTML = "Search "; - if (options4.do_type_filter) { + if (options22.do_type_filter) { dialog.innerHTML += ""; dialog.innerHTML += ""; } @@ -63855,14 +64300,14 @@ class LGraphCanvas { } let selIn; let selOut; - if (options4.do_type_filter) { + if (options22.do_type_filter) { selIn = dialog.querySelector(".slot_in_type_filter"); selOut = dialog.querySelector(".slot_out_type_filter"); } dialog.close = function() { that.search_box = null; this.blur(); - canvas.focus(); + canvas2.focus(); root_document.body.style.overflow = ""; setTimeout(function() { that.canvas.focus(); @@ -63872,7 +64317,7 @@ class LGraphCanvas { if (this.ds.scale > 1) { dialog.style.transform = "scale(" + this.ds.scale + ")"; } - if (options4.hide_on_mouse_leave) { + if (options22.hide_on_mouse_leave) { let prevent_timeout = false; let timeout_close = null; LiteGraph.pointerListenerAdd(dialog, "enter", function() { @@ -63886,9 +64331,9 @@ class LGraphCanvas { return; timeout_close = setTimeout(function() { dialog.close(); - }, typeof options4.hide_on_mouse_leave === "number" ? options4.hide_on_mouse_leave : 500); + }, typeof options22.hide_on_mouse_leave === "number" ? options22.hide_on_mouse_leave : 500); }); - if (options4.do_type_filter) { + if (options22.do_type_filter) { selIn.addEventListener("click", function() { prevent_timeout++; }); @@ -63948,12 +64393,12 @@ class LGraphCanvas { return true; }); } - if (options4.do_type_filter) { + if (options22.do_type_filter) { if (selIn) { const aSlots = LiteGraph.slot_types_in; const nSlots = aSlots.length; - if (options4.type_filter_in == LiteGraph.EVENT || options4.type_filter_in == LiteGraph.ACTION) - options4.type_filter_in = "_event_"; + if (options22.type_filter_in == LiteGraph.EVENT || options22.type_filter_in == LiteGraph.ACTION) + options22.type_filter_in = "_event_"; for (let iK = 0; iK < nSlots; iK++) { const opt = document.createElement("option"); opt.value = aSlots[iK]; @@ -63961,7 +64406,7 @@ class LGraphCanvas { selIn.appendChild(opt); if ( // @ts-expect-error - options4.type_filter_in !== false && (options4.type_filter_in + "").toLowerCase() == (aSlots[iK] + "").toLowerCase() + options22.type_filter_in !== false && (options22.type_filter_in + "").toLowerCase() == (aSlots[iK] + "").toLowerCase() ) { opt.selected = true; } @@ -63973,14 +64418,14 @@ class LGraphCanvas { if (selOut) { const aSlots = LiteGraph.slot_types_out; const nSlots = aSlots.length; - if (options4.type_filter_out == LiteGraph.EVENT || options4.type_filter_out == LiteGraph.ACTION) - options4.type_filter_out = "_event_"; + if (options22.type_filter_out == LiteGraph.EVENT || options22.type_filter_out == LiteGraph.ACTION) + options22.type_filter_out = "_event_"; for (let iK = 0; iK < nSlots; iK++) { const opt = document.createElement("option"); opt.value = aSlots[iK]; opt.innerHTML = aSlots[iK]; selOut.appendChild(opt); - if (options4.type_filter_out !== false && (options4.type_filter_out + "").toLowerCase() == (aSlots[iK] + "").toLowerCase()) + if (options22.type_filter_out !== false && (options22.type_filter_out + "").toLowerCase() == (aSlots[iK] + "").toLowerCase()) opt.selected = true; } selOut.addEventListener("change", function() { @@ -63988,7 +64433,7 @@ class LGraphCanvas { }); } } - const rect = canvas.getBoundingClientRect(); + const rect = canvas2.getBoundingClientRect(); const left = (event ? event.clientX : rect.left + rect.width * 0.5) - 80; const top = (event ? event.clientY : rect.top + rect.height * 0.5) - 20; dialog.style.left = left + "px"; @@ -63998,7 +64443,7 @@ class LGraphCanvas { requestAnimationFrame(function() { input.focus(); }); - if (options4.show_all_on_open) refreshHelper(); + if (options22.show_all_on_open) refreshHelper(); function select(name2) { if (name2) { if (that.onSearchBoxSelection) { @@ -64043,47 +64488,47 @@ class LGraphCanvas { node22.configure(extra.data.json); } } - if (options4.node_from) { + if (options22.node_from) { let iS = false; - switch (typeof options4.slot_from) { + switch (typeof options22.slot_from) { case "string": - iS = options4.node_from.findOutputSlot(options4.slot_from); + iS = options22.node_from.findOutputSlot(options22.slot_from); break; case "object": - iS = options4.slot_from.name ? options4.node_from.findOutputSlot(options4.slot_from.name) : -1; - if (iS == -1 && typeof options4.slot_from.slot_index !== "undefined") iS = options4.slot_from.slot_index; + iS = options22.slot_from.name ? options22.node_from.findOutputSlot(options22.slot_from.name) : -1; + if (iS == -1 && typeof options22.slot_from.slot_index !== "undefined") iS = options22.slot_from.slot_index; break; case "number": - iS = options4.slot_from; + iS = options22.slot_from; break; default: iS = 0; } - if (typeof options4.node_from.outputs[iS] !== "undefined") { + if (typeof options22.node_from.outputs[iS] !== "undefined") { if (iS !== false && iS > -1) { - options4.node_from.connectByType(iS, node22, options4.node_from.outputs[iS].type); + options22.node_from.connectByType(iS, node22, options22.node_from.outputs[iS].type); } } } - if (options4.node_to) { + if (options22.node_to) { let iS = false; - switch (typeof options4.slot_from) { + switch (typeof options22.slot_from) { case "string": - iS = options4.node_to.findInputSlot(options4.slot_from); + iS = options22.node_to.findInputSlot(options22.slot_from); break; case "object": - iS = options4.slot_from.name ? options4.node_to.findInputSlot(options4.slot_from.name) : -1; - if (iS == -1 && typeof options4.slot_from.slot_index !== "undefined") iS = options4.slot_from.slot_index; + iS = options22.slot_from.name ? options22.node_to.findInputSlot(options22.slot_from.name) : -1; + if (iS == -1 && typeof options22.slot_from.slot_index !== "undefined") iS = options22.slot_from.slot_index; break; case "number": - iS = options4.slot_from; + iS = options22.slot_from; break; default: iS = 0; } - if (typeof options4.node_to.inputs[iS] !== "undefined") { + if (typeof options22.node_to.inputs[iS] !== "undefined") { if (iS !== false && iS > -1) { - options4.node_to.connectByTypeOutput(iS, node22, options4.node_to.inputs[iS].type); + options22.node_to.connectByTypeOutput(iS, node22, options22.node_to.inputs[iS].type); } } } @@ -64112,7 +64557,7 @@ class LGraphCanvas { let str = input.value; first2 = null; helper.innerHTML = ""; - if (!str && !options4.show_all_if_empty) return; + if (!str && !options22.show_all_if_empty) return; if (that.onSearchBox) { const list2 = that.onSearchBox(helper, str, graphcanvas); if (list2) { @@ -64131,9 +64576,9 @@ class LGraphCanvas { const opts = Object.assign(optsDef, optsIn); const ctor = LiteGraph.registered_node_types[type]; if (filter4 && ctor.filter != filter4) return false; - if ((!options4.show_all_if_empty || str) && type.toLowerCase().indexOf(str) === -1 && (!ctor.title || ctor.title.toLowerCase().indexOf(str) === -1)) + if ((!options22.show_all_if_empty || str) && type.toLowerCase().indexOf(str) === -1 && (!ctor.title || ctor.title.toLowerCase().indexOf(str) === -1)) return false; - if (options4.do_type_filter && !opts.skipFilter) { + if (options22.do_type_filter && !opts.skipFilter) { const sType = type; let sV = opts.inTypeOverride !== false ? opts.inTypeOverride : sIn.value; if (sIn && sV && LiteGraph.registered_slot_in_types[sV]?.nodes) { @@ -64154,13 +64599,13 @@ class LGraphCanvas { const filter4 = graphcanvas.filter || graphcanvas.graph.filter; let sIn = false; let sOut = false; - if (options4.do_type_filter && that.search_box) { + if (options22.do_type_filter && that.search_box) { sIn = that.search_box.querySelector(".slot_in_type_filter"); sOut = that.search_box.querySelector(".slot_out_type_filter"); } for (const i2 in LiteGraph.searchbox_extras) { const extra = LiteGraph.searchbox_extras[i2]; - if ((!options4.show_all_if_empty || str) && extra.desc.toLowerCase().indexOf(str) === -1) + if ((!options22.show_all_if_empty || str) && extra.desc.toLowerCase().indexOf(str) === -1) continue; const ctor = LiteGraph.registered_node_types[extra.type]; if (ctor && ctor.filter != filter4) continue; @@ -64185,7 +64630,7 @@ class LGraphCanvas { if (LGraphCanvas.search_limit !== -1 && c2++ > LGraphCanvas.search_limit) break; } - if (options4.show_general_after_typefiltered && (sIn.value || sOut.value)) { + if (options22.show_general_after_typefiltered && (sIn.value || sOut.value)) { filtered_extra = []; for (const i2 in LiteGraph.registered_node_types) { if (inner_test_filter(i2, { @@ -64200,7 +64645,7 @@ class LGraphCanvas { break; } } - if ((sIn.value || sOut.value) && helper.childNodes.length == 0 && options4.show_general_if_none_on_typefilter) { + if ((sIn.value || sOut.value) && helper.childNodes.length == 0 && options22.show_general_if_none_on_typefilter) { filtered_extra = []; for (const i2 in LiteGraph.registered_node_types) { if (inner_test_filter(i2, { skipFilter: true })) @@ -64241,9 +64686,9 @@ class LGraphCanvas { __name(refreshHelper, "refreshHelper"); return dialog; } - showEditPropertyValue(node22, property, options4) { + showEditPropertyValue(node22, property, options22) { if (!node22 || node22.properties[property] === void 0) return; - options4 = options4 || {}; + options22 = options22 || {}; const info = node22.getPropertyInfo(property); const type = info.type; let input_html = ""; @@ -64264,7 +64709,7 @@ class LGraphCanvas { } const dialog = this.createDialog( "" + (info.label || property) + "" + input_html + "", - options4 + options22 ); let input; if ((type == "enum" || type == "combo") && info.values) { @@ -64325,7 +64770,7 @@ class LGraphCanvas { node22.graph._version++; } node22.onPropertyChanged?.(property, value4); - options4.onclose?.(); + options22.onclose?.(); dialog.close(); this.setDirty(true, true); } @@ -64333,13 +64778,13 @@ class LGraphCanvas { return dialog; } // TODO refactor, theer are different dialog, some uses createDialog, some dont - createDialog(html, options4) { + createDialog(html, options22) { const def_options = { checkForInput: false, closeOnLeave: true, closeOnLeave_checkModified: true }; - options4 = Object.assign(def_options, options4 || {}); + options22 = Object.assign(def_options, options22 || {}); const dialog = document.createElement("div"); dialog.className = "graphdialog"; dialog.innerHTML = html; @@ -64351,12 +64796,12 @@ class LGraphCanvas { offsetx -= rect.left; offsety -= rect.top; } - if (options4.position) { - offsetx += options4.position[0]; - offsety += options4.position[1]; - } else if (options4.event) { - offsetx += options4.event.clientX; - offsety += options4.event.clientY; + if (options22.position) { + offsetx += options22.position[0]; + offsety += options22.position[1]; + } else if (options22.event) { + offsetx += options22.event.clientX; + offsety += options22.event.clientY; } else { offsetx += this.canvas.width * 0.5; offsety += this.canvas.height * 0.5; @@ -64364,7 +64809,7 @@ class LGraphCanvas { dialog.style.left = offsetx + "px"; dialog.style.top = offsety + "px"; this.canvas.parentNode.appendChild(dialog); - if (options4.checkForInput) { + if (options22.checkForInput) { const aI = dialog.querySelectorAll("input"); aI?.forEach(function(iX) { iX.addEventListener("keydown", function(e2) { @@ -64397,7 +64842,7 @@ class LGraphCanvas { ); }); dialog.addEventListener("mouseenter", function() { - if (options4.closeOnLeave || LiteGraph.dialog_close_on_mouse_leave) { + if (options22.closeOnLeave || LiteGraph.dialog_close_on_mouse_leave) { if (dialogCloseTimer) clearTimeout(dialogCloseTimer); } }); @@ -64415,18 +64860,18 @@ class LGraphCanvas { }); return dialog; } - createPanel(title, options4) { - options4 = options4 || {}; - const ref_window = options4.window || window; + createPanel(title, options22) { + options22 = options22 || {}; + const ref_window = options22.window || window; const root29 = document.createElement("div"); root29.className = "litegraph dialog"; root29.innerHTML = "
"; root29.header = root29.querySelector(".dialog-header"); - if (options4.width) - root29.style.width = options4.width + (typeof options4.width === "number" ? "px" : ""); - if (options4.height) - root29.style.height = options4.height + (typeof options4.height === "number" ? "px" : ""); - if (options4.closable) { + if (options22.width) + root29.style.width = options22.width + (typeof options22.width === "number" ? "px" : ""); + if (options22.height) + root29.style.height = options22.height + (typeof options22.height === "number" ? "px" : ""); + if (options22.closable) { const close5 = document.createElement("span"); close5.innerHTML = "✕"; close5.classList.add("close"); @@ -64478,10 +64923,10 @@ class LGraphCanvas { else root29.content.appendChild(elem); return elem; }; - root29.addButton = function(name2, callback, options22) { + root29.addButton = function(name2, callback, options222) { const elem = document.createElement("button"); elem.innerText = name2; - elem.options = options22; + elem.options = options222; elem.classList.add("btn"); elem.addEventListener("click", callback); root29.footer.appendChild(elem); @@ -64492,20 +64937,20 @@ class LGraphCanvas { elem.className = "separator"; root29.content.appendChild(elem); }; - root29.addWidget = function(type, name2, value4, options22, callback) { - options22 = options22 || {}; + root29.addWidget = function(type, name2, value4, options222, callback) { + options222 = options222 || {}; let str_value = String(value4); type = type.toLowerCase(); if (type == "number") str_value = value4.toFixed(3); const elem = document.createElement("div"); elem.className = "property"; elem.innerHTML = ""; - elem.querySelector(".property_name").innerText = options22.label || name2; + elem.querySelector(".property_name").innerText = options222.label || name2; const value_element = elem.querySelector(".property_value"); value_element.innerText = str_value; elem.dataset["property"] = name2; - elem.dataset["type"] = options22.type || type; - elem.options = options22; + elem.dataset["type"] = options222.type || type; + elem.options = options222; elem.value = value4; if (type == "code") elem.addEventListener("click", function() { @@ -64537,10 +64982,10 @@ class LGraphCanvas { innerChange(propname, v2); }); } else if (type == "enum" || type == "combo") { - const str_value2 = LGraphCanvas.getPropertyPrintableValue(value4, options22.values); + const str_value2 = LGraphCanvas.getPropertyPrintableValue(value4, options222.values); value_element.innerText = str_value2; value_element.addEventListener("click", function(event) { - const values = options22.values || []; + const values = options222.values || []; const propname = this.parentNode.dataset["property"]; const elem_that = this; new LiteGraph.ContextMenu( @@ -64563,8 +65008,8 @@ class LGraphCanvas { } root29.content.appendChild(elem); function innerChange(name22, value22) { - options22.callback?.(name22, value22, options22); - callback?.(name22, value22, options22); + options222.callback?.(name22, value22, options222); + callback?.(name22, value22, options222); } __name(innerChange, "innerChange"); return elem; @@ -64698,11 +65143,11 @@ class LGraphCanvas { } } getCanvasMenuOptions() { - let options4 = null; + let options22 = null; if (this.getMenuOptions) { - options4 = this.getMenuOptions(); + options22 = this.getMenuOptions(); } else { - options4 = [ + options22 = [ { content: "Add Node", has_submenu: true, @@ -64714,23 +65159,23 @@ class LGraphCanvas { // {content:"Collapse All", callback: LGraphCanvas.onMenuCollapseAll } ]; if (Object.keys(this.selected_nodes).length > 1) { - options4.push({ + options22.push({ content: "Align", has_submenu: true, callback: LGraphCanvas.onGroupAlign }); } } - const extra = this.getExtraMenuOptions?.(this, options4); - return Array.isArray(extra) ? options4.concat(extra) : options4; + const extra = this.getExtraMenuOptions?.(this, options22); + return Array.isArray(extra) ? options22.concat(extra) : options22; } // called by processContextMenu to extract the menu list getNodeMenuOptions(node22) { - let options4 = null; + let options22 = null; if (node22.getMenuOptions) { - options4 = node22.getMenuOptions(this); + options22 = node22.getMenuOptions(this); } else { - options4 = [ + options22 = [ { content: "Inputs", has_submenu: true, @@ -64751,8 +65196,8 @@ class LGraphCanvas { }, { content: "Properties Panel", - callback: /* @__PURE__ */ __name(function(item3, options22, e2, menu2, node3) { - LGraphCanvas.active_canvas.showShowNodePanel(node3); + callback: /* @__PURE__ */ __name(function(item3, options222, e2, menu2, node222) { + LGraphCanvas.active_canvas.showShowNodePanel(node222); }, "callback") }, null, @@ -64767,31 +65212,31 @@ class LGraphCanvas { } ]; if (node22.resizable !== false) { - options4.push({ + options22.push({ content: "Resize", callback: LGraphCanvas.onMenuResizeNode }); } if (node22.collapsible) { - options4.push({ + options22.push({ content: node22.collapsed ? "Expand" : "Collapse", callback: LGraphCanvas.onMenuNodeCollapse }); } if (node22.widgets?.some((w2) => w2.advanced)) { - options4.push({ + options22.push({ content: node22.showAdvanced ? "Hide Advanced" : "Show Advanced", callback: LGraphCanvas.onMenuToggleAdvanced }); } - options4.push( + options22.push( { content: node22.pinned ? "Unpin" : "Pin", callback: /* @__PURE__ */ __name((...args) => { LGraphCanvas.onMenuNodePin(...args); for (const i2 in this.selected_nodes) { - const node3 = this.selected_nodes[i2]; - node3.pin(); + const node222 = this.selected_nodes[i2]; + node222.pin(); } this.setDirty(true, true); }, "callback") @@ -64810,39 +65255,39 @@ class LGraphCanvas { ); } const inputs = node22.onGetInputs?.(); - if (inputs?.length) options4[0].disabled = false; + if (inputs?.length) options22[0].disabled = false; const outputs = node22.onGetOutputs?.(); - if (outputs?.length) options4[1].disabled = false; - const extra = node22.getExtraMenuOptions?.(this, options4); + if (outputs?.length) options22[1].disabled = false; + const extra = node22.getExtraMenuOptions?.(this, options22); if (Array.isArray(extra) && extra.length > 0) { extra.push(null); - options4 = extra.concat(options4); + options22 = extra.concat(options22); } if (node22.clonable !== false) { - options4.push({ + options22.push({ content: "Clone", callback: LGraphCanvas.onMenuNodeClone }); } if (Object.keys(this.selected_nodes).length > 1) { - options4.push({ + options22.push({ content: "Align Selected To", has_submenu: true, callback: LGraphCanvas.onNodeAlign }); - options4.push({ + options22.push({ content: "Distribute Nodes", has_submenu: true, callback: LGraphCanvas.createDistributeMenu }); } - options4.push(null, { + options22.push(null, { content: "Remove", disabled: !(node22.removable !== false && !node22.block_delete), callback: LGraphCanvas.onMenuNodeRemove }); - node22.graph?.onGetNodeMenuOptions?.(options4, node22); - return options4; + node22.graph?.onGetNodeMenuOptions?.(options22, node22); + return options22; } getGroupMenuOptions(group) { console.warn("LGraphCanvas.getGroupMenuOptions is deprecated, use LGraphGroup.getMenuOptions instead"); @@ -64850,15 +65295,15 @@ class LGraphCanvas { } processContextMenu(node22, event) { const that = this; - const canvas = LGraphCanvas.active_canvas; - const ref_window = canvas.getCanvasWindow(); + const canvas2 = LGraphCanvas.active_canvas; + const ref_window = canvas2.getCanvasWindow(); let menu_info = null; - const options4 = { + const options22 = { event, callback: inner_option_clicked, extra: node22 }; - if (node22) options4.title = node22.type; + if (node22) options22.title = node22.type; let slot = null; if (node22) { slot = node22.getSlotInPosition(event.canvasX, event.canvasY); @@ -64879,12 +65324,15 @@ class LGraphCanvas { } if (!_slot.nameLocked) menu_info.push({ content: "Rename Slot", slot }); + if (node22.getExtraSlotMenuOptions) { + menu_info.push(...node22.getExtraSlotMenuOptions(slot)); + } } - options4.title = (slot.input ? slot.input.type : slot.output.type) || "*"; + options22.title = (slot.input ? slot.input.type : slot.output.type) || "*"; if (slot.input && slot.input.type == LiteGraph.ACTION) - options4.title = "Action"; + options22.title = "Action"; if (slot.output && slot.output.type == LiteGraph.EVENT) - options4.title = "Event"; + options22.title = "Event"; } else if (node22) { menu_info = this.getNodeMenuOptions(node22); } else { @@ -64915,8 +65363,8 @@ class LGraphCanvas { } } if (!menu_info) return; - new LiteGraph.ContextMenu(menu_info, options4, ref_window); - function inner_option_clicked(v2, options22) { + new LiteGraph.ContextMenu(menu_info, options22, ref_window); + function inner_option_clicked(v2, options222) { if (!v2) return; if (v2.content == "Remove Slot") { const info = v2.slot; @@ -64943,7 +65391,7 @@ class LGraphCanvas { const slot_info = info.input ? node22.getInputInfo(info.slot) : node22.getOutputInfo(info.slot); const dialog = that.createDialog( "Name", - options22 + options222 ); const input = dialog.querySelector("input"); if (input && slot_info) { @@ -65033,9 +65481,9 @@ class LGraphCanvas { * Fits the view to the selected nodes with animation. * If nothing is selected, the view is fitted around all items in the graph. */ - fitViewToSelectionAnimated(options4 = {}) { + fitViewToSelectionAnimated(options22 = {}) { const items2 = this.selectedItems.size ? Array.from(this.selectedItems) : this.positionableItems; - this.animateToBounds(createBounds(items2), options4); + this.animateToBounds(createBounds(items2), options22); } } class MapProxyHandler { @@ -65131,7 +65579,6 @@ let LGraph$1 = class LGraph2 { execution_time; _last_trigger_time; filter; - _subgraph_node; /** Must contain serialisable values, e.g. primitive types */ config; vars; @@ -65273,10 +65720,10 @@ let LGraph$1 = class LGraph2 { */ detachCanvas(graphcanvas) { if (!this.list_of_graphcanvas) return; - const pos2 = this.list_of_graphcanvas.indexOf(graphcanvas); - if (pos2 == -1) return; + const pos = this.list_of_graphcanvas.indexOf(graphcanvas); + if (pos == -1) return; graphcanvas.graph = null; - this.list_of_graphcanvas.splice(pos2, 1); + this.list_of_graphcanvas.splice(pos, 1); } /** * Starts running this graph every interval milliseconds. @@ -65572,12 +66019,6 @@ let LGraph$1 = class LGraph2 { if (!nodes) return; for (let j2 = 0, l2 = nodes.length; j2 < l2; ++j2) { const node22 = nodes[j2]; - if (node22.constructor === LiteGraph.Subgraph && eventname != "onExecute") { - if (node22.mode == mode2) { - node22.sendEventToAllNodes(eventname, params, mode2); - } - continue; - } if (!node22[eventname] || node22.mode != mode2) continue; if (params === void 0) { node22[eventname](); @@ -65691,13 +66132,13 @@ let LGraph$1 = class LGraph2 { this._version++; if (this.list_of_graphcanvas) { for (let i2 = 0; i2 < this.list_of_graphcanvas.length; ++i2) { - const canvas = this.list_of_graphcanvas[i2]; - if (canvas.selected_nodes[node22.id]) - delete canvas.selected_nodes[node22.id]; + const canvas2 = this.list_of_graphcanvas[i2]; + if (canvas2.selected_nodes[node22.id]) + delete canvas2.selected_nodes[node22.id]; } } - const pos2 = this._nodes.indexOf(node22); - if (pos2 != -1) this._nodes.splice(pos2, 1); + const pos = this._nodes.indexOf(node22); + if (pos != -1) this._nodes.splice(pos, 1); delete this._nodes_by_id[node22.id]; this.onNodeRemoved?.(node22); this.canvasAction((c2) => c2.checkPanels()); @@ -65809,8 +66250,8 @@ let LGraph$1 = class LGraph2 { */ getRerouteOnPos(x2, y2) { for (const reroute of this.reroutes.values()) { - const { pos: pos2 } = reroute; - if (isSortaInsideOctagon(x2 - pos2[0], y2 - pos2[1], 2 * Reroute.radius)) + const { pos } = reroute; + if (isSortaInsideOctagon(x2 - pos[0], y2 - pos[1], 2 * Reroute.radius)) return reroute; } } @@ -65860,7 +66301,7 @@ let LGraph$1 = class LGraph2 { this.updateExecutionOrder(); } // ********** GLOBALS ***************** - onAction(action, param, options4) { + onAction(action, param, options22) { this._input_nodes = this.findNodesByClass( // @ts-expect-error Never impl. LiteGraph.GraphInput, @@ -65869,7 +66310,7 @@ let LGraph$1 = class LGraph2 { for (let i2 = 0; i2 < this._input_nodes.length; ++i2) { const node22 = this._input_nodes[i2]; if (node22.properties.name != action) continue; - node22.actionDo(action, param, options4); + node22.actionDo(action, param, options22); break; } } @@ -66061,11 +66502,11 @@ let LGraph$1 = class LGraph2 { * Creates the object if it does not exist. * @param serialisedReroute See {@link SerialisableReroute} */ - setReroute({ id: id3, parentId, pos: pos2, linkIds }) { + setReroute({ id: id3, parentId, pos, linkIds }) { id3 ??= ++this.state.lastRerouteId; if (id3 > this.state.lastRerouteId) this.state.lastRerouteId = id3; const reroute = this.reroutes.get(id3) ?? new Reroute(id3, this); - reroute.update(parentId, pos2, linkIds); + reroute.update(parentId, pos, linkIds); this.reroutes.set(id3, reroute); return reroute; } @@ -66076,10 +66517,10 @@ let LGraph$1 = class LGraph2 { * going from the node output to input. * @returns The newly created reroute - typically ignored. */ - createReroute(pos2, before) { + createReroute(pos, before) { const rerouteId = ++this.state.lastRerouteId; const linkIds = before instanceof Reroute ? before.linkIds : [before.id]; - const reroute = new Reroute(rerouteId, this, pos2, before.parentId, linkIds); + const reroute = new Reroute(rerouteId, this, pos, before.parentId, linkIds); this.reroutes.set(rerouteId, reroute); for (const linkId of linkIds) { const link2 = this._links.get(linkId); @@ -66150,9 +66591,9 @@ let LGraph$1 = class LGraph2 { * Mutating the properties of the return object may result in changes to your graph. * It is intended for use with {@link structuredClone} or {@link JSON.stringify}. */ - asSerialisable(options4) { + asSerialisable(options22) { const { config: config2, state, extra } = this; - const nodeList = !LiteGraph.use_uuids && options4?.sortNodes ? [...this._nodes].sort((a2, b2) => a2.id - b2.id) : this._nodes; + const nodeList = !LiteGraph.use_uuids && options22?.sortNodes ? [...this._nodes].sort((a2, b2) => a2.id - b2.id) : this._nodes; const nodes = nodeList.map((node22) => node22.serialize()); const groups = this._groups.map((x2) => x2.serialize()); const links = [...this._links.values()].map((x2) => x2.asSerialisable()); @@ -66311,31 +66752,31 @@ class ContextMenu { * - ignore_item_callbacks: ignores the callback inside the item, it just calls the options.callback * - event: you can pass a MouseEvent, this way the ContextMenu appears in that position */ - constructor(values, options4) { - options4 ||= {}; - this.options = options4; - const parent = options4.parentMenu; + constructor(values, options22) { + options22 ||= {}; + this.options = options22; + const parent = options22.parentMenu; if (parent) { if (!(parent instanceof ContextMenu)) { console.error("parentMenu must be of class ContextMenu, ignoring it"); - options4.parentMenu = null; + options22.parentMenu = null; } else { this.parentMenu = parent; this.parentMenu.lock = true; this.parentMenu.current_submenu = this; } if (parent.options?.className === "dark") { - options4.className = "dark"; + options22.className = "dark"; } } - const eventClass = options4.event ? options4.event.constructor.name : null; + const eventClass = options22.event ? options22.event.constructor.name : null; if (eventClass !== "MouseEvent" && eventClass !== "CustomEvent" && eventClass !== "PointerEvent") { console.error(`Event passed to ContextMenu is not of type MouseEvent or CustomEvent. Ignoring it. (${eventClass})`); - options4.event = null; + options22.event = null; } const root29 = document.createElement("div"); let classes2 = "litegraph litecontextmenu litemenubar-panel"; - if (options4.className) classes2 += " " + options4.className; + if (options22.className) classes2 += " " + options22.className; root29.className = classes2; root29.style.minWidth = "100"; root29.style.minHeight = "100"; @@ -66374,10 +66815,10 @@ class ContextMenu { true ); this.root = root29; - if (options4.title) { + if (options22.title) { const element = document.createElement("div"); element.className = "litemenu-title"; - element.innerHTML = options4.title; + element.innerHTML = options22.title; root29.appendChild(element); } for (let i2 = 0; i2 < values.length; i2++) { @@ -66386,25 +66827,25 @@ class ContextMenu { if (typeof name2 !== "string") { name2 = name2 != null ? name2.content === void 0 ? String(name2) : name2.content : name2; } - this.addItem(name2, value4, options4); + this.addItem(name2, value4, options22); } LiteGraph.pointerListenerAdd(root29, "enter", function() { if (root29.closing_timer) { clearTimeout(root29.closing_timer); } }); - const ownerDocument = (options4.event?.target).ownerDocument; + const ownerDocument = (options22.event?.target).ownerDocument; const root_document = ownerDocument || document; if (root_document.fullscreenElement) root_document.fullscreenElement.appendChild(root29); else root_document.body.appendChild(root29); - let left = options4.left || 0; - let top = options4.top || 0; - if (options4.event) { - left = options4.event.clientX - 10; - top = options4.event.clientY - 10; - if (options4.title) top -= 20; + let left = options22.left || 0; + let top = options22.top || 0; + if (options22.event) { + left = options22.event.clientX - 10; + top = options22.event.clientY - 10; + if (options22.title) top -= 20; if (parent) { const rect = parent.root.getBoundingClientRect(); left = rect.left + rect.width; @@ -66420,12 +66861,12 @@ class ContextMenu { } root29.style.left = left + "px"; root29.style.top = top + "px"; - if (LiteGraph.context_menu_scaling && options4.scale) { - root29.style.transform = `scale(${Math.round(options4.scale * 4) * 0.25})`; + if (LiteGraph.context_menu_scaling && options22.scale) { + root29.style.transform = `scale(${Math.round(options22.scale * 4) * 0.25})`; } } - addItem(name2, value4, options4) { - options4 ||= {}; + addItem(name2, value4, options22) { + options22 ||= {}; const element = document.createElement("div"); element.className = "litemenu-entry submenu"; let disabled2 = false; @@ -66459,7 +66900,7 @@ class ContextMenu { } this.root.appendChild(element); if (!disabled2) element.addEventListener("click", inner_onclick); - if (!disabled2 && options4.autoopen) + if (!disabled2 && options22.autoopen) LiteGraph.pointerListenerAdd(element, "enter", inner_over); const setAriaExpanded = /* @__PURE__ */ __name(() => { const entries = this.root.querySelectorAll("div.litemenu-entry.has_submenu"); @@ -66485,26 +66926,26 @@ class ContextMenu { if (value22?.has_submenu || value22?.submenu) { setAriaExpanded(); } - if (options4.callback) { - const r2 = options4.callback.call( + if (options22.callback) { + const r2 = options22.callback.call( this, value22, - options4, + options22, e2, that, - options4.node + options22.node ); if (r2 === true) close_parent = false; } if (typeof value22 === "object") { - if (value22.callback && !options4.ignore_item_callbacks && value22.disabled !== true) { + if (value22.callback && !options22.ignore_item_callbacks && value22.disabled !== true) { const r2 = value22.callback.call( this, value22, - options4, + options22, e2, that, - options4.extra + options22.extra ); if (r2 === true) close_parent = false; } @@ -66517,7 +66958,7 @@ class ContextMenu { ignore_item_callbacks: value22.submenu.ignore_item_callbacks, title: value22.submenu.title, extra: value22.submenu.extra, - autoopen: options4.autoopen + autoopen: options22.autoopen }); close_parent = false; } @@ -66648,9 +67089,9 @@ class CurveEditor { const h2 = this.size[1] - this.margin * 2; const x2 = localpos[0] - this.margin; const y2 = localpos[1] - this.margin; - const pos2 = [x2, y2]; + const pos = [x2, y2]; const max_dist = 30 / graphcanvas.ds.scale; - this.selected = this.getCloserPoint(pos2, max_dist); + this.selected = this.getCloserPoint(pos, max_dist); if (this.selected == -1) { const point = [x2 / w2, 1 - y2 / h2]; points.push(point); @@ -66698,7 +67139,7 @@ class CurveEditor { this.selected = -1; return false; } - getCloserPoint(pos2, max_dist) { + getCloserPoint(pos, max_dist) { const points = this.points; if (!points) return -1; max_dist = max_dist || 30; @@ -66712,7 +67153,7 @@ class CurveEditor { const p3 = points[i2]; p2[0] = p3[0] * w2; p2[1] = (1 - p3[1]) * h2; - const dist3 = distance(pos2, p2); + const dist3 = distance(pos, p2); if (dist3 > min_dist || dist3 > max_dist) continue; closest = i2; min_dist = dist3; @@ -66771,6 +67212,7 @@ class LiteGraphGlobal { DEFAULT_POSITION = [100, 100]; /** ,"circle" */ VALID_SHAPES = ["default", "box", "round", "card"]; + ROUND_RADIUS = 8; // shapes are used for nodes but also for slots BOX_SHAPE = RenderShape.BOX; ROUND_SHAPE = RenderShape.ROUND; @@ -66969,8 +67411,8 @@ class LiteGraphGlobal { base_class.type = type; if (this.debug) console.log("Node registered: " + type); const classname = base_class.name; - const pos2 = type.lastIndexOf("/"); - base_class.category = type.substring(0, pos2); + const pos = type.lastIndexOf("/"); + base_class.category = type.substring(0, pos); base_class.title ||= classname; for (const i2 in LGraphNode.prototype) { base_class.prototype[i2] ||= LGraphNode.prototype[i2]; @@ -66979,44 +67421,6 @@ class LiteGraphGlobal { if (prev2) { console.log("replacing node type: " + type); } - if (!Object.prototype.hasOwnProperty.call(base_class.prototype, "shape")) { - Object.defineProperty(base_class.prototype, "shape", { - set(v2) { - switch (v2) { - case "default": - delete this._shape; - break; - case "box": - this._shape = RenderShape.BOX; - break; - case "round": - this._shape = RenderShape.ROUND; - break; - case "circle": - this._shape = RenderShape.CIRCLE; - break; - case "card": - this._shape = RenderShape.CARD; - break; - default: - this._shape = v2; - } - }, - get() { - return this._shape; - }, - enumerable: true, - configurable: true - }); - if (base_class.supported_extensions) { - for (const i2 in base_class.supported_extensions) { - const ext = base_class.supported_extensions[i2]; - if (ext && typeof ext === "string") { - this.node_types_by_file_extension[ext.toLowerCase()] = base_class; - } - } - } - } this.registered_node_types[type] = base_class; if (base_class.constructor.name) this.Nodes[classname] = base_class; this.onNodeTypeRegistered?.(type, base_class); @@ -67068,41 +67472,6 @@ class LiteGraphGlobal { } } } - /** - * Create a new nodetype by passing a function, it wraps it with a proper class and - * generates inputs according to the parameters of the function. - * Useful to wrap simple methods that do not require properties, and that only process some input to generate an output. - * @param name node name with namespace (p.e.: 'math/sum') - * @param func - * @param param_types [optional] an array containing the type of every parameter, - * otherwise parameters will accept any type - * @param return_type [optional] string with the return type, otherwise it will be generic - * @param properties [optional] properties to be configurable - */ - wrapFunctionAsNode(name2, func, param_types, return_type, properties) { - const params = Array(func.length); - let code2 = ""; - const names = this.getParameterNames(func); - for (let i2 = 0; i2 < names.length; ++i2) { - code2 += `this.addInput('${names[i2]}',${param_types && param_types[i2] ? `'${param_types[i2]}'` : "0"}); -`; - } - code2 += `this.addOutput('out',${return_type ? `'${return_type}'` : 0}); -`; - if (properties) code2 += `this.properties = ${JSON.stringify(properties)}; -`; - const classobj = Function(code2); - classobj.title = name2.split("/").pop(); - classobj.desc = "Generated from " + func.name; - classobj.prototype.onExecute = /* @__PURE__ */ __name(function onExecute() { - for (let i2 = 0; i2 < params.length; ++i2) { - params[i2] = this.getInputData(i2); - } - const r2 = func.apply(this, params); - this.setOutputData(0, r2); - }, "onExecute"); - this.registerNodeType(name2, classobj); - } /** * Removes all previously registered node's types */ @@ -67131,7 +67500,7 @@ class LiteGraphGlobal { * @param title a name to distinguish from other nodes * @param options to set options */ - createNode(type, title, options4) { + createNode(type, title, options22) { const base_class = this.registered_node_types[type]; if (!base_class) { if (this.debug) console.log(`GraphNode type "${type}" not registered.`); @@ -67157,9 +67526,9 @@ class LiteGraphGlobal { node22.size ||= node22.computeSize(); node22.pos ||= this.DEFAULT_POSITION.concat(); node22.mode ||= LGraphEventMode.ALWAYS; - if (options4) { - for (const i2 in options4) { - node22[i2] = options4[i2]; + if (options22) { + for (const i2 in options22) { + node22[i2] = options22[i2]; } } node22.onNodeCreated?.(); @@ -67299,54 +67668,6 @@ class LiteGraphGlobal { data: data26 }; } - /** - * Wrapper to load files (from url using fetch or from file using FileReader) - * @param url the url of the file (or the file itself) - * @param type an string to know how to fetch it: "text","arraybuffer","json","blob" - * @param on_complete callback(data) - * @param on_error in case of an error - * @returns returns the object used to - */ - fetchFile(url, type, on_complete, on_error) { - if (!url) return null; - type = type || "text"; - if (typeof url === "string") { - if (url.substr(0, 4) == "http" && this.proxy) - url = this.proxy + url.substr(url.indexOf(":") + 3); - return fetch(url).then(function(response) { - if (!response.ok) - throw new Error("File not found"); - if (type == "arraybuffer") - return response.arrayBuffer(); - else if (type == "text" || type == "string") - return response.text(); - else if (type == "json") - return response.json(); - else if (type == "blob") - return response.blob(); - }).then(function(data26) { - on_complete?.(data26); - }).catch(function(error2) { - console.error("error fetching file:", url); - on_error?.(error2); - }); - } else if (url instanceof File || url instanceof Blob) { - const reader = new FileReader(); - reader.onload = function(e2) { - let v2 = e2.target.result; - if (type == "json") - v2 = JSON.parse(v2); - on_complete?.(v2); - }; - if (type == "arraybuffer") - return reader.readAsArrayBuffer(url); - else if (type == "text" || type == "json") - return reader.readAsText(url); - else if (type == "blob") - return reader.readAsBinaryString(url); - } - return null; - } // used to create nodes from wrapping functions getParameterNames(func) { return (func + "").replace(/[/][/].*$/gm, "").replace(/\s+/g, "").replace(/[/][*][^/*]*[*][/]/g, "").split("){", 1)[0].replace(/^[^(]*[(]/, "").replace(/=[^,]+/g, "").split(",").filter(Boolean); @@ -72536,6 +72857,16 @@ function inputSpec(spec, allowUpcast = true) { ]); } __name(inputSpec, "inputSpec"); +const zRemoteWidgetConfig = z.object({ + route: z.string().url().or(z.string().startsWith("/")), + refresh: z.number().gte(128).safe().or(z.number().lte(0).safe()).optional(), + response_key: z.string().optional(), + query_params: z.record(z.string(), z.string()).optional(), + refresh_button: z.boolean().optional(), + control_after_refresh: z.enum(["first", "last"]).optional(), + timeout: z.number().gte(0).optional(), + max_retries: z.number().gte(0).optional() +}); const zBaseInputSpecValue = z.object({ default: z.any().optional(), defaultInput: z.boolean().optional(), @@ -72554,7 +72885,12 @@ const zIntInputSpec = inputSpec([ step: z.number().optional(), // Note: Many node authors are using INT to pass list of INT. // TODO: Add list of ints type. - default: z.union([z.number(), z.array(z.number())]).optional() + default: z.union([z.number(), z.array(z.number())]).optional(), + /** + * If true, a linked widget will be added to the node to select the mode + * of `control_after_generate`. + */ + control_after_generate: z.boolean().optional() }) ]); const zFloatInputSpec = inputSpec([ @@ -72588,17 +72924,26 @@ const zStringInputSpec = inputSpec([ placeholder: z.string().optional() }) ]); +const zComboInputProps = zBaseInputSpecValue.extend({ + control_after_generate: z.boolean().optional(), + image_upload: z.boolean().optional(), + image_folder: z.enum(["input", "output", "temp"]).optional(), + remote: zRemoteWidgetConfig.optional() +}); const zComboInputSpec = inputSpec( - [ - z.array(z.any()), - zBaseInputSpecValue.extend({ - control_after_generate: z.boolean().optional(), - image_upload: z.boolean().optional() - }) - ], + [z.array(z.any()), zComboInputProps], /* allowUpcast=*/ false ); +const zComboInputSpecV2 = inputSpec( + [z.literal("COMBO"), zComboInputProps], + /* allowUpcast=*/ + false +); +function isComboInputSpecV1(inputSpec2) { + return Array.isArray(inputSpec2[0]); +} +__name(isComboInputSpecV1, "isComboInputSpecV1"); const excludedLiterals = /* @__PURE__ */ new Set(["INT", "FLOAT", "BOOLEAN", "STRING", "COMBO"]); const zCustomInputSpec = inputSpec([ z.string().refine((value4) => !excludedLiterals.has(value4)), @@ -72610,6 +72955,7 @@ const zInputSpec = z.union([ zBooleanInputSpec, zStringInputSpec, zComboInputSpec, + zComboInputSpecV2, zCustomInputSpec ]); const zComfyInputsSpec = z.object({ @@ -72794,7 +73140,8 @@ const zSettings = z.record(z.any()).and( "Comfy.Server.LaunchArgs": z.record(z.string(), z.string()), "LiteGraph.Canvas.MaximumFps": z.number(), "Comfy.Workflow.ConfirmDelete": z.boolean(), - "Comfy.RerouteBeta": z.boolean() + "Comfy.RerouteBeta": z.boolean(), + "LiteGraph.Canvas.LowQualityRenderingZoomThreshold": z.number() }).optional() ); class ComfyApi extends EventTarget { @@ -73523,7 +73870,7 @@ const router = createRouter({ { path: "", name: "GraphView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./GraphView-D9ZzDQZV.js"), true ? __vite__mapDeps([0,1,2,3,4,5]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./GraphView-CLFBgoGf.js"), true ? __vite__mapDeps([0,1,2,3,4,5,6]) : void 0, import.meta.url), "component"), beforeEnter: /* @__PURE__ */ __name(async (to, from2, next2) => { const userStore = useUserStore(); await userStore.initialize(); @@ -73537,60 +73884,66 @@ const router = createRouter({ { path: "user-select", name: "UserSelectView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./UserSelectView-wxa07xPk.js"), true ? __vite__mapDeps([6,7]) : void 0, import.meta.url), "component") + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./UserSelectView-CRPNAEVJ.js"), true ? __vite__mapDeps([7,8]) : void 0, import.meta.url), "component") }, { path: "server-start", name: "ServerStartView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ServerStartView-BpH4TXPO.js"), true ? __vite__mapDeps([8,7,9]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ServerStartView-BENqs5bD.js"), true ? __vite__mapDeps([9,8,10]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "install", name: "InstallView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./InstallView-CVZcZZXJ.js"), true ? __vite__mapDeps([10,11,12,7,13]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./InstallView-x9XCq0hC.js"), true ? __vite__mapDeps([11,12,13,8,14]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "welcome", name: "WelcomeView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./WelcomeView-BrXELNIm.js"), true ? __vite__mapDeps([14,7,15]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./WelcomeView-Cvtvw05C.js"), true ? __vite__mapDeps([15,8,16]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "not-supported", name: "NotSupportedView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./NotSupportedView-BUpntA4x.js"), true ? __vite__mapDeps([16,7,17]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./NotSupportedView-BzM0uuqA.js"), true ? __vite__mapDeps([17,8,18]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "download-git", name: "DownloadGitView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DownloadGitView-DVXUne-M.js"), true ? __vite__mapDeps([18,7]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DownloadGitView-SPK8AXQU.js"), true ? __vite__mapDeps([19,8]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "manual-configuration", name: "ManualConfigurationView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ManualConfigurationView-Cz0_f_T-.js"), true ? __vite__mapDeps([19,7,20]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ManualConfigurationView-D3on5kXY.js"), true ? __vite__mapDeps([20,8,21]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "/metrics-consent", name: "MetricsConsentView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MetricsConsentView-B5NlgqrS.js"), true ? __vite__mapDeps([21,7]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MetricsConsentView-DK20ednB.js"), true ? __vite__mapDeps([22,8]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "desktop-start", name: "DesktopStartView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DesktopStartView-FKlxS2Lt.js"), true ? __vite__mapDeps([22,7]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DesktopStartView-B2BMUZxW.js"), true ? __vite__mapDeps([23,8]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "maintenance", name: "MaintenanceView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MaintenanceView-Df7CHNWW.js"), true ? __vite__mapDeps([23,1,2,24,11,7,25]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MaintenanceView-BUmTZX1d.js"), true ? __vite__mapDeps([24,3,1,2,25,26,12,8,27]) : void 0, import.meta.url), "component"), + beforeEnter: guardElectronAccess + }, + { + path: "desktop-update", + name: "DesktopUpdateView", + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DesktopUpdateView-DWsew03S.js"), true ? __vite__mapDeps([28,3,26,8,29]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess } ] @@ -75201,9 +75554,9 @@ function watchTriggerable(source, cb, options4 = {}) { cleanupFn = callback; } __name(onCleanup, "onCleanup"); - const _cb = /* @__PURE__ */ __name((value4, oldValue2) => { + const _cb = /* @__PURE__ */ __name((value4, oldValue) => { onEffect(); - return cb(value4, oldValue2, onCleanup); + return cb(value4, oldValue, onCleanup); }, "_cb"); const res = watchIgnorable(source, _cb, options4); const { ignoreUpdates } = res; @@ -76320,12 +76673,12 @@ function useBase64(target2, options4) { const img = _target.cloneNode(false); img.crossOrigin = "Anonymous"; imgLoaded(img).then(() => { - const canvas = document.createElement("canvas"); - const ctx = canvas.getContext("2d"); - canvas.width = img.width; - canvas.height = img.height; - ctx.drawImage(img, 0, 0, canvas.width, canvas.height); - resolve2(canvas.toDataURL(options4 == null ? void 0 : options4.type, options4 == null ? void 0 : options4.quality)); + const canvas2 = document.createElement("canvas"); + const ctx = canvas2.getContext("2d"); + canvas2.width = img.width; + canvas2.height = img.height; + ctx.drawImage(img, 0, 0, canvas2.width, canvas2.height); + resolve2(canvas2.toDataURL(options4 == null ? void 0 : options4.type, options4 == null ? void 0 : options4.quality)); }).catch(reject3); } else if (typeof _target === "object") { const _serializeFn = (options4 == null ? void 0 : options4.serializer) || getDefaultSerialization(_target); @@ -77040,12 +77393,12 @@ function useStorage(key, defaults2, storage, options4 = {}) { } if (!initOnMounted) update(); - function dispatchWriteEvent(oldValue2, newValue2) { + function dispatchWriteEvent(oldValue, newValue2) { if (window2 && !(storage instanceof Storage)) { window2.dispatchEvent(new CustomEvent(customStorageEventName, { detail: { key, - oldValue: oldValue2, + oldValue, newValue: newValue2, storageArea: storage } @@ -77055,15 +77408,15 @@ function useStorage(key, defaults2, storage, options4 = {}) { __name(dispatchWriteEvent, "dispatchWriteEvent"); function write(v2) { try { - const oldValue2 = storage.getItem(key); + const oldValue = storage.getItem(key); if (v2 == null) { - dispatchWriteEvent(oldValue2, null); + dispatchWriteEvent(oldValue, null); storage.removeItem(key); } else { const serialized = serializer.write(v2); - if (oldValue2 !== serialized) { + if (oldValue !== serialized) { storage.setItem(key, serialized); - dispatchWriteEvent(oldValue2, serialized); + dispatchWriteEvent(oldValue, serialized); } } } catch (e2) { @@ -77817,13 +78170,13 @@ function useDraggable(target2, options4 = {}) { const container = toValue$3(containerElement); const containerRect = (_a22 = container == null ? void 0 : container.getBoundingClientRect) == null ? void 0 : _a22.call(container); const targetRect = toValue$3(target2).getBoundingClientRect(); - const pos2 = { + const pos = { x: e2.clientX - (container ? targetRect.left - containerRect.left + container.scrollLeft : targetRect.left), y: e2.clientY - (container ? targetRect.top - containerRect.top + container.scrollTop : targetRect.top) }; - if ((onStart == null ? void 0 : onStart(pos2, e2)) === false) + if ((onStart == null ? void 0 : onStart(pos, e2)) === false) return; - pressedDelta.value = pos2; + pressedDelta.value = pos; handleEvent(e2); }, "start"); const move = /* @__PURE__ */ __name((e2) => { @@ -78544,13 +78897,13 @@ function useFetch(url, ...args) { const errorEvent = createEventHook(); const finallyEvent = createEventHook(); const isFinished = ref(false); - const isFetching = ref(false); + const isFetching2 = ref(false); const aborted = ref(false); const statusCode = ref(null); const response = shallowRef(null); const error2 = shallowRef(null); const data26 = shallowRef(initialData || null); - const canAbort = computed(() => supportsAbort && isFetching.value); + const canAbort = computed(() => supportsAbort && isFetching2.value); let controller; let timer; const abort = /* @__PURE__ */ __name(() => { @@ -78565,7 +78918,7 @@ function useFetch(url, ...args) { } }, "abort"); const loading2 = /* @__PURE__ */ __name((isLoading) => { - isFetching.value = isLoading; + isFetching2.value = isLoading; isFinished.value = !isLoading; }, "loading"); if (timeout) @@ -78675,7 +79028,7 @@ function useFetch(url, ...args) { ); const shell = { isFinished: readonly(isFinished), - isFetching: readonly(isFetching), + isFetching: readonly(isFetching2), statusCode, response, error: error2, @@ -78704,7 +79057,7 @@ function useFetch(url, ...args) { }; function setMethod(method) { return (payload, payloadType) => { - if (!isFetching.value) { + if (!isFetching2.value) { config2.method = method; config2.payload = payload; config2.payloadType = payloadType; @@ -78737,7 +79090,7 @@ function useFetch(url, ...args) { __name(waitUntilFinished, "waitUntilFinished"); function setType2(type) { return () => { - if (!isFetching.value) { + if (!isFetching2.value) { config2.type = type; return { ...shell, @@ -80049,10 +80402,10 @@ function useMouse(options4 = {}) { const scrollHandler = /* @__PURE__ */ __name(() => { if (!_prevMouseEvent || !window2) return; - const pos2 = extractor(_prevMouseEvent); - if (_prevMouseEvent instanceof MouseEvent && pos2) { - x2.value = pos2[0] + window2.scrollX; - y2.value = pos2[1] + window2.scrollY; + const pos = extractor(_prevMouseEvent); + if (_prevMouseEvent instanceof MouseEvent && pos) { + x2.value = pos[0] + window2.scrollX; + y2.value = pos[1] + window2.scrollY; } }, "scrollHandler"); const reset2 = /* @__PURE__ */ __name(() => { @@ -80774,8 +81127,8 @@ function usePrevious(value4, initialValue) { const previous = shallowRef(initialValue); watch( toRef(value4), - (_2, oldValue2) => { - previous.value = oldValue2; + (_2, oldValue) => { + previous.value = oldValue; }, { flush: "sync" } ); @@ -84799,12 +85152,12 @@ var classes$B = { mask: /* @__PURE__ */ __name(function mask2(_ref3) { var props = _ref3.props; var positions = ["left", "right", "top", "topleft", "topright", "bottom", "bottomleft", "bottomright"]; - var pos2 = positions.find(function(item3) { + var pos = positions.find(function(item3) { return item3 === props.position; }); return ["p-dialog-mask", { "p-overlay-mask p-overlay-mask-enter": props.modal - }, pos2 ? "p-dialog-".concat(pos2) : ""]; + }, pos ? "p-dialog-".concat(pos) : ""]; }, "mask"), root: /* @__PURE__ */ __name(function root4(_ref4) { var props = _ref4.props, instance = _ref4.instance; @@ -85608,7 +85961,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({ }); const config$1 = { app_title: "ComfyUI", - app_version: "1.8.14" + app_version: "1.9.17" }; /*! * shared v9.13.1 @@ -86016,12 +86369,12 @@ function createTokenizer(source, options4 = {}) { }; const context = /* @__PURE__ */ __name(() => _context, "context"); const { onError } = options4; - function emitError(code2, pos2, offset, ...args) { + function emitError(code2, pos, offset, ...args) { const ctx = context(); - pos2.column += offset; - pos2.offset += offset; + pos.column += offset; + pos.offset += offset; if (onError) { - const loc = location2 ? createLocation(ctx.startLoc, pos2) : null; + const loc = location2 ? createLocation(ctx.startLoc, pos) : null; const err = createCompileError(code2, loc, { domain: ERROR_DOMAIN$3, args @@ -86758,14 +87111,14 @@ function createParser(options4 = {}) { return node3; } __name(startNode, "startNode"); - function endNode(node3, offset, pos2, type) { + function endNode(node3, offset, pos, type) { if (type) { node3.type = type; } if (location2) { node3.end = offset; if (node3.loc) { - node3.loc.end = pos2; + node3.loc.end = pos; } } } @@ -91962,7 +92315,8 @@ const g$5 = { workflow: "Workflow", success: "Success", ok: "OK", - feedback: "Feedback" + feedback: "Feedback", + "continue": "Continue" }; const issueReport$5 = { submitErrorReport: "Submit Error Report (Optional)", @@ -91989,6 +92343,39 @@ const color$5 = { yellow: "Yellow", custom: "Custom" }; +const contextMenu$5 = { + Inputs: "Inputs", + Outputs: "Outputs", + Properties: "Properties", + "Properties Panel": "Properties Panel", + Title: "Title", + Mode: "Mode", + Resize: "Resize", + Collapse: "Collapse", + Expand: "Expand", + Pin: "Pin", + Unpin: "Unpin", + Clone: "Clone", + Remove: "Remove", + Colors: "Colors", + Shapes: "Shapes", + Bypass: "Bypass", + "Copy (Clipspace)": "Copy (Clipspace)", + "Convert Widget to Input": "Convert Widget to Input", + "Convert Input to Widget": "Convert Input to Widget", + "Add Node": "Add Node", + "Add Group": "Add Group", + "Convert to Group Node": "Convert to Group Node", + "Manage Group Nodes": "Manage Group Nodes", + "Add Group For Selected Nodes": "Add Group For Selected Nodes", + "Save Selected as Template": "Save Selected as Template", + "Node Templates": "Node Templates", + Manage: "Manage", + "Convert ": "Convert ", + " to input": " to input", + " to widget": " to widget", + Search: "Search" +}; const icon$5 = { bookmark: "Bookmark", folder: "Folder", @@ -92170,6 +92557,7 @@ const sideToolbar$5 = { deleteFailed: "Attempt to delete the workflow failed.", dirtyCloseTitle: "Save Changes?", dirtyClose: "The files below have been changed. Would you like to save them before closing?", + dirtyCloseHint: "Hold Shift to close without prompt", confirmOverwriteTitle: "Overwrite existing file?", confirmOverwrite: "The file below already exists. Would you like to overwrite it?", workflowTreeType: { @@ -92591,6 +92979,7 @@ const dataTypes$5 = { WEBCAM: "WEBCAM" }; const maintenance$5 = { + title: "Maintenance", allOk: "No issues were detected.", status: "Status", detected: "Detected", @@ -92600,9 +92989,12 @@ const maintenance$5 = { Skipped: "Skipped", showManual: "Show maintenance tasks", confirmTitle: "Are you sure?", + terminalDefaultMessage: "When you run a troubleshooting command, any output will be shown here.", + consoleLogs: "Console Logs", error: { toastTitle: "Task error", taskFailed: "Task failed to run.", + cannotContinue: "Unable to continue - errors remain", defaultDescription: "An error occurred while running a maintenance task." } }; @@ -92611,10 +93003,29 @@ const missingModelsDialog$5 = { missingModels: "Missing Models", missingModelsMessage: "When loading the graph, the following models were not found" }; +const desktopUpdate$5 = { + title: "Updating ComfyUI Desktop", + description: "ComfyUI Desktop is installing new dependencies. This may take a few minutes.", + terminalDefaultMessage: "Any console output from the update will be shown here." +}; +const clipboard$5 = { + successMessage: "Copied to clipboard", + errorMessage: "Failed to copy to clipboard", + errorNotSupported: "Clipboard API not supported in your browser" +}; +const load3d$5 = { + switchCamera: "Switch Camera", + showGrid: "Show Grid", + backgroundColor: "Background Color", + lightIntensity: "Light Intensity", + fov: "FOV", + previewOutput: "Preview Output" +}; const en = { g: g$5, issueReport: issueReport$5, color: color$5, + contextMenu: contextMenu$5, icon: icon$5, welcome: welcome$5, userSelect: userSelect$5, @@ -92640,7 +93051,10 @@ const en = { nodeCategories: nodeCategories$5, dataTypes: dataTypes$5, maintenance: maintenance$5, - missingModelsDialog: missingModelsDialog$5 + missingModelsDialog: missingModelsDialog$5, + desktopUpdate: desktopUpdate$5, + clipboard: clipboard$5, + load3d: load3d$5 }; const AddNoise$5 = { display_name: "AddNoise", @@ -98766,13 +99180,20 @@ const Comfy_Workflow_WorkflowTabsPosition$5 = { "Topbar (2nd-row)": "Topbar (2nd-row)" } }; +const LiteGraph_Canvas_LowQualityRenderingZoomThreshold$5 = { + name: "Low quality rendering zoom threshold", + tooltip: "Render low quality shapes when zoomed out" +}; const LiteGraph_Canvas_MaximumFps$5 = { - name: "Maxium FPS", + name: "Maximum 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" }; const LiteGraph_ContextMenu_Scaling$5 = { name: "Scale node combo widget menus (lists) when zoomed in" }; +const LiteGraph_Node_TooltipDelay$5 = { + name: "Tooltip Delay" +}; const pysssss_SnapToGrid$5 = { name: "Always snap to grid" }; @@ -98870,8 +99291,10 @@ const enSettings = { Comfy_Workflow_ShowMissingNodesWarning: Comfy_Workflow_ShowMissingNodesWarning$5, Comfy_Workflow_SortNodeIdOnSave: Comfy_Workflow_SortNodeIdOnSave$5, Comfy_Workflow_WorkflowTabsPosition: Comfy_Workflow_WorkflowTabsPosition$5, + LiteGraph_Canvas_LowQualityRenderingZoomThreshold: LiteGraph_Canvas_LowQualityRenderingZoomThreshold$5, LiteGraph_Canvas_MaximumFps: LiteGraph_Canvas_MaximumFps$5, LiteGraph_ContextMenu_Scaling: LiteGraph_ContextMenu_Scaling$5, + LiteGraph_Node_TooltipDelay: LiteGraph_Node_TooltipDelay$5, pysssss_SnapToGrid: pysssss_SnapToGrid$5 }; const Comfy_BrowseTemplates$4 = { @@ -99125,6 +99548,11 @@ const frCommands = { Workspace_ToggleSidebarTab_queue: Workspace_ToggleSidebarTab_queue$4, Workspace_ToggleSidebarTab_workflows: Workspace_ToggleSidebarTab_workflows$4 }; +const clipboard$4 = { + errorMessage: "Échec de la copie dans le presse-papiers", + errorNotSupported: "L'API du presse-papiers n'est pas prise en charge par votre navigateur", + successMessage: "Copié dans le presse-papiers" +}; const color$4 = { blue: "Bleu", custom: "Personnalisé", @@ -99134,6 +99562,39 @@ const color$4 = { red: "Rouge", yellow: "Jaune" }; +const contextMenu$4 = { + " to input": " en entrée", + " to widget": " en widget", + "Add Group": "Ajouter un Groupe", + "Add Group For Selected Nodes": "Ajouter un Groupe pour les Nœuds Sélectionnés", + "Add Node": "Ajouter un Nœud", + Bypass: "Contourner", + Clone: "Cloner", + Collapse: "Réduire", + Colors: "Couleurs", + "Convert ": "Convertir ", + "Convert Input to Widget": "Convertir l'Entrée en Widget", + "Convert Widget to Input": "Convertir le Widget en Entrée", + "Convert to Group Node": "Convertir en Nœud de Groupe", + "Copy (Clipspace)": "Copier (Clipspace)", + Expand: "Développer", + Inputs: "Entrées", + Manage: "Gérer", + "Manage Group Nodes": "Gérer les Nœuds de Groupe", + Mode: "Mode", + "Node Templates": "Modèles de Nœuds", + Outputs: "Sorties", + Pin: "Épingler", + Properties: "Propriétés", + "Properties Panel": "Panneau des Propriétés", + Remove: "Supprimer", + Resize: "Redimensionner", + "Save Selected as Template": "Enregistrer la Sélection comme Modèle", + Search: "Recherche", + Shapes: "Formes", + Title: "Titre", + Unpin: "Désépingler" +}; const dataTypes$4 = { AUDIO: "AUDIO", BOOLEAN: "BOOLEAN", @@ -99174,6 +99635,11 @@ const desktopMenu$4 = { quit: "Quitter", reinstall: "Réinstaller" }; +const desktopUpdate$4 = { + description: "ComfyUI Desktop installe de nouvelles dépendances. Cela peut prendre quelques minutes.", + terminalDefaultMessage: "Toute sortie de console de la mise à jour sera affichée ici.", + title: "Mise à jour de ComfyUI Desktop" +}; const downloadGit$4 = { gitWebsite: "Télécharger git", instructions: "Veuillez télécharger et installer la dernière version pour votre système d'exploitation. Le bouton Télécharger git ci-dessous ouvre la page de téléchargement de git-scm.com.", @@ -99200,6 +99666,7 @@ const g$4 = { comingSoon: "Bientôt disponible", command: "Commande", confirm: "Confirmer", + "continue": "Continuer", copyToClipboard: "Copier dans le presse-papiers", currentUser: "Utilisateur actuel", customize: "Personnaliser", @@ -99393,21 +99860,33 @@ const issueReport$4 = { maxLength: "Message trop long" } }; +const load3d$4 = { + backgroundColor: "Couleur de fond", + fov: "FOV", + lightIntensity: "Intensité de la lumière", + previewOutput: "Aperçu de la sortie", + showGrid: "Afficher la grille", + switchCamera: "Changer de caméra" +}; const maintenance$4 = { None: "Aucun", OK: "OK", Skipped: "Ignoré", allOk: "Aucun problème détecté.", confirmTitle: "Êtes-vous sûr ?", + consoleLogs: "Journaux de la console", detected: "Détecté", error: { + cannotContinue: "Impossible de continuer - des erreurs subsistent", defaultDescription: "Une erreur s'est produite lors de l'exécution d'une tâche de maintenance.", taskFailed: "La tâche a échoué.", toastTitle: "Erreur de tâche" }, refreshing: "Actualisation", showManual: "Afficher les tâches de maintenance", - status: "Statut" + status: "Statut", + terminalDefaultMessage: "Lorsque vous exécutez une commande de dépannage, toute sortie sera affichée ici.", + title: "Maintenance" }; const menu$4 = { autoQueue: "File d'attente automatique", @@ -99805,6 +100284,7 @@ const sideToolbar$4 = { deleteFailedTitle: "Échec de la suppression", deleted: "Flux de travail supprimé", dirtyClose: "Les fichiers ci-dessous ont été modifiés. Souhaitez-vous les enregistrer avant de fermer ?", + dirtyCloseHint: "Maintenez Shift pour fermer sans invite", dirtyCloseTitle: "Enregistrer les modifications ?", workflowTreeType: { bookmarks: "Favoris", @@ -99849,9 +100329,12 @@ const workflowService$4 = { saveWorkflow: "Enregistrer le flux de travail" }; const fr = { + clipboard: clipboard$4, color: color$4, + contextMenu: contextMenu$4, dataTypes: dataTypes$4, desktopMenu: desktopMenu$4, + desktopUpdate: desktopUpdate$4, downloadGit: downloadGit$4, electronFileDownload: electronFileDownload$4, g: g$4, @@ -99860,6 +100343,7 @@ const fr = { icon: icon$4, install: install$4, issueReport: issueReport$4, + load3d: load3d$4, maintenance: maintenance$4, menu: menu$4, menuLabels: menuLabels$4, @@ -106003,6 +106487,10 @@ const Comfy_Workflow_WorkflowTabsPosition$4 = { "Topbar (2nd-row)": "Barre supérieure (2ème rangée)" } }; +const LiteGraph_Canvas_LowQualityRenderingZoomThreshold$4 = { + name: "Seuil de zoom pour le rendu de faible qualité", + tooltip: "Rendre des formes de faible qualité lorsqu'on est dézoomé" +}; const LiteGraph_Canvas_MaximumFps$4 = { name: "FPS maximum", tooltip: "Le nombre maximum d'images par seconde que le canevas est autorisé à rendre. Limite l'utilisation du GPU au détriment de la fluidité. Si 0, le taux de rafraîchissement de l'écran est utilisé. Par défaut : 0" @@ -106010,6 +106498,9 @@ const LiteGraph_Canvas_MaximumFps$4 = { const LiteGraph_ContextMenu_Scaling$4 = { name: "Mise à l'échelle des menus de widgets combinés de nœuds (listes) lors du zoom" }; +const LiteGraph_Node_TooltipDelay$4 = { + name: "Délai d'infobulle" +}; const pysssss_SnapToGrid$4 = { name: "Toujours aligner sur la grille" }; @@ -106107,8 +106598,10 @@ const frSettings = { Comfy_Workflow_ShowMissingNodesWarning: Comfy_Workflow_ShowMissingNodesWarning$4, Comfy_Workflow_SortNodeIdOnSave: Comfy_Workflow_SortNodeIdOnSave$4, Comfy_Workflow_WorkflowTabsPosition: Comfy_Workflow_WorkflowTabsPosition$4, + LiteGraph_Canvas_LowQualityRenderingZoomThreshold: LiteGraph_Canvas_LowQualityRenderingZoomThreshold$4, LiteGraph_Canvas_MaximumFps: LiteGraph_Canvas_MaximumFps$4, LiteGraph_ContextMenu_Scaling: LiteGraph_ContextMenu_Scaling$4, + LiteGraph_Node_TooltipDelay: LiteGraph_Node_TooltipDelay$4, pysssss_SnapToGrid: pysssss_SnapToGrid$4 }; const Comfy_BrowseTemplates$3 = { @@ -106121,10 +106614,10 @@ const Comfy_Canvas_ResetView$3 = { label: "ビューをリセット" }; const Comfy_Canvas_ToggleLinkVisibility$3 = { - label: "キャンバスのリンクの可視性を切り替え" + label: "キャンバスのリンク表示を切り替える" }; const Comfy_Canvas_ToggleLock$3 = { - label: "キャンバスのロックを切り替え" + label: "キャンバスのロックを切り替える" }; const Comfy_Canvas_ToggleSelectedNodes_Bypass$3 = { label: "選択したノードのバイパス/バイパス解除" @@ -106202,7 +106695,7 @@ const Comfy_LoadDefaultWorkflow$3 = { label: "デフォルトのワークフローを読み込む" }; const Comfy_NewBlankWorkflow$3 = { - label: "新しい空白のワークフロー" + label: "新しい空のワークフロー" }; const Comfy_OpenClipspace$3 = { label: "クリップスペース" @@ -106250,7 +106743,7 @@ const Workspace_SearchBox_Toggle$3 = { label: "検索ボックスの切り替え" }; const Workspace_ToggleBottomPanel$3 = { - label: "ボトムパネルの切り替え" + label: "パネル下部の切り替え" }; const Workspace_ToggleFocusMode$3 = { label: "フォーカスモードの切り替え" @@ -106345,10 +106838,10 @@ const jaCommands = { Workspace_SearchBox_Toggle: Workspace_SearchBox_Toggle$3, Workspace_ToggleBottomPanel: Workspace_ToggleBottomPanel$3, "Workspace_ToggleBottomPanelTab_command-terminal": { - label: "ターミナルボトムパネルの切り替え" + label: "ターミナルパネル下部の切り替え" }, "Workspace_ToggleBottomPanelTab_logs-terminal": { - label: "ログボトムパネルの切り替え" + label: "ログパネル下部の切り替え" }, Workspace_ToggleFocusMode: Workspace_ToggleFocusMode$3, "Workspace_ToggleSidebarTab_model-library": { @@ -106362,6 +106855,11 @@ const jaCommands = { Workspace_ToggleSidebarTab_queue: Workspace_ToggleSidebarTab_queue$3, Workspace_ToggleSidebarTab_workflows: Workspace_ToggleSidebarTab_workflows$3 }; +const clipboard$3 = { + errorMessage: "クリップボードへのコピーに失敗しました", + errorNotSupported: "お使いのブラウザではクリップボードAPIがサポートされていません", + successMessage: "クリップボードにコピーしました" +}; const color$3 = { blue: "青", custom: "カスタム", @@ -106371,6 +106869,39 @@ const color$3 = { red: "赤", yellow: "黄色" }; +const contextMenu$3 = { + " to input": " 入力へ", + " to widget": " ウィジェットへ", + "Add Group": "グループを追加", + "Add Group For Selected Nodes": "選択したノードのグループを追加", + "Add Node": "ノードを追加", + Bypass: "バイパス", + Clone: "クローン", + Collapse: "折りたたむ", + Colors: "色", + "Convert ": "変換 ", + "Convert Input to Widget": "入力をウィジェットに変換", + "Convert Widget to Input": "ウィジェットを入力に変換", + "Convert to Group Node": "グループノードに変換", + "Copy (Clipspace)": "コピー (Clipspace)", + Expand: "展開", + Inputs: "入力", + Manage: "管理", + "Manage Group Nodes": "グループノードを管理", + Mode: "モード", + "Node Templates": "ノードテンプレート", + Outputs: "出力", + Pin: "ピン", + Properties: "プロパティ", + "Properties Panel": "プロパティパネル", + Remove: "削除", + Resize: "リサイズ", + "Save Selected as Template": "選択したものをテンプレートとして保存", + Search: "検索", + Shapes: "形", + Title: "タイトル", + Unpin: "ピンを解除" +}; const dataTypes$3 = { AUDIO: "オーディオ", BOOLEAN: "ブール", @@ -106400,20 +106931,25 @@ const dataTypes$3 = { SIGMAS: "シグマ", STRING: "文字列", STYLE_MODEL: "スタイルモデル", - TIMESTEPS_RANGE: "タイムステップ範囲", + TIMESTEPS_RANGE: "タイムステップの範囲", UPSCALE_MODEL: "アップスケールモデル", VAE: "VAE", WEBCAM: "ウェブカメラ" }; const desktopMenu$3 = { - confirmQuit: "保存されていないワークフローが開いています。保存されていない変更はすべて失われます。これを無視して終了しますか?", + confirmQuit: "保存されていないワークフローを終了しようとしています。保存されていない変更はすべて失われます。これを無視して終了しますか?", confirmReinstall: "これにより、extra_models_config.yamlファイルがクリアされ、再インストールが開始されます。本当によろしいですか?", quit: "終了", reinstall: "再インストール" }; +const desktopUpdate$3 = { + description: "ComfyUIデスクトップは新しい依存関係をインストールしています。これには数分かかる場合があります。", + terminalDefaultMessage: "更新からの任意のコンソール出力はここに表示されます。", + title: "ComfyUIデスクトップの更新" +}; const downloadGit$3 = { gitWebsite: "Gitをダウンロード", - instructions: "お使いのオペレーティングシステムに最新バージョンをダウンロードしてインストールしてください。以下の「Gitをダウンロード」ボタンをクリックすると、git-scm.comのダウンロードページが開きます。", + instructions: "お使いのオペレーティングシステムに最新のバージョンをダウンロードしてインストールしてください。以下の「Gitをダウンロード」ボタンをクリックすると、git-scm.comのダウンロードページが開きます。", message: "Gitを見つけることができません。正常に動作するためには、Gitの作業コピーが必要です。", skip: "スキップ", title: "Gitをダウンロード", @@ -106437,6 +106973,7 @@ const g$3 = { comingSoon: "近日公開", command: "コマンド", confirm: "確認", + "continue": "続ける", copyToClipboard: "クリップボードにコピー", currentUser: "現在のユーザー", customize: "カスタマイズ", @@ -106454,7 +106991,7 @@ const g$3 = { extensionName: "拡張機能名", feedback: "フィードバック", findIssues: "問題を見つける", - firstTimeUIMessage: "新しいUIを初めて使用しています。「メニュー > 新しいメニューを使用 > 無効」を選択して古いUIに戻してください。", + firstTimeUIMessage: "新しいUIを初めて使用しています。「メニュー > 新しいメニューを使用 > 無効」を選択することで古いUIに戻すことが可能です。", goToNode: "ノードに移動", icon: "アイコン", imageFailedToLoad: "画像の読み込みに失敗しました", @@ -106488,7 +107025,7 @@ const g$3 = { resetKeybindingsTooltip: "キーバインディングをデフォルトにリセット", save: "保存", searchExtensions: "拡張機能を検索", - searchFailedMessage: "検索に一致する設定が見つかりませんでした。検索用語を調整してみてください。", + searchFailedMessage: "検索に一致する設定が見つかりませんでした。検索キーワードを調整してみてください。", searchKeybindings: "キーバインディングを検索", searchModels: "モデルを検索", searchNodes: "ノードを検索", @@ -106541,7 +107078,7 @@ const install$3 = { gpu: "GPU", gpuSelection: { cpuMode: "CPUモード", - cpuModeDescription: "CPUモードは開発者やまれなエッジケースのみを対象としています。", + cpuModeDescription: "CPUモードは開発者や、まれなエッジケースのみを対象としています。", cpuModeDescription2: "これが絶対に必要であることが確定していない場合は、このボックスを無視して上でGPUを選択してください。", customComfyNeedsPython: "ComfyUIはpythonがセットアップされるまで動作しません", customInstallRequirements: "すべての要件と依存関係をインストールする(例:カスタムtorch)", @@ -106566,13 +107103,13 @@ const install$3 = { title: "マニュアル設定", virtualEnvironmentPath: "仮想環境のパス" }, - metricsDisabled: "メトリクス無効", - metricsEnabled: "メトリクス有効", + metricsDisabled: "メトリクスを無効にする", + metricsEnabled: "メトリクスを有効にする", migrateFromExistingInstallation: "既存のインストールから移行", migration: "移行", migrationOptional: "移行は任意です。既存のインストールがない場合、このステップをスキップできます。", migrationSourcePathDescription: "既存のComfyUIインストールがある場合、既存のユーザーファイルとモデルを新しいインストールにコピー/リンクすることができます。既存のComfyUIインストールは影響を受けません。", - moreInfo: "詳細は、私たちの", + moreInfo: "詳しくはこちらをご覧ください", parentMissing: "パスが存在しません - 最初に含まれるディレクトリを作成してください", pathExists: "ディレクトリはすでに存在します - すべてのデータをバックアップしたことを確認してください", pathValidationFailed: "パスの検証に失敗しました", @@ -106612,7 +107149,7 @@ const install$3 = { }, systemLocations: "システムの場所", unhandledError: "未知のエラー", - updateConsent: "以前はクラッシュの報告に同意していました。現在、バグの特定とアプリの改善を助けるためにイベントベースのメトリクスを追跡しています。個人を特定できる情報は収集されません。" + updateConsent: "以前、クラッシュレポートを報告することに同意していました。現在、バグの特定とアプリの改善を助けるためにイベントベースのメトリクスを追跡しています。個人を特定できる情報は収集されません。" }; const issueReport$3 = { contactFollowUp: "フォローアップのために私に連絡する", @@ -106630,21 +107167,33 @@ const issueReport$3 = { maxLength: "メッセージが長すぎます" } }; +const load3d$3 = { + backgroundColor: "背景色", + fov: "FOV", + lightIntensity: "光の強度", + previewOutput: "出力のプレビュー", + showGrid: "グリッドを表示", + switchCamera: "カメラを切り替える" +}; const maintenance$3 = { None: "なし", OK: "OK", Skipped: "スキップされました", allOk: "問題は検出されませんでした。", confirmTitle: "よろしいですか?", + consoleLogs: "コンソールログ", detected: "検出されました", error: { + cannotContinue: "続行できません - エラーが残っています", defaultDescription: "メンテナンスタスクの実行中にエラーが発生しました。", taskFailed: "タスクの実行に失敗しました。", toastTitle: "タスクエラー" }, refreshing: "更新中", showManual: "メンテナンスタスクを表示", - status: "ステータス" + status: "ステータス", + terminalDefaultMessage: "トラブルシューティングコマンドを実行すると、出力はここに表示されます。", + title: "メンテナンス" }; const menu$3 = { autoQueue: "自動キュー", @@ -106725,12 +107274,12 @@ const menuLabels$3 = { "Show Settings Dialog": "設定ダイアログを表示", "Toggle Bottom Panel": "下部パネルの切り替え", "Toggle Focus Mode": "フォーカスモードの切り替え", - "Toggle Logs Bottom Panel": "ログボトムパネルを切り替え", + "Toggle Logs Bottom Panel": "ログパネル下部を切り替え", "Toggle Model Library Sidebar": "モデルライブラリサイドバーを切り替え", "Toggle Node Library Sidebar": "ノードライブラリサイドバーを切り替え", "Toggle Queue Sidebar": "キューサイドバーを切り替え", "Toggle Search Box": "検索ボックスの切り替え", - "Toggle Terminal Bottom Panel": "ターミナルボトムパネルを切り替え", + "Toggle Terminal Bottom Panel": "ターミナルパネル下部を切り替え", "Toggle Theme (Dark/Light)": "テーマを切り替え(ダーク/ライト)", "Toggle Workflows Sidebar": "ワークフローサイドバーを切り替え", Undo: "元に戻す", @@ -106749,7 +107298,7 @@ const nodeCategories$3 = { "3d_models": "3Dモデル", DevTools: "デブツール", _for_testing: "_テスト用", - advanced: "高度な", + advanced: "高度な機能", animation: "アニメーション", api: "API", attention_experiments: "アテンション実験", @@ -107042,6 +107591,7 @@ const sideToolbar$3 = { deleteFailedTitle: "削除に失敗しました", deleted: "ワークフローが削除されました", dirtyClose: "以下のファイルが変更されました。閉じる前に保存しますか?", + dirtyCloseHint: "Shiftキーを押しながら閉じると、プロンプトなしで閉じます", dirtyCloseTitle: "変更を保存しますか?", workflowTreeType: { bookmarks: "ブックマーク", @@ -107086,9 +107636,12 @@ const workflowService$3 = { saveWorkflow: "ワークフローを保存" }; const ja = { + clipboard: clipboard$3, color: color$3, + contextMenu: contextMenu$3, dataTypes: dataTypes$3, desktopMenu: desktopMenu$3, + desktopUpdate: desktopUpdate$3, downloadGit: downloadGit$3, electronFileDownload: electronFileDownload$3, g: g$3, @@ -107097,6 +107650,7 @@ const ja = { icon: icon$3, install: install$3, issueReport: issueReport$3, + load3d: load3d$3, maintenance: maintenance$3, menu: menu$3, menuLabels: menuLabels$3, @@ -113240,6 +113794,10 @@ const Comfy_Workflow_WorkflowTabsPosition$3 = { "Topbar (2nd-row)": "トップバー(2行目)" } }; +const LiteGraph_Canvas_LowQualityRenderingZoomThreshold$3 = { + name: "低品質レンダリングズーム閾値", + tooltip: "ズームアウト時に低品質の形状をレンダリングする" +}; const LiteGraph_Canvas_MaximumFps$3 = { name: "最大FPS", tooltip: "キャンバスがレンダリングできる最大フレーム数です。スムーズさの代わりにGPU使用量を制限します。0の場合、画面のリフレッシュレートが使用されます。デフォルト:0" @@ -113247,6 +113805,9 @@ const LiteGraph_Canvas_MaximumFps$3 = { const LiteGraph_ContextMenu_Scaling$3 = { name: "ズームイン時にノードコンボウィジェットメニュー(リスト)をスケーリングする" }; +const LiteGraph_Node_TooltipDelay$3 = { + name: "ツールチップ遅延" +}; const pysssss_SnapToGrid$3 = { name: "常にグリッドにスナップ" }; @@ -113344,8 +113905,10 @@ const jaSettings = { Comfy_Workflow_ShowMissingNodesWarning: Comfy_Workflow_ShowMissingNodesWarning$3, Comfy_Workflow_SortNodeIdOnSave: Comfy_Workflow_SortNodeIdOnSave$3, Comfy_Workflow_WorkflowTabsPosition: Comfy_Workflow_WorkflowTabsPosition$3, + LiteGraph_Canvas_LowQualityRenderingZoomThreshold: LiteGraph_Canvas_LowQualityRenderingZoomThreshold$3, LiteGraph_Canvas_MaximumFps: LiteGraph_Canvas_MaximumFps$3, LiteGraph_ContextMenu_Scaling: LiteGraph_ContextMenu_Scaling$3, + LiteGraph_Node_TooltipDelay: LiteGraph_Node_TooltipDelay$3, pysssss_SnapToGrid: pysssss_SnapToGrid$3 }; const Comfy_BrowseTemplates$2 = { @@ -113599,6 +114162,11 @@ const koCommands = { Workspace_ToggleSidebarTab_queue: Workspace_ToggleSidebarTab_queue$2, Workspace_ToggleSidebarTab_workflows: Workspace_ToggleSidebarTab_workflows$2 }; +const clipboard$2 = { + errorMessage: "클립보드에 복사하지 못했습니다", + errorNotSupported: "브라우저가 클립보드 API를 지원하지 않습니다.", + successMessage: "클립보드에 복사됨" +}; const color$2 = { blue: "파란색", custom: "사용자 정의", @@ -113608,6 +114176,39 @@ const color$2 = { red: "빨간색", yellow: "노란색" }; +const contextMenu$2 = { + " to input": " 위젯을 입력으로", + " to widget": " 입력을 위젯으로", + "Add Group": "그룹 추가", + "Add Group For Selected Nodes": "선택한 노드 그룹 추가", + "Add Node": "노드 추가", + Bypass: "실행 건너뛰기", + Clone: "복제", + Collapse: "접기", + Colors: "색상", + "Convert ": "[변환] ", + "Convert Input to Widget": "입력을 위젯으로 변환", + "Convert Widget to Input": "위젯을 입력으로 변환", + "Convert to Group Node": "그룹 노드로 변환", + "Copy (Clipspace)": "복사 (Clipspace)", + Expand: "확장", + Inputs: "입력", + Manage: "관리", + "Manage Group Nodes": "그룹 노드 관리", + Mode: "모드", + "Node Templates": "노드 템플릿", + Outputs: "출력", + Pin: "고정", + Properties: "속성", + "Properties Panel": "속성 패널", + Remove: "제거", + Resize: "크기 조정", + "Save Selected as Template": "선택된 부분을 템플릿으로 저장", + Search: "검색", + Shapes: "형태", + Title: "제목", + Unpin: "고정 해제" +}; const dataTypes$2 = { AUDIO: "오디오", BOOLEAN: "논리값", @@ -113648,6 +114249,11 @@ const desktopMenu$2 = { quit: "종료", reinstall: "재설치" }; +const desktopUpdate$2 = { + description: "ComfyUI 데스크톱이 새로운 종속성을 설치하고 있습니다. 이 작업은 몇 분 정도 걸릴 수 있습니다.", + terminalDefaultMessage: "업데이트 콘솔 출력은 여기에 표시됩니다.", + title: "ComfyUI 데스크톱 업데이트 중" +}; const downloadGit$2 = { gitWebsite: "git 프로그램 다운로드", instructions: "운영 체제에 맞는 최신 버전을 다운로드하여 설치하십시오. 아래의 'git 프로그램 다운로드' 버튼을 클릭하면 git-scm.com 다운로드 페이지가 열립니다.", @@ -113674,6 +114280,7 @@ const g$2 = { comingSoon: "곧 출시 예정", command: "명령", confirm: "확인", + "continue": "계속", copyToClipboard: "클립보드에 복사", currentUser: "현재 사용자", customize: "사용자 정의", @@ -113867,21 +114474,33 @@ const issueReport$2 = { maxLength: "메시지가 너무 깁니다" } }; +const load3d$2 = { + backgroundColor: "배경색", + fov: "FOV", + lightIntensity: "조명 강도", + previewOutput: "출력 미리보기", + showGrid: "그리드 표시", + switchCamera: "카메라 전환" +}; const maintenance$2 = { None: "없음", OK: "확인", Skipped: "건너뜀", allOk: "문제가 발견되지 않았습니다.", confirmTitle: "확실합니까?", + consoleLogs: "콘솔 로그", detected: "감지됨", error: { + cannotContinue: "계속할 수 없습니다 - 오류가 남아 있습니다", defaultDescription: "유지 보수 작업을 실행하는 동안 오류가 발생했습니다.", taskFailed: "작업 실행에 실패했습니다.", toastTitle: "작업 오류" }, refreshing: "새로 고침 중", showManual: "유지 보수 작업 보기", - status: "상태" + status: "상태", + terminalDefaultMessage: "문제 해결 명령을 실행하면 출력이 여기에 표시됩니다.", + title: "유지 보수" }; const menu$2 = { autoQueue: "자동 실행 큐", @@ -114279,6 +114898,7 @@ const sideToolbar$2 = { deleteFailedTitle: "삭제 실패", deleted: "워크플로가 삭제되었습니다.", dirtyClose: "아래 파일들이 변경되었습니다. 닫기 전에 저장하시겠습니까?", + dirtyCloseHint: "프롬프트 없이 닫으려면 Shift를 누르세요", dirtyCloseTitle: "변경 사항 저장", workflowTreeType: { bookmarks: "북마크", @@ -114323,9 +114943,12 @@ const workflowService$2 = { saveWorkflow: "워크플로 저장" }; const ko = { + clipboard: clipboard$2, color: color$2, + contextMenu: contextMenu$2, dataTypes: dataTypes$2, desktopMenu: desktopMenu$2, + desktopUpdate: desktopUpdate$2, downloadGit: downloadGit$2, electronFileDownload: electronFileDownload$2, g: g$2, @@ -114334,6 +114957,7 @@ const ko = { icon: icon$2, install: install$2, issueReport: issueReport$2, + load3d: load3d$2, maintenance: maintenance$2, menu: menu$2, menuLabels: menuLabels$2, @@ -120477,6 +121101,10 @@ const Comfy_Workflow_WorkflowTabsPosition$2 = { "Topbar (2nd-row)": "상단바 (2번째 행)" } }; +const LiteGraph_Canvas_LowQualityRenderingZoomThreshold$2 = { + name: "저품질 렌더링 줌 임계값", + tooltip: "줌 아웃시 저품질 도형 렌더링" +}; const LiteGraph_Canvas_MaximumFps$2 = { name: "최대 FPS", tooltip: "캔버스가 렌더링할 수 있는 최대 프레임 수입니다. 부드럽게 동작하도록 GPU 사용률을 제한 합니다. 0이면 화면 주사율로 작동 합니다. 기본값: 0" @@ -120484,6 +121112,9 @@ const LiteGraph_Canvas_MaximumFps$2 = { const LiteGraph_ContextMenu_Scaling$2 = { name: "확대시 노드 콤보 위젯 메뉴 (목록) 스케일링" }; +const LiteGraph_Node_TooltipDelay$2 = { + name: "툴팁 지연" +}; const pysssss_SnapToGrid$2 = { name: "항상 그리드에 스냅" }; @@ -120581,8 +121212,10 @@ const koSettings = { Comfy_Workflow_ShowMissingNodesWarning: Comfy_Workflow_ShowMissingNodesWarning$2, Comfy_Workflow_SortNodeIdOnSave: Comfy_Workflow_SortNodeIdOnSave$2, Comfy_Workflow_WorkflowTabsPosition: Comfy_Workflow_WorkflowTabsPosition$2, + LiteGraph_Canvas_LowQualityRenderingZoomThreshold: LiteGraph_Canvas_LowQualityRenderingZoomThreshold$2, LiteGraph_Canvas_MaximumFps: LiteGraph_Canvas_MaximumFps$2, LiteGraph_ContextMenu_Scaling: LiteGraph_ContextMenu_Scaling$2, + LiteGraph_Node_TooltipDelay: LiteGraph_Node_TooltipDelay$2, pysssss_SnapToGrid: pysssss_SnapToGrid$2 }; const Comfy_BrowseTemplates$1 = { @@ -120836,6 +121469,11 @@ const ruCommands = { Workspace_ToggleSidebarTab_queue: Workspace_ToggleSidebarTab_queue$1, Workspace_ToggleSidebarTab_workflows: Workspace_ToggleSidebarTab_workflows$1 }; +const clipboard$1 = { + errorMessage: "Не удалось скопировать в буфер обмена", + errorNotSupported: "API буфера обмена не поддерживается в вашем браузере", + successMessage: "Скопировано в буфер обмена" +}; const color$1 = { blue: "Синий", custom: "Пользовательский", @@ -120845,6 +121483,39 @@ const color$1 = { red: "Красный", yellow: "Жёлтый" }; +const contextMenu$1 = { + " to input": " во вход", + " to widget": " в виджет", + "Add Group": "Добавить группу", + "Add Group For Selected Nodes": "Добавить группу для выбранных узлов", + "Add Node": "Добавить узел", + Bypass: "Обход", + Clone: "Клонировать", + Collapse: "Свернуть", + Colors: "Цвета", + "Convert ": "Преобразовать ", + "Convert Input to Widget": "Преобразовать вход в виджет", + "Convert Widget to Input": "Преобразовать виджет во вход", + "Convert to Group Node": "Преобразовать в групповой узел", + "Copy (Clipspace)": "Копировать (Clipspace)", + Expand: "Развернуть", + Inputs: "Входы", + Manage: "Управлять", + "Manage Group Nodes": "Управление групповыми узлами", + Mode: "Режим", + "Node Templates": "Шаблоны узлов", + Outputs: "Выходы", + Pin: "Закрепить", + Properties: "Свойства", + "Properties Panel": "Панель свойств", + Remove: "Удалить", + Resize: "Изменить размер", + "Save Selected as Template": "Сохранить выбранное как шаблон", + Search: "Поиск", + Shapes: "Формы", + Title: "Заголовок", + Unpin: "Открепить" +}; const dataTypes$1 = { AUDIO: "АУДИО", BOOLEAN: "БУЛЕВО", @@ -120885,6 +121556,11 @@ const desktopMenu$1 = { quit: "Выйти", reinstall: "Переустановить" }; +const desktopUpdate$1 = { + description: "ComfyUI Desktop устанавливает новые зависимости. Это может занять несколько минут.", + terminalDefaultMessage: "Любой вывод консоли из обновления будет отображаться здесь.", + title: "Обновление ComfyUI Desktop" +}; const downloadGit$1 = { gitWebsite: "Скачать git", instructions: "Пожалуйста, скачайте и установите последнюю версию для вашей операционной системы. Кнопка «Скачать git» ниже открывает страницу загрузок git-scm.com.", @@ -120911,6 +121587,7 @@ const g$1 = { comingSoon: "Скоро будет", command: "Команда", confirm: "Подтвердить", + "continue": "Продолжить", copyToClipboard: "Скопировать в буфер обмена", currentUser: "Текущий пользователь", customize: "Настроить", @@ -121104,21 +121781,33 @@ const issueReport$1 = { maxLength: "Сообщение слишком длинное" } }; +const load3d$1 = { + backgroundColor: "Цвет фона", + fov: "Угол обзора", + lightIntensity: "Интенсивность света", + previewOutput: "Предварительный просмотр", + showGrid: "Показать сетку", + switchCamera: "Переключить камеру" +}; const maintenance$1 = { None: "Нет", OK: "OK", Skipped: "Пропущено", allOk: "Проблем не обнаружено.", confirmTitle: "Вы уверены?", + consoleLogs: "Консольные журналы", detected: "Обнаружено", error: { + cannotContinue: "Невозможно продолжить - остались ошибки", defaultDescription: "Произошла ошибка при выполнении задачи по обслуживанию.", taskFailed: "Не удалось выполнить задачу.", toastTitle: "Ошибка задачи" }, refreshing: "Обновление", showManual: "Показать задачи по обслуживанию", - status: "Статус" + status: "Статус", + terminalDefaultMessage: "Когда вы запускаете команду для устранения неполадок, любой вывод будет отображаться здесь.", + title: "Обслуживание" }; const menu$1 = { autoQueue: "Автоочередь", @@ -121516,6 +122205,7 @@ const sideToolbar$1 = { deleteFailedTitle: "Не удалось удалить", deleted: "Рабочий процесс удалён", dirtyClose: "Файлы ниже были изменены. Вы хотите сохранить их перед закрытием?", + dirtyCloseHint: "Удерживайте Shift, чтобы закрыть без подсказки", dirtyCloseTitle: "Сохранить изменения?", workflowTreeType: { bookmarks: "Закладки", @@ -121560,9 +122250,12 @@ const workflowService$1 = { saveWorkflow: "Сохранить рабочий процесс" }; const ru = { + clipboard: clipboard$1, color: color$1, + contextMenu: contextMenu$1, dataTypes: dataTypes$1, desktopMenu: desktopMenu$1, + desktopUpdate: desktopUpdate$1, downloadGit: downloadGit$1, electronFileDownload: electronFileDownload$1, g: g$1, @@ -121571,6 +122264,7 @@ const ru = { icon: icon$1, install: install$1, issueReport: issueReport$1, + load3d: load3d$1, maintenance: maintenance$1, menu: menu$1, menuLabels: menuLabels$1, @@ -127714,6 +128408,10 @@ const Comfy_Workflow_WorkflowTabsPosition$1 = { "Topbar (2nd-row)": "Топбар (2-й ряд)" } }; +const LiteGraph_Canvas_LowQualityRenderingZoomThreshold$1 = { + name: "Порог масштабирования для рендеринга низкого качества", + tooltip: "Рендеринг фигур низкого качества при уменьшении масштаба" +}; const LiteGraph_Canvas_MaximumFps$1 = { name: "Максимум FPS", tooltip: "Максимальное количество кадров в секунду, которое холст может рендерить. Ограничивает использование GPU за счёт плавности. Если 0, используется частота обновления экрана. По умолчанию: 0" @@ -127721,6 +128419,9 @@ const LiteGraph_Canvas_MaximumFps$1 = { const LiteGraph_ContextMenu_Scaling$1 = { name: "Масштабирование комбинированных виджетов меню узлов (списков) при увеличении" }; +const LiteGraph_Node_TooltipDelay$1 = { + name: "Задержка всплывающей подсказки" +}; const pysssss_SnapToGrid$1 = { name: "Всегда привязываться к сетке" }; @@ -127818,8 +128519,10 @@ const ruSettings = { Comfy_Workflow_ShowMissingNodesWarning: Comfy_Workflow_ShowMissingNodesWarning$1, Comfy_Workflow_SortNodeIdOnSave: Comfy_Workflow_SortNodeIdOnSave$1, Comfy_Workflow_WorkflowTabsPosition: Comfy_Workflow_WorkflowTabsPosition$1, + LiteGraph_Canvas_LowQualityRenderingZoomThreshold: LiteGraph_Canvas_LowQualityRenderingZoomThreshold$1, LiteGraph_Canvas_MaximumFps: LiteGraph_Canvas_MaximumFps$1, LiteGraph_ContextMenu_Scaling: LiteGraph_ContextMenu_Scaling$1, + LiteGraph_Node_TooltipDelay: LiteGraph_Node_TooltipDelay$1, pysssss_SnapToGrid: pysssss_SnapToGrid$1 }; const Comfy_BrowseTemplates = { @@ -128073,6 +128776,11 @@ const zhCommands = { Workspace_ToggleSidebarTab_queue, Workspace_ToggleSidebarTab_workflows }; +const clipboard = { + errorMessage: "复制到剪贴板失败", + errorNotSupported: "您的浏览器不支持剪贴板API", + successMessage: "已复制到剪贴板" +}; const color = { blue: "蓝色", custom: "自定义", @@ -128082,6 +128790,39 @@ const color = { red: "红色", yellow: "黄色" }; +const contextMenu = { + " to input": " 为输入", + " to widget": " 为控件", + "Add Group": "添加组", + "Add Group For Selected Nodes": "为选定节点添加组", + "Add Node": "添加节点", + Bypass: "绕过", + Clone: "克隆", + Collapse: "折叠", + Colors: "颜色", + "Convert ": "转换 ", + "Convert Input to Widget": "将输入转换为控件", + "Convert Widget to Input": "将控件转换为输入", + "Convert to Group Node": "转换为组节点", + "Copy (Clipspace)": "复制 (Clipspace)", + Expand: "展开", + Inputs: "输入", + Manage: "管理", + "Manage Group Nodes": "管理组节点", + Mode: "模式", + "Node Templates": "节点模板", + Outputs: "输出", + Pin: "固定", + Properties: "属性", + "Properties Panel": "属性面板", + Remove: "删除", + Resize: "调整大小", + "Save Selected as Template": "将选定节点另存为模板", + Search: "搜索", + Shapes: "形状", + Title: "标题", + Unpin: "取消固定" +}; const dataTypes = { AUDIO: "音频", BOOLEAN: "布尔", @@ -128122,6 +128863,11 @@ const desktopMenu = { quit: "退出", reinstall: "重新安装" }; +const desktopUpdate = { + description: "ComfyUI桌面正在安装新的依赖项。这可能需要几分钟的时间。", + terminalDefaultMessage: "更新过程中的任何控制台输出都将在这里显示。", + title: "正在更新ComfyUI桌面" +}; const downloadGit = { gitWebsite: "下载 git", instructions: "请下载并安装适合您操作系统的最新版本。下面的下载 git 按钮将打开 git-scm.com 下载页面。", @@ -128148,6 +128894,7 @@ const g = { comingSoon: "即将推出", command: "指令", confirm: "确认", + "continue": "继续", copyToClipboard: "复制到剪贴板", currentUser: "当前用户", customize: "自定义", @@ -128341,21 +129088,33 @@ const issueReport = { maxLength: "消息过长" } }; +const load3d = { + backgroundColor: "背景颜色", + fov: "视场", + lightIntensity: "光照强度", + previewOutput: "预览输出", + showGrid: "显示网格", + switchCamera: "切换摄像头" +}; const maintenance = { None: "无", OK: "确定", Skipped: "跳过", allOk: "未检测到任何问题。", confirmTitle: "你确定吗?", + consoleLogs: "控制台日志", detected: "检测到", error: { + cannotContinue: "无法继续 - 仍有错误", defaultDescription: "运行维护任务时发生错误。", taskFailed: "任务运行失败。", toastTitle: "任务错误" }, refreshing: "刷新中", showManual: "显示维护任务", - status: "状态" + status: "状态", + terminalDefaultMessage: "当你运行一个故障排除命令时,任何输出都会在这里显示。", + title: "维护" }; const menu = { autoQueue: "自动执行", @@ -128753,6 +129512,7 @@ const sideToolbar = { deleteFailedTitle: "删除失败", deleted: "工作流已删除", dirtyClose: "以下文件已被更改。您想在关闭之前保存它们吗?", + dirtyCloseHint: "按住 Shift 关闭而不提示", dirtyCloseTitle: "保存更改?", workflowTreeType: { bookmarks: "书签", @@ -128797,9 +129557,12 @@ const workflowService = { saveWorkflow: "保存工作流" }; const zh = { + clipboard, color, + contextMenu, dataTypes, desktopMenu, + desktopUpdate, downloadGit, electronFileDownload, g, @@ -128808,6 +129571,7 @@ const zh = { icon, install, issueReport, + load3d, maintenance, menu, menuLabels, @@ -134951,6 +135715,10 @@ const Comfy_Workflow_WorkflowTabsPosition = { "Topbar (2nd-row)": "顶部栏 (第二行)" } }; +const LiteGraph_Canvas_LowQualityRenderingZoomThreshold = { + name: "低质量渲染缩放阈值", + tooltip: "在缩小时渲染低质量形状" +}; const LiteGraph_Canvas_MaximumFps = { name: "最大FPS", tooltip: "画布允许渲染的最大帧数。限制GPU使用以换取流畅度。如果为0,则使用屏幕刷新率。默认值:0" @@ -134958,6 +135726,9 @@ const LiteGraph_Canvas_MaximumFps = { const LiteGraph_ContextMenu_Scaling = { name: "放大时缩放节点组合部件菜单(列表)" }; +const LiteGraph_Node_TooltipDelay = { + name: "工具提示延迟" +}; const pysssss_SnapToGrid = { name: "始终吸附到网格" }; @@ -135055,8 +135826,10 @@ const zhSettings = { Comfy_Workflow_ShowMissingNodesWarning, Comfy_Workflow_SortNodeIdOnSave, Comfy_Workflow_WorkflowTabsPosition, + LiteGraph_Canvas_LowQualityRenderingZoomThreshold, LiteGraph_Canvas_MaximumFps, LiteGraph_ContextMenu_Scaling, + LiteGraph_Node_TooltipDelay, pysssss_SnapToGrid }; function buildLocale(main, nodes, commands2, settings) { @@ -141171,7 +141944,219 @@ var lodash = lodash$1.exports; })(lodash$1, lodash$1.exports); var lodashExports = lodash$1.exports; const _ = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports); -const _hoisted_1$17 = { class: "prompt-dialog-content flex flex-col gap-6 m-2 mt-4" }; +var theme$w = /* @__PURE__ */ __name(function theme10(_ref) { + var dt2 = _ref.dt; + return "\n.p-message {\n border-radius: ".concat(dt2("message.border.radius"), ";\n outline-width: ").concat(dt2("message.border.width"), ";\n outline-style: solid;\n}\n\n.p-message-content {\n display: flex;\n align-items: center;\n padding: ").concat(dt2("message.content.padding"), ";\n gap: ").concat(dt2("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-inline-start: auto;\n overflow: hidden;\n position: relative;\n width: ").concat(dt2("message.close.button.width"), ";\n height: ").concat(dt2("message.close.button.height"), ";\n border-radius: ").concat(dt2("message.close.button.border.radius"), ";\n background: transparent;\n transition: background ").concat(dt2("message.transition.duration"), ", color ").concat(dt2("message.transition.duration"), ", outline-color ").concat(dt2("message.transition.duration"), ", box-shadow ").concat(dt2("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(dt2("message.close.icon.size"), ";\n width: ").concat(dt2("message.close.icon.size"), ";\n height: ").concat(dt2("message.close.icon.size"), ";\n}\n\n.p-message-close-button:focus-visible {\n outline-width: ").concat(dt2("message.close.button.focus.ring.width"), ";\n outline-style: ").concat(dt2("message.close.button.focus.ring.style"), ";\n outline-offset: ").concat(dt2("message.close.button.focus.ring.offset"), ";\n}\n\n.p-message-info {\n background: ").concat(dt2("message.info.background"), ";\n outline-color: ").concat(dt2("message.info.border.color"), ";\n color: ").concat(dt2("message.info.color"), ";\n box-shadow: ").concat(dt2("message.info.shadow"), ";\n}\n\n.p-message-info .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.info.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.info.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-info .p-message-close-button:hover {\n background: ").concat(dt2("message.info.close.button.hover.background"), ";\n}\n\n.p-message-info.p-message-outlined {\n color: ").concat(dt2("message.info.outlined.color"), ";\n outline-color: ").concat(dt2("message.info.outlined.border.color"), ";\n}\n\n.p-message-info.p-message-simple {\n color: ").concat(dt2("message.info.simple.color"), ";\n}\n\n.p-message-success {\n background: ").concat(dt2("message.success.background"), ";\n outline-color: ").concat(dt2("message.success.border.color"), ";\n color: ").concat(dt2("message.success.color"), ";\n box-shadow: ").concat(dt2("message.success.shadow"), ";\n}\n\n.p-message-success .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.success.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.success.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-success .p-message-close-button:hover {\n background: ").concat(dt2("message.success.close.button.hover.background"), ";\n}\n\n.p-message-success.p-message-outlined {\n color: ").concat(dt2("message.success.outlined.color"), ";\n outline-color: ").concat(dt2("message.success.outlined.border.color"), ";\n}\n\n.p-message-success.p-message-simple {\n color: ").concat(dt2("message.success.simple.color"), ";\n}\n\n.p-message-warn {\n background: ").concat(dt2("message.warn.background"), ";\n outline-color: ").concat(dt2("message.warn.border.color"), ";\n color: ").concat(dt2("message.warn.color"), ";\n box-shadow: ").concat(dt2("message.warn.shadow"), ";\n}\n\n.p-message-warn .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.warn.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.warn.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-warn .p-message-close-button:hover {\n background: ").concat(dt2("message.warn.close.button.hover.background"), ";\n}\n\n.p-message-warn.p-message-outlined {\n color: ").concat(dt2("message.warn.outlined.color"), ";\n outline-color: ").concat(dt2("message.warn.outlined.border.color"), ";\n}\n\n.p-message-warn.p-message-simple {\n color: ").concat(dt2("message.warn.simple.color"), ";\n}\n\n.p-message-error {\n background: ").concat(dt2("message.error.background"), ";\n outline-color: ").concat(dt2("message.error.border.color"), ";\n color: ").concat(dt2("message.error.color"), ";\n box-shadow: ").concat(dt2("message.error.shadow"), ";\n}\n\n.p-message-error .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.error.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.error.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-error .p-message-close-button:hover {\n background: ").concat(dt2("message.error.close.button.hover.background"), ";\n}\n\n.p-message-error.p-message-outlined {\n color: ").concat(dt2("message.error.outlined.color"), ";\n outline-color: ").concat(dt2("message.error.outlined.border.color"), ";\n}\n\n.p-message-error.p-message-simple {\n color: ").concat(dt2("message.error.simple.color"), ";\n}\n\n.p-message-secondary {\n background: ").concat(dt2("message.secondary.background"), ";\n outline-color: ").concat(dt2("message.secondary.border.color"), ";\n color: ").concat(dt2("message.secondary.color"), ";\n box-shadow: ").concat(dt2("message.secondary.shadow"), ";\n}\n\n.p-message-secondary .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.secondary.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.secondary.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-secondary .p-message-close-button:hover {\n background: ").concat(dt2("message.secondary.close.button.hover.background"), ";\n}\n\n.p-message-secondary.p-message-outlined {\n color: ").concat(dt2("message.secondary.outlined.color"), ";\n outline-color: ").concat(dt2("message.secondary.outlined.border.color"), ";\n}\n\n.p-message-secondary.p-message-simple {\n color: ").concat(dt2("message.secondary.simple.color"), ";\n}\n\n.p-message-contrast {\n background: ").concat(dt2("message.contrast.background"), ";\n outline-color: ").concat(dt2("message.contrast.border.color"), ";\n color: ").concat(dt2("message.contrast.color"), ";\n box-shadow: ").concat(dt2("message.contrast.shadow"), ";\n}\n\n.p-message-contrast .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.contrast.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.contrast.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-contrast .p-message-close-button:hover {\n background: ").concat(dt2("message.contrast.close.button.hover.background"), ";\n}\n\n.p-message-contrast.p-message-outlined {\n color: ").concat(dt2("message.contrast.outlined.color"), ";\n outline-color: ").concat(dt2("message.contrast.outlined.border.color"), ";\n}\n\n.p-message-contrast.p-message-simple {\n color: ").concat(dt2("message.contrast.simple.color"), ";\n}\n\n.p-message-text {\n font-size: ").concat(dt2("message.text.font.size"), ";\n font-weight: ").concat(dt2("message.text.font.weight"), ";\n}\n\n.p-message-icon {\n font-size: ").concat(dt2("message.icon.size"), ";\n width: ").concat(dt2("message.icon.size"), ";\n height: ").concat(dt2("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.p-message-sm .p-message-content {\n padding: ").concat(dt2("message.content.sm.padding"), ";\n}\n\n.p-message-sm .p-message-text {\n font-size: ").concat(dt2("message.text.sm.font.size"), ";\n}\n\n.p-message-sm .p-message-icon {\n font-size: ").concat(dt2("message.icon.sm.size"), ";\n width: ").concat(dt2("message.icon.sm.size"), ";\n height: ").concat(dt2("message.icon.sm.size"), ";\n}\n\n.p-message-sm .p-message-close-icon {\n font-size: ").concat(dt2("message.close.icon.sm.size"), ";\n width: ").concat(dt2("message.close.icon.sm.size"), ";\n height: ").concat(dt2("message.close.icon.sm.size"), ";\n}\n\n.p-message-lg .p-message-content {\n padding: ").concat(dt2("message.content.lg.padding"), ";\n}\n\n.p-message-lg .p-message-text {\n font-size: ").concat(dt2("message.text.lg.font.size"), ";\n}\n\n.p-message-lg .p-message-icon {\n font-size: ").concat(dt2("message.icon.lg.size"), ";\n width: ").concat(dt2("message.icon.lg.size"), ";\n height: ").concat(dt2("message.icon.lg.size"), ";\n}\n\n.p-message-lg .p-message-close-icon {\n font-size: ").concat(dt2("message.close.icon.lg.size"), ";\n width: ").concat(dt2("message.close.icon.lg.size"), ";\n height: ").concat(dt2("message.close.icon.lg.size"), ";\n}\n\n.p-message-outlined {\n background: transparent;\n outline-width: ").concat(dt2("message.outlined.border.width"), ";\n}\n\n.p-message-simple {\n background: transparent;\n outline-color: transparent;\n box-shadow: none;\n}\n\n.p-message-simple .p-message-content {\n padding: ").concat(dt2("message.simple.content.padding"), ";\n}\n\n.p-message-outlined .p-message-close-button:hover,\n.p-message-simple .p-message-close-button:hover {\n background: transparent;\n}\n"); +}, "theme"); +var classes$A = { + root: /* @__PURE__ */ __name(function root5(_ref2) { + var props = _ref2.props; + return ["p-message p-component p-message-" + props.severity, { + "p-message-outlined": props.variant === "outlined", + "p-message-simple": props.variant === "simple", + "p-message-sm": props.size === "small", + "p-message-lg": props.size === "large" + }]; + }, "root"), + content: "p-message-content", + icon: "p-message-icon", + text: "p-message-text", + closeButton: "p-message-close-button", + closeIcon: "p-message-close-icon" +}; +var MessageStyle = BaseStyle$1.extend({ + name: "message", + theme: theme$w, + classes: classes$A +}); +var script$1$A = { + name: "BaseMessage", + "extends": script$14, + props: { + severity: { + type: String, + "default": "info" + }, + closable: { + type: Boolean, + "default": false + }, + life: { + type: Number, + "default": null + }, + icon: { + type: String, + "default": void 0 + }, + closeIcon: { + type: String, + "default": void 0 + }, + closeButtonProps: { + type: null, + "default": null + }, + size: { + type: String, + "default": null + }, + variant: { + type: String, + "default": null + } + }, + style: MessageStyle, + provide: /* @__PURE__ */ __name(function provide9() { + return { + $pcMessage: this, + $parentInstance: this + }; + }, "provide") +}; +var script$S = { + name: "Message", + "extends": script$1$A, + inheritAttrs: false, + emits: ["close", "life-end"], + timeout: null, + data: /* @__PURE__ */ __name(function data5() { + return { + visible: true + }; + }, "data"), + mounted: /* @__PURE__ */ __name(function mounted6() { + var _this = this; + if (this.life) { + setTimeout(function() { + _this.visible = false; + _this.$emit("life-end"); + }, this.life); + } + }, "mounted"), + methods: { + close: /* @__PURE__ */ __name(function close3(event) { + this.visible = false; + this.$emit("close", event); + }, "close") + }, + computed: { + closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel2() { + return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : void 0; + }, "closeAriaLabel") + }, + directives: { + ripple: Ripple + }, + components: { + TimesIcon: script$_ + } +}; +function _typeof$g(o2) { + "@babel/helpers - typeof"; + return _typeof$g = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$g(o2); +} +__name(_typeof$g, "_typeof$g"); +function ownKeys$i(e2, r2) { + var t2 = Object.keys(e2); + if (Object.getOwnPropertySymbols) { + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); + } + return t2; +} +__name(ownKeys$i, "ownKeys$i"); +function _objectSpread$i(e2) { + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$i(Object(t2), true).forEach(function(r3) { + _defineProperty$i(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$i(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); + }); + } + return e2; +} +__name(_objectSpread$i, "_objectSpread$i"); +function _defineProperty$i(e2, r2, t2) { + return (r2 = _toPropertyKey$f(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; +} +__name(_defineProperty$i, "_defineProperty$i"); +function _toPropertyKey$f(t2) { + var i2 = _toPrimitive$f(t2, "string"); + return "symbol" == _typeof$g(i2) ? i2 : i2 + ""; +} +__name(_toPropertyKey$f, "_toPropertyKey$f"); +function _toPrimitive$f(t2, r2) { + if ("object" != _typeof$g(t2) || !t2) return t2; + var e2 = t2[Symbol.toPrimitive]; + if (void 0 !== e2) { + var i2 = e2.call(t2, r2 || "default"); + if ("object" != _typeof$g(i2)) return i2; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r2 ? String : Number)(t2); +} +__name(_toPrimitive$f, "_toPrimitive$f"); +var _hoisted_1$17 = ["aria-label"]; +function render$Q(_ctx, _cache, $props, $setup, $data, $options) { + var _component_TimesIcon = resolveComponent("TimesIcon"); + var _directive_ripple = resolveDirective("ripple"); + return openBlock(), createBlock(Transition, mergeProps$2({ + name: "p-message", + appear: "" + }, _ctx.ptmi("transition")), { + "default": withCtx(function() { + return [withDirectives(createBaseVNode("div", mergeProps$2({ + "class": _ctx.cx("root"), + role: "alert", + "aria-live": "assertive", + "aria-atomic": "true" + }, _ctx.ptm("root")), [_ctx.$slots.container ? renderSlot(_ctx.$slots, "container", { + key: 0, + closeCallback: $options.close + }) : (openBlock(), createElementBlock("div", mergeProps$2({ + key: 1, + "class": _ctx.cx("content") + }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "icon", { + "class": normalizeClass(_ctx.cx("icon")) + }, function() { + return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon ? "span" : null), mergeProps$2({ + "class": [_ctx.cx("icon"), _ctx.icon] + }, _ctx.ptm("icon")), null, 16, ["class"]))]; + }), _ctx.$slots["default"] ? (openBlock(), createElementBlock("div", mergeProps$2({ + key: 0, + "class": _ctx.cx("text") + }, _ctx.ptm("text")), [renderSlot(_ctx.$slots, "default")], 16)) : createCommentVNode("", true), _ctx.closable ? withDirectives((openBlock(), createElementBlock("button", mergeProps$2({ + key: 1, + "class": _ctx.cx("closeButton"), + "aria-label": $options.closeAriaLabel, + type: "button", + onClick: _cache[0] || (_cache[0] = function($event) { + return $options.close($event); + }) + }, _objectSpread$i(_objectSpread$i({}, _ctx.closeButtonProps), _ctx.ptm("closeButton"))), [renderSlot(_ctx.$slots, "closeicon", {}, function() { + return [_ctx.closeIcon ? (openBlock(), createElementBlock("i", mergeProps$2({ + key: 0, + "class": [_ctx.cx("closeIcon"), _ctx.closeIcon] + }, _ctx.ptm("closeIcon")), null, 16)) : (openBlock(), createBlock(_component_TimesIcon, mergeProps$2({ + key: 1, + "class": [_ctx.cx("closeIcon"), _ctx.closeIcon] + }, _ctx.ptm("closeIcon")), null, 16, ["class"]))]; + })], 16, _hoisted_1$17)), [[_directive_ripple]]) : createCommentVNode("", true)], 16))], 16), [[vShow, $data.visible]])]; + }), + _: 3 + }, 16); +} +__name(render$Q, "render$Q"); +script$S.render = render$Q; +const _hoisted_1$16 = { class: "prompt-dialog-content flex flex-col gap-6 m-2 mt-4" }; const _hoisted_2$L = { key: 0, class: "pl-4 m-0 flex flex-col gap-2" @@ -141183,7 +142168,8 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({ message: {}, type: {}, onConfirm: { type: Function }, - itemList: {} + itemList: {}, + hint: {} }, setup(__props) { const props = __props; @@ -141197,13 +142183,25 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({ useDialogStore().closeDialog(); }, "onConfirm"); return (_ctx, _cache) => { - return openBlock(), createElementBlock("section", _hoisted_1$17, [ + return openBlock(), createElementBlock("section", _hoisted_1$16, [ createBaseVNode("span", null, toDisplayString$1(_ctx.message), 1), _ctx.itemList?.length ? (openBlock(), createElementBlock("ul", _hoisted_2$L, [ (openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.itemList, (item3) => { return openBlock(), createElementBlock("li", { key: item3 }, toDisplayString$1(item3), 1); }), 128)) ])) : createCommentVNode("", true), + _ctx.hint ? (openBlock(), createBlock(unref(script$S), { + key: 1, + icon: "pi pi-info-circle", + severity: "secondary", + size: "small", + variant: "simple" + }, { + default: withCtx(() => [ + createTextVNode(toDisplayString$1(_ctx.hint), 1) + ]), + _: 1 + })) : createCommentVNode("", true), createBaseVNode("div", _hoisted_3$u, [ createVNode(unref(script$V), { label: _ctx.$t("g.cancel"), @@ -141260,13 +142258,13 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({ }; } }); -const ConfirmationDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__scopeId", "data-v-3df70997"]]); -var theme$w = /* @__PURE__ */ __name(function theme10(_ref) { +const ConfirmationDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__scopeId", "data-v-4f1e3bbe"]]); +var theme$v = /* @__PURE__ */ __name(function theme11(_ref) { var dt2 = _ref.dt; return "\n.p-divider-horizontal {\n display: flex;\n width: 100%;\n position: relative;\n align-items: center;\n margin: ".concat(dt2("divider.horizontal.margin"), ";\n padding: ").concat(dt2("divider.horizontal.padding"), ';\n}\n\n.p-divider-horizontal:before {\n position: absolute;\n display: block;\n inset-block-start: 50%;\n inset-inline-start: 0;\n width: 100%;\n content: "";\n border-block-start: 1px solid ').concat(dt2("divider.border.color"), ";\n}\n\n.p-divider-horizontal .p-divider-content {\n padding: ").concat(dt2("divider.horizontal.content.padding"), ";\n}\n\n.p-divider-vertical {\n min-height: 100%;\n display: flex;\n position: relative;\n justify-content: center;\n margin: ").concat(dt2("divider.vertical.margin"), ";\n padding: ").concat(dt2("divider.vertical.padding"), ';\n}\n\n.p-divider-vertical:before {\n position: absolute;\n display: block;\n inset-block-start: 0;\n inset-inline-start: 50%;\n height: 100%;\n content: "";\n border-inline-start: 1px solid ').concat(dt2("divider.border.color"), ";\n}\n\n.p-divider.p-divider-vertical .p-divider-content {\n padding: ").concat(dt2("divider.vertical.content.padding"), ";\n}\n\n.p-divider-content {\n z-index: 1;\n background: ").concat(dt2("divider.content.background"), ";\n color: ").concat(dt2("divider.content.color"), ";\n}\n\n.p-divider-solid.p-divider-horizontal:before {\n border-block-start-style: solid;\n}\n\n.p-divider-solid.p-divider-vertical:before {\n border-inline-start-style: solid;\n}\n\n.p-divider-dashed.p-divider-horizontal:before {\n border-block-start-style: dashed;\n}\n\n.p-divider-dashed.p-divider-vertical:before {\n border-inline-start-style: dashed;\n}\n\n.p-divider-dotted.p-divider-horizontal:before {\n border-block-start-style: dotted;\n}\n\n.p-divider-dotted.p-divider-vertical:before {\n border-inline-start-style: dotted;\n}\n\n.p-divider-left:dir(rtl),\n.p-divider-right:dir(rtl) {\n flex-direction: row-reverse;\n}\n"); }, "theme"); var inlineStyles$3 = { - root: /* @__PURE__ */ __name(function root5(_ref2) { + root: /* @__PURE__ */ __name(function root6(_ref2) { var props = _ref2.props; return { justifyContent: props.layout === "horizontal" ? props.align === "center" || props.align === null ? "center" : props.align === "left" ? "flex-start" : props.align === "right" ? "flex-end" : null : null, @@ -141274,8 +142272,8 @@ var inlineStyles$3 = { }; }, "root") }; -var classes$A = { - root: /* @__PURE__ */ __name(function root6(_ref3) { +var classes$z = { + root: /* @__PURE__ */ __name(function root7(_ref3) { var props = _ref3.props; return ["p-divider p-component", "p-divider-" + props.layout, "p-divider-" + props.type, { "p-divider-left": props.layout === "horizontal" && (!props.align || props.align === "left") @@ -141295,11 +142293,11 @@ var classes$A = { }; var DividerStyle = BaseStyle$1.extend({ name: "divider", - theme: theme$w, - classes: classes$A, + theme: theme$v, + classes: classes$z, inlineStyles: inlineStyles$3 }); -var script$1$A = { +var script$1$z = { name: "BaseDivider", "extends": script$14, props: { @@ -141317,20 +142315,20 @@ var script$1$A = { } }, style: DividerStyle, - provide: /* @__PURE__ */ __name(function provide9() { + provide: /* @__PURE__ */ __name(function provide10() { return { $pcDivider: this, $parentInstance: this }; }, "provide") }; -var script$S = { +var script$R = { name: "Divider", - "extends": script$1$A, + "extends": script$1$z, inheritAttrs: false }; -var _hoisted_1$16 = ["aria-orientation"]; -function render$Q(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$15 = ["aria-orientation"]; +function render$P(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps$2({ "class": _ctx.cx("root"), style: _ctx.sx("root"), @@ -141339,15 +142337,15 @@ function render$Q(_ctx, _cache, $props, $setup, $data, $options) { }, _ctx.ptmi("root")), [_ctx.$slots["default"] ? (openBlock(), createElementBlock("div", mergeProps$2({ key: 0, "class": _ctx.cx("content") - }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16)) : createCommentVNode("", true)], 16, _hoisted_1$16); + }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16)) : createCommentVNode("", true)], 16, _hoisted_1$15); } -__name(render$Q, "render$Q"); -script$S.render = render$Q; -var theme$v = /* @__PURE__ */ __name(function theme11(_ref) { +__name(render$P, "render$P"); +script$R.render = render$P; +var theme$u = /* @__PURE__ */ __name(function theme12(_ref) { var dt2 = _ref.dt; 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(dt2("scrollpanel.bar.size"), "));\n width: calc(100% + calc(2 * ").concat(dt2("scrollpanel.bar.size"), "));\n padding-inline: 0 calc(2 * ").concat(dt2("scrollpanel.bar.size"), ");\n padding-block: 0 calc(2 * ").concat(dt2("scrollpanel.bar.size"), ");\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(dt2("scrollpanel.bar.border.radius"), ";\n z-index: 2;\n cursor: pointer;\n opacity: 0;\n outline-color: transparent;\n background: ").concat(dt2("scrollpanel.bar.background"), ";\n border: 0 none;\n transition: outline-color ").concat(dt2("scrollpanel.transition.duration"), ", opacity ").concat(dt2("scrollpanel.transition.duration"), ";\n}\n\n.p-scrollpanel-bar:focus-visible {\n box-shadow: ").concat(dt2("scrollpanel.bar.focus.ring.shadow"), ";\n outline: ").concat(dt2("scrollpanel.barfocus.ring.width"), " ").concat(dt2("scrollpanel.bar.focus.ring.style"), " ").concat(dt2("scrollpanel.bar.focus.ring.color"), ";\n outline-offset: ").concat(dt2("scrollpanel.barfocus.ring.offset"), ";\n}\n\n.p-scrollpanel-bar-y {\n width: ").concat(dt2("scrollpanel.bar.size"), ";\n inset-block-start: 0;\n}\n\n.p-scrollpanel-bar-x {\n height: ").concat(dt2("scrollpanel.bar.size"), ";\n inset-block-end: 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"); }, "theme"); -var classes$z = { +var classes$y = { root: "p-scrollpanel p-component", contentContainer: "p-scrollpanel-content-container", content: "p-scrollpanel-content", @@ -141356,10 +142354,10 @@ var classes$z = { }; var ScrollPanelStyle = BaseStyle$1.extend({ name: "scrollpanel", - theme: theme$v, - classes: classes$z + theme: theme$u, + classes: classes$y }); -var script$1$z = { +var script$1$y = { name: "BaseScrollPanel", "extends": script$14, props: { @@ -141369,16 +142367,16 @@ var script$1$z = { } }, style: ScrollPanelStyle, - provide: /* @__PURE__ */ __name(function provide10() { + provide: /* @__PURE__ */ __name(function provide11() { return { $pcScrollPanel: this, $parentInstance: this }; }, "provide") }; -var script$R = { +var script$Q = { name: "ScrollPanel", - "extends": script$1$z, + "extends": script$1$y, inheritAttrs: false, initialized: false, documentResizeListener: null, @@ -141393,7 +142391,7 @@ var script$R = { lastPageY: null, timer: null, outsideClickListener: null, - data: /* @__PURE__ */ __name(function data5() { + data: /* @__PURE__ */ __name(function data6() { return { id: this.$attrs.id, orientation: "vertical", @@ -141406,7 +142404,7 @@ var script$R = { this.id = newValue2 || UniqueComponentId(); }, "$attrsId") }, - mounted: /* @__PURE__ */ __name(function mounted6() { + mounted: /* @__PURE__ */ __name(function mounted7() { this.id = this.id || UniqueComponentId(); if (this.$el.offsetParent) { this.initialize(); @@ -141675,10 +142673,10 @@ var script$R = { }, "contentId") } }; -var _hoisted_1$15 = ["id"]; +var _hoisted_1$14 = ["id"]; var _hoisted_2$K = ["aria-controls", "aria-valuenow"]; var _hoisted_3$t = ["aria-controls", "aria-valuenow"]; -function render$P(_ctx, _cache, $props, $setup, $data, $options) { +function render$O(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps$2({ "class": _ctx.cx("root") }, _ctx.ptmi("root")), [createBaseVNode("div", mergeProps$2({ @@ -141693,7 +142691,7 @@ function render$P(_ctx, _cache, $props, $setup, $data, $options) { onMouseenter: _cache[1] || (_cache[1] = function() { return $options.moveBar && $options.moveBar.apply($options, arguments); }) - }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$15)], 16), createBaseVNode("div", mergeProps$2({ + }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$14)], 16), createBaseVNode("div", mergeProps$2({ ref: "xBar", "class": _ctx.cx("barx"), tabindex: "0", @@ -141742,13 +142740,13 @@ function render$P(_ctx, _cache, $props, $setup, $data, $options) { "data-pc-group-section": "bar" }), null, 16, _hoisted_3$t)], 16); } -__name(render$P, "render$P"); -script$R.render = render$P; -var theme$u = /* @__PURE__ */ __name(function theme12(_ref) { +__name(render$O, "render$O"); +script$Q.render = render$O; +var theme$t = /* @__PURE__ */ __name(function theme13(_ref) { var dt2 = _ref.dt; return "\n.p-card {\n background: ".concat(dt2("card.background"), ";\n color: ").concat(dt2("card.color"), ";\n box-shadow: ").concat(dt2("card.shadow"), ";\n border-radius: ").concat(dt2("card.border.radius"), ";\n display: flex;\n flex-direction: column;\n}\n\n.p-card-caption {\n display: flex;\n flex-direction: column;\n gap: ").concat(dt2("card.caption.gap"), ";\n}\n\n.p-card-body {\n padding: ").concat(dt2("card.body.padding"), ";\n display: flex;\n flex-direction: column;\n gap: ").concat(dt2("card.body.gap"), ";\n}\n\n.p-card-title {\n font-size: ").concat(dt2("card.title.font.size"), ";\n font-weight: ").concat(dt2("card.title.font.weight"), ";\n}\n\n.p-card-subtitle {\n color: ").concat(dt2("card.subtitle.color"), ";\n}\n"); }, "theme"); -var classes$y = { +var classes$x = { root: "p-card p-component", header: "p-card-header", body: "p-card-body", @@ -141760,26 +142758,26 @@ var classes$y = { }; var CardStyle = BaseStyle$1.extend({ name: "card", - theme: theme$u, - classes: classes$y + theme: theme$t, + classes: classes$x }); -var script$1$y = { +var script$1$x = { name: "BaseCard", "extends": script$14, style: CardStyle, - provide: /* @__PURE__ */ __name(function provide11() { + provide: /* @__PURE__ */ __name(function provide12() { return { $pcCard: this, $parentInstance: this }; }, "provide") }; -var script$Q = { +var script$P = { name: "Card", - "extends": script$1$y, + "extends": script$1$x, inheritAttrs: false }; -function render$O(_ctx, _cache, $props, $setup, $data, $options) { +function render$N(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", mergeProps$2({ "class": _ctx.cx("root") }, _ctx.ptmi("root")), [_ctx.$slots.header ? (openBlock(), createElementBlock("div", mergeProps$2({ @@ -141803,9 +142801,9 @@ function render$O(_ctx, _cache, $props, $setup, $data, $options) { "class": _ctx.cx("footer") }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true)], 16)], 16); } -__name(render$O, "render$O"); -script$Q.render = render$O; -const _hoisted_1$14 = { class: "flex flex-col items-center" }; +__name(render$N, "render$N"); +script$P.render = render$N; +const _hoisted_1$13 = { class: "flex flex-col items-center" }; const _hoisted_2$J = { class: "whitespace-pre-line text-center" }; const _sfc_main$Z = /* @__PURE__ */ defineComponent({ __name: "NoResultsPlaceholder", @@ -141823,9 +142821,9 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({ return openBlock(), createElementBlock("div", { class: normalizeClass(["no-results-placeholder p-8 h-full", props.class]) }, [ - createVNode(unref(script$Q), null, { + createVNode(unref(script$P), null, { content: withCtx(() => [ - createBaseVNode("div", _hoisted_1$14, [ + createBaseVNode("div", _hoisted_1$13, [ createBaseVNode("i", { class: normalizeClass(_ctx.icon), style: { "font-size": "3rem", "margin-bottom": "1rem" } @@ -141881,22 +142879,22 @@ function useCopyToClipboard() { await copy2(text2); toast.add({ severity: "success", - summary: "Success", - detail: "Copied to clipboard", + summary: t("g.success"), + detail: t("clipboard.successMessage"), life: 3e3 }); } catch (err) { toast.add({ severity: "error", - summary: "Error", - detail: "Failed to copy report" + summary: t("g.error"), + detail: t("clipboard.errorMessage") }); } } else { toast.add({ severity: "error", - summary: "Error", - detail: "Clipboard API not supported in your browser" + summary: t("g.error"), + detail: t("clipboard.errorNotSupported") }); } }, "copyToClipboard"); @@ -143351,15 +144349,15 @@ function handler() { } __name(handler, "handler"); var ZIndex = handler(); -function _typeof$g(o2) { +function _typeof$f(o2) { "@babel/helpers - typeof"; - return _typeof$g = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return _typeof$f = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { return typeof o3; } : function(o3) { return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; - }, _typeof$g(o2); + }, _typeof$f(o2); } -__name(_typeof$g, "_typeof$g"); +__name(_typeof$f, "_typeof$f"); function _slicedToArray$4(r2, e2) { return _arrayWithHoles$4(r2) || _iterableToArrayLimit$4(r2, e2) || _unsupportedIterableToArray$g(r2, e2) || _nonIterableRest$4(); } @@ -143406,7 +144404,7 @@ function _arrayWithHoles$4(r2) { if (Array.isArray(r2)) return r2; } __name(_arrayWithHoles$4, "_arrayWithHoles$4"); -function ownKeys$i(e2, r2) { +function ownKeys$h(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { var o2 = Object.getOwnPropertySymbols(e2); @@ -143416,39 +144414,39 @@ function ownKeys$i(e2, r2) { } return t2; } -__name(ownKeys$i, "ownKeys$i"); -function _objectSpread$i(e2) { +__name(ownKeys$h, "ownKeys$h"); +function _objectSpread$h(e2) { for (var r2 = 1; r2 < arguments.length; r2++) { var t2 = null != arguments[r2] ? arguments[r2] : {}; - r2 % 2 ? ownKeys$i(Object(t2), true).forEach(function(r3) { - _defineProperty$i(e2, r3, t2[r3]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$i(Object(t2)).forEach(function(r3) { + r2 % 2 ? ownKeys$h(Object(t2), true).forEach(function(r3) { + _defineProperty$h(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$h(Object(t2)).forEach(function(r3) { Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } -__name(_objectSpread$i, "_objectSpread$i"); -function _defineProperty$i(e2, r2, t2) { - return (r2 = _toPropertyKey$f(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; +__name(_objectSpread$h, "_objectSpread$h"); +function _defineProperty$h(e2, r2, t2) { + return (r2 = _toPropertyKey$e(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$i, "_defineProperty$i"); -function _toPropertyKey$f(t2) { - var i2 = _toPrimitive$f(t2, "string"); - return "symbol" == _typeof$g(i2) ? i2 : i2 + ""; +__name(_defineProperty$h, "_defineProperty$h"); +function _toPropertyKey$e(t2) { + var i2 = _toPrimitive$e(t2, "string"); + return "symbol" == _typeof$f(i2) ? i2 : i2 + ""; } -__name(_toPropertyKey$f, "_toPropertyKey$f"); -function _toPrimitive$f(t2, r2) { - if ("object" != _typeof$g(t2) || !t2) return t2; +__name(_toPropertyKey$e, "_toPropertyKey$e"); +function _toPrimitive$e(t2, r2) { + if ("object" != _typeof$f(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { var i2 = e2.call(t2, r2 || "default"); - if ("object" != _typeof$g(i2)) return i2; + if ("object" != _typeof$f(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r2 ? String : Number)(t2); } -__name(_toPrimitive$f, "_toPrimitive$f"); +__name(_toPrimitive$e, "_toPrimitive$e"); function _regeneratorRuntime() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = /* @__PURE__ */ __name(function _regeneratorRuntime2() { @@ -143512,7 +144510,7 @@ function _regeneratorRuntime() { var c3 = tryCatch(t3[r4], t3, o3); if ("throw" !== c3.type) { var u3 = c3.arg, h3 = u3.value; - return h3 && "object" == _typeof$g(h3) && n2.call(h3, "__await") ? e3.resolve(h3.__await).then(function(t4) { + return h3 && "object" == _typeof$f(h3) && n2.call(h3, "__await") ? e3.resolve(h3.__await).then(function(t4) { invoke2("next", t4, i3, a3); }, function(t4) { invoke2("throw", t4, i3, a3); @@ -143606,7 +144604,7 @@ function _regeneratorRuntime() { return i3.next = i3; } } - throw new TypeError(_typeof$g(e3) + " is not iterable"); + throw new TypeError(_typeof$f(e3) + " is not iterable"); } __name(values, "values"); return GeneratorFunction.prototype = GeneratorFunctionPrototype, o2(g2, "constructor", { value: GeneratorFunctionPrototype, configurable: true }), o2(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: true }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u2, "GeneratorFunction"), e2.isGeneratorFunction = function(t3) { @@ -143852,11 +144850,11 @@ var useForm = /* @__PURE__ */ __name(function useForm2() { }; watch(function() { return states[field2].value; - }, function(newValue2, oldValue2) { + }, function(newValue2, oldValue) { if (states[field2].pristine) { states[field2].pristine = false; } - if (newValue2 !== oldValue2) { + if (newValue2 !== oldValue) { states[field2].dirty = true; } validateFieldOn(field2, fieldOptions, "validateOnValueUpdate", true); @@ -143874,7 +144872,7 @@ var useForm = /* @__PURE__ */ __name(function useForm2() { return validateOn("validateOnSubmit", true); case 2: results = _context2.sent; - return _context2.abrupt("return", callback(_objectSpread$i({ + return _context2.abrupt("return", callback(_objectSpread$h({ originalEvent: event, valid: toValue$4(valid), states: toValue$4(states), @@ -143974,7 +144972,7 @@ var useForm = /* @__PURE__ */ __name(function useForm2() { _context3.t5 = {}; case 33: fieldResult = _context3.t5; - isArray$7(fieldResult.errors) && (fieldResult.errors = _defineProperty$i({}, fieldName, fieldResult.errors)); + isArray$7(fieldResult.errors) && (fieldResult.errors = _defineProperty$h({}, fieldName, fieldResult.errors)); result = mergeKeys$1(result, fieldResult); case 36: errors2 = (_result$errors$fieldN = result.errors[fieldName]) !== null && _result$errors$fieldN !== void 0 ? _result$errors$fieldN : []; @@ -144746,16 +145744,16 @@ var Base = { this._loadedStyleNames.clear(); }, "clearLoadedStyleNames") }; -function _typeof$f(o2) { +function _typeof$e(o2) { "@babel/helpers - typeof"; - return _typeof$f = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return _typeof$e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { return typeof o3; } : function(o3) { return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; - }, _typeof$f(o2); + }, _typeof$e(o2); } -__name(_typeof$f, "_typeof$f"); -function ownKeys$h(e2, r2) { +__name(_typeof$e, "_typeof$e"); +function ownKeys$g(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { var o2 = Object.getOwnPropertySymbols(e2); @@ -144765,39 +145763,39 @@ function ownKeys$h(e2, r2) { } return t2; } -__name(ownKeys$h, "ownKeys$h"); -function _objectSpread$h(e2) { +__name(ownKeys$g, "ownKeys$g"); +function _objectSpread$g(e2) { for (var r2 = 1; r2 < arguments.length; r2++) { var t2 = null != arguments[r2] ? arguments[r2] : {}; - r2 % 2 ? ownKeys$h(Object(t2), true).forEach(function(r3) { - _defineProperty$h(e2, r3, t2[r3]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$h(Object(t2)).forEach(function(r3) { + r2 % 2 ? ownKeys$g(Object(t2), true).forEach(function(r3) { + _defineProperty$g(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$g(Object(t2)).forEach(function(r3) { Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } -__name(_objectSpread$h, "_objectSpread$h"); -function _defineProperty$h(e2, r2, t2) { - return (r2 = _toPropertyKey$e(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; +__name(_objectSpread$g, "_objectSpread$g"); +function _defineProperty$g(e2, r2, t2) { + return (r2 = _toPropertyKey$d(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$h, "_defineProperty$h"); -function _toPropertyKey$e(t2) { - var i2 = _toPrimitive$e(t2, "string"); - return "symbol" == _typeof$f(i2) ? i2 : i2 + ""; +__name(_defineProperty$g, "_defineProperty$g"); +function _toPropertyKey$d(t2) { + var i2 = _toPrimitive$d(t2, "string"); + return "symbol" == _typeof$e(i2) ? i2 : i2 + ""; } -__name(_toPropertyKey$e, "_toPropertyKey$e"); -function _toPrimitive$e(t2, r2) { - if ("object" != _typeof$f(t2) || !t2) return t2; +__name(_toPropertyKey$d, "_toPropertyKey$d"); +function _toPrimitive$d(t2, r2) { + if ("object" != _typeof$e(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { var i2 = e2.call(t2, r2 || "default"); - if ("object" != _typeof$f(i2)) return i2; + if ("object" != _typeof$e(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r2 ? String : Number)(t2); } -__name(_toPrimitive$e, "_toPrimitive$e"); +__name(_toPrimitive$d, "_toPrimitive$d"); function tryOnMounted(fn) { var sync = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; if (getCurrentInstance()) onMounted(fn); @@ -144818,7 +145816,7 @@ function useStyle(css4) { var load3 = /* @__PURE__ */ __name(function load4(_css) { var _props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (!document2) return; - var _styleProps = _objectSpread$h(_objectSpread$h({}, props), _props); + var _styleProps = _objectSpread$g(_objectSpread$g({}, props), _props); var _name = _styleProps.name || name2, _id2 = _styleProps.id || id3, _nonce = _styleProps.nonce || nonce; styleRef.value = document2.querySelector('style[data-primevue-style-id="'.concat(_name, '"]')) || document2.getElementById(_id2) || document2.createElement("style"); if (!styleRef.value.isConnected) { @@ -144866,15 +145864,15 @@ function useStyle(css4) { }; } __name(useStyle, "useStyle"); -function _typeof$e(o2) { +function _typeof$d(o2) { "@babel/helpers - typeof"; - return _typeof$e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return _typeof$d = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { return typeof o3; } : function(o3) { return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; - }, _typeof$e(o2); + }, _typeof$d(o2); } -__name(_typeof$e, "_typeof$e"); +__name(_typeof$d, "_typeof$d"); function _slicedToArray$3(r2, e2) { return _arrayWithHoles$3(r2) || _iterableToArrayLimit$3(r2, e2) || _unsupportedIterableToArray$f(r2, e2) || _nonIterableRest$3(); } @@ -144921,7 +145919,7 @@ function _arrayWithHoles$3(r2) { if (Array.isArray(r2)) return r2; } __name(_arrayWithHoles$3, "_arrayWithHoles$3"); -function ownKeys$g(e2, r2) { +function ownKeys$f(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { var o2 = Object.getOwnPropertySymbols(e2); @@ -144931,40 +145929,40 @@ function ownKeys$g(e2, r2) { } return t2; } -__name(ownKeys$g, "ownKeys$g"); -function _objectSpread$g(e2) { +__name(ownKeys$f, "ownKeys$f"); +function _objectSpread$f(e2) { for (var r2 = 1; r2 < arguments.length; r2++) { var t2 = null != arguments[r2] ? arguments[r2] : {}; - r2 % 2 ? ownKeys$g(Object(t2), true).forEach(function(r3) { - _defineProperty$g(e2, r3, t2[r3]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$g(Object(t2)).forEach(function(r3) { + r2 % 2 ? ownKeys$f(Object(t2), true).forEach(function(r3) { + _defineProperty$f(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$f(Object(t2)).forEach(function(r3) { Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } -__name(_objectSpread$g, "_objectSpread$g"); -function _defineProperty$g(e2, r2, t2) { - return (r2 = _toPropertyKey$d(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; +__name(_objectSpread$f, "_objectSpread$f"); +function _defineProperty$f(e2, r2, t2) { + return (r2 = _toPropertyKey$c(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$g, "_defineProperty$g"); -function _toPropertyKey$d(t2) { - var i2 = _toPrimitive$d(t2, "string"); - return "symbol" == _typeof$e(i2) ? i2 : i2 + ""; +__name(_defineProperty$f, "_defineProperty$f"); +function _toPropertyKey$c(t2) { + var i2 = _toPrimitive$c(t2, "string"); + return "symbol" == _typeof$d(i2) ? i2 : i2 + ""; } -__name(_toPropertyKey$d, "_toPropertyKey$d"); -function _toPrimitive$d(t2, r2) { - if ("object" != _typeof$e(t2) || !t2) return t2; +__name(_toPropertyKey$c, "_toPropertyKey$c"); +function _toPrimitive$c(t2, r2) { + if ("object" != _typeof$d(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { var i2 = e2.call(t2, r2 || "default"); - if ("object" != _typeof$e(i2)) return i2; + if ("object" != _typeof$d(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r2 ? String : Number)(t2); } -__name(_toPrimitive$d, "_toPrimitive$d"); -var theme$t = /* @__PURE__ */ __name(function theme13(_ref) { +__name(_toPrimitive$c, "_toPrimitive$c"); +var theme$s = /* @__PURE__ */ __name(function theme14(_ref) { var dt2 = _ref.dt; return "\n*,\n::before,\n::after {\n box-sizing: border-box;\n}\n\n/* Non vue overlay animations */\n.p-connected-overlay {\n opacity: 0;\n transform: scaleY(0.8);\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1),\n opacity 0.12s cubic-bezier(0, 0, 0.2, 1);\n}\n\n.p-connected-overlay-visible {\n opacity: 1;\n transform: scaleY(1);\n}\n\n.p-connected-overlay-hidden {\n opacity: 0;\n transform: scaleY(1);\n transition: opacity 0.1s linear;\n}\n\n/* Vue based overlay animations */\n.p-connected-overlay-enter-from {\n opacity: 0;\n transform: scaleY(0.8);\n}\n\n.p-connected-overlay-leave-to {\n opacity: 0;\n}\n\n.p-connected-overlay-enter-active {\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1),\n opacity 0.12s cubic-bezier(0, 0, 0.2, 1);\n}\n\n.p-connected-overlay-leave-active {\n transition: opacity 0.1s linear;\n}\n\n/* Toggleable Content */\n.p-toggleable-content-enter-from,\n.p-toggleable-content-leave-to {\n max-height: 0;\n}\n\n.p-toggleable-content-enter-to,\n.p-toggleable-content-leave-from {\n max-height: 1000px;\n}\n\n.p-toggleable-content-leave-active {\n overflow: hidden;\n transition: max-height 0.45s cubic-bezier(0, 1, 0, 1);\n}\n\n.p-toggleable-content-enter-active {\n overflow: hidden;\n transition: max-height 1s ease-in-out;\n}\n\n.p-disabled,\n.p-disabled * {\n cursor: default;\n pointer-events: none;\n user-select: none;\n}\n\n.p-disabled,\n.p-component:disabled {\n opacity: ".concat(dt2("disabled.opacity"), ";\n}\n\n.pi {\n font-size: ").concat(dt2("icon.size"), ";\n}\n\n.p-icon {\n width: ").concat(dt2("icon.size"), ";\n height: ").concat(dt2("icon.size"), ";\n}\n\n.p-overlay-mask {\n background: ").concat(dt2("mask.background"), ";\n color: ").concat(dt2("mask.color"), ";\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-overlay-mask-enter {\n animation: p-overlay-mask-enter-animation ").concat(dt2("mask.transition.duration"), " forwards;\n}\n\n.p-overlay-mask-leave {\n animation: p-overlay-mask-leave-animation ").concat(dt2("mask.transition.duration"), " forwards;\n}\n\n@keyframes p-overlay-mask-enter-animation {\n from {\n background: transparent;\n }\n to {\n background: ").concat(dt2("mask.background"), ";\n }\n}\n@keyframes p-overlay-mask-leave-animation {\n from {\n background: ").concat(dt2("mask.background"), ";\n }\n to {\n background: transparent;\n }\n}\n"); }, "theme"); @@ -144972,13 +145970,13 @@ var css$1 = /* @__PURE__ */ __name(function css3(_ref2) { var dt2 = _ref2.dt; return "\n.p-hidden-accessible {\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n width: 1px;\n}\n\n.p-hidden-accessible input,\n.p-hidden-accessible select {\n transform: scale(0);\n}\n\n.p-overflow-hidden {\n overflow: hidden;\n padding-right: ".concat(dt2("scrollbar.width"), ";\n}\n"); }, "css"); -var classes$x = {}; +var classes$w = {}; var inlineStyles$2 = {}; var BaseStyle = { name: "base", css: css$1, - theme: theme$t, - classes: classes$x, + theme: theme$s, + classes: classes$w, inlineStyles: inlineStyles$2, load: /* @__PURE__ */ __name(function load2(style2) { var options4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; @@ -144988,7 +145986,7 @@ var BaseStyle = { var computedStyle = transform2(resolve$1(style2, { dt })); - return isNotEmpty$1(computedStyle) ? useStyle(minifyCSS$1(computedStyle), _objectSpread$g({ + return isNotEmpty$1(computedStyle) ? useStyle(minifyCSS$1(computedStyle), _objectSpread$f({ name: this.name }, options4)) : {}; }, "load"), @@ -145058,7 +146056,7 @@ var BaseStyle = { return css4.join(""); }, "getThemeStyleSheet"), extend: /* @__PURE__ */ __name(function extend4(style2) { - return _objectSpread$g(_objectSpread$g({}, this), {}, { + return _objectSpread$f(_objectSpread$f({}, this), {}, { css: void 0, theme: void 0 }, style2); @@ -145067,15 +146065,15 @@ var BaseStyle = { var BaseComponentStyle = BaseStyle.extend({ name: "common" }); -function _typeof$d(o2) { +function _typeof$c(o2) { "@babel/helpers - typeof"; - return _typeof$d = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return _typeof$c = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { return typeof o3; } : function(o3) { return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; - }, _typeof$d(o2); + }, _typeof$c(o2); } -__name(_typeof$d, "_typeof$d"); +__name(_typeof$c, "_typeof$c"); function _toArray(r2) { return _arrayWithHoles$2(r2) || _iterableToArray$b(r2) || _unsupportedIterableToArray$e(r2) || _nonIterableRest$2(); } @@ -145132,7 +146130,7 @@ function _arrayWithHoles$2(r2) { if (Array.isArray(r2)) return r2; } __name(_arrayWithHoles$2, "_arrayWithHoles$2"); -function ownKeys$f(e2, r2) { +function ownKeys$e(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { var o2 = Object.getOwnPropertySymbols(e2); @@ -145142,40 +146140,40 @@ function ownKeys$f(e2, r2) { } return t2; } -__name(ownKeys$f, "ownKeys$f"); -function _objectSpread$f(e2) { +__name(ownKeys$e, "ownKeys$e"); +function _objectSpread$e(e2) { for (var r2 = 1; r2 < arguments.length; r2++) { var t2 = null != arguments[r2] ? arguments[r2] : {}; - r2 % 2 ? ownKeys$f(Object(t2), true).forEach(function(r3) { - _defineProperty$f(e2, r3, t2[r3]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$f(Object(t2)).forEach(function(r3) { + r2 % 2 ? ownKeys$e(Object(t2), true).forEach(function(r3) { + _defineProperty$e(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$e(Object(t2)).forEach(function(r3) { Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } -__name(_objectSpread$f, "_objectSpread$f"); -function _defineProperty$f(e2, r2, t2) { - return (r2 = _toPropertyKey$c(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; +__name(_objectSpread$e, "_objectSpread$e"); +function _defineProperty$e(e2, r2, t2) { + return (r2 = _toPropertyKey$b(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; } -__name(_defineProperty$f, "_defineProperty$f"); -function _toPropertyKey$c(t2) { - var i2 = _toPrimitive$c(t2, "string"); - return "symbol" == _typeof$d(i2) ? i2 : i2 + ""; +__name(_defineProperty$e, "_defineProperty$e"); +function _toPropertyKey$b(t2) { + var i2 = _toPrimitive$b(t2, "string"); + return "symbol" == _typeof$c(i2) ? i2 : i2 + ""; } -__name(_toPropertyKey$c, "_toPropertyKey$c"); -function _toPrimitive$c(t2, r2) { - if ("object" != _typeof$d(t2) || !t2) return t2; +__name(_toPropertyKey$b, "_toPropertyKey$b"); +function _toPrimitive$b(t2, r2) { + if ("object" != _typeof$c(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { var i2 = e2.call(t2, r2 || "default"); - if ("object" != _typeof$d(i2)) return i2; + if ("object" != _typeof$c(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r2 ? String : Number)(t2); } -__name(_toPrimitive$c, "_toPrimitive$c"); -var script$P = { +__name(_toPrimitive$b, "_toPrimitive$b"); +var script$O = { name: "BaseComponent", props: { pt: { @@ -145247,7 +146245,7 @@ var script$P = { this.rootEl = findSingle(this.$el, '[data-pc-name="'.concat(toFlatCase$1(this.$.type.name), '"]')); if (this.rootEl) { this.$attrSelector && !this.rootEl.hasAttribute(this.$attrSelector) && this.rootEl.setAttribute(this.$attrSelector, ""); - this.rootEl.$pc = _objectSpread$f({ + this.rootEl.$pc = _objectSpread$e({ name: this.$.type.name, attrSelector: this.$attrSelector }, this.$params); @@ -145255,7 +146253,7 @@ var script$P = { this._loadStyles(); this._hook("onBeforeMount"); }, "beforeMount"), - mounted: /* @__PURE__ */ __name(function mounted7() { + mounted: /* @__PURE__ */ __name(function mounted8() { this._hook("onMounted"); }, "mounted"), beforeUpdate: /* @__PURE__ */ __name(function beforeUpdate2() { @@ -145309,7 +146307,7 @@ var script$P = { }, "_loadCoreStyles"), _loadGlobalStyles: /* @__PURE__ */ __name(function _loadGlobalStyles2() { var globalCSS = this._useGlobalPT(this._getOptionValue, "global.css", this.$params); - isNotEmpty$1(globalCSS) && BaseStyle.load(globalCSS, _objectSpread$f({ + isNotEmpty$1(globalCSS) && BaseStyle.load(globalCSS, _objectSpread$e({ name: "global" }, this.$styleOptions)); }, "_loadGlobalStyles"), @@ -145319,16 +146317,16 @@ var script$P = { if (!config_default.isStyleNameLoaded("common")) { var _this$$style3, _this$$style3$getComm; var _ref3 = ((_this$$style3 = this.$style) === null || _this$$style3 === void 0 || (_this$$style3$getComm = _this$$style3.getCommonTheme) === null || _this$$style3$getComm === void 0 ? void 0 : _this$$style3$getComm.call(_this$$style3)) || {}, primitive = _ref3.primitive, semantic = _ref3.semantic, global2 = _ref3.global, style2 = _ref3.style; - BaseStyle.load(primitive === null || primitive === void 0 ? void 0 : primitive.css, _objectSpread$f({ + BaseStyle.load(primitive === null || primitive === void 0 ? void 0 : primitive.css, _objectSpread$e({ name: "primitive-variables" }, this.$styleOptions)); - BaseStyle.load(semantic === null || semantic === void 0 ? void 0 : semantic.css, _objectSpread$f({ + BaseStyle.load(semantic === null || semantic === void 0 ? void 0 : semantic.css, _objectSpread$e({ name: "semantic-variables" }, this.$styleOptions)); - BaseStyle.load(global2 === null || global2 === void 0 ? void 0 : global2.css, _objectSpread$f({ + BaseStyle.load(global2 === null || global2 === void 0 ? void 0 : global2.css, _objectSpread$e({ name: "global-variables" }, this.$styleOptions)); - BaseStyle.loadTheme(_objectSpread$f({ + BaseStyle.loadTheme(_objectSpread$e({ name: "global-style" }, this.$styleOptions), style2); config_default.setLoadedStyleName("common"); @@ -145336,10 +146334,10 @@ var script$P = { if (!config_default.isStyleNameLoaded((_this$$style4 = this.$style) === null || _this$$style4 === void 0 ? void 0 : _this$$style4.name) && (_this$$style5 = this.$style) !== null && _this$$style5 !== void 0 && _this$$style5.name) { var _this$$style6, _this$$style6$getComp, _this$$style7, _this$$style8; var _ref4 = ((_this$$style6 = this.$style) === null || _this$$style6 === void 0 || (_this$$style6$getComp = _this$$style6.getComponentTheme) === null || _this$$style6$getComp === void 0 ? void 0 : _this$$style6$getComp.call(_this$$style6)) || {}, css4 = _ref4.css, _style = _ref4.style; - (_this$$style7 = this.$style) === null || _this$$style7 === void 0 || _this$$style7.load(css4, _objectSpread$f({ + (_this$$style7 = this.$style) === null || _this$$style7 === void 0 || _this$$style7.load(css4, _objectSpread$e({ name: "".concat(this.$style.name, "-variables") }, this.$styleOptions)); - (_this$$style8 = this.$style) === null || _this$$style8 === void 0 || _this$$style8.loadTheme(_objectSpread$f({ + (_this$$style8 = this.$style) === null || _this$$style8 === void 0 || _this$$style8.loadTheme(_objectSpread$e({ name: "".concat(this.$style.name, "-style") }, this.$styleOptions), _style); config_default.setLoadedStyleName(this.$style.name); @@ -145347,7 +146345,7 @@ var script$P = { if (!config_default.isStyleNameLoaded("layer-order")) { var _this$$style9, _this$$style9$getLaye; var layerOrder = (_this$$style9 = this.$style) === null || _this$$style9 === void 0 || (_this$$style9$getLaye = _this$$style9.getLayerOrderThemeCSS) === null || _this$$style9$getLaye === void 0 ? void 0 : _this$$style9$getLaye.call(_this$$style9); - BaseStyle.load(layerOrder, _objectSpread$f({ + BaseStyle.load(layerOrder, _objectSpread$e({ name: "layer-order", first: true }, this.$styleOptions)); @@ -145357,7 +146355,7 @@ var script$P = { _loadScopedThemeStyles: /* @__PURE__ */ __name(function _loadScopedThemeStyles3(preset) { var _this$$style10, _this$$style10$getPre, _this$$style11; var _ref5 = ((_this$$style10 = this.$style) === null || _this$$style10 === void 0 || (_this$$style10$getPre = _this$$style10.getPresetTheme) === null || _this$$style10$getPre === void 0 ? void 0 : _this$$style10$getPre.call(_this$$style10, preset, "[".concat(this.$attrSelector, "]"))) || {}, css4 = _ref5.css; - var scopedStyle = (_this$$style11 = this.$style) === null || _this$$style11 === void 0 ? void 0 : _this$$style11.load(css4, _objectSpread$f({ + var scopedStyle = (_this$$style11 = this.$style) === null || _this$$style11 === void 0 ? void 0 : _this$$style11.load(css4, _objectSpread$e({ name: "".concat(this.$attrSelector, "-").concat(this.$style.name) }, this.$styleOptions)); this.scopedStyleEl = scopedStyle.el; @@ -145393,11 +146391,11 @@ var script$P = { var searchOut = /./g.test(key) && !!params[key.split(".")[0]]; var _ref6 = this._getPropValue("ptOptions") || ((_this$$primevueConfig2 = this.$primevueConfig) === null || _this$$primevueConfig2 === void 0 ? void 0 : _this$$primevueConfig2.ptOptions) || {}, _ref6$mergeSections = _ref6.mergeSections, mergeSections = _ref6$mergeSections === void 0 ? true : _ref6$mergeSections, _ref6$mergeProps = _ref6.mergeProps, useMergeProps = _ref6$mergeProps === void 0 ? false : _ref6$mergeProps; var global2 = searchInDefaultPT ? searchOut ? this._useGlobalPT(this._getPTClassValue, key, params) : this._useDefaultPT(this._getPTClassValue, key, params) : void 0; - var self2 = searchOut ? void 0 : this._getPTSelf(obj, this._getPTClassValue, key, _objectSpread$f(_objectSpread$f({}, params), {}, { + var self2 = searchOut ? void 0 : this._getPTSelf(obj, this._getPTClassValue, key, _objectSpread$e(_objectSpread$e({}, params), {}, { global: global2 || {} })); var datasets = this._getPTDatasets(key); - return mergeSections || !mergeSections && self2 ? useMergeProps ? this._mergeProps(useMergeProps, global2, self2, datasets) : _objectSpread$f(_objectSpread$f(_objectSpread$f({}, global2), self2), datasets) : _objectSpread$f(_objectSpread$f({}, self2), datasets); + return mergeSections || !mergeSections && self2 ? useMergeProps ? this._mergeProps(useMergeProps, global2, self2, datasets) : _objectSpread$e(_objectSpread$e(_objectSpread$e({}, global2), self2), datasets) : _objectSpread$e(_objectSpread$e({}, self2), datasets); }, "_getPTValue"), _getPTSelf: /* @__PURE__ */ __name(function _getPTSelf2() { var obj = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; @@ -145416,7 +146414,7 @@ var script$P = { var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; var datasetPrefix = "data-pc-"; var isExtended = key === "root" && isNotEmpty$1((_this$pt4 = this.pt) === null || _this$pt4 === void 0 ? void 0 : _this$pt4["data-pc-section"]); - return key !== "transition" && _objectSpread$f(_objectSpread$f({}, key === "root" && _objectSpread$f(_objectSpread$f(_defineProperty$f({}, "".concat(datasetPrefix, "name"), toFlatCase$1(isExtended ? (_this$pt5 = this.pt) === null || _this$pt5 === void 0 ? void 0 : _this$pt5["data-pc-section"] : this.$.type.name)), isExtended && _defineProperty$f({}, "".concat(datasetPrefix, "extend"), toFlatCase$1(this.$.type.name))), isClient() && _defineProperty$f({}, "".concat(this.$attrSelector), ""))), {}, _defineProperty$f({}, "".concat(datasetPrefix, "section"), toFlatCase$1(key))); + return key !== "transition" && _objectSpread$e(_objectSpread$e({}, key === "root" && _objectSpread$e(_objectSpread$e(_defineProperty$e({}, "".concat(datasetPrefix, "name"), toFlatCase$1(isExtended ? (_this$pt5 = this.pt) === null || _this$pt5 === void 0 ? void 0 : _this$pt5["data-pc-section"] : this.$.type.name)), isExtended && _defineProperty$e({}, "".concat(datasetPrefix, "extend"), toFlatCase$1(this.$.type.name))), isClient() && _defineProperty$e({}, "".concat(this.$attrSelector), ""))), {}, _defineProperty$e({}, "".concat(datasetPrefix, "section"), toFlatCase$1(key))); }, "_getPTDatasets"), _getPTClassValue: /* @__PURE__ */ __name(function _getPTClassValue2() { var value4 = this._getOptionValue.apply(this, arguments); @@ -145454,7 +146452,7 @@ var script$P = { if (originalValue === void 0 && value4 === void 0) return void 0; else if (isString$5(value4)) return value4; else if (isString$5(originalValue)) return originalValue; - return mergeSections || !mergeSections && value4 ? useMergeProps ? this._mergeProps(useMergeProps, originalValue, value4) : _objectSpread$f(_objectSpread$f({}, originalValue), value4) : value4; + return mergeSections || !mergeSections && value4 ? useMergeProps ? this._mergeProps(useMergeProps, originalValue, value4) : _objectSpread$e(_objectSpread$e({}, originalValue), value4) : value4; } return fn(pt); }, "_usePT"), @@ -145467,7 +146465,7 @@ var script$P = { ptm: /* @__PURE__ */ __name(function ptm2() { var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - return this._getPTValue(this.pt, key, _objectSpread$f(_objectSpread$f({}, this.$params), params)); + return this._getPTValue(this.pt, key, _objectSpread$e(_objectSpread$e({}, this.$params), params)); }, "ptm"), ptmi: /* @__PURE__ */ __name(function ptmi2() { var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; @@ -145478,22 +146476,22 @@ var script$P = { var obj = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; var key = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; var params = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; - return this._getPTValue(obj, key, _objectSpread$f({ + return this._getPTValue(obj, key, _objectSpread$e({ instance: this }, params), false); }, "ptmo"), cx: /* @__PURE__ */ __name(function cx2() { var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - return !this.isUnstyled ? this._getOptionValue(this.$style.classes, key, _objectSpread$f(_objectSpread$f({}, this.$params), params)) : void 0; + return !this.isUnstyled ? this._getOptionValue(this.$style.classes, key, _objectSpread$e(_objectSpread$e({}, this.$params), params)) : void 0; }, "cx"), sx: /* @__PURE__ */ __name(function sx2() { var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; var when = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; var params = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; if (when) { - var self2 = this._getOptionValue(this.$style.inlineStyles, key, _objectSpread$f(_objectSpread$f({}, this.$params), params)); - var base2 = this._getOptionValue(BaseComponentStyle.inlineStyles, key, _objectSpread$f(_objectSpread$f({}, this.$params), params)); + var self2 = this._getOptionValue(this.$style.inlineStyles, key, _objectSpread$e(_objectSpread$e({}, this.$params), params)); + var base2 = this._getOptionValue(BaseComponentStyle.inlineStyles, key, _objectSpread$e(_objectSpread$e({}, this.$params), params)); return [base2, self2]; } return void 0; @@ -145511,7 +146509,7 @@ var script$P = { defaultPT: /* @__PURE__ */ __name(function defaultPT2() { var _this$$primevueConfig5, _this5 = this; return this._getPT((_this$$primevueConfig5 = this.$primevueConfig) === null || _this$$primevueConfig5 === void 0 ? void 0 : _this$$primevueConfig5.pt, void 0, function(value4) { - return _this5._getOptionValue(value4, _this5.$name, _objectSpread$f({}, _this5.$params)) || resolve$1(value4, _objectSpread$f({}, _this5.$params)); + return _this5._getOptionValue(value4, _this5.$name, _objectSpread$e({}, _this5.$params)) || resolve$1(value4, _objectSpread$e({}, _this5.$params)); }); }, "defaultPT"), isUnstyled: /* @__PURE__ */ __name(function isUnstyled2() { @@ -145531,7 +146529,7 @@ var script$P = { return (_this$$primevueConfig7 = this.$primevueConfig) === null || _this$$primevueConfig7 === void 0 ? void 0 : _this$$primevueConfig7.theme; }, "$theme"), $style: /* @__PURE__ */ __name(function $style2() { - return _objectSpread$f(_objectSpread$f({ + return _objectSpread$e(_objectSpread$e({ classes: void 0, inlineStyles: void 0, load: /* @__PURE__ */ __name(function load3() { @@ -145596,16 +146594,16 @@ var script$P = { }, "$_attrsWithoutPT") } }; -var classes$w = { +var classes$v = { root: "p-form p-component" }; var FormStyle = BaseStyle.extend({ name: "form", - classes: classes$w + classes: classes$v }); -var script$1$x = { +var script$1$w = { name: "BaseForm", - "extends": script$P, + "extends": script$O, style: FormStyle, props: { resolver: { @@ -145633,198 +146631,9 @@ var script$1$x = { "default": true } }, - provide: /* @__PURE__ */ __name(function provide12() { - return { - $pcForm: this, - $parentInstance: this - }; - }, "provide") -}; -function _typeof$c(o2) { - "@babel/helpers - typeof"; - return _typeof$c = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { - return typeof o3; - } : function(o3) { - return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; - }, _typeof$c(o2); -} -__name(_typeof$c, "_typeof$c"); -function ownKeys$e(e2, r2) { - var t2 = Object.keys(e2); - if (Object.getOwnPropertySymbols) { - var o2 = Object.getOwnPropertySymbols(e2); - r2 && (o2 = o2.filter(function(r3) { - return Object.getOwnPropertyDescriptor(e2, r3).enumerable; - })), t2.push.apply(t2, o2); - } - return t2; -} -__name(ownKeys$e, "ownKeys$e"); -function _objectSpread$e(e2) { - for (var r2 = 1; r2 < arguments.length; r2++) { - var t2 = null != arguments[r2] ? arguments[r2] : {}; - r2 % 2 ? ownKeys$e(Object(t2), true).forEach(function(r3) { - _defineProperty$e(e2, r3, t2[r3]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$e(Object(t2)).forEach(function(r3) { - Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); - }); - } - return e2; -} -__name(_objectSpread$e, "_objectSpread$e"); -function _defineProperty$e(e2, r2, t2) { - return (r2 = _toPropertyKey$b(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; -} -__name(_defineProperty$e, "_defineProperty$e"); -function _toPropertyKey$b(t2) { - var i2 = _toPrimitive$b(t2, "string"); - return "symbol" == _typeof$c(i2) ? i2 : i2 + ""; -} -__name(_toPropertyKey$b, "_toPropertyKey$b"); -function _toPrimitive$b(t2, r2) { - if ("object" != _typeof$c(t2) || !t2) return t2; - var e2 = t2[Symbol.toPrimitive]; - if (void 0 !== e2) { - var i2 = e2.call(t2, r2 || "default"); - if ("object" != _typeof$c(i2)) return i2; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r2 ? String : Number)(t2); -} -__name(_toPrimitive$b, "_toPrimitive$b"); -function _slicedToArray$1(r2, e2) { - return _arrayWithHoles$1(r2) || _iterableToArrayLimit$1(r2, e2) || _unsupportedIterableToArray$d(r2, e2) || _nonIterableRest$1(); -} -__name(_slicedToArray$1, "_slicedToArray$1"); -function _nonIterableRest$1() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableRest$1, "_nonIterableRest$1"); -function _unsupportedIterableToArray$d(r2, a2) { - if (r2) { - if ("string" == typeof r2) return _arrayLikeToArray$d(r2, a2); - var t2 = {}.toString.call(r2).slice(8, -1); - return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$d(r2, a2) : void 0; - } -} -__name(_unsupportedIterableToArray$d, "_unsupportedIterableToArray$d"); -function _arrayLikeToArray$d(r2, a2) { - (null == a2 || a2 > r2.length) && (a2 = r2.length); - for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; - return n2; -} -__name(_arrayLikeToArray$d, "_arrayLikeToArray$d"); -function _iterableToArrayLimit$1(r2, l2) { - var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; - if (null != t2) { - var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false; - try { - if (i2 = (t2 = t2.call(r2)).next, 0 === l2) ; - else for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true) ; - } catch (r3) { - o2 = true, n2 = r3; - } finally { - try { - if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2)) return; - } finally { - if (o2) throw n2; - } - } - return a2; - } -} -__name(_iterableToArrayLimit$1, "_iterableToArrayLimit$1"); -function _arrayWithHoles$1(r2) { - if (Array.isArray(r2)) return r2; -} -__name(_arrayWithHoles$1, "_arrayWithHoles$1"); -var script$O = { - name: "Form", - "extends": script$1$x, - inheritAttrs: false, - emits: ["submit"], - setup: /* @__PURE__ */ __name(function setup2(props, _ref) { - var emit2 = _ref.emit; - var $form = useForm(props); - var register3 = /* @__PURE__ */ __name(function register4(field2, options4) { - var _$form$defineField = $form.defineField(field2, options4), _$form$defineField2 = _slicedToArray$1(_$form$defineField, 2), fieldProps = _$form$defineField2[1]; - return fieldProps; - }, "register"); - var onSubmit = $form.handleSubmit(function(e2) { - emit2("submit", e2); - }); - return _objectSpread$e({ - register: register3, - onSubmit - }, omit$1($form, ["handleSubmit"])); - }, "setup") -}; -function render$N(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("form", mergeProps$2({ - onSubmit: _cache[0] || (_cache[0] = withModifiers(function() { - return $setup.onSubmit && $setup.onSubmit.apply($setup, arguments); - }, ["prevent"])), - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default", mergeProps$2({ - register: $setup.register, - valid: _ctx.valid, - reset: _ctx.reset - }, _ctx.states))], 16); -} -__name(render$N, "render$N"); -script$O.render = render$N; -var classes$v = { - root: "p-formfield p-component" -}; -var FormFieldStyle = BaseStyle.extend({ - name: "formfield", - classes: classes$v -}); -var script$1$w = { - name: "BaseFormField", - "extends": script$P, - style: FormFieldStyle, - props: { - name: { - type: String, - "default": void 0 - }, - resolver: { - type: Function, - "default": void 0 - }, - initialValue: { - type: null, - "default": void 0 - }, - validateOnValueUpdate: { - type: Boolean, - "default": void 0 - }, - validateOnBlur: { - type: Boolean, - "default": void 0 - }, - validateOnMount: { - type: Boolean, - "default": void 0 - }, - validateOnSubmit: { - type: Boolean, - "default": void 0 - }, - as: { - type: [String, Object], - "default": "DIV" - }, - asChild: { - type: Boolean, - "default": false - } - }, provide: /* @__PURE__ */ __name(function provide13() { return { - $pcFormField: this, + $pcForm: this, $parentInstance: this }; }, "provide") @@ -145881,10 +146690,199 @@ function _toPrimitive$a(t2, r2) { return ("string" === r2 ? String : Number)(t2); } __name(_toPrimitive$a, "_toPrimitive$a"); +function _slicedToArray$1(r2, e2) { + return _arrayWithHoles$1(r2) || _iterableToArrayLimit$1(r2, e2) || _unsupportedIterableToArray$d(r2, e2) || _nonIterableRest$1(); +} +__name(_slicedToArray$1, "_slicedToArray$1"); +function _nonIterableRest$1() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +__name(_nonIterableRest$1, "_nonIterableRest$1"); +function _unsupportedIterableToArray$d(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray$d(r2, a2); + var t2 = {}.toString.call(r2).slice(8, -1); + return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$d(r2, a2) : void 0; + } +} +__name(_unsupportedIterableToArray$d, "_unsupportedIterableToArray$d"); +function _arrayLikeToArray$d(r2, a2) { + (null == a2 || a2 > r2.length) && (a2 = r2.length); + for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++) n2[e2] = r2[e2]; + return n2; +} +__name(_arrayLikeToArray$d, "_arrayLikeToArray$d"); +function _iterableToArrayLimit$1(r2, l2) { + var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; + if (null != t2) { + var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false; + try { + if (i2 = (t2 = t2.call(r2)).next, 0 === l2) ; + else for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true) ; + } catch (r3) { + o2 = true, n2 = r3; + } finally { + try { + if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2)) return; + } finally { + if (o2) throw n2; + } + } + return a2; + } +} +__name(_iterableToArrayLimit$1, "_iterableToArrayLimit$1"); +function _arrayWithHoles$1(r2) { + if (Array.isArray(r2)) return r2; +} +__name(_arrayWithHoles$1, "_arrayWithHoles$1"); var script$N = { - name: "FormField", + name: "Form", "extends": script$1$w, inheritAttrs: false, + emits: ["submit"], + setup: /* @__PURE__ */ __name(function setup2(props, _ref) { + var emit2 = _ref.emit; + var $form = useForm(props); + var register3 = /* @__PURE__ */ __name(function register4(field2, options4) { + var _$form$defineField = $form.defineField(field2, options4), _$form$defineField2 = _slicedToArray$1(_$form$defineField, 2), fieldProps = _$form$defineField2[1]; + return fieldProps; + }, "register"); + var onSubmit = $form.handleSubmit(function(e2) { + emit2("submit", e2); + }); + return _objectSpread$d({ + register: register3, + onSubmit + }, omit$1($form, ["handleSubmit"])); + }, "setup") +}; +function render$M(_ctx, _cache, $props, $setup, $data, $options) { + return openBlock(), createElementBlock("form", mergeProps$2({ + onSubmit: _cache[0] || (_cache[0] = withModifiers(function() { + return $setup.onSubmit && $setup.onSubmit.apply($setup, arguments); + }, ["prevent"])), + "class": _ctx.cx("root") + }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default", mergeProps$2({ + register: $setup.register, + valid: _ctx.valid, + reset: _ctx.reset + }, _ctx.states))], 16); +} +__name(render$M, "render$M"); +script$N.render = render$M; +var classes$u = { + root: "p-formfield p-component" +}; +var FormFieldStyle = BaseStyle.extend({ + name: "formfield", + classes: classes$u +}); +var script$1$v = { + name: "BaseFormField", + "extends": script$O, + style: FormFieldStyle, + props: { + name: { + type: String, + "default": void 0 + }, + resolver: { + type: Function, + "default": void 0 + }, + initialValue: { + type: null, + "default": void 0 + }, + validateOnValueUpdate: { + type: Boolean, + "default": void 0 + }, + validateOnBlur: { + type: Boolean, + "default": void 0 + }, + validateOnMount: { + type: Boolean, + "default": void 0 + }, + validateOnSubmit: { + type: Boolean, + "default": void 0 + }, + as: { + type: [String, Object], + "default": "DIV" + }, + asChild: { + type: Boolean, + "default": false + } + }, + provide: /* @__PURE__ */ __name(function provide14() { + return { + $pcFormField: this, + $parentInstance: this + }; + }, "provide") +}; +function _typeof$a(o2) { + "@babel/helpers - typeof"; + return _typeof$a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof$a(o2); +} +__name(_typeof$a, "_typeof$a"); +function ownKeys$c(e2, r2) { + var t2 = Object.keys(e2); + if (Object.getOwnPropertySymbols) { + var o2 = Object.getOwnPropertySymbols(e2); + r2 && (o2 = o2.filter(function(r3) { + return Object.getOwnPropertyDescriptor(e2, r3).enumerable; + })), t2.push.apply(t2, o2); + } + return t2; +} +__name(ownKeys$c, "ownKeys$c"); +function _objectSpread$c(e2) { + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = null != arguments[r2] ? arguments[r2] : {}; + r2 % 2 ? ownKeys$c(Object(t2), true).forEach(function(r3) { + _defineProperty$c(e2, r3, t2[r3]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$c(Object(t2)).forEach(function(r3) { + Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); + }); + } + return e2; +} +__name(_objectSpread$c, "_objectSpread$c"); +function _defineProperty$c(e2, r2, t2) { + return (r2 = _toPropertyKey$9(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; +} +__name(_defineProperty$c, "_defineProperty$c"); +function _toPropertyKey$9(t2) { + var i2 = _toPrimitive$9(t2, "string"); + return "symbol" == _typeof$a(i2) ? i2 : i2 + ""; +} +__name(_toPropertyKey$9, "_toPropertyKey$9"); +function _toPrimitive$9(t2, r2) { + if ("object" != _typeof$a(t2) || !t2) return t2; + var e2 = t2[Symbol.toPrimitive]; + if (void 0 !== e2) { + var i2 = e2.call(t2, r2 || "default"); + if ("object" != _typeof$a(i2)) return i2; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r2 ? String : Number)(t2); +} +__name(_toPrimitive$9, "_toPrimitive$9"); +var script$M = { + name: "FormField", + "extends": script$1$v, + inheritAttrs: false, inject: { $pcForm: { "default": void 0 @@ -145916,11 +146914,11 @@ var script$N = { return ((_this$$pcForm2 = this.$pcForm) === null || _this$$pcForm2 === void 0 || (_this$$pcForm2 = _this$$pcForm2.fields) === null || _this$$pcForm2 === void 0 ? void 0 : _this$$pcForm2[this.name]) || {}; }, "field"), fieldAttrs: /* @__PURE__ */ __name(function fieldAttrs() { - return _objectSpread$d(_objectSpread$d({}, this.field.props), this.field.states); + return _objectSpread$c(_objectSpread$c({}, this.field.props), this.field.states); }, "fieldAttrs") } }; -function render$M(_ctx, _cache, $props, $setup, $data, $options) { +function render$L(_ctx, _cache, $props, $setup, $data, $options) { return !_ctx.asChild ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps$2({ key: 0, "class": _ctx.cx("root") @@ -145937,8 +146935,8 @@ function render$M(_ctx, _cache, $props, $setup, $data, $options) { props: $options.field.props }, $options.fieldAttrs)); } -__name(render$M, "render$M"); -script$N.render = render$M; +__name(render$L, "render$L"); +script$M.render = render$L; var __defProp$1 = Object.defineProperty; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; @@ -146836,9 +147834,9 @@ var defineProperty$1 = function() { } catch (e2) { } }(); -var _defineProperty$b = defineProperty$1; -const _defineProperty$c = /* @__PURE__ */ getDefaultExportFromCjs(_defineProperty$b); -var defineProperty = _defineProperty$b; +var _defineProperty$a = defineProperty$1; +const _defineProperty$b = /* @__PURE__ */ getDefaultExportFromCjs(_defineProperty$a); +var defineProperty = _defineProperty$a; function baseAssignValue$2(object, key, value4) { if (key == "__proto__" && defineProperty) { defineProperty(object, key, { @@ -147533,11 +148531,11 @@ function cloneDeep(value4) { __name(cloneDeep, "cloneDeep"); var cloneDeep_1 = cloneDeep; const cloneDeep$1 = /* @__PURE__ */ getDefaultExportFromCjs(cloneDeep_1); -var script$M = { +var script$L = { name: "CheckIcon", "extends": script$$ }; -function render$L(_ctx, _cache, $props, $setup, $data, $options) { +function render$K(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps$2({ width: "14", height: "14", @@ -147549,13 +148547,13 @@ function render$L(_ctx, _cache, $props, $setup, $data, $options) { fill: "currentColor" }, null, -1)]), 16); } -__name(render$L, "render$L"); -script$M.render = render$L; -var script$L = { +__name(render$K, "render$K"); +script$L.render = render$K; +var script$K = { name: "MinusIcon", "extends": script$$ }; -function render$K(_ctx, _cache, $props, $setup, $data, $options) { +function render$J(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("svg", mergeProps$2({ width: "14", height: "14", @@ -147567,14 +148565,14 @@ function render$K(_ctx, _cache, $props, $setup, $data, $options) { fill: "currentColor" }, null, -1)]), 16); } -__name(render$K, "render$K"); -script$L.render = render$K; -var theme$s = /* @__PURE__ */ __name(function theme14(_ref) { +__name(render$J, "render$J"); +script$K.render = render$J; +var theme$r = /* @__PURE__ */ __name(function theme15(_ref) { var dt2 = _ref.dt; return "\n.p-checkbox {\n position: relative;\n display: inline-flex;\n user-select: none;\n vertical-align: bottom;\n width: ".concat(dt2("checkbox.width"), ";\n height: ").concat(dt2("checkbox.height"), ";\n}\n\n.p-checkbox-input {\n cursor: pointer;\n appearance: none;\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: 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(dt2("checkbox.border.radius"), ";\n}\n\n.p-checkbox-box {\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: ").concat(dt2("checkbox.border.radius"), ";\n border: 1px solid ").concat(dt2("checkbox.border.color"), ";\n background: ").concat(dt2("checkbox.background"), ";\n width: ").concat(dt2("checkbox.width"), ";\n height: ").concat(dt2("checkbox.height"), ";\n transition: background ").concat(dt2("checkbox.transition.duration"), ", color ").concat(dt2("checkbox.transition.duration"), ", border-color ").concat(dt2("checkbox.transition.duration"), ", box-shadow ").concat(dt2("checkbox.transition.duration"), ", outline-color ").concat(dt2("checkbox.transition.duration"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt2("checkbox.shadow"), ";\n}\n\n.p-checkbox-icon {\n transition-duration: ").concat(dt2("checkbox.transition.duration"), ";\n color: ").concat(dt2("checkbox.icon.color"), ";\n font-size: ").concat(dt2("checkbox.icon.size"), ";\n width: ").concat(dt2("checkbox.icon.size"), ";\n height: ").concat(dt2("checkbox.icon.size"), ";\n}\n\n.p-checkbox:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-box {\n border-color: ").concat(dt2("checkbox.hover.border.color"), ";\n}\n\n.p-checkbox-checked .p-checkbox-box {\n border-color: ").concat(dt2("checkbox.checked.border.color"), ";\n background: ").concat(dt2("checkbox.checked.background"), ";\n}\n\n.p-checkbox-checked .p-checkbox-icon {\n color: ").concat(dt2("checkbox.icon.checked.color"), ";\n}\n\n.p-checkbox-checked:not(.p-disabled):has(.p-checkbox-input:hover) .p-checkbox-box {\n background: ").concat(dt2("checkbox.checked.hover.background"), ";\n border-color: ").concat(dt2("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(dt2("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(dt2("checkbox.focus.border.color"), ";\n box-shadow: ").concat(dt2("checkbox.focus.ring.shadow"), ";\n outline: ").concat(dt2("checkbox.focus.ring.width"), " ").concat(dt2("checkbox.focus.ring.style"), " ").concat(dt2("checkbox.focus.ring.color"), ";\n outline-offset: ").concat(dt2("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(dt2("checkbox.checked.focus.border.color"), ";\n}\n\n.p-checkbox.p-invalid > .p-checkbox-box {\n border-color: ").concat(dt2("checkbox.invalid.border.color"), ";\n}\n\n.p-checkbox.p-variant-filled .p-checkbox-box {\n background: ").concat(dt2("checkbox.filled.background"), ";\n}\n\n.p-checkbox-checked.p-variant-filled .p-checkbox-box {\n background: ").concat(dt2("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(dt2("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(dt2("checkbox.disabled.background"), ";\n border-color: ").concat(dt2("checkbox.checked.disabled.border.color"), ";\n}\n\n.p-checkbox.p-disabled .p-checkbox-box .p-checkbox-icon {\n color: ").concat(dt2("checkbox.icon.disabled.color"), ";\n}\n\n.p-checkbox-sm,\n.p-checkbox-sm .p-checkbox-box {\n width: ").concat(dt2("checkbox.sm.width"), ";\n height: ").concat(dt2("checkbox.sm.height"), ";\n}\n\n.p-checkbox-sm .p-checkbox-icon {\n font-size: ").concat(dt2("checkbox.icon.sm.size"), ";\n width: ").concat(dt2("checkbox.icon.sm.size"), ";\n height: ").concat(dt2("checkbox.icon.sm.size"), ";\n}\n\n.p-checkbox-lg,\n.p-checkbox-lg .p-checkbox-box {\n width: ").concat(dt2("checkbox.lg.width"), ";\n height: ").concat(dt2("checkbox.lg.height"), ";\n}\n\n.p-checkbox-lg .p-checkbox-icon {\n font-size: ").concat(dt2("checkbox.icon.lg.size"), ";\n width: ").concat(dt2("checkbox.icon.lg.size"), ";\n height: ").concat(dt2("checkbox.icon.lg.size"), ";\n}\n"); }, "theme"); -var classes$u = { - root: /* @__PURE__ */ __name(function root7(_ref2) { +var classes$t = { + root: /* @__PURE__ */ __name(function root8(_ref2) { var instance = _ref2.instance, props = _ref2.props; return ["p-checkbox p-component", { "p-checkbox-checked": instance.checked, @@ -147591,10 +148589,10 @@ var classes$u = { }; var CheckboxStyle = BaseStyle$1.extend({ name: "checkbox", - theme: theme$s, - classes: classes$u + theme: theme$r, + classes: classes$t }); -var script$1$v = { +var script$1$u = { name: "BaseCheckbox", "extends": script$10, props: { @@ -147646,7 +148644,7 @@ var script$1$v = { } }, style: CheckboxStyle, - provide: /* @__PURE__ */ __name(function provide14() { + provide: /* @__PURE__ */ __name(function provide15() { return { $pcCheckbox: this, $parentInstance: this @@ -147683,9 +148681,9 @@ function _arrayLikeToArray$c(r2, a2) { return n2; } __name(_arrayLikeToArray$c, "_arrayLikeToArray$c"); -var script$K = { +var script$J = { name: "Checkbox", - "extends": script$1$v, + "extends": script$1$u, inheritAttrs: false, emits: ["change", "focus", "blur", "update:indeterminate"], inject: { @@ -147693,7 +148691,7 @@ var script$K = { "default": void 0 } }, - data: /* @__PURE__ */ __name(function data6() { + data: /* @__PURE__ */ __name(function data7() { return { d_indeterminate: this.indeterminate }; @@ -147754,13 +148752,13 @@ var script$K = { }, "checked") }, components: { - CheckIcon: script$M, - MinusIcon: script$L + CheckIcon: script$L, + MinusIcon: script$K } }; -var _hoisted_1$13 = ["data-p-checked", "data-p-indeterminate", "data-p-disabled"]; +var _hoisted_1$12 = ["data-p-checked", "data-p-indeterminate", "data-p-disabled"]; var _hoisted_2$I = ["id", "value", "name", "checked", "tabindex", "disabled", "readonly", "required", "aria-labelledby", "aria-label", "aria-invalid", "aria-checked"]; -function render$J(_ctx, _cache, $props, $setup, $data, $options) { +function render$I(_ctx, _cache, $props, $setup, $data, $options) { var _component_CheckIcon = resolveComponent("CheckIcon"); var _component_MinusIcon = resolveComponent("MinusIcon"); return openBlock(), createElementBlock("div", mergeProps$2({ @@ -147808,16 +148806,16 @@ function render$J(_ctx, _cache, $props, $setup, $data, $options) { key: 1, "class": _ctx.cx("icon") }, $options.getPTOptions("icon")), null, 16, ["class"])) : createCommentVNode("", true)]; - })], 16)], 16, _hoisted_1$13); + })], 16)], 16, _hoisted_1$12); } -__name(render$J, "render$J"); -script$K.render = render$J; -var theme$r = /* @__PURE__ */ __name(function theme15(_ref) { +__name(render$I, "render$I"); +script$J.render = render$I; +var theme$q = /* @__PURE__ */ __name(function theme16(_ref) { var dt2 = _ref.dt; return "\n.p-inputtext {\n font-family: inherit;\n font-feature-settings: inherit;\n font-size: 1rem;\n color: ".concat(dt2("inputtext.color"), ";\n background: ").concat(dt2("inputtext.background"), ";\n padding-block: ").concat(dt2("inputtext.padding.y"), ";\n padding-inline: ").concat(dt2("inputtext.padding.x"), ";\n border: 1px solid ").concat(dt2("inputtext.border.color"), ";\n transition: background ").concat(dt2("inputtext.transition.duration"), ", color ").concat(dt2("inputtext.transition.duration"), ", border-color ").concat(dt2("inputtext.transition.duration"), ", outline-color ").concat(dt2("inputtext.transition.duration"), ", box-shadow ").concat(dt2("inputtext.transition.duration"), ";\n appearance: none;\n border-radius: ").concat(dt2("inputtext.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt2("inputtext.shadow"), ";\n}\n\n.p-inputtext:enabled:hover {\n border-color: ").concat(dt2("inputtext.hover.border.color"), ";\n}\n\n.p-inputtext:enabled:focus {\n border-color: ").concat(dt2("inputtext.focus.border.color"), ";\n box-shadow: ").concat(dt2("inputtext.focus.ring.shadow"), ";\n outline: ").concat(dt2("inputtext.focus.ring.width"), " ").concat(dt2("inputtext.focus.ring.style"), " ").concat(dt2("inputtext.focus.ring.color"), ";\n outline-offset: ").concat(dt2("inputtext.focus.ring.offset"), ";\n}\n\n.p-inputtext.p-invalid {\n border-color: ").concat(dt2("inputtext.invalid.border.color"), ";\n}\n\n.p-inputtext.p-variant-filled {\n background: ").concat(dt2("inputtext.filled.background"), ";\n}\n\n.p-inputtext.p-variant-filled:enabled:hover {\n background: ").concat(dt2("inputtext.filled.hover.background"), ";\n}\n\n.p-inputtext.p-variant-filled:enabled:focus {\n background: ").concat(dt2("inputtext.filled.focus.background"), ";\n}\n\n.p-inputtext:disabled {\n opacity: 1;\n background: ").concat(dt2("inputtext.disabled.background"), ";\n color: ").concat(dt2("inputtext.disabled.color"), ";\n}\n\n.p-inputtext::placeholder {\n color: ").concat(dt2("inputtext.placeholder.color"), ";\n}\n\n.p-inputtext.p-invalid::placeholder {\n color: ").concat(dt2("inputtext.invalid.placeholder.color"), ";\n}\n\n.p-inputtext-sm {\n font-size: ").concat(dt2("inputtext.sm.font.size"), ";\n padding-block: ").concat(dt2("inputtext.sm.padding.y"), ";\n padding-inline: ").concat(dt2("inputtext.sm.padding.x"), ";\n}\n\n.p-inputtext-lg {\n font-size: ").concat(dt2("inputtext.lg.font.size"), ";\n padding-block: ").concat(dt2("inputtext.lg.padding.y"), ";\n padding-inline: ").concat(dt2("inputtext.lg.padding.x"), ";\n}\n\n.p-inputtext-fluid {\n width: 100%;\n}\n"); }, "theme"); -var classes$t = { - root: /* @__PURE__ */ __name(function root8(_ref2) { +var classes$s = { + root: /* @__PURE__ */ __name(function root9(_ref2) { var instance = _ref2.instance, props = _ref2.props; return ["p-inputtext p-component", { "p-filled": instance.$filled, @@ -147831,23 +148829,23 @@ var classes$t = { }; var InputTextStyle = BaseStyle$1.extend({ name: "inputtext", - theme: theme$r, - classes: classes$t + theme: theme$q, + classes: classes$s }); -var script$1$u = { +var script$1$t = { name: "BaseInputText", "extends": script$10, style: InputTextStyle, - provide: /* @__PURE__ */ __name(function provide15() { + provide: /* @__PURE__ */ __name(function provide16() { return { $pcInputText: this, $parentInstance: this }; }, "provide") }; -var script$J = { +var script$I = { name: "InputText", - "extends": script$1$u, + "extends": script$1$t, inheritAttrs: false, methods: { onInput: /* @__PURE__ */ __name(function onInput(event) { @@ -147865,8 +148863,8 @@ var script$J = { }, "attrs") } }; -var _hoisted_1$12 = ["value", "disabled", "aria-invalid"]; -function render$I(_ctx, _cache, $props, $setup, $data, $options) { +var _hoisted_1$11 = ["value", "disabled", "aria-invalid"]; +function render$H(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("input", mergeProps$2({ type: "text", "class": _ctx.cx("root"), @@ -147876,219 +148874,7 @@ function render$I(_ctx, _cache, $props, $setup, $data, $options) { onInput: _cache[0] || (_cache[0] = function() { return $options.onInput && $options.onInput.apply($options, arguments); }) - }, $options.attrs), null, 16, _hoisted_1$12); -} -__name(render$I, "render$I"); -script$J.render = render$I; -var theme$q = /* @__PURE__ */ __name(function theme16(_ref) { - var dt2 = _ref.dt; - return "\n.p-message {\n border-radius: ".concat(dt2("message.border.radius"), ";\n outline-width: ").concat(dt2("message.border.width"), ";\n outline-style: solid;\n}\n\n.p-message-content {\n display: flex;\n align-items: center;\n padding: ").concat(dt2("message.content.padding"), ";\n gap: ").concat(dt2("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-inline-start: auto;\n overflow: hidden;\n position: relative;\n width: ").concat(dt2("message.close.button.width"), ";\n height: ").concat(dt2("message.close.button.height"), ";\n border-radius: ").concat(dt2("message.close.button.border.radius"), ";\n background: transparent;\n transition: background ").concat(dt2("message.transition.duration"), ", color ").concat(dt2("message.transition.duration"), ", outline-color ").concat(dt2("message.transition.duration"), ", box-shadow ").concat(dt2("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(dt2("message.close.icon.size"), ";\n width: ").concat(dt2("message.close.icon.size"), ";\n height: ").concat(dt2("message.close.icon.size"), ";\n}\n\n.p-message-close-button:focus-visible {\n outline-width: ").concat(dt2("message.close.button.focus.ring.width"), ";\n outline-style: ").concat(dt2("message.close.button.focus.ring.style"), ";\n outline-offset: ").concat(dt2("message.close.button.focus.ring.offset"), ";\n}\n\n.p-message-info {\n background: ").concat(dt2("message.info.background"), ";\n outline-color: ").concat(dt2("message.info.border.color"), ";\n color: ").concat(dt2("message.info.color"), ";\n box-shadow: ").concat(dt2("message.info.shadow"), ";\n}\n\n.p-message-info .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.info.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.info.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-info .p-message-close-button:hover {\n background: ").concat(dt2("message.info.close.button.hover.background"), ";\n}\n\n.p-message-info.p-message-outlined {\n color: ").concat(dt2("message.info.outlined.color"), ";\n outline-color: ").concat(dt2("message.info.outlined.border.color"), ";\n}\n\n.p-message-info.p-message-simple {\n color: ").concat(dt2("message.info.simple.color"), ";\n}\n\n.p-message-success {\n background: ").concat(dt2("message.success.background"), ";\n outline-color: ").concat(dt2("message.success.border.color"), ";\n color: ").concat(dt2("message.success.color"), ";\n box-shadow: ").concat(dt2("message.success.shadow"), ";\n}\n\n.p-message-success .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.success.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.success.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-success .p-message-close-button:hover {\n background: ").concat(dt2("message.success.close.button.hover.background"), ";\n}\n\n.p-message-success.p-message-outlined {\n color: ").concat(dt2("message.success.outlined.color"), ";\n outline-color: ").concat(dt2("message.success.outlined.border.color"), ";\n}\n\n.p-message-success.p-message-simple {\n color: ").concat(dt2("message.success.simple.color"), ";\n}\n\n.p-message-warn {\n background: ").concat(dt2("message.warn.background"), ";\n outline-color: ").concat(dt2("message.warn.border.color"), ";\n color: ").concat(dt2("message.warn.color"), ";\n box-shadow: ").concat(dt2("message.warn.shadow"), ";\n}\n\n.p-message-warn .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.warn.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.warn.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-warn .p-message-close-button:hover {\n background: ").concat(dt2("message.warn.close.button.hover.background"), ";\n}\n\n.p-message-warn.p-message-outlined {\n color: ").concat(dt2("message.warn.outlined.color"), ";\n outline-color: ").concat(dt2("message.warn.outlined.border.color"), ";\n}\n\n.p-message-warn.p-message-simple {\n color: ").concat(dt2("message.warn.simple.color"), ";\n}\n\n.p-message-error {\n background: ").concat(dt2("message.error.background"), ";\n outline-color: ").concat(dt2("message.error.border.color"), ";\n color: ").concat(dt2("message.error.color"), ";\n box-shadow: ").concat(dt2("message.error.shadow"), ";\n}\n\n.p-message-error .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.error.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.error.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-error .p-message-close-button:hover {\n background: ").concat(dt2("message.error.close.button.hover.background"), ";\n}\n\n.p-message-error.p-message-outlined {\n color: ").concat(dt2("message.error.outlined.color"), ";\n outline-color: ").concat(dt2("message.error.outlined.border.color"), ";\n}\n\n.p-message-error.p-message-simple {\n color: ").concat(dt2("message.error.simple.color"), ";\n}\n\n.p-message-secondary {\n background: ").concat(dt2("message.secondary.background"), ";\n outline-color: ").concat(dt2("message.secondary.border.color"), ";\n color: ").concat(dt2("message.secondary.color"), ";\n box-shadow: ").concat(dt2("message.secondary.shadow"), ";\n}\n\n.p-message-secondary .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.secondary.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.secondary.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-secondary .p-message-close-button:hover {\n background: ").concat(dt2("message.secondary.close.button.hover.background"), ";\n}\n\n.p-message-secondary.p-message-outlined {\n color: ").concat(dt2("message.secondary.outlined.color"), ";\n outline-color: ").concat(dt2("message.secondary.outlined.border.color"), ";\n}\n\n.p-message-secondary.p-message-simple {\n color: ").concat(dt2("message.secondary.simple.color"), ";\n}\n\n.p-message-contrast {\n background: ").concat(dt2("message.contrast.background"), ";\n outline-color: ").concat(dt2("message.contrast.border.color"), ";\n color: ").concat(dt2("message.contrast.color"), ";\n box-shadow: ").concat(dt2("message.contrast.shadow"), ";\n}\n\n.p-message-contrast .p-message-close-button:focus-visible {\n outline-color: ").concat(dt2("message.contrast.close.button.focus.ring.color"), ";\n box-shadow: ").concat(dt2("message.contrast.close.button.focus.ring.shadow"), ";\n}\n\n.p-message-contrast .p-message-close-button:hover {\n background: ").concat(dt2("message.contrast.close.button.hover.background"), ";\n}\n\n.p-message-contrast.p-message-outlined {\n color: ").concat(dt2("message.contrast.outlined.color"), ";\n outline-color: ").concat(dt2("message.contrast.outlined.border.color"), ";\n}\n\n.p-message-contrast.p-message-simple {\n color: ").concat(dt2("message.contrast.simple.color"), ";\n}\n\n.p-message-text {\n font-size: ").concat(dt2("message.text.font.size"), ";\n font-weight: ").concat(dt2("message.text.font.weight"), ";\n}\n\n.p-message-icon {\n font-size: ").concat(dt2("message.icon.size"), ";\n width: ").concat(dt2("message.icon.size"), ";\n height: ").concat(dt2("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.p-message-sm .p-message-content {\n padding: ").concat(dt2("message.content.sm.padding"), ";\n}\n\n.p-message-sm .p-message-text {\n font-size: ").concat(dt2("message.text.sm.font.size"), ";\n}\n\n.p-message-sm .p-message-icon {\n font-size: ").concat(dt2("message.icon.sm.size"), ";\n width: ").concat(dt2("message.icon.sm.size"), ";\n height: ").concat(dt2("message.icon.sm.size"), ";\n}\n\n.p-message-sm .p-message-close-icon {\n font-size: ").concat(dt2("message.close.icon.sm.size"), ";\n width: ").concat(dt2("message.close.icon.sm.size"), ";\n height: ").concat(dt2("message.close.icon.sm.size"), ";\n}\n\n.p-message-lg .p-message-content {\n padding: ").concat(dt2("message.content.lg.padding"), ";\n}\n\n.p-message-lg .p-message-text {\n font-size: ").concat(dt2("message.text.lg.font.size"), ";\n}\n\n.p-message-lg .p-message-icon {\n font-size: ").concat(dt2("message.icon.lg.size"), ";\n width: ").concat(dt2("message.icon.lg.size"), ";\n height: ").concat(dt2("message.icon.lg.size"), ";\n}\n\n.p-message-lg .p-message-close-icon {\n font-size: ").concat(dt2("message.close.icon.lg.size"), ";\n width: ").concat(dt2("message.close.icon.lg.size"), ";\n height: ").concat(dt2("message.close.icon.lg.size"), ";\n}\n\n.p-message-outlined {\n background: transparent;\n outline-width: ").concat(dt2("message.outlined.border.width"), ";\n}\n\n.p-message-simple {\n background: transparent;\n outline-color: transparent;\n box-shadow: none;\n}\n\n.p-message-simple .p-message-content {\n padding: ").concat(dt2("message.simple.content.padding"), ";\n}\n\n.p-message-outlined .p-message-close-button:hover,\n.p-message-simple .p-message-close-button:hover {\n background: transparent;\n}\n"); -}, "theme"); -var classes$s = { - root: /* @__PURE__ */ __name(function root9(_ref2) { - var props = _ref2.props; - return ["p-message p-component p-message-" + props.severity, { - "p-message-outlined": props.variant === "outlined", - "p-message-simple": props.variant === "simple", - "p-message-sm": props.size === "small", - "p-message-lg": props.size === "large" - }]; - }, "root"), - content: "p-message-content", - icon: "p-message-icon", - text: "p-message-text", - closeButton: "p-message-close-button", - closeIcon: "p-message-close-icon" -}; -var MessageStyle = BaseStyle$1.extend({ - name: "message", - theme: theme$q, - classes: classes$s -}); -var script$1$t = { - name: "BaseMessage", - "extends": script$14, - props: { - severity: { - type: String, - "default": "info" - }, - closable: { - type: Boolean, - "default": false - }, - life: { - type: Number, - "default": null - }, - icon: { - type: String, - "default": void 0 - }, - closeIcon: { - type: String, - "default": void 0 - }, - closeButtonProps: { - type: null, - "default": null - }, - size: { - type: String, - "default": null - }, - variant: { - type: String, - "default": null - } - }, - style: MessageStyle, - provide: /* @__PURE__ */ __name(function provide16() { - return { - $pcMessage: this, - $parentInstance: this - }; - }, "provide") -}; -var script$I = { - name: "Message", - "extends": script$1$t, - inheritAttrs: false, - emits: ["close", "life-end"], - timeout: null, - data: /* @__PURE__ */ __name(function data7() { - return { - visible: true - }; - }, "data"), - mounted: /* @__PURE__ */ __name(function mounted8() { - var _this = this; - if (this.life) { - setTimeout(function() { - _this.visible = false; - _this.$emit("life-end"); - }, this.life); - } - }, "mounted"), - methods: { - close: /* @__PURE__ */ __name(function close3(event) { - this.visible = false; - this.$emit("close", event); - }, "close") - }, - computed: { - closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel2() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : void 0; - }, "closeAriaLabel") - }, - directives: { - ripple: Ripple - }, - components: { - TimesIcon: script$_ - } -}; -function _typeof$a(o2) { - "@babel/helpers - typeof"; - return _typeof$a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { - return typeof o3; - } : function(o3) { - return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; - }, _typeof$a(o2); -} -__name(_typeof$a, "_typeof$a"); -function ownKeys$c(e2, r2) { - var t2 = Object.keys(e2); - if (Object.getOwnPropertySymbols) { - var o2 = Object.getOwnPropertySymbols(e2); - r2 && (o2 = o2.filter(function(r3) { - return Object.getOwnPropertyDescriptor(e2, r3).enumerable; - })), t2.push.apply(t2, o2); - } - return t2; -} -__name(ownKeys$c, "ownKeys$c"); -function _objectSpread$c(e2) { - for (var r2 = 1; r2 < arguments.length; r2++) { - var t2 = null != arguments[r2] ? arguments[r2] : {}; - r2 % 2 ? ownKeys$c(Object(t2), true).forEach(function(r3) { - _defineProperty$a(e2, r3, t2[r3]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$c(Object(t2)).forEach(function(r3) { - Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); - }); - } - return e2; -} -__name(_objectSpread$c, "_objectSpread$c"); -function _defineProperty$a(e2, r2, t2) { - return (r2 = _toPropertyKey$9(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; -} -__name(_defineProperty$a, "_defineProperty$a"); -function _toPropertyKey$9(t2) { - var i2 = _toPrimitive$9(t2, "string"); - return "symbol" == _typeof$a(i2) ? i2 : i2 + ""; -} -__name(_toPropertyKey$9, "_toPropertyKey$9"); -function _toPrimitive$9(t2, r2) { - if ("object" != _typeof$a(t2) || !t2) return t2; - var e2 = t2[Symbol.toPrimitive]; - if (void 0 !== e2) { - var i2 = e2.call(t2, r2 || "default"); - if ("object" != _typeof$a(i2)) return i2; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r2 ? String : Number)(t2); -} -__name(_toPrimitive$9, "_toPrimitive$9"); -var _hoisted_1$11 = ["aria-label"]; -function render$H(_ctx, _cache, $props, $setup, $data, $options) { - var _component_TimesIcon = resolveComponent("TimesIcon"); - var _directive_ripple = resolveDirective("ripple"); - return openBlock(), createBlock(Transition, mergeProps$2({ - name: "p-message", - appear: "" - }, _ctx.ptmi("transition")), { - "default": withCtx(function() { - return [withDirectives(createBaseVNode("div", mergeProps$2({ - "class": _ctx.cx("root"), - role: "alert", - "aria-live": "assertive", - "aria-atomic": "true" - }, _ctx.ptm("root")), [_ctx.$slots.container ? renderSlot(_ctx.$slots, "container", { - key: 0, - closeCallback: $options.close - }) : (openBlock(), createElementBlock("div", mergeProps$2({ - key: 1, - "class": _ctx.cx("content") - }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "icon", { - "class": normalizeClass(_ctx.cx("icon")) - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon ? "span" : null), mergeProps$2({ - "class": [_ctx.cx("icon"), _ctx.icon] - }, _ctx.ptm("icon")), null, 16, ["class"]))]; - }), _ctx.$slots["default"] ? (openBlock(), createElementBlock("div", mergeProps$2({ - key: 0, - "class": _ctx.cx("text") - }, _ctx.ptm("text")), [renderSlot(_ctx.$slots, "default")], 16)) : createCommentVNode("", true), _ctx.closable ? withDirectives((openBlock(), createElementBlock("button", mergeProps$2({ - key: 1, - "class": _ctx.cx("closeButton"), - "aria-label": $options.closeAriaLabel, - type: "button", - onClick: _cache[0] || (_cache[0] = function($event) { - return $options.close($event); - }) - }, _objectSpread$c(_objectSpread$c({}, _ctx.closeButtonProps), _ctx.ptm("closeButton"))), [renderSlot(_ctx.$slots, "closeicon", {}, function() { - return [_ctx.closeIcon ? (openBlock(), createElementBlock("i", mergeProps$2({ - key: 0, - "class": [_ctx.cx("closeIcon"), _ctx.closeIcon] - }, _ctx.ptm("closeIcon")), null, 16)) : (openBlock(), createBlock(_component_TimesIcon, mergeProps$2({ - key: 1, - "class": [_ctx.cx("closeIcon"), _ctx.closeIcon] - }, _ctx.ptm("closeIcon")), null, 16, ["class"]))]; - })], 16, _hoisted_1$11)), [[_directive_ripple]]) : createCommentVNode("", true)], 16))], 16), [[vShow, $data.visible]])]; - }), - _: 3 - }, 16); + }, $options.attrs), null, 16, _hoisted_1$11); } __name(render$H, "render$H"); script$I.render = render$H; @@ -148205,7 +148991,7 @@ var script$G = { }, components: { PlusIcon: script$H, - MinusIcon: script$L, + MinusIcon: script$K, Button: script$V }, directives: { @@ -148391,7 +149177,7 @@ const _hoisted_1$_ = { class: "flex items-center gap-2" }; const _hoisted_2$G = { class: "font-bold" }; const _hoisted_3$s = { class: "flex justify-end gap-4" }; const _hoisted_4$k = { class: "p-4 mt-2 border border-round surface-border shadow-1" }; -const _hoisted_5$f = { class: "flex flex-row gap-3 mb-2" }; +const _hoisted_5$g = { class: "flex flex-row gap-3 mb-2" }; const _hoisted_6$a = ["for"]; const _hoisted_7$4 = { class: "flex flex-row gap-3 mt-2" }; const _hoisted_8$3 = ["for"]; @@ -148507,7 +149293,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({ }, "submit"); return (_ctx, _cache) => { const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createBlock(unref(script$O), { + return openBlock(), createBlock(unref(script$N), { onSubmit: submit, resolver: unref(zodResolver)(unref(issueReportSchema)) }, { @@ -148535,18 +149321,18 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({ ]), default: withCtx(() => [ createBaseVNode("div", _hoisted_4$k, [ - createBaseVNode("div", _hoisted_5$f, [ + createBaseVNode("div", _hoisted_5$g, [ (openBlock(true), createElementBlock(Fragment$1, null, renderList(fields.value, (field2) => { return openBlock(), createElementBlock("div", { key: field2.value }, [ - field2.optIn ? (openBlock(), createBlock(unref(script$N), { + field2.optIn ? (openBlock(), createBlock(unref(script$M), { key: 0, name: field2.value, class: "flex space-x-1" }, { default: withCtx(($field) => [ - createVNode(unref(script$K), mergeProps$2({ ref_for: true }, $field, { + createVNode(unref(script$J), mergeProps$2({ ref_for: true }, $field, { inputId: field2.value, value: field2.value, modelValue: selection.value, @@ -148561,7 +149347,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({ ]); }), 128)) ]), - createVNode(unref(script$N), { + createVNode(unref(script$M), { class: "mb-4", name: "details" }, { @@ -148572,7 +149358,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({ placeholder: _ctx.$t("issueReport.provideAdditionalDetails"), "aria-label": _ctx.$t("issueReport.provideAdditionalDetails") }), null, 16, ["placeholder", "aria-label"]), - $field?.error && $field.touched && $field.value ? (openBlock(), createBlock(unref(script$I), { + $field?.error && $field.touched && $field.value ? (openBlock(), createBlock(unref(script$S), { key: 0, severity: "error", size: "small", @@ -148586,13 +149372,13 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({ ]), _: 1 }), - createVNode(unref(script$N), { name: "contactInfo" }, { + createVNode(unref(script$M), { name: "contactInfo" }, { default: withCtx(($field) => [ - createVNode(unref(script$J), mergeProps$2($field, { + createVNode(unref(script$I), mergeProps$2($field, { class: "w-full", placeholder: _ctx.$t("issueReport.provideEmail") }), null, 16, ["placeholder"]), - $field?.error && $field.touched && $field.value !== "" ? (openBlock(), createBlock(unref(script$I), { + $field?.error && $field.touched && $field.value !== "" ? (openBlock(), createBlock(unref(script$S), { key: 0, severity: "error", size: "small", @@ -148611,12 +149397,12 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({ return createBaseVNode("div", { key: checkbox.value }, [ - createVNode(unref(script$N), { + createVNode(unref(script$M), { name: checkbox.value, class: "flex space-x-1" }, { default: withCtx(($field) => [ - createVNode(unref(script$K), mergeProps$2({ ref_for: true }, $field, { + createVNode(unref(script$J), mergeProps$2({ ref_for: true }, $field, { inputId: checkbox.value, value: checkbox.value, modelValue: contactPrefs.value, @@ -148781,14 +149567,14 @@ ${workflowText} ]) ]), reportOpen.value ? (openBlock(), createElementBlock(Fragment$1, { key: 0 }, [ - createVNode(unref(script$S)), - createVNode(unref(script$R), { style: { "width": "100%", "height": "400px", "max-width": "80vw" } }, { + createVNode(unref(script$R)), + createVNode(unref(script$Q), { style: { "width": "100%", "height": "400px", "max-width": "80vw" } }, { default: withCtx(() => [ createBaseVNode("pre", _hoisted_3$r, toDisplayString$1(reportContent.value), 1) ]), _: 1 }), - createVNode(unref(script$S)) + createVNode(unref(script$R)) ], 64)) : createCommentVNode("", true), sendReportOpen.value ? (openBlock(), createBlock(_sfc_main$X, { key: 1, @@ -148815,7 +149601,7 @@ ${workflowText} }; } }); -const ExecutionErrorDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["__scopeId", "data-v-3faf7785"]]); +const ExecutionErrorDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["__scopeId", "data-v-e5000be2"]]); const _hoisted_1$Y = { class: "p-2 h-full", "aria-labelledby": "issue-report-title" @@ -149184,13 +149970,13 @@ var script$A = { numToleratedItems: /* @__PURE__ */ __name(function numToleratedItems(newValue2) { this.d_numToleratedItems = newValue2; }, "numToleratedItems"), - loading: /* @__PURE__ */ __name(function loading(newValue2, oldValue2) { - if (this.lazy && newValue2 !== oldValue2 && newValue2 !== this.d_loading) { + loading: /* @__PURE__ */ __name(function loading(newValue2, oldValue) { + if (this.lazy && newValue2 !== oldValue && newValue2 !== this.d_loading) { this.d_loading = newValue2; } }, "loading"), - items: /* @__PURE__ */ __name(function items(newValue2, oldValue2) { - if (!oldValue2 || oldValue2.length !== (newValue2 || []).length) { + items: /* @__PURE__ */ __name(function items(newValue2, oldValue) { + if (!oldValue || oldValue.length !== (newValue2 || []).length) { this.init(); this.calculateAutoSize(); } @@ -149347,8 +150133,8 @@ var script$A = { } } else { if (viewport.first - first2 > index2) { - var pos2 = (viewport.first - 1) * this.itemSize; - horizontal2 ? scrollTo3(pos2, 0) : scrollTo3(0, pos2); + var pos = (viewport.first - 1) * this.itemSize; + horizontal2 ? scrollTo3(pos, 0) : scrollTo3(0, pos); } } } else if (isToEnd) { @@ -149559,12 +150345,12 @@ var script$A = { } } }, "setSpacerSize"), - setContentPosition: /* @__PURE__ */ __name(function setContentPosition(pos2) { + setContentPosition: /* @__PURE__ */ __name(function setContentPosition(pos) { var _this7 = this; if (this.content && !this.appendOnly) { var both = this.isBoth(); var horizontal2 = this.isHorizontal(); - var first2 = pos2 ? pos2.first : this.first; + var first2 = pos ? pos.first : this.first; var calculateTranslateVal = /* @__PURE__ */ __name(function calculateTranslateVal2(_first, _size) { return _first * _size; }, "calculateTranslateVal"); @@ -150722,12 +151508,12 @@ var script$z = { ripple: Ripple }, components: { - InputText: script$J, + InputText: script$I, VirtualScroller: script$A, InputIcon: script$B, IconField: script$C, SearchIcon: script$D, - CheckIcon: script$M, + CheckIcon: script$L, BlankIcon: script$E } }; @@ -150735,7 +151521,7 @@ var _hoisted_1$W = ["id"]; var _hoisted_2$D = ["tabindex"]; var _hoisted_3$p = ["id", "aria-multiselectable", "aria-label", "aria-labelledby", "aria-activedescendant", "aria-disabled"]; var _hoisted_4$h = ["id"]; -var _hoisted_5$e = ["id", "aria-label", "aria-selected", "aria-disabled", "aria-setsize", "aria-posinset", "onClick", "onMousedown", "onMousemove", "onDblclick", "data-p-selected", "data-p-focused", "data-p-disabled"]; +var _hoisted_5$f = ["id", "aria-label", "aria-selected", "aria-disabled", "aria-setsize", "aria-posinset", "onClick", "onMousedown", "onMousemove", "onDblclick", "data-p-selected", "data-p-focused", "data-p-disabled"]; var _hoisted_6$9 = ["tabindex"]; function render$y(_ctx, _cache, $props, $setup, $data, $options) { var _component_InputText = resolveComponent("InputText"); @@ -150932,7 +151718,7 @@ function render$y(_ctx, _cache, $props, $setup, $data, $options) { index: $options.getOptionIndex(i2, getItemOptions) }, function() { return [createTextVNode(toDisplayString$1($options.getOptionLabel(option3)), 1)]; - })], 16, _hoisted_5$e)), [[_directive_ripple]])], 64); + })], 16, _hoisted_5$f)), [[_directive_ripple]])], 64); }), 128)), $data.filterValue && (!items2 || items2 && items2.length === 0) ? (openBlock(), createElementBlock("li", mergeProps$2({ key: 0, "class": _ctx.cx("emptyMessage"), @@ -151487,7 +152273,7 @@ const _hoisted_3$n = { class: "pi pi-check text-green-500" }; const _hoisted_4$g = { class: "file-info" }; -const _hoisted_5$d = { class: "file-details" }; +const _hoisted_5$e = { class: "file-details" }; const _hoisted_6$8 = ["title"]; const _hoisted_7$3 = { key: 0, @@ -151542,7 +152328,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({ createBaseVNode("div", _hoisted_2$B, [ status.value === "completed" ? (openBlock(), createElementBlock("i", _hoisted_3$n)) : createCommentVNode("", true), createBaseVNode("div", _hoisted_4$g, [ - createBaseVNode("div", _hoisted_5$d, [ + createBaseVNode("div", _hoisted_5$e, [ createBaseVNode("span", { class: "file-type", title: hint.value @@ -151626,7 +152412,7 @@ const _hoisted_1$S = { class: "flex flex-row items-center gap-2" }; const _hoisted_2$A = { class: "file-info" }; const _hoisted_3$m = { class: "file-details" }; const _hoisted_4$f = ["title"]; -const _hoisted_5$c = { +const _hoisted_5$d = { key: 0, class: "file-error" }; @@ -151656,7 +152442,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({ title: hint.value }, toDisplayString$1(label5.value), 9, _hoisted_4$f) ]), - props.error ? (openBlock(), createElementBlock("div", _hoisted_5$c, toDisplayString$1(props.error), 1)) : createCommentVNode("", true) + props.error ? (openBlock(), createElementBlock("div", _hoisted_5$d, toDisplayString$1(props.error), 1)) : createCommentVNode("", true) ]), createBaseVNode("div", _hoisted_6$7, [ createVNode(unref(script$V), { @@ -151780,11 +152566,11 @@ function tryMigrateDeprecatedValue(setting, value4) { return setting?.migrateDeprecatedValue?.(value4) ?? value4; } __name(tryMigrateDeprecatedValue, "tryMigrateDeprecatedValue"); -function onChange(setting, newValue2, oldValue2) { +function onChange(setting, newValue2, oldValue) { if (setting?.onChange) { - setting.onChange(newValue2, oldValue2); + setting.onChange(newValue2, oldValue); } - app$1.ui.settings.dispatchChange(setting.id, newValue2, oldValue2); + app$1.ui.settings.dispatchChange(setting.id, newValue2, oldValue); } __name(onChange, "onChange"); const useSettingStore = /* @__PURE__ */ defineStore("setting", () => { @@ -151819,9 +152605,9 @@ const useSettingStore = /* @__PURE__ */ defineStore("setting", () => { settingsById.value[key], clonedValue ); - const oldValue2 = get3(key); - if (newValue2 === oldValue2) return; - onChange(settingsById.value[key], newValue2, oldValue2); + const oldValue = get3(key); + if (newValue2 === oldValue) return; + onChange(settingsById.value[key], newValue2, oldValue); settingValues.value[key] = newValue2; await api.storeSetting(key, newValue2); } @@ -151956,7 +152742,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({ message: unref(t2)("missingModelsDialog.missingModelsMessage") }, null, 8, ["title", "message"]), createBaseVNode("div", _hoisted_1$R, [ - createVNode(unref(script$K), { + createVNode(unref(script$J), { modelValue: doNotAskAgain.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => doNotAskAgain.value = $event), binary: "", @@ -152066,7 +152852,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({ return openBlock(), createElementBlock("div", _hoisted_1$Q, [ createVNode(unref(script$x), null, { default: withCtx(() => [ - createVNode(unref(script$J), { + createVNode(unref(script$I), { ref_key: "inputRef", ref: inputRef, modelValue: inputValue.value, @@ -152420,7 +153206,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({ severity: "contrast", onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("showFilter", $event)) }, null, 8, ["icon"])) : createCommentVNode("", true), - createVNode(unref(script$J), { + createVNode(unref(script$I), { class: "search-box-input w-full", onInput: handleInput, modelValue: _ctx.modelValue, @@ -152844,15 +153630,15 @@ var script$o = { onPrevButtonClick: /* @__PURE__ */ __name(function onPrevButtonClick() { var content2 = this.$refs.content; var width2 = getWidth$1(content2); - var pos2 = content2.scrollLeft - width2; - content2.scrollLeft = pos2 <= 0 ? 0 : pos2; + var pos = content2.scrollLeft - width2; + content2.scrollLeft = pos <= 0 ? 0 : pos; }, "onPrevButtonClick"), onNextButtonClick: /* @__PURE__ */ __name(function onNextButtonClick() { var content2 = this.$refs.content; var width2 = getWidth$1(content2) - this.getVisibleButtonWidths(); - var pos2 = content2.scrollLeft + width2; + var pos = content2.scrollLeft + width2; var lastPos = content2.scrollWidth - width2; - content2.scrollLeft = pos2 >= lastPos ? lastPos : pos2; + content2.scrollLeft = pos >= lastPos ? lastPos : pos; }, "onNextButtonClick"), onTabClick: /* @__PURE__ */ __name(function onTabClick(event, tab, index2) { this.changeActiveIndex(event, tab, index2); @@ -153081,7 +153867,7 @@ var _hoisted_1$N = ["tabindex", "aria-label"]; var _hoisted_2$x = ["data-p-active", "data-p-disabled", "data-pc-index"]; var _hoisted_3$l = ["id", "tabindex", "aria-disabled", "aria-selected", "aria-controls", "onClick", "onKeydown"]; var _hoisted_4$e = ["tabindex", "aria-label"]; -var _hoisted_5$b = ["id", "aria-labelledby", "data-pc-index", "data-p-active"]; +var _hoisted_5$c = ["id", "aria-labelledby", "data-pc-index", "data-p-active"]; function render$n(_ctx, _cache, $props, $setup, $data, $options) { var _directive_ripple = resolveDirective("ripple"); return openBlock(), createElementBlock("div", mergeProps$2({ @@ -153193,7 +153979,7 @@ function render$n(_ctx, _cache, $props, $setup, $data, $options) { "data-pc-name": "tabpanel", "data-pc-index": index2, "data-p-active": $data.d_activeIndex === index2 - }), [(openBlock(), createBlock(resolveDynamicComponent(tab)))], 16, _hoisted_5$b)), [[vShow, _ctx.lazy ? true : $options.isTabActive(index2)]]) : createCommentVNode("", true)], 64); + }), [(openBlock(), createBlock(resolveDynamicComponent(tab)))], 16, _hoisted_5$c)), [[vShow, _ctx.lazy ? true : $options.isTabActive(index2)]]) : createCommentVNode("", true)], 64); }), 128))], 16)], 16); } __name(render$n, "render$n"); @@ -153241,7 +154027,7 @@ const _hoisted_1$L = { class: "system-stats" }; const _hoisted_2$v = { class: "mb-6" }; const _hoisted_3$k = { class: "text-2xl font-semibold mb-4" }; const _hoisted_4$d = { class: "grid grid-cols-2 gap-2" }; -const _hoisted_5$a = { class: "font-medium" }; +const _hoisted_5$b = { class: "font-medium" }; const _hoisted_6$6 = { class: "text-2xl font-semibold mb-4" }; const _sfc_main$M = /* @__PURE__ */ defineComponent({ __name: "SystemStatsPanel", @@ -153278,13 +154064,13 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({ return openBlock(), createElementBlock(Fragment$1, { key: col.field }, [ - createBaseVNode("div", _hoisted_5$a, toDisplayString$1(col.header), 1), + createBaseVNode("div", _hoisted_5$b, toDisplayString$1(col.header), 1), createBaseVNode("div", null, toDisplayString$1(formatValue2(systemInfo.value[col.field], col.field)), 1) ], 64); }), 64)) ]) ]), - createVNode(unref(script$S)), + createVNode(unref(script$R)), createBaseVNode("div", null, [ createBaseVNode("h2", _hoisted_6$6, toDisplayString$1(_ctx.$t("g.devices")), 1), props.stats.devices.length > 1 ? (openBlock(), createBlock(unref(script$o), { key: 0 }, { @@ -153413,7 +154199,7 @@ const useSystemStatsStore = /* @__PURE__ */ defineStore("systemStats", () => { }; }); const useAboutPanelStore = /* @__PURE__ */ defineStore("aboutPanel", () => { - const frontendVersion = "1.8.14"; + const frontendVersion = "1.9.17"; const extensionStore = useExtensionStore(); const systemStatsStore = useSystemStatsStore(); const coreVersion = computed( @@ -153464,7 +154250,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({ default: withCtx(() => [ createBaseVNode("div", _hoisted_1$K, [ renderSlot(_ctx.$slots, "header"), - createVNode(unref(script$R), { class: "flex-grow h-0 pr-2" }, { + createVNode(unref(script$Q), { class: "flex-grow h-0 pr-2" }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), @@ -153522,7 +154308,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({ ], 8, _hoisted_3$j); }), 128)) ]), - createVNode(unref(script$S)), + createVNode(unref(script$R)), unref(systemStatsStore).systemStats ? (openBlock(), createBlock(_sfc_main$M, { key: 0, stats: unref(systemStatsStore).systemStats @@ -154632,7 +155418,7 @@ var script$m = { ripple: Ripple }, components: { - InputText: script$J, + InputText: script$I, VirtualScroller: script$A, Portal: script$U, InputIcon: script$B, @@ -154641,7 +155427,7 @@ var script$m = { ChevronDownIcon: script$n, SpinnerIcon: script$X, SearchIcon: script$D, - CheckIcon: script$M, + CheckIcon: script$L, BlankIcon: script$E } }; @@ -154649,7 +155435,7 @@ var _hoisted_1$I = ["id"]; var _hoisted_2$t = ["id", "value", "placeholder", "tabindex", "disabled", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-invalid"]; var _hoisted_3$i = ["id", "tabindex", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-disabled"]; var _hoisted_4$c = ["id"]; -var _hoisted_5$9 = ["id"]; +var _hoisted_5$a = ["id"]; var _hoisted_6$5 = ["id", "aria-label", "aria-selected", "aria-disabled", "aria-setsize", "aria-posinset", "onClick", "onMousemove", "data-p-selected", "data-p-focused", "data-p-disabled"]; function render$l(_ctx, _cache, $props, $setup, $data, $options) { var _component_SpinnerIcon = resolveComponent("SpinnerIcon"); @@ -154901,7 +155687,7 @@ function render$l(_ctx, _cache, $props, $setup, $data, $options) { "class": _ctx.cx("optionGroupLabel"), ref_for: true }, _ctx.ptm("optionGroupLabel")), toDisplayString$1($options.getOptionGroupLabel(option3.optionGroup)), 17)]; - })], 16, _hoisted_5$9)) : withDirectives((openBlock(), createElementBlock("li", mergeProps$2({ + })], 16, _hoisted_5$a)) : withDirectives((openBlock(), createElementBlock("li", mergeProps$2({ key: 1, id: $data.id + "_" + $options.getOptionIndex(i2, getItemOptions), "class": _ctx.cx("option", { @@ -155563,7 +156349,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({ } }, "importCustomPalette"); return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$I), { + return openBlock(), createBlock(unref(script$S), { severity: "info", icon: "pi pi-palette", "pt:text": "w-full" @@ -155618,7 +156404,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({ window.location.reload(); }, "logout"); return (_ctx, _cache) => { - return unref(userStore).isMultiUserServer ? (openBlock(), createBlock(unref(script$I), { + return unref(userStore).isMultiUserServer ? (openBlock(), createBlock(unref(script$S), { key: 0, severity: "info", icon: "pi pi-user", @@ -155649,7 +156435,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({ settingStore.set("Comfy.UseNewMenu", currentValue); }, "handleClose"); return (_ctx, _cache) => { - return show5.value ? (openBlock(), createBlock(unref(script$I), { + return show5.value ? (openBlock(), createBlock(unref(script$S), { key: 0, class: "first-time-ui-message", severity: "info", @@ -155997,35 +156783,35 @@ var script$j = { d_value: /* @__PURE__ */ __name(function d_value(newValue2) { this.d_modelValue = newValue2; }, "d_value"), - locale: /* @__PURE__ */ __name(function locale(newValue2, oldValue2) { - this.updateConstructParser(newValue2, oldValue2); + locale: /* @__PURE__ */ __name(function locale(newValue2, oldValue) { + this.updateConstructParser(newValue2, oldValue); }, "locale"), - localeMatcher: /* @__PURE__ */ __name(function localeMatcher(newValue2, oldValue2) { - this.updateConstructParser(newValue2, oldValue2); + localeMatcher: /* @__PURE__ */ __name(function localeMatcher(newValue2, oldValue) { + this.updateConstructParser(newValue2, oldValue); }, "localeMatcher"), - mode: /* @__PURE__ */ __name(function mode(newValue2, oldValue2) { - this.updateConstructParser(newValue2, oldValue2); + mode: /* @__PURE__ */ __name(function mode(newValue2, oldValue) { + this.updateConstructParser(newValue2, oldValue); }, "mode"), - currency: /* @__PURE__ */ __name(function currency(newValue2, oldValue2) { - this.updateConstructParser(newValue2, oldValue2); + currency: /* @__PURE__ */ __name(function currency(newValue2, oldValue) { + this.updateConstructParser(newValue2, oldValue); }, "currency"), - currencyDisplay: /* @__PURE__ */ __name(function currencyDisplay(newValue2, oldValue2) { - this.updateConstructParser(newValue2, oldValue2); + currencyDisplay: /* @__PURE__ */ __name(function currencyDisplay(newValue2, oldValue) { + this.updateConstructParser(newValue2, oldValue); }, "currencyDisplay"), - useGrouping: /* @__PURE__ */ __name(function useGrouping(newValue2, oldValue2) { - this.updateConstructParser(newValue2, oldValue2); + useGrouping: /* @__PURE__ */ __name(function useGrouping(newValue2, oldValue) { + this.updateConstructParser(newValue2, oldValue); }, "useGrouping"), - minFractionDigits: /* @__PURE__ */ __name(function minFractionDigits(newValue2, oldValue2) { - this.updateConstructParser(newValue2, oldValue2); + minFractionDigits: /* @__PURE__ */ __name(function minFractionDigits(newValue2, oldValue) { + this.updateConstructParser(newValue2, oldValue); }, "minFractionDigits"), - maxFractionDigits: /* @__PURE__ */ __name(function maxFractionDigits(newValue2, oldValue2) { - this.updateConstructParser(newValue2, oldValue2); + maxFractionDigits: /* @__PURE__ */ __name(function maxFractionDigits(newValue2, oldValue) { + this.updateConstructParser(newValue2, oldValue); }, "maxFractionDigits"), - suffix: /* @__PURE__ */ __name(function suffix(newValue2, oldValue2) { - this.updateConstructParser(newValue2, oldValue2); + suffix: /* @__PURE__ */ __name(function suffix(newValue2, oldValue) { + this.updateConstructParser(newValue2, oldValue); }, "suffix"), - prefix: /* @__PURE__ */ __name(function prefix(newValue2, oldValue2) { - this.updateConstructParser(newValue2, oldValue2); + prefix: /* @__PURE__ */ __name(function prefix(newValue2, oldValue) { + this.updateConstructParser(newValue2, oldValue); }, "prefix") }, created: /* @__PURE__ */ __name(function created3() { @@ -156063,8 +156849,8 @@ var script$j = { return index2.get(d2); }; }, "constructParser"), - updateConstructParser: /* @__PURE__ */ __name(function updateConstructParser(newValue2, oldValue2) { - if (newValue2 !== oldValue2) { + updateConstructParser: /* @__PURE__ */ __name(function updateConstructParser(newValue2, oldValue) { + if (newValue2 !== oldValue) { this.constructParser(); } }, "updateConstructParser"), @@ -156799,7 +157585,7 @@ var script$j = { }, "getFormatter") }, components: { - InputText: script$J, + InputText: script$I, AngleUpIcon: script$k, AngleDownIcon: script$l } @@ -157825,6 +158611,9 @@ __name(render$g, "render$g"); script$h.render = render$g; const _hoisted_1$C = { class: "color-picker-wrapper flex items-center gap-2" }; const _sfc_main$F = /* @__PURE__ */ defineComponent({ + ...{ + inheritAttrs: false + }, __name: "FormColorPicker", props: /* @__PURE__ */ mergeModels({ defaultValue: {}, @@ -157838,11 +158627,11 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({ const modelValue3 = useModel(__props, "modelValue"); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$C, [ - createVNode(unref(script$h), { + createVNode(unref(script$h), mergeProps$2({ modelValue: modelValue3.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue3.value = $event) - }, null, 8, ["modelValue"]), - createVNode(unref(script$J), { + }, _ctx.$attrs), null, 16, ["modelValue"]), + createVNode(unref(script$I), { modelValue: modelValue3.value, "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => modelValue3.value = $event), class: "w-28", @@ -157859,7 +158648,7 @@ const _hoisted_4$a = { key: 1, class: "pi pi-image text-gray-400 text-xl" }; -const _hoisted_5$8 = { class: "flex flex-col gap-2" }; +const _hoisted_5$9 = { class: "flex flex-col gap-2" }; const _sfc_main$E = /* @__PURE__ */ defineComponent({ __name: "FormImageUpload", props: { @@ -157902,7 +158691,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({ class: "max-w-full max-h-full object-contain" }, null, 8, _hoisted_3$g)) : (openBlock(), createElementBlock("i", _hoisted_4$a)) ], 2), - createBaseVNode("div", _hoisted_5$8, [ + createBaseVNode("div", _hoisted_5$9, [ createVNode(unref(script$V), { icon: "pi pi-upload", label: _ctx.$t("g.upload"), @@ -158077,10 +158866,10 @@ var script$g = { } var newValue2 = (this.max - this.min) * (handleValue / 100) + this.min; if (this.step) { - var oldValue2 = this.range ? this.value[this.handleIndex] : this.value; - var diff2 = newValue2 - oldValue2; - if (diff2 < 0) newValue2 = oldValue2 + Math.ceil(newValue2 / this.step - oldValue2 / this.step) * this.step; - else if (diff2 > 0) newValue2 = oldValue2 + Math.floor(newValue2 / this.step - oldValue2 / this.step) * this.step; + var oldValue = this.range ? this.value[this.handleIndex] : this.value; + var diff2 = newValue2 - oldValue; + if (diff2 < 0) newValue2 = oldValue + Math.ceil(newValue2 / this.step - oldValue / this.step) * this.step; + else if (diff2 > 0) newValue2 = oldValue + Math.floor(newValue2 / this.step - oldValue / this.step) * this.step; } else { newValue2 = Math.floor(newValue2); } @@ -158438,6 +159227,9 @@ __name(render$f, "render$f"); script$g.render = render$f; const _hoisted_1$z = { class: "input-slider flex flex-row items-center gap-2" }; const _sfc_main$D = /* @__PURE__ */ defineComponent({ + ...{ + inheritAttrs: false + }, __name: "InputSlider", props: { modelValue: {}, @@ -158472,14 +159264,14 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({ }, "updateValue"); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$z, [ - createVNode(unref(script$g), { + createVNode(unref(script$g), mergeProps$2({ modelValue: _ctx.modelValue, "onUpdate:modelValue": updateValue3, - class: normalizeClass(["slider-part", _ctx.sliderClass]), + class: ["slider-part", _ctx.sliderClass], min: _ctx.min, max: _ctx.max, step: _ctx.step - }, null, 8, ["modelValue", "class", "min", "max", "step"]), + }, _ctx.$attrs), null, 16, ["modelValue", "class", "min", "max", "step"]), createVNode(unref(script$j), { modelValue: _ctx.modelValue, "onUpdate:modelValue": updateValue3, @@ -158506,6 +159298,38 @@ const checkUrlReachable = /* @__PURE__ */ __name(async (url) => { const checkMirrorReachable = /* @__PURE__ */ __name(async (mirror2) => { return isValidUrl(mirror2) && await electronAPI().NetWork.canAccessUrl(mirror2); }, "checkMirrorReachable"); +async function isInChina() { + const isChineseLocale = navigator.language.toLowerCase().startsWith("zh-cn"); + try { + const googleTest = await Promise.race([ + fetch("https://www.google.com", { + mode: "no-cors", + cache: "no-cache" + }), + new Promise((_2, reject3) => setTimeout(() => reject3(), 2e3)) + ]); + if (googleTest) { + return false; + } + } catch { + if (isChineseLocale) { + return true; + } + try { + const start2 = performance.now(); + await fetch("https://www.baidu.com", { + mode: "no-cors", + cache: "no-cache" + }); + const latency = performance.now() - start2; + return latency < 150; + } catch { + return isChineseLocale; + } + } + return false; +} +__name(isInChina, "isInChina"); var ValidationState = /* @__PURE__ */ ((ValidationState2) => { ValidationState2["IDLE"] = "IDLE"; ValidationState2["LOADING"] = "LOADING"; @@ -158593,7 +159417,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({ return (_ctx, _cache) => { return openBlock(), createBlock(unref(script$C), { class: "w-full" }, { default: withCtx(() => [ - createVNode(unref(script$J), mergeProps$2(_ctx.$attrs, { + createVNode(unref(script$I), mergeProps$2(_ctx.$attrs, { "model-value": internalValue.value, class: "w-full", invalid: validationState.value === unref(ValidationState).INVALID, @@ -158616,11 +159440,12 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({ }); const _hoisted_1$y = { class: "flex flex-row items-center gap-2" }; const _hoisted_2$n = { class: "form-label flex flex-grow items-center" }; -const _hoisted_3$e = { +const _hoisted_3$e = ["id"]; +const _hoisted_4$9 = { key: 0, class: "pi pi-info-circle bg-transparent" }; -const _hoisted_4$9 = { class: "form-input flex justify-end" }; +const _hoisted_5$8 = { class: "form-input flex justify-end" }; const _sfc_main$B = /* @__PURE__ */ defineComponent({ __name: "FormItem", props: /* @__PURE__ */ mergeModels({ @@ -158682,7 +159507,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({ case "url": return _sfc_main$C; default: - return script$J; + return script$I; } } __name(getFormComponent, "getFormComponent"); @@ -158691,28 +159516,30 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({ return openBlock(), createElementBlock("div", _hoisted_1$y, [ createBaseVNode("div", _hoisted_2$n, [ createBaseVNode("span", { - class: normalizeClass(["text-muted", props.labelClass]) + class: normalizeClass(["text-muted", props.labelClass]), + id: `${props.id}-label` }, [ renderSlot(_ctx.$slots, "name-prefix", {}, void 0, true), createTextVNode(" " + toDisplayString$1(props.item.name) + " ", 1), - props.item.tooltip ? withDirectives((openBlock(), createElementBlock("i", _hoisted_3$e, null, 512)), [ + props.item.tooltip ? withDirectives((openBlock(), createElementBlock("i", _hoisted_4$9, null, 512)), [ [_directive_tooltip, props.item.tooltip] ]) : createCommentVNode("", true), renderSlot(_ctx.$slots, "name-suffix", {}, void 0, true) - ], 2) + ], 10, _hoisted_3$e) ]), - createBaseVNode("div", _hoisted_4$9, [ + createBaseVNode("div", _hoisted_5$8, [ (openBlock(), createBlock(resolveDynamicComponent(markRaw(getFormComponent(props.item))), mergeProps$2({ id: props.id, + "aria-labelledby": `${props.id}-label`, modelValue: formValue.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => formValue.value = $event) - }, getFormAttrs(props.item)), null, 16, ["id", "modelValue"])) + }, getFormAttrs(props.item)), null, 16, ["id", "aria-labelledby", "modelValue"])) ]) ]); }; } }); -const FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-1451da7b"]]); +const FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-a29c257f"]]); const _sfc_main$A = /* @__PURE__ */ defineComponent({ __name: "SettingItem", props: { @@ -158782,7 +159609,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({ setup(__props) { return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$x, [ - _ctx.divider ? (openBlock(), createBlock(unref(script$S), { key: 0 })) : createCommentVNode("", true), + _ctx.divider ? (openBlock(), createBlock(unref(script$R), { key: 0 })) : createCommentVNode("", true), createBaseVNode("h3", null, toDisplayString$1(_ctx.$t(`settingsCategories.${unref(normalizeI18nKey)(_ctx.group.label)}`, _ctx.group.label)), 1), (openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.group.settings, (setting) => { return openBlock(), createElementBlock("div", { @@ -158831,13 +159658,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({ setup(__props) { const props = __props; const KeybindingPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./KeybindingPanel-CeHhC2F4.js"), true ? __vite__mapDeps([26,24,2,3,27]) : void 0, import.meta.url) + () => __vitePreload(() => import("./KeybindingPanel-BIrxefrS.js"), true ? __vite__mapDeps([30,25,2,4,31]) : void 0, import.meta.url) ); const ExtensionPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./ExtensionPanel-iPOrhDVM.js"), true ? __vite__mapDeps([28,24,2]) : void 0, import.meta.url) + () => __vitePreload(() => import("./ExtensionPanel-1HZtMFvH.js"), true ? __vite__mapDeps([32,25,2]) : void 0, import.meta.url) ); const ServerConfigPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./ServerConfigPanel-B1lI5M9c.js"), true ? __vite__mapDeps([29,4]) : void 0, import.meta.url) + () => __vitePreload(() => import("./ServerConfigPanel-D0jTW_iX.js"), true ? __vite__mapDeps([33,5]) : void 0, import.meta.url) ); const aboutPanelNode = { key: "about", @@ -158960,14 +159787,14 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({ const tabValue = computed( () => inSearch.value ? "Search Results" : activeCategory.value?.label ); - watch(activeCategory, (_2, oldValue2) => { + watch(activeCategory, (_2, oldValue) => { if (!tabValue.value) { - activeCategory.value = oldValue2; + activeCategory.value = oldValue; } }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$v, [ - createVNode(unref(script$R), { class: "settings-sidebar flex-shrink-0 p-2 w-48 2xl:w-64" }, { + createVNode(unref(script$Q), { class: "settings-sidebar flex-shrink-0 p-2 w-48 2xl:w-64" }, { default: withCtx(() => [ createVNode(SearchBox, { class: "settings-search-box w-full mb-2", @@ -158989,11 +159816,11 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({ ]), _: 1 }), - createVNode(unref(script$S), { + createVNode(unref(script$R), { layout: "vertical", class: "mx-1 2xl:mx-4 hidden md:flex" }), - createVNode(unref(script$S), { + createVNode(unref(script$R), { layout: "horizontal", class: "flex md:hidden" }), @@ -159295,16 +160122,16 @@ var script$e = { circular: /* @__PURE__ */ __name(function circular(newValue2) { this.d_circular = newValue2; }, "circular"), - numVisible: /* @__PURE__ */ __name(function numVisible(newValue2, oldValue2) { + numVisible: /* @__PURE__ */ __name(function numVisible(newValue2, oldValue) { this.d_numVisible = newValue2; - this.d_oldNumVisible = oldValue2; + this.d_oldNumVisible = oldValue; }, "numVisible"), - numScroll: /* @__PURE__ */ __name(function numScroll(newValue2, oldValue2) { - this.d_oldNumScroll = oldValue2; + numScroll: /* @__PURE__ */ __name(function numScroll(newValue2, oldValue) { + this.d_oldNumScroll = oldValue; this.d_numScroll = newValue2; }, "numScroll"), - value: /* @__PURE__ */ __name(function value3(oldValue2) { - this.d_oldValue = oldValue2; + value: /* @__PURE__ */ __name(function value3(oldValue) { + this.d_oldValue = oldValue; }, "value") }, mounted: /* @__PURE__ */ __name(function mounted17() { @@ -159921,7 +160748,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({ const props = __props; const imageError = ref(false); return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$Q), { + return openBlock(), createBlock(unref(script$P), { "data-testid": `template-workflow-${props.workflowName}` }, { header: withCtx(() => [ @@ -160201,7 +161028,8 @@ const useDialogService = /* @__PURE__ */ __name(() => { title, message: message3, type = "default", - itemList = [] + itemList = [], + hint }) { return new Promise((resolve2) => { const options4 = { @@ -160212,7 +161040,8 @@ const useDialogService = /* @__PURE__ */ __name(() => { message: message3, type, itemList, - onConfirm: resolve2 + onConfirm: resolve2, + hint }, dialogComponentProps: { onClose: /* @__PURE__ */ __name(() => resolve2(null), "onClose") @@ -160234,6 +161063,41 @@ const useDialogService = /* @__PURE__ */ __name(() => { confirm: confirm2 }; }, "useDialogService"); +const RESERVED_BY_TEXT_INPUT = /* @__PURE__ */ new Set([ + "Ctrl + a", + "Ctrl + c", + "Ctrl + v", + "Ctrl + x", + "Ctrl + z", + "Ctrl + y", + "Ctrl + p", + "Enter", + "Shift + Enter", + "Ctrl + Backspace", + "Ctrl + Delete", + "Home", + "Ctrl + Home", + "Ctrl + Shift + Home", + "End", + "Ctrl + End", + "Ctrl + Shift + End", + "PageUp", + "PageDown", + "Shift + PageUp", + "Shift + PageDown", + "ArrowLeft", + "Ctrl + ArrowLeft", + "Shift + ArrowLeft", + "Ctrl + Shift + ArrowLeft", + "ArrowRight", + "Ctrl + ArrowRight", + "Shift + ArrowRight", + "Ctrl + Shift + ArrowRight", + "ArrowUp", + "Shift + ArrowUp", + "ArrowDown", + "Shift + ArrowDown" +]); class KeybindingImpl { static { __name(this, "KeybindingImpl"); @@ -160290,6 +161154,16 @@ class KeyComboImpl { get isModifier() { return ["Control", "Meta", "Alt", "Shift"].includes(this.key); } + get modifierCount() { + const modifiers2 = [this.ctrl, this.alt, this.shift]; + return modifiers2.reduce((acc, cur) => acc + Number(cur), 0); + } + get isShiftOnly() { + return this.shift && this.modifierCount === 1; + } + get isReservedByTextInput() { + return !this.hasModifier || this.isShiftOnly || RESERVED_BY_TEXT_INPUT.has(this.toString()); + } getKeySequences() { const sequences = []; if (this.ctrl) { @@ -160617,6 +161491,437 @@ const useMenuItemStore = /* @__PURE__ */ defineStore("menuItem", () => { registerCoreMenuCommands }; }); +const useBooleanWidget = /* @__PURE__ */ __name(() => { + const widgetConstructor = /* @__PURE__ */ __name((node3, inputName, inputData) => { + const inputOptions = inputData[1]; + const defaultVal = inputOptions?.default ?? false; + const options4 = { + on: inputOptions?.label_on, + off: inputOptions?.label_off + }; + return { + widget: node3.addWidget("toggle", inputName, defaultVal, () => { + }, options4) + }; + }, "widgetConstructor"); + return widgetConstructor; +}, "useBooleanWidget"); +const MAX_RETRIES = 5; +const TIMEOUT = 4096; +const dataCache = /* @__PURE__ */ new Map(); +const createCacheKey = /* @__PURE__ */ __name((config2) => { + const { route, query_params = {}, refresh: refresh2 = 0 } = config2; + const paramsKey = Object.entries(query_params).sort(([a2], [b2]) => a2.localeCompare(b2)).map(([k2, v2]) => `${k2}=${v2}`).join("&"); + return [route, `r=${refresh2}`, paramsKey].join(";"); +}, "createCacheKey"); +const getBackoff = /* @__PURE__ */ __name((retryCount) => Math.min(1e3 * Math.pow(2, retryCount), 512), "getBackoff"); +const isInitialized = /* @__PURE__ */ __name((entry) => entry?.data && entry?.timestamp && entry.timestamp > 0, "isInitialized"); +const isStale = /* @__PURE__ */ __name((entry, ttl) => entry?.timestamp && Date.now() - entry.timestamp >= ttl, "isStale"); +const isFetching = /* @__PURE__ */ __name((entry) => entry?.fetchPromise !== void 0, "isFetching"); +const isFailed = /* @__PURE__ */ __name((entry) => entry?.failed === true, "isFailed"); +const isBackingOff = /* @__PURE__ */ __name((entry) => entry?.error && entry?.lastErrorTime && Date.now() - entry.lastErrorTime < getBackoff(entry.retryCount || 0), "isBackingOff"); +const fetchData = /* @__PURE__ */ __name(async (config2, controller) => { + const { route, response_key, query_params, timeout = TIMEOUT } = config2; + const res = await axios.get(route, { + params: query_params, + signal: controller.signal, + timeout + }); + return response_key ? res.data[response_key] : res.data; +}, "fetchData"); +function useRemoteWidget(options4) { + const { inputData, defaultValue: defaultValue2, node: node3, widget } = options4; + const config2 = inputData[1].remote; + const { refresh: refresh2 = 0, max_retries = MAX_RETRIES } = config2; + const isPermanent = refresh2 <= 0; + const cacheKey = createCacheKey(config2); + let isLoaded = false; + const setSuccess = /* @__PURE__ */ __name((entry, data26) => { + entry.retryCount = 0; + entry.lastErrorTime = 0; + entry.error = null; + entry.timestamp = Date.now(); + entry.data = data26 ?? defaultValue2; + }, "setSuccess"); + const setError = /* @__PURE__ */ __name((entry, error2) => { + entry.retryCount = (entry.retryCount || 0) + 1; + entry.lastErrorTime = Date.now(); + entry.error = error2 instanceof Error ? error2 : new Error(String(error2)); + entry.data ??= defaultValue2; + entry.fetchPromise = void 0; + if (entry.retryCount >= max_retries) { + setFailed(entry); + } + }, "setError"); + const setFailed = /* @__PURE__ */ __name((entry) => { + dataCache.set(cacheKey, { + data: entry.data ?? defaultValue2, + failed: true + }); + }, "setFailed"); + const isFirstLoad = /* @__PURE__ */ __name(() => { + return !isLoaded && isInitialized(dataCache.get(cacheKey)); + }, "isFirstLoad"); + const onFirstLoad = /* @__PURE__ */ __name((data26) => { + isLoaded = true; + widget.value = data26[0]; + widget.callback?.(widget.value); + node3.graph?.setDirtyCanvas(true); + }, "onFirstLoad"); + const fetchValue = /* @__PURE__ */ __name(async () => { + const entry = dataCache.get(cacheKey); + if (isFailed(entry)) return entry.data; + const isValid2 = isInitialized(entry) && (isPermanent || !isStale(entry, refresh2)); + if (isValid2 || isBackingOff(entry) || isFetching(entry)) return entry.data; + const currentEntry = entry || { data: defaultValue2 }; + dataCache.set(cacheKey, currentEntry); + try { + currentEntry.controller = new AbortController(); + currentEntry.fetchPromise = fetchData(config2, currentEntry.controller); + const data26 = await currentEntry.fetchPromise; + setSuccess(currentEntry, data26); + return currentEntry.data; + } catch (err) { + setError(currentEntry, err); + return currentEntry.data; + } finally { + currentEntry.fetchPromise = void 0; + currentEntry.controller = void 0; + } + }, "fetchValue"); + const onRefresh = /* @__PURE__ */ __name(() => { + if (config2.control_after_refresh) { + const data26 = getCachedValue(); + if (!Array.isArray(data26)) return; + switch (config2.control_after_refresh) { + case "first": + widget.value = data26[0] ?? defaultValue2; + break; + case "last": + widget.value = data26.at(-1) ?? defaultValue2; + break; + } + widget.callback?.(widget.value); + node3.graph?.setDirtyCanvas(true); + } + }, "onRefresh"); + const clearCachedValue = /* @__PURE__ */ __name(() => { + const entry = dataCache.get(cacheKey); + if (!entry) return; + if (entry.fetchPromise) entry.controller?.abort(); + dataCache.delete(cacheKey); + }, "clearCachedValue"); + function getCachedValue() { + return dataCache.get(cacheKey)?.data; + } + __name(getCachedValue, "getCachedValue"); + function getValue2(onFulfilled) { + fetchValue().then((data26) => { + if (isFirstLoad()) onFirstLoad(data26); + onFulfilled?.(); + }); + return getCachedValue() ?? defaultValue2; + } + __name(getValue2, "getValue"); + function refreshValue() { + clearCachedValue(); + getValue2(onRefresh); + } + __name(refreshValue, "refreshValue"); + function addRefreshButton() { + node3.addWidget("button", "refresh", "refresh", refreshValue); + } + __name(addRefreshButton, "addRefreshButton"); + return { + getCachedValue, + getValue: getValue2, + refreshValue, + addRefreshButton, + getCacheEntry: /* @__PURE__ */ __name(() => dataCache.get(cacheKey), "getCacheEntry"), + cacheKey + }; +} +__name(useRemoteWidget, "useRemoteWidget"); +const useComboWidget = /* @__PURE__ */ __name(() => { + const widgetConstructor = /* @__PURE__ */ __name((node3, inputName, inputData) => { + const widgetStore = useWidgetStore(); + const { remote, options: options4 } = inputData[1] || {}; + const defaultValue2 = widgetStore.getDefaultValue(inputData); + const res = { + widget: node3.addWidget("combo", inputName, defaultValue2, () => { + }, { + values: options4 ?? inputData[0] + }) + }; + if (remote) { + const remoteWidget = useRemoteWidget({ + inputData, + defaultValue: defaultValue2, + node: node3, + widget: res.widget + }); + if (remote.refresh_button) remoteWidget.addRefreshButton(); + const origOptions = res.widget.options; + res.widget.options = new Proxy( + origOptions, + { + get(target2, prop2) { + if (prop2 !== "values") return target2[prop2]; + return remoteWidget.getValue(); + } + } + ); + } + if (inputData[1]?.control_after_generate) { + res.widget.linkedWidgets = addValueControlWidgets( + node3, + res.widget, + void 0, + void 0, + inputData + ); + } + return res; + }, "widgetConstructor"); + return widgetConstructor; +}, "useComboWidget"); +function getNumberDefaults(inputOptions, options4) { + const { defaultStep } = options4; + const { + default: defaultVal = 0, + min = 0, + max = 2048, + step: step3 = defaultStep + } = inputOptions; + const { precision = Math.max(-Math.floor(Math.log10(step3)), 0) } = options4; + let round = inputOptions.round; + if (options4.enableRounding && (round == void 0 || round === true)) { + round = Math.round(1e6 * Math.pow(0.1, precision)) / 1e6; + } + return { + val: defaultVal, + config: { min, max, step: 10 * step3, round, precision } + }; +} +__name(getNumberDefaults, "getNumberDefaults"); +const useFloatWidget = /* @__PURE__ */ __name(() => { + const widgetConstructor = /* @__PURE__ */ __name((node3, inputName, inputData) => { + const settingStore = useSettingStore(); + const sliderEnabled = !settingStore.get("Comfy.DisableSliders"); + const inputOptions = inputData[1]; + const widgetType = sliderEnabled ? inputOptions?.display === "slider" ? "slider" : "number" : "number"; + const precision = settingStore.get("Comfy.FloatRoundingPrecision") || void 0; + const enableRounding = !settingStore.get("Comfy.DisableFloatRounding"); + const { val, config: config2 } = getNumberDefaults(inputOptions, { + defaultStep: 0.5, + precision, + enableRounding + }); + return { + widget: node3.addWidget( + widgetType, + inputName, + val, + function(v2) { + if (config2.round) { + this.value = Math.round((v2 + Number.EPSILON) / config2.round) * config2.round; + if (this.value > config2.max) this.value = config2.max; + if (this.value < config2.min) this.value = config2.min; + } else { + this.value = v2; + } + }, + config2 + ) + }; + }, "widgetConstructor"); + return widgetConstructor; +}, "useFloatWidget"); +const useImageUploadWidget = /* @__PURE__ */ __name(() => { + const widgetConstructor = /* @__PURE__ */ __name((node3, inputName, inputData, app2) => { + const imageWidget = node3.widgets?.find( + (w2) => w2.name === (inputData[1]?.widget ?? "image") + ); + const { image_folder = "input" } = inputData[1] ?? {}; + function showImage(name2) { + const img = new Image(); + img.onload = () => { + node3.imgs = [img]; + app2.graph.setDirtyCanvas(true); + }; + const folder_separator = name2.lastIndexOf("/"); + let subfolder = ""; + if (folder_separator > -1) { + subfolder = name2.substring(0, folder_separator); + name2 = name2.substring(folder_separator + 1); + } + img.src = api.apiURL( + `/view?filename=${encodeURIComponent(name2)}&type=${image_folder}&subfolder=${subfolder}${app2.getPreviewFormatParam()}${app2.getRandParam()}` + ); + node3.setSizeForImage?.(); + } + __name(showImage, "showImage"); + const default_value = imageWidget.value; + Object.defineProperty(imageWidget, "value", { + set: /* @__PURE__ */ __name(function(value4) { + this._real_value = value4; + }, "set"), + get: /* @__PURE__ */ __name(function() { + if (!this._real_value) { + return default_value; + } + let value4 = this._real_value; + if (value4.filename) { + const real_value = value4; + value4 = ""; + if (real_value.subfolder) { + value4 = real_value.subfolder + "/"; + } + value4 += real_value.filename; + if (real_value.type && real_value.type !== "input") + value4 += ` [${real_value.type}]`; + } + return value4; + }, "get") + }); + const cb = node3.callback; + imageWidget.callback = function(...args) { + showImage(imageWidget.value); + if (cb) { + return cb.apply(this, args); + } + }; + requestAnimationFrame(() => { + if (imageWidget.value) { + showImage(imageWidget.value); + } + }); + async function uploadFile2(file, updateNode, pasted = false) { + try { + const body = new FormData(); + body.append("image", file); + if (pasted) body.append("subfolder", "pasted"); + const resp = await api.fetchApi("/upload/image", { + method: "POST", + body + }); + if (resp.status === 200) { + const data26 = await resp.json(); + let path = data26.name; + if (data26.subfolder) path = data26.subfolder + "/" + path; + if (!imageWidget.options) { + imageWidget.options = { values: [] }; + } + if (!imageWidget.options.values) { + imageWidget.options.values = []; + } + if (!imageWidget.options.values.includes(path)) { + imageWidget.options.values.push(path); + } + if (updateNode) { + showImage(path); + imageWidget.value = path; + } + } else { + useToastStore().addAlert(resp.status + " - " + resp.statusText); + } + } catch (error2) { + useToastStore().addAlert(String(error2)); + } + } + __name(uploadFile2, "uploadFile"); + const fileInput2 = document.createElement("input"); + Object.assign(fileInput2, { + type: "file", + accept: "image/jpeg,image/png,image/webp", + style: "display: none", + onchange: /* @__PURE__ */ __name(async () => { + if (fileInput2.files && fileInput2.files.length) { + await uploadFile2(fileInput2.files[0], true); + } + }, "onchange") + }); + document.body.append(fileInput2); + const uploadWidget = node3.addWidget("button", inputName, "image", () => { + fileInput2.click(); + }); + uploadWidget.label = "choose file to upload"; + uploadWidget.serialize = false; + node3.onDragOver = function(e2) { + if (e2.dataTransfer && e2.dataTransfer.items) { + const image2 = [...e2.dataTransfer.items].find((f2) => f2.kind === "file"); + return !!image2; + } + return false; + }; + node3.onDragDrop = function(e2) { + console.log("onDragDrop called"); + let handled = false; + if (e2.dataTransfer?.files) { + for (const file of e2.dataTransfer.files) { + if (file.type.startsWith("image/")) { + uploadFile2(file, !handled); + handled = true; + } + } + } + return handled; + }; + node3.pasteFile = function(file) { + if (file.type.startsWith("image/")) { + const is_pasted = file.name === "image.png" && file.lastModified - Date.now() < 2e3; + uploadFile2(file, true, is_pasted); + return true; + } + return false; + }; + return { widget: uploadWidget }; + }, "widgetConstructor"); + return widgetConstructor; +}, "useImageUploadWidget"); +const useIntWidget = /* @__PURE__ */ __name(() => { + const widgetConstructor = /* @__PURE__ */ __name((node3, inputName, inputData, app2, widgetName) => { + const settingStore = useSettingStore(); + const sliderEnabled = !settingStore.get("Comfy.DisableSliders"); + const inputOptions = inputData[1]; + const widgetType = sliderEnabled ? inputOptions?.display === "slider" ? "slider" : "number" : "number"; + const { val, config: config2 } = getNumberDefaults(inputOptions, { + defaultStep: 1, + precision: 0, + enableRounding: true + }); + config2.precision = 0; + const result = { + widget: node3.addWidget( + widgetType, + inputName, + val, + function(v2) { + const s2 = (this.options.step ?? 1) / 10; + let sh = (this.options.min ?? 0) % s2; + if (isNaN(sh)) { + sh = 0; + } + this.value = Math.round((v2 - sh) / s2) * s2 + sh; + }, + config2 + ) + }; + if (inputData[1]?.control_after_generate) { + const seedControl = addValueControlWidget( + node3, + result.widget, + "randomize", + void 0, + widgetName, + inputData + ); + result.widget.linkedWidgets = [seedControl]; + } + return result; + }, "widgetConstructor"); + return widgetConstructor; +}, "useIntWidget"); function OrderedMap(content2) { this.content = content2; } @@ -160734,28 +162039,28 @@ OrderedMap.from = function(value4) { if (value4) for (var prop2 in value4) content2.push(prop2, value4[prop2]); return new OrderedMap(content2); }; -function findDiffStart(a2, b2, pos2) { +function findDiffStart(a2, b2, pos) { for (let i2 = 0; ; i2++) { if (i2 == a2.childCount || i2 == b2.childCount) - return a2.childCount == b2.childCount ? null : pos2; + return a2.childCount == b2.childCount ? null : pos; let childA = a2.child(i2), childB = b2.child(i2); if (childA == childB) { - pos2 += childA.nodeSize; + pos += childA.nodeSize; continue; } if (!childA.sameMarkup(childB)) - return pos2; + return pos; if (childA.isText && childA.text != childB.text) { for (let j2 = 0; childA.text[j2] == childB.text[j2]; j2++) - pos2++; - return pos2; + pos++; + return pos; } if (childA.content.size || childB.content.size) { - let inner = findDiffStart(childA.content, childB.content, pos2 + 1); + let inner = findDiffStart(childA.content, childB.content, pos + 1); if (inner != null) return inner; } - pos2 += childA.nodeSize; + pos += childA.nodeSize; } } __name(findDiffStart, "findDiffStart"); @@ -160810,13 +162115,13 @@ class Fragment { into a node when the callback returns `false`. */ nodesBetween(from2, to, f2, nodeStart = 0, parent) { - for (let i2 = 0, pos2 = 0; pos2 < to; i2++) { - let child = this.content[i2], end = pos2 + child.nodeSize; - if (end > from2 && f2(child, nodeStart + pos2, parent || null, i2) !== false && child.content.size) { - let start2 = pos2 + 1; + for (let i2 = 0, pos = 0; pos < to; i2++) { + let child = this.content[i2], end = pos + child.nodeSize; + if (end > from2 && f2(child, nodeStart + pos, parent || null, i2) !== false && child.content.size) { + let start2 = pos + 1; child.nodesBetween(Math.max(0, from2 - start2), Math.min(child.content.size, to - start2), f2, nodeStart + start2); } - pos2 = end; + pos = end; } } /** @@ -160833,8 +162138,8 @@ class Fragment { */ textBetween(from2, to, blockSeparator, leafText) { let text2 = "", first2 = true; - this.nodesBetween(from2, to, (node3, pos2) => { - let nodeText = node3.isText ? node3.text.slice(Math.max(from2, pos2) - pos2, to - pos2) : !node3.isLeaf ? "" : leafText ? typeof leafText === "function" ? leafText(node3) : leafText : node3.type.spec.leafText ? node3.type.spec.leafText(node3) : ""; + this.nodesBetween(from2, to, (node3, pos) => { + let nodeText = node3.isText ? node3.text.slice(Math.max(from2, pos) - pos, to - pos) : !node3.isLeaf ? "" : leafText ? typeof leafText === "function" ? leafText(node3) : leafText : node3.type.spec.leafText ? node3.type.spec.leafText(node3) : ""; if (node3.isBlock && (node3.isLeaf && nodeText || node3.isTextblock) && blockSeparator) { if (first2) first2 = false; @@ -160871,19 +162176,19 @@ class Fragment { return this; let result = [], size = 0; if (to > from2) - for (let i2 = 0, pos2 = 0; pos2 < to; i2++) { - let child = this.content[i2], end = pos2 + child.nodeSize; + for (let i2 = 0, pos = 0; pos < to; i2++) { + let child = this.content[i2], end = pos + child.nodeSize; if (end > from2) { - if (pos2 < from2 || end > to) { + if (pos < from2 || end > to) { if (child.isText) - child = child.cut(Math.max(0, from2 - pos2), Math.min(child.text.length, to - pos2)); + child = child.cut(Math.max(0, from2 - pos), Math.min(child.text.length, to - pos)); else - child = child.cut(Math.max(0, from2 - pos2 - 1), Math.min(child.content.size, to - pos2 - 1)); + child = child.cut(Math.max(0, from2 - pos - 1), Math.min(child.content.size, to - pos - 1)); } result.push(child); size += child.nodeSize; } - pos2 = end; + pos = end; } return new Fragment(result, size); } @@ -160984,8 +162289,8 @@ class Fragment { Find the first position at which this fragment and another fragment differ, or `null` if they are the same. */ - findDiffStart(other, pos2 = 0) { - return findDiffStart(this, other, pos2); + findDiffStart(other, pos = 0) { + return findDiffStart(this, other, pos); } /** Find the first position, searching from the end, at which this @@ -160993,25 +162298,25 @@ class Fragment { the same. Since this position will not be the same in both nodes, an object with two separate positions is returned. */ - findDiffEnd(other, pos2 = this.size, otherPos = other.size) { - return findDiffEnd(this, other, pos2, otherPos); + findDiffEnd(other, pos = this.size, otherPos = other.size) { + return findDiffEnd(this, other, pos, otherPos); } /** Find the index and inner offset corresponding to a given relative position in this fragment. The result object will be reused (overwritten) the next time the function is called. @internal */ - findIndex(pos2, round = -1) { - if (pos2 == 0) - return retIndex(0, pos2); - if (pos2 == this.size) - return retIndex(this.content.length, pos2); - if (pos2 > this.size || pos2 < 0) - throw new RangeError(`Position ${pos2} outside of fragment (${this})`); + findIndex(pos, round = -1) { + if (pos == 0) + return retIndex(0, pos); + if (pos == this.size) + return retIndex(this.content.length, pos); + if (pos > this.size || pos < 0) + throw new RangeError(`Position ${pos} outside of fragment (${this})`); for (let i2 = 0, curPos = 0; ; i2++) { let cur = this.child(i2), end = curPos + cur.nodeSize; - if (end >= pos2) { - if (end == pos2 || round > 0) + if (end >= pos) { + if (end == pos || round > 0) return retIndex(i2 + 1, end); return retIndex(i2, curPos); } @@ -161277,8 +162582,8 @@ class Slice { /** @internal */ - insertAt(pos2, fragment) { - let content2 = insertInto(this.content, pos2 + this.openStart, fragment); + insertAt(pos, fragment) { + let content2 = insertInto(this.content, pos + this.openStart, fragment); return content2 && new Slice(content2, this.openStart, this.openEnd); } /** @@ -161475,8 +162780,8 @@ class ResolvedPos { /** @internal */ - constructor(pos2, path, parentOffset) { - this.pos = pos2; + constructor(pos, path, parentOffset) { + this.pos = pos; this.path = path; this.parentOffset = parentOffset; this.depth = path.length / 3 - 1; @@ -161603,10 +162908,10 @@ class ResolvedPos { */ posAtIndex(index2, depth) { depth = this.resolveDepth(depth); - let node3 = this.path[depth * 3], pos2 = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1; + let node3 = this.path[depth * 3], pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1; for (let i2 = 0; i2 < index2; i2++) - pos2 += node3.child(i2).nodeSize; - return pos2; + pos += node3.child(i2).nodeSize; + return pos; } /** Get the marks at this position, factoring in the surrounding @@ -161654,9 +162959,9 @@ class ResolvedPos { The depth up to which this position and the given (non-resolved) position share the same parent nodes. */ - sharedDepth(pos2) { + sharedDepth(pos) { for (let depth = this.depth; depth > 0; depth--) - if (this.start(depth) <= pos2 && this.end(depth) >= pos2) + if (this.start(depth) <= pos && this.end(depth) >= pos) return depth; return 0; } @@ -161707,11 +163012,11 @@ class ResolvedPos { /** @internal */ - static resolve(doc2, pos2) { - if (!(pos2 >= 0 && pos2 <= doc2.content.size)) - throw new RangeError("Position " + pos2 + " out of range"); + static resolve(doc2, pos) { + if (!(pos >= 0 && pos <= doc2.content.size)) + throw new RangeError("Position " + pos + " out of range"); let path = []; - let start2 = 0, parentOffset = pos2; + let start2 = 0, parentOffset = pos; for (let node3 = doc2; ; ) { let { index: index2, offset } = node3.content.findIndex(parentOffset); let rem = parentOffset - offset; @@ -161724,23 +163029,23 @@ class ResolvedPos { parentOffset = rem - 1; start2 += offset + 1; } - return new ResolvedPos(pos2, path, parentOffset); + return new ResolvedPos(pos, path, parentOffset); } /** @internal */ - static resolveCached(doc2, pos2) { + static resolveCached(doc2, pos) { let cache2 = resolveCache.get(doc2); if (cache2) { for (let i2 = 0; i2 < cache2.elts.length; i2++) { let elt = cache2.elts[i2]; - if (elt.pos == pos2) + if (elt.pos == pos) return elt; } } else { resolveCache.set(doc2, cache2 = new ResolveCache()); } - let result = cache2.elts[cache2.i] = ResolvedPos.resolve(doc2, pos2); + let result = cache2.elts[cache2.i] = ResolvedPos.resolve(doc2, pos); cache2.i = (cache2.i + 1) % resolveCacheSize; return result; } @@ -161980,15 +163285,15 @@ let Node$2 = class Node2 { /** Find the node directly after the given position. */ - nodeAt(pos2) { + nodeAt(pos) { for (let node3 = this; ; ) { - let { index: index2, offset } = node3.content.findIndex(pos2); + let { index: index2, offset } = node3.content.findIndex(pos); node3 = node3.maybeChild(index2); if (!node3) return null; - if (offset == pos2 || node3.isText) + if (offset == pos || node3.isText) return node3; - pos2 -= offset + 1; + pos -= offset + 1; } } /** @@ -161996,8 +163301,8 @@ let Node$2 = class Node2 { and return it along with its index and offset relative to this node. */ - childAfter(pos2) { - let { index: index2, offset } = this.content.findIndex(pos2); + childAfter(pos) { + let { index: index2, offset } = this.content.findIndex(pos); return { node: this.content.maybeChild(index2), index: index2, offset }; } /** @@ -162005,11 +163310,11 @@ let Node$2 = class Node2 { and return it along with its index and offset relative to this node. */ - childBefore(pos2) { - if (pos2 == 0) + childBefore(pos) { + if (pos == 0) return { node: null, index: 0, offset: 0 }; - let { index: index2, offset } = this.content.findIndex(pos2); - if (offset < pos2) + let { index: index2, offset } = this.content.findIndex(pos); + if (offset < pos) return { node: this.content.child(index2), index: index2, offset }; let node3 = this.content.child(index2 - 1); return { node: node3, index: index2 - 1, offset: offset - node3.nodeSize }; @@ -162018,14 +163323,14 @@ let Node$2 = class Node2 { Resolve the given position in the document, returning an [object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context. */ - resolve(pos2) { - return ResolvedPos.resolveCached(this, pos2); + resolve(pos) { + return ResolvedPos.resolveCached(this, pos); } /** @internal */ - resolveNoCache(pos2) { - return ResolvedPos.resolve(this, pos2); + resolveNoCache(pos) { + return ResolvedPos.resolve(this, pos); } /** Test whether a given mark or mark type occurs in this document @@ -163691,15 +164996,15 @@ class ParseContext { } get currentPos() { this.closeExtra(); - let pos2 = 0; + let pos = 0; for (let i2 = this.open; i2 >= 0; i2--) { let content2 = this.nodes[i2].content; for (let j2 = content2.length - 1; j2 >= 0; j2--) - pos2 += content2[j2].nodeSize; + pos += content2[j2].nodeSize; if (i2) - pos2++; + pos++; } - return pos2; + return pos; } findAtPoint(parent, offset) { if (this.find) @@ -163719,8 +165024,8 @@ class ParseContext { if (parent != content2 && this.find) for (let i2 = 0; i2 < this.find.length; i2++) { if (this.find[i2].pos == null && parent.nodeType == 1 && parent.contains(this.find[i2].node)) { - let pos2 = content2.compareDocumentPosition(this.find[i2].node); - if (pos2 & (before ? 2 : 4)) + let pos = content2.compareDocumentPosition(this.find[i2].node); + if (pos & (before ? 2 : 4)) this.find[i2].pos = this.currentPos; } } @@ -164061,8 +165366,8 @@ class MapResult { /** @internal */ - constructor(pos2, delInfo, recover) { - this.pos = pos2; + constructor(pos, delInfo, recover) { + this.pos = pos; this.delInfo = delInfo; this.recover = recover; } @@ -164120,49 +165425,49 @@ class StepMap { diff2 += this.ranges[i2 * 3 + 2] - this.ranges[i2 * 3 + 1]; return this.ranges[index2 * 3] + diff2 + recoverOffset(value4); } - mapResult(pos2, assoc = 1) { - return this._map(pos2, assoc, false); + mapResult(pos, assoc = 1) { + return this._map(pos, assoc, false); } - map(pos2, assoc = 1) { - return this._map(pos2, assoc, true); + map(pos, assoc = 1) { + return this._map(pos, assoc, true); } /** @internal */ - _map(pos2, assoc, simple) { + _map(pos, assoc, simple) { let diff2 = 0, oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2; for (let i2 = 0; i2 < this.ranges.length; i2 += 3) { let start2 = this.ranges[i2] - (this.inverted ? diff2 : 0); - if (start2 > pos2) + if (start2 > pos) break; let oldSize = this.ranges[i2 + oldIndex], newSize = this.ranges[i2 + newIndex], end = start2 + oldSize; - if (pos2 <= end) { - let side = !oldSize ? assoc : pos2 == start2 ? -1 : pos2 == end ? 1 : assoc; + if (pos <= end) { + let side = !oldSize ? assoc : pos == start2 ? -1 : pos == end ? 1 : assoc; let result = start2 + diff2 + (side < 0 ? 0 : newSize); if (simple) return result; - let recover = pos2 == (assoc < 0 ? start2 : end) ? null : makeRecover(i2 / 3, pos2 - start2); - let del2 = pos2 == start2 ? DEL_AFTER : pos2 == end ? DEL_BEFORE : DEL_ACROSS; - if (assoc < 0 ? pos2 != start2 : pos2 != end) + let recover = pos == (assoc < 0 ? start2 : end) ? null : makeRecover(i2 / 3, pos - start2); + let del2 = pos == start2 ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS; + if (assoc < 0 ? pos != start2 : pos != end) del2 |= DEL_SIDE; return new MapResult(result, del2, recover); } diff2 += newSize - oldSize; } - return simple ? pos2 + diff2 : new MapResult(pos2 + diff2, 0, null); + return simple ? pos + diff2 : new MapResult(pos + diff2, 0, null); } /** @internal */ - touches(pos2, recover) { + touches(pos, recover) { let diff2 = 0, index2 = recoverIndex(recover); let oldIndex = this.inverted ? 2 : 1, newIndex = this.inverted ? 1 : 2; for (let i2 = 0; i2 < this.ranges.length; i2 += 3) { let start2 = this.ranges[i2] - (this.inverted ? diff2 : 0); - if (start2 > pos2) + if (start2 > pos) break; let oldSize = this.ranges[i2 + oldIndex], end = start2 + oldSize; - if (pos2 <= end && i2 == index2 * 3) + if (pos <= end && i2 == index2 * 3) return true; diff2 += this.ranges[i2 + newIndex] - oldSize; } @@ -164289,39 +165594,39 @@ class Mapping { /** Map a position through this mapping. */ - map(pos2, assoc = 1) { + map(pos, assoc = 1) { if (this.mirror) - return this._map(pos2, assoc, true); + return this._map(pos, assoc, true); for (let i2 = this.from; i2 < this.to; i2++) - pos2 = this.maps[i2].map(pos2, assoc); - return pos2; + pos = this.maps[i2].map(pos, assoc); + return pos; } /** Map a position through this mapping, returning a mapping result. */ - mapResult(pos2, assoc = 1) { - return this._map(pos2, assoc, false); + mapResult(pos, assoc = 1) { + return this._map(pos, assoc, false); } /** @internal */ - _map(pos2, assoc, simple) { + _map(pos, assoc, simple) { let delInfo = 0; for (let i2 = this.from; i2 < this.to; i2++) { - let map3 = this.maps[i2], result = map3.mapResult(pos2, assoc); + let map3 = this.maps[i2], result = map3.mapResult(pos, assoc); if (result.recover != null) { let corr = this.getMirror(i2); if (corr != null && corr > i2 && corr < this.to) { i2 = corr; - pos2 = this.maps[corr].recover(result.recover); + pos = this.maps[corr].recover(result.recover); continue; } } delInfo |= result.delInfo; - pos2 = result.pos; + pos = result.pos; } - return simple ? pos2 : new MapResult(pos2, delInfo, null); + return simple ? pos : new MapResult(pos, delInfo, null); } } const stepsByID = /* @__PURE__ */ Object.create(null); @@ -164536,9 +165841,9 @@ class AddNodeMarkStep extends Step { /** Create a node mark step. */ - constructor(pos2, mark2) { + constructor(pos, mark2) { super(); - this.pos = pos2; + this.pos = pos; this.mark = mark2; } apply(doc2) { @@ -164562,8 +165867,8 @@ class AddNodeMarkStep extends Step { return new RemoveNodeMarkStep(this.pos, this.mark); } map(mapping) { - let pos2 = mapping.mapResult(this.pos, 1); - return pos2.deletedAfter ? null : new AddNodeMarkStep(pos2.pos, this.mark); + let pos = mapping.mapResult(this.pos, 1); + return pos.deletedAfter ? null : new AddNodeMarkStep(pos.pos, this.mark); } toJSON() { return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() }; @@ -164585,9 +165890,9 @@ class RemoveNodeMarkStep extends Step { /** Create a mark-removing step. */ - constructor(pos2, mark2) { + constructor(pos, mark2) { super(); - this.pos = pos2; + this.pos = pos; this.mark = mark2; } apply(doc2) { @@ -164604,8 +165909,8 @@ class RemoveNodeMarkStep extends Step { return new AddNodeMarkStep(this.pos, this.mark); } map(mapping) { - let pos2 = mapping.mapResult(this.pos, 1); - return pos2.deletedAfter ? null : new RemoveNodeMarkStep(pos2.pos, this.mark); + let pos = mapping.mapResult(this.pos, 1); + return pos.deletedAfter ? null : new RemoveNodeMarkStep(pos.pos, this.mark); } toJSON() { return { stepType: "removeNodeMark", pos: this.pos, mark: this.mark.toJSON() }; @@ -164787,12 +166092,12 @@ __name(contentBetween, "contentBetween"); function addMark(tr2, from2, to, mark2) { let removed = [], added = []; let removing, adding; - tr2.doc.nodesBetween(from2, to, (node3, pos2, parent) => { + tr2.doc.nodesBetween(from2, to, (node3, pos, parent) => { if (!node3.isInline) return; let marks = node3.marks; if (!mark2.isInSet(marks) && parent.type.allowsMarkType(mark2.type)) { - let start2 = Math.max(pos2, from2), end = Math.min(pos2 + node3.nodeSize, to); + let start2 = Math.max(pos, from2), end = Math.min(pos + node3.nodeSize, to); let newSet = mark2.addToSet(marks); for (let i2 = 0; i2 < marks.length; i2++) { if (!marks[i2].isInSet(newSet)) { @@ -164814,7 +166119,7 @@ function addMark(tr2, from2, to, mark2) { __name(addMark, "addMark"); function removeMark(tr2, from2, to, mark2) { let matched = [], step3 = 0; - tr2.doc.nodesBetween(from2, to, (node3, pos2) => { + tr2.doc.nodesBetween(from2, to, (node3, pos) => { if (!node3.isInline) return; step3++; @@ -164832,7 +166137,7 @@ function removeMark(tr2, from2, to, mark2) { toRemove = node3.marks; } if (toRemove && toRemove.length) { - let end = Math.min(pos2 + node3.nodeSize, to); + let end = Math.min(pos + node3.nodeSize, to); for (let i2 = 0; i2 < toRemove.length; i2++) { let style2 = toRemove[i2], found2; for (let j2 = 0; j2 < matched.length; j2++) { @@ -164844,7 +166149,7 @@ function removeMark(tr2, from2, to, mark2) { found2.to = end; found2.step = step3; } else { - matched.push({ style: style2, from: Math.max(pos2, from2), to: end, step: step3 }); + matched.push({ style: style2, from: Math.max(pos, from2), to: end, step: step3 }); } } } @@ -164852,9 +166157,9 @@ function removeMark(tr2, from2, to, mark2) { matched.forEach((m2) => tr2.step(new RemoveMarkStep(m2.from, m2.to, m2.style))); } __name(removeMark, "removeMark"); -function clearIncompatible(tr2, pos2, parentType, match2 = parentType.contentMatch, clearNewlines = true) { - let node3 = tr2.doc.nodeAt(pos2); - let replSteps = [], cur = pos2 + 1; +function clearIncompatible(tr2, pos, parentType, match2 = parentType.contentMatch, clearNewlines = true) { + let node3 = tr2.doc.nodeAt(pos); + let replSteps = [], cur = pos + 1; for (let i2 = 0; i2 < node3.childCount; i2++) { let child = node3.child(i2), end = cur + child.nodeSize; let allowed = match2.matchType(child.type); @@ -164981,9 +166286,9 @@ function setBlockType$1(tr2, from2, to, type, attrs6) { if (!type.isTextblock) throw new RangeError("Type given to setBlockType should be a textblock"); let mapFrom = tr2.steps.length; - tr2.doc.nodesBetween(from2, to, (node3, pos2) => { + tr2.doc.nodesBetween(from2, to, (node3, pos) => { let attrsHere = typeof attrs6 == "function" ? attrs6(node3) : attrs6; - if (node3.isTextblock && !node3.hasMarkup(type, attrsHere) && canChangeType(tr2.doc, tr2.mapping.slice(mapFrom).map(pos2), type)) { + if (node3.isTextblock && !node3.hasMarkup(type, attrsHere) && canChangeType(tr2.doc, tr2.mapping.slice(mapFrom).map(pos), type)) { let convertNewlines = null; if (type.schema.linebreakReplacement) { let pre = type.whitespace == "pre", supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement); @@ -164993,60 +166298,60 @@ function setBlockType$1(tr2, from2, to, type, attrs6) { convertNewlines = true; } if (convertNewlines === false) - replaceLinebreaks(tr2, node3, pos2, mapFrom); - clearIncompatible(tr2, tr2.mapping.slice(mapFrom).map(pos2, 1), type, void 0, convertNewlines === null); + replaceLinebreaks(tr2, node3, pos, mapFrom); + clearIncompatible(tr2, tr2.mapping.slice(mapFrom).map(pos, 1), type, void 0, convertNewlines === null); let mapping = tr2.mapping.slice(mapFrom); - let startM = mapping.map(pos2, 1), endM = mapping.map(pos2 + node3.nodeSize, 1); + let startM = mapping.map(pos, 1), endM = mapping.map(pos + node3.nodeSize, 1); tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrsHere, null, node3.marks)), 0, 0), 1, true)); if (convertNewlines === true) - replaceNewlines(tr2, node3, pos2, mapFrom); + replaceNewlines(tr2, node3, pos, mapFrom); return false; } }); } __name(setBlockType$1, "setBlockType$1"); -function replaceNewlines(tr2, node3, pos2, mapFrom) { +function replaceNewlines(tr2, node3, pos, mapFrom) { node3.forEach((child, offset) => { if (child.isText) { let m2, newline2 = /\r?\n|\r/g; while (m2 = newline2.exec(child.text)) { - let start2 = tr2.mapping.slice(mapFrom).map(pos2 + 1 + offset + m2.index); + let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset + m2.index); tr2.replaceWith(start2, start2 + 1, node3.type.schema.linebreakReplacement.create()); } } }); } __name(replaceNewlines, "replaceNewlines"); -function replaceLinebreaks(tr2, node3, pos2, mapFrom) { +function replaceLinebreaks(tr2, node3, pos, mapFrom) { node3.forEach((child, offset) => { if (child.type == child.type.schema.linebreakReplacement) { - let start2 = tr2.mapping.slice(mapFrom).map(pos2 + 1 + offset); + let start2 = tr2.mapping.slice(mapFrom).map(pos + 1 + offset); tr2.replaceWith(start2, start2 + 1, node3.type.schema.text("\n")); } }); } __name(replaceLinebreaks, "replaceLinebreaks"); -function canChangeType(doc2, pos2, type) { - let $pos = doc2.resolve(pos2), index2 = $pos.index(); +function canChangeType(doc2, pos, type) { + let $pos = doc2.resolve(pos), index2 = $pos.index(); return $pos.parent.canReplaceWith(index2, index2 + 1, type); } __name(canChangeType, "canChangeType"); -function setNodeMarkup(tr2, pos2, type, attrs6, marks) { - let node3 = tr2.doc.nodeAt(pos2); +function setNodeMarkup(tr2, pos, type, attrs6, marks) { + let node3 = tr2.doc.nodeAt(pos); if (!node3) throw new RangeError("No node at given position"); if (!type) type = node3.type; let newNode = type.create(attrs6, null, marks || node3.marks); if (node3.isLeaf) - return tr2.replaceWith(pos2, pos2 + node3.nodeSize, newNode); + return tr2.replaceWith(pos, pos + node3.nodeSize, newNode); if (!type.validContent(node3.content)) throw new RangeError("Invalid content for node type " + type.name); - tr2.step(new ReplaceAroundStep(pos2, pos2 + node3.nodeSize, pos2 + 1, pos2 + node3.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true)); + tr2.step(new ReplaceAroundStep(pos, pos + node3.nodeSize, pos + 1, pos + node3.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true)); } __name(setNodeMarkup, "setNodeMarkup"); -function canSplit(doc2, pos2, depth = 1, typesAfter) { - let $pos = doc2.resolve(pos2), base2 = $pos.depth - depth; +function canSplit(doc2, pos, depth = 1, typesAfter) { + let $pos = doc2.resolve(pos), base2 = $pos.depth - depth; let innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent; if (base2 < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false; @@ -165067,18 +166372,18 @@ function canSplit(doc2, pos2, depth = 1, typesAfter) { return $pos.node(base2).canReplaceWith(index2, index2, baseType ? baseType.type : $pos.node(base2 + 1).type); } __name(canSplit, "canSplit"); -function split(tr2, pos2, depth = 1, typesAfter) { - let $pos = tr2.doc.resolve(pos2), before = Fragment.empty, after = Fragment.empty; +function split(tr2, pos, depth = 1, typesAfter) { + let $pos = tr2.doc.resolve(pos), before = Fragment.empty, after = Fragment.empty; for (let d2 = $pos.depth, e2 = $pos.depth - depth, i2 = depth - 1; d2 > e2; d2--, i2--) { before = Fragment.from($pos.node(d2).copy(before)); let typeAfter = typesAfter && typesAfter[i2]; after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d2).copy(after)); } - tr2.step(new ReplaceStep(pos2, pos2, new Slice(before.append(after), depth, depth), true)); + tr2.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true)); } __name(split, "split"); -function canJoin(doc2, pos2) { - let $pos = doc2.resolve(pos2), index2 = $pos.index(); +function canJoin(doc2, pos) { + let $pos = doc2.resolve(pos), index2 = $pos.index(); return joinable($pos.nodeBefore, $pos.nodeAfter) && $pos.parent.canReplace(index2, index2 + 1); } __name(canJoin, "canJoin"); @@ -165103,8 +166408,8 @@ function joinable(a2, b2) { return !!(a2 && b2 && !a2.isLeaf && canAppendWithSubstitutedLinebreaks(a2, b2)); } __name(joinable, "joinable"); -function joinPoint(doc2, pos2, dir = -1) { - let $pos = doc2.resolve(pos2); +function joinPoint(doc2, pos, dir = -1) { + let $pos = doc2.resolve(pos); for (let d2 = $pos.depth; ; d2--) { let before, after, index2 = $pos.index(d2); if (d2 == $pos.depth) { @@ -165119,17 +166424,17 @@ function joinPoint(doc2, pos2, dir = -1) { after = $pos.node(d2 + 1); } if (before && !before.isTextblock && joinable(before, after) && $pos.node(d2).canReplace(index2, index2 + 1)) - return pos2; + return pos; if (d2 == 0) break; - pos2 = dir < 0 ? $pos.before(d2) : $pos.after(d2); + pos = dir < 0 ? $pos.before(d2) : $pos.after(d2); } } __name(joinPoint, "joinPoint"); -function join(tr2, pos2, depth) { +function join(tr2, pos, depth) { let convertNewlines = null; let { linebreakReplacement } = tr2.doc.type.schema; - let $before = tr2.doc.resolve(pos2 - depth), beforeType = $before.node().type; + let $before = tr2.doc.resolve(pos - depth), beforeType = $before.node().type; if (linebreakReplacement && beforeType.inlineContent) { let pre = beforeType.whitespace == "pre"; let supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement); @@ -165140,13 +166445,13 @@ function join(tr2, pos2, depth) { } let mapFrom = tr2.steps.length; if (convertNewlines === false) { - let $after = tr2.doc.resolve(pos2 + depth); + let $after = tr2.doc.resolve(pos + depth); replaceLinebreaks(tr2, $after.node(), $after.before(), mapFrom); } if (beforeType.inlineContent) - clearIncompatible(tr2, pos2 + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null); - let mapping = tr2.mapping.slice(mapFrom), start2 = mapping.map(pos2 - depth); - tr2.step(new ReplaceStep(start2, mapping.map(pos2 + depth, -1), Slice.empty, true)); + clearIncompatible(tr2, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null); + let mapping = tr2.mapping.slice(mapFrom), start2 = mapping.map(pos - depth); + tr2.step(new ReplaceStep(start2, mapping.map(pos + depth, -1), Slice.empty, true)); if (convertNewlines === true) { let $full = tr2.doc.resolve(start2); replaceNewlines(tr2, $full.node(), $full.before(), tr2.steps.length); @@ -165154,10 +166459,10 @@ function join(tr2, pos2, depth) { return tr2; } __name(join, "join"); -function insertPoint(doc2, pos2, nodeType) { - let $pos = doc2.resolve(pos2); +function insertPoint(doc2, pos, nodeType) { + let $pos = doc2.resolve(pos); if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType)) - return pos2; + return pos; if ($pos.parentOffset == 0) for (let d2 = $pos.depth - 1; d2 >= 0; d2--) { let index2 = $pos.index(d2); @@ -165177,10 +166482,10 @@ function insertPoint(doc2, pos2, nodeType) { return null; } __name(insertPoint, "insertPoint"); -function dropPoint(doc2, pos2, slice2) { - let $pos = doc2.resolve(pos2); +function dropPoint(doc2, pos, slice2) { + let $pos = doc2.resolve(pos); if (!slice2.content.size) - return pos2; + return pos; let content2 = slice2.content; for (let i2 = 0; i2 < slice2.openStart; i2++) content2 = content2.firstChild.content; @@ -165478,13 +166783,13 @@ function replaceRange(tr2, from2, to, slice2) { targetDepths.pop(); let preferredTarget = -($from.depth + 1); targetDepths.unshift(preferredTarget); - for (let d2 = $from.depth, pos2 = $from.pos - 1; d2 > 0; d2--, pos2--) { + for (let d2 = $from.depth, pos = $from.pos - 1; d2 > 0; d2--, pos--) { let spec = $from.node(d2).type.spec; if (spec.defining || spec.definingAsContext || spec.isolating) break; if (targetDepths.indexOf(d2) > -1) preferredTarget = d2; - else if ($from.before(d2) == pos2) + else if ($from.before(d2) == pos) targetDepths.splice(1, 0, -d2); } let preferredTargetIndex = targetDepths.indexOf(preferredTarget); @@ -165590,9 +166895,9 @@ class AttrStep extends Step { /** Construct an attribute step. */ - constructor(pos2, attr, value4) { + constructor(pos, attr, value4) { super(); - this.pos = pos2; + this.pos = pos; this.attr = attr; this.value = value4; } @@ -165614,8 +166919,8 @@ class AttrStep extends Step { return new AttrStep(this.pos, this.attr, doc2.nodeAt(this.pos).attrs[this.attr]); } map(mapping) { - let pos2 = mapping.mapResult(this.pos, 1); - return pos2.deletedAfter ? null : new AttrStep(pos2.pos, this.attr, this.value); + let pos = mapping.mapResult(this.pos, 1); + return pos.deletedAfter ? null : new AttrStep(pos.pos, this.attr, this.value); } toJSON() { return { stepType: "attr", pos: this.pos, attr: this.attr, value: this.value }; @@ -165760,8 +167065,8 @@ class Transform { /** Insert the given content at the given position. */ - insert(pos2, content2) { - return this.replaceWith(pos2, pos2, content2); + insert(pos, content2) { + return this.replaceWith(pos, pos, content2); } /** Replace a range of the document with a given slice, using @@ -165822,8 +167127,8 @@ class Transform { Join the blocks around the given position. If depth is 2, their last and first siblings are also joined, and so on. */ - join(pos2, depth = 1) { - join(this, pos2, depth); + join(pos, depth = 1) { + join(this, pos, depth); return this; } /** @@ -165847,8 +167152,8 @@ class Transform { Change the type, attributes, and/or marks of the node at `pos`. When `type` isn't given, the existing node type is preserved, */ - setNodeMarkup(pos2, type, attrs6 = null, marks) { - setNodeMarkup(this, pos2, type, attrs6, marks); + setNodeMarkup(pos, type, attrs6 = null, marks) { + setNodeMarkup(this, pos, type, attrs6, marks); return this; } /** @@ -165856,8 +167161,8 @@ class Transform { The `pos` addresses the document content. Use `setDocAttribute` to set attributes on the document itself. */ - setNodeAttribute(pos2, attr, value4) { - this.step(new AttrStep(pos2, attr, value4)); + setNodeAttribute(pos, attr, value4) { + this.step(new AttrStep(pos, attr, value4)); return this; } /** @@ -165870,24 +167175,24 @@ class Transform { /** Add a mark to the node at position `pos`. */ - addNodeMark(pos2, mark2) { - this.step(new AddNodeMarkStep(pos2, mark2)); + addNodeMark(pos, mark2) { + this.step(new AddNodeMarkStep(pos, mark2)); return this; } /** Remove a mark (or a mark of the given type) from the node at position `pos`. */ - removeNodeMark(pos2, mark2) { + removeNodeMark(pos, mark2) { if (!(mark2 instanceof Mark$1)) { - let node3 = this.doc.nodeAt(pos2); + let node3 = this.doc.nodeAt(pos); if (!node3) - throw new RangeError("No node at position " + pos2); + throw new RangeError("No node at position " + pos); mark2 = mark2.isInSet(node3.marks); if (!mark2) return this; } - this.step(new RemoveNodeMarkStep(pos2, mark2)); + this.step(new RemoveNodeMarkStep(pos, mark2)); return this; } /** @@ -165897,8 +167202,8 @@ class Transform { This can be changed by passing an array of types and attributes to use after the split. */ - split(pos2, depth = 1, typesAfter) { - split(this, pos2, depth, typesAfter); + split(pos, depth = 1, typesAfter) { + split(this, pos, depth, typesAfter); return this; } /** @@ -165924,8 +167229,8 @@ class Transform { an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as third argument. */ - clearIncompatible(pos2, parentType, match2) { - clearIncompatible(this, pos2, parentType, match2); + clearIncompatible(pos, parentType, match2) { + clearIncompatible(this, pos, parentType, match2); return this; } } @@ -166252,8 +167557,8 @@ class NodeSelection extends Selection { this.node = node3; } map(doc2, mapping) { - let { deleted, pos: pos2 } = mapping.mapResult(this.anchor); - let $pos = doc2.resolve(pos2); + let { deleted, pos } = mapping.mapResult(this.anchor); + let $pos = doc2.resolve(pos); if (deleted) return Selection.near($pos); return new NodeSelection($pos); @@ -166302,8 +167607,8 @@ class NodeBookmark { this.anchor = anchor; } map(mapping) { - let { deleted, pos: pos2 } = mapping.mapResult(this.anchor); - return deleted ? new TextBookmark(pos2, pos2) : new NodeBookmark(pos2); + let { deleted, pos } = mapping.mapResult(this.anchor); + return deleted ? new TextBookmark(pos, pos) : new NodeBookmark(pos); } resolve(doc2) { let $pos = doc2.resolve(this.anchor), node3 = $pos.nodeAfter; @@ -166360,19 +167665,19 @@ const AllBookmark = { return new AllSelection(doc2); } }; -function findSelectionIn(doc2, node3, pos2, index2, dir, text2 = false) { +function findSelectionIn(doc2, node3, pos, index2, dir, text2 = false) { if (node3.inlineContent) - return TextSelection.create(doc2, pos2); + return TextSelection.create(doc2, pos); for (let i2 = index2 - (dir > 0 ? 0 : 1); dir > 0 ? i2 < node3.childCount : i2 >= 0; i2 += dir) { let child = node3.child(i2); if (!child.isAtom) { - let inner = findSelectionIn(doc2, child, pos2 + dir, dir < 0 ? child.childCount : 0, dir, text2); + let inner = findSelectionIn(doc2, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text2); if (inner) return inner; } else if (!text2 && NodeSelection.isSelectable(child)) { - return NodeSelection.create(doc2, pos2 - (dir < 0 ? child.nodeSize : 0)); + return NodeSelection.create(doc2, pos - (dir < 0 ? child.nodeSize : 0)); } - pos2 += child.nodeSize * dir; + pos += child.nodeSize * dir; } return null; } @@ -167025,9 +168330,9 @@ __name(deepActiveElement, "deepActiveElement"); function caretFromPoint(doc2, x2, y2) { if (doc2.caretPositionFromPoint) { try { - let pos2 = doc2.caretPositionFromPoint(x2, y2); - if (pos2) - return { node: pos2.offsetNode, offset: Math.min(nodeSize(pos2.offsetNode), pos2.offset) }; + let pos = doc2.caretPositionFromPoint(x2, y2); + if (pos) + return { node: pos.offsetNode, offset: Math.min(nodeSize(pos.offsetNode), pos.offset) }; } catch (_2) { } } @@ -167327,7 +168632,7 @@ function posAtCoords(view, coords) { if (caret) ({ node: node3, offset } = caret); let elt = (view.root.elementFromPoint ? view.root : doc2).elementFromPoint(coords.left, coords.top); - let pos2; + let pos; if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) { let box = view.dom.getBoundingClientRect(); if (!inRect(coords, box)) @@ -167355,14 +168660,14 @@ function posAtCoords(view, coords) { if (webkit && offset && node3.nodeType == 1 && (prev2 = node3.childNodes[offset - 1]).nodeType == 1 && prev2.contentEditable == "false" && prev2.getBoundingClientRect().top >= coords.top) offset--; if (node3 == view.dom && offset == node3.childNodes.length - 1 && node3.lastChild.nodeType == 1 && coords.top > node3.lastChild.getBoundingClientRect().bottom) - pos2 = view.state.doc.content.size; + pos = view.state.doc.content.size; else if (offset == 0 || node3.nodeType != 1 || node3.childNodes[offset - 1].nodeName != "BR") - pos2 = posFromCaret(view, node3, offset, coords); + pos = posFromCaret(view, node3, offset, coords); } - if (pos2 == null) - pos2 = posFromElement(view, elt, coords); + if (pos == null) + pos = posFromElement(view, elt, coords); let desc = view.docView.nearestDesc(elt, true); - return { pos: pos2, inside: desc ? desc.posAtStart - desc.border : -1 }; + return { pos, inside: desc ? desc.posAtStart - desc.border : -1 }; } __name(posAtCoords, "posAtCoords"); function nonZero(rect) { @@ -167380,8 +168685,8 @@ function singleRect(target2, bias) { } __name(singleRect, "singleRect"); const BIDI = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/; -function coordsAtPos(view, pos2, side) { - let { node: node3, offset, atom } = view.docView.domFromPos(pos2, side < 0 ? -1 : 1); +function coordsAtPos(view, pos, side) { + let { node: node3, offset, atom } = view.docView.domFromPos(pos, side < 0 ? -1 : 1); let supportEmptyRange = webkit || gecko; if (node3.nodeType == 3) { if (supportEmptyRange && (BIDI.test(node3.nodeValue) || (side < 0 ? !offset : offset == node3.nodeValue.length))) { @@ -167411,7 +168716,7 @@ function coordsAtPos(view, pos2, side) { return flattenV(singleRect(textRange(node3, from2, to), takeSide), takeSide < 0); } } - let $dom = view.state.doc.resolve(pos2 - (atom || 0)); + let $dom = view.state.doc.resolve(pos - (atom || 0)); if (!$dom.parent.inlineContent) { if (atom == null && offset && (side < 0 || offset == nodeSize(node3))) { let before = node3.childNodes[offset - 1]; @@ -167562,7 +168867,7 @@ class ViewDesc { } // Used to check whether a given description corresponds to a // widget/mark/node. - matchesWidget(widget2) { + matchesWidget(widget) { return false; } matchesMark(mark2) { @@ -167605,11 +168910,11 @@ class ViewDesc { this.children[i2].destroy(); } posBeforeChild(child) { - for (let i2 = 0, pos2 = this.posAtStart; ; i2++) { + for (let i2 = 0, pos = this.posAtStart; ; i2++) { let cur = this.children[i2]; if (cur == child) - return pos2; - pos2 += cur.size; + return pos; + pos += cur.size; } } get posBefore() { @@ -167706,27 +169011,27 @@ class ViewDesc { } // Find the desc for the node after the given pos, if any. (When a // parent node overrode rendering, there might not be one.) - descAt(pos2) { + descAt(pos) { for (let i2 = 0, offset = 0; i2 < this.children.length; i2++) { let child = this.children[i2], end = offset + child.size; - if (offset == pos2 && end != offset) { + if (offset == pos && end != offset) { while (!child.border && child.children.length) child = child.children[0]; return child; } - if (pos2 < end) - return child.descAt(pos2 - offset - child.border); + if (pos < end) + return child.descAt(pos - offset - child.border); offset = end; } } - domFromPos(pos2, side) { + domFromPos(pos, side) { if (!this.contentDOM) - return { node: this.dom, offset: 0, atom: pos2 + 1 }; + return { node: this.dom, offset: 0, atom: pos + 1 }; let i2 = 0, offset = 0; for (let curPos = 0; i2 < this.children.length; i2++) { let child = this.children[i2], end = curPos + child.size; - if (end > pos2 || child instanceof TrailingHackViewDesc) { - offset = pos2 - curPos; + if (end > pos || child instanceof TrailingHackViewDesc) { + offset = pos - curPos; break; } curPos = end; @@ -167805,10 +169110,10 @@ class ViewDesc { let child = this.children[side < 0 ? 0 : this.children.length - 1]; return child.size == 0 || child.emptyChildAt(side); } - domAfterPos(pos2) { - let { node: node3, offset } = this.domFromPos(pos2, 0); + domAfterPos(pos) { + let { node: node3, offset } = this.domFromPos(pos, 0); if (node3.nodeType != 1 || offset == node3.childNodes.length) - throw new RangeError("No node after pos " + pos2); + throw new RangeError("No node after pos " + pos); return node3.childNodes[offset]; } // View descs are responsible for setting any selection that falls @@ -167930,16 +169235,16 @@ class WidgetViewDesc extends ViewDesc { static { __name(this, "WidgetViewDesc"); } - constructor(parent, widget2, view, pos2) { - let self2, dom = widget2.type.toDOM; + constructor(parent, widget, view, pos) { + let self2, dom = widget.type.toDOM; if (typeof dom == "function") dom = dom(view, () => { if (!self2) - return pos2; + return pos; if (self2.parent) return self2.parent.posBeforeChild(self2); }); - if (!widget2.type.spec.raw) { + if (!widget.type.spec.raw) { if (dom.nodeType != 1) { let wrap2 = document.createElement("span"); wrap2.appendChild(dom); @@ -167949,12 +169254,12 @@ class WidgetViewDesc extends ViewDesc { dom.classList.add("ProseMirror-widget"); } super(parent, [], dom, null); - this.widget = widget2; - this.widget = widget2; + this.widget = widget; + this.widget = widget; self2 = this; } - matchesWidget(widget2) { - return this.dirty == NOT_DIRTY && widget2.type.eq(this.widget.type); + matchesWidget(widget) { + return this.dirty == NOT_DIRTY && widget.type.eq(this.widget.type); } parseRule() { return { ignore: true }; @@ -167994,8 +169299,8 @@ class CompositionViewDesc extends ViewDesc { return this.posAtStart + (offset ? this.size : 0); return this.posAtStart + offset; } - domFromPos(pos2) { - return { node: this.textDOM, offset: pos2 }; + domFromPos(pos) { + return { node: this.textDOM, offset: pos }; } ignoreMutation(mut) { return mut.type === "characterData" && mut.target.nodeValue == mut.oldValue; @@ -168061,7 +169366,7 @@ class NodeViewDesc extends ViewDesc { static { __name(this, "NodeViewDesc"); } - constructor(parent, node3, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos2) { + constructor(parent, node3, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos) { super(parent, [], dom, contentDOM); this.node = node3; this.outerDeco = outerDeco; @@ -168077,11 +169382,11 @@ class NodeViewDesc extends ViewDesc { // since it'd require exposing a whole slew of finicky // implementation details to the user code that they probably will // never need.) - static create(parent, node3, outerDeco, innerDeco, view, pos2) { + static create(parent, node3, outerDeco, innerDeco, view, pos) { let custom2 = view.nodeViews[node3.type.name], descObj; let spec = custom2 && custom2(node3, view, () => { if (!descObj) - return pos2; + return pos; if (descObj.parent) return descObj.parent.posBeforeChild(descObj); }, outerDeco, innerDeco); @@ -168104,11 +169409,11 @@ class NodeViewDesc extends ViewDesc { let nodeDOM = dom; dom = applyOuterDeco(dom, outerDeco, node3); if (spec) - return descObj = new CustomNodeViewDesc(parent, node3, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, spec, view, pos2 + 1); + return descObj = new CustomNodeViewDesc(parent, node3, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, spec, view, pos + 1); else if (node3.isText) return new TextViewDesc(parent, node3, outerDeco, innerDeco, dom, nodeDOM, view); else - return new NodeViewDesc(parent, node3, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, view, pos2 + 1); + return new NodeViewDesc(parent, node3, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, view, pos + 1); } parseRule() { if (this.node.type.spec.reparseInView) @@ -168146,18 +169451,18 @@ class NodeViewDesc extends ViewDesc { // decorations, possibly introducing nesting for marks. Then, in a // separate step, syncs the DOM inside `this.contentDOM` to // `this.children`. - updateChildren(view, pos2) { - let inline3 = this.node.inlineContent, off = pos2; - let composition = view.composing ? this.localCompositionInfo(view, pos2) : null; + updateChildren(view, pos) { + let inline3 = this.node.inlineContent, off = pos; + let composition = view.composing ? this.localCompositionInfo(view, pos) : null; let localComposition = composition && composition.pos > -1 ? composition : null; let compositionInChild = composition && composition.pos < 0; let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view); - iterDeco(this.node, this.innerDeco, (widget2, i2, insideNode) => { - if (widget2.spec.marks) - updater.syncToMarks(widget2.spec.marks, inline3, view); - else if (widget2.type.side >= 0 && !insideNode) + iterDeco(this.node, this.innerDeco, (widget, i2, insideNode) => { + if (widget.spec.marks) + updater.syncToMarks(widget.spec.marks, inline3, view); + else if (widget.type.side >= 0 && !insideNode) updater.syncToMarks(i2 == this.node.childCount ? Mark$1.none : this.node.child(i2).marks, inline3, view); - updater.placeWidget(widget2, view, off); + updater.placeWidget(widget, view, off); }, (child, outerDeco, innerDeco, i2) => { updater.syncToMarks(child.marks, inline3, view); let compIndex; @@ -168181,22 +169486,22 @@ class NodeViewDesc extends ViewDesc { iosHacks(this.dom); } } - localCompositionInfo(view, pos2) { + localCompositionInfo(view, pos) { let { from: from2, to } = view.state.selection; - if (!(view.state.selection instanceof TextSelection) || from2 < pos2 || to > pos2 + this.node.content.size) + if (!(view.state.selection instanceof TextSelection) || from2 < pos || to > pos + this.node.content.size) return null; let textNode = view.input.compositionNode; if (!textNode || !this.dom.contains(textNode.parentNode)) return null; if (this.node.inlineContent) { let text2 = textNode.nodeValue; - let textPos = findTextInFragment(this.node.content, text2, from2 - pos2, to - pos2); + let textPos = findTextInFragment(this.node.content, text2, from2 - pos, to - pos); return textPos < 0 ? null : { node: textNode, pos: textPos, text: text2 }; } else { return { node: textNode, pos: -1, text: "" }; } } - protectLocalComposition(view, { node: node3, pos: pos2, text: text2 }) { + protectLocalComposition(view, { node: node3, pos, text: text2 }) { if (this.getDesc(node3)) return; let topNode = node3; @@ -168212,7 +169517,7 @@ class NodeViewDesc extends ViewDesc { } let desc = new CompositionViewDesc(this, topNode, node3, text2); view.input.compositionNodes.push(desc); - this.children = replaceNodes(this.children, pos2, pos2 + text2.length, view, desc); + this.children = replaceNodes(this.children, pos, pos + text2.length, view, desc); } // If this desc must be updated to match the given node decoration, // do so and return true. @@ -168302,8 +169607,8 @@ class TextViewDesc extends NodeViewDesc { return true; return false; } - domFromPos(pos2) { - return { node: this.nodeDOM, offset: pos2 }; + domFromPos(pos) { + return { node: this.nodeDOM, offset: pos }; } localPosFromDOM(dom, offset, bias) { if (dom == this.nodeDOM) @@ -168350,8 +169655,8 @@ class CustomNodeViewDesc extends NodeViewDesc { static { __name(this, "CustomNodeViewDesc"); } - constructor(parent, node3, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec, view, pos2) { - super(parent, node3, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos2); + constructor(parent, node3, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec, view, pos) { + super(parent, node3, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos); this.spec = spec; } // A custom `update` method gets to decide whether the update goes @@ -168407,9 +169712,9 @@ function renderDescs(parentDOM, descs, view) { parentDOM.insertBefore(childDOM, dom); } if (desc instanceof MarkViewDesc) { - let pos2 = dom ? dom.previousSibling : parentDOM.lastChild; + let pos = dom ? dom.previousSibling : parentDOM.lastChild; renderDescs(desc.contentDOM, desc.children, view); - dom = pos2 ? pos2.nextSibling : parentDOM.firstChild; + dom = pos ? pos.nextSibling : parentDOM.firstChild; } } while (dom) { @@ -168642,7 +169947,7 @@ class ViewTreeUpdater { } // Try to update the next node, if any, to the given data. Checks // pre-matches to avoid overwriting nodes that could still be used. - updateNextNode(node3, outerDeco, innerDeco, view, index2, pos2) { + updateNextNode(node3, outerDeco, innerDeco, view, index2, pos) { for (let i2 = this.index; i2 < this.top.children.length; i2++) { let next2 = this.top.children[i2]; if (next2 instanceof NodeViewDesc) { @@ -168657,12 +169962,12 @@ class ViewTreeUpdater { this.changed = true; this.index++; return true; - } else if (!locked && (updated15 = this.recreateWrapper(next2, node3, outerDeco, innerDeco, view, pos2))) { + } else if (!locked && (updated15 = this.recreateWrapper(next2, node3, outerDeco, innerDeco, view, pos))) { this.destroyBetween(this.index, i2); this.top.children[this.index] = updated15; if (updated15.contentDOM) { updated15.dirty = CONTENT_DIRTY; - updated15.updateChildren(view, pos2 + 1); + updated15.updateChildren(view, pos + 1); updated15.dirty = NOT_DIRTY; } this.changed = true; @@ -168676,10 +169981,10 @@ class ViewTreeUpdater { } // When a node with content is replaced by a different node with // identical content, move over its children. - recreateWrapper(next2, node3, outerDeco, innerDeco, view, pos2) { + recreateWrapper(next2, node3, outerDeco, innerDeco, view, pos) { if (next2.dirty || node3.isAtom || !next2.children.length || !next2.node.content.eq(node3.content) || !sameOuterDeco(outerDeco, next2.outerDeco) || !innerDeco.eq(next2.innerDeco)) return null; - let wrapper = NodeViewDesc.create(this.top, node3, outerDeco, innerDeco, view, pos2); + let wrapper = NodeViewDesc.create(this.top, node3, outerDeco, innerDeco, view, pos); if (wrapper.contentDOM) { wrapper.children = next2.children; next2.children = []; @@ -168690,19 +169995,19 @@ class ViewTreeUpdater { return wrapper; } // Insert the node as a newly created node desc. - addNode(node3, outerDeco, innerDeco, view, pos2) { - let desc = NodeViewDesc.create(this.top, node3, outerDeco, innerDeco, view, pos2); + addNode(node3, outerDeco, innerDeco, view, pos) { + let desc = NodeViewDesc.create(this.top, node3, outerDeco, innerDeco, view, pos); if (desc.contentDOM) - desc.updateChildren(view, pos2 + 1); + desc.updateChildren(view, pos + 1); this.top.children.splice(this.index++, 0, desc); this.changed = true; } - placeWidget(widget2, view, pos2) { + placeWidget(widget, view, pos) { let next2 = this.index < this.top.children.length ? this.top.children[this.index] : null; - if (next2 && next2.matchesWidget(widget2) && (widget2 == next2.widget || !next2.widget.type.toDOM.parentNode)) { + if (next2 && next2.matchesWidget(widget) && (widget == next2.widget || !next2.widget.type.toDOM.parentNode)) { this.index++; } else { - let desc = new WidgetViewDesc(this.top, widget2, view, pos2); + let desc = new WidgetViewDesc(this.top, widget, view, pos); this.top.children.splice(this.index++, 0, desc); this.changed = true; } @@ -168796,23 +170101,23 @@ function iterDeco(parent, deco, onWidget, onNode) { } let decoIndex = 0, active3 = [], restNode = null; for (let parentIndex = 0; ; ) { - let widget2, widgets; + let widget, widgets; while (decoIndex < locals.length && locals[decoIndex].to == offset) { let next2 = locals[decoIndex++]; if (next2.widget) { - if (!widget2) - widget2 = next2; + if (!widget) + widget = next2; else - (widgets || (widgets = [widget2])).push(next2); + (widgets || (widgets = [widget])).push(next2); } } - if (widget2) { + if (widget) { if (widgets) { widgets.sort(compareSide); for (let i2 = 0; i2 < widgets.length; i2++) onWidget(widgets[i2], parentIndex, !!restNode); } else { - onWidget(widget2, parentIndex, !!restNode); + onWidget(widget, parentIndex, !!restNode); } } let child, index2; @@ -168865,21 +170170,21 @@ function iosHacks(dom) { } __name(iosHacks, "iosHacks"); function findTextInFragment(frag, text2, from2, to) { - for (let i2 = 0, pos2 = 0; i2 < frag.childCount && pos2 <= to; ) { - let child = frag.child(i2++), childStart = pos2; - pos2 += child.nodeSize; + for (let i2 = 0, pos = 0; i2 < frag.childCount && pos <= to; ) { + let child = frag.child(i2++), childStart = pos; + pos += child.nodeSize; if (!child.isText) continue; let str = child.text; while (i2 < frag.childCount) { let next2 = frag.child(i2++); - pos2 += next2.nodeSize; + pos += next2.nodeSize; if (!next2.isText) break; str += next2.text; } - if (pos2 >= from2) { - if (pos2 >= to && str.slice(to - text2.length - childStart, to - childStart) == text2) + if (pos >= from2) { + if (pos >= to && str.slice(to - text2.length - childStart, to - childStart) == text2) return to - text2.length; let found2 = childStart < to ? str.lastIndexOf(text2, to - childStart - 1) : -1; if (found2 >= 0 && found2 + text2.length + childStart >= from2) @@ -168926,8 +170231,8 @@ function selectionFromDOM(view, origin2 = null) { nearestDesc = nearestDesc.parent; let nearestDescNode = nearestDesc.node; if (nearestDesc && nearestDescNode.isAtom && NodeSelection.isSelectable(nearestDescNode) && nearestDesc.parent && !(nearestDescNode.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) { - let pos2 = nearestDesc.posBefore; - selection = new NodeSelection(head == pos2 ? $head : doc2.resolve(pos2)); + let pos = nearestDesc.posBefore; + selection = new NodeSelection(head == pos ? $head : doc2.resolve(pos)); } } else { if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) { @@ -169003,8 +170308,8 @@ function selectionToDOM(view, force = false) { } __name(selectionToDOM, "selectionToDOM"); const brokenSelectBetweenUneditable = safari || chrome && chrome_version < 63; -function temporarilyEditableNear(view, pos2) { - let { node: node3, offset } = view.docView.domFromPos(pos2, 0); +function temporarilyEditableNear(view, pos) { + let { node: node3, offset } = view.docView.domFromPos(pos, 0); let after = offset < node3.childNodes.length ? node3.childNodes[offset] : null; let before = offset ? node3.childNodes[offset - 1] : null; if (safari && after && after.contentEditable == "false") @@ -169342,18 +170647,18 @@ function setSelFocus(view, node3, offset) { }, 50); } __name(setSelFocus, "setSelFocus"); -function findDirection(view, pos2) { - let $pos = view.state.doc.resolve(pos2); +function findDirection(view, pos) { + let $pos = view.state.doc.resolve(pos); if (!(chrome || windows) && $pos.parent.inlineContent) { - let coords = view.coordsAtPos(pos2); - if (pos2 > $pos.start()) { - let before = view.coordsAtPos(pos2 - 1); + let coords = view.coordsAtPos(pos); + if (pos > $pos.start()) { + let before = view.coordsAtPos(pos - 1); let mid = (before.top + before.bottom) / 2; if (mid > coords.top && mid < coords.bottom && Math.abs(before.left - coords.left) > 1) return before.left < coords.left ? "ltr" : "rtl"; } - if (pos2 < $pos.end()) { - let after = view.coordsAtPos(pos2 + 1); + if (pos < $pos.end()) { + let after = view.coordsAtPos(pos + 1); let mid = (after.top + after.bottom) / 2; if (mid > coords.top && mid < coords.bottom && Math.abs(after.left - coords.left) > 1) return after.left > coords.left ? "ltr" : "rtl"; @@ -169858,12 +171163,12 @@ function isNear(event, click2) { return dx * dx + dy * dy < 100; } __name(isNear, "isNear"); -function runHandlerOnContext(view, propName, pos2, inside, event) { +function runHandlerOnContext(view, propName, pos, inside, event) { if (inside == -1) return false; let $pos = view.state.doc.resolve(inside); for (let i2 = $pos.depth + 1; i2 > 0; i2--) { - if (view.someProp(propName, (f2) => i2 > $pos.depth ? f2(view, pos2, $pos.nodeAfter, $pos.before(i2), event, true) : f2(view, pos2, $pos.node(i2), $pos.before(i2), event, false))) + if (view.someProp(propName, (f2) => i2 > $pos.depth ? f2(view, pos, $pos.nodeAfter, $pos.before(i2), event, true) : f2(view, pos, $pos.node(i2), $pos.before(i2), event, false))) return true; } return false; @@ -169916,16 +171221,16 @@ function selectClickedNode(view, inside) { } } __name(selectClickedNode, "selectClickedNode"); -function handleSingleClick(view, pos2, inside, event, selectNode) { - return runHandlerOnContext(view, "handleClickOn", pos2, inside, event) || view.someProp("handleClick", (f2) => f2(view, pos2, event)) || (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside)); +function handleSingleClick(view, pos, inside, event, selectNode) { + return runHandlerOnContext(view, "handleClickOn", pos, inside, event) || view.someProp("handleClick", (f2) => f2(view, pos, event)) || (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside)); } __name(handleSingleClick, "handleSingleClick"); -function handleDoubleClick(view, pos2, inside, event) { - return runHandlerOnContext(view, "handleDoubleClickOn", pos2, inside, event) || view.someProp("handleDoubleClick", (f2) => f2(view, pos2, event)); +function handleDoubleClick(view, pos, inside, event) { + return runHandlerOnContext(view, "handleDoubleClickOn", pos, inside, event) || view.someProp("handleDoubleClick", (f2) => f2(view, pos, event)); } __name(handleDoubleClick, "handleDoubleClick"); -function handleTripleClick$1(view, pos2, inside, event) { - return runHandlerOnContext(view, "handleTripleClickOn", pos2, inside, event) || view.someProp("handleTripleClick", (f2) => f2(view, pos2, event)) || defaultTripleClick(view, inside, event); +function handleTripleClick$1(view, pos, inside, event) { + return runHandlerOnContext(view, "handleTripleClickOn", pos, inside, event) || view.someProp("handleTripleClick", (f2) => f2(view, pos, event)) || defaultTripleClick(view, inside, event); } __name(handleTripleClick$1, "handleTripleClick$1"); function defaultTripleClick(view, inside, event) { @@ -169970,14 +171275,14 @@ handlers.mousedown = (view, _event) => { type = "tripleClick"; } view.input.lastClick = { time: now2, x: event.clientX, y: event.clientY, type }; - let pos2 = view.posAtCoords(eventCoords(event)); - if (!pos2) + let pos = view.posAtCoords(eventCoords(event)); + if (!pos) return; if (type == "singleClick") { if (view.input.mouseDown) view.input.mouseDown.done(); - view.input.mouseDown = new MouseDown(view, pos2, event, !!flushed); - } else if ((type == "doubleClick" ? handleDoubleClick : handleTripleClick$1)(view, pos2.pos, pos2.inside, event)) { + view.input.mouseDown = new MouseDown(view, pos, event, !!flushed); + } else if ((type == "doubleClick" ? handleDoubleClick : handleTripleClick$1)(view, pos.pos, pos.inside, event)) { event.preventDefault(); } else { setSelectionOrigin(view, "pointer"); @@ -169987,9 +171292,9 @@ class MouseDown { static { __name(this, "MouseDown"); } - constructor(view, pos2, event, flushed) { + constructor(view, pos, event, flushed) { this.view = view; - this.pos = pos2; + this.pos = pos; this.event = event; this.flushed = flushed; this.delayedSelectionSync = false; @@ -169998,11 +171303,11 @@ class MouseDown { this.selectNode = !!event[selectNodeModifier]; this.allowDefault = event.shiftKey; let targetNode, targetPos; - if (pos2.inside > -1) { - targetNode = view.state.doc.nodeAt(pos2.inside); - targetPos = pos2.inside; + if (pos.inside > -1) { + targetNode = view.state.doc.nodeAt(pos.inside); + targetPos = pos.inside; } else { - let $pos = view.state.doc.resolve(pos2.pos); + let $pos = view.state.doc.resolve(pos.pos); targetNode = $pos.parent; targetPos = $pos.depth ? $pos.before() : 0; } @@ -170051,13 +171356,13 @@ class MouseDown { this.done(); if (!this.view.dom.contains(event.target)) return; - let pos2 = this.pos; + let pos = this.pos; if (this.view.state.doc != this.startDoc) - pos2 = this.view.posAtCoords(eventCoords(event)); + pos = this.view.posAtCoords(eventCoords(event)); this.updateAllowDefault(event); - if (this.allowDefault || !pos2) { + if (this.allowDefault || !pos) { setSelectionOrigin(this.view, "pointer"); - } else if (handleSingleClick(this.view, pos2.pos, pos2.inside, event, this.selectNode)) { + } else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) { event.preventDefault(); } else if (event.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements safari && this.mightDrag && !this.mightDrag.node.isAtom || // Chrome will sometimes treat a node selection as a @@ -170067,8 +171372,8 @@ class MouseDown { // (hidden) cursor is doesn't change the selection, and // thus doesn't get a reaction from ProseMirror. This // works around that. - chrome && !this.view.state.selection.visible && Math.min(Math.abs(pos2.pos - this.view.state.selection.from), Math.abs(pos2.pos - this.view.state.selection.to)) <= 2)) { - updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos2.pos)), "pointer"); + chrome && !this.view.state.selection.visible && Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2)) { + updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos)), "pointer"); event.preventDefault(); } else { setSelectionOrigin(this.view, "pointer"); @@ -170322,9 +171627,9 @@ handlers.dragstart = (view, _event) => { if (!event.dataTransfer) return; let sel = view.state.selection; - let pos2 = sel.empty ? null : view.posAtCoords(eventCoords(event)); + let pos = sel.empty ? null : view.posAtCoords(eventCoords(event)); let node3; - if (pos2 && pos2.pos >= sel.from && pos2.pos <= (sel instanceof NodeSelection ? sel.to - 1 : sel.to)) ; + if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1 : sel.to)) ; else if (mouseDown && mouseDown.mightDrag) { node3 = NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos); } else if (event.target && event.target.nodeType == 1) { @@ -170387,16 +171692,16 @@ editHandlers.drop = (view, _event) => { else tr2.deleteSelection(); } - let pos2 = tr2.mapping.map(insertPos); + let pos = tr2.mapping.map(insertPos); let isNode = slice2.openStart == 0 && slice2.openEnd == 0 && slice2.content.childCount == 1; let beforeInsert = tr2.doc; if (isNode) - tr2.replaceRangeWith(pos2, pos2, slice2.content.firstChild); + tr2.replaceRangeWith(pos, pos, slice2.content.firstChild); else - tr2.replaceRange(pos2, pos2, slice2); + tr2.replaceRange(pos, pos, slice2); if (tr2.doc.eq(beforeInsert)) return; - let $pos = tr2.doc.resolve(pos2); + let $pos = tr2.doc.resolve(pos); if (isNode && NodeSelection.isSelectable(slice2.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice2.content.firstChild)) { tr2.setSelection(new NodeSelection($pos)); } else { @@ -170473,8 +171778,8 @@ class WidgetType { this.side = this.spec.side || 0; } map(mapping, span, offset, oldOffset) { - let { pos: pos2, deleted } = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1); - return deleted ? null : new Decoration(pos2 - offset, pos2 - offset, this); + let { pos, deleted } = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1); + return deleted ? null : new Decoration(pos - offset, pos - offset, this); } valid() { return true; @@ -170577,8 +171882,8 @@ class Decoration { also directly pass a DOM node. `getPos` can be used to find the widget's current document position. */ - static widget(pos2, toDOM, spec) { - return new Decoration(pos2, pos2, new WidgetType(toDOM, spec)); + static widget(pos, toDOM, spec) { + return new Decoration(pos, pos, new WidgetType(toDOM, spec)); } /** Creates an inline decoration, which adds the given attributes to @@ -171681,11 +172986,11 @@ function skipClosingAndOpening($pos, fromEnd, mayOpen) { return end; } __name(skipClosingAndOpening, "skipClosingAndOpening"); -function findDiff(a2, b2, pos2, preferredPos, preferredSide) { - let start2 = a2.findDiffStart(b2, pos2); +function findDiff(a2, b2, pos, preferredPos, preferredSide) { + let start2 = a2.findDiffStart(b2, pos); if (start2 == null) return null; - let { a: endA, b: endB } = a2.findDiffEnd(b2, pos2 + a2.size, pos2 + b2.size); + let { a: endA, b: endB } = a2.findDiffEnd(b2, pos + a2.size, pos + b2.size); if (preferredSide == "end") { let adjust = Math.max(0, start2 - Math.min(endA, endB)); preferredPos -= endA + adjust - start2; @@ -172028,8 +173333,8 @@ class EditorView { is used. When < 0, the element before the position is used, otherwise the element after. */ - coordsAtPos(pos2, side = 1) { - return coordsAtPos(this, pos2, side); + coordsAtPos(pos, side = 1) { + return coordsAtPos(this, pos, side); } /** Find the DOM position that corresponds to the given document @@ -172041,8 +173346,8 @@ class EditorView { Note that you should **not** mutate the editor's internal DOM, only inspect it (and even that is usually not necessary). */ - domAtPos(pos2, side = 0) { - return this.docView.domFromPos(pos2, side); + domAtPos(pos, side = 0) { + return this.docView.domFromPos(pos, side); } /** Find the DOM node that represents the document node after the @@ -172054,8 +173359,8 @@ class EditorView { editor DOM directly, or add styling this way, since that will be immediately overriden by the editor as it redraws the node. */ - nodeDOM(pos2) { - let desc = this.docView.descAt(pos2); + nodeDOM(pos) { + let desc = this.docView.descAt(pos); return desc ? desc.nodeDOM : null; } /** @@ -172069,10 +173374,10 @@ class EditorView { node to use when the position is inside a leaf node. */ posAtDOM(node3, offset, bias = -1) { - let pos2 = this.docView.posFromDOM(node3, offset, bias); - if (pos2 == null) + let pos = this.docView.posFromDOM(node3, offset, bias); + if (pos == null) throw new RangeError("DOM position not inside the editor"); - return pos2; + return pos; } /** Find out whether the selection is at the end of a textblock when @@ -172682,8 +173987,8 @@ const exitCode$1 = /* @__PURE__ */ __name((state, dispatch) => { if (!type || !above.canReplaceWith(after, after, type)) return false; if (dispatch) { - let pos2 = $head.after(), tr2 = state.tr.replaceWith(pos2, pos2, type.createAndFill()); - tr2.setSelection(Selection.near(tr2.doc.resolve(pos2), 1)); + let pos = $head.after(), tr2 = state.tr.replaceWith(pos, pos, type.createAndFill()); + tr2.setSelection(Selection.near(tr2.doc.resolve(pos), 1)); dispatch(tr2.scrollIntoView()); } return true; @@ -172783,13 +174088,13 @@ const splitBlockKeepMarks = /* @__PURE__ */ __name((state, dispatch) => { })); }, "splitBlockKeepMarks"); const selectParentNode$1 = /* @__PURE__ */ __name((state, dispatch) => { - let { $from, to } = state.selection, pos2; + let { $from, to } = state.selection, pos; let same = $from.sharedDepth(to); if (same == 0) return false; - pos2 = $from.before(same); + pos = $from.before(same); if (dispatch) - dispatch(state.tr.setSelection(NodeSelection.create(state.doc, pos2))); + dispatch(state.tr.setSelection(NodeSelection.create(state.doc, pos))); return true; }, "selectParentNode$1"); const selectAll$1 = /* @__PURE__ */ __name((state, dispatch) => { @@ -172901,7 +174206,7 @@ function setBlockType(nodeType, attrs6 = null) { let applicable = false; for (let i2 = 0; i2 < state.selection.ranges.length && !applicable; i2++) { let { $from: { pos: from2 }, $to: { pos: to } } = state.selection.ranges[i2]; - state.doc.nodesBetween(from2, to, (node3, pos2) => { + state.doc.nodesBetween(from2, to, (node3, pos) => { if (applicable) return false; if (!node3.isTextblock || node3.hasMarkup(nodeType, attrs6)) @@ -172909,7 +174214,7 @@ function setBlockType(nodeType, attrs6 = null) { if (node3.type == nodeType) { applicable = true; } else { - let $pos = state.doc.resolve(pos2), index2 = $pos.index(); + let $pos = state.doc.resolve(pos), index2 = $pos.index(); applicable = $pos.parent.canReplaceWith(index2, index2 + 1, nodeType); } }); @@ -172932,8 +174237,8 @@ function markApplies(doc2, ranges, type, enterAtoms) { for (let i2 = 0; i2 < ranges.length; i2++) { let { $from, $to } = ranges[i2]; let can = $from.depth == 0 ? doc2.inlineContent && doc2.type.allowsMarkType(type) : false; - doc2.nodesBetween($from.pos, $to.pos, (node3, pos2) => { - if (can || !enterAtoms && node3.isAtom && node3.isInline && pos2 >= $from.pos && pos2 + node3.nodeSize <= $to.pos) + doc2.nodesBetween($from.pos, $to.pos, (node3, pos) => { + if (can || !enterAtoms && node3.isAtom && node3.isInline && pos >= $from.pos && pos + node3.nodeSize <= $to.pos) return false; can = node3.inlineContent && node3.type.allowsMarkType(type); }); @@ -172947,11 +174252,11 @@ function removeInlineAtoms(ranges) { let result = []; for (let i2 = 0; i2 < ranges.length; i2++) { let { $from, $to } = ranges[i2]; - $from.doc.nodesBetween($from.pos, $to.pos, (node3, pos2) => { - if (node3.isAtom && node3.content.size && node3.isInline && pos2 >= $from.pos && pos2 + node3.nodeSize <= $to.pos) { - if (pos2 + 1 > $from.pos) - result.push(new SelectionRange($from, $from.doc.resolve(pos2 + 1))); - $from = $from.doc.resolve(pos2 + 1 + node3.content.size); + $from.doc.nodesBetween($from.pos, $to.pos, (node3, pos) => { + if (node3.isAtom && node3.content.size && node3.isInline && pos >= $from.pos && pos + node3.nodeSize <= $to.pos) { + if (pos + 1 > $from.pos) + result.push(new SelectionRange($from, $from.doc.resolve(pos + 1))); + $from = $from.doc.resolve(pos + 1 + node3.content.size); return false; } }); @@ -172983,10 +174288,10 @@ function toggleMark$1(markType, attrs6 = null, options4) { } else { add3 = !ranges.every((r2) => { let missing = false; - tr2.doc.nodesBetween(r2.$from.pos, r2.$to.pos, (node3, pos2, parent) => { + tr2.doc.nodesBetween(r2.$from.pos, r2.$to.pos, (node3, pos, parent) => { if (missing) return false; - missing = !markType.isInSet(node3.marks) && !!parent && parent.type.allowsMarkType(markType) && !(node3.isText && /^\s*$/.test(node3.textBetween(Math.max(0, r2.$from.pos - pos2), Math.min(node3.nodeSize, r2.$to.pos - pos2)))); + missing = !markType.isInSet(node3.marks) && !!parent && parent.type.allowsMarkType(markType) && !(node3.isText && /^\s*$/.test(node3.textBetween(Math.max(0, r2.$from.pos - pos), Math.min(node3.nodeSize, r2.$to.pos - pos)))); }); return !missing; }); @@ -173028,16 +174333,16 @@ function wrapDispatchForJoin(dispatch, isJoinable) { for (let i2 = 0; i2 < ranges.length; i2 += 2) { let from2 = ranges[i2], to = ranges[i2 + 1]; let $from = tr2.doc.resolve(from2), depth = $from.sharedDepth(to), parent = $from.node(depth); - for (let index2 = $from.indexAfter(depth), pos2 = $from.after(depth + 1); pos2 <= to; ++index2) { + for (let index2 = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index2) { let after = parent.maybeChild(index2); if (!after) break; - if (index2 && joinable2.indexOf(pos2) == -1) { + if (index2 && joinable2.indexOf(pos) == -1) { let before = parent.child(index2 - 1); if (before.type == after.type && isJoinable(before, after)) - joinable2.push(pos2); + joinable2.push(pos); } - pos2 += after.nodeSize; + pos += after.nodeSize; } } joinable2.sort((a2, b2) => a2 - b2); @@ -173205,11 +174510,11 @@ function splitListItem$1(itemType, itemAttrs) { let start2 = $from.before($from.depth - (depthBefore - 1)); let tr3 = state.tr.replace(start2, $from.after(-depthAfter), new Slice(wrap2, 4 - depthBefore, 0)); let sel = -1; - tr3.doc.nodesBetween(start2, tr3.doc.content.size, (node4, pos2) => { + tr3.doc.nodesBetween(start2, tr3.doc.content.size, (node4, pos) => { if (sel > -1) return false; if (node4.isTextblock && node4.content.size == 0) - sel = pos2 + 1; + sel = pos + 1; }); if (sel > -1) tr3.setSelection(Selection.near(tr3.doc.resolve(sel))); @@ -173274,9 +174579,9 @@ function liftToOuterList(state, dispatch, itemType, range2) { __name(liftToOuterList, "liftToOuterList"); function liftOutOfList(state, dispatch, range2) { let tr2 = state.tr, list2 = range2.parent; - for (let pos2 = range2.end, i2 = range2.endIndex - 1, e2 = range2.startIndex; i2 > e2; i2--) { - pos2 -= list2.child(i2).nodeSize; - tr2.delete(pos2 - 1, pos2 + 1); + for (let pos = range2.end, i2 = range2.endIndex - 1, e2 = range2.startIndex; i2 > e2; i2--) { + pos -= list2.child(i2).nodeSize; + tr2.delete(pos - 1, pos + 1); } let $start = tr2.doc.resolve(range2.start), item3 = $start.nodeAfter; if (tr2.mapping.map(range2.end) != range2.start + $start.nodeAfter.nodeSize) @@ -173839,15 +175144,15 @@ __name(getHTMLFromFragment, "getHTMLFromFragment"); const getTextContentFromNodes = /* @__PURE__ */ __name(($from, maxMatch = 500) => { let textBefore = ""; const sliceEndPos = $from.parentOffset; - $from.parent.nodesBetween(Math.max(0, sliceEndPos - maxMatch), sliceEndPos, (node3, pos2, parent, index2) => { + $from.parent.nodesBetween(Math.max(0, sliceEndPos - maxMatch), sliceEndPos, (node3, pos, parent, index2) => { var _a2, _b; const chunk = ((_b = (_a2 = node3.type.spec).toText) === null || _b === void 0 ? void 0 : _b.call(_a2, { node: node3, - pos: pos2, + pos, parent, index: index2 })) || node3.textContent || "%leaf%"; - textBefore += node3.isAtom && !node3.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos2)); + textBefore += node3.isAtom && !node3.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos)); }); return textBefore; }, "getTextContentFromNodes"); @@ -174187,13 +175492,13 @@ function run$2(config2) { state }); const handlers2 = []; - state.doc.nodesBetween(from2, to, (node3, pos2) => { + state.doc.nodesBetween(from2, to, (node3, pos) => { if (!node3.isTextblock || node3.type.spec.code) { return; } - const resolvedFrom = Math.max(from2, pos2); - const resolvedTo = Math.min(to, pos2 + node3.content.size); - const textToMatch = node3.textBetween(resolvedFrom - pos2, resolvedTo - pos2, void 0, ""); + const resolvedFrom = Math.max(from2, pos); + const resolvedTo = Math.min(to, pos + node3.content.size); + const textToMatch = node3.textBetween(resolvedFrom - pos, resolvedTo - pos, void 0, ""); const matches2 = pasteRuleMatcherHandler(textToMatch, rule.find, pasteEvent); matches2.forEach((match2) => { if (match2.index === void 0) { @@ -174662,9 +175967,9 @@ function getTextBetween(startNode, range2, options4) { const { from: from2, to } = range2; const { blockSeparator = "\n\n", textSerializers = {} } = options4 || {}; let text2 = ""; - startNode.nodesBetween(from2, to, (node3, pos2, parent, index2) => { + startNode.nodesBetween(from2, to, (node3, pos, parent, index2) => { var _a2; - if (node3.isBlock && pos2 > from2) { + if (node3.isBlock && pos > from2) { text2 += blockSeparator; } const textSerializer = textSerializers === null || textSerializers === void 0 ? void 0 : textSerializers[node3.type.name]; @@ -174672,7 +175977,7 @@ function getTextBetween(startNode, range2, options4) { if (parent) { text2 += textSerializer({ node: node3, - pos: pos2, + pos, parent, index: index2, range: range2 @@ -174681,7 +175986,7 @@ function getTextBetween(startNode, range2, options4) { return false; } if (node3.isText) { - text2 += (_a2 = node3 === null || node3 === void 0 ? void 0 : node3.text) === null || _a2 === void 0 ? void 0 : _a2.slice(Math.max(from2, pos2) - pos2, to - pos2); + text2 += (_a2 = node3 === null || node3 === void 0 ? void 0 : node3.text) === null || _a2 === void 0 ? void 0 : _a2.slice(Math.max(from2, pos) - pos, to - pos); } }); return text2; @@ -174742,13 +176047,13 @@ const clearNodes = /* @__PURE__ */ __name(() => ({ state, tr: tr2, dispatch }) = return true; } ranges.forEach(({ $from, $to }) => { - state.doc.nodesBetween($from.pos, $to.pos, (node3, pos2) => { + state.doc.nodesBetween($from.pos, $to.pos, (node3, pos) => { if (node3.type.isText) { return; } const { doc: doc2, mapping } = tr2; - const $mappedFrom = doc2.resolve(mapping.map(pos2)); - const $mappedTo = doc2.resolve(mapping.map(pos2 + node3.nodeSize)); + const $mappedFrom = doc2.resolve(mapping.map(pos)); + const $mappedTo = doc2.resolve(mapping.map(pos + node3.nodeSize)); const nodeRange = $mappedFrom.blockRange($mappedTo); if (!nodeRange) { return; @@ -175332,12 +176637,12 @@ function isNodeActive(state, typeOrName, attributes = {}) { const { from: from2, to, empty: empty3 } = state.selection; const type = typeOrName ? getNodeType(typeOrName, state.schema) : null; const nodeRanges = []; - state.doc.nodesBetween(from2, to, (node3, pos2) => { + state.doc.nodesBetween(from2, to, (node3, pos) => { if (node3.isText) { return; } - const relativeFrom = Math.max(from2, pos2); - const relativeTo = Math.min(to, pos2 + node3.nodeSize); + const relativeFrom = Math.max(from2, pos); + const relativeTo = Math.min(to, pos + node3.nodeSize); nodeRanges.push({ node: node3, from: relativeFrom, @@ -175411,14 +176716,14 @@ const resetAttributes = /* @__PURE__ */ __name((typeOrName, attributes) => ({ tr } if (dispatch) { tr2.selection.ranges.forEach((range2) => { - state.doc.nodesBetween(range2.$from.pos, range2.$to.pos, (node3, pos2) => { + state.doc.nodesBetween(range2.$from.pos, range2.$to.pos, (node3, pos) => { if (nodeType && nodeType === node3.type) { - tr2.setNodeMarkup(pos2, void 0, deleteProps(node3.attrs, attributes)); + tr2.setNodeMarkup(pos, void 0, deleteProps(node3.attrs, attributes)); } if (markType && node3.marks.length) { node3.marks.forEach((mark2) => { if (markType === mark2.type) { - tr2.addMark(pos2, pos2 + node3.nodeSize, markType.create(deleteProps(mark2.attrs, attributes))); + tr2.addMark(pos, pos + node3.nodeSize, markType.create(deleteProps(mark2.attrs, attributes))); } }); } @@ -175525,11 +176830,11 @@ function defaultBlockAt(match2) { __name(defaultBlockAt, "defaultBlockAt"); function findChildren(node3, predicate) { const nodesWithPos = []; - node3.descendants((child, pos2) => { + node3.descendants((child, pos) => { if (predicate(child)) { nodesWithPos.push({ node: child, - pos: pos2 + pos }); } }); @@ -175538,11 +176843,11 @@ function findChildren(node3, predicate) { __name(findChildren, "findChildren"); function findChildrenInRange(node3, range2, predicate) { const nodesWithPos = []; - node3.nodesBetween(range2.from, range2.to, (child, pos2) => { + node3.nodesBetween(range2.from, range2.to, (child, pos) => { if (predicate(child)) { nodesWithPos.push({ node: child, - pos: pos2 + pos }); } }); @@ -175738,13 +177043,13 @@ function getMarksBetween(from2, to, doc2) { }); }); } else { - doc2.nodesBetween(from2, to, (node3, pos2) => { + doc2.nodesBetween(from2, to, (node3, pos) => { if (!node3 || (node3 === null || node3 === void 0 ? void 0 : node3.nodeSize) === void 0) { return; } marks.push(...node3.marks.map((mark2) => ({ - from: pos2, - to: pos2 + node3.nodeSize, + from: pos, + to: pos + node3.nodeSize, mark: mark2 }))); }); @@ -175752,8 +177057,8 @@ function getMarksBetween(from2, to, doc2) { return marks; } __name(getMarksBetween, "getMarksBetween"); -const getNodeAtPosition = /* @__PURE__ */ __name((state, typeOrName, pos2, maxDepth = 20) => { - const $pos = state.doc.resolve(pos2); +const getNodeAtPosition = /* @__PURE__ */ __name((state, typeOrName, pos, maxDepth = 20) => { + const $pos = state.doc.resolve(pos); let currentDepth = maxDepth; let node3 = null; while (currentDepth > 0 && node3 === null) { @@ -175794,12 +177099,12 @@ function isMarkActive(state, typeOrName, attributes = {}) { ranges.forEach(({ $from, $to }) => { const from2 = $from.pos; const to = $to.pos; - state.doc.nodesBetween(from2, to, (node3, pos2) => { + state.doc.nodesBetween(from2, to, (node3, pos) => { if (!node3.isText && !node3.marks.length) { return; } - const relativeFrom = Math.max(from2, pos2); - const relativeTo = Math.min(to, pos2 + node3.nodeSize); + const relativeFrom = Math.max(from2, pos); + const relativeTo = Math.min(to, pos + node3.nodeSize); const range3 = relativeTo - relativeFrom; selectionRange += range3; markRanges.push(...node3.marks.map((mark2) => ({ @@ -175998,9 +177303,9 @@ const setMark = /* @__PURE__ */ __name((typeOrName, attributes = {}) => ({ tr: t ranges.forEach((range2) => { const from2 = range2.$from.pos; const to = range2.$to.pos; - state.doc.nodesBetween(from2, to, (node3, pos2) => { - const trimmedFrom = Math.max(pos2, from2); - const trimmedTo = Math.min(pos2 + node3.nodeSize, to); + state.doc.nodesBetween(from2, to, (node3, pos) => { + const trimmedFrom = Math.max(pos, from2); + const trimmedTo = Math.min(pos + node3.nodeSize, to); const someHasMark = node3.marks.find((mark2) => mark2.type === type); if (someHasMark) { node3.marks.forEach((mark2) => { @@ -176170,12 +177475,12 @@ const splitListItem = /* @__PURE__ */ __name((typeOrName, overrideAttrs = {}) => const start2 = $from.before($from.depth - (depthBefore - 1)); tr2.replace(start2, $from.after(-depthAfter), new Slice(wrap2, 4 - depthBefore, 0)); let sel = -1; - tr2.doc.nodesBetween(start2, tr2.doc.content.size, (n2, pos2) => { + tr2.doc.nodesBetween(start2, tr2.doc.content.size, (n2, pos) => { if (sel > -1) { return false; } if (n2.isTextblock && n2.content.size === 0) { - sel = pos2 + 1; + sel = pos + 1; } }); if (sel > -1) { @@ -176406,25 +177711,25 @@ const updateAttributes = /* @__PURE__ */ __name((typeOrName, attributes = {}) => let trimmedFrom; let trimmedTo; if (tr2.selection.empty) { - state.doc.nodesBetween(from2, to, (node3, pos2) => { + state.doc.nodesBetween(from2, to, (node3, pos) => { if (nodeType && nodeType === node3.type) { - trimmedFrom = Math.max(pos2, from2); - trimmedTo = Math.min(pos2 + node3.nodeSize, to); - lastPos = pos2; + trimmedFrom = Math.max(pos, from2); + trimmedTo = Math.min(pos + node3.nodeSize, to); + lastPos = pos; lastNode = node3; } }); } else { - state.doc.nodesBetween(from2, to, (node3, pos2) => { - if (pos2 < from2 && nodeType && nodeType === node3.type) { - trimmedFrom = Math.max(pos2, from2); - trimmedTo = Math.min(pos2 + node3.nodeSize, to); - lastPos = pos2; + state.doc.nodesBetween(from2, to, (node3, pos) => { + if (pos < from2 && nodeType && nodeType === node3.type) { + trimmedFrom = Math.max(pos, from2); + trimmedTo = Math.min(pos + node3.nodeSize, to); + lastPos = pos; lastNode = node3; } - if (pos2 >= from2 && pos2 <= to) { + if (pos >= from2 && pos <= to) { if (nodeType && nodeType === node3.type) { - tr2.setNodeMarkup(pos2, void 0, { + tr2.setNodeMarkup(pos, void 0, { ...node3.attrs, ...attributes }); @@ -176432,8 +177737,8 @@ const updateAttributes = /* @__PURE__ */ __name((typeOrName, attributes = {}) => if (markType && node3.marks.length) { node3.marks.forEach((mark2) => { if (markType === mark2.type) { - const trimmedFrom2 = Math.max(pos2, from2); - const trimmedTo2 = Math.min(pos2 + node3.nodeSize, to); + const trimmedFrom2 = Math.max(pos, from2); + const trimmedTo2 = Math.min(pos + node3.nodeSize, to); tr2.addMark(trimmedFrom2, trimmedTo2, markType.create({ ...mark2.attrs, ...attributes @@ -176612,11 +177917,11 @@ const Keymap = Extension.create({ () => commands2.command(({ tr: tr2 }) => { const { selection, doc: doc2 } = tr2; const { empty: empty3, $anchor } = selection; - const { pos: pos2, parent } = $anchor; - const $parentPos = $anchor.parent.isTextblock && pos2 > 0 ? tr2.doc.resolve(pos2 - 1) : $anchor; + const { pos, parent } = $anchor; + const $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr2.doc.resolve(pos - 1) : $anchor; const parentIsIsolating = $parentPos.parent.type.spec.isolating; const parentPos = $anchor.pos - $anchor.parentOffset; - const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc2).from === pos2; + const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc2).from === pos; if (!empty3 || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === "paragraph") { return false; } @@ -176762,11 +178067,11 @@ class NodePos { get name() { return this.node.type.name; } - constructor(pos2, editor, isBlock = false, node3 = null) { + constructor(pos, editor, isBlock = false, node3 = null) { this.currentNode = null; this.actualDepth = null; this.isBlock = isBlock; - this.resolvedPos = pos2; + this.resolvedPos = pos; this.editor = editor; this.currentNode = node3; } @@ -177452,8 +178757,8 @@ class Editor extends EventEmitter { var _a2; return ((_a2 = this.$doc) === null || _a2 === void 0 ? void 0 : _a2.querySelectorAll(selector, attributes)) || null; } - $pos(pos2) { - const $pos = this.state.doc.resolve(pos2); + $pos(pos) { + const $pos = this.state.doc.resolve(pos); return new NodePos($pos, this); } get $doc() { @@ -177713,11 +179018,11 @@ class NodeView { y2 = handleBox.y - domBox.y + offsetY; } (_g = event.dataTransfer) === null || _g === void 0 ? void 0 : _g.setDragImage(this.dom, x2, y2); - const pos2 = this.getPos(); - if (typeof pos2 !== "number") { + const pos = this.getPos(); + if (typeof pos !== "number") { return; } - const selection = NodeSelection.create(view.state.doc, pos2); + const selection = NodeSelection.create(view.state.doc, pos); const transaction = view.state.tr.setSelection(selection); view.dispatch(transaction); } @@ -177816,11 +179121,11 @@ class NodeView { */ updateAttributes(attributes) { this.editor.commands.command(({ tr: tr2 }) => { - const pos2 = this.getPos(); - if (typeof pos2 !== "number") { + const pos = this.getPos(); + if (typeof pos !== "number") { return false; } - tr2.setNodeMarkup(pos2, void 0, { + tr2.setNodeMarkup(pos, void 0, { ...this.node.attrs, ...attributes }); @@ -179268,7 +180573,7 @@ function clickHandler(options4) { return new Plugin({ key: new PluginKey("handleClickLink"), props: { - handleClick: /* @__PURE__ */ __name((view, pos2, event) => { + handleClick: /* @__PURE__ */ __name((view, pos, event) => { var _a2, _b; if (event.button !== 0) { return false; @@ -179578,10 +180883,10 @@ var TableMap = class { this.problems = problems; } // Find the dimensions of the cell at the given position. - findCell(pos2) { + findCell(pos) { for (let i2 = 0; i2 < this.map.length; i2++) { const curPos = this.map[i2]; - if (curPos != pos2) + if (curPos != pos) continue; const left = i2 % this.width; const top = i2 / this.width | 0; @@ -179595,21 +180900,21 @@ var TableMap = class { } return { left, top, right, bottom }; } - throw new RangeError(`No cell with offset ${pos2} found`); + throw new RangeError(`No cell with offset ${pos} found`); } // Find the left side of the cell at the given position. - colCount(pos2) { + colCount(pos) { for (let i2 = 0; i2 < this.map.length; i2++) { - if (this.map[i2] == pos2) { + if (this.map[i2] == pos) { return i2 % this.width; } } - throw new RangeError(`No cell with offset ${pos2} found`); + throw new RangeError(`No cell with offset ${pos} found`); } // Find the next cell in the given direction, starting from the cell // at `pos`, if any. - nextCell(pos2, axis, dir) { - const { left, right, top, bottom } = this.findCell(pos2); + nextCell(pos, axis, dir) { + const { left, right, top, bottom } = this.findCell(pos); if (axis == "horiz") { if (dir < 0 ? left == 0 : right == this.width) return null; @@ -179649,14 +180954,14 @@ var TableMap = class { for (let row = rect.top; row < rect.bottom; row++) { for (let col = rect.left; col < rect.right; col++) { const index2 = row * this.width + col; - const pos2 = this.map[index2]; - if (seen2[pos2]) + const pos = this.map[index2]; + if (seen2[pos]) continue; - seen2[pos2] = true; - if (col == rect.left && col && this.map[index2 - 1] == pos2 || row == rect.top && row && this.map[index2 - this.width] == pos2) { + seen2[pos] = true; + if (col == rect.left && col && this.map[index2 - 1] == pos || row == rect.top && row && this.map[index2 - this.width] == pos) { continue; } - result.push(pos2); + result.push(pos); } } return result; @@ -179691,9 +180996,9 @@ function computeMap(table2) { const colWidths = []; for (let i2 = 0, e2 = width2 * height; i2 < e2; i2++) map3[i2] = 0; - for (let row = 0, pos2 = 0; row < height; row++) { + for (let row = 0, pos = 0; row < height; row++) { const rowNode = table2.child(row); - pos2++; + pos++; for (let i2 = 0; ; i2++) { while (mapPos < map3.length && map3[mapPos] != 0) mapPos++; @@ -179705,7 +181010,7 @@ function computeMap(table2) { if (h2 + row >= height) { (problems || (problems = [])).push({ type: "overlong_rowspan", - pos: pos2, + pos, n: rowspan - h2 }); break; @@ -179713,12 +181018,12 @@ function computeMap(table2) { const start2 = mapPos + h2 * width2; for (let w2 = 0; w2 < colspan; w2++) { if (map3[start2 + w2] == 0) - map3[start2 + w2] = pos2; + map3[start2 + w2] = pos; else (problems || (problems = [])).push({ type: "collision", row, - pos: pos2, + pos, n: colspan - w2 }); const colW = colwidth && colwidth[w2]; @@ -179734,7 +181039,7 @@ function computeMap(table2) { } } mapPos += colspan; - pos2 += cellNode.nodeSize; + pos += cellNode.nodeSize; } const expectedPos = (row + 1) * width2; let missing = 0; @@ -179743,7 +181048,7 @@ function computeMap(table2) { missing++; if (missing) (problems || (problems = [])).push({ type: "missing", row, n: missing }); - pos2++; + pos++; } const tableMap = new TableMap(width2, height, map3, problems); let badWidths = false; @@ -179789,13 +181094,13 @@ function findBadColWidths(map3, colWidths, table2) { map3.problems = []; const seen2 = {}; for (let i2 = 0; i2 < map3.map.length; i2++) { - const pos2 = map3.map[i2]; - if (seen2[pos2]) + const pos = map3.map[i2]; + if (seen2[pos]) continue; - seen2[pos2] = true; - const node3 = table2.nodeAt(pos2); + seen2[pos] = true; + const node3 = table2.nodeAt(pos); if (!node3) { - throw new RangeError(`No cell with offset ${pos2} found`); + throw new RangeError(`No cell with offset ${pos} found`); } let updated15 = null; const attrs6 = node3.attrs; @@ -179808,7 +181113,7 @@ function findBadColWidths(map3, colWidths, table2) { if (updated15) map3.problems.unshift({ type: "colwidth mismatch", - pos: pos2, + pos, colwidth: updated15 }); } @@ -179969,15 +181274,15 @@ function selectionCell(state) { } __name(selectionCell, "selectionCell"); function cellNear($pos) { - for (let after = $pos.nodeAfter, pos2 = $pos.pos; after; after = after.firstChild, pos2++) { + for (let after = $pos.nodeAfter, pos = $pos.pos; after; after = after.firstChild, pos++) { const role = after.type.spec.tableRole; if (role == "cell" || role == "header_cell") - return $pos.doc.resolve(pos2); + return $pos.doc.resolve(pos); } - for (let before = $pos.nodeBefore, pos2 = $pos.pos; before; before = before.lastChild, pos2--) { + for (let before = $pos.nodeBefore, pos = $pos.pos; before; before = before.lastChild, pos--) { const role = before.type.spec.tableRole; if (role == "cell" || role == "header_cell") - return $pos.doc.resolve(pos2 - before.nodeSize); + return $pos.doc.resolve(pos - before.nodeSize); } } __name(cellNear, "cellNear"); @@ -180009,23 +181314,23 @@ function nextCell($pos, axis, dir) { return moved == null ? null : $pos.node(0).resolve(tableStart + moved); } __name(nextCell, "nextCell"); -function removeColSpan(attrs6, pos2, n2 = 1) { +function removeColSpan(attrs6, pos, n2 = 1) { const result = { ...attrs6, colspan: attrs6.colspan - n2 }; if (result.colwidth) { result.colwidth = result.colwidth.slice(); - result.colwidth.splice(pos2, n2); + result.colwidth.splice(pos, n2); if (!result.colwidth.some((w2) => w2 > 0)) result.colwidth = null; } return result; } __name(removeColSpan, "removeColSpan"); -function addColSpan(attrs6, pos2, n2 = 1) { +function addColSpan(attrs6, pos, n2 = 1) { const result = { ...attrs6, colspan: attrs6.colspan + n2 }; if (result.colwidth) { result.colwidth = result.colwidth.slice(); for (let i2 = 0; i2 < n2; i2++) - result.colwidth.splice(pos2, 0, 0); + result.colwidth.splice(pos, 0, 0); } return result; } @@ -180057,12 +181362,12 @@ var CellSelection = class _CellSelection extends Selection { const doc2 = $anchorCell.node(0); const cells = map3.cellsInRect(rect).filter((p2) => p2 != $headCell.pos - tableStart); cells.unshift($headCell.pos - tableStart); - const ranges = cells.map((pos2) => { - const cell = table2.nodeAt(pos2); + const ranges = cells.map((pos) => { + const cell = table2.nodeAt(pos); if (!cell) { - throw RangeError(`No cell with offset ${pos2} found`); + throw RangeError(`No cell with offset ${pos} found`); } - const from2 = tableStart + pos2 + 1; + const from2 = tableStart + pos + 1; return new SelectionRange( doc2.resolve(from2), doc2.resolve(from2 + cell.content.size) @@ -180101,14 +181406,14 @@ var CellSelection = class _CellSelection extends Selection { for (let row = rect.top; row < rect.bottom; row++) { const rowContent = []; for (let index2 = row * map3.width + rect.left, col = rect.left; col < rect.right; col++, index2++) { - const pos2 = map3.map[index2]; - if (seen2[pos2]) + const pos = map3.map[index2]; + if (seen2[pos]) continue; - seen2[pos2] = true; - const cellRect = map3.findCell(pos2); - let cell = table2.nodeAt(pos2); + seen2[pos] = true; + const cellRect = map3.findCell(pos); + let cell = table2.nodeAt(pos); if (!cell) { - throw RangeError(`No cell with offset ${pos2} found`); + throw RangeError(`No cell with offset ${pos} found`); } const extraLeft = rect.left - cellRect.left; const extraRight = cellRect.right - rect.right; @@ -180311,9 +181616,9 @@ function drawCellSelection(state) { if (!(state.selection instanceof CellSelection)) return null; const cells = []; - state.selection.forEachCell((node3, pos2) => { + state.selection.forEachCell((node3, pos) => { cells.push( - Decoration.node(pos2, pos2 + node3.nodeSize, { class: "selectedCell" }) + Decoration.node(pos, pos + node3.nodeSize, { class: "selectedCell" }) ); }); return DecorationSet.create(state.doc, cells); @@ -180405,9 +181710,9 @@ function changedDescendants(old, cur, offset, f2) { __name(changedDescendants, "changedDescendants"); function fixTables(state, oldState) { let tr2; - const check = /* @__PURE__ */ __name((node3, pos2) => { + const check = /* @__PURE__ */ __name((node3, pos) => { if (node3.type.spec.tableRole == "table") - tr2 = fixTable(state, node3, pos2, tr2); + tr2 = fixTable(state, node3, pos, tr2); }, "check"); if (!oldState) state.doc.descendants(check); @@ -180466,9 +181771,9 @@ function fixTable(state, table2, tablePos, tr2) { first2 = i2; last = i2; } - for (let i2 = 0, pos2 = tablePos + 1; i2 < map3.height; i2++) { + for (let i2 = 0, pos = tablePos + 1; i2 < map3.height; i2++) { const row = table2.child(i2); - const end = pos2 + row.nodeSize; + const end = pos + row.nodeSize; const add3 = mustAdd[i2]; if (add3 > 0) { let role = "cell"; @@ -180481,10 +181786,10 @@ function fixTable(state, table2, tablePos, tr2) { if (node3) nodes.push(node3); } - const side = (i2 == 0 || first2 == i2 - 1) && last == i2 ? pos2 + 1 : end - 1; + const side = (i2 == 0 || first2 == i2 - 1) && last == i2 ? pos + 1 : end - 1; tr2.insert(tr2.mapping.map(side), nodes); } - pos2 = end; + pos = end; } return tr2.setMeta(fixTablesKey, { fixTables: true }); } @@ -180510,18 +181815,18 @@ function addColumn(tr2, { map: map3, tableStart, table: table2 }, col) { for (let row = 0; row < map3.height; row++) { const index2 = row * map3.width + col; if (col > 0 && col < map3.width && map3.map[index2 - 1] == map3.map[index2]) { - const pos2 = map3.map[index2]; - const cell = table2.nodeAt(pos2); + const pos = map3.map[index2]; + const cell = table2.nodeAt(pos); tr2.setNodeMarkup( - tr2.mapping.map(tableStart + pos2), + tr2.mapping.map(tableStart + pos), null, - addColSpan(cell.attrs, col - map3.colCount(pos2)) + addColSpan(cell.attrs, col - map3.colCount(pos)) ); row += cell.attrs.rowspan - 1; } else { const type = refColumn == null ? tableNodeTypes(table2.type.schema).cell : table2.nodeAt(map3.map[index2 + refColumn]).type; - const pos2 = map3.positionAt(row, col, table2); - tr2.insert(tr2.mapping.map(tableStart + pos2), type.createAndFill()); + const pos = map3.positionAt(row, col, table2); + tr2.insert(tr2.mapping.map(tableStart + pos), type.createAndFill()); } } return tr2; @@ -180551,17 +181856,17 @@ function removeColumn(tr2, { map: map3, table: table2, tableStart }, col) { const mapStart = tr2.mapping.maps.length; for (let row = 0; row < map3.height; ) { const index2 = row * map3.width + col; - const pos2 = map3.map[index2]; - const cell = table2.nodeAt(pos2); + const pos = map3.map[index2]; + const cell = table2.nodeAt(pos); const attrs6 = cell.attrs; - if (col > 0 && map3.map[index2 - 1] == pos2 || col < map3.width - 1 && map3.map[index2 + 1] == pos2) { + if (col > 0 && map3.map[index2 - 1] == pos || col < map3.width - 1 && map3.map[index2 + 1] == pos) { tr2.setNodeMarkup( - tr2.mapping.slice(mapStart).map(tableStart + pos2), + tr2.mapping.slice(mapStart).map(tableStart + pos), null, - removeColSpan(attrs6, col - map3.colCount(pos2)) + removeColSpan(attrs6, col - map3.colCount(pos)) ); } else { - const start2 = tr2.mapping.slice(mapStart).map(tableStart + pos2); + const start2 = tr2.mapping.slice(mapStart).map(tableStart + pos); tr2.delete(start2, start2 + cell.nodeSize); } row += attrs6.rowspan; @@ -180612,9 +181917,9 @@ function addRow(tr2, { map: map3, tableStart, table: table2 }, row) { refRow = row == 0 || row == map3.height ? null : 0; for (let col = 0, index2 = map3.width * row; col < map3.width; col++, index2++) { if (row > 0 && row < map3.height && map3.map[index2] == map3.map[index2 - map3.width]) { - const pos2 = map3.map[index2]; - const attrs6 = table2.nodeAt(pos2).attrs; - tr2.setNodeMarkup(tableStart + pos2, null, { + const pos = map3.map[index2]; + const attrs6 = table2.nodeAt(pos).attrs; + tr2.setNodeMarkup(tableStart + pos, null, { ...attrs6, rowspan: attrs6.rowspan + 1 }); @@ -180659,19 +181964,19 @@ function removeRow(tr2, { map: map3, table: table2, tableStart }, row) { tr2.delete(rowPos + tableStart, nextRow + tableStart); const seen2 = /* @__PURE__ */ new Set(); for (let col = 0, index2 = row * map3.width; col < map3.width; col++, index2++) { - const pos2 = map3.map[index2]; - if (seen2.has(pos2)) + const pos = map3.map[index2]; + if (seen2.has(pos)) continue; - seen2.add(pos2); - if (row > 0 && pos2 == map3.map[index2 - map3.width]) { - const attrs6 = table2.nodeAt(pos2).attrs; - tr2.setNodeMarkup(tr2.mapping.slice(mapFrom).map(pos2 + tableStart), null, { + seen2.add(pos); + if (row > 0 && pos == map3.map[index2 - map3.width]) { + const attrs6 = table2.nodeAt(pos).attrs; + tr2.setNodeMarkup(tr2.mapping.slice(mapFrom).map(pos + tableStart), null, { ...attrs6, rowspan: attrs6.rowspan - 1 }); col += attrs6.colspan - 1; - } else if (row < map3.height && pos2 == map3.map[index2 + map3.width]) { - const cell = table2.nodeAt(pos2); + } else if (row < map3.height && pos == map3.map[index2 + map3.width]) { + const cell = table2.nodeAt(pos); const attrs6 = cell.attrs; const copy2 = cell.type.create( { ...attrs6, rowspan: cell.attrs.rowspan - 1 }, @@ -180833,14 +182138,14 @@ function splitCellWithType(getCellType) { ); let lastCell; for (let row = rect.top; row < rect.bottom; row++) { - let pos2 = rect.map.positionAt(row, rect.left, rect.table); + let pos = rect.map.positionAt(row, rect.left, rect.table); if (row == rect.top) - pos2 += cellNode.nodeSize; + pos += cellNode.nodeSize; for (let col = rect.left, i2 = 0; col < rect.right; col++, i2++) { if (col == rect.left && row == rect.top) continue; tr2.insert( - lastCell = tr2.mapping.map(pos2 + rect.tableStart, 1), + lastCell = tr2.mapping.map(pos + rect.tableStart, 1), getCellType({ node: cellNode, row, col }).createAndFill(attrs6[i2]) ); } @@ -180873,9 +182178,9 @@ function setCellAttr(name2, value4) { if (dispatch) { const tr2 = state.tr; if (state.selection instanceof CellSelection) - state.selection.forEachCell((node3, pos2) => { + state.selection.forEachCell((node3, pos) => { if (node3.attrs[name2] !== value4) - tr2.setNodeMarkup(pos2, null, { + tr2.setNodeMarkup(pos, null, { ...node3.attrs, [name2]: value4 }); @@ -180911,7 +182216,7 @@ function deprecated_toggleHeader(type) { bottom: rect.bottom } : rect ); - const nodes = cells.map((pos2) => rect.table.nodeAt(pos2)); + const nodes = cells.map((pos) => rect.table.nodeAt(pos)); for (let i2 = 0; i2 < cells.length; i2++) if (nodes[i2].type == types.header_cell) tr2.setNodeMarkup( @@ -181067,11 +182372,11 @@ function deleteCellSelection(state, dispatch) { if (dispatch) { const tr2 = state.tr; const baseContent = tableNodeTypes(state.schema).cell.createAndFill().content; - sel.forEachCell((cell, pos2) => { + sel.forEachCell((cell, pos) => { if (!cell.content.eq(baseContent)) tr2.replace( - tr2.mapping.map(pos2 + 1), - tr2.mapping.map(pos2 + cell.nodeSize - 1), + tr2.mapping.map(pos + 1), + tr2.mapping.map(pos + cell.nodeSize - 1), new Slice(baseContent, 0, 0) ); }); @@ -181244,12 +182549,12 @@ function isolateHorizontal(tr2, map3, table2, start2, left, right, top, mapFrom) return false; let found2 = false; for (let col = left; col < right; col++) { - const index2 = top * map3.width + col, pos2 = map3.map[index2]; - if (map3.map[index2 - map3.width] == pos2) { + const index2 = top * map3.width + col, pos = map3.map[index2]; + if (map3.map[index2 - map3.width] == pos) { found2 = true; - const cell = table2.nodeAt(pos2); - const { top: cellTop, left: cellLeft } = map3.findCell(pos2); - tr2.setNodeMarkup(tr2.mapping.slice(mapFrom).map(pos2 + start2), null, { + const cell = table2.nodeAt(pos); + const { top: cellTop, left: cellLeft } = map3.findCell(pos); + tr2.setNodeMarkup(tr2.mapping.slice(mapFrom).map(pos + start2), null, { ...cell.attrs, rowspan: top - cellTop }); @@ -181271,12 +182576,12 @@ function isolateVertical(tr2, map3, table2, start2, top, bottom, left, mapFrom) return false; let found2 = false; for (let row = top; row < bottom; row++) { - const index2 = row * map3.width + left, pos2 = map3.map[index2]; - if (map3.map[index2 - 1] == pos2) { + const index2 = row * map3.width + left, pos = map3.map[index2]; + if (map3.map[index2 - 1] == pos) { found2 = true; - const cell = table2.nodeAt(pos2); - const cellLeft = map3.colCount(pos2); - const updatePos = tr2.mapping.slice(mapFrom).map(pos2 + start2); + const cell = table2.nodeAt(pos); + const cellLeft = map3.colCount(pos); + const updatePos = tr2.mapping.slice(mapFrom).map(pos + start2); tr2.setNodeMarkup( updatePos, null, @@ -181430,8 +182735,8 @@ function shiftArrow(axis, dir) { }; } __name(shiftArrow, "shiftArrow"); -function handleTripleClick(view, pos2) { - const doc2 = view.state.doc, $cell = cellAround(doc2.resolve(pos2)); +function handleTripleClick(view, pos) { + const doc2 = view.state.doc, $cell = cellAround(doc2.resolve(pos)); if (!$cell) return false; view.dispatch(view.state.tr.setSelection(new CellSelection($cell))); @@ -181858,8 +183163,8 @@ function edgeCell(view, event, side, handleWidth) { }); if (!found2) return -1; - const { pos: pos2 } = found2; - const $cell = cellAround(view.state.doc.resolve(pos2)); + const { pos } = found2; + const $cell = cellAround(view.state.doc.resolve(pos)); if (!$cell) return -1; if (side == "right") @@ -181889,14 +183194,14 @@ function updateColumnWidth(view, cell, width2) { const mapIndex = row * map3.width + col; if (row && map3.map[mapIndex] == map3.map[mapIndex - map3.width]) continue; - const pos2 = map3.map[mapIndex]; - const attrs6 = table2.nodeAt(pos2).attrs; - const index2 = attrs6.colspan == 1 ? 0 : col - map3.colCount(pos2); + const pos = map3.map[mapIndex]; + const attrs6 = table2.nodeAt(pos).attrs; + const index2 = attrs6.colspan == 1 ? 0 : col - map3.colCount(pos); if (attrs6.colwidth && attrs6.colwidth[index2] == width2) continue; const colwidth = attrs6.colwidth ? attrs6.colwidth.slice() : zeroes(attrs6.colspan); colwidth[index2] = width2; - tr2.setNodeMarkup(start2 + pos2, null, { ...attrs6, colwidth }); + tr2.setNodeMarkup(start2 + pos, null, { ...attrs6, colwidth }); } if (tr2.docChanged) view.dispatch(tr2); @@ -181941,7 +183246,7 @@ function handleDecorations(state, cell) { const index2 = col + row * map3.width; if ((col == map3.width - 1 || map3.map[index2] != map3.map[index2 + 1]) && (row == 0 || map3.map[index2] != map3.map[index2 - map3.width])) { const cellPos = map3.map[index2]; - const pos2 = start2 + cellPos + table2.nodeAt(cellPos).nodeSize - 1; + const pos = start2 + cellPos + table2.nodeAt(cellPos).nodeSize - 1; const dom = document.createElement("div"); dom.className = "column-resize-handle"; if ((_a2 = columnResizingPluginKey.getState(state)) == null ? void 0 : _a2.dragging) { @@ -181955,7 +183260,7 @@ function handleDecorations(state, cell) { ) ); } - decorations.push(Decoration.widget(pos2, dom)); + decorations.push(Decoration.widget(pos, dom)); } } return DecorationSet.create(state.doc, decorations); @@ -181979,8 +183284,8 @@ function tableEditing({ return set3 == -1 ? null : set3; if (cur == null || !tr2.docChanged) return cur; - const { deleted, pos: pos2 } = tr2.mapping.mapResult(cur); - return deleted ? null : pos2; + const { deleted, pos } = tr2.mapping.mapResult(cur); + return deleted ? null : pos; } }, props: { @@ -182906,11 +184211,11 @@ class DropCursorView { this.updateOverlay(); } } - setCursor(pos2) { - if (pos2 == this.cursorPos) + setCursor(pos) { + if (pos == this.cursorPos) return; - this.cursorPos = pos2; - if (pos2 == null) { + this.cursorPos = pos; + if (pos == null) { this.element.parentNode.removeChild(this.element); this.element = null; } else { @@ -182970,12 +184275,12 @@ class DropCursorView { dragover(event) { if (!this.editorView.editable) return; - let pos2 = this.editorView.posAtCoords({ left: event.clientX, top: event.clientY }); - let node3 = pos2 && pos2.inside >= 0 && this.editorView.state.doc.nodeAt(pos2.inside); + let pos = this.editorView.posAtCoords({ left: event.clientX, top: event.clientY }); + let node3 = pos && pos.inside >= 0 && this.editorView.state.doc.nodeAt(pos.inside); let disableDropCursor = node3 && node3.type.spec.disableDropCursor; - let disabled2 = typeof disableDropCursor == "function" ? disableDropCursor(this.editorView, pos2, event) : disableDropCursor; - if (pos2 && !disabled2) { - let target2 = pos2.pos; + let disabled2 = typeof disableDropCursor == "function" ? disableDropCursor(this.editorView, pos, event) : disableDropCursor; + if (pos && !disabled2) { + let target2 = pos.pos; if (this.editorView.dragging && this.editorView.dragging.slice) { let point = dropPoint(this.editorView.state.doc, target2, this.editorView.dragging.slice); if (point != null) @@ -183068,7 +184373,7 @@ class GapCursor extends Selection { search: for (; ; ) { if (!mustMove && GapCursor.valid($pos)) return $pos; - let pos2 = $pos.pos, next2 = null; + let pos = $pos.pos, next2 = null; for (let d2 = $pos.depth; ; d2--) { let parent = $pos.node(d2); if (dir > 0 ? $pos.indexAfter(d2) < parent.childCount : $pos.index(d2) > 0) { @@ -183077,8 +184382,8 @@ class GapCursor extends Selection { } else if (d2 == 0) { return null; } - pos2 += dir; - let $cur = $pos.doc.resolve(pos2); + pos += dir; + let $cur = $pos.doc.resolve(pos); if (GapCursor.valid($cur)) return $cur; } @@ -183086,15 +184391,15 @@ class GapCursor extends Selection { let inside = dir > 0 ? next2.firstChild : next2.lastChild; if (!inside) { if (next2.isAtom && !next2.isText && !NodeSelection.isSelectable(next2)) { - $pos = $pos.doc.resolve(pos2 + next2.nodeSize * dir); + $pos = $pos.doc.resolve(pos + next2.nodeSize * dir); mustMove = false; continue search; } break; } next2 = inside; - pos2 += dir; - let $cur = $pos.doc.resolve(pos2); + pos += dir; + let $cur = $pos.doc.resolve(pos); if (GapCursor.valid($cur)) return $cur; } @@ -183109,8 +184414,8 @@ class GapBookmark { static { __name(this, "GapBookmark"); } - constructor(pos2) { - this.pos = pos2; + constructor(pos) { + this.pos = pos; } map(mapping) { return new GapBookmark(mapping.map(this.pos)); @@ -183196,10 +184501,10 @@ function arrow(axis, dir) { }; } __name(arrow, "arrow"); -function handleClick(view, pos2, event) { +function handleClick(view, pos, event) { if (!view || !view.editable) return false; - let $pos = view.state.doc.resolve(pos2); + let $pos = view.state.doc.resolve(pos); if (!GapCursor.valid($pos)) return false; let clickPos = view.posAtCoords({ left: event.clientX, top: event.clientY }); @@ -183675,14 +184980,14 @@ class Branch { }, start2); let iRebased = rebasedCount; this.items.forEach((item3) => { - let pos2 = mapping.getMirror(--iRebased); - if (pos2 == null) + let pos = mapping.getMirror(--iRebased); + if (pos == null) return; - newUntil = Math.min(newUntil, pos2); - let map3 = mapping.maps[pos2]; + newUntil = Math.min(newUntil, pos); + let map3 = mapping.maps[pos]; if (item3.step) { - let step3 = rebasedTransform.steps[pos2].invert(rebasedTransform.docs[pos2]); - let selection = item3.selection && item3.selection.map(mapping.slice(iRebased + 1, pos2)); + let step3 = rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]); + let selection = item3.selection && item3.selection.map(mapping.slice(iRebased + 1, pos)); if (selection) eventCount++; rebasedItems.push(new Item(map3, step3, selection)); @@ -185393,8 +186698,8 @@ function assign$1(obj) { return obj; } __name(assign$1, "assign$1"); -function arrayReplaceAt(src, pos2, newElements) { - return [].concat(src.slice(0, pos2), newElements, src.slice(pos2 + 1)); +function arrayReplaceAt(src, pos, newElements) { + return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1)); } __name(arrayReplaceAt, "arrayReplaceAt"); function isValidEntityCode(c2) { @@ -185635,16 +186940,16 @@ function parseLinkLabel(state, start2, disableNested) { __name(parseLinkLabel, "parseLinkLabel"); function parseLinkDestination(str, start2, max) { let code2; - let pos2 = start2; + let pos = start2; const result = { ok: false, pos: 0, str: "" }; - if (str.charCodeAt(pos2) === 60) { - pos2++; - while (pos2 < max) { - code2 = str.charCodeAt(pos2); + if (str.charCodeAt(pos) === 60) { + pos++; + while (pos < max) { + code2 = str.charCodeAt(pos); if (code2 === 10) { return result; } @@ -185652,33 +186957,33 @@ function parseLinkDestination(str, start2, max) { return result; } if (code2 === 62) { - result.pos = pos2 + 1; - result.str = unescapeAll(str.slice(start2 + 1, pos2)); + result.pos = pos + 1; + result.str = unescapeAll(str.slice(start2 + 1, pos)); result.ok = true; return result; } - if (code2 === 92 && pos2 + 1 < max) { - pos2 += 2; + if (code2 === 92 && pos + 1 < max) { + pos += 2; continue; } - pos2++; + pos++; } return result; } let level = 0; - while (pos2 < max) { - code2 = str.charCodeAt(pos2); + while (pos < max) { + code2 = str.charCodeAt(pos); if (code2 === 32) { break; } if (code2 < 32 || code2 === 127) { break; } - if (code2 === 92 && pos2 + 1 < max) { - if (str.charCodeAt(pos2 + 1) === 32) { + if (code2 === 92 && pos + 1 < max) { + if (str.charCodeAt(pos + 1) === 32) { break; } - pos2 += 2; + pos += 2; continue; } if (code2 === 40) { @@ -185693,23 +186998,23 @@ function parseLinkDestination(str, start2, max) { } level--; } - pos2++; + pos++; } - if (start2 === pos2) { + if (start2 === pos) { return result; } if (level !== 0) { return result; } - result.str = unescapeAll(str.slice(start2, pos2)); - result.pos = pos2; + result.str = unescapeAll(str.slice(start2, pos)); + result.pos = pos; result.ok = true; return result; } __name(parseLinkDestination, "parseLinkDestination"); function parseLinkTitle(str, start2, max, prev_state) { let code2; - let pos2 = start2; + let pos = start2; const state = { // if `true`, this is a valid link title ok: false, @@ -185726,36 +187031,36 @@ function parseLinkTitle(str, start2, max, prev_state) { state.str = prev_state.str; state.marker = prev_state.marker; } else { - if (pos2 >= max) { + if (pos >= max) { return state; } - let marker = str.charCodeAt(pos2); + let marker = str.charCodeAt(pos); if (marker !== 34 && marker !== 39 && marker !== 40) { return state; } start2++; - pos2++; + pos++; if (marker === 40) { marker = 41; } state.marker = marker; } - while (pos2 < max) { - code2 = str.charCodeAt(pos2); + while (pos < max) { + code2 = str.charCodeAt(pos); if (code2 === state.marker) { - state.pos = pos2 + 1; - state.str += unescapeAll(str.slice(start2, pos2)); + state.pos = pos + 1; + state.str += unescapeAll(str.slice(start2, pos)); state.ok = true; return state; } else if (code2 === 40 && state.marker === 41) { return state; - } else if (code2 === 92 && pos2 + 1 < max) { - pos2++; + } else if (code2 === 92 && pos + 1 < max) { + pos++; } - pos2++; + pos++; } state.can_continue = true; - state.str += unescapeAll(str.slice(start2, pos2)); + state.str += unescapeAll(str.slice(start2, pos)); return state; } __name(parseLinkTitle, "parseLinkTitle"); @@ -186232,10 +187537,10 @@ function linkify$1(state) { } else { urlText = state.md.normalizeLinkText(urlText); } - const pos2 = links[ln].index; - if (pos2 > lastPos) { + const pos = links[ln].index; + if (pos > lastPos) { const token = new state.Token("text", "", 0); - token.content = text2.slice(lastPos, pos2); + token.content = text2.slice(lastPos, pos); token.level = level; nodes.push(token); } @@ -186355,18 +187660,18 @@ function process_inlines(tokens, state) { continue; } let text2 = token.content; - let pos2 = 0; + let pos = 0; let max = text2.length; OUTER: - while (pos2 < max) { - QUOTE_RE.lastIndex = pos2; + while (pos < max) { + QUOTE_RE.lastIndex = pos; const t2 = QUOTE_RE.exec(text2); if (!t2) { break; } let canOpen = true; let canClose = true; - pos2 = t2.index + 1; + pos = t2.index + 1; const isSingle = t2[0] === "'"; let lastChar = 32; if (t2.index - 1 >= 0) { @@ -186380,8 +187685,8 @@ function process_inlines(tokens, state) { } } let nextChar = 32; - if (pos2 < max) { - nextChar = text2.charCodeAt(pos2); + if (pos < max) { + nextChar = text2.charCodeAt(pos); } else { for (j2 = i2 + 1; j2 < tokens.length; j2++) { if (tokens[j2].type === "softbreak" || tokens[j2].type === "hardbreak") break; @@ -186446,9 +187751,9 @@ function process_inlines(tokens, state) { item3.pos, openQuote ); - pos2 += closeQuote.length - 1; + pos += closeQuote.length - 1; if (item3.token === i2) { - pos2 += openQuote.length - 1; + pos += openQuote.length - 1; } text2 = token.content; max = text2.length; @@ -186556,8 +187861,8 @@ function StateBlock(src, md2, env, tokens) { this.parentType = "root"; this.level = 0; const s2 = this.src; - for (let start2 = 0, pos2 = 0, indent = 0, offset = 0, len = s2.length, indent_found = false; pos2 < len; pos2++) { - const ch = s2.charCodeAt(pos2); + for (let start2 = 0, pos = 0, indent = 0, offset = 0, len = s2.length, indent_found = false; pos < len; pos++) { + const ch = s2.charCodeAt(pos); if (!indent_found) { if (isSpace(ch)) { indent++; @@ -186571,19 +187876,19 @@ function StateBlock(src, md2, env, tokens) { indent_found = true; } } - if (ch === 10 || pos2 === len - 1) { + if (ch === 10 || pos === len - 1) { if (ch !== 10) { - pos2++; + pos++; } this.bMarks.push(start2); - this.eMarks.push(pos2); + this.eMarks.push(pos); this.tShift.push(indent); this.sCount.push(offset); this.bsCount.push(0); indent_found = false; indent = 0; offset = 0; - start2 = pos2 + 1; + start2 = pos + 1; } } this.bMarks.push(s2.length); @@ -186614,44 +187919,44 @@ StateBlock.prototype.skipEmptyLines = /* @__PURE__ */ __name(function skipEmptyL } return from2; }, "skipEmptyLines"); -StateBlock.prototype.skipSpaces = /* @__PURE__ */ __name(function skipSpaces(pos2) { - for (let max = this.src.length; pos2 < max; pos2++) { - const ch = this.src.charCodeAt(pos2); +StateBlock.prototype.skipSpaces = /* @__PURE__ */ __name(function skipSpaces(pos) { + for (let max = this.src.length; pos < max; pos++) { + const ch = this.src.charCodeAt(pos); if (!isSpace(ch)) { break; } } - return pos2; + return pos; }, "skipSpaces"); -StateBlock.prototype.skipSpacesBack = /* @__PURE__ */ __name(function skipSpacesBack(pos2, min) { - if (pos2 <= min) { - return pos2; +StateBlock.prototype.skipSpacesBack = /* @__PURE__ */ __name(function skipSpacesBack(pos, min) { + if (pos <= min) { + return pos; } - while (pos2 > min) { - if (!isSpace(this.src.charCodeAt(--pos2))) { - return pos2 + 1; + while (pos > min) { + if (!isSpace(this.src.charCodeAt(--pos))) { + return pos + 1; } } - return pos2; + return pos; }, "skipSpacesBack"); -StateBlock.prototype.skipChars = /* @__PURE__ */ __name(function skipChars(pos2, code2) { - for (let max = this.src.length; pos2 < max; pos2++) { - if (this.src.charCodeAt(pos2) !== code2) { +StateBlock.prototype.skipChars = /* @__PURE__ */ __name(function skipChars(pos, code2) { + for (let max = this.src.length; pos < max; pos++) { + if (this.src.charCodeAt(pos) !== code2) { break; } } - return pos2; + return pos; }, "skipChars"); -StateBlock.prototype.skipCharsBack = /* @__PURE__ */ __name(function skipCharsBack(pos2, code2, min) { - if (pos2 <= min) { - return pos2; +StateBlock.prototype.skipCharsBack = /* @__PURE__ */ __name(function skipCharsBack(pos, code2, min) { + if (pos <= min) { + return pos; } - while (pos2 > min) { - if (code2 !== this.src.charCodeAt(--pos2)) { - return pos2 + 1; + while (pos > min) { + if (code2 !== this.src.charCodeAt(--pos)) { + return pos + 1; } } - return pos2; + return pos; }, "skipCharsBack"); StateBlock.prototype.getLines = /* @__PURE__ */ __name(function getLines(begin, end, indent, keepLastLF) { if (begin >= end) { @@ -186694,33 +187999,33 @@ StateBlock.prototype.getLines = /* @__PURE__ */ __name(function getLines(begin, StateBlock.prototype.Token = Token; const MAX_AUTOCOMPLETED_CELLS = 65536; function getLine(state, line) { - const pos2 = state.bMarks[line] + state.tShift[line]; + const pos = state.bMarks[line] + state.tShift[line]; const max = state.eMarks[line]; - return state.src.slice(pos2, max); + return state.src.slice(pos, max); } __name(getLine, "getLine"); function escapedSplit(str) { const result = []; const max = str.length; - let pos2 = 0; - let ch = str.charCodeAt(pos2); + let pos = 0; + let ch = str.charCodeAt(pos); let isEscaped = false; let lastPos = 0; let current = ""; - while (pos2 < max) { + while (pos < max) { if (ch === 124) { if (!isEscaped) { - result.push(current + str.substring(lastPos, pos2)); + result.push(current + str.substring(lastPos, pos)); current = ""; - lastPos = pos2 + 1; + lastPos = pos + 1; } else { - current += str.substring(lastPos, pos2 - 1); - lastPos = pos2; + current += str.substring(lastPos, pos - 1); + lastPos = pos; } } isEscaped = ch === 92; - pos2++; - ch = str.charCodeAt(pos2); + pos++; + ch = str.charCodeAt(pos); } result.push(current + str.substring(lastPos)); return result; @@ -186737,30 +188042,30 @@ function table(state, startLine, endLine, silent) { if (state.sCount[nextLine] - state.blkIndent >= 4) { return false; } - let pos2 = state.bMarks[nextLine] + state.tShift[nextLine]; - if (pos2 >= state.eMarks[nextLine]) { + let pos = state.bMarks[nextLine] + state.tShift[nextLine]; + if (pos >= state.eMarks[nextLine]) { return false; } - const firstCh = state.src.charCodeAt(pos2++); + const firstCh = state.src.charCodeAt(pos++); if (firstCh !== 124 && firstCh !== 45 && firstCh !== 58) { return false; } - if (pos2 >= state.eMarks[nextLine]) { + if (pos >= state.eMarks[nextLine]) { return false; } - const secondCh = state.src.charCodeAt(pos2++); + const secondCh = state.src.charCodeAt(pos++); if (secondCh !== 124 && secondCh !== 45 && secondCh !== 58 && !isSpace(secondCh)) { return false; } if (firstCh === 45 && isSpace(secondCh)) { return false; } - while (pos2 < state.eMarks[nextLine]) { - const ch = state.src.charCodeAt(pos2); + while (pos < state.eMarks[nextLine]) { + const ch = state.src.charCodeAt(pos); if (ch !== 124 && ch !== 45 && ch !== 58 && !isSpace(ch)) { return false; } - pos2++; + pos++; } let lineText = getLine(state, startLine + 1); let columns = lineText.split("|"); @@ -186909,26 +188214,26 @@ function code(state, startLine, endLine) { } __name(code, "code"); function fence(state, startLine, endLine, silent) { - let pos2 = state.bMarks[startLine] + state.tShift[startLine]; + let pos = state.bMarks[startLine] + state.tShift[startLine]; let max = state.eMarks[startLine]; if (state.sCount[startLine] - state.blkIndent >= 4) { return false; } - if (pos2 + 3 > max) { + if (pos + 3 > max) { return false; } - const marker = state.src.charCodeAt(pos2); + const marker = state.src.charCodeAt(pos); if (marker !== 126 && marker !== 96) { return false; } - let mem = pos2; - pos2 = state.skipChars(pos2, marker); - let len = pos2 - mem; + let mem = pos; + pos = state.skipChars(pos, marker); + let len = pos - mem; if (len < 3) { return false; } - const markup = state.src.slice(mem, pos2); - const params = state.src.slice(pos2, max); + const markup = state.src.slice(mem, pos); + const params = state.src.slice(pos, max); if (marker === 96) { if (params.indexOf(String.fromCharCode(marker)) >= 0) { return false; @@ -186944,23 +188249,23 @@ function fence(state, startLine, endLine, silent) { if (nextLine >= endLine) { break; } - pos2 = mem = state.bMarks[nextLine] + state.tShift[nextLine]; + pos = mem = state.bMarks[nextLine] + state.tShift[nextLine]; max = state.eMarks[nextLine]; - if (pos2 < max && state.sCount[nextLine] < state.blkIndent) { + if (pos < max && state.sCount[nextLine] < state.blkIndent) { break; } - if (state.src.charCodeAt(pos2) !== marker) { + if (state.src.charCodeAt(pos) !== marker) { continue; } if (state.sCount[nextLine] - state.blkIndent >= 4) { continue; } - pos2 = state.skipChars(pos2, marker); - if (pos2 - mem < len) { + pos = state.skipChars(pos, marker); + if (pos - mem < len) { continue; } - pos2 = state.skipSpaces(pos2); - if (pos2 < max) { + pos = state.skipSpaces(pos); + if (pos < max) { continue; } haveEndMarker = true; @@ -186977,13 +188282,13 @@ function fence(state, startLine, endLine, silent) { } __name(fence, "fence"); function blockquote(state, startLine, endLine, silent) { - let pos2 = state.bMarks[startLine] + state.tShift[startLine]; + let pos = state.bMarks[startLine] + state.tShift[startLine]; let max = state.eMarks[startLine]; const oldLineMax = state.lineMax; if (state.sCount[startLine] - state.blkIndent >= 4) { return false; } - if (state.src.charCodeAt(pos2) !== 62) { + if (state.src.charCodeAt(pos) !== 62) { return false; } if (silent) { @@ -187000,24 +188305,24 @@ function blockquote(state, startLine, endLine, silent) { let nextLine; for (nextLine = startLine; nextLine < endLine; nextLine++) { const isOutdented = state.sCount[nextLine] < state.blkIndent; - pos2 = state.bMarks[nextLine] + state.tShift[nextLine]; + pos = state.bMarks[nextLine] + state.tShift[nextLine]; max = state.eMarks[nextLine]; - if (pos2 >= max) { + if (pos >= max) { break; } - if (state.src.charCodeAt(pos2++) === 62 && !isOutdented) { + if (state.src.charCodeAt(pos++) === 62 && !isOutdented) { let initial = state.sCount[nextLine] + 1; let spaceAfterMarker; let adjustTab; - if (state.src.charCodeAt(pos2) === 32) { - pos2++; + if (state.src.charCodeAt(pos) === 32) { + pos++; initial++; adjustTab = false; spaceAfterMarker = true; - } else if (state.src.charCodeAt(pos2) === 9) { + } else if (state.src.charCodeAt(pos) === 9) { spaceAfterMarker = true; if ((state.bsCount[nextLine] + initial) % 4 === 3) { - pos2++; + pos++; initial++; adjustTab = false; } else { @@ -187028,9 +188333,9 @@ function blockquote(state, startLine, endLine, silent) { } let offset = initial; oldBMarks.push(state.bMarks[nextLine]); - state.bMarks[nextLine] = pos2; - while (pos2 < max) { - const ch = state.src.charCodeAt(pos2); + state.bMarks[nextLine] = pos; + while (pos < max) { + const ch = state.src.charCodeAt(pos); if (isSpace(ch)) { if (ch === 9) { offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4; @@ -187040,15 +188345,15 @@ function blockquote(state, startLine, endLine, silent) { } else { break; } - pos2++; + pos++; } - lastLineEmpty = pos2 >= max; + lastLineEmpty = pos >= max; oldBSCount.push(state.bsCount[nextLine]); state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0); oldSCount.push(state.sCount[nextLine]); state.sCount[nextLine] = offset - initial; oldTShift.push(state.tShift[nextLine]); - state.tShift[nextLine] = pos2 - state.bMarks[nextLine]; + state.tShift[nextLine] = pos - state.bMarks[nextLine]; continue; } if (lastLineEmpty) { @@ -187105,14 +188410,14 @@ function hr(state, startLine, endLine, silent) { if (state.sCount[startLine] - state.blkIndent >= 4) { return false; } - let pos2 = state.bMarks[startLine] + state.tShift[startLine]; - const marker = state.src.charCodeAt(pos2++); + let pos = state.bMarks[startLine] + state.tShift[startLine]; + const marker = state.src.charCodeAt(pos++); if (marker !== 42 && marker !== 45 && marker !== 95) { return false; } let cnt = 1; - while (pos2 < max) { - const ch = state.src.charCodeAt(pos2++); + while (pos < max) { + const ch = state.src.charCodeAt(pos++); if (ch !== marker && !isSpace(ch)) { return false; } @@ -187135,38 +188440,38 @@ function hr(state, startLine, endLine, silent) { __name(hr, "hr"); function skipBulletListMarker(state, startLine) { const max = state.eMarks[startLine]; - let pos2 = state.bMarks[startLine] + state.tShift[startLine]; - const marker = state.src.charCodeAt(pos2++); + let pos = state.bMarks[startLine] + state.tShift[startLine]; + const marker = state.src.charCodeAt(pos++); if (marker !== 42 && marker !== 45 && marker !== 43) { return -1; } - if (pos2 < max) { - const ch = state.src.charCodeAt(pos2); + if (pos < max) { + const ch = state.src.charCodeAt(pos); if (!isSpace(ch)) { return -1; } } - return pos2; + return pos; } __name(skipBulletListMarker, "skipBulletListMarker"); function skipOrderedListMarker(state, startLine) { const start2 = state.bMarks[startLine] + state.tShift[startLine]; const max = state.eMarks[startLine]; - let pos2 = start2; - if (pos2 + 1 >= max) { + let pos = start2; + if (pos + 1 >= max) { return -1; } - let ch = state.src.charCodeAt(pos2++); + let ch = state.src.charCodeAt(pos++); if (ch < 48 || ch > 57) { return -1; } for (; ; ) { - if (pos2 >= max) { + if (pos >= max) { return -1; } - ch = state.src.charCodeAt(pos2++); + ch = state.src.charCodeAt(pos++); if (ch >= 48 && ch <= 57) { - if (pos2 - start2 >= 10) { + if (pos - start2 >= 10) { return -1; } continue; @@ -187176,13 +188481,13 @@ function skipOrderedListMarker(state, startLine) { } return -1; } - if (pos2 < max) { - ch = state.src.charCodeAt(pos2); + if (pos < max) { + ch = state.src.charCodeAt(pos); if (!isSpace(ch)) { return -1; } } - return pos2; + return pos; } __name(skipOrderedListMarker, "skipOrderedListMarker"); function markTightParagraphs(state, idx) { @@ -187197,7 +188502,7 @@ function markTightParagraphs(state, idx) { } __name(markTightParagraphs, "markTightParagraphs"); function list(state, startLine, endLine, silent) { - let max, pos2, start2, token; + let max, pos, start2, token; let nextLine = startLine; let tight = true; if (state.sCount[nextLine] - state.blkIndent >= 4) { @@ -187249,12 +188554,12 @@ function list(state, startLine, endLine, silent) { const oldParentType = state.parentType; state.parentType = "list"; while (nextLine < endLine) { - pos2 = posAfterMarker; + pos = posAfterMarker; max = state.eMarks[nextLine]; const initial = state.sCount[nextLine] + posAfterMarker - (state.bMarks[nextLine] + state.tShift[nextLine]); let offset = initial; - while (pos2 < max) { - const ch = state.src.charCodeAt(pos2); + while (pos < max) { + const ch = state.src.charCodeAt(pos); if (ch === 9) { offset += 4 - (offset + state.bsCount[nextLine]) % 4; } else if (ch === 32) { @@ -187262,9 +188567,9 @@ function list(state, startLine, endLine, silent) { } else { break; } - pos2++; + pos++; } - const contentStart = pos2; + const contentStart = pos; let indentAfterMarker; if (contentStart >= max) { indentAfterMarker = 1; @@ -187360,13 +188665,13 @@ function list(state, startLine, endLine, silent) { } __name(list, "list"); function reference(state, startLine, _endLine, silent) { - let pos2 = state.bMarks[startLine] + state.tShift[startLine]; + let pos = state.bMarks[startLine] + state.tShift[startLine]; let max = state.eMarks[startLine]; let nextLine = startLine + 1; if (state.sCount[startLine] - state.blkIndent >= 4) { return false; } - if (state.src.charCodeAt(pos2) !== 91) { + if (state.src.charCodeAt(pos) !== 91) { return false; } function getNextLine(nextLine2) { @@ -187397,20 +188702,20 @@ function reference(state, startLine, _endLine, silent) { return null; } } - const pos3 = state.bMarks[nextLine2] + state.tShift[nextLine2]; + const pos2 = state.bMarks[nextLine2] + state.tShift[nextLine2]; const max2 = state.eMarks[nextLine2]; - return state.src.slice(pos3, max2 + 1); + return state.src.slice(pos2, max2 + 1); } __name(getNextLine, "getNextLine"); - let str = state.src.slice(pos2, max + 1); + let str = state.src.slice(pos, max + 1); max = str.length; let labelEnd = -1; - for (pos2 = 1; pos2 < max; pos2++) { - const ch = str.charCodeAt(pos2); + for (pos = 1; pos < max; pos++) { + const ch = str.charCodeAt(pos); if (ch === 91) { return false; } else if (ch === 93) { - labelEnd = pos2; + labelEnd = pos; break; } else if (ch === 10) { const lineContent = getNextLine(nextLine); @@ -187420,8 +188725,8 @@ function reference(state, startLine, _endLine, silent) { nextLine++; } } else if (ch === 92) { - pos2++; - if (pos2 < max && str.charCodeAt(pos2) === 10) { + pos++; + if (pos < max && str.charCodeAt(pos) === 10) { const lineContent = getNextLine(nextLine); if (lineContent !== null) { str += lineContent; @@ -187434,8 +188739,8 @@ function reference(state, startLine, _endLine, silent) { if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 58) { return false; } - for (pos2 = labelEnd + 2; pos2 < max; pos2++) { - const ch = str.charCodeAt(pos2); + for (pos = labelEnd + 2; pos < max; pos++) { + const ch = str.charCodeAt(pos); if (ch === 10) { const lineContent = getNextLine(nextLine); if (lineContent !== null) { @@ -187448,7 +188753,7 @@ function reference(state, startLine, _endLine, silent) { break; } } - const destRes = state.md.helpers.parseLinkDestination(str, pos2, max); + const destRes = state.md.helpers.parseLinkDestination(str, pos, max); if (!destRes.ok) { return false; } @@ -187456,12 +188761,12 @@ function reference(state, startLine, _endLine, silent) { if (!state.md.validateLink(href)) { return false; } - pos2 = destRes.pos; - const destEndPos = pos2; + pos = destRes.pos; + const destEndPos = pos; const destEndLineNo = nextLine; - const start2 = pos2; - for (; pos2 < max; pos2++) { - const ch = str.charCodeAt(pos2); + const start2 = pos; + for (; pos < max; pos++) { + const ch = str.charCodeAt(pos); if (ch === 10) { const lineContent = getNextLine(nextLine); if (lineContent !== null) { @@ -187474,47 +188779,47 @@ function reference(state, startLine, _endLine, silent) { break; } } - let titleRes = state.md.helpers.parseLinkTitle(str, pos2, max); + let titleRes = state.md.helpers.parseLinkTitle(str, pos, max); while (titleRes.can_continue) { const lineContent = getNextLine(nextLine); if (lineContent === null) break; str += lineContent; - pos2 = max; + pos = max; max = str.length; nextLine++; - titleRes = state.md.helpers.parseLinkTitle(str, pos2, max, titleRes); + titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes); } let title; - if (pos2 < max && start2 !== pos2 && titleRes.ok) { + if (pos < max && start2 !== pos && titleRes.ok) { title = titleRes.str; - pos2 = titleRes.pos; + pos = titleRes.pos; } else { title = ""; - pos2 = destEndPos; + pos = destEndPos; nextLine = destEndLineNo; } - while (pos2 < max) { - const ch = str.charCodeAt(pos2); + while (pos < max) { + const ch = str.charCodeAt(pos); if (!isSpace(ch)) { break; } - pos2++; + pos++; } - if (pos2 < max && str.charCodeAt(pos2) !== 10) { + if (pos < max && str.charCodeAt(pos) !== 10) { if (title) { title = ""; - pos2 = destEndPos; + pos = destEndPos; nextLine = destEndLineNo; - while (pos2 < max) { - const ch = str.charCodeAt(pos2); + while (pos < max) { + const ch = str.charCodeAt(pos); if (!isSpace(ch)) { break; } - pos2++; + pos++; } } } - if (pos2 < max && str.charCodeAt(pos2) !== 10) { + if (pos < max && str.charCodeAt(pos) !== 10) { return false; } const label5 = normalizeReference(str.slice(1, labelEnd)); @@ -187622,7 +188927,7 @@ const HTML_SEQUENCES = [ [new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + "\\s*$"), /^$/, false] ]; function html_block(state, startLine, endLine, silent) { - let pos2 = state.bMarks[startLine] + state.tShift[startLine]; + let pos = state.bMarks[startLine] + state.tShift[startLine]; let max = state.eMarks[startLine]; if (state.sCount[startLine] - state.blkIndent >= 4) { return false; @@ -187630,10 +188935,10 @@ function html_block(state, startLine, endLine, silent) { if (!state.md.options.html) { return false; } - if (state.src.charCodeAt(pos2) !== 60) { + if (state.src.charCodeAt(pos) !== 60) { return false; } - let lineText = state.src.slice(pos2, max); + let lineText = state.src.slice(pos, max); let i2 = 0; for (; i2 < HTML_SEQUENCES.length; i2++) { if (HTML_SEQUENCES[i2][0].test(lineText)) { @@ -187652,9 +188957,9 @@ function html_block(state, startLine, endLine, silent) { if (state.sCount[nextLine] < state.blkIndent) { break; } - pos2 = state.bMarks[nextLine] + state.tShift[nextLine]; + pos = state.bMarks[nextLine] + state.tShift[nextLine]; max = state.eMarks[nextLine]; - lineText = state.src.slice(pos2, max); + lineText = state.src.slice(pos, max); if (HTML_SEQUENCES[i2][1].test(lineText)) { if (lineText.length !== 0) { nextLine++; @@ -187671,30 +188976,30 @@ function html_block(state, startLine, endLine, silent) { } __name(html_block, "html_block"); function heading(state, startLine, endLine, silent) { - let pos2 = state.bMarks[startLine] + state.tShift[startLine]; + let pos = state.bMarks[startLine] + state.tShift[startLine]; let max = state.eMarks[startLine]; if (state.sCount[startLine] - state.blkIndent >= 4) { return false; } - let ch = state.src.charCodeAt(pos2); - if (ch !== 35 || pos2 >= max) { + let ch = state.src.charCodeAt(pos); + if (ch !== 35 || pos >= max) { return false; } let level = 1; - ch = state.src.charCodeAt(++pos2); - while (ch === 35 && pos2 < max && level <= 6) { + ch = state.src.charCodeAt(++pos); + while (ch === 35 && pos < max && level <= 6) { level++; - ch = state.src.charCodeAt(++pos2); + ch = state.src.charCodeAt(++pos); } - if (level > 6 || pos2 < max && !isSpace(ch)) { + if (level > 6 || pos < max && !isSpace(ch)) { return false; } if (silent) { return true; } - max = state.skipSpacesBack(max, pos2); - const tmp = state.skipCharsBack(max, 35, pos2); - if (tmp > pos2 && isSpace(state.src.charCodeAt(tmp - 1))) { + max = state.skipSpacesBack(max, pos); + const tmp = state.skipCharsBack(max, 35, pos); + if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) { max = tmp; } state.line = startLine + 1; @@ -187702,7 +189007,7 @@ function heading(state, startLine, endLine, silent) { token_o.markup = "########".slice(0, level); token_o.map = [startLine, state.line]; const token_i = state.push("inline", "", 0); - token_i.content = state.src.slice(pos2, max).trim(); + token_i.content = state.src.slice(pos, max).trim(); token_i.map = [startLine, state.line]; token_i.children = []; const token_c = state.push("heading_close", "h" + String(level), -1); @@ -187725,14 +189030,14 @@ function lheading(state, startLine, endLine) { continue; } if (state.sCount[nextLine] >= state.blkIndent) { - let pos2 = state.bMarks[nextLine] + state.tShift[nextLine]; + let pos = state.bMarks[nextLine] + state.tShift[nextLine]; const max = state.eMarks[nextLine]; - if (pos2 < max) { - marker = state.src.charCodeAt(pos2); + if (pos < max) { + marker = state.src.charCodeAt(pos); if (marker === 45 || marker === 61) { - pos2 = state.skipChars(pos2, marker); - pos2 = state.skipSpaces(pos2); - if (pos2 >= max) { + pos = state.skipChars(pos, marker); + pos = state.skipSpaces(pos); + if (pos >= max) { level = marker === 61 ? 1 : 2; break; } @@ -187932,12 +189237,12 @@ StateInline.prototype.scanDelims = function(start2, canSplitWord) { const max = this.posMax; const marker = this.src.charCodeAt(start2); const lastChar = start2 > 0 ? this.src.charCodeAt(start2 - 1) : 32; - let pos2 = start2; - while (pos2 < max && this.src.charCodeAt(pos2) === marker) { - pos2++; + let pos = start2; + while (pos < max && this.src.charCodeAt(pos) === marker) { + pos++; } - const count = pos2 - start2; - const nextChar = pos2 < max ? this.src.charCodeAt(pos2) : 32; + const count = pos - start2; + const nextChar = pos < max ? this.src.charCodeAt(pos) : 32; const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar)); const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar)); const isLastWhiteSpace = isWhiteSpace(lastChar); @@ -187981,17 +189286,17 @@ function isTerminatorChar(ch) { } __name(isTerminatorChar, "isTerminatorChar"); function text(state, silent) { - let pos2 = state.pos; - while (pos2 < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos2))) { - pos2++; + let pos = state.pos; + while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) { + pos++; } - if (pos2 === state.pos) { + if (pos === state.pos) { return false; } if (!silent) { - state.pending += state.src.slice(state.pos, pos2); + state.pending += state.src.slice(state.pos, pos); } - state.pos = pos2; + state.pos = pos; return true; } __name(text, "text"); @@ -187999,16 +189304,16 @@ const SCHEME_RE = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i; function linkify(state, silent) { if (!state.md.options.linkify) return false; if (state.linkLevel > 0) return false; - const pos2 = state.pos; + const pos = state.pos; const max = state.posMax; - if (pos2 + 3 > max) return false; - if (state.src.charCodeAt(pos2) !== 58) return false; - if (state.src.charCodeAt(pos2 + 1) !== 47) return false; - if (state.src.charCodeAt(pos2 + 2) !== 47) return false; + if (pos + 3 > max) return false; + if (state.src.charCodeAt(pos) !== 58) return false; + if (state.src.charCodeAt(pos + 1) !== 47) return false; + if (state.src.charCodeAt(pos + 2) !== 47) return false; const match2 = state.pending.match(SCHEME_RE); if (!match2) return false; const proto = match2[1]; - const link2 = state.md.linkify.matchAtStart(state.src.slice(pos2 - proto.length)); + const link2 = state.md.linkify.matchAtStart(state.src.slice(pos - proto.length)); if (!link2) return false; let url = link2.url; if (url.length <= proto.length) return false; @@ -188032,8 +189337,8 @@ function linkify(state, silent) { } __name(linkify, "linkify"); function newline(state, silent) { - let pos2 = state.pos; - if (state.src.charCodeAt(pos2) !== 10) { + let pos = state.pos; + if (state.src.charCodeAt(pos) !== 10) { return false; } const pmax = state.pending.length - 1; @@ -188053,11 +189358,11 @@ function newline(state, silent) { state.push("softbreak", "br", 0); } } - pos2++; - while (pos2 < max && isSpace(state.src.charCodeAt(pos2))) { - pos2++; + pos++; + while (pos < max && isSpace(state.src.charCodeAt(pos))) { + pos++; } - state.pos = pos2; + state.pos = pos; return true; } __name(newline, "newline"); @@ -188069,31 +189374,31 @@ for (let i2 = 0; i2 < 256; i2++) { ESCAPED[ch.charCodeAt(0)] = 1; }); function escape$1(state, silent) { - let pos2 = state.pos; + let pos = state.pos; const max = state.posMax; - if (state.src.charCodeAt(pos2) !== 92) return false; - pos2++; - if (pos2 >= max) return false; - let ch1 = state.src.charCodeAt(pos2); + if (state.src.charCodeAt(pos) !== 92) return false; + pos++; + if (pos >= max) return false; + let ch1 = state.src.charCodeAt(pos); if (ch1 === 10) { if (!silent) { state.push("hardbreak", "br", 0); } - pos2++; - while (pos2 < max) { - ch1 = state.src.charCodeAt(pos2); + pos++; + while (pos < max) { + ch1 = state.src.charCodeAt(pos); if (!isSpace(ch1)) break; - pos2++; + pos++; } - state.pos = pos2; + state.pos = pos; return true; } - let escapedStr = state.src[pos2]; - if (ch1 >= 55296 && ch1 <= 56319 && pos2 + 1 < max) { - const ch2 = state.src.charCodeAt(pos2 + 1); + let escapedStr = state.src[pos]; + if (ch1 >= 55296 && ch1 <= 56319 && pos + 1 < max) { + const ch2 = state.src.charCodeAt(pos + 1); if (ch2 >= 56320 && ch2 <= 57343) { - escapedStr += state.src[pos2 + 1]; - pos2++; + escapedStr += state.src[pos + 1]; + pos++; } } const origStr = "\\" + escapedStr; @@ -188107,30 +189412,30 @@ function escape$1(state, silent) { token.markup = origStr; token.info = "escape"; } - state.pos = pos2 + 1; + state.pos = pos + 1; return true; } __name(escape$1, "escape$1"); function backtick(state, silent) { - let pos2 = state.pos; - const ch = state.src.charCodeAt(pos2); + let pos = state.pos; + const ch = state.src.charCodeAt(pos); if (ch !== 96) { return false; } - const start2 = pos2; - pos2++; + const start2 = pos; + pos++; const max = state.posMax; - while (pos2 < max && state.src.charCodeAt(pos2) === 96) { - pos2++; + while (pos < max && state.src.charCodeAt(pos) === 96) { + pos++; } - const marker = state.src.slice(start2, pos2); + const marker = state.src.slice(start2, pos); const openerLength = marker.length; if (state.backticksScanned && (state.backticks[openerLength] || 0) <= start2) { if (!silent) state.pending += marker; state.pos += openerLength; return true; } - let matchEnd = pos2; + let matchEnd = pos; let matchStart; while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1) { matchEnd = matchStart + 1; @@ -188142,7 +189447,7 @@ function backtick(state, silent) { if (!silent) { const token = state.push("code_inline", "code", 0); token.markup = marker; - token.content = state.src.slice(pos2, matchStart).replace(/\n/g, " ").replace(/^ (.+) $/, "$1"); + token.content = state.src.slice(pos, matchStart).replace(/\n/g, " ").replace(/^ (.+) $/, "$1"); } state.pos = matchEnd; return true; @@ -188356,66 +189661,66 @@ function link(state, silent) { if (labelEnd < 0) { return false; } - let pos2 = labelEnd + 1; - if (pos2 < max && state.src.charCodeAt(pos2) === 40) { + let pos = labelEnd + 1; + if (pos < max && state.src.charCodeAt(pos) === 40) { parseReference = false; - pos2++; - for (; pos2 < max; pos2++) { - code2 = state.src.charCodeAt(pos2); + pos++; + for (; pos < max; pos++) { + code2 = state.src.charCodeAt(pos); if (!isSpace(code2) && code2 !== 10) { break; } } - if (pos2 >= max) { + if (pos >= max) { return false; } - start2 = pos2; - res = state.md.helpers.parseLinkDestination(state.src, pos2, state.posMax); + start2 = pos; + res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax); if (res.ok) { href = state.md.normalizeLink(res.str); if (state.md.validateLink(href)) { - pos2 = res.pos; + pos = res.pos; } else { href = ""; } - start2 = pos2; - for (; pos2 < max; pos2++) { - code2 = state.src.charCodeAt(pos2); + start2 = pos; + for (; pos < max; pos++) { + code2 = state.src.charCodeAt(pos); if (!isSpace(code2) && code2 !== 10) { break; } } - res = state.md.helpers.parseLinkTitle(state.src, pos2, state.posMax); - if (pos2 < max && start2 !== pos2 && res.ok) { + res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax); + if (pos < max && start2 !== pos && res.ok) { title = res.str; - pos2 = res.pos; - for (; pos2 < max; pos2++) { - code2 = state.src.charCodeAt(pos2); + pos = res.pos; + for (; pos < max; pos++) { + code2 = state.src.charCodeAt(pos); if (!isSpace(code2) && code2 !== 10) { break; } } } } - if (pos2 >= max || state.src.charCodeAt(pos2) !== 41) { + if (pos >= max || state.src.charCodeAt(pos) !== 41) { parseReference = true; } - pos2++; + pos++; } if (parseReference) { if (typeof state.env.references === "undefined") { return false; } - if (pos2 < max && state.src.charCodeAt(pos2) === 91) { - start2 = pos2 + 1; - pos2 = state.md.helpers.parseLinkLabel(state, pos2); - if (pos2 >= 0) { - label5 = state.src.slice(start2, pos2++); + if (pos < max && state.src.charCodeAt(pos) === 91) { + start2 = pos + 1; + pos = state.md.helpers.parseLinkLabel(state, pos); + if (pos >= 0) { + label5 = state.src.slice(start2, pos++); } else { - pos2 = labelEnd + 1; + pos = labelEnd + 1; } } else { - pos2 = labelEnd + 1; + pos = labelEnd + 1; } if (!label5) { label5 = state.src.slice(labelStart, labelEnd); @@ -188442,13 +189747,13 @@ function link(state, silent) { state.linkLevel--; state.push("link_close", "a", -1); } - state.pos = pos2; + state.pos = pos; state.posMax = max; return true; } __name(link, "link"); function image(state, silent) { - let code2, content2, label5, pos2, ref2, res, title, start2; + let code2, content2, label5, pos, ref2, res, title, start2; let href = ""; const oldPos = state.pos; const max = state.posMax; @@ -188463,41 +189768,41 @@ function image(state, silent) { if (labelEnd < 0) { return false; } - pos2 = labelEnd + 1; - if (pos2 < max && state.src.charCodeAt(pos2) === 40) { - pos2++; - for (; pos2 < max; pos2++) { - code2 = state.src.charCodeAt(pos2); + pos = labelEnd + 1; + if (pos < max && state.src.charCodeAt(pos) === 40) { + pos++; + for (; pos < max; pos++) { + code2 = state.src.charCodeAt(pos); if (!isSpace(code2) && code2 !== 10) { break; } } - if (pos2 >= max) { + if (pos >= max) { return false; } - start2 = pos2; - res = state.md.helpers.parseLinkDestination(state.src, pos2, state.posMax); + start2 = pos; + res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax); if (res.ok) { href = state.md.normalizeLink(res.str); if (state.md.validateLink(href)) { - pos2 = res.pos; + pos = res.pos; } else { href = ""; } } - start2 = pos2; - for (; pos2 < max; pos2++) { - code2 = state.src.charCodeAt(pos2); + start2 = pos; + for (; pos < max; pos++) { + code2 = state.src.charCodeAt(pos); if (!isSpace(code2) && code2 !== 10) { break; } } - res = state.md.helpers.parseLinkTitle(state.src, pos2, state.posMax); - if (pos2 < max && start2 !== pos2 && res.ok) { + res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax); + if (pos < max && start2 !== pos && res.ok) { title = res.str; - pos2 = res.pos; - for (; pos2 < max; pos2++) { - code2 = state.src.charCodeAt(pos2); + pos = res.pos; + for (; pos < max; pos++) { + code2 = state.src.charCodeAt(pos); if (!isSpace(code2) && code2 !== 10) { break; } @@ -188505,25 +189810,25 @@ function image(state, silent) { } else { title = ""; } - if (pos2 >= max || state.src.charCodeAt(pos2) !== 41) { + if (pos >= max || state.src.charCodeAt(pos) !== 41) { state.pos = oldPos; return false; } - pos2++; + pos++; } else { if (typeof state.env.references === "undefined") { return false; } - if (pos2 < max && state.src.charCodeAt(pos2) === 91) { - start2 = pos2 + 1; - pos2 = state.md.helpers.parseLinkLabel(state, pos2); - if (pos2 >= 0) { - label5 = state.src.slice(start2, pos2++); + if (pos < max && state.src.charCodeAt(pos) === 91) { + start2 = pos + 1; + pos = state.md.helpers.parseLinkLabel(state, pos); + if (pos >= 0) { + label5 = state.src.slice(start2, pos++); } else { - pos2 = labelEnd + 1; + pos = labelEnd + 1; } } else { - pos2 = labelEnd + 1; + pos = labelEnd + 1; } if (!label5) { label5 = state.src.slice(labelStart, labelEnd); @@ -188554,7 +189859,7 @@ function image(state, silent) { attrs6.push(["title", title]); } } - state.pos = pos2; + state.pos = pos; state.posMax = max; return true; } @@ -188562,19 +189867,19 @@ __name(image, "image"); const EMAIL_RE = /^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/; const AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/; function autolink(state, silent) { - let pos2 = state.pos; - if (state.src.charCodeAt(pos2) !== 60) { + let pos = state.pos; + if (state.src.charCodeAt(pos) !== 60) { return false; } const start2 = state.pos; const max = state.posMax; for (; ; ) { - if (++pos2 >= max) return false; - const ch = state.src.charCodeAt(pos2); + if (++pos >= max) return false; + const ch = state.src.charCodeAt(pos); if (ch === 60) return false; if (ch === 62) break; } - const url = state.src.slice(start2 + 1, pos2); + const url = state.src.slice(start2 + 1, pos); if (AUTOLINK_RE.test(url)) { const fullUrl = state.md.normalizeLink(url); if (!state.md.validateLink(fullUrl)) { @@ -188634,15 +189939,15 @@ function html_inline(state, silent) { return false; } const max = state.posMax; - const pos2 = state.pos; - if (state.src.charCodeAt(pos2) !== 60 || pos2 + 2 >= max) { + const pos = state.pos; + if (state.src.charCodeAt(pos) !== 60 || pos + 2 >= max) { return false; } - const ch = state.src.charCodeAt(pos2 + 1); + const ch = state.src.charCodeAt(pos + 1); if (ch !== 33 && ch !== 63 && ch !== 47 && !isLetter(ch)) { return false; } - const match2 = state.src.slice(pos2).match(HTML_TAG_RE); + const match2 = state.src.slice(pos).match(HTML_TAG_RE); if (!match2) { return false; } @@ -188659,13 +189964,13 @@ __name(html_inline, "html_inline"); const DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i; const NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i; function entity(state, silent) { - const pos2 = state.pos; + const pos = state.pos; const max = state.posMax; - if (state.src.charCodeAt(pos2) !== 38) return false; - if (pos2 + 1 >= max) return false; - const ch = state.src.charCodeAt(pos2 + 1); + if (state.src.charCodeAt(pos) !== 38) return false; + if (pos + 1 >= max) return false; + const ch = state.src.charCodeAt(pos + 1); if (ch === 35) { - const match2 = state.src.slice(pos2).match(DIGITAL_RE); + const match2 = state.src.slice(pos).match(DIGITAL_RE); if (match2) { if (!silent) { const code2 = match2[1][0].toLowerCase() === "x" ? parseInt(match2[1].slice(1), 16) : parseInt(match2[1], 10); @@ -188678,7 +189983,7 @@ function entity(state, silent) { return true; } } else { - const match2 = state.src.slice(pos2).match(NAMED_RE); + const match2 = state.src.slice(pos).match(NAMED_RE); if (match2) { const decoded = decodeHTML(match2[0]); if (decoded !== match2[0]) { @@ -188817,13 +190122,13 @@ function ParserInline() { } __name(ParserInline, "ParserInline"); ParserInline.prototype.skipToken = function(state) { - const pos2 = state.pos; + const pos = state.pos; const rules = this.ruler.getRules(""); const len = rules.length; const maxNesting = state.md.options.maxNesting; const cache2 = state.cache; - if (typeof cache2[pos2] !== "undefined") { - state.pos = cache2[pos2]; + if (typeof cache2[pos] !== "undefined") { + state.pos = cache2[pos]; return; } let ok = false; @@ -188833,7 +190138,7 @@ ParserInline.prototype.skipToken = function(state) { ok = rules[i2](state, true); state.level--; if (ok) { - if (pos2 >= state.pos) { + if (pos >= state.pos) { throw new Error("inline rule didn't increment state.pos"); } break; @@ -188845,7 +190150,7 @@ ParserInline.prototype.skipToken = function(state) { if (!ok) { state.pos++; } - cache2[pos2] = state.pos; + cache2[pos] = state.pos; }; ParserInline.prototype.tokenize = function(state) { const rules = this.ruler.getRules(""); @@ -188979,8 +190284,8 @@ function isOptionsObj(obj) { __name(isOptionsObj, "isOptionsObj"); const defaultSchemas = { "http:": { - validate: /* @__PURE__ */ __name(function(text2, pos2, self2) { - const tail = text2.slice(pos2); + validate: /* @__PURE__ */ __name(function(text2, pos, self2) { + const tail = text2.slice(pos); if (!self2.re.http) { self2.re.http = new RegExp( "^\\/\\/" + self2.re.src_auth + self2.re.src_host_port_strict + self2.re.src_path, @@ -188996,8 +190301,8 @@ const defaultSchemas = { "https:": "http:", "ftp:": "http:", "//": { - validate: /* @__PURE__ */ __name(function(text2, pos2, self2) { - const tail = text2.slice(pos2); + validate: /* @__PURE__ */ __name(function(text2, pos, self2) { + const tail = text2.slice(pos); if (!self2.re.no_http) { self2.re.no_http = new RegExp( "^" + self2.re.src_auth + // Don't allow single-level domains, because of false positives like '//test' @@ -189007,10 +190312,10 @@ const defaultSchemas = { ); } if (self2.re.no_http.test(tail)) { - if (pos2 >= 3 && text2[pos2 - 3] === ":") { + if (pos >= 3 && text2[pos - 3] === ":") { return 0; } - if (pos2 >= 3 && text2[pos2 - 3] === "/") { + if (pos >= 3 && text2[pos - 3] === "/") { return 0; } return tail.match(self2.re.no_http)[0].length; @@ -189019,8 +190324,8 @@ const defaultSchemas = { }, "validate") }, "mailto:": { - validate: /* @__PURE__ */ __name(function(text2, pos2, self2) { - const tail = text2.slice(pos2); + validate: /* @__PURE__ */ __name(function(text2, pos, self2) { + const tail = text2.slice(pos); if (!self2.re.mailto) { self2.re.mailto = new RegExp( "^" + self2.re.src_email_name + "@" + self2.re.src_host_strict, @@ -189042,8 +190347,8 @@ function resetScanCache(self2) { } __name(resetScanCache, "resetScanCache"); function createValidator(re) { - return function(text2, pos2) { - const tail = text2.slice(pos2); + return function(text2, pos) { + const tail = text2.slice(pos); if (re.test(tail)) { return tail.match(re)[0].length; } @@ -189235,11 +190540,11 @@ LinkifyIt.prototype.test = /* @__PURE__ */ __name(function test2(text2) { LinkifyIt.prototype.pretest = /* @__PURE__ */ __name(function pretest(text2) { return this.re.pretest.test(text2); }, "pretest"); -LinkifyIt.prototype.testSchemaAt = /* @__PURE__ */ __name(function testSchemaAt(text2, schema2, pos2) { +LinkifyIt.prototype.testSchemaAt = /* @__PURE__ */ __name(function testSchemaAt(text2, schema2, pos) { if (!this.__compiled__[schema2.toLowerCase()]) { return 0; } - return this.__compiled__[schema2.toLowerCase()].validate(text2, pos2, this); + return this.__compiled__[schema2.toLowerCase()].validate(text2, pos, this); }, "testSchemaAt"); LinkifyIt.prototype.match = /* @__PURE__ */ __name(function match(text2) { const result = []; @@ -190821,13 +192126,13 @@ const MarkdownTightLists = Extension.create({ } }); const md = MarkdownIt(); -function scanDelims(text2, pos2) { +function scanDelims(text2, pos) { md.inline.State.prototype.scanDelims.call({ src: text2, posMax: text2.length }); const state = new md.inline.State(text2, null, null, []); - return state.scanDelims(pos2, true); + return state.scanDelims(pos, true); } __name(scanDelims, "scanDelims"); function shiftDelim(text2, delim, start2, offset) { @@ -190837,34 +192142,34 @@ function shiftDelim(text2, delim, start2, offset) { } __name(shiftDelim, "shiftDelim"); function trimStart(text2, delim, from2, to) { - let pos2 = from2, res = text2; - while (pos2 < to) { - if (scanDelims(res, pos2).can_open) { + let pos = from2, res = text2; + while (pos < to) { + if (scanDelims(res, pos).can_open) { break; } - res = shiftDelim(res, delim, pos2, 1); - pos2++; + res = shiftDelim(res, delim, pos, 1); + pos++; } return { text: res, - from: pos2, + from: pos, to }; } __name(trimStart, "trimStart"); function trimEnd(text2, delim, from2, to) { - let pos2 = to, res = text2; - while (pos2 > from2) { - if (scanDelims(res, pos2).can_close) { + let pos = to, res = text2; + while (pos > from2) { + if (scanDelims(res, pos).can_close) { break; } - res = shiftDelim(res, delim, pos2, -1); - pos2--; + res = shiftDelim(res, delim, pos, -1); + pos--; } return { text: res, from: from2, - to: pos2 + to: pos }; } __name(trimEnd, "trimEnd"); @@ -191794,6 +193099,202 @@ const Markdown = Extension.create({ })]; } }); +function addMarkdownWidget(node3, name2, opts, app2) { + Markdown.configure({ + html: false, + breaks: true, + transformPastedText: true + }); + const editor = new Editor({ + extensions: [ + StarterKit, + Markdown, + Link$2, + Table$2, + TableCell, + TableHeader, + TableRow + ], + content: opts.defaultVal, + editable: false + }); + const inputEl = editor.options.element; + inputEl.classList.add("comfy-markdown"); + const textarea = document.createElement("textarea"); + inputEl.append(textarea); + const widget = node3.addDOMWidget(name2, "MARKDOWN", inputEl, { + getValue() { + return textarea.value; + }, + setValue(v2) { + textarea.value = v2; + editor.commands.setContent(v2); + } + }); + widget.inputEl = inputEl; + inputEl.addEventListener("pointerdown", (event) => { + if (event.button !== 0) { + app2.canvas.processMouseDown(event); + return; + } + if (event.target instanceof HTMLAnchorElement) { + return; + } + inputEl.classList.add("editing"); + setTimeout(() => { + textarea.focus(); + }, 0); + }); + textarea.addEventListener("blur", () => { + inputEl.classList.remove("editing"); + }); + textarea.addEventListener("change", () => { + editor.commands.setContent(textarea.value); + widget.callback?.(widget.value); + }); + inputEl.addEventListener("keydown", (event) => { + event.stopPropagation(); + }); + inputEl.addEventListener("pointerdown", (event) => { + if (event.button === 1) { + app2.canvas.processMouseDown(event); + } + }); + inputEl.addEventListener("pointermove", (event) => { + if ((event.buttons & 4) === 4) { + app2.canvas.processMouseMove(event); + } + }); + inputEl.addEventListener("pointerup", (event) => { + if (event.button === 1) { + app2.canvas.processMouseUp(event); + } + }); + return { minWidth: 400, minHeight: 200, widget }; +} +__name(addMarkdownWidget, "addMarkdownWidget"); +const useMarkdownWidget = /* @__PURE__ */ __name(() => { + const widgetConstructor = /* @__PURE__ */ __name((node3, inputName, inputData, app2) => { + const defaultVal = inputData[1]?.default || ""; + return addMarkdownWidget( + node3, + inputName, + { defaultVal, ...inputData[1] }, + app2 + ); + }, "widgetConstructor"); + return widgetConstructor; +}, "useMarkdownWidget"); +const useSeedWidget = /* @__PURE__ */ __name(() => { + const IntWidget = useIntWidget(); + const widgetConstructor = /* @__PURE__ */ __name((node3, inputName, inputData, app2, widgetName) => { + inputData[1] = { + ...inputData[1], + control_after_generate: true + }; + return IntWidget(node3, inputName, inputData, app2, widgetName); + }, "widgetConstructor"); + return widgetConstructor; +}, "useSeedWidget"); +function addMultilineWidget(node3, name2, opts, app2) { + const inputEl = document.createElement("textarea"); + inputEl.className = "comfy-multiline-input"; + inputEl.value = opts.defaultVal; + inputEl.placeholder = opts.placeholder || name2; + if (app2.vueAppReady) { + inputEl.spellcheck = useSettingStore().get( + "Comfy.TextareaWidget.Spellcheck" + ); + } + const widget = node3.addDOMWidget(name2, "customtext", inputEl, { + getValue() { + return inputEl.value; + }, + setValue(v2) { + inputEl.value = v2; + } + }); + widget.inputEl = inputEl; + inputEl.addEventListener("input", () => { + widget.callback?.(widget.value); + }); + inputEl.addEventListener("pointerdown", (event) => { + if (event.button === 1) { + app2.canvas.processMouseDown(event); + } + }); + inputEl.addEventListener("pointermove", (event) => { + if ((event.buttons & 4) === 4) { + app2.canvas.processMouseMove(event); + } + }); + inputEl.addEventListener("pointerup", (event) => { + if (event.button === 1) { + app2.canvas.processMouseUp(event); + } + }); + return { minWidth: 400, minHeight: 200, widget }; +} +__name(addMultilineWidget, "addMultilineWidget"); +const useStringWidget = /* @__PURE__ */ __name(() => { + const widgetConstructor = /* @__PURE__ */ __name((node3, inputName, inputData, app2) => { + const defaultVal = inputData[1]?.default || ""; + const multiline = !!inputData[1]?.multiline; + let res; + if (multiline) { + res = addMultilineWidget( + node3, + inputName, + { defaultVal, ...inputData[1] }, + app2 + ); + } else { + res = { + widget: node3.addWidget("text", inputName, defaultVal, () => { + }, {}) + }; + } + if (inputData[1]?.dynamicPrompts != void 0) + res.widget.dynamicPrompts = inputData[1].dynamicPrompts; + return res; + }, "widgetConstructor"); + return widgetConstructor; +}, "useStringWidget"); +function distributeSpace(totalSpace, requests) { + if (requests.length === 0) return []; + const totalMinSize = requests.reduce((sum, req) => sum + req.minSize, 0); + if (totalSpace < totalMinSize) { + return requests.map((req) => req.minSize); + } + let allocations = requests.map((req) => ({ + computedSize: req.minSize, + maxSize: req.maxSize ?? Infinity, + remaining: (req.maxSize ?? Infinity) - req.minSize + })); + let remainingSpace = totalSpace - totalMinSize; + while (remainingSpace > 0 && allocations.some((alloc) => alloc.remaining > 0)) { + const growableItems = allocations.filter( + (alloc) => alloc.remaining > 0 + ).length; + if (growableItems === 0) break; + const sharePerItem = remainingSpace / growableItems; + let spaceUsedThisRound = 0; + allocations = allocations.map((alloc) => { + if (alloc.remaining <= 0) return alloc; + const growth = Math.min(sharePerItem, alloc.remaining); + spaceUsedThisRound += growth; + return { + ...alloc, + computedSize: alloc.computedSize + growth, + remaining: alloc.remaining - growth + }; + }); + remainingSpace -= spaceUsedThisRound; + if (spaceUsedThisRound === 0) break; + } + return allocations.map(({ computedSize }) => computedSize); +} +__name(distributeSpace, "distributeSpace"); const SIZE = Symbol(); function intersect(a2, b2) { const x2 = Math.max(a2.x, b2.x); @@ -191806,7 +193307,7 @@ function intersect(a2, b2) { __name(intersect, "intersect"); function getClipPath(node3, element, canvasRect) { const selectedNode = Object.values( - app$1.canvas.selected_nodes + app$1.canvas.selected_nodes ?? {} )[0]; if (selectedNode && selectedNode !== node3) { const elRect = element.getBoundingClientRect(); @@ -191841,95 +193342,44 @@ function getClipPath(node3, element, canvasRect) { } __name(getClipPath, "getClipPath"); function computeSize(size) { - if (this.widgets?.[0]?.last_y == null) return; + if (!this.widgets?.[0]?.last_y) return; let y2 = this.widgets[0].last_y; let freeSpace = size[1] - y2; - let widgetHeight = 0; - let dom = []; + let fixedWidgetHeight = 0; + const layoutWidgets = []; for (const w2 of this.widgets) { if (w2.type === "converted-widget") { delete w2.computedHeight; - } else if (w2.computeSize) { - widgetHeight += w2.computeSize()[1] + 4; - } else if (w2.element) { - const styles = getComputedStyle(w2.element); - let minHeight = w2.options.getMinHeight?.() ?? parseInt(styles.getPropertyValue("--comfy-widget-min-height")); - let maxHeight = w2.options.getMaxHeight?.() ?? parseInt(styles.getPropertyValue("--comfy-widget-max-height")); - let prefHeight = w2.options.getHeight?.() ?? styles.getPropertyValue("--comfy-widget-height"); - if (prefHeight.endsWith?.("%")) { - prefHeight = size[1] * (parseFloat(prefHeight.substring(0, prefHeight.length - 1)) / 100); - } else { - prefHeight = parseInt(prefHeight); - if (isNaN(minHeight)) { - minHeight = prefHeight; - } - } - if (isNaN(minHeight)) { - minHeight = 50; - } - if (!isNaN(maxHeight)) { - if (!isNaN(prefHeight)) { - prefHeight = Math.min(prefHeight, maxHeight); - } else { - prefHeight = maxHeight; - } - } - dom.push({ + } else if (w2.computeLayoutSize) { + const { minHeight, maxHeight } = w2.computeLayoutSize(this); + layoutWidgets.push({ minHeight, - prefHeight, + prefHeight: maxHeight, w: w2 }); + } else if (w2.computeSize) { + fixedWidgetHeight += w2.computeSize()[1] + 4; } else { - widgetHeight += LiteGraph.NODE_WIDGET_HEIGHT + 4; + fixedWidgetHeight += LiteGraph.NODE_WIDGET_HEIGHT + 4; } } - freeSpace -= widgetHeight; - const prefGrow = []; - const canGrow = []; - let growBy = 0; - for (const d2 of dom) { - freeSpace -= d2.minHeight; - if (isNaN(d2.prefHeight)) { - canGrow.push(d2); - d2.w.computedHeight = d2.minHeight; - } else { - const diff2 = d2.prefHeight - d2.minHeight; - if (diff2 > 0) { - prefGrow.push(d2); - growBy += diff2; - d2.diff = diff2; - } else { - d2.w.computedHeight = d2.minHeight; - } - } - } - if (this.imgs && !this.widgets.find((w2) => w2.name === ANIM_PREVIEW_WIDGET)) { - freeSpace -= 220; + if (this.imgs && !this.widgets?.find((w2) => w2.name === ANIM_PREVIEW_WIDGET)) { + fixedWidgetHeight += 220; } + freeSpace -= fixedWidgetHeight; this.freeWidgetSpace = freeSpace; - if (freeSpace < 0) { - size[1] -= freeSpace; - this.graph.setDirtyCanvas(true); - } else { - const growDiff = freeSpace - growBy; - if (growDiff > 0) { - freeSpace = growDiff; - for (const d2 of prefGrow) { - d2.w.computedHeight = d2.prefHeight; - } - } else { - const shared = -growDiff / prefGrow.length; - for (const d2 of prefGrow) { - d2.w.computedHeight = d2.prefHeight - shared; - } - freeSpace = 0; - } - if (freeSpace > 0 && canGrow.length) { - const shared = freeSpace / canGrow.length; - for (const d2 of canGrow) { - d2.w.computedHeight += shared; - } - } + const spaceRequests = layoutWidgets.map((d2) => ({ + minSize: d2.minHeight, + maxSize: d2.prefHeight + })); + const allocations = distributeSpace(Math.max(0, freeSpace), spaceRequests); + layoutWidgets.forEach((d2, i2) => { + d2.w.computedHeight = allocations[i2]; + }); + const totalNeeded = fixedWidgetHeight + allocations.reduce((sum, h2) => sum + h2, 0); + if (totalNeeded > size[1] - this.widgets[0].last_y) { + size[1] = totalNeeded + this.widgets[0].last_y; + this.graph?.setDirtyCanvas(true); } for (const w2 of this.widgets) { w2.y = y2; @@ -191945,12 +193395,12 @@ function computeSize(size) { __name(computeSize, "computeSize"); const elementWidgets = /* @__PURE__ */ new Set(); const computeVisibleNodes = LGraphCanvas.prototype.computeVisibleNodes; -LGraphCanvas.prototype.computeVisibleNodes = function() { - const visibleNodes = computeVisibleNodes.apply(this, arguments); +LGraphCanvas.prototype.computeVisibleNodes = function(nodes, out) { + const visibleNodes = computeVisibleNodes.call(this, nodes, out); for (const node3 of app$1.graph.nodes) { if (elementWidgets.has(node3)) { const hidden = visibleNodes.indexOf(node3) === -1; - for (const w2 of node3.widgets) { + for (const w2 of node3.widgets ?? []) { if (w2.element) { w2.element.dataset.isInVisibleNodes = hidden ? "false" : "true"; const shouldOtherwiseHide = w2.element.dataset.shouldHide === "true"; @@ -191958,7 +193408,7 @@ LGraphCanvas.prototype.computeVisibleNodes = function() { const wasHidden = w2.element.hidden; const actualHidden = hidden || shouldOtherwiseHide || isCollapsed; w2.element.hidden = actualHidden; - w2.element.style.display = actualHidden ? "none" : null; + w2.element.style.display = actualHidden ? "none" : ""; if (actualHidden && !wasHidden) { w2.options.onHide?.(w2); } @@ -191968,6 +193418,108 @@ LGraphCanvas.prototype.computeVisibleNodes = function() { } return visibleNodes; }; +class DOMWidgetImpl { + static { + __name(this, "DOMWidgetImpl"); + } + type; + name; + element; + options; + computedHeight; + callback; + mouseDownHandler; + constructor(name2, type, element, options4 = {}) { + this.type = type; + this.name = name2; + this.element = element; + this.options = options4; + if (element.blur) { + this.mouseDownHandler = (event) => { + if (!element.contains(event.target)) { + element.blur(); + } + }; + document.addEventListener("mousedown", this.mouseDownHandler); + } + } + get value() { + return this.options.getValue?.() ?? ""; + } + set value(v2) { + this.options.setValue?.(v2); + this.callback?.(this.value); + } + /** Extract DOM widget size info */ + computeLayoutSize(node3) { + const styles = getComputedStyle(this.element); + let minHeight = this.options.getMinHeight?.() ?? parseInt(styles.getPropertyValue("--comfy-widget-min-height")); + let maxHeight = this.options.getMaxHeight?.() ?? parseInt(styles.getPropertyValue("--comfy-widget-max-height")); + let prefHeight = this.options.getHeight?.() ?? styles.getPropertyValue("--comfy-widget-height"); + if (typeof prefHeight === "string" && prefHeight.endsWith?.("%")) { + prefHeight = node3.size[1] * (parseFloat(prefHeight.substring(0, prefHeight.length - 1)) / 100); + } else { + prefHeight = typeof prefHeight === "number" ? prefHeight : parseInt(prefHeight); + if (isNaN(minHeight)) { + minHeight = prefHeight; + } + } + return { + minHeight: isNaN(minHeight) ? 50 : minHeight, + maxHeight: isNaN(maxHeight) ? void 0 : maxHeight, + minWidth: 0 + }; + } + draw(ctx, node3, widgetWidth, y2) { + if (this.computedHeight == null) { + computeSize.call(node3, node3.size); + } + const { offset, scale } = app$1.canvas.ds; + const hidden = !!this.options.hideOnZoom && app$1.canvas.low_quality || (this.computedHeight ?? 0) <= 0 || // @ts-expect-error custom widget type + this.type === "converted-widget" || // @ts-expect-error custom widget type + this.type === "hidden"; + this.element.dataset.shouldHide = hidden ? "true" : "false"; + const isInVisibleNodes = this.element.dataset.isInVisibleNodes === "true"; + const isCollapsed = this.element.dataset.collapsed === "true"; + const actualHidden = hidden || !isInVisibleNodes || isCollapsed; + const wasHidden = this.element.hidden; + this.element.hidden = actualHidden; + this.element.style.display = actualHidden ? "none" : ""; + if (actualHidden && !wasHidden) { + this.options.onHide?.(this); + } + if (actualHidden) { + return; + } + const elRect = ctx.canvas.getBoundingClientRect(); + const margin = 10; + const top = node3.pos[0] + offset[0] + margin; + const left = node3.pos[1] + offset[1] + margin + y2; + Object.assign(this.element.style, { + transformOrigin: "0 0", + transform: `scale(${scale})`, + left: `${top * scale}px`, + top: `${left * scale}px`, + width: `${widgetWidth - margin * 2}px`, + height: `${(this.computedHeight ?? 50) - margin * 2}px`, + position: "absolute", + zIndex: app$1.graph.nodes.indexOf(node3), + pointerEvents: app$1.canvas.read_only ? "none" : "auto" + }); + if (useSettingStore().get("Comfy.DOMClippingEnabled")) { + const clipPath = getClipPath(node3, this.element, elRect); + this.element.style.clipPath = clipPath ?? "none"; + this.element.style.willChange = "clip-path"; + } + this.options.onDraw?.(this); + } + onRemove() { + if (this.mouseDownHandler) { + document.removeEventListener("mousedown", this.mouseDownHandler); + } + this.element.remove(); + } +} LGraphNode.prototype.addDOMWidget = function(name2, type, element, options4 = {}) { options4 = { hideOnZoom: true, selectOn: ["focus", "click"], ...options4 }; if (!element.parentElement) { @@ -191975,167 +193527,90 @@ LGraphNode.prototype.addDOMWidget = function(name2, type, element, options4 = {} } element.hidden = true; element.style.display = "none"; - let mouseDownHandler; - if (element.blur) { - mouseDownHandler = /* @__PURE__ */ __name((event) => { - if (!element.contains(event.target)) { - element.blur(); - } - }, "mouseDownHandler"); - document.addEventListener("mousedown", mouseDownHandler); - } const { nodeData } = this.constructor; const tooltip = (nodeData?.input.required?.[name2] ?? nodeData?.input.optional?.[name2])?.[1]?.tooltip; if (tooltip && !element.title) { element.title = tooltip; } - const widget2 = { - // @ts-expect-error All unrecognized types will be treated the same way as 'custom' - // in litegraph internally. - type, - name: name2, - get value() { - return options4.getValue?.() ?? void 0; + const widget = new DOMWidgetImpl(name2, type, element, options4); + Object.defineProperty(widget, "value", { + get() { + return this.options.getValue?.() ?? ""; }, - set value(v2) { - options4.setValue?.(v2); - widget2.callback?.(widget2.value); - }, - draw: /* @__PURE__ */ __name(function(ctx, node3, widgetWidth, y2, widgetHeight) { - if (widget2.computedHeight == null) { - computeSize.call(node3, node3.size); - } - const { offset, scale } = app$1.canvas.ds; - const hidden = !!options4.hideOnZoom && scale < 0.5 || widget2.computedHeight <= 0 || // @ts-expect-error Used by widgetInputs.ts - widget2.type === "converted-widget" || // @ts-expect-error Used by groupNode.ts - widget2.type === "hidden"; - element.dataset.shouldHide = hidden ? "true" : "false"; - const isInVisibleNodes = element.dataset.isInVisibleNodes === "true"; - const isCollapsed = element.dataset.collapsed === "true"; - const actualHidden = hidden || !isInVisibleNodes || isCollapsed; - const wasHidden = element.hidden; - element.hidden = actualHidden; - element.style.display = actualHidden ? "none" : null; - if (actualHidden && !wasHidden) { - widget2.options.onHide?.(widget2); - } - if (actualHidden) { - return; - } - const elRect = ctx.canvas.getBoundingClientRect(); - const margin = 10; - const top = node3.pos[0] + offset[0] + margin; - const left = node3.pos[1] + offset[1] + margin + y2; - Object.assign(element.style, { - transformOrigin: "0 0", - transform: `scale(${scale})`, - left: `${top * scale}px`, - top: `${left * scale}px`, - width: `${widgetWidth - margin * 2}px`, - height: `${(widget2.computedHeight ?? 50) - margin * 2}px`, - position: "absolute", - zIndex: app$1.graph.nodes.indexOf(node3), - pointerEvents: app$1.canvas.read_only ? "none" : "auto" - }); - if (useSettingStore().get("Comfy.DOMClippingEnabled")) { - element.style.clipPath = getClipPath(node3, element, elRect); - element.style.willChange = "clip-path"; - } - this.options.onDraw?.(widget2); - }, "draw"), - element, - options: options4, - onRemove() { - if (mouseDownHandler) { - document.removeEventListener("mousedown", mouseDownHandler); - } - element.remove(); + set(v2) { + this.options.setValue?.(v2); + this.callback?.(this.value); } - }; - for (const evt of options4.selectOn) { + }); + const selectEvents = options4.selectOn ?? ["focus", "click"]; + for (const evt of selectEvents) { element.addEventListener(evt, () => { app$1.canvas.selectNode(this); app$1.canvas.bringToFront(this); }); } - this.addCustomWidget(widget2); + this.addCustomWidget(widget); elementWidgets.add(this); const collapse = this.collapse; - this.collapse = function() { - collapse.apply(this, arguments); - if (this.flags?.collapsed) { + this.collapse = function(force) { + collapse.call(this, force); + if (this.collapsed) { element.hidden = true; element.style.display = "none"; } - element.dataset.collapsed = this.flags?.collapsed ? "true" : "false"; + element.dataset.collapsed = this.collapsed ? "true" : "false"; }; const { onConfigure } = this; - this.onConfigure = function() { - onConfigure?.apply(this, arguments); - element.dataset.collapsed = this.flags?.collapsed ? "true" : "false"; + this.onConfigure = function(serializedNode) { + onConfigure?.call(this, serializedNode); + element.dataset.collapsed = this.collapsed ? "true" : "false"; }; const onRemoved = this.onRemoved; this.onRemoved = function() { element.remove(); elementWidgets.delete(this); - onRemoved?.apply(this, arguments); + onRemoved?.call(this); }; if (!this[SIZE]) { this[SIZE] = true; const onResize2 = this.onResize; this.onResize = function(size) { - options4.beforeResize?.call(widget2, this); + options4.beforeResize?.call(widget, this); computeSize.call(this, size); - onResize2?.apply(this, arguments); - options4.afterResize?.call(widget2, this); + onResize2?.call(this, size); + options4.afterResize?.call(widget, this); }; } - return widget2; + return widget; }; +window.comfyAPI = window.comfyAPI || {}; +window.comfyAPI.domWidget = window.comfyAPI.domWidget || {}; +window.comfyAPI.domWidget.DOMWidgetImpl = DOMWidgetImpl; function controlValueRunBefore() { return useSettingStore().get("Comfy.WidgetControlMode") === "before"; } __name(controlValueRunBefore, "controlValueRunBefore"); -function updateControlWidgetLabel(widget2) { +function updateControlWidgetLabel(widget) { let replacement = "after"; let find2 = "before"; if (controlValueRunBefore()) { ; [find2, replacement] = [replacement, find2]; } - widget2.label = (widget2.label ?? widget2.name).replace(find2, replacement); + widget.label = (widget.label ?? widget.name ?? "").replace(find2, replacement); } __name(updateControlWidgetLabel, "updateControlWidgetLabel"); const IS_CONTROL_WIDGET = Symbol(); const HAS_EXECUTED = Symbol(); -function getNumberDefaults(inputData, defaultStep, precision, enable_rounding) { - let defaultVal = inputData[1]["default"]; - let { min, max, step: step3, round } = inputData[1]; - if (defaultVal == void 0) defaultVal = 0; - if (min == void 0) min = 0; - if (max == void 0) max = 2048; - if (step3 == void 0) step3 = defaultStep; - if (precision == void 0) { - precision = Math.max(-Math.floor(Math.log10(step3)), 0); - } - if (enable_rounding && (round == void 0 || round === true)) { - round = Math.round(1e6 * Math.pow(0.1, precision)) / 1e6; - } - return { - val: defaultVal, - config: { min, max, step: 10 * step3, round, precision } - }; -} -__name(getNumberDefaults, "getNumberDefaults"); -function addValueControlWidget(node3, targetWidget, defaultValue2 = "randomize", values, widgetName, inputData) { - let name2 = inputData[1]?.control_after_generate; +function addValueControlWidget(node3, targetWidget, defaultValue2, values, widgetName, inputData) { + let name2 = inputData?.[1]?.control_after_generate; if (typeof name2 !== "string") { name2 = widgetName; } const widgets = addValueControlWidgets( node3, targetWidget, - defaultValue2, + defaultValue2 ?? "randomize", { addFilterList: false, controlAfterGenerateName: name2 @@ -192145,7 +193620,7 @@ function addValueControlWidget(node3, targetWidget, defaultValue2 = "randomize", return widgets[0]; } __name(addValueControlWidget, "addValueControlWidget"); -function addValueControlWidgets(node3, targetWidget, defaultValue2 = "randomize", options4, inputData) { +function addValueControlWidgets(node3, targetWidget, defaultValue2, options4, inputData) { if (!defaultValue2) defaultValue2 = "randomize"; if (!options4) options4 = {}; const getName = /* @__PURE__ */ __name((defaultName, optionName) => { @@ -192178,7 +193653,7 @@ function addValueControlWidgets(node3, targetWidget, defaultValue2 = "randomize" widgets.push(valueControl); const isCombo = targetWidget.type === "combo"; let comboFilter; - if (isCombo) { + if (isCombo && valueControl.options.values) { valueControl.options.values.push("increment-wrap"); } if (isCombo && options4.addFilterList !== false) { @@ -192200,7 +193675,7 @@ function addValueControlWidgets(node3, targetWidget, defaultValue2 = "randomize" const applyWidgetControl = /* @__PURE__ */ __name(() => { var v2 = valueControl.value; if (isCombo && v2 !== "fixed") { - let values = targetWidget.options.values; + let values = targetWidget.options.values ?? []; const filter4 = comboFilter?.value; if (filter4) { let check; @@ -192221,7 +193696,7 @@ function addValueControlWidgets(node3, targetWidget, defaultValue2 = "randomize" check = /* @__PURE__ */ __name((item3) => item3.toLocaleLowerCase().includes(lower), "check"); } values = values.filter((item3) => check(item3)); - if (!values.length && targetWidget.options.values.length) { + if (!values.length && targetWidget.options.values?.length) { console.warn( "Filter for node " + node3.id + " has filtered out all items", filter4 @@ -192254,32 +193729,31 @@ function addValueControlWidgets(node3, targetWidget, defaultValue2 = "randomize" if (current_index >= 0) { let value4 = values[current_index]; targetWidget.value = value4; - targetWidget.callback(value4); + targetWidget.callback?.(value4); } } else { - let min = targetWidget.options.min; - let max = targetWidget.options.max; + let { min = 0, max = 1, step: step3 = 1 } = targetWidget.options; max = Math.min(1125899906842624, max); min = Math.max(-1125899906842624, min); - let range2 = (max - min) / (targetWidget.options.step / 10); + let range2 = (max - min) / (step3 / 10); switch (v2) { case "fixed": break; case "increment": - targetWidget.value += targetWidget.options.step / 10; + targetWidget.value += step3 / 10; break; case "decrement": - targetWidget.value -= targetWidget.options.step / 10; + targetWidget.value -= step3 / 10; break; case "randomize": - targetWidget.value = Math.floor(Math.random() * range2) * (targetWidget.options.step / 10) + min; + targetWidget.value = Math.floor(Math.random() * range2) * (step3 / 10) + min; break; default: break; } if (targetWidget.value < min) targetWidget.value = min; if (targetWidget.value > max) targetWidget.value = max; - targetWidget.callback(targetWidget.value); + targetWidget.callback?.(targetWidget.value); } }, "applyWidgetControl"); valueControl.beforeQueued = () => { @@ -192298,414 +193772,17 @@ function addValueControlWidgets(node3, targetWidget, defaultValue2 = "randomize" return widgets; } __name(addValueControlWidgets, "addValueControlWidgets"); -function seedWidget(node3, inputName, inputData, app2, widgetName) { - const seed = createIntWidget(node3, inputName, inputData, app2, true); - const seedControl = addValueControlWidget( - node3, - seed.widget, - "randomize", - void 0, - widgetName, - inputData - ); - seed.widget.linkedWidgets = [seedControl]; - return seed; -} -__name(seedWidget, "seedWidget"); -function createIntWidget(node3, inputName, inputData, app2, isSeedInput = false) { - const control = inputData[1]?.control_after_generate; - if (!isSeedInput && control) { - return seedWidget( - node3, - inputName, - inputData, - app2, - typeof control === "string" ? control : void 0 - ); - } - let widgetType = isSlider(inputData[1]["display"], app2); - const { val, config: config2 } = getNumberDefaults(inputData, 1, 0, true); - Object.assign(config2, { precision: 0 }); - return { - widget: node3.addWidget( - widgetType, - inputName, - val, - function(v2) { - const s2 = this.options.step / 10; - let sh = this.options.min % s2; - if (isNaN(sh)) { - sh = 0; - } - this.value = Math.round((v2 - sh) / s2) * s2 + sh; - }, - config2 - ) - }; -} -__name(createIntWidget, "createIntWidget"); -function addMultilineWidget(node3, name2, opts, app2) { - const inputEl = document.createElement("textarea"); - inputEl.className = "comfy-multiline-input"; - inputEl.value = opts.defaultVal; - inputEl.placeholder = opts.placeholder || name2; - if (app2.vueAppReady) { - inputEl.spellcheck = useSettingStore().get( - "Comfy.TextareaWidget.Spellcheck" - ); - } - const widget2 = node3.addDOMWidget(name2, "customtext", inputEl, { - getValue() { - return inputEl.value; - }, - setValue(v2) { - inputEl.value = v2; - } - }); - widget2.inputEl = inputEl; - inputEl.addEventListener("input", () => { - widget2.callback?.(widget2.value); - }); - inputEl.addEventListener("pointerdown", (event) => { - if (event.button === 1) { - app2.canvas.processMouseDown(event); - } - }); - inputEl.addEventListener("pointermove", (event) => { - if ((event.buttons & 4) === 4) { - app2.canvas.processMouseMove(event); - } - }); - inputEl.addEventListener("pointerup", (event) => { - if (event.button === 1) { - app2.canvas.processMouseUp(event); - } - }); - return { minWidth: 400, minHeight: 200, widget: widget2 }; -} -__name(addMultilineWidget, "addMultilineWidget"); -function addMarkdownWidget(node3, name2, opts, app2) { - Markdown.configure({ - html: false, - breaks: true, - transformPastedText: true - }); - const editor = new Editor({ - extensions: [ - StarterKit, - Markdown, - Link$2, - Table$2, - TableCell, - TableHeader, - TableRow - ], - content: opts.defaultVal, - editable: false - }); - const inputEl = editor.options.element; - inputEl.classList.add("comfy-markdown"); - const textarea = document.createElement("textarea"); - inputEl.append(textarea); - const widget2 = node3.addDOMWidget(name2, "MARKDOWN", inputEl, { - getValue() { - return textarea.value; - }, - setValue(v2) { - textarea.value = v2; - editor.commands.setContent(v2); - } - }); - widget2.inputEl = inputEl; - editor.options.element.addEventListener( - "pointerdown", - (event) => { - if (event.button !== 0) { - app2.canvas.processMouseDown(event); - return; - } - if (event.target instanceof HTMLAnchorElement) { - return; - } - inputEl.classList.add("editing"); - setTimeout(() => { - textarea.focus(); - }, 0); - } - ); - textarea.addEventListener("blur", () => { - inputEl.classList.remove("editing"); - }); - textarea.addEventListener("change", () => { - editor.commands.setContent(textarea.value); - widget2.callback?.(widget2.value); - }); - inputEl.addEventListener("keydown", (event) => { - event.stopPropagation(); - }); - inputEl.addEventListener("pointerdown", (event) => { - if (event.button === 1) { - app2.canvas.processMouseDown(event); - } - }); - inputEl.addEventListener("pointermove", (event) => { - if ((event.buttons & 4) === 4) { - app2.canvas.processMouseMove(event); - } - }); - inputEl.addEventListener("pointerup", (event) => { - if (event.button === 1) { - app2.canvas.processMouseUp(event); - } - }); - return { minWidth: 400, minHeight: 200, widget: widget2 }; -} -__name(addMarkdownWidget, "addMarkdownWidget"); -function isSlider(display, app2) { - if (app2.ui.settings.getSettingValue("Comfy.DisableSliders")) { - return "number"; - } - return display === "slider" ? "slider" : "number"; -} -__name(isSlider, "isSlider"); +const SeedWidget = useSeedWidget(); const ComfyWidgets = { - "INT:seed": seedWidget, - "INT:noise_seed": seedWidget, - FLOAT(node3, inputName, inputData, app2) { - let widgetType = isSlider(inputData[1]["display"], app2); - let precision = app2.ui.settings.getSettingValue( - "Comfy.FloatRoundingPrecision" - ); - let disable_rounding = app2.ui.settings.getSettingValue( - "Comfy.DisableFloatRounding" - ); - if (precision == 0) precision = void 0; - const { val, config: config2 } = getNumberDefaults( - inputData, - 0.5, - precision, - !disable_rounding - ); - return { - widget: node3.addWidget( - widgetType, - inputName, - val, - function(v2) { - if (config2.round) { - this.value = Math.round((v2 + Number.EPSILON) / config2.round) * config2.round; - if (this.value > config2.max) this.value = config2.max; - if (this.value < config2.min) this.value = config2.min; - } else { - this.value = v2; - } - }, - config2 - ) - }; - }, - INT(node3, inputName, inputData, app2) { - return createIntWidget(node3, inputName, inputData, app2); - }, - BOOLEAN(node3, inputName, inputData) { - let defaultVal = false; - let options4 = {}; - if (inputData[1]) { - if (inputData[1].default) defaultVal = inputData[1].default; - if (inputData[1].label_on) options4["on"] = inputData[1].label_on; - if (inputData[1].label_off) options4["off"] = inputData[1].label_off; - } - return { - widget: node3.addWidget("toggle", inputName, defaultVal, () => { - }, options4) - }; - }, - STRING(node3, inputName, inputData, app2) { - const defaultVal = inputData[1].default || ""; - const multiline = !!inputData[1].multiline; - let res; - if (multiline) { - res = addMultilineWidget( - node3, - inputName, - { defaultVal, ...inputData[1] }, - app2 - ); - } else { - res = { - widget: node3.addWidget("text", inputName, defaultVal, () => { - }, {}) - }; - } - if (inputData[1].dynamicPrompts != void 0) - res.widget.dynamicPrompts = inputData[1].dynamicPrompts; - return res; - }, - MARKDOWN(node3, inputName, inputData, app2) { - const defaultVal = inputData[1].default || ""; - let res; - res = addMarkdownWidget( - node3, - inputName, - { defaultVal, ...inputData[1] }, - app2 - ); - return res; - }, - COMBO(node3, inputName, inputData) { - const type = inputData[0]; - let defaultValue2 = type[0]; - if (inputData[1] && inputData[1].default) { - defaultValue2 = inputData[1].default; - } - const res = { - widget: node3.addWidget("combo", inputName, defaultValue2, () => { - }, { - values: type - }) - }; - if (inputData[1]?.control_after_generate) { - res.widget.linkedWidgets = addValueControlWidgets( - node3, - res.widget, - void 0, - void 0, - inputData - ); - } - return res; - }, - IMAGEUPLOAD(node3, inputName, inputData, app2) { - const imageWidget = node3.widgets.find( - (w2) => w2.name === (inputData[1]?.widget ?? "image") - ); - let uploadWidget; - function showImage(name2) { - const img = new Image(); - img.onload = () => { - node3.imgs = [img]; - app2.graph.setDirtyCanvas(true); - }; - let folder_separator = name2.lastIndexOf("/"); - let subfolder = ""; - if (folder_separator > -1) { - subfolder = name2.substring(0, folder_separator); - name2 = name2.substring(folder_separator + 1); - } - img.src = api.apiURL( - `/view?filename=${encodeURIComponent(name2)}&type=input&subfolder=${subfolder}${app2.getPreviewFormatParam()}${app2.getRandParam()}` - ); - node3.setSizeForImage?.(); - } - __name(showImage, "showImage"); - var default_value = imageWidget.value; - Object.defineProperty(imageWidget, "value", { - set: /* @__PURE__ */ __name(function(value4) { - this._real_value = value4; - }, "set"), - get: /* @__PURE__ */ __name(function() { - if (!this._real_value) { - return default_value; - } - let value4 = this._real_value; - if (value4.filename) { - let real_value = value4; - value4 = ""; - if (real_value.subfolder) { - value4 = real_value.subfolder + "/"; - } - value4 += real_value.filename; - if (real_value.type && real_value.type !== "input") - value4 += ` [${real_value.type}]`; - } - return value4; - }, "get") - }); - const cb = node3.callback; - imageWidget.callback = function() { - showImage(imageWidget.value); - if (cb) { - return cb.apply(this, arguments); - } - }; - requestAnimationFrame(() => { - if (imageWidget.value) { - showImage(imageWidget.value); - } - }); - async function uploadFile2(file, updateNode, pasted = false) { - try { - const body = new FormData(); - body.append("image", file); - if (pasted) body.append("subfolder", "pasted"); - const resp = await api.fetchApi("/upload/image", { - method: "POST", - body - }); - if (resp.status === 200) { - const data26 = await resp.json(); - let path = data26.name; - if (data26.subfolder) path = data26.subfolder + "/" + path; - if (!imageWidget.options.values.includes(path)) { - imageWidget.options.values.push(path); - } - if (updateNode) { - showImage(path); - imageWidget.value = path; - } - } else { - useToastStore().addAlert(resp.status + " - " + resp.statusText); - } - } catch (error2) { - useToastStore().addAlert(error2); - } - } - __name(uploadFile2, "uploadFile"); - const fileInput2 = document.createElement("input"); - Object.assign(fileInput2, { - type: "file", - accept: "image/jpeg,image/png,image/webp", - style: "display: none", - onchange: /* @__PURE__ */ __name(async () => { - if (fileInput2.files.length) { - await uploadFile2(fileInput2.files[0], true); - } - }, "onchange") - }); - document.body.append(fileInput2); - uploadWidget = node3.addWidget("button", inputName, "image", () => { - fileInput2.click(); - }); - uploadWidget.label = "choose file to upload"; - uploadWidget.serialize = false; - node3.onDragOver = function(e2) { - if (e2.dataTransfer && e2.dataTransfer.items) { - const image2 = [...e2.dataTransfer.items].find((f2) => f2.kind === "file"); - return !!image2; - } - return false; - }; - node3.onDragDrop = function(e2) { - console.log("onDragDrop called"); - let handled = false; - for (const file of e2.dataTransfer.files) { - if (file.type.startsWith("image/")) { - uploadFile2(file, !handled); - handled = true; - } - } - return handled; - }; - node3.pasteFile = function(file) { - if (file.type.startsWith("image/")) { - const is_pasted = file.name === "image.png" && file.lastModified - Date.now() < 2e3; - uploadFile2(file, true, is_pasted); - return true; - } - return false; - }; - return { widget: uploadWidget }; - } + "INT:seed": SeedWidget, + "INT:noise_seed": SeedWidget, + INT: useIntWidget(), + FLOAT: useFloatWidget(), + BOOLEAN: useBooleanWidget(), + STRING: useStringWidget(), + MARKDOWN: useMarkdownWidget(), + COMBO: useComboWidget(), + IMAGEUPLOAD: useImageUploadWidget() }; window.comfyAPI = window.comfyAPI || {}; window.comfyAPI.widgets = window.comfyAPI.widgets || {}; @@ -192744,11 +193821,33 @@ const useWidgetStore = /* @__PURE__ */ defineStore("widget", () => { }; } __name(registerCustomWidgets, "registerCustomWidgets"); + function getDefaultValue(inputData) { + if (Array.isArray(inputData[0])) + return getDefaultValue(transformComboInput(inputData)); + const widgetType = getWidgetType(inputData[0], inputData[1]?.name); + const [_2, props] = inputData; + if (!props) return void 0; + if (props.default) return props.default; + if (widgetType === "COMBO" && props.options?.length) return props.options[0]; + if (props.remote) return "Loading..."; + return void 0; + } + __name(getDefaultValue, "getDefaultValue"); + const transformComboInput = /* @__PURE__ */ __name((inputData) => { + return isComboInputSpecV1(inputData) ? [ + "COMBO", + { + options: inputData[0], + ...Object(inputData[1] || {}) + } + ] : inputData; + }, "transformComboInput"); return { widgets, getWidgetType, inputIsWidget, - registerCustomWidgets + registerCustomWidgets, + getDefaultValue }; }); var addonFit$2 = { exports: {} }; @@ -199050,12 +200149,13 @@ __name(useTerminal, "useTerminal"); const _hoisted_1$q = { class: "p-terminal rounded-none h-full w-full p-2" }; const _sfc_main$t = /* @__PURE__ */ defineComponent({ __name: "BaseTerminal", - emits: ["created"], + emits: ["created", "unmounted"], setup(__props, { emit: __emit }) { const emit2 = __emit; const terminalEl = ref(); const rootEl = ref(); emit2("created", useTerminal(terminalEl), rootEl); + onUnmounted(() => emit2("unmounted")); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: "relative overflow-hidden h-full w-full bg-black", @@ -199073,7 +200173,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({ }; } }); -const BaseTerminal = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-250ab9af"]]); +const BaseTerminal = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-873a313f"]]); const _sfc_main$s = /* @__PURE__ */ defineComponent({ __name: "CommandTerminal", setup(__props) { @@ -199115,7 +200215,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({ }; } }); -const CommandTerminal = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-90a7f075"]]); +const CommandTerminal = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-14fef2e4"]]); const useExecutionStore = /* @__PURE__ */ defineStore("execution", () => { const clientId = ref(null); const activePromptId = ref(null); @@ -199331,7 +200431,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({ }; } }); -const LogsTerminal = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-03daf1c8"]]); +const LogsTerminal = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-cf0c7d52"]]); const useLogsTerminalTab = /* @__PURE__ */ __name(() => { const { t: t2 } = useI18n(); return { @@ -199422,7 +200522,7 @@ const useExtensionService = /* @__PURE__ */ __name(() => { settingStore.get("Comfy.Extension.Disabled") ); const extensions = await api.getExtensions(); - await __vitePreload(() => import("./index-BYzwFNH3.js"), true ? __vite__mapDeps([30,12,31]) : void 0, import.meta.url); + await __vitePreload(() => import("./index-D9D9jjLT.js"), true ? __vite__mapDeps([34,13,35]) : void 0, import.meta.url); extensionStore.captureCoreExtensions(); await Promise.all( extensions.filter((extension) => !extension.includes("extensions/core")).map(async (ext) => { @@ -199555,12 +200655,12 @@ class ComfySettingsDialog extends ComfyDialog$1 { super(); this.app = app2; } - dispatchChange(id3, value4, oldValue2) { + dispatchChange(id3, value4, oldValue) { this.dispatchEvent( new CustomEvent(id3 + ".change", { detail: { value: value4, - oldValue: oldValue2 + oldValue } }) ); @@ -199799,9 +200899,9 @@ function dragElement(dragEl, settings) { function restorePos() { let posString = localStorage.getItem("Comfy.MenuPosition"); if (posString) { - const pos2 = JSON.parse(posString); - newPosX = pos2.x; - newPosY = pos2.y; + const pos = JSON.parse(posString); + newPosX = pos.x; + newPosY = pos.y; positionElement(); ensureInBounds(); } @@ -200197,7 +201297,7 @@ class ComfyUI { if (!useSettingStore().get("Comfy.ConfirmClear") || confirm("Clear workflow?")) { app$1.clean(); app$1.graph.clear(); - app$1.resetView(); + useLitegraphService().resetView(); api.dispatchCustomEvent("graphCleared"); } }, "onclick") @@ -200207,7 +201307,7 @@ class ComfyUI { textContent: "Load Default", onclick: /* @__PURE__ */ __name(async () => { if (!useSettingStore().get("Comfy.ConfirmClear") || confirm("Load default workflow?")) { - app$1.resetView(); + useLitegraphService().resetView(); await app$1.loadGraphData(); } }, "onclick") @@ -200216,7 +201316,7 @@ class ComfyUI { id: "comfy-reset-view-button", textContent: "Reset View", onclick: /* @__PURE__ */ __name(async () => { - app$1.resetView(); + useLitegraphService().resetView(); }, "onclick") }) ] @@ -200337,9 +201437,26 @@ window.comfyAPI = window.comfyAPI || {}; window.comfyAPI.imagePreview = window.comfyAPI.imagePreview || {}; window.comfyAPI.imagePreview.calculateImageGrid = calculateImageGrid; window.comfyAPI.imagePreview.createImageHost = createImageHost; +const useTitleEditorStore = /* @__PURE__ */ defineStore("titleEditor", () => { + const titleEditorTarget = shallowRef(null); + return { + titleEditorTarget + }; +}); +const useCanvasStore = /* @__PURE__ */ defineStore("canvas", () => { + const canvas2 = shallowRef(null); + return { + canvas: canvas2 + }; +}); +function isImageNode(node3) { + return node3.imgs || node3 && node3.widgets && node3.widgets.findIndex((obj) => obj.name === "image") >= 0; +} +__name(isImageNode, "isImageNode"); const useLitegraphService = /* @__PURE__ */ __name(() => { const extensionService = useExtensionService(); const toastStore = useToastStore(); + const canvasStore = useCanvasStore(); async function registerNodeDef(nodeId, nodeData) { const node3 = class ComfyNode extends LGraphNode { static { @@ -200499,11 +201616,11 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { await writeImage(blob); } catch (error2) { if (blob.type !== "image/png") { - const canvas = $el("canvas", { + const canvas2 = $el("canvas", { width: img.naturalWidth, height: img.naturalHeight }); - const ctx = canvas.getContext("2d"); + const ctx = canvas2.getContext("2d"); let image2; if (typeof window.createImageBitmap === "undefined") { image2 = new Image(); @@ -200520,7 +201637,7 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { } try { ctx.drawImage(image2, 0, 0); - canvas.toBlob(writeImage, "image/png"); + canvas2.toBlob(writeImage, "image/png"); } finally { if (typeof image2.close === "function") { image2.close(); @@ -200603,7 +201720,7 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { }, "callback") }); } - if (ComfyApp.isImageNode(this)) { + if (isImageNode(this)) { options4.push({ content: "Open in MaskEditor", callback: /* @__PURE__ */ __name((obj) => { @@ -200712,12 +201829,12 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { ); if (this.animatedImages) { if (widgetIdx > -1) { - const widget2 = this.widgets[widgetIdx]; - widget2.options.host.updateImages(this.imgs); + const widget = this.widgets[widgetIdx]; + widget.options.host.updateImages(this.imgs); } else { const host = createImageHost(this); this.setSizeForImage(true); - const widget2 = this.addDOMWidget( + const widget = this.addDOMWidget( ANIM_PREVIEW_WIDGET, "img", host.el, @@ -200728,8 +201845,8 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { hideOnZoom: false } ); - widget2.serializeValue = () => void 0; - widget2.options.host.updateImages(this.imgs); + widget.serializeValue = () => void 0; + widget.options.host.updateImages(this.imgs); } return; } @@ -200737,9 +201854,9 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { this.widgets[widgetIdx].onRemove?.(); this.widgets.splice(widgetIdx, 1); } - const canvas = app$1.graph.list_of_graphcanvas[0]; - const mouse = canvas.graph_mouse; - if (!canvas.pointer_is_down && this.pointerDown) { + const canvas2 = app$1.graph.list_of_graphcanvas[0]; + const mouse = canvas2.graph_mouse; + if (!canvas2.pointer_is_down && this.pointerDown) { if (mouse[0] === this.pointerDown.pos[0] && mouse[1] === this.pointerDown.pos[1]) { this.imageIndex = this.pointerDown.index; } @@ -200805,14 +201922,14 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { if (anyHovered) { this.overIndex = i2; let value4 = 110; - if (canvas.pointer_is_down) { + if (canvas2.pointer_is_down) { if (!this.pointerDown || this.pointerDown.index !== i2) { this.pointerDown = { index: i2, pos: [...mouse] }; } value4 = 125; } ctx.filter = `contrast(${value4}%) brightness(${value4}%)`; - canvas.canvas.style.cursor = "pointer"; + canvas2.canvas.style.cursor = "pointer"; } } this.imageRects.push([x22, y22, cellWidth, cellHeight]); @@ -200871,8 +201988,8 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { let textFill = "#fff"; let isClicking = false; if (hovered) { - canvas.canvas.style.cursor = "pointer"; - if (canvas.pointer_is_down) { + canvas2.canvas.style.cursor = "pointer"; + if (canvas2.pointer_is_down) { fill2 = "#1e90ff"; isClicking = true; } else { @@ -200970,11 +202087,20 @@ const useLitegraphService = /* @__PURE__ */ __name(() => { app$1.canvas.animateToBounds(graphNode.boundingRect); } __name(goToNode, "goToNode"); + function resetView() { + const canvas2 = canvasStore.canvas; + if (!canvas2) return; + canvas2.ds.scale = 1; + canvas2.ds.offset = [0, 0]; + canvas2.setDirty(true, true); + } + __name(resetView, "resetView"); return { registerNodeDef, addNodeOnGraph, getCanvasCenter, - goToNode + goToNode, + resetView }; }, "useLitegraphService"); const defaultGraph = { @@ -201093,7 +202219,7 @@ const defaultGraph = { { name: "VAE", type: "VAE", links: [8], slot_index: 2 } ], properties: {}, - widgets_values: ["v1-5-pruned-emaonly.ckpt"] + widgets_values: ["v1-5-pruned-emaonly-fp16.safetensors"] } ], links: [ @@ -201184,12 +202310,12 @@ function applyTextReplacements(app2, value4) { console.warn("Multiple nodes matched", split2[0], "using first match"); } const node3 = nodes[0]; - const widget2 = node3.widgets?.find((w2) => w2.name === split2[1]); - if (!widget2) { + const widget = node3.widgets?.find((w2) => w2.name === split2[1]); + if (!widget) { console.warn("Unable to find widget", split2[1], "on node", split2[0], node3); return match2; } - return ((widget2.value ?? "") + "").replaceAll(/\/|\\/g, "_"); + return ((widget.value ?? "") + "").replaceAll(/\/|\\/g, "_"); }); } __name(applyTextReplacements, "applyTextReplacements"); @@ -203630,13 +204756,16 @@ const useWorkflowService = /* @__PURE__ */ __name(() => { } ); }, "openWorkflow"); - const closeWorkflow = /* @__PURE__ */ __name(async (workflow, options4 = { warnIfUnsaved: true }) => { + const closeWorkflow = /* @__PURE__ */ __name(async (workflow, options4 = { + warnIfUnsaved: true + }) => { if (workflow.isModified && options4.warnIfUnsaved) { const confirmed = await dialogService.confirm({ title: t("sideToolbar.workflowTab.dirtyCloseTitle"), type: "dirtyClose", message: t("sideToolbar.workflowTab.dirtyClose"), - itemList: [workflow.path] + itemList: [workflow.path], + hint: options4.hint }); if (confirmed === null) return false; if (confirmed === true) { @@ -203716,20 +204845,20 @@ const useWorkflowService = /* @__PURE__ */ __name(() => { loadedWorkflow.changeTracker.reset(workflowData); loadedWorkflow.changeTracker.restore(); }, "afterLoadNewGraph"); - const insertWorkflow = /* @__PURE__ */ __name(async (workflow) => { + const insertWorkflow = /* @__PURE__ */ __name(async (workflow, options4 = {}) => { const loadedWorkflow = await workflow.load(); const data26 = loadedWorkflow.initialState; const old = localStorage.getItem("litegrapheditor_clipboard"); const graph = new LGraph(data26); const canvasElement = document.createElement("canvas"); - const canvas = new LGraphCanvas(canvasElement, graph, { + const canvas2 = new LGraphCanvas(canvasElement, graph, { skip_events: true, skip_render: true }); - canvas.reroutesEnabled = app$1.canvas.reroutesEnabled; - canvas.selectItems(); - canvas.copyToClipboard(); - app$1.canvas.pasteFromClipboard(); + canvas2.reroutesEnabled = app$1.canvas.reroutesEnabled; + canvas2.selectItems(); + canvas2.copyToClipboard(); + app$1.canvas.pasteFromClipboard(options4); if (old !== null) { localStorage.setItem("litegrapheditor_clipboard", old); } @@ -206074,17 +207203,17 @@ function serialise(nodes, graph) { return JSON.stringify(serialisable); } __name(serialise, "serialise"); -function deserialiseAndCreate(data26, canvas) { +function deserialiseAndCreate(data26, canvas2) { if (!data26) return; - const { graph, graph_mouse } = canvas; - canvas.emitBeforeChange(); + const { graph, graph_mouse } = canvas2; + canvas2.emitBeforeChange(); try { graph.beforeChange(); const deserialised = JSON.parse(data26); const topLeft = [Infinity, Infinity]; - for (const { pos: pos2 } of deserialised.nodes) { - if (topLeft[0] > pos2[0]) topLeft[0] = pos2[0]; - if (topLeft[1] > pos2[1]) topLeft[1] = pos2[1]; + for (const { pos } of deserialised.nodes) { + if (topLeft[0] > pos[0]) topLeft[0] = pos[0]; + if (topLeft[1] > pos[1]) topLeft[1] = pos[1]; } if (!Number.isFinite(topLeft[0]) || !Number.isFinite(topLeft[1])) { topLeft[0] = graph_mouse[0]; @@ -206107,10 +207236,10 @@ function deserialiseAndCreate(data26, canvas) { if (outNode && inNode) outNode.connect(info[1], inNode, info[3]); else console.warn("Warning, nodes missing on pasting"); } - canvas.selectNodes(nodes); + canvas2.selectNodes(nodes); graph.afterChange(); } finally { - canvas.emitAfterChange(); + canvas2.emitAfterChange(); } } __name(deserialiseAndCreate, "deserialiseAndCreate"); @@ -206384,7 +207513,7 @@ async function importA1111(graph, parameters) { const getWidget = /* @__PURE__ */ __name((node3, name2) => { return node3.widgets.find((w2) => w2.name === name2); }, "getWidget"); - const setWidgetValue2 = /* @__PURE__ */ __name((node3, name2, value4, isOptionPrefix) => { + const setWidgetValue = /* @__PURE__ */ __name((node3, name2, value4, isOptionPrefix) => { const w2 = getWidget(node3, name2); if (isOptionPrefix) { const o2 = w2.options.values.find((w22) => w22.startsWith(value4)); @@ -206413,9 +207542,9 @@ async function importA1111(graph, parameters) { for (const l2 of loras) { const loraNode = LiteGraph.createNode("LoraLoader"); graph.add(loraNode); - setWidgetValue2(loraNode, "lora_name", l2.name, true); - setWidgetValue2(loraNode, "strength_model", l2.weight); - setWidgetValue2(loraNode, "strength_clip", l2.weight); + setWidgetValue(loraNode, "lora_name", l2.name, true); + setWidgetValue(loraNode, "strength_model", l2.weight); + setWidgetValue(loraNode, "strength_clip", l2.weight); prevModel.node.connect(prevModel.index, loraNode, 0); prevClip.node.connect(prevClip.index, loraNode, 1); prevModel = { node: loraNode, index: 0 }; @@ -206465,31 +207594,31 @@ async function importA1111(graph, parameters) { vaeLoaderNode.connect(0, vaeNode, 1); const handlers2 = { model(v2) { - setWidgetValue2(ckptNode, "ckpt_name", v2, true); + setWidgetValue(ckptNode, "ckpt_name", v2, true); }, vae(v2) { - setWidgetValue2(vaeLoaderNode, "vae_name", v2, true); + setWidgetValue(vaeLoaderNode, "vae_name", v2, true); }, "cfg scale"(v2) { - setWidgetValue2(samplerNode, "cfg", +v2); + setWidgetValue(samplerNode, "cfg", +v2); }, "clip skip"(v2) { - setWidgetValue2(clipSkipNode, "stop_at_clip_layer", -v2); + setWidgetValue(clipSkipNode, "stop_at_clip_layer", -v2); }, sampler(v2) { let name2 = v2.toLowerCase().replace("++", "pp").replaceAll(" ", "_"); if (name2.includes("karras")) { name2 = name2.replace("karras", "").replace(/_+$/, ""); - setWidgetValue2(samplerNode, "scheduler", "karras"); + setWidgetValue(samplerNode, "scheduler", "karras"); } else { - setWidgetValue2(samplerNode, "scheduler", "normal"); + setWidgetValue(samplerNode, "scheduler", "normal"); } const w2 = getWidget(samplerNode, "sampler_name"); const o2 = w2.options.values.find( (w22) => w22 === name2 || w22 === "sample_" + name2 ); if (o2) { - setWidgetValue2(samplerNode, "sampler_name", o2); + setWidgetValue(samplerNode, "sampler_name", o2); } }, size(v2) { @@ -206500,8 +207629,8 @@ async function importA1111(graph, parameters) { const hrSz = popOpt("hires resize"); hrSteps = popOpt("hires steps"); let hrMethod = popOpt("hires upscaler"); - setWidgetValue2(imageNode, "width", w2); - setWidgetValue2(imageNode, "height", h2); + setWidgetValue(imageNode, "width", w2); + setWidgetValue(imageNode, "height", h2); if (hrUp || hrSz) { let uw, uh; if (hrUp) { @@ -206523,7 +207652,7 @@ async function importA1111(graph, parameters) { hrMethod = "nearest-exact"; break; } - setWidgetValue2(upscaleNode, "upscale_method", hrMethod, true); + setWidgetValue(upscaleNode, "upscale_method", hrMethod, true); } else { const decode2 = LiteGraph.createNode("VAEDecodeTiled"); graph.add(decode2); @@ -206531,7 +207660,7 @@ async function importA1111(graph, parameters) { vaeLoaderNode.connect(0, decode2, 1); const upscaleLoaderNode = LiteGraph.createNode("UpscaleModelLoader"); graph.add(upscaleLoaderNode); - setWidgetValue2(upscaleLoaderNode, "model_name", hrMethod, true); + setWidgetValue(upscaleLoaderNode, "model_name", hrMethod, true); const modelUpscaleNode = LiteGraph.createNode( "ImageUpscaleWithModel" ); @@ -206546,8 +207675,8 @@ async function importA1111(graph, parameters) { upscaleNode.connect(0, vaeEncodeNode, 0); vaeLoaderNode.connect(0, vaeEncodeNode, 1); } - setWidgetValue2(upscaleNode, "width", ceil64(uw)); - setWidgetValue2(upscaleNode, "height", ceil64(uh)); + setWidgetValue(upscaleNode, "width", ceil64(uw)); + setWidgetValue(upscaleNode, "height", ceil64(uh)); hrSamplerNode = LiteGraph.createNode("KSampler"); graph.add(hrSamplerNode); ckptNode.connect(0, hrSamplerNode, 0); @@ -206558,10 +207687,10 @@ async function importA1111(graph, parameters) { } }, steps(v2) { - setWidgetValue2(samplerNode, "steps", +v2); + setWidgetValue(samplerNode, "steps", +v2); }, seed(v2) { - setWidgetValue2(samplerNode, "seed", +v2); + setWidgetValue(samplerNode, "seed", +v2); } }; for (const opt in opts) { @@ -206570,27 +207699,27 @@ async function importA1111(graph, parameters) { } } if (hrSamplerNode) { - setWidgetValue2( + setWidgetValue( hrSamplerNode, "steps", hrSteps ? +hrSteps : getWidget(samplerNode, "steps").value ); - setWidgetValue2( + setWidgetValue( hrSamplerNode, "cfg", getWidget(samplerNode, "cfg").value ); - setWidgetValue2( + setWidgetValue( hrSamplerNode, "scheduler", getWidget(samplerNode, "scheduler").value ); - setWidgetValue2( + setWidgetValue( hrSamplerNode, "sampler_name", getWidget(samplerNode, "sampler_name").value ); - setWidgetValue2( + setWidgetValue( hrSamplerNode, "denoise", +(popOpt("denoising strength") || "1") @@ -206605,8 +207734,8 @@ async function importA1111(graph, parameters) { positive = n2.text; n2 = createLoraNodes(negativeNode, negative, n2.prevClip, n2.prevModel); negative = n2.text; - setWidgetValue2(positiveNode, "text", replaceEmbeddings(positive)); - setWidgetValue2(negativeNode, "text", replaceEmbeddings(negative)); + setWidgetValue(positiveNode, "text", replaceEmbeddings(positive)); + setWidgetValue(negativeNode, "text", replaceEmbeddings(negative)); graph.arrange(); for (const opt of [ "model hash", @@ -207403,8 +208532,6 @@ class ComfyApp { canvas; dragOverNode; canvasEl; - // x, y, scale - zoom_drag_start; lastNodeErrors; /** @type {ExecutionErrorWsMessage} */ lastExecutionError; @@ -207467,17 +208594,28 @@ class ComfyApp { get progress() { return useExecutionStore()._executingNodeProgress; } + /** + * @deprecated Use {@link isImageNode} from @/utils/litegraphUtil instead + */ + static isImageNode(node3) { + return isImageNode(node3); + } + /** + * Resets the canvas view to the default + * @deprecated Use {@link useLitegraphService().resetView} instead + */ + resetView() { + useLitegraphService().resetView(); + } constructor() { this.vueAppReady = false; this.ui = new ComfyUI(this); this.api = api; - this.bodyTop = $el("div.comfyui-body-top", { parent: document.body }); - this.bodyLeft = $el("div.comfyui-body-left", { parent: document.body }); - this.bodyRight = $el("div.comfyui-body-right", { parent: document.body }); - this.bodyBottom = $el("div.comfyui-body-bottom", { parent: document.body }); - this.canvasContainer = $el("div.graph-canvas-container", { - parent: document.body - }); + this.bodyTop = $el("div.comfyui-body-top"); + this.bodyLeft = $el("div.comfyui-body-left"); + this.bodyRight = $el("div.comfyui-body-right"); + this.bodyBottom = $el("div.comfyui-body-bottom"); + this.canvasContainer = $el("div.graph-canvas-container"); this.menu = new ComfyAppMenu(this); this.bypassBgColor = "#FF00FF"; this.nodeOutputs = {}; @@ -207499,9 +208637,6 @@ class ComfyApp { getRandParam() { return "&rand=" + Math.random(); } - static isImageNode(node3) { - return node3.imgs || node3 && node3.widgets && node3.widgets.findIndex((obj) => obj.name === "image") >= 0; - } static onClipspaceEditorSave() { if (ComfyApp.clipspace_return_node) { ComfyApp.pasteFromClipspace(ComfyApp.clipspace_return_node); @@ -207685,113 +208820,6 @@ class ComfyApp { false ); } - /** - * Adds a handler on paste that extracts and loads images or workflows from pasted JSON data - */ - #addPasteHandler() { - document.addEventListener("paste", async (e2) => { - if (this.shiftDown) return; - let data26 = e2.clipboardData || window.clipboardData; - const items2 = data26.items; - for (const item3 of items2) { - if (item3.type.startsWith("image/")) { - var imageNode = null; - if (this.canvas.current_node && this.canvas.current_node.is_selected && ComfyApp.isImageNode(this.canvas.current_node)) { - imageNode = this.canvas.current_node; - } - if (!imageNode) { - const newNode = LiteGraph.createNode("LoadImage"); - newNode.pos = [...this.canvas.graph_mouse]; - imageNode = this.graph.add(newNode); - this.graph.change(); - } - const blob = item3.getAsFile(); - imageNode.pasteFile(blob); - return; - } - } - data26 = data26.getData("text/plain"); - let workflow = null; - try { - data26 = data26.slice(data26.indexOf("{")); - workflow = JSON.parse(data26); - } catch (err) { - try { - data26 = data26.slice(data26.indexOf("workflow\n")); - data26 = data26.slice(data26.indexOf("{")); - workflow = JSON.parse(data26); - } catch (error2) { - workflow = null; - } - } - if (workflow && workflow.version && workflow.nodes && workflow.extra) { - await this.loadGraphData(workflow); - } else { - if (e2.target instanceof HTMLTextAreaElement && e2.target.type === "textarea" || e2.target instanceof HTMLInputElement && e2.target.type === "text") { - return; - } - this.canvas.pasteFromClipboard(); - } - }); - } - /** - * Adds a handler on copy that serializes selected nodes to JSON - */ - #addCopyHandler() { - document.addEventListener("copy", (e2) => { - if (!(e2.target instanceof Element)) { - return; - } - if (e2.target instanceof HTMLTextAreaElement && e2.target.type === "textarea" || e2.target instanceof HTMLInputElement && e2.target.type === "text") { - return; - } - const isTargetInGraph = e2.target.classList.contains("litegraph") || e2.target.classList.contains("graph-canvas-container") || e2.target.id === "graph-canvas"; - if (isTargetInGraph && this.canvas.selected_nodes) { - this.canvas.copyToClipboard(); - e2.clipboardData.setData("text", " "); - e2.preventDefault(); - e2.stopImmediatePropagation(); - return false; - } - }); - } - /** - * Handle mouse - * - * Move group by header - */ - #addProcessMouseHandler() { - const self2 = this; - const origProcessMouseDown = LGraphCanvas.prototype.processMouseDown; - LGraphCanvas.prototype.processMouseDown = function(e2) { - const useFastZoom = useSettingStore().get("Comfy.Graph.CtrlShiftZoom"); - if (useFastZoom && e2.ctrlKey && e2.shiftKey && !e2.altKey && e2.buttons) { - self2.zoom_drag_start = [e2.x, e2.y, this.ds.scale]; - return; - } - const res = origProcessMouseDown.apply(this, arguments); - return res; - }; - const origProcessMouseMove = LGraphCanvas.prototype.processMouseMove; - LGraphCanvas.prototype.processMouseMove = function(e2) { - if (e2.ctrlKey && e2.shiftKey && self2.zoom_drag_start) { - if (!e2.buttons) { - self2.zoom_drag_start = null; - return; - } - let deltaY = e2.y - self2.zoom_drag_start[1]; - let startScale = self2.zoom_drag_start[2]; - let scale = startScale - deltaY / 100; - this.ds.changeScale(scale, [ - self2.zoom_drag_start[0], - self2.zoom_drag_start[1] - ]); - this.graph.change(); - return; - } - return origProcessMouseMove.apply(this, arguments); - }; - } /** * Handle keypress */ @@ -207829,40 +208857,6 @@ class ComfyApp { return origProcessKey.apply(this, arguments); }; } - /** - * Draws group header bar - */ - #addDrawGroupsHandler() { - const self2 = this; - const origDrawGroups = LGraphCanvas.prototype.drawGroups; - LGraphCanvas.prototype.drawGroups = function(canvas, ctx) { - if (!this.graph) { - return; - } - var groups = this.graph.groups; - ctx.save(); - ctx.globalAlpha = 0.7 * this.editor_alpha; - for (var i2 = 0; i2 < groups.length; ++i2) { - var group = groups[i2]; - if (!LiteGraph.overlapBounding(this.visible_area, group._bounding)) { - continue; - } - ctx.fillStyle = group.color || "#335"; - ctx.strokeStyle = group.color || "#335"; - var pos2 = group._pos; - var size = group._size; - ctx.globalAlpha = 0.25 * this.editor_alpha; - ctx.beginPath(); - var font_size = group.font_size || LiteGraph.DEFAULT_GROUP_FONT_SIZE; - ctx.rect(pos2[0] + 0.5, pos2[1] + 0.5, size[0], font_size * 1.4); - ctx.fill(); - ctx.globalAlpha = this.editor_alpha; - } - ctx.restore(); - const res = origDrawGroups.apply(this, arguments); - return res; - }; - } /** * Draws node highlights (executing, drag drop) and progress bar */ @@ -207886,45 +208880,19 @@ class ComfyApp { lineWidth = 2; } if (color2) { - const shape = node3._shape || node3.constructor.shape || LiteGraph.ROUND_SHAPE; - ctx.lineWidth = lineWidth; - ctx.globalAlpha = 0.8; - ctx.beginPath(); - if (shape == LiteGraph.BOX_SHAPE) - ctx.rect( - -6, - -6 - LiteGraph.NODE_TITLE_HEIGHT, - 12 + size[0] + 1, - 12 + size[1] + LiteGraph.NODE_TITLE_HEIGHT - ); - else if (shape == LiteGraph.ROUND_SHAPE || shape == LiteGraph.CARD_SHAPE && node3.flags.collapsed) - ctx.roundRect( - -6, - -6 - LiteGraph.NODE_TITLE_HEIGHT, - 12 + size[0] + 1, - 12 + size[1] + LiteGraph.NODE_TITLE_HEIGHT, - this.round_radius * 2 - ); - else if (shape == LiteGraph.CARD_SHAPE) - ctx.roundRect( - -6, - -6 - LiteGraph.NODE_TITLE_HEIGHT, - 12 + size[0] + 1, - 12 + size[1] + LiteGraph.NODE_TITLE_HEIGHT, - [this.round_radius * 2, this.round_radius * 2, 2, 2] - ); - else if (shape == LiteGraph.CIRCLE_SHAPE) - ctx.arc( - size[0] * 0.5, - size[1] * 0.5, - size[0] * 0.5 + 6, - 0, - Math.PI * 2 - ); - ctx.strokeStyle = color2; - ctx.stroke(); - ctx.strokeStyle = fgcolor; - ctx.globalAlpha = 1; + const area = [ + 0, + -LiteGraph.NODE_TITLE_HEIGHT, + size[0], + size[1] + LiteGraph.NODE_TITLE_HEIGHT + ]; + strokeShape(ctx, area, { + shape: node3._shape || node3.constructor.shape || LiteGraph.ROUND_SHAPE, + thickness: lineWidth, + colour: color2, + title_height: LiteGraph.NODE_TITLE_HEIGHT, + collapsed: node3.collapsed + }); } if (self2.progress && node3.id === +self2.runningNodeId) { ctx.fillStyle = "green"; @@ -207943,11 +208911,11 @@ class ComfyApp { if (error2.extra_info && error2.extra_info.input_name) { const inputIndex = node3.findInputSlot(error2.extra_info.input_name); if (inputIndex !== -1) { - let pos2 = node3.getConnectionPos(true, inputIndex); + let pos = node3.getConnectionPos(true, inputIndex); ctx.beginPath(); ctx.arc( - pos2[0] - node3.pos[0], - pos2[1] - node3.pos[1], + pos[0] - node3.pos[0], + pos[1] - node3.pos[1], 12, 0, 2 * Math.PI, @@ -208077,11 +209045,15 @@ class ComfyApp { * Set up the app on the page */ async setup(canvasEl) { + this.bodyTop = document.getElementById("comfyui-body-top"); + this.bodyLeft = document.getElementById("comfyui-body-left"); + this.bodyRight = document.getElementById("comfyui-body-right"); + this.bodyBottom = document.getElementById("comfyui-body-bottom"); + this.canvasContainer = document.getElementById("graph-canvas-container"); this.canvasEl = canvasEl; this.resizeCanvas(); await useWorkspaceStore().workflow.syncWorkflows(); await useExtensionService().loadExtensions(); - this.#addProcessMouseHandler(); this.#addProcessKeyHandler(); this.#addConfigureHandler(); this.#addApiUpdateHandlers(); @@ -208103,10 +209075,7 @@ class ComfyApp { await useExtensionService().invokeExtensionsAsync("init"); await this.registerNodes(); this.#addDrawNodeHandler(); - this.#addDrawGroupsHandler(); this.#addDropHandler(); - this.#addCopyHandler(); - this.#addPasteHandler(); await useExtensionService().invokeExtensionsAsync("setup"); } resizeCanvas() { @@ -208310,8 +209279,8 @@ class ComfyApp { } catch (error2) { let errorHint = []; const filename = error2.fileName || (error2.stack || "").match(/(\/extensions\/.*\.js)/)?.[1]; - const pos2 = (filename || "").indexOf("/extensions/"); - if (pos2 > -1) { + const pos = (filename || "").indexOf("/extensions/"); + if (pos > -1) { errorHint.push( $el("span", { textContent: "This may be due to the following script:" @@ -208321,7 +209290,7 @@ class ComfyApp { style: { fontWeight: "bold" }, - textContent: filename.substring(pos2) + textContent: filename.substring(pos) }) ); } @@ -208356,27 +209325,27 @@ class ComfyApp { size[1] = Math.max(node3.size[1], size[1]); node3.size = size; if (node3.widgets) { - for (let widget2 of node3.widgets) { + for (let widget of node3.widgets) { if (node3.type == "KSampler" || node3.type == "KSamplerAdvanced") { - if (widget2.name == "sampler_name") { - if (typeof widget2.value === "string" && widget2.value.startsWith("sample_")) { - widget2.value = widget2.value.slice(7); + if (widget.name == "sampler_name") { + if (typeof widget.value === "string" && widget.value.startsWith("sample_")) { + widget.value = widget.value.slice(7); } } } if (node3.type == "KSampler" || node3.type == "KSamplerAdvanced" || node3.type == "PrimitiveNode") { - if (widget2.name == "control_after_generate") { - if (widget2.value === true) { - widget2.value = "randomize"; - } else if (widget2.value === false) { - widget2.value = "fixed"; + if (widget.name == "control_after_generate") { + if (widget.value === true) { + widget.value = "randomize"; + } else if (widget.value === false) { + widget.value = "fixed"; } } } if (reset_invalid_values) { - if (widget2.type == "combo") { - if (!widget2.options.values.includes(widget2.value) && widget2.options.values.length > 0) { - widget2.value = widget2.options.values[0]; + if (widget.type == "combo") { + if (!widget.options.values.includes(widget.value) && widget.options.values.length > 0) { + widget.value = widget.options.values[0]; } } } @@ -208421,8 +209390,8 @@ class ComfyApp { async graphToPrompt(graph = this.graph, clean = true) { for (const outerNode of graph.computeExecutionOrder(false)) { if (outerNode.widgets) { - for (const widget2 of outerNode.widgets) { - widget2.beforeQueued?.(); + for (const widget of outerNode.widgets) { + widget.beforeQueued?.(); } } const innerNodes = outerNode.getInnerNodes ? outerNode.getInnerNodes() : [outerNode]; @@ -208457,14 +209426,14 @@ class ComfyApp { const inputs = {}; const widgets = node3.widgets; if (widgets) { - for (const i2 in widgets) { - const widget2 = widgets[i2]; - if (!widget2.options || widget2.options.serialize !== false) { - inputs[widget2.name] = widget2.serializeValue ? await widget2.serializeValue(node3, i2) : widget2.value; + for (let i2 = 0; i2 < widgets.length; i2++) { + const widget = widgets[i2]; + if (!widget.options || widget.options.serialize !== false) { + inputs[widget.name] = widget.serializeValue ? await widget.serializeValue(node3, i2) : widget.value; } } } - for (let i2 in node3.inputs) { + for (let i2 = 0; i2 < node3.inputs.length; i2++) { let parent = node3.getInputNode(i2); if (parent) { let link2 = node3.getInputLink(i2); @@ -208506,6 +209475,7 @@ class ComfyApp { if (link2) { inputs[node3.inputs[i2].name] = [ String(link2.origin_id), + // @ts-expect-error link.origin_slot is already number. parseInt(link2.origin_slot) ]; } @@ -208596,9 +209566,9 @@ class ComfyApp { for (const n2 of p2.workflow.nodes) { const node3 = this.graph.getNodeById(n2.id); if (node3.widgets) { - for (const widget2 of node3.widgets) { - if (widget2.afterQueued) { - widget2.afterQueued(); + for (const widget of node3.widgets) { + if (widget.afterQueued) { + widget.afterQueued(); } } } @@ -208746,8 +209716,8 @@ class ComfyApp { let toSlot = node3.inputs?.findIndex((inp) => inp.name === input); if (toSlot == null || toSlot === -1) { try { - const widget2 = node3.widgets?.find((w2) => w2.name === input); - if (widget2 && node3.convertWidgetToInput?.(widget2)) { + const widget = node3.widgets?.find((w2) => w2.name === input); + if (widget && node3.convertWidgetToInput?.(widget)) { toSlot = node3.inputs?.length - 1; } } catch (error2) { @@ -208757,10 +209727,10 @@ class ComfyApp { fromNode.connect(fromSlot, node3, toSlot); } } else { - const widget2 = node3.widgets?.find((w2) => w2.name === input); - if (widget2) { - widget2.value = value4; - widget2.callback?.(value4); + const widget = node3.widgets?.find((w2) => w2.name === input); + if (widget) { + widget.value = value4; + widget.callback?.(value4); } } } @@ -208777,8 +209747,8 @@ class ComfyApp { let toSlot = node3.inputs?.findIndex((inp) => inp.name === input); if (toSlot == null || toSlot === -1) { try { - const widget2 = node3.widgets?.find((w2) => w2.name === input); - if (widget2 && node3.convertWidgetToInput?.(widget2)) { + const widget = node3.widgets?.find((w2) => w2.name === input); + if (widget && node3.convertWidgetToInput?.(widget)) { toSlot = node3.inputs?.length - 1; } } catch (error2) { @@ -208788,10 +209758,10 @@ class ComfyApp { fromNode.connect(fromSlot, node3, toSlot); } } else { - const widget2 = node3.widgets?.find((w2) => w2.name === input); - if (widget2) { - widget2.value = value4; - widget2.callback?.(value4); + const widget = node3.widgets?.find((w2) => w2.name === input); + if (widget) { + widget.value = value4; + widget.callback?.(value4); } } } @@ -208829,9 +209799,9 @@ class ComfyApp { node3.refreshComboInNode?.(defs); if (!def2) continue; for (const widgetNum in node3.widgets) { - const widget2 = node3.widgets[widgetNum]; - if (widget2.type == "combo" && def2["input"]["required"][widget2.name] !== void 0) { - widget2.options.values = def2["input"]["required"][widget2.name][0]; + const widget = node3.widgets[widgetNum]; + if (widget.type == "combo" && def2["input"]["required"][widget.name] !== void 0) { + widget.options.values = def2["input"]["required"][widget.name][0]; } } } @@ -208850,11 +209820,6 @@ class ComfyApp { }); } } - resetView() { - app$1.canvas.ds.scale = 1; - app$1.canvas.ds.offset = [0, 0]; - app$1.graph.setDirtyCanvas(true, true); - } /** * Frees memory allocated to image preview blobs for a specific node, by revoking the URLs associated with them. * @param nodeId ID of the node to revoke all preview images of @@ -208877,17 +209842,17 @@ class ComfyApp { this.lastNodeErrors = null; this.lastExecutionError = null; } - clientPosToCanvasPos(pos2) { + clientPosToCanvasPos(pos) { const rect = this.canvasContainer.getBoundingClientRect(); const containerOffsets = [rect.left, rect.top]; - return _.zip(pos2, this.canvas.ds.offset, containerOffsets).map( + return _.zip(pos, this.canvas.ds.offset, containerOffsets).map( ([p2, o1, o2]) => (p2 - o2) / this.canvas.ds.scale - o1 ); } - canvasPosToClientPos(pos2) { + canvasPosToClientPos(pos) { const rect = this.canvasContainer.getBoundingClientRect(); const containerOffsets = [rect.left, rect.top]; - return _.zip(pos2, this.canvas.ds.offset, containerOffsets).map( + return _.zip(pos, this.canvas.ds.offset, containerOffsets).map( ([p2, o1, o2]) => (p2 + o1) * this.canvas.ds.scale + o2 ); } @@ -210998,11 +211963,11 @@ var script$1$7 = { }, "ariaSelected") }, components: { - Checkbox: script$K, + Checkbox: script$J, ChevronDownIcon: script$n, ChevronRightIcon: script$p, - CheckIcon: script$M, - MinusIcon: script$L, + CheckIcon: script$L, + MinusIcon: script$K, SpinnerIcon: script$X }, directives: { @@ -211455,7 +212420,7 @@ var script$b = { }, components: { TreeNode: script$1$7, - InputText: script$J, + InputText: script$I, InputIcon: script$B, IconField: script$C, SearchIcon: script$D, @@ -213411,7 +214376,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({ }; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$m, [ - !props.isEditing ? (openBlock(), createElementBlock("span", _hoisted_2$g, toDisplayString$1(_ctx.modelValue), 1)) : withDirectives((openBlock(), createBlock(unref(script$J), { + !props.isEditing ? (openBlock(), createElementBlock("span", _hoisted_2$g, toDisplayString$1(_ctx.modelValue), 1)) : withDirectives((openBlock(), createBlock(unref(script$I), { key: 1, type: "text", size: "small", @@ -213502,7 +214467,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({ const errorHandling = useErrorHandling(); const handleRename = errorHandling.wrapWithErrorHandlingAsync( async (newName) => { - await props.node.handleRename(props.node, newName); + await props.node.handleRename(newName); }, props.node.handleError, () => { @@ -213525,7 +214490,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({ onGenerateDragPreview: props.node.renderDragPreview ? ({ nativeSetDragImage }) => { setCustomNativeDragPreview({ render: /* @__PURE__ */ __name(({ container: container2 }) => { - return props.node.renderDragPreview(props.node, container2); + return props.node.renderDragPreview(container2); }, "render"), nativeSetDragImage }); @@ -213537,7 +214502,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({ onDrop: /* @__PURE__ */ __name(async (event) => { const dndData = event.source.data; if (dndData.type === "tree-explorer-node") { - await props.node.handleDrop?.(props.node, dndData); + await props.node.handleDrop?.(dndData); canDrop.value = false; emit2("itemDropped", props.node, dndData.data); } @@ -213596,7 +214561,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({ }; } }); -const TreeExplorerTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-654109c7"]]); +const TreeExplorerTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-a945b5a8"]]); const _sfc_main$o = /* @__PURE__ */ defineComponent({ __name: "TreeExplorer", props: /* @__PURE__ */ mergeModels({ @@ -213622,7 +214587,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ }); const getTreeNodeIcon = /* @__PURE__ */ __name((node3) => { if (node3.getIcon) { - const icon3 = node3.getIcon(node3); + const icon3 = node3.getIcon(); if (icon3) { return icon3; } @@ -213644,7 +214609,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ children, type: node3.leaf ? "node" : "folder", totalLeaves, - badgeText: node3.getBadgeText ? node3.getBadgeText(node3) : null + badgeText: node3.getBadgeText ? node3.getBadgeText() : null }; }, "fillNodeInfo"); const onNodeContentClick = /* @__PURE__ */ __name(async (e2, node3) => { @@ -213652,7 +214617,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ selectionKeys.value = {}; } if (node3.handleClick) { - await node3.handleClick(node3, e2); + await node3.handleClick(e2); } emit2("nodeClick", node3, e2); }, "onNodeContentClick"); @@ -213669,7 +214634,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ renameEditingNode.value = node3; }, "renameCommand"); const deleteCommand = /* @__PURE__ */ __name(async (node3) => { - await node3.handleDelete?.(node3); + await node3.handleDelete?.(); emit2("nodeDelete", node3); }, "deleteCommand"); const menuItems = computed( @@ -213762,7 +214727,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({ }; } }); -const TreeExplorer = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-976a6d58"]]); +const TreeExplorer = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-e3a237e6"]]); var theme$6 = /* @__PURE__ */ __name(function theme36(_ref) { var dt2 = _ref.dt; return "\n.p-toolbar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n padding: ".concat(dt2("toolbar.padding"), ";\n background: ").concat(dt2("toolbar.background"), ";\n border: 1px solid ").concat(dt2("toolbar.border.color"), ";\n color: ").concat(dt2("toolbar.color"), ";\n border-radius: ").concat(dt2("toolbar.border.radius"), ";\n gap: ").concat(dt2("toolbar.gap"), ";\n}\n\n.p-toolbar-start,\n.p-toolbar-center,\n.p-toolbar-end {\n display: flex;\n align-items: center;\n}\n"); @@ -213848,7 +214813,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({ }), renderSlot(_ctx.$slots, "header", {}, void 0, true) ]), - createVNode(unref(script$R), { class: "comfy-vue-side-bar-body flex-grow h-0" }, { + createVNode(unref(script$Q), { class: "comfy-vue-side-bar-body flex-grow h-0" }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "body", {}, void 0, true) ]), @@ -214331,7 +215296,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ label: model ? nameFormat === "title" ? model.title : model.simplified_file_name : node3.label, leaf: node3.leaf, data: node3.data, - getIcon: /* @__PURE__ */ __name(() => { + getIcon() { if (model) { return model.image ? "pi pi-image" : "pi pi-file"; } @@ -214339,31 +215304,31 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ return folder.state === ResourceState.Loading ? "pi pi-spin pi-spinner" : "pi pi-folder"; } return "pi pi-folder"; - }, "getIcon"), - getBadgeText: /* @__PURE__ */ __name(() => { + }, + getBadgeText() { if (!folder) { return null; } return folder.state === ResourceState.Loaded ? null : ""; - }, "getBadgeText"), + }, children, draggable: node3.leaf, - handleClick: /* @__PURE__ */ __name((node22, e2) => { - if (node22.leaf) { + handleClick(e2) { + if (this.leaf) { const provider = modelToNodeStore.getNodeProvider(model.directory); if (provider) { - const node32 = useLitegraphService().addNodeOnGraph(provider.nodeDef); - const widget2 = node32.widgets.find( - (widget22) => widget22.name === provider.key + const node22 = useLitegraphService().addNodeOnGraph(provider.nodeDef); + const widget = node22.widgets.find( + (widget2) => widget2.name === provider.key ); - if (widget2) { - widget2.value = model.file_name; + if (widget) { + widget.value = model.file_name; } } } else { - toggleNodeOnEvent(e2, node22); + toggleNodeOnEvent(e2, node3); } - }, "handleClick") + } }; }, "fillNodeInfo"); return fillNodeInfo(root29.value); @@ -214452,7 +215417,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({ }; } }); -const ModelLibrarySidebarTab = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-0bb2ac55"]]); +const ModelLibrarySidebarTab = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-3be51840"]]); const useModelLibrarySidebarTab = /* @__PURE__ */ __name(() => { const { t: t2 } = useI18n(); return { @@ -215779,7 +216744,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({ _: 1 }, 8, ["modelValue"]) ]), - createVNode(unref(script$S)), + createVNode(unref(script$R)), createBaseVNode("div", _hoisted_4$3, [ createBaseVNode("label", _hoisted_5$3, toDisplayString$1(_ctx.$t("g.color")), 1), createBaseVNode("div", _hoisted_6$2, [ @@ -215950,38 +216915,49 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ label: node3.leaf ? node3.data.display_name : node3.label, leaf: node3.leaf, data: node3.data, - getIcon: /* @__PURE__ */ __name((node22) => { - if (node22.leaf) { + getIcon() { + if (this.leaf) { return "pi pi-circle-fill"; } - const customization = nodeBookmarkStore.bookmarksCustomization[node22.data?.nodePath]; + const customization = nodeBookmarkStore.bookmarksCustomization[node3.data?.nodePath]; return customization?.icon ? "pi " + customization.icon : "pi pi-bookmark-fill"; - }, "getIcon"), + }, children: sortedChildren, draggable: node3.leaf, + renderDragPreview(container) { + const vnode = h(NodePreview, { nodeDef: node3.data }); + render$$(vnode, container); + return () => { + render$$(null, container); + }; + }, droppable: !node3.leaf, - handleDrop: /* @__PURE__ */ __name((node22, data26) => { + handleDrop(data26) { const nodeDefToAdd = data26.data.data; if (nodeBookmarkStore.isBookmarked(nodeDefToAdd)) { nodeBookmarkStore.toggleBookmark(nodeDefToAdd); } - const folderNodeDef = node22.data; + const folderNodeDef = node3.data; const nodePath = folderNodeDef.category + "/" + nodeDefToAdd.name; nodeBookmarkStore.addBookmark(nodePath); - }, "handleDrop"), - handleClick: /* @__PURE__ */ __name((node22, e2) => { - if (node22.leaf) { - useLitegraphService().addNodeOnGraph(node22.data); + }, + handleClick(e2) { + if (this.leaf) { + useLitegraphService().addNodeOnGraph(this.data); } else { - toggleNodeOnEvent(e2, node22); + toggleNodeOnEvent(e2, node3); } - }, "handleClick"), + }, contextMenuItems: extraMenuItems, ...node3.leaf ? {} : { - handleRename, - handleDelete: /* @__PURE__ */ __name((node22) => { - nodeBookmarkStore.deleteBookmarkFolder(node22.data); - }, "handleDelete") + handleRename(newName) { + if (this.data && this.data.isDummyFolder) { + nodeBookmarkStore.renameBookmarkFolder(this.data, newName); + } + }, + handleDelete() { + nodeBookmarkStore.deleteBookmarkFolder(this.data); + } } }; }, "fillNodeInfo"); @@ -216006,11 +216982,6 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({ __expose({ addNewBookmarkFolder }); - const handleRename = /* @__PURE__ */ __name((node3, newName) => { - if (node3.data && node3.data.isDummyFolder) { - nodeBookmarkStore.renameBookmarkFolder(node3.data, newName); - } - }, "handleRename"); const showCustomizationDialog = ref(false); const initialIcon = ref(nodeBookmarkStore.defaultBookmarkIcon); const initialColor = ref(nodeBookmarkStore.defaultBookmarkColor); @@ -216074,27 +217045,27 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ label: node3.leaf ? node3.data.display_name : node3.label, leaf: node3.leaf, data: node3.data, - getIcon: /* @__PURE__ */ __name((node22) => { - if (node22.leaf) { + getIcon() { + if (this.leaf) { return "pi pi-circle-fill"; } - }, "getIcon"), + }, children, draggable: node3.leaf, - renderDragPreview: /* @__PURE__ */ __name((node22, container) => { - const vnode = h(NodePreview, { nodeDef: node22.data }); + renderDragPreview(container) { + const vnode = h(NodePreview, { nodeDef: node3.data }); render$$(vnode, container); return () => { render$$(null, container); }; - }, "renderDragPreview"), - handleClick: /* @__PURE__ */ __name((node22, e2) => { - if (node22.leaf) { - useLitegraphService().addNodeOnGraph(node22.data); + }, + handleClick(e2) { + if (this.leaf) { + useLitegraphService().addNodeOnGraph(this.data); } else { - toggleNodeOnEvent(e2, node22); + toggleNodeOnEvent(e2, this); } - }, "handleClick") + } }; }, "fillNodeInfo"); return fillNodeInfo(root29.value); @@ -216211,7 +217182,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({ ref: nodeBookmarkTreeExplorerRef, "filtered-node-defs": filteredNodeDefs.value }, null, 8, ["filtered-node-defs"]), - withDirectives(createVNode(unref(script$S), { + withDirectives(createVNode(unref(script$R), { type: "dashed", class: "m-2" }, null, 512), [ @@ -217371,13 +218342,13 @@ var script$2 = { }; }, "data"), watch: { - numVisible: /* @__PURE__ */ __name(function numVisible2(newValue2, oldValue2) { + numVisible: /* @__PURE__ */ __name(function numVisible2(newValue2, oldValue) { this.d_numVisible = newValue2; - this.d_oldNumVisible = oldValue2; + this.d_oldNumVisible = oldValue; }, "numVisible"), - activeIndex: /* @__PURE__ */ __name(function activeIndex2(newValue2, oldValue2) { + activeIndex: /* @__PURE__ */ __name(function activeIndex2(newValue2, oldValue) { this.d_activeIndex = newValue2; - this.d_oldActiveItemIndex = oldValue2; + this.d_oldActiveItemIndex = oldValue; }, "activeIndex") }, mounted: /* @__PURE__ */ __name(function mounted23() { @@ -217970,10 +218941,10 @@ var script$1$1 = { }, "stopSlideShow"), getPositionClass: /* @__PURE__ */ __name(function getPositionClass(preClassName, position3) { var positions = ["top", "left", "bottom", "right"]; - var pos2 = positions.find(function(item3) { + var pos = positions.find(function(item3) { return item3 === position3; }); - return pos2 ? "".concat(preClassName, "-").concat(pos2) : ""; + return pos ? "".concat(preClassName, "-").concat(pos) : ""; }, "getPositionClass"), isVertical: /* @__PURE__ */ __name(function isVertical4() { return this.$attrs.thumbnailsPosition === "left" || this.$attrs.thumbnailsPosition === "right"; @@ -219236,7 +220207,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({ class: normalizeClass(["flex items-center", props.class]) }, [ _ctx.position === "left" ? (openBlock(), createElementBlock("span", _hoisted_1$1, toDisplayString$1(_ctx.text), 1)) : createCommentVNode("", true), - createVNode(unref(script$S), { + createVNode(unref(script$R), { align: _ctx.align, type: _ctx.type, layout: _ctx.layout, @@ -219356,34 +220327,36 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({ const renderTreeNode = /* @__PURE__ */ __name((node3, type) => { const children = node3.children?.map((child) => renderTreeNode(child, type)); const workflow = node3.data; - const handleClick2 = /* @__PURE__ */ __name((node22, e2) => { - if (node22.leaf) { + function handleClick2(e2) { + if (this.leaf) { workflowService2.openWorkflow(workflow); } else { - toggleNodeOnEvent(e2, node22); + toggleNodeOnEvent(e2, this); } - }, "handleClick"); + } + __name(handleClick2, "handleClick"); const actions = node3.leaf ? { handleClick: handleClick2, - handleRename: /* @__PURE__ */ __name(async (node22, newName) => { + async handleRename(newName) { const newPath = type === "Browse" ? workflow.directory + "/" + appendJsonExt(newName) : ComfyWorkflow.basePath + appendJsonExt(newName); await workflowService2.renameWorkflow(workflow, newPath); - }, "handleRename"), - handleDelete: workflow.isTemporary ? void 0 : async () => { + }, + handleDelete: workflow.isTemporary ? void 0 : async function() { await workflowService2.deleteWorkflow(workflow); }, - contextMenuItems: /* @__PURE__ */ __name((node22) => { + contextMenuItems() { return [ { label: t2("g.insert"), icon: "pi pi-file-export", command: /* @__PURE__ */ __name(() => { - const workflow2 = node22.data; + const workflow2 = node3.data; workflowService2.insertWorkflow(workflow2); }, "command") } ]; - }, "contextMenuItems") + }, + draggable: true } : { handleClick: handleClick2 }; return { key: node3.key, @@ -219659,6 +220632,7 @@ const useWorkspaceStore = /* @__PURE__ */ defineStore("workspace", () => { const workflow = computed(() => useWorkflowStore()); const colorPalette = useColorPaletteService(); const dialog = useDialogService(); + const bottomPanel = useBottomPanelStore(); function registerSidebarTab(tab) { sidebarTab.value.registerSidebarTab(tab); } @@ -219686,6 +220660,7 @@ const useWorkspaceStore = /* @__PURE__ */ defineStore("workspace", () => { workflow, colorPalette, dialog, + bottomPanel, registerSidebarTab, unregisterSidebarTab, getSidebarTabs @@ -219745,7 +220720,7 @@ init$3({ app, dsn: "https://e2d0c0bd392ffdce48e856c2a055f437@o4507954455314432.ingest.us.sentry.io/4508621568475136", enabled: true, - release: "1.8.14", + release: "1.9.17", integrations: [], autoSessionTracking: false, defaultIntegrations: false, @@ -219778,195 +220753,195 @@ export { Fragment$1 as F, script$v as G, markRaw as H, - defineStore as I, - shallowRef as J, - useI18n as K, - useCommandStore as L, - LiteGraph as M, - useColorPaletteStore as N, - watch as O, - useNodeDefStore as P, - BadgePosition as Q, - LGraphBadge as R, - _ as S, - NodeBadgeMode as T, - ref as U, - useEventListener as V, - nextTick as W, - st as X, - normalizeI18nKey as Y, + useI18n as I, + useCommandStore as J, + useCanvasStore as K, + LiteGraph as L, + useColorPaletteStore as M, + watch as N, + useNodeDefStore as O, + BadgePosition as P, + LGraphBadge as Q, + _ as R, + NodeBadgeMode as S, + ref as T, + useEventListener as U, + nextTick as V, + st as W, + normalizeI18nKey as X, + useTitleEditorStore as Y, LGraphGroup as Z, _export_sfc as _, useSettingStore as a, - script$G as a$, + useDraggable as a$, EditableText as a0, - useNodeFrequencyStore as a1, - useNodeBookmarkStore as a2, - highlightQuery as a3, - script$s as a4, - formatNumberWithSuffix as a5, - NodeSourceType as a6, - createTextVNode as a7, - script$t as a8, - NodePreview as a9, + defineStore as a1, + useNodeFrequencyStore as a2, + useNodeBookmarkStore as a3, + highlightQuery as a4, + script$s as a5, + formatNumberWithSuffix as a6, + NodeSourceType as a7, + createTextVNode as a8, + script$t as a9, ComfyNodeDefImpl as aA, ComfyModelDef as aB, - LGraph$1 as aC, - LLink as aD, - DragAndScale as aE, - LGraphCanvas as aF, - ContextMenu as aG, - api as aH, - getStorageValue as aI, - useModelStore as aJ, - setStorageValue as aK, - CanvasPointer as aL, - IS_CONTROL_WIDGET as aM, - updateControlWidgetLabel as aN, - useColorPaletteService as aO, - ChangeTracker as aP, - i18n as aQ, - useToast as aR, - useToastStore as aS, - useQueueSettingsStore as aT, - script$j as aU, - useQueuePendingTaskCountStore as aV, - useLocalStorage as aW, - useDraggable as aX, - watchDebounced as aY, - inject as aZ, - useElementBounding as a_, - NodeSearchFilter as aa, - script$T as ab, - SearchFilterChip as ac, - useLitegraphService as ad, - storeToRefs as ae, - isRef as af, - toRaw as ag, - LinkReleaseTriggerAction as ah, - normalizeClass as ai, - useUserStore as aj, - useDialogStore as ak, - SettingDialogHeader as al, - SettingDialogContent as am, - useKeybindingStore as an, - Teleport as ao, - usePragmaticDraggable as ap, - usePragmaticDroppable as aq, - withModifiers as ar, - mergeProps$2 as as, - useWorkflowService as at, - useWorkflowBookmarkStore as au, - script$7 as av, - script$R as aw, - script$c as ax, - LinkMarkerShape as ay, + ComfyWorkflow as aC, + LGraphCanvas as aD, + te as aE, + LGraph$1 as aF, + LLink as aG, + DragAndScale as aH, + ContextMenu as aI, + CanvasPointer as aJ, + isImageNode as aK, + api as aL, + getStorageValue as aM, + useModelStore as aN, + setStorageValue as aO, + LinkMarkerShape as aP, + IS_CONTROL_WIDGET as aQ, + updateControlWidgetLabel as aR, + useColorPaletteService as aS, + ChangeTracker as aT, + i18n as aU, + useToast as aV, + useToastStore as aW, + useQueueSettingsStore as aX, + script$j as aY, + useQueuePendingTaskCountStore as aZ, + useLocalStorage as a_, + NodePreview as aa, + NodeSearchFilter as ab, + script$T as ac, + SearchFilterChip as ad, + useLitegraphService as ae, + storeToRefs as af, + isRef as ag, + toRaw as ah, + LinkReleaseTriggerAction as ai, + normalizeClass as aj, + useUserStore as ak, + useDialogStore as al, + SettingDialogHeader as am, + SettingDialogContent as an, + useKeybindingStore as ao, + Teleport as ap, + usePragmaticDraggable as aq, + usePragmaticDroppable as ar, + withModifiers as as, + mergeProps$2 as at, + useWorkflowService as au, + useWorkflowBookmarkStore as av, + script$7 as aw, + script$Q as ax, + script$c as ay, useModelToNodeStore as az, useWorkflowStore as b, - addStyle$1 as b$, - lodashExports as b0, - useEventBus as b1, - useMenuItemStore as b2, - provide as b3, - isElectron as b4, - electronAPI as b5, - isNativeWindow as b6, - useDialogService as b7, - LGraphEventMode as b8, - useQueueStore as b9, - BaseStyle$1 as bA, - script$14 as bB, - ZIndex$1 as bC, - addClass$1 as bD, - focus$2 as bE, - blockBodyScroll$1 as bF, - unblockBodyScroll$1 as bG, - FocusTrap as bH, - script$U as bI, - script$_ as bJ, - resolveComponent as bK, - Transition as bL, - script$12 as bM, - PrimeIcons as bN, - findSingle$1 as bO, - getAttribute$1 as bP, - script$f as bQ, - script$n as bR, - Ripple as bS, - UniqueComponentId as bT, - script$p as bU, - BaseDirective as bV, - removeClass$1 as bW, - createElement$1 as bX, - hasClass$1 as bY, - script$$ as bZ, - script$10 as b_, - DEFAULT_DARK_COLOR_PALETTE as ba, - DEFAULT_LIGHT_COLOR_PALETTE as bb, - t as bc, - useErrorHandling as bd, - useRouter as be, - withKeys as bf, - script$J as bg, - script$S as bh, - script$m as bi, - script$I as bj, - ProgressStatus as bk, - BaseTerminal as bl, - useModel as bm, - script$i as bn, - script$B as bo, - script$C as bp, - MigrationItems as bq, - script$K as br, - mergeModels as bs, - ValidationState as bt, - checkMirrorReachable as bu, - _sfc_main$C as bv, - mergeValidationStates as bw, - CUDA_TORCH_URL as bx, - NIGHTLY_CPU_TORCH_URL as by, - script$y as bz, + ConnectedOverlayScrollHandler as b$, + watchDebounced as b0, + inject as b1, + useElementBounding as b2, + script$G as b3, + lodashExports as b4, + useEventBus as b5, + useMenuItemStore as b6, + provide as b7, + isElectron as b8, + electronAPI as b9, + isInChina as bA, + mergeValidationStates as bB, + CUDA_TORCH_URL as bC, + NIGHTLY_CPU_TORCH_URL as bD, + script$12 as bE, + PrimeIcons as bF, + BaseStyle$1 as bG, + script$14 as bH, + Transition as bI, + findSingle$1 as bJ, + getAttribute$1 as bK, + focus$2 as bL, + script$f as bM, + script$n as bN, + Ripple as bO, + UniqueComponentId as bP, + script$p as bQ, + resolveComponent as bR, + BaseDirective as bS, + removeClass$1 as bT, + addClass$1 as bU, + createElement$1 as bV, + hasClass$1 as bW, + script$$ as bX, + script$10 as bY, + ZIndex$1 as bZ, + addStyle$1 as b_, + isNativeWindow as ba, + useDialogService as bb, + LGraphEventMode as bc, + useQueueStore as bd, + DEFAULT_DARK_COLOR_PALETTE as be, + DEFAULT_LIGHT_COLOR_PALETTE as bf, + t as bg, + useErrorHandling as bh, + useRouter as bi, + withKeys as bj, + script$I as bk, + script$R as bl, + script$m as bm, + script$S as bn, + ProgressStatus as bo, + BaseTerminal as bp, + useModel as bq, + script$i as br, + script$B as bs, + script$C as bt, + MigrationItems as bu, + script$J as bv, + mergeModels as bw, + ValidationState as bx, + checkMirrorReachable as by, + _sfc_main$C as bz, computed as c, - useTimeout as c$, - ConnectedOverlayScrollHandler as c0, - isTouchDevice$1 as c1, - relativePosition$1 as c2, - getOuterWidth$1 as c3, - absolutePosition$1 as c4, - find$2 as c5, - getIndex$1 as c6, - getFocusableElements$1 as c7, - OverlayEventBus as c8, - setAttribute$1 as c9, - script$M as cA, - script$u as cB, - getUserAgent$1 as cC, - script$l as cD, - getFirstFocusableElement$1 as cE, - getLastFocusableElement$1 as cF, - FilterService as cG, - script$A as cH, - script$D as cI, - findIndexInList$2 as cJ, - scrollInView$1 as cK, - script$z as cL, - script$k as cM, - script$9 as cN, - findLast$3 as cO, - getWindowScrollTop$1 as cP, - getWidth$1 as cQ, - getOffset$1 as cR, - vModelText as cS, - script$b as cT, - getVNodeProp as cU, - getNextElementSibling$1 as cV, - getPreviousElementSibling$1 as cW, - isClickable$1 as cX, - _default as cY, - clearSelection$1 as cZ, - isRTL$1 as c_, - localeComparator$2 as ca, + getPreviousElementSibling$1 as c$, + isTouchDevice$1 as c0, + relativePosition$1 as c1, + getOuterWidth$1 as c2, + absolutePosition$1 as c3, + find$2 as c4, + getIndex$1 as c5, + getFocusableElements$1 as c6, + OverlayEventBus as c7, + setAttribute$1 as c8, + localeComparator$2 as c9, + unblockBodyScroll$1 as cA, + FocusTrap as cB, + guardReactiveProps as cC, + setCSSProperty$1 as cD, + $dt$1 as cE, + script$L as cF, + script$u as cG, + getUserAgent$1 as cH, + script$l as cI, + getFirstFocusableElement$1 as cJ, + getLastFocusableElement$1 as cK, + FilterService as cL, + script$A as cM, + script$D as cN, + findIndexInList$2 as cO, + scrollInView$1 as cP, + script$z as cQ, + script$k as cR, + script$9 as cS, + findLast$3 as cT, + getWindowScrollTop$1 as cU, + getWidth$1 as cV, + getOffset$1 as cW, + vModelText as cX, + script$b as cY, + getVNodeProp as cZ, + getNextElementSibling$1 as c_, + script$U as ca, script$q as cb, resolveFieldData$2 as cc, isNotEmpty$2 as cd, @@ -219977,57 +220952,68 @@ export { isEmpty$3 as ci, findLastIndex$2 as cj, script$X as ck, - script$11 as cl, - uuid$1 as cm, - sort$2 as cn, - createSlots as co, - EventBus$1 as cp, - resolve$4 as cq, - Tooltip as cr, - script$H as cs, - script$L as ct, - script$W as cu, - normalizeProps as cv, - isAttributeEquals$1 as cw, - guardReactiveProps as cx, - setCSSProperty$1 as cy, - $dt$1 as cz, + script$_ as cl, + script$11 as cm, + uuid$1 as cn, + sort$2 as co, + createSlots as cp, + EventBus$1 as cq, + resolve$4 as cr, + Tooltip as cs, + script$H as ct, + script$K as cu, + script$W as cv, + script$y as cw, + normalizeProps as cx, + blockBodyScroll$1 as cy, + isAttributeEquals$1 as cz, defineComponent as d, - script$Q as d0, - useConfirm as d1, - script$6 as d2, - onUnmounted as d3, - getHeight$1 as d4, - getOuterHeight$1 as d5, - isArray$c as d6, - ToastEventBus as d7, - TransitionGroup as d8, - nestedPosition$1 as d9, - ComfyDialog as da, - $el as db, - ComfyApp as dc, - useExtensionService as dd, - processDynamicPrompt as de, - DraggableList as df, - applyTextReplacements as dg, - ComfyWidgets as dh, - addValueControlWidgets as di, - serialise as dj, - deserialiseAndCreate as dk, - FilterMatchMode as dl, - SearchBox as dm, - _sfc_main$L as dn, - KeyComboImpl as dp, - KeybindingImpl as dq, - useExtensionStore as dr, - invokeElementMethod$1 as ds, - FilterOperator as dt, - exportCSV$1 as du, - getHiddenElementOuterWidth$1 as dv, - getHiddenElementOuterHeight$1 as dw, - reorderArray$2 as dx, - useCopyToClipboard as dy, - FormItem as dz, + isClickable$1 as d0, + _default as d1, + clearSelection$1 as d2, + isRTL$1 as d3, + useTimeout as d4, + script$P as d5, + useConfirm as d6, + script$6 as d7, + onUnmounted as d8, + getHeight$1 as d9, + KeyComboImpl as dA, + KeybindingImpl as dB, + useExtensionStore as dC, + invokeElementMethod$1 as dD, + FilterOperator as dE, + exportCSV$1 as dF, + getHiddenElementOuterWidth$1 as dG, + getHiddenElementOuterHeight$1 as dH, + reorderArray$2 as dI, + useCopyToClipboard as dJ, + FormItem as dK, + getOuterHeight$1 as da, + isArray$c as db, + nestedPosition$1 as dc, + commonjsGlobal as dd, + getDefaultExportFromCjs as de, + xtermExports as df, + ToastEventBus as dg, + TransitionGroup as dh, + ComfyDialog as di, + $el as dj, + ComfyApp as dk, + useExtensionService as dl, + processDynamicPrompt as dm, + DraggableList as dn, + applyTextReplacements as dp, + ComfyWidgets as dq, + addValueControlWidgets as dr, + serialise as ds, + deserialiseAndCreate as dt, + script$g as du, + createApp as dv, + PrimeVue as dw, + FilterMatchMode as dx, + SearchBox as dy, + _sfc_main$L as dz, useTitle as e, createElementBlock as f, useWorkspaceStore as g, @@ -220051,4 +221037,4 @@ export { createBlock as y, withCtx as z }; -//# sourceMappingURL=index-DqqhYDnY.js.map +//# sourceMappingURL=index-DqXp9vW4.js.map diff --git a/web/assets/index-BapOFhAR.js b/web/assets/index-KUUE4Ew8.js similarity index 99% rename from web/assets/index-BapOFhAR.js rename to web/assets/index-KUUE4Ew8.js index a8d556911..dd2a87a8c 100644 --- a/web/assets/index-BapOFhAR.js +++ b/web/assets/index-KUUE4Ew8.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bA as BaseStyle, bB as script$s, bZ as script$t, o as openBlock, f as createElementBlock, as as mergeProps, m as createBaseVNode, E as toDisplayString, bS as Ripple, r as resolveDirective, i as withDirectives, y as createBlock, C as resolveDynamicComponent, bi as script$u, bK as resolveComponent, ai as normalizeClass, co as createSlots, z as withCtx, aU as script$v, cf as script$w, F as Fragment, D as renderList, a7 as createTextVNode, c9 as setAttribute, cv as normalizeProps, A as renderSlot, B as createCommentVNode, b_ as script$x, ce as equals, cA as script$y, br as script$z, cE as getFirstFocusableElement, c8 as OverlayEventBus, cU as getVNodeProp, cc as resolveFieldData, ds as invokeElementMethod, bP as getAttribute, cV as getNextElementSibling, c3 as getOuterWidth, cW as getPreviousElementSibling, l as script$A, bR as script$B, bU as script$C, bJ as script$E, cd as isNotEmpty, ar as withModifiers, d5 as getOuterHeight, bT as UniqueComponentId, cY as _default, bC as ZIndex, bE as focus, b$ as addStyle, c4 as absolutePosition, c0 as ConnectedOverlayScrollHandler, c1 as isTouchDevice, dt as FilterOperator, bI as script$F, cs as script$G, bH as FocusTrap, k as createVNode, bL as Transition, bf as withKeys, c6 as getIndex, cu as script$H, cX as isClickable, cZ as clearSelection, ca as localeComparator, cn as sort, cG as FilterService, dl as FilterMatchMode, bO as findSingle, cJ as findIndexInList, c5 as find, du as exportCSV, cR as getOffset, c_ as isRTL, dv as getHiddenElementOuterWidth, dw as getHiddenElementOuterHeight, dx as reorderArray, bW as removeClass, bD as addClass, ci as isEmpty, cH as script$I, ck as script$J } from "./index-DqqhYDnY.js"; -import { s as script$D } from "./index-DXE47DZl.js"; +import { bG as BaseStyle, bH as script$s, bX as script$t, o as openBlock, f as createElementBlock, at as mergeProps, m as createBaseVNode, E as toDisplayString, bO as Ripple, r as resolveDirective, i as withDirectives, y as createBlock, C as resolveDynamicComponent, bm as script$u, bR as resolveComponent, aj as normalizeClass, cp as createSlots, z as withCtx, aY as script$v, cf as script$w, F as Fragment, D as renderList, a8 as createTextVNode, c8 as setAttribute, cx as normalizeProps, A as renderSlot, B as createCommentVNode, bY as script$x, ce as equals, cF as script$y, bv as script$z, cJ as getFirstFocusableElement, c7 as OverlayEventBus, cZ as getVNodeProp, cc as resolveFieldData, dD as invokeElementMethod, bK as getAttribute, c_ as getNextElementSibling, c2 as getOuterWidth, c$ as getPreviousElementSibling, l as script$A, bN as script$B, bQ as script$C, cl as script$E, cd as isNotEmpty, as as withModifiers, da as getOuterHeight, bP as UniqueComponentId, d1 as _default, bZ as ZIndex, bL as focus, b_ as addStyle, c3 as absolutePosition, b$ as ConnectedOverlayScrollHandler, c0 as isTouchDevice, dE as FilterOperator, ca as script$F, ct as script$G, cB as FocusTrap, k as createVNode, bI as Transition, bj as withKeys, c5 as getIndex, cv as script$H, d0 as isClickable, d2 as clearSelection, c9 as localeComparator, co as sort, cL as FilterService, dx as FilterMatchMode, bJ as findSingle, cO as findIndexInList, c4 as find, dF as exportCSV, cW as getOffset, d3 as isRTL, dG as getHiddenElementOuterWidth, dH as getHiddenElementOuterHeight, dI as reorderArray, bT as removeClass, bU as addClass, ci as isEmpty, cM as script$I, ck as script$J } from "./index-DqXp9vW4.js"; +import { s as script$D } from "./index-BTHx8UHZ.js"; var ColumnStyle = BaseStyle.extend({ name: "column" }); @@ -8787,4 +8787,4 @@ export { script as h, script$l as s }; -//# sourceMappingURL=index-BapOFhAR.js.map +//# sourceMappingURL=index-KUUE4Ew8.js.map diff --git a/web/assets/keybindingService-DEgCutrm.js b/web/assets/keybindingService-DgS0S2M6.js similarity index 93% rename from web/assets/keybindingService-DEgCutrm.js rename to web/assets/keybindingService-DgS0S2M6.js index 91a668b79..6b2f26f05 100644 --- a/web/assets/keybindingService-DEgCutrm.js +++ b/web/assets/keybindingService-DgS0S2M6.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { an as useKeybindingStore, L as useCommandStore, a as useSettingStore, dp as KeyComboImpl, dq as KeybindingImpl } from "./index-DqqhYDnY.js"; +import { ao as useKeybindingStore, J as useCommandStore, a as useSettingStore, dA as KeyComboImpl, dB as KeybindingImpl } from "./index-DqXp9vW4.js"; const CORE_KEYBINDINGS = [ { combo: { @@ -186,7 +186,7 @@ const useKeybindingService = /* @__PURE__ */ __name(() => { return; } const target = event.composedPath()[0]; - if (!keyCombo.hasModifier && (target.tagName === "TEXTAREA" || target.tagName === "INPUT" || target.tagName === "SPAN" && target.classList.contains("property_value"))) { + if (keyCombo.isReservedByTextInput && (target.tagName === "TEXTAREA" || target.tagName === "INPUT" || target.tagName === "SPAN" && target.classList.contains("property_value"))) { return; } const keybinding = keybindingStore.getKeybinding(keyCombo); @@ -247,4 +247,4 @@ const useKeybindingService = /* @__PURE__ */ __name(() => { export { useKeybindingService as u }; -//# sourceMappingURL=keybindingService-DEgCutrm.js.map +//# sourceMappingURL=keybindingService-DgS0S2M6.js.map diff --git a/web/assets/serverConfigStore-Kb5DJVFt.js b/web/assets/serverConfigStore-C8uoM7Sm.js similarity index 95% rename from web/assets/serverConfigStore-Kb5DJVFt.js rename to web/assets/serverConfigStore-C8uoM7Sm.js index c1ff0646c..b447c27b7 100644 --- a/web/assets/serverConfigStore-Kb5DJVFt.js +++ b/web/assets/serverConfigStore-C8uoM7Sm.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { I as defineStore, U as ref, c as computed } from "./index-DqqhYDnY.js"; +import { a1 as defineStore, T as ref, c as computed } from "./index-DqXp9vW4.js"; const useServerConfigStore = defineStore("serverConfig", () => { const serverConfigById = ref({}); const serverConfigs = computed(() => { @@ -87,4 +87,4 @@ const useServerConfigStore = defineStore("serverConfig", () => { export { useServerConfigStore as u }; -//# sourceMappingURL=serverConfigStore-Kb5DJVFt.js.map +//# sourceMappingURL=serverConfigStore-C8uoM7Sm.js.map diff --git a/web/index.html b/web/index.html index c14633534..f8b1fc2ff 100644 --- a/web/index.html +++ b/web/index.html @@ -6,8 +6,8 @@ - - + +
diff --git a/web/scripts/domWidget.js b/web/scripts/domWidget.js new file mode 100644 index 000000000..a5fd049eb --- /dev/null +++ b/web/scripts/domWidget.js @@ -0,0 +1,2 @@ +// Shim for scripts/domWidget.ts +export const DOMWidgetImpl = window.comfyAPI.domWidget.DOMWidgetImpl; diff --git a/web/templates/image2image.json b/web/templates/image2image.json index 81da539d0..7aaf5a21a 100644 --- a/web/templates/image2image.json +++ b/web/templates/image2image.json @@ -330,7 +330,7 @@ "Node name for S&R": "CheckpointLoaderSimple" }, "widgets_values": [ - "v1-5-pruned-emaonly.safetensors" + "v1-5-pruned-emaonly-fp16.safetensors" ] } ], @@ -440,8 +440,8 @@ "extra": {}, "version": 0.4, "models": [{ - "name": "v1-5-pruned-emaonly.safetensors", - "url": "https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive/resolve/main/v1-5-pruned-emaonly.safetensors?download=true", + "name": "v1-5-pruned-emaonly-fp16.safetensors", + "url": "https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive/resolve/main/v1-5-pruned-emaonly-fp16.safetensors?download=true", "directory": "checkpoints" }] } From 93c8607d5157d2e30c4d598b01b32d71e07e9e6a Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Sat, 15 Feb 2025 15:34:36 -0500 Subject: [PATCH 105/478] remove light_intensity and fov from load3d (#6742) --- comfy_extras/nodes_load_3d.py | 46 +++++++++-------------------------- 1 file changed, 12 insertions(+), 34 deletions(-) diff --git a/comfy_extras/nodes_load_3d.py b/comfy_extras/nodes_load_3d.py index 3b969e45f..53a66b95a 100644 --- a/comfy_extras/nodes_load_3d.py +++ b/comfy_extras/nodes_load_3d.py @@ -20,9 +20,7 @@ class Load3D(): "width": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "material": (["original", "normal", "wireframe", "depth"],), - "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") @@ -34,22 +32,14 @@ class Load3D(): CATEGORY = "3d" def process(self, model_file, image, **kwargs): - if isinstance(image, dict): - image_path = folder_paths.get_annotated_filepath(image['image']) - mask_path = folder_paths.get_annotated_filepath(image['mask']) + image_path = folder_paths.get_annotated_filepath(image['image']) + mask_path = folder_paths.get_annotated_filepath(image['mask']) - 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) + 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) - 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, + return output_image, output_mask, model_file, class Load3DAnimation(): @classmethod @@ -66,9 +56,7 @@ class Load3DAnimation(): "width": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "material": (["original", "normal", "wireframe", "depth"],), - "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") @@ -80,20 +68,14 @@ class Load3DAnimation(): CATEGORY = "3d" def process(self, model_file, image, **kwargs): - if isinstance(image, dict): - image_path = folder_paths.get_annotated_filepath(image['image']) - mask_path = folder_paths.get_annotated_filepath(image['mask']) + image_path = folder_paths.get_annotated_filepath(image['image']) + mask_path = folder_paths.get_annotated_filepath(image['mask']) - 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) + 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) - 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, + return output_image, output_mask, model_file, class Preview3D(): @classmethod @@ -101,9 +83,7 @@ class Preview3D(): return {"required": { "model_file": ("STRING", {"default": "", "multiline": False}), "material": (["original", "normal", "wireframe", "depth"],), - "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 @@ -123,9 +103,7 @@ class Preview3DAnimation(): return {"required": { "model_file": ("STRING", {"default": "", "multiline": False}), "material": (["original", "normal", "wireframe", "depth"],), - "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 From e2919d38b4a7cfc03eb8a31b28c5a1ac4c9f10a4 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 16 Feb 2025 05:45:08 -0500 Subject: [PATCH 106/478] Disable bf16 on AMD GPUs that don't support it. --- comfy/model_management.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/comfy/model_management.py b/comfy/model_management.py index fb924f432..9f6522967 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -1106,6 +1106,11 @@ def should_use_bf16(device=None, model_params=0, prioritize_performance=True, ma if is_ascend_npu(): return True + if is_amd(): + arch = torch.cuda.get_device_properties(device).gcnArchName + if arch in ["gfx1030", "gfx1031", "gfx1010", "gfx1011", "gfx1012", "gfx906", "gfx900", "gfx803"]: # RDNA2 and older don't support bf16 + return False + props = torch.cuda.get_device_properties(device) if props.major >= 8: return True From d0399f43436bcc3b6bdfa0f71d92b423e18fae30 Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Mon, 17 Feb 2025 01:45:47 +0900 Subject: [PATCH 107/478] Update frontend to v1.9.18 (#6828) Co-authored-by: huchenlei <20929282+huchenlei@users.noreply.github.com> --- ...GljfEG.js => BaseViewTemplate-BTbuZf5t.js} | 4 +- ...BMUZxW.js => DesktopStartView-D9r53Bue.js} | 6 +-- ...ew03S.js => DesktopUpdateView-C-R0415K.js} | 10 ++--- ...PK8AXQU.js => DownloadGitView-PWqK5ke4.js} | 6 +-- ...1HZtMFvH.js => ExtensionPanel-Ba57xrmg.js} | 8 ++-- ...View-CLFBgoGf.js => GraphView-B_UDZi95.js} | 14 +++---- ...ew-x9XCq0hC.js => InstallView-DW9xwU_F.js} | 8 ++-- ...IrxefrS.js => KeybindingPanel-oavhFdkz.js} | 10 ++--- ...UmTZX1d.js => MaintenanceView-Bh8OZpgl.js} | 18 ++++---- ...js => ManualConfigurationView-DTLyJ3VG.js} | 6 +-- ...ednB.js => MetricsConsentView-C80fk2cl.js} | 6 +-- ...M0uuqA.js => NotSupportedView-B78ZVR9Z.js} | 6 +-- ...TW_iX.js => ServerConfigPanel-BYrt6wyr.js} | 6 +-- ...ENqs5bD.js => ServerStartView-B7TlHxYo.js} | 6 +-- ...HP.js => TerminalOutputDrawer-CKr7Br7O.js} | 4 +- ...CRPNAEVJ.js => UserSelectView-C703HOyO.js} | 6 +-- ...ew-Cvtvw05C.js => WelcomeView-DIFvbWc2.js} | 6 +-- .../{index-B0BQ8jlU.js => index-A_bXPJCN.js} | 4 +- .../{index-D9D9jjLT.js => index-B36GcHVN.js} | 8 ++-- .../{index-DqXp9vW4.js => index-Bv0b06LE.js} | 42 +++++++++---------- .../{index-DSWvxALN.js => index-C068lYT4.js} | 6 +-- .../{index-KUUE4Ew8.js => index-CgMyWf7n.js} | 6 +-- .../{index-BTHx8UHZ.js => index-Dzu9WL4p.js} | 4 +- .../{index-A-dAhghd.js => index-SeIZOWJp.js} | 4 +- ...0S2M6.js => keybindingService-DyjX-nxF.js} | 4 +- ...oM7Sm.js => serverConfigStore-D2Vr0L0h.js} | 4 +- web/index.html | 2 +- 27 files changed, 107 insertions(+), 107 deletions(-) rename web/assets/{BaseViewTemplate-DlGljfEG.js => BaseViewTemplate-BTbuZf5t.js} (94%) rename web/assets/{DesktopStartView-B2BMUZxW.js => DesktopStartView-D9r53Bue.js} (78%) rename web/assets/{DesktopUpdateView-DWsew03S.js => DesktopUpdateView-C-R0415K.js} (90%) rename web/assets/{DownloadGitView-SPK8AXQU.js => DownloadGitView-PWqK5ke4.js} (94%) rename web/assets/{ExtensionPanel-1HZtMFvH.js => ExtensionPanel-Ba57xrmg.js} (97%) rename web/assets/{GraphView-CLFBgoGf.js => GraphView-B_UDZi95.js} (99%) rename web/assets/{InstallView-x9XCq0hC.js => InstallView-DW9xwU_F.js} (99%) rename web/assets/{KeybindingPanel-BIrxefrS.js => KeybindingPanel-oavhFdkz.js} (98%) rename web/assets/{MaintenanceView-BUmTZX1d.js => MaintenanceView-Bh8OZpgl.js} (99%) rename web/assets/{ManualConfigurationView-D3on5kXY.js => ManualConfigurationView-DTLyJ3VG.js} (95%) rename web/assets/{MetricsConsentView-DK20ednB.js => MetricsConsentView-C80fk2cl.js} (95%) rename web/assets/{NotSupportedView-BzM0uuqA.js => NotSupportedView-B78ZVR9Z.js} (96%) rename web/assets/{ServerConfigPanel-D0jTW_iX.js => ServerConfigPanel-BYrt6wyr.js} (97%) rename web/assets/{ServerStartView-BENqs5bD.js => ServerStartView-B7TlHxYo.js} (96%) rename web/assets/{TerminalOutputDrawer-BgTEspHP.js => TerminalOutputDrawer-CKr7Br7O.js} (99%) rename web/assets/{UserSelectView-CRPNAEVJ.js => UserSelectView-C703HOyO.js} (97%) rename web/assets/{WelcomeView-Cvtvw05C.js => WelcomeView-DIFvbWc2.js} (91%) rename web/assets/{index-B0BQ8jlU.js => index-A_bXPJCN.js} (99%) rename web/assets/{index-D9D9jjLT.js => index-B36GcHVN.js} (99%) rename web/assets/{index-DqXp9vW4.js => index-Bv0b06LE.js} (99%) rename web/assets/{index-DSWvxALN.js => index-C068lYT4.js} (99%) rename web/assets/{index-KUUE4Ew8.js => index-CgMyWf7n.js} (99%) rename web/assets/{index-BTHx8UHZ.js => index-Dzu9WL4p.js} (94%) rename web/assets/{index-A-dAhghd.js => index-SeIZOWJp.js} (99%) rename web/assets/{keybindingService-DgS0S2M6.js => keybindingService-DyjX-nxF.js} (98%) rename web/assets/{serverConfigStore-C8uoM7Sm.js => serverConfigStore-D2Vr0L0h.js} (97%) diff --git a/web/assets/BaseViewTemplate-DlGljfEG.js b/web/assets/BaseViewTemplate-BTbuZf5t.js similarity index 94% rename from web/assets/BaseViewTemplate-DlGljfEG.js rename to web/assets/BaseViewTemplate-BTbuZf5t.js index 9bf3787d3..d7f9e402b 100644 --- a/web/assets/BaseViewTemplate-DlGljfEG.js +++ b/web/assets/BaseViewTemplate-BTbuZf5t.js @@ -1,4 +1,4 @@ -import { d as defineComponent, T as ref, p as onMounted, b8 as isElectron, V as nextTick, b9 as electronAPI, o as openBlock, f as createElementBlock, i as withDirectives, v as vShow, j as unref, ba as isNativeWindow, m as createBaseVNode, A as renderSlot, aj as normalizeClass } from "./index-DqXp9vW4.js"; +import { d as defineComponent, T as ref, p as onMounted, b8 as isElectron, V as nextTick, b9 as electronAPI, o as openBlock, f as createElementBlock, i as withDirectives, v as vShow, j as unref, ba as isNativeWindow, m as createBaseVNode, A as renderSlot, aj as normalizeClass } from "./index-Bv0b06LE.js"; const _hoisted_1 = { class: "flex-grow w-full flex items-center justify-center overflow-auto" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "BaseViewTemplate", @@ -48,4 +48,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as _ }; -//# sourceMappingURL=BaseViewTemplate-DlGljfEG.js.map +//# sourceMappingURL=BaseViewTemplate-BTbuZf5t.js.map diff --git a/web/assets/DesktopStartView-B2BMUZxW.js b/web/assets/DesktopStartView-D9r53Bue.js similarity index 78% rename from web/assets/DesktopStartView-B2BMUZxW.js rename to web/assets/DesktopStartView-D9r53Bue.js index 7fdd14876..744682eca 100644 --- a/web/assets/DesktopStartView-B2BMUZxW.js +++ b/web/assets/DesktopStartView-D9r53Bue.js @@ -1,5 +1,5 @@ -import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, k as createVNode, j as unref, bE as script } from "./index-DqXp9vW4.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.js"; +import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, k as createVNode, j as unref, bE as script } from "./index-Bv0b06LE.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.js"; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "DesktopStartView", setup(__props) { @@ -16,4 +16,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=DesktopStartView-B2BMUZxW.js.map +//# sourceMappingURL=DesktopStartView-D9r53Bue.js.map diff --git a/web/assets/DesktopUpdateView-DWsew03S.js b/web/assets/DesktopUpdateView-C-R0415K.js similarity index 90% rename from web/assets/DesktopUpdateView-DWsew03S.js rename to web/assets/DesktopUpdateView-C-R0415K.js index dec3d41f2..8de7eee9e 100644 --- a/web/assets/DesktopUpdateView-DWsew03S.js +++ b/web/assets/DesktopUpdateView-C-R0415K.js @@ -1,9 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, T as ref, d8 as onUnmounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, j as unref, bg as t, k as createVNode, bE as script, l as script$1, b9 as electronAPI, _ as _export_sfc } from "./index-DqXp9vW4.js"; -import { s as script$2 } from "./index-B0BQ8jlU.js"; -import { _ as _sfc_main$1 } from "./TerminalOutputDrawer-BgTEspHP.js"; -import { _ as _sfc_main$2 } from "./BaseViewTemplate-DlGljfEG.js"; +import { d as defineComponent, T as ref, d8 as onUnmounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, j as unref, bg as t, k as createVNode, bE as script, l as script$1, b9 as electronAPI, _ as _export_sfc } from "./index-Bv0b06LE.js"; +import { s as script$2 } from "./index-A_bXPJCN.js"; +import { _ as _sfc_main$1 } from "./TerminalOutputDrawer-CKr7Br7O.js"; +import { _ as _sfc_main$2 } from "./BaseViewTemplate-BTbuZf5t.js"; const _hoisted_1 = { class: "h-screen w-screen grid items-center justify-around overflow-y-auto" }; const _hoisted_2 = { class: "relative m-8 text-center" }; const _hoisted_3 = { class: "download-bg pi-download text-4xl font-bold" }; @@ -55,4 +55,4 @@ const DesktopUpdateView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", export { DesktopUpdateView as default }; -//# sourceMappingURL=DesktopUpdateView-DWsew03S.js.map +//# sourceMappingURL=DesktopUpdateView-C-R0415K.js.map diff --git a/web/assets/DownloadGitView-SPK8AXQU.js b/web/assets/DownloadGitView-PWqK5ke4.js similarity index 94% rename from web/assets/DownloadGitView-SPK8AXQU.js rename to web/assets/DownloadGitView-PWqK5ke4.js index 1b7d7e0c0..2128466de 100644 --- a/web/assets/DownloadGitView-SPK8AXQU.js +++ b/web/assets/DownloadGitView-PWqK5ke4.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, bi as useRouter } from "./index-DqXp9vW4.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.js"; +import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, bi as useRouter } from "./index-Bv0b06LE.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.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" }; @@ -55,4 +55,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=DownloadGitView-SPK8AXQU.js.map +//# sourceMappingURL=DownloadGitView-PWqK5ke4.js.map diff --git a/web/assets/ExtensionPanel-1HZtMFvH.js b/web/assets/ExtensionPanel-Ba57xrmg.js similarity index 97% rename from web/assets/ExtensionPanel-1HZtMFvH.js rename to web/assets/ExtensionPanel-Ba57xrmg.js index 99adb239b..575b6d5b2 100644 --- a/web/assets/ExtensionPanel-1HZtMFvH.js +++ b/web/assets/ExtensionPanel-Ba57xrmg.js @@ -1,8 +1,8 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, T as ref, dx as FilterMatchMode, dC as useExtensionStore, a as useSettingStore, p as onMounted, c as computed, o as openBlock, y as createBlock, z as withCtx, k as createVNode, dy as SearchBox, j as unref, bn as script, m as createBaseVNode, f as createElementBlock, D as renderList, E as toDisplayString, a8 as createTextVNode, F as Fragment, l as script$1, B as createCommentVNode, a5 as script$3, ay as script$4, br as script$5, dz as _sfc_main$1 } from "./index-DqXp9vW4.js"; -import { g as script$2, h as script$6 } from "./index-KUUE4Ew8.js"; -import "./index-BTHx8UHZ.js"; +import { d as defineComponent, T as ref, dx as FilterMatchMode, dC as useExtensionStore, a as useSettingStore, p as onMounted, c as computed, o as openBlock, y as createBlock, z as withCtx, k as createVNode, dy as SearchBox, j as unref, bn as script, m as createBaseVNode, f as createElementBlock, D as renderList, E as toDisplayString, a8 as createTextVNode, F as Fragment, l as script$1, B as createCommentVNode, a5 as script$3, ay as script$4, br as script$5, dz as _sfc_main$1 } from "./index-Bv0b06LE.js"; +import { g as script$2, h as script$6 } from "./index-CgMyWf7n.js"; +import "./index-Dzu9WL4p.js"; const _hoisted_1 = { class: "flex justify-end" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "ExtensionPanel", @@ -179,4 +179,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ExtensionPanel-1HZtMFvH.js.map +//# sourceMappingURL=ExtensionPanel-Ba57xrmg.js.map diff --git a/web/assets/GraphView-CLFBgoGf.js b/web/assets/GraphView-B_UDZi95.js similarity index 99% rename from web/assets/GraphView-CLFBgoGf.js rename to web/assets/GraphView-B_UDZi95.js index 900a8cc86..dc6554706 100644 --- a/web/assets/GraphView-CLFBgoGf.js +++ b/web/assets/GraphView-B_UDZi95.js @@ -1,11 +1,11 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -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 createVNode, s as showNativeMenu, l as script, m as createBaseVNode, n as normalizeStyle, _ as _export_sfc, p as onMounted, q as onBeforeUnmount, t as useSidebarTabStore, x as useBottomPanelStore, y as createBlock, z as withCtx, A as renderSlot, B as createCommentVNode, C as resolveDynamicComponent, F as Fragment, D as renderList, E as toDisplayString, G as script$5, H as markRaw, I as useI18n, J as useCommandStore, K as useCanvasStore, L as LiteGraph, M as useColorPaletteStore, N as watch, O as useNodeDefStore, P as BadgePosition, Q as LGraphBadge, R as _, S as NodeBadgeMode, T as ref, U as useEventListener, V as nextTick, W as st, X as normalizeI18nKey, Y as useTitleEditorStore, Z as LGraphGroup, $ as LGraphNode, a0 as EditableText, a1 as defineStore, a2 as useNodeFrequencyStore, a3 as useNodeBookmarkStore, a4 as highlightQuery, a5 as script$8, a6 as formatNumberWithSuffix, a7 as NodeSourceType, a8 as createTextVNode, a9 as script$9, aa as NodePreview, ab as NodeSearchFilter, ac as script$a, ad as SearchFilterChip, ae as useLitegraphService, af as storeToRefs, ag as isRef, ah as toRaw, ai as LinkReleaseTriggerAction, aj as normalizeClass, ak as useUserStore, al as useDialogStore, am as SettingDialogHeader, an as SettingDialogContent, ao as useKeybindingStore, ap as Teleport, aq as usePragmaticDraggable, ar as usePragmaticDroppable, as as withModifiers, at as mergeProps, au as useWorkflowService, av as useWorkflowBookmarkStore, aw as script$c, ax as script$d, ay as script$e, az as useModelToNodeStore, aA as ComfyNodeDefImpl, aB as ComfyModelDef, aC as ComfyWorkflow, aD as LGraphCanvas, aE as te, aF as LGraph, aG as LLink, aH as DragAndScale, aI as ContextMenu, aJ as CanvasPointer, aK as isImageNode, aL as api, aM as getStorageValue, aN as useModelStore, aO as setStorageValue, aP as LinkMarkerShape, aQ as IS_CONTROL_WIDGET, aR as updateControlWidgetLabel, aS as useColorPaletteService, aT as ChangeTracker, aU as i18n, aV as useToast, aW as useToastStore, aX as useQueueSettingsStore, aY as script$g, aZ as useQueuePendingTaskCountStore, a_ as useLocalStorage, a$ as useDraggable, b0 as watchDebounced, b1 as inject, b2 as useElementBounding, b3 as script$i, b4 as lodashExports, b5 as useEventBus, b6 as useMenuItemStore, b7 as provide, b8 as isElectron, b9 as electronAPI, ba as isNativeWindow, bb as useDialogService, bc as LGraphEventMode, bd as useQueueStore, be as DEFAULT_DARK_COLOR_PALETTE, bf as DEFAULT_LIGHT_COLOR_PALETTE, bg as t, bh as useErrorHandling } from "./index-DqXp9vW4.js"; -import { s as script$1, a as script$2, b as script$3, c as script$4, d as script$6, e as script$7, f as script$b, g as script$h, h as script$j } from "./index-DSWvxALN.js"; -import { s as script$f } from "./index-B0BQ8jlU.js"; -import { u as useKeybindingService } from "./keybindingService-DgS0S2M6.js"; -import { u as useServerConfigStore } from "./serverConfigStore-C8uoM7Sm.js"; -import "./index-BTHx8UHZ.js"; +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 createVNode, s as showNativeMenu, l as script, m as createBaseVNode, n as normalizeStyle, _ as _export_sfc, p as onMounted, q as onBeforeUnmount, t as useSidebarTabStore, x as useBottomPanelStore, y as createBlock, z as withCtx, A as renderSlot, B as createCommentVNode, C as resolveDynamicComponent, F as Fragment, D as renderList, E as toDisplayString, G as script$5, H as markRaw, I as useI18n, J as useCommandStore, K as useCanvasStore, L as LiteGraph, M as useColorPaletteStore, N as watch, O as useNodeDefStore, P as BadgePosition, Q as LGraphBadge, R as _, S as NodeBadgeMode, T as ref, U as useEventListener, V as nextTick, W as st, X as normalizeI18nKey, Y as useTitleEditorStore, Z as LGraphGroup, $ as LGraphNode, a0 as EditableText, a1 as defineStore, a2 as useNodeFrequencyStore, a3 as useNodeBookmarkStore, a4 as highlightQuery, a5 as script$8, a6 as formatNumberWithSuffix, a7 as NodeSourceType, a8 as createTextVNode, a9 as script$9, aa as NodePreview, ab as NodeSearchFilter, ac as script$a, ad as SearchFilterChip, ae as useLitegraphService, af as storeToRefs, ag as isRef, ah as toRaw, ai as LinkReleaseTriggerAction, aj as normalizeClass, ak as useUserStore, al as useDialogStore, am as SettingDialogHeader, an as SettingDialogContent, ao as useKeybindingStore, ap as Teleport, aq as usePragmaticDraggable, ar as usePragmaticDroppable, as as withModifiers, at as mergeProps, au as useWorkflowService, av as useWorkflowBookmarkStore, aw as script$c, ax as script$d, ay as script$e, az as useModelToNodeStore, aA as ComfyNodeDefImpl, aB as ComfyModelDef, aC as ComfyWorkflow, aD as LGraphCanvas, aE as te, aF as LGraph, aG as LLink, aH as DragAndScale, aI as ContextMenu, aJ as CanvasPointer, aK as isImageNode, aL as api, aM as getStorageValue, aN as useModelStore, aO as setStorageValue, aP as LinkMarkerShape, aQ as IS_CONTROL_WIDGET, aR as updateControlWidgetLabel, aS as useColorPaletteService, aT as ChangeTracker, aU as i18n, aV as useToast, aW as useToastStore, aX as useQueueSettingsStore, aY as script$g, aZ as useQueuePendingTaskCountStore, a_ as useLocalStorage, a$ as useDraggable, b0 as watchDebounced, b1 as inject, b2 as useElementBounding, b3 as script$i, b4 as lodashExports, b5 as useEventBus, b6 as useMenuItemStore, b7 as provide, b8 as isElectron, b9 as electronAPI, ba as isNativeWindow, bb as useDialogService, bc as LGraphEventMode, bd as useQueueStore, be as DEFAULT_DARK_COLOR_PALETTE, bf as DEFAULT_LIGHT_COLOR_PALETTE, bg as t, bh as useErrorHandling } from "./index-Bv0b06LE.js"; +import { s as script$1, a as script$2, b as script$3, c as script$4, d as script$6, e as script$7, f as script$b, g as script$h, h as script$j } from "./index-C068lYT4.js"; +import { s as script$f } from "./index-A_bXPJCN.js"; +import { u as useKeybindingService } from "./keybindingService-DyjX-nxF.js"; +import { u as useServerConfigStore } from "./serverConfigStore-D2Vr0L0h.js"; +import "./index-Dzu9WL4p.js"; const DEFAULT_TITLE = "ComfyUI"; const TITLE_SUFFIX = " - ComfyUI"; const _sfc_main$u = /* @__PURE__ */ defineComponent({ @@ -4916,4 +4916,4 @@ const GraphView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v- export { GraphView as default }; -//# sourceMappingURL=GraphView-CLFBgoGf.js.map +//# sourceMappingURL=GraphView-B_UDZi95.js.map diff --git a/web/assets/InstallView-x9XCq0hC.js b/web/assets/InstallView-DW9xwU_F.js similarity index 99% rename from web/assets/InstallView-x9XCq0hC.js rename to web/assets/InstallView-DW9xwU_F.js index 9487ebf27..e7e2509e9 100644 --- a/web/assets/InstallView-x9XCq0hC.js +++ b/web/assets/InstallView-DW9xwU_F.js @@ -1,9 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, T as ref, bq as useModel, o as openBlock, f as createElementBlock, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, br as script, bl as script$1, as as withModifiers, z as withCtx, ac as script$2, I as useI18n, c as computed, aj as normalizeClass, B as createCommentVNode, a5 as script$3, a8 as createTextVNode, b9 as electronAPI, _ as _export_sfc, p as onMounted, r as resolveDirective, bk as script$4, i as withDirectives, bs as script$5, bt as script$6, l as script$7, y as createBlock, bn as script$8, bu as MigrationItems, w as watchEffect, F as Fragment, D as renderList, bv as script$9, bw as mergeModels, bx as ValidationState, X as normalizeI18nKey, N as watch, by as checkMirrorReachable, bz as _sfc_main$7, bA as isInChina, bB as mergeValidationStates, bg as t, b3 as script$a, bC as CUDA_TORCH_URL, bD as NIGHTLY_CPU_TORCH_URL, bi as useRouter, ah as toRaw } from "./index-DqXp9vW4.js"; -import { s as script$b, a as script$c, b as script$d, c as script$e, d as script$f } from "./index-A-dAhghd.js"; +import { d as defineComponent, T as ref, bq as useModel, o as openBlock, f as createElementBlock, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, br as script, bl as script$1, as as withModifiers, z as withCtx, ac as script$2, I as useI18n, c as computed, aj as normalizeClass, B as createCommentVNode, a5 as script$3, a8 as createTextVNode, b9 as electronAPI, _ as _export_sfc, p as onMounted, r as resolveDirective, bk as script$4, i as withDirectives, bs as script$5, bt as script$6, l as script$7, y as createBlock, bn as script$8, bu as MigrationItems, w as watchEffect, F as Fragment, D as renderList, bv as script$9, bw as mergeModels, bx as ValidationState, X as normalizeI18nKey, N as watch, by as checkMirrorReachable, bz as _sfc_main$7, bA as isInChina, bB as mergeValidationStates, bg as t, b3 as script$a, bC as CUDA_TORCH_URL, bD as NIGHTLY_CPU_TORCH_URL, bi as useRouter, ah as toRaw } from "./index-Bv0b06LE.js"; +import { s as script$b, a as script$c, b as script$d, c as script$e, d as script$f } from "./index-SeIZOWJp.js"; import { P as PYTHON_MIRROR, a as PYPI_MIRROR } from "./uvMirrors-B-HKMf6X.js"; -import { _ as _sfc_main$8 } from "./BaseViewTemplate-DlGljfEG.js"; +import { _ as _sfc_main$8 } from "./BaseViewTemplate-BTbuZf5t.js"; const _hoisted_1$5 = { class: "flex flex-col gap-6 w-[600px]" }; const _hoisted_2$5 = { class: "flex flex-col gap-4" }; const _hoisted_3$5 = { class: "text-2xl font-semibold text-neutral-100" }; @@ -968,4 +968,4 @@ const InstallView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data- export { InstallView as default }; -//# sourceMappingURL=InstallView-x9XCq0hC.js.map +//# sourceMappingURL=InstallView-DW9xwU_F.js.map diff --git a/web/assets/KeybindingPanel-BIrxefrS.js b/web/assets/KeybindingPanel-oavhFdkz.js similarity index 98% rename from web/assets/KeybindingPanel-BIrxefrS.js rename to web/assets/KeybindingPanel-oavhFdkz.js index dc8d2ae3c..aa3739dcd 100644 --- a/web/assets/KeybindingPanel-BIrxefrS.js +++ b/web/assets/KeybindingPanel-oavhFdkz.js @@ -1,9 +1,9 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, D as renderList, k as createVNode, z as withCtx, a8 as createTextVNode, E as toDisplayString, j as unref, a5 as script, B as createCommentVNode, T as ref, dx as FilterMatchMode, ao as useKeybindingStore, J as useCommandStore, I as useI18n, X as normalizeI18nKey, w as watchEffect, aV as useToast, r as resolveDirective, y as createBlock, dy as SearchBox, m as createBaseVNode, l as script$2, bk as script$4, as as withModifiers, bn as script$5, ac as script$6, i as withDirectives, dz as _sfc_main$2, dA as KeyComboImpl, dB as KeybindingImpl, _ as _export_sfc } from "./index-DqXp9vW4.js"; -import { g as script$1, h as script$3 } from "./index-KUUE4Ew8.js"; -import { u as useKeybindingService } from "./keybindingService-DgS0S2M6.js"; -import "./index-BTHx8UHZ.js"; +import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, D as renderList, k as createVNode, z as withCtx, a8 as createTextVNode, E as toDisplayString, j as unref, a5 as script, B as createCommentVNode, T as ref, dx as FilterMatchMode, ao as useKeybindingStore, J as useCommandStore, I as useI18n, X as normalizeI18nKey, w as watchEffect, aV as useToast, r as resolveDirective, y as createBlock, dy as SearchBox, m as createBaseVNode, l as script$2, bk as script$4, as as withModifiers, bn as script$5, ac as script$6, i as withDirectives, dz as _sfc_main$2, dA as KeyComboImpl, dB as KeybindingImpl, _ as _export_sfc } from "./index-Bv0b06LE.js"; +import { g as script$1, h as script$3 } from "./index-CgMyWf7n.js"; +import { u as useKeybindingService } from "./keybindingService-DyjX-nxF.js"; +import "./index-Dzu9WL4p.js"; const _hoisted_1$1 = { key: 0, class: "px-2" @@ -289,4 +289,4 @@ const KeybindingPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { KeybindingPanel as default }; -//# sourceMappingURL=KeybindingPanel-BIrxefrS.js.map +//# sourceMappingURL=KeybindingPanel-oavhFdkz.js.map diff --git a/web/assets/MaintenanceView-BUmTZX1d.js b/web/assets/MaintenanceView-Bh8OZpgl.js similarity index 99% rename from web/assets/MaintenanceView-BUmTZX1d.js rename to web/assets/MaintenanceView-Bh8OZpgl.js index f52e9b169..4f3d99c3b 100644 --- a/web/assets/MaintenanceView-BUmTZX1d.js +++ b/web/assets/MaintenanceView-Bh8OZpgl.js @@ -1,13 +1,13 @@ var __defProp = Object.defineProperty; var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -import { d as defineComponent, bw as mergeModels, bq as useModel, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, aj as normalizeClass, i as withDirectives, v as vShow, k as createVNode, j as unref, bE as script$1c, l as script$1d, c as computed, bF as PrimeIcons, bg as t, a5 as script$1e, b1 as inject, bG as BaseStyle, bH as script$1f, at as mergeProps, bI as Transition, C as resolveDynamicComponent, A as renderSlot, B as createCommentVNode, bJ as findSingle, bK as getAttribute, bL as focus, bM as script$1g, bN as script$1h, bO as Ripple, r as resolveDirective, bP as UniqueComponentId, bQ as script$1i, bR as resolveComponent, f as createElementBlock, F as Fragment, D as renderList, E as toDisplayString, bS as BaseDirective, bT as removeClass, bU as addClass, bV as createElement, bW as hasClass, bX as script$1j, bY as script$1k, bZ as ZIndex, b_ as addStyle, b$ as ConnectedOverlayScrollHandler, c0 as isTouchDevice, c1 as relativePosition, c2 as getOuterWidth, c3 as absolutePosition, c4 as find, c5 as getIndex, c6 as getFocusableElements, c7 as OverlayEventBus, c8 as setAttribute, c9 as localeComparator, bk as script$1l, ca as script$1m, cb as script$1n, n as normalizeStyle, a8 as createTextVNode, bj as withKeys, cc as resolveFieldData, cd as isNotEmpty, ce as equals, cf as script$1o, cg as isString, ch as isPrintableCharacter, ci as isEmpty, cj as findLastIndex, ck as script$1p, cl as script$1q, cm as script$1r, cn as uuid, a9 as script$1s, co as sort, cp as createSlots, cq as EventBus, H as markRaw, cr as resolve, cs as Tooltip, bm as script$1u, ac as script$1v, ct as script$1w, cu as script$1x, cv as script$1y, cw as script$1z, bn as script$1A, cx as normalizeProps, cy as blockBodyScroll, cz as isAttributeEquals, cA as unblockBodyScroll, cB as FocusTrap, cC as guardReactiveProps, cD as setCSSProperty, cE as $dt, cF as script$1C, cG as script$1E, cH as getUserAgent, br as script$1F, cI as script$1G, cJ as getFirstFocusableElement, cK as getLastFocusableElement, cL as FilterService, bv as script$1I, cM as script$1J, bt as script$1K, bs as script$1L, cN as script$1M, cO as findIndexInList, cP as scrollInView, cQ as script$1N, cR as script$1O, cS as script$1P, cT as findLast, cU as getWindowScrollTop, cV as getWidth, cW as getOffset, cX as vModelText, cY as script$1U, as as withModifiers, cZ as getVNodeProp, c_ as getNextElementSibling, c$ as getPreviousElementSibling, d0 as isClickable, d1 as _default, d2 as clearSelection, d3 as isRTL, b9 as electronAPI, a1 as defineStore, T as ref, d4 as useTimeout, N as watch, d5 as script$1Y, _ as _export_sfc, aV as useToast, d6 as useConfirm, bl as script$1Z, d7 as script$1_, p as onMounted, d8 as onUnmounted, aw as script$1$, ag as isRef } from "./index-DqXp9vW4.js"; -import { a as script$1B, b as script$1D, s as script$20 } from "./index-B0BQ8jlU.js"; -import "./index-DSWvxALN.js"; -import { s as script$1t, a as script$1Q, b as script$1R, c as script$1S, d as script$1V, e as script$1W, f as script$1X } from "./index-KUUE4Ew8.js"; -import { s as script$1T, _ as _sfc_main$7 } from "./TerminalOutputDrawer-BgTEspHP.js"; -import { s as script$1H } from "./index-BTHx8UHZ.js"; -import "./index-A-dAhghd.js"; -import { _ as _sfc_main$8 } from "./BaseViewTemplate-DlGljfEG.js"; +import { d as defineComponent, bw as mergeModels, bq as useModel, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, aj as normalizeClass, i as withDirectives, v as vShow, k as createVNode, j as unref, bE as script$1c, l as script$1d, c as computed, bF as PrimeIcons, bg as t, a5 as script$1e, b1 as inject, bG as BaseStyle, bH as script$1f, at as mergeProps, bI as Transition, C as resolveDynamicComponent, A as renderSlot, B as createCommentVNode, bJ as findSingle, bK as getAttribute, bL as focus, bM as script$1g, bN as script$1h, bO as Ripple, r as resolveDirective, bP as UniqueComponentId, bQ as script$1i, bR as resolveComponent, f as createElementBlock, F as Fragment, D as renderList, E as toDisplayString, bS as BaseDirective, bT as removeClass, bU as addClass, bV as createElement, bW as hasClass, bX as script$1j, bY as script$1k, bZ as ZIndex, b_ as addStyle, b$ as ConnectedOverlayScrollHandler, c0 as isTouchDevice, c1 as relativePosition, c2 as getOuterWidth, c3 as absolutePosition, c4 as find, c5 as getIndex, c6 as getFocusableElements, c7 as OverlayEventBus, c8 as setAttribute, c9 as localeComparator, bk as script$1l, ca as script$1m, cb as script$1n, n as normalizeStyle, a8 as createTextVNode, bj as withKeys, cc as resolveFieldData, cd as isNotEmpty, ce as equals, cf as script$1o, cg as isString, ch as isPrintableCharacter, ci as isEmpty, cj as findLastIndex, ck as script$1p, cl as script$1q, cm as script$1r, cn as uuid, a9 as script$1s, co as sort, cp as createSlots, cq as EventBus, H as markRaw, cr as resolve, cs as Tooltip, bm as script$1u, ac as script$1v, ct as script$1w, cu as script$1x, cv as script$1y, cw as script$1z, bn as script$1A, cx as normalizeProps, cy as blockBodyScroll, cz as isAttributeEquals, cA as unblockBodyScroll, cB as FocusTrap, cC as guardReactiveProps, cD as setCSSProperty, cE as $dt, cF as script$1C, cG as script$1E, cH as getUserAgent, br as script$1F, cI as script$1G, cJ as getFirstFocusableElement, cK as getLastFocusableElement, cL as FilterService, bv as script$1I, cM as script$1J, bt as script$1K, bs as script$1L, cN as script$1M, cO as findIndexInList, cP as scrollInView, cQ as script$1N, cR as script$1O, cS as script$1P, cT as findLast, cU as getWindowScrollTop, cV as getWidth, cW as getOffset, cX as vModelText, cY as script$1U, as as withModifiers, cZ as getVNodeProp, c_ as getNextElementSibling, c$ as getPreviousElementSibling, d0 as isClickable, d1 as _default, d2 as clearSelection, d3 as isRTL, b9 as electronAPI, a1 as defineStore, T as ref, d4 as useTimeout, N as watch, d5 as script$1Y, _ as _export_sfc, aV as useToast, d6 as useConfirm, bl as script$1Z, d7 as script$1_, p as onMounted, d8 as onUnmounted, aw as script$1$, ag as isRef } from "./index-Bv0b06LE.js"; +import { a as script$1B, b as script$1D, s as script$20 } from "./index-A_bXPJCN.js"; +import "./index-C068lYT4.js"; +import { s as script$1t, a as script$1Q, b as script$1R, c as script$1S, d as script$1V, e as script$1W, f as script$1X } from "./index-CgMyWf7n.js"; +import { s as script$1T, _ as _sfc_main$7 } from "./TerminalOutputDrawer-CKr7Br7O.js"; +import { s as script$1H } from "./index-Dzu9WL4p.js"; +import "./index-SeIZOWJp.js"; +import { _ as _sfc_main$8 } from "./BaseViewTemplate-BTbuZf5t.js"; const _sfc_main$6 = /* @__PURE__ */ defineComponent({ __name: "RefreshButton", props: /* @__PURE__ */ mergeModels({ @@ -25632,4 +25632,4 @@ const MaintenanceView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { MaintenanceView as default }; -//# sourceMappingURL=MaintenanceView-BUmTZX1d.js.map +//# sourceMappingURL=MaintenanceView-Bh8OZpgl.js.map diff --git a/web/assets/ManualConfigurationView-D3on5kXY.js b/web/assets/ManualConfigurationView-DTLyJ3VG.js similarity index 95% rename from web/assets/ManualConfigurationView-D3on5kXY.js rename to web/assets/ManualConfigurationView-DTLyJ3VG.js index bcb4cdaa8..9f2a63acc 100644 --- a/web/assets/ManualConfigurationView-D3on5kXY.js +++ b/web/assets/ManualConfigurationView-DTLyJ3VG.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, I as useI18n, T as ref, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, a5 as script, b3 as script$1, l as script$2, b9 as electronAPI, _ as _export_sfc } from "./index-DqXp9vW4.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.js"; +import { d as defineComponent, I as useI18n, T as ref, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, a5 as script, b3 as script$1, l as script$2, b9 as electronAPI, _ as _export_sfc } from "./index-Bv0b06LE.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.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" }; @@ -71,4 +71,4 @@ const ManualConfigurationView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scop export { ManualConfigurationView as default }; -//# sourceMappingURL=ManualConfigurationView-D3on5kXY.js.map +//# sourceMappingURL=ManualConfigurationView-DTLyJ3VG.js.map diff --git a/web/assets/MetricsConsentView-DK20ednB.js b/web/assets/MetricsConsentView-C80fk2cl.js similarity index 95% rename from web/assets/MetricsConsentView-DK20ednB.js rename to web/assets/MetricsConsentView-C80fk2cl.js index e887d63b3..f92e06b76 100644 --- a/web/assets/MetricsConsentView-DK20ednB.js +++ b/web/assets/MetricsConsentView-C80fk2cl.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.js"; -import { d as defineComponent, aV as useToast, I as useI18n, T as ref, bi as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, a8 as createTextVNode, k as createVNode, j as unref, br as script, l as script$1, b9 as electronAPI } from "./index-DqXp9vW4.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.js"; +import { d as defineComponent, aV as useToast, I as useI18n, T as ref, bi as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, a8 as createTextVNode, k as createVNode, j as unref, br as script, l as script$1, b9 as electronAPI } from "./index-Bv0b06LE.js"; const _hoisted_1 = { class: "h-full p-8 2xl:p-16 flex flex-col items-center justify-center" }; const _hoisted_2 = { class: "bg-neutral-800 rounded-lg shadow-lg p-6 w-full max-w-[600px] flex flex-col gap-6" }; const _hoisted_3 = { class: "text-3xl font-semibold text-neutral-100" }; @@ -83,4 +83,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=MetricsConsentView-DK20ednB.js.map +//# sourceMappingURL=MetricsConsentView-C80fk2cl.js.map diff --git a/web/assets/NotSupportedView-BzM0uuqA.js b/web/assets/NotSupportedView-B78ZVR9Z.js similarity index 96% rename from web/assets/NotSupportedView-BzM0uuqA.js rename to web/assets/NotSupportedView-B78ZVR9Z.js index 532b19abf..f59e3d1ad 100644 --- a/web/assets/NotSupportedView-BzM0uuqA.js +++ b/web/assets/NotSupportedView-B78ZVR9Z.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, bi as useRouter, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, i as withDirectives, _ as _export_sfc } from "./index-DqXp9vW4.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.js"; +import { d as defineComponent, bi as useRouter, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, i as withDirectives, _ as _export_sfc } from "./index-Bv0b06LE.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.js"; const _imports_0 = "" + new URL("images/sad_girl.png", import.meta.url).href; const _hoisted_1 = { class: "sad-container" }; const _hoisted_2 = { class: "no-drag sad-text flex items-center" }; @@ -83,4 +83,4 @@ const NotSupportedView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", " export { NotSupportedView as default }; -//# sourceMappingURL=NotSupportedView-BzM0uuqA.js.map +//# sourceMappingURL=NotSupportedView-B78ZVR9Z.js.map diff --git a/web/assets/ServerConfigPanel-D0jTW_iX.js b/web/assets/ServerConfigPanel-BYrt6wyr.js similarity index 97% rename from web/assets/ServerConfigPanel-D0jTW_iX.js rename to web/assets/ServerConfigPanel-BYrt6wyr.js index cd7194db4..494678ac1 100644 --- a/web/assets/ServerConfigPanel-D0jTW_iX.js +++ b/web/assets/ServerConfigPanel-BYrt6wyr.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { o as openBlock, f as createElementBlock, m as createBaseVNode, H as markRaw, d as defineComponent, a as useSettingStore, af as storeToRefs, N as watch, dJ as useCopyToClipboard, I as useI18n, y as createBlock, z as withCtx, j as unref, bn as script, E as toDisplayString, D as renderList, F as Fragment, k as createVNode, l as script$1, B as createCommentVNode, bl as script$2, dK as FormItem, dz as _sfc_main$1, b9 as electronAPI } from "./index-DqXp9vW4.js"; -import { u as useServerConfigStore } from "./serverConfigStore-C8uoM7Sm.js"; +import { o as openBlock, f as createElementBlock, m as createBaseVNode, H as markRaw, d as defineComponent, a as useSettingStore, af as storeToRefs, N as watch, dJ as useCopyToClipboard, I as useI18n, y as createBlock, z as withCtx, j as unref, bn as script, E as toDisplayString, D as renderList, F as Fragment, k as createVNode, l as script$1, B as createCommentVNode, bl as script$2, dK as FormItem, dz as _sfc_main$1, b9 as electronAPI } from "./index-Bv0b06LE.js"; +import { u as useServerConfigStore } from "./serverConfigStore-D2Vr0L0h.js"; const _hoisted_1$1 = { viewBox: "0 0 24 24", width: "1.2em", @@ -153,4 +153,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=ServerConfigPanel-D0jTW_iX.js.map +//# sourceMappingURL=ServerConfigPanel-BYrt6wyr.js.map diff --git a/web/assets/ServerStartView-BENqs5bD.js b/web/assets/ServerStartView-B7TlHxYo.js similarity index 96% rename from web/assets/ServerStartView-BENqs5bD.js rename to web/assets/ServerStartView-B7TlHxYo.js index 2e154ee90..80dfeb323 100644 --- a/web/assets/ServerStartView-BENqs5bD.js +++ b/web/assets/ServerStartView-B7TlHxYo.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, I as useI18n, T as ref, bo as ProgressStatus, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, a8 as createTextVNode, E as toDisplayString, j as unref, f as createElementBlock, B as createCommentVNode, k as createVNode, l as script, i as withDirectives, v as vShow, bp as BaseTerminal, b9 as electronAPI, _ as _export_sfc } from "./index-DqXp9vW4.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.js"; +import { d as defineComponent, I as useI18n, T as ref, bo as ProgressStatus, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, a8 as createTextVNode, E as toDisplayString, j as unref, f as createElementBlock, B as createCommentVNode, k as createVNode, l as script, i as withDirectives, v as vShow, bp as BaseTerminal, b9 as electronAPI, _ as _export_sfc } from "./index-Bv0b06LE.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.js"; const _hoisted_1 = { class: "flex flex-col w-full h-full items-center" }; const _hoisted_2 = { class: "text-2xl font-bold" }; const _hoisted_3 = { key: 0 }; @@ -97,4 +97,4 @@ const ServerStartView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "d export { ServerStartView as default }; -//# sourceMappingURL=ServerStartView-BENqs5bD.js.map +//# sourceMappingURL=ServerStartView-B7TlHxYo.js.map diff --git a/web/assets/TerminalOutputDrawer-BgTEspHP.js b/web/assets/TerminalOutputDrawer-CKr7Br7O.js similarity index 99% rename from web/assets/TerminalOutputDrawer-BgTEspHP.js rename to web/assets/TerminalOutputDrawer-CKr7Br7O.js index 786fe62f1..09062bab9 100644 --- a/web/assets/TerminalOutputDrawer-BgTEspHP.js +++ b/web/assets/TerminalOutputDrawer-CKr7Br7O.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bG as BaseStyle, bH as script$2, bZ as ZIndex, bU as addClass, bL as focus, cy as blockBodyScroll, cA as unblockBodyScroll, cB as FocusTrap, l as script$3, ca as script$4, cl as script$5, bR as resolveComponent, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, f as createElementBlock, at as mergeProps, k as createVNode, bI as Transition, i as withDirectives, A as renderSlot, F as Fragment, m as createBaseVNode, aj as normalizeClass, E as toDisplayString, B as createCommentVNode, C as resolveDynamicComponent, dd as commonjsGlobal, de as getDefaultExportFromCjs, H as markRaw, df as xtermExports, p as onMounted, d8 as onUnmounted, d as defineComponent, bw as mergeModels, bq as useModel, bp as BaseTerminal, j as unref, b9 as electronAPI } from "./index-DqXp9vW4.js"; +import { bG as BaseStyle, bH as script$2, bZ as ZIndex, bU as addClass, bL as focus, cy as blockBodyScroll, cA as unblockBodyScroll, cB as FocusTrap, l as script$3, ca as script$4, cl as script$5, bR as resolveComponent, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, f as createElementBlock, at as mergeProps, k as createVNode, bI as Transition, i as withDirectives, A as renderSlot, F as Fragment, m as createBaseVNode, aj as normalizeClass, E as toDisplayString, B as createCommentVNode, C as resolveDynamicComponent, dd as commonjsGlobal, de as getDefaultExportFromCjs, H as markRaw, df as xtermExports, p as onMounted, d8 as onUnmounted, d as defineComponent, bw as mergeModels, bq as useModel, bp as BaseTerminal, j as unref, b9 as electronAPI } from "./index-Bv0b06LE.js"; var theme = /* @__PURE__ */ __name(function theme2(_ref) { var dt = _ref.dt; return "\n.p-drawer {\n display: flex;\n flex-direction: column;\n transform: translate3d(0px, 0px, 0px);\n position: relative;\n transition: transform 0.3s;\n background: ".concat(dt("drawer.background"), ";\n color: ").concat(dt("drawer.color"), ";\n border: 1px solid ").concat(dt("drawer.border.color"), ";\n box-shadow: ").concat(dt("drawer.shadow"), ";\n}\n\n.p-drawer-content {\n overflow-y: auto;\n flex-grow: 1;\n padding: ").concat(dt("drawer.content.padding"), ";\n}\n\n.p-drawer-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-shrink: 0;\n padding: ").concat(dt("drawer.header.padding"), ";\n}\n\n.p-drawer-footer {\n padding: ").concat(dt("drawer.footer.padding"), ";\n}\n\n.p-drawer-title {\n font-weight: ").concat(dt("drawer.title.font.weight"), ";\n font-size: ").concat(dt("drawer.title.font.size"), ";\n}\n\n.p-drawer-full .p-drawer {\n transition: none;\n transform: none;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n border-width: 1px;\n}\n\n.p-drawer-left .p-drawer-enter-from,\n.p-drawer-left .p-drawer-leave-to {\n transform: translateX(-100%);\n}\n\n.p-drawer-right .p-drawer-enter-from,\n.p-drawer-right .p-drawer-leave-to {\n transform: translateX(100%);\n}\n\n.p-drawer-top .p-drawer-enter-from,\n.p-drawer-top .p-drawer-leave-to {\n transform: translateY(-100%);\n}\n\n.p-drawer-bottom .p-drawer-enter-from,\n.p-drawer-bottom .p-drawer-leave-to {\n transform: translateY(100%);\n}\n\n.p-drawer-full .p-drawer-enter-from,\n.p-drawer-full .p-drawer-leave-to {\n opacity: 0;\n}\n\n.p-drawer-full .p-drawer-enter-active,\n.p-drawer-full .p-drawer-leave-active {\n transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n.p-drawer-left .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-end-width: 1px;\n}\n\n.p-drawer-right .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-start-width: 1px;\n}\n\n.p-drawer-top .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-end-width: 1px;\n}\n\n.p-drawer-bottom .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-start-width: 1px;\n}\n\n.p-drawer-left .p-drawer-content,\n.p-drawer-right .p-drawer-content,\n.p-drawer-top .p-drawer-content,\n.p-drawer-bottom .p-drawer-content {\n width: 100%;\n height: 100%;\n}\n\n.p-drawer-open {\n display: flex;\n}\n\n.p-drawer-mask:dir(rtl) {\n flex-direction: row-reverse;\n}\n"); @@ -1058,4 +1058,4 @@ export { _sfc_main as _, script as s }; -//# sourceMappingURL=TerminalOutputDrawer-BgTEspHP.js.map +//# sourceMappingURL=TerminalOutputDrawer-CKr7Br7O.js.map diff --git a/web/assets/UserSelectView-CRPNAEVJ.js b/web/assets/UserSelectView-C703HOyO.js similarity index 97% rename from web/assets/UserSelectView-CRPNAEVJ.js rename to web/assets/UserSelectView-C703HOyO.js index d5d12bd6b..6ada5034d 100644 --- a/web/assets/UserSelectView-CRPNAEVJ.js +++ b/web/assets/UserSelectView-C703HOyO.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, ak as useUserStore, bi as useRouter, T as ref, c as computed, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, bj as withKeys, j as unref, bk as script, bl as script$1, bm as script$2, bn as script$3, a8 as createTextVNode, B as createCommentVNode, l as script$4 } from "./index-DqXp9vW4.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.js"; +import { d as defineComponent, ak as useUserStore, bi as useRouter, T as ref, c as computed, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, bj as withKeys, j as unref, bk as script, bl as script$1, bm as script$2, bn as script$3, a8 as createTextVNode, B as createCommentVNode, l as script$4 } from "./index-Bv0b06LE.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.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" @@ -98,4 +98,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({ export { _sfc_main as default }; -//# sourceMappingURL=UserSelectView-CRPNAEVJ.js.map +//# sourceMappingURL=UserSelectView-C703HOyO.js.map diff --git a/web/assets/WelcomeView-Cvtvw05C.js b/web/assets/WelcomeView-DIFvbWc2.js similarity index 91% rename from web/assets/WelcomeView-Cvtvw05C.js rename to web/assets/WelcomeView-DIFvbWc2.js index 20b087d94..93c670199 100644 --- a/web/assets/WelcomeView-Cvtvw05C.js +++ b/web/assets/WelcomeView-DIFvbWc2.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, bi as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, _ as _export_sfc } from "./index-DqXp9vW4.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-DlGljfEG.js"; +import { d as defineComponent, bi as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, _ as _export_sfc } from "./index-Bv0b06LE.js"; +import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.js"; 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({ @@ -36,4 +36,4 @@ const WelcomeView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data- export { WelcomeView as default }; -//# sourceMappingURL=WelcomeView-Cvtvw05C.js.map +//# sourceMappingURL=WelcomeView-DIFvbWc2.js.map diff --git a/web/assets/index-B0BQ8jlU.js b/web/assets/index-A_bXPJCN.js similarity index 99% rename from web/assets/index-B0BQ8jlU.js rename to web/assets/index-A_bXPJCN.js index 350e04eca..8753d0e80 100644 --- a/web/assets/index-B0BQ8jlU.js +++ b/web/assets/index-A_bXPJCN.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bG as BaseStyle, bX as script$5, o as openBlock, f as createElementBlock, at as mergeProps, m as createBaseVNode, bH as script$6, cF as script$7, cG as script$8, cl as script$9, bO as Ripple, r as resolveDirective, y as createBlock, C as resolveDynamicComponent, F as Fragment, E as toDisplayString, cx as normalizeProps, i as withDirectives, B as createCommentVNode, dg as ToastEventBus, bZ as ZIndex, ci as isEmpty, c8 as setAttribute, ca as script$a, bR as resolveComponent, z as withCtx, k as createVNode, dh as TransitionGroup, D as renderList } from "./index-DqXp9vW4.js"; +import { bG as BaseStyle, bX as script$5, o as openBlock, f as createElementBlock, at as mergeProps, m as createBaseVNode, bH as script$6, cF as script$7, cG as script$8, cl as script$9, bO as Ripple, r as resolveDirective, y as createBlock, C as resolveDynamicComponent, F as Fragment, E as toDisplayString, cx as normalizeProps, i as withDirectives, B as createCommentVNode, dg as ToastEventBus, bZ as ZIndex, ci as isEmpty, c8 as setAttribute, ca as script$a, bR as resolveComponent, z as withCtx, k as createVNode, dh as TransitionGroup, D as renderList } from "./index-Bv0b06LE.js"; function _typeof$2(o) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { @@ -615,4 +615,4 @@ export { script$4 as b, script as s }; -//# sourceMappingURL=index-B0BQ8jlU.js.map +//# sourceMappingURL=index-A_bXPJCN.js.map diff --git a/web/assets/index-D9D9jjLT.js b/web/assets/index-B36GcHVN.js similarity index 99% rename from web/assets/index-D9D9jjLT.js rename to web/assets/index-B36GcHVN.js index 22a3f2910..3aed3257e 100644 --- a/web/assets/index-D9D9jjLT.js +++ b/web/assets/index-B36GcHVN.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { di as ComfyDialog, dj as $el, dk as ComfyApp, h as app, L as LiteGraph, aD as LGraphCanvas, dl as useExtensionService, dm as processDynamicPrompt, b8 as isElectron, b9 as electronAPI, b as useWorkflowStore, by as checkMirrorReachable, bb as useDialogService, bg as t, dn as DraggableList, aW as useToastStore, $ as LGraphNode, dp as applyTextReplacements, dq as ComfyWidgets, dr as addValueControlWidgets, O as useNodeDefStore, a as useSettingStore, ds as serialise, dt as deserialiseAndCreate, aL as api, Z as LGraphGroup, d as defineComponent, T as ref, p as onMounted, d8 as onUnmounted, r as resolveDirective, o as openBlock, f as createElementBlock, k as createVNode, j as unref, l as script, z as withCtx, i as withDirectives, m as createBaseVNode, y as createBlock, aj as normalizeClass, du as script$1, v as vShow, B as createCommentVNode, dv as createApp, cs as Tooltip, N as watch, bm as script$2, dw as PrimeVue, V as nextTick, b4 as lodashExports, aO as setStorageValue, aM as getStorageValue } from "./index-DqXp9vW4.js"; +import { di as ComfyDialog, dj as $el, dk as ComfyApp, h as app, L as LiteGraph, aD as LGraphCanvas, dl as useExtensionService, dm as processDynamicPrompt, b8 as isElectron, b9 as electronAPI, b as useWorkflowStore, by as checkMirrorReachable, bb as useDialogService, bg as t, dn as DraggableList, aW as useToastStore, $ as LGraphNode, dp as applyTextReplacements, dq as ComfyWidgets, dr as addValueControlWidgets, O as useNodeDefStore, a as useSettingStore, ds as serialise, dt as deserialiseAndCreate, aL as api, Z as LGraphGroup, d as defineComponent, T as ref, p as onMounted, d8 as onUnmounted, r as resolveDirective, o as openBlock, f as createElementBlock, k as createVNode, j as unref, l as script, z as withCtx, i as withDirectives, m as createBaseVNode, y as createBlock, aj as normalizeClass, du as script$1, v as vShow, B as createCommentVNode, dv as createApp, cs as Tooltip, N as watch, bm as script$2, dw as PrimeVue, V as nextTick, b4 as lodashExports, aO as setStorageValue, aM as getStorageValue } from "./index-Bv0b06LE.js"; import { P as PYTHON_MIRROR } from "./uvMirrors-B-HKMf6X.js"; class ClipspaceDialog extends ComfyDialog { static { @@ -46215,7 +46215,7 @@ class STLLoader extends Loader { return isBinary(binData) ? parseBinary(binData) : parseASCII(ensureString(data)); } } -const _hoisted_1$1 = { class: "absolute top-2 left-2 flex flex-col gap-2 z-20" }; +const _hoisted_1$1 = { class: "absolute top-2 left-2 flex flex-col gap-2 pointer-events-auto z-20" }; const _hoisted_2$1 = { class: "pi pi-camera text-white text-lg" }; const _hoisted_3 = { class: "pi pi-palette text-white text-lg" }; const _hoisted_4 = ["value"]; @@ -47271,7 +47271,7 @@ class Load3d { const _hoisted_1 = { class: "absolute top-0 left-0 w-full h-full pointer-events-none" }; const _hoisted_2 = { key: 0, - class: "absolute top-0 left-0 w-full flex justify-center pt-2 gap-2 items-center z-10" + class: "absolute top-0 left-0 w-full flex justify-center pt-2 gap-2 items-center pointer-events-auto z-10" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "Load3DAnimationControls", @@ -54179,4 +54179,4 @@ app.registerExtension({ }); } }); -//# sourceMappingURL=index-D9D9jjLT.js.map +//# sourceMappingURL=index-B36GcHVN.js.map diff --git a/web/assets/index-DqXp9vW4.js b/web/assets/index-Bv0b06LE.js similarity index 99% rename from web/assets/index-DqXp9vW4.js rename to web/assets/index-Bv0b06LE.js index 46d800e22..b91de40d7 100644 --- a/web/assets/index-DqXp9vW4.js +++ b/web/assets/index-Bv0b06LE.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-CLFBgoGf.js","./index-DSWvxALN.js","./index-BTHx8UHZ.js","./index-B0BQ8jlU.js","./keybindingService-DgS0S2M6.js","./serverConfigStore-C8uoM7Sm.js","./GraphView-Bo28XDd0.css","./UserSelectView-CRPNAEVJ.js","./BaseViewTemplate-DlGljfEG.js","./ServerStartView-BENqs5bD.js","./ServerStartView-BZ7uhZHv.css","./InstallView-x9XCq0hC.js","./index-A-dAhghd.js","./uvMirrors-B-HKMf6X.js","./InstallView-DbJ2cGfL.css","./WelcomeView-Cvtvw05C.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-BzM0uuqA.js","./NotSupportedView-RFx6eCkN.css","./DownloadGitView-SPK8AXQU.js","./ManualConfigurationView-D3on5kXY.js","./ManualConfigurationView-CsirlNfV.css","./MetricsConsentView-DK20ednB.js","./DesktopStartView-B2BMUZxW.js","./MaintenanceView-BUmTZX1d.js","./index-KUUE4Ew8.js","./TerminalOutputDrawer-BgTEspHP.js","./MaintenanceView-DEJCj8SR.css","./DesktopUpdateView-DWsew03S.js","./DesktopUpdateView-CxchaIvw.css","./KeybindingPanel-BIrxefrS.js","./KeybindingPanel-CDYVPYDp.css","./ExtensionPanel-1HZtMFvH.js","./ServerConfigPanel-D0jTW_iX.js","./index-D9D9jjLT.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-B_UDZi95.js","./index-C068lYT4.js","./index-Dzu9WL4p.js","./index-A_bXPJCN.js","./keybindingService-DyjX-nxF.js","./serverConfigStore-D2Vr0L0h.js","./GraphView-Bo28XDd0.css","./UserSelectView-C703HOyO.js","./BaseViewTemplate-BTbuZf5t.js","./ServerStartView-B7TlHxYo.js","./ServerStartView-BZ7uhZHv.css","./InstallView-DW9xwU_F.js","./index-SeIZOWJp.js","./uvMirrors-B-HKMf6X.js","./InstallView-DbJ2cGfL.css","./WelcomeView-DIFvbWc2.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-B78ZVR9Z.js","./NotSupportedView-RFx6eCkN.css","./DownloadGitView-PWqK5ke4.js","./ManualConfigurationView-DTLyJ3VG.js","./ManualConfigurationView-CsirlNfV.css","./MetricsConsentView-C80fk2cl.js","./DesktopStartView-D9r53Bue.js","./MaintenanceView-Bh8OZpgl.js","./index-CgMyWf7n.js","./TerminalOutputDrawer-CKr7Br7O.js","./MaintenanceView-DEJCj8SR.css","./DesktopUpdateView-C-R0415K.js","./DesktopUpdateView-CxchaIvw.css","./KeybindingPanel-oavhFdkz.js","./KeybindingPanel-CDYVPYDp.css","./ExtensionPanel-Ba57xrmg.js","./ServerConfigPanel-BYrt6wyr.js","./index-B36GcHVN.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); var __defProp2 = Object.defineProperty; var __name = (target2, value4) => __defProp2(target2, "name", { value: value4, configurable: true }); (/* @__PURE__ */ __name(function polyfill2() { @@ -73870,7 +73870,7 @@ const router = createRouter({ { path: "", name: "GraphView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./GraphView-CLFBgoGf.js"), true ? __vite__mapDeps([0,1,2,3,4,5,6]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./GraphView-B_UDZi95.js"), true ? __vite__mapDeps([0,1,2,3,4,5,6]) : void 0, import.meta.url), "component"), beforeEnter: /* @__PURE__ */ __name(async (to, from2, next2) => { const userStore = useUserStore(); await userStore.initialize(); @@ -73884,66 +73884,66 @@ const router = createRouter({ { path: "user-select", name: "UserSelectView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./UserSelectView-CRPNAEVJ.js"), true ? __vite__mapDeps([7,8]) : void 0, import.meta.url), "component") + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./UserSelectView-C703HOyO.js"), true ? __vite__mapDeps([7,8]) : void 0, import.meta.url), "component") }, { path: "server-start", name: "ServerStartView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ServerStartView-BENqs5bD.js"), true ? __vite__mapDeps([9,8,10]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ServerStartView-B7TlHxYo.js"), true ? __vite__mapDeps([9,8,10]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "install", name: "InstallView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./InstallView-x9XCq0hC.js"), true ? __vite__mapDeps([11,12,13,8,14]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./InstallView-DW9xwU_F.js"), true ? __vite__mapDeps([11,12,13,8,14]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "welcome", name: "WelcomeView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./WelcomeView-Cvtvw05C.js"), true ? __vite__mapDeps([15,8,16]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./WelcomeView-DIFvbWc2.js"), true ? __vite__mapDeps([15,8,16]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "not-supported", name: "NotSupportedView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./NotSupportedView-BzM0uuqA.js"), true ? __vite__mapDeps([17,8,18]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./NotSupportedView-B78ZVR9Z.js"), true ? __vite__mapDeps([17,8,18]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "download-git", name: "DownloadGitView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DownloadGitView-SPK8AXQU.js"), true ? __vite__mapDeps([19,8]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DownloadGitView-PWqK5ke4.js"), true ? __vite__mapDeps([19,8]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "manual-configuration", name: "ManualConfigurationView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ManualConfigurationView-D3on5kXY.js"), true ? __vite__mapDeps([20,8,21]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./ManualConfigurationView-DTLyJ3VG.js"), true ? __vite__mapDeps([20,8,21]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "/metrics-consent", name: "MetricsConsentView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MetricsConsentView-DK20ednB.js"), true ? __vite__mapDeps([22,8]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MetricsConsentView-C80fk2cl.js"), true ? __vite__mapDeps([22,8]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "desktop-start", name: "DesktopStartView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DesktopStartView-B2BMUZxW.js"), true ? __vite__mapDeps([23,8]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DesktopStartView-D9r53Bue.js"), true ? __vite__mapDeps([23,8]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "maintenance", name: "MaintenanceView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MaintenanceView-BUmTZX1d.js"), true ? __vite__mapDeps([24,3,1,2,25,26,12,8,27]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./MaintenanceView-Bh8OZpgl.js"), true ? __vite__mapDeps([24,3,1,2,25,26,12,8,27]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess }, { path: "desktop-update", name: "DesktopUpdateView", - component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DesktopUpdateView-DWsew03S.js"), true ? __vite__mapDeps([28,3,26,8,29]) : void 0, import.meta.url), "component"), + component: /* @__PURE__ */ __name(() => __vitePreload(() => import("./DesktopUpdateView-C-R0415K.js"), true ? __vite__mapDeps([28,3,26,8,29]) : void 0, import.meta.url), "component"), beforeEnter: guardElectronAccess } ] @@ -85961,7 +85961,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({ }); const config$1 = { app_title: "ComfyUI", - app_version: "1.9.17" + app_version: "1.9.18" }; /*! * shared v9.13.1 @@ -154199,7 +154199,7 @@ const useSystemStatsStore = /* @__PURE__ */ defineStore("systemStats", () => { }; }); const useAboutPanelStore = /* @__PURE__ */ defineStore("aboutPanel", () => { - const frontendVersion = "1.9.17"; + const frontendVersion = "1.9.18"; const extensionStore = useExtensionStore(); const systemStatsStore = useSystemStatsStore(); const coreVersion = computed( @@ -159658,13 +159658,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({ setup(__props) { const props = __props; const KeybindingPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./KeybindingPanel-BIrxefrS.js"), true ? __vite__mapDeps([30,25,2,4,31]) : void 0, import.meta.url) + () => __vitePreload(() => import("./KeybindingPanel-oavhFdkz.js"), true ? __vite__mapDeps([30,25,2,4,31]) : void 0, import.meta.url) ); const ExtensionPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./ExtensionPanel-1HZtMFvH.js"), true ? __vite__mapDeps([32,25,2]) : void 0, import.meta.url) + () => __vitePreload(() => import("./ExtensionPanel-Ba57xrmg.js"), true ? __vite__mapDeps([32,25,2]) : void 0, import.meta.url) ); const ServerConfigPanel = /* @__PURE__ */ defineAsyncComponent( - () => __vitePreload(() => import("./ServerConfigPanel-D0jTW_iX.js"), true ? __vite__mapDeps([33,5]) : void 0, import.meta.url) + () => __vitePreload(() => import("./ServerConfigPanel-BYrt6wyr.js"), true ? __vite__mapDeps([33,5]) : void 0, import.meta.url) ); const aboutPanelNode = { key: "about", @@ -200522,7 +200522,7 @@ const useExtensionService = /* @__PURE__ */ __name(() => { settingStore.get("Comfy.Extension.Disabled") ); const extensions = await api.getExtensions(); - await __vitePreload(() => import("./index-D9D9jjLT.js"), true ? __vite__mapDeps([34,13,35]) : void 0, import.meta.url); + await __vitePreload(() => import("./index-B36GcHVN.js"), true ? __vite__mapDeps([34,13,35]) : void 0, import.meta.url); extensionStore.captureCoreExtensions(); await Promise.all( extensions.filter((extension) => !extension.includes("extensions/core")).map(async (ext) => { @@ -220720,7 +220720,7 @@ init$3({ app, dsn: "https://e2d0c0bd392ffdce48e856c2a055f437@o4507954455314432.ingest.us.sentry.io/4508621568475136", enabled: true, - release: "1.9.17", + release: "1.9.18", integrations: [], autoSessionTracking: false, defaultIntegrations: false, @@ -221037,4 +221037,4 @@ export { createBlock as y, withCtx as z }; -//# sourceMappingURL=index-DqXp9vW4.js.map +//# sourceMappingURL=index-Bv0b06LE.js.map diff --git a/web/assets/index-DSWvxALN.js b/web/assets/index-C068lYT4.js similarity index 99% rename from web/assets/index-DSWvxALN.js rename to web/assets/index-C068lYT4.js index d7da709c2..0dd767df0 100644 --- a/web/assets/index-DSWvxALN.js +++ b/web/assets/index-C068lYT4.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bG as BaseStyle, bH as script$c, cV as getWidth, d9 as getHeight, c2 as getOuterWidth, da as getOuterHeight, d3 as isRTL, cZ as getVNodeProp, db as isArray, o as openBlock, f as createElementBlock, at as mergeProps, F as Fragment, D as renderList, y as createBlock, C as resolveDynamicComponent, m as createBaseVNode, B as createCommentVNode, A as renderSlot, bK as getAttribute, bJ as findSingle, bL as focus, ce as equals, bO as Ripple, r as resolveDirective, i as withDirectives, z as withCtx, aj as normalizeClass, cW as getOffset, cb as script$d, bQ as script$e, cd as isNotEmpty, bY as script$f, bP as UniqueComponentId, bZ as ZIndex, cc as resolveFieldData, c7 as OverlayEventBus, ci as isEmpty, b_ as addStyle, c1 as relativePosition, c3 as absolutePosition, b$ as ConnectedOverlayScrollHandler, c0 as isTouchDevice, cj as findLastIndex, bk as script$g, cM as script$h, ca as script$i, bN as script$j, ck as script$k, a9 as script$l, bR as resolveComponent, n as normalizeStyle, k as createVNode, E as toDisplayString, bI as Transition, cp as createSlots, a8 as createTextVNode, cv as script$m, cr as resolve, dc as nestedPosition, cf as script$n, ch as isPrintableCharacter, l as script$o, cI as script$p, cx as normalizeProps, cC as guardReactiveProps } from "./index-DqXp9vW4.js"; -import { s as script$q } from "./index-BTHx8UHZ.js"; +import { bG as BaseStyle, bH as script$c, cV as getWidth, d9 as getHeight, c2 as getOuterWidth, da as getOuterHeight, d3 as isRTL, cZ as getVNodeProp, db as isArray, o as openBlock, f as createElementBlock, at as mergeProps, F as Fragment, D as renderList, y as createBlock, C as resolveDynamicComponent, m as createBaseVNode, B as createCommentVNode, A as renderSlot, bK as getAttribute, bJ as findSingle, bL as focus, ce as equals, bO as Ripple, r as resolveDirective, i as withDirectives, z as withCtx, aj as normalizeClass, cW as getOffset, cb as script$d, bQ as script$e, cd as isNotEmpty, bY as script$f, bP as UniqueComponentId, bZ as ZIndex, cc as resolveFieldData, c7 as OverlayEventBus, ci as isEmpty, b_ as addStyle, c1 as relativePosition, c3 as absolutePosition, b$ as ConnectedOverlayScrollHandler, c0 as isTouchDevice, cj as findLastIndex, bk as script$g, cM as script$h, ca as script$i, bN as script$j, ck as script$k, a9 as script$l, bR as resolveComponent, n as normalizeStyle, k as createVNode, E as toDisplayString, bI as Transition, cp as createSlots, a8 as createTextVNode, cv as script$m, cr as resolve, dc as nestedPosition, cf as script$n, ch as isPrintableCharacter, l as script$o, cI as script$p, cx as normalizeProps, cC as guardReactiveProps } from "./index-Bv0b06LE.js"; +import { s as script$q } from "./index-Dzu9WL4p.js"; var theme$6 = /* @__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"); @@ -4990,4 +4990,4 @@ export { script as h, script$a as s }; -//# sourceMappingURL=index-DSWvxALN.js.map +//# sourceMappingURL=index-C068lYT4.js.map diff --git a/web/assets/index-KUUE4Ew8.js b/web/assets/index-CgMyWf7n.js similarity index 99% rename from web/assets/index-KUUE4Ew8.js rename to web/assets/index-CgMyWf7n.js index dd2a87a8c..24e5adc4e 100644 --- a/web/assets/index-KUUE4Ew8.js +++ b/web/assets/index-CgMyWf7n.js @@ -1,7 +1,7 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bG as BaseStyle, bH as script$s, bX as script$t, o as openBlock, f as createElementBlock, at as mergeProps, m as createBaseVNode, E as toDisplayString, bO as Ripple, r as resolveDirective, i as withDirectives, y as createBlock, C as resolveDynamicComponent, bm as script$u, bR as resolveComponent, aj as normalizeClass, cp as createSlots, z as withCtx, aY as script$v, cf as script$w, F as Fragment, D as renderList, a8 as createTextVNode, c8 as setAttribute, cx as normalizeProps, A as renderSlot, B as createCommentVNode, bY as script$x, ce as equals, cF as script$y, bv as script$z, cJ as getFirstFocusableElement, c7 as OverlayEventBus, cZ as getVNodeProp, cc as resolveFieldData, dD as invokeElementMethod, bK as getAttribute, c_ as getNextElementSibling, c2 as getOuterWidth, c$ as getPreviousElementSibling, l as script$A, bN as script$B, bQ as script$C, cl as script$E, cd as isNotEmpty, as as withModifiers, da as getOuterHeight, bP as UniqueComponentId, d1 as _default, bZ as ZIndex, bL as focus, b_ as addStyle, c3 as absolutePosition, b$ as ConnectedOverlayScrollHandler, c0 as isTouchDevice, dE as FilterOperator, ca as script$F, ct as script$G, cB as FocusTrap, k as createVNode, bI as Transition, bj as withKeys, c5 as getIndex, cv as script$H, d0 as isClickable, d2 as clearSelection, c9 as localeComparator, co as sort, cL as FilterService, dx as FilterMatchMode, bJ as findSingle, cO as findIndexInList, c4 as find, dF as exportCSV, cW as getOffset, d3 as isRTL, dG as getHiddenElementOuterWidth, dH as getHiddenElementOuterHeight, dI as reorderArray, bT as removeClass, bU as addClass, ci as isEmpty, cM as script$I, ck as script$J } from "./index-DqXp9vW4.js"; -import { s as script$D } from "./index-BTHx8UHZ.js"; +import { bG as BaseStyle, bH as script$s, bX as script$t, o as openBlock, f as createElementBlock, at as mergeProps, m as createBaseVNode, E as toDisplayString, bO as Ripple, r as resolveDirective, i as withDirectives, y as createBlock, C as resolveDynamicComponent, bm as script$u, bR as resolveComponent, aj as normalizeClass, cp as createSlots, z as withCtx, aY as script$v, cf as script$w, F as Fragment, D as renderList, a8 as createTextVNode, c8 as setAttribute, cx as normalizeProps, A as renderSlot, B as createCommentVNode, bY as script$x, ce as equals, cF as script$y, bv as script$z, cJ as getFirstFocusableElement, c7 as OverlayEventBus, cZ as getVNodeProp, cc as resolveFieldData, dD as invokeElementMethod, bK as getAttribute, c_ as getNextElementSibling, c2 as getOuterWidth, c$ as getPreviousElementSibling, l as script$A, bN as script$B, bQ as script$C, cl as script$E, cd as isNotEmpty, as as withModifiers, da as getOuterHeight, bP as UniqueComponentId, d1 as _default, bZ as ZIndex, bL as focus, b_ as addStyle, c3 as absolutePosition, b$ as ConnectedOverlayScrollHandler, c0 as isTouchDevice, dE as FilterOperator, ca as script$F, ct as script$G, cB as FocusTrap, k as createVNode, bI as Transition, bj as withKeys, c5 as getIndex, cv as script$H, d0 as isClickable, d2 as clearSelection, c9 as localeComparator, co as sort, cL as FilterService, dx as FilterMatchMode, bJ as findSingle, cO as findIndexInList, c4 as find, dF as exportCSV, cW as getOffset, d3 as isRTL, dG as getHiddenElementOuterWidth, dH as getHiddenElementOuterHeight, dI as reorderArray, bT as removeClass, bU as addClass, ci as isEmpty, cM as script$I, ck as script$J } from "./index-Bv0b06LE.js"; +import { s as script$D } from "./index-Dzu9WL4p.js"; var ColumnStyle = BaseStyle.extend({ name: "column" }); @@ -8787,4 +8787,4 @@ export { script as h, script$l as s }; -//# sourceMappingURL=index-KUUE4Ew8.js.map +//# sourceMappingURL=index-CgMyWf7n.js.map diff --git a/web/assets/index-BTHx8UHZ.js b/web/assets/index-Dzu9WL4p.js similarity index 94% rename from web/assets/index-BTHx8UHZ.js rename to web/assets/index-Dzu9WL4p.js index 71fd1e5d8..43332ad42 100644 --- a/web/assets/index-BTHx8UHZ.js +++ b/web/assets/index-Dzu9WL4p.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bX as script$1, o as openBlock, f as createElementBlock, at as mergeProps, m as createBaseVNode } from "./index-DqXp9vW4.js"; +import { bX as script$1, o as openBlock, f as createElementBlock, at as mergeProps, m as createBaseVNode } from "./index-Bv0b06LE.js"; var script = { name: "BarsIcon", "extends": script$1 @@ -24,4 +24,4 @@ script.render = render; export { script as s }; -//# sourceMappingURL=index-BTHx8UHZ.js.map +//# sourceMappingURL=index-Dzu9WL4p.js.map diff --git a/web/assets/index-A-dAhghd.js b/web/assets/index-SeIZOWJp.js similarity index 99% rename from web/assets/index-A-dAhghd.js rename to web/assets/index-SeIZOWJp.js index 69e7290ff..eff075f74 100644 --- a/web/assets/index-A-dAhghd.js +++ b/web/assets/index-SeIZOWJp.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -import { bG as BaseStyle, bH as script$6, o as openBlock, f as createElementBlock, at as mergeProps, cO as findIndexInList, c4 as find, bR as resolveComponent, y as createBlock, C as resolveDynamicComponent, z as withCtx, m as createBaseVNode, E as toDisplayString, A as renderSlot, B as createCommentVNode, aj as normalizeClass, bJ as findSingle, F as Fragment, bI as Transition, i as withDirectives, v as vShow, bP as UniqueComponentId } from "./index-DqXp9vW4.js"; +import { bG as BaseStyle, bH as script$6, o as openBlock, f as createElementBlock, at as mergeProps, cO as findIndexInList, c4 as find, bR as resolveComponent, y as createBlock, C as resolveDynamicComponent, z as withCtx, m as createBaseVNode, E as toDisplayString, A as renderSlot, B as createCommentVNode, aj as normalizeClass, bJ as findSingle, F as Fragment, bI as Transition, i as withDirectives, v as vShow, bP as UniqueComponentId } from "./index-Bv0b06LE.js"; var classes$4 = { root: /* @__PURE__ */ __name(function root(_ref) { var instance = _ref.instance; @@ -536,4 +536,4 @@ export { script as d, script$4 as s }; -//# sourceMappingURL=index-A-dAhghd.js.map +//# sourceMappingURL=index-SeIZOWJp.js.map diff --git a/web/assets/keybindingService-DgS0S2M6.js b/web/assets/keybindingService-DyjX-nxF.js similarity index 98% rename from web/assets/keybindingService-DgS0S2M6.js rename to web/assets/keybindingService-DyjX-nxF.js index 6b2f26f05..eb4730051 100644 --- a/web/assets/keybindingService-DgS0S2M6.js +++ b/web/assets/keybindingService-DyjX-nxF.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { ao as useKeybindingStore, J as useCommandStore, a as useSettingStore, dA as KeyComboImpl, dB as KeybindingImpl } from "./index-DqXp9vW4.js"; +import { ao as useKeybindingStore, J as useCommandStore, a as useSettingStore, dA as KeyComboImpl, dB as KeybindingImpl } from "./index-Bv0b06LE.js"; const CORE_KEYBINDINGS = [ { combo: { @@ -247,4 +247,4 @@ const useKeybindingService = /* @__PURE__ */ __name(() => { export { useKeybindingService as u }; -//# sourceMappingURL=keybindingService-DgS0S2M6.js.map +//# sourceMappingURL=keybindingService-DyjX-nxF.js.map diff --git a/web/assets/serverConfigStore-C8uoM7Sm.js b/web/assets/serverConfigStore-D2Vr0L0h.js similarity index 97% rename from web/assets/serverConfigStore-C8uoM7Sm.js rename to web/assets/serverConfigStore-D2Vr0L0h.js index b447c27b7..d4ff4307e 100644 --- a/web/assets/serverConfigStore-C8uoM7Sm.js +++ b/web/assets/serverConfigStore-D2Vr0L0h.js @@ -1,6 +1,6 @@ var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { a1 as defineStore, T as ref, c as computed } from "./index-DqXp9vW4.js"; +import { a1 as defineStore, T as ref, c as computed } from "./index-Bv0b06LE.js"; const useServerConfigStore = defineStore("serverConfig", () => { const serverConfigById = ref({}); const serverConfigs = computed(() => { @@ -87,4 +87,4 @@ const useServerConfigStore = defineStore("serverConfig", () => { export { useServerConfigStore as u }; -//# sourceMappingURL=serverConfigStore-C8uoM7Sm.js.map +//# sourceMappingURL=serverConfigStore-D2Vr0L0h.js.map diff --git a/web/index.html b/web/index.html index f8b1fc2ff..0aa96b19d 100644 --- a/web/index.html +++ b/web/index.html @@ -6,7 +6,7 @@ - + From 61c8c70c6e195de180309ec06f3fb114c387d5e7 Mon Sep 17 00:00:00 2001 From: Zhong-Yu Li <44114862+lzyhha@users.noreply.github.com> Date: Mon, 17 Feb 2025 07:15:43 +0800 Subject: [PATCH 108/478] support system prompt and cfg renorm in Lumina2 (#6795) * support system prompt and cfg renorm in Lumina2 * fix issues with the ruff style check --- comfy_extras/nodes_lumina2.py | 104 ++++++++++++++++++++++++++++++++++ nodes.py | 1 + 2 files changed, 105 insertions(+) create mode 100644 comfy_extras/nodes_lumina2.py diff --git a/comfy_extras/nodes_lumina2.py b/comfy_extras/nodes_lumina2.py new file mode 100644 index 000000000..275189785 --- /dev/null +++ b/comfy_extras/nodes_lumina2.py @@ -0,0 +1,104 @@ +from comfy.comfy_types import IO, ComfyNodeABC, InputTypeDict +import torch + + +class RenormCFG: + @classmethod + def INPUT_TYPES(s): + return {"required": { "model": ("MODEL",), + "cfg_trunc": ("FLOAT", {"default": 100, "min": 0.0, "max": 100.0, "step": 0.01}), + "renorm_cfg": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 100.0, "step": 0.01}), + }} + RETURN_TYPES = ("MODEL",) + FUNCTION = "patch" + + CATEGORY = "advanced/model" + + def patch(self, model, cfg_trunc, renorm_cfg): + def renorm_cfg_func(args): + cond_denoised = args["cond_denoised"] + uncond_denoised = args["uncond_denoised"] + cond_scale = args["cond_scale"] + timestep = args["timestep"] + x_orig = args["input"] + in_channels = model.model.diffusion_model.in_channels + + if timestep[0] < cfg_trunc: + cond_eps, uncond_eps = cond_denoised[:, :in_channels], uncond_denoised[:, :in_channels] + cond_rest, _ = cond_denoised[:, in_channels:], uncond_denoised[:, in_channels:] + half_eps = uncond_eps + cond_scale * (cond_eps - uncond_eps) + half_rest = cond_rest + + if float(renorm_cfg) > 0.0: + ori_pos_norm = torch.linalg.vector_norm(cond_eps + , dim=tuple(range(1, len(cond_eps.shape))), keepdim=True + ) + max_new_norm = ori_pos_norm * float(renorm_cfg) + new_pos_norm = torch.linalg.vector_norm( + half_eps, dim=tuple(range(1, len(half_eps.shape))), keepdim=True + ) + if new_pos_norm >= max_new_norm: + half_eps = half_eps * (max_new_norm / new_pos_norm) + else: + cond_eps, uncond_eps = cond_denoised[:, :in_channels], uncond_denoised[:, :in_channels] + cond_rest, _ = cond_denoised[:, in_channels:], uncond_denoised[:, in_channels:] + half_eps = cond_eps + half_rest = cond_rest + + cfg_result = torch.cat([half_eps, half_rest], dim=1) + + # cfg_result = uncond_denoised + (cond_denoised - uncond_denoised) * cond_scale + + return x_orig - cfg_result + + m = model.clone() + m.set_model_sampler_cfg_function(renorm_cfg_func) + return (m, ) + + +class CLIPTextEncodeLumina2(ComfyNodeABC): + SYSTEM_PROMPT = { + "superior": "You are an assistant designed to generate superior images with the superior "\ + "degree of image-text alignment based on textual prompts or user prompts.", + "alignment": "You are an assistant designed to generate high-quality images with the "\ + "highest degree of image-text alignment based on textual prompts." + } + SYSTEM_PROMPT_TIP = "Lumina2 provide two types of system prompts:" \ + "Superior: You are an assistant designed to generate superior images with the superior "\ + "degree of image-text alignment based on textual prompts or user prompts. "\ + "Alignment: You are an assistant designed to generate high-quality images with the highest "\ + "degree of image-text alignment based on textual prompts." + @classmethod + def INPUT_TYPES(s) -> InputTypeDict: + return { + "required": { + "system_prompt": (list(CLIPTextEncodeLumina2.SYSTEM_PROMPT.keys()), {"tooltip": CLIPTextEncodeLumina2.SYSTEM_PROMPT_TIP}), + "user_prompt": (IO.STRING, {"multiline": True, "dynamicPrompts": True, "tooltip": "The text to be encoded."}), + "clip": (IO.CLIP, {"tooltip": "The CLIP model used for encoding the text."}) + } + } + RETURN_TYPES = (IO.CONDITIONING,) + OUTPUT_TOOLTIPS = ("A conditioning containing the embedded text used to guide the diffusion model.",) + FUNCTION = "encode" + + CATEGORY = "conditioning" + DESCRIPTION = "Encodes a system prompt and a user prompt using a CLIP model into an embedding that can be used to guide the diffusion model towards generating specific images." + + def encode(self, clip, user_prompt, system_prompt): + if clip is None: + raise RuntimeError("ERROR: clip input is invalid: None\n\nIf the clip is from a checkpoint loader node your checkpoint does not contain a valid clip or text encoder model.") + system_prompt = CLIPTextEncodeLumina2.SYSTEM_PROMPT[system_prompt] + prompt = f'{system_prompt} {user_prompt}' + tokens = clip.tokenize(prompt) + return (clip.encode_from_tokens_scheduled(tokens), ) + + +NODE_CLASS_MAPPINGS = { + "CLIPTextEncodeLumina2": CLIPTextEncodeLumina2, + "RenormCFG": RenormCFG +} + + +NODE_DISPLAY_NAME_MAPPINGS = { + "CLIPTextEncodeLumina2": "CLIP Text Encode for Lumina2", +} diff --git a/nodes.py b/nodes.py index 7defb60b7..504a3376e 100644 --- a/nodes.py +++ b/nodes.py @@ -2233,6 +2233,7 @@ def init_builtin_extra_nodes(): "nodes_hooks.py", "nodes_load_3d.py", "nodes_cosmos.py", + "nodes_lumina2.py", ] import_failed = [] From 530412cb9da671d1e191ca19b0df86c5bb252a62 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 17 Feb 2025 04:36:45 -0500 Subject: [PATCH 109/478] Refactor torch version checks to be more future proof. --- comfy/model_management.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 9f6522967..05f66c9e5 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -50,7 +50,9 @@ xpu_available = False torch_version = "" try: torch_version = torch.version.__version__ - xpu_available = (int(torch_version[0]) < 2 or (int(torch_version[0]) == 2 and int(torch_version[2]) <= 4)) and torch.xpu.is_available() + temp = torch_version.split(".") + torch_version_numeric = (int(temp[0]), int(temp[1])) + xpu_available = (torch_version_numeric[0] < 2 or (torch_version_numeric[0] == 2 and torch_version_numeric[1] <= 4)) and torch.xpu.is_available() except: pass @@ -227,7 +229,7 @@ if args.use_pytorch_cross_attention: try: if is_nvidia(): - if int(torch_version[0]) >= 2: + if torch_version_numeric[0] >= 2: if ENABLE_PYTORCH_ATTENTION == False and args.use_split_cross_attention == False and args.use_quad_cross_attention == False: ENABLE_PYTORCH_ATTENTION = True if is_intel_xpu() or is_ascend_npu(): @@ -242,7 +244,7 @@ try: arch = torch.cuda.get_device_properties(get_torch_device()).gcnArchName logging.info("AMD arch: {}".format(arch)) if args.use_split_cross_attention == False and args.use_quad_cross_attention == False: - if int(torch_version[0]) >= 2 and int(torch_version[2]) >= 7: # works on 2.6 but doesn't actually seem to improve much + if torch_version_numeric[0] >= 2 and torch_version_numeric[1] >= 7: # works on 2.6 but doesn't actually seem to improve much if arch in ["gfx1100"]: #TODO: more arches ENABLE_PYTORCH_ATTENTION = True except: @@ -261,7 +263,7 @@ except: pass try: - if int(torch_version[0]) == 2 and int(torch_version[2]) >= 5: + if torch_version_numeric[0] == 2 and torch_version_numeric[1] >= 5: torch.backends.cuda.allow_fp16_bf16_reduction_math_sdp(True) except: logging.warning("Warning, could not set allow_fp16_bf16_reduction_math_sdp") @@ -1136,11 +1138,11 @@ def supports_fp8_compute(device=None): if props.minor < 9: return False - if int(torch_version[0]) < 2 or (int(torch_version[0]) == 2 and int(torch_version[2]) < 3): + if torch_version_numeric[0] < 2 or (torch_version_numeric[0] == 2 and torch_version_numeric[1] < 3): return False if WINDOWS: - if (int(torch_version[0]) == 2 and int(torch_version[2]) < 4): + if (torch_version_numeric[0] == 2 and torch_version_numeric[1] < 4): return False return True From 8c0bae50c3b13a4cf1b910f6b98efd27a87acf27 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 17 Feb 2025 04:42:40 -0500 Subject: [PATCH 110/478] bf16 manual cast works on old AMD. --- comfy/model_management.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/comfy/model_management.py b/comfy/model_management.py index 05f66c9e5..535d53014 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -1111,6 +1111,8 @@ def should_use_bf16(device=None, model_params=0, prioritize_performance=True, ma if is_amd(): arch = torch.cuda.get_device_properties(device).gcnArchName if arch in ["gfx1030", "gfx1031", "gfx1010", "gfx1011", "gfx1012", "gfx906", "gfx900", "gfx803"]: # RDNA2 and older don't support bf16 + if manual_cast: + return True return False props = torch.cuda.get_device_properties(device) From 31e54b7052bd65c151018950bd95473e3f9a9489 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 17 Feb 2025 04:53:40 -0500 Subject: [PATCH 111/478] Improve AMD arch detection. --- comfy/model_management.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 535d53014..9252afab1 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -245,7 +245,7 @@ try: logging.info("AMD arch: {}".format(arch)) if args.use_split_cross_attention == False and args.use_quad_cross_attention == False: if torch_version_numeric[0] >= 2 and torch_version_numeric[1] >= 7: # works on 2.6 but doesn't actually seem to improve much - if arch in ["gfx1100"]: #TODO: more arches + if any((a in arch) for a in ["gfx1100", "gfx1101"]): # TODO: more arches ENABLE_PYTORCH_ATTENTION = True except: pass @@ -1110,7 +1110,7 @@ def should_use_bf16(device=None, model_params=0, prioritize_performance=True, ma if is_amd(): arch = torch.cuda.get_device_properties(device).gcnArchName - if arch in ["gfx1030", "gfx1031", "gfx1010", "gfx1011", "gfx1012", "gfx906", "gfx900", "gfx803"]: # RDNA2 and older don't support bf16 + if any((a in arch) for a in ["gfx1030", "gfx1031", "gfx1010", "gfx1011", "gfx1012", "gfx906", "gfx900", "gfx803"]): # RDNA2 and older don't support bf16 if manual_cast: return True return False From b07258cef2ec53e2f76ef9ae73682ca1aa08a9b1 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 18 Feb 2025 07:28:33 -0500 Subject: [PATCH 112/478] Fix typo. Let me know if this slows things down on 2000 series and below. --- comfy/model_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 9252afab1..9ff63f35d 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -1121,7 +1121,7 @@ def should_use_bf16(device=None, model_params=0, prioritize_performance=True, ma bf16_works = torch.cuda.is_bf16_supported() - if bf16_works or manual_cast: + if bf16_works and manual_cast: free_model_memory = maximum_vram_for_weights(device) if (not prioritize_performance) or model_params * 4 > free_model_memory: return True From acc152b674fd1c983acc6efd8aedbeb380660c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Sepp=C3=A4nen?= <40791699+kijai@users.noreply.github.com> Date: Wed, 19 Feb 2025 00:06:54 +0200 Subject: [PATCH 113/478] Support loading and using SkyReels-V1-Hunyuan-I2V (#6862) * Support SkyReels-V1-Hunyuan-I2V * VAE scaling * Fix T2V oops * Proper latent scaling --- comfy/ldm/hunyuan_video/model.py | 2 +- comfy/model_base.py | 9 +++++++++ comfy/model_detection.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/comfy/ldm/hunyuan_video/model.py b/comfy/ldm/hunyuan_video/model.py index fc3a67444..f3f445843 100644 --- a/comfy/ldm/hunyuan_video/model.py +++ b/comfy/ldm/hunyuan_video/model.py @@ -310,7 +310,7 @@ class HunyuanVideo(nn.Module): shape[i] = shape[i] // self.patch_size[i] img = img.reshape([img.shape[0]] + shape + [self.out_channels] + self.patch_size) img = img.permute(0, 4, 1, 5, 2, 6, 3, 7) - img = img.reshape(initial_shape) + img = img.reshape(initial_shape[0], self.out_channels, initial_shape[2], initial_shape[3], initial_shape[4]) return img def forward(self, x, timestep, context, y, guidance=None, attention_mask=None, control=None, transformer_options={}, **kwargs): diff --git a/comfy/model_base.py b/comfy/model_base.py index 98f462b32..0eeaed790 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -871,6 +871,15 @@ class HunyuanVideo(BaseModel): if cross_attn is not None: out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) + image = kwargs.get("concat_latent_image", None) + noise = kwargs.get("noise", None) + + if image is not None: + padding_shape = (noise.shape[0], 16, noise.shape[2] - 1, noise.shape[3], noise.shape[4]) + latent_padding = torch.zeros(padding_shape, device=noise.device, dtype=noise.dtype) + image_latents = torch.cat([image.to(noise), latent_padding], dim=2) + out['c_concat'] = comfy.conds.CONDNoiseShape(self.process_latent_in(image_latents)) + guidance = kwargs.get("guidance", 6.0) if guidance is not None: out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor([guidance])) diff --git a/comfy/model_detection.py b/comfy/model_detection.py index 2644dd0dc..5051f821d 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -136,7 +136,7 @@ def detect_unet_config(state_dict, key_prefix): if '{}txt_in.individual_token_refiner.blocks.0.norm1.weight'.format(key_prefix) in state_dict_keys: #Hunyuan Video dit_config = {} dit_config["image_model"] = "hunyuan_video" - dit_config["in_channels"] = 16 + dit_config["in_channels"] = state_dict["img_in.proj.weight"].shape[1] #SkyReels img2video has 32 input channels dit_config["patch_size"] = [1, 2, 2] dit_config["out_channels"] = 16 dit_config["vec_in_dim"] = 768 From afc85cdeb64e1c758cd1d0fa8c99f0e3a9e9f9cd Mon Sep 17 00:00:00 2001 From: bymyself Date: Tue, 18 Feb 2025 15:53:01 -0700 Subject: [PATCH 114/478] Add Load Image Output node (#6790) * add LoadImageOutput node * add route for input/output/temp files * update node_typing.py * use literal type for image_folder field * mark node as beta --- api_server/routes/internal/internal_routes.py | 17 +++++++++- comfy/comfy_types/node_typing.py | 21 ++++++++++++ nodes.py | 32 +++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/api_server/routes/internal/internal_routes.py b/api_server/routes/internal/internal_routes.py index a66fe529b..613b0f7c7 100644 --- a/api_server/routes/internal/internal_routes.py +++ b/api_server/routes/internal/internal_routes.py @@ -1,8 +1,9 @@ from aiohttp import web from typing import Optional -from folder_paths import folder_names_and_paths +from folder_paths import folder_names_and_paths, get_directory_by_type from api_server.services.terminal_service import TerminalService import app.logger +import os class InternalRoutes: ''' @@ -50,6 +51,20 @@ class InternalRoutes: response[key] = folder_names_and_paths[key][0] return web.json_response(response) + @self.routes.get('/files/{directory_type}') + async def get_files(request: web.Request) -> web.Response: + directory_type = request.match_info['directory_type'] + if directory_type not in ("output", "input", "temp"): + return web.json_response({"error": "Invalid directory type"}, status=400) + + directory = get_directory_by_type(directory_type) + sorted_files = sorted( + (entry for entry in os.scandir(directory) if entry.is_file()), + key=lambda entry: -entry.stat().st_mtime + ) + return web.json_response([entry.name for entry in sorted_files], status=200) + + def get_app(self): if self._app is None: self._app = web.Application() diff --git a/comfy/comfy_types/node_typing.py b/comfy/comfy_types/node_typing.py index 056b1aa65..0f70fdb23 100644 --- a/comfy/comfy_types/node_typing.py +++ b/comfy/comfy_types/node_typing.py @@ -66,6 +66,19 @@ class IO(StrEnum): b = frozenset(value.split(",")) return not (b.issubset(a) or a.issubset(b)) +class RemoteInputOptions(TypedDict): + route: str + """The route to the remote source.""" + refresh_button: bool + """Specifies whether to show a refresh button in the UI below the widget.""" + control_after_refresh: Literal["first", "last"] + """Specifies the control after the refresh button is clicked. If "first", the first item will be automatically selected, and so on.""" + timeout: int + """The maximum amount of time to wait for a response from the remote source in milliseconds.""" + max_retries: int + """The maximum number of retries before aborting the request.""" + refresh: int + """The TTL of the remote input's value in milliseconds. Specifies the interval at which the remote input's value is refreshed.""" class InputTypeOptions(TypedDict): """Provides type hinting for the return type of the INPUT_TYPES node function. @@ -113,6 +126,14 @@ class InputTypeOptions(TypedDict): # defaultVal: str dynamicPrompts: bool """Causes the front-end to evaluate dynamic prompts (``STRING``)""" + # class InputTypeCombo(InputTypeOptions): + image_upload: bool + """Specifies whether the input should have an image upload button and image preview attached to it. Requires that the input's name is `image`.""" + image_folder: Literal["input", "output", "temp"] + """Specifies which folder to get preview images from if the input has the ``image_upload`` flag. + """ + remote: RemoteInputOptions + """Specifies the configuration for a remote input.""" class HiddenInputTypeDict(TypedDict): diff --git a/nodes.py b/nodes.py index 504a3376e..b39adc654 100644 --- a/nodes.py +++ b/nodes.py @@ -1763,6 +1763,36 @@ class LoadImageMask: return True + +class LoadImageOutput(LoadImage): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": ("COMBO", { + "image_upload": True, + "image_folder": "output", + "remote": { + "route": "/internal/files/output", + "refresh_button": True, + "control_after_refresh": "first", + }, + }), + } + } + + DESCRIPTION = "Load an image from the output folder. When the refresh button is clicked, the node will update the image list and automatically select the first image, allowing for easy iteration." + EXPERIMENTAL = True + FUNCTION = "load_image_output" + + def load_image_output(self, image): + return self.load_image(f"{image} [output]") + + @classmethod + def VALIDATE_INPUTS(s, image): + return True + + class ImageScale: upscale_methods = ["nearest-exact", "bilinear", "area", "bicubic", "lanczos"] crop_methods = ["disabled", "center"] @@ -1949,6 +1979,7 @@ NODE_CLASS_MAPPINGS = { "PreviewImage": PreviewImage, "LoadImage": LoadImage, "LoadImageMask": LoadImageMask, + "LoadImageOutput": LoadImageOutput, "ImageScale": ImageScale, "ImageScaleBy": ImageScaleBy, "ImageInvert": ImageInvert, @@ -2049,6 +2080,7 @@ NODE_DISPLAY_NAME_MAPPINGS = { "PreviewImage": "Preview Image", "LoadImage": "Load Image", "LoadImageMask": "Load Image (as Mask)", + "LoadImageOutput": "Load Image (from Outputs)", "ImageScale": "Upscale Image", "ImageScaleBy": "Upscale Image By", "ImageUpscaleWithModel": "Upscale Image (using Model)", From 0d4d9222c6922e123e81c9fea104275df33b497d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 19 Feb 2025 07:11:49 -0500 Subject: [PATCH 115/478] Add early experimental SaveWEBM node to save .webm files. The frontend part isn't done yet so there is no video preview on the node or dragging the webm on the interface to load the workflow yet. This uses a new dependency: PyAV. --- comfy_extras/nodes_video.py | 75 +++++++++++++++++++++++++++++++++++++ nodes.py | 1 + requirements.txt | 1 + 3 files changed, 77 insertions(+) create mode 100644 comfy_extras/nodes_video.py diff --git a/comfy_extras/nodes_video.py b/comfy_extras/nodes_video.py new file mode 100644 index 000000000..f3922e03d --- /dev/null +++ b/comfy_extras/nodes_video.py @@ -0,0 +1,75 @@ +import os +import av +import torch +import folder_paths +import json +from fractions import Fraction + + +class SaveWEBM: + def __init__(self): + self.output_dir = folder_paths.get_output_directory() + self.type = "output" + self.prefix_append = "" + + @classmethod + def INPUT_TYPES(s): + return {"required": + {"images": ("IMAGE", ), + "filename_prefix": ("STRING", {"default": "ComfyUI"}), + "codec": (["vp9", "av1"],), + "fps": ("FLOAT", {"default": 24.0, "min": 0.01, "max": 1000.0, "step": 0.01}), + "crf": ("FLOAT", {"default": 32.0, "min": 0, "max": 63.0, "step": 1, "tooltip": "Higher crf means lower quality with a smaller file size, lower crf means higher quality higher filesize."}), + }, + "hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"}, + } + + RETURN_TYPES = () + FUNCTION = "save_images" + + OUTPUT_NODE = True + + CATEGORY = "image/video" + + EXPERIMENTAL = True + + def save_images(self, images, codec, fps, filename_prefix, crf, prompt=None, extra_pnginfo=None): + filename_prefix += self.prefix_append + full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir, images[0].shape[1], images[0].shape[0]) + + file = f"{filename}_{counter:05}_.webm" + container = av.open(os.path.join(full_output_folder, file), mode="w") + + if prompt is not None: + container.metadata["prompt"] = json.dumps(prompt) + + if extra_pnginfo is not None: + for x in extra_pnginfo: + container.metadata[x] = json.dumps(extra_pnginfo[x]) + + codec_map = {"vp9": "libvpx-vp9", "av1": "libaom-av1"} + stream = container.add_stream(codec_map[codec], rate=Fraction(round(fps * 1000), 1000)) + stream.width = images.shape[-2] + stream.height = images.shape[-3] + stream.pix_fmt = "yuv420p" + stream.bit_rate = 0 + stream.options = {'crf': str(crf)} + + for frame in images: + frame = av.VideoFrame.from_ndarray(torch.clamp(frame[..., :3] * 255, min=0, max=255).to(device=torch.device("cpu"), dtype=torch.uint8).numpy(), format="rgb24") + for packet in stream.encode(frame): + container.mux(packet) + container.close() + + results = [{ + "filename": file, + "subfolder": subfolder, + "type": self.type + }] + + return {"ui": {"images": results, "animated": (True,)}} # TODO: frontend side + + +NODE_CLASS_MAPPINGS = { + "SaveWEBM": SaveWEBM, +} diff --git a/nodes.py b/nodes.py index b39adc654..4e68af79d 100644 --- a/nodes.py +++ b/nodes.py @@ -2265,6 +2265,7 @@ def init_builtin_extra_nodes(): "nodes_hooks.py", "nodes_load_3d.py", "nodes_cosmos.py", + "nodes_video.py", "nodes_lumina2.py", ] diff --git a/requirements.txt b/requirements.txt index 3bc945a1b..3229fe81f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,3 +19,4 @@ psutil kornia>=0.7.1 spandrel soundfile +av From 5715be2ca9930b7239590524203d89f74ec9f568 Mon Sep 17 00:00:00 2001 From: maedtb Date: Wed, 19 Feb 2025 07:14:45 -0500 Subject: [PATCH 116/478] Fix Hunyuan unet config detection for some models. (#6877) The change to support 32 channel hunyuan models is missing the `key_prefix` on the key. This addresses a complain in the comments of acc152b674fd1c983acc6efd8aedbeb380660c0c. --- comfy/model_detection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/model_detection.py b/comfy/model_detection.py index 5051f821d..b1faa63f4 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -136,7 +136,7 @@ def detect_unet_config(state_dict, key_prefix): if '{}txt_in.individual_token_refiner.blocks.0.norm1.weight'.format(key_prefix) in state_dict_keys: #Hunyuan Video dit_config = {} dit_config["image_model"] = "hunyuan_video" - dit_config["in_channels"] = state_dict["img_in.proj.weight"].shape[1] #SkyReels img2video has 32 input channels + dit_config["in_channels"] = state_dict['{}img_in.proj.weight'.format(key_prefix)].shape[1] #SkyReels img2video has 32 input channels dit_config["patch_size"] = [1, 2, 2] dit_config["out_channels"] = 16 dit_config["vec_in_dim"] = 768 From b4d3652d88927a341f22a35252471562f1f25f1b Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" <128333288+ltdrdata@users.noreply.github.com> Date: Wed, 19 Feb 2025 21:15:36 +0900 Subject: [PATCH 117/478] fixed: crash caused by outdated incompatible aiohttp dependency (#6841) https://github.com/comfyanonymous/ComfyUI/issues/6038#issuecomment-2661776795 https://github.com/comfyanonymous/ComfyUI/issues/5814#issue-2700816845 --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3229fe81f..afbcb7cba 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,8 @@ transformers>=4.28.1 tokenizers>=0.13.3 sentencepiece safetensors>=0.4.2 -aiohttp +aiohttp>=3.11.8 +yarl>=1.18.0 pyyaml Pillow scipy From c5be423d6bf0e53d460471f49d75455e621773c0 Mon Sep 17 00:00:00 2001 From: Silver <65376327+silveroxides@users.noreply.github.com> Date: Thu, 20 Feb 2025 13:07:07 +0100 Subject: [PATCH 118/478] Fix link pointing to non-exisiting docs (#6891) * Fix link pointing to non-exisiting docs The current link is pointing to a path that does not exist any longer. I changed it to point to the currect correct path for custom nodes datatypes. * Update node_typing.py --- comfy/comfy_types/node_typing.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/comfy/comfy_types/node_typing.py b/comfy/comfy_types/node_typing.py index 0f70fdb23..0696dbe5e 100644 --- a/comfy/comfy_types/node_typing.py +++ b/comfy/comfy_types/node_typing.py @@ -85,7 +85,7 @@ class InputTypeOptions(TypedDict): Due to IDE limitations with unions, for now all options are available for all types (e.g. `label_on` is hinted even when the type is not `IO.BOOLEAN`). - Comfy Docs: https://docs.comfy.org/essentials/custom_node_datatypes + Comfy Docs: https://docs.comfy.org/custom-nodes/backend/datatypes """ default: bool | str | float | int | list | tuple @@ -154,7 +154,7 @@ class HiddenInputTypeDict(TypedDict): class InputTypeDict(TypedDict): """Provides type hinting for node INPUT_TYPES. - Comfy Docs: https://docs.comfy.org/essentials/custom_node_more_on_inputs + Comfy Docs: https://docs.comfy.org/custom-nodes/backend/more_on_inputs """ required: dict[str, tuple[IO, InputTypeOptions]] @@ -164,14 +164,14 @@ class InputTypeDict(TypedDict): hidden: HiddenInputTypeDict """Offers advanced functionality and server-client communication. - Comfy Docs: https://docs.comfy.org/essentials/custom_node_more_on_inputs#hidden-inputs + Comfy Docs: https://docs.comfy.org/custom-nodes/backend/more_on_inputs#hidden-inputs """ class ComfyNodeABC(ABC): """Abstract base class for Comfy nodes. Includes the names and expected types of attributes. - Comfy Docs: https://docs.comfy.org/essentials/custom_node_server_overview + Comfy Docs: https://docs.comfy.org/custom-nodes/backend/server_overview """ DESCRIPTION: str @@ -188,7 +188,7 @@ class ComfyNodeABC(ABC): CATEGORY: str """The category of the node, as per the "Add Node" menu. - Comfy Docs: https://docs.comfy.org/essentials/custom_node_server_overview#category + Comfy Docs: https://docs.comfy.org/custom-nodes/backend/server_overview#category """ EXPERIMENTAL: bool """Flags a node as experimental, informing users that it may change or not work as expected.""" @@ -202,9 +202,9 @@ class ComfyNodeABC(ABC): * Must include the ``required`` key, which describes all inputs that must be connected for the node to execute. * The ``optional`` key can be added to describe inputs which do not need to be connected. - * The ``hidden`` key offers some advanced functionality. More info at: https://docs.comfy.org/essentials/custom_node_more_on_inputs#hidden-inputs + * The ``hidden`` key offers some advanced functionality. More info at: https://docs.comfy.org/custom-nodes/backend/more_on_inputs#hidden-inputs - Comfy Docs: https://docs.comfy.org/essentials/custom_node_server_overview#input-types + Comfy Docs: https://docs.comfy.org/custom-nodes/backend/server_overview#input-types """ return {"required": {}} @@ -219,7 +219,7 @@ class ComfyNodeABC(ABC): By default, a node is not considered an output. Set ``OUTPUT_NODE = True`` to specify that it is. - Comfy Docs: https://docs.comfy.org/essentials/custom_node_server_overview#output-node + Comfy Docs: https://docs.comfy.org/custom-nodes/backend/server_overview#output-node """ INPUT_IS_LIST: bool """A flag indicating if this node implements the additional code necessary to deal with OUTPUT_IS_LIST nodes. @@ -230,7 +230,7 @@ class ComfyNodeABC(ABC): A node can also override the default input behaviour and receive the whole list in a single call. This is done by setting a class attribute `INPUT_IS_LIST` to ``True``. - Comfy Docs: https://docs.comfy.org/essentials/custom_node_lists#list-processing + Comfy Docs: https://docs.comfy.org/custom-nodes/backend/lists#list-processing """ OUTPUT_IS_LIST: tuple[bool] """A tuple indicating which node outputs are lists, but will be connected to nodes that expect individual items. @@ -248,7 +248,7 @@ class ComfyNodeABC(ABC): the node should provide a class attribute `OUTPUT_IS_LIST`, which is a ``tuple[bool]``, of the same length as `RETURN_TYPES`, specifying which outputs which should be so treated. - Comfy Docs: https://docs.comfy.org/essentials/custom_node_lists#list-processing + Comfy Docs: https://docs.comfy.org/custom-nodes/backend/lists#list-processing """ RETURN_TYPES: tuple[IO] @@ -258,19 +258,19 @@ class ComfyNodeABC(ABC): RETURN_TYPES = (IO.INT, "INT", "CUSTOM_TYPE") - Comfy Docs: https://docs.comfy.org/essentials/custom_node_server_overview#return-types + Comfy Docs: https://docs.comfy.org/custom-nodes/backend/server_overview#return-types """ RETURN_NAMES: tuple[str] """The output slot names for each item in `RETURN_TYPES`, e.g. ``RETURN_NAMES = ("count", "filter_string")`` - Comfy Docs: https://docs.comfy.org/essentials/custom_node_server_overview#return-names + Comfy Docs: https://docs.comfy.org/custom-nodes/backend/server_overview#return-names """ OUTPUT_TOOLTIPS: tuple[str] """A tuple of strings to use as tooltips for node outputs, one for each item in `RETURN_TYPES`.""" FUNCTION: str """The name of the function to execute as a literal string, e.g. `FUNCTION = "execute"` - Comfy Docs: https://docs.comfy.org/essentials/custom_node_server_overview#function + Comfy Docs: https://docs.comfy.org/custom-nodes/backend/server_overview#function """ @@ -288,7 +288,7 @@ class CheckLazyMixin: Params should match the nodes execution ``FUNCTION`` (self, and all inputs by name). Will be executed repeatedly until it returns an empty list, or all requested items were already evaluated (and sent as params). - Comfy Docs: https://docs.comfy.org/essentials/custom_node_lazy_evaluation#defining-check-lazy-status + Comfy Docs: https://docs.comfy.org/custom-nodes/backend/lazy_evaluation#defining-check-lazy-status """ need = [name for name in kwargs if kwargs[name] is None] From 29d4384a75abb4ca90f5b64e70499f2120d76a3a Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Thu, 20 Feb 2025 04:09:45 -0800 Subject: [PATCH 119/478] Normalize extra_model_config.yaml paths to prevent duplicates. (#6885) * Normalize extra_model_config.yaml paths before adding. * Fix tests. * Fix tests. --- tests-unit/utils/extra_config_test.py | 6 +++--- utils/extra_config.py | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests-unit/utils/extra_config_test.py b/tests-unit/utils/extra_config_test.py index 6d232079e..eae1aa3d3 100644 --- a/tests-unit/utils/extra_config_test.py +++ b/tests-unit/utils/extra_config_test.py @@ -145,7 +145,7 @@ def test_load_extra_model_paths_expands_appdata( else: expected_base_path = '/Users/TestUser/AppData/Roaming/ComfyUI' expected_calls = [ - ('checkpoints', os.path.join(expected_base_path, 'models/checkpoints'), False), + ('checkpoints', os.path.normpath(os.path.join(expected_base_path, 'models/checkpoints')), False), ] assert mock_add_model_folder_path.call_count == len(expected_calls) @@ -197,8 +197,8 @@ def test_load_extra_path_config_relative_base_path( load_extra_path_config(dummy_yaml_name) - expected_checkpoints = os.path.abspath(os.path.join(str(tmp_path), sub_folder, "checkpoints")) - expected_some_value = os.path.abspath(os.path.join(str(tmp_path), sub_folder, "some_value")) + expected_checkpoints = os.path.abspath(os.path.join(str(tmp_path), "my_rel_base", "checkpoints")) + expected_some_value = os.path.abspath(os.path.join(str(tmp_path), "my_rel_base", "some_value")) actual_paths = folder_paths.folder_names_and_paths["checkpoints"][0] assert len(actual_paths) == 1, "Should have one path added for 'checkpoints'." diff --git a/utils/extra_config.py b/utils/extra_config.py index b7196e36f..a0fcda9e8 100644 --- a/utils/extra_config.py +++ b/utils/extra_config.py @@ -29,5 +29,6 @@ def load_extra_path_config(yaml_path): full_path = os.path.join(base_path, full_path) elif not os.path.isabs(full_path): full_path = os.path.abspath(os.path.join(yaml_dir, y)) - logging.info("Adding extra search path {} {}".format(x, full_path)) - folder_paths.add_model_folder_path(x, full_path, is_default) + normalized_path = os.path.normpath(full_path) + logging.info("Adding extra search path {} {}".format(x, normalized_path)) + folder_paths.add_model_folder_path(x, normalized_path, is_default) From 12da6ef581cd9f47a4341d74159ce32f3d2f3e8d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 20 Feb 2025 09:29:59 -0500 Subject: [PATCH 120/478] Apparently directml supports fp16. --- comfy/model_management.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 9ff63f35d..9066e0dc2 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -1021,8 +1021,6 @@ def is_directml_enabled(): return False def should_use_fp16(device=None, model_params=0, prioritize_performance=True, manual_cast=False): - global directml_enabled - if device is not None: if is_device_cpu(device): return False @@ -1033,8 +1031,8 @@ def should_use_fp16(device=None, model_params=0, prioritize_performance=True, ma if FORCE_FP32: return False - if directml_enabled: - return False + if is_directml_enabled(): + return True if (device is not None and is_device_mps(device)) or mps_mode(): return True From d37272532cf80fe7c58532b4161502fa9043ed33 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Thu, 20 Feb 2025 15:26:16 -0800 Subject: [PATCH 121/478] Add discord channel to support section. (#6900) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 44f46a41a..e50ed6607 100644 --- a/README.md +++ b/README.md @@ -293,6 +293,8 @@ Use `--tls-keyfile key.pem --tls-certfile cert.pem` to enable TLS/SSL, the app w ## Support and dev channel +[Discord](https://comfy.org/discord): Try the #help or #feedback channels. + [Matrix space: #comfyui_space:matrix.org](https://app.element.io/#/room/%23comfyui_space%3Amatrix.org) (it's like discord but open source). See also: [https://www.comfy.org/](https://www.comfy.org/) From f579a740ddcfa90a1dfdfd9a8378c27fa9b2ac87 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Fri, 21 Feb 2025 21:58:12 +1100 Subject: [PATCH 122/478] Update frontend release schedule in README. (#6908) Changes release schedule from weekly to fortnightly. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e50ed6607..83d67cef4 100644 --- a/README.md +++ b/README.md @@ -311,7 +311,7 @@ For any bugs, issues, or feature requests related to the frontend, please use th The new frontend is now the default for ComfyUI. However, please note: -1. The frontend in the main ComfyUI repository is updated weekly. +1. The frontend in the main ComfyUI repository is updated fortnightly. 2. Daily releases are available in the separate frontend repository. To use the most up-to-date frontend version: @@ -328,7 +328,7 @@ To use the most up-to-date frontend version: --front-end-version Comfy-Org/ComfyUI_frontend@1.2.2 ``` -This approach allows you to easily switch between the stable weekly release and the cutting-edge daily updates, or even specific versions for testing purposes. +This approach allows you to easily switch between the stable fortnightly release and the cutting-edge daily updates, or even specific versions for testing purposes. ### Accessing the Legacy Frontend From 41c30e92e7c468dde630714a27431299de438490 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 21 Feb 2025 06:32:11 -0500 Subject: [PATCH 123/478] Let all model memory be offloaded on nvidia. --- comfy/model_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 9066e0dc2..331aa9fd3 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -220,7 +220,7 @@ def is_amd(): MIN_WEIGHT_MEMORY_RATIO = 0.4 if is_nvidia(): - MIN_WEIGHT_MEMORY_RATIO = 0.1 + MIN_WEIGHT_MEMORY_RATIO = 0.0 ENABLE_PYTORCH_ATTENTION = False if args.use_pytorch_cross_attention: From a6deca6d9ae36ec60722d66ad5c31cbb05725383 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 21 Feb 2025 20:14:30 -0500 Subject: [PATCH 124/478] Latest mac still has the black image bug. --- comfy/model_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 331aa9fd3..86b4727a3 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -943,7 +943,7 @@ def force_upcast_attention_dtype(): upcast = args.force_upcast_attention macos_version = mac_version() - if macos_version is not None and ((14, 5) <= macos_version <= (15, 2)): # black image bug on recent versions of macOS + if macos_version is not None and ((14, 5) <= macos_version <= (15, 3)): # black image bug on recent versions of macOS upcast = True if upcast: From 072db3bea6e530ad14c168a94cb83024358ecb9b Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 21 Feb 2025 20:24:07 -0500 Subject: [PATCH 125/478] Assume the mac black image bug won't be fixed before v16. --- comfy/model_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 86b4727a3..8b6c4a667 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -943,7 +943,7 @@ def force_upcast_attention_dtype(): upcast = args.force_upcast_attention macos_version = mac_version() - if macos_version is not None and ((14, 5) <= macos_version <= (15, 3)): # black image bug on recent versions of macOS + if macos_version is not None and ((14, 5) <= macos_version < (16,)): # black image bug on recent versions of macOS upcast = True if upcast: From b50ab153f96fd396ea26a76529f164c5ae3b50a6 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 21 Feb 2025 20:28:28 -0500 Subject: [PATCH 126/478] Bump ComfyUI version to v0.3.15 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 6be6f59f0..fc7bb1df8 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.14" +__version__ = "0.3.15" diff --git a/pyproject.toml b/pyproject.toml index a450b9b0c..877ae4d70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.14" +version = "0.3.15" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From aff16532d4505d3df2129802f89309ec6eb4499a Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 22 Feb 2025 04:45:14 -0500 Subject: [PATCH 127/478] Remove some useless code. --- comfy/ldm/modules/attention.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.py index 975faa21f..24fb9d950 100644 --- a/comfy/ldm/modules/attention.py +++ b/comfy/ldm/modules/attention.py @@ -41,27 +41,12 @@ def exists(val): return val is not None -def uniq(arr): - return{el: True for el in arr}.keys() - - def default(val, d): if exists(val): return val return d -def max_neg_value(t): - return -torch.finfo(t.dtype).max - - -def init_(tensor): - dim = tensor.shape[-1] - std = 1 / math.sqrt(dim) - tensor.uniform_(-std, std) - return tensor - - # feedforward class GEGLU(nn.Module): def __init__(self, dim_in, dim_out, dtype=None, device=None, operations=ops): From ace899e71a3d8d75f64a016fa398b95fa83e6978 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 23 Feb 2025 04:45:54 -0500 Subject: [PATCH 128/478] Prioritize fp16 compute when using allow_fp16_accumulation --- comfy/model_management.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/comfy/model_management.py b/comfy/model_management.py index 8b6c4a667..f4a63c6d3 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -256,9 +256,12 @@ if ENABLE_PYTORCH_ATTENTION: torch.backends.cuda.enable_flash_sdp(True) torch.backends.cuda.enable_mem_efficient_sdp(True) + +PRIORITIZE_FP16 = False # TODO: remove and replace with something that shows exactly which dtype is faster than the other try: if is_nvidia() and args.fast: torch.backends.cuda.matmul.allow_fp16_accumulation = True + PRIORITIZE_FP16 = True # TODO: limit to cards where it actually boosts performance except: pass @@ -681,6 +684,10 @@ def unet_dtype(device=None, model_params=0, supported_dtypes=[torch.float16, tor if model_params * 2 > free_model_memory: return fp8_dtype + if PRIORITIZE_FP16: + if torch.float16 in supported_dtypes and should_use_fp16(device=device, model_params=model_params): + return torch.float16 + for dt in supported_dtypes: if dt == torch.float16 and should_use_fp16(device=device, model_params=model_params): if torch.float16 in supported_dtypes: From 4553891bbd993d0ee37377a6a30e13bd0e070143 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Sun, 23 Feb 2025 16:13:39 -0800 Subject: [PATCH 129/478] Update installation documentation to include desktop + cli. (#6899) * Update installation documentation. * Add portable to description. * Move cli further down. --- README.md | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 83d67cef4..b51f7a067 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,24 @@ ![ComfyUI Screenshot](https://github.com/user-attachments/assets/7ccaf2c1-9b72-41ae-9a89-5688c94b7abe) -This ui will let you design and execute advanced stable diffusion pipelines using a graph/nodes/flowchart based interface. For some workflow examples and see what ComfyUI can do you can check out: -### [ComfyUI Examples](https://comfyanonymous.github.io/ComfyUI_examples/) +ComfyUI lets you design and execute advanced stable diffusion pipelines using a graph/nodes/flowchart based interface. Available on Windows, Linux, and macOS. + +## Get Started + +#### [Desktop Application](https://www.comfy.org/download) +- The easiest way to get started. +- Available on Windows & macOS. + +#### [Windows Portable Package](#installing) +- Get the latest commits and completely portable. +- Available on Windows. + +#### [Manual Install](#manual-install-windows-linux) +Supports all operating systems and GPU types (NVIDIA, AMD, Intel, Apple Silicon, Ascend). + +## Examples +See what ComfyUI can do with the [example workflows](https://comfyanonymous.github.io/ComfyUI_examples/). -### [Installing ComfyUI](#installing) ## Features - Nodes/graph/flowchart interface to experiment and create complex Stable Diffusion workflows without needing to code anything. @@ -121,7 +135,7 @@ Workflow examples can be found on the [Examples page](https://comfyanonymous.git # Installing -## Windows +## Windows Portable There is a portable standalone build for Windows that should work for running on Nvidia GPUs or for running on your CPU only on the [releases page](https://github.com/comfyanonymous/ComfyUI/releases). @@ -141,6 +155,15 @@ See the [Config file](extra_model_paths.yaml.example) to set the search paths fo To run it on services like paperspace, kaggle or colab you can use my [Jupyter Notebook](notebooks/comfyui_colab.ipynb) + +## [comfy-cli](https://docs.comfy.org/comfy-cli/getting-started) + +You can install and start ComfyUI using comfy-cli: +```bash +pip install comfy-cli +comfy install +``` + ## Manual Install (Windows, Linux) python 3.13 is supported but using 3.12 is recommended because some custom nodes and their dependencies might not support it yet. From 96d891cb94d90f220e066cebad349887137f07a6 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 24 Feb 2025 05:41:07 -0500 Subject: [PATCH 130/478] Speedup on some models by not upcasting bfloat16 to float32 on mac. --- comfy/ldm/modules/attention.py | 13 +++++++------ comfy/model_management.py | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.py index 24fb9d950..2758f9508 100644 --- a/comfy/ldm/modules/attention.py +++ b/comfy/ldm/modules/attention.py @@ -30,11 +30,12 @@ ops = comfy.ops.disable_weight_init FORCE_UPCAST_ATTENTION_DTYPE = model_management.force_upcast_attention_dtype() -def get_attn_precision(attn_precision): +def get_attn_precision(attn_precision, current_dtype): if args.dont_upcast_attention: return None - if FORCE_UPCAST_ATTENTION_DTYPE is not None: - return FORCE_UPCAST_ATTENTION_DTYPE + + if FORCE_UPCAST_ATTENTION_DTYPE is not None and current_dtype in FORCE_UPCAST_ATTENTION_DTYPE: + return FORCE_UPCAST_ATTENTION_DTYPE[current_dtype] return attn_precision def exists(val): @@ -81,7 +82,7 @@ def Normalize(in_channels, dtype=None, device=None): return torch.nn.GroupNorm(num_groups=32, num_channels=in_channels, eps=1e-6, affine=True, dtype=dtype, device=device) def attention_basic(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False, skip_output_reshape=False): - attn_precision = get_attn_precision(attn_precision) + attn_precision = get_attn_precision(attn_precision, q.dtype) if skip_reshape: b, _, _, dim_head = q.shape @@ -150,7 +151,7 @@ def attention_basic(q, k, v, heads, mask=None, attn_precision=None, skip_reshape def attention_sub_quad(query, key, value, heads, mask=None, attn_precision=None, skip_reshape=False, skip_output_reshape=False): - attn_precision = get_attn_precision(attn_precision) + attn_precision = get_attn_precision(attn_precision, query.dtype) if skip_reshape: b, _, _, dim_head = query.shape @@ -220,7 +221,7 @@ def attention_sub_quad(query, key, value, heads, mask=None, attn_precision=None, return hidden_states def attention_split(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False, skip_output_reshape=False): - attn_precision = get_attn_precision(attn_precision) + attn_precision = get_attn_precision(attn_precision, q.dtype) if skip_reshape: b, _, _, dim_head = q.shape diff --git a/comfy/model_management.py b/comfy/model_management.py index f4a63c6d3..1e6599be2 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -954,7 +954,7 @@ def force_upcast_attention_dtype(): upcast = True if upcast: - return torch.float32 + return {torch.float16: torch.float32} else: return None From f40076096e2a448c82bbc4a631982274dc85e7c2 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 25 Feb 2025 04:10:26 -0500 Subject: [PATCH 131/478] Cleanup some lumina te code. --- comfy/text_encoders/lumina2.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/comfy/text_encoders/lumina2.py b/comfy/text_encoders/lumina2.py index 166d13281..a7b1d702b 100644 --- a/comfy/text_encoders/lumina2.py +++ b/comfy/text_encoders/lumina2.py @@ -19,11 +19,6 @@ class LuminaTokenizer(sd1_clip.SD1Tokenizer): class Gemma2_2BModel(sd1_clip.SDClipModel): def __init__(self, device="cpu", layer="hidden", layer_idx=-2, dtype=None, attention_mask=True, model_options={}): - llama_scaled_fp8 = model_options.get("llama_scaled_fp8", None) - if llama_scaled_fp8 is not None: - model_options = model_options.copy() - model_options["scaled_fp8"] = llama_scaled_fp8 - super().__init__(device=device, layer=layer, layer_idx=layer_idx, textmodel_json_config={}, dtype=dtype, special_tokens={"start": 2, "pad": 0}, layer_norm_hidden_state=False, model_class=comfy.text_encoders.llama.Gemma2_2B, enable_attention_masks=attention_mask, return_attention_masks=attention_mask, model_options=model_options) @@ -35,10 +30,10 @@ class LuminaModel(sd1_clip.SD1ClipModel): def te(dtype_llama=None, llama_scaled_fp8=None): class LuminaTEModel_(LuminaModel): def __init__(self, device="cpu", dtype=None, model_options={}): - if llama_scaled_fp8 is not None and "llama_scaled_fp8" not in model_options: + if llama_scaled_fp8 is not None and "scaled_fp8" not in model_options: model_options = model_options.copy() - model_options["llama_scaled_fp8"] = llama_scaled_fp8 - if dtype_llama is not None: - dtype = dtype_llama + model_options["scaled_fp8"] = llama_scaled_fp8 + if dtype_llama is not None: + dtype = dtype_llama super().__init__(device=device, dtype=dtype, model_options=model_options) return LuminaTEModel_ From 63023011b97b85087896683b73eab5d1a6d95a05 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 25 Feb 2025 17:20:35 -0500 Subject: [PATCH 132/478] WIP support for Wan t2v model. --- comfy/latent_formats.py | 28 ++ comfy/ldm/wan/model.py | 567 +++++++++++++++++++++++ comfy/ldm/wan/vae.py | 567 +++++++++++++++++++++++ comfy/model_base.py | 12 + comfy/model_detection.py | 20 + comfy/sd.py | 19 + comfy/supported_models.py | 32 +- comfy/text_encoders/umt5_config_xxl.json | 22 + comfy/text_encoders/wan.py | 37 ++ nodes.py | 6 +- 10 files changed, 1307 insertions(+), 3 deletions(-) create mode 100644 comfy/ldm/wan/model.py create mode 100644 comfy/ldm/wan/vae.py create mode 100644 comfy/text_encoders/umt5_config_xxl.json create mode 100644 comfy/text_encoders/wan.py diff --git a/comfy/latent_formats.py b/comfy/latent_formats.py index e98982c94..8299ecd1b 100644 --- a/comfy/latent_formats.py +++ b/comfy/latent_formats.py @@ -407,3 +407,31 @@ class Cosmos1CV8x8x8(LatentFormat): ] latent_rgb_factors_bias = [-0.1223, -0.1889, -0.1976] + +class Wan21(LatentFormat): + latent_channels = 16 + latent_dimensions = 3 + + def __init__(self): + self.scale_factor = 1.0 + self.latents_mean = torch.tensor([ + -0.7571, -0.7089, -0.9113, 0.1075, -0.1745, 0.9653, -0.1517, 1.5508, + 0.4134, -0.0715, 0.5517, -0.3632, -0.1922, -0.9497, 0.2503, -0.2921 + ]).view(1, self.latent_channels, 1, 1, 1) + self.latents_std = torch.tensor([ + 2.8184, 1.4541, 2.3275, 2.6558, 1.2196, 1.7708, 2.6052, 2.0743, + 3.2687, 2.1526, 2.8652, 1.5579, 1.6382, 1.1253, 2.8251, 1.9160 + ]).view(1, self.latent_channels, 1, 1, 1) + + + self.taesd_decoder_name = None #TODO + + def process_in(self, latent): + latents_mean = self.latents_mean.to(latent.device, latent.dtype) + latents_std = self.latents_std.to(latent.device, latent.dtype) + return (latent - latents_mean) * self.scale_factor / latents_std + + def process_out(self, latent): + latents_mean = self.latents_mean.to(latent.device, latent.dtype) + latents_std = self.latents_std.to(latent.device, latent.dtype) + return latent * latents_std / self.scale_factor + latents_mean diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py new file mode 100644 index 000000000..49880b606 --- /dev/null +++ b/comfy/ldm/wan/model.py @@ -0,0 +1,567 @@ +# original version: https://github.com/Wan-Video/Wan2.1/blob/main/wan/modules/model.py +# Copyright 2024-2025 The Alibaba Wan Team Authors. All rights reserved. +import math + +import torch +import torch.nn as nn + +from comfy.ldm.modules.attention import optimized_attention + + +def sinusoidal_embedding_1d(dim, position): + # preprocess + assert dim % 2 == 0 + half = dim // 2 + position = position.type(torch.float64) + + # calculation + sinusoid = torch.outer( + position, torch.pow(10000, -torch.arange(half).to(position).div(half))) + x = torch.cat([torch.cos(sinusoid), torch.sin(sinusoid)], dim=1) + return x + + +def rope_params(max_seq_len, dim, theta=10000): + assert dim % 2 == 0 + freqs = torch.outer( + torch.arange(max_seq_len), + 1.0 / torch.pow(theta, + torch.arange(0, dim, 2).to(torch.float64).div(dim))) + freqs = torch.polar(torch.ones_like(freqs), freqs) + return freqs + + +def rope_apply(x, grid_sizes, freqs): + n, c = x.size(2), x.size(3) // 2 + + # split freqs + freqs = freqs.split([c - 2 * (c // 3), c // 3, c // 3], dim=1) + + # loop over samples + output = [] + for i, (f, h, w) in enumerate(grid_sizes.tolist()): + seq_len = f * h * w + + # precompute multipliers + x_i = torch.view_as_complex(x[i, :seq_len].to(torch.float64).reshape( + seq_len, n, -1, 2)) + freqs_i = torch.cat([ + freqs[0][:f].view(f, 1, 1, -1).expand(f, h, w, -1), + freqs[1][:h].view(1, h, 1, -1).expand(f, h, w, -1), + freqs[2][:w].view(1, 1, w, -1).expand(f, h, w, -1) + ], dim=-1).reshape(seq_len, 1, -1) + + # apply rotary embedding + x_i = torch.view_as_real(x_i * freqs_i).flatten(2) + x_i = torch.cat([x_i, x[i, seq_len:]]) + + # append to collection + output.append(x_i) + return torch.stack(output).to(dtype=x.dtype) + + +class WanRMSNorm(nn.Module): + + def __init__(self, dim, eps=1e-5, device=None, dtype=None): + super().__init__() + self.dim = dim + self.eps = eps + self.weight = nn.Parameter(torch.ones(dim, device=device, dtype=dtype)) + + def forward(self, x): + r""" + Args: + x(Tensor): Shape [B, L, C] + """ + return self._norm(x.float()).type_as(x) * self.weight + + def _norm(self, x): + return x * torch.rsqrt(x.pow(2).mean(dim=-1, keepdim=True) + self.eps) + + +class WanSelfAttention(nn.Module): + + def __init__(self, + dim, + num_heads, + window_size=(-1, -1), + qk_norm=True, + eps=1e-6, operation_settings={}): + assert dim % num_heads == 0 + super().__init__() + self.dim = dim + self.num_heads = num_heads + self.head_dim = dim // num_heads + self.window_size = window_size + self.qk_norm = qk_norm + self.eps = eps + + # layers + self.q = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.k = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.v = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.o = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.norm_q = WanRMSNorm(dim, eps=eps, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() + self.norm_k = WanRMSNorm(dim, eps=eps, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() + + def forward(self, x, seq_lens, grid_sizes, freqs): + r""" + Args: + x(Tensor): Shape [B, L, num_heads, C / num_heads] + seq_lens(Tensor): Shape [B] + grid_sizes(Tensor): Shape [B, 3], the second dimension contains (F, H, W) + freqs(Tensor): Rope freqs, shape [1024, C / num_heads / 2] + """ + b, s, n, d = *x.shape[:2], self.num_heads, self.head_dim + + # query, key, value function + def qkv_fn(x): + q = self.norm_q(self.q(x)).view(b, s, n, d) + k = self.norm_k(self.k(x)).view(b, s, n, d) + v = self.v(x).view(b, s, n * d) + return q, k, v + + q, k, v = qkv_fn(x) + + x = optimized_attention( + q=rope_apply(q, grid_sizes, freqs).view(b, s, n * d), + k=rope_apply(k, grid_sizes, freqs).view(b, s, n * d), + v=v, + heads=self.num_heads, + ) + + x = self.o(x) + return x + + +class WanT2VCrossAttention(WanSelfAttention): + + def forward(self, x, context, context_lens): + r""" + Args: + x(Tensor): Shape [B, L1, C] + context(Tensor): Shape [B, L2, C] + context_lens(Tensor): Shape [B] + """ + # compute query, key, value + q = self.norm_q(self.q(x)) + k = self.norm_k(self.k(context)) + v = self.v(context) + + # compute attention + x = optimized_attention(q, k, v, heads=self.num_heads) + + x = self.o(x) + return x + + +class WanI2VCrossAttention(WanSelfAttention): + + def __init__(self, + dim, + num_heads, + window_size=(-1, -1), + qk_norm=True, + eps=1e-6, operation_settings={}): + super().__init__(dim, num_heads, window_size, qk_norm, eps) + + self.k_img = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.v_img = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + # self.alpha = nn.Parameter(torch.zeros((1, ))) + self.norm_k_img = WanRMSNorm(dim, eps=eps, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() + + def forward(self, x, context, context_lens): + r""" + Args: + x(Tensor): Shape [B, L1, C] + context(Tensor): Shape [B, L2, C] + context_lens(Tensor): Shape [B] + """ + context_img = context[:, :257] + context = context[:, 257:] + + # compute query, key, value + q = self.norm_q(self.q(x)) + k = self.norm_k(self.k(context)) + v = self.v(context) + k_img = self.norm_k_img(self.k_img(context_img)) + v_img = self.v_img(context_img) + img_x = optimized_attention(q, k_img, v_img, heads=self.num_heads) + # compute attention + x = optimized_attention(q, k, v, heads=self.num_heads) + + # output + x = x + img_x + x = self.o(x) + return x + + +WAN_CROSSATTENTION_CLASSES = { + 't2v_cross_attn': WanT2VCrossAttention, + 'i2v_cross_attn': WanI2VCrossAttention, +} + + +class WanAttentionBlock(nn.Module): + + def __init__(self, + cross_attn_type, + dim, + ffn_dim, + num_heads, + window_size=(-1, -1), + qk_norm=True, + cross_attn_norm=False, + eps=1e-6, operation_settings={}): + super().__init__() + self.dim = dim + self.ffn_dim = ffn_dim + self.num_heads = num_heads + self.window_size = window_size + self.qk_norm = qk_norm + self.cross_attn_norm = cross_attn_norm + self.eps = eps + + # layers + self.norm1 = operation_settings.get("operations").LayerNorm(dim, eps, elementwise_affine=False, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.self_attn = WanSelfAttention(dim, num_heads, window_size, qk_norm, + eps, operation_settings=operation_settings) + self.norm3 = operation_settings.get("operations").LayerNorm( + dim, eps, + elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if cross_attn_norm else nn.Identity() + self.cross_attn = WAN_CROSSATTENTION_CLASSES[cross_attn_type](dim, + num_heads, + (-1, -1), + qk_norm, + eps, operation_settings=operation_settings) + self.norm2 = operation_settings.get("operations").LayerNorm(dim, eps, elementwise_affine=False, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.ffn = nn.Sequential( + operation_settings.get("operations").Linear(dim, ffn_dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")), nn.GELU(approximate='tanh'), + operation_settings.get("operations").Linear(ffn_dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype"))) + + # modulation + self.modulation = nn.Parameter(torch.empty(1, 6, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype"))) + + def forward( + self, + x, + e, + seq_lens, + grid_sizes, + freqs, + context, + context_lens, + ): + r""" + Args: + x(Tensor): Shape [B, L, C] + e(Tensor): Shape [B, 6, C] + seq_lens(Tensor): Shape [B], length of each sequence in batch + grid_sizes(Tensor): Shape [B, 3], the second dimension contains (F, H, W) + freqs(Tensor): Rope freqs, shape [1024, C / num_heads / 2] + """ + # assert e.dtype == torch.float32 + + e = (self.modulation + e).chunk(6, dim=1) + # assert e[0].dtype == torch.float32 + + # self-attention + y = self.self_attn( + self.norm1(x) * (1 + e[1]) + e[0], seq_lens, grid_sizes, + freqs) + + x = x + y * e[2] + + # cross-attention & ffn function + def cross_attn_ffn(x, context, context_lens, e): + x = x + self.cross_attn(self.norm3(x), context, context_lens) + y = self.ffn(self.norm2(x) * (1 + e[4]) + e[3]) + x = x + y * e[5] + return x + + x = cross_attn_ffn(x, context, context_lens, e) + return x + + +class Head(nn.Module): + + def __init__(self, dim, out_dim, patch_size, eps=1e-6, operation_settings={}): + super().__init__() + self.dim = dim + self.out_dim = out_dim + self.patch_size = patch_size + self.eps = eps + + # layers + out_dim = math.prod(patch_size) * out_dim + self.norm = operation_settings.get("operations").LayerNorm(dim, eps, elementwise_affine=False, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.head = operation_settings.get("operations").Linear(dim, out_dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + + # modulation + self.modulation = nn.Parameter(torch.empty(1, 2, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype"))) + + def forward(self, x, e): + r""" + Args: + x(Tensor): Shape [B, L1, C] + e(Tensor): Shape [B, C] + """ + # assert e.dtype == torch.float32 + e = (self.modulation + e.unsqueeze(1)).chunk(2, dim=1) + x = (self.head(self.norm(x) * (1 + e[1]) + e[0])) + return x + + +class MLPProj(torch.nn.Module): + + def __init__(self, in_dim, out_dim, operation_settings={}): + super().__init__() + + self.proj = torch.nn.Sequential( + operation_settings.get("operations").LayerNorm(in_dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")), operation_settings.get("operations").Linear(in_dim, in_dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")), + torch.nn.GELU(), operation_settings.get("operations").Linear(in_dim, out_dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")), + operation_settings.get("operations").LayerNorm(out_dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype"))) + + def forward(self, image_embeds): + clip_extra_context_tokens = self.proj(image_embeds) + return clip_extra_context_tokens + + +class WanModel(torch.nn.Module): + r""" + Wan diffusion backbone supporting both text-to-video and image-to-video. + """ + + def __init__(self, + model_type='t2v', + patch_size=(1, 2, 2), + text_len=512, + in_dim=16, + dim=2048, + ffn_dim=8192, + freq_dim=256, + text_dim=4096, + out_dim=16, + num_heads=16, + num_layers=32, + window_size=(-1, -1), + qk_norm=True, + cross_attn_norm=True, + eps=1e-6, + image_model=None, + device=None, + dtype=None, + operations=None, + ): + r""" + Initialize the diffusion model backbone. + + Args: + model_type (`str`, *optional*, defaults to 't2v'): + Model variant - 't2v' (text-to-video) or 'i2v' (image-to-video) + patch_size (`tuple`, *optional*, defaults to (1, 2, 2)): + 3D patch dimensions for video embedding (t_patch, h_patch, w_patch) + text_len (`int`, *optional*, defaults to 512): + Fixed length for text embeddings + in_dim (`int`, *optional*, defaults to 16): + Input video channels (C_in) + dim (`int`, *optional*, defaults to 2048): + Hidden dimension of the transformer + ffn_dim (`int`, *optional*, defaults to 8192): + Intermediate dimension in feed-forward network + freq_dim (`int`, *optional*, defaults to 256): + Dimension for sinusoidal time embeddings + text_dim (`int`, *optional*, defaults to 4096): + Input dimension for text embeddings + out_dim (`int`, *optional*, defaults to 16): + Output video channels (C_out) + num_heads (`int`, *optional*, defaults to 16): + Number of attention heads + num_layers (`int`, *optional*, defaults to 32): + Number of transformer blocks + window_size (`tuple`, *optional*, defaults to (-1, -1)): + Window size for local attention (-1 indicates global attention) + qk_norm (`bool`, *optional*, defaults to True): + Enable query/key normalization + cross_attn_norm (`bool`, *optional*, defaults to False): + Enable cross-attention normalization + eps (`float`, *optional*, defaults to 1e-6): + Epsilon value for normalization layers + """ + + super().__init__() + self.dtype = dtype + operation_settings = {"operations": operations, "device": device, "dtype": dtype} + + assert model_type in ['t2v', 'i2v'] + self.model_type = model_type + + self.patch_size = patch_size + self.text_len = text_len + self.in_dim = in_dim + self.dim = dim + self.ffn_dim = ffn_dim + self.freq_dim = freq_dim + self.text_dim = text_dim + self.out_dim = out_dim + self.num_heads = num_heads + self.num_layers = num_layers + self.window_size = window_size + self.qk_norm = qk_norm + self.cross_attn_norm = cross_attn_norm + self.eps = eps + + # embeddings + self.patch_embedding = operations.Conv3d( + in_dim, dim, kernel_size=patch_size, stride=patch_size, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.text_embedding = nn.Sequential( + operations.Linear(text_dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")), nn.GELU(approximate='tanh'), + operations.Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype"))) + + self.time_embedding = nn.Sequential( + operations.Linear(freq_dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")), nn.SiLU(), operations.Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype"))) + self.time_projection = nn.Sequential(nn.SiLU(), operations.Linear(dim, dim * 6, device=operation_settings.get("device"), dtype=operation_settings.get("dtype"))) + + # blocks + cross_attn_type = 't2v_cross_attn' if model_type == 't2v' else 'i2v_cross_attn' + self.blocks = nn.ModuleList([ + WanAttentionBlock(cross_attn_type, dim, ffn_dim, num_heads, + window_size, qk_norm, cross_attn_norm, eps, operation_settings=operation_settings) + for _ in range(num_layers) + ]) + + # head + self.head = Head(dim, out_dim, patch_size, eps, operation_settings=operation_settings) + + # buffers (don't use register_buffer otherwise dtype will be changed in to()) + assert (dim % num_heads) == 0 and (dim // num_heads) % 2 == 0 + d = dim // num_heads + self.register_buffer("freqs", torch.cat([ + rope_params(1024, d - 4 * (d // 6)), + rope_params(1024, 2 * (d // 6)), + rope_params(1024, 2 * (d // 6)) + ], dim=1), persistent=False) + + if model_type == 'i2v': + self.img_emb = MLPProj(1280, dim, operation_settings=operation_settings) + + def forward_orig( + self, + x, + t, + context, + seq_len=None, + clip_fea=None, + y=None, + ): + r""" + Forward pass through the diffusion model + + Args: + x (List[Tensor]): + List of input video tensors, each with shape [C_in, F, H, W] + t (Tensor): + Diffusion timesteps tensor of shape [B] + context (List[Tensor]): + List of text embeddings each with shape [L, C] + seq_len (`int`): + Maximum sequence length for positional encoding + clip_fea (Tensor, *optional*): + CLIP image features for image-to-video mode + y (List[Tensor], *optional*): + Conditional video inputs for image-to-video mode, same shape as x + + Returns: + List[Tensor]: + List of denoised video tensors with original input shapes [C_out, F, H / 8, W / 8] + """ + if self.model_type == 'i2v': + assert clip_fea is not None and y is not None + # params + # device = self.patch_embedding.weight.device + # if self.freqs.device != device: + # self.freqs = self.freqs.to(device) + + if y is not None: + x = [torch.cat([u, v], dim=0) for u, v in zip(x, y)] + + # embeddings + x = [self.patch_embedding(u) for u in x] + grid_sizes = torch.stack( + [torch.tensor(u.shape[2:], dtype=torch.long) for u in x]) + x = [u.flatten(2).transpose(1, 2) for u in x] + seq_lens = torch.tensor([u.size(1) for u in x], dtype=torch.long) + if seq_len is not None: + assert seq_lens.max() <= seq_len + x = torch.cat([ + torch.cat([u, u.new_zeros(1, seq_len - u.size(1), u.size(2))], + dim=1) for u in x + ]) + elif len(x) == 1: + x = x[0] + + # time embeddings + e = self.time_embedding( + sinusoidal_embedding_1d(self.freq_dim, t).to(dtype=x[0].dtype)) + e0 = self.time_projection(e).unflatten(1, (6, self.dim)) + + # context + context_lens = None + context = self.text_embedding( + torch.cat([ + torch.cat( + [u, u.new_zeros(u.size(0), self.text_len - u.size(1), u.size(2))], dim=1) + for u in context + ], dim=0)) + + if clip_fea is not None: + context_clip = self.img_emb(clip_fea) # bs x 257 x dim + context = torch.concat([context_clip, context], dim=1) + + # arguments + kwargs = dict( + e=e0, + seq_lens=seq_lens, + grid_sizes=grid_sizes, + freqs=self.freqs, + context=context, + context_lens=context_lens) + + for block in self.blocks: + x = block(x, **kwargs) + + # head + x = self.head(x, e) + + # unpatchify + x = self.unpatchify(x, grid_sizes) + return x + # return [u.float() for u in x] + + def forward(self, x, t, context, y=None, image=None, **kwargs): + return self.forward_orig([x], t, [context], clip_fea=y, y=image)[0] + + def unpatchify(self, x, grid_sizes): + r""" + Reconstruct video tensors from patch embeddings. + + Args: + x (List[Tensor]): + List of patchified features, each with shape [L, C_out * prod(patch_size)] + grid_sizes (Tensor): + Original spatial-temporal grid dimensions before patching, + shape [B, 3] (3 dimensions correspond to F_patches, H_patches, W_patches) + + Returns: + List[Tensor]: + Reconstructed video tensors with shape [C_out, F, H / 8, W / 8] + """ + + c = self.out_dim + out = [] + for u, v in zip(x, grid_sizes.tolist()): + u = u[:math.prod(v)].view(*v, *self.patch_size, c) + u = torch.einsum('fhwpqrc->cfphqwr', u) + u = u.reshape(c, *[i * j for i, j in zip(v, self.patch_size)]) + out.append(u) + return out diff --git a/comfy/ldm/wan/vae.py b/comfy/ldm/wan/vae.py new file mode 100644 index 000000000..a8ebc5ec6 --- /dev/null +++ b/comfy/ldm/wan/vae.py @@ -0,0 +1,567 @@ +# original version: https://github.com/Wan-Video/Wan2.1/blob/main/wan/modules/vae.py +# Copyright 2024-2025 The Alibaba Wan Team Authors. All rights reserved. + +import torch +import torch.nn as nn +import torch.nn.functional as F +from einops import rearrange +from comfy.ldm.modules.diffusionmodules.model import vae_attention + +import comfy.ops +ops = comfy.ops.disable_weight_init + +CACHE_T = 2 + + +class CausalConv3d(ops.Conv3d): + """ + Causal 3d convolusion. + """ + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._padding = (self.padding[2], self.padding[2], self.padding[1], + self.padding[1], 2 * self.padding[0], 0) + self.padding = (0, 0, 0) + + def forward(self, x, cache_x=None): + padding = list(self._padding) + if cache_x is not None and self._padding[4] > 0: + cache_x = cache_x.to(x.device) + x = torch.cat([cache_x, x], dim=2) + padding[4] -= cache_x.shape[2] + x = F.pad(x, padding) + + return super().forward(x) + + +class RMS_norm(nn.Module): + + def __init__(self, dim, channel_first=True, images=True, bias=False): + super().__init__() + broadcastable_dims = (1, 1, 1) if not images else (1, 1) + shape = (dim, *broadcastable_dims) if channel_first else (dim,) + + self.channel_first = channel_first + self.scale = dim**0.5 + self.gamma = nn.Parameter(torch.ones(shape)) + self.bias = nn.Parameter(torch.zeros(shape)) if bias else None + + def forward(self, x): + return F.normalize( + x, dim=(1 if self.channel_first else -1)) * self.scale * self.gamma.to(x) + (self.bias.to(x) if self.bias is not None else 0) + + +class Upsample(nn.Upsample): + + def forward(self, x): + """ + Fix bfloat16 support for nearest neighbor interpolation. + """ + return super().forward(x.float()).type_as(x) + + +class Resample(nn.Module): + + def __init__(self, dim, mode): + assert mode in ('none', 'upsample2d', 'upsample3d', 'downsample2d', + 'downsample3d') + super().__init__() + self.dim = dim + self.mode = mode + + # layers + if mode == 'upsample2d': + self.resample = nn.Sequential( + Upsample(scale_factor=(2., 2.), mode='nearest-exact'), + ops.Conv2d(dim, dim // 2, 3, padding=1)) + elif mode == 'upsample3d': + self.resample = nn.Sequential( + Upsample(scale_factor=(2., 2.), mode='nearest-exact'), + ops.Conv2d(dim, dim // 2, 3, padding=1)) + self.time_conv = CausalConv3d( + dim, dim * 2, (3, 1, 1), padding=(1, 0, 0)) + + elif mode == 'downsample2d': + self.resample = nn.Sequential( + nn.ZeroPad2d((0, 1, 0, 1)), + ops.Conv2d(dim, dim, 3, stride=(2, 2))) + elif mode == 'downsample3d': + self.resample = nn.Sequential( + nn.ZeroPad2d((0, 1, 0, 1)), + ops.Conv2d(dim, dim, 3, stride=(2, 2))) + self.time_conv = CausalConv3d( + dim, dim, (3, 1, 1), stride=(2, 1, 1), padding=(0, 0, 0)) + + else: + self.resample = nn.Identity() + + def forward(self, x, feat_cache=None, feat_idx=[0]): + b, c, t, h, w = x.size() + if self.mode == 'upsample3d': + if feat_cache is not None: + idx = feat_idx[0] + if feat_cache[idx] is None: + feat_cache[idx] = 'Rep' + feat_idx[0] += 1 + else: + + cache_x = x[:, :, -CACHE_T:, :, :].clone() + if cache_x.shape[2] < 2 and feat_cache[ + idx] is not None and feat_cache[idx] != 'Rep': + # cache last frame of last two chunk + cache_x = torch.cat([ + feat_cache[idx][:, :, -1, :, :].unsqueeze(2).to( + cache_x.device), cache_x + ], + dim=2) + if cache_x.shape[2] < 2 and feat_cache[ + idx] is not None and feat_cache[idx] == 'Rep': + cache_x = torch.cat([ + torch.zeros_like(cache_x).to(cache_x.device), + cache_x + ], + dim=2) + if feat_cache[idx] == 'Rep': + x = self.time_conv(x) + else: + x = self.time_conv(x, feat_cache[idx]) + feat_cache[idx] = cache_x + feat_idx[0] += 1 + + x = x.reshape(b, 2, c, t, h, w) + x = torch.stack((x[:, 0, :, :, :, :], x[:, 1, :, :, :, :]), + 3) + x = x.reshape(b, c, t * 2, h, w) + t = x.shape[2] + x = rearrange(x, 'b c t h w -> (b t) c h w') + x = self.resample(x) + x = rearrange(x, '(b t) c h w -> b c t h w', t=t) + + if self.mode == 'downsample3d': + if feat_cache is not None: + idx = feat_idx[0] + if feat_cache[idx] is None: + feat_cache[idx] = x.clone() + feat_idx[0] += 1 + else: + + cache_x = x[:, :, -1:, :, :].clone() + # if cache_x.shape[2] < 2 and feat_cache[idx] is not None and feat_cache[idx]!='Rep': + # # cache last frame of last two chunk + # cache_x = torch.cat([feat_cache[idx][:, :, -1, :, :].unsqueeze(2).to(cache_x.device), cache_x], dim=2) + + x = self.time_conv( + torch.cat([feat_cache[idx][:, :, -1:, :, :], x], 2)) + feat_cache[idx] = cache_x + feat_idx[0] += 1 + return x + + def init_weight(self, conv): + conv_weight = conv.weight + nn.init.zeros_(conv_weight) + c1, c2, t, h, w = conv_weight.size() + one_matrix = torch.eye(c1, c2) + init_matrix = one_matrix + nn.init.zeros_(conv_weight) + #conv_weight.data[:,:,-1,1,1] = init_matrix * 0.5 + conv_weight.data[:, :, 1, 0, 0] = init_matrix #* 0.5 + conv.weight.data.copy_(conv_weight) + nn.init.zeros_(conv.bias.data) + + def init_weight2(self, conv): + conv_weight = conv.weight.data + nn.init.zeros_(conv_weight) + c1, c2, t, h, w = conv_weight.size() + init_matrix = torch.eye(c1 // 2, c2) + #init_matrix = repeat(init_matrix, 'o ... -> (o 2) ...').permute(1,0,2).contiguous().reshape(c1,c2) + conv_weight[:c1 // 2, :, -1, 0, 0] = init_matrix + conv_weight[c1 // 2:, :, -1, 0, 0] = init_matrix + conv.weight.data.copy_(conv_weight) + nn.init.zeros_(conv.bias.data) + + +class ResidualBlock(nn.Module): + + def __init__(self, in_dim, out_dim, dropout=0.0): + super().__init__() + self.in_dim = in_dim + self.out_dim = out_dim + + # layers + self.residual = nn.Sequential( + RMS_norm(in_dim, images=False), nn.SiLU(), + CausalConv3d(in_dim, out_dim, 3, padding=1), + RMS_norm(out_dim, images=False), nn.SiLU(), nn.Dropout(dropout), + CausalConv3d(out_dim, out_dim, 3, padding=1)) + self.shortcut = CausalConv3d(in_dim, out_dim, 1) \ + if in_dim != out_dim else nn.Identity() + + def forward(self, x, feat_cache=None, feat_idx=[0]): + h = self.shortcut(x) + for layer in self.residual: + if isinstance(layer, CausalConv3d) and feat_cache is not None: + idx = feat_idx[0] + cache_x = x[:, :, -CACHE_T:, :, :].clone() + if cache_x.shape[2] < 2 and feat_cache[idx] is not None: + # cache last frame of last two chunk + cache_x = torch.cat([ + feat_cache[idx][:, :, -1, :, :].unsqueeze(2).to( + cache_x.device), cache_x + ], + dim=2) + x = layer(x, feat_cache[idx]) + feat_cache[idx] = cache_x + feat_idx[0] += 1 + else: + x = layer(x) + return x + h + + +class AttentionBlock(nn.Module): + """ + Causal self-attention with a single head. + """ + + def __init__(self, dim): + super().__init__() + self.dim = dim + + # layers + self.norm = RMS_norm(dim) + self.to_qkv = ops.Conv2d(dim, dim * 3, 1) + self.proj = ops.Conv2d(dim, dim, 1) + self.optimized_attention = vae_attention() + + def forward(self, x): + identity = x + b, c, t, h, w = x.size() + x = rearrange(x, 'b c t h w -> (b t) c h w') + x = self.norm(x) + # compute query, key, value + + q, k, v = self.to_qkv(x).chunk(3, dim=1) + x = self.optimized_attention(q, k, v) + + # output + x = self.proj(x) + x = rearrange(x, '(b t) c h w-> b c t h w', t=t) + return x + identity + + +class Encoder3d(nn.Module): + + def __init__(self, + dim=128, + z_dim=4, + dim_mult=[1, 2, 4, 4], + num_res_blocks=2, + attn_scales=[], + temperal_downsample=[True, True, False], + dropout=0.0): + super().__init__() + self.dim = dim + self.z_dim = z_dim + self.dim_mult = dim_mult + self.num_res_blocks = num_res_blocks + self.attn_scales = attn_scales + self.temperal_downsample = temperal_downsample + + # dimensions + dims = [dim * u for u in [1] + dim_mult] + scale = 1.0 + + # init block + self.conv1 = CausalConv3d(3, dims[0], 3, padding=1) + + # downsample blocks + downsamples = [] + for i, (in_dim, out_dim) in enumerate(zip(dims[:-1], dims[1:])): + # residual (+attention) blocks + for _ in range(num_res_blocks): + downsamples.append(ResidualBlock(in_dim, out_dim, dropout)) + if scale in attn_scales: + downsamples.append(AttentionBlock(out_dim)) + in_dim = out_dim + + # downsample block + if i != len(dim_mult) - 1: + mode = 'downsample3d' if temperal_downsample[ + i] else 'downsample2d' + downsamples.append(Resample(out_dim, mode=mode)) + scale /= 2.0 + self.downsamples = nn.Sequential(*downsamples) + + # middle blocks + self.middle = nn.Sequential( + ResidualBlock(out_dim, out_dim, dropout), AttentionBlock(out_dim), + ResidualBlock(out_dim, out_dim, dropout)) + + # output blocks + self.head = nn.Sequential( + RMS_norm(out_dim, images=False), nn.SiLU(), + CausalConv3d(out_dim, z_dim, 3, padding=1)) + + def forward(self, x, feat_cache=None, feat_idx=[0]): + if feat_cache is not None: + idx = feat_idx[0] + cache_x = x[:, :, -CACHE_T:, :, :].clone() + if cache_x.shape[2] < 2 and feat_cache[idx] is not None: + # cache last frame of last two chunk + cache_x = torch.cat([ + feat_cache[idx][:, :, -1, :, :].unsqueeze(2).to( + cache_x.device), cache_x + ], + dim=2) + x = self.conv1(x, feat_cache[idx]) + feat_cache[idx] = cache_x + feat_idx[0] += 1 + else: + x = self.conv1(x) + + ## downsamples + for layer in self.downsamples: + if feat_cache is not None: + x = layer(x, feat_cache, feat_idx) + else: + x = layer(x) + + ## middle + for layer in self.middle: + if isinstance(layer, ResidualBlock) and feat_cache is not None: + x = layer(x, feat_cache, feat_idx) + else: + x = layer(x) + + ## head + for layer in self.head: + if isinstance(layer, CausalConv3d) and feat_cache is not None: + idx = feat_idx[0] + cache_x = x[:, :, -CACHE_T:, :, :].clone() + if cache_x.shape[2] < 2 and feat_cache[idx] is not None: + # cache last frame of last two chunk + cache_x = torch.cat([ + feat_cache[idx][:, :, -1, :, :].unsqueeze(2).to( + cache_x.device), cache_x + ], + dim=2) + x = layer(x, feat_cache[idx]) + feat_cache[idx] = cache_x + feat_idx[0] += 1 + else: + x = layer(x) + return x + + +class Decoder3d(nn.Module): + + def __init__(self, + dim=128, + z_dim=4, + dim_mult=[1, 2, 4, 4], + num_res_blocks=2, + attn_scales=[], + temperal_upsample=[False, True, True], + dropout=0.0): + super().__init__() + self.dim = dim + self.z_dim = z_dim + self.dim_mult = dim_mult + self.num_res_blocks = num_res_blocks + self.attn_scales = attn_scales + self.temperal_upsample = temperal_upsample + + # dimensions + dims = [dim * u for u in [dim_mult[-1]] + dim_mult[::-1]] + scale = 1.0 / 2**(len(dim_mult) - 2) + + # init block + self.conv1 = CausalConv3d(z_dim, dims[0], 3, padding=1) + + # middle blocks + self.middle = nn.Sequential( + ResidualBlock(dims[0], dims[0], dropout), AttentionBlock(dims[0]), + ResidualBlock(dims[0], dims[0], dropout)) + + # upsample blocks + upsamples = [] + for i, (in_dim, out_dim) in enumerate(zip(dims[:-1], dims[1:])): + # residual (+attention) blocks + if i == 1 or i == 2 or i == 3: + in_dim = in_dim // 2 + for _ in range(num_res_blocks + 1): + upsamples.append(ResidualBlock(in_dim, out_dim, dropout)) + if scale in attn_scales: + upsamples.append(AttentionBlock(out_dim)) + in_dim = out_dim + + # upsample block + if i != len(dim_mult) - 1: + mode = 'upsample3d' if temperal_upsample[i] else 'upsample2d' + upsamples.append(Resample(out_dim, mode=mode)) + scale *= 2.0 + self.upsamples = nn.Sequential(*upsamples) + + # output blocks + self.head = nn.Sequential( + RMS_norm(out_dim, images=False), nn.SiLU(), + CausalConv3d(out_dim, 3, 3, padding=1)) + + def forward(self, x, feat_cache=None, feat_idx=[0]): + ## conv1 + if feat_cache is not None: + idx = feat_idx[0] + cache_x = x[:, :, -CACHE_T:, :, :].clone() + if cache_x.shape[2] < 2 and feat_cache[idx] is not None: + # cache last frame of last two chunk + cache_x = torch.cat([ + feat_cache[idx][:, :, -1, :, :].unsqueeze(2).to( + cache_x.device), cache_x + ], + dim=2) + x = self.conv1(x, feat_cache[idx]) + feat_cache[idx] = cache_x + feat_idx[0] += 1 + else: + x = self.conv1(x) + + ## middle + for layer in self.middle: + if isinstance(layer, ResidualBlock) and feat_cache is not None: + x = layer(x, feat_cache, feat_idx) + else: + x = layer(x) + + ## upsamples + for layer in self.upsamples: + if feat_cache is not None: + x = layer(x, feat_cache, feat_idx) + else: + x = layer(x) + + ## head + for layer in self.head: + if isinstance(layer, CausalConv3d) and feat_cache is not None: + idx = feat_idx[0] + cache_x = x[:, :, -CACHE_T:, :, :].clone() + if cache_x.shape[2] < 2 and feat_cache[idx] is not None: + # cache last frame of last two chunk + cache_x = torch.cat([ + feat_cache[idx][:, :, -1, :, :].unsqueeze(2).to( + cache_x.device), cache_x + ], + dim=2) + x = layer(x, feat_cache[idx]) + feat_cache[idx] = cache_x + feat_idx[0] += 1 + else: + x = layer(x) + return x + + +def count_conv3d(model): + count = 0 + for m in model.modules(): + if isinstance(m, CausalConv3d): + count += 1 + return count + + +class WanVAE(nn.Module): + + def __init__(self, + dim=128, + z_dim=4, + dim_mult=[1, 2, 4, 4], + num_res_blocks=2, + attn_scales=[], + temperal_downsample=[True, True, False], + dropout=0.0): + super().__init__() + self.dim = dim + self.z_dim = z_dim + self.dim_mult = dim_mult + self.num_res_blocks = num_res_blocks + self.attn_scales = attn_scales + self.temperal_downsample = temperal_downsample + self.temperal_upsample = temperal_downsample[::-1] + + # modules + self.encoder = Encoder3d(dim, z_dim * 2, dim_mult, num_res_blocks, + attn_scales, self.temperal_downsample, dropout) + self.conv1 = CausalConv3d(z_dim * 2, z_dim * 2, 1) + self.conv2 = CausalConv3d(z_dim, z_dim, 1) + self.decoder = Decoder3d(dim, z_dim, dim_mult, num_res_blocks, + attn_scales, self.temperal_upsample, dropout) + + def forward(self, x): + mu, log_var = self.encode(x) + z = self.reparameterize(mu, log_var) + x_recon = self.decode(z) + return x_recon, mu, log_var + + def encode(self, x): + self.clear_cache() + ## cache + t = x.shape[2] + iter_ = 1 + (t - 1) // 4 + ## 对encode输入的x,按时间拆分为1、4、4、4.... + for i in range(iter_): + self._enc_conv_idx = [0] + if i == 0: + out = self.encoder( + x[:, :, :1, :, :], + feat_cache=self._enc_feat_map, + feat_idx=self._enc_conv_idx) + else: + out_ = self.encoder( + x[:, :, 1 + 4 * (i - 1):1 + 4 * i, :, :], + feat_cache=self._enc_feat_map, + feat_idx=self._enc_conv_idx) + out = torch.cat([out, out_], 2) + mu, log_var = self.conv1(out).chunk(2, dim=1) + self.clear_cache() + return mu + + def decode(self, z): + self.clear_cache() + # z: [b,c,t,h,w] + + iter_ = z.shape[2] + x = self.conv2(z) + for i in range(iter_): + self._conv_idx = [0] + if i == 0: + out = self.decoder( + x[:, :, i:i + 1, :, :], + feat_cache=self._feat_map, + feat_idx=self._conv_idx) + else: + out_ = self.decoder( + x[:, :, i:i + 1, :, :], + feat_cache=self._feat_map, + feat_idx=self._conv_idx) + out = torch.cat([out, out_], 2) + self.clear_cache() + return out + + def reparameterize(self, mu, log_var): + std = torch.exp(0.5 * log_var) + eps = torch.randn_like(std) + return eps * std + mu + + def sample(self, imgs, deterministic=False): + mu, log_var = self.encode(imgs) + if deterministic: + return mu + std = torch.exp(0.5 * log_var.clamp(-30.0, 20.0)) + return mu + std * torch.randn_like(std) + + def clear_cache(self): + self._conv_num = count_conv3d(self.decoder) + self._conv_idx = [0] + self._feat_map = [None] * self._conv_num + #cache encode + self._enc_conv_num = count_conv3d(self.encoder) + self._enc_conv_idx = [0] + self._enc_feat_map = [None] * self._enc_conv_num diff --git a/comfy/model_base.py b/comfy/model_base.py index 0eeaed790..76fd52c75 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -35,6 +35,7 @@ import comfy.ldm.lightricks.model import comfy.ldm.hunyuan_video.model import comfy.ldm.cosmos.model import comfy.ldm.lumina.model +import comfy.ldm.wan.model import comfy.model_management import comfy.patcher_extension @@ -927,3 +928,14 @@ class Lumina2(BaseModel): if cross_attn is not None: out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) return out + +class WAN21_T2V(BaseModel): + def __init__(self, model_config, model_type=ModelType.FLOW, device=None): + super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.wan.model.WanModel) + + def extra_conds(self, **kwargs): + out = super().extra_conds(**kwargs) + cross_attn = kwargs.get("cross_attn", None) + if cross_attn is not None: + out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) + return out diff --git a/comfy/model_detection.py b/comfy/model_detection.py index b1faa63f4..3dbd9dada 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -299,6 +299,26 @@ def detect_unet_config(state_dict, key_prefix): dit_config["axes_lens"] = [300, 512, 512] return dit_config + if '{}head.modulation'.format(key_prefix) in state_dict_keys: # Wan 2.1 + dit_config = {} + dit_config["image_model"] = "wan2.1" + dim = state_dict['{}head.modulation'.format(key_prefix)].shape[-1] + dit_config["dim"] = dim + dit_config["num_heads"] = dim // 128 + dit_config["ffn_dim"] = state_dict['{}blocks.0.ffn.0.weight'.format(key_prefix)].shape[0] + dit_config["num_layers"] = count_blocks(state_dict_keys, '{}blocks.'.format(key_prefix) + '{}.') + dit_config["patch_size"] = (1, 2, 2) + dit_config["freq_dim"] = 256 + dit_config["window_size"] = (-1, -1) + dit_config["qk_norm"] = True + dit_config["cross_attn_norm"] = True + dit_config["eps"] = 1e-6 + if '{}img_emb.proj.0.bias'.format(key_prefix) in state_dict_keys: + dit_config["model_type"] = "i2v" + else: + dit_config["model_type"] = "t2v" + return dit_config + if '{}input_blocks.0.0.weight'.format(key_prefix) not in state_dict_keys: return None diff --git a/comfy/sd.py b/comfy/sd.py index eabf0bda0..640253b09 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -12,6 +12,7 @@ from .ldm.audio.autoencoder import AudioOobleckVAE import comfy.ldm.genmo.vae.model import comfy.ldm.lightricks.vae.causal_video_autoencoder import comfy.ldm.cosmos.vae +import comfy.ldm.wan.vae import yaml import math @@ -37,6 +38,7 @@ import comfy.text_encoders.lt import comfy.text_encoders.hunyuan_video import comfy.text_encoders.cosmos import comfy.text_encoders.lumina2 +import comfy.text_encoders.wan import comfy.model_patcher import comfy.lora @@ -392,6 +394,18 @@ class VAE: self.memory_used_decode = lambda shape, dtype: (50 * shape[2] * shape[3] * shape[4] * (8 * 8 * 8)) * model_management.dtype_size(dtype) self.memory_used_encode = lambda shape, dtype: (50 * (round((shape[2] + 7) / 8) * 8) * shape[3] * shape[4]) * model_management.dtype_size(dtype) self.working_dtypes = [torch.bfloat16, torch.float32] + elif "decoder.middle.0.residual.0.gamma" in sd: + self.upscale_ratio = (lambda a: max(0, a * 4 - 3), 8, 8) + self.upscale_index_formula = (4, 8, 8) + self.downscale_ratio = (lambda a: max(0, math.floor((a + 3) / 4)), 8, 8) + self.downscale_index_formula = (4, 8, 8) + self.latent_dim = 3 + self.latent_channels = 16 + ddconfig = {"dim": 96, "z_dim": self.latent_channels, "dim_mult": [1, 2, 4, 4], "num_res_blocks": 2, "attn_scales": [], "temperal_downsample": [False, True, True], "dropout": 0.0} + self.first_stage_model = comfy.ldm.wan.vae.WanVAE(**ddconfig) + self.working_dtypes = [torch.bfloat16, torch.float16, torch.float32] + self.memory_used_encode = lambda shape, dtype: 6000 * shape[3] * shape[4] * model_management.dtype_size(dtype) + self.memory_used_decode = lambda shape, dtype: 7000 * shape[3] * shape[4] * (8 * 8) * model_management.dtype_size(dtype) else: logging.warning("WARNING: No VAE weights detected, VAE not initalized.") self.first_stage_model = None @@ -659,6 +673,7 @@ class CLIPType(Enum): PIXART = 10 COSMOS = 11 LUMINA2 = 12 + WAN = 13 def load_clip(ckpt_paths, embedding_directory=None, clip_type=CLIPType.STABLE_DIFFUSION, model_options={}): @@ -763,6 +778,10 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip elif clip_type == CLIPType.PIXART: clip_target.clip = comfy.text_encoders.pixart_t5.pixart_te(**t5xxl_detect(clip_data)) clip_target.tokenizer = comfy.text_encoders.pixart_t5.PixArtTokenizer + elif clip_type == CLIPType.WAN: + clip_target.clip = comfy.text_encoders.wan.te(**t5xxl_detect(clip_data)) + clip_target.tokenizer = comfy.text_encoders.wan.WanT5Tokenizer + tokenizer_data["spiece_model"] = clip_data[0].get("spiece_model", None) else: #CLIPType.MOCHI clip_target.clip = comfy.text_encoders.genmo.mochi_te(**t5xxl_detect(clip_data)) clip_target.tokenizer = comfy.text_encoders.genmo.MochiT5Tokenizer diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 7aa152480..64611f58d 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -16,6 +16,7 @@ import comfy.text_encoders.lt import comfy.text_encoders.hunyuan_video import comfy.text_encoders.cosmos import comfy.text_encoders.lumina2 +import comfy.text_encoders.wan from . import supported_models_base from . import latent_formats @@ -895,6 +896,35 @@ class Lumina2(supported_models_base.BASE): hunyuan_detect = comfy.text_encoders.hunyuan_video.llama_detect(state_dict, "{}gemma2_2b.transformer.".format(pref)) return supported_models_base.ClipTarget(comfy.text_encoders.lumina2.LuminaTokenizer, comfy.text_encoders.lumina2.te(**hunyuan_detect)) -models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2] +class WAN21_T2V(supported_models_base.BASE): + unet_config = { + "image_model": "wan2.1", + "model_type": "t2v", + } + + sampling_settings = { + "shift": 8.0, + } + + unet_extra_config = {} + latent_format = latent_formats.Wan21 + + memory_usage_factor = 1.0 + + supported_inference_dtypes = [torch.bfloat16, torch.float32] + + vae_key_prefix = ["vae."] + text_encoder_key_prefix = ["text_encoders."] + + def get_model(self, state_dict, prefix="", device=None): + out = model_base.WAN21_T2V(self, device=device) + return out + + def clip_target(self, state_dict={}): + pref = self.text_encoder_key_prefix[0] + t5_detect = comfy.text_encoders.sd3_clip.t5_xxl_detect(state_dict, "{}umt5xxl.transformer.".format(pref)) + return supported_models_base.ClipTarget(comfy.text_encoders.wan.WanT5Tokenizer, comfy.text_encoders.wan.te(**t5_detect)) + +models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V] models += [SVD_img2vid] diff --git a/comfy/text_encoders/umt5_config_xxl.json b/comfy/text_encoders/umt5_config_xxl.json new file mode 100644 index 000000000..dfcb4b54b --- /dev/null +++ b/comfy/text_encoders/umt5_config_xxl.json @@ -0,0 +1,22 @@ +{ + "d_ff": 10240, + "d_kv": 64, + "d_model": 4096, + "decoder_start_token_id": 0, + "dropout_rate": 0.1, + "eos_token_id": 1, + "dense_act_fn": "gelu_pytorch_tanh", + "initializer_factor": 1.0, + "is_encoder_decoder": true, + "is_gated_act": true, + "layer_norm_epsilon": 1e-06, + "model_type": "umt5", + "num_decoder_layers": 24, + "num_heads": 64, + "num_layers": 24, + "output_past": true, + "pad_token_id": 0, + "relative_attention_num_buckets": 32, + "tie_word_embeddings": false, + "vocab_size": 256384 +} diff --git a/comfy/text_encoders/wan.py b/comfy/text_encoders/wan.py new file mode 100644 index 000000000..d98c9ad28 --- /dev/null +++ b/comfy/text_encoders/wan.py @@ -0,0 +1,37 @@ +from comfy import sd1_clip +from .spiece_tokenizer import SPieceTokenizer +import comfy.text_encoders.t5 +import os + +class UMT5XXlModel(sd1_clip.SDClipModel): + def __init__(self, device="cpu", layer="last", layer_idx=None, dtype=None, model_options={}): + textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "umt5_config_xxl.json") + super().__init__(device=device, layer=layer, layer_idx=layer_idx, textmodel_json_config=textmodel_json_config, dtype=dtype, special_tokens={"end": 1, "pad": 0}, model_class=comfy.text_encoders.t5.T5, enable_attention_masks=True, zero_out_masked=True, model_options=model_options) + +class UMT5XXlTokenizer(sd1_clip.SDTokenizer): + def __init__(self, embedding_directory=None, tokenizer_data={}): + tokenizer = tokenizer_data.get("spiece_model", None) + super().__init__(tokenizer, pad_with_end=False, embedding_size=4096, embedding_key='umt5xxl', tokenizer_class=SPieceTokenizer, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=1, pad_token=0) + + def state_dict(self): + return {"spiece_model": self.tokenizer.serialize_model()} + + +class WanT5Tokenizer(sd1_clip.SD1Tokenizer): + def __init__(self, embedding_directory=None, tokenizer_data={}): + super().__init__(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data, clip_name="umt5xxl", tokenizer=UMT5XXlTokenizer) + +class WanT5Model(sd1_clip.SD1ClipModel): + def __init__(self, device="cpu", dtype=None, model_options={}, **kwargs): + super().__init__(device=device, dtype=dtype, model_options=model_options, name="umt5xxl", clip_model=UMT5XXlModel, **kwargs) + +def te(dtype_t5=None, t5xxl_scaled_fp8=None): + class WanTEModel(WanT5Model): + def __init__(self, device="cpu", dtype=None, model_options={}): + if t5xxl_scaled_fp8 is not None and "scaled_fp8" not in model_options: + model_options = model_options.copy() + model_options["scaled_fp8"] = t5xxl_scaled_fp8 + if dtype_t5 is not None: + dtype = dtype_t5 + super().__init__(device=device, dtype=dtype, model_options=model_options) + return WanTEModel diff --git a/nodes.py b/nodes.py index 4e68af79d..a93254106 100644 --- a/nodes.py +++ b/nodes.py @@ -914,7 +914,7 @@ class CLIPLoader: @classmethod def INPUT_TYPES(s): return {"required": { "clip_name": (folder_paths.get_filename_list("text_encoders"), ), - "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart", "cosmos", "lumina2"], ), + "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart", "cosmos", "lumina2", "wan"], ), }, "optional": { "device": (["default", "cpu"], {"advanced": True}), @@ -924,7 +924,7 @@ class CLIPLoader: CATEGORY = "advanced/loaders" - DESCRIPTION = "[Recipes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5\ncosmos: old t5 xxl\nlumina2: gemma 2 2B" + DESCRIPTION = "[Recipes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 xxl/ clip-g / clip-l\nstable_audio: t5 base\nmochi: t5 xxl\ncosmos: old t5 xxl\nlumina2: gemma 2 2B\nwan: umt5 xxl" def load_clip(self, clip_name, type="stable_diffusion", device="default"): if type == "stable_cascade": @@ -943,6 +943,8 @@ class CLIPLoader: clip_type = comfy.sd.CLIPType.COSMOS elif type == "lumina2": clip_type = comfy.sd.CLIPType.LUMINA2 + elif type == "wan": + clip_type = comfy.sd.CLIPType.WAN else: clip_type = comfy.sd.CLIPType.STABLE_DIFFUSION From f37551c1d2d11b6e2baaed7f2afbad32bbc61488 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 25 Feb 2025 19:11:14 -0500 Subject: [PATCH 133/478] Change wan rope implementation to the flux one. Should be more compatible. --- comfy/ldm/wan/model.py | 79 ++++++++++++------------------------------ 1 file changed, 23 insertions(+), 56 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index 49880b606..546ebb225 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -4,9 +4,11 @@ import math import torch import torch.nn as nn +from einops import repeat from comfy.ldm.modules.attention import optimized_attention - +from comfy.ldm.flux.layers import EmbedND +from comfy.ldm.flux.math import apply_rope def sinusoidal_embedding_1d(dim, position): # preprocess @@ -21,45 +23,6 @@ def sinusoidal_embedding_1d(dim, position): return x -def rope_params(max_seq_len, dim, theta=10000): - assert dim % 2 == 0 - freqs = torch.outer( - torch.arange(max_seq_len), - 1.0 / torch.pow(theta, - torch.arange(0, dim, 2).to(torch.float64).div(dim))) - freqs = torch.polar(torch.ones_like(freqs), freqs) - return freqs - - -def rope_apply(x, grid_sizes, freqs): - n, c = x.size(2), x.size(3) // 2 - - # split freqs - freqs = freqs.split([c - 2 * (c // 3), c // 3, c // 3], dim=1) - - # loop over samples - output = [] - for i, (f, h, w) in enumerate(grid_sizes.tolist()): - seq_len = f * h * w - - # precompute multipliers - x_i = torch.view_as_complex(x[i, :seq_len].to(torch.float64).reshape( - seq_len, n, -1, 2)) - freqs_i = torch.cat([ - freqs[0][:f].view(f, 1, 1, -1).expand(f, h, w, -1), - freqs[1][:h].view(1, h, 1, -1).expand(f, h, w, -1), - freqs[2][:w].view(1, 1, w, -1).expand(f, h, w, -1) - ], dim=-1).reshape(seq_len, 1, -1) - - # apply rotary embedding - x_i = torch.view_as_real(x_i * freqs_i).flatten(2) - x_i = torch.cat([x_i, x[i, seq_len:]]) - - # append to collection - output.append(x_i) - return torch.stack(output).to(dtype=x.dtype) - - class WanRMSNorm(nn.Module): def __init__(self, dim, eps=1e-5, device=None, dtype=None): @@ -122,10 +85,11 @@ class WanSelfAttention(nn.Module): return q, k, v q, k, v = qkv_fn(x) + q, k = apply_rope(q, k, freqs) x = optimized_attention( - q=rope_apply(q, grid_sizes, freqs).view(b, s, n * d), - k=rope_apply(k, grid_sizes, freqs).view(b, s, n * d), + q=q.view(b, s, n * d), + k=k.view(b, s, n * d), v=v, heads=self.num_heads, ) @@ -433,14 +397,8 @@ class WanModel(torch.nn.Module): # head self.head = Head(dim, out_dim, patch_size, eps, operation_settings=operation_settings) - # buffers (don't use register_buffer otherwise dtype will be changed in to()) - assert (dim % num_heads) == 0 and (dim // num_heads) % 2 == 0 d = dim // num_heads - self.register_buffer("freqs", torch.cat([ - rope_params(1024, d - 4 * (d // 6)), - rope_params(1024, 2 * (d // 6)), - rope_params(1024, 2 * (d // 6)) - ], dim=1), persistent=False) + self.rope_embedder = EmbedND(dim=d, theta=10000.0, axes_dim=[d - 4 * (d // 6), 2 * (d // 6), 2 * (d // 6)]) if model_type == 'i2v': self.img_emb = MLPProj(1280, dim, operation_settings=operation_settings) @@ -453,6 +411,7 @@ class WanModel(torch.nn.Module): seq_len=None, clip_fea=None, y=None, + freqs=None, ): r""" Forward pass through the diffusion model @@ -477,10 +436,6 @@ class WanModel(torch.nn.Module): """ if self.model_type == 'i2v': assert clip_fea is not None and y is not None - # params - # device = self.patch_embedding.weight.device - # if self.freqs.device != device: - # self.freqs = self.freqs.to(device) if y is not None: x = [torch.cat([u, v], dim=0) for u, v in zip(x, y)] @@ -523,7 +478,7 @@ class WanModel(torch.nn.Module): e=e0, seq_lens=seq_lens, grid_sizes=grid_sizes, - freqs=self.freqs, + freqs=freqs, context=context, context_lens=context_lens) @@ -538,8 +493,20 @@ class WanModel(torch.nn.Module): return x # return [u.float() for u in x] - def forward(self, x, t, context, y=None, image=None, **kwargs): - return self.forward_orig([x], t, [context], clip_fea=y, y=image)[0] + def forward(self, x, timestep, context, y=None, image=None, **kwargs): + bs, c, t, h, w = x.shape + patch_size = self.patch_size + t_len = ((t + (patch_size[0] // 2)) // patch_size[0]) + h_len = ((h + (patch_size[1] // 2)) // patch_size[1]) + w_len = ((w + (patch_size[2] // 2)) // patch_size[2]) + img_ids = torch.zeros((t_len, h_len, w_len, 3), device=x.device, dtype=x.dtype) + img_ids[:, :, :, 0] = img_ids[:, :, :, 0] + torch.linspace(0, t_len - 1, steps=t_len, device=x.device, dtype=x.dtype).reshape(-1, 1, 1) + img_ids[:, :, :, 1] = img_ids[:, :, :, 1] + torch.linspace(0, h_len - 1, steps=h_len, device=x.device, dtype=x.dtype).reshape(1, -1, 1) + img_ids[:, :, :, 2] = img_ids[:, :, :, 2] + torch.linspace(0, w_len - 1, steps=w_len, device=x.device, dtype=x.dtype).reshape(1, 1, -1) + img_ids = repeat(img_ids, "t h w c -> b (t h w) c", b=bs) + + freqs = self.rope_embedder(img_ids).movedim(1, 2) + return self.forward_orig([x], timestep, [context], clip_fea=y, y=image, freqs=freqs)[0] def unpatchify(self, x, grid_sizes): r""" From ea0f939df32cc808ac1ce79448d56eeef89796e2 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 25 Feb 2025 19:13:39 -0500 Subject: [PATCH 134/478] Fix issue with wan and other attention implementations. --- comfy/ldm/wan/model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index 546ebb225..151192975 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -88,9 +88,9 @@ class WanSelfAttention(nn.Module): q, k = apply_rope(q, k, freqs) x = optimized_attention( - q=q.view(b, s, n * d), - k=k.view(b, s, n * d), - v=v, + q.view(b, s, n * d), + k.view(b, s, n * d), + v, heads=self.num_heads, ) From 9a66bb972d2200981e6be48f28973665ccab9844 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 25 Feb 2025 19:56:04 -0500 Subject: [PATCH 135/478] Make wan work with all latent resolutions. Cleanup some code. --- comfy/ldm/wan/model.py | 80 ++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 54 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index 151192975..4f2315ac0 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -9,6 +9,7 @@ from einops import repeat from comfy.ldm.modules.attention import optimized_attention from comfy.ldm.flux.layers import EmbedND from comfy.ldm.flux.math import apply_rope +import comfy.ldm.common_dit def sinusoidal_embedding_1d(dim, position): # preprocess @@ -67,12 +68,10 @@ class WanSelfAttention(nn.Module): self.norm_q = WanRMSNorm(dim, eps=eps, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() self.norm_k = WanRMSNorm(dim, eps=eps, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() - def forward(self, x, seq_lens, grid_sizes, freqs): + def forward(self, x, freqs): r""" Args: x(Tensor): Shape [B, L, num_heads, C / num_heads] - seq_lens(Tensor): Shape [B] - grid_sizes(Tensor): Shape [B, 3], the second dimension contains (F, H, W) freqs(Tensor): Rope freqs, shape [1024, C / num_heads / 2] """ b, s, n, d = *x.shape[:2], self.num_heads, self.head_dim @@ -100,12 +99,11 @@ class WanSelfAttention(nn.Module): class WanT2VCrossAttention(WanSelfAttention): - def forward(self, x, context, context_lens): + def forward(self, x, context): r""" Args: x(Tensor): Shape [B, L1, C] context(Tensor): Shape [B, L2, C] - context_lens(Tensor): Shape [B] """ # compute query, key, value q = self.norm_q(self.q(x)) @@ -134,12 +132,11 @@ class WanI2VCrossAttention(WanSelfAttention): # self.alpha = nn.Parameter(torch.zeros((1, ))) self.norm_k_img = WanRMSNorm(dim, eps=eps, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() - def forward(self, x, context, context_lens): + def forward(self, x, context): r""" Args: x(Tensor): Shape [B, L1, C] context(Tensor): Shape [B, L2, C] - context_lens(Tensor): Shape [B] """ context_img = context[:, :257] context = context[:, 257:] @@ -210,18 +207,13 @@ class WanAttentionBlock(nn.Module): self, x, e, - seq_lens, - grid_sizes, freqs, context, - context_lens, ): r""" Args: x(Tensor): Shape [B, L, C] e(Tensor): Shape [B, 6, C] - seq_lens(Tensor): Shape [B], length of each sequence in batch - grid_sizes(Tensor): Shape [B, 3], the second dimension contains (F, H, W) freqs(Tensor): Rope freqs, shape [1024, C / num_heads / 2] """ # assert e.dtype == torch.float32 @@ -231,19 +223,19 @@ class WanAttentionBlock(nn.Module): # self-attention y = self.self_attn( - self.norm1(x) * (1 + e[1]) + e[0], seq_lens, grid_sizes, + self.norm1(x) * (1 + e[1]) + e[0], freqs) x = x + y * e[2] # cross-attention & ffn function - def cross_attn_ffn(x, context, context_lens, e): - x = x + self.cross_attn(self.norm3(x), context, context_lens) + def cross_attn_ffn(x, context, e): + x = x + self.cross_attn(self.norm3(x), context) y = self.ffn(self.norm2(x) * (1 + e[4]) + e[3]) x = x + y * e[5] return x - x = cross_attn_ffn(x, context, context_lens, e) + x = cross_attn_ffn(x, context, e) return x @@ -408,7 +400,6 @@ class WanModel(torch.nn.Module): x, t, context, - seq_len=None, clip_fea=None, y=None, freqs=None, @@ -417,12 +408,12 @@ class WanModel(torch.nn.Module): Forward pass through the diffusion model Args: - x (List[Tensor]): - List of input video tensors, each with shape [C_in, F, H, W] + x (Tensor): + List of input video tensors with shape [B, C_in, F, H, W] t (Tensor): Diffusion timesteps tensor of shape [B] context (List[Tensor]): - List of text embeddings each with shape [L, C] + List of text embeddings each with shape [B, L, C] seq_len (`int`): Maximum sequence length for positional encoding clip_fea (Tensor, *optional*): @@ -438,22 +429,12 @@ class WanModel(torch.nn.Module): assert clip_fea is not None and y is not None if y is not None: - x = [torch.cat([u, v], dim=0) for u, v in zip(x, y)] + x = torch.cat([x, y], dim=0) # embeddings - x = [self.patch_embedding(u) for u in x] - grid_sizes = torch.stack( - [torch.tensor(u.shape[2:], dtype=torch.long) for u in x]) - x = [u.flatten(2).transpose(1, 2) for u in x] - seq_lens = torch.tensor([u.size(1) for u in x], dtype=torch.long) - if seq_len is not None: - assert seq_lens.max() <= seq_len - x = torch.cat([ - torch.cat([u, u.new_zeros(1, seq_len - u.size(1), u.size(2))], - dim=1) for u in x - ]) - elif len(x) == 1: - x = x[0] + x = self.patch_embedding(x) + grid_sizes = x.shape[2:] + x = x.flatten(2).transpose(1, 2) # time embeddings e = self.time_embedding( @@ -461,13 +442,7 @@ class WanModel(torch.nn.Module): e0 = self.time_projection(e).unflatten(1, (6, self.dim)) # context - context_lens = None - context = self.text_embedding( - torch.cat([ - torch.cat( - [u, u.new_zeros(u.size(0), self.text_len - u.size(1), u.size(2))], dim=1) - for u in context - ], dim=0)) + context = self.text_embedding(torch.cat([context, context.new_zeros(context.size(0), self.text_len - context.size(1), context.size(2))], dim=1)) if clip_fea is not None: context_clip = self.img_emb(clip_fea) # bs x 257 x dim @@ -476,11 +451,8 @@ class WanModel(torch.nn.Module): # arguments kwargs = dict( e=e0, - seq_lens=seq_lens, - grid_sizes=grid_sizes, freqs=freqs, - context=context, - context_lens=context_lens) + context=context) for block in self.blocks: x = block(x, **kwargs) @@ -495,6 +467,7 @@ class WanModel(torch.nn.Module): def forward(self, x, timestep, context, y=None, image=None, **kwargs): bs, c, t, h, w = x.shape + x = comfy.ldm.common_dit.pad_to_patch_size(x, self.patch_size) patch_size = self.patch_size t_len = ((t + (patch_size[0] // 2)) // patch_size[0]) h_len = ((h + (patch_size[1] // 2)) // patch_size[1]) @@ -506,7 +479,7 @@ class WanModel(torch.nn.Module): img_ids = repeat(img_ids, "t h w c -> b (t h w) c", b=bs) freqs = self.rope_embedder(img_ids).movedim(1, 2) - return self.forward_orig([x], timestep, [context], clip_fea=y, y=image, freqs=freqs)[0] + return self.forward_orig(x, timestep, context, clip_fea=y, y=image, freqs=freqs)[:, :, :t, :h, :w] def unpatchify(self, x, grid_sizes): r""" @@ -521,14 +494,13 @@ class WanModel(torch.nn.Module): Returns: List[Tensor]: - Reconstructed video tensors with shape [C_out, F, H / 8, W / 8] + Reconstructed video tensors with shape [L, C_out, F, H / 8, W / 8] """ c = self.out_dim - out = [] - for u, v in zip(x, grid_sizes.tolist()): - u = u[:math.prod(v)].view(*v, *self.patch_size, c) - u = torch.einsum('fhwpqrc->cfphqwr', u) - u = u.reshape(c, *[i * j for i, j in zip(v, self.patch_size)]) - out.append(u) - return out + u = x + b = u.shape[0] + u = u[:, :math.prod(grid_sizes)].view(b, *grid_sizes, *self.patch_size, c) + u = torch.einsum('bfhwpqrc->bcfphqwr', u) + u = u.reshape(b, c, *[i * j for i, j in zip(grid_sizes, self.patch_size)]) + return u From 189da3726d6e77a71d9bea04ddd420c1ceb7a327 Mon Sep 17 00:00:00 2001 From: Yoland Yan <4950057+yoland68@users.noreply.github.com> Date: Tue, 25 Feb 2025 17:17:18 -0800 Subject: [PATCH 136/478] Update README.md (#6960) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b51f7a067..9d9a6a41e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@
# ComfyUI -**The most powerful and modular diffusion model GUI and backend.** +**The most powerful and modular visual AI engine and application.** [![Website][website-shield]][website-url] From 0c32f822987ef2a3eb8f87f84b6b6d1f0b2f3832 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 25 Feb 2025 20:21:03 -0500 Subject: [PATCH 137/478] Fix missing frames in SaveWEBM node. --- comfy_extras/nodes_video.py | 1 + 1 file changed, 1 insertion(+) diff --git a/comfy_extras/nodes_video.py b/comfy_extras/nodes_video.py index f3922e03d..53920ba18 100644 --- a/comfy_extras/nodes_video.py +++ b/comfy_extras/nodes_video.py @@ -59,6 +59,7 @@ class SaveWEBM: frame = av.VideoFrame.from_ndarray(torch.clamp(frame[..., :3] * 255, min=0, max=255).to(device=torch.device("cpu"), dtype=torch.uint8).numpy(), format="rgb24") for packet in stream.encode(frame): container.mux(packet) + container.mux(stream.encode()) container.close() results = [{ From cb06e9669b1e0a232f674cf685ba1abbac59f3d9 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 25 Feb 2025 21:37:12 -0500 Subject: [PATCH 138/478] Wan seems to work with fp16. --- comfy/supported_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 64611f58d..d39a03f25 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -911,7 +911,7 @@ class WAN21_T2V(supported_models_base.BASE): memory_usage_factor = 1.0 - supported_inference_dtypes = [torch.bfloat16, torch.float32] + supported_inference_dtypes = [torch.bfloat16, torch.float16, torch.float32] vae_key_prefix = ["vae."] text_encoder_key_prefix = ["text_encoders."] From 4ced06b879a9b1f3a3f6b3fc6828cdb933c27e92 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Feb 2025 01:49:43 -0500 Subject: [PATCH 139/478] WIP support for Wan I2V model. --- comfy/ldm/wan/model.py | 20 +++++-------- comfy/model_base.py | 36 +++++++++++++++++++++-- comfy/model_detection.py | 1 + comfy/supported_models.py | 14 +++++++-- comfy_extras/nodes_wan.py | 61 +++++++++++++++++++++++++++++++++++++++ nodes.py | 1 + 6 files changed, 116 insertions(+), 17 deletions(-) create mode 100644 comfy_extras/nodes_wan.py diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index 4f2315ac0..6533039f7 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -10,6 +10,7 @@ from comfy.ldm.modules.attention import optimized_attention from comfy.ldm.flux.layers import EmbedND from comfy.ldm.flux.math import apply_rope import comfy.ldm.common_dit +import comfy.model_management def sinusoidal_embedding_1d(dim, position): # preprocess @@ -37,7 +38,7 @@ class WanRMSNorm(nn.Module): Args: x(Tensor): Shape [B, L, C] """ - return self._norm(x.float()).type_as(x) * self.weight + return self._norm(x.float()).type_as(x) * comfy.model_management.cast_to(self.weight, dtype=x.dtype, device=x.device) def _norm(self, x): return x * torch.rsqrt(x.pow(2).mean(dim=-1, keepdim=True) + self.eps) @@ -125,7 +126,7 @@ class WanI2VCrossAttention(WanSelfAttention): window_size=(-1, -1), qk_norm=True, eps=1e-6, operation_settings={}): - super().__init__(dim, num_heads, window_size, qk_norm, eps) + super().__init__(dim, num_heads, window_size, qk_norm, eps, operation_settings=operation_settings) self.k_img = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) self.v_img = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) @@ -218,7 +219,7 @@ class WanAttentionBlock(nn.Module): """ # assert e.dtype == torch.float32 - e = (self.modulation + e).chunk(6, dim=1) + e = (comfy.model_management.cast_to(self.modulation, dtype=x.dtype, device=x.device) + e).chunk(6, dim=1) # assert e[0].dtype == torch.float32 # self-attention @@ -263,7 +264,7 @@ class Head(nn.Module): e(Tensor): Shape [B, C] """ # assert e.dtype == torch.float32 - e = (self.modulation + e.unsqueeze(1)).chunk(2, dim=1) + e = (comfy.model_management.cast_to(self.modulation, dtype=x.dtype, device=x.device) + e.unsqueeze(1)).chunk(2, dim=1) x = (self.head(self.norm(x) * (1 + e[1]) + e[0])) return x @@ -401,7 +402,6 @@ class WanModel(torch.nn.Module): t, context, clip_fea=None, - y=None, freqs=None, ): r""" @@ -425,12 +425,6 @@ class WanModel(torch.nn.Module): List[Tensor]: List of denoised video tensors with original input shapes [C_out, F, H / 8, W / 8] """ - if self.model_type == 'i2v': - assert clip_fea is not None and y is not None - - if y is not None: - x = torch.cat([x, y], dim=0) - # embeddings x = self.patch_embedding(x) grid_sizes = x.shape[2:] @@ -465,7 +459,7 @@ class WanModel(torch.nn.Module): return x # return [u.float() for u in x] - def forward(self, x, timestep, context, y=None, image=None, **kwargs): + def forward(self, x, timestep, context, clip_fea=None, **kwargs): bs, c, t, h, w = x.shape x = comfy.ldm.common_dit.pad_to_patch_size(x, self.patch_size) patch_size = self.patch_size @@ -479,7 +473,7 @@ class WanModel(torch.nn.Module): img_ids = repeat(img_ids, "t h w c -> b (t h w) c", b=bs) freqs = self.rope_embedder(img_ids).movedim(1, 2) - return self.forward_orig(x, timestep, context, clip_fea=y, y=image, freqs=freqs)[:, :, :t, :h, :w] + return self.forward_orig(x, timestep, context, clip_fea=clip_fea, freqs=freqs)[:, :, :t, :h, :w] def unpatchify(self, x, grid_sizes): r""" diff --git a/comfy/model_base.py b/comfy/model_base.py index 76fd52c75..1885049e7 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -929,13 +929,45 @@ class Lumina2(BaseModel): out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) return out -class WAN21_T2V(BaseModel): - def __init__(self, model_config, model_type=ModelType.FLOW, device=None): +class WAN21(BaseModel): + def __init__(self, model_config, model_type=ModelType.FLOW, image_to_video=False, device=None): super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.wan.model.WanModel) + self.image_to_video = image_to_video + + def concat_cond(self, **kwargs): + if not self.image_to_video: + return None + + image = kwargs.get("concat_latent_image", None) + noise = kwargs.get("noise", None) + device = kwargs["device"] + + if image is None: + image = torch.zeros_like(noise) + + image = utils.common_upscale(image.to(device), noise.shape[-1], noise.shape[-2], "bilinear", "center") + image = self.process_latent_in(image) + image = utils.resize_to_batch_size(image, noise.shape[0]) + + mask = kwargs.get("concat_mask", kwargs.get("denoise_mask", None)) + if mask is None: + mask = torch.zeros_like(noise)[:, :4] + else: + mask = 1.0 - torch.mean(mask, dim=1, keepdim=True) + mask = utils.common_upscale(mask.to(device), noise.shape[-1], noise.shape[-2], "bilinear", "center") + if mask.shape[-3] < noise.shape[-3]: + mask = torch.nn.functional.pad(mask, (0, 0, 0, 0, 0, noise.shape[-3] - mask.shape[-3]), mode='constant', value=0) + mask = mask.view(mask.shape[0], -1, 4, mask.shape[-2], mask.shape[-1]).transpose(1, 2) + mask = utils.resize_to_batch_size(mask, noise.shape[0]) + return torch.cat((mask, image), dim=1) def extra_conds(self, **kwargs): out = super().extra_conds(**kwargs) cross_attn = kwargs.get("cross_attn", None) if cross_attn is not None: out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) + + clip_vision_output = kwargs.get("clip_vision_output", None) + if clip_vision_output is not None: + out['clip_fea'] = comfy.conds.CONDRegular(clip_vision_output.penultimate_hidden_states) return out diff --git a/comfy/model_detection.py b/comfy/model_detection.py index 3dbd9dada..f149a4bf7 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -313,6 +313,7 @@ def detect_unet_config(state_dict, key_prefix): dit_config["qk_norm"] = True dit_config["cross_attn_norm"] = True dit_config["eps"] = 1e-6 + dit_config["in_dim"] = state_dict['{}patch_embedding.weight'.format(key_prefix)].shape[1] if '{}img_emb.proj.0.bias'.format(key_prefix) in state_dict_keys: dit_config["model_type"] = "i2v" else: diff --git a/comfy/supported_models.py b/comfy/supported_models.py index d39a03f25..e28bd1382 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -917,7 +917,7 @@ class WAN21_T2V(supported_models_base.BASE): text_encoder_key_prefix = ["text_encoders."] def get_model(self, state_dict, prefix="", device=None): - out = model_base.WAN21_T2V(self, device=device) + out = model_base.WAN21(self, device=device) return out def clip_target(self, state_dict={}): @@ -925,6 +925,16 @@ class WAN21_T2V(supported_models_base.BASE): t5_detect = comfy.text_encoders.sd3_clip.t5_xxl_detect(state_dict, "{}umt5xxl.transformer.".format(pref)) return supported_models_base.ClipTarget(comfy.text_encoders.wan.WanT5Tokenizer, comfy.text_encoders.wan.te(**t5_detect)) -models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V] +class WAN21_I2V(WAN21_T2V): + unet_config = { + "image_model": "wan2.1", + "model_type": "i2v", + } + + def get_model(self, state_dict, prefix="", device=None): + out = model_base.WAN21(self, image_to_video=True, device=device) + return out + +models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V] models += [SVD_img2vid] diff --git a/comfy_extras/nodes_wan.py b/comfy_extras/nodes_wan.py new file mode 100644 index 000000000..52851d1f9 --- /dev/null +++ b/comfy_extras/nodes_wan.py @@ -0,0 +1,61 @@ +import nodes +import node_helpers +import torch +import comfy.model_management +import comfy.utils + + +def masked_images(num_images): + rem = 4 - (num_images % 4) + if rem == 4: + return num_images + return rem + num_images + + +class WanImageToVideo: + @classmethod + def INPUT_TYPES(s): + return {"required": {"positive": ("CONDITIONING", ), + "negative": ("CONDITIONING", ), + "vae": ("VAE", ), + "width": ("INT", {"default": 1280, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "height": ("INT", {"default": 720, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "length": ("INT", {"default": 121, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}), + "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), + }, + "optional": {"clip_vision_output": ("CLIP_VISION_OUTPUT", ), + "start_image": ("IMAGE", ), + }} + + RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT") + RETURN_NAMES = ("positive", "negative", "latent") + FUNCTION = "encode" + + CATEGORY = "conditioning/video_models" + + def encode(self, positive, negative, vae, width, height, length, batch_size, start_image=None, clip_vision_output=None): + latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) + if start_image is not None: + start_image = comfy.utils.common_upscale(start_image[:length].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + image = torch.ones((length, height, width, start_image.shape[-1]), device=start_image.device, dtype=start_image.dtype) * 0.5 + image[:start_image.shape[0]] = start_image + + concat_latent_image = vae.encode(image[:, :, :, :3]) + mask = torch.ones((1, 1, latent.shape[2] * 4, concat_latent_image.shape[-2], concat_latent_image.shape[-1]), device=start_image.device, dtype=start_image.dtype) + mask[:, :, :masked_images(start_image.shape[0])] = 0.0 + + positive = node_helpers.conditioning_set_values(positive, {"concat_latent_image": concat_latent_image, "concat_mask": mask}) + negative = node_helpers.conditioning_set_values(negative, {"concat_latent_image": concat_latent_image, "concat_mask": mask}) + + if clip_vision_output is not None: + positive = node_helpers.conditioning_set_values(positive, {"clip_vision_output": clip_vision_output}) + negative = node_helpers.conditioning_set_values(negative, {"clip_vision_output": clip_vision_output}) + + out_latent = {} + out_latent["samples"] = latent + return (positive, negative, out_latent) + + +NODE_CLASS_MAPPINGS = { + "WanImageToVideo": WanImageToVideo, +} diff --git a/nodes.py b/nodes.py index a93254106..f7f6cb156 100644 --- a/nodes.py +++ b/nodes.py @@ -2269,6 +2269,7 @@ def init_builtin_extra_nodes(): "nodes_cosmos.py", "nodes_video.py", "nodes_lumina2.py", + "nodes_wan.py", ] import_failed = [] From 0844998db3d72f4edc46c91dcc6fbaaf480ea1b7 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Feb 2025 03:49:50 -0500 Subject: [PATCH 140/478] Slightly better wan i2v mask implementation. --- comfy/model_base.py | 3 ++- comfy_extras/nodes_wan.py | 11 ++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index 1885049e7..66cd0ded1 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -957,8 +957,9 @@ class WAN21(BaseModel): mask = utils.common_upscale(mask.to(device), noise.shape[-1], noise.shape[-2], "bilinear", "center") if mask.shape[-3] < noise.shape[-3]: mask = torch.nn.functional.pad(mask, (0, 0, 0, 0, 0, noise.shape[-3] - mask.shape[-3]), mode='constant', value=0) - mask = mask.view(mask.shape[0], -1, 4, mask.shape[-2], mask.shape[-1]).transpose(1, 2) + mask = mask.repeat(1, 4, 1, 1, 1) mask = utils.resize_to_batch_size(mask, noise.shape[0]) + return torch.cat((mask, image), dim=1) def extra_conds(self, **kwargs): diff --git a/comfy_extras/nodes_wan.py b/comfy_extras/nodes_wan.py index 52851d1f9..f3a8ec660 100644 --- a/comfy_extras/nodes_wan.py +++ b/comfy_extras/nodes_wan.py @@ -5,13 +5,6 @@ import comfy.model_management import comfy.utils -def masked_images(num_images): - rem = 4 - (num_images % 4) - if rem == 4: - return num_images - return rem + num_images - - class WanImageToVideo: @classmethod def INPUT_TYPES(s): @@ -41,8 +34,8 @@ class WanImageToVideo: image[:start_image.shape[0]] = start_image concat_latent_image = vae.encode(image[:, :, :, :3]) - mask = torch.ones((1, 1, latent.shape[2] * 4, concat_latent_image.shape[-2], concat_latent_image.shape[-1]), device=start_image.device, dtype=start_image.dtype) - mask[:, :, :masked_images(start_image.shape[0])] = 0.0 + mask = torch.ones((1, 1, latent.shape[2], concat_latent_image.shape[-2], concat_latent_image.shape[-1]), device=start_image.device, dtype=start_image.dtype) + mask[:, :, :((start_image.shape[0] - 1) // 4) + 1] = 0.0 positive = node_helpers.conditioning_set_values(positive, {"concat_latent_image": concat_latent_image, "concat_mask": mask}) negative = node_helpers.conditioning_set_values(negative, {"concat_latent_image": concat_latent_image, "concat_mask": mask}) From fa62287f1f47f6ed30de077d5623bf07b805f7a0 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Feb 2025 05:22:29 -0500 Subject: [PATCH 141/478] More code reuse in wan. Fix bug when changing the compute dtype on wan. --- comfy/ldm/wan/model.py | 27 +++++---------------------- comfy/model_patcher.py | 2 +- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index 6533039f7..e88a1834b 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -9,9 +9,11 @@ from einops import repeat from comfy.ldm.modules.attention import optimized_attention from comfy.ldm.flux.layers import EmbedND from comfy.ldm.flux.math import apply_rope +from comfy.ldm.modules.diffusionmodules.mmdit import RMSNorm import comfy.ldm.common_dit import comfy.model_management + def sinusoidal_embedding_1d(dim, position): # preprocess assert dim % 2 == 0 @@ -25,25 +27,6 @@ def sinusoidal_embedding_1d(dim, position): return x -class WanRMSNorm(nn.Module): - - def __init__(self, dim, eps=1e-5, device=None, dtype=None): - super().__init__() - self.dim = dim - self.eps = eps - self.weight = nn.Parameter(torch.ones(dim, device=device, dtype=dtype)) - - def forward(self, x): - r""" - Args: - x(Tensor): Shape [B, L, C] - """ - return self._norm(x.float()).type_as(x) * comfy.model_management.cast_to(self.weight, dtype=x.dtype, device=x.device) - - def _norm(self, x): - return x * torch.rsqrt(x.pow(2).mean(dim=-1, keepdim=True) + self.eps) - - class WanSelfAttention(nn.Module): def __init__(self, @@ -66,8 +49,8 @@ class WanSelfAttention(nn.Module): self.k = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) self.v = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) self.o = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) - self.norm_q = WanRMSNorm(dim, eps=eps, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() - self.norm_k = WanRMSNorm(dim, eps=eps, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() + self.norm_q = RMSNorm(dim, eps=eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() + self.norm_k = RMSNorm(dim, eps=eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() def forward(self, x, freqs): r""" @@ -131,7 +114,7 @@ class WanI2VCrossAttention(WanSelfAttention): self.k_img = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) self.v_img = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) # self.alpha = nn.Parameter(torch.zeros((1, ))) - self.norm_k_img = WanRMSNorm(dim, eps=eps, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() + self.norm_k_img = RMSNorm(dim, eps=eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() def forward(self, x, context): r""" diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py index 4dbe1b7aa..8a1f8fb63 100644 --- a/comfy/model_patcher.py +++ b/comfy/model_patcher.py @@ -639,7 +639,7 @@ class ModelPatcher: mem_counter += module_mem load_completely.append((module_mem, n, m, params)) - if cast_weight: + if cast_weight and hasattr(m, "comfy_cast_weights"): m.prev_comfy_cast_weights = m.comfy_cast_weights m.comfy_cast_weights = True From b6fefe686beba2e550e8556bb86113a5ddef9318 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Feb 2025 07:51:22 -0500 Subject: [PATCH 142/478] Better wan memory estimation. --- comfy/supported_models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index e28bd1382..a8212c1fa 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -916,6 +916,10 @@ class WAN21_T2V(supported_models_base.BASE): vae_key_prefix = ["vae."] text_encoder_key_prefix = ["text_encoders."] + def __init__(self, unet_config): + super().__init__(unet_config) + self.memory_usage_factor = self.unet_config.get("dim", 2000) / 2000 + def get_model(self, state_dict, prefix="", device=None): out = model_base.WAN21(self, device=device) return out From 4bca7367f324b2214de1ccb1c002fd29521edaa7 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Feb 2025 08:38:09 -0500 Subject: [PATCH 143/478] Don't try to use clip_fea on t2v model. --- comfy/ldm/wan/model.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index e88a1834b..c67a65b24 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -378,6 +378,8 @@ class WanModel(torch.nn.Module): if model_type == 'i2v': self.img_emb = MLPProj(1280, dim, operation_settings=operation_settings) + else: + self.img_emb = None def forward_orig( self, @@ -421,7 +423,7 @@ class WanModel(torch.nn.Module): # context context = self.text_embedding(torch.cat([context, context.new_zeros(context.size(0), self.text_len - context.size(1), context.size(2))], dim=1)) - if clip_fea is not None: + if clip_fea is not None and self.img_emb is not None: context_clip = self.img_emb(clip_fea) # bs x 257 x dim context = torch.concat([context_clip, context], dim=1) From c37f15f98ef152fbd9e95fe49311019503145d6b Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Feb 2025 08:56:23 -0500 Subject: [PATCH 144/478] Add fast preview support for Wan models. --- comfy/latent_formats.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/comfy/latent_formats.py b/comfy/latent_formats.py index 8299ecd1b..622c1df54 100644 --- a/comfy/latent_formats.py +++ b/comfy/latent_formats.py @@ -412,6 +412,27 @@ class Wan21(LatentFormat): latent_channels = 16 latent_dimensions = 3 + latent_rgb_factors = [ + [-0.1299, -0.1692, 0.2932], + [ 0.0671, 0.0406, 0.0442], + [ 0.3568, 0.2548, 0.1747], + [ 0.0372, 0.2344, 0.1420], + [ 0.0313, 0.0189, -0.0328], + [ 0.0296, -0.0956, -0.0665], + [-0.3477, -0.4059, -0.2925], + [ 0.0166, 0.1902, 0.1975], + [-0.0412, 0.0267, -0.1364], + [-0.1293, 0.0740, 0.1636], + [ 0.0680, 0.3019, 0.1128], + [ 0.0032, 0.0581, 0.0639], + [-0.1251, 0.0927, 0.1699], + [ 0.0060, -0.0633, 0.0005], + [ 0.3477, 0.2275, 0.2950], + [ 0.1984, 0.0913, 0.1861] + ] + + latent_rgb_factors_bias = [-0.1835, -0.0868, -0.3360] + def __init__(self): self.scale_factor = 1.0 self.latents_mean = torch.tensor([ From 26c7baf78979c3923f090f35a1177a1eae71224d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Feb 2025 14:30:32 -0500 Subject: [PATCH 145/478] Bump ComfyUI version to v0.3.16 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index fc7bb1df8..9856bcaa5 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.15" +__version__ = "0.3.16" diff --git a/pyproject.toml b/pyproject.toml index 877ae4d70..900354f6f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.15" +version = "0.3.16" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 0270a0b41cef69726694b189f37942a04d762c8a Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Feb 2025 16:59:26 -0500 Subject: [PATCH 146/478] Reduce artifacts on Wan by doing the patch embedding in fp32. --- comfy/ldm/wan/model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index c67a65b24..dbe84b8bb 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -18,7 +18,7 @@ def sinusoidal_embedding_1d(dim, position): # preprocess assert dim % 2 == 0 half = dim // 2 - position = position.type(torch.float64) + position = position.type(torch.float32) # calculation sinusoid = torch.outer( @@ -353,7 +353,7 @@ class WanModel(torch.nn.Module): # embeddings self.patch_embedding = operations.Conv3d( - in_dim, dim, kernel_size=patch_size, stride=patch_size, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + in_dim, dim, kernel_size=patch_size, stride=patch_size, device=operation_settings.get("device"), dtype=torch.float32) self.text_embedding = nn.Sequential( operations.Linear(text_dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")), nn.GELU(approximate='tanh'), operations.Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype"))) @@ -411,7 +411,7 @@ class WanModel(torch.nn.Module): List of denoised video tensors with original input shapes [C_out, F, H / 8, W / 8] """ # embeddings - x = self.patch_embedding(x) + x = self.patch_embedding(x.float()).to(x.dtype) grid_sizes = x.shape[2:] x = x.flatten(2).transpose(1, 2) From 8e69e2ddfda965267e1c90ab1cc89d95541155b1 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Feb 2025 17:59:10 -0500 Subject: [PATCH 147/478] Bump ComfyUI version to v0.3.17 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 9856bcaa5..2c00ff181 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.16" +__version__ = "0.3.17" diff --git a/pyproject.toml b/pyproject.toml index 900354f6f..d119e9834 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.16" +version = "0.3.17" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 3ea3bc85462f3e41ddffb0db61ce256eec14c50b Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Feb 2025 20:34:02 -0500 Subject: [PATCH 148/478] Fix wan issues when prompt length is long. --- comfy/ldm/wan/model.py | 2 +- comfy/text_encoders/wan.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index dbe84b8bb..5471763bb 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -421,7 +421,7 @@ class WanModel(torch.nn.Module): e0 = self.time_projection(e).unflatten(1, (6, self.dim)) # context - context = self.text_embedding(torch.cat([context, context.new_zeros(context.size(0), self.text_len - context.size(1), context.size(2))], dim=1)) + context = self.text_embedding(context) if clip_fea is not None and self.img_emb is not None: context_clip = self.img_emb(clip_fea) # bs x 257 x dim diff --git a/comfy/text_encoders/wan.py b/comfy/text_encoders/wan.py index d98c9ad28..971ac8fa8 100644 --- a/comfy/text_encoders/wan.py +++ b/comfy/text_encoders/wan.py @@ -11,7 +11,7 @@ class UMT5XXlModel(sd1_clip.SDClipModel): class UMT5XXlTokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): tokenizer = tokenizer_data.get("spiece_model", None) - super().__init__(tokenizer, pad_with_end=False, embedding_size=4096, embedding_key='umt5xxl', tokenizer_class=SPieceTokenizer, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=1, pad_token=0) + super().__init__(tokenizer, pad_with_end=False, embedding_size=4096, embedding_key='umt5xxl', tokenizer_class=SPieceTokenizer, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=512, pad_token=0) def state_dict(self): return {"spiece_model": self.tokenizer.serialize_model()} From 89253e9fe5bef0a93cc3b8d6e43542f0a5eae697 Mon Sep 17 00:00:00 2001 From: BiologicalExplosion <49753622+BiologicalExplosion@users.noreply.github.com> Date: Thu, 27 Feb 2025 09:45:13 +0800 Subject: [PATCH 149/478] Support Cambricon MLU (#6964) Co-authored-by: huzhan --- README.md | 7 +++++++ comfy/model_management.py | 44 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d9a6a41e..ae6092fd0 100644 --- a/README.md +++ b/README.md @@ -260,6 +260,13 @@ For models compatible with Ascend Extension for PyTorch (torch_npu). To get star 3. Next, install the necessary packages for torch-npu by adhering to the platform-specific instructions on the [Installation](https://ascend.github.io/docs/sources/pytorch/install.html#pytorch) page. 4. Finally, adhere to the [ComfyUI manual installation](#manual-install-windows-linux) guide for Linux. Once all components are installed, you can run ComfyUI as described earlier. +#### Cambricon MLUs + +For models compatible with Cambricon Extension for PyTorch (torch_mlu). Here's a step-by-step guide tailored to your platform and installation method: + +1. Install the Cambricon CNToolkit by adhering to the platform-specific instructions on the [Installation](https://www.cambricon.com/docs/sdk_1.15.0/cntoolkit_3.7.2/cntoolkit_install_3.7.2/index.html) +2. Next, install the PyTorch(torch_mlu) following the instructions on the [Installation](https://www.cambricon.com/docs/sdk_1.15.0/cambricon_pytorch_1.17.0/user_guide_1.9/index.html) +3. Launch ComfyUI by running `python main.py --listen` # Running diff --git a/comfy/model_management.py b/comfy/model_management.py index 1e6599be2..49eaf7948 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -95,6 +95,13 @@ try: except: npu_available = False +try: + import torch_mlu # noqa: F401 + _ = torch.mlu.device_count() + mlu_available = torch.mlu.is_available() +except: + mlu_available = False + if args.cpu: cpu_state = CPUState.CPU @@ -112,6 +119,12 @@ def is_ascend_npu(): return True return False +def is_mlu(): + global mlu_available + if mlu_available: + return True + return False + def get_torch_device(): global directml_enabled global cpu_state @@ -127,6 +140,8 @@ def get_torch_device(): return torch.device("xpu", torch.xpu.current_device()) elif is_ascend_npu(): return torch.device("npu", torch.npu.current_device()) + elif is_mlu(): + return torch.device("mlu", torch.mlu.current_device()) else: return torch.device(torch.cuda.current_device()) @@ -153,6 +168,12 @@ def get_total_memory(dev=None, torch_total_too=False): _, mem_total_npu = torch.npu.mem_get_info(dev) mem_total_torch = mem_reserved mem_total = mem_total_npu + elif is_mlu(): + stats = torch.mlu.memory_stats(dev) + mem_reserved = stats['reserved_bytes.all.current'] + _, mem_total_mlu = torch.mlu.mem_get_info(dev) + mem_total_torch = mem_reserved + mem_total = mem_total_mlu else: stats = torch.cuda.memory_stats(dev) mem_reserved = stats['reserved_bytes.all.current'] @@ -232,7 +253,7 @@ try: if torch_version_numeric[0] >= 2: if ENABLE_PYTORCH_ATTENTION == False and args.use_split_cross_attention == False and args.use_quad_cross_attention == False: ENABLE_PYTORCH_ATTENTION = True - if is_intel_xpu() or is_ascend_npu(): + if is_intel_xpu() or is_ascend_npu() or is_mlu(): if args.use_split_cross_attention == False and args.use_quad_cross_attention == False: ENABLE_PYTORCH_ATTENTION = True except: @@ -316,6 +337,8 @@ def get_torch_device_name(device): return "{} {}".format(device, torch.xpu.get_device_name(device)) elif is_ascend_npu(): return "{} {}".format(device, torch.npu.get_device_name(device)) + elif is_mlu(): + return "{} {}".format(device, torch.mlu.get_device_name(device)) else: return "CUDA {}: {}".format(device, torch.cuda.get_device_name(device)) @@ -905,6 +928,8 @@ def xformers_enabled(): return False if is_ascend_npu(): return False + if is_mlu(): + return False if directml_enabled: return False return XFORMERS_IS_AVAILABLE @@ -936,6 +961,8 @@ def pytorch_attention_flash_attention(): return True if is_ascend_npu(): return True + if is_mlu(): + return True if is_amd(): return True #if you have pytorch attention enabled on AMD it probably supports at least mem efficient attention return False @@ -984,6 +1011,13 @@ def get_free_memory(dev=None, torch_free_too=False): mem_free_npu, _ = torch.npu.mem_get_info(dev) mem_free_torch = mem_reserved - mem_active mem_free_total = mem_free_npu + mem_free_torch + elif is_mlu(): + stats = torch.mlu.memory_stats(dev) + mem_active = stats['active_bytes.all.current'] + mem_reserved = stats['reserved_bytes.all.current'] + mem_free_mlu, _ = torch.mlu.mem_get_info(dev) + mem_free_torch = mem_reserved - mem_active + mem_free_total = mem_free_mlu + mem_free_torch else: stats = torch.cuda.memory_stats(dev) mem_active = stats['active_bytes.all.current'] @@ -1053,6 +1087,9 @@ def should_use_fp16(device=None, model_params=0, prioritize_performance=True, ma if is_ascend_npu(): return True + if is_mlu(): + return True + if torch.version.hip: return True @@ -1121,6 +1158,11 @@ def should_use_bf16(device=None, model_params=0, prioritize_performance=True, ma return False props = torch.cuda.get_device_properties(device) + + if is_mlu(): + if props.major > 3: + return True + if props.major >= 8: return True From 92d8d153000cab2eae4eab4ef7314abb2ddbf9f1 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Feb 2025 20:47:08 -0500 Subject: [PATCH 150/478] Readme changes. Instructions shouldn't recommend to run comfyui with --listen --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ae6092fd0..5d3ba0496 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ ComfyUI lets you design and execute advanced stable diffusion pipelines using a #### [Manual Install](#manual-install-windows-linux) Supports all operating systems and GPU types (NVIDIA, AMD, Intel, Apple Silicon, Ascend). -## Examples +## [Examples](https://comfyanonymous.github.io/ComfyUI_examples/) See what ComfyUI can do with the [example workflows](https://comfyanonymous.github.io/ComfyUI_examples/). @@ -266,7 +266,7 @@ For models compatible with Cambricon Extension for PyTorch (torch_mlu). Here's a 1. Install the Cambricon CNToolkit by adhering to the platform-specific instructions on the [Installation](https://www.cambricon.com/docs/sdk_1.15.0/cntoolkit_3.7.2/cntoolkit_install_3.7.2/index.html) 2. Next, install the PyTorch(torch_mlu) following the instructions on the [Installation](https://www.cambricon.com/docs/sdk_1.15.0/cambricon_pytorch_1.17.0/user_guide_1.9/index.html) -3. Launch ComfyUI by running `python main.py --listen` +3. Launch ComfyUI by running `python main.py` # Running From 714f728820858836b3249a465443f3e2317c2ca2 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Feb 2025 20:48:50 -0500 Subject: [PATCH 151/478] Add to README that the Wan model is supported. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5d3ba0496..9190dd493 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ See what ComfyUI can do with the [example workflows](https://comfyanonymous.gith - [LTX-Video](https://comfyanonymous.github.io/ComfyUI_examples/ltxv/) - [Hunyuan Video](https://comfyanonymous.github.io/ComfyUI_examples/hunyuan_video/) - [Nvidia Cosmos](https://comfyanonymous.github.io/ComfyUI_examples/cosmos/) + - [Wan 2.1](https://comfyanonymous.github.io/ComfyUI_examples/wan/) - [Stable Audio](https://comfyanonymous.github.io/ComfyUI_examples/audio/) - Asynchronous Queue system - Many optimizations: Only re-executes the parts of the workflow that changes between executions. From b07f116dea4e00b42df3fbbe045f4c8c76c9d97b Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Feb 2025 21:19:14 -0500 Subject: [PATCH 152/478] Bump ComfyUI version to v0.3.18 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 2c00ff181..9d69edfc1 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.17" +__version__ = "0.3.18" diff --git a/pyproject.toml b/pyproject.toml index d119e9834..be52c6028 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.17" +version = "0.3.18" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From f4dac8ab6f68ac3918ca83b9a3d19131eab0b851 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 27 Feb 2025 07:22:42 -0500 Subject: [PATCH 153/478] Wan code small cleanup. --- comfy/ldm/wan/model.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index 5471763bb..e78d846b2 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -212,14 +212,10 @@ class WanAttentionBlock(nn.Module): x = x + y * e[2] - # cross-attention & ffn function - def cross_attn_ffn(x, context, e): - x = x + self.cross_attn(self.norm3(x), context) - y = self.ffn(self.norm2(x) * (1 + e[4]) + e[3]) - x = x + y * e[5] - return x - - x = cross_attn_ffn(x, context, e) + # cross-attention & ffn + x = x + self.cross_attn(self.norm3(x), context) + y = self.ffn(self.norm2(x) * (1 + e[4]) + e[3]) + x = x + y * e[5] return x @@ -442,7 +438,6 @@ class WanModel(torch.nn.Module): # unpatchify x = self.unpatchify(x, grid_sizes) return x - # return [u.float() for u in x] def forward(self, x, timestep, context, clip_fea=None, **kwargs): bs, c, t, h, w = x.shape From 180439795282612e2873c345c39d661ff622f229 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 27 Feb 2025 16:39:57 -0500 Subject: [PATCH 154/478] Use fp16 if checkpoint weights are fp16 and the model supports it. --- comfy/controlnet.py | 10 ++-------- comfy/model_management.py | 10 ++++------ comfy/sd.py | 12 ++++++------ 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/comfy/controlnet.py b/comfy/controlnet.py index ee29251b9..ceb24c852 100644 --- a/comfy/controlnet.py +++ b/comfy/controlnet.py @@ -418,10 +418,7 @@ def controlnet_config(sd, model_options={}): weight_dtype = comfy.utils.weight_dtype(sd) supported_inference_dtypes = list(model_config.supported_inference_dtypes) - if weight_dtype is not None: - supported_inference_dtypes.append(weight_dtype) - - unet_dtype = comfy.model_management.unet_dtype(model_params=-1, supported_dtypes=supported_inference_dtypes) + unet_dtype = comfy.model_management.unet_dtype(model_params=-1, supported_dtypes=supported_inference_dtypes, weight_dtype=weight_dtype) load_device = comfy.model_management.get_torch_device() manual_cast_dtype = comfy.model_management.unet_manual_cast(unet_dtype, load_device) @@ -689,10 +686,7 @@ def load_controlnet_state_dict(state_dict, model=None, model_options={}): if supported_inference_dtypes is None: supported_inference_dtypes = [comfy.model_management.unet_dtype()] - if weight_dtype is not None: - supported_inference_dtypes.append(weight_dtype) - - unet_dtype = comfy.model_management.unet_dtype(model_params=-1, supported_dtypes=supported_inference_dtypes) + unet_dtype = comfy.model_management.unet_dtype(model_params=-1, supported_dtypes=supported_inference_dtypes, weight_dtype=weight_dtype) load_device = comfy.model_management.get_torch_device() diff --git a/comfy/model_management.py b/comfy/model_management.py index 49eaf7948..987b45e41 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -674,7 +674,7 @@ def unet_inital_load_device(parameters, dtype): def maximum_vram_for_weights(device=None): return (get_total_memory(device) * 0.88 - minimum_inference_memory()) -def unet_dtype(device=None, model_params=0, supported_dtypes=[torch.float16, torch.bfloat16, torch.float32]): +def unet_dtype(device=None, model_params=0, supported_dtypes=[torch.float16, torch.bfloat16, torch.float32], weight_dtype=None): if model_params < 0: model_params = 1000000000000000000000 if args.fp32_unet: @@ -692,10 +692,8 @@ def unet_dtype(device=None, model_params=0, supported_dtypes=[torch.float16, tor fp8_dtype = None try: - for dtype in [torch.float8_e4m3fn, torch.float8_e5m2]: - if dtype in supported_dtypes: - fp8_dtype = dtype - break + if weight_dtype in [torch.float8_e4m3fn, torch.float8_e5m2]: + fp8_dtype = weight_dtype except: pass @@ -707,7 +705,7 @@ def unet_dtype(device=None, model_params=0, supported_dtypes=[torch.float16, tor if model_params * 2 > free_model_memory: return fp8_dtype - if PRIORITIZE_FP16: + if PRIORITIZE_FP16 or weight_dtype == torch.float16: if torch.float16 in supported_dtypes and should_use_fp16(device=device, model_params=model_params): return torch.float16 diff --git a/comfy/sd.py b/comfy/sd.py index 640253b09..21913cf3e 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -896,14 +896,14 @@ def load_state_dict_guess_config(sd, output_vae=True, output_clip=True, output_c return None unet_weight_dtype = list(model_config.supported_inference_dtypes) - if weight_dtype is not None and model_config.scaled_fp8 is None: - unet_weight_dtype.append(weight_dtype) + if model_config.scaled_fp8 is not None: + weight_dtype = None model_config.custom_operations = model_options.get("custom_operations", None) unet_dtype = model_options.get("dtype", model_options.get("weight_dtype", None)) if unet_dtype is None: - unet_dtype = model_management.unet_dtype(model_params=parameters, supported_dtypes=unet_weight_dtype) + unet_dtype = model_management.unet_dtype(model_params=parameters, supported_dtypes=unet_weight_dtype, weight_dtype=weight_dtype) manual_cast_dtype = model_management.unet_manual_cast(unet_dtype, load_device, model_config.supported_inference_dtypes) model_config.set_inference_dtype(unet_dtype, manual_cast_dtype) @@ -994,11 +994,11 @@ def load_diffusion_model_state_dict(sd, model_options={}): #load unet in diffuse offload_device = model_management.unet_offload_device() unet_weight_dtype = list(model_config.supported_inference_dtypes) - if weight_dtype is not None and model_config.scaled_fp8 is None: - unet_weight_dtype.append(weight_dtype) + if model_config.scaled_fp8 is not None: + weight_dtype = None if dtype is None: - unet_dtype = model_management.unet_dtype(model_params=parameters, supported_dtypes=unet_weight_dtype) + unet_dtype = model_management.unet_dtype(model_params=parameters, supported_dtypes=unet_weight_dtype, weight_dtype=weight_dtype) else: unet_dtype = dtype From eb4543474b6a3f48125900b262a098f0a4bd6609 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 28 Feb 2025 02:17:50 -0500 Subject: [PATCH 155/478] Use fp16 for intermediate for fp8 weights with --fast if supported. --- comfy/model_management.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/comfy/model_management.py b/comfy/model_management.py index 987b45e41..afbb133d4 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -741,6 +741,9 @@ def unet_manual_cast(weight_dtype, inference_device, supported_dtypes=[torch.flo return None fp16_supported = should_use_fp16(inference_device, prioritize_performance=True) + if PRIORITIZE_FP16 and fp16_supported and torch.float16 in supported_dtypes: + return torch.float16 + for dt in supported_dtypes: if dt == torch.float16 and fp16_supported: return torch.float16 From cf0b549d4828b6b9f6d98277c36784ab3c79ff6d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 28 Feb 2025 02:48:20 -0500 Subject: [PATCH 156/478] --fast now takes a number as argument to indicate how fast you want it. The idea is that you can indicate how much quality vs speed you want. At the moment: --fast 2 enables fp16 accumulation if your pytorch supports it. --fast 5 enables fp8 matrix mult on fp8 models and the optimization above. --fast without a number enables all optimizations. --- comfy/cli_args.py | 2 +- comfy/model_management.py | 3 ++- comfy/ops.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index a906ff1c0..10c142e67 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -130,7 +130,7 @@ parser.add_argument("--default-hashing-function", type=str, choices=['md5', 'sha parser.add_argument("--disable-smart-memory", action="store_true", help="Force ComfyUI to agressively offload to regular ram instead of keeping models in vram when it can.") parser.add_argument("--deterministic", action="store_true", help="Make pytorch use slower deterministic algorithms when it can. Note that this might not make images deterministic in all cases.") -parser.add_argument("--fast", action="store_true", help="Enable some untested and potentially quality deteriorating optimizations.") +parser.add_argument("--fast", metavar="number", type=int, const=99, default=0, nargs="?", help="Enable some untested and potentially quality deteriorating optimizations. You can pass a number from 0 to 10 for a bigger speed vs quality tradeoff. Using --fast with no number means maximum speed. 2 or larger enables fp16 accumulation, 5 or larger enables fp8 matrix multiplication.") parser.add_argument("--dont-print-server", action="store_true", help="Don't print server output.") parser.add_argument("--quick-test-for-ci", action="store_true", help="Quick test for CI.") diff --git a/comfy/model_management.py b/comfy/model_management.py index afbb133d4..5eb2e5ad6 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -280,9 +280,10 @@ if ENABLE_PYTORCH_ATTENTION: PRIORITIZE_FP16 = False # TODO: remove and replace with something that shows exactly which dtype is faster than the other try: - if is_nvidia() and args.fast: + if is_nvidia() and args.fast >= 2: torch.backends.cuda.matmul.allow_fp16_accumulation = True PRIORITIZE_FP16 = True # TODO: limit to cards where it actually boosts performance + logging.info("Enabled fp16 accumulation.") except: pass diff --git a/comfy/ops.py b/comfy/ops.py index 30014477e..905ea90f6 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -360,7 +360,7 @@ def pick_operations(weight_dtype, compute_dtype, load_device=None, disable_fast_ if scaled_fp8 is not None: return scaled_fp8_ops(fp8_matrix_mult=fp8_compute, scale_input=True, override_dtype=scaled_fp8) - if fp8_compute and (fp8_optimizations or args.fast) and not disable_fast_fp8: + if fp8_compute and (fp8_optimizations or args.fast >= 5) and not disable_fast_fp8: return fp8_ops if compute_dtype is None or weight_dtype == compute_dtype: From 4d55f16ae87221cdb03a2c21d0220ed35f62fbec Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Sat, 1 Mar 2025 02:37:35 -0500 Subject: [PATCH 157/478] Use enum list for --fast options (#7024) --- comfy/cli_args.py | 18 +++++++++++++++++- comfy/model_management.py | 4 ++-- comfy/ops.py | 8 ++++++-- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 10c142e67..6aee14b3e 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -130,7 +130,12 @@ parser.add_argument("--default-hashing-function", type=str, choices=['md5', 'sha parser.add_argument("--disable-smart-memory", action="store_true", help="Force ComfyUI to agressively offload to regular ram instead of keeping models in vram when it can.") parser.add_argument("--deterministic", action="store_true", help="Make pytorch use slower deterministic algorithms when it can. Note that this might not make images deterministic in all cases.") -parser.add_argument("--fast", metavar="number", type=int, const=99, default=0, nargs="?", help="Enable some untested and potentially quality deteriorating optimizations. You can pass a number from 0 to 10 for a bigger speed vs quality tradeoff. Using --fast with no number means maximum speed. 2 or larger enables fp16 accumulation, 5 or larger enables fp8 matrix multiplication.") + +class PerformanceFeature(enum.Enum): + Fp16Accumulation = "fp16_accumulation" + Fp8Optimization = "fp8_optimization" + +parser.add_argument("--fast", nargs="*", type=PerformanceFeature, help="Enable some untested and potentially quality deteriorating optimizations.") parser.add_argument("--dont-print-server", action="store_true", help="Don't print server output.") parser.add_argument("--quick-test-for-ci", action="store_true", help="Quick test for CI.") @@ -194,3 +199,14 @@ if args.disable_auto_launch: if args.force_fp16: args.fp16_unet = True + + +# '--fast' is not provided, use an empty set +if args.fast is None: + args.fast = set() +# '--fast' is provided with an empty list, enable all optimizations +elif args.fast == []: + args.fast = set(PerformanceFeature) +# '--fast' is provided with a list of performance features, use that list +else: + args.fast = set(args.fast) diff --git a/comfy/model_management.py b/comfy/model_management.py index 5eb2e5ad6..bc90e3dff 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -19,7 +19,7 @@ import psutil import logging from enum import Enum -from comfy.cli_args import args +from comfy.cli_args import args, PerformanceFeature import torch import sys import platform @@ -280,7 +280,7 @@ if ENABLE_PYTORCH_ATTENTION: PRIORITIZE_FP16 = False # TODO: remove and replace with something that shows exactly which dtype is faster than the other try: - if is_nvidia() and args.fast >= 2: + if is_nvidia() and PerformanceFeature.Fp16Accumulation in args.fast: torch.backends.cuda.matmul.allow_fp16_accumulation = True PRIORITIZE_FP16 = True # TODO: limit to cards where it actually boosts performance logging.info("Enabled fp16 accumulation.") diff --git a/comfy/ops.py b/comfy/ops.py index 905ea90f6..d98b2b0e7 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -18,7 +18,7 @@ import torch import comfy.model_management -from comfy.cli_args import args +from comfy.cli_args import args, PerformanceFeature import comfy.float cast_to = comfy.model_management.cast_to #TODO: remove once no more references @@ -360,7 +360,11 @@ def pick_operations(weight_dtype, compute_dtype, load_device=None, disable_fast_ if scaled_fp8 is not None: return scaled_fp8_ops(fp8_matrix_mult=fp8_compute, scale_input=True, override_dtype=scaled_fp8) - if fp8_compute and (fp8_optimizations or args.fast >= 5) and not disable_fast_fp8: + if ( + fp8_compute and + (fp8_optimizations or PerformanceFeature.Fp8Optimization in args.fast) and + not disable_fast_fp8 + ): return fp8_ops if compute_dtype is None or weight_dtype == compute_dtype: From 4dc6709307b8af6e7396b215003e004c324e3ef1 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 1 Mar 2025 02:43:49 -0500 Subject: [PATCH 158/478] Rename argument in last commit and document the options. --- comfy/cli_args.py | 4 ++-- comfy/ops.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 6aee14b3e..c99c9e65e 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -133,9 +133,9 @@ parser.add_argument("--deterministic", action="store_true", help="Make pytorch u class PerformanceFeature(enum.Enum): Fp16Accumulation = "fp16_accumulation" - Fp8Optimization = "fp8_optimization" + Fp8MatrixMultiplication = "fp8_matrix_mult" -parser.add_argument("--fast", nargs="*", type=PerformanceFeature, help="Enable some untested and potentially quality deteriorating optimizations.") +parser.add_argument("--fast", nargs="*", type=PerformanceFeature, help="Enable some untested and potentially quality deteriorating optimizations. --fast with no arguments enables everything. You can pass a list specific optimizations if you only want to enable specific ones. Current valid optimizations: fp16_accumulation fp8_matrix_mult") parser.add_argument("--dont-print-server", action="store_true", help="Don't print server output.") parser.add_argument("--quick-test-for-ci", action="store_true", help="Quick test for CI.") diff --git a/comfy/ops.py b/comfy/ops.py index d98b2b0e7..358c6ec60 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -362,7 +362,7 @@ def pick_operations(weight_dtype, compute_dtype, load_device=None, disable_fast_ if ( fp8_compute and - (fp8_optimizations or PerformanceFeature.Fp8Optimization in args.fast) and + (fp8_optimizations or PerformanceFeature.Fp8MatrixMultiplication in args.fast) and not disable_fast_fp8 ): return fp8_ops From 6f81cd89732174109d59b51df72932a6644cf6e0 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 1 Mar 2025 19:26:48 -0500 Subject: [PATCH 159/478] Change defaults in WanImageToVideo node. --- comfy_extras/nodes_wan.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/comfy_extras/nodes_wan.py b/comfy_extras/nodes_wan.py index f3a8ec660..dc30eb546 100644 --- a/comfy_extras/nodes_wan.py +++ b/comfy_extras/nodes_wan.py @@ -11,9 +11,9 @@ class WanImageToVideo: return {"required": {"positive": ("CONDITIONING", ), "negative": ("CONDITIONING", ), "vae": ("VAE", ), - "width": ("INT", {"default": 1280, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), - "height": ("INT", {"default": 720, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), - "length": ("INT", {"default": 121, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}), + "width": ("INT", {"default": 832, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "height": ("INT", {"default": 480, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "length": ("INT", {"default": 81, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}), "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), }, "optional": {"clip_vision_output": ("CLIP_VISION_OUTPUT", ), From 9af6320ec9d288856f505153ed03df7dfcd39dce Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 2 Mar 2025 08:19:16 -0500 Subject: [PATCH 160/478] Make 2d area composition nodes work on video models. --- comfy/samplers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/comfy/samplers.py b/comfy/samplers.py index a1b4787ef..076c98791 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -34,6 +34,9 @@ def get_area_and_mult(conds, x_in, timestep_in): return None if 'area' in conds: area = list(conds['area']) + while (len(area) // 2) < len(dims): + area = [2147483648] + area[:len(area) // 2] + [0] + area[len(area) // 2:] + if 'strength' in conds: strength = conds['strength'] From 04cf0ccb512bde4195c35f9d1769aa13e5b4cdfa Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Sun, 2 Mar 2025 14:18:33 -0500 Subject: [PATCH 161/478] Use comfyui_frontend_package pypi package to manage frontend dependency (Frontend v1.10.17) (#7021) * Use frontend pypi package * Remove web/ * nit * nit * Update importlib logic * Remove unused gh action * Update code owners * Update codeowners * error message --- .github/workflows/update-frontend.yml | 58 - CODEOWNERS | 5 +- app/frontend_management.py | 12 +- requirements.txt | 1 + web/assets/BaseViewTemplate-BTbuZf5t.js | 51 - web/assets/CREDIT.txt | 1 - web/assets/DesktopStartView-D9r53Bue.js | 19 - web/assets/DesktopUpdateView-C-R0415K.js | 58 - web/assets/DesktopUpdateView-CxchaIvw.css | 20 - web/assets/DownloadGitView-PWqK5ke4.js | 58 - web/assets/ExtensionPanel-Ba57xrmg.js | 182 - web/assets/GraphView-B_UDZi95.js | 4919 - web/assets/GraphView-Bo28XDd0.css | 383 - web/assets/InstallView-DW9xwU_F.js | 971 - web/assets/InstallView-DbJ2cGfL.css | 81 - web/assets/KeybindingPanel-CDYVPYDp.css | 8 - web/assets/KeybindingPanel-oavhFdkz.js | 292 - web/assets/MaintenanceView-Bh8OZpgl.js | 25635 -- web/assets/MaintenanceView-DEJCj8SR.css | 87 - .../ManualConfigurationView-CsirlNfV.css | 7 - .../ManualConfigurationView-DTLyJ3VG.js | 74 - web/assets/MetricsConsentView-C80fk2cl.js | 86 - web/assets/NotSupportedView-B78ZVR9Z.js | 86 - web/assets/NotSupportedView-RFx6eCkN.css | 19 - web/assets/ServerConfigPanel-BYrt6wyr.js | 156 - web/assets/ServerStartView-B7TlHxYo.js | 100 - web/assets/ServerStartView-BZ7uhZHv.css | 5 - web/assets/TerminalOutputDrawer-CKr7Br7O.js | 1061 - web/assets/UserSelectView-C703HOyO.js | 101 - web/assets/WelcomeView-Brz3-luE.css | 36 - web/assets/WelcomeView-DIFvbWc2.js | 39 - web/assets/images/Git-Logo-White.svg | 1 - web/assets/images/apple-mps-logo.png | Bin 67332 -> 0 bytes web/assets/images/manual-configuration.svg | 5 - web/assets/images/nvidia-logo.svg | 6 - web/assets/images/sad_girl.png | Bin 177633 -> 0 bytes web/assets/index-A_bXPJCN.js | 618 - web/assets/index-B36GcHVN.js | 54182 ---- web/assets/index-BRhY6FpL.css | 149 - web/assets/index-Bv0b06LE.js | 221040 --------------- web/assets/index-C068lYT4.js | 4993 - web/assets/index-CBxvvAzM.css | 4922 - web/assets/index-CgMyWf7n.js | 8790 - web/assets/index-Dzu9WL4p.js | 27 - web/assets/index-SeIZOWJp.js | 539 - web/assets/keybindingService-DyjX-nxF.js | 250 - web/assets/primeicons-C6QP2o4f.woff2 | Bin 35148 -> 0 bytes web/assets/primeicons-DMOk5skT.eot | Bin 85156 -> 0 bytes web/assets/primeicons-Dr5RGzOO.svg | 345 - web/assets/primeicons-MpK4pl85.ttf | Bin 84980 -> 0 bytes web/assets/primeicons-WjwUDZjB.woff | Bin 85056 -> 0 bytes web/assets/serverConfigStore-D2Vr0L0h.js | 90 - web/assets/sorted-custom-node-map.json | 2602 - web/assets/uvMirrors-B-HKMf6X.js | 16 - web/cursor/colorSelect.png | Bin 373 -> 0 bytes web/cursor/paintBucket.png | Bin 410 -> 0 bytes web/extensions/core/clipspace.js | 2 - web/extensions/core/groupNode.js | 3 - web/extensions/core/groupNodeManage.js | 2 - web/extensions/core/maskEditorOld.js | 2 - web/extensions/core/widgetInputs.js | 5 - web/fonts/materialdesignicons-webfont.woff2 | Bin 403216 -> 0 bytes web/index.html | 15 - web/materialdesignicons.min.css | 3 - web/scripts/api.js | 3 - web/scripts/app.js | 4 - web/scripts/changeTracker.js | 2 - web/scripts/defaultGraph.js | 4 - web/scripts/domWidget.js | 2 - web/scripts/metadata/flac.js | 3 - web/scripts/metadata/png.js | 3 - web/scripts/pnginfo.js | 6 - web/scripts/ui.js | 4 - web/scripts/ui/components/asyncDialog.js | 2 - web/scripts/ui/components/button.js | 2 - web/scripts/ui/components/buttonGroup.js | 2 - web/scripts/ui/components/popup.js | 2 - web/scripts/ui/components/splitButton.js | 2 - web/scripts/ui/dialog.js | 2 - web/scripts/ui/draggableList.js | 2 - web/scripts/ui/imagePreview.js | 3 - web/scripts/ui/menu/index.js | 2 - web/scripts/ui/settings.js | 2 - web/scripts/ui/toggleSwitch.js | 2 - web/scripts/ui/utils.js | 3 - web/scripts/utils.js | 9 - web/scripts/widgets.js | 6 - web/templates/default.jpg | Bin 20506 -> 0 bytes web/templates/default.json | 356 - web/templates/flux_schnell.jpg | Bin 23789 -> 0 bytes web/templates/flux_schnell.json | 420 - web/templates/image2image.jpg | Bin 25787 -> 0 bytes web/templates/image2image.json | 447 - web/templates/upscale.jpg | Bin 30593 -> 0 bytes web/templates/upscale.json | 652 - web/user.css | 1 - 96 files changed, 14 insertions(+), 335152 deletions(-) delete mode 100644 .github/workflows/update-frontend.yml delete mode 100644 web/assets/BaseViewTemplate-BTbuZf5t.js delete mode 100644 web/assets/CREDIT.txt delete mode 100644 web/assets/DesktopStartView-D9r53Bue.js delete mode 100644 web/assets/DesktopUpdateView-C-R0415K.js delete mode 100644 web/assets/DesktopUpdateView-CxchaIvw.css delete mode 100644 web/assets/DownloadGitView-PWqK5ke4.js delete mode 100644 web/assets/ExtensionPanel-Ba57xrmg.js delete mode 100644 web/assets/GraphView-B_UDZi95.js delete mode 100644 web/assets/GraphView-Bo28XDd0.css delete mode 100644 web/assets/InstallView-DW9xwU_F.js delete mode 100644 web/assets/InstallView-DbJ2cGfL.css delete mode 100644 web/assets/KeybindingPanel-CDYVPYDp.css delete mode 100644 web/assets/KeybindingPanel-oavhFdkz.js delete mode 100644 web/assets/MaintenanceView-Bh8OZpgl.js delete mode 100644 web/assets/MaintenanceView-DEJCj8SR.css delete mode 100644 web/assets/ManualConfigurationView-CsirlNfV.css delete mode 100644 web/assets/ManualConfigurationView-DTLyJ3VG.js delete mode 100644 web/assets/MetricsConsentView-C80fk2cl.js delete mode 100644 web/assets/NotSupportedView-B78ZVR9Z.js delete mode 100644 web/assets/NotSupportedView-RFx6eCkN.css delete mode 100644 web/assets/ServerConfigPanel-BYrt6wyr.js delete mode 100644 web/assets/ServerStartView-B7TlHxYo.js delete mode 100644 web/assets/ServerStartView-BZ7uhZHv.css delete mode 100644 web/assets/TerminalOutputDrawer-CKr7Br7O.js delete mode 100644 web/assets/UserSelectView-C703HOyO.js delete mode 100644 web/assets/WelcomeView-Brz3-luE.css delete mode 100644 web/assets/WelcomeView-DIFvbWc2.js delete mode 100644 web/assets/images/Git-Logo-White.svg delete mode 100644 web/assets/images/apple-mps-logo.png delete mode 100644 web/assets/images/manual-configuration.svg delete mode 100644 web/assets/images/nvidia-logo.svg delete mode 100644 web/assets/images/sad_girl.png delete mode 100644 web/assets/index-A_bXPJCN.js delete mode 100644 web/assets/index-B36GcHVN.js delete mode 100644 web/assets/index-BRhY6FpL.css delete mode 100644 web/assets/index-Bv0b06LE.js delete mode 100644 web/assets/index-C068lYT4.js delete mode 100644 web/assets/index-CBxvvAzM.css delete mode 100644 web/assets/index-CgMyWf7n.js delete mode 100644 web/assets/index-Dzu9WL4p.js delete mode 100644 web/assets/index-SeIZOWJp.js delete mode 100644 web/assets/keybindingService-DyjX-nxF.js delete mode 100644 web/assets/primeicons-C6QP2o4f.woff2 delete mode 100644 web/assets/primeicons-DMOk5skT.eot delete mode 100644 web/assets/primeicons-Dr5RGzOO.svg delete mode 100644 web/assets/primeicons-MpK4pl85.ttf delete mode 100644 web/assets/primeicons-WjwUDZjB.woff delete mode 100644 web/assets/serverConfigStore-D2Vr0L0h.js delete mode 100644 web/assets/sorted-custom-node-map.json delete mode 100644 web/assets/uvMirrors-B-HKMf6X.js delete mode 100644 web/cursor/colorSelect.png delete mode 100644 web/cursor/paintBucket.png delete mode 100644 web/extensions/core/clipspace.js delete mode 100644 web/extensions/core/groupNode.js delete mode 100644 web/extensions/core/groupNodeManage.js delete mode 100644 web/extensions/core/maskEditorOld.js delete mode 100644 web/extensions/core/widgetInputs.js delete mode 100644 web/fonts/materialdesignicons-webfont.woff2 delete mode 100644 web/index.html delete mode 100644 web/materialdesignicons.min.css delete mode 100644 web/scripts/api.js delete mode 100644 web/scripts/app.js delete mode 100644 web/scripts/changeTracker.js delete mode 100644 web/scripts/defaultGraph.js delete mode 100644 web/scripts/domWidget.js delete mode 100644 web/scripts/metadata/flac.js delete mode 100644 web/scripts/metadata/png.js delete mode 100644 web/scripts/pnginfo.js delete mode 100644 web/scripts/ui.js delete mode 100644 web/scripts/ui/components/asyncDialog.js delete mode 100644 web/scripts/ui/components/button.js delete mode 100644 web/scripts/ui/components/buttonGroup.js delete mode 100644 web/scripts/ui/components/popup.js delete mode 100644 web/scripts/ui/components/splitButton.js delete mode 100644 web/scripts/ui/dialog.js delete mode 100644 web/scripts/ui/draggableList.js delete mode 100644 web/scripts/ui/imagePreview.js delete mode 100644 web/scripts/ui/menu/index.js delete mode 100644 web/scripts/ui/settings.js delete mode 100644 web/scripts/ui/toggleSwitch.js delete mode 100644 web/scripts/ui/utils.js delete mode 100644 web/scripts/utils.js delete mode 100644 web/scripts/widgets.js delete mode 100644 web/templates/default.jpg delete mode 100644 web/templates/default.json delete mode 100644 web/templates/flux_schnell.jpg delete mode 100644 web/templates/flux_schnell.json delete mode 100644 web/templates/image2image.jpg delete mode 100644 web/templates/image2image.json delete mode 100644 web/templates/upscale.jpg delete mode 100644 web/templates/upscale.json delete mode 100644 web/user.css diff --git a/.github/workflows/update-frontend.yml b/.github/workflows/update-frontend.yml deleted file mode 100644 index 0c5774789..000000000 --- a/.github/workflows/update-frontend.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Update Frontend Release - -on: - workflow_dispatch: - inputs: - version: - description: "Frontend version to update to (e.g., 1.0.0)" - required: true - type: string - -jobs: - update-frontend: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - - steps: - - name: Checkout ComfyUI - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Install requirements - run: | - python -m pip install --upgrade pip - pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu - pip install -r requirements.txt - pip install wait-for-it - # Frontend asset will be downloaded to ComfyUI/web_custom_versions/Comfy-Org_ComfyUI_frontend/{version} - - name: Start ComfyUI server - run: | - python main.py --cpu --front-end-version Comfy-Org/ComfyUI_frontend@${{ github.event.inputs.version }} 2>&1 | tee console_output.log & - wait-for-it --service 127.0.0.1:8188 -t 30 - - name: Configure Git - run: | - git config --global user.name "GitHub Action" - git config --global user.email "action@github.com" - # Replace existing frontend content with the new version and remove .js.map files - # See https://github.com/Comfy-Org/ComfyUI_frontend/issues/2145 for why we remove .js.map files - - name: Update frontend content - run: | - rm -rf web/ - cp -r web_custom_versions/Comfy-Org_ComfyUI_frontend/${{ github.event.inputs.version }} web/ - rm web/**/*.js.map - - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 - with: - token: ${{ secrets.PR_BOT_PAT }} - commit-message: "Update frontend to v${{ github.event.inputs.version }}" - title: "Frontend Update: v${{ github.event.inputs.version }}" - body: | - Automated PR to update frontend content to version ${{ github.event.inputs.version }} - - This PR was created automatically by the frontend update workflow. - branch: release-${{ github.event.inputs.version }} - base: master - labels: Frontend,dependencies diff --git a/CODEOWNERS b/CODEOWNERS index 77da0b7ed..eeec358de 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -11,14 +11,13 @@ /notebooks/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink /script_examples/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink /.github/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink +/requirements.txt @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink +/pyproject.toml @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink # Python web server /api_server/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata /app/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata /utils/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata -# Frontend assets -/web/ @huchenlei @webfiltered @pythongosssss @yoland68 @robinjhuang - # Extra nodes /comfy_extras/ @yoland68 @robinjhuang @huchenlei @pythongosssss @ltdrdata @Kosinkadink diff --git a/app/frontend_management.py b/app/frontend_management.py index 6f20e439c..003c97527 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -5,6 +5,7 @@ import os import re import tempfile import zipfile +import importlib from dataclasses import dataclass from functools import cached_property from pathlib import Path @@ -12,9 +13,18 @@ from typing import TypedDict, Optional import requests from typing_extensions import NotRequired + from comfy.cli_args import DEFAULT_VERSION_STRING +try: + import comfyui_frontend_package +except ImportError as e: + # TODO: Remove the check after roll out of 0.3.16 + logging.error("comfyui-frontend-package is not installed. Please install the updated requirements.txt file by running: pip install -r requirements.txt") + raise e + + REQUEST_TIMEOUT = 10 # seconds @@ -109,7 +119,7 @@ def download_release_asset_zip(release: Release, destination_path: str) -> None: class FrontendManager: - DEFAULT_FRONTEND_PATH = str(Path(__file__).parents[1] / "web") + DEFAULT_FRONTEND_PATH = str(importlib.resources.files(comfyui_frontend_package) / "static") CUSTOM_FRONTENDS_ROOT = str(Path(__file__).parents[1] / "web_custom_versions") @classmethod diff --git a/requirements.txt b/requirements.txt index afbcb7cba..4ad5f3b8a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +comfyui-frontend-package==1.10.17 torch torchsde torchvision diff --git a/web/assets/BaseViewTemplate-BTbuZf5t.js b/web/assets/BaseViewTemplate-BTbuZf5t.js deleted file mode 100644 index d7f9e402b..000000000 --- a/web/assets/BaseViewTemplate-BTbuZf5t.js +++ /dev/null @@ -1,51 +0,0 @@ -import { d as defineComponent, T as ref, p as onMounted, b8 as isElectron, V as nextTick, b9 as electronAPI, o as openBlock, f as createElementBlock, i as withDirectives, v as vShow, j as unref, ba as isNativeWindow, m as createBaseVNode, A as renderSlot, aj as normalizeClass } from "./index-Bv0b06LE.js"; -const _hoisted_1 = { class: "flex-grow w-full flex items-center justify-center overflow-auto" }; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "BaseViewTemplate", - props: { - dark: { type: Boolean, default: false } - }, - setup(__props) { - const props = __props; - const darkTheme = { - color: "rgba(0, 0, 0, 0)", - symbolColor: "#d4d4d4" - }; - const lightTheme = { - color: "rgba(0, 0, 0, 0)", - symbolColor: "#171717" - }; - const topMenuRef = ref(null); - onMounted(async () => { - if (isElectron()) { - await nextTick(); - electronAPI().changeTheme({ - ...props.dark ? darkTheme : lightTheme, - height: topMenuRef.value.getBoundingClientRect().height - }); - } - }); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", { - class: normalizeClass(["font-sans w-screen h-screen flex flex-col", [ - props.dark ? "text-neutral-300 bg-neutral-900 dark-theme" : "text-neutral-900 bg-neutral-300" - ]]) - }, [ - withDirectives(createBaseVNode("div", { - ref_key: "topMenuRef", - ref: topMenuRef, - class: "app-drag w-full h-[var(--comfy-topbar-height)]" - }, null, 512), [ - [vShow, unref(isNativeWindow)()] - ]), - createBaseVNode("div", _hoisted_1, [ - renderSlot(_ctx.$slots, "default") - ]) - ], 2); - }; - } -}); -export { - _sfc_main as _ -}; -//# sourceMappingURL=BaseViewTemplate-BTbuZf5t.js.map diff --git a/web/assets/CREDIT.txt b/web/assets/CREDIT.txt deleted file mode 100644 index b3a9bc906..000000000 --- a/web/assets/CREDIT.txt +++ /dev/null @@ -1 +0,0 @@ -Thanks to OpenArt (https://openart.ai) for providing the sorted-custom-node-map data, captured in September 2024. \ No newline at end of file diff --git a/web/assets/DesktopStartView-D9r53Bue.js b/web/assets/DesktopStartView-D9r53Bue.js deleted file mode 100644 index 744682eca..000000000 --- a/web/assets/DesktopStartView-D9r53Bue.js +++ /dev/null @@ -1,19 +0,0 @@ -import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, k as createVNode, j as unref, bE as script } from "./index-Bv0b06LE.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.js"; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "DesktopStartView", - setup(__props) { - return (_ctx, _cache) => { - return openBlock(), createBlock(_sfc_main$1, { dark: "" }, { - default: withCtx(() => [ - createVNode(unref(script), { class: "m-8 w-48 h-48" }) - ]), - _: 1 - }); - }; - } -}); -export { - _sfc_main as default -}; -//# sourceMappingURL=DesktopStartView-D9r53Bue.js.map diff --git a/web/assets/DesktopUpdateView-C-R0415K.js b/web/assets/DesktopUpdateView-C-R0415K.js deleted file mode 100644 index 8de7eee9e..000000000 --- a/web/assets/DesktopUpdateView-C-R0415K.js +++ /dev/null @@ -1,58 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, T as ref, d8 as onUnmounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, j as unref, bg as t, k as createVNode, bE as script, l as script$1, b9 as electronAPI, _ as _export_sfc } from "./index-Bv0b06LE.js"; -import { s as script$2 } from "./index-A_bXPJCN.js"; -import { _ as _sfc_main$1 } from "./TerminalOutputDrawer-CKr7Br7O.js"; -import { _ as _sfc_main$2 } from "./BaseViewTemplate-BTbuZf5t.js"; -const _hoisted_1 = { class: "h-screen w-screen grid items-center justify-around overflow-y-auto" }; -const _hoisted_2 = { class: "relative m-8 text-center" }; -const _hoisted_3 = { class: "download-bg pi-download text-4xl font-bold" }; -const _hoisted_4 = { class: "m-8" }; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "DesktopUpdateView", - setup(__props) { - const electron = electronAPI(); - const terminalVisible = ref(false); - const toggleConsoleDrawer = /* @__PURE__ */ __name(() => { - terminalVisible.value = !terminalVisible.value; - }, "toggleConsoleDrawer"); - onUnmounted(() => electron.Validation.dispose()); - return (_ctx, _cache) => { - return openBlock(), createBlock(_sfc_main$2, { dark: "" }, { - default: withCtx(() => [ - createBaseVNode("div", _hoisted_1, [ - createBaseVNode("div", _hoisted_2, [ - createBaseVNode("h1", _hoisted_3, toDisplayString(unref(t)("desktopUpdate.title")), 1), - createBaseVNode("div", _hoisted_4, [ - createBaseVNode("span", null, toDisplayString(unref(t)("desktopUpdate.description")), 1) - ]), - createVNode(unref(script), { class: "m-8 w-48 h-48" }), - createVNode(unref(script$1), { - style: { "transform": "translateX(-50%)" }, - class: "fixed bottom-0 left-1/2 my-8", - label: unref(t)("maintenance.consoleLogs"), - icon: "pi pi-desktop", - "icon-pos": "left", - severity: "secondary", - onClick: toggleConsoleDrawer - }, null, 8, ["label"]), - createVNode(_sfc_main$1, { - modelValue: terminalVisible.value, - "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => terminalVisible.value = $event), - header: unref(t)("g.terminal"), - "default-message": unref(t)("desktopUpdate.terminalDefaultMessage") - }, null, 8, ["modelValue", "header", "default-message"]) - ]) - ]), - createVNode(unref(script$2)) - ]), - _: 1 - }); - }; - } -}); -const DesktopUpdateView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8d77828d"]]); -export { - DesktopUpdateView as default -}; -//# sourceMappingURL=DesktopUpdateView-C-R0415K.js.map diff --git a/web/assets/DesktopUpdateView-CxchaIvw.css b/web/assets/DesktopUpdateView-CxchaIvw.css deleted file mode 100644 index e85cbfae6..000000000 --- a/web/assets/DesktopUpdateView-CxchaIvw.css +++ /dev/null @@ -1,20 +0,0 @@ - -.download-bg[data-v-8d77828d]::before { - position: absolute; - margin: 0px; - color: var(--p-text-muted-color); - font-family: 'primeicons'; - top: -2rem; - right: 2rem; - speak: none; - font-style: normal; - font-weight: normal; - font-variant: normal; - text-transform: none; - line-height: 1; - display: inline-block; - -webkit-font-smoothing: antialiased; - opacity: 0.02; - font-size: min(14rem, 90vw); - z-index: 0 -} diff --git a/web/assets/DownloadGitView-PWqK5ke4.js b/web/assets/DownloadGitView-PWqK5ke4.js deleted file mode 100644 index 2128466de..000000000 --- a/web/assets/DownloadGitView-PWqK5ke4.js +++ /dev/null @@ -1,58 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, bi as useRouter } from "./index-Bv0b06LE.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.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) { - const openGitDownloads = /* @__PURE__ */ __name(() => { - window.open("https://git-scm.com/downloads/", "_blank"); - }, "openGitDownloads"); - const skipGit = /* @__PURE__ */ __name(() => { - console.warn("pushing"); - const router = useRouter(); - router.push("install"); - }, "skipGit"); - return (_ctx, _cache) => { - 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_7, [ - createVNode(unref(script), { - label: _ctx.$t("downloadGit.gitWebsite"), - icon: "pi pi-external-link", - "icon-pos": "right", - onClick: openGitDownloads, - severity: "primary" - }, null, 8, ["label"]), - createVNode(unref(script), { - label: _ctx.$t("downloadGit.skip"), - icon: "pi pi-exclamation-triangle", - onClick: skipGit, - severity: "secondary" - }, null, 8, ["label"]) - ]) - ]) - ]), - _: 1 - }); - }; - } -}); -export { - _sfc_main as default -}; -//# sourceMappingURL=DownloadGitView-PWqK5ke4.js.map diff --git a/web/assets/ExtensionPanel-Ba57xrmg.js b/web/assets/ExtensionPanel-Ba57xrmg.js deleted file mode 100644 index 575b6d5b2..000000000 --- a/web/assets/ExtensionPanel-Ba57xrmg.js +++ /dev/null @@ -1,182 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, T as ref, dx as FilterMatchMode, dC as useExtensionStore, a as useSettingStore, p as onMounted, c as computed, o as openBlock, y as createBlock, z as withCtx, k as createVNode, dy as SearchBox, j as unref, bn as script, m as createBaseVNode, f as createElementBlock, D as renderList, E as toDisplayString, a8 as createTextVNode, F as Fragment, l as script$1, B as createCommentVNode, a5 as script$3, ay as script$4, br as script$5, dz as _sfc_main$1 } from "./index-Bv0b06LE.js"; -import { g as script$2, h as script$6 } from "./index-CgMyWf7n.js"; -import "./index-Dzu9WL4p.js"; -const _hoisted_1 = { class: "flex justify-end" }; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "ExtensionPanel", - setup(__props) { - const filters = ref({ - global: { value: "", matchMode: FilterMatchMode.CONTAINS } - }); - const extensionStore = useExtensionStore(); - const settingStore = useSettingStore(); - const editingEnabledExtensions = ref({}); - onMounted(() => { - extensionStore.extensions.forEach((ext) => { - editingEnabledExtensions.value[ext.name] = extensionStore.isExtensionEnabled(ext.name); - }); - }); - const changedExtensions = computed(() => { - return extensionStore.extensions.filter( - (ext) => editingEnabledExtensions.value[ext.name] !== extensionStore.isExtensionEnabled(ext.name) - ); - }); - const hasChanges = computed(() => { - return changedExtensions.value.length > 0; - }); - const updateExtensionStatus = /* @__PURE__ */ __name(() => { - const editingDisabledExtensionNames = Object.entries( - editingEnabledExtensions.value - ).filter(([_, enabled]) => !enabled).map(([name]) => name); - settingStore.set("Comfy.Extension.Disabled", [ - ...extensionStore.inactiveDisabledExtensionNames, - ...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", - class: "extension-panel" - }, { - header: withCtx(() => [ - createVNode(SearchBox, { - modelValue: filters.value["global"].value, - "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filters.value["global"].value = $event), - placeholder: _ctx.$t("g.searchExtensions") + "..." - }, null, 8, ["modelValue", "placeholder"]), - hasChanges.value ? (openBlock(), createBlock(unref(script), { - key: 0, - severity: "info", - "pt:text": "w-full", - class: "max-h-96 overflow-y-auto" - }, { - default: withCtx(() => [ - createBaseVNode("ul", null, [ - (openBlock(true), createElementBlock(Fragment, null, renderList(changedExtensions.value, (ext) => { - return openBlock(), createElementBlock("li", { - key: ext.name - }, [ - createBaseVNode("span", null, toDisplayString(unref(extensionStore).isExtensionEnabled(ext.name) ? "[-]" : "[+]"), 1), - createTextVNode(" " + toDisplayString(ext.name), 1) - ]); - }), 128)) - ]), - createBaseVNode("div", _hoisted_1, [ - createVNode(unref(script$1), { - label: _ctx.$t("g.reloadToApplyChanges"), - onClick: applyChanges, - outlined: "", - severity: "danger" - }, null, 8, ["label"]) - ]) - ]), - _: 1 - })) : createCommentVNode("", true) - ]), - default: withCtx(() => [ - createVNode(unref(script$6), { - value: unref(extensionStore).extensions, - stripedRows: "", - size: "small", - filters: filters.value - }, { - default: withCtx(() => [ - createVNode(unref(script$2), { - header: _ctx.$t("g.extensionName"), - 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$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, ["disabled", "modelValue", "onUpdate:modelValue"]) - ]), - _: 1 - }) - ]), - _: 1 - }, 8, ["value", "filters"]) - ]), - _: 1 - }); - }; - } -}); -export { - _sfc_main as default -}; -//# sourceMappingURL=ExtensionPanel-Ba57xrmg.js.map diff --git a/web/assets/GraphView-B_UDZi95.js b/web/assets/GraphView-B_UDZi95.js deleted file mode 100644 index dc6554706..000000000 --- a/web/assets/GraphView-B_UDZi95.js +++ /dev/null @@ -1,4919 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -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 createVNode, s as showNativeMenu, l as script, m as createBaseVNode, n as normalizeStyle, _ as _export_sfc, p as onMounted, q as onBeforeUnmount, t as useSidebarTabStore, x as useBottomPanelStore, y as createBlock, z as withCtx, A as renderSlot, B as createCommentVNode, C as resolveDynamicComponent, F as Fragment, D as renderList, E as toDisplayString, G as script$5, H as markRaw, I as useI18n, J as useCommandStore, K as useCanvasStore, L as LiteGraph, M as useColorPaletteStore, N as watch, O as useNodeDefStore, P as BadgePosition, Q as LGraphBadge, R as _, S as NodeBadgeMode, T as ref, U as useEventListener, V as nextTick, W as st, X as normalizeI18nKey, Y as useTitleEditorStore, Z as LGraphGroup, $ as LGraphNode, a0 as EditableText, a1 as defineStore, a2 as useNodeFrequencyStore, a3 as useNodeBookmarkStore, a4 as highlightQuery, a5 as script$8, a6 as formatNumberWithSuffix, a7 as NodeSourceType, a8 as createTextVNode, a9 as script$9, aa as NodePreview, ab as NodeSearchFilter, ac as script$a, ad as SearchFilterChip, ae as useLitegraphService, af as storeToRefs, ag as isRef, ah as toRaw, ai as LinkReleaseTriggerAction, aj as normalizeClass, ak as useUserStore, al as useDialogStore, am as SettingDialogHeader, an as SettingDialogContent, ao as useKeybindingStore, ap as Teleport, aq as usePragmaticDraggable, ar as usePragmaticDroppable, as as withModifiers, at as mergeProps, au as useWorkflowService, av as useWorkflowBookmarkStore, aw as script$c, ax as script$d, ay as script$e, az as useModelToNodeStore, aA as ComfyNodeDefImpl, aB as ComfyModelDef, aC as ComfyWorkflow, aD as LGraphCanvas, aE as te, aF as LGraph, aG as LLink, aH as DragAndScale, aI as ContextMenu, aJ as CanvasPointer, aK as isImageNode, aL as api, aM as getStorageValue, aN as useModelStore, aO as setStorageValue, aP as LinkMarkerShape, aQ as IS_CONTROL_WIDGET, aR as updateControlWidgetLabel, aS as useColorPaletteService, aT as ChangeTracker, aU as i18n, aV as useToast, aW as useToastStore, aX as useQueueSettingsStore, aY as script$g, aZ as useQueuePendingTaskCountStore, a_ as useLocalStorage, a$ as useDraggable, b0 as watchDebounced, b1 as inject, b2 as useElementBounding, b3 as script$i, b4 as lodashExports, b5 as useEventBus, b6 as useMenuItemStore, b7 as provide, b8 as isElectron, b9 as electronAPI, ba as isNativeWindow, bb as useDialogService, bc as LGraphEventMode, bd as useQueueStore, be as DEFAULT_DARK_COLOR_PALETTE, bf as DEFAULT_LIGHT_COLOR_PALETTE, bg as t, bh as useErrorHandling } from "./index-Bv0b06LE.js"; -import { s as script$1, a as script$2, b as script$3, c as script$4, d as script$6, e as script$7, f as script$b, g as script$h, h as script$j } from "./index-C068lYT4.js"; -import { s as script$f } from "./index-A_bXPJCN.js"; -import { u as useKeybindingService } from "./keybindingService-DyjX-nxF.js"; -import { u as useServerConfigStore } from "./serverConfigStore-D2Vr0L0h.js"; -import "./index-Dzu9WL4p.js"; -const DEFAULT_TITLE = "ComfyUI"; -const TITLE_SUFFIX = " - ComfyUI"; -const _sfc_main$u = /* @__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 _hoisted_1$k = { class: "window-actions-spacer" }; -const _sfc_main$t = /* @__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(), createElementBlock("div", { - class: "comfy-menu-hamburger no-drag", - style: normalizeStyle(positionCSS.value) - }, [ - withDirectives(createVNode(unref(script), { - icon: "pi pi-bars", - severity: "secondary", - text: "", - size: "large", - "aria-label": _ctx.$t("menu.showMenu"), - "aria-live": "assertive", - onClick: exitFocusMode, - onContextmenu: unref(showNativeMenu) - }, null, 8, ["aria-label", "onContextmenu"]), [ - [_directive_tooltip, { value: _ctx.$t("menu.showMenu"), showDelay: 300 }] - ]), - withDirectives(createBaseVNode("div", _hoisted_1$k, null, 512), [ - [vShow, menuSetting.value !== "Bottom"] - ]) - ], 4)), [ - [vShow, unref(workspaceState).focusMode] - ]); - }; - } -}); -const MenuHamburger = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-82120b51"]]); -const _sfc_main$s = /* @__PURE__ */ defineComponent({ - __name: "UnloadWindowConfirmDialog", - setup(__props) { - const settingStore = useSettingStore(); - const workflowStore = useWorkflowStore(); - const handleBeforeUnload = /* @__PURE__ */ __name((event) => { - if (settingStore.get("Comfy.Window.UnloadConfirmation") && workflowStore.modifiedWorkflows.length > 0) { - 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 _sfc_main$r = /* @__PURE__ */ defineComponent({ - __name: "LiteGraphCanvasSplitterOverlay", - setup(__props) { - const settingStore = useSettingStore(); - const sidebarLocation = computed( - () => settingStore.get("Comfy.Sidebar.Location") - ); - const sidebarPanelVisible = computed( - () => useSidebarTabStore().activeSidebarTab !== null - ); - const bottomPanelVisible = computed( - () => useBottomPanelStore().bottomPanelVisible - ); - const activeSidebarTabId = computed( - () => useSidebarTabStore().activeSidebarTabId - ); - return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$2), { - class: "splitter-overlay-root splitter-overlay", - "pt:gutter": sidebarPanelVisible.value ? "" : "hidden", - key: activeSidebarTabId.value, - stateKey: activeSidebarTabId.value, - stateStorage: "local" - }, { - default: withCtx(() => [ - sidebarLocation.value === "left" ? withDirectives((openBlock(), createBlock(unref(script$1), { - key: 0, - class: "side-bar-panel", - minSize: 10, - size: 20 - }, { - default: withCtx(() => [ - renderSlot(_ctx.$slots, "side-bar-panel", {}, void 0, true) - ]), - _: 3 - }, 512)), [ - [vShow, sidebarPanelVisible.value] - ]) : createCommentVNode("", true), - createVNode(unref(script$1), { size: 100 }, { - default: withCtx(() => [ - createVNode(unref(script$2), { - class: "splitter-overlay max-w-full", - layout: "vertical", - "pt:gutter": bottomPanelVisible.value ? "" : "hidden", - stateKey: "bottom-panel-splitter", - stateStorage: "local" - }, { - default: withCtx(() => [ - createVNode(unref(script$1), { class: "graph-canvas-panel relative" }, { - default: withCtx(() => [ - renderSlot(_ctx.$slots, "graph-canvas-panel", {}, void 0, true) - ]), - _: 3 - }), - withDirectives(createVNode(unref(script$1), { class: "bottom-panel" }, { - default: withCtx(() => [ - renderSlot(_ctx.$slots, "bottom-panel", {}, void 0, true) - ]), - _: 3 - }, 512), [ - [vShow, bottomPanelVisible.value] - ]) - ]), - _: 3 - }, 8, ["pt:gutter"]) - ]), - _: 3 - }), - sidebarLocation.value === "right" ? withDirectives((openBlock(), createBlock(unref(script$1), { - key: 1, - class: "side-bar-panel", - minSize: 10, - size: 20 - }, { - default: withCtx(() => [ - renderSlot(_ctx.$slots, "side-bar-panel", {}, void 0, true) - ]), - _: 3 - }, 512)), [ - [vShow, sidebarPanelVisible.value] - ]) : createCommentVNode("", true) - ]), - _: 3 - }, 8, ["pt:gutter", "stateKey"]); - }; - } -}); -const LiteGraphCanvasSplitterOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-e50caa15"]]); -const _sfc_main$q = /* @__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$j = { class: "flex flex-col h-full" }; -const _hoisted_2$7 = { class: "w-full flex justify-between" }; -const _hoisted_3$6 = { class: "tabs-container" }; -const _hoisted_4$2 = { class: "font-bold" }; -const _hoisted_5$1 = { class: "flex-grow h-0" }; -const _sfc_main$p = /* @__PURE__ */ defineComponent({ - __name: "BottomPanel", - setup(__props) { - const bottomPanelStore = useBottomPanelStore(); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$j, [ - createVNode(unref(script$5), { - value: unref(bottomPanelStore).activeBottomPanelTabId, - "onUpdate:value": _cache[1] || (_cache[1] = ($event) => unref(bottomPanelStore).activeBottomPanelTabId = $event) - }, { - default: withCtx(() => [ - createVNode(unref(script$3), { "pt:tabList": "border-none" }, { - default: withCtx(() => [ - createBaseVNode("div", _hoisted_2$7, [ - createBaseVNode("div", _hoisted_3$6, [ - (openBlock(true), createElementBlock(Fragment, null, renderList(unref(bottomPanelStore).bottomPanelTabs, (tab) => { - return openBlock(), createBlock(unref(script$4), { - key: tab.id, - value: tab.id, - class: "p-3 border-none" - }, { - default: withCtx(() => [ - createBaseVNode("span", _hoisted_4$2, toDisplayString(tab.title.toUpperCase()), 1) - ]), - _: 2 - }, 1032, ["value"]); - }), 128)) - ]), - createVNode(unref(script), { - 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$1, [ - unref(bottomPanelStore).bottomPanelVisible && unref(bottomPanelStore).activeBottomPanelTab ? (openBlock(), createBlock(_sfc_main$q, { - key: 0, - extension: unref(bottomPanelStore).activeBottomPanelTab - }, null, 8, ["extension"])) : createCommentVNode("", true) - ]) - ]); - }; - } -}); -const _hoisted_1$i = { - viewBox: "0 0 1024 1024", - width: "1.2em", - height: "1.2em" -}; -function render$7(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$i, _cache[0] || (_cache[0] = [ - 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) - ])); -} -__name(render$7, "render$7"); -const __unplugin_components_1$2 = markRaw({ name: "simple-line-icons-cursor", render: render$7 }); -const _hoisted_1$h = { - viewBox: "0 0 24 24", - width: "1.2em", - height: "1.2em" -}; -function render$6(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$h, _cache[0] || (_cache[0] = [ - 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) - ])); -} -__name(render$6, "render$6"); -const __unplugin_components_0$2 = markRaw({ name: "material-symbols-pan-tool-outline", render: render$6 }); -const _sfc_main$o = /* @__PURE__ */ defineComponent({ - __name: "GraphCanvasMenu", - setup(__props) { - const { t: t2 } = useI18n(); - const commandStore = useCommandStore(); - const canvasStore = useCanvasStore(); - const settingStore = useSettingStore(); - const linkHidden = computed( - () => settingStore.get("Comfy.LinkRenderMode") === LiteGraph.HIDDEN_LINK - ); - let interval = null; - const repeat = /* @__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$6), { class: "p-buttongroup-vertical absolute bottom-[10px] right-[10px] z-[1000]" }, { - default: withCtx(() => [ - withDirectives(createVNode(unref(script), { - severity: "secondary", - icon: "pi pi-plus", - "aria-label": _ctx.$t("graphCanvasMenu.zoomIn"), - onMousedown: _cache[0] || (_cache[0] = ($event) => repeat("Comfy.Canvas.ZoomIn")), - onMouseup: stopRepeat - }, null, 8, ["aria-label"]), [ - [ - _directive_tooltip, - unref(t2)("graphCanvasMenu.zoomIn"), - void 0, - { left: true } - ] - ]), - withDirectives(createVNode(unref(script), { - severity: "secondary", - icon: "pi pi-minus", - "aria-label": _ctx.$t("graphCanvasMenu.zoomOut"), - onMousedown: _cache[1] || (_cache[1] = ($event) => repeat("Comfy.Canvas.ZoomOut")), - onMouseup: stopRepeat - }, null, 8, ["aria-label"]), [ - [ - _directive_tooltip, - unref(t2)("graphCanvasMenu.zoomOut"), - void 0, - { left: true } - ] - ]), - withDirectives(createVNode(unref(script), { - severity: "secondary", - icon: "pi pi-expand", - "aria-label": _ctx.$t("graphCanvasMenu.fitView"), - onClick: _cache[2] || (_cache[2] = () => unref(commandStore).execute("Comfy.Canvas.FitView")) - }, null, 8, ["aria-label"]), [ - [ - _directive_tooltip, - unref(t2)("graphCanvasMenu.fitView"), - void 0, - { left: true } - ] - ]), - withDirectives((openBlock(), createBlock(unref(script), { - severity: "secondary", - "aria-label": unref(t2)( - "graphCanvasMenu." + (unref(canvasStore).canvas?.read_only ? "panMode" : "selectMode") - ), - 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 - }, 8, ["aria-label"])), [ - [ - _directive_tooltip, - unref(t2)( - "graphCanvasMenu." + (unref(canvasStore).canvas?.read_only ? "panMode" : "selectMode") - ) + " (Space)", - void 0, - { left: true } - ] - ]), - withDirectives(createVNode(unref(script), { - severity: "secondary", - icon: linkHidden.value ? "pi pi-eye-slash" : "pi pi-eye", - "aria-label": _ctx.$t("graphCanvasMenu.toggleLinkVisibility"), - onClick: _cache[4] || (_cache[4] = () => unref(commandStore).execute("Comfy.Canvas.ToggleLinkVisibility")), - "data-testid": "toggle-link-visibility-button" - }, null, 8, ["icon", "aria-label"]), [ - [ - _directive_tooltip, - unref(t2)("graphCanvasMenu.toggleLinkVisibility"), - void 0, - { left: true } - ] - ]) - ]), - _: 1 - }); - }; - } -}); -const GraphCanvasMenu = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-27a9500c"]]); -const _sfc_main$n = /* @__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$m = /* @__PURE__ */ defineComponent({ - __name: "NodeTooltip", - setup(__props) { - let idleTimeout; - const nodeDefStore = useNodeDefStore(); - const settingStore = useSettingStore(); - 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, - settingStore.get("LiteGraph.Node.TooltipDelay") - ); - }, "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$m, [["__scopeId", "data-v-f03142eb"]]); -const _sfc_main$l = /* @__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$l, [["__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); - } - } -} -const _sfc_main$k = { - name: "AutoCompletePlus", - extends: script$7, - emits: ["focused-option-changed"], - data() { - return { - // Flag to determine if IME is active - isComposing: false - }; - }, - mounted() { - if (typeof script$7.mounted === "function") { - script$7.mounted.call(this); - } - const inputEl = this.$el.querySelector("input"); - if (inputEl) { - inputEl.addEventListener("compositionstart", () => { - this.isComposing = true; - }); - inputEl.addEventListener("compositionend", () => { - this.isComposing = false; - }); - } - this.$watch( - () => this.focusedOptionIndex, - (newVal, oldVal) => { - this.$emit("focused-option-changed", newVal); - } - ); - }, - methods: { - // Override onKeyDown to block Enter when IME is active - onKeyDown(event) { - if (event.key === "Enter" && this.isComposing) { - event.preventDefault(); - event.stopPropagation(); - return; - } - script$7.methods.onKeyDown.call(this, event); - } - } -}; -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$6 = { class: "option-display-name font-semibold flex flex-col" }; -const _hoisted_3$5 = { key: 0 }; -const _hoisted_4$1 = ["innerHTML"]; -const _hoisted_5 = ["innerHTML"]; -const _hoisted_6 = { - key: 0, - class: "option-category font-light text-sm text-muted overflow-hidden text-ellipsis whitespace-nowrap" -}; -const _hoisted_7 = { class: "option-badges" }; -const _sfc_main$j = /* @__PURE__ */ defineComponent({ - __name: "NodeSearchItem", - props: { - nodeDef: {}, - currentQuery: {} - }, - setup(__props) { - const settingStore = useSettingStore(); - const showCategory = computed( - () => settingStore.get("Comfy.NodeSearchBoxImpl.ShowCategory") - ); - const showIdName = computed( - () => settingStore.get("Comfy.NodeSearchBoxImpl.ShowIdName") - ); - const showNodeFrequency = computed( - () => settingStore.get("Comfy.NodeSearchBoxImpl.ShowNodeFrequency") - ); - const nodeFrequencyStore = useNodeFrequencyStore(); - const nodeFrequency = computed( - () => nodeFrequencyStore.getNodeFrequency(props.nodeDef) - ); - const nodeBookmarkStore = useNodeBookmarkStore(); - const isBookmarked = computed( - () => nodeBookmarkStore.isBookmarked(props.nodeDef) - ); - const props = __props; - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$g, [ - createBaseVNode("div", _hoisted_2$6, [ - createBaseVNode("div", null, [ - isBookmarked.value ? (openBlock(), createElementBlock("span", _hoisted_3$5, _cache[0] || (_cache[0] = [ - createBaseVNode("i", { class: "pi pi-bookmark-fill text-sm mr-1" }, null, -1) - ]))) : createCommentVNode("", true), - createBaseVNode("span", { - innerHTML: unref(highlightQuery)(_ctx.nodeDef.display_name, _ctx.currentQuery) - }, null, 8, _hoisted_4$1), - _cache[1] || (_cache[1] = createBaseVNode("span", null, " ", -1)), - showIdName.value ? (openBlock(), createBlock(unref(script$8), { - key: 1, - severity: "secondary" - }, { - default: withCtx(() => [ - createBaseVNode("span", { - innerHTML: unref(highlightQuery)(_ctx.nodeDef.name, _ctx.currentQuery) - }, null, 8, _hoisted_5) - ]), - _: 1 - })) : createCommentVNode("", true) - ]), - showCategory.value ? (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(_ctx.nodeDef.category.replaceAll("/", " > ")), 1)) : createCommentVNode("", true) - ]), - createBaseVNode("div", _hoisted_7, [ - _ctx.nodeDef.experimental ? (openBlock(), createBlock(unref(script$8), { - key: 0, - value: _ctx.$t("g.experimental"), - severity: "primary" - }, null, 8, ["value"])) : createCommentVNode("", true), - _ctx.nodeDef.deprecated ? (openBlock(), createBlock(unref(script$8), { - key: 1, - value: _ctx.$t("g.deprecated"), - severity: "danger" - }, null, 8, ["value"])) : createCommentVNode("", true), - showNodeFrequency.value && nodeFrequency.value > 0 ? (openBlock(), createBlock(unref(script$8), { - 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$9), { - key: 3, - class: "text-sm font-light" - }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(_ctx.nodeDef.nodeSource.displayText), 1) - ]), - _: 1 - })) : createCommentVNode("", true) - ]) - ]); - }; - } -}); -const NodeSearchItem = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-fd0a74bd"]]); -const _hoisted_1$f = { class: "comfy-vue-node-search-container flex justify-center items-center w-full min-w-96" }; -const _hoisted_2$5 = { - key: 0, - class: "comfy-vue-node-preview-container absolute left-[-350px] top-[50px]" -}; -const _hoisted_3$4 = { class: "_dialog-body" }; -const _sfc_main$i = /* @__PURE__ */ defineComponent({ - __name: "NodeSearchBox", - props: { - filters: {}, - searchLimit: { default: 64 } - }, - emits: ["addFilter", "removeFilter", "addNode"], - setup(__props, { emit: __emit }) { - const settingStore = useSettingStore(); - const { t: t2 } = useI18n(); - const enableNodePreview = computed( - () => settingStore.get("Comfy.NodeSearchBoxImpl.NodePreview") - ); - const props = __props; - const nodeSearchFilterVisible = ref(false); - const inputId = `comfy-vue-node-search-box-input-${Math.random()}`; - const suggestions = ref([]); - const hoveredSuggestion = ref(null); - const currentQuery = ref(""); - const placeholder = computed(() => { - return props.filters.length === 0 ? t2("g.searchNodes") + "..." : ""; - }); - const nodeDefStore = useNodeDefStore(); - const nodeFrequencyStore = useNodeFrequencyStore(); - const search = /* @__PURE__ */ __name((query) => { - const queryIsEmpty = query === "" && props.filters.length === 0; - currentQuery.value = query; - suggestions.value = queryIsEmpty ? nodeFrequencyStore.topNodeDefs : [ - ...nodeDefStore.nodeSearchService.searchNode(query, props.filters, { - limit: props.searchLimit - }) - ]; - }, "search"); - const emit = __emit; - let inputElement = null; - const reFocusInput = /* @__PURE__ */ __name(() => { - inputElement ??= document.getElementById(inputId); - if (inputElement) { - inputElement.blur(); - nextTick(() => inputElement?.focus()); - } - }, "reFocusInput"); - onMounted(reFocusInput); - const onAddFilter = /* @__PURE__ */ __name((filterAndValue) => { - nodeSearchFilterVisible.value = false; - emit("addFilter", filterAndValue); - }, "onAddFilter"); - const onRemoveFilter = /* @__PURE__ */ __name((event, filterAndValue) => { - event.stopPropagation(); - event.preventDefault(); - emit("removeFilter", filterAndValue); - reFocusInput(); - }, "onRemoveFilter"); - const setHoverSuggestion = /* @__PURE__ */ __name((index) => { - if (index === -1) { - hoveredSuggestion.value = null; - return; - } - const value = suggestions.value[index]; - hoveredSuggestion.value = value; - }, "setHoverSuggestion"); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$f, [ - enableNodePreview.value ? (openBlock(), createElementBlock("div", _hoisted_2$5, [ - hoveredSuggestion.value ? (openBlock(), createBlock(NodePreview, { - nodeDef: hoveredSuggestion.value, - key: hoveredSuggestion.value?.name || "" - }, null, 8, ["nodeDef"])) : createCommentVNode("", true) - ])) : createCommentVNode("", true), - createVNode(unref(script), { - icon: "pi pi-filter", - severity: "secondary", - class: "filter-button z-10", - onClick: _cache[0] || (_cache[0] = ($event) => nodeSearchFilterVisible.value = true) - }), - createVNode(unref(script$a), { - visible: nodeSearchFilterVisible.value, - "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => nodeSearchFilterVisible.value = $event), - class: "min-w-96", - "dismissable-mask": "", - modal: "", - onHide: reFocusInput - }, { - header: withCtx(() => _cache[5] || (_cache[5] = [ - createBaseVNode("h3", null, "Add node filter condition", -1) - ])), - default: withCtx(() => [ - createBaseVNode("div", _hoisted_3$4, [ - createVNode(NodeSearchFilter, { onAddFilter }) - ]) - ]), - _: 1 - }, 8, ["visible"]), - createVNode(_sfc_main$k, { - "model-value": props.filters, - class: "comfy-vue-node-search-box z-10 flex-grow", - scrollHeight: "40vh", - placeholder: placeholder.value, - "input-id": inputId, - "append-to": "self", - suggestions: suggestions.value, - "min-length": 0, - delay: 100, - loading: !unref(nodeFrequencyStore).isLoaded, - onComplete: _cache[2] || (_cache[2] = ($event) => search($event.query)), - onOptionSelect: _cache[3] || (_cache[3] = ($event) => emit("addNode", $event.value)), - onFocusedOptionChanged: _cache[4] || (_cache[4] = ($event) => setHoverSuggestion($event)), - "complete-on-focus": "", - "auto-option-focus": "", - "force-selection": "", - multiple: "", - optionLabel: "display_name" - }, { - option: withCtx(({ option }) => [ - createVNode(NodeSearchItem, { - nodeDef: option, - currentQuery: currentQuery.value - }, null, 8, ["nodeDef", "currentQuery"]) - ]), - chip: withCtx(({ value }) => [ - Array.isArray(value) && value.length === 2 ? (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"])) : createCommentVNode("", true) - ]), - _: 1 - }, 8, ["model-value", "placeholder", "suggestions", "loading"]) - ]); - }; - } -}); -const _sfc_main$h = /* @__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 litegraphService.getCanvasCenter(); - } - const originalEvent = triggerEvent.value.detail.originalEvent; - return [originalEvent.canvasX, originalEvent.canvasY]; - }, "getNewNodeLocation"); - const nodeFilters = ref([]); - const addFilter = /* @__PURE__ */ __name((filter) => { - nodeFilters.value.push(filter); - }, "addFilter"); - const removeFilter = /* @__PURE__ */ __name((filter) => { - nodeFilters.value = nodeFilters.value.filter( - (f) => toRaw(f) !== toRaw(filter) - ); - }, "removeFilter"); - const clearFilters = /* @__PURE__ */ __name(() => { - nodeFilters.value = []; - }, "clearFilters"); - const closeDialog = /* @__PURE__ */ __name(() => { - visible.value = false; - }, "closeDialog"); - const addNode = /* @__PURE__ */ __name((nodeDef) => { - const node = litegraphService.addNodeOnGraph(nodeDef, { - pos: getNewNodeLocation() - }); - const eventDetail = triggerEvent.value?.detail; - if (eventDetail && eventDetail.subType === "empty-release") { - eventDetail.linkReleaseContext.links.forEach((link) => { - ConnectingLinkImpl.createFromPlainObject(link).connectTo(node); - }); - } - window.setTimeout(() => { - closeDialog(); - }, 100); - }, "addNode"); - const newSearchBoxEnabled = computed( - () => settingStore.get("Comfy.NodeSearchBoxImpl") === "default" - ); - const showSearchBox = /* @__PURE__ */ __name((e) => { - const detail = e.detail; - if (newSearchBoxEnabled.value) { - if (detail.originalEvent?.pointerType === "touch") { - setTimeout(() => { - showNewSearchBox(e); - }, 128); - } else { - showNewSearchBox(e); - } - } else { - canvasStore.canvas.showSearchBox(detail.originalEvent); - } - }, "showSearchBox"); - const nodeDefStore = useNodeDefStore(); - const showNewSearchBox = /* @__PURE__ */ __name((e) => { - if (e.detail.subType === "empty-release") { - const links = e.detail.linkReleaseContext.links; - if (links.length === 0) { - console.warn("Empty release with no links! This should never happen"); - return; - } - const firstLink = ConnectingLinkImpl.createFromPlainObject(links[0]); - const filter = nodeDefStore.nodeSearchService.getFilterById( - firstLink.releaseSlotType - ); - const dataType = firstLink.type.toString(); - addFilter([filter, dataType]); - } - visible.value = true; - triggerEvent.value = e; - dismissable.value = false; - setTimeout(() => { - dismissable.value = true; - }, 300); - }, "showNewSearchBox"); - const showContextMenu = /* @__PURE__ */ __name((e) => { - if (e.detail.subType !== "empty-release") { - return; - } - const links = e.detail.linkReleaseContext.links; - if (links.length === 0) { - console.warn("Empty release with no links! This should never happen"); - return; - } - const firstLink = ConnectingLinkImpl.createFromPlainObject(links[0]); - const mouseEvent = e.detail.originalEvent; - const commonOptions = { - e: mouseEvent, - allow_searchbox: true, - showSearchBox: /* @__PURE__ */ __name(() => showSearchBox(e), "showSearchBox") - }; - const connectionOptions = firstLink.output ? { - nodeFrom: firstLink.node, - slotFrom: firstLink.output, - afterRerouteId: firstLink.afterRerouteId - } : { - nodeTo: firstLink.node, - slotTo: firstLink.input, - afterRerouteId: firstLink.afterRerouteId - }; - canvasStore.canvas.showConnectionMenu({ - ...connectionOptions, - ...commonOptions - }); - }, "showContextMenu"); - const canvasStore = useCanvasStore(); - watchEffect(() => { - if (canvasStore.canvas) { - LiteGraph.release_link_on_empty_shows_menu = false; - canvasStore.canvas.allow_searchbox = false; - } - }); - const canvasEventHandler = /* @__PURE__ */ __name((e) => { - if (e.detail.subType === "empty-double-click") { - showSearchBox(e); - } else if (e.detail.subType === "empty-release") { - handleCanvasEmptyRelease(e); - } else if (e.detail.subType === "group-double-click") { - const group = e.detail.group; - const [x, y] = group.pos; - const relativeY = e.detail.originalEvent.canvasY - y; - if (relativeY > group.titleHeight) { - showSearchBox(e); - } - } - }, "canvasEventHandler"); - const linkReleaseAction = computed(() => { - return settingStore.get("Comfy.LinkRelease.Action"); - }); - const linkReleaseActionShift = computed(() => { - return settingStore.get("Comfy.LinkRelease.ActionShift"); - }); - const handleCanvasEmptyRelease = /* @__PURE__ */ __name((e) => { - const detail = e.detail; - const shiftPressed = detail.originalEvent.shiftKey; - const action = shiftPressed ? linkReleaseActionShift.value : linkReleaseAction.value; - switch (action) { - case LinkReleaseTriggerAction.SEARCH_BOX: - showSearchBox(e); - break; - case LinkReleaseTriggerAction.CONTEXT_MENU: - showContextMenu(e); - break; - case LinkReleaseTriggerAction.NO_ACTION: - default: - break; - } - }, "handleCanvasEmptyRelease"); - useEventListener(document, "litegraph:canvas", canvasEventHandler); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", null, [ - createVNode(unref(script$a), { - visible: unref(visible), - "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => isRef(visible) ? visible.value = $event : null), - modal: "", - "dismissable-mask": dismissable.value, - onHide: clearFilters, - pt: { - root: { - class: "invisible-dialog-root", - role: "search" - }, - mask: { class: "node-search-box-dialog-mask" }, - transition: { - enterFromClass: "opacity-0 scale-75", - // 100ms is the duration of the transition in the dialog component - enterActiveClass: "transition-all duration-100 ease-out", - leaveActiveClass: "transition-all duration-100 ease-in", - leaveToClass: "opacity-0 scale-75" - } - } - }, { - container: withCtx(() => [ - createVNode(_sfc_main$i, { - filters: nodeFilters.value, - onAddFilter: addFilter, - onRemoveFilter: removeFilter, - onAddNode: addNode - }, null, 8, ["filters"]) - ]), - _: 1 - }, 8, ["visible", "dismissable-mask"]) - ]); - }; - } -}); -const _sfc_main$g = /* @__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 shouldShowBadge = computed(() => !!overlayValue.value); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return withDirectives((openBlock(), createBlock(unref(script), { - 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$b), { - 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 }] - ]); - }; - } -}); -const SidebarIcon = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-6ab4daa6"]]); -const _sfc_main$f = /* @__PURE__ */ defineComponent({ - __name: "SidebarLogoutIcon", - setup(__props) { - const { t: t2 } = useI18n(); - const userStore = useUserStore(); - const tooltip = computed( - () => `${t2("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$e = /* @__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$d = /* @__PURE__ */ defineComponent({ - __name: "SidebarThemeToggleIcon", - setup(__props) { - const colorPaletteStore = useColorPaletteStore(); - const icon = computed( - () => colorPaletteStore.completedActivePalette.light_theme ? "pi pi-sun" : "pi pi-moon" - ); - 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 _hoisted_1$e = { class: "side-tool-bar-end" }; -const _hoisted_2$4 = { - key: 0, - class: "sidebar-content-container h-full overflow-y-auto overflow-x-hidden" -}; -const _sfc_main$c = /* @__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((item) => { - workspaceStore.sidebarTab.toggleSidebarTab(item.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", { "small-sidebar": isSmall.value }]) - }, [ - (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$f, { key: 0 })) : createCommentVNode("", true), - createVNode(_sfc_main$d), - createVNode(_sfc_main$e) - ]) - ], 2) - ], 8, ["to"])), - selectedTab.value ? (openBlock(), createElementBlock("div", _hoisted_2$4, [ - createVNode(_sfc_main$q, { extension: selectedTab.value }, null, 8, ["extension"]) - ])) : createCommentVNode("", true) - ], 64); - }; - } -}); -const SideToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-04875455"]]); -const _hoisted_1$d = { class: "workflow-label text-sm max-w-[150px] truncate inline-block" }; -const _hoisted_2$3 = { class: "relative" }; -const _hoisted_3$3 = { - key: 0, - class: "status-indicator" -}; -const _sfc_main$b = /* @__PURE__ */ defineComponent({ - __name: "WorkflowTab", - props: { - class: {}, - workflowOption: {} - }, - setup(__props) { - const props = __props; - const { t: t2 } = useI18n(); - 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, - hint: t2("sideToolbar.workflowTab.dirtyCloseHint") - })) { - break; - } - } - }, "closeWorkflows"); - const onCloseWorkflow = /* @__PURE__ */ __name((option) => { - closeWorkflows([option]); - }, "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$d, [ - createTextVNode(toDisplayString(_ctx.workflowOption.workflow.filename), 1) - ])), [ - [ - _directive_tooltip, - _ctx.workflowOption.workflow.key, - void 0, - { bottom: true } - ] - ]), - createBaseVNode("div", _hoisted_2$3, [ - !unref(workspaceStore).shiftDown && (_ctx.workflowOption.workflow.isModified || !_ctx.workflowOption.workflow.isPersisted) ? (openBlock(), createElementBlock("span", _hoisted_3$3, "•")) : createCommentVNode("", true), - createVNode(unref(script), { - 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$b, [["__scopeId", "data-v-fd6ae3af"]]); -const _hoisted_1$c = { class: "workflow-tabs-container flex flex-row max-w-full h-full" }; -const _sfc_main$a = /* @__PURE__ */ defineComponent({ - __name: "WorkflowTabs", - props: { - class: {} - }, - setup(__props) { - const props = __props; - const { t: t2 } = useI18n(); - const workspaceStore = useWorkspaceStore(); - const workflowStore = useWorkflowStore(); - const workflowService = useWorkflowService(); - const workflowBookmarkStore = useWorkflowBookmarkStore(); - 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((option) => { - if (!option) { - return; - } - if (selectedWorkflow.value?.value === option.value) { - return; - } - workflowService.openWorkflow(option.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((option) => { - closeWorkflows([option]); - }, "onCloseWorkflow"); - const showContextMenu = /* @__PURE__ */ __name((event, option) => { - rightClickedTab.value = option; - 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: t2("tabMenu.duplicateTab"), - command: /* @__PURE__ */ __name(() => { - workflowService.duplicateWorkflow(tab.workflow); - }, "command") - }, - { - separator: true - }, - { - label: t2("tabMenu.closeTab"), - command: /* @__PURE__ */ __name(() => onCloseWorkflow(tab), "command") - }, - { - label: t2("tabMenu.closeTabsToLeft"), - command: /* @__PURE__ */ __name(() => closeWorkflows(options.value.slice(0, index)), "command"), - disabled: index <= 0 - }, - { - label: t2("tabMenu.closeTabsToRight"), - command: /* @__PURE__ */ __name(() => closeWorkflows(options.value.slice(index + 1)), "command"), - disabled: index === options.value.length - 1 - }, - { - label: t2("tabMenu.closeOtherTabs"), - command: /* @__PURE__ */ __name(() => closeWorkflows([ - ...options.value.slice(index + 1), - ...options.value.slice(0, index) - ]), "command"), - disabled: options.value.length <= 1 - }, - { - label: workflowBookmarkStore.isBookmarked(tab.workflow.path) ? t2("tabMenu.removeFromBookmarks") : t2("tabMenu.addToBookmarks"), - command: /* @__PURE__ */ __name(() => workflowBookmarkStore.toggleBookmarked(tab.workflow.path), "command"), - disabled: tab.workflow.isTemporary - } - ]; - }); - const commandStore = useCommandStore(); - const handleWheel = /* @__PURE__ */ __name((event) => { - const scrollElement = event.currentTarget; - const scrollAmount = event.deltaX || event.deltaY; - scrollElement.scroll({ - left: scrollElement.scrollLeft + scrollAmount - }); - }, "handleWheel"); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock("div", _hoisted_1$c, [ - createVNode(unref(script$d), { - class: "overflow-hidden no-drag", - "pt:content": { - class: "p-0 w-full", - onwheel: handleWheel - }, - "pt:barX": "h-1" - }, { - default: withCtx(() => [ - createVNode(unref(script$c), { - class: normalizeClass(["workflow-tabs bg-transparent", props.class]), - modelValue: selectedWorkflow.value, - "onUpdate:modelValue": onWorkflowChange, - options: options.value, - optionLabel: "label", - dataKey: "value" - }, { - option: withCtx(({ option }) => [ - createVNode(WorkflowTab, { - onContextmenu: /* @__PURE__ */ __name(($event) => showContextMenu($event, option), "onContextmenu"), - onMouseup: withModifiers(($event) => onCloseWorkflow(option), ["middle"]), - "workflow-option": option - }, null, 8, ["onContextmenu", "onMouseup", "workflow-option"]) - ]), - _: 1 - }, 8, ["class", "modelValue", "options"]) - ]), - _: 1 - }, 8, ["pt:content"]), - withDirectives(createVNode(unref(script), { - class: "new-blank-workflow-button flex-shrink-0 no-drag", - icon: "pi pi-plus", - text: "", - severity: "secondary", - "aria-label": _ctx.$t("sideToolbar.newBlankWorkflow"), - onClick: _cache[0] || (_cache[0] = () => unref(commandStore).execute("Comfy.NewBlankWorkflow")) - }, null, 8, ["aria-label"]), [ - [_directive_tooltip, { value: _ctx.$t("sideToolbar.newBlankWorkflow"), showDelay: 300 }] - ]), - createVNode(unref(script$e), { - ref_key: "menu", - ref: menu, - model: contextMenuItems.value - }, null, 8, ["model"]) - ]); - }; - } -}); -const WorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-54fadc45"]]); -const _hoisted_1$b = { class: "absolute top-0 left-0 w-auto max-w-full" }; -const _sfc_main$9 = /* @__PURE__ */ defineComponent({ - __name: "SecondRowWorkflowTabs", - setup(__props) { - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$b, [ - createVNode(WorkflowTabs) - ]); - }; - } -}); -const SecondRowWorkflowTabs = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-6ab68035"]]); -const useCanvasDrop = /* @__PURE__ */ __name((canvasRef) => { - const modelToNodeStore = useModelToNodeStore(); - const litegraphService = useLitegraphService(); - const workflowService = useWorkflowService(); - usePragmaticDroppable(() => canvasRef.value, { - getDropEffect: /* @__PURE__ */ __name((args) => args.source.data.type === "tree-explorer-node" ? "copy" : "move", "getDropEffect"), - onDrop: /* @__PURE__ */ __name((event) => { - const loc = event.location.current.input; - const dndData = event.source.data; - if (dndData.type === "tree-explorer-node") { - const node = dndData.data; - if (node.data instanceof ComfyNodeDefImpl) { - const nodeDef = node.data; - const pos = app.clientPosToCanvasPos([ - loc.clientX, - loc.clientY + LiteGraph.NODE_TITLE_HEIGHT - ]); - litegraphService.addNodeOnGraph(nodeDef, { pos }); - } else if (node.data instanceof ComfyModelDef) { - const model = node.data; - const pos = app.clientPosToCanvasPos([loc.clientX, loc.clientY]); - const nodeAtPos = app.graph.getNodeOnPos(pos[0], pos[1]); - let targetProvider = null; - let targetGraphNode = null; - if (nodeAtPos) { - const providers = modelToNodeStore.getAllNodeProviders( - model.directory - ); - for (const provider of providers) { - if (provider.nodeDef.name === nodeAtPos.comfyClass) { - targetGraphNode = nodeAtPos; - targetProvider = provider; - } - } - } - if (!targetGraphNode) { - const provider = modelToNodeStore.getNodeProvider(model.directory); - if (provider) { - targetGraphNode = litegraphService.addNodeOnGraph( - provider.nodeDef, - { - pos - } - ); - targetProvider = provider; - } - } - if (targetGraphNode) { - const widget = targetGraphNode.widgets?.find( - (widget2) => widget2.name === targetProvider?.key - ); - if (widget) { - widget.value = model.file_name; - } - } - } else if (node.data instanceof ComfyWorkflow) { - const workflow = node.data; - const position = app.clientPosToCanvasPos([ - loc.clientX, - loc.clientY - ]); - workflowService.insertWorkflow(workflow, { position }); - } - } - }, "onDrop") - }); -}, "useCanvasDrop"); -const useContextMenuTranslation = /* @__PURE__ */ __name(() => { - const f = LGraphCanvas.prototype.getCanvasMenuOptions; - const getCanvasCenterMenuOptions = /* @__PURE__ */ __name(function(...args) { - const res = f.apply(this, args); - for (const item of res) { - if (item?.content) { - item.content = st(`contextMenu.${item.content}`, item.content); - } - } - return res; - }, "getCanvasCenterMenuOptions"); - LGraphCanvas.prototype.getCanvasMenuOptions = getCanvasCenterMenuOptions; - function translateMenus(values, options) { - if (!values) return; - const reInput = /Convert (.*) to input/; - const reWidget = /Convert (.*) to widget/; - const cvt = st("contextMenu.Convert ", "Convert "); - const tinp = st("contextMenu. to input", " to input"); - const twgt = st("contextMenu. to widget", " to widget"); - for (const value of values) { - if (typeof value === "string") continue; - translateMenus(value?.submenu?.options, options); - if (!value?.content) { - continue; - } - if (te(`contextMenu.${value.content}`)) { - value.content = st(`contextMenu.${value.content}`, value.content); - } - const extraInfo = options.extra || options.parentMenu?.options?.extra; - const matchInput = value.content?.match(reInput); - if (matchInput) { - let match = matchInput[1]; - extraInfo?.inputs?.find((i) => { - if (i.name != match) return false; - match = i.label ? i.label : i.name; - }); - extraInfo?.widgets?.find((i) => { - if (i.name != match) return false; - match = i.label ? i.label : i.name; - }); - value.content = cvt + match + tinp; - continue; - } - const matchWidget = value.content?.match(reWidget); - if (matchWidget) { - let match = matchWidget[1]; - extraInfo?.inputs?.find((i) => { - if (i.name != match) return false; - match = i.label ? i.label : i.name; - }); - extraInfo?.widgets?.find((i) => { - if (i.name != match) return false; - match = i.label ? i.label : i.name; - }); - value.content = cvt + match + twgt; - continue; - } - } - } - __name(translateMenus, "translateMenus"); - const OriginalContextMenu = LiteGraph.ContextMenu; - function ContextMenu2(values, options) { - if (options.title) { - options.title = st( - `nodeDefs.${normalizeI18nKey(options.title)}.display_name`, - options.title - ); - } - translateMenus(values, options); - const ctx = new OriginalContextMenu(values, options); - return ctx; - } - __name(ContextMenu2, "ContextMenu"); - LiteGraph.ContextMenu = ContextMenu2; -}, "useContextMenuTranslation"); -const useCopy = /* @__PURE__ */ __name(() => { - const canvasStore = useCanvasStore(); - useEventListener(document, "copy", (e) => { - if (!(e.target instanceof Element)) { - return; - } - if (e.target instanceof HTMLTextAreaElement && e.target.type === "textarea" || e.target instanceof HTMLInputElement && e.target.type === "text") { - return; - } - const isTargetInGraph = e.target.classList.contains("litegraph") || e.target.classList.contains("graph-canvas-container") || e.target.id === "graph-canvas"; - const canvas = canvasStore.canvas; - if (isTargetInGraph && canvas?.selectedItems) { - canvas.copyToClipboard(); - e.clipboardData?.setData("text", " "); - e.preventDefault(); - e.stopImmediatePropagation(); - return false; - } - }); -}, "useCopy"); -const useGlobalLitegraph = /* @__PURE__ */ __name(() => { - window["LiteGraph"] = LiteGraph; - window["LGraph"] = LGraph; - window["LLink"] = LLink; - window["LGraphNode"] = LGraphNode; - window["LGraphGroup"] = LGraphGroup; - window["DragAndScale"] = DragAndScale; - window["LGraphCanvas"] = LGraphCanvas; - window["ContextMenu"] = ContextMenu; - window["LGraphBadge"] = LGraphBadge; -}, "useGlobalLitegraph"); -const useLitegraphSettings = /* @__PURE__ */ __name(() => { - const settingStore = useSettingStore(); - const canvasStore = useCanvasStore(); - watchEffect(() => { - const canvasInfoEnabled = settingStore.get("Comfy.Graph.CanvasInfo"); - if (canvasStore.canvas) { - canvasStore.canvas.show_info = canvasInfoEnabled; - } - }); - watchEffect(() => { - const zoomSpeed = settingStore.get("Comfy.Graph.ZoomSpeed"); - if (canvasStore.canvas) { - canvasStore.canvas.zoom_speed = zoomSpeed; - } - }); - watchEffect(() => { - LiteGraph.snaps_for_comfy = settingStore.get( - "Comfy.Node.AutoSnapLinkToSlot" - ); - }); - watchEffect(() => { - LiteGraph.snap_highlights_node = settingStore.get( - "Comfy.Node.SnapHighlightsNode" - ); - }); - watchEffect(() => { - LGraphNode.keepAllLinksOnBypass = settingStore.get( - "Comfy.Node.BypassAllLinksOnDelete" - ); - }); - watchEffect(() => { - LiteGraph.middle_click_slot_add_default_node = settingStore.get( - "Comfy.Node.MiddleClickRerouteNode" - ); - }); - watchEffect(() => { - const linkRenderMode = settingStore.get("Comfy.LinkRenderMode"); - if (canvasStore.canvas) { - canvasStore.canvas.links_render_mode = linkRenderMode; - canvasStore.canvas.setDirty( - /* fg */ - false, - /* bg */ - true - ); - } - }); - watchEffect(() => { - const lowQualityRenderingZoomThreshold = settingStore.get( - "LiteGraph.Canvas.LowQualityRenderingZoomThreshold" - ); - if (canvasStore.canvas) { - canvasStore.canvas.low_quality_zoom_threshold = lowQualityRenderingZoomThreshold; - canvasStore.canvas.setDirty( - /* fg */ - true, - /* bg */ - true - ); - } - }); - watchEffect(() => { - const linkMarkerShape = settingStore.get("Comfy.Graph.LinkMarkers"); - const { canvas } = canvasStore; - if (canvas) { - canvas.linkMarkerShape = linkMarkerShape; - canvas.setDirty(false, true); - } - }); - watchEffect(() => { - const reroutesEnabled = settingStore.get("Comfy.RerouteBeta"); - const { canvas } = canvasStore; - if (canvas) { - canvas.reroutesEnabled = reroutesEnabled; - canvas.setDirty(false, true); - } - }); - watchEffect(() => { - const maximumFps = settingStore.get("LiteGraph.Canvas.MaximumFps"); - const { canvas } = canvasStore; - if (canvas) canvas.maximumFps = maximumFps; - }); - watchEffect(() => { - const dragZoomEnabled = settingStore.get("Comfy.Graph.CtrlShiftZoom"); - const { canvas } = canvasStore; - if (canvas) canvas.dragZoomEnabled = dragZoomEnabled; - }); - watchEffect(() => { - CanvasPointer.doubleClickTime = settingStore.get( - "Comfy.Pointer.DoubleClickTime" - ); - }); - watchEffect(() => { - CanvasPointer.bufferTime = settingStore.get("Comfy.Pointer.ClickBufferTime"); - }); - watchEffect(() => { - CanvasPointer.maxClickDrift = settingStore.get("Comfy.Pointer.ClickDrift"); - }); - watchEffect(() => { - LiteGraph.CANVAS_GRID_SIZE = settingStore.get("Comfy.SnapToGrid.GridSize"); - }); - watchEffect(() => { - LiteGraph.alwaysSnapToGrid = settingStore.get("pysssss.SnapToGrid"); - }); - watchEffect(() => { - LiteGraph.context_menu_scaling = settingStore.get( - "LiteGraph.ContextMenu.Scaling" - ); - }); -}, "useLitegraphSettings"); -const usePaste = /* @__PURE__ */ __name(() => { - const workspaceStore = useWorkspaceStore(); - const canvasStore = useCanvasStore(); - useEventListener(document, "paste", async (e) => { - if (workspaceStore.shiftDown) return; - const canvas = canvasStore.canvas; - if (!canvas) return; - const graph = canvas.graph; - let data = e.clipboardData || window.clipboardData; - const items = data.items; - for (const item of items) { - if (item.type.startsWith("image/")) { - let imageNode = null; - const currentNode = canvas.current_node; - if (currentNode && currentNode.is_selected && isImageNode(currentNode)) { - imageNode = currentNode; - } - if (!imageNode) { - const newNode = LiteGraph.createNode("LoadImage"); - newNode.pos = [...canvas.graph_mouse]; - imageNode = graph.add(newNode) ?? null; - graph.change(); - } - const blob = item.getAsFile(); - imageNode?.pasteFile?.(blob); - return; - } - } - data = data.getData("text/plain"); - let workflow = null; - try { - data = data.slice(data.indexOf("{")); - workflow = JSON.parse(data); - } catch (err) { - try { - data = data.slice(data.indexOf("workflow\n")); - data = data.slice(data.indexOf("{")); - workflow = JSON.parse(data); - } catch (error) { - workflow = null; - } - } - if (workflow && workflow.version && workflow.nodes && workflow.extra) { - await app.loadGraphData(workflow); - } else { - if (e.target instanceof HTMLTextAreaElement && e.target.type === "textarea" || e.target instanceof HTMLInputElement && e.target.type === "text") { - return; - } - canvas.pasteFromClipboard(); - } - }); -}, "usePaste"); -function useWorkflowPersistence() { - const workflowStore = useWorkflowStore(); - const settingStore = useSettingStore(); - const persistCurrentWorkflow = /* @__PURE__ */ __name(() => { - const workflow = JSON.stringify(app.serializeGraph()); - localStorage.setItem("workflow", workflow); - if (api.clientId) { - sessionStorage.setItem(`workflow:${api.clientId}`, workflow); - } - }, "persistCurrentWorkflow"); - const loadWorkflowFromStorage = /* @__PURE__ */ __name(async (json, workflowName) => { - if (!json) return false; - const workflow = JSON.parse(json); - await app.loadGraphData(workflow, true, true, workflowName); - return true; - }, "loadWorkflowFromStorage"); - const loadPreviousWorkflowFromStorage = /* @__PURE__ */ __name(async () => { - const workflowName = getStorageValue("Comfy.PreviousWorkflow"); - const clientId = api.initialClientId ?? api.clientId; - if (clientId) { - const sessionWorkflow = sessionStorage.getItem(`workflow:${clientId}`); - if (await loadWorkflowFromStorage(sessionWorkflow, workflowName)) { - return true; - } - } - const localWorkflow = localStorage.getItem("workflow"); - return await loadWorkflowFromStorage(localWorkflow, workflowName); - }, "loadPreviousWorkflowFromStorage"); - const loadDefaultWorkflow = /* @__PURE__ */ __name(async () => { - if (!settingStore.get("Comfy.TutorialCompleted")) { - await settingStore.set("Comfy.TutorialCompleted", true); - await useModelStore().loadModelFolders(); - await useWorkflowService().loadTutorialWorkflow(); - } else { - await app.loadGraphData(); - } - }, "loadDefaultWorkflow"); - const restorePreviousWorkflow = /* @__PURE__ */ __name(async () => { - try { - const restored = await loadPreviousWorkflowFromStorage(); - if (!restored) { - await loadDefaultWorkflow(); - } - } catch (err) { - console.error("Error loading previous workflow", err); - await loadDefaultWorkflow(); - } - }, "restorePreviousWorkflow"); - watchEffect(() => { - if (workflowStore.activeWorkflow) { - const workflow = workflowStore.activeWorkflow; - setStorageValue("Comfy.PreviousWorkflow", workflow.key); - persistCurrentWorkflow(); - } - }); - api.addEventListener("graphChanged", persistCurrentWorkflow); - const openWorkflows = computed(() => workflowStore.openWorkflows); - const activeWorkflow = computed(() => workflowStore.activeWorkflow); - const restoreState = computed( - () => { - if (!openWorkflows.value || !activeWorkflow.value) { - return { paths: [], activeIndex: -1 }; - } - const paths = openWorkflows.value.filter((workflow) => workflow?.isPersisted && !workflow.isModified).map((workflow) => workflow.path); - const activeIndex = openWorkflows.value.findIndex( - (workflow) => workflow.path === activeWorkflow.value?.path - ); - return { paths, activeIndex }; - } - ); - const storedWorkflows = JSON.parse( - getStorageValue("Comfy.OpenWorkflowsPaths") || "[]" - ); - const storedActiveIndex = JSON.parse( - getStorageValue("Comfy.ActiveWorkflowIndex") || "-1" - ); - watch(restoreState, ({ paths, activeIndex }) => { - setStorageValue("Comfy.OpenWorkflowsPaths", JSON.stringify(paths)); - setStorageValue("Comfy.ActiveWorkflowIndex", JSON.stringify(activeIndex)); - }); - const restoreWorkflowTabsState = /* @__PURE__ */ __name(() => { - const isRestorable = storedWorkflows?.length > 0 && storedActiveIndex >= 0; - if (isRestorable) { - workflowStore.openWorkflowsInBackground({ - left: storedWorkflows.slice(0, storedActiveIndex), - right: storedWorkflows.slice(storedActiveIndex) - }); - } - }, "restoreWorkflowTabsState"); - return { - restorePreviousWorkflow, - restoreWorkflowTabsState - }; -} -__name(useWorkflowPersistence, "useWorkflowPersistence"); -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"], - // Default to small if the window is less than 1536px(2xl) wide. - defaultValue: /* @__PURE__ */ __name(() => window.innerWidth < 1536 ? "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: true, - 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: true, - versionModified: "1.7.12" - }, - { - 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.None - }, - { - 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: "LiteGraph.Node.TooltipDelay", - name: "Tooltip Delay", - type: "number", - attrs: { - min: 100, - max: 3e3, - step: 50 - }, - defaultValue: 500, - versionAdded: "1.9.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", "Topbar (2nd-row)"], - // Default to topbar (2nd-row) if the window is less than 1536px(2xl) wide. - defaultValue: /* @__PURE__ */ __name(() => window.innerWidth < 1536 ? "Topbar (2nd-row)" : "Topbar", "defaultValue") - }, - { - 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", - versionModified: "1.7.3", - migrateDeprecatedValue: /* @__PURE__ */ __name((value) => { - return value.map((keybinding) => { - if (keybinding["targetSelector"] === "#graph-canvas") { - keybinding["targetElementId"] = "graph-canvas"; - } - return keybinding; - }); - }, "migrateDeprecatedValue") - }, - { - 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: "Maximum 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" - }, - { - id: "Comfy.TutorialCompleted", - name: "Tutorial completed", - type: "hidden", - defaultValue: false, - versionAdded: "1.8.7" - }, - { - id: "LiteGraph.ContextMenu.Scaling", - name: "Scale node combo widget menus (lists) when zoomed in", - defaultValue: false, - type: "boolean", - versionAdded: "1.8.8" - }, - { - id: "LiteGraph.Canvas.LowQualityRenderingZoomThreshold", - name: "Low quality rendering zoom threshold", - tooltip: "Render low quality shapes when zoomed out", - type: "slider", - attrs: { - min: 0.1, - max: 1, - step: 0.01 - }, - defaultValue: 0.6, - versionAdded: "1.9.1" - } -]; -const _sfc_main$8 = /* @__PURE__ */ defineComponent({ - __name: "GraphCanvas", - emits: ["ready"], - setup(__props, { emit: __emit }) { - const emit = __emit; - const canvasRef = ref(null); - const settingStore = useSettingStore(); - const nodeDefStore = useNodeDefStore(); - const workspaceStore = useWorkspaceStore(); - const canvasStore = useCanvasStore(); - const betaMenuEnabled = computed( - () => settingStore.get("Comfy.UseNewMenu") !== "Disabled" - ); - const workflowTabsPosition = computed( - () => settingStore.get("Comfy.Workflow.WorkflowTabsPosition") - ); - const canvasMenuEnabled = computed( - () => settingStore.get("Comfy.Graph.CanvasMenu") - ); - const tooltipEnabled = computed(() => settingStore.get("Comfy.EnableTooltips")); - watchEffect(() => { - nodeDefStore.showDeprecated = settingStore.get("Comfy.Node.ShowDeprecated"); - }); - watchEffect(() => { - nodeDefStore.showExperimental = settingStore.get( - "Comfy.Node.ShowExperimental" - ); - }); - watchEffect(() => { - const spellcheckEnabled = settingStore.get("Comfy.TextareaWidget.Spellcheck"); - const textareas = document.querySelectorAll("textarea.comfy-multiline-input"); - textareas.forEach((textarea) => { - textarea.spellcheck = spellcheckEnabled; - textarea.focus(); - textarea.blur(); - }); - }); - 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); - } - ); - const colorPaletteService = useColorPaletteService(); - const colorPaletteStore = useColorPaletteStore(); - watch( - [() => canvasStore.canvas, () => settingStore.get("Comfy.ColorPalette")], - ([canvas, currentPaletteId]) => { - if (!canvas) return; - colorPaletteService.loadColorPalette(currentPaletteId); - } - ); - watch( - () => colorPaletteStore.activePaletteId, - (newValue) => { - settingStore.set("Comfy.ColorPalette", newValue); - } - ); - const loadCustomNodesI18n = /* @__PURE__ */ __name(async () => { - try { - const i18nData = await api.getCustomNodesI18n(); - Object.entries(i18nData).forEach(([locale, message]) => { - i18n.global.mergeLocaleMessage(locale, message); - }); - } catch (error) { - console.error("Failed to load custom nodes i18n", error); - } - }, "loadCustomNodesI18n"); - const comfyAppReady = ref(false); - const workflowPersistence = useWorkflowPersistence(); - useCanvasDrop(canvasRef); - useLitegraphSettings(); - onMounted(async () => { - useGlobalLitegraph(); - useContextMenuTranslation(); - useCopy(); - usePaste(); - app.vueAppReady = true; - workspaceStore.spinner = true; - ChangeTracker.init(app); - await loadCustomNodesI18n(); - 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; - workspaceStore.spinner = false; - window["app"] = app; - window["graph"] = app.graph; - comfyAppReady.value = true; - colorPaletteStore.customPalettes = settingStore.get( - "Comfy.CustomColorPalettes" - ); - await workflowPersistence.restorePreviousWorkflow(); - workflowPersistence.restoreWorkflowTabsState(); - watch( - () => settingStore.get("Comfy.Locale"), - async () => { - await useCommandStore().execute("Comfy.RefreshNodeDefinitions"); - useWorkflowService().reloadCurrentWorkflow(); - } - ); - emit("ready"); - }); - return (_ctx, _cache) => { - return openBlock(), createElementBlock(Fragment, null, [ - comfyAppReady.value && betaMenuEnabled.value && !unref(workspaceStore).focusMode ? (openBlock(), createBlock(LiteGraphCanvasSplitterOverlay, { key: 0 }, { - "side-bar-panel": withCtx(() => [ - createVNode(SideToolbar) - ]), - "bottom-panel": withCtx(() => [ - createVNode(_sfc_main$p) - ]), - "graph-canvas-panel": withCtx(() => [ - workflowTabsPosition.value === "Topbar (2nd-row)" ? (openBlock(), createBlock(SecondRowWorkflowTabs, { - key: 0, - class: "pointer-events-auto" - })) : createCommentVNode("", true), - canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { - key: 1, - class: "pointer-events-auto" - })) : createCommentVNode("", true) - ]), - _: 1 - })) : createCommentVNode("", true), - createVNode(TitleEditor), - !betaMenuEnabled.value && canvasMenuEnabled.value ? (openBlock(), createBlock(GraphCanvasMenu, { key: 1 })) : createCommentVNode("", true), - createBaseVNode("canvas", { - ref_key: "canvasRef", - ref: canvasRef, - id: "graph-canvas", - tabindex: "1", - class: "w-full h-full touch-none" - }, null, 512), - createVNode(_sfc_main$h), - tooltipEnabled.value ? (openBlock(), createBlock(NodeTooltip, { key: 2 })) : createCommentVNode("", true), - createVNode(_sfc_main$n) - ], 64); - }; - } -}); -const _sfc_main$7 = /* @__PURE__ */ defineComponent({ - __name: "GlobalToast", - setup(__props) { - const toast = useToast(); - const toastStore = useToastStore(); - const settingStore = useSettingStore(); - watch( - () => toastStore.messagesToAdd, - (newMessages) => { - if (newMessages.length === 0) { - return; - } - newMessages.forEach((message) => { - toast.add(message); - }); - toastStore.messagesToAdd = []; - }, - { deep: true } - ); - watch( - () => toastStore.messagesToRemove, - (messagesToRemove) => { - if (messagesToRemove.length === 0) { - return; - } - messagesToRemove.forEach((message) => { - toast.remove(message); - }); - toastStore.messagesToRemove = []; - }, - { deep: true } - ); - watch( - () => toastStore.removeAllRequested, - (requested) => { - if (requested) { - toast.removeAllGroups(); - toastStore.removeAllRequested = false; - } - } - ); - function updateToastPosition() { - const styleElement = document.getElementById("dynamic-toast-style") || createStyleElement(); - const rect = document.querySelector(".graph-canvas-container").getBoundingClientRect(); - styleElement.textContent = ` - .p-toast.p-component.p-toast-top-right { - top: ${rect.top + 20}px !important; - right: ${window.innerWidth - (rect.left + rect.width) + 20}px !important; - } - `; - } - __name(updateToastPosition, "updateToastPosition"); - function createStyleElement() { - const style = document.createElement("style"); - style.id = "dynamic-toast-style"; - document.head.appendChild(style); - return style; - } - __name(createStyleElement, "createStyleElement"); - watch( - () => settingStore.get("Comfy.UseNewMenu"), - () => nextTick(updateToastPosition), - { immediate: true } - ); - watch( - () => settingStore.get("Comfy.Sidebar.Location"), - () => nextTick(updateToastPosition), - { immediate: true } - ); - return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$f)); - }; - } -}); -const _hoisted_1$a = { - viewBox: "0 0 24 24", - width: "1.2em", - height: "1.2em" -}; -function render$5(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$a, _cache[0] || (_cache[0] = [ - createBaseVNode("path", { - fill: "none", - stroke: "currentColor", - "stroke-linecap": "round", - "stroke-linejoin": "round", - "stroke-width": "2", - d: "M6 4v16m4-16l10 8l-10 8z" - }, null, -1) - ])); -} -__name(render$5, "render$5"); -const __unplugin_components_3 = markRaw({ name: "lucide-step-forward", render: render$5 }); -const _hoisted_1$9 = { - viewBox: "0 0 24 24", - width: "1.2em", - height: "1.2em" -}; -function render$4(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$9, _cache[0] || (_cache[0] = [ - createBaseVNode("path", { - fill: "none", - stroke: "currentColor", - "stroke-linecap": "round", - "stroke-linejoin": "round", - "stroke-width": "2", - d: "m13 19l9-7l-9-7zM2 19l9-7l-9-7z" - }, null, -1) - ])); -} -__name(render$4, "render$4"); -const __unplugin_components_2 = markRaw({ name: "lucide-fast-forward", render: render$4 }); -const _hoisted_1$8 = { - viewBox: "0 0 24 24", - width: "1.2em", - height: "1.2em" -}; -function render$3(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$8, _cache[0] || (_cache[0] = [ - createBaseVNode("path", { - fill: "none", - stroke: "currentColor", - "stroke-linecap": "round", - "stroke-linejoin": "round", - "stroke-width": "2", - d: "m6 3l14 9l-14 9z" - }, null, -1) - ])); -} -__name(render$3, "render$3"); -const __unplugin_components_1$1 = markRaw({ name: "lucide-play", render: render$3 }); -const _hoisted_1$7 = { - viewBox: "0 0 24 24", - width: "1.2em", - height: "1.2em" -}; -function render$2(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$7, _cache[0] || (_cache[0] = [ - createBaseVNode("g", { - fill: "none", - stroke: "currentColor", - "stroke-linecap": "round", - "stroke-linejoin": "round", - "stroke-width": "2" - }, [ - createBaseVNode("path", { d: "M16 12H3m13 6H3m7-12H3m18 12V8a2 2 0 0 0-2-2h-5" }), - createBaseVNode("path", { d: "m16 8l-2-2l2-2" }) - ], -1) - ])); -} -__name(render$2, "render$2"); -const __unplugin_components_0$1 = markRaw({ name: "lucide-list-start", render: render$2 }); -const _hoisted_1$6 = ["aria-label"]; -const minQueueCount = 1; -const _sfc_main$6 = /* @__PURE__ */ defineComponent({ - __name: "BatchCountEdit", - props: { - class: { default: "" } - }, - setup(__props) { - const props = __props; - const queueSettingsStore = useQueueSettingsStore(); - const { batchCount } = storeToRefs(queueSettingsStore); - const settingStore = useSettingStore(); - const maxQueueCount = computed( - () => settingStore.get("Comfy.QueueButton.BatchCountLimit") - ); - const handleClick = /* @__PURE__ */ __name((increment) => { - let newCount; - if (increment) { - const originalCount = batchCount.value - 1; - newCount = Math.min(originalCount * 2, maxQueueCount.value); - } else { - const originalCount = batchCount.value + 1; - newCount = Math.floor(originalCount / 2); - } - batchCount.value = newCount; - }, "handleClick"); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return withDirectives((openBlock(), createElementBlock("div", { - class: normalizeClass(["batch-count", props.class]), - "aria-label": _ctx.$t("menu.batchCount") - }, [ - createVNode(unref(script$g), { - class: "w-14", - modelValue: unref(batchCount), - "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(batchCount) ? batchCount.value = $event : null), - min: minQueueCount, - max: maxQueueCount.value, - fluid: "", - showButtons: "", - pt: { - incrementButton: { - class: "w-6", - onmousedown: /* @__PURE__ */ __name(() => { - handleClick(true); - }, "onmousedown") - }, - decrementButton: { - class: "w-6", - onmousedown: /* @__PURE__ */ __name(() => { - handleClick(false); - }, "onmousedown") - } - } - }, null, 8, ["modelValue", "max", "pt"]) - ], 10, _hoisted_1$6)), [ - [ - _directive_tooltip, - _ctx.$t("menu.batchCount"), - void 0, - { bottom: true } - ] - ]); - }; - } -}); -const BatchCountEdit = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-26957f1f"]]); -const _hoisted_1$5 = { class: "queue-button-group flex" }; -const _sfc_main$5 = /* @__PURE__ */ defineComponent({ - __name: "ComfyQueueButton", - setup(__props) { - const workspaceStore = useWorkspaceStore(); - const queueCountStore = storeToRefs(useQueuePendingTaskCountStore()); - const { mode: queueMode } = storeToRefs(useQueueSettingsStore()); - const { t: t2 } = useI18n(); - const queueModeMenuItemLookup = computed(() => ({ - disabled: { - key: "disabled", - label: t2("menu.queue"), - tooltip: t2("menu.disabledTooltip"), - command: /* @__PURE__ */ __name(() => { - queueMode.value = "disabled"; - }, "command") - }, - instant: { - key: "instant", - label: `${t2("menu.queue")} (${t2("menu.instant")})`, - tooltip: t2("menu.instantTooltip"), - command: /* @__PURE__ */ __name(() => { - queueMode.value = "instant"; - }, "command") - }, - change: { - key: "change", - label: `${t2("menu.queue")} (${t2("menu.onChange")})`, - tooltip: t2("menu.onChangeTooltip"), - command: /* @__PURE__ */ __name(() => { - queueMode.value = "change"; - }, "command") - } - })); - const activeQueueModeMenuItem = computed( - () => queueModeMenuItemLookup.value[queueMode.value] - ); - const queueModeMenuItems = computed( - () => Object.values(queueModeMenuItemLookup.value) - ); - const executingPrompt = computed(() => !!queueCountStore.count.value); - const hasPendingTasks = computed(() => queueCountStore.count.value > 1); - const commandStore = useCommandStore(); - const queuePrompt = /* @__PURE__ */ __name((e) => { - const commandId = e.shiftKey ? "Comfy.QueuePromptFront" : "Comfy.QueuePrompt"; - commandStore.execute(commandId); - }, "queuePrompt"); - return (_ctx, _cache) => { - const _component_i_lucide58list_start = __unplugin_components_0$1; - const _component_i_lucide58play = __unplugin_components_1$1; - 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$5, [ - withDirectives((openBlock(), createBlock(unref(script$h), { - class: "comfyui-queue-button", - label: activeQueueModeMenuItem.value.label, - severity: "primary", - size: "small", - onClick: queuePrompt, - model: queueModeMenuItems.value, - "data-testid": "queue-button" - }, { - icon: withCtx(() => [ - 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 }) => [ - withDirectives(createVNode(unref(script), { - label: String(item.label), - icon: item.icon, - severity: item.key === unref(queueMode) ? "primary" : "secondary", - size: "small", - text: "" - }, null, 8, ["label", "icon", "severity"]), [ - [_directive_tooltip, item.tooltip] - ]) - ]), - _: 1 - }, 8, ["label", "model"])), [ - [ - _directive_tooltip, - unref(workspaceStore).shiftDown ? _ctx.$t("menu.queueWorkflowFront") : _ctx.$t("menu.queueWorkflow"), - void 0, - { bottom: true } - ] - ]), - createVNode(BatchCountEdit), - createVNode(unref(script$6), { class: "execution-actions flex flex-nowrap" }, { - default: withCtx(() => [ - withDirectives(createVNode(unref(script), { - icon: "pi pi-times", - severity: executingPrompt.value ? "danger" : "secondary", - disabled: !executingPrompt.value, - text: "", - "aria-label": _ctx.$t("menu.interrupt"), - onClick: _cache[0] || (_cache[0] = () => unref(commandStore).execute("Comfy.Interrupt")) - }, null, 8, ["severity", "disabled", "aria-label"]), [ - [ - _directive_tooltip, - _ctx.$t("menu.interrupt"), - void 0, - { bottom: true } - ] - ]), - withDirectives(createVNode(unref(script), { - icon: "pi pi-stop", - severity: hasPendingTasks.value ? "danger" : "secondary", - disabled: !hasPendingTasks.value, - text: "", - "aria-label": _ctx.$t("sideToolbar.queueTab.clearPendingTasks"), - onClick: _cache[1] || (_cache[1] = () => unref(commandStore).execute("Comfy.ClearPendingTasks")) - }, null, 8, ["severity", "disabled", "aria-label"]), [ - [ - _directive_tooltip, - _ctx.$t("sideToolbar.queueTab.clearPendingTasks"), - void 0, - { bottom: true } - ] - ]) - ]), - _: 1 - }) - ]); - }; - } -}); -const ComfyQueueButton = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-91a628af"]]); -const overlapThreshold = 20; -const _sfc_main$4 = /* @__PURE__ */ defineComponent({ - __name: "ComfyActionbar", - setup(__props) { - const settingsStore = useSettingStore(); - const visible = computed( - () => settingsStore.get("Comfy.UseNewMenu") !== "Disabled" - ); - const panelRef = ref(null); - const dragHandleRef = ref(null); - const isDocked = useLocalStorage("Comfy.MenuPosition.Docked", false); - const storedPosition = useLocalStorage("Comfy.MenuPosition.Floating", { - x: 0, - y: 0 - }); - const { - x, - y, - style, - isDragging - } = useDraggable(panelRef, { - initialValue: { x: 0, y: 0 }, - handle: dragHandleRef, - containerElement: document.body - }); - watchDebounced( - [x, y], - ([newX, newY]) => { - storedPosition.value = { x: newX, y: newY }; - }, - { debounce: 300 } - ); - const setInitialPosition = /* @__PURE__ */ __name(() => { - if (x.value !== 0 || y.value !== 0) { - return; - } - if (storedPosition.value.x !== 0 || storedPosition.value.y !== 0) { - x.value = storedPosition.value.x; - y.value = storedPosition.value.y; - captureLastDragState(); - return; - } - if (panelRef.value) { - const screenWidth = window.innerWidth; - const screenHeight = window.innerHeight; - const menuWidth = panelRef.value.offsetWidth; - const menuHeight = panelRef.value.offsetHeight; - if (menuWidth === 0 || menuHeight === 0) { - return; - } - x.value = (screenWidth - menuWidth) / 2; - y.value = screenHeight - menuHeight - 10; - captureLastDragState(); - } - }, "setInitialPosition"); - onMounted(setInitialPosition); - watch(visible, (newVisible) => { - if (newVisible) { - nextTick(setInitialPosition); - } - }); - const lastDragState = ref({ - x: x.value, - y: y.value, - windowWidth: window.innerWidth, - windowHeight: window.innerHeight - }); - const captureLastDragState = /* @__PURE__ */ __name(() => { - lastDragState.value = { - x: x.value, - y: y.value, - windowWidth: window.innerWidth, - windowHeight: window.innerHeight - }; - }, "captureLastDragState"); - watch( - isDragging, - (newIsDragging) => { - if (!newIsDragging) { - captureLastDragState(); - } - }, - { immediate: true } - ); - const adjustMenuPosition = /* @__PURE__ */ __name(() => { - if (panelRef.value) { - const screenWidth = window.innerWidth; - const screenHeight = window.innerHeight; - const menuWidth = panelRef.value.offsetWidth; - const menuHeight = panelRef.value.offsetHeight; - const distanceLeft = lastDragState.value.x; - const distanceRight = lastDragState.value.windowWidth - (lastDragState.value.x + menuWidth); - const distanceTop = lastDragState.value.y; - const distanceBottom = lastDragState.value.windowHeight - (lastDragState.value.y + menuHeight); - const distances = [ - { edge: "left", distance: distanceLeft }, - { edge: "right", distance: distanceRight }, - { edge: "top", distance: distanceTop }, - { edge: "bottom", distance: distanceBottom } - ]; - const closestEdge = distances.reduce( - (min, curr) => curr.distance < min.distance ? curr : min - ); - const verticalRatio = lastDragState.value.y / lastDragState.value.windowHeight; - const horizontalRatio = lastDragState.value.x / lastDragState.value.windowWidth; - if (closestEdge.edge === "left") { - x.value = closestEdge.distance; - y.value = verticalRatio * screenHeight; - } else if (closestEdge.edge === "right") { - x.value = screenWidth - menuWidth - closestEdge.distance; - y.value = verticalRatio * screenHeight; - } else if (closestEdge.edge === "top") { - x.value = horizontalRatio * screenWidth; - y.value = closestEdge.distance; - } else { - x.value = horizontalRatio * screenWidth; - y.value = screenHeight - menuHeight - closestEdge.distance; - } - x.value = lodashExports.clamp(x.value, 0, screenWidth - menuWidth); - y.value = lodashExports.clamp(y.value, 0, screenHeight - menuHeight); - } - }, "adjustMenuPosition"); - useEventListener(window, "resize", adjustMenuPosition); - const topMenuRef = inject("topMenuRef"); - const topMenuBounds = useElementBounding(topMenuRef); - const isOverlappingWithTopMenu = computed(() => { - if (!panelRef.value) { - return false; - } - const { height } = panelRef.value.getBoundingClientRect(); - const actionbarBottom = y.value + height; - const topMenuBottom = topMenuBounds.bottom.value; - const overlapPixels = Math.min(actionbarBottom, topMenuBottom) - Math.max(y.value, topMenuBounds.top.value); - return overlapPixels > overlapThreshold; - }); - watch(isDragging, (newIsDragging) => { - if (!newIsDragging) { - isDocked.value = isOverlappingWithTopMenu.value; - } else { - isDocked.value = false; - } - }); - const eventBus = useEventBus("topMenu"); - watch([isDragging, isOverlappingWithTopMenu], ([dragging, overlapping]) => { - eventBus.emit("updateHighlight", { - isDragging: dragging, - isOverlapping: overlapping - }); - }); - return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$i), { - class: normalizeClass(["actionbar w-fit", { "is-dragging": unref(isDragging), "is-docked": unref(isDocked) }]), - style: normalizeStyle(unref(style)) - }, { - default: withCtx(() => [ - createBaseVNode("div", { - class: "actionbar-content flex items-center select-none", - ref_key: "panelRef", - ref: panelRef - }, [ - createBaseVNode("span", { - class: "drag-handle cursor-move mr-2 p-0!", - ref_key: "dragHandleRef", - ref: dragHandleRef - }, null, 512), - createVNode(ComfyQueueButton) - ], 512) - ]), - _: 1 - }, 8, ["style", "class"]); - }; - } -}); -const Actionbar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-ebd56d51"]]); -const _hoisted_1$4 = { - viewBox: "0 0 24 24", - width: "1.2em", - height: "1.2em" -}; -function render$1(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$4, _cache[0] || (_cache[0] = [ - 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) - ])); -} -__name(render$1, "render$1"); -const __unplugin_components_1 = markRaw({ name: "material-symbols-dock-to-bottom-outline", render: render$1 }); -const _hoisted_1$3 = { - viewBox: "0 0 24 24", - width: "1.2em", - height: "1.2em" -}; -function render(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$3, _cache[0] || (_cache[0] = [ - 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) - ])); -} -__name(render, "render"); -const __unplugin_components_0 = markRaw({ name: "material-symbols-dock-to-bottom", render }); -const _sfc_main$3 = /* @__PURE__ */ defineComponent({ - __name: "BottomPanelToggleButton", - setup(__props) { - const bottomPanelStore = useBottomPanelStore(); - return (_ctx, _cache) => { - 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), { - severity: "secondary", - text: "", - "aria-label": _ctx.$t("menu.toggleBottomPanel"), - onClick: unref(bottomPanelStore).toggleBottomPanel - }, { - icon: withCtx(() => [ - unref(bottomPanelStore).bottomPanelVisible ? (openBlock(), createBlock(_component_i_material_symbols58dock_to_bottom, { key: 0 })) : (openBlock(), createBlock(_component_i_material_symbols58dock_to_bottom_outline, { key: 1 })) - ]), - _: 1 - }, 8, ["aria-label", "onClick"])), [ - [vShow, unref(bottomPanelStore).bottomPanelTabs.length > 0], - [_directive_tooltip, { value: _ctx.$t("menu.toggleBottomPanel"), showDelay: 300 }] - ]); - }; - } -}); -const _hoisted_1$2 = ["href"]; -const _hoisted_2$2 = { class: "p-menubar-item-label" }; -const _hoisted_3$2 = { - key: 1, - class: "ml-auto border border-surface rounded text-muted text-xs text-nowrap p-1 keybinding-tag" -}; -const _sfc_main$2 = /* @__PURE__ */ defineComponent({ - __name: "CommandMenubar", - setup(__props) { - const settingStore = useSettingStore(); - const dropdownDirection = computed( - () => settingStore.get("Comfy.UseNewMenu") === "Top" ? "down" : "up" - ); - const menuItemsStore = useMenuItemStore(); - const { t: t2 } = useI18n(); - const translateMenuItem = /* @__PURE__ */ __name((item) => { - const label = typeof item.label === "function" ? item.label() : item.label; - const translatedLabel = label ? t2(`menuLabels.${normalizeI18nKey(label)}`, label) : void 0; - return { - ...item, - label: translatedLabel, - items: item.items?.map(translateMenuItem) - }; - }, "translateMenuItem"); - const translatedItems = computed( - () => menuItemsStore.menuItems.map(translateMenuItem) - ); - return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$j), { - 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, props }) => [ - createBaseVNode("a", mergeProps({ class: "p-menubar-item-link" }, props.action, { - href: item.url, - target: "_blank" - }), [ - item.icon ? (openBlock(), createElementBlock("span", { - key: 0, - class: normalizeClass(["p-menubar-item-icon", item.icon]) - }, null, 2)) : createCommentVNode("", true), - createBaseVNode("span", _hoisted_2$2, toDisplayString(item.label), 1), - item?.comfyCommand?.keybinding ? (openBlock(), createElementBlock("span", _hoisted_3$2, toDisplayString(item.comfyCommand.keybinding.combo.toString()), 1)) : createCommentVNode("", true) - ], 16, _hoisted_1$2) - ]), - _: 1 - }, 8, ["model", "pt"]); - }; - } -}); -const CommandMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-56df69d2"]]); -const _hoisted_1$1 = { class: "flex-grow min-w-0 app-drag h-full" }; -const _hoisted_2$1 = { class: "window-actions-spacer flex-shrink-0" }; -const _hoisted_3$1 = { class: "fixed top-0 left-0 app-drag w-full h-[var(--comfy-topbar-height)]" }; -const _sfc_main$1 = /* @__PURE__ */ defineComponent({ - __name: "TopMenubar", - setup(__props) { - const workspaceState = useWorkspaceStore(); - const settingStore = useSettingStore(); - const workflowTabsPosition = computed( - () => settingStore.get("Comfy.Workflow.WorkflowTabsPosition") - ); - const menuSetting = computed(() => settingStore.get("Comfy.UseNewMenu")); - const betaMenuEnabled = computed(() => menuSetting.value !== "Disabled"); - const showTopMenu = computed( - () => betaMenuEnabled.value && !workspaceState.focusMode - ); - const menuRight = ref(null); - onMounted(() => { - if (menuRight.value) { - menuRight.value.appendChild(app.menu.element); - } - }); - const topMenuRef = ref(null); - provide("topMenuRef", topMenuRef); - const eventBus = useEventBus("topMenu"); - const isDropZone = ref(false); - const isDroppable = ref(false); - eventBus.on((event, payload) => { - if (event === "updateHighlight") { - isDropZone.value = payload.isDragging; - isDroppable.value = payload.isOverlapping && payload.isDragging; - } - }); - onMounted(() => { - if (isElectron()) { - electronAPI().changeTheme({ - height: topMenuRef.value.getBoundingClientRect().height - }); - } - }); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock(Fragment, null, [ - withDirectives(createBaseVNode("div", { - ref_key: "topMenuRef", - ref: topMenuRef, - class: normalizeClass(["comfyui-menu flex items-center", { dropzone: isDropZone.value, "dropzone-active": isDroppable.value }]) - }, [ - _cache[1] || (_cache[1] = createBaseVNode("h1", { class: "comfyui-logo mx-2 app-drag" }, "ComfyUI", -1)), - createVNode(CommandMenubar), - createBaseVNode("div", _hoisted_1$1, [ - workflowTabsPosition.value === "Topbar" ? (openBlock(), createBlock(WorkflowTabs, { key: 0 })) : createCommentVNode("", true) - ]), - createBaseVNode("div", { - class: "comfyui-menu-right flex-shrink-0", - ref_key: "menuRight", - ref: menuRight - }, null, 512), - createVNode(Actionbar), - createVNode(_sfc_main$3, { class: "flex-shrink-0" }), - withDirectives(createVNode(unref(script), { - class: "flex-shrink-0", - icon: "pi pi-bars", - severity: "secondary", - text: "", - "aria-label": _ctx.$t("menu.hideMenu"), - onClick: _cache[0] || (_cache[0] = ($event) => unref(workspaceState).focusMode = true), - onContextmenu: unref(showNativeMenu) - }, null, 8, ["aria-label", "onContextmenu"]), [ - [_directive_tooltip, { value: _ctx.$t("menu.hideMenu"), showDelay: 300 }] - ]), - withDirectives(createBaseVNode("div", _hoisted_2$1, null, 512), [ - [vShow, menuSetting.value !== "Bottom"] - ]) - ], 2), [ - [vShow, showTopMenu.value] - ]), - withDirectives(createBaseVNode("div", _hoisted_3$1, null, 512), [ - [vShow, unref(isNativeWindow)() && !showTopMenu.value] - ]) - ], 64); - }; - } -}); -const TopMenubar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-68d3b5b9"]]); -function useCoreCommands() { - const workflowService = useWorkflowService(); - const workflowStore = useWorkflowStore(); - const dialogService = useDialogService(); - const colorPaletteStore = useColorPaletteStore(); - const getTracker = /* @__PURE__ */ __name(() => workflowStore.activeWorkflow?.changeTracker, "getTracker"); - const getSelectedNodes = /* @__PURE__ */ __name(() => { - const selectedNodes = app.canvas.selected_nodes; - const result = []; - if (selectedNodes) { - for (const i in selectedNodes) { - const node = selectedNodes[i]; - result.push(node); - } - } - return result; - }, "getSelectedNodes"); - const toggleSelectedNodesMode = /* @__PURE__ */ __name((mode) => { - getSelectedNodes().forEach((node) => { - if (node.mode === mode) { - node.mode = LGraphEventMode.ALWAYS; - } else { - node.mode = mode; - } - }); - }, "toggleSelectedNodesMode"); - return [ - { - id: "Comfy.NewBlankWorkflow", - icon: "pi pi-plus", - label: "New Blank Workflow", - menubarLabel: "New", - function: /* @__PURE__ */ __name(() => workflowService.loadBlankWorkflow(), "function") - }, - { - id: "Comfy.OpenWorkflow", - icon: "pi pi-folder-open", - label: "Open Workflow", - menubarLabel: "Open", - function: /* @__PURE__ */ __name(() => { - app.ui.loadFile(); - }, "function") - }, - { - id: "Comfy.LoadDefaultWorkflow", - icon: "pi pi-code", - label: "Load Default Workflow", - function: /* @__PURE__ */ __name(() => workflowService.loadDefaultWorkflow(), "function") - }, - { - id: "Comfy.SaveWorkflow", - icon: "pi pi-save", - label: "Save Workflow", - menubarLabel: "Save", - function: /* @__PURE__ */ __name(async () => { - const workflow = useWorkflowStore().activeWorkflow; - if (!workflow) return; - await workflowService.saveWorkflow(workflow); - }, "function") - }, - { - id: "Comfy.SaveWorkflowAs", - icon: "pi pi-save", - label: "Save Workflow As", - menubarLabel: "Save As", - function: /* @__PURE__ */ __name(async () => { - const workflow = useWorkflowStore().activeWorkflow; - if (!workflow) return; - await workflowService.saveWorkflowAs(workflow); - }, "function") - }, - { - id: "Comfy.ExportWorkflow", - icon: "pi pi-download", - label: "Export Workflow", - menubarLabel: "Export", - function: /* @__PURE__ */ __name(() => { - workflowService.exportWorkflow("workflow", "workflow"); - }, "function") - }, - { - id: "Comfy.ExportWorkflowAPI", - icon: "pi pi-download", - label: "Export Workflow (API Format)", - menubarLabel: "Export (API)", - function: /* @__PURE__ */ __name(() => { - workflowService.exportWorkflow("workflow_api", "output"); - }, "function") - }, - { - id: "Comfy.Undo", - icon: "pi pi-undo", - label: "Undo", - function: /* @__PURE__ */ __name(async () => { - await getTracker()?.undo?.(); - }, "function") - }, - { - id: "Comfy.Redo", - icon: "pi pi-refresh", - label: "Redo", - function: /* @__PURE__ */ __name(async () => { - await getTracker()?.redo?.(); - }, "function") - }, - { - id: "Comfy.ClearWorkflow", - icon: "pi pi-trash", - label: "Clear Workflow", - function: /* @__PURE__ */ __name(() => { - const settingStore = useSettingStore(); - if (!settingStore.get("Comfy.ComfirmClear") || confirm("Clear workflow?")) { - app.clean(); - app.graph.clear(); - api.dispatchCustomEvent("graphCleared"); - } - }, "function") - }, - { - id: "Comfy.Canvas.ResetView", - icon: "pi pi-expand", - label: "Reset View", - function: /* @__PURE__ */ __name(() => { - useLitegraphService().resetView(); - }, "function") - }, - { - id: "Comfy.OpenClipspace", - icon: "pi pi-clipboard", - label: "Clipspace", - function: /* @__PURE__ */ __name(() => { - app.openClipspace(); - }, "function") - }, - { - id: "Comfy.RefreshNodeDefinitions", - icon: "pi pi-refresh", - label: "Refresh Node Definitions", - function: /* @__PURE__ */ __name(async () => { - await app.refreshComboInNodes(); - }, "function") - }, - { - id: "Comfy.Interrupt", - icon: "pi pi-stop", - label: "Interrupt", - function: /* @__PURE__ */ __name(async () => { - await api.interrupt(); - useToastStore().add({ - severity: "info", - summary: "Interrupted", - detail: "Execution has been interrupted", - life: 1e3 - }); - }, "function") - }, - { - id: "Comfy.ClearPendingTasks", - icon: "pi pi-stop", - label: "Clear Pending Tasks", - function: /* @__PURE__ */ __name(async () => { - await useQueueStore().clear(["queue"]); - useToastStore().add({ - severity: "info", - summary: "Confirmed", - detail: "Pending tasks deleted", - life: 3e3 - }); - }, "function") - }, - { - id: "Comfy.BrowseTemplates", - icon: "pi pi-folder-open", - label: "Browse Templates", - function: /* @__PURE__ */ __name(() => { - dialogService.showTemplateWorkflowsDialog(); - }, "function") - }, - { - id: "Comfy.Canvas.ZoomIn", - icon: "pi pi-plus", - label: "Zoom In", - function: /* @__PURE__ */ __name(() => { - const ds = app.canvas.ds; - ds.changeScale( - ds.scale * 1.1, - ds.element ? [ds.element.width / 2, ds.element.height / 2] : void 0 - ); - app.canvas.setDirty(true, true); - }, "function") - }, - { - id: "Comfy.Canvas.ZoomOut", - icon: "pi pi-minus", - label: "Zoom Out", - function: /* @__PURE__ */ __name(() => { - const ds = app.canvas.ds; - ds.changeScale( - ds.scale / 1.1, - ds.element ? [ds.element.width / 2, ds.element.height / 2] : void 0 - ); - app.canvas.setDirty(true, true); - }, "function") - }, - { - id: "Comfy.Canvas.FitView", - icon: "pi pi-expand", - label: "Fit view to selected nodes", - function: /* @__PURE__ */ __name(() => { - if (app.canvas.empty) { - useToastStore().add({ - severity: "error", - summary: "Empty canvas", - life: 3e3 - }); - return; - } - app.canvas.fitViewToSelectionAnimated(); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleLock", - icon: "pi pi-lock", - label: "Canvas Toggle Lock", - function: /* @__PURE__ */ __name(() => { - app.canvas["read_only"] = !app.canvas["read_only"]; - }, "function") - }, - { - id: "Comfy.Canvas.ToggleLinkVisibility", - icon: "pi pi-eye", - label: "Canvas Toggle Link Visibility", - versionAdded: "1.3.6", - function: (() => { - const settingStore = useSettingStore(); - let lastLinksRenderMode = LiteGraph.SPLINE_LINK; - return () => { - const currentMode = settingStore.get("Comfy.LinkRenderMode"); - if (currentMode === LiteGraph.HIDDEN_LINK) { - settingStore.set("Comfy.LinkRenderMode", lastLinksRenderMode); - } else { - lastLinksRenderMode = currentMode; - settingStore.set("Comfy.LinkRenderMode", LiteGraph.HIDDEN_LINK); - } - }; - })() - }, - { - id: "Comfy.QueuePrompt", - icon: "pi pi-play", - label: "Queue Prompt", - versionAdded: "1.3.7", - function: /* @__PURE__ */ __name(() => { - const batchCount = useQueueSettingsStore().batchCount; - app.queuePrompt(0, batchCount); - }, "function") - }, - { - id: "Comfy.QueuePromptFront", - icon: "pi pi-play", - label: "Queue Prompt (Front)", - versionAdded: "1.3.7", - function: /* @__PURE__ */ __name(() => { - const batchCount = useQueueSettingsStore().batchCount; - app.queuePrompt(-1, batchCount); - }, "function") - }, - { - id: "Comfy.ShowSettingsDialog", - icon: "pi pi-cog", - label: "Show Settings Dialog", - versionAdded: "1.3.7", - function: /* @__PURE__ */ __name(() => { - dialogService.showSettingsDialog(); - }, "function") - }, - { - id: "Comfy.Graph.GroupSelectedNodes", - icon: "pi pi-sitemap", - label: "Group Selected Nodes", - versionAdded: "1.3.7", - function: /* @__PURE__ */ __name(() => { - const { canvas } = app; - if (!canvas.selectedItems?.size) { - useToastStore().add({ - severity: "error", - summary: "Nothing to group", - detail: "Please select the nodes (or other groups) to create a group for", - life: 3e3 - }); - return; - } - const group = new LGraphGroup(); - const padding = useSettingStore().get( - "Comfy.GroupSelectedNodes.Padding" - ); - group.resizeTo(canvas.selectedItems, padding); - canvas.graph.add(group); - useTitleEditorStore().titleEditorTarget = group; - }, "function") - }, - { - id: "Workspace.NextOpenedWorkflow", - icon: "pi pi-step-forward", - label: "Next Opened Workflow", - versionAdded: "1.3.9", - function: /* @__PURE__ */ __name(() => { - workflowService.loadNextOpenedWorkflow(); - }, "function") - }, - { - id: "Workspace.PreviousOpenedWorkflow", - icon: "pi pi-step-backward", - label: "Previous Opened Workflow", - versionAdded: "1.3.9", - function: /* @__PURE__ */ __name(() => { - workflowService.loadPreviousOpenedWorkflow(); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelectedNodes.Mute", - icon: "pi pi-volume-off", - label: "Mute/Unmute Selected Nodes", - versionAdded: "1.3.11", - function: /* @__PURE__ */ __name(() => { - toggleSelectedNodesMode(LGraphEventMode.NEVER); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelectedNodes.Bypass", - icon: "pi pi-shield", - label: "Bypass/Unbypass Selected Nodes", - versionAdded: "1.3.11", - function: /* @__PURE__ */ __name(() => { - toggleSelectedNodesMode(LGraphEventMode.BYPASS); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelectedNodes.Pin", - icon: "pi pi-pin", - label: "Pin/Unpin Selected Nodes", - versionAdded: "1.3.11", - function: /* @__PURE__ */ __name(() => { - getSelectedNodes().forEach((node) => { - node.pin(!node.pinned); - }); - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelected.Pin", - icon: "pi pi-pin", - label: "Pin/Unpin Selected Items", - versionAdded: "1.3.33", - function: /* @__PURE__ */ __name(() => { - for (const item of app.canvas.selectedItems) { - if (item instanceof LGraphNode || item instanceof LGraphGroup) { - item.pin(!item.pinned); - } - } - }, "function") - }, - { - id: "Comfy.Canvas.ToggleSelectedNodes.Collapse", - icon: "pi pi-minus", - label: "Collapse/Expand Selected Nodes", - versionAdded: "1.3.11", - function: /* @__PURE__ */ __name(() => { - getSelectedNodes().forEach((node) => { - node.collapse(); - }); - }, "function") - }, - { - id: "Comfy.ToggleTheme", - icon: "pi pi-moon", - label: "Toggle Theme (Dark/Light)", - versionAdded: "1.3.12", - function: (() => { - let previousDarkTheme = DEFAULT_DARK_COLOR_PALETTE.id; - let previousLightTheme = DEFAULT_LIGHT_COLOR_PALETTE.id; - return () => { - const settingStore = useSettingStore(); - const theme = colorPaletteStore.completedActivePalette; - if (theme.light_theme) { - previousLightTheme = theme.id; - settingStore.set("Comfy.ColorPalette", previousDarkTheme); - } else { - previousDarkTheme = theme.id; - settingStore.set("Comfy.ColorPalette", previousLightTheme); - } - }; - })() - }, - { - id: "Workspace.ToggleBottomPanel", - icon: "pi pi-list", - label: "Toggle Bottom Panel", - versionAdded: "1.3.22", - function: /* @__PURE__ */ __name(() => { - useBottomPanelStore().toggleBottomPanel(); - }, "function") - }, - { - id: "Workspace.ToggleFocusMode", - icon: "pi pi-eye", - label: "Toggle Focus Mode", - versionAdded: "1.3.27", - function: /* @__PURE__ */ __name(() => { - useWorkspaceStore().toggleFocusMode(); - }, "function") - }, - { - id: "Comfy.Graph.FitGroupToContents", - icon: "pi pi-expand", - label: "Fit Group To Contents", - versionAdded: "1.4.9", - function: /* @__PURE__ */ __name(() => { - for (const group of app.canvas.selectedItems) { - if (group instanceof LGraphGroup) { - group.recomputeInsideNodes(); - const padding = useSettingStore().get( - "Comfy.GroupSelectedNodes.Padding" - ); - group.resizeTo(group.children, padding); - app.graph.change(); - } - } - }, "function") - }, - { - id: "Comfy.Help.OpenComfyUIIssues", - icon: "pi pi-github", - label: "Open ComfyUI Issues", - menubarLabel: "ComfyUI Issues", - versionAdded: "1.5.5", - function: /* @__PURE__ */ __name(() => { - window.open( - "https://github.com/comfyanonymous/ComfyUI/issues", - "_blank" - ); - }, "function") - }, - { - id: "Comfy.Help.OpenComfyUIDocs", - icon: "pi pi-info-circle", - label: "Open ComfyUI Docs", - menubarLabel: "ComfyUI Docs", - versionAdded: "1.5.5", - function: /* @__PURE__ */ __name(() => { - window.open("https://docs.comfy.org/", "_blank"); - }, "function") - }, - { - id: "Comfy.Help.OpenComfyOrgDiscord", - icon: "pi pi-discord", - label: "Open Comfy-Org Discord", - menubarLabel: "Comfy-Org Discord", - versionAdded: "1.5.5", - function: /* @__PURE__ */ __name(() => { - window.open("https://www.comfy.org/discord", "_blank"); - }, "function") - }, - { - id: "Workspace.SearchBox.Toggle", - icon: "pi pi-search", - label: "Toggle Search Box", - versionAdded: "1.5.7", - 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") - }, - { - id: "Workspace.CloseWorkflow", - icon: "pi pi-times", - label: "Close Current Workflow", - versionAdded: "1.7.3", - function: /* @__PURE__ */ __name(() => { - if (workflowStore.activeWorkflow) - workflowService.closeWorkflow(workflowStore.activeWorkflow); - }, "function") - }, - { - id: "Comfy.Feedback", - icon: "pi pi-megaphone", - label: "Give Feedback", - versionAdded: "1.8.2", - function: /* @__PURE__ */ __name(() => { - dialogService.showIssueReportDialog({ - title: t("g.feedback"), - subtitle: t("issueReport.feedbackTitle"), - panelProps: { - errorType: "Feedback", - defaultFields: ["SystemStats", "Settings"] - } - }); - }, "function") - }, - { - id: "Comfy.Help.OpenComfyUIForum", - icon: "pi pi-comments", - label: "Open ComfyUI Forum", - menubarLabel: "ComfyUI Forum", - versionAdded: "1.8.2", - function: /* @__PURE__ */ __name(() => { - window.open("https://forum.comfy.org/", "_blank"); - }, "function") - } - ]; -} -__name(useCoreCommands, "useCoreCommands"); -var LatentPreviewMethod = /* @__PURE__ */ ((LatentPreviewMethod2) => { - LatentPreviewMethod2["NoPreviews"] = "none"; - LatentPreviewMethod2["Auto"] = "auto"; - LatentPreviewMethod2["Latent2RGB"] = "latent2rgb"; - LatentPreviewMethod2["TAESD"] = "taesd"; - return LatentPreviewMethod2; -})(LatentPreviewMethod || {}); -var LogLevel = /* @__PURE__ */ ((LogLevel2) => { - LogLevel2["DEBUG"] = "DEBUG"; - LogLevel2["INFO"] = "INFO"; - LogLevel2["WARNING"] = "WARNING"; - LogLevel2["ERROR"] = "ERROR"; - LogLevel2["CRITICAL"] = "CRITICAL"; - return LogLevel2; -})(LogLevel || {}); -var HashFunction = /* @__PURE__ */ ((HashFunction2) => { - HashFunction2["MD5"] = "md5"; - HashFunction2["SHA1"] = "sha1"; - HashFunction2["SHA256"] = "sha256"; - HashFunction2["SHA512"] = "sha512"; - return HashFunction2; -})(HashFunction || {}); -var AutoLaunch = /* @__PURE__ */ ((AutoLaunch2) => { - AutoLaunch2["Auto"] = "auto"; - AutoLaunch2["Disable"] = "disable"; - AutoLaunch2["Enable"] = "enable"; - return AutoLaunch2; -})(AutoLaunch || {}); -var CudaMalloc = /* @__PURE__ */ ((CudaMalloc2) => { - CudaMalloc2["Auto"] = "auto"; - CudaMalloc2["Disable"] = "disable"; - CudaMalloc2["Enable"] = "enable"; - return CudaMalloc2; -})(CudaMalloc || {}); -var FloatingPointPrecision = /* @__PURE__ */ ((FloatingPointPrecision2) => { - FloatingPointPrecision2["AUTO"] = "auto"; - FloatingPointPrecision2["FP64"] = "fp64"; - FloatingPointPrecision2["FP32"] = "fp32"; - FloatingPointPrecision2["FP16"] = "fp16"; - FloatingPointPrecision2["BF16"] = "bf16"; - FloatingPointPrecision2["FP8E4M3FN"] = "fp8_e4m3fn"; - FloatingPointPrecision2["FP8E5M2"] = "fp8_e5m2"; - return FloatingPointPrecision2; -})(FloatingPointPrecision || {}); -var CrossAttentionMethod = /* @__PURE__ */ ((CrossAttentionMethod2) => { - CrossAttentionMethod2["Auto"] = "auto"; - CrossAttentionMethod2["Split"] = "split"; - CrossAttentionMethod2["Quad"] = "quad"; - CrossAttentionMethod2["Pytorch"] = "pytorch"; - return CrossAttentionMethod2; -})(CrossAttentionMethod || {}); -var VramManagement = /* @__PURE__ */ ((VramManagement2) => { - VramManagement2["Auto"] = "auto"; - VramManagement2["GPUOnly"] = "gpu-only"; - VramManagement2["HighVram"] = "highvram"; - VramManagement2["NormalVram"] = "normalvram"; - VramManagement2["LowVram"] = "lowvram"; - VramManagement2["NoVram"] = "novram"; - VramManagement2["CPU"] = "cpu"; - return VramManagement2; -})(VramManagement || {}); -const WEB_ONLY_CONFIG_ITEMS = [ - // Launch behavior - { - id: "auto-launch", - name: "Automatically opens in the browser on startup", - category: ["Launch"], - type: "combo", - options: Object.values(AutoLaunch), - defaultValue: AutoLaunch.Auto, - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case AutoLaunch.Auto: - return {}; - case AutoLaunch.Enable: - return { - ["auto-launch"]: true - }; - case AutoLaunch.Disable: - return { - ["disable-auto-launch"]: true - }; - } - }, "getValue") - } -]; -const SERVER_CONFIG_ITEMS = [ - // Network settings - { - id: "listen", - name: "Host: The IP address to listen on", - category: ["Network"], - type: "text", - defaultValue: "127.0.0.1" - }, - { - id: "port", - name: "Port: The port to listen on", - category: ["Network"], - type: "number", - // The default launch port for desktop app is 8000 instead of 8188. - defaultValue: 8e3 - }, - { - id: "tls-keyfile", - name: "TLS Key File: Path to TLS key file for HTTPS", - category: ["Network"], - type: "text", - defaultValue: "" - }, - { - id: "tls-certfile", - name: "TLS Certificate File: Path to TLS certificate file for HTTPS", - category: ["Network"], - type: "text", - defaultValue: "" - }, - { - id: "enable-cors-header", - name: 'Enable CORS header: Use "*" for all origins or specify domain', - category: ["Network"], - type: "text", - defaultValue: "" - }, - { - id: "max-upload-size", - name: "Maximum upload size (MB)", - category: ["Network"], - type: "number", - defaultValue: 100 - }, - // CUDA settings - { - id: "cuda-device", - name: "CUDA device index to use", - category: ["CUDA"], - type: "number", - defaultValue: null - }, - { - id: "cuda-malloc", - name: "Use CUDA malloc for memory allocation", - category: ["CUDA"], - type: "combo", - options: Object.values(CudaMalloc), - defaultValue: CudaMalloc.Auto, - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case CudaMalloc.Auto: - return {}; - case CudaMalloc.Enable: - return { - ["cuda-malloc"]: true - }; - case CudaMalloc.Disable: - return { - ["disable-cuda-malloc"]: true - }; - } - }, "getValue") - }, - // Precision settings - { - id: "global-precision", - name: "Global floating point precision", - category: ["Inference"], - type: "combo", - options: [ - FloatingPointPrecision.AUTO, - FloatingPointPrecision.FP32, - FloatingPointPrecision.FP16 - ], - defaultValue: FloatingPointPrecision.AUTO, - tooltip: "Global floating point precision", - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case FloatingPointPrecision.AUTO: - return {}; - case FloatingPointPrecision.FP32: - return { - ["force-fp32"]: true - }; - case FloatingPointPrecision.FP16: - return { - ["force-fp16"]: true - }; - default: - return {}; - } - }, "getValue") - }, - // UNET precision - { - id: "unet-precision", - name: "UNET precision", - category: ["Inference"], - type: "combo", - options: [ - FloatingPointPrecision.AUTO, - FloatingPointPrecision.FP64, - FloatingPointPrecision.FP32, - FloatingPointPrecision.FP16, - FloatingPointPrecision.BF16, - FloatingPointPrecision.FP8E4M3FN, - FloatingPointPrecision.FP8E5M2 - ], - defaultValue: FloatingPointPrecision.AUTO, - tooltip: "UNET precision", - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case FloatingPointPrecision.AUTO: - return {}; - default: - return { - [`${value.toLowerCase()}-unet`]: true - }; - } - }, "getValue") - }, - // VAE settings - { - id: "vae-precision", - name: "VAE precision", - category: ["Inference"], - type: "combo", - options: [ - FloatingPointPrecision.AUTO, - FloatingPointPrecision.FP16, - FloatingPointPrecision.FP32, - FloatingPointPrecision.BF16 - ], - defaultValue: FloatingPointPrecision.AUTO, - tooltip: "VAE precision", - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case FloatingPointPrecision.AUTO: - return {}; - default: - return { - [`${value.toLowerCase()}-vae`]: true - }; - } - }, "getValue") - }, - { - id: "cpu-vae", - name: "Run VAE on CPU", - category: ["Inference"], - type: "boolean", - defaultValue: false - }, - // Text Encoder settings - { - id: "text-encoder-precision", - name: "Text Encoder precision", - category: ["Inference"], - type: "combo", - options: [ - FloatingPointPrecision.AUTO, - FloatingPointPrecision.FP8E4M3FN, - FloatingPointPrecision.FP8E5M2, - FloatingPointPrecision.FP16, - FloatingPointPrecision.FP32 - ], - defaultValue: FloatingPointPrecision.AUTO, - tooltip: "Text Encoder precision", - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case FloatingPointPrecision.AUTO: - return {}; - default: - return { - [`${value.toLowerCase()}-text-enc`]: true - }; - } - }, "getValue") - }, - // Memory and performance settings - { - id: "force-channels-last", - name: "Force channels-last memory format", - category: ["Memory"], - type: "boolean", - defaultValue: false - }, - { - id: "directml", - name: "DirectML device index", - category: ["Memory"], - type: "number", - defaultValue: null - }, - { - id: "disable-ipex-optimize", - name: "Disable IPEX optimization", - category: ["Memory"], - type: "boolean", - defaultValue: false - }, - // Preview settings - { - id: "preview-method", - name: "Method used for latent previews", - category: ["Preview"], - type: "combo", - options: Object.values(LatentPreviewMethod), - defaultValue: LatentPreviewMethod.NoPreviews - }, - { - id: "preview-size", - name: "Size of preview images", - category: ["Preview"], - type: "slider", - defaultValue: 512, - attrs: { - min: 128, - max: 2048, - step: 128 - } - }, - // Cache settings - { - id: "cache-classic", - name: "Use classic cache system", - category: ["Cache"], - type: "boolean", - defaultValue: false - }, - { - id: "cache-lru", - name: "Use LRU caching with a maximum of N node results cached.", - category: ["Cache"], - type: "number", - defaultValue: null, - tooltip: "May use more RAM/VRAM." - }, - // Attention settings - { - id: "cross-attention-method", - name: "Cross attention method", - category: ["Attention"], - type: "combo", - options: Object.values(CrossAttentionMethod), - defaultValue: CrossAttentionMethod.Auto, - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case CrossAttentionMethod.Auto: - return {}; - default: - return { - [`use-${value.toLowerCase()}-cross-attention`]: true - }; - } - }, "getValue") - }, - { - id: "disable-xformers", - name: "Disable xFormers optimization", - type: "boolean", - defaultValue: false - }, - { - id: "force-upcast-attention", - name: "Force attention upcast", - category: ["Attention"], - type: "boolean", - defaultValue: false - }, - { - id: "dont-upcast-attention", - name: "Prevent attention upcast", - category: ["Attention"], - type: "boolean", - defaultValue: false - }, - // VRAM management - { - id: "vram-management", - name: "VRAM management mode", - category: ["Memory"], - type: "combo", - options: Object.values(VramManagement), - defaultValue: VramManagement.Auto, - getValue: /* @__PURE__ */ __name((value) => { - switch (value) { - case VramManagement.Auto: - return {}; - default: - return { - [value]: true - }; - } - }, "getValue") - }, - { - id: "reserve-vram", - name: "Reserved VRAM (GB)", - category: ["Memory"], - type: "number", - defaultValue: null, - tooltip: "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." - }, - // Misc settings - { - id: "default-hashing-function", - name: "Default hashing function for model files", - type: "combo", - options: Object.values(HashFunction), - defaultValue: HashFunction.SHA256 - }, - { - id: "disable-smart-memory", - name: "Disable smart memory management", - tooltip: "Force ComfyUI to aggressively offload to regular ram instead of keeping models in vram when it can.", - category: ["Memory"], - type: "boolean", - defaultValue: false - }, - { - id: "deterministic", - name: "Make pytorch use slower deterministic algorithms when it can.", - type: "boolean", - defaultValue: false, - tooltip: "Note that this might not make images deterministic in all cases." - }, - { - id: "fast", - name: "Enable some untested and potentially quality deteriorating optimizations.", - type: "boolean", - defaultValue: false - }, - { - id: "dont-print-server", - name: "Don't print server output to console.", - type: "boolean", - defaultValue: false - }, - { - id: "disable-metadata", - name: "Disable saving prompt metadata in files.", - type: "boolean", - defaultValue: false - }, - { - id: "disable-all-custom-nodes", - name: "Disable loading all custom nodes.", - type: "boolean", - defaultValue: false - }, - { - id: "log-level", - name: "Logging verbosity level", - type: "combo", - options: Object.values(LogLevel), - defaultValue: LogLevel.INFO, - getValue: /* @__PURE__ */ __name((value) => { - return { - verbose: value - }; - }, "getValue") - }, - // Directories - { - id: "input-directory", - name: "Input directory", - category: ["Directories"], - type: "text", - defaultValue: "" - }, - { - id: "output-directory", - name: "Output directory", - category: ["Directories"], - type: "text", - defaultValue: "" - } -]; -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 _hoisted_1 = { class: "comfyui-body grid h-screen w-screen overflow-hidden" }; -const _hoisted_2 = { - class: "comfyui-body-top", - id: "comfyui-body-top" -}; -const _hoisted_3 = { - class: "comfyui-body-bottom", - id: "comfyui-body-bottom" -}; -const _hoisted_4 = { - class: "graph-canvas-container", - id: "graph-canvas-container" -}; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "GraphView", - setup(__props) { - setupAutoQueueHandler(); - const { t: t2 } = useI18n(); - const toast = useToast(); - const settingStore = useSettingStore(); - const executionStore = useExecutionStore(); - const colorPaletteStore = useColorPaletteStore(); - const queueStore = useQueueStore(); - watch( - () => colorPaletteStore.completedActivePalette, - (newTheme) => { - const DARK_THEME_CLASS = "dark-theme"; - if (newTheme.light_theme) { - document.body.classList.remove(DARK_THEME_CLASS); - } else { - document.body.classList.add(DARK_THEME_CLASS); - } - if (isElectron()) { - electronAPI().changeTheme({ - color: "rgba(0, 0, 0, 0)", - symbolColor: newTheme.colors.comfy_base["input-text"] - }); - } - }, - { immediate: true } - ); - if (isElectron()) { - watch( - () => queueStore.tasks, - (newTasks, oldTasks) => { - const oldRunningTaskIds = new Set( - oldTasks.filter((task) => task.isRunning).map((task) => task.promptId) - ); - newTasks.filter( - (task) => oldRunningTaskIds.has(task.promptId) && task.isHistory - ).forEach((task) => { - electronAPI().Events.incrementUserProperty( - `execution:${task.displayStatus.toLowerCase()}`, - 1 - ); - electronAPI().Events.trackEvent("execution", { - status: task.displayStatus.toLowerCase() - }); - }); - }, - { deep: true } - ); - } - watchEffect(() => { - const fontSize = settingStore.get("Comfy.TextareaWidget.FontSize"); - document.documentElement.style.setProperty( - "--comfy-textarea-font-size", - `${fontSize}px` - ); - }); - watchEffect(() => { - const padding = settingStore.get("Comfy.TreeExplorer.ItemPadding"); - document.documentElement.style.setProperty( - "--comfy-tree-explorer-item-padding", - `${padding}px` - ); - }); - watchEffect(() => { - const locale = settingStore.get("Comfy.Locale"); - if (locale) { - i18n.global.locale.value = locale; - } - }); - const useNewMenu = computed(() => { - return settingStore.get("Comfy.UseNewMenu"); - }); - watchEffect(() => { - if (useNewMenu.value === "Disabled") { - app.ui.menuContainer.style.setProperty("display", "block"); - app.ui.restoreMenuPosition(); - } else { - app.ui.menuContainer.style.setProperty("display", "none"); - } - }); - watchEffect(() => { - queueStore.maxHistoryItems = settingStore.get("Comfy.Queue.MaxHistoryItems"); - }); - const init = /* @__PURE__ */ __name(() => { - const coreCommands = useCoreCommands(); - useCommandStore().registerCommands(coreCommands); - useMenuItemStore().registerCoreMenuCommands(); - useKeybindingService().registerCoreKeybindings(); - useSidebarTabStore().registerCoreSidebarTabs(); - useBottomPanelStore().registerCoreBottomPanelTabs(); - app.extensionManager = useWorkspaceStore(); - }, "init"); - const queuePendingTaskCountStore = useQueuePendingTaskCountStore(); - const onStatus = /* @__PURE__ */ __name(async (e) => { - queuePendingTaskCountStore.update(e); - await queueStore.update(); - }, "onStatus"); - const reconnectingMessage = { - severity: "error", - summary: t2("g.reconnecting") - }; - const onReconnecting = /* @__PURE__ */ __name(() => { - toast.remove(reconnectingMessage); - toast.add(reconnectingMessage); - }, "onReconnecting"); - const onReconnected = /* @__PURE__ */ __name(() => { - toast.remove(reconnectingMessage); - toast.add({ - severity: "success", - summary: t2("g.reconnected"), - life: 2e3 - }); - }, "onReconnected"); - onMounted(() => { - api.addEventListener("status", onStatus); - api.addEventListener("reconnecting", onReconnecting); - api.addEventListener("reconnected", onReconnected); - executionStore.bindExecutionEvents(); - try { - init(); - } catch (e) { - console.error("Failed to init ComfyUI frontend", e); - } - }); - onBeforeUnmount(() => { - api.removeEventListener("status", onStatus); - api.removeEventListener("reconnecting", onReconnecting); - api.removeEventListener("reconnected", onReconnected); - executionStore.unbindExecutionEvents(); - }); - useEventListener(window, "keydown", useKeybindingService().keybindHandler); - const { wrapWithErrorHandling, wrapWithErrorHandlingAsync } = useErrorHandling(); - const onGraphReady = /* @__PURE__ */ __name(() => { - requestIdleCallback( - () => { - wrapWithErrorHandling(useKeybindingService().registerUserKeybindings)(); - wrapWithErrorHandling(useServerConfigStore().loadServerConfig)( - SERVER_CONFIG_ITEMS, - settingStore.get("Comfy.Server.ServerConfigValues") - ); - wrapWithErrorHandlingAsync(useModelStore().loadModelFolders)(); - wrapWithErrorHandlingAsync(useNodeFrequencyStore().loadNodeFrequencies)(); - useNodeDefStore().nodeSearchService.endsWithFilterStartSequence(""); - }, - { timeout: 1e3 } - ); - }, "onGraphReady"); - return (_ctx, _cache) => { - return openBlock(), createElementBlock(Fragment, null, [ - createBaseVNode("div", _hoisted_1, [ - createBaseVNode("div", _hoisted_2, [ - useNewMenu.value === "Top" ? (openBlock(), createBlock(TopMenubar, { key: 0 })) : createCommentVNode("", true) - ]), - createBaseVNode("div", _hoisted_3, [ - useNewMenu.value === "Bottom" ? (openBlock(), createBlock(TopMenubar, { key: 0 })) : createCommentVNode("", true) - ]), - _cache[0] || (_cache[0] = createBaseVNode("div", { - class: "comfyui-body-left", - id: "comfyui-body-left" - }, null, -1)), - _cache[1] || (_cache[1] = createBaseVNode("div", { - class: "comfyui-body-right", - id: "comfyui-body-right" - }, null, -1)), - createBaseVNode("div", _hoisted_4, [ - createVNode(_sfc_main$8, { onReady: onGraphReady }) - ]) - ]), - createVNode(_sfc_main$7), - !unref(isElectron)() ? (openBlock(), createBlock(_sfc_main$s, { key: 0 })) : createCommentVNode("", true), - createVNode(_sfc_main$u), - createVNode(MenuHamburger) - ], 64); - }; - } -}); -const GraphView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e89d9273"]]); -export { - GraphView as default -}; -//# sourceMappingURL=GraphView-B_UDZi95.js.map diff --git a/web/assets/GraphView-Bo28XDd0.css b/web/assets/GraphView-Bo28XDd0.css deleted file mode 100644 index aab80799b..000000000 --- a/web/assets/GraphView-Bo28XDd0.css +++ /dev/null @@ -1,383 +0,0 @@ - -.comfy-menu-hamburger[data-v-82120b51] { - position: fixed; - z-index: 9999; - display: flex; - flex-direction: row -} - -[data-v-e50caa15] .p-splitter-gutter { - pointer-events: auto; -} -[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-e50caa15] { - background-color: var(--bg-color); - pointer-events: auto; -} -.bottom-panel[data-v-e50caa15] { - background-color: var(--bg-color); - pointer-events: auto; -} -.splitter-overlay[data-v-e50caa15] { - pointer-events: none; - border-style: none; - background-color: transparent; -} -.splitter-overlay-root[data-v-e50caa15] { - position: absolute; - top: 0px; - left: 0px; - height: 100%; - width: 100%; - - /* Set it the same as the ComfyUI menu */ - /* Note: Lite-graph DOM widgets have the same z-index as the node id, so - 999 should be sufficient to make sure splitter overlays on node's DOM - widgets */ - z-index: 999; -} - -.p-buttongroup-vertical[data-v-27a9500c] { - 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-27a9500c] { - margin: 0; - border-radius: 0; -} - -.node-tooltip[data-v-f03142eb] { - 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-fd0a74bd] .highlight { - background-color: var(--p-primary-color); - color: var(--p-primary-contrast-color); - font-weight: bold; - border-radius: 0.25rem; - padding: 0rem 0.125rem; - margin: -0.125rem 0.125rem; -} - -.invisible-dialog-root { - width: 60%; - min-width: 24rem; - max-width: 48rem; - border: 0 !important; - background-color: transparent !important; - margin-top: 25vh; - margin-left: 400px; -} -@media all and (max-width: 768px) { -.invisible-dialog-root { - margin-left: 0px; -} -} -.node-search-box-dialog-mask { - align-items: flex-start !important; -} - -.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-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); -} - -.side-tool-bar-container[data-v-04875455] { - display: flex; - flex-direction: column; - align-items: center; - - width: var(--sidebar-width); - height: 100%; - - background-color: var(--comfy-menu-secondary-bg); - color: var(--fg-color); - box-shadow: var(--bar-shadow); - - --sidebar-width: 4rem; - --sidebar-icon-size: 1.5rem; -} -.side-tool-bar-container.small-sidebar[data-v-04875455] { - --sidebar-width: 2.5rem; - --sidebar-icon-size: 1rem; -} -.side-tool-bar-end[data-v-04875455] { - align-self: flex-end; - margin-top: auto; -} - -.status-indicator[data-v-fd6ae3af] { - position: absolute; - font-weight: 700; - font-size: 1.5rem; - top: 50%; - left: 50%; - transform: translate(-50%, -50%) -} - -[data-v-54fadc45] .p-togglebutton { - position: relative; - flex-shrink: 0; - border-radius: 0px; - border-width: 0px; - border-right-width: 1px; - border-style: solid; - background-color: transparent; - padding: 0px; - border-right-color: var(--border-color) -} -[data-v-54fadc45] .p-togglebutton::before { - display: none -} -[data-v-54fadc45] .p-togglebutton:first-child { - border-left-width: 1px; - border-style: solid; - border-left-color: var(--border-color) -} -[data-v-54fadc45] .p-togglebutton:not(:first-child) { - border-left-width: 0px -} -[data-v-54fadc45] .p-togglebutton.p-togglebutton-checked { - height: 100%; - border-bottom-width: 1px; - border-style: solid; - border-bottom-color: var(--p-button-text-primary-color) -} -[data-v-54fadc45] .p-togglebutton:not(.p-togglebutton-checked) { - opacity: 0.75 -} -[data-v-54fadc45] .p-togglebutton-checked .close-button,[data-v-54fadc45] .p-togglebutton:hover .close-button { - visibility: visible -} -[data-v-54fadc45] .p-togglebutton:hover .status-indicator { - display: none -} -[data-v-54fadc45] .p-togglebutton .close-button { - visibility: hidden -} -[data-v-54fadc45] .p-scrollpanel-content { - height: 100% -} - -/* Scrollbar half opacity to avoid blocking the active tab bottom border */ -[data-v-54fadc45] .p-scrollpanel:hover .p-scrollpanel-bar,[data-v-54fadc45] .p-scrollpanel:active .p-scrollpanel-bar { - opacity: 0.5 -} -[data-v-54fadc45] .p-selectbutton { - height: 100%; - border-radius: 0px -} - -[data-v-6ab68035] .workflow-tabs { - background-color: var(--comfy-menu-bg); -} - -[data-v-26957f1f] .p-inputtext { - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} - -.comfyui-queue-button[data-v-91a628af] .p-splitbutton-dropdown { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} - -.actionbar[data-v-ebd56d51] { - pointer-events: all; - position: fixed; - z-index: 1000; -} -.actionbar.is-docked[data-v-ebd56d51] { - position: static; - border-style: none; - background-color: transparent; - padding: 0px; -} -.actionbar.is-dragging[data-v-ebd56d51] { - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; -} -[data-v-ebd56d51] .p-panel-content { - padding: 0.25rem; -} -.is-docked[data-v-ebd56d51] .p-panel-content { - padding: 0px; -} -[data-v-ebd56d51] .p-panel-header { - display: none; -} -.drag-handle[data-v-ebd56d51] { - height: -moz-max-content; - height: max-content; - width: 0.75rem; -} - -.top-menubar[data-v-56df69d2] .p-menubar-item-link svg { - display: none; -} -[data-v-56df69d2] .p-menubar-submenu.dropdown-direction-up { - top: auto; - bottom: 100%; - flex-direction: column-reverse; -} -.keybinding-tag[data-v-56df69d2] { - background: var(--p-content-hover-background); - border-color: var(--p-content-border-color); - border-style: solid; -} - -.comfyui-menu[data-v-68d3b5b9] { - width: 100vw; - height: var(--comfy-topbar-height); - background: var(--comfy-menu-bg); - color: var(--fg-color); - box-shadow: var(--bar-shadow); - font-family: Arial, Helvetica, sans-serif; - font-size: 0.8em; - box-sizing: border-box; - z-index: 1000; - order: 0; - grid-column: 1/-1; -} -.comfyui-menu.dropzone[data-v-68d3b5b9] { - background: var(--p-highlight-background); -} -.comfyui-menu.dropzone-active[data-v-68d3b5b9] { - background: var(--p-highlight-background-focus); -} -[data-v-68d3b5b9] .p-menubar-item-label { - line-height: revert; -} -.comfyui-logo[data-v-68d3b5b9] { - font-size: 1.2em; - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; - cursor: default; -} - -.comfyui-body[data-v-e89d9273] { - grid-template-columns: auto 1fr auto; - grid-template-rows: auto 1fr auto; -} - -/** - +------------------+------------------+------------------+ - | | - | .comfyui-body- | - | top | - | (spans all cols) | - | | - +------------------+------------------+------------------+ - | | | | - | .comfyui-body- | #graph-canvas | .comfyui-body- | - | left | | right | - | | | | - | | | | - +------------------+------------------+------------------+ - | | - | .comfyui-body- | - | bottom | - | (spans all cols) | - | | - +------------------+------------------+------------------+ -*/ -.comfyui-body-top[data-v-e89d9273] { - order: -5; - /* Span across all columns */ - grid-column: 1/-1; - /* Position at the first row */ - grid-row: 1; - /* Top menu bar dropdown needs to be above of graph canvas splitter overlay which is z-index: 999 */ - /* Top menu bar z-index needs to be higher than bottom menu bar z-index as by default - pysssss's image feed is located at body-bottom, and it can overlap with the queue button, which - is located in body-top. */ - z-index: 1001; - display: flex; - flex-direction: column; -} -.comfyui-body-left[data-v-e89d9273] { - order: -4; - /* Position in the first column */ - grid-column: 1; - /* Position below the top element */ - grid-row: 2; - z-index: 10; - display: flex; -} -.graph-canvas-container[data-v-e89d9273] { - width: 100%; - height: 100%; - order: -3; - grid-column: 2; - grid-row: 2; - position: relative; - overflow: hidden; -} -.comfyui-body-right[data-v-e89d9273] { - order: -2; - z-index: 10; - grid-column: 3; - grid-row: 2; -} -.comfyui-body-bottom[data-v-e89d9273] { - order: 4; - /* Span across all columns */ - grid-column: 1/-1; - grid-row: 3; - /* Bottom menu bar dropdown needs to be above of graph canvas splitter overlay which is z-index: 999 */ - z-index: 1000; - display: flex; - flex-direction: column; -} diff --git a/web/assets/InstallView-DW9xwU_F.js b/web/assets/InstallView-DW9xwU_F.js deleted file mode 100644 index e7e2509e9..000000000 --- a/web/assets/InstallView-DW9xwU_F.js +++ /dev/null @@ -1,971 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, T as ref, bq as useModel, o as openBlock, f as createElementBlock, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, br as script, bl as script$1, as as withModifiers, z as withCtx, ac as script$2, I as useI18n, c as computed, aj as normalizeClass, B as createCommentVNode, a5 as script$3, a8 as createTextVNode, b9 as electronAPI, _ as _export_sfc, p as onMounted, r as resolveDirective, bk as script$4, i as withDirectives, bs as script$5, bt as script$6, l as script$7, y as createBlock, bn as script$8, bu as MigrationItems, w as watchEffect, F as Fragment, D as renderList, bv as script$9, bw as mergeModels, bx as ValidationState, X as normalizeI18nKey, N as watch, by as checkMirrorReachable, bz as _sfc_main$7, bA as isInChina, bB as mergeValidationStates, bg as t, b3 as script$a, bC as CUDA_TORCH_URL, bD as NIGHTLY_CPU_TORCH_URL, bi as useRouter, ah as toRaw } from "./index-Bv0b06LE.js"; -import { s as script$b, a as script$c, b as script$d, c as script$e, d as script$f } from "./index-SeIZOWJp.js"; -import { P as PYTHON_MIRROR, a as PYPI_MIRROR } from "./uvMirrors-B-HKMf6X.js"; -import { _ as _sfc_main$8 } from "./BaseViewTemplate-BTbuZf5t.js"; -const _hoisted_1$5 = { class: "flex flex-col gap-6 w-[600px]" }; -const _hoisted_2$5 = { class: "flex flex-col gap-4" }; -const _hoisted_3$5 = { class: "text-2xl font-semibold text-neutral-100" }; -const _hoisted_4$5 = { 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$1 = { class: "text-sm text-neutral-400 mt-1" }; -const _hoisted_14$1 = { 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 _hoisted_19 = { class: "mt-4" }; -const _hoisted_20 = { - href: "https://comfy.org/privacy", - target: "_blank", - class: "text-blue-400 hover:text-blue-300 underline" -}; -const _sfc_main$6 = /* @__PURE__ */ defineComponent({ - __name: "DesktopSettingsConfiguration", - props: { - "autoUpdate": { type: Boolean, ...{ required: true } }, - "autoUpdateModifiers": {}, - "allowMetrics": { type: Boolean, ...{ 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$5, [ - createBaseVNode("div", _hoisted_2$5, [ - createBaseVNode("h2", _hoisted_3$5, toDisplayString(_ctx.$t("install.desktopAppSettings")), 1), - createBaseVNode("p", _hoisted_4$5, 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), { - modelValue: autoUpdate.value, - "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => autoUpdate.value = $event) - }, null, 8, ["modelValue"]) - ]), - createVNode(unref(script$1)), - 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$1, 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), { - modelValue: allowMetrics.value, - "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => allowMetrics.value = $event) - }, null, 8, ["modelValue"]) - ]) - ]), - createVNode(unref(script$2), { - 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$1, [ - 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.collect.errorReports")), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.collect.systemInfo")), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t( - "install.settings.dataCollectionDialog.collect.userJourneyEvents" - )), 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.doNotCollect.personalInformation" - )), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t( - "install.settings.dataCollectionDialog.doNotCollect.workflowContents" - )), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t( - "install.settings.dataCollectionDialog.doNotCollect.fileSystemInformation" - )), 1), - createBaseVNode("li", null, toDisplayString(_ctx.$t( - "install.settings.dataCollectionDialog.doNotCollect.customNodeConfigurations" - )), 1) - ]), - createBaseVNode("div", _hoisted_19, [ - createBaseVNode("a", _hoisted_20, toDisplayString(_ctx.$t("install.settings.dataCollectionDialog.viewFullPolicy")), 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$4 = { class: "flex flex-col gap-6 w-[600px] h-[30rem] select-none" }; -const _hoisted_2$4 = { class: "grow flex flex-col gap-4 text-neutral-300" }; -const _hoisted_3$4 = { class: "text-2xl font-semibold text-neutral-100" }; -const _hoisted_4$4 = { class: "m-1 text-neutral-400" }; -const _hoisted_5$2 = { - key: 0, - class: "m-1" -}; -const _hoisted_6$2 = { - key: 1, - class: "m-1" -}; -const _hoisted_7$2 = { - key: 2, - class: "text-neutral-300" -}; -const _hoisted_8$2 = { class: "m-1" }; -const _hoisted_9$2 = { key: 3 }; -const _hoisted_10$2 = { class: "m-1" }; -const _hoisted_11$2 = { class: "m-1" }; -const _hoisted_12$2 = { - for: "cpu-mode", - class: "select-none" -}; -const _sfc_main$5 = /* @__PURE__ */ defineComponent({ - __name: "GpuPicker", - props: { - "device": { - required: true - }, - "deviceModifiers": {} - }, - emits: ["update:device"], - setup(__props) { - const { t: t2 } = useI18n(); - const cpuMode = computed({ - get: /* @__PURE__ */ __name(() => selected.value === "cpu", "get"), - set: /* @__PURE__ */ __name((value) => { - selected.value = value ? "cpu" : null; - }, "set") - }); - const selected = useModel(__props, "device"); - const electron = electronAPI(); - const platform = electron.getPlatform(); - const pickGpu = /* @__PURE__ */ __name((value) => { - const newValue = selected.value === value ? null : value; - selected.value = newValue; - }, "pickGpu"); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$4, [ - createBaseVNode("div", _hoisted_2$4, [ - createBaseVNode("h2", _hoisted_3$4, toDisplayString(_ctx.$t("install.gpuSelection.selectGpu")), 1), - createBaseVNode("p", _hoisted_4$4, 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")) - }, _cache[4] || (_cache[4] = [ - createBaseVNode("img", { - class: "m-12", - alt: "NVIDIA logo", - width: "196", - height: "32", - src: _imports_0 - }, null, -1) - ]), 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")) - }, _cache[5] || (_cache[5] = [ - createBaseVNode("img", { - class: "rounded-lg hover-brighten", - alt: "Apple Metal Performance Shaders Logo", - width: "292", - ratio: "", - src: _imports_1 - }, null, -1) - ]), 2)) : createCommentVNode("", true), - createBaseVNode("div", { - class: normalizeClass(["gpu-button", { selected: selected.value === "unsupported" }]), - role: "button", - onClick: _cache[2] || (_cache[2] = ($event) => pickGpu("unsupported")) - }, _cache[6] || (_cache[6] = [ - createBaseVNode("img", { - class: "m-12", - alt: "Manual configuration", - width: "196", - src: _imports_2 - }, null, -1) - ]), 2) - ], 2), - selected.value === "nvidia" ? (openBlock(), createElementBlock("p", _hoisted_5$2, [ - createVNode(unref(script$3), { - 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_6$2, [ - createVNode(unref(script$3), { - 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_7$2, [ - createBaseVNode("p", _hoisted_8$2, [ - createVNode(unref(script$3), { - icon: "pi pi-exclamation-triangle", - severity: "warn", - value: unref(t2)("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_9$2, [ - createBaseVNode("p", _hoisted_10$2, [ - createVNode(unref(script$3), { - icon: "pi pi-exclamation-triangle", - severity: "warn", - value: unref(t2)("icon.exclamation-triangle") - }, null, 8, ["value"]), - createTextVNode(" " + toDisplayString(_ctx.$t("install.gpuSelection.cpuModeDescription")), 1) - ]), - createBaseVNode("p", _hoisted_11$2, 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), { - 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_12$2, toDisplayString(_ctx.$t("install.gpuSelection.enableCpuMode")), 1) - ], 2) - ]); - }; - } -}); -const GpuPicker = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-79125ff6"]]); -const _hoisted_1$3 = { class: "flex flex-col gap-6 w-[600px]" }; -const _hoisted_2$3 = { class: "flex flex-col gap-4" }; -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$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 = { class: "text-neutral-200" }; -const _hoisted_11$1 = { class: "pi pi-info-circle" }; -const _hoisted_12$1 = { class: "flex items-center gap-2" }; -const _hoisted_13 = { class: "text-neutral-200" }; -const _hoisted_14 = { class: "pi pi-info-circle" }; -const _sfc_main$4 = /* @__PURE__ */ defineComponent({ - __name: "InstallLocationPicker", - props: { - "installPath": { required: true }, - "installPathModifiers": {}, - "pathError": { required: true }, - "pathErrorModifiers": {} - }, - emits: ["update:installPath", "update:pathError"], - setup(__props) { - const { t: t2 } = useI18n(); - const installPath = useModel(__props, "installPath"); - const pathError = useModel(__props, "pathError"); - const pathExists = ref(false); - const appData = ref(""); - const appPath = ref(""); - const inputTouched = ref(false); - const electron = electronAPI(); - onMounted(async () => { - const paths = await electron.getSystemPaths(); - appData.value = paths.appData; - appPath.value = paths.appPath; - installPath.value = paths.defaultInstallPath; - await validatePath(paths.defaultInstallPath); - }); - const validatePath = /* @__PURE__ */ __name(async (path) => { - try { - pathError.value = ""; - pathExists.value = false; - const validation = await electron.validateInstallPath(path); - if (!validation.isValid) { - const errors = []; - if (validation.cannotWrite) errors.push(t2("install.cannotWrite")); - if (validation.freeSpace < validation.requiredSpace) { - const requiredGB = validation.requiredSpace / 1024 / 1024 / 1024; - errors.push(`${t2("install.insufficientFreeSpace")}: ${requiredGB} GB`); - } - if (validation.parentMissing) errors.push(t2("install.parentMissing")); - if (validation.error) - errors.push(`${t2("install.unhandledError")}: ${validation.error}`); - pathError.value = errors.join("\n"); - } - if (validation.exists) pathExists.value = true; - } catch (error) { - pathError.value = t2("install.pathValidationFailed"); - } - }, "validatePath"); - const browsePath = /* @__PURE__ */ __name(async () => { - try { - const result = await electron.showDirectoryPicker(); - if (result) { - installPath.value = result; - await validatePath(result); - } - } catch (error) { - pathError.value = t2("install.failedToSelectDirectory"); - } - }, "browsePath"); - const onFocus = /* @__PURE__ */ __name(() => { - if (!inputTouched.value) { - inputTouched.value = true; - return; - } - validatePath(installPath.value); - }, "onFocus"); - 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$1, [ - createVNode(unref(script$6), { class: "flex-1" }, { - default: withCtx(() => [ - createVNode(unref(script$4), { - modelValue: installPath.value, - "onUpdate:modelValue": [ - _cache[0] || (_cache[0] = ($event) => installPath.value = $event), - validatePath - ], - class: normalizeClass(["w-full", { "p-invalid": pathError.value }]), - onFocus - }, null, 8, ["modelValue", "class"]), - withDirectives(createVNode(unref(script$5), { class: "pi pi-info-circle" }, null, 512), [ - [ - _directive_tooltip, - _ctx.$t("install.installLocationTooltip"), - void 0, - { top: true } - ] - ]) - ]), - _: 1 - }), - createVNode(unref(script$7), { - icon: "pi pi-folder", - onClick: browsePath, - class: "w-12" - }) - ]), - pathError.value ? (openBlock(), createBlock(unref(script$8), { - key: 0, - severity: "error", - class: "whitespace-pre-line" - }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(pathError.value), 1) - ]), - _: 1 - })) : createCommentVNode("", true), - pathExists.value ? (openBlock(), createBlock(unref(script$8), { - key: 1, - severity: "warn" - }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(_ctx.$t("install.pathExists")), 1) - ]), - _: 1 - })) : createCommentVNode("", true) - ]), - 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, [ - _cache[1] || (_cache[1] = createBaseVNode("i", { class: "pi pi-folder text-neutral-400" }, null, -1)), - _cache[2] || (_cache[2] = createBaseVNode("span", { class: "text-neutral-400" }, "App Data:", -1)), - createBaseVNode("span", _hoisted_10$1, toDisplayString(appData.value), 1), - withDirectives(createBaseVNode("span", _hoisted_11$1, null, 512), [ - [_directive_tooltip, _ctx.$t("install.appDataLocationTooltip")] - ]) - ]), - createBaseVNode("div", _hoisted_12$1, [ - _cache[3] || (_cache[3] = createBaseVNode("i", { class: "pi pi-desktop text-neutral-400" }, null, -1)), - _cache[4] || (_cache[4] = createBaseVNode("span", { class: "text-neutral-400" }, "App Path:", -1)), - createBaseVNode("span", _hoisted_13, toDisplayString(appPath.value), 1), - withDirectives(createBaseVNode("span", _hoisted_14, null, 512), [ - [_directive_tooltip, _ctx.$t("install.appPathLocationTooltip")] - ]) - ]) - ]) - ]) - ]); - }; - } -}); -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 = { 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 = { 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$3 = /* @__PURE__ */ defineComponent({ - __name: "MigrationPicker", - props: { - "sourcePath": { required: false }, - "sourcePathModifiers": {}, - "migrationItemIds": { - required: false - }, - "migrationItemIdsModifiers": {} - }, - emits: ["update:sourcePath", "update:migrationItemIds"], - setup(__props) { - const { t: t2 } = useI18n(); - const electron = electronAPI(); - const sourcePath = useModel(__props, "sourcePath"); - const migrationItemIds = useModel(__props, "migrationItemIds"); - const migrationItems = ref( - MigrationItems.map((item) => ({ - ...item, - selected: true - })) - ); - const pathError = ref(""); - const isValidSource = computed( - () => sourcePath.value !== "" && pathError.value === "" - ); - const validateSource = /* @__PURE__ */ __name(async (sourcePath2) => { - if (!sourcePath2) { - pathError.value = ""; - return; - } - try { - pathError.value = ""; - const validation = await electron.validateComfyUISource(sourcePath2); - if (!validation.isValid) pathError.value = validation.error; - } catch (error) { - console.error(error); - pathError.value = t2("install.pathValidationFailed"); - } - }, "validateSource"); - const browsePath = /* @__PURE__ */ __name(async () => { - try { - const result = await electron.showDirectoryPicker(); - if (result) { - sourcePath.value = result; - await validateSource(result); - } - } catch (error) { - console.error(error); - pathError.value = t2("install.failedToSelectDirectory"); - } - }, "browsePath"); - watchEffect(() => { - 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, [ - createVNode(unref(script$4), { - modelValue: sourcePath.value, - "onUpdate:modelValue": [ - _cache[0] || (_cache[0] = ($event) => sourcePath.value = $event), - validateSource - ], - placeholder: "Select existing ComfyUI installation (optional)", - class: normalizeClass(["flex-1", { "p-invalid": pathError.value }]) - }, null, 8, ["modelValue", "class"]), - createVNode(unref(script$7), { - icon: "pi pi-folder", - onClick: browsePath, - class: "w-12" - }) - ]), - pathError.value ? (openBlock(), createBlock(unref(script$8), { - key: 0, - severity: "error" - }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(pathError.value), 1) - ]), - _: 1 - })) : createCommentVNode("", true) - ]), - 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$9), { - modelValue: item.selected, - "onUpdate:modelValue": /* @__PURE__ */ __name(($event) => item.selected = $event, "onUpdate:modelValue"), - inputId: item.id, - binary: true, - onClick: _cache[1] || (_cache[1] = withModifiers(() => { - }, ["stop"])) - }, null, 8, ["modelValue", "onUpdate:modelValue", "inputId"]), - createBaseVNode("div", null, [ - createBaseVNode("label", { - for: item.id, - class: "text-neutral-200 font-medium" - }, toDisplayString(item.label), 9, _hoisted_10), - createBaseVNode("p", _hoisted_11, toDisplayString(item.description), 1) - ]) - ], 8, _hoisted_9); - }), 128)) - ]) - ])) : (openBlock(), createElementBlock("div", _hoisted_12, toDisplayString(_ctx.$t("install.migrationOptional")), 1)) - ]); - }; - } -}); -const _hoisted_1$1 = { class: "flex flex-col items-center gap-4" }; -const _hoisted_2$1 = { class: "w-full" }; -const _hoisted_3$1 = { class: "text-lg font-medium text-neutral-100" }; -const _hoisted_4$1 = { class: "text-sm text-neutral-400 mt-1" }; -const _sfc_main$2 = /* @__PURE__ */ defineComponent({ - __name: "MirrorItem", - props: /* @__PURE__ */ mergeModels({ - item: {} - }, { - "modelValue": { required: true }, - "modelModifiers": {} - }), - emits: /* @__PURE__ */ mergeModels(["state-change"], ["update:modelValue"]), - setup(__props, { emit: __emit }) { - const emit = __emit; - const modelValue = useModel(__props, "modelValue"); - const validationState = ref(ValidationState.IDLE); - const normalizedSettingId = computed(() => { - return normalizeI18nKey(__props.item.settingId); - }); - onMounted(() => { - modelValue.value = __props.item.mirror; - }); - watch(validationState, (newState) => { - emit("state-change", newState); - if (newState === ValidationState.INVALID && modelValue.value === __props.item.mirror) { - modelValue.value = __props.item.fallbackMirror; - } - }); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", _hoisted_1$1, [ - createBaseVNode("div", _hoisted_2$1, [ - createBaseVNode("h3", _hoisted_3$1, toDisplayString(_ctx.$t(`settings.${normalizedSettingId.value}.name`)), 1), - createBaseVNode("p", _hoisted_4$1, toDisplayString(_ctx.$t(`settings.${normalizedSettingId.value}.tooltip`)), 1) - ]), - createVNode(_sfc_main$7, { - modelValue: modelValue.value, - "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event), - "validate-url-fn": /* @__PURE__ */ __name((mirror) => unref(checkMirrorReachable)(mirror + (_ctx.item.validationPathSuffix ?? "")), "validate-url-fn"), - onStateChange: _cache[1] || (_cache[1] = ($event) => validationState.value = $event) - }, null, 8, ["modelValue", "validate-url-fn"]) - ]); - }; - } -}); -const _sfc_main$1 = /* @__PURE__ */ defineComponent({ - __name: "MirrorsConfiguration", - props: /* @__PURE__ */ mergeModels({ - device: {} - }, { - "pythonMirror": { required: true }, - "pythonMirrorModifiers": {}, - "pypiMirror": { required: true }, - "pypiMirrorModifiers": {}, - "torchMirror": { required: true }, - "torchMirrorModifiers": {} - }), - emits: ["update:pythonMirror", "update:pypiMirror", "update:torchMirror"], - setup(__props) { - const showMirrorInputs = ref(false); - const pythonMirror = useModel(__props, "pythonMirror"); - const pypiMirror = useModel(__props, "pypiMirror"); - const torchMirror = useModel(__props, "torchMirror"); - const getTorchMirrorItem = /* @__PURE__ */ __name((device) => { - const settingId = "Comfy-Desktop.UV.TorchInstallMirror"; - switch (device) { - case "mps": - return { - settingId, - mirror: NIGHTLY_CPU_TORCH_URL, - fallbackMirror: NIGHTLY_CPU_TORCH_URL - }; - case "nvidia": - return { - settingId, - mirror: CUDA_TORCH_URL, - fallbackMirror: CUDA_TORCH_URL - }; - case "cpu": - default: - return { - settingId, - mirror: PYPI_MIRROR.mirror, - fallbackMirror: PYPI_MIRROR.fallbackMirror - }; - } - }, "getTorchMirrorItem"); - const userIsInChina = ref(false); - onMounted(async () => { - userIsInChina.value = await isInChina(); - }); - const useFallbackMirror = /* @__PURE__ */ __name((mirror) => ({ - ...mirror, - mirror: mirror.fallbackMirror - }), "useFallbackMirror"); - const mirrors = computed( - () => [ - [PYTHON_MIRROR, pythonMirror], - [PYPI_MIRROR, pypiMirror], - [getTorchMirrorItem(__props.device), torchMirror] - ].map(([item, modelValue]) => [ - userIsInChina.value ? useFallbackMirror(item) : item, - modelValue - ]) - ); - const validationStates = ref( - mirrors.value.map(() => ValidationState.IDLE) - ); - const validationState = computed(() => { - return mergeValidationStates(validationStates.value); - }); - const validationStateTooltip = computed(() => { - switch (validationState.value) { - case ValidationState.INVALID: - return t("install.settings.mirrorsUnreachable"); - case ValidationState.VALID: - return t("install.settings.mirrorsReachable"); - default: - return t("install.settings.checkingMirrors"); - } - }); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createBlock(unref(script$a), { - header: _ctx.$t("install.settings.mirrorSettings"), - toggleable: "", - collapsed: !showMirrorInputs.value, - "pt:root": "bg-neutral-800 border-none w-[600px]" - }, { - icons: withCtx(() => [ - withDirectives(createBaseVNode("i", { - class: normalizeClass({ - "pi pi-spin pi-spinner text-neutral-400": validationState.value === unref(ValidationState).LOADING, - "pi pi-check text-green-500": validationState.value === unref(ValidationState).VALID, - "pi pi-times text-red-500": validationState.value === unref(ValidationState).INVALID - }) - }, null, 2), [ - [_directive_tooltip, validationStateTooltip.value] - ]) - ]), - default: withCtx(() => [ - (openBlock(true), createElementBlock(Fragment, null, renderList(mirrors.value, ([item, modelValue], index) => { - return openBlock(), createElementBlock(Fragment, { - key: item.settingId + item.mirror - }, [ - index > 0 ? (openBlock(), createBlock(unref(script$1), { key: 0 })) : createCommentVNode("", true), - createVNode(_sfc_main$2, { - item, - modelValue: modelValue.value, - "onUpdate:modelValue": /* @__PURE__ */ __name(($event) => modelValue.value = $event, "onUpdate:modelValue"), - onStateChange: /* @__PURE__ */ __name(($event) => validationStates.value[index] = $event, "onStateChange") - }, null, 8, ["item", "modelValue", "onUpdate:modelValue", "onStateChange"]) - ], 64); - }), 128)) - ]), - _: 1 - }, 8, ["header", "collapsed"]); - }; - } -}); -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 mt-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 pythonMirror = ref(""); - const pypiMirror = ref(""); - const torchMirror = ref(""); - const highestStep = ref(0); - const handleStepChange = /* @__PURE__ */ __name((value) => { - setHighestStep(value); - electronAPI().Events.trackEvent("install_stepper_change", { - step: value - }); - }, "handleStepChange"); - const setHighestStep = /* @__PURE__ */ __name((value) => { - const int = typeof value === "number" ? value : parseInt(value, 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 = { - installPath: installPath.value, - autoUpdate: autoUpdate.value, - allowMetrics: allowMetrics.value, - migrationSourcePath: migrationSourcePath.value, - migrationItemIds: toRaw(migrationItemIds.value), - pythonMirror: pythonMirror.value, - pypiMirror: pypiMirror.value, - torchMirror: torchMirror.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; - } - electronAPI().Events.trackEvent("install_stepper_change", { - step: "0", - gpu: detectedGpu - }); - }); - return (_ctx, _cache) => { - return openBlock(), createBlock(_sfc_main$8, { dark: "" }, { - default: withCtx(() => [ - createVNode(unref(script$f), { - class: "h-full p-8 2xl:p-16", - value: "0", - "onUpdate:value": handleStepChange - }, { - default: withCtx(() => [ - createVNode(unref(script$b), { class: "select-none" }, { - default: withCtx(() => [ - createVNode(unref(script$c), { value: "0" }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(_ctx.$t("install.gpu")), 1) - ]), - _: 1 - }), - createVNode(unref(script$c), { - value: "1", - disabled: noGpu.value - }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(_ctx.$t("install.installLocation")), 1) - ]), - _: 1 - }, 8, ["disabled"]), - createVNode(unref(script$c), { - 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$c), { - 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$d), null, { - default: withCtx(() => [ - createVNode(unref(script$e), { value: "0" }, { - default: withCtx(({ activateCallback }) => [ - createVNode(GpuPicker, { - device: device.value, - "onUpdate:device": _cache[0] || (_cache[0] = ($event) => device.value = $event) - }, null, 8, ["device"]), - createBaseVNode("div", _hoisted_1, [ - createVNode(unref(script$7), { - 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$e), { value: "1" }, { - default: withCtx(({ activateCallback }) => [ - createVNode(_sfc_main$4, { - 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$7), { - 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$7), { - 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$e), { value: "2" }, { - default: withCtx(({ activateCallback }) => [ - createVNode(_sfc_main$3, { - 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$7), { - 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$7), { - 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$e), { value: "3" }, { - default: withCtx(({ activateCallback }) => [ - createVNode(_sfc_main$6, { - 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"]), - createVNode(_sfc_main$1, { - device: device.value, - pythonMirror: pythonMirror.value, - "onUpdate:pythonMirror": _cache[7] || (_cache[7] = ($event) => pythonMirror.value = $event), - pypiMirror: pypiMirror.value, - "onUpdate:pypiMirror": _cache[8] || (_cache[8] = ($event) => pypiMirror.value = $event), - torchMirror: torchMirror.value, - "onUpdate:torchMirror": _cache[9] || (_cache[9] = ($event) => torchMirror.value = $event), - class: "mt-6" - }, null, 8, ["device", "pythonMirror", "pypiMirror", "torchMirror"]), - createBaseVNode("div", _hoisted_4, [ - createVNode(unref(script$7), { - 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$7), { - label: _ctx.$t("g.install"), - icon: "pi pi-check", - iconPos: "right", - disabled: hasError.value, - onClick: _cache[10] || (_cache[10] = ($event) => install()) - }, null, 8, ["label", "disabled"]) - ]) - ]), - _: 1 - }) - ]), - _: 1 - }) - ]), - _: 1 - }) - ]), - _: 1 - }); - }; - } -}); -const InstallView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cd6731d2"]]); -export { - InstallView as default -}; -//# sourceMappingURL=InstallView-DW9xwU_F.js.map diff --git a/web/assets/InstallView-DbJ2cGfL.css b/web/assets/InstallView-DbJ2cGfL.css deleted file mode 100644 index 5bbebb809..000000000 --- a/web/assets/InstallView-DbJ2cGfL.css +++ /dev/null @@ -1,81 +0,0 @@ - -.p-tag[data-v-79125ff6] { - --p-tag-gap: 0.5rem; -} -.hover-brighten { -&[data-v-79125ff6] { - 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; - } -&[data-v-79125ff6]:hover { - filter: brightness(107%) contrast(105%); - box-shadow: 0 0 0.25rem #ffffff79; -} -} -.p-accordioncontent-content[data-v-79125ff6] { - 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[data-v-79125ff6]:not(.selected) { - opacity: 0.5; -} -.gpu-button[data-v-79125ff6]:not(.selected):hover { - opacity: 1; -} -} -.gpu-button[data-v-79125ff6] { - 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[data-v-79125ff6]:hover { - --tw-bg-opacity: 0.75; -} -.gpu-button { -&.selected[data-v-79125ff6] { - --tw-bg-opacity: 1; - background-color: rgb(64 64 64 / var(--tw-bg-opacity)); -} -&.selected[data-v-79125ff6] { - --tw-bg-opacity: 0.5; -} -&.selected[data-v-79125ff6] { - opacity: 1; -} -&.selected[data-v-79125ff6]:hover { - --tw-bg-opacity: 0.6; -} -} -.disabled[data-v-79125ff6] { - pointer-events: none; - opacity: 0.4; -} -.p-card-header[data-v-79125ff6] { - flex-grow: 1; - text-align: center; -} -.p-card-body[data-v-79125ff6] { - padding-top: 0px; - text-align: center; -} - -[data-v-cd6731d2] .p-steppanel { - background-color: transparent -} diff --git a/web/assets/KeybindingPanel-CDYVPYDp.css b/web/assets/KeybindingPanel-CDYVPYDp.css deleted file mode 100644 index 2392e4f5c..000000000 --- a/web/assets/KeybindingPanel-CDYVPYDp.css +++ /dev/null @@ -1,8 +0,0 @@ - -[data-v-8454e24f] .p-datatable-tbody > tr > td { - padding: 0.25rem; - min-height: 2rem -} -[data-v-8454e24f] .p-datatable-row-selected .actions,[data-v-8454e24f] .p-datatable-selectable-row:hover .actions { - visibility: visible -} diff --git a/web/assets/KeybindingPanel-oavhFdkz.js b/web/assets/KeybindingPanel-oavhFdkz.js deleted file mode 100644 index aa3739dcd..000000000 --- a/web/assets/KeybindingPanel-oavhFdkz.js +++ /dev/null @@ -1,292 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, c as computed, o as openBlock, f as createElementBlock, F as Fragment, D as renderList, k as createVNode, z as withCtx, a8 as createTextVNode, E as toDisplayString, j as unref, a5 as script, B as createCommentVNode, T as ref, dx as FilterMatchMode, ao as useKeybindingStore, J as useCommandStore, I as useI18n, X as normalizeI18nKey, w as watchEffect, aV as useToast, r as resolveDirective, y as createBlock, dy as SearchBox, m as createBaseVNode, l as script$2, bk as script$4, as as withModifiers, bn as script$5, ac as script$6, i as withDirectives, dz as _sfc_main$2, dA as KeyComboImpl, dB as KeybindingImpl, _ as _export_sfc } from "./index-Bv0b06LE.js"; -import { g as script$1, h as script$3 } from "./index-CgMyWf7n.js"; -import { u as useKeybindingService } from "./keybindingService-DyjX-nxF.js"; -import "./index-Dzu9WL4p.js"; -const _hoisted_1$1 = { - key: 0, - class: "px-2" -}; -const _sfc_main$1 = /* @__PURE__ */ defineComponent({ - __name: "KeyComboDisplay", - props: { - keyCombo: {}, - isModified: { type: Boolean, default: false } - }, - setup(__props) { - const props = __props; - const keySequences = computed(() => props.keyCombo.getKeySequences()); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("span", null, [ - (openBlock(true), createElementBlock(Fragment, null, renderList(keySequences.value, (sequence, index) => { - return openBlock(), createElementBlock(Fragment, { key: index }, [ - createVNode(unref(script), { - severity: _ctx.isModified ? "info" : "secondary" - }, { - default: withCtx(() => [ - createTextVNode(toDisplayString(sequence), 1) - ]), - _: 2 - }, 1032, ["severity"]), - index < keySequences.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_1$1, "+")) : createCommentVNode("", true) - ], 64); - }), 128)) - ]); - }; - } -}); -const _hoisted_1 = { class: "actions invisible flex flex-row" }; -const _hoisted_2 = ["title"]; -const _hoisted_3 = { key: 1 }; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "KeybindingPanel", - setup(__props) { - const filters = ref({ - global: { value: "", matchMode: FilterMatchMode.CONTAINS } - }); - const keybindingStore = useKeybindingStore(); - const keybindingService = useKeybindingService(); - const commandStore = useCommandStore(); - const { t } = useI18n(); - const commandsData = computed(() => { - return Object.values(commandStore.commands).map((command) => ({ - id: command.id, - label: t(`commands.${normalizeI18nKey(command.id)}.label`, command.label), - keybinding: keybindingStore.getKeybindingByCommandId(command.id) - })); - }); - const selectedCommandData = ref(null); - const editDialogVisible = ref(false); - const newBindingKeyCombo = ref(null); - const currentEditingCommand = ref(null); - const keybindingInput = ref(null); - const existingKeybindingOnCombo = computed(() => { - if (!currentEditingCommand.value) { - return null; - } - if (currentEditingCommand.value.keybinding?.combo?.equals( - newBindingKeyCombo.value - )) { - return null; - } - if (!newBindingKeyCombo.value) { - return null; - } - return keybindingStore.getKeybinding(newBindingKeyCombo.value); - }); - function editKeybinding(commandData) { - currentEditingCommand.value = commandData; - newBindingKeyCombo.value = commandData.keybinding ? commandData.keybinding.combo : null; - editDialogVisible.value = true; - } - __name(editKeybinding, "editKeybinding"); - watchEffect(() => { - if (editDialogVisible.value) { - setTimeout(() => { - keybindingInput.value?.$el?.focus(); - }, 300); - } - }); - function removeKeybinding(commandData) { - if (commandData.keybinding) { - keybindingStore.unsetKeybinding(commandData.keybinding); - keybindingService.persistUserKeybindings(); - } - } - __name(removeKeybinding, "removeKeybinding"); - function captureKeybinding(event) { - if (!event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) { - switch (event.key) { - case "Escape": - cancelEdit(); - return; - case "Enter": - saveKeybinding(); - return; - } - } - const keyCombo = KeyComboImpl.fromEvent(event); - newBindingKeyCombo.value = keyCombo; - } - __name(captureKeybinding, "captureKeybinding"); - function cancelEdit() { - editDialogVisible.value = false; - currentEditingCommand.value = null; - newBindingKeyCombo.value = null; - } - __name(cancelEdit, "cancelEdit"); - function saveKeybinding() { - if (currentEditingCommand.value && newBindingKeyCombo.value) { - const updated = keybindingStore.updateKeybindingOnCommand( - new KeybindingImpl({ - commandId: currentEditingCommand.value.id, - combo: newBindingKeyCombo.value - }) - ); - if (updated) { - keybindingService.persistUserKeybindings(); - } - } - cancelEdit(); - } - __name(saveKeybinding, "saveKeybinding"); - const toast = useToast(); - async function resetKeybindings() { - keybindingStore.resetKeybindings(); - await keybindingService.persistUserKeybindings(); - toast.add({ - severity: "info", - summary: "Info", - detail: "Keybindings reset", - life: 3e3 - }); - } - __name(resetKeybindings, "resetKeybindings"); - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createBlock(_sfc_main$2, { - value: "Keybinding", - class: "keybinding-panel" - }, { - header: withCtx(() => [ - createVNode(SearchBox, { - modelValue: filters.value["global"].value, - "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filters.value["global"].value = $event), - placeholder: _ctx.$t("g.searchKeybindings") + "..." - }, null, 8, ["modelValue", "placeholder"]) - ]), - default: withCtx(() => [ - createVNode(unref(script$3), { - value: commandsData.value, - selection: selectedCommandData.value, - "onUpdate:selection": _cache[1] || (_cache[1] = ($event) => selectedCommandData.value = $event), - "global-filter-fields": ["id", "label"], - filters: filters.value, - selectionMode: "single", - stripedRows: "", - pt: { - header: "px-0" - } - }, { - default: withCtx(() => [ - createVNode(unref(script$1), { - field: "actions", - header: "" - }, { - body: withCtx((slotProps) => [ - createBaseVNode("div", _hoisted_1, [ - createVNode(unref(script$2), { - icon: "pi pi-pencil", - class: "p-button-text", - onClick: /* @__PURE__ */ __name(($event) => editKeybinding(slotProps.data), "onClick") - }, null, 8, ["onClick"]), - createVNode(unref(script$2), { - icon: "pi pi-trash", - class: "p-button-text p-button-danger", - onClick: /* @__PURE__ */ __name(($event) => removeKeybinding(slotProps.data), "onClick"), - disabled: !slotProps.data.keybinding - }, null, 8, ["onClick", "disabled"]) - ]) - ]), - _: 1 - }), - createVNode(unref(script$1), { - field: "id", - header: _ctx.$t("g.command"), - sortable: "", - class: "max-w-64 2xl:max-w-full" - }, { - body: withCtx((slotProps) => [ - createBaseVNode("div", { - class: "overflow-hidden text-ellipsis whitespace-nowrap", - title: slotProps.data.id - }, toDisplayString(slotProps.data.label), 9, _hoisted_2) - ]), - _: 1 - }, 8, ["header"]), - createVNode(unref(script$1), { - field: "keybinding", - header: _ctx.$t("g.keybinding") - }, { - body: withCtx((slotProps) => [ - slotProps.data.keybinding ? (openBlock(), createBlock(_sfc_main$1, { - key: 0, - keyCombo: slotProps.data.keybinding.combo, - isModified: unref(keybindingStore).isCommandKeybindingModified(slotProps.data.id) - }, null, 8, ["keyCombo", "isModified"])) : (openBlock(), createElementBlock("span", _hoisted_3, "-")) - ]), - _: 1 - }, 8, ["header"]) - ]), - _: 1 - }, 8, ["value", "selection", "filters"]), - createVNode(unref(script$6), { - class: "min-w-96", - visible: editDialogVisible.value, - "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => editDialogVisible.value = $event), - modal: "", - header: currentEditingCommand.value?.label, - onHide: cancelEdit - }, { - footer: withCtx(() => [ - createVNode(unref(script$2), { - label: "Save", - icon: "pi pi-check", - onClick: saveKeybinding, - disabled: !!existingKeybindingOnCombo.value, - autofocus: "" - }, null, 8, ["disabled"]) - ]), - default: withCtx(() => [ - createBaseVNode("div", null, [ - createVNode(unref(script$4), { - class: "mb-2 text-center", - ref_key: "keybindingInput", - ref: keybindingInput, - modelValue: newBindingKeyCombo.value?.toString() ?? "", - placeholder: "Press keys for new binding", - onKeydown: withModifiers(captureKeybinding, ["stop", "prevent"]), - autocomplete: "off", - fluid: "", - invalid: !!existingKeybindingOnCombo.value - }, null, 8, ["modelValue", "invalid"]), - existingKeybindingOnCombo.value ? (openBlock(), createBlock(unref(script$5), { - key: 0, - severity: "error" - }, { - default: withCtx(() => [ - _cache[3] || (_cache[3] = createTextVNode(" Keybinding already exists on ")), - createVNode(unref(script), { - severity: "secondary", - value: existingKeybindingOnCombo.value.commandId - }, null, 8, ["value"]) - ]), - _: 1 - })) : createCommentVNode("", true) - ]) - ]), - _: 1 - }, 8, ["visible", "header"]), - withDirectives(createVNode(unref(script$2), { - class: "mt-4", - label: _ctx.$t("g.reset"), - icon: "pi pi-trash", - severity: "danger", - fluid: "", - text: "", - onClick: resetKeybindings - }, null, 8, ["label"]), [ - [_directive_tooltip, _ctx.$t("g.resetKeybindingsTooltip")] - ]) - ]), - _: 1 - }); - }; - } -}); -const KeybindingPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8454e24f"]]); -export { - KeybindingPanel as default -}; -//# sourceMappingURL=KeybindingPanel-oavhFdkz.js.map diff --git a/web/assets/MaintenanceView-Bh8OZpgl.js b/web/assets/MaintenanceView-Bh8OZpgl.js deleted file mode 100644 index 4f3d99c3b..000000000 --- a/web/assets/MaintenanceView-Bh8OZpgl.js +++ /dev/null @@ -1,25635 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); -import { d as defineComponent, bw as mergeModels, bq as useModel, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, aj as normalizeClass, i as withDirectives, v as vShow, k as createVNode, j as unref, bE as script$1c, l as script$1d, c as computed, bF as PrimeIcons, bg as t, a5 as script$1e, b1 as inject, bG as BaseStyle, bH as script$1f, at as mergeProps, bI as Transition, C as resolveDynamicComponent, A as renderSlot, B as createCommentVNode, bJ as findSingle, bK as getAttribute, bL as focus, bM as script$1g, bN as script$1h, bO as Ripple, r as resolveDirective, bP as UniqueComponentId, bQ as script$1i, bR as resolveComponent, f as createElementBlock, F as Fragment, D as renderList, E as toDisplayString, bS as BaseDirective, bT as removeClass, bU as addClass, bV as createElement, bW as hasClass, bX as script$1j, bY as script$1k, bZ as ZIndex, b_ as addStyle, b$ as ConnectedOverlayScrollHandler, c0 as isTouchDevice, c1 as relativePosition, c2 as getOuterWidth, c3 as absolutePosition, c4 as find, c5 as getIndex, c6 as getFocusableElements, c7 as OverlayEventBus, c8 as setAttribute, c9 as localeComparator, bk as script$1l, ca as script$1m, cb as script$1n, n as normalizeStyle, a8 as createTextVNode, bj as withKeys, cc as resolveFieldData, cd as isNotEmpty, ce as equals, cf as script$1o, cg as isString, ch as isPrintableCharacter, ci as isEmpty, cj as findLastIndex, ck as script$1p, cl as script$1q, cm as script$1r, cn as uuid, a9 as script$1s, co as sort, cp as createSlots, cq as EventBus, H as markRaw, cr as resolve, cs as Tooltip, bm as script$1u, ac as script$1v, ct as script$1w, cu as script$1x, cv as script$1y, cw as script$1z, bn as script$1A, cx as normalizeProps, cy as blockBodyScroll, cz as isAttributeEquals, cA as unblockBodyScroll, cB as FocusTrap, cC as guardReactiveProps, cD as setCSSProperty, cE as $dt, cF as script$1C, cG as script$1E, cH as getUserAgent, br as script$1F, cI as script$1G, cJ as getFirstFocusableElement, cK as getLastFocusableElement, cL as FilterService, bv as script$1I, cM as script$1J, bt as script$1K, bs as script$1L, cN as script$1M, cO as findIndexInList, cP as scrollInView, cQ as script$1N, cR as script$1O, cS as script$1P, cT as findLast, cU as getWindowScrollTop, cV as getWidth, cW as getOffset, cX as vModelText, cY as script$1U, as as withModifiers, cZ as getVNodeProp, c_ as getNextElementSibling, c$ as getPreviousElementSibling, d0 as isClickable, d1 as _default, d2 as clearSelection, d3 as isRTL, b9 as electronAPI, a1 as defineStore, T as ref, d4 as useTimeout, N as watch, d5 as script$1Y, _ as _export_sfc, aV as useToast, d6 as useConfirm, bl as script$1Z, d7 as script$1_, p as onMounted, d8 as onUnmounted, aw as script$1$, ag as isRef } from "./index-Bv0b06LE.js"; -import { a as script$1B, b as script$1D, s as script$20 } from "./index-A_bXPJCN.js"; -import "./index-C068lYT4.js"; -import { s as script$1t, a as script$1Q, b as script$1R, c as script$1S, d as script$1V, e as script$1W, f as script$1X } from "./index-CgMyWf7n.js"; -import { s as script$1T, _ as _sfc_main$7 } from "./TerminalOutputDrawer-CKr7Br7O.js"; -import { s as script$1H } from "./index-Dzu9WL4p.js"; -import "./index-SeIZOWJp.js"; -import { _ as _sfc_main$8 } from "./BaseViewTemplate-BTbuZf5t.js"; -const _sfc_main$6 = /* @__PURE__ */ defineComponent({ - __name: "RefreshButton", - props: /* @__PURE__ */ mergeModels({ - outlined: { type: Boolean, default: true }, - disabled: { type: Boolean }, - severity: { default: "secondary" } - }, { - "modelValue": { type: Boolean, ...{ required: true } }, - "modelModifiers": {} - }), - emits: /* @__PURE__ */ mergeModels(["refresh"], ["update:modelValue"]), - setup(__props) { - const props = __props; - const active3 = useModel(__props, "modelValue"); - return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$1d), { - class: "relative p-button-icon-only", - outlined: props.outlined, - severity: props.severity, - disabled: active3.value || props.disabled, - onClick: _cache[0] || (_cache[0] = (event2) => _ctx.$emit("refresh", event2)) - }, { - default: withCtx(() => [ - createBaseVNode("span", { - class: normalizeClass(["p-button-icon pi pi-refresh transition-all", { "opacity-0": active3.value }]), - "data-pc-section": "icon" - }, null, 2), - _cache[1] || (_cache[1] = createBaseVNode("span", { - class: "p-button-label", - "data-pc-section": "label" - }, " ", -1)), - withDirectives(createVNode(unref(script$1c), { class: "absolute w-1/2 h-1/2" }, null, 512), [ - [vShow, active3.value] - ]) - ]), - _: 1 - }, 8, ["outlined", "severity", "disabled"]); - }; - } -}); -const _sfc_main$5 = /* @__PURE__ */ defineComponent({ - __name: "StatusTag", - props: { - error: { type: Boolean }, - refreshing: { type: Boolean } - }, - setup(__props) { - const props = __props; - const icon2 = computed(() => { - if (props.refreshing) return PrimeIcons.QUESTION; - if (props.error) return PrimeIcons.TIMES; - return PrimeIcons.CHECK; - }); - const severity = computed(() => { - if (props.refreshing) return "info"; - if (props.error) return "danger"; - return "success"; - }); - const value2 = computed(() => { - if (props.refreshing) return t("maintenance.refreshing"); - if (props.error) return t("g.error"); - return t("maintenance.OK"); - }); - return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script$1e), { - icon: icon2.value, - severity: severity.value, - value: value2.value - }, null, 8, ["icon", "severity", "value"]); - }; - } -}); -var PrimeVueDialogSymbol = Symbol(); -function useDialog() { - var PrimeVueDialog = inject(PrimeVueDialogSymbol); - if (!PrimeVueDialog) { - throw new Error("No PrimeVue Dialog provided!"); - } - return PrimeVueDialog; -} -__name(useDialog, "useDialog"); -var classes$L = { - root: "p-accordioncontent", - content: "p-accordioncontent-content" -}; -var AccordionContentStyle = BaseStyle.extend({ - name: "accordioncontent", - classes: classes$L -}); -var script$1$N = { - name: "BaseAccordionContent", - "extends": script$1f, - props: { - as: { - type: [String, Object], - "default": "DIV" - }, - asChild: { - type: Boolean, - "default": false - } - }, - style: AccordionContentStyle, - provide: /* @__PURE__ */ __name(function provide() { - return { - $pcAccordionContent: this, - $parentInstance: this - }; - }, "provide") -}; -var script$1b = { - name: "AccordionContent", - "extends": script$1$N, - inheritAttrs: false, - inject: ["$pcAccordion", "$pcAccordionPanel"], - computed: { - id: /* @__PURE__ */ __name(function id() { - return "".concat(this.$pcAccordion.id, "_accordioncontent_").concat(this.$pcAccordionPanel.value); - }, "id"), - ariaLabelledby: /* @__PURE__ */ __name(function ariaLabelledby() { - return "".concat(this.$pcAccordion.id, "_accordionheader_").concat(this.$pcAccordionPanel.value); - }, "ariaLabelledby"), - attrs: /* @__PURE__ */ __name(function attrs() { - return mergeProps(this.a11yAttrs, this.ptmi("root", this.ptParams)); - }, "attrs"), - a11yAttrs: /* @__PURE__ */ __name(function a11yAttrs() { - return { - id: this.id, - role: "region", - "aria-labelledby": this.ariaLabelledby, - "data-pc-name": "accordioncontent", - "data-p-active": this.$pcAccordionPanel.active - }; - }, "a11yAttrs"), - ptParams: /* @__PURE__ */ __name(function ptParams() { - return { - context: { - active: this.$pcAccordionPanel.active - } - }; - }, "ptParams") - } -}; -function render$12(_ctx, _cache, $props, $setup, $data, $options) { - return !_ctx.asChild ? (openBlock(), createBlock(Transition, mergeProps({ - key: 0, - name: "p-toggleable-content" - }, _ctx.ptm("transition", $options.ptParams)), { - "default": withCtx(function() { - return [($options.$pcAccordion.lazy ? $options.$pcAccordionPanel.active : true) ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ - key: 0, - "class": _ctx.cx("root") - }, $options.attrs), { - "default": withCtx(function() { - return [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("content") - }, _ctx.ptm("content", $options.ptParams)), [renderSlot(_ctx.$slots, "default")], 16)]; - }), - _: 3 - }, 16, ["class"])), [[vShow, $options.$pcAccordion.lazy ? true : $options.$pcAccordionPanel.active]]) : createCommentVNode("", true)]; - }), - _: 3 - }, 16)) : renderSlot(_ctx.$slots, "default", { - key: 1, - "class": normalizeClass(_ctx.cx("root")), - active: $options.$pcAccordionPanel.active, - a11yAttrs: $options.a11yAttrs - }); -} -__name(render$12, "render$12"); -script$1b.render = render$12; -var classes$K = { - root: "p-accordionheader", - toggleicon: "p-accordionheader-toggle-icon" -}; -var AccordionHeaderStyle = BaseStyle.extend({ - name: "accordionheader", - classes: classes$K -}); -var script$1$M = { - name: "BaseAccordionHeader", - "extends": script$1f, - props: { - as: { - type: [String, Object], - "default": "BUTTON" - }, - asChild: { - type: Boolean, - "default": false - } - }, - style: AccordionHeaderStyle, - provide: /* @__PURE__ */ __name(function provide2() { - return { - $pcAccordionHeader: this, - $parentInstance: this - }; - }, "provide") -}; -var script$1a = { - name: "AccordionHeader", - "extends": script$1$M, - inheritAttrs: false, - inject: ["$pcAccordion", "$pcAccordionPanel"], - methods: { - onFocus: /* @__PURE__ */ __name(function onFocus() { - this.$pcAccordion.selectOnFocus && this.changeActiveValue(); - }, "onFocus"), - onClick: /* @__PURE__ */ __name(function onClick() { - this.changeActiveValue(); - }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown(event2) { - switch (event2.code) { - case "ArrowDown": - this.onArrowDownKey(event2); - break; - case "ArrowUp": - this.onArrowUpKey(event2); - break; - case "Home": - this.onHomeKey(event2); - break; - case "End": - this.onEndKey(event2); - break; - case "Enter": - case "NumpadEnter": - case "Space": - this.onEnterKey(event2); - break; - } - }, "onKeydown"), - onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey(event2) { - var nextPanel = this.findNextPanel(this.findPanel(event2.currentTarget)); - nextPanel ? this.changeFocusedPanel(event2, nextPanel) : this.onHomeKey(event2); - event2.preventDefault(); - }, "onArrowDownKey"), - onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey(event2) { - var prevPanel = this.findPrevPanel(this.findPanel(event2.currentTarget)); - prevPanel ? this.changeFocusedPanel(event2, prevPanel) : this.onEndKey(event2); - event2.preventDefault(); - }, "onArrowUpKey"), - onHomeKey: /* @__PURE__ */ __name(function onHomeKey(event2) { - var firstPanel = this.findFirstPanel(); - this.changeFocusedPanel(event2, firstPanel); - event2.preventDefault(); - }, "onHomeKey"), - onEndKey: /* @__PURE__ */ __name(function onEndKey(event2) { - var lastPanel = this.findLastPanel(); - this.changeFocusedPanel(event2, lastPanel); - event2.preventDefault(); - }, "onEndKey"), - onEnterKey: /* @__PURE__ */ __name(function onEnterKey(event2) { - this.changeActiveValue(); - event2.preventDefault(); - }, "onEnterKey"), - findPanel: /* @__PURE__ */ __name(function findPanel(headerElement) { - return headerElement === null || headerElement === void 0 ? void 0 : headerElement.closest('[data-pc-name="accordionpanel"]'); - }, "findPanel"), - findHeader: /* @__PURE__ */ __name(function findHeader(panelElement) { - return findSingle(panelElement, '[data-pc-name="accordionheader"]'); - }, "findHeader"), - findNextPanel: /* @__PURE__ */ __name(function findNextPanel(panelElement) { - var selfCheck = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - var element = selfCheck ? panelElement : panelElement.nextElementSibling; - return element ? getAttribute(element, "data-p-disabled") ? this.findNextPanel(element) : this.findHeader(element) : null; - }, "findNextPanel"), - findPrevPanel: /* @__PURE__ */ __name(function findPrevPanel(panelElement) { - var selfCheck = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - var element = selfCheck ? panelElement : panelElement.previousElementSibling; - return element ? getAttribute(element, "data-p-disabled") ? this.findPrevPanel(element) : this.findHeader(element) : null; - }, "findPrevPanel"), - findFirstPanel: /* @__PURE__ */ __name(function findFirstPanel() { - return this.findNextPanel(this.$pcAccordion.$el.firstElementChild, true); - }, "findFirstPanel"), - findLastPanel: /* @__PURE__ */ __name(function findLastPanel() { - return this.findPrevPanel(this.$pcAccordion.$el.lastElementChild, true); - }, "findLastPanel"), - changeActiveValue: /* @__PURE__ */ __name(function changeActiveValue() { - this.$pcAccordion.updateValue(this.$pcAccordionPanel.value); - }, "changeActiveValue"), - changeFocusedPanel: /* @__PURE__ */ __name(function changeFocusedPanel(event2, element) { - focus(this.findHeader(element)); - }, "changeFocusedPanel") - }, - computed: { - id: /* @__PURE__ */ __name(function id2() { - return "".concat(this.$pcAccordion.id, "_accordionheader_").concat(this.$pcAccordionPanel.value); - }, "id"), - ariaControls: /* @__PURE__ */ __name(function ariaControls() { - return "".concat(this.$pcAccordion.id, "_accordioncontent_").concat(this.$pcAccordionPanel.value); - }, "ariaControls"), - attrs: /* @__PURE__ */ __name(function attrs2() { - 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.$pcAccordionPanel.disabled - } : void 0; - }, "asAttrs"), - a11yAttrs: /* @__PURE__ */ __name(function a11yAttrs2() { - return { - id: this.id, - tabindex: this.$pcAccordion.tabindex, - "aria-expanded": this.$pcAccordionPanel.active, - "aria-controls": this.ariaControls, - "data-pc-name": "accordionheader", - "data-p-disabled": this.$pcAccordionPanel.disabled, - "data-p-active": this.$pcAccordionPanel.active, - onFocus: this.onFocus, - onKeydown: this.onKeydown - }; - }, "a11yAttrs"), - ptParams: /* @__PURE__ */ __name(function ptParams2() { - return { - context: { - active: this.$pcAccordionPanel.active - } - }; - }, "ptParams") - }, - components: { - ChevronUpIcon: script$1g, - ChevronDownIcon: script$1h - }, - directives: { - ripple: Ripple - } -}; -function render$11(_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", { - active: $options.$pcAccordionPanel.active - }), renderSlot(_ctx.$slots, "toggleicon", { - active: $options.$pcAccordionPanel.active, - "class": normalizeClass(_ctx.cx("toggleicon")) - }, function() { - return [$options.$pcAccordionPanel.active ? (openBlock(), createBlock(resolveDynamicComponent($options.$pcAccordion.$slots.collapseicon ? $options.$pcAccordion.$slots.collapseicon : $options.$pcAccordion.collapseIcon ? "span" : "ChevronDownIcon"), mergeProps({ - key: 0, - "class": [$options.$pcAccordion.collapseIcon, _ctx.cx("toggleicon")], - "aria-hidden": "true" - }, _ctx.ptm("toggleicon", $options.ptParams)), null, 16, ["class"])) : (openBlock(), createBlock(resolveDynamicComponent($options.$pcAccordion.$slots.expandicon ? $options.$pcAccordion.$slots.expandicon : $options.$pcAccordion.expandIcon ? "span" : "ChevronUpIcon"), mergeProps({ - key: 1, - "class": [$options.$pcAccordion.expandIcon, _ctx.cx("toggleicon")], - "aria-hidden": "true" - }, _ctx.ptm("toggleicon", $options.ptParams)), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "onClick"])), [[_directive_ripple]]) : renderSlot(_ctx.$slots, "default", { - key: 1, - "class": normalizeClass(_ctx.cx("root")), - active: $options.$pcAccordionPanel.active, - a11yAttrs: $options.a11yAttrs, - onClick: $options.onClick - }); -} -__name(render$11, "render$11"); -script$1a.render = render$11; -var classes$J = { - root: /* @__PURE__ */ __name(function root(_ref) { - var instance = _ref.instance, props = _ref.props; - return ["p-accordionpanel", { - "p-accordionpanel-active": instance.active, - "p-disabled": props.disabled - }]; - }, "root") -}; -var AccordionPanelStyle = BaseStyle.extend({ - name: "accordionpanel", - classes: classes$J -}); -var script$1$L = { - name: "BaseAccordionPanel", - "extends": script$1f, - props: { - value: { - type: [String, Number], - "default": void 0 - }, - disabled: { - type: Boolean, - "default": false - }, - as: { - type: [String, Object], - "default": "DIV" - }, - asChild: { - type: Boolean, - "default": false - } - }, - style: AccordionPanelStyle, - provide: /* @__PURE__ */ __name(function provide3() { - return { - $pcAccordionPanel: this, - $parentInstance: this - }; - }, "provide") -}; -var script$19 = { - name: "AccordionPanel", - "extends": script$1$L, - inheritAttrs: false, - inject: ["$pcAccordion"], - computed: { - active: /* @__PURE__ */ __name(function active() { - return this.$pcAccordion.isItemActive(this.value); - }, "active"), - attrs: /* @__PURE__ */ __name(function attrs3() { - return mergeProps(this.a11yAttrs, this.ptmi("root", this.ptParams)); - }, "attrs"), - a11yAttrs: /* @__PURE__ */ __name(function a11yAttrs3() { - return { - "data-pc-name": "accordionpanel", - "data-p-disabled": this.disabled, - "data-p-active": this.active - }; - }, "a11yAttrs"), - ptParams: /* @__PURE__ */ __name(function ptParams3() { - return { - context: { - active: this.active - } - }; - }, "ptParams") - } -}; -function render$10(_ctx, _cache, $props, $setup, $data, $options) { - return !_ctx.asChild ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ - key: 0, - "class": _ctx.cx("root") - }, $options.attrs), { - "default": withCtx(function() { - return [renderSlot(_ctx.$slots, "default")]; - }), - _: 3 - }, 16, ["class"])) : renderSlot(_ctx.$slots, "default", { - key: 1, - "class": normalizeClass(_ctx.cx("root")), - active: $options.active, - a11yAttrs: $options.a11yAttrs - }); -} -__name(render$10, "render$10"); -script$19.render = render$10; -var theme$C = /* @__PURE__ */ __name(function theme(_ref) { - var dt = _ref.dt; - return "\n.p-accordionpanel {\n display: flex;\n flex-direction: column;\n border-style: solid;\n border-width: ".concat(dt("accordion.panel.border.width"), ";\n border-color: ").concat(dt("accordion.panel.border.color"), ";\n}\n\n.p-accordionheader {\n all: unset;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: ").concat(dt("accordion.header.padding"), ";\n color: ").concat(dt("accordion.header.color"), ";\n background: ").concat(dt("accordion.header.background"), ";\n border-style: solid;\n border-width: ").concat(dt("accordion.header.border.width"), ";\n border-color: ").concat(dt("accordion.header.border.color"), ";\n font-weight: ").concat(dt("accordion.header.font.weight"), ";\n border-radius: ").concat(dt("accordion.header.border.radius"), ";\n transition: background ").concat(dt("accordion.transition.duration"), "; color ").concat(dt("accordion.transition.duration"), "color ").concat(dt("accordion.transition.duration"), ", outline-color ").concat(dt("accordion.transition.duration"), ", box-shadow ").concat(dt("accordion.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-accordionpanel:first-child > .p-accordionheader {\n border-width: ").concat(dt("accordion.header.first.border.width"), ";\n border-start-start-radius: ").concat(dt("accordion.header.first.top.border.radius"), ";\n border-start-end-radius: ").concat(dt("accordion.header.first.top.border.radius"), ";\n}\n\n.p-accordionpanel:last-child > .p-accordionheader {\n border-end-start-radius: ").concat(dt("accordion.header.last.bottom.border.radius"), ";\n border-end-end-radius: ").concat(dt("accordion.header.last.bottom.border.radius"), ";\n}\n\n.p-accordionpanel:last-child.p-accordionpanel-active > .p-accordionheader {\n border-end-start-radius: ").concat(dt("accordion.header.last.active.bottom.border.radius"), ";\n border-end-end-radius: ").concat(dt("accordion.header.last.active.bottom.border.radius"), ";\n}\n\n.p-accordionheader-toggle-icon {\n color: ").concat(dt("accordion.header.toggle.icon.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled) .p-accordionheader:focus-visible {\n box-shadow: ").concat(dt("accordion.header.focus.ring.shadow"), ";\n outline: ").concat(dt("accordion.header.focus.ring.width"), " ").concat(dt("accordion.header.focus.ring.style"), " ").concat(dt("accordion.header.focus.ring.color"), ";\n outline-offset: ").concat(dt("accordion.header.focus.ring.offset"), ";\n}\n\n.p-accordionpanel:not(.p-accordionpanel-active):not(.p-disabled) > .p-accordionheader:hover {\n background: ").concat(dt("accordion.header.hover.background"), ";\n color: ").concat(dt("accordion.header.hover.color"), ";\n}\n\n.p-accordionpanel:not(.p-accordionpanel-active):not(.p-disabled) .p-accordionheader:hover .p-accordionheader-toggle-icon {\n color: ").concat(dt("accordion.header.toggle.icon.hover.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled).p-accordionpanel-active > .p-accordionheader {\n background: ").concat(dt("accordion.header.active.background"), ";\n color: ").concat(dt("accordion.header.active.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled).p-accordionpanel-active > .p-accordionheader .p-accordionheader-toggle-icon {\n color: ").concat(dt("accordion.header.toggle.icon.active.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled).p-accordionpanel-active > .p-accordionheader:hover {\n background: ").concat(dt("accordion.header.active.hover.background"), ";\n color: ").concat(dt("accordion.header.active.hover.color"), ";\n}\n\n.p-accordionpanel:not(.p-disabled).p-accordionpanel-active > .p-accordionheader:hover .p-accordionheader-toggle-icon {\n color: ").concat(dt("accordion.header.toggle.icon.active.hover.color"), ";\n}\n\n.p-accordioncontent-content {\n border-style: solid;\n border-width: ").concat(dt("accordion.content.border.width"), ";\n border-color: ").concat(dt("accordion.content.border.color"), ";\n background-color: ").concat(dt("accordion.content.background"), ";\n color: ").concat(dt("accordion.content.color"), ";\n padding: ").concat(dt("accordion.content.padding"), ";\n}\n"); -}, "theme"); -var classes$I = { - root: "p-accordion p-component" -}; -var AccordionStyle = BaseStyle.extend({ - name: "accordion", - theme: theme$C, - classes: classes$I -}); -var script$1$K = { - name: "BaseAccordion", - "extends": script$1f, - props: { - value: { - type: [String, Number, Array], - "default": void 0 - }, - multiple: { - type: Boolean, - "default": false - }, - lazy: { - type: Boolean, - "default": false - }, - tabindex: { - type: Number, - "default": 0 - }, - selectOnFocus: { - type: Boolean, - "default": false - }, - expandIcon: { - type: String, - "default": void 0 - }, - collapseIcon: { - type: String, - "default": void 0 - }, - // @deprecated since v4. - activeIndex: { - type: [Number, Array], - "default": null - } - }, - style: AccordionStyle, - provide: /* @__PURE__ */ __name(function provide4() { - return { - $pcAccordion: this, - $parentInstance: this - }; - }, "provide") -}; -var script$18 = { - name: "Accordion", - "extends": script$1$K, - inheritAttrs: false, - emits: ["update:value", "update:activeIndex", "tab-open", "tab-close", "tab-click"], - 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"), - activeIndex: { - immediate: true, - handler: /* @__PURE__ */ __name(function handler(newValue) { - if (this.hasAccordionTab) { - this.d_value = this.multiple ? newValue === null || newValue === void 0 ? void 0 : newValue.map(String) : newValue === null || newValue === void 0 ? void 0 : newValue.toString(); - } - }, "handler") - } - }, - mounted: /* @__PURE__ */ __name(function mounted() { - this.id = this.id || UniqueComponentId(); - }, "mounted"), - methods: { - isItemActive: /* @__PURE__ */ __name(function isItemActive(value2) { - var _this$d_value; - return this.multiple ? (_this$d_value = this.d_value) === null || _this$d_value === void 0 ? void 0 : _this$d_value.includes(value2) : this.d_value === value2; - }, "isItemActive"), - updateValue: /* @__PURE__ */ __name(function updateValue(newValue) { - var _this$d_value2; - var active3 = this.isItemActive(newValue); - if (this.multiple) { - if (active3) { - this.d_value = this.d_value.filter(function(v) { - return v !== newValue; - }); - } else { - if (this.d_value) this.d_value.push(newValue); - else this.d_value = [newValue]; - } - } else { - this.d_value = active3 ? null : newValue; - } - this.$emit("update:value", this.d_value); - this.$emit("update:activeIndex", this.multiple ? (_this$d_value2 = this.d_value) === null || _this$d_value2 === void 0 ? void 0 : _this$d_value2.map(Number) : Number(this.d_value)); - this.$emit(active3 ? "tab-close" : "tab-open", { - originalEvent: void 0, - index: Number(newValue) - }); - }, "updateValue"), - // @deprecated since v4. Use new structure instead. - isAccordionTab: /* @__PURE__ */ __name(function isAccordionTab(child) { - return child.type.name === "AccordionTab"; - }, "isAccordionTab"), - getTabProp: /* @__PURE__ */ __name(function getTabProp(tab, name4) { - return tab.props ? tab.props[name4] : void 0; - }, "getTabProp"), - getKey: /* @__PURE__ */ __name(function getKey(tab, index) { - return this.getTabProp(tab, "header") || index; - }, "getKey"), - getHeaderPT: /* @__PURE__ */ __name(function getHeaderPT(tab, index) { - var _this = this; - return { - root: mergeProps({ - onClick: /* @__PURE__ */ __name(function onClick11(event2) { - return _this.onTabClick(event2, index); - }, "onClick") - }, this.getTabProp(tab, "headerProps"), this.getTabPT(tab, "header", index)), - toggleicon: mergeProps(this.getTabProp(tab, "headeractionprops"), this.getTabPT(tab, "headeraction", index)) - }; - }, "getHeaderPT"), - getContentPT: /* @__PURE__ */ __name(function getContentPT(tab, index) { - return { - root: mergeProps(this.getTabProp(tab, "contentProps"), this.getTabPT(tab, "toggleablecontent", index)), - transition: this.getTabPT(tab, "transition", index), - content: this.getTabPT(tab, "content", index) - }; - }, "getContentPT"), - getTabPT: /* @__PURE__ */ __name(function getTabPT(tab, key, index) { - var count = this.tabs.length; - var tabMetaData = { - props: tab.props || {}, - parent: { - instance: this, - props: this.$props, - state: this.$data - }, - context: { - index, - count, - first: index === 0, - last: index === count - 1, - active: this.isItemActive("".concat(index)) - } - }; - return mergeProps(this.ptm("accordiontab.".concat(key), tabMetaData), this.ptmo(this.getTabProp(tab, "pt"), key, tabMetaData)); - }, "getTabPT"), - onTabClick: /* @__PURE__ */ __name(function onTabClick(event2, index) { - this.$emit("tab-click", { - originalEvent: event2, - index - }); - }, "onTabClick") - }, - computed: { - // @deprecated since v4. - tabs: /* @__PURE__ */ __name(function tabs() { - var _this2 = this; - return this.$slots["default"]().reduce(function(tabs2, child) { - if (_this2.isAccordionTab(child)) { - tabs2.push(child); - } else if (child.children && child.children instanceof Array) { - child.children.forEach(function(nestedChild) { - if (_this2.isAccordionTab(nestedChild)) { - tabs2.push(nestedChild); - } - }); - } - return tabs2; - }, []); - }, "tabs"), - hasAccordionTab: /* @__PURE__ */ __name(function hasAccordionTab() { - return this.tabs.length; - }, "hasAccordionTab") - }, - components: { - AccordionPanel: script$19, - AccordionHeader: script$1a, - AccordionContent: script$1b, - ChevronUpIcon: script$1g, - ChevronRightIcon: script$1i - } -}; -function render$$(_ctx, _cache, $props, $setup, $data, $options) { - var _component_AccordionHeader = resolveComponent("AccordionHeader"); - var _component_AccordionContent = resolveComponent("AccordionContent"); - var _component_AccordionPanel = resolveComponent("AccordionPanel"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [$options.hasAccordionTab ? (openBlock(true), createElementBlock(Fragment, { - key: 0 - }, renderList($options.tabs, function(tab, i) { - return openBlock(), createBlock(_component_AccordionPanel, { - key: $options.getKey(tab, i), - value: "".concat(i), - pt: { - root: $options.getTabPT(tab, "root", i) - }, - disabled: $options.getTabProp(tab, "disabled") - }, { - "default": withCtx(function() { - return [createVNode(_component_AccordionHeader, { - "class": normalizeClass($options.getTabProp(tab, "headerClass")), - pt: $options.getHeaderPT(tab, i) - }, { - toggleicon: withCtx(function(slotProps) { - return [slotProps.active ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.collapseicon ? _ctx.$slots.collapseicon : _ctx.collapseIcon ? "span" : "ChevronDownIcon"), mergeProps({ - key: 0, - "class": [_ctx.collapseIcon, slotProps["class"]], - "aria-hidden": "true", - ref_for: true - }, $options.getTabPT(tab, "headericon", i)), null, 16, ["class"])) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.expandicon ? _ctx.$slots.expandicon : _ctx.expandIcon ? "span" : "ChevronUpIcon"), mergeProps({ - key: 1, - "class": [_ctx.expandIcon, slotProps["class"]], - "aria-hidden": "true", - ref_for: true - }, $options.getTabPT(tab, "headericon", i)), null, 16, ["class"]))]; - }), - "default": withCtx(function() { - return [tab.children && tab.children.headericon ? (openBlock(), createBlock(resolveDynamicComponent(tab.children.headericon), { - key: 0, - isTabActive: $options.isItemActive("".concat(i)), - active: $options.isItemActive("".concat(i)), - index: i - }, null, 8, ["isTabActive", "active", "index"])) : createCommentVNode("", true), tab.props && tab.props.header ? (openBlock(), createElementBlock("span", mergeProps({ - key: 1, - ref_for: true - }, $options.getTabPT(tab, "headertitle", i)), toDisplayString(tab.props.header), 17)) : createCommentVNode("", true), tab.children && tab.children.header ? (openBlock(), createBlock(resolveDynamicComponent(tab.children.header), { - key: 2 - })) : createCommentVNode("", true)]; - }), - _: 2 - }, 1032, ["class", "pt"]), createVNode(_component_AccordionContent, { - pt: $options.getContentPT(tab, i) - }, { - "default": withCtx(function() { - return [(openBlock(), createBlock(resolveDynamicComponent(tab)))]; - }), - _: 2 - }, 1032, ["pt"])]; - }), - _: 2 - }, 1032, ["value", "pt", "disabled"]); - }), 128)) : renderSlot(_ctx.$slots, "default", { - key: 1 - })], 16); -} -__name(render$$, "render$$"); -script$18.render = render$$; -var AccordionTabStyle = BaseStyle.extend({ - name: "accordiontab" -}); -var script$1$J = { - name: "BaseAccordionTab", - "extends": script$1f, - props: { - header: null, - headerStyle: null, - headerClass: null, - headerProps: null, - headerActionProps: null, - contentStyle: null, - contentClass: null, - contentProps: null, - disabled: Boolean - }, - style: AccordionTabStyle, - provide: /* @__PURE__ */ __name(function provide5() { - return { - $pcAccordionTab: this, - $parentInstance: this - }; - }, "provide") -}; -var script$17 = { - name: "AccordionTab", - "extends": script$1$J, - inheritAttrs: false, - mounted: /* @__PURE__ */ __name(function mounted2() { - console.warn("Deprecated since v4. Use the new structure of Accordion instead."); - }, "mounted") -}; -function render$_(_ctx, _cache, $props, $setup, $data, $options) { - return renderSlot(_ctx.$slots, "default"); -} -__name(render$_, "render$_"); -script$17.render = render$_; -var AnimateOnScrollStyle = BaseStyle.extend({ - name: "animateonscroll-directive" -}); -var BaseAnimateOnScroll = BaseDirective.extend({ - style: AnimateOnScrollStyle -}); -function _typeof$n(o) { - "@babel/helpers - typeof"; - return _typeof$n = "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$n(o); -} -__name(_typeof$n, "_typeof$n"); -function ownKeys$k(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$k, "ownKeys$k"); -function _objectSpread$k(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$k(Object(t2), true).forEach(function(r2) { - _defineProperty$l(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$k(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$k, "_objectSpread$k"); -function _defineProperty$l(e, r, t2) { - return (r = _toPropertyKey$l(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$l, "_defineProperty$l"); -function _toPropertyKey$l(t2) { - var i = _toPrimitive$l(t2, "string"); - return "symbol" == _typeof$n(i) ? i : i + ""; -} -__name(_toPropertyKey$l, "_toPropertyKey$l"); -function _toPrimitive$l(t2, r) { - if ("object" != _typeof$n(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$n(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$l, "_toPrimitive$l"); -function _slicedToArray$1(r, e) { - return _arrayWithHoles$1(r) || _iterableToArrayLimit$1(r, e) || _unsupportedIterableToArray$f(r, e) || _nonIterableRest$1(); -} -__name(_slicedToArray$1, "_slicedToArray$1"); -function _nonIterableRest$1() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableRest$1, "_nonIterableRest$1"); -function _unsupportedIterableToArray$f(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$f(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$f(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$f, "_unsupportedIterableToArray$f"); -function _arrayLikeToArray$f(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; -} -__name(_arrayLikeToArray$f, "_arrayLikeToArray$f"); -function _iterableToArrayLimit$1(r, l) { - var t2 = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; - if (null != t2) { - var e, n, i, u, a = [], f = true, o = false; - try { - if (i = (t2 = t2.call(r)).next, 0 === l) ; - else for (; !(f = (e = i.call(t2)).done) && (a.push(e.value), a.length !== l); f = true) ; - } catch (r2) { - o = true, n = r2; - } finally { - try { - if (!f && null != t2["return"] && (u = t2["return"](), Object(u) !== u)) return; - } finally { - if (o) throw n; - } - } - return a; - } -} -__name(_iterableToArrayLimit$1, "_iterableToArrayLimit$1"); -function _arrayWithHoles$1(r) { - if (Array.isArray(r)) return r; -} -__name(_arrayWithHoles$1, "_arrayWithHoles$1"); -var AnimateOnScroll = BaseAnimateOnScroll.extend("animateonscroll", { - created: /* @__PURE__ */ __name(function created() { - this.$value = this.$value || {}; - this.$el.style.opacity = this.$value.enterClass ? "0" : ""; - }, "created"), - mounted: /* @__PURE__ */ __name(function mounted3() { - this.$el.setAttribute("data-pd-animateonscroll", true); - this.bindIntersectionObserver(); - }, "mounted"), - unmounted: /* @__PURE__ */ __name(function unmounted() { - this.unbindAnimationEvents(); - this.unbindIntersectionObserver(); - }, "unmounted"), - observer: void 0, - resetObserver: void 0, - isObserverActive: false, - animationState: void 0, - animationEndListener: void 0, - methods: { - bindAnimationEvents: /* @__PURE__ */ __name(function bindAnimationEvents() { - var _this = this; - if (!this.animationEndListener) { - this.animationEndListener = function() { - removeClass(_this.$el, [_this.$value.enterClass, _this.$value.leaveClass]); - !_this.$modifiers.once && _this.resetObserver.observe(_this.$el); - _this.unbindAnimationEvents(); - }; - this.$el.addEventListener("animationend", this.animationEndListener); - } - }, "bindAnimationEvents"), - bindIntersectionObserver: /* @__PURE__ */ __name(function bindIntersectionObserver() { - var _this2 = this; - var _this$$value = this.$value, root34 = _this$$value.root, rootMargin = _this$$value.rootMargin, _this$$value$threshol = _this$$value.threshold, threshold = _this$$value$threshol === void 0 ? 0.5 : _this$$value$threshol; - var options4 = { - root: root34, - rootMargin, - threshold - }; - this.observer = new IntersectionObserver(function(_ref) { - var _ref2 = _slicedToArray$1(_ref, 1), entry = _ref2[0]; - if (_this2.isObserverActive) { - if (entry.boundingClientRect.top > 0) { - entry.isIntersecting ? _this2.enter() : _this2.leave(); - } - } else if (entry.isIntersecting) { - _this2.enter(); - } - _this2.isObserverActive = true; - }, options4); - setTimeout(function() { - return _this2.observer.observe(_this2.$el); - }, 0); - this.resetObserver = new IntersectionObserver(function(_ref3) { - var _ref4 = _slicedToArray$1(_ref3, 1), entry = _ref4[0]; - if (entry.boundingClientRect.top > 0 && !entry.isIntersecting) { - _this2.$el.style.opacity = _this2.$value.enterClass ? "0" : ""; - removeClass(_this2.$el, [_this2.$value.enterClass, _this2.$value.leaveClass]); - _this2.resetObserver.unobserve(_this2.$el); - } - _this2.animationState = void 0; - }, _objectSpread$k(_objectSpread$k({}, options4), {}, { - threshold: 0 - })); - }, "bindIntersectionObserver"), - enter: /* @__PURE__ */ __name(function enter() { - if (this.animationState !== "enter" && this.$value.enterClass) { - this.$el.style.opacity = ""; - removeClass(this.$el, this.$value.leaveClass); - addClass(this.$el, this.$value.enterClass); - this.$modifiers.once && this.unbindIntersectionObserver(this.$el); - this.bindAnimationEvents(); - this.animationState = "enter"; - } - }, "enter"), - leave: /* @__PURE__ */ __name(function leave() { - if (this.animationState !== "leave" && this.$value.leaveClass) { - this.$el.style.opacity = this.$value.enterClass ? "0" : ""; - removeClass(this.$el, this.$value.enterClass); - addClass(this.$el, this.$value.leaveClass); - this.bindAnimationEvents(); - this.animationState = "leave"; - } - }, "leave"), - unbindAnimationEvents: /* @__PURE__ */ __name(function unbindAnimationEvents() { - if (this.animationEndListener) { - this.$el.removeEventListener("animationend", this.animationEndListener); - this.animationEndListener = void 0; - } - }, "unbindAnimationEvents"), - unbindIntersectionObserver: /* @__PURE__ */ __name(function unbindIntersectionObserver() { - var _this$observer, _this$resetObserver; - (_this$observer = this.observer) === null || _this$observer === void 0 || _this$observer.unobserve(this.$el); - (_this$resetObserver = this.resetObserver) === null || _this$resetObserver === void 0 || _this$resetObserver.unobserve(this.$el); - this.isObserverActive = false; - }, "unbindIntersectionObserver") - } -}); -var theme$B = /* @__PURE__ */ __name(function theme2(_ref) { - var dt = _ref.dt; - return "\n.p-avatar {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: ".concat(dt("avatar.width"), ";\n height: ").concat(dt("avatar.height"), ";\n font-size: ").concat(dt("avatar.font.size"), ";\n background: ").concat(dt("avatar.background"), ";\n color: ").concat(dt("avatar.color"), ";\n border-radius: ").concat(dt("avatar.border.radius"), ";\n}\n\n.p-avatar-image {\n background: transparent;\n}\n\n.p-avatar-circle {\n border-radius: 50%;\n}\n\n.p-avatar-circle img {\n border-radius: 50%;\n}\n\n.p-avatar-icon {\n font-size: ").concat(dt("avatar.icon.size"), ";\n width: ").concat(dt("avatar.icon.size"), ";\n height: ").concat(dt("avatar.icon.size"), ";\n}\n\n.p-avatar img {\n width: 100%;\n height: 100%;\n}\n\n.p-avatar-lg {\n width: ").concat(dt("avatar.lg.width"), ";\n height: ").concat(dt("avatar.lg.width"), ";\n font-size: ").concat(dt("avatar.lg.font.size"), ";\n}\n\n.p-avatar-lg .p-avatar-icon {\n font-size: ").concat(dt("avatar.lg.icon.size"), ";\n width: ").concat(dt("avatar.lg.icon.size"), ";\n height: ").concat(dt("avatar.lg.icon.size"), ";\n}\n\n.p-avatar-xl {\n width: ").concat(dt("avatar.xl.width"), ";\n height: ").concat(dt("avatar.xl.width"), ";\n font-size: ").concat(dt("avatar.xl.font.size"), ";\n}\n\n.p-avatar-xl .p-avatar-icon {\n font-size: ").concat(dt("avatar.xl.icon.size"), ";\n width: ").concat(dt("avatar.xl.icon.size"), ";\n height: ").concat(dt("avatar.xl.icon.size"), ";\n}\n\n.p-avatar-group {\n display: flex;\n align-items: center;\n}\n\n.p-avatar-group .p-avatar + .p-avatar {\n margin-inline-start: ").concat(dt("avatar.group.offset"), ";\n}\n\n.p-avatar-group .p-avatar {\n border: 2px solid ").concat(dt("avatar.group.border.color"), ";\n}\n\n.p-avatar-group .p-avatar-lg + .p-avatar-lg {\n margin-inline-start: ").concat(dt("avatar.lg.group.offset"), ";\n}\n\n.p-avatar-group .p-avatar-xl + .p-avatar-xl {\n margin-inline-start: ").concat(dt("avatar.xl.group.offset"), ";\n}\n"); -}, "theme"); -var classes$H = { - root: /* @__PURE__ */ __name(function root2(_ref2) { - var props = _ref2.props; - return ["p-avatar p-component", { - "p-avatar-image": props.image != null, - "p-avatar-circle": props.shape === "circle", - "p-avatar-lg": props.size === "large", - "p-avatar-xl": props.size === "xlarge" - }]; - }, "root"), - label: "p-avatar-label", - icon: "p-avatar-icon" -}; -var AvatarStyle = BaseStyle.extend({ - name: "avatar", - theme: theme$B, - classes: classes$H -}); -var script$1$I = { - name: "BaseAvatar", - "extends": script$1f, - props: { - label: { - type: String, - "default": null - }, - icon: { - type: String, - "default": null - }, - image: { - type: String, - "default": null - }, - size: { - type: String, - "default": "normal" - }, - shape: { - type: String, - "default": "square" - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - } - }, - style: AvatarStyle, - provide: /* @__PURE__ */ __name(function provide6() { - return { - $pcAvatar: this, - $parentInstance: this - }; - }, "provide") -}; -var script$16 = { - name: "Avatar", - "extends": script$1$I, - inheritAttrs: false, - emits: ["error"], - methods: { - onError: /* @__PURE__ */ __name(function onError(event2) { - this.$emit("error", event2); - }, "onError") - } -}; -var _hoisted_1$u = ["aria-labelledby", "aria-label"]; -var _hoisted_2$m = ["src", "alt"]; -function render$Z(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root"), - "aria-labelledby": _ctx.ariaLabelledby, - "aria-label": _ctx.ariaLabel - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default", {}, function() { - return [_ctx.label ? (openBlock(), createElementBlock("span", mergeProps({ - key: 0, - "class": _ctx.cx("label") - }, _ctx.ptm("label")), toDisplayString(_ctx.label), 17)) : _ctx.$slots.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.icon), { - key: 1, - "class": normalizeClass(_ctx.cx("icon")) - }, null, 8, ["class"])) : _ctx.icon ? (openBlock(), createElementBlock("span", mergeProps({ - key: 2, - "class": [_ctx.cx("icon"), _ctx.icon] - }, _ctx.ptm("icon")), null, 16)) : _ctx.image ? (openBlock(), createElementBlock("img", mergeProps({ - key: 3, - src: _ctx.image, - alt: _ctx.ariaLabel, - onError: _cache[0] || (_cache[0] = function() { - return $options.onError && $options.onError.apply($options, arguments); - }) - }, _ctx.ptm("image")), null, 16, _hoisted_2$m)) : createCommentVNode("", true)]; - })], 16, _hoisted_1$u); -} -__name(render$Z, "render$Z"); -script$16.render = render$Z; -var classes$G = { - root: "p-avatar-group p-component" -}; -var AvatarGroupStyle = BaseStyle.extend({ - name: "avatargroup", - classes: classes$G -}); -var script$1$H = { - name: "BaseAvatarGroup", - "extends": script$1f, - style: AvatarGroupStyle, - provide: /* @__PURE__ */ __name(function provide7() { - return { - $pcAvatarGroup: this, - $parentInstance: this - }; - }, "provide") -}; -var script$15 = { - name: "AvatarGroup", - "extends": script$1$H, - inheritAttrs: false -}; -function render$Y(_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$Y, "render$Y"); -script$15.render = render$Y; -var classes$F = { - root: "p-badge p-component" -}; -var BadgeDirectiveStyle = BaseStyle.extend({ - name: "badge-directive", - classes: classes$F -}); -var BaseBadgeDirective = BaseDirective.extend({ - style: BadgeDirectiveStyle -}); -function _typeof$m(o) { - "@babel/helpers - typeof"; - return _typeof$m = "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$m(o); -} -__name(_typeof$m, "_typeof$m"); -function ownKeys$j(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$j, "ownKeys$j"); -function _objectSpread$j(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$j(Object(t2), true).forEach(function(r2) { - _defineProperty$k(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$j(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$j, "_objectSpread$j"); -function _defineProperty$k(e, r, t2) { - return (r = _toPropertyKey$k(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$k, "_defineProperty$k"); -function _toPropertyKey$k(t2) { - var i = _toPrimitive$k(t2, "string"); - return "symbol" == _typeof$m(i) ? i : i + ""; -} -__name(_toPropertyKey$k, "_toPropertyKey$k"); -function _toPrimitive$k(t2, r) { - if ("object" != _typeof$m(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$m(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$k, "_toPrimitive$k"); -var BadgeDirective = BaseBadgeDirective.extend("badge", { - mounted: /* @__PURE__ */ __name(function mounted4(el, binding) { - console.warn("Deprecated since v4. Use OverlayBadge component instead."); - var id4 = UniqueComponentId() + "_badge"; - var badge = createElement("span", _defineProperty$k(_defineProperty$k({ - id: id4, - "class": !this.isUnstyled() && this.cx("root") - }, this.$attrSelector, ""), "p-bind", this.ptm("root", { - context: _objectSpread$j(_objectSpread$j({}, binding.modifiers), {}, { - nogutter: String(binding.value).length === 1, - dot: binding.value == null - }) - }))); - el.$_pbadgeId = badge.getAttribute("id"); - for (var modifier in binding.modifiers) { - !this.isUnstyled() && addClass(badge, "p-badge-" + modifier); - } - if (binding.value != null) { - if (_typeof$m(binding.value) === "object") el.$_badgeValue = binding.value.value; - else el.$_badgeValue = binding.value; - badge.appendChild(document.createTextNode(el.$_badgeValue)); - if (String(el.$_badgeValue).length === 1 && !this.isUnstyled()) { - !this.isUnstyled() && addClass(badge, "p-badge-circle"); - } - } else { - !this.isUnstyled() && addClass(badge, "p-badge-dot"); - } - el.setAttribute("data-pd-badge", true); - !this.isUnstyled() && addClass(el, "p-overlay-badge"); - el.setAttribute("data-p-overlay-badge", "true"); - el.appendChild(badge); - this.$el = badge; - }, "mounted"), - updated: /* @__PURE__ */ __name(function updated(el, binding) { - !this.isUnstyled() && addClass(el, "p-overlay-badge"); - el.setAttribute("data-p-overlay-badge", "true"); - if (binding.oldValue !== binding.value) { - var badge = document.getElementById(el.$_pbadgeId); - if (_typeof$m(binding.value) === "object") el.$_badgeValue = binding.value.value; - else el.$_badgeValue = binding.value; - if (!this.isUnstyled()) { - if (el.$_badgeValue) { - if (hasClass(badge, "p-badge-dot")) removeClass(badge, "p-badge-dot"); - if (el.$_badgeValue.length === 1) addClass(badge, "p-badge-circle"); - else removeClass(badge, "p-badge-circle"); - } else if (!el.$_badgeValue && !hasClass(badge, "p-badge-dot")) { - addClass(badge, "p-badge-dot"); - } - } - badge.innerHTML = ""; - badge.appendChild(document.createTextNode(el.$_badgeValue)); - } - }, "updated") -}); -var theme$A = /* @__PURE__ */ __name(function theme3(_ref) { - var dt = _ref.dt; - return "\n.p-breadcrumb {\n background: ".concat(dt("breadcrumb.background"), ";\n padding: ").concat(dt("breadcrumb.padding"), ";\n overflow-x: auto;\n}\n\n.p-breadcrumb-list {\n margin: 0;\n padding: 0;\n list-style-type: none;\n display: flex;\n align-items: center;\n flex-wrap: nowrap;\n gap: ").concat(dt("breadcrumb.gap"), ";\n}\n\n.p-breadcrumb-separator {\n display: flex;\n align-items: center;\n color: ").concat(dt("breadcrumb.separator.color"), ";\n}\n\n.p-breadcrumb-separator-icon:dir(rtl) {\n transform: rotate(180deg);\n}\n\n.p-breadcrumb::-webkit-scrollbar {\n display: none;\n}\n\n.p-breadcrumb-item-link {\n text-decoration: none;\n display: flex;\n align-items: center;\n gap: ").concat(dt("breadcrumb.item.gap"), ";\n transition: background ").concat(dt("breadcrumb.transition.duration"), ", color ").concat(dt("breadcrumb.transition.duration"), ", outline-color ").concat(dt("breadcrumb.transition.duration"), ", box-shadow ").concat(dt("breadcrumb.transition.duration"), ";\n border-radius: ").concat(dt("breadcrumb.item.border.radius"), ";\n outline-color: transparent;\n color: ").concat(dt("breadcrumb.item.color"), ";\n}\n\n.p-breadcrumb-item-link:focus-visible {\n box-shadow: ").concat(dt("breadcrumb.item.focus.ring.shadow"), ";\n outline: ").concat(dt("breadcrumb.item.focus.ring.width"), " ").concat(dt("breadcrumb.item.focus.ring.style"), " ").concat(dt("breadcrumb.item.focus.ring.color"), ";\n outline-offset: ").concat(dt("breadcrumb.item.focus.ring.offset"), ";\n}\n\n.p-breadcrumb-item-link:hover .p-breadcrumb-item-label {\n color: ").concat(dt("breadcrumb.item.hover.color"), ";\n}\n\n.p-breadcrumb-item-label {\n transition: inherit;\n}\n\n.p-breadcrumb-item-icon {\n color: ").concat(dt("breadcrumb.item.icon.color"), ";\n transition: inherit;\n}\n\n.p-breadcrumb-item-link:hover .p-breadcrumb-item-icon {\n color: ").concat(dt("breadcrumb.item.icon.hover.color"), ";\n}\n"); -}, "theme"); -var classes$E = { - root: "p-breadcrumb p-component", - list: "p-breadcrumb-list", - homeItem: "p-breadcrumb-home-item", - separator: "p-breadcrumb-separator", - separatorIcon: "p-breadcrumb-separator-icon", - item: /* @__PURE__ */ __name(function item(_ref2) { - var instance = _ref2.instance; - return ["p-breadcrumb-item", { - "p-disabled": instance.disabled() - }]; - }, "item"), - itemLink: "p-breadcrumb-item-link", - itemIcon: "p-breadcrumb-item-icon", - itemLabel: "p-breadcrumb-item-label" -}; -var BreadcrumbStyle = BaseStyle.extend({ - name: "breadcrumb", - theme: theme$A, - classes: classes$E -}); -var script$2$9 = { - name: "BaseBreadcrumb", - "extends": script$1f, - props: { - model: { - type: Array, - "default": null - }, - home: { - type: null, - "default": null - } - }, - style: BreadcrumbStyle, - provide: /* @__PURE__ */ __name(function provide8() { - return { - $pcBreadcrumb: this, - $parentInstance: this - }; - }, "provide") -}; -var script$1$G = { - name: "BreadcrumbItem", - hostName: "Breadcrumb", - "extends": script$1f, - props: { - item: null, - templates: null, - index: null - }, - methods: { - onClick: /* @__PURE__ */ __name(function onClick2(event2) { - if (this.item.command) { - this.item.command({ - originalEvent: event2, - item: this.item - }); - } - }, "onClick"), - visible: /* @__PURE__ */ __name(function visible() { - return typeof this.item.visible === "function" ? this.item.visible() : this.item.visible !== false; - }, "visible"), - disabled: /* @__PURE__ */ __name(function disabled() { - return typeof this.item.disabled === "function" ? this.item.disabled() : this.item.disabled; - }, "disabled"), - label: /* @__PURE__ */ __name(function label() { - return typeof this.item.label === "function" ? this.item.label() : this.item.label; - }, "label"), - isCurrentUrl: /* @__PURE__ */ __name(function isCurrentUrl() { - var _this$item = this.item, to = _this$item.to, url = _this$item.url; - var lastPath = typeof window !== "undefined" ? window.location.pathname : ""; - return to === lastPath || url === lastPath ? "page" : void 0; - }, "isCurrentUrl") - }, - computed: { - ptmOptions: /* @__PURE__ */ __name(function ptmOptions() { - return { - context: { - item: this.item, - index: this.index - } - }; - }, "ptmOptions"), - getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps() { - var _this = this; - return { - action: mergeProps({ - "class": this.cx("itemLink"), - "aria-current": this.isCurrentUrl(), - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return _this.onClick($event); - }, "onClick") - }, this.ptm("itemLink", this.ptmOptions)), - icon: mergeProps({ - "class": [this.cx("icon"), this.item.icon] - }, this.ptm("icon", this.ptmOptions)), - label: mergeProps({ - "class": this.cx("label") - }, this.ptm("label", this.ptmOptions)) - }; - }, "getMenuItemProps") - } -}; -var _hoisted_1$t = ["href", "target", "aria-current"]; -function render$1$9(_ctx, _cache, $props, $setup, $data, $options) { - return $options.visible() ? (openBlock(), createElementBlock("li", mergeProps({ - key: 0, - "class": [_ctx.cx("item"), $props.item["class"]] - }, _ctx.ptm("item", $options.ptmOptions)), [!$props.templates.item ? (openBlock(), createElementBlock("a", mergeProps({ - key: 0, - href: $props.item.url || "#", - "class": _ctx.cx("itemLink"), - target: $props.item.target, - "aria-current": $options.isCurrentUrl(), - onClick: _cache[0] || (_cache[0] = function() { - return $options.onClick && $options.onClick.apply($options, arguments); - }) - }, _ctx.ptm("itemLink", $options.ptmOptions)), [$props.templates && $props.templates.itemicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.itemicon), { - key: 0, - item: $props.item, - "class": normalizeClass(_ctx.cx("itemIcon", $options.ptmOptions)) - }, null, 8, ["item", "class"])) : $props.item.icon ? (openBlock(), createElementBlock("span", mergeProps({ - key: 1, - "class": [_ctx.cx("itemIcon"), $props.item.icon] - }, _ctx.ptm("itemIcon", $options.ptmOptions)), null, 16)) : createCommentVNode("", true), $props.item.label ? (openBlock(), createElementBlock("span", mergeProps({ - key: 2, - "class": _ctx.cx("itemLabel") - }, _ctx.ptm("itemLabel", $options.ptmOptions)), toDisplayString($options.label()), 17)) : createCommentVNode("", true)], 16, _hoisted_1$t)) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { - key: 1, - item: $props.item, - label: $options.label(), - props: $options.getMenuItemProps - }, null, 8, ["item", "label", "props"]))], 16)) : createCommentVNode("", true); -} -__name(render$1$9, "render$1$9"); -script$1$G.render = render$1$9; -var script$14 = { - name: "Breadcrumb", - "extends": script$2$9, - inheritAttrs: false, - components: { - BreadcrumbItem: script$1$G, - ChevronRightIcon: script$1i - } -}; -function render$X(_ctx, _cache, $props, $setup, $data, $options) { - var _component_BreadcrumbItem = resolveComponent("BreadcrumbItem"); - var _component_ChevronRightIcon = resolveComponent("ChevronRightIcon"); - return openBlock(), createElementBlock("nav", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [createBaseVNode("ol", mergeProps({ - "class": _ctx.cx("list") - }, _ctx.ptm("list")), [_ctx.home ? (openBlock(), createBlock(_component_BreadcrumbItem, mergeProps({ - key: 0, - item: _ctx.home, - "class": _ctx.cx("homeItem"), - templates: _ctx.$slots, - pt: _ctx.pt, - unstyled: _ctx.unstyled - }, _ctx.ptm("homeItem")), null, 16, ["item", "class", "templates", "pt", "unstyled"])) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model, function(item8, i) { - return openBlock(), createElementBlock(Fragment, { - key: item8.label + "_" + i - }, [_ctx.home || i !== 0 ? (openBlock(), createElementBlock("li", mergeProps({ - key: 0, - "class": _ctx.cx("separator"), - ref_for: true - }, _ctx.ptm("separator")), [renderSlot(_ctx.$slots, "separator", {}, function() { - return [createVNode(_component_ChevronRightIcon, mergeProps({ - "aria-hidden": "true", - "class": _ctx.cx("separatorIcon"), - ref_for: true - }, _ctx.ptm("separatorIcon")), null, 16, ["class"])]; - })], 16)) : createCommentVNode("", true), createVNode(_component_BreadcrumbItem, { - item: item8, - index: i, - templates: _ctx.$slots, - pt: _ctx.pt, - unstyled: _ctx.unstyled - }, null, 8, ["item", "index", "templates", "pt", "unstyled"])], 64); - }), 128))], 16)], 16); -} -__name(render$X, "render$X"); -script$14.render = render$X; -var script$13 = { - name: "CalendarIcon", - "extends": script$1j -}; -function render$W(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - d: "M10.7838 1.51351H9.83783V0.567568C9.83783 0.417039 9.77804 0.272676 9.6716 0.166237C9.56516 0.0597971 9.42079 0 9.27027 0C9.11974 0 8.97538 0.0597971 8.86894 0.166237C8.7625 0.272676 8.7027 0.417039 8.7027 0.567568V1.51351H5.29729V0.567568C5.29729 0.417039 5.2375 0.272676 5.13106 0.166237C5.02462 0.0597971 4.88025 0 4.72973 0C4.5792 0 4.43484 0.0597971 4.3284 0.166237C4.22196 0.272676 4.16216 0.417039 4.16216 0.567568V1.51351H3.21621C2.66428 1.51351 2.13494 1.73277 1.74467 2.12305C1.35439 2.51333 1.13513 3.04266 1.13513 3.59459V11.9189C1.13513 12.4709 1.35439 13.0002 1.74467 13.3905C2.13494 13.7807 2.66428 14 3.21621 14H10.7838C11.3357 14 11.865 13.7807 12.2553 13.3905C12.6456 13.0002 12.8649 12.4709 12.8649 11.9189V3.59459C12.8649 3.04266 12.6456 2.51333 12.2553 2.12305C11.865 1.73277 11.3357 1.51351 10.7838 1.51351ZM3.21621 2.64865H4.16216V3.59459C4.16216 3.74512 4.22196 3.88949 4.3284 3.99593C4.43484 4.10237 4.5792 4.16216 4.72973 4.16216C4.88025 4.16216 5.02462 4.10237 5.13106 3.99593C5.2375 3.88949 5.29729 3.74512 5.29729 3.59459V2.64865H8.7027V3.59459C8.7027 3.74512 8.7625 3.88949 8.86894 3.99593C8.97538 4.10237 9.11974 4.16216 9.27027 4.16216C9.42079 4.16216 9.56516 4.10237 9.6716 3.99593C9.77804 3.88949 9.83783 3.74512 9.83783 3.59459V2.64865H10.7838C11.0347 2.64865 11.2753 2.74831 11.4527 2.92571C11.6301 3.10311 11.7297 3.34371 11.7297 3.59459V5.67568H2.27027V3.59459C2.27027 3.34371 2.36993 3.10311 2.54733 2.92571C2.72473 2.74831 2.96533 2.64865 3.21621 2.64865ZM10.7838 12.8649H3.21621C2.96533 12.8649 2.72473 12.7652 2.54733 12.5878C2.36993 12.4104 2.27027 12.1698 2.27027 11.9189V6.81081H11.7297V11.9189C11.7297 12.1698 11.6301 12.4104 11.4527 12.5878C11.2753 12.7652 11.0347 12.8649 10.7838 12.8649Z", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$W, "render$W"); -script$13.render = render$W; -var theme$z = /* @__PURE__ */ __name(function theme4(_ref) { - var dt = _ref.dt; - return "\n.p-datepicker {\n display: inline-flex;\n max-width: 100%;\n}\n\n.p-datepicker-input {\n flex: 1 1 auto;\n width: 1%;\n}\n\n.p-datepicker:has(.p-datepicker-dropdown) .p-datepicker-input {\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n}\n\n.p-datepicker-dropdown {\n cursor: pointer;\n display: inline-flex;\n user-select: none;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n width: ".concat(dt("datepicker.dropdown.width"), ";\n border-start-end-radius: ").concat(dt("datepicker.dropdown.border.radius"), ";\n border-end-end-radius: ").concat(dt("datepicker.dropdown.border.radius"), ";\n background: ").concat(dt("datepicker.dropdown.background"), ";\n border: 1px solid ").concat(dt("datepicker.dropdown.border.color"), ";\n border-inline-start: 0 none;\n color: ").concat(dt("datepicker.dropdown.color"), ";\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-datepicker-dropdown:not(:disabled):hover {\n background: ").concat(dt("datepicker.dropdown.hover.background"), ";\n border-color: ").concat(dt("datepicker.dropdown.hover.border.color"), ";\n color: ").concat(dt("datepicker.dropdown.hover.color"), ";\n}\n\n.p-datepicker-dropdown:not(:disabled):active {\n background: ").concat(dt("datepicker.dropdown.active.background"), ";\n border-color: ").concat(dt("datepicker.dropdown.active.border.color"), ";\n color: ").concat(dt("datepicker.dropdown.active.color"), ";\n}\n\n.p-datepicker-dropdown:focus-visible {\n box-shadow: ").concat(dt("datepicker.dropdown.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.dropdown.focus.ring.width"), " ").concat(dt("datepicker.dropdown.focus.ring.style"), " ").concat(dt("datepicker.dropdown.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.dropdown.focus.ring.offset"), ";\n}\n\n.p-datepicker:has(.p-datepicker-input-icon-container) {\n position: relative;\n}\n\n.p-datepicker:has(.p-datepicker-input-icon-container) .p-datepicker-input {\n padding-inline-end: calc((").concat(dt("form.field.padding.x"), " * 2) + ").concat(dt("icon.size"), ");\n}\n\n.p-datepicker-input-icon-container {\n cursor: pointer;\n position: absolute;\n top: 50%;\n inset-inline-end: ").concat(dt("form.field.padding.x"), ";\n margin-block-start: calc(-1 * (").concat(dt("icon.size"), " / 2));\n color: ").concat(dt("datepicker.input.icon.color"), ";\n line-height: 1;\n}\n\n.p-datepicker-fluid {\n display: flex;\n}\n\n.p-datepicker-fluid .p-datepicker-input {\n width: 1%;\n}\n\n.p-datepicker .p-datepicker-panel {\n min-width: 100%;\n}\n\n.p-datepicker-panel {\n width: auto;\n padding: ").concat(dt("datepicker.panel.padding"), ";\n background: ").concat(dt("datepicker.panel.background"), ";\n color: ").concat(dt("datepicker.panel.color"), ";\n border: 1px solid ").concat(dt("datepicker.panel.border.color"), ";\n border-radius: ").concat(dt("datepicker.panel.border.radius"), ";\n box-shadow: ").concat(dt("datepicker.panel.shadow"), ";\n}\n\n.p-datepicker-panel-inline {\n display: inline-block;\n overflow-x: auto;\n box-shadow: none;\n}\n\n.p-datepicker-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: ").concat(dt("datepicker.header.padding"), ";\n background: ").concat(dt("datepicker.header.background"), ";\n color: ").concat(dt("datepicker.header.color"), ";\n border-block-end: 1px solid ").concat(dt("datepicker.header.border.color"), ";\n}\n\n.p-datepicker-next-button:dir(rtl) {\n order: -1;\n}\n\n.p-datepicker-prev-button:dir(rtl) {\n order: 1;\n}\n\n.p-datepicker-title {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ").concat(dt("datepicker.title.gap"), ";\n font-weight: ").concat(dt("datepicker.title.font.weight"), ";\n}\n\n.p-datepicker-select-year,\n.p-datepicker-select-month {\n border: none;\n background: transparent;\n margin: 0;\n cursor: pointer;\n font-weight: inherit;\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ", box-shadow ").concat(dt("datepicker.transition.duration"), ";\n}\n\n.p-datepicker-select-month {\n padding: ").concat(dt("datepicker.select.month.padding"), ";\n color: ").concat(dt("datepicker.select.month.color"), ";\n border-radius: ").concat(dt("datepicker.select.month.border.radius"), ";\n}\n\n.p-datepicker-select-year {\n padding: ").concat(dt("datepicker.select.year.padding"), ";\n color: ").concat(dt("datepicker.select.year.color"), ";\n border-radius: ").concat(dt("datepicker.select.year.border.radius"), ";\n}\n\n.p-datepicker-select-month:enabled:hover {\n background: ").concat(dt("datepicker.select.month.hover.background"), ";\n color: ").concat(dt("datepicker.select.month.hover.color"), ";\n}\n\n.p-datepicker-select-year:enabled:hover {\n background: ").concat(dt("datepicker.select.year.hover.background"), ";\n color: ").concat(dt("datepicker.select.year.hover.color"), ";\n}\n\n.p-datepicker-select-month:focus-visible,\n.p-datepicker-select-year:focus-visible {\n box-shadow: ").concat(dt("datepicker.date.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.date.focus.ring.width"), " ").concat(dt("datepicker.date.focus.ring.style"), " ").concat(dt("datepicker.date.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.date.focus.ring.offset"), ";\n}\n\n.p-datepicker-calendar-container {\n display: flex;\n}\n\n.p-datepicker-calendar-container .p-datepicker-calendar {\n flex: 1 1 auto;\n border-inline-start: 1px solid ").concat(dt("datepicker.group.border.color"), ";\n padding-inline-end: ").concat(dt("datepicker.group.gap"), ";\n padding-inline-start: ").concat(dt("datepicker.group.gap"), ";\n}\n\n.p-datepicker-calendar-container .p-datepicker-calendar:first-child {\n padding-inline-start: 0;\n border-inline-start: 0 none;\n}\n\n.p-datepicker-calendar-container .p-datepicker-calendar:last-child {\n padding-inline-end: 0;\n}\n\n.p-datepicker-day-view {\n width: 100%;\n border-collapse: collapse;\n font-size: 1rem;\n margin: ").concat(dt("datepicker.day.view.margin"), ";\n}\n\n.p-datepicker-weekday-cell {\n padding: ").concat(dt("datepicker.week.day.padding"), ";\n}\n\n.p-datepicker-weekday {\n font-weight: ").concat(dt("datepicker.week.day.font.weight"), ";\n color: ").concat(dt("datepicker.week.day.color"), ";\n}\n\n.p-datepicker-day-cell {\n padding: ").concat(dt("datepicker.date.padding"), ";\n}\n\n.p-datepicker-day {\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n margin: 0 auto;\n overflow: hidden;\n position: relative;\n width: ").concat(dt("datepicker.date.width"), ";\n height: ").concat(dt("datepicker.date.height"), ";\n border-radius: ").concat(dt("datepicker.date.border.radius"), ";\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", box-shadow ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ";\n border: 1px solid transparent;\n outline-color: transparent;\n color: ").concat(dt("datepicker.date.color"), ";\n}\n\n.p-datepicker-day:not(.p-datepicker-day-selected):not(.p-disabled):hover {\n background: ").concat(dt("datepicker.date.hover.background"), ";\n color: ").concat(dt("datepicker.date.hover.color"), ";\n}\n\n.p-datepicker-day:focus-visible {\n box-shadow: ").concat(dt("datepicker.date.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.date.focus.ring.width"), " ").concat(dt("datepicker.date.focus.ring.style"), " ").concat(dt("datepicker.date.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.date.focus.ring.offset"), ";\n}\n\n.p-datepicker-day-selected {\n background: ").concat(dt("datepicker.date.selected.background"), ";\n color: ").concat(dt("datepicker.date.selected.color"), ";\n}\n\n.p-datepicker-day-selected-range {\n background: ").concat(dt("datepicker.date.range.selected.background"), ";\n color: ").concat(dt("datepicker.date.range.selected.color"), ";\n}\n\n.p-datepicker-today > .p-datepicker-day {\n background: ").concat(dt("datepicker.today.background"), ";\n color: ").concat(dt("datepicker.today.color"), ";\n}\n\n.p-datepicker-today > .p-datepicker-day-selected {\n background: ").concat(dt("datepicker.date.selected.background"), ";\n color: ").concat(dt("datepicker.date.selected.color"), ";\n}\n\n.p-datepicker-today > .p-datepicker-day-selected-range {\n background: ").concat(dt("datepicker.date.range.selected.background"), ";\n color: ").concat(dt("datepicker.date.range.selected.color"), ";\n}\n\n.p-datepicker-weeknumber {\n text-align: center;\n}\n\n.p-datepicker-month-view {\n margin: ").concat(dt("datepicker.month.view.margin"), ";\n}\n\n.p-datepicker-month {\n width: 33.3%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n overflow: hidden;\n position: relative;\n padding: ").concat(dt("datepicker.month.padding"), ";\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", box-shadow ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ";\n border-radius: ").concat(dt("datepicker.month.border.radius"), ";\n outline-color: transparent;\n color: ").concat(dt("datepicker.date.color"), ";\n}\n\n.p-datepicker-month:not(.p-disabled):not(.p-datepicker-month-selected):hover {\n color: ").concat(dt("datepicker.date.hover.color"), ";\n background: ").concat(dt("datepicker.date.hover.background"), ";\n}\n\n.p-datepicker-month-selected {\n color: ").concat(dt("datepicker.date.selected.color"), ";\n background: ").concat(dt("datepicker.date.selected.background"), ";\n}\n\n.p-datepicker-month:not(.p-disabled):focus-visible {\n box-shadow: ").concat(dt("datepicker.date.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.date.focus.ring.width"), " ").concat(dt("datepicker.date.focus.ring.style"), " ").concat(dt("datepicker.date.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.date.focus.ring.offset"), ";\n}\n\n.p-datepicker-year-view {\n margin: ").concat(dt("datepicker.year.view.margin"), ";\n}\n\n.p-datepicker-year {\n width: 50%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n overflow: hidden;\n position: relative;\n padding: ").concat(dt("datepicker.year.padding"), ";\n transition: background ").concat(dt("datepicker.transition.duration"), ", color ").concat(dt("datepicker.transition.duration"), ", border-color ").concat(dt("datepicker.transition.duration"), ", box-shadow ").concat(dt("datepicker.transition.duration"), ", outline-color ").concat(dt("datepicker.transition.duration"), ";\n border-radius: ").concat(dt("datepicker.year.border.radius"), ";\n outline-color: transparent;\n color: ").concat(dt("datepicker.date.color"), ";\n}\n\n.p-datepicker-year:not(.p-disabled):not(.p-datepicker-year-selected):hover {\n color: ").concat(dt("datepicker.date.hover.color"), ";\n background: ").concat(dt("datepicker.date.hover.background"), ";\n}\n\n.p-datepicker-year-selected {\n color: ").concat(dt("datepicker.date.selected.color"), ";\n background: ").concat(dt("datepicker.date.selected.background"), ";\n}\n\n.p-datepicker-year:not(.p-disabled):focus-visible {\n box-shadow: ").concat(dt("datepicker.date.focus.ring.shadow"), ";\n outline: ").concat(dt("datepicker.date.focus.ring.width"), " ").concat(dt("datepicker.date.focus.ring.style"), " ").concat(dt("datepicker.date.focus.ring.color"), ";\n outline-offset: ").concat(dt("datepicker.date.focus.ring.offset"), ";\n}\n\n.p-datepicker-buttonbar {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: ").concat(dt("datepicker.buttonbar.padding"), ";\n border-block-start: 1px solid ").concat(dt("datepicker.buttonbar.border.color"), ";\n}\n\n.p-datepicker-buttonbar .p-button {\n width: auto;\n}\n\n.p-datepicker-time-picker {\n display: flex;\n justify-content: center;\n align-items: center;\n border-block-start: 1px solid ").concat(dt("datepicker.time.picker.border.color"), ";\n padding: 0;\n gap: ").concat(dt("datepicker.time.picker.gap"), ";\n}\n\n.p-datepicker-calendar-container + .p-datepicker-time-picker {\n padding: ").concat(dt("datepicker.time.picker.padding"), ";\n}\n\n.p-datepicker-time-picker > div {\n display: flex;\n align-items: center;\n flex-direction: column;\n gap: ").concat(dt("datepicker.time.picker.button.gap"), ";\n}\n\n.p-datepicker-time-picker span {\n font-size: 1rem;\n}\n\n.p-datepicker-timeonly .p-datepicker-time-picker {\n border-block-start: 0 none;\n}\n\n.p-datepicker:has(.p-inputtext-sm) .p-datepicker-dropdown {\n width: ").concat(dt("datepicker.dropdown.sm.width"), ";\n}\n\n.p-datepicker:has(.p-inputtext-sm) .p-datepicker-dropdown .p-icon,\n.p-datepicker:has(.p-inputtext-sm) .p-datepicker-input-icon {\n font-size: ").concat(dt("form.field.sm.font.size"), ";\n width: ").concat(dt("form.field.sm.font.size"), ";\n height: ").concat(dt("form.field.sm.font.size"), ";\n}\n\n.p-datepicker:has(.p-inputtext-lg) .p-datepicker-dropdown {\n width: ").concat(dt("datepicker.dropdown.lg.width"), ";\n}\n\n.p-datepicker:has(.p-inputtext-lg) .p-datepicker-dropdown .p-icon,\n.p-datepicker:has(.p-inputtext-lg) .p-datepicker-input-icon {\n font-size: ").concat(dt("form.field.lg.font.size"), ";\n width: ").concat(dt("form.field.lg.font.size"), ";\n height: ").concat(dt("form.field.lg.font.size"), ";\n}\n"); -}, "theme"); -var inlineStyles$8 = { - root: /* @__PURE__ */ __name(function root3(_ref2) { - var props = _ref2.props; - return { - position: props.appendTo === "self" ? "relative" : void 0 - }; - }, "root") -}; -var classes$D = { - root: /* @__PURE__ */ __name(function root4(_ref3) { - var instance = _ref3.instance, state = _ref3.state; - return ["p-datepicker p-component p-inputwrapper", { - "p-invalid": instance.$invalid, - "p-inputwrapper-filled": instance.$filled, - "p-inputwrapper-focus": state.focused || state.overlayVisible, - "p-focus": state.focused || state.overlayVisible, - "p-datepicker-fluid": instance.$fluid - }]; - }, "root"), - pcInputText: "p-datepicker-input", - dropdown: "p-datepicker-dropdown", - inputIconContainer: "p-datepicker-input-icon-container", - inputIcon: "p-datepicker-input-icon", - panel: /* @__PURE__ */ __name(function panel(_ref4) { - var props = _ref4.props; - return ["p-datepicker-panel p-component", { - "p-datepicker-panel-inline": props.inline, - "p-disabled": props.disabled, - "p-datepicker-timeonly": props.timeOnly - }]; - }, "panel"), - calendarContainer: "p-datepicker-calendar-container", - calendar: "p-datepicker-calendar", - header: "p-datepicker-header", - pcPrevButton: "p-datepicker-prev-button", - title: "p-datepicker-title", - selectMonth: "p-datepicker-select-month", - selectYear: "p-datepicker-select-year", - decade: "p-datepicker-decade", - pcNextButton: "p-datepicker-next-button", - dayView: "p-datepicker-day-view", - weekHeader: "p-datepicker-weekheader p-disabled", - weekNumber: "p-datepicker-weeknumber", - weekLabelContainer: "p-datepicker-weeklabel-container p-disabled", - weekDayCell: "p-datepicker-weekday-cell", - weekDay: "p-datepicker-weekday", - dayCell: /* @__PURE__ */ __name(function dayCell(_ref5) { - var date = _ref5.date; - return ["p-datepicker-day-cell", { - "p-datepicker-other-month": date.otherMonth, - "p-datepicker-today": date.today - }]; - }, "dayCell"), - day: /* @__PURE__ */ __name(function day(_ref6) { - var instance = _ref6.instance, props = _ref6.props, date = _ref6.date; - var selectedDayClass = ""; - if (instance.isRangeSelection() && instance.isSelected(date) && date.selectable) { - selectedDayClass = instance.isDateEquals(props.modelValue[0], date) || instance.isDateEquals(props.modelValue[1], date) ? "p-datepicker-day-selected" : "p-datepicker-day-selected-range"; - } - return ["p-datepicker-day", { - "p-datepicker-day-selected": !instance.isRangeSelection() && instance.isSelected(date) && date.selectable, - "p-disabled": props.disabled || !date.selectable - }, selectedDayClass]; - }, "day"), - monthView: "p-datepicker-month-view", - month: /* @__PURE__ */ __name(function month(_ref7) { - var instance = _ref7.instance, props = _ref7.props, _month = _ref7.month, index = _ref7.index; - return ["p-datepicker-month", { - "p-datepicker-month-selected": instance.isMonthSelected(index), - "p-disabled": props.disabled || !_month.selectable - }]; - }, "month"), - yearView: "p-datepicker-year-view", - year: /* @__PURE__ */ __name(function year(_ref8) { - var instance = _ref8.instance, props = _ref8.props, _year = _ref8.year; - return ["p-datepicker-year", { - "p-datepicker-year-selected": instance.isYearSelected(_year.value), - "p-disabled": props.disabled || !_year.selectable - }]; - }, "year"), - timePicker: "p-datepicker-time-picker", - hourPicker: "p-datepicker-hour-picker", - pcIncrementButton: "p-datepicker-increment-button", - pcDecrementButton: "p-datepicker-decrement-button", - separator: "p-datepicker-separator", - minutePicker: "p-datepicker-minute-picker", - secondPicker: "p-datepicker-second-picker", - ampmPicker: "p-datepicker-ampm-picker", - buttonbar: "p-datepicker-buttonbar", - pcTodayButton: "p-datepicker-today-button", - pcClearButton: "p-datepicker-clear-button" -}; -var DatePickerStyle = BaseStyle.extend({ - name: "datepicker", - theme: theme$z, - classes: classes$D, - inlineStyles: inlineStyles$8 -}); -var script$1$F = { - name: "BaseDatePicker", - "extends": script$1k, - props: { - selectionMode: { - type: String, - "default": "single" - }, - dateFormat: { - type: String, - "default": null - }, - inline: { - type: Boolean, - "default": false - }, - showOtherMonths: { - type: Boolean, - "default": true - }, - selectOtherMonths: { - type: Boolean, - "default": false - }, - showIcon: { - type: Boolean, - "default": false - }, - iconDisplay: { - type: String, - "default": "button" - }, - icon: { - type: String, - "default": void 0 - }, - prevIcon: { - type: String, - "default": void 0 - }, - nextIcon: { - type: String, - "default": void 0 - }, - incrementIcon: { - type: String, - "default": void 0 - }, - decrementIcon: { - type: String, - "default": void 0 - }, - numberOfMonths: { - type: Number, - "default": 1 - }, - responsiveOptions: Array, - breakpoint: { - type: String, - "default": "769px" - }, - view: { - type: String, - "default": "date" - }, - minDate: { - type: Date, - value: null - }, - maxDate: { - type: Date, - value: null - }, - disabledDates: { - type: Array, - value: null - }, - disabledDays: { - type: Array, - value: null - }, - maxDateCount: { - type: Number, - value: null - }, - showOnFocus: { - type: Boolean, - "default": true - }, - autoZIndex: { - type: Boolean, - "default": true - }, - baseZIndex: { - type: Number, - "default": 0 - }, - showButtonBar: { - type: Boolean, - "default": false - }, - shortYearCutoff: { - type: String, - "default": "+10" - }, - showTime: { - type: Boolean, - "default": false - }, - timeOnly: { - type: Boolean, - "default": false - }, - hourFormat: { - type: String, - "default": "24" - }, - stepHour: { - type: Number, - "default": 1 - }, - stepMinute: { - type: Number, - "default": 1 - }, - stepSecond: { - type: Number, - "default": 1 - }, - showSeconds: { - type: Boolean, - "default": false - }, - hideOnDateTimeSelect: { - type: Boolean, - "default": false - }, - hideOnRangeSelection: { - type: Boolean, - "default": false - }, - timeSeparator: { - type: String, - "default": ":" - }, - showWeek: { - type: Boolean, - "default": false - }, - manualInput: { - type: Boolean, - "default": true - }, - appendTo: { - type: [String, Object], - "default": "body" - }, - readonly: { - type: Boolean, - "default": false - }, - placeholder: { - type: String, - "default": null - }, - id: { - type: String, - "default": null - }, - inputId: { - type: String, - "default": null - }, - inputClass: { - type: [String, Object], - "default": null - }, - inputStyle: { - type: Object, - "default": null - }, - panelClass: { - type: [String, Object], - "default": null - }, - panelStyle: { - type: Object, - "default": null - }, - todayButtonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default2() { - return { - severity: "secondary", - text: true, - size: "small" - }; - }, "_default") - }, - clearButtonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default3() { - return { - severity: "secondary", - text: true, - size: "small" - }; - }, "_default") - }, - navigatorButtonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default4() { - return { - severity: "secondary", - text: true, - rounded: true - }; - }, "_default") - }, - timepickerButtonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default5() { - return { - severity: "secondary", - text: true, - rounded: true - }; - }, "_default") - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - } - }, - style: DatePickerStyle, - provide: /* @__PURE__ */ __name(function provide9() { - return { - $pcDatePicker: this, - $parentInstance: this - }; - }, "provide") -}; -function _typeof$l(o) { - "@babel/helpers - typeof"; - return _typeof$l = "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$l(o); -} -__name(_typeof$l, "_typeof$l"); -function _toConsumableArray$d(r) { - return _arrayWithoutHoles$d(r) || _iterableToArray$d(r) || _unsupportedIterableToArray$e(r) || _nonIterableSpread$d(); -} -__name(_toConsumableArray$d, "_toConsumableArray$d"); -function _nonIterableSpread$d() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableSpread$d, "_nonIterableSpread$d"); -function _iterableToArray$d(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$d, "_iterableToArray$d"); -function _arrayWithoutHoles$d(r) { - if (Array.isArray(r)) return _arrayLikeToArray$e(r); -} -__name(_arrayWithoutHoles$d, "_arrayWithoutHoles$d"); -function _createForOfIteratorHelper$4(r, e) { - var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; - if (!t2) { - if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$e(r)) || e) { - t2 && (r = t2); - var _n = 0, F = /* @__PURE__ */ __name(function F2() { - }, "F"); - return { s: F, n: /* @__PURE__ */ __name(function n() { - return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; - }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { - throw r2; - }, "e"), 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 = true, u = false; - return { s: /* @__PURE__ */ __name(function s() { - t2 = t2.call(r); - }, "s"), n: /* @__PURE__ */ __name(function n() { - var r2 = t2.next(); - return a = r2.done, r2; - }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { - u = true, o = r2; - }, "e"), f: /* @__PURE__ */ __name(function f() { - try { - a || null == t2["return"] || t2["return"](); - } finally { - if (u) throw o; - } - }, "f") }; -} -__name(_createForOfIteratorHelper$4, "_createForOfIteratorHelper$4"); -function _unsupportedIterableToArray$e(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$e(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$e(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$e, "_unsupportedIterableToArray$e"); -function _arrayLikeToArray$e(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; -} -__name(_arrayLikeToArray$e, "_arrayLikeToArray$e"); -var script$12 = { - name: "DatePicker", - "extends": script$1$F, - inheritAttrs: false, - emits: ["show", "hide", "input", "month-change", "year-change", "date-select", "today-click", "clear-click", "focus", "blur", "keydown"], - inject: { - $pcFluid: { - "default": null - } - }, - navigationState: null, - timePickerChange: false, - scrollHandler: null, - outsideClickListener: null, - resizeListener: null, - matchMediaListener: null, - overlay: null, - input: null, - previousButton: null, - nextButton: null, - timePickerTimer: null, - preventFocus: false, - typeUpdate: false, - data: /* @__PURE__ */ __name(function data2() { - return { - d_id: this.id, - currentMonth: null, - currentYear: null, - currentHour: null, - currentMinute: null, - currentSecond: null, - pm: null, - focused: false, - overlayVisible: false, - currentView: this.view, - query: null, - queryMatches: false - }; - }, "data"), - watch: { - id: /* @__PURE__ */ __name(function id3(newValue) { - this.d_id = newValue || UniqueComponentId(); - }, "id"), - modelValue: /* @__PURE__ */ __name(function modelValue(newValue) { - this.updateCurrentMetaData(); - if (!this.typeUpdate && !this.inline && this.input) { - this.input.value = this.inputFieldValue; - } - this.typeUpdate = false; - }, "modelValue"), - showTime: /* @__PURE__ */ __name(function showTime() { - this.updateCurrentMetaData(); - }, "showTime"), - minDate: /* @__PURE__ */ __name(function minDate() { - this.updateCurrentMetaData(); - }, "minDate"), - maxDate: /* @__PURE__ */ __name(function maxDate() { - this.updateCurrentMetaData(); - }, "maxDate"), - months: /* @__PURE__ */ __name(function months() { - if (this.overlay) { - if (!this.focused) { - if (this.inline) { - this.preventFocus = true; - } - setTimeout(this.updateFocus, 0); - } - } - }, "months"), - numberOfMonths: /* @__PURE__ */ __name(function numberOfMonths() { - this.destroyResponsiveStyleElement(); - this.createResponsiveStyle(); - }, "numberOfMonths"), - responsiveOptions: /* @__PURE__ */ __name(function responsiveOptions() { - this.destroyResponsiveStyleElement(); - this.createResponsiveStyle(); - }, "responsiveOptions"), - currentView: /* @__PURE__ */ __name(function currentView() { - var _this = this; - Promise.resolve(null).then(function() { - return _this.alignOverlay(); - }); - }, "currentView"), - view: /* @__PURE__ */ __name(function view(newValue) { - this.currentView = newValue; - }, "view") - }, - created: /* @__PURE__ */ __name(function created2() { - this.updateCurrentMetaData(); - }, "created"), - mounted: /* @__PURE__ */ __name(function mounted5() { - this.d_id = this.d_id || UniqueComponentId(); - this.createResponsiveStyle(); - this.bindMatchMediaListener(); - if (this.inline) { - if (!this.disabled) { - this.preventFocus = true; - this.initFocusableCell(); - } - } else { - this.input.value = this.inputFieldValue; - } - }, "mounted"), - updated: /* @__PURE__ */ __name(function updated2() { - if (this.overlay) { - this.preventFocus = true; - setTimeout(this.updateFocus, 0); - } - if (this.input && this.selectionStart != null && this.selectionEnd != null) { - this.input.selectionStart = this.selectionStart; - this.input.selectionEnd = this.selectionEnd; - this.selectionStart = null; - this.selectionEnd = null; - } - }, "updated"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount() { - if (this.timePickerTimer) { - clearTimeout(this.timePickerTimer); - } - this.destroyResponsiveStyleElement(); - this.unbindOutsideClickListener(); - this.unbindResizeListener(); - this.unbindMatchMediaListener(); - if (this.scrollHandler) { - this.scrollHandler.destroy(); - this.scrollHandler = null; - } - if (this.overlay && this.autoZIndex) { - ZIndex.clear(this.overlay); - } - this.overlay = null; - }, "beforeUnmount"), - methods: { - isComparable: /* @__PURE__ */ __name(function isComparable() { - return this.d_value != null && typeof this.d_value !== "string"; - }, "isComparable"), - isSelected: /* @__PURE__ */ __name(function isSelected(dateMeta) { - if (!this.isComparable()) { - return false; - } - if (this.d_value) { - if (this.isSingleSelection()) { - return this.isDateEquals(this.d_value, dateMeta); - } else if (this.isMultipleSelection()) { - var selected3 = false; - var _iterator = _createForOfIteratorHelper$4(this.d_value), _step; - try { - for (_iterator.s(); !(_step = _iterator.n()).done; ) { - var date = _step.value; - selected3 = this.isDateEquals(date, dateMeta); - if (selected3) { - break; - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - return selected3; - } else if (this.isRangeSelection()) { - if (this.d_value[1]) return this.isDateEquals(this.d_value[0], dateMeta) || this.isDateEquals(this.d_value[1], dateMeta) || this.isDateBetween(this.d_value[0], this.d_value[1], dateMeta); - else { - return this.isDateEquals(this.d_value[0], dateMeta); - } - } - } - return false; - }, "isSelected"), - isMonthSelected: /* @__PURE__ */ __name(function isMonthSelected(month2) { - var _this2 = this; - if (!this.isComparable()) return false; - if (this.isMultipleSelection()) { - return this.d_value.some(function(currentValue) { - return currentValue.getMonth() === month2 && currentValue.getFullYear() === _this2.currentYear; - }); - } else if (this.isRangeSelection()) { - if (!this.d_value[1]) { - var _this$d_value$, _this$d_value$2; - return ((_this$d_value$ = this.d_value[0]) === null || _this$d_value$ === void 0 ? void 0 : _this$d_value$.getFullYear()) === this.currentYear && ((_this$d_value$2 = this.d_value[0]) === null || _this$d_value$2 === void 0 ? void 0 : _this$d_value$2.getMonth()) === month2; - } else { - var currentDate = new Date(this.currentYear, month2, 1); - var startDate = new Date(this.d_value[0].getFullYear(), this.d_value[0].getMonth(), 1); - var endDate = new Date(this.d_value[1].getFullYear(), this.d_value[1].getMonth(), 1); - return currentDate >= startDate && currentDate <= endDate; - } - } else { - return this.d_value.getMonth() === month2 && this.d_value.getFullYear() === this.currentYear; - } - }, "isMonthSelected"), - isYearSelected: /* @__PURE__ */ __name(function isYearSelected(year2) { - if (!this.isComparable()) return false; - if (this.isMultipleSelection()) { - return this.d_value.some(function(currentValue) { - return currentValue.getFullYear() === year2; - }); - } else if (this.isRangeSelection()) { - var start = this.d_value[0] ? this.d_value[0].getFullYear() : null; - var end = this.d_value[1] ? this.d_value[1].getFullYear() : null; - return start === year2 || end === year2 || start < year2 && end > year2; - } else { - return this.d_value.getFullYear() === year2; - } - }, "isYearSelected"), - isDateEquals: /* @__PURE__ */ __name(function isDateEquals(value2, dateMeta) { - if (value2) return value2.getDate() === dateMeta.day && value2.getMonth() === dateMeta.month && value2.getFullYear() === dateMeta.year; - else return false; - }, "isDateEquals"), - isDateBetween: /* @__PURE__ */ __name(function isDateBetween(start, end, dateMeta) { - var between = false; - if (start && end) { - var date = new Date(dateMeta.year, dateMeta.month, dateMeta.day); - return start.getTime() <= date.getTime() && end.getTime() >= date.getTime(); - } - return between; - }, "isDateBetween"), - getFirstDayOfMonthIndex: /* @__PURE__ */ __name(function getFirstDayOfMonthIndex(month2, year2) { - var day2 = /* @__PURE__ */ new Date(); - day2.setDate(1); - day2.setMonth(month2); - day2.setFullYear(year2); - var dayIndex = day2.getDay() + this.sundayIndex; - return dayIndex >= 7 ? dayIndex - 7 : dayIndex; - }, "getFirstDayOfMonthIndex"), - getDaysCountInMonth: /* @__PURE__ */ __name(function getDaysCountInMonth(month2, year2) { - return 32 - this.daylightSavingAdjust(new Date(year2, month2, 32)).getDate(); - }, "getDaysCountInMonth"), - getDaysCountInPrevMonth: /* @__PURE__ */ __name(function getDaysCountInPrevMonth(month2, year2) { - var prev = this.getPreviousMonthAndYear(month2, year2); - return this.getDaysCountInMonth(prev.month, prev.year); - }, "getDaysCountInPrevMonth"), - getPreviousMonthAndYear: /* @__PURE__ */ __name(function getPreviousMonthAndYear(month2, year2) { - var m, y; - if (month2 === 0) { - m = 11; - y = year2 - 1; - } else { - m = month2 - 1; - y = year2; - } - return { - month: m, - year: y - }; - }, "getPreviousMonthAndYear"), - getNextMonthAndYear: /* @__PURE__ */ __name(function getNextMonthAndYear(month2, year2) { - var m, y; - if (month2 === 11) { - m = 0; - y = year2 + 1; - } else { - m = month2 + 1; - y = year2; - } - return { - month: m, - year: y - }; - }, "getNextMonthAndYear"), - daylightSavingAdjust: /* @__PURE__ */ __name(function daylightSavingAdjust(date) { - if (!date) { - return null; - } - date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); - return date; - }, "daylightSavingAdjust"), - isToday: /* @__PURE__ */ __name(function isToday(today, day2, month2, year2) { - return today.getDate() === day2 && today.getMonth() === month2 && today.getFullYear() === year2; - }, "isToday"), - isSelectable: /* @__PURE__ */ __name(function isSelectable(day2, month2, year2, otherMonth) { - var validMin = true; - var validMax = true; - var validDate = true; - var validDay = true; - if (otherMonth && !this.selectOtherMonths) { - return false; - } - if (this.minDate) { - if (this.minDate.getFullYear() > year2) { - validMin = false; - } else if (this.minDate.getFullYear() === year2) { - if (this.minDate.getMonth() > month2) { - validMin = false; - } else if (this.minDate.getMonth() === month2) { - if (this.minDate.getDate() > day2) { - validMin = false; - } - } - } - } - if (this.maxDate) { - if (this.maxDate.getFullYear() < year2) { - validMax = false; - } else if (this.maxDate.getFullYear() === year2) { - if (this.maxDate.getMonth() < month2) { - validMax = false; - } else if (this.maxDate.getMonth() === month2) { - if (this.maxDate.getDate() < day2) { - validMax = false; - } - } - } - } - if (this.disabledDates) { - validDate = !this.isDateDisabled(day2, month2, year2); - } - if (this.disabledDays) { - validDay = !this.isDayDisabled(day2, month2, year2); - } - return validMin && validMax && validDate && validDay; - }, "isSelectable"), - onOverlayEnter: /* @__PURE__ */ __name(function onOverlayEnter(el) { - var styles = !this.inline ? { - position: "absolute", - top: "0", - left: "0" - } : void 0; - addStyle(el, styles); - if (this.autoZIndex) { - ZIndex.set("overlay", el, this.baseZIndex || this.$primevue.config.zIndex.overlay); - } - this.alignOverlay(); - this.$emit("show"); - }, "onOverlayEnter"), - onOverlayEnterComplete: /* @__PURE__ */ __name(function onOverlayEnterComplete() { - this.bindOutsideClickListener(); - this.bindScrollListener(); - this.bindResizeListener(); - }, "onOverlayEnterComplete"), - onOverlayAfterLeave: /* @__PURE__ */ __name(function onOverlayAfterLeave(el) { - if (this.autoZIndex) { - ZIndex.clear(el); - } - }, "onOverlayAfterLeave"), - onOverlayLeave: /* @__PURE__ */ __name(function onOverlayLeave() { - this.currentView = this.view; - this.unbindOutsideClickListener(); - this.unbindScrollListener(); - this.unbindResizeListener(); - this.$emit("hide"); - this.overlay = null; - }, "onOverlayLeave"), - onPrevButtonClick: /* @__PURE__ */ __name(function onPrevButtonClick(event2) { - this.navigationState = { - backward: true, - button: true - }; - this.navBackward(event2); - }, "onPrevButtonClick"), - onNextButtonClick: /* @__PURE__ */ __name(function onNextButtonClick(event2) { - this.navigationState = { - backward: false, - button: true - }; - this.navForward(event2); - }, "onNextButtonClick"), - navBackward: /* @__PURE__ */ __name(function navBackward(event2) { - event2.preventDefault(); - if (!this.isEnabled()) { - return; - } - if (this.currentView === "month") { - this.decrementYear(); - this.$emit("year-change", { - month: this.currentMonth, - year: this.currentYear - }); - } else if (this.currentView === "year") { - this.decrementDecade(); - } else { - if (event2.shiftKey) { - this.decrementYear(); - } else { - if (this.currentMonth === 0) { - this.currentMonth = 11; - this.decrementYear(); - } else { - this.currentMonth--; - } - this.$emit("month-change", { - month: this.currentMonth + 1, - year: this.currentYear - }); - } - } - }, "navBackward"), - navForward: /* @__PURE__ */ __name(function navForward(event2) { - event2.preventDefault(); - if (!this.isEnabled()) { - return; - } - if (this.currentView === "month") { - this.incrementYear(); - this.$emit("year-change", { - month: this.currentMonth, - year: this.currentYear - }); - } else if (this.currentView === "year") { - this.incrementDecade(); - } else { - if (event2.shiftKey) { - this.incrementYear(); - } else { - if (this.currentMonth === 11) { - this.currentMonth = 0; - this.incrementYear(); - } else { - this.currentMonth++; - } - this.$emit("month-change", { - month: this.currentMonth + 1, - year: this.currentYear - }); - } - } - }, "navForward"), - decrementYear: /* @__PURE__ */ __name(function decrementYear() { - this.currentYear--; - }, "decrementYear"), - decrementDecade: /* @__PURE__ */ __name(function decrementDecade() { - this.currentYear = this.currentYear - 10; - }, "decrementDecade"), - incrementYear: /* @__PURE__ */ __name(function incrementYear() { - this.currentYear++; - }, "incrementYear"), - incrementDecade: /* @__PURE__ */ __name(function incrementDecade() { - this.currentYear = this.currentYear + 10; - }, "incrementDecade"), - switchToMonthView: /* @__PURE__ */ __name(function switchToMonthView(event2) { - this.currentView = "month"; - setTimeout(this.updateFocus, 0); - event2.preventDefault(); - }, "switchToMonthView"), - switchToYearView: /* @__PURE__ */ __name(function switchToYearView(event2) { - this.currentView = "year"; - setTimeout(this.updateFocus, 0); - event2.preventDefault(); - }, "switchToYearView"), - isEnabled: /* @__PURE__ */ __name(function isEnabled() { - return !this.disabled && !this.readonly; - }, "isEnabled"), - updateCurrentTimeMeta: /* @__PURE__ */ __name(function updateCurrentTimeMeta(date) { - var currentHour = date.getHours(); - if (this.hourFormat === "12") { - this.pm = currentHour > 11; - if (currentHour >= 12) currentHour = currentHour == 12 ? 12 : currentHour - 12; - } - this.currentHour = Math.floor(currentHour / this.stepHour) * this.stepHour; - this.currentMinute = Math.floor(date.getMinutes() / this.stepMinute) * this.stepMinute; - this.currentSecond = Math.floor(date.getSeconds() / this.stepSecond) * this.stepSecond; - }, "updateCurrentTimeMeta"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener() { - var _this3 = this; - if (!this.outsideClickListener) { - this.outsideClickListener = function(event2) { - if (_this3.overlayVisible && _this3.isOutsideClicked(event2)) { - _this3.overlayVisible = false; - } - }; - document.addEventListener("mousedown", this.outsideClickListener); - } - }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener() { - if (this.outsideClickListener) { - document.removeEventListener("mousedown", this.outsideClickListener); - this.outsideClickListener = null; - } - }, "unbindOutsideClickListener"), - bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener() { - var _this4 = this; - if (!this.scrollHandler) { - this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, function() { - if (_this4.overlayVisible) { - _this4.overlayVisible = false; - } - }); - } - this.scrollHandler.bindScrollListener(); - }, "bindScrollListener"), - unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener() { - if (this.scrollHandler) { - this.scrollHandler.unbindScrollListener(); - } - }, "unbindScrollListener"), - bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener() { - var _this5 = this; - if (!this.resizeListener) { - this.resizeListener = function() { - if (_this5.overlayVisible && !isTouchDevice()) { - _this5.overlayVisible = false; - } - }; - window.addEventListener("resize", this.resizeListener); - } - }, "bindResizeListener"), - unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener() { - if (this.resizeListener) { - window.removeEventListener("resize", this.resizeListener); - this.resizeListener = null; - } - }, "unbindResizeListener"), - bindMatchMediaListener: /* @__PURE__ */ __name(function bindMatchMediaListener() { - var _this6 = this; - if (!this.matchMediaListener) { - var query = matchMedia("(max-width: ".concat(this.breakpoint, ")")); - this.query = query; - this.queryMatches = query.matches; - this.matchMediaListener = function() { - _this6.queryMatches = query.matches; - _this6.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"), - isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked(event2) { - return !(this.$el.isSameNode(event2.target) || this.isNavIconClicked(event2) || this.$el.contains(event2.target) || this.overlay && this.overlay.contains(event2.target)); - }, "isOutsideClicked"), - isNavIconClicked: /* @__PURE__ */ __name(function isNavIconClicked(event2) { - return this.previousButton && (this.previousButton.isSameNode(event2.target) || this.previousButton.contains(event2.target)) || this.nextButton && (this.nextButton.isSameNode(event2.target) || this.nextButton.contains(event2.target)); - }, "isNavIconClicked"), - alignOverlay: /* @__PURE__ */ __name(function alignOverlay() { - if (this.overlay) { - if (this.appendTo === "self" || this.inline) { - relativePosition(this.overlay, this.$el); - } else { - if (this.view === "date") { - this.overlay.style.width = getOuterWidth(this.overlay) + "px"; - this.overlay.style.minWidth = getOuterWidth(this.$el) + "px"; - } else { - this.overlay.style.width = getOuterWidth(this.$el) + "px"; - } - absolutePosition(this.overlay, this.$el); - } - } - }, "alignOverlay"), - onButtonClick: /* @__PURE__ */ __name(function onButtonClick() { - if (this.isEnabled()) { - if (!this.overlayVisible) { - this.input.focus(); - this.overlayVisible = true; - } else { - this.overlayVisible = false; - } - } - }, "onButtonClick"), - isDateDisabled: /* @__PURE__ */ __name(function isDateDisabled(day2, month2, year2) { - if (this.disabledDates) { - var _iterator2 = _createForOfIteratorHelper$4(this.disabledDates), _step2; - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { - var disabledDate = _step2.value; - if (disabledDate.getFullYear() === year2 && disabledDate.getMonth() === month2 && disabledDate.getDate() === day2) { - return true; - } - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - } - return false; - }, "isDateDisabled"), - isDayDisabled: /* @__PURE__ */ __name(function isDayDisabled(day2, month2, year2) { - if (this.disabledDays) { - var weekday = new Date(year2, month2, day2); - var weekdayNumber = weekday.getDay(); - return this.disabledDays.indexOf(weekdayNumber) !== -1; - } - return false; - }, "isDayDisabled"), - onMonthDropdownChange: /* @__PURE__ */ __name(function onMonthDropdownChange(value2) { - this.currentMonth = parseInt(value2); - this.$emit("month-change", { - month: this.currentMonth + 1, - year: this.currentYear - }); - }, "onMonthDropdownChange"), - onYearDropdownChange: /* @__PURE__ */ __name(function onYearDropdownChange(value2) { - this.currentYear = parseInt(value2); - this.$emit("year-change", { - month: this.currentMonth + 1, - year: this.currentYear - }); - }, "onYearDropdownChange"), - onDateSelect: /* @__PURE__ */ __name(function onDateSelect(event2, dateMeta) { - var _this7 = this; - if (this.disabled || !dateMeta.selectable) { - return; - } - find(this.overlay, 'table td span:not([data-p-disabled="true"])').forEach(function(cell) { - return cell.tabIndex = -1; - }); - if (event2) { - event2.currentTarget.focus(); - } - if (this.isMultipleSelection() && this.isSelected(dateMeta)) { - var newValue = this.d_value.filter(function(date) { - return !_this7.isDateEquals(date, dateMeta); - }); - this.updateModel(newValue); - } else { - if (this.shouldSelectDate(dateMeta)) { - if (dateMeta.otherMonth) { - this.currentMonth = dateMeta.month; - this.currentYear = dateMeta.year; - this.selectDate(dateMeta); - } else { - this.selectDate(dateMeta); - } - } - } - if (this.isSingleSelection() && (!this.showTime || this.hideOnDateTimeSelect)) { - if (this.input) { - this.input.focus(); - } - setTimeout(function() { - _this7.overlayVisible = false; - }, 150); - } - }, "onDateSelect"), - selectDate: /* @__PURE__ */ __name(function selectDate(dateMeta) { - var _this8 = this; - var date = new Date(dateMeta.year, dateMeta.month, dateMeta.day); - if (this.showTime) { - this.hourFormat === "12" && this.currentHour !== 12 && this.pm ? date.setHours(this.currentHour + 12) : date.setHours(this.currentHour); - date.setMinutes(this.currentMinute); - date.setSeconds(this.currentSecond); - } - if (this.minDate && this.minDate > date) { - date = this.minDate; - this.currentHour = date.getHours(); - this.currentMinute = date.getMinutes(); - this.currentSecond = date.getSeconds(); - } - if (this.maxDate && this.maxDate < date) { - date = this.maxDate; - this.currentHour = date.getHours(); - this.currentMinute = date.getMinutes(); - this.currentSecond = date.getSeconds(); - } - var modelVal = null; - if (this.isSingleSelection()) { - modelVal = date; - } else if (this.isMultipleSelection()) { - modelVal = this.d_value ? [].concat(_toConsumableArray$d(this.d_value), [date]) : [date]; - } else if (this.isRangeSelection()) { - if (this.d_value && this.d_value.length) { - var startDate = this.d_value[0]; - var endDate = this.d_value[1]; - if (!endDate && date.getTime() >= startDate.getTime()) { - endDate = date; - } else { - startDate = date; - endDate = null; - } - modelVal = [startDate, endDate]; - } else { - modelVal = [date, null]; - } - } - if (modelVal !== null) { - this.updateModel(modelVal); - } - if (this.isRangeSelection() && this.hideOnRangeSelection && modelVal[1] !== null) { - setTimeout(function() { - _this8.overlayVisible = false; - }, 150); - } - this.$emit("date-select", date); - }, "selectDate"), - updateModel: /* @__PURE__ */ __name(function updateModel(value2) { - this.writeValue(value2); - }, "updateModel"), - shouldSelectDate: /* @__PURE__ */ __name(function shouldSelectDate() { - if (this.isMultipleSelection()) return this.maxDateCount != null ? this.maxDateCount > (this.d_value ? this.d_value.length : 0) : true; - else return true; - }, "shouldSelectDate"), - isSingleSelection: /* @__PURE__ */ __name(function isSingleSelection() { - return this.selectionMode === "single"; - }, "isSingleSelection"), - isRangeSelection: /* @__PURE__ */ __name(function isRangeSelection() { - return this.selectionMode === "range"; - }, "isRangeSelection"), - isMultipleSelection: /* @__PURE__ */ __name(function isMultipleSelection() { - return this.selectionMode === "multiple"; - }, "isMultipleSelection"), - formatValue: /* @__PURE__ */ __name(function formatValue(value2) { - if (typeof value2 === "string") { - return this.dateFormat ? this.formatDate(new Date(value2), this.dateFormat) : value2; - } - var formattedValue = ""; - if (value2) { - try { - if (this.isSingleSelection()) { - formattedValue = this.formatDateTime(value2); - } else if (this.isMultipleSelection()) { - for (var i = 0; i < value2.length; i++) { - var dateAsString = this.formatDateTime(value2[i]); - formattedValue += dateAsString; - if (i !== value2.length - 1) { - formattedValue += ", "; - } - } - } else if (this.isRangeSelection()) { - if (value2 && value2.length) { - var startDate = value2[0]; - var endDate = value2[1]; - formattedValue = this.formatDateTime(startDate); - if (endDate) { - formattedValue += " - " + this.formatDateTime(endDate); - } - } - } - } catch (err) { - formattedValue = value2; - } - } - return formattedValue; - }, "formatValue"), - formatDateTime: /* @__PURE__ */ __name(function formatDateTime(date) { - var formattedValue = null; - if (date) { - if (this.timeOnly) { - formattedValue = this.formatTime(date); - } else { - formattedValue = this.formatDate(date, this.datePattern); - if (this.showTime) { - formattedValue += " " + this.formatTime(date); - } - } - } - return formattedValue; - }, "formatDateTime"), - formatDate: /* @__PURE__ */ __name(function formatDate(date, format) { - if (!date) { - return ""; - } - var iFormat; - var lookAhead = /* @__PURE__ */ __name(function lookAhead2(match) { - var matches = iFormat + 1 < format.length && format.charAt(iFormat + 1) === match; - if (matches) { - iFormat++; - } - return matches; - }, "lookAhead"), formatNumber = /* @__PURE__ */ __name(function formatNumber2(match, value2, len) { - var num = "" + value2; - if (lookAhead(match)) { - while (num.length < len) { - num = "0" + num; - } - } - return num; - }, "formatNumber"), formatName = /* @__PURE__ */ __name(function formatName2(match, value2, shortNames, longNames) { - return lookAhead(match) ? longNames[value2] : shortNames[value2]; - }, "formatName"); - var output = ""; - var literal = false; - if (date) { - for (iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) { - if (format.charAt(iFormat) === "'" && !lookAhead("'")) { - literal = false; - } else { - output += format.charAt(iFormat); - } - } else { - switch (format.charAt(iFormat)) { - case "d": - output += formatNumber("d", date.getDate(), 2); - break; - case "D": - output += formatName("D", date.getDay(), this.$primevue.config.locale.dayNamesShort, this.$primevue.config.locale.dayNames); - break; - case "o": - output += formatNumber("o", Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 864e5), 3); - break; - case "m": - output += formatNumber("m", date.getMonth() + 1, 2); - break; - case "M": - output += formatName("M", date.getMonth(), this.$primevue.config.locale.monthNamesShort, this.$primevue.config.locale.monthNames); - break; - case "y": - output += lookAhead("y") ? date.getFullYear() : (date.getFullYear() % 100 < 10 ? "0" : "") + date.getFullYear() % 100; - break; - case "@": - output += date.getTime(); - break; - case "!": - output += date.getTime() * 1e4 + this.ticksTo1970; - break; - case "'": - if (lookAhead("'")) { - output += "'"; - } else { - literal = true; - } - break; - default: - output += format.charAt(iFormat); - } - } - } - } - return output; - }, "formatDate"), - formatTime: /* @__PURE__ */ __name(function formatTime(date) { - if (!date) { - return ""; - } - var output = ""; - var hours = date.getHours(); - var minutes = date.getMinutes(); - var seconds = date.getSeconds(); - if (this.hourFormat === "12" && hours > 11 && hours !== 12) { - hours -= 12; - } - if (this.hourFormat === "12") { - output += hours === 0 ? 12 : hours < 10 ? "0" + hours : hours; - } else { - output += hours < 10 ? "0" + hours : hours; - } - output += ":"; - output += minutes < 10 ? "0" + minutes : minutes; - if (this.showSeconds) { - output += ":"; - output += seconds < 10 ? "0" + seconds : seconds; - } - if (this.hourFormat === "12") { - output += date.getHours() > 11 ? " ".concat(this.$primevue.config.locale.pm) : " ".concat(this.$primevue.config.locale.am); - } - return output; - }, "formatTime"), - onTodayButtonClick: /* @__PURE__ */ __name(function onTodayButtonClick(event2) { - var date = /* @__PURE__ */ new Date(); - var dateMeta = { - day: date.getDate(), - month: date.getMonth(), - year: date.getFullYear(), - otherMonth: date.getMonth() !== this.currentMonth || date.getFullYear() !== this.currentYear, - today: true, - selectable: true - }; - this.onDateSelect(null, dateMeta); - this.$emit("today-click", date); - event2.preventDefault(); - }, "onTodayButtonClick"), - onClearButtonClick: /* @__PURE__ */ __name(function onClearButtonClick(event2) { - this.updateModel(null); - this.overlayVisible = false; - this.$emit("clear-click", event2); - event2.preventDefault(); - }, "onClearButtonClick"), - onTimePickerElementMouseDown: /* @__PURE__ */ __name(function onTimePickerElementMouseDown(event2, type, direction) { - if (this.isEnabled()) { - this.repeat(event2, null, type, direction); - event2.preventDefault(); - } - }, "onTimePickerElementMouseDown"), - onTimePickerElementMouseUp: /* @__PURE__ */ __name(function onTimePickerElementMouseUp(event2) { - if (this.isEnabled()) { - this.clearTimePickerTimer(); - this.updateModelTime(); - event2.preventDefault(); - } - }, "onTimePickerElementMouseUp"), - onTimePickerElementMouseLeave: /* @__PURE__ */ __name(function onTimePickerElementMouseLeave() { - this.clearTimePickerTimer(); - }, "onTimePickerElementMouseLeave"), - repeat: /* @__PURE__ */ __name(function repeat(event2, interval, type, direction) { - var _this9 = this; - var i = interval || 500; - this.clearTimePickerTimer(); - this.timePickerTimer = setTimeout(function() { - _this9.repeat(event2, 100, type, direction); - }, i); - switch (type) { - case 0: - if (direction === 1) this.incrementHour(event2); - else this.decrementHour(event2); - break; - case 1: - if (direction === 1) this.incrementMinute(event2); - else this.decrementMinute(event2); - break; - case 2: - if (direction === 1) this.incrementSecond(event2); - else this.decrementSecond(event2); - break; - } - }, "repeat"), - convertTo24Hour: /* @__PURE__ */ __name(function convertTo24Hour(hours, pm) { - if (this.hourFormat == "12") { - if (hours === 12) { - return pm ? 12 : 0; - } else { - return pm ? hours + 12 : hours; - } - } - return hours; - }, "convertTo24Hour"), - validateTime: /* @__PURE__ */ __name(function validateTime(hour, minute, second, pm) { - var value2 = this.isComparable() ? this.d_value : this.viewDate; - var convertedHour = this.convertTo24Hour(hour, pm); - if (this.isRangeSelection()) { - value2 = this.d_value[1] || this.d_value[0]; - } - if (this.isMultipleSelection()) { - value2 = this.d_value[this.d_value.length - 1]; - } - var valueDateString = value2 ? value2.toDateString() : null; - if (this.minDate && valueDateString && this.minDate.toDateString() === valueDateString) { - if (this.minDate.getHours() > convertedHour) { - return false; - } - if (this.minDate.getHours() === convertedHour) { - if (this.minDate.getMinutes() > minute) { - return false; - } - if (this.minDate.getMinutes() === minute) { - if (this.minDate.getSeconds() > second) { - return false; - } - } - } - } - if (this.maxDate && valueDateString && this.maxDate.toDateString() === valueDateString) { - if (this.maxDate.getHours() < convertedHour) { - return false; - } - if (this.maxDate.getHours() === convertedHour) { - if (this.maxDate.getMinutes() < minute) { - return false; - } - if (this.maxDate.getMinutes() === minute) { - if (this.maxDate.getSeconds() < second) { - return false; - } - } - } - } - return true; - }, "validateTime"), - incrementHour: /* @__PURE__ */ __name(function incrementHour(event2) { - var prevHour = this.currentHour; - var newHour = this.currentHour + Number(this.stepHour); - var newPM = this.pm; - if (this.hourFormat == "24") newHour = newHour >= 24 ? newHour - 24 : newHour; - else if (this.hourFormat == "12") { - if (prevHour < 12 && newHour > 11) { - newPM = !this.pm; - } - newHour = newHour >= 13 ? newHour - 12 : newHour; - } - if (this.validateTime(newHour, this.currentMinute, this.currentSecond, newPM)) { - this.currentHour = newHour; - this.pm = newPM; - } - event2.preventDefault(); - }, "incrementHour"), - decrementHour: /* @__PURE__ */ __name(function decrementHour(event2) { - var newHour = this.currentHour - this.stepHour; - var newPM = this.pm; - if (this.hourFormat == "24") newHour = newHour < 0 ? 24 + newHour : newHour; - else if (this.hourFormat == "12") { - if (this.currentHour === 12) { - newPM = !this.pm; - } - newHour = newHour <= 0 ? 12 + newHour : newHour; - } - if (this.validateTime(newHour, this.currentMinute, this.currentSecond, newPM)) { - this.currentHour = newHour; - this.pm = newPM; - } - event2.preventDefault(); - }, "decrementHour"), - incrementMinute: /* @__PURE__ */ __name(function incrementMinute(event2) { - var newMinute = this.currentMinute + Number(this.stepMinute); - if (this.validateTime(this.currentHour, newMinute, this.currentSecond, this.pm)) { - this.currentMinute = newMinute > 59 ? newMinute - 60 : newMinute; - } - event2.preventDefault(); - }, "incrementMinute"), - decrementMinute: /* @__PURE__ */ __name(function decrementMinute(event2) { - var newMinute = this.currentMinute - this.stepMinute; - newMinute = newMinute < 0 ? 60 + newMinute : newMinute; - if (this.validateTime(this.currentHour, newMinute, this.currentSecond, this.pm)) { - this.currentMinute = newMinute; - } - event2.preventDefault(); - }, "decrementMinute"), - incrementSecond: /* @__PURE__ */ __name(function incrementSecond(event2) { - var newSecond = this.currentSecond + Number(this.stepSecond); - if (this.validateTime(this.currentHour, this.currentMinute, newSecond, this.pm)) { - this.currentSecond = newSecond > 59 ? newSecond - 60 : newSecond; - } - event2.preventDefault(); - }, "incrementSecond"), - decrementSecond: /* @__PURE__ */ __name(function decrementSecond(event2) { - var newSecond = this.currentSecond - this.stepSecond; - newSecond = newSecond < 0 ? 60 + newSecond : newSecond; - if (this.validateTime(this.currentHour, this.currentMinute, newSecond, this.pm)) { - this.currentSecond = newSecond; - } - event2.preventDefault(); - }, "decrementSecond"), - updateModelTime: /* @__PURE__ */ __name(function updateModelTime() { - var _this10 = this; - this.timePickerChange = true; - var value2 = this.isComparable() ? this.d_value : this.viewDate; - if (this.isRangeSelection()) { - value2 = this.d_value[1] || this.d_value[0]; - } - if (this.isMultipleSelection()) { - value2 = this.d_value[this.d_value.length - 1]; - } - value2 = value2 ? new Date(value2.getTime()) : /* @__PURE__ */ new Date(); - if (this.hourFormat == "12") { - if (this.currentHour === 12) value2.setHours(this.pm ? 12 : 0); - else value2.setHours(this.pm ? this.currentHour + 12 : this.currentHour); - } else { - value2.setHours(this.currentHour); - } - value2.setMinutes(this.currentMinute); - value2.setSeconds(this.currentSecond); - if (this.isRangeSelection()) { - if (this.d_value[1]) value2 = [this.d_value[0], value2]; - else value2 = [value2, null]; - } - if (this.isMultipleSelection()) { - value2 = [].concat(_toConsumableArray$d(this.d_value.slice(0, -1)), [value2]); - } - this.updateModel(value2); - this.$emit("date-select", value2); - setTimeout(function() { - return _this10.timePickerChange = false; - }, 0); - }, "updateModelTime"), - toggleAMPM: /* @__PURE__ */ __name(function toggleAMPM(event2) { - var validHour = this.validateTime(this.currentHour, this.currentMinute, this.currentSecond, !this.pm); - if (!validHour && (this.maxDate || this.minDate)) return; - this.pm = !this.pm; - this.updateModelTime(); - event2.preventDefault(); - }, "toggleAMPM"), - clearTimePickerTimer: /* @__PURE__ */ __name(function clearTimePickerTimer() { - if (this.timePickerTimer) { - clearInterval(this.timePickerTimer); - } - }, "clearTimePickerTimer"), - onMonthSelect: /* @__PURE__ */ __name(function onMonthSelect(event2, _ref) { - _ref.month; - var index = _ref.index; - if (this.view === "month") { - this.onDateSelect(event2, { - year: this.currentYear, - month: index, - day: 1, - selectable: true - }); - } else { - this.currentMonth = index; - this.currentView = "date"; - this.$emit("month-change", { - month: this.currentMonth + 1, - year: this.currentYear - }); - } - setTimeout(this.updateFocus, 0); - }, "onMonthSelect"), - onYearSelect: /* @__PURE__ */ __name(function onYearSelect(event2, year2) { - if (this.view === "year") { - this.onDateSelect(event2, { - year: year2.value, - month: 0, - day: 1, - selectable: true - }); - } else { - this.currentYear = year2.value; - this.currentView = "month"; - this.$emit("year-change", { - month: this.currentMonth + 1, - year: this.currentYear - }); - } - setTimeout(this.updateFocus, 0); - }, "onYearSelect"), - updateCurrentMetaData: /* @__PURE__ */ __name(function updateCurrentMetaData() { - var viewDate2 = this.viewDate; - this.currentMonth = viewDate2.getMonth(); - this.currentYear = viewDate2.getFullYear(); - if (this.showTime || this.timeOnly) { - this.updateCurrentTimeMeta(viewDate2); - } - }, "updateCurrentMetaData"), - isValidSelection: /* @__PURE__ */ __name(function isValidSelection(value2) { - var _this11 = this; - if (value2 == null) { - return true; - } - var isValid = true; - if (this.isSingleSelection()) { - if (!this.isSelectable(value2.getDate(), value2.getMonth(), value2.getFullYear(), false)) { - isValid = false; - } - } else if (value2.every(function(v) { - return _this11.isSelectable(v.getDate(), v.getMonth(), v.getFullYear(), false); - })) { - if (this.isRangeSelection()) { - isValid = value2.length > 1 && value2[1] >= value2[0]; - } - } - return isValid; - }, "isValidSelection"), - parseValue: /* @__PURE__ */ __name(function parseValue(text) { - if (!text || text.trim().length === 0) { - return null; - } - var value2; - if (this.isSingleSelection()) { - value2 = this.parseDateTime(text); - } else if (this.isMultipleSelection()) { - var tokens = text.split(","); - value2 = []; - var _iterator3 = _createForOfIteratorHelper$4(tokens), _step3; - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { - var token = _step3.value; - value2.push(this.parseDateTime(token.trim())); - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - } else if (this.isRangeSelection()) { - var _tokens = text.split(" - "); - value2 = []; - for (var i = 0; i < _tokens.length; i++) { - value2[i] = this.parseDateTime(_tokens[i].trim()); - } - } - return value2; - }, "parseValue"), - parseDateTime: /* @__PURE__ */ __name(function parseDateTime(text) { - var date; - var parts = text.split(" "); - if (this.timeOnly) { - date = /* @__PURE__ */ new Date(); - this.populateTime(date, parts[0], parts[1]); - } else { - var dateFormat = this.datePattern; - if (this.showTime) { - date = this.parseDate(parts[0], dateFormat); - this.populateTime(date, parts[1], parts[2]); - } else { - date = this.parseDate(text, dateFormat); - } - } - return date; - }, "parseDateTime"), - populateTime: /* @__PURE__ */ __name(function populateTime(value2, timeString, ampm) { - if (this.hourFormat == "12" && !ampm) { - throw "Invalid Time"; - } - this.pm = ampm === this.$primevue.config.locale.pm || ampm === this.$primevue.config.locale.pm.toLowerCase(); - var time = this.parseTime(timeString); - value2.setHours(time.hour); - value2.setMinutes(time.minute); - value2.setSeconds(time.second); - }, "populateTime"), - parseTime: /* @__PURE__ */ __name(function parseTime(value2) { - var tokens = value2.split(":"); - var validTokenLength = this.showSeconds ? 3 : 2; - var regex = /^[0-9][0-9]$/; - if (tokens.length !== validTokenLength || !tokens[0].match(regex) || !tokens[1].match(regex) || this.showSeconds && !tokens[2].match(regex)) { - throw "Invalid time"; - } - var h = parseInt(tokens[0]); - var m = parseInt(tokens[1]); - var s = this.showSeconds ? parseInt(tokens[2]) : null; - if (isNaN(h) || isNaN(m) || h > 23 || m > 59 || this.hourFormat == "12" && h > 12 || this.showSeconds && (isNaN(s) || s > 59)) { - throw "Invalid time"; - } else { - if (this.hourFormat == "12" && h !== 12 && this.pm) { - h += 12; - } else if (this.hourFormat == "12" && h == 12 && !this.pm) { - h = 0; - } - return { - hour: h, - minute: m, - second: s - }; - } - }, "parseTime"), - parseDate: /* @__PURE__ */ __name(function parseDate(value2, format) { - if (format == null || value2 == null) { - throw "Invalid arguments"; - } - value2 = _typeof$l(value2) === "object" ? value2.toString() : value2 + ""; - if (value2 === "") { - return null; - } - var iFormat, dim, extra, iValue = 0, shortYearCutoff = typeof this.shortYearCutoff !== "string" ? this.shortYearCutoff : (/* @__PURE__ */ new Date()).getFullYear() % 100 + parseInt(this.shortYearCutoff, 10), year2 = -1, month2 = -1, day2 = -1, doy = -1, literal = false, date, lookAhead = /* @__PURE__ */ __name(function lookAhead2(match) { - var matches = iFormat + 1 < format.length && format.charAt(iFormat + 1) === match; - if (matches) { - iFormat++; - } - return matches; - }, "lookAhead"), getNumber = /* @__PURE__ */ __name(function getNumber2(match) { - var isDoubled = lookAhead(match), size = match === "@" ? 14 : match === "!" ? 20 : match === "y" && isDoubled ? 4 : match === "o" ? 3 : 2, minSize = match === "y" ? size : 1, digits = new RegExp("^\\d{" + minSize + "," + size + "}"), num = value2.substring(iValue).match(digits); - if (!num) { - throw "Missing number at position " + iValue; - } - iValue += num[0].length; - return parseInt(num[0], 10); - }, "getNumber"), getName = /* @__PURE__ */ __name(function getName2(match, shortNames, longNames) { - var index = -1; - var arr = lookAhead(match) ? longNames : shortNames; - var names = []; - for (var i = 0; i < arr.length; i++) { - names.push([i, arr[i]]); - } - names.sort(function(a, b) { - return -(a[1].length - b[1].length); - }); - for (var _i = 0; _i < names.length; _i++) { - var name4 = names[_i][1]; - if (value2.substr(iValue, name4.length).toLowerCase() === name4.toLowerCase()) { - index = names[_i][0]; - iValue += name4.length; - break; - } - } - if (index !== -1) { - return index + 1; - } else { - throw "Unknown name at position " + iValue; - } - }, "getName"), checkLiteral = /* @__PURE__ */ __name(function checkLiteral2() { - if (value2.charAt(iValue) !== format.charAt(iFormat)) { - throw "Unexpected literal at position " + iValue; - } - iValue++; - }, "checkLiteral"); - if (this.currentView === "month") { - day2 = 1; - } - if (this.currentView === "year") { - day2 = 1; - month2 = 1; - } - for (iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) { - if (format.charAt(iFormat) === "'" && !lookAhead("'")) { - literal = false; - } else { - checkLiteral(); - } - } else { - switch (format.charAt(iFormat)) { - case "d": - day2 = getNumber("d"); - break; - case "D": - getName("D", this.$primevue.config.locale.dayNamesShort, this.$primevue.config.locale.dayNames); - break; - case "o": - doy = getNumber("o"); - break; - case "m": - month2 = getNumber("m"); - break; - case "M": - month2 = getName("M", this.$primevue.config.locale.monthNamesShort, this.$primevue.config.locale.monthNames); - break; - case "y": - year2 = getNumber("y"); - break; - case "@": - date = new Date(getNumber("@")); - year2 = date.getFullYear(); - month2 = date.getMonth() + 1; - day2 = date.getDate(); - break; - case "!": - date = new Date((getNumber("!") - this.ticksTo1970) / 1e4); - year2 = date.getFullYear(); - month2 = date.getMonth() + 1; - day2 = date.getDate(); - break; - case "'": - if (lookAhead("'")) { - checkLiteral(); - } else { - literal = true; - } - break; - default: - checkLiteral(); - } - } - } - if (iValue < value2.length) { - extra = value2.substr(iValue); - if (!/^\s+/.test(extra)) { - throw "Extra/unparsed characters found in date: " + extra; - } - } - if (year2 === -1) { - year2 = (/* @__PURE__ */ new Date()).getFullYear(); - } else if (year2 < 100) { - year2 += (/* @__PURE__ */ new Date()).getFullYear() - (/* @__PURE__ */ new Date()).getFullYear() % 100 + (year2 <= shortYearCutoff ? 0 : -100); - } - if (doy > -1) { - month2 = 1; - day2 = doy; - do { - dim = this.getDaysCountInMonth(year2, month2 - 1); - if (day2 <= dim) { - break; - } - month2++; - day2 -= dim; - } while (true); - } - date = this.daylightSavingAdjust(new Date(year2, month2 - 1, day2)); - if (date.getFullYear() !== year2 || date.getMonth() + 1 !== month2 || date.getDate() !== day2) { - throw "Invalid date"; - } - return date; - }, "parseDate"), - getWeekNumber: /* @__PURE__ */ __name(function getWeekNumber(date) { - var checkDate = new Date(date.getTime()); - checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); - var time = checkDate.getTime(); - checkDate.setMonth(0); - checkDate.setDate(1); - return Math.floor(Math.round((time - checkDate.getTime()) / 864e5) / 7) + 1; - }, "getWeekNumber"), - onDateCellKeydown: /* @__PURE__ */ __name(function onDateCellKeydown(event2, date, groupIndex) { - var cellContent = event2.currentTarget; - var cell = cellContent.parentElement; - var cellIndex = getIndex(cell); - switch (event2.code) { - case "ArrowDown": { - cellContent.tabIndex = "-1"; - var nextRow = cell.parentElement.nextElementSibling; - if (nextRow) { - var tableRowIndex = getIndex(cell.parentElement); - var tableRows = Array.from(cell.parentElement.parentElement.children); - var nextTableRows = tableRows.slice(tableRowIndex + 1); - var hasNextFocusableDate = nextTableRows.find(function(el) { - var focusCell2 = el.children[cellIndex].children[0]; - return !getAttribute(focusCell2, "data-p-disabled"); - }); - if (hasNextFocusableDate) { - var focusCell = hasNextFocusableDate.children[cellIndex].children[0]; - focusCell.tabIndex = "0"; - focusCell.focus(); - } else { - this.navigationState = { - backward: false - }; - this.navForward(event2); - } - } else { - this.navigationState = { - backward: false - }; - this.navForward(event2); - } - event2.preventDefault(); - break; - } - case "ArrowUp": { - cellContent.tabIndex = "-1"; - if (event2.altKey) { - this.overlayVisible = false; - this.focused = true; - } else { - var prevRow = cell.parentElement.previousElementSibling; - if (prevRow) { - var _tableRowIndex = getIndex(cell.parentElement); - var _tableRows = Array.from(cell.parentElement.parentElement.children); - var prevTableRows = _tableRows.slice(0, _tableRowIndex).reverse(); - var _hasNextFocusableDate = prevTableRows.find(function(el) { - var focusCell2 = el.children[cellIndex].children[0]; - return !getAttribute(focusCell2, "data-p-disabled"); - }); - if (_hasNextFocusableDate) { - var _focusCell = _hasNextFocusableDate.children[cellIndex].children[0]; - _focusCell.tabIndex = "0"; - _focusCell.focus(); - } else { - this.navigationState = { - backward: true - }; - this.navBackward(event2); - } - } else { - this.navigationState = { - backward: true - }; - this.navBackward(event2); - } - } - event2.preventDefault(); - break; - } - case "ArrowLeft": { - cellContent.tabIndex = "-1"; - var prevCell = cell.previousElementSibling; - if (prevCell) { - var cells = Array.from(cell.parentElement.children); - var prevCells = cells.slice(0, cellIndex).reverse(); - var _hasNextFocusableDate2 = prevCells.find(function(el) { - var focusCell2 = el.children[0]; - return !getAttribute(focusCell2, "data-p-disabled"); - }); - if (_hasNextFocusableDate2) { - var _focusCell2 = _hasNextFocusableDate2.children[0]; - _focusCell2.tabIndex = "0"; - _focusCell2.focus(); - } else { - this.navigateToMonth(event2, true, groupIndex); - } - } else { - this.navigateToMonth(event2, true, groupIndex); - } - event2.preventDefault(); - break; - } - case "ArrowRight": { - cellContent.tabIndex = "-1"; - var nextCell = cell.nextElementSibling; - if (nextCell) { - var _cells = Array.from(cell.parentElement.children); - var nextCells = _cells.slice(cellIndex + 1); - var _hasNextFocusableDate3 = nextCells.find(function(el) { - var focusCell2 = el.children[0]; - return !getAttribute(focusCell2, "data-p-disabled"); - }); - if (_hasNextFocusableDate3) { - var _focusCell3 = _hasNextFocusableDate3.children[0]; - _focusCell3.tabIndex = "0"; - _focusCell3.focus(); - } else { - this.navigateToMonth(event2, false, groupIndex); - } - } else { - this.navigateToMonth(event2, false, groupIndex); - } - event2.preventDefault(); - break; - } - case "Enter": - case "NumpadEnter": - case "Space": { - this.onDateSelect(event2, date); - event2.preventDefault(); - break; - } - case "Escape": { - this.overlayVisible = false; - event2.preventDefault(); - break; - } - case "Tab": { - if (!this.inline) { - this.trapFocus(event2); - } - break; - } - case "Home": { - cellContent.tabIndex = "-1"; - var currentRow = cell.parentElement; - var _focusCell4 = currentRow.children[0].children[0]; - if (getAttribute(_focusCell4, "data-p-disabled")) { - this.navigateToMonth(event2, true, groupIndex); - } else { - _focusCell4.tabIndex = "0"; - _focusCell4.focus(); - } - event2.preventDefault(); - break; - } - case "End": { - cellContent.tabIndex = "-1"; - var _currentRow = cell.parentElement; - var _focusCell5 = _currentRow.children[_currentRow.children.length - 1].children[0]; - if (getAttribute(_focusCell5, "data-p-disabled")) { - this.navigateToMonth(event2, false, groupIndex); - } else { - _focusCell5.tabIndex = "0"; - _focusCell5.focus(); - } - event2.preventDefault(); - break; - } - case "PageUp": { - cellContent.tabIndex = "-1"; - if (event2.shiftKey) { - this.navigationState = { - backward: true - }; - this.navBackward(event2); - } else this.navigateToMonth(event2, true, groupIndex); - event2.preventDefault(); - break; - } - case "PageDown": { - cellContent.tabIndex = "-1"; - if (event2.shiftKey) { - this.navigationState = { - backward: false - }; - this.navForward(event2); - } else this.navigateToMonth(event2, false, groupIndex); - event2.preventDefault(); - break; - } - } - }, "onDateCellKeydown"), - navigateToMonth: /* @__PURE__ */ __name(function navigateToMonth(event2, prev, groupIndex) { - if (prev) { - if (this.numberOfMonths === 1 || groupIndex === 0) { - this.navigationState = { - backward: true - }; - this.navBackward(event2); - } else { - var prevMonthContainer = this.overlay.children[groupIndex - 1]; - var cells = find(prevMonthContainer, 'table td span:not([data-p-disabled="true"]):not([data-p-ink="true"])'); - var focusCell = cells[cells.length - 1]; - focusCell.tabIndex = "0"; - focusCell.focus(); - } - } else { - if (this.numberOfMonths === 1 || groupIndex === this.numberOfMonths - 1) { - this.navigationState = { - backward: false - }; - this.navForward(event2); - } else { - var nextMonthContainer = this.overlay.children[groupIndex + 1]; - var _focusCell6 = findSingle(nextMonthContainer, 'table td span:not([data-p-disabled="true"]):not([data-p-ink="true"])'); - _focusCell6.tabIndex = "0"; - _focusCell6.focus(); - } - } - }, "navigateToMonth"), - onMonthCellKeydown: /* @__PURE__ */ __name(function onMonthCellKeydown(event2, index) { - var cell = event2.currentTarget; - switch (event2.code) { - case "ArrowUp": - case "ArrowDown": { - cell.tabIndex = "-1"; - var cells = cell.parentElement.children; - var cellIndex = getIndex(cell); - var nextCell = cells[event2.code === "ArrowDown" ? cellIndex + 3 : cellIndex - 3]; - if (nextCell) { - nextCell.tabIndex = "0"; - nextCell.focus(); - } - event2.preventDefault(); - break; - } - case "ArrowLeft": { - cell.tabIndex = "-1"; - var prevCell = cell.previousElementSibling; - if (prevCell) { - prevCell.tabIndex = "0"; - prevCell.focus(); - } else { - this.navigationState = { - backward: true - }; - this.navBackward(event2); - } - event2.preventDefault(); - break; - } - case "ArrowRight": { - cell.tabIndex = "-1"; - var _nextCell = cell.nextElementSibling; - if (_nextCell) { - _nextCell.tabIndex = "0"; - _nextCell.focus(); - } else { - this.navigationState = { - backward: false - }; - this.navForward(event2); - } - event2.preventDefault(); - break; - } - case "PageUp": { - if (event2.shiftKey) return; - this.navigationState = { - backward: true - }; - this.navBackward(event2); - break; - } - case "PageDown": { - if (event2.shiftKey) return; - this.navigationState = { - backward: false - }; - this.navForward(event2); - break; - } - case "Enter": - case "NumpadEnter": - case "Space": { - this.onMonthSelect(event2, index); - event2.preventDefault(); - break; - } - case "Escape": { - this.overlayVisible = false; - event2.preventDefault(); - break; - } - case "Tab": { - this.trapFocus(event2); - break; - } - } - }, "onMonthCellKeydown"), - onYearCellKeydown: /* @__PURE__ */ __name(function onYearCellKeydown(event2, index) { - var cell = event2.currentTarget; - switch (event2.code) { - case "ArrowUp": - case "ArrowDown": { - cell.tabIndex = "-1"; - var cells = cell.parentElement.children; - var cellIndex = getIndex(cell); - var nextCell = cells[event2.code === "ArrowDown" ? cellIndex + 2 : cellIndex - 2]; - if (nextCell) { - nextCell.tabIndex = "0"; - nextCell.focus(); - } - event2.preventDefault(); - break; - } - case "ArrowLeft": { - cell.tabIndex = "-1"; - var prevCell = cell.previousElementSibling; - if (prevCell) { - prevCell.tabIndex = "0"; - prevCell.focus(); - } else { - this.navigationState = { - backward: true - }; - this.navBackward(event2); - } - event2.preventDefault(); - break; - } - case "ArrowRight": { - cell.tabIndex = "-1"; - var _nextCell2 = cell.nextElementSibling; - if (_nextCell2) { - _nextCell2.tabIndex = "0"; - _nextCell2.focus(); - } else { - this.navigationState = { - backward: false - }; - this.navForward(event2); - } - event2.preventDefault(); - break; - } - case "PageUp": { - if (event2.shiftKey) return; - this.navigationState = { - backward: true - }; - this.navBackward(event2); - break; - } - case "PageDown": { - if (event2.shiftKey) return; - this.navigationState = { - backward: false - }; - this.navForward(event2); - break; - } - case "Enter": - case "NumpadEnter": - case "Space": { - this.onYearSelect(event2, index); - event2.preventDefault(); - break; - } - case "Escape": { - this.overlayVisible = false; - event2.preventDefault(); - break; - } - case "Tab": { - this.trapFocus(event2); - break; - } - } - }, "onYearCellKeydown"), - updateFocus: /* @__PURE__ */ __name(function updateFocus() { - var cell; - if (this.navigationState) { - if (this.navigationState.button) { - this.initFocusableCell(); - if (this.navigationState.backward) this.previousButton.focus(); - else this.nextButton.focus(); - } else { - if (this.navigationState.backward) { - var cells; - if (this.currentView === "month") { - cells = find(this.overlay, '[data-pc-section="monthview"] [data-pc-section="month"]:not([data-p-disabled="true"])'); - } else if (this.currentView === "year") { - cells = find(this.overlay, '[data-pc-section="yearview"] [data-pc-section="year"]:not([data-p-disabled="true"])'); - } else { - cells = find(this.overlay, 'table td span:not([data-p-disabled="true"]):not([data-p-ink="true"])'); - } - if (cells && cells.length > 0) { - cell = cells[cells.length - 1]; - } - } else { - if (this.currentView === "month") { - cell = findSingle(this.overlay, '[data-pc-section="monthview"] [data-pc-section="month"]:not([data-p-disabled="true"])'); - } else if (this.currentView === "year") { - cell = findSingle(this.overlay, '[data-pc-section="yearview"] [data-pc-section="year"]:not([data-p-disabled="true"])'); - } else { - cell = findSingle(this.overlay, 'table td span:not([data-p-disabled="true"]):not([data-p-ink="true"])'); - } - } - if (cell) { - cell.tabIndex = "0"; - cell.focus(); - } - } - this.navigationState = null; - } else { - this.initFocusableCell(); - } - }, "updateFocus"), - initFocusableCell: /* @__PURE__ */ __name(function initFocusableCell() { - var cell; - if (this.currentView === "month") { - var cells = find(this.overlay, '[data-pc-section="monthview"] [data-pc-section="month"]'); - var selectedCell = findSingle(this.overlay, '[data-pc-section="monthview"] [data-pc-section="month"][data-p-selected="true"]'); - cells.forEach(function(cell2) { - return cell2.tabIndex = -1; - }); - cell = selectedCell || cells[0]; - } else if (this.currentView === "year") { - var _cells2 = find(this.overlay, '[data-pc-section="yearview"] [data-pc-section="year"]'); - var _selectedCell = findSingle(this.overlay, '[data-pc-section="yearview"] [data-pc-section="year"][data-p-selected="true"]'); - _cells2.forEach(function(cell2) { - return cell2.tabIndex = -1; - }); - cell = _selectedCell || _cells2[0]; - } else { - cell = findSingle(this.overlay, 'span[data-p-selected="true"]'); - if (!cell) { - var todayCell = findSingle(this.overlay, 'td[data-p-today="true"] span:not([data-p-disabled="true"]):not([data-p-ink="true"])'); - if (todayCell) cell = todayCell; - else cell = findSingle(this.overlay, '.p-datepicker-calendar td span:not([data-p-disabled="true"]):not([data-p-ink="true"])'); - } - } - if (cell) { - cell.tabIndex = "0"; - this.preventFocus = false; - } - }, "initFocusableCell"), - trapFocus: /* @__PURE__ */ __name(function trapFocus(event2) { - event2.preventDefault(); - var focusableElements = getFocusableElements(this.overlay); - if (focusableElements && focusableElements.length > 0) { - if (!document.activeElement) { - focusableElements[0].focus(); - } else { - var focusedIndex = focusableElements.indexOf(document.activeElement); - if (event2.shiftKey) { - if (focusedIndex === -1 || focusedIndex === 0) focusableElements[focusableElements.length - 1].focus(); - else focusableElements[focusedIndex - 1].focus(); - } else { - if (focusedIndex === -1) { - if (this.timeOnly) { - focusableElements[0].focus(); - } else { - var spanIndex = null; - for (var i = 0; i < focusableElements.length; i++) { - if (focusableElements[i].tagName === "SPAN") { - spanIndex = i; - break; - } - } - focusableElements[spanIndex].focus(); - } - } else if (focusedIndex === focusableElements.length - 1) focusableElements[0].focus(); - else focusableElements[focusedIndex + 1].focus(); - } - } - } - }, "trapFocus"), - onContainerButtonKeydown: /* @__PURE__ */ __name(function onContainerButtonKeydown(event2) { - switch (event2.code) { - case "Tab": - this.trapFocus(event2); - break; - case "Escape": - this.overlayVisible = false; - event2.preventDefault(); - break; - } - this.$emit("keydown", event2); - }, "onContainerButtonKeydown"), - onInput: /* @__PURE__ */ __name(function onInput(event2) { - try { - this.selectionStart = this.input.selectionStart; - this.selectionEnd = this.input.selectionEnd; - var value2 = this.parseValue(event2.target.value); - if (this.isValidSelection(value2)) { - this.typeUpdate = true; - this.updateModel(value2); - this.updateCurrentMetaData(); - } - } catch (err) { - } - this.$emit("input", event2); - }, "onInput"), - onInputClick: /* @__PURE__ */ __name(function onInputClick() { - if (this.showOnFocus && this.isEnabled() && !this.overlayVisible) { - this.overlayVisible = true; - } - }, "onInputClick"), - onFocus: /* @__PURE__ */ __name(function onFocus2(event2) { - if (this.showOnFocus && this.isEnabled()) { - this.overlayVisible = true; - } - this.focused = true; - this.$emit("focus", event2); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur(event2) { - var _this$formField$onBlu, _this$formField; - this.$emit("blur", { - originalEvent: event2, - value: event2.target.value - }); - (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField); - this.focused = false; - event2.target.value = this.formatValue(this.d_value); - }, "onBlur"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown(event2) { - if (event2.code === "ArrowDown" && this.overlay) { - this.trapFocus(event2); - } else if (event2.code === "ArrowDown" && !this.overlay) { - this.overlayVisible = true; - } else if (event2.code === "Escape") { - if (this.overlayVisible) { - this.overlayVisible = false; - event2.preventDefault(); - } - } else if (event2.code === "Tab") { - if (this.overlay) { - getFocusableElements(this.overlay).forEach(function(el) { - return el.tabIndex = "-1"; - }); - } - if (this.overlayVisible) { - this.overlayVisible = false; - } - } else if (event2.code === "Enter") { - var _event$target$value; - if (this.manualInput && event2.target.value !== null && ((_event$target$value = event2.target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.trim()) !== "") { - try { - var value2 = this.parseValue(event2.target.value); - if (this.isValidSelection(value2)) { - this.overlayVisible = false; - } - } catch (err) { - } - } - this.$emit("keydown", event2); - } - }, "onKeyDown"), - overlayRef: /* @__PURE__ */ __name(function overlayRef(el) { - this.overlay = el; - }, "overlayRef"), - inputRef: /* @__PURE__ */ __name(function inputRef(el) { - this.input = el ? el.$el : void 0; - }, "inputRef"), - previousButtonRef: /* @__PURE__ */ __name(function previousButtonRef(el) { - this.previousButton = el ? el.$el : void 0; - }, "previousButtonRef"), - nextButtonRef: /* @__PURE__ */ __name(function nextButtonRef(el) { - this.nextButton = el ? el.$el : void 0; - }, "nextButtonRef"), - getMonthName: /* @__PURE__ */ __name(function getMonthName(index) { - return this.$primevue.config.locale.monthNames[index]; - }, "getMonthName"), - getYear: /* @__PURE__ */ __name(function getYear(month2) { - return this.currentView === "month" ? this.currentYear : month2.year; - }, "getYear"), - onOverlayClick: /* @__PURE__ */ __name(function onOverlayClick(event2) { - event2.stopPropagation(); - if (!this.inline) { - OverlayEventBus.emit("overlay-click", { - originalEvent: event2, - target: this.$el - }); - } - }, "onOverlayClick"), - onOverlayKeyDown: /* @__PURE__ */ __name(function onOverlayKeyDown(event2) { - switch (event2.code) { - case "Escape": - if (!this.inline) { - this.input.focus(); - this.overlayVisible = false; - } - break; - } - }, "onOverlayKeyDown"), - onOverlayMouseUp: /* @__PURE__ */ __name(function onOverlayMouseUp(event2) { - this.onOverlayClick(event2); - }, "onOverlayMouseUp"), - createResponsiveStyle: /* @__PURE__ */ __name(function createResponsiveStyle() { - if (this.numberOfMonths > 1 && this.responsiveOptions && !this.isUnstyled) { - if (!this.responsiveStyleElement) { - var _this$$primevue; - this.responsiveStyleElement = document.createElement("style"); - this.responsiveStyleElement.type = "text/css"; - setAttribute(this.responsiveStyleElement, "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); - document.body.appendChild(this.responsiveStyleElement); - } - var innerHTML = ""; - if (this.responsiveOptions) { - var comparer = localeComparator(); - var responsiveOptions2 = _toConsumableArray$d(this.responsiveOptions).filter(function(o) { - return !!(o.breakpoint && o.numMonths); - }).sort(function(o1, o2) { - return -1 * comparer(o1.breakpoint, o2.breakpoint); - }); - for (var i = 0; i < responsiveOptions2.length; i++) { - var _responsiveOptions$i = responsiveOptions2[i], breakpoint2 = _responsiveOptions$i.breakpoint, numMonths = _responsiveOptions$i.numMonths; - var styles = "\n .p-datepicker-panel[".concat(this.$attrSelector, "] .p-datepicker-calendar:nth-child(").concat(numMonths, ") .p-datepicker-next-button {\n display: inline-flex;\n }\n "); - for (var j = numMonths; j < this.numberOfMonths; j++) { - styles += "\n .p-datepicker-panel[".concat(this.$attrSelector, "] .p-datepicker-calendar:nth-child(").concat(j + 1, ") {\n display: none;\n }\n "); - } - innerHTML += "\n @media screen and (max-width: ".concat(breakpoint2, ") {\n ").concat(styles, "\n }\n "); - } - } - this.responsiveStyleElement.innerHTML = innerHTML; - } - }, "createResponsiveStyle"), - destroyResponsiveStyleElement: /* @__PURE__ */ __name(function destroyResponsiveStyleElement() { - if (this.responsiveStyleElement) { - this.responsiveStyleElement.remove(); - this.responsiveStyleElement = null; - } - }, "destroyResponsiveStyleElement") - }, - computed: { - viewDate: /* @__PURE__ */ __name(function viewDate() { - var propValue = this.d_value; - if (propValue && Array.isArray(propValue)) { - if (this.isRangeSelection()) { - propValue = this.inline ? propValue[0] : propValue[1] || propValue[0]; - } else if (this.isMultipleSelection()) { - propValue = propValue[propValue.length - 1]; - } - } - if (propValue && typeof propValue !== "string") { - return propValue; - } else { - var today = /* @__PURE__ */ new Date(); - if (this.maxDate && this.maxDate < today) { - return this.maxDate; - } - if (this.minDate && this.minDate > today) { - return this.minDate; - } - return today; - } - }, "viewDate"), - inputFieldValue: /* @__PURE__ */ __name(function inputFieldValue() { - return this.formatValue(this.d_value); - }, "inputFieldValue"), - months: /* @__PURE__ */ __name(function months2() { - var months3 = []; - for (var i = 0; i < this.numberOfMonths; i++) { - var month2 = this.currentMonth + i; - var year2 = this.currentYear; - if (month2 > 11) { - month2 = month2 % 11 - 1; - year2 = year2 + 1; - } - var dates = []; - var firstDay = this.getFirstDayOfMonthIndex(month2, year2); - var daysLength = this.getDaysCountInMonth(month2, year2); - var prevMonthDaysLength = this.getDaysCountInPrevMonth(month2, year2); - var dayNo = 1; - var today = /* @__PURE__ */ new Date(); - var weekNumbers = []; - var monthRows = Math.ceil((daysLength + firstDay) / 7); - for (var _i2 = 0; _i2 < monthRows; _i2++) { - var week = []; - if (_i2 == 0) { - for (var j = prevMonthDaysLength - firstDay + 1; j <= prevMonthDaysLength; j++) { - var prev = this.getPreviousMonthAndYear(month2, year2); - week.push({ - day: j, - month: prev.month, - year: prev.year, - otherMonth: true, - today: this.isToday(today, j, prev.month, prev.year), - selectable: this.isSelectable(j, prev.month, prev.year, true) - }); - } - var remainingDaysLength = 7 - week.length; - for (var _j = 0; _j < remainingDaysLength; _j++) { - week.push({ - day: dayNo, - month: month2, - year: year2, - today: this.isToday(today, dayNo, month2, year2), - selectable: this.isSelectable(dayNo, month2, year2, false) - }); - dayNo++; - } - } else { - for (var _j2 = 0; _j2 < 7; _j2++) { - if (dayNo > daysLength) { - var next = this.getNextMonthAndYear(month2, year2); - week.push({ - day: dayNo - daysLength, - month: next.month, - year: next.year, - otherMonth: true, - today: this.isToday(today, dayNo - daysLength, next.month, next.year), - selectable: this.isSelectable(dayNo - daysLength, next.month, next.year, true) - }); - } else { - week.push({ - day: dayNo, - month: month2, - year: year2, - today: this.isToday(today, dayNo, month2, year2), - selectable: this.isSelectable(dayNo, month2, year2, false) - }); - } - dayNo++; - } - } - if (this.showWeek) { - weekNumbers.push(this.getWeekNumber(new Date(week[0].year, week[0].month, week[0].day))); - } - dates.push(week); - } - months3.push({ - month: month2, - year: year2, - dates, - weekNumbers - }); - } - return months3; - }, "months"), - weekDays: /* @__PURE__ */ __name(function weekDays() { - var weekDays2 = []; - var dayIndex = this.$primevue.config.locale.firstDayOfWeek; - for (var i = 0; i < 7; i++) { - weekDays2.push(this.$primevue.config.locale.dayNamesMin[dayIndex]); - dayIndex = dayIndex == 6 ? 0 : ++dayIndex; - } - return weekDays2; - }, "weekDays"), - ticksTo1970: /* @__PURE__ */ __name(function ticksTo1970() { - return ((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + Math.floor(1970 / 400)) * 24 * 60 * 60 * 1e7; - }, "ticksTo1970"), - sundayIndex: /* @__PURE__ */ __name(function sundayIndex() { - return this.$primevue.config.locale.firstDayOfWeek > 0 ? 7 - this.$primevue.config.locale.firstDayOfWeek : 0; - }, "sundayIndex"), - datePattern: /* @__PURE__ */ __name(function datePattern() { - return this.dateFormat || this.$primevue.config.locale.dateFormat; - }, "datePattern"), - monthPickerValues: /* @__PURE__ */ __name(function monthPickerValues() { - var _this12 = this; - var monthPickerValues2 = []; - var isSelectableMonth = /* @__PURE__ */ __name(function isSelectableMonth2(baseMonth) { - if (_this12.minDate) { - var minMonth = _this12.minDate.getMonth(); - var minYear = _this12.minDate.getFullYear(); - if (_this12.currentYear < minYear || _this12.currentYear === minYear && baseMonth < minMonth) { - return false; - } - } - if (_this12.maxDate) { - var maxMonth = _this12.maxDate.getMonth(); - var maxYear = _this12.maxDate.getFullYear(); - if (_this12.currentYear > maxYear || _this12.currentYear === maxYear && baseMonth > maxMonth) { - return false; - } - } - return true; - }, "isSelectableMonth"); - for (var i = 0; i <= 11; i++) { - monthPickerValues2.push({ - value: this.$primevue.config.locale.monthNamesShort[i], - selectable: isSelectableMonth(i) - }); - } - return monthPickerValues2; - }, "monthPickerValues"), - yearPickerValues: /* @__PURE__ */ __name(function yearPickerValues() { - var _this13 = this; - var yearPickerValues2 = []; - var base = this.currentYear - this.currentYear % 10; - var isSelectableYear = /* @__PURE__ */ __name(function isSelectableYear2(baseYear) { - if (_this13.minDate) { - if (_this13.minDate.getFullYear() > baseYear) return false; - } - if (_this13.maxDate) { - if (_this13.maxDate.getFullYear() < baseYear) return false; - } - return true; - }, "isSelectableYear"); - for (var i = 0; i < 10; i++) { - yearPickerValues2.push({ - value: base + i, - selectable: isSelectableYear(base + i) - }); - } - return yearPickerValues2; - }, "yearPickerValues"), - formattedCurrentHour: /* @__PURE__ */ __name(function formattedCurrentHour() { - if (this.currentHour == 0 && this.hourFormat == "12") { - return this.currentHour + 12; - } - return this.currentHour < 10 ? "0" + this.currentHour : this.currentHour; - }, "formattedCurrentHour"), - formattedCurrentMinute: /* @__PURE__ */ __name(function formattedCurrentMinute() { - return this.currentMinute < 10 ? "0" + this.currentMinute : this.currentMinute; - }, "formattedCurrentMinute"), - formattedCurrentSecond: /* @__PURE__ */ __name(function formattedCurrentSecond() { - return this.currentSecond < 10 ? "0" + this.currentSecond : this.currentSecond; - }, "formattedCurrentSecond"), - todayLabel: /* @__PURE__ */ __name(function todayLabel() { - return this.$primevue.config.locale.today; - }, "todayLabel"), - clearLabel: /* @__PURE__ */ __name(function clearLabel() { - return this.$primevue.config.locale.clear; - }, "clearLabel"), - weekHeaderLabel: /* @__PURE__ */ __name(function weekHeaderLabel() { - return this.$primevue.config.locale.weekHeader; - }, "weekHeaderLabel"), - monthNames: /* @__PURE__ */ __name(function monthNames() { - return this.$primevue.config.locale.monthNames; - }, "monthNames"), - switchViewButtonDisabled: /* @__PURE__ */ __name(function switchViewButtonDisabled() { - return this.numberOfMonths > 1 || this.disabled; - }, "switchViewButtonDisabled"), - panelId: /* @__PURE__ */ __name(function panelId() { - return this.d_id + "_panel"; - }, "panelId") - }, - components: { - InputText: script$1l, - Button: script$1d, - Portal: script$1m, - CalendarIcon: script$13, - ChevronLeftIcon: script$1n, - ChevronRightIcon: script$1i, - ChevronUpIcon: script$1g, - ChevronDownIcon: script$1h - }, - directives: { - ripple: Ripple - } -}; -var _hoisted_1$s = ["id"]; -var _hoisted_2$l = ["disabled", "aria-label", "aria-expanded", "aria-controls"]; -var _hoisted_3$h = ["id", "role", "aria-modal", "aria-label"]; -var _hoisted_4$9 = ["disabled", "aria-label"]; -var _hoisted_5$4 = ["disabled", "aria-label"]; -var _hoisted_6$2 = ["disabled", "aria-label"]; -var _hoisted_7$2 = ["disabled", "aria-label"]; -var _hoisted_8$2 = ["data-p-disabled"]; -var _hoisted_9 = ["abbr"]; -var _hoisted_10 = ["data-p-disabled"]; -var _hoisted_11 = ["aria-label", "data-p-today", "data-p-other-month"]; -var _hoisted_12 = ["onClick", "onKeydown", "aria-selected", "aria-disabled", "data-p-disabled", "data-p-selected"]; -var _hoisted_13 = ["onClick", "onKeydown", "data-p-disabled", "data-p-selected"]; -var _hoisted_14 = ["onClick", "onKeydown", "data-p-disabled", "data-p-selected"]; -function render$V(_ctx, _cache, $props, $setup, $data, $options) { - var _component_InputText = resolveComponent("InputText"); - var _component_Button = resolveComponent("Button"); - var _component_Portal = resolveComponent("Portal"); - var _directive_ripple = resolveDirective("ripple"); - return openBlock(), createElementBlock("span", mergeProps({ - ref: "container", - id: $data.d_id, - "class": _ctx.cx("root"), - style: _ctx.sx("root") - }, _ctx.ptmi("root")), [!_ctx.inline ? (openBlock(), createBlock(_component_InputText, { - key: 0, - ref: $options.inputRef, - id: _ctx.inputId, - role: "combobox", - "class": normalizeClass([_ctx.inputClass, _ctx.cx("pcInputText")]), - style: normalizeStyle(_ctx.inputStyle), - defaultValue: $options.inputFieldValue, - placeholder: _ctx.placeholder, - name: _ctx.name, - size: _ctx.size, - invalid: _ctx.invalid, - variant: _ctx.variant, - fluid: _ctx.fluid, - unstyled: _ctx.unstyled, - autocomplete: "off", - "aria-autocomplete": "none", - "aria-haspopup": "dialog", - "aria-expanded": $data.overlayVisible, - "aria-controls": $options.panelId, - "aria-labelledby": _ctx.ariaLabelledby, - "aria-label": _ctx.ariaLabel, - inputmode: "none", - disabled: _ctx.disabled, - readonly: !_ctx.manualInput || _ctx.readonly, - tabindex: 0, - onInput: $options.onInput, - onClick: $options.onInputClick, - onFocus: $options.onFocus, - onBlur: $options.onBlur, - onKeydown: $options.onKeyDown, - pt: _ctx.ptm("pcInputText") - }, null, 8, ["id", "class", "style", "defaultValue", "placeholder", "name", "size", "invalid", "variant", "fluid", "unstyled", "aria-expanded", "aria-controls", "aria-labelledby", "aria-label", "disabled", "readonly", "onInput", "onClick", "onFocus", "onBlur", "onKeydown", "pt"])) : createCommentVNode("", true), _ctx.showIcon && _ctx.iconDisplay === "button" && !_ctx.inline ? renderSlot(_ctx.$slots, "dropdownbutton", { - key: 1, - toggleCallback: $options.onButtonClick - }, function() { - return [createBaseVNode("button", mergeProps({ - "class": _ctx.cx("dropdown"), - disabled: _ctx.disabled, - onClick: _cache[0] || (_cache[0] = function() { - return $options.onButtonClick && $options.onButtonClick.apply($options, arguments); - }), - type: "button", - "aria-label": _ctx.$primevue.config.locale.chooseDate, - "aria-haspopup": "dialog", - "aria-expanded": $data.overlayVisible, - "aria-controls": $options.panelId - }, _ctx.ptm("dropdown")), [renderSlot(_ctx.$slots, "dropdownicon", { - "class": normalizeClass(_ctx.icon) - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon ? "span" : "CalendarIcon"), mergeProps({ - "class": _ctx.icon - }, _ctx.ptm("dropdownIcon")), null, 16, ["class"]))]; - })], 16, _hoisted_2$l)]; - }) : _ctx.showIcon && _ctx.iconDisplay === "input" && !_ctx.inline ? (openBlock(), createElementBlock(Fragment, { - key: 2 - }, [_ctx.$slots.inputicon || _ctx.showIcon ? (openBlock(), createElementBlock("span", mergeProps({ - key: 0, - "class": _ctx.cx("inputIconContainer") - }, _ctx.ptm("inputIconContainer")), [renderSlot(_ctx.$slots, "inputicon", { - "class": normalizeClass(_ctx.cx("inputIcon")), - clickCallback: $options.onButtonClick - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon ? "i" : "CalendarIcon"), mergeProps({ - "class": [_ctx.icon, _ctx.cx("inputIcon")], - onClick: $options.onButtonClick - }, _ctx.ptm("inputicon")), null, 16, ["class", "onClick"]))]; - })], 16)) : createCommentVNode("", true)], 64)) : createCommentVNode("", true), createVNode(_component_Portal, { - appendTo: _ctx.appendTo, - disabled: _ctx.inline - }, { - "default": withCtx(function() { - return [createVNode(Transition, mergeProps({ - name: "p-connected-overlay", - onEnter: _cache[58] || (_cache[58] = function($event) { - return $options.onOverlayEnter($event); - }), - onAfterEnter: $options.onOverlayEnterComplete, - onAfterLeave: $options.onOverlayAfterLeave, - onLeave: $options.onOverlayLeave - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [_ctx.inline || $data.overlayVisible ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: $options.overlayRef, - id: $options.panelId, - "class": [_ctx.cx("panel"), _ctx.panelClass], - style: _ctx.panelStyle, - role: _ctx.inline ? null : "dialog", - "aria-modal": _ctx.inline ? null : "true", - "aria-label": _ctx.$primevue.config.locale.chooseDate, - onClick: _cache[55] || (_cache[55] = function() { - return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); - }), - onKeydown: _cache[56] || (_cache[56] = function() { - return $options.onOverlayKeyDown && $options.onOverlayKeyDown.apply($options, arguments); - }), - onMouseup: _cache[57] || (_cache[57] = function() { - return $options.onOverlayMouseUp && $options.onOverlayMouseUp.apply($options, arguments); - }) - }, _ctx.ptm("panel")), [!_ctx.timeOnly ? (openBlock(), createElementBlock(Fragment, { - key: 0 - }, [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("calendarContainer") - }, _ctx.ptm("calendarContainer")), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.months, function(month2, groupIndex) { - return openBlock(), createElementBlock("div", mergeProps({ - key: month2.month + month2.year, - "class": _ctx.cx("calendar"), - ref_for: true - }, _ctx.ptm("calendar")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("header"), - ref_for: true - }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header"), withDirectives(createVNode(_component_Button, mergeProps({ - ref_for: true, - ref: $options.previousButtonRef, - "class": _ctx.cx("pcPrevButton"), - disabled: _ctx.disabled, - "aria-label": $data.currentView === "year" ? _ctx.$primevue.config.locale.prevDecade : $data.currentView === "month" ? _ctx.$primevue.config.locale.prevYear : _ctx.$primevue.config.locale.prevMonth, - unstyled: _ctx.unstyled, - onClick: $options.onPrevButtonClick, - onKeydown: $options.onContainerButtonKeydown - }, _ctx.navigatorButtonProps, { - pt: _ctx.ptm("pcPrevButton"), - "data-pc-group-section": "navigator" - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "previcon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.prevIcon ? "span" : "ChevronLeftIcon"), mergeProps({ - "class": [_ctx.prevIcon, slotProps["class"]], - ref_for: true - }, _ctx.ptm("pcPrevButton")["icon"]), null, 16, ["class"]))]; - })]; - }), - _: 2 - }, 1040, ["class", "disabled", "aria-label", "unstyled", "onClick", "onKeydown", "pt"]), [[vShow, groupIndex === 0]]), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("title"), - ref_for: true - }, _ctx.ptm("title")), [_ctx.$primevue.config.locale.showMonthAfterYear ? (openBlock(), createElementBlock(Fragment, { - key: 0 - }, [$data.currentView !== "year" ? (openBlock(), createElementBlock("button", mergeProps({ - key: 0, - type: "button", - onClick: _cache[1] || (_cache[1] = function() { - return $options.switchToYearView && $options.switchToYearView.apply($options, arguments); - }), - onKeydown: _cache[2] || (_cache[2] = function() { - return $options.onContainerButtonKeydown && $options.onContainerButtonKeydown.apply($options, arguments); - }), - "class": _ctx.cx("selectYear"), - disabled: $options.switchViewButtonDisabled, - "aria-label": _ctx.$primevue.config.locale.chooseYear, - ref_for: true - }, _ctx.ptm("selectYear"), { - "data-pc-group-section": "view" - }), toDisplayString($options.getYear(month2)), 17, _hoisted_4$9)) : createCommentVNode("", true), $data.currentView === "date" ? (openBlock(), createElementBlock("button", mergeProps({ - key: 1, - type: "button", - onClick: _cache[3] || (_cache[3] = function() { - return $options.switchToMonthView && $options.switchToMonthView.apply($options, arguments); - }), - onKeydown: _cache[4] || (_cache[4] = function() { - return $options.onContainerButtonKeydown && $options.onContainerButtonKeydown.apply($options, arguments); - }), - "class": _ctx.cx("selectMonth"), - disabled: $options.switchViewButtonDisabled, - "aria-label": _ctx.$primevue.config.locale.chooseMonth, - ref_for: true - }, _ctx.ptm("selectMonth"), { - "data-pc-group-section": "view" - }), toDisplayString($options.getMonthName(month2.month)), 17, _hoisted_5$4)) : createCommentVNode("", true)], 64)) : (openBlock(), createElementBlock(Fragment, { - key: 1 - }, [$data.currentView === "date" ? (openBlock(), createElementBlock("button", mergeProps({ - key: 0, - type: "button", - onClick: _cache[5] || (_cache[5] = function() { - return $options.switchToMonthView && $options.switchToMonthView.apply($options, arguments); - }), - onKeydown: _cache[6] || (_cache[6] = function() { - return $options.onContainerButtonKeydown && $options.onContainerButtonKeydown.apply($options, arguments); - }), - "class": _ctx.cx("selectMonth"), - disabled: $options.switchViewButtonDisabled, - "aria-label": _ctx.$primevue.config.locale.chooseMonth, - ref_for: true - }, _ctx.ptm("selectMonth"), { - "data-pc-group-section": "view" - }), toDisplayString($options.getMonthName(month2.month)), 17, _hoisted_6$2)) : createCommentVNode("", true), $data.currentView !== "year" ? (openBlock(), createElementBlock("button", mergeProps({ - key: 1, - type: "button", - onClick: _cache[7] || (_cache[7] = function() { - return $options.switchToYearView && $options.switchToYearView.apply($options, arguments); - }), - onKeydown: _cache[8] || (_cache[8] = function() { - return $options.onContainerButtonKeydown && $options.onContainerButtonKeydown.apply($options, arguments); - }), - "class": _ctx.cx("selectYear"), - disabled: $options.switchViewButtonDisabled, - "aria-label": _ctx.$primevue.config.locale.chooseYear, - ref_for: true - }, _ctx.ptm("selectYear"), { - "data-pc-group-section": "view" - }), toDisplayString($options.getYear(month2)), 17, _hoisted_7$2)) : createCommentVNode("", true)], 64)), $data.currentView === "year" ? (openBlock(), createElementBlock("span", mergeProps({ - key: 2, - "class": _ctx.cx("decade"), - ref_for: true - }, _ctx.ptm("decade")), [renderSlot(_ctx.$slots, "decade", { - years: $options.yearPickerValues - }, function() { - return [createTextVNode(toDisplayString($options.yearPickerValues[0].value) + " - " + toDisplayString($options.yearPickerValues[$options.yearPickerValues.length - 1].value), 1)]; - })], 16)) : createCommentVNode("", true)], 16), withDirectives(createVNode(_component_Button, mergeProps({ - ref_for: true, - ref: $options.nextButtonRef, - "class": _ctx.cx("pcNextButton"), - disabled: _ctx.disabled, - "aria-label": $data.currentView === "year" ? _ctx.$primevue.config.locale.nextDecade : $data.currentView === "month" ? _ctx.$primevue.config.locale.nextYear : _ctx.$primevue.config.locale.nextMonth, - unstyled: _ctx.unstyled, - onClick: $options.onNextButtonClick, - onKeydown: $options.onContainerButtonKeydown - }, _ctx.navigatorButtonProps, { - pt: _ctx.ptm("pcNextButton"), - "data-pc-group-section": "navigator" - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "nexticon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.nextIcon ? "span" : "ChevronRightIcon"), mergeProps({ - "class": [_ctx.nextIcon, slotProps["class"]], - ref_for: true - }, _ctx.ptm("pcNextButton")["icon"]), null, 16, ["class"]))]; - })]; - }), - _: 2 - }, 1040, ["class", "disabled", "aria-label", "unstyled", "onClick", "onKeydown", "pt"]), [[vShow, _ctx.numberOfMonths === 1 ? true : groupIndex === _ctx.numberOfMonths - 1]])], 16), $data.currentView === "date" ? (openBlock(), createElementBlock("table", mergeProps({ - key: 0, - "class": _ctx.cx("dayView"), - role: "grid", - ref_for: true - }, _ctx.ptm("dayView")), [createBaseVNode("thead", mergeProps({ - ref_for: true - }, _ctx.ptm("tableHeader")), [createBaseVNode("tr", mergeProps({ - ref_for: true - }, _ctx.ptm("tableHeaderRow")), [_ctx.showWeek ? (openBlock(), createElementBlock("th", mergeProps({ - key: 0, - scope: "col", - "class": _ctx.cx("weekHeader"), - ref_for: true - }, _ctx.ptm("weekHeader", { - context: { - disabled: _ctx.showWeek - } - }), { - "data-p-disabled": _ctx.showWeek, - "data-pc-group-section": "tableheadercell" - }), [renderSlot(_ctx.$slots, "weekheaderlabel", {}, function() { - return [createBaseVNode("span", mergeProps({ - ref_for: true - }, _ctx.ptm("weekHeaderLabel", { - context: { - disabled: _ctx.showWeek - } - }), { - "data-pc-group-section": "tableheadercelllabel" - }), toDisplayString($options.weekHeaderLabel), 17)]; - })], 16, _hoisted_8$2)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList($options.weekDays, function(weekDay) { - return openBlock(), createElementBlock("th", mergeProps({ - key: weekDay, - scope: "col", - abbr: weekDay, - ref_for: true - }, _ctx.ptm("tableHeaderCell"), { - "data-pc-group-section": "tableheadercell", - "class": _ctx.cx("weekDayCell") - }), [createBaseVNode("span", mergeProps({ - "class": _ctx.cx("weekDay"), - ref_for: true - }, _ctx.ptm("weekDay"), { - "data-pc-group-section": "tableheadercelllabel" - }), toDisplayString(weekDay), 17)], 16, _hoisted_9); - }), 128))], 16)], 16), createBaseVNode("tbody", mergeProps({ - ref_for: true - }, _ctx.ptm("tableBody")), [(openBlock(true), createElementBlock(Fragment, null, renderList(month2.dates, function(week, i) { - return openBlock(), createElementBlock("tr", mergeProps({ - key: week[0].day + "" + week[0].month, - ref_for: true - }, _ctx.ptm("tableBodyRow")), [_ctx.showWeek ? (openBlock(), createElementBlock("td", mergeProps({ - key: 0, - "class": _ctx.cx("weekNumber"), - ref_for: true - }, _ctx.ptm("weekNumber"), { - "data-pc-group-section": "tablebodycell" - }), [createBaseVNode("span", mergeProps({ - "class": _ctx.cx("weekLabelContainer"), - ref_for: true - }, _ctx.ptm("weekLabelContainer", { - context: { - disabled: _ctx.showWeek - } - }), { - "data-p-disabled": _ctx.showWeek, - "data-pc-group-section": "tablebodycelllabel" - }), [renderSlot(_ctx.$slots, "weeklabel", { - weekNumber: month2.weekNumbers[i] - }, function() { - return [month2.weekNumbers[i] < 10 ? (openBlock(), createElementBlock("span", mergeProps({ - key: 0, - style: { - "visibility": "hidden" - }, - ref_for: true - }, _ctx.ptm("weekLabel")), "0", 16)) : createCommentVNode("", true), createTextVNode(" " + toDisplayString(month2.weekNumbers[i]), 1)]; - })], 16, _hoisted_10)], 16)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(week, function(date) { - return openBlock(), createElementBlock("td", mergeProps({ - key: date.day + "" + date.month, - "aria-label": date.day, - "class": _ctx.cx("dayCell", { - date - }), - ref_for: true - }, _ctx.ptm("dayCell", { - context: { - date, - today: date.today, - otherMonth: date.otherMonth, - selected: $options.isSelected(date), - disabled: !date.selectable - } - }), { - "data-p-today": date.today, - "data-p-other-month": date.otherMonth, - "data-pc-group-section": "tablebodycell" - }), [_ctx.showOtherMonths || !date.otherMonth ? withDirectives((openBlock(), createElementBlock("span", mergeProps({ - key: 0, - "class": _ctx.cx("day", { - date - }), - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return $options.onDateSelect($event, date); - }, "onClick"), - draggable: "false", - onKeydown: /* @__PURE__ */ __name(function onKeydown5($event) { - return $options.onDateCellKeydown($event, date, groupIndex); - }, "onKeydown"), - "aria-selected": $options.isSelected(date), - "aria-disabled": !date.selectable, - ref_for: true - }, _ctx.ptm("day", { - context: { - date, - today: date.today, - otherMonth: date.otherMonth, - selected: $options.isSelected(date), - disabled: !date.selectable - } - }), { - "data-p-disabled": !date.selectable, - "data-p-selected": $options.isSelected(date), - "data-pc-group-section": "tablebodycelllabel" - }), [renderSlot(_ctx.$slots, "date", { - date - }, function() { - return [createTextVNode(toDisplayString(date.day), 1)]; - })], 16, _hoisted_12)), [[_directive_ripple]]) : createCommentVNode("", true), $options.isSelected(date) ? (openBlock(), createElementBlock("div", mergeProps({ - key: 1, - "class": "p-hidden-accessible", - "aria-live": "polite", - ref_for: true - }, _ctx.ptm("hiddenSelectedDay"), { - "data-p-hidden-accessible": true - }), toDisplayString(date.day), 17)) : createCommentVNode("", true)], 16, _hoisted_11); - }), 128))], 16); - }), 128))], 16)], 16)) : createCommentVNode("", true)], 16); - }), 128))], 16), $data.currentView === "month" ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("monthView") - }, _ctx.ptm("monthView")), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.monthPickerValues, function(m, i) { - return withDirectives((openBlock(), createElementBlock("span", mergeProps({ - key: m, - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return $options.onMonthSelect($event, { - month: m, - index: i - }); - }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown5($event) { - return $options.onMonthCellKeydown($event, { - month: m, - index: i - }); - }, "onKeydown"), - "class": _ctx.cx("month", { - month: m, - index: i - }), - ref_for: true - }, _ctx.ptm("month", { - context: { - month: m, - monthIndex: i, - selected: $options.isMonthSelected(i), - disabled: !m.selectable - } - }), { - "data-p-disabled": !m.selectable, - "data-p-selected": $options.isMonthSelected(i) - }), [createTextVNode(toDisplayString(m.value) + " ", 1), $options.isMonthSelected(i) ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": "p-hidden-accessible", - "aria-live": "polite", - ref_for: true - }, _ctx.ptm("hiddenMonth"), { - "data-p-hidden-accessible": true - }), toDisplayString(m.value), 17)) : createCommentVNode("", true)], 16, _hoisted_13)), [[_directive_ripple]]); - }), 128))], 16)) : createCommentVNode("", true), $data.currentView === "year" ? (openBlock(), createElementBlock("div", mergeProps({ - key: 1, - "class": _ctx.cx("yearView") - }, _ctx.ptm("yearView")), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.yearPickerValues, function(y) { - return withDirectives((openBlock(), createElementBlock("span", mergeProps({ - key: y.value, - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return $options.onYearSelect($event, y); - }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown5($event) { - return $options.onYearCellKeydown($event, y); - }, "onKeydown"), - "class": _ctx.cx("year", { - year: y - }), - ref_for: true - }, _ctx.ptm("year", { - context: { - year: y, - selected: $options.isYearSelected(y.value), - disabled: !y.selectable - } - }), { - "data-p-disabled": !y.selectable, - "data-p-selected": $options.isYearSelected(y.value) - }), [createTextVNode(toDisplayString(y.value) + " ", 1), $options.isYearSelected(y.value) ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": "p-hidden-accessible", - "aria-live": "polite", - ref_for: true - }, _ctx.ptm("hiddenYear"), { - "data-p-hidden-accessible": true - }), toDisplayString(y.value), 17)) : createCommentVNode("", true)], 16, _hoisted_14)), [[_directive_ripple]]); - }), 128))], 16)) : createCommentVNode("", true)], 64)) : createCommentVNode("", true), (_ctx.showTime || _ctx.timeOnly) && $data.currentView === "date" ? (openBlock(), createElementBlock("div", mergeProps({ - key: 1, - "class": _ctx.cx("timePicker") - }, _ctx.ptm("timePicker")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("hourPicker") - }, _ctx.ptm("hourPicker"), { - "data-pc-group-section": "timepickerContainer" - }), [createVNode(_component_Button, mergeProps({ - "class": _ctx.cx("pcIncrementButton"), - "aria-label": _ctx.$primevue.config.locale.nextHour, - unstyled: _ctx.unstyled, - onMousedown: _cache[9] || (_cache[9] = function($event) { - return $options.onTimePickerElementMouseDown($event, 0, 1); - }), - onMouseup: _cache[10] || (_cache[10] = function($event) { - return $options.onTimePickerElementMouseUp($event); - }), - onKeydown: [$options.onContainerButtonKeydown, _cache[12] || (_cache[12] = withKeys(function($event) { - return $options.onTimePickerElementMouseDown($event, 0, 1); - }, ["enter"])), _cache[13] || (_cache[13] = withKeys(function($event) { - return $options.onTimePickerElementMouseDown($event, 0, 1); - }, ["space"]))], - onMouseleave: _cache[11] || (_cache[11] = function($event) { - return $options.onTimePickerElementMouseLeave(); - }), - onKeyup: [_cache[14] || (_cache[14] = withKeys(function($event) { - return $options.onTimePickerElementMouseUp($event); - }, ["enter"])), _cache[15] || (_cache[15] = withKeys(function($event) { - return $options.onTimePickerElementMouseUp($event); - }, ["space"]))] - }, _ctx.timepickerButtonProps, { - pt: _ctx.ptm("pcIncrementButton"), - "data-pc-group-section": "timepickerbutton" - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "incrementicon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.incrementIcon ? "span" : "ChevronUpIcon"), mergeProps({ - "class": [_ctx.incrementIcon, slotProps["class"]] - }, _ctx.ptm("pcIncrementButton")["icon"], { - "data-pc-group-section": "timepickerlabel" - }), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "aria-label", "unstyled", "onKeydown", "pt"]), createBaseVNode("span", mergeProps(_ctx.ptm("hour"), { - "data-pc-group-section": "timepickerlabel" - }), toDisplayString($options.formattedCurrentHour), 17), createVNode(_component_Button, mergeProps({ - "class": _ctx.cx("pcDecrementButton"), - "aria-label": _ctx.$primevue.config.locale.prevHour, - unstyled: _ctx.unstyled, - onMousedown: _cache[16] || (_cache[16] = function($event) { - return $options.onTimePickerElementMouseDown($event, 0, -1); - }), - onMouseup: _cache[17] || (_cache[17] = function($event) { - return $options.onTimePickerElementMouseUp($event); - }), - onKeydown: [$options.onContainerButtonKeydown, _cache[19] || (_cache[19] = withKeys(function($event) { - return $options.onTimePickerElementMouseDown($event, 0, -1); - }, ["enter"])), _cache[20] || (_cache[20] = withKeys(function($event) { - return $options.onTimePickerElementMouseDown($event, 0, -1); - }, ["space"]))], - onMouseleave: _cache[18] || (_cache[18] = function($event) { - return $options.onTimePickerElementMouseLeave(); - }), - onKeyup: [_cache[21] || (_cache[21] = withKeys(function($event) { - return $options.onTimePickerElementMouseUp($event); - }, ["enter"])), _cache[22] || (_cache[22] = withKeys(function($event) { - return $options.onTimePickerElementMouseUp($event); - }, ["space"]))] - }, _ctx.timepickerButtonProps, { - pt: _ctx.ptm("pcDecrementButton"), - "data-pc-group-section": "timepickerbutton" - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "decrementicon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.decrementIcon ? "span" : "ChevronDownIcon"), mergeProps({ - "class": [_ctx.decrementIcon, slotProps["class"]] - }, _ctx.ptm("pcDecrementButton")["icon"], { - "data-pc-group-section": "timepickerlabel" - }), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "aria-label", "unstyled", "onKeydown", "pt"])], 16), createBaseVNode("div", mergeProps(_ctx.ptm("separatorContainer"), { - "data-pc-group-section": "timepickerContainer" - }), [createBaseVNode("span", mergeProps(_ctx.ptm("separator"), { - "data-pc-group-section": "timepickerlabel" - }), toDisplayString(_ctx.timeSeparator), 17)], 16), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("minutePicker") - }, _ctx.ptm("minutePicker"), { - "data-pc-group-section": "timepickerContainer" - }), [createVNode(_component_Button, mergeProps({ - "class": _ctx.cx("pcIncrementButton"), - "aria-label": _ctx.$primevue.config.locale.nextMinute, - disabled: _ctx.disabled, - unstyled: _ctx.unstyled, - onMousedown: _cache[23] || (_cache[23] = function($event) { - return $options.onTimePickerElementMouseDown($event, 1, 1); - }), - onMouseup: _cache[24] || (_cache[24] = function($event) { - return $options.onTimePickerElementMouseUp($event); - }), - onKeydown: [$options.onContainerButtonKeydown, _cache[26] || (_cache[26] = withKeys(function($event) { - return $options.onTimePickerElementMouseDown($event, 1, 1); - }, ["enter"])), _cache[27] || (_cache[27] = withKeys(function($event) { - return $options.onTimePickerElementMouseDown($event, 1, 1); - }, ["space"]))], - onMouseleave: _cache[25] || (_cache[25] = function($event) { - return $options.onTimePickerElementMouseLeave(); - }), - onKeyup: [_cache[28] || (_cache[28] = withKeys(function($event) { - return $options.onTimePickerElementMouseUp($event); - }, ["enter"])), _cache[29] || (_cache[29] = withKeys(function($event) { - return $options.onTimePickerElementMouseUp($event); - }, ["space"]))] - }, _ctx.timepickerButtonProps, { - pt: _ctx.ptm("pcIncrementButton"), - "data-pc-group-section": "timepickerbutton" - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "incrementicon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.incrementIcon ? "span" : "ChevronUpIcon"), mergeProps({ - "class": [_ctx.incrementIcon, slotProps["class"]] - }, _ctx.ptm("pcIncrementButton")["icon"], { - "data-pc-group-section": "timepickerlabel" - }), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "aria-label", "disabled", "unstyled", "onKeydown", "pt"]), createBaseVNode("span", mergeProps(_ctx.ptm("minute"), { - "data-pc-group-section": "timepickerlabel" - }), toDisplayString($options.formattedCurrentMinute), 17), createVNode(_component_Button, mergeProps({ - "class": _ctx.cx("pcDecrementButton"), - "aria-label": _ctx.$primevue.config.locale.prevMinute, - disabled: _ctx.disabled, - onMousedown: _cache[30] || (_cache[30] = function($event) { - return $options.onTimePickerElementMouseDown($event, 1, -1); - }), - onMouseup: _cache[31] || (_cache[31] = function($event) { - return $options.onTimePickerElementMouseUp($event); - }), - onKeydown: [$options.onContainerButtonKeydown, _cache[33] || (_cache[33] = withKeys(function($event) { - return $options.onTimePickerElementMouseDown($event, 1, -1); - }, ["enter"])), _cache[34] || (_cache[34] = withKeys(function($event) { - return $options.onTimePickerElementMouseDown($event, 1, -1); - }, ["space"]))], - onMouseleave: _cache[32] || (_cache[32] = function($event) { - return $options.onTimePickerElementMouseLeave(); - }), - onKeyup: [_cache[35] || (_cache[35] = withKeys(function($event) { - return $options.onTimePickerElementMouseUp($event); - }, ["enter"])), _cache[36] || (_cache[36] = withKeys(function($event) { - return $options.onTimePickerElementMouseUp($event); - }, ["space"]))] - }, _ctx.timepickerButtonProps, { - pt: _ctx.ptm("pcDecrementButton"), - "data-pc-group-section": "timepickerbutton" - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "decrementicon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.decrementIcon ? "span" : "ChevronDownIcon"), mergeProps({ - "class": [_ctx.decrementIcon, slotProps["class"]] - }, _ctx.ptm("pcDecrementButton")["icon"], { - "data-pc-group-section": "timepickerlabel" - }), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "aria-label", "disabled", "onKeydown", "pt"])], 16), _ctx.showSeconds ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("separatorContainer") - }, _ctx.ptm("separatorContainer"), { - "data-pc-group-section": "timepickerContainer" - }), [createBaseVNode("span", mergeProps(_ctx.ptm("separator"), { - "data-pc-group-section": "timepickerlabel" - }), toDisplayString(_ctx.timeSeparator), 17)], 16)) : createCommentVNode("", true), _ctx.showSeconds ? (openBlock(), createElementBlock("div", mergeProps({ - key: 1, - "class": _ctx.cx("secondPicker") - }, _ctx.ptm("secondPicker"), { - "data-pc-group-section": "timepickerContainer" - }), [createVNode(_component_Button, mergeProps({ - "class": _ctx.cx("pcIncrementButton"), - "aria-label": _ctx.$primevue.config.locale.nextSecond, - disabled: _ctx.disabled, - unstyled: _ctx.unstyled, - onMousedown: _cache[37] || (_cache[37] = function($event) { - return $options.onTimePickerElementMouseDown($event, 2, 1); - }), - onMouseup: _cache[38] || (_cache[38] = function($event) { - return $options.onTimePickerElementMouseUp($event); - }), - onKeydown: [$options.onContainerButtonKeydown, _cache[40] || (_cache[40] = withKeys(function($event) { - return $options.onTimePickerElementMouseDown($event, 2, 1); - }, ["enter"])), _cache[41] || (_cache[41] = withKeys(function($event) { - return $options.onTimePickerElementMouseDown($event, 2, 1); - }, ["space"]))], - onMouseleave: _cache[39] || (_cache[39] = function($event) { - return $options.onTimePickerElementMouseLeave(); - }), - onKeyup: [_cache[42] || (_cache[42] = withKeys(function($event) { - return $options.onTimePickerElementMouseUp($event); - }, ["enter"])), _cache[43] || (_cache[43] = withKeys(function($event) { - return $options.onTimePickerElementMouseUp($event); - }, ["space"]))] - }, _ctx.timepickerButtonProps, { - pt: _ctx.ptm("pcIncrementButton"), - "data-pc-group-section": "timepickerbutton" - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "incrementicon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.incrementIcon ? "span" : "ChevronUpIcon"), mergeProps({ - "class": [_ctx.incrementIcon, slotProps["class"]] - }, _ctx.ptm("pcIncrementButton")["icon"], { - "data-pc-group-section": "timepickerlabel" - }), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "aria-label", "disabled", "unstyled", "onKeydown", "pt"]), createBaseVNode("span", mergeProps(_ctx.ptm("second"), { - "data-pc-group-section": "timepickerlabel" - }), toDisplayString($options.formattedCurrentSecond), 17), createVNode(_component_Button, mergeProps({ - "class": _ctx.cx("pcDecrementButton"), - "aria-label": _ctx.$primevue.config.locale.prevSecond, - disabled: _ctx.disabled, - unstyled: _ctx.unstyled, - onMousedown: _cache[44] || (_cache[44] = function($event) { - return $options.onTimePickerElementMouseDown($event, 2, -1); - }), - onMouseup: _cache[45] || (_cache[45] = function($event) { - return $options.onTimePickerElementMouseUp($event); - }), - onKeydown: [$options.onContainerButtonKeydown, _cache[47] || (_cache[47] = withKeys(function($event) { - return $options.onTimePickerElementMouseDown($event, 2, -1); - }, ["enter"])), _cache[48] || (_cache[48] = withKeys(function($event) { - return $options.onTimePickerElementMouseDown($event, 2, -1); - }, ["space"]))], - onMouseleave: _cache[46] || (_cache[46] = function($event) { - return $options.onTimePickerElementMouseLeave(); - }), - onKeyup: [_cache[49] || (_cache[49] = withKeys(function($event) { - return $options.onTimePickerElementMouseUp($event); - }, ["enter"])), _cache[50] || (_cache[50] = withKeys(function($event) { - return $options.onTimePickerElementMouseUp($event); - }, ["space"]))] - }, _ctx.timepickerButtonProps, { - pt: _ctx.ptm("pcDecrementButton"), - "data-pc-group-section": "timepickerbutton" - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "decrementicon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.decrementIcon ? "span" : "ChevronDownIcon"), mergeProps({ - "class": [_ctx.decrementIcon, slotProps["class"]] - }, _ctx.ptm("pcDecrementButton")["icon"], { - "data-pc-group-section": "timepickerlabel" - }), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "aria-label", "disabled", "unstyled", "onKeydown", "pt"])], 16)) : createCommentVNode("", true), _ctx.hourFormat == "12" ? (openBlock(), createElementBlock("div", mergeProps({ - key: 2, - "class": _ctx.cx("separatorContainer") - }, _ctx.ptm("separatorContainer"), { - "data-pc-group-section": "timepickerContainer" - }), [createBaseVNode("span", mergeProps(_ctx.ptm("separator"), { - "data-pc-group-section": "timepickerlabel" - }), toDisplayString(_ctx.timeSeparator), 17)], 16)) : createCommentVNode("", true), _ctx.hourFormat == "12" ? (openBlock(), createElementBlock("div", mergeProps({ - key: 3, - "class": _ctx.cx("ampmPicker") - }, _ctx.ptm("ampmPicker")), [createVNode(_component_Button, mergeProps({ - "class": _ctx.cx("pcIncrementButton"), - "aria-label": _ctx.$primevue.config.locale.am, - disabled: _ctx.disabled, - unstyled: _ctx.unstyled, - onClick: _cache[51] || (_cache[51] = function($event) { - return $options.toggleAMPM($event); - }), - onKeydown: $options.onContainerButtonKeydown - }, _ctx.timepickerButtonProps, { - pt: _ctx.ptm("pcIncrementButton"), - "data-pc-group-section": "timepickerbutton" - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "incrementicon", { - "class": normalizeClass(_ctx.cx("incrementIcon")) - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.incrementIcon ? "span" : "ChevronUpIcon"), mergeProps({ - "class": [_ctx.cx("incrementIcon"), slotProps["class"]] - }, _ctx.ptm("pcIncrementButton")["icon"], { - "data-pc-group-section": "timepickerlabel" - }), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "aria-label", "disabled", "unstyled", "onKeydown", "pt"]), createBaseVNode("span", mergeProps(_ctx.ptm("ampm"), { - "data-pc-group-section": "timepickerlabel" - }), toDisplayString($data.pm ? _ctx.$primevue.config.locale.pm : _ctx.$primevue.config.locale.am), 17), createVNode(_component_Button, mergeProps({ - "class": _ctx.cx("pcDecrementButton"), - "aria-label": _ctx.$primevue.config.locale.pm, - disabled: _ctx.disabled, - onClick: _cache[52] || (_cache[52] = function($event) { - return $options.toggleAMPM($event); - }), - onKeydown: $options.onContainerButtonKeydown - }, _ctx.timepickerButtonProps, { - pt: _ctx.ptm("pcDecrementButton"), - "data-pc-group-section": "timepickerbutton" - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "decrementicon", { - "class": normalizeClass(_ctx.cx("decrementIcon")) - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.decrementIcon ? "span" : "ChevronDownIcon"), mergeProps({ - "class": [_ctx.cx("decrementIcon"), slotProps["class"]] - }, _ctx.ptm("pcDecrementButton")["icon"], { - "data-pc-group-section": "timepickerlabel" - }), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "aria-label", "disabled", "onKeydown", "pt"])], 16)) : createCommentVNode("", true)], 16)) : createCommentVNode("", true), _ctx.showButtonBar ? (openBlock(), createElementBlock("div", mergeProps({ - key: 2, - "class": _ctx.cx("buttonbar") - }, _ctx.ptm("buttonbar")), [createVNode(_component_Button, mergeProps({ - label: $options.todayLabel, - onClick: _cache[53] || (_cache[53] = function($event) { - return $options.onTodayButtonClick($event); - }), - "class": _ctx.cx("pcTodayButton"), - unstyled: _ctx.unstyled, - onKeydown: $options.onContainerButtonKeydown - }, _ctx.todayButtonProps, { - pt: _ctx.ptm("pcTodayButton"), - "data-pc-group-section": "button" - }), null, 16, ["label", "class", "unstyled", "onKeydown", "pt"]), createVNode(_component_Button, mergeProps({ - label: $options.clearLabel, - onClick: _cache[54] || (_cache[54] = function($event) { - return $options.onClearButtonClick($event); - }), - "class": _ctx.cx("pcClearButton"), - unstyled: _ctx.unstyled, - onKeydown: $options.onContainerButtonKeydown - }, _ctx.clearButtonProps, { - pt: _ctx.ptm("pcClearButton"), - "data-pc-group-section": "button" - }), null, 16, ["label", "class", "unstyled", "onKeydown", "pt"])], 16)) : createCommentVNode("", true), renderSlot(_ctx.$slots, "footer")], 16, _hoisted_3$h)) : createCommentVNode("", true)]; - }), - _: 3 - }, 16, ["onAfterEnter", "onAfterLeave", "onLeave"])]; - }), - _: 3 - }, 8, ["appendTo", "disabled"])], 16, _hoisted_1$s); -} -__name(render$V, "render$V"); -script$12.render = render$V; -var script$11 = { - name: "Calendar", - "extends": script$12, - mounted: /* @__PURE__ */ __name(function mounted6() { - console.warn("Deprecated since v4. Use DatePicker component instead."); - }, "mounted") -}; -var CalendarStyle = BaseStyle.extend({ - name: "calendar" -}); -var theme$y = /* @__PURE__ */ __name(function theme5(_ref) { - var dt = _ref.dt; - return "\n.p-cascadeselect {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n background: ".concat(dt("cascadeselect.background"), ";\n border: 1px solid ").concat(dt("cascadeselect.border.color"), ";\n transition: background ").concat(dt("cascadeselect.transition.duration"), ", color ").concat(dt("cascadeselect.transition.duration"), ", border-color ").concat(dt("cascadeselect.transition.duration"), ", outline-color ").concat(dt("cascadeselect.transition.duration"), ", box-shadow ").concat(dt("cascadeselect.transition.duration"), ";\n border-radius: ").concat(dt("cascadeselect.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("cascadeselect.shadow"), ";\n}\n\n.p-cascadeselect:not(.p-disabled):hover {\n border-color: ").concat(dt("cascadeselect.hover.border.color"), ";\n}\n\n.p-cascadeselect:not(.p-disabled).p-focus {\n border-color: ").concat(dt("cascadeselect.focus.border.color"), ";\n box-shadow: ").concat(dt("cascadeselect.focus.ring.shadow"), ";\n outline: ").concat(dt("cascadeselect.focus.ring.width"), " ").concat(dt("cascadeselect.focus.ring.style"), " ").concat(dt("cascadeselect.focus.ring.color"), ";\n outline-offset: ").concat(dt("cascadeselect.focus.ring.offset"), ";\n}\n\n.p-cascadeselect.p-variant-filled {\n background: ").concat(dt("cascadeselect.filled.background"), ";\n}\n\n.p-cascadeselect.p-variant-filled:not(.p-disabled):hover {\n background: ").concat(dt("cascadeselect.filled.hover.background"), ";\n}\n\n.p-cascadeselect.p-variant-filled.p-focus {\n background: ").concat(dt("cascadeselect.filled.focus.background"), ";\n}\n\n.p-cascadeselect.p-invalid {\n border-color: ").concat(dt("cascadeselect.invalid.border.color"), ";\n}\n\n.p-cascadeselect.p-disabled {\n opacity: 1;\n background: ").concat(dt("cascadeselect.disabled.background"), ";\n}\n\n.p-cascadeselect-dropdown {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n background: transparent;\n color: ").concat(dt("cascadeselect.dropdown.color"), ";\n width: ").concat(dt("cascadeselect.dropdown.width"), ";\n border-start-end-radius: ").concat(dt("border.radius.md"), ";\n border-end-end-radius: ").concat(dt("border.radius.md"), ";\n}\n\n.p-cascadeselect-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n color: ").concat(dt("cascadeselect.clear.icon.color"), ";\n inset-inline-end: ").concat(dt("cascadeselect.dropdown.width"), ";\n}\n\n.p-cascadeselect-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n padding: ").concat(dt("cascadeselect.padding.y"), " ").concat(dt("cascadeselect.padding.x"), ";\n background: transparent;\n border: 0 none;\n outline: 0 none;\n}\n\n.p-cascadeselect-label.p-placeholder {\n color: ").concat(dt("cascadeselect.placeholder.color"), ";\n}\n\n.p-cascadeselect.p-invalid .p-cascadeselect-label.p-placeholder {\n color: ").concat(dt("cascadeselect.invalid.placeholder.color"), ";\n}\n\n.p-cascadeselect.p-disabled .p-cascadeselect-label {\n color: ").concat(dt("cascadeselect.disabled.color"), ";\n}\n\n.p-cascadeselect-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\n\n.p-cascadeselect-fluid {\n display: flex;\n}\n\n.p-cascadeselect-fluid .p-cascadeselect-label {\n width: 1%;\n}\n\n.p-cascadeselect-overlay {\n background: ").concat(dt("cascadeselect.overlay.background"), ";\n color: ").concat(dt("cascadeselect.overlay.color"), ";\n border: 1px solid ").concat(dt("cascadeselect.overlay.border.color"), ";\n border-radius: ").concat(dt("cascadeselect.overlay.border.radius"), ";\n box-shadow: ").concat(dt("cascadeselect.overlay.shadow"), ";\n}\n\n.p-cascadeselect .p-cascadeselect-overlay {\n min-width: 100%;\n}\n\n.p-cascadeselect-option-list {\n display: none;\n min-width: 100%;\n position: absolute;\n z-index: 1;\n}\n\n.p-cascadeselect-list {\n min-width: 100%;\n margin: 0;\n padding: 0;\n list-style-type: none;\n padding: ").concat(dt("cascadeselect.list.padding"), ";\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("cascadeselect.list.gap"), ";\n}\n\n.p-cascadeselect-option {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n border: 0 none;\n color: ").concat(dt("cascadeselect.option.color"), ";\n background: transparent;\n border-radius: ").concat(dt("cascadeselect.option.border.radius"), ";\n}\n\n.p-cascadeselect-option-active {\n overflow: visible;\n}\n\n.p-cascadeselect-option-active > .p-cascadeselect-option-content {\n background: ").concat(dt("cascadeselect.option.focus.background"), ";\n color: ").concat(dt("cascadeselect.option.focus.color"), ";\n}\n\n.p-cascadeselect-option:not(.p-cascadeselect-option-selected):not(.p-disabled).p-focus > .p-cascadeselect-option-content {\n background: ").concat(dt("cascadeselect.option.focus.background"), ";\n color: ").concat(dt("cascadeselect.option.focus.color"), ";\n}\n\n.p-cascadeselect-option:not(.p-cascadeselect-option-selected):not(.p-disabled).p-focus > .p-cascadeselect-option-content > .p-cascadeselect-group-icon-container > .p-cascadeselect-group-icon {\n color: ").concat(dt("cascadeselect.option.icon.focus.color"), ";\n}\n\n.p-cascadeselect-option-selected > .p-cascadeselect-option-content {\n background: ").concat(dt("cascadeselect.option.selected.background"), ";\n color: ").concat(dt("cascadeselect.option.selected.color"), ";\n}\n\n.p-cascadeselect-option-selected.p-focus > .p-cascadeselect-option-content {\n background: ").concat(dt("cascadeselect.option.selected.focus.background"), ";\n color: ").concat(dt("cascadeselect.option.selected.focus.color"), ";\n}\n\n.p-cascadeselect-option-active > .p-cascadeselect-option-list {\n inset-inline-start: 100%;\n inset-block-start: 0;\n}\n\n.p-cascadeselect-option-content {\n display: flex;\n align-items: center;\n justify-content: space-between;\n overflow: hidden;\n position: relative;\n padding: ").concat(dt("cascadeselect.option.padding"), ";\n border-radius: ").concat(dt("cascadeselect.option.border.radius"), ";\n transition: background ").concat(dt("cascadeselect.transition.duration"), ", color ").concat(dt("cascadeselect.transition.duration"), ", border-color ").concat(dt("cascadeselect.transition.duration"), ", box-shadow ").concat(dt("cascadeselect.transition.duration"), ", outline-color ").concat(dt("cascadeselect.transition.duration"), ";\n}\n\n.p-cascadeselect-group-icon {\n font-size: ").concat(dt("cascadeselect.option.icon.size"), ";\n width: ").concat(dt("cascadeselect.option.icon.size"), ";\n height: ").concat(dt("cascadeselect.option.icon.size"), ";\n color: ").concat(dt("cascadeselect.option.icon.color"), ";\n}\n\n.p-cascadeselect-group-icon:dir(rtl) {\n transform: rotate(180deg);\n}\n\n.p-cascadeselect-mobile-active .p-cascadeselect-option-list {\n position: static;\n box-shadow: none;\n border: 0 none;\n padding-inline-start: ").concat(dt("tieredmenu.submenu.mobile.indent"), ";\n padding-inline-end: 0;\n}\n\n.p-cascadeselect-mobile-active .p-cascadeselect-group-icon {\n transition: transform 0.2s;\n transform: rotate(90deg);\n}\n\n.p-cascadeselect-mobile-active .p-cascadeselect-option-active > .p-cascadeselect-option-content .p-cascadeselect-group-icon {\n transform: rotate(-90deg);\n}\n\n.p-cascadeselect-sm .p-cascadeselect-label {\n font-size: ").concat(dt("cascadeselect.sm.font.size"), ";\n padding-block: ").concat(dt("cascadeselect.sm.padding.y"), ";\n padding-inline: ").concat(dt("cascadeselect.sm.padding.x"), ";\n}\n\n.p-cascadeselect-sm .p-cascadeselect-dropdown .p-icon {\n font-size: ").concat(dt("cascadeselect.sm.font.size"), ";\n width: ").concat(dt("cascadeselect.sm.font.size"), ";\n height: ").concat(dt("cascadeselect.sm.font.size"), ";\n}\n\n.p-cascadeselect-lg .p-cascadeselect-label {\n font-size: ").concat(dt("cascadeselect.lg.font.size"), ";\n padding-block: ").concat(dt("cascadeselect.lg.padding.y"), ";\n padding-inline: ").concat(dt("cascadeselect.lg.padding.x"), ";\n}\n\n.p-cascadeselect-lg .p-cascadeselect-dropdown .p-icon {\n font-size: ").concat(dt("cascadeselect.lg.font.size"), ";\n width: ").concat(dt("cascadeselect.lg.font.size"), ";\n height: ").concat(dt("cascadeselect.lg.font.size"), ";\n}\n"); -}, "theme"); -var inlineStyles$7 = { - root: /* @__PURE__ */ __name(function root5(_ref2) { - var props = _ref2.props; - return { - position: props.appendTo === "self" ? "relative" : void 0 - }; - }, "root") -}; -var classes$C = { - root: /* @__PURE__ */ __name(function root6(_ref3) { - var instance = _ref3.instance, props = _ref3.props; - return ["p-cascadeselect p-component p-inputwrapper", { - "p-cascadeselect-mobile": instance.queryMatches, - "p-disabled": props.disabled, - "p-invalid": instance.$invalid, - "p-variant-filled": instance.$variant === "filled", - "p-focus": instance.focused, - "p-inputwrapper-filled": instance.$filled, - "p-inputwrapper-focus": instance.focused || instance.overlayVisible, - "p-cascadeselect-open": instance.overlayVisible, - "p-cascadeselect-fluid": instance.$fluid, - "p-cascadeselect-sm p-inputfield-sm": props.size === "small", - "p-cascadeselect-lg p-inputfield-lg": props.size === "large" - }]; - }, "root"), - label: /* @__PURE__ */ __name(function label2(_ref4) { - var instance = _ref4.instance, props = _ref4.props; - return ["p-cascadeselect-label", { - "p-placeholder": instance.label === props.placeholder, - "p-cascadeselect-label-empty": !instance.$slots["value"] && (instance.label === "p-emptylabel" || instance.label.length === 0) - }]; - }, "label"), - clearIcon: "p-cascadeselect-clear-icon", - dropdown: "p-cascadeselect-dropdown", - loadingIcon: "p-cascadeselect-loading-icon", - dropdownIcon: "p-cascadeselect-dropdown-icon", - overlay: /* @__PURE__ */ __name(function overlay(_ref5) { - var instance = _ref5.instance; - return ["p-cascadeselect-overlay p-component", { - "p-cascadeselect-mobile-active": instance.queryMatches - }]; - }, "overlay"), - listContainer: "p-cascadeselect-list-container", - list: "p-cascadeselect-list", - option: /* @__PURE__ */ __name(function option(_ref6) { - var instance = _ref6.instance, processedOption = _ref6.processedOption; - return ["p-cascadeselect-option", { - "p-cascadeselect-option-active": instance.isOptionActive(processedOption), - "p-cascadeselect-option-selected": instance.isOptionSelected(processedOption), - "p-focus": instance.isOptionFocused(processedOption), - "p-disabled": instance.isOptionDisabled(processedOption) - }]; - }, "option"), - optionContent: "p-cascadeselect-option-content", - optionText: "p-cascadeselect-option-text", - groupIconContainer: "p-cascadeselect-group-icon-container", - groupIcon: "p-cascadeselect-group-icon", - optionList: "p-cascadeselect-overlay p-cascadeselect-option-list" -}; -var CascadeSelectStyle = BaseStyle.extend({ - name: "cascadeselect", - theme: theme$y, - classes: classes$C, - inlineStyles: inlineStyles$7 -}); -var script$2$8 = { - name: "BaseCascadeSelect", - "extends": script$1k, - props: { - options: Array, - optionLabel: null, - optionValue: null, - optionDisabled: null, - optionGroupLabel: null, - optionGroupChildren: null, - placeholder: String, - breakpoint: { - type: String, - "default": "960px" - }, - dataKey: null, - showClear: { - type: Boolean, - "default": false - }, - clearIcon: { - type: String, - "default": void 0 - }, - inputId: { - type: String, - "default": null - }, - inputClass: { - type: [String, Object], - "default": null - }, - inputStyle: { - type: Object, - "default": null - }, - inputProps: { - type: null, - "default": null - }, - panelClass: { - type: [String, Object], - "default": null - }, - panelStyle: { - type: Object, - "default": null - }, - panelProps: { - type: null, - "default": null - }, - overlayClass: { - type: [String, Object], - "default": null - }, - overlayStyle: { - type: Object, - "default": null - }, - overlayProps: { - type: null, - "default": null - }, - appendTo: { - type: [String, Object], - "default": "body" - }, - loading: { - type: Boolean, - "default": false - }, - dropdownIcon: { - type: String, - "default": void 0 - }, - loadingIcon: { - type: String, - "default": void 0 - }, - optionGroupIcon: { - type: String, - "default": void 0 - }, - autoOptionFocus: { - type: Boolean, - "default": false - }, - selectOnFocus: { - type: Boolean, - "default": false - }, - focusOnHover: { - type: Boolean, - "default": true - }, - searchLocale: { - type: String, - "default": void 0 - }, - searchMessage: { - type: String, - "default": null - }, - selectionMessage: { - type: String, - "default": null - }, - emptySelectionMessage: { - type: String, - "default": null - }, - emptySearchMessage: { - type: String, - "default": null - }, - emptyMessage: { - type: String, - "default": null - }, - tabindex: { - type: Number, - "default": 0 - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - } - }, - style: CascadeSelectStyle, - provide: /* @__PURE__ */ __name(function provide10() { - return { - $pcCascadeSelect: this, - $parentInstance: this - }; - }, "provide") -}; -var script$1$E = { - name: "CascadeSelectSub", - hostName: "CascadeSelect", - "extends": script$1f, - emits: ["option-change", "option-focus-change", "option-focus-enter-change"], - container: null, - props: { - selectId: String, - focusedOptionId: String, - options: Array, - optionLabel: String, - optionValue: String, - optionDisabled: null, - optionGroupIcon: String, - optionGroupLabel: String, - optionGroupChildren: { - type: [String, Array], - "default": null - }, - activeOptionPath: Array, - level: Number, - templates: null, - value: null - }, - methods: { - getOptionId: /* @__PURE__ */ __name(function getOptionId(processedOption) { - return "".concat(this.selectId, "_").concat(processedOption.key); - }, "getOptionId"), - getOptionLabel: /* @__PURE__ */ __name(function getOptionLabel(processedOption) { - return this.optionLabel ? resolveFieldData(processedOption.option, this.optionLabel) : processedOption.option; - }, "getOptionLabel"), - getOptionValue: /* @__PURE__ */ __name(function getOptionValue(processedOption) { - return this.optionValue ? resolveFieldData(processedOption.option, this.optionValue) : processedOption.option; - }, "getOptionValue"), - getPTOptions: /* @__PURE__ */ __name(function getPTOptions(processedOption, index, key) { - return this.ptm(key, { - context: { - option: processedOption, - index, - level: this.level, - optionGroup: this.isOptionGroup(processedOption), - active: this.isOptionActive(processedOption), - focused: this.isOptionFocused(processedOption), - disabled: this.isOptionDisabled(processedOption) - } - }); - }, "getPTOptions"), - isOptionDisabled: /* @__PURE__ */ __name(function isOptionDisabled(processedOption) { - return this.optionDisabled ? resolveFieldData(processedOption.option, this.optionDisabled) : false; - }, "isOptionDisabled"), - getOptionGroupLabel: /* @__PURE__ */ __name(function getOptionGroupLabel(processedOption) { - return this.optionGroupLabel ? resolveFieldData(processedOption.option, this.optionGroupLabel) : null; - }, "getOptionGroupLabel"), - getOptionGroupChildren: /* @__PURE__ */ __name(function getOptionGroupChildren(processedOption) { - return processedOption.children; - }, "getOptionGroupChildren"), - isOptionGroup: /* @__PURE__ */ __name(function isOptionGroup(processedOption) { - return isNotEmpty(processedOption.children); - }, "isOptionGroup"), - isOptionSelected: /* @__PURE__ */ __name(function isOptionSelected(processedOption) { - return equals(this.value, processedOption === null || processedOption === void 0 ? void 0 : processedOption.option); - }, "isOptionSelected"), - isOptionActive: /* @__PURE__ */ __name(function isOptionActive(processedOption) { - return this.activeOptionPath.some(function(path) { - return path.key === processedOption.key; - }); - }, "isOptionActive"), - isOptionFocused: /* @__PURE__ */ __name(function isOptionFocused(processedOption) { - return this.focusedOptionId === this.getOptionId(processedOption); - }, "isOptionFocused"), - getOptionLabelToRender: /* @__PURE__ */ __name(function getOptionLabelToRender(processedOption) { - return this.isOptionGroup(processedOption) ? this.getOptionGroupLabel(processedOption) : this.getOptionLabel(processedOption); - }, "getOptionLabelToRender"), - onOptionClick: /* @__PURE__ */ __name(function onOptionClick(event2, processedOption) { - this.$emit("option-change", { - originalEvent: event2, - processedOption, - isFocus: true - }); - }, "onOptionClick"), - onOptionMouseEnter: /* @__PURE__ */ __name(function onOptionMouseEnter(event2, processedOption) { - this.$emit("option-focus-enter-change", { - originalEvent: event2, - processedOption - }); - }, "onOptionMouseEnter"), - onOptionMouseMove: /* @__PURE__ */ __name(function onOptionMouseMove(event2, processedOption) { - this.$emit("option-focus-change", { - originalEvent: event2, - processedOption - }); - }, "onOptionMouseMove"), - containerRef: /* @__PURE__ */ __name(function containerRef(el) { - this.container = el; - }, "containerRef"), - listAriaLabel: /* @__PURE__ */ __name(function listAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.listLabel : void 0; - }, "listAriaLabel") - }, - directives: { - ripple: Ripple - }, - components: { - AngleRightIcon: script$1o - } -}; -var _hoisted_1$1$6 = ["id", "aria-label", "aria-selected", "aria-expanded", "aria-level", "aria-setsize", "aria-posinset", "data-p-option-group", "data-p-active", "data-p-focus", "data-p-disabled"]; -var _hoisted_2$k = ["onClick", "onMouseenter", "onMousemove"]; -function render$1$8(_ctx, _cache, $props, $setup, $data, $options) { - var _component_AngleRightIcon = resolveComponent("AngleRightIcon"); - var _component_CascadeSelectSub = resolveComponent("CascadeSelectSub", true); - var _directive_ripple = resolveDirective("ripple"); - return openBlock(), createElementBlock("ul", mergeProps({ - ref: $options.containerRef, - "class": _ctx.cx("list") - }, $props.level === 0 ? _ctx.ptm("list") : _ctx.ptm("optionList")), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.options, function(processedOption, index) { - return openBlock(), createElementBlock("li", mergeProps({ - key: $options.getOptionLabelToRender(processedOption), - id: $options.getOptionId(processedOption), - "class": _ctx.cx("option", { - processedOption - }), - role: "treeitem", - "aria-label": $options.getOptionLabelToRender(processedOption), - "aria-selected": $options.isOptionGroup(processedOption) ? void 0 : $options.isOptionSelected(processedOption), - "aria-expanded": $options.isOptionGroup(processedOption) ? $options.isOptionActive(processedOption) : void 0, - "aria-level": $props.level + 1, - "aria-setsize": $props.options.length, - "aria-posinset": index + 1, - ref_for: true - }, $options.getPTOptions(processedOption, index, "option"), { - "data-p-option-group": $options.isOptionGroup(processedOption), - "data-p-active": $options.isOptionActive(processedOption), - "data-p-focus": $options.isOptionFocused(processedOption), - "data-p-disabled": $options.isOptionDisabled(processedOption) - }), [withDirectives((openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("optionContent"), - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return $options.onOptionClick($event, processedOption); - }, "onClick"), - onMouseenter: /* @__PURE__ */ __name(function onMouseenter($event) { - return $options.onOptionMouseEnter($event, processedOption); - }, "onMouseenter"), - onMousemove: /* @__PURE__ */ __name(function onMousemove($event) { - return $options.onOptionMouseMove($event, processedOption); - }, "onMousemove"), - ref_for: true - }, $options.getPTOptions(processedOption, index, "optionContent")), [$props.templates["option"] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates["option"]), { - key: 0, - option: processedOption.option, - selected: $options.isOptionGroup(processedOption) ? false : $options.isOptionSelected(processedOption) - }, null, 8, ["option", "selected"])) : (openBlock(), createElementBlock("span", mergeProps({ - key: 1, - "class": _ctx.cx("optionText"), - ref_for: true - }, $options.getPTOptions(processedOption, index, "optionText")), toDisplayString($options.getOptionLabelToRender(processedOption)), 17)), $options.isOptionGroup(processedOption) ? (openBlock(), createElementBlock("span", { - key: 2, - "class": normalizeClass(_ctx.cx("groupIconContainer")) - }, [$props.templates["optiongroupicon"] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates["optiongroupicon"]), { - key: 0, - "class": normalizeClass(_ctx.cx("groupIcon")) - }, null, 8, ["class"])) : $props.optionGroupIcon ? (openBlock(), createElementBlock("span", mergeProps({ - key: 1, - "class": [_ctx.cx("groupIcon"), $props.optionGroupIcon], - "aria-hidden": "true", - ref_for: true - }, $options.getPTOptions(processedOption, index, "groupIcon")), null, 16)) : (openBlock(), createBlock(_component_AngleRightIcon, mergeProps({ - key: 2, - "class": _ctx.cx("groupIcon"), - "aria-hidden": "true", - ref_for: true - }, $options.getPTOptions(processedOption, index, "groupIcon")), null, 16, ["class"]))], 2)) : createCommentVNode("", true)], 16, _hoisted_2$k)), [[_directive_ripple]]), $options.isOptionGroup(processedOption) && $options.isOptionActive(processedOption) ? (openBlock(), createBlock(_component_CascadeSelectSub, { - key: 0, - role: "group", - "class": normalizeClass(_ctx.cx("optionList")), - selectId: $props.selectId, - focusedOptionId: $props.focusedOptionId, - options: $options.getOptionGroupChildren(processedOption), - activeOptionPath: $props.activeOptionPath, - level: $props.level + 1, - templates: $props.templates, - optionLabel: $props.optionLabel, - optionValue: $props.optionValue, - optionDisabled: $props.optionDisabled, - optionGroupIcon: $props.optionGroupIcon, - optionGroupLabel: $props.optionGroupLabel, - optionGroupChildren: $props.optionGroupChildren, - value: $props.value, - onOptionChange: _cache[0] || (_cache[0] = function($event) { - return _ctx.$emit("option-change", $event); - }), - onOptionFocusChange: _cache[1] || (_cache[1] = function($event) { - return _ctx.$emit("option-focus-change", $event); - }), - onOptionFocusEnterChange: _cache[2] || (_cache[2] = function($event) { - return _ctx.$emit("option-focus-enter-change", $event); - }), - pt: _ctx.pt, - unstyled: _ctx.unstyled - }, null, 8, ["class", "selectId", "focusedOptionId", "options", "activeOptionPath", "level", "templates", "optionLabel", "optionValue", "optionDisabled", "optionGroupIcon", "optionGroupLabel", "optionGroupChildren", "value", "pt", "unstyled"])) : createCommentVNode("", true)], 16, _hoisted_1$1$6); - }), 128))], 16); -} -__name(render$1$8, "render$1$8"); -script$1$E.render = render$1$8; -function _typeof$1$3(o) { - "@babel/helpers - typeof"; - return _typeof$1$3 = "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$1$3(o); -} -__name(_typeof$1$3, "_typeof$1$3"); -function ownKeys$1$2(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$1$2, "ownKeys$1$2"); -function _objectSpread$1$2(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$1$2(Object(t2), true).forEach(function(r2) { - _defineProperty$1$3(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$1$2(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$1$2, "_objectSpread$1$2"); -function _defineProperty$1$3(e, r, t2) { - return (r = _toPropertyKey$1$3(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$1$3, "_defineProperty$1$3"); -function _toPropertyKey$1$3(t2) { - var i = _toPrimitive$1$3(t2, "string"); - return "symbol" == _typeof$1$3(i) ? i : i + ""; -} -__name(_toPropertyKey$1$3, "_toPropertyKey$1$3"); -function _toPrimitive$1$3(t2, r) { - if ("object" != _typeof$1$3(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$1$3(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$1$3, "_toPrimitive$1$3"); -var script$10 = { - name: "CascadeSelect", - "extends": script$2$8, - inheritAttrs: false, - emits: ["change", "focus", "blur", "click", "group-change", "before-show", "before-hide", "hide", "show"], - outsideClickListener: null, - matchMediaListener: null, - scrollHandler: null, - resizeListener: null, - overlay: null, - searchTimeout: null, - searchValue: null, - data: /* @__PURE__ */ __name(function data3() { - return { - id: this.$attrs.id, - clicked: false, - focused: false, - focusedOptionInfo: { - index: -1, - level: 0, - parentKey: "" - }, - activeOptionPath: [], - overlayVisible: false, - dirty: false, - mobileActive: false, - query: null, - queryMatches: false - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId2(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId"), - options: /* @__PURE__ */ __name(function options() { - this.autoUpdateModel(); - }, "options") - }, - mounted: /* @__PURE__ */ __name(function mounted7() { - this.id = this.id || UniqueComponentId(); - this.autoUpdateModel(); - this.bindMatchMediaListener(); - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount2() { - this.unbindOutsideClickListener(); - this.unbindResizeListener(); - this.unbindMatchMediaListener(); - if (this.scrollHandler) { - this.scrollHandler.destroy(); - this.scrollHandler = null; - } - if (this.overlay) { - ZIndex.clear(this.overlay); - this.overlay = null; - } - if (this.mobileActive) { - this.mobileActive = false; - } - }, "beforeUnmount"), - methods: { - getOptionLabel: /* @__PURE__ */ __name(function getOptionLabel2(option4) { - return this.optionLabel ? resolveFieldData(option4, this.optionLabel) : option4; - }, "getOptionLabel"), - getOptionValue: /* @__PURE__ */ __name(function getOptionValue2(option4) { - return this.optionValue ? resolveFieldData(option4, this.optionValue) : option4; - }, "getOptionValue"), - isOptionDisabled: /* @__PURE__ */ __name(function isOptionDisabled2(option4) { - return this.optionDisabled ? resolveFieldData(option4, this.optionDisabled) : false; - }, "isOptionDisabled"), - getOptionGroupLabel: /* @__PURE__ */ __name(function getOptionGroupLabel2(optionGroup) { - return this.optionGroupLabel ? resolveFieldData(optionGroup, this.optionGroupLabel) : null; - }, "getOptionGroupLabel"), - getOptionGroupChildren: /* @__PURE__ */ __name(function getOptionGroupChildren2(optionGroup, level) { - return isString(this.optionGroupChildren) ? resolveFieldData(optionGroup, this.optionGroupChildren) : resolveFieldData(optionGroup, this.optionGroupChildren[level]); - }, "getOptionGroupChildren"), - isOptionGroup: /* @__PURE__ */ __name(function isOptionGroup2(option4, level) { - return Object.prototype.hasOwnProperty.call(option4, this.optionGroupChildren[level]); - }, "isOptionGroup"), - getProccessedOptionLabel: /* @__PURE__ */ __name(function getProccessedOptionLabel() { - var processedOption = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; - var grouped = this.isProccessedOptionGroup(processedOption); - return grouped ? this.getOptionGroupLabel(processedOption.option, processedOption.level) : this.getOptionLabel(processedOption.option); - }, "getProccessedOptionLabel"), - isProccessedOptionGroup: /* @__PURE__ */ __name(function isProccessedOptionGroup(processedOption) { - return isNotEmpty(processedOption === null || processedOption === void 0 ? void 0 : processedOption.children); - }, "isProccessedOptionGroup"), - show: /* @__PURE__ */ __name(function show(isFocus) { - this.$emit("before-show"); - this.overlayVisible = true; - this.activeOptionPath = this.$filled ? this.findOptionPathByValue(this.d_value) : this.activeOptionPath; - if (this.$filled && isNotEmpty(this.activeOptionPath)) { - var processedOption = this.activeOptionPath[this.activeOptionPath.length - 1]; - this.focusedOptionInfo = { - index: processedOption.index, - level: processedOption.level, - parentKey: processedOption.parentKey - }; - } else { - this.focusedOptionInfo = { - index: this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : this.findSelectedOptionIndex(), - level: 0, - parentKey: "" - }; - } - isFocus && focus(this.$refs.focusInput); - }, "show"), - hide: /* @__PURE__ */ __name(function hide(isFocus) { - var _this = this; - var _hide = /* @__PURE__ */ __name(function _hide2() { - _this.$emit("before-hide"); - _this.overlayVisible = false; - _this.clicked = false; - _this.activeOptionPath = []; - _this.focusedOptionInfo = { - index: -1, - level: 0, - parentKey: "" - }; - isFocus && focus(_this.$refs.focusInput); - }, "_hide"); - setTimeout(function() { - _hide(); - }, 0); - }, "hide"), - onFocus: /* @__PURE__ */ __name(function onFocus3(event2) { - if (this.disabled) { - return; - } - this.focused = true; - this.$emit("focus", event2); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur2(event2) { - var _this$formField$onBlu, _this$formField; - this.focused = false; - this.focusedOptionInfo = { - index: -1, - level: 0, - parentKey: "" - }; - this.searchValue = ""; - this.$emit("blur", event2); - (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField); - }, "onBlur"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown2(event2) { - if (this.disabled || this.loading) { - event2.preventDefault(); - return; - } - var metaKey = event2.metaKey || event2.ctrlKey; - switch (event2.code) { - case "ArrowDown": - this.onArrowDownKey(event2); - break; - case "ArrowUp": - this.onArrowUpKey(event2); - break; - case "ArrowLeft": - this.onArrowLeftKey(event2); - break; - case "ArrowRight": - this.onArrowRightKey(event2); - break; - case "Home": - this.onHomeKey(event2); - break; - case "End": - this.onEndKey(event2); - break; - case "Space": - this.onSpaceKey(event2); - break; - case "Enter": - case "NumpadEnter": - this.onEnterKey(event2); - break; - case "Escape": - this.onEscapeKey(event2); - break; - case "Tab": - this.onTabKey(event2); - break; - case "PageDown": - case "PageUp": - case "Backspace": - case "ShiftLeft": - case "ShiftRight": - break; - default: - if (!metaKey && isPrintableCharacter(event2.key)) { - !this.overlayVisible && this.show(); - this.searchOptions(event2, event2.key); - } - break; - } - this.clicked = false; - }, "onKeyDown"), - onOptionChange: /* @__PURE__ */ __name(function onOptionChange(event2) { - var processedOption = event2.processedOption, type = event2.type; - if (isEmpty(processedOption)) return; - var index = processedOption.index, key = processedOption.key, level = processedOption.level, parentKey = processedOption.parentKey, children = processedOption.children; - var grouped = isNotEmpty(children); - var activeOptionPath = this.activeOptionPath.filter(function(p) { - return p.parentKey !== parentKey && p.parentKey !== key; - }); - this.focusedOptionInfo = { - index, - level, - parentKey - }; - if (type == "hover" && this.queryMatches) { - return; - } - if (grouped) { - activeOptionPath.push(processedOption); - } - this.activeOptionPath = activeOptionPath; - }, "onOptionChange"), - onOptionClick: /* @__PURE__ */ __name(function onOptionClick2(event2) { - var originalEvent = event2.originalEvent, processedOption = event2.processedOption, isFocus = event2.isFocus, isHide = event2.isHide, preventSelection = event2.preventSelection; - var index = processedOption.index, key = processedOption.key, level = processedOption.level, parentKey = processedOption.parentKey; - var grouped = this.isProccessedOptionGroup(processedOption); - var selected3 = this.isSelected(processedOption); - if (selected3) { - this.activeOptionPath = this.activeOptionPath.filter(function(p) { - return key !== p.key && key.startsWith(p.key); - }); - this.focusedOptionInfo = { - index, - level, - parentKey - }; - } else { - if (grouped) { - this.onOptionChange(event2); - this.onOptionGroupSelect(originalEvent, processedOption); - } else { - var activeOptionPath = this.activeOptionPath.filter(function(p) { - return p.parentKey !== parentKey; - }); - activeOptionPath.push(processedOption); - this.focusedOptionInfo = { - index, - level, - parentKey - }; - if (!preventSelection || (processedOption === null || processedOption === void 0 ? void 0 : processedOption.children.length) !== 0) { - this.activeOptionPath = activeOptionPath; - this.onOptionSelect(originalEvent, processedOption, isHide); - } - } - } - isFocus && focus(this.$refs.focusInput); - }, "onOptionClick"), - onOptionMouseEnter: /* @__PURE__ */ __name(function onOptionMouseEnter2(event2) { - if (this.focusOnHover) { - if (this.dirty || !this.dirty && isNotEmpty(this.d_value)) { - this.onOptionChange(_objectSpread$1$2(_objectSpread$1$2({}, event2), {}, { - type: "hover" - })); - } else if (!this.dirty && event2.processedOption.level === 0) { - this.onOptionClick(_objectSpread$1$2(_objectSpread$1$2({}, event2), {}, { - type: "hover" - })); - } - } - }, "onOptionMouseEnter"), - onOptionMouseMove: /* @__PURE__ */ __name(function onOptionMouseMove2(event2) { - if (this.focused && this.focusOnHover) { - this.changeFocusedOptionIndex(event2, event2.processedOption.index); - } - }, "onOptionMouseMove"), - onOptionSelect: /* @__PURE__ */ __name(function onOptionSelect(event2, processedOption) { - var isHide = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true; - var value2 = this.getOptionValue(processedOption === null || processedOption === void 0 ? void 0 : processedOption.option); - this.activeOptionPath.forEach(function(p) { - return p.selected = true; - }); - this.updateModel(event2, value2); - isHide && this.hide(true); - }, "onOptionSelect"), - onOptionGroupSelect: /* @__PURE__ */ __name(function onOptionGroupSelect(event2, processedOption) { - this.dirty = true; - this.$emit("group-change", { - originalEvent: event2, - value: processedOption.option - }); - }, "onOptionGroupSelect"), - onContainerClick: /* @__PURE__ */ __name(function onContainerClick(event2) { - if (this.disabled || this.loading) { - return; - } - if (event2.target.getAttribute("data-pc-section") === "clearicon" || event2.target.closest('[data-pc-section="clearicon"]')) { - return; - } else if (!this.overlay || !this.overlay.contains(event2.target)) { - this.overlayVisible ? this.hide() : this.show(); - focus(this.$refs.focusInput); - } - this.clicked = true; - this.$emit("click", event2); - }, "onContainerClick"), - onClearClick: /* @__PURE__ */ __name(function onClearClick(event2) { - this.updateModel(event2, null); - }, "onClearClick"), - onOverlayClick: /* @__PURE__ */ __name(function onOverlayClick2(event2) { - OverlayEventBus.emit("overlay-click", { - originalEvent: event2, - target: this.$el - }); - }, "onOverlayClick"), - onOverlayKeyDown: /* @__PURE__ */ __name(function onOverlayKeyDown2(event2) { - switch (event2.code) { - case "Escape": - this.onEscapeKey(event2); - break; - } - }, "onOverlayKeyDown"), - onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey2(event2) { - if (!this.overlayVisible) { - this.show(); - } else { - var optionIndex = this.focusedOptionInfo.index !== -1 ? this.findNextOptionIndex(this.focusedOptionInfo.index) : this.clicked ? this.findFirstOptionIndex() : this.findFirstFocusedOptionIndex(); - this.changeFocusedOptionIndex(event2, optionIndex, true); - } - event2.preventDefault(); - }, "onArrowDownKey"), - onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey2(event2) { - if (event2.altKey) { - if (this.focusedOptionInfo.index !== -1) { - var processedOption = this.visibleOptions[this.focusedOptionInfo.index]; - var grouped = this.isProccessedOptionGroup(processedOption); - !grouped && this.onOptionChange({ - originalEvent: event2, - processedOption - }); - } - this.overlayVisible && this.hide(); - event2.preventDefault(); - } else { - var optionIndex = this.focusedOptionInfo.index !== -1 ? this.findPrevOptionIndex(this.focusedOptionInfo.index) : this.clicked ? this.findLastOptionIndex() : this.findLastFocusedOptionIndex(); - this.changeFocusedOptionIndex(event2, optionIndex, true); - !this.overlayVisible && this.show(); - event2.preventDefault(); - } - }, "onArrowUpKey"), - onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey(event2) { - var _this2 = this; - if (this.overlayVisible) { - var processedOption = this.visibleOptions[this.focusedOptionInfo.index]; - var parentOption = this.activeOptionPath.find(function(p) { - return p.key === (processedOption === null || processedOption === void 0 ? void 0 : processedOption.parentKey); - }); - var matched = this.focusedOptionInfo.parentKey === "" || parentOption && parentOption.key === this.focusedOptionInfo.parentKey; - var root34 = isEmpty(processedOption === null || processedOption === void 0 ? void 0 : processedOption.parent); - if (matched) { - this.activeOptionPath = this.activeOptionPath.filter(function(p) { - return p.parentKey !== _this2.focusedOptionInfo.parentKey; - }); - } - if (!root34) { - this.focusedOptionInfo = { - index: -1, - parentKey: parentOption ? parentOption.parentKey : "" - }; - this.searchValue = ""; - this.onArrowDownKey(event2); - } - event2.preventDefault(); - } - }, "onArrowLeftKey"), - onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey(event2) { - if (this.overlayVisible) { - var processedOption = this.visibleOptions[this.focusedOptionInfo.index]; - var grouped = this.isProccessedOptionGroup(processedOption); - if (grouped) { - var matched = this.activeOptionPath.some(function(p) { - return (processedOption === null || processedOption === void 0 ? void 0 : processedOption.key) === p.key; - }); - if (matched) { - this.focusedOptionInfo = { - index: -1, - parentKey: processedOption === null || processedOption === void 0 ? void 0 : processedOption.key - }; - this.searchValue = ""; - this.onArrowDownKey(event2); - } else { - this.onOptionChange({ - originalEvent: event2, - processedOption - }); - } - } - event2.preventDefault(); - } - }, "onArrowRightKey"), - onHomeKey: /* @__PURE__ */ __name(function onHomeKey2(event2) { - this.changeFocusedOptionIndex(event2, this.findFirstOptionIndex()); - !this.overlayVisible && this.show(); - event2.preventDefault(); - }, "onHomeKey"), - onEndKey: /* @__PURE__ */ __name(function onEndKey2(event2) { - this.changeFocusedOptionIndex(event2, this.findLastOptionIndex()); - !this.overlayVisible && this.show(); - event2.preventDefault(); - }, "onEndKey"), - onEnterKey: /* @__PURE__ */ __name(function onEnterKey2(event2) { - if (!this.overlayVisible) { - this.focusedOptionInfo.index !== -1; - this.onArrowDownKey(event2); - } else { - if (this.focusedOptionInfo.index !== -1) { - var processedOption = this.visibleOptions[this.focusedOptionInfo.index]; - var grouped = this.isProccessedOptionGroup(processedOption); - this.onOptionClick({ - originalEvent: event2, - processedOption, - preventSelection: false - }); - !grouped && this.hide(); - } - } - event2.preventDefault(); - }, "onEnterKey"), - onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey(event2) { - this.onEnterKey(event2); - }, "onSpaceKey"), - onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey(event2) { - this.overlayVisible && this.hide(true); - event2.preventDefault(); - }, "onEscapeKey"), - onTabKey: /* @__PURE__ */ __name(function onTabKey(event2) { - if (this.focusedOptionInfo.index !== -1) { - var processedOption = this.visibleOptions[this.focusedOptionInfo.index]; - var grouped = this.isProccessedOptionGroup(processedOption); - !grouped && this.onOptionChange({ - originalEvent: event2, - processedOption - }); - } - this.overlayVisible && this.hide(); - }, "onTabKey"), - onOverlayEnter: /* @__PURE__ */ __name(function onOverlayEnter2(el) { - ZIndex.set("overlay", el, this.$primevue.config.zIndex.overlay); - addStyle(el, { - position: "absolute", - top: "0", - left: "0" - }); - this.alignOverlay(); - this.scrollInView(); - }, "onOverlayEnter"), - onOverlayAfterEnter: /* @__PURE__ */ __name(function onOverlayAfterEnter() { - this.bindOutsideClickListener(); - this.bindScrollListener(); - this.bindResizeListener(); - this.$emit("show"); - }, "onOverlayAfterEnter"), - onOverlayLeave: /* @__PURE__ */ __name(function onOverlayLeave2() { - this.unbindOutsideClickListener(); - this.unbindScrollListener(); - this.unbindResizeListener(); - this.$emit("hide"); - this.overlay = null; - this.dirty = false; - }, "onOverlayLeave"), - onOverlayAfterLeave: /* @__PURE__ */ __name(function onOverlayAfterLeave2(el) { - ZIndex.clear(el); - }, "onOverlayAfterLeave"), - alignOverlay: /* @__PURE__ */ __name(function alignOverlay2() { - if (this.appendTo === "self") { - relativePosition(this.overlay, this.$el); - } else { - this.overlay.style.minWidth = getOuterWidth(this.$el) + "px"; - absolutePosition(this.overlay, this.$el); - } - }, "alignOverlay"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener2() { - var _this3 = this; - if (!this.outsideClickListener) { - this.outsideClickListener = function(event2) { - if (_this3.overlayVisible && _this3.overlay && !_this3.$el.contains(event2.target) && !_this3.overlay.contains(event2.target)) { - _this3.hide(); - } - }; - document.addEventListener("click", this.outsideClickListener); - } - }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener2() { - if (this.outsideClickListener) { - document.removeEventListener("click", this.outsideClickListener); - this.outsideClickListener = null; - } - }, "unbindOutsideClickListener"), - bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener2() { - var _this4 = this; - if (!this.scrollHandler) { - this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, function() { - if (_this4.overlayVisible) { - _this4.hide(); - } - }); - } - this.scrollHandler.bindScrollListener(); - }, "bindScrollListener"), - unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener2() { - if (this.scrollHandler) { - this.scrollHandler.unbindScrollListener(); - } - }, "unbindScrollListener"), - bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener2() { - var _this5 = this; - if (!this.resizeListener) { - this.resizeListener = function() { - if (_this5.overlayVisible && !isTouchDevice()) { - _this5.hide(); - } - }; - 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 bindMatchMediaListener2() { - var _this6 = this; - if (!this.matchMediaListener) { - var query = matchMedia("(max-width: ".concat(this.breakpoint, ")")); - this.query = query; - this.queryMatches = query.matches; - this.matchMediaListener = function() { - _this6.queryMatches = query.matches; - _this6.mobileActive = false; - }; - this.query.addEventListener("change", this.matchMediaListener); - } - }, "bindMatchMediaListener"), - unbindMatchMediaListener: /* @__PURE__ */ __name(function unbindMatchMediaListener2() { - if (this.matchMediaListener) { - this.query.removeEventListener("change", this.matchMediaListener); - this.matchMediaListener = null; - } - }, "unbindMatchMediaListener"), - isOptionMatched: /* @__PURE__ */ __name(function isOptionMatched(processedOption) { - var _this$getProccessedOp; - return this.isValidOption(processedOption) && ((_this$getProccessedOp = this.getProccessedOptionLabel(processedOption)) === null || _this$getProccessedOp === void 0 ? void 0 : _this$getProccessedOp.toLocaleLowerCase(this.searchLocale).startsWith(this.searchValue.toLocaleLowerCase(this.searchLocale))); - }, "isOptionMatched"), - isValidOption: /* @__PURE__ */ __name(function isValidOption(processedOption) { - return isNotEmpty(processedOption) && !this.isOptionDisabled(processedOption.option); - }, "isValidOption"), - isValidSelectedOption: /* @__PURE__ */ __name(function isValidSelectedOption(processedOption) { - return this.isValidOption(processedOption) && this.isSelected(processedOption); - }, "isValidSelectedOption"), - isSelected: /* @__PURE__ */ __name(function isSelected2(processedOption) { - return this.activeOptionPath.some(function(p) { - return p.key === processedOption.key; - }); - }, "isSelected"), - findFirstOptionIndex: /* @__PURE__ */ __name(function findFirstOptionIndex() { - var _this7 = this; - return this.visibleOptions.findIndex(function(processedOption) { - return _this7.isValidOption(processedOption); - }); - }, "findFirstOptionIndex"), - findLastOptionIndex: /* @__PURE__ */ __name(function findLastOptionIndex() { - var _this8 = this; - return findLastIndex(this.visibleOptions, function(processedOption) { - return _this8.isValidOption(processedOption); - }); - }, "findLastOptionIndex"), - findNextOptionIndex: /* @__PURE__ */ __name(function findNextOptionIndex(index) { - var _this9 = this; - var matchedOptionIndex = index < this.visibleOptions.length - 1 ? this.visibleOptions.slice(index + 1).findIndex(function(processedOption) { - return _this9.isValidOption(processedOption); - }) : -1; - return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index; - }, "findNextOptionIndex"), - findPrevOptionIndex: /* @__PURE__ */ __name(function findPrevOptionIndex(index) { - var _this10 = this; - var matchedOptionIndex = index > 0 ? findLastIndex(this.visibleOptions.slice(0, index), function(processedOption) { - return _this10.isValidOption(processedOption); - }) : -1; - return matchedOptionIndex > -1 ? matchedOptionIndex : index; - }, "findPrevOptionIndex"), - findSelectedOptionIndex: /* @__PURE__ */ __name(function findSelectedOptionIndex() { - var _this11 = this; - return this.visibleOptions.findIndex(function(processedOption) { - return _this11.isValidSelectedOption(processedOption); - }); - }, "findSelectedOptionIndex"), - findFirstFocusedOptionIndex: /* @__PURE__ */ __name(function findFirstFocusedOptionIndex() { - var selectedIndex = this.findSelectedOptionIndex(); - return selectedIndex < 0 ? this.findFirstOptionIndex() : selectedIndex; - }, "findFirstFocusedOptionIndex"), - findLastFocusedOptionIndex: /* @__PURE__ */ __name(function findLastFocusedOptionIndex() { - var selectedIndex = this.findSelectedOptionIndex(); - return selectedIndex < 0 ? this.findLastOptionIndex() : selectedIndex; - }, "findLastFocusedOptionIndex"), - findOptionPathByValue: /* @__PURE__ */ __name(function findOptionPathByValue(value2, processedOptions2) { - var level = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; - processedOptions2 = processedOptions2 || level === 0 && this.processedOptions; - if (!processedOptions2) return null; - if (isEmpty(value2)) return []; - for (var i = 0; i < processedOptions2.length; i++) { - var processedOption = processedOptions2[i]; - if (equals(value2, this.getOptionValue(processedOption.option), this.equalityKey)) { - return [processedOption]; - } - var matchedOptions = this.findOptionPathByValue(value2, processedOption.children, level + 1); - if (matchedOptions) { - matchedOptions.unshift(processedOption); - return matchedOptions; - } - } - }, "findOptionPathByValue"), - searchOptions: /* @__PURE__ */ __name(function searchOptions(event2, _char) { - var _this12 = this; - this.searchValue = (this.searchValue || "") + _char; - var optionIndex = -1; - var matched = false; - if (isNotEmpty(this.searchValue)) { - if (this.focusedOptionInfo.index !== -1) { - optionIndex = this.visibleOptions.slice(this.focusedOptionInfo.index).findIndex(function(processedOption) { - return _this12.isOptionMatched(processedOption); - }); - optionIndex = optionIndex === -1 ? this.visibleOptions.slice(0, this.focusedOptionInfo.index).findIndex(function(processedOption) { - return _this12.isOptionMatched(processedOption); - }) : optionIndex + this.focusedOptionInfo.index; - } else { - optionIndex = this.visibleOptions.findIndex(function(processedOption) { - return _this12.isOptionMatched(processedOption); - }); - } - if (optionIndex !== -1) { - matched = true; - } - if (optionIndex === -1 && this.focusedOptionInfo.index === -1) { - optionIndex = this.findFirstFocusedOptionIndex(); - } - if (optionIndex !== -1) { - this.changeFocusedOptionIndex(event2, optionIndex); - } - } - if (this.searchTimeout) { - clearTimeout(this.searchTimeout); - } - this.searchTimeout = setTimeout(function() { - _this12.searchValue = ""; - _this12.searchTimeout = null; - }, 500); - return matched; - }, "searchOptions"), - changeFocusedOptionIndex: /* @__PURE__ */ __name(function changeFocusedOptionIndex(event2, index, preventSelection) { - if (this.focusedOptionInfo.index !== index) { - this.focusedOptionInfo.index = index; - this.scrollInView(); - if (this.focusOnHover) { - this.onOptionClick({ - originalEvent: event2, - processedOption: this.visibleOptions[index], - isHide: false, - preventSelection - }); - } - if (this.selectOnFocus) { - this.onOptionChange({ - originalEvent: event2, - processedOption: this.visibleOptions[index], - isHide: false - }); - } - } - }, "changeFocusedOptionIndex"), - scrollInView: /* @__PURE__ */ __name(function scrollInView2() { - var _this13 = this; - var index = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : -1; - this.$nextTick(function() { - var id4 = index !== -1 ? "".concat(_this13.id, "_").concat(index) : _this13.focusedOptionId; - var element = findSingle(_this13.list, 'li[id="'.concat(id4, '"]')); - if (element) { - element.scrollIntoView && element.scrollIntoView({ - block: "nearest", - inline: "start" - }); - } - }); - }, "scrollInView"), - autoUpdateModel: /* @__PURE__ */ __name(function autoUpdateModel() { - if (this.selectOnFocus && this.autoOptionFocus && !this.$filled) { - this.focusedOptionInfo.index = this.findFirstFocusedOptionIndex(); - this.onOptionChange({ - processedOption: this.visibleOptions[this.focusedOptionInfo.index], - isHide: false - }); - !this.overlayVisible && (this.focusedOptionInfo = { - index: -1, - level: 0, - parentKey: "" - }); - } - }, "autoUpdateModel"), - updateModel: /* @__PURE__ */ __name(function updateModel2(event2, value2) { - this.writeValue(value2, event2); - this.$emit("change", { - originalEvent: event2, - value: value2 - }); - }, "updateModel"), - createProcessedOptions: /* @__PURE__ */ __name(function createProcessedOptions(options4) { - 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 processedOptions2 = []; - options4 && options4.forEach(function(option4, index) { - var key = (parentKey !== "" ? parentKey + "_" : "") + index; - var newOption = { - option: option4, - index, - level, - key, - parent, - parentKey - }; - newOption["children"] = _this14.createProcessedOptions(_this14.getOptionGroupChildren(option4, level), level + 1, newOption, key); - processedOptions2.push(newOption); - }); - return processedOptions2; - }, "createProcessedOptions"), - overlayRef: /* @__PURE__ */ __name(function overlayRef2(el) { - this.overlay = el; - }, "overlayRef") - }, - computed: { - // @deprecated use $filled instead. - hasSelectedOption: /* @__PURE__ */ __name(function hasSelectedOption() { - return this.$filled; - }, "hasSelectedOption"), - label: /* @__PURE__ */ __name(function label3() { - var label12 = this.placeholder || "p-emptylabel"; - if (this.$filled) { - var activeOptionPath = this.findOptionPathByValue(this.d_value); - var processedOption = isNotEmpty(activeOptionPath) ? activeOptionPath[activeOptionPath.length - 1] : null; - return processedOption ? this.getOptionLabel(processedOption.option) : label12; - } - return label12; - }, "label"), - processedOptions: /* @__PURE__ */ __name(function processedOptions() { - return this.createProcessedOptions(this.options || []); - }, "processedOptions"), - visibleOptions: /* @__PURE__ */ __name(function visibleOptions() { - var _this15 = this; - var processedOption = this.activeOptionPath.find(function(p) { - return p.key === _this15.focusedOptionInfo.parentKey; - }); - return processedOption ? processedOption.children : this.processedOptions; - }, "visibleOptions"), - equalityKey: /* @__PURE__ */ __name(function equalityKey() { - return this.optionValue ? null : this.dataKey; - }, "equalityKey"), - searchResultMessageText: /* @__PURE__ */ __name(function searchResultMessageText() { - return isNotEmpty(this.visibleOptions) ? this.searchMessageText.replaceAll("{0}", this.visibleOptions.length) : this.emptySearchMessageText; - }, "searchResultMessageText"), - searchMessageText: /* @__PURE__ */ __name(function searchMessageText() { - return this.searchMessage || this.$primevue.config.locale.searchMessage || ""; - }, "searchMessageText"), - emptySearchMessageText: /* @__PURE__ */ __name(function emptySearchMessageText() { - return this.emptySearchMessage || this.$primevue.config.locale.emptySearchMessage || ""; - }, "emptySearchMessageText"), - emptyMessageText: /* @__PURE__ */ __name(function emptyMessageText() { - return this.emptyMessage || this.$primevue.config.locale.emptyMessage || ""; - }, "emptyMessageText"), - selectionMessageText: /* @__PURE__ */ __name(function selectionMessageText() { - return this.selectionMessage || this.$primevue.config.locale.selectionMessage || ""; - }, "selectionMessageText"), - emptySelectionMessageText: /* @__PURE__ */ __name(function emptySelectionMessageText() { - return this.emptySelectionMessage || this.$primevue.config.locale.emptySelectionMessage || ""; - }, "emptySelectionMessageText"), - selectedMessageText: /* @__PURE__ */ __name(function selectedMessageText() { - return this.$filled ? this.selectionMessageText.replaceAll("{0}", "1") : this.emptySelectionMessageText; - }, "selectedMessageText"), - focusedOptionId: /* @__PURE__ */ __name(function focusedOptionId() { - return this.focusedOptionInfo.index !== -1 ? "".concat(this.id).concat(isNotEmpty(this.focusedOptionInfo.parentKey) ? "_" + this.focusedOptionInfo.parentKey : "", "_").concat(this.focusedOptionInfo.index) : null; - }, "focusedOptionId"), - isClearIconVisible: /* @__PURE__ */ __name(function isClearIconVisible() { - return this.showClear && this.d_value != null && isNotEmpty(this.options); - }, "isClearIconVisible") - }, - components: { - CascadeSelectSub: script$1$E, - Portal: script$1m, - ChevronDownIcon: script$1h, - SpinnerIcon: script$1p, - AngleRightIcon: script$1o, - TimesIcon: script$1q - } -}; -function _typeof$k(o) { - "@babel/helpers - typeof"; - return _typeof$k = "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$k(o); -} -__name(_typeof$k, "_typeof$k"); -function ownKeys$i(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$i, "ownKeys$i"); -function _objectSpread$i(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$i(Object(t2), true).forEach(function(r2) { - _defineProperty$j(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$i(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$i, "_objectSpread$i"); -function _defineProperty$j(e, r, t2) { - return (r = _toPropertyKey$j(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$j, "_defineProperty$j"); -function _toPropertyKey$j(t2) { - var i = _toPrimitive$j(t2, "string"); - return "symbol" == _typeof$k(i) ? i : i + ""; -} -__name(_toPropertyKey$j, "_toPropertyKey$j"); -function _toPrimitive$j(t2, r) { - if ("object" != _typeof$k(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$k(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$j, "_toPrimitive$j"); -var _hoisted_1$r = ["id", "disabled", "placeholder", "tabindex", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-invalid"]; -function render$U(_ctx, _cache, $props, $setup, $data, $options) { - var _component_SpinnerIcon = resolveComponent("SpinnerIcon"); - var _component_CascadeSelectSub = resolveComponent("CascadeSelectSub"); - var _component_Portal = resolveComponent("Portal"); - return openBlock(), createElementBlock("div", mergeProps({ - ref: "container", - "class": _ctx.cx("root"), - style: _ctx.sx("root"), - onClick: _cache[5] || (_cache[5] = function($event) { - return $options.onContainerClick($event); - }) - }, _ctx.ptmi("root")), [createBaseVNode("div", mergeProps({ - "class": "p-hidden-accessible" - }, _ctx.ptm("hiddenInputContainer"), { - "data-p-hidden-accessible": true - }), [createBaseVNode("input", mergeProps({ - ref: "focusInput", - id: _ctx.inputId, - type: "text", - "class": _ctx.inputClass, - style: _ctx.inputStyle, - readonly: "", - disabled: _ctx.disabled, - placeholder: _ctx.placeholder, - tabindex: !_ctx.disabled ? _ctx.tabindex : -1, - role: "combobox", - "aria-label": _ctx.ariaLabel, - "aria-labelledby": _ctx.ariaLabelledby, - "aria-haspopup": "tree", - "aria-expanded": $data.overlayVisible, - "aria-controls": $data.id + "_tree", - "aria-activedescendant": $data.focused ? $options.focusedOptionId : void 0, - "aria-invalid": _ctx.invalid || void 0, - onFocus: _cache[0] || (_cache[0] = function() { - return $options.onFocus && $options.onFocus.apply($options, arguments); - }), - onBlur: _cache[1] || (_cache[1] = function() { - return $options.onBlur && $options.onBlur.apply($options, arguments); - }), - onKeydown: _cache[2] || (_cache[2] = function() { - return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); - }) - }, _objectSpread$i(_objectSpread$i({}, _ctx.inputProps), _ctx.ptm("hiddenInput"))), null, 16, _hoisted_1$r)], 16), createBaseVNode("span", mergeProps({ - "class": _ctx.cx("label") - }, _ctx.ptm("label")), [renderSlot(_ctx.$slots, "value", { - value: _ctx.d_value, - placeholder: _ctx.placeholder - }, function() { - return [createTextVNode(toDisplayString($options.label), 1)]; - })], 16), $options.isClearIconVisible ? renderSlot(_ctx.$slots, "clearicon", { - key: 0, - "class": normalizeClass(_ctx.cx("clearIcon")), - clearCallback: $options.onClearClick - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon ? "i" : "TimesIcon"), mergeProps({ - ref: "clearIcon", - "class": [_ctx.cx("clearIcon"), _ctx.clearIcon], - onClick: $options.onClearClick - }, _ctx.ptm("clearIcon"), { - "data-pc-section": "clearicon" - }), null, 16, ["class", "onClick"]))]; - }) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("dropdown"), - role: "button", - tabindex: "-1" - }, _ctx.ptm("dropdown")), [_ctx.loading ? renderSlot(_ctx.$slots, "loadingicon", { - key: 0, - "class": normalizeClass(_ctx.cx("loadingIcon")) - }, function() { - return [_ctx.loadingIcon ? (openBlock(), createElementBlock("span", mergeProps({ - key: 0, - "class": [_ctx.cx("loadingIcon"), "pi-spin", _ctx.loadingIcon], - "aria-hidden": "true" - }, _ctx.ptm("loadingIcon")), null, 16)) : (openBlock(), createBlock(_component_SpinnerIcon, mergeProps({ - key: 1, - "class": _ctx.cx("loadingIcon"), - spin: "", - "aria-hidden": "true" - }, _ctx.ptm("loadingIcon")), null, 16, ["class"]))]; - }) : renderSlot(_ctx.$slots, "dropdownicon", { - key: 1, - "class": normalizeClass(_ctx.cx("dropdownIcon")) - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.dropdownIcon ? "span" : "ChevronDownIcon"), mergeProps({ - "class": [_ctx.cx("dropdownIcon"), _ctx.dropdownIcon], - "aria-hidden": "true" - }, _ctx.ptm("dropdownIcon")), null, 16, ["class"]))]; - })], 16), createBaseVNode("span", mergeProps({ - role: "status", - "aria-live": "polite", - "class": "p-hidden-accessible" - }, _ctx.ptm("hiddenSearchResult"), { - "data-p-hidden-accessible": true - }), toDisplayString($options.searchResultMessageText), 17), createVNode(_component_Portal, { - appendTo: _ctx.appendTo - }, { - "default": withCtx(function() { - return [createVNode(Transition, mergeProps({ - name: "p-connected-overlay", - onEnter: $options.onOverlayEnter, - onAfterEnter: $options.onOverlayAfterEnter, - onLeave: $options.onOverlayLeave, - onAfterLeave: $options.onOverlayAfterLeave - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [$data.overlayVisible ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: $options.overlayRef, - "class": [_ctx.cx("overlay"), _ctx.panelClass, _ctx.overlayClass], - style: [_ctx.panelStyle, _ctx.overlayStyle], - onClick: _cache[3] || (_cache[3] = function() { - return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); - }), - onKeydown: _cache[4] || (_cache[4] = function() { - return $options.onOverlayKeyDown && $options.onOverlayKeyDown.apply($options, arguments); - }) - }, _objectSpread$i(_objectSpread$i(_objectSpread$i({}, _ctx.panelProps), _ctx.overlayProps), _ctx.ptm("overlay"))), [renderSlot(_ctx.$slots, "header", { - value: _ctx.d_value, - options: _ctx.options - }), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("listContainer") - }, _ctx.ptm("listContainer")), [createVNode(_component_CascadeSelectSub, { - id: $data.id + "_tree", - role: "tree", - "aria-orientation": "horizontal", - selectId: $data.id, - focusedOptionId: $data.focused ? $options.focusedOptionId : void 0, - options: $options.processedOptions, - activeOptionPath: $data.activeOptionPath, - level: 0, - templates: _ctx.$slots, - optionLabel: _ctx.optionLabel, - optionValue: _ctx.optionValue, - optionDisabled: _ctx.optionDisabled, - optionGroupIcon: _ctx.optionGroupIcon, - optionGroupLabel: _ctx.optionGroupLabel, - optionGroupChildren: _ctx.optionGroupChildren, - value: _ctx.d_value, - onOptionChange: $options.onOptionClick, - onOptionFocusChange: $options.onOptionMouseMove, - onOptionFocusEnterChange: $options.onOptionMouseEnter, - pt: _ctx.pt, - unstyled: _ctx.unstyled - }, null, 8, ["id", "selectId", "focusedOptionId", "options", "activeOptionPath", "templates", "optionLabel", "optionValue", "optionDisabled", "optionGroupIcon", "optionGroupLabel", "optionGroupChildren", "value", "onOptionChange", "onOptionFocusChange", "onOptionFocusEnterChange", "pt", "unstyled"])], 16), createBaseVNode("span", mergeProps({ - role: "status", - "aria-live": "polite", - "class": "p-hidden-accessible" - }, _ctx.ptm("hiddenSelectedMessage"), { - "data-p-hidden-accessible": true - }), toDisplayString($options.selectedMessageText), 17), renderSlot(_ctx.$slots, "footer", { - value: _ctx.d_value, - options: _ctx.options - })], 16)) : createCommentVNode("", true)]; - }), - _: 3 - }, 16, ["onEnter", "onAfterEnter", "onLeave", "onAfterLeave"])]; - }), - _: 3 - }, 8, ["appendTo"])], 16); -} -__name(render$U, "render$U"); -script$10.render = render$U; -var theme$x = /* @__PURE__ */ __name(function theme6(_ref) { - _ref.dt; - return "\n.p-checkbox-group {\n display: inline-flex;\n}\n"; -}, "theme"); -var classes$B = { - root: "p-checkbox-group p-component" -}; -var CheckboxGroupStyle = BaseStyle.extend({ - name: "checkboxgroup", - theme: theme$x, - classes: classes$B -}); -var script$1$D = { - name: "BaseCheckboxGroup", - "extends": script$1r, - style: CheckboxGroupStyle, - provide: /* @__PURE__ */ __name(function provide11() { - return { - $pcCheckboxGroup: this, - $parentInstance: this - }; - }, "provide") -}; -var script$$ = { - name: "CheckboxGroup", - "extends": script$1$D, - inheritAttrs: false, - data: /* @__PURE__ */ __name(function data4() { - return { - groupName: this.name - }; - }, "data"), - watch: { - name: /* @__PURE__ */ __name(function name(newValue) { - this.groupName = newValue || uuid("checkbox-group-"); - }, "name") - }, - mounted: /* @__PURE__ */ __name(function mounted8() { - this.groupName = this.groupName || uuid("checkbox-group-"); - }, "mounted") -}; -function render$T(_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$T, "render$T"); -script$$.render = render$T; -var theme$w = /* @__PURE__ */ __name(function theme7(_ref) { - var dt = _ref.dt; - return "\n.p-inputchips {\n display: inline-flex;\n}\n\n.p-inputchips-input {\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("inputchips.padding.y"), " / 2) ").concat(dt("inputchips.padding.x"), ";\n gap: calc(").concat(dt("inputchips.padding.y"), " / 2);\n color: ").concat(dt("inputchips.color"), ";\n background: ").concat(dt("inputchips.background"), ";\n border: 1px solid ").concat(dt("inputchips.border.color"), ";\n border-radius: ").concat(dt("inputchips.border.radius"), ";\n width: 100%;\n transition: background ").concat(dt("inputchips.transition.duration"), ", color ").concat(dt("inputchips.transition.duration"), ", border-color ").concat(dt("inputchips.transition.duration"), ", outline-color ").concat(dt("inputchips.transition.duration"), ", box-shadow ").concat(dt("inputchips.transition.duration"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("inputchips.shadow"), ";\n}\n\n.p-inputchips:not(.p-disabled):hover .p-inputchips-input {\n border-color: ").concat(dt("inputchips.hover.border.color"), ";\n}\n\n.p-inputchips:not(.p-disabled).p-focus .p-inputchips-input {\n border-color: ").concat(dt("inputchips.focus.border.color"), ";\n box-shadow: ").concat(dt("inputchips.focus.ring.shadow"), ";\n outline: ").concat(dt("inputchips.focus.ring.width"), " ").concat(dt("inputchips.focus.ring.style"), " ").concat(dt("inputchips.focus.ring.color"), ";\n outline-offset: ").concat(dt("inputchips.focus.ring.offset"), ";\n}\n\n.p-inputchips.p-invalid .p-inputchips-input {\n border-color: ").concat(dt("inputchips.invalid.border.color"), ";\n}\n\n.p-variant-filled.p-inputchips-input {\n background: ").concat(dt("inputchips.filled.background"), ";\n}\n\n.p-inputchips:not(.p-disabled).p-focus .p-variant-filled.p-inputchips-input {\n background: ").concat(dt("inputchips.filled.focus.background"), ";\n}\n\n.p-inputchips.p-disabled .p-inputchips-input {\n opacity: 1;\n background: ").concat(dt("inputchips.disabled.background"), ";\n color: ").concat(dt("inputchips.disabled.color"), ";\n}\n\n.p-inputchips-chip.p-chip {\n padding-top: calc(").concat(dt("inputchips.padding.y"), " / 2);\n padding-bottom: calc(").concat(dt("inputchips.padding.y"), " / 2);\n border-radius: ").concat(dt("inputchips.chip.border.radius"), ";\n transition: background ").concat(dt("inputchips.transition.duration"), ", color ").concat(dt("inputchips.transition.duration"), ";\n}\n\n.p-inputchips-chip-item.p-focus .p-inputchips-chip {\n background: ").concat(dt("inputchips.chip.focus.background"), ";\n color: ").concat(dt("inputchips.chip.focus.color"), ";\n}\n\n.p-inputchips-input:has(.p-inputchips-chip) {\n padding-left: calc(").concat(dt("inputchips.padding.y"), " / 2);\n padding-right: calc(").concat(dt("inputchips.padding.y"), " / 2);\n}\n\n.p-inputchips-input-item {\n flex: 1 1 auto;\n display: inline-flex;\n padding-top: calc(").concat(dt("inputchips.padding.y"), " / 2);\n padding-bottom: calc(").concat(dt("inputchips.padding.y"), " / 2);\n}\n\n.p-inputchips-input-item 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-inputchips-input-item input::placeholder {\n color: ").concat(dt("inputchips.placeholder.color"), ";\n}\n"); -}, "theme"); -var classes$A = { - root: /* @__PURE__ */ __name(function root7(_ref2) { - var instance = _ref2.instance, props = _ref2.props; - return ["p-inputchips p-component p-inputwrapper", { - "p-disabled": props.disabled, - "p-invalid": props.invalid, - "p-focus": instance.focused, - "p-inputwrapper-filled": props.modelValue && props.modelValue.length || instance.inputValue && instance.inputValue.length, - "p-inputwrapper-focus": instance.focused - }]; - }, "root"), - input: /* @__PURE__ */ __name(function input(_ref3) { - var props = _ref3.props, instance = _ref3.instance; - return ["p-inputchips-input", { - "p-variant-filled": props.variant ? props.variant === "filled" : instance.$primevue.config.inputStyle === "filled" || instance.$primevue.config.inputVariant === "filled" - }]; - }, "input"), - chipItem: /* @__PURE__ */ __name(function chipItem(_ref4) { - var state = _ref4.state, index = _ref4.index; - return ["p-inputchips-chip-item", { - "p-focus": state.focusedIndex === index - }]; - }, "chipItem"), - pcChip: "p-inputchips-chip", - chipIcon: "p-inputchips-chip-icon", - inputItem: "p-inputchips-input-item" -}; -var InputChipsStyle = BaseStyle.extend({ - name: "inputchips", - theme: theme$w, - classes: classes$A -}); -var script$1$C = { - name: "BaseInputChips", - "extends": script$1f, - props: { - modelValue: { - type: Array, - "default": null - }, - max: { - type: Number, - "default": null - }, - separator: { - type: [String, Object], - "default": null - }, - addOnBlur: { - type: Boolean, - "default": null - }, - allowDuplicate: { - type: Boolean, - "default": true - }, - placeholder: { - type: String, - "default": null - }, - variant: { - type: String, - "default": null - }, - invalid: { - type: Boolean, - "default": false - }, - disabled: { - type: Boolean, - "default": false - }, - inputId: { - type: String, - "default": null - }, - inputClass: { - type: [String, Object], - "default": null - }, - inputStyle: { - type: Object, - "default": null - }, - inputProps: { - type: null, - "default": null - }, - removeTokenIcon: { - type: String, - "default": void 0 - }, - chipIcon: { - type: String, - "default": void 0 - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - } - }, - style: InputChipsStyle, - provide: /* @__PURE__ */ __name(function provide12() { - return { - $pcInputChips: this, - $parentInstance: this - }; - }, "provide") -}; -function _toConsumableArray$c(r) { - return _arrayWithoutHoles$c(r) || _iterableToArray$c(r) || _unsupportedIterableToArray$d(r) || _nonIterableSpread$c(); -} -__name(_toConsumableArray$c, "_toConsumableArray$c"); -function _nonIterableSpread$c() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableSpread$c, "_nonIterableSpread$c"); -function _unsupportedIterableToArray$d(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$d(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$d(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$d, "_unsupportedIterableToArray$d"); -function _iterableToArray$c(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$c, "_iterableToArray$c"); -function _arrayWithoutHoles$c(r) { - if (Array.isArray(r)) return _arrayLikeToArray$d(r); -} -__name(_arrayWithoutHoles$c, "_arrayWithoutHoles$c"); -function _arrayLikeToArray$d(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; -} -__name(_arrayLikeToArray$d, "_arrayLikeToArray$d"); -var script$_ = { - name: "InputChips", - "extends": script$1$C, - inheritAttrs: false, - emits: ["update:modelValue", "add", "remove", "focus", "blur"], - data: /* @__PURE__ */ __name(function data5() { - return { - id: this.$attrs.id, - inputValue: null, - focused: false, - focusedIndex: null - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId3(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId") - }, - mounted: /* @__PURE__ */ __name(function mounted9() { - console.warn("Deprecated since v4. Use AutoComplete component instead with its typeahead property."); - this.id = this.id || UniqueComponentId(); - }, "mounted"), - methods: { - onWrapperClick: /* @__PURE__ */ __name(function onWrapperClick() { - this.$refs.input.focus(); - }, "onWrapperClick"), - onInput: /* @__PURE__ */ __name(function onInput2(event2) { - this.inputValue = event2.target.value; - this.focusedIndex = null; - }, "onInput"), - onFocus: /* @__PURE__ */ __name(function onFocus4(event2) { - this.focused = true; - this.focusedIndex = null; - this.$emit("focus", event2); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur3(event2) { - this.focused = false; - this.focusedIndex = null; - if (this.addOnBlur) { - this.addItem(event2, event2.target.value, false); - } - this.$emit("blur", event2); - }, "onBlur"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown3(event2) { - var inputValue = event2.target.value; - switch (event2.code) { - case "Backspace": - if (inputValue.length === 0 && this.modelValue && this.modelValue.length > 0) { - if (this.focusedIndex !== null) { - this.removeItem(event2, this.focusedIndex); - } else this.removeItem(event2, this.modelValue.length - 1); - } - break; - case "Enter": - case "NumpadEnter": - if (inputValue && inputValue.trim().length && !this.maxedOut) { - this.addItem(event2, inputValue, true); - } - break; - case "ArrowLeft": - if (inputValue.length === 0 && this.modelValue && this.modelValue.length > 0) { - this.$refs.container.focus(); - } - break; - case "ArrowRight": - event2.stopPropagation(); - break; - default: - if (this.separator) { - if (this.separator === event2.key || event2.key.match(this.separator)) { - this.addItem(event2, inputValue, true); - } - } - break; - } - }, "onKeyDown"), - onPaste: /* @__PURE__ */ __name(function onPaste(event2) { - var _this = this; - if (this.separator) { - var separator = this.separator.replace("\\n", "\n").replace("\\r", "\r").replace("\\t", " "); - var pastedData = (event2.clipboardData || window["clipboardData"]).getData("Text"); - if (pastedData) { - var value2 = this.modelValue || []; - var pastedValues = pastedData.split(separator); - pastedValues = pastedValues.filter(function(val) { - return _this.allowDuplicate || value2.indexOf(val) === -1; - }); - value2 = [].concat(_toConsumableArray$c(value2), _toConsumableArray$c(pastedValues)); - this.updateModel(event2, value2, true); - } - } - }, "onPaste"), - onContainerFocus: /* @__PURE__ */ __name(function onContainerFocus() { - this.focused = true; - }, "onContainerFocus"), - onContainerBlur: /* @__PURE__ */ __name(function onContainerBlur() { - this.focusedIndex = -1; - this.focused = false; - }, "onContainerBlur"), - onContainerKeyDown: /* @__PURE__ */ __name(function onContainerKeyDown(event2) { - switch (event2.code) { - case "ArrowLeft": - this.onArrowLeftKeyOn(event2); - break; - case "ArrowRight": - this.onArrowRightKeyOn(event2); - break; - case "Backspace": - this.onBackspaceKeyOn(event2); - break; - } - }, "onContainerKeyDown"), - onArrowLeftKeyOn: /* @__PURE__ */ __name(function onArrowLeftKeyOn() { - if (this.inputValue.length === 0 && this.modelValue && this.modelValue.length > 0) { - this.focusedIndex = this.focusedIndex === null ? this.modelValue.length - 1 : this.focusedIndex - 1; - if (this.focusedIndex < 0) this.focusedIndex = 0; - } - }, "onArrowLeftKeyOn"), - onArrowRightKeyOn: /* @__PURE__ */ __name(function onArrowRightKeyOn() { - if (this.inputValue.length === 0 && this.modelValue && this.modelValue.length > 0) { - if (this.focusedIndex === this.modelValue.length - 1) { - this.focusedIndex = null; - this.$refs.input.focus(); - } else { - this.focusedIndex++; - } - } - }, "onArrowRightKeyOn"), - onBackspaceKeyOn: /* @__PURE__ */ __name(function onBackspaceKeyOn(event2) { - if (this.focusedIndex !== null) { - this.removeItem(event2, this.focusedIndex); - } - }, "onBackspaceKeyOn"), - updateModel: /* @__PURE__ */ __name(function updateModel3(event2, value2, preventDefault) { - var _this2 = this; - this.$emit("update:modelValue", value2); - this.$emit("add", { - originalEvent: event2, - value: value2 - }); - this.$refs.input.value = ""; - this.inputValue = ""; - setTimeout(function() { - _this2.maxedOut && (_this2.focused = false); - }, 0); - if (preventDefault) { - event2.preventDefault(); - } - }, "updateModel"), - addItem: /* @__PURE__ */ __name(function addItem(event2, item8, preventDefault) { - if (item8 && item8.trim().length) { - var value2 = this.modelValue ? _toConsumableArray$c(this.modelValue) : []; - if (this.allowDuplicate || value2.indexOf(item8) === -1) { - value2.push(item8); - this.updateModel(event2, value2, preventDefault); - } - } - }, "addItem"), - removeItem: /* @__PURE__ */ __name(function removeItem(event2, index) { - if (this.disabled) { - return; - } - var values = _toConsumableArray$c(this.modelValue); - var removedItem = values.splice(index, 1); - this.focusedIndex = null; - this.$refs.input.focus(); - this.$emit("update:modelValue", values); - this.$emit("remove", { - originalEvent: event2, - value: removedItem - }); - }, "removeItem") - }, - computed: { - maxedOut: /* @__PURE__ */ __name(function maxedOut() { - return this.max && this.modelValue && this.max === this.modelValue.length; - }, "maxedOut"), - focusedOptionId: /* @__PURE__ */ __name(function focusedOptionId2() { - return this.focusedIndex !== null ? "".concat(this.id, "_inputchips_item_").concat(this.focusedIndex) : null; - }, "focusedOptionId") - }, - components: { - Chip: script$1s - } -}; -function _typeof$j(o) { - "@babel/helpers - typeof"; - return _typeof$j = "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$j(o); -} -__name(_typeof$j, "_typeof$j"); -function ownKeys$h(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$h, "ownKeys$h"); -function _objectSpread$h(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$h(Object(t2), true).forEach(function(r2) { - _defineProperty$i(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$h(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$h, "_objectSpread$h"); -function _defineProperty$i(e, r, t2) { - return (r = _toPropertyKey$i(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$i, "_defineProperty$i"); -function _toPropertyKey$i(t2) { - var i = _toPrimitive$i(t2, "string"); - return "symbol" == _typeof$j(i) ? i : i + ""; -} -__name(_toPropertyKey$i, "_toPropertyKey$i"); -function _toPrimitive$i(t2, r) { - if ("object" != _typeof$j(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$j(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$i, "_toPrimitive$i"); -var _hoisted_1$q = ["aria-labelledby", "aria-label", "aria-activedescendant"]; -var _hoisted_2$j = ["id", "aria-label", "aria-setsize", "aria-posinset", "data-p-focused"]; -var _hoisted_3$g = ["id", "disabled", "placeholder", "aria-invalid"]; -function render$S(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Chip = resolveComponent("Chip"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [createBaseVNode("ul", mergeProps({ - ref: "container", - "class": _ctx.cx("input"), - tabindex: "-1", - role: "listbox", - "aria-orientation": "horizontal", - "aria-labelledby": _ctx.ariaLabelledby, - "aria-label": _ctx.ariaLabel, - "aria-activedescendant": $data.focused ? $options.focusedOptionId : void 0, - onClick: _cache[5] || (_cache[5] = function($event) { - return $options.onWrapperClick(); - }), - onFocus: _cache[6] || (_cache[6] = function() { - return $options.onContainerFocus && $options.onContainerFocus.apply($options, arguments); - }), - onBlur: _cache[7] || (_cache[7] = function() { - return $options.onContainerBlur && $options.onContainerBlur.apply($options, arguments); - }), - onKeydown: _cache[8] || (_cache[8] = function() { - return $options.onContainerKeyDown && $options.onContainerKeyDown.apply($options, arguments); - }) - }, _ctx.ptm("input")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.modelValue, function(val, i) { - return openBlock(), createElementBlock("li", mergeProps({ - key: "".concat(i, "_").concat(val), - id: $data.id + "_inputchips_item_" + i, - role: "option", - "class": _ctx.cx("chipItem", { - index: i - }), - "aria-label": val, - "aria-selected": true, - "aria-setsize": _ctx.modelValue.length, - "aria-posinset": i + 1, - ref_for: true - }, _ctx.ptm("chipItem"), { - "data-p-focused": $data.focusedIndex === i - }), [renderSlot(_ctx.$slots, "chip", { - "class": normalizeClass(_ctx.cx("pcChip")), - index: i, - value: val, - removeCallback: /* @__PURE__ */ __name(function removeCallback(event2) { - return _ctx.removeOption(event2, i); - }, "removeCallback") - }, function() { - return [createVNode(_component_Chip, { - "class": normalizeClass(_ctx.cx("pcChip")), - label: val, - removeIcon: _ctx.chipIcon || _ctx.removeTokenIcon, - removable: "", - unstyled: _ctx.unstyled, - onRemove: /* @__PURE__ */ __name(function onRemove($event) { - return $options.removeItem($event, i); - }, "onRemove"), - pt: _ctx.ptm("pcChip") - }, { - removeicon: withCtx(function() { - return [renderSlot(_ctx.$slots, _ctx.$slots.chipicon ? "chipicon" : "removetokenicon", { - "class": normalizeClass(_ctx.cx("chipIcon")), - index: i, - removeCallback: /* @__PURE__ */ __name(function removeCallback(event2) { - return $options.removeItem(event2, i); - }, "removeCallback") - })]; - }), - _: 2 - }, 1032, ["class", "label", "removeIcon", "unstyled", "onRemove", "pt"])]; - })], 16, _hoisted_2$j); - }), 128)), createBaseVNode("li", mergeProps({ - "class": _ctx.cx("inputItem"), - role: "option" - }, _ctx.ptm("inputItem")), [createBaseVNode("input", mergeProps({ - ref: "input", - id: _ctx.inputId, - type: "text", - "class": _ctx.inputClass, - style: _ctx.inputStyle, - disabled: _ctx.disabled || $options.maxedOut, - placeholder: _ctx.placeholder, - "aria-invalid": _ctx.invalid || void 0, - onFocus: _cache[0] || (_cache[0] = function($event) { - return $options.onFocus($event); - }), - onBlur: _cache[1] || (_cache[1] = function($event) { - return $options.onBlur($event); - }), - onInput: _cache[2] || (_cache[2] = function() { - return $options.onInput && $options.onInput.apply($options, arguments); - }), - onKeydown: _cache[3] || (_cache[3] = function($event) { - return $options.onKeyDown($event); - }), - onPaste: _cache[4] || (_cache[4] = function($event) { - return $options.onPaste($event); - }) - }, _objectSpread$h(_objectSpread$h({}, _ctx.inputProps), _ctx.ptm("inputItemField"))), null, 16, _hoisted_3$g)], 16)], 16, _hoisted_1$q)], 16); -} -__name(render$S, "render$S"); -script$_.render = render$S; -var script$Z = { - name: "Chips", - "extends": script$_, - mounted: /* @__PURE__ */ __name(function mounted10() { - console.warn("Deprecated since v4. Use InputChips component instead."); - }, "mounted") -}; -var ChipsStyle = BaseStyle.extend({ - name: "chips" -}); -var ColumnGroupStyle = BaseStyle.extend({ - name: "columngroup" -}); -var script$1$B = { - name: "BaseColumnGroup", - "extends": script$1f, - props: { - type: { - type: String, - "default": null - } - }, - style: ColumnGroupStyle, - provide: /* @__PURE__ */ __name(function provide13() { - return { - $pcColumnGroup: this, - $parentInstance: this - }; - }, "provide") -}; -var script$Y = { - name: "ColumnGroup", - "extends": script$1$B, - inheritAttrs: false, - inject: ["$columnGroups"], - mounted: /* @__PURE__ */ __name(function mounted11() { - var _this$$columnGroups; - (_this$$columnGroups = this.$columnGroups) === null || _this$$columnGroups === void 0 || _this$$columnGroups.add(this.$); - }, "mounted"), - unmounted: /* @__PURE__ */ __name(function unmounted2() { - var _this$$columnGroups2; - (_this$$columnGroups2 = this.$columnGroups) === null || _this$$columnGroups2 === void 0 || _this$$columnGroups2["delete"](this.$); - }, "unmounted"), - render: /* @__PURE__ */ __name(function render() { - return null; - }, "render") -}; -var theme$v = /* @__PURE__ */ __name(function theme8(_ref) { - var dt = _ref.dt; - return "\n.p-dataview {\n border-color: ".concat(dt("dataview.border.color"), ";\n border-width: ").concat(dt("dataview.border.width"), ";\n border-style: solid;\n border-radius: ").concat(dt("dataview.border.radius"), ";\n padding: ").concat(dt("dataview.padding"), ";\n}\n\n.p-dataview-header {\n background: ").concat(dt("dataview.header.background"), ";\n color: ").concat(dt("dataview.header.color"), ";\n border-color: ").concat(dt("dataview.header.border.color"), ";\n border-width: ").concat(dt("dataview.header.border.width"), ";\n border-style: solid;\n padding: ").concat(dt("dataview.header.padding"), ";\n border-radius: ").concat(dt("dataview.header.border.radius"), ";\n}\n\n.p-dataview-content {\n background: ").concat(dt("dataview.content.background"), ";\n border-color: ").concat(dt("dataview.content.border.color"), ";\n border-width: ").concat(dt("dataview.content.border.width"), ";\n border-style: solid;\n color: ").concat(dt("dataview.content.color"), ";\n padding: ").concat(dt("dataview.content.padding"), ";\n border-radius: ").concat(dt("dataview.content.border.radius"), ";\n}\n\n.p-dataview-footer {\n background: ").concat(dt("dataview.footer.background"), ";\n color: ").concat(dt("dataview.footer.color"), ";\n border-color: ").concat(dt("dataview.footer.border.color"), ";\n border-width: ").concat(dt("dataview.footer.border.width"), ";\n border-style: solid;\n padding: ").concat(dt("dataview.footer.padding"), ";\n border-radius: ").concat(dt("dataview.footer.border.radius"), ";\n}\n\n.p-dataview-paginator-top {\n border-width: ").concat(dt("dataview.paginator.top.border.width"), ";\n border-color: ").concat(dt("dataview.paginator.top.border.color"), ";\n border-style: solid;\n}\n\n.p-dataview-paginator-bottom {\n border-width: ").concat(dt("dataview.paginator.bottom.border.width"), ";\n border-color: ").concat(dt("dataview.paginator.bottom.border.color"), ";\n border-style: solid;\n}\n"); -}, "theme"); -var classes$z = { - root: /* @__PURE__ */ __name(function root8(_ref2) { - var props = _ref2.props; - return ["p-dataview p-component", { - "p-dataview-list": props.layout === "list", - "p-dataview-grid": props.layout === "grid" - }]; - }, "root"), - header: "p-dataview-header", - pcPaginator: /* @__PURE__ */ __name(function pcPaginator(_ref3) { - var position = _ref3.position; - return "p-dataview-paginator-" + position; - }, "pcPaginator"), - content: "p-dataview-content", - emptyMessage: "p-dataview-empty-message", - // TODO: remove? - footer: "p-dataview-footer" -}; -var DataViewStyle = BaseStyle.extend({ - name: "dataview", - theme: theme$v, - classes: classes$z -}); -var script$1$A = { - name: "BaseDataView", - "extends": script$1f, - props: { - value: { - type: Array, - "default": null - }, - layout: { - type: String, - "default": "list" - }, - rows: { - type: Number, - "default": 0 - }, - first: { - type: Number, - "default": 0 - }, - totalRecords: { - type: Number, - "default": 0 - }, - paginator: { - type: Boolean, - "default": false - }, - paginatorPosition: { - type: String, - "default": "bottom" - }, - alwaysShowPaginator: { - type: Boolean, - "default": true - }, - paginatorTemplate: { - type: String, - "default": "FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown" - }, - pageLinkSize: { - type: Number, - "default": 5 - }, - rowsPerPageOptions: { - type: Array, - "default": null - }, - currentPageReportTemplate: { - type: String, - "default": "({currentPage} of {totalPages})" - }, - sortField: { - type: [String, Function], - "default": null - }, - sortOrder: { - type: Number, - "default": null - }, - lazy: { - type: Boolean, - "default": false - }, - dataKey: { - type: String, - "default": null - } - }, - style: DataViewStyle, - provide: /* @__PURE__ */ __name(function provide14() { - return { - $pcDataView: this, - $parentInstance: this - }; - }, "provide") -}; -function _toConsumableArray$b(r) { - return _arrayWithoutHoles$b(r) || _iterableToArray$b(r) || _unsupportedIterableToArray$c(r) || _nonIterableSpread$b(); -} -__name(_toConsumableArray$b, "_toConsumableArray$b"); -function _nonIterableSpread$b() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableSpread$b, "_nonIterableSpread$b"); -function _unsupportedIterableToArray$c(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$c(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$c(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$c, "_unsupportedIterableToArray$c"); -function _iterableToArray$b(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$b, "_iterableToArray$b"); -function _arrayWithoutHoles$b(r) { - if (Array.isArray(r)) return _arrayLikeToArray$c(r); -} -__name(_arrayWithoutHoles$b, "_arrayWithoutHoles$b"); -function _arrayLikeToArray$c(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; -} -__name(_arrayLikeToArray$c, "_arrayLikeToArray$c"); -var script$X = { - name: "DataView", - "extends": script$1$A, - inheritAttrs: false, - emits: ["update:first", "update:rows", "page"], - data: /* @__PURE__ */ __name(function data6() { - return { - d_first: this.first, - d_rows: this.rows - }; - }, "data"), - watch: { - first: /* @__PURE__ */ __name(function first(newValue) { - this.d_first = newValue; - }, "first"), - rows: /* @__PURE__ */ __name(function rows(newValue) { - this.d_rows = newValue; - }, "rows"), - sortField: /* @__PURE__ */ __name(function sortField() { - this.resetPage(); - }, "sortField"), - sortOrder: /* @__PURE__ */ __name(function sortOrder() { - this.resetPage(); - }, "sortOrder") - }, - methods: { - getKey: /* @__PURE__ */ __name(function getKey2(item8, index) { - return this.dataKey ? resolveFieldData(item8, this.dataKey) : index; - }, "getKey"), - onPage: /* @__PURE__ */ __name(function onPage(event2) { - this.d_first = event2.first; - this.d_rows = event2.rows; - this.$emit("update:first", this.d_first); - this.$emit("update:rows", this.d_rows); - this.$emit("page", event2); - }, "onPage"), - sort: /* @__PURE__ */ __name(function sort$1() { - var _this = this; - if (this.value) { - var value2 = _toConsumableArray$b(this.value); - var comparer = localeComparator(); - value2.sort(function(data1, data210) { - var value1 = resolveFieldData(data1, _this.sortField); - var value22 = resolveFieldData(data210, _this.sortField); - return sort(value1, value22, _this.sortOrder, comparer); - }); - return value2; - } else { - return null; - } - }, "sort$1"), - resetPage: /* @__PURE__ */ __name(function resetPage() { - this.d_first = 0; - this.$emit("update:first", this.d_first); - }, "resetPage") - }, - computed: { - getTotalRecords: /* @__PURE__ */ __name(function getTotalRecords() { - if (this.totalRecords) return this.totalRecords; - else return this.value ? this.value.length : 0; - }, "getTotalRecords"), - empty: /* @__PURE__ */ __name(function empty() { - return !this.value || this.value.length === 0; - }, "empty"), - emptyMessageText: /* @__PURE__ */ __name(function emptyMessageText2() { - var _this$$primevue$confi; - return ((_this$$primevue$confi = this.$primevue.config) === null || _this$$primevue$confi === void 0 || (_this$$primevue$confi = _this$$primevue$confi.locale) === null || _this$$primevue$confi === void 0 ? void 0 : _this$$primevue$confi.emptyMessage) || ""; - }, "emptyMessageText"), - paginatorTop: /* @__PURE__ */ __name(function paginatorTop() { - return this.paginator && (this.paginatorPosition !== "bottom" || this.paginatorPosition === "both"); - }, "paginatorTop"), - paginatorBottom: /* @__PURE__ */ __name(function paginatorBottom() { - return this.paginator && (this.paginatorPosition !== "top" || this.paginatorPosition === "both"); - }, "paginatorBottom"), - items: /* @__PURE__ */ __name(function items() { - if (this.value && this.value.length) { - var data40 = this.value; - if (data40 && data40.length && this.sortField) { - data40 = this.sort(); - } - if (this.paginator) { - var first3 = this.lazy ? 0 : this.d_first; - return data40.slice(first3, first3 + this.d_rows); - } else { - return data40; - } - } else { - return null; - } - }, "items") - }, - components: { - DVPaginator: script$1t - } -}; -function render$R(_ctx, _cache, $props, $setup, $data, $options) { - var _component_DVPaginator = resolveComponent("DVPaginator"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [_ctx.$slots.header ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("header") - }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header")], 16)) : createCommentVNode("", true), $options.paginatorTop ? (openBlock(), createBlock(_component_DVPaginator, { - key: 1, - rows: $data.d_rows, - first: $data.d_first, - totalRecords: $options.getTotalRecords, - pageLinkSize: _ctx.pageLinkSize, - template: _ctx.paginatorTemplate, - rowsPerPageOptions: _ctx.rowsPerPageOptions, - currentPageReportTemplate: _ctx.currentPageReportTemplate, - "class": normalizeClass(_ctx.cx("pcPaginator", { - position: "top" - })), - alwaysShow: _ctx.alwaysShowPaginator, - onPage: _cache[0] || (_cache[0] = function($event) { - return $options.onPage($event); - }), - unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcPaginator") - }, createSlots({ - _: 2 - }, [_ctx.$slots.paginatorcontainer ? { - name: "container", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorcontainer", { - first: slotProps.first, - last: slotProps.last, - rows: slotProps.rows, - page: slotProps.page, - pageCount: slotProps.pageCount, - totalRecords: slotProps.totalRecords, - firstPageCallback: slotProps.firstPageCallback, - lastPageCallback: slotProps.lastPageCallback, - prevPageCallback: slotProps.prevPageCallback, - nextPageCallback: slotProps.nextPageCallback, - rowChangeCallback: slotProps.rowChangeCallback - })]; - }), - key: "0" - } : void 0, _ctx.$slots.paginatorstart ? { - name: "start", - fn: withCtx(function() { - return [renderSlot(_ctx.$slots, "paginatorstart")]; - }), - key: "1" - } : void 0, _ctx.$slots.paginatorend ? { - name: "end", - fn: withCtx(function() { - return [renderSlot(_ctx.$slots, "paginatorend")]; - }), - key: "2" - } : void 0]), 1032, ["rows", "first", "totalRecords", "pageLinkSize", "template", "rowsPerPageOptions", "currentPageReportTemplate", "class", "alwaysShow", "unstyled", "pt"])) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("content") - }, _ctx.ptm("content")), [!$options.empty ? (openBlock(), createElementBlock(Fragment, { - key: 0 - }, [_ctx.$slots.list && _ctx.layout === "list" ? renderSlot(_ctx.$slots, "list", { - key: 0, - items: $options.items - }) : createCommentVNode("", true), _ctx.$slots.grid && _ctx.layout === "grid" ? renderSlot(_ctx.$slots, "grid", { - key: 1, - items: $options.items - }) : createCommentVNode("", true)], 64)) : (openBlock(), createElementBlock("div", mergeProps({ - key: 1, - "class": _ctx.cx("emptyMessage") - }, _ctx.ptm("emptyMessage")), [renderSlot(_ctx.$slots, "empty", { - layout: _ctx.layout - }, function() { - return [createTextVNode(toDisplayString($options.emptyMessageText), 1)]; - })], 16))], 16), $options.paginatorBottom ? (openBlock(), createBlock(_component_DVPaginator, { - key: 2, - rows: $data.d_rows, - first: $data.d_first, - totalRecords: $options.getTotalRecords, - pageLinkSize: _ctx.pageLinkSize, - template: _ctx.paginatorTemplate, - rowsPerPageOptions: _ctx.rowsPerPageOptions, - currentPageReportTemplate: _ctx.currentPageReportTemplate, - "class": normalizeClass(_ctx.cx("pcPaginator", { - position: "bottom" - })), - alwaysShow: _ctx.alwaysShowPaginator, - onPage: _cache[1] || (_cache[1] = function($event) { - return $options.onPage($event); - }), - unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcPaginator") - }, createSlots({ - _: 2 - }, [_ctx.$slots.paginatorcontainer ? { - name: "container", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorcontainer", { - first: slotProps.first, - last: slotProps.last, - rows: slotProps.rows, - page: slotProps.page, - pageCount: slotProps.pageCount, - totalRecords: slotProps.totalRecords, - firstPageCallback: slotProps.firstPageCallback, - lastPageCallback: slotProps.lastPageCallback, - prevPageCallback: slotProps.prevPageCallback, - nextPageCallback: slotProps.nextPageCallback, - rowChangeCallback: slotProps.rowChangeCallback - })]; - }), - key: "0" - } : void 0, _ctx.$slots.paginatorstart ? { - name: "start", - fn: withCtx(function() { - return [renderSlot(_ctx.$slots, "paginatorstart")]; - }), - key: "1" - } : void 0, _ctx.$slots.paginatorend ? { - name: "end", - fn: withCtx(function() { - return [renderSlot(_ctx.$slots, "paginatorend")]; - }), - key: "2" - } : void 0]), 1032, ["rows", "first", "totalRecords", "pageLinkSize", "template", "rowsPerPageOptions", "currentPageReportTemplate", "class", "alwaysShow", "unstyled", "pt"])) : createCommentVNode("", true), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", mergeProps({ - key: 3, - "class": _ctx.cx("footer") - }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true)], 16); -} -__name(render$R, "render$R"); -script$X.render = render$R; -var DeferredContentStyle = BaseStyle.extend({ - name: "deferredcontent" -}); -var script$W = { - name: "DeferredContent", - "extends": script$1f, - inheritAttrs: false, - emits: ["load"], - style: DeferredContentStyle, - data: /* @__PURE__ */ __name(function data7() { - return { - loaded: false - }; - }, "data"), - mounted: /* @__PURE__ */ __name(function mounted12() { - if (!this.loaded) { - if (this.shouldLoad()) this.load(); - else this.bindScrollListener(); - } - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount3() { - this.unbindScrollListener(); - }, "beforeUnmount"), - methods: { - bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener3() { - var _this = this; - this.documentScrollListener = function() { - if (_this.shouldLoad()) { - _this.load(); - _this.unbindScrollListener(); - } - }; - window.addEventListener("scroll", this.documentScrollListener); - }, "bindScrollListener"), - unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener3() { - if (this.documentScrollListener) { - window.removeEventListener("scroll", this.documentScrollListener); - this.documentScrollListener = null; - } - }, "unbindScrollListener"), - shouldLoad: /* @__PURE__ */ __name(function shouldLoad() { - if (this.loaded) { - return false; - } else { - var rect = this.$refs.container.getBoundingClientRect(); - var docElement = document.documentElement; - var winHeight = docElement.clientHeight; - return winHeight >= rect.top; - } - }, "shouldLoad"), - load: /* @__PURE__ */ __name(function load(event2) { - this.loaded = true; - this.$emit("load", event2); - }, "load") - } -}; -function render$Q(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - ref: "container" - }, _ctx.ptmi("root")), [$data.loaded ? renderSlot(_ctx.$slots, "default", { - key: 0 - }) : createCommentVNode("", true)], 16); -} -__name(render$Q, "render$Q"); -script$W.render = render$Q; -var DynamicDialogEventBus = EventBus(); -var DialogService = { - install: /* @__PURE__ */ __name(function install(app) { - var DialogService2 = { - open: /* @__PURE__ */ __name(function open2(content, options4) { - var instance = { - content: content && markRaw(content), - options: options4 || {}, - data: options4 && options4.data, - close: /* @__PURE__ */ __name(function close2(params) { - DynamicDialogEventBus.emit("close", { - instance, - params - }); - }, "close") - }; - DynamicDialogEventBus.emit("open", { - instance - }); - return instance; - }, "open") - }; - app.config.globalProperties.$dialog = DialogService2; - app.provide(PrimeVueDialogSymbol, DialogService2); - }, "install") -}; -var theme$u = /* @__PURE__ */ __name(function theme9(_ref) { - var dt = _ref.dt; - return "\n.p-dock {\n position: absolute;\n z-index: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\n.p-dock-list-container {\n display: flex;\n pointer-events: auto;\n background: ".concat(dt("dock.background"), ";\n border: 1px solid ").concat(dt("dock.border.color"), ";\n padding: ").concat(dt("dock.padding"), ";\n border-radius: ").concat(dt("dock.border.radius"), ";\n}\n\n.p-dock-list {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n align-items: center;\n justify-content: center;\n outline: 0 none;\n}\n\n.p-dock-item {\n transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n will-change: transform;\n padding: ").concat(dt("dock.item.padding"), ";\n border-radius: ").concat(dt("dock.item.border.radius"), ";\n}\n\n.p-dock-item.p-focus {\n box-shadow: ").concat(dt("dock.item.focus.ring.shadow"), ";\n outline: ").concat(dt("dock.item.focus.ring.width"), " ").concat(dt("dock.item.focus.ring.style"), " ").concat(dt("dock.item.focus.ring.color"), ";\n outline-offset: ").concat(dt("dock.item.focus.ring.offset"), ";\n}\n\n.p-dock-item-link {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: relative;\n overflow: hidden;\n cursor: default;\n width: ").concat(dt("dock.item.size"), ";\n height: ").concat(dt("dock.item.size"), ";\n}\n\n.p-dock-top {\n left: 0;\n top: 0;\n width: 100%;\n}\n\n.p-dock-bottom {\n left: 0;\n bottom: 0;\n width: 100%;\n}\n\n.p-dock-right {\n right: 0;\n top: 0;\n height: 100%;\n}\n\n.p-dock-right .p-dock-list {\n flex-direction: column;\n}\n\n.p-dock-left {\n left: 0;\n top: 0;\n height: 100%;\n}\n\n.p-dock-left .p-dock-list {\n flex-direction: column;\n}\n\n.p-dock-mobile.p-dock-top .p-dock-list-container,\n.p-dock-mobile.p-dock-bottom .p-dock-list-container {\n overflow-x: auto;\n width: 100%;\n}\n\n.p-dock-mobile.p-dock-top .p-dock-list-container .p-dock-list,\n.p-dock-mobile.p-dock-bottom .p-dock-list-container .p-dock-list {\n margin: 0 auto;\n}\n\n.p-dock-mobile.p-dock-left .p-dock-list-container,\n.p-dock-mobile.p-dock-right .p-dock-list-container {\n overflow-y: auto;\n height: 100%;\n}\n\n.p-dock-mobile.p-dock-left .p-dock-list-container .p-dock-list,\n.p-dock-mobile.p-dock-right .p-dock-list-container .p-dock-list {\n margin: auto 0;\n}\n\n.p-dock-mobile .p-dock-list .p-dock-item {\n transform: none;\n margin: 0;\n}\n"); -}, "theme"); -var classes$y = { - root: /* @__PURE__ */ __name(function root9(_ref2) { - var instance = _ref2.instance, props = _ref2.props; - return ["p-dock p-component", "p-dock-".concat(props.position), { - "p-dock-mobile": instance.queryMatches - }]; - }, "root"), - listContainer: "p-dock-list-container", - list: "p-dock-list", - item: /* @__PURE__ */ __name(function item2(_ref3) { - var instance = _ref3.instance, processedItem = _ref3.processedItem, id4 = _ref3.id; - return ["p-dock-item", { - "p-focus": instance.isItemActive(id4), - "p-disabled": instance.disabled(processedItem) - }]; - }, "item"), - itemContent: "p-dock-item-content", - itemLink: "p-dock-item-link", - itemIcon: "p-dock-item-icon" -}; -var DockStyle = BaseStyle.extend({ - name: "dock", - theme: theme$u, - classes: classes$y -}); -var script$2$7 = { - name: "BaseDock", - "extends": script$1f, - props: { - position: { - type: String, - "default": "bottom" - }, - model: null, - "class": null, - style: null, - tooltipOptions: null, - menuId: { - type: String, - "default": null - }, - tabindex: { - type: Number, - "default": 0 - }, - breakpoint: { - type: String, - "default": "960px" - }, - ariaLabel: { - type: String, - "default": null - }, - ariaLabelledby: { - type: String, - "default": null - } - }, - style: DockStyle, - provide: /* @__PURE__ */ __name(function provide15() { - return { - $pcDock: this, - $parentInstance: this - }; - }, "provide") -}; -function _toConsumableArray$a(r) { - return _arrayWithoutHoles$a(r) || _iterableToArray$a(r) || _unsupportedIterableToArray$b(r) || _nonIterableSpread$a(); -} -__name(_toConsumableArray$a, "_toConsumableArray$a"); -function _nonIterableSpread$a() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableSpread$a, "_nonIterableSpread$a"); -function _unsupportedIterableToArray$b(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$b(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$b(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$b, "_unsupportedIterableToArray$b"); -function _iterableToArray$a(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$a, "_iterableToArray$a"); -function _arrayWithoutHoles$a(r) { - if (Array.isArray(r)) return _arrayLikeToArray$b(r); -} -__name(_arrayWithoutHoles$a, "_arrayWithoutHoles$a"); -function _arrayLikeToArray$b(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; -} -__name(_arrayLikeToArray$b, "_arrayLikeToArray$b"); -var script$1$z = { - name: "DockSub", - hostName: "Dock", - "extends": script$1f, - emits: ["focus", "blur"], - props: { - position: { - type: String, - "default": "bottom" - }, - model: { - type: Array, - "default": null - }, - templates: { - type: null, - "default": null - }, - tooltipOptions: null, - menuId: { - type: String, - "default": null - }, - tabindex: { - type: Number, - "default": 0 - }, - ariaLabel: { - type: String, - "default": null - }, - ariaLabelledby: { - type: String, - "default": null - } - }, - data: /* @__PURE__ */ __name(function data8() { - return { - id: this.menuId, - currentIndex: -3, - focused: false, - focusedOptionIndex: -1 - }; - }, "data"), - watch: { - menuId: /* @__PURE__ */ __name(function menuId(newValue) { - this.id = newValue || UniqueComponentId(); - }, "menuId") - }, - mounted: /* @__PURE__ */ __name(function mounted13() { - this.id = this.id || UniqueComponentId(); - }, "mounted"), - methods: { - getItemId: /* @__PURE__ */ __name(function getItemId(index) { - return "".concat(this.id, "_").concat(index); - }, "getItemId"), - getItemProp: /* @__PURE__ */ __name(function getItemProp(processedItem, name4) { - return processedItem && processedItem.item ? resolve(processedItem.item[name4]) : void 0; - }, "getItemProp"), - getPTOptions: /* @__PURE__ */ __name(function getPTOptions2(key, item8, index) { - return this.ptm(key, { - context: { - index, - item: item8, - active: this.isItemActive(this.getItemId(index)) - } - }); - }, "getPTOptions"), - isSameMenuItem: /* @__PURE__ */ __name(function isSameMenuItem(event2) { - return event2.currentTarget && (event2.currentTarget.isSameNode(event2.target) || event2.currentTarget.isSameNode(event2.target.closest('[data-pc-section="item"]'))); - }, "isSameMenuItem"), - isItemActive: /* @__PURE__ */ __name(function isItemActive2(id4) { - return id4 === this.focusedOptionIndex; - }, "isItemActive"), - onListMouseLeave: /* @__PURE__ */ __name(function onListMouseLeave() { - this.currentIndex = -3; - }, "onListMouseLeave"), - onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter(index) { - this.currentIndex = index; - }, "onItemMouseEnter"), - onItemClick: /* @__PURE__ */ __name(function onItemClick(event2, processedItem) { - if (this.isSameMenuItem(event2)) { - var command = this.getItemProp(processedItem, "command"); - command && command({ - originalEvent: event2, - item: processedItem.item - }); - } - }, "onItemClick"), - onListFocus: /* @__PURE__ */ __name(function onListFocus(event2) { - this.focused = true; - this.changeFocusedOptionIndex(0); - this.$emit("focus", event2); - }, "onListFocus"), - onListBlur: /* @__PURE__ */ __name(function onListBlur(event2) { - this.focused = false; - this.focusedOptionIndex = -1; - this.$emit("blur", event2); - }, "onListBlur"), - onListKeyDown: /* @__PURE__ */ __name(function onListKeyDown(event2) { - switch (event2.code) { - case "ArrowDown": { - if (this.position === "left" || this.position === "right") this.onArrowDownKey(); - event2.preventDefault(); - break; - } - case "ArrowUp": { - if (this.position === "left" || this.position === "right") this.onArrowUpKey(); - event2.preventDefault(); - break; - } - case "ArrowRight": { - if (this.position === "top" || this.position === "bottom") this.onArrowDownKey(); - event2.preventDefault(); - break; - } - case "ArrowLeft": { - if (this.position === "top" || this.position === "bottom") this.onArrowUpKey(); - event2.preventDefault(); - break; - } - case "Home": { - this.onHomeKey(); - event2.preventDefault(); - break; - } - case "End": { - this.onEndKey(); - event2.preventDefault(); - break; - } - case "Enter": - case "NumpadEnter": - case "Space": { - this.onSpaceKey(event2); - event2.preventDefault(); - break; - } - } - }, "onListKeyDown"), - onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey3() { - var optionIndex = this.findNextOptionIndex(this.focusedOptionIndex); - this.changeFocusedOptionIndex(optionIndex); - }, "onArrowDownKey"), - onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey3() { - var optionIndex = this.findPrevOptionIndex(this.focusedOptionIndex); - this.changeFocusedOptionIndex(optionIndex); - }, "onArrowUpKey"), - onHomeKey: /* @__PURE__ */ __name(function onHomeKey3() { - this.changeFocusedOptionIndex(0); - }, "onHomeKey"), - onEndKey: /* @__PURE__ */ __name(function onEndKey3() { - this.changeFocusedOptionIndex(find(this.$refs.list, 'li[data-pc-section="item"][data-p-disabled="false"]').length - 1); - }, "onEndKey"), - onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey2() { - var element = findSingle(this.$refs.list, 'li[id="'.concat("".concat(this.focusedOptionIndex), '"]')); - var anchorElement = element && findSingle(element, '[data-pc-section="itemlink"]'); - anchorElement ? anchorElement.click() : element && element.click(); - }, "onSpaceKey"), - findNextOptionIndex: /* @__PURE__ */ __name(function findNextOptionIndex2(index) { - var menuitems = find(this.$refs.list, 'li[data-pc-section="item"][data-p-disabled="false"]'); - var matchedOptionIndex = _toConsumableArray$a(menuitems).findIndex(function(link) { - return link.id === index; - }); - return matchedOptionIndex > -1 ? matchedOptionIndex + 1 : 0; - }, "findNextOptionIndex"), - findPrevOptionIndex: /* @__PURE__ */ __name(function findPrevOptionIndex2(index) { - var menuitems = find(this.$refs.list, 'li[data-pc-section="item"][data-p-disabled="false"]'); - var matchedOptionIndex = _toConsumableArray$a(menuitems).findIndex(function(link) { - return link.id === index; - }); - return matchedOptionIndex > -1 ? matchedOptionIndex - 1 : 0; - }, "findPrevOptionIndex"), - changeFocusedOptionIndex: /* @__PURE__ */ __name(function changeFocusedOptionIndex2(index) { - var menuitems = find(this.$refs.list, 'li[data-pc-section="item"][data-p-disabled="false"]'); - var order = index >= menuitems.length ? menuitems.length - 1 : index < 0 ? 0 : index; - this.focusedOptionIndex = menuitems[order].getAttribute("id"); - }, "changeFocusedOptionIndex"), - disabled: /* @__PURE__ */ __name(function disabled2(item8) { - return typeof item8.disabled === "function" ? item8.disabled() : item8.disabled; - }, "disabled"), - getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps2(item8, index) { - return { - action: mergeProps({ - tabindex: -1, - "class": this.cx("itemLink") - }, this.getPTOptions("itemLink", item8, index)), - icon: mergeProps({ - "class": [this.cx("itemIcon"), item8.icon] - }, this.getPTOptions("itemIcon", item8, index)) - }; - }, "getMenuItemProps") - }, - computed: { - focusedOptionId: /* @__PURE__ */ __name(function focusedOptionId3() { - return this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : null; - }, "focusedOptionId") - }, - directives: { - ripple: Ripple, - tooltip: Tooltip - } -}; -var _hoisted_1$p = ["id", "aria-orientation", "aria-activedescendant", "tabindex", "aria-label", "aria-labelledby"]; -var _hoisted_2$i = ["id", "aria-label", "aria-disabled", "onClick", "onMouseenter", "data-p-focused", "data-p-disabled"]; -var _hoisted_3$f = ["href", "target"]; -function render$1$7(_ctx, _cache, $props, $setup, $data, $options) { - var _directive_ripple = resolveDirective("ripple"); - var _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("listContainer") - }, _ctx.ptm("listContainer")), [createBaseVNode("ul", mergeProps({ - ref: "list", - id: $data.id, - "class": _ctx.cx("list"), - role: "menu", - "aria-orientation": $props.position === "bottom" || $props.position === "top" ? "horizontal" : "vertical", - "aria-activedescendant": $data.focused ? $options.focusedOptionId : void 0, - tabindex: $props.tabindex, - "aria-label": $props.ariaLabel, - "aria-labelledby": $props.ariaLabelledby, - onFocus: _cache[0] || (_cache[0] = function() { - return $options.onListFocus && $options.onListFocus.apply($options, arguments); - }), - onBlur: _cache[1] || (_cache[1] = function() { - return $options.onListBlur && $options.onListBlur.apply($options, arguments); - }), - onKeydown: _cache[2] || (_cache[2] = function() { - return $options.onListKeyDown && $options.onListKeyDown.apply($options, arguments); - }), - onMouseleave: _cache[3] || (_cache[3] = function() { - return $options.onListMouseLeave && $options.onListMouseLeave.apply($options, arguments); - }) - }, _ctx.ptm("list")), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.model, function(processedItem, index) { - return openBlock(), createElementBlock("li", mergeProps({ - key: index, - id: $options.getItemId(index), - "class": _ctx.cx("item", { - processedItem, - id: $options.getItemId(index) - }), - role: "menuitem", - "aria-label": processedItem.label, - "aria-disabled": $options.disabled(processedItem), - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return $options.onItemClick($event, processedItem); - }, "onClick"), - onMouseenter: /* @__PURE__ */ __name(function onMouseenter($event) { - return $options.onItemMouseEnter(index); - }, "onMouseenter"), - ref_for: true - }, $options.getPTOptions("item", processedItem, index), { - "data-p-focused": $options.isItemActive($options.getItemId(index)), - "data-p-disabled": $options.disabled(processedItem) || false - }), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("itemContent"), - ref_for: true - }, $options.getPTOptions("itemContent", processedItem, index)), [!$props.templates["item"] ? withDirectives((openBlock(), createElementBlock("a", mergeProps({ - key: 0, - href: processedItem.url, - "class": _ctx.cx("itemLink"), - target: processedItem.target, - tabindex: "-1", - "aria-hidden": "true", - ref_for: true - }, $options.getPTOptions("itemLink", processedItem, index)), [!$props.templates["icon"] && !$props.templates["itemicon"] ? withDirectives((openBlock(), createElementBlock("span", mergeProps({ - key: 0, - "class": [_ctx.cx("itemIcon"), processedItem.icon], - ref_for: true - }, $options.getPTOptions("itemIcon", processedItem, index)), null, 16)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates["icon"] || $props.templates["itemicon"]), { - key: 1, - item: processedItem, - "class": normalizeClass(_ctx.cx("itemIcon")) - }, null, 8, ["item", "class"]))], 16, _hoisted_3$f)), [[_directive_tooltip, { - value: processedItem.label, - disabled: !$props.tooltipOptions - }, $props.tooltipOptions]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates["item"]), { - key: 1, - item: processedItem, - index, - label: processedItem.label, - props: $options.getMenuItemProps(processedItem, index) - }, null, 8, ["item", "index", "label", "props"]))], 16)], 16, _hoisted_2$i); - }), 128))], 16, _hoisted_1$p)], 16); -} -__name(render$1$7, "render$1$7"); -script$1$z.render = render$1$7; -var script$V = { - name: "Dock", - "extends": script$2$7, - inheritAttrs: false, - matchMediaListener: null, - data: /* @__PURE__ */ __name(function data9() { - return { - query: null, - queryMatches: false - }; - }, "data"), - mounted: /* @__PURE__ */ __name(function mounted14() { - this.bindMatchMediaListener(); - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount4() { - this.unbindMatchMediaListener(); - }, "beforeUnmount"), - methods: { - bindMatchMediaListener: /* @__PURE__ */ __name(function bindMatchMediaListener3() { - var _this = this; - if (!this.matchMediaListener) { - var query = matchMedia("(max-width: ".concat(this.breakpoint, ")")); - this.query = query; - this.queryMatches = query.matches; - this.matchMediaListener = function() { - _this.queryMatches = query.matches; - _this.mobileActive = false; - }; - this.query.addEventListener("change", this.matchMediaListener); - } - }, "bindMatchMediaListener"), - unbindMatchMediaListener: /* @__PURE__ */ __name(function unbindMatchMediaListener3() { - if (this.matchMediaListener) { - this.query.removeEventListener("change", this.matchMediaListener); - this.matchMediaListener = null; - } - }, "unbindMatchMediaListener") - }, - computed: { - containerClass: /* @__PURE__ */ __name(function containerClass() { - return [this["class"], this.cx("root")]; - }, "containerClass") - }, - components: { - DockSub: script$1$z - } -}; -function render$P(_ctx, _cache, $props, $setup, $data, $options) { - var _component_DockSub = resolveComponent("DockSub"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": $options.containerClass, - style: _ctx.style - }, _ctx.ptmi("root")), [createVNode(_component_DockSub, { - model: _ctx.model, - templates: _ctx.$slots, - tooltipOptions: _ctx.tooltipOptions, - position: _ctx.position, - menuId: _ctx.menuId, - "aria-label": _ctx.ariaLabel, - "aria-labelledby": _ctx.ariaLabelledby, - tabindex: _ctx.tabindex, - pt: _ctx.pt, - unstyled: _ctx.unstyled - }, null, 8, ["model", "templates", "tooltipOptions", "position", "menuId", "aria-label", "aria-labelledby", "tabindex", "pt", "unstyled"])], 16); -} -__name(render$P, "render$P"); -script$V.render = render$P; -var script$U = { - name: "Dropdown", - "extends": script$1u, - mounted: /* @__PURE__ */ __name(function mounted15() { - console.warn("Deprecated since v4. Use Select component instead."); - }, "mounted") -}; -var DropdownStyle = BaseStyle.extend({ - name: "dropdown" -}); -var DynamicDialogStyle = BaseStyle.extend({ - name: "dynamicdialog" -}); -var script$1$y = { - name: "BaseDynamicDialog", - "extends": script$1f, - props: {}, - style: DynamicDialogStyle, - provide: /* @__PURE__ */ __name(function provide16() { - return { - $pcDynamicDialog: this, - $parentInstance: this - }; - }, "provide") -}; -var script$T = { - name: "DynamicDialog", - "extends": script$1$y, - inheritAttrs: false, - data: /* @__PURE__ */ __name(function data10() { - return { - instanceMap: {} - }; - }, "data"), - openListener: null, - closeListener: null, - currentInstance: null, - mounted: /* @__PURE__ */ __name(function mounted16() { - var _this = this; - this.openListener = function(_ref) { - var instance = _ref.instance; - var key = UniqueComponentId() + "_dynamic_dialog"; - instance.visible = true; - instance.key = key; - _this.instanceMap[key] = instance; - }; - this.closeListener = function(_ref2) { - var instance = _ref2.instance, params = _ref2.params; - var key = instance.key; - var currentInstance = _this.instanceMap[key]; - if (currentInstance) { - currentInstance.visible = false; - currentInstance.options.onClose && currentInstance.options.onClose({ - data: params, - type: "config-close" - }); - _this.currentInstance = currentInstance; - } - }; - DynamicDialogEventBus.on("open", this.openListener); - DynamicDialogEventBus.on("close", this.closeListener); - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount5() { - DynamicDialogEventBus.off("open", this.openListener); - DynamicDialogEventBus.off("close", this.closeListener); - }, "beforeUnmount"), - methods: { - onDialogHide: /* @__PURE__ */ __name(function onDialogHide(instance) { - !this.currentInstance && instance.options.onClose && instance.options.onClose({ - type: "dialog-close" - }); - delete this.instanceMap[instance.key]; - }, "onDialogHide"), - onDialogAfterHide: /* @__PURE__ */ __name(function onDialogAfterHide() { - this.currentInstance && delete this.currentInstance; - this.currentInstance = null; - }, "onDialogAfterHide"), - getTemplateItems: /* @__PURE__ */ __name(function getTemplateItems(template) { - return Array.isArray(template) ? template : [template]; - }, "getTemplateItems") - }, - components: { - DDialog: script$1v - } -}; -function render$O(_ctx, _cache, $props, $setup, $data, $options) { - var _component_DDialog = resolveComponent("DDialog"); - return openBlock(true), createElementBlock(Fragment, null, renderList($data.instanceMap, function(instance, key) { - return openBlock(), createBlock(_component_DDialog, mergeProps({ - key, - visible: instance.visible, - "onUpdate:visible": /* @__PURE__ */ __name(function onUpdateVisible($event) { - return instance.visible = $event; - }, "onUpdateVisible"), - _instance: instance, - ref_for: true - }, instance.options.props, { - onHide: /* @__PURE__ */ __name(function onHide($event) { - return $options.onDialogHide(instance); - }, "onHide"), - onAfterHide: $options.onDialogAfterHide - }), createSlots({ - "default": withCtx(function() { - return [(openBlock(), createBlock(resolveDynamicComponent(instance.content), mergeProps({ - ref_for: true - }, instance.options.emits), null, 16))]; - }), - _: 2 - }, [instance.options.templates && instance.options.templates.header ? { - name: "header", - fn: withCtx(function() { - return [(openBlock(true), createElementBlock(Fragment, null, renderList($options.getTemplateItems(instance.options.templates.header), function(header2, index) { - return openBlock(), createBlock(resolveDynamicComponent(header2), mergeProps({ - key: index + "_header", - ref_for: true - }, instance.options.emits), null, 16); - }), 128))]; - }), - key: "0" - } : void 0, instance.options.templates && instance.options.templates.footer ? { - name: "footer", - fn: withCtx(function() { - return [(openBlock(true), createElementBlock(Fragment, null, renderList($options.getTemplateItems(instance.options.templates.footer), function(footer, index) { - return openBlock(), createBlock(resolveDynamicComponent(footer), mergeProps({ - key: index + "_footer", - ref_for: true - }, instance.options.emits), null, 16); - }), 128))]; - }), - key: "1" - } : void 0]), 1040, ["visible", "onUpdate:visible", "_instance", "onHide", "onAfterHide"]); - }), 128); -} -__name(render$O, "render$O"); -script$T.render = render$O; -var theme$t = /* @__PURE__ */ __name(function theme10(_ref) { - var dt = _ref.dt; - return "\n.p-fieldset {\n background: ".concat(dt("fieldset.background"), ";\n border: 1px solid ").concat(dt("fieldset.border.color"), ";\n border-radius: ").concat(dt("fieldset.border.radius"), ";\n color: ").concat(dt("fieldset.color"), ";\n padding: ").concat(dt("fieldset.padding"), ";\n margin: 0;\n}\n\n.p-fieldset-legend {\n background: ").concat(dt("fieldset.legend.background"), ";\n border-radius: ").concat(dt("fieldset.legend.border.radius"), ";\n border-width: ").concat(dt("fieldset.legend.border.width"), ";\n border-style: solid;\n border-color: ").concat(dt("fieldset.legend.border.color"), ";\n padding: ").concat(dt("fieldset.legend.padding"), ";\n transition: background ").concat(dt("fieldset.transition.duration"), ", color ").concat(dt("fieldset.transition.duration"), ", outline-color ").concat(dt("fieldset.transition.duration"), ", box-shadow ").concat(dt("fieldset.transition.duration"), ";\n}\n\n.p-fieldset-toggleable > .p-fieldset-legend {\n padding: 0;\n}\n\n.p-fieldset-toggle-button {\n cursor: pointer;\n user-select: none;\n overflow: hidden;\n position: relative;\n text-decoration: none;\n display: flex;\n gap: ").concat(dt("fieldset.legend.gap"), ";\n align-items: center;\n justify-content: center;\n padding: ").concat(dt("fieldset.legend.padding"), ";\n background: transparent;\n border: 0 none;\n border-radius: ").concat(dt("fieldset.legend.border.radius"), ";\n transition: background ").concat(dt("fieldset.transition.duration"), ", color ").concat(dt("fieldset.transition.duration"), ", outline-color ").concat(dt("fieldset.transition.duration"), ", box-shadow ").concat(dt("fieldset.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-fieldset-legend-label {\n font-weight: ").concat(dt("fieldset.legend.font.weight"), ";\n}\n\n.p-fieldset-toggle-button:focus-visible {\n box-shadow: ").concat(dt("fieldset.legend.focus.ring.shadow"), ";\n outline: ").concat(dt("fieldset.legend.focus.ring.width"), " ").concat(dt("fieldset.legend.focus.ring.style"), " ").concat(dt("fieldset.legend.focus.ring.color"), ";\n outline-offset: ").concat(dt("fieldset.legend.focus.ring.offset"), ";\n}\n\n.p-fieldset-toggleable > .p-fieldset-legend:hover {\n color: ").concat(dt("fieldset.legend.hover.color"), ";\n background: ").concat(dt("fieldset.legend.hover.background"), ";\n}\n\n.p-fieldset-toggle-icon {\n color: ").concat(dt("fieldset.toggle.icon.color"), ";\n transition: color ").concat(dt("fieldset.transition.duration"), ";\n}\n\n.p-fieldset-toggleable > .p-fieldset-legend:hover .p-fieldset-toggle-icon {\n color: ").concat(dt("fieldset.toggle.icon.hover.color"), ";\n}\n\n.p-fieldset .p-fieldset-content {\n padding: ").concat(dt("fieldset.content.padding"), ";\n}\n"); -}, "theme"); -var classes$x = { - root: /* @__PURE__ */ __name(function root10(_ref2) { - var props = _ref2.props; - return ["p-fieldset p-component", { - "p-fieldset-toggleable": props.toggleable - }]; - }, "root"), - legend: "p-fieldset-legend", - legendLabel: "p-fieldset-legend-label", - toggleButton: "p-fieldset-toggle-button", - toggleIcon: "p-fieldset-toggle-icon", - contentContainer: "p-fieldset-content-container", - content: "p-fieldset-content" -}; -var FieldsetStyle = BaseStyle.extend({ - name: "fieldset", - theme: theme$t, - classes: classes$x -}); -var script$1$x = { - name: "BaseFieldset", - "extends": script$1f, - props: { - legend: String, - toggleable: Boolean, - collapsed: Boolean, - toggleButtonProps: { - type: null, - "default": null - } - }, - style: FieldsetStyle, - provide: /* @__PURE__ */ __name(function provide17() { - return { - $pcFieldset: this, - $parentInstance: this - }; - }, "provide") -}; -var script$S = { - name: "Fieldset", - "extends": script$1$x, - inheritAttrs: false, - emits: ["update:collapsed", "toggle"], - data: /* @__PURE__ */ __name(function data11() { - return { - id: this.$attrs.id, - d_collapsed: this.collapsed - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId4(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId"), - collapsed: /* @__PURE__ */ __name(function collapsed(newValue) { - this.d_collapsed = newValue; - }, "collapsed") - }, - mounted: /* @__PURE__ */ __name(function mounted17() { - this.id = this.id || UniqueComponentId(); - }, "mounted"), - methods: { - toggle: /* @__PURE__ */ __name(function toggle(event2) { - this.d_collapsed = !this.d_collapsed; - this.$emit("update:collapsed", this.d_collapsed); - this.$emit("toggle", { - originalEvent: event2, - value: this.d_collapsed - }); - }, "toggle"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown4(event2) { - if (event2.code === "Enter" || event2.code === "NumpadEnter" || event2.code === "Space") { - this.toggle(event2); - event2.preventDefault(); - } - }, "onKeyDown") - }, - computed: { - buttonAriaLabel: /* @__PURE__ */ __name(function buttonAriaLabel() { - return this.toggleButtonProps && this.toggleButtonProps.ariaLabel ? this.toggleButtonProps.ariaLabel : this.legend; - }, "buttonAriaLabel") - }, - directives: { - ripple: Ripple - }, - components: { - PlusIcon: script$1w, - MinusIcon: script$1x - } -}; -function _typeof$i(o) { - "@babel/helpers - typeof"; - return _typeof$i = "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$i(o); -} -__name(_typeof$i, "_typeof$i"); -function ownKeys$g(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$g, "ownKeys$g"); -function _objectSpread$g(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$g(Object(t2), true).forEach(function(r2) { - _defineProperty$h(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$g(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$g, "_objectSpread$g"); -function _defineProperty$h(e, r, t2) { - return (r = _toPropertyKey$h(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$h, "_defineProperty$h"); -function _toPropertyKey$h(t2) { - var i = _toPrimitive$h(t2, "string"); - return "symbol" == _typeof$i(i) ? i : i + ""; -} -__name(_toPropertyKey$h, "_toPropertyKey$h"); -function _toPrimitive$h(t2, r) { - if ("object" != _typeof$i(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$i(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$h, "_toPrimitive$h"); -var _hoisted_1$o = ["id"]; -var _hoisted_2$h = ["id", "aria-controls", "aria-expanded", "aria-label"]; -var _hoisted_3$e = ["id", "aria-labelledby"]; -function render$N(_ctx, _cache, $props, $setup, $data, $options) { - var _directive_ripple = resolveDirective("ripple"); - return openBlock(), createElementBlock("fieldset", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [createBaseVNode("legend", mergeProps({ - "class": _ctx.cx("legend") - }, _ctx.ptm("legend")), [renderSlot(_ctx.$slots, "legend", { - toggleCallback: $options.toggle - }, function() { - return [!_ctx.toggleable ? (openBlock(), createElementBlock("span", mergeProps({ - key: 0, - id: $data.id + "_header", - "class": _ctx.cx("legendLabel") - }, _ctx.ptm("legendLabel")), toDisplayString(_ctx.legend), 17, _hoisted_1$o)) : createCommentVNode("", true), _ctx.toggleable ? withDirectives((openBlock(), createElementBlock("button", mergeProps({ - key: 1, - id: $data.id + "_header", - type: "button", - "aria-controls": $data.id + "_content", - "aria-expanded": !$data.d_collapsed, - "aria-label": $options.buttonAriaLabel, - "class": _ctx.cx("toggleButton"), - onClick: _cache[0] || (_cache[0] = function() { - return $options.toggle && $options.toggle.apply($options, arguments); - }), - onKeydown: _cache[1] || (_cache[1] = function() { - return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); - }) - }, _objectSpread$g(_objectSpread$g({}, _ctx.toggleButtonProps), _ctx.ptm("toggleButton"))), [renderSlot(_ctx.$slots, _ctx.$slots.toggleicon ? "toggleicon" : "togglericon", { - collapsed: $data.d_collapsed, - "class": normalizeClass(_ctx.cx("toggleIcon")) - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent($data.d_collapsed ? "PlusIcon" : "MinusIcon"), mergeProps({ - "class": _ctx.cx("toggleIcon") - }, _ctx.ptm("toggleIcon")), null, 16, ["class"]))]; - }), createBaseVNode("span", mergeProps({ - "class": _ctx.cx("legendLabel") - }, _ctx.ptm("legendLabel")), toDisplayString(_ctx.legend), 17)], 16, _hoisted_2$h)), [[_directive_ripple]]) : createCommentVNode("", true)]; - })], 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)], 16, _hoisted_3$e), [[vShow, !$data.d_collapsed]])]; - }), - _: 3 - }, 16)], 16); -} -__name(render$N, "render$N"); -script$S.render = render$N; -var script$R = { - name: "UploadIcon", - "extends": script$1j -}; -function render$M(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M6.58942 9.82197C6.70165 9.93405 6.85328 9.99793 7.012 10C7.17071 9.99793 7.32234 9.93405 7.43458 9.82197C7.54681 9.7099 7.61079 9.55849 7.61286 9.4V2.04798L9.79204 4.22402C9.84752 4.28011 9.91365 4.32457 9.98657 4.35479C10.0595 4.38502 10.1377 4.40039 10.2167 4.40002C10.2956 4.40039 10.3738 4.38502 10.4467 4.35479C10.5197 4.32457 10.5858 4.28011 10.6413 4.22402C10.7538 4.11152 10.817 3.95902 10.817 3.80002C10.817 3.64102 10.7538 3.48852 10.6413 3.37602L7.45127 0.190618C7.44656 0.185584 7.44176 0.180622 7.43687 0.175736C7.32419 0.063214 7.17136 0 7.012 0C6.85264 0 6.69981 0.063214 6.58712 0.175736C6.58181 0.181045 6.5766 0.186443 6.5715 0.191927L3.38282 3.37602C3.27669 3.48976 3.2189 3.6402 3.22165 3.79564C3.2244 3.95108 3.28746 4.09939 3.39755 4.20932C3.50764 4.31925 3.65616 4.38222 3.81182 4.38496C3.96749 4.3877 4.11814 4.33001 4.23204 4.22402L6.41113 2.04807V9.4C6.41321 9.55849 6.47718 9.7099 6.58942 9.82197ZM11.9952 14H2.02883C1.751 13.9887 1.47813 13.9228 1.22584 13.8061C0.973545 13.6894 0.746779 13.5241 0.558517 13.3197C0.370254 13.1154 0.22419 12.876 0.128681 12.6152C0.0331723 12.3545 -0.00990605 12.0775 0.0019109 11.8V9.40005C0.0019109 9.24092 0.065216 9.08831 0.1779 8.97579C0.290584 8.86326 0.443416 8.80005 0.602775 8.80005C0.762134 8.80005 0.914966 8.86326 1.02765 8.97579C1.14033 9.08831 1.20364 9.24092 1.20364 9.40005V11.8C1.18295 12.0376 1.25463 12.274 1.40379 12.4602C1.55296 12.6463 1.76817 12.7681 2.00479 12.8H11.9952C12.2318 12.7681 12.447 12.6463 12.5962 12.4602C12.7453 12.274 12.817 12.0376 12.7963 11.8V9.40005C12.7963 9.24092 12.8596 9.08831 12.9723 8.97579C13.085 8.86326 13.2378 8.80005 13.3972 8.80005C13.5565 8.80005 13.7094 8.86326 13.8221 8.97579C13.9347 9.08831 13.998 9.24092 13.998 9.40005V11.8C14.022 12.3563 13.8251 12.8996 13.45 13.3116C13.0749 13.7236 12.552 13.971 11.9952 14Z", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$M, "render$M"); -script$R.render = render$M; -var theme$s = /* @__PURE__ */ __name(function theme11(_ref) { - var dt = _ref.dt; - return '\n.p-fileupload input[type="file"] {\n display: none;\n}\n\n.p-fileupload-advanced {\n border: 1px solid '.concat(dt("fileupload.border.color"), ";\n border-radius: ").concat(dt("fileupload.border.radius"), ";\n background: ").concat(dt("fileupload.background"), ";\n color: ").concat(dt("fileupload.color"), ";\n}\n\n.p-fileupload-header {\n display: flex;\n align-items: center;\n padding: ").concat(dt("fileupload.header.padding"), ";\n background: ").concat(dt("fileupload.header.background"), ";\n color: ").concat(dt("fileupload.header.color"), ";\n border-style: solid;\n border-width: ").concat(dt("fileupload.header.border.width"), ";\n border-color: ").concat(dt("fileupload.header.border.color"), ";\n border-radius: ").concat(dt("fileupload.header.border.radius"), ";\n gap: ").concat(dt("fileupload.header.gap"), ";\n}\n\n.p-fileupload-content {\n border: 1px solid transparent;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("fileupload.content.gap"), ";\n transition: border-color ").concat(dt("fileupload.transition.duration"), ";\n padding: ").concat(dt("fileupload.content.padding"), ";\n}\n\n.p-fileupload-content .p-progressbar {\n width: 100%;\n height: ").concat(dt("fileupload.progressbar.height"), ";\n}\n\n.p-fileupload-file-list {\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("fileupload.filelist.gap"), ";\n}\n\n.p-fileupload-file {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n padding: ").concat(dt("fileupload.file.padding"), ";\n border-block-end: 1px solid ").concat(dt("fileupload.file.border.color"), ";\n gap: ").concat(dt("fileupload.file.gap"), ";\n}\n\n.p-fileupload-file:last-child {\n border-block-end: 0;\n}\n\n.p-fileupload-file-info {\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("fileupload.file.info.gap"), ";\n}\n\n.p-fileupload-file-thumbnail {\n flex-shrink: 0;\n}\n\n.p-fileupload-file-actions {\n margin-inline-start: auto;\n}\n\n.p-fileupload-highlight {\n border: 1px dashed ").concat(dt("fileupload.content.highlight.border.color"), ";\n}\n\n.p-fileupload-basic {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n gap: ").concat(dt("fileupload.basic.gap"), ";\n}\n"); -}, "theme"); -var classes$w = { - root: /* @__PURE__ */ __name(function root11(_ref2) { - var props = _ref2.props; - return ["p-fileupload p-fileupload-".concat(props.mode, " p-component")]; - }, "root"), - header: "p-fileupload-header", - pcChooseButton: "p-fileupload-choose-button", - pcUploadButton: "p-fileupload-upload-button", - pcCancelButton: "p-fileupload-cancel-button", - content: "p-fileupload-content", - fileList: "p-fileupload-file-list", - file: "p-fileupload-file", - fileThumbnail: "p-fileupload-file-thumbnail", - fileInfo: "p-fileupload-file-info", - fileName: "p-fileupload-file-name", - fileSize: "p-fileupload-file-size", - pcFileBadge: "p-fileupload-file-badge", - fileActions: "p-fileupload-file-actions", - pcFileRemoveButton: "p-fileupload-file-remove-button" -}; -var FileUploadStyle = BaseStyle.extend({ - name: "fileupload", - theme: theme$s, - classes: classes$w -}); -var script$2$6 = { - name: "BaseFileUpload", - "extends": script$1f, - props: { - name: { - type: String, - "default": null - }, - url: { - type: String, - "default": null - }, - mode: { - type: String, - "default": "advanced" - }, - multiple: { - type: Boolean, - "default": false - }, - accept: { - type: String, - "default": null - }, - disabled: { - type: Boolean, - "default": false - }, - auto: { - type: Boolean, - "default": false - }, - maxFileSize: { - type: Number, - "default": null - }, - invalidFileSizeMessage: { - type: String, - "default": "{0}: Invalid file size, file size should be smaller than {1}." - }, - invalidFileTypeMessage: { - type: String, - "default": "{0}: Invalid file type, allowed file types: {1}." - }, - fileLimit: { - type: Number, - "default": null - }, - invalidFileLimitMessage: { - type: String, - "default": "Maximum number of files exceeded, limit is {0} at most." - }, - withCredentials: { - type: Boolean, - "default": false - }, - previewWidth: { - type: Number, - "default": 50 - }, - chooseLabel: { - type: String, - "default": null - }, - uploadLabel: { - type: String, - "default": null - }, - cancelLabel: { - type: String, - "default": null - }, - customUpload: { - type: Boolean, - "default": false - }, - showUploadButton: { - type: Boolean, - "default": true - }, - showCancelButton: { - type: Boolean, - "default": true - }, - chooseIcon: { - type: String, - "default": void 0 - }, - uploadIcon: { - type: String, - "default": void 0 - }, - cancelIcon: { - type: String, - "default": void 0 - }, - style: null, - "class": null, - chooseButtonProps: { - type: null, - "default": null - }, - uploadButtonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default6() { - return { - severity: "secondary" - }; - }, "_default") - }, - cancelButtonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default7() { - return { - severity: "secondary" - }; - }, "_default") - } - }, - style: FileUploadStyle, - provide: /* @__PURE__ */ __name(function provide18() { - return { - $pcFileUpload: this, - $parentInstance: this - }; - }, "provide") -}; -var script$1$w = { - name: "FileContent", - hostName: "FileUpload", - "extends": script$1f, - emits: ["remove"], - props: { - files: { - type: Array, - "default": /* @__PURE__ */ __name(function _default8() { - return []; - }, "_default") - }, - badgeSeverity: { - type: String, - "default": "warn" - }, - badgeValue: { - type: String, - "default": null - }, - previewWidth: { - type: Number, - "default": 50 - }, - templates: { - type: null, - "default": null - } - }, - methods: { - formatSize: /* @__PURE__ */ __name(function formatSize(bytes) { - var _this$$primevue$confi; - var k = 1024; - var dm = 3; - var sizes = ((_this$$primevue$confi = this.$primevue.config.locale) === null || _this$$primevue$confi === void 0 ? void 0 : _this$$primevue$confi.fileSizeTypes) || ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; - if (bytes === 0) { - return "0 ".concat(sizes[0]); - } - var i = Math.floor(Math.log(bytes) / Math.log(k)); - var formattedSize = parseFloat((bytes / Math.pow(k, i)).toFixed(dm)); - return "".concat(formattedSize, " ").concat(sizes[i]); - }, "formatSize") - }, - components: { - Button: script$1d, - Badge: script$1y, - TimesIcon: script$1q - } -}; -var _hoisted_1$1$5 = ["alt", "src", "width"]; -function render$1$6(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Badge = resolveComponent("Badge"); - var _component_TimesIcon = resolveComponent("TimesIcon"); - var _component_Button = resolveComponent("Button"); - return openBlock(true), createElementBlock(Fragment, null, renderList($props.files, function(file, index) { - return openBlock(), createElementBlock("div", mergeProps({ - key: file.name + file.type + file.size, - "class": _ctx.cx("file"), - ref_for: true - }, _ctx.ptm("file")), [createBaseVNode("img", mergeProps({ - role: "presentation", - "class": _ctx.cx("fileThumbnail"), - alt: file.name, - src: file.objectURL, - width: $props.previewWidth, - ref_for: true - }, _ctx.ptm("fileThumbnail")), null, 16, _hoisted_1$1$5), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("fileInfo"), - ref_for: true - }, _ctx.ptm("fileInfo")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("fileName"), - ref_for: true - }, _ctx.ptm("fileName")), toDisplayString(file.name), 17), createBaseVNode("span", mergeProps({ - "class": _ctx.cx("fileSize"), - ref_for: true - }, _ctx.ptm("fileSize")), toDisplayString($options.formatSize(file.size)), 17)], 16), createVNode(_component_Badge, { - value: $props.badgeValue, - "class": normalizeClass(_ctx.cx("pcFileBadge")), - severity: $props.badgeSeverity, - unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcFileBadge") - }, null, 8, ["value", "class", "severity", "unstyled", "pt"]), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("fileActions"), - ref_for: true - }, _ctx.ptm("fileActions")), [createVNode(_component_Button, { - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return _ctx.$emit("remove", index); - }, "onClick"), - text: "", - rounded: "", - severity: "danger", - "class": normalizeClass(_ctx.cx("pcFileRemoveButton")), - unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcFileRemoveButton") - }, { - icon: withCtx(function(iconProps) { - return [$props.templates.fileremoveicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.fileremoveicon), { - key: 0, - "class": normalizeClass(iconProps["class"]), - file, - index - }, null, 8, ["class", "file", "index"])) : (openBlock(), createBlock(_component_TimesIcon, mergeProps({ - key: 1, - "class": iconProps["class"], - "aria-hidden": "true", - ref_for: true - }, _ctx.ptm("pcFileRemoveButton")["icon"]), null, 16, ["class"]))]; - }), - _: 2 - }, 1032, ["onClick", "class", "unstyled", "pt"])], 16)], 16); - }), 128); -} -__name(render$1$6, "render$1$6"); -script$1$w.render = render$1$6; -function _toConsumableArray$9(r) { - return _arrayWithoutHoles$9(r) || _iterableToArray$9(r) || _unsupportedIterableToArray$a(r) || _nonIterableSpread$9(); -} -__name(_toConsumableArray$9, "_toConsumableArray$9"); -function _nonIterableSpread$9() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableSpread$9, "_nonIterableSpread$9"); -function _iterableToArray$9(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$9, "_iterableToArray$9"); -function _arrayWithoutHoles$9(r) { - if (Array.isArray(r)) return _arrayLikeToArray$a(r); -} -__name(_arrayWithoutHoles$9, "_arrayWithoutHoles$9"); -function _createForOfIteratorHelper$3(r, e) { - var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; - if (!t2) { - if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$a(r)) || e) { - t2 && (r = t2); - var _n = 0, F = /* @__PURE__ */ __name(function F2() { - }, "F"); - return { s: F, n: /* @__PURE__ */ __name(function n() { - return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; - }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { - throw r2; - }, "e"), 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 = true, u = false; - return { s: /* @__PURE__ */ __name(function s() { - t2 = t2.call(r); - }, "s"), n: /* @__PURE__ */ __name(function n() { - var r2 = t2.next(); - return a = r2.done, r2; - }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { - u = true, o = r2; - }, "e"), f: /* @__PURE__ */ __name(function f() { - try { - a || null == t2["return"] || t2["return"](); - } finally { - if (u) throw o; - } - }, "f") }; -} -__name(_createForOfIteratorHelper$3, "_createForOfIteratorHelper$3"); -function _unsupportedIterableToArray$a(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$a(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$a(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$a, "_unsupportedIterableToArray$a"); -function _arrayLikeToArray$a(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; -} -__name(_arrayLikeToArray$a, "_arrayLikeToArray$a"); -var script$Q = { - name: "FileUpload", - "extends": script$2$6, - inheritAttrs: false, - emits: ["select", "uploader", "before-upload", "progress", "upload", "error", "before-send", "clear", "remove", "remove-uploaded-file"], - duplicateIEEvent: false, - data: /* @__PURE__ */ __name(function data12() { - return { - uploadedFileCount: 0, - files: [], - messages: [], - focused: false, - progress: null, - uploadedFiles: [] - }; - }, "data"), - methods: { - upload: /* @__PURE__ */ __name(function upload() { - if (this.hasFiles) this.uploader(); - }, "upload"), - onBasicUploaderClick: /* @__PURE__ */ __name(function onBasicUploaderClick(event2) { - if (event2.button === 0) this.$refs.fileInput.click(); - }, "onBasicUploaderClick"), - onFileSelect: /* @__PURE__ */ __name(function onFileSelect(event2) { - if (event2.type !== "drop" && this.isIE11() && this.duplicateIEEvent) { - this.duplicateIEEvent = false; - return; - } - if (this.isBasic && this.hasFiles) { - this.files = []; - } - this.messages = []; - this.files = this.files || []; - var files = event2.dataTransfer ? event2.dataTransfer.files : event2.target.files; - var _iterator = _createForOfIteratorHelper$3(files), _step; - try { - for (_iterator.s(); !(_step = _iterator.n()).done; ) { - var file = _step.value; - if (!this.isFileSelected(file) && !this.isFileLimitExceeded()) { - if (this.validate(file)) { - if (this.isImage(file)) { - file.objectURL = window.URL.createObjectURL(file); - } - this.files.push(file); - } - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - this.$emit("select", { - originalEvent: event2, - files: this.files - }); - if (this.fileLimit) { - this.checkFileLimit(); - } - if (this.auto && this.hasFiles && !this.isFileLimitExceeded()) { - this.uploader(); - } - if (event2.type !== "drop" && this.isIE11()) { - this.clearIEInput(); - } else { - this.clearInputElement(); - } - }, "onFileSelect"), - choose: /* @__PURE__ */ __name(function choose() { - this.$refs.fileInput.click(); - }, "choose"), - uploader: /* @__PURE__ */ __name(function uploader() { - var _this = this; - if (this.customUpload) { - if (this.fileLimit) { - this.uploadedFileCount += this.files.length; - } - this.$emit("uploader", { - files: this.files - }); - this.clear(); - } else { - var xhr = new XMLHttpRequest(); - var formData = new FormData(); - this.$emit("before-upload", { - xhr, - formData - }); - var _iterator2 = _createForOfIteratorHelper$3(this.files), _step2; - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { - var file = _step2.value; - formData.append(this.name, file, file.name); - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - xhr.upload.addEventListener("progress", function(event2) { - if (event2.lengthComputable) { - _this.progress = Math.round(event2.loaded * 100 / event2.total); - } - _this.$emit("progress", { - originalEvent: event2, - progress: _this.progress - }); - }); - xhr.onreadystatechange = function() { - if (xhr.readyState === 4) { - var _this$uploadedFiles; - _this.progress = 0; - if (xhr.status >= 200 && xhr.status < 300) { - if (_this.fileLimit) { - _this.uploadedFileCount += _this.files.length; - } - _this.$emit("upload", { - xhr, - files: _this.files - }); - } else { - _this.$emit("error", { - xhr, - files: _this.files - }); - } - (_this$uploadedFiles = _this.uploadedFiles).push.apply(_this$uploadedFiles, _toConsumableArray$9(_this.files)); - _this.clear(); - } - }; - xhr.open("POST", this.url, true); - this.$emit("before-send", { - xhr, - formData - }); - xhr.withCredentials = this.withCredentials; - xhr.send(formData); - } - }, "uploader"), - clear: /* @__PURE__ */ __name(function clear() { - this.files = []; - this.messages = null; - this.$emit("clear"); - if (this.isAdvanced) { - this.clearInputElement(); - } - }, "clear"), - onFocus: /* @__PURE__ */ __name(function onFocus5() { - this.focused = true; - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur4() { - this.focused = false; - }, "onBlur"), - isFileSelected: /* @__PURE__ */ __name(function isFileSelected(file) { - if (this.files && this.files.length) { - var _iterator3 = _createForOfIteratorHelper$3(this.files), _step3; - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { - var sFile = _step3.value; - if (sFile.name + sFile.type + sFile.size === file.name + file.type + file.size) return true; - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - } - return false; - }, "isFileSelected"), - isIE11: /* @__PURE__ */ __name(function isIE11() { - return !!window["MSInputMethodContext"] && !!document["documentMode"]; - }, "isIE11"), - validate: /* @__PURE__ */ __name(function validate(file) { - if (this.accept && !this.isFileTypeValid(file)) { - this.messages.push(this.invalidFileTypeMessage.replace("{0}", file.name).replace("{1}", this.accept)); - return false; - } - if (this.maxFileSize && file.size > this.maxFileSize) { - this.messages.push(this.invalidFileSizeMessage.replace("{0}", file.name).replace("{1}", this.formatSize(this.maxFileSize))); - return false; - } - return true; - }, "validate"), - isFileTypeValid: /* @__PURE__ */ __name(function isFileTypeValid(file) { - var acceptableTypes = this.accept.split(",").map(function(type2) { - return type2.trim(); - }); - var _iterator4 = _createForOfIteratorHelper$3(acceptableTypes), _step4; - try { - for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) { - var type = _step4.value; - var acceptable = this.isWildcard(type) ? this.getTypeClass(file.type) === this.getTypeClass(type) : file.type == type || this.getFileExtension(file).toLowerCase() === type.toLowerCase(); - if (acceptable) { - return true; - } - } - } catch (err) { - _iterator4.e(err); - } finally { - _iterator4.f(); - } - return false; - }, "isFileTypeValid"), - getTypeClass: /* @__PURE__ */ __name(function getTypeClass(fileType) { - return fileType.substring(0, fileType.indexOf("/")); - }, "getTypeClass"), - isWildcard: /* @__PURE__ */ __name(function isWildcard(fileType) { - return fileType.indexOf("*") !== -1; - }, "isWildcard"), - getFileExtension: /* @__PURE__ */ __name(function getFileExtension(file) { - return "." + file.name.split(".").pop(); - }, "getFileExtension"), - isImage: /* @__PURE__ */ __name(function isImage(file) { - return /^image\//.test(file.type); - }, "isImage"), - onDragEnter: /* @__PURE__ */ __name(function onDragEnter(event2) { - if (!this.disabled) { - event2.stopPropagation(); - event2.preventDefault(); - } - }, "onDragEnter"), - onDragOver: /* @__PURE__ */ __name(function onDragOver(event2) { - if (!this.disabled) { - !this.isUnstyled && addClass(this.$refs.content, "p-fileupload-highlight"); - this.$refs.content.setAttribute("data-p-highlight", true); - event2.stopPropagation(); - event2.preventDefault(); - } - }, "onDragOver"), - onDragLeave: /* @__PURE__ */ __name(function onDragLeave() { - if (!this.disabled) { - !this.isUnstyled && removeClass(this.$refs.content, "p-fileupload-highlight"); - this.$refs.content.setAttribute("data-p-highlight", false); - } - }, "onDragLeave"), - onDrop: /* @__PURE__ */ __name(function onDrop(event2) { - if (!this.disabled) { - !this.isUnstyled && removeClass(this.$refs.content, "p-fileupload-highlight"); - this.$refs.content.setAttribute("data-p-highlight", false); - event2.stopPropagation(); - event2.preventDefault(); - var files = event2.dataTransfer ? event2.dataTransfer.files : event2.target.files; - var allowDrop = this.multiple || files && files.length === 1; - if (allowDrop) { - this.onFileSelect(event2); - } - } - }, "onDrop"), - remove: /* @__PURE__ */ __name(function remove(index) { - this.clearInputElement(); - var removedFile = this.files.splice(index, 1)[0]; - this.files = _toConsumableArray$9(this.files); - this.$emit("remove", { - file: removedFile, - files: this.files - }); - }, "remove"), - removeUploadedFile: /* @__PURE__ */ __name(function removeUploadedFile(index) { - var removedFile = this.uploadedFiles.splice(index, 1)[0]; - this.uploadedFiles = _toConsumableArray$9(this.uploadedFiles); - this.$emit("remove-uploaded-file", { - file: removedFile, - files: this.uploadedFiles - }); - }, "removeUploadedFile"), - clearInputElement: /* @__PURE__ */ __name(function clearInputElement() { - this.$refs.fileInput.value = ""; - }, "clearInputElement"), - clearIEInput: /* @__PURE__ */ __name(function clearIEInput() { - if (this.$refs.fileInput) { - this.duplicateIEEvent = true; - this.$refs.fileInput.value = ""; - } - }, "clearIEInput"), - formatSize: /* @__PURE__ */ __name(function formatSize2(bytes) { - var _this$$primevue$confi; - var k = 1024; - var dm = 3; - var sizes = ((_this$$primevue$confi = this.$primevue.config.locale) === null || _this$$primevue$confi === void 0 ? void 0 : _this$$primevue$confi.fileSizeTypes) || ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; - if (bytes === 0) { - return "0 ".concat(sizes[0]); - } - var i = Math.floor(Math.log(bytes) / Math.log(k)); - var formattedSize = parseFloat((bytes / Math.pow(k, i)).toFixed(dm)); - return "".concat(formattedSize, " ").concat(sizes[i]); - }, "formatSize"), - isFileLimitExceeded: /* @__PURE__ */ __name(function isFileLimitExceeded() { - if (this.fileLimit && this.fileLimit <= this.files.length + this.uploadedFileCount && this.focused) { - this.focused = false; - } - return this.fileLimit && this.fileLimit < this.files.length + this.uploadedFileCount; - }, "isFileLimitExceeded"), - checkFileLimit: /* @__PURE__ */ __name(function checkFileLimit() { - if (this.isFileLimitExceeded()) { - this.messages.push(this.invalidFileLimitMessage.replace("{0}", this.fileLimit.toString())); - } - }, "checkFileLimit"), - onMessageClose: /* @__PURE__ */ __name(function onMessageClose() { - this.messages = null; - }, "onMessageClose") - }, - computed: { - isAdvanced: /* @__PURE__ */ __name(function isAdvanced() { - return this.mode === "advanced"; - }, "isAdvanced"), - isBasic: /* @__PURE__ */ __name(function isBasic() { - return this.mode === "basic"; - }, "isBasic"), - chooseButtonClass: /* @__PURE__ */ __name(function chooseButtonClass() { - return [this.cx("pcChooseButton"), this["class"]]; - }, "chooseButtonClass"), - basicFileChosenLabel: /* @__PURE__ */ __name(function basicFileChosenLabel() { - var _this$$primevue$confi3; - if (this.auto) return this.chooseButtonLabel; - else if (this.hasFiles) { - var _this$$primevue$confi2; - if (this.files && this.files.length === 1) return this.files[0].name; - return (_this$$primevue$confi2 = this.$primevue.config.locale) === null || _this$$primevue$confi2 === void 0 || (_this$$primevue$confi2 = _this$$primevue$confi2.fileChosenMessage) === null || _this$$primevue$confi2 === void 0 ? void 0 : _this$$primevue$confi2.replace("{0}", this.files.length); - } - return ((_this$$primevue$confi3 = this.$primevue.config.locale) === null || _this$$primevue$confi3 === void 0 ? void 0 : _this$$primevue$confi3.noFileChosenMessage) || ""; - }, "basicFileChosenLabel"), - hasFiles: /* @__PURE__ */ __name(function hasFiles() { - return this.files && this.files.length > 0; - }, "hasFiles"), - hasUploadedFiles: /* @__PURE__ */ __name(function hasUploadedFiles() { - return this.uploadedFiles && this.uploadedFiles.length > 0; - }, "hasUploadedFiles"), - chooseDisabled: /* @__PURE__ */ __name(function chooseDisabled() { - return this.disabled || this.fileLimit && this.fileLimit <= this.files.length + this.uploadedFileCount; - }, "chooseDisabled"), - uploadDisabled: /* @__PURE__ */ __name(function uploadDisabled() { - return this.disabled || !this.hasFiles || this.fileLimit && this.fileLimit < this.files.length; - }, "uploadDisabled"), - cancelDisabled: /* @__PURE__ */ __name(function cancelDisabled() { - return this.disabled || !this.hasFiles; - }, "cancelDisabled"), - chooseButtonLabel: /* @__PURE__ */ __name(function chooseButtonLabel() { - return this.chooseLabel || this.$primevue.config.locale.choose; - }, "chooseButtonLabel"), - uploadButtonLabel: /* @__PURE__ */ __name(function uploadButtonLabel() { - return this.uploadLabel || this.$primevue.config.locale.upload; - }, "uploadButtonLabel"), - cancelButtonLabel: /* @__PURE__ */ __name(function cancelButtonLabel() { - return this.cancelLabel || this.$primevue.config.locale.cancel; - }, "cancelButtonLabel"), - completedLabel: /* @__PURE__ */ __name(function completedLabel() { - return this.$primevue.config.locale.completed; - }, "completedLabel"), - pendingLabel: /* @__PURE__ */ __name(function pendingLabel() { - return this.$primevue.config.locale.pending; - }, "pendingLabel") - }, - components: { - Button: script$1d, - ProgressBar: script$1z, - Message: script$1A, - FileContent: script$1$w, - PlusIcon: script$1w, - UploadIcon: script$R, - TimesIcon: script$1q - }, - directives: { - ripple: Ripple - } -}; -var _hoisted_1$n = ["multiple", "accept", "disabled"]; -var _hoisted_2$g = ["files"]; -var _hoisted_3$d = ["accept", "disabled", "multiple"]; -function render$L(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Button = resolveComponent("Button"); - var _component_ProgressBar = resolveComponent("ProgressBar"); - var _component_Message = resolveComponent("Message"); - var _component_FileContent = resolveComponent("FileContent"); - return $options.isAdvanced ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [createBaseVNode("input", mergeProps({ - ref: "fileInput", - type: "file", - onChange: _cache[0] || (_cache[0] = function() { - return $options.onFileSelect && $options.onFileSelect.apply($options, arguments); - }), - multiple: _ctx.multiple, - accept: _ctx.accept, - disabled: $options.chooseDisabled - }, _ctx.ptm("input")), null, 16, _hoisted_1$n), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("header") - }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header", { - files: $data.files, - uploadedFiles: $data.uploadedFiles, - chooseCallback: $options.choose, - uploadCallback: $options.uploader, - clearCallback: $options.clear - }, function() { - return [createVNode(_component_Button, mergeProps({ - label: $options.chooseButtonLabel, - "class": $options.chooseButtonClass, - style: _ctx.style, - disabled: _ctx.disabled, - unstyled: _ctx.unstyled, - onClick: $options.choose, - onKeydown: withKeys($options.choose, ["enter"]), - onFocus: $options.onFocus, - onBlur: $options.onBlur - }, _ctx.chooseButtonProps, { - pt: _ctx.ptm("pcChooseButton") - }), { - icon: withCtx(function(iconProps) { - return [renderSlot(_ctx.$slots, "chooseicon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.chooseIcon ? "span" : "PlusIcon"), mergeProps({ - "class": [iconProps["class"], _ctx.chooseIcon], - "aria-hidden": "true" - }, _ctx.ptm("pcChooseButton")["icon"]), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["label", "class", "style", "disabled", "unstyled", "onClick", "onKeydown", "onFocus", "onBlur", "pt"]), _ctx.showUploadButton ? (openBlock(), createBlock(_component_Button, mergeProps({ - key: 0, - "class": _ctx.cx("pcUploadButton"), - label: $options.uploadButtonLabel, - onClick: $options.uploader, - disabled: $options.uploadDisabled, - unstyled: _ctx.unstyled - }, _ctx.uploadButtonProps, { - pt: _ctx.ptm("pcUploadButton") - }), { - icon: withCtx(function(iconProps) { - return [renderSlot(_ctx.$slots, "uploadicon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.uploadIcon ? "span" : "UploadIcon"), mergeProps({ - "class": [iconProps["class"], _ctx.uploadIcon], - "aria-hidden": "true" - }, _ctx.ptm("pcUploadButton")["icon"], { - "data-pc-section": "uploadbuttonicon" - }), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "label", "onClick", "disabled", "unstyled", "pt"])) : createCommentVNode("", true), _ctx.showCancelButton ? (openBlock(), createBlock(_component_Button, mergeProps({ - key: 1, - "class": _ctx.cx("pcCancelButton"), - label: $options.cancelButtonLabel, - onClick: $options.clear, - disabled: $options.cancelDisabled, - unstyled: _ctx.unstyled - }, _ctx.cancelButtonProps, { - pt: _ctx.ptm("pcCancelButton") - }), { - icon: withCtx(function(iconProps) { - return [renderSlot(_ctx.$slots, "cancelicon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.cancelIcon ? "span" : "TimesIcon"), mergeProps({ - "class": [iconProps["class"], _ctx.cancelIcon], - "aria-hidden": "true" - }, _ctx.ptm("pcCancelButton")["icon"], { - "data-pc-section": "cancelbuttonicon" - }), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "label", "onClick", "disabled", "unstyled", "pt"])) : createCommentVNode("", true)]; - })], 16), createBaseVNode("div", mergeProps({ - ref: "content", - "class": _ctx.cx("content"), - onDragenter: _cache[1] || (_cache[1] = function() { - return $options.onDragEnter && $options.onDragEnter.apply($options, arguments); - }), - onDragover: _cache[2] || (_cache[2] = function() { - return $options.onDragOver && $options.onDragOver.apply($options, arguments); - }), - onDragleave: _cache[3] || (_cache[3] = function() { - return $options.onDragLeave && $options.onDragLeave.apply($options, arguments); - }), - onDrop: _cache[4] || (_cache[4] = function() { - return $options.onDrop && $options.onDrop.apply($options, arguments); - }) - }, _ctx.ptm("content"), { - "data-p-highlight": false - }), [renderSlot(_ctx.$slots, "content", { - files: $data.files, - uploadedFiles: $data.uploadedFiles, - removeUploadedFileCallback: $options.removeUploadedFile, - removeFileCallback: $options.remove, - progress: $data.progress, - messages: $data.messages - }, function() { - return [$options.hasFiles ? (openBlock(), createBlock(_component_ProgressBar, { - key: 0, - value: $data.progress, - showValue: false, - unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcProgressbar") - }, null, 8, ["value", "unstyled", "pt"])) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList($data.messages, function(msg) { - return openBlock(), createBlock(_component_Message, { - key: msg, - severity: "error", - onClose: $options.onMessageClose, - unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcMessage") - }, { - "default": withCtx(function() { - return [createTextVNode(toDisplayString(msg), 1)]; - }), - _: 2 - }, 1032, ["onClose", "unstyled", "pt"]); - }), 128)), $options.hasFiles ? (openBlock(), createElementBlock("div", { - key: 1, - "class": normalizeClass(_ctx.cx("fileList")) - }, [createVNode(_component_FileContent, { - files: $data.files, - onRemove: $options.remove, - badgeValue: $options.pendingLabel, - previewWidth: _ctx.previewWidth, - templates: _ctx.$slots, - unstyled: _ctx.unstyled, - pt: _ctx.pt - }, null, 8, ["files", "onRemove", "badgeValue", "previewWidth", "templates", "unstyled", "pt"])], 2)) : createCommentVNode("", true), $options.hasUploadedFiles ? (openBlock(), createElementBlock("div", { - key: 2, - "class": normalizeClass(_ctx.cx("fileList")) - }, [createVNode(_component_FileContent, { - files: $data.uploadedFiles, - onRemove: $options.removeUploadedFile, - badgeValue: $options.completedLabel, - badgeSeverity: "success", - previewWidth: _ctx.previewWidth, - templates: _ctx.$slots, - unstyled: _ctx.unstyled, - pt: _ctx.pt - }, null, 8, ["files", "onRemove", "badgeValue", "previewWidth", "templates", "unstyled", "pt"])], 2)) : createCommentVNode("", true)]; - }), _ctx.$slots.empty && !$options.hasFiles && !$options.hasUploadedFiles ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ - key: 0 - }, _ctx.ptm("empty"))), [renderSlot(_ctx.$slots, "empty")], 16)) : createCommentVNode("", true)], 16)], 16)) : $options.isBasic ? (openBlock(), createElementBlock("div", mergeProps({ - key: 1, - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [(openBlock(true), createElementBlock(Fragment, null, renderList($data.messages, function(msg) { - return openBlock(), createBlock(_component_Message, { - key: msg, - severity: "error", - onClose: $options.onMessageClose, - unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcMessage") - }, { - "default": withCtx(function() { - return [createTextVNode(toDisplayString(msg), 1)]; - }), - _: 2 - }, 1032, ["onClose", "unstyled", "pt"]); - }), 128)), createVNode(_component_Button, mergeProps({ - label: $options.chooseButtonLabel, - "class": $options.chooseButtonClass, - style: _ctx.style, - disabled: _ctx.disabled, - unstyled: _ctx.unstyled, - onMouseup: $options.onBasicUploaderClick, - onKeydown: withKeys($options.choose, ["enter"]), - onFocus: $options.onFocus, - onBlur: $options.onBlur - }, _ctx.chooseButtonProps, { - pt: _ctx.ptm("pcChooseButton") - }), { - icon: withCtx(function(iconProps) { - return [renderSlot(_ctx.$slots, "chooseicon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.chooseIcon ? "span" : "PlusIcon"), mergeProps({ - "class": [iconProps["class"], _ctx.chooseIcon], - "aria-hidden": "true" - }, _ctx.ptm("pcChooseButton")["icon"]), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["label", "class", "style", "disabled", "unstyled", "onMouseup", "onKeydown", "onFocus", "onBlur", "pt"]), !_ctx.auto ? renderSlot(_ctx.$slots, "filelabel", { - key: 0, - "class": normalizeClass(_ctx.cx("filelabel")) - }, function() { - return [createBaseVNode("span", { - "class": normalizeClass(_ctx.cx("filelabel")), - files: $data.files - }, toDisplayString($options.basicFileChosenLabel), 11, _hoisted_2$g)]; - }) : createCommentVNode("", true), createBaseVNode("input", mergeProps({ - ref: "fileInput", - type: "file", - accept: _ctx.accept, - disabled: _ctx.disabled, - multiple: _ctx.multiple, - onChange: _cache[5] || (_cache[5] = function() { - return $options.onFileSelect && $options.onFileSelect.apply($options, arguments); - }), - onFocus: _cache[6] || (_cache[6] = function() { - return $options.onFocus && $options.onFocus.apply($options, arguments); - }), - onBlur: _cache[7] || (_cache[7] = function() { - return $options.onBlur && $options.onBlur.apply($options, arguments); - }) - }, _ctx.ptm("input")), null, 16, _hoisted_3$d)], 16)) : createCommentVNode("", true); -} -__name(render$L, "render$L"); -script$Q.render = render$L; -var classes$v = { - root: "p-fluid" -}; -var FluidStyle = BaseStyle.extend({ - name: "fluid", - classes: classes$v -}); -var script$1$v = { - name: "BaseFluid", - "extends": script$1f, - style: FluidStyle, - provide: /* @__PURE__ */ __name(function provide19() { - return { - $pcFluid: this, - $parentInstance: this - }; - }, "provide") -}; -var script$P = { - name: "Fluid", - "extends": script$1$v, - inheritAttrs: false -}; -function render$K(_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$K, "render$K"); -script$P.render = render$K; -var theme$r = /* @__PURE__ */ __name(function theme12(_ref) { - var dt = _ref.dt; - return "\n.p-iftalabel {\n display: block;\n position: relative;\n}\n\n.p-iftalabel label {\n position: absolute;\n pointer-events: none;\n top: ".concat(dt("iftalabel.top"), ";\n transition-property: all;\n transition-timing-function: ease;\n line-height: 1;\n font-size: ").concat(dt("iftalabel.font.size"), ";\n font-weight: ").concat(dt("iftalabel.font.weight"), ";\n inset-inline-start: ").concat(dt("iftalabel.position.x"), ";\n color: ").concat(dt("iftalabel.color"), ";\n transition-duration: ").concat(dt("iftalabel.transition.duration"), ";\n}\n\n.p-iftalabel .p-inputtext,\n.p-iftalabel .p-textarea,\n.p-iftalabel .p-select-label,\n.p-iftalabel .p-multiselect-label,\n.p-iftalabel .p-autocomplete-input-multiple,\n.p-iftalabel .p-cascadeselect-label,\n.p-iftalabel .p-treeselect-label {\n padding-block-start: ").concat(dt("iftalabel.input.padding.top"), ";\n padding-block-end: ").concat(dt("iftalabel.input.padding.bottom"), ";\n}\n\n.p-iftalabel:has(.p-invalid) label {\n color: ").concat(dt("iftalabel.invalid.color"), ";\n}\n\n.p-iftalabel:has(input:focus) label,\n.p-iftalabel:has(input:-webkit-autofill) label,\n.p-iftalabel:has(textarea:focus) label,\n.p-iftalabel:has(.p-inputwrapper-focus) label {\n color: ").concat(dt("iftalabel.focus.color"), ";\n}\n\n.p-iftalabel .p-inputicon {\n top: ").concat(dt("iftalabel.input.padding.top"), ";\n transform: translateY(25%);\n margin-top: 0;\n}\n"); -}, "theme"); -var classes$u = { - root: "p-iftalabel" -}; -var IftaLabelStyle = BaseStyle.extend({ - name: "iftalabel", - theme: theme$r, - classes: classes$u -}); -var script$1$u = { - name: "BaseIftaLabel", - "extends": script$1f, - style: IftaLabelStyle, - provide: /* @__PURE__ */ __name(function provide20() { - return { - $pcIftaLabel: this, - $parentInstance: this - }; - }, "provide") -}; -var script$O = { - name: "IftaLabel", - "extends": script$1$u, - inheritAttrs: false -}; -function render$J(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("span", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16); -} -__name(render$J, "render$J"); -script$O.render = render$J; -var script$N = { - name: "EyeIcon", - "extends": script$1j -}; -function render$I(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M0.0535499 7.25213C0.208567 7.59162 2.40413 12.4 7 12.4C11.5959 12.4 13.7914 7.59162 13.9465 7.25213C13.9487 7.2471 13.9506 7.24304 13.952 7.24001C13.9837 7.16396 14 7.08239 14 7.00001C14 6.91762 13.9837 6.83605 13.952 6.76001C13.9506 6.75697 13.9487 6.75292 13.9465 6.74788C13.7914 6.4084 11.5959 1.60001 7 1.60001C2.40413 1.60001 0.208567 6.40839 0.0535499 6.74788C0.0512519 6.75292 0.0494023 6.75697 0.048 6.76001C0.0163137 6.83605 0 6.91762 0 7.00001C0 7.08239 0.0163137 7.16396 0.048 7.24001C0.0494023 7.24304 0.0512519 7.2471 0.0535499 7.25213ZM7 11.2C3.664 11.2 1.736 7.92001 1.264 7.00001C1.736 6.08001 3.664 2.80001 7 2.80001C10.336 2.80001 12.264 6.08001 12.736 7.00001C12.264 7.92001 10.336 11.2 7 11.2ZM5.55551 9.16182C5.98308 9.44751 6.48576 9.6 7 9.6C7.68891 9.59789 8.349 9.32328 8.83614 8.83614C9.32328 8.349 9.59789 7.68891 9.59999 7C9.59999 6.48576 9.44751 5.98308 9.16182 5.55551C8.87612 5.12794 8.47006 4.7947 7.99497 4.59791C7.51988 4.40112 6.99711 4.34963 6.49276 4.44995C5.98841 4.55027 5.52513 4.7979 5.16152 5.16152C4.7979 5.52513 4.55027 5.98841 4.44995 6.49276C4.34963 6.99711 4.40112 7.51988 4.59791 7.99497C4.7947 8.47006 5.12794 8.87612 5.55551 9.16182ZM6.2222 5.83594C6.45243 5.6821 6.7231 5.6 7 5.6C7.37065 5.6021 7.72553 5.75027 7.98762 6.01237C8.24972 6.27446 8.39789 6.62934 8.4 7C8.4 7.27689 8.31789 7.54756 8.16405 7.77779C8.01022 8.00802 7.79157 8.18746 7.53575 8.29343C7.27994 8.39939 6.99844 8.42711 6.72687 8.37309C6.4553 8.31908 6.20584 8.18574 6.01005 7.98994C5.81425 7.79415 5.68091 7.54469 5.6269 7.27312C5.57288 7.00155 5.6006 6.72006 5.70656 6.46424C5.81253 6.20842 5.99197 5.98977 6.2222 5.83594Z", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$I, "render$I"); -script$N.render = render$I; -var script$M = { - name: "RefreshIcon", - "extends": script$1j -}; -function render$H(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M6.77051 5.96336C6.84324 5.99355 6.92127 6.00891 7.00002 6.00854C7.07877 6.00891 7.1568 5.99355 7.22953 5.96336C7.30226 5.93317 7.36823 5.88876 7.42357 5.83273L9.82101 3.43529C9.93325 3.32291 9.99629 3.17058 9.99629 3.01175C9.99629 2.85292 9.93325 2.70058 9.82101 2.5882L7.42357 0.190763C7.3687 0.131876 7.30253 0.0846451 7.22901 0.0518865C7.15549 0.019128 7.07612 0.00151319 6.99564 9.32772e-05C6.91517 -0.00132663 6.83523 0.0134773 6.7606 0.0436218C6.68597 0.0737664 6.61817 0.118634 6.56126 0.175548C6.50435 0.232462 6.45948 0.300257 6.42933 0.374888C6.39919 0.449519 6.38439 0.529456 6.38581 0.609933C6.38722 0.690409 6.40484 0.769775 6.4376 0.843296C6.47036 0.916817 6.51759 0.982986 6.57647 1.03786L7.95103 2.41241H6.99998C5.46337 2.41241 3.98969 3.02283 2.90314 4.10938C1.81659 5.19593 1.20618 6.66961 1.20618 8.20622C1.20618 9.74283 1.81659 11.2165 2.90314 12.3031C3.98969 13.3896 5.46337 14 6.99998 14C8.53595 13.9979 10.0084 13.3868 11.0945 12.3007C12.1806 11.2146 12.7917 9.74218 12.7938 8.20622C12.7938 8.04726 12.7306 7.89481 12.6182 7.78241C12.5058 7.67001 12.3534 7.60686 12.1944 7.60686C12.0355 7.60686 11.883 7.67001 11.7706 7.78241C11.6582 7.89481 11.5951 8.04726 11.5951 8.20622C11.5951 9.11504 11.3256 10.0035 10.8207 10.7591C10.3157 11.5148 9.59809 12.1037 8.75845 12.4515C7.9188 12.7993 6.99489 12.8903 6.10353 12.713C5.21217 12.5357 4.3934 12.0981 3.75077 11.4554C3.10813 10.8128 2.67049 9.99404 2.49319 9.10268C2.31589 8.21132 2.40688 7.2874 2.75468 6.44776C3.10247 5.60811 3.69143 4.89046 4.44709 4.38554C5.20275 3.88063 6.09116 3.61113 6.99998 3.61113H7.95098L6.57647 4.98564C6.46423 5.09802 6.40119 5.25035 6.40119 5.40918C6.40119 5.56801 6.46423 5.72035 6.57647 5.83273C6.63181 5.88876 6.69778 5.93317 6.77051 5.96336Z", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$H, "render$H"); -script$M.render = render$H; -var script$L = { - name: "SearchMinusIcon", - "extends": script$1j -}; -function render$G(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M6.0208 12.0411C4.83005 12.0411 3.66604 11.688 2.67596 11.0265C1.68589 10.3649 0.914216 9.42464 0.458534 8.32452C0.00285271 7.22441 -0.116374 6.01388 0.11593 4.84601C0.348235 3.67813 0.921637 2.60537 1.76363 1.76338C2.60562 0.921393 3.67838 0.34799 4.84625 0.115686C6.01412 -0.116618 7.22466 0.00260857 8.32477 0.45829C9.42488 0.913972 10.3652 1.68564 11.0267 2.67572C11.6883 3.66579 12.0414 4.8298 12.0414 6.02056C12.0395 7.41563 11.5542 8.76029 10.6783 9.8305L13.8244 12.9765C13.9367 13.089 13.9997 13.2414 13.9997 13.4003C13.9997 13.5592 13.9367 13.7116 13.8244 13.8241C13.769 13.8801 13.703 13.9245 13.6302 13.9548C13.5575 13.985 13.4794 14.0003 13.4006 14C13.3218 14.0003 13.2437 13.985 13.171 13.9548C13.0982 13.9245 13.0322 13.8801 12.9768 13.8241L9.83082 10.678C8.76059 11.5539 7.4159 12.0393 6.0208 12.0411ZM6.0208 1.20731C5.07199 1.20731 4.14449 1.48867 3.35559 2.0158C2.56669 2.54292 1.95181 3.29215 1.58872 4.16874C1.22562 5.04532 1.13062 6.00989 1.31572 6.94046C1.50083 7.87104 1.95772 8.72583 2.62863 9.39674C3.29954 10.0676 4.15433 10.5245 5.0849 10.7096C6.01548 10.8947 6.98005 10.7997 7.85663 10.4367C8.73322 10.0736 9.48244 9.45868 10.0096 8.66978C10.5367 7.88088 10.8181 6.95337 10.8181 6.00457C10.8181 4.73226 10.3126 3.51206 9.41297 2.6124C8.51331 1.71274 7.29311 1.20731 6.0208 1.20731ZM4.00591 6.60422H8.00362C8.16266 6.60422 8.31518 6.54104 8.42764 6.42859C8.5401 6.31613 8.60328 6.1636 8.60328 6.00456C8.60328 5.84553 8.5401 5.693 8.42764 5.58054C8.31518 5.46809 8.16266 5.40491 8.00362 5.40491H4.00591C3.84687 5.40491 3.69434 5.46809 3.58189 5.58054C3.46943 5.693 3.40625 5.84553 3.40625 6.00456C3.40625 6.1636 3.46943 6.31613 3.58189 6.42859C3.69434 6.54104 3.84687 6.60422 4.00591 6.60422Z", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$G, "render$G"); -script$L.render = render$G; -var script$K = { - name: "SearchPlusIcon", - "extends": script$1j -}; -function render$F(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M2.67596 11.0265C3.66604 11.688 4.83005 12.0411 6.0208 12.0411C6.81143 12.0411 7.59432 11.8854 8.32477 11.5828C8.86999 11.357 9.37802 11.0526 9.83311 10.6803L12.9768 13.8241C13.0322 13.8801 13.0982 13.9245 13.171 13.9548C13.2437 13.985 13.3218 14.0003 13.4006 14C13.4794 14.0003 13.5575 13.985 13.6302 13.9548C13.703 13.9245 13.769 13.8801 13.8244 13.8241C13.9367 13.7116 13.9997 13.5592 13.9997 13.4003C13.9997 13.2414 13.9367 13.089 13.8244 12.9765L10.6806 9.8328C11.0529 9.37773 11.3572 8.86972 11.5831 8.32452C11.8856 7.59408 12.0414 6.81119 12.0414 6.02056C12.0414 4.8298 11.6883 3.66579 11.0267 2.67572C10.3652 1.68564 9.42488 0.913972 8.32477 0.45829C7.22466 0.00260857 6.01412 -0.116618 4.84625 0.115686C3.67838 0.34799 2.60562 0.921393 1.76363 1.76338C0.921637 2.60537 0.348235 3.67813 0.11593 4.84601C-0.116374 6.01388 0.00285271 7.22441 0.458534 8.32452C0.914216 9.42464 1.68589 10.3649 2.67596 11.0265ZM3.35559 2.0158C4.14449 1.48867 5.07199 1.20731 6.0208 1.20731C7.29311 1.20731 8.51331 1.71274 9.41297 2.6124C10.3126 3.51206 10.8181 4.73226 10.8181 6.00457C10.8181 6.95337 10.5367 7.88088 10.0096 8.66978C9.48244 9.45868 8.73322 10.0736 7.85663 10.4367C6.98005 10.7997 6.01548 10.8947 5.0849 10.7096C4.15433 10.5245 3.29954 10.0676 2.62863 9.39674C1.95772 8.72583 1.50083 7.87104 1.31572 6.94046C1.13062 6.00989 1.22562 5.04532 1.58872 4.16874C1.95181 3.29215 2.56669 2.54292 3.35559 2.0158ZM6.00481 8.60309C5.84641 8.60102 5.69509 8.53718 5.58308 8.42517C5.47107 8.31316 5.40722 8.16183 5.40515 8.00344V6.60422H4.00591C3.84687 6.60422 3.69434 6.54104 3.58189 6.42859C3.46943 6.31613 3.40625 6.1636 3.40625 6.00456C3.40625 5.84553 3.46943 5.693 3.58189 5.58054C3.69434 5.46809 3.84687 5.40491 4.00591 5.40491H5.40515V4.00572C5.40515 3.84668 5.46833 3.69416 5.58079 3.5817C5.69324 3.46924 5.84577 3.40607 6.00481 3.40607C6.16385 3.40607 6.31637 3.46924 6.42883 3.5817C6.54129 3.69416 6.60447 3.84668 6.60447 4.00572V5.40491H8.00362C8.16266 5.40491 8.31518 5.46809 8.42764 5.58054C8.5401 5.693 8.60328 5.84553 8.60328 6.00456C8.60328 6.1636 8.5401 6.31613 8.42764 6.42859C8.31518 6.54104 8.16266 6.60422 8.00362 6.60422H6.60447V8.00344C6.60239 8.16183 6.53855 8.31316 6.42654 8.42517C6.31453 8.53718 6.1632 8.60102 6.00481 8.60309Z", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$F, "render$F"); -script$K.render = render$F; -var script$J = { - name: "UndoIcon", - "extends": script$1j -}; -function render$E(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M6.77042 5.96336C6.84315 5.99355 6.92118 6.00891 6.99993 6.00854C7.07868 6.00891 7.15671 5.99355 7.22944 5.96336C7.30217 5.93317 7.36814 5.88876 7.42348 5.83273C7.53572 5.72035 7.59876 5.56801 7.59876 5.40918C7.59876 5.25035 7.53572 5.09802 7.42348 4.98564L6.04897 3.61113H6.99998C7.9088 3.61113 8.79722 3.88063 9.55288 4.38554C10.3085 4.89046 10.8975 5.60811 11.2453 6.44776C11.5931 7.2874 11.6841 8.21132 11.5068 9.10268C11.3295 9.99404 10.8918 10.8128 10.2492 11.4554C9.60657 12.0981 8.7878 12.5357 7.89644 12.713C7.00508 12.8903 6.08116 12.7993 5.24152 12.4515C4.40188 12.1037 3.68422 11.5148 3.17931 10.7591C2.67439 10.0035 2.4049 9.11504 2.4049 8.20622C2.4049 8.04726 2.34175 7.89481 2.22935 7.78241C2.11695 7.67001 1.9645 7.60686 1.80554 7.60686C1.64658 7.60686 1.49413 7.67001 1.38172 7.78241C1.26932 7.89481 1.20618 8.04726 1.20618 8.20622C1.20829 9.74218 1.81939 11.2146 2.90548 12.3007C3.99157 13.3868 5.46402 13.9979 6.99998 14C8.5366 14 10.0103 13.3896 11.0968 12.3031C12.1834 11.2165 12.7938 9.74283 12.7938 8.20622C12.7938 6.66961 12.1834 5.19593 11.0968 4.10938C10.0103 3.02283 8.5366 2.41241 6.99998 2.41241H6.04892L7.42348 1.03786C7.48236 0.982986 7.5296 0.916817 7.56235 0.843296C7.59511 0.769775 7.61273 0.690409 7.61415 0.609933C7.61557 0.529456 7.60076 0.449519 7.57062 0.374888C7.54047 0.300257 7.49561 0.232462 7.43869 0.175548C7.38178 0.118634 7.31398 0.0737664 7.23935 0.0436218C7.16472 0.0134773 7.08478 -0.00132663 7.00431 9.32772e-05C6.92383 0.00151319 6.84447 0.019128 6.77095 0.0518865C6.69742 0.0846451 6.63126 0.131876 6.57638 0.190763L4.17895 2.5882C4.06671 2.70058 4.00366 2.85292 4.00366 3.01175C4.00366 3.17058 4.06671 3.32291 4.17895 3.43529L6.57638 5.83273C6.63172 5.88876 6.69769 5.93317 6.77042 5.96336Z", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$E, "render$E"); -script$J.render = render$E; -var theme$q = /* @__PURE__ */ __name(function theme13(_ref) { - var dt = _ref.dt; - return "\n.p-image-mask {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-image-preview {\n position: relative;\n display: inline-flex;\n line-height: 0;\n}\n\n.p-image-preview-mask {\n position: absolute;\n inset-inline-start: 0;\n inset-block-start: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0;\n transition: opacity 0.3s;\n border: 0 none;\n padding: 0;\n cursor: pointer;\n background: transparent;\n color: ".concat(dt("image.preview.mask.color"), ";\n transition: background ").concat(dt("image.transition.duration"), ";\n}\n\n.p-image-preview:hover > .p-image-preview-mask {\n opacity: 1;\n cursor: pointer;\n background: ").concat(dt("image.preview.mask.background"), ";\n}\n\n.p-image-preview-icon {\n font-size: ").concat(dt("image.preview.icon.size"), ";\n width: ").concat(dt("image.preview.icon.size"), ";\n height: ").concat(dt("image.preview.icon.size"), ";\n}\n\n.p-image-toolbar {\n position: absolute;\n inset-block-start: ").concat(dt("image.toolbar.position.top"), ";\n inset-inline-end: ").concat(dt("image.toolbar.position.right"), ";\n inset-inline-start: ").concat(dt("image.toolbar.position.left"), ";\n inset-block-end: ").concat(dt("image.toolbar.position.bottom"), ";\n display: flex;\n z-index: 1;\n padding: ").concat(dt("image.toolbar.padding"), ";\n background: ").concat(dt("image.toolbar.background"), ";\n backdrop-filter: blur(").concat(dt("image.toolbar.blur"), ");\n border-color: ").concat(dt("image.toolbar.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("image.toolbar.border.width"), ";\n border-radius: ").concat(dt("image.toolbar.border.radius"), ";\n gap: ").concat(dt("image.toolbar.gap"), ";\n}\n\n.p-image-action {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n color: ").concat(dt("image.action.color"), ";\n background: transparent;\n width: ").concat(dt("image.action.size"), ";\n height: ").concat(dt("image.action.size"), ";\n margin: 0;\n padding: 0;\n border: 0 none;\n cursor: pointer;\n user-select: none;\n border-radius: ").concat(dt("image.action.border.radius"), ";\n outline-color: transparent;\n transition: background ").concat(dt("image.transition.duration"), ", color ").concat(dt("image.transition.duration"), ", outline-color ").concat(dt("image.transition.duration"), ", box-shadow ").concat(dt("image.transition.duration"), ";\n}\n\n.p-image-action:hover {\n color: ").concat(dt("image.action.hover.color"), ";\n background: ").concat(dt("image.action.hover.background"), ";\n}\n\n.p-image-action:focus-visible {\n box-shadow: ").concat(dt("image.action.focus.ring.shadow"), ";\n outline: ").concat(dt("image.action.focus.ring.width"), " ").concat(dt("image.action.focus.ring.style"), " ").concat(dt("image.action.focus.ring.color"), ";\n outline-offset: ").concat(dt("image.action.focus.ring.offset"), ";\n}\n\n.p-image-action .p-icon {\n font-size: ").concat(dt("image.action.icon.size"), ";\n width: ").concat(dt("image.action.icon.size"), ";\n height: ").concat(dt("image.action.icon.size"), ";\n}\n\n.p-image-action.p-disabled {\n pointer-events: auto;\n}\n\n.p-image-original {\n transition: transform 0.15s;\n max-width: 100vw;\n max-height: 100vh;\n}\n\n.p-image-original-enter-active {\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n}\n\n.p-image-original-leave-active {\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n.p-image-original-enter-from,\n.p-image-original-leave-to {\n opacity: 0;\n transform: scale(0.7);\n}\n"); -}, "theme"); -var classes$t = { - root: /* @__PURE__ */ __name(function root12(_ref2) { - var props = _ref2.props; - return ["p-image p-component", { - "p-image-preview": props.preview - }]; - }, "root"), - previewMask: "p-image-preview-mask", - previewIcon: "p-image-preview-icon", - mask: "p-image-mask p-overlay-mask p-overlay-mask-enter", - toolbar: "p-image-toolbar", - rotateRightButton: "p-image-action p-image-rotate-right-button", - rotateLeftButton: "p-image-action p-image-rotate-left-button", - zoomOutButton: /* @__PURE__ */ __name(function zoomOutButton(_ref3) { - var instance = _ref3.instance; - return ["p-image-action p-image-zoom-out-button", { - "p-disabled": instance.isZoomOutDisabled - }]; - }, "zoomOutButton"), - zoomInButton: /* @__PURE__ */ __name(function zoomInButton(_ref4) { - var instance = _ref4.instance; - return ["p-image-action p-image-zoom-in-button", { - "p-disabled": instance.isZoomInDisabled - }]; - }, "zoomInButton"), - closeButton: "p-image-action p-image-close-button", - original: "p-image-original" -}; -var ImageStyle = BaseStyle.extend({ - name: "image", - theme: theme$q, - classes: classes$t -}); -var script$1$t = { - name: "BaseImage", - "extends": script$1f, - props: { - preview: { - type: Boolean, - "default": false - }, - "class": { - type: null, - "default": null - }, - style: { - type: null, - "default": null - }, - imageStyle: { - type: null, - "default": null - }, - imageClass: { - type: null, - "default": null - }, - previewButtonProps: { - type: null, - "default": null - }, - indicatorIcon: { - type: String, - "default": void 0 - }, - previewIcon: { - type: String, - "default": void 0 - }, - zoomInDisabled: { - type: Boolean, - "default": false - }, - zoomOutDisabled: { - type: Boolean, - "default": false - } - }, - style: ImageStyle, - provide: /* @__PURE__ */ __name(function provide21() { - return { - $pcImage: this, - $parentInstance: this - }; - }, "provide") -}; -var script$I = { - name: "Image", - "extends": script$1$t, - inheritAttrs: false, - emits: ["show", "hide", "error"], - mask: null, - data: /* @__PURE__ */ __name(function data13() { - return { - maskVisible: false, - previewVisible: false, - rotate: 0, - scale: 1 - }; - }, "data"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount6() { - if (this.mask) { - ZIndex.clear(this.container); - } - }, "beforeUnmount"), - methods: { - maskRef: /* @__PURE__ */ __name(function maskRef(el) { - this.mask = el; - }, "maskRef"), - toolbarRef: /* @__PURE__ */ __name(function toolbarRef(el) { - this.toolbarRef = el; - }, "toolbarRef"), - onImageClick: /* @__PURE__ */ __name(function onImageClick() { - var _this = this; - if (this.preview) { - blockBodyScroll(); - this.maskVisible = true; - setTimeout(function() { - _this.previewVisible = true; - }, 25); - } - }, "onImageClick"), - onPreviewImageClick: /* @__PURE__ */ __name(function onPreviewImageClick() { - this.previewClick = true; - }, "onPreviewImageClick"), - onMaskClick: /* @__PURE__ */ __name(function onMaskClick(event2) { - var isBarActionsClicked = isAttributeEquals(event2.target, "data-pc-section-group", "action") || event2.target.closest('[data-pc-section-group="action"]'); - if (!this.previewClick && !isBarActionsClicked) { - this.previewVisible = false; - this.rotate = 0; - this.scale = 1; - } - this.previewClick = false; - }, "onMaskClick"), - onMaskKeydown: /* @__PURE__ */ __name(function onMaskKeydown(event2) { - var _this2 = this; - switch (event2.code) { - case "Escape": - this.hidePreview(); - setTimeout(function() { - focus(_this2.$refs.previewButton); - }, 200); - event2.preventDefault(); - break; - } - }, "onMaskKeydown"), - onError: /* @__PURE__ */ __name(function onError2() { - this.$emit("error"); - }, "onError"), - rotateRight: /* @__PURE__ */ __name(function rotateRight() { - this.rotate += 90; - this.previewClick = true; - }, "rotateRight"), - rotateLeft: /* @__PURE__ */ __name(function rotateLeft() { - this.rotate -= 90; - this.previewClick = true; - }, "rotateLeft"), - zoomIn: /* @__PURE__ */ __name(function zoomIn() { - this.scale = this.scale + 0.1; - this.previewClick = true; - }, "zoomIn"), - zoomOut: /* @__PURE__ */ __name(function zoomOut() { - this.scale = this.scale - 0.1; - this.previewClick = true; - }, "zoomOut"), - onBeforeEnter: /* @__PURE__ */ __name(function onBeforeEnter() { - ZIndex.set("modal", this.mask, this.$primevue.config.zIndex.modal); - }, "onBeforeEnter"), - onEnter: /* @__PURE__ */ __name(function onEnter() { - this.focus(); - this.$emit("show"); - }, "onEnter"), - onBeforeLeave: /* @__PURE__ */ __name(function onBeforeLeave() { - !this.isUnstyled && addClass(this.mask, "p-overlay-mask-leave"); - }, "onBeforeLeave"), - onLeave: /* @__PURE__ */ __name(function onLeave() { - unblockBodyScroll(); - this.$emit("hide"); - }, "onLeave"), - onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave(el) { - ZIndex.clear(el); - this.maskVisible = false; - }, "onAfterLeave"), - focus: /* @__PURE__ */ __name(function focus2() { - var focusTarget = this.mask.querySelector("[autofocus]"); - if (focusTarget) { - focusTarget.focus(); - } - }, "focus"), - hidePreview: /* @__PURE__ */ __name(function hidePreview() { - this.previewVisible = false; - this.rotate = 0; - this.scale = 1; - unblockBodyScroll(); - }, "hidePreview") - }, - computed: { - containerClass: /* @__PURE__ */ __name(function containerClass2() { - return [this.cx("root"), this["class"]]; - }, "containerClass"), - rotateClass: /* @__PURE__ */ __name(function rotateClass() { - return "p-image-preview-rotate-" + this.rotate; - }, "rotateClass"), - imagePreviewStyle: /* @__PURE__ */ __name(function imagePreviewStyle() { - return { - transform: "rotate(" + this.rotate + "deg) scale(" + this.scale + ")" - }; - }, "imagePreviewStyle"), - isZoomInDisabled: /* @__PURE__ */ __name(function isZoomInDisabled() { - return this.zoomInDisabled || this.scale >= 1.5; - }, "isZoomInDisabled"), - isZoomOutDisabled: /* @__PURE__ */ __name(function isZoomOutDisabled() { - return this.zoomOutDisabled || this.scale <= 0.5; - }, "isZoomOutDisabled"), - rightAriaLabel: /* @__PURE__ */ __name(function rightAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.rotateRight : void 0; - }, "rightAriaLabel"), - leftAriaLabel: /* @__PURE__ */ __name(function leftAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.rotateLeft : void 0; - }, "leftAriaLabel"), - zoomInAriaLabel: /* @__PURE__ */ __name(function zoomInAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.zoomIn : void 0; - }, "zoomInAriaLabel"), - zoomOutAriaLabel: /* @__PURE__ */ __name(function zoomOutAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.zoomOut : void 0; - }, "zoomOutAriaLabel"), - zoomImageAriaLabel: /* @__PURE__ */ __name(function zoomImageAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.zoomImage : void 0; - }, "zoomImageAriaLabel"), - closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : void 0; - }, "closeAriaLabel") - }, - components: { - Portal: script$1m, - EyeIcon: script$N, - RefreshIcon: script$M, - UndoIcon: script$J, - SearchMinusIcon: script$L, - SearchPlusIcon: script$K, - TimesIcon: script$1q - }, - directives: { - focustrap: FocusTrap - } -}; -function _typeof$h(o) { - "@babel/helpers - typeof"; - return _typeof$h = "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$h(o); -} -__name(_typeof$h, "_typeof$h"); -function ownKeys$f(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$f, "ownKeys$f"); -function _objectSpread$f(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$f(Object(t2), true).forEach(function(r2) { - _defineProperty$g(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$f(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$f, "_objectSpread$f"); -function _defineProperty$g(e, r, t2) { - return (r = _toPropertyKey$g(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$g, "_defineProperty$g"); -function _toPropertyKey$g(t2) { - var i = _toPrimitive$g(t2, "string"); - return "symbol" == _typeof$h(i) ? i : i + ""; -} -__name(_toPropertyKey$g, "_toPropertyKey$g"); -function _toPrimitive$g(t2, r) { - if ("object" != _typeof$h(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$h(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$g, "_toPrimitive$g"); -var _hoisted_1$m = ["aria-label"]; -var _hoisted_2$f = ["aria-modal"]; -var _hoisted_3$c = ["aria-label"]; -var _hoisted_4$8 = ["aria-label"]; -var _hoisted_5$3 = ["disabled", "aria-label"]; -var _hoisted_6$1 = ["disabled", "aria-label"]; -var _hoisted_7$1 = ["aria-label"]; -var _hoisted_8$1 = ["src"]; -function render$D(_ctx, _cache, $props, $setup, $data, $options) { - var _component_RefreshIcon = resolveComponent("RefreshIcon"); - var _component_UndoIcon = resolveComponent("UndoIcon"); - var _component_SearchMinusIcon = resolveComponent("SearchMinusIcon"); - var _component_SearchPlusIcon = resolveComponent("SearchPlusIcon"); - var _component_TimesIcon = resolveComponent("TimesIcon"); - var _component_Portal = resolveComponent("Portal"); - var _directive_focustrap = resolveDirective("focustrap"); - return openBlock(), createElementBlock("span", mergeProps({ - "class": $options.containerClass, - style: _ctx.style - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "image", { - errorCallback: $options.onError - }, function() { - return [createBaseVNode("img", mergeProps({ - style: _ctx.imageStyle, - "class": _ctx.imageClass, - onError: _cache[0] || (_cache[0] = function() { - return $options.onError && $options.onError.apply($options, arguments); - }) - }, _objectSpread$f(_objectSpread$f({}, _ctx.$attrs), _ctx.ptm("image"))), null, 16)]; - }), _ctx.preview ? (openBlock(), createElementBlock("button", mergeProps({ - key: 0, - ref: "previewButton", - "aria-label": $options.zoomImageAriaLabel, - type: "button", - "class": _ctx.cx("previewMask"), - onClick: _cache[1] || (_cache[1] = function() { - return $options.onImageClick && $options.onImageClick.apply($options, arguments); - }) - }, _objectSpread$f(_objectSpread$f({}, _ctx.previewButtonProps), _ctx.ptm("previewMask"))), [renderSlot(_ctx.$slots, _ctx.$slots.previewicon ? "previewicon" : "indicatoricon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.previewIcon || _ctx.indicatorIcon ? "i" : "EyeIcon"), mergeProps({ - "class": _ctx.cx("previewIcon") - }, _ctx.ptm("previewIcon")), null, 16, ["class"]))]; - })], 16, _hoisted_1$m)) : createCommentVNode("", true), createVNode(_component_Portal, null, { - "default": withCtx(function() { - return [$data.maskVisible ? withDirectives((openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: $options.maskRef, - role: "dialog", - "class": _ctx.cx("mask"), - "aria-modal": $data.maskVisible, - onClick: _cache[8] || (_cache[8] = function() { - return $options.onMaskClick && $options.onMaskClick.apply($options, arguments); - }), - onKeydown: _cache[9] || (_cache[9] = function() { - return $options.onMaskKeydown && $options.onMaskKeydown.apply($options, arguments); - }) - }, _ctx.ptm("mask")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("toolbar") - }, _ctx.ptm("toolbar")), [createBaseVNode("button", mergeProps({ - "class": _ctx.cx("rotateRightButton"), - onClick: _cache[2] || (_cache[2] = function() { - return $options.rotateRight && $options.rotateRight.apply($options, arguments); - }), - type: "button", - "aria-label": $options.rightAriaLabel - }, _ctx.ptm("rotateRightButton"), { - "data-pc-group-section": "action" - }), [renderSlot(_ctx.$slots, "refresh", {}, function() { - return [createVNode(_component_RefreshIcon, normalizeProps(guardReactiveProps(_ctx.ptm("rotateRightIcon"))), null, 16)]; - })], 16, _hoisted_3$c), createBaseVNode("button", mergeProps({ - "class": _ctx.cx("rotateLeftButton"), - onClick: _cache[3] || (_cache[3] = function() { - return $options.rotateLeft && $options.rotateLeft.apply($options, arguments); - }), - type: "button", - "aria-label": $options.leftAriaLabel - }, _ctx.ptm("rotateLeftButton"), { - "data-pc-group-section": "action" - }), [renderSlot(_ctx.$slots, "undo", {}, function() { - return [createVNode(_component_UndoIcon, normalizeProps(guardReactiveProps(_ctx.ptm("rotateLeftIcon"))), null, 16)]; - })], 16, _hoisted_4$8), createBaseVNode("button", mergeProps({ - "class": _ctx.cx("zoomOutButton"), - onClick: _cache[4] || (_cache[4] = function() { - return $options.zoomOut && $options.zoomOut.apply($options, arguments); - }), - type: "button", - disabled: $options.isZoomOutDisabled, - "aria-label": $options.zoomOutAriaLabel - }, _ctx.ptm("zoomOutButton"), { - "data-pc-group-section": "action" - }), [renderSlot(_ctx.$slots, "zoomout", {}, function() { - return [createVNode(_component_SearchMinusIcon, normalizeProps(guardReactiveProps(_ctx.ptm("zoomOutIcon"))), null, 16)]; - })], 16, _hoisted_5$3), createBaseVNode("button", mergeProps({ - "class": _ctx.cx("zoomInButton"), - onClick: _cache[5] || (_cache[5] = function() { - return $options.zoomIn && $options.zoomIn.apply($options, arguments); - }), - type: "button", - disabled: $options.isZoomInDisabled, - "aria-label": $options.zoomInAriaLabel - }, _ctx.ptm("zoomInButton"), { - "data-pc-group-section": "action" - }), [renderSlot(_ctx.$slots, "zoomin", {}, function() { - return [createVNode(_component_SearchPlusIcon, normalizeProps(guardReactiveProps(_ctx.ptm("zoomInIcon"))), null, 16)]; - })], 16, _hoisted_6$1), createBaseVNode("button", mergeProps({ - "class": _ctx.cx("closeButton"), - type: "button", - onClick: _cache[6] || (_cache[6] = function() { - return $options.hidePreview && $options.hidePreview.apply($options, arguments); - }), - "aria-label": $options.closeAriaLabel, - autofocus: "" - }, _ctx.ptm("closeButton"), { - "data-pc-group-section": "action" - }), [renderSlot(_ctx.$slots, "close", {}, function() { - return [createVNode(_component_TimesIcon, normalizeProps(guardReactiveProps(_ctx.ptm("closeIcon"))), null, 16)]; - })], 16, _hoisted_7$1)], 16), createVNode(Transition, mergeProps({ - name: "p-image-original", - onBeforeEnter: $options.onBeforeEnter, - onEnter: $options.onEnter, - onLeave: $options.onLeave, - onBeforeLeave: $options.onBeforeLeave, - onAfterLeave: $options.onAfterLeave - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [$data.previewVisible ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ - key: 0 - }, _ctx.ptm("originalContainer"))), [renderSlot(_ctx.$slots, _ctx.$slots.original ? "original" : "preview", { - "class": normalizeClass(_ctx.cx("original")), - style: normalizeStyle($options.imagePreviewStyle), - previewCallback: $options.onPreviewImageClick - }, function() { - return [createBaseVNode("img", mergeProps({ - src: _ctx.$attrs.src, - "class": _ctx.cx("original"), - style: $options.imagePreviewStyle, - onClick: _cache[7] || (_cache[7] = function() { - return $options.onPreviewImageClick && $options.onPreviewImageClick.apply($options, arguments); - }) - }, _ctx.ptm("original")), null, 16, _hoisted_8$1)]; - })], 16)) : createCommentVNode("", true)]; - }), - _: 3 - }, 16, ["onBeforeEnter", "onEnter", "onLeave", "onBeforeLeave", "onAfterLeave"])], 16, _hoisted_2$f)), [[_directive_focustrap]]) : createCommentVNode("", true)]; - }), - _: 3 - })], 16); -} -__name(render$D, "render$D"); -script$I.render = render$D; -var theme$p = /* @__PURE__ */ __name(function theme14(_ref) { - var dt = _ref.dt; - return "\n.p-imagecompare {\n position: relative;\n overflow: hidden;\n width: 100%;\n aspect-ratio: 16 / 9;\n}\n\n.p-imagecompare img {\n width: 100%;\n height: 100%;\n position: absolute;\n}\n\n.p-imagecompare img + img {\n clip-path: polygon(0 0, ".concat(dt("imagecompare.scope.x", "50%"), " 0, ").concat(dt("imagecompare.scope.x", "50%"), " 100%, 0 100%);\n}\n\n.p-imagecompare:dir(rtl) img + img {\n clip-path: polygon(calc(100% - ").concat(dt("imagecompare.scope.x", "50%"), ") 0, 100% 0, 100% 100%, calc(100% - ").concat(dt("imagecompare.scope.x", "50%"), ") 100%);\n}\n\n.p-imagecompare-slider {\n position: relative;\n -webkit-appearance: none;\n width: calc(100% + ").concat(dt("imagecompare.handle.size"), ");\n height: 100%;\n margin-inline-start: calc(-1 * calc(").concat(dt("imagecompare.handle.size"), " / 2));\n background-color: transparent;\n outline: none;\n transition: all ").concat(dt("imagecompare.handle.transition.duration"), ";\n}\n\n.p-imagecompare-slider::-webkit-slider-thumb {\n -webkit-appearance: none;\n height: ").concat(dt("imagecompare.handle.size"), ";\n width: ").concat(dt("imagecompare.handle.size"), ";\n background: ").concat(dt("imagecompare.handle.background"), ";\n border: ").concat(dt("imagecompare.handle.border.width"), " solid ").concat(dt("imagecompare.handle.border.color"), ";\n border-radius: ").concat(dt("imagecompare.handle.border.radius"), ";\n background-size: contain;\n cursor: ew-resize;\n transition: all ").concat(dt("imagecompare.handle.transition.duration"), ";\n}\n\n.p-imagecompare-slider::-moz-range-thumb {\n height: ").concat(dt("imagecompare.handle.size"), ";\n width: ").concat(dt("imagecompare.handle.size"), ";\n background: ").concat(dt("imagecompare.handle.background"), ";\n border: ").concat(dt("imagecompare.handle.border.width"), " ").concat(dt("imagecompare.handle.border.style"), " ").concat(dt("imagecompare.handle.border.color"), ";\n border-radius: ").concat(dt("imagecompare.handle.border.radius"), ";\n background-size: contain;\n cursor: ew-resize;\n}\n\n.p-imagecompare-slider:focus-visible::-webkit-slider-thumb {\n box-shadow: ").concat(dt("imagecompare.handle.focus.ring.shadow"), ";\n outline: ").concat(dt("imagecompare.handle.focus.ring.width"), " ").concat(dt("imagecompare.handle.focus.ring.style"), " ").concat(dt("imagecompare.handle.focus.ring.color"), ";\n outline-offset: ").concat(dt("imagecompare.handle.focus.ring.offset"), ";\n}\n\n.p-imagecompare-slider:focus-visible::-moz-range-thumb {\n box-shadow: ").concat(dt("imagecompare.handle.focus.ring.shadow"), ";\n outline: ").concat(dt("imagecompare.handle.focus.ring.width"), " ").concat(dt("imagecompare.handle.focus.ring.style"), " ").concat(dt("imagecompare.handle.focus.ring.color"), ";\n outline-offset: ").concat(dt("imagecompare.handle.focus.ring.offset"), ";\n}\n\n.p-imagecompare-slider:hover {\n width: calc(100% + ").concat(dt("imagecompare.handle.hover.size"), ");\n margin-inline-start: calc(-1 * calc(").concat(dt("imagecompare.handle.hover.size"), " / 2));\n}\n\n.p-imagecompare-slider:hover::-webkit-slider-thumb {\n background: ").concat(dt("imagecompare.handle.hover.background"), ";\n border-color: ").concat(dt("imagecompare.handle.hover.border.color"), ";\n height: ").concat(dt("imagecompare.handle.hover.size"), ";\n width: ").concat(dt("imagecompare.handle.hover.size"), ";\n}\n\n.p-imagecompare-slider:hover::-moz-range-thumb {\n background: ").concat(dt("imagecompare.handle.hover.background"), ";\n border-color: ").concat(dt("imagecompare.handle.hover.border.color"), ";\n height: ").concat(dt("imagecompare.handle.hover.size"), ";\n width: ").concat(dt("imagecompare.handle.hover.size"), ";\n}\n"); -}, "theme"); -var classes$s = { - root: "p-imagecompare", - slider: "p-imagecompare-slider" -}; -var ImageCompareStyle = BaseStyle.extend({ - name: "imagecompare", - theme: theme$p, - classes: classes$s -}); -var script$1$s = { - name: "BaseImageCompare", - "extends": script$1f, - props: { - tabindex: { - type: Number, - "default": 0 - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - } - }, - style: ImageCompareStyle, - provide: /* @__PURE__ */ __name(function provide22() { - return { - $pcImageCompare: this, - $parentInstance: this - }; - }, "provide") -}; -var script$H = { - name: "ImageCompare", - "extends": script$1$s, - methods: { - onSlide: /* @__PURE__ */ __name(function onSlide(event2) { - var value2 = event2.target.value; - var image = event2.target.previousElementSibling; - setCSSProperty(image, $dt("imagecompare.scope.x").name, "".concat(value2, "%")); - }, "onSlide") - } -}; -var _hoisted_1$l = ["aria-labelledby", "aria-label"]; -function render$C(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root"), - "aria-labelledby": _ctx.ariaLabelledby, - "aria-label": _ctx.ariaLabel - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "left"), renderSlot(_ctx.$slots, "right"), createBaseVNode("input", mergeProps({ - type: "range", - min: "0", - max: "100", - value: "50", - onInput: _cache[0] || (_cache[0] = function() { - return $options.onSlide && $options.onSlide.apply($options, arguments); - }), - "class": _ctx.cx("slider") - }, _ctx.ptm("slider")), null, 16)], 16, _hoisted_1$l); -} -__name(render$C, "render$C"); -script$H.render = render$C; -var theme$o = /* @__PURE__ */ __name(function theme15(_ref) { - var dt = _ref.dt; - return "\n.p-inlinemessage {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: ".concat(dt("inlinemessage.padding"), ";\n border-radius: ").concat(dt("inlinemessage.border.radius"), ";\n gap: ").concat(dt("inlinemessage.gap"), ";\n}\n\n.p-inlinemessage-text {\n font-weight: ").concat(dt("inlinemessage.text.font.weight"), ";\n}\n\n.p-inlinemessage-icon {\n flex-shrink: 0;\n font-size: ").concat(dt("inlinemessage.icon.size"), ";\n width: ").concat(dt("inlinemessage.icon.size"), ";\n height: ").concat(dt("inlinemessage.icon.size"), ";\n}\n\n.p-inlinemessage-icon-only .p-inlinemessage-text {\n visibility: hidden;\n width: 0;\n}\n\n.p-inlinemessage-info {\n background: ").concat(dt("inlinemessage.info.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.info.border.color"), ";\n color: ").concat(dt("inlinemessage.info.color"), ";\n box-shadow: ").concat(dt("inlinemessage.info.shadow"), ";\n}\n\n.p-inlinemessage-info .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.info.color"), ";\n}\n\n.p-inlinemessage-success {\n background: ").concat(dt("inlinemessage.success.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.success.border.color"), ";\n color: ").concat(dt("inlinemessage.success.color"), ";\n box-shadow: ").concat(dt("inlinemessage.success.shadow"), ";\n}\n\n.p-inlinemessage-success .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.success.color"), ";\n}\n\n.p-inlinemessage-warn {\n background: ").concat(dt("inlinemessage.warn.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.warn.border.color"), ";\n color: ").concat(dt("inlinemessage.warn.color"), ";\n box-shadow: ").concat(dt("inlinemessage.warn.shadow"), ";\n}\n\n.p-inlinemessage-warn .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.warn.color"), ";\n}\n\n.p-inlinemessage-error {\n background: ").concat(dt("inlinemessage.error.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.error.border.color"), ";\n color: ").concat(dt("inlinemessage.error.color"), ";\n box-shadow: ").concat(dt("inlinemessage.error.shadow"), ";\n}\n\n.p-inlinemessage-error .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.error.color"), ";\n}\n\n.p-inlinemessage-secondary {\n background: ").concat(dt("inlinemessage.secondary.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.secondary.border.color"), ";\n color: ").concat(dt("inlinemessage.secondary.color"), ";\n box-shadow: ").concat(dt("inlinemessage.secondary.shadow"), ";\n}\n\n.p-inlinemessage-secondary .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.secondary.color"), ";\n}\n\n.p-inlinemessage-contrast {\n background: ").concat(dt("inlinemessage.contrast.background"), ";\n border: 1px solid ").concat(dt("inlinemessage.contrast.border.color"), ";\n color: ").concat(dt("inlinemessage.contrast.color"), ";\n box-shadow: ").concat(dt("inlinemessage.contrast.shadow"), ";\n}\n\n.p-inlinemessage-contrast .p-inlinemessage-icon {\n color: ").concat(dt("inlinemessage.contrast.color"), ";\n}\n"); -}, "theme"); -var classes$r = { - root: /* @__PURE__ */ __name(function root13(_ref2) { - var props = _ref2.props, instance = _ref2.instance; - return ["p-inlinemessage p-component p-inlinemessage-" + props.severity, { - "p-inlinemessage-icon-only": !instance.$slots["default"] - }]; - }, "root"), - icon: /* @__PURE__ */ __name(function icon(_ref3) { - var props = _ref3.props; - return ["p-inlinemessage-icon", props.icon]; - }, "icon"), - text: "p-inlinemessage-text" -}; -var InlineMessageStyle = BaseStyle.extend({ - name: "inlinemessage", - theme: theme$o, - classes: classes$r -}); -var script$1$r = { - name: "BaseInlineMessage", - "extends": script$1f, - props: { - severity: { - type: String, - "default": "error" - }, - icon: { - type: String, - "default": void 0 - } - }, - style: InlineMessageStyle, - provide: /* @__PURE__ */ __name(function provide23() { - return { - $pcInlineMessage: this, - $parentInstance: this - }; - }, "provide") -}; -var script$G = { - name: "InlineMessage", - "extends": script$1$r, - inheritAttrs: false, - timeout: null, - data: /* @__PURE__ */ __name(function data14() { - return { - visible: true - }; - }, "data"), - mounted: /* @__PURE__ */ __name(function mounted18() { - var _this = this; - if (!this.sticky) { - setTimeout(function() { - _this.visible = false; - }, this.life); - } - }, "mounted"), - computed: { - iconComponent: /* @__PURE__ */ __name(function iconComponent() { - return { - info: script$1B, - success: script$1C, - warn: script$1D, - error: script$1E - }[this.severity]; - }, "iconComponent") - } -}; -function render$B(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - role: "alert", - "aria-live": "assertive", - "aria-atomic": "true", - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "icon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon ? "span" : $options.iconComponent), mergeProps({ - "class": _ctx.cx("icon") - }, _ctx.ptm("icon")), null, 16, ["class"]))]; - }), _ctx.$slots["default"] ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("text") - }, _ctx.ptm("text")), [renderSlot(_ctx.$slots, "default")], 16)) : createCommentVNode("", true)], 16); -} -__name(render$B, "render$B"); -script$G.render = render$B; -var theme$n = /* @__PURE__ */ __name(function theme16(_ref) { - var dt = _ref.dt; - return "\n.p-inplace-display {\n display: inline-block;\n cursor: pointer;\n border: 1px solid transparent;\n padding: ".concat(dt("inplace.padding"), ";\n border-radius: ").concat(dt("inplace.border.radius"), ";\n transition: background ").concat(dt("inplace.transition.duration"), ", color ").concat(dt("inplace.transition.duration"), ", outline-color ").concat(dt("inplace.transition.duration"), ", box-shadow ").concat(dt("inplace.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-inplace-display:not(.p-disabled):hover {\n background: ").concat(dt("inplace.display.hover.background"), ";\n color: ").concat(dt("inplace.display.hover.color"), ";\n}\n\n.p-inplace-display:focus-visible {\n box-shadow: ").concat(dt("inplace.focus.ring.shadow"), ";\n outline: ").concat(dt("inplace.focus.ring.width"), " ").concat(dt("inplace.focus.ring.style"), " ").concat(dt("inplace.focus.ring.color"), ";\n outline-offset: ").concat(dt("inplace.focus.ring.offset"), ";\n}\n\n.p-inplace-content {\n display: block;\n}\n"); -}, "theme"); -var classes$q = { - root: "p-inplace p-component", - display: /* @__PURE__ */ __name(function display(_ref2) { - var props = _ref2.props; - return ["p-inplace-display", { - "p-disabled": props.disabled - }]; - }, "display"), - content: "p-inplace-content" -}; -var InplaceStyle = BaseStyle.extend({ - name: "inplace", - theme: theme$n, - classes: classes$q -}); -var script$1$q = { - name: "BaseInplace", - "extends": script$1f, - props: { - active: { - type: Boolean, - "default": false - }, - disabled: { - type: Boolean, - "default": false - }, - displayProps: { - type: null, - "default": null - } - }, - style: InplaceStyle, - provide: /* @__PURE__ */ __name(function provide24() { - return { - $pcInplace: this, - $parentInstance: this - }; - }, "provide") -}; -var script$F = { - name: "Inplace", - "extends": script$1$q, - inheritAttrs: false, - emits: ["open", "close", "update:active"], - data: /* @__PURE__ */ __name(function data15() { - return { - d_active: this.active - }; - }, "data"), - watch: { - active: /* @__PURE__ */ __name(function active2(newValue) { - this.d_active = newValue; - }, "active") - }, - methods: { - open: /* @__PURE__ */ __name(function open(event2) { - if (this.disabled) { - return; - } - this.d_active = true; - this.$emit("open", event2); - this.$emit("update:active", true); - }, "open"), - close: /* @__PURE__ */ __name(function close(event2) { - var _this = this; - this.d_active = false; - this.$emit("close", event2); - this.$emit("update:active", false); - setTimeout(function() { - _this.$refs.display.focus(); - }, 0); - }, "close") - } -}; -function _typeof$g(o) { - "@babel/helpers - typeof"; - return _typeof$g = "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$g(o); -} -__name(_typeof$g, "_typeof$g"); -function ownKeys$e(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$e, "ownKeys$e"); -function _objectSpread$e(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$e(Object(t2), true).forEach(function(r2) { - _defineProperty$f(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$e(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$e, "_objectSpread$e"); -function _defineProperty$f(e, r, t2) { - return (r = _toPropertyKey$f(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$f, "_defineProperty$f"); -function _toPropertyKey$f(t2) { - var i = _toPrimitive$f(t2, "string"); - return "symbol" == _typeof$g(i) ? i : i + ""; -} -__name(_toPropertyKey$f, "_toPropertyKey$f"); -function _toPrimitive$f(t2, r) { - if ("object" != _typeof$g(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$g(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$f, "_toPrimitive$f"); -var _hoisted_1$k = ["tabindex"]; -function render$A(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root"), - "aria-live": "polite" - }, _ctx.ptmi("root")), [!$data.d_active ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: "display", - "class": _ctx.cx("display"), - tabindex: _ctx.$attrs.tabindex || "0", - role: "button", - onClick: _cache[0] || (_cache[0] = function() { - return $options.open && $options.open.apply($options, arguments); - }), - onKeydown: _cache[1] || (_cache[1] = withKeys(function() { - return $options.open && $options.open.apply($options, arguments); - }, ["enter"])) - }, _objectSpread$e(_objectSpread$e({}, _ctx.displayProps), _ctx.ptm("display"))), [renderSlot(_ctx.$slots, "display")], 16, _hoisted_1$k)) : (openBlock(), createElementBlock("div", mergeProps({ - key: 1, - "class": _ctx.cx("content") - }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "content", { - closeCallback: $options.close - })], 16))], 16); -} -__name(render$A, "render$A"); -script$F.render = render$A; -var theme$m = /* @__PURE__ */ __name(function theme17(_ref) { - var dt = _ref.dt; - return "\n.p-inputgroup,\n.p-inputgroup .p-iconfield,\n.p-inputgroup .p-floatlabel,\n.p-inputgroup .p-iftalabel {\n display: flex;\n align-items: stretch;\n width: 100%;\n}\n\n.p-inputgroup .p-inputtext,\n.p-inputgroup .p-inputwrapper {\n flex: 1 1 auto;\n width: 1%;\n}\n\n.p-inputgroupaddon {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: ".concat(dt("inputgroup.addon.padding"), ";\n background: ").concat(dt("inputgroup.addon.background"), ";\n color: ").concat(dt("inputgroup.addon.color"), ";\n border-block-start: 1px solid ").concat(dt("inputgroup.addon.border.color"), ";\n border-block-end: 1px solid ").concat(dt("inputgroup.addon.border.color"), ";\n min-width: ").concat(dt("inputgroup.addon.min.width"), ";\n}\n\n.p-inputgroupaddon:first-child,\n.p-inputgroupaddon + .p-inputgroupaddon {\n border-inline-start: 1px solid ").concat(dt("inputgroup.addon.border.color"), ";\n}\n\n.p-inputgroupaddon:last-child {\n border-inline-end: 1px solid ").concat(dt("inputgroup.addon.border.color"), ";\n}\n\n.p-inputgroupaddon:has(.p-button) {\n padding: 0;\n overflow: hidden;\n}\n\n.p-inputgroupaddon .p-button {\n border-radius: 0;\n}\n\n.p-inputgroup > .p-component,\n.p-inputgroup > .p-inputwrapper > .p-component,\n.p-inputgroup > .p-iconfield > .p-component,\n.p-inputgroup > .p-floatlabel > .p-component,\n.p-inputgroup > .p-floatlabel > .p-inputwrapper > .p-component,\n.p-inputgroup > .p-iftalabel > .p-component,\n.p-inputgroup > .p-iftalabel > .p-inputwrapper > .p-component {\n border-radius: 0;\n margin: 0;\n}\n\n.p-inputgroupaddon:first-child,\n.p-inputgroup > .p-component:first-child,\n.p-inputgroup > .p-inputwrapper:first-child > .p-component,\n.p-inputgroup > .p-iconfield:first-child > .p-component,\n.p-inputgroup > .p-floatlabel:first-child > .p-component,\n.p-inputgroup > .p-floatlabel:first-child > .p-inputwrapper > .p-component,\n.p-inputgroup > .p-iftalabel:first-child > .p-component,\n.p-inputgroup > .p-iftalabel:first-child > .p-inputwrapper > .p-component {\n border-start-start-radius: ").concat(dt("inputgroup.addon.border.radius"), ";\n border-end-start-radius: ").concat(dt("inputgroup.addon.border.radius"), ";\n}\n\n.p-inputgroupaddon:last-child,\n.p-inputgroup > .p-component:last-child,\n.p-inputgroup > .p-inputwrapper:last-child > .p-component,\n.p-inputgroup > .p-iconfield:last-child > .p-component,\n.p-inputgroup > .p-floatlabel:last-child > .p-component,\n.p-inputgroup > .p-floatlabel:last-child > .p-inputwrapper > .p-component,\n.p-inputgroup > .p-iftalabel:last-child > .p-component,\n.p-inputgroup > .p-iftalabel:last-child > .p-inputwrapper > .p-component {\n border-start-end-radius: ").concat(dt("inputgroup.addon.border.radius"), ";\n border-end-end-radius: ").concat(dt("inputgroup.addon.border.radius"), ";\n}\n\n.p-inputgroup .p-component:focus,\n.p-inputgroup .p-component.p-focus,\n.p-inputgroup .p-inputwrapper-focus,\n.p-inputgroup .p-component:focus ~ label,\n.p-inputgroup .p-component.p-focus ~ label,\n.p-inputgroup .p-inputwrapper-focus ~ label {\n z-index: 1;\n}\n\n.p-inputgroup > .p-button:not(.p-button-icon-only) {\n width: auto;\n}\n\n.p-inputgroup .p-iconfield + .p-iconfield .p-inputtext {\n border-inline-start: 0;\n}\n"); -}, "theme"); -var classes$p = { - root: "p-inputgroup" -}; -var InputGroupStyle = BaseStyle.extend({ - name: "inputgroup", - theme: theme$m, - classes: classes$p -}); -var script$1$p = { - name: "BaseInputGroup", - "extends": script$1f, - style: InputGroupStyle, - provide: /* @__PURE__ */ __name(function provide25() { - return { - $pcInputGroup: this, - $parentInstance: this - }; - }, "provide") -}; -var script$E = { - name: "InputGroup", - "extends": script$1$p, - inheritAttrs: false -}; -function render$z(_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$z, "render$z"); -script$E.render = render$z; -var classes$o = { - root: "p-inputgroupaddon" -}; -var InputGroupAddonStyle = BaseStyle.extend({ - name: "inputgroupaddon", - classes: classes$o -}); -var script$1$o = { - name: "BaseInputGroupAddon", - "extends": script$1f, - style: InputGroupAddonStyle, - provide: /* @__PURE__ */ __name(function provide26() { - return { - $pcInputGroupAddon: this, - $parentInstance: this - }; - }, "provide") -}; -var script$D = { - name: "InputGroupAddon", - "extends": script$1$o, - inheritAttrs: false -}; -function render$y(_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$y, "render$y"); -script$D.render = render$y; -var classes$n = { - root: /* @__PURE__ */ __name(function root14(_ref) { - var instance = _ref.instance; - return ["p-inputmask", { - "p-filled": instance.$filled - }]; - }, "root") -}; -var InputMaskStyle = BaseStyle.extend({ - name: "inputmask", - classes: classes$n -}); -var script$1$n = { - name: "BaseInputMask", - "extends": script$1k, - props: { - slotChar: { - type: String, - "default": "_" - }, - id: { - type: String, - "default": null - }, - "class": { - type: [String, Object], - "default": null - }, - mask: { - type: String, - "default": null - }, - placeholder: { - type: String, - "default": null - }, - autoClear: { - type: Boolean, - "default": true - }, - unmask: { - type: Boolean, - "default": false - }, - readonly: { - type: Boolean, - "default": false - } - }, - style: InputMaskStyle, - provide: /* @__PURE__ */ __name(function provide27() { - return { - $pcInputMask: this, - $parentInstance: this - }; - }, "provide") -}; -var script$C = { - name: "InputMask", - "extends": script$1$n, - inheritAttrs: false, - emits: ["focus", "blur", "keydown", "complete", "keypress", "paste"], - inject: { - $pcFluid: { - "default": null - } - }, - data: /* @__PURE__ */ __name(function data16() { - return { - currentVal: "" - }; - }, "data"), - watch: { - mask: /* @__PURE__ */ __name(function mask(newMask, oldMask) { - if (oldMask !== newMask) { - this.initMask(); - } - }, "mask") - }, - mounted: /* @__PURE__ */ __name(function mounted19() { - this.initMask(); - }, "mounted"), - updated: /* @__PURE__ */ __name(function updated3() { - if (this.isValueUpdated()) { - this.updateValue(); - } - }, "updated"), - methods: { - onInput: /* @__PURE__ */ __name(function onInput3(event2) { - if (!event2.isComposing) { - if (this.androidChrome) this.handleAndroidInput(event2); - else this.handleInputChange(event2); - this.updateModelValue(event2.target.value); - } - }, "onInput"), - onFocus: /* @__PURE__ */ __name(function onFocus6(event2) { - var _this = this; - if (this.readonly) { - return; - } - this.focus = true; - clearTimeout(this.caretTimeoutId); - var pos; - this.focusText = this.$el.value; - pos = this.checkVal(); - this.caretTimeoutId = setTimeout(function() { - if (_this.$el !== document.activeElement) { - return; - } - _this.writeBuffer(); - if (pos === _this.mask.replace("?", "").length) { - _this.caret(0, pos); - } else { - _this.caret(pos); - } - }, 10); - this.$emit("focus", event2); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur5(event2) { - var _this$formField$onBlu, _this$formField; - this.focus = false; - this.checkVal(); - this.updateModelValue(event2.target.value); - if (this.$el.value !== this.focusText) { - var e = document.createEvent("HTMLEvents"); - e.initEvent("change", true, false); - this.$el.dispatchEvent(e); - } - this.$emit("blur", event2); - (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField, event2); - }, "onBlur"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown5(event2) { - if (this.readonly) { - return; - } - var k = event2.code, pos, begin, end; - var iPhone = /iphone/i.test(getUserAgent()); - this.oldVal = this.$el.value; - if (k === "Backspace" || k === "Delete" || iPhone && k === "Escape") { - pos = this.caret(); - begin = pos.begin; - end = pos.end; - if (end - begin === 0) { - begin = k !== "Delete" ? this.seekPrev(begin) : end = this.seekNext(begin - 1); - end = k === "Delete" ? this.seekNext(end) : end; - } - this.clearBuffer(begin, end); - this.shiftL(begin, end - 1); - this.updateModelValue(event2.target.value); - event2.preventDefault(); - } else if (k === "Enter") { - this.$el.blur(); - this.updateModelValue(event2.target.value); - } else if (k === "Escape") { - this.$el.value = this.focusText; - this.caret(0, this.checkVal()); - this.updateModelValue(event2.target.value); - event2.preventDefault(); - } - this.$emit("keydown", event2); - }, "onKeyDown"), - onKeyPress: /* @__PURE__ */ __name(function onKeyPress(event2) { - var _this2 = this; - if (this.readonly) { - return; - } - var k = event2.code, pos = this.caret(), p, c, next, completed; - if (event2.ctrlKey || event2.altKey || event2.metaKey || event2.shiftKey || event2.key === "CapsLock" || event2.key === "Escape" || event2.key === "Tab") { - return; - } else if (k && k !== "Enter") { - if (pos.end - pos.begin !== 0) { - this.clearBuffer(pos.begin, pos.end); - this.shiftL(pos.begin, pos.end - 1); - } - p = this.seekNext(pos.begin - 1); - if (p < this.len) { - c = event2.key; - if (this.tests[p].test(c)) { - this.shiftR(p); - this.buffer[p] = c; - this.writeBuffer(); - next = this.seekNext(p); - if (/android/i.test(getUserAgent())) { - var proxy = /* @__PURE__ */ __name(function proxy2() { - _this2.caret(next); - }, "proxy"); - setTimeout(proxy, 0); - } else { - this.caret(next); - } - if (pos.begin <= this.lastRequiredNonMaskPos) { - completed = this.isCompleted(); - } - } - } - event2.preventDefault(); - } - this.updateModelValue(event2.target.value); - if (completed) { - this.$emit("complete", event2); - } - this.$emit("keypress", event2); - }, "onKeyPress"), - onPaste: /* @__PURE__ */ __name(function onPaste2(event2) { - this.handleInputChange(event2); - this.$emit("paste", event2); - }, "onPaste"), - caret: /* @__PURE__ */ __name(function caret(first3, last) { - var range, begin, end; - if (!this.$el.offsetParent || this.$el !== document.activeElement) { - return; - } - if (typeof first3 === "number") { - begin = first3; - end = typeof last === "number" ? last : begin; - if (this.$el.setSelectionRange) { - this.$el.setSelectionRange(begin, end); - } else if (this.$el["createTextRange"]) { - range = this.$el["createTextRange"](); - range.collapse(true); - range.moveEnd("character", end); - range.moveStart("character", begin); - range.select(); - } - } else { - if (this.$el.setSelectionRange) { - begin = this.$el.selectionStart; - end = this.$el.selectionEnd; - } else if (document["selection"] && document["selection"].createRange) { - range = document["selection"].createRange(); - begin = 0 - range.duplicate().moveStart("character", -1e5); - end = begin + range.text.length; - } - return { - begin, - end - }; - } - }, "caret"), - isCompleted: /* @__PURE__ */ __name(function isCompleted() { - for (var i = this.firstNonMaskPos; i <= this.lastRequiredNonMaskPos; i++) { - if (this.tests[i] && this.buffer[i] === this.getPlaceholder(i)) { - return false; - } - } - return true; - }, "isCompleted"), - getPlaceholder: /* @__PURE__ */ __name(function getPlaceholder(i) { - if (i < this.slotChar.length) { - return this.slotChar.charAt(i); - } - return this.slotChar.charAt(0); - }, "getPlaceholder"), - seekNext: /* @__PURE__ */ __name(function seekNext(pos) { - while (++pos < this.len && !this.tests[pos]) ; - return pos; - }, "seekNext"), - seekPrev: /* @__PURE__ */ __name(function seekPrev(pos) { - while (--pos >= 0 && !this.tests[pos]) ; - return pos; - }, "seekPrev"), - shiftL: /* @__PURE__ */ __name(function shiftL(begin, end) { - var i, j; - if (begin < 0) { - return; - } - for (i = begin, j = this.seekNext(end); i < this.len; i++) { - if (this.tests[i]) { - if (j < this.len && this.tests[i].test(this.buffer[j])) { - this.buffer[i] = this.buffer[j]; - this.buffer[j] = this.getPlaceholder(j); - } else { - break; - } - j = this.seekNext(j); - } - } - this.writeBuffer(); - this.caret(Math.max(this.firstNonMaskPos, begin)); - }, "shiftL"), - shiftR: /* @__PURE__ */ __name(function shiftR(pos) { - var i, c, j, t2; - for (i = pos, c = this.getPlaceholder(pos); i < this.len; i++) { - if (this.tests[i]) { - j = this.seekNext(i); - t2 = this.buffer[i]; - this.buffer[i] = c; - if (j < this.len && this.tests[j].test(t2)) { - c = t2; - } else { - break; - } - } - } - }, "shiftR"), - handleAndroidInput: /* @__PURE__ */ __name(function handleAndroidInput(event2) { - var curVal = this.$el.value; - var pos = this.caret(); - if (this.oldVal && this.oldVal.length && this.oldVal.length > curVal.length) { - this.checkVal(true); - while (pos.begin > 0 && !this.tests[pos.begin - 1]) pos.begin--; - if (pos.begin === 0) { - while (pos.begin < this.firstNonMaskPos && !this.tests[pos.begin]) pos.begin++; - } - this.caret(pos.begin, pos.begin); - } else { - this.checkVal(true); - while (pos.begin < this.len && !this.tests[pos.begin]) pos.begin++; - this.caret(pos.begin, pos.begin); - } - if (this.isCompleted()) { - this.$emit("complete", event2); - } - }, "handleAndroidInput"), - clearBuffer: /* @__PURE__ */ __name(function clearBuffer(start, end) { - var i; - for (i = start; i < end && i < this.len; i++) { - if (this.tests[i]) { - this.buffer[i] = this.getPlaceholder(i); - } - } - }, "clearBuffer"), - writeBuffer: /* @__PURE__ */ __name(function writeBuffer() { - this.$el.value = this.buffer.join(""); - }, "writeBuffer"), - checkVal: /* @__PURE__ */ __name(function checkVal(allow) { - this.isValueChecked = true; - var test = this.$el.value, lastMatch = -1, i, c, pos; - for (i = 0, pos = 0; i < this.len; i++) { - if (this.tests[i]) { - this.buffer[i] = this.getPlaceholder(i); - while (pos++ < test.length) { - c = test.charAt(pos - 1); - if (this.tests[i].test(c)) { - this.buffer[i] = c; - lastMatch = i; - break; - } - } - if (pos > test.length) { - this.clearBuffer(i + 1, this.len); - break; - } - } else { - if (this.buffer[i] === test.charAt(pos)) { - pos++; - } - if (i < this.partialPosition) { - lastMatch = i; - } - } - } - if (allow) { - this.writeBuffer(); - } else if (lastMatch + 1 < this.partialPosition) { - if (this.autoClear || this.buffer.join("") === this.defaultBuffer) { - if (this.$el.value) this.$el.value = ""; - this.clearBuffer(0, this.len); - } else { - this.writeBuffer(); - } - } else { - this.writeBuffer(); - this.$el.value = this.$el.value.substring(0, lastMatch + 1); - } - return this.partialPosition ? i : this.firstNonMaskPos; - }, "checkVal"), - handleInputChange: /* @__PURE__ */ __name(function handleInputChange(event2) { - var isPasteEvent = event2.type === "paste"; - if (this.readonly || isPasteEvent) { - return; - } - var pos = this.checkVal(true); - this.caret(pos); - this.updateModelValue(event2.target.value); - if (this.isCompleted()) { - this.$emit("complete", event2); - } - }, "handleInputChange"), - getUnmaskedValue: /* @__PURE__ */ __name(function getUnmaskedValue() { - var unmaskedBuffer = []; - for (var i = 0; i < this.buffer.length; i++) { - var c = this.buffer[i]; - if (this.tests[i] && c !== this.getPlaceholder(i)) { - unmaskedBuffer.push(c); - } - } - return unmaskedBuffer.join(""); - }, "getUnmaskedValue"), - updateModelValue: /* @__PURE__ */ __name(function updateModelValue(value2) { - if (this.currentVal === value2) return; - var val = this.unmask ? this.getUnmaskedValue() : value2; - this.currentVal = value2; - this.writeValue(this.defaultBuffer !== val ? val : ""); - }, "updateModelValue"), - updateValue: /* @__PURE__ */ __name(function updateValue2() { - var _this3 = this; - var updateModel8 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; - if (this.$el) { - if (this.d_value == null) { - this.$el.value = ""; - updateModel8 && this.updateModelValue(""); - } else { - this.$el.value = this.d_value; - this.checkVal(); - setTimeout(function() { - if (_this3.$el) { - _this3.writeBuffer(); - _this3.checkVal(); - if (updateModel8) _this3.updateModelValue(_this3.$el.value); - } - }, 10); - } - this.focusText = this.$el.value; - } - }, "updateValue"), - initMask: /* @__PURE__ */ __name(function initMask() { - this.tests = []; - this.partialPosition = this.mask.length; - this.len = this.mask.length; - this.firstNonMaskPos = null; - this.defs = { - 9: "[0-9]", - a: "[A-Za-z]", - "*": "[A-Za-z0-9]" - }; - var ua = getUserAgent(); - this.androidChrome = /chrome/i.test(ua) && /android/i.test(ua); - var maskTokens = this.mask.split(""); - for (var i = 0; i < maskTokens.length; i++) { - var c = maskTokens[i]; - if (c === "?") { - this.len--; - this.partialPosition = i; - } else if (this.defs[c]) { - this.tests.push(new RegExp(this.defs[c])); - if (this.firstNonMaskPos === null) { - this.firstNonMaskPos = this.tests.length - 1; - } - if (i < this.partialPosition) { - this.lastRequiredNonMaskPos = this.tests.length - 1; - } - } else { - this.tests.push(null); - } - } - this.buffer = []; - for (var _i = 0; _i < maskTokens.length; _i++) { - var _c = maskTokens[_i]; - if (_c !== "?") { - if (this.defs[_c]) this.buffer.push(this.getPlaceholder(_i)); - else this.buffer.push(_c); - } - } - this.defaultBuffer = this.buffer.join(""); - this.updateValue(false); - }, "initMask"), - isValueUpdated: /* @__PURE__ */ __name(function isValueUpdated() { - return this.unmask ? this.d_value != this.getUnmaskedValue() : this.defaultBuffer !== this.$el.value && this.$el.value !== this.d_value; - }, "isValueUpdated") - }, - computed: { - inputClass: /* @__PURE__ */ __name(function inputClass() { - return [this.cx("root"), this["class"]]; - }, "inputClass"), - rootPTOptions: /* @__PURE__ */ __name(function rootPTOptions() { - return { - root: mergeProps(this.ptm("pcInputText", this.ptmParams), this.ptmi("root", this.ptmParams)) - }; - }, "rootPTOptions"), - ptmParams: /* @__PURE__ */ __name(function ptmParams() { - return { - context: { - filled: this.$filled - } - }; - }, "ptmParams") - }, - components: { - InputText: script$1l - } -}; -function render$x(_ctx, _cache, $props, $setup, $data, $options) { - var _component_InputText = resolveComponent("InputText"); - return openBlock(), createBlock(_component_InputText, { - id: _ctx.id, - value: $data.currentVal, - "class": normalizeClass($options.inputClass), - readonly: _ctx.readonly, - disabled: _ctx.disabled, - invalid: _ctx.invalid, - size: _ctx.size, - name: _ctx.name, - variant: _ctx.variant, - placeholder: _ctx.placeholder, - fluid: _ctx.$fluid, - unstyled: _ctx.unstyled, - onInput: $options.onInput, - onCompositionend: $options.onInput, - onFocus: $options.onFocus, - onBlur: $options.onBlur, - onKeydown: $options.onKeyDown, - onKeypress: $options.onKeyPress, - onPaste: $options.onPaste, - pt: $options.rootPTOptions - }, null, 8, ["id", "value", "class", "readonly", "disabled", "invalid", "size", "name", "variant", "placeholder", "fluid", "unstyled", "onInput", "onCompositionend", "onFocus", "onBlur", "onKeydown", "onKeypress", "onPaste", "pt"]); -} -__name(render$x, "render$x"); -script$C.render = render$x; -var theme$l = /* @__PURE__ */ __name(function theme18(_ref) { - var dt = _ref.dt; - return "\n.p-inputotp {\n display: flex;\n align-items: center;\n gap: ".concat(dt("inputotp.gap"), ";\n}\n\n.p-inputotp-input {\n text-align: center;\n width: ").concat(dt("inputotp.input.width"), ";\n}\n\n.p-inputotp-input.p-inputtext-sm {\n text-align: center;\n width: ").concat(dt("inputotp.input.sm.width"), ";\n}\n\n.p-inputotp-input.p-inputtext-lg {\n text-align: center;\n width: ").concat(dt("inputotp.input.lg.width"), ";\n}\n"); -}, "theme"); -var classes$m = { - root: "p-inputotp p-component", - pcInputText: "p-inputotp-input" -}; -var InputOtpStyle = BaseStyle.extend({ - name: "inputotp", - theme: theme$l, - classes: classes$m -}); -var script$1$m = { - name: "BaseInputOtp", - "extends": script$1k, - props: { - readonly: { - type: Boolean, - "default": false - }, - tabindex: { - type: Number, - "default": null - }, - length: { - type: Number, - "default": 4 - }, - mask: { - type: Boolean, - "default": false - }, - integerOnly: { - type: Boolean, - "default": false - } - }, - style: InputOtpStyle, - provide: /* @__PURE__ */ __name(function provide28() { - return { - $pcInputOtp: this, - $parentInstance: this - }; - }, "provide") -}; -var script$B = { - name: "InputOtp", - "extends": script$1$m, - inheritAttrs: false, - emits: ["change", "focus", "blur"], - data: /* @__PURE__ */ __name(function data17() { - return { - tokens: [] - }; - }, "data"), - watch: { - modelValue: { - immediate: true, - handler: /* @__PURE__ */ __name(function handler2(newValue) { - this.tokens = newValue ? newValue.split("") : new Array(this.length); - }, "handler") - } - }, - methods: { - getTemplateAttrs: /* @__PURE__ */ __name(function getTemplateAttrs(index) { - return { - value: this.tokens[index] - }; - }, "getTemplateAttrs"), - getTemplateEvents: /* @__PURE__ */ __name(function getTemplateEvents(index) { - var _this = this; - return { - input: /* @__PURE__ */ __name(function input2(event2) { - return _this.onInput(event2, index); - }, "input"), - keydown: /* @__PURE__ */ __name(function keydown(event2) { - return _this.onKeyDown(event2); - }, "keydown"), - focus: /* @__PURE__ */ __name(function focus4(event2) { - return _this.onFocus(event2); - }, "focus"), - blur: /* @__PURE__ */ __name(function blur(event2) { - return _this.onBlur(event2); - }, "blur"), - paste: /* @__PURE__ */ __name(function paste(event2) { - return _this.onPaste(event2); - }, "paste") - }; - }, "getTemplateEvents"), - onInput: /* @__PURE__ */ __name(function onInput4(event2, index) { - this.tokens[index] = event2.target.value; - this.updateModel(event2); - if (event2.inputType === "deleteContentBackward") { - this.moveToPrev(event2); - } else if (event2.inputType === "insertText" || event2.inputType === "deleteContentForward" || isTouchDevice() && event2 instanceof CustomEvent) { - this.moveToNext(event2); - } - }, "onInput"), - updateModel: /* @__PURE__ */ __name(function updateModel4(event2) { - var newValue = this.tokens.join(""); - this.writeValue(newValue, event2); - this.$emit("change", { - originalEvent: event2, - value: newValue - }); - }, "updateModel"), - moveToPrev: /* @__PURE__ */ __name(function moveToPrev(event2) { - var prevInput = this.findPrevInput(event2.target); - if (prevInput) { - prevInput.focus(); - prevInput.select(); - } - }, "moveToPrev"), - moveToNext: /* @__PURE__ */ __name(function moveToNext(event2) { - var nextInput = this.findNextInput(event2.target); - if (nextInput) { - nextInput.focus(); - nextInput.select(); - } - }, "moveToNext"), - findNextInput: /* @__PURE__ */ __name(function findNextInput(element) { - var nextElement = element.nextElementSibling; - if (!nextElement) return; - return nextElement.nodeName === "INPUT" ? nextElement : this.findNextInput(nextElement); - }, "findNextInput"), - findPrevInput: /* @__PURE__ */ __name(function findPrevInput(element) { - var prevElement = element.previousElementSibling; - if (!prevElement) return; - return prevElement.nodeName === "INPUT" ? prevElement : this.findPrevInput(prevElement); - }, "findPrevInput"), - onFocus: /* @__PURE__ */ __name(function onFocus7(event2) { - event2.target.select(); - this.$emit("focus", event2); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur6(event2) { - this.$emit("blur", event2); - }, "onBlur"), - onClick: /* @__PURE__ */ __name(function onClick3(event2) { - setTimeout(function() { - return event2.target.select(); - }, 1); - }, "onClick"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown6(event2) { - if (event2.ctrlKey || event2.metaKey) { - return; - } - switch (event2.code) { - case "ArrowLeft": - this.moveToPrev(event2); - event2.preventDefault(); - break; - case "ArrowUp": - case "ArrowDown": - event2.preventDefault(); - break; - case "Backspace": - if (event2.target.value.length === 0) { - this.moveToPrev(event2); - event2.preventDefault(); - } - break; - case "ArrowRight": - this.moveToNext(event2); - event2.preventDefault(); - break; - case "Enter": - case "NumpadEnter": - case "Tab": - break; - default: - if (this.integerOnly && !(event2.code !== "Space" && Number(event2.key) >= 0 && Number(event2.key) <= 9) || this.tokens.join("").length >= this.length && event2.code !== "Delete") { - event2.preventDefault(); - } - break; - } - }, "onKeyDown"), - onPaste: /* @__PURE__ */ __name(function onPaste3(event2) { - var paste = event2.clipboardData.getData("text"); - if (paste.length) { - var pastedCode = paste.substring(0, this.length); - if (!this.integerOnly || !isNaN(pastedCode)) { - this.tokens = pastedCode.split(""); - this.updateModel(event2); - } - } - event2.preventDefault(); - }, "onPaste") - }, - computed: { - inputMode: /* @__PURE__ */ __name(function inputMode() { - return this.integerOnly ? "numeric" : "text"; - }, "inputMode"), - inputType: /* @__PURE__ */ __name(function inputType() { - return this.mask ? "password" : "text"; - }, "inputType") - }, - components: { - OtpInputText: script$1l - } -}; -function render$w(_ctx, _cache, $props, $setup, $data, $options) { - var _component_OtpInputText = resolveComponent("OtpInputText"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.length, function(i) { - return renderSlot(_ctx.$slots, "default", { - key: i, - events: $options.getTemplateEvents(i - 1), - attrs: $options.getTemplateAttrs(i - 1), - index: i - }, function() { - return [createVNode(_component_OtpInputText, { - value: $data.tokens[i - 1], - type: $options.inputType, - "class": normalizeClass(_ctx.cx("pcInputText")), - name: _ctx.$formName, - inputmode: $options.inputMode, - variant: _ctx.variant, - readonly: _ctx.readonly, - disabled: _ctx.disabled, - size: _ctx.size, - invalid: _ctx.invalid, - tabindex: _ctx.tabindex, - unstyled: _ctx.unstyled, - onInput: /* @__PURE__ */ __name(function onInput6($event) { - return $options.onInput($event, i - 1); - }, "onInput"), - onFocus: _cache[0] || (_cache[0] = function($event) { - return $options.onFocus($event); - }), - onBlur: _cache[1] || (_cache[1] = function($event) { - return $options.onBlur($event); - }), - onPaste: _cache[2] || (_cache[2] = function($event) { - return $options.onPaste($event); - }), - onKeydown: _cache[3] || (_cache[3] = function($event) { - return $options.onKeyDown($event); - }), - onClick: _cache[4] || (_cache[4] = function($event) { - return $options.onClick($event); - }), - pt: _ctx.ptm("pcInputText") - }, null, 8, ["value", "type", "class", "name", "inputmode", "variant", "readonly", "disabled", "size", "invalid", "tabindex", "unstyled", "onInput", "pt"])]; - }); - }), 128))], 16); -} -__name(render$w, "render$w"); -script$B.render = render$w; -var script$A = { - name: "InputSwitch", - "extends": script$1F, - mounted: /* @__PURE__ */ __name(function mounted20() { - console.warn("Deprecated since v4. Use ToggleSwitch component instead."); - }, "mounted") -}; -var InputSwitchStyle = BaseStyle.extend({ - name: "inputswitch" -}); -var KeyFilterStyle = BaseStyle.extend({ - name: "keyfilter-directive" -}); -var BaseKeyFilter = BaseDirective.extend({ - style: KeyFilterStyle -}); -function _toConsumableArray$8(r) { - return _arrayWithoutHoles$8(r) || _iterableToArray$8(r) || _unsupportedIterableToArray$9(r) || _nonIterableSpread$8(); -} -__name(_toConsumableArray$8, "_toConsumableArray$8"); -function _nonIterableSpread$8() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableSpread$8, "_nonIterableSpread$8"); -function _unsupportedIterableToArray$9(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$9(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$9(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$9, "_unsupportedIterableToArray$9"); -function _iterableToArray$8(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$8, "_iterableToArray$8"); -function _arrayWithoutHoles$8(r) { - if (Array.isArray(r)) return _arrayLikeToArray$9(r); -} -__name(_arrayWithoutHoles$8, "_arrayWithoutHoles$8"); -function _arrayLikeToArray$9(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; -} -__name(_arrayLikeToArray$9, "_arrayLikeToArray$9"); -function _typeof$f(o) { - "@babel/helpers - typeof"; - return _typeof$f = "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$f(o); -} -__name(_typeof$f, "_typeof$f"); -var KeyFilter = BaseKeyFilter.extend("keyfilter", { - beforeMount: /* @__PURE__ */ __name(function beforeMount(el, options4) { - var target = this.getTarget(el); - if (!target) return; - target.$_pkeyfilterModifier = this.getModifiers(options4); - if (_typeof$f(options4.value)) { - var _options$value, _options$value2; - target.$_pkeyfilterPattern = ((_options$value = options4.value) === null || _options$value === void 0 ? void 0 : _options$value.pattern) || options4.value; - target.$_pkeyfilterValidateOnly = ((_options$value2 = options4.value) === null || _options$value2 === void 0 ? void 0 : _options$value2.validateOnly) || false; - } - this.bindEvents(target); - target.setAttribute("data-pd-keyfilter", true); - }, "beforeMount"), - updated: /* @__PURE__ */ __name(function updated4(el, options4) { - var target = this.getTarget(el); - if (!target) return; - target.$_pkeyfilterModifier = this.getModifiers(options4); - this.unbindEvents(el, options4); - if (_typeof$f(options4.value)) { - var _options$value3, _options$value4; - target.$_pkeyfilterPattern = ((_options$value3 = options4.value) === null || _options$value3 === void 0 ? void 0 : _options$value3.pattern) || options4.value; - target.$_pkeyfilterValidateOnly = ((_options$value4 = options4.value) === null || _options$value4 === void 0 ? void 0 : _options$value4.validateOnly) || false; - } - this.bindEvents(target); - }, "updated"), - unmounted: /* @__PURE__ */ __name(function unmounted3(el, options4) { - this.unbindEvents(el, options4); - }, "unmounted"), - DEFAULT_PATTERNS: { - pint: /[\d]/, - "int": /[\d\-]/, - pnum: /[\d\.]/, - money: /[\d\.\s,]/, - num: /[\d\-\.]/, - hex: /[0-9a-f]/i, - email: /[a-z0-9_\.\-@]/i, - alpha: /[a-z_]/i, - alphanum: /[a-z0-9_]/i - }, - methods: { - getTarget: /* @__PURE__ */ __name(function getTarget(el) { - return isAttributeEquals(el, "data-pc-name", "inputtext") || isAttributeEquals(el, "data-pc-name", "textarea") ? el : null; - }, "getTarget"), - getModifiers: /* @__PURE__ */ __name(function getModifiers(options4) { - if (options4.modifiers && Object.keys(options4.modifiers).length) { - return Object.keys(options4.modifiers)[Object.keys.length - 1]; - } - return ""; - }, "getModifiers"), - getRegex: /* @__PURE__ */ __name(function getRegex(target) { - return target.$_pkeyfilterPattern ? target.$_pkeyfilterPattern : target.$_pkeyfilterModifier ? this.DEFAULT_PATTERNS[target.$_pkeyfilterModifier] : /./; - }, "getRegex"), - bindEvents: /* @__PURE__ */ __name(function bindEvents(el) { - var _this = this; - el.$_keyfilterKeydownEvent = function(event2) { - return _this.onKeydown(event2, el); - }; - el.$_keyfilterPasteEvent = function(event2) { - return _this.onPaste(event2, el); - }; - el.addEventListener("keypress", el.$_keyfilterKeydownEvent); - el.addEventListener("paste", el.$_keyfilterPasteEvent); - }, "bindEvents"), - unbindEvents: /* @__PURE__ */ __name(function unbindEvents(el) { - el.removeEventListener("keypress", el.$_keyfilterKeydownEvent); - el.removeEventListener("paste", el.$_keyfilterPasteEvent); - el.$_keyfilterKeydownEvent = null; - el.$_keyfilterPasteEvent = null; - }, "unbindEvents"), - onKeydown: /* @__PURE__ */ __name(function onKeydown2(event2, target) { - if (event2.ctrlKey || event2.altKey || event2.metaKey || event2.key === "Tab") { - return; - } - var regex = this.getRegex(target); - if (regex === "") { - return; - } - var testKey = "".concat(event2.key); - if (target.$_pkeyfilterValidateOnly) { - testKey = "".concat(event2.target.value).concat(event2.key); - } - if (!regex.test(testKey)) { - event2.preventDefault(); - } - }, "onKeydown"), - onPaste: /* @__PURE__ */ __name(function onPaste4(event2, target) { - var regex = this.getRegex(target); - if (regex === "") { - return; - } - var clipboard = event2.clipboardData.getData("text"); - var testKey = ""; - _toConsumableArray$8(clipboard).forEach(function(c) { - if (target.$_pkeyfilterValidateOnly) { - testKey += c; - } else { - testKey = c; - } - if (!regex.test(testKey)) { - event2.preventDefault(); - return false; - } - }); - }, "onPaste") - } -}); -var theme$k = /* @__PURE__ */ __name(function theme19(_ref) { - var dt = _ref.dt; - return "\n.p-knob-range {\n fill: none;\n transition: stroke 0.1s ease-in;\n}\n\n.p-knob-value {\n animation-name: p-knob-dash-frame;\n animation-fill-mode: forwards;\n fill: none;\n}\n\n.p-knob-text {\n font-size: 1.3rem;\n text-align: center;\n}\n\n.p-knob svg {\n border-radius: 50%;\n outline-color: transparent;\n transition: background ".concat(dt("knob.transition.duration"), ", color ").concat(dt("knob.transition.duration"), ", outline-color ").concat(dt("knob.transition.duration"), ", box-shadow ").concat(dt("knob.transition.duration"), ";\n}\n\n.p-knob svg:focus-visible {\n box-shadow: ").concat(dt("knob.focus.ring.shadow"), ";\n outline: ").concat(dt("knob.focus.ring.width"), " ").concat(dt("knob.focus.ring.style"), " ").concat(dt("knob.focus.ring.color"), ";\n outline-offset: ").concat(dt("knob.focus.ring.offset"), ";\n}\n\n@keyframes p-knob-dash-frame {\n 100% {\n stroke-dashoffset: 0;\n }\n}\n"); -}, "theme"); -var classes$l = { - root: /* @__PURE__ */ __name(function root15(_ref2) { - var instance = _ref2.instance, props = _ref2.props; - return ["p-knob p-component", { - "p-disabled": props.disabled, - "p-invalid": instance.$invalid - }]; - }, "root"), - range: "p-knob-range", - value: "p-knob-value", - text: "p-knob-text" -}; -var KnobStyle = BaseStyle.extend({ - name: "knob", - theme: theme$k, - classes: classes$l -}); -var script$1$l = { - name: "BaseKnob", - "extends": script$1r, - props: { - size: { - type: Number, - "default": 100 - }, - readonly: { - type: Boolean, - "default": false - }, - step: { - type: Number, - "default": 1 - }, - min: { - type: Number, - "default": 0 - }, - max: { - type: Number, - "default": 100 - }, - valueColor: { - type: String, - "default": /* @__PURE__ */ __name(function _default9() { - return $dt("knob.value.background").variable; - }, "_default") - }, - rangeColor: { - type: String, - "default": /* @__PURE__ */ __name(function _default10() { - return $dt("knob.range.background").variable; - }, "_default") - }, - textColor: { - type: String, - "default": /* @__PURE__ */ __name(function _default11() { - return $dt("knob.text.color").variable; - }, "_default") - }, - strokeWidth: { - type: Number, - "default": 14 - }, - showValue: { - type: Boolean, - "default": true - }, - valueTemplate: { - type: [String, Function], - "default": "{value}" - }, - tabindex: { - type: Number, - "default": 0 - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - } - }, - style: KnobStyle, - provide: /* @__PURE__ */ __name(function provide29() { - return { - $pcKnob: this, - $parentInstance: this - }; - }, "provide") -}; -var Math_PI$1 = 3.14159265358979; -var script$z = { - name: "Knob", - "extends": script$1$l, - inheritAttrs: false, - emits: ["change"], - data: /* @__PURE__ */ __name(function data18() { - return { - radius: 40, - midX: 50, - midY: 50, - minRadians: 4 * Math_PI$1 / 3, - maxRadians: -Math_PI$1 / 3 - }; - }, "data"), - methods: { - updateValueByOffset: /* @__PURE__ */ __name(function updateValueByOffset(offsetX, offsetY) { - var dx = offsetX - this.size / 2; - var dy = this.size / 2 - offsetY; - var angle = Math.atan2(dy, dx); - var start = -Math_PI$1 / 2 - Math_PI$1 / 6; - this.updateModel(angle, start); - }, "updateValueByOffset"), - updateModel: /* @__PURE__ */ __name(function updateModel5(angle, start) { - var mappedValue; - if (angle > this.maxRadians) mappedValue = this.mapRange(angle, this.minRadians, this.maxRadians, this.min, this.max); - else if (angle < start) mappedValue = this.mapRange(angle + 2 * Math_PI$1, this.minRadians, this.maxRadians, this.min, this.max); - else return; - var newValue = Math.round((mappedValue - this.min) / this.step) * this.step + this.min; - this.writeValue(newValue); - this.$emit("change", newValue); - }, "updateModel"), - updateModelValue: /* @__PURE__ */ __name(function updateModelValue2(newValue) { - if (newValue > this.max) this.writeValue(this.max); - else if (newValue < this.min) this.writeValue(this.min); - else this.writeValue(newValue); - }, "updateModelValue"), - mapRange: /* @__PURE__ */ __name(function mapRange(x, inMin, inMax, outMin, outMax) { - return (x - inMin) * (outMax - outMin) / (inMax - inMin) + outMin; - }, "mapRange"), - onClick: /* @__PURE__ */ __name(function onClick4(event2) { - if (!this.disabled && !this.readonly) { - this.updateValueByOffset(event2.offsetX, event2.offsetY); - } - }, "onClick"), - onBlur: /* @__PURE__ */ __name(function onBlur7(event2) { - var _this$formField$onBlu, _this$formField; - (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField, event2); - }, "onBlur"), - onMouseDown: /* @__PURE__ */ __name(function onMouseDown(event2) { - if (!this.disabled && !this.readonly) { - window.addEventListener("mousemove", this.onMouseMove); - window.addEventListener("mouseup", this.onMouseUp); - event2.preventDefault(); - } - }, "onMouseDown"), - onMouseUp: /* @__PURE__ */ __name(function onMouseUp(event2) { - if (!this.disabled && !this.readonly) { - window.removeEventListener("mousemove", this.onMouseMove); - window.removeEventListener("mouseup", this.onMouseUp); - event2.preventDefault(); - } - }, "onMouseUp"), - onTouchStart: /* @__PURE__ */ __name(function onTouchStart(event2) { - if (!this.disabled && !this.readonly) { - window.addEventListener("touchmove", this.onTouchMove); - window.addEventListener("touchend", this.onTouchEnd); - event2.preventDefault(); - } - }, "onTouchStart"), - onTouchEnd: /* @__PURE__ */ __name(function onTouchEnd(event2) { - if (!this.disabled && !this.readonly) { - window.removeEventListener("touchmove", this.onTouchMove); - window.removeEventListener("touchend", this.onTouchEnd); - event2.preventDefault(); - } - }, "onTouchEnd"), - onMouseMove: /* @__PURE__ */ __name(function onMouseMove(event2) { - if (!this.disabled && !this.readonly) { - this.updateValueByOffset(event2.offsetX, event2.offsetY); - event2.preventDefault(); - } - }, "onMouseMove"), - onTouchMove: /* @__PURE__ */ __name(function onTouchMove(event2) { - if (!this.disabled && !this.readonly && event2.touches.length == 1) { - var rect = this.$el.getBoundingClientRect(); - var touch = event2.targetTouches.item(0); - var offsetX = touch.clientX - rect.left; - var offsetY = touch.clientY - rect.top; - this.updateValueByOffset(offsetX, offsetY); - } - }, "onTouchMove"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown7(event2) { - if (!this.disabled && !this.readonly) { - switch (event2.code) { - case "ArrowRight": - case "ArrowUp": { - event2.preventDefault(); - this.updateModelValue(this.d_value + this.step); - break; - } - case "ArrowLeft": - case "ArrowDown": { - event2.preventDefault(); - this.updateModelValue(this.d_value - this.step); - break; - } - case "Home": { - event2.preventDefault(); - this.writeValue(this.min); - break; - } - case "End": { - event2.preventDefault(); - this.writeValue(this.max); - break; - } - case "PageUp": { - event2.preventDefault(); - this.updateModelValue(this.d_value + 10); - break; - } - case "PageDown": { - event2.preventDefault(); - this.updateModelValue(this.d_value - 10); - break; - } - } - } - }, "onKeyDown") - }, - computed: { - rangePath: /* @__PURE__ */ __name(function rangePath() { - return "M ".concat(this.minX, " ").concat(this.minY, " A ").concat(this.radius, " ").concat(this.radius, " 0 1 1 ").concat(this.maxX, " ").concat(this.maxY); - }, "rangePath"), - valuePath: /* @__PURE__ */ __name(function valuePath() { - return "M ".concat(this.zeroX, " ").concat(this.zeroY, " A ").concat(this.radius, " ").concat(this.radius, " 0 ").concat(this.largeArc, " ").concat(this.sweep, " ").concat(this.valueX, " ").concat(this.valueY); - }, "valuePath"), - zeroRadians: /* @__PURE__ */ __name(function zeroRadians() { - if (this.min > 0 && this.max > 0) return this.mapRange(this.min, this.min, this.max, this.minRadians, this.maxRadians); - else return this.mapRange(0, this.min, this.max, this.minRadians, this.maxRadians); - }, "zeroRadians"), - valueRadians: /* @__PURE__ */ __name(function valueRadians() { - return this.mapRange(this.d_value, this.min, this.max, this.minRadians, this.maxRadians); - }, "valueRadians"), - minX: /* @__PURE__ */ __name(function minX() { - return this.midX + Math.cos(this.minRadians) * this.radius; - }, "minX"), - minY: /* @__PURE__ */ __name(function minY() { - return this.midY - Math.sin(this.minRadians) * this.radius; - }, "minY"), - maxX: /* @__PURE__ */ __name(function maxX() { - return this.midX + Math.cos(this.maxRadians) * this.radius; - }, "maxX"), - maxY: /* @__PURE__ */ __name(function maxY() { - return this.midY - Math.sin(this.maxRadians) * this.radius; - }, "maxY"), - zeroX: /* @__PURE__ */ __name(function zeroX() { - return this.midX + Math.cos(this.zeroRadians) * this.radius; - }, "zeroX"), - zeroY: /* @__PURE__ */ __name(function zeroY() { - return this.midY - Math.sin(this.zeroRadians) * this.radius; - }, "zeroY"), - valueX: /* @__PURE__ */ __name(function valueX() { - return this.midX + Math.cos(this.valueRadians) * this.radius; - }, "valueX"), - valueY: /* @__PURE__ */ __name(function valueY() { - return this.midY - Math.sin(this.valueRadians) * this.radius; - }, "valueY"), - largeArc: /* @__PURE__ */ __name(function largeArc() { - return Math.abs(this.zeroRadians - this.valueRadians) < Math_PI$1 ? 0 : 1; - }, "largeArc"), - sweep: /* @__PURE__ */ __name(function sweep() { - return this.valueRadians > this.zeroRadians ? 0 : 1; - }, "sweep"), - valueToDisplay: /* @__PURE__ */ __name(function valueToDisplay() { - if (typeof this.valueTemplate === "string") { - return this.valueTemplate.replace(/{value}/g, this.d_value); - } else { - return this.valueTemplate(this.d_value); - } - }, "valueToDisplay") - } -}; -var _hoisted_1$j = ["width", "height", "tabindex", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-labelledby", "aria-label"]; -var _hoisted_2$e = ["d", "stroke-width", "stroke"]; -var _hoisted_3$b = ["d", "stroke-width", "stroke"]; -var _hoisted_4$7 = ["fill"]; -function render$v(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [(openBlock(), createElementBlock("svg", mergeProps({ - viewBox: "0 0 100 100", - role: "slider", - width: _ctx.size, - height: _ctx.size, - tabindex: _ctx.readonly || _ctx.disabled ? -1 : _ctx.tabindex, - "aria-valuemin": _ctx.min, - "aria-valuemax": _ctx.max, - "aria-valuenow": _ctx.d_value, - "aria-labelledby": _ctx.ariaLabelledby, - "aria-label": _ctx.ariaLabel, - onClick: _cache[0] || (_cache[0] = function() { - return $options.onClick && $options.onClick.apply($options, arguments); - }), - onBlur: _cache[1] || (_cache[1] = function() { - return $options.onBlur && $options.onBlur.apply($options, arguments); - }), - onKeydown: _cache[2] || (_cache[2] = function() { - return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); - }), - onMousedown: _cache[3] || (_cache[3] = function() { - return $options.onMouseDown && $options.onMouseDown.apply($options, arguments); - }), - onMouseup: _cache[4] || (_cache[4] = function() { - return $options.onMouseUp && $options.onMouseUp.apply($options, arguments); - }), - onTouchstartPassive: _cache[5] || (_cache[5] = function() { - return $options.onTouchStart && $options.onTouchStart.apply($options, arguments); - }), - onTouchend: _cache[6] || (_cache[6] = function() { - return $options.onTouchEnd && $options.onTouchEnd.apply($options, arguments); - }) - }, _ctx.ptm("svg")), [createBaseVNode("path", mergeProps({ - d: $options.rangePath, - "stroke-width": _ctx.strokeWidth, - stroke: _ctx.rangeColor, - "class": _ctx.cx("range") - }, _ctx.ptm("range")), null, 16, _hoisted_2$e), createBaseVNode("path", mergeProps({ - d: $options.valuePath, - "stroke-width": _ctx.strokeWidth, - stroke: _ctx.valueColor, - "class": _ctx.cx("value") - }, _ctx.ptm("value")), null, 16, _hoisted_3$b), _ctx.showValue ? (openBlock(), createElementBlock("text", mergeProps({ - key: 0, - x: 50, - y: 57, - "text-anchor": "middle", - fill: _ctx.textColor, - "class": _ctx.cx("text") - }, _ctx.ptm("text")), toDisplayString($options.valueToDisplay), 17, _hoisted_4$7)) : createCommentVNode("", true)], 16, _hoisted_1$j))], 16); -} -__name(render$v, "render$v"); -script$z.render = render$v; -var theme$j = /* @__PURE__ */ __name(function theme20(_ref) { - var dt = _ref.dt; - return "\n.p-megamenu {\n position: relative;\n display: flex;\n align-items: center;\n background: ".concat(dt("megamenu.background"), ";\n border: 1px solid ").concat(dt("megamenu.border.color"), ";\n border-radius: ").concat(dt("megamenu.border.radius"), ";\n color: ").concat(dt("megamenu.color"), ";\n gap: ").concat(dt("megamenu.gap"), ";\n}\n\n.p-megamenu-start,\n.p-megamenu-end {\n display: flex;\n align-items: center;\n}\n\n.p-megamenu-root-list {\n margin: 0;\n padding: 0;\n list-style: none;\n outline: 0 none;\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n gap: ").concat(dt("megamenu.gap"), ";\n}\n\n.p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content {\n border-radius: ").concat(dt("megamenu.base.item.border.radius"), ";\n}\n\n.p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content > .p-megamenu-item-link {\n padding: ").concat(dt("megamenu.base.item.padding"), ";\n}\n\n.p-megamenu-item-content {\n transition: background ").concat(dt("megamenu.transition.duration"), ", color ").concat(dt("megamenu.transition.duration"), ";\n border-radius: ").concat(dt("megamenu.item.border.radius"), ";\n color: ").concat(dt("megamenu.item.color"), ";\n}\n\n.p-megamenu-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("megamenu.item.padding"), ";\n gap: ").concat(dt("megamenu.item.gap"), ";\n user-select: none;\n outline: 0 none;\n}\n\n.p-megamenu-item-label {\n line-height: 1;\n}\n\n.p-megamenu-item-icon {\n color: ").concat(dt("megamenu.item.icon.color"), ";\n}\n\n.p-megamenu-submenu-icon {\n color: ").concat(dt("megamenu.submenu.icon.color"), ";\n font-size: ").concat(dt("megamenu.submenu.icon.size"), ";\n width: ").concat(dt("megamenu.submenu.icon.size"), ";\n height: ").concat(dt("megamenu.submenu.icon.size"), ";\n}\n\n.p-megamenu-item.p-focus > .p-megamenu-item-content {\n color: ").concat(dt("megamenu.item.focus.color"), ";\n background: ").concat(dt("megamenu.item.focus.background"), ";\n}\n\n.p-megamenu-item.p-focus > .p-megamenu-item-content .p-megamenu-item-icon {\n color: ").concat(dt("megamenu.item.icon.focus.color"), ";\n}\n\n.p-megamenu-item.p-focus > .p-megamenu-item-content .p-megamenu-submenu-icon {\n color: ").concat(dt("megamenu.submenu.icon.focus.color"), ";\n}\n\n.p-megamenu-item:not(.p-disabled) > .p-megamenu-item-content:hover {\n color: ").concat(dt("megamenu.item.focus.color"), ";\n background: ").concat(dt("megamenu.item.focus.background"), ";\n}\n\n.p-megamenu-item:not(.p-disabled) > .p-megamenu-item-content:hover .p-megamenu-item-icon {\n color: ").concat(dt("megamenu.item.icon.focus.color"), ";\n}\n\n.p-megamenu-item:not(.p-disabled) > .p-megamenu-item-content:hover .p-megamenu-submenu-icon {\n color: ").concat(dt("megamenu.submenu.icon.focus.color"), ";\n}\n\n.p-megamenu-item-active > .p-megamenu-item-content {\n color: ").concat(dt("megamenu.item.active.color"), ";\n background: ").concat(dt("megamenu.item.active.background"), ";\n}\n\n.p-megamenu-item-active > .p-megamenu-item-content .p-megamenu-item-icon {\n color: ").concat(dt("megamenu.item.icon.active.color"), ";\n}\n\n.p-megamenu-item-active > .p-megamenu-item-content .p-megamenu-submenu-icon {\n color: ").concat(dt("megamenu.submenu.icon.active.color"), ";\n}\n\n.p-megamenu-overlay {\n display: none;\n position: absolute;\n width: auto;\n z-index: 1;\n left: 0;\n min-width: 100%;\n padding: ").concat(dt("megamenu.overlay.padding"), ";\n background: ").concat(dt("megamenu.overlay.background"), ";\n color: ").concat(dt("megamenu.overlay.color"), ";\n border: 1px solid ").concat(dt("megamenu.overlay.border.color"), ";\n border-radius: ").concat(dt("megamenu.overlay.border.radius"), ";\n box-shadow: ").concat(dt("megamenu.overlay.shadow"), ";\n}\n\n.p-megamenu-overlay:dir(rtl) {\n left: auto;\n right: 0;\n}\n\n.p-megamenu-root-list > .p-megamenu-item-active > .p-megamenu-overlay {\n display: block;\n}\n\n.p-megamenu-submenu {\n margin: 0;\n list-style: none;\n padding: ").concat(dt("megamenu.submenu.padding"), ";\n min-width: 12.5rem;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("megamenu.submenu.gap"), "\n}\n\n.p-megamenu-submenu-label {\n padding: ").concat(dt("megamenu.submenu.label.padding"), ";\n color: ").concat(dt("megamenu.submenu.label.color"), ";\n font-weight: ").concat(dt("megamenu.submenu.label.font.weight"), ";\n background: ").concat(dt("megamenu.submenu.label.background"), ";\n}\n\n.p-megamenu-separator {\n border-block-start: 1px solid ").concat(dt("megamenu.separator.border.color"), ";\n}\n\n.p-megamenu-horizontal {\n align-items: center;\n padding: ").concat(dt("megamenu.horizontal.orientation.padding"), ";\n}\n\n.p-megamenu-horizontal .p-megamenu-root-list {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: ").concat(dt("megamenu.horizontal.orientation.gap"), ";\n}\n\n.p-megamenu-horizontal .p-megamenu-end {\n margin-left: auto;\n align-self: center;\n}\n\n.p-megamenu-horizontal .p-megamenu-end:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\n}\n\n.p-megamenu-vertical {\n display: inline-flex;\n min-width: 12.5rem;\n flex-direction: column;\n align-items: stretch;\n padding: ").concat(dt("megamenu.vertical.orientation.padding"), ";\n}\n\n.p-megamenu-vertical .p-megamenu-root-list {\n align-items: stretch;\n flex-direction: column;\n gap: ").concat(dt("megamenu.vertical.orientation.gap"), ";\n}\n\n.p-megamenu-vertical .p-megamenu-root-list > .p-megamenu-item-active > .p-megamenu-overlay {\n left: 100%;\n top: 0;\n}\n\n.p-megamenu-vertical .p-megamenu-root-list > .p-megamenu-item-active > .p-megamenu-overlay:dir(rtl) {\n left: auto;\n right: 100%;\n}\n\n.p-megamenu-vertical .p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content .p-megamenu-submenu-icon {\n margin-left: auto;\n}\n\n.p-megamenu-vertical .p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content .p-megamenu-submenu-icon:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\n transform: rotate(180deg);\n}\n\n.p-megamenu-grid {\n display: flex;\n}\n\n.p-megamenu-col-2,\n.p-megamenu-col-3,\n.p-megamenu-col-4,\n.p-megamenu-col-6,\n.p-megamenu-col-12 {\n flex: 0 0 auto;\n padding: ").concat(dt("megamenu.overlay.gap"), ";\n}\n\n.p-megamenu-col-2 {\n width: 16.6667%;\n}\n\n.p-megamenu-col-3 {\n width: 25%;\n}\n\n.p-megamenu-col-4 {\n width: 33.3333%;\n}\n\n.p-megamenu-col-6 {\n width: 50%;\n}\n\n.p-megamenu-col-12 {\n width: 100%;\n}\n\n.p-megamenu-button {\n display: none;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n width: ").concat(dt("megamenu.mobile.button.size"), ";\n height: ").concat(dt("megamenu.mobile.button.size"), ";\n position: relative;\n color: ").concat(dt("megamenu.mobile.button.color"), ";\n border: 0 none;\n background: transparent;\n border-radius: ").concat(dt("megamenu.mobile.button.border.radius"), ";\n transition: background ").concat(dt("megamenu.transition.duration"), ", color ").concat(dt("megamenu.transition.duration"), ", outline-color ").concat(dt("megamenu.transition.duration"), ", box-shadow ").concat(dt("megamenu.transition.duration"), ";\n outline-color: transparent;\n}\n\n.p-megamenu-button:hover {\n color: ").concat(dt("megamenu.mobile.button.hover.color"), ";\n background: ").concat(dt("megamenu.mobile.button.hover.background"), ";\n}\n\n.p-megamenu-button:focus-visible {\n box-shadow: ").concat(dt("megamenu.mobile.button.focus.ring.shadow"), ";\n outline: ").concat(dt("megamenu.mobile.button.focus.ring.width"), " ").concat(dt("megamenu.mobile.button.focus.ring.style"), " ").concat(dt("megamenu.mobile.button.focus.ring.color"), ";\n outline-offset: ").concat(dt("megamenu.mobile.button.focus.ring.offset"), ";\n}\n\n.p-megamenu-mobile {\n display: flex;\n}\n\n.p-megamenu-mobile .p-megamenu-button {\n display: flex;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list {\n position: absolute;\n display: none;\n flex-direction: column;\n top: 100%;\n left: 0;\n z-index: 1;\n width: 100%;\n padding: ").concat(dt("megamenu.submenu.padding"), ";\n gap: ").concat(dt("megamenu.submenu.gap"), ";\n background: ").concat(dt("megamenu.overlay.background"), ";\n border: 1px solid ").concat(dt("megamenu.overlay.border.color"), ";\n box-shadow: ").concat(dt("megamenu.overlay.shadow"), ";\n}\n\n.p-megamenu-mobile .p-megamenu-root-list:dir(rtl) {\n left: auto;\n right: 0;\n}\n\n.p-megamenu-mobile-active .p-megamenu-root-list {\n display: block;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list .p-megamenu-item {\n width: 100%;\n position: static;\n}\n\n.p-megamenu-mobile .p-megamenu-overlay {\n position: static;\n border: 0 none;\n border-radius: 0;\n box-shadow: none;\n}\n\n.p-megamenu-mobile .p-megamenu-grid {\n flex-wrap: wrap;\n overflow: auto;\n max-height: 90%;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content .p-megamenu-submenu-icon {\n margin-left: auto;\n transition: transform 0.2s;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list > .p-megamenu-item > .p-megamenu-item-content .p-megamenu-submenu-icon:dir(rtl) {\n margin-left: 0;\n margin-right: auto;\n}\n\n.p-megamenu-mobile .p-megamenu-root-list > .p-megamenu-item-active > .p-megamenu-item-content .p-megamenu-submenu-icon {\n transform: rotate(-180deg);\n}\n"); -}, "theme"); -var inlineStyles$6 = { - rootList: /* @__PURE__ */ __name(function rootList(_ref2) { - var props = _ref2.props; - return { - "max-height": props.scrollHeight, - overflow: "auto" - }; - }, "rootList") -}; -var classes$k = { - root: /* @__PURE__ */ __name(function root16(_ref3) { - var instance = _ref3.instance; - return ["p-megamenu p-component", { - "p-megamenu-mobile": instance.queryMatches, - "p-megamenu-mobile-active": instance.mobileActive, - "p-megamenu-horizontal": instance.horizontal, - "p-megamenu-vertical": instance.vertical - }]; - }, "root"), - start: "p-megamenu-start", - button: "p-megamenu-button", - rootList: "p-megamenu-root-list", - submenuLabel: /* @__PURE__ */ __name(function submenuLabel(_ref4) { - var instance = _ref4.instance, processedItem = _ref4.processedItem; - return ["p-megamenu-submenu-label", { - "p-disabled": instance.isItemDisabled(processedItem) - }]; - }, "submenuLabel"), - item: /* @__PURE__ */ __name(function item3(_ref5) { - var instance = _ref5.instance, processedItem = _ref5.processedItem; - return ["p-megamenu-item", { - "p-megamenu-item-active": instance.isItemActive(processedItem), - "p-focus": instance.isItemFocused(processedItem), - "p-disabled": instance.isItemDisabled(processedItem) - }]; - }, "item"), - itemContent: "p-megamenu-item-content", - itemLink: "p-megamenu-item-link", - itemIcon: "p-megamenu-item-icon", - itemLabel: "p-megamenu-item-label", - submenuIcon: "p-megamenu-submenu-icon", - overlay: "p-megamenu-overlay", - grid: "p-megamenu-grid", - column: /* @__PURE__ */ __name(function column(_ref6) { - var instance = _ref6.instance, processedItem = _ref6.processedItem; - var length = instance.isItemGroup(processedItem) ? processedItem.items.length : 0; - var columnClass; - if (instance.$parentInstance.queryMatches) columnClass = "p-megamenu-col-12"; - else { - switch (length) { - case 2: - columnClass = "p-megamenu-col-6"; - break; - case 3: - columnClass = "p-megamenu-col-4"; - break; - case 4: - columnClass = "p-megamenu-col-3"; - break; - case 6: - columnClass = "p-megamenu-col-2"; - break; - default: - columnClass = "p-megamenu-col-12"; - break; - } - } - return columnClass; - }, "column"), - submenu: "p-megamenu-submenu", - separator: "p-megamenu-separator", - end: "p-megamenu-end" -}; -var MegaMenuStyle = BaseStyle.extend({ - name: "megamenu", - theme: theme$j, - classes: classes$k, - inlineStyles: inlineStyles$6 -}); -var script$2$5 = { - name: "BaseMegaMenu", - "extends": script$1f, - props: { - model: { - type: Array, - "default": null - }, - orientation: { - type: String, - "default": "horizontal" - }, - breakpoint: { - type: String, - "default": "960px" - }, - disabled: { - type: Boolean, - "default": false - }, - tabindex: { - type: Number, - "default": 0 - }, - scrollHeight: { - type: String, - "default": "20rem" - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - } - }, - style: MegaMenuStyle, - provide: /* @__PURE__ */ __name(function provide30() { - return { - $pcMegaMenu: this, - $parentInstance: this - }; - }, "provide") -}; -var script$1$k = { - name: "MegaMenuSub", - hostName: "MegaMenu", - "extends": script$1f, - emits: ["item-click", "item-mouseenter"], - props: { - menuId: { - type: String, - "default": null - }, - focusedItemId: { - type: String, - "default": null - }, - horizontal: { - type: Boolean, - "default": false - }, - submenu: { - type: Object, - "default": null - }, - mobileActive: { - type: Boolean, - "default": false - }, - items: { - type: Array, - "default": null - }, - level: { - type: Number, - "default": 0 - }, - templates: { - type: Object, - "default": null - }, - activeItem: { - type: Object, - "default": null - }, - tabindex: { - type: Number, - "default": 0 - } - }, - methods: { - getSubListId: /* @__PURE__ */ __name(function getSubListId(processedItem) { - return "".concat(this.getItemId(processedItem), "_list"); - }, "getSubListId"), - getSubListKey: /* @__PURE__ */ __name(function getSubListKey(processedItem) { - return this.getSubListId(processedItem); - }, "getSubListKey"), - getItemId: /* @__PURE__ */ __name(function getItemId2(processedItem) { - return "".concat(this.menuId, "_").concat(processedItem.key); - }, "getItemId"), - getItemKey: /* @__PURE__ */ __name(function getItemKey(processedItem) { - return this.getItemId(processedItem); - }, "getItemKey"), - getItemProp: /* @__PURE__ */ __name(function getItemProp2(processedItem, name4, params) { - return processedItem && processedItem.item ? resolve(processedItem.item[name4], params) : void 0; - }, "getItemProp"), - getItemLabel: /* @__PURE__ */ __name(function getItemLabel(processedItem) { - return this.getItemProp(processedItem, "label"); - }, "getItemLabel"), - getPTOptions: /* @__PURE__ */ __name(function getPTOptions3(processedItem, index, key) { - return this.ptm(key, { - context: { - item: processedItem.item, - index, - active: this.isItemActive(processedItem), - focused: this.isItemFocused(processedItem), - disabled: this.isItemDisabled(processedItem) - } - }); - }, "getPTOptions"), - isItemActive: /* @__PURE__ */ __name(function isItemActive3(processedItem) { - return isNotEmpty(this.activeItem) ? this.activeItem.key === processedItem.key : false; - }, "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 onItemClick2(event2, processedItem) { - this.getItemProp(processedItem, "command", { - originalEvent: event2, - item: processedItem.item - }); - this.$emit("item-click", { - originalEvent: event2, - processedItem, - isFocus: true - }); - }, "onItemClick"), - onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter2(event2, processedItem) { - this.$emit("item-mouseenter", { - originalEvent: event2, - processedItem - }); - }, "onItemMouseEnter"), - 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 getAriaPosInset(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 getMenuItemProps3(processedItem, index) { - return { - action: mergeProps({ - "class": this.cx("itemLink"), - tabindex: -1 - }, 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("label") - }, this.getPTOptions(processedItem, index, "label")), - submenuicon: mergeProps({ - "class": this.cx("submenuIcon") - }, this.getPTOptions(processedItem, index, "submenuIcon")) - }; - }, "getMenuItemProps") - }, - components: { - AngleRightIcon: script$1o, - AngleDownIcon: script$1G - }, - directives: { - ripple: Ripple - } -}; -var _hoisted_1$1$4 = ["tabindex"]; -var _hoisted_2$1$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$a = ["onClick", "onMouseenter"]; -var _hoisted_4$6 = ["href", "target"]; -var _hoisted_5$2 = ["id"]; -function render$1$5(_ctx, _cache, $props, $setup, $data, $options) { - var _component_MegaMenuSub = resolveComponent("MegaMenuSub", true); - var _directive_ripple = resolveDirective("ripple"); - return openBlock(), createElementBlock("ul", mergeProps({ - "class": $props.level === 0 ? _ctx.cx("rootList") : _ctx.cx("submenu"), - tabindex: $props.tabindex - }, $props.level === 0 ? _ctx.ptm("rootList") : _ctx.ptm("submenu")), [$props.submenu ? (openBlock(), createElementBlock("li", mergeProps({ - key: 0, - "class": [_ctx.cx("submenuLabel", { - submenu: $props.submenu - }), $options.getItemProp($props.submenu, "class")], - style: $options.getItemProp($props.submenu, "style"), - role: "presentation" - }, _ctx.ptm("submenuLabel")), toDisplayString($options.getItemLabel($props.submenu)), 17)) : createCommentVNode("", true), (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 onClick11($event) { - return $options.onItemClick($event, processedItem); - }, "onClick"), - onMouseenter: /* @__PURE__ */ __name(function onMouseenter($event) { - return $options.onItemMouseEnter($event, processedItem); - }, "onMouseenter"), - 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({ - "class": _ctx.cx("itemLabel"), - ref_for: true - }, $options.getPTOptions(processedItem, index, "itemLabel")), toDisplayString($options.getItemLabel(processedItem)), 17), $options.isItemGroup(processedItem) ? (openBlock(), createElementBlock(Fragment, { - key: 2 - }, [$props.templates.submenuicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.submenuicon), mergeProps({ - key: 0, - active: $options.isItemActive(processedItem), - "class": _ctx.cx("submenuIcon"), - ref_for: true - }, $options.getPTOptions(processedItem, index, "submenuIcon")), null, 16, ["active", "class"])) : (openBlock(), createBlock(resolveDynamicComponent($props.horizontal || $props.mobileActive ? "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_4$6)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { - key: 1, - item: processedItem.item, - hasSubmenu: $options.isItemGroup(processedItem), - label: $options.getItemLabel(processedItem), - props: $options.getMenuItemProps(processedItem, index) - }, null, 8, ["item", "hasSubmenu", "label", "props"]))], 16, _hoisted_3$a), $options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("overlay"), - ref_for: true - }, _ctx.ptm("overlay")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("grid"), - ref_for: true - }, _ctx.ptm("grid")), [(openBlock(true), createElementBlock(Fragment, null, renderList(processedItem.items, function(col) { - return openBlock(), createElementBlock("div", mergeProps({ - key: $options.getItemKey(col), - "class": _ctx.cx("column", { - processedItem - }), - ref_for: true - }, _ctx.ptm("column")), [(openBlock(true), createElementBlock(Fragment, null, renderList(col, function(submenu) { - return openBlock(), createBlock(_component_MegaMenuSub, { - key: $options.getSubListKey(submenu), - id: $options.getSubListId(submenu), - style: normalizeStyle(_ctx.sx("submenu", true, { - processedItem - })), - role: "menu", - menuId: $props.menuId, - focusedItemId: $props.focusedItemId, - submenu, - items: submenu.items, - templates: $props.templates, - level: $props.level + 1, - mobileActive: $props.mobileActive, - 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); - }) - }, null, 8, ["id", "style", "menuId", "focusedItemId", "submenu", "items", "templates", "level", "mobileActive", "pt", "unstyled"]); - }), 128))], 16); - }), 128))], 16)], 16)) : createCommentVNode("", true)], 16, _hoisted_2$1$3)) : 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$2)) : createCommentVNode("", true)], 64); - }), 128))], 16, _hoisted_1$1$4); -} -__name(render$1$5, "render$1$5"); -script$1$k.render = render$1$5; -var script$y = { - name: "MegaMenu", - "extends": script$2$5, - inheritAttrs: false, - emits: ["focus", "blur"], - outsideClickListener: null, - resizeListener: null, - matchMediaListener: null, - container: null, - menubar: null, - searchTimeout: null, - searchValue: null, - data: /* @__PURE__ */ __name(function data19() { - return { - id: this.$attrs.id, - mobileActive: false, - focused: false, - focusedItemInfo: { - index: -1, - key: "", - parentKey: "" - }, - activeItem: null, - dirty: false, - query: null, - queryMatches: false - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId5(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId"), - activeItem: /* @__PURE__ */ __name(function activeItem(newItem) { - if (isNotEmpty(newItem)) { - this.bindOutsideClickListener(); - this.bindResizeListener(); - } else { - this.unbindOutsideClickListener(); - this.unbindResizeListener(); - } - }, "activeItem") - }, - mounted: /* @__PURE__ */ __name(function mounted21() { - this.id = this.id || UniqueComponentId(); - this.bindMatchMediaListener(); - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount7() { - this.mobileActive = false; - this.unbindOutsideClickListener(); - this.unbindResizeListener(); - this.unbindMatchMediaListener(); - }, "beforeUnmount"), - methods: { - getItemProp: /* @__PURE__ */ __name(function getItemProp3(item8, name4) { - return item8 ? resolve(item8[name4]) : void 0; - }, "getItemProp"), - getItemLabel: /* @__PURE__ */ __name(function getItemLabel2(item8) { - return this.getItemProp(item8, "label"); - }, "getItemLabel"), - isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled2(item8) { - return this.getItemProp(item8, "disabled"); - }, "isItemDisabled"), - isItemVisible: /* @__PURE__ */ __name(function isItemVisible2(item8) { - return this.getItemProp(item8, "visible") !== false; - }, "isItemVisible"), - isItemGroup: /* @__PURE__ */ __name(function isItemGroup2(item8) { - return isNotEmpty(this.getItemProp(item8, "items")); - }, "isItemGroup"), - isItemSeparator: /* @__PURE__ */ __name(function isItemSeparator(item8) { - return this.getItemProp(item8, "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 toggle2(event2) { - 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(); - event2.preventDefault(); - }, "toggle"), - show: /* @__PURE__ */ __name(function show2() { - this.focusedItemInfo = { - index: this.findFirstFocusedItemIndex(), - level: 0, - parentKey: "" - }; - focus(this.menubar); - }, "show"), - hide: /* @__PURE__ */ __name(function hide2(event2, isFocus) { - var _this2 = this; - if (this.mobileActive) { - this.mobileActive = false; - setTimeout(function() { - focus(_this2.$refs.menubutton, { - preventScroll: true - }); - }, 1); - } - this.activeItem = null; - this.focusedItemInfo = { - index: -1, - key: "", - parentKey: "" - }; - isFocus && focus(this.menubar); - this.dirty = false; - }, "hide"), - onFocus: /* @__PURE__ */ __name(function onFocus8(event2) { - this.focused = true; - if (this.focusedItemInfo.index === -1) { - var index = this.findFirstFocusedItemIndex(); - var processedItem = this.findVisibleItem(index); - this.focusedItemInfo = { - index, - key: processedItem.key, - parentKey: processedItem.parentKey - }; - } - this.$emit("focus", event2); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur8(event2) { - this.focused = false; - this.focusedItemInfo = { - index: -1, - key: "", - parentKey: "" - }; - this.searchValue = ""; - this.dirty = false; - this.$emit("blur", event2); - }, "onBlur"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown8(event2) { - if (this.disabled) { - event2.preventDefault(); - return; - } - var metaKey = event2.metaKey || event2.ctrlKey; - switch (event2.code) { - case "ArrowDown": - this.onArrowDownKey(event2); - break; - case "ArrowUp": - this.onArrowUpKey(event2); - break; - case "ArrowLeft": - this.onArrowLeftKey(event2); - break; - case "ArrowRight": - this.onArrowRightKey(event2); - break; - case "Home": - this.onHomeKey(event2); - break; - case "End": - this.onEndKey(event2); - break; - case "Space": - this.onSpaceKey(event2); - break; - case "Enter": - case "NumpadEnter": - this.onEnterKey(event2); - break; - case "Escape": - this.onEscapeKey(event2); - break; - case "Tab": - this.onTabKey(event2); - break; - case "PageDown": - case "PageUp": - case "Backspace": - case "ShiftLeft": - case "ShiftRight": - break; - default: - if (!metaKey && isPrintableCharacter(event2.key)) { - this.searchItems(event2, event2.key); - } - break; - } - }, "onKeyDown"), - onItemChange: /* @__PURE__ */ __name(function onItemChange(event2) { - var processedItem = event2.processedItem, isFocus = event2.isFocus; - if (isEmpty(processedItem)) return; - var index = processedItem.index, key = processedItem.key, parentKey = processedItem.parentKey, items2 = processedItem.items; - var grouped = isNotEmpty(items2); - grouped && (this.activeItem = processedItem); - this.focusedItemInfo = { - index, - key, - parentKey - }; - grouped && (this.dirty = true); - isFocus && focus(this.menubar); - }, "onItemChange"), - onItemClick: /* @__PURE__ */ __name(function onItemClick3(event2) { - var originalEvent = event2.originalEvent, processedItem = event2.processedItem; - var grouped = this.isProccessedItemGroup(processedItem); - var root34 = isEmpty(processedItem.parent); - var selected3 = this.isSelected(processedItem); - if (selected3) { - var index = processedItem.index, key = processedItem.key, parentKey = processedItem.parentKey; - this.activeItem = null; - this.focusedItemInfo = { - index, - key, - parentKey - }; - this.dirty = !root34; - if (!this.mobileActive) { - focus(this.menubar, { - preventScroll: true - }); - } - } else { - if (grouped) { - this.onItemChange(event2); - } else { - this.hide(originalEvent); - } - } - }, "onItemClick"), - onItemMouseEnter: /* @__PURE__ */ __name(function onItemMouseEnter3(event2) { - if (!this.mobileActive && this.dirty) { - this.onItemChange(event2); - } - }, "onItemMouseEnter"), - menuButtonClick: /* @__PURE__ */ __name(function menuButtonClick(event2) { - this.toggle(event2); - }, "menuButtonClick"), - menuButtonKeydown: /* @__PURE__ */ __name(function menuButtonKeydown(event2) { - (event2.code === "Enter" || event2.code === "NumpadEnter" || event2.code === "Space") && this.menuButtonClick(event2); - }, "menuButtonKeydown"), - onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey4(event2) { - if (this.horizontal) { - if (isNotEmpty(this.activeItem) && this.activeItem.key === this.focusedItemInfo.key) { - this.focusedItemInfo = { - index: -1, - key: "", - parentKey: this.activeItem.key - }; - } else { - var processedItem = this.findVisibleItem(this.focusedItemInfo.index); - var grouped = this.isProccessedItemGroup(processedItem); - if (grouped) { - this.onItemChange({ - originalEvent: event2, - processedItem - }); - this.focusedItemInfo = { - index: -1, - key: processedItem.key, - parentKey: processedItem.parentKey - }; - this.searchValue = ""; - } - } - } - var itemIndex = this.focusedItemInfo.index !== -1 ? this.findNextItemIndex(this.focusedItemInfo.index) : this.findFirstFocusedItemIndex(); - this.changeFocusedItemInfo(event2, itemIndex); - event2.preventDefault(); - }, "onArrowDownKey"), - onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey4(event2) { - if (event2.altKey && this.horizontal) { - if (this.focusedItemInfo.index !== -1) { - var processedItem = this.findVisibleItem(this.focusedItemInfo.index); - var grouped = this.isProccessedItemGroup(processedItem); - if (!grouped && isNotEmpty(this.activeItem)) { - if (this.focusedItemInfo.index === 0) { - this.focusedItemInfo = { - index: this.activeItem.index, - key: this.activeItem.key, - parentKey: this.activeItem.parentKey - }; - this.activeItem = null; - } else { - this.changeFocusedItemInfo(event2, this.findFirstItemIndex()); - } - } - } - event2.preventDefault(); - } else { - var itemIndex = this.focusedItemInfo.index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo.index) : this.findLastFocusedItemIndex(); - this.changeFocusedItemInfo(event2, itemIndex); - event2.preventDefault(); - } - }, "onArrowUpKey"), - onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey2(event2) { - var processedItem = this.findVisibleItem(this.focusedItemInfo.index); - var grouped = this.isProccessedItemGroup(processedItem); - if (grouped) { - if (this.horizontal) { - var itemIndex = this.focusedItemInfo.index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo.index) : this.findLastFocusedItemIndex(); - this.changeFocusedItemInfo(event2, itemIndex); - } - } else { - if (this.vertical && isNotEmpty(this.activeItem)) { - if (processedItem.columnIndex === 0) { - this.focusedItemInfo = { - index: this.activeItem.index, - key: this.activeItem.key, - parentKey: this.activeItem.parentKey - }; - this.activeItem = null; - } - } - var columnIndex = processedItem.columnIndex - 1; - var _itemIndex = this.visibleItems.findIndex(function(item8) { - return item8.columnIndex === columnIndex; - }); - _itemIndex !== -1 && this.changeFocusedItemInfo(event2, _itemIndex); - } - event2.preventDefault(); - }, "onArrowLeftKey"), - onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey2(event2) { - var processedItem = this.findVisibleItem(this.focusedItemInfo.index); - var grouped = this.isProccessedItemGroup(processedItem); - if (grouped) { - if (this.vertical) { - if (isNotEmpty(this.activeItem) && this.activeItem.key === processedItem.key) { - this.focusedItemInfo = { - index: -1, - key: "", - parentKey: this.activeItem.key - }; - } else { - var _processedItem = this.findVisibleItem(this.focusedItemInfo.index); - var _grouped = this.isProccessedItemGroup(_processedItem); - if (_grouped) { - this.onItemChange({ - originalEvent: event2, - processedItem: _processedItem - }); - this.focusedItemInfo = { - index: -1, - key: _processedItem.key, - parentKey: _processedItem.parentKey - }; - this.searchValue = ""; - } - } - } - var itemIndex = this.focusedItemInfo.index !== -1 ? this.findNextItemIndex(this.focusedItemInfo.index) : this.findFirstFocusedItemIndex(); - this.changeFocusedItemInfo(event2, itemIndex); - } else { - var columnIndex = processedItem.columnIndex + 1; - var _itemIndex2 = this.visibleItems.findIndex(function(item8) { - return item8.columnIndex === columnIndex; - }); - _itemIndex2 !== -1 && this.changeFocusedItemInfo(event2, _itemIndex2); - } - event2.preventDefault(); - }, "onArrowRightKey"), - onHomeKey: /* @__PURE__ */ __name(function onHomeKey4(event2) { - this.changeFocusedItemInfo(event2, this.findFirstItemIndex()); - event2.preventDefault(); - }, "onHomeKey"), - onEndKey: /* @__PURE__ */ __name(function onEndKey4(event2) { - this.changeFocusedItemInfo(event2, this.findLastItemIndex()); - event2.preventDefault(); - }, "onEndKey"), - onEnterKey: /* @__PURE__ */ __name(function onEnterKey3(event2) { - 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.changeFocusedItemInfo(event2, this.findFirstFocusedItemIndex()); - } - event2.preventDefault(); - }, "onEnterKey"), - onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey3(event2) { - this.onEnterKey(event2); - }, "onSpaceKey"), - onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey2(event2) { - if (isNotEmpty(this.activeItem)) { - this.focusedItemInfo = { - index: this.activeItem.index, - key: this.activeItem.key - }; - this.activeItem = null; - } - event2.preventDefault(); - }, "onEscapeKey"), - onTabKey: /* @__PURE__ */ __name(function onTabKey2(event2) { - if (this.focusedItemInfo.index !== -1) { - var processedItem = this.findVisibleItem(this.focusedItemInfo.index); - var grouped = this.isProccessedItemGroup(processedItem); - !grouped && this.onItemChange({ - originalEvent: event2, - processedItem - }); - } - this.hide(); - }, "onTabKey"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener3() { - var _this3 = this; - if (!this.outsideClickListener) { - this.outsideClickListener = function(event2) { - var isOutsideContainer = _this3.container && !_this3.container.contains(event2.target); - var isOutsideTarget = !(_this3.target && (_this3.target === event2.target || _this3.target.contains(event2.target))); - if (isOutsideContainer && isOutsideTarget) { - _this3.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 _this4 = this; - if (!this.resizeListener) { - this.resizeListener = function(event2) { - if (!isTouchDevice()) { - _this4.hide(event2, true); - } - _this4.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 bindMatchMediaListener4() { - var _this5 = this; - if (!this.matchMediaListener) { - var query = matchMedia("(max-width: ".concat(this.breakpoint, ")")); - this.query = query; - this.queryMatches = query.matches; - this.matchMediaListener = function() { - _this5.queryMatches = query.matches; - _this5.mobileActive = false; - }; - this.query.addEventListener("change", this.matchMediaListener); - } - }, "bindMatchMediaListener"), - unbindMatchMediaListener: /* @__PURE__ */ __name(function unbindMatchMediaListener4() { - 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 isSelected3(processedItem) { - return isNotEmpty(this.activeItem) ? this.activeItem.key === processedItem.key : false; - }, "isSelected"), - findFirstItemIndex: /* @__PURE__ */ __name(function findFirstItemIndex() { - var _this6 = this; - return this.visibleItems.findIndex(function(processedItem) { - return _this6.isValidItem(processedItem); - }); - }, "findFirstItemIndex"), - findLastItemIndex: /* @__PURE__ */ __name(function findLastItemIndex() { - var _this7 = this; - return findLastIndex(this.visibleItems, function(processedItem) { - return _this7.isValidItem(processedItem); - }); - }, "findLastItemIndex"), - findNextItemIndex: /* @__PURE__ */ __name(function findNextItemIndex(index) { - var _this8 = this; - var matchedItemIndex = index < this.visibleItems.length - 1 ? this.visibleItems.slice(index + 1).findIndex(function(processedItem) { - return _this8.isValidItem(processedItem); - }) : -1; - return matchedItemIndex > -1 ? matchedItemIndex + index + 1 : index; - }, "findNextItemIndex"), - findPrevItemIndex: /* @__PURE__ */ __name(function findPrevItemIndex(index) { - var _this9 = this; - var matchedItemIndex = index > 0 ? findLastIndex(this.visibleItems.slice(0, index), function(processedItem) { - return _this9.isValidItem(processedItem); - }) : -1; - return matchedItemIndex > -1 ? matchedItemIndex : index; - }, "findPrevItemIndex"), - findSelectedItemIndex: /* @__PURE__ */ __name(function findSelectedItemIndex() { - var _this10 = this; - return this.visibleItems.findIndex(function(processedItem) { - return _this10.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"), - findVisibleItem: /* @__PURE__ */ __name(function findVisibleItem(index) { - return isNotEmpty(this.visibleItems) ? this.visibleItems[index] : null; - }, "findVisibleItem"), - searchItems: /* @__PURE__ */ __name(function searchItems(event2, _char) { - var _this11 = 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 _this11.isItemMatched(processedItem); - }); - itemIndex = itemIndex === -1 ? this.visibleItems.slice(0, this.focusedItemInfo.index).findIndex(function(processedItem) { - return _this11.isItemMatched(processedItem); - }) : itemIndex + this.focusedItemInfo.index; - } else { - itemIndex = this.visibleItems.findIndex(function(processedItem) { - return _this11.isItemMatched(processedItem); - }); - } - if (itemIndex !== -1) { - matched = true; - } - if (itemIndex === -1 && this.focusedItemInfo.index === -1) { - itemIndex = this.findFirstFocusedItemIndex(); - } - if (itemIndex !== -1) { - this.changeFocusedItemInfo(event2, itemIndex); - } - if (this.searchTimeout) { - clearTimeout(this.searchTimeout); - } - this.searchTimeout = setTimeout(function() { - _this11.searchValue = ""; - _this11.searchTimeout = null; - }, 500); - return matched; - }, "searchItems"), - changeFocusedItemInfo: /* @__PURE__ */ __name(function changeFocusedItemInfo(event2, index) { - var processedItem = this.findVisibleItem(index); - this.focusedItemInfo.index = index; - this.focusedItemInfo.key = isNotEmpty(processedItem) ? processedItem.key : ""; - this.scrollInView(); - }, "changeFocusedItemInfo"), - scrollInView: /* @__PURE__ */ __name(function scrollInView3() { - var index = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : -1; - var id4 = index !== -1 ? "".concat(this.id, "_").concat(index) : this.focusedItemId; - var element; - if (id4 === null && this.queryMatches) { - element = this.$refs.menubutton; - } else { - element = findSingle(this.menubar, 'li[id="'.concat(id4, '"]')); - } - if (element) { - element.scrollIntoView && element.scrollIntoView({ - block: "nearest", - inline: "nearest", - behavior: "smooth" - }); - } - }, "scrollInView"), - createProcessedItems: /* @__PURE__ */ __name(function createProcessedItems(items2) { - var _this12 = 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 columnIndex = arguments.length > 4 ? arguments[4] : void 0; - var processedItems3 = []; - items2 && items2.forEach(function(item8, index) { - var key = (parentKey !== "" ? parentKey + "_" : "") + (columnIndex !== void 0 ? columnIndex + "_" : "") + index; - var newItem = { - item: item8, - index, - level, - key, - parent, - parentKey, - columnIndex: columnIndex !== void 0 ? columnIndex : parent.columnIndex !== void 0 ? parent.columnIndex : index - }; - newItem["items"] = level === 0 && item8.items && item8.items.length > 0 ? item8.items.map(function(_items, _index) { - return _this12.createProcessedItems(_items, level + 1, newItem, key, _index); - }) : _this12.createProcessedItems(item8.items, level + 1, newItem, key); - processedItems3.push(newItem); - }); - return processedItems3; - }, "createProcessedItems"), - containerRef: /* @__PURE__ */ __name(function containerRef2(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 processedItem = isNotEmpty(this.activeItem) ? this.activeItem : null; - return processedItem && processedItem.key === this.focusedItemInfo.parentKey ? processedItem.items.reduce(function(items2, col) { - col.forEach(function(submenu) { - submenu.items.forEach(function(a) { - items2.push(a); - }); - }); - return items2; - }, []) : this.processedItems; - }, "visibleItems"), - horizontal: /* @__PURE__ */ __name(function horizontal() { - return this.orientation === "horizontal"; - }, "horizontal"), - vertical: /* @__PURE__ */ __name(function vertical() { - return this.orientation === "vertical"; - }, "vertical"), - focusedItemId: /* @__PURE__ */ __name(function focusedItemId() { - return isNotEmpty(this.focusedItemInfo.key) ? "".concat(this.id, "_").concat(this.focusedItemInfo.key) : null; - }, "focusedItemId") - }, - components: { - MegaMenuSub: script$1$k, - BarsIcon: script$1H - } -}; -var _hoisted_1$i = ["id"]; -var _hoisted_2$d = ["aria-haspopup", "aria-expanded", "aria-controls", "aria-label"]; -function render$u(_ctx, _cache, $props, $setup, $data, $options) { - var _component_BarsIcon = resolveComponent("BarsIcon"); - var _component_MegaMenuSub = resolveComponent("MegaMenuSub"); - return openBlock(), createElementBlock("div", mergeProps({ - ref: $options.containerRef, - id: $data.id, - "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(event2) { - return $options.menuButtonClick(event2); - }, "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); - }) - }, _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_2$d)) : createCommentVNode("", true)]; - }), createVNode(_component_MegaMenuSub, { - ref: $options.menubarRef, - id: $data.id + "_list", - tabindex: !_ctx.disabled ? _ctx.tabindex : -1, - role: "menubar", - "aria-label": _ctx.ariaLabel, - "aria-labelledby": _ctx.ariaLabelledby, - "aria-disabled": _ctx.disabled || void 0, - "aria-orientation": _ctx.orientation, - "aria-activedescendant": $data.focused ? $options.focusedItemId : void 0, - menuId: $data.id, - focusedItemId: $data.focused ? $options.focusedItemId : void 0, - items: $options.processedItems, - horizontal: $options.horizontal, - templates: _ctx.$slots, - activeItem: $data.activeItem, - mobileActive: $data.mobileActive, - level: 0, - style: normalizeStyle(_ctx.sx("rootList")), - pt: _ctx.pt, - unstyled: _ctx.unstyled, - onFocus: $options.onFocus, - onBlur: $options.onBlur, - onKeydown: $options.onKeyDown, - onItemClick: $options.onItemClick, - onItemMouseenter: $options.onItemMouseEnter - }, null, 8, ["id", "tabindex", "aria-label", "aria-labelledby", "aria-disabled", "aria-orientation", "aria-activedescendant", "menuId", "focusedItemId", "items", "horizontal", "templates", "activeItem", "mobileActive", "style", "pt", "unstyled", "onFocus", "onBlur", "onKeydown", "onItemClick", "onItemMouseenter"]), _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$i); -} -__name(render$u, "render$u"); -script$y.render = render$u; -var theme$i = /* @__PURE__ */ __name(function theme21(_ref) { - var dt = _ref.dt; - return "\n.p-menu {\n background: ".concat(dt("menu.background"), ";\n color: ").concat(dt("menu.color"), ";\n border: 1px solid ").concat(dt("menu.border.color"), ";\n border-radius: ").concat(dt("menu.border.radius"), ";\n min-width: 12.5rem;\n}\n\n.p-menu-list {\n margin: 0;\n padding: ").concat(dt("menu.list.padding"), ";\n outline: 0 none;\n list-style: none;\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("menu.list.gap"), ";\n}\n\n.p-menu-item-content {\n transition: background ").concat(dt("menu.transition.duration"), ", color ").concat(dt("menu.transition.duration"), ";\n border-radius: ").concat(dt("menu.item.border.radius"), ";\n color: ").concat(dt("menu.item.color"), ";\n}\n\n.p-menu-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("menu.item.padding"), ";\n gap: ").concat(dt("menu.item.gap"), ";\n user-select: none;\n outline: 0 none;\n}\n\n.p-menu-item-label {\n line-height: 1;\n}\n\n.p-menu-item-icon {\n color: ").concat(dt("menu.item.icon.color"), ";\n}\n\n.p-menu-item.p-focus .p-menu-item-content {\n color: ").concat(dt("menu.item.focus.color"), ";\n background: ").concat(dt("menu.item.focus.background"), ";\n}\n\n.p-menu-item.p-focus .p-menu-item-icon {\n color: ").concat(dt("menu.item.icon.focus.color"), ";\n}\n\n.p-menu-item:not(.p-disabled) .p-menu-item-content:hover {\n color: ").concat(dt("menu.item.focus.color"), ";\n background: ").concat(dt("menu.item.focus.background"), ";\n}\n\n.p-menu-item:not(.p-disabled) .p-menu-item-content:hover .p-menu-item-icon {\n color: ").concat(dt("menu.item.icon.focus.color"), ";\n}\n\n.p-menu-overlay {\n box-shadow: ").concat(dt("menu.shadow"), ";\n}\n\n.p-menu-submenu-label {\n background: ").concat(dt("menu.submenu.label.background"), ";\n padding: ").concat(dt("menu.submenu.label.padding"), ";\n color: ").concat(dt("menu.submenu.label.color"), ";\n font-weight: ").concat(dt("menu.submenu.label.font.weight"), ";\n}\n\n.p-menu-separator {\n border-block-start: 1px solid ").concat(dt("menu.separator.border.color"), ";\n}\n"); -}, "theme"); -var classes$j = { - root: /* @__PURE__ */ __name(function root17(_ref2) { - var props = _ref2.props; - return ["p-menu p-component", { - "p-menu-overlay": props.popup - }]; - }, "root"), - start: "p-menu-start", - list: "p-menu-list", - submenuLabel: "p-menu-submenu-label", - separator: "p-menu-separator", - end: "p-menu-end", - item: /* @__PURE__ */ __name(function item4(_ref3) { - var instance = _ref3.instance; - return ["p-menu-item", { - "p-focus": instance.id === instance.focusedOptionId, - "p-disabled": instance.disabled() - }]; - }, "item"), - itemContent: "p-menu-item-content", - itemLink: "p-menu-item-link", - itemIcon: "p-menu-item-icon", - itemLabel: "p-menu-item-label" -}; -var MenuStyle = BaseStyle.extend({ - name: "menu", - theme: theme$i, - classes: classes$j -}); -var script$2$4 = { - name: "BaseMenu", - "extends": script$1f, - props: { - popup: { - type: Boolean, - "default": false - }, - model: { - type: Array, - "default": null - }, - appendTo: { - type: [String, Object], - "default": "body" - }, - autoZIndex: { - type: Boolean, - "default": true - }, - baseZIndex: { - type: Number, - "default": 0 - }, - tabindex: { - type: Number, - "default": 0 - }, - ariaLabel: { - type: String, - "default": null - }, - ariaLabelledby: { - type: String, - "default": null - } - }, - style: MenuStyle, - provide: /* @__PURE__ */ __name(function provide31() { - return { - $pcMenu: this, - $parentInstance: this - }; - }, "provide") -}; -var script$1$j = { - name: "Menuitem", - hostName: "Menu", - "extends": script$1f, - inheritAttrs: false, - emits: ["item-click", "item-mousemove"], - props: { - item: null, - templates: null, - id: null, - focusedOptionId: null, - index: null - }, - methods: { - getItemProp: /* @__PURE__ */ __name(function getItemProp4(processedItem, name4) { - return processedItem && processedItem.item ? resolve(processedItem.item[name4]) : void 0; - }, "getItemProp"), - getPTOptions: /* @__PURE__ */ __name(function getPTOptions4(key) { - return this.ptm(key, { - context: { - item: this.item, - index: this.index, - focused: this.isItemFocused(), - disabled: this.disabled() - } - }); - }, "getPTOptions"), - isItemFocused: /* @__PURE__ */ __name(function isItemFocused2() { - return this.focusedOptionId === this.id; - }, "isItemFocused"), - onItemClick: /* @__PURE__ */ __name(function onItemClick4(event2) { - var command = this.getItemProp(this.item, "command"); - command && command({ - originalEvent: event2, - item: this.item.item - }); - this.$emit("item-click", { - originalEvent: event2, - item: this.item, - id: this.id - }); - }, "onItemClick"), - onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove(event2) { - this.$emit("item-mousemove", { - originalEvent: event2, - item: this.item, - id: this.id - }); - }, "onItemMouseMove"), - visible: /* @__PURE__ */ __name(function visible2() { - return typeof this.item.visible === "function" ? this.item.visible() : this.item.visible !== false; - }, "visible"), - disabled: /* @__PURE__ */ __name(function disabled3() { - return typeof this.item.disabled === "function" ? this.item.disabled() : this.item.disabled; - }, "disabled"), - label: /* @__PURE__ */ __name(function label4() { - return typeof this.item.label === "function" ? this.item.label() : this.item.label; - }, "label"), - getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps4(item8) { - return { - action: mergeProps({ - "class": this.cx("itemLink"), - tabindex: "-1" - }, this.getPTOptions("itemLink")), - icon: mergeProps({ - "class": [this.cx("itemIcon"), item8.icon] - }, this.getPTOptions("itemIcon")), - label: mergeProps({ - "class": this.cx("itemLabel") - }, this.getPTOptions("itemLabel")) - }; - }, "getMenuItemProps") - }, - directives: { - ripple: Ripple - } -}; -var _hoisted_1$1$3 = ["id", "aria-label", "aria-disabled", "data-p-focused", "data-p-disabled"]; -var _hoisted_2$1$2 = ["href", "target"]; -function render$1$4(_ctx, _cache, $props, $setup, $data, $options) { - var _directive_ripple = resolveDirective("ripple"); - return $options.visible() ? (openBlock(), createElementBlock("li", mergeProps({ - key: 0, - id: $props.id, - "class": [_ctx.cx("item"), $props.item["class"]], - role: "menuitem", - style: $props.item.style, - "aria-label": $options.label(), - "aria-disabled": $options.disabled() - }, $options.getPTOptions("item"), { - "data-p-focused": $options.isItemFocused(), - "data-p-disabled": $options.disabled() || false - }), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("itemContent"), - onClick: _cache[0] || (_cache[0] = function($event) { - return $options.onItemClick($event); - }), - onMousemove: _cache[1] || (_cache[1] = function($event) { - return $options.onItemMouseMove($event); - }) - }, $options.getPTOptions("itemContent")), [!$props.templates.item ? withDirectives((openBlock(), createElementBlock("a", mergeProps({ - key: 0, - href: $props.item.url, - "class": _ctx.cx("itemLink"), - target: $props.item.target, - tabindex: "-1" - }, $options.getPTOptions("itemLink")), [$props.templates.itemicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.itemicon), { - key: 0, - item: $props.item, - "class": normalizeClass(_ctx.cx("itemIcon")) - }, null, 8, ["item", "class"])) : $props.item.icon ? (openBlock(), createElementBlock("span", mergeProps({ - key: 1, - "class": [_ctx.cx("itemIcon"), $props.item.icon] - }, $options.getPTOptions("itemIcon")), null, 16)) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ - "class": _ctx.cx("itemLabel") - }, $options.getPTOptions("itemLabel")), toDisplayString($options.label()), 17)], 16, _hoisted_2$1$2)), [[_directive_ripple]]) : $props.templates.item ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { - key: 1, - item: $props.item, - label: $options.label(), - props: $options.getMenuItemProps($props.item) - }, null, 8, ["item", "label", "props"])) : createCommentVNode("", true)], 16)], 16, _hoisted_1$1$3)) : createCommentVNode("", true); -} -__name(render$1$4, "render$1$4"); -script$1$j.render = render$1$4; -function _toConsumableArray$7(r) { - return _arrayWithoutHoles$7(r) || _iterableToArray$7(r) || _unsupportedIterableToArray$8(r) || _nonIterableSpread$7(); -} -__name(_toConsumableArray$7, "_toConsumableArray$7"); -function _nonIterableSpread$7() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableSpread$7, "_nonIterableSpread$7"); -function _unsupportedIterableToArray$8(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$8(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$8(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$8, "_unsupportedIterableToArray$8"); -function _iterableToArray$7(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$7, "_iterableToArray$7"); -function _arrayWithoutHoles$7(r) { - if (Array.isArray(r)) return _arrayLikeToArray$8(r); -} -__name(_arrayWithoutHoles$7, "_arrayWithoutHoles$7"); -function _arrayLikeToArray$8(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; -} -__name(_arrayLikeToArray$8, "_arrayLikeToArray$8"); -var script$x = { - name: "Menu", - "extends": script$2$4, - inheritAttrs: false, - emits: ["show", "hide", "focus", "blur"], - data: /* @__PURE__ */ __name(function data20() { - return { - id: this.$attrs.id, - overlayVisible: false, - focused: false, - focusedOptionIndex: -1, - selectedOptionIndex: -1 - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId6(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId") - }, - target: null, - outsideClickListener: null, - scrollHandler: null, - resizeListener: null, - container: null, - list: null, - mounted: /* @__PURE__ */ __name(function mounted22() { - this.id = this.id || UniqueComponentId(); - if (!this.popup) { - this.bindResizeListener(); - this.bindOutsideClickListener(); - } - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount8() { - this.unbindResizeListener(); - this.unbindOutsideClickListener(); - if (this.scrollHandler) { - this.scrollHandler.destroy(); - this.scrollHandler = null; - } - this.target = null; - if (this.container && this.autoZIndex) { - ZIndex.clear(this.container); - } - this.container = null; - }, "beforeUnmount"), - methods: { - itemClick: /* @__PURE__ */ __name(function itemClick(event2) { - var item8 = event2.item; - if (this.disabled(item8)) { - return; - } - if (item8.command) { - item8.command(event2); - } - if (this.overlayVisible) this.hide(); - if (!this.popup && this.focusedOptionIndex !== event2.id) { - this.focusedOptionIndex = event2.id; - } - }, "itemClick"), - itemMouseMove: /* @__PURE__ */ __name(function itemMouseMove(event2) { - if (this.focused) { - this.focusedOptionIndex = event2.id; - } - }, "itemMouseMove"), - onListFocus: /* @__PURE__ */ __name(function onListFocus2(event2) { - this.focused = true; - !this.popup && this.changeFocusedOptionIndex(0); - this.$emit("focus", event2); - }, "onListFocus"), - onListBlur: /* @__PURE__ */ __name(function onListBlur2(event2) { - this.focused = false; - this.focusedOptionIndex = -1; - this.$emit("blur", event2); - }, "onListBlur"), - onListKeyDown: /* @__PURE__ */ __name(function onListKeyDown2(event2) { - switch (event2.code) { - case "ArrowDown": - this.onArrowDownKey(event2); - break; - case "ArrowUp": - this.onArrowUpKey(event2); - break; - case "Home": - this.onHomeKey(event2); - break; - case "End": - this.onEndKey(event2); - break; - case "Enter": - case "NumpadEnter": - this.onEnterKey(event2); - break; - case "Space": - this.onSpaceKey(event2); - break; - case "Escape": - if (this.popup) { - focus(this.target); - this.hide(); - } - case "Tab": - this.overlayVisible && this.hide(); - break; - } - }, "onListKeyDown"), - onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey5(event2) { - var optionIndex = this.findNextOptionIndex(this.focusedOptionIndex); - this.changeFocusedOptionIndex(optionIndex); - event2.preventDefault(); - }, "onArrowDownKey"), - onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey5(event2) { - if (event2.altKey && this.popup) { - focus(this.target); - this.hide(); - event2.preventDefault(); - } else { - var optionIndex = this.findPrevOptionIndex(this.focusedOptionIndex); - this.changeFocusedOptionIndex(optionIndex); - event2.preventDefault(); - } - }, "onArrowUpKey"), - onHomeKey: /* @__PURE__ */ __name(function onHomeKey5(event2) { - this.changeFocusedOptionIndex(0); - event2.preventDefault(); - }, "onHomeKey"), - onEndKey: /* @__PURE__ */ __name(function onEndKey5(event2) { - this.changeFocusedOptionIndex(find(this.container, 'li[data-pc-section="item"][data-p-disabled="false"]').length - 1); - event2.preventDefault(); - }, "onEndKey"), - onEnterKey: /* @__PURE__ */ __name(function onEnterKey4(event2) { - var element = findSingle(this.list, 'li[id="'.concat("".concat(this.focusedOptionIndex), '"]')); - var anchorElement = element && findSingle(element, 'a[data-pc-section="itemlink"]'); - this.popup && focus(this.target); - anchorElement ? anchorElement.click() : element && element.click(); - event2.preventDefault(); - }, "onEnterKey"), - onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey4(event2) { - this.onEnterKey(event2); - }, "onSpaceKey"), - findNextOptionIndex: /* @__PURE__ */ __name(function findNextOptionIndex3(index) { - var links = find(this.container, 'li[data-pc-section="item"][data-p-disabled="false"]'); - var matchedOptionIndex = _toConsumableArray$7(links).findIndex(function(link) { - return link.id === index; - }); - return matchedOptionIndex > -1 ? matchedOptionIndex + 1 : 0; - }, "findNextOptionIndex"), - findPrevOptionIndex: /* @__PURE__ */ __name(function findPrevOptionIndex3(index) { - var links = find(this.container, 'li[data-pc-section="item"][data-p-disabled="false"]'); - var matchedOptionIndex = _toConsumableArray$7(links).findIndex(function(link) { - return link.id === index; - }); - return matchedOptionIndex > -1 ? matchedOptionIndex - 1 : 0; - }, "findPrevOptionIndex"), - changeFocusedOptionIndex: /* @__PURE__ */ __name(function changeFocusedOptionIndex3(index) { - var links = find(this.container, 'li[data-pc-section="item"][data-p-disabled="false"]'); - var order = index >= links.length ? links.length - 1 : index < 0 ? 0 : index; - order > -1 && (this.focusedOptionIndex = links[order].getAttribute("id")); - }, "changeFocusedOptionIndex"), - toggle: /* @__PURE__ */ __name(function toggle3(event2) { - if (this.overlayVisible) this.hide(); - else this.show(event2); - }, "toggle"), - show: /* @__PURE__ */ __name(function show3(event2) { - this.overlayVisible = true; - this.target = event2.currentTarget; - }, "show"), - hide: /* @__PURE__ */ __name(function hide3() { - this.overlayVisible = false; - this.target = null; - }, "hide"), - onEnter: /* @__PURE__ */ __name(function onEnter2(el) { - addStyle(el, { - position: "absolute", - top: "0", - left: "0" - }); - this.alignOverlay(); - this.bindOutsideClickListener(); - this.bindResizeListener(); - this.bindScrollListener(); - if (this.autoZIndex) { - ZIndex.set("menu", el, this.baseZIndex + this.$primevue.config.zIndex.menu); - } - if (this.popup) { - focus(this.list); - } - this.$emit("show"); - }, "onEnter"), - onLeave: /* @__PURE__ */ __name(function onLeave2() { - this.unbindOutsideClickListener(); - this.unbindResizeListener(); - this.unbindScrollListener(); - this.$emit("hide"); - }, "onLeave"), - onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave2(el) { - if (this.autoZIndex) { - ZIndex.clear(el); - } - }, "onAfterLeave"), - alignOverlay: /* @__PURE__ */ __name(function alignOverlay3() { - absolutePosition(this.container, this.target); - var targetWidth = getOuterWidth(this.target); - if (targetWidth > getOuterWidth(this.container)) { - this.container.style.minWidth = getOuterWidth(this.target) + "px"; - } - }, "alignOverlay"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener4() { - var _this = this; - if (!this.outsideClickListener) { - this.outsideClickListener = function(event2) { - var isOutsideContainer = _this.container && !_this.container.contains(event2.target); - var isOutsideTarget = !(_this.target && (_this.target === event2.target || _this.target.contains(event2.target))); - if (_this.overlayVisible && isOutsideContainer && isOutsideTarget) { - _this.hide(); - } else if (!_this.popup && isOutsideContainer && isOutsideTarget) { - _this.focusedOptionIndex = -1; - } - }; - document.addEventListener("click", this.outsideClickListener); - } - }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener4() { - if (this.outsideClickListener) { - document.removeEventListener("click", this.outsideClickListener); - this.outsideClickListener = null; - } - }, "unbindOutsideClickListener"), - bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener4() { - var _this2 = this; - if (!this.scrollHandler) { - this.scrollHandler = new ConnectedOverlayScrollHandler(this.target, function() { - if (_this2.overlayVisible) { - _this2.hide(); - } - }); - } - this.scrollHandler.bindScrollListener(); - }, "bindScrollListener"), - unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener4() { - if (this.scrollHandler) { - this.scrollHandler.unbindScrollListener(); - } - }, "unbindScrollListener"), - bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener4() { - var _this3 = this; - if (!this.resizeListener) { - this.resizeListener = function() { - if (_this3.overlayVisible && !isTouchDevice()) { - _this3.hide(); - } - }; - window.addEventListener("resize", this.resizeListener); - } - }, "bindResizeListener"), - unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener4() { - if (this.resizeListener) { - window.removeEventListener("resize", this.resizeListener); - this.resizeListener = null; - } - }, "unbindResizeListener"), - visible: /* @__PURE__ */ __name(function visible3(item8) { - return typeof item8.visible === "function" ? item8.visible() : item8.visible !== false; - }, "visible"), - disabled: /* @__PURE__ */ __name(function disabled4(item8) { - return typeof item8.disabled === "function" ? item8.disabled() : item8.disabled; - }, "disabled"), - label: /* @__PURE__ */ __name(function label5(item8) { - return typeof item8.label === "function" ? item8.label() : item8.label; - }, "label"), - onOverlayClick: /* @__PURE__ */ __name(function onOverlayClick3(event2) { - OverlayEventBus.emit("overlay-click", { - originalEvent: event2, - target: this.target - }); - }, "onOverlayClick"), - containerRef: /* @__PURE__ */ __name(function containerRef3(el) { - this.container = el; - }, "containerRef"), - listRef: /* @__PURE__ */ __name(function listRef(el) { - this.list = el; - }, "listRef") - }, - computed: { - focusedOptionId: /* @__PURE__ */ __name(function focusedOptionId4() { - return this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : null; - }, "focusedOptionId") - }, - components: { - PVMenuitem: script$1$j, - Portal: script$1m - } -}; -var _hoisted_1$h = ["id"]; -var _hoisted_2$c = ["id", "tabindex", "aria-activedescendant", "aria-label", "aria-labelledby"]; -var _hoisted_3$9 = ["id"]; -function render$t(_ctx, _cache, $props, $setup, $data, $options) { - var _component_PVMenuitem = resolveComponent("PVMenuitem"); - var _component_Portal = resolveComponent("Portal"); - return openBlock(), createBlock(_component_Portal, { - appendTo: _ctx.appendTo, - disabled: !_ctx.popup - }, { - "default": withCtx(function() { - return [createVNode(Transition, mergeProps({ - name: "p-connected-overlay", - onEnter: $options.onEnter, - onLeave: $options.onLeave, - onAfterLeave: $options.onAfterLeave - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [(_ctx.popup ? $data.overlayVisible : true) ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: $options.containerRef, - id: $data.id, - "class": _ctx.cx("root"), - onClick: _cache[3] || (_cache[3] = function() { - return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); - }) - }, _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), createBaseVNode("ul", mergeProps({ - ref: $options.listRef, - id: $data.id + "_list", - "class": _ctx.cx("list"), - role: "menu", - tabindex: _ctx.tabindex, - "aria-activedescendant": $data.focused ? $options.focusedOptionId : void 0, - "aria-label": _ctx.ariaLabel, - "aria-labelledby": _ctx.ariaLabelledby, - onFocus: _cache[0] || (_cache[0] = function() { - return $options.onListFocus && $options.onListFocus.apply($options, arguments); - }), - onBlur: _cache[1] || (_cache[1] = function() { - return $options.onListBlur && $options.onListBlur.apply($options, arguments); - }), - onKeydown: _cache[2] || (_cache[2] = function() { - return $options.onListKeyDown && $options.onListKeyDown.apply($options, arguments); - }) - }, _ctx.ptm("list")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model, function(item8, i) { - return openBlock(), createElementBlock(Fragment, { - key: $options.label(item8) + i.toString() - }, [item8.items && $options.visible(item8) && !item8.separator ? (openBlock(), createElementBlock(Fragment, { - key: 0 - }, [item8.items ? (openBlock(), createElementBlock("li", mergeProps({ - key: 0, - id: $data.id + "_" + i, - "class": [_ctx.cx("submenuLabel"), item8["class"]], - role: "none", - ref_for: true - }, _ctx.ptm("submenuLabel")), [renderSlot(_ctx.$slots, _ctx.$slots.submenulabel ? "submenulabel" : "submenuheader", { - item: item8 - }, function() { - return [createTextVNode(toDisplayString($options.label(item8)), 1)]; - })], 16, _hoisted_3$9)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(item8.items, function(child, j) { - return openBlock(), createElementBlock(Fragment, { - key: child.label + i + "_" + j - }, [$options.visible(child) && !child.separator ? (openBlock(), createBlock(_component_PVMenuitem, { - key: 0, - id: $data.id + "_" + i + "_" + j, - item: child, - templates: _ctx.$slots, - focusedOptionId: $options.focusedOptionId, - unstyled: _ctx.unstyled, - onItemClick: $options.itemClick, - onItemMousemove: $options.itemMouseMove, - pt: _ctx.pt - }, null, 8, ["id", "item", "templates", "focusedOptionId", "unstyled", "onItemClick", "onItemMousemove", "pt"])) : $options.visible(child) && child.separator ? (openBlock(), createElementBlock("li", mergeProps({ - key: "separator" + i + j, - "class": [_ctx.cx("separator"), item8["class"]], - style: child.style, - role: "separator", - ref_for: true - }, _ctx.ptm("separator")), null, 16)) : createCommentVNode("", true)], 64); - }), 128))], 64)) : $options.visible(item8) && item8.separator ? (openBlock(), createElementBlock("li", mergeProps({ - key: "separator" + i.toString(), - "class": [_ctx.cx("separator"), item8["class"]], - style: item8.style, - role: "separator", - ref_for: true - }, _ctx.ptm("separator")), null, 16)) : (openBlock(), createBlock(_component_PVMenuitem, { - key: $options.label(item8) + i.toString(), - id: $data.id + "_" + i, - item: item8, - index: i, - templates: _ctx.$slots, - focusedOptionId: $options.focusedOptionId, - unstyled: _ctx.unstyled, - onItemClick: $options.itemClick, - onItemMousemove: $options.itemMouseMove, - pt: _ctx.pt - }, null, 8, ["id", "item", "index", "templates", "focusedOptionId", "unstyled", "onItemClick", "onItemMousemove", "pt"]))], 64); - }), 128))], 16, _hoisted_2$c), _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$h)) : createCommentVNode("", true)]; - }), - _: 3 - }, 16, ["onEnter", "onLeave", "onAfterLeave"])]; - }), - _: 3 - }, 8, ["appendTo", "disabled"]); -} -__name(render$t, "render$t"); -script$x.render = render$t; -var theme$h = /* @__PURE__ */ __name(function theme22(_ref) { - var dt = _ref.dt; - return "\n.p-metergroup {\n display: flex;\n gap: ".concat(dt("metergroup.gap"), ";\n}\n\n.p-metergroup-meters {\n display: flex;\n background: ").concat(dt("metergroup.meters.background"), ";\n border-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n\n.p-metergroup-label-list {\n display: flex;\n flex-wrap: wrap;\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n\n.p-metergroup-label {\n display: inline-flex;\n align-items: center;\n gap: ").concat(dt("metergroup.label.gap"), ";\n}\n\n.p-metergroup-label-marker {\n display: inline-flex;\n width: ").concat(dt("metergroup.label.marker.size"), ";\n height: ").concat(dt("metergroup.label.marker.size"), ";\n border-radius: 100%;\n}\n\n.p-metergroup-label-icon {\n font-size: ").concat(dt("metergroup.label.icon.size"), ";\n width: ").concat(dt("metergroup.label.icon.size"), ";\n height: ").concat(dt("metergroup.label.icon.size"), ";\n}\n\n.p-metergroup-horizontal {\n flex-direction: column;\n}\n\n.p-metergroup-label-list-horizontal {\n gap: ").concat(dt("metergroup.label.list.horizontal.gap"), ";\n}\n\n.p-metergroup-horizontal .p-metergroup-meters {\n height: ").concat(dt("metergroup.meters.size"), ";\n}\n\n.p-metergroup-horizontal .p-metergroup-meter:first-of-type {\n border-start-start-radius: ").concat(dt("metergroup.border.radius"), ";\n border-end-start-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n\n.p-metergroup-horizontal .p-metergroup-meter:last-of-type {\n border-start-end-radius: ").concat(dt("metergroup.border.radius"), ";\n border-end-end-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n\n.p-metergroup-vertical {\n flex-direction: row;\n}\n\n.p-metergroup-label-list-vertical {\n flex-direction: column;\n gap: ").concat(dt("metergroup.label.list.vertical.gap"), ";\n}\n\n.p-metergroup-vertical .p-metergroup-meters {\n flex-direction: column;\n width: ").concat(dt("metergroup.meters.size"), ";\n height: 100%;\n}\n\n.p-metergroup-vertical .p-metergroup-label-list {\n align-items: flex-start;\n}\n\n.p-metergroup-vertical .p-metergroup-meter:first-of-type {\n border-start-start-radius: ").concat(dt("metergroup.border.radius"), ";\n border-start-end-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n\n.p-metergroup-vertical .p-metergroup-meter:last-of-type {\n border-end-start-radius: ").concat(dt("metergroup.border.radius"), ";\n border-end-end-radius: ").concat(dt("metergroup.border.radius"), ";\n}\n"); -}, "theme"); -var classes$i = { - root: /* @__PURE__ */ __name(function root18(_ref2) { - var props = _ref2.props; - return ["p-metergroup p-component", { - "p-metergroup-horizontal": props.orientation === "horizontal", - "p-metergroup-vertical": props.orientation === "vertical" - }]; - }, "root"), - meters: "p-metergroup-meters", - meter: "p-metergroup-meter", - labelList: /* @__PURE__ */ __name(function labelList(_ref3) { - var props = _ref3.props; - return ["p-metergroup-label-list", { - "p-metergroup-label-list-vertical": props.labelOrientation === "vertical", - "p-metergroup-label-list-horizontal": props.labelOrientation === "horizontal" - }]; - }, "labelList"), - label: "p-metergroup-label", - labelIcon: "p-metergroup-label-icon", - labelMarker: "p-metergroup-label-marker", - labelText: "p-metergroup-label-text" -}; -var MeterGroupStyle = BaseStyle.extend({ - name: "metergroup", - theme: theme$h, - classes: classes$i -}); -var script$2$3 = { - name: "MeterGroup", - "extends": script$1f, - props: { - value: { - type: Array, - "default": null - }, - min: { - type: Number, - "default": 0 - }, - max: { - type: Number, - "default": 100 - }, - orientation: { - type: String, - "default": "horizontal" - }, - labelPosition: { - type: String, - "default": "end" - }, - labelOrientation: { - type: String, - "default": "horizontal" - } - }, - style: MeterGroupStyle, - provide: /* @__PURE__ */ __name(function provide32() { - return { - $pcMeterGroup: this, - $parentInstance: this - }; - }, "provide") -}; -var script$1$i = { - name: "MeterGroupLabel", - hostName: "MeterGroup", - "extends": script$1f, - inheritAttrs: false, - props: { - value: { - type: Array, - "default": null - }, - labelPosition: { - type: String, - "default": "end" - }, - labelOrientation: { - type: String, - "default": "horizontal" - } - } -}; -function render$1$3(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("ol", mergeProps({ - "class": _ctx.cx("labelList") - }, _ctx.ptm("labelList")), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.value, function(val, index) { - return openBlock(), createElementBlock("li", mergeProps({ - key: index + "_label", - "class": _ctx.cx("label"), - ref_for: true - }, _ctx.ptm("label")), [renderSlot(_ctx.$slots, "icon", { - value: val, - "class": normalizeClass(_ctx.cx("labelIcon")) - }, function() { - return [val.icon ? (openBlock(), createElementBlock("i", mergeProps({ - key: 0, - "class": [val.icon, _ctx.cx("labelIcon")], - style: { - color: val.color - }, - ref_for: true - }, _ctx.ptm("labelIcon")), null, 16)) : (openBlock(), createElementBlock("span", mergeProps({ - key: 1, - "class": _ctx.cx("labelMarker"), - style: { - backgroundColor: val.color - }, - ref_for: true - }, _ctx.ptm("labelMarker")), null, 16))]; - }), createBaseVNode("span", mergeProps({ - "class": _ctx.cx("labelText"), - ref_for: true - }, _ctx.ptm("labelText")), toDisplayString(val.label) + " (" + toDisplayString(_ctx.$parentInstance.percentValue(val.value)) + ")", 17)], 16); - }), 128))], 16); -} -__name(render$1$3, "render$1$3"); -script$1$i.render = render$1$3; -var script$w = { - name: "MeterGroup", - "extends": script$2$3, - inheritAttrs: false, - methods: { - getPTOptions: /* @__PURE__ */ __name(function getPTOptions5(key, value2, index) { - return this.ptm(key, { - context: { - value: value2, - index - } - }); - }, "getPTOptions"), - percent: /* @__PURE__ */ __name(function percent() { - var meter = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0; - var percentOfItem = (meter - this.min) / (this.max - this.min) * 100; - return Math.round(Math.max(0, Math.min(100, percentOfItem))); - }, "percent"), - percentValue: /* @__PURE__ */ __name(function percentValue(meter) { - return this.percent(meter) + "%"; - }, "percentValue"), - meterCalculatedStyles: /* @__PURE__ */ __name(function meterCalculatedStyles(val) { - return { - backgroundColor: val.color, - width: this.orientation === "horizontal" && this.percentValue(val.value), - height: this.orientation === "vertical" && this.percentValue(val.value) - }; - }, "meterCalculatedStyles") - }, - computed: { - totalPercent: /* @__PURE__ */ __name(function totalPercent() { - return this.percent(this.value.reduce(function(total, val) { - return total + val.value; - }, 0)); - }, "totalPercent"), - percentages: /* @__PURE__ */ __name(function percentages() { - var sum = 0; - var sumsArray = []; - this.value.forEach(function(item8) { - sum += item8.value; - sumsArray.push(sum); - }); - return sumsArray; - }, "percentages") - }, - components: { - MeterGroupLabel: script$1$i - } -}; -var _hoisted_1$g = ["aria-valuemin", "aria-valuemax", "aria-valuenow"]; -function render$s(_ctx, _cache, $props, $setup, $data, $options) { - var _component_MeterGroupLabel = resolveComponent("MeterGroupLabel"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root"), - role: "meter", - "aria-valuemin": _ctx.min, - "aria-valuemax": _ctx.max, - "aria-valuenow": $options.totalPercent - }, _ctx.ptmi("root")), [_ctx.labelPosition === "start" ? renderSlot(_ctx.$slots, "label", { - key: 0, - value: _ctx.value, - totalPercent: $options.totalPercent, - percentages: $options.percentages - }, function() { - return [createVNode(_component_MeterGroupLabel, { - value: _ctx.value, - labelPosition: _ctx.labelPosition, - labelOrientation: _ctx.labelOrientation, - unstyled: _ctx.unstyled, - pt: _ctx.pt - }, null, 8, ["value", "labelPosition", "labelOrientation", "unstyled", "pt"])]; - }) : createCommentVNode("", true), renderSlot(_ctx.$slots, "start", { - value: _ctx.value, - totalPercent: $options.totalPercent, - percentages: $options.percentages - }), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("meters") - }, _ctx.ptm("meters")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.value, function(val, index) { - return renderSlot(_ctx.$slots, "meter", { - key: index, - value: val, - index, - "class": normalizeClass(_ctx.cx("meter")), - orientation: _ctx.orientation, - size: $options.percentValue(val.value), - totalPercent: $options.totalPercent - }, function() { - return [$options.percent(val.value) ? (openBlock(), createElementBlock("span", mergeProps({ - key: 0, - "class": _ctx.cx("meter"), - style: $options.meterCalculatedStyles(val), - ref_for: true - }, $options.getPTOptions("meter", val, index)), null, 16)) : createCommentVNode("", true)]; - }); - }), 128))], 16), renderSlot(_ctx.$slots, "end", { - value: _ctx.value, - totalPercent: $options.totalPercent, - percentages: $options.percentages - }), _ctx.labelPosition === "end" ? renderSlot(_ctx.$slots, "label", { - key: 1, - value: _ctx.value, - totalPercent: $options.totalPercent, - percentages: $options.percentages - }, function() { - return [createVNode(_component_MeterGroupLabel, { - value: _ctx.value, - labelPosition: _ctx.labelPosition, - labelOrientation: _ctx.labelOrientation, - unstyled: _ctx.unstyled, - pt: _ctx.pt - }, null, 8, ["value", "labelPosition", "labelOrientation", "unstyled", "pt"])]; - }) : createCommentVNode("", true)], 16, _hoisted_1$g); -} -__name(render$s, "render$s"); -script$w.render = render$s; -var theme$g = /* @__PURE__ */ __name(function theme23(_ref) { - var dt = _ref.dt; - return "\n.p-multiselect {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n background: ".concat(dt("multiselect.background"), ";\n border: 1px solid ").concat(dt("multiselect.border.color"), ";\n transition: background ").concat(dt("multiselect.transition.duration"), ", color ").concat(dt("multiselect.transition.duration"), ", border-color ").concat(dt("multiselect.transition.duration"), ", outline-color ").concat(dt("multiselect.transition.duration"), ", box-shadow ").concat(dt("multiselect.transition.duration"), ";\n border-radius: ").concat(dt("multiselect.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("multiselect.shadow"), ";\n}\n\n.p-multiselect:not(.p-disabled):hover {\n border-color: ").concat(dt("multiselect.hover.border.color"), ";\n}\n\n.p-multiselect:not(.p-disabled).p-focus {\n border-color: ").concat(dt("multiselect.focus.border.color"), ";\n box-shadow: ").concat(dt("multiselect.focus.ring.shadow"), ";\n outline: ").concat(dt("multiselect.focus.ring.width"), " ").concat(dt("multiselect.focus.ring.style"), " ").concat(dt("multiselect.focus.ring.color"), ";\n outline-offset: ").concat(dt("multiselect.focus.ring.offset"), ";\n}\n\n.p-multiselect.p-variant-filled {\n background: ").concat(dt("multiselect.filled.background"), ";\n}\n\n.p-multiselect.p-variant-filled:not(.p-disabled):hover {\n background: ").concat(dt("multiselect.filled.hover.background"), ";\n}\n\n.p-multiselect.p-variant-filled.p-focus {\n background: ").concat(dt("multiselect.filled.focus.background"), ";\n}\n\n.p-multiselect.p-invalid {\n border-color: ").concat(dt("multiselect.invalid.border.color"), ";\n}\n\n.p-multiselect.p-disabled {\n opacity: 1;\n background: ").concat(dt("multiselect.disabled.background"), ";\n}\n\n.p-multiselect-dropdown {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n background: transparent;\n color: ").concat(dt("multiselect.dropdown.color"), ";\n width: ").concat(dt("multiselect.dropdown.width"), ";\n border-start-end-radius: ").concat(dt("multiselect.border.radius"), ";\n border-end-end-radius: ").concat(dt("multiselect.border.radius"), ";\n}\n\n.p-multiselect-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n color: ").concat(dt("multiselect.clear.icon.color"), ";\n inset-inline-end: ").concat(dt("multiselect.dropdown.width"), ";\n}\n\n.p-multiselect-label-container {\n overflow: hidden;\n flex: 1 1 auto;\n cursor: pointer;\n}\n\n.p-multiselect-label {\n display: flex;\n align-items: center;\n gap: calc(").concat(dt("multiselect.padding.y"), " / 2);\n white-space: nowrap;\n cursor: pointer;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: ").concat(dt("multiselect.padding.y"), " ").concat(dt("multiselect.padding.x"), ";\n color: ").concat(dt("multiselect.color"), ";\n}\n\n.p-multiselect-label.p-placeholder {\n color: ").concat(dt("multiselect.placeholder.color"), ";\n}\n\n.p-multiselect.p-invalid .p-multiselect-label.p-placeholder {\n color: ").concat(dt("multiselect.invalid.placeholder.color"), ";\n}\n\n.p-multiselect.p-disabled .p-multiselect-label {\n color: ").concat(dt("multiselect.disabled.color"), ";\n}\n\n.p-multiselect-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\n\n.p-multiselect .p-multiselect-overlay {\n min-width: 100%;\n}\n\n.p-multiselect-overlay {\n position: absolute;\n top: 0;\n left: 0;\n background: ").concat(dt("multiselect.overlay.background"), ";\n color: ").concat(dt("multiselect.overlay.color"), ";\n border: 1px solid ").concat(dt("multiselect.overlay.border.color"), ";\n border-radius: ").concat(dt("multiselect.overlay.border.radius"), ";\n box-shadow: ").concat(dt("multiselect.overlay.shadow"), ";\n}\n\n.p-multiselect-header {\n display: flex;\n align-items: center;\n padding: ").concat(dt("multiselect.list.header.padding"), ";\n}\n\n.p-multiselect-header .p-checkbox {\n margin-inline-end: ").concat(dt("multiselect.option.gap"), ";\n}\n\n.p-multiselect-filter-container {\n flex: 1 1 auto;\n}\n\n.p-multiselect-filter {\n width: 100%;\n}\n\n.p-multiselect-list-container {\n overflow: auto;\n}\n\n.p-multiselect-list {\n margin: 0;\n padding: 0;\n list-style-type: none;\n padding: ").concat(dt("multiselect.list.padding"), ";\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("multiselect.list.gap"), ";\n}\n\n.p-multiselect-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 gap: ").concat(dt("multiselect.option.gap"), ";\n padding: ").concat(dt("multiselect.option.padding"), ";\n border: 0 none;\n color: ").concat(dt("multiselect.option.color"), ";\n background: transparent;\n transition: background ").concat(dt("multiselect.transition.duration"), ", color ").concat(dt("multiselect.transition.duration"), ", border-color ").concat(dt("multiselect.transition.duration"), ", box-shadow ").concat(dt("multiselect.transition.duration"), ", outline-color ").concat(dt("multiselect.transition.duration"), ";\n border-radius: ").concat(dt("multiselect.option.border.radius"), ";\n}\n\n.p-multiselect-option:not(.p-multiselect-option-selected):not(.p-disabled).p-focus {\n background: ").concat(dt("multiselect.option.focus.background"), ";\n color: ").concat(dt("multiselect.option.focus.color"), ";\n}\n\n.p-multiselect-option.p-multiselect-option-selected {\n background: ").concat(dt("multiselect.option.selected.background"), ";\n color: ").concat(dt("multiselect.option.selected.color"), ";\n}\n\n.p-multiselect-option.p-multiselect-option-selected.p-focus {\n background: ").concat(dt("multiselect.option.selected.focus.background"), ";\n color: ").concat(dt("multiselect.option.selected.focus.color"), ";\n}\n\n.p-multiselect-option-group {\n cursor: auto;\n margin: 0;\n padding: ").concat(dt("multiselect.option.group.padding"), ";\n background: ").concat(dt("multiselect.option.group.background"), ";\n color: ").concat(dt("multiselect.option.group.color"), ";\n font-weight: ").concat(dt("multiselect.option.group.font.weight"), ";\n}\n\n.p-multiselect-empty-message {\n padding: ").concat(dt("multiselect.empty.message.padding"), ";\n}\n\n.p-multiselect-label .p-chip {\n padding-block-start: calc(").concat(dt("multiselect.padding.y"), " / 2);\n padding-block-end: calc(").concat(dt("multiselect.padding.y"), " / 2);\n border-radius: ").concat(dt("multiselect.chip.border.radius"), ";\n}\n\n.p-multiselect-label:has(.p-chip) {\n padding: calc(").concat(dt("multiselect.padding.y"), " / 2) calc(").concat(dt("multiselect.padding.x"), " / 2);\n}\n\n.p-multiselect-fluid {\n display: flex;\n width: 100%;\n}\n\n.p-multiselect-sm .p-multiselect-label {\n font-size: ").concat(dt("multiselect.sm.font.size"), ";\n padding-block: ").concat(dt("multiselect.sm.padding.y"), ";\n padding-inline: ").concat(dt("multiselect.sm.padding.x"), ";\n}\n\n.p-multiselect-sm .p-multiselect-dropdown .p-icon {\n font-size: ").concat(dt("multiselect.sm.font.size"), ";\n width: ").concat(dt("multiselect.sm.font.size"), ";\n height: ").concat(dt("multiselect.sm.font.size"), ";\n}\n\n.p-multiselect-lg .p-multiselect-label {\n font-size: ").concat(dt("multiselect.lg.font.size"), ";\n padding-block: ").concat(dt("multiselect.lg.padding.y"), ";\n padding-inline: ").concat(dt("multiselect.lg.padding.x"), ";\n}\n\n.p-multiselect-lg .p-multiselect-dropdown .p-icon {\n font-size: ").concat(dt("multiselect.lg.font.size"), ";\n width: ").concat(dt("multiselect.lg.font.size"), ";\n height: ").concat(dt("multiselect.lg.font.size"), ";\n}\n"); -}, "theme"); -var inlineStyles$5 = { - root: /* @__PURE__ */ __name(function root19(_ref2) { - var props = _ref2.props; - return { - position: props.appendTo === "self" ? "relative" : void 0 - }; - }, "root") -}; -var classes$h = { - root: /* @__PURE__ */ __name(function root20(_ref3) { - var instance = _ref3.instance, props = _ref3.props; - return ["p-multiselect p-component p-inputwrapper", { - "p-multiselect-display-chip": props.display === "chip", - "p-disabled": props.disabled, - "p-invalid": instance.$invalid, - "p-variant-filled": instance.$variant === "filled", - "p-focus": instance.focused, - "p-inputwrapper-filled": instance.$filled, - "p-inputwrapper-focus": instance.focused || instance.overlayVisible, - "p-multiselect-open": instance.overlayVisible, - "p-multiselect-fluid": instance.$fluid, - "p-multiselect-sm p-inputfield-sm": props.size === "small", - "p-multiselect-lg p-inputfield-lg": props.size === "large" - }]; - }, "root"), - labelContainer: "p-multiselect-label-container", - label: /* @__PURE__ */ __name(function label6(_ref4) { - var instance = _ref4.instance, props = _ref4.props; - return ["p-multiselect-label", { - "p-placeholder": instance.label === props.placeholder, - "p-multiselect-label-empty": !props.placeholder && (!props.modelValue || props.modelValue.length === 0) - }]; - }, "label"), - clearIcon: "p-multiselect-clear-icon", - chipItem: "p-multiselect-chip-item", - pcChip: "p-multiselect-chip", - chipIcon: "p-multiselect-chip-icon", - dropdown: "p-multiselect-dropdown", - loadingIcon: "p-multiselect-loading-icon", - dropdownIcon: "p-multiselect-dropdown-icon", - overlay: "p-multiselect-overlay p-component", - header: "p-multiselect-header", - pcFilterContainer: "p-multiselect-filter-container", - pcFilter: "p-multiselect-filter", - listContainer: "p-multiselect-list-container", - list: "p-multiselect-list", - optionGroup: "p-multiselect-option-group", - option: /* @__PURE__ */ __name(function option2(_ref5) { - var instance = _ref5.instance, _option = _ref5.option, index = _ref5.index, getItemOptions = _ref5.getItemOptions, props = _ref5.props; - return ["p-multiselect-option", { - "p-multiselect-option-selected": instance.isSelected(_option) && props.highlightOnSelect, - "p-focus": instance.focusedOptionIndex === instance.getOptionIndex(index, getItemOptions), - "p-disabled": instance.isOptionDisabled(_option) - }]; - }, "option"), - emptyMessage: "p-multiselect-empty-message" -}; -var MultiSelectStyle = BaseStyle.extend({ - name: "multiselect", - theme: theme$g, - classes: classes$h, - inlineStyles: inlineStyles$5 -}); -var script$1$h = { - name: "BaseMultiSelect", - "extends": script$1k, - props: { - options: Array, - optionLabel: null, - optionValue: null, - optionDisabled: null, - optionGroupLabel: null, - optionGroupChildren: null, - scrollHeight: { - type: String, - "default": "14rem" - }, - placeholder: String, - inputId: { - type: String, - "default": null - }, - panelClass: { - type: String, - "default": null - }, - panelStyle: { - type: null, - "default": null - }, - overlayClass: { - type: String, - "default": null - }, - overlayStyle: { - type: null, - "default": null - }, - dataKey: null, - showClear: { - type: Boolean, - "default": false - }, - clearIcon: { - type: String, - "default": void 0 - }, - resetFilterOnClear: { - type: Boolean, - "default": false - }, - filter: Boolean, - filterPlaceholder: String, - filterLocale: String, - filterMatchMode: { - type: String, - "default": "contains" - }, - filterFields: { - type: Array, - "default": null - }, - appendTo: { - type: [String, Object], - "default": "body" - }, - display: { - type: String, - "default": "comma" - }, - selectedItemsLabel: { - type: String, - "default": null - }, - maxSelectedLabels: { - type: Number, - "default": null - }, - selectionLimit: { - type: Number, - "default": null - }, - showToggleAll: { - type: Boolean, - "default": true - }, - loading: { - type: Boolean, - "default": false - }, - checkboxIcon: { - type: String, - "default": void 0 - }, - dropdownIcon: { - type: String, - "default": void 0 - }, - filterIcon: { - type: String, - "default": void 0 - }, - loadingIcon: { - type: String, - "default": void 0 - }, - removeTokenIcon: { - type: String, - "default": void 0 - }, - chipIcon: { - type: String, - "default": void 0 - }, - selectAll: { - type: Boolean, - "default": null - }, - resetFilterOnHide: { - type: Boolean, - "default": false - }, - virtualScrollerOptions: { - type: Object, - "default": null - }, - autoOptionFocus: { - type: Boolean, - "default": false - }, - autoFilterFocus: { - type: Boolean, - "default": false - }, - focusOnHover: { - type: Boolean, - "default": true - }, - highlightOnSelect: { - type: Boolean, - "default": false - }, - filterMessage: { - type: String, - "default": null - }, - selectionMessage: { - type: String, - "default": null - }, - emptySelectionMessage: { - type: String, - "default": null - }, - emptyFilterMessage: { - type: String, - "default": null - }, - emptyMessage: { - type: String, - "default": null - }, - tabindex: { - type: Number, - "default": 0 - }, - ariaLabel: { - type: String, - "default": null - }, - ariaLabelledby: { - type: String, - "default": null - } - }, - style: MultiSelectStyle, - provide: /* @__PURE__ */ __name(function provide33() { - return { - $pcMultiSelect: this, - $parentInstance: this - }; - }, "provide") -}; -function _typeof$1$2(o) { - "@babel/helpers - typeof"; - return _typeof$1$2 = "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$1$2(o); -} -__name(_typeof$1$2, "_typeof$1$2"); -function ownKeys$d(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$d, "ownKeys$d"); -function _objectSpread$d(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$d(Object(t2), true).forEach(function(r2) { - _defineProperty$1$2(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$d(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$d, "_objectSpread$d"); -function _defineProperty$1$2(e, r, t2) { - return (r = _toPropertyKey$1$2(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$1$2, "_defineProperty$1$2"); -function _toPropertyKey$1$2(t2) { - var i = _toPrimitive$1$2(t2, "string"); - return "symbol" == _typeof$1$2(i) ? i : i + ""; -} -__name(_toPropertyKey$1$2, "_toPropertyKey$1$2"); -function _toPrimitive$1$2(t2, r) { - if ("object" != _typeof$1$2(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$1$2(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$1$2, "_toPrimitive$1$2"); -function _toConsumableArray$6(r) { - return _arrayWithoutHoles$6(r) || _iterableToArray$6(r) || _unsupportedIterableToArray$7(r) || _nonIterableSpread$6(); -} -__name(_toConsumableArray$6, "_toConsumableArray$6"); -function _nonIterableSpread$6() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableSpread$6, "_nonIterableSpread$6"); -function _unsupportedIterableToArray$7(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$7(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$7(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$7, "_unsupportedIterableToArray$7"); -function _iterableToArray$6(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$6, "_iterableToArray$6"); -function _arrayWithoutHoles$6(r) { - if (Array.isArray(r)) return _arrayLikeToArray$7(r); -} -__name(_arrayWithoutHoles$6, "_arrayWithoutHoles$6"); -function _arrayLikeToArray$7(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; -} -__name(_arrayLikeToArray$7, "_arrayLikeToArray$7"); -var script$v = { - name: "MultiSelect", - "extends": script$1$h, - inheritAttrs: false, - emits: ["change", "focus", "blur", "before-show", "before-hide", "show", "hide", "filter", "selectall-change"], - inject: { - $pcFluid: { - "default": null - } - }, - outsideClickListener: null, - scrollHandler: null, - resizeListener: null, - overlay: null, - list: null, - virtualScroller: null, - startRangeIndex: -1, - searchTimeout: null, - searchValue: "", - selectOnFocus: false, - data: /* @__PURE__ */ __name(function data21() { - return { - id: this.$attrs.id, - clicked: false, - focused: false, - focusedOptionIndex: -1, - filterValue: null, - overlayVisible: false - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId7(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId"), - options: /* @__PURE__ */ __name(function options2() { - this.autoUpdateModel(); - }, "options") - }, - mounted: /* @__PURE__ */ __name(function mounted23() { - this.id = this.id || UniqueComponentId(); - this.autoUpdateModel(); - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount9() { - this.unbindOutsideClickListener(); - this.unbindResizeListener(); - if (this.scrollHandler) { - this.scrollHandler.destroy(); - this.scrollHandler = null; - } - if (this.overlay) { - ZIndex.clear(this.overlay); - this.overlay = null; - } - }, "beforeUnmount"), - methods: { - getOptionIndex: /* @__PURE__ */ __name(function getOptionIndex(index, fn) { - return this.virtualScrollerDisabled ? index : fn && fn(index)["index"]; - }, "getOptionIndex"), - getOptionLabel: /* @__PURE__ */ __name(function getOptionLabel3(option4) { - return this.optionLabel ? resolveFieldData(option4, this.optionLabel) : option4; - }, "getOptionLabel"), - getOptionValue: /* @__PURE__ */ __name(function getOptionValue3(option4) { - return this.optionValue ? resolveFieldData(option4, this.optionValue) : option4; - }, "getOptionValue"), - getOptionRenderKey: /* @__PURE__ */ __name(function getOptionRenderKey(option4, index) { - return this.dataKey ? resolveFieldData(option4, this.dataKey) : this.getOptionLabel(option4) + "_".concat(index); - }, "getOptionRenderKey"), - getHeaderCheckboxPTOptions: /* @__PURE__ */ __name(function getHeaderCheckboxPTOptions(key) { - return this.ptm(key, { - context: { - selected: this.allSelected - } - }); - }, "getHeaderCheckboxPTOptions"), - getCheckboxPTOptions: /* @__PURE__ */ __name(function getCheckboxPTOptions(option4, itemOptions, index, key) { - return this.ptm(key, { - context: { - selected: this.isSelected(option4), - focused: this.focusedOptionIndex === this.getOptionIndex(index, itemOptions), - disabled: this.isOptionDisabled(option4) - } - }); - }, "getCheckboxPTOptions"), - isOptionDisabled: /* @__PURE__ */ __name(function isOptionDisabled3(option4) { - if (this.maxSelectionLimitReached && !this.isSelected(option4)) { - return true; - } - return this.optionDisabled ? resolveFieldData(option4, this.optionDisabled) : false; - }, "isOptionDisabled"), - isOptionGroup: /* @__PURE__ */ __name(function isOptionGroup3(option4) { - return this.optionGroupLabel && option4.optionGroup && option4.group; - }, "isOptionGroup"), - getOptionGroupLabel: /* @__PURE__ */ __name(function getOptionGroupLabel3(optionGroup) { - return resolveFieldData(optionGroup, this.optionGroupLabel); - }, "getOptionGroupLabel"), - getOptionGroupChildren: /* @__PURE__ */ __name(function getOptionGroupChildren3(optionGroup) { - return resolveFieldData(optionGroup, this.optionGroupChildren); - }, "getOptionGroupChildren"), - getAriaPosInset: /* @__PURE__ */ __name(function getAriaPosInset2(index) { - var _this = this; - return (this.optionGroupLabel ? index - this.visibleOptions.slice(0, index).filter(function(option4) { - return _this.isOptionGroup(option4); - }).length : index) + 1; - }, "getAriaPosInset"), - show: /* @__PURE__ */ __name(function show4(isFocus) { - this.$emit("before-show"); - this.overlayVisible = true; - this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : this.findSelectedOptionIndex(); - isFocus && focus(this.$refs.focusInput); - }, "show"), - hide: /* @__PURE__ */ __name(function hide4(isFocus) { - var _this2 = this; - var _hide = /* @__PURE__ */ __name(function _hide2() { - _this2.$emit("before-hide"); - _this2.overlayVisible = false; - _this2.clicked = false; - _this2.focusedOptionIndex = -1; - _this2.searchValue = ""; - _this2.resetFilterOnHide && (_this2.filterValue = null); - isFocus && focus(_this2.$refs.focusInput); - }, "_hide"); - setTimeout(function() { - _hide(); - }, 0); - }, "hide"), - onFocus: /* @__PURE__ */ __name(function onFocus9(event2) { - if (this.disabled) { - return; - } - this.focused = true; - if (this.overlayVisible) { - this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : this.findSelectedOptionIndex(); - this.scrollInView(this.focusedOptionIndex); - } - this.$emit("focus", event2); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur9(event2) { - var _this$formField$onBlu, _this$formField; - this.clicked = false; - this.focused = false; - this.focusedOptionIndex = -1; - this.searchValue = ""; - this.$emit("blur", event2); - (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField); - }, "onBlur"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown9(event2) { - var _this3 = this; - if (this.disabled) { - event2.preventDefault(); - return; - } - var metaKey = event2.metaKey || event2.ctrlKey; - switch (event2.code) { - case "ArrowDown": - this.onArrowDownKey(event2); - break; - case "ArrowUp": - this.onArrowUpKey(event2); - break; - case "Home": - this.onHomeKey(event2); - break; - case "End": - this.onEndKey(event2); - break; - case "PageDown": - this.onPageDownKey(event2); - break; - case "PageUp": - this.onPageUpKey(event2); - break; - case "Enter": - case "NumpadEnter": - case "Space": - this.onEnterKey(event2); - break; - case "Escape": - this.onEscapeKey(event2); - break; - case "Tab": - this.onTabKey(event2); - break; - case "ShiftLeft": - case "ShiftRight": - this.onShiftKey(event2); - break; - default: - if (event2.code === "KeyA" && metaKey) { - var value2 = this.visibleOptions.filter(function(option4) { - return _this3.isValidOption(option4); - }).map(function(option4) { - return _this3.getOptionValue(option4); - }); - this.updateModel(event2, value2); - event2.preventDefault(); - break; - } - if (!metaKey && isPrintableCharacter(event2.key)) { - !this.overlayVisible && this.show(); - this.searchOptions(event2); - event2.preventDefault(); - } - break; - } - this.clicked = false; - }, "onKeyDown"), - onContainerClick: /* @__PURE__ */ __name(function onContainerClick2(event2) { - if (this.disabled || this.loading) { - return; - } - if (event2.target.tagName === "INPUT" || event2.target.getAttribute("data-pc-section") === "clearicon" || event2.target.closest('[data-pc-section="clearicon"]')) { - return; - } else if (!this.overlay || !this.overlay.contains(event2.target)) { - this.overlayVisible ? this.hide(true) : this.show(true); - } - this.clicked = true; - }, "onContainerClick"), - onClearClick: /* @__PURE__ */ __name(function onClearClick2(event2) { - this.updateModel(event2, null); - this.resetFilterOnClear && (this.filterValue = null); - }, "onClearClick"), - onFirstHiddenFocus: /* @__PURE__ */ __name(function onFirstHiddenFocus(event2) { - var focusableEl = event2.relatedTarget === this.$refs.focusInput ? getFirstFocusableElement(this.overlay, ':not([data-p-hidden-focusable="true"])') : this.$refs.focusInput; - focus(focusableEl); - }, "onFirstHiddenFocus"), - onLastHiddenFocus: /* @__PURE__ */ __name(function onLastHiddenFocus(event2) { - var focusableEl = event2.relatedTarget === this.$refs.focusInput ? getLastFocusableElement(this.overlay, ':not([data-p-hidden-focusable="true"])') : this.$refs.focusInput; - focus(focusableEl); - }, "onLastHiddenFocus"), - onOptionSelect: /* @__PURE__ */ __name(function onOptionSelect2(event2, option4) { - var _this4 = this; - var index = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1; - var isFocus = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false; - if (this.disabled || this.isOptionDisabled(option4)) { - return; - } - var selected3 = this.isSelected(option4); - var value2 = null; - if (selected3) value2 = this.d_value.filter(function(val) { - return !equals(val, _this4.getOptionValue(option4), _this4.equalityKey); - }); - else value2 = [].concat(_toConsumableArray$6(this.d_value || []), [this.getOptionValue(option4)]); - this.updateModel(event2, value2); - index !== -1 && (this.focusedOptionIndex = index); - isFocus && focus(this.$refs.focusInput); - }, "onOptionSelect"), - onOptionMouseMove: /* @__PURE__ */ __name(function onOptionMouseMove3(event2, index) { - if (this.focusOnHover) { - this.changeFocusedOptionIndex(event2, index); - } - }, "onOptionMouseMove"), - onOptionSelectRange: /* @__PURE__ */ __name(function onOptionSelectRange(event2) { - var _this5 = this; - var start = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -1; - var end = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1; - start === -1 && (start = this.findNearestSelectedOptionIndex(end, true)); - end === -1 && (end = this.findNearestSelectedOptionIndex(start)); - if (start !== -1 && end !== -1) { - var rangeStart = Math.min(start, end); - var rangeEnd = Math.max(start, end); - var value2 = this.visibleOptions.slice(rangeStart, rangeEnd + 1).filter(function(option4) { - return _this5.isValidOption(option4); - }).map(function(option4) { - return _this5.getOptionValue(option4); - }); - this.updateModel(event2, value2); - } - }, "onOptionSelectRange"), - onFilterChange: /* @__PURE__ */ __name(function onFilterChange(event2) { - var value2 = event2.target.value; - this.filterValue = value2; - this.focusedOptionIndex = -1; - this.$emit("filter", { - originalEvent: event2, - value: value2 - }); - !this.virtualScrollerDisabled && this.virtualScroller.scrollToIndex(0); - }, "onFilterChange"), - onFilterKeyDown: /* @__PURE__ */ __name(function onFilterKeyDown(event2) { - switch (event2.code) { - case "ArrowDown": - this.onArrowDownKey(event2); - break; - case "ArrowUp": - this.onArrowUpKey(event2, true); - break; - case "ArrowLeft": - case "ArrowRight": - this.onArrowLeftKey(event2, true); - break; - case "Home": - this.onHomeKey(event2, true); - break; - case "End": - this.onEndKey(event2, true); - break; - case "Enter": - case "NumpadEnter": - this.onEnterKey(event2); - break; - case "Escape": - this.onEscapeKey(event2); - break; - case "Tab": - this.onTabKey(event2, true); - break; - } - }, "onFilterKeyDown"), - onFilterBlur: /* @__PURE__ */ __name(function onFilterBlur() { - this.focusedOptionIndex = -1; - }, "onFilterBlur"), - onFilterUpdated: /* @__PURE__ */ __name(function onFilterUpdated() { - if (this.overlayVisible) { - this.alignOverlay(); - } - }, "onFilterUpdated"), - onOverlayClick: /* @__PURE__ */ __name(function onOverlayClick4(event2) { - OverlayEventBus.emit("overlay-click", { - originalEvent: event2, - target: this.$el - }); - }, "onOverlayClick"), - onOverlayKeyDown: /* @__PURE__ */ __name(function onOverlayKeyDown3(event2) { - switch (event2.code) { - case "Escape": - this.onEscapeKey(event2); - break; - } - }, "onOverlayKeyDown"), - onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey6(event2) { - if (!this.overlayVisible) { - this.show(); - } else { - var optionIndex = this.focusedOptionIndex !== -1 ? this.findNextOptionIndex(this.focusedOptionIndex) : this.clicked ? this.findFirstOptionIndex() : this.findFirstFocusedOptionIndex(); - if (event2.shiftKey) { - this.onOptionSelectRange(event2, this.startRangeIndex, optionIndex); - } - this.changeFocusedOptionIndex(event2, optionIndex); - } - event2.preventDefault(); - }, "onArrowDownKey"), - onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey6(event2) { - var pressedInInputText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - if (event2.altKey && !pressedInInputText) { - if (this.focusedOptionIndex !== -1) { - this.onOptionSelect(event2, this.visibleOptions[this.focusedOptionIndex]); - } - this.overlayVisible && this.hide(); - event2.preventDefault(); - } else { - var optionIndex = this.focusedOptionIndex !== -1 ? this.findPrevOptionIndex(this.focusedOptionIndex) : this.clicked ? this.findLastOptionIndex() : this.findLastFocusedOptionIndex(); - if (event2.shiftKey) { - this.onOptionSelectRange(event2, optionIndex, this.startRangeIndex); - } - this.changeFocusedOptionIndex(event2, optionIndex); - !this.overlayVisible && this.show(); - event2.preventDefault(); - } - }, "onArrowUpKey"), - onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey3(event2) { - var pressedInInputText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - pressedInInputText && (this.focusedOptionIndex = -1); - }, "onArrowLeftKey"), - onHomeKey: /* @__PURE__ */ __name(function onHomeKey6(event2) { - var pressedInInputText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - if (pressedInInputText) { - var target = event2.currentTarget; - if (event2.shiftKey) { - target.setSelectionRange(0, event2.target.selectionStart); - } else { - target.setSelectionRange(0, 0); - this.focusedOptionIndex = -1; - } - } else { - var metaKey = event2.metaKey || event2.ctrlKey; - var optionIndex = this.findFirstOptionIndex(); - if (event2.shiftKey && metaKey) { - this.onOptionSelectRange(event2, optionIndex, this.startRangeIndex); - } - this.changeFocusedOptionIndex(event2, optionIndex); - !this.overlayVisible && this.show(); - } - event2.preventDefault(); - }, "onHomeKey"), - onEndKey: /* @__PURE__ */ __name(function onEndKey6(event2) { - var pressedInInputText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - if (pressedInInputText) { - var target = event2.currentTarget; - if (event2.shiftKey) { - target.setSelectionRange(event2.target.selectionStart, target.value.length); - } else { - var len = target.value.length; - target.setSelectionRange(len, len); - this.focusedOptionIndex = -1; - } - } else { - var metaKey = event2.metaKey || event2.ctrlKey; - var optionIndex = this.findLastOptionIndex(); - if (event2.shiftKey && metaKey) { - this.onOptionSelectRange(event2, this.startRangeIndex, optionIndex); - } - this.changeFocusedOptionIndex(event2, optionIndex); - !this.overlayVisible && this.show(); - } - event2.preventDefault(); - }, "onEndKey"), - onPageUpKey: /* @__PURE__ */ __name(function onPageUpKey(event2) { - this.scrollInView(0); - event2.preventDefault(); - }, "onPageUpKey"), - onPageDownKey: /* @__PURE__ */ __name(function onPageDownKey(event2) { - this.scrollInView(this.visibleOptions.length - 1); - event2.preventDefault(); - }, "onPageDownKey"), - onEnterKey: /* @__PURE__ */ __name(function onEnterKey5(event2) { - if (!this.overlayVisible) { - this.focusedOptionIndex = -1; - this.onArrowDownKey(event2); - } else { - if (this.focusedOptionIndex !== -1) { - if (event2.shiftKey) this.onOptionSelectRange(event2, this.focusedOptionIndex); - else this.onOptionSelect(event2, this.visibleOptions[this.focusedOptionIndex]); - } - } - event2.preventDefault(); - }, "onEnterKey"), - onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey3(event2) { - this.overlayVisible && this.hide(true); - event2.preventDefault(); - }, "onEscapeKey"), - onTabKey: /* @__PURE__ */ __name(function onTabKey3(event2) { - var pressedInInputText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - if (!pressedInInputText) { - if (this.overlayVisible && this.hasFocusableElements()) { - focus(event2.shiftKey ? this.$refs.lastHiddenFocusableElementOnOverlay : this.$refs.firstHiddenFocusableElementOnOverlay); - event2.preventDefault(); - } else { - if (this.focusedOptionIndex !== -1) { - this.onOptionSelect(event2, this.visibleOptions[this.focusedOptionIndex]); - } - this.overlayVisible && this.hide(this.filter); - } - } - }, "onTabKey"), - onShiftKey: /* @__PURE__ */ __name(function onShiftKey() { - this.startRangeIndex = this.focusedOptionIndex; - }, "onShiftKey"), - onOverlayEnter: /* @__PURE__ */ __name(function onOverlayEnter3(el) { - ZIndex.set("overlay", el, this.$primevue.config.zIndex.overlay); - addStyle(el, { - position: "absolute", - top: "0", - left: "0" - }); - this.alignOverlay(); - this.scrollInView(); - this.autoFilterFocus && focus(this.$refs.filterInput.$el); - }, "onOverlayEnter"), - onOverlayAfterEnter: /* @__PURE__ */ __name(function onOverlayAfterEnter2() { - this.bindOutsideClickListener(); - this.bindScrollListener(); - this.bindResizeListener(); - this.$emit("show"); - }, "onOverlayAfterEnter"), - onOverlayLeave: /* @__PURE__ */ __name(function onOverlayLeave3() { - this.unbindOutsideClickListener(); - this.unbindScrollListener(); - this.unbindResizeListener(); - this.$emit("hide"); - this.overlay = null; - }, "onOverlayLeave"), - onOverlayAfterLeave: /* @__PURE__ */ __name(function onOverlayAfterLeave3(el) { - ZIndex.clear(el); - }, "onOverlayAfterLeave"), - alignOverlay: /* @__PURE__ */ __name(function alignOverlay4() { - if (this.appendTo === "self") { - relativePosition(this.overlay, this.$el); - } else { - this.overlay.style.minWidth = getOuterWidth(this.$el) + "px"; - absolutePosition(this.overlay, this.$el); - } - }, "alignOverlay"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener5() { - var _this6 = this; - if (!this.outsideClickListener) { - this.outsideClickListener = function(event2) { - if (_this6.overlayVisible && _this6.isOutsideClicked(event2)) { - _this6.hide(); - } - }; - document.addEventListener("click", this.outsideClickListener); - } - }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener5() { - if (this.outsideClickListener) { - document.removeEventListener("click", this.outsideClickListener); - this.outsideClickListener = null; - } - }, "unbindOutsideClickListener"), - bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener5() { - var _this7 = this; - if (!this.scrollHandler) { - this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, function() { - if (_this7.overlayVisible) { - _this7.hide(); - } - }); - } - this.scrollHandler.bindScrollListener(); - }, "bindScrollListener"), - unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener5() { - if (this.scrollHandler) { - this.scrollHandler.unbindScrollListener(); - } - }, "unbindScrollListener"), - bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener5() { - var _this8 = this; - if (!this.resizeListener) { - this.resizeListener = function() { - if (_this8.overlayVisible && !isTouchDevice()) { - _this8.hide(); - } - }; - window.addEventListener("resize", this.resizeListener); - } - }, "bindResizeListener"), - unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener5() { - if (this.resizeListener) { - window.removeEventListener("resize", this.resizeListener); - this.resizeListener = null; - } - }, "unbindResizeListener"), - isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked2(event2) { - return !(this.$el.isSameNode(event2.target) || this.$el.contains(event2.target) || this.overlay && this.overlay.contains(event2.target)); - }, "isOutsideClicked"), - getLabelByValue: /* @__PURE__ */ __name(function getLabelByValue(value2) { - var _this9 = this; - var options4 = this.optionGroupLabel ? this.flatOptions(this.options) : this.options || []; - var matchedOption = options4.find(function(option4) { - return !_this9.isOptionGroup(option4) && equals(_this9.getOptionValue(option4), value2, _this9.equalityKey); - }); - return matchedOption ? this.getOptionLabel(matchedOption) : null; - }, "getLabelByValue"), - getSelectedItemsLabel: /* @__PURE__ */ __name(function getSelectedItemsLabel() { - var pattern = /{(.*?)}/; - var selectedItemsLabel = this.selectedItemsLabel || this.$primevue.config.locale.selectionMessage; - if (pattern.test(selectedItemsLabel)) { - return selectedItemsLabel.replace(selectedItemsLabel.match(pattern)[0], this.d_value.length + ""); - } - return selectedItemsLabel; - }, "getSelectedItemsLabel"), - onToggleAll: /* @__PURE__ */ __name(function onToggleAll(event2) { - var _this10 = this; - if (this.selectAll !== null) { - this.$emit("selectall-change", { - originalEvent: event2, - checked: !this.allSelected - }); - } else { - var value2 = this.allSelected ? [] : this.visibleOptions.filter(function(option4) { - return _this10.isValidOption(option4); - }).map(function(option4) { - return _this10.getOptionValue(option4); - }); - this.updateModel(event2, value2); - } - }, "onToggleAll"), - removeOption: /* @__PURE__ */ __name(function removeOption(event2, optionValue) { - var _this11 = this; - event2.stopPropagation(); - var value2 = this.d_value.filter(function(val) { - return !equals(val, optionValue, _this11.equalityKey); - }); - this.updateModel(event2, value2); - }, "removeOption"), - clearFilter: /* @__PURE__ */ __name(function clearFilter() { - this.filterValue = null; - }, "clearFilter"), - hasFocusableElements: /* @__PURE__ */ __name(function hasFocusableElements() { - return getFocusableElements(this.overlay, ':not([data-p-hidden-focusable="true"])').length > 0; - }, "hasFocusableElements"), - isOptionMatched: /* @__PURE__ */ __name(function isOptionMatched2(option4) { - var _this$getOptionLabel; - return this.isValidOption(option4) && typeof this.getOptionLabel(option4) === "string" && ((_this$getOptionLabel = this.getOptionLabel(option4)) === null || _this$getOptionLabel === void 0 ? void 0 : _this$getOptionLabel.toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))); - }, "isOptionMatched"), - isValidOption: /* @__PURE__ */ __name(function isValidOption2(option4) { - return isNotEmpty(option4) && !(this.isOptionDisabled(option4) || this.isOptionGroup(option4)); - }, "isValidOption"), - isValidSelectedOption: /* @__PURE__ */ __name(function isValidSelectedOption2(option4) { - return this.isValidOption(option4) && this.isSelected(option4); - }, "isValidSelectedOption"), - isEquals: /* @__PURE__ */ __name(function isEquals(value1, value2) { - return equals(value1, value2, this.equalityKey); - }, "isEquals"), - isSelected: /* @__PURE__ */ __name(function isSelected4(option4) { - var _this12 = this; - var optionValue = this.getOptionValue(option4); - return (this.d_value || []).some(function(value2) { - return _this12.isEquals(value2, optionValue); - }); - }, "isSelected"), - findFirstOptionIndex: /* @__PURE__ */ __name(function findFirstOptionIndex2() { - var _this13 = this; - return this.visibleOptions.findIndex(function(option4) { - return _this13.isValidOption(option4); - }); - }, "findFirstOptionIndex"), - findLastOptionIndex: /* @__PURE__ */ __name(function findLastOptionIndex2() { - var _this14 = this; - return findLastIndex(this.visibleOptions, function(option4) { - return _this14.isValidOption(option4); - }); - }, "findLastOptionIndex"), - findNextOptionIndex: /* @__PURE__ */ __name(function findNextOptionIndex4(index) { - var _this15 = this; - var matchedOptionIndex = index < this.visibleOptions.length - 1 ? this.visibleOptions.slice(index + 1).findIndex(function(option4) { - return _this15.isValidOption(option4); - }) : -1; - return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index; - }, "findNextOptionIndex"), - findPrevOptionIndex: /* @__PURE__ */ __name(function findPrevOptionIndex4(index) { - var _this16 = this; - var matchedOptionIndex = index > 0 ? findLastIndex(this.visibleOptions.slice(0, index), function(option4) { - return _this16.isValidOption(option4); - }) : -1; - return matchedOptionIndex > -1 ? matchedOptionIndex : index; - }, "findPrevOptionIndex"), - findSelectedOptionIndex: /* @__PURE__ */ __name(function findSelectedOptionIndex2() { - var _this17 = this; - if (this.$filled) { - var _loop = /* @__PURE__ */ __name(function _loop2() { - var value2 = _this17.d_value[index]; - var matchedOptionIndex = _this17.visibleOptions.findIndex(function(option4) { - return _this17.isValidSelectedOption(option4) && _this17.isEquals(value2, _this17.getOptionValue(option4)); - }); - if (matchedOptionIndex > -1) return { - v: matchedOptionIndex - }; - }, "_loop"), _ret; - for (var index = this.d_value.length - 1; index >= 0; index--) { - _ret = _loop(); - if (_ret) return _ret.v; - } - } - return -1; - }, "findSelectedOptionIndex"), - findFirstSelectedOptionIndex: /* @__PURE__ */ __name(function findFirstSelectedOptionIndex() { - var _this18 = this; - return this.$filled ? this.visibleOptions.findIndex(function(option4) { - return _this18.isValidSelectedOption(option4); - }) : -1; - }, "findFirstSelectedOptionIndex"), - findLastSelectedOptionIndex: /* @__PURE__ */ __name(function findLastSelectedOptionIndex() { - var _this19 = this; - return this.$filled ? findLastIndex(this.visibleOptions, function(option4) { - return _this19.isValidSelectedOption(option4); - }) : -1; - }, "findLastSelectedOptionIndex"), - findNextSelectedOptionIndex: /* @__PURE__ */ __name(function findNextSelectedOptionIndex(index) { - var _this20 = this; - var matchedOptionIndex = this.$filled && index < this.visibleOptions.length - 1 ? this.visibleOptions.slice(index + 1).findIndex(function(option4) { - return _this20.isValidSelectedOption(option4); - }) : -1; - return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : -1; - }, "findNextSelectedOptionIndex"), - findPrevSelectedOptionIndex: /* @__PURE__ */ __name(function findPrevSelectedOptionIndex(index) { - var _this21 = this; - var matchedOptionIndex = this.$filled && index > 0 ? findLastIndex(this.visibleOptions.slice(0, index), function(option4) { - return _this21.isValidSelectedOption(option4); - }) : -1; - return matchedOptionIndex > -1 ? matchedOptionIndex : -1; - }, "findPrevSelectedOptionIndex"), - findNearestSelectedOptionIndex: /* @__PURE__ */ __name(function findNearestSelectedOptionIndex(index) { - var firstCheckUp = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - var matchedOptionIndex = -1; - if (this.$filled) { - if (firstCheckUp) { - matchedOptionIndex = this.findPrevSelectedOptionIndex(index); - matchedOptionIndex = matchedOptionIndex === -1 ? this.findNextSelectedOptionIndex(index) : matchedOptionIndex; - } else { - matchedOptionIndex = this.findNextSelectedOptionIndex(index); - matchedOptionIndex = matchedOptionIndex === -1 ? this.findPrevSelectedOptionIndex(index) : matchedOptionIndex; - } - } - return matchedOptionIndex > -1 ? matchedOptionIndex : index; - }, "findNearestSelectedOptionIndex"), - findFirstFocusedOptionIndex: /* @__PURE__ */ __name(function findFirstFocusedOptionIndex2() { - var selectedIndex = this.findSelectedOptionIndex(); - return selectedIndex < 0 ? this.findFirstOptionIndex() : selectedIndex; - }, "findFirstFocusedOptionIndex"), - findLastFocusedOptionIndex: /* @__PURE__ */ __name(function findLastFocusedOptionIndex2() { - var selectedIndex = this.findSelectedOptionIndex(); - return selectedIndex < 0 ? this.findLastOptionIndex() : selectedIndex; - }, "findLastFocusedOptionIndex"), - searchOptions: /* @__PURE__ */ __name(function searchOptions2(event2) { - var _this22 = this; - this.searchValue = (this.searchValue || "") + event2.key; - var optionIndex = -1; - if (isNotEmpty(this.searchValue)) { - if (this.focusedOptionIndex !== -1) { - optionIndex = this.visibleOptions.slice(this.focusedOptionIndex).findIndex(function(option4) { - return _this22.isOptionMatched(option4); - }); - optionIndex = optionIndex === -1 ? this.visibleOptions.slice(0, this.focusedOptionIndex).findIndex(function(option4) { - return _this22.isOptionMatched(option4); - }) : optionIndex + this.focusedOptionIndex; - } else { - optionIndex = this.visibleOptions.findIndex(function(option4) { - return _this22.isOptionMatched(option4); - }); - } - if (optionIndex === -1 && this.focusedOptionIndex === -1) { - optionIndex = this.findFirstFocusedOptionIndex(); - } - if (optionIndex !== -1) { - this.changeFocusedOptionIndex(event2, optionIndex); - } - } - if (this.searchTimeout) { - clearTimeout(this.searchTimeout); - } - this.searchTimeout = setTimeout(function() { - _this22.searchValue = ""; - _this22.searchTimeout = null; - }, 500); - }, "searchOptions"), - changeFocusedOptionIndex: /* @__PURE__ */ __name(function changeFocusedOptionIndex4(event2, index) { - if (this.focusedOptionIndex !== index) { - this.focusedOptionIndex = index; - this.scrollInView(); - if (this.selectOnFocus) { - this.onOptionSelect(event2, this.visibleOptions[index]); - } - } - }, "changeFocusedOptionIndex"), - scrollInView: /* @__PURE__ */ __name(function scrollInView4() { - var _this23 = this; - var index = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : -1; - this.$nextTick(function() { - var id4 = index !== -1 ? "".concat(_this23.id, "_").concat(index) : _this23.focusedOptionId; - var element = findSingle(_this23.list, 'li[id="'.concat(id4, '"]')); - if (element) { - element.scrollIntoView && element.scrollIntoView({ - block: "nearest", - inline: "nearest" - }); - } else if (!_this23.virtualScrollerDisabled) { - _this23.virtualScroller && _this23.virtualScroller.scrollToIndex(index !== -1 ? index : _this23.focusedOptionIndex); - } - }); - }, "scrollInView"), - autoUpdateModel: /* @__PURE__ */ __name(function autoUpdateModel2() { - if (this.selectOnFocus && this.autoOptionFocus && !this.$filled) { - this.focusedOptionIndex = this.findFirstFocusedOptionIndex(); - var value2 = this.getOptionValue(this.visibleOptions[this.focusedOptionIndex]); - this.updateModel(null, [value2]); - } - }, "autoUpdateModel"), - updateModel: /* @__PURE__ */ __name(function updateModel6(event2, value2) { - this.writeValue(value2, event2); - this.$emit("change", { - originalEvent: event2, - value: value2 - }); - }, "updateModel"), - flatOptions: /* @__PURE__ */ __name(function flatOptions(options4) { - var _this24 = this; - return (options4 || []).reduce(function(result, option4, index) { - result.push({ - optionGroup: option4, - group: true, - index - }); - var optionGroupChildren = _this24.getOptionGroupChildren(option4); - optionGroupChildren && optionGroupChildren.forEach(function(o) { - return result.push(o); - }); - return result; - }, []); - }, "flatOptions"), - overlayRef: /* @__PURE__ */ __name(function overlayRef3(el) { - this.overlay = el; - }, "overlayRef"), - listRef: /* @__PURE__ */ __name(function listRef2(el, contentRef) { - this.list = el; - contentRef && contentRef(el); - }, "listRef"), - virtualScrollerRef: /* @__PURE__ */ __name(function virtualScrollerRef(el) { - this.virtualScroller = el; - }, "virtualScrollerRef") - }, - computed: { - visibleOptions: /* @__PURE__ */ __name(function visibleOptions2() { - var _this25 = this; - var options4 = this.optionGroupLabel ? this.flatOptions(this.options) : this.options || []; - if (this.filterValue) { - var filteredOptions = FilterService.filter(options4, this.searchFields, this.filterValue, this.filterMatchMode, this.filterLocale); - if (this.optionGroupLabel) { - var optionGroups = this.options || []; - var filtered = []; - optionGroups.forEach(function(group) { - var groupChildren = _this25.getOptionGroupChildren(group); - var filteredItems = groupChildren.filter(function(item8) { - return filteredOptions.includes(item8); - }); - if (filteredItems.length > 0) filtered.push(_objectSpread$d(_objectSpread$d({}, group), {}, _defineProperty$1$2({}, typeof _this25.optionGroupChildren === "string" ? _this25.optionGroupChildren : "items", _toConsumableArray$6(filteredItems)))); - }); - return this.flatOptions(filtered); - } - return filteredOptions; - } - return options4; - }, "visibleOptions"), - label: /* @__PURE__ */ __name(function label7() { - var label12; - if (this.d_value && this.d_value.length) { - if (isNotEmpty(this.maxSelectedLabels) && this.d_value.length > this.maxSelectedLabels) { - return this.getSelectedItemsLabel(); - } else { - label12 = ""; - for (var i = 0; i < this.d_value.length; i++) { - if (i !== 0) { - label12 += ", "; - } - label12 += this.getLabelByValue(this.d_value[i]); - } - } - } else { - label12 = this.placeholder; - } - return label12; - }, "label"), - chipSelectedItems: /* @__PURE__ */ __name(function chipSelectedItems() { - return isNotEmpty(this.maxSelectedLabels) && this.d_value && this.d_value.length > this.maxSelectedLabels; - }, "chipSelectedItems"), - allSelected: /* @__PURE__ */ __name(function allSelected() { - var _this26 = this; - return this.selectAll !== null ? this.selectAll : isNotEmpty(this.visibleOptions) && this.visibleOptions.every(function(option4) { - return _this26.isOptionGroup(option4) || _this26.isOptionDisabled(option4) || _this26.isSelected(option4); - }); - }, "allSelected"), - // @deprecated use $filled instead. - hasSelectedOption: /* @__PURE__ */ __name(function hasSelectedOption2() { - return this.$filled; - }, "hasSelectedOption"), - equalityKey: /* @__PURE__ */ __name(function equalityKey2() { - return this.optionValue ? null : this.dataKey; - }, "equalityKey"), - searchFields: /* @__PURE__ */ __name(function searchFields() { - return this.filterFields || [this.optionLabel]; - }, "searchFields"), - maxSelectionLimitReached: /* @__PURE__ */ __name(function maxSelectionLimitReached() { - return this.selectionLimit && this.d_value && this.d_value.length === this.selectionLimit; - }, "maxSelectionLimitReached"), - filterResultMessageText: /* @__PURE__ */ __name(function filterResultMessageText() { - return isNotEmpty(this.visibleOptions) ? this.filterMessageText.replaceAll("{0}", this.visibleOptions.length) : this.emptyFilterMessageText; - }, "filterResultMessageText"), - filterMessageText: /* @__PURE__ */ __name(function filterMessageText() { - return this.filterMessage || this.$primevue.config.locale.searchMessage || ""; - }, "filterMessageText"), - emptyFilterMessageText: /* @__PURE__ */ __name(function emptyFilterMessageText() { - return this.emptyFilterMessage || this.$primevue.config.locale.emptySearchMessage || this.$primevue.config.locale.emptyFilterMessage || ""; - }, "emptyFilterMessageText"), - emptyMessageText: /* @__PURE__ */ __name(function emptyMessageText3() { - return this.emptyMessage || this.$primevue.config.locale.emptyMessage || ""; - }, "emptyMessageText"), - selectionMessageText: /* @__PURE__ */ __name(function selectionMessageText2() { - return this.selectionMessage || this.$primevue.config.locale.selectionMessage || ""; - }, "selectionMessageText"), - emptySelectionMessageText: /* @__PURE__ */ __name(function emptySelectionMessageText2() { - return this.emptySelectionMessage || this.$primevue.config.locale.emptySelectionMessage || ""; - }, "emptySelectionMessageText"), - selectedMessageText: /* @__PURE__ */ __name(function selectedMessageText2() { - return this.$filled ? this.selectionMessageText.replaceAll("{0}", this.d_value.length) : this.emptySelectionMessageText; - }, "selectedMessageText"), - focusedOptionId: /* @__PURE__ */ __name(function focusedOptionId5() { - return this.focusedOptionIndex !== -1 ? "".concat(this.id, "_").concat(this.focusedOptionIndex) : null; - }, "focusedOptionId"), - ariaSetSize: /* @__PURE__ */ __name(function ariaSetSize() { - var _this27 = this; - return this.visibleOptions.filter(function(option4) { - return !_this27.isOptionGroup(option4); - }).length; - }, "ariaSetSize"), - toggleAllAriaLabel: /* @__PURE__ */ __name(function toggleAllAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria[this.allSelected ? "selectAll" : "unselectAll"] : void 0; - }, "toggleAllAriaLabel"), - listAriaLabel: /* @__PURE__ */ __name(function listAriaLabel2() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.listLabel : void 0; - }, "listAriaLabel"), - virtualScrollerDisabled: /* @__PURE__ */ __name(function virtualScrollerDisabled() { - return !this.virtualScrollerOptions; - }, "virtualScrollerDisabled"), - hasFluid: /* @__PURE__ */ __name(function hasFluid() { - return isEmpty(this.fluid) ? !!this.$pcFluid : this.fluid; - }, "hasFluid"), - isClearIconVisible: /* @__PURE__ */ __name(function isClearIconVisible2() { - return this.showClear && this.d_value != null && isNotEmpty(this.options); - }, "isClearIconVisible") - }, - directives: { - ripple: Ripple - }, - components: { - InputText: script$1l, - Checkbox: script$1I, - VirtualScroller: script$1J, - Portal: script$1m, - Chip: script$1s, - IconField: script$1K, - InputIcon: script$1L, - TimesIcon: script$1q, - SearchIcon: script$1M, - ChevronDownIcon: script$1h, - SpinnerIcon: script$1p, - CheckIcon: script$1C - } -}; -function _typeof$e(o) { - "@babel/helpers - typeof"; - return _typeof$e = "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$e(o); -} -__name(_typeof$e, "_typeof$e"); -function _defineProperty$e(e, r, t2) { - return (r = _toPropertyKey$e(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$e, "_defineProperty$e"); -function _toPropertyKey$e(t2) { - var i = _toPrimitive$e(t2, "string"); - return "symbol" == _typeof$e(i) ? i : i + ""; -} -__name(_toPropertyKey$e, "_toPropertyKey$e"); -function _toPrimitive$e(t2, r) { - if ("object" != _typeof$e(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$e(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$e, "_toPrimitive$e"); -var _hoisted_1$f = ["id", "disabled", "placeholder", "tabindex", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-invalid"]; -var _hoisted_2$b = { - key: 0 -}; -var _hoisted_3$8 = ["id", "aria-label"]; -var _hoisted_4$5 = ["id"]; -var _hoisted_5$1 = ["id", "aria-label", "aria-selected", "aria-disabled", "aria-setsize", "aria-posinset", "onClick", "onMousemove", "data-p-selected", "data-p-focused", "data-p-disabled"]; -function render$r(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Chip = resolveComponent("Chip"); - var _component_SpinnerIcon = resolveComponent("SpinnerIcon"); - var _component_Checkbox = resolveComponent("Checkbox"); - var _component_InputText = resolveComponent("InputText"); - var _component_SearchIcon = resolveComponent("SearchIcon"); - var _component_InputIcon = resolveComponent("InputIcon"); - var _component_IconField = resolveComponent("IconField"); - var _component_VirtualScroller = resolveComponent("VirtualScroller"); - var _component_Portal = resolveComponent("Portal"); - var _directive_ripple = resolveDirective("ripple"); - return openBlock(), createElementBlock("div", mergeProps({ - ref: "container", - "class": _ctx.cx("root"), - style: _ctx.sx("root"), - onClick: _cache[7] || (_cache[7] = function() { - return $options.onContainerClick && $options.onContainerClick.apply($options, arguments); - }) - }, _ctx.ptmi("root")), [createBaseVNode("div", mergeProps({ - "class": "p-hidden-accessible" - }, _ctx.ptm("hiddenInputContainer"), { - "data-p-hidden-accessible": true - }), [createBaseVNode("input", mergeProps({ - ref: "focusInput", - id: _ctx.inputId, - type: "text", - readonly: "", - disabled: _ctx.disabled, - placeholder: _ctx.placeholder, - tabindex: !_ctx.disabled ? _ctx.tabindex : -1, - role: "combobox", - "aria-label": _ctx.ariaLabel, - "aria-labelledby": _ctx.ariaLabelledby, - "aria-haspopup": "listbox", - "aria-expanded": $data.overlayVisible, - "aria-controls": $data.id + "_list", - "aria-activedescendant": $data.focused ? $options.focusedOptionId : void 0, - "aria-invalid": _ctx.invalid || void 0, - onFocus: _cache[0] || (_cache[0] = function() { - return $options.onFocus && $options.onFocus.apply($options, arguments); - }), - onBlur: _cache[1] || (_cache[1] = function() { - return $options.onBlur && $options.onBlur.apply($options, arguments); - }), - onKeydown: _cache[2] || (_cache[2] = function() { - return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); - }) - }, _ctx.ptm("hiddenInput")), null, 16, _hoisted_1$f)], 16), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("labelContainer") - }, _ctx.ptm("labelContainer")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("label") - }, _ctx.ptm("label")), [renderSlot(_ctx.$slots, "value", { - value: _ctx.d_value, - placeholder: _ctx.placeholder - }, function() { - return [_ctx.display === "comma" ? (openBlock(), createElementBlock(Fragment, { - key: 0 - }, [createTextVNode(toDisplayString($options.label || "empty"), 1)], 64)) : _ctx.display === "chip" ? (openBlock(), createElementBlock(Fragment, { - key: 1 - }, [$options.chipSelectedItems ? (openBlock(), createElementBlock("span", _hoisted_2$b, toDisplayString($options.label), 1)) : (openBlock(true), createElementBlock(Fragment, { - key: 1 - }, renderList(_ctx.d_value, function(item8) { - return openBlock(), createElementBlock("span", mergeProps({ - key: $options.getLabelByValue(item8), - "class": _ctx.cx("chipItem"), - ref_for: true - }, _ctx.ptm("chipItem")), [renderSlot(_ctx.$slots, "chip", { - value: item8, - removeCallback: /* @__PURE__ */ __name(function removeCallback(event2) { - return $options.removeOption(event2, item8); - }, "removeCallback") - }, function() { - return [createVNode(_component_Chip, { - "class": normalizeClass(_ctx.cx("pcChip")), - label: $options.getLabelByValue(item8), - removeIcon: _ctx.chipIcon || _ctx.removeTokenIcon, - removable: "", - unstyled: _ctx.unstyled, - onRemove: /* @__PURE__ */ __name(function onRemove($event) { - return $options.removeOption($event, item8); - }, "onRemove"), - pt: _ctx.ptm("pcChip") - }, { - removeicon: withCtx(function() { - return [renderSlot(_ctx.$slots, _ctx.$slots.chipicon ? "chipicon" : "removetokenicon", { - "class": normalizeClass(_ctx.cx("chipIcon")), - item: item8, - removeCallback: /* @__PURE__ */ __name(function removeCallback(event2) { - return $options.removeOption(event2, item8); - }, "removeCallback") - })]; - }), - _: 2 - }, 1032, ["class", "label", "removeIcon", "unstyled", "onRemove", "pt"])]; - })], 16); - }), 128)), !_ctx.d_value || _ctx.d_value.length === 0 ? (openBlock(), createElementBlock(Fragment, { - key: 2 - }, [createTextVNode(toDisplayString(_ctx.placeholder || "empty"), 1)], 64)) : createCommentVNode("", true)], 64)) : createCommentVNode("", true)]; - })], 16)], 16), $options.isClearIconVisible ? renderSlot(_ctx.$slots, "clearicon", { - key: 0, - "class": normalizeClass(_ctx.cx("clearIcon")), - clearCallback: $options.onClearClick - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon ? "i" : "TimesIcon"), mergeProps({ - ref: "clearIcon", - "class": [_ctx.cx("clearIcon"), _ctx.clearIcon], - onClick: $options.onClearClick - }, _ctx.ptm("clearIcon"), { - "data-pc-section": "clearicon" - }), null, 16, ["class", "onClick"]))]; - }) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("dropdown") - }, _ctx.ptm("dropdown")), [_ctx.loading ? renderSlot(_ctx.$slots, "loadingicon", { - key: 0, - "class": normalizeClass(_ctx.cx("loadingIcon")) - }, function() { - return [_ctx.loadingIcon ? (openBlock(), createElementBlock("span", mergeProps({ - key: 0, - "class": [_ctx.cx("loadingIcon"), "pi-spin", _ctx.loadingIcon], - "aria-hidden": "true" - }, _ctx.ptm("loadingIcon")), null, 16)) : (openBlock(), createBlock(_component_SpinnerIcon, mergeProps({ - key: 1, - "class": _ctx.cx("loadingIcon"), - spin: "", - "aria-hidden": "true" - }, _ctx.ptm("loadingIcon")), null, 16, ["class"]))]; - }) : renderSlot(_ctx.$slots, "dropdownicon", { - key: 1, - "class": normalizeClass(_ctx.cx("dropdownIcon")) - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.dropdownIcon ? "span" : "ChevronDownIcon"), mergeProps({ - "class": [_ctx.cx("dropdownIcon"), _ctx.dropdownIcon], - "aria-hidden": "true" - }, _ctx.ptm("dropdownIcon")), null, 16, ["class"]))]; - })], 16), createVNode(_component_Portal, { - appendTo: _ctx.appendTo - }, { - "default": withCtx(function() { - return [createVNode(Transition, mergeProps({ - name: "p-connected-overlay", - onEnter: $options.onOverlayEnter, - onAfterEnter: $options.onOverlayAfterEnter, - onLeave: $options.onOverlayLeave, - onAfterLeave: $options.onOverlayAfterLeave - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [$data.overlayVisible ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: $options.overlayRef, - style: [_ctx.panelStyle, _ctx.overlayStyle], - "class": [_ctx.cx("overlay"), _ctx.panelClass, _ctx.overlayClass], - onClick: _cache[5] || (_cache[5] = function() { - return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); - }), - onKeydown: _cache[6] || (_cache[6] = function() { - return $options.onOverlayKeyDown && $options.onOverlayKeyDown.apply($options, arguments); - }) - }, _ctx.ptm("overlay")), [createBaseVNode("span", mergeProps({ - ref: "firstHiddenFocusableElementOnOverlay", - role: "presentation", - "aria-hidden": "true", - "class": "p-hidden-accessible p-hidden-focusable", - tabindex: 0, - onFocus: _cache[3] || (_cache[3] = function() { - return $options.onFirstHiddenFocus && $options.onFirstHiddenFocus.apply($options, arguments); - }) - }, _ctx.ptm("hiddenFirstFocusableEl"), { - "data-p-hidden-accessible": true, - "data-p-hidden-focusable": true - }), null, 16), renderSlot(_ctx.$slots, "header", { - value: _ctx.d_value, - options: $options.visibleOptions - }), _ctx.showToggleAll && _ctx.selectionLimit == null || _ctx.filter ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("header") - }, _ctx.ptm("header")), [_ctx.showToggleAll && _ctx.selectionLimit == null ? (openBlock(), createBlock(_component_Checkbox, { - key: 0, - modelValue: $options.allSelected, - binary: true, - disabled: _ctx.disabled, - variant: _ctx.variant, - "aria-label": $options.toggleAllAriaLabel, - onChange: $options.onToggleAll, - unstyled: _ctx.unstyled, - pt: $options.getHeaderCheckboxPTOptions("pcHeaderCheckbox") - }, { - icon: withCtx(function(slotProps) { - return [_ctx.$slots.headercheckboxicon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.headercheckboxicon), { - key: 0, - checked: slotProps.checked, - "class": normalizeClass(slotProps["class"]) - }, null, 8, ["checked", "class"])) : slotProps.checked ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.checkboxIcon ? "span" : "CheckIcon"), mergeProps({ - key: 1, - "class": [slotProps["class"], _defineProperty$e({}, _ctx.checkboxIcon, slotProps.checked)] - }, $options.getHeaderCheckboxPTOptions("pcHeaderCheckbox.icon")), null, 16, ["class"])) : createCommentVNode("", true)]; - }), - _: 1 - }, 8, ["modelValue", "disabled", "variant", "aria-label", "onChange", "unstyled", "pt"])) : createCommentVNode("", true), _ctx.filter ? (openBlock(), createBlock(_component_IconField, { - key: 1, - "class": normalizeClass(_ctx.cx("pcFilterContainer")), - unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcFilterContainer") - }, { - "default": withCtx(function() { - return [createVNode(_component_InputText, { - ref: "filterInput", - value: $data.filterValue, - onVnodeMounted: $options.onFilterUpdated, - onVnodeUpdated: $options.onFilterUpdated, - "class": normalizeClass(_ctx.cx("pcFilter")), - placeholder: _ctx.filterPlaceholder, - disabled: _ctx.disabled, - variant: _ctx.variant, - unstyled: _ctx.unstyled, - role: "searchbox", - autocomplete: "off", - "aria-owns": $data.id + "_list", - "aria-activedescendant": $options.focusedOptionId, - onKeydown: $options.onFilterKeyDown, - onBlur: $options.onFilterBlur, - onInput: $options.onFilterChange, - pt: _ctx.ptm("pcFilter") - }, null, 8, ["value", "onVnodeMounted", "onVnodeUpdated", "class", "placeholder", "disabled", "variant", "unstyled", "aria-owns", "aria-activedescendant", "onKeydown", "onBlur", "onInput", "pt"]), createVNode(_component_InputIcon, { - unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcFilterIconContainer") - }, { - "default": withCtx(function() { - return [renderSlot(_ctx.$slots, "filtericon", {}, function() { - return [_ctx.filterIcon ? (openBlock(), createElementBlock("span", mergeProps({ - key: 0, - "class": _ctx.filterIcon - }, _ctx.ptm("filterIcon")), null, 16)) : (openBlock(), createBlock(_component_SearchIcon, normalizeProps(mergeProps({ - key: 1 - }, _ctx.ptm("filterIcon"))), null, 16))]; - })]; - }), - _: 3 - }, 8, ["unstyled", "pt"])]; - }), - _: 3 - }, 8, ["class", "unstyled", "pt"])) : createCommentVNode("", true), _ctx.filter ? (openBlock(), createElementBlock("span", mergeProps({ - key: 2, - role: "status", - "aria-live": "polite", - "class": "p-hidden-accessible" - }, _ctx.ptm("hiddenFilterResult"), { - "data-p-hidden-accessible": true - }), toDisplayString($options.filterResultMessageText), 17)) : createCommentVNode("", true)], 16)) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("listContainer"), - style: { - "max-height": $options.virtualScrollerDisabled ? _ctx.scrollHeight : "" - } - }, _ctx.ptm("listContainer")), [createVNode(_component_VirtualScroller, mergeProps({ - ref: $options.virtualScrollerRef - }, _ctx.virtualScrollerOptions, { - items: $options.visibleOptions, - style: { - height: _ctx.scrollHeight - }, - tabindex: -1, - disabled: $options.virtualScrollerDisabled, - pt: _ctx.ptm("virtualScroller") - }), createSlots({ - content: withCtx(function(_ref2) { - var styleClass = _ref2.styleClass, contentRef = _ref2.contentRef, items2 = _ref2.items, getItemOptions = _ref2.getItemOptions, contentStyle = _ref2.contentStyle, itemSize = _ref2.itemSize; - return [createBaseVNode("ul", mergeProps({ - ref: /* @__PURE__ */ __name(function ref2(el) { - return $options.listRef(el, contentRef); - }, "ref"), - id: $data.id + "_list", - "class": [_ctx.cx("list"), styleClass], - style: contentStyle, - role: "listbox", - "aria-multiselectable": "true", - "aria-label": $options.listAriaLabel - }, _ctx.ptm("list")), [(openBlock(true), createElementBlock(Fragment, null, renderList(items2, function(option4, i) { - return openBlock(), createElementBlock(Fragment, { - key: $options.getOptionRenderKey(option4, $options.getOptionIndex(i, getItemOptions)) - }, [$options.isOptionGroup(option4) ? (openBlock(), createElementBlock("li", mergeProps({ - key: 0, - id: $data.id + "_" + $options.getOptionIndex(i, getItemOptions), - style: { - height: itemSize ? itemSize + "px" : void 0 - }, - "class": _ctx.cx("optionGroup"), - role: "option", - ref_for: true - }, _ctx.ptm("optionGroup")), [renderSlot(_ctx.$slots, "optiongroup", { - option: option4.optionGroup, - index: $options.getOptionIndex(i, getItemOptions) - }, function() { - return [createTextVNode(toDisplayString($options.getOptionGroupLabel(option4.optionGroup)), 1)]; - })], 16, _hoisted_4$5)) : withDirectives((openBlock(), createElementBlock("li", mergeProps({ - key: 1, - id: $data.id + "_" + $options.getOptionIndex(i, getItemOptions), - style: { - height: itemSize ? itemSize + "px" : void 0 - }, - "class": _ctx.cx("option", { - option: option4, - index: i, - getItemOptions - }), - role: "option", - "aria-label": $options.getOptionLabel(option4), - "aria-selected": $options.isSelected(option4), - "aria-disabled": $options.isOptionDisabled(option4), - "aria-setsize": $options.ariaSetSize, - "aria-posinset": $options.getAriaPosInset($options.getOptionIndex(i, getItemOptions)), - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return $options.onOptionSelect($event, option4, $options.getOptionIndex(i, getItemOptions), true); - }, "onClick"), - onMousemove: /* @__PURE__ */ __name(function onMousemove($event) { - return $options.onOptionMouseMove($event, $options.getOptionIndex(i, getItemOptions)); - }, "onMousemove"), - ref_for: true - }, $options.getCheckboxPTOptions(option4, getItemOptions, i, "option"), { - "data-p-selected": $options.isSelected(option4), - "data-p-focused": $data.focusedOptionIndex === $options.getOptionIndex(i, getItemOptions), - "data-p-disabled": $options.isOptionDisabled(option4) - }), [createVNode(_component_Checkbox, { - defaultValue: $options.isSelected(option4), - binary: true, - tabindex: -1, - variant: _ctx.variant, - unstyled: _ctx.unstyled, - pt: $options.getCheckboxPTOptions(option4, getItemOptions, i, "pcOptionCheckbox") - }, { - icon: withCtx(function(slotProps) { - return [_ctx.$slots.optioncheckboxicon || _ctx.$slots.itemcheckboxicon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.optioncheckboxicon || _ctx.$slots.itemcheckboxicon), { - key: 0, - checked: slotProps.checked, - "class": normalizeClass(slotProps["class"]) - }, null, 8, ["checked", "class"])) : slotProps.checked ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.checkboxIcon ? "span" : "CheckIcon"), mergeProps({ - key: 1, - "class": [slotProps["class"], _defineProperty$e({}, _ctx.checkboxIcon, slotProps.checked)], - ref_for: true - }, $options.getCheckboxPTOptions(option4, getItemOptions, i, "pcOptionCheckbox.icon")), null, 16, ["class"])) : createCommentVNode("", true)]; - }), - _: 2 - }, 1032, ["defaultValue", "variant", "unstyled", "pt"]), renderSlot(_ctx.$slots, "option", { - option: option4, - selected: $options.isSelected(option4), - index: $options.getOptionIndex(i, getItemOptions) - }, function() { - return [createBaseVNode("span", mergeProps({ - ref_for: true - }, _ctx.ptm("optionLabel")), toDisplayString($options.getOptionLabel(option4)), 17)]; - })], 16, _hoisted_5$1)), [[_directive_ripple]])], 64); - }), 128)), $data.filterValue && (!items2 || items2 && items2.length === 0) ? (openBlock(), createElementBlock("li", mergeProps({ - key: 0, - "class": _ctx.cx("emptyMessage"), - role: "option" - }, _ctx.ptm("emptyMessage")), [renderSlot(_ctx.$slots, "emptyfilter", {}, function() { - return [createTextVNode(toDisplayString($options.emptyFilterMessageText), 1)]; - })], 16)) : !_ctx.options || _ctx.options && _ctx.options.length === 0 ? (openBlock(), createElementBlock("li", mergeProps({ - key: 1, - "class": _ctx.cx("emptyMessage"), - role: "option" - }, _ctx.ptm("emptyMessage")), [renderSlot(_ctx.$slots, "empty", {}, function() { - return [createTextVNode(toDisplayString($options.emptyMessageText), 1)]; - })], 16)) : createCommentVNode("", true)], 16, _hoisted_3$8)]; - }), - _: 2 - }, [_ctx.$slots.loader ? { - name: "loader", - fn: withCtx(function(_ref4) { - var options4 = _ref4.options; - return [renderSlot(_ctx.$slots, "loader", { - options: options4 - })]; - }), - key: "0" - } : void 0]), 1040, ["items", "style", "disabled", "pt"])], 16), renderSlot(_ctx.$slots, "footer", { - value: _ctx.d_value, - options: $options.visibleOptions - }), !_ctx.options || _ctx.options && _ctx.options.length === 0 ? (openBlock(), createElementBlock("span", mergeProps({ - key: 1, - role: "status", - "aria-live": "polite", - "class": "p-hidden-accessible" - }, _ctx.ptm("hiddenEmptyMessage"), { - "data-p-hidden-accessible": true - }), toDisplayString($options.emptyMessageText), 17)) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ - role: "status", - "aria-live": "polite", - "class": "p-hidden-accessible" - }, _ctx.ptm("hiddenSelectedMessage"), { - "data-p-hidden-accessible": true - }), toDisplayString($options.selectedMessageText), 17), createBaseVNode("span", mergeProps({ - ref: "lastHiddenFocusableElementOnOverlay", - role: "presentation", - "aria-hidden": "true", - "class": "p-hidden-accessible p-hidden-focusable", - tabindex: 0, - onFocus: _cache[4] || (_cache[4] = function() { - return $options.onLastHiddenFocus && $options.onLastHiddenFocus.apply($options, arguments); - }) - }, _ctx.ptm("hiddenLastFocusableEl"), { - "data-p-hidden-accessible": true, - "data-p-hidden-focusable": true - }), null, 16)], 16)) : createCommentVNode("", true)]; - }), - _: 3 - }, 16, ["onEnter", "onAfterEnter", "onLeave", "onAfterLeave"])]; - }), - _: 3 - }, 8, ["appendTo"])], 16); -} -__name(render$r, "render$r"); -script$v.render = render$r; -var script$u = { - name: "AngleDoubleDownIcon", - "extends": script$1j -}; -function render$q(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M6.70786 6.59831C6.80043 6.63674 6.89974 6.65629 6.99997 6.65581C7.19621 6.64081 7.37877 6.54953 7.50853 6.40153L11.0685 2.8416C11.1364 2.69925 11.1586 2.53932 11.132 2.38384C11.1053 2.22837 11.0311 2.08498 10.9195 1.97343C10.808 1.86188 10.6646 1.78766 10.5091 1.76099C10.3536 1.73431 10.1937 1.75649 10.0513 1.82448L6.99997 4.87585L3.9486 1.82448C3.80625 1.75649 3.64632 1.73431 3.49084 1.76099C3.33536 1.78766 3.19197 1.86188 3.08043 1.97343C2.96888 2.08498 2.89466 2.22837 2.86798 2.38384C2.84131 2.53932 2.86349 2.69925 2.93147 2.8416L6.46089 6.43205C6.53132 6.50336 6.61528 6.55989 6.70786 6.59831ZM6.70786 12.1925C6.80043 12.2309 6.89974 12.2505 6.99997 12.25C7.10241 12.2465 7.20306 12.2222 7.29575 12.1785C7.38845 12.1348 7.47124 12.0726 7.53905 11.9957L11.0685 8.46629C11.1614 8.32292 11.2036 8.15249 11.1881 7.98233C11.1727 7.81216 11.1005 7.6521 10.9833 7.52781C10.866 7.40353 10.7104 7.3222 10.5415 7.29688C10.3725 7.27155 10.1999 7.30369 10.0513 7.38814L6.99997 10.4395L3.9486 7.38814C3.80006 7.30369 3.62747 7.27155 3.45849 7.29688C3.28951 7.3222 3.13393 7.40353 3.01667 7.52781C2.89942 7.6521 2.82729 7.81216 2.81184 7.98233C2.79639 8.15249 2.83852 8.32292 2.93148 8.46629L6.4609 12.0262C6.53133 12.0975 6.61529 12.1541 6.70786 12.1925Z", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$q, "render$q"); -script$u.render = render$q; -var script$t = { - name: "AngleDoubleUpIcon", - "extends": script$1j -}; -function render$p(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M10.1504 6.67719C10.2417 6.71508 10.3396 6.73436 10.4385 6.73389C10.6338 6.74289 10.8249 6.67441 10.97 6.54334C11.1109 6.4023 11.19 6.21112 11.19 6.01178C11.19 5.81245 11.1109 5.62127 10.97 5.48023L7.45977 1.96998C7.31873 1.82912 7.12755 1.75 6.92821 1.75C6.72888 1.75 6.5377 1.82912 6.39666 1.96998L2.9165 5.45014C2.83353 5.58905 2.79755 5.751 2.81392 5.91196C2.83028 6.07293 2.89811 6.22433 3.00734 6.34369C3.11656 6.46306 3.26137 6.54402 3.42025 6.57456C3.57914 6.60511 3.74364 6.5836 3.88934 6.51325L6.89813 3.50446L9.90691 6.51325C9.97636 6.58357 10.0592 6.6393 10.1504 6.67719ZM9.93702 11.9993C10.065 12.1452 10.245 12.2352 10.4385 12.25C10.632 12.2352 10.812 12.1452 10.9399 11.9993C11.0633 11.8614 11.1315 11.6828 11.1315 11.4978C11.1315 11.3128 11.0633 11.1342 10.9399 10.9963L7.48987 7.48609C7.34883 7.34523 7.15765 7.26611 6.95832 7.26611C6.75899 7.26611 6.5678 7.34523 6.42677 7.48609L2.91652 10.9963C2.84948 11.1367 2.82761 11.2944 2.85391 11.4477C2.88022 11.601 2.9534 11.7424 3.06339 11.8524C3.17338 11.9624 3.31477 12.0356 3.46808 12.0619C3.62139 12.0882 3.77908 12.0663 3.91945 11.9993L6.92823 8.99048L9.93702 11.9993Z", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$p, "render$p"); -script$t.render = render$p; -var theme$f = /* @__PURE__ */ __name(function theme24(_ref) { - var dt = _ref.dt; - return "\n.p-orderlist {\n display: flex;\n gap: ".concat(dt("orderlist.gap"), ";\n}\n\n.p-orderlist-controls {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: ").concat(dt("orderlist.controls.gap"), ";\n}\n"); -}, "theme"); -var classes$g = { - root: "p-orderlist p-component", - controls: "p-orderlist-controls" -}; -var OrderListStyle = BaseStyle.extend({ - name: "orderlist", - theme: theme$f, - classes: classes$g -}); -var script$1$g = { - name: "BaseOrderList", - "extends": script$1f, - props: { - modelValue: { - type: Array, - "default": null - }, - selection: { - type: Array, - "default": null - }, - dataKey: { - type: String, - "default": null - }, - listStyle: { - type: null, - "default": null - }, - metaKeySelection: { - type: Boolean, - "default": false - }, - autoOptionFocus: { - type: Boolean, - "default": true - }, - focusOnHover: { - type: Boolean, - "default": true - }, - responsive: { - type: Boolean, - "default": true - }, - breakpoint: { - type: String, - "default": "960px" - }, - striped: { - type: Boolean, - "default": false - }, - scrollHeight: { - type: String, - "default": "14rem" - }, - buttonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default12() { - return { - severity: "secondary" - }; - }, "_default") - }, - moveUpButtonProps: { - type: null, - "default": null - }, - moveTopButtonProps: { - type: null, - "default": null - }, - moveDownButtonProps: { - type: null, - "default": null - }, - moveBottomButtonProps: { - type: null, - "default": null - }, - tabindex: { - type: Number, - "default": 0 - }, - disabled: { - type: Boolean, - "default": false - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - } - }, - style: OrderListStyle, - provide: /* @__PURE__ */ __name(function provide34() { - return { - $pcOrderList: this, - $parentInstance: this - }; - }, "provide") -}; -function _toConsumableArray$5(r) { - return _arrayWithoutHoles$5(r) || _iterableToArray$5(r) || _unsupportedIterableToArray$6(r) || _nonIterableSpread$5(); -} -__name(_toConsumableArray$5, "_toConsumableArray$5"); -function _nonIterableSpread$5() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableSpread$5, "_nonIterableSpread$5"); -function _unsupportedIterableToArray$6(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$6(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$6(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$6, "_unsupportedIterableToArray$6"); -function _iterableToArray$5(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$5, "_iterableToArray$5"); -function _arrayWithoutHoles$5(r) { - if (Array.isArray(r)) return _arrayLikeToArray$6(r); -} -__name(_arrayWithoutHoles$5, "_arrayWithoutHoles$5"); -function _arrayLikeToArray$6(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; -} -__name(_arrayLikeToArray$6, "_arrayLikeToArray$6"); -var script$s = { - name: "OrderList", - "extends": script$1$g, - inheritAttrs: false, - emits: ["update:modelValue", "reorder", "update:selection", "selection-change", "focus", "blur"], - itemTouched: false, - reorderDirection: null, - styleElement: null, - list: null, - data: /* @__PURE__ */ __name(function data22() { - return { - id: this.$attrs.id, - d_selection: this.selection - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId8(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId") - }, - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount10() { - this.destroyStyle(); - }, "beforeUnmount"), - updated: /* @__PURE__ */ __name(function updated5() { - if (this.reorderDirection) { - this.updateListScroll(); - this.reorderDirection = null; - } - }, "updated"), - mounted: /* @__PURE__ */ __name(function mounted24() { - this.id = this.id || UniqueComponentId(); - if (this.responsive) { - this.createStyle(); - } - }, "mounted"), - methods: { - updateSelection: /* @__PURE__ */ __name(function updateSelection(event2) { - this.$emit("update:selection", this.d_selection); - this.$emit("selection-change", { - originalEvent: event2, - value: this.d_selection - }); - }, "updateSelection"), - onChangeSelection: /* @__PURE__ */ __name(function onChangeSelection(params) { - this.d_selection = params.value; - this.updateSelection(params.event); - }, "onChangeSelection"), - onListFocus: /* @__PURE__ */ __name(function onListFocus3(event2) { - this.$emit("focus", event2); - }, "onListFocus"), - onListBlur: /* @__PURE__ */ __name(function onListBlur3(event2) { - this.$emit("blur", event2); - }, "onListBlur"), - onReorderUpdate: /* @__PURE__ */ __name(function onReorderUpdate(event2, value2) { - this.$emit("update:modelValue", value2); - this.$emit("reorder", { - originalEvent: event2, - value: value2, - direction: this.reorderDirection - }); - }, "onReorderUpdate"), - moveUp: /* @__PURE__ */ __name(function moveUp(event2) { - if (this.d_selection) { - var value2 = _toConsumableArray$5(this.modelValue); - for (var i = 0; i < this.d_selection.length; i++) { - var selectedItem = this.d_selection[i]; - var selectedItemIndex = findIndexInList(selectedItem, value2); - if (selectedItemIndex !== 0) { - var movedItem = value2[selectedItemIndex]; - var temp = value2[selectedItemIndex - 1]; - value2[selectedItemIndex - 1] = movedItem; - value2[selectedItemIndex] = temp; - } else { - break; - } - } - this.reorderDirection = "up"; - this.onReorderUpdate(event2, value2); - } - }, "moveUp"), - moveTop: /* @__PURE__ */ __name(function moveTop(event2) { - if (this.d_selection) { - var value2 = _toConsumableArray$5(this.modelValue); - for (var i = 0; i < this.d_selection.length; i++) { - var selectedItem = this.d_selection[i]; - var selectedItemIndex = findIndexInList(selectedItem, value2); - if (selectedItemIndex !== 0) { - var movedItem = value2.splice(selectedItemIndex, 1)[0]; - value2.unshift(movedItem); - } else { - break; - } - } - this.reorderDirection = "top"; - this.onReorderUpdate(event2, value2); - } - }, "moveTop"), - moveDown: /* @__PURE__ */ __name(function moveDown(event2) { - if (this.d_selection) { - var value2 = _toConsumableArray$5(this.modelValue); - for (var i = this.d_selection.length - 1; i >= 0; i--) { - var selectedItem = this.d_selection[i]; - var selectedItemIndex = findIndexInList(selectedItem, value2); - if (selectedItemIndex !== value2.length - 1) { - var movedItem = value2[selectedItemIndex]; - var temp = value2[selectedItemIndex + 1]; - value2[selectedItemIndex + 1] = movedItem; - value2[selectedItemIndex] = temp; - } else { - break; - } - } - this.reorderDirection = "down"; - this.onReorderUpdate(event2, value2); - } - }, "moveDown"), - moveBottom: /* @__PURE__ */ __name(function moveBottom(event2) { - if (this.d_selection) { - var value2 = _toConsumableArray$5(this.modelValue); - for (var i = this.d_selection.length - 1; i >= 0; i--) { - var selectedItem = this.d_selection[i]; - var selectedItemIndex = findIndexInList(selectedItem, value2); - if (selectedItemIndex !== value2.length - 1) { - var movedItem = value2.splice(selectedItemIndex, 1)[0]; - value2.push(movedItem); - } else { - break; - } - } - this.reorderDirection = "bottom"; - this.onReorderUpdate(event2, value2); - } - }, "moveBottom"), - updateListScroll: /* @__PURE__ */ __name(function updateListScroll() { - this.list = findSingle(this.$refs.listbox.$el, '[data-pc-section="list"]'); - var listItems = find(this.list, '[data-pc-section="item"][data-p-selected="true"]'); - if (listItems && listItems.length) { - switch (this.reorderDirection) { - case "up": - scrollInView(this.list, listItems[0]); - break; - case "top": - this.list.scrollTop = 0; - break; - case "down": - scrollInView(this.list, listItems[listItems.length - 1]); - break; - case "bottom": - this.list.scrollTop = this.list.scrollHeight; - break; - } - } - }, "updateListScroll"), - createStyle: /* @__PURE__ */ __name(function createStyle() { - if (!this.styleElement && !this.isUnstyled) { - var _this$$primevue; - this.styleElement = document.createElement("style"); - this.styleElement.type = "text/css"; - 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); - document.head.appendChild(this.styleElement); - var innerHTML = "\n@media screen and (max-width: ".concat(this.breakpoint, ") {\n .p-orderlist[").concat(this.$attrSelector, "] {\n flex-direction: column;\n }\n\n .p-orderlist[").concat(this.$attrSelector, "] .p-orderlist-controls {\n flex-direction: row;\n }\n}\n"); - this.styleElement.innerHTML = innerHTML; - } - }, "createStyle"), - destroyStyle: /* @__PURE__ */ __name(function destroyStyle() { - if (this.styleElement) { - document.head.removeChild(this.styleElement); - this.styleElement = null; - } - }, "destroyStyle"), - moveDisabled: /* @__PURE__ */ __name(function moveDisabled() { - return this.disabled ? true : !this.d_selection || !this.d_selection.length ? true : false; - }, "moveDisabled") - }, - computed: { - moveUpAriaLabel: /* @__PURE__ */ __name(function moveUpAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveUp : void 0; - }, "moveUpAriaLabel"), - moveTopAriaLabel: /* @__PURE__ */ __name(function moveTopAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveTop : void 0; - }, "moveTopAriaLabel"), - moveDownAriaLabel: /* @__PURE__ */ __name(function moveDownAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveDown : void 0; - }, "moveDownAriaLabel"), - moveBottomAriaLabel: /* @__PURE__ */ __name(function moveBottomAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveBottom : void 0; - }, "moveBottomAriaLabel"), - hasSelectedOption: /* @__PURE__ */ __name(function hasSelectedOption3() { - return isNotEmpty(this.d_selection); - }, "hasSelectedOption") - }, - components: { - Listbox: script$1N, - Button: script$1d, - AngleUpIcon: script$1O, - AngleDownIcon: script$1G, - AngleDoubleUpIcon: script$t, - AngleDoubleDownIcon: script$u - }, - directives: { - ripple: Ripple - } -}; -function _typeof$d(o) { - "@babel/helpers - typeof"; - return _typeof$d = "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$d(o); -} -__name(_typeof$d, "_typeof$d"); -function ownKeys$c(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$c, "ownKeys$c"); -function _objectSpread$c(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$c(Object(t2), true).forEach(function(r2) { - _defineProperty$d(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$c(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$c, "_objectSpread$c"); -function _defineProperty$d(e, r, t2) { - return (r = _toPropertyKey$d(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$d, "_defineProperty$d"); -function _toPropertyKey$d(t2) { - var i = _toPrimitive$d(t2, "string"); - return "symbol" == _typeof$d(i) ? i : i + ""; -} -__name(_toPropertyKey$d, "_toPropertyKey$d"); -function _toPrimitive$d(t2, r) { - if ("object" != _typeof$d(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$d(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$d, "_toPrimitive$d"); -function render$o(_ctx, _cache, $props, $setup, $data, $options) { - var _component_AngleUpIcon = resolveComponent("AngleUpIcon"); - var _component_Button = resolveComponent("Button"); - var _component_AngleDoubleUpIcon = resolveComponent("AngleDoubleUpIcon"); - var _component_AngleDownIcon = resolveComponent("AngleDownIcon"); - var _component_AngleDoubleDownIcon = resolveComponent("AngleDoubleDownIcon"); - var _component_Listbox = resolveComponent("Listbox"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("controls") - }, _ctx.ptm("controls")), [renderSlot(_ctx.$slots, "controlsstart"), createVNode(_component_Button, mergeProps({ - onClick: $options.moveUp, - "aria-label": $options.moveUpAriaLabel, - disabled: $options.moveDisabled() - }, _objectSpread$c(_objectSpread$c({}, _ctx.buttonProps), _ctx.moveUpButtonProps), { - pt: _ctx.ptm("pcMoveUpButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "moveupicon", {}, function() { - return [createVNode(_component_AngleUpIcon, mergeProps(_ctx.ptm("pcMoveUpButton")["icon"], { - "data-pc-section": "moveupicon" - }), null, 16)]; - })]; - }), - _: 3 - }, 16, ["onClick", "aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ - onClick: $options.moveTop, - "aria-label": $options.moveTopAriaLabel, - disabled: $options.moveDisabled() - }, _objectSpread$c(_objectSpread$c({}, _ctx.buttonProps), _ctx.moveTopButtonProps), { - pt: _ctx.ptm("pcMoveTopButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "movetopicon", {}, function() { - return [createVNode(_component_AngleDoubleUpIcon, mergeProps(_ctx.ptm("pcMoveTopButton")["icon"], { - "data-pc-section": "movetopicon" - }), null, 16)]; - })]; - }), - _: 3 - }, 16, ["onClick", "aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ - onClick: $options.moveDown, - "aria-label": $options.moveDownAriaLabel, - disabled: $options.moveDisabled() - }, _objectSpread$c(_objectSpread$c({}, _ctx.buttonProps), _ctx.moveDownButtonProps), { - pt: _ctx.ptm("pcMoveDownButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "movedownicon", {}, function() { - return [createVNode(_component_AngleDownIcon, mergeProps(_ctx.ptm("pcMoveDownButton")["icon"], { - "data-pc-section": "movedownicon" - }), null, 16)]; - })]; - }), - _: 3 - }, 16, ["onClick", "aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ - onClick: $options.moveBottom, - "aria-label": $options.moveBottomAriaLabel, - disabled: $options.moveDisabled() - }, _objectSpread$c(_objectSpread$c({}, _ctx.buttonProps), _ctx.moveBottomButtonProps), { - pt: _ctx.ptm("pcMoveBottomButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "movebottomicon", {}, function() { - return [createVNode(_component_AngleDoubleDownIcon, mergeProps(_ctx.ptm("pcMoveBottomButton")["icon"], { - "data-pc-section": "movebottomicon" - }), null, 16)]; - })]; - }), - _: 3 - }, 16, ["onClick", "aria-label", "disabled", "pt", "unstyled"]), renderSlot(_ctx.$slots, "controlsend")], 16), createVNode(_component_Listbox, { - ref: "listbox", - id: $data.id, - modelValue: $data.d_selection, - options: _ctx.modelValue, - multiple: "", - metaKeySelection: _ctx.metaKeySelection, - listStyle: _ctx.listStyle, - scrollHeight: _ctx.scrollHeight, - tabindex: _ctx.tabindex, - dataKey: _ctx.dataKey, - autoOptionFocus: _ctx.autoOptionFocus, - focusOnHover: _ctx.focusOnHover, - striped: _ctx.striped, - disabled: _ctx.disabled, - ariaLabel: _ctx.ariaLabel, - ariaLabelledby: _ctx.ariaLabelledby, - pt: _ctx.ptm("pcListbox"), - unstyled: _ctx.unstyled, - onFocus: $options.onListFocus, - onBlur: $options.onListBlur, - onChange: $options.onChangeSelection - }, createSlots({ - option: withCtx(function(_ref) { - var option4 = _ref.option, selected3 = _ref.selected, index = _ref.index; - return [renderSlot(_ctx.$slots, _ctx.$slots.option ? "option" : "item", { - item: option4, - option: option4, - selected: selected3, - index - })]; - }), - _: 2 - }, [_ctx.$slots.header ? { - name: "header", - fn: withCtx(function() { - return [renderSlot(_ctx.$slots, "header")]; - }), - key: "0" - } : void 0]), 1032, ["id", "modelValue", "options", "metaKeySelection", "listStyle", "scrollHeight", "tabindex", "dataKey", "autoOptionFocus", "focusOnHover", "striped", "disabled", "ariaLabel", "ariaLabelledby", "pt", "unstyled", "onFocus", "onBlur", "onChange"])], 16); -} -__name(render$o, "render$o"); -script$s.render = render$o; -var theme$e = /* @__PURE__ */ __name(function theme25(_ref) { - var dt = _ref.dt; - return "\n.p-organizationchart-table {\n border-spacing: 0;\n border-collapse: separate;\n margin: 0 auto;\n}\n\n.p-organizationchart-table > tbody > tr > td {\n text-align: center;\n vertical-align: top;\n padding: 0 ".concat(dt("organizationchart.gutter"), ";\n}\n\n.p-organizationchart-node {\n display: inline-block;\n position: relative;\n border: 1px solid ").concat(dt("organizationchart.node.border.color"), ";\n background: ").concat(dt("organizationchart.node.background"), ";\n color: ").concat(dt("organizationchart.node.color"), ";\n padding: ").concat(dt("organizationchart.node.padding"), ";\n border-radius: ").concat(dt("organizationchart.node.border.radius"), ";\n transition: background ").concat(dt("organizationchart.transition.duration"), ", border-color ").concat(dt("organizationchart.transition.duration"), ", color ").concat(dt("organizationchart.transition.duration"), ", box-shadow ").concat(dt("organizationchart.transition.duration"), ";\n}\n\n.p-organizationchart-node:has(.p-organizationchart-node-toggle-button) {\n padding: ").concat(dt("organizationchart.node.toggleable.padding"), ";\n}\n\n.p-organizationchart-node.p-organizationchart-node-selectable:not(.p-organizationchart-node-selected):hover {\n background: ").concat(dt("organizationchart.node.hover.background"), ";\n color: ").concat(dt("organizationchart.node.hover.color"), ";\n}\n\n.p-organizationchart-node-selected {\n background: ").concat(dt("organizationchart.node.selected.background"), ";\n color: ").concat(dt("organizationchart.node.selected.color"), ";\n}\n\n.p-organizationchart-node-toggle-button {\n position: absolute;\n inset-block-end: calc(-1 * calc(").concat(dt("organizationchart.node.toggle.button.size"), " / 2));\n margin-inline-start: calc(-1 * calc(").concat(dt("organizationchart.node.toggle.button.size"), " / 2));\n z-index: 2;\n inset-inline-start: 50%;\n user-select: none;\n cursor: pointer;\n width: ").concat(dt("organizationchart.node.toggle.button.size"), ";\n height: ").concat(dt("organizationchart.node.toggle.button.size"), ";\n text-decoration: none;\n background: ").concat(dt("organizationchart.node.toggle.button.background"), ";\n color: ").concat(dt("organizationchart.node.toggle.button.color"), ";\n border-radius: ").concat(dt("organizationchart.node.toggle.button.border.radius"), ";\n border: 1px solid ").concat(dt("organizationchart.node.toggle.button.border.color"), ";\n display: inline-flex;\n justify-content: center;\n align-items: center;\n outline-color: transparent;\n transition: background ").concat(dt("organizationchart.transition.duration"), ", color ").concat(dt("organizationchart.transition.duration"), ", border-color ").concat(dt("organizationchart.transition.duration"), ", outline-color ").concat(dt("organizationchart.transition.duration"), ", box-shadow ").concat(dt("organizationchart.transition.duration"), ";\n}\n\n.p-organizationchart-node-toggle-button:hover {\n background: ").concat(dt("organizationchart.node.toggle.button.hover.background"), ";\n color: ").concat(dt("organizationchart.node.toggle.button.hover.color"), ";\n}\n\n.p-organizationchart-node-toggle-button:focus-visible {\n box-shadow: ").concat(dt("breadcrumb.item.focus.ring.shadow"), ";\n outline: ").concat(dt("breadcrumb.item.focus.ring.width"), " ").concat(dt("breadcrumb.item.focus.ring.style"), " ").concat(dt("breadcrumb.item.focus.ring.color"), ";\n outline-offset: ").concat(dt("breadcrumb.item.focus.ring.offset"), ";\n}\n\n.p-organizationchart-node-toggle-button-icon {\n position: relative;\n inset-block-start: 1px;\n}\n\n.p-organizationchart-connector-down {\n margin: 0 auto;\n height: ").concat(dt("organizationchart.connector.height"), ";\n width: 1px;\n background: ").concat(dt("organizationchart.connector.color"), ";\n}\n\n.p-organizationchart-connector-right {\n border-radius: 0;\n}\n\n.p-organizationchart-connector-left {\n border-radius: 0;\n border-inline-end: 1px solid ").concat(dt("organizationchart.connector.color"), ";\n}\n\n.p-organizationchart-connector-top {\n border-block-start: 1px solid ").concat(dt("organizationchart.connector.color"), ";\n}\n\n.p-organizationchart-node-selectable {\n cursor: pointer;\n}\n\n.p-organizationchart-connectors :nth-child(1 of .p-organizationchart-connector-left) {\n border-inline-end: 0 none;\n}\n\n.p-organizationchart-connectors :nth-last-child(1 of .p-organizationchart-connector-left) {\n border-start-end-radius: ").concat(dt("organizationchart.connector.border.radius"), ";\n}\n\n.p-organizationchart-connectors :nth-child(1 of .p-organizationchart-connector-right) {\n border-inline-start: 1px solid ").concat(dt("organizationchart.connector.color"), ";\n border-start-start-radius: ").concat(dt("organizationchart.connector.border.radius"), ";\n}\n"); -}, "theme"); -var classes$f = { - root: "p-organizationchart p-component", - table: "p-organizationchart-table", - node: /* @__PURE__ */ __name(function node(_ref2) { - var instance = _ref2.instance; - return ["p-organizationchart-node", { - "p-organizationchart-node-selectable": instance.selectable, - "p-organizationchart-node-selected": instance.selected - }]; - }, "node"), - nodeToggleButton: "p-organizationchart-node-toggle-button", - nodeToggleButtonIcon: "p-organizationchart-node-toggle-button-icon", - connectors: "p-organizationchart-connectors", - connectorDown: "p-organizationchart-connector-down", - connectorLeft: /* @__PURE__ */ __name(function connectorLeft(_ref3) { - var index = _ref3.index; - return ["p-organizationchart-connector-left", { - "p-organizationchart-connector-top": !(index === 0) - }]; - }, "connectorLeft"), - connectorRight: /* @__PURE__ */ __name(function connectorRight(_ref4) { - var props = _ref4.props, index = _ref4.index; - return ["p-organizationchart-connector-right", { - "p-organizationchart-connector-top": !(index === props.node.children.length - 1) - }]; - }, "connectorRight"), - nodeChildren: "p-organizationchart-node-children" -}; -var OrganizationChartStyle = BaseStyle.extend({ - name: "organizationchart", - theme: theme$e, - classes: classes$f -}); -var script$2$2 = { - name: "BaseOrganizationChart", - "extends": script$1f, - props: { - value: { - type: null, - "default": null - }, - selectionKeys: { - type: null, - "default": null - }, - selectionMode: { - type: String, - "default": null - }, - collapsible: { - type: Boolean, - "default": false - }, - collapsedKeys: { - type: null, - "default": null - } - }, - style: OrganizationChartStyle, - provide: /* @__PURE__ */ __name(function provide35() { - return { - $pcOrganizationChart: this, - $parentInstance: this - }; - }, "provide") -}; -var script$1$f = { - name: "OrganizationChartNode", - hostName: "OrganizationChart", - "extends": script$1f, - emits: ["node-click", "node-toggle"], - props: { - node: { - type: null, - "default": null - }, - templates: { - type: null, - "default": null - }, - collapsible: { - type: Boolean, - "default": false - }, - collapsedKeys: { - type: null, - "default": null - }, - selectionKeys: { - type: null, - "default": null - }, - selectionMode: { - type: String, - "default": null - } - }, - methods: { - getPTOptions: /* @__PURE__ */ __name(function getPTOptions6(key) { - return this.ptm(key, { - context: { - expanded: this.expanded, - selectable: this.selectable, - selected: this.selected, - toggleable: this.toggleable, - active: this.selected - } - }); - }, "getPTOptions"), - getNodeOptions: /* @__PURE__ */ __name(function getNodeOptions(lineTop, key) { - return this.ptm(key, { - context: { - lineTop - } - }); - }, "getNodeOptions"), - onNodeClick: /* @__PURE__ */ __name(function onNodeClick(event2) { - if (isAttributeEquals(event2.target, "data-pc-section", "nodetogglebutton") || isAttributeEquals(event2.target, "data-pc-section", "nodetogglebuttonicon")) { - return; - } - if (this.selectionMode) { - this.$emit("node-click", this.node); - } - }, "onNodeClick"), - onChildNodeClick: /* @__PURE__ */ __name(function onChildNodeClick(node2) { - this.$emit("node-click", node2); - }, "onChildNodeClick"), - toggleNode: /* @__PURE__ */ __name(function toggleNode() { - this.$emit("node-toggle", this.node); - }, "toggleNode"), - onChildNodeToggle: /* @__PURE__ */ __name(function onChildNodeToggle(node2) { - this.$emit("node-toggle", node2); - }, "onChildNodeToggle"), - onKeydown: /* @__PURE__ */ __name(function onKeydown3(event2) { - if (event2.code === "Enter" || event2.code === "NumpadEnter" || event2.code === "Space") { - this.toggleNode(); - event2.preventDefault(); - } - }, "onKeydown") - }, - computed: { - leaf: /* @__PURE__ */ __name(function leaf() { - return this.node.leaf === false ? false : !(this.node.children && this.node.children.length); - }, "leaf"), - colspan: /* @__PURE__ */ __name(function colspan() { - return this.node.children && this.node.children.length ? this.node.children.length * 2 : null; - }, "colspan"), - childStyle: /* @__PURE__ */ __name(function childStyle() { - return { - visibility: !this.leaf && this.expanded ? "inherit" : "hidden" - }; - }, "childStyle"), - expanded: /* @__PURE__ */ __name(function expanded() { - return this.collapsedKeys[this.node.key] === void 0; - }, "expanded"), - selectable: /* @__PURE__ */ __name(function selectable() { - return this.selectionMode && this.node.selectable !== false; - }, "selectable"), - selected: /* @__PURE__ */ __name(function selected() { - return this.selectable && this.selectionKeys && this.selectionKeys[this.node.key] === true; - }, "selected"), - toggleable: /* @__PURE__ */ __name(function toggleable() { - return this.collapsible && this.node.collapsible !== false && !this.leaf; - }, "toggleable") - }, - components: { - ChevronDownIcon: script$1h, - ChevronUpIcon: script$1g - } -}; -var _hoisted_1$e = ["colspan"]; -var _hoisted_2$a = ["colspan"]; -var _hoisted_3$7 = ["colspan"]; -function render$1$2(_ctx, _cache, $props, $setup, $data, $options) { - var _component_OrganizationChartNode = resolveComponent("OrganizationChartNode", true); - return openBlock(), createElementBlock("table", mergeProps({ - "class": _ctx.cx("table") - }, _ctx.ptm("table")), [createBaseVNode("tbody", normalizeProps(guardReactiveProps(_ctx.ptm("body"))), [$props.node ? (openBlock(), createElementBlock("tr", normalizeProps(mergeProps({ - key: 0 - }, _ctx.ptm("row"))), [createBaseVNode("td", mergeProps({ - colspan: $options.colspan - }, _ctx.ptm("cell")), [createBaseVNode("div", mergeProps({ - "class": [_ctx.cx("node"), $props.node.styleClass], - onClick: _cache[2] || (_cache[2] = function() { - return $options.onNodeClick && $options.onNodeClick.apply($options, arguments); - }) - }, $options.getPTOptions("node")), [(openBlock(), createBlock(resolveDynamicComponent($props.templates[$props.node.type] || $props.templates["default"]), { - node: $props.node - }, null, 8, ["node"])), $options.toggleable ? (openBlock(), createElementBlock("a", mergeProps({ - key: 0, - tabindex: "0", - "class": _ctx.cx("nodeToggleButton"), - onClick: _cache[0] || (_cache[0] = function() { - return $options.toggleNode && $options.toggleNode.apply($options, arguments); - }), - onKeydown: _cache[1] || (_cache[1] = function() { - return $options.onKeydown && $options.onKeydown.apply($options, arguments); - }) - }, $options.getPTOptions("nodeToggleButton")), [$props.templates.toggleicon || $props.templates.togglericon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.toggleicon || $props.templates.togglericon), mergeProps({ - key: 0, - expanded: $options.expanded, - "class": _ctx.cx("nodeToggleButtonIcon") - }, $options.getPTOptions("nodeToggleButtonIcon")), null, 16, ["expanded", "class"])) : (openBlock(), createBlock(resolveDynamicComponent($options.expanded ? "ChevronDownIcon" : "ChevronUpIcon"), mergeProps({ - key: 1, - "class": _ctx.cx("nodeToggleButtonIcon") - }, $options.getPTOptions("nodeToggleButtonIcon")), null, 16, ["class"]))], 16)) : createCommentVNode("", true)], 16)], 16, _hoisted_1$e)], 16)) : createCommentVNode("", true), createBaseVNode("tr", mergeProps({ - style: $options.childStyle, - "class": _ctx.cx("connectors") - }, _ctx.ptm("connectors")), [createBaseVNode("td", mergeProps({ - colspan: $options.colspan - }, _ctx.ptm("lineCell")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("connectorDown") - }, _ctx.ptm("connectorDown")), null, 16)], 16, _hoisted_2$a)], 16), createBaseVNode("tr", mergeProps({ - style: $options.childStyle, - "class": _ctx.cx("connectors") - }, _ctx.ptm("connectors")), [$props.node.children && $props.node.children.length === 1 ? (openBlock(), createElementBlock("td", mergeProps({ - key: 0, - colspan: $options.colspan - }, _ctx.ptm("lineCell")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("connectorDown") - }, _ctx.ptm("connectorDown")), null, 16)], 16, _hoisted_3$7)) : createCommentVNode("", true), $props.node.children && $props.node.children.length > 1 ? (openBlock(true), createElementBlock(Fragment, { - key: 1 - }, renderList($props.node.children, function(child, i) { - return openBlock(), createElementBlock(Fragment, { - key: child.key - }, [createBaseVNode("td", mergeProps({ - "class": _ctx.cx("connectorLeft", { - index: i - }), - ref_for: true - }, $options.getNodeOptions(!(i === 0), "connectorLeft")), " ", 16), createBaseVNode("td", mergeProps({ - "class": _ctx.cx("connectorRight", { - index: i - }), - ref_for: true - }, $options.getNodeOptions(!(i === $props.node.children.length - 1), "connectorRight")), " ", 16)], 64); - }), 128)) : createCommentVNode("", true)], 16), createBaseVNode("tr", mergeProps({ - style: $options.childStyle, - "class": _ctx.cx("nodeChildren") - }, _ctx.ptm("nodeChildren")), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.node.children, function(child) { - return openBlock(), createElementBlock("td", mergeProps({ - key: child.key, - colspan: "2", - ref_for: true - }, _ctx.ptm("nodeCell")), [createVNode(_component_OrganizationChartNode, { - node: child, - templates: $props.templates, - collapsedKeys: $props.collapsedKeys, - onNodeToggle: $options.onChildNodeToggle, - collapsible: $props.collapsible, - selectionMode: $props.selectionMode, - selectionKeys: $props.selectionKeys, - onNodeClick: $options.onChildNodeClick, - pt: _ctx.pt, - unstyled: _ctx.unstyled - }, null, 8, ["node", "templates", "collapsedKeys", "onNodeToggle", "collapsible", "selectionMode", "selectionKeys", "onNodeClick", "pt", "unstyled"])], 16); - }), 128))], 16)], 16)], 16); -} -__name(render$1$2, "render$1$2"); -script$1$f.render = render$1$2; -function _typeof$c(o) { - "@babel/helpers - typeof"; - return _typeof$c = "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$c(o); -} -__name(_typeof$c, "_typeof$c"); -function ownKeys$b(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$b, "ownKeys$b"); -function _objectSpread$b(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$b(Object(t2), true).forEach(function(r2) { - _defineProperty$c(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$b(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$b, "_objectSpread$b"); -function _defineProperty$c(e, r, t2) { - return (r = _toPropertyKey$c(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$c, "_defineProperty$c"); -function _toPropertyKey$c(t2) { - var i = _toPrimitive$c(t2, "string"); - return "symbol" == _typeof$c(i) ? i : i + ""; -} -__name(_toPropertyKey$c, "_toPropertyKey$c"); -function _toPrimitive$c(t2, r) { - if ("object" != _typeof$c(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$c(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$c, "_toPrimitive$c"); -var script$r = { - name: "OrganizationChart", - "extends": script$2$2, - inheritAttrs: false, - emits: ["node-unselect", "node-select", "update:selectionKeys", "node-expand", "node-collapse", "update:collapsedKeys"], - data: /* @__PURE__ */ __name(function data23() { - return { - d_collapsedKeys: this.collapsedKeys || {} - }; - }, "data"), - watch: { - collapsedKeys: /* @__PURE__ */ __name(function collapsedKeys(newValue) { - this.d_collapsedKeys = newValue; - }, "collapsedKeys") - }, - methods: { - onNodeClick: /* @__PURE__ */ __name(function onNodeClick2(node2) { - var key = node2.key; - if (this.selectionMode) { - var _selectionKeys = this.selectionKeys ? _objectSpread$b({}, this.selectionKeys) : {}; - if (_selectionKeys[key]) { - delete _selectionKeys[key]; - this.$emit("node-unselect", node2); - } else { - if (this.selectionMode === "single") { - _selectionKeys = {}; - } - _selectionKeys[key] = true; - this.$emit("node-select", node2); - } - this.$emit("update:selectionKeys", _selectionKeys); - } - }, "onNodeClick"), - onNodeToggle: /* @__PURE__ */ __name(function onNodeToggle(node2) { - var key = node2.key; - if (this.d_collapsedKeys[key]) { - delete this.d_collapsedKeys[key]; - this.$emit("node-expand", node2); - } else { - this.d_collapsedKeys[key] = true; - this.$emit("node-collapse", node2); - } - this.d_collapsedKeys = _objectSpread$b({}, this.d_collapsedKeys); - this.$emit("update:collapsedKeys", this.d_collapsedKeys); - }, "onNodeToggle") - }, - components: { - OrganizationChartNode: script$1$f - } -}; -function render$n(_ctx, _cache, $props, $setup, $data, $options) { - var _component_OrganizationChartNode = resolveComponent("OrganizationChartNode"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [createVNode(_component_OrganizationChartNode, { - node: _ctx.value, - templates: _ctx.$slots, - onNodeToggle: $options.onNodeToggle, - collapsedKeys: $data.d_collapsedKeys, - collapsible: _ctx.collapsible, - onNodeClick: $options.onNodeClick, - selectionMode: _ctx.selectionMode, - selectionKeys: _ctx.selectionKeys, - pt: _ctx.pt, - unstyled: _ctx.unstyled - }, null, 8, ["node", "templates", "onNodeToggle", "collapsedKeys", "collapsible", "onNodeClick", "selectionMode", "selectionKeys", "pt", "unstyled"])], 16); -} -__name(render$n, "render$n"); -script$r.render = render$n; -var script$q = { - name: "OverlayPanel", - "extends": script$1P, - mounted: /* @__PURE__ */ __name(function mounted25() { - console.warn("Deprecated since v4. Use Popover component instead."); - }, "mounted") -}; -var OverlayPanelStyle = BaseStyle.extend({ - name: "overlaypanel" -}); -var theme$d = /* @__PURE__ */ __name(function theme26(_ref) { - var dt = _ref.dt; - return "\n.p-panelmenu {\n display: flex;\n flex-direction: column;\n gap: ".concat(dt("panelmenu.gap"), ";\n}\n\n.p-panelmenu-panel {\n background: ").concat(dt("panelmenu.panel.background"), ";\n border-width: ").concat(dt("panelmenu.panel.border.width"), ";\n border-style: solid;\n border-color: ").concat(dt("panelmenu.panel.border.color"), ";\n color: ").concat(dt("panelmenu.panel.color"), ";\n border-radius: ").concat(dt("panelmenu.panel.border.radius"), ";\n padding: ").concat(dt("panelmenu.panel.padding"), ";\n}\n\n.p-panelmenu-panel:first-child {\n border-width: ").concat(dt("panelmenu.panel.first.border.width"), ";\n border-start-start-radius: ").concat(dt("panelmenu.panel.first.top.border.radius"), ";\n border-start-end-radius: ").concat(dt("panelmenu.panel.first.top.border.radius"), ";\n}\n\n.p-panelmenu-panel:last-child {\n border-width: ").concat(dt("panelmenu.panel.last.border.width"), ";\n border-end-start-radius: ").concat(dt("panelmenu.panel.last.bottom.border.radius"), ";\n border-end-end-radius: ").concat(dt("panelmenu.panel.last.bottom.border.radius"), ";\n}\n\n.p-panelmenu-header {\n outline: 0 none;\n}\n\n.p-panelmenu-header-content {\n border-radius: ").concat(dt("panelmenu.item.border.radius"), ";\n transition: background ").concat(dt("panelmenu.transition.duration"), ", color ").concat(dt("panelmenu.transition.duration"), ", outline-color ").concat(dt("panelmenu.transition.duration"), ", box-shadow ").concat(dt("panelmenu.transition.duration"), ";\n outline-color: transparent;\n color: ").concat(dt("panelmenu.item.color"), ";\n}\n\n.p-panelmenu-header-link {\n display: flex;\n gap: ").concat(dt("panelmenu.item.gap"), ";\n padding: ").concat(dt("panelmenu.item.padding"), ";\n align-items: center;\n user-select: none;\n cursor: pointer;\n position: relative;\n text-decoration: none;\n color: inherit;\n}\n\n.p-panelmenu-header-icon,\n.p-panelmenu-item-icon {\n color: ").concat(dt("panelmenu.item.icon.color"), ";\n}\n\n.p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.color"), ";\n}\n\n.p-panelmenu-submenu-icon:dir(rtl) {\n transform: rotate(180deg);\n}\n\n.p-panelmenu-header:not(.p-disabled):focus-visible .p-panelmenu-header-content {\n background: ").concat(dt("panelmenu.item.focus.background"), ";\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled):focus-visible .p-panelmenu-header-content .p-panelmenu-header-icon {\n color: ").concat(dt("panelmenu.item.icon.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled):focus-visible .p-panelmenu-header-content .p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled) .p-panelmenu-header-content:hover {\n background: ").concat(dt("panelmenu.item.focus.background"), ";\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled) .p-panelmenu-header-content:hover .p-panelmenu-header-icon {\n color: ").concat(dt("panelmenu.item.icon.focus.color"), ";\n}\n\n.p-panelmenu-header:not(.p-disabled) .p-panelmenu-header-content:hover .p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.focus.color"), ";\n}\n\n.p-panelmenu-submenu {\n margin: 0;\n padding: 0 0 0 ").concat(dt("panelmenu.submenu.indent"), ";\n outline: 0;\n list-style: none;\n}\n\n.p-panelmenu-submenu:dir(rtl) {\n padding: 0 ").concat(dt("panelmenu.submenu.indent"), " 0 0;\n}\n\n.p-panelmenu-item-link {\n display: flex;\n gap: ").concat(dt("panelmenu.item.gap"), ";\n padding: ").concat(dt("panelmenu.item.padding"), ";\n align-items: center;\n user-select: none;\n cursor: pointer;\n text-decoration: none;\n color: inherit;\n position: relative;\n overflow: hidden;\n}\n\n.p-panelmenu-item-label {\n line-height: 1;\n}\n\n.p-panelmenu-item-content {\n border-radius: ").concat(dt("panelmenu.item.border.radius"), ";\n transition: background ").concat(dt("panelmenu.transition.duration"), ", color ").concat(dt("panelmenu.transition.duration"), ", outline-color ").concat(dt("panelmenu.transition.duration"), ", box-shadow ").concat(dt("panelmenu.transition.duration"), ";\n color: ").concat(dt("panelmenu.item.color"), ";\n outline-color: transparent;\n}\n\n.p-panelmenu-item.p-focus > .p-panelmenu-item-content {\n background: ").concat(dt("panelmenu.item.focus.background"), ";\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-item.p-focus > .p-panelmenu-item-content .p-panelmenu-item-icon {\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-item.p-focus > .p-panelmenu-item-content .p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.focus.color"), ";\n}\n\n.p-panelmenu-item:not(.p-disabled) > .p-panelmenu-item-content:hover {\n background: ").concat(dt("panelmenu.item.focus.background"), ";\n color: ").concat(dt("panelmenu.item.focus.color"), ";\n}\n\n.p-panelmenu-item:not(.p-disabled) > .p-panelmenu-item-content:hover .p-panelmenu-item-icon {\n color: ").concat(dt("panelmenu.item.icon.focus.color"), ";\n}\n\n.p-panelmenu-item:not(.p-disabled) > .p-panelmenu-item-content:hover .p-panelmenu-submenu-icon {\n color: ").concat(dt("panelmenu.submenu.icon.focus.color"), ";\n}\n"); -}, "theme"); -var classes$e = { - root: "p-panelmenu p-component", - panel: "p-panelmenu-panel", - header: /* @__PURE__ */ __name(function header(_ref2) { - var instance = _ref2.instance, item8 = _ref2.item; - return ["p-panelmenu-header", { - "p-panelmenu-header-active": instance.isItemActive(item8) && !!item8.items, - "p-disabled": instance.isItemDisabled(item8) - }]; - }, "header"), - headerContent: "p-panelmenu-header-content", - headerLink: "p-panelmenu-header-link", - headerIcon: "p-panelmenu-header-icon", - headerLabel: "p-panelmenu-header-label", - contentContainer: "p-panelmenu-content-container", - content: "p-panelmenu-content", - rootList: "p-panelmenu-root-list", - item: /* @__PURE__ */ __name(function item5(_ref3) { - var instance = _ref3.instance, processedItem = _ref3.processedItem; - return ["p-panelmenu-item", { - "p-focus": instance.isItemFocused(processedItem), - "p-disabled": instance.isItemDisabled(processedItem) - }]; - }, "item"), - itemContent: "p-panelmenu-item-content", - itemLink: "p-panelmenu-item-link", - itemIcon: "p-panelmenu-item-icon", - itemLabel: "p-panelmenu-item-label", - submenuIcon: "p-panelmenu-submenu-icon", - submenu: "p-panelmenu-submenu", - separator: "p-menuitem-separator" -}; -var PanelMenuStyle = BaseStyle.extend({ - name: "panelmenu", - theme: theme$d, - classes: classes$e -}); -var script$3$1 = { - name: "BasePanelMenu", - "extends": script$1f, - props: { - model: { - type: Array, - "default": null - }, - expandedKeys: { - type: Object, - "default": null - }, - multiple: { - type: Boolean, - "default": false - }, - tabindex: { - type: Number, - "default": 0 - } - }, - style: PanelMenuStyle, - provide: /* @__PURE__ */ __name(function provide36() { - return { - $pcPanelMenu: this, - $parentInstance: this - }; - }, "provide") -}; -var script$2$1 = { - name: "PanelMenuSub", - hostName: "PanelMenu", - "extends": script$1f, - emits: ["item-toggle", "item-mousemove"], - props: { - panelId: { - type: String, - "default": null - }, - focusedItemId: { - type: String, - "default": null - }, - items: { - type: Array, - "default": null - }, - level: { - type: Number, - "default": 0 - }, - templates: { - type: Object, - "default": null - }, - activeItemPath: { - type: Object, - "default": null - }, - tabindex: { - type: Number, - "default": -1 - } - }, - methods: { - getItemId: /* @__PURE__ */ __name(function getItemId3(processedItem) { - return "".concat(this.panelId, "_").concat(processedItem.key); - }, "getItemId"), - getItemKey: /* @__PURE__ */ __name(function getItemKey2(processedItem) { - return this.getItemId(processedItem); - }, "getItemKey"), - getItemProp: /* @__PURE__ */ __name(function getItemProp5(processedItem, name4, params) { - return processedItem && processedItem.item ? resolve(processedItem.item[name4], params) : void 0; - }, "getItemProp"), - getItemLabel: /* @__PURE__ */ __name(function getItemLabel3(processedItem) { - return this.getItemProp(processedItem, "label"); - }, "getItemLabel"), - getPTOptions: /* @__PURE__ */ __name(function getPTOptions7(key, processedItem, index) { - return this.ptm(key, { - context: { - item: processedItem.item, - index, - active: this.isItemActive(processedItem), - focused: this.isItemFocused(processedItem), - disabled: this.isItemDisabled(processedItem) - } - }); - }, "getPTOptions"), - isItemActive: /* @__PURE__ */ __name(function isItemActive4(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 isItemFocused3(processedItem) { - return this.focusedItemId === this.getItemId(processedItem); - }, "isItemFocused"), - isItemGroup: /* @__PURE__ */ __name(function isItemGroup3(processedItem) { - return isNotEmpty(processedItem.items); - }, "isItemGroup"), - onItemClick: /* @__PURE__ */ __name(function onItemClick5(event2, processedItem) { - this.getItemProp(processedItem, "command", { - originalEvent: event2, - item: processedItem.item - }); - this.$emit("item-toggle", { - processedItem, - expanded: !this.isItemActive(processedItem) - }); - }, "onItemClick"), - onItemToggle: /* @__PURE__ */ __name(function onItemToggle(event2) { - this.$emit("item-toggle", event2); - }, "onItemToggle"), - onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove2(event2, processedItem) { - this.$emit("item-mousemove", { - originalEvent: event2, - processedItem - }); - }, "onItemMouseMove"), - getAriaSetSize: /* @__PURE__ */ __name(function getAriaSetSize2() { - 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) { - 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 getMenuItemProps5(processedItem, index) { - return { - action: mergeProps({ - "class": this.cx("itemLink"), - tabindex: -1 - }, this.getPTOptions("itemLink", processedItem, index)), - icon: mergeProps({ - "class": [this.cx("itemIcon"), this.getItemProp(processedItem, "icon")] - }, this.getPTOptions("itemIcon", processedItem, index)), - label: mergeProps({ - "class": this.cx("itemLabel") - }, this.getPTOptions("itemLabel", processedItem, index)), - submenuicon: mergeProps({ - "class": this.cx("submenuIcon") - }, this.getPTOptions("submenuicon", processedItem, index)) - }; - }, "getMenuItemProps") - }, - components: { - ChevronRightIcon: script$1i, - ChevronDownIcon: script$1h - }, - directives: { - ripple: Ripple - } -}; -var _hoisted_1$1$2 = ["tabindex"]; -var _hoisted_2$1$1 = ["id", "aria-label", "aria-expanded", "aria-level", "aria-setsize", "aria-posinset", "data-p-focused", "data-p-disabled"]; -var _hoisted_3$1$1 = ["onClick", "onMousemove"]; -var _hoisted_4$1$1 = ["href", "target"]; -function render$2$1(_ctx, _cache, $props, $setup, $data, $options) { - var _component_PanelMenuSub = resolveComponent("PanelMenuSub", true); - var _directive_ripple = resolveDirective("ripple"); - return openBlock(), createElementBlock("ul", { - "class": normalizeClass(_ctx.cx("submenu")), - tabindex: $props.tabindex - }, [(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), - "class": [_ctx.cx("item", { - processedItem - }), $options.getItemProp(processedItem, "class")], - style: $options.getItemProp(processedItem, "style"), - role: "treeitem", - "aria-label": $options.getItemLabel(processedItem), - "aria-expanded": $options.isItemGroup(processedItem) ? $options.isItemActive(processedItem) : void 0, - "aria-level": $props.level + 1, - "aria-setsize": $options.getAriaSetSize(), - "aria-posinset": $options.getAriaPosInset(index), - ref_for: true - }, $options.getPTOptions("item", processedItem, index), { - "data-p-focused": $options.isItemFocused(processedItem), - "data-p-disabled": $options.isItemDisabled(processedItem) - }), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("itemContent"), - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return $options.onItemClick($event, processedItem); - }, "onClick"), - onMousemove: /* @__PURE__ */ __name(function onMousemove($event) { - return $options.onItemMouseMove($event, processedItem); - }, "onMousemove"), - ref_for: true - }, $options.getPTOptions("itemContent", processedItem, index)), [!$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("itemLink", processedItem, index)), [$options.isItemGroup(processedItem) ? (openBlock(), createElementBlock(Fragment, { - key: 0 - }, [$props.templates.submenuicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.submenuicon), mergeProps({ - key: 0, - "class": _ctx.cx("submenuIcon"), - active: $options.isItemActive(processedItem), - ref_for: true - }, $options.getPTOptions("submenuIcon", processedItem, index)), null, 16, ["class", "active"])) : (openBlock(), createBlock(resolveDynamicComponent($options.isItemActive(processedItem) ? "ChevronDownIcon" : "ChevronRightIcon"), mergeProps({ - key: 1, - "class": _ctx.cx("submenuIcon"), - ref_for: true - }, $options.getPTOptions("submenuIcon", processedItem, index)), null, 16, ["class"]))], 64)) : createCommentVNode("", true), $props.templates.itemicon ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.itemicon), { - key: 1, - item: processedItem.item, - "class": normalizeClass(_ctx.cx("itemIcon")) - }, null, 8, ["item", "class"])) : $options.getItemProp(processedItem, "icon") ? (openBlock(), createElementBlock("span", mergeProps({ - key: 2, - "class": [_ctx.cx("itemIcon"), $options.getItemProp(processedItem, "icon")], - ref_for: true - }, $options.getPTOptions("itemIcon", processedItem, index)), null, 16)) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ - "class": _ctx.cx("itemLabel"), - ref_for: true - }, $options.getPTOptions("itemLabel", processedItem, index)), toDisplayString($options.getItemLabel(processedItem)), 17)], 16, _hoisted_4$1$1)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.item), { - key: 1, - item: processedItem.item, - root: false, - active: $options.isItemActive(processedItem), - hasSubmenu: $options.isItemGroup(processedItem), - label: $options.getItemLabel(processedItem), - props: $options.getMenuItemProps(processedItem, index) - }, null, 8, ["item", "active", "hasSubmenu", "label", "props"]))], 16, _hoisted_3$1$1), createVNode(Transition, mergeProps({ - name: "p-toggleable-content", - ref_for: true - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [withDirectives(createBaseVNode("div", mergeProps({ - "class": _ctx.cx("contentContainer"), - ref_for: true - }, _ctx.ptm("contentContainer")), [$options.isItemVisible(processedItem) && $options.isItemGroup(processedItem) ? (openBlock(), createBlock(_component_PanelMenuSub, mergeProps({ - key: 0, - id: $options.getItemId(processedItem) + "_list", - role: "group", - panelId: $props.panelId, - focusedItemId: $props.focusedItemId, - items: processedItem.items, - level: $props.level + 1, - templates: $props.templates, - activeItemPath: $props.activeItemPath, - onItemToggle: $options.onItemToggle, - onItemMousemove: _cache[0] || (_cache[0] = function($event) { - return _ctx.$emit("item-mousemove", $event); - }), - pt: _ctx.pt, - unstyled: _ctx.unstyled, - ref_for: true - }, _ctx.ptm("submenu")), null, 16, ["id", "panelId", "focusedItemId", "items", "level", "templates", "activeItemPath", "onItemToggle", "pt", "unstyled"])) : createCommentVNode("", true)], 16), [[vShow, $options.isItemActive(processedItem)]])]; - }), - _: 2 - }, 1040)], 16, _hoisted_2$1$1)) : createCommentVNode("", true), $options.isItemVisible(processedItem) && $options.getItemProp(processedItem, "separator") ? (openBlock(), createElementBlock("li", mergeProps({ - key: 1, - style: $options.getItemProp(processedItem, "style"), - "class": [_ctx.cx("separator"), $options.getItemProp(processedItem, "class")], - role: "separator", - ref_for: true - }, _ctx.ptm("separator")), null, 16)) : createCommentVNode("", true)], 64); - }), 128))], 10, _hoisted_1$1$2); -} -__name(render$2$1, "render$2$1"); -script$2$1.render = render$2$1; -function _slicedToArray(r, e) { - return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$5(r, e) || _nonIterableRest(); -} -__name(_slicedToArray, "_slicedToArray"); -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableRest, "_nonIterableRest"); -function _unsupportedIterableToArray$5(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$5(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$5(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$5, "_unsupportedIterableToArray$5"); -function _arrayLikeToArray$5(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; -} -__name(_arrayLikeToArray$5, "_arrayLikeToArray$5"); -function _iterableToArrayLimit(r, l) { - var t2 = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; - if (null != t2) { - var e, n, i, u, a = [], f = true, o = false; - try { - if (i = (t2 = t2.call(r)).next, 0 === l) ; - else for (; !(f = (e = i.call(t2)).done) && (a.push(e.value), a.length !== l); f = true) ; - } catch (r2) { - o = true, n = r2; - } finally { - try { - if (!f && null != t2["return"] && (u = t2["return"](), Object(u) !== u)) return; - } finally { - if (o) throw n; - } - } - return a; - } -} -__name(_iterableToArrayLimit, "_iterableToArrayLimit"); -function _arrayWithHoles(r) { - if (Array.isArray(r)) return r; -} -__name(_arrayWithHoles, "_arrayWithHoles"); -var script$1$e = { - name: "PanelMenuList", - hostName: "PanelMenu", - "extends": script$1f, - emits: ["item-toggle", "header-focus"], - props: { - panelId: { - type: String, - "default": null - }, - items: { - type: Array, - "default": null - }, - templates: { - type: Object, - "default": null - }, - expandedKeys: { - type: Object, - "default": null - } - }, - searchTimeout: null, - searchValue: null, - data: /* @__PURE__ */ __name(function data24() { - return { - focused: false, - focusedItem: null, - activeItemPath: [] - }; - }, "data"), - watch: { - expandedKeys: /* @__PURE__ */ __name(function expandedKeys(newValue) { - this.autoUpdateActiveItemPath(newValue); - }, "expandedKeys") - }, - mounted: /* @__PURE__ */ __name(function mounted26() { - this.autoUpdateActiveItemPath(this.expandedKeys); - }, "mounted"), - methods: { - getItemProp: /* @__PURE__ */ __name(function getItemProp6(processedItem, name4) { - return processedItem && processedItem.item ? resolve(processedItem.item[name4]) : void 0; - }, "getItemProp"), - getItemLabel: /* @__PURE__ */ __name(function getItemLabel4(processedItem) { - return this.getItemProp(processedItem, "label"); - }, "getItemLabel"), - isItemVisible: /* @__PURE__ */ __name(function isItemVisible4(processedItem) { - return this.getItemProp(processedItem, "visible") !== false; - }, "isItemVisible"), - isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled4(processedItem) { - return this.getItemProp(processedItem, "disabled"); - }, "isItemDisabled"), - isItemActive: /* @__PURE__ */ __name(function isItemActive5(processedItem) { - return this.activeItemPath.some(function(path) { - return path.key === processedItem.parentKey; - }); - }, "isItemActive"), - isItemGroup: /* @__PURE__ */ __name(function isItemGroup4(processedItem) { - return isNotEmpty(processedItem.items); - }, "isItemGroup"), - onFocus: /* @__PURE__ */ __name(function onFocus10(event2) { - this.focused = true; - this.focusedItem = this.focusedItem || (this.isElementInPanel(event2, event2.relatedTarget) ? this.findFirstItem() : this.findLastItem()); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur10() { - this.focused = false; - this.focusedItem = null; - this.searchValue = ""; - }, "onBlur"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown10(event2) { - var metaKey = event2.metaKey || event2.ctrlKey; - switch (event2.code) { - case "ArrowDown": - this.onArrowDownKey(event2); - break; - case "ArrowUp": - this.onArrowUpKey(event2); - break; - case "ArrowLeft": - this.onArrowLeftKey(event2); - break; - case "ArrowRight": - this.onArrowRightKey(event2); - break; - case "Home": - this.onHomeKey(event2); - break; - case "End": - this.onEndKey(event2); - break; - case "Space": - this.onSpaceKey(event2); - break; - case "Enter": - case "NumpadEnter": - this.onEnterKey(event2); - break; - case "Escape": - case "Tab": - case "PageDown": - case "PageUp": - case "Backspace": - case "ShiftLeft": - case "ShiftRight": - break; - default: - if (!metaKey && isPrintableCharacter(event2.key)) { - this.searchItems(event2, event2.key); - } - break; - } - }, "onKeyDown"), - onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey7(event2) { - var processedItem = isNotEmpty(this.focusedItem) ? this.findNextItem(this.focusedItem) : this.findFirstItem(); - this.changeFocusedItem({ - originalEvent: event2, - processedItem, - focusOnNext: true - }); - event2.preventDefault(); - }, "onArrowDownKey"), - onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey7(event2) { - var processedItem = isNotEmpty(this.focusedItem) ? this.findPrevItem(this.focusedItem) : this.findLastItem(); - this.changeFocusedItem({ - originalEvent: event2, - processedItem, - selfCheck: true - }); - event2.preventDefault(); - }, "onArrowUpKey"), - onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey4(event2) { - var _this = this; - if (isNotEmpty(this.focusedItem)) { - var matched = this.activeItemPath.some(function(p) { - return p.key === _this.focusedItem.key; - }); - if (matched) { - this.activeItemPath = this.activeItemPath.filter(function(p) { - return p.key !== _this.focusedItem.key; - }); - } else { - this.focusedItem = isNotEmpty(this.focusedItem.parent) ? this.focusedItem.parent : this.focusedItem; - } - event2.preventDefault(); - } - }, "onArrowLeftKey"), - onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey3(event2) { - var _this2 = this; - if (isNotEmpty(this.focusedItem)) { - var grouped = this.isItemGroup(this.focusedItem); - if (grouped) { - var matched = this.activeItemPath.some(function(p) { - return p.key === _this2.focusedItem.key; - }); - if (matched) { - this.onArrowDownKey(event2); - } else { - this.activeItemPath = this.activeItemPath.filter(function(p) { - return p.parentKey !== _this2.focusedItem.parentKey; - }); - this.activeItemPath.push(this.focusedItem); - } - } - event2.preventDefault(); - } - }, "onArrowRightKey"), - onHomeKey: /* @__PURE__ */ __name(function onHomeKey7(event2) { - this.changeFocusedItem({ - originalEvent: event2, - processedItem: this.findFirstItem(), - allowHeaderFocus: false - }); - event2.preventDefault(); - }, "onHomeKey"), - onEndKey: /* @__PURE__ */ __name(function onEndKey7(event2) { - this.changeFocusedItem({ - originalEvent: event2, - processedItem: this.findLastItem(), - focusOnNext: true, - allowHeaderFocus: false - }); - event2.preventDefault(); - }, "onEndKey"), - onEnterKey: /* @__PURE__ */ __name(function onEnterKey6(event2) { - if (isNotEmpty(this.focusedItem)) { - var element = findSingle(this.$el, 'li[id="'.concat("".concat(this.focusedItemId), '"]')); - var anchorElement = element && (findSingle(element, '[data-pc-section="itemlink"]') || findSingle(element, "a,button")); - anchorElement ? anchorElement.click() : element && element.click(); - } - event2.preventDefault(); - }, "onEnterKey"), - onSpaceKey: /* @__PURE__ */ __name(function onSpaceKey5(event2) { - this.onEnterKey(event2); - }, "onSpaceKey"), - onItemToggle: /* @__PURE__ */ __name(function onItemToggle2(event2) { - var processedItem = event2.processedItem, expanded3 = event2.expanded; - if (this.expandedKeys) { - this.$emit("item-toggle", { - item: processedItem.item, - expanded: expanded3 - }); - } else { - this.activeItemPath = this.activeItemPath.filter(function(p) { - return p.parentKey !== processedItem.parentKey; - }); - expanded3 && this.activeItemPath.push(processedItem); - } - this.focusedItem = processedItem; - focus(this.$el); - }, "onItemToggle"), - onItemMouseMove: /* @__PURE__ */ __name(function onItemMouseMove3(event2) { - if (this.focused) { - this.focusedItem = event2.processedItem; - } - }, "onItemMouseMove"), - isElementInPanel: /* @__PURE__ */ __name(function isElementInPanel(event2, element) { - var panel2 = event2.currentTarget.closest('[data-pc-section="panel"]'); - return panel2 && panel2.contains(element); - }, "isElementInPanel"), - isItemMatched: /* @__PURE__ */ __name(function isItemMatched2(processedItem) { - var _this$getItemLabel; - return this.isValidItem(processedItem) && ((_this$getItemLabel = this.getItemLabel(processedItem)) === null || _this$getItemLabel === void 0 ? void 0 : _this$getItemLabel.toLocaleLowerCase(this.searchLocale).startsWith(this.searchValue.toLocaleLowerCase(this.searchLocale))); - }, "isItemMatched"), - isVisibleItem: /* @__PURE__ */ __name(function isVisibleItem(processedItem) { - return !!processedItem && (processedItem.level === 0 || this.isItemActive(processedItem)) && this.isItemVisible(processedItem); - }, "isVisibleItem"), - isValidItem: /* @__PURE__ */ __name(function isValidItem2(processedItem) { - return !!processedItem && !this.isItemDisabled(processedItem) && !this.getItemProp(processedItem, "separator"); - }, "isValidItem"), - findFirstItem: /* @__PURE__ */ __name(function findFirstItem() { - var _this3 = this; - return this.visibleItems.find(function(processedItem) { - return _this3.isValidItem(processedItem); - }); - }, "findFirstItem"), - findLastItem: /* @__PURE__ */ __name(function findLastItem() { - var _this4 = this; - return findLast(this.visibleItems, function(processedItem) { - return _this4.isValidItem(processedItem); - }); - }, "findLastItem"), - findNextItem: /* @__PURE__ */ __name(function findNextItem(processedItem) { - var _this5 = this; - var index = this.visibleItems.findIndex(function(item8) { - return item8.key === processedItem.key; - }); - var matchedItem = index < this.visibleItems.length - 1 ? this.visibleItems.slice(index + 1).find(function(pItem) { - return _this5.isValidItem(pItem); - }) : void 0; - return matchedItem || processedItem; - }, "findNextItem"), - findPrevItem: /* @__PURE__ */ __name(function findPrevItem(processedItem) { - var _this6 = this; - var index = this.visibleItems.findIndex(function(item8) { - return item8.key === processedItem.key; - }); - var matchedItem = index > 0 ? findLast(this.visibleItems.slice(0, index), function(pItem) { - return _this6.isValidItem(pItem); - }) : void 0; - return matchedItem || processedItem; - }, "findPrevItem"), - searchItems: /* @__PURE__ */ __name(function searchItems2(event2, _char) { - var _this7 = this; - this.searchValue = (this.searchValue || "") + _char; - var matchedItem = null; - var matched = false; - if (isNotEmpty(this.focusedItem)) { - var focusedItemIndex = this.visibleItems.findIndex(function(processedItem) { - return processedItem.key === _this7.focusedItem.key; - }); - matchedItem = this.visibleItems.slice(focusedItemIndex).find(function(processedItem) { - return _this7.isItemMatched(processedItem); - }); - matchedItem = isEmpty(matchedItem) ? this.visibleItems.slice(0, focusedItemIndex).find(function(processedItem) { - return _this7.isItemMatched(processedItem); - }) : matchedItem; - } else { - matchedItem = this.visibleItems.find(function(processedItem) { - return _this7.isItemMatched(processedItem); - }); - } - if (isNotEmpty(matchedItem)) { - matched = true; - } - if (isEmpty(matchedItem) && isEmpty(this.focusedItem)) { - matchedItem = this.findFirstItem(); - } - if (isNotEmpty(matchedItem)) { - this.changeFocusedItem({ - originalEvent: event2, - processedItem: matchedItem, - allowHeaderFocus: false - }); - } - if (this.searchTimeout) { - clearTimeout(this.searchTimeout); - } - this.searchTimeout = setTimeout(function() { - _this7.searchValue = ""; - _this7.searchTimeout = null; - }, 500); - return matched; - }, "searchItems"), - changeFocusedItem: /* @__PURE__ */ __name(function changeFocusedItem(event2) { - var originalEvent = event2.originalEvent, processedItem = event2.processedItem, focusOnNext = event2.focusOnNext, selfCheck = event2.selfCheck, _event$allowHeaderFoc = event2.allowHeaderFocus, allowHeaderFocus = _event$allowHeaderFoc === void 0 ? true : _event$allowHeaderFoc; - if (isNotEmpty(this.focusedItem) && this.focusedItem.key !== processedItem.key) { - this.focusedItem = processedItem; - this.scrollInView(); - } else if (allowHeaderFocus) { - this.$emit("header-focus", { - originalEvent, - focusOnNext, - selfCheck - }); - } - }, "changeFocusedItem"), - scrollInView: /* @__PURE__ */ __name(function scrollInView5() { - var element = findSingle(this.$el, 'li[id="'.concat("".concat(this.focusedItemId), '"]')); - if (element) { - element.scrollIntoView && element.scrollIntoView({ - block: "nearest", - inline: "start" - }); - } - }, "scrollInView"), - autoUpdateActiveItemPath: /* @__PURE__ */ __name(function autoUpdateActiveItemPath(expandedKeys4) { - var _this8 = this; - this.activeItemPath = Object.entries(expandedKeys4 || {}).reduce(function(acc, _ref) { - var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], val = _ref2[1]; - if (val) { - var processedItem = _this8.findProcessedItemByItemKey(key); - processedItem && acc.push(processedItem); - } - return acc; - }, []); - }, "autoUpdateActiveItemPath"), - findProcessedItemByItemKey: /* @__PURE__ */ __name(function findProcessedItemByItemKey(key, processedItems3) { - var level = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; - processedItems3 = processedItems3 || level === 0 && this.processedItems; - if (!processedItems3) return null; - for (var i = 0; i < processedItems3.length; i++) { - var processedItem = processedItems3[i]; - if (this.getItemProp(processedItem, "key") === key) return processedItem; - var matchedItem = this.findProcessedItemByItemKey(key, processedItem.items, level + 1); - if (matchedItem) return matchedItem; - } - }, "findProcessedItemByItemKey"), - createProcessedItems: /* @__PURE__ */ __name(function createProcessedItems2(items2) { - var _this9 = 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 = []; - items2 && items2.forEach(function(item8, index) { - var key = (parentKey !== "" ? parentKey + "_" : "") + index; - var newItem = { - item: item8, - index, - level, - key, - parent, - parentKey - }; - newItem["items"] = _this9.createProcessedItems(item8.items, level + 1, newItem, key); - processedItems3.push(newItem); - }); - return processedItems3; - }, "createProcessedItems"), - flatItems: /* @__PURE__ */ __name(function flatItems(processedItems3) { - var _this10 = this; - var processedFlattenItems = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; - processedItems3 && processedItems3.forEach(function(processedItem) { - if (_this10.isVisibleItem(processedItem)) { - processedFlattenItems.push(processedItem); - _this10.flatItems(processedItem.items, processedFlattenItems); - } - }); - return processedFlattenItems; - }, "flatItems") - }, - computed: { - processedItems: /* @__PURE__ */ __name(function processedItems2() { - return this.createProcessedItems(this.items || []); - }, "processedItems"), - visibleItems: /* @__PURE__ */ __name(function visibleItems2() { - return this.flatItems(this.processedItems); - }, "visibleItems"), - focusedItemId: /* @__PURE__ */ __name(function focusedItemId2() { - return isNotEmpty(this.focusedItem) ? "".concat(this.panelId, "_").concat(this.focusedItem.key) : null; - }, "focusedItemId") - }, - components: { - PanelMenuSub: script$2$1 - } -}; -function render$1$1(_ctx, _cache, $props, $setup, $data, $options) { - var _component_PanelMenuSub = resolveComponent("PanelMenuSub"); - return openBlock(), createBlock(_component_PanelMenuSub, mergeProps({ - id: $props.panelId + "_list", - "class": _ctx.cx("rootList"), - role: "tree", - tabindex: -1, - "aria-activedescendant": $data.focused ? $options.focusedItemId : void 0, - panelId: $props.panelId, - focusedItemId: $data.focused ? $options.focusedItemId : void 0, - items: $options.processedItems, - templates: $props.templates, - activeItemPath: $data.activeItemPath, - onFocus: $options.onFocus, - onBlur: $options.onBlur, - onKeydown: $options.onKeyDown, - onItemToggle: $options.onItemToggle, - onItemMousemove: $options.onItemMouseMove, - pt: _ctx.pt, - unstyled: _ctx.unstyled - }, _ctx.ptm("rootList")), null, 16, ["id", "class", "aria-activedescendant", "panelId", "focusedItemId", "items", "templates", "activeItemPath", "onFocus", "onBlur", "onKeydown", "onItemToggle", "onItemMousemove", "pt", "unstyled"]); -} -__name(render$1$1, "render$1$1"); -script$1$e.render = render$1$1; -function _typeof$b(o) { - "@babel/helpers - typeof"; - return _typeof$b = "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$b(o); -} -__name(_typeof$b, "_typeof$b"); -function ownKeys$a(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$a, "ownKeys$a"); -function _objectSpread$a(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$a(Object(t2), true).forEach(function(r2) { - _defineProperty$b(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$a(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$a, "_objectSpread$a"); -function _defineProperty$b(e, r, t2) { - return (r = _toPropertyKey$b(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$b, "_defineProperty$b"); -function _toPropertyKey$b(t2) { - var i = _toPrimitive$b(t2, "string"); - return "symbol" == _typeof$b(i) ? i : i + ""; -} -__name(_toPropertyKey$b, "_toPropertyKey$b"); -function _toPrimitive$b(t2, r) { - if ("object" != _typeof$b(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$b(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$b, "_toPrimitive$b"); -var script$p = { - name: "PanelMenu", - "extends": script$3$1, - inheritAttrs: false, - emits: ["update:expandedKeys", "panel-open", "panel-close"], - data: /* @__PURE__ */ __name(function data25() { - return { - id: this.$attrs.id, - activeItem: null, - activeItems: [] - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId9(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId") - }, - mounted: /* @__PURE__ */ __name(function mounted27() { - this.id = this.id || UniqueComponentId(); - }, "mounted"), - methods: { - getItemProp: /* @__PURE__ */ __name(function getItemProp7(item8, name4) { - return item8 ? resolve(item8[name4]) : void 0; - }, "getItemProp"), - getItemLabel: /* @__PURE__ */ __name(function getItemLabel5(item8) { - return this.getItemProp(item8, "label"); - }, "getItemLabel"), - getPTOptions: /* @__PURE__ */ __name(function getPTOptions8(key, item8, index) { - return this.ptm(key, { - context: { - index, - active: this.isItemActive(item8), - focused: this.isItemFocused(item8), - disabled: this.isItemDisabled(item8) - } - }); - }, "getPTOptions"), - isItemActive: /* @__PURE__ */ __name(function isItemActive6(item8) { - return this.expandedKeys ? this.expandedKeys[this.getItemProp(item8, "key")] : this.multiple ? this.activeItems.some(function(subItem) { - return equals(item8, subItem); - }) : equals(item8, this.activeItem); - }, "isItemActive"), - isItemVisible: /* @__PURE__ */ __name(function isItemVisible5(item8) { - return this.getItemProp(item8, "visible") !== false; - }, "isItemVisible"), - isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled5(item8) { - return this.getItemProp(item8, "disabled"); - }, "isItemDisabled"), - isItemFocused: /* @__PURE__ */ __name(function isItemFocused4(item8) { - return equals(item8, this.activeItem); - }, "isItemFocused"), - isItemGroup: /* @__PURE__ */ __name(function isItemGroup5(item8) { - return isNotEmpty(item8.items); - }, "isItemGroup"), - getPanelId: /* @__PURE__ */ __name(function getPanelId(index) { - return "".concat(this.id, "_").concat(index); - }, "getPanelId"), - getPanelKey: /* @__PURE__ */ __name(function getPanelKey(index) { - return this.getPanelId(index); - }, "getPanelKey"), - getHeaderId: /* @__PURE__ */ __name(function getHeaderId(index) { - return "".concat(this.getPanelId(index), "_header"); - }, "getHeaderId"), - getContentId: /* @__PURE__ */ __name(function getContentId(index) { - return "".concat(this.getPanelId(index), "_content"); - }, "getContentId"), - onHeaderClick: /* @__PURE__ */ __name(function onHeaderClick(event2, item8) { - if (this.isItemDisabled(item8)) { - event2.preventDefault(); - return; - } - if (item8.command) { - item8.command({ - originalEvent: event2, - item: item8 - }); - } - this.changeActiveItem(event2, item8); - focus(event2.currentTarget); - }, "onHeaderClick"), - onHeaderKeyDown: /* @__PURE__ */ __name(function onHeaderKeyDown(event2, item8) { - switch (event2.code) { - case "ArrowDown": - this.onHeaderArrowDownKey(event2); - break; - case "ArrowUp": - this.onHeaderArrowUpKey(event2); - break; - case "Home": - this.onHeaderHomeKey(event2); - break; - case "End": - this.onHeaderEndKey(event2); - break; - case "Enter": - case "NumpadEnter": - case "Space": - this.onHeaderEnterKey(event2, item8); - break; - } - }, "onHeaderKeyDown"), - onHeaderArrowDownKey: /* @__PURE__ */ __name(function onHeaderArrowDownKey(event2) { - var rootList2 = getAttribute(event2.currentTarget, "data-p-active") === true ? findSingle(event2.currentTarget.nextElementSibling, '[data-pc-section="rootlist"]') : null; - rootList2 ? focus(rootList2) : this.updateFocusedHeader({ - originalEvent: event2, - focusOnNext: true - }); - event2.preventDefault(); - }, "onHeaderArrowDownKey"), - onHeaderArrowUpKey: /* @__PURE__ */ __name(function onHeaderArrowUpKey(event2) { - var prevHeader = this.findPrevHeader(event2.currentTarget.parentElement) || this.findLastHeader(); - var rootList2 = getAttribute(prevHeader, "data-p-active") === true ? findSingle(prevHeader.nextElementSibling, '[data-pc-section="rootlist"]') : null; - rootList2 ? focus(rootList2) : this.updateFocusedHeader({ - originalEvent: event2, - focusOnNext: false - }); - event2.preventDefault(); - }, "onHeaderArrowUpKey"), - onHeaderHomeKey: /* @__PURE__ */ __name(function onHeaderHomeKey(event2) { - this.changeFocusedHeader(event2, this.findFirstHeader()); - event2.preventDefault(); - }, "onHeaderHomeKey"), - onHeaderEndKey: /* @__PURE__ */ __name(function onHeaderEndKey(event2) { - this.changeFocusedHeader(event2, this.findLastHeader()); - event2.preventDefault(); - }, "onHeaderEndKey"), - onHeaderEnterKey: /* @__PURE__ */ __name(function onHeaderEnterKey(event2, item8) { - var headerAction = findSingle(event2.currentTarget, '[data-pc-section="headerlink"]'); - headerAction ? headerAction.click() : this.onHeaderClick(event2, item8); - event2.preventDefault(); - }, "onHeaderEnterKey"), - findNextHeader: /* @__PURE__ */ __name(function findNextHeader(panelElement) { - var selfCheck = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - var nextPanelElement = selfCheck ? panelElement : panelElement.nextElementSibling; - var headerElement = findSingle(nextPanelElement, '[data-pc-section="header"]'); - return headerElement ? getAttribute(headerElement, "data-p-disabled") ? this.findNextHeader(headerElement.parentElement) : headerElement : null; - }, "findNextHeader"), - findPrevHeader: /* @__PURE__ */ __name(function findPrevHeader(panelElement) { - var selfCheck = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - var prevPanelElement = selfCheck ? panelElement : panelElement.previousElementSibling; - var headerElement = findSingle(prevPanelElement, '[data-pc-section="header"]'); - return headerElement ? getAttribute(headerElement, "data-p-disabled") ? this.findPrevHeader(headerElement.parentElement) : headerElement : null; - }, "findPrevHeader"), - findFirstHeader: /* @__PURE__ */ __name(function findFirstHeader() { - return this.findNextHeader(this.$el.firstElementChild, true); - }, "findFirstHeader"), - findLastHeader: /* @__PURE__ */ __name(function findLastHeader() { - return this.findPrevHeader(this.$el.lastElementChild, true); - }, "findLastHeader"), - updateFocusedHeader: /* @__PURE__ */ __name(function updateFocusedHeader(event2) { - var originalEvent = event2.originalEvent, focusOnNext = event2.focusOnNext, selfCheck = event2.selfCheck; - var panelElement = originalEvent.currentTarget.closest('[data-pc-section="panel"]'); - var header2 = selfCheck ? findSingle(panelElement, '[data-pc-section="header"]') : focusOnNext ? this.findNextHeader(panelElement) : this.findPrevHeader(panelElement); - header2 ? this.changeFocusedHeader(originalEvent, header2) : focusOnNext ? this.onHeaderHomeKey(originalEvent) : this.onHeaderEndKey(originalEvent); - }, "updateFocusedHeader"), - changeActiveItem: /* @__PURE__ */ __name(function changeActiveItem(event2, item8) { - var selfActive = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false; - if (!this.isItemDisabled(item8)) { - var active3 = this.isItemActive(item8); - var eventName = !active3 ? "panel-open" : "panel-close"; - this.activeItem = selfActive ? item8 : this.activeItem && equals(item8, this.activeItem) ? null : item8; - if (this.multiple) { - if (this.activeItems.some(function(subItem) { - return equals(item8, subItem); - })) { - this.activeItems = this.activeItems.filter(function(subItem) { - return !equals(item8, subItem); - }); - } else { - this.activeItems.push(item8); - } - } - this.changeExpandedKeys({ - item: item8, - expanded: !active3 - }); - this.$emit(eventName, { - originalEvent: event2, - item: item8 - }); - } - }, "changeActiveItem"), - changeExpandedKeys: /* @__PURE__ */ __name(function changeExpandedKeys(_ref) { - var item8 = _ref.item, _ref$expanded = _ref.expanded, expanded3 = _ref$expanded === void 0 ? false : _ref$expanded; - if (this.expandedKeys) { - var _keys = _objectSpread$a({}, this.expandedKeys); - if (expanded3) _keys[item8.key] = true; - else delete _keys[item8.key]; - this.$emit("update:expandedKeys", _keys); - } - }, "changeExpandedKeys"), - changeFocusedHeader: /* @__PURE__ */ __name(function changeFocusedHeader(event2, element) { - element && focus(element); - }, "changeFocusedHeader"), - getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps6(item8, index) { - return { - icon: mergeProps({ - "class": [this.cx("headerIcon"), this.getItemProp(item8, "icon")] - }, this.getPTOptions("headerIcon", item8, index)), - label: mergeProps({ - "class": this.cx("headerLabel") - }, this.getPTOptions("headerLabel", item8, index)) - }; - }, "getMenuItemProps") - }, - components: { - PanelMenuList: script$1$e, - ChevronRightIcon: script$1i, - ChevronDownIcon: script$1h - } -}; -var _hoisted_1$d = ["id"]; -var _hoisted_2$9 = ["id", "tabindex", "aria-label", "aria-expanded", "aria-controls", "aria-disabled", "onClick", "onKeydown", "data-p-active", "data-p-disabled"]; -var _hoisted_3$6 = ["href"]; -var _hoisted_4$4 = ["id", "aria-labelledby"]; -function render$m(_ctx, _cache, $props, $setup, $data, $options) { - var _component_PanelMenuList = resolveComponent("PanelMenuList"); - return openBlock(), createElementBlock("div", mergeProps({ - id: $data.id, - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model, function(item8, index) { - return openBlock(), createElementBlock(Fragment, { - key: $options.getPanelKey(index) - }, [$options.isItemVisible(item8) ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - style: $options.getItemProp(item8, "style"), - "class": [_ctx.cx("panel"), $options.getItemProp(item8, "class")], - ref_for: true - }, _ctx.ptm("panel")), [createBaseVNode("div", mergeProps({ - id: $options.getHeaderId(index), - "class": [_ctx.cx("header", { - item: item8 - }), $options.getItemProp(item8, "headerClass")], - tabindex: $options.isItemDisabled(item8) ? -1 : _ctx.tabindex, - role: "button", - "aria-label": $options.getItemLabel(item8), - "aria-expanded": $options.isItemActive(item8), - "aria-controls": $options.getContentId(index), - "aria-disabled": $options.isItemDisabled(item8), - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return $options.onHeaderClick($event, item8); - }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown5($event) { - return $options.onHeaderKeyDown($event, item8); - }, "onKeydown"), - ref_for: true - }, $options.getPTOptions("header", item8, index), { - "data-p-active": $options.isItemActive(item8), - "data-p-disabled": $options.isItemDisabled(item8) - }), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("headerContent"), - ref_for: true - }, $options.getPTOptions("headerContent", item8, index)), [!_ctx.$slots.item ? (openBlock(), createElementBlock("a", mergeProps({ - key: 0, - href: $options.getItemProp(item8, "url"), - "class": _ctx.cx("headerLink"), - tabindex: -1, - ref_for: true - }, $options.getPTOptions("headerLink", item8, index)), [$options.getItemProp(item8, "items") ? renderSlot(_ctx.$slots, "submenuicon", { - key: 0, - active: $options.isItemActive(item8) - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent($options.isItemActive(item8) ? "ChevronDownIcon" : "ChevronRightIcon"), mergeProps({ - "class": _ctx.cx("submenuIcon"), - ref_for: true - }, $options.getPTOptions("submenuIcon", item8, index)), null, 16, ["class"]))]; - }) : createCommentVNode("", true), _ctx.$slots.headericon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.headericon), { - key: 1, - item: item8, - "class": normalizeClass([_ctx.cx("headerIcon"), $options.getItemProp(item8, "icon")]) - }, null, 8, ["item", "class"])) : $options.getItemProp(item8, "icon") ? (openBlock(), createElementBlock("span", mergeProps({ - key: 2, - "class": [_ctx.cx("headerIcon"), $options.getItemProp(item8, "icon")], - ref_for: true - }, $options.getPTOptions("headerIcon", item8, index)), null, 16)) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ - "class": _ctx.cx("headerLabel"), - ref_for: true - }, $options.getPTOptions("headerLabel", item8, index)), toDisplayString($options.getItemLabel(item8)), 17)], 16, _hoisted_3$6)) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.item), { - key: 1, - item: item8, - root: true, - active: $options.isItemActive(item8), - hasSubmenu: $options.isItemGroup(item8), - label: $options.getItemLabel(item8), - props: $options.getMenuItemProps(item8, index) - }, null, 8, ["item", "active", "hasSubmenu", "label", "props"]))], 16)], 16, _hoisted_2$9), createVNode(Transition, mergeProps({ - name: "p-toggleable-content", - ref_for: true - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [withDirectives(createBaseVNode("div", mergeProps({ - id: $options.getContentId(index), - "class": _ctx.cx("contentContainer"), - role: "region", - "aria-labelledby": $options.getHeaderId(index), - ref_for: true - }, _ctx.ptm("contentContainer")), [$options.getItemProp(item8, "items") ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("content"), - ref_for: true - }, _ctx.ptm("content")), [createVNode(_component_PanelMenuList, { - panelId: $options.getPanelId(index), - items: $options.getItemProp(item8, "items"), - templates: _ctx.$slots, - expandedKeys: _ctx.expandedKeys, - onItemToggle: $options.changeExpandedKeys, - onHeaderFocus: $options.updateFocusedHeader, - pt: _ctx.pt, - unstyled: _ctx.unstyled - }, null, 8, ["panelId", "items", "templates", "expandedKeys", "onItemToggle", "onHeaderFocus", "pt", "unstyled"])], 16)) : createCommentVNode("", true)], 16, _hoisted_4$4), [[vShow, $options.isItemActive(item8)]])]; - }), - _: 2 - }, 1040)], 16)) : createCommentVNode("", true)], 64); - }), 128))], 16, _hoisted_1$d); -} -__name(render$m, "render$m"); -script$p.render = render$m; -var script$o = { - name: "EyeSlashIcon", - "extends": script$1j -}; -function render$l(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - d: "M13.9414 6.74792C13.9437 6.75295 13.9455 6.757 13.9469 6.76003C13.982 6.8394 14.0001 6.9252 14.0001 7.01195C14.0001 7.0987 13.982 7.1845 13.9469 7.26386C13.6004 8.00059 13.1711 8.69549 12.6674 9.33515C12.6115 9.4071 12.54 9.46538 12.4582 9.50556C12.3765 9.54574 12.2866 9.56678 12.1955 9.56707C12.0834 9.56671 11.9737 9.53496 11.8788 9.47541C11.7838 9.41586 11.7074 9.3309 11.6583 9.23015C11.6092 9.12941 11.5893 9.01691 11.6008 8.90543C11.6124 8.79394 11.6549 8.68793 11.7237 8.5994C12.1065 8.09726 12.4437 7.56199 12.7313 6.99995C12.2595 6.08027 10.3402 2.8014 6.99732 2.8014C6.63723 2.80218 6.27816 2.83969 5.92569 2.91336C5.77666 2.93304 5.62568 2.89606 5.50263 2.80972C5.37958 2.72337 5.29344 2.59398 5.26125 2.44714C5.22907 2.30031 5.2532 2.14674 5.32885 2.01685C5.40451 1.88696 5.52618 1.79021 5.66978 1.74576C6.10574 1.64961 6.55089 1.60134 6.99732 1.60181C11.5916 1.60181 13.7864 6.40856 13.9414 6.74792ZM2.20333 1.61685C2.35871 1.61411 2.5091 1.67179 2.6228 1.77774L12.2195 11.3744C12.3318 11.4869 12.3949 11.6393 12.3949 11.7983C12.3949 11.9572 12.3318 12.1097 12.2195 12.2221C12.107 12.3345 11.9546 12.3976 11.7956 12.3976C11.6367 12.3976 11.4842 12.3345 11.3718 12.2221L10.5081 11.3584C9.46549 12.0426 8.24432 12.4042 6.99729 12.3981C2.403 12.3981 0.208197 7.59135 0.0532336 7.25198C0.0509364 7.24694 0.0490875 7.2429 0.0476856 7.23986C0.0162332 7.16518 3.05176e-05 7.08497 3.05176e-05 7.00394C3.05176e-05 6.92291 0.0162332 6.8427 0.0476856 6.76802C0.631261 5.47831 1.46902 4.31959 2.51084 3.36119L1.77509 2.62545C1.66914 2.51175 1.61146 2.36136 1.61421 2.20597C1.61695 2.05059 1.6799 1.90233 1.78979 1.79244C1.89968 1.68254 2.04794 1.6196 2.20333 1.61685ZM7.45314 8.35147L5.68574 6.57609V6.5361C5.5872 6.78938 5.56498 7.06597 5.62183 7.33173C5.67868 7.59749 5.8121 7.84078 6.00563 8.03158C6.19567 8.21043 6.43052 8.33458 6.68533 8.39089C6.94014 8.44721 7.20543 8.43359 7.45314 8.35147ZM1.26327 6.99994C1.7351 7.91163 3.64645 11.1985 6.99729 11.1985C7.9267 11.2048 8.8408 10.9618 9.64438 10.4947L8.35682 9.20718C7.86027 9.51441 7.27449 9.64491 6.69448 9.57752C6.11446 9.51014 5.57421 9.24881 5.16131 8.83592C4.74842 8.42303 4.4871 7.88277 4.41971 7.30276C4.35232 6.72274 4.48282 6.13697 4.79005 5.64041L3.35855 4.2089C2.4954 5.00336 1.78523 5.94935 1.26327 6.99994Z", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$l, "render$l"); -script$o.render = render$l; -var theme$c = /* @__PURE__ */ __name(function theme27(_ref) { - var dt = _ref.dt; - return "\n.p-password {\n display: inline-flex;\n position: relative;\n}\n\n.p-password .p-password-overlay {\n min-width: 100%;\n}\n\n.p-password-meter {\n height: ".concat(dt("password.meter.height"), ";\n background: ").concat(dt("password.meter.background"), ";\n border-radius: ").concat(dt("password.meter.border.radius"), ";\n}\n\n.p-password-meter-label {\n height: 100%;\n width: 0;\n transition: width 1s ease-in-out;\n border-radius: ").concat(dt("password.meter.border.radius"), ";\n}\n\n.p-password-meter-weak {\n background: ").concat(dt("password.strength.weak.background"), ";\n}\n\n.p-password-meter-medium {\n background: ").concat(dt("password.strength.medium.background"), ";\n}\n\n.p-password-meter-strong {\n background: ").concat(dt("password.strength.strong.background"), ";\n}\n\n.p-password-fluid {\n display: flex;\n}\n\n.p-password-fluid .p-password-input {\n width: 100%;\n}\n\n.p-password-input::-ms-reveal,\n.p-password-input::-ms-clear {\n display: none;\n}\n\n.p-password-overlay {\n padding: ").concat(dt("password.overlay.padding"), ";\n background: ").concat(dt("password.overlay.background"), ";\n color: ").concat(dt("password.overlay.color"), ";\n border: 1px solid ").concat(dt("password.overlay.border.color"), ";\n box-shadow: ").concat(dt("password.overlay.shadow"), ";\n border-radius: ").concat(dt("password.overlay.border.radius"), ";\n}\n\n.p-password-content {\n display: flex;\n flex-direction: column;\n gap: ").concat(dt("password.content.gap"), ";\n}\n\n.p-password-toggle-mask-icon {\n inset-inline-end: ").concat(dt("form.field.padding.x"), ";\n color: ").concat(dt("password.icon.color"), ";\n position: absolute;\n top: 50%;\n margin-top: calc(-1 * calc(").concat(dt("icon.size"), " / 2));\n width: ").concat(dt("icon.size"), ";\n height: ").concat(dt("icon.size"), ";\n}\n\n.p-password:has(.p-password-toggle-mask-icon) .p-password-input {\n padding-inline-end: calc((").concat(dt("form.field.padding.x"), " * 2) + ").concat(dt("icon.size"), ");\n}\n"); -}, "theme"); -var inlineStyles$4 = { - root: /* @__PURE__ */ __name(function root21(_ref2) { - var props = _ref2.props; - return { - position: props.appendTo === "self" ? "relative" : void 0 - }; - }, "root") -}; -var classes$d = { - root: /* @__PURE__ */ __name(function root22(_ref3) { - var instance = _ref3.instance; - return ["p-password p-component p-inputwrapper", { - "p-inputwrapper-filled": instance.$filled, - "p-inputwrapper-focus": instance.focused, - "p-password-fluid": instance.$fluid - }]; - }, "root"), - pcInputText: "p-password-input", - maskIcon: "p-password-toggle-mask-icon p-password-mask-icon", - unmaskIcon: "p-password-toggle-mask-icon p-password-unmask-icon", - overlay: "p-password-overlay p-component", - content: "p-password-content", - meter: "p-password-meter", - meterLabel: /* @__PURE__ */ __name(function meterLabel(_ref4) { - var instance = _ref4.instance; - return "p-password-meter-label ".concat(instance.meter ? "p-password-meter-" + instance.meter.strength : ""); - }, "meterLabel"), - meterText: "p-password-meter-text" -}; -var PasswordStyle = BaseStyle.extend({ - name: "password", - theme: theme$c, - classes: classes$d, - inlineStyles: inlineStyles$4 -}); -var script$1$d = { - name: "BasePassword", - "extends": script$1k, - props: { - promptLabel: { - type: String, - "default": null - }, - mediumRegex: { - type: [String, RegExp], - "default": "^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})" - // eslint-disable-line - }, - strongRegex: { - type: [String, RegExp], - "default": "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{8,})" - // eslint-disable-line - }, - weakLabel: { - type: String, - "default": null - }, - mediumLabel: { - type: String, - "default": null - }, - strongLabel: { - type: String, - "default": null - }, - feedback: { - type: Boolean, - "default": true - }, - appendTo: { - type: [String, Object], - "default": "body" - }, - toggleMask: { - type: Boolean, - "default": false - }, - hideIcon: { - type: String, - "default": void 0 - }, - maskIcon: { - type: String, - "default": void 0 - }, - showIcon: { - type: String, - "default": void 0 - }, - unmaskIcon: { - type: String, - "default": void 0 - }, - disabled: { - type: Boolean, - "default": false - }, - placeholder: { - type: String, - "default": null - }, - required: { - type: Boolean, - "default": false - }, - inputId: { - type: String, - "default": null - }, - inputClass: { - type: [String, Object], - "default": null - }, - inputStyle: { - type: Object, - "default": null - }, - inputProps: { - type: null, - "default": null - }, - panelId: { - type: String, - "default": null - }, - panelClass: { - type: [String, Object], - "default": null - }, - panelStyle: { - type: Object, - "default": null - }, - panelProps: { - type: null, - "default": null - }, - overlayId: { - type: String, - "default": null - }, - overlayClass: { - type: [String, Object], - "default": null - }, - overlayStyle: { - type: Object, - "default": null - }, - overlayProps: { - type: null, - "default": null - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - }, - autofocus: { - type: Boolean, - "default": null - } - }, - style: PasswordStyle, - provide: /* @__PURE__ */ __name(function provide37() { - return { - $pcPassword: this, - $parentInstance: this - }; - }, "provide") -}; -var script$n = { - name: "Password", - "extends": script$1$d, - inheritAttrs: false, - emits: ["change", "focus", "blur", "invalid"], - inject: { - $pcFluid: { - "default": null - } - }, - data: /* @__PURE__ */ __name(function data26() { - return { - id: this.$attrs.id, - overlayVisible: false, - meter: null, - infoText: null, - focused: false, - unmasked: false - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId10(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId") - }, - mediumCheckRegExp: null, - strongCheckRegExp: null, - resizeListener: null, - scrollHandler: null, - overlay: null, - mounted: /* @__PURE__ */ __name(function mounted28() { - this.id = this.id || UniqueComponentId(); - this.infoText = this.promptText; - this.mediumCheckRegExp = new RegExp(this.mediumRegex); - this.strongCheckRegExp = new RegExp(this.strongRegex); - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount11() { - this.unbindResizeListener(); - if (this.scrollHandler) { - this.scrollHandler.destroy(); - this.scrollHandler = null; - } - if (this.overlay) { - ZIndex.clear(this.overlay); - this.overlay = null; - } - }, "beforeUnmount"), - methods: { - onOverlayEnter: /* @__PURE__ */ __name(function onOverlayEnter4(el) { - ZIndex.set("overlay", el, this.$primevue.config.zIndex.overlay); - addStyle(el, { - position: "absolute", - top: "0", - left: "0" - }); - this.alignOverlay(); - this.bindScrollListener(); - this.bindResizeListener(); - }, "onOverlayEnter"), - onOverlayLeave: /* @__PURE__ */ __name(function onOverlayLeave4() { - this.unbindScrollListener(); - this.unbindResizeListener(); - this.overlay = null; - }, "onOverlayLeave"), - onOverlayAfterLeave: /* @__PURE__ */ __name(function onOverlayAfterLeave4(el) { - ZIndex.clear(el); - }, "onOverlayAfterLeave"), - alignOverlay: /* @__PURE__ */ __name(function alignOverlay5() { - if (this.appendTo === "self") { - relativePosition(this.overlay, this.$refs.input.$el); - } else { - this.overlay.style.minWidth = getOuterWidth(this.$refs.input.$el) + "px"; - absolutePosition(this.overlay, this.$refs.input.$el); - } - }, "alignOverlay"), - testStrength: /* @__PURE__ */ __name(function testStrength(str) { - var level = 0; - if (this.strongCheckRegExp.test(str)) level = 3; - else if (this.mediumCheckRegExp.test(str)) level = 2; - else if (str.length) level = 1; - return level; - }, "testStrength"), - onInput: /* @__PURE__ */ __name(function onInput5(event2) { - this.writeValue(event2.target.value, event2); - this.$emit("change", event2); - }, "onInput"), - onFocus: /* @__PURE__ */ __name(function onFocus11(event2) { - this.focused = true; - if (this.feedback) { - this.setPasswordMeter(this.d_value); - this.overlayVisible = true; - } - this.$emit("focus", event2); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur11(event2) { - this.focused = false; - if (this.feedback) { - this.overlayVisible = false; - } - this.$emit("blur", event2); - }, "onBlur"), - onKeyUp: /* @__PURE__ */ __name(function onKeyUp(event2) { - if (this.feedback) { - var value2 = event2.target.value; - var _this$checkPasswordSt = this.checkPasswordStrength(value2), meter = _this$checkPasswordSt.meter, label12 = _this$checkPasswordSt.label; - this.meter = meter; - this.infoText = label12; - if (event2.code === "Escape") { - this.overlayVisible && (this.overlayVisible = false); - return; - } - if (!this.overlayVisible) { - this.overlayVisible = true; - } - } - }, "onKeyUp"), - setPasswordMeter: /* @__PURE__ */ __name(function setPasswordMeter() { - if (!this.d_value) { - this.meter = null; - this.infoText = this.promptText; - return; - } - var _this$checkPasswordSt2 = this.checkPasswordStrength(this.d_value), meter = _this$checkPasswordSt2.meter, label12 = _this$checkPasswordSt2.label; - this.meter = meter; - this.infoText = label12; - if (!this.overlayVisible) { - this.overlayVisible = true; - } - }, "setPasswordMeter"), - checkPasswordStrength: /* @__PURE__ */ __name(function checkPasswordStrength(value2) { - var label12 = null; - var meter = null; - switch (this.testStrength(value2)) { - case 1: - label12 = this.weakText; - meter = { - strength: "weak", - width: "33.33%" - }; - break; - case 2: - label12 = this.mediumText; - meter = { - strength: "medium", - width: "66.66%" - }; - break; - case 3: - label12 = this.strongText; - meter = { - strength: "strong", - width: "100%" - }; - break; - default: - label12 = this.promptText; - meter = null; - break; - } - return { - label: label12, - meter - }; - }, "checkPasswordStrength"), - onInvalid: /* @__PURE__ */ __name(function onInvalid(event2) { - this.$emit("invalid", event2); - }, "onInvalid"), - bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener6() { - var _this = this; - if (!this.scrollHandler) { - this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.input.$el, function() { - if (_this.overlayVisible) { - _this.overlayVisible = false; - } - }); - } - this.scrollHandler.bindScrollListener(); - }, "bindScrollListener"), - unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener6() { - if (this.scrollHandler) { - this.scrollHandler.unbindScrollListener(); - } - }, "unbindScrollListener"), - bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener6() { - var _this2 = this; - if (!this.resizeListener) { - this.resizeListener = function() { - if (_this2.overlayVisible && !isTouchDevice()) { - _this2.overlayVisible = false; - } - }; - window.addEventListener("resize", this.resizeListener); - } - }, "bindResizeListener"), - unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener6() { - if (this.resizeListener) { - window.removeEventListener("resize", this.resizeListener); - this.resizeListener = null; - } - }, "unbindResizeListener"), - overlayRef: /* @__PURE__ */ __name(function overlayRef4(el) { - this.overlay = el; - }, "overlayRef"), - onMaskToggle: /* @__PURE__ */ __name(function onMaskToggle() { - this.unmasked = !this.unmasked; - }, "onMaskToggle"), - onOverlayClick: /* @__PURE__ */ __name(function onOverlayClick5(event2) { - OverlayEventBus.emit("overlay-click", { - originalEvent: event2, - target: this.$el - }); - }, "onOverlayClick") - }, - computed: { - inputType: /* @__PURE__ */ __name(function inputType2() { - return this.unmasked ? "text" : "password"; - }, "inputType"), - weakText: /* @__PURE__ */ __name(function weakText() { - return this.weakLabel || this.$primevue.config.locale.weak; - }, "weakText"), - mediumText: /* @__PURE__ */ __name(function mediumText() { - return this.mediumLabel || this.$primevue.config.locale.medium; - }, "mediumText"), - strongText: /* @__PURE__ */ __name(function strongText() { - return this.strongLabel || this.$primevue.config.locale.strong; - }, "strongText"), - promptText: /* @__PURE__ */ __name(function promptText() { - return this.promptLabel || this.$primevue.config.locale.passwordPrompt; - }, "promptText"), - overlayUniqueId: /* @__PURE__ */ __name(function overlayUniqueId() { - return this.id + "_overlay"; - }, "overlayUniqueId") - }, - components: { - InputText: script$1l, - Portal: script$1m, - EyeSlashIcon: script$o, - EyeIcon: script$N - } -}; -function _typeof$a(o) { - "@babel/helpers - typeof"; - return _typeof$a = "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$a(o); -} -__name(_typeof$a, "_typeof$a"); -function ownKeys$9(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$9, "ownKeys$9"); -function _objectSpread$9(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$9(Object(t2), true).forEach(function(r2) { - _defineProperty$a(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$9(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$9, "_objectSpread$9"); -function _defineProperty$a(e, r, t2) { - return (r = _toPropertyKey$a(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$a, "_defineProperty$a"); -function _toPropertyKey$a(t2) { - var i = _toPrimitive$a(t2, "string"); - return "symbol" == _typeof$a(i) ? i : i + ""; -} -__name(_toPropertyKey$a, "_toPropertyKey$a"); -function _toPrimitive$a(t2, r) { - if ("object" != _typeof$a(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$a(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$a, "_toPrimitive$a"); -var _hoisted_1$c = ["id"]; -function render$k(_ctx, _cache, $props, $setup, $data, $options) { - var _component_InputText = resolveComponent("InputText"); - var _component_Portal = resolveComponent("Portal"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root"), - style: _ctx.sx("root") - }, _ctx.ptmi("root")), [createVNode(_component_InputText, mergeProps({ - ref: "input", - id: _ctx.inputId, - type: $options.inputType, - "class": [_ctx.cx("pcInputText"), _ctx.inputClass], - style: _ctx.inputStyle, - value: _ctx.d_value, - name: _ctx.$formName, - "aria-labelledby": _ctx.ariaLabelledby, - "aria-label": _ctx.ariaLabel, - "aria-controls": _ctx.overlayProps && _ctx.overlayProps.id || _ctx.overlayId || _ctx.panelProps && _ctx.panelProps.id || _ctx.panelId || $options.overlayUniqueId, - "aria-expanded": $data.overlayVisible, - "aria-haspopup": true, - placeholder: _ctx.placeholder, - required: _ctx.required, - fluid: _ctx.fluid, - disabled: _ctx.disabled, - variant: _ctx.variant, - invalid: _ctx.invalid, - size: _ctx.size, - autofocus: _ctx.autofocus, - onInput: $options.onInput, - onFocus: $options.onFocus, - onBlur: $options.onBlur, - onKeyup: $options.onKeyUp, - onInvalid: $options.onInvalid - }, _ctx.inputProps, { - pt: _ctx.ptm("pcInputText"), - unstyled: _ctx.unstyled - }), null, 16, ["id", "type", "class", "style", "value", "name", "aria-labelledby", "aria-label", "aria-controls", "aria-expanded", "placeholder", "required", "fluid", "disabled", "variant", "invalid", "size", "autofocus", "onInput", "onFocus", "onBlur", "onKeyup", "onInvalid", "pt", "unstyled"]), _ctx.toggleMask && $data.unmasked ? renderSlot(_ctx.$slots, _ctx.$slots.maskicon ? "maskicon" : "hideicon", { - key: 0, - toggleCallback: $options.onMaskToggle - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.maskIcon ? "i" : "EyeSlashIcon"), mergeProps({ - "class": [_ctx.cx("maskIcon"), _ctx.maskIcon], - onClick: $options.onMaskToggle - }, _ctx.ptm("maskIcon")), null, 16, ["class", "onClick"]))]; - }) : createCommentVNode("", true), _ctx.toggleMask && !$data.unmasked ? renderSlot(_ctx.$slots, _ctx.$slots.unmaskicon ? "unmaskicon" : "showicon", { - key: 1, - toggleCallback: $options.onMaskToggle - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.unmaskIcon ? "i" : "EyeIcon"), mergeProps({ - "class": [_ctx.cx("unmaskIcon"), _ctx.unmaskIcon], - onClick: $options.onMaskToggle - }, _ctx.ptm("unmaskIcon")), null, 16, ["class", "onClick"]))]; - }) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ - "class": "p-hidden-accessible", - "aria-live": "polite" - }, _ctx.ptm("hiddenAccesible"), { - "data-p-hidden-accessible": true - }), toDisplayString($data.infoText), 17), createVNode(_component_Portal, { - appendTo: _ctx.appendTo - }, { - "default": withCtx(function() { - return [createVNode(Transition, mergeProps({ - name: "p-connected-overlay", - onEnter: $options.onOverlayEnter, - onLeave: $options.onOverlayLeave, - onAfterLeave: $options.onOverlayAfterLeave - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [$data.overlayVisible ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: $options.overlayRef, - id: _ctx.overlayId || _ctx.panelId || $options.overlayUniqueId, - "class": [_ctx.cx("overlay"), _ctx.panelClass, _ctx.overlayClass], - style: [_ctx.overlayStyle, _ctx.panelStyle], - onClick: _cache[0] || (_cache[0] = function() { - return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); - }) - }, _objectSpread$9(_objectSpread$9(_objectSpread$9({}, _ctx.panelProps), _ctx.overlayProps), _ctx.ptm("overlay"))), [renderSlot(_ctx.$slots, "header"), renderSlot(_ctx.$slots, "content", {}, function() { - return [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("content") - }, _ctx.ptm("content")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("meter") - }, _ctx.ptm("meter")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("meterLabel"), - style: { - width: $data.meter ? $data.meter.width : "" - } - }, _ctx.ptm("meterLabel")), null, 16)], 16), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("meterText") - }, _ctx.ptm("meterText")), toDisplayString($data.infoText), 17)], 16)]; - }), renderSlot(_ctx.$slots, "footer")], 16, _hoisted_1$c)) : createCommentVNode("", true)]; - }), - _: 3 - }, 16, ["onEnter", "onLeave", "onAfterLeave"])]; - }), - _: 3 - }, 8, ["appendTo"])], 16); -} -__name(render$k, "render$k"); -script$n.render = render$k; -var theme$b = /* @__PURE__ */ __name(function theme28(_ref) { - var dt = _ref.dt; - return "\n.p-picklist {\n display: flex;\n gap: ".concat(dt("picklist.gap"), ";\n}\n\n.p-picklist-controls {\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: ").concat(dt("picklist.controls.gap"), ";\n}\n\n.p-picklist-list-container {\n flex: 1 1 50%;\n}\n\n.p-picklist .p-listbox {\n height: 100%;\n}\n"); -}, "theme"); -var classes$c = { - root: "p-picklist p-component", - sourceControls: "p-picklist-controls p-picklist-source-controls", - sourceListContainer: "p-picklist-list-container p-picklist-source-list-container", - transferControls: "p-picklist-controls p-picklist-transfer-controls", - targetListContainer: "p-picklist-list-container p-picklist-target-list-container", - targetControls: "p-picklist-controls p-picklist-target-controls" -}; -var PickListStyle = BaseStyle.extend({ - name: "picklist", - theme: theme$b, - classes: classes$c -}); -var script$1$c = { - name: "BasePickList", - "extends": script$1f, - props: { - modelValue: { - type: Array, - "default": /* @__PURE__ */ __name(function _default13() { - return [[], []]; - }, "_default") - }, - selection: { - type: Array, - "default": /* @__PURE__ */ __name(function _default14() { - return [[], []]; - }, "_default") - }, - dataKey: { - type: String, - "default": null - }, - listStyle: { - type: null, - "default": null - }, - metaKeySelection: { - type: Boolean, - "default": false - }, - autoOptionFocus: { - type: Boolean, - "default": true - }, - focusOnHover: { - type: Boolean, - "default": true - }, - responsive: { - type: Boolean, - "default": true - }, - breakpoint: { - type: String, - "default": "960px" - }, - striped: { - type: Boolean, - "default": false - }, - scrollHeight: { - type: String, - "default": "14rem" - }, - showSourceControls: { - type: Boolean, - "default": true - }, - showTargetControls: { - type: Boolean, - "default": true - }, - buttonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default15() { - return { - severity: "secondary" - }; - }, "_default") - }, - moveUpButtonProps: { - type: null, - "default": null - }, - moveTopButtonProps: { - type: null, - "default": null - }, - moveDownButtonProps: { - type: null, - "default": null - }, - moveBottomButtonProps: { - type: null, - "default": null - }, - moveToTargetProps: { - type: null, - "default": null - }, - moveAllToTargetProps: { - type: null, - "default": null - }, - moveToSourceProps: { - type: null, - "default": null - }, - moveAllToSourceProps: { - type: null, - "default": null - }, - tabindex: { - type: Number, - "default": 0 - }, - disabled: { - type: Boolean, - "default": false - } - }, - style: PickListStyle, - provide: /* @__PURE__ */ __name(function provide38() { - return { - $pcPickList: this, - $parentInstance: this - }; - }, "provide") -}; -function _toConsumableArray$4(r) { - return _arrayWithoutHoles$4(r) || _iterableToArray$4(r) || _unsupportedIterableToArray$4(r) || _nonIterableSpread$4(); -} -__name(_toConsumableArray$4, "_toConsumableArray$4"); -function _nonIterableSpread$4() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableSpread$4, "_nonIterableSpread$4"); -function _unsupportedIterableToArray$4(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$4(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$4(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$4, "_unsupportedIterableToArray$4"); -function _iterableToArray$4(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$4, "_iterableToArray$4"); -function _arrayWithoutHoles$4(r) { - if (Array.isArray(r)) return _arrayLikeToArray$4(r); -} -__name(_arrayWithoutHoles$4, "_arrayWithoutHoles$4"); -function _arrayLikeToArray$4(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; -} -__name(_arrayLikeToArray$4, "_arrayLikeToArray$4"); -var script$m = { - name: "PickList", - "extends": script$1$c, - inheritAttrs: false, - emits: ["update:modelValue", "reorder", "update:selection", "selection-change", "move-to-target", "move-to-source", "move-all-to-target", "move-all-to-source", "focus", "blur"], - itemTouched: false, - reorderDirection: null, - styleElement: null, - media: null, - mediaChangeListener: null, - data: /* @__PURE__ */ __name(function data27() { - return { - id: this.$attrs.id, - d_selection: this.selection, - viewChanged: false - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId11(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId"), - selection: /* @__PURE__ */ __name(function selection(newValue) { - this.d_selection = newValue; - }, "selection"), - breakpoint: /* @__PURE__ */ __name(function breakpoint() { - this.destroyMedia(); - this.initMedia(); - }, "breakpoint") - }, - updated: /* @__PURE__ */ __name(function updated6() { - if (this.reorderDirection) { - this.updateListScroll(this.$refs.sourceList.$el); - this.updateListScroll(this.$refs.targetList.$el); - this.reorderDirection = null; - } - }, "updated"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount12() { - this.destroyStyle(); - this.destroyMedia(); - }, "beforeUnmount"), - mounted: /* @__PURE__ */ __name(function mounted29() { - this.id = this.id || UniqueComponentId(); - if (this.responsive) { - this.createStyle(); - this.initMedia(); - } - }, "mounted"), - methods: { - updateSelection: /* @__PURE__ */ __name(function updateSelection2(event2) { - this.$emit("update:selection", this.d_selection); - this.$emit("selection-change", { - originalEvent: event2, - value: this.d_selection - }); - }, "updateSelection"), - onChangeSelection: /* @__PURE__ */ __name(function onChangeSelection2(params, listIndex) { - this.d_selection[listIndex] = params.value; - this.updateSelection(params.event); - }, "onChangeSelection"), - onListFocus: /* @__PURE__ */ __name(function onListFocus4(event2, listType) { - this.$emit("focus", event2, listType); - }, "onListFocus"), - onListBlur: /* @__PURE__ */ __name(function onListBlur4(event2, listType) { - this.$emit("blur", event2, listType); - }, "onListBlur"), - onReorderUpdate: /* @__PURE__ */ __name(function onReorderUpdate2(event2, value2, listIndex) { - this.$emit("update:modelValue", value2); - this.$emit("reorder", { - originalEvent: event2, - value: value2, - direction: this.reorderDirection, - listIndex - }); - }, "onReorderUpdate"), - onItemDblClick: /* @__PURE__ */ __name(function onItemDblClick(event2, listIndex) { - if (listIndex === 0) this.moveToTarget({ - event: event2.originalEvent - }); - else if (listIndex === 1) this.moveToSource({ - event: event2.originalEvent - }); - }, "onItemDblClick"), - moveUp: /* @__PURE__ */ __name(function moveUp2(event2, listIndex) { - if (this.d_selection && this.d_selection[listIndex]) { - var valueList = _toConsumableArray$4(this.modelValue[listIndex]); - var selectionList = this.d_selection[listIndex]; - for (var i = 0; i < selectionList.length; i++) { - var selectedItem = selectionList[i]; - var selectedItemIndex = findIndexInList(selectedItem, valueList); - if (selectedItemIndex !== 0) { - var movedItem = valueList[selectedItemIndex]; - var temp = valueList[selectedItemIndex - 1]; - valueList[selectedItemIndex - 1] = movedItem; - valueList[selectedItemIndex] = temp; - } else { - break; - } - } - var value2 = _toConsumableArray$4(this.modelValue); - value2[listIndex] = valueList; - this.reorderDirection = "up"; - this.onReorderUpdate(event2, value2, listIndex); - } - }, "moveUp"), - moveTop: /* @__PURE__ */ __name(function moveTop2(event2, listIndex) { - if (this.d_selection) { - var valueList = _toConsumableArray$4(this.modelValue[listIndex]); - var selectionList = this.d_selection[listIndex]; - for (var i = 0; i < selectionList.length; i++) { - var selectedItem = selectionList[i]; - var selectedItemIndex = findIndexInList(selectedItem, valueList); - if (selectedItemIndex !== 0) { - var movedItem = valueList.splice(selectedItemIndex, 1)[0]; - valueList.unshift(movedItem); - } else { - break; - } - } - var value2 = _toConsumableArray$4(this.modelValue); - value2[listIndex] = valueList; - this.reorderDirection = "top"; - this.onReorderUpdate(event2, value2, listIndex); - } - }, "moveTop"), - moveDown: /* @__PURE__ */ __name(function moveDown2(event2, listIndex) { - if (this.d_selection) { - var valueList = _toConsumableArray$4(this.modelValue[listIndex]); - var selectionList = this.d_selection[listIndex]; - for (var i = selectionList.length - 1; i >= 0; i--) { - var selectedItem = selectionList[i]; - var selectedItemIndex = findIndexInList(selectedItem, valueList); - if (selectedItemIndex !== valueList.length - 1) { - var movedItem = valueList[selectedItemIndex]; - var temp = valueList[selectedItemIndex + 1]; - valueList[selectedItemIndex + 1] = movedItem; - valueList[selectedItemIndex] = temp; - } else { - break; - } - } - var value2 = _toConsumableArray$4(this.modelValue); - value2[listIndex] = valueList; - this.reorderDirection = "down"; - this.onReorderUpdate(event2, value2, listIndex); - } - }, "moveDown"), - moveBottom: /* @__PURE__ */ __name(function moveBottom2(event2, listIndex) { - if (this.d_selection) { - var valueList = _toConsumableArray$4(this.modelValue[listIndex]); - var selectionList = this.d_selection[listIndex]; - for (var i = selectionList.length - 1; i >= 0; i--) { - var selectedItem = selectionList[i]; - var selectedItemIndex = findIndexInList(selectedItem, valueList); - if (selectedItemIndex !== valueList.length - 1) { - var movedItem = valueList.splice(selectedItemIndex, 1)[0]; - valueList.push(movedItem); - } else { - break; - } - } - var value2 = _toConsumableArray$4(this.modelValue); - value2[listIndex] = valueList; - this.reorderDirection = "bottom"; - this.onReorderUpdate(event2, value2, listIndex); - } - }, "moveBottom"), - moveToTarget: /* @__PURE__ */ __name(function moveToTarget(event2) { - var selection2 = this.d_selection && this.d_selection[0] ? this.d_selection[0] : null; - var sourceList2 = _toConsumableArray$4(this.modelValue[0]); - var targetList2 = _toConsumableArray$4(this.modelValue[1]); - if (selection2) { - for (var i = 0; i < selection2.length; i++) { - var selectedItem = selection2[i]; - if (findIndexInList(selectedItem, targetList2) == -1) { - targetList2.push(sourceList2.splice(findIndexInList(selectedItem, sourceList2), 1)[0]); - } - } - var value2 = _toConsumableArray$4(this.modelValue); - value2[0] = sourceList2; - value2[1] = targetList2; - this.$emit("update:modelValue", value2); - this.$emit("move-to-target", { - originalEvent: event2, - items: _toConsumableArray$4(new Set(selection2)) - }); - this.d_selection[0] = []; - this.updateSelection(event2); - } - }, "moveToTarget"), - moveAllToTarget: /* @__PURE__ */ __name(function moveAllToTarget(event2) { - if (this.modelValue[0]) { - var sourceList2 = _toConsumableArray$4(this.modelValue[0]); - var targetList2 = _toConsumableArray$4(this.modelValue[1]); - this.$emit("move-all-to-target", { - originalEvent: event2, - items: sourceList2 - }); - targetList2 = [].concat(_toConsumableArray$4(targetList2), _toConsumableArray$4(sourceList2)); - sourceList2 = []; - var value2 = _toConsumableArray$4(this.modelValue); - value2[0] = sourceList2; - value2[1] = targetList2; - this.$emit("update:modelValue", value2); - this.d_selection = [[], []]; - this.updateSelection(event2); - } - }, "moveAllToTarget"), - moveToSource: /* @__PURE__ */ __name(function moveToSource(event2) { - var selection2 = this.d_selection && this.d_selection[1] ? this.d_selection[1] : null; - var sourceList2 = _toConsumableArray$4(this.modelValue[0]); - var targetList2 = _toConsumableArray$4(this.modelValue[1]); - if (selection2) { - for (var i = 0; i < selection2.length; i++) { - var selectedItem = selection2[i]; - if (findIndexInList(selectedItem, sourceList2) == -1) { - sourceList2.push(targetList2.splice(findIndexInList(selectedItem, targetList2), 1)[0]); - } - } - var value2 = _toConsumableArray$4(this.modelValue); - value2[0] = sourceList2; - value2[1] = targetList2; - this.$emit("update:modelValue", value2); - this.$emit("move-to-source", { - originalEvent: event2, - items: _toConsumableArray$4(new Set(selection2)) - }); - this.d_selection[1] = []; - this.updateSelection(event2); - } - }, "moveToSource"), - moveAllToSource: /* @__PURE__ */ __name(function moveAllToSource(event2) { - if (this.modelValue[1]) { - var sourceList2 = _toConsumableArray$4(this.modelValue[0]); - var targetList2 = _toConsumableArray$4(this.modelValue[1]); - this.$emit("move-all-to-source", { - originalEvent: event2, - items: targetList2 - }); - sourceList2 = [].concat(_toConsumableArray$4(sourceList2), _toConsumableArray$4(targetList2)); - targetList2 = []; - var value2 = _toConsumableArray$4(this.modelValue); - value2[0] = sourceList2; - value2[1] = targetList2; - this.$emit("update:modelValue", value2); - this.d_selection = [[], []]; - this.updateSelection(event2); - } - }, "moveAllToSource"), - onItemClick: /* @__PURE__ */ __name(function onItemClick6(event2, item8, index, listIndex) { - var listType = listIndex === 0 ? "sourceList" : "targetList"; - this.itemTouched = false; - var selectionList = this.d_selection[listIndex]; - var selectedIndex = findIndexInList(item8, selectionList); - var selected3 = selectedIndex != -1; - var metaSelection = this.itemTouched ? false : this.metaKeySelection; - var selectedId = find(this.$refs[listType].$el, '[data-pc-section="item"]')[index].getAttribute("id"); - this.focusedOptionIndex = selectedId; - var _selection; - if (metaSelection) { - var metaKey = event2.metaKey || event2.ctrlKey; - if (selected3 && metaKey) { - _selection = selectionList.filter(function(val, index2) { - return index2 !== selectedIndex; - }); - } else { - _selection = metaKey ? selectionList ? _toConsumableArray$4(selectionList) : [] : []; - _selection.push(item8); - } - } else { - if (selected3) { - _selection = selectionList.filter(function(val, index2) { - return index2 !== selectedIndex; - }); - } else { - _selection = selectionList ? _toConsumableArray$4(selectionList) : []; - _selection.push(item8); - } - } - var newSelection = _toConsumableArray$4(this.d_selection); - newSelection[listIndex] = _selection; - this.d_selection = newSelection; - this.updateSelection(event2); - }, "onItemClick"), - updateListScroll: /* @__PURE__ */ __name(function updateListScroll2(listElement) { - var listItems = find(listElement, '[data-pc-section="item"][data-p-selected="true"]'); - if (listItems && listItems.length) { - switch (this.reorderDirection) { - case "up": - scrollInView(listElement, listItems[0]); - break; - case "top": - listElement.scrollTop = 0; - break; - case "down": - scrollInView(listElement, listItems[listItems.length - 1]); - break; - case "bottom": - listElement.scrollTop = listElement.scrollHeight; - break; - } - } - }, "updateListScroll"), - initMedia: /* @__PURE__ */ __name(function initMedia() { - this.media = window.matchMedia("(max-width: ".concat(this.breakpoint, ")")); - this.viewChanged = this.media.matches; - this.bindMediaChangeListener(); - }, "initMedia"), - destroyMedia: /* @__PURE__ */ __name(function destroyMedia() { - this.unbindMediaChangeListener(); - }, "destroyMedia"), - bindMediaChangeListener: /* @__PURE__ */ __name(function bindMediaChangeListener() { - var _this = this; - if (this.media && !this.mediaChangeListener) { - this.mediaChangeListener = function(event2) { - _this.viewChanged = event2.matches; - }; - this.media.addEventListener("change", this.mediaChangeListener); - } - }, "bindMediaChangeListener"), - unbindMediaChangeListener: /* @__PURE__ */ __name(function unbindMediaChangeListener() { - if (this.media && this.mediaChangeListener) { - this.media.removeEventListener("change", this.mediaChangeListener); - this.mediaChangeListener = null; - } - }, "unbindMediaChangeListener"), - createStyle: /* @__PURE__ */ __name(function createStyle2() { - if (!this.styleElement && !this.isUnstyled) { - var _this$$primevue; - this.styleElement = document.createElement("style"); - this.styleElement.type = "text/css"; - 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); - document.head.appendChild(this.styleElement); - var innerHTML = "\n@media screen and (max-width: ".concat(this.breakpoint, ") {\n .p-picklist[").concat(this.$attrSelector, "] {\n flex-direction: column;\n }\n\n .p-picklist[").concat(this.$attrSelector, "] .p-picklist-controls {\n flex-direction: row;\n }\n}\n"); - this.styleElement.innerHTML = innerHTML; - } - }, "createStyle"), - destroyStyle: /* @__PURE__ */ __name(function destroyStyle2() { - if (this.styleElement) { - document.head.removeChild(this.styleElement); - this.styleElement = null; - } - }, "destroyStyle"), - moveDisabled: /* @__PURE__ */ __name(function moveDisabled2(index) { - return this.disabled ? true : this.d_selection && (!this.d_selection[index] || !this.d_selection[index].length) ? true : false; - }, "moveDisabled"), - moveAllDisabled: /* @__PURE__ */ __name(function moveAllDisabled(list2) { - return this.disabled ? true : isEmpty(this[list2]); - }, "moveAllDisabled") - }, - computed: { - idSource: /* @__PURE__ */ __name(function idSource() { - return "".concat(this.id, "_source"); - }, "idSource"), - idTarget: /* @__PURE__ */ __name(function idTarget() { - return "".concat(this.id, "_target"); - }, "idTarget"), - sourceList: /* @__PURE__ */ __name(function sourceList() { - return this.modelValue && this.modelValue[0] ? this.modelValue[0] : null; - }, "sourceList"), - targetList: /* @__PURE__ */ __name(function targetList() { - return this.modelValue && this.modelValue[1] ? this.modelValue[1] : null; - }, "targetList"), - moveUpAriaLabel: /* @__PURE__ */ __name(function moveUpAriaLabel2() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveUp : void 0; - }, "moveUpAriaLabel"), - moveTopAriaLabel: /* @__PURE__ */ __name(function moveTopAriaLabel2() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveTop : void 0; - }, "moveTopAriaLabel"), - moveDownAriaLabel: /* @__PURE__ */ __name(function moveDownAriaLabel2() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveDown : void 0; - }, "moveDownAriaLabel"), - moveBottomAriaLabel: /* @__PURE__ */ __name(function moveBottomAriaLabel2() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveBottom : void 0; - }, "moveBottomAriaLabel"), - moveToTargetAriaLabel: /* @__PURE__ */ __name(function moveToTargetAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveToTarget : void 0; - }, "moveToTargetAriaLabel"), - moveAllToTargetAriaLabel: /* @__PURE__ */ __name(function moveAllToTargetAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveAllToTarget : void 0; - }, "moveAllToTargetAriaLabel"), - moveToSourceAriaLabel: /* @__PURE__ */ __name(function moveToSourceAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveToSource : void 0; - }, "moveToSourceAriaLabel"), - moveAllToSourceAriaLabel: /* @__PURE__ */ __name(function moveAllToSourceAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.moveAllToSource : void 0; - }, "moveAllToSourceAriaLabel") - }, - components: { - Listbox: script$1N, - Button: script$1d, - AngleRightIcon: script$1o, - AngleLeftIcon: script$1Q, - AngleDownIcon: script$1G, - AngleUpIcon: script$1O, - AngleDoubleRightIcon: script$1R, - AngleDoubleLeftIcon: script$1S, - AngleDoubleDownIcon: script$u, - AngleDoubleUpIcon: script$t - }, - directives: { - ripple: Ripple - } -}; -function _typeof$9(o) { - "@babel/helpers - typeof"; - return _typeof$9 = "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$9(o); -} -__name(_typeof$9, "_typeof$9"); -function ownKeys$8(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$8, "ownKeys$8"); -function _objectSpread$8(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$8(Object(t2), true).forEach(function(r2) { - _defineProperty$9(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$8(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$8, "_objectSpread$8"); -function _defineProperty$9(e, r, t2) { - return (r = _toPropertyKey$9(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$9, "_defineProperty$9"); -function _toPropertyKey$9(t2) { - var i = _toPrimitive$9(t2, "string"); - return "symbol" == _typeof$9(i) ? i : i + ""; -} -__name(_toPropertyKey$9, "_toPropertyKey$9"); -function _toPrimitive$9(t2, r) { - if ("object" != _typeof$9(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$9(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$9, "_toPrimitive$9"); -function render$j(_ctx, _cache, $props, $setup, $data, $options) { - var _component_AngleUpIcon = resolveComponent("AngleUpIcon"); - var _component_Button = resolveComponent("Button"); - var _component_AngleDoubleUpIcon = resolveComponent("AngleDoubleUpIcon"); - var _component_AngleDownIcon = resolveComponent("AngleDownIcon"); - var _component_AngleDoubleDownIcon = resolveComponent("AngleDoubleDownIcon"); - var _component_Listbox = resolveComponent("Listbox"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [_ctx.showSourceControls ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("sourceControls") - }, _ctx.ptm("sourceControls"), { - "data-pc-group-section": "controls" - }), [renderSlot(_ctx.$slots, "sourcecontrolsstart"), createVNode(_component_Button, mergeProps({ - "aria-label": $options.moveUpAriaLabel, - disabled: $options.moveDisabled(0), - onClick: _cache[0] || (_cache[0] = function($event) { - return $options.moveUp($event, 0); - }) - }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveUpButtonProps), { - pt: _ctx.ptm("pcSourceMoveUpButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "moveupicon", {}, function() { - return [createVNode(_component_AngleUpIcon, mergeProps(_ctx.ptm("pcSourceMoveUpButton")["icon"], { - "data-pc-section": "moveupicon" - }), null, 16)]; - })]; - }), - _: 3 - }, 16, ["aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ - "aria-label": $options.moveTopAriaLabel, - disabled: $options.moveDisabled(0), - onClick: _cache[1] || (_cache[1] = function($event) { - return $options.moveTop($event, 0); - }) - }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveTopButtonProps), { - pt: _ctx.ptm("pcSourceMoveTopButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "movetopicon", {}, function() { - return [createVNode(_component_AngleDoubleUpIcon, mergeProps(_ctx.ptm("pcSourceMoveTopButton")["icon"], { - "data-pc-section": "movetopicon" - }), null, 16)]; - })]; - }), - _: 3 - }, 16, ["aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ - "aria-label": $options.moveDownAriaLabel, - disabled: $options.moveDisabled(0), - onClick: _cache[2] || (_cache[2] = function($event) { - return $options.moveDown($event, 0); - }) - }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveDownButtonProps), { - pt: _ctx.ptm("pcSourceMoveDownButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "movedownicon", {}, function() { - return [createVNode(_component_AngleDownIcon, mergeProps(_ctx.ptm("pcSourceMoveDownButton")["icon"], { - "data-pc-section": "movedownicon" - }), null, 16)]; - })]; - }), - _: 3 - }, 16, ["aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ - "aria-label": $options.moveBottomAriaLabel, - disabled: $options.moveDisabled(0), - onClick: _cache[3] || (_cache[3] = function($event) { - return $options.moveBottom($event, 0); - }) - }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveBottomButtonProps), { - pt: _ctx.ptm("pcSourceMoveBottomButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "movebottomicon", {}, function() { - return [createVNode(_component_AngleDoubleDownIcon, mergeProps(_ctx.ptm("pcSourceMoveBottomButton")["icon"], { - "data-pc-section": "movebottomicon" - }), null, 16)]; - })]; - }), - _: 3 - }, 16, ["aria-label", "disabled", "pt", "unstyled"]), renderSlot(_ctx.$slots, "sourcecontrolsend")], 16)) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("sourceListContainer") - }, _ctx.ptm("sourceListContainer"), { - "data-pc-group-section": "listcontainer" - }), [createVNode(_component_Listbox, { - ref: "sourceList", - id: $options.idSource + "_list", - modelValue: $data.d_selection[0], - options: $options.sourceList, - multiple: "", - metaKeySelection: _ctx.metaKeySelection, - listStyle: _ctx.listStyle, - scrollHeight: _ctx.scrollHeight, - tabindex: $options.sourceList && $options.sourceList.length > 0 ? _ctx.tabindex : -1, - dataKey: _ctx.dataKey, - autoOptionFocus: _ctx.autoOptionFocus, - focusOnHover: _ctx.focusOnHover, - striped: _ctx.striped, - disabled: _ctx.disabled, - pt: _ctx.ptm("pcListbox"), - unstyled: _ctx.unstyled, - onFocus: _cache[4] || (_cache[4] = function($event) { - return $options.onListFocus($event, "sourceList"); - }), - onBlur: _cache[5] || (_cache[5] = function($event) { - return $options.onListBlur($event, "sourceList"); - }), - onChange: _cache[6] || (_cache[6] = function($event) { - return $options.onChangeSelection($event, 0); - }), - onItemDblclick: _cache[7] || (_cache[7] = function($event) { - return $options.onItemDblClick($event, 0); - }), - "data-pc-group-section": "list" - }, createSlots({ - option: withCtx(function(_ref) { - var option4 = _ref.option, selected3 = _ref.selected, index = _ref.index; - return [renderSlot(_ctx.$slots, _ctx.$slots.option ? "option" : "item", { - item: option4, - option: option4, - selected: selected3, - index - })]; - }), - _: 2 - }, [_ctx.$slots.sourceheader ? { - name: "header", - fn: withCtx(function() { - return [renderSlot(_ctx.$slots, "sourceheader")]; - }), - key: "0" - } : void 0]), 1032, ["id", "modelValue", "options", "metaKeySelection", "listStyle", "scrollHeight", "tabindex", "dataKey", "autoOptionFocus", "focusOnHover", "striped", "disabled", "pt", "unstyled"])], 16), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("transferControls") - }, _ctx.ptm("transferControls"), { - "data-pc-group-section": "controls" - }), [renderSlot(_ctx.$slots, "movecontrolsstart"), createVNode(_component_Button, mergeProps({ - "aria-label": $options.moveToTargetAriaLabel, - onClick: $options.moveToTarget, - disabled: $options.moveDisabled(0) - }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveToTargetProps), { - pt: _ctx.ptm("pcMoveToTargetButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "movetotargeticon", { - viewChanged: $data.viewChanged - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent($data.viewChanged ? "AngleDownIcon" : "AngleRightIcon"), mergeProps(_ctx.ptm("pcMoveToTargetButton")["icon"], { - "data-pc-section": "movetotargeticon" - }), null, 16))]; - })]; - }), - _: 3 - }, 16, ["aria-label", "onClick", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ - "aria-label": $options.moveAllToTargetAriaLabel, - onClick: $options.moveAllToTarget, - disabled: $options.moveAllDisabled("sourceList") - }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveAllToTargetProps), { - pt: _ctx.ptm("pcMoveAllToTargetButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "movealltotargeticon", { - viewChanged: $data.viewChanged - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent($data.viewChanged ? "AngleDoubleDownIcon" : "AngleDoubleRightIcon"), mergeProps(_ctx.ptm("pcMoveAllToTargetButton")["icon"], { - "data-pc-section": "movealltotargeticon" - }), null, 16))]; - })]; - }), - _: 3 - }, 16, ["aria-label", "onClick", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ - "aria-label": $options.moveToSourceAriaLabel, - onClick: $options.moveToSource, - disabled: $options.moveDisabled(1) - }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveToSourceProps), { - pt: _ctx.ptm("pcMoveToSourceButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "movetosourceicon", { - viewChanged: $data.viewChanged - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent($data.viewChanged ? "AngleUpIcon" : "AngleLeftIcon"), mergeProps(_ctx.ptm("pcMoveToSourceButton")["icon"], { - "data-pc-section": "movetosourceicon" - }), null, 16))]; - })]; - }), - _: 3 - }, 16, ["aria-label", "onClick", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ - "aria-label": $options.moveAllToSourceAriaLabel, - onClick: $options.moveAllToSource, - disabled: $options.moveAllDisabled("targetList") - }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveAllToSourceProps), { - pt: _ctx.ptm("pcMoveAllToSourceButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "movealltosourceicon", { - viewChanged: $data.viewChanged - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent($data.viewChanged ? "AngleDoubleUpIcon" : "AngleDoubleLeftIcon"), mergeProps(_ctx.ptm("pcMoveAllToSourceButton")["icon"], { - "data-pc-section": "movealltosourceicon" - }), null, 16))]; - })]; - }), - _: 3 - }, 16, ["aria-label", "onClick", "disabled", "pt", "unstyled"]), renderSlot(_ctx.$slots, "movecontrolsend")], 16), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("targetListContainer") - }, _ctx.ptm("targetListContainer"), { - "data-pc-group-section": "listcontainer" - }), [createVNode(_component_Listbox, { - ref: "targetList", - id: $options.idTarget + "_list", - modelValue: $data.d_selection[1], - options: $options.targetList, - multiple: "", - metaKeySelection: _ctx.metaKeySelection, - listStyle: _ctx.listStyle, - scrollHeight: _ctx.scrollHeight, - tabindex: $options.targetList && $options.targetList.length > 0 ? _ctx.tabindex : -1, - dataKey: _ctx.dataKey, - autoOptionFocus: _ctx.autoOptionFocus, - focusOnHover: _ctx.focusOnHover, - striped: _ctx.striped, - disabled: _ctx.disabled, - pt: _ctx.ptm("pcListbox"), - unstyled: _ctx.unstyled, - onFocus: _cache[8] || (_cache[8] = function($event) { - return $options.onListFocus($event, "targetList"); - }), - onBlur: _cache[9] || (_cache[9] = function($event) { - return $options.onListBlur($event, "targetList"); - }), - onChange: _cache[10] || (_cache[10] = function($event) { - return $options.onChangeSelection($event, 1); - }), - onItemDblclick: _cache[11] || (_cache[11] = function($event) { - return $options.onItemDblClick($event, 1); - }), - "data-pc-group-section": "list" - }, createSlots({ - option: withCtx(function(_ref2) { - var option4 = _ref2.option, selected3 = _ref2.selected, index = _ref2.index; - return [renderSlot(_ctx.$slots, _ctx.$slots.option ? "option" : "item", { - item: option4, - option: option4, - selected: selected3, - index - })]; - }), - _: 2 - }, [_ctx.$slots.targetheader ? { - name: "header", - fn: withCtx(function() { - return [renderSlot(_ctx.$slots, "targetheader")]; - }), - key: "0" - } : void 0]), 1032, ["id", "modelValue", "options", "metaKeySelection", "listStyle", "scrollHeight", "tabindex", "dataKey", "autoOptionFocus", "focusOnHover", "striped", "disabled", "pt", "unstyled"])], 16), _ctx.showTargetControls ? (openBlock(), createElementBlock("div", mergeProps({ - key: 1, - "class": _ctx.cx("targetControls") - }, _ctx.ptm("targetControls"), { - "data-pc-group-section": "controls" - }), [renderSlot(_ctx.$slots, "targetcontrolsstart"), createVNode(_component_Button, mergeProps({ - "aria-label": $options.moveUpAriaLabel, - disabled: $options.moveDisabled(1), - onClick: _cache[12] || (_cache[12] = function($event) { - return $options.moveUp($event, 1); - }) - }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveUpButtonProps), { - pt: _ctx.ptm("pcTargetMoveUpButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "moveupicon", {}, function() { - return [createVNode(_component_AngleUpIcon, mergeProps(_ctx.ptm("pcTargetMoveUpButton")["icon"], { - "data-pc-section": "moveupicon" - }), null, 16)]; - })]; - }), - _: 3 - }, 16, ["aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ - "aria-label": $options.moveTopAriaLabel, - disabled: $options.moveDisabled(1), - onClick: _cache[13] || (_cache[13] = function($event) { - return $options.moveTop($event, 1); - }) - }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveTopButtonProps), { - pt: _ctx.ptm("pcTargetMoveTopButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "movetopicon", {}, function() { - return [createVNode(_component_AngleDoubleUpIcon, mergeProps(_ctx.ptm("pcTargetMoveTopButton")["icon"], { - "data-pc-section": "movetopicon" - }), null, 16)]; - })]; - }), - _: 3 - }, 16, ["aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ - "aria-label": $options.moveDownAriaLabel, - disabled: $options.moveDisabled(1), - onClick: _cache[14] || (_cache[14] = function($event) { - return $options.moveDown($event, 1); - }) - }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveDownButtonProps), { - pt: _ctx.ptm("pcTargetMoveDownButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "movedownicon", {}, function() { - return [createVNode(_component_AngleDownIcon, mergeProps(_ctx.ptm("pcTargetMoveDownButton")["icon"], { - "data-pc-section": "movedownicon" - }), null, 16)]; - })]; - }), - _: 3 - }, 16, ["aria-label", "disabled", "pt", "unstyled"]), createVNode(_component_Button, mergeProps({ - "aria-label": $options.moveBottomAriaLabel, - disabled: $options.moveDisabled(1), - onClick: _cache[15] || (_cache[15] = function($event) { - return $options.moveBottom($event, 1); - }) - }, _objectSpread$8(_objectSpread$8({}, _ctx.buttonProps), _ctx.moveBottomButtonProps), { - pt: _ctx.ptm("pcTargetMoveBottomButton"), - unstyled: _ctx.unstyled - }), { - icon: withCtx(function() { - return [renderSlot(_ctx.$slots, "movebottomicon", {}, function() { - return [createVNode(_component_AngleDoubleDownIcon, mergeProps(_ctx.ptm("pcTargetMoveBottomButton")["icon"], { - "data-pc-section": "movebottomicon" - }), null, 16)]; - })]; - }), - _: 3 - }, 16, ["aria-label", "disabled", "pt", "unstyled"]), renderSlot(_ctx.$slots, "targetcontrolsend")], 16)) : createCommentVNode("", true)], 16); -} -__name(render$j, "render$j"); -script$m.render = render$j; -var PortalStyle = BaseStyle.extend({ - name: "portal" -}); -var theme$a = /* @__PURE__ */ __name(function theme29(_ref) { - _ref.dt; - return "\n.p-radiobutton-group {\n display: inline-flex;\n}\n"; -}, "theme"); -var classes$b = { - root: "p-radiobutton-group p-component" -}; -var RadioButtonGroupStyle = BaseStyle.extend({ - name: "radiobuttongroup", - theme: theme$a, - classes: classes$b -}); -var script$1$b = { - name: "BaseRadioButtonGroup", - "extends": script$1r, - style: RadioButtonGroupStyle, - provide: /* @__PURE__ */ __name(function provide39() { - return { - $pcRadioButtonGroup: this, - $parentInstance: this - }; - }, "provide") -}; -var script$l = { - name: "RadioButtonGroup", - "extends": script$1$b, - inheritAttrs: false, - data: /* @__PURE__ */ __name(function data28() { - return { - groupName: this.name - }; - }, "data"), - watch: { - name: /* @__PURE__ */ __name(function name2(newValue) { - this.groupName = newValue || uuid("radiobutton-group-"); - }, "name") - }, - mounted: /* @__PURE__ */ __name(function mounted30() { - this.groupName = this.groupName || uuid("radiobutton-group-"); - }, "mounted") -}; -function render$i(_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$i, "render$i"); -script$l.render = render$i; -var script$k = { - name: "BanIcon", - "extends": script$1j -}; -function render$h(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - d: "M7 0C5.61553 0 4.26215 0.410543 3.11101 1.17971C1.95987 1.94888 1.06266 3.04213 0.532846 4.32122C0.00303296 5.6003 -0.13559 7.00776 0.134506 8.36563C0.404603 9.7235 1.07129 10.9708 2.05026 11.9497C3.02922 12.9287 4.2765 13.5954 5.63437 13.8655C6.99224 14.1356 8.3997 13.997 9.67879 13.4672C10.9579 12.9373 12.0511 12.0401 12.8203 10.889C13.5895 9.73785 14 8.38447 14 7C14 5.14348 13.2625 3.36301 11.9497 2.05025C10.637 0.737498 8.85652 0 7 0ZM1.16667 7C1.16549 5.65478 1.63303 4.35118 2.48889 3.31333L10.6867 11.5111C9.83309 12.2112 8.79816 12.6544 7.70243 12.789C6.60669 12.9236 5.49527 12.744 4.49764 12.2713C3.50001 11.7986 2.65724 11.0521 2.06751 10.1188C1.47778 9.18558 1.16537 8.10397 1.16667 7ZM11.5111 10.6867L3.31334 2.48889C4.43144 1.57388 5.84966 1.10701 7.29265 1.1789C8.73565 1.2508 10.1004 1.85633 11.1221 2.87795C12.1437 3.89956 12.7492 5.26435 12.8211 6.70735C12.893 8.15034 12.4261 9.56856 11.5111 10.6867Z", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$h, "render$h"); -script$k.render = render$h; -var script$j = { - name: "StarIcon", - "extends": script$1j -}; -function render$g(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - d: "M10.9741 13.6721C10.8806 13.6719 10.7886 13.6483 10.7066 13.6033L7.00002 11.6545L3.29345 13.6033C3.19926 13.6539 3.09281 13.6771 2.98612 13.6703C2.87943 13.6636 2.77676 13.6271 2.6897 13.5651C2.60277 13.5014 2.53529 13.4147 2.4948 13.3148C2.45431 13.215 2.44241 13.1058 2.46042 12.9995L3.17881 8.87264L0.167699 5.95324C0.0922333 5.8777 0.039368 5.78258 0.0150625 5.67861C-0.00924303 5.57463 -0.00402231 5.46594 0.030136 5.36477C0.0621323 5.26323 0.122141 5.17278 0.203259 5.10383C0.284377 5.03488 0.383311 4.99023 0.488681 4.97501L4.63087 4.37126L6.48797 0.618832C6.54083 0.530159 6.61581 0.456732 6.70556 0.405741C6.79532 0.35475 6.89678 0.327942 7.00002 0.327942C7.10325 0.327942 7.20471 0.35475 7.29447 0.405741C7.38422 0.456732 7.4592 0.530159 7.51206 0.618832L9.36916 4.37126L13.5114 4.97501C13.6167 4.99023 13.7157 5.03488 13.7968 5.10383C13.8779 5.17278 13.9379 5.26323 13.9699 5.36477C14.0041 5.46594 14.0093 5.57463 13.985 5.67861C13.9607 5.78258 13.9078 5.8777 13.8323 5.95324L10.8212 8.87264L11.532 12.9995C11.55 13.1058 11.5381 13.215 11.4976 13.3148C11.4571 13.4147 11.3896 13.5014 11.3027 13.5651C11.2059 13.632 11.0917 13.6692 10.9741 13.6721ZM7.00002 10.4393C7.09251 10.4404 7.18371 10.4613 7.2675 10.5005L10.2098 12.029L9.65193 8.75036C9.6368 8.6584 9.64343 8.56418 9.6713 8.47526C9.69918 8.38633 9.74751 8.30518 9.81242 8.23832L12.1969 5.94559L8.90298 5.45648C8.81188 5.44198 8.72555 5.406 8.65113 5.35152C8.57671 5.29703 8.51633 5.2256 8.475 5.14314L7.00002 2.1626L5.52503 5.15078C5.4837 5.23324 5.42332 5.30467 5.3489 5.35916C5.27448 5.41365 5.18815 5.44963 5.09705 5.46412L1.80318 5.94559L4.18761 8.23832C4.25252 8.30518 4.30085 8.38633 4.32873 8.47526C4.3566 8.56418 4.36323 8.6584 4.3481 8.75036L3.7902 12.0519L6.73253 10.5234C6.81451 10.4762 6.9058 10.4475 7.00002 10.4393Z", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$g, "render$g"); -script$j.render = render$g; -var script$i = { - name: "StarFillIcon", - "extends": script$1j -}; -function render$f(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - d: "M13.9718 5.36453C13.9398 5.26298 13.8798 5.17252 13.7986 5.10356C13.7175 5.0346 13.6186 4.98994 13.5132 4.97472L9.37043 4.37088L7.51307 0.617955C7.46021 0.529271 7.38522 0.455834 7.29545 0.404836C7.20568 0.353838 7.1042 0.327026 7.00096 0.327026C6.89771 0.327026 6.79624 0.353838 6.70647 0.404836C6.6167 0.455834 6.54171 0.529271 6.48885 0.617955L4.63149 4.37088L0.488746 4.97472C0.383363 4.98994 0.284416 5.0346 0.203286 5.10356C0.122157 5.17252 0.0621407 5.26298 0.03014 5.36453C-0.00402286 5.46571 -0.00924428 5.57442 0.0150645 5.67841C0.0393733 5.7824 0.0922457 5.87753 0.167722 5.95308L3.17924 8.87287L2.4684 13.0003C2.45038 13.1066 2.46229 13.2158 2.50278 13.3157C2.54328 13.4156 2.61077 13.5022 2.6977 13.5659C2.78477 13.628 2.88746 13.6644 2.99416 13.6712C3.10087 13.678 3.20733 13.6547 3.30153 13.6042L7.00096 11.6551L10.708 13.6042C10.79 13.6491 10.882 13.6728 10.9755 13.673C11.0958 13.6716 11.2129 13.6343 11.3119 13.5659C11.3988 13.5022 11.4663 13.4156 11.5068 13.3157C11.5473 13.2158 11.5592 13.1066 11.5412 13.0003L10.8227 8.87287L13.8266 5.95308C13.9033 5.87835 13.9577 5.7836 13.9833 5.67957C14.009 5.57554 14.005 5.4664 13.9718 5.36453Z", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$f, "render$f"); -script$i.render = render$f; -var theme$9 = /* @__PURE__ */ __name(function theme30(_ref) { - var dt = _ref.dt; - return "\n.p-rating {\n position: relative;\n display: flex;\n align-items: center;\n gap: ".concat(dt("rating.gap"), ";\n}\n\n.p-rating-option {\n display: inline-flex;\n align-items: center;\n cursor: pointer;\n outline-color: transparent;\n border-radius: 50%;\n transition: background ").concat(dt("rating.transition.duration"), ", color ").concat(dt("rating.transition.duration"), ", border-color ").concat(dt("rating.transition.duration"), ", outline-color ").concat(dt("rating.transition.duration"), ", box-shadow ").concat(dt("rating.transition.duration"), ";\n}\n\n.p-rating-option.p-focus-visible {\n box-shadow: ").concat(dt("rating.focus.ring.shadow"), ";\n outline: ").concat(dt("rating.focus.ring.width"), " ").concat(dt("rating.focus.ring.style"), " ").concat(dt("rating.focus.ring.color"), ";\n outline-offset: ").concat(dt("rating.focus.ring.offset"), ";\n}\n\n.p-rating-icon {\n color: ").concat(dt("rating.icon.color"), ";\n transition: background ").concat(dt("rating.transition.duration"), ", color ").concat(dt("rating.transition.duration"), ", border-color ").concat(dt("rating.transition.duration"), ", outline-color ").concat(dt("rating.transition.duration"), ", box-shadow ").concat(dt("rating.transition.duration"), ";\n font-size: ").concat(dt("rating.icon.size"), ";\n width: ").concat(dt("rating.icon.size"), ";\n height: ").concat(dt("rating.icon.size"), ";\n}\n\n.p-rating:not(.p-disabled):not(.p-readonly) .p-rating-option:hover .p-rating-icon {\n color: ").concat(dt("rating.icon.hover.color"), ";\n}\n\n.p-rating-option-active .p-rating-icon {\n color: ").concat(dt("rating.icon.active.color"), ";\n}\n\n.p-rating-icon.p-invalid { /* @todo */\n stroke: ").concat(dt("rating.invalid.icon.color"), ";\n}\n"); -}, "theme"); -var classes$a = { - root: /* @__PURE__ */ __name(function root23(_ref2) { - var props = _ref2.props; - return ["p-rating", { - "p-readonly": props.readonly, - "p-disabled": props.disabled - }]; - }, "root"), - option: /* @__PURE__ */ __name(function option3(_ref3) { - var instance = _ref3.instance, value2 = _ref3.value; - return ["p-rating-option", { - "p-rating-option-active": value2 <= instance.d_value, - "p-focus-visible": value2 === instance.focusedOptionIndex && instance.isFocusVisibleItem - }]; - }, "option"), - onIcon: /* @__PURE__ */ __name(function onIcon(_ref4) { - var instance = _ref4.instance; - return ["p-rating-icon p-rating-on-icon", { - "p-invalid": instance.$invalid - }]; - }, "onIcon"), - offIcon: /* @__PURE__ */ __name(function offIcon(_ref5) { - var instance = _ref5.instance; - return ["p-rating-icon p-rating-off-icon", { - "p-invalid": instance.$invalid - }]; - }, "offIcon") -}; -var RatingStyle = BaseStyle.extend({ - name: "rating", - theme: theme$9, - classes: classes$a -}); -var script$1$a = { - name: "BaseRating", - "extends": script$1r, - props: { - readonly: { - type: Boolean, - "default": false - }, - stars: { - type: Number, - "default": 5 - }, - onIcon: { - type: String, - "default": void 0 - }, - offIcon: { - type: String, - "default": void 0 - } - }, - style: RatingStyle, - provide: /* @__PURE__ */ __name(function provide40() { - return { - $pcRating: this, - $parentInstance: this - }; - }, "provide") -}; -var script$h = { - name: "Rating", - "extends": script$1$a, - inheritAttrs: false, - emits: ["change", "focus", "blur"], - data: /* @__PURE__ */ __name(function data29() { - return { - d_name: this.name, - focusedOptionIndex: -1, - isFocusVisibleItem: true - }; - }, "data"), - watch: { - name: /* @__PURE__ */ __name(function name3(newValue) { - this.d_name = newValue || UniqueComponentId(); - }, "name") - }, - mounted: /* @__PURE__ */ __name(function mounted31() { - this.d_name = this.d_name || UniqueComponentId(); - }, "mounted"), - methods: { - getPTOptions: /* @__PURE__ */ __name(function getPTOptions9(key, value2) { - return this.ptm(key, { - context: { - active: value2 <= this.d_value, - focused: value2 === this.focusedOptionIndex - } - }); - }, "getPTOptions"), - onOptionClick: /* @__PURE__ */ __name(function onOptionClick3(event2, value2) { - if (!this.readonly && !this.disabled) { - this.onOptionSelect(event2, value2); - this.isFocusVisibleItem = false; - var firstFocusableEl = getFirstFocusableElement(event2.currentTarget); - firstFocusableEl && focus(firstFocusableEl); - } - }, "onOptionClick"), - onFocus: /* @__PURE__ */ __name(function onFocus12(event2, value2) { - this.focusedOptionIndex = value2; - this.$emit("focus", event2); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur12(event2) { - var _this$formField$onBlu, _this$formField; - this.focusedOptionIndex = -1; - this.$emit("blur", event2); - (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField); - }, "onBlur"), - onChange: /* @__PURE__ */ __name(function onChange(event2, value2) { - this.onOptionSelect(event2, value2); - this.isFocusVisibleItem = true; - }, "onChange"), - onOptionSelect: /* @__PURE__ */ __name(function onOptionSelect3(event2, value2) { - if (this.focusedOptionIndex === value2 || this.d_value === value2) { - this.focusedOptionIndex = -1; - this.updateModel(event2, null); - } else { - this.focusedOptionIndex = value2; - this.updateModel(event2, value2 || null); - } - }, "onOptionSelect"), - updateModel: /* @__PURE__ */ __name(function updateModel7(event2, value2) { - this.writeValue(value2, event2); - this.$emit("change", { - originalEvent: event2, - value: value2 - }); - }, "updateModel"), - starAriaLabel: /* @__PURE__ */ __name(function starAriaLabel(value2) { - return value2 === 1 ? this.$primevue.config.locale.aria.star : this.$primevue.config.locale.aria.stars.replace(/{star}/g, value2); - }, "starAriaLabel") - }, - components: { - StarFillIcon: script$i, - StarIcon: script$j, - BanIcon: script$k - } -}; -var _hoisted_1$b = ["onClick", "data-p-active", "data-p-focused"]; -var _hoisted_2$8 = ["value", "name", "checked", "disabled", "readonly", "aria-label", "onFocus", "onChange"]; -function render$e(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.stars, function(value2) { - return openBlock(), createElementBlock("div", mergeProps({ - key: value2, - "class": _ctx.cx("option", { - value: value2 - }), - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return $options.onOptionClick($event, value2); - }, "onClick"), - ref_for: true - }, $options.getPTOptions("option", value2), { - "data-p-active": value2 <= _ctx.d_value, - "data-p-focused": value2 === $data.focusedOptionIndex - }), [createBaseVNode("span", mergeProps({ - "class": "p-hidden-accessible", - ref_for: true - }, _ctx.ptm("hiddenOptionInputContainer"), { - "data-p-hidden-accessible": true - }), [createBaseVNode("input", mergeProps({ - type: "radio", - value: value2, - name: $data.d_name, - checked: _ctx.d_value === value2, - disabled: _ctx.disabled, - readonly: _ctx.readonly, - "aria-label": $options.starAriaLabel(value2), - onFocus: /* @__PURE__ */ __name(function onFocus15($event) { - return $options.onFocus($event, value2); - }, "onFocus"), - onBlur: _cache[0] || (_cache[0] = function() { - return $options.onBlur && $options.onBlur.apply($options, arguments); - }), - onChange: /* @__PURE__ */ __name(function onChange2($event) { - return $options.onChange($event, value2); - }, "onChange"), - ref_for: true - }, _ctx.ptm("hiddenOptionInput")), null, 16, _hoisted_2$8)], 16), value2 <= _ctx.d_value ? renderSlot(_ctx.$slots, "onicon", { - key: 0, - value: value2, - "class": normalizeClass(_ctx.cx("onIcon")) - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.onIcon ? "span" : "StarFillIcon"), mergeProps({ - "class": [_ctx.cx("onIcon"), _ctx.onIcon], - ref_for: true - }, _ctx.ptm("onIcon")), null, 16, ["class"]))]; - }) : renderSlot(_ctx.$slots, "officon", { - key: 1, - value: value2, - "class": normalizeClass(_ctx.cx("offIcon")) - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.offIcon ? "span" : "StarIcon"), mergeProps({ - "class": [_ctx.cx("offIcon"), _ctx.offIcon], - ref_for: true - }, _ctx.ptm("offIcon")), null, 16, ["class"]))]; - })], 16, _hoisted_1$b); - }), 128))], 16); -} -__name(render$e, "render$e"); -script$h.render = render$e; -var script$g = { - name: "Row", - "extends": script$1f, - inject: ["$rows"], - mounted: /* @__PURE__ */ __name(function mounted32() { - var _this$$rows; - (_this$$rows = this.$rows) === null || _this$$rows === void 0 || _this$$rows.add(this.$); - }, "mounted"), - unmounted: /* @__PURE__ */ __name(function unmounted4() { - var _this$$rows2; - (_this$$rows2 = this.$rows) === null || _this$$rows2 === void 0 || _this$$rows2["delete"](this.$); - }, "unmounted"), - render: /* @__PURE__ */ __name(function render2() { - return null; - }, "render") -}; -var RowStyle = BaseStyle.extend({ - name: "row" -}); -var theme$8 = /* @__PURE__ */ __name(function theme31(_ref) { - _ref.dt; - return "\n.p-scrolltop.p-button {\n position: fixed !important;\n inset-block-end: 20px;\n inset-inline-end: 20px;\n}\n\n.p-scrolltop-sticky.p-button {\n position: sticky !important;\n display: flex;\n margin-inline-start: auto;\n}\n\n.p-scrolltop-enter-from {\n opacity: 0;\n}\n\n.p-scrolltop-enter-active {\n transition: opacity 0.15s;\n}\n\n.p-scrolltop.p-scrolltop-leave-to {\n opacity: 0;\n}\n\n.p-scrolltop-leave-active {\n transition: opacity 0.15s;\n}\n"; -}, "theme"); -var classes$9 = { - root: /* @__PURE__ */ __name(function root24(_ref2) { - var props = _ref2.props; - return ["p-scrolltop", { - "p-scrolltop-sticky": props.target !== "window" - }]; - }, "root"), - icon: "p-scrolltop-icon" -}; -var ScrollTopStyle = BaseStyle.extend({ - name: "scrolltop", - theme: theme$8, - classes: classes$9 -}); -var script$1$9 = { - name: "BaseScrollTop", - "extends": script$1f, - props: { - target: { - type: String, - "default": "window" - }, - threshold: { - type: Number, - "default": 400 - }, - icon: { - type: String, - "default": void 0 - }, - behavior: { - type: String, - "default": "smooth" - }, - buttonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default16() { - return { - rounded: true - }; - }, "_default") - } - }, - style: ScrollTopStyle, - provide: /* @__PURE__ */ __name(function provide41() { - return { - $pcScrollTop: this, - $parentInstance: this - }; - }, "provide") -}; -var script$f = { - name: "ScrollTop", - "extends": script$1$9, - inheritAttrs: false, - scrollListener: null, - container: null, - data: /* @__PURE__ */ __name(function data30() { - return { - visible: false - }; - }, "data"), - mounted: /* @__PURE__ */ __name(function mounted33() { - if (this.target === "window") this.bindDocumentScrollListener(); - else if (this.target === "parent") this.bindParentScrollListener(); - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount13() { - if (this.target === "window") this.unbindDocumentScrollListener(); - else if (this.target === "parent") this.unbindParentScrollListener(); - if (this.container) { - ZIndex.clear(this.container); - this.overlay = null; - } - }, "beforeUnmount"), - methods: { - onClick: /* @__PURE__ */ __name(function onClick5() { - var scrollElement = this.target === "window" ? window : this.$el.parentElement; - scrollElement.scroll({ - top: 0, - behavior: this.behavior - }); - }, "onClick"), - checkVisibility: /* @__PURE__ */ __name(function checkVisibility(scrollY) { - if (scrollY > this.threshold) this.visible = true; - else this.visible = false; - }, "checkVisibility"), - bindParentScrollListener: /* @__PURE__ */ __name(function bindParentScrollListener() { - var _this = this; - this.scrollListener = function() { - _this.checkVisibility(_this.$el.parentElement.scrollTop); - }; - this.$el.parentElement.addEventListener("scroll", this.scrollListener); - }, "bindParentScrollListener"), - bindDocumentScrollListener: /* @__PURE__ */ __name(function bindDocumentScrollListener() { - var _this2 = this; - this.scrollListener = function() { - _this2.checkVisibility(getWindowScrollTop()); - }; - window.addEventListener("scroll", this.scrollListener); - }, "bindDocumentScrollListener"), - unbindParentScrollListener: /* @__PURE__ */ __name(function unbindParentScrollListener() { - if (this.scrollListener) { - this.$el.parentElement.removeEventListener("scroll", this.scrollListener); - this.scrollListener = null; - } - }, "unbindParentScrollListener"), - unbindDocumentScrollListener: /* @__PURE__ */ __name(function unbindDocumentScrollListener() { - if (this.scrollListener) { - window.removeEventListener("scroll", this.scrollListener); - this.scrollListener = null; - } - }, "unbindDocumentScrollListener"), - onEnter: /* @__PURE__ */ __name(function onEnter3(el) { - ZIndex.set("overlay", el, this.$primevue.config.zIndex.overlay); - }, "onEnter"), - onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave3(el) { - ZIndex.clear(el); - }, "onAfterLeave"), - containerRef: /* @__PURE__ */ __name(function containerRef4(el) { - this.container = el ? el.$el : void 0; - }, "containerRef") - }, - computed: { - scrollTopAriaLabel: /* @__PURE__ */ __name(function scrollTopAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.scrollTop : void 0; - }, "scrollTopAriaLabel") - }, - components: { - ChevronUpIcon: script$1g, - Button: script$1d - } -}; -function render$d(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Button = resolveComponent("Button"); - return openBlock(), createBlock(Transition, mergeProps({ - name: "p-scrolltop", - appear: "", - onEnter: $options.onEnter, - onAfterLeave: $options.onAfterLeave - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [$data.visible ? (openBlock(), createBlock(_component_Button, mergeProps({ - key: 0, - ref: $options.containerRef, - "class": _ctx.cx("root"), - onClick: $options.onClick, - "aria-label": $options.scrollTopAriaLabel, - unstyled: _ctx.unstyled - }, _ctx.buttonProps, { - pt: _ctx.pt - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "icon", { - "class": normalizeClass(_ctx.cx("icon")) - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon ? "span" : "ChevronUpIcon"), mergeProps({ - "class": [_ctx.cx("icon"), _ctx.icon, slotProps["class"]] - }, _ctx.ptm("icon")), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "onClick", "aria-label", "unstyled", "pt"])) : createCommentVNode("", true)]; - }), - _: 3 - }, 16, ["onEnter", "onAfterLeave"]); -} -__name(render$d, "render$d"); -script$f.render = render$d; -var script$e = { - name: "Sidebar", - "extends": script$1T, - mounted: /* @__PURE__ */ __name(function mounted34() { - console.warn("Deprecated since v4. Use Drawer component instead."); - }, "mounted") -}; -var SidebarStyle = BaseStyle.extend({ - name: "sidebar" -}); -var theme$7 = /* @__PURE__ */ __name(function theme32(_ref) { - var dt = _ref.dt; - return "\n.p-skeleton {\n overflow: hidden;\n background: ".concat(dt("skeleton.background"), ";\n border-radius: ").concat(dt("skeleton.border.radius"), ';\n}\n\n.p-skeleton::after {\n content: "";\n animation: p-skeleton-animation 1.2s infinite;\n height: 100%;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n transform: translateX(-100%);\n z-index: 1;\n background: linear-gradient(90deg, rgba(255, 255, 255, 0), ').concat(dt("skeleton.animation.background"), ", rgba(255, 255, 255, 0));\n}\n\n[dir='rtl'] .p-skeleton::after {\n animation-name: p-skeleton-animation-rtl;\n}\n\n.p-skeleton-circle {\n border-radius: 50%;\n}\n\n.p-skeleton-animation-none::after {\n animation: none;\n}\n\n@keyframes p-skeleton-animation {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(100%);\n }\n}\n\n@keyframes p-skeleton-animation-rtl {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(-100%);\n }\n}\n"); -}, "theme"); -var inlineStyles$3 = { - root: { - position: "relative" - } -}; -var classes$8 = { - root: /* @__PURE__ */ __name(function root25(_ref2) { - var props = _ref2.props; - return ["p-skeleton p-component", { - "p-skeleton-circle": props.shape === "circle", - "p-skeleton-animation-none": props.animation === "none" - }]; - }, "root") -}; -var SkeletonStyle = BaseStyle.extend({ - name: "skeleton", - theme: theme$7, - classes: classes$8, - inlineStyles: inlineStyles$3 -}); -var script$1$8 = { - name: "BaseSkeleton", - "extends": script$1f, - props: { - shape: { - type: String, - "default": "rectangle" - }, - size: { - type: String, - "default": null - }, - width: { - type: String, - "default": "100%" - }, - height: { - type: String, - "default": "1rem" - }, - borderRadius: { - type: String, - "default": null - }, - animation: { - type: String, - "default": "wave" - } - }, - style: SkeletonStyle, - provide: /* @__PURE__ */ __name(function provide42() { - return { - $pcSkeleton: this, - $parentInstance: this - }; - }, "provide") -}; -var script$d = { - name: "Skeleton", - "extends": script$1$8, - inheritAttrs: false, - computed: { - containerStyle: /* @__PURE__ */ __name(function containerStyle() { - if (this.size) return { - width: this.size, - height: this.size, - borderRadius: this.borderRadius - }; - else return { - width: this.width, - height: this.height, - borderRadius: this.borderRadius - }; - }, "containerStyle") - } -}; -function render$c(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root"), - style: [_ctx.sx("root"), $options.containerStyle], - "aria-hidden": "true" - }, _ctx.ptmi("root")), null, 16); -} -__name(render$c, "render$c"); -script$d.render = render$c; -function _typeof$8(o) { - "@babel/helpers - typeof"; - return _typeof$8 = "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$8(o); -} -__name(_typeof$8, "_typeof$8"); -function _defineProperty$8(e, r, t2) { - return (r = _toPropertyKey$8(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$8, "_defineProperty$8"); -function _toPropertyKey$8(t2) { - var i = _toPrimitive$8(t2, "string"); - return "symbol" == _typeof$8(i) ? i : i + ""; -} -__name(_toPropertyKey$8, "_toPropertyKey$8"); -function _toPrimitive$8(t2, r) { - if ("object" != _typeof$8(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$8(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$8, "_toPrimitive$8"); -var theme$6 = /* @__PURE__ */ __name(function theme33(_ref) { - var dt = _ref.dt; - return "\n.p-speeddial {\n position: static;\n display: flex;\n gap: ".concat(dt("speeddial.gap"), ";\n}\n\n.p-speeddial-button {\n z-index: 1;\n}\n\n.p-speeddial-button.p-speeddial-rotate {\n transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, background ").concat(dt("speeddial.transition.duration"), ", color ").concat(dt("speeddial.transition.duration"), ", border-color ").concat(dt("speeddial.transition.duration"), ",\n box-shadow ").concat(dt("speeddial.transition.duration"), ", outline-color ").concat(dt("speeddial.transition.duration"), ";\n will-change: transform;\n}\n\n.p-speeddial-list {\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: inset-block-start 0s linear ").concat(dt("speeddial.transition.duration"), ";\n pointer-events: none;\n outline: 0 none;\n z-index: 2;\n gap: ").concat(dt("speeddial.gap"), ";\n}\n\n.p-speeddial-item {\n transform: scale(0);\n opacity: 0;\n transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, opacity 0.8s;\n will-change: transform;\n}\n\n.p-speeddial-circle .p-speeddial-item,\n.p-speeddial-semi-circle .p-speeddial-item,\n.p-speeddial-quarter-circle .p-speeddial-item {\n position: absolute;\n}\n\n.p-speeddial-mask {\n position: absolute;\n inset-inline-start: 0;\n inset-block-start: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n background: ").concat(dt("mask.background"), ";\n border-radius: 6px;\n transition: opacity 150ms;\n}\n\n.p-speeddial-mask-visible {\n pointer-events: none;\n opacity: 1;\n transition: opacity 150ms;\n}\n\n.p-speeddial-open .p-speeddial-list {\n pointer-events: auto;\n}\n\n.p-speeddial-open .p-speeddial-item {\n transform: scale(1);\n opacity: 1;\n}\n\n.p-speeddial-open .p-speeddial-rotate {\n transform: rotate(45deg);\n}\n"); -}, "theme"); -var inlineStyles$2 = { - root: /* @__PURE__ */ __name(function root26(_ref2) { - var props = _ref2.props; - return { - alignItems: (props.direction === "up" || props.direction === "down") && "center", - justifyContent: (props.direction === "left" || props.direction === "right") && "center", - flexDirection: props.direction === "up" ? "column-reverse" : props.direction === "down" ? "column" : props.direction === "left" ? "row-reverse" : props.direction === "right" ? "row" : null - }; - }, "root"), - list: /* @__PURE__ */ __name(function list(_ref3) { - var props = _ref3.props; - return { - flexDirection: props.direction === "up" ? "column-reverse" : props.direction === "down" ? "column" : props.direction === "left" ? "row-reverse" : props.direction === "right" ? "row" : null - }; - }, "list") -}; -var classes$7 = { - root: /* @__PURE__ */ __name(function root27(_ref4) { - var instance = _ref4.instance, props = _ref4.props; - return ["p-speeddial p-component p-speeddial-".concat(props.type), _defineProperty$8(_defineProperty$8(_defineProperty$8({}, "p-speeddial-direction-".concat(props.direction), props.type !== "circle"), "p-speeddial-open", instance.d_visible), "p-disabled", props.disabled)]; - }, "root"), - pcButton: /* @__PURE__ */ __name(function pcButton(_ref6) { - var props = _ref6.props; - return ["p-speeddial-button", { - "p-speeddial-rotate": props.rotateAnimation && !props.hideIcon - }]; - }, "pcButton"), - list: "p-speeddial-list", - item: "p-speeddial-item", - action: "p-speeddial-action", - actionIcon: "p-speeddial-action-icon", - mask: /* @__PURE__ */ __name(function mask2(_ref7) { - var instance = _ref7.instance; - return ["p-speeddial-mask", { - "p-speeddial-mask-visible": instance.d_visible - }]; - }, "mask") -}; -var SpeedDialStyle = BaseStyle.extend({ - name: "speeddial", - theme: theme$6, - classes: classes$7, - inlineStyles: inlineStyles$2 -}); -var script$1$7 = { - name: "BaseSpeedDial", - "extends": script$1f, - props: { - model: null, - visible: { - type: Boolean, - "default": false - }, - direction: { - type: String, - "default": "up" - }, - transitionDelay: { - type: Number, - "default": 30 - }, - type: { - type: String, - "default": "linear" - }, - radius: { - type: Number, - "default": 0 - }, - mask: { - type: Boolean, - "default": false - }, - disabled: { - type: Boolean, - "default": false - }, - hideOnClickOutside: { - type: Boolean, - "default": true - }, - buttonClass: null, - maskStyle: null, - maskClass: null, - showIcon: { - type: String, - "default": void 0 - }, - hideIcon: { - type: String, - "default": void 0 - }, - rotateAnimation: { - type: Boolean, - "default": true - }, - tooltipOptions: null, - style: null, - "class": null, - buttonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default17() { - return { - rounded: true - }; - }, "_default") - }, - actionButtonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default18() { - return { - severity: "secondary", - rounded: true, - size: "small" - }; - }, "_default") - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - } - }, - style: SpeedDialStyle, - provide: /* @__PURE__ */ __name(function provide43() { - return { - $pcSpeedDial: this, - $parentInstance: this - }; - }, "provide") -}; -function _typeof$7(o) { - "@babel/helpers - typeof"; - return _typeof$7 = "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$7(o); -} -__name(_typeof$7, "_typeof$7"); -function ownKeys$7(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$7, "ownKeys$7"); -function _objectSpread$7(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$7(Object(t2), true).forEach(function(r2) { - _defineProperty$7(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$7(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$7, "_objectSpread$7"); -function _defineProperty$7(e, r, t2) { - return (r = _toPropertyKey$7(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$7, "_defineProperty$7"); -function _toPropertyKey$7(t2) { - var i = _toPrimitive$7(t2, "string"); - return "symbol" == _typeof$7(i) ? i : i + ""; -} -__name(_toPropertyKey$7, "_toPropertyKey$7"); -function _toPrimitive$7(t2, r) { - if ("object" != _typeof$7(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$7(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$7, "_toPrimitive$7"); -function _toConsumableArray$3(r) { - return _arrayWithoutHoles$3(r) || _iterableToArray$3(r) || _unsupportedIterableToArray$3(r) || _nonIterableSpread$3(); -} -__name(_toConsumableArray$3, "_toConsumableArray$3"); -function _nonIterableSpread$3() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableSpread$3, "_nonIterableSpread$3"); -function _unsupportedIterableToArray$3(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$3(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$3(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$3, "_unsupportedIterableToArray$3"); -function _iterableToArray$3(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$3, "_iterableToArray$3"); -function _arrayWithoutHoles$3(r) { - if (Array.isArray(r)) return _arrayLikeToArray$3(r); -} -__name(_arrayWithoutHoles$3, "_arrayWithoutHoles$3"); -function _arrayLikeToArray$3(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; -} -__name(_arrayLikeToArray$3, "_arrayLikeToArray$3"); -var Math_PI = 3.14159265358979; -var script$c = { - name: "SpeedDial", - "extends": script$1$7, - inheritAttrs: false, - emits: ["click", "show", "hide", "focus", "blur"], - documentClickListener: null, - container: null, - list: null, - data: /* @__PURE__ */ __name(function data31() { - return { - id: this.$attrs.id, - d_visible: this.visible, - isItemClicked: false, - focused: false, - focusedOptionIndex: -1 - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId12(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId"), - visible: /* @__PURE__ */ __name(function visible4(newValue) { - this.d_visible = newValue; - }, "visible") - }, - mounted: /* @__PURE__ */ __name(function mounted35() { - this.id = this.id || UniqueComponentId(); - if (this.type !== "linear") { - var button = findSingle(this.container, '[data-pc-name="pcbutton"]'); - var firstItem = findSingle(this.list, '[data-pc-section="item"]'); - if (button && firstItem) { - var wDiff = Math.abs(button.offsetWidth - firstItem.offsetWidth); - var hDiff = Math.abs(button.offsetHeight - firstItem.offsetHeight); - this.list.style.setProperty($dt("item.diff.x").name, "".concat(wDiff / 2, "px")); - this.list.style.setProperty($dt("item.diff.y").name, "".concat(hDiff / 2, "px")); - } - } - if (this.hideOnClickOutside) { - this.bindDocumentClickListener(); - } - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount14() { - this.unbindDocumentClickListener(); - }, "beforeUnmount"), - methods: { - getPTOptions: /* @__PURE__ */ __name(function getPTOptions10(id4, key) { - return this.ptm(key, { - context: { - active: this.isItemActive(id4), - hidden: !this.d_visible - } - }); - }, "getPTOptions"), - onFocus: /* @__PURE__ */ __name(function onFocus13(event2) { - this.$emit("focus", event2); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur13(event2) { - this.focusedOptionIndex = -1; - this.$emit("blur", event2); - }, "onBlur"), - onItemClick: /* @__PURE__ */ __name(function onItemClick7(e, item8) { - if (item8.command) { - item8.command({ - originalEvent: e, - item: item8 - }); - } - this.hide(); - this.isItemClicked = true; - e.preventDefault(); - }, "onItemClick"), - onClick: /* @__PURE__ */ __name(function onClick6(event2) { - this.d_visible ? this.hide() : this.show(); - this.isItemClicked = true; - this.$emit("click", event2); - }, "onClick"), - show: /* @__PURE__ */ __name(function show5() { - this.d_visible = true; - this.$emit("show"); - }, "show"), - hide: /* @__PURE__ */ __name(function hide5() { - this.d_visible = false; - this.$emit("hide"); - }, "hide"), - calculateTransitionDelay: /* @__PURE__ */ __name(function calculateTransitionDelay(index) { - var length = this.model.length; - var visible7 = this.d_visible; - return (visible7 ? index : length - index - 1) * this.transitionDelay; - }, "calculateTransitionDelay"), - onTogglerKeydown: /* @__PURE__ */ __name(function onTogglerKeydown(event2) { - switch (event2.code) { - case "ArrowDown": - case "ArrowLeft": - this.onTogglerArrowDown(event2); - break; - case "ArrowUp": - case "ArrowRight": - this.onTogglerArrowUp(event2); - break; - case "Escape": - this.onEscapeKey(); - break; - } - }, "onTogglerKeydown"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown11(event2) { - switch (event2.code) { - case "ArrowDown": - this.onArrowDown(event2); - break; - case "ArrowUp": - this.onArrowUp(event2); - break; - case "ArrowLeft": - this.onArrowLeft(event2); - break; - case "ArrowRight": - this.onArrowRight(event2); - break; - case "Enter": - case "NumpadEnter": - case "Space": - this.onEnterKey(event2); - break; - case "Escape": - this.onEscapeKey(event2); - break; - case "Home": - this.onHomeKey(event2); - break; - case "End": - this.onEndKey(event2); - break; - } - }, "onKeyDown"), - onTogglerArrowUp: /* @__PURE__ */ __name(function onTogglerArrowUp(event2) { - this.show(); - this.navigatePrevItem(event2); - event2.preventDefault(); - }, "onTogglerArrowUp"), - onTogglerArrowDown: /* @__PURE__ */ __name(function onTogglerArrowDown(event2) { - this.show(); - this.navigateNextItem(event2); - event2.preventDefault(); - }, "onTogglerArrowDown"), - onEnterKey: /* @__PURE__ */ __name(function onEnterKey7(event2) { - var _this = this; - var items2 = find(this.container, '[data-pc-section="item"]'); - var itemIndex = _toConsumableArray$3(items2).findIndex(function(item8) { - return item8.id === _this.focusedOptionIndex; - }); - var buttonEl = findSingle(this.container, "button"); - this.onItemClick(event2, this.model[itemIndex]); - this.onBlur(event2); - buttonEl && focus(buttonEl); - }, "onEnterKey"), - onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey4() { - this.hide(); - var buttonEl = findSingle(this.container, "button"); - buttonEl && focus(buttonEl); - }, "onEscapeKey"), - onArrowUp: /* @__PURE__ */ __name(function onArrowUp(event2) { - if (this.direction === "down") { - this.navigatePrevItem(event2); - } else { - this.navigateNextItem(event2); - } - }, "onArrowUp"), - onArrowDown: /* @__PURE__ */ __name(function onArrowDown(event2) { - if (this.direction === "down") { - this.navigateNextItem(event2); - } else { - this.navigatePrevItem(event2); - } - }, "onArrowDown"), - onArrowLeft: /* @__PURE__ */ __name(function onArrowLeft(event2) { - var leftValidDirections = ["left", "up-right", "down-left"]; - var rightValidDirections = ["right", "up-left", "down-right"]; - if (leftValidDirections.includes(this.direction)) { - this.navigateNextItem(event2); - } else if (rightValidDirections.includes(this.direction)) { - this.navigatePrevItem(event2); - } else { - this.navigatePrevItem(event2); - } - }, "onArrowLeft"), - onArrowRight: /* @__PURE__ */ __name(function onArrowRight(event2) { - var leftValidDirections = ["left", "up-right", "down-left"]; - var rightValidDirections = ["right", "up-left", "down-right"]; - if (leftValidDirections.includes(this.direction)) { - this.navigatePrevItem(event2); - } else if (rightValidDirections.includes(this.direction)) { - this.navigateNextItem(event2); - } else { - this.navigateNextItem(event2); - } - }, "onArrowRight"), - onEndKey: /* @__PURE__ */ __name(function onEndKey8(event2) { - event2.preventDefault(); - this.focusedOptionIndex = -1; - this.navigatePrevItem(event2); - }, "onEndKey"), - onHomeKey: /* @__PURE__ */ __name(function onHomeKey8(event2) { - event2.preventDefault(); - this.focusedOptionIndex = -1; - this.navigateNextItem(event2); - }, "onHomeKey"), - navigateNextItem: /* @__PURE__ */ __name(function navigateNextItem(event2) { - var optionIndex = this.findNextOptionIndex(this.focusedOptionIndex); - this.changeFocusedOptionIndex(optionIndex); - event2.preventDefault(); - }, "navigateNextItem"), - navigatePrevItem: /* @__PURE__ */ __name(function navigatePrevItem(event2) { - var optionIndex = this.findPrevOptionIndex(this.focusedOptionIndex); - this.changeFocusedOptionIndex(optionIndex); - event2.preventDefault(); - }, "navigatePrevItem"), - changeFocusedOptionIndex: /* @__PURE__ */ __name(function changeFocusedOptionIndex5(index) { - var items2 = find(this.container, '[data-pc-section="item"]'); - var filteredItems = _toConsumableArray$3(items2).filter(function(item8) { - return !hasClass(findSingle(item8, "a"), "p-disabled"); - }); - if (filteredItems[index]) { - this.focusedOptionIndex = filteredItems[index].getAttribute("id"); - var buttonEl = findSingle(filteredItems[index], '[type="button"]'); - buttonEl && focus(buttonEl); - } - }, "changeFocusedOptionIndex"), - findPrevOptionIndex: /* @__PURE__ */ __name(function findPrevOptionIndex5(index) { - var items2 = find(this.container, '[data-pc-section="item"]'); - var filteredItems = _toConsumableArray$3(items2).filter(function(item8) { - return !hasClass(findSingle(item8, "a"), "p-disabled"); - }); - var newIndex = index === -1 ? filteredItems[filteredItems.length - 1].id : index; - var matchedOptionIndex = filteredItems.findIndex(function(link) { - return link.getAttribute("id") === newIndex; - }); - matchedOptionIndex = index === -1 ? filteredItems.length - 1 : matchedOptionIndex - 1; - return matchedOptionIndex; - }, "findPrevOptionIndex"), - findNextOptionIndex: /* @__PURE__ */ __name(function findNextOptionIndex5(index) { - var items2 = find(this.container, '[data-pc-section="item"]'); - var filteredItems = _toConsumableArray$3(items2).filter(function(item8) { - return !hasClass(findSingle(item8, "a"), "p-disabled"); - }); - var newIndex = index === -1 ? filteredItems[0].id : index; - var matchedOptionIndex = filteredItems.findIndex(function(link) { - return link.getAttribute("id") === newIndex; - }); - matchedOptionIndex = index === -1 ? 0 : matchedOptionIndex + 1; - return matchedOptionIndex; - }, "findNextOptionIndex"), - calculatePointStyle: /* @__PURE__ */ __name(function calculatePointStyle(index) { - var type = this.type; - if (type !== "linear") { - var length = this.model.length; - var radius = this.radius || length * 20; - if (type === "circle") { - var step = 2 * Math_PI / length; - return { - left: "calc(".concat(radius * Math.cos(step * index), "px + ").concat($dt("item.diff.x", "0px").variable, ")"), - top: "calc(".concat(radius * Math.sin(step * index), "px + ").concat($dt("item.diff.y", "0px").variable, ")") - }; - } else if (type === "semi-circle") { - var direction = this.direction; - var _step = Math_PI / (length - 1); - var x = "calc(".concat(radius * Math.cos(_step * index), "px + ").concat($dt("item.diff.x", "0px").variable, ")"); - var y = "calc(".concat(radius * Math.sin(_step * index), "px + ").concat($dt("item.diff.y", "0px").variable, ")"); - if (direction === "up") { - return { - left: x, - bottom: y - }; - } else if (direction === "down") { - return { - left: x, - top: y - }; - } else if (direction === "left") { - return { - right: y, - top: x - }; - } else if (direction === "right") { - return { - left: y, - top: x - }; - } - } else if (type === "quarter-circle") { - var _direction = this.direction; - var _step2 = Math_PI / (2 * (length - 1)); - var _x = "calc(".concat(radius * Math.cos(_step2 * index), "px + ").concat($dt("item.diff.x", "0px").variable, ")"); - var _y = "calc(".concat(radius * Math.sin(_step2 * index), "px + ").concat($dt("item.diff.y", "0px").variable, ")"); - if (_direction === "up-left") { - return { - right: _x, - bottom: _y - }; - } else if (_direction === "up-right") { - return { - left: _x, - bottom: _y - }; - } else if (_direction === "down-left") { - return { - right: _y, - top: _x - }; - } else if (_direction === "down-right") { - return { - left: _y, - top: _x - }; - } - } - } - return {}; - }, "calculatePointStyle"), - getItemStyle: /* @__PURE__ */ __name(function getItemStyle(index) { - var transitionDelay = this.calculateTransitionDelay(index); - var pointStyle = this.calculatePointStyle(index); - return _objectSpread$7({ - transitionDelay: "".concat(transitionDelay, "ms") - }, pointStyle); - }, "getItemStyle"), - bindDocumentClickListener: /* @__PURE__ */ __name(function bindDocumentClickListener() { - var _this2 = this; - if (!this.documentClickListener) { - this.documentClickListener = function(event2) { - if (_this2.d_visible && _this2.isOutsideClicked(event2)) { - _this2.hide(); - } - _this2.isItemClicked = false; - }; - document.addEventListener("click", this.documentClickListener); - } - }, "bindDocumentClickListener"), - unbindDocumentClickListener: /* @__PURE__ */ __name(function unbindDocumentClickListener() { - if (this.documentClickListener) { - document.removeEventListener("click", this.documentClickListener); - this.documentClickListener = null; - } - }, "unbindDocumentClickListener"), - isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked3(event2) { - return this.container && !(this.container.isSameNode(event2.target) || this.container.contains(event2.target) || this.isItemClicked); - }, "isOutsideClicked"), - isItemVisible: /* @__PURE__ */ __name(function isItemVisible6(item8) { - return typeof item8.visible === "function" ? item8.visible() : item8.visible !== false; - }, "isItemVisible"), - isItemActive: /* @__PURE__ */ __name(function isItemActive7(id4) { - return id4 === this.focusedOptionId; - }, "isItemActive"), - containerRef: /* @__PURE__ */ __name(function containerRef5(el) { - this.container = el; - }, "containerRef"), - listRef: /* @__PURE__ */ __name(function listRef3(el) { - this.list = el; - }, "listRef") - }, - computed: { - containerClass: /* @__PURE__ */ __name(function containerClass3() { - return [this.cx("root"), this["class"]]; - }, "containerClass"), - focusedOptionId: /* @__PURE__ */ __name(function focusedOptionId6() { - return this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : null; - }, "focusedOptionId") - }, - components: { - Button: script$1d, - PlusIcon: script$1w - }, - directives: { - ripple: Ripple, - tooltip: Tooltip - } -}; -var _hoisted_1$a = ["id"]; -var _hoisted_2$7 = ["id", "data-p-active"]; -function render$b(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Button = resolveComponent("Button"); - var _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock(Fragment, null, [createBaseVNode("div", mergeProps({ - ref: $options.containerRef, - "class": $options.containerClass, - style: [_ctx.style, _ctx.sx("root")] - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "button", { - visible: $data.d_visible, - toggleCallback: $options.onClick - }, function() { - return [createVNode(_component_Button, mergeProps({ - "class": [_ctx.cx("pcButton"), _ctx.buttonClass], - disabled: _ctx.disabled, - "aria-expanded": $data.d_visible, - "aria-haspopup": true, - "aria-controls": $data.id + "_list", - "aria-label": _ctx.ariaLabel, - "aria-labelledby": _ctx.ariaLabelledby, - unstyled: _ctx.unstyled, - onClick: _cache[0] || (_cache[0] = function($event) { - return $options.onClick($event); - }), - onKeydown: $options.onTogglerKeydown - }, _ctx.buttonProps, { - pt: _ctx.ptm("pcButton") - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "icon", { - visible: $data.d_visible - }, function() { - return [$data.d_visible && !!_ctx.hideIcon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.hideIcon ? "span" : "PlusIcon"), mergeProps({ - key: 0, - "class": [_ctx.hideIcon, slotProps["class"]] - }, _ctx.ptm("pcButton")["icon"], { - "data-pc-section": "icon" - }), null, 16, ["class"])) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.showIcon ? "span" : "PlusIcon"), mergeProps({ - key: 1, - "class": [$data.d_visible && !!_ctx.hideIcon ? _ctx.hideIcon : _ctx.showIcon, slotProps["class"]] - }, _ctx.ptm("pcButton")["icon"], { - "data-pc-section": "icon" - }), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "disabled", "aria-expanded", "aria-controls", "aria-label", "aria-labelledby", "unstyled", "onKeydown", "pt"])]; - }), createBaseVNode("ul", mergeProps({ - ref: $options.listRef, - id: $data.id + "_list", - "class": _ctx.cx("list"), - style: _ctx.sx("list"), - role: "menu", - tabindex: "-1", - onFocus: _cache[1] || (_cache[1] = function() { - return $options.onFocus && $options.onFocus.apply($options, arguments); - }), - onBlur: _cache[2] || (_cache[2] = function() { - return $options.onBlur && $options.onBlur.apply($options, arguments); - }), - onKeydown: _cache[3] || (_cache[3] = function() { - return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); - }) - }, _ctx.ptm("list")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model, function(item8, index) { - return openBlock(), createElementBlock(Fragment, { - key: index - }, [$options.isItemVisible(item8) ? (openBlock(), createElementBlock("li", mergeProps({ - key: 0, - id: "".concat($data.id, "_").concat(index), - "class": _ctx.cx("item", { - id: "".concat($data.id, "_").concat(index) - }), - style: $options.getItemStyle(index), - role: "none", - "data-p-active": $options.isItemActive("".concat($data.id, "_").concat(index)), - ref_for: true - }, $options.getPTOptions("".concat($data.id, "_").concat(index), "item")), [!_ctx.$slots.item ? withDirectives((openBlock(), createBlock(_component_Button, mergeProps({ - key: 0, - tabindex: -1, - role: "menuitem", - "class": _ctx.cx("pcAction", { - item: item8 - }), - "aria-label": item8.label, - disabled: _ctx.disabled, - unstyled: _ctx.unstyled, - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return $options.onItemClick($event, item8); - }, "onClick"), - ref_for: true - }, _ctx.actionButtonProps, { - pt: $options.getPTOptions("".concat($data.id, "_").concat(index), "pcAction") - }), createSlots({ - _: 2 - }, [item8.icon ? { - name: "icon", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "itemicon", { - item: item8, - "class": normalizeClass(slotProps["class"]) - }, function() { - return [createBaseVNode("span", mergeProps({ - "class": [item8.icon, slotProps["class"]], - ref_for: true - }, $options.getPTOptions("".concat($data.id, "_").concat(index), "actionIcon")), null, 16)]; - })]; - }), - key: "0" - } : void 0]), 1040, ["class", "aria-label", "disabled", "unstyled", "onClick", "pt"])), [[_directive_tooltip, { - value: item8.label, - disabled: !_ctx.tooltipOptions - }, _ctx.tooltipOptions]]) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.item), { - key: 1, - item: item8, - onClick: /* @__PURE__ */ __name(function onClick11(event2) { - return $options.onItemClick(event2, item8); - }, "onClick"), - toggleCallback: /* @__PURE__ */ __name(function toggleCallback(event2) { - return $options.onItemClick(event2, item8); - }, "toggleCallback") - }, null, 8, ["item", "onClick", "toggleCallback"]))], 16, _hoisted_2$7)) : createCommentVNode("", true)], 64); - }), 128))], 16, _hoisted_1$a)], 16), _ctx.mask ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": [_ctx.cx("mask"), _ctx.maskClass], - style: _ctx.maskStyle - }, _ctx.ptm("mask")), null, 16)) : createCommentVNode("", true)], 64); -} -__name(render$b, "render$b"); -script$c.render = render$b; -var classes$6 = { - root: /* @__PURE__ */ __name(function root28(_ref) { - var instance = _ref.instance; - return ["p-stepitem", { - "p-stepitem-active": instance.isActive - }]; - }, "root") -}; -var StepItemStyle = BaseStyle.extend({ - name: "stepitem", - classes: classes$6 -}); -var script$1$6 = { - name: "BaseStepItem", - "extends": script$1f, - props: { - value: { - type: [String, Number], - "default": void 0 - } - }, - style: StepItemStyle, - provide: /* @__PURE__ */ __name(function provide44() { - return { - $pcStepItem: this, - $parentInstance: this - }; - }, "provide") -}; -var script$b = { - name: "StepItem", - "extends": script$1$6, - inheritAttrs: false, - inject: ["$pcStepper"], - computed: { - isActive: /* @__PURE__ */ __name(function isActive() { - var _this$$pcStepper; - return ((_this$$pcStepper = this.$pcStepper) === null || _this$$pcStepper === void 0 ? void 0 : _this$$pcStepper.d_value) === this.value; - }, "isActive") - } -}; -var _hoisted_1$9 = ["data-p-active"]; -function render$a(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root"), - "data-p-active": $options.isActive - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$9); -} -__name(render$a, "render$a"); -script$b.render = render$a; -var theme$5 = /* @__PURE__ */ __name(function theme34(_ref) { - var dt = _ref.dt; - return '\n.p-steps {\n position: relative;\n}\n\n.p-steps-list {\n padding: 0;\n margin: 0;\n list-style-type: none;\n display: flex;\n}\n\n.p-steps-item {\n position: relative;\n display: flex;\n justify-content: center;\n flex: 1 1 auto;\n}\n\n.p-steps-item.p-disabled,\n.p-steps-item.p-disabled * {\n opacity: 1;\n pointer-events: auto;\n user-select: auto;\n cursor: auto;\n}\n\n.p-steps-item:before {\n content: " ";\n border-top: 2px solid '.concat(dt("steps.separator.background"), ";\n width: 100%;\n top: 50%;\n left: 0;\n display: block;\n position: absolute;\n margin-top: calc(-1rem + 1px);\n}\n\n.p-steps-item:first-child::before {\n width: calc(50% + 1rem);\n transform: translateX(100%);\n}\n\n.p-steps-item:last-child::before {\n width: 50%;\n}\n\n.p-steps-item-link {\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n overflow: hidden;\n text-decoration: none;\n transition: outline-color ").concat(dt("steps.transition.duration"), ", box-shadow ").concat(dt("steps.transition.duration"), ";\n border-radius: ").concat(dt("steps.item.link.border.radius"), ";\n outline-color: transparent;\n gap: ").concat(dt("steps.item.link.gap"), ";\n}\n\n.p-steps-item-link:not(.p-disabled):focus-visible {\n box-shadow: ").concat(dt("steps.item.link.focus.ring.shadow"), ";\n outline: ").concat(dt("steps.item.link.focus.ring.width"), " ").concat(dt("steps.item.link.focus.ring.style"), " ").concat(dt("steps.item.link.focus.ring.color"), ";\n outline-offset: ").concat(dt("steps.item.link.focus.ring.offset"), ";\n}\n\n.p-steps-item-label {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n color: ").concat(dt("steps.item.label.color"), ";\n display: block;\n font-weight: ").concat(dt("steps.item.label.font.weight"), ";\n}\n\n.p-steps-item-number {\n display: flex;\n align-items: center;\n justify-content: center;\n color: ").concat(dt("steps.item.number.color"), ";\n border: 2px solid ").concat(dt("steps.item.number.border.color"), ";\n background: ").concat(dt("steps.item.number.background"), ";\n min-width: ").concat(dt("steps.item.number.size"), ";\n height: ").concat(dt("steps.item.number.size"), ";\n line-height: ").concat(dt("steps.item.number.size"), ";\n font-size: ").concat(dt("steps.item.number.font.size"), ";\n z-index: 1;\n border-radius: ").concat(dt("steps.item.number.border.radius"), ";\n position: relative;\n font-weight: ").concat(dt("steps.item.number.font.weight"), ';\n}\n\n.p-steps-item-number::after {\n content: " ";\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: ').concat(dt("steps.item.number.border.radius"), ";\n box-shadow: ").concat(dt("steps.item.number.shadow"), ";\n}\n\n.p-steps:not(.p-readonly) .p-steps-item {\n cursor: pointer;\n}\n\n.p-steps-item-active .p-steps-item-number {\n background: ").concat(dt("steps.item.number.active.background"), ";\n border-color: ").concat(dt("steps.item.number.active.border.color"), ";\n color: ").concat(dt("steps.item.number.active.color"), ";\n}\n\n.p-steps-item-active .p-steps-item-label {\n color: ").concat(dt("steps.item.label.active.color"), ";\n}\n"); -}, "theme"); -var classes$5 = { - root: /* @__PURE__ */ __name(function root29(_ref2) { - var props = _ref2.props; - return ["p-steps p-component", { - "p-readonly": props.readonly - }]; - }, "root"), - list: "p-steps-list", - item: /* @__PURE__ */ __name(function item6(_ref3) { - var instance = _ref3.instance, _item = _ref3.item, index = _ref3.index; - return ["p-steps-item", { - "p-steps-item-active": instance.isActive(index), - "p-disabled": instance.isItemDisabled(_item, index) - }]; - }, "item"), - itemLink: "p-steps-item-link", - itemNumber: "p-steps-item-number", - itemLabel: "p-steps-item-label" -}; -var StepsStyle = BaseStyle.extend({ - name: "steps", - theme: theme$5, - classes: classes$5 -}); -var script$1$5 = { - name: "BaseSteps", - "extends": script$1f, - props: { - id: { - type: String - }, - model: { - type: Array, - "default": null - }, - readonly: { - type: Boolean, - "default": true - }, - activeStep: { - type: Number, - "default": 0 - } - }, - style: StepsStyle, - provide: /* @__PURE__ */ __name(function provide45() { - return { - $pcSteps: this, - $parentInstance: this - }; - }, "provide") -}; -var script$a = { - name: "Steps", - "extends": script$1$5, - inheritAttrs: false, - emits: ["update:activeStep", "step-change"], - data: /* @__PURE__ */ __name(function data32() { - return { - d_activeStep: this.activeStep - }; - }, "data"), - watch: { - activeStep: /* @__PURE__ */ __name(function activeStep(newValue) { - this.d_activeStep = newValue; - }, "activeStep") - }, - mounted: /* @__PURE__ */ __name(function mounted36() { - var firstItem = this.findFirstItem(); - firstItem && (firstItem.tabIndex = "0"); - }, "mounted"), - methods: { - getPTOptions: /* @__PURE__ */ __name(function getPTOptions11(key, item8, index) { - return this.ptm(key, { - context: { - item: item8, - index, - active: this.isActive(index), - disabled: this.isItemDisabled(item8, index) - } - }); - }, "getPTOptions"), - onItemClick: /* @__PURE__ */ __name(function onItemClick8(event2, item8, index) { - if (this.disabled(item8) || this.readonly) { - event2.preventDefault(); - return; - } - if (item8.command) { - item8.command({ - originalEvent: event2, - item: item8 - }); - } - if (index !== this.d_activeStep) { - this.d_activeStep = index; - this.$emit("update:activeStep", this.d_activeStep); - } - this.$emit("step-change", { - originalEvent: event2, - index - }); - }, "onItemClick"), - onItemKeydown: /* @__PURE__ */ __name(function onItemKeydown(event2, item8) { - switch (event2.code) { - case "ArrowRight": { - this.navigateToNextItem(event2.target); - event2.preventDefault(); - break; - } - case "ArrowLeft": { - this.navigateToPrevItem(event2.target); - event2.preventDefault(); - break; - } - case "Home": { - this.navigateToFirstItem(event2.target); - event2.preventDefault(); - break; - } - case "End": { - this.navigateToLastItem(event2.target); - event2.preventDefault(); - break; - } - case "Tab": - break; - case "Enter": - case "NumpadEnter": - case "Space": { - this.onItemClick(event2, item8); - event2.preventDefault(); - break; - } - } - }, "onItemKeydown"), - navigateToNextItem: /* @__PURE__ */ __name(function navigateToNextItem(target) { - var nextItem = this.findNextItem(target); - nextItem && this.setFocusToMenuitem(target, nextItem); - }, "navigateToNextItem"), - navigateToPrevItem: /* @__PURE__ */ __name(function navigateToPrevItem(target) { - var prevItem = this.findPrevItem(target); - prevItem && this.setFocusToMenuitem(target, prevItem); - }, "navigateToPrevItem"), - navigateToFirstItem: /* @__PURE__ */ __name(function navigateToFirstItem(target) { - var firstItem = this.findFirstItem(target); - firstItem && this.setFocusToMenuitem(target, firstItem); - }, "navigateToFirstItem"), - navigateToLastItem: /* @__PURE__ */ __name(function navigateToLastItem(target) { - var lastItem = this.findLastItem(target); - lastItem && this.setFocusToMenuitem(target, lastItem); - }, "navigateToLastItem"), - findNextItem: /* @__PURE__ */ __name(function findNextItem2(item8) { - var nextItem = item8.parentElement.nextElementSibling; - return nextItem ? nextItem.children[0] : null; - }, "findNextItem"), - findPrevItem: /* @__PURE__ */ __name(function findPrevItem2(item8) { - var prevItem = item8.parentElement.previousElementSibling; - return prevItem ? prevItem.children[0] : null; - }, "findPrevItem"), - findFirstItem: /* @__PURE__ */ __name(function findFirstItem2() { - var firstSibling = findSingle(this.$refs.list, '[data-pc-section="item"]'); - return firstSibling ? firstSibling.children[0] : null; - }, "findFirstItem"), - findLastItem: /* @__PURE__ */ __name(function findLastItem2() { - var siblings = find(this.$refs.list, '[data-pc-section="item"]'); - return siblings ? siblings[siblings.length - 1].children[0] : null; - }, "findLastItem"), - setFocusToMenuitem: /* @__PURE__ */ __name(function setFocusToMenuitem(target, focusableItem) { - target.tabIndex = "-1"; - focusableItem.tabIndex = "0"; - focusableItem.focus(); - }, "setFocusToMenuitem"), - isActive: /* @__PURE__ */ __name(function isActive2(index) { - return index === this.d_activeStep; - }, "isActive"), - isItemDisabled: /* @__PURE__ */ __name(function isItemDisabled6(item8, index) { - return this.disabled(item8) || this.readonly && !this.isActive(index); - }, "isItemDisabled"), - visible: /* @__PURE__ */ __name(function visible5(item8) { - return typeof item8.visible === "function" ? item8.visible() : item8.visible !== false; - }, "visible"), - disabled: /* @__PURE__ */ __name(function disabled5(item8) { - return typeof item8.disabled === "function" ? item8.disabled() : item8.disabled; - }, "disabled"), - label: /* @__PURE__ */ __name(function label8(item8) { - return typeof item8.label === "function" ? item8.label() : item8.label; - }, "label"), - getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps7(item8, index) { - var _this = this; - return { - action: mergeProps({ - "class": this.cx("itemLink"), - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return _this.onItemClick($event, item8); - }, "onClick"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown15($event) { - return _this.onItemKeydown($event, item8); - }, "onKeyDown") - }, this.getPTOptions("itemLink", item8, index)), - step: mergeProps({ - "class": this.cx("itemNumber") - }, this.getPTOptions("itemNumber", item8, index)), - label: mergeProps({ - "class": this.cx("itemLabel") - }, this.getPTOptions("itemLabel", item8, index)) - }; - }, "getMenuItemProps") - } -}; -var _hoisted_1$8 = ["id"]; -var _hoisted_2$6 = ["aria-current", "onClick", "onKeydown", "data-p-active", "data-p-disabled"]; -function render$9(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("nav", mergeProps({ - id: _ctx.id, - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [createBaseVNode("ol", mergeProps({ - ref: "list", - "class": _ctx.cx("list") - }, _ctx.ptm("list")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model, function(item8, index) { - return openBlock(), createElementBlock(Fragment, { - key: $options.label(item8) + "_" + index.toString() - }, [$options.visible(item8) ? (openBlock(), createElementBlock("li", mergeProps({ - key: 0, - "class": [_ctx.cx("item", { - item: item8, - index - }), item8["class"]], - style: item8.style, - "aria-current": $options.isActive(index) ? "step" : void 0, - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return $options.onItemClick($event, item8, index); - }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown5($event) { - return $options.onItemKeydown($event, item8, index); - }, "onKeydown"), - ref_for: true - }, $options.getPTOptions("item", item8, index), { - "data-p-active": $options.isActive(index), - "data-p-disabled": $options.isItemDisabled(item8, index) - }), [!_ctx.$slots.item ? (openBlock(), createElementBlock("span", mergeProps({ - key: 0, - "class": _ctx.cx("itemLink"), - ref_for: true - }, $options.getPTOptions("itemLink", item8, index)), [createBaseVNode("span", mergeProps({ - "class": _ctx.cx("itemNumber"), - ref_for: true - }, $options.getPTOptions("itemNumber", item8, index)), toDisplayString(index + 1), 17), createBaseVNode("span", mergeProps({ - "class": _ctx.cx("itemLabel"), - ref_for: true - }, $options.getPTOptions("itemLabel", item8, index)), toDisplayString($options.label(item8)), 17)], 16)) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.item), { - key: 1, - item: item8, - index, - active: index === $data.d_activeStep, - label: $options.label(item8), - props: $options.getMenuItemProps(item8, index) - }, null, 8, ["item", "index", "active", "label", "props"]))], 16, _hoisted_2$6)) : createCommentVNode("", true)], 64); - }), 128))], 16)], 16, _hoisted_1$8); -} -__name(render$9, "render$9"); -script$a.render = render$9; -var StyleClassStyle = BaseStyle.extend({ - name: "styleclass-directive" -}); -var BaseStyleClass = BaseDirective.extend({ - style: StyleClassStyle -}); -var StyleClass = BaseStyleClass.extend("styleclass", { - mounted: /* @__PURE__ */ __name(function mounted37(el, binding) { - el.setAttribute("data-pd-styleclass", true); - this.bind(el, binding); - }, "mounted"), - unmounted: /* @__PURE__ */ __name(function unmounted5(el) { - this.unbind(el); - }, "unmounted"), - methods: { - bind: /* @__PURE__ */ __name(function bind(el, binding) { - var _this = this; - var target = this.resolveTarget(el, binding); - this.$el = target; - el.$_pstyleclass_clicklistener = function() { - if (binding.value.toggleClass) { - if (hasClass(target, binding.value.toggleClass)) removeClass(target, binding.value.toggleClass); - else addClass(target, binding.value.toggleClass); - } else { - if (target.offsetParent === null) _this.enter(target, el, binding); - else _this.leave(target, binding); - } - }; - el.addEventListener("click", el.$_pstyleclass_clicklistener); - }, "bind"), - unbind: /* @__PURE__ */ __name(function unbind(el) { - if (el.$_pstyleclass_clicklistener) { - el.removeEventListener("click", el.$_pstyleclass_clicklistener); - el.$_pstyleclass_clicklistener = null; - } - this.unbindDocumentListener(el); - }, "unbind"), - enter: /* @__PURE__ */ __name(function enter2(target, el, binding) { - if (binding.value.enterActiveClass) { - if (!target.$_pstyleclass_animating) { - target.$_pstyleclass_animating = true; - if (binding.value.enterActiveClass.includes("slidedown")) { - target.style.height = "0px"; - removeClass(target, binding.value.hiddenClass || binding.value.enterFromClass); - target.style.maxHeight = target.scrollHeight + "px"; - addClass(target, binding.value.hiddenClass || binding.value.enterActiveClass); - target.style.height = ""; - } - addClass(target, binding.value.enterActiveClass); - if (binding.value.enterFromClass) { - removeClass(target, binding.value.enterFromClass); - } - target.$p_styleclass_enterlistener = function() { - removeClass(target, binding.value.enterActiveClass); - if (binding.value.enterToClass) { - addClass(target, binding.value.enterToClass); - } - target.removeEventListener("animationend", target.$p_styleclass_enterlistener); - if (binding.value.enterActiveClass.includes("slidedown")) { - target.style.maxHeight = ""; - } - target.$_pstyleclass_animating = false; - }; - target.addEventListener("animationend", target.$p_styleclass_enterlistener); - } - } else { - if (binding.value.enterFromClass) { - removeClass(target, binding.value.enterFromClass); - } - if (binding.value.enterToClass) { - addClass(target, binding.value.enterToClass); - } - } - if (binding.value.hideOnOutsideClick) { - this.bindDocumentListener(target, el, binding); - } - }, "enter"), - leave: /* @__PURE__ */ __name(function leave2(target, binding) { - if (binding.value.leaveActiveClass) { - if (!target.$_pstyleclass_animating) { - target.$_pstyleclass_animating = true; - addClass(target, binding.value.leaveActiveClass); - if (binding.value.leaveFromClass) { - removeClass(target, binding.value.leaveFromClass); - } - target.$p_styleclass_leavelistener = function() { - removeClass(target, binding.value.leaveActiveClass); - if (binding.value.leaveToClass) { - addClass(target, binding.value.leaveToClass); - } - target.removeEventListener("animationend", target.$p_styleclass_leavelistener); - target.$_pstyleclass_animating = false; - }; - target.addEventListener("animationend", target.$p_styleclass_leavelistener); - } - } else { - if (binding.value.leaveFromClass) { - removeClass(target, binding.value.leaveFromClass); - } - if (binding.value.leaveToClass) { - addClass(target, binding.value.leaveToClass); - } - } - if (binding.value.hideOnOutsideClick) { - this.unbindDocumentListener(target); - } - }, "leave"), - resolveTarget: /* @__PURE__ */ __name(function resolveTarget(el, binding) { - switch (binding.value.selector) { - case "@next": - return el.nextElementSibling; - case "@prev": - return el.previousElementSibling; - case "@parent": - return el.parentElement; - case "@grandparent": - return el.parentElement.parentElement; - default: - return document.querySelector(binding.value.selector); - } - }, "resolveTarget"), - bindDocumentListener: /* @__PURE__ */ __name(function bindDocumentListener(target, el, binding) { - var _this2 = this; - if (!target.$p_styleclass_documentlistener) { - target.$p_styleclass_documentlistener = function(event2) { - if (!_this2.isVisible(target) || getComputedStyle(target).getPropertyValue("position") === "static") { - _this2.unbindDocumentListener(target); - } else if (_this2.isOutsideClick(event2, target, el)) { - _this2.leave(target, binding); - } - }; - target.ownerDocument.addEventListener("click", target.$p_styleclass_documentlistener); - } - }, "bindDocumentListener"), - unbindDocumentListener: /* @__PURE__ */ __name(function unbindDocumentListener(target) { - if (target.$p_styleclass_documentlistener) { - target.ownerDocument.removeEventListener("click", target.$p_styleclass_documentlistener); - target.$p_styleclass_documentlistener = null; - } - }, "unbindDocumentListener"), - isVisible: /* @__PURE__ */ __name(function isVisible(target) { - return target.offsetParent !== null; - }, "isVisible"), - isOutsideClick: /* @__PURE__ */ __name(function isOutsideClick(event2, target, el) { - return !el.isSameNode(event2.target) && !el.contains(event2.target) && !target.contains(event2.target); - }, "isOutsideClick") - } -}); -var theme$4 = /* @__PURE__ */ __name(function theme35(_ref) { - var dt = _ref.dt; - return "\n.p-tabmenu {\n overflow-x: auto;\n}\n\n.p-tabmenu-tablist {\n display: flex;\n margin: 0;\n padding: 0;\n list-style-type: none;\n background: ".concat(dt("tabmenu.tablist.background"), ";\n border-style: solid;\n border-color: ").concat(dt("tabmenu.tablist.border.color"), ";\n border-width: ").concat(dt("tabmenu.tablist.border.width"), ";\n position: relative;\n}\n\n.p-tabmenu-item-link {\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 background: ").concat(dt("tabmenu.item.background"), ";\n border-style: solid;\n border-width: ").concat(dt("tabmenu.item.border.width"), ";\n border-color: ").concat(dt("tabmenu.item.border.color"), ";\n color: ").concat(dt("tabmenu.item.color"), ";\n padding: ").concat(dt("tabmenu.item.padding"), ";\n font-weight: ").concat(dt("tabmenu.item.font.weight"), ";\n transition: background ").concat(dt("tabmenu.transition.duration"), ", border-color ").concat(dt("tabmenu.transition.duration"), ", color ").concat(dt("tabmenu.transition.duration"), ", outline-color ").concat(dt("tabmenu.transition.duration"), ", box-shadow ").concat(dt("tabmenu.transition.duration"), ";\n margin: ").concat(dt("tabmenu.item.margin"), ";\n outline-color: transparent;\n gap: ").concat(dt("tabmenu.item.gap"), ";\n}\n\n.p-tabmenu-item-link:focus-visible {\n z-index: 1;\n box-shadow: ").concat(dt("tabmenu.item.focus.ring.shadow"), ";\n outline: ").concat(dt("tabmenu.item.focus.ring.width"), " ").concat(dt("tabmenu.item.focus.ring.style"), " ").concat(dt("tabmenu.item.focus.ring.color"), ";\n outline-offset: ").concat(dt("tabmenu.item.focus.ring.offset"), ";\n}\n\n.p-tabmenu-item-icon {\n color: ").concat(dt("tabmenu.item.icon.color"), ";\n transition: background ").concat(dt("tabmenu.transition.duration"), ", border-color ").concat(dt("tabmenu.transition.duration"), ", color ").concat(dt("tabmenu.transition.duration"), ", outline-color ").concat(dt("tabmenu.transition.duration"), ", box-shadow ").concat(dt("tabmenu.transition.duration"), ";\n}\n\n.p-tabmenu-item-label {\n line-height: 1;\n}\n\n.p-tabmenu-item:not(.p-tabmenu-item-active):not(.p-disabled):hover .p-tabmenu-item-link {\n background: ").concat(dt("tabmenu.item.hover.background"), ";\n border-color: ").concat(dt("tabmenu.item.hover.border.color"), ";\n color: ").concat(dt("tabmenu.item.hover.color"), ";\n}\n\n.p-tabmenu-item:not(.p-tabmenu-item-active):not(.p-disabled):hover .p-tabmenu-item-icon {\n color: ").concat(dt("tabmenu.item.icon.hover.color"), ";\n}\n\n.p-tabmenu-item-active .p-tabmenu-item-link {\n background: ").concat(dt("tabmenu.item.active.background"), ";\n border-color: ").concat(dt("tabmenu.item.active.border.color"), ";\n color: ").concat(dt("tabmenu.item.active.color"), ";\n}\n\n.p-tabmenu-item-active .p-tabmenu-item-icon {\n color: ").concat(dt("tabmenu.item.icon.active.color"), ";\n}\n\n.p-tabmenu-active-bar {\n z-index: 1;\n display: block;\n position: absolute;\n bottom: ").concat(dt("tabmenu.active.bar.bottom"), ";\n height: ").concat(dt("tabmenu.active.bar.height"), ";\n background: ").concat(dt("tabmenu.active.bar.background"), ";\n transition: 250ms cubic-bezier(0.35, 0, 0.25, 1);\n}\n\n.p-tabmenu::-webkit-scrollbar {\n display: none;\n}\n"); -}, "theme"); -var classes$4 = { - root: "p-tabmenu p-component", - tablist: "p-tabmenu-tablist", - item: /* @__PURE__ */ __name(function item7(_ref2) { - var instance = _ref2.instance, index = _ref2.index, _item = _ref2.item; - return ["p-tabmenu-item", { - "p-tabmenu-item-active": instance.d_activeIndex === index, - "p-disabled": instance.disabled(_item) - }]; - }, "item"), - itemLink: "p-tabmenu-item-link", - itemIcon: "p-tabmenu-item-icon", - itemLabel: "p-tabmenu-item-label", - activeBar: "p-tabmenu-active-bar" -}; -var TabMenuStyle = BaseStyle.extend({ - name: "tabmenu", - theme: theme$4, - classes: classes$4 -}); -var script$1$4 = { - name: "BaseTabMenu", - "extends": script$1f, - props: { - model: { - type: Array, - "default": null - }, - activeIndex: { - type: Number, - "default": 0 - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - } - }, - style: TabMenuStyle, - provide: /* @__PURE__ */ __name(function provide46() { - return { - $pcTabMenu: this, - $parentInstance: this - }; - }, "provide") -}; -var script$9 = { - name: "TabMenu", - "extends": script$1$4, - inheritAttrs: false, - emits: ["update:activeIndex", "tab-change"], - data: /* @__PURE__ */ __name(function data33() { - return { - d_activeIndex: this.activeIndex - }; - }, "data"), - watch: { - activeIndex: { - flush: "post", - handler: /* @__PURE__ */ __name(function handler3(newValue) { - this.d_activeIndex = newValue; - this.updateInkBar(); - }, "handler") - } - }, - mounted: /* @__PURE__ */ __name(function mounted38() { - var _this = this; - this.$nextTick(function() { - _this.updateInkBar(); - }); - var activeItem2 = this.findActiveItem(); - activeItem2 && (activeItem2.tabIndex = "0"); - }, "mounted"), - updated: /* @__PURE__ */ __name(function updated7() { - this.updateInkBar(); - }, "updated"), - methods: { - getPTOptions: /* @__PURE__ */ __name(function getPTOptions12(key, item8, index) { - return this.ptm(key, { - context: { - item: item8, - index - } - }); - }, "getPTOptions"), - onItemClick: /* @__PURE__ */ __name(function onItemClick9(event2, item8, index) { - if (this.disabled(item8)) { - event2.preventDefault(); - return; - } - if (item8.command) { - item8.command({ - originalEvent: event2, - item: item8 - }); - } - if (index !== this.d_activeIndex) { - this.d_activeIndex = index; - this.$emit("update:activeIndex", this.d_activeIndex); - } - this.$emit("tab-change", { - originalEvent: event2, - index - }); - }, "onItemClick"), - onKeydownItem: /* @__PURE__ */ __name(function onKeydownItem(event2, item8, index) { - switch (event2.code) { - case "ArrowRight": { - this.navigateToNextItem(event2.target); - event2.preventDefault(); - break; - } - case "ArrowLeft": { - this.navigateToPrevItem(event2.target); - event2.preventDefault(); - break; - } - case "Home": { - this.navigateToFirstItem(event2.target); - event2.preventDefault(); - break; - } - case "End": { - this.navigateToLastItem(event2.target); - event2.preventDefault(); - break; - } - case "Space": - case "NumpadEnter": - case "Enter": { - this.onItemClick(event2, item8, index); - event2.preventDefault(); - break; - } - case "Tab": { - this.onTabKey(); - break; - } - } - }, "onKeydownItem"), - navigateToNextItem: /* @__PURE__ */ __name(function navigateToNextItem2(target) { - var nextItem = this.findNextItem(target); - nextItem && this.setFocusToMenuitem(target, nextItem); - }, "navigateToNextItem"), - navigateToPrevItem: /* @__PURE__ */ __name(function navigateToPrevItem2(target) { - var prevItem = this.findPrevItem(target); - prevItem && this.setFocusToMenuitem(target, prevItem); - }, "navigateToPrevItem"), - navigateToFirstItem: /* @__PURE__ */ __name(function navigateToFirstItem2(target) { - var firstItem = this.findFirstItem(target); - firstItem && this.setFocusToMenuitem(target, firstItem); - }, "navigateToFirstItem"), - navigateToLastItem: /* @__PURE__ */ __name(function navigateToLastItem2(target) { - var lastItem = this.findLastItem(target); - lastItem && this.setFocusToMenuitem(target, lastItem); - }, "navigateToLastItem"), - findNextItem: /* @__PURE__ */ __name(function findNextItem3(item8) { - var nextItem = item8.parentElement.nextElementSibling; - return nextItem ? getAttribute(nextItem, "data-p-disabled") === true ? this.findNextItem(nextItem.children[0]) : nextItem.children[0] : null; - }, "findNextItem"), - findPrevItem: /* @__PURE__ */ __name(function findPrevItem3(item8) { - var prevItem = item8.parentElement.previousElementSibling; - return prevItem ? getAttribute(prevItem, "data-p-disabled") === true ? this.findPrevItem(prevItem.children[0]) : prevItem.children[0] : null; - }, "findPrevItem"), - findFirstItem: /* @__PURE__ */ __name(function findFirstItem3() { - var firstSibling = findSingle(this.$refs.nav, '[data-pc-section="item"][data-p-disabled="false"]'); - return firstSibling ? firstSibling.children[0] : null; - }, "findFirstItem"), - findLastItem: /* @__PURE__ */ __name(function findLastItem3() { - var siblings = find(this.$refs.nav, '[data-pc-section="item"][data-p-disabled="false"]'); - return siblings ? siblings[siblings.length - 1].children[0] : null; - }, "findLastItem"), - findActiveItem: /* @__PURE__ */ __name(function findActiveItem() { - var activeItem2 = findSingle(this.$refs.nav, '[data-pc-section="item"][data-p-disabled="false"][data-p-active="true"]'); - return activeItem2 ? activeItem2.children[0] : null; - }, "findActiveItem"), - setFocusToMenuitem: /* @__PURE__ */ __name(function setFocusToMenuitem2(target, focusableItem) { - target.tabIndex = "-1"; - focusableItem.tabIndex = "0"; - focusableItem.focus(); - }, "setFocusToMenuitem"), - onTabKey: /* @__PURE__ */ __name(function onTabKey4() { - var activeItem2 = findSingle(this.$refs.nav, '[data-pc-section="item"][data-p-disabled="false"][data-p-active="true"]'); - var focusedItem = findSingle(this.$refs.nav, '[data-pc-section="itemlink"][tabindex="0"]'); - if (focusedItem !== activeItem2.children[0]) { - activeItem2 && (activeItem2.children[0].tabIndex = "0"); - focusedItem.tabIndex = "-1"; - } - }, "onTabKey"), - visible: /* @__PURE__ */ __name(function visible6(item8) { - return typeof item8.visible === "function" ? item8.visible() : item8.visible !== false; - }, "visible"), - disabled: /* @__PURE__ */ __name(function disabled6(item8) { - return typeof item8.disabled === "function" ? item8.disabled() : item8.disabled === true; - }, "disabled"), - label: /* @__PURE__ */ __name(function label9(item8) { - return typeof item8.label === "function" ? item8.label() : item8.label; - }, "label"), - updateInkBar: /* @__PURE__ */ __name(function updateInkBar() { - var tabs2 = this.$refs.nav.children; - var inkHighlighted = false; - for (var i = 0; i < tabs2.length; i++) { - var tab = tabs2[i]; - if (getAttribute(tab, "data-p-active")) { - this.$refs.inkbar.style.width = getWidth(tab) + "px"; - this.$refs.inkbar.style.left = getOffset(tab).left - getOffset(this.$refs.nav).left + "px"; - inkHighlighted = true; - } - } - if (!inkHighlighted) { - this.$refs.inkbar.style.width = "0px"; - this.$refs.inkbar.style.left = "0px"; - } - }, "updateInkBar"), - getMenuItemProps: /* @__PURE__ */ __name(function getMenuItemProps8(item8, index) { - var _this2 = this; - return { - action: mergeProps({ - "class": this.cx("itemLink"), - tabindex: -1, - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return _this2.onItemClick($event, item8, index); - }, "onClick"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown15($event) { - return _this2.onKeydownItem($event, item8, index); - }, "onKeyDown") - }, this.getPTOptions("itemLink", item8, index)), - icon: mergeProps({ - "class": [this.cx("itemIcon"), item8.icon] - }, this.getPTOptions("itemIcon", item8, index)), - label: mergeProps({ - "class": this.cx("itemLabel") - }, this.getPTOptions("itemLabel", item8, index)) - }; - }, "getMenuItemProps") - }, - directives: { - ripple: Ripple - } -}; -var _hoisted_1$7 = ["aria-labelledby", "aria-label"]; -var _hoisted_2$5 = ["onClick", "onKeydown", "data-p-active", "data-p-disabled"]; -var _hoisted_3$5 = ["href", "target", "aria-label", "aria-disabled"]; -function render$8(_ctx, _cache, $props, $setup, $data, $options) { - var _directive_ripple = resolveDirective("ripple"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [createBaseVNode("ul", mergeProps({ - ref: "nav", - "class": _ctx.cx("tablist"), - role: "menubar", - "aria-labelledby": _ctx.ariaLabelledby, - "aria-label": _ctx.ariaLabel - }, _ctx.ptm("tablist")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model, function(item8, i) { - return openBlock(), createElementBlock(Fragment, { - key: $options.label(item8) + "_" + i.toString() - }, [$options.visible(item8) ? (openBlock(), createElementBlock("li", mergeProps({ - key: 0, - ref_for: true, - ref: "tab", - "class": [_ctx.cx("item", { - item: item8, - index: i - }), item8["class"]], - role: "presentation", - onClick: /* @__PURE__ */ __name(function onClick11($event) { - return $options.onItemClick($event, item8, i); - }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown5($event) { - return $options.onKeydownItem($event, item8, i); - }, "onKeydown") - }, $options.getPTOptions("item", item8, i), { - "data-p-active": $data.d_activeIndex === i, - "data-p-disabled": $options.disabled(item8) - }), [!_ctx.$slots.item ? withDirectives((openBlock(), createElementBlock("a", mergeProps({ - key: 0, - ref_for: true, - ref: "tabLink", - role: "menuitem", - href: item8.url, - "class": _ctx.cx("itemLink"), - target: item8.target, - "aria-label": $options.label(item8), - "aria-disabled": $options.disabled(item8), - tabindex: -1 - }, $options.getPTOptions("itemLink", item8, i)), [_ctx.$slots.itemicon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.itemicon), { - key: 0, - item: item8, - "class": normalizeClass(_ctx.cx("itemIcon")) - }, null, 8, ["item", "class"])) : item8.icon ? (openBlock(), createElementBlock("span", mergeProps({ - key: 1, - "class": [_ctx.cx("itemIcon"), item8.icon], - ref_for: true - }, $options.getPTOptions("itemIcon", item8, i)), null, 16)) : createCommentVNode("", true), createBaseVNode("span", mergeProps({ - "class": _ctx.cx("itemLabel"), - ref_for: true - }, $options.getPTOptions("itemLabel", item8, i)), toDisplayString($options.label(item8)), 17)], 16, _hoisted_3$5)), [[_directive_ripple]]) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.item), { - key: 1, - item: item8, - index: i, - active: i === $data.d_activeIndex, - label: $options.label(item8), - props: $options.getMenuItemProps(item8, i) - }, null, 8, ["item", "index", "active", "label", "props"]))], 16, _hoisted_2$5)) : createCommentVNode("", true)], 64); - }), 128)), createBaseVNode("li", mergeProps({ - ref: "inkbar", - role: "none", - "class": _ctx.cx("activeBar") - }, _ctx.ptm("activeBar")), null, 16)], 16, _hoisted_1$7)], 16); -} -__name(render$8, "render$8"); -script$9.render = render$8; -var TerminalService = EventBus(); -var theme$3 = /* @__PURE__ */ __name(function theme36(_ref) { - var dt = _ref.dt; - return "\n.p-terminal {\n height: ".concat(dt("terminal.height"), ";\n overflow: auto;\n background: ").concat(dt("terminal.background"), ";\n color: ").concat(dt("terminal.color"), ";\n border: 1px solid ").concat(dt("terminal.border.color"), ";\n padding: ").concat(dt("terminal.padding"), ";\n border-radius: ").concat(dt("terminal.border.radius"), ";\n}\n\n.p-terminal-prompt {\n display: flex;\n align-items: center;\n}\n\n.p-terminal-prompt-value {\n flex: 1 1 auto;\n border: 0 none;\n background: transparent;\n color: inherit;\n padding: 0;\n outline: 0 none;\n font-family: inherit;\n font-feature-settings: inherit;\n font-size: 1rem;\n}\n\n.p-terminal-prompt-label {\n margin-inline-end: ").concat(dt("terminal.prompt.gap"), ";\n}\n\n.p-terminal-input::-ms-clear {\n display: none;\n}\n\n.p-terminal-command-response {\n margin: ").concat(dt("terminal.command.response.margin"), ";\n}\n"); -}, "theme"); -var classes$3 = { - root: "p-terminal p-component", - welcomeMessage: "p-terminal-welcome-message", - commandList: "p-terminal-command-list", - command: "p-terminal-command", - commandValue: "p-terminal-command-value", - commandResponse: "p-terminal-command-response", - prompt: "p-terminal-prompt", - promptLabel: "p-terminal-prompt-label", - promptValue: "p-terminal-prompt-value" -}; -var TerminalStyle = BaseStyle.extend({ - name: "terminal", - theme: theme$3, - classes: classes$3 -}); -var script$1$3 = { - name: "BaseTerminal", - "extends": script$1f, - props: { - welcomeMessage: { - type: String, - "default": null - }, - prompt: { - type: String, - "default": null - } - }, - style: TerminalStyle, - provide: /* @__PURE__ */ __name(function provide47() { - return { - $pcTerminal: this, - $parentInstance: this - }; - }, "provide") -}; -var script$8 = { - name: "Terminal", - "extends": script$1$3, - inheritAttrs: false, - data: /* @__PURE__ */ __name(function data34() { - return { - commandText: null, - commands: [] - }; - }, "data"), - mounted: /* @__PURE__ */ __name(function mounted39() { - TerminalService.on("response", this.responseListener); - this.$refs.input.focus(); - }, "mounted"), - updated: /* @__PURE__ */ __name(function updated8() { - this.$el.scrollTop = this.$el.scrollHeight; - }, "updated"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount15() { - TerminalService.off("response", this.responseListener); - }, "beforeUnmount"), - methods: { - onClick: /* @__PURE__ */ __name(function onClick7() { - this.$refs.input.focus(); - }, "onClick"), - onKeydown: /* @__PURE__ */ __name(function onKeydown4(event2) { - if (event2.key === "Enter" && this.commandText) { - this.commands.push({ - text: this.commandText - }); - TerminalService.emit("command", this.commandText); - this.commandText = ""; - } - }, "onKeydown"), - responseListener: /* @__PURE__ */ __name(function responseListener(response) { - this.commands[this.commands.length - 1].response = response; - }, "responseListener") - } -}; -function render$7(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root"), - onClick: _cache[2] || (_cache[2] = function() { - return $options.onClick && $options.onClick.apply($options, arguments); - }) - }, _ctx.ptmi("root")), [_ctx.welcomeMessage ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("welcomeMessage") - }, _ctx.ptm("welcomeMessage")), toDisplayString(_ctx.welcomeMessage), 17)) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("commandList") - }, _ctx.ptm("content")), [(openBlock(true), createElementBlock(Fragment, null, renderList($data.commands, function(command, i) { - return openBlock(), createElementBlock("div", mergeProps({ - key: command.text + i.toString(), - "class": _ctx.cx("command"), - ref_for: true - }, _ctx.ptm("commands")), [createBaseVNode("span", mergeProps({ - "class": _ctx.cx("promptLabel"), - ref_for: true - }, _ctx.ptm("prompt")), toDisplayString(_ctx.prompt), 17), createBaseVNode("span", mergeProps({ - "class": _ctx.cx("commandValue"), - ref_for: true - }, _ctx.ptm("command")), toDisplayString(command.text), 17), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("commandResponse"), - "aria-live": "polite", - ref_for: true - }, _ctx.ptm("response")), toDisplayString(command.response), 17)], 16); - }), 128))], 16), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("prompt") - }, _ctx.ptm("container")), [createBaseVNode("span", mergeProps({ - "class": _ctx.cx("promptLabel") - }, _ctx.ptm("prompt")), toDisplayString(_ctx.prompt), 17), withDirectives(createBaseVNode("input", mergeProps({ - ref: "input", - "onUpdate:modelValue": _cache[0] || (_cache[0] = function($event) { - return $data.commandText = $event; - }), - "class": _ctx.cx("promptValue"), - type: "text", - autocomplete: "off", - onKeydown: _cache[1] || (_cache[1] = function() { - return $options.onKeydown && $options.onKeydown.apply($options, arguments); - }) - }, _ctx.ptm("commandText")), null, 16), [[vModelText, $data.commandText]])], 16)], 16); -} -__name(render$7, "render$7"); -script$8.render = render$7; -var theme$2 = /* @__PURE__ */ __name(function theme37(_ref) { - var dt = _ref.dt; - return "\n.p-timeline {\n display: flex;\n flex-grow: 1;\n flex-direction: column;\n direction: ltr;\n}\n\n.p-timeline-left .p-timeline-event-opposite {\n text-align: right;\n}\n\n.p-timeline-left .p-timeline-event-content {\n text-align: left;\n}\n\n.p-timeline-right .p-timeline-event {\n flex-direction: row-reverse;\n}\n\n.p-timeline-right .p-timeline-event-opposite {\n text-align: left;\n}\n\n.p-timeline-right .p-timeline-event-content {\n text-align: right;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) {\n flex-direction: row-reverse;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(odd) .p-timeline-event-opposite {\n text-align: right;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(odd) .p-timeline-event-content {\n text-align: left;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) .p-timeline-event-opposite {\n text-align: left;\n}\n\n.p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) .p-timeline-event-content {\n text-align: right;\n}\n\n.p-timeline-vertical .p-timeline-event-opposite,\n.p-timeline-vertical .p-timeline-event-content {\n padding: ".concat(dt("timeline.vertical.event.content.padding"), ";\n}\n\n.p-timeline-vertical .p-timeline-event-connector {\n width: ").concat(dt("timeline.event.connector.size"), ";\n}\n\n.p-timeline-event {\n display: flex;\n position: relative;\n min-height: ").concat(dt("timeline.event.min.height"), ";\n}\n\n.p-timeline-event:last-child {\n min-height: 0;\n}\n\n.p-timeline-event-opposite {\n flex: 1;\n}\n\n.p-timeline-event-content {\n flex: 1;\n}\n\n.p-timeline-event-separator {\n flex: 0;\n display: flex;\n align-items: center;\n flex-direction: column;\n}\n\n.p-timeline-event-marker {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: relative;\n align-self: baseline;\n border-width: ").concat(dt("timeline.event.marker.border.width"), ";\n border-style: solid;\n border-color: ").concat(dt("timeline.event.marker.border.color"), ";\n border-radius: ").concat(dt("timeline.event.marker.border.radius"), ";\n width: ").concat(dt("timeline.event.marker.size"), ";\n height: ").concat(dt("timeline.event.marker.size"), ";\n background: ").concat(dt("timeline.event.marker.background"), ';\n}\n\n.p-timeline-event-marker::before {\n content: " ";\n border-radius: ').concat(dt("timeline.event.marker.content.border.radius"), ";\n width: ").concat(dt("timeline.event.marker.content.size"), ";\n height:").concat(dt("timeline.event.marker.content.size"), ";\n background: ").concat(dt("timeline.event.marker.content.background"), ';\n}\n\n.p-timeline-event-marker::after {\n content: " ";\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: ').concat(dt("timeline.event.marker.border.radius"), ";\n box-shadow: ").concat(dt("timeline.event.marker.content.inset.shadow"), ";\n}\n\n.p-timeline-event-connector {\n flex-grow: 1;\n background: ").concat(dt("timeline.event.connector.color"), ";\n}\n\n.p-timeline-horizontal {\n flex-direction: row;\n}\n\n.p-timeline-horizontal .p-timeline-event {\n flex-direction: column;\n flex: 1;\n}\n\n.p-timeline-horizontal .p-timeline-event:last-child {\n flex: 0;\n}\n\n.p-timeline-horizontal .p-timeline-event-separator {\n flex-direction: row;\n}\n\n.p-timeline-horizontal .p-timeline-event-connector {\n width: 100%;\n height: ").concat(dt("timeline.event.connector.size"), ";\n}\n\n.p-timeline-horizontal .p-timeline-event-opposite,\n.p-timeline-horizontal .p-timeline-event-content {\n padding: ").concat(dt("timeline.horizontal.event.content.padding"), ";\n}\n\n.p-timeline-horizontal.p-timeline-alternate .p-timeline-event:nth-child(even) {\n flex-direction: column-reverse;\n}\n\n.p-timeline-bottom .p-timeline-event {\n flex-direction: column-reverse;\n}\n"); -}, "theme"); -var classes$2 = { - root: /* @__PURE__ */ __name(function root30(_ref2) { - var props = _ref2.props; - return ["p-timeline p-component", "p-timeline-" + props.align, "p-timeline-" + props.layout]; - }, "root"), - event: "p-timeline-event", - eventOpposite: "p-timeline-event-opposite", - eventSeparator: "p-timeline-event-separator", - eventMarker: "p-timeline-event-marker", - eventConnector: "p-timeline-event-connector", - eventContent: "p-timeline-event-content" -}; -var TimelineStyle = BaseStyle.extend({ - name: "timeline", - theme: theme$2, - classes: classes$2 -}); -var script$1$2 = { - name: "BaseTimeline", - "extends": script$1f, - props: { - value: null, - align: { - mode: String, - "default": "left" - }, - layout: { - mode: String, - "default": "vertical" - }, - dataKey: null - }, - style: TimelineStyle, - provide: /* @__PURE__ */ __name(function provide48() { - return { - $pcTimeline: this, - $parentInstance: this - }; - }, "provide") -}; -var script$7 = { - name: "Timeline", - "extends": script$1$2, - inheritAttrs: false, - methods: { - getKey: /* @__PURE__ */ __name(function getKey3(item8, index) { - return this.dataKey ? resolveFieldData(item8, this.dataKey) : index; - }, "getKey"), - getPTOptions: /* @__PURE__ */ __name(function getPTOptions13(key, index) { - return this.ptm(key, { - context: { - index, - count: this.value.length - } - }); - }, "getPTOptions") - } -}; -function render$6(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root") - }, _ctx.ptmi("root")), [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.value, function(item8, index) { - return openBlock(), createElementBlock("div", mergeProps({ - key: $options.getKey(item8, index), - "class": _ctx.cx("event"), - ref_for: true - }, $options.getPTOptions("event", index)), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("eventOpposite", { - index - }), - ref_for: true - }, $options.getPTOptions("eventOpposite", index)), [renderSlot(_ctx.$slots, "opposite", { - item: item8, - index - })], 16), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("eventSeparator"), - ref_for: true - }, $options.getPTOptions("eventSeparator", index)), [renderSlot(_ctx.$slots, "marker", { - item: item8, - index - }, function() { - return [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("eventMarker"), - ref_for: true - }, $options.getPTOptions("eventMarker", index)), null, 16)]; - }), index !== _ctx.value.length - 1 ? renderSlot(_ctx.$slots, "connector", { - key: 0, - item: item8, - index - }, function() { - return [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("eventConnector"), - ref_for: true - }, $options.getPTOptions("eventConnector", index)), null, 16)]; - }) : createCommentVNode("", true)], 16), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("eventContent"), - ref_for: true - }, $options.getPTOptions("eventContent", index)), [renderSlot(_ctx.$slots, "content", { - item: item8, - index - })], 16)], 16); - }), 128))], 16); -} -__name(render$6, "render$6"); -script$7.render = render$6; -var theme$1 = /* @__PURE__ */ __name(function theme38(_ref) { - var dt = _ref.dt; - return "\n.p-treeselect {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n background: ".concat(dt("treeselect.background"), ";\n border: 1px solid ").concat(dt("treeselect.border.color"), ";\n transition: background ").concat(dt("treeselect.transition.duration"), ", color ").concat(dt("treeselect.transition.duration"), ", border-color ").concat(dt("treeselect.transition.duration"), ", outline-color ").concat(dt("treeselect.transition.duration"), ", box-shadow ").concat(dt("treeselect.transition.duration"), ";\n border-radius: ").concat(dt("treeselect.border.radius"), ";\n outline-color: transparent;\n box-shadow: ").concat(dt("treeselect.shadow"), ";\n}\n\n.p-treeselect:not(.p-disabled):hover {\n border-color: ").concat(dt("treeselect.hover.border.color"), ";\n}\n\n.p-treeselect:not(.p-disabled).p-focus {\n border-color: ").concat(dt("treeselect.focus.border.color"), ";\n box-shadow: ").concat(dt("treeselect.focus.ring.shadow"), ";\n outline: ").concat(dt("treeselect.focus.ring.width"), " ").concat(dt("treeselect.focus.ring.style"), " ").concat(dt("treeselect.focus.ring.color"), ";\n outline-offset: ").concat(dt("treeselect.focus.ring.offset"), ";\n}\n\n.p-treeselect.p-variant-filled {\n background: ").concat(dt("treeselect.filled.background"), ";\n}\n\n.p-treeselect.p-variant-filled:not(.p-disabled):hover {\n background: ").concat(dt("treeselect.filled.hover.background"), ";\n}\n\n.p-treeselect.p-variant-filled.p-focus {\n background: ").concat(dt("treeselect.filled.focus.background"), ";\n}\n\n.p-treeselect.p-invalid {\n border-color: ").concat(dt("treeselect.invalid.border.color"), ";\n}\n\n.p-treeselect.p-disabled {\n opacity: 1;\n background: ").concat(dt("treeselect.disabled.background"), ";\n}\n\n.p-treeselect-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n color: ").concat(dt("treeselect.clear.icon.color"), ";\n inset-inline-end: ").concat(dt("treeselect.dropdown.width"), ";\n}\n\n.p-treeselect-dropdown {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n background: transparent;\n color: ").concat(dt("treeselect.dropdown.color"), ";\n width: ").concat(dt("treeselect.dropdown.width"), ";\n border-start-end-radius: ").concat(dt("border.radius.md"), ";\n border-end-end-radius: ").concat(dt("border.radius.md"), ";\n}\n\n.p-treeselect-label-container {\n overflow: hidden;\n flex: 1 1 auto;\n cursor: pointer;\n}\n\n.p-treeselect-label {\n display: flex;\n align-items: center;\n gap: calc(").concat(dt("treeselect.padding.y"), " / 2);\n white-space: nowrap;\n cursor: pointer;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: ").concat(dt("treeselect.padding.y"), " ").concat(dt("treeselect.padding.x"), ";\n color: ").concat(dt("treeselect.color"), ";\n}\n\n.p-treeselect-label.p-placeholder {\n color: ").concat(dt("treeselect.placeholder.color"), ";\n}\n\n.p-treeselect.p-invalid .p-treeselect-label.p-placeholder {\n color: ").concat(dt("treeselect.invalid.placeholder.color"), ";\n}\n\n.p-treeselect.p-disabled .p-treeselect-label {\n color: ").concat(dt("treeselect.disabled.color"), ";\n}\n\n.p-treeselect-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\n\n.p-treeselect .p-treeselect-overlay {\n min-width: 100%;\n}\n\n.p-treeselect-overlay {\n position: absolute;\n top: 0;\n left: 0;\n background: ").concat(dt("treeselect.overlay.background"), ";\n color: ").concat(dt("treeselect.overlay.color"), ";\n border: 1px solid ").concat(dt("treeselect.overlay.border.color"), ";\n border-radius: ").concat(dt("treeselect.overlay.border.radius"), ";\n box-shadow: ").concat(dt("treeselect.overlay.shadow"), ";\n overflow: hidden;\n}\n\n.p-treeselect-tree-container {\n overflow: auto;\n}\n\n.p-treeselect-empty-message {\n padding: ").concat(dt("treeselect.empty.message.padding"), ";\n background: transparent;\n}\n\n.p-treeselect-fluid {\n display: flex;\n}\n\n.p-treeselect-overlay .p-tree {\n padding: ").concat(dt("treeselect.tree.padding"), ";\n}\n\n.p-treeselect-overlay .p-tree-loading {\n min-height: 3rem;\n}\n\n.p-treeselect-label .p-chip {\n padding-block-start: calc(").concat(dt("treeselect.padding.y"), " / 2);\n padding-block-end: calc(").concat(dt("treeselect.padding.y"), " / 2);\n border-radius: ").concat(dt("treeselect.chip.border.radius"), ";\n}\n\n.p-treeselect-label:has(.p-chip) {\n padding: calc(").concat(dt("treeselect.padding.y"), " / 2) calc(").concat(dt("treeselect.padding.x"), " / 2);\n}\n\n.p-treeselect-sm .p-treeselect-label {\n font-size: ").concat(dt("treeselect.sm.font.size"), ";\n padding-block: ").concat(dt("treeselect.sm.padding.y"), ";\n padding-inline: ").concat(dt("treeselect.sm.padding.x"), ";\n}\n\n.p-treeselect-sm .p-treeselect-dropdown .p-icon {\n font-size: ").concat(dt("treeselect.sm.font.size"), ";\n width: ").concat(dt("treeselect.sm.font.size"), ";\n height: ").concat(dt("treeselect.sm.font.size"), ";\n}\n\n.p-treeselect-lg .p-treeselect-label {\n font-size: ").concat(dt("treeselect.lg.font.size"), ";\n padding-block: ").concat(dt("treeselect.lg.padding.y"), ";\n padding-inline: ").concat(dt("treeselect.lg.padding.x"), ";\n}\n\n.p-treeselect-lg .p-treeselect-dropdown .p-icon {\n font-size: ").concat(dt("treeselect.lg.font.size"), ";\n width: ").concat(dt("treeselect.lg.font.size"), ";\n height: ").concat(dt("treeselect.lg.font.size"), ";\n}\n"); -}, "theme"); -var inlineStyles$1 = { - root: /* @__PURE__ */ __name(function root31(_ref2) { - var props = _ref2.props; - return { - position: props.appendTo === "self" ? "relative" : void 0 - }; - }, "root") -}; -var classes$1 = { - root: /* @__PURE__ */ __name(function root32(_ref3) { - var instance = _ref3.instance, props = _ref3.props; - return ["p-treeselect p-component p-inputwrapper", { - "p-treeselect-display-chip": props.display === "chip", - "p-disabled": props.disabled, - "p-invalid": instance.$invalid, - "p-focus": instance.focused, - "p-variant-filled": instance.$variant === "filled", - "p-inputwrapper-filled": instance.$filled, - "p-inputwrapper-focus": instance.focused || instance.overlayVisible, - "p-treeselect-open": instance.overlayVisible, - "p-treeselect-fluid": instance.$fluid, - "p-treeselect-sm p-inputfield-sm": props.size === "small", - "p-treeselect-lg p-inputfield-lg": props.size === "large" - }]; - }, "root"), - labelContainer: "p-treeselect-label-container", - label: /* @__PURE__ */ __name(function label10(_ref4) { - var instance = _ref4.instance, props = _ref4.props; - return ["p-treeselect-label", { - "p-placeholder": instance.label === props.placeholder, - "p-treeselect-label-empty": !props.placeholder && instance.emptyValue - }]; - }, "label"), - clearIcon: "p-treeselect-clear-icon", - chip: "p-treeselect-chip-item", - pcChip: "p-treeselect-chip", - dropdown: "p-treeselect-dropdown", - dropdownIcon: "p-treeselect-dropdown-icon", - panel: "p-treeselect-overlay p-component", - treeContainer: "p-treeselect-tree-container", - emptyMessage: "p-treeselect-empty-message" -}; -var TreeSelectStyle = BaseStyle.extend({ - name: "treeselect", - theme: theme$1, - classes: classes$1, - inlineStyles: inlineStyles$1 -}); -var script$1$1 = { - name: "BaseTreeSelect", - "extends": script$1k, - props: { - options: Array, - scrollHeight: { - type: String, - "default": "20rem" - }, - placeholder: { - type: String, - "default": null - }, - tabindex: { - type: Number, - "default": null - }, - selectionMode: { - type: String, - "default": "single" - }, - selectedItemsLabel: { - type: String, - "default": null - }, - maxSelectedLabels: { - type: Number, - "default": null - }, - appendTo: { - type: [String, Object], - "default": "body" - }, - emptyMessage: { - type: String, - "default": null - }, - display: { - type: String, - "default": "comma" - }, - metaKeySelection: { - type: Boolean, - "default": false - }, - loading: { - type: Boolean, - "default": false - }, - loadingIcon: { - type: String, - "default": void 0 - }, - loadingMode: { - type: String, - "default": "mask" - }, - showClear: { - type: Boolean, - "default": false - }, - clearIcon: { - type: String, - "default": void 0 - }, - filter: { - type: Boolean, - "default": false - }, - filterBy: { - type: [String, Function], - "default": "label" - }, - filterMode: { - type: String, - "default": "lenient" - }, - filterPlaceholder: { - type: String, - "default": null - }, - filterLocale: { - type: String, - "default": void 0 - }, - inputId: { - type: String, - "default": null - }, - inputClass: { - type: [String, Object], - "default": null - }, - inputStyle: { - type: Object, - "default": null - }, - inputProps: { - type: null, - "default": null - }, - panelClass: { - type: [String, Object], - "default": null - }, - panelProps: { - type: null, - "default": null - }, - ariaLabelledby: { - type: String, - "default": null - }, - ariaLabel: { - type: String, - "default": null - }, - expandedKeys: { - type: null, - "default": null - } - }, - style: TreeSelectStyle, - provide: /* @__PURE__ */ __name(function provide49() { - return { - $pcTreeSelect: this, - $parentInstance: this - }; - }, "provide") -}; -function _typeof$1$1(o) { - "@babel/helpers - typeof"; - return _typeof$1$1 = "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$1$1(o); -} -__name(_typeof$1$1, "_typeof$1$1"); -function ownKeys$1$1(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$1$1, "ownKeys$1$1"); -function _objectSpread$1$1(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$1$1(Object(t2), true).forEach(function(r2) { - _defineProperty$1$1(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$1$1(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$1$1, "_objectSpread$1$1"); -function _defineProperty$1$1(e, r, t2) { - return (r = _toPropertyKey$1$1(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$1$1, "_defineProperty$1$1"); -function _toPropertyKey$1$1(t2) { - var i = _toPrimitive$1$1(t2, "string"); - return "symbol" == _typeof$1$1(i) ? i : i + ""; -} -__name(_toPropertyKey$1$1, "_toPropertyKey$1$1"); -function _toPrimitive$1$1(t2, r) { - if ("object" != _typeof$1$1(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$1$1(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$1$1, "_toPrimitive$1$1"); -function _createForOfIteratorHelper$2(r, e) { - var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; - if (!t2) { - if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$2(r)) || e) { - t2 && (r = t2); - var _n = 0, F = /* @__PURE__ */ __name(function F2() { - }, "F"); - return { s: F, n: /* @__PURE__ */ __name(function n() { - return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; - }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { - throw r2; - }, "e"), 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 = true, u = false; - return { s: /* @__PURE__ */ __name(function s() { - t2 = t2.call(r); - }, "s"), n: /* @__PURE__ */ __name(function n() { - var r2 = t2.next(); - return a = r2.done, r2; - }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { - u = true, o = r2; - }, "e"), f: /* @__PURE__ */ __name(function f() { - try { - a || null == t2["return"] || t2["return"](); - } finally { - if (u) throw o; - } - }, "f") }; -} -__name(_createForOfIteratorHelper$2, "_createForOfIteratorHelper$2"); -function _toConsumableArray$2(r) { - return _arrayWithoutHoles$2(r) || _iterableToArray$2(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread$2(); -} -__name(_toConsumableArray$2, "_toConsumableArray$2"); -function _nonIterableSpread$2() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -__name(_nonIterableSpread$2, "_nonIterableSpread$2"); -function _unsupportedIterableToArray$2(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$2(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$2(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$2, "_unsupportedIterableToArray$2"); -function _iterableToArray$2(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$2, "_iterableToArray$2"); -function _arrayWithoutHoles$2(r) { - if (Array.isArray(r)) return _arrayLikeToArray$2(r); -} -__name(_arrayWithoutHoles$2, "_arrayWithoutHoles$2"); -function _arrayLikeToArray$2(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; -} -__name(_arrayLikeToArray$2, "_arrayLikeToArray$2"); -var script$6 = { - name: "TreeSelect", - "extends": script$1$1, - inheritAttrs: false, - emits: ["before-show", "before-hide", "change", "show", "hide", "node-select", "node-unselect", "node-expand", "node-collapse", "focus", "blur", "update:expandedKeys"], - inject: { - $pcFluid: { - "default": null - } - }, - data: /* @__PURE__ */ __name(function data35() { - return { - id: this.$attrs.id, - focused: false, - overlayVisible: false, - d_expandedKeys: this.expandedKeys || {} - }; - }, "data"), - watch: { - "$attrs.id": /* @__PURE__ */ __name(function $attrsId13(newValue) { - this.id = newValue || UniqueComponentId(); - }, "$attrsId"), - modelValue: { - handler: /* @__PURE__ */ __name(function handler4() { - if (!this.selfChange) { - this.updateTreeState(); - } - this.selfChange = false; - }, "handler"), - immediate: true - }, - options: /* @__PURE__ */ __name(function options3() { - this.updateTreeState(); - }, "options"), - expandedKeys: /* @__PURE__ */ __name(function expandedKeys2(value2) { - this.d_expandedKeys = value2; - }, "expandedKeys") - }, - outsideClickListener: null, - resizeListener: null, - scrollHandler: null, - overlay: null, - selfChange: false, - selfClick: false, - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount16() { - this.unbindOutsideClickListener(); - this.unbindResizeListener(); - if (this.scrollHandler) { - this.scrollHandler.destroy(); - this.scrollHandler = null; - } - if (this.overlay) { - ZIndex.clear(this.overlay); - this.overlay = null; - } - }, "beforeUnmount"), - mounted: /* @__PURE__ */ __name(function mounted40() { - this.id = this.id || UniqueComponentId(); - this.updateTreeState(); - }, "mounted"), - methods: { - show: /* @__PURE__ */ __name(function show6() { - this.$emit("before-show"); - this.overlayVisible = true; - }, "show"), - hide: /* @__PURE__ */ __name(function hide6() { - this.$emit("before-hide"); - this.overlayVisible = false; - this.$refs.focusInput.focus(); - }, "hide"), - onFocus: /* @__PURE__ */ __name(function onFocus14(event2) { - this.focused = true; - this.$emit("focus", event2); - }, "onFocus"), - onBlur: /* @__PURE__ */ __name(function onBlur14(event2) { - var _this$formField$onBlu, _this$formField; - this.focused = false; - this.$emit("blur", event2); - (_this$formField$onBlu = (_this$formField = this.formField).onBlur) === null || _this$formField$onBlu === void 0 || _this$formField$onBlu.call(_this$formField); - }, "onBlur"), - onClick: /* @__PURE__ */ __name(function onClick8(event2) { - if (this.disabled) { - return; - } - if (event2.target.tagName === "INPUT" || event2.target.getAttribute("data-pc-section") === "clearicon" || event2.target.closest('[data-pc-section="clearicon"]')) { - return; - } else if (!this.overlay || !this.overlay.contains(event2.target)) { - if (this.overlayVisible) this.hide(); - else this.show(); - focus(this.$refs.focusInput); - } - }, "onClick"), - onClearClick: /* @__PURE__ */ __name(function onClearClick3() { - this.onSelectionChange(null); - }, "onClearClick"), - onSelectionChange: /* @__PURE__ */ __name(function onSelectionChange(keys) { - this.selfChange = true; - this.writeValue(keys); - this.$emit("change", keys); - }, "onSelectionChange"), - onNodeSelect: /* @__PURE__ */ __name(function onNodeSelect(node2) { - this.$emit("node-select", node2); - if (this.selectionMode === "single") { - this.hide(); - } - }, "onNodeSelect"), - onNodeUnselect: /* @__PURE__ */ __name(function onNodeUnselect(node2) { - this.$emit("node-unselect", node2); - }, "onNodeUnselect"), - onNodeToggle: /* @__PURE__ */ __name(function onNodeToggle2(keys) { - this.d_expandedKeys = keys; - this.$emit("update:expandedKeys", this.d_expandedKeys); - }, "onNodeToggle"), - getSelectedItemsLabel: /* @__PURE__ */ __name(function getSelectedItemsLabel2() { - var pattern = /{(.*?)}/; - var selectedItemsLabel = this.selectedItemsLabel || this.$primevue.config.locale.selectionMessage; - if (pattern.test(selectedItemsLabel)) { - return selectedItemsLabel.replace(selectedItemsLabel.match(pattern)[0], Object.keys(this.d_value).length + ""); - } - return selectedItemsLabel; - }, "getSelectedItemsLabel"), - onFirstHiddenFocus: /* @__PURE__ */ __name(function onFirstHiddenFocus2(event2) { - var focusableEl = event2.relatedTarget === this.$refs.focusInput ? getFirstFocusableElement(this.overlay, ':not([data-p-hidden-focusable="true"])') : this.$refs.focusInput; - focus(focusableEl); - }, "onFirstHiddenFocus"), - onLastHiddenFocus: /* @__PURE__ */ __name(function onLastHiddenFocus2(event2) { - var focusableEl = event2.relatedTarget === this.$refs.focusInput ? getLastFocusableElement(this.overlay, ':not([data-p-hidden-focusable="true"])') : this.$refs.focusInput; - focus(focusableEl); - }, "onLastHiddenFocus"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown12(event2) { - switch (event2.code) { - case "ArrowDown": - this.onArrowDownKey(event2); - break; - case "Space": - case "Enter": - case "NumpadEnter": - this.onEnterKey(event2); - break; - case "Escape": - this.onEscapeKey(event2); - break; - case "Tab": - this.onTabKey(event2); - break; - } - }, "onKeyDown"), - onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey8(event2) { - var _this = this; - if (this.overlayVisible) return; - this.show(); - this.$nextTick(function() { - var treeNodeEl = find(_this.$refs.tree.$el, '[data-pc-section="treeitem"]'); - var focusedElement = _toConsumableArray$2(treeNodeEl).find(function(item8) { - return item8.getAttribute("tabindex") === "0"; - }); - focus(focusedElement); - }); - event2.preventDefault(); - }, "onArrowDownKey"), - onEnterKey: /* @__PURE__ */ __name(function onEnterKey8(event2) { - if (this.overlayVisible) { - this.hide(); - } else { - this.onArrowDownKey(event2); - } - event2.preventDefault(); - }, "onEnterKey"), - onEscapeKey: /* @__PURE__ */ __name(function onEscapeKey5(event2) { - if (this.overlayVisible) { - this.hide(); - event2.preventDefault(); - } - }, "onEscapeKey"), - onTabKey: /* @__PURE__ */ __name(function onTabKey5(event2) { - var pressedInInputText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; - if (!pressedInInputText) { - if (this.overlayVisible && this.hasFocusableElements()) { - focus(this.$refs.firstHiddenFocusableElementOnOverlay); - event2.preventDefault(); - } - } - }, "onTabKey"), - hasFocusableElements: /* @__PURE__ */ __name(function hasFocusableElements2() { - return getFocusableElements(this.overlay, ':not([data-p-hidden-focusable="true"])').length > 0; - }, "hasFocusableElements"), - onOverlayEnter: /* @__PURE__ */ __name(function onOverlayEnter5(el) { - ZIndex.set("overlay", el, this.$primevue.config.zIndex.overlay); - addStyle(el, { - position: "absolute", - top: "0", - left: "0" - }); - this.alignOverlay(); - this.focus(); - }, "onOverlayEnter"), - onOverlayAfterEnter: /* @__PURE__ */ __name(function onOverlayAfterEnter3() { - this.bindOutsideClickListener(); - this.bindScrollListener(); - this.bindResizeListener(); - this.scrollValueInView(); - this.$emit("show"); - }, "onOverlayAfterEnter"), - onOverlayLeave: /* @__PURE__ */ __name(function onOverlayLeave5() { - this.unbindOutsideClickListener(); - this.unbindScrollListener(); - this.unbindResizeListener(); - this.$emit("hide"); - this.overlay = null; - }, "onOverlayLeave"), - onOverlayAfterLeave: /* @__PURE__ */ __name(function onOverlayAfterLeave5(el) { - ZIndex.clear(el); - }, "onOverlayAfterLeave"), - focus: /* @__PURE__ */ __name(function focus3() { - var focusableElements = getFocusableElements(this.overlay); - if (focusableElements && focusableElements.length > 0) { - focusableElements[0].focus(); - } - }, "focus"), - alignOverlay: /* @__PURE__ */ __name(function alignOverlay6() { - if (this.appendTo === "self") { - relativePosition(this.overlay, this.$el); - } else { - this.overlay.style.minWidth = getOuterWidth(this.$el) + "px"; - absolutePosition(this.overlay, this.$el); - } - }, "alignOverlay"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener6() { - var _this2 = this; - if (!this.outsideClickListener) { - this.outsideClickListener = function(event2) { - if (_this2.overlayVisible && !_this2.selfClick && _this2.isOutsideClicked(event2)) { - _this2.hide(); - } - _this2.selfClick = false; - }; - document.addEventListener("click", this.outsideClickListener); - } - }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener6() { - if (this.outsideClickListener) { - document.removeEventListener("click", this.outsideClickListener); - this.outsideClickListener = null; - } - }, "unbindOutsideClickListener"), - bindScrollListener: /* @__PURE__ */ __name(function bindScrollListener7() { - var _this3 = this; - if (!this.scrollHandler) { - this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, function() { - if (_this3.overlayVisible) { - _this3.hide(); - } - }); - } - this.scrollHandler.bindScrollListener(); - }, "bindScrollListener"), - unbindScrollListener: /* @__PURE__ */ __name(function unbindScrollListener7() { - if (this.scrollHandler) { - this.scrollHandler.unbindScrollListener(); - } - }, "unbindScrollListener"), - bindResizeListener: /* @__PURE__ */ __name(function bindResizeListener7() { - var _this4 = this; - if (!this.resizeListener) { - this.resizeListener = function() { - if (_this4.overlayVisible && !isTouchDevice()) { - _this4.hide(); - } - }; - window.addEventListener("resize", this.resizeListener); - } - }, "bindResizeListener"), - unbindResizeListener: /* @__PURE__ */ __name(function unbindResizeListener7() { - if (this.resizeListener) { - window.removeEventListener("resize", this.resizeListener); - this.resizeListener = null; - } - }, "unbindResizeListener"), - isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked4(event2) { - return !(this.$el.isSameNode(event2.target) || this.$el.contains(event2.target) || this.overlay && this.overlay.contains(event2.target)); - }, "isOutsideClicked"), - overlayRef: /* @__PURE__ */ __name(function overlayRef5(el) { - this.overlay = el; - }, "overlayRef"), - onOverlayClick: /* @__PURE__ */ __name(function onOverlayClick6(event2) { - OverlayEventBus.emit("overlay-click", { - originalEvent: event2, - target: this.$el - }); - this.selfClick = true; - }, "onOverlayClick"), - onOverlayKeydown: /* @__PURE__ */ __name(function onOverlayKeydown(event2) { - if (event2.code === "Escape") this.hide(); - }, "onOverlayKeydown"), - findSelectedNodes: /* @__PURE__ */ __name(function findSelectedNodes(node2, keys, selectedNodes2) { - if (node2) { - if (this.isSelected(node2, keys)) { - selectedNodes2.push(node2); - delete keys[node2.key]; - } - if (Object.keys(keys).length && node2.children) { - var _iterator = _createForOfIteratorHelper$2(node2.children), _step; - try { - for (_iterator.s(); !(_step = _iterator.n()).done; ) { - var childNode = _step.value; - this.findSelectedNodes(childNode, keys, selectedNodes2); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - } - } else { - var _iterator2 = _createForOfIteratorHelper$2(this.options), _step2; - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { - var _childNode = _step2.value; - this.findSelectedNodes(_childNode, keys, selectedNodes2); - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - } - }, "findSelectedNodes"), - isSelected: /* @__PURE__ */ __name(function isSelected5(node2, keys) { - return this.selectionMode === "checkbox" ? keys[node2.key] && keys[node2.key].checked : keys[node2.key]; - }, "isSelected"), - updateTreeState: /* @__PURE__ */ __name(function updateTreeState() { - var keys = _objectSpread$1$1({}, this.d_value); - if (keys && this.options) { - this.updateTreeBranchState(null, null, keys); - } - }, "updateTreeState"), - updateTreeBranchState: /* @__PURE__ */ __name(function updateTreeBranchState(node2, path, keys) { - if (node2) { - if (this.isSelected(node2, keys)) { - this.expandPath(path); - delete keys[node2.key]; - } - if (Object.keys(keys).length && node2.children) { - var _iterator3 = _createForOfIteratorHelper$2(node2.children), _step3; - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { - var childNode = _step3.value; - path.push(node2.key); - this.updateTreeBranchState(childNode, path, keys); - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - } - } else { - var _iterator4 = _createForOfIteratorHelper$2(this.options), _step4; - try { - for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) { - var _childNode2 = _step4.value; - this.updateTreeBranchState(_childNode2, [], keys); - } - } catch (err) { - _iterator4.e(err); - } finally { - _iterator4.f(); - } - } - }, "updateTreeBranchState"), - expandPath: /* @__PURE__ */ __name(function expandPath(path) { - if (path.length > 0) { - var _iterator5 = _createForOfIteratorHelper$2(path), _step5; - try { - for (_iterator5.s(); !(_step5 = _iterator5.n()).done; ) { - var key = _step5.value; - this.d_expandedKeys[key] = true; - } - } catch (err) { - _iterator5.e(err); - } finally { - _iterator5.f(); - } - this.d_expandedKeys = _objectSpread$1$1({}, this.d_expandedKeys); - this.$emit("update:expandedKeys", this.d_expandedKeys); - } - }, "expandPath"), - scrollValueInView: /* @__PURE__ */ __name(function scrollValueInView() { - if (this.overlay) { - var selectedItem = findSingle(this.overlay, '[data-p-selected="true"]'); - if (selectedItem) { - selectedItem.scrollIntoView({ - block: "nearest", - inline: "start" - }); - } - } - }, "scrollValueInView") - }, - computed: { - selectedNodes: /* @__PURE__ */ __name(function selectedNodes() { - var selectedNodes2 = []; - if (this.d_value && this.options) { - var keys = _objectSpread$1$1({}, this.d_value); - this.findSelectedNodes(null, keys, selectedNodes2); - } - return selectedNodes2; - }, "selectedNodes"), - label: /* @__PURE__ */ __name(function label11() { - var value2 = this.selectedNodes; - var label12; - if (value2.length) { - if (isNotEmpty(this.maxSelectedLabels) && value2.length > this.maxSelectedLabels) { - label12 = this.getSelectedItemsLabel(); - } else { - label12 = value2.map(function(node2) { - return node2.label; - }).join(", "); - } - } else { - label12 = this.placeholder; - } - return label12; - }, "label"), - chipSelectedItems: /* @__PURE__ */ __name(function chipSelectedItems2() { - return isNotEmpty(this.maxSelectedLabels) && this.d_value && Object.keys(this.d_value).length > this.maxSelectedLabels; - }, "chipSelectedItems"), - emptyMessageText: /* @__PURE__ */ __name(function emptyMessageText4() { - return this.emptyMessage || this.$primevue.config.locale.emptyMessage; - }, "emptyMessageText"), - emptyValue: /* @__PURE__ */ __name(function emptyValue() { - return !this.$filled; - }, "emptyValue"), - emptyOptions: /* @__PURE__ */ __name(function emptyOptions() { - return !this.options || this.options.length === 0; - }, "emptyOptions"), - listId: /* @__PURE__ */ __name(function listId() { - return this.id + "_list"; - }, "listId"), - hasFluid: /* @__PURE__ */ __name(function hasFluid2() { - return isEmpty(this.fluid) ? !!this.$pcFluid : this.fluid; - }, "hasFluid"), - isClearIconVisible: /* @__PURE__ */ __name(function isClearIconVisible3() { - return this.showClear && this.d_value != null && isNotEmpty(this.options); - }, "isClearIconVisible") - }, - components: { - TSTree: script$1U, - Chip: script$1s, - Portal: script$1m, - ChevronDownIcon: script$1h, - TimesIcon: script$1q - }, - directives: { - ripple: Ripple - } -}; -function _typeof$6(o) { - "@babel/helpers - typeof"; - return _typeof$6 = "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$6(o); -} -__name(_typeof$6, "_typeof$6"); -function ownKeys$6(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$6, "ownKeys$6"); -function _objectSpread$6(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$6(Object(t2), true).forEach(function(r2) { - _defineProperty$6(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$6(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$6, "_objectSpread$6"); -function _defineProperty$6(e, r, t2) { - return (r = _toPropertyKey$6(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$6, "_defineProperty$6"); -function _toPropertyKey$6(t2) { - var i = _toPrimitive$6(t2, "string"); - return "symbol" == _typeof$6(i) ? i : i + ""; -} -__name(_toPropertyKey$6, "_toPropertyKey$6"); -function _toPrimitive$6(t2, r) { - if ("object" != _typeof$6(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$6(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$6, "_toPrimitive$6"); -var _hoisted_1$6 = ["id", "disabled", "tabindex", "aria-labelledby", "aria-label", "aria-expanded", "aria-controls"]; -var _hoisted_2$4 = { - key: 0 -}; -var _hoisted_3$4 = ["aria-expanded"]; -function render$5(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Chip = resolveComponent("Chip"); - var _component_TSTree = resolveComponent("TSTree"); - var _component_Portal = resolveComponent("Portal"); - return openBlock(), createElementBlock("div", mergeProps({ - ref: "container", - "class": _ctx.cx("root"), - style: _ctx.sx("root"), - onClick: _cache[10] || (_cache[10] = function() { - return $options.onClick && $options.onClick.apply($options, arguments); - }) - }, _ctx.ptmi("root")), [createBaseVNode("div", mergeProps({ - "class": "p-hidden-accessible" - }, _ctx.ptm("hiddenInputContainer"), { - "data-p-hidden-accessible": true - }), [createBaseVNode("input", mergeProps({ - ref: "focusInput", - id: _ctx.inputId, - type: "text", - role: "combobox", - "class": _ctx.inputClass, - style: _ctx.inputStyle, - readonly: "", - disabled: _ctx.disabled, - tabindex: !_ctx.disabled ? _ctx.tabindex : -1, - "aria-labelledby": _ctx.ariaLabelledby, - "aria-label": _ctx.ariaLabel, - "aria-haspopup": "tree", - "aria-expanded": $data.overlayVisible, - "aria-controls": $options.listId, - onFocus: _cache[0] || (_cache[0] = function($event) { - return $options.onFocus($event); - }), - onBlur: _cache[1] || (_cache[1] = function($event) { - return $options.onBlur($event); - }), - onKeydown: _cache[2] || (_cache[2] = function($event) { - return $options.onKeyDown($event); - }) - }, _objectSpread$6(_objectSpread$6({}, _ctx.inputProps), _ctx.ptm("hiddenInput"))), null, 16, _hoisted_1$6)], 16), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("labelContainer") - }, _ctx.ptm("labelContainer")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("label") - }, _ctx.ptm("label")), [renderSlot(_ctx.$slots, "value", { - value: $options.selectedNodes, - placeholder: _ctx.placeholder - }, function() { - return [_ctx.display === "comma" ? (openBlock(), createElementBlock(Fragment, { - key: 0 - }, [createTextVNode(toDisplayString($options.label || "empty"), 1)], 64)) : _ctx.display === "chip" ? (openBlock(), createElementBlock(Fragment, { - key: 1 - }, [$options.chipSelectedItems ? (openBlock(), createElementBlock("span", _hoisted_2$4, toDisplayString($options.label), 1)) : (openBlock(), createElementBlock(Fragment, { - key: 1 - }, [(openBlock(true), createElementBlock(Fragment, null, renderList($options.selectedNodes, function(node2) { - return openBlock(), createElementBlock("div", mergeProps({ - key: node2.key, - "class": _ctx.cx("chipItem"), - ref_for: true - }, _ctx.ptm("chipItem")), [createVNode(_component_Chip, { - "class": normalizeClass(_ctx.cx("pcChip")), - label: node2.label, - unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcChip") - }, null, 8, ["class", "label", "unstyled", "pt"])], 16); - }), 128)), $options.emptyValue ? (openBlock(), createElementBlock(Fragment, { - key: 0 - }, [createTextVNode(toDisplayString(_ctx.placeholder || "empty"), 1)], 64)) : createCommentVNode("", true)], 64))], 64)) : createCommentVNode("", true)]; - })], 16)], 16), $options.isClearIconVisible ? renderSlot(_ctx.$slots, "clearicon", { - key: 0, - "class": normalizeClass(_ctx.cx("clearIcon")), - clearCallback: $options.onClearClick - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon ? "i" : "TimesIcon"), mergeProps({ - ref: "clearIcon", - "class": [_ctx.cx("clearIcon"), _ctx.clearIcon], - onClick: $options.onClearClick - }, _ctx.ptm("clearIcon"), { - "data-pc-section": "clearicon" - }), null, 16, ["class", "onClick"]))]; - }) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("dropdown"), - role: "button", - "aria-haspopup": "tree", - "aria-expanded": $data.overlayVisible - }, _ctx.ptm("dropdown")), [renderSlot(_ctx.$slots, _ctx.$slots.dropdownicon ? "dropdownicon" : "triggericon", { - "class": normalizeClass(_ctx.cx("dropdownIcon")) - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent("ChevronDownIcon"), mergeProps({ - "class": _ctx.cx("dropdownIcon") - }, _ctx.ptm("dropdownIcon")), null, 16, ["class"]))]; - })], 16, _hoisted_3$4), createVNode(_component_Portal, { - appendTo: _ctx.appendTo - }, { - "default": withCtx(function() { - return [createVNode(Transition, mergeProps({ - name: "p-connected-overlay", - onEnter: $options.onOverlayEnter, - onAfterEnter: $options.onOverlayAfterEnter, - onLeave: $options.onOverlayLeave, - onAfterLeave: $options.onOverlayAfterLeave - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [$data.overlayVisible ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: $options.overlayRef, - onClick: _cache[8] || (_cache[8] = function() { - return $options.onOverlayClick && $options.onOverlayClick.apply($options, arguments); - }), - "class": [_ctx.cx("panel"), _ctx.panelClass], - onKeydown: _cache[9] || (_cache[9] = function() { - return $options.onOverlayKeydown && $options.onOverlayKeydown.apply($options, arguments); - }) - }, _objectSpread$6(_objectSpread$6({}, _ctx.panelProps), _ctx.ptm("panel"))), [createBaseVNode("span", mergeProps({ - ref: "firstHiddenFocusableElementOnOverlay", - role: "presentation", - "class": "p-hidden-accessible p-hidden-focusable", - tabindex: 0, - onFocus: _cache[3] || (_cache[3] = function() { - return $options.onFirstHiddenFocus && $options.onFirstHiddenFocus.apply($options, arguments); - }) - }, _ctx.ptm("hiddenFirstFocusableEl"), { - "data-p-hidden-accessible": true, - "data-p-hidden-focusable": true - }), null, 16), renderSlot(_ctx.$slots, "header", { - value: _ctx.d_value, - options: _ctx.options - }), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("treeContainer"), - style: { - "max-height": _ctx.scrollHeight - } - }, _ctx.ptm("treeContainer")), [createVNode(_component_TSTree, { - ref: "tree", - id: $options.listId, - value: _ctx.options, - selectionMode: _ctx.selectionMode, - loading: _ctx.loading, - loadingIcon: _ctx.loadingIcon, - loadingMode: _ctx.loadingMode, - filter: _ctx.filter, - filterBy: _ctx.filterBy, - filterMode: _ctx.filterMode, - filterPlaceholder: _ctx.filterPlaceholder, - filterLocale: _ctx.filterLocale, - "onUpdate:selectionKeys": $options.onSelectionChange, - selectionKeys: _ctx.d_value, - expandedKeys: $data.d_expandedKeys, - "onUpdate:expandedKeys": $options.onNodeToggle, - metaKeySelection: _ctx.metaKeySelection, - onNodeExpand: _cache[4] || (_cache[4] = function($event) { - return _ctx.$emit("node-expand", $event); - }), - onNodeCollapse: _cache[5] || (_cache[5] = function($event) { - return _ctx.$emit("node-collapse", $event); - }), - onNodeSelect: $options.onNodeSelect, - onNodeUnselect: $options.onNodeUnselect, - onClick: _cache[6] || (_cache[6] = withModifiers(function() { - }, ["stop"])), - level: 0, - unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcTree") - }, createSlots({ - _: 2 - }, [_ctx.$slots.option ? { - name: "default", - fn: withCtx(function(optionSlotProps) { - return [renderSlot(_ctx.$slots, "option", { - node: optionSlotProps.node, - expanded: optionSlotProps.expanded, - selected: optionSlotProps.selected - })]; - }), - key: "0" - } : void 0, _ctx.$slots.itemtoggleicon ? { - name: "toggleicon", - fn: withCtx(function(iconSlotProps) { - return [renderSlot(_ctx.$slots, "itemtoggleicon", { - node: iconSlotProps.node, - expanded: iconSlotProps.expanded, - "class": normalizeClass(iconSlotProps["class"]) - })]; - }), - key: "1" - } : _ctx.$slots.itemtogglericon ? { - name: "togglericon", - fn: withCtx(function(iconSlotProps) { - return [renderSlot(_ctx.$slots, "itemtogglericon", { - node: iconSlotProps.node, - expanded: iconSlotProps.expanded, - "class": normalizeClass(iconSlotProps["class"]) - })]; - }), - key: "2" - } : void 0, _ctx.$slots.itemcheckboxicon ? { - name: "checkboxicon", - fn: withCtx(function(iconSlotProps) { - return [renderSlot(_ctx.$slots, "itemcheckboxicon", { - checked: iconSlotProps.checked, - partialChecked: iconSlotProps.partialChecked, - "class": normalizeClass(iconSlotProps["class"]) - })]; - }), - key: "3" - } : void 0]), 1032, ["id", "value", "selectionMode", "loading", "loadingIcon", "loadingMode", "filter", "filterBy", "filterMode", "filterPlaceholder", "filterLocale", "onUpdate:selectionKeys", "selectionKeys", "expandedKeys", "onUpdate:expandedKeys", "metaKeySelection", "onNodeSelect", "onNodeUnselect", "unstyled", "pt"]), $options.emptyOptions && !_ctx.loading ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("emptyMessage") - }, _ctx.ptm("emptyMessage")), [renderSlot(_ctx.$slots, "empty", {}, function() { - return [createTextVNode(toDisplayString($options.emptyMessageText), 1)]; - })], 16)) : createCommentVNode("", true)], 16), renderSlot(_ctx.$slots, "footer", { - value: _ctx.d_value, - options: _ctx.options - }), createBaseVNode("span", mergeProps({ - ref: "lastHiddenFocusableElementOnOverlay", - role: "presentation", - "class": "p-hidden-accessible p-hidden-focusable", - tabindex: 0, - onFocus: _cache[7] || (_cache[7] = function() { - return $options.onLastHiddenFocus && $options.onLastHiddenFocus.apply($options, arguments); - }) - }, _ctx.ptm("hiddenLastFocusableEl"), { - "data-p-hidden-accessible": true, - "data-p-hidden-focusable": true - }), null, 16)], 16)) : createCommentVNode("", true)]; - }), - _: 3 - }, 16, ["onEnter", "onAfterEnter", "onLeave", "onAfterLeave"])]; - }), - _: 3 - }, 8, ["appendTo"])], 16); -} -__name(render$5, "render$5"); -script$6.render = render$5; -var theme39 = /* @__PURE__ */ __name(function theme40(_ref) { - var dt = _ref.dt; - return "\n.p-treetable {\n position: relative;\n}\n\n.p-treetable-table {\n border-spacing: 0;\n border-collapse: separate;\n width: 100%;\n}\n\n.p-treetable-scrollable > .p-treetable-table-container {\n position: relative;\n}\n\n.p-treetable-scrollable-table > .p-treetable-thead {\n inset-block-start: 0;\n z-index: 1;\n}\n\n.p-treetable-scrollable-table > .p-treetable-frozen-tbody {\n position: sticky;\n z-index: 1;\n}\n\n.p-treetable-scrollable-table > .p-treetable-tfoot {\n inset-block-end: 0;\n z-index: 1;\n}\n\n.p-treetable-scrollable .p-treetable-frozen-column {\n position: sticky;\n background: ".concat(dt("treetable.header.cell.background"), ";\n}\n\n.p-treetable-scrollable th.p-treetable-frozen-column {\n z-index: 1;\n}\n\n.p-treetable-scrollable > .p-treetable-table-container > .p-treetable-table > .p-treetable-thead {\n background: ").concat(dt("treetable.header.cell.background"), ";\n}\n\n.p-treetable-scrollable > .p-treetable-table-container > .p-treetable-table > .p-treetable-tfoot {\n background: ").concat(dt("treetable.footer.cell.background"), ";\n}\n\n.p-treetable-flex-scrollable {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n.p-treetable-flex-scrollable > .p-treetable-table-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n height: 100%;\n}\n\n.p-treetable-scrollable-table > .p-treetable-tbody > .p-treetable-row-group-header {\n position: sticky;\n z-index: 1;\n}\n\n.p-treetable-resizable-table > .p-treetable-thead > tr > th,\n.p-treetable-resizable-table > .p-treetable-tfoot > tr > td,\n.p-treetable-resizable-table > .p-treetable-tbody > tr > td {\n overflow: hidden;\n white-space: nowrap;\n}\n\n.p-treetable-resizable-table > .p-treetable-thead > tr > th.p-treetable-resizable-column:not(.p-treetable-frozen-column) {\n background-clip: padding-box;\n position: relative;\n}\n\n.p-treetable-resizable-table-fit > .p-treetable-thead > tr > th.p-treetable-resizable-column:last-child .p-treetable-column-resizer {\n display: none;\n}\n\n.p-treetable-column-resizer {\n display: block;\n position: absolute;\n inset-block-start: 0;\n inset-inline-end: 0;\n margin: 0;\n width: ").concat(dt("treetable.column.resizer.width"), ";\n height: 100%;\n padding: 0;\n cursor: col-resize;\n border: 1px solid transparent;\n}\n\n.p-treetable-column-header-content {\n display: flex;\n align-items: center;\n gap: ").concat(dt("treetable.header.cell.gap"), ";\n}\n\n.p-treetable-column-resize-indicator {\n width: ").concat(dt("treetable.resize.indicator.width"), ";\n position: absolute;\n z-index: 10;\n display: none;\n background: ").concat(dt("treetable.resize.indicator.color"), ";\n}\n\n.p-treetable-mask {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 2;\n}\n\n.p-treetable-paginator-top {\n border-color: ").concat(dt("treetable.paginator.top.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("treetable.paginator.top.border.width"), ";\n}\n\n.p-treetable-paginator-bottom {\n border-color: ").concat(dt("treetable.paginator.bottom.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("treetable.paginator.bottom.border.width"), ";\n}\n\n.p-treetable-header {\n background: ").concat(dt("treetable.header.background"), ";\n color: ").concat(dt("treetable.header.color"), ";\n border-color: ").concat(dt("treetable.header.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("treetable.header.border.width"), ";\n padding: ").concat(dt("treetable.header.padding"), ";\n}\n\n.p-treetable-footer {\n background: ").concat(dt("treetable.footer.background"), ";\n color: ").concat(dt("treetable.footer.color"), ";\n border-color: ").concat(dt("treetable.footer.border.color"), ";\n border-style: solid;\n border-width: ").concat(dt("treetable.footer.border.width"), ";\n padding: ").concat(dt("treetable.footer.padding"), ";\n}\n\n.p-treetable-header-cell {\n padding: ").concat(dt("treetable.header.cell.padding"), ";\n background: ").concat(dt("treetable.header.cell.background"), ";\n border-color: ").concat(dt("treetable.header.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n color: ").concat(dt("treetable.header.cell.color"), ";\n font-weight: normal;\n text-align: start;\n transition: background ").concat(dt("treetable.transition.duration"), ", color ").concat(dt("treetable.transition.duration"), ", border-color ").concat(dt("treetable.transition.duration"), ",\n outline-color ").concat(dt("treetable.transition.duration"), ", box-shadow ").concat(dt("treetable.transition.duration"), ";\n}\n\n.p-treetable-column-title {\n font-weight: ").concat(dt("treetable.column.title.font.weight"), ";\n}\n\n.p-treetable-tbody > tr {\n outline-color: transparent;\n background: ").concat(dt("treetable.row.background"), ";\n color: ").concat(dt("treetable.row.color"), ";\n transition: background ").concat(dt("treetable.transition.duration"), ", color ").concat(dt("treetable.transition.duration"), ", border-color ").concat(dt("treetable.transition.duration"), ",\n outline-color ").concat(dt("treetable.transition.duration"), ", box-shadow ").concat(dt("treetable.transition.duration"), ";\n}\n\n.p-treetable-tbody > tr > td {\n text-align: start;\n border-color: ").concat(dt("treetable.body.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n padding: ").concat(dt("treetable.body.cell.padding"), ";\n}\n\n.p-treetable-hoverable .p-treetable-tbody > tr:not(.p-treetable-row-selected):hover {\n background: ").concat(dt("treetable.row.hover.background"), ";\n color: ").concat(dt("treetable.row.hover.color"), ";\n}\n\n.p-treetable-tbody > tr.p-treetable-row-selected {\n background: ").concat(dt("treetable.row.selected.background"), ";\n color: ").concat(dt("treetable.row.selected.color"), ";\n}\n\n.p-treetable-tbody > tr:has(+ .p-treetable-row-selected) > td {\n border-block-end-color: ").concat(dt("treetable.body.cell.selected.border.color"), ";\n}\n\n.p-treetable-tbody > tr.p-treetable-row-selected > td {\n border-block-end-color: ").concat(dt("treetable.body.cell.selected.border.color"), ";\n}\n\n.p-treetable-tbody > tr:focus-visible,\n.p-treetable-tbody > tr.p-treetable-contextmenu-row-selected {\n box-shadow: ").concat(dt("treetable.row.focus.ring.shadow"), ";\n outline: ").concat(dt("treetable.row.focus.ring.width"), " ").concat(dt("treetable.row.focus.ring.style"), " ").concat(dt("treetable.row.focus.ring.color"), ";\n outline-offset: ").concat(dt("treetable.row.focus.ring.offset"), ";\n}\n\n.p-treetable-tfoot > tr > td {\n text-align: start;\n padding: ").concat(dt("treetable.footer.cell.padding"), ";\n border-color: ").concat(dt("treetable.footer.cell.border.color"), ";\n border-style: solid;\n border-width: 0 0 1px 0;\n color: ").concat(dt("treetable.footer.cell.color"), ";\n background: ").concat(dt("treetable.footer.cell.background"), ";\n}\n\n.p-treetable-column-footer {\n font-weight: ").concat(dt("treetable.column.footer.font.weight"), ";\n}\n\n.p-treetable-sortable-column {\n cursor: pointer;\n user-select: none;\n outline-color: transparent;\n}\n\n.p-treetable-column-title,\n.p-treetable-sort-icon,\n.p-treetable-sort-badge {\n vertical-align: middle;\n}\n\n.p-treetable-sort-icon {\n color: ").concat(dt("treetable.sort.icon.color"), ";\n font-size: ").concat(dt("treetable.sort.icon.size"), ";\n width: ").concat(dt("treetable.sort.icon.size"), ";\n height: ").concat(dt("treetable.sort.icon.size"), ";\n transition: color ").concat(dt("treetable.transition.duration"), ";\n}\n\n.p-treetable-sortable-column:not(.p-treetable-column-sorted):hover {\n background: ").concat(dt("treetable.header.cell.hover.background"), ";\n color: ").concat(dt("treetable.header.cell.hover.color"), ";\n}\n\n.p-treetable-sortable-column:not(.p-treetable-column-sorted):hover .p-treetable-sort-icon {\n color: ").concat(dt("treetable.sort.icon.hover.color"), ";\n}\n\n.p-treetable-column-sorted {\n background: ").concat(dt("treetable.header.cell.selected.background"), ";\n color: ").concat(dt("treetable.header.cell.selected.color"), ";\n}\n\n.p-treetable-column-sorted .p-treetable-sort-icon {\n color: ").concat(dt("treetable.header.cell.selected.color"), ";\n}\n\n.p-treetable-sortable-column:focus-visible {\n box-shadow: ").concat(dt("treetable.header.cell.focus.ring.shadow"), ";\n outline: ").concat(dt("treetable.header.cell.focus.ring.width"), " ").concat(dt("treetable.header.cell.focus.ring.style"), " ").concat(dt("treetable.header.cell.focus.ring.color"), ";\n outline-offset: ").concat(dt("treetable.header.cell.focus.ring.offset"), ";\n}\n\n.p-treetable-hoverable .p-treetable-selectable-row {\n cursor: pointer;\n}\n\n.p-treetable-loading-icon {\n font-size: ").concat(dt("treetable.loading.icon.size"), ";\n width: ").concat(dt("treetable.loading.icon.size"), ";\n height: ").concat(dt("treetable.loading.icon.size"), ";\n}\n\n.p-treetable-gridlines .p-treetable-header {\n border-width: 1px 1px 0 1px;\n}\n\n.p-treetable-gridlines .p-treetable-footer {\n border-width: 0 1px 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-paginator-top {\n border-width: 1px 1px 0 1px;\n}\n\n.p-treetable-gridlines .p-treetable-paginator-bottom {\n border-width: 0 1px 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-thead > tr > th {\n border-width: 1px 0 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-thead > tr > th:last-child {\n border-width: 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tbody > tr > td {\n border-width: 1px 0 0 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tbody > tr > td:last-child {\n border-width: 1px 1px 0 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tbody > tr:last-child > td {\n border-width: 1px 0 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tbody > tr:last-child > td:last-child {\n border-width: 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tfoot > tr > td {\n border-width: 1px 0 1px 1px;\n}\n\n.p-treetable-gridlines .p-treetable-tfoot > tr > td:last-child {\n border-width: 1px 1px 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines .p-treetable-thead + .p-treetable-tfoot > tr > td {\n border-width: 0 0 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines .p-treetable-thead + .p-treetable-tfoot > tr > td:last-child {\n border-width: 0 1px 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines:has(.p-treetable-thead):has(.p-treetable-tbody) .p-treetable-tbody > tr > td {\n border-width: 0 0 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines:has(.p-treetable-thead):has(.p-treetable-tbody) .p-treetable-tbody > tr > td:last-child {\n border-width: 0 1px 1px 1px;\n}\n\n.p-treetable.p-treetable-gridlines:has(.p-treetable-tbody):has(.p-treetable-tfoot) .p-treetable-tbody > tr:last-child > td {\n border-width: 0 0 0 1px;\n}\n\n.p-treetable.p-treetable-gridlines:has(.p-treetable-tbody):has(.p-treetable-tfoot) .p-treetable-tbody > tr:last-child > td:last-child {\n border-width: 0 1px 0 1px;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-header {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-thead > tr > th {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-tbody > tr > td {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-tfoot > tr > td {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-sm .p-treetable-footer {\n padding: 0.375rem 0.5rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-header {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-thead > tr > th {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-tbody > tr > td {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-tfoot > tr > td {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable.p-treetable-lg .p-treetable-footer {\n padding: 0.9375rem 1.25rem;\n}\n\n.p-treetable-body-cell-content {\n display: flex;\n align-items: center;\n gap: ").concat(dt("treetable.body.cell.gap"), ";\n}\n\n.p-treetable-tbody > tr.p-treetable-row-selected .p-treetable-node-toggle-button {\n color: inherit;\n}\n\n.p-treetable-node-toggle-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n width: ").concat(dt("treetable.node.toggle.button.size"), ";\n height: ").concat(dt("treetable.node.toggle.button.size"), ";\n color: ").concat(dt("treetable.node.toggle.button.color"), ";\n border: 0 none;\n background: transparent;\n cursor: pointer;\n border-radius: ").concat(dt("treetable.node.toggle.button.border.radius"), ";\n transition: background ").concat(dt("treetable.transition.duration"), ", color ").concat(dt("treetable.transition.duration"), ", border-color ").concat(dt("treetable.transition.duration"), ",\n outline-color ").concat(dt("treetable.transition.duration"), ", box-shadow ").concat(dt("treetable.transition.duration"), ";\n outline-color: transparent;\n user-select: none;\n}\n\n.p-treetable-node-toggle-button:enabled:hover {\n color: ").concat(dt("treetable.node.toggle.button.hover.color"), ";\n background: ").concat(dt("treetable.node.toggle.button.hover.background"), ";\n}\n\n.p-treetable-tbody > tr.p-treetable-row-selected .p-treetable-node-toggle-button:hover {\n background: ").concat(dt("treetable.node.toggle.button.selected.hover.background"), ";\n color: ").concat(dt("treetable.node.toggle.button.selected.hover.color"), ";\n}\n\n.p-treetable-node-toggle-button:focus-visible {\n box-shadow: ").concat(dt("treetable.node.toggle.button.focus.ring.shadow"), ";\n outline: ").concat(dt("treetable.node.toggle.button.focus.ring.width"), " ").concat(dt("treetable.node.toggle.button.focus.ring.style"), " ").concat(dt("treetable.node.toggle.button.focus.ring.color"), ";\n outline-offset: ").concat(dt("treetable.node.toggle.button.focus.ring.offset"), ";\n}\n\n.p-treetable-node-toggle-icon:dir(rtl) {\n transform: rotate(180deg);\n}\n"); -}, "theme"); -var classes = { - root: /* @__PURE__ */ __name(function root33(_ref2) { - var instance = _ref2.instance, props = _ref2.props; - return ["p-treetable p-component", { - "p-treetable-hoverable": props.rowHover || instance.rowSelectionMode, - "p-treetable-resizable": props.resizableColumns, - "p-treetable-resizable-fit": props.resizableColumns && props.columnResizeMode === "fit", - "p-treetable-scrollable": props.scrollable, - "p-treetable-flex-scrollable": props.scrollable && props.scrollHeight === "flex", - "p-treetable-gridlines": props.showGridlines, - "p-treetable-sm": props.size === "small", - "p-treetable-lg": props.size === "large" - }]; - }, "root"), - loading: "p-treetable-loading", - //TODO: required? - mask: "p-treetable-mask p-overlay-mask", - loadingIcon: "p-treetable-loading-icon", - header: "p-treetable-header", - paginator: /* @__PURE__ */ __name(function paginator(_ref3) { - var position = _ref3.position; - return "p-treetable-paginator-" + position; - }, "paginator"), - tableContainer: "p-treetable-table-container", - table: /* @__PURE__ */ __name(function table(_ref4) { - var props = _ref4.props; - return ["p-treetable-table", { - "p-treetable-scrollable-table": props.scrollable, - "p-treetable-resizable-table": props.resizableColumns, - "p-treetable-resizable-table-fit": props.resizableColumns && props.columnResizeMode === "fit" - }]; - }, "table"), - thead: "p-treetable-thead", - headerCell: /* @__PURE__ */ __name(function headerCell(_ref5) { - var instance = _ref5.instance, props = _ref5.props, context = _ref5.context; - return ["p-treetable-header-cell", { - "p-treetable-sortable-column": instance.columnProp("sortable"), - "p-treetable-resizable-column": props.resizableColumns, - "p-treetable-column-sorted": context === null || context === void 0 ? void 0 : context.sorted, - "p-treetable-frozen-column": instance.columnProp("frozen") - }]; - }, "headerCell"), - columnResizer: "p-treetable-column-resizer", - columnHeaderContent: "p-treetable-column-header-content", - columnTitle: "p-treetable-column-title", - sortIcon: "p-treetable-sort-icon", - pcSortBadge: "p-treetable-sort-badge", - tbody: "p-treetable-tbody", - row: /* @__PURE__ */ __name(function row(_ref6) { - var props = _ref6.props, instance = _ref6.instance; - return [{ - "p-treetable-row-selected": instance.selected, - "p-treetable-contextmenu-row-selected": props.contextMenuSelection && instance.isSelectedWithContextMenu - }]; - }, "row"), - bodyCell: /* @__PURE__ */ __name(function bodyCell(_ref7) { - var instance = _ref7.instance; - return [{ - "p-treetable-frozen-column": instance.columnProp("frozen") - }]; - }, "bodyCell"), - bodyCellContent: /* @__PURE__ */ __name(function bodyCellContent(_ref8) { - var instance = _ref8.instance; - return ["p-treetable-body-cell-content", { - "p-treetable-body-cell-content-expander": instance.columnProp("expander") - }]; - }, "bodyCellContent"), - nodeToggleButton: "p-treetable-node-toggle-button", - nodeToggleIcon: "p-treetable-node-toggle-icon", - pcNodeCheckbox: "p-treetable-node-checkbox", - emptyMessage: "p-treetable-empty-message", - tfoot: "p-treetable-tfoot", - footerCell: /* @__PURE__ */ __name(function footerCell(_ref9) { - var instance = _ref9.instance; - return [{ - "p-treetable-frozen-column": instance.columnProp("frozen") - }]; - }, "footerCell"), - footer: "p-treetable-footer", - columnResizeIndicator: "p-treetable-column-resize-indicator" -}; -var inlineStyles = { - tableContainer: { - overflow: "auto" - }, - thead: { - position: "sticky" - }, - tfoot: { - position: "sticky" - } -}; -var TreeTableStyle = BaseStyle.extend({ - name: "treetable", - theme: theme39, - classes, - inlineStyles -}); -var script$5 = { - name: "BaseTreeTable", - "extends": script$1f, - props: { - value: { - type: null, - "default": null - }, - dataKey: { - type: [String, Function], - "default": "key" - }, - expandedKeys: { - type: null, - "default": null - }, - selectionKeys: { - type: null, - "default": null - }, - selectionMode: { - type: String, - "default": null - }, - metaKeySelection: { - type: Boolean, - "default": false - }, - contextMenu: { - type: Boolean, - "default": false - }, - contextMenuSelection: { - type: Object, - "default": null - }, - rows: { - type: Number, - "default": 0 - }, - first: { - type: Number, - "default": 0 - }, - totalRecords: { - type: Number, - "default": 0 - }, - paginator: { - type: Boolean, - "default": false - }, - paginatorPosition: { - type: String, - "default": "bottom" - }, - alwaysShowPaginator: { - type: Boolean, - "default": true - }, - paginatorTemplate: { - type: String, - "default": "FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown" - }, - pageLinkSize: { - type: Number, - "default": 5 - }, - rowsPerPageOptions: { - type: Array, - "default": null - }, - currentPageReportTemplate: { - type: String, - "default": "({currentPage} of {totalPages})" - }, - lazy: { - type: Boolean, - "default": false - }, - loading: { - type: Boolean, - "default": false - }, - loadingIcon: { - type: String, - "default": void 0 - }, - loadingMode: { - type: String, - "default": "mask" - }, - rowHover: { - type: Boolean, - "default": false - }, - autoLayout: { - type: Boolean, - "default": false - }, - sortField: { - type: [String, Function], - "default": null - }, - sortOrder: { - type: Number, - "default": null - }, - defaultSortOrder: { - type: Number, - "default": 1 - }, - multiSortMeta: { - type: Array, - "default": null - }, - sortMode: { - type: String, - "default": "single" - }, - removableSort: { - type: Boolean, - "default": false - }, - filters: { - type: Object, - "default": null - }, - filterMode: { - type: String, - "default": "lenient" - }, - filterLocale: { - type: String, - "default": void 0 - }, - resizableColumns: { - type: Boolean, - "default": false - }, - columnResizeMode: { - type: String, - "default": "fit" - }, - indentation: { - type: Number, - "default": 1 - }, - showGridlines: { - type: Boolean, - "default": false - }, - scrollable: { - type: Boolean, - "default": false - }, - scrollHeight: { - type: String, - "default": null - }, - size: { - type: String, - "default": null - }, - tableStyle: { - type: null, - "default": null - }, - tableClass: { - type: [String, Object], - "default": null - }, - tableProps: { - type: Object, - "default": null - } - }, - style: TreeTableStyle, - provide: /* @__PURE__ */ __name(function provide50() { - return { - $pcTreeTable: this, - $parentInstance: this - }; - }, "provide") -}; -var script$4 = { - name: "FooterCell", - hostName: "TreeTable", - "extends": script$1f, - props: { - column: { - type: Object, - "default": null - }, - index: { - type: Number, - "default": null - } - }, - data: /* @__PURE__ */ __name(function data36() { - return { - styleObject: {} - }; - }, "data"), - mounted: /* @__PURE__ */ __name(function mounted41() { - if (this.columnProp("frozen")) { - this.updateStickyPosition(); - } - }, "mounted"), - updated: /* @__PURE__ */ __name(function updated9() { - if (this.columnProp("frozen")) { - this.updateStickyPosition(); - } - }, "updated"), - methods: { - columnProp: /* @__PURE__ */ __name(function columnProp(prop) { - return getVNodeProp(this.column, prop); - }, "columnProp"), - getColumnPT: /* @__PURE__ */ __name(function getColumnPT(key) { - var _this$$parentInstance; - var columnMetaData = { - props: this.column.props, - parent: { - instance: this, - props: this.$props, - state: this.$data - }, - context: { - index: this.index, - frozen: this.columnProp("frozen"), - size: (_this$$parentInstance = this.$parentInstance) === null || _this$$parentInstance === void 0 ? void 0 : _this$$parentInstance.size - } - }; - return mergeProps(this.ptm("column.".concat(key), { - column: columnMetaData - }), this.ptm("column.".concat(key), columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData)); - }, "getColumnPT"), - getColumnProp: /* @__PURE__ */ __name(function getColumnProp() { - return this.column.props && this.column.props.pt ? this.column.props.pt : void 0; - }, "getColumnProp"), - updateStickyPosition: /* @__PURE__ */ __name(function updateStickyPosition() { - if (this.columnProp("frozen")) { - var align = this.columnProp("alignFrozen"); - if (align === "right") { - var pos = 0; - var next = getNextElementSibling(this.$el, '[data-p-frozen-column="true"]'); - if (next) { - pos = getOuterWidth(next) + parseFloat(next.style.right || 0); - } - this.styleObject.insetInlineEnd = pos + "px"; - } else { - var _pos = 0; - var prev = getPreviousElementSibling(this.$el, '[data-p-frozen-column="true"]'); - if (prev) { - _pos = getOuterWidth(prev) + parseFloat(prev.style.left || 0); - } - this.styleObject.insetInlineStart = _pos + "px"; - } - } - }, "updateStickyPosition") - }, - computed: { - containerClass: /* @__PURE__ */ __name(function containerClass4() { - return [this.columnProp("footerClass"), this.columnProp("class"), this.cx("footerCell")]; - }, "containerClass"), - containerStyle: /* @__PURE__ */ __name(function containerStyle2() { - var bodyStyle = this.columnProp("footerStyle"); - var columnStyle = this.columnProp("style"); - return this.columnProp("frozen") ? [columnStyle, bodyStyle, this.styleObject] : [columnStyle, bodyStyle]; - }, "containerStyle") - } -}; -function _typeof$5(o) { - "@babel/helpers - typeof"; - return _typeof$5 = "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$5(o); -} -__name(_typeof$5, "_typeof$5"); -function ownKeys$5(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$5, "ownKeys$5"); -function _objectSpread$5(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$5(Object(t2), true).forEach(function(r2) { - _defineProperty$5(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$5(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$5, "_objectSpread$5"); -function _defineProperty$5(e, r, t2) { - return (r = _toPropertyKey$5(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$5, "_defineProperty$5"); -function _toPropertyKey$5(t2) { - var i = _toPrimitive$5(t2, "string"); - return "symbol" == _typeof$5(i) ? i : i + ""; -} -__name(_toPropertyKey$5, "_toPropertyKey$5"); -function _toPrimitive$5(t2, r) { - if ("object" != _typeof$5(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$5(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$5, "_toPrimitive$5"); -var _hoisted_1$4 = ["data-p-frozen-column"]; -function render$4(_ctx, _cache, $props, $setup, $data, $options) { - return openBlock(), createElementBlock("td", mergeProps({ - style: $options.containerStyle, - "class": $options.containerClass, - role: "cell" - }, _objectSpread$5(_objectSpread$5({}, $options.getColumnPT("root")), $options.getColumnPT("footerCell")), { - "data-p-frozen-column": $options.columnProp("frozen") - }), [$props.column.children && $props.column.children.footer ? (openBlock(), createBlock(resolveDynamicComponent($props.column.children.footer), { - key: 0, - column: $props.column - }, null, 8, ["column"])) : createCommentVNode("", true), $options.columnProp("footer") ? (openBlock(), createElementBlock("span", mergeProps({ - key: 1, - "class": _ctx.cx("columnFooter") - }, $options.getColumnPT("columnFooter")), toDisplayString($options.columnProp("footer")), 17)) : createCommentVNode("", true)], 16, _hoisted_1$4); -} -__name(render$4, "render$4"); -script$4.render = render$4; -var script$3 = { - name: "HeaderCell", - hostName: "TreeTable", - "extends": script$1f, - emits: ["column-click", "column-resizestart"], - props: { - column: { - type: Object, - "default": null - }, - resizableColumns: { - type: Boolean, - "default": false - }, - sortField: { - type: [String, Function], - "default": null - }, - sortOrder: { - type: Number, - "default": null - }, - multiSortMeta: { - type: Array, - "default": null - }, - sortMode: { - type: String, - "default": "single" - }, - index: { - type: Number, - "default": null - } - }, - data: /* @__PURE__ */ __name(function data37() { - return { - styleObject: {} - }; - }, "data"), - mounted: /* @__PURE__ */ __name(function mounted42() { - if (this.columnProp("frozen")) { - this.updateStickyPosition(); - } - }, "mounted"), - updated: /* @__PURE__ */ __name(function updated10() { - if (this.columnProp("frozen")) { - this.updateStickyPosition(); - } - }, "updated"), - methods: { - columnProp: /* @__PURE__ */ __name(function columnProp2(prop) { - return getVNodeProp(this.column, prop); - }, "columnProp"), - getColumnPT: /* @__PURE__ */ __name(function getColumnPT2(key) { - var _this$$parentInstance; - var columnMetaData = { - props: this.column.props, - parent: { - instance: this, - props: this.$props, - state: this.$data - }, - context: { - index: this.index, - sorted: this.isColumnSorted(), - frozen: this.$parentInstance.scrollable && this.columnProp("frozen"), - resizable: this.resizableColumns, - scrollable: this.$parentInstance.scrollable, - showGridlines: this.$parentInstance.showGridlines, - size: (_this$$parentInstance = this.$parentInstance) === null || _this$$parentInstance === void 0 ? void 0 : _this$$parentInstance.size - } - }; - return mergeProps(this.ptm("column.".concat(key), { - column: columnMetaData - }), this.ptm("column.".concat(key), columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData)); - }, "getColumnPT"), - getColumnProp: /* @__PURE__ */ __name(function getColumnProp2() { - return this.column.props && this.column.props.pt ? this.column.props.pt : void 0; - }, "getColumnProp"), - updateStickyPosition: /* @__PURE__ */ __name(function updateStickyPosition2() { - if (this.columnProp("frozen")) { - var align = this.columnProp("alignFrozen"); - if (align === "right") { - var pos = 0; - var next = getNextElementSibling(this.$el, '[data-p-frozen-column="true"]'); - if (next) { - pos = getOuterWidth(next) + parseFloat(next.style.right || 0); - } - this.styleObject.insetInlineEnd = pos + "px"; - } else { - var _pos = 0; - var prev = getPreviousElementSibling(this.$el, '[data-p-frozen-column="true"]'); - if (prev) { - _pos = getOuterWidth(prev) + parseFloat(prev.style.left || 0); - } - this.styleObject.insetInlineStart = _pos + "px"; - } - var filterRow = this.$el.parentElement.nextElementSibling; - if (filterRow) { - var index = getIndex(this.$el); - filterRow.children[index].style.left = this.styleObject.left; - filterRow.children[index].style.right = this.styleObject.right; - } - } - }, "updateStickyPosition"), - onClick: /* @__PURE__ */ __name(function onClick9(event2) { - this.$emit("column-click", { - originalEvent: event2, - column: this.column - }); - }, "onClick"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown13(event2) { - if ((event2.code === "Enter" || event2.code === "NumpadEnter" || event2.code === "Space") && event2.currentTarget.nodeName === "TH" && getAttribute(event2.currentTarget, "data-p-sortable-column")) { - this.$emit("column-click", { - originalEvent: event2, - column: this.column - }); - event2.preventDefault(); - } - }, "onKeyDown"), - onResizeStart: /* @__PURE__ */ __name(function onResizeStart(event2) { - this.$emit("column-resizestart", event2); - }, "onResizeStart"), - getMultiSortMetaIndex: /* @__PURE__ */ __name(function getMultiSortMetaIndex() { - var index = -1; - for (var i = 0; i < this.multiSortMeta.length; i++) { - var meta = this.multiSortMeta[i]; - if (meta.field === this.columnProp("field") || meta.field === this.columnProp("sortField")) { - index = i; - break; - } - } - return index; - }, "getMultiSortMetaIndex"), - isMultiSorted: /* @__PURE__ */ __name(function isMultiSorted() { - return this.columnProp("sortable") && this.getMultiSortMetaIndex() > -1; - }, "isMultiSorted"), - isColumnSorted: /* @__PURE__ */ __name(function isColumnSorted() { - return this.sortMode === "single" ? this.sortField && (this.sortField === this.columnProp("field") || this.sortField === this.columnProp("sortField")) : this.isMultiSorted(); - }, "isColumnSorted") - }, - computed: { - containerClass: /* @__PURE__ */ __name(function containerClass5() { - return [this.columnProp("headerClass"), this.columnProp("class"), this.cx("headerCell")]; - }, "containerClass"), - containerStyle: /* @__PURE__ */ __name(function containerStyle3() { - var headerStyle = this.columnProp("headerStyle"); - var columnStyle = this.columnProp("style"); - return this.columnProp("frozen") ? [columnStyle, headerStyle, this.styleObject] : [columnStyle, headerStyle]; - }, "containerStyle"), - sortState: /* @__PURE__ */ __name(function sortState() { - var sorted2 = false; - var sortOrder3 = null; - if (this.sortMode === "single") { - sorted2 = this.sortField && (this.sortField === this.columnProp("field") || this.sortField === this.columnProp("sortField")); - sortOrder3 = sorted2 ? this.sortOrder : 0; - } else if (this.sortMode === "multiple") { - var metaIndex = this.getMultiSortMetaIndex(); - if (metaIndex > -1) { - sorted2 = true; - sortOrder3 = this.multiSortMeta[metaIndex].order; - } - } - return { - sorted: sorted2, - sortOrder: sortOrder3 - }; - }, "sortState"), - sortableColumnIcon: /* @__PURE__ */ __name(function sortableColumnIcon() { - var _this$sortState = this.sortState, sorted2 = _this$sortState.sorted, sortOrder3 = _this$sortState.sortOrder; - if (!sorted2) return script$1V; - else if (sorted2 && sortOrder3 > 0) return script$1W; - else if (sorted2 && sortOrder3 < 0) return script$1X; - return null; - }, "sortableColumnIcon"), - ariaSort: /* @__PURE__ */ __name(function ariaSort() { - if (this.columnProp("sortable")) { - var _this$sortState2 = this.sortState, sorted2 = _this$sortState2.sorted, sortOrder3 = _this$sortState2.sortOrder; - if (sorted2 && sortOrder3 < 0) return "descending"; - else if (sorted2 && sortOrder3 > 0) return "ascending"; - else return "none"; - } else { - return null; - } - }, "ariaSort") - }, - components: { - Badge: script$1y, - SortAltIcon: script$1V, - SortAmountUpAltIcon: script$1W, - SortAmountDownIcon: script$1X - } -}; -function _typeof$4(o) { - "@babel/helpers - typeof"; - return _typeof$4 = "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$4(o); -} -__name(_typeof$4, "_typeof$4"); -function ownKeys$4(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$4, "ownKeys$4"); -function _objectSpread$4(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$4(Object(t2), true).forEach(function(r2) { - _defineProperty$4(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$4(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$4, "_objectSpread$4"); -function _defineProperty$4(e, r, t2) { - return (r = _toPropertyKey$4(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$4, "_defineProperty$4"); -function _toPropertyKey$4(t2) { - var i = _toPrimitive$4(t2, "string"); - return "symbol" == _typeof$4(i) ? i : i + ""; -} -__name(_toPropertyKey$4, "_toPropertyKey$4"); -function _toPrimitive$4(t2, r) { - if ("object" != _typeof$4(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$4(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$4, "_toPrimitive$4"); -var _hoisted_1$3$1 = ["tabindex", "aria-sort", "data-p-sortable-column", "data-p-resizable-column", "data-p-sorted", "data-p-frozen-column"]; -function render$3(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Badge = resolveComponent("Badge"); - return openBlock(), createElementBlock("th", mergeProps({ - "class": $options.containerClass, - style: [$options.containerStyle], - onClick: _cache[1] || (_cache[1] = function() { - return $options.onClick && $options.onClick.apply($options, arguments); - }), - onKeydown: _cache[2] || (_cache[2] = function() { - return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); - }), - tabindex: $options.columnProp("sortable") ? "0" : null, - "aria-sort": $options.ariaSort, - role: "columnheader" - }, _objectSpread$4(_objectSpread$4({}, $options.getColumnPT("root")), $options.getColumnPT("headerCell")), { - "data-p-sortable-column": $options.columnProp("sortable"), - "data-p-resizable-column": $props.resizableColumns, - "data-p-sorted": $options.isColumnSorted(), - "data-p-frozen-column": $options.columnProp("frozen") - }), [$props.resizableColumns && !$options.columnProp("frozen") ? (openBlock(), createElementBlock("span", mergeProps({ - key: 0, - "class": _ctx.cx("columnResizer"), - onMousedown: _cache[0] || (_cache[0] = function() { - return $options.onResizeStart && $options.onResizeStart.apply($options, arguments); - }) - }, $options.getColumnPT("columnResizer")), null, 16)) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("columnHeaderContent") - }, $options.getColumnPT("columnHeaderContent")), [$props.column.children && $props.column.children.header ? (openBlock(), createBlock(resolveDynamicComponent($props.column.children.header), { - key: 0, - column: $props.column - }, null, 8, ["column"])) : createCommentVNode("", true), $options.columnProp("header") ? (openBlock(), createElementBlock("span", mergeProps({ - key: 1, - "class": _ctx.cx("columnTitle") - }, $options.getColumnPT("columnTitle")), toDisplayString($options.columnProp("header")), 17)) : createCommentVNode("", true), $options.columnProp("sortable") ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ - key: 2 - }, $options.getColumnPT("sort"))), [(openBlock(), createBlock(resolveDynamicComponent($props.column.children && $props.column.children.sorticon || $options.sortableColumnIcon), mergeProps({ - sorted: $options.sortState.sorted, - sortOrder: $options.sortState.sortOrder, - "class": _ctx.cx("sortIcon") - }, $options.getColumnPT("sortIcon")), null, 16, ["sorted", "sortOrder", "class"]))], 16)) : createCommentVNode("", true), $options.isMultiSorted() ? (openBlock(), createBlock(_component_Badge, mergeProps({ - key: 3, - "class": _ctx.cx("pcSortBadge") - }, $options.getColumnPT("pcSortBadge"), { - value: $options.getMultiSortMetaIndex() + 1, - size: "small" - }), null, 16, ["class", "value"])) : createCommentVNode("", true)], 16)], 16, _hoisted_1$3$1); -} -__name(render$3, "render$3"); -script$3.render = render$3; -var script$2 = { - name: "BodyCell", - hostName: "TreeTable", - "extends": script$1f, - emits: ["node-toggle", "checkbox-toggle"], - props: { - node: { - type: Object, - "default": null - }, - column: { - type: Object, - "default": null - }, - level: { - type: Number, - "default": 0 - }, - indentation: { - type: Number, - "default": 1 - }, - leaf: { - type: Boolean, - "default": false - }, - expanded: { - type: Boolean, - "default": false - }, - selectionMode: { - type: String, - "default": null - }, - checked: { - type: Boolean, - "default": false - }, - partialChecked: { - type: Boolean, - "default": false - }, - templates: { - type: Object, - "default": null - }, - index: { - type: Number, - "default": null - }, - loadingMode: { - type: String, - "default": "mask" - } - }, - data: /* @__PURE__ */ __name(function data38() { - return { - styleObject: {} - }; - }, "data"), - mounted: /* @__PURE__ */ __name(function mounted43() { - if (this.columnProp("frozen")) { - this.updateStickyPosition(); - } - }, "mounted"), - updated: /* @__PURE__ */ __name(function updated11() { - if (this.columnProp("frozen")) { - this.updateStickyPosition(); - } - }, "updated"), - methods: { - toggle: /* @__PURE__ */ __name(function toggle4() { - this.$emit("node-toggle", this.node); - }, "toggle"), - columnProp: /* @__PURE__ */ __name(function columnProp3(prop) { - return getVNodeProp(this.column, prop); - }, "columnProp"), - getColumnPT: /* @__PURE__ */ __name(function getColumnPT3(key) { - var _this$$parentInstance; - var columnMetaData = { - props: this.column.props, - parent: { - instance: this, - props: this.$props, - state: this.$data - }, - context: { - index: this.index, - selectable: this.$parentInstance.rowHover || this.$parentInstance.rowSelectionMode, - selected: this.$parent.selected, - frozen: this.columnProp("frozen"), - scrollable: this.$parentInstance.scrollable, - showGridlines: this.$parentInstance.showGridlines, - size: (_this$$parentInstance = this.$parentInstance) === null || _this$$parentInstance === void 0 ? void 0 : _this$$parentInstance.size - } - }; - return mergeProps(this.ptm("column.".concat(key), { - column: columnMetaData - }), this.ptm("column.".concat(key), columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData)); - }, "getColumnPT"), - getColumnProp: /* @__PURE__ */ __name(function getColumnProp3() { - return this.column.props && this.column.props.pt ? this.column.props.pt : void 0; - }, "getColumnProp"), - getColumnCheckboxPT: /* @__PURE__ */ __name(function getColumnCheckboxPT(key) { - var columnMetaData = { - props: this.column.props, - parent: { - instance: this, - props: this.$props, - state: this.$data - }, - context: { - checked: this.checked, - partialChecked: this.partialChecked - } - }; - return mergeProps(this.ptm("column.".concat(key), { - column: columnMetaData - }), this.ptm("column.".concat(key), columnMetaData), this.ptmo(this.getColumnProp(), key, columnMetaData)); - }, "getColumnCheckboxPT"), - updateStickyPosition: /* @__PURE__ */ __name(function updateStickyPosition3() { - if (this.columnProp("frozen")) { - var align = this.columnProp("alignFrozen"); - if (align === "right") { - var pos = 0; - var next = getNextElementSibling(this.$el, '[data-p-frozen-column="true"]'); - if (next) { - pos = getOuterWidth(next) + parseFloat(next.style.right || 0); - } - this.styleObject.insetInlineEnd = pos + "px"; - } else { - var _pos = 0; - var prev = getPreviousElementSibling(this.$el, '[data-p-frozen-column="true"]'); - if (prev) { - _pos = getOuterWidth(prev) + parseFloat(prev.style.left || 0); - } - this.styleObject.insetInlineStart = _pos + "px"; - } - } - }, "updateStickyPosition"), - resolveFieldData: /* @__PURE__ */ __name(function resolveFieldData$1(rowData, field) { - return resolveFieldData(rowData, field); - }, "resolveFieldData$1"), - toggleCheckbox: /* @__PURE__ */ __name(function toggleCheckbox() { - this.$emit("checkbox-toggle"); - }, "toggleCheckbox") - }, - computed: { - containerClass: /* @__PURE__ */ __name(function containerClass6() { - return [this.columnProp("bodyClass"), this.columnProp("class"), this.cx("bodyCell")]; - }, "containerClass"), - containerStyle: /* @__PURE__ */ __name(function containerStyle4() { - var bodyStyle = this.columnProp("bodyStyle"); - var columnStyle = this.columnProp("style"); - return this.columnProp("frozen") ? [columnStyle, bodyStyle, this.styleObject] : [columnStyle, bodyStyle]; - }, "containerStyle"), - togglerStyle: /* @__PURE__ */ __name(function togglerStyle() { - return { - marginLeft: this.level * this.indentation + "rem", - visibility: this.leaf ? "hidden" : "visible" - }; - }, "togglerStyle"), - checkboxSelectionMode: /* @__PURE__ */ __name(function checkboxSelectionMode() { - return this.selectionMode === "checkbox"; - }, "checkboxSelectionMode") - }, - components: { - Checkbox: script$1I, - ChevronRightIcon: script$1i, - ChevronDownIcon: script$1h, - CheckIcon: script$1C, - MinusIcon: script$1x, - SpinnerIcon: script$1p - }, - directives: { - ripple: Ripple - } -}; -function _typeof$3(o) { - "@babel/helpers - typeof"; - return _typeof$3 = "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$3(o); -} -__name(_typeof$3, "_typeof$3"); -function ownKeys$3(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$3, "ownKeys$3"); -function _objectSpread$3(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$3(Object(t2), true).forEach(function(r2) { - _defineProperty$3(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$3(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$3, "_objectSpread$3"); -function _defineProperty$3(e, r, t2) { - return (r = _toPropertyKey$3(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$3, "_defineProperty$3"); -function _toPropertyKey$3(t2) { - var i = _toPrimitive$3(t2, "string"); - return "symbol" == _typeof$3(i) ? i : i + ""; -} -__name(_toPropertyKey$3, "_toPropertyKey$3"); -function _toPrimitive$3(t2, r) { - if ("object" != _typeof$3(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$3(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$3, "_toPrimitive$3"); -var _hoisted_1$2$1 = ["data-p-frozen-column"]; -function render$2(_ctx, _cache, $props, $setup, $data, $options) { - var _component_SpinnerIcon = resolveComponent("SpinnerIcon"); - var _component_Checkbox = resolveComponent("Checkbox"); - var _directive_ripple = resolveDirective("ripple"); - return openBlock(), createElementBlock("td", mergeProps({ - style: $options.containerStyle, - "class": $options.containerClass, - role: "cell" - }, _objectSpread$3(_objectSpread$3({}, $options.getColumnPT("root")), $options.getColumnPT("bodyCell")), { - "data-p-frozen-column": $options.columnProp("frozen") - }), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("bodyCellContent") - }, $options.getColumnPT("bodyCellContent")), [$options.columnProp("expander") ? withDirectives((openBlock(), createElementBlock("button", mergeProps({ - key: 0, - type: "button", - "class": _ctx.cx("nodeToggleButton"), - onClick: _cache[0] || (_cache[0] = function() { - return $options.toggle && $options.toggle.apply($options, arguments); - }), - style: $options.togglerStyle, - tabindex: "-1" - }, $options.getColumnPT("nodeToggleButton"), { - "data-pc-group-section": "rowactionbutton" - }), [$props.node.loading && $props.loadingMode === "icon" ? (openBlock(), createElementBlock(Fragment, { - key: 0 - }, [$props.templates["nodetoggleicon"] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates["nodetoggleicon"]), { - key: 0 - })) : createCommentVNode("", true), $props.templates["nodetogglericon"] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates["nodetogglericon"]), { - key: 1 - })) : (openBlock(), createBlock(_component_SpinnerIcon, mergeProps({ - key: 2, - spin: "" - }, _ctx.ptm("nodetoggleicon")), null, 16))], 64)) : (openBlock(), createElementBlock(Fragment, { - key: 1 - }, [$props.column.children && $props.column.children.rowtoggleicon ? (openBlock(), createBlock(resolveDynamicComponent($props.column.children.rowtoggleicon), { - key: 0, - node: $props.node, - expanded: $props.expanded, - "class": normalizeClass(_ctx.cx("nodeToggleIcon")) - }, null, 8, ["node", "expanded", "class"])) : createCommentVNode("", true), $props.column.children && $props.column.children.rowtogglericon ? (openBlock(), createBlock(resolveDynamicComponent($props.column.children.rowtogglericon), { - key: 1, - node: $props.node, - expanded: $props.expanded, - "class": normalizeClass(_ctx.cx("nodeToggleIcon")) - }, null, 8, ["node", "expanded", "class"])) : $props.expanded ? (openBlock(), createBlock(resolveDynamicComponent($props.node.expandedIcon ? "span" : "ChevronDownIcon"), mergeProps({ - key: 2, - "class": _ctx.cx("nodeToggleIcon") - }, $options.getColumnPT("nodeToggleIcon")), null, 16, ["class"])) : (openBlock(), createBlock(resolveDynamicComponent($props.node.collapsedIcon ? "span" : "ChevronRightIcon"), mergeProps({ - key: 3, - "class": _ctx.cx("nodeToggleIcon") - }, $options.getColumnPT("nodeToggleIcon")), null, 16, ["class"]))], 64))], 16)), [[_directive_ripple]]) : createCommentVNode("", true), $options.checkboxSelectionMode && $options.columnProp("expander") ? (openBlock(), createBlock(_component_Checkbox, { - key: 1, - modelValue: $props.checked, - binary: true, - "class": normalizeClass(_ctx.cx("pcNodeCheckbox")), - disabled: $props.node.selectable === false, - onChange: $options.toggleCheckbox, - tabindex: -1, - indeterminate: $props.partialChecked, - unstyled: _ctx.unstyled, - pt: $options.getColumnCheckboxPT("pcNodeCheckbox"), - "data-p-partialchecked": $props.partialChecked - }, { - icon: withCtx(function(slotProps) { - return [$props.templates["checkboxicon"] ? (openBlock(), createBlock(resolveDynamicComponent($props.templates["checkboxicon"]), { - key: 0, - checked: slotProps.checked, - partialChecked: $props.partialChecked, - "class": normalizeClass(slotProps["class"]) - }, null, 8, ["checked", "partialChecked", "class"])) : createCommentVNode("", true)]; - }), - _: 1 - }, 8, ["modelValue", "class", "disabled", "onChange", "indeterminate", "unstyled", "pt", "data-p-partialchecked"])) : createCommentVNode("", true), $props.column.children && $props.column.children.body ? (openBlock(), createBlock(resolveDynamicComponent($props.column.children.body), { - key: 2, - node: $props.node, - column: $props.column - }, null, 8, ["node", "column"])) : (openBlock(), createElementBlock(Fragment, { - key: 3 - }, [createTextVNode(toDisplayString($options.resolveFieldData($props.node.data, $options.columnProp("field"))), 1)], 64))], 16)], 16, _hoisted_1$2$1); -} -__name(render$2, "render$2"); -script$2.render = render$2; -function _typeof$2(o) { - "@babel/helpers - typeof"; - return _typeof$2 = "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$2(o); -} -__name(_typeof$2, "_typeof$2"); -function _createForOfIteratorHelper$1(r, e) { - var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; - if (!t2) { - if (Array.isArray(r) || (t2 = _unsupportedIterableToArray$1(r)) || e) { - t2 && (r = t2); - var _n = 0, F = /* @__PURE__ */ __name(function F2() { - }, "F"); - return { s: F, n: /* @__PURE__ */ __name(function n() { - return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; - }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { - throw r2; - }, "e"), 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 = true, u = false; - return { s: /* @__PURE__ */ __name(function s() { - t2 = t2.call(r); - }, "s"), n: /* @__PURE__ */ __name(function n() { - var r2 = t2.next(); - return a = r2.done, r2; - }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { - u = true, o = r2; - }, "e"), f: /* @__PURE__ */ __name(function f() { - try { - a || null == t2["return"] || t2["return"](); - } finally { - if (u) throw o; - } - }, "f") }; -} -__name(_createForOfIteratorHelper$1, "_createForOfIteratorHelper$1"); -function ownKeys$2(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$2, "ownKeys$2"); -function _objectSpread$2(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$2(Object(t2), true).forEach(function(r2) { - _defineProperty$2(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$2(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$2, "_objectSpread$2"); -function _defineProperty$2(e, r, t2) { - return (r = _toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$2, "_defineProperty$2"); -function _toPropertyKey$2(t2) { - var i = _toPrimitive$2(t2, "string"); - return "symbol" == _typeof$2(i) ? i : i + ""; -} -__name(_toPropertyKey$2, "_toPropertyKey$2"); -function _toPrimitive$2(t2, r) { - if ("object" != _typeof$2(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$2(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$2, "_toPrimitive$2"); -function _toConsumableArray$1(r) { - return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread$1(); -} -__name(_toConsumableArray$1, "_toConsumableArray$1"); -function _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."); -} -__name(_nonIterableSpread$1, "_nonIterableSpread$1"); -function _unsupportedIterableToArray$1(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray$1(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$1(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray$1, "_unsupportedIterableToArray$1"); -function _iterableToArray$1(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray$1, "_iterableToArray$1"); -function _arrayWithoutHoles$1(r) { - if (Array.isArray(r)) return _arrayLikeToArray$1(r); -} -__name(_arrayWithoutHoles$1, "_arrayWithoutHoles$1"); -function _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; -} -__name(_arrayLikeToArray$1, "_arrayLikeToArray$1"); -var script$1 = { - name: "TreeTableRow", - hostName: "TreeTable", - "extends": script$1f, - emits: ["node-click", "node-toggle", "checkbox-change", "nodeClick", "nodeToggle", "checkboxChange", "row-rightclick", "rowRightclick"], - props: { - node: { - type: null, - "default": null - }, - dataKey: { - type: [String, Function], - "default": "key" - }, - parentNode: { - type: null, - "default": null - }, - columns: { - type: null, - "default": null - }, - expandedKeys: { - type: null, - "default": null - }, - selectionKeys: { - type: null, - "default": null - }, - selectionMode: { - type: String, - "default": null - }, - level: { - type: Number, - "default": 0 - }, - indentation: { - type: Number, - "default": 1 - }, - tabindex: { - type: Number, - "default": -1 - }, - ariaSetSize: { - type: Number, - "default": null - }, - ariaPosInset: { - type: Number, - "default": null - }, - loadingMode: { - type: String, - "default": "mask" - }, - templates: { - type: Object, - "default": null - }, - contextMenu: { - type: Boolean, - "default": false - }, - contextMenuSelection: { - type: Object, - "default": null - } - }, - nodeTouched: false, - methods: { - columnProp: /* @__PURE__ */ __name(function columnProp4(col, prop) { - return getVNodeProp(col, prop); - }, "columnProp"), - toggle: /* @__PURE__ */ __name(function toggle5() { - this.$emit("node-toggle", this.node); - }, "toggle"), - onClick: /* @__PURE__ */ __name(function onClick10(event2) { - if (isClickable(event2.target) || getAttribute(event2.target, "data-pc-section") === "nodetogglebutton" || getAttribute(event2.target, "data-pc-section") === "nodetoggleicon" || event2.target.tagName === "path") { - return; - } - this.setTabIndexForSelectionMode(event2, this.nodeTouched); - this.$emit("node-click", { - originalEvent: event2, - nodeTouched: this.nodeTouched, - node: this.node - }); - this.nodeTouched = false; - }, "onClick"), - onRowRightClick: /* @__PURE__ */ __name(function onRowRightClick(event2) { - this.$emit("row-rightclick", { - originalEvent: event2, - node: this.node - }); - }, "onRowRightClick"), - onTouchEnd: /* @__PURE__ */ __name(function onTouchEnd2() { - this.nodeTouched = true; - }, "onTouchEnd"), - nodeKey: /* @__PURE__ */ __name(function nodeKey(node2) { - return resolveFieldData(node2, this.dataKey); - }, "nodeKey"), - onKeyDown: /* @__PURE__ */ __name(function onKeyDown14(event2, item8) { - switch (event2.code) { - case "ArrowDown": - this.onArrowDownKey(event2); - break; - case "ArrowUp": - this.onArrowUpKey(event2); - break; - case "ArrowLeft": - this.onArrowLeftKey(event2); - break; - case "ArrowRight": - this.onArrowRightKey(event2); - break; - case "Home": - this.onHomeKey(event2); - break; - case "End": - this.onEndKey(event2); - break; - case "Enter": - case "NumpadEnter": - case "Space": - if (!isClickable(event2.target)) { - this.onEnterKey(event2, item8); - } - break; - case "Tab": - this.onTabKey(event2); - break; - } - }, "onKeyDown"), - onArrowDownKey: /* @__PURE__ */ __name(function onArrowDownKey9(event2) { - var nextElementSibling = event2.currentTarget.nextElementSibling; - nextElementSibling && this.focusRowChange(event2.currentTarget, nextElementSibling); - event2.preventDefault(); - }, "onArrowDownKey"), - onArrowUpKey: /* @__PURE__ */ __name(function onArrowUpKey8(event2) { - var previousElementSibling = event2.currentTarget.previousElementSibling; - previousElementSibling && this.focusRowChange(event2.currentTarget, previousElementSibling); - event2.preventDefault(); - }, "onArrowUpKey"), - onArrowRightKey: /* @__PURE__ */ __name(function onArrowRightKey4(event2) { - var _this = this; - var ishiddenIcon = findSingle(event2.currentTarget, "button").style.visibility === "hidden"; - var togglerElement = findSingle(this.$refs.node, '[data-pc-section="nodetogglebutton"]'); - if (ishiddenIcon) return; - !this.expanded && togglerElement.click(); - this.$nextTick(function() { - _this.onArrowDownKey(event2); - }); - event2.preventDefault(); - }, "onArrowRightKey"), - onArrowLeftKey: /* @__PURE__ */ __name(function onArrowLeftKey5(event2) { - if (this.level === 0 && !this.expanded) { - return; - } - var currentTarget = event2.currentTarget; - var ishiddenIcon = findSingle(currentTarget, "button").style.visibility === "hidden"; - var togglerElement = findSingle(currentTarget, '[data-pc-section="nodetogglebutton"]'); - if (this.expanded && !ishiddenIcon) { - togglerElement.click(); - return; - } - var target = this.findBeforeClickableNode(currentTarget); - target && this.focusRowChange(currentTarget, target); - }, "onArrowLeftKey"), - onHomeKey: /* @__PURE__ */ __name(function onHomeKey9(event2) { - var findFirstElement = findSingle(event2.currentTarget.parentElement, 'tr[aria-level="'.concat(this.level + 1, '"]')); - findFirstElement && focus(findFirstElement); - event2.preventDefault(); - }, "onHomeKey"), - onEndKey: /* @__PURE__ */ __name(function onEndKey9(event2) { - var nodes = find(event2.currentTarget.parentElement, 'tr[aria-level="'.concat(this.level + 1, '"]')); - var findFirstElement = nodes[nodes.length - 1]; - focus(findFirstElement); - event2.preventDefault(); - }, "onEndKey"), - onEnterKey: /* @__PURE__ */ __name(function onEnterKey9(event2) { - event2.preventDefault(); - this.setTabIndexForSelectionMode(event2, this.nodeTouched); - if (this.selectionMode === "checkbox") { - this.toggleCheckbox(); - return; - } - this.$emit("node-click", { - originalEvent: event2, - nodeTouched: this.nodeTouched, - node: this.node - }); - this.nodeTouched = false; - }, "onEnterKey"), - onTabKey: /* @__PURE__ */ __name(function onTabKey6() { - var rows3 = _toConsumableArray$1(find(this.$refs.node.parentElement, "tr")); - var hasSelectedRow = rows3.some(function(row2) { - return getAttribute(row2, "data-p-selected") || row2.getAttribute("aria-checked") === "true"; - }); - rows3.forEach(function(row2) { - row2.tabIndex = -1; - }); - if (hasSelectedRow) { - var selectedNodes2 = rows3.filter(function(node2) { - return getAttribute(node2, "data-p-selected") || node2.getAttribute("aria-checked") === "true"; - }); - selectedNodes2[0].tabIndex = 0; - return; - } - rows3[0].tabIndex = 0; - }, "onTabKey"), - focusRowChange: /* @__PURE__ */ __name(function focusRowChange(firstFocusableRow, currentFocusedRow) { - firstFocusableRow.tabIndex = "-1"; - currentFocusedRow.tabIndex = "0"; - focus(currentFocusedRow); - }, "focusRowChange"), - findBeforeClickableNode: /* @__PURE__ */ __name(function findBeforeClickableNode(node2) { - var prevNode = node2.previousElementSibling; - if (prevNode) { - var prevNodeButton = prevNode.querySelector("button"); - if (prevNodeButton && prevNodeButton.style.visibility !== "hidden") { - return prevNode; - } - return this.findBeforeClickableNode(prevNode); - } - return null; - }, "findBeforeClickableNode"), - toggleCheckbox: /* @__PURE__ */ __name(function toggleCheckbox2() { - var _selectionKeys = this.selectionKeys ? _objectSpread$2({}, this.selectionKeys) : {}; - var _check = !this.checked; - this.propagateDown(this.node, _check, _selectionKeys); - this.$emit("checkbox-change", { - node: this.node, - check: _check, - selectionKeys: _selectionKeys - }); - }, "toggleCheckbox"), - propagateDown: /* @__PURE__ */ __name(function propagateDown(node2, check, selectionKeys) { - if (check) selectionKeys[this.nodeKey(node2)] = { - checked: true, - partialChecked: false - }; - else delete selectionKeys[this.nodeKey(node2)]; - if (node2.children && node2.children.length) { - var _iterator = _createForOfIteratorHelper$1(node2.children), _step; - try { - for (_iterator.s(); !(_step = _iterator.n()).done; ) { - var child = _step.value; - this.propagateDown(child, check, selectionKeys); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - } - }, "propagateDown"), - propagateUp: /* @__PURE__ */ __name(function propagateUp(event2) { - var check = event2.check; - var _selectionKeys = _objectSpread$2({}, event2.selectionKeys); - var checkedChildCount = 0; - var childPartialSelected = false; - var _iterator2 = _createForOfIteratorHelper$1(this.node.children), _step2; - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { - var child = _step2.value; - if (_selectionKeys[this.nodeKey(child)] && _selectionKeys[this.nodeKey(child)].checked) checkedChildCount++; - else if (_selectionKeys[this.nodeKey(child)] && _selectionKeys[this.nodeKey(child)].partialChecked) childPartialSelected = true; - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - if (check && checkedChildCount === this.node.children.length) { - _selectionKeys[this.nodeKey(this.node)] = { - checked: true, - partialChecked: false - }; - } else { - if (!check) { - delete _selectionKeys[this.nodeKey(this.node)]; - } - if (childPartialSelected || checkedChildCount > 0 && checkedChildCount !== this.node.children.length) _selectionKeys[this.nodeKey(this.node)] = { - checked: false, - partialChecked: true - }; - else _selectionKeys[this.nodeKey(this.node)] = { - checked: false, - partialChecked: false - }; - } - this.$emit("checkbox-change", { - node: event2.node, - check: event2.check, - selectionKeys: _selectionKeys - }); - }, "propagateUp"), - onCheckboxChange: /* @__PURE__ */ __name(function onCheckboxChange(event2) { - var check = event2.check; - var _selectionKeys = _objectSpread$2({}, event2.selectionKeys); - var checkedChildCount = 0; - var childPartialSelected = false; - var _iterator3 = _createForOfIteratorHelper$1(this.node.children), _step3; - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { - var child = _step3.value; - if (_selectionKeys[this.nodeKey(child)] && _selectionKeys[this.nodeKey(child)].checked) checkedChildCount++; - else if (_selectionKeys[this.nodeKey(child)] && _selectionKeys[this.nodeKey(child)].partialChecked) childPartialSelected = true; - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - if (check && checkedChildCount === this.node.children.length) { - _selectionKeys[this.nodeKey(this.node)] = { - checked: true, - partialChecked: false - }; - } else { - if (!check) { - delete _selectionKeys[this.nodeKey(this.node)]; - } - if (childPartialSelected || checkedChildCount > 0 && checkedChildCount !== this.node.children.length) _selectionKeys[this.nodeKey(this.node)] = { - checked: false, - partialChecked: true - }; - else _selectionKeys[this.nodeKey(this.node)] = { - checked: false, - partialChecked: false - }; - } - this.$emit("checkbox-change", { - node: event2.node, - check: event2.check, - selectionKeys: _selectionKeys - }); - }, "onCheckboxChange"), - setTabIndexForSelectionMode: /* @__PURE__ */ __name(function setTabIndexForSelectionMode(event2, nodeTouched) { - if (this.selectionMode !== null) { - var elements = _toConsumableArray$1(find(this.$refs.node.parentElement, "tr")); - event2.currentTarget.tabIndex = nodeTouched === false ? -1 : 0; - if (elements.every(function(element) { - return element.tabIndex === -1; - })) { - elements[0].tabIndex = 0; - } - } - }, "setTabIndexForSelectionMode") - }, - computed: { - containerClass: /* @__PURE__ */ __name(function containerClass7() { - return [this.node.styleClass, this.cx("row")]; - }, "containerClass"), - expanded: /* @__PURE__ */ __name(function expanded2() { - return this.expandedKeys && this.expandedKeys[this.nodeKey(this.node)] === true; - }, "expanded"), - leaf: /* @__PURE__ */ __name(function leaf2() { - return this.node.leaf === false ? false : !(this.node.children && this.node.children.length); - }, "leaf"), - selected: /* @__PURE__ */ __name(function selected2() { - return this.selectionMode && this.selectionKeys ? this.selectionKeys[this.nodeKey(this.node)] === true : false; - }, "selected"), - isSelectedWithContextMenu: /* @__PURE__ */ __name(function isSelectedWithContextMenu() { - if (this.node && this.contextMenuSelection) { - return equals(this.node, this.contextMenuSelection, this.dataKey); - } - return false; - }, "isSelectedWithContextMenu"), - checked: /* @__PURE__ */ __name(function checked() { - return this.selectionKeys ? this.selectionKeys[this.nodeKey(this.node)] && this.selectionKeys[this.nodeKey(this.node)].checked : false; - }, "checked"), - partialChecked: /* @__PURE__ */ __name(function partialChecked() { - return this.selectionKeys ? this.selectionKeys[this.nodeKey(this.node)] && this.selectionKeys[this.nodeKey(this.node)].partialChecked : false; - }, "partialChecked"), - getAriaSelected: /* @__PURE__ */ __name(function getAriaSelected() { - return this.selectionMode === "single" || this.selectionMode === "multiple" ? this.selected : null; - }, "getAriaSelected"), - ptmOptions: /* @__PURE__ */ __name(function ptmOptions2() { - return { - context: { - selectable: this.$parentInstance.rowHover || this.$parentInstance.rowSelectionMode, - selected: this.selected, - scrollable: this.$parentInstance.scrollable - } - }; - }, "ptmOptions") - }, - components: { - TTBodyCell: script$2 - } -}; -var _hoisted_1$1$1 = ["tabindex", "aria-expanded", "aria-level", "aria-setsize", "aria-posinset", "aria-selected", "aria-checked", "data-p-selected", "data-p-selected-contextmenu"]; -function render$1(_ctx, _cache, $props, $setup, $data, $options) { - var _component_TTBodyCell = resolveComponent("TTBodyCell"); - var _component_TreeTableRow = resolveComponent("TreeTableRow", true); - return openBlock(), createElementBlock(Fragment, null, [createBaseVNode("tr", mergeProps({ - ref: "node", - "class": $options.containerClass, - style: $props.node.style, - tabindex: $props.tabindex, - role: "row", - "aria-expanded": $props.node.children && $props.node.children.length ? $options.expanded : void 0, - "aria-level": $props.level + 1, - "aria-setsize": $props.ariaSetSize, - "aria-posinset": $props.ariaPosInset, - "aria-selected": $options.getAriaSelected, - "aria-checked": $options.checked || void 0, - onClick: _cache[1] || (_cache[1] = function() { - return $options.onClick && $options.onClick.apply($options, arguments); - }), - onKeydown: _cache[2] || (_cache[2] = function() { - return $options.onKeyDown && $options.onKeyDown.apply($options, arguments); - }), - onTouchend: _cache[3] || (_cache[3] = function() { - return $options.onTouchEnd && $options.onTouchEnd.apply($options, arguments); - }), - onContextmenu: _cache[4] || (_cache[4] = function() { - return $options.onRowRightClick && $options.onRowRightClick.apply($options, arguments); - }) - }, _ctx.ptm("row", $options.ptmOptions), { - "data-p-selected": $options.selected, - "data-p-selected-contextmenu": $props.contextMenuSelection && $options.isSelectedWithContextMenu - }), [(openBlock(true), createElementBlock(Fragment, null, renderList($props.columns, function(col, i) { - return openBlock(), createElementBlock(Fragment, { - key: $options.columnProp(col, "columnKey") || $options.columnProp(col, "field") || i - }, [!$options.columnProp(col, "hidden") ? (openBlock(), createBlock(_component_TTBodyCell, { - key: 0, - column: col, - node: $props.node, - level: $props.level, - leaf: $options.leaf, - indentation: $props.indentation, - expanded: $options.expanded, - selectionMode: $props.selectionMode, - checked: $options.checked, - partialChecked: $options.partialChecked, - templates: $props.templates, - onNodeToggle: _cache[0] || (_cache[0] = function($event) { - return _ctx.$emit("node-toggle", $event); - }), - onCheckboxToggle: $options.toggleCheckbox, - index: i, - loadingMode: $props.loadingMode, - unstyled: _ctx.unstyled, - pt: _ctx.pt - }, null, 8, ["column", "node", "level", "leaf", "indentation", "expanded", "selectionMode", "checked", "partialChecked", "templates", "onCheckboxToggle", "index", "loadingMode", "unstyled", "pt"])) : createCommentVNode("", true)], 64); - }), 128))], 16, _hoisted_1$1$1), $options.expanded && $props.node.children && $props.node.children.length ? (openBlock(true), createElementBlock(Fragment, { - key: 0 - }, renderList($props.node.children, function(childNode) { - return openBlock(), createBlock(_component_TreeTableRow, { - key: $options.nodeKey(childNode), - dataKey: $props.dataKey, - columns: $props.columns, - node: childNode, - parentNode: $props.node, - level: $props.level + 1, - expandedKeys: $props.expandedKeys, - selectionMode: $props.selectionMode, - selectionKeys: $props.selectionKeys, - contextMenu: $props.contextMenu, - contextMenuSelection: $props.contextMenuSelection, - indentation: $props.indentation, - ariaPosInset: $props.node.children.indexOf(childNode) + 1, - ariaSetSize: $props.node.children.length, - templates: $props.templates, - onNodeToggle: _cache[5] || (_cache[5] = function($event) { - return _ctx.$emit("node-toggle", $event); - }), - onNodeClick: _cache[6] || (_cache[6] = function($event) { - return _ctx.$emit("node-click", $event); - }), - onRowRightclick: _cache[7] || (_cache[7] = function($event) { - return _ctx.$emit("row-rightclick", $event); - }), - onCheckboxChange: $options.onCheckboxChange, - unstyled: _ctx.unstyled, - pt: _ctx.pt - }, null, 8, ["dataKey", "columns", "node", "parentNode", "level", "expandedKeys", "selectionMode", "selectionKeys", "contextMenu", "contextMenuSelection", "indentation", "ariaPosInset", "ariaSetSize", "templates", "onCheckboxChange", "unstyled", "pt"]); - }), 128)) : createCommentVNode("", true)], 64); -} -__name(render$1, "render$1"); -script$1.render = render$1; -function _typeof$1(o) { - "@babel/helpers - typeof"; - return _typeof$1 = "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$1(o); -} -__name(_typeof$1, "_typeof$1"); -function _createForOfIteratorHelper(r, e) { - var t2 = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; - if (!t2) { - if (Array.isArray(r) || (t2 = _unsupportedIterableToArray(r)) || e) { - t2 && (r = t2); - var _n = 0, F = /* @__PURE__ */ __name(function F2() { - }, "F"); - return { s: F, n: /* @__PURE__ */ __name(function n() { - return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; - }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { - throw r2; - }, "e"), 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 = true, u = false; - return { s: /* @__PURE__ */ __name(function s() { - t2 = t2.call(r); - }, "s"), n: /* @__PURE__ */ __name(function n() { - var r2 = t2.next(); - return a = r2.done, r2; - }, "n"), e: /* @__PURE__ */ __name(function e2(r2) { - u = true, o = r2; - }, "e"), f: /* @__PURE__ */ __name(function f() { - try { - a || null == t2["return"] || t2["return"](); - } finally { - if (u) throw o; - } - }, "f") }; -} -__name(_createForOfIteratorHelper, "_createForOfIteratorHelper"); -function ownKeys$1(e, r) { - var t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys$1, "ownKeys$1"); -function _objectSpread$1(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$1(Object(t2), true).forEach(function(r2) { - _defineProperty$1(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys$1(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread$1, "_objectSpread$1"); -function _defineProperty$1(e, r, t2) { - return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty$1, "_defineProperty$1"); -function _toPropertyKey$1(t2) { - var i = _toPrimitive$1(t2, "string"); - return "symbol" == _typeof$1(i) ? i : i + ""; -} -__name(_toPropertyKey$1, "_toPropertyKey$1"); -function _toPrimitive$1(t2, r) { - if ("object" != _typeof$1(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof$1(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive$1, "_toPrimitive$1"); -function _toConsumableArray(r) { - return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); -} -__name(_toConsumableArray, "_toConsumableArray"); -function _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."); -} -__name(_nonIterableSpread, "_nonIterableSpread"); -function _unsupportedIterableToArray(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray(r, a); - var t2 = {}.toString.call(r).slice(8, -1); - return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray(r, a) : void 0; - } -} -__name(_unsupportedIterableToArray, "_unsupportedIterableToArray"); -function _iterableToArray(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray, "_iterableToArray"); -function _arrayWithoutHoles(r) { - if (Array.isArray(r)) return _arrayLikeToArray(r); -} -__name(_arrayWithoutHoles, "_arrayWithoutHoles"); -function _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; -} -__name(_arrayLikeToArray, "_arrayLikeToArray"); -var script = { - name: "TreeTable", - "extends": script$5, - inheritAttrs: false, - emits: ["node-expand", "node-collapse", "update:expandedKeys", "update:selectionKeys", "node-select", "node-unselect", "update:first", "update:rows", "page", "update:sortField", "update:sortOrder", "update:multiSortMeta", "sort", "filter", "column-resize-end", "update:contextMenuSelection", "row-contextmenu"], - provide: /* @__PURE__ */ __name(function provide51() { - return { - $columns: this.d_columns - }; - }, "provide"), - data: /* @__PURE__ */ __name(function data39() { - return { - d_expandedKeys: this.expandedKeys || {}, - d_first: this.first, - d_rows: this.rows, - d_sortField: this.sortField, - d_sortOrder: this.sortOrder, - d_multiSortMeta: this.multiSortMeta ? _toConsumableArray(this.multiSortMeta) : [], - hasASelectedNode: false, - d_columns: new _default({ - type: "Column" - }) - }; - }, "data"), - documentColumnResizeListener: null, - documentColumnResizeEndListener: null, - lastResizeHelperX: null, - resizeColumnElement: null, - watch: { - expandedKeys: /* @__PURE__ */ __name(function expandedKeys3(newValue) { - this.d_expandedKeys = newValue; - }, "expandedKeys"), - first: /* @__PURE__ */ __name(function first2(newValue) { - this.d_first = newValue; - }, "first"), - rows: /* @__PURE__ */ __name(function rows2(newValue) { - this.d_rows = newValue; - }, "rows"), - sortField: /* @__PURE__ */ __name(function sortField2(newValue) { - this.d_sortField = newValue; - }, "sortField"), - sortOrder: /* @__PURE__ */ __name(function sortOrder2(newValue) { - this.d_sortOrder = newValue; - }, "sortOrder"), - multiSortMeta: /* @__PURE__ */ __name(function multiSortMeta(newValue) { - this.d_multiSortMeta = newValue; - }, "multiSortMeta") - }, - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount17() { - this.destroyStyleElement(); - this.d_columns.clear(); - }, "beforeUnmount"), - methods: { - columnProp: /* @__PURE__ */ __name(function columnProp5(col, prop) { - return getVNodeProp(col, prop); - }, "columnProp"), - ptHeaderCellOptions: /* @__PURE__ */ __name(function ptHeaderCellOptions(column2) { - return { - context: { - frozen: this.columnProp(column2, "frozen") - } - }; - }, "ptHeaderCellOptions"), - onNodeToggle: /* @__PURE__ */ __name(function onNodeToggle3(node2) { - var key = this.nodeKey(node2); - if (this.d_expandedKeys[key]) { - delete this.d_expandedKeys[key]; - this.$emit("node-collapse", node2); - } else { - this.d_expandedKeys[key] = true; - this.$emit("node-expand", node2); - } - this.d_expandedKeys = _objectSpread$1({}, this.d_expandedKeys); - this.$emit("update:expandedKeys", this.d_expandedKeys); - }, "onNodeToggle"), - onNodeClick: /* @__PURE__ */ __name(function onNodeClick3(event2) { - if (this.rowSelectionMode && event2.node.selectable !== false) { - var metaSelection = event2.nodeTouched ? false : this.metaKeySelection; - var _selectionKeys = metaSelection ? this.handleSelectionWithMetaKey(event2) : this.handleSelectionWithoutMetaKey(event2); - this.$emit("update:selectionKeys", _selectionKeys); - } - }, "onNodeClick"), - nodeKey: /* @__PURE__ */ __name(function nodeKey2(node2) { - return resolveFieldData(node2, this.dataKey); - }, "nodeKey"), - handleSelectionWithMetaKey: /* @__PURE__ */ __name(function handleSelectionWithMetaKey(event2) { - var originalEvent = event2.originalEvent; - var node2 = event2.node; - var nodeKey3 = this.nodeKey(node2); - var metaKey = originalEvent.metaKey || originalEvent.ctrlKey; - var selected3 = this.isNodeSelected(node2); - var _selectionKeys; - if (selected3 && metaKey) { - if (this.isSingleSelectionMode()) { - _selectionKeys = {}; - } else { - _selectionKeys = _objectSpread$1({}, this.selectionKeys); - delete _selectionKeys[nodeKey3]; - } - this.$emit("node-unselect", node2); - } else { - if (this.isSingleSelectionMode()) { - _selectionKeys = {}; - } else if (this.isMultipleSelectionMode()) { - _selectionKeys = !metaKey ? {} : this.selectionKeys ? _objectSpread$1({}, this.selectionKeys) : {}; - } - _selectionKeys[nodeKey3] = true; - this.$emit("node-select", node2); - } - return _selectionKeys; - }, "handleSelectionWithMetaKey"), - handleSelectionWithoutMetaKey: /* @__PURE__ */ __name(function handleSelectionWithoutMetaKey(event2) { - var node2 = event2.node; - var nodeKey3 = this.nodeKey(node2); - var selected3 = this.isNodeSelected(node2); - var _selectionKeys; - if (this.isSingleSelectionMode()) { - if (selected3) { - _selectionKeys = {}; - this.$emit("node-unselect", node2); - } else { - _selectionKeys = {}; - _selectionKeys[nodeKey3] = true; - this.$emit("node-select", node2); - } - } else { - if (selected3) { - _selectionKeys = _objectSpread$1({}, this.selectionKeys); - delete _selectionKeys[nodeKey3]; - this.$emit("node-unselect", node2); - } else { - _selectionKeys = this.selectionKeys ? _objectSpread$1({}, this.selectionKeys) : {}; - _selectionKeys[nodeKey3] = true; - this.$emit("node-select", node2); - } - } - return _selectionKeys; - }, "handleSelectionWithoutMetaKey"), - onCheckboxChange: /* @__PURE__ */ __name(function onCheckboxChange2(event2) { - this.$emit("update:selectionKeys", event2.selectionKeys); - if (event2.check) this.$emit("node-select", event2.node); - else this.$emit("node-unselect", event2.node); - }, "onCheckboxChange"), - onRowRightClick: /* @__PURE__ */ __name(function onRowRightClick2(event2) { - if (this.contextMenu) { - clearSelection(); - event2.originalEvent.target.focus(); - } - this.$emit("update:contextMenuSelection", event2.node); - this.$emit("row-contextmenu", event2); - }, "onRowRightClick"), - isSingleSelectionMode: /* @__PURE__ */ __name(function isSingleSelectionMode() { - return this.selectionMode === "single"; - }, "isSingleSelectionMode"), - isMultipleSelectionMode: /* @__PURE__ */ __name(function isMultipleSelectionMode() { - return this.selectionMode === "multiple"; - }, "isMultipleSelectionMode"), - onPage: /* @__PURE__ */ __name(function onPage2(event2) { - this.d_first = event2.first; - this.d_rows = event2.rows; - var pageEvent = this.createLazyLoadEvent(event2); - pageEvent.pageCount = event2.pageCount; - pageEvent.page = event2.page; - this.d_expandedKeys = {}; - this.$emit("update:expandedKeys", this.d_expandedKeys); - this.$emit("update:first", this.d_first); - this.$emit("update:rows", this.d_rows); - this.$emit("page", pageEvent); - }, "onPage"), - resetPage: /* @__PURE__ */ __name(function resetPage2() { - this.d_first = 0; - this.$emit("update:first", this.d_first); - }, "resetPage"), - getFilterColumnHeaderClass: /* @__PURE__ */ __name(function getFilterColumnHeaderClass(column2) { - return [this.cx("headerCell", { - column: column2 - }), this.columnProp(column2, "filterHeaderClass")]; - }, "getFilterColumnHeaderClass"), - onColumnHeaderClick: /* @__PURE__ */ __name(function onColumnHeaderClick(e) { - var event2 = e.originalEvent; - var column2 = e.column; - if (this.columnProp(column2, "sortable")) { - var targetNode = event2.target; - var columnField = this.columnProp(column2, "sortField") || this.columnProp(column2, "field"); - if (getAttribute(targetNode, "data-p-sortable-column") === true || getAttribute(targetNode, "data-pc-section") === "columntitle" || getAttribute(targetNode, "data-pc-section") === "columnheadercontent" || getAttribute(targetNode, "data-pc-section") === "sorticon" || getAttribute(targetNode.parentElement, "data-pc-section") === "sorticon" || getAttribute(targetNode.parentElement.parentElement, "data-pc-section") === "sorticon" || targetNode.closest('[data-p-sortable-column="true"]')) { - clearSelection(); - if (this.sortMode === "single") { - if (this.d_sortField === columnField) { - if (this.removableSort && this.d_sortOrder * -1 === this.defaultSortOrder) { - this.d_sortOrder = null; - this.d_sortField = null; - } else { - this.d_sortOrder = this.d_sortOrder * -1; - } - } else { - this.d_sortOrder = this.defaultSortOrder; - this.d_sortField = columnField; - } - this.$emit("update:sortField", this.d_sortField); - this.$emit("update:sortOrder", this.d_sortOrder); - this.resetPage(); - } else if (this.sortMode === "multiple") { - var metaKey = event2.metaKey || event2.ctrlKey; - if (!metaKey) { - this.d_multiSortMeta = this.d_multiSortMeta.filter(function(meta) { - return meta.field === columnField; - }); - } - this.addMultiSortField(columnField); - this.$emit("update:multiSortMeta", this.d_multiSortMeta); - } - this.$emit("sort", this.createLazyLoadEvent(event2)); - } - } - }, "onColumnHeaderClick"), - addMultiSortField: /* @__PURE__ */ __name(function addMultiSortField(field) { - var index = this.d_multiSortMeta.findIndex(function(meta) { - return meta.field === field; - }); - if (index >= 0) { - if (this.removableSort && this.d_multiSortMeta[index].order * -1 === this.defaultSortOrder) this.d_multiSortMeta.splice(index, 1); - else this.d_multiSortMeta[index] = { - field, - order: this.d_multiSortMeta[index].order * -1 - }; - } else { - this.d_multiSortMeta.push({ - field, - order: this.defaultSortOrder - }); - } - this.d_multiSortMeta = _toConsumableArray(this.d_multiSortMeta); - }, "addMultiSortField"), - sortSingle: /* @__PURE__ */ __name(function sortSingle(nodes) { - return this.sortNodesSingle(nodes); - }, "sortSingle"), - sortNodesSingle: /* @__PURE__ */ __name(function sortNodesSingle(nodes) { - var _this = this; - var _nodes = _toConsumableArray(nodes); - var comparer = localeComparator(); - _nodes.sort(function(node1, node2) { - var value1 = resolveFieldData(node1.data, _this.d_sortField); - var value2 = resolveFieldData(node2.data, _this.d_sortField); - return sort(value1, value2, _this.d_sortOrder, comparer); - }); - return _nodes; - }, "sortNodesSingle"), - sortMultiple: /* @__PURE__ */ __name(function sortMultiple(nodes) { - return this.sortNodesMultiple(nodes); - }, "sortMultiple"), - sortNodesMultiple: /* @__PURE__ */ __name(function sortNodesMultiple(nodes) { - var _this2 = this; - var _nodes = _toConsumableArray(nodes); - _nodes.sort(function(node1, node2) { - return _this2.multisortField(node1, node2, 0); - }); - return _nodes; - }, "sortNodesMultiple"), - multisortField: /* @__PURE__ */ __name(function multisortField(node1, node2, index) { - var value1 = resolveFieldData(node1.data, this.d_multiSortMeta[index].field); - var value2 = resolveFieldData(node2.data, this.d_multiSortMeta[index].field); - var comparer = localeComparator(); - if (value1 === value2) { - return this.d_multiSortMeta.length - 1 > index ? this.multisortField(node1, node2, index + 1) : 0; - } - return sort(value1, value2, this.d_multiSortMeta[index].order, comparer); - }, "multisortField"), - filter: /* @__PURE__ */ __name(function filter(value2) { - var filteredNodes = []; - var strict = this.filterMode === "strict"; - var _iterator = _createForOfIteratorHelper(value2), _step; - try { - for (_iterator.s(); !(_step = _iterator.n()).done; ) { - var node2 = _step.value; - var copyNode = _objectSpread$1({}, node2); - var localMatch = true; - var globalMatch = false; - for (var j = 0; j < this.columns.length; j++) { - var col = this.columns[j]; - var filterField = this.columnProp(col, "filterField") || this.columnProp(col, "field"); - if (Object.prototype.hasOwnProperty.call(this.filters, filterField)) { - var filterMatchMode = this.columnProp(col, "filterMatchMode") || "startsWith"; - var filterValue = this.filters[filterField]; - var filterConstraint = FilterService.filters[filterMatchMode]; - var paramsWithoutNode = { - filterField, - filterValue, - filterConstraint, - strict - }; - if (strict && !(this.findFilteredNodes(copyNode, paramsWithoutNode) || this.isFilterMatched(copyNode, paramsWithoutNode)) || !strict && !(this.isFilterMatched(copyNode, paramsWithoutNode) || this.findFilteredNodes(copyNode, paramsWithoutNode))) { - localMatch = false; - } - if (!localMatch) { - break; - } - } - if (this.hasGlobalFilter() && !globalMatch) { - var copyNodeForGlobal = _objectSpread$1({}, copyNode); - var _filterValue = this.filters["global"]; - var _filterConstraint = FilterService.filters["contains"]; - var globalFilterParamsWithoutNode = { - filterField, - filterValue: _filterValue, - filterConstraint: _filterConstraint, - strict - }; - if (strict && (this.findFilteredNodes(copyNodeForGlobal, globalFilterParamsWithoutNode) || this.isFilterMatched(copyNodeForGlobal, globalFilterParamsWithoutNode)) || !strict && (this.isFilterMatched(copyNodeForGlobal, globalFilterParamsWithoutNode) || this.findFilteredNodes(copyNodeForGlobal, globalFilterParamsWithoutNode))) { - globalMatch = true; - copyNode = copyNodeForGlobal; - } - } - } - var matches = localMatch; - if (this.hasGlobalFilter()) { - matches = localMatch && globalMatch; - } - if (matches) { - filteredNodes.push(copyNode); - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - var filterEvent = this.createLazyLoadEvent(event); - filterEvent.filteredValue = filteredNodes; - this.$emit("filter", filterEvent); - return filteredNodes; - }, "filter"), - findFilteredNodes: /* @__PURE__ */ __name(function findFilteredNodes(node2, paramsWithoutNode) { - if (node2) { - var matched = false; - if (node2.children) { - var childNodes = _toConsumableArray(node2.children); - node2.children = []; - var _iterator2 = _createForOfIteratorHelper(childNodes), _step2; - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { - var childNode = _step2.value; - var copyChildNode = _objectSpread$1({}, childNode); - if (this.isFilterMatched(copyChildNode, paramsWithoutNode)) { - matched = true; - node2.children.push(copyChildNode); - } - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - } - if (matched) { - return true; - } - } - }, "findFilteredNodes"), - isFilterMatched: /* @__PURE__ */ __name(function isFilterMatched(node2, _ref) { - var filterField = _ref.filterField, filterValue = _ref.filterValue, filterConstraint = _ref.filterConstraint, strict = _ref.strict; - var matched = false; - var dataFieldValue = resolveFieldData(node2.data, filterField); - if (filterConstraint(dataFieldValue, filterValue, this.filterLocale)) { - matched = true; - } - if (!matched || strict && !this.isNodeLeaf(node2)) { - matched = this.findFilteredNodes(node2, { - filterField, - filterValue, - filterConstraint, - strict - }) || matched; - } - return matched; - }, "isFilterMatched"), - isNodeSelected: /* @__PURE__ */ __name(function isNodeSelected(node2) { - return this.selectionMode && this.selectionKeys ? this.selectionKeys[this.nodeKey(node2)] === true : false; - }, "isNodeSelected"), - isNodeLeaf: /* @__PURE__ */ __name(function isNodeLeaf(node2) { - return node2.leaf === false ? false : !(node2.children && node2.children.length); - }, "isNodeLeaf"), - createLazyLoadEvent: /* @__PURE__ */ __name(function createLazyLoadEvent(event2) { - var _this3 = this; - var filterMatchModes; - if (this.hasFilters()) { - filterMatchModes = {}; - this.columns.forEach(function(col) { - if (_this3.columnProp(col, "field")) { - filterMatchModes[col.props.field] = _this3.columnProp(col, "filterMatchMode"); - } - }); - } - return { - originalEvent: event2, - first: this.d_first, - rows: this.d_rows, - sortField: this.d_sortField, - sortOrder: this.d_sortOrder, - multiSortMeta: this.d_multiSortMeta, - filters: this.filters, - filterMatchModes - }; - }, "createLazyLoadEvent"), - onColumnResizeStart: /* @__PURE__ */ __name(function onColumnResizeStart(event2) { - var containerLeft = getOffset(this.$el).left; - this.resizeColumnElement = event2.target.parentElement; - this.columnResizing = true; - this.lastResizeHelperX = event2.pageX - containerLeft + this.$el.scrollLeft; - this.bindColumnResizeEvents(); - }, "onColumnResizeStart"), - onColumnResize: /* @__PURE__ */ __name(function onColumnResize(event2) { - var containerLeft = getOffset(this.$el).left; - this.$el.setAttribute("data-p-unselectable-text", "true"); - !this.isUnstyled && addStyle(this.$el, { - "user-select": "none" - }); - this.$refs.resizeHelper.style.height = this.$el.offsetHeight + "px"; - this.$refs.resizeHelper.style.top = "0px"; - this.$refs.resizeHelper.style.left = event2.pageX - containerLeft + this.$el.scrollLeft + "px"; - this.$refs.resizeHelper.style.display = "block"; - }, "onColumnResize"), - onColumnResizeEnd: /* @__PURE__ */ __name(function onColumnResizeEnd() { - var delta = isRTL(this.$el) ? this.lastResizeHelperX - this.$refs.resizeHelper.offsetLeft : this.$refs.resizeHelper.offsetLeft - this.lastResizeHelperX; - var columnWidth = this.resizeColumnElement.offsetWidth; - var newColumnWidth = columnWidth + delta; - var minWidth = this.resizeColumnElement.style.minWidth || 15; - if (columnWidth + delta > parseInt(minWidth, 10)) { - if (this.columnResizeMode === "fit") { - var nextColumn = this.resizeColumnElement.nextElementSibling; - var nextColumnWidth = nextColumn.offsetWidth - delta; - if (newColumnWidth > 15 && nextColumnWidth > 15) { - this.resizeTableCells(newColumnWidth, nextColumnWidth); - } - } else if (this.columnResizeMode === "expand") { - var tableWidth = this.$refs.table.offsetWidth + delta + "px"; - var updateTableWidth = /* @__PURE__ */ __name(function updateTableWidth2(el) { - !!el && (el.style.width = el.style.minWidth = tableWidth); - }, "updateTableWidth"); - this.resizeTableCells(newColumnWidth); - updateTableWidth(this.$refs.table); - } - this.$emit("column-resize-end", { - element: this.resizeColumnElement, - delta - }); - } - this.$refs.resizeHelper.style.display = "none"; - this.resizeColumn = null; - this.$el.removeAttribute("data-p-unselectable-text"); - !this.isUnstyled && (this.$el.style["user-select"] = ""); - this.unbindColumnResizeEvents(); - }, "onColumnResizeEnd"), - resizeTableCells: /* @__PURE__ */ __name(function resizeTableCells(newColumnWidth, nextColumnWidth) { - var colIndex = getIndex(this.resizeColumnElement); - var widths = []; - var headers = find(this.$refs.table, 'thead[data-pc-section="thead"] > tr > th'); - headers.forEach(function(header2) { - return widths.push(getOuterWidth(header2)); - }); - this.destroyStyleElement(); - this.createStyleElement(); - var innerHTML = ""; - var selector = '[data-pc-name="treetable"]['.concat(this.$attrSelector, '] > [data-pc-section="tablecontainer"] > table[data-pc-section="table"]'); - widths.forEach(function(width, index) { - var colWidth = index === colIndex ? newColumnWidth : nextColumnWidth && index === colIndex + 1 ? nextColumnWidth : width; - var style = "width: ".concat(colWidth, "px !important; max-width: ").concat(colWidth, "px !important"); - innerHTML += "\n ".concat(selector, ' > thead[data-pc-section="thead"] > tr > th:nth-child(').concat(index + 1, "),\n ").concat(selector, ' > tbody[data-pc-section="tbody"] > tr > td:nth-child(').concat(index + 1, "),\n ").concat(selector, ' > tfoot[data-pc-section="tfoot"] > tr > td:nth-child(').concat(index + 1, ") {\n ").concat(style, "\n }\n "); - }); - this.styleElement.innerHTML = innerHTML; - }, "resizeTableCells"), - bindColumnResizeEvents: /* @__PURE__ */ __name(function bindColumnResizeEvents() { - var _this4 = this; - if (!this.documentColumnResizeListener) { - this.documentColumnResizeListener = document.addEventListener("mousemove", function(event2) { - if (_this4.columnResizing) { - _this4.onColumnResize(event2); - } - }); - } - if (!this.documentColumnResizeEndListener) { - this.documentColumnResizeEndListener = document.addEventListener("mouseup", function() { - if (_this4.columnResizing) { - _this4.columnResizing = false; - _this4.onColumnResizeEnd(); - } - }); - } - }, "bindColumnResizeEvents"), - unbindColumnResizeEvents: /* @__PURE__ */ __name(function unbindColumnResizeEvents() { - if (this.documentColumnResizeListener) { - document.removeEventListener("document", this.documentColumnResizeListener); - this.documentColumnResizeListener = null; - } - if (this.documentColumnResizeEndListener) { - document.removeEventListener("document", this.documentColumnResizeEndListener); - this.documentColumnResizeEndListener = null; - } - }, "unbindColumnResizeEvents"), - onColumnKeyDown: /* @__PURE__ */ __name(function onColumnKeyDown(event2, col) { - if ((event2.code === "Enter" || event2.code === "NumpadEnter") && event2.currentTarget.nodeName === "TH" && getAttribute(event2.currentTarget, "data-p-sortable-column")) { - this.onColumnHeaderClick(event2, col); - } - }, "onColumnKeyDown"), - hasColumnFilter: /* @__PURE__ */ __name(function hasColumnFilter() { - if (this.columns) { - var _iterator3 = _createForOfIteratorHelper(this.columns), _step3; - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { - var col = _step3.value; - if (col.children && col.children.filter) { - return true; - } - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - } - return false; - }, "hasColumnFilter"), - hasFilters: /* @__PURE__ */ __name(function hasFilters() { - return this.filters && Object.keys(this.filters).length > 0 && this.filters.constructor === Object; - }, "hasFilters"), - hasGlobalFilter: /* @__PURE__ */ __name(function hasGlobalFilter() { - return this.filters && Object.prototype.hasOwnProperty.call(this.filters, "global"); - }, "hasGlobalFilter"), - getItemLabel: /* @__PURE__ */ __name(function getItemLabel6(node2) { - return node2.data.name; - }, "getItemLabel"), - createStyleElement: /* @__PURE__ */ __name(function createStyleElement() { - var _this$$primevue; - this.styleElement = document.createElement("style"); - this.styleElement.type = "text/css"; - 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); - document.head.appendChild(this.styleElement); - }, "createStyleElement"), - destroyStyleElement: /* @__PURE__ */ __name(function destroyStyleElement() { - if (this.styleElement) { - document.head.removeChild(this.styleElement); - this.styleElement = null; - } - }, "destroyStyleElement"), - setTabindex: /* @__PURE__ */ __name(function setTabindex(node2, index) { - if (this.isNodeSelected(node2)) { - this.hasASelectedNode = true; - return 0; - } - if (this.selectionMode) { - if (!this.isNodeSelected(node2) && index === 0 && !this.hasASelectedNode) return 0; - } else if (!this.selectionMode && index === 0) { - return 0; - } - return -1; - }, "setTabindex") - }, - computed: { - columns: /* @__PURE__ */ __name(function columns() { - return this.d_columns.get(this); - }, "columns"), - processedData: /* @__PURE__ */ __name(function processedData() { - if (this.lazy) { - return this.value; - } else { - if (this.value && this.value.length) { - var data40 = this.value; - if (this.sorted) { - if (this.sortMode === "single") data40 = this.sortSingle(data40); - else if (this.sortMode === "multiple") data40 = this.sortMultiple(data40); - } - if (this.hasFilters()) { - data40 = this.filter(data40); - } - return data40; - } else { - return null; - } - } - }, "processedData"), - dataToRender: /* @__PURE__ */ __name(function dataToRender() { - var data40 = this.processedData; - if (this.paginator) { - var first3 = this.lazy ? 0 : this.d_first; - return data40.slice(first3, first3 + this.d_rows); - } else { - return data40; - } - }, "dataToRender"), - empty: /* @__PURE__ */ __name(function empty2() { - var data40 = this.processedData; - return !data40 || data40.length === 0; - }, "empty"), - sorted: /* @__PURE__ */ __name(function sorted() { - return this.d_sortField || this.d_multiSortMeta && this.d_multiSortMeta.length > 0; - }, "sorted"), - hasFooter: /* @__PURE__ */ __name(function hasFooter() { - var hasFooter2 = false; - var _iterator4 = _createForOfIteratorHelper(this.columns), _step4; - try { - for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) { - var col = _step4.value; - if (this.columnProp(col, "footer") || col.children && col.children.footer) { - hasFooter2 = true; - break; - } - } - } catch (err) { - _iterator4.e(err); - } finally { - _iterator4.f(); - } - return hasFooter2; - }, "hasFooter"), - paginatorTop: /* @__PURE__ */ __name(function paginatorTop2() { - return this.paginator && (this.paginatorPosition !== "bottom" || this.paginatorPosition === "both"); - }, "paginatorTop"), - paginatorBottom: /* @__PURE__ */ __name(function paginatorBottom2() { - return this.paginator && (this.paginatorPosition !== "top" || this.paginatorPosition === "both"); - }, "paginatorBottom"), - singleSelectionMode: /* @__PURE__ */ __name(function singleSelectionMode() { - return this.selectionMode && this.selectionMode === "single"; - }, "singleSelectionMode"), - multipleSelectionMode: /* @__PURE__ */ __name(function multipleSelectionMode() { - return this.selectionMode && this.selectionMode === "multiple"; - }, "multipleSelectionMode"), - rowSelectionMode: /* @__PURE__ */ __name(function rowSelectionMode() { - return this.singleSelectionMode || this.multipleSelectionMode; - }, "rowSelectionMode"), - totalRecordsLength: /* @__PURE__ */ __name(function totalRecordsLength() { - if (this.lazy) { - return this.totalRecords; - } else { - var data40 = this.processedData; - return data40 ? data40.length : 0; - } - }, "totalRecordsLength") - }, - components: { - TTRow: script$1, - TTPaginator: script$1t, - TTHeaderCell: script$3, - TTFooterCell: script$4, - SpinnerIcon: script$1p - } -}; -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 t2 = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - r && (o = o.filter(function(r2) { - return Object.getOwnPropertyDescriptor(e, r2).enumerable; - })), t2.push.apply(t2, o); - } - return t2; -} -__name(ownKeys, "ownKeys"); -function _objectSpread(e) { - for (var r = 1; r < arguments.length; r++) { - var t2 = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys(Object(t2), true).forEach(function(r2) { - _defineProperty(e, r2, t2[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : ownKeys(Object(t2)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t2, r2)); - }); - } - return e; -} -__name(_objectSpread, "_objectSpread"); -function _defineProperty(e, r, t2) { - return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t2, enumerable: true, configurable: true, writable: true }) : e[r] = t2, e; -} -__name(_defineProperty, "_defineProperty"); -function _toPropertyKey(t2) { - var i = _toPrimitive(t2, "string"); - return "symbol" == _typeof(i) ? i : i + ""; -} -__name(_toPropertyKey, "_toPropertyKey"); -function _toPrimitive(t2, r) { - if ("object" != _typeof(t2) || !t2) return t2; - var e = t2[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t2, r || "default"); - if ("object" != _typeof(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t2); -} -__name(_toPrimitive, "_toPrimitive"); -var _hoisted_1$5 = ["colspan"]; -function render3(_ctx, _cache, $props, $setup, $data, $options) { - var _component_TTPaginator = resolveComponent("TTPaginator"); - var _component_TTHeaderCell = resolveComponent("TTHeaderCell"); - var _component_TTRow = resolveComponent("TTRow"); - var _component_TTFooterCell = resolveComponent("TTFooterCell"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": _ctx.cx("root"), - "data-scrollselectors": ".p-treetable-scrollable-body" - }, _ctx.ptmi("root")), [renderSlot(_ctx.$slots, "default"), _ctx.loading && _ctx.loadingMode === "mask" ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("loading") - }, _ctx.ptm("loading")), [createBaseVNode("div", mergeProps({ - "class": _ctx.cx("mask") - }, _ctx.ptm("mask")), [renderSlot(_ctx.$slots, "loadingicon", { - "class": normalizeClass(_ctx.cx("loadingIcon")) - }, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon ? "span" : "SpinnerIcon"), mergeProps({ - spin: "", - "class": [_ctx.cx("loadingIcon"), _ctx.loadingIcon] - }, _ctx.ptm("loadingIcon")), null, 16, ["class"]))]; - })], 16)], 16)) : createCommentVNode("", true), _ctx.$slots.header ? (openBlock(), createElementBlock("div", mergeProps({ - key: 1, - "class": _ctx.cx("header") - }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header")], 16)) : createCommentVNode("", true), $options.paginatorTop ? (openBlock(), createBlock(_component_TTPaginator, { - key: 2, - rows: $data.d_rows, - first: $data.d_first, - totalRecords: $options.totalRecordsLength, - pageLinkSize: _ctx.pageLinkSize, - template: _ctx.paginatorTemplate, - rowsPerPageOptions: _ctx.rowsPerPageOptions, - currentPageReportTemplate: _ctx.currentPageReportTemplate, - "class": normalizeClass(_ctx.cx("pcPaginator", { - position: "top" - })), - onPage: _cache[0] || (_cache[0] = function($event) { - return $options.onPage($event); - }), - alwaysShow: _ctx.alwaysShowPaginator, - unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcPaginator") - }, createSlots({ - _: 2 - }, [_ctx.$slots.paginatorcontainer ? { - name: "container", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorcontainer", { - first: slotProps.first, - last: slotProps.last, - rows: slotProps.rows, - page: slotProps.page, - pageCount: slotProps.pageCount, - totalRecords: slotProps.totalRecords, - firstPageCallback: slotProps.firstPageCallback, - lastPageCallback: slotProps.lastPageCallback, - prevPageCallback: slotProps.prevPageCallback, - nextPageCallback: slotProps.nextPageCallback, - rowChangeCallback: slotProps.rowChangeCallback - })]; - }), - key: "0" - } : void 0, _ctx.$slots.paginatorstart ? { - name: "start", - fn: withCtx(function() { - return [renderSlot(_ctx.$slots, "paginatorstart")]; - }), - key: "1" - } : void 0, _ctx.$slots.paginatorend ? { - name: "end", - fn: withCtx(function() { - return [renderSlot(_ctx.$slots, "paginatorend")]; - }), - key: "2" - } : void 0, _ctx.$slots.paginatorfirstpagelinkicon ? { - name: "firstpagelinkicon", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorfirstpagelinkicon", { - "class": normalizeClass(slotProps["class"]) - })]; - }), - key: "3" - } : void 0, _ctx.$slots.paginatorprevpagelinkicon ? { - name: "prevpagelinkicon", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorprevpagelinkicon", { - "class": normalizeClass(slotProps["class"]) - })]; - }), - key: "4" - } : void 0, _ctx.$slots.paginatornextpagelinkicon ? { - name: "nextpagelinkicon", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatornextpagelinkicon", { - "class": normalizeClass(slotProps["class"]) - })]; - }), - key: "5" - } : void 0, _ctx.$slots.paginatorlastpagelinkicon ? { - name: "lastpagelinkicon", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorlastpagelinkicon", { - "class": normalizeClass(slotProps["class"]) - })]; - }), - key: "6" - } : void 0, _ctx.$slots.paginatorjumptopagedropdownicon ? { - name: "jumptopagedropdownicon", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorjumptopagedropdownicon", { - "class": normalizeClass(slotProps["class"]) - })]; - }), - key: "7" - } : void 0, _ctx.$slots.paginatorrowsperpagedropdownicon ? { - name: "rowsperpagedropdownicon", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorrowsperpagedropdownicon", { - "class": normalizeClass(slotProps["class"]) - })]; - }), - key: "8" - } : void 0]), 1032, ["rows", "first", "totalRecords", "pageLinkSize", "template", "rowsPerPageOptions", "currentPageReportTemplate", "class", "alwaysShow", "unstyled", "pt"])) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("tableContainer"), - style: [_ctx.sx("tableContainer"), { - maxHeight: _ctx.scrollHeight - }] - }, _ctx.ptm("tableContainer")), [createBaseVNode("table", mergeProps({ - ref: "table", - role: "table", - "class": [_ctx.cx("table"), _ctx.tableClass], - style: _ctx.tableStyle - }, _objectSpread(_objectSpread({}, _ctx.tableProps), _ctx.ptm("table"))), [createBaseVNode("thead", mergeProps({ - "class": _ctx.cx("thead"), - style: _ctx.sx("thead"), - role: "rowgroup" - }, _ctx.ptm("thead")), [createBaseVNode("tr", mergeProps({ - role: "row" - }, _ctx.ptm("headerRow")), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.columns, function(col, i) { - return openBlock(), createElementBlock(Fragment, { - key: $options.columnProp(col, "columnKey") || $options.columnProp(col, "field") || i - }, [!$options.columnProp(col, "hidden") ? (openBlock(), createBlock(_component_TTHeaderCell, { - key: 0, - column: col, - resizableColumns: _ctx.resizableColumns, - sortField: $data.d_sortField, - sortOrder: $data.d_sortOrder, - multiSortMeta: $data.d_multiSortMeta, - sortMode: _ctx.sortMode, - onColumnClick: _cache[1] || (_cache[1] = function($event) { - return $options.onColumnHeaderClick($event); - }), - onColumnResizestart: _cache[2] || (_cache[2] = function($event) { - return $options.onColumnResizeStart($event); - }), - index: i, - unstyled: _ctx.unstyled, - pt: _ctx.pt - }, null, 8, ["column", "resizableColumns", "sortField", "sortOrder", "multiSortMeta", "sortMode", "index", "unstyled", "pt"])) : createCommentVNode("", true)], 64); - }), 128))], 16), $options.hasColumnFilter() ? (openBlock(), createElementBlock("tr", normalizeProps(mergeProps({ - key: 0 - }, _ctx.ptm("headerRow"))), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.columns, function(col, i) { - return openBlock(), createElementBlock(Fragment, { - key: $options.columnProp(col, "columnKey") || $options.columnProp(col, "field") || i - }, [!$options.columnProp(col, "hidden") ? (openBlock(), createElementBlock("th", mergeProps({ - key: 0, - "class": $options.getFilterColumnHeaderClass(col), - style: [$options.columnProp(col, "style"), $options.columnProp(col, "filterHeaderStyle")], - ref_for: true - }, _ctx.ptm("headerCell", $options.ptHeaderCellOptions(col))), [col.children && col.children.filter ? (openBlock(), createBlock(resolveDynamicComponent(col.children.filter), { - key: 0, - column: col, - index: i - }, null, 8, ["column", "index"])) : createCommentVNode("", true)], 16)) : createCommentVNode("", true)], 64); - }), 128))], 16)) : createCommentVNode("", true)], 16), createBaseVNode("tbody", mergeProps({ - "class": _ctx.cx("tbody"), - role: "rowgroup" - }, _ctx.ptm("tbody")), [!$options.empty ? (openBlock(true), createElementBlock(Fragment, { - key: 0 - }, renderList($options.dataToRender, function(node2, index) { - return openBlock(), createBlock(_component_TTRow, { - key: $options.nodeKey(node2), - dataKey: _ctx.dataKey, - columns: $options.columns, - node: node2, - level: 0, - expandedKeys: $data.d_expandedKeys, - indentation: _ctx.indentation, - selectionMode: _ctx.selectionMode, - selectionKeys: _ctx.selectionKeys, - ariaSetSize: $options.dataToRender.length, - ariaPosInset: index + 1, - tabindex: $options.setTabindex(node2, index), - loadingMode: _ctx.loadingMode, - contextMenu: _ctx.contextMenu, - contextMenuSelection: _ctx.contextMenuSelection, - templates: _ctx.$slots, - onNodeToggle: $options.onNodeToggle, - onNodeClick: $options.onNodeClick, - onCheckboxChange: $options.onCheckboxChange, - onRowRightclick: _cache[3] || (_cache[3] = function($event) { - return $options.onRowRightClick($event); - }), - unstyled: _ctx.unstyled, - pt: _ctx.pt - }, null, 8, ["dataKey", "columns", "node", "expandedKeys", "indentation", "selectionMode", "selectionKeys", "ariaSetSize", "ariaPosInset", "tabindex", "loadingMode", "contextMenu", "contextMenuSelection", "templates", "onNodeToggle", "onNodeClick", "onCheckboxChange", "unstyled", "pt"]); - }), 128)) : (openBlock(), createElementBlock("tr", mergeProps({ - key: 1, - "class": _ctx.cx("emptyMessage") - }, _ctx.ptm("emptyMessage")), [createBaseVNode("td", mergeProps({ - colspan: $options.columns.length - }, _ctx.ptm("emptyMessageCell")), [renderSlot(_ctx.$slots, "empty")], 16, _hoisted_1$5)], 16))], 16), $options.hasFooter ? (openBlock(), createElementBlock("tfoot", mergeProps({ - key: 0, - "class": _ctx.cx("tfoot"), - style: _ctx.sx("tfoot"), - role: "rowgroup" - }, _ctx.ptm("tfoot")), [createBaseVNode("tr", mergeProps({ - role: "row" - }, _ctx.ptm("footerRow")), [(openBlock(true), createElementBlock(Fragment, null, renderList($options.columns, function(col, i) { - return openBlock(), createElementBlock(Fragment, { - key: $options.columnProp(col, "columnKey") || $options.columnProp(col, "field") || i - }, [!$options.columnProp(col, "hidden") ? (openBlock(), createBlock(_component_TTFooterCell, { - key: 0, - column: col, - index: i, - unstyled: _ctx.unstyled, - pt: _ctx.pt - }, null, 8, ["column", "index", "unstyled", "pt"])) : createCommentVNode("", true)], 64); - }), 128))], 16)], 16)) : createCommentVNode("", true)], 16)], 16), $options.paginatorBottom ? (openBlock(), createBlock(_component_TTPaginator, { - key: 3, - rows: $data.d_rows, - first: $data.d_first, - totalRecords: $options.totalRecordsLength, - pageLinkSize: _ctx.pageLinkSize, - template: _ctx.paginatorTemplate, - rowsPerPageOptions: _ctx.rowsPerPageOptions, - currentPageReportTemplate: _ctx.currentPageReportTemplate, - "class": normalizeClass(_ctx.cx("pcPaginator", { - position: "bottom" - })), - onPage: _cache[4] || (_cache[4] = function($event) { - return $options.onPage($event); - }), - alwaysShow: _ctx.alwaysShowPaginator, - unstyled: _ctx.unstyled, - pt: _ctx.ptm("pcPaginator") - }, createSlots({ - _: 2 - }, [_ctx.$slots.paginatorcontainer ? { - name: "container", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorcontainer", { - first: slotProps.first, - last: slotProps.last, - rows: slotProps.rows, - page: slotProps.page, - pageCount: slotProps.pageCount, - totalRecords: slotProps.totalRecords, - firstPageCallback: slotProps.firstPageCallback, - lastPageCallback: slotProps.lastPageCallback, - prevPageCallback: slotProps.prevPageCallback, - nextPageCallback: slotProps.nextPageCallback, - rowChangeCallback: slotProps.rowChangeCallback - })]; - }), - key: "0" - } : void 0, _ctx.$slots.paginatorstart ? { - name: "start", - fn: withCtx(function() { - return [renderSlot(_ctx.$slots, "paginatorstart")]; - }), - key: "1" - } : void 0, _ctx.$slots.paginatorend ? { - name: "end", - fn: withCtx(function() { - return [renderSlot(_ctx.$slots, "paginatorend")]; - }), - key: "2" - } : void 0, _ctx.$slots.paginatorfirstpagelinkicon ? { - name: "firstpagelinkicon", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorfirstpagelinkicon", { - "class": normalizeClass(slotProps["class"]) - })]; - }), - key: "3" - } : void 0, _ctx.$slots.paginatorprevpagelinkicon ? { - name: "prevpagelinkicon", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorprevpagelinkicon", { - "class": normalizeClass(slotProps["class"]) - })]; - }), - key: "4" - } : void 0, _ctx.$slots.paginatornextpagelinkicon ? { - name: "nextpagelinkicon", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatornextpagelinkicon", { - "class": normalizeClass(slotProps["class"]) - })]; - }), - key: "5" - } : void 0, _ctx.$slots.paginatorlastpagelinkicon ? { - name: "lastpagelinkicon", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorlastpagelinkicon", { - "class": normalizeClass(slotProps["class"]) - })]; - }), - key: "6" - } : void 0, _ctx.$slots.paginatorjumptopagedropdownicon ? { - name: "jumptopagedropdownicon", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorjumptopagedropdownicon", { - "class": normalizeClass(slotProps["class"]) - })]; - }), - key: "7" - } : void 0, _ctx.$slots.paginatorrowsperpagedropdownicon ? { - name: "rowsperpagedropdownicon", - fn: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "paginatorrowsperpagedropdownicon", { - "class": normalizeClass(slotProps["class"]) - })]; - }), - key: "8" - } : void 0]), 1032, ["rows", "first", "totalRecords", "pageLinkSize", "template", "rowsPerPageOptions", "currentPageReportTemplate", "class", "alwaysShow", "unstyled", "pt"])) : createCommentVNode("", true), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", mergeProps({ - key: 4, - "class": _ctx.cx("footer") - }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true), createBaseVNode("div", mergeProps({ - ref: "resizeHelper", - "class": _ctx.cx("columnResizeIndicator"), - style: { - "display": "none" - } - }, _ctx.ptm("columnResizeIndicator")), null, 16)], 16); -} -__name(render3, "render"); -script.render = render3; -const electron = electronAPI(); -const openUrl = /* @__PURE__ */ __name((url) => { - window.open(url, "_blank"); - return true; -}, "openUrl"); -const DESKTOP_MAINTENANCE_TASKS = [ - { - id: "basePath", - execute: /* @__PURE__ */ __name(async () => await electron.setBasePath(), "execute"), - name: "Base path", - shortDescription: "Change the application base path.", - errorDescription: "Unable to open the base path. Please select a new one.", - description: "The base path is the default location where ComfyUI stores data. It is the location fo the python environment, and may also contain models, custom nodes, and other extensions.", - isInstallationFix: true, - button: { - icon: PrimeIcons.QUESTION, - text: "Select" - } - }, - { - id: "git", - headerImg: "/assets/images/Git-Logo-White.svg", - execute: /* @__PURE__ */ __name(() => openUrl("https://git-scm.com/downloads/"), "execute"), - name: "Download git", - shortDescription: "Open the git download page.", - errorDescription: "Git is missing. Please download and install git, then restart ComfyUI Desktop.", - description: "Git is required to download and manage custom nodes and other extensions. This task opens the download page in your default browser, where you can download the latest version of git. Once you have installed git, please restart ComfyUI Desktop.", - button: { - icon: PrimeIcons.EXTERNAL_LINK, - text: "Download" - } - }, - { - id: "vcRedist", - execute: /* @__PURE__ */ __name(() => openUrl("https://aka.ms/vs/17/release/vc_redist.x64.exe"), "execute"), - name: "Download VC++ Redist", - shortDescription: "Download the latest VC++ Redistributable runtime.", - description: "The Visual C++ runtime libraries are required to run ComfyUI. You will need to download and install this file.", - button: { - icon: PrimeIcons.EXTERNAL_LINK, - text: "Download" - } - }, - { - id: "reinstall", - severity: "danger", - requireConfirm: true, - execute: /* @__PURE__ */ __name(async () => { - await electron.reinstall(); - return true; - }, "execute"), - name: "Reinstall ComfyUI", - shortDescription: "Deletes the desktop app config and load the welcome screen.", - description: "Delete the desktop app config, restart the app, and load the installation screen.", - confirmText: "Delete all saved config and reinstall?", - button: { - icon: PrimeIcons.EXCLAMATION_TRIANGLE, - text: "Reinstall" - } - }, - { - id: "pythonPackages", - requireConfirm: true, - execute: /* @__PURE__ */ __name(async () => { - try { - await electron.uv.installRequirements(); - return true; - } catch (error) { - return false; - } - }, "execute"), - name: "Install python packages", - shortDescription: "Installs the base python packages required to run ComfyUI.", - errorDescription: "Python packages that are required to run ComfyUI are not installed.", - description: "This will install the python packages required to run ComfyUI. This includes torch, torchvision, and other dependencies.", - usesTerminal: true, - isInstallationFix: true, - button: { - icon: PrimeIcons.DOWNLOAD, - text: "Install" - } - }, - { - id: "uv", - execute: /* @__PURE__ */ __name(() => openUrl("https://docs.astral.sh/uv/getting-started/installation/"), "execute"), - name: "uv executable", - shortDescription: "uv installs and maintains the python environment.", - description: "This will open the download page for Astral's uv tool. uv is used to install python and manage python packages.", - button: { - icon: "pi pi-asterisk", - text: "Download" - } - }, - { - id: "uvCache", - severity: "danger", - requireConfirm: true, - execute: /* @__PURE__ */ __name(async () => await electron.uv.clearCache(), "execute"), - name: "uv cache", - shortDescription: "Remove the Astral uv cache of python packages.", - description: "This will remove the uv cache directory and its contents. All downloaded python packages will need to be downloaded again.", - confirmText: "Delete uv cache of python packages?", - isInstallationFix: true, - button: { - icon: PrimeIcons.TRASH, - text: "Clear cache" - } - }, - { - id: "venvDirectory", - severity: "danger", - requireConfirm: true, - execute: /* @__PURE__ */ __name(async () => await electron.uv.resetVenv(), "execute"), - name: "Reset virtual environment", - shortDescription: "Remove and recreate the .venv directory. This removes all python packages.", - description: "The python environment is where ComfyUI installs python and python packages. It is used to run the ComfyUI server.", - confirmText: "Delete the .venv directory?", - usesTerminal: true, - isInstallationFix: true, - button: { - icon: PrimeIcons.FOLDER, - text: "Recreate" - } - } -]; -class MaintenanceTaskRunner { - static { - __name(this, "MaintenanceTaskRunner"); - } - constructor(task) { - this.task = task; - } - _state; - /** The current state of the task. Setter also controls {@link resolved} as a side-effect. */ - get state() { - return this._state; - } - /** Updates the task state and {@link resolved} status. */ - setState(value2) { - if (this._state === "error" && value2 === "OK") this.resolved = true; - if (value2 === "error") this.resolved &&= false; - this._state = value2; - } - /** `true` if the task has been resolved (was `error`, now `OK`). This is a side-effect of the {@link state} setter. */ - resolved; - /** Whether the task state is currently being refreshed. */ - refreshing; - /** Whether the task is currently running. */ - executing; - /** The error message that occurred when the task failed. */ - error; - update(update) { - const state = update[this.task.id]; - this.refreshing = state === void 0; - if (state) this.setState(state); - } - finaliseUpdate(update) { - this.refreshing = false; - this.setState(update[this.task.id] ?? "skipped"); - } - /** Wraps the execution of a maintenance task, updating state and rethrowing errors. */ - async execute(task) { - try { - this.executing = true; - const success = await task.execute(); - if (!success) return false; - this.error = void 0; - return true; - } catch (error) { - this.error = error?.message; - throw error; - } finally { - this.executing = false; - } - } -} -const useMaintenanceTaskStore = defineStore("maintenanceTask", () => { - const electron2 = electronAPI(); - const isRefreshing = ref(false); - const isRunningTerminalCommand = computed( - () => tasks.value.filter((task) => task.usesTerminal).some((task) => getRunner(task)?.executing) - ); - const isRunningInstallationFix = computed( - () => tasks.value.filter((task) => task.isInstallationFix).some((task) => getRunner(task)?.executing) - ); - const tasks = ref(DESKTOP_MAINTENANCE_TASKS); - const taskRunners = ref( - new Map( - DESKTOP_MAINTENANCE_TASKS.map((x) => [x.id, new MaintenanceTaskRunner(x)]) - ) - ); - const anyErrors = computed( - () => tasks.value.some((task) => getRunner(task).state === "error") - ); - const getRunner = /* @__PURE__ */ __name((task) => taskRunners.value.get(task.id), "getRunner"); - const processUpdate = /* @__PURE__ */ __name((validationUpdate) => { - const update = validationUpdate; - isRefreshing.value = true; - for (const task of tasks.value) { - getRunner(task).update(update); - } - if (!update.inProgress && isRefreshing.value) { - isRefreshing.value = false; - for (const task of tasks.value) { - getRunner(task).finaliseUpdate(update); - } - } - }, "processUpdate"); - const clearResolved = /* @__PURE__ */ __name(() => { - for (const task of tasks.value) { - getRunner(task).resolved &&= false; - } - }, "clearResolved"); - const refreshDesktopTasks = /* @__PURE__ */ __name(async () => { - isRefreshing.value = true; - console.log("Refreshing desktop tasks"); - await electron2.Validation.validateInstallation(processUpdate); - }, "refreshDesktopTasks"); - const execute = /* @__PURE__ */ __name(async (task) => { - return getRunner(task).execute(task); - }, "execute"); - return { - tasks, - isRefreshing, - isRunningTerminalCommand, - isRunningInstallationFix, - execute, - getRunner, - processUpdate, - clearResolved, - /** True if any tasks are in an error state. */ - anyErrors, - refreshDesktopTasks - }; -}); -function useMinLoadingDurationRef(value2, minDuration = 250) { - const current = ref(value2.value); - const { ready, start } = useTimeout(minDuration, { - controls: true, - immediate: false - }); - watch(value2, (newValue) => { - if (newValue && !current.value) start(); - current.value = newValue; - }); - return computed(() => current.value || !ready.value); -} -__name(useMinLoadingDurationRef, "useMinLoadingDurationRef"); -const _hoisted_1$3 = { - key: 0, - class: "pi pi-exclamation-triangle text-red-500 absolute m-2 top-0 -right-14 opacity-15", - style: { "font-size": "10rem" } -}; -const _hoisted_2$3 = ["src"]; -const _hoisted_3$3 = { class: "flex gap-4 mt-1" }; -const _hoisted_4$3 = { - key: 0, - class: "task-card-ok pi pi-check" -}; -const _sfc_main$4 = /* @__PURE__ */ defineComponent({ - __name: "TaskCard", - props: { - task: {} - }, - emits: ["execute"], - setup(__props) { - const taskStore = useMaintenanceTaskStore(); - const runner = computed(() => taskStore.getRunner(props.task)); - const props = __props; - const description = computed( - () => runner.value.state === "error" ? props.task.errorDescription ?? props.task.shortDescription : props.task.shortDescription - ); - const reactiveLoading = computed(() => runner.value.refreshing); - const reactiveExecuting = computed(() => runner.value.executing); - const isLoading = useMinLoadingDurationRef(reactiveLoading, 250); - const isExecuting = useMinLoadingDurationRef(reactiveExecuting, 250); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("div", { - class: normalizeClass(["task-div max-w-48 min-h-52 grid relative", { "opacity-75": unref(isLoading) }]) - }, [ - createVNode(unref(script$1Y), mergeProps({ - class: ["max-w-48 relative h-full overflow-hidden", { "opacity-65": runner.value.state !== "error" }] - }, (({ onClick: onClick11, ...rest }) => rest)(_ctx.$attrs)), { - header: withCtx(() => [ - runner.value.state === "error" ? (openBlock(), createElementBlock("i", _hoisted_1$3)) : createCommentVNode("", true), - _ctx.task.headerImg ? (openBlock(), createElementBlock("img", { - key: 1, - src: _ctx.task.headerImg, - class: "object-contain w-full h-full opacity-25 pt-4 px-4" - }, null, 8, _hoisted_2$3)) : createCommentVNode("", true) - ]), - title: withCtx(() => [ - createTextVNode(toDisplayString(_ctx.task.name), 1) - ]), - content: withCtx(() => [ - createTextVNode(toDisplayString(description.value), 1) - ]), - footer: withCtx(() => [ - createBaseVNode("div", _hoisted_3$3, [ - createVNode(unref(script$1d), { - icon: _ctx.task.button?.icon, - label: _ctx.task.button?.text, - class: "w-full", - raised: "", - "icon-pos": "right", - onClick: _cache[0] || (_cache[0] = (event2) => _ctx.$emit("execute", event2)), - loading: unref(isExecuting) - }, null, 8, ["icon", "label", "loading"]) - ]) - ]), - _: 1 - }, 16, ["class"]), - !unref(isLoading) && runner.value.state === "OK" ? (openBlock(), createElementBlock("i", _hoisted_4$3)) : createCommentVNode("", true) - ], 2); - }; - } -}); -const TaskCard = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-c3bd7658"]]); -const _sfc_main$3 = /* @__PURE__ */ defineComponent({ - __name: "TaskListStatusIcon", - props: { - state: {}, - loading: {} - }, - setup(__props) { - const tooltip = computed(() => { - if (props.state === "error") { - return t("g.error"); - } else if (props.state === "OK") { - return t("maintenance.OK"); - } else { - return t("maintenance.Skipped"); - } - }); - const cssClasses = computed(() => { - let classes2; - if (props.state === "error") { - classes2 = `${PrimeIcons.EXCLAMATION_TRIANGLE} text-red-500`; - } else if (props.state === "OK") { - classes2 = `${PrimeIcons.CHECK} text-green-500`; - } else { - classes2 = PrimeIcons.MINUS; - } - return `text-3xl pi ${classes2}`; - }); - const props = __props; - return (_ctx, _cache) => { - const _directive_tooltip = resolveDirective("tooltip"); - return !_ctx.state || _ctx.loading ? (openBlock(), createBlock(unref(script$1c), { - key: 0, - class: "h-8 w-8" - })) : withDirectives((openBlock(), createElementBlock("i", { - key: 1, - class: normalizeClass(cssClasses.value) - }, null, 2)), [ - [ - _directive_tooltip, - { value: tooltip.value, showDelay: 250 }, - void 0, - { top: true } - ] - ]); - }; - } -}); -const _hoisted_1$2 = { class: "text-center w-16" }; -const _hoisted_2$2 = { class: "inline-block" }; -const _hoisted_3$2 = { class: "whitespace-pre-line" }; -const _hoisted_4$2 = { class: "text-right px-4" }; -const _sfc_main$2 = /* @__PURE__ */ defineComponent({ - __name: "TaskListItem", - props: { - task: {} - }, - emits: ["execute"], - setup(__props) { - const taskStore = useMaintenanceTaskStore(); - const runner = computed(() => taskStore.getRunner(props.task)); - const props = __props; - const severity = computed( - () => runner.value.state === "error" || runner.value.state === "warning" ? "primary" : "secondary" - ); - const reactiveLoading = computed(() => runner.value.refreshing); - const reactiveExecuting = computed(() => runner.value.executing); - const isLoading = useMinLoadingDurationRef(reactiveLoading, 250); - const isExecuting = useMinLoadingDurationRef(reactiveExecuting, 250); - const infoPopover = ref(); - const toggle6 = /* @__PURE__ */ __name((event2) => { - infoPopover.value.toggle(event2); - }, "toggle"); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("tr", { - class: normalizeClass(["border-neutral-700 border-solid border-y", { - "opacity-50": runner.value.resolved, - "opacity-75": unref(isLoading) && runner.value.resolved - }]) - }, [ - createBaseVNode("td", _hoisted_1$2, [ - createVNode(_sfc_main$3, { - state: runner.value.state, - loading: unref(isLoading) - }, null, 8, ["state", "loading"]) - ]), - createBaseVNode("td", null, [ - createBaseVNode("p", _hoisted_2$2, toDisplayString(_ctx.task.name), 1), - createVNode(unref(script$1d), { - class: "inline-block mx-2", - type: "button", - icon: unref(PrimeIcons).INFO_CIRCLE, - severity: "secondary", - text: true, - onClick: toggle6 - }, null, 8, ["icon"]), - createVNode(unref(script$1P), { - ref_key: "infoPopover", - ref: infoPopover, - class: "block m-1 max-w-64 min-w-32" - }, { - default: withCtx(() => [ - createBaseVNode("span", _hoisted_3$2, toDisplayString(_ctx.task.description), 1) - ]), - _: 1 - }, 512) - ]), - createBaseVNode("td", _hoisted_4$2, [ - createVNode(unref(script$1d), { - icon: _ctx.task.button?.icon, - label: _ctx.task.button?.text, - severity: severity.value, - "icon-pos": "right", - onClick: _cache[0] || (_cache[0] = (event2) => _ctx.$emit("execute", event2)), - loading: unref(isExecuting) - }, null, 8, ["icon", "label", "severity", "loading"]) - ]) - ], 2); - }; - } -}); -const _hoisted_1$1 = { class: "my-4" }; -const _hoisted_2$1 = { class: "text-neutral-400 w-full text-center" }; -const _hoisted_3$1 = { - key: 0, - class: "w-full border-collapse border-hidden" -}; -const _hoisted_4$1 = { - key: 1, - class: "flex flex-wrap justify-evenly gap-8 pad-y my-4" -}; -const _sfc_main$1 = /* @__PURE__ */ defineComponent({ - __name: "TaskListPanel", - props: { - displayAsList: {}, - filter: {}, - isRefreshing: { type: Boolean } - }, - setup(__props) { - const toast = useToast(); - const confirm = useConfirm(); - const taskStore = useMaintenanceTaskStore(); - const props = __props; - const executeTask = /* @__PURE__ */ __name(async (task) => { - let message; - try { - if (await taskStore.execute(task) === true) return; - message = t("maintenance.error.taskFailed"); - } catch (error) { - message = error?.message; - } - toast.add({ - severity: "error", - summary: t("maintenance.error.toastTitle"), - detail: message ?? t("maintenance.error.defaultDescription"), - life: 1e4 - }); - }, "executeTask"); - const confirmButton = /* @__PURE__ */ __name(async (event2, task) => { - if (!task.requireConfirm) { - await executeTask(task); - return; - } - confirm.require({ - target: event2.currentTarget, - message: task.confirmText ?? t("maintenance.confirmTitle"), - icon: "pi pi-exclamation-circle", - rejectProps: { - label: t("g.cancel"), - severity: "secondary", - outlined: true - }, - acceptProps: { - label: task.button?.text ?? t("g.save"), - severity: task.severity ?? "primary" - }, - // TODO: Not awaited. - accept: /* @__PURE__ */ __name(async () => { - await executeTask(task); - }, "accept") - }); - }, "confirmButton"); - return (_ctx, _cache) => { - return openBlock(), createElementBlock("section", _hoisted_1$1, [ - _ctx.filter.tasks.length === 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ - createVNode(unref(script$1Z)), - createBaseVNode("p", _hoisted_2$1, toDisplayString(_ctx.$t("maintenance.allOk")), 1) - ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [ - _ctx.displayAsList === unref(PrimeIcons).LIST ? (openBlock(), createElementBlock("table", _hoisted_3$1, [ - (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filter.tasks, (task) => { - return openBlock(), createBlock(_sfc_main$2, { - key: task.id, - task, - onExecute: /* @__PURE__ */ __name((event2) => confirmButton(event2, task), "onExecute") - }, null, 8, ["task", "onExecute"]); - }), 128)) - ])) : (openBlock(), createElementBlock("div", _hoisted_4$1, [ - (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filter.tasks, (task) => { - return openBlock(), createBlock(TaskCard, { - key: task.id, - task, - onExecute: /* @__PURE__ */ __name((event2) => confirmButton(event2, task), "onExecute") - }, null, 8, ["task", "onExecute"]); - }), 128)) - ])) - ], 64)), - createVNode(unref(script$1_)) - ]); - }; - } -}); -const _hoisted_1 = { class: "min-w-full min-h-full font-sans w-screen h-screen grid justify-around text-neutral-300 bg-neutral-900 dark-theme overflow-y-auto" }; -const _hoisted_2 = { class: "max-w-screen-sm w-screen m-8 relative" }; -const _hoisted_3 = { class: "backspan pi-wrench text-4xl font-bold" }; -const _hoisted_4 = { class: "w-full flex flex-wrap gap-4 items-center" }; -const _hoisted_5 = { class: "grow" }; -const _hoisted_6 = { class: "flex gap-4 items-center" }; -const _hoisted_7 = { class: "max-sm:hidden" }; -const _hoisted_8 = { class: "flex justify-between gap-4 flex-row" }; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "MaintenanceView", - setup(__props) { - const electron2 = electronAPI(); - const toast = useToast(); - const taskStore = useMaintenanceTaskStore(); - const { clearResolved, processUpdate, refreshDesktopTasks } = taskStore; - const terminalVisible = ref(false); - const reactiveIsRefreshing = computed(() => taskStore.isRefreshing); - const isRefreshing = useMinLoadingDurationRef(reactiveIsRefreshing, 250); - const anyErrors = computed(() => taskStore.anyErrors); - const displayAsList = ref(PrimeIcons.TH_LARGE); - const errorFilter = computed( - () => taskStore.tasks.filter((x) => { - const { state, resolved } = taskStore.getRunner(x); - return state === "error" || resolved; - }) - ); - const filterOptions = ref([ - { icon: PrimeIcons.FILTER_FILL, value: "All", tasks: taskStore.tasks }, - { icon: PrimeIcons.EXCLAMATION_TRIANGLE, value: "Errors", tasks: errorFilter } - ]); - const filter2 = ref(filterOptions.value[1]); - const completeValidation = /* @__PURE__ */ __name(async (alertOnFail = true) => { - const isValid = await electron2.Validation.complete(); - if (alertOnFail && !isValid) { - toast.add({ - severity: "error", - summary: t("g.error"), - detail: t("maintenance.error.cannotContinue"), - life: 5e3 - }); - } - }, "completeValidation"); - const toggleConsoleDrawer = /* @__PURE__ */ __name(() => { - terminalVisible.value = !terminalVisible.value; - }, "toggleConsoleDrawer"); - watch( - () => taskStore.isRunningTerminalCommand, - (value2) => { - terminalVisible.value = value2; - } - ); - watch( - () => taskStore.isRunningInstallationFix, - (value2, oldValue) => { - if (!value2 && oldValue) completeValidation(false); - } - ); - onMounted(async () => { - electron2.Validation.onUpdate(processUpdate); - const update = await electron2.Validation.getStatus(); - processUpdate(update); - }); - onUnmounted(() => electron2.Validation.dispose()); - return (_ctx, _cache) => { - return openBlock(), createBlock(_sfc_main$8, { dark: "" }, { - default: withCtx(() => [ - createBaseVNode("div", _hoisted_1, [ - createBaseVNode("div", _hoisted_2, [ - createBaseVNode("h1", _hoisted_3, toDisplayString(unref(t)("maintenance.title")), 1), - createBaseVNode("div", _hoisted_4, [ - createBaseVNode("span", _hoisted_5, [ - createTextVNode(toDisplayString(unref(t)("maintenance.status")) + ": ", 1), - createVNode(_sfc_main$5, { - refreshing: unref(isRefreshing), - error: anyErrors.value - }, null, 8, ["refreshing", "error"]) - ]), - createBaseVNode("div", _hoisted_6, [ - createVNode(unref(script$1$), { - modelValue: displayAsList.value, - "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => displayAsList.value = $event), - options: [unref(PrimeIcons).LIST, unref(PrimeIcons).TH_LARGE], - "allow-empty": false - }, { - option: withCtx((opts) => [ - createBaseVNode("i", { - class: normalizeClass(opts.option) - }, null, 2) - ]), - _: 1 - }, 8, ["modelValue", "options"]), - createVNode(unref(script$1$), { - modelValue: filter2.value, - "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => filter2.value = $event), - options: filterOptions.value, - "allow-empty": false, - optionLabel: "value", - dataKey: "value", - "area-labelledby": "custom", - onChange: unref(clearResolved) - }, { - option: withCtx((opts) => [ - createBaseVNode("i", { - class: normalizeClass(opts.option.icon) - }, null, 2), - createBaseVNode("span", _hoisted_7, toDisplayString(opts.option.value), 1) - ]), - _: 1 - }, 8, ["modelValue", "options", "onChange"]), - createVNode(_sfc_main$6, { - modelValue: unref(isRefreshing), - "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(isRefreshing) ? isRefreshing.value = $event : null), - severity: "secondary", - onRefresh: unref(refreshDesktopTasks) - }, null, 8, ["modelValue", "onRefresh"]) - ]) - ]), - createVNode(_sfc_main$1, { - class: "border-neutral-700 border-solid border-x-0 border-y", - filter: filter2.value, - displayAsList: displayAsList.value, - isRefreshing: unref(isRefreshing) - }, null, 8, ["filter", "displayAsList", "isRefreshing"]), - createBaseVNode("div", _hoisted_8, [ - createVNode(unref(script$1d), { - label: unref(t)("maintenance.consoleLogs"), - icon: "pi pi-desktop", - "icon-pos": "left", - severity: "secondary", - onClick: toggleConsoleDrawer - }, null, 8, ["label"]), - createVNode(unref(script$1d), { - label: unref(t)("g.continue"), - icon: "pi pi-arrow-right", - "icon-pos": "left", - severity: anyErrors.value ? "secondary" : "primary", - onClick: _cache[3] || (_cache[3] = () => completeValidation()), - loading: unref(isRefreshing) - }, null, 8, ["label", "severity", "loading"]) - ]) - ]), - createVNode(_sfc_main$7, { - modelValue: terminalVisible.value, - "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => terminalVisible.value = $event), - header: unref(t)("g.terminal"), - "default-message": unref(t)("maintenance.terminalDefaultMessage") - }, null, 8, ["modelValue", "header", "default-message"]), - createVNode(unref(script$20)) - ]) - ]), - _: 1 - }); - }; - } -}); -const MaintenanceView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-dd50a7dd"]]); -export { - MaintenanceView as default -}; -//# sourceMappingURL=MaintenanceView-Bh8OZpgl.js.map diff --git a/web/assets/MaintenanceView-DEJCj8SR.css b/web/assets/MaintenanceView-DEJCj8SR.css deleted file mode 100644 index c12b64c90..000000000 --- a/web/assets/MaintenanceView-DEJCj8SR.css +++ /dev/null @@ -1,87 +0,0 @@ - -.task-card-ok[data-v-c3bd7658] { - - position: absolute; - - right: -1rem; - - bottom: -1rem; - - grid-column: 1 / -1; - - grid-row: 1 / -1; - - --tw-text-opacity: 1; - - color: rgb(150 206 76 / var(--tw-text-opacity)); - - opacity: 1; - - transition-property: opacity; - - transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); - - transition-duration: 150ms; - - font-size: 4rem; - text-shadow: 0.25rem 0 0.5rem black; - z-index: 10; -} -.p-card { -&[data-v-c3bd7658] { - - transition-property: opacity; - - transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); - - transition-duration: 150ms; - - --p-card-background: var(--p-button-secondary-background); - opacity: 0.9; - } -&.opacity-65[data-v-c3bd7658] { - opacity: 0.4; -} -&[data-v-c3bd7658]:hover { - opacity: 1; -} -} -[data-v-c3bd7658] .p-card-header { - z-index: 0; -} -[data-v-c3bd7658] .p-card-body { - z-index: 1; - flex-grow: 1; - justify-content: space-between; -} -.task-div { -> i[data-v-c3bd7658] { - pointer-events: none; -} -&:hover > i[data-v-c3bd7658] { - opacity: 0.2; -} -} - -[data-v-dd50a7dd] .p-tag { - --p-tag-gap: 0.375rem; -} -.backspan[data-v-dd50a7dd]::before { - position: absolute; - margin: 0px; - color: var(--p-text-muted-color); - font-family: 'primeicons'; - top: -2rem; - right: -2rem; - speak: none; - font-style: normal; - font-weight: normal; - font-variant: normal; - text-transform: none; - line-height: 1; - display: inline-block; - -webkit-font-smoothing: antialiased; - opacity: 0.02; - font-size: min(14rem, 90vw); - z-index: 0; -} diff --git a/web/assets/ManualConfigurationView-CsirlNfV.css b/web/assets/ManualConfigurationView-CsirlNfV.css deleted file mode 100644 index dba81a0bb..000000000 --- a/web/assets/ManualConfigurationView-CsirlNfV.css +++ /dev/null @@ -1,7 +0,0 @@ - -.p-tag[data-v-dc169863] { - --p-tag-gap: 0.5rem; -} -.comfy-installer[data-v-dc169863] { - margin-top: max(1rem, max(0px, calc((100vh - 42rem) * 0.5))); -} diff --git a/web/assets/ManualConfigurationView-DTLyJ3VG.js b/web/assets/ManualConfigurationView-DTLyJ3VG.js deleted file mode 100644 index 9f2a63acc..000000000 --- a/web/assets/ManualConfigurationView-DTLyJ3VG.js +++ /dev/null @@ -1,74 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, I as useI18n, T as ref, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, a5 as script, b3 as script$1, l as script$2, b9 as electronAPI, _ as _export_sfc } from "./index-Bv0b06LE.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.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 - }); - }; - } -}); -const ManualConfigurationView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-dc169863"]]); -export { - ManualConfigurationView as default -}; -//# sourceMappingURL=ManualConfigurationView-DTLyJ3VG.js.map diff --git a/web/assets/MetricsConsentView-C80fk2cl.js b/web/assets/MetricsConsentView-C80fk2cl.js deleted file mode 100644 index f92e06b76..000000000 --- a/web/assets/MetricsConsentView-C80fk2cl.js +++ /dev/null @@ -1,86 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.js"; -import { d as defineComponent, aV as useToast, I as useI18n, T as ref, bi as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, a8 as createTextVNode, k as createVNode, j as unref, br as script, l as script$1, b9 as electronAPI } from "./index-Bv0b06LE.js"; -const _hoisted_1 = { class: "h-full p-8 2xl:p-16 flex flex-col items-center justify-center" }; -const _hoisted_2 = { class: "bg-neutral-800 rounded-lg shadow-lg p-6 w-full max-w-[600px] flex flex-col gap-6" }; -const _hoisted_3 = { class: "text-3xl font-semibold text-neutral-100" }; -const _hoisted_4 = { class: "text-neutral-400" }; -const _hoisted_5 = { class: "text-neutral-400" }; -const _hoisted_6 = { - href: "https://comfy.org/privacy", - target: "_blank", - class: "text-blue-400 hover:text-blue-300 underline" -}; -const _hoisted_7 = { class: "flex items-center gap-4" }; -const _hoisted_8 = { - id: "metricsDescription", - class: "text-neutral-100" -}; -const _hoisted_9 = { class: "flex pt-6 justify-end" }; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "MetricsConsentView", - setup(__props) { - const toast = useToast(); - const { t } = useI18n(); - const allowMetrics = ref(true); - const router = useRouter(); - const isUpdating = ref(false); - const updateConsent = /* @__PURE__ */ __name(async () => { - isUpdating.value = true; - try { - await electronAPI().setMetricsConsent(allowMetrics.value); - } catch (error) { - toast.add({ - severity: "error", - summary: t("install.errorUpdatingConsent"), - detail: t("install.errorUpdatingConsentDetail"), - life: 3e3 - }); - } finally { - isUpdating.value = false; - } - router.push("/"); - }, "updateConsent"); - return (_ctx, _cache) => { - const _component_BaseViewTemplate = _sfc_main$1; - return openBlock(), createBlock(_component_BaseViewTemplate, { dark: "" }, { - default: withCtx(() => [ - createBaseVNode("div", _hoisted_1, [ - createBaseVNode("div", _hoisted_2, [ - createBaseVNode("h2", _hoisted_3, toDisplayString(_ctx.$t("install.helpImprove")), 1), - createBaseVNode("p", _hoisted_4, toDisplayString(_ctx.$t("install.updateConsent")), 1), - createBaseVNode("p", _hoisted_5, [ - createTextVNode(toDisplayString(_ctx.$t("install.moreInfo")) + " ", 1), - createBaseVNode("a", _hoisted_6, toDisplayString(_ctx.$t("install.privacyPolicy")), 1), - _cache[1] || (_cache[1] = createTextVNode(". ")) - ]), - createBaseVNode("div", _hoisted_7, [ - createVNode(unref(script), { - modelValue: allowMetrics.value, - "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => allowMetrics.value = $event), - "aria-describedby": "metricsDescription" - }, null, 8, ["modelValue"]), - createBaseVNode("span", _hoisted_8, toDisplayString(allowMetrics.value ? _ctx.$t("install.metricsEnabled") : _ctx.$t("install.metricsDisabled")), 1) - ]), - createBaseVNode("div", _hoisted_9, [ - createVNode(unref(script$1), { - label: _ctx.$t("g.ok"), - icon: "pi pi-check", - loading: isUpdating.value, - iconPos: "right", - onClick: updateConsent - }, null, 8, ["label", "loading"]) - ]) - ]) - ]) - ]), - _: 1 - }); - }; - } -}); -export { - _sfc_main as default -}; -//# sourceMappingURL=MetricsConsentView-C80fk2cl.js.map diff --git a/web/assets/NotSupportedView-B78ZVR9Z.js b/web/assets/NotSupportedView-B78ZVR9Z.js deleted file mode 100644 index f59e3d1ad..000000000 --- a/web/assets/NotSupportedView-B78ZVR9Z.js +++ /dev/null @@ -1,86 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, bi as useRouter, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, i as withDirectives, _ as _export_sfc } from "./index-Bv0b06LE.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.js"; -const _imports_0 = "" + new URL("images/sad_girl.png", import.meta.url).href; -const _hoisted_1 = { class: "sad-container" }; -const _hoisted_2 = { class: "no-drag sad-text flex items-center" }; -const _hoisted_3 = { class: "flex flex-col gap-8 p-8 min-w-110" }; -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 _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, [ - _cache[0] || (_cache[0] = createBaseVNode("img", { - class: "sad-girl", - src: _imports_0, - alt: "Sad girl illustration" - }, null, -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")] - ]) - ]) - ]) - ]) - ]) - ]), - _: 1 - }); - }; - } -}); -const NotSupportedView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ebb20958"]]); -export { - NotSupportedView as default -}; -//# sourceMappingURL=NotSupportedView-B78ZVR9Z.js.map diff --git a/web/assets/NotSupportedView-RFx6eCkN.css b/web/assets/NotSupportedView-RFx6eCkN.css deleted file mode 100644 index 594783813..000000000 --- a/web/assets/NotSupportedView-RFx6eCkN.css +++ /dev/null @@ -1,19 +0,0 @@ - -.sad-container { -&[data-v-ebb20958] { - display: grid; - align-items: center; - justify-content: space-evenly; - grid-template-columns: 25rem 1fr; -} -&[data-v-ebb20958] > * { - grid-row: 1; -} -} -.sad-text[data-v-ebb20958] { - grid-column: 1/3; -} -.sad-girl[data-v-ebb20958] { - grid-column: 2/3; - width: min(75vw, 100vh); -} diff --git a/web/assets/ServerConfigPanel-BYrt6wyr.js b/web/assets/ServerConfigPanel-BYrt6wyr.js deleted file mode 100644 index 494678ac1..000000000 --- a/web/assets/ServerConfigPanel-BYrt6wyr.js +++ /dev/null @@ -1,156 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { o as openBlock, f as createElementBlock, m as createBaseVNode, H as markRaw, d as defineComponent, a as useSettingStore, af as storeToRefs, N as watch, dJ as useCopyToClipboard, I as useI18n, y as createBlock, z as withCtx, j as unref, bn as script, E as toDisplayString, D as renderList, F as Fragment, k as createVNode, l as script$1, B as createCommentVNode, bl as script$2, dK as FormItem, dz as _sfc_main$1, b9 as electronAPI } from "./index-Bv0b06LE.js"; -import { u as useServerConfigStore } from "./serverConfigStore-D2Vr0L0h.js"; -const _hoisted_1$1 = { - viewBox: "0 0 24 24", - width: "1.2em", - height: "1.2em" -}; -function render(_ctx, _cache) { - return openBlock(), createElementBlock("svg", _hoisted_1$1, _cache[0] || (_cache[0] = [ - createBaseVNode("path", { - fill: "none", - stroke: "currentColor", - "stroke-linecap": "round", - "stroke-linejoin": "round", - "stroke-width": "2", - d: "m4 17l6-6l-6-6m8 14h8" - }, null, -1) - ])); -} -__name(render, "render"); -const __unplugin_components_0 = markRaw({ name: "lucide-terminal", render }); -const _hoisted_1 = { class: "flex flex-col gap-2" }; -const _hoisted_2 = { class: "flex justify-end gap-2" }; -const _hoisted_3 = { class: "flex items-center justify-between" }; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "ServerConfigPanel", - setup(__props) { - const settingStore = useSettingStore(); - const serverConfigStore = useServerConfigStore(); - const { - serverConfigsByCategory, - serverConfigValues, - launchArgs, - commandLineArgs, - modifiedConfigs - } = storeToRefs(serverConfigStore); - const revertChanges = /* @__PURE__ */ __name(() => { - serverConfigStore.revertChanges(); - }, "revertChanges"); - const restartApp = /* @__PURE__ */ __name(() => { - electronAPI().restartApp(); - }, "restartApp"); - watch(launchArgs, (newVal) => { - settingStore.set("Comfy.Server.LaunchArgs", newVal); - }); - watch(serverConfigValues, (newVal) => { - settingStore.set("Comfy.Server.ServerConfigValues", newVal); - }); - const { copyToClipboard } = useCopyToClipboard(); - const copyCommandLineArgs = /* @__PURE__ */ __name(async () => { - await copyToClipboard(commandLineArgs.value); - }, "copyCommandLineArgs"); - const { t } = useI18n(); - const translateItem = /* @__PURE__ */ __name((item) => { - return { - ...item, - name: t(`serverConfigItems.${item.id}.name`, item.name), - tooltip: item.tooltip ? t(`serverConfigItems.${item.id}.tooltip`, item.tooltip) : void 0 - }; - }, "translateItem"); - return (_ctx, _cache) => { - const _component_i_lucide58terminal = __unplugin_components_0; - return openBlock(), createBlock(_sfc_main$1, { - value: "Server-Config", - class: "server-config-panel" - }, { - header: withCtx(() => [ - createBaseVNode("div", _hoisted_1, [ - unref(modifiedConfigs).length > 0 ? (openBlock(), createBlock(unref(script), { - key: 0, - severity: "info", - "pt:text": "w-full" - }, { - default: withCtx(() => [ - createBaseVNode("p", null, toDisplayString(_ctx.$t("serverConfig.modifiedConfigs")), 1), - createBaseVNode("ul", null, [ - (openBlock(true), createElementBlock(Fragment, null, renderList(unref(modifiedConfigs), (config) => { - return openBlock(), createElementBlock("li", { - key: config.id - }, toDisplayString(config.name) + ": " + toDisplayString(config.initialValue) + " → " + toDisplayString(config.value), 1); - }), 128)) - ]), - createBaseVNode("div", _hoisted_2, [ - createVNode(unref(script$1), { - label: _ctx.$t("serverConfig.revertChanges"), - onClick: revertChanges, - outlined: "" - }, null, 8, ["label"]), - createVNode(unref(script$1), { - label: _ctx.$t("serverConfig.restart"), - onClick: restartApp, - outlined: "", - severity: "danger" - }, null, 8, ["label"]) - ]) - ]), - _: 1 - })) : createCommentVNode("", true), - unref(commandLineArgs) ? (openBlock(), createBlock(unref(script), { - key: 1, - severity: "secondary", - "pt:text": "w-full" - }, { - icon: withCtx(() => [ - createVNode(_component_i_lucide58terminal, { class: "text-xl font-bold" }) - ]), - default: withCtx(() => [ - createBaseVNode("div", _hoisted_3, [ - createBaseVNode("p", null, toDisplayString(unref(commandLineArgs)), 1), - createVNode(unref(script$1), { - icon: "pi pi-clipboard", - onClick: copyCommandLineArgs, - severity: "secondary", - text: "" - }) - ]) - ]), - _: 1 - })) : createCommentVNode("", true) - ]) - ]), - default: withCtx(() => [ - (openBlock(true), createElementBlock(Fragment, null, renderList(Object.entries(unref(serverConfigsByCategory)), ([label, items], i) => { - return openBlock(), createElementBlock("div", { key: label }, [ - i > 0 ? (openBlock(), createBlock(unref(script$2), { key: 0 })) : createCommentVNode("", true), - createBaseVNode("h3", null, toDisplayString(_ctx.$t(`serverConfigCategories.${label}`, label)), 1), - (openBlock(true), createElementBlock(Fragment, null, renderList(items, (item) => { - return openBlock(), createElementBlock("div", { - key: item.name, - class: "mb-4" - }, [ - createVNode(FormItem, { - item: translateItem(item), - formValue: item.value, - "onUpdate:formValue": /* @__PURE__ */ __name(($event) => item.value = $event, "onUpdate:formValue"), - id: item.id, - labelClass: { - "text-highlight": item.initialValue !== item.value - } - }, null, 8, ["item", "formValue", "onUpdate:formValue", "id", "labelClass"]) - ]); - }), 128)) - ]); - }), 128)) - ]), - _: 1 - }); - }; - } -}); -export { - _sfc_main as default -}; -//# sourceMappingURL=ServerConfigPanel-BYrt6wyr.js.map diff --git a/web/assets/ServerStartView-B7TlHxYo.js b/web/assets/ServerStartView-B7TlHxYo.js deleted file mode 100644 index 80dfeb323..000000000 --- a/web/assets/ServerStartView-B7TlHxYo.js +++ /dev/null @@ -1,100 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, I as useI18n, T as ref, bo as ProgressStatus, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, a8 as createTextVNode, E as toDisplayString, j as unref, f as createElementBlock, B as createCommentVNode, k as createVNode, l as script, i as withDirectives, v as vShow, bp as BaseTerminal, b9 as electronAPI, _ as _export_sfc } from "./index-Bv0b06LE.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.js"; -const _hoisted_1 = { class: "flex flex-col w-full h-full items-center" }; -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, autoRows: true, autoCols: 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("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] - ]) - ]) - ]), - _: 1 - }); - }; - } -}); -const ServerStartView = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e6ba9633"]]); -export { - ServerStartView as default -}; -//# sourceMappingURL=ServerStartView-B7TlHxYo.js.map diff --git a/web/assets/ServerStartView-BZ7uhZHv.css b/web/assets/ServerStartView-BZ7uhZHv.css deleted file mode 100644 index 778134b72..000000000 --- a/web/assets/ServerStartView-BZ7uhZHv.css +++ /dev/null @@ -1,5 +0,0 @@ - -[data-v-e6ba9633] .xterm-helper-textarea { - /* Hide this as it moves all over when uv is running */ - display: none; -} diff --git a/web/assets/TerminalOutputDrawer-CKr7Br7O.js b/web/assets/TerminalOutputDrawer-CKr7Br7O.js deleted file mode 100644 index 09062bab9..000000000 --- a/web/assets/TerminalOutputDrawer-CKr7Br7O.js +++ /dev/null @@ -1,1061 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { bG as BaseStyle, bH as script$2, bZ as ZIndex, bU as addClass, bL as focus, cy as blockBodyScroll, cA as unblockBodyScroll, cB as FocusTrap, l as script$3, ca as script$4, cl as script$5, bR as resolveComponent, r as resolveDirective, o as openBlock, y as createBlock, z as withCtx, f as createElementBlock, at as mergeProps, k as createVNode, bI as Transition, i as withDirectives, A as renderSlot, F as Fragment, m as createBaseVNode, aj as normalizeClass, E as toDisplayString, B as createCommentVNode, C as resolveDynamicComponent, dd as commonjsGlobal, de as getDefaultExportFromCjs, H as markRaw, df as xtermExports, p as onMounted, d8 as onUnmounted, d as defineComponent, bw as mergeModels, bq as useModel, bp as BaseTerminal, j as unref, b9 as electronAPI } from "./index-Bv0b06LE.js"; -var theme = /* @__PURE__ */ __name(function theme2(_ref) { - var dt = _ref.dt; - return "\n.p-drawer {\n display: flex;\n flex-direction: column;\n transform: translate3d(0px, 0px, 0px);\n position: relative;\n transition: transform 0.3s;\n background: ".concat(dt("drawer.background"), ";\n color: ").concat(dt("drawer.color"), ";\n border: 1px solid ").concat(dt("drawer.border.color"), ";\n box-shadow: ").concat(dt("drawer.shadow"), ";\n}\n\n.p-drawer-content {\n overflow-y: auto;\n flex-grow: 1;\n padding: ").concat(dt("drawer.content.padding"), ";\n}\n\n.p-drawer-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-shrink: 0;\n padding: ").concat(dt("drawer.header.padding"), ";\n}\n\n.p-drawer-footer {\n padding: ").concat(dt("drawer.footer.padding"), ";\n}\n\n.p-drawer-title {\n font-weight: ").concat(dt("drawer.title.font.weight"), ";\n font-size: ").concat(dt("drawer.title.font.size"), ";\n}\n\n.p-drawer-full .p-drawer {\n transition: none;\n transform: none;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n border-width: 1px;\n}\n\n.p-drawer-left .p-drawer-enter-from,\n.p-drawer-left .p-drawer-leave-to {\n transform: translateX(-100%);\n}\n\n.p-drawer-right .p-drawer-enter-from,\n.p-drawer-right .p-drawer-leave-to {\n transform: translateX(100%);\n}\n\n.p-drawer-top .p-drawer-enter-from,\n.p-drawer-top .p-drawer-leave-to {\n transform: translateY(-100%);\n}\n\n.p-drawer-bottom .p-drawer-enter-from,\n.p-drawer-bottom .p-drawer-leave-to {\n transform: translateY(100%);\n}\n\n.p-drawer-full .p-drawer-enter-from,\n.p-drawer-full .p-drawer-leave-to {\n opacity: 0;\n}\n\n.p-drawer-full .p-drawer-enter-active,\n.p-drawer-full .p-drawer-leave-active {\n transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n.p-drawer-left .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-end-width: 1px;\n}\n\n.p-drawer-right .p-drawer {\n width: 20rem;\n height: 100%;\n border-inline-start-width: 1px;\n}\n\n.p-drawer-top .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-end-width: 1px;\n}\n\n.p-drawer-bottom .p-drawer {\n height: 10rem;\n width: 100%;\n border-block-start-width: 1px;\n}\n\n.p-drawer-left .p-drawer-content,\n.p-drawer-right .p-drawer-content,\n.p-drawer-top .p-drawer-content,\n.p-drawer-bottom .p-drawer-content {\n width: 100%;\n height: 100%;\n}\n\n.p-drawer-open {\n display: flex;\n}\n\n.p-drawer-mask:dir(rtl) {\n flex-direction: row-reverse;\n}\n"); -}, "theme"); -var inlineStyles = { - mask: /* @__PURE__ */ __name(function mask(_ref2) { - var position = _ref2.position, modal = _ref2.modal; - return { - position: "fixed", - height: "100%", - width: "100%", - left: 0, - top: 0, - display: "flex", - justifyContent: position === "left" ? "flex-start" : position === "right" ? "flex-end" : "center", - alignItems: position === "top" ? "flex-start" : position === "bottom" ? "flex-end" : "center", - pointerEvents: modal ? "auto" : "none" - }; - }, "mask"), - root: { - pointerEvents: "auto" - } -}; -var classes = { - mask: /* @__PURE__ */ __name(function mask2(_ref3) { - var instance = _ref3.instance, props = _ref3.props; - var positions = ["left", "right", "top", "bottom"]; - var pos = positions.find(function(item) { - return item === props.position; - }); - return ["p-drawer-mask", { - "p-overlay-mask p-overlay-mask-enter": props.modal, - "p-drawer-open": instance.containerVisible, - "p-drawer-full": instance.fullScreen - }, pos ? "p-drawer-".concat(pos) : ""]; - }, "mask"), - root: /* @__PURE__ */ __name(function root(_ref4) { - var instance = _ref4.instance; - return ["p-drawer p-component", { - "p-drawer-full": instance.fullScreen - }]; - }, "root"), - header: "p-drawer-header", - title: "p-drawer-title", - pcCloseButton: "p-drawer-close-button", - content: "p-drawer-content", - footer: "p-drawer-footer" -}; -var DrawerStyle = BaseStyle.extend({ - name: "drawer", - theme, - classes, - inlineStyles -}); -var script$1 = { - name: "BaseDrawer", - "extends": script$2, - props: { - visible: { - type: Boolean, - "default": false - }, - position: { - type: String, - "default": "left" - }, - header: { - type: null, - "default": null - }, - baseZIndex: { - type: Number, - "default": 0 - }, - autoZIndex: { - type: Boolean, - "default": true - }, - dismissable: { - type: Boolean, - "default": true - }, - showCloseIcon: { - type: Boolean, - "default": true - }, - closeButtonProps: { - type: Object, - "default": /* @__PURE__ */ __name(function _default() { - return { - severity: "secondary", - text: true, - rounded: true - }; - }, "_default") - }, - closeIcon: { - type: String, - "default": void 0 - }, - modal: { - type: Boolean, - "default": true - }, - blockScroll: { - type: Boolean, - "default": false - } - }, - style: DrawerStyle, - provide: /* @__PURE__ */ __name(function provide() { - return { - $pcDrawer: this, - $parentInstance: this - }; - }, "provide") -}; -var script = { - name: "Drawer", - "extends": script$1, - inheritAttrs: false, - emits: ["update:visible", "show", "after-show", "hide", "after-hide"], - data: /* @__PURE__ */ __name(function data() { - return { - containerVisible: this.visible - }; - }, "data"), - container: null, - mask: null, - content: null, - headerContainer: null, - footerContainer: null, - closeButton: null, - outsideClickListener: null, - documentKeydownListener: null, - watch: { - dismissable: /* @__PURE__ */ __name(function dismissable(newValue) { - if (newValue) { - this.enableDocumentSettings(); - } else { - this.disableDocumentSettings(); - } - }, "dismissable") - }, - updated: /* @__PURE__ */ __name(function updated() { - if (this.visible) { - this.containerVisible = this.visible; - } - }, "updated"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount() { - this.disableDocumentSettings(); - if (this.mask && this.autoZIndex) { - ZIndex.clear(this.mask); - } - this.container = null; - this.mask = null; - }, "beforeUnmount"), - methods: { - hide: /* @__PURE__ */ __name(function hide() { - this.$emit("update:visible", false); - }, "hide"), - onEnter: /* @__PURE__ */ __name(function onEnter() { - this.$emit("show"); - this.focus(); - this.bindDocumentKeyDownListener(); - if (this.autoZIndex) { - ZIndex.set("modal", this.mask, this.baseZIndex || this.$primevue.config.zIndex.modal); - } - }, "onEnter"), - onAfterEnter: /* @__PURE__ */ __name(function onAfterEnter() { - this.enableDocumentSettings(); - this.$emit("after-show"); - }, "onAfterEnter"), - onBeforeLeave: /* @__PURE__ */ __name(function onBeforeLeave() { - if (this.modal) { - !this.isUnstyled && addClass(this.mask, "p-overlay-mask-leave"); - } - }, "onBeforeLeave"), - onLeave: /* @__PURE__ */ __name(function onLeave() { - this.$emit("hide"); - }, "onLeave"), - onAfterLeave: /* @__PURE__ */ __name(function onAfterLeave() { - if (this.autoZIndex) { - ZIndex.clear(this.mask); - } - this.unbindDocumentKeyDownListener(); - this.containerVisible = false; - this.disableDocumentSettings(); - this.$emit("after-hide"); - }, "onAfterLeave"), - onMaskClick: /* @__PURE__ */ __name(function onMaskClick(event) { - if (this.dismissable && this.modal && this.mask === event.target) { - this.hide(); - } - }, "onMaskClick"), - focus: /* @__PURE__ */ __name(function focus$1() { - var findFocusableElement = /* @__PURE__ */ __name(function findFocusableElement2(container) { - return container && container.querySelector("[autofocus]"); - }, "findFocusableElement"); - var focusTarget = this.$slots.header && findFocusableElement(this.headerContainer); - if (!focusTarget) { - focusTarget = this.$slots["default"] && findFocusableElement(this.container); - if (!focusTarget) { - focusTarget = this.$slots.footer && findFocusableElement(this.footerContainer); - if (!focusTarget) { - focusTarget = this.closeButton; - } - } - } - focusTarget && focus(focusTarget); - }, "focus$1"), - enableDocumentSettings: /* @__PURE__ */ __name(function enableDocumentSettings() { - if (this.dismissable && !this.modal) { - this.bindOutsideClickListener(); - } - if (this.blockScroll) { - blockBodyScroll(); - } - }, "enableDocumentSettings"), - disableDocumentSettings: /* @__PURE__ */ __name(function disableDocumentSettings() { - this.unbindOutsideClickListener(); - if (this.blockScroll) { - unblockBodyScroll(); - } - }, "disableDocumentSettings"), - onKeydown: /* @__PURE__ */ __name(function onKeydown(event) { - if (event.code === "Escape") { - this.hide(); - } - }, "onKeydown"), - containerRef: /* @__PURE__ */ __name(function containerRef(el) { - this.container = el; - }, "containerRef"), - maskRef: /* @__PURE__ */ __name(function maskRef(el) { - this.mask = el; - }, "maskRef"), - contentRef: /* @__PURE__ */ __name(function contentRef(el) { - this.content = el; - }, "contentRef"), - headerContainerRef: /* @__PURE__ */ __name(function headerContainerRef(el) { - this.headerContainer = el; - }, "headerContainerRef"), - footerContainerRef: /* @__PURE__ */ __name(function footerContainerRef(el) { - this.footerContainer = el; - }, "footerContainerRef"), - closeButtonRef: /* @__PURE__ */ __name(function closeButtonRef(el) { - this.closeButton = el ? el.$el : void 0; - }, "closeButtonRef"), - bindDocumentKeyDownListener: /* @__PURE__ */ __name(function bindDocumentKeyDownListener() { - if (!this.documentKeydownListener) { - this.documentKeydownListener = this.onKeydown; - document.addEventListener("keydown", this.documentKeydownListener); - } - }, "bindDocumentKeyDownListener"), - unbindDocumentKeyDownListener: /* @__PURE__ */ __name(function unbindDocumentKeyDownListener() { - if (this.documentKeydownListener) { - document.removeEventListener("keydown", this.documentKeydownListener); - this.documentKeydownListener = null; - } - }, "unbindDocumentKeyDownListener"), - bindOutsideClickListener: /* @__PURE__ */ __name(function bindOutsideClickListener() { - var _this = this; - if (!this.outsideClickListener) { - this.outsideClickListener = function(event) { - if (_this.isOutsideClicked(event)) { - _this.hide(); - } - }; - document.addEventListener("click", this.outsideClickListener); - } - }, "bindOutsideClickListener"), - unbindOutsideClickListener: /* @__PURE__ */ __name(function unbindOutsideClickListener() { - if (this.outsideClickListener) { - document.removeEventListener("click", this.outsideClickListener); - this.outsideClickListener = null; - } - }, "unbindOutsideClickListener"), - isOutsideClicked: /* @__PURE__ */ __name(function isOutsideClicked(event) { - return this.container && !this.container.contains(event.target); - }, "isOutsideClicked") - }, - computed: { - fullScreen: /* @__PURE__ */ __name(function fullScreen() { - return this.position === "full"; - }, "fullScreen"), - closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : void 0; - }, "closeAriaLabel") - }, - directives: { - focustrap: FocusTrap - }, - components: { - Button: script$3, - Portal: script$4, - TimesIcon: script$5 - } -}; -var _hoisted_1 = ["aria-modal"]; -function render(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Button = resolveComponent("Button"); - var _component_Portal = resolveComponent("Portal"); - var _directive_focustrap = resolveDirective("focustrap"); - return openBlock(), createBlock(_component_Portal, null, { - "default": withCtx(function() { - return [$data.containerVisible ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: $options.maskRef, - onMousedown: _cache[0] || (_cache[0] = function() { - return $options.onMaskClick && $options.onMaskClick.apply($options, arguments); - }), - "class": _ctx.cx("mask"), - style: _ctx.sx("mask", true, { - position: _ctx.position, - modal: _ctx.modal - }) - }, _ctx.ptm("mask")), [createVNode(Transition, mergeProps({ - name: "p-drawer", - onEnter: $options.onEnter, - onAfterEnter: $options.onAfterEnter, - onBeforeLeave: $options.onBeforeLeave, - onLeave: $options.onLeave, - onAfterLeave: $options.onAfterLeave, - appear: "" - }, _ctx.ptm("transition")), { - "default": withCtx(function() { - return [_ctx.visible ? withDirectives((openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: $options.containerRef, - "class": _ctx.cx("root"), - style: _ctx.sx("root"), - role: "complementary", - "aria-modal": _ctx.modal - }, _ctx.ptmi("root")), [_ctx.$slots.container ? renderSlot(_ctx.$slots, "container", { - key: 0, - closeCallback: $options.hide - }) : (openBlock(), createElementBlock(Fragment, { - key: 1 - }, [createBaseVNode("div", mergeProps({ - ref: $options.headerContainerRef, - "class": _ctx.cx("header") - }, _ctx.ptm("header")), [renderSlot(_ctx.$slots, "header", { - "class": normalizeClass(_ctx.cx("title")) - }, function() { - return [_ctx.header ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - "class": _ctx.cx("title") - }, _ctx.ptm("title")), toDisplayString(_ctx.header), 17)) : createCommentVNode("", true)]; - }), _ctx.showCloseIcon ? (openBlock(), createBlock(_component_Button, mergeProps({ - key: 0, - ref: $options.closeButtonRef, - type: "button", - "class": _ctx.cx("pcCloseButton"), - "aria-label": $options.closeAriaLabel, - unstyled: _ctx.unstyled, - onClick: $options.hide - }, _ctx.closeButtonProps, { - pt: _ctx.ptm("pcCloseButton"), - "data-pc-group-section": "iconcontainer" - }), { - icon: withCtx(function(slotProps) { - return [renderSlot(_ctx.$slots, "closeicon", {}, function() { - return [(openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon ? "span" : "TimesIcon"), mergeProps({ - "class": [_ctx.closeIcon, slotProps["class"]] - }, _ctx.ptm("pcCloseButton")["icon"]), null, 16, ["class"]))]; - })]; - }), - _: 3 - }, 16, ["class", "aria-label", "unstyled", "onClick", "pt"])) : createCommentVNode("", true)], 16), createBaseVNode("div", mergeProps({ - ref: $options.contentRef, - "class": _ctx.cx("content") - }, _ctx.ptm("content")), [renderSlot(_ctx.$slots, "default")], 16), _ctx.$slots.footer ? (openBlock(), createElementBlock("div", mergeProps({ - key: 0, - ref: $options.footerContainerRef, - "class": _ctx.cx("footer") - }, _ctx.ptm("footer")), [renderSlot(_ctx.$slots, "footer")], 16)) : createCommentVNode("", true)], 64))], 16, _hoisted_1)), [[_directive_focustrap]]) : createCommentVNode("", true)]; - }), - _: 3 - }, 16, ["onEnter", "onAfterEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])], 16)) : createCommentVNode("", true)]; - }), - _: 3 - }); -} -__name(render, "render"); -script.render = render; -var addonSerialize$2 = { exports: {} }; -var addonSerialize = addonSerialize$2.exports; -(function(module, exports) { - !function(e, t) { - true ? module.exports = t() : false ? (void 0)([], t) : true ? exports.SerializeAddon = t() : e.SerializeAddon = t(); - }(commonjsGlobal, () => (() => { - "use strict"; - var e = { 930: (e2, t2, s2) => { - Object.defineProperty(t2, "__esModule", { value: true }), t2.ColorContrastCache = void 0; - const r2 = s2(485); - t2.ColorContrastCache = class { - constructor() { - this._color = new r2.TwoKeyMap(), this._css = new r2.TwoKeyMap(); - } - setCss(e3, t3, s3) { - this._css.set(e3, t3, s3); - } - getCss(e3, t3) { - return this._css.get(e3, t3); - } - setColor(e3, t3, s3) { - this._color.set(e3, t3, s3); - } - getColor(e3, t3) { - return this._color.get(e3, t3); - } - clear() { - this._color.clear(), this._css.clear(); - } - }; - }, 997: function(e2, t2, s2) { - var r2 = this && this.__decorate || function(e3, t3, s3, r3) { - var o2, i2 = arguments.length, n2 = i2 < 3 ? t3 : null === r3 ? r3 = Object.getOwnPropertyDescriptor(t3, s3) : r3; - if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n2 = Reflect.decorate(e3, t3, s3, r3); - else for (var l2 = e3.length - 1; l2 >= 0; l2--) (o2 = e3[l2]) && (n2 = (i2 < 3 ? o2(n2) : i2 > 3 ? o2(t3, s3, n2) : o2(t3, s3)) || n2); - return i2 > 3 && n2 && Object.defineProperty(t3, s3, n2), n2; - }, o = this && this.__param || function(e3, t3) { - return function(s3, r3) { - t3(s3, r3, e3); - }; - }; - Object.defineProperty(t2, "__esModule", { value: true }), t2.ThemeService = t2.DEFAULT_ANSI_COLORS = void 0; - const i = s2(930), n = s2(160), l = s2(345), a = s2(859), c = s2(97), h = n.css.toColor("#ffffff"), u = n.css.toColor("#000000"), _ = n.css.toColor("#ffffff"), d = n.css.toColor("#000000"), C = { css: "rgba(255, 255, 255, 0.3)", rgba: 4294967117 }; - t2.DEFAULT_ANSI_COLORS = Object.freeze((() => { - const e3 = [n.css.toColor("#2e3436"), n.css.toColor("#cc0000"), n.css.toColor("#4e9a06"), n.css.toColor("#c4a000"), n.css.toColor("#3465a4"), n.css.toColor("#75507b"), n.css.toColor("#06989a"), n.css.toColor("#d3d7cf"), n.css.toColor("#555753"), n.css.toColor("#ef2929"), n.css.toColor("#8ae234"), n.css.toColor("#fce94f"), n.css.toColor("#729fcf"), n.css.toColor("#ad7fa8"), n.css.toColor("#34e2e2"), n.css.toColor("#eeeeec")], t3 = [0, 95, 135, 175, 215, 255]; - for (let s3 = 0; s3 < 216; s3++) { - const r3 = t3[s3 / 36 % 6 | 0], o2 = t3[s3 / 6 % 6 | 0], i2 = t3[s3 % 6]; - e3.push({ css: n.channels.toCss(r3, o2, i2), rgba: n.channels.toRgba(r3, o2, i2) }); - } - for (let t4 = 0; t4 < 24; t4++) { - const s3 = 8 + 10 * t4; - e3.push({ css: n.channels.toCss(s3, s3, s3), rgba: n.channels.toRgba(s3, s3, s3) }); - } - return e3; - })()); - let f = t2.ThemeService = class extends a.Disposable { - get colors() { - return this._colors; - } - constructor(e3) { - super(), this._optionsService = e3, this._contrastCache = new i.ColorContrastCache(), this._halfContrastCache = new i.ColorContrastCache(), this._onChangeColors = this.register(new l.EventEmitter()), this.onChangeColors = this._onChangeColors.event, this._colors = { foreground: h, background: u, cursor: _, cursorAccent: d, selectionForeground: void 0, selectionBackgroundTransparent: C, selectionBackgroundOpaque: n.color.blend(u, C), selectionInactiveBackgroundTransparent: C, selectionInactiveBackgroundOpaque: n.color.blend(u, C), ansi: t2.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(e3 = {}) { - const s3 = this._colors; - if (s3.foreground = g(e3.foreground, h), s3.background = g(e3.background, u), s3.cursor = g(e3.cursor, _), s3.cursorAccent = g(e3.cursorAccent, d), s3.selectionBackgroundTransparent = g(e3.selectionBackground, C), s3.selectionBackgroundOpaque = n.color.blend(s3.background, s3.selectionBackgroundTransparent), s3.selectionInactiveBackgroundTransparent = g(e3.selectionInactiveBackground, s3.selectionBackgroundTransparent), s3.selectionInactiveBackgroundOpaque = n.color.blend(s3.background, s3.selectionInactiveBackgroundTransparent), s3.selectionForeground = e3.selectionForeground ? g(e3.selectionForeground, n.NULL_COLOR) : void 0, s3.selectionForeground === n.NULL_COLOR && (s3.selectionForeground = void 0), n.color.isOpaque(s3.selectionBackgroundTransparent)) { - const e4 = 0.3; - s3.selectionBackgroundTransparent = n.color.opacity(s3.selectionBackgroundTransparent, e4); - } - if (n.color.isOpaque(s3.selectionInactiveBackgroundTransparent)) { - const e4 = 0.3; - s3.selectionInactiveBackgroundTransparent = n.color.opacity(s3.selectionInactiveBackgroundTransparent, e4); - } - if (s3.ansi = t2.DEFAULT_ANSI_COLORS.slice(), s3.ansi[0] = g(e3.black, t2.DEFAULT_ANSI_COLORS[0]), s3.ansi[1] = g(e3.red, t2.DEFAULT_ANSI_COLORS[1]), s3.ansi[2] = g(e3.green, t2.DEFAULT_ANSI_COLORS[2]), s3.ansi[3] = g(e3.yellow, t2.DEFAULT_ANSI_COLORS[3]), s3.ansi[4] = g(e3.blue, t2.DEFAULT_ANSI_COLORS[4]), s3.ansi[5] = g(e3.magenta, t2.DEFAULT_ANSI_COLORS[5]), s3.ansi[6] = g(e3.cyan, t2.DEFAULT_ANSI_COLORS[6]), s3.ansi[7] = g(e3.white, t2.DEFAULT_ANSI_COLORS[7]), s3.ansi[8] = g(e3.brightBlack, t2.DEFAULT_ANSI_COLORS[8]), s3.ansi[9] = g(e3.brightRed, t2.DEFAULT_ANSI_COLORS[9]), s3.ansi[10] = g(e3.brightGreen, t2.DEFAULT_ANSI_COLORS[10]), s3.ansi[11] = g(e3.brightYellow, t2.DEFAULT_ANSI_COLORS[11]), s3.ansi[12] = g(e3.brightBlue, t2.DEFAULT_ANSI_COLORS[12]), s3.ansi[13] = g(e3.brightMagenta, t2.DEFAULT_ANSI_COLORS[13]), s3.ansi[14] = g(e3.brightCyan, t2.DEFAULT_ANSI_COLORS[14]), s3.ansi[15] = g(e3.brightWhite, t2.DEFAULT_ANSI_COLORS[15]), e3.extendedAnsi) { - const r3 = Math.min(s3.ansi.length - 16, e3.extendedAnsi.length); - for (let o2 = 0; o2 < r3; o2++) s3.ansi[o2 + 16] = g(e3.extendedAnsi[o2], t2.DEFAULT_ANSI_COLORS[o2 + 16]); - } - this._contrastCache.clear(), this._halfContrastCache.clear(), this._updateRestoreColors(), this._onChangeColors.fire(this.colors); - } - restoreColor(e3) { - this._restoreColor(e3), this._onChangeColors.fire(this.colors); - } - _restoreColor(e3) { - if (void 0 !== e3) switch (e3) { - case 256: - this._colors.foreground = this._restoreColors.foreground; - break; - case 257: - this._colors.background = this._restoreColors.background; - break; - case 258: - this._colors.cursor = this._restoreColors.cursor; - break; - default: - this._colors.ansi[e3] = this._restoreColors.ansi[e3]; - } - else for (let e4 = 0; e4 < this._restoreColors.ansi.length; ++e4) this._colors.ansi[e4] = this._restoreColors.ansi[e4]; - } - modifyColors(e3) { - e3(this._colors), this._onChangeColors.fire(this.colors); - } - _updateRestoreColors() { - this._restoreColors = { foreground: this._colors.foreground, background: this._colors.background, cursor: this._colors.cursor, ansi: this._colors.ansi.slice() }; - } - }; - function g(e3, t3) { - if (void 0 !== e3) try { - return n.css.toColor(e3); - } catch { - } - return t3; - } - __name(g, "g"); - t2.ThemeService = f = r2([o(0, c.IOptionsService)], f); - }, 160: (e2, t2) => { - Object.defineProperty(t2, "__esModule", { value: true }), t2.contrastRatio = t2.toPaddedHex = t2.rgba = t2.rgb = t2.css = t2.color = t2.channels = t2.NULL_COLOR = void 0; - let s2 = 0, r2 = 0, o = 0, i = 0; - var n, l, a, c, h; - function u(e3) { - const t3 = e3.toString(16); - return t3.length < 2 ? "0" + t3 : t3; - } - __name(u, "u"); - function _(e3, t3) { - return e3 < t3 ? (t3 + 0.05) / (e3 + 0.05) : (e3 + 0.05) / (t3 + 0.05); - } - __name(_, "_"); - t2.NULL_COLOR = { css: "#00000000", rgba: 0 }, function(e3) { - e3.toCss = function(e4, t3, s3, r3) { - return void 0 !== r3 ? `#${u(e4)}${u(t3)}${u(s3)}${u(r3)}` : `#${u(e4)}${u(t3)}${u(s3)}`; - }, e3.toRgba = function(e4, t3, s3, r3 = 255) { - return (e4 << 24 | t3 << 16 | s3 << 8 | r3) >>> 0; - }, e3.toColor = function(t3, s3, r3, o2) { - return { css: e3.toCss(t3, s3, r3, o2), rgba: e3.toRgba(t3, s3, r3, o2) }; - }; - }(n || (t2.channels = n = {})), function(e3) { - function t3(e4, t4) { - return i = Math.round(255 * t4), [s2, r2, o] = h.toChannels(e4.rgba), { css: n.toCss(s2, r2, o, i), rgba: n.toRgba(s2, r2, o, i) }; - } - __name(t3, "t"); - e3.blend = function(e4, t4) { - if (i = (255 & t4.rgba) / 255, 1 === i) return { css: t4.css, rgba: t4.rgba }; - const l2 = t4.rgba >> 24 & 255, a2 = t4.rgba >> 16 & 255, c2 = t4.rgba >> 8 & 255, h2 = e4.rgba >> 24 & 255, u2 = e4.rgba >> 16 & 255, _2 = e4.rgba >> 8 & 255; - return s2 = h2 + Math.round((l2 - h2) * i), r2 = u2 + Math.round((a2 - u2) * i), o = _2 + Math.round((c2 - _2) * i), { css: n.toCss(s2, r2, o), rgba: n.toRgba(s2, r2, o) }; - }, e3.isOpaque = function(e4) { - return 255 == (255 & e4.rgba); - }, e3.ensureContrastRatio = function(e4, t4, s3) { - const r3 = h.ensureContrastRatio(e4.rgba, t4.rgba, s3); - if (r3) return n.toColor(r3 >> 24 & 255, r3 >> 16 & 255, r3 >> 8 & 255); - }, e3.opaque = function(e4) { - const t4 = (255 | e4.rgba) >>> 0; - return [s2, r2, o] = h.toChannels(t4), { css: n.toCss(s2, r2, o), rgba: t4 }; - }, e3.opacity = t3, e3.multiplyOpacity = function(e4, s3) { - return i = 255 & e4.rgba, t3(e4, i * s3 / 255); - }, e3.toColorRGB = function(e4) { - return [e4.rgba >> 24 & 255, e4.rgba >> 16 & 255, e4.rgba >> 8 & 255]; - }; - }(l || (t2.color = l = {})), function(e3) { - let t3, l2; - try { - const e4 = document.createElement("canvas"); - e4.width = 1, e4.height = 1; - const s3 = e4.getContext("2d", { willReadFrequently: true }); - s3 && (t3 = s3, t3.globalCompositeOperation = "copy", l2 = t3.createLinearGradient(0, 0, 1, 1)); - } catch { - } - e3.toColor = function(e4) { - if (e4.match(/#[\da-f]{3,8}/i)) switch (e4.length) { - case 4: - return s2 = parseInt(e4.slice(1, 2).repeat(2), 16), r2 = parseInt(e4.slice(2, 3).repeat(2), 16), o = parseInt(e4.slice(3, 4).repeat(2), 16), n.toColor(s2, r2, o); - case 5: - return s2 = parseInt(e4.slice(1, 2).repeat(2), 16), r2 = parseInt(e4.slice(2, 3).repeat(2), 16), o = parseInt(e4.slice(3, 4).repeat(2), 16), i = parseInt(e4.slice(4, 5).repeat(2), 16), n.toColor(s2, r2, o, i); - case 7: - return { css: e4, rgba: (parseInt(e4.slice(1), 16) << 8 | 255) >>> 0 }; - case 9: - return { css: e4, rgba: parseInt(e4.slice(1), 16) >>> 0 }; - } - const a2 = e4.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/); - if (a2) return s2 = parseInt(a2[1]), r2 = parseInt(a2[2]), o = parseInt(a2[3]), i = Math.round(255 * (void 0 === a2[5] ? 1 : parseFloat(a2[5]))), n.toColor(s2, r2, o, i); - if (!t3 || !l2) throw new Error("css.toColor: Unsupported css format"); - if (t3.fillStyle = l2, t3.fillStyle = e4, "string" != typeof t3.fillStyle) throw new Error("css.toColor: Unsupported css format"); - if (t3.fillRect(0, 0, 1, 1), [s2, r2, o, i] = t3.getImageData(0, 0, 1, 1).data, 255 !== i) throw new Error("css.toColor: Unsupported css format"); - return { rgba: n.toRgba(s2, r2, o, i), css: e4 }; - }; - }(a || (t2.css = a = {})), function(e3) { - function t3(e4, t4, s3) { - const r3 = e4 / 255, o2 = t4 / 255, i2 = s3 / 255; - return 0.2126 * (r3 <= 0.03928 ? r3 / 12.92 : Math.pow((r3 + 0.055) / 1.055, 2.4)) + 0.7152 * (o2 <= 0.03928 ? o2 / 12.92 : Math.pow((o2 + 0.055) / 1.055, 2.4)) + 0.0722 * (i2 <= 0.03928 ? i2 / 12.92 : Math.pow((i2 + 0.055) / 1.055, 2.4)); - } - __name(t3, "t"); - e3.relativeLuminance = function(e4) { - return t3(e4 >> 16 & 255, e4 >> 8 & 255, 255 & e4); - }, e3.relativeLuminance2 = t3; - }(c || (t2.rgb = c = {})), function(e3) { - function t3(e4, t4, s3) { - const r3 = e4 >> 24 & 255, o2 = e4 >> 16 & 255, i2 = e4 >> 8 & 255; - let n2 = t4 >> 24 & 255, l3 = t4 >> 16 & 255, a2 = t4 >> 8 & 255, h2 = _(c.relativeLuminance2(n2, l3, a2), c.relativeLuminance2(r3, o2, i2)); - for (; h2 < s3 && (n2 > 0 || l3 > 0 || a2 > 0); ) n2 -= Math.max(0, Math.ceil(0.1 * n2)), l3 -= Math.max(0, Math.ceil(0.1 * l3)), a2 -= Math.max(0, Math.ceil(0.1 * a2)), h2 = _(c.relativeLuminance2(n2, l3, a2), c.relativeLuminance2(r3, o2, i2)); - return (n2 << 24 | l3 << 16 | a2 << 8 | 255) >>> 0; - } - __name(t3, "t"); - function l2(e4, t4, s3) { - const r3 = e4 >> 24 & 255, o2 = e4 >> 16 & 255, i2 = e4 >> 8 & 255; - let n2 = t4 >> 24 & 255, l3 = t4 >> 16 & 255, a2 = t4 >> 8 & 255, h2 = _(c.relativeLuminance2(n2, l3, a2), c.relativeLuminance2(r3, o2, i2)); - for (; h2 < s3 && (n2 < 255 || l3 < 255 || a2 < 255); ) n2 = Math.min(255, n2 + Math.ceil(0.1 * (255 - n2))), l3 = Math.min(255, l3 + Math.ceil(0.1 * (255 - l3))), a2 = Math.min(255, a2 + Math.ceil(0.1 * (255 - a2))), h2 = _(c.relativeLuminance2(n2, l3, a2), c.relativeLuminance2(r3, o2, i2)); - return (n2 << 24 | l3 << 16 | a2 << 8 | 255) >>> 0; - } - __name(l2, "l"); - e3.blend = function(e4, t4) { - if (i = (255 & t4) / 255, 1 === i) return t4; - const l3 = t4 >> 24 & 255, a2 = t4 >> 16 & 255, c2 = t4 >> 8 & 255, h2 = e4 >> 24 & 255, u2 = e4 >> 16 & 255, _2 = e4 >> 8 & 255; - return s2 = h2 + Math.round((l3 - h2) * i), r2 = u2 + Math.round((a2 - u2) * i), o = _2 + Math.round((c2 - _2) * i), n.toRgba(s2, r2, o); - }, e3.ensureContrastRatio = function(e4, s3, r3) { - const o2 = c.relativeLuminance(e4 >> 8), i2 = c.relativeLuminance(s3 >> 8); - if (_(o2, i2) < r3) { - if (i2 < o2) { - const i3 = t3(e4, s3, r3), n3 = _(o2, c.relativeLuminance(i3 >> 8)); - if (n3 < r3) { - const t4 = l2(e4, s3, r3); - return n3 > _(o2, c.relativeLuminance(t4 >> 8)) ? i3 : t4; - } - return i3; - } - const n2 = l2(e4, s3, r3), a2 = _(o2, c.relativeLuminance(n2 >> 8)); - if (a2 < r3) { - const i3 = t3(e4, s3, r3); - return a2 > _(o2, c.relativeLuminance(i3 >> 8)) ? n2 : i3; - } - return n2; - } - }, e3.reduceLuminance = t3, e3.increaseLuminance = l2, e3.toChannels = function(e4) { - return [e4 >> 24 & 255, e4 >> 16 & 255, e4 >> 8 & 255, 255 & e4]; - }; - }(h || (t2.rgba = h = {})), t2.toPaddedHex = u, t2.contrastRatio = _; - }, 345: (e2, t2) => { - Object.defineProperty(t2, "__esModule", { value: true }), t2.runAndSubscribe = t2.forwardEvent = t2.EventEmitter = void 0, t2.EventEmitter = class { - constructor() { - this._listeners = [], this._disposed = false; - } - get event() { - return this._event || (this._event = (e3) => (this._listeners.push(e3), { dispose: /* @__PURE__ */ __name(() => { - if (!this._disposed) { - for (let t3 = 0; t3 < this._listeners.length; t3++) if (this._listeners[t3] === e3) return void this._listeners.splice(t3, 1); - } - }, "dispose") })), this._event; - } - fire(e3, t3) { - const s2 = []; - for (let e4 = 0; e4 < this._listeners.length; e4++) s2.push(this._listeners[e4]); - for (let r2 = 0; r2 < s2.length; r2++) s2[r2].call(void 0, e3, t3); - } - dispose() { - this.clearListeners(), this._disposed = true; - } - clearListeners() { - this._listeners && (this._listeners.length = 0); - } - }, t2.forwardEvent = function(e3, t3) { - return e3((e4) => t3.fire(e4)); - }, t2.runAndSubscribe = function(e3, t3) { - return t3(void 0), e3((e4) => t3(e4)); - }; - }, 859: (e2, t2) => { - function s2(e3) { - for (const t3 of e3) t3.dispose(); - e3.length = 0; - } - __name(s2, "s"); - Object.defineProperty(t2, "__esModule", { value: true }), t2.getDisposeArrayDisposable = t2.disposeArray = t2.toDisposable = t2.MutableDisposable = t2.Disposable = void 0, t2.Disposable = class { - constructor() { - this._disposables = [], this._isDisposed = false; - } - dispose() { - this._isDisposed = true; - for (const e3 of this._disposables) e3.dispose(); - this._disposables.length = 0; - } - register(e3) { - return this._disposables.push(e3), e3; - } - unregister(e3) { - const t3 = this._disposables.indexOf(e3); - -1 !== t3 && this._disposables.splice(t3, 1); - } - }, t2.MutableDisposable = class { - constructor() { - this._isDisposed = false; - } - get value() { - return this._isDisposed ? void 0 : this._value; - } - set value(e3) { - this._isDisposed || e3 === this._value || (this._value?.dispose(), this._value = e3); - } - clear() { - this.value = void 0; - } - dispose() { - this._isDisposed = true, this._value?.dispose(), this._value = void 0; - } - }, t2.toDisposable = function(e3) { - return { dispose: e3 }; - }, t2.disposeArray = s2, t2.getDisposeArrayDisposable = function(e3) { - return { dispose: /* @__PURE__ */ __name(() => s2(e3), "dispose") }; - }; - }, 485: (e2, t2) => { - Object.defineProperty(t2, "__esModule", { value: true }), t2.FourKeyMap = t2.TwoKeyMap = void 0; - class s2 { - static { - __name(this, "s"); - } - constructor() { - this._data = {}; - } - set(e3, t3, s3) { - this._data[e3] || (this._data[e3] = {}), this._data[e3][t3] = s3; - } - get(e3, t3) { - return this._data[e3] ? this._data[e3][t3] : void 0; - } - clear() { - this._data = {}; - } - } - t2.TwoKeyMap = s2, t2.FourKeyMap = class { - constructor() { - this._data = new s2(); - } - set(e3, t3, r2, o, i) { - this._data.get(e3, t3) || this._data.set(e3, t3, new s2()), this._data.get(e3, t3).set(r2, o, i); - } - get(e3, t3, s3, r2) { - return this._data.get(e3, t3)?.get(s3, r2); - } - clear() { - this._data.clear(); - } - }; - }, 726: (e2, t2) => { - Object.defineProperty(t2, "__esModule", { value: true }), t2.createDecorator = t2.getServiceDependencies = t2.serviceRegistry = void 0; - const s2 = "di$target", r2 = "di$dependencies"; - t2.serviceRegistry = /* @__PURE__ */ new Map(), t2.getServiceDependencies = function(e3) { - return e3[r2] || []; - }, t2.createDecorator = function(e3) { - if (t2.serviceRegistry.has(e3)) return t2.serviceRegistry.get(e3); - const o = /* @__PURE__ */ __name(function(e4, t3, i) { - if (3 !== arguments.length) throw new Error("@IServiceName-decorator can only be used to decorate a parameter"); - !function(e5, t4, o2) { - t4[s2] === t4 ? t4[r2].push({ id: e5, index: o2 }) : (t4[r2] = [{ id: e5, index: o2 }], t4[s2] = t4); - }(o, e4, i); - }, "o"); - return o.toString = () => e3, t2.serviceRegistry.set(e3, o), o; - }; - }, 97: (e2, t2, s2) => { - Object.defineProperty(t2, "__esModule", { value: true }), t2.IDecorationService = t2.IUnicodeService = t2.IOscLinkService = t2.IOptionsService = t2.ILogService = t2.LogLevelEnum = t2.IInstantiationService = t2.ICharsetService = t2.ICoreService = t2.ICoreMouseService = t2.IBufferService = void 0; - const r2 = s2(726); - var o; - t2.IBufferService = (0, r2.createDecorator)("BufferService"), t2.ICoreMouseService = (0, r2.createDecorator)("CoreMouseService"), t2.ICoreService = (0, r2.createDecorator)("CoreService"), t2.ICharsetService = (0, r2.createDecorator)("CharsetService"), t2.IInstantiationService = (0, r2.createDecorator)("InstantiationService"), function(e3) { - e3[e3.TRACE = 0] = "TRACE", e3[e3.DEBUG = 1] = "DEBUG", e3[e3.INFO = 2] = "INFO", e3[e3.WARN = 3] = "WARN", e3[e3.ERROR = 4] = "ERROR", e3[e3.OFF = 5] = "OFF"; - }(o || (t2.LogLevelEnum = o = {})), t2.ILogService = (0, r2.createDecorator)("LogService"), t2.IOptionsService = (0, r2.createDecorator)("OptionsService"), t2.IOscLinkService = (0, r2.createDecorator)("OscLinkService"), t2.IUnicodeService = (0, r2.createDecorator)("UnicodeService"), t2.IDecorationService = (0, r2.createDecorator)("DecorationService"); - } }, t = {}; - function s(r2) { - var o = t[r2]; - if (void 0 !== o) return o.exports; - var i = t[r2] = { exports: {} }; - return e[r2].call(i.exports, i, i.exports, s), i.exports; - } - __name(s, "s"); - var r = {}; - return (() => { - var e2 = r; - Object.defineProperty(e2, "__esModule", { value: true }), e2.HTMLSerializeHandler = e2.SerializeAddon = void 0; - const t2 = s(997); - function o(e3, t3, s2) { - return Math.max(t3, Math.min(e3, s2)); - } - __name(o, "o"); - class i { - static { - __name(this, "i"); - } - constructor(e3) { - this._buffer = e3; - } - serialize(e3, t3) { - const s2 = this._buffer.getNullCell(), r2 = this._buffer.getNullCell(); - let o2 = s2; - const i2 = e3.start.y, n2 = e3.end.y, l2 = e3.start.x, a2 = e3.end.x; - this._beforeSerialize(n2 - i2, i2, n2); - for (let t4 = i2; t4 <= n2; t4++) { - const i3 = this._buffer.getLine(t4); - if (i3) { - const n3 = t4 === e3.start.y ? l2 : 0, c2 = t4 === e3.end.y ? a2 : i3.length; - for (let e4 = n3; e4 < c2; e4++) { - const n4 = i3.getCell(e4, o2 === s2 ? r2 : s2); - n4 ? (this._nextCell(n4, o2, t4, e4), o2 = n4) : console.warn(`Can't get cell at row=${t4}, col=${e4}`); - } - } - this._rowEnd(t4, t4 === n2); - } - return this._afterSerialize(), this._serializeString(t3); - } - _nextCell(e3, t3, s2, r2) { - } - _rowEnd(e3, t3) { - } - _beforeSerialize(e3, t3, s2) { - } - _afterSerialize() { - } - _serializeString(e3) { - return ""; - } - } - function n(e3, t3) { - return e3.getFgColorMode() === t3.getFgColorMode() && e3.getFgColor() === t3.getFgColor(); - } - __name(n, "n"); - function l(e3, t3) { - return e3.getBgColorMode() === t3.getBgColorMode() && e3.getBgColor() === t3.getBgColor(); - } - __name(l, "l"); - function a(e3, t3) { - return e3.isInverse() === t3.isInverse() && e3.isBold() === t3.isBold() && e3.isUnderline() === t3.isUnderline() && e3.isOverline() === t3.isOverline() && e3.isBlink() === t3.isBlink() && e3.isInvisible() === t3.isInvisible() && e3.isItalic() === t3.isItalic() && e3.isDim() === t3.isDim() && e3.isStrikethrough() === t3.isStrikethrough(); - } - __name(a, "a"); - class c extends i { - static { - __name(this, "c"); - } - constructor(e3, t3) { - super(e3), this._terminal = t3, this._rowIndex = 0, this._allRows = new Array(), this._allRowSeparators = new Array(), this._currentRow = "", this._nullCellCount = 0, this._cursorStyle = this._buffer.getNullCell(), this._cursorStyleRow = 0, this._cursorStyleCol = 0, this._backgroundCell = this._buffer.getNullCell(), this._firstRow = 0, this._lastCursorRow = 0, this._lastCursorCol = 0, this._lastContentCursorRow = 0, this._lastContentCursorCol = 0, this._thisRowLastChar = this._buffer.getNullCell(), this._thisRowLastSecondChar = this._buffer.getNullCell(), this._nextRowFirstChar = this._buffer.getNullCell(); - } - _beforeSerialize(e3, t3, s2) { - this._allRows = new Array(e3), this._lastContentCursorRow = t3, this._lastCursorRow = t3, this._firstRow = t3; - } - _rowEnd(e3, t3) { - this._nullCellCount > 0 && !l(this._cursorStyle, this._backgroundCell) && (this._currentRow += `\x1B[${this._nullCellCount}X`); - let s2 = ""; - if (!t3) { - e3 - this._firstRow >= this._terminal.rows && this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol, this._backgroundCell); - const t4 = this._buffer.getLine(e3), r2 = this._buffer.getLine(e3 + 1); - if (r2.isWrapped) { - s2 = ""; - const o2 = t4.getCell(t4.length - 1, this._thisRowLastChar), i2 = t4.getCell(t4.length - 2, this._thisRowLastSecondChar), n2 = r2.getCell(0, this._nextRowFirstChar), a2 = n2.getWidth() > 1; - let c2 = false; - (n2.getChars() && a2 ? this._nullCellCount <= 1 : this._nullCellCount <= 0) && ((o2.getChars() || 0 === o2.getWidth()) && l(o2, n2) && (c2 = true), a2 && (i2.getChars() || 0 === i2.getWidth()) && l(o2, n2) && l(i2, n2) && (c2 = true)), c2 || (s2 = "-".repeat(this._nullCellCount + 1), s2 += "\x1B[1D\x1B[1X", this._nullCellCount > 0 && (s2 += "\x1B[A", s2 += `\x1B[${t4.length - this._nullCellCount}C`, s2 += `\x1B[${this._nullCellCount}X`, s2 += `\x1B[${t4.length - this._nullCellCount}D`, s2 += "\x1B[B"), this._lastContentCursorRow = e3 + 1, this._lastContentCursorCol = 0, this._lastCursorRow = e3 + 1, this._lastCursorCol = 0); - } else s2 = "\r\n", this._lastCursorRow = e3 + 1, this._lastCursorCol = 0; - } - this._allRows[this._rowIndex] = this._currentRow, this._allRowSeparators[this._rowIndex++] = s2, this._currentRow = "", this._nullCellCount = 0; - } - _diffStyle(e3, t3) { - const s2 = [], r2 = !n(e3, t3), o2 = !l(e3, t3), i2 = !a(e3, t3); - if (r2 || o2 || i2) if (e3.isAttributeDefault()) t3.isAttributeDefault() || s2.push(0); - else { - if (r2) { - const t4 = e3.getFgColor(); - e3.isFgRGB() ? s2.push(38, 2, t4 >>> 16 & 255, t4 >>> 8 & 255, 255 & t4) : e3.isFgPalette() ? t4 >= 16 ? s2.push(38, 5, t4) : s2.push(8 & t4 ? 90 + (7 & t4) : 30 + (7 & t4)) : s2.push(39); - } - if (o2) { - const t4 = e3.getBgColor(); - e3.isBgRGB() ? s2.push(48, 2, t4 >>> 16 & 255, t4 >>> 8 & 255, 255 & t4) : e3.isBgPalette() ? t4 >= 16 ? s2.push(48, 5, t4) : s2.push(8 & t4 ? 100 + (7 & t4) : 40 + (7 & t4)) : s2.push(49); - } - i2 && (e3.isInverse() !== t3.isInverse() && s2.push(e3.isInverse() ? 7 : 27), e3.isBold() !== t3.isBold() && s2.push(e3.isBold() ? 1 : 22), e3.isUnderline() !== t3.isUnderline() && s2.push(e3.isUnderline() ? 4 : 24), e3.isOverline() !== t3.isOverline() && s2.push(e3.isOverline() ? 53 : 55), e3.isBlink() !== t3.isBlink() && s2.push(e3.isBlink() ? 5 : 25), e3.isInvisible() !== t3.isInvisible() && s2.push(e3.isInvisible() ? 8 : 28), e3.isItalic() !== t3.isItalic() && s2.push(e3.isItalic() ? 3 : 23), e3.isDim() !== t3.isDim() && s2.push(e3.isDim() ? 2 : 22), e3.isStrikethrough() !== t3.isStrikethrough() && s2.push(e3.isStrikethrough() ? 9 : 29)); - } - return s2; - } - _nextCell(e3, t3, s2, r2) { - if (0 === e3.getWidth()) return; - const o2 = "" === e3.getChars(), i2 = this._diffStyle(e3, this._cursorStyle); - if (o2 ? !l(this._cursorStyle, e3) : i2.length > 0) { - this._nullCellCount > 0 && (l(this._cursorStyle, this._backgroundCell) || (this._currentRow += `\x1B[${this._nullCellCount}X`), this._currentRow += `\x1B[${this._nullCellCount}C`, this._nullCellCount = 0), this._lastContentCursorRow = this._lastCursorRow = s2, this._lastContentCursorCol = this._lastCursorCol = r2, this._currentRow += `\x1B[${i2.join(";")}m`; - const e4 = this._buffer.getLine(s2); - void 0 !== e4 && (e4.getCell(r2, this._cursorStyle), this._cursorStyleRow = s2, this._cursorStyleCol = r2); - } - o2 ? this._nullCellCount += e3.getWidth() : (this._nullCellCount > 0 && (l(this._cursorStyle, this._backgroundCell) || (this._currentRow += `\x1B[${this._nullCellCount}X`), this._currentRow += `\x1B[${this._nullCellCount}C`, this._nullCellCount = 0), this._currentRow += e3.getChars(), this._lastContentCursorRow = this._lastCursorRow = s2, this._lastContentCursorCol = this._lastCursorCol = r2 + e3.getWidth()); - } - _serializeString(e3) { - let t3 = this._allRows.length; - this._buffer.length - this._firstRow <= this._terminal.rows && (t3 = this._lastContentCursorRow + 1 - this._firstRow, this._lastCursorCol = this._lastContentCursorCol, this._lastCursorRow = this._lastContentCursorRow); - let s2 = ""; - for (let e4 = 0; e4 < t3; e4++) s2 += this._allRows[e4], e4 + 1 < t3 && (s2 += this._allRowSeparators[e4]); - if (!e3) { - const e4 = this._buffer.baseY + this._buffer.cursorY, t4 = this._buffer.cursorX, o3 = /* @__PURE__ */ __name((e5) => { - e5 > 0 ? s2 += `\x1B[${e5}C` : e5 < 0 && (s2 += `\x1B[${-e5}D`); - }, "o"); - (e4 !== this._lastCursorRow || t4 !== this._lastCursorCol) && ((r2 = e4 - this._lastCursorRow) > 0 ? s2 += `\x1B[${r2}B` : r2 < 0 && (s2 += `\x1B[${-r2}A`), o3(t4 - this._lastCursorCol)); - } - var r2; - const o2 = this._terminal._core._inputHandler._curAttrData, i2 = this._diffStyle(o2, this._cursorStyle); - return i2.length > 0 && (s2 += `\x1B[${i2.join(";")}m`), s2; - } - } - e2.SerializeAddon = class { - activate(e3) { - this._terminal = e3; - } - _serializeBufferByScrollback(e3, t3, s2) { - const r2 = t3.length, i2 = void 0 === s2 ? r2 : o(s2 + e3.rows, 0, r2); - return this._serializeBufferByRange(e3, t3, { start: r2 - i2, end: r2 - 1 }, false); - } - _serializeBufferByRange(e3, t3, s2, r2) { - return new c(t3, e3).serialize({ start: { x: 0, y: "number" == typeof s2.start ? s2.start : s2.start.line }, end: { x: e3.cols, y: "number" == typeof s2.end ? s2.end : s2.end.line } }, r2); - } - _serializeBufferAsHTML(e3, t3) { - const s2 = e3.buffer.active, r2 = new h(s2, e3, t3); - if (!t3.onlySelection) { - const i3 = s2.length, n2 = t3.scrollback, l2 = void 0 === n2 ? i3 : o(n2 + e3.rows, 0, i3); - return r2.serialize({ start: { x: 0, y: i3 - l2 }, end: { x: e3.cols, y: i3 - 1 } }); - } - const i2 = this._terminal?.getSelectionPosition(); - return void 0 !== i2 ? r2.serialize({ start: { x: i2.start.x, y: i2.start.y }, end: { x: i2.end.x, y: i2.end.y } }) : ""; - } - _serializeModes(e3) { - let t3 = ""; - const s2 = e3.modes; - if (s2.applicationCursorKeysMode && (t3 += "\x1B[?1h"), s2.applicationKeypadMode && (t3 += "\x1B[?66h"), s2.bracketedPasteMode && (t3 += "\x1B[?2004h"), s2.insertMode && (t3 += "\x1B[4h"), s2.originMode && (t3 += "\x1B[?6h"), s2.reverseWraparoundMode && (t3 += "\x1B[?45h"), s2.sendFocusMode && (t3 += "\x1B[?1004h"), false === s2.wraparoundMode && (t3 += "\x1B[?7l"), "none" !== s2.mouseTrackingMode) switch (s2.mouseTrackingMode) { - case "x10": - t3 += "\x1B[?9h"; - break; - case "vt200": - t3 += "\x1B[?1000h"; - break; - case "drag": - t3 += "\x1B[?1002h"; - break; - case "any": - t3 += "\x1B[?1003h"; - } - return t3; - } - serialize(e3) { - if (!this._terminal) throw new Error("Cannot use addon until it has been loaded"); - let t3 = e3?.range ? this._serializeBufferByRange(this._terminal, this._terminal.buffer.normal, e3.range, true) : this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.normal, e3?.scrollback); - return e3?.excludeAltBuffer || "alternate" !== this._terminal.buffer.active.type || (t3 += `\x1B[?1049h\x1B[H${this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.alternate, void 0)}`), e3?.excludeModes || (t3 += this._serializeModes(this._terminal)), t3; - } - serializeAsHTML(e3) { - if (!this._terminal) throw new Error("Cannot use addon until it has been loaded"); - return this._serializeBufferAsHTML(this._terminal, e3 || {}); - } - dispose() { - } - }; - class h extends i { - static { - __name(this, "h"); - } - constructor(e3, s2, r2) { - super(e3), this._terminal = s2, this._options = r2, this._currentRow = "", this._htmlContent = "", s2._core._themeService ? this._ansiColors = s2._core._themeService.colors.ansi : this._ansiColors = t2.DEFAULT_ANSI_COLORS; - } - _padStart(e3, t3, s2) { - return t3 >>= 0, s2 = s2 ?? " ", e3.length > t3 ? e3 : ((t3 -= e3.length) > s2.length && (s2 += s2.repeat(t3 / s2.length)), s2.slice(0, t3) + e3); - } - _beforeSerialize(e3, t3, s2) { - this._htmlContent += "
";
-          let r2 = "#000000", o2 = "#ffffff";
-          this._options.includeGlobalBackground && (r2 = this._terminal.options.theme?.foreground ?? "#ffffff", o2 = this._terminal.options.theme?.background ?? "#000000");
-          const i2 = [];
-          i2.push("color: " + r2 + ";"), i2.push("background-color: " + o2 + ";"), i2.push("font-family: " + this._terminal.options.fontFamily + ";"), i2.push("font-size: " + this._terminal.options.fontSize + "px;"), this._htmlContent += "
"; - } - _afterSerialize() { - this._htmlContent += "
", this._htmlContent += "
"; - } - _rowEnd(e3, t3) { - this._htmlContent += "
" + this._currentRow + "
", this._currentRow = ""; - } - _getHexColor(e3, t3) { - const s2 = t3 ? e3.getFgColor() : e3.getBgColor(); - return (t3 ? e3.isFgRGB() : e3.isBgRGB()) ? "#" + [s2 >> 16 & 255, s2 >> 8 & 255, 255 & s2].map((e4) => this._padStart(e4.toString(16), 2, "0")).join("") : (t3 ? e3.isFgPalette() : e3.isBgPalette()) ? this._ansiColors[s2].css : void 0; - } - _diffStyle(e3, t3) { - const s2 = [], r2 = !n(e3, t3), o2 = !l(e3, t3), i2 = !a(e3, t3); - if (r2 || o2 || i2) { - const t4 = this._getHexColor(e3, true); - t4 && s2.push("color: " + t4 + ";"); - const r3 = this._getHexColor(e3, false); - return r3 && s2.push("background-color: " + r3 + ";"), e3.isInverse() && s2.push("color: #000000; background-color: #BFBFBF;"), e3.isBold() && s2.push("font-weight: bold;"), e3.isUnderline() && e3.isOverline() ? s2.push("text-decoration: overline underline;") : e3.isUnderline() ? s2.push("text-decoration: underline;") : e3.isOverline() && s2.push("text-decoration: overline;"), e3.isBlink() && s2.push("text-decoration: blink;"), e3.isInvisible() && s2.push("visibility: hidden;"), e3.isItalic() && s2.push("font-style: italic;"), e3.isDim() && s2.push("opacity: 0.5;"), e3.isStrikethrough() && s2.push("text-decoration: line-through;"), s2; - } - } - _nextCell(e3, t3, s2, r2) { - if (0 === e3.getWidth()) return; - const o2 = "" === e3.getChars(), i2 = this._diffStyle(e3, t3); - i2 && (this._currentRow += 0 === i2.length ? "" : ""), this._currentRow += o2 ? " " : e3.getChars(); - } - _serializeString() { - return this._htmlContent; - } - } - e2.HTMLSerializeHandler = h; - })(), r; - })()); -})(addonSerialize$2, addonSerialize$2.exports); -var addonSerializeExports = addonSerialize$2.exports; -const addonSerialize$1 = /* @__PURE__ */ getDefaultExportFromCjs(addonSerializeExports); -function useTerminalBuffer() { - const serializeAddon = new addonSerializeExports.SerializeAddon(); - const terminal = markRaw(new xtermExports.Terminal({ convertEol: true })); - const copyTo = /* @__PURE__ */ __name((destinationTerminal) => { - destinationTerminal.write(serializeAddon.serialize()); - }, "copyTo"); - const write = /* @__PURE__ */ __name((message) => terminal.write(message), "write"); - const serialize = /* @__PURE__ */ __name(() => serializeAddon.serialize(), "serialize"); - onMounted(() => { - terminal.loadAddon(serializeAddon); - }); - onUnmounted(() => { - terminal.dispose(); - }); - return { - copyTo, - serialize, - write - }; -} -__name(useTerminalBuffer, "useTerminalBuffer"); -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "TerminalOutputDrawer", - props: /* @__PURE__ */ mergeModels({ - header: {}, - defaultMessage: {} - }, { - "modelValue": { type: Boolean, ...{ required: true } }, - "modelModifiers": {} - }), - emits: ["update:modelValue"], - setup(__props) { - const terminalVisible = useModel(__props, "modelValue"); - const props = __props; - const electron = electronAPI(); - const buffer = useTerminalBuffer(); - let xterm = null; - const terminalCreated = /* @__PURE__ */ __name(({ terminal, useAutoSize }, root2) => { - xterm = terminal; - useAutoSize({ root: root2, autoRows: true, autoCols: true }); - terminal.write(props.defaultMessage); - buffer.copyTo(terminal); - terminal.options.cursorBlink = false; - terminal.options.cursorStyle = "bar"; - terminal.options.cursorInactiveStyle = "bar"; - terminal.options.disableStdin = true; - }, "terminalCreated"); - const terminalUnmounted = /* @__PURE__ */ __name(() => { - xterm = null; - }, "terminalUnmounted"); - onMounted(async () => { - electron.onLogMessage((message) => { - buffer.write(message); - xterm?.write(message); - }); - }); - return (_ctx, _cache) => { - return openBlock(), createBlock(unref(script), { - visible: terminalVisible.value, - "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => terminalVisible.value = $event), - header: _ctx.header, - position: "bottom", - style: { "height": "max(50vh, 34rem)" } - }, { - default: withCtx(() => [ - createVNode(BaseTerminal, { - onCreated: terminalCreated, - onUnmounted: terminalUnmounted - }) - ]), - _: 1 - }, 8, ["visible", "header"]); - }; - } -}); -export { - _sfc_main as _, - script as s -}; -//# sourceMappingURL=TerminalOutputDrawer-CKr7Br7O.js.map diff --git a/web/assets/UserSelectView-C703HOyO.js b/web/assets/UserSelectView-C703HOyO.js deleted file mode 100644 index 6ada5034d..000000000 --- a/web/assets/UserSelectView-C703HOyO.js +++ /dev/null @@ -1,101 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, ak as useUserStore, bi as useRouter, T as ref, c as computed, p as onMounted, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, bj as withKeys, j as unref, bk as script, bl as script$1, bm as script$2, bn as script$3, a8 as createTextVNode, B as createCommentVNode, l as script$4 } from "./index-Bv0b06LE.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.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 = { class: "flex w-full flex-col items-center" }; -const _hoisted_3 = { class: "flex w-full flex-col gap-2" }; -const _hoisted_4 = { for: "new-user-input" }; -const _hoisted_5 = { class: "flex w-full flex-col gap-2" }; -const _hoisted_6 = { for: "existing-user-select" }; -const _hoisted_7 = { 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, [ - _cache[2] || (_cache[2] = createBaseVNode("h1", { class: "my-2.5 mb-7 font-normal" }, "ComfyUI", -1)), - createBaseVNode("div", _hoisted_2, [ - createBaseVNode("div", _hoisted_3, [ - createBaseVNode("label", _hoisted_4, 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_5, [ - createBaseVNode("label", _hoisted_6, 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_7, [ - createVNode(unref(script$4), { - label: _ctx.$t("userSelect.next"), - onClick: login - }, null, 8, ["label"]) - ]) - ]) - ]) - ]), - _: 1 - }); - }; - } -}); -export { - _sfc_main as default -}; -//# sourceMappingURL=UserSelectView-C703HOyO.js.map diff --git a/web/assets/WelcomeView-Brz3-luE.css b/web/assets/WelcomeView-Brz3-luE.css deleted file mode 100644 index 522f34388..000000000 --- a/web/assets/WelcomeView-Brz3-luE.css +++ /dev/null @@ -1,36 +0,0 @@ - -.animated-gradient-text[data-v-7dfaf74c] { - font-weight: 700; - font-size: clamp(2rem, 8vw, 4rem); - background: linear-gradient(to right, #12c2e9, #c471ed, #f64f59, #12c2e9); - background-size: 300% auto; - background-clip: text; - -webkit-background-clip: text; - -webkit-text-fill-color: transparent; - animation: gradient-7dfaf74c 8s linear infinite; -} -.text-glow[data-v-7dfaf74c] { - filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3)); -} -@keyframes gradient-7dfaf74c { -0% { - background-position: 0% center; -} -100% { - background-position: 300% center; -} -} -.fade-in-up[data-v-7dfaf74c] { - animation: fadeInUp-7dfaf74c 1.5s ease-out; - animation-fill-mode: both; -} -@keyframes fadeInUp-7dfaf74c { -0% { - opacity: 0; - transform: translateY(20px); -} -100% { - opacity: 1; - transform: translateY(0); -} -} diff --git a/web/assets/WelcomeView-DIFvbWc2.js b/web/assets/WelcomeView-DIFvbWc2.js deleted file mode 100644 index 93c670199..000000000 --- a/web/assets/WelcomeView-DIFvbWc2.js +++ /dev/null @@ -1,39 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { d as defineComponent, bi as useRouter, o as openBlock, y as createBlock, z as withCtx, m as createBaseVNode, E as toDisplayString, k as createVNode, j as unref, l as script, _ as _export_sfc } from "./index-Bv0b06LE.js"; -import { _ as _sfc_main$1 } from "./BaseViewTemplate-BTbuZf5t.js"; -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-DIFvbWc2.js.map diff --git a/web/assets/images/Git-Logo-White.svg b/web/assets/images/Git-Logo-White.svg deleted file mode 100644 index f2961b944..000000000 --- a/web/assets/images/Git-Logo-White.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/web/assets/images/apple-mps-logo.png b/web/assets/images/apple-mps-logo.png deleted file mode 100644 index 261edbfd638fd82bc7e0971b528a01d91f800179..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 67332 zcmV)sK$yRYP)EX>4Tx04R}tkv&MmKpe$iQ$^8A2Rn#5WT;LSK}8%(6^me@v=v%)FuC*#nlvOS zE{=k0!NHHks)LKOt`4q(Aou~|?BJy6A|?JWDYS_3;J6>}?mh0_0Yam~RI@7zsG4P@ z;xRFsTNQg=5kNnJ7{R2(Og)ia%)oPe-NVP%y9m$nKKJJsQ1T`Nd?Im_>4rtTK|H%@ z>74h8L#!kz#OK5l23?T&k?XR{Z=8z`3p_JqWK#3QA!4!E!Ey()lA#jM5Qi02qkJLj zvch?bvs$UK);;+P19@#F&2^fih+_!}Bq2gZ4P{hdAwsK0iis5M$2|PQjz38*nOtQs zax9<<6_Voz|AXJ%nuX~pHz^PUx?gPjV+`oo1)6o+{yw(t<_X|`2ClTWzuExiK1r{) zweS%T+y*YL+nT%wT zj29_;-Q(T8oxS~grq$mM)qrx&w|rCq0000PbVXQnLvL+uWo~o;Lvm$dbY)~9cWHEJ zAV*0}P*;Ht7XSbt07*naRCwB~y=$*!*>#>b=UV%6&Z(-tve|65NKuqTQ`DvH1VMlV z28wG@nZnv$qaU3_B&1^QSwGPA3_kGuOlgVTp$JW{~471s+ zwYJ@E`@S!w^nE{$V=1N98W$YLvDO+NsI`_-x~?0?aktyWSD&7q^7+J z-;MPdh9NEuRlCtu_9Yzr@AkMZ^sc!w|O}j}xDa)rd!6DdIlkf8!bB?eBKG zc&@nl*i`;}yw>=q-EPMx<0o;?{8QX#d};hV-tTU=^FOuLVh_ZAj^~Q|8OJf6k&DD{ z#n*LR7dI2n$eqWfV$I_s?EKh)o6RO}kFR6V;*;?R@e+5t-E217Y&P+(CzA;~Esjsz zOx)FEGKm#qO=_)iJmWL$kT{R=XmQPWcazCvy>-9SBA^va-<4fb5hH>coKEA!%Y&P6ztnz$5 zpH8RoB(>JCee3l)4mS3SN3FGPHk(+uVHkKq7Gk^I&StZCw)jA7IPN=MSXi|9-7uyc z`}j%xkX^``j03h@E>BKQ;&skuGxl+;MSMkkY1ehD)e18mZ!vCQGMU6}gmsQb3lp%} zY+}jc&7GW__>i!_!x`{s@fV(s-5+)qpTSSUuf+Pqd04Gh;c{ZZSz%lPU&juP-4@HT z*=#nOO?*CHLA<;8U(6iO5@#&7TGw@KgRbi_bMg7z;ZOWu9?hz7)F@?-y6ZD~n@QO6lM8p7*c|V}0Yq#)k;&;;78$a~1;kLYPxZ zA$*ulryQ+#0XV(sbjl0BV@DVj4lSc4Kp2YA|l_o;dq2_K|F8VaNHhyIv$*N93Pv_X3OO=ZY=gw{DlXM z8;kD>>ltsZ*4o<03dCc^*Rki~!|VVyM0fZTy8#R3tsJYzU9mA7{$OF_IyP`NXNUj0 zf4Q*^>;Y^FmL>j)XXlCV)#Krh;~>rwOU>B`6OYTmti*edsEYH(hK%zcs}$=W>%*0K zn{h5M&~Y^%0sk(~9@i&CC3T3O$ExmjyHe_8(i2*8OT7BnNSL|!OT1;i%VvoC;rzx= z;yCcJIQ#JvK7)QbP7q`NDBEaF5@M1{5 zVuAKXy6@wwF%#42ln6Xh&RB(bJ!BB12C)#hyRdX|LL#OkV&`|`FX3b3=E+LpPL54a z{5-xiZZ(pTZ~$B(LgQHEcww>iW6wE7t+im$ux0FQA6L7?cyV4~3>LATlUx>x3?&}t zIKsjYaj@B@UDvgC<U=ao5 zDKRuQzGUcOCbrvc{3Px?E*nuB2it)^%L4KczY-yQTKRY*VQ|?P*gotyt_!b_?jLj_ zzS=J?_DOs@FNk9sD-(Ob84Q+=r(-Mf?Yu9aHI|(?6sPDQIz`h4g}_YMc*LPxD$Exy z)*)*Dp7*@Rs~MIHKn=sZUa!y2&e;7Jk$BmJcpQdt9K$HYsb=4>BHT^vnE8Aj#@NAj ztSo!W28bu@x^A&poSvS>&w;(-3iJ6qc42%MrWxZK*AGhJKb?}yzTophn4op0P^NVImkQN`y3HM1$_isa%QgQ>h_!!JC&k~WlVPf8RSpV3c>=}$;tW4~y z*nWUBr0^^P*=2x1v3bI+vMhv4Kxr%vd%z(o3*}UXxH~rRF=#d9yyFSL8T$W__|1e!)Ib9Sf9WIqZ|Yn$7Z7V zL$V*=PB=`~iB}951vr`LChl#s*~F?EG>DJIi;IN~ix9>=zKbh>reO{U%#FPo5X5Wh zAnk1F_+RqwcyPzFI7R2+u^Tb#ai4L+MzRSX=JR>@u&_<>iv)B;2RJq$o!Bh^)0l7P zJtrq8o6RQRe4_Gre9$*1_(btGYP;PoP+;(^`1L@{V{PLw6MGsQ_w}(Xf!?r%IIS#> zA#xeYy|Ew=GYAWm#zkUHa8AdC5qneKX)H4Mn6rUE$&)8wW2C$lGmR;XZ;!J>{JS^S zzw#@;0z5$+jsuUcU#(VA8Q~qf@Jg_Q--sL9ZnrmY-b_v`jJ075;}}I1HUT!m02x0S$FYC!@2DY`kqnN#!9|ElVu>iV^SXI2 z_*!H9VeeQa4u4o-ay>r_;k;|vu0J~NBX@R8=kO;b&g^!tmD59j0wPBqid!WL;qyd% zq^|6@unhbwyFFG92n!d&#sF4J=`Eg^6>$FKD>xD4C`I@}F5Lgxul*V+w2v#^%)ptq zHMl9}BThAiIgSeG0Qe5Ivxr*5(xu`z*bvErgWh=H^?E&@&tnIG&BZUqqO(QV6J*xp z+V(b%Ln8?d)5&h|$&Xjdapi=ErGq^Xw@11W=4Q28Mcv(2n_SN+BuD)K4;3#?cz#e7 zrxK=^1T+I3hdPYGJ|5qIv9BDa#IT(MXZuJ@10PFKcDx89_n2e0qJN(7bz%w*Dla8m zh~ZSM32>glFCLSy9pmdd1Gf=B^gZ~WB5I3Jz`+igHFhmwc_i`<^KA&o7CCpu!U*>g zYV1TUZqmgiTZ(X;iPZ#J1xC;P8~ZaZ=AFZP3^E2u4`@UDN*q=Hocx-<6V@4)b!Zya zIKf_%p7Yhb8b`9&LDDP!FNqlUW-g8yQT&P_DgqgHvOkO!F!{r*I!t-IR(P7!D6p6T zD)FM7eiCT#;4VQL)C2IkUY6~dyh%|`I8uegfGOSu6mS1YleUOg2~bVrh%}$JW5F8YezWCRuY3z2pFq#C9#ECpkglQ4v zLcNB3V+Rlh6r9Ceq4?hEbh=utVCuw|a{gIimqDr3973>3*vD8mNThLNQ0hqJVaY@w z9QVelaJ2#K6`J0BK94nb+T}eXTq$Kr z1KaV)Dd*xQiB(~%#JdA@4&obLB%ECA5ZJJB&Dg7PwZ&o)FD159ICY13;6H4qh)Hp@ z&WGZ64~YAIF&%O9bhi7vVvd8qk(w{C8fCFKiP&h005(kI9{|3XMFJFp>o`Q_+!$hm zXyHZ!!=3&~Vkwc5n+G0%$=`Eq8$QCC(cY@|a;{FPJQhW=%$aq)> z=Iix(wOR#F0+W$2KHeHu)v2E&eZOUj52RNvaQRtC(&PNoh{6UYWsVzw(gp7lGhur{ zH_mFcN+y-sMZAKrbR>^q%>x?+(&_s?kcu$e?214|Ox$&c29yTdJ95la+)L>jrrBky zSQ!`7cS(lV~B_>X!u8s{U5g4X1Knq0< zHawwIB(Q*G$qrJ=h$w^g0%s+0FyccUApChSk0LUPZ>QSru*k9JcDs$3j%1ml64^S1 z9U!v^pu9gE@HEg{%hAK}w4GS0Ijf-Lamop(i2^ zwIhyk9MQOr@hRd^7bs%4kgUXNM6JxBvFiygQW>};5iuLXY-hvkP-nO?(>RE=*{dLK z+)3gy^B3YuGlY4HICOSqMy|~nO8eiLtO?SvTqz;+?|Rp}%+Lb|r3h=LYboA>8XR}$nZy!J2i~Ska4WnR?j$0-1NtoAht6XY_V6(Ez`H8M#uJ!2mqs& zxCFj9hsdQE7akLJ4jXE)n4c3mfzc;obMh0kkVApMJ;#wxa0;=1LaS5PyrceD0ia0$ z@!0cMg}X4Q*agfS#)a_51s8lQHV*HKS269Dg$AW^cN(SUo7g@tN=juzc}p244wVTD7Tl z1d`?c4G=wS9C^2^5cnRN6ywFk+J<9xsB4_TypvcNte#st<3Pq@#)sGIHOD(P!*aPK zd8E%gA^_-YSeZC=u_fZ|)Aelq1;eJG@=hMH6vT#flF(gmj&zcQz|4`_LoFm&c4awL zb%?Mq+=<@oj2>j)6%QIAoK8gqKmeZDFp%a54^3eKe&L@`I`G@KaqHjx?srp`0-lTW z83CHNqjLn(K-^$NF3>4VzfKYW5hz7iWc>zSHsLpWl*Tph>BPl@8B0JK&k3)`jv_X6 zaHHr7W93bb0Usfj=D@f;-gJK#+FkUZIvG|GE)L9Lv;5sr%bTS< zNAZCGguPOM|gH|_`kp-!18h#R+rwZTe;1u&?`9lGa=pZ9$qew-EV z+*$#fIg%hQO>YCGRU}pb&LM3(Wk`{W1&(kXaAN630K(&NT0S8>bI>)g?ifv8KRX8a zjMYprnlYNVPEcp!KG`2;a?*W;b^y(@E>y+q2QCfen9whA=HkrGei97cnPA^fXiy8c z;f~8FfH;Py!WfD3$;pYk#Nt=nNSK(z)Mwp9g~uZ3aHBr94|o(J5uuz3%x0OzVQ_an zaY1}Fpr=74AVR*^GzbG^?)e|b20h3vhAFg(AewTG3l|Y#MTmeYArGK46xb)K6Dc^r z%3I(IF*IyM-**;(fI&h}E(NI6V4Iq>Tn!_6a)3!ZmAsuX*$9I;5pIknQE-!$4gBnH4z~KIyY2fJ#htb589M_R4AlPupLf*qu~r0EJC4hHF5KVd!z1cHWZhel!cD1f2#e(aRunGTAyuk0$IqLlA2RF z`okAlCB@F)JzEY!ja5U$gJ6gi!zJVY`@VBDXTH9He{0gk8!?OXz*_HzVWh#)a)gL? z#RVgiuyu~8!VivX@B7Ix?0h;b4IDaZ;i3JB(}So%sOZ?< z1@a)xg<}uZCj47$;)we!Z|QDdr`3c=mS%A<8{Zq|*jj#cl{zMhVC~?UEB#@v{U>gH zDv&w)j?jjb%3Z7OrXV!43KOs1SH|~JYEMN{0GCvka7!XgF%A_GDDTTrp(8ttntRbm z1&o)u(E^+6pwi_vB5qhO0D@dC_DrCbkxl|`+S|FEmYo2j9iji(C|_>ZS5rJSFiC(sJfkvQ-X=n)Cp7?~HH6u7u& zd?PJiK-c62mc8S^SeqesZJ5->ViC4JUSR~Gt~ofu=MWP3kg&(U1_3Zp0no*wv=^#e z>=jrMycF~!ZR?L63`WQ8{pQ4)4NDFZkuvWNQZ5jo9jy1IsV%hDrWQ1gkehJK3XHWv z|B_tEjpgxSGg0E_EMRKfb|bdC*{}`)cUrRtjDNjeht>e4d=96<-zes;Rx5jS4mK27 zQzK#LMVSkBktvY4XC!v`MwBMtP7s9=iO>0d4VD{0x1PSe)ODG^YJ@&z7;d4XTtJSJN|vdmgows2|5!RZ%p6)_ z?q*E@Kh;?4GrH8~dvH4)Md!_C8+s6?2U|kX!7L@_V-M#BehXE=UIO89YMgAnY3hmf zLJtPVpAGDO(9~ERXUd7%_X`*kd)%xB3npJR{=2RWsn7Xv+*X9#_J>wO4jM;T3W6!u zo-TZ{I0DPSks)Me?7L6tiUz|kM8WWK`U0hsH$Dnh`wiWSC5{`q@oh4S9 z=~)CWRv~hc2L`@X65O=lyb`eAwOyllNt**N$ZN8$IB$(K#gZcC$rG3pV-npT13?^T zcS)IUy$`hC{qA=I1o9dTH<(Xk@q+|uS$QJeF4ajl%(||O_(7_36DTF_z6IZzTH@*f z!*RmdT1*Y(2>grd(`Z3bX(b7)Vb~hWBBJDjA2a?%-Vj-P&URK9P3A!4>27+f2D&hRm}!!%Npo0R6Q-DcmCTC&iAKn9skV-B#VSa?oF7^5hL z()Sm!80%=`9UNowWllaBp9#H;P>M%(|E86!tRz9Fgq1uZ!*vA%3vS&AtA_AljI6ffQB2U?+_14`jdpu|Y zo^V9dWDJmU4c@y(&sV^=a)NIcW$R{kI-CqLK3!p~wK%A8TfQr7CJ)(&9|#O%3W7|d zi)hY;QPbufdOL=28H6;}8snI%ly`HifGn)VV6@H}Q>i9k;W@X9c~`jdYZ<7-x$`o* zB{VhLr0PdPx_EKssAIJ}({4Y5B60WGQr5QtCQmI;NfO#fJOwgNwROjwr~>hrK^|Ly z5XSlkwbtlG4KopS59@|f4v&LmG9a2xREKG1z?z5QaCrztW!|XUkJ*B7=u?7eJ81A8 z76>^DrDr}vs~ONT`xu6o1wQ@lyWQ59-ElXoC*yfwmGw9=SaAp=7y%~=%+$6fQH5Po zBNj-cVrQNHjAvb1C^%I``8#YlG-XW|p)1i94C8v@a9nYNtcd5>&AoJVbhs%9yuv`0 ze;qzb1SxJ0H-_kT~k)w)*9J{gDkgLQP{N%0pCK#<{it%uyC;p9cIxcvP+8V zV?W2YbFK}Egwut4i<2gbN^J$!G{&IYThvd+cXP!F;Y|nkThsk>G z5LrmX@Ec%HQH6vT%7&(wiy#Q2j7@al2`cHJ*YOJ--82K(-$pj!(W@TlN&Fn+!K|}_ zyq#GroCn)JTe?&*B3)&Yp_SR`jsp0I43}DsgMx!zLzm`$CBhvL0Ue_b8!c(aoXIre z%ht{FZtR~d4r(|ljk6$ibp_LW03tXtWs`wT8%$03j%_(Ap84rS&l;kh9%*dI&7`hf z+H-rH7_bk(Jl!>v1xyV|@5ow;wjdssU^N5)DA%Ao*(zZR^bRD=dF#5awnqEXbZ-$;rHTz2w+Uu-Nh z@T>LYGi>7LNdVh zxn+u=*rHu@To5k@#vj#i+zcKS$K^o>=EoDHTWc3`wdogT53E)zK0td6BF|*UTsd}v zWlJcbM2u-mN4k`TQ6=M>q?RIhWHT(6OZR~S^Bd^2#UaIp2ZL{L`vIk-)G+U4Khk+P zq|k#vA+R{K@ey%vw_Cg*T9}5&qfjyuy`u%_uS9wGc+AP;N?J|7$x4+CKh zW9bk^v%Crst`&)sT8ta`lG2>%DSVM7P7O4B96KjB-d&tfcig8DnnsW@=y(gt?pHl$ z*z%AAF%LUllEXb}YOp;#suthwIrdh0qqWOC2~wNIVi6A?rCaP&SQCn0L^|&E0fCOX z1T513NnVh%FqzEjp+b3P5cTZxPPwdVC^9NmNvSfvIhnThlX)Ef6 zQKNA8s0mPsxr>CdE8nY5qXuX*R1ykDNsa(%J&cc$~yGJ9Vqvt?-xm@dkc_~A(hNuUO^uO>6zYrmGaLvrccmF2* zH5eYT`W9$&a-POw9t(U@Axg7ZfgY&;a(a39%$G2QhvYO#Ji3F2qCprz3eDs%&H>|F zVuQLx7emZ)C-G?a_oQS5c-TK$GQG%eJ3l*(f49`bW_J2 zVWs(bR_IFOWs>$+8hMVPLF?Pb(OrG49zWb}cMt5uz=}b>Nn^7uNJUQV-V%0*x#&qj zk65IC$2;EP9b-=dhGIn;w~Ge7;;RyRHjeCXXpFV2>S4RJ%YG0Z`ZL_37y;nTu7+6T0t1&ZbXlE7XgD zQ0chFeck@f3$H&tU5(p|)%s+9vK@BQ$)tAOX1noZPf6)Di$|s@$c*fXu6}|AQ#!1a z=k{0+b;L*|)8;Bi8cE^U)03XeJ2BFny1N`gB9~wWC{dnyv*g7|UD-l!$$49r(tMXx zaiW|Jeau9nzVC-&oKCOgJUtT79aJu+C4|n_)>TBK{uZQzgBFTyY1SIBM$#_DMS-9h ztVe{-PjO5LC--#EyJ;wCtdG0Jv6TSUX;g(RauOBx=u3}|*rPyEja{u)HpXf@-=MN< zh7N3xxE#Pl%C4ESmFg@>%E_bzC%>NS8Wt+dD^M2`!g!s>TfuUB$BrvaceR33+(}qZ zG#4pm+wd{X$e3%aHh?B#ENb+hZn z+Rvx8)?qhvlkRv6Mr7xLwJA=NL;}75YCr-gY2GF65XV_5Rrfe9!abS+O!P}-2dl88 zoXd@?X-KvOI}N&H->naB?z$Uq4FzEFX=k>^uOm}Z3M>UVo!bV6VJPJ)MlMUApxa)e@C7TPO93 zSq&x4_VgUlG}G>?fc}nmyd!M?>FFscqzA8=;_Pl&TCdXlA&+51>jKYjW+v$d4HAUq z2%NB!Qi~OSj9c{#MrR5h|9*0Ea(Q_fI69{tYIH)iV9%u~-4Nf>Om$1=}I17V>epY12puYL1tkA430Kk~l!-hblp7w2d5`N`N?*VQ&&l_N+}YOR~i z8lg(aiQv|!r>8DVxw>s-b{8lpADMH0tYVf@AydASvWU}pdt>L(hZwVq1|P$VR)3U0 zz%^EiyJFmxVUI|lt$}teX1RH;6V}0P5*{y$9(AfSS{UY-!cFPPPzi}tqL^4MjTFIi zczJL$x}qzGwz;GfO*Z36x49vFb9I7(vP-UvF|a0na#x(AG$5RH zqYm!qevjFuf%ahwf~xAV;Y?7cyC{t~iiR+F>OnTf=n%oBK{Ez=cuDDH`xrYwz#y{K z*zxXCMwbE^57HUHGM_+WIe^2eNc6*?np5=Gg-`} z^}?ny#7Sh}u6|pLhMx-Y#UZa)?B)I}r;&dg7lUs9*vs#5X zKIzFap04Hvve2f-N`#yVb|HQ%bdylIVk27i%cUadWl*TvIvDKk=U3=utb3gUb z_no|S=arZ5EG`$T<)XA<9Cuy4HZ6M`%XB)MOlHH-Hk(~*bv{3x&rbv6k0&+v-TZ?n zeFmrpQ6rIZ49SuAg=cmpfjHV-Q&yT}|0LAO8#;|uS2aiO)sTK1y^dQi{>1|c9i~OiU4(d8s^;z9-E)bx}56vY7eFLK0)b+=#O6q*y*~f z)-DgN=TcS^p*5Z(!=Otxw#~wEK@2p&LoAPl5p5g^7-Pk*Pa}!HRMXwkd$E@adRb>G z8PF2P*yx5k2h;3V^Zj6f!8oCwKq!}b*9~mBjUoOLcpOz!EDl^ed>V9c3^A!qB(NSF zgOZx1>p3BbyNE(upa84Gniu0b2wQPJ)G*&2TrR-JbT~w8s@#Laq3HLr9Jws z&%f=H9~#bIxqt8eYPnpm*W1m8X3zLbDW$a%>lTEPQpz|E2sfcz#HL46%QA()YUz!; zCBuS_hW1=<z&8!O4Wo?EiyQR`tO6?W_%Y9&fYL#XM&h6PVGZ!p z@#30^+tKNjMz)JAEX*0{Gh;%DU#Xhn2A)5WF*sWmwvP zK!H)E_+vMo0~%m(0nJ?kw$31ACX2fnk~5ZltP*OG4pfWjcY?#rt~kzz(hNdN%sQ;$ zXr!#xGi?nDB~46Tkk>6yn#?V67k?MirkxL?)Wix>2k>M@#Y3_36a(A|iH zNN&0Y81iHT4}3`->>wbF#RWKsh$g~A*M^uJ#)3wk8wF?&-(cTITbPp$N6XF>7_^uM z%B6;16j{(-zH#G5tXpt&A`ruqm(tpSy;oalW9!D<8=w8-H+=b1tBd=0@7~>Pw!?0> zSS*a($5aiHL`HKV5tv#d5?zM+3C7DBb4Cf=Qszz@kDBvdw`8U#az&(Ly#p&#m}26y zLBP)R%Y6y^AZcS8iUCbT=-3#MH?bQTn&XlsXbE6B1`gQ>iwn5N0A>$%!Sq*nU8H^% zWx?!*d%(m~_#%IT_lwSgd)geRLOG&h%MeaNgjBSo{fX-syKv)|#qywAU{77zN^>CH zbl|wswOXJRtFR==i7U*`P+F=drYRVBY?j^+Y!$GCqnQ%v!M#{zEFfS%t_k9j1+`6c zjieH{;F3-1{o?O&0EiS^6i>6zBb;``Yo(P^N}KMsZ~O3vUiY=HEf%Z$_s$o~WjyBP_%Qt8NW z17HH}@&Wb;D720}5S>VhtS8MPcp&)YwAU>}uJBs$!$cGB*fckukAZJc;9@E0uVC*% zZKG+&g3qvvd3S_4cqw;5kf70$NDCB$4LIjiZ(-+Cc>Sp}wq@SoyvX&D6 zm6P@AXFl?Qo8Nuz-n~2Li_7(Tb@%RFj2CToW(c#M#%EnJM)#aXIsj$@dC%)I?PJ?wPS`Fp%Xcz;Y#VNK|*)wm^|$64&(JnTfqv($9-U)Qu08Wahmp3O6kHgB&KCbvrYE#D~z}6EZT~}7FBon zY9g^SdB_~R_-IF`i0Pi8_}z#{fHnhKW>Y%+bfiW_i3oyQvXr(NM$Ad^m>4PmoINfG zh#Ss>AQz%Z3R@DPFZg#jC54?tPC+h~SiHo%A*^ z1Vjfs%bC!_lD{tbJB9T2!bqh-?(x)scXa#OGWx}_>o9XP^I7%RF*}nez|`YOm&;|$ zaEJ;iI->y1AQg$Y5b%h{f!Ye-$*h9MKmyNvv5LK=^gzJfG3lzSN2Ze7CWMq0X{h^D zJd(x?IH1Si;R};E{_$+4;AT29B@D6&bC0P9CtCYHb)MNx!t;e;ZVETfJMFHt4#qNoZDA(x{}xtGtP7$?mkSKF@|=uB@f2}7-d)H?p#(o1n;%BB$P_UHjN#i(i%3)Z7QD2VSZWkoM8T#12B$b z*p_{H;+iyBD`ofacfav-AOC2(^YUV~*lf1z^=iA>tX3*8B%z@h0M-?xOKy3p@o;q3(|M#XLRR5^IMW^--6yGS&ky0Nr_LpG#o&cLxfrwU|{#dFd43m1Ex-^<6e&zJ^)Ug%$soU4xPi{HoG>sU#iLpp> z8LGF$5eA{t&?6gPsB?hOQMG`=Vx6^!>1wUfZ|erQEA`6S)mmFADa0GPv9|IfU;5O~ ze)`$X-P?C=zjXKf{$g>-2cyjvqcfXLj~hi1?*s2hf;a36peu{Kh8+nGqm|rU-ymNG zSct-|MFa@hr~`6ApK7N3#Ot#Rq6MJH<~Z|VcTkRrPli_jRLA0htl>IW&%N+ z$+vDk^Ylw|S1GIkT~SLRqzx~N`{AF=;-X3b6^_)wv&=Cucx6|65#Y0IjHws?MweDy z1x~i!qa8Uxq|9I=4&>buj-BY^j@{_Ssndr~3i6O3i!*IYI-7r}mp z;Ke{SuNE{HOA1{sXcmZc!Z^V@5t*mXuml+K6cG}px#f(Sb?)i(BwC##a*V%IUGZ&r zp$sHhGNjhJSS&(uz!TR@BVuA15emvwJ{y#eZ-4K_C!T-)iEnc&iu^fsa0*ql4EaXD$8nHvYG!c$q|cw74$;1$Q_WDU_x&;Mk{TC>;uC;N2@ zQ(;>n9=UCcaS$#U2T)@bGPico6lA@4PoKc7;De9bT8vj115HC+kHv@0sCPLo&8RU@ z=79=q4+;h>uWQ6a5*7$>!WkR18>L)m)p}!GC<(an%5?> zTY?cE;;GLR;8C`5C#;iGI3oBE&)|S$6i(g zV;UKjj@fz`abEDD!EoI88x@j%*Hkl9I+y3}tumAct*XQSp^Yhk*s2#7@>p2xMrpNiF25!^h(gecClYU}^EHhLw_83RyUtt^*To_gN?@u9AEp#IFaeKql;;s@*kiZ;;bDM9dCnLN zWW<3Kj8X&DHzIKAt!|pLsBb`KaW)VF!2Noa!FtJm<1dUHqVFv={jgU^=Rxk=IGhH{ zf(PGz@ukPV``yRC{>1}yx8L4lExWF^+G;D)-QtlKUVib(C+|&fl)iRdKMuReWHO)4 zrCokCr8m*6EX>Jc`V6?|(G$l3wuw6&GMG>2vzo*a9FD;h!6jJ7G<5|fXxuz1)0>iP zLF$?JKm&B&tY&O`$Gc8Fk+D^n9Fk-pXumlaqn0L4IBclg+u*e+7#1q80CsoIkqMCQ<=3=*jvMbQpbhCu(?-q2i)JoEe zzfyC;+?sZq1~poj!luyBX;es$r_CQn_*g>*$`N5X!L*DxvI?ksrVtWGVIe@v7D0Zd zpn+M(j9!1!BlIN*fbgdP0V8X6{d=)kL{Zg>r_ql=+ztpG0T*1VG(KE1aCJ7Db(2YH zsX$R{Dg9V#E2Xquot(b%y=Ol0M>p=ic>nJGJGbw&ajd)24tvqnfOx3bE}J z8}S$Utfv|hA2Gzo{p9gsCImT?a>dYNfM&COJQ!_~o6QDRpzE-PS)59PoPgxwjd=Tq zKKTv^4|wZ1#pCCeGhz4A>=BmElhJ8NKn*GB1H&vKm~fo|UJJ+5^STUXd4!A0-%ipY zSNP}0(;9=y?qX}oh|_LKJ#(B;b_{CaBpSmyw=OMTK!_Nh*uS@5#VLiNuB!;;t^FvNLZt8(^486WsBNs>Dt)0 z@rmcY@za0u;d1ZA#pd#SdA``Jw!6XY+=K(b;i<0>2McWoikxA4egc$kD)Ix15=p~` zJ7FHKX@KaY53!4A zFQZ-0xr^21ppRI$&Xiy)dpqNS@Zk*ZSe=-??WRxD>r&$c5phcF()=(0WrV@uz*pu~}?)>qB^ctz#TfYTDz^ zHs@})J3l{nvjpdgfeEO}Hcp2R#wEiOP7woPUD9_lpO%si zn1E|LsTAWnuhV&pS-E8`HR_q#;$aTBe-~}7MrUN-GWR}T?iaSyQW_2HX|VPyR-H&0 zu9J6z48%-e9o9zeEZt|CNE%*Al4#v7qlO&sL_l|4HBey_f&dYCkyg<48E`Lc|0i}23GwIy) z74O==tuk5RnFApZ$&&P%4ool%bT2m#iRfNLTa<+?kQLq@hfqb-7=9P$0SCAZE=^nZDksx zfs9QW?rPGa8K8;EW5V+l7UV&H2GmI7J%G}tgh@{BfjyonV~uj_Pq}u^$R#?oPz*I^ z8hW!O^Gv>t3~{koxE+eVh%~R-bw(RsjzPdT;C&3rqm7vv)vQd+--<3GXR`5&9>GB( zfFf9$)ES17;T!AqdeTp(^I1Qel~T+1Gj^?%7U*2-O6hmYxBSV6-t_Ojb$_vV<=(yZ zt7r!Eb!q*w9AiQ$3H1jLT1Wi))a76-L;W+%NWh{)}yGb==&z`{GZ3=mR(I zynKGKy?1eOad~e%#Lm3IQcB-a2qL52OCBG=C_=XYq4X6=ceJS_h1*0Q3%3{V zE6@WsS{d*Pv0Qu-J2Me_Bb@iJCrh_NFaRu~YGLDRLHRUK%Vc0vV%?f*P>i^kkpNEj zV$JEA$GkdM;|RpZ45}t-h)GKiY-(bsCE=;-j_q2##TBPi?{XzNiB@z8j3@SUdd%fg zHyGFxv6bQ86w3LKxP8RK(jy8x9^K+%Jm(XP)5e9e03-lXPHSyy&cLbb$^3l_I;^l~QZzOMA_CzVUOP z_{i-1rN!lHx7sci%hF0K&A7=hjIEU%*V>4DSQ z*-V~#=VF4B=Tu$7{kqi=@hLP*EF_!w)*f@~G2=9=(qdw(YWxLf0*p;{f~pH{-~0(U z%qV|h`z*Q4S5U$xz#cYb%d`@iTAv(@%Dnm*$ra@SQ* zh42t~Dw2sW4OE&~1Rik^XEHe9f!Lx(0hR(1Vzu7X%|@gKzdg-laAAj;$Yw#tw&BR& zRFa|^!&}nCGG@I4i<`6&o6h2wRy?)@04nn))p8PD2e+;`A-R1X%~4db{Wu0aT+6l| zA2CznR42hG(*Uo;8Lj?K6`#tBp@F25oMat&yAW+Ky;K!Ek&E|~hQbkJTRMW88iYP` z%9-r|{sl!d_L-IG!UfUL&R%qL2$N_?VE`5*@l1nSBKI-87}p_~j|Y$LR0OOnAse^k z=|wRQH@GGj7Z;($bP&sI<*)pw?KM(r-zGoyr=R+<&;Lc+Zdd0Qmy63`yIZYRyJ6?r zzts$(hJY2|&v9cYSvfVzF9MPW7cc z$k8}AW(&d-;3$K9!^x9m{Z={)$+Lbg`2G9SyzV-Y4B^f$xI zI?1dyOiYgxp*rj_p6*mj%sY5s1YT*zBdHsa>@W;hgRdN7BsdoE#UZp==9pU)1Sl%G zfI`~)z=CnY_{p1`StQ6juoX{cioKOItkWp0>tjb6DLgOLz?^ICG<)zm*;@?ErqedA z5aB@375OKuGe9pmH=B&{fK*PRE>B6T^pM8ktAONN|X+M}PrdPlCHMVVrsE3{I}w6)EXpZSZYKlqV$ez{y+Y?sUB za`8aj8U(IEU5$#+dqBJ#A10!4p&67XoJx>AE&iHBYal8oJL_2)@vdRW1G!jnIxv0` z8pkY_WyHjz2ya@PlLPC&TJyp%w;2l-3QdjV5DW;E65Ypnu3KOEB&CT&h;txj0%O%5 zk9=|uqT^-b;5Oo(w{3T8hQKfkowGl~kU(tSrZngzrOz~xBq?zlbHTfY39tZcx^iNu zkV?3R(E@p3y6$aA8k5FlQp=Pprx2kZNRlKtrxZt6wX`z6?o*$6`cMC?-CLZ$a{vDQ`{x(ugyBSpcBob&u;iRo z>f-OtVmt#o);TsIRZ(VfxH#@&0-BFWTHWA!w2)(r@Y%+yte^p!#$_F3S=!UOu+$8b z8Yq8v*CWO^mB`c78xK?>VMoOtrUavQ+-;WnphM0lsZON1ajv0T?$lc=Y>qL9Wbtub z{LoG4mdU&7jZK1dY$KPS9i35ocGiQla^4D~-TM992g$43Ytj(VaJ86_m*X;)(4Z{#K zY7q*ZPA2uQW$bDxU5Sm{&hEbW*Z?PwascfY{wwq#m=8hro+&7 zyRqvgNy0vE#$yW1qH^oIJwzKzX{C+b*h*`4Y_aRw*t#<8Ui;yXz2-BY-fcIl&33mN zR;$f&vyBKZ$xNAl>k;t~>&PD|95IGMQV3Uiu5qfD%Oz&o(_}13O-o#S3?z;>p5zSR zj>IS38SOmDiK@pB1tJM!$%43Glor0`#2NCY_xX7EVXCgCXoE@=vzF|eK>#fp;-&=- zGQ4`|d)6-WK{i?1wF~zwaObi8JbxCId3XZUd^?Bb$QF4NRuHs@f5=_AhKLry(akEy4h;``uG3QV_*8>dbLbZc(zR@_ zwOBk1D9K^kF5~GFJZFo{1QM5JJt)KCbY|oQWy)mLBx35b#%de9GaQ^K(0EWNFIYNX z+3_zxo-s6XM>m-fgLhybE)TN_aYTOQOt_trOe4E51S;oLJB522c z8|O0P!Q{KBBv`{5t$o+afN8?X({~-DHfwyx=fl`xya*pqOrhAc+wD$IPca9W!o=-z zcM(*tz$h7>Kri&9@Bey{U5fJh)*k=NC*SDA07m+WOWDCG(X(EDQcW1ef;GL|}&VeH!c za`C43e)Q4jzuR`3?Q*?bFW2kUX1$+p&9GFrso9^A=lb9wW`PrpCnD#tL}&!m_LpP~ z;c_V5xc}c11&-%Juy0LvBRQb+jBaa}GTp9Vu{F>kKov76k}$d}klcpZ0yII<(U=-7 zTy3zRA?g_Bj(7vOxMAnvp$jP`vXQcBvXYxQhDk5a@usK5JV2?!afgXKP9)P%TbfVV zOg_)-Gf3NpU0pmTtsp41BC(Zfc&RBucG72jG-)IdeDNmY0GJPDP5tC}@j{W1hCPCF z3rKYH=FRQlkHOS1mn8mdM~40oX2z8n05Y9UYuA+@Ir_d z_44vE?5|HI<(E_%Lbb*Fhi0JoOuT(IS zPyN9M<}bap+H97K#cH)0cVk2+smTwkXZpU0`)P0lF~|Xvxq<>+j5dAU6IXEdk!r9k zo>7(NF*+Ia;R+B9pxGPDH3X-zXjppkGC?R4RNTAbDxVRtRJu9tKeG+R#sTRVQcswp zJ)B#TtS)yvn1V3YY%|N!rBKoC%`U{Ku6^PD3Ve;bo#`T^M(&wL-pv%J%;dIJN_8I$ zM_A(UBuN?!?iM=P@)VwyH}PS$)RHGS)#mJ+Qg&U z$&^uxOf-eyK!jKu1w_j$)xT<^*kAR}Y_op)U;K-QzxU0vvy;ts!`N&Stia|t07<>l zjdAf(Ae}N;WABQ(TEYs|t|_uBbC_?3*t<^#>oA-+gh|l*M|t7*^|DE2UbU zA6Z?jo(b@9n8BI~*B51swCBKs9J^+phcN~qV8(0htTVMmk9K|#vJV>LK z3?b2Wc_GPRSs2~oxJXjFP>xc|A#l4Up5_dic}W(PN>pmXQXhG!tPW1GUrzaL<6z^a zwekcq7s`Ezygo_KslLJM~EOz76Gqc_&5%#2RY5Zlj6l)uoSM4#yZaH!yPk4ek>3F~l-T#!TLU zAjWiL_#xd#Hnfjyt|7&_P ztn(ht1hY>=iTJ;sV#nP(%Y%|?j-IWUZMIeUtqEf-=`>pe5~e3bn1Su3AtW*3&T6Qv zR|>nR8dEuC8)1|!HfOC<_e;?2AHTR*ER6J7-NF1xh;>x=si**%hZ1Uel`uOol3QQf zjc=9tHoloUN4qQ4??CM0$0|vs}r-#9mfE;-g1DjjP>H0 zt|YkNXsJg};j*k5;su^x!Qvo+W!fN6i5V?WCd{=YgLWm*p^#;ifTu{9Fc!8cHoj*6 z0X?}|%3lDc!AV_*bsFwMhux|>ZH_TJPxC?VkM!aY$28Y}kv_c=vx5?e&vX!HlC%ZR zh(a+FWNPq_+>;y!BmNjOK9+XDxnVm@cS0$|sTNO>SW)H^88c3r5Jdh22p+aXtC`Wm zG_S*Imx$t83l|fHn4L8X&1kv2yre$mx#O3Ym(+89SW8z+D`V?QEv415wC&jM9{bae z-+KT5_2{HKJ-M-1ElXGNbIC0c%0=*UdU_f?Z5B!)s%3uT6>?fiXb_C88_WK`Hr6)Q zabK($h8m4!!$Y6`%E9R1V(t|rz*gj0rozbyC zA)Xfp8;Jw&vt*{EF)2es>?N$BNo`4)o#l0Y2QA^4K4tN^)ZCd!D(3mS+ra{&X(o~L z9=NoOJmrjg>;ZqQ`Ih?p@rVhS^H4-Xbtam)0R~jv1|9gqb7}UZVv2@d1<&uWiM3R> zt)XRPlB`pbw>KI}ctuUaoO`zo`n|fp8r?*X5dqQ170`_c?J)ThQ=@IxA@P&cK)x|a z&^4SiYcX{Vdmf!7(IcSnkV!0WY+~HQtB|?2(v@1rR!iwytz+rOQfhnr_dkC2iI3bm zJ2^c)yMO;a?Yh=7apPcwa^Non$Ph%3>)7*7S}XgP`#@Fs0~~qPW>F`tJobq{d-T(v z+pah3?Pj;xj?4A1TsO59$C3t3DvAClgx+*Z!@*>TOvZ{&l2TBVchiCaGKZ+tA~9ru zo|ZOZzLLdMTn};f=f)M*AEK{E`M?!*C`1^6&@8bMd4t=W(ugu6TGpCOjaeqrCP|X8 z#ax+|`Sh^vR5KQAD8R!lBmSU&(XpXv8~fjNO~5009F$t)4D(5IJ83+@wi~UO!jq)B z-Rx$j(sAP<)`5sL>Eu9h!hyTMWRVhwcozG2OTUw4Qrgs{31aAivS&`x+6nhP-mBZ% z=#7nc85keMP?S6XCCw>)71G!`*4kPrVDd`syVh6Q1!wfzBG)5;w2 zPmapB+ig1@jFu(k!{pVy)$6*h^|STziGTgUhrjfl*?hj)ZqM)D-)^=B?~?Wjlb-zT z7Nmmd39Mst44xA-oel!TC`LJmMG_eKl-@Rof zV^L)AgjUP$x{hJiK?37a{nul&eUMW<&}B^1-(dVA|3#c(K`?~l%>nd0AS_Y>z6euN zgU40dY-+UN@ZLWq3fRVAh&OAHN_`eVEm#$1x+#Z!>#qG(S8hC838)9Grp@=snJV^_Mc zC_`7vSSI~sC~auFR@>Q~=lcKkpPbyk_>nifejIn3^?Gq}8O&{mX2Fj^-jzTP${``f z6^Xx;Mh(2Qu~hzRrAALKmhPa$SB6@K+MS$VJodidJ^RMDPbTx-uAQG>TwGjuASZGx zu|Lnw&J0m;DlF|q{S80uybLB#8aRc2O+b|iz;17HkY&Lbv*Z#f*Ak(}6bi>^RF=Wr z+#rM}aNO#_238t3(R9oykdd?F6GWJY5Y8(2Fi(rt94O*D;~ z3F#r~b@3Ti*lpvbl+)8wD{UAQH$~1PwOp%l@ey>Gq3qy1SkfqPrOB{#Pg>4^EuC0w zsc3Gy>0of*gLnwI9KqQZd!Uu|=3Mf2RCq|#28WH7|3ezq;94pV_#h`?6|y3FpB;R- zo@R)n^A(M(@%qj2aT1PyGY*vs{|}Ur@puROD>|#_wu9uwCtWZ>JJ5)xM-!xSl4o2x z2eF7=Y?_Fq>~&puG2z=@2q|qK`~Whd@(|ZYH_d23yln8M(3=f=7p9Zy@T*C$E43@# z(Av0f)*8n)4z0DANZab!AAg|ztKWI_^z=vH@FTn3dOVb0NyLDJoi33OxMA6Qz3;l( z)oAa3pw4KRwz1R<616gp?duy0x@ZD9^-I2Fh3kEYj9 zpl8n~%6b}1?AdkBCp<-f_}#rg3@mn6r4KDf#-X2OEWqh}Z}AowA8OQ+!bt2x6CvGY z#T~jwAoZN4s1rQVJX~k2?y)@>@dnUu8X0kh3BQiM)64^|08EU*y(R%q?Kbt_dPJ6? zIty*O3gcyRu6{i9+apvQRJ$l{kT~qA3!N@(x%vZ>-i2+?2eA2rD3eAmnHm<)71&K` zLqSx-$e^viXWG*{<=Hx^-O@wX0j*>DOuRy-+`c*mic-c>`r5V9YKc6u#>k3RYAIc9 z<@9&{+4ch;eB$AU9)JAt#d5V;t!R*{wL6w;x41l-wA8W>KtY6X!4|Bg9sZ-0;_$zR zagp)!+DhqKUs}ES+;^V(z@N19%Ud^Zt=F6FcDr7$!`_7(Lo@*;B8o_0L*{iFJn~LR z^CSbm16ii5>Csl+0I59c5y|j-F>T0;VG$htS>2w9%&qwFZyaVGD}`9H2rdqL*qjP8 znbQGD=$5NRKsT&U%?0|J6!%c-(Os#E4>=g>q(sjqM-651K1x=Jg`F5Y-wi@>C;XnWCYd-nuX(snfe)B#;t8s*-J;VpFpHzjURW;rV$7U?cx6txAGPU^oYle1|An-Qv+3E z+weyAw`43VY0O(wlV|gZC04Y;IL)Lar1PB)UNBMlS!>z zwsd=ITUx1CgDPri^-!g4S46xz?jHa6XCHs|bJIGUo}PyG-*&r=st)mfK&TGE5>YGO z2qg;`zZ7|i>!Ztp+KVNU&|yzYZ9x>s&&Q%~AVMA)0XGGLL42u+$EIYNj!Rl?We~lIPfkwe^ZCii$$=m`DYXNz zYpu%C?d!1RijQ)|%^PbOOC4J&rS5j?NB-#9$3FXwnXFbFJMkIi#N zLb$}db~|YsL{nQ`ys|Jvs&ys?JGlt0gziDKBlpZhuEw2P|03==8MV}gcwFK{ugH?) zCe0DkSW_?AN?R-IlDUkT$i1dm#Dg%ifq>WOp$WexfxGPMUr#ODR@2)z_9eL}+WpKL zH^P-<70jLS)M_`A#kUftc=c`Ct#jZChNmbwS5FlKV{HJXB(s+7K6V;(p<-cuOIB6I zW;yD_U(xxC$+m)^2hqaFL%_oos8}x2c)=#HHsqtU5 z#J1MPR>mSy@xjcEt+rOjQrcJ}2pvi(wV!M@kG$_=XJ7f|jhm;F)A?q#iujSq66Qk1 z_NLAQRufH!;6#>q;wdOAMaLEWEmqA9&orOU?Kp9PZrW#Dj+=Ah%0{m&9tHAcJ@6!+ zmL_3)u&VFF+Q_E6~71!LJMv!xK?hkO0x_9|GqgBC!& zis?!nOBo+5j?!9fZ5;aF{^xgo@AsZ~{B>`BrvOW%p2Bs}a-f&2fd4S4*k0&GxbPe*E+s&p&+Qp*o$#LJh-^ zM26XNSme}l^FXxD6arY^Hl22X#1XCun9ysH@nnKiUu_!RWWDty7wp)=;erVXHrYPc z4kXi5250(K_VwH)^e$aIO?jTf7tSCVu9?_L?$ogevU=1^95xxPB51X5xYCbFdZ8(A zciX>Jm3^;i@>8_egtt!}@+0fp>E|{e5G`h-x0??JjUZWdoFG?cMXqdxw+7D{x9;}jbAbbSVy%ja-Kkzc8 zmAcvekN;@-sZajco8SD@6R*8kEf?!mxjqM;P}-&Nc$W2gv)hG}D6`qL>$~e==AKK8 zA!~ahc)g9Ra+8F(ZGP|K@!$W``SUNn=AlP|q#fG#!7HL;*ORe8Lc&0k8^p1?E!G zmnmG<5hPOOlTJUq#2(QEj)p)2OAn+)EJi>}v+8lvqD`K~IgFi~yXP#P)_hdCq3D2=4ZrHE5X0G++DS70>Q!FxuhgwbfGU zP`aV^r!U-j?Dsx#^3vUhAAV#q>9^a>a=F4Mxv2<9-ryRp)TK!xL3^@P;&iX1)imwS z&F(_P*d-|-Md&YKoz2Q}Y9)oZYpR?nc1xNU)}HbVdv9isJWrFLkG0W!kRLb#&5Prl zIuRSkag12r;SM>h4WFHg({^hM9xTRH;hQ4W)#O7b#!1)39b>?;78G=BjO-=iGf7Fw znojOW^Yq+g*NmN!{M&lE*O!vem0)Bk3^B2~R+=%43$p#S8;H;>ERkIT&HQA$HsTmE zO5n^$WL`b#5-UUVpb44(9woa6^6AEXet6ZNFqUp;bu5R|*lHO|Yo(607S(x584g-d zftR(`)mBR>H(q}JrQiJfj^7+Kshqr5htxZ3phl)qiy?b%-0NdvZ+Z-__QY){SK{)~=S) zx6(iN!mamz?BsI!_#=;Wt!`Jl?Phx@tW|SGQ+^c2H}*EYE*?k*jzJNSi2_i`poM$B ziifoMOoe|%R4RTkem6#}UXlLQ6XFOU(7jacb=vO2h`UP3YNK5=DYkj`2v*6qCSihU zfO6M$<5+6#hoP0yjbjNT6Hz&y22gJt$F7@n-K4cL3@tvt+l?_U!Xl%d9F`_5r}8v@ z!UBBzkSiH`Eah=c*4lnn(X;k{n&*^sA0N0(ei^AqYS<#6Umnchf(xv!z#8CiC!PBf z%|0i=3=`u%S(jh1!l0I*Y^m+n=#|qM52i}W874H)Rf?`$-}mJQ2JPy7r-N~xY(WEEwPJq#fxLvqISDN%CLO)9eTDDM<8kt?y)<1w@x zV+K=tvU<|kJDx#`?MviP>#vdN!;m}SA~}_7>7Dg8VqEV z-El5#dx|8^+VJ^_x*U%X6?%^`q8gj>AZtt=@bdZtRV2ixi>hlFl&&0r{}x?4hj}++ zWQVeb2eL5=0$m+<(+|A=#oziTx6V#}?&qF~ZY{zStAUe!)3;b_?fN>K&-&@4T-Rl9 zSF?n|oVC#aW2=X<>_HHvt3w-WDZ@DKYH34zc6|IG}Hq+8MbMOdgc62QtxovTP1gCYuHo zTDaUe7g(nU1lJB8wM%5cuDf`&}H5JIr8^|K@tM|Y6l6;)DK=$ng_2Gve-mKT#&1St?u?d;+hJuJU zq-jjYgWh?M^vNb)?wJf=ZM219PdT6D%T7UGg z9~*a%??^L+p}r>OgFDsS%;#6 zrS_%N$!-|_!EfIFlTW<)&2N74bx$sq%VB7{-MHE8BDpc00w(!Bjh)T9t{=I*T3ajQ zfuPz-w8xf1jrc02gN)Kz4O=;mV`(+Oi%nODq4Yz&_5RPDef}%AZrptI(Z|-y)i@03 z))}$3j4O2ma~jenOsCy6at|FgmhTkDgJ_TENW^75A)ET9lepA3=?pqmAyQYRC)XG_ zN|l*7l7LihG;;OECJFI<4{5UzPl9ho#%QGRQ=6XQo;H*CRB9`!Umz*?UR9s44z8}^ zlasKrZ{4x9WqwnCzLPsZIybZ$WlQ0Y;~IYM;q#`v7{yE6JzG7u*(VbQmnsR{rXdo? zjA-k)xEg~_FH7f97_QGA?*`8(@zk^*CZ;>oDC&6VJhi2}&U$NfZjDtkBnM7hgj@Y) zbLa2=`sJ6u@>6ep+szxd?%utNFgGh~ImW~OsfTK8y;g6HibRdzF2ttxA}CieT}V*X zgIg-4b^TaN*Y%}#W3Am-#!||9JAeP@ZhZM$58b+P6a$^SY0n+gq}Bk z91nVWX3DH>L_B{waTgP$=r}xyP&xD^dQYVy&)zmi&*eN%FtE@u{XG~&M0k+3FdRwN z&zLKVn5GdQe?>l>5HZ`7Sgdkn>3kimVLg^nm&RN@dHMbefA7EEJpcSpz4fQ&v-xVZ zS}Yb;v9~PRA$RMhv#$32G3%w3Jx~|ryO8j_is_)*l@g%dQ0uO=T`9ZP4*Z2uTHAGH zez7_Ey=N!i`0itmJY4$;lfTn(N=%W&&UZ&AgUZ4qS{>K)I_opTL$a=%xvy58G7a8_ zfP5T~exMho(z)Mx?ML=tbKJ*wwA(?x$hhyB3|vIm>B zm*(7CmbUM`QUh5jZpeSolvxi4Ypu01|BJ6a_uu~yv)%HUzxm8=yB&7B=%z|SkB&Y2 zzOP+hlr@KK9h>#+_ORV`Yj|jGJ1|iWC}dYk?OJVJ9c!tzj-^d5mbc#fZ*G0>{!_1e zaypqT7mI)nH=9jFZL`@7G|fZ;k8wzEJYm+>!Z5KTH7c>gtsw6p(evhq;hK)O_YWgO zog;hhExyWaRgNtV);1!w1|279>mJK5r@0eEnsyAFtgB$^fJ>5(TSG7vOwvdlcgs4i zbgM}sW^ee!V%z*h(UHEwP!vllM<-~Gh=<@--Q{&-&} zoAq|P9g^$^L~$eE9v-%Z^3)KwNvk&KgG7PPh8nHxh;%e>5o!#Zx_kC-1 z9QVI93}dZ*t^H&&Bj8BWBeD2wV1`n1OR0ch>*ms^t9j~G?`rM)ep+h}AG6lJ>n8EP zT{nq)?)zzLHGVP-t?MRN?JthAoLJdTrQp^&4Tvd63(fO-!>> zas)@js}w6hthe_r4`!b{ zuo0pjLwG}N^*{bk?){hl)uzqH?=!&ls*j;PD1nt%>}$6UllXtW?_0m~|2+E0t-tZs zw=R~8^Ye30>aa9cZ0AzD>-CW1*=NOtzEi6R))(Qr2EmLnCOeCPi35C6?< zJHFxRr(+B4yNrdOcxF@LA*65<*gVv-bMoA~nr3IMy04OAc#p5;3Yuz{24ui!OX^9W{t5r$-6zRxa=H{Py0+k0*I=IuI!5}e^8?D3 z#-mtm!Z(nF$zT$BTz9f`Hjb`KxGcja@PM~#l;*PMjC5`6uA7Ik?*AJK;a-IvEGyW$ zu|D_gr~bdzfA^=}+GrZvV?y09A6VTUo;jpsQ}%Wad}Wb9bY+V*-~2(~z*#UG5t01F0KH$u3Ef z;0STm*5EM9*ELP!4CKyEY{`wl6OVam=3ui|344#TC0BuLm(ysW^wfZNsWAbt2%qFJ zW)`-)8j_6|XOhZG#6_0F^KRWWm4Lj2Y8{WZOKtyNVzPo*s1d=ZH#VplQ>I2!u?Fx9S4+`r_ zE49=*)bggE{K;?r?Z18dsW-OTYN-dB$6h~<%j}C72NvFy-P!BkwOY%x)Kbe>%51%U z`S1S5<-h&PTi*KCTMs=HEDEpZ-ofgOC0&9eKHa|Qt$BEMt7F3)iN*2~w9mi%WS+aMe!>CRq9Nm*W zMCBV2XY6U5b^7v{iR9Y;+_`8KE&Hl4=5a!iQ@z*iLdMx*3 zl3ilzxT}N~jufc5RIoR@#I*KZ?me~&F?~_#qWCl#<~=mWL*!CWW{2Y_+IgSHS}m=6P~aA!3@UWTfZV>fwClSsfAz~}Kl{vQ z|IUAUaduK#DW#9|KARu{>q~_A9~HB zkHuT~{|S53Sj(>KJaF%QraQfw>s7JHn&+8hv5J!L2Tz?|f&SM|Gi4c=g_W_nv95y@qdKY8RS!Sd$8pU|8BY9xUY1^S>^do>!0mH`o-?{^=D)bC3?k#{FDvVtzAx@8ny)5? z8ax-XzKnIZ8G9QfvymzU>5BI^)>0p0VvMj4H}6V=+u@q`KH7n4`k{ITrsx zmPd)O=5(9W`@!hiOo_AollhlkdTC>Q;UBv4+#`>yd!MB&!33v;xhbEli%s6MS;VH| zD=u^Lr=NZCXaB`CqzmWI)k+3#2@IyM&tZBKJe}`VuU({T1HS&4GtjryLJ)Bhvw3vC z{g?SSukKpiIoq;Q$EcF`#sQ95=%B=7aym@+xMB-~l9Bv8D>0s;lIMDY z@dHEEPX?nQy6MCjus(*Hux1@))DcmS6-;I(Ri)0hYK?_7;VF|9U~migFIH_zz`Nvaousscb5Y2faGo( z>9l93K8ilLzkc?wx9{4${^VmXojRAiWUlGTsVs0J)+%9=O{C+W26389x%sdD-Zy^p z->>f2e(dqc`HD~R+$z{^g-JBw3ynDOuWUu-bt@nL4 zm-(-L%763P?wz})($Y@ut(5O_{Ajc!~ib8;@FU zcJX8*V6!##CU>$pq2mga4_C7fAT!Lb8+~dhJ{rO-%U2=6Vb^VbIDl+m03Es{JaHe6 zkB7Zpd^GAxycN2Q1}KEH1KS_N3S0+;1S9ye6cvM(5sT5tXYNk#2@^?8JKja{`ZqOm z1O;CRY!Z`qT~jOtNnXS!ajAiSgrX?E@|CabJ9z5G_dNZbeS4#(Nj@Z9X(_0Mt2Ai1 zAjvoRSNqZQQ=hy}fyIf>>-yf0edyX}KDGbA{d@1*x3;#nzP{ej7@X*kBzBImAxUWQ zbRjt}K8OqAJ%D)5h1hu7X3hmCKDiJ>h|V?TYHC7rYS4w<-{?YgdZAnr@9xy|U-|U- z+MR<34y?>(i}^g$#HkAwKFf+cFGI*e$RW+9kCIBZDb7m)ZdyKjpNT>R#p`b=@=L|t z6x61#@je3u710y>oT+W`;GuBSfhk+!aYw(6HCYIGo|n#rWTRYWQb#X}#1NeKl2WaMy(|kr!0DCA^Fpr-XEuyOfCVkH12n`rm-JJdOZq|j zU;P_nol>n!KgJ~=d|*P1fl!@QmT+2U2 zI|gljv#*-1#te*DJ=jRDa}YNZVPkR2O-$x{b6vo=2X5QxyWzhb&|2Kv_)w5OU9T;M zM9C3&uIVx7d7hGc@o!#SJ$vq@r{8sRWkt0tOd8IZ1TN$@$o{ z`I^}6MC8W3H$M8u`RjL&A3G+_Efz~CPAhxYFe8VQN0utevK-F?7?bGJwNF&WMJtF# z$gOlSv)~eTS&*xkWU3378$|4w!_wl0r@{OL4m74FHkKgl?C@Do* zN-|MZoT)v{H=CRe{<9*!c=Pr*{`ViBRW3P=02G8$3=kK;&Ol_4MvR!K$g4f*RQ4E{pBlPf9%29=g#{=at|z9Preus zU#%{ikwS8={pb$vmr^XB{mu*j_@}as#idJ+EbF?i>&0T}rI*=hI7+^4wD}H3*YDYN z!{02q%mweW&UewV-a*T2YeJjv@o*)06?Xrt*RFm1Gh0)6;`s4;xm?zDOyUTf%*`V- z$Ps$b1se*nF`m{yO-&ZhfehclhyzSA7H2nb7GpupvkvnDcse7HvQq; z$|%YW-43|u<~QF|JeXI6(cEQQH9jxs60s7W#_ets8uFQV)^30x>@C6r$02CW7$$Iy z%q}M;(sNgf(`>_4Hg$wa==jYM<{1Ue?bTuKV3I_}4e{$aB(dTnr+Xac@M550hR+{d zPWWgUChoe-Cq);vgQkDKt3F*1teaeeuWSy|xhyNHviR0Z-`uui_r1rjeCyN+@kL5L zw%VCsl_Amr?eK4AF<^g80lys6YAqYrp%c z?bXVK^A9eUX<4U~Tpn`oyy=q|IZ3nBP32+WZ2WyBQyet8YGaxdCukf#uniBREk9HY z17=+SK8!Z__Nqm0f-`qw)0&J`Z%q%~0K&M8HBELVH5g#VrU||o6Ent}^8*OpiAZ3p zgdzC@nKn14Ovj3Q|7OxSTq{GKWhbN|R%-}Q>gLqnP4MLH^y!+>g)<~DmY_sE$y z-~IH<_pQV%bi4)c+F`3FyjwfBZ3UNv`h(49dFPy~z07~*4`29=-`u@r<>0|X%lX{9 z&Jrkr2+`{*dU8Q)-_|$8wdBLnOOfSHTneF?%zBNm+C5Z6bOS2x74l7iAG`!FAxK#J z!>?Zd#9!{+zWdDSGk%$ti#mDlgEuP>OmJgz3P=}|sbPu0+HjN}dc%9yVG(QIMJ)^RP9-P6%7-R_pg!#NS zjoQtCf)_AnJ?t98L_EIPm>wcuV_#lFw`SA~V>mYbbR$)QiKn5dYG0Y*k(?hH>Ao<#`7=iK7HYpr{BLm9W$Y;L$@K)`Bv>N^$(-LqtZvFlu5kx;~&2E z$DciX;Qsse?r|;Cmg!>DYil?X2F<6DE+)wj@4j97g_GO|b+A%pC+7o#tR$|2d+&k? zwG)>_f`nVY`k6OB`=!-wyY4%3a9%H$b=`9t@?N=C+|*|97fVa9w<#-PFu?%83oTdq z`R~Nn`Z!SE_vbZ5v4K(<;JtDA!8f^d9ReGMoqCg_Fr>zC)Q0VN7JyN;G^3SZM5`FY z$69;CMiw0G_+JC*?YOZ+_A*aiKsMlX$(*^NwOZxK!NuZ?of8?ZmXa-o^^ks|=PZdn7(Q?r#Ut>p3!x82zlDie=Lz5T(cAnQmteFR$ zwowFezO|od1O3Lv26l@)&)3%P-FW@RmIohv?mbUzq-4jfcTWmMy}y5C8F7Uw!fT1BZ_tJi0O8&^v54w&BEpjfA)hWU?W4x8c4p z>qO`X6eqek)AfZB`zJ?XiL@tH7 zDk&35B&JlyxK#LzDdJeO0eO+~pGFs%4B5mA*oX@QCg$#0Yk`f!ML^*Sx!^u-EWYs8%UuBWEn zG-h202bx~dEG1VMU&ZdGh$x$Sw`xImUgCqcHEuJPQU`&&(VQ&xEJ% z9P(Oftvy<9#F%jyPv02l9Aj*?J^p`OVlCWGT*vzAq?5!nC`BZum}S`uFFe0>=g#%V z9(n2Xk=RZldYPS|q2~G`D<0^MHa2ysnHN_)_u^Oo&wskO^HvY=-17YUsw(1~8Y)U7 z8mhWaK1c|=&YoO<&qKHOPLp`G^!6dNwEtGk*o9tZ*T>(r?Z_alA$RrW^4XvMHTTNx zvllLI-?4+02aPThk{y^D^EY7_R5NHKwV~OoR#{K#0k>-k{Lq;?#^vOli!) zktegt@aH(ouQY1RZ1=-0IfM8!`5-QxvG3tjnrn7u_;UhFQ`a6;kN_wNoaJ6-H{`=I zP(#OvM*Pw&Y%^Im1eYQ1*I;^wy$0?QGVj-1de&3nijsjTLt`X9Fhn%d)L=yeb|W+M z-?z)Ihrn#Zoi>AAGvUPq1IBvZ1(zg=*I~gh(vdSPmxO`hqwhd%sps^p2U+BWK4D+} z;#c<`IR46e9)0z`J#o`d8+@)bLsjY8h2ndz+ukKF^2slL`JeoA|HiErQU}UMcl;u6 zBPyyN6Y|wvs}DSQ=B*DtcxSb8A%rX}V{~2*pq1Mb0029kzFuhVKZ;SrzjE)3Kl73N z=EftJ9-T}kO!Z-Utidzk5AV(B4Crrhp9{9osv*oXS$4eBMjKz8{Ws^sGJ8kC1(e8WPXgR-H)@)aIh>zW^N2OKK%W*7p!fF3lOn@6UK z=JRAyf$^X)2wr1iwke+D?eK&~j>eGEjF7LXC{1tGG#XGrb9<5dj0}Bb#ED_c@pj5P z9&0b_XF&wfcs{W@Zl8B;ZF~*CIL25nmtM(Y-f?=;jX_zDq^TkWOTC#Vcoe){o1*hY z6Vb_FlK9*UU%UUrnZJ486Sucayc2OWL+~xXRf6=rw3`A}sDsu{HllcOnG?7E(NC=Z z&S%7g%a#EGSMTIJiT5>%CP|VH-Z}TzfA#F)%MYzT^Wfcyi@~`fi{2_5_l~OZr4^0H z$vN_tY_eBzVe!{DKKC>KHmxt7c;bn&EMPKg6pT4}L0n*atszE_`)f?G!sDmOAo#Y1 z*kFQGQ4|_z%(klaDZ|+qeZoRdhIP+KV7AkR-zmoqPOMD*&T|H%fXgv-Xqam-`5Z%W zZEv9uvku!u`T3rtHVQ7s^t{@IUo z$}RO|qT{tv)bJtQq+icEE|+ufCB~&Valt1iS&`k^xbw$^6|$qFL7C?I!a7lnk)&fH^x1gEoFzI82oti;?zZlK?f>ReqdNDh2e5$6kxcX z#!-t|9C#TAJET;M^Dvw!-n==?nX1be^l-@I&BOG>kUleaV#vhjQ|9C6GS+Zf0%SW) z;74eHjE9k~G^1Gd667HWUyGs206V8)=ECTfA^6)|BcmkDx06Y=nznGi%N8o5 z>Agl$)a+fbS>Wi*sUjN>b5)C=iCV*8ar#e8U(~J#8+IsHAtS6Qm`E$pE=)`4ViIf9 zb9Gh~#mm=TuIoCxa`vUi&M!ljq-XNbmB})cy6Z&Yfk0-OZ67k&{<@b|u1*X?mh@4a zI2VE+k4M+8UAwz}Z|9R2Z-3zIvQQO(jy9*SR9hbntkS_~q!V_AhN!BxIPX$^`*)xH zPrvxPTgurZSFR+nxC%DEi!Z0_eE{Fz*mmjg?l7~gu%y!Z<) zgiSkz9mu%t!|(>JtcNjWsO5)`~k$P2So!4BaL9Ez_Rwc^a)3! za%E-Zjo06pR@1$YKYaI@bIT&@>lC;&(DH+EPZPK|^V@aKhdNyQ$QPdbolo7jdjFM2 zF4xOtl2oTSWPKtT;mE}~jxoCDnvRz@SYo`k&1``~15B)kb*{nU84VSlGcb4_&}hyW zIIwE(7}khzQ(^J$}=U5C~M3aFYAF|HW)%)IgKl~K&!KeId|IZ)2@caL9-|l_qE}UO3 z>*X>IOCP2yv0()>D2&88XYm*y@GH3|#qYzRghkwjU8*4&5epvE5|C{<_XPLDlvcx{ zN{x3}xrb9xHkyL{ zbl5{E4PWGWsen6tuHqKONlMO%G`12#+}IXq<gvFU>poWUU_~Ya&Ev`r0g(y$JOvIRj7B5&XXwM$Hc@ag*%_*AbR@NT z$Jq>*sEjnwQOR%)YYG%5PH=W?IyP9aW)i49VUZ}!)Jpoly`|3b)nv+VXQ z9M8WQ63J>MMy8pO69(HoNJ)A!0obH@moSz>h!IBKppP-m4D$>_6>L*1=)}kmjN6&S z##7^VpX^P+fVdt4N1-2O0PB#tGj6#oRo-cHWWb%RJJrgZDbs?EQ~hLM!7 z+4m=?PH&cZ?>E-hUw-A~*@cs@JbihQkCKRUF*p)d@j;yTDrtw5N~};F{+l{^67N90 zkjDL58vS>|*@@MgDvF}2s;a7rqL@ynZ@%&7!J|jUPd$A1$pb20z+J*tSpe7+Z1NFRC;!)fee+8%oj!5q@ZlpdcJlp94mF}|oJ@gghRlG~1h`x^xE2_18a|fs zV>GHH2JZIn9h9K!P)V+*NS!*^c(_9CTt`NGx5&MxvQWtj%n;Jo)fIyVop zY-YYroV5OA3PKjJ`aAxtW|}y>=Jj|Q`}P+D(TmY&RFcfR^gq6PMaO$mi+sF@S!{3cDRSPRxT%!{mMx&pdM}3E z#e*T!dgG|Uf(k&H8}2HravFsdBbjM@DvYQUt1xl}p|=x|QD(4m;A4paV@uT6dU34v z)F<9WHsYh#2xFw1y*(*g%x`MA(?mLzT58jl*rCjbrO-3Qc3eQg1sF;MSjkzIJ@?#m zTXybRd;HRk6Za>{y~};_l3aA&d!Hxoy!WEg02Jv+A|)!8nQ}U1zjaJrJv=B!_42{y zM0_i=taq&}%axUt(P%WCPH)}1b?W@t;yn-DIkinZ+=H4A;-Hp9)eusWUZiWYNMVHF z^0oDk|Kp#N>+{DSe|+2a?Ev3_+0KGa-1CB~gSPNFAsUh&kl!IO(dCLVmiKioBn|1x zz+$+jMgZjy%w0S!gElQNVLsc#bF_Uo7Lwu-%5YL_WLH?pjUi>G%g^~H8&UFQY$}pI zL$<4yhI9hfx-vLegC*{-cFTuHIOpT0TGAOj4kJzsbphKWPXpQj(QsBw7t@eE5H30B z7#&TMLK|ut(l?fCH>&h(WyJM$jEOguzC@bm#xQ2MMxL+R9;AlPR&*YJ6U<&)-&nOk zbUZF-vp*+|@P;w^~bVy~eZ1`Pf9Sm(~j9Li~H~1mM zBEq&Yd_6~7gXHK>8qMzB(|s`m0PLXnbWS)n6*D(R)ogUd5H6FPK@+88P-tvYe@O#? zW|TiioT2au2YWLLG1=CT3N{@57&BH-6!>9kf9l|Z$ll=QN|`}ESFgtKm|K?If?-cZ zX0f1y!(2aT%(DA9#yDI-v*tUw8YiB|_3V(e^pn9%w!zA_!wJuW$c~_zy5?P12kVET z2m%a>m!flSG#X`Dp6A8$U;oT|3kO8OnhE!c!?sp1TQ`pm6!7*g5r}l;G_+6 zZS~qkI@clNRGE%b!mjVu_Wrzc-Z#^Ls;Wk#QBf45(P%WPX0z#NG`f55-ieFn@(*0P z^FSqDl5;Vk{%_p1o7~e=_1dI(o}e(IyRviMyYTwwzw`S)@o%=c(YxRMRG#OJ#5`Rq zluj5{U{xD9r|!^P!y0ceye&HcaJqo^H`E0q2*kmHMOk>|8jnB|*Nj@Sp`aN^AkLR} zbgr6*hs`85Q~4P_yFnLoCvm9DGQ@ra1H3k+7T+X}yR2iyPN~MimF+l(h?t?kx@|&J z&1eP!+`_{J(l(iqRAm(@?ox5>rV=AVRZ;HpB0Xezm|?foe2~#cFzPJE5spMaWm6YE zAAEEvxn;XVheB<`> zwmi>MjK?lt$iDy5+MYbRn-!1FuuRN^l*g|o7W3w*JKj(;hAVx8 z@Z?~}J1RcN$jtU!cVm*o<5=%{QkTIQ7qNyy5&F~xXOt=R7AzJEE1nHXh zcV$_QMk6ePs;VZFNmW%VD=R+uswfU#xgdY*(qc!RB#OBH?A25Ev+rRh_M6^^lti4* zeE#)+^Vv`R;>Y*ySbgG&$JN!Bd((K#5SSQafmp`cA-r)S#<3m;{%~o+DgbN?3x^=C zYSI2Sf|U%~Hv*A37xphji)KjJVBDOs{xWC8%_WXGX54H<5Lktn^HWq>xJt&EtJ^#j zF$7&LUAb9SD2PmPUQl5ZiMTPwc0@5^F{Ti5HrX_XMd?q2r^B1KpO`@&3y>M*@N$lm zWmzls8})bVdI5Y~3+#_7uBSS2`Y(qYwUTN{`$6@*;QpynTo~T7vpQQ@545x514?an2r{Ks|wK0uWP+KBfoMz%FA&K{*2H43- z3|^c>?-IoEF;ZMEm+1J8$7612jz{Ax%f{o;*T4Dvw%vP{?|SOZbBA-uViG{u#08PY z1XfamaZ^54@dN>s;qi8=aSsY4k3tGUS=wARX0BCZnn< zrql6wGFryPWHQ?S*ai22i)&*EUV$u*AbXIs^9?zq_2F#~BZC2Ba*c3ajM-oQlRx;6 zzwt*8?0w+!l}8qfjpcHIn^jd6RvmZu8RuaJ6pUhlUn1uwDm2SYA#_OegYbGI*<`SO zO!Hv)F$TVxobuF#gO?fd@@HXe3JU>7s$q`Iz+J#D4xp;q#V8ss^ypX( zpJgsPwHWR-0+Pd>`vLu{H%Z|{z;zxgJSeGL(NqcU&1!>s2Yr1EoyBjwhz^4B&9aD5#yuEyw?Uc z31!}vxZ0sl`V}{n!Zhydf6-eEA!r=YD4#?|qlt)ARr%a=&+a*L=;pgG+}t(sAs<*Q z_Srnt7we2@J^wd!a2a6{`5v+m+ImI%XFMKbP>4U%$z(R0iO7yETlZbLAb z*0Z*d-Y{EwuC<|~8+ZJZ5X6T?`1C*e&9DB^e>!pGJl~kB<}=&tV5X;coJWW3 z-pA8e^lh0?WISOFEgcW4Q3_z(34;)ZCih%Ev#ABPcGKhIW|v-bQ?GCu#E06dmS*7j zbGdCA<>-2|gMu+y;}RRq1iq>UzSm{Zi0-UZjJU?M1g=jRFJeenX5|mtcFg~8U!ROJ zgdsvO4VZOJ%vI+00U{mOst7>rmclL&2#ZkhW7#jfQo{iXXU#WF70;0lWHLkk)rZw= zHf#jd*o-HLX+y~Fi^Vn0h7q-q&0Vp~iNKUo8hpB{8F)}rc$c!8|IAkhtusR|Fc~cXG#{sCm;y79#Wbn# zBgWHpNb>eDFo%Vr6a!6+a=2;3nb$LN3#%Bw0|S&p*kvLuSGy)J9x6y02uJrCK8QZH zuGiBs4kO&QgL;a#`H{dghym#gQbjZoc)e*@Fb6FnF(%$Ehow8q?HQjDZt!smW}MHB zw;L8bHcUiqcBM1J9L(MDGF)h*E2R%K3k7Rf;T<0R!44_TV}(uH_HE-ok-CX^7`ZlT znqngePsC8nYT(xOmQt#!ii7faJVrA3`WrX5Ubt}mdmmZmg>zY_mfS|VBxGsEk&YZ= z)vvXcu_J$L_L1;Pv1mr6%jI&pT%v8S`CXpp%B;}w@pwF*t*q2>dEfqhyB|9@f9gn` zwfQA`(F*)(+s&Xw$27;Ix+%^%3C&;U{7v^8|HIF`{MRo&bn&6RyZ6r57fP*zo3Qs@ zn*e}!aOca&F5wx|rNl}{JfL9k3ir;2;+@<;#|v0<#aJ!lgK+$ivmNStbFl@iFZW&; zii{cpd#5QD8NP>Az(5&8?=?aIM%;-fehh~WLobCkI#_0yv1s5kG1|&QEnnkm$haXh zH8;i)0C_Pi&L~{#b6`9x_*4;dk**Fk4!HU-`lC1nwhw1&8pslc*vMQNBO_`AkXbPl zXA0C_x4nC>_7jr4Bp;>wt7|f~yanf272UT=cKD7MseQ~e6;8oZysE0SvaYHMqcM$l zRaFI--Mw=+FN^G^*rgEy|)Tr`Na_16M?VRe_g|=%Jl1OY| zD}j6u5(+L|AsVlBmQobOmMyc{mf709yGKqO-upcdE#7$`y67ZDanZY$x7!?sm}IlP zq&S}F8sJ_Mm!eyKC;r-x{QT{!Hy^!xW&5@r%f(``Sc*7MAdnyFhQXwFeN@V_Wc4~_ z*BizKI9{fwWHdPRJ<)h&_$S6AECjDfA3!8S4RFSbAWH=u*htqgC61d&IA!FRtQX74 zfe}MB%2ce+&h}%devEzrQp>Ku=jdScDNWVQ#VG<4YyS=nXp9((5e_g~o8SraUN>xY znc1=FwQ*6#1tX7&5JdQoDI2-$<(ZmM-9jUlLqGViydB|#w9bWoKW}}yLQHAH)8}S| zY~~pZ!8mE`bX=o|Nn##dhUL7`F4f*5GsE=&5as}&MU-4Fm&(?1&b|8TwOxDm$~!Jz zKf62nkfI|Lif@o5g!#~%E_uhg?W(!t+RP5vkj|%~<&8Aqve|t*=%OYFlgR|;hl;-| z@_fgR?He2Ghff{Z`8^NTk3A5TgX==uLhMq!?s&8_AU?4~vkrWuW3a4!;m*JM;eU4b z=G`YAdwevSY;4RS!paL6OO%_oOg;rcVyMEzd%VsWAfksy#l$0Y)0lSwiGM6ZWbwQi zV;48tZf48Ji6Cr2^@owLoE~u(lCcLMl>$%=oCB9uz~~t}F_h1kmolWkQ_1JT%^2AEoHf=bo_*5Qn&QDTYlwD5O(1PsVi&anLnPD9oCTfEqxN zqtQsOzeeY>EESu=9UonLD=RA^^71RM>^pJ%t@mDB-@B4R==^S^?He{|yC!v_$l}@r zuoK;L0`qL?Yu>pe-ic2{1dK82#lf0{WO-Fpd7c+VKAld>vWRhc{QU8icb}VI*zQEc zr4*VzU3WYlP#)Lwv6cR)M6mN* zTz1r_DC^kH0s>rm?raZc`Z-)+L6XGGI*jE2iX>$8oB(Q~%0M(TNag7Vqq|sgic1*- z@<(iC$`^B`0K*>IrLqeLQV=fcn@=;*@>j6_6Y_E29ALh_-(b}LMJRN!3d`yq0=KTief&WYrhGjE{%73`VcHa#k6J1 z7IE&C*IvEv^vO5ge{p?MI?0pfJ{|5vv(7fr^Bt9qGy)nUh|V__d>fed)TaUL@xeMaF z7yr^np8e>L{!;F;C*SeJVm?oGWIIj3fVm@v#jKv02D-10D>D;#Z|405xfPN)7JxEb zAeJNM?mk;GaOE^~7c$gxhAWt2*0_wa8m2**vW1&*x4;4G!^!wFlw91M*Gpm2x=zo| zd&x3i*9#R;Q)rlaQ!3~TzKtQ|5RlSe)YmIkE(E7m2Ku$a&9KRE*kuZH%38o_>S}Mvurl{HhO0sBicA@JuwRki|hqYrwHEGq(T_#DAM3Kl6l7`?7ZYK6T zoxtKQG?6aLocBp&Wi}I$dQopXfBNRrXXjZ+zBOqDVon;L*+z`dh1B5b6m928>JA9F z4i+a8oP>l4207{uW1o&JL_|ll-pkglE8}rh7I_iEsmrH#Jac~I_*h(Q#}N&tFLr3b z1`HTG={+ZEgX?|rUM)D1NRr^BdiLkP{QE!myIZ&IeD_mN&FAywd{O2F!_bU5nIQ(~ z7NRUPW5k1rgf1LLCgXh+7Oufa+phqQAc4RqBE!&IsU~M;l)+FnM%6Ln4Zo<*hGvmS zi4Yt$wM3uNcDhCY03ZNKL_t)MRBr=#WE(9W*_4Ijeo0i#5}d| zx7J=v^B`PdSaD;vuH_77`MMzMy2h{q?I9mRRTOLU`E2VpfBEzq?>y>KCXHFO=^m1h zoU|5;*5BG9E{j2iOtJm0!?YgLUxaL2Bkntkv2#h!BM zqlzXp5XR0M*S9@K6tkWV$+w;rS;N?s@cAG6p0>}(^v_Wu2 z4B^819pagJoPZP$q(*k3WGyU4dXJ0?J3KK6Aj-h-*XlI5K`|g)yh_h31P1|(^ zZEIs=LvQzdK37Pf@+z_Sq-N!kR}K z6nE$SDL7*_02TcFDp@}388w2wf zS-%g_d8j6UVy<~yxjkgoA+r(irWllPQ-5F$BSTGN1J7a0RD*_Nky2x&%4XOmKC+hw z4+OZ~z?%=dZnMV{ZYRU&m>A3MAqwzO8#`UQDGQ54=gS7f8fcrqTp zdF$o_$B!@Gb^iA5Nh9t_u`IO$0j(ifCwrGV`l|0N$2z@};9O|N9Z48%kDLx|6YT>y z=hoNP6?P{glgT8@ve9TX9*xSfs>aok$4~G4{)_ckw*&8*+P_QmL>%kuN#}A4{ZVPX z8H1DHm)XbumybOE=U+Q{;^d)2ht}5Cz`f&bo(W-C$rw23W55$tmfqC|41GEP445j5 ztOYg^c>Gx5lBX7!q5v3RtcCQ!fVr*F<1?cPhNqyB%5X8B=CLCh)79!fA^#c&>mY=7>s8dW6@A7=P%q^x-6g8ynLVWnw?t)VDp zp0gHc05KvH~^oAIr*#P~0sER6tqR6Z9c)GUO*mv>F zt!K`!O)@XROK{1j)C?Rtli3zs90ifCRYMVp5|Yc3&yvrQ%aTG2#V6-{=-LSAWTD8= z*q2gTUthl!{>M&Ee(>mGRJTsJA-Q&_f=K5(3DQn_uT3+f z3wr!cyicxvJ%0GV{`tT8(u=1~pWL~7=lXmj5=s;Si^YyG`+_Ve@BNyVYJq}E6JO|) zj~K_X4>6Ht1rV_Gko4Elxx*5MRuzkqVnr~`24x>lGgvE>Ln{B&sE`_sUfr(PRfn$$ zf+-JD@Fqju{6^0XW1S(^3|T8X{&I!_2}1-XPE#4tGF0?Mn+ypB2j%Bc#Xuk zSz_l|^+f-TsArpiBI#}X43Tvr3qYq5t!~!cEz45HK9!h-{j&&pk>}&_xGYQWybpf$ z{HdECIJ?aJ(mCft3Zd1KYjZl1z2o*GkuEy)Ow%UwZ9>&oT~z>zZbBwCuIpN3w|>Vt zHY>gxL18kZ(UP?oD1yap2qW^SRU!P8P8R~UxIA}G3knX-m>p?z2m zB12G!F}pC+18&T5s>PEHbi?p*5If*VXNaUckk$CZ`!1s(@C+DXP4>)lEksjT8^GwI zu>P=Ntuxh@h3!}yiXkJ~S!6i`O_aFv#g~u4JG?cqq&w$jECR#+zRXrJ!i0D+z~xvZ z+yrEf1b$0Dkq6$GSm_PG-a8C}3|mKQ#`v@sMS(t4n^k4C)G@|HNIL5`-Kcd68cb9t zcFpx9-nnL$YG9mbaA?%fv;vg^;+<;741JxmEGvt0JRXOT?Ot7-K6vWplZR5~q8At1 z$lF9Z$A%b)B<;=i2u7aC7%RHmlI&ugD&n+)U}vftQJ$H1hGFDny}0|F=G+PE?urjgh>4D%mB4U3;o zjLG>t&0sJZgDs4I1$wT`Ma6B#lMRsulecrfkGCuYI1F=H42$z{#*4GAFDLeT0XfXE z^9CD1g%Fs1Y@|sw(BLv6EzL4TjgTCh^c0B&41}()@0-~L6g{02iF}3Gh0>^N=oY0s zC!L0C_NOg8Jum?7uz@LWp{hpn#o~cO2h-!HZ=To@>f~!_Rg{AlZ7Bw0@r5ZTl0NCl zEH_oUkVA+_)A`m&rz=NOxy53EaXFru#bTiuYnJ6&(gyDj9Xq`D9f$L$w?|bG74+}g zE?z5^MTS8hUTCf}C(|&UN%Ge}bK@8O(Z6)}+8CIuv`)|#+c`11UL<9 zOetkd?9ph#wUH5;Hg}d;5JPtDa=BDvMh=mjf|$_(!?28f1V8-PEIErb4!Ooz&3I<> zNSe7)#>oKlG=hb+0}9q_Ydh zp}4Ln>?($YfUX&z1~=Nw1l{NqvayI!(PA1ux~D9khXYm&3J-vwNMi&Wkm};CKx$bo z7d#!tKpYoG!wNgsWg({iQXmWn(`AN)fCa# z6*XRH-JyHFen;g1Sf7=RpsK2>Mw1xRky9t<@40aM{^>Hf=cO<~n;>=cDtXQR@>m5w7dS`uaK=>QE2%-p}WAq&B)8qJN^7y{gKUt+Uaj8c#=c zTAn1BeHu4?UsaIvWeuW?y#4HM?|Y0>d3&nvk4)7N8%<~0i;Jd|#H>rK&Z zAY4q1;Bi4w6#96ep@wIke^*ZmjVv7>aeJC69|--B-eD~wO)nUs!XaDFt^<3Riq*8$ zIEmv?tg-NjF{cC zcziQdvSKt0Po0=s%BU!&QXqKYvoMgsXCbb!k`>gVbTOoqoOkt73uA}G_t1i$S_6?c|K)YZh!GZfA!IS{;}D3%caYg>N?_4qHCWV*6-`?hn(*Pc36XD)f?Qfdb$t}piKF{QOYLg&Q0=v}RH zDYR!`m(_8Z-cTF^ptd@osH#d;HhEi8F{rIux4PiZUAnOAy(iK`;}lYI(wb`brL(fD_=`XJ^*>qNx%$ZE%k%ky&6}7w!T39UU^MFiz07C?V3eWp z(P+$RQLkz%9L`u7N$dU5Xk^It7;SS}!}E8vcerxoAt`Ho0H-;yweAVh@i$F=$Ba*A z`*6RWC3(!SqM5w0aiW=n;EJ#%Fm3}DIY$Hr?lLi0TNSK*YE-wpcPv-Og*T%yHQ#~B z?lAXc)c}?}F^D^n-b0G`wKr&wxCR`-AL+f_Py%dc0pL;Eo?khMRlu zm-RBmB+m8y8GPH`XW+0OT0Sf1DGA)E1#Jc}B^WV-{FF0dEom9j!8TN&C3Vg+S(azn z{s$fyKXU5UV+SNf?|n>-gq?I|*uIs(^Q1S&L=kP|h1QJBvoHpp5Y2-1?sImm8>B`$ z)IqpAv)ODqolYi`EQIryF7Er_sdT=AW+#~%DWO&<(sfhgrbC)q?uUqT!HZ7||L^|( zAAj~^pWeHB_3Y_0T3?%K9$E)T>oB#@^U^1lwKGgR3}q~8US5pKcQ!f{AR#cq84yL2 z5^@H>bR&HSF2J#PS=t9>6AEf{3=O6POI7zLuA(>zGyX)ZmB})n9bb!u*SW38I}C;z zpi;0*0<+CP>SBO3YtJJwWb7`~>)1DQNK-c=ab_NZejkq)OcHJ;6}t5?3dE4Ex!N_E zui5vwl4X*LJ_Jmp<&2mGuh81(eMM70fW2c(^JQJnmkI=ND_0rFUvP9_wSNX*(J>dTM1^Djo%0 zSN+j!HY=*UD2g+WoZb6@WWpV7Jm;Ec877rsj~F8%b`8WYG7kh}Lqlrd9HooCJiFy? zF82sH=VGM+<7C2zz&+-lsL8H4F90SOz+vfJ5*{@Y)A;fvoqdHm#kd+*auqBcp_ z*Vm2qB#%ciOhgaCAZE4Sk9PnD1$P-`DOx>x0rhII;wJa?z@}h$2T}peFu>slQ-XnS z`e1Vw#VHOZa@>-`ID$EpOiwZ$B+fZ7c;U1Op;>dB9&wM8K==T0QDzJxjVvmxDCWSN-$?N zF~NFZN;#+GD0@ev(P%Wt$z-x~_s-*wpS|w~kJPIhSxhb_HKlC%dOkG_v!3vM z(&x<&CG>+!QLd(+`5%Az^%rklIDdY}jvZinaGM+Z++;FgyHP|a#%Ur1pk!gi0j4GB z-Ncq_e>FE!G{rv3-NFMpv$9H_j|ZCfGv~L-S?L2#gPlo+hSVdgSBrc*~ZRtjKon z*?r{E^LxJU@cNe8NAGKCJU$(`v>@R@idjYRTpt3dwiiLXy!GtbPyhXY@%n3TJoMm$ zA!H){-o1Mwl7$SK?5bj5vSTz=IT^=<4J|WGxIl(M&TG;)F4Xi^>XWSVU&EW?yad@j z)&llL7|R%6ZPw;wpf5ltz|HCVuow^HkhvWRm?t9^fxG5Rt6M&*-=K1J7#xR?vEZjZ zGzgGrpCNNesd1HsZL1omDh|{TVmSX~{}JGBbV9^e*?1SB5o`8vM(r8bIMdER?#WbH zgS=w|85h)SwV~Gp!w_V z^^zKaOzr5orV$pjZ7z~YOv`%7J2TJ#7=(cm#{hy50>TdJBNk}k4vry2XIWNOWm%Tv z$>{KrgQEwJzV-Ni=aQyOjdiT3??mg?>atGH&fx?@bi%%Ch-lo?VBC@xjJkf9y~GU% z#ZI=ZBA=JpcwCJ}`N0EwPrU2+>VLk!-jbGukDiUXeS>F|Mg_0E5iW^O-bY6_Majz& zvXo!{)3u-bpa1Rh&hm-Jo+$HjzP?Pg)XP|8B^Ial6R<|WRAr)qKB7p(m;{De1Q8Hj zJhOh$k{(V8R5Sr$2%pYrBkM;%lTPmoGH%V|ARdABg>D*SJWTn>^2pedA-2e66W4a2 zY_s=iSS*&{LQ$gBvzX+D9}}L~^#;iu3r-*y^T>=dFO$TwgC7pmIQSTU1{Qmmm!d3Y zvuSefz@h!et{l4WZy$)|JaZ#2xk&I)J;r=reyZ!BiV)7R^UzQuBLA(AU;kG>_G_*V z=gysj;2rORioC-`!<|BIg>6!Qs$y1*)8uTxP(n3$&F6Cfq&Rm$B8IJwZW2%K< z#4}bl0nn&{;KdTk{4d1B`K~jzpt(E#ZH*MEuq7K`N0SO^3&SJ~5M}iQUM+CcWkL(w z3yuFCLLu+`SY4>otE$rG-O6No{LD%Dp7U?*EuADXg>`TDr)B0hxEXHdq7E_##^r)p zV~BK!&KnyW$Y0c)Oo_Bk-0>5K55D8r_V@2zW*btc-ga3X zzVxAQ{_4+sY*dsFUwUXhpU>xW?4!ms8sHBlx@o1UD@9`>qKq!&(P+d9k6frSsh*!P z3>;8L8~7CRL>?KlMa-u24WlW*coz^YQ28391ga~BF&OLw)6p2O$3{Br928jMjh#DK zO4OLHBBJwwvho@Zi`gw~*vk8ZiEeyi{CZt->^^D41=;0@#cGTspHW2z7nRouTHOp; z;3N)LR(}zS8ff7ov%u}auE;?XQAx#!xD(3Lo5q&RhbGzSTur-_2WegE3|O1dVLvl+ zG4(7ijWi3>nL)bLJQR&2+${9VxE0GyaV}CY@*a&wli6h3j%|m}oDAJHw)2>VmZNESS-tiv)~yejkoR`{`EdRf5%VR1AXO{SB)93MS(^zc(Bw?DmW znbnfiovdNeY9mN`Zsn~;iwH3;eDbb|>n?c7KKbb2dZiI)dFUa2?a>4ur7G; zWr*ke>!7|dQ1bhM1UO7#~ZF zV)4wCWtqgQiD_eIn$Qw*U?I2QuOL06Sl4P&DyLMS0cV_|bhT^Go^@`~BR6V*C?OeS z&deEXtqp9#C!e{z%%&@o@pQCn@2(vW9$UQk)G~J|gcuZ?*5ku!9BTe18hLo$SUru^IQ00}*4Frzp@*y3x5;#+D9aGsnTsb5y!X)becO_sd+(E1 zAr>!Pr1Pz$AQHbI6zQ6wtu)$vzApaV4}a>9e&bWCyLTKvaeQrkZLwJBDWJ$;`AG(v zXkbD%1Rx|TQ0BmL3XcL1`6IW$xId%sj9nay9fMu{&UieA3?Cj0OftFq!LSw67~%Yb z85c}XLhwQ|ge$<~L{J!*j8qgw$0%lR$}G#x$dE}LMn zb+J}SniDbH5+GHLl?)`pJW6Y*JkLWGM&r?VI^KWi!1&ye#iRS1X=P6YrPmH?Js&iu zO6`u@)9}E?j0I!#bs&8RHx;NHa~pSKV}qr7$K&yAWhG?c%)`fzy!XiHN?A)xUXx7^ zoM58#*-@_Di*#NwkKU=Wah?6j-}~b)ed6l}_a8j4|G>t^2Ejj zka}QpzZKDeAw-xjLA3!D3C3j+8CU`xA4A!gUG%uvWNRwGej!@L zwGNtckEy9i>oio@*A+ZMOCP?Wm`RV`W zqtAW*g`>xg?%KV3V`Bpk0J1hrd&c82o0H&z1E33mMFeXW&e1t9vOI48FBS_8dF=Us zP0|T=*zP)C z1^ulA={+M(i{}sH7icnL00r15gwD12n$PDvurf1TW(}g%U6ti{GN~rj0~b!XCr`b# zT1fC-TaB&77v$}n%cRvucj9<@h-C)s1%ne!Qm?U0f5r41v@eNm6(Lejb2eM4s!^8Z z=P#W*@xDWoBa7Dg7>z|P*jWaqd&1SERV3zlNU5%>!h1=n zDTZ0Mjv;17bpQ_*Gg$fY!X~M;J%SoTUJ$m}5fWb;l_&ivnqu5~;~fCE3PFTNGaPI5 zY0EBu001BWNklgEZR2UfEHa-AVgMh}wN znmWN4jYg`T#6%J9So6)ob6k#!(PXr;ZFb*ci_Ry>RQXP)0kJVT zOcXuExg?@?!yOfe)m*p?)RW!V*nlo6;A8Xo9DM@>adwZ)Ls5hxALYj%JAL#A4rB-P zj-=#LgLxE5LKCERf}wufjRL6n<{Y&Uj?p{6cu{`xzyIYozkU1cnKMOM8UsIe&W4c~ z6oauTqTPnaRrg?iL_v$fCZX|5p&ksz!Z3>2-+;TKO{7mO>wxMbjZ7Ie5Ld)iRq0Nn zZ;pBy98-qBpm@hq1k4S}2ouxU>aUT680yM%!yZD?Y-Wz!l7U4WL6|auavdof7a(|B z)@U|kS>{x*WFFVcsJ@Ze8utc9b)fJ>l89%WC#t+qd5DgoSV}$e2Gh&%w#pmDaVo5d z32j^>a52lUKFql=fmLXJ>av4ga_6M!<-1Ph$&=No6DKJqsLwO52vT%<%k*EKLKvhZ zi=KjAt2Pu|_2~O3*A3dsAeoe9URA}O)g8Oe9SH9`R%g;0&SuW_+{H|ZtK{O=!aVQB z)_rOut}t5Hn!aiCk=X@Y5Mdn0d#Bd#)9G~Uwk;>FoH+h>PG|e9P*5Kdq-9ct?;O&A?XPN$6JDVDQQxHGK5p7lGk!EkzdWEe0b zKf<(|t!KDf$KX4@2N)o5Jj+q@8csnJ8~vOPFa; z!74+*^%3f8&SZH8$HWh`pHbkmp9Zo;&HKPG!*}$LZuryjWHO!{JbZ9+VgLFQt4m)e zHMbR#_i-+H%%j9$1AvWZ5)v;G4P0Nh0*-pRV7JOJjLi*bV}X_+y~JyG66OyR~IB3w!~ zd|(G0UR0cYFliq+FAmlidNNuCdzXHSHkgbh66hZ&kWuPtor{}+#lTV!j7Nb#w{~YW ztf2G4PH{|+Wf&vyK`7+A0dxS2=In1`Wj+2Ky4&!gyMnYB#Q8V%>AK^c=%WMM2y z3}O~f08k}>s>z&iMhUQ`Nu%LjmStHUIeBDq`S9Z0tesb~cxNY6rSw>YISp0V-g&mb zPz;@z>vRBu7u@%(-2{oZ zf>fGx&*v`t%!gn6@K63$k&3ft&ee6T2aG2~RVR3NVbm0RpR!AXQMfZsgGjpo=0Hcx z^<^UrRdeL~0&3IRgWsvKk#ekBKZFhi*Y92m>36bbT#o&_ot3`*^qWIV;2wvE%A`mBAT$^tufm)`8(UAm}{s}Yc#1Qv+>H-*^#qH!#fYH z?GXtnIdRIkZd#L0T_RKJHIkH@!9I|vqj)fn)#WY8)rMyn3lq(_Rd%kf#?GRc*9W0tDZ^_ugeGd7rXB`N`*h z=NJEU=gN+=r_bJfYfT4-+^u89Fl6Xx0ds>A9WlL|0K^f_%&G@-Zh@78?hyNj@yM7# z-Q)3ih~`1i0Yqs?kicp}-p%G@2m*k4@Caq-2MbtVqb(u6Vq8_XfAHMHFcAEIKIWlvG+U0bG&~Ej8r=m< zLI6qCi9SO4d_G4%i=P+-O2kTRJUFU6%RSXcz06LPk04+tO-xKZmW4EoG4H_hNBo6) z0;|`suoX@au8$~%m^lY96C3yF#~JrwIEQMG&GWpf$}G>eZQFL}^zq_-NAFFRb%@bP z@~%$FNsva;&S4V8H^u1d0+gUt9+_7_}<~ShsWm%?EQEpXZ`Aw(O$z&WtcKFEQ z!

n_|H~Tk$S?#E!Ko1UBmiq0O3NUv!LU4FCk0Cum8h8{|_JiYW>oyAuG0bvIg2JW!~24l(@kO)swrXMkl4D~*%yc+&2>#&13 z%~()$k&NcT@K5rc?ThP3W3BQ`=V~fOIEz`0F!U(Pl08-sn9#h7?H|^tV8dSspKzO* z6AEJwi10U_Ov6gObIVrIcLeb4R`v(l$(?(Qj;?G0xJ`70StgeQ7A< z(qyq%j7B5P7r04c>;zR76dCT8EnA#-hfW+l{KURpAFP&YCB&V(exw6##*vn)>TdZq z@e@he!vDe#{pp|mhc6u1x9{MggZJ*O>0CuKO_suk?glg+bmu@b0h2dWm&nD+vfS9% z(6eSr24;h;VR0~Wkh*mt4&sU-Ddxc-f)N@E`q&%$F_blo1mO6Ec#1-bm%PSb)=B2z z)3sF4 za|Q|cZ`-+Rzu77dNu$rMpkl}48nmUgl7$OBqdM6$jJvLi^@s2Q9s>}zFw(`qnnyrz z$-#|KhQ@e2e&FDN*~P>4WBZa5$+ON$)@9B459(zS91|=OE!=VCr%wd@vg(G-#=@biY_QH5IYQOO84~pyw@Bs_4X>C?vDQH|Mc6> ze*XDG`w#5ex$E|=n?iPC*dx(-aDAcR0E; z2@d%V_p0$$n+{M|`-Q*5ok142Vxb7G$`NOR2o7@XShrphyZ3}Ly`Z_-_6L>ZMQfV@Bx;XQ$+@mOjVTMaiBk%2OF85bSkZv%f} z#-CPjQKmpCaW!KCiQX-aNhci{-MF@D0)_ z{HnDW+*dn$9k`A4RECtCNjBI9TfjX^bnX%IxGk&A^3iC7>;U5z?S*Y@Y|Q6#P-SuZ z@HO@=eLWJ}qR6YNtg7noA*f!xYE+whA3_)b$-q>vip7@!8dLUznx zc|l}$*!~%_0m=mQC>guX(@y=Vo-$s*Z7Yt9JeS8jEwJ$-Yg90fhOM?hY{J1|{hPSJ zZA%lO*#ZK0i_=4H)gwZ2k-{38M!X+SA>?ih>r3kzh>>t79$7TT!K|{s>7+uhKC_GT zqUoLqS5s|{@TS58HKvs48^Y-s(GVkox0QQqmr4@re;`hIrCQ;N^MNzg5JFLuusGm- zRcjW^VKMUOY7~rdWl%7m4AVC}yC~0%TD9r8DIa6Y)-AJbv)yO+Pv5&gm9@8QV8=#N z8kIz3eSMvkGcZ#Y5vBKY;Kt+4exZ1-*o{zgIxg7&?$a<)mgUOI%BUzWK79JzGkdGc zi{%6YBhG$M6Jf^c-(`+JcK^LhmA=gXLR898DIncz(EsA0s3h{jsj#*T;YVhF*xFn#s4 z**9J_OiXbeE)$IbHBts2#OVbMiqyTadwg&2cIW(LGMP*!+5v$`CuR%m)y=xC$dXtB zk3syXb9w5A2c64X<2;GkQKzyMV>KGB<+71W`sN)S$mSQeY&*DXKA-Es1FEfq2nCm* z0&UBb8sJd$Pq~Ib8-bPJ5cM>^aLb&VgCT^nDD}#un8c;+JGQ23?Z)*x^^M?RissoT zq>FR{Hz8+Dh>(@vdNIEA=C>Yy&xJkvR&QLtUN4qqRp~^V~}A^=n{F4q{7q=%uOi$%nIe(0Dn8wbV|xI2s?1C$aBU-)?e8 zpLym3C@Zj4YAA)SA-Dv{W;b%RRPQgMx0F8Xj)@l%BqN|_Q8wuWm!(Qtt`fC zuU@_3?~I-E&WA)AtE%hCk*=*|F^6eMa^5=^B>AgfUVlSgdGsCUw{F{d{rZjh#=I=b zEbnOlM&S~sIVi#yCc=b#-E^Ugfs)JUEsjPb!1T=Kjie8~Da|z5ItpDvMv9hc$3E+LWYPc3G0d-vN@*n=|Db6 z_b!|rY6m?>7TPw7GId>tkd3chpS^I+J4wDL2%cIXaTDpVivEye8=C;#d&JSHArvAkxqKbD5MtERvOmKw!4>~ zJU^RFuU@-aR+XlMD6n8df$|HB6v?>85k(#Hzzt!MCED@W12V#yqruoRl1U3M6eTD> z^{tTK!8BRB!ytjNXuhrp+%>So00ida;V6W*a?@vj=9v$ql$`TrS#U$j*xEDw4Qt!v z0^A0|u424+Sc(9+Rz{zJl!_#RM}Ytq;u+=9fsr#DI%9BK&6p+QX+RI&VEXv7vRN%i zuc&!Jh{5<=vvGdx7?RDgl}(NTlz}Xjh~#-Oy>?^z^;djPs;=S5E6cJ+AS2spy*)|X zwe7{m{X5IDoXuvV(Wop743wc!fop|`k6e#+A6c7|TeQHb;3)#K7(n8oI|2KSH@RNy z$Vu5Oza8$~eCc|;KihkJzozz+$wVWy9zWWkXx_C>BS{lFLtbW-mC?M_*C=cVV+sRw zS2rbCf3^LMP?W`dW230b(Y7KVtzUiNwk!(jqIwjqh;+J9`9T@m#K!hpfAxv0TaL(u zN6w5V<6Adx`^@J>&PaYPkKph-L`3sg5;u$IjR<*I=2+AkXiU3_r`z23K#r*y7H{O( zN?AggJ3{Dp0|CnN98i;GdrZa*7@5E9`@Zjk42WY;McL}ipaaT+dZrpI$c8Dhf#xxW20d^1Ig~vb}PTg4o2q^%beuf<|8-{yl-rJ5ci!CFJ>gKPv z8K6h@+(PfXs;atEM*yyBMk?;4HA)9G|FnN(G&X&sA(>Vd&Sj}`U}o0!|RW=zjaK}L5ot_s_R zUO)_{n}jjsAp~X3kIO3M>AKupcj?IKqh(o6CKE(qX7wn|10`pSNyLeyEMs+pt^{E- zJSNgZniP2i1{z8bcNvV+dg~o8~iL7jM1tjkm%w?~svg7M{FU+@$y>)cMwL zR!FO`({m92m;djJ*^c?KGy9XI`C?vHC46?co2)kxwItgd>rT&{OAQ=qIix%vyc;A> z*4Nir1&_NHSU4!Q7_E&a8i;qAEuy2UIe`{E;4E{&3#=U4%0Qm6JrJH)o~3jXMZ`tS zKs9!#&6?(-Teoh#bLS57CKkHV3&$i%W|#v!%y43ciSP*ztyFoo0z8y96HRLz)J`6) zm}G%rSuoi_LrS3rERMn=l$-i#ArA+Pnd??u5V#5`x`H!e2n6WkRaMPyVbFY_XJ`!(a z%}<>^d2fEVnUJ(IM%FIVh0HxKCa|NOjk}|#19U1^Ct7gmO5t(`Tbc$q4Wnp4W3-5* zOoJK-EgDsIX|UmrmcT&aarL0@z_yJ@m{3~58(=&ht5$AGsd;OFlEAIy?3V|NkVwYP znUW}I6L|qIR47*B(P5J<)6e2kj(eXX;(ZY5s#L~{piabz{C{no$#PrSl|^3z5F|k< ztBLfi!ch?p|4G?u{r?|O6;*>AIV3?OfcI*!fyKoQX^_s8N#Hg2o_m_zFg|DLC%6!T zQ^vcLj+9{T0ylMgXeI97-`^Kf(L*{KtIyBR4-XG{m{4$-os%}^OX<^b3&s%TK)b}m z)A??@z5C05{O`X!yqr%L(cvW%S1Qb$fNg4K~Qc=ZUvN-sZ9bn7uR*oBq}!BsT|j@c;2~5{L{Kl}jEILU^JUO8?;jTRWXy{zmQ|&wqFMs{(Uw+%~|NH;`2UKTb+Afxzgse`Kzkg4RgZM&cf#xgC z5f((A&*^l!+un`GwA3=VMJXI~20B0wF>| zjlBRMoL!u);RY*KaAfho3`_lY7=~Ad6X&+&;pk`W_j@82h+?N6#Z)yZ+8qgaC34{LSq|ItG`H6P`)j16vD7Pk5fEsmwkZWTs>*)uZpSrl(f{eC# zsl>-yPvWet&1MsqDd>Tu*wfwSZW^D)X_}|)X*VnvwWIS{{z2owIAxsY@j}2H=6Rgw zdAr$c=FMhvx7+O=9v+xbTa1r)kyb{jXq4d`O-57DtbO3$Dp4Fm9ZB=8qy}y=B1f$9 z)9JJb{c92uWeUwB027vjrWH#Sk}R9HJ>{4g+&O;eW7ae?>l5L;&1Q2xugkJLJ?-at zdU$$xettfljxR6AWm)KXj#He3hH;#?o6We6$Cu+etm80Nu)B=EHuG+`yWc(TcDs4I zaTR4F4p=?x;=8-MA3uHo-9Xj>)ZsXeY0MRL&UA04)tmtg@gWWd7#c4x zFNoq%kkMD+r~~X3H3V~+Zgn;pOfVhNn zdZNY$QZHLL%v@q*vRP84$!;{9b5bMb5`4pLVw5pW)8TMALh!=kqX*+w0(! zNMu<$gUnrbTfTf*)@iyN#u4nK<}JG!XcF#+lq)l74z=O3EbF@LcH6_@=eysYo}Zuh z`-ga6T#kovoThPE&hxy4j0C&>*8H~xP9{FzBzcGG^p|Mu-$T+_0;Y;weBI*igGp**tl zwejugO$ICf$KA!^DO3-)MC5a%XW9Dtu5T5~DBt2T{K04p| zB2L7z%(*nh`rp!e!nk?*JW8VQ2;qeE0!dPj>N67jV?RGnC1aiN5ZKS|Cu~`ZMvW9M% zvyQ0~5Fb=_8BsB8p;wg@jLmOk?>LT;&NL1N!dCSwOWn^kso{`@=2@n~iIpKK)h&U> zEX#)Ngb6oT4d#26FSI5HYLqDDrM56( zDe;a(fkb{Yy`CaD5iiNSn~pPJv)Rm_KY#K)(PwW-001BWNkl-o58%mKz4_K9?$#}(1{4fH>4I4`7xETBJoiAH=Cc^A(T1Rl-5{wA z$8m!H;G{cC(RRR8{npo^H4MkuVy;B49M4XOss{>I#yaWqG$U9Ln$%_YO(V=-mv32h z_xJanL9BP4o`f(DH+MyXowSJ ztfIz)0vBcI5*pfWEP%zK)i!_q`h`)tGkN1PY2=aLmaBs`;5ZV^sC8;;U@(!?zSkDp zaii4U<7DHe<#Q+*&36lb0~1FM%<05p1*q(@$l0!UVUo6)ChCx&fj~U9MxN&( z<@s6qV_p?l$=F*i5%XG94$E?$=jkFPw=U=NX&A;dznH3(p^8ObY2%dPB>5nDC^Os| ze;dQh$YmJEVH~GFXj^IXy+tI zur}q6q{N1w?1e-nDB+H?%=B2X5W)(goXgeI#O zFqrLOE*IbBpll#MHB=$;-HNi7tP@_!C{_+cDW94ZbD!}iNG`fum>Qb(hW4pAF$h7Y}RGLWQ8CS2S5r)Q=VR` zX)wSbz?f+Qp8}m`iWm$HL&O+U_&6loQ@0_kn@aQH;ek;S>ltma*U&FMY?;`2K1TU$ zMBQaSe);m*m7sSc88YKh<9O+$@Vp43jAJM^jgB$4o~4<`WWgu{1)cs-VnC(f(bp)} z^_Kxw#b9MxXA>XL4{lVsC&m6WQr}rjX=E8kLXORU)*R4M91Kahej76JTg(c`YRTYS zXs~t3D{Y@{J$-~8tyxmk2q)$o@&s014V^fa5HK|Gz&Zbm)a^M#;qt68S@w0-bSy+C zVa|PScwh*kgvLw6F?fx)nLeH0U{&iB%ji6^Jlv}R%E~TvvW5mh0btD`0LQq6qs;c%d}&jX^r=sJaQRXHmLUg)~dr#ER7;mL|! zbj|6K*u&5d$fo7IJii9ZD`6l{jLX7h9+yssaTp#~kwCcz&j=-*N_(oaf|=?9%E{y9 z!8!`$L18Bf6u>bTF`HZlRYO)PUKuoH42q<1Fj1tOJ?$cbAd&?j9Q)jgCCFA}bS9p0 zA#WKbY`OEfgs;APC@4HwQl~&Pc&9<+F;TTCc+DlzI%Y=ftQ&^m z<>knj)#pDIsQEgXG5LV?gK{cokuT&15Un&w$fknq!?H1Rh`}=q*JLBt?9*foC0k{Z zu={T;h@GR@dis{4yZv1fNxv7`GB(z+LQhU;tj<^lRuHg88FN5Zj#ZZp7&JrPiMGA> z+HJP7JUUaX5uD?(z&tp-|J*0vz5ST@}>M-C*g>s|xUwn%cbcZk3CZ={N%6`mgp zhM6=7JU`9{wDWjJhWFBD;le1w?964|Z#K1gO?P*9^XJc>%Ek~93GJuUs!o!j&^w_e z;(Fk~qX&}aeaNqrHYX4bvuKF|7F__WSOfsG4v5I!FqTud8YL@+*k>;YcfJjZuDxM| zU?DIq`NwP|3&H{?`~X=nP&%CgKG>Swa|)1rriHgz-?H)PPq^-RfVY zJh6w0r(Z8=(VEx$4!)OKjH_^o-?1QE}y-Qsj^m04$6SJO1bN8H)E(fl5-VI9XU z(6uPD7*9?;Dh0*uW@sh@*4=QvNv9}(GB)*)os`ETh1=`FK+-LOw9RRDX#1K$`c}pASX~IB>gO zO%KANjggg|-irO}fWO$&0PL}uaOf0REP(WoHg;BFdRu-4O!PRb$&oPtW18mT9TQv*%fXStM}|VudFPl*a-uI#si28+olpBT~R}zH)vf<+K+H&|ip5oY3L___3E1 zFdWAKQw+B(7i!?N29_a;V;C8n4Q!;!3!d^w4OvonW@WXh$ugBl02=W*uzyND~t2Inl+d^aD%KCpGLdjv^h@5Gx85GW&C z{np|(mq%~aJUinCh~q2>PohEXRw-?a9v@rA#;{^7B8M!#+uRPYSHZ1a-L+-8#Thm63A$!dFo;)&#kZ$hlJ&}P0y&7YmJWx93-k9i(Am2 zF%E8|oF4+~Or_OIU!O^W5ob1~v_FyaeXF9|?v_ZGH<%ugduo0`tWSC->92W~0@OJ| ziWE{-Mxh4G35T+2G?DT)0j&7d+b)M>!jJ||Wn)nph*=AO!iBAEHf!+z9;Opp%Fmu7 zGZ{LX0`8Tq>pFk=^0_K6TQO37SlSnuTiNl_*G~>i?Ok(X*CV&+5M%vqr(IwLBVYoE zaSU?xL&P1Q9P>PHHrp~(w(vbY*)mYCnXHQdKA&`t8W8ksWq*FT#;<@eCeWMza4Yi8 zb}fn$Kfuai4U^d+R7IpSHV~B;w@RJ3c?%S^(X9ickr+x){!IrG3g!)s72pIOK=3miP*5!KEz2;DP;{Mhy^R4tt7RP^F$q z=b5wq%~Nm()2q&iXf)O?3(|hCJV#k2wQc|`DvPlVYQU2DX4zPwEXNa3GX6X$kXa{Fj9GCTJ6w4&Fe`8 zeUDr)XgHgVp+`gv;>U7fZ079YTOHkecyyx7%Cw*9G)?RJIuJJih1Kh^gQuU2vn<=? z8wVn4iA`2D&_bTG1r)52K?V@%c^6eS-n4r`c4J4Hy!hRX!mu0ii8mQ#8I2Qlp5 za5-*)bP}nNN@CbSCQvesG1>{_rtcb^O2d0i51T)K{$#Kl$4*uZs!iO9T~XWz@vPuh zQn^6Lrgsd(I8CErQ?wCH2zPt6q;Am>Ba=hh*yxcayp1;)qa`6Pg*oblGB z8np$w4f3Cm zy}Z0+56~zCC|lTXf)PK=qb3MuO{3nEXloo_F)@-J=6;RJ1S!Uvw1feO-!xV7(4L;2 z7%7ku+emG89bhbiuTA{yI%us*V1tfm<2Zi*{+(SzE|UmS#9MR+g1*FM z)j~V;WOI*n^vkJ|^dJ1QhrC9Q=4q#Jwu}V_Dj~_PM$jT1iIR8wNzx)Wkl42I_8arh zqokev!cd!-ZVbTu>C;Cy#XT^!)uUe(h!7h!O6h>UKj(18|(OYBn<~;RB078Jt0cHRqvODc6~`qP znqNsyTI^;w_#I(+&Ja=DaU)K7it7B-mK4_3cW2$haRc8>hbWSjPzdsxfxJ>x*;=1LIBxphG>apVhNk_L1rc)%;kY6_- z%$^bnAe>}0vI6qA;VgiyCmgl{C5WI>!3J z;-n?Ygv8isnpuyJkH2&!x6&Ms5wRc_vmS0*=+x*CV~H(fK(=lQWSNH;wPy=T_mYaV zPsqz#$POXWc@hOI#=ttGk%}uqOFp>b?=vf$7QC^NTXHB|@>oZwf8Jie(N{#H3EK1H!tUwMDXy}0RGcH`RO{{fnICS#p zn!*>`oo~NYsUZ{~N}TR$2@7RcCTNx?r{4wrs3e>7r%xZ*=S(LpN^bgb>Dd~3V!h1L zp0D!Lq0*ITOjrJe$8x78gI0$!|@KpBOq=coc=YgqP z4DQ60RG(Xr=9a`^;Q9I4f64QQww(`045mCH49N5*aj(P}-~!MLGlcQq|Xxo zmYgLNc@ZJT6lC2VIzEHRYm5)QTEXnlNu%xH0n&wh|al74KgaCe-Ua#igjjIKxgi1xM&U9Zg+u4bJ;f~TTZb(|r~9DJS(q-lvT!;> zL(`_+<#_G*1y-Qo8i+|)-kEjJP@7m|u^_>wF__9oiwA&jf*7`InIc1vz4She2VU!z(uRdhB`G@ZR13 zHNKrrG#!$F(phG9+em0g{lzpa#a%cXxDFb;W;}E5+C6@-krjL|D_0Efh?z*z7t&ED0e6Y?U z@!EQpUhce0SB}+Q+!){H;{A09=IFhq<-Dn2%Zz7HPss^$WzpTxZkQ;@&am$+?<^Dw+2c)6N`k?lM^8`x4sWY&pv)O2hUi->@w$o9+_v{t^uaTYC|djN(EA{gw# z&!J347uros6A&H5A&TWWSn`r11W68Tc9Q@CqsyD6mSP7{sBwhXxnlQgGmF@XF8oo! zn|xpztV}WjKiq29Y&rT_X&ZU4RRTK(d=Ld(i5P-sHEq^kX@AoJ0umBP9#rO=E7}dKxUH@dyXDnFp5w4-R zt7Z#u0>SVxRK=?Z7UR0E+wI278*!wPn9ruQz8PS{B+C{G%w(L#C7S}91t%Z*C(sZk zu$G@-2y@%o&Y!gEsM3-rW~9q-0DXUsPY!Qi3_Te#Q2vzkB&sb%79fl=OQA0T$`y|X za#*rUe3q>Q!QRIu7OU(_(ev@+2a}E5Ww<5D8;Dp8I}0Du5%kLD@U-O^wOe(FEc{=@ z2?!;wLs_Y|Z8a{x==bia88*mnEEz&3N@yIGwU8x`JeT0Rs8&F(l!s=)469@|$|1CE zi&^^o@YK8Jm5Bumttv0hu&QgD!z)s}gAdC8D1g=f;bAoh7{9_d;* z0QmzyKu@}VIWsf}1SgGUS>}KI9O@}g(lY-7AbhH*2A-kDkPOsHaOXSP!SGUH^ z%%|nY1+cfB>sjKpM!-gOT1_(}c0(x3p~90BS`|h@f=%)Kn#X9SS7{dmSoIStc}}l` zgqm9hrZWC0cEw16*(`kBjf%ig>(dki<$fPO!HM?jk`V9)VO!#(SrdcH{~4zSCu zwPkM1+AJ&r;$up52VZy7+^090zZ5t~65WC&xTl8oqVaXw;}!i0l0mE5TFK5TPtKH) z60tNXi|@++f5Xwq`b+!P9U{+jtgK15-avMg5skIB9iP!2Migc>gSM+Zf7_nBmbcr~ zVh&^$gYxGiLPs~pv6afj+Nh`pvR6x)qNL2A8PMf$?!y(rOt?OxHv_b45SNP(RTXb7 zTipaTqk^3~+hx@17>rygfJnRG8iK^a8JVq0r5OpPw9?!$q|q5nd!lD1q`;4<0`bzd zj0I!NL@{fxXXe0$LW?O0;QjqQFN-|ASS4f+j1%3Pw%$NoC6u)`}GPS0s6Mc4iodbvSszKne`bGFPc?n|jj%2@TvXE#?e1t zcuEwAJ*KgKj?SJ3fhQ< z^~{tuH|F2CARq%p+Eo53mePP(QN}p9eIvh2Ma3xcGBvj0&J{ngIIS}f+$dK3UNeqy zRp?5s{I=QZOcH2|nj+(4-18>l2y!vhxrR-8|9EQ28X~4Jq0b9;;O4408K~lE`LWg+ zbeeSSGuHf5-xu-4wYCEpTQRG_5#QXbVHnZ|wqAB2pXhBi4`xP{$ZNQUEf!%GYIgK({dT z-PuEW_xLxmB=Xg%f6GtCn}`yaERyMMdGFcyDYujFwYjKSjCmK2kB_hZzhA$8p|rea zeQ&^PmOt|5bQ{|d&1e_jB$sG$5fFLBqp;~J=`=?upf=h!VAJa~BMw^Up0=@t2B4`H zHkeMOIYuVm`H;6XBlpX8#pj7;5C)P&;p$`J9LDgGZV|Pl>-4~1ELnl$N7-@Fj?89Y zdw4`^?tvK>o{E%rIJgrxC5m?L#*hoHDklp>S-P<1gjQu>UI#S+;{rEHxQh~cgw^jh z>os7#I)@RpDaM_s=DQAugS+8Qz(Kh)?qG~Vf(B#SXet^4b{cRgGyt*pv2-@OrgUjkT5V2CVAFxqtzy9-ld)8TwGkhzljp3XG+2pV1Qd4h?j^ zoE6&S&|Ft@TJ5kwDw-~@D`gAJ6`9oMRhG5;amC}IW$DI{hglwsTE*XGzJ&nbIo_JC z6}q^JTuahZT-a;TQdDku+g`fV^UWSHVzKaRoV7*Wt?9PUQ5ID-L##MmpiZ{5FP>e; z={O8y6%bHyov`F}Ao*)`V&aM>5X`|1+~c&O*!)x;3d- zmSz6*>7x;0&SLBUT^8JBIK=zo$83RNQ!(&C)@3G+cni4%!~cO@YTS(#2b>l;_EA)N z8sLVDD<&@9Mi!K))?_w5lUQkxN8%B=8%Lu1o^IuU^<(V7&04C@;9)mXsj$-9CL^ms ztq+x7CPzWExh3yaf%?d;aDYRq4JB;KV}}ikn^xnGRm&fuhS@AdKI5@CepPm3>0slB z-QDy0!4hzqre%4PX<`k-$wb@%U1WJ8_hg((^QJ((A;ItSo9&r>gvdt$RyfP;myjNr z9ioXH)P2afSGnzziP)O`o&|h79v>ectu;c zc`wcuF9+V&uV37b@lIIRAth}_jn=j+9~tzgY&>q0(<(a5S9N2{{SFck9E9-=?o|%{Zv9>JXlKjs5UsOB1N#h4(FU#Aj4VqFvSp=7x3ZUo zn*+Qlx_H^h90nv}0BHfZQ7VzvA(KJ0B~43#Nm;`{AZcClJLaG00XsRhj{L390d*Dm z3MICi$gHbe58?Hdzwr68F ztra|oM+-LXd0Dr7Uk4?MA_7C1TW>{aip268wfn!jv^~a%@F!ny3&Op*!OBT(`s2OI=cAR`oHGd_L z?;t{wZw|S^!xpC^9MF8cZQ|4%COM!f6Sj1k=gsMKv?qC085XcIxZgbmaxr&9+)*yw za~rCPg<(%W#_N!x-0>d1Z(@RuL+(2Q`hVQ zLv~7CwZwtEnXPFIsUDR&_cUoW_@M!0A(L=^3KW^Vf#nS@3OlM2yen%u}&ddYmdH(U^M=H(GKT?8tA9=#&OgYRsx3g)f-KKR;*yj%){%(GljmTW_)zXwO z%WLk9#|MK8V~lN3LV&YTbTzHqHFs-+y`;*xV&OizX7%sT@Ndl8K;0pJ5s}IOf%#|;#B2>|NQi6sQh=_eJ_vD@`}d!#pquz%kr7b?H`XP+H=m2BCLcc z2HX!zWEk5OB!etbKn0AOS;o0MDh58^?p#stu>+f{f=fv=ND$ zw2$n67(0|a7N>I7R>?5Lp3cUu@t;K%B?#0Ao5hyb%1GDXjaQtV*9YF%x6YoWi0!6B zDWhg#nZw~$m$3pwYt#BngfOw6N8=RI?i&^FC{;`vr<5~rk?>9XgEW(o3&$*tZOdIa zL11d`Fv{z}BhGRT?p@|=M{LI@yd5xH6Ioz}-H1L!<*=soVG-{sq18{#{X|l@h_^l? zJ-@3nwnSSE7%r5YeMR2N%)J?xGkZ0kv=lyUDnM7470CHP+tdn-`9K!44FDmf!vFL1 zCaaDRMyO@Y+t@P+V2)LW{w{YCgNzoi_%I^^m-)bw;c~&W#X`tWlI>YK(iCARp3#8z zPGQ8sS3tbYCqFzqP%_%p-cCkt#rU9t#7%3}+7>o_Pw=hz8#dPS-~RSrWg6>03}M}I zceBH;iLUmMHl*aV+XH8X<&_P~G{DNOL;nkyFGgA>Cs&92R(Z+hEZ&o@7P%yz0}VwCoc%vxbS|*UrNQEAszh WwrB%B;W$D70000 - - - - diff --git a/web/assets/images/nvidia-logo.svg b/web/assets/images/nvidia-logo.svg deleted file mode 100644 index 71f15b53b..000000000 --- a/web/assets/images/nvidia-logo.svg +++ /dev/null @@ -1,6 +0,0 @@ - Artificial Intelligence Computing Leadership from NVIDIA - - - - - \ No newline at end of file diff --git a/web/assets/images/sad_girl.png b/web/assets/images/sad_girl.png deleted file mode 100644 index 2b0925a63cf0f12db8d806f4fad64d19afea2ec8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 177633 zcmd42XH-*9^fo#tg%VomNDW20fC^F+2)$T9nxF_M7C;oF2ujJJDA=eXHabd|A}9!$ zp!fq(Dbi6PG>IU+Ly~jzfA9P0-uvaQbwAu$E9;!Ivd*5#%$~iU{XCPq_9v`(aN;-s z0FRBexdQ+g)-48bpjj8|Pd}?!7bw`l$`l&@qE2Exa0Xht1p~k(_&*;AJbNJq0BXVh zn3DzTOZvaU(dYj3xqSNkEBfEu_Z4553?_mw$DaE!8Jp5FYV?_G`g9iK?;w5RnUu6D zHOqg{`#gO#)7aFy&(n*(F~`_l{{76y%<^b+&OPNvZwHjoV`& zz$eTv!=P{P&iytpFdw+!P3@qlD(f8FZ@ByX@nqrEj%ybEF^=y_|Dz8)9!d6~PxSS8 zcp9RyBX`}nIfTE59Tmn2>TAKrgOC>kVCf@Ezzq(acZlk1lR{tPlz12}eojUwyYh$u9MteWdvAZ5huyI8FP8 z^yDC&y?3J1Jk+G8KEKbg*M5Ba`9MuUZOMO6!$VWA`NE#=e*&(DIJ-pn-&F8P_LUcF zFU_yI=F|86SO4{Z?&7T9q)2Tkg?pC!8uDLm|Cf}SnD_0|V5aBk@%%_mX?=bR-v@5` zp_aOr&IgxVJ@%_2J~P1j@AsluBe~afMoHYcWP7WCG5W_uw}Fz-Px((?rame-Wt+Q0 zPtnoYZfkjAVVbyKVPfRx?8nsNg648}*E~{m!x{Ijs+@?4-N7eM{kj$>iwfTzvv1D1 zn)G|A>EX@!(E$ys3kFG5R?b&;*H`9;db=6O@yhOr?_Xy6dq$ed{R>);UcK)e|8lm! zcdEN%rl+GIGNR)4?cKGdYt6$iBX1SQ#g|on{!v%e{kHN+OKcm<<99+FPB;SO|6fhu z|Ks7{S@sOH5MN_^(CQjim{xu_ZPJ<(dH26>( zQRYF^C8K>0S4(1^+T}UgDb6Kw`>5iM8#Hm8sTg*wQvDuy$(E*9*S~b)`O_rHf+Tht zHU2{U%|hb-18|?bcFE%(J||MQMpmHg7fnSyGAGiD$S*eRw#ow{7V9?uLFLMEugeBB z_kFCoe0K2tLd5UQ=7EYy>iO2Aa|Lc~(D_y?9^?xxPZu-B? z#{J)#_wd$B^6E@~G>@dDWLcbVPWOkA%9#HdK(|u7shLz6Lsd^t&jpP(<=_rt1_vIA zqgCC&8ByQ7-k4+c;)-?Ws;8r#c+O|Gw6rWw_3W3yvl*DM#?BgfTe_7MiAa+aHtQ{8 zn6k`dA7P99*eYwhRQbPN4qx#RjqfzON)Q^i0+L53Tl~l%DZ_$@XXl&WQ@96Q$w5X` z$%Lc}|HZMFF>rb=0^}Xjylt}xON%oY=9eK&K*7RslY3gajDTFihUCi6k}#jzichyvcE%fL*w9%)RLG44~lSHQS|7sDm& zn#arleZ6d`FCLzB$!c8K%7e}zuoSm={-{q8ZTDiGrxj5rPsGL)|(_^XDmJNu(=O1>Av-H!j*AI&dmhkk9s z^it4biR?r^UC80b;1-)BKOulVC9?GM;r-1_C&n!#kB07u@UU8rq z6F6RX`?>$#phBW>5t|Nb7#S3-FCxreWT!T3zW;+XjA*9DeU^&I9lKB33|7YDKf~i+ z$amQ7m`8(-NV{`2v}UWAB0{Ys1)!*cO6+WOKkE+CxQuc%i3?X~0&Le334QCWo*(0s zn8NzfeDC3}CR;hN3V;oqe2NtF7I#hG3xupSxH*h+@Dz5yq%b&(0i%qOrZ=Fx10OA9 z8fPpSAL~V&z)nOxP>^_#2ahQYv2|}(bWKYMW0x)@`^g;Xsr+wwtDA2VkSKzkyrl2Htm0DBd2)zL^uy^-9?ZRvLK2pxQ*qCbd1tF)-=!?I6iP zj_u${p&(HmFr^1|G{6@&Qn8_A(iWikbAicMh8~%doK}$J6=_Qn#~@<+6WLi`a8pEE z3sJbRxp%mTHRIy=JNf560Wgn#+y2Th;+6$Jclk!ygzM3I#l-wckp(2<2;c?}%0Y?; zVf1=h{8C(WWefhcVy+;!zd?wPW2-DGT7**Vzjhmw;Js7t#Ej!1Y90cL!+MsRY znVosi<1=*FYb3#t0)NHsxa{7(u3*S!n*V9}`}Mty1W7pJM$Nua@FYJ@P82RQSJsZN zsk2mu2HMB%s@RD*iXmt_Pt)4A=ox=+x0NH81q#2P*sz@B0na!)umqL;UOAiRA+6I7 z2mYE_Lq@}^8Aqq2VekDRocTU;e+^H>lKw&6u(;+8z;S0Z$`#`M zjgNV#1`>??BEcQxUH4K~U!RjT(@732eEHH-d0j_{K=IQvfRh{u|t#W za;E_A*)`dnob1-mWFNZbACl@6((~nSaq2_x;71IxK8K5#cD~&RuNWY5Yo?IkHI@f+ zQ0RVSy`-tQy5DTuNPpjT^GIz*aPtM|l2XynM4)8>EAUXT1mAO5Jx*dAi1W2}0Hnkj zNKc#QIw<;a1JRRW=9uyUM|;##+h|n}&3OhSa#B$#O-tLj<2B&PvD=PL&_~F`^*Y~@ z*KK2&w)D?+AfMEw-muF)!z@I@-xfbS=d~*Ns~g_z@x|Gem&(dL;k;+J%z8caF)(>e zIvXLR$T2>Y*tNvL56DQ2qPo zK!mZ#eMa+lwS8)i^?V%06&qocyo99aZkdawKmkfaJ&DZsnz;#hIp$!Pwzz}aWD&V8LtcWAf}F_OBTODPWm8xIlm)JGw;c#%-)gqB0NnPU zxb|`_J$44BiE5OC50gU8vcNpEC}N>8xp&P|)o8mwH6=~|=vJ}<1>YdG`smSxOw8gt z6FXLZNumQNn(ej42D})o7v=fxIUiEr&z`ARl>zo-f24O(80#k zzzvfmi=Yh)Z01p_GSB#0eK5T>w;ek%CAXU*%P$G)~n zD|Q^?YCgwr z!bQK2IYj!kknG1)vgwyeT6ff;XChNKjtUd)*_zP01SGfw+B%{)cqZ|G*?9_Ky*%u| zv9D5Pn`Hp44YYxlWx=YbXdoM2g?LvT$ON&c z{Gy=nZ6r59JskDI9QvFEt5JIICMAXHFrbhgzS*sYW%&(e{baH#d}t$c%eenaO`0_9 zqy6LHq{^2J2YBzP22jpJglN6|VC(Jp;jzJ@4(Z(RZnk>Vktmw$<$1GzO3xA9A0?#H zzSZYxAD={9g4x+$DHD3A#5)B#ObL^14m^(X(;D!K21C|2=r4%if#UYSJA+xsL#hfo z+=V`3L4za6=RTappVg?{ZM^m?OeWKm^lcS0Y9$yc29MXXpszT4t0R;$28B(!S}{fbZuj;2GN}cIT<7km?=rpQ6XW{LYgUVZ zfXx6;%7uE22IswOuDwN z;2P5m4aNLp9AZzR&&|%x4k%HZIv_7}_fLseyJVe-ScrH{BORsp=jmUaXx7Sin8Agg zH9ufb#Ph&l&DnrgeIa6n5N2b_-erune>d9UG>(E&4#1X9(1iyauf4Q%&+x-( zsovdCt=nF980%F>zRG*nnwMzW_tP>UG$jqxG7e^_Qp)&yrYF2V4k#|g7%Pyu-i)n3 zbYCp$T}ZbF-F8|)%O34j&Z)QX(8xhstTC6TDmBh&P>vT*l3jzU)FbeOC@sf_; zx|90CJ_tNPdUmT*Q&aDrJP*CHHVMa#lT^Q;|NY!_;aLG6>-wYTCBK@FM=Hq~R}K58 zFm$hdmp+9e8H{*yGRur954pkb19G`5+3Z)5Aymp~f;y&78)MuseDL;)ai|JA0dY^*4oKmq5QmS9v~j$XRuEzKtaa|oi_MfeeO;oNY_xB%9JKc#$Y?}6?l z#fI@0IkXkKV+W^BMHsvkCo5xQ!zxg^tlJW+3 zFh4EqZhu7FPqTAiy)ovr;I4Fl5 zkpv|N{xWZPawKZx91X#;%@h?pA00{f(p7`##zxKXBM~n#aPx}BxG_Jd4WoRH3xX|F zA+0SFV^Mf29@0XaTcv2rBXbx~iA-iUKu|r{Fdq@1Koqi{Q;;av zv9)V3!^JoL?#@4k^4zAqj?sOT60r0I_F^?>3z=lo2@&Vw~PRwjgT$1vdJ z%F%y=3*%p}?evJkB`SYasisaS_q?SX4kBj~xOdO!Sp(Th0C+#-3;CZOxS@;6#p+;q zZ_E7^6GHI*M|24%0rLX*Qxfz2zi6Os`sdx{|lLRu*MNDLPx1^?_1D&@r!wuwkr1FU40L|)uk!?Deq z56z*%8~hFXpD;~@y~eVAGtmpiO=eqnq2tT*tMY#u-Seq9ZgU*p$p!LWCB}psla>lN zLHlv|EGshHLu_$iMFvMK6f=P3Y3K2iAmT5x#gc~*}yakHrr+;Mg+Pia*mW?lQ z{zK}snrulnR%JOSDkVogH1!3flFt%ljWw3`B%13szm!92ly;9uF1Z(%4EK06o#r+( zf{(&FC^#v_9+yj-{T5RF56BUz%|x4f8YdImQCj=Bh+m8~c=Kkx3PI@3hy6Mk?t7{N zJeTuKoURK{i=bo)DI|*h-Fj}iQHwDg#89A)wJp#&i?*3JHVUdLllFt#^ZCWR-~vS9 z2SV^kbwIn}HFso*Q9F{HWF~VKW`W95biNI&wi%?T))iHwU0!$u@6(A3Y*^n5S^$z6#cBK){#3aK6PJWf@^_ z19YKeo&gQ_2_*w}L)~i+rAHEY$U%L{YkE9k>(%{H|DJDf{43IhK7m}V2Uvn!Vh)?y z+6L(niiiq~{&=5-L)AgtTdPL*?8)jpZ)uKRCvc3l^JktZA{j|+4@5yz_Y$LpBVi{6 z1w*5REwQCwi~%V!H2DfaV6<>#yJsNB_Vmt=9}3vSoW)h^pT>{*+L4nVk&kfr#k}~J zq_=V)K%Qv^aj2oXuT9Rh+T2Srih|lV)a!S?kY4q}&-x#kA{AxwI5;Rq*M6`;i##&c z>v$(Aw0nE4<+Uq zAiajgY9JpdyP!kMz77)5}!GQ=OKeH4#~yFU-hB!Ph;yvaA{J$4WW*%0UpPBtDGop|# zvq-N3#VouvRhTF04Cr(&ZJIC`g^wWTs9PDlbEQ`Un-)*Qsv9po_)d^ck zDdjZwk0}b^swyPbAZuQ(sIcw$Uc}3=SKj(ROy0U%Q<3I{H+SMf4gtj;ODX~9AF*o|mv?1Rm@~oJ>GZtWB5fqEK z>iTI$Kb>*`D-U`O_3@~CF3mm_WUo+6*J0Jy7GBMgY`M?iclmLYar|eZj4^)eDl3;| zZE~eBUuUX zTfk<;hWxZO#u7AL6_j=Xv7%9CF7#ItA!ks|xGE19AjZMHZ4shCo7)}qBSl={qYaFj z{G+4Mse#MLqXOpp_kB+7k=)-HwN9!a{CuOI|6<3I=e=czpi2=woP>MqS4`iA#hQeo zQud+ELn((-KrYKUWX?lkwYxXf>}yb*MAvI<7qGdl2jw@+xKi}Eh+&*NbGNpMfn%@C zQUQ@;>0nF3XYzYGi)xVA2|{GegV$_A-0ZVm~1n?KK4HR*-=W3eQ%OgM5xHM zTUTU$@6J(2$@?8Wfm0D_PUdQN=8DS!6w!G96f)%_JJMdk7AG@?7FPncIO=NHenyy3 zRpc)+%Iaal|j9H`=mh8%g2a)xAkEWQ|F(Yxo_y zFdT5g3=5(?__8^S*SYe6J0rZFuVnN3W!vs`P!4tbQ^{G(Zx>DU8taYr1|J+Zb^?xP z$ltH;Pu$9RZVw7Ma+Po7;NTvi1tEGF1J)PF^FH}ME>R&_)gj`Q`dog>QQ3Eo949P& z=-|GC-{-R#BNyWY@U#iE*;=SE--VSkhSsP^#+`mLURpQSe54A!jF;GLRYhNKHHAU{P0u*&!%LO zx}6(#tgsR`?K$rwZ``QKbVr>R6Ch4Y4kP{gtW?#`Pf3yrE@%gliDzOWy%GVyO1myWK_!Ym|RX^r(d5xaT~vYWvPT&zCyJDa?Nx zc5<*DWSucblJ42Qq79-h9XLk_W$b7_MO+H;*2$XVy)DExnQOnaJ?uk?3t3t(!*Gn7saLJ^ZfmS?(T>1`Wb-M(c_0*|&UFGEi_a(&oU zF|8^<8N_|)_A|bm6z^&ZYTg)z&By6+UO4?2XsP@aI#8e?Y*nS5Fnyy@iEJw0YB5H5 z2hFj8s_kYR+I;&i0>wQx}91NNjzm$ZN8${9TB@BF4TG zu&^}8Q51E37gff1p)Y{q0(;h8iNFHB1~k)`TITF%sljGt?Velt-m^b02*RQV9>K$B zM9b_S2Ielhy@jNt&S@XM_+hL6yd-__;z{dmlKwh*e67?JLS&js=L1 zy$nb^#{Td*Zxc6Uef+4i4Oo76ZL=@gv%%ihUM&33TZbXfyx6Yt)BZ* zz}6v>gJ8N5`_dNb`+85qWf+};hv@_XFc`Vrrdw*SOkKS7 zSlrUUq@5&Yw`;J_*@r=n?Pwb9=G08Aof3j^p?OW^N{YsLqU z7tH6`&m>IIlBbPbz`kuq=Wt2-We1WkZR}VBz<-!#P_8e?{D8b(-@qq2u(=<|7lZT5 z1QSX?e340_C)eX|-SHsjN+$^9);gu)9^nJouh^=5^M!5EQx`p%zeS5Li-j0Tc%$io zr+yWhk?tTrsCK{qlGHL7>G9?czVx~u2Xy6`R?89|;Y#MbVB!s_9BFeVJ^;TK$Ko(x z2ACv<#V8)^Lusuv(31}ArzCzIu-icUYIPqtBwGgxU)BgiX`Fg+0+b zZESSZwsFCc7A%=V~pdty1$2tu9; z!2ZWERq`UkA@Ll$#~o9ZV}gxfcow$ACx9;4y*+NPxC_B`=IQ`w>L)kTU!C2EO2o1 zDvgvb?m$rpxu6kVA+J;A#*5zGDA!Ve|Go)ncCCP8ItF`YGACp)VbPKiAE}lDr zygb4)iYWQg1C-a|X4S$mRj<)r2SMpUI6ql&q+5kBixI5F`7;_>8@RsyP= zOX^N>z6BXid7Juh$9jZerwUNDAGp9TR?ZZa)1>uS=OTW)8wcosZ*#NhA4Te1v(#B8EL-x)=G$4RI{%)#AH96O{%-AaX3+u#eu7$h>LIAR+B1Zrg7CkJwjzR z0-Q%5vOPrfhPpdlnb-M3pov~#_K>wgrHVvJNGl3hSe#mx1tP$VNbM!2N!Ww;yl47R z@N0}cJJgWf*bjvm#_Y#y*|_E{vDt()YimehDS z;+uusjnIjoM^XUASvX5{%X&$HT?jT})ySzJ@^uL+_uk^RP_0C{i(od6@Y{;~O}I^3 z$7U@#fdA4yqKV1P6WfelXI_xY8IF5w-zG)SyY+kF*f6t95H9^>Yyn(;A!WLxyU5c0 z83Hq5nFm&ELdMp;I<8=0b&fiy+Y$(pM$BKun6qPy1de>+ua03>sRL;ibmy*$pEmA9 zeRH}aXAe@aM7O_VwF|YpgmZ3$4Y1%AQYMDaz7t%Scoy`w9SrVx=~U#0DD4I1;D{o# ztfU3DrPQukRdNxYH}Kj^Ktc~&&qo}}I}GJ|u5mTt^}evgI-&sV zAqQq{iGQQ`vfuDLE4P$Hrwpf(FAo33LMxB(>%QO-ypmk$q;F2;tK4wB<Be}~G9=hzTtiPi1IjkA z2a_BhZV@U&?6Io8>!A+Ld54Pw5B4Wh-7IY=9D+Y+>Yd`;$pd2CT5RF879o}8GEL`x zLNNyVAmpWS* z>FJIq4?vPDIojY)jWn@{P0IumsB>o)EZ4!~MqZQp6oob^3s8O!-9CT=?z}B(6i>7_ z=;I^o>zuCq`bg*yZ_13F{Z3g~Y@s<}>Zr-KC$jPPu=DwL@|}RpJ>bxw)6JVPmcVI{ z^aBu_9||9XT9-W!c)ArcF9)eUSRrvEY8QCAE1{IPEPcO}gBn@Bh_`{nJ}pViu=-|s zwTT6Yy)FyWKV*h43=>ZYU4(vx#&e#)OkZQw*Ep$}{n2#E`|{`C$U>CQlu=G)5YW4+a{{Oy z37e-W;Ku}?r9Jz|K{;RworSC&&x+%7I2A;^R*y!66*R`1W?fkpNi}V`wEHUZpb$9D zM)U@cxgi&rS<;biw|Bv~h)QKHY9Yttk(nn9&rZ}V2b_jt9iO*2<;^&$0JcuxPfmRT zX;SvUpc)Me;Imv|lvX|qG`vSq{a6Weg#BT+>Ul20n0;2w3+NoDBuK{=_Qt+h6Y~1H zifrT*m0hL0+u+S0t;jMF9S`8N2VCNyc5s2+A;-dP6zyNm5@~TtNCRk#9j;@N_Os_o zqG~Qu4qMveU>s2tM9Kx$pznYz2aXhb;KQvI^m*YquQyljF~(z;Au~?Ek^!P1iN6n_ zXWA^5JM%_PBw|~K9vb*nm~!Iz{DkM%{fx=Oz)1yucwHYB>fcWZ@cJ;@()-a^A4%9m z7!j;0U543PvVz>AUq-?H&(sFYS;w}jUmKc(2ds2C;4`$r4dEycm4#s~5x7e*9w_kW z;p+srsyyyOkKYh=1WkvoCaG}z$Yv9Ol!uz8sSD&6^a=NupFaHe_EB`>vezNHOAyJPP*YhZ|URnJ|G?f{KwHV3D+_CH&Eo!zq0?iPP%ve#lmwx;|*v+2nZE zcNN+6Gp

X8yjh)A)V*0&*EkY(&29fid31%qX=vIlHV&XC1y2+|i6(lDP=mGwj;2 z4DvnXz7q6iT@E;5?H^zWk`FDTK>7HmpO-Pc<)BqW6#kXkm|<#sTGNs5ELUz8|9>1r zaWxPmm+~D&*uwz|#p(Hr7{ap1jauFfl zUdb6iOqlGV!^or=$T~rllCQpNXtg8@?>~)(t40<QYfe}7Q{F4O@}g2uFX&yp8E@+x1mgwZ>1pgyF4%#+yaV`P zsPC-7ZehljOa_v|kO_;GI36cky(2e8T3Fe#OJix)rK*HSsA3hPSoT=)Pf>?FI9||U zqwfJJ7_aC*1z{!NLfb`1&0ak4wRp6i2+-Ac@fhHTnXd~2povRpYY{57^LHir!|v2K z{bFz>U&m|okKR6K@LwoY90dE`!sX^8H3?dZ;R7A%ijG5gWUPSxZh}d+o7_NJFM|tl ziHqo=<&)(yzj28eijZ_|MYGxS%Y3)xIBIQv6E{;qQ^f(G3c(^&+n3!J>nwR3ulcIC zf7*9Elq2QilCcMP^nnn+Z#Rb|H8GVlR`NDxW2#F-ctp~fq*k;KU`u6*ZqLNQS@x9D zaU`G}?boh3&&sMfOJm)81k{Wl{zNkIaN3q{uEpWkoq0!Fs({!>D4L^+%?n1^D{~Uf z_kq15lEiDTFTWB9x%Kd*U@iEjLN(L0?eBafQVDLIq_85IH#Qux4SgvV{z5+PFq3mR zabaDl<>b2a_N6a?hJ#(8K7RO*VpW1Lm|xIrM9Rx!zbi0}k8Sf&nVu(??NKQez3le2 z-WSe`FU#;?bZYMs!#n;M7(dkFq?{_?ps@G^+cj*i+!pVWMJ`q=PmEZKVOGe(mf*(( zhFAdt77B4ozQRs$o9?xdkonH6*N1iH45Tg425My*oy?4R=tl#mxfr4=E+W&_?t(&V%Lu;2SKQXqP@m=B@dNu*X3a$Rez)aweafOI zR}#!?kT&mBNw2pa82C;MRfxFX5BuU>OiM<@Wj$%Z=;gexP)14aX~^pk=>@i!BO4tf zs{r0y^VL=k{<0Pz2(q-jUfr-&wm~-?J3`skES1a;xXp8^&0unR{sbHQi%R+c;Rc6Z zDU&|<{W+JkEpW&%CC~#Mw7ZS0bp8%HR#LQ)Vj0am5>$fl73luHV6ls=Y*o$xr(WXy zd#^j!ucigTJtkmhTbB4^vIyXdrt{!~EQL`d7zk%KX5>X*(e`_yYIocl>ovS9XhzDw zrtn;6l~$KyD!s9K+c`cCL-$nSx`17=3ydMP%t{?*_bX!3H7>-y&& z@->%CZ~&F^QUF{;E^A=U1Su;=Z9PKLj@pZZLMK$zhpp5jrCeDLWw7lrmyzMHTBRXfYA1g|o zEK!G>_r_Zw!&cKW=N35Q{qw~IN`Vx3+gMJyRD_YBqP;T<8$1(^5B~dEREFJ1sQ${Z=UJ+523k<_}|$@ zP98wITqi}P`tNR4dUCkum!g|WlR(nVsx`?qW zZPYG$6ecl~ubh}so8{9yOw@X8kHTTAXN?h_J)jsU^AwMhUaSlv(^$p^P z&sc)_{*Mgga4X6BWIb{?kVzU|J5>t%>{)75NAABq5hC0xnfv9i>^-IxDL_wJ*MKeN zs)qpRDvK$5bGd=I2wE2lW+dpXz z#Am3b`&SA)R^6=HK-KyeR3K?V-jWsagek$5rzN>r!_|8JCiTxU$MnU~wg4B-fvbM! zA^R~w2LdPM`TvT(JkMawT-25f^NeMvkrXXu?8on+a=}sM3y^U&@~m&G|91 z=&H;D5|a|X&=G5uj0pS9ww+~j7Z~G6?10Y;vdSKrk6mMb1U~Ehs9E+eDCoMBzQ88` z5;g}<6Alm)Ct^?)^dI?ga@6iMSqmoy_U#)vh7pUAqi`c8F?p)bC>Yesdce zxhEg5D5Ou56tw&|k+It7Ihrg7#}|RGc+jk#`*upM8WirQ7h!>ZBC>n=It1ta_l^V6 z@upORDTkfQYR<4YI?(^s;-?9DD|?KWj)gh@kq-|0l7!9Ln!YP~a^so1-}=MGnorl% zqo!^xxa5Due7ySR4fbitkB&z+WT!aF0d;U##JpFy-mL~~sZ)QdKCfz$H5nXf6Qlfo zUPT^f7ua+h2^gYS1LnKB^#{SnnCh8hVpm$(AZE_1Yg@h(0+1y&e5OltF*^Gd5cvwt zp2c+*0+H`1)wJhc$f>dSrmM*Aru1#P@q;Zs)v`*uJU>!r1(ymCnr(m{Ht?{iBd{#1 zwiDXcg6rTU4PRB|*BDdO(hZxp;@90+8Wz6T#FtVK@R2|~Tleu%zPbt+aSEmT6Q^Gh zEkI!$C-q)}Ih-9O_d zu1b-q_-!Cf@G5&Y-2A){)S_~Yxry^YKp0&r{aR!7Zl=RFY5Knm$r?l^%isYHRAMn! z>lwE(oW$?Uocomtm(t<-|EYLx2-$>EtjaCDYaN9Kht}R+7LxK&&Q%A^=D_D*Ri`^q z4zw()nQ2{1+&Cc}Z$kX#a5i7vzRt~eQ|*s}{iYbGnPp+Gd#EN-b;l*o8fq)YyIsE5 zI=ZPC&nu3>t9-`VI_E|MhN||NTJzOiM_ zqz;R%%3$GK2R3s))Fcl}2j6|}gYnWn(I_dWi9Rh@3{jMlF)Js+lTNZzTA|ad#~4{{ z5w8v9S|HIYkWl{hD5yH~ILO9Y4zfRiI;pr+w^`|=*&jYSE!p_?_<7@0==M72J5mSY z`0ypEkeBk0J}I>_sB6zx#d8xrT!W(fu@{Xcuu<1%oKW_;UC6O4;I$k~jQUfSUC2tn zUHnE(x_lED!W21FdWF1`b$g3RGUOuciwTFi#o?h=pXmH-*;s;_LO7OV(2JY64>kz?d~HqpqJ=Y&frO;N4?wXa zi&|?^Xakk!IJZ_C{GNyKG3t!6P|X|FhgW)-Y|s8${kpbyoN}HnBQ1R>lezrOczI?| z#3bLIM+|e2!d^f5C_SF#$f8O;YNpQM7%x$WU+?H)p>Te7ijb@NPpHu5jd5WSN6s%1 zG0+qyw1`A`Q(SIpoMUQgV7g-mfKL|)d(i5IS@K)vcV~AObN!UrVC21($p;!_#2#WT zzJp;-9-_vuZtP}h3(Wr+SmgnKcX!}WSPhjT1&zKoH!1Z7pbi{q(}M>+4sXw>KIi#u z;y5%DEUjlRGWZ`k%N!_NQ=0njBOc%{8So!}RK6sbK(@A)URDISo1UQ?OPs@0nS3WX zDF+hL+nKP9Rxmi z)nA~!2g}EYzZ3-gAz%s3|AH*E8i_AsZhXC7arZUuG6r75*t)S$Pi4-F63mS;wTs@J zx-V$;cF&{5C9WuZ@H`hVr^03W#(-d7a5KEVy88Oo%7E@2WHM*YfLRbRHz4!KPIiuX z2OB-!;yGA>PP#v{Ja;onNgJFIgSuT|i*z7vq*=XQR23Gz-_Bvr>qK$b9!n|zhP2L* z!WRdHP^D4CyV1gdJ^f-2Sc;^izQ1<(%ywPw74~Sa=f>raP#ziVahbGLmgKwOVzAqz zPhrMk-JW(di`-vu<_z0s2z9FxV}ef6TAEA6sO#x6p0&e#l7WwZ`-@!@*9c82X$&PP zqEhk%;Opw(;qkkI;CNB44Xf-Uht5rZ4dXV}en(#JI8*_=WR}btgTLu&do>1SyQU3p z`pLncvBU`8;!jAQ(5nMl&U*?ehZwzNWkX9}#EKJ+t3~;MTn1@BQhBp-_?OHTpshm5 z&rcnqD=L6`;i1EX6<^{Nwt32cCKrYFEs=F*f~o5PsTQ6m2%-JIe7W%Y|Dfn99HRP~ z=zY5^-QA^h3P>s}p_G(Gmq>R=!!C-%PYDI-QUOtw9Pp+de#lDYytd3j)?#>Jw!z)pb@Zm*#Xv*ub!duv zRPN(v8Zz|xLswq-kj~kHyjAOQg6E}opYaLqb@Ooc8=5XuvZm8tHs5LY+t#`HuyP#V zOCN*n`HHr`nMH1+v)=-f8HeXw zpE=O_^ypEIw)($@d6MLa#YKmz4|2jgkE{xN>CsgkgxtE77Y~TM_7r%5fC~2C2eQae zN67?fFa6e_x}`hSh_lJ5sd8a}PQHBykyr7kjM`}i4;Er^Dck1)2QCH{Dn_l(LR>>h zZP=bc{b6?gGaKoL0@@sT_%W}ES9UQp`g`5r)aTb&C2b-aD~zA2bImZ;;acUC7>++& zwFcwIInsn$Yl?;(@bYWSnG&5a^Z>xqkW>U#BJ1l!I%4JHO7BI085z0~7QPeoOC0cX>Hbe8+ojhQAPv<+W{HozsBay&dBWSsM0)# z*E?W&AH;efv%WtQ^6+wq4Q=~@dQZK^vrNxmu=u7Y?zD~=Nee__?T%er{?VJAeHUC@ zcMj3LzCJ&Dd&&@J(F59fTi9i?=YF1~mhm7_P3K@`FP)?T-a&TNYDjX9qn=TDfGhih z%7V_EY+-jm*;{>NGM-Tbt_Y4p3{4_}o7KEdxF6y07d(U^$+U*FZ5nwLZ`PmMs8Uiw zQ;!;%uefx;Zw@5HfKFAx>JYrIP|{;r5llF!`&?0BK3Cus&{5RpL_*R7kJ?Nf zkV$}l6ulZCdPpaT` z6nejkjJo{iR|GaDaaS)3@xiiX8|M7yY;G`~<1FN>NHw)TCfPVg87k*-tY1&(0I@(O zUj+k=5H_5-2Y>`eR>O@o2yTZzCl(&;7puf-cEKe{sU1N)!mf&HQGJD16G3hE#x{=K z0C3QNNLhCtv>EtTP%5cFz|EK^CF4YHuzklFNlPHPy)}|Bb|;3b7CpMMT6`Ok_`z8l zZ z7W-Orhhu@)yy_Q;?}zY==rT)1^M!+-BKGzLMS^V`e*Py7l@DRm3sm`|ba?`xudwVA zb@$dgUea$kPldVw31R5@W!YD&3|y>0#5=(l6?hYC=DJuXCE!c?aJVSf=lt75j6C-L zki;g~Va25hbl5|&u!j+to34I7yV!n(w=h9UOwQQbS)cBxNtE?rTDLD9!6Q zOP6=G?m|7$1b}es+`MsL?sW53%ioU$H|^44NQdV=5a>w1-0{PoF^`lS{Es8KW}5V{ z?S%hWYN};#-u$Sjc9`8;hA9H~Tp5tQ)aaJef+Ua;UHH!65eXt5X9V-wo&SX!ZDq$U z^Kys%tGtw88PWK zu&FT!!!OYNRV$R(A(J-1?`HBNOfXSkbv4t`lVqTRQRp~V^<;&Y!V zMr=WT#SwIYXg&h;8G--l;M2djAuNve4-U6Or=j`mxNqcg(y=uI7c7J^(TE4Hjmo&t znspE3mPy(LC95%y@zbic{g+@`6qrgfkiElL+hy}IqB#*?49c`fW_%uhqX%ve_f=XL zz(H&12vz5Sgq&-vu7dN8Pv)%HFjw7E5j#7Hl$tE(x@44^Z+LAaC?~{>yhXtj(9_>k zsvO*g!ZU1pWA_W)*_=4hCoFD>m855_Zmxg*r#+nrkRdAN@i5WNiVe#zY6rM(u(ivv8Yicm)qxg=`N%LP#MnPuk?amqay3&g}>ZFyi5h0bFOZ z;Jfb+*$KzvftK1+J|VL5tm;fH=pp0dPt?TN`#DJ)IqU=jOuhO=C#F%!C2@a_nmSXM ztYb20FWiYOuEzb{6rpQjU&@5g?-(!5;wwz@c3V{4i54V-4bE%*|6dga|dmDx)#Jk_YjNsn?PQe zrK)?lZizyeu~k4QDNuabNhgqDE?r|^#8QS8JbK%?b>$7?o}Kj!zZihUCVwB*w3jYI5OHgL^Con;+IDN-nvhLZ?T#7Y^;4{dzFFBOBt^dCp704V*v}sC#t_eQb-@DTC{o;%a(GQAlK}J{ zR<(jM%uJ=M-D#TMc4WotEba%S_}%lo4PoNcg7&yVNzb0#z7+k_BwY~43SqbcKGz7T zD{4K|B^RM@7bChnFv^Q3(z*_4H;z$d;ePjUT&p;2wo(9R^DeE1(Qll(JX+)biPMR| zi{K`V7mE3p$~x5X<{_pZ{0B7nZ{Jb}etpe}93rst3 zj`bl#1WMOY;m%?0LJqH^+1-0PT%W^0Psr_7QL1fRP!N+&W0(2Otz<-=xd=#}THk#F z)m0sfj?q-E`fQZ*1E)Ky9gd=UeXchAl#hT((*#&Mo1Ama%kl50S zs%V1+>>M4@6-;)SOOKH>z2@(AY=D(V_>um+thETQU?aoye{*2K$>qJ_O_}a(FS!pr z5B`ll@GfazZa>zy6&`?|{;feM%cK!$9-!o*y^*%;!Pd*h1cSzo)qRyE_eB>n>PbTM zeXyc~xh4pc47$d<7zbQQIKq(iEEv|(bQ2o_B6l^g&&E#5D0?&e1^fum zW5;sWpgbX@Zdf>+2A%R)k3NDN6PsC-Ycivke^uAHPen=mV09$mBRzp`ZKMPXVx2ZO z87mA+yh8zYfP5WpH5GNbs-%0MlIj=W!k}zKOw9$czxr`^l^1WIas-#mlS_MZO?x=v zTg`uB84_cNfI4=sH&Eh1D)4fxx;cKYE-o+t+qMhhw?Y-nU=gK=jV{v12z^2)h$ z??<2U+zMTn;ugLWo_dtBU~@wqpGcbL19e>cG6O6>!H}BIwH~zdL5V(~RiYW3d)ACi zy2i|rQlJYiws>LX+o;7d0+pV#-Ru^jdM>ShcNh>wcaWbX<>N1fpGv)ZPzUqE`AVpq zt}+Tl=9!)<)g-uRv-;Yo#x5hTePN9ZX4URh=jyzxsT8aS9rDpCWHwF!A~GEYk}%$BfJjvyH1THf*%il0>}!5XSBz$3r0# z7lGhdw3KM}V3{mj&lqhy9D|kXQ9}Al#2^#hG(EDgD|L-%uT3uw$b58I%5;q41KTMl8J6i#^dQW{ToMdjqaf70Li=)NQzL5`B~vZv@SnidWXN@jIt?A&HS$-_ zz?Qt%T}XD`Cq*_#@nunio=a=08Or1|hvy}@{u1^6YZVXG&fJ_KV9k7_03H%~6*7kB z)rXjf02UK)oeFIpk(bczTK`qSo!!GtW-{C>%w$u8UgEj*%jI>t?7-oT0N3-}jVMC` zWI=W>F`?hNfizlzV-}B}-5FMJr++VS-HoZ4CO}3SylVt>%xK=hSs88U16#yB_gjea zKYOo$h5I)UxjV=W<^9ZUc2bc1#}`OrhMxb`b2=X)EnvjyRWG8DbekaYtBoq)r1FTLd_io^o??U1kFq?D0o~b~nulK^W_er))0vE*)TIQZ z$kSJjhcO__h=e#t*saBC0g13-yHJ=S0JKS+(&kj5FA!)J%0KvOvfm{n2(d|z(z7Mr z&6$rz?+DBA=>+BDpXaQO#Hv%=4)-4jDe4vqRvVp&zDg7YRVtrFD>;Y+*DCv4D^s*{b* zHq41SFU*ULZ={O^9FF;{(4nuCa%Ys5xtV~Aot)ILI}K#mx-W{;RZfrtTtA+K7{V62 zqcs42hV&a&UO2Sm*bp&fv$(i+jqfS3hPMCjaPan4X%Tb%b1}^D>HG|@Ihbaya%01k zuGC3kvii8T?NYpDx^T(&eMI!2L^$}BDfeL%^^iPy^6dh}MgSuT$hi8kv)G=ZD^@)O zS$Jwxs;&6mp?@Ot0Bc84G}ub1j`s7l3afQ-^kns@N;4RQL5VNm=AV^16#1`xidCK^&02GR;KqvNOC+H{KbFxZ!wh7%UiiKv{!%9TFj0mp zh)7rX`TAY-><@Zw^Elc#D25JQT(R*4@8xn60;I+vcYJTrD-ycv$R*ymrTBsr%GX2p zKu^1dxiYl}@9}vZ8*p451WdsMIc?I-Rm{6ezdG3CBm}$vQOX-Ewl{a$3aypW!6jkn zER>bia{47BJxTJonx>7y_)n?8*^%;Qh!m;rF8x#N=SxH&BbpZkiJeh%ho$NOCmO@; zf`4RJNw#RnMucPYUo@EErF{-dx3VK&za$yz-7l_Jn+|rqZq+XKz8W!sm2B zg9eGz*N=?3GFK9vNs3_Wm(Dcu17gXT)6dtL*n$$e=rl}-QyzA6ioXZR$;s=)$RCK+U)5RFf+fa1P4Z# zZ)XO4-1@)^sXOU6;MN@!TRtK+-*+_U921Sx6j4TW>uRQB2J!vyeE+sXG94c2-?-T? zV6_p&<-0_n4RcFExo|iVU@RU-kw(}O8=|7(Kt|NCXhfx>D<5Q7Pu-JFp7ijERqv~F zx!x?It?zP9vWAZfFFGN|+s+QMsUKvazfe9kx9`UeuYOyuu%e87?GzW>La5i8Z=*`f zZ?HJ~oT$Z_fkCxyUqZBRwlU!Jx6;}`_C>US`F-!>vj2eKZqqdAAj4GP#o>HJPDcZ; z^1?Rwy52lYtGzLYoT!OKP%+@=1}7Od?xNajFV+ZmW5K=4-5!aBnMTvcXg&nma{P$? zwdKH`oJVcd=Xa;LI=OJ;v@w#T(r>&NCCw8f3fP&u zI{5Kdr>kCpx#u1A4hr>y??VRq@85u(HbHboT^*L|G5D=AB z%rQP%qa&&@;2ob$bQ7?56G%5AT&oZaEtfD=7ja`sf2-&rX@M$Pk`Vm;V7rE*d9u5zND30y)8*v5?THq2^oLq&UU%mdbZI{PH0;G9uNLUON_+R4u zYz_wIBv27)l;XRSSN}^_d*-3)Z~AJO+m?(wI~8m;0%Wk5dmL_iGrtbkYy6SDip2P3*|RT#jY zhyjVMJ2?$}Q&jBbsO3)BV#~91#0#51#Rmzur;lLOY;wScv-z2^unvO+o8 zVFwPGro+hdd#3Ke{~W8CT)HyND+t_N-PPWQaf$$ma2wSd$l&?(fBc_+5jg^}KhyvI znN_kFvlQO~)pR9>*Su8QN=Gh(H%6~V63;3v9|->P#u~*Bh#E2(A$9uBmyVNA z#qQ>OE>%7q=!}6}IPfg>7mUdwLLOrT$@WfrBm!CjBsJY3 zS$<{8v9C`Xa`u(iu{6)H=b`@jKoaH^z%ezze7Ns0;Wqj&%sE8!@YZ3sD);4QrPldN zRWb&&-^TU4>SuK|6SIj60AVxvk}Rcj=|O*BOl}l5C`h1YqP;bG`oBhV{T`*;zfn2$ zHAl3sDMb5Owo2M{fTWwg01H~WpnyrsPO3xi)9Cq=tGbte#3~+I_(a{E!)t6qO|TFC zUBi0*YCT+?LzVhJY(7k&8QkVHBH;N{hBM2oEwTRke5X~TXK6hZ`Z26xego`ZO8j&3 zXh`FPnNS$1o9ANIB1&&xk}gy`jR}%quF?@%h-7wTY!1Bpk;_k?N|8JSH9vN14qhs z!`I%WWTPMFW<*=A@Jb4TI784^;CRs2=s#|C*7wAjU9;;oqZsax6+7AQ_k2^V{eBJC zf=F7%-Rxd;AaJ4#)sq1ThDu(2C z?$sz5{v`f6;nZ{0ie!cMW;fRijE$|+W9O(L;+L?i$$Lv)GwT$Z)o-tozRrxm5-oXS z(WQ`JgCb1|0mdmNct#PSO#YOD7r?9pfeZoOVgWe_W26BM@A6)N$pwK^H8R72_~u#W zTE9_Q{`^+@t3g6^<(B?v&1-i}7|-6vkiQ~ML^ZP1xP+iN!L`F=g4yzy_qIKs5O7oN zZ@XO)jc|?hKP`29;2XRxURhA^<86!UWa*&G;mWzSnT*?Q*Bi?X&!ZU06vCbEIIH3L zD`lq}AGa_<+Ca8Q%l$?Y0s4*<*r=0l8!;q2Pk6!nSzPGavRk*@%T)t0$VUyS%pQZX z`iV6lL;K@ab*kH+o$}_l4pIK{q%d!v7l$lK`5ke~5|Du)^bIj24V3&7g}FmT>PSd2 zPTWt|+L05Sm&hU>7=TCY$y@`mrNqWe$qq!jk6!(D7X+;#p3)&uPHC84-4z|Q&Y(6> zDKEHC;~prwvU&O|%u#otu16k_B@rf?$Ygo6eHpsdNB!%Gf>A^B9UbmJtJ~kBnya0s zntHP)0}HDdJ^D5pT~yjv6@&IK<#L6ZV}mkttY$`#Q*(;(4zV&hlAbCr2)M(tSctjP zflPX`21v0iC`cVvh0&moHVX`&t>3YqacV_I{UT}cwY#AE1V(({X5l@e+plo_S0MpA z%IEHn-W7N8!4@!8ZLG&;?VUByV$tQ;@^HR)svRJ{sHC$8${8QCF+U_>l6RVEc%H6h zBV8#uvH|&>;Tz(N==oTM!L@Jy9zceS3HrLAfv?ESZ%&024+Gi9kL4OjxwjoNDp6I~ zxuoZVzqlW*x-~}aj1#A^vCX5O+B4*t{>8o_$O~ffIKNgK{*x=s(OF0&i2!)aY{d1K zl<4)xMD%ckDse*DQiIGcwA_$)i!OZb-hv7Wo2;FwWy5l-?w(D%Wi{O@ZGXN@_5hl9$x zj?TH_S3PdZzJ>NoH>oB!_Yo^kZPsI%Tnwr#B$r#mzdTa3NDQVoj~=F1y*zf+)h&Af zA+vkz?FCrbGRKZIZ(yKSCF$rD{c>t?A;|RaRqh!sTcY(c_YtKL_4Kv*^2yD(@2K}; z0rg*Y;|QMlU-BhDPD(}LY}{X94ODU{DKbo?KBR<@teY-QUw$9q0PA1&MP3I+yB*{T zL=Wv~Af#SIt{RyaCj!#!t?u8U9UniMJjU&Cwked#oa9lQI+$)uNXN~YZ<@w`Z~=u_ zt{=xs1weT1$^MPfvbI_?hpmOn!xOD_=qfZtvJquy@y^!#8dW%eS0C zcW*e(+6PKkB!M<;ou~P_v8cqoRvr3FOLr@B_+>!%8ttH1pzzUi?2jFo(V_Jzao+kz z7FsATVo?jYz%T$vWJE(6G}zWAJTx5XL~1XuhA|`yp_-SK<`A(=3M20Lcu+ zA3+0KM&pi1sA>uyKo@a(ct%)c_YJcG0v(kP3 z&(vrW^n^F-Zo7mx$2dseQ2k!Ikeb8cd23v_T1rbGicKmi`=qBz^k&LD_8ne04R%A% z>&uGu8zZr5Wvb5urUm4`{JGUedOqtYEu(@%PgEe(`SJXc# z&?V%an_Xm!v0&Tc^vEamT2k8A43daIt?;_zc9X$$KA)SS_*T@$yS!MX#uYV@wqbl zx9YSxkG3}%rCs*QN^X09c)#Rks$P=L4*Qe7uZNC{t79e(k384MFzsDjZD+r56t~1k zL(13s=8s`V^l_<0Ab(9Ls}OEa~sd$N`8apu}yuoD5+>%I5?)2)JlT1!f0s(#*Y9_jzcb=bOatYHGK!@|%wgEbk^Fct%A5Or6j6 z;!d33O~uZlY~Q~xDK8&-b>`{&gOSmT&C4rR2;IO08N&0JKpru-#cKvUf$>-nSe025 zgjs+IUKsLg#cyG-f;W&D^~JaqNQ8PLkSfo~j5Ra|yR3IE=MFDEBTVLFQ>x16lKj^= z@cEYnxhZQA0B2bIv5ji#7{M3EKM#K1Kt|o_e8B+j&yCJK_YWF73s~x?Zqd)>{;xFW z6|!0R#xsiuqI(!Y@MM(JJ-(WHRPp2 zFL9a9Ft0UyF>4)q`n^JB1;zFsE&}!BNxTh2)}~I1{LO1KMnsLT7Hi?1WyM+Pz@ysp0ekCSdqEi9-w&!- zn<;CF>cg7AR?aT0QMV7rnHH?JHtKy=U!~7j&z_ykNO+*Gu;;B!C)2K|^WL5$f%nvx z=O=fFQiyXG$*Qb9oT_Bzn@nAKw9$o+Z+&SxPByhy6<CE%vAz07K@p0sT(nNX1hy6&fc&Oy~r2`qKhO4Q`KoS!x4?_$Cf6ztB0juIJgu+5X z!?vye!crWe53JnTsy1ij;1R^3pcV!3Kru0D>#5^bz3ih}Dnd4yy0pjoN+Kcn}_I%Knx$IZ%XFvoP8uY?mo ztU^qzznpbazA0o-k_!XZbkTNTSzsWD_M}eDx<2<7Loyq_IWfAwA1ic$!94Wz^c?N( z|4~}1=%N`U{er5oxEPVUwWAyyVE=TH!8)(I9*0 z?!Db>SImFf6)$^Dlo(B#7lyhDWoc^-{6I1cI#tfDu$>GT@HdVFdVgxLN5u~0VSUxK zL(WBHi--5l$ZY7m?2_ho1HPZW=4)L3F_`@*JA31;_0mM7pV4raLlW}Mvo`0vr;Nmy z)>72-YE42IPI&uw-OH~;8u~~Zj}0bT%$r=)&OLcp7TT@rimS#=`(Do-a&B(4-iPVM z_dA6T96KPXwUv~74&QQD8L z`|Qp85U}8IIQ((XNkzCqeO)5Zmv~MiYJsCYN-M9CH3*@5nt2&sHaX*fX2nQaQ{H;# zV6vrtMs#CXAa{J3)n@NRe_EglNIvETi|+FOm0wP9JrBpV=RRcqo%uVL7BAbK9vT1Z zMe+M6ms1!thfjFyT4s)KVzL!2?;08D4UbwWEqCVxwOBnuEQA36TA7wGdqzYR;Yx;Zqd9g`SRlhmJ!i0$0en#^P zsJ^+q$Bsgy8Uvh<=l}jbcZs}+ifY(V6xvca;!@Pv*RMc5JiGA}oKar3J%4#Xeo&HH5JuZGkC-^18uCdMZwvxT0sOc~DVo6qRyhPma z>`(~&qF$6Mei8kis62H5eiCGgTWoB3d+j73J;ydf#!s}U24%nTh(U$c;{go4sj5>c z(Z)P_DB7jfP82KTfB^?xX&PsTFiePx87 zVh^lR)HT5mcBRulFy$D;wD@yG*Z@fBBejT0ig58;@y6Mk+3KdIx)iYvzCYV$_$}y~ zoDJD-|GZ)@1c;9}*Oy{KHVxxhLzm@kYROIjS5VaSfy?{sFT8O zpVg9J6*#=ssrRA9eh=T@ZL_maoaz)x7pWPcdw2F1Tje+?>4PFhlG8uQBgKk)JJ-Sm?C(Q0;_ zboJ2O>A$R#skxiH3;zb20tVV9%KT>nIF zZdk_fP!8K*jC}b@oHZmypYl@F&doL5FDh>N^>aF8+D!(ll|*fqJ3b0qOlzs)S`#^I zhAPx@J|4%H<5=va$=kR`@JY~3fD1&PsVw}AHwhcNIHiGsLa{HuM4qeER8D9!bEKQD z3L+KBy&gay6~IHB_FU*Gx@K z)i*bb1=!X1R`j%cw8KS6(4|ho;5#)^y7ZvuR%N4J;)bq{ur}M>mm&B!2C~`=N1Ous zEgG_(12N^RH=M}F>DF1@(nz_pne33pK(c^T1p$M!p1dKrM)~c4-eC_b!iNb~KIOOV z2tQ)T@DXTfO^oRnPm^~1BVzW%y9Dj`S^>+r#C#1y^SL}}aq!|rAKU3&g7TzE+_^%m zkc!{C8b!hzTc5F-g}r%u3;YG(Iy_C3DT}7zoh14z9ko6P-RIaMxb^Bb@Eg{cfZ_h5 zIDzXUAdpoemINp9T^9yO{;g3+~BceMRvJDCgUU zr&nK`j8=f60tsi)lKj4II+z8qPjR%ZriazK@=pcqcWw}blBBxjZpHT>RsO?2E6}Dy-i(NI@}l5t!YnSIsgPXK%*25$mTPB&ubqoq$x;*YNe4oP zk8GxtnUkC)nKR9~H8DbhC%Li$=%;VN+0qNml6db()NM_$mr#lm?ZnCchk~fwE~*^- zzr|K$F`Mmn(B-b&MzdM>F5@t9h~jSekV)oN_*`R4BK{cv`eFXMV7Ofby?LE@?}U__ z=Y8cNOYc*As(y;>v^H8Bvcw^!0&FpX?wNAH^5=!ruAds+u{Ppzw5SI6(<&_(^Yloa zDv#ksSMt5{^fv{i4T?NlB>BD~bVgc|`!+2?oHhKPlMY|`{+BfFrS$1O$$Up~0Dt?J zjEhnNuBQ%k(B9tZ_E&O#)Vhi4H z6%hJWarVu%NUxA~E;5PX{7!R7Q?zAWNe=LdWCpN+c z|EJYtlV>se*6Bo)XHB7A6Kj7m$AoWXB#LMPH#Gmdw(FMzD^1&VDe0RJl6{b&O+pKO z(J)Gml1($8U(FBfs>=t9YHkyEA-+f0rW;@U-A!zUe}0G^E$1r3?T_8Kw&STY_s5>| zCk?nX-H|amQ@<1l_uGpepO~N_!Fn^I$*|FcP|>x$4Xdl`XYZO#b~Tc6)_2pDaK+zA zKphS7E&=|c2+3thj7C(%<$wJHA*B3sfw4|8dkfA|Bzw8vR-=DB zW@`N1-e8>%VJfoT7!iCeBus%K4co+7Dbhg0_Q;^78Xtxbw)l#TY%&(CchP_ag7&Y? zo5k`^P-T`|74rQ5sw07+kfGuNHCC1a@{;6E1k0}XQtbFI?sKF7BHu#=!o+8;%X2$j z{*GR+qdL3OCH_l95sw0yp81yL_!#h3%9TR9=F{lyHdyB~R7FEEB}WgDuMefixgcT~ z`9xni@m%=Uo3wbof=!Zhk^(J=SeRapA02pnlJ!%J>-z7#-#i*nv0Su;_+>8Uci>)h z!q&p!0WvjSqc@*86Hu4@j(Km?lK-zt*=V$^P4+RDXnFZH-LgLohVa3Poem2d1qE|j zp??Uv*mtuZc%=$%ZDoC@U}bWmZ-4r;S6gHFj+xv;OUtXjExxRcqN9A;>79+`#>BR* zO&@|<(nW7vb4%6vFU#>dd4NdoUB!rShLhUXo;f8a+ol}w z2tpIAs8q7$N!d=ir=qv9q1X1Ch*#`S#6uW_2Aa8 z2SwLukyV)*i-^55sxJ699hcK0#*z3?(;jkSkT1Ax@)=dyb)(La?Zlx$k*Mu)e6_rJGN;ZftvShEtJQe3Hfo z1MgrYAJ7{<2vw;w1Nr;aKg}j6xj5aPaFkF8Zq)D*Ng_G>2qWL3d#+e9D3n-S%nx2z znuL0zzjA&UR7Z{8{3h3NR6yZ-?ULN!MR*N;UTY~^>edVOv&FR;9%uy#|Ae|_`aowc zeBWQHr;t~fzfOT@NW1XwO4F>4iLZt$af1I`rHo#D9L27|_g>`dyNi?<6(5LcMjVPtRk+%FgM>{&7Whj;CK>$&OC3?N{| z5!ThvQbMIqe3Spz#Magb`_8ONBM!}E^>7qYSQZ?JXo| z-m-pHj|`4x+dIP!#k6*zV$3?4UBN%ZU-da`N1&4|_%bp6`At0h2+ zj12#R>lfn6QfZT-d2fn+QznlScVAj39RxFwQ3^H>Cw!yd;kXIr=n=P_12=H%HOt z-pW5CK2@M$US2cX6ok>{8qd51h5TzpefuyJgV$7%S|Bhj;B6ZtTn@+T@+tU|agz7m zKf1GzKOzO+5yh{pWSd;l1&W~G1azncaqE|VyXO%d+s6+dnT=V?;9Gml|JG@7_~SDQ zidWa%65>kP)z}R?;|SCj{C~_z)soUF-NC53DF({f*9m3gOtdJFYp%x>2UBrWY?tMwuX^|tZ&hWjc>kat)j8NQ1P zon-RvkgaZgdDTbS9vH^L4h1rLX-Y28U5|r}(E89Yxs^1?KD8x;;9tuzBp8;UJ`e+Y zD})dHX|^gG70Tm_I5)6!H!tySxnn5DW^TI}vi;8`>F4Vjf0bo?;pX669iDS9?Nd)& zD^OBxB|hXO8-|5Gl*e=WgX|Nc!jNEvPCpX;__u<^AndD zT^r|HC7CY>(4V&3T5M*#a`zu6{HP`+3Vh$Kbn9{>*5L4x;7Uj6?;SU4EBK!E-7We^ zGD@Gq0qFp)_6l@E!{1D|vWOji*{PkH#B70lI0!9HcXxIkO}7uMqH$>Rd@-L2)(_Tk zS?xH!G(eq;rN=$@;)1D&62aDYCk(N7&hb#yZ!%v zS#Rm~WXgMd$83YQ0%O~GuSq`K7k4SkKc2(VxLQ5ib$G#j*-w16&+dRQQZZfEjI~Ec zLIf{WeO!>$EM!HsA9-z8NXMStb_{XXPOHN{xeo91GBpfh!QiqDPO2w6ng5udouL1# zTD(e~QCZ-8ezm=)c^YIT{@3JdNTeD1WrfNZF4M@5F$8C_Pq)Wpzb=#UPFtz{!)Pn1 zfj7c4|07a?Xi=qI6ST^gmmB&%z6X>gmJ^bpt1sKXuea+TyM88IZ*8fv`muy^#UH0s zdEg~3SjyVqzn$I=D<%zVHdUV@;eLbs37zLI$i@-O{J^So0R}W6k7_xQ%@iX{7>?Kb zaRbd_T#V$^M%v$NBxhdfrOvH~86 z>-H7_`yB>Vc9NApDz?w>%4?r4C#WRTB1Mm&CsOX)+p;g>JVsREwYKa-PF34f->$tP z#tH7{G)m{xVTDO&yfj;11L9r6?(0O~r2!XBWNnhj{vLM+NHuR>uE}pvvbzz`BS$ww zYp#q6n4e0iK{ZUIC>W$7cxas}uI8OliA4LH&%9uFX`KOKkmeR@@F-l~ zIAaV3L#PPgmkG#M_Hx4s7!pg$%9K$jTR#d|2BNHPg|xK%{U+n=r?{}#9eYQ55Ohnz zn`}pZ@?5HuEUM?l8O^kbK05$njL^KbY2Ikq{P3Uxegd{vpG zcfz02^ZXIYu-=`ow=L2Ue_AmxmzaBx;4o3!i@WcFdD-a zE}BMtarV64e|x-=NnKi+LqI>Pd*Hi+_fu0*O3jm4$~r^Wk>z3QAm0zw#qp9z(kEz( zK8T`^rAhA^0Zx(>P0Zan^jO6$rh)}RR3*PZG1CCcCofCwoNh_5&m_IRh9iFE?JYIX zO222cKIlMBt@$xVY9DFJgPbAixj4(7@ued{U`A|qA8K>;AskqD=UxtT9M;sUz|DqdNkc8PQ0Hmg1Y1A+(?yrqGXY8o$hoL{E2^R zE8cPMh$#;CXDL^Iul3y)Y!2X%pf9I{<~1zh8Cvh&Q|`U8`CwCrw*qMFyYb`l2N5Hv z9r-sDwf*I#g`M-Cdt&#iBO=-&BC2CQ-<4qhv0Enn>UUuG zCnVcp_-I2y6;6z!f9PRh9PoLpdWDV)7kEj;2=cc)jr+IGo_ZP#uKdh>eD|BOd-SZbf=0w0If*=p%WS7gF z=#zgn3ClsMI3nep9EiF;-JKGB#bJ^Dc=Kv2bCxtGIYFNAEMg87(DI?_4nHaJGCJ^^ z=l$2)Ggs}}#uP>Ij2yVmV22`B%D=Kq0-n(?v04GTE3E`Lqx+Y=^^h$r;uab4f;%I% z;jn`$J!NFX&k%8(q&`vS)06Rfn*w zcYO%$?{2#naPzwnP&BZ~vJc@kS4C|*97~J4f&{`rq$+yAF9-rVCBZ4pEux;3tr!j7v6%?Jz~ zvYtjiE~a`WFz+w29I(@&AHZHRn-tx;UYGElo%=`&Y`!GFG})n2X;E#``hSCv`wmWCHY8_r<{C8MFvLbWyY!8t&sNOihof)EYgt? zeyJiX#;|NX*o$&;l=he#al|+*HaAilC@AK@*Kox8V>w98f7&N+_-3p?xHyZR4H>9vwD10t+55n*Ky6AZAe320`PahZC%Vt~aZ>6MN>wId zUmN8)DfZgeTHeY7+c6Y<7i84r&PaBBC?y5aBScU@j#XeZEDrD(RL#8eg-P=gPq}86 zl;wvnc)cAS3UHJsB*`12va6r?H04t@CMe`APppA1-i+?(NT!#Xj=3b>ysKn!%~<}j zot*m}?s?||tJk2FP2}eGG#G115?OX&vfq=W!{?4{lMi)1n7^ zr?16<*5Jmec1gM>*g99}OId=SbYKj)sY=Lizg!m}&l}wcGiKdxhGazIZ}U6_yf9W~ zNA2`C%-12?M@Tm}U)tK`_KB9|doyVinAW)-e3HMi54e%F1IKy0UlNqPKl{|3N(2W@m6;T2X;ANgfqH#)^{~z_Y=d#>%JM(*^Gou1A3xn=!};=igvd-x zC}qF4uU4%ZAtnUk0ev!7OdBZnE2j9%C6C=Xb7>l1i3{u_qBp_z;6+%f5|ue)E0({)F?q&U5Z_ zuKT***V3*k&wty8>SNLFy6WsXy~6uVX)_(BSAyFB^XXxY9)%wu168C+z}{k-2+Nw! z?9}}vH-+S7g9T!=A8~3oX||aa7pIPpcCIh--<0uYn-*r#l~eI=P3zdk@G`zB#8Y&w zcicKtywAc!jzezd!(Hp)!@?ad^@kOcubYfuOoq859Q0&3+YDhk@d|}wq%HQ< z&)RU%Ia(rbnHyX)5gT@9rMcb!Ki0D!%exnWO>G zt|~;`iOSM1fUZx)Ad(8F`Q=Z=9Xm6>s(3W84ndEVU2onnj=s8+(7x}J$xIezVHA@0 zO!UcN7%vJ4jO|W6Km--O8K19_y@((TBrcSio}~=UoqR=+WP<)VUX!h;^B!6yQ#XSy z>?cnOx6D1w0WF^7Gr(U6=1L+7b=*wFk={-m)#tjR=fg8nj!6HN^-5m=QUgq=GAPf( zUd$9Nb5x{ysI`|(OXtvWyq zEPOJtcZ_?n(e%ntdD8->rZ|~yfA9v>u{sMcsw;EoCt7Xf2E%sX8|M~ES+5cHr-`@vAkzMx9kB^-6Waw#W&KeZm5$rTi1 z#HzsjlQge=ogND{e&_VzF{Wc((1Fb8#Q6Fx?wG6b9%>>m69+0o7)y|USz6jFLPj&8 zw69bN8IloUEDM#EN6SRtwBuJ<;%mIxgcjw7f)X!jlTaZ0J5F0FBsxIDA4urb)3Ey2mo9e~2y zOAAaP3npD(F0>m}eAGd%13X0P#Y=+=*X*TJvVbBo>!XIzClr5|k^RU?k)z3Bi*bJu zoIKt5$DP+T1@lKgK6rc|vMMvwYyun~Z{3T|cW4@tpuI09dV01P>A(e$C(&`Fdvt%u zukGkuNdH1jZMixI(1VXiES50FnzHh?H2h(1yIGjnYoL$NnUHn5yu|O{QyxOE3S3}~ zhw~zZM@1%J5Ak?Y_L)4-*lKMon>d9-yYZKti2?Ch8)c}JwVsMUvRJKuqb>} zqOzaS8DTGPlgVP>_T@&uqBJ3i*a8+t2a_vamqelMo$d2|g?2R^81U7_2lBedc@8}>>Wm(xh~!paqT=8Iw`~#T}}E=I+t7UE3iMuJb%A*FiqC| zE5q6fTeENn6j^lXyq}=JW8OD^d4LVw$*~XWCCtyAfD+OP=^}tGaS?1LGWY}QDKT(5 zQR%;X&Qo60nz%+7stv<09JlGvtqXl!Rkg_;t`ff6&B*=myot7cJn;gpLce5WtdF-2 z3&F1<*B`E2ewp{{KOYzp!(Hk01-b?}R7R`rap3DGY2Uht-rZ=%54_#60}$kw63bu1CO z%Jk}R$dW(E>OlDXH`~rK{Xk&Su+bf)MeXuVSm*vigpmFfAV?%jVdXU6XG>X zXsauGQ|md-c}+_;((w#<^E7b%H;9pR2|pPAvAOy1&F_cwn1sRt$?}*RuOAt?u^kuu zxm+cC0Ws&~f$JPF~Zk?4YEDo@sD&pQ@9eIZu|BjSR{92S$Ajj zcN?VcPyTQ0zsV1@fe)G#)4y^!THhETy6t?G8zXC$Ze%J>fUA&LqqD}-uwv8Lh(@N{ zT1C~IOE{JD3Q|5*$lA!A4_RD;LwuHG+t(xh%&^EQThRZs#1y5;e;4;T9*$#=A( zY98fqpEnWu*<_6BGX`z68ag?(zOFpBk2!&#>6ii(Q1bvw?%)M@@ORF{p9~e0r*o;%+LdR)O7c8! zhj}dMiwrEwtrAIUyQ_}{7fF`Y#V#$P49FL|n|x`Is?LP7k^9YiJOwxVr&u3mcs7mA zq+g5`!>BJcSyUfB4jkm6K46K;=DRto>811E??boZ3v7p`{xnF8`d!?cd!hB`Ym#Mp zY9rq*w-o<)I#|fcV3m@AjC^$rZ-jZ!0tVKn*0INYPD!*|wobf79X;Nv8G z@PJuJxo?g2bl?L7#kv8JwTUiI+1Zo3e7RV+I}0@C0?HIAG|=05O@#1d`SGSvV$5gV zziyB9@&JN_sg>wUQf4BcV}o_HCZ*>38M~pA$Kzs1GQ`i$dvgtajIZoJa%^tim5(a4 zWF}x-Slp;-5;tv=r-_fS)(cB_e;2JC*?qjid!Bqiqhq(~hVvIErKO?8G6qtwJq*q< zHT|Bh&y16d+etM*Xz#hcI_{KPANhTTl`jlIdSia|@Z$T4%cKx1h}Kf`YKT7jiB2E{ zda*_H=-+c5V`wmChz|Nde9`q_hUY~DsT~DJw?6#|kOvcC!MWVPZpHKT2d4;{CB%!i zBi*ayc{Vduh(QI?V&O-?Htj?U7bgY??Kjx60)6#Kz3 zC8j&noys!DIZ9KiCeeTaww4(7M&=*{wSFGDz0+biMp77{S{323@4;g+V@3u}X_7() zl=e&T(`8LfuYip%67#CU3GTnA(wgmxulReb*KwC`<)TUv)aXV2YkOkUST-tKP#tj?H1{*i^zH4VC|v;t@fnKyRu|3z_)%i zajk)I?)ut}_o;`PE#S%<3=76WvS;djL`&V#kKV1vKFP!%rL8DDCkX$8q8#NX{CK<( z9IUTEvdXYI&Q3)*hyC~N=iu+CpAJ692Txw5$V~e^WjpG(sl3*`W^x9IBvAd@LCX~a z9j_E0-OX!kzdXYRk_ zx4@@*6MG}{TZg)upo=>?z&opFUv@TLR!;~+I2WVAA1Nuh49KL%ZD1CHYt z_f6w(5j2e^Zak|V`?sL;%hw!zN7n~DoFlqLMu+YwsS3?m{_bDy-n}XGt?4IoK{mi1 znIt?g=SaICZQb6TgjiTebCh-rYT|@ekHhui@~mp7JvVb){z6Kk1S-U`6^blhlj6BK{!=Qq#0XDasgMB&S22q`3nj|7*)%S8AmR z7bt=}De+)JrhE1MH;@Icn1M(k7jI2oe$FYRkN8RVOP9V|s0;jif|)_ONs;dGxIF(D zT$Nl%6Q~pSOVUaP*BhIjGoJ@ad`y|&4lBH1qVmqgGoX*tmOHetzkYC5AzdfDs`g)q z(FO|m41^V|LTA=x5*Q6um6eL6iM&m}41#k^gzNjEw_Ca?glS|Ka1gg&n+kZ+awR}IQ?SsxjS~gL; zR-T^oh5f=@$-nzK`u*+@Ck<#xTQQRG#n>;_yH%1+%T|lt*%#mlSI9NY70-lzklnKO z@|5WL8h;jRGJ?nSN5~4L=uP!^wQnib(;H13w0qet>y!HLgOoD_!~5K21G_p|2G!=4gdzc|L~MI%Fyu8~9(DKna+5lO=16fo9X|h~xVt;My}di#3bne@jko~e+Gik2F9^F+`bZJx zy#ZrtCyhG`fj?D-QM|S&)@6ZF%2=y1aF=E zalQu-3I7eJ0b&P)&FKW=cd0DogK6hWn%ry0Xd&3=FM^@JLU;avj}Y0B>5MkK)3wRe z`VDQ&0dQaz`Q8}~KOD)$U+*xU?Ysd*nIUXofWD`@%f`=TXj zHN2_5_0&Sg47AEmbIjpCc6DlwOikI~_2n9M1dhm0rmiQO7H02ubxB-Y`?rI#89I?1Yeq3GKnNEQu#7S-sjt!19a1dH0BCB=gCp z67!`IBKPpBNBteT*97}(G1HUl>j5*qr!2c;>!{CO-&AmZMGKVMBUjVQ^PiH_4U(ar zT2&x4USM)R&@s=A>sWuhcwxb0<#9`kE)y&E3MxKW?`6a{j+9XH?@1-`Ev=BBtfR`z zXrutMW=Ls`_wM~xrRcNTh%67lLai?%V{BAsJcjSj<__IpG76~@H3IyG036jzurTt) zoWr{GEaxX-;hnGY=1OK3y1v*Sp8J?xMf?`(dPPz1;A2_8@06{@IPc6*R4b!h*C*4OIef1h9d5*91YH;vFw|;m4g)#fxW8i2^4yUdW&N zbI$J+j|-0EGN<){NQ|=2U-FW`(J3;7&xQ>YaUaN*ls}!+ZKGm@NInWakbjRhcSUG( zq?`m?^9q4xA*I$`u3)XqmqFa98VzPcguP|zMfuNrDixULK#{O{9u0E*CyZwEeCT^C z1#`4nauhA>a7H60EkX&RkeJ`9*f}G_1e(=~OeA+Nk9ba?nW}y&v+j$HuAp`~0&9q9BFXNN*Q*G(BGM;lGa(iLUP* z$}aI21*mNS7J*s_1$!vyGCfL*nENdh6?Z z40?G!bo+s^MbW8#nD(~GH7o_2&C~l&C;ydQ2^)4>-||!XxTLiml`IN3#}>C^CWzES zjj*H4Jz_SXnq!(Au5bHmx+3zC zkuawWM}HIc=!FkKK;$F`Hc01W_0sUIm#8B`g@oHSbN@XUar6xcf4SA%!H%bP2jWlCl= z?}9wK24UDqerhMSTYA#?(x8f3vfvItU~g>xx?DC)w>p2)!eWWn0O>FDwF1%2kwtoV zSnEgR&j5*sy&Vy@=7k^W6r+2a-v=- zz72xTzN!{BQxewiB0b$Pv#Px*h1z<`9s?sSrAZUkO`=O_%yuuIS1;{E99=u*f7j>n z<8vJhluVN-zMyRrdLWN%LpJ~M0`b@Vw>=9ddfl4{oVh>r3Fg3u05C_CPJX|RWOW2t zA3n^Cju698jz(l#D`gI8>RKN)aSw3p&cC?JzFCS`Nei<1{N$FMgSXK8lWE-uc1gl1 zIy&%-#svN0@bDZDJ~53nR@3y|<<-uq-+}qsch^|6-@ht%x{D&MCotZXm@_IA;a_VP zWo4jNuz=?T<7jrddUZR!`gjh8OG4X-v?uk#avd_+@3qhd*XW-!k?s?oeLWmF-K6s7 zmwV-i*C?&}n|mv~8zCEVBoVLA?C0v08Qvqx{Y@Iq>a&&&fw*U5&R;$@&W;BUOP#UxR=OWlF zy+23%!8tZ^@>I)}N9RsI#z`Fq`5k;g)tyt!Fu5h~lna{+DSNe}s48l!TBs?sbWRKp zOO;a-8dabS&7GEB0%+cRC0o_0bmgx)Q zv!E|uPXOxH;J#>iR6xS7*YrHVu@>3;8*N4#Ub)@gz?Rr>bxuuy1ojtmk2-Yq4!Ea0 z!=;Z_OHc(SPK}n1DKFx}hHtL-P3xbPf*J(*aS#wX_;b#B_?wOi#!zqhTpJ&GE+;3T zFG{2~$5i5rDvllz%j$4cwY|5e(kdQBV*HZQh5GTuy)8LTRgZ(gi2 zm7Kn`S&`zT+Zv*6zaqxpB2HV;BppeZO8Gq|umW(b;J_s6e98_rVra;#?Fg!Fu^Y|? zRzQ&zbjEdKpxQqd5N61r3dG@ev)(<`AUsYONn&vMTK5+5w)u=b>FLvM7o9%RS;W`I z;Jv4N(2+&n#g5FuiIxH39WdiianrK%m@waJ+v2aB{#wnQoEO4MAS!Zvky$y$#DNWm z;U!Bwu?(1WR~}NKZG~NgNO2govY<%BY3m6++M8Jl1OH0A?(W{w-u$PNBOL%NdmBTcj;B6#M{QAmM%jqlI#<-cxhEN;nr#xb(Wu3cz8=m$Y#N9VfZCd(dHDvX z$)-B3N~GtX`p=%cyL%$x)vSvZFDr*_&zS8%D%&L39(?H!= zCc^>{dBd58$GR7{%@PLDHQ2pn_d&N`BJjt9=OAngJqV`er!4_#;#KE@TLbUPo=NJk zZre)+9x~Dr0iU0^u82FuXQpk-*F`P$xST=^;Mz*MQS_N)2Pihr^0QqoC7V|da}hvj z=A2oI*;A3Z9eayB?bJ2lx9ptYBE3s#gF~*UG3zU*YI$zyX^y`8R4rM}CuVFH+fLtp z@n7X9?vspdOWzXe;AMm0--XQ5(IH=GqvMdvU6FgpP37MI#H!c?TPEymdg+fk+%Is`CYxyPQhnLfS(1a>rdt<1KG`$83CAY0id{eXj%2+ z7oWQNS%oiWbKZDM4!io1mVnvxy+nSSvi^8WP>%TT7PnmUf#S)B>QHF+ z*Q-8i1`kA31|FgWV9t1|ek}1WAe;oZ2c0FxZJx8Z7PCvkGd5$n8xP@}CS-KX)KC{c zf%hDfxC{K}*_k$ARBx1gNqvrL!-Ut;2D{)^X+9t0cB@>HBA=I8%bG5`?D8l zi|~%F63xg2SH3?LR~4`}14Ux$t}<6x+x8@HcPU&WKw+s2tKP; zRwRrblm9l*A+Wac_`OOdb)~-1 zTy#7AU2-PfE3PCoRF$`AS~heh8H#6~xpb+lSawu(jy^8hj8O`OEAO4kyx(?8_CeCPq0w0vXc{&q^6yl z#``d&#YE0~l!iDM`jkHSSV5tz%OCHCW%O~7{B{Cd7@doDB!m=q@XXqOY4m@AfDv}x zeOS#>RlaCpY!knFITHb8X>F}K-1^>U{==526ayjgb7DSS7+`>Hz3=QSXJbKbhlp;@Y29Z4erc_9nQISB z;>xW%W-m!RNf**`uc$vb!+FP>D2A%^EQFKj3eaJ8 zXY!u*!hc1qn*(iXvX?vm5)0-VDn!DCCZ>F?yaZzkz@w*9|8>()_7FNU)kh4ms$-wo zt~~OV*281j1P|W`lFUwH`Mnz5YuxrV1w$c3o5^g7b9QfEHH=}qA@Zvr5hxpZR z?*(Cx&JNUEYUloTca-iqlpQ`7J!#Jc8686xP*E?y_ywtroWNbr0$1r+%RU7i-L=9j zgU+<#Am`p>BL&MRdQ8*_H!P@ArsbGTyr6egM3VR^R)@DcJqCFBz5>3};y`X`80Q^h zvF7XqNa)5C`ox}Ip(}4&X5a=!oCGEeJflt&0DLNVMgwJjBB?K?{{#)+t8H97*XjBm zxJW@kd5esF7&1*ZWgtscdPoX<%j#^+-P-flCuos_s@YfpXKnkqub+&Jg5OO;K73Cy zJ1DWpYmM97-D^^R7H{N!rDFWTYpxWuB`1=Vu=el-A(nWboy-`+VY0Qp7#8rrG~zH` zn1Gh5h-dPbDh?mv5auqWa*9NB&d?K@_n~D>h@`+hc9s0Ex2bkm)s=l869TYO>a>Wm1&9L4+GS49zj^8{(X9iG3ImqcEBZC@JQcnn|~qha_mr8 z`Vx`CTPvZCJd7FQ-GqvgV~?@_(9*giz_mY6d0+QFUEIFRjUawcc=+!&QNh!Yy`WrY zPCz}1kAY@~{CELD{0a!5sOZl|BSgWRhHIJAi1!yH5d=l8_-Vwd`Rj1zC|JFii5A*H zM&FSdth2BFDOjfSd1XRJsDb3^7K#7E}M)GW6jigd8iy%;>$nFzu*0C?%?|eq$n4i{~Wfy)-D}mJn>gM+eDF%?6zoNM<*6P zW`9}r79C27)-qi$7eO7e6v+%b3*U7hWOJRxW zL|57agZ){w!7!RINhEtOAI#DLU*xs}hJ`>oWVNS|e{uc@@gKrTwe*ICrh+ZA?v33o08 zRvd*ncpU5E`ypS6tm6x7!BvvY_% zYK}XRQ+Dy&?_qlE2^#71b;hxHR;#|#VkX6(x^8!N`Wklso zW`|v{=6~#w4;AQR?=(F$zxLDKHvDn9&ksZv-U}r$0MliH+G$}d%pYiKQy{;+jv~E5 zI#!N~`jS?f=6N{KVho@H+sux4m2u=qi-czlDrA$}$A4-mRbJf!$8J~$@jhrIq;k^& zcG&>OzqG>-{e3kPBemSwAUFAeV}p^zX55B`c)wUFliJ5|-4Z6GI`pe`jZhVqReAhV zKpk}LGO#*Px~9RBH=Y%t*r|QRLrqemZ2J0Fs{X2Q3m7v>0#jL5tUR-o@AOX%4ve}> zNu~~vgkKHUjNUeV@6VY|x1cc94f;mXAE@yh?Tyf>$?(6T#=kLQXBV^A8#rbx>XL+9 zJ?Vf{A4=~fDjm6^T{7I3*f8W%E}xlHPT+wPB4b0C?tW=$>92g&?3Q3q{`s{>KqT%x zoLE#^_ZzRd^kieg>)P&=+Bp3UC7#p?&A79QkpKF=RNZv`Uodr#``E>M)8|-llg?}Z z#TY^dzo%g_p46{zoz(7%hCinmB|2RQSbq3yq5qSnia)|y`Aypc1$j5*I&OUiKvG%D zcj)%Ly-PYem^kHLhv9K1n4il!<8cco+67=qWIzlEqb!~)rwuy2IiW=(G-&D^6}N)A z1Olc}9lv_S8W~8g=MQ9zqd6IMFQd_Ge!hsNd1Gesz8^P+x8vpvSz(y{VebcUm#(5I zJmhs%Yr;3ic2aqEMa7SdX5i!zWm^8KG1V^NjgRb{fOe`1VBn?Zf1u1Pw6$H2C$bBt zBuCGMS@M_%7$ma<+N1a9DJF#T{Nw@u#tGB&9b)zHC8~v7LqnoR(08+qzv~o~WOL2bdgUa_+C!BWW zxkS*ozXuODLaX`ql}Bl&VpkDg`nGKJrbBv7Zup zpq>IQ-^lq-i_1Ca5MO5j*qkR^9LLt`J`mD0>9eFnZgW(s8nJkB|T{L z)kB5ItRzOiTXCRv?fq7xeZZ5%nmJ~4`~cZ0XlDKW6C6q6thSZajWc#L%~?jjPn^)u zy7WVll=v)8m{7*{;!73u#WS_}u(eX7C8;{0g}+CRz&yMyu)=m0SY7nj9mmPrv9b6^ z)Y68coK@8O|I`3(*eB$eH(>9Kxl9;uJX-$mV?|xUW%>iQqx)c$2^@@4XX_i4MYk=K zKIgBox+n3tq}p@JrikAX)r$!Z38|nmRgu0WCA&3*>A<~#-F5Y{4|TV%O+I4unb~OV z%(eLgo@viMq}@(>sLlLcIX!nZv|jI|C$-2iK|bc-eGh>hA%)ffu0k4UocfAM(b##7 zY)rlI9UfP0Zcyxxdz+89B1o+PqcL+n~1l~4X$1K!rTvb(-V5qriX4#bo4CN>E zOg8z9r}UL^5ndyJF#O3Gyp~D*K6qokP!aZg!9h!dUs?rK}v=gJ#}_b|c7` z1`B7oaRIYEgp|Ex4$?9!?vhnQii!HmO(*H1c&q!rsJF&VmeiMxPrR1Qay7=5JTv zviJ-Bil|H4U2>=spRw99a(`tWe+()_wZqC53C^~va)wENm!%@-L#yfOfd-<7le7B! zvx_%`N(uywjjRc&qyk%5A{4>UH-~=mKQhM}6HZSWZUaXf=@XF~J)x&=IxM1S2grc` z?=vk7c;&JF|FGIxw7ZC`==S#yhKYhJ7J;Z;?03fhoV z_TBCm&p``Q;TbQoMeU$Q_T4YE3_XHKK^ikX!7e$eH%itV4{_*RZ&1=lz!eUgD)w?SJw2YCRLeMeTCb(Hl45)E8I>HjB)tr+n(ti0&~o+?9$vQ!3kte1L*$|5 zR|h;SOTM*ne{PdIpGs@jNKM99GN!{Q#rC_@X$cfuURjB2RIj4XZv2*09=KPb)FmYb zrho6cx2BP^6xndfQjbm%Muk{i!Nfm~%)zztiy3w2@RYX;C?f8l6GItr<^W{$X*2x; z-BfkZB+^~EzZ7?P<$3d@%a2RX=^I4YR#iyUqB~R0vt5sZj`IG3IVm_mowc_7-?v+{ za#>Itf^g1sK|EWXG-2WN&-|NJ^6J~5iO|!sViXRwJyU=4Wr={NrgUE{AqVJDO#{=N z!^Dnt{eCm2JceEj-{(p?W1uPiEMlHtR>p8nH*|S_F6wcQ&ue?ZE(R)dCG0(1VA3J=dr8HD@Tp_ia>q|j?qal{Ma(@GvL1YQm=en9Eec<`$ z=i_?A07@W-<*x(LF*dGWiu4(JA}t@y{O?gYGNYz0U*hZ?xylanJ~ao_Q*pmuI6h#z zI>v%}+QcZV)$v3)D z77aJ8DBNIKZJZuIegSFCBd&Yp7$hyvVguPcL7fh@1lsfOZRyEMXn;g2H5x3+lR z5v$KD9d$*!p0p&D(laBmYZJFmJe}{KMCwEV^H254P7W*r zTt{Mb&%c$aJ~i??vTSe^SK+s$tlmf~cp)-ZBeKsypoV791Lmt<6wjgpohEdZ8@oDyqZ~UpwhbsApNSDeIoH~bM%=eX zm%rdCvFFW;8pmhs{{>Bq9OyCvxOBNDd!Q1bsw^ zc&YvF-%md_GQ4J36={2;->txe6ugjz4RMwp|FttE8Hb;^(z;r|VG~gpp0%y%N<+Ls40U zTsjC_NV`Y`uDQ84A|;t*5OSOQQ_hBUYzf0G!v6#G;sxh|!-w5SPlI>oIK^LIeQ?{0 zX+2Pq{^;7pi#54A5nMRZd}cy|x(Zq7#N2%x!R&IE(Cm|kLKKlz$sSvNT)cZhztRVm zENa;-Bk^!xg~Emqp>%Gc;!U(=1%HDH>8y<{9tONANr>31_i9dhdUGu9k zWQUv1ExP?f3b_hcmf5d4l(>Qhfs`^7f(0(D$=Bw4`CJkDrnzG_@T6L-ib((mzw4RL zKizX1{H*78NjC4hcR?D)_$%tBb>mthre8SMyl16x7F_@OeYh&jhBhFjADt*Gt3P&L zIzf?%hl}b^m#(bP9~u2}QJmLKq8yVI72*UUpD|!TI8^fP7~ml>`xKE`(O2l;>JonM z+}`oN&t(AuI2%+Lnn6~Sv9UE`%}MX>p5#Z}VdWbEY*Q0L%~Zd^O{UQ~#w2l=GZFf= zTLQJjqTfiZ|{CWNVU-FP-W9m&VF6CPE2J0+g0 zuU^kDCThE^)x+%>)$urmd%n*O`aFILn@)VI6HA>a-BSGb%4V6044`*sWCZrRdG{%s z2_nWwGv7n&Nn{LocKoKG-&LL!z;b-Ps-~eceMRRY!WsksCSzc>%)kk*wnC@Rjs<+Y zZJKvsxR5m&eaB%(gm(BvEeo7KOs0qJQ4)zF7()@|+h@3)D^yO2b)LfOW4t>=`vp&+m{9h-C zd#Zw{*fQAQub1H@*X4n$I}c5Q1r%r{rcbp+N1L0w1g1MF$#`xno#%1D*{01(Zf(n2 zAyflu;6_cImhSbD^jIoG3l{My=7eWN>y7yZWUzw+56#>5nb32>xvylAs#@@4PG{WPwP-?Yt?S)6Jx=UiHm&Jqa zjZjWEC+!CtyUq^n>7{%4PinXVSx_C)__bQK1Hc`Gid8sti2yxdx^t=(id8i*vh-+V|^R8 zwe<0g#lDESvQAwT%JTJv2e_i3|B}R}XxDa#8!hk5cLmK39|Mydv^QD?bmJsRjQ}hW zXPW&KN>`Pp1=RfCfPqen)7e3YJ6{g`(W|=4!6%t1+IdIOK}W4`T>YQb4(}MPe(z%w zncPT0?tV{eT4bc{%U|;0yq=~RA$<$<4VS~^eVENxA}3usPV=3v_0rUIDwltE-X;z7 zu@w_F>D@?cQ63#W*Gdj}^VtyvX9)*5p_^Xr9N!pAA9B}-{iVMXY=H3By`>@Kf>8gw zw5hR6){$dO<2pIPFsHXE5;WVKS<7A4^ZTwuu}iiQHi@oNR~(ia=2j1%{~H%}8G)ZC zu7`&qDC%41XoaJuKvwJuWm*S=Y6otHP8m)-$6q9 z<<9OKZVnu6Kjv2oPkaii$@j(;<KFmKfIpAzAcA7c1y@Ce~zjFN_L>==0T8LkmKcsF~Gqp`$qca#qQ z75&!I2s`|mEo1XPFk@USz)>Q;-(w{ z>(SeFiQdDPWW=o#R5#XtD+^Gx!BOYVSOAJN@mH6dT^OD`k}UkYyez=kGu>6Z{-Vt= zqhjoGL)g4koMxJ{{286|oY+0f*Gcl)b=o30T^g3R+<<9Z7jg(02I4M_VLe&9Lv^Dlcq4n+TQwqQ9-{|kt(M{=zJm6<|0WMhaDROcmCTpa4;rB1d zbsWp%u@(hXzo+Q;uh}MrRY;>&V0ZrQ=C(Nt6XGDQun8T!`?Wy0)!B3%%a{H!XHDg( zD>Q26>_6vba$1H&nH}QBNdm%B5)aAIKY6G6Mrp)AH?-vix!2U^qTTt0`Hx{L>JUzD zDc5#&pb8)cyI8pc0|%$hK_`QZdQ{koAUCU?!ld@#{)-KneqHemM(}S zlg7);k+8P*q=E?#5=Uiqr4V9F5g~ss>3*t8`Gq=H3deuv7K~!)02e$@kUNE2Prm-s z>MODgm1S5MvCC2(eYgbK1S`-Gi;F!`_X!t zw|qL+@=C%NU!n>!-Js9Cnq|#_t;uaD0(rus?``2Fln$PH`Iom}N)Yud(`fs-#Lo&Q zsFq}R|7zXUzk_A@YXu{vwk#nrQH^Q)J;#1&31nW;;3i;7x)sNxO@ROLJpGCr=%*L% zk10OMWE_I9l0h_KJ4e2gmP;Td#dRBjD_VF_cy<#n2~qlqtO_LpOBL41(vW^yRMFx& zw&S}*@DQ^EhD$GgeXq4a=u<=`N!+zMI}5YHW}xiy zzq=kmQ{V3AYdt#Y`^fs^po}EYZ)PplS*6W-2L^UYhT+(JB;kxx7TflvD$mHzTJI|BaaA}tiPHV38Q1K!8t zh5yqSUN*o2;XQKCohm-;Haa?`6zZ1=PPhAaalnR&$kR4qhnx$VO7HWpWRe@li}4Av zOe&md>L?jtT$v_0%V7)^$in(OH>RJ) z6^gOIedh`a#F8Ww5ajAfE5TJLz&dj0U2K}59f zh#FVOok}rM{IDK9WTp)NdAr_KEdOET*^L(!^x`1sZ(*V%PiNd={ix;IO;^=mA(zR3 zwHc%IyjnJhtYDJIAV)Y7nmO%qYPDoEgHkdBzsBxYs;hHKB3v#7{Oqw68t?KY#CPiQwckbGn)EoM0u^R`&B^ICKzu2giHrw*&(kk64z2r+c3_si7{s8y zc-P*ZA2*F*#GU_xh|CQ;U@LWgSq#5^Erxk??>fQfU#DW(>oXPi7oH~wKAORj_kzEG zJ%1(=@=6l%lOiEDdQHJFork;^^=sMVczY9DCeJ_mpv$Mfxc!_mpi_b66&qK*I9Z;I z-n$b!If>6z@i|t<(p4lK&>mBBp6M}?CI%Nk&38ivWzJAAp=C1MM#<+*Vi1<>+%E4v z4l<`-J_APaj|({Yt@_z>^etCpv=0iUB+em)q72oe3AZC|aNr0gX*44Qb}T{Cb3yru z@LY`d4#ik6U^&4k=iw!PclsUa)xf9}DWJo*3r1H*SaB8zAjSUZiHUNI)bF()lXLBr zolO2`)1V*$=nD$MGWtgt#D8^mS*198UbQpLTy}K!W!oS6kbIg+OYdP6mIvRuuqH=9 z<4vKu#{yl=JRCD}fN`$u+2aMb#%RtYR)XiJP!&2w67~D|KIUU^{_YV}t{#?g zvV2*6Ol_Tz?0Em3*5b2|J17xKNAc8KaQ?CF3PTn-e-5|?uL~TX#we2MWjPYLPApM?pQ5xWP5TpeO0jX6) z8YvNw4hd-i0f}$l@BjU6JUe&p%$ak}bSUnwoyzC0jeT)gaI?)LCwV)605CGmFg|}rqC$PF#UG0{E&kStHkvM z!nJ&WeE82{0Pd31mfxN+NJkjnx>86X>SoV7*UN+hFrab`Y<r+BNA07wN z@P;c-KjI^WM#sbVtaa@>#y0E}C$|~0sdOJ78jv7eMG7_#Vxt~0E$qw&|6Tu%sUhB@ z0_YGOw(BM9RexVF$`euI$z1rEd2MexAd__GEj0$~c)MP=+`Tfr#Cvos4+Hc|meMAF zXg3Irw+Q)IVC(-L-&6|K$mq6%^N2s6wlV#KR`8{(E!=O zUEF+&;a^q)4Z%WRIA8{4e=WSO>hn3A1D5@4>^lot@t&yCZAo)y%pHCYG6PhAb*wx5Id`_m{@{up}b1aN$m%&-Mfxr8CE;vOibL z-!8jVZMd`{+J+lR;NiYlj^5R}Vy>Y&=GSV1$=nD%idQpi9M80PD#oEV;jCA|c85#+%zSa%eJ0Y*? z#Ji&Fr=Nc0lyJdG&O^TDu^QkjT#49|66h@Av(jg8dJ;+C4uQg*}fbz3Xnt>iZ$T>nuForEoEu`9|%C%jM{UA zZku31+ER9LDXyQSWbW->*Z%~8uvaF>%U=*~nE zKm>8$kRx3ECc6E=|KF%ZCK=aV$@Jb`Gw2QGl3AVhv(SFJHyTJdBqz9$W<{;-;4yJWA}iKt9Eb_J$iD;&rIG@wbf2q>#e0(9Kk%ns<_2Nuy`!{hgd}0o3?Nit z^HK?2^DHd$kg__tB#8|Kx!G9M;6?xNqa;B|!B*~I^5AOMfe__mO+Y#LI_~FB87I~Y zahsBLfrF1(1%FE~Db&N&My83W!vnam9?N?k;kp!|pV)+-F7sjM{lwZ-DM}AJ61jJn z>Zgo{#_9yMwMo1yWi)9Jpj{;sX7~E5Br{t{mx4r0q~y00oeLkZmHfaeGfi_Xg3@*1 zl6F2G=v9B*Hc&7{`My)zv_Z+-HP*S!%}U39)~oWUXx$&>Bv**|)TZ{&js=w!z)m5J z4pqO5Y8Y7H$%QY-BIig9sjQ=nthz78mLqf6;(jom+kaX9!r19UyK%#6#13X@TBY#d z-cJ@5)%(JdXMrUMVXf{2p&P6+6Jw<7|9h^jr{ZS-F z8{mdVke-}->Va%6pas)q7-?P1t-o=kfpk*#nHN%sNmA0_2rbjT*vsSL8(ho$^ zV0gZM>U%$JX8UhGx;y%6-Oj1o%$!2K4kCBfL$-Yh;+Oh4YfGcB5dWz#FHaz+KS!a8 z;UALLD^h zer8PRdL7jW4etS<6xZx&#ddYRnSDrx68|45@JXBMz^v;h8WJF*B8?D} z##aR2Z=nnOUaqdb>?@2!K9PGkexF6I{-=mAS3BwZUeWhNnVY}gLVZ72O#Twc$-Mwz z!Si^vU_?{ljh2=H>`R5DOlu4cc$@B_z4X}B#eNLJ{1OP*Y`_kFvAuxq^CluQ*a?5A!>?if2vii?&STFC}e*G zWXDhzFnJR6G5tl|5P2p{kZUbmMTT|3lL%8u#tCR41ZjL6S>eT0q0Ta44OJpt4e2nv z`rnucoKDzXBB>mkgr&Vl~Hx7<#@d zm(ft({^HUfThzpq0x!zf>CrzF=p>Nw)sW@VmZGm=f!xnHWZQD|&Mx|W_@Z}wFx~jz zQg?hh$fKssw!XGueWA8x;xSxe>E_b1-&dKrG4GQaVL;w*4n&#H zzgbl*!utGxHWTH%u(|2fn7D)-A@INh3%5Hm0&fn2B)5?94sZ6&tE}Zr{NMq)>kRsT zcwd3c+HrF1t2|gz4CiJ+#2mY8bK6@npaJ+;o8|A2(g2t>*9}rTE?`(dH7^H43tuoD zQh94(VRu7g!+dscY*|jQ`x_^6r>~{nAQ$cY%IV|HnM(o_{2pMd#ET|H_vtn<1eoAV zs2D&q(_8PF632;5xXl;aE&@_Gp&r8hL@$~{=4ofjdGUj_;sQ@=iwqG9rnb@2$1pu6 zKnlcooJH_}`KpPURu0cd1?2G)w+?{M?Ci1l9{XnLeiPMq3luHr85Bqjc=GA_(>5js zdY#dD)al%kD;fG+dx6U#Q_#pBKC`DS!7+Y!hj{vo>iJeg4N@_yk{O#oBE)u`MT{-yoXECcF=%!!YlW$6uS}y zKrexR%v$YMry3E6rWjK$ajz^XIWk-Ju)R7c;lQpn2fsNp4+y3mvyD6oSvj&#Pd6iy!_p z`~|B)He9XonyDDP^in+f(tDut+YjmSu{wGA+{4d<-+d50eG?6r%=p9p=H^jn!NwU( z{V90L;-!ONeIvuslb}NjKB;D~ zYob;lnR{rtfSYn=!!W^6&m-jc_#2n=`@)SHM->M!I*_zDbn|pg+EXD%65bb&lA}b2 z(3la`=fw%0&wz883&y8FhIGeT z{G2F!KT_wbtmE$JSmnu$jb?juut1T(F0|n<8!TXMzVTeYz73~(xI+SZ(0Qg`FA6Ow z(4?TNCpWH=)jX8(2Wa#FtcqlhpLQSQ^TaC=UkDhFkUn9rDWp@gYBrUy`YYm9NGL); zC_Al3j+tJWw~1?(XUz=}ue&bRJ?NI1hHo4Ev`C3oj9W(L@~4jbvfBL-HQNK@lt1z7 zfxt)=J+ogibZPWTdYqWCW=6*Ic#DySg;~DozpE_o{AA(CB)I#e^v6c7#m>gHj~PUO z3PXU_jK3)ZAASq=PAcT>8MFsPAN;tkzs_gP4D{}^vk?sSLF7ny<6+^=&Xp|=1(y;e z3jY+XLyZAoL}~bE3f7aTg$;Kx0DUS^%|a|aBKe3SZ*)Kw=DGMmMtNkQ=J`oXeBhMm~RdTjP+I=(2*u9)X0#^mMg_y!&Md&FQ1>!4j3gP zq&myjnASy(4}U)4=zn%b=rwT3^zOZ9KwWL5IYpE~Ze2&MY9de>kKUN);JfhWBt?bh zsIb{O&NElA-2~QOmhZY(`ny!V8QJg_%P|9#up$P7ETZyfLR zIj;h+djw{rU*qZibSxNo=$?85!^Bj3($L?!B#)&(`^JfnC50BessI5csjR%iC=sS^ zsH8)Pf&qVi$e5n;S$tfjV4%oN<;E0@xfO;SD2%$k^K2TClHJsN(Ya`zTjw1}0;42+ zFxtG>x7jfYSPO-2S1G@*aMu>K#m620O2)*7L_=~5mR$}Ga~&&(;j=d?*r<4|U7}gi z1!-XjbEEAWh7`~rXd8dim++izRRCHz!j9hc0w)+>nC6>O1+U%2bRe-Tnd3d+Pbe;_Op3v9nGP&%yi8c4cULlv1eM9YPH*3mVM1-aUF5b>NMDB;1aC^|kFB>wRnS z*@Er8pqN8K^dC{5$;7av6{i?;=HUnIE^Pt(oVm*q6M@GrEuO4B(cN()jAQRZ-an#i z4LaQ734zLwu7DlLG53L%>QE(5h|%V!S`%l@&m)55lQi8qtZhx27Q1ttJ@l^2>sA^y zv~D>o6dr5TOOhdE6m8PJeK%<=V z=FJ-}<+Q5zpHdQrX2VRG_KRO$lcM>}hWOom%{4G92pm~1M4HF_!{{&|-Qaf_7Lyc# z7*a5*O1J2v2UpD*H}dp#{67amaEujb{A<@MP^z<8of018g^U%dsG(e+w|U3#rG@hY zpo;3YIr{>T^TY0m+@XyZoAAM)^ZQC~ma^2yt&f!siQo|)<6S&0d2j@wh)4V4?NE|o z1BuNYMwVAA6mL>UDY5xM_K$s9-^^|&+|(MFRs6Ui%;YL{55~CPLsfhE8JdU z;4G}cg^hgl_AkMPD|!X73;D>*2TEX~Sm$s4AUev2mu#EK>R620BogQlz^13*7?fOV6%!co?hctT96mYLe%z=(IeppucdP%G0z*${p?Q(Y#oVg;E`ycEft{rmN1O`6# z@V0aLP&e}1K6Bdat$$@l=is>C$EbAMuh!OF>`E`DnZ7dpw!&vBnm`o6t$VuTHtV5O zW+eNsaOUk_$$wgYZ4NxPd1)jKQW3yM_FL^j&Qa$Q@%eaPSTFU{@pZTqv)2 z9h<_V`aU8d=jr=2$t=`8R#hNc5V#av#M`>vl_&}GVMIb$yQ)TP=C7`Xj2(0ry);OI zBS|pwiA4fu^)~hs>>Wo%wx9kE=NI>0I}9TFK!Bd=Sf?4Dp1%bS6AJ}CwS?3u*W+XA z!5+qad8@L=Ggp(QSUBH*Ym+1GN~n55YXg72^UH+rI-5~y>nKN~F!Rdr1&xr; zL1g0!-<1MLGC_WIIN?jH4S+%mV)ln-(;CLlf?jdBF=6L`#0Q=SA{m}ySD>&a$<7K`fU+=Z*%nV8BSzjyCNzAplA zzV$e4`SlPTAB3I;08BO|Z3XEl0}~>Tpze&|`ZE#P$!UscD)JwETzWKwKB_EZiI-t| z|2{&1OYzC!YrYMpKNAzO|E?GLEkuqwNL<4ft19j$&G90eTb3mtEc-eB%*DHR8bZ$m zO4qJC3*mC1Dl{;`@^~h_*G_+9PrQdCR0e?_Bz_tX2f0KlDmO`i-h?6F5qI`uF>8H| z>3SnytX&!5=PC4fyZl!VsC#Ww}Enkk=+D zL$#^1nbw{OZjsego*9KVdRxAJuR^4E-}Bqe`FFga$$Mv}SxV*R6qyjJt*a=yuwcj6W5Vk=aF7R46->8`tcn2TD zTtj_cW&QWJ{_53NVGLEiG{4-;&A%qa5Ah7C(L;F6TGUz& znwEAE=7(cu&tFx!NLi^700$B|g}7MoEmZj>gxv55U~2+a-43gt*uOh0Jp0+r^RdTK z9WXBBe%+(sQj9vm%x>?Pv`@wa5ANTlWr8H|Opb$8t$xBl$@;jktRRbPqUrAp0N#$t zHy(cI6~BJMo;P&!iP@oI@p&3KrkohEhTzsQQR)DRdj6ae#hG%Rx-nM-!zVtO z4m&xD)o4Bha~AX52iRJ^y~iX;<)$!j50&DbcJ`v0%!rc^GltrAm6cijfl>Ngn0WIY zTym-IYk=S{_K%Z6YMzr?#o=OXTemw5Jb7@;Ma93WB!KCJUF*rUp_;*ODlMFq32Sff zcW|FL=;RE_1PJWat$_0H^Z-*+#BfYm^hhc3K#NKU$k14)rAZfQB zqu#=wQEvT|a0}ehdrUP9W5voR#(-~W85OL6%3nLc{x*tqodcpoGe|dBwn`gsno%f~ z3_$@Lw)GcG`%{JP@?Q_>+XB>lSy2_?uMiSq7YFitp$Api1B8+c9OV%7?d#F_os7=% z3Q6uem>YRHN8wbU)V=mL7>H&BqC^Wj__6)0*G)Bb$hBpCZeXtJkpw2h(Vy{8RL8ZX zXEq{gwR})eIb>Gp!b%6_2?z^>n;MW6Ng}D%nn(3Zs^5G2g}C_Gd9Qbx>abz}wu2x= z(P3En-1&=R%>EDOZs9(fh>=?~n+Wv!6;(h3+i(^hiWuG3%(jx&QF3{Fr~GTOaX?0A zcJr&1rLa_<>rsC2Pz{(}830Ab`48f8%s?OwPXUUQf_~EFCQQ=iS&#z0Nu_IquiHq6 zs^!n(9Q?-Hz+Qvg7tmLP-&6Cu4WwD^MaEb`8iI!bFxI5R9AF7Cd#B9H>J0Kqe5<4j zsfCJP8LuAw_XSP1*JDTH!IKK52_=5$;h(@*2@6mPEuejbszWT;jbC&W3S|>d4w@4Z zpVzM9y~*_$vrDE`FL4dI1LM;VAOd-x@8rNh!L9popQ}(Pph=#`n8I~2$+k+dYEJhb z0-lLb%bjL7HkGgt?RCZ3=xM@~0A$_xlWjHIY(dHnfBadez{|T%k8oT@-oOa+5`e8K zRZkPMZMlGnEorjZ-gGehNV9@b1Zo`CQPp*K4PcY1hvC@?yJ>ysQd&S7CPvjWLyhb3 z*QN|u8yBT)VIj;2O6V~W_KUDpLKQH2{t?+x;H~Vboz_|UvS|xTUdpR62eXrNGyqeA$ULeSRj|* z_ptyREr8Bg;Kfk5!OE-gLetkd+9%#$t`-ECGEKbo@Inq3Q2;~Z3NLADR{x*w>Ds45 zjem>asK7WBJ}OO{3@x6@`HknPy&nn)%#b1Sk0ymdXgZHb67?@VCOt(O>(Ssz!PSeW zPe4tr`b|72iLBGo*ph21NV^Aj6xKCvd?3eKedm6t)$P{tEbfH5yTHVSlpSuI0bU(s z{6njT&S_S&p;f^7Z&M#nsevn9M>T)HzDthQhVBUo%57ppmu0}unm{+yQ0fQF<7a0z zu1rm{Vc;AO=sl{Nnxsq403N^Ck=TcnmUJucv00DwQrElPZlhUObNC3NefB-Co_Lks zR-CR3SP<0aqvV8RbEyk&%?Ajl#1mPIgqfzah>@JU_;|Xz%6yB($@pR12%+_tlEfjC zaA)V=!BJ)-t704f!qYNVs8LbwP2^y~bdO~2$4hxEq<{5eJ-ISGxIBk?#6$Z#{ZBWU zn&zQJLhl(erQ|nGb{Td&>``C?l%@kw9tc_gndqT3AhiB_vOkV`PSA5->9x~QH>jE9 zj41W^=ksEGAhTGO^%ZY;s{WM*7$B1O_=5m^6al91b`?rQ;Z6n^-aCV!yD7ZmrwAuk zd;LxJ-&;?%Z)9U5e+31p{bAZvC^Jk0IDqcp^s7$W3qfqe56fVdwwDAazx$}v8{38G z$Pk;2lU{I6`|Sj4^s>Gv9>)3oapks-C2AE!k1sfxw~ZSD2zvu~@cMLj@xamG_(Kqh z)4=tWWN8#xMC*ONP{!lE6+G(CWD<-$+}E&0fp$Czv_xPQ_tKjB0%Od9%S+rCq=+yn zotRJRiWU&Y7QgRox!}jaHO!F>uOIMdT<3iusd`Vf8x`k9UiQ_1`r^&H|5^HCUm^e^ z;3@q4{#A!rK}^H2;XJ(s1w!6@ry;_K8K9o|yDQ)5+i2SQE&ggJsQbt&J%%+?~#eB98Iimf>7t5u>OAK zoE(qinOYc38gIS%uyp>nvr;SsNU?zdj=OMcG_?qtaN(Uf$D<)4SmY%v^H z6xU&^x6IY7q?}R|f0h3~hGQzK8zTeSj{nV9Z?jswU@Mt+E{}$rux}rpwYI;fseS}& z^&>vMz}OoI=^k}4^E!7?=kq0Map9>6T)V)7^zQ%iKm<^^!c7D-0WTg{IVmDXc1yIq zT8kjZc6GFT$fH$}RwhvqirY;+xx!xQjf=5~$5Ke0mt2IU?S4!4g4TgxC0ELV8{d$K z^BU0;_PbtmF$ySw6Uj>^MSch=E+Qh5S_J!akin4;MHGEIjrgy$wZNDcT?L#(zCSj5 z>s?n{Qeu=1yVo%9{Uoqxeo*>#yroDV&}$8q)to+hK!a-6qd=HbEzl%K4|1pdT@{l0 z0@JiK%~Hr+35{jMgghRmWg0 z*qy3i2TwRRUYKCODt!SH$I268#Ir@Rsp zzjGn}US3Yb4zPk>-fMUK18;_Hj~JRe{FEmVW9qp2HK^H7!Qg)AFGh(NT4d?R67q$D zDN*z{6Qen{qghFun*kGbDK8M_9j;ad;HpDt4}Pl$TA_lis2`zvfHh+D29SGd2u%EM zzQJKYCtLfsg9m2iKFHLE;8kBeNS9LmCpSx~7k;%cMU$hmJ9+;(giQ^u_YO=uAjrRO z@%}T#E0OmOn}r)e8X4c6R85E3R~Mgv!tlGGQqb3R`{rRjIXV^ZloGg0N=ZfOC7CVc zsAmLJ$PtQ=R=rR`84}1-T&{IAw+6h4JiYvzH5DawQT`P0-!~aB*5yvwo2_|FlEc4U z!G=CuHN1MPKk@>MzVRZkxKihn#OsTRh429(ZA10C(DR29D3}K^&XP5L|Kc};0|v49ytB<%mtkH zxqgfjf~?oS8H z8ba+Zi+6T_60>CoZ4-WuI=c4EYv8Ry$px11gxTE%tpys0sqh}${b(?gtE4&vNz`>3 zPFQh(=f)GTV5px<1L&iyXvy_>;P)WDS~U{3y=PDV_y-F%&r2>T z!P}wUGxv6n0wyl&!By(dpO$KCiPs^IEQ&HKFHSVX66J|3=ukd@a(l;p@sKeSh_IC4{&s`A zjsq4qHm+K&ObZ`aELKbuHk8NXz?-$l5L(;Us7QKp@DIo9=Ig>W#zeqa_CspI`ZNq? z4hKTbm9zJajqm_&rwOH#TbXl{5?vv}gb2UinkOj;JbaF2#NL8>(2uO)wU4QHJ@3Mv zin9r0>JKcRkXAGM+t4fee*;=^;3Qb`Bu&6sNnBhi6$>QE zCn}plUU&T5&WNJ2+6VZkX_)kp0#S0IZT8of~R z!ta3r*sC9v9_>R)TgSgUqpJgazD`ppZ_~grKCR|EJrOm5=}3_M0fr{a0EGqO2I`9+ zo>OCq*<`fo{50?mS9GaKC94JXBiOJ^Jm7eD-fDD@S`hD zR{oU{B~ioZn2PRLV>Az&tt6PCyrh$p<=L>OBHXgJuYFNhUqDj4XBu}eIrEAnMJ_1{bDMZfhHkxtgr1=SB$!OWgkEmnHhy6vbym@`5pE`7n^qa)%lq zza@aAviq`U(VtHoM>Qe}QI8u{KR^91^Gq_@+w_-MBjF1rWz~LB!dwDeWWb{LZqZwu zL&D*8`KJ^@vIAiF(X4t+p$!a`Z1})j$bk&DB8!6$6TTG@;Y2RzhpJyJ7uB0myeRbe z#&K9uhg}1c8-Z381grG#96ZA5(vcMorx|mRBtgERj~+E}>9-CIo*ogQKAanxBGNkU zTs^N0OkVCx7L)S>Uf(Ik&@mQaIo9YCm=@YP^KT#p6A)dBjqPI;|Bw#=BQQuPG;sg@ zoQeOFq(YLGPd`A4hbPH@x~kv;K;ECge*ONAWCcq)Nl~K5OM;xWRp2rsx!bpv^{6=r)S>0}Y-h*d-pJ7^zYZd-*#(kt0GE7w( z1A3*T{V7Ot6j-?dl7t}C^--lQ!ac>WnS?f97#O!nwZJ+(kN}2RF~JQ-_={PtV=wve z0kwE-S2S#$%$W|LuwAn%eGiv^l^!JF@zwWm-Jv~5C-BS~{Sk(PFPNVJ55w`2rXza*}k>fsQEEVQ+!=a6Nro#Aewp%yUU1zop#)EH>@Qre3Or`c z{t<#*)%(}cba3o1h#p($2$fO|6QEx?VSYCP(5Hj*VcT1D>J2j*pN(2WK85>@nm0mNi3>-^ zUvH^UmvI9R@c=I=VBE*UV`XX2|8<3gP}OeFK&p*T{tovRt7e3wCRi~Mq)QM}o#Y97 zcBItsE9fpOI<0}uIJn$2Rwa8ft9{(PB)k>h7OWWG?Ye~rn2((c?T#RBAPNcJoHnu~ z&%Cc^QmR*NlrCn`J*9>eMd={;aRziz72nQ>Kl4Jk>Iv}WCV2gxz1^Zw6)$_gjWcaK=H*NT_D`wd)NcwcVbQj6bF%@;4BmA`cJEgjQIM zDI~RaI+$&F$D}TncPEE{7uqmI*Qx|KU+Dr5G5v?>p%xI(CPGtU7Gb%x9&VfDq7czz zn6*%nC}4mp`4!+iYiU281%~DAMC$=e{=0|!Rbm>I&j~^8xvQifWNETfQz08(bW72o zK?G9+_#KBoSOaXdh~SxReAFWn%89E$r8!~)J1FQ#i3of+GxV_+09aF`YoYV@#ov;* za~83&@pJc#VW@~IK!fG{Mx6dOMxAunpkpR55$L&eeoc7mCOilMTk652H7q-5YyCHudzy=f+i#*SbSLL2p4!#8_VoT#}a-dCyawQhq zSV~lMi2^2)|3w}3^83kWt(ROEnk9B0vS(GRWMEj>umOqyH-Vx{R`clMnajy-W%+wE zPDExaw**%A{ilm4QH`0Pz7pEzoyW(+TeFSQ=8ccQ-ck%Ha3w-#qyHJyFfxAZZ+SQ( z%1UQ=n=0vT7~iimHSND2Mc;SS-YGPs{eMm<#UruU+*`YVvxvZQI&;xGB zm`L*Oyv&NEl5Cmzlh1=17Y3l7Xi0$x=ko%5dB8ToE3dMCB$dZ_UFADGaOOLH_aoxb zT=my%1n_OMB0@ifeE}@f1P=vQ@oB*%e?88RYf&VZa8jHh3CzA_Hb ze?S6K^DY_W+&(?M`$N`U`&OsUYrRqb9F5A4y#_euBR|6I z6-a7GcWX~Oh{_={13d(g57qDi^%f)PEi0Y$bmB4(B#ymd+>QXj+JR^W_A&?+OQF%7 zNQ7iTZ#vn)u)7mH2%zdWmp=V~9^!FC!7f$U0kFlz|2J9=XNp&U6^y2+Vvnp|ty~>H z>0mPMP{^z2MtK{~7eOd#y|KG7fexnvgT|`dHA`MkzhBWSRC1W@&tf!e|M1J>ok|cT zdAzZ7_5C99FWj&^5)gVVwa|jWGakT9#sFR}q%Xv*d+k#~kSbjcIdHxfT>Dl&lXiiT zOFPIGhis&hc6`1v02tbZ0vb!>ot{*Ev@03PPxyi+0gfrgzFNdR!MK|zL03kYv+%3G zSLffZ&i{t*25$~KME#sqEHb&&{ijU{8a>m6d!=Wg9$(y~3s>kgkP(9bn5#gs4qy0b z(HyOmU|CgJ8Gi@v@5Xz6pvx60GgzC94V8{zSN`5BM~Ze!2sgMzVx7Zh+J+`4d`(hy z4dH`lZJQMT9bjsbssftjn~+6zwKvGn`g>2n-Y_lJ!PY&)>*bP-s-NF4KXvr+ZjYL% zJdWOs^}rpF4^3yXG{3hvSWXu8HBZyLk9{R( z2j2DsNwGgJwQ4VMw-PfsE<#yFzRq+uIyf$~b+Xmj=47nQDcM~m*POG|!EOQLiq_k@ zN7YQxj=VtaErgq>UKLONbq@W(Y;iyB^4qhfd)YQMel4AExY6=vsuzSOk<)(~iNQc~ zih%_DF^(woPjizSfn-45d+<3zjhn&_CMXH%4dtmJDJh>tW#h`JD@h|hMLj(Wqbh(# z7WKvUZ#kt_^PSj_=5b6yx%5T&*1%e78CN%>zj2+VGr6C4et+??aXx+GqH)B%=8WL; zH^n8qMM-wYD!u$%1YfYXx;8l+sb`BTSHcRy-yi>L=*)=txKj=dx9Z>&9_rc&J-z24 zhJ^LWvS<|ueP=4F=!TV3n<_Ag$RtXp#@YhwaH4yFnMJlC#izN+j+hghY_8J~x74IWr)m!DbmBZgMbgdFdVaqOeN7?I z^^EP$;FQ@~{Mp$85SjagZ@qcC_L7EhKc2526yVK(DA3svFn)T+R3p5a$%sWwgp`TOz12T!YKYv21;bm_YMCB*YW-ydAJ%3Um z@l{RsRF^CqB2T-7K)D3qBLGSMpl($ND)%~EoN;AE{|9q=A6mo*hJKC@47o2%c%@DM z;`!^2n*+@nuRWU%3gB)|BsDxhkQk^Ph|c@`kW|cm=Y`Pc%*K!TdRUc`Wl><>E^{zD zrKO70PopTDHn6b9`Nkxc>zEfWKX}Oz3PYegJ~d2)>~P(Gm=m<|`GQ2KqJoUfS5#vK zNs7A(vrC4Hmkc;mR47N%aQlOOR*VAVDFG3Kl6wOm$L%br2m-j^LMuLhy|#FSek|${ zM3h8-zOsem36tOhKXJvmZGw~YrN3;7BG(5Lr<(%3;rOqv2IIR-KdpJozHX12ywbe> z@QHCAJ}|+_8fDBCV5lOLS^34Eq3MLvji6v{>AtQKHP?2CFFq4`)Rc`a<`fxSMI!(& z>NfcJQGjLp$T%E^wiey|_%q}k6D2?{z~bp?D=G*H$SN4-f8XHe584&9{zSwC0OVUS zjE`O;Z3~QwqWeT^128C4PtQ}dW>b|LT|K`O8V}D2w%}hb!0#gX1YskUf&f!}5y+TV z9NVy8g%nQSz)OY@pnm}DPFHu!1;}@F`4Akch(&ir{Ye6U65kCn7A{ zs;+L_W;<0&_zI!Go&`0ibm-rRY8dJwGxt>q40xUnlm|Uj+7k)>N{XDM4}Z6&Hwbm} z!2BvA02mBT1)erQ;8s=4;&PB(O#$Y7n@?x5ym#+h@VaY<1>9z$P;3oxr9U70J`u)o z7e_ylH1Y9MQpeXo;=)c?;!WyP$2kH?v>^h5$3WmSXJaV=N5dtF;qI>ohO{-~&^Q-? zo@M&$jEpkrqmtRb884Hv9H4i~VC$G){K2B5%5_iTlqZH z|1h`f@%vj-E%+EbT$gnP7t>cn7k<;(CLA71R??-V7#3kC#=aUZs>k#vYz#@2b)HR7QcfuGR-12W{zuD|kyCBAf+h{^P*uqn6_f6|LQP-vxIgd8EM%G3LBThNR0rk z(p@a?a?ZZMk*fGy{n*($W0DWj3IPa=^P7o|?t9eo)^Nt8ra)-sH}nhd-04eu zZHA@{!rOu$A)`~llm-L;KPO_f2eb6|jUF1azxWHg2GEbg_N)UvR;DKd!mmymk_+!-Q`~>O%g=wm}_U>)C+uu zn_&SYx$fU2oj3HSqS%)ghC9*=IoJ7MeLe?q&ORFPrC>q-^S%4X_Y15N>wxr5c#`OQ86+)BIdJSk z1kP@YIT<9=F8C`@`NX@6Ctu0T5UahqifjzqgY#d}I8x{eQjn1e=^B2p3?X^5us-tR z_{R-7d<{y(@aw|0q1QxhE%d7v#WSr&T;Zlyr)R(;V1*V9fCW`v27x=lpn*SZ#{_`@ z9vnEqYBZJA_Bx9#%Hf^NT=~}5Tbl5L{bV+hcI(8~2?sUx`aGNicF`iHzR${ID^*+^kfXi z!a#D61wdWk9x)ZlS5nO!))V({=IeJ{?_V$?wex4z!RV}z9VMIehI!!jwD05w9zf#+ z+NI$^TJM-oyha+RQyM{Z(+&;E!pBc$URtJ?@n^qDLNEiCw}GDat!KeobcGuIWTLp1 z<>T_qtiuydlm4*WbxpjE!Vy15S0TYbey7NqvyE*=7D0aX>%a%1SSNZh{CafsL;b;< zL%Y*wz=<&TVfp9;=qrPxH@gwTzTim}sz!+tEOgC=MKJDvPiPPODuv6^r&@VW0lg5I z{0Xzb;VyJt5wA${M<^6Z1*Sx@w(upGwgz6U=QLtjvBtaVge1wewdJt3VnZf#fDwd& zVYbge`Uk6%Uiv>>*6FRg=4=}K6@0@oL5z}wSEx>Kkc-^;sKHPbb00VLUlF(yG=$@l zZUMInfc68?@X0$@PX^IhuAWvcewb9Mdm-&3i_SB8FznlUP|l5df}2GyXtUg+J9=7w z$v_X_lwHB-y?1UZ55kCc2uQ1B+|jI9m)d~0EqGx_liao2^wx63>u@a9hE7asz$Zn5 zZfGGWT)lTHGIDtvH$GO07)oYHlLSiJ{71B@!fpxQSAZlDz{4>o$uW0eD3%d$G_#`OmwM&t;6{*nQldWaVcU{S#h(O6#;HQ06AP=!$;O< ztI&1JnbX*Q{Z#gQS?))IXpqWU17sHDrr)lmhDcBf_Wx0HkY$7FwNXPP(U*U&fq*=6 zHYYc?2p)8!S%&IY*$}xWRyIJ~GRsd3wfT^~nTZHUe!N{~ab*v~O6jCOz=TIK0#-br zK$WX1LNYG{p}ix#t^vQ()qN{5#Y>#A)PgQ!xX(Wa(;RlFG6<2BuvPcrRT6RQ!#Us1 zK7AZYH{ny&vSSU$ydIg_16jY1Mw#ff$+Plw_Cq+=J#r7%H`I-@^RD3>C8E{!>*Ri% zhx|9Y=o@+O{KM_m*+bzULz~wnG5#=D0u7d@|9%TEa3i_BZV-d#f7A$2?Jy9*d$>yh zvwpce!2?zb@|4UFTB<0w=_g>4Gn47ack6#7eRWh+-~08sGXo6WAvr4D2+}b$C{ltT zpkR<9-Jo*;73mUD5Tq0oq@+Ve&<~-~2$F-ebT{*x@B98eYu37F?woU;XYc*&y;e+O zEW%E{F25n2R5xfrM=+^D3($iV*64!xGk+RWG~5UpZbXCqWl~-FwH-0#f5@BH*z7)V zRqF-)7zEYWnEM;alVc$S_LVLD^a~yi_}TtTeLczMTBVa${ppO-q3>qDJ^r46d1!mZ zr$9Sp;v6_6qXHuqKsXA?x_PiU7cXlZ01OC$PVk1B(n;-ciS7;H7O{CL*=| z@#UraHD8wVRZ4e7?t^}coflQ$PBU>ntDlT5tHfE8F3E1aX3Se7$=vjCj2WC|QQTG! z5YpKphW+>#N-I#T-Ilm~W=XSXC4lgkILOqipOqtruaSXIX9Cowrb+A_-$41Fl2|n8 zX*Pne^Uw#Y$38+{M{HnF1BG2L{h}Cm@UQ*+f5F<+pbLahu`z?h4gtEHB*z5?;FeL) zd`VtWI%#(8+7c(QAb*u%bL^6`FOe6D9$7kPbt$6~iLh`*rIp=w8MuNZLj%fT&Pf#d zvc2^u+grTOZW{4tW)eC2-Z$##R&UBrO&`!!9k8#_0HaSQO&O|k%yEtnf7i=_-f%dh z5w7&70S$b@+aZIl|AP(Xj_59RD|sLS$IYu9E)Rt?Y+Sv?lxK z*Xu+G%>ibDc+m{rFaJ?;l{||NIR_wcGPl?jnGI!;7XUa5%K<{juqWp&wtEI`;GfI? zj|s2nvzqmjtlTON)khdm`28V`?Q(Xcf+U3`gP487Kc#mHd9?*=kdPj6;W*VyF`Py+ zb-;W0NO_7DIPA}cTEv)pRu?utq=5q=@ZMql3pE)-<@=+B65UPZnAKCw8H^}dtG)lm z!QJg!3B}HR?(|0bM`glUpvp!`0txOLxB=1y`7OLkjt%q* z!K%q^|4CBzNt2Mvhri3{=u2YzM4HHo3W+}?*>USVlW!4ST1d2YKH7_nRjLV;k(|<>xt@Ny*|^GvE+R?8d2i1J#nwr-t1d#%jxd0{Zs^G?1VO96c69+ znh(5X$Mp*oOhi58b8iq!HYATIUx}as!QY?)R_OC)u){+xP>K2~I}s!A#l$g`oe11M;9o=P_{h$$7x`M(<)0qrD3ji1+c=VudIT zK0~$;elm@zR~T<<;CoG|d??Z*r}oS;Xyr@rKO>h<79&_t_sctQSVtZF00jclxZ_>> zyE>8x{C3ZjzAsi|*6~!9C!gYN(%ItRkLqd_sWdBvO4WaZK%n zP;vx-$KVyclo@jtFso?F2`XKg@oaRMIrpjmUnK#sAyKjOK30O#v}i~J;Qeot!@uU2 zGG=a#0J~m6pzTqZx>RRwWi<@Y3>nI@WD5_!?u3MdH_BE^>P2cgKwGM|=wi&LV>bB- z9rM3~SNGSaJYDO1eeUoi?CNd>Cfcj{?3Us3TaJo307FtYSQk*`COqDL(UJV`c^=W> z0RndZXm4F-3`t9QT|i;4q27T%q*IL+HDFKl_5EB{7`B!ecu02lo0SS0xR58cumWK+ zDo5~hyA=SK2a$uHM@JU0?|~;7X{>l=p>DdGVdaT@wV*vV4E|~F>t23}6mW3yrK0*E z59@Gb0LKxkmjbJc`F;^#DZJcS&P7W)EKifNRT-#bRUejOwF-BzvM@L<=mzKJuUc1J(z~w zadUFL+QbQV%}6(~t)+u5h*dJ!_}}9RFrQXeS9lM4CeC|lBbrzuBB7KGn!CGxDUBy# ziXx?s%Gi%dU}Jsus=O z(r=E_N`RUd8lmjoTM3UBlj&zD_*2bwv#O>WpJT^cPkX7PO7D-IM||{q_wF7Q0}y=ME&>vF=;w$# z757YtCuOx)i9?&M_IvL$;j;#&5$cU-h(MU(@-w+_Mj&CEIzNbP&d@Fma3jy22{Y-M z%ZXAR8=LS5{5hc%Fr=7wGDJ!#C}_(TY?QY&oe-P9mvh2{z|&22`~Gx5N(-!#kvV;uz9;0}PU2cE3@XPNJEQlV?u6f7iu-jTMyN=`6Q?O>Ufd^0L*Fsg_Vo}1y z8!r51`6>rN3?T3hWzL*rFK%W8^@2EHe>|F8h}&GS-YW|`R>AFlwkNKXec4qY>S!kd zjl-#C*PGaTCb!z2n$W}3%ST3x@)N11=!yh=~!rj2yX+uW#x-J!FR#N z;8!{r)UuDjuNrYKwQv7>-XlP|xxXmA{PIQZ3Rp}-Zmy}3gUr9?b8~YE5fLW_wr^&B zYvBPw1}oH^fOl2V5LSYEMmkc%g-PhsnDnph3&U{u8?hZOW_dc4SL}n%tq@JG3ZGj zz|Sqay4+lF;#DBS-XbLr^O`UKQc6aOR!kyE;>1hdeZvOlw`lT+O*j)^6jYdj!%8QF zzitvQy~>k++KZ~2$ck({l_RO(`T`FsK+Xsw{(8urs1=%8(sA9<(-ZL1+s@}7jWh_N zAbcF;(XyQXLF!EwaBLMhnu_yx*%Yu0J zZ=rZ#^p^)_7NX;BR+O8hG+7)XQGCj;N&3Glx~vY>bFEi%dozSdu9xoU@!gm6oxS?1 zI3eNJ0OYSyO0S}~17VUUgyUycNutRN3!#0g^^7PrHF8W7-K>$eTh<1%pN$ol-F`Uy z62ZkcPP%u9oJC6`XW^=ZDXoa_`E4We=j-!OSovx&Di1D$N=Fntb;&9vzS)EYWFKMX z*VID)F6LHna92$pe)Z5uBq7+6TEO&=mF0)^X0vnzwI%Zr^@u)q|7lDw4HtJtZuim`Pc3QCe@baZ8ngMIK zt|y3zP)3N>=wTsizikY#5&S+IWlA*BK8;k|+m|9B2*siM>X8iP>#v=o5R8-29qq=ng*obH2xOcv8qQv;VotIo$m)S#foWDrPVU)ixY*0yrl1jwXYU z_Vw%6X%FsZGw16V{cEeQ?oQ}S?z8>uJt+{AZe?qO-TOkS2n^TShK_&z%B|-Ahen`; zB_kUl%h`YBVa*RATaQ=vEyQUO`^}DfP7Ac~`(Lzg>;{qo`pVZ2CYv<|5LjK(i`uF! z`w~*15D(B`h-`>;NaYi8gWvR#Xs1L96Uby@le`K#UIaix+Tqc?1D+^+CJai#@{fsY zdty2~k1omtw$lTM&W;<2E_(E6C9(0;Krig&!L6SP7qiGqdVzxqilw}k?2DMSM-ScB zg}}nYpMxy*Zx+7OxfKpL`Tox1Q81g8ER!!OmA7Ml%IW~I-P#;tGk`-4Wk$1TLlHkN z)Mx(-GfCCA4;Yr zLss@`@}&YWN6Qx(wTT*(*hLj?Q{j%cU%K_{1;*JQ-V44%3lZiPZqvW5clf(Ah9 zs(>CwT&^KDyM!AAfk5|_#Xh8dBCncCKOIA_$1G(3&+FKn31o=+m3Y$XFI;p$XVYJ9$z(aiqM7iF-WI_h z)e=4;)aJtJM?bbM|IL4vl9KXSqreulf7wfH`Fajdt?}4tebd>LuH18KvKd#11OkY& ze+zg7H`l(~+r6#RcVvDRcZDdxC0IbcvwHfGd5}c!6>9|iS31XokKw$gAUE<^VK^gw zub^BA#alVBv-{s&tK73Y7r-qr;Q0!c@~%2|D(t+2vAsSZ1mI8E?93!hVJ!PCvGRHn zbT{`&$OGs`Z>HJSl85hvBVAmIY*`h*{E~e%c8)^TrJhfD-^qf->ir7IPaY&wB^HYM zFqO0@17VUduh1@$usQKLN(K^I{Vc){87^#Qsf-z%1g)zRPQz&xAD_GqJbPOTnKFS{Fs0%%`^t{OYr1gm8!4Td z$3!^vU%uJx5j;6wwQc($iP?q-(U_&$2s|sv;LUtO%C>^`6@@rlw)vM?AHEPslMdz3 z20i%p>)YKKz0i$xxucM*HZDIF?DcGQ;Ku+U29mC2L3i_-T*hZ;vE_N6VE+;g$L(j$ zSXxt}zd)kh-`3qD`Se<{%al>?wfLeX)!pe|LI|BM(T^7{2Pafr!9q{4wh<)IjxX?>eSgu=+yD#Kzl;9n7nk(nNkAt!PD3EA6M1j_Ef^mT^46hj!LSV%z6T_h2i(X zq7w+ZU?A8{oV$fR$gSaD2>tsJn5YeL#ai-Wq4QpMWy$aA9Q_!+mrtz7G;#hW^!$rV zVYwz3l<~5L92=ej7PVL6Uah>R#J}#nDj?MDwqwtAyr$4X_t$pnq&pC|l{y)4scyOpYK}f}V&ZR54qN&QA^;56K?rm&1CNYUU`^< zD~B~pJiwIonxvNq4It)Wo{)+RgB=lr9Q znn~oO;lsVuzNc`TS#rQr!j7GVwJsZwIP>Zu>X)zbomJtE3UNo>Ww^utxI9mGh>XNC z^A-eju-y_3HkvP*@HKWF@b5-4=yqFjmPrX4EbE%~qwj;(kS_m7fcd`pu>PyCMh*ga zkl#SSybK+>yFk|@X@xX%n5{_PTiYoeIRbI(avx}FVBpLGsD)@L{-0{_>sZE+J_YOL zMhO*o=^>i5dn+i6zy?`X?#mRJ>a&TKgQrIhXVmuVJmq59RFvp1x}br z{MB|N@u;k!xP=OO1zJv5i_6YPTUEnnwj;+X7nk1Q{cfXfwq_ak#aUV4y?LpUDucTX z!{6c0V|jU0V5tzQfDHJk44O&gv2FkUf!h(m#4<6keYB@_h|iNE!ah=(7Nha#?=H#a zkN1pOEr#)}z)|V%)+IX>@XcPmTt*Jwgtq4^!Dx_fdE^{IdX$z@wFF|T{mCjtn)YeD zWM7)Q=9WI{)!gAmjMx_{sRJ?1+HKPCRvT#k8rCO=VwS3|tT z{asWa-6amJGcC25{yrti%F!gcxS0=$;0|VGa9|DsPtTqP*Ekej13iY>_J;K@d%y8t z)Im+w|^5V7y6sqriG28RgEYIgYmm$YZ;QD{EYbe8{3Z- z3tAo2!KzA2*zQ7EUKV`sUflomv_zE>BH7_kwvsyM?FEm|LCmHM4ZZ@T=FxX3Dtzf2 zmX*b4Ad$=3_i*bH5>uJQZ8Fnc;+St+{ zB=1++Wl;NMF+=$ANblBd9(83JM(N;nx*nkjM=uS`*I10ebAl}@8nb-;#4C#lgyIf) zs9;>uPD}hr1qBuy>`peXpKNq6j?j9|Mm778W9*#&Wc?;0OdeSnk>%N`ec2Ee;UB9c znMI|Zy8k(7E6_-7iq=Oi(~^gKU)n#STG&olRpj%FyW>VAP2OZ0xxc9+=Ia|?kVc?; z6VLV%J>Gv#{t&NLUyV-;JchDgd8s%XP$k)?xgGKA!b^(j1*GYc!oe2iMdC=$?I2x= z$I34jGF#5laZB|>i_K4cNsdtsX6NhaQeoaJa7x27itGDp6O4yC!QMA-O8?yc8$u#q z1EB1B{$VP}OO+NR7UK-Sjw!Bo|8;XHE@Y)+KSA|$r{cWXCE&Y~0AMRtBn9(4nIe6M z(?jMbI!-k_022-frUKypYLBi6_WjPZ#0^{#j$ybl>d|EPuZKhxw%w3sTqO-b#G1^D z?;ANmSb~h(+KJ;m@-jL7?}jpeSclLl05d8cDQA5a_XgR6LLU&Vud#vrU_GrYc?iOAEx8q1nK(|II^l{ZP8kwm(1AE1_qee3Xn}9KqV--{{1ag37g=4Y zav#W>Ji21N&dc!kh9Yg!({orSQn^t?iT8yIeqnFTIsX8P!8|pn;99P)GNbC_i^ZQ# zt~a~)>fsej5e94oe7LsEGw&8O@k`6^iH4-U{+NCy40N!5qwwW)%tRH8za-h%q2l9~$QJAqan*lfvEx&qv)qo6=CN zInl&`6Nyp%@#Ah2+(C62kC9N#kE1qWk7(-#uI=T8*7y^1>G+dCC0qzGGax;uhkIL!|uNR+QM zo_|IsQ++BFGkP!1j4G@$-}9RY{swmBwo2Bk*Ebj(LJyJD(n7r~IZ7XUTe!rD7-Z5_ zScf=uw92*Kv_0_l(Q*%jczlwtFd04{Oac@7eRjh zc5_N45goBhK`h13deL9sWA0zqjFzjxiX527SLB&iS;WRj(Ma5=_|E9O^OMQh=~Gno z(YkNTO7rKy+opw7C70`CnozMhhmY6R{U?SWkpMH%c)c`2jq5byw zxU7mTm@Ya?=5ovwH32SYBfc^3pYiDo3-nVSIf?qI@>2$U`>xxg(E_^Xw{H?Z$Mk8P ze(z7Wf9(3-*z)gB=^gWiP3-8dOLUxuTY7uHGXG3Al3_b)CKY`SA|F_V(j@$7Q3+f9 z*ygb)!nkNDnwIy?>4e)Dlc}mC4S02lBZ#Jk><<@N_-y2Qp1&kognl7MI24F|)hv2K z-dM~(bw@>tHJk>2NA^|zc@TmikxY;v!=(kdeziqi1e-Dp_=T}A>S+s-VdmeQZV8{> zD0t3wA**+<-KZZo7`6N4ac|=7bc;*AvGck38{;kJC}ma-_V#Otzx?q&IxyvpEJ@i? zJwwJ^aR*iXIlCYQQ<^WVCHb;JvR<(12+am}?`ZAsfKUkIiTFXPay>aH@Qb)j>lfj1*Jj=sh+wM0#(0NdO|Hp4Jub&hPJ~Ewh=L~3I`U67LkKwHvzQY;IsILxQ zlshpu!c$ctQt}trh=3SOiJ^;VcW5$rn&G-Dq`?jXmSttQcFGVENJLE1B5rp*rBp>!y{xWI;&+wny2DXz^QrIE zl@xjBz~z0X{vb{BoAm`+`oa?V-il?F;TXvXLRsd_pjQS*QSJg7ehZ;j;XQfJ$5j23?(C;aHF`WBPea?<@nicjh` zDU)!g&Zxx4X037bp-^S54<%_vvYg_NZ6ddN<*8o4bbM3OMU5SR+Idl36OiP8Zh+t0 zniz*9{KJ`)Z*)SpgN~Js9>D8m@@YE2OJp$5!1ZSb9X6SOxwW+Pu7<4$=UVv7iS79# zZqUGEieEb%n70>ZC?9AcMPiq4`S6Do;C2$Urrg#7Mh%$WUauUZN$6gyywQAn>Yv<= zPX5e)B0Ra43C0o*lDgKvy;8yZ3%!_O(Fb>Ur1hEDt*$bV*1b?9ezz9Vaf)It00);6 z2wlz)!+`6u9#FiyZ%lNzMz#A&jGWkhffNtByF07!f@Stc$AP!cR@uLQ-yF#2-w`#5 zRXe_MToWgzP~#2oH;|>{O~DtDPN=c%8b0!K;a{hfM^cWIMk&5+w|ohLPJ%<5j}{($ zQ9>gz;IYb5{lW&CB!E(P0X8e7qy!`P`zsv+fL)#1Wr!~Hjl0h3#i{XUu5P+q~ zpVMt4VN zml^Z@f^w4cj$EkmgJ7dfPm2;Qef5J1xjM{?v7qE`G5dolTYgvlDUjo5q7&rxix9Ue zI!LTsZ<@hLv~R%OB~!-;!jHS+xEyJ@y5*}5kTs&bxOpW%?b4sLp4!7n89EJ0E^NqV#zV_EFbiH zH97zjcR*l>atU;W1ce|+NFQ)MMEU@X1ArxPuV9k3gGx9;QBPQ0Aj?wyF+~tyXy)a1 zi|75Vg<&+f$CuPXM^b+kalR|;7Qf>9D{f03sas)2-=Ac2^In3#a!|R{EcBnR#qX~8 zLS5@^-okK03SKfGbF1dZ*m)pXcnO6icjzl1>)|Ve@HO+pgW3yA{-I3ZWmmO@sezck4(h~v{hTbh_iUX0}Fbd7_jU@unqQzMt(wSnmcPPC}= zPRI+b%~!c{*~xbwwMo_tTv(UjSQ-2C`4E*;*7omm)d}Mw5j~)k`DVPz0W#G<0DEHS zes)uHHiY-~b0^NSySO{Q873b8m`I1l>F=NWV;lIW=|SK#aSy65WCaHa8eq|p&k^~ zH6gxVsRyj6%L?6NG(SI)$(eP1oUou%mm4=Qvsk>}s~F!!74ZRaMa3YgE99U}>ec?? zZSYld(6x^I68xa#EIM{Efj5YWAV3Eer&Zef^a#G2Q7^M~QiB36T$Rou15@i1{Lt|E zoLGI?fU?dcLl;u=MhZmwWzb;bD;|XhV2Z;CdT&%lrqT7(J(V^9`bO@FG=IP%lOY*7 zk@Z$xcIsM&?gjb+sA(88$_KdLMb7dev5QE+iO|YmYF#WSf5KYY@8gY_LJ6}(l+syc z79+iKit`5?Wb3+YY;Auz&a)l5@KS)Ki<*~vhj5eaQ(ak6M)Lm2@KD6qeaYw%&*7ZZ#2lf z$;@?57>TF1C55)zeLw}Y&c1yvHRCg=>jK417nrr+f{=)w{cOl*41YKN; zb(&7IWj&=Dzet|&@>~7=Q0njbx^rZ$LD|{VVWWDZ-LZ)7mb}XvnG2wSCVhMBWi?5o zQV0_S@%#fSXb)m!lz}AmUQ_nHb+gpAP2GH97OH zQAJgHm;xMh2*#TK(cx)J{8VB7%_Sq%R5j#8+g0_d0@&k>;~%9!GpL>pBoL~;R;WoO zDydOlg2__Z@Z6-YPVztAE0L@ry;L(|%={s6_y~IrJi^*$1c%FlCKj)_R(r8Nj{ueb(Wpx>Y-(vkM?V*$uFYT9}p=fC5WRhm9XGLTdT@d*o7;yZS zoe+NcM(p=d4xw;5j9Y06h7@Vs_`i4Mn4Bzv2vVNY6Y8J{<1P!NV=v@>PVTF0ODDDc z8%Pv$AhG+9*G|v5_QW54<#a*ZH{tdG;u#8?1$wScRRi-VPP;jh|R9)Y!N|tvAd2Q0*iW0z*wYZRjdR|Md zs<+4-T7VNW6*gKbF*dwOhbg~688!j_nIP`02^!86y@7J>Ng6GQ30S^xG<>sfBz^n% z^|h}8x>p|P3Z5QZi9yFx@uZvmaj5DOicoW&?UX;GaWC6l(0IatagzzLWc{V4bWPZGk2U*P;^r0}BA<#YPQ5L)-5r61`ixbdMR zdg~KZc}-J_?PlytX;Oljj&Tu>gX(`!#1mQ=+nZf_|Kgu{$|_0*7?70AH9wwCRR9;T zMX{;cfmA<{XoqrYRBN=;&x0y3rCz}eY~d_=2v(qU;pOJ#<<%j*p}OmFOmOGsW{UFG zz35rQQg06%*%V6LeGLylZ`*i{dYZFRIiGZR>Q(4_!o7oB-C&jszY;q#C^nNuZhA zg+K`cOslo;Ax@V+!2BLmx4+_Afy>@ih``q~M9lsgUZzPS=cx%sq7y|;vQ-_kH^0ff zo<&jG9wS#Ef_{qmOKLJY#SB17^YPsE8|k2fjEH>#*uTH&a3H7{AQElfa`8ySIcc;v z;IdDawC)uDSnHNT8^8#L!z_MRbKam1jjdF=;(jfQm6vj&)3Db#HQoz9c24*~QBh(_ zZ({3BsH@kBa1h%inm-WvEFvf*-sYlpchE7I{15Y%1+dbtC`ig)uS#pj00&mkB>w0% z1Qx6%g^-F*6Q;9OXID`NN_1eJ6k#y6=>`BnJx9%U&x;oH6Nl~XIdw$vn|F_L`gh2e z(_9BG{p$$(And}GqbML?*ysA$p8SYnzUkZK2L-N`ET^iYi?3sC8*hT=o8H)im<+wP3>W1MQ}K^<*)w&Ye$Y9}Zu zCY|To(rn@(>`0O$!_>^ayC^6I?XiE1;kUYAkVY}sXOno`eY;x_6f(b3qkh6yN8BA2 zhwutp%#-?IlDF?RfVhqYy-dUe74LK4mP4Ftb>kZ3kBcx4)h`~KG#7OGjl=BRNdFW? z0rnysHj+(?(%s~=HYm?Kdonaf?`d$+Xbk_u(5jWDgb4>5znHU9SqVsWEpQDt5j#uI za}#Ir&xvu{2|!#DLXMQh}xXb;-t+32rc6UDq64-#v!Y7YN zF37=&iW;mt5YT`V3k9-)jX{H{asyMmE+vf$L^Gm8QD0_ z2(O>z7L{N)okc_(<11aRb7z8bm585T@t4^X9YZKhuQKGGyE7w&r2|5d5#N6e2x^$6 z$235vgS==U(_h0@LvH;P0&4gI-S$(cyqz9Zhg@)m;Cqlm4z~lf-BDC|XNw&7bI`^O zXx@&7a+!#Qc=&{UqQQ{e2RvUvPP8ON?Bmzaq6W_zc+XO2pkNGoWgLY4Hj1kU2v^>= z0l1m_g(Uf`Xn|Y2sIno)e;*J8ljx@_{<%&3fC)d*Mj6%CcemV?((xWaGuPzQaG=oQ ziu}#!JgOh6lY1HpfK{Hyw$+_J&kSN=9Hrv$G`lI*ehl1}{><)0cGgG+Vc-hl*Ijzg z#pO!UA!t(tsv+o9>frBc`spRW2OOw@54@y-;{t(5E$R&c6rMM`Jt~Gz=j$SFg9&}0 zM9R0;HsT@(2GN|`gKAs3t|OQ1(Sfr+@yU%&f)U_l(^J(&K_17FGqcjEf1u?~_Zy`W zBs!l59EFu?q4uGaFl8u*S=gB*>eU8qIX{y|m-3Lw_@$BoQ872YdnZfz+D6fxP~w~q8=~!l|~08RchJY^*l_Fdx2hT4i?^VNvdko!xrHb z88C65z+d~m`uYpWHu=K)132qf96-C{B}y?E#*e4`Tk%uoaamGGDyS*_=p^2x!NnG& zyOF}(YA!(O0m1*$OOmB6wKk4Lf{TQL#&sR@$KSJmFB-!3{6}5wGY~8V!XCixLYR=@ zfn|Ew5KH{-wL&k2bVywAq6DDgo=@0d&pO#ROOW&TZ=eZce!L|%vIay(s-nhc{t?Z$ zMFvx7F2M)aF5P@)^zxQ|K<-#d*jyR;QIunyM~Yuz+pdO;fZ@1d&6xXyktf~i4y)53 zgzad{)rH?jFrN_`1j zS9rboGOSxiF74Wv@b~Xuab9pjw=jT$DZHDtHP0+J?;-FvCKvuHAgMP9lI#E(83t&! zXt2Z&*NeEI8h(!mD>jp20ovvZL~;WFKk?Bc3ZQ|ASnCycfBAmLy?=Z$%9@tsflvj~ zI^jCdlpCOA;K@qjy2$!L&2a9GF-E@sItOAS5Q&1pe_zD@;D}>S`Zy0|?pnzIi^(Zj z7MasE=JSF_P~u=ffPrm1Os0pKxovv;~tfR*dOp{?5 zS5VL5@li3cLMD$xb2UK5DJb8c{qpx<$=jqAVUTC4(0lYQbf3-_0DkqjcQ|@fSSXJU z(VrYd78*Z_{g0|$-_Z$9avV&qlj@RU>I#R1mjzeVtclTL-y)1NCDJ58>pg7UNLg>- zNNB$|Ej&q~b1{6enN-nKTYOCD{6&8sYPFmD3rj!|zikDBXNqV~LaZ(JmR>LoPH6}G z!q}t47~7c%A;8DlDe?e+318B8#;EmG$MI92%gc{LZe~$tN_VuLHciaj8B|9A9bUCe zs5c&qp$rP;QC(uUr@3(0zp5xhfv;;hQPoC+sV95(E&kC?Hgct^kJohVy5rf)5+`5XF zo_HKb2A7>Fu{o?yj;Ulb00$n1?%lBpzx9`pQ>^E~q*~F=@_rIB#}e0!3#!8%C_e;y zYi(rMXc`DJ!!7yz=!sK++)9&J{}F&%p{WXchxp5kFUbZVipB93Sclbj)uKVQB}yC({7y z9fgN?Gs(V2UG`C$n`*E~X3pSI4KVv7q<>FSwOKys?Y*Z>rRiynJx`>K+2QxUV9yT@ zD&g3boG9Gc6R13j9_+E4u^sVGPS(!6)wu|#gVe-zwV}9z#C&23&W_>>VR8fi?rNK@ zan>j#3-pMUiPeyEUeR|9QA)}eBK9ouJ+B&blAX;D=UzlJltTP2a-ZZwFH^&;?y}P4 z;J_p|=EW6Vnfjr=5)}f#{ItwUnH`|TuG3N3s2C~d$zW&Jg?Y)|zr7^p-*C^MKU4h8 z<0+Cv;=17eD{LCK{rRqV&WXNFs0KG|$~j>^LTRdRVQKtIm!l^Lp#-|OG`QXaPTk@| zZfzjZ0SWSm>QOA;xs>pJhoWC&l0keF1X_ohOGDeo7d9SQqmkWJP4;< zXCIK(ey`@w)tjJK7bt5oVDyRzx_K9_xz>9!GEk|V@3g!{wM9)TOL2p49fV?bCMTAOD$e#&V7`p^|iRV{NlKzo4qfS*h z%UbTA++|5Q?u30c-kv23W+$xAOx{8ZI7-x~@Qv}NBQ(E_l#ND`%2{h11@D^(x|3)K zFgPe54B!wrQGKF4?$_Qa2`{FXfifs4OtO^y(X@!vK2WDQYI7gZ(knh$0`~(UU*}>q9(nDfH%fAlIhGD@0Tyi|m@M)P2$1TncaKRr|LrF}Sa^rE z6*YAo+GySQeFJ~K-tMNQEd7JUb>Bow(|cZ&3wBCo8a$oqpBG0ulz;)^(vnI3luvll z@wk1z&eA{qV+u5xkSNiRV@y>>re89jt?qM+XnZ#bydCEOg6B4Z-i&fpZ|GnveTMRO zz3}Rlr1`2-TXhh0FK92vWBls={tAz10`4w=SHWg#>^l52vX40YMN`Aa^wbsKiF&@xUV$?G6L(NZ5n(wR3%4Gv)+8m?gRzF=<>%R z7(B*k`*dgh5uv|1G!%<4r8#UXAy(Sfu$j=<6U!ax4~P*=jT3~32{qr|47#?)oqQ%N z$ALl4b4J%4x=b!4V05V004)Cu7|i|kKj1Ect)q8q|6WInsH0&vV9zk<*6r!b=`Kwp zvAST8zm#uAY6XFuaeMdUYcubo07f!(-!FXE)y7ztc z33J%ag*#6Q5fwv)#n9O>39{(blJB^0^)DrL?h%F}5tpED`}wiR1E|hG8m?%%@ME+J4?-!~7BXYo#Xlkzbft z$;*^YjC`s_SiE@}6@8A>V9J49UXIX5?9G%|W{iv>_o@JB5EQmzriL*6b;v!W_OEnh zyP?G<&8{tkr!#}EK1PkE4kOZOH_w0VHwiA-8tKc}$KXr}D9Zf7#gYlx}|@QbLAxjsO7V#YGY?fA~1S zy{f>9eO?G&aMG;x@A&Be)v)_Y+=v(&^w~wL+4TB{f}i}2#$1_u<0`>?t*ij5OKvxU`zIgBwuNInZJvELkzeBbctZZ z@?Re7u&s2x)Va{P^sTvA6JZ% z$7nlzuSjA91T9`+mVPuT%}YLv3I6~JQUVBUDd#*O1ZGaGDBXEX3r?8)Qa|jyDA9a+zBVVFRMq9FPnbV>bO#y4|thX7hLzlQk^j@@?MNgYN-X)m11;*S~Xn)BN& z?yELAM8~Hdm8oNgIh2t?-zcJw(bQtZcdMxYlN5u8>J7hf1jjLOhKX%aGj`@;V-0p zN8Zn(p{D`Rf7*8ZRkf;z@)3`3pVphvq46vT%X-eWS0tF|t}0z6Pxia?TOVY9n~+@h zYk)>`$QFMWM7|kUdIt?Zp2wcycSC=L29{9gc~V{lhT|6*@r`HBGj&^q+Od@Zll8vN zE{jk?ZkEda(4@mq;KB zae6vAW74?)t1PHHm-LlvlAJ+QM-B{T-O>bL|ESB|XQJtHwdIvogB1RiV;K&2`HfPu z2bC7_j@x!~x_%tORGu5(9k(E9o{x`}&scv#I?V0{+P0*wLs#`XzYa%Z6;8u0TV<8g$fINsh!xN+d z2<0aB@6ItZa@#L7DrC^B1#^qn60QhCaox*>xb7gX@GI#^pm~~x5v|r zKMST$qr;C$r*TSZs-eE2viq5#T{3^dJbJQ`9gjV4h1yZQZ1+)P;_mt;0`!pCO73;> z1&3;uazdC3Olzp4AAF1Uxdz~6{#a3QM@h-a*wbfJu`e-bCG^I#N{ik2hYLoIZzY}C zWaru_fWhwLX-|k#_-c2GQE{aV6-mY~bLy=Xey_BDB-b-i2`g{`KP8HRTs%t*uTZT( zckil7^dhhbJ88>r)5{HJoL(+6JQ<_ z^@+C46|~<=Zz*_8Zj=(e4k^xX%YmlEoquI!I_?vhfZ zV-abkq#Kb&Sh{z<{eHsC&djs-eXes((YQ2R1JZ2k}O0EY0d4Kb*}Y+~}hus)GO?8b|5#=i`uzITR6Gbx3~B^%?rrI%%~k zI9kb1QlvCL3jgcAbGqnMJDX0^1ubnTL7|+A;L31xF&Fn}1~vU5EGGo@QxR++7v`vG zMY7%iEWA!0iT{WBzUG*ymP^Xub&ZVT5f?=9dN(IQjr|)TdkcV2E-pRBtc)+F*GQM| zlVT7{%OvMAG&dJ7T7KJ?rQwpjyOEy_zaXPOrt6WD(GJ38W4tG?Ue${ZDwrzrOM_u= zHx3oyADctRE!i}yzX6LQ{#lR*f~&D!fu`fv+b$yD3Yr>7))g)H+BTnJ{POr=~P@l;(z;TIX6NO8z$*1~=r zzyTwy?u=Lt2*JY<@U$IC2~&cRGaDAH!sWrLe!4QR{+9f^(5u%^&R)u%(X0@TCYzXu zk|G14aTFMd1mdE$OmU1%ioren9SRZsgW#_!VSEG2Jd?A4#Pb#6W z#x|Ws?C+OCbr~CtB z-EqHz4|8r{+SR{KgJ(+5OU!d+1`&7Zfc=Yx5V#^Xik3=I|pi&*>7S)GVSNPMcn>rKSb=T+0us z?+379cRk2WpFQ)J3?3hcS6|(%`F;gOFZ1u-dAThmIGNXNRjBtJXbz4$q4}>zi2~D> zeOQTQri4w}O^=s9Nsz}z=3+iz^IeaK&X)k9mYw!iJ?38qu#;1bBB*#E+*#6oc>A8WaxC7V zpm0!~RF)cWkdV?uA!X;Uvad|jzKx`KooC?fC8`1MeEceqOjYu%{F2Zt!wGl!BKYQm z(fgvrEBc&pY+ZD3uiC>$jhc(9Mnp|Zp+`TQmoEmC(IF1!BxmG!rjjRr-1Jb#@WNj^ z^9o+yA2WD3)ORvKP$8-8^v8a5G#BM{E~t14!qww@)+MDnjmiXrs%*y5<#*|* zQKKhf-lrZZiQ*DV~#2tNehY>Dv z85%qK$N#9YT`!X6>@M)&V|`$KqP_znc_8SgN_MQm5Mq`bU;k6Rpp zHmh}$_kvLo_{-ws9{}!W&R!lGihSoz&qaSIpDo;s*3!6h9HCz8!N(q51dJMig#w*XG5j+D~7NK&*EnM;@VjXfQ zzq)FPd9e;mSICuHbc+n_`OOZ0!`FY9D&0KMpVU~l3Jg3vXUKX-h_pyBEzYUJ$KPw~ zyz~8OiE>y727$4`7il32P>B6dz@`OBt z`owaV`Hg#KC_jd9o1>2YWgRNPVH}6r;+%w2GNtt`5x@b9cOboD77cBWBgU^2+ zwT2n{Y+XhWd}^5}8Tdznf#+rVi+{2_D7%RFQ-8F1y>?Cp?)Ra*3kzdgF81FGgeBbM+31je z2Hk04XJWett^2fTopPZhHX_(30MklB&>F|TQ!bR*xrdB9QyjBLDZJ`N0Omn7+R@=3 z)l<+!YT9@it?%&ST1gd*^iAy1bjdLX411PII_4DQF4Lop_`|^Uygua^om+)s0Siht zu(d`60dEw-)Tf+i*Bw;%6iLNIIk%an;!WOs>8?0cvOz2;16q@KL>HM9y`iJvg6wO> z&;`pSOEdTCbskL z8v}lY;qGw+3Oo44jVV!K)U^&cIf2#X@2bzZujjr3x}x|`{8*XGc4ham83JE%*vfPb z)X%I-{(ZS~u{TZp!xBYASj{^HRWKw2`!g69(a|}X83~3OskwfI>rPYY?_)#p22!rO zeB_yDKgEKtD>!SHOBlt}tE`Oue)KAF|APm|V5=kWGs9M;`QzMRp(X6onIc!390&E~ z=Cmx|7~I}>C^(*QO)vA1A7AiA)hsA zHWG2aow>`GVPVS3%3U;NJp}sr72xXT2R^`Au4=1O2VhqDnO`cPpfKOf5E7ezkcIO; z^|j@{a>`n;)m|}c2GpjKt4uwTBU02OYG9ovBWpqv zzxltt_)qD1|4*;vS(~-*NRJ8jd?FksE%XV@eqh^`Cxis^$w5U!W@)DBxu^cvpq_-^ zGvbQK$RiP1B>Q&;9u!6zWFTrczg>r2lM2cBT75cRIGSo$v^`{mWkYv&Rd47+JOmEQ`q!14p0WlD+0SP7E=lOIZ%!~P@XFTRA z@hp+KbK_N3qwMPC=oObChrOQ`7SnnN|h+FTVflBi~(9@L?k1Ctz6Jgo#|eMI!t*)lV8= z2^XFw1L7XFb#*B)?5tK1-vYry?!zNSSOKVO*noih0b8OWvRGn}fZsel%VaGcuZ@o! z<~l2kLVTqL+X$>1)+0cG3+{%De&$IawX!axSifE2g_X)&X!v~Uu+uTnGK}d^09-o* zRb$Q~j=pu#2IY$~FcPD)D+haepu6Z+-MsjfceGOSPaOPTbKi(in0!C~goISk*_F|Y zrQ5KvG4C@Q@fX)>EZ$0odcmM)Ss1co`R2+59p<>zy_F>3uSeir`NIqH`N zZOoHOo)cX@{nq!D*oQAY6Acr0RJj62bw7q$Wt0BI2r7aCkP7~*DlCxS>-h7Zj5y54!8h3K?p^<2|7y4nO(uKp_D1!$86n||V8ts7Q{N)` zYQ!v#n4J2=EZ^uZyNevqW9MOa?ybHHe?IOVXVd7mT%T~P2^ZA&6 z)9G9=4WB}jYn1kWOU&pGG-+duB0ql_y;?iSBtnIo&)e}lYNB6Y^WmozLcAye@W4rC zA;d7LxbLUj^)U5&Ho)<6iGiinv^ijDV@}?}%=unv{Vzw}4^+8jNxj5;RnM-eK6+b{ zhB^1mZAt|#BB+Os~HE^t4BH7}i%Bl+?5?hDaGLq-v+_-HziIk-NmKz#d|$8vI8 z42+<`Y>7&wQZzLDgr77S6~CBv$=mO~u=B4(I4F)lg{ZKIZmPd96O1!Z1U6*i!*Swd z`)W1zqD}8Y?ND+4T>Ji{03B>CksI_0STp}du5p@AksRoDC$O)3T1xvc#5Lm8)hWX3 zg(@$ibklmh!6E=|!&V!m=vb!`7`8EMfwL^Rckc za~^#wv^OzQ;*E=XgONiDJQp;5LnX3=6h}L{R+@=c5)X1hN(8*^4qz4Gs7=i(Q9C3d z@5oh2oS7KQfBkkatb>f!hCk?MQ2);ZPEloO$HUvYWrpxTa*YnIZ(ww|Zm=>{4EV~% zbb3zjPF#Ll6Q@1{C>xQMSO@3pzC0LrSSTIF?7;5JBP!#2$w^7StB09E3*v4Q5<65I zMT2n{osB?Zm~8xtziAZy?)f+BxpIJgfOV|WrK3IdnZP0pp`Sk-SQx+o=O*kb${_%N z!Q8t;mtY3X;KaAU)vg1QBiY3{^8XCI>xD1p)TN= zM_oy&m@+YMA)NaF^KP&2SE#Y4dSml))VID^)G^I(paP3SU?sCWCdUZdBPorwA^vf`POF4uacBD z+Y&YP)5vjfj&n@O{QNl)*MDOP0|UUG5Z{!Hu}(9_Ft$9oyC#G}a!`+q-cU0FUR2`4 zN>f&hcR{!^{NR&|9RbCt{LC;%J|*eIjQIIQk5ONLU+|CVhrG})!mlXi;Iu4&#{`Bo zapo%8l|5aXmv{0iNTPoB)bFW^Ho-sV=l@4L;BGsY21zl7eJ+iHL!`{7UbMZ6)gw(* zgPd)UdE%c5x|WGRh(_&_w@u#(WM*!P`RYL^-yx0j_!@NK*cl;IHa0grY+I73`Gtn* z*(=3K$!%#2q=!9aBL;vHO$gVtCafdTdx>o6O+*)WMvs`jioY#~aWR1Z&=DMoc>Wg% z1Q)mQ-{%RD^lF#+e0;NRg+2Dp&zB`gH4du4NfN4#4$}bR;l8s?4--a`=SEb+uzOJ; z?z{ZL#@Egy<03RJN2bx$oab>FXZr5KgZmp32kRt)Inr(!^wKbu=d=sC5cZYisP$t#+Vu?Nd0nm2-QR{*bfBc{T&ns;C||0$pUVaL(0!R;LF5S7;+zIK*GS5 zC-YJB^QB0iFUo|(3mf>siZsF&)gD5Y$dKU#E88RVXZ|766LSPcckwL!IkicLU=m9)+(vBe}vkQvS*7!jGz! z#6hH)p)P5gcw%Fm;;+RFsP<<)P8M&6N3UCVtYk1eKg; zvA8z_|G-NacR$4wn(MfSQ~)NXFs9}|B)D=mMqL;aPH5viWL{yHHHJnqD2(nq@#(oV z8<_Dtq^Ek`_7bBuh!zJ6VvOS{xs=ObNnnNXs;lcTRhAp&{uw!FZ>?kMr}vj{!#p<-7fKb~%}8u!tr8lofyKY{#1 zDn8WZ>c-!O>S~#!mXF_Z>*`MQ#!{aZygyKpCc*wz&H3mY+K#+O)WS=eP8NEJ8KMLe zNG@a6YZO*Wjn9`}UK^O8ER!Y4qO;kKq{JK(!CH4el#`c#{w8?y55^|-^VBEB`WFw_ zj`=a_W35VrBTp71MnTo#7hV4#e8`8X48O3>e)VeDLFNa;M?#`D7NJdx-;fdv4*kVG zmWn;Hg-Ig#>aswe)%~bc%wx^DWAw+??Oc2nG73)89 z9jjIMUft8*mApl_0=5M2N;=S5(dT_XM&`T>?f2y;drXXhp{@aa7hzr$5=r1t{uE2-n{-$Gp2E|5Gttp z693=Sl&*UUOKfc&H@A`FrLOs+5YemWcXO2BEO2b8xcTcaMC<^@Noty&-Xq4w z2b3NkobER}u6O-Y3=shVvUjA_=Ho3%p5DuAuEIUa3oe2##hOoh1a5m)^Q|9PKOnzD ziv^e#J4$|-hcxXBRrK2}53=?^7%icjVKcrWI2J5Cr^I&upW2&vt8Jh}}*)JU~XfZ@<{$PIIjAaBM z9f?=A5%)h050hp=eRCM($t-kv@VgerY<@l#Ph$#a(XI3b+eDA&uEEWSw*qPjcz7f@ zupq@WSI9ml!rGOdmmFXC2O&#e%p6H126f#;PY_)xRdnYTj5}Txo<%!8dL9^fXAo)_ zu!7$GstDR!Y?Sv6<{m@ezyIF%JMH$ZEB|SNIWpS%+w^ca;6jm?f@=e;%Q~LUH-!=K z-P#Pr*?>*Ubj?!X04K78`Pag|e0tl?!m5lP+>F`WW?#Mh3}1+T2JCx6*f!RUZr!8f z6%rnMqqPtOxcD!g*jXnMr9elVAr}NHGt%wF8^h>Ded(<840;C^aXUfugo!Sd4jcGIOur?U9-zrHCzp*YB+p~#vq4y`5l zdY}eSU}2bAV)2XE@@w#{ggfVq;$WC+u36Ei>)j^6oiE072a(*rn76Lvn0-rb#mL+W zo&EVdZgu{2RMCY{iec;_j3MM^T~9|2e!Y8;u1UrMijcH@Wcnwa$8#^may3K+Zr|SP z`)Thv*|sfRsOil6!AN&U+|@2Ou_0QeVb~yVWKjgw32=nwK!7_0znkSyYpB6B^~<4L zxes4*ii@j?$>Xe?C0RpG=V^5~y+4x26bs!jXCpq$-0o)1F(ddvkT$^YeKLC>=Nh#6 z=Z~!)GwxCmeY$_Zxp0STj_8BN)3Luy6&L7}564nXyJHo%VDH6n!YB{q=ceD<44B#r z1Om4ZBj13Gro@T`@BaMpO7UtdC*Til<@)9S(0r;f)%SBMo38a67VC>;Ej_4I(d;l= zbycSeEpy|>vLyv(hk}uu@ys+pmiEN_k((F2EG-ByQHBS)e7NSC_sd>9#bv=-OH|;s zQ^tySTi1tPa$aA}%#M4e5+65Fm;YhVbYRYrJcgJ(%rTGDjvW`LcBSBmv-P_Ldhww? zoR;otLh2PJ{wo6cd3lZh2qE3k088w_f@Q&c3472*Qr^yRObXg>Cld{!aZ4EbfNQ9N zk^jiBqcn5mg24@aoY%8d8)NtYA=7`Kte&>c@1-M-Bb~_OiH(>v5Pdmq3^0VHL2!@Q zpfq+wV}1Q=L)w$g@v@s4Z!1(Y?)YCq;1a#pBSc&AZ{*|sHCBKG$F@U`cQ_5RlhjlO zS3~n$*&S)4m4NN20V(FVpJmy5wOa3t>w}S$ZaoiSRNYpKv^LH*H1O0vefJOH7kK(^ zkiqXQ=`wgi%NRc9wQc$GrN#6|PF;7?=8)o-x>QkzuJPPA{|3KUFwMXlPpe7CopLQ3izNk%Z|f~rsQJ~|TMuEjNu@Vkogw3&9O zJqGZD{R5>t)q}(O@(wF$PO0mq75&GG=UWn9r)U*`CC7fO?szj7iRa9ND)Gl1260e@ z?UOE4BP$_X6mck-B zib7QScQx1+1SkE{7of-C>X4ni`Bj@@0~t6+wb3#|sh zB*2RBLd4Us_90LI^C|UsrRaYq7N2FwQaX7s%&@I7o5%A*2?ED%{vPN$w2e&``UD>~ zEx=rpYkT>VK5BO?^7l1qxYA!;U=2WD`L;qrjo0Y(=If!nyIIhZ1QYxcO$y(H62|8S zLjGZBL1lWV2_m{+09xKqby3c$E@ic9_(RAiytfc}j2CyEB3lw<{7IwNAVfBI)R<-1 z!qUNx_+A0yn27D?4iOI=gVuE7pl5wm3 zeA7Q?EQGJpM<@RV8e+u(3>>AW_BOKzCt?eXX_uGn)^mbSM+QW`1oMQYtM({|N#^wopqx7;**<9YHPxT7lbD0^lMGNTt;-T_{XsP1E;)Oqkvhd4eKY{R|F~fac@FDd ztOhxPGm`B&1xYaXonYg4+SN?E$9YO31=zp@do0g8!Qd^Jxpw0^JX8$c#MV9Gt)s;& zkUCZRS=~W6ZTEYrR+*}igZ$pE@$65ps0+e^{Ms!5=fb!XXTcnG&$kA%536CO(8|q< zrux%%ntEXR&FPjf;=2$R$A4E=lpNx&gW%ojWhXdc%LBZ3Hk2+FTWdb5MSutLv$p~q zO%z6%EunW5fD>71T@}fdG3+0ycZXMKT+&pVKlPXKs#mSIub0;cFR#X#^nRwWbjjWa zLD0!QQRvo{%Kcqg-FaSCAfYw2L%9&-ZS%Q8`7|tOSE zDRP|`oYJE@1wdTuExB*`=Tju({d972Nd*kE?D<@{y4)WJPQwSg8>2fgpq(cBA6Td$ z)!%v7&|w`|#qkt)Z0-;KiJ+K=aLU%8DbqOWHCS$fXJI@|QUC)NeIrKW@~V+G7hI*Y zv*@J^ev#%q#Z=*a4D+?eCT>AG<_rp7Za$o(?WzEKycbA-37}GzLB^OF8sqB=dXeoK z-}N)aU3j03I6Zh!)K{&q<3sWBXJTVunMT?xfkiLV9U716&9lW{FKLckskqU>@C79X z7J!XE_5-FXpZjnGOD4kR^mh5>?l|GkxG%rIj_Rii%Wu9u%;F$@uOK(ru$c_6zREnhItnqwp$Vpcle-ZwFja4Qd-+HzeN_wt_ zTk4pWu!>%=2fcXJ;n>GKY_jY@C9ELm*q=7MosX~t2LwN;Plx*Xy8<)-^_PuZ3D6h2 zs2=leog5mtV#R;Y9zL`vzhwOZdH(xyXEg@0OtarAKcdDF5o7%xFLfTL&|^nlF@$Y! z#$CTRKOJ|3k7eJCBk+;ZONl1O=sN#>drlhMBA$)s5s`{7`SWQo5kP(bgrvB@PeL81 zykwJ*4R0Z>U%=8!bXx;la6EDlZ3z7ymN;*_FUB@4JjNwo=4Izs~ z!;mbzF@&n2@DEIMMexQfOtVa99Cdurd1?p+`@k38fSMZMiMdsOB6x*{B7ewg_;oDs z5JpMf;pqlknFwGEwZD1yywT(NO`W6ev*d*k!2Gwriv(qL&Nv@?FAGXE3cn*a8hrXL zGxX%JLh14V$N5dpeJk9-I~GBqCm)sJo3UL$h3#|@7(Sy(gKOs>&LO1XNeW| z-ZShr&Y=dDFx)8g5Dwl3#38~1LOLIhWKnXxE|P8@lR%2np0f>!A%s)#ye~^d3+(j6)UDKVI;waak}OVn(oo? z29Ln9k~2m{9vyU?{W@Joj#R%R!?!vj9s)2*3HFc#4CaV+EA0D>vH9Vc6f(nPUrkPy(1LD>z`IQ#@- z7%lDk8yE_#cgF0@{>MsIvO8l{DLc5em)mf8cIcE`D5BhfqGD}?SdOh z#V_1&KA+46uE&m=Z+v{%`P&=77we zsiV$`>?_D9loFM%SF|AN{n@;tn~|{R7r1EwH;w0Isx=m2V?E-BT^_r)PI>U9oFMF> zEh*Gm*t>7w6zv{QpDn*x`%Yv$6dIk0$A7^Ec&LL4La0 zX_pI;jSvD;{7??q%)J_QzT-f)X%9f$<&)EalhL;(R`#SGX(C9%M)s?4d&AQbE z{(H!I>RY(+V$NFX8ND(_GqXA4Ns$_|sODoGu?;txiKUi)+6L(0mr}Uyy zwY;?3ywZmL+Cb}RLpc#Vt6}6WQ_$O+m{yw?!B&$r10ZuZmD%aS#iiy#z8kx=a;T>P*ll!kr-fKPuY)NnE^B^FF5l8_zx`kh` zGrmZGH!0D}WeNe^7Tokz zIplR+X{q4t)P0F5ni+f-0^?#b+eSwwj>aF)GrP@x`gMgtsiYWl4R5ncz>?o(p7lZ= zFTeDEac>J9XE~<{R)AKn$qNX>lNwyTt)J5aD;nAzH4K$Ogqr7+W^=v&P)oA4?J}W& zC_32+y??TM+4W9>kpB)+t^L|xR8n$*ZDctqIe=MSRGmD7|1Gh#=^%^;jPgR^p(Fqh z7vsHlL~27+6tU3_b>H~Qk^gKmpS%odWimaZku+WQXy=qgD;=WG*5i3rtK};l z+j}#8FQKQysqVCH%w9nH2_hY6|Cm*}(6@1+6Sw?SI&@saF!n3K2Y;+35&Wtex+za~ zGAhR0a&e}E!U#(%S|0W!Q~dTS@FdBmzzBqfZ2|0ip?<(Zt)jl_WNZ73IQqaz=`t5p zSo`wj;YzFy6864YZd3dIpCN$=s4N~%)=s2ZfPA`ON*i z_{+|oKL6BoO%^lEk-C1<9Kw@enpCmHdXUhi+@Cc(Q5ST+e6{t0j|WYRY(-xZ`J6fo zW71oDG_`)4p}6DTb2Gh*gO(&w8c(?7Z`{z#enpoZql6nTOFGLZytvUeLJPZo0RyS~ zx2ZX{+-^B>Dnra7ALt7pdd-=B4xtzRvq7jz8Nv}+Nb!Kz0~>mGoPHXx z_DDa|7IrvPPc|jYTv&ZDTJCj=kTVobu^=1I@lptbsVQ3ApZ%gv1ejs(pM81jvSQ0Q zp`Df|UO^dqp*sKthE3}1#KBINWagWE|vOV-ZO#3Km@Y08; z5G*iTU6vl4ecj8wovDQ1+oWiFPYCY4*h`kMI@^)?`X!JQx44_Wv+{Q>jqh|#1xLCU zWkN!+i~cUY`+9Hh#q~5Q?)PfnSF*6vFg@s2B?swsT=S$RD_I}U0ELy=UCd#t7z5th zt;CFhx$bjEDjz7OT@)NvE)le`-q`9gpz6C_bg(A70$M!v17*&!G zy+b+6UdhdOOQHG4=o1X3_@|N$vA_=@4#&C_f1!`J?*~j3>ES=`T_vf67}FU*R&_)<$U<^qE++ASV;Vs-HVWDZY8Yp#5H@X-(7#Zw09l7Up=a6XA`O#kqe zPxOi$IcmjxzYHcmc4~sb2T8B5ID&wZ<~@g++680gCIvyFUz3_*Ws#H`52WdPb2>jE z8tqyX(SPGALml9;MIm1)1bOkfZ{}O;>V+PdtY)5~15R+9V$R-j5ZT{%CFlx5Oj3f? z`5t3>V}tzcgHOSEFEL>;0JHZFoSCGx*ul@x=f9xfb(1+l(4|B$q07LQ6D&}*8J&OL z+rC(~tyzhR;9Pl${ggn7jql6PU(dgBlirXN-a?J~(T$e2#Or1fmA2}e9TuIVwOEC( zsG5q}!*{j*laPtYg9ILd13o}OFja*H+$z6oqOWC&Kb6d!%=Y_mV*O@pBGSPqBFa-6 zrIJ^2hmS9RE|*CS25EA`%nGr4lrtKPgZZao$aW-s8qBf$HF(For0c6`T4VX z>sy_4lpq}jE>~A-K0Wwx{)Q=NZ%<3Y3MU2pWEPIaTJbGnFx=ZL8E@Cq<%2H+8HInX zul!;Dv**OjW|m~o!p-^+@ZzHp2E6#mue+2c51dU3MHstVclDQ{@qn8eco8bc(}D1_ zWaJS3_bwC&{Cwf(qw-}+15h|$sImG~T+i}pT!0WeTzvoHGfhW2rX z47dG+NYxF&d^4^#<2EW$rdh3qH4fxdXklfVai*aRZ_5G<0^u@_z{h(Q1ClGN#A|=<8-sJ zylKy4VM%mgQ19@7>13Tl7Ig_3;GmBe=%?_Bf^qBFe9i_BFGt6G<`dWHrL(h#B+r!1 z#qsVLH+YeH$JO=hws>p-ZT?~pt^c&zqnDn`t;cshe&TdjjF8%-FC8tZ*xpvW73g}_ z8&S1+O)Nuc-p{mz<-J2p%&Hj2bj|tDM8r*#iuAQ%i*(0m{EIhz8L6qlz6X32n*5YF z0Y1b94IHY+$D+oqQyy_FrhRR0UJ@C#<|O+7Lfv3hlwbrh_@$}oI{)^zuGin--H)9G z!}d?ZwSd$QApa-@$)%5Je%2pQC?Rc?4L&H9byLz()ZY7*`|x42oufna$6uPIEoU1G zZDGExXB#J+J2M%aN<<2%!$;#*jN+V7dyJdFbEw@S-Vz4IsIULpkue0M0-*Ss$9cKv zCGOVdU`$i_xcpk3tx}t`@p$dUP%3uJkZ7s(bLHotl2d%ii76J%m10DT;-90my`m>$ zE;smF%hhWGFJ~%CIobA}UO=L`rJuX}-?A^@aW^;dM@wxoUiX?w+hwad8 zuNBX?1E!(mz}WYwot+&hPyNI}j0}=W7MrI}|EjQG_*qP6SQQfz3oZOr;<*2xfE|aD z;Dm`3PBoINXu7%6hLlBZ)rWh1b!aIJ(OTWn>gm@3w)z zEFPMhYiMZju~pDr=@Mu&-z{)%wo)3A3L-=rUn=eGZfBX$;U9&`aGj{nqpuJilSOEN zfFp;3tZSxdTWzIkyYq#?UUBTSls53=+q%gLJN|SRO8zE8Q{DA7tWC3ujs+tGE>ef_ z)h}vvrm&5#F8IgkI8r{L&psI31QjRUN8WS|8RCvKM-K zdXD5Az6!(ehJV&-9Rw=OzJ|jw`q;i8j@7>j4@Hh+v!s6f&=hISM$*=nCoL%LALO-c zKKI!^=UgVQd8-GDyRNY473y)r5_YBj4n^TF&8jauG%c*s52~rc!JP{=QyZ&e8JxgC^QGCWfSj@B?JhK=DjruJd@y z`5+_f*}9;Bd`g^;NNeLIupwY`@%<_DUvkwZg6 zMJielLqSS0*s1{G^>*Z*Q@NzDHp$K^N$g(?FLlYd&0uZNofDD zjpM^YMP4cV?-M)|l6ip!?1T)4A~bAeB7p~EkgF`>2j9qdql%@ave|cE)fF$+*c&Yj zRo{X^7x`J+@Ov12^s4p^5%}l#-y!UNcjR5vg9nL|Gn12w@`nd(`5`NwON@N|<*wJD zO(Xi{aRrW#K(U|GM?R{dJVvT_O#tWq1G$iT1ksV%Tpn#IkA|IXHytuZ8utSC-!(oa z3>OskQ##JIVWP9#YM90oHVLX$)^*Hb;7WPFcM>DfdUT`8FdY$Bd%?PafG5x zw*OPJy>Mx);*9-w8V}AGu~7n($?E)W{%K2ZK}Hg#&%{M?fWJ%V0BAsl{fhIlKIoZnfom=;Kvyo4R8DIZ?Gh~t>qx?4^ z_FKJLNV9>8rSZaxYXw$HJvNr2RW;x6utxXh=U9`3ZfH_!^~2u!>F)pxblBOHt8RB7 zv%(p48?W>qjIFHPZIq_m8Xe@gHhO;5WXpT{aKmX+_6+?LJcXH(#C`gKLkHCS#hb7I z!_l#g!dRzQY1X3%w_u(23=!N=j~XYE0}7=`z}2#O(EBnwcf@357Bq9ZPB)q z803G?`K*7rDDM^){ejZ^^RC5(YERF9u<%nThwPn0_te?jQ)tv#rXrycKk0dekT+rE zF}8p5?`&IZl6}$xQPd;y;_)pM)=PfZxCm69D^PUxkw0tvTY@63Y#O?U`t>W7L_$l; z4%e>rQ6bTI^`_lrIhD83?+Yy2s%&htG^(rr;fykFK1CNdf0B!XJQ=V@Z2`@PQ)h># z%E~vBzt4SA;2eH<`EDWEb>Hf1ICT2H_csQrnffy&tx6_td`6U90{rB>s&lwy;dn;jdG!-2Xv8*6qQ!fdVX;XnKO;6@Pj?K1qy!{1=SGO7Rkh1Eg75Wh?d@zd|J(1kbc6D73V+epxHrsG@GRu5CYb1(jE;`DvDBGUx8&Ej=a=X{gJQk zgOA?Z`m6X)1U{j{_DO(K10RdS{%e0b+7h2(YM)qCtRIezHO_e(TxPaG z&7l(2tdBHs)@BBKU7?{hQ?g?5-Ps|+Mj*nQ{_n$p)SF4KK*riCSHU|r*wc!;P8!lz z)d+W{iZn;Cfg$m4CI6(uko2s1^|S+9SthjEiuak33*ju*9eKbTWe@xM_&V2V!aq-0 z^Hw*Tnt)lEm*Z+&7;l*bTBvrjw8Gxu-NbbSuD?QlCeV@DBaRHt`5%4CzvDF7IWywM zg!gMd2j0KAyW9b)_5v_9C8-@9WF6nKRBi5&3UW!{OEpUm?F#RfuSFGDY>HhBTsTul zeSJwu*!YN8kY2o7ai9HSce9NU*}4dMo)d!cY)q2p>b(^xiG7;q@>g#j3Hb!2_(4gx zJD&gCkvJ(FtGRWO%*d3HQ6hMw9$i`D>TWr*AsY?u1*axdzEgS1TKSG>1!Y1F%mJ z{q?Ua`C9pTM4QaU$YtWA5fQ#vQy#D^aFvsZw3sD6)XaU+u&%(43&n&Hgjn?V6f8s4FT;`BUSk5@;Zfut9P$ z!Ul{C@0gK8S%4JwIerH1BWM#s`~H#TZ@Y6}(R8jo?wt&>B1lSA)qHWRyL;J!frmYe z51MbqZ=z)dwvxq|87Kcu^0#@(8SshA`B%+6|GsH=@^0?D%bj~c$?cKILhJrPV9+7s z%cE|ME@sYKa8q;Ok!IdO@tOtnN5qrbthGJA2ON0erlMrD6BOYUZ3x$I9fofi+YO9u zLL}@xM`c9%vzJ*{q7Kj2pNyV8%fUBx_Gh;G?fzkcL;Eo?%(Wq|Ka+7#2_E{kr1bsH z;L)K;nzDM&c=gMo06vP76_>$vFZyw7vs?JCRI-lZ;qA#|C+DgE2D;axaIHZ}3+U|A z)Ps?_wY9anFxRTrJ;rZ=&A!4qrH6TOCX?9^x-x z&H{Lpokr_*WQ~{2&&FYeiX;CQk)HkU#nUmxh~TviK?O#$ajFUD;kSmMNUvxkNUKj( z*$7kI)EmCn{AoLt|Jpq-gQxFae1;Fzw3%`Kl{N?MgGz#L9c(!+PhYdQD5J$AN|y5ncGn{O;#Leg%!P-qP< zaQ_4>qz0q)_(Z(XY$l%aYPNlESF7gg`g3dROWoXG3-+azl`5Nd;gqwhzVz3~>*_Am z_LCYmKxt5EFyQr#ix*K5J`uli_z;dKfg;v&Y}oP2U>!58{PWVB=BVCZP^G`zP+0$p=!(DlnXiwr=Ceum~WP+uj@TyajWzOOae?f8f3qqlj7-oWQ%n+ zW@3Ng+Po7EE+r=;mkoz-Sx=Z2}~sd&6Nd` zeIobD?_AQJdUJc?O5|aRK*I_vg?67hdiaD1`03FMC7>0Mo!-OT2L~(r zL3fra{(Re$Jh!sqHa$w8ShX#$d^;7kTk;Sy?}-CgRn>bwl`~gPZD=uSu3d&=SH=kzTURu;^x|b8W^+|{`=~!ms@G)k49mTiFJV`PA z#|o8q@5`5Y1}Jch<^A+fax_32xx?|zWmB_))b9dy!7EL#114wgWj3&Vh}k0_=Y|k+yz+&1{VnF#FA`GCbLsdV`CKq)j}d zO+^Ypew6^%2Lgp_mXPT~u?r<7KiS{E=04zG;VXegZR#wrsC=z2$NCxjajR3`?jCMt zt|xxX&K~7$)~bE;;{+0?uNS15UsqM-Z9{F+Wvof(0E|$?{zu7A81PSir|MR)@mgFZ zRH~X2t=}v(x;6t3&&z1pxWjpDawXV-sM2$MzQ-m4?QlQ?{LWbnyHq_ESA@Q&WxFE2 zPh0-$eYBCnv3tj6wKZjtmg1lU64N`Y@F3YN4{gBhdhdFw8o>NTAyfy zyGK!<#kmF1(Mj`Xl+A_0xEjCb@0-H+51UsDJ>Sl4y+p&~%a)!GN5I6{)46b90BcG& zQ0z|CS2Rq1Q*c%hr0Ms{2eg}yoTXQwC%|kQZpwMXmh8Bqhg&q^q{2Dh&X7Djf#c=u zrJ_&7kp~U?2RCoyFn1gu&-edR&)+H37v1NyCh_@sy}g?JShJJnXZ~bMdy$4k{0gT_ z;6;uSImicsqTuE?K8W+D*4_pG;MTH(5Ninz!XpjixBCjwVCEr@DRX7HJ-!5V|EAbmBXMgMLFj2GhRN{e69@oOuQ3E?QX+SvysWJQw~^kkc?1vo&(nsDu+%^ESH= z^8~Fz;P?V8;ZPWnoBN?fXpSV*bhq+p)a%3OKcGaGs1oe>{=|I93{@EeThnZCV6gMJ zvj@>*a3`}P1T-*me6R5g@v>413X-~QSFinzIOozgtyD@KbB>wK3#k0sv?hD=Y9knL zQLCu0so&TXmjw)GHU&I^3(`McaWK%BFwXkX!8Bq6y49zU#(C%ghjF>ba+!*Kpe5#B z2-R)}uYEO?FYqk5RP5+{vh;s(_O$J}>tW%(J8$a7ESUY6Uj1xdUmc}SH1g-*hZ5@| z2B7$;`m7;*9ODsrX}M~gbhR~bMXz$w`?meyX6RF!sjug<8^Vv?U#*e?r7jp)`Azqo zc55F#Sh0zW+(a*5@yoE5SN|4FkmUc&&Q+z#CLUoJiC^T}{90S)-{@orVWEa^$XhX~jUn|P2& zvnG?a1g}c%>I14cJQp$`yCK2TNIpWA7^Ls9lQjG2k^6X-DTeSEo_z5aEwh~;uZO@5 z4qS=}N@^n!;GH3>uaT->t_@#aYNpoQpcnagC@^2k5z;=0f`QsYgvmu9Hck72BcuNV z@{ZlaVygg|kgmztBRSH<-=(w=Q%&cO-1&lxHc=G#cq+a_l7xlL z|KPW;N<19&PEe!-@u0&B<37Od2i)AH|7ZKHlZwtYA9U|!KX~x5_fnWlCr!3aSc+ys zCB1n#Pdd}p%1m<#+k9_DiHOV20Nxx3I|)A6=Dkg})K5tN51(;G;XrUS5zLeiDGpge1RZP2ml+H zJwNQj#5l9yo^E;tEWhw6s(RK!v;P0BXskOMM0%Q!P)s!2mT3FpHXzgTto0%RU`YR- znR)aQHaU3!96DQUPEH10+S9PK?y|A5%MBc@t3mcA_9EtQ>_}^oJKcPE^FUev_Vptq z?ay##)z^M@TAUUmr3gnxvZ#%GvIdfkycIMNcA*Z4r1%(Vbb;{_)%X?Ct`NA0vP)fr zUq{<9Jpt#M%Xb=l&i~453FJ9@^zBC4%a7~Yx2P)IjR6yvMq%|=+gm#U`!r2?M%$W$ z*pXsz*!~Y4_nfvQCpt~jKeO4`I`unntN*j<+4r^gm9 z*BY=q!qa}y7-;q<&!9VJ5CN`Y0a+LeT3-8$*P{feoA3zFw2MhS@AbOV@gVO6`x>p_-TBRQK$hhsRGdOv;s`n|rA&%k`;2HK zJ6@cuEE{g;b|tsk{K`v-zqC$~K5Glo_S;`O^ofH9F3>NME&$&6UB;2~x=G^j@vy9L zud&$J@E;i)+y}kEt{-g8znE3EM8g>iuAo|E_rQK2P)*groulFAD=4FLsdhuh+NI%9OTk*r=V}EJbc?F6NQn?KNT%> z!*m9|iPPi!H3sF#pZNLDiotq>C}O{g9(Wwb5qyk4UG-y@gCS>V>R8(BmMP7nRRjZq zTQ&y$IAFA5{cIWJ^RK1mOjpSCDK~HqaRo+TPUkp z=i^?Imy6zSEncx-m@pfZze_77fIC2Xu=NGly|OM+!cOeC#8c?_we|YASJ$2nn^Q3gS3AwgjQWUPKm&i53@OMYv$Pp zO%QKr-~2lVAu*_QzrG$*nXEG=A532C6blis62v;&?=-cS)rCFuddn3O?kI{zOED?` zX_TIvuA5=R0r3*`u$mah)X;X21;21bCLK=m&9nB^xnbsT9|wEENI$FikSw?hKqLBAMt>X-1nT6_<_ROw{~^#j=fsdo?Fdlkx^sY0?vQYY+Vy?s;;Kb8 z4(QR&xHU2C{mt-W!D1eSHg@f%>@d@+3qtDL%zl&`O;q+Xr=T|HqX$aRTYt$QIFcQh zU_OjZp3T*pBXwX1smvG{j)fo&)wk!LOW2?mk2x&0-e2$iR`+@5)0NhrC0q~|#L^H9 zsT^qf7Jc|*EsX#s8q`j~L#}^yx+)444aWbKOy{{<6;0K1d90Tbdq^*IGbKL*%%{B1 z9vv}UARpRmq*TT|Z#I{eJ$v}?69b#@kGHoN9O6Sm-DOS|Q5kRqztvAyAVtDEo3dq4 zJnC`lo5Gzn7~GP5b3!(KzQYBtx1;%Dk7@1m4N+uqoz6qZol)5~8txkne}*1-9v!F) zPV_OTAf6ck@}32mG{;%#fnK8Z#!b@Z%YoZtpZ{UgRJ?^^3C?q!dPGu!m zUqUWfAx~lufArGkX->peNQFS!05~(UG_thh;2AE(rtcxKCg zhvVOFG)L)(TmS+aPk4xLcn&=$IreEO6z!P|;(y=`^Mcd+P2aBY#H;@{e#diL(IaVY zzhd7dtT5NPaY*BZqWF{tTJ96RQSMjde+{>JU5lwQRrA`nhs8#RPaR+%iCO2RTn7LZ!Q`uBcAdGfQF!aFl|Hx? zlx&4_UkV^3?L%ui*#@PND)-y%z-yh-Q{E7t2A<>D1o7b%K( zUkk2-1g4`tBMhYXkH>SJUG%Ai7AdwTT6+Yx&wfPwro|+VzOkF?-)V8$XjG?6Q4~V? zISL9@rerb!)Hpb_)E>)V<^~5Ra(X@e<&Ghf94JrP5RYIuS|?3X!kQa!0d09zIaY!U zZbn3v{8%Dq16GgV`r9c^;DeD7sudL#s}~EDI=&Z^^JXu{D1j9WqatV~F1{NcvL;P0 zf3wI2+7bZ2U^vi_<9K~3nwjavfC!3nU@7mxfWV{yenk|yxzzg8zkw}ll6ZTx3N|06=_IOr7l&+X-; z%YsTM7E9XiD=sGNWS$=k@74dGQ4shRGvgc z=J2;Yr69|r!aty*S#q@ou1_nRG2DPOlTP4H5rR`)_rU_8ES_h;ZXf7Jaw&K!tLK?@ zA8I@{_xPmvI9W64iyrmeV5AXmi0Y@`=Wp~Ilq16e1Mz`pcdp{a6l&<(eRD`C_54M32Zk=dd<5qkAX_ttJHWQmqC$1F1b=S*gMYQHEF z9vIxqOwPU^NllsXKjDu*Wb=UNrKrrJ5K9{)-Y>+62hTAnn6vD-xDm-ZK=Pi5d7oh<)waXwr?^z1lX*CpzcmJOkq zD4=*LThP3ZCN^YcmzZlAXNU!ggmAo$wud7lQM zJ6UPDjzwX+({fcY-9u47f+LZBU z88Z^+^w6B2=%FCbW_yh-K8t}ql-sk!uTP#}hQ5$Z6v+nLzOL`#G(VH0xKo69cu(_x zV`)cQzgzodw#8Ovu`}i=uwBDq$e)!MT8Pj22YaAHGo8|lr-P+9dvM99vz~8z@gx#H z$iQ!n7A2!qNcbo0USz@&Q$0#2W1h`J z&y9T9e`%B%C2vTG?>h4sZt1)V=OABI;HLQw{%wkWZ2bmauKh?}YG+UTzV;Z)VCyo? zc+=Ukhl){wn2RsgMLy{oD8T`ydI3IHsC>Kz2UK+KJ7@}CH>wh4u1V;G)m})&7$dp3 z1{Np-sZj3BIvrg!H1P(Vw9)%-1^hc4Y-x0w)SpBUo+m* zF=jOiF%=8xZgR>Ew9Mk(KX5zMsJG0+ch_9n**!Lv6?lCXj}O|1jF46tR;J9?*@is9 z3?rA!(EWN1tg70kxM-zi7;#pXM;xeT0L`S-8%&})s1^}XXtdgO2L47~Ui4fY*J%;0 zkvq3*1l(dBR%st%L}H?kD;`F@*M7Cc<^s~eGk$fQ7B`O=NMasAengl@_c3cT$BIQ% zUJ|0yskgj!eEFTBSM8>#!}EFsSnc!gE?zp8cwWA_cR%UJ_U#2dJcTwtBmgEA4|Bwz z%Fv^S-0+a2?J-s%_I_%P2{?>0)}9$t=lRK`nW5~ivrc;SOs9ky!~Iz*sO?DtkRfx1 zyh}4eik#+tw6;NXeefd&M3B%m@GmDhtTDDHA;xqj4zEUnqblrq_A`WLT?dvYBA!Kf z?iexLZUoB{=P}-#P0wg`5v+L&QvU|OX;`fOJ=CQa>^gYRsvwSk&+nh#z#?|=%%eXHQ$*t$DxXcTi`IFkzFns=p}U-Q43fC6U9TITG4>MyAOk5FI*F#X!|u%BpT~h-oTWc=52yzQ zYVmgk*9MPe>1%r*>m^3&x`TE-Z$Td0b)GRyq10lo7`>WWIS-y8hQNr z^UyUS;9wy7<8GpQK+VIuKbwj_kQ;ALHa|6gU7xCNjzq@LbeM6_uL%h-A{iompZ;@S ze@|)CNV8deB$nuqvtz2xbEps*7tGSlBq{kE0ZFqnUBl;WdL zv-by}N`m;IpSkYglvjoD=P$85oxgmW-^{8JK>C-=brG&zA1)qQm?Dc&NYpUh7xVZ} zewD(dNBpqsh1hRc@~enVoRksJg)N{S{TZ69$a;0^F(bwT!NUbmwimyS{O4zmaRKpO ziM%K6#o}NN8;GCUyZ5KIw-{lNF{CEIAZrGA%gqdBwnKdfre73^Us_?mq1hpG9j0nf z(D&b|6Z`kAGcEDBJ8l6tlNNq+t)1lYJpaHcL;K2=_&yR15eo)E&50MzX+Cw_4N9f((MIfOv&9Yc^?6g@t9zDf()yqjP3H0^v|tso-zJR@XmY@KT%PB>Wt&Ac;? zhAsXVnt(|ci&dmq@Kf+sELfdhLOVm(&PjWF^JHm0sHW{oBSz{5;zxrY+j7XnE#g$( z8N|O?4Do235!P}^Ab6Cte^gC6QkWuPk;G6e47cm^lZWH)@G&8tgF4F~lPmA}a|UlH z>HS-;X1urk==#X;<-m64CvlD*80>MlMwe`v6a|hiJv;%2O7d54W~@d>EBHU}iQp?%5l7>ZHX9uY66^k-NALB^9D4Q_PD1YdxDDS@DZ?4GUfAQ( z(c;hY=zmGc%;`M)?v8Y}LOvJNh&=7RKKQLi?MAKa%SZl;t+8B?DOfE5^BP~jtLEml z#1`Vd9L?12XxFoU1H-1zDQ}$USr>;U5pB6 z{wyBKY?%!z7Etd06#7if=-TG;D^a^4Zqj%HxTqQpAF@#!4#G2|JBcUPzJ-{Cefkw+ z0biTyIn>sn6=t%qL<4hSjaME;(Ih-L&OCXphAJlmt-#=RSD2~$%WtWj3`T(VuVPqi zvEGYaoKUP_)Zw5f#ti2)uAI@&xSZ=bYifxGIr$&nYS1h^z-b+%f{S)Z8^Px2eLa3t z!S&-hD#wZokjnj$$XL0dhy`> z?pl~9qFAJZE0Sh3f7z0dZOcGG7WUBM&Yim*LjWGRNGX;Sm`iUIN4*Zb`0L{m)e3*_ z!bvaHZU!?H7Z*~AU?%qrd`9)u=?qTta&vRbF}Vt;9jAKjuxZkJ&Z--xF|v2gN@IcE z%zhXFyENsgOpY~ThAe`sab%zR)@xrC?jOKTLKX#`N`V;|!s#fyeoHwVSLg9oj<$v8q$UboHl z55z;mO{y~z;vmT0N!4DcFfo??lpN!;6b*Y|36K5&9=Q*IEZ8>uQ0?h|9}uuCo>VQN zDg>hxi#@Y7?jztpL1>Vanwa=6JS@+WaMYnKh}iXW+nuVLiyvD`NrynHwE{a$HI8O0?I{;33j+Bv`5w<0P9|L2eEuLR;=A50DlS%Lfr0{?IfJEO-IHWNQ4|3S zDG^q#J;RVc5ISj#Qq?FM8lr{Ep|e_43r$7_ZM;YcbJ25H~@USk+Lsb$23yQ%(aZp91{gCl2)hK)^4p7svc z*bbn+-rpaMQP2(>Tp4ta&wf(k#t|Zx{JTQ-!c;ZW3rwjms8cr>W3HdtRo|%;RYkrz z7HJoy4S#T7BS|^zD4}J-Y?8VtG9dn-Q6M%P0^^6NltQpuEp4ytA_>QT14shhfd(7N z7ex|~WMYHIdXnP>@HQGq5Lt6Epltf<3@MhBB8VXDPUj-wM&FRiAc$5Aq|(nlw$~>-TgJ+ln`ZBaGk=b^={J9guma@I&nAf*|CWRkRr}J3i+Zxr+t3aQAh2QnD zQlxU;J&a%Gim>`Ls6l%6%g5N3(vCboW%~Hzjk{NdBd?<~&ciA6v!VIO-v!st%p;9~ zZXzpGbGWl__vHjRt%u07qtf$QB=!b)-)ili3~`8tQ$Aq`Wv1|~r3hdx1tW4QRv`=9 z#7YQY$eF&jJQ}Br#VQd(L%lVx(?#DwZ`5*_&wBaA*^35ib|yYd5m?n4#FZ65Q;$_!U7eEOYP z$MF|FK>|bf6ZzY7C?Y>vmDZ+z{V2U&I{GVWGWl@fbd9w5EIV0p|=12eSC1?I6NJuD_#8jLN7>$i}M2x;_Z>euPl=y zH!a@eKlcWz{QV19rmW&8vU+x1(C~{o^AwPsN9Prt#}+Oc2|&I^of9z1$addNkJ+>Nd8ycEX-+^~?5|n(iVS*0~=rYekV08kOr?@^8zr z^ZQL3&|?NA>9fjIZ;(==n)()6d zi$JS!&4gD-058@6O`s+VXXPcU2g4!C%f4D4a-wsqWu^IZS1XeAVC-1PnyeX*EWOOR zaXO@xIz72tVZ+^NZdQ2A!mdGn@fV%p-zo52d-YIoSrdomhwzCO9Yj>llb&NAwPuC~a%2JFvc(f#YQm;9&#bs8# zpsTbI@BXT-tOsann{Rr`g-eUlIEwd8HUHgRE4z+tb9x$r7Ww(#*Uz6nn>sEkU)k-f z?}=fG;n#E2TrOFPonB^_mFCRLVkFPy%4TEnLN?Ic$x1(F4tNg=RTICETKu}G+8Pko z#ysIa$^7&~^_~>M5o?ki3EC$h(*Dn!)IcTc-{xhr zucHC+1$s@vCn%!foBB16X>ML*ot}V2bz(e^NZ<1Mp^V#dnAgdL^FA^7pCWj8_FZw2 zqK*E|t*cF0Vi=QhIYhQA?i`@Lov!5laPvnab@y>MqCh`PKjM~Hue_m;k~{(df2MIB zzEK$QkyEW{F8SN9cY#O0>MAb^UOOTp*UEIk0t6)L8eDK2Xb|i^BjP zB14pL<43UL8Ryy{oD_%)yGV>rZ{mWV_LZ@lfs3Rjx$8S#qgD(dESbwoB70B#FIHj>H zHo&QE+oUxM+Gg|Wx!<}j>ag7q_S1g2m9#Sr$wLb=i1IQ0{FiJvLh0y-+GgEI3Ip2z zZOZ$cW-ljJNsPg6k3=5*zW(OGRqQ~2sl$KBkJrL)mpc~!yVtYMzIhKV;`dFzPN?%u z5T}skUuzC>a@p@kbi+U~+EQJ6AauoGEMK~L{#08l3oFxO=7>5GMtH~x7GMm@65U`0 z7V~#E3ygqt4KAG(b^e%Qf*E{Ty_lbHH4$lf{)pu5-K3Gp0qq6d+BnR7`UUY&90xfP z`27i9?)Q-_mJR|RVR^>nG>;#g9En9gZ`Rtc>L}n6cHd2suU&6cc;j&%N0lDoH?=sO zo-Vq3Lt72zIDDr25)ZtEM?g?hf|FcCTNrDlhCg#mwro(wo-7-bvJXn9co03tR*_Z| zjnY(ZWbv!%-}J_?vtPlnh6T54k9SGtHGIyZjiYjEd^!OcmyKmw^>wuL>9wMFJ3b?^ zh~&Qmk$4{-ch^p@Tde(G4H(1s-@VVfvw6%J495or$lf*k7u|7^lTgd=4ShjWU53De zqz4B*YJHW{0+-3!ONJDu4*Q6CBgM;q8_lqI)GNqMI)aaqtf73#o+Xh!p1$FH6&($m znV39}O@I8@o<5E$l8+Mq3{DR2{rUJY@gNKS5ne+6#|#NV;+FS!CZ#KH|BFNWIp$WS zTw&pdo>(@m_AEZjOk`|Z$^>-BMg8zz2ps}Vy82Z+N3oXH-%8!8?v7VstwQ`M-=o;p z3>vj4wzb-pxqA2|pU#N;rb*8&r}&<=$T*oUMP&aN@n6nqVMcRO;h7qi9&YJm0>uU40ufbUw<<_xkv1K>m0;htR9vLPFw$eR>2S?i8rL`m*b4 z=+ex#E^mN1~9&N0%hsbSB^}->p`T1-}76YAMw?9>l(HijI~YVc5AW2W z^P#PY$r8fvyy=f7#l!BqX~+wZ&RXoXk}ydDms0arg5=aOezC6i>+A$K)Q>*b zw{Z2sa%(daKc3WMb+f4joyH=O*%}SP3h@+kbwgOl%T$PzteF4;SlBJ}feMv?*af@&q=2C$q3PJ)A zGoJ|XEFDXQ6R@FSrU!hm>wRptreB@a2hZ#W6~A(!OShL!lWnfA{Pn;*9${3vNttcnqeD+} zI+Dg9lZ7Fs#0h!@v57+gdw9HwN7O*%^c1@LJ*Bf@5a)7MWwXMz1z!Q$LCsOe)3e_H zIUZA);}f5nY-X2TO+?gzkU({f=8oAGUNa@ijSeot6Y7V(e)ODU@OZ>=Aw9M!`2OM= z8xG1xnSL`4B8jS?hWYTPM@@&J#4YHNjrtCg(z|Hd=J)c?x*x&HQ*@sde0+qd7lOHD zA^5Pw8^tehJ-RR1Kk#;ntUi*YI~0pr?&P#-bJ2Wi8Hg7CY;?=XxJ*lUKf7Q30}z=( z+gT^*!PNn8@`k+K*5y=<0vSfi?eXGkPTFtR);=llK9(urx08M9ZLb5)29OL2-9hII z;$ak_Vf{3y9BHk5HLXc1xO8I{R$dBxnjLR`JtY%)KQhI2H_pcCw9vb0Hyag{G8`8H ziqF|e`T$NvNWwE-M*bdeX}L*F6l((@62=h(u0Lb6rj&% zIyL7PjaF&5`961v7LH z^P2bn-@-(BG`CqqnOu9ZT(zeqXe!8 zf+nXTTaT{L85}K~#5Uzpwv^@DzQJLNx(3t{>Hiwh7rUPQWE-)kuA@I$V0hF&A#0!V z0i$LZVuVC0LsHMBVe^U$#a+pw3gmU|oUSa+lVE7*PyYVsH-+v#;WH%aOs$2y8)RB68vJ&E!4FSjd9Qzz3S$Rr|i%%>$ezSOgL)qy1F{VMYuNE ztm6f>wD_oC?1q0e1-Ul;7N&2J0bL%})|ws;e_mzgnfj}7{U;oiY)zO+BZ9lqI0xpF zL$X9h9*_YPS?tDrV$C3TIxcihq_$wLh8KUy7`%4FA#%Swd5ZmDXmc9nz&H;zHEnBh z9og7yjQsas;bwi27WM08OMw?Z^Xwg8Sc2V1Yif1M_Ft>MJ>T(~u%l2r_Q2~?@9D!; z>9@yi7-WrTjh1J(#r24IMu062*h!~G-}bd@wMOqAti*=fN6Vu))WWB z@CY!&+Ve%kca4+#WcFcZ;?Z+=1uTX)DK!1hxdD;(F||=r`+<%cn(~4N8si@2Q3kH+ zGq9>ydlsR>IV%J}NO{9fAA=J-MF%QGnNB5(n4`RYTbCu1=--1DCtZ?1D{jS;cZEUl zif>cEYq$KDC^@Y<>EA)O!tUG*4z}ukqBk!1GK=o>kH{;oW+gSUmX>)PO$8^To0cXij zs16qsuRD2~hc})5fmh{ojYeKgrUV|Ns;UZ&+~>Z)PJq6+!>Q};J%#A`qnOAZRhKC~5?dRvYm^B!g zpH$!x?hzb#=8g{R&F}MmwQC%TW(Gq23CArEApRFSO=9NJMSFUTa@e%})$$AYEdINm zTc`l%S(G{4B%6H~L^0Wj!-)tZiE%S=#>OPaYdTWHIa7!)eI~^s%T4Elu9};_|1q-O zSV^^2;vi^>LfaAhZ9k6Rv&uNiHt#$^h=#+@7GD}xr+nqZTh;R5{vzC;-EFHKh{BsK zlpB+?tl)F)lc(n47%^z_);s@m^~HbAX<#jFl%4D^w4-nRIkG|QEM@gMv7)TGb``Gg zve{X4Fs59r{66sD`*-gOIGMA;Utf29>U8_1IP6-~?WOME6&Gd#hLYHE{$9irLGT84tMijCKiPnn zN?`%M8&;3XHG$y9X@1)tRvx(-Cpmxn9~}%~^;$(TN<+Phx=KSj!bCv{k5%wTc-+S)bfY58b)mi6O8!#UJvqVb2dL4!6z^ zD`9a)un>9qD%xNwi-x)fsEjRH2JaZ7H%B1VG4~eG9Mzvu@2yoW zB>*3Tt;{7j9+u_Ijd!ch#E~V^LG2$RI{xbIzm8`*=^&9&^*asHOXlW#p}JT)lf<8n zkY(%e(0Qpn{velGy-_1om|g!!g!5?+_)Gqe78@%jDbS*~rv_2eSdW9>%)lH|S3~Sh z%VlMhR*U8&2a~l$p$*B+{n`zWt*^s=0_R$h0xz6)dG@aduT0(Ejf%U32RV^Ig+~|o za)=nh1`r()XS}Xi+&IOa@pAp(C_ylR1DTZg|G*F=H9tG9R>*2;V=u(SP6q5T+v^@r zcdKbc@qmF_dFdWcnaNB;?_rs&Sm4cc8cXxf7@zqQlTYo^=jJs9THW}SLnrtV9`;gG z2xSD8BcTm=&*$zfSI{G!vG0I0=VbbSM<2uowEIhatg4*WMO;d7`Bpw zYGX6zh+kiiY<0^CbGp$EK}JPE27(jTlB zk-}^2Ny~?Oe-|IpRV;Q?Y}gX_{KE;_O42tDUGSR`1^7d`d0=t_*ldB$j`%}~WU1Q_3fP-6he(ZA2>V;)3S3U$6oGZC=a4R!2 zX?fUuNv#W;7XdyRES<}VKUkgj^bWkDxKlE2N{p(|(}jDFa;|+u62jdVnJodo%iD{S zSZf2Ti8J=}2*rGI8DWJF>XZS(tP>BgY2j-n3X=0VXJMmZX<(*p(qPj}%FdXM3 zXyM4O7dht?3X4YXUCKt#-^+Dv$HAO>`TKkRf|`aG&L-j@VT2X`#b5LcG$XZ>$0)Dn zdwq`Yp@diO%=Fz%G9&EtckDAOswOb|=M)aEs@ba>fJDcu$G5+I|H0FCoN@6*=L?FK z7^gc<980X94s;R{xX>O~TsJxseCu@7r-%P3|B;G=sixK*;U<=~@9(a0h{2j!Th*t7 z0Af4=X(u(=qVbTOz|ck-t_qKWUR(T-eiq3+fBFsLCwhT>_>(@th2r5pG-OWbGEdKX z)mLB(D>r?ZlB&y0#^8-5pz+=9KeuX@4UIupgACdr0;Kk{A{QYF^$YXZCo8BE{`sJq zF2RZN0C6XdnDPi@nMAmZFr4j#@6AVeQG@UC!|_G~^j)8r*KDW5w!kQSS6$hGU# zs%3E;l5>zZXEWo3hp7CzB8_~{(`;#NeMLi2@xYHpEx)!ZeK{3z9EN+FmiPX4Y%xzr zZv|Fw+~<`__%9|qVRLcKw$|(rlImVZ0!3NlTA9*(ke9}(e^+V;%V*;OFj@#{Fvf;! zGWwQtKn92Qc)*>`n$vS3{VbbvES;t7Et(y&A3qvUNdTD5)}v253fJ!M&m7dniCK|f z@)iZNqm9h3WuBX@r&_jXy!&H%;hXIz$8IB=qBOA|Gk;PfbVE)R))5`vCYDKNu*Bx5 zqE4WHgRi*=dQZ2Vq4HM286~%z2d7jYp3=Xj*v(7ez$>3NZYTNrdfd9Dkg(|b5b0lC zI^*c^^sVxSqkfm?1spX~v8z>f|M!onHka?TPd~Kt+2d}_Y@X$dr4=8Rxt3n}Su`!& z3{kwYf>h$)?+9Z!v+i~NK5{<8wZ>Kko(aZo2}<(=EX8w{$A!0=^{NI*iDs8`>$lOo zPp#oT3Z6FAcDE)jG>vckrHIl zEY|bUTAvkZu&ott~;LU|NFn*cW~`%%gD7wxEUehnhDt%m0T^7LYYPPZO>34LUvS& zA{23j50x2;tefn;_jP~w`}^A;+{Zo6>zwmkD6057DD?*xs;WZ;Y0e zWSKtRY@mxkuNCE_@RTw>DUAN}hyA5Y`IPRlJ;t31E^wNiwK_Ckvd?TMDK72y$6!^I zH0owJ(HCikWAKj=Unxoza}^{uMJ+P^@`{Ne83RVT2=4RdKpSY4tk$xW&o@{Y$>#a`1mPEYVSINVy-E8^@___gx;-{Tg0m}&+>|1>Azs; zsKYR7Cd9^G$~}^-Ia{eZ`cmx%g&k|{#wrC$7z8vLZy=fA@aQaibfd3U3IkS+6-A&+%~k`uarw8E@tXL!yetIG96+dN_15x+yg)Yky!i*eZ*C z9!$Nxmp>$KdOArDMV1A(Qa9c=7a1eDxRE^IYv?BDUyJ0(Q&S&o9p^`9W;0EufMV1dqc9w^sY zo~ds`mFv*qIYi*7A9XxUVYe&Vo;kFvN#|%ODdO>3HEm5P=NW6zH8cR{xxlj$)h(er z6t$bNFNF)nKDwh)Il@GGCr{p2>%L-}QOQ?wRDi30sr&L5)rO86s!z7jXk3Iin=Kn^ zYvSq^gYq8fyUFYP&4!6Bq+z^F)EM^35*6UGswpliFzW#h#^dYpC zowT?6m)dKQB(J{ToiKWT`^Ndd8C&+zwU=%&UohcohGN{M&PN^+^(S@DWymrS>$276 zO;Fuh7c~1bKin(+lq>g(bvNXu7R!S1$c!fdhq4N;EkZ~Vre7a31uO3nOfZ(^ z3H9uoKkQ5A6mBSxZB}yxDLJSE$JVBCn#c2%rUzF}EW8tt046MkZ*}zF&>?#kplXYi zO2r14yamck3&}6goaFidA-d>%F$Gj1pi48O7?k&y3#854;nUBEqApiE2>TqQ{rqOz z&fS}ZiGt3zkO&w{p0Yo)r=TA5Jj?K@ab_Y}OUg{}>W9rr&VW;W@iIZ^aqm zG^rIy1ljK@!tH06R&^udvQfq9myjp^vPo85oW!!n33pX|T;a#}DlQ0L&L^a_k`tdF zX@=V07$f@Kx<2pX_{Mg^gZz$~b9fl;T>J7gyThG3OKQ^-6^M0FOU>`Ir@oe&@DQAE z%20Qe?$o|PuasN{2$TdDKG4ZNHtOf^vSV_~;bu_8g|r&fQS-i2sYth-Utav8IePc? zr?uJX2p}haRzpvhPehVAJjANc#WwSDI|C@3b+J2CZR8NgF{{9RRF%I7)Q- zhacAo$3eG=>*izf(Z?cM*Eq`!OhH5>*iRH5tk8ypb5Z4f5@N7k7)@b!x;EPW2`Fn) z)QArF5>I01XtKePo?kM3%0%d9(nEoUF(+v*)SJLZW>4LfpF9hBs1Huw4AQ;PCX3I_ zDm$OSdLdq$9mffOOLLuw*^5?#J%u!~Wq$o_=e!Pj@+EpSnz`yO;FRd*hUz7^Rr8}n znolNUPjc_t<%eB9xOaa(mioh&E)fbo+#g#ULsP-Kg@r`L`S7x%l^WX8do4odYvS0g z{ImBZKhRu$;t*D5JB)~QPq%Yg$2NjYM}p6;%O2nAI9~GgW5ZOTWE8Fa)%VbzQDqe| zczeb;`3s}v$AlyY`xi^?!3Y!_6rtP>NwkhnGY!;Ym4P%34-_qyNTdsjDsNNZL(2b+tVf?O#g8+Fmwd+G(^-yp}IBb$8XZ; z$-sw9Th(GziH+pw)?7}^#jQc(MPVG^Gyr<+khe?~)6-QjY?w3VCH{JBV*8ePH-mZg zv_K)V=57Z+6XY!&-Xs1p5)c1+skRn|F#>forbi!MvtB|I=+*<8WL%9A(pT^ZkyhUF zb)V^w`&|B`qq||J8_V^`3~p#vItyZj`&v*|_?c%nk%g!g>N4p;difZ-xT(AE#J@{{ z6yKDJ^Ai{Lz6h+UNodP1qM2^M4!BSlv?XJ3kyQ&X%MZV7?MoT{;AW6jC^5bAOgFv7 zBGpcN@vVHSJ))?1?BJ?d3pawQE28_bI6n+aVEzFjJVUXsSvqDy_BmdH`gs_jXWpi>2p>>(Z$=nqP5yW_WppZRCG9`Et?zcMi~4L3}U z`8O}YpzK_I1bLDi=krh1LL3NH@~{7_osydgrNBO zn(}8p_LNQ)YDO|Tpv^-i329enN>mx^B$*cWek|+K))m*-f4>oVkko9Kt|KAV_<)1@+_)+vnNvFVkmT!?JfOmkaRjg<4tYtMLJjM zs)esx(YI(diY$>Xn^AWEhQza>$lY=I9n0(ctofW6Sk~`0kN~6!WT$?x>L}mKzedj| z3PRG65z-PVhbLR8N)%uP@io46^40V75SK5ot7jbc~vdu8C%Z3|(d8*`bee?N+dkC@w18(HRaV zcu%x9-sQl7Y+XmX_Yuf(#2(go5H9aNs*Uj8{+-Vu$hN;9)939|t|VL*)}3LvW|?O> z5FvxSJ+aQr=K=%ap=(fiC1Pi5JBQ}4djk`2dMl9b@Cw^Y$b}^DCC~QF`3hGZ94U;9 z(R1VolC-{$lc#f3L7&G*Wt2eK(;M3YP`g8d1N#O7N@s%7!+8mlgch>h0~pkcl_<%V z3YF~i-ZTb}(ZEq#l4`5Y$V~`5P}<##dg?oz6tULBX{SrpVP*k4$C;VnJD8XoNo9#1 zR>CY8UW99v>)7L&yZ_C_t%IETXy?wYY*zw;HyJ^j}9%l&6eh77$0z`w%&-Peo@3Xw(7 z5uM)fuYArFKJ2c*1!2u`{`VDbKJQ77XMpZQNcq4|{GySGR}|N7=vlCJ#5{4nnTo7@ zW()RpX^YdPXYtDi39bMBR?d<8IQmYg)*Ge{<+H2GF(`&dvcTOpqK<#o>?yJNv2UpC zt>le`3Jd$x9JG%Jq`yW=@^}Apxe<#{UUukYw`<=vMU`()Wyjf`zJC4sG{bXC+JhFd ztQG@L6m4Lja3}2fpUm>Dt11P6i8hbeNwRkA^Qd8aP0+c&Nto4*Q>MFiKw4t(=DsA= za?Dk2S72Wp7s51D-YT^2fl9U{Co!;=7x`S!t^B~hu<7Wqy>!*BHEL5CDi1sDiLyP* zOeThTiX`lE?W_mB75cs|ZG9VuB2rK>-y36xDpmcA!y!|k4OJQuQOQl?zHAa;WslGM z!`*3Ct>T;GzI8v&6xMY0H_V9Bezo*$fVoKWBA(lmiRW*OrmxW1oW_a3db3mLN^K|@ z$IGOQ9OJ<)i$K?FYfKC9t!Kq z5F>S4iLS50a({$MALRv%ndpQ#EOEzsf)7j@)Yj7$y=eL_k;VH;f!}`wsZsZCjwj;b zu4g45YmA;EW?jW#t_|jmg7myYQRC2lJg4mE>;RiE9>V^oxT#*!YtN;(Z{+0@(1>KJ zuKB_FMB1zTpx0Y8x8)I1=I5VOngK9K%=0tsJ6neg9vV4$(?@-1>!tl711rXVT;RWB zq0M~?;XXFDc5&`=-?I_Nu;aLQVjU(e84>Mvj|A?&EM$As?1znck>6`+ImG#T>Z0F6 zVxfv|c9JTM9B{hp!mY8oY}9l1_3UqQ6XPhE?mCzGPrCB438Kz5tG%b$*qr@p8VX$} zras>W@Mi?*{uEYjeXS|#?L}81Sv*lMkLsld$_{#e9KL<1TXDD=>f}Y%S#?smA&5QE zWX0@wP`-f^1nbio<54ZgfeLsrw`$piN`Kz_SJzl|^#^sfGUaa7t&z`*@v((Q=zxQr zh?I6;g(vgR-A@tbSHJ5$Wj>DLLY2<1=Do-ZWfww7Wl@X(B_B}MP+%vW1&l;N2D=HD z4J7Dx>@>Fu8xut@7t_(Nfq9b8-)zKW=pP3HM7h`b3^1X$=t~(PW8I7oQTp&(w@A(X zWv%64x19vH>Vq^K!FXLX(JWc=echKY%7jC7*mD+g0xTX-ugP{LhW2>B;g3|G`t4;^ z1TcVqC;7h9((Xpf1O+f7oyIOF6&`$T}TX{Vii!Rl-&~?aKcw6Pe(wp9Si=`V! z;eJ%ELgdGfS^?w!=(Itv<^NM_BEUt;7Romj?SHvTxLQPviO>V6H6@U%CYv0vF7oI;tfSnPSZ;QYkTzG!lWw_oB zW16?+4`4a1kLR2()DR-R7%7|cZ)koxkZ}JDbZJgCaV-){ zY+974jV%}(ME|3i1IPZsZv5SeiK>dL@}fo{_@Vma zhHj=@`P*#pVC3Gk0MYa}s`C<{*5_#6O6xgr(*sQ*cT|oCXIRfE)dl8&z&n1?4L+Ym z-Ay}lbQ79xzIKp2|6LGZZP3=a-!z?y_KNql3{q7^jW6%vj)=-~7+t5^()cl6Kb_L$ zAHt%TF3d-dmQ`f{0Vh8L6cBs3EoAC0FVCw9eTc6AhfPPMet5p7#|aE)%4abf=SBJe z?p6@F`RCpaN5JUA{eQIWhF@=Y+XJZ$U$%cdt2D}c<*qlh zo0oHhs2AuM(pOf4U;+z!y8u79F9FPjMh^a)ABby*Rw~3nU@r!Q!7@3)S2n$*DW-Is%`n>{eS_&9+#~s)pRQ?c)>Jc5G?2$X@bQm7liY@1Im(&Cd{5U{ zW(rH&aijNndVjIEBVtrv;Cw*Jvs(tfKi&sQfA;mscTUw86TLPyBwtXYi_P*)yFp;a zf)eJX6N#n=w6n+rAyA&GL%)zX!F&dAQOQP63lL~%knZIJDt#I* z2zMu=azXm5Ghp}D6;ylrHw7g9w%|ltc$_o4S1i?dFYSK|E_Vqk|6I#IK;%@XL(nTf z%kCfaT9c2Rk~v%~%Q-k<_;CEXlh7F3H(=x+XUY>5_R7KyFQC7lGneCjlm#hir4%HS z{=~3YAI*hf($E-a^>}~*hB;l=XZl-C0Ti5|8SK(MtZmD_t}7|4W-iG!8D|E2UOicB zXpb6Z#-uh`DD=yI$G|uwpen}_Y=7izJ*=Cj3Dcb(1`fK{cfJn=yokOxZ6*TfwYXLk zb{6W=*{`J@ivwusql{9IPwp7mipfI>QSdub&4KlyVgmJ+H26e|MG{A+dV{O}db_Q! zO?5U!Gk*SzV|GW72Y(sV&hN3S4~qlG8t=&#wITm|!1tZlgvRH5D_YUs^VPTy*+P{d z*BRq|ITW(8+U_dzKaJ67^8RZJC|+?)_Dt7=`SvP08t^CvS@aYP5u!Qq!0|Y^Er~}^ zVvUShh&^dJ>RaZ^nCuVtwwD_9&SS5A9M-6ipW)8x?y)=$Lfs=|Qv9t?c5Q;_2CH zzi-@c$nVat464%x>|89f*`#VDOHl5#g3_o37Sg%B-;*5M4Q47dYg(~ZZTnF&!Jx^Z zNnyVHZM;4r|pJbJv)7DdC=Dy_O0HKbtvvbeYOXh<67=3nBc>rv6eC^Wl zVLkvcqsQJ^b)S91qc6vJ*6CcR^PxpI{3Efp4qU7&6%w>)jzuhLuoB(@R z;36{m>o+4?=$j23p<_{Po?$NS_iZF7y|go1<>!{<0RnGP+Aey%RZwPtFVj8}4-JmM z9~sHgXm1*zJcLx3+@+E^fl{68IW_`{V)T->>&VhRjU8$R)dHYA<^ov0J)3TUH28MuIY%_b=YmALtU+02v_sy_@ z;btZiy(^YBqb%)T!r)Bj{Y`R*rl1obo@#K;AQ6zg!1&m`*!v$`{^ zpiB1Tk&}uU#=GHSoH7668QQ1~HD7GZ8`D1UC?PP+AHEL*1jwQ1y)kvCByKN{7`1dw zZ~&YRd2ak(*zrcfXMRa6t3sn4Z03g!{F^koTL8gEhk2CZKSe=Mf2W7cCEAb||4hR= z{sedpKu1V42Px8;;7n6H^XqM+xh_Qho+|HE`EI^G2$vm_d2A0pS085?fz3S7CbZND>rgO%J zKR#G7%tQc;GO#MLf3iO`TgbgC<|=dEgQ__3G7a_2M90da*sYMqnw5+0`-RdGD87VX z!A&HXMg!PR)_1Hk1VvKH~jZUN$W{-vkq5J;4qVcNq zgvYfjNbqOAcQvr}^5WX>YNp7XU5bPMLep6cz(JT0A2mV=bZR|M(Z(30!oBDa%(t+HBbF=ju#3%+;QvD zzJemFRDs+@!W&Y*iZg34sg)1Vwn$P=uqiI>WUrAobK2YW<4eK!d7O;9eOGR-_EebOOoh2N~lK;j+NJ+E5l4+GMq_F zF|4FSN$_U~YgW}Uy-z1n5LzMMZIFO#an|?g9cV@ooPac-{}{;zT{;1Eug-EB>M^4Y zRiW>(8Jw&3;vmMJFM+Aznfddc^VxeOIFy4 zYJ|Hv9jo(=lR!f0MRjnLu>Q^OLChh?;tdA!#f3v9`WuYyzOTVR&4h>w`};lBy4BEe z3B9)Sy75Xv7pgovv#ysi5!6B3b_-O#+Yx>AJ%V!N0r1?tezhyQ7o>mXmaHzze-6rh zUx^!>z}C=uN?4cbPcphl@?T93WIQf+dCB}+@>7RvY9&TM->Ozsl!=eB4&pk##3YrXFY;n|^I zOSB-}$ir0ux?Pv=YDUFwDY0HILVNGjm@!709N(vx`y=u#2;>7RFE~LuL!cMw--dbe zD{Zm!Tmz0@irP7F(%{;vw-`Uq!l&=Z;9o{k0&`cs%dBrY=JBMlaO-NfFh7w0;rcK+ zf*KyImg^J3&j4k4GGKRrH?_h^7_lL|`Z`leOpTc-W(~HytC{^Iti$9!?y^lm`Bhv= ziJl6`6_!0594*cvy_kY7hiqQ&3@cv7GSpEgo2AJHZ)hqblAJ6OSk|;&4V-J%BM1&B zss76urS*q_#)d<$+Y^?kv4EWwr=~j%Q@5kL{7>2fqRh&-sHo5zf0Xc;A@>y;zRc9Tp?gpI22}Yzccp|6q5yLA7!d>-20#E@#DE!B z5IFZqLFCcCXyuK=SDjB%#-G@jrG0qkoW`6SBW-jXN{Qjl^=e@^jJ1zUvFxb}OPLG* zoAJcb{$^ci*6;yyI(mY`;W;3O0mH3-izMoAl7KlV#VFgO`5DR2miIFy1uTvh zTEp1g`=Md7xFvI5tF7k{&hF`Q<4x@<9HO%k1 z9tA``GNI{j{pXLYz-v)w*t@2Jy)`O;jn#LJnevf=k^BNwVr#wz(=yrUrBjM2M-bBv zw=}fjDY6ru$FqVDG(!bE;NBD-5CQQ88@L?!7*IHo;Nj{*MLQz!PEUTZ093-VGLgn{ zUy%Q_d(VMNcG0nM*Ef0vcCOLYJdf<-xoTftUuo9!PenA(T^s2C5>bq{)#*obS6(;y z?O-2;t723*HBpgvTzM&M__3U-W;Rxla3Kc41oZF4PB z3Ylio+!YfizHp>N@goA1B3BP~*Jt;nTB&YhJ+Gk^?S=pwX>v~ed`Z&YYlB9tfAlMldSpD7R517hDhIfWxWDB+#AHoSH<0FT27xxSTxLBhCKcjO zI6qk{h)D&IyJ5~Idn&g&@>c?3ELYHE$>rY7XR)9em2S>MSzPW^``i2&hX#6yg2(CR z5(6{3&jA5J;8jBq$?U*;BR)J>iEFXi2N0)Ti4U(AAHnC=$9_3Uat z0N5q~R$?H~Kmgj+ld(qs861a=mZ?2sDqn<%bDgnEJdfj!rziNWX>mq~Q7jggD&wna>w&grjc=J5rrQuKpc zi7)^WM5`l5^{h~M1kc@811`M4CX+n}@n-E;fZGduKe4;xCM`t#y>4kK&A#(JKv(q_ zayZaVyzRMo2f$`m9#|4135dg|-!>12B0pQ~Mpr*emSq;?rF0nF!x(?#ys^9_%>K_#l)vLoTv#4>dR?$y*v% zB;6XeEqFZj+6*ptBqYoheqr#~LWD&SBHRhA{4D>CpHmf~(K1(3p^f^_fTuQ$pVNJdcJsQpeV{ZldB*0IQ$-lKm_l=T|-$fpAeg{Tvt`Cc+mhfRciNGW@$q8L>b z%?l9*_t@-cQ|Ad)A^>ecW_`+tH&dbRW(WYo#bEkar@)Zgk8aOW?{Y^ZFS7%16yy?+ zz!7*UvrxY1gM+;g+J+%~Oj~B{n5LYm6(;x097R$tRTc|wgY;B1XCU2(vN$t<@k2ak zs~I5l0I(K6bp-5|IwB1l@AYU;CCGDM#JLE0Ogv)qqA&<|0UmDih>yo4 zlF{i}&(c6w({l3!0?@sxfb2ji625fkWy3;7z(zdaG%2|I^{&jR07lyn$4y`PUwxT) z3WBm26)D(*t2duMH0M)T5TNILb@iyo*IUmTW5 zmrzkx-OiOyB-2?xIN2YSzOMjK#efsQ@r|$)pRE`uN0;YyJvp*4H&-_zI=I{#-*8vs z2#eMVywT8z^wJ!@v#h@BnT*f<7tQrx(;?;Wsa$m0bzIcYSRbO~4JpcXF3D)*zxgo_ zW&tWGScs4HgJ0-y17IO8eb77(@Lu)b00F@NyWuDrLQbso{=>31{%QKf#mY7h#KE2} z^>pui|wZ?{~y0>-s4#_IPE-r)c{ zh{aGI>8%qTG2yL}XCoRVpr+vw7$fp&7$M8?P3|5-(w#kQl0xxFE))E~NZ`4R?jICl zk3Rhk@Gu0|%?EwK5%q;&K)G~5Ob34Y_YTv7HgDR%1)#C_>_DdHv>Y9R|8<-&-S#=^ zwlOt;b9I~T(pZ#Y19tA{BR0*i>?m^b)fkaNJq^}0xLP5LLw5C-gcNU;9$f^`{+YQ= z`p}F0AVZoYq`2kuOQi|RkLQA|>Awx#r#sCe&+#H2f(QE!avT7xKBZenMu8IgdmfmN z1q}yZ8r<$H@APHYW~40KW42-{TwLzM;1Ez&C6fO`=m)_Tr(kJ-9dm>c4|z5IBDI`L zrI#Ik?q9y8tcoD|XjKYn8llg`G*ZM6Akr%8Jipa#PCBbUhO00a1e~jsnx6@I-;t^0L?EvW=OW215Zv2vOwP5#C*+_oZ5cvaGzVq@ZxoQ2JBA~~pqkyIMH#1ljXn&k>{6{~Fu4Jv`m)NG=y+8Mc zn{Mbn?QwU0&)XJbvELM{eSg~WI#>_T;L>1bIT<@+^D6lZGB*R5Wy__5nUiDy&Wd@x zOb9=NK!LcY0~m2MA*hJEmyLNskm!!N#(_?kvn!z$#k;-$DAr3l>;Rt|zPZ}gT5Eoi ztbuZ*es9%XkdTJO-y^nq--6$P3Q^oun=Hg(6G9XP2um#UZcmK5I| zW)@fPQw^!H!TPwkP!o~M=~ z`}D2*7316Ir2KpN=Rm^opCs%gXknVclLcp-IE*?BFV_w;egW!u&s-F2vq zWEMCrVn5=90av7KgW{&c^h_?git7!b`Tf^D6#o`WZQ<(<>mCt?5cj#Wnz)(OUD|G zjm&zSIZVn$h9gCGKXlblkp&1lYNcI{`_ITdFLkZMNEEJ2U)dbO&TLApkN&rW=U1P|e8hrx7i!jbE3A>TehG0`DLC@&(CTq-rw`q;|+O?-2A?7>L{) z<|NxZ4aMyWouLb_utY^Lf@CHlWYEWf3w6ul536Ipp9+^|-{7G6?E75XKt!A+`)kuYsSe3HRr#G{ zpm>~8jIr89;Jp7s*T0P(m@uR@ZuzhRK?b53#`Rc$+C}}B#;!XtF-;F=7?c@6q#BKQ zOxaUBx=>OBUkzF0AL4+Cnei9UY(<6s~)=a|1Q6Aae8TLs#E@1)tT{GE5#{)p4x-I7dI~r z_#`_YFi;ER@iLE>MCCmhH=!@J>PxZlM)JtrGifp!yz6zT|KHd9 zS~95(giGN*<0J+laQP$4#7V!O&J%JYhv<;z@&}me+sdH(koXx^!F-9GU}3TN11E42 zYH@Ty*?9?Y4F#+(Y0OFtV5N#?RoG#NRs}`^P<<}|R7_ET&|S_f43QJf)dh^--v|S_ zZ(cK>gXK#S;%1^ z^Stmk`S?vI)AN)I-v?ixPlazM?{a;q5Dk20Qcd}se&7>H+>O}#Jsj?jzQtz5XHVEQ zydHZ;m@ELJUD1-K&zfrSvlzLNmKm+2?Ek#oNxWVYfjlKsw zz&kNp^C}>}zX{A&&%(+19-o{AiLY*;P`ojyat+ahx}r0E?9OBS?H2mfKkGM+L9YvZ zzpD#EbU3#8+|_a^3{;MyyG6^pe#gg^3SQvyaWvs%gb|?r;ppIHfS|AAqLe*#F<9rx z;;a(1xc&;LsREO2pb#AFO6N+Kk>Z)WX?le4gGVQT0)p`NaL@=4mT71^8XtX^8pxO) zl>}sKxHXY_*nWZyH2m+&%c&hPyr2I>F8y`Wb<>Z3Ua(zR$ll#&n3Uke8_3jt=eL|X zbUR75Su3<|Q`UFG-GBt>^RFzs7$9~y;;k||(inM#t(VsS9$0Y(<_$P0Y@m(+l#$5w z=j+l~F!60Z^UlN8eZ)WvK2w7{_iU+doxW#U`NkXpiU=TkpZ(|QSx;fBk9UBqDwFIF zQ^lM_^>S14RA;Ec^Mes?F-n0*WT);uFm<553LG)XMTlGO07k$Upfmxp=Ph>f1*U@n zKosO_2Kev*q`*wm)5q(9YWRDA4-e{YA;=jj4bmX+3H@&ZmgkU^;!^?9As^;aZ1N($ zFy-E=;xauDn{v4QME4OhcHcQGWwUF-GUwB2mXKPD$LCQ#D2jkLUNiRyAu33(jy?1e z&B9w9&*kobxQ2k~d*U&65WvTrN?g_SL3H-u$!}Vi%I|N=cQvg0NFd-Msjx7+M`J1U zN1FLm5XLJ11ZO)WXZnj8z;ibI4=jR^@6D3CvZZd0BL3IF2JE>D zXy4SwhCk4gn0r9YeLq2h zdz?6bGwy(#4TQNrZ~s6bN-t9<-v#I_LE)(NhZ9vYC2yh{K2w-`jJ~x4_y*w*n$-xl z&ZqfXUc6`@TkX#^O`>>8j#gf?GTZyqT1(47lI7uq>9J=W8TaanNuC@+Ow9%0qtHoL z6s6~pkh;$I5O7Zh?q?L}LZ`C=^PB=F@E>a~JDg#Ua0CPnM!=4KILo@aR}DaCR?ytQ z`!`n|UU97S*;?xOMFFxd8~ut9&;b9iG1261!4R=t4<7iR#k{+fDq0w-Vs~eO>T*FC z8Rd38l-!cfs&EGH(0BHB@K&kvZ`}$u%r%tE7utzS*z)*8A&_edKqQ1)z{E$`h$o7O zTaXWv#!f^)FY4Ee)Y!}SioVp2?uuEobD{{~8RuE?PCSw^(q8{m1|#K3x3Ac!?ygei z#{Dn1HIIoj_%3~)HPIGnYmGBLR8YmSlZDqiy2hNgmVcx((hni+2w4LpoJIfqw}(v} z!juAcT>s&T@*wUHZQBhJ2nT#%Mwsq$Kwi=R!)5}l(6592Dwekg!+?hWLi@mg00OQ- zTH=8@KjIv{5F)5rHl|UN4^mSH{Xe^y6*pc{K@qP8T-RJ`3jLa6m78^NtjIfwYbqNF|sq>H70|MdRrs0cR} z5YHG+?!7cyuJaIwTUZ>aKjkeO);l#(usmU#L^iY&MG#oUpcw*D67(tOe-oE_Vz_Vz z0rWi9w&^ca*e8L}L+&D)ur@Mg>7gDLt^pKi;l#YCG63+S8g{ICs1G3fYDy`>@43@$ z32zj}G5Gt4e@=iy=o0MqB4kj(7I(wf0w&PSj{IN z+o`owg&O;ub;#8=^S$lHPVT%zeNk*gx^XddY~|p@?VoTD=;nJ;t@JK}32F6*<-L)N zG90HXhj1Nmx>!FQ0D>bY; zaR)og02sst0#=}i0@;jl3?S%2jP>`%JMK$9PkYmBBbNT%96zYIFp(cgiV9~ZE8k+m z_0qDgw^EC@`&Qn=YNaRvR&aOUD>5|~145*7Ke7kD+~k=d{oJOp{=1l_k!t}mC3Dlz zcrG#ujy?n+Fbtx!JKi3&K!JNu;^zNRsO-kLXb(w$w#F`+R=t z6rZQvcd?)KH6q4~R;U<@OK%hi5us=(m*)(jS69})w=4>;7dd_U;-F#wyf5^ItGfhX8*rTjmvJ))7y5kyd%Tt6Fn zCw;OdQC;ar#%NZdv}2#wm0hhmI@K-(^s<5;8mX9Cy`8QePT;^_qFq!kbpx^(XqW{^ zF9U&TB=0O^`spEIrb-25IYjnAfc!udy~vw^?3+j&d;{9p*E&4NJ-^=N`-eEeQTUFT zDOVJwCv}23<~)&Gu6zI(nGnO7r_LW|H*tTk(i~L&q&*->yVxn2)1K9_kx=VUvk*FO5|8s*vL`;$MkYA=Tb{XV>3sa?MO{?D;lfcz2*ChunkbZnWp?^F z2&)WHMK~^~(Cns_EJQ!IM52;E{xd5gPB5k&M(LY#g)TwCwAi%Z?_pMf0xzqJch5s==2iQ z4(tkI`cdieA>hpO`MF+P%5mZGlh$h(N+o#W+tfm2@%rjZ5-;)0&lDte^=V+Bx5K(RL3yFGCbfg@GZ zJJQ(dbBe?Jq3_oq@xK|s3i;OlfqH zk}#>SbORy#og}KgQ_WrG924@mYZ7rx^vACvyP0XE(CKp26KL`2mt8hocLG3!!YuJn zKJ&a5<$9DgAK%8=ysg-N7gk_n#|XFxFK_Fa(@NDT?3$LkmZD20;YaipAIRLHNlu+r z{T=|ceAw}A4HwpmKAf=B;JX(%l4!2;ujNw1nbPIN&HuCq_u$1yFKLk1g#L%Z3xUAS zYTu=I7cDSk1z34}$7`Ux-rvpW2;J5LS#yS;qBCK6gv^BRl_XubO9bSFRX|LD-jzv# zoz3@ea+ZfRjTPWGtucqBB(T$!HXDkwy>DUX0c1_#y($rzHn&mg(Ac4WfRhfIgp-rM zTXk`q#QYLT*gjeW-C#H;mqR#g=Ws7$)gzonH+TK zPaRhO2OcfLe4wrkT49X~00fH9s9-5Vl7TgC5v65(Tm`Jucx<)11rgq}cJ0g%P~Su*6N`eQnMOYR2f<0`VEK2?7O z5mh+)ut)(V3~^{q{nb7xO$|dli8vkv7SQE0G}pKMGZ}6!yZ5Pke?Gi%dl)n|*QxBU z(_mUinwndNfNrG)l4#mBvSfFH1vb0*u4^`jR&8$j@>zw_y0z8G7w&zI&2O$yuoXMZ z{wv-2VlxyKUO`@A1XQZ}bwG6Y>SPr!(?3M+C1VgH44M%;|1kk<0$t7Q-aLy_dU~~= zwyxVeFUE6hZOJV*o%$gc$`uR<8z_V;`0E`132Y{2Yori74CS+WkYWKY@2$iDA8Gr##= z^Z(3su5;!*&-*-|`@RVey!n=qDk_(;t5Uk|f;mfM!vP_OKpPbX?jywa#b8xEMBq<;Z{O;lq_e~egLF?8&1(i}rb%cy$NiG#s5 zX5hq(4Rc_|rq`f%?@_288LzjRIvgd5+KrB&N|WG1z1#yh(zId6MSO}DqCc~uDp79Lqo z-pqBbzMde4TZ|iIz9vR#`wbhpf@xZ-B#&k5Z(o7<#kTE#5vI%t@tcB@ticyd!&$R< zh`mr%z?et=EnBOtC+CY2+Z5aYk<%g*;s3o=uYdZNZJ+{QW9VN=Ftu=Ds*UYq1b5rB zZX;Xat|Vt|yP}bB?zwH(gIpQncfYuE5P(f8v#--(WRMt{AjFC6d!=vauxFrVHbkNe z!URD}gG+}nOo+ru#NY{p?pHn?0KhNpLTJimX|X^8g?tKHblo$ka~_e4R7|Cs_rx=^ z!OHak0HUulBXa*aR8#8gwbJ_5sv1`KH?ScgnHhSebk=3?$c2Qj7pg7qFu!B zJT8+;(*bbo6*k9)0;R4{{A=L-@Ds`|EOfierEq=xNax17qJR2nDx+7ScoTmt%@(U` zz0F+?_Ka{r>%+TiW5%NKY7)5izs_Dk)U*fv_mISVBX=Ba!6 zv%TBDp9LMwyp*NJTG|-_Db|KJW}|GD;aE&o%14nL5j78O{= ztL&jnaRQUKeJ+u)=Lz^)_y``Fu|%H&Jz%ifdK1J98_NM{`H@H43w>JZHvj4lv||3* z&!fK6U<|S?%WBl35$KmxJVQss?!xqV1P{LPZMnj~0(bS+B7t1bkf4P>ScGL`aMIxS6o9I81|W?{7=?K4#(}&?-vT5 zE{eSOzMy=PrsI(N<08xH#}e$uG+1}SCHRh>0g3GLn@nVjIpCK10w4<(ujFz<;5)6P zFFh5xKUgkDwT`Q&#c@>O(>qAh9*#-^YgV!VYIYmhpP$Y@381xpWq9qdf9~iU1XcQgo!pZq7v8(XnAeAH3ct zPU~4(GU^ihv|imlWq%}OKz(3VXg|_`*zXq3Er~+ywAV>d=Cokee2j35YE3}ulWz`p zZ-wK=C!@XK``!z~(Ji~GYR!{6bCM+GcbMkz+tfU}atlygGpvd7RJ%8Zu6{SD{`1!_ zZI^KIvyGSp+E}5U3;|PTM+fF^t%k&S@!vyEU*0eLV!Z^nvQ_H#8C6uzf>^<)^#iP#8a|FKJOD^+H~j#E z1JFO`9m=kHEghpbu&svriKRAhq|Jcm9aIV&($*v};AvYKFn`UkrS|ww(SQkZ22DsI zpr1UZ2Qf@N<3D#izWjcuB}~wCQd4o25j>Pk5$p^sM=}sFNs?R!%DmF%wq4UHB|seE zlSk;Ll6}ocj6JcvsP>>s3qNtJSR9H&KeE1=9)V8#4^EF*x{lyhphdzh+mF9K7jrp# zfx5lWNQZwpeo1ozF&qViL*L%z>{9TcNWQU6L_h>~Mx=KB%(c;E0Wcc<16%=+LO33u z6lt)8x38jZf(O7ck}-O9{sLCqwkm)FTa2@3d&rqgqk_MD2M!P0NGo%_g@h^Emy;xV zZk9xY1|`b(9XW83&)DlJ^zSnrE7lP_$X;43nE%l zmgKYsKevDq?lc<6_zF7^Pzz=B3s>_PtTZYI7I%M05nV}7&%r;R9!vJtl~nd5QvZwS za>~!ZBLy1b1>7Egs3h%lqV^A=+TXR~hS2c$xJbrdBTk{-w_*kNlDf@dLOnP>_CW z>n*UT{{pZGm~L&p+0A&E?$GQ`Rlt*dI`oc!^sWGYe2?5VyQSI-DXs1AqIlI?;{;5%=R*&> z@N9it;Llj)!^OkahhJ&dtOj5{7#a*`Mi$8IfLhq;j6Bc6{x@%K@{&VmpnAt=%GQ#m<=lNN5 z8u($+Dy|AT?n&ap+16Iu>47d|wz<1C@kBuyd0hg58gVjd5v1MaAnMovXC%Ru zJsC-~qBW@1V}v^utI5$m5bRk$_$=yj3paVqT*Oy5{8QCGoA*^mqW_SWw~beYfVY`< zM%Rn7qi()hsdUqNovD8&SKc3JE%fPihvNxOxMDB!cPP8O(hbE_W2 z9W)mTaJ->~Q2lZjK14Vq&iriF!ElwXnK1P_O&1%8O*xKeNy885G zoUS#vK8-~l571Nh6Z#l+8{3rY?4%sc0feK~Y2WEdq#5219^>0SgCL&e-kiFr?|r86 z{IzS#uHP+=8x_kqLO%aw>$&PpY9LJ2-Ek=aSLThWwIL?$=8LNUtJ>4{Qo!NbUVj3U zx`Hi%4k~pcL1@nRD5x+Kx#C zH+kuIXLxw{Gs}(e3!%tU1Lm0zD(vnBK*Eb2F>LnKxpna-qqenm87B}WP5J4$?y!}f zX1I#yzxTC{C4uTb6d;;yrH z<04hiLf{2UrvNR$F88*n6Bzf#^g=3qvJz-49BGNms_XNXu#7J5BnN0S96p6R9+wFk zHa~jytmJtwufWRFHj`zqg}tQb7ohY4rt>4#*O*)Bp(lZE&#pKJqul zX`kI+KXOCZFy5SoL96Mmmts6)Co|o>*lF%O76R=V&+;d;ileF8Kpi#1*@ET!RkwRS zaCrPag6ddx4ZsG{^why}gD)`>AI6x{P!EFqe_#3saVOH^#Xvj{NPB=HY8M>I0}K+I zB@g1MFG)D=*`B{B>4pgJBFD=ct1oot?fGrkmPPg6UfSPOKFM1x>DAaeJ3OrHdu3}< z|N3Qsl~*!_82vSh(>b4~k)n%?O^yb!C!Zs(pjUmg9B;c3Is7GmN_}^-R{kaQJS*gx zhW6JbrhCjo7v|{f)S}fPDrtKSJCvAIjRFi#e8k~5*W_7RS@&I{^038%+za7*RJkkS z^HCm9%0km&cgQX$J!oVEX`de0@2|{sz8we0lmBJCR{(gKF6<8sg1yv$t%cYn*rmO`QlA4=c4()XTJw~?j7;n<5oHkzd;$0-EVE_hqqrX zD7XKC;El<>D8t_tZOx0;cF=&c5z)2bSDUXTuk23g0$N1u!FO5kvMS%ax37B`L8HGe zlQoWs&|C6p*|6qlOKtig{dSdO8^VPX&H11Ld4eG4j80}iw zx(3>v5>8274k~2fNqA%mteQyFXIF@cQBCFh`M}iWPZD6T;w6F@pjI)2s@Q!;>R-b@ z6yNJW0B(LDd+Q9S#<0K%T;kA`_8k?29nA%J>3h=bNx*!~5&E3HhkW z@S`=~vj5&(`-AKA9ejLCUFKM?KSZlnCFJ#fV{Oe<+K)svoFlCn-{c`vE=r4Xbv=WL=G&ho860+i#kLX<193kks1{yb-NGaW9#F zw34A0FqvG3zJMK(%aW~?FwW?L}c=mw!U&q6j_l6hi|H?7Eq^ovSfcx z>DM6H8wIv=w#hS5htWyZ47xR${RZFR-gLlrUvJy3Y=yTV%0opvI=N7 z$J^WZk*2Sh?}3iO(||~8s%t>`aSFTz7r-VXW4Ln~9irnsWsD9;W>JQkwz?f*MXIo+ z&F~!fj~|c_e^%^f@m&bB{hy5;iEVjXfXsWphV_-+OPz$9i@mwOFsU2_U}babCe7QT zTYaW&G;<5u<&-0mg@&5k!QBbpC_4(53sT!*!@c#{6Ea#v=ql&S_v}a_&yj(uO~&x? zHyHx|G3A$)^O|oA>AYy5-bXw?YEoN>>a67vX;kXlJrjZ7Tw(g&x;as3{8Pj+#h~ag}Mkf1ks^J zH9}McR?Nv7fGLkoNf;2{3RcxL>t)cSA6$RU>+!a2)@CZ28606#Ut9ylcE@i*6`IKSGVfrR+H{M<7u63Ryy}hga&E_xz;f8EXy` zIu}^u=kY36lp>u$y0fs!l#`tu1KhIQHPv9p0y2HCnqbP%Ib1}JYp)%kX_VW-mv^bH z6@sYgBpMoatF5~)_LiM%PQ;8KpST46{1X@QF1)hdxh+6sz*56gu3@zhqmy{dcG3xpIl&Q1as8`DGjAW^`$PU~|W!=#2!@cXv^1~a>hui2Hq;~H9yVM%h^3~xnVn6B49Pw?_BtkInCzp8}HzLQ&F3%E(CWDO1yVTRBUGM9qe*EUW(n zR)jp*8Z1iKyo56n|UgMNSh>GQJgk-{ImG2*A}7S;q|{2 zI%DS=Jwde8N%|Q-F*al9IjrRsy$x9A;gjA2-^2P4oIIb~uqvh7tI2!+8gG%y2_Cp=nDmIP<yx+M`MMDpx4Y}&2@6O0Z`&^GMTw(EQs*H>X z5^+D6kgfk{Tffd0|4&@eCXM|#*e^C-=KX9;WJEZ-CFFXrDj^KldVQ+A?R_O*F;^${ zrA55p-;l>ztEi7QHu*@5dj8&sgoFV_T8JLO&V~&iqA5NAXA=@BHSsiG6F|HZg@+kI z+SOaY2LpPLs#LZOJd4&T>-rSf9KUXE=(K3!>G%oB9gXV5yMgqaTUV5fR~E(Cdo0+^oNpHX zZJ`2fW*UQBA7%)JY_$f14w-6GIrbWOp?fto)$KeWnRyc>Dn|tbz01H?Swem5{L={uK~@kJ&!A+txO)-y>BLbz$Q`J2uB{>@ zMwX|9hPd6jb(w@)^85FqZn{U<5Ax>Ie7I-P`HNAW{&E3`MHYuV5;+Sjhj$gn+Aa9JGIav|XOsn9Zd1kymMHpgLOzN(z+( zfj>uzG9ATpxAP+VfeQG<6d?!F?k68lIYB8^lv(BNkx!^TDg&5Ab;&G!T$3gQ%1qg) zsqK0qTRl`;iDT<2y%Y;Z`o$$np=^0@TbhvL{9tpVrGhGhK`t$L#H5R?WS3S;`r7)(0x_LXM0qXPT;G3%2 zbGO_A+rE+aZ>O=9`G$8!6+51Ub;oBjA*IIK2tqDp_P#2hd4f>^uF9ANh`?o`#GTd* zs5I1pRLDWRpIHdW%Q}!c5j$~@87$$1)Pbck5>EUEIu*S>|D!T@EnQ$vTi{$~{3GUr zq*B>ebP!m%+y5Cszw6oj{Chi=k@U~;B0cSw*p*Q%XElA%{M0o@5u^w2F~fnu{^5_S zUKK&ll(ql9ZL$#V-aQLYO;=e|yf=!mJzGa>+v#7-h2xcOs0k!R$OJ-hrq@_D4G6Q?FIX)>>T%c@(Wnz%l>doN7_; z`A146ziwMpE?9^e7%!*NeDYer{}|s|`$6ht&PeIIMXA(R=YMM71|>@$`#k$&z~Onp zlDoB90`#$H=g4JN*>2|{-wA`@;NUVHap|l59C8}_;a&Fhk{VS))P$JGX5k)OaM6e` zaJU5aFiN-O`2kTf{@fj1d!P8>zK%X=l3iXRm zi|aAloHuBItis=1+kaQ^Bcvjcd-2Krhv*%~)+-;iW>}nZ_1CK%y@J&yr%R#7XOlgl z9=FU7axrGPUjZ=tIorYv1de!zZUV$Rkh~ngk9miXuLNk?ID2$ef}E=WO#1A{gmm7zZ`$(-S$np z8Vw6Q<*R~!beZ}iFVGVaAWhkX9uuFS|COxjt8v~m*P6cg^NMRi4wFPkoI9%cG6y;ic#M8Tf&zFDX9-?V&&lqt*`n}#Cz=v8 zt4>ahis~vU8NMxxa6Jcd4wHKEql{(0Y2AQ`00v2T@5)Ko_pcn8&_9kYc_}4Bd)CwN zixxv%xOS#Nd7+YPMZ{^mBQ~vEhJE!e@FDETQna1lc7Vv7r}gulP>X_Pm@y!~N`7 zWn{-LC7v(xVYu3t+-6)j4OR&0Y6MxigOhFt;}!Q8Ev1n^>S)W6CVH17oOo=GSMhu0 zdUd!E%5%EoN!`$nS;bs2d6wwJ!Fl{Xg+R%_S?!ULgK)Rxpd-nqB0fr=Vfo-5tQq~- z8G@}Y^KWTtKN&On$l$HvJM?#5Rdb%Jzrd?!s%ImNhP~%@V)f6qjr4coR#cxJPyr@> zt^7b+fd|(3b1cLyHu~fn=U&JJg#}RsN|rahf8)Du%cycA&v?PsKuew2Kzb?5q6_HY zoc{M}L^)X?3B%za5~S&kdkXYS&g_Ytggow;*@v1qi_y+1Qt)T0p!#%8-QBX&!`4^3_~CkUka}!ul&E!Ii(J{@_Lu?fysSvHa;8^xAWi{ ze2E8}vy8T=;wQ8u?C3>-SUUK^-TxqL_q+bdZqIqw^_FOnEw-aA<;=PecF`5ew(^U* zLYiW?rj6;F?F9?WdKF6aK{t7*lg@tM4mL$GJMe?ktoLp* zoV;{)bSQ^BMlC+?e*j>NDmIV;5K;0HkY~fTB23un(*OK&$Hm{r$Rm|T1QF7gAzia& zis>aJR%-j$_?rqm1S)#@_q*i}%ggt2TO!C8GIn<_-X0LFd_O$}gMTwtJvjQyfWsv3*1%M_#OSxddITyn+>!_kV+x1dPihJ>CP5rLl=)Oll z8Y8~eOB)3uq-lNml03PBoMK;4>EkyD;!RV(@QD1=|ImlJrK@GP{u}Sl2eElK>Zv{2 z3%5SvrBj#!e8Cu?4v@U3Cm+ivE7M|?06Pev4ZB)^A3st%K}efxGR*k$0n*)h5NkzurM&(|c!#4|5yIIBW4dT50`oyz_Mtiua4m3^A&SevK7tfJ zwF|^Tl=KX66(t&~KX3$tPY-g1VOFpyf9>{}OWJTy`wqFeId9NLH8f}HXr%&gMT!3G zp*lYfQ*XhEkUWVWpj71cWmI+FfU5TwYigG>bQdak6Ssi8fQkCLoR#w$mPBY&XFd1(<8~rwv%)>Ty{__h5-t6g+lqaS&JK-V@4Z#v zqXu=0g-TGXVg#(j9FuNp2?qUX%=`c0nE~T(xak_~3fRYxIqb-{Y8Y0`B6M1&l#}pb z>ax3W%TBAy@$Wt&1wH!%Kd$$8@Jr1^Pb;sSf3FVEOh(v+Z+CCmXG8FO-FyE)`|(@$ zHL40AU;6)8LE@vRY4-9R4zM&M% zFFh^@JCl~5)2*J(RWm#Q8=)VwCd<>v%gazdIk*+*(|B<>MDpPRjB+4Ub8pIms5fRw zp=pQX#wgUt!-^Pup+GTnavp^!1I}-n=+fCkQO? z{#i8M)~u4>d(SjJQI_ORlClx5n$@Y-;{-JZ6ux2qAErQZy^QI`_Jech79R?9BK{$N zoDO|%e5>v=F6erm`NO4M^^ETIm`JVHYC+Uc+Yi&gwWAvyYA5=GDy%>dPSP`2V4<}3 za8q;|70c+aYeMxz18v(1W@fM^JxUf}1_WV1X_|cPK`^;^|7Ye``9rZ+e`}}k3bY{> zvw1nfb#*0^dwG*Whtz2gn~+#JC9^Q-SYWGL+M==zjYAWi?qq+Hj!{Fr_)MKu{v1

H^JxyGA>5x5OKXuQ&u!Pk*y0;eyfplWE72T%+#DE-e~2WvN+s`H*xbo|zT-==4O z4o+l0K1FTecx5Auuke963sNML2yWDZ=`I%YjvRLn)d_eF$uz29QWMyyv-i0J_@!jC zK9FdRLLZI%bsH3(r~F>E$=yY07jNFuYYo%Nyx`r%N)5B}l15>y6D}Tm(;m3uc{YLD zLJZ`+Auj;@AKKY}mE@#)`iw7)vH;$l=kB`VaakrCSjb=MI}MN|zBqw2T@hE5^7V9b z4)0z)b%0A)-gI9~_5JP<@P{6@y^;FyU_N6tUyTEk@3pYM^z}D6$3IX}LCa(=f%xzf zYfswoZ!4?^18I|pRp*6>=UGAf4Y25sF+&vmWfB6x%WqdH>u+IUdn0C;#U^$k4hd@_ zv(tfu)2YJ3!tvvYOF#5#1oy%-*u;)!yXvQzT?k+A{?2`?=6zf=yN;VXu+i7SIW{cj zKKf8(iPXFS1w0HbeefZNnq-wR?zy|F6{cORD3tUqvv$M!gAB(eC&k`m!FN+KI;G|f zsM*JKt?z1OPEEHzDjNBKW2OnJ=CRX?5vZy5^s+fGzQHE2t#|t8e<`Ly7pDboBdJaG zd6+DlQGPf{qSI)|^f=04g|pn3|{_G7d~^k2Wgcw37-R7R#?7fMC-U0wSKm;*^hr$sS()H&%91vR&QAu-G3pp zHX47RC>wcM_$sb`d3>}wc=zY$+nK%Lr6k$P12fOXf{A-XL2$D(V`MV-xw7x`#>0Q> zmz~TtSG%I8u$S7CIpnDhT&8ec3J+<0N+D2cNZOkVYRD`@(y8xXgAgll`$hlXu>mBQJp)Y4q5$T*)nv3{-YL>P`V| z*$=3t1R4}rirk-3e@{#Wn;#jJ?3qAEIW0gVFx+(~PQ6s&z=Xw^RGs=Rf_Y6#T|-9o z$JyK04D;i=Ann#o{ky@Gmj#4S{tD$mO15f2|Lvx36L@CK&=ap+z3eK_vP7cvznKn2 zj+8AcT-?8P!_^wj?;`I-E1UBomoh`7GjwsflP4CNKIlJS{YpbZ!>z~SrMk}ZPKy?D z0~y^KpHzb@_|xWatTaFz*_K_emPM{%u;zR{nny$OZ*cY%0)1xsg-PQpV(d>vKfXI! zZ(SaHLq|Xol=gG=uH_)H$df~Ie*lre!b7d~Lt-Hl_B*A}36?*Q0`Q1Pn8W9Y^leKp zw~tf1vEkuP=_|a2i!nDxJu03}N+^srv**itR>z`pcq?kS=&Rk)&8rw!`L(BDBs$yXZ{9N86FrAF65u5oM~1bpvHrQe^PTK#+HtMRi(ah>jMYyFbOovUUy}|%b6aOHkWdy2vy z_ZSMBTOvMF?$PBS|H?94WGqdR3GuD0d=nU$D0q8-KlWRu+yqyFXv^34MT=8qMQ+r+ zu_il&xiwoBr0(8O-|;#t(CWsu@H9Fm_}lt-Nr3rnvexnnX+{s|EYS@EstG5viyHnW z1rY7J?+F5Z<@tU~#G_c%tn-QlhXn$cdI}e!M+t3!%22Qm{he*Lp*T=|IASdS>_Ubm z55^rKt*npPW!js*kA#DzVCQ3=*yGM`&J@#Ks)U9eiPeFKRJmX?r2gkKg)$gCGN`t4 z)}Fhk>G_SJ_u{A1FZexQ&Plmb*@JC+7KKiII_U$VB?~p2tPX zatt*wC>l4VX&NMmc4iNM$Sx}5^Eu-=2m9|}4wbocY6<}?UL_iXY@N{xJuA`6fBn3> z0_w&no4D73*Ir26imh)+HMq)cB(-^XjOz~8UU2}=>8M5UtcVDu>7*FEdn+d{d}oBb zot47#+4j-=s&2*3L6dsPjEgf9MT(yMY?dvWvfws9m4FvMc5KgII8Sj(x>L2&o8;A$ zf%0BkJ8NDYwz{+L{L$UX`0Ae!(eY-)cuA_^B5#x%PWJM4b!x~rDn;T+m>gFRk4dL+ zQznXsh$!^bt=dxi-|Qp~8r!O!gR?E#2ol4Wk;&}= zMf>WY)i~L15qbIAgB34IW6_oJGOI|X1N-2$SoeXjqh2~sM9|70*MM%V4_C8mF?aBn zg4Ev+`xZ%D2=DkqbN>A=nDw2xwIWp(`+5%RrF)Yi9B?87oaCmW`EjTHTq1s!>C6yg zRA2-kZw~sNTV!2c-)Ea(T!%ehiC&eJnAgquGjle{9Sc_HTJ{qPu zijbx7?jQ}J{WE}?oC5z={9Guc8EF9WEYExSF0+fm)=XrdDmh+$sIDTh2j{w&FmIP! z6kW5s5Xr=&L{pupL3#*l9hlVBk~K9Ce(i6U4-{cEaqB{RxSh9b9ME9o*t&~--A;Xy zeWjqDYZ0Sn(Au<#TIGisY+_A3I2PvTMqQL%uq*Dc0Kvi8BMyt#5Knai7& zoBKTwpb&s_AwPCzt6O8m=VA}_7N+}gz;7YjWT8$lIaN=Y2-kg}?ymvH8R&uVIRq;R z0?~2^OnIRoL5e=+!D7OzFov(rWwo}U!IeBy?hcf#m4dkJtZqF@@A$F25^*tx9_+gm z->D5*{#%GY+Is|3ekNTWYqk-2Sv%;vMK4slb3iesCzgnFa}Wz>$G;DmJa^FkuXouk zZ!7zAU5EPptve|8h&$;I`*tgIRP=}DWW)B8OgU&(&z@fsVIA;i$Pc^t7k=JkoSwca z{!o8Gl{P&_HVmumEfLCw!KX zbPA3(qT6$#Oj36g@zLtyl4g&6Kn!s50G(Qkuq`^1pain&X2(DUn*= zou!4%Zpz+d-Qh^^?&mwSRROC{Z0wJwq(tickM`Uc-cd5Da2G`qxQXT-G}P}Mpscj0 zFvZlH+rno>Y#+@YIiLC9&q3#3H5O*}VZ=|TzrPxVe(0N&gHB_mxvBL=siB^@$7W+G zbXn9$eX9C{`$M>nb*<=TLEi>qh~d9i?ACj9jIGaZ069jZpETZx%)R=vmO_2XGYHhg zkDMpg*BG@g=m6VnqkiOmD9{#b&4S7%q22B$>#KKYRvPraNZ}u^8;C&<^*-3Hb7!Ka zjG>Af#18ZR^?~h4DZMvQp!U+v&xBj%V)mefxY-hW%&S}YS&SO{I~=`w+#fb)qkct1 zOOm!*tZ6M}Qn5zaeH!?P5}O7T#}B;spTD_L*+UsvUK@?Mq}OK*l3lvJwD_jpnJOJX z8~8M_IbI6KNz@z!xz2mkb;a!`it9&O^r;lg6mvGsYLn7i_VC?Zr!Js~hWEYL6=>0~ zK{;YD3VedG+MZm**y|ozaDiY?A}T2NX~HCURiuPCockTvJR#x+1~_A{OZ|(MhSD1s zVdo=$;y;)xaK)p3LU}W;FQx7cCvl*iyfv0&r?tN$_N8~>7w3(&S0~5ArWX=+$)m>= z<$vYxSeHu>^$mcc5QUcu$k3Q{d@3p$-{1I~fLG}D+DbuFPCTVZjyzke&-zCdS<`J@ zWZG@}R(pn%!pIGj5iv@L!ONR@u3^_-ez2gYZ!ieRYv4c-5HJyc1`}^a|KFviHeZHx z*yR!zQO*zgmwJ%<2x#&Jv0R{Tsa?612wFka|HfC2C}rm4Dlvefv_h9L{Yj~^_=re? zPkR=F7`(UmK^nWb*;j5qh;I*Zn_R+^k0N*f9?vHTi2U7~FZx?^IFF}Ib*r|h^!+6X zyA<82qD5i1p^lDEl!MLP?o9cNkbCEH)o#v3-v1dQ#ZJb6r~w*`8RqQxBNPf4haF^< zM!vsHPvJOj6x@|7F35+{D!i=Y_`Ph;+xSJ~|wW1_TRI(;;kKK#q`s%ZQOcz67Kh)pX7YZ+2 zOgd2J`F?@ZFGOVEv^$un{7ao+#9ltd>?fI?IDbUd0%RE5sF-oDtDN%V4(pm! ze~EC=j?F%qBf74J$y=Q4LkqM(v>7lj45!6-ZLn|Ojkr&|;@<4ipM(#cO$xR)f55g} z+P4_MPR)%qrpkxNlrP_W`z%;G*`t~|%h1xBOgoMlfC0@LH6jxoy|pP%#dUW>zA+)OZH`d4&6 z!G7Y;yAlMpIgzHT+Q)xA_b~K?`Le@uA=|B@Pd2f{#z7i@AR@z^`@M?Ny+kpACoVpi z^~-mgVuG%J$sk@ILxDVmzU#C)_6aGI9Vi&EmL6uk$4#A}u?0^jOu2y=eEJ%=7Mf>7 z56+-o2q~O+uR=!*M#0M{(rx|E*PdPl!ib;%704>EtA`gfoNUlL1>&Gu_p@-3YEJ;| z;GLZ@=tLd&{& z*C$YD)Y@d+U18p4N)FsTOMf!H8{+~P+vUJ`A6v1@ zPx8-_>G0GB_QKlewQ+sGVZu=uY4w5~9zdd**|YbOe0=Y{Rz)ZyG?v6c0aH(2>O5LU zjeD+#e}uzB8GZ$7g`T?AwTk$x*qDcJGK}vBupiyg!6=?bDJjP>U{9*cJ)CHM9nkJd8hdN6N zKwuC{`hp-9cXQEo5+8LEXv&@M1<#*zseXyMQN($aCBjRS7zC7y=&**+WhV>fYvG;@ zFavtR5~L!PF3ijgNANi@(UWA(gK@dru$Mo>O-GX?QREh5?i|UaQo9P_@=$O@6VP_cihNU*ql6C0SH3V z`STxNudWUw(ILP4G&7bZ6DAO7EwT#-{8>PI7pT)j(*8ikJT?7VA1CGv?CD`6kPlsx zDJiZFYLS3gwVuFsY}o!--n|fd2C77*SO~=d-$Ly*qgGnANrA5@2cx*tpct7P(|E(` z^mXs(idR5zSBXZ6=_dH?1CP4~mw$Vl#6fg00fwsp`ebi^uI|~7lsX26kM}sfZ;Wul z!#mmtE$DpBXU0>0J6!zQ&q_)<*OSB}UXJ^b^f-T}vD_KhdvTgWgs8HZs)^zOgOL1KhVw8CqD?o^fE(zDCW66S!a$?LzecG)4A zGH!IbVoUESIpD-o97}4LM#c3=S< z0W}?m500B~BdB+2guv<8Y2|_g`px1Mz9JYHkhs8`x?gl(*V@G!Su#$8`dDLacA6vjD5qMm`s z`h(SoN}8v*)fw%uR^r5!gfCyw>^MLjy`8w+EC7fo3jyZa#@orm{olfJhnBWJS?G(~ zwx3Kz&|_IWsM!)rOo?qL%260b;#-<6{T6eOOO+6}{yvE$MU3XImjN#?0?$~=Igr?> z=Zf0nNJ3(|D6e0mgbvCRnyf9))^0Z~d}AcN^{m5H`5z@bc?!b3XI2x1kN+iT@uaGY zGr9cN%dt=X0B>`EjBdP#^C4Rb9Xq$EjB96qPTiWwz{z*!hzJT;I7)W$G6f~YLe3N9 z+vbY7iZ2&i6<$Ucnj(EJYFsFYd^}IHgg|kC7s%&sSZy(0V=&BxLJ=#&Kb2y;epsh7 z|MLHj`Wi78`;&E+5*#GKR)RsKX)tRH@3ZYtjA-HbeY0d+$wyhIc+o3+>d$tfUT?p$ z94C*3*%PmiWFNa_Z>>{8*U+M{jbRdbYGe6j^^b(2eEWelyvOWpV^ z@Ghetf%cabEj{b8eLVV(Ugbh8NskwkA)-k+`*#mNjd<#=b6;U>!TpWHw`Y0R`a145 z@U?MlBlu|lnIkb`FgqrG8>P>iY(Xqhx7XEJG(mL*F@`VIJm%JX3Np`oM+=4T3F?L( z$nc&pV;~CAcykfc(qPJ#NGxvS3)KPafIIWh^eK}Pwa`92JE|T*KX-%py3k$_ZwYDB z29)}5^`DFGD?JOqCvj=lp)p>v{fy`+i;bb=}wJ^ZvXCND8B-t-LG1 zsYIZN$kCib;?l2!6za`%qfQE-1OsYJZ>OdSOor(k2kI31J2>AIz`sCioR*DTRDjXr zyn{5u^6jduoiPS)fz&J;XoV4OU|*)49PWAsoEue*@v6n62zTgJ^-vCKCf6Wd zmkBo=kD7Jbshy$fpVtsI=LO1TD=BBcksDA&zhgOJe4%m63x{u)=Ywae48yOE0|kiX zOvQh=lNhz#lL3m}d2&8&h5_5^r-(~vE|@P1w}+=q<75A`&_Ld`sOoEa8$Z=fCS^x+ zYW7LL=u4+3P4n@39#J0JNc)WnALFS>e@i_fvj`lP@LcJo3}wMm={@?th0SXecI;VILmu z;5nDuqmcQ`v)(&oZ(a_*sW?{XDal_SKt&(~NW|Ye)Vh1o$LPCKLE417!l06~Uc^&9 zv6Cp%imC`3hnuD;$1`$~_$NYKWI;HNYuU_WS0t5k;5hSco9A`*?KAmtIp5q~TSQTP zPg{Gs14RP?Bw5Pgd5cy{2K+En2cQwYnam{FN~vVXy@WMn@Jd%<{}zs^bhepcQ_c+7 zabys@c*6Sjm}AKhi0U&KSR9)zg&R1|t_j#ZMrR``hoH9ftTV?UetQL{4Zek6gM(KU zC|iTox07(2+ufs|ZPgmeLn^3P}9u&>Jx9>DuS8-P)}ad}aiTmFnt8=d;E#FCj(X$#H*b^QG@V zRh^L#)`|)X?quexZ#DbX^bIacp@F+kYxm@N2(R}AzzK2hhC6HGn4pT`I|(LieJx7+ zqt>pk^hKbGJ;S_QVh@>IUB9Z?*@gr(N=_H8hn@aap!`Xz?z5{UwP!v|w-4vXyVPao zuA;)NUk#>-0(alUqs-sGbBs4f_;-K*RK7{k>_3u3rB1hO>REgeB+;WON%0s!v#0A; z#89iX8wtyXFif=J+o5_f;m5T2Ltu09Rr6egw-B*eCx)5u4gcmH!I-9OL+n0YORQIr z2CvhLB0u!yn~5{Ix<1C~Dh(1*Au+t06B;-b(jWl)SH+QpptOn}1PTL2FSCM-XN}&Z zwOQQs#>0RI!A`iNLIH`-p&=WyGnDm}$8j{^?~j3K8}W_6FC8`EGcI*iwvqx<2esZs z)9^jXz>zq*-OW!B|vvk+eFGIX=Qi3CfKhb(-x{$N2fbv4E30>Z;z*amHJKw3 zGpt|6Bi0}TL-Q-rQW3OyukXxu-on}|fTI^k+T`X-t(KSZm*^C)eJpY-A_gSDy-n!b z8LQEUDlvsHK5Jn!MMtaHMg_%Wgf3YQoQ9Irjkc1m;g@)fl66H7SKOV;7jTme9@2!7 zj(2VL>jzaTRZ|m%3hC+Tacw(`x05g1%MX2q#$oGhg>RP}{JW+&`<0D`3x;#i#qFkj zVQaL{efV+Sweyii^JYhky2L@3DH5CdZ({IjiSyJM80M5PeC_^7KSuuEe$oS)dQ55& zo?pO$i4D-gQrW>v(0wTY3(d}d2`U1&#VR7{HA?ge(d_QD>WDN27BU}vv$8@d@H=9V z5V+^LK)FDk8`=|tgPWK?+fLaVGap@?;8OJb*!x?O`zNz+et%~Cqh9Ce?yJ1OD-^zv zrBIP&eS6)%?tyLZLC*uN^mdwk|Lf59*jH*{C@_Coz3ul?m@JJnI6gfqG2=|=&5#!X z|FXh58deYcT>70CbrSs0OYiqYmRi=(P<;dfBE^j5lG5Rb)i9FEr1zph5xF%1%0%NC zm=MS-^a$4nQkD((*JqUiUVlZhl5nF+mwkmQcF6w!aB#9W!ZalM$J70GR&m(U4n%ck zR)p9yQeO}^_{L!-Xj(XIYd;lf8D8XNB=jEllfV zz9wcMH>km#c;UYu1OXAr+Iy7sSyw>Y1U5+#Fr~~n;`LkI=K~}5IAS`-94o^&-o(!KEiSvsnh9Dni<&g|52P&$%u zs>i}?|Gb|R8(X2z`tz0@d)^;60X}azV>w{1_vQ2WXud~r5qo6aEHCt5$6iW)I?pmoswtmPe=y?gFWueNA)LevT_@XLKS;+#h#SqQ2TnbiK=@4hU?a| zLXJNDkHq}0X1@5n_wL*IkI9!#ICv|)1`N@-nSw5I7&Y+H)j@UK2&NDX5 z@w7xELm-U6A4o_-03tj1M-F<{3BLh9g3j!P&FF#N{+SeEi$x7I`OCTRf2|w-(TwuG ztb~#Jf!X4dr(4Dzqx)S?{tYt3Wo3SQ4}nFd8eV$yFC$U4mUekRdEv!IDhfWldP5}t zi-L&z-<``Z<5{ECu!8fk$F(AA68}m^9+E%{V72P_;HA3M^zQ$)WeH5xYODtFQFUxLcm{cB~kkAw&h9l}zt)w_U~mB&G%r z;2TfQ2-q^i2x*2i%4C(Yn~KkhY2lkEJm$fVll%_n4zh|Ys$Wv}TYk+cTwHL`H(-Tb z?3b>}7=DsT2a3YgGT?8DzXEzkb&;H7C*1386%u2B+J=y$(CVuA4!6o$Y&)}Bo~ zm?!77&gqJikb5UdP3pnb7Gr2OLZ1bv3C+K(?B5DMK65ONL+Awl=8fOlGcC{QJwUBA zk3DTqIf%D<=)mo;u*m;AH78Ffv^~L{oJu2nvYGT|IP_0hT`SV_M6P)F*``S|A|-zO zVrA+sse=_OA8A)Ac9rY>AOj^(Zd0EYT|teGK-dw2n|alMl0XNxi}Av0dwx}wS)nw9 zfKQHb3?mc>=*B01%M~6u!mYIa-WSH{Zk@>rqWSjM|GxKcIb=p-P)1`j@K@=u2|eBEt)kxl9u55&4y`{fsewe+dNT^w(Vpyd-k`~qj3)SvtrCy zEstx5C;J@&m1gnofET7|{IHSM`@KwIYz>NIPm=@NHy?{1`_a1*-(q#ovujJ3I zwNh(^We32F2vNv@eP5z>DG#?%%@oB?>WN_X3IyNiRa|-aBh>!;|D15Y1JaYLJr9-) zxbl9Lj$X2|pn`X$g-r_CoRurEfJq5rb+1hWLPaI=^G7=LL3fQw2uDJ^<$dgGM*|Bn zj3K#e_qkJr`DeG3;TS%nht=|#aZek+SGIaCoJumQNQGnX zqAhB4E2;25MTS707>G9-qoKU)#`XxxCF{`5LSw12*m|)^-8EboA{e$stfmX?e}?-V zf$LG4p5uooOH0r$jUgVe5RP9C{HUbc^e!uI<5-S?9V(#Jl21N$AzIWN-9r!!O|3By;?W{4NCsM84hX z5Tpc~sIP~q?;K7Ys(+z5qO_I>tj_(}xDLgiFq?R791Tnis^xVwZMQLE^+h9$eY;HS zK04hy+6|GP>nA%d5*d{JB2G)5`{7$%2wKTlnW3&lYV9NN0Zv{U3#f-N^GP$kz79*a zc`x!@sBb6xe0TZzzuS93p@Q|ve*^jRxi12*ikVJL%vpFD3T&V*OyxhrexPxM6F(R1 z$%19R_UiNBM>gZJ^Iue~@RMqqD}nANgipwv{nrVHW|C?P?drN-=&@=RAX_1KpSy#t zL zVlgr%#@}DYzY(JucKljG3na7NkyUu0cj zU~g76|jYshQmEQk!1GDZJTRmj&H^8 z?-V+Qsx#I&g&993zB-0%7H-_;e4=4^(Xg-eoVK~Ue0|!TvX9_q3Ab0TBR>=y)Fgzz zl_CQDgdvE#g51H4A||0ra9*@ZWDGo4bWu%HodMNqrWM9`9(f4aU_mg=KsFow6Unn? zB_vL&r6p9~J?)6zAxzO$5Z=0Vv{QU3_xe?Q2VweKT}T7nFLmD#v8es_Xu-(0*&*r8 zouXj$0*|}s5+2e^f8F|g{3fobp{NK&HZOkPap~x?DAkSK7#T$TS0ATpq9?K1@7Rx; zd+M+xd!3y*t3D{|47Bj3^ly5_aNxzBd>3*P4aaNeMSwC?#@5?mSKEo^PuzmH&is$^ zkEVGk1`;OOaBs>d2##2Qux|e?!xC{^=(rF* zBJtT-yT+O0`9q~QB24C3NvGkYHFj=h|9?8&;?Tf>2%MV((cs_+=j5@jLx+o}$cG%7 z4T&v@Zt{iA7{Z0l*6fjHXMNEGh3V;_RfWc*q=58A7P4c7#QmiEo+u+}H&;vVymz}- z^;Y!h9C*u~=6lJouMEY!4jXQqTl3E)e>Fqnahw{peZdFV~|zMN*B#xg)~@p>Ik@re{-i-(9NL0b)KZ)W>JO0G}f8@BeB zr+WYXEeuFsmFFQZ&0k5qTg%&PiEJ1h7kJWX9j!!IrjM6-XEoE>fotCid1N^OCnoOJ z#zkf)7v>wNaCF*aytg#bOb`1n%TBVO!~7l^D1oNKfQ#Tk&AGC&kbR~-h@IM!q9t3w zF+O5bhchBuSXMI(B7PRrgeS0uITS2Xe#ePK>bKxzjiDI^J^ca7U+5hCz*vK&ZOBRA z!O8ZU-~UR^aei5Nz8z*!X!PSr3Ul6v{BM(AP#9Is%_K%7o&oTIM4j`=(7Z#F8+W7* z8ujRK-;rOeb@w&2P_zhQBwCXBB%%|E7^L1U*M65Dr3K zBOtx~+C-+O55=jy77R9a6N=G-c6|fsAcKn{7D{GMp@@)7`X0qW^w(z+zXKZv&76%h!rgjLg%6$-8OxheXq=HZN1=Jr4<~#KcO)!v6pNZ3Iw?rLlO%Q|=#g<=?UpOrK7H&FASGEXYW?oY4#4V093& za)t#wO#p>i#goLJ-3kS52?0hu>lWA1SnWVuZqPJcpqZ#3B34@Rzo|X&$3Ju6}4+}$$ z8n$JG`jMqk}=2X>3m+x z!r7d(E8tJs4d^RKr7eD!zKl_z9sTR)(_E6pU(3+Fe^wYi{krx9Z}#=X{5Bocmgyo?+Y839F@_XlfJJsdjHw@*@zlM%QGUs zL(dt4Y^1wD-owh{aQH9v-0xnRDpHf`7LfR3jhYL8%_mVq8wU#gdiH7e1_gsoSI%+3 zD^Wyn%tioIQUgLz1m)HK2j*T}I(09;;>(FQjrCjN{ev_|V|E+;8=8c2?}t`^D<_M#)*7C^9;VL(xfH~ zNZohrU%Y1_cz!>XkhGU+;ohK4y5?M*u&w!Zg)rCBjdLw~!7PhqUB$hd7!fII5{ZqG z6Os^cQ1B%lcMKO;nGdj#_v~8k(4eIss-6Rubm3bj?ja2L^WYI=KLV@OpXvOTJ@z+> zZgYgT!a}f4jw=`)c&EP?1y*q%#Fc$lCY6*=d|II%HXz&qeg-{e9u}Ilxjlp75!f;W zQNV_r$^A8O?Cj|}26SZq*IIHX@;VkAO6LmL+I+8@N#7Xqe@ID9i(&ALhn{6+??OR^ z!gvce5dS>x&3zIQ%~5!dAr-?04h1aj%K`{)o4Tb#M0zdrL5A;4a;aNtLX)L$9T&uI z?kW``y@>cMuo>+j3E7MV4c}vFi9K1q=R2?bP&NfUmMvPFyNsGtioMr6qLL)ca;f9c zUh7!h_<*UjZCoXz%7)c{vkvxxb~|I87VzS!!)Olm(kN2&-3>C2{ggc{tM&)6F|hd-#TPWsQS?80vz-`**qd(wp5 zQ|_+AbFnb5CDX|iv+Q$UP%28xXYaVDv}z~N-x*DkXxN^>9Y1I+ohe!$2*sH_3QDx* zqD9}FAb^|KrgwD~1Ke3U+?2h&@a)k8=D}B(VD`f2PbgGRMmj7sZ@hMhF2!nY+9}_w zU0fK7e@3u*B!LBE3|M4%4I>NTB!kL9fJ=>36Nf3;w>*VK0+^12-!{Pc}X#XWoi@(F4e+fLI8^&8VU4Q?o zG!_FCSs`2+U?&pr`eC&pUI-P&&A&|^b1M}L8**GrnH;(bQOP+3vqIzSvWakU4zD*9 z(@oemwJr^j$x!{Xd9a=?8h|tse+{Q7LId{#r~v%1N|o(|eRjJ1?e7VgFQQS&C{uHz z`2FnDS{1E^1l-Bd7to&%1t*k0EZZ|jb-{N#PiiDNmC+&h4zhS6UM~kBNVys&k`B;3 z7QziUaS2h5!f-4&(|5;7@sOU$qTv}LrMeM#;cA2w6jXc*H@0LTY%;ThCfv;pb*&B( zKKnpr?^$HkyZC!yd>hC(&!=0Y*)H{vsu@n|f$+$kyei34Su@=R5=>>r%^BtOM5BUT zH`g;DTu;ytDLgA+rTECLCLRx8g{X&4aQj$x6`O|Q$@i`8*MI%d8hPl_tcySaYe)nF z{|5OM7A8(ZP>AaeymH7^$$n2r(W5RVW)J>(oWU#n&x{a$kbx{KJ0VW;ofl^ywioS(HWpWzg2mVfr7x0{Nn5rLtye=MH*u;4x)( z#jp3bHk>&}2J76S?IuXKUS$RTxp(^p3xX@3W+KRt@+Z^y+|Ps&3J1ax?rX~(Pj|pUB|pUBCzwgVt%apN2q@TANwEN>0H6P(f3B!q=>1& z#qTA@>>%V0eN^7rytKc*gK>+UiClO!6*2(=@D8`}^#UxM$I#ZcoO}VYOOVo&&&6n} zBIfN^#(XzFh$FWH`9oRjGaLVZg!81n8&C(cCMsFE?Fm8Fq~9OUcL3`<(`3e5rNKL;W`TptZd$^>rE#UhW%{8XI-e!a3mO7N<|0Ez4q7~C$<}>K zZaH1h-;4Ri3Ex0Oonq&i#W>UR`A}ToI7}2@hr1E$qgxXLq+n7|MYp>U?|~Ur+3r6a!)HcyE-H*Tkr^|KbfQY zvoN*2-9P#9=J)hip-wH^7Aw$jzASPsEuVbTv0xFtSd%fOzdNYwOi)+$NAQA8t)U6V zngE(FNb`~&$Ds+D^-g^RgO?$iq5cQ9G9O0ZjPE6HoHjfv{HnL#vQx<_yq@nQj@r_s-hs6&c{iBc5-VF5_mZ` z!Hn%Y>`r6(H)UJI{^8is4if6Rj;>*fM=}rfHaAD#sz70!a!1&t@j9Gb6lKk<0r|7? zgJzV)ryuJz)lWJy5^Ua;X?9QP_mhlp^sp049cFo6@wZPAKue%3}oIa`o|rVY5F8YKlRF|UEV+{^nMrGnS;!af{8@l=1>GZ=VsbSCx%=!`D2eFBUR zC+3nGS9qyu z?*=}w!*)lb*Z*vzJ~g_-mM4>p^WoQ9KTb&( ze{+nbw|bedzQxIK9gq7+Ij6IJQLxIa1%~wqJYI5=+)BzV`+dE8yjNE?YqtBfW?@Rx zYu2!7?Sq%;+ENlKc0da15T`Ld&g_Ukf7?c4%7+!a0?Z~L=Nx~@lO$HKEb_eKkKn(( zIayg*TFSC=lx;M6h;PW;??aJ88NJLu*CCyin(mDRt+Y$Mc@&L@ z@TRqJnOzSLy=jdS287c`D<#la3jx)Eo!sw)Dc}5tU!%X*LzQCA6YPvIk*TTd)WMUf z4O$S^nNR}p4+0ucaJq2!yHGX@*n>c~)W2zswSj-3wpT6y7l`}e^9l8@$Io5Y2{@-K z#K>H~SHM`6hHI0#5yeD^q4)@Vo+`R3Ga>$$$Ko8&xO)9xiTTzotZjc)lb4_yYT&7? zb3nhb9U~TF*LJ8ERHwy@FOzrLWf>-0vEzGjRi@%R>tEmB|M*|k~Z+D>|3`wR1|4qBK!>51m!ty){j%uqi%nNww-{ zQ0{qj2+j&nFuU6lZR{nvhw& zWQq~yfmQMA&&L!!Mv7NE`jQol7Svnl*cthi{rYX1_Mk9lw7*d*-S|GUoV3xEFvTnQ z_$|N`h@hqv(r{vdLGDyEW$Wzj5W~DUKbAxg4Dg2|S59ZEz_3TDV_)cMN4G^+1a5*5glWi2350 z`%JH0`8S=+Oc`J9_9~@93b^p^ScSO>>LQbfcNF0_7U0*}{5%n&9V@nd^1Ma)1I~a` zb0h2CdspHU7>)YPFJE4aM;d)&e9;S;u>&rbA<071>K-&4d`f_WMs)YM~KY|Ye}cVY4P zxzmS(V)pkFy$Fn=_964HiwOb^zP>U-_*G( zcQYhL@GQFiAA`f z`neHf{O=0RU_*BMRJ~jE?s|XF3uhqAcHyQrF8MzQzQ1vq^DY;@<5^UwGpKKrAf;JY z4fiYm{Ap1!*w=kGObTx>5!{Z(W|*@wm852ov!AEq$EPSMu@j7A-7J_)ulLI0URg^d zB-C_?p2(u7U84n`X~U)`d90lGZ|SkwWWucj23tc9Eyo)h!#4%m4wD20@+6iyAbDAu!LVhr zMF%=kgcgZC=W&f)rR>+J!_P4Pqp}?lw}97-Z;mNTr1T%3J`U1Wi_u#JtYtR&tki~g zZna!FpNX!KNx-M0vUD9auD>gJN|<9OOhQHw>{U&<|Cxgu61Fx+q&=}vq8L!+ilkX1 zD_W_fuWz4o+Y0?JxY*64LFy+^)!j!Da14@7nw(|lC4GH=a}*b6?YT?DyueB1_Kirs z>|XfeHTK};>XFSWwv!A9y#8*{B5{`7x6((_$Yy4!8~` z*df=WiBnQkAFRgj<=+mA?*pQDd2zQ+X2&-L8Uruy3&S*rmr_kR?;5|jEB*We2HEaY zW8z;iBN?ak0p(syx6bVP1;peOc7D`2VipD(=RK99=_{~AyCfjorvAsvqr#H+fk%NA zC+Dk`v*&?M^4W$_Y^im(q!({K$VO%hw1FDNj5V0=tiU7$4d~lmPNe5<&dwx4i4N0m z9pdX6*4jfP52bv|$O9|0DwOh>^tGY=en7dAQ@|-R3-Qi3{yVpD*Slf(*W2k+ny=H? zn~X-Xn5>ad2Zli_Ekdd_7qKZc(J_okq+rfoOjtpm4pS>Fd6(;|qF*BqrS2Srw8rg4 zsZ9_`B^&5m+PTl71dRonH(MAoT!9ZTU;rDivpT??^`7`&R#3uWDj|_hp5}p87Kbt2 zoJ?@R*DR{YAP)rz-xAhuF%w#<8!WG?FalMJeZgjRq@JqsAHnx+?-Zq{)-KxSTP1fh zu9e6-xb-~vRCw)XEPU|CviL1j@$-xNSIZ~6+wCGlnmZcb+<^0cV9taJtShY{j+-KF zqDE7nLofB7o4U94xS=$1C|N|KtD-x(B2Thk6LTGOhNJMu6eTx6Xjd0XLX6Rqf~XNg zw0NWtbX&Cm=EB>QNUJg8FIf;mL3j;1CE9B9V*Gx-I|q zOEOztk!_JpvJc->0J_BbE$h3-KB^JRpxwzRu ztSUjkVp79~$F^A?>LQ?udP%?cSZ5jwPo^D=ReLc+c$O#&M;)irDQPuNh3mr^lIf&A z8EBY>IzvfO$rUB~26h(}WJ->6vqyrBK_oRSLz07uOFuU+06*=>sg3_UTs!$5;v#h~ z<8!9-dkINP348?L6>{k1hjIBS18G)3crqkMjT}RRBE*;yY>j43;|eXQEA+T+vP5sw!Cw+guJT@#l&s1Vw?zaSL zb4A{(z++4#Ei$=|c<-W!1pbx$^-EB+9E}TAfYGMYE?4us=E4W-#?mU5$#WWEY4&t} z+p$mrJ=gB_#f@Q!GXo{;iZpOynEJ^GRmjWk9L6qNYiU!%TdB zw#eicw<;U<9r{1WV?x8U@%=qp;|-X+1M4b#nG$mcZp;oSXMzy9n83Dr->$ma-qfMV zySRocRG7a1L0*gi(_iTFBllE~*3Y2zQ-PZad6`;I$FH@Qi`Q+cE2J+fF>yIK{tJ86 zSDhB|(}@MSem{sAR}?nG46FLJXrVl65{+d;jcKNOyv-)uwQg`uT%$NjhsCsAjl*Ki zO^p9qUkoxa5ZU8lG{Bg5cm67s|922+p*AseOB-ULgRSW}<#oxxWiwa!e(8}- ze4MV*qx<>JLq57PBE$5xuiq?)p+7M#+1a*2TI5Cz2F}`7Q`wvK40(~!R$Xdq5u1&1 zJ_4aC5!~A9nC@C*P7^7-mp~7t=(iEx)o3&t8O`%lYk+50;P$86E@<$}MomS1g8?Y^ zn^=Ug&8rmSiC45uoSYyZ@p`kl`k)oe0BEd=95{Y->ZaG1Q!hPCNlK{)5bR7_PJ*|z zHgHldWb}Fc;>E2m11`Zpyw?57F8U2?p8Jo-X&$3HU+_E>Llu>h*Up<8OA^yc5F){u zYpC&jw;$te@+JKg3{9CBSL&#aGJ$I(>#6z6-IENtD|9l^xGU6A#P*Cb$?8=7tK~P= zewz6-(7}{+mW3=Y6GIPV2_s3RIU#x&`B44%Eb91i z)M{;_D}yN4S-S3BG%;&Zvv~C_K1I~`ar7MNAcn%vPhzq8jP7#zr%XxJy{2pQRiX$+<96p^_p#HGl4pw^{f4SNG za{9wzAD_n!YD36_UoAn|;)R1YYDD!IdNLW}@D_^lhX^uLhxWw*;om?wGz(ciSX~*)1WPrmPr-xhUDHglwA^i?4N2CUQJAcM`iI@E0Gn z_y#$SEz{H7gmkKWuz2`ne(UXBb+Xl?NIr@hNtPDBC3*XmBWqqMqf{p?VGnEXLsteT zjJz2bub%n;Yeps={g+Wq+(?AF_}DO9!$<87XhJydN_73lkLhnQzZ!Xm1eYJ``{8F) z6&(}A_?!NWFy-{(C8$>bWxXASX~f}#?Zy9w4$0-|Lh8@ex96nR^FIyr;NL#IhOA6} z`{?h9KF`n(dQ~C34gSz=fo1F@iG~eip`h}FQOU-JH^712>(FYWdAc;g3W4{YtgYFL zD=2n52&LC2gsv2wep#zp_%E9$Wkr{P5W$8K&Jc%?zTnnq;RA#_FrlzyG&|hm{I(Ws z$`pDAJpPfEMbcGFrV4?GF$DF0w^ls1qcj_;E_`T*^=RG{b}x6*+Qyc5GX#a+wLBH; zGl-bRE;H}iJq??iugqXXQBnp4S_EF>CK-|+heRtmNYRBrN$O3yFg(qnbvvYF8fK}$ zJ9E6ZHC&;vPd=N?N+5Gr0vZ}HR*U@dD1|#_OK|1AK<*!Y|9^F+h`0Wamu=WKelw(k z&O4odga2GdlUqhy`uXP6v%6e&H@aW?HWZxySsum(48Y{t;t0D7qobeNoA%*Qr~GlP z_dHq>m)p^83)CU04-V3yo(VMJAO;yGK|Wm&P~AG_c4C`{=3OE_>;#9Kx$mHuhN{qo zwQ=Ug-zRZihTz0CmnyQ=`;mEQ8d;V-cem#g4EQSLoHIzKAv?0Xm$Vvi30 zFU;WFP#>d_^{pCYgE}No)cK?SiC%ZK$OVIU_9G5z8v4~x&}$zX`IDnfJr&UZv@3A) zLii$u@M9qkWY5r?kGNN>2h{QuLXaqXDJdyj=d&@LZa@9aZ)3a7gFc)|eHDZM@{bT} zmv{9p^T3&xpfFGclK@+W>STi^Ye=@lgL$+zRW6kGe(tFt zROBeqwYI1GuKbJLIrX<9-A^v_UI)x65X}9?>*n3UZtsgkwUn>R#$2}lIPmhUMQ+NR zLVxv2c+Zbh9q+Kdznrf&5B|$wZf=x4bffAaN#j)%5!&Q%I{XBVa&Yjdv9YGSJl_4C z@BVRmdSARGoxeC8K9I1)Em$e(`F;I4lj~e!PwqJgkz{{)>Tu1z zOOz^RtqrBbMQQ7sUM?JqJp3=9Jzg5>pgMrvfSkFmF`RU$HZRpR6S=`;;u&zZgW&Q$mt~LkBK?Ha8Uy zJ5C0X!8MxR3#WYzAp(w#mg4URb;=eN+9m>YcM+;{Zul?L*vXY2Pr0%-Isfok4maMS zlzx_=3M`Z6WvClfZM<+vXrTz^Mc@zkQ@g+D6-<~6Q`NXe_l&9`y?@+vZx$k0CjH^1 zXR+yL`a7&{a z7MEyGAESbzyt0BY`KERE@ogFixy{)RCS+iCLYOfxonUD+evpoX?jamdZakJZ$S&I9;z)O0f>FF&R0v#rjQjI&L&L+ytChi0yc|j>j zAc1PhVBtHbET|LaE89`e6}2A=XAaeQP^84zpDyo&SVf)7 zHoQGivZyFAGl2c?V8@3s?IomkAL!{m2N&lJdL$V(OKHD%b+;NY zOu0eX8T-eev%=yG7mJ}NqB@@m8)d*t_nG11;uE!iydv84$5|Fk1SJ+#rz&ommoTMF zA+uqHBSS$2?S|<8lAVO*vmS{yA+eI8=F(Of$Aro=c)#Noz7}Z5Gdq$GiefR!+#A}z zgv0((SESrP3U3zOgZ!b)n-@};4?EsLZ?pr%q==j-lh@&RMBv>F`dK^OKshTsO9y4- z&0KNm>9GC(Tks6PWdL0MRS65_AOzzNq9G8km&Ri-Q!_%_fy=tRkH(`W@aXHa+vZiS zS37o8kB3VC?Av%UB)>Uzd}vyhaLVwHFS17Ct@2pUpZVqpbTYjuJ`ZJ(uqgLE099|D zpqhUF8#LicV+J*xh5_@c+o}H!#Z_jXzVs9|3uYmvI?1ydM9I*vvE+*9Oh}M~e5<6@ z%6hGBVc-o5gTpY4S5@($1bbxlna+*0nBy7K_+*e)#a`WB$Zxn9;L;ED0{+ zyGRuh3w^WbEZ8AW$=GWw&EP+|Od*-S(TQ?q9L~I`2;`uW75k0?VmM2F z%BKN2j|thbN6a0kC}?a7Ng$CTNNQY(r<@<{N3iQzvI{S}!SAA+ue)$_Jx;+A4E%sVO2^r0Des zN2*HeXQ73N9`x#vGJE~y}I2S z>K}Z!cBx%G6r)Bi7~>%h6ube3keFPRC0^D_q?wl3(H_epWp8*m_cXoF?!u=RhGO{Htp875OdL_WB6r@z{@8b-`|sz`xkmZ79`-RAlYfLD$$Svif8gTc^4`?WF0Xb6RK z@-Y1ZMCujcrr?<~9Uk-qc03o+N)zJi(YYp3{ltV_8Wm3IIo>Pa3_Tqmzggt_XP;Uq z+`YT7LVxn~kFkfz8k-Hw%R!7Ebite`xjhXpF8wS!^F@o!R;VIO%P>ZAXhIM&0^dJd zWzFbG!@9YITJ zdT7;??&moSgr}FOJt=d4r~0GzhkR%Fp1E-0R#uEGYdOjPse-{ zc`X;J0+KjO%zVIGaw$C>qnURvI^JpAh$%ar>0a(%+)__L%o;PuRwyAi>%USLYIg0j z4<|!sp{QnQOe(qaxI~F;O5W_NmFc^bND;4~6!zc97eNriP!H)4mq7}amk>OF_CCu3 zt;sXWw{i-UK)F!0PFYzQyTi|SD7!2aT3?(f54B2tbWIv--9AVTXw${%T0u7$GU*( zDm87u4d^`W!9+5go2_3vl~US4>W=Mhhuim))20r`-T%6T^fpiL_$2!GO3lSn?806`0Nf)^_*&U#=nC8Ap z9A#MO7O_+5NGaM3e)iEH4-8J&W*#dhm~p(KZ~jZq-ws9|vRW%6)Seft3^jhGO6LIbaBDK8+gAKGq!hUPv4+LF7hR~;?Djw~0BM3ZpjH5Bn;Y|?Dj zj$5o1a+4KLkB){oMmom`1E|}7F%lhEQEq@8umZiLQdf|dOMXUoGC3k5r>c4S%C`Kz za`x^cOYE(ygO6uh3M`b%Kl{{cza9n7s%!OGJXx_D4Y%46Y_DQtr4V%EL6zx0X%U|8 zs-?1wMGXP@MK<07ss9euDWawgSMSt)Hz+*LI9N{e*4onbx_70 z%&yrC0BcYNwV!X(3(H>$=6?$5^w%6Fm;+b9Qcy?sU7m!^qU)GjbQshJ8!T$6SYeW~ z?AOrHfIEkuVncun(#w*FZrOUoc7|E$x`ml-u?|BxK2xLeuhxDdE$77=n`9Z4QB}_L zBQoQ^SsRBur+Ru9Nbw8Jc<1{*&-7EGANRhvBQ`S*rQdCHR9rneWOW9MfdUiT8=i;! zJ-RS0rHvT3HDAA}&%V)X1JVX1gM{hd(A9>|)jRQ-5`zuZ-mjsfSoqI9tU4VRkR|)L z6`_t2PQl=U@d(J1bZ-H4 znWsv{%y*{-!|Clg^_OO}p21X}OEK9$lVpj;y^k#Q*x_RyD*nr?z0Y#vi!dsSNg~UT z(yc&Ct1MRe!yqmZ_lo2^Pv#|wh-NVS11h`_QiZaQEg5DPF3zpNbQ(n$iPMj2aJbI<9aQ9} zVe^CBp%c<%KbXD!dqawl@^@R=PeD)Ehg0nUfG#y{#O#98|5n$@ivZ5Vx7ig+P7Ahw zpKS>3ax=4}qnYJ&3J7r(9*nGqbC75YTfu9dJhVg%+7a;Q;k>W3|06~RtOs~C6_>}} z3*HfTeo4b|HCFY0e_5Ca>qm^x3qyl`TO-+@Yo+CrLxQ09ja}sCYoUH%0EIL9Po)j+ zjCsN)1A1cI6_+4v#4ZNx9?VVv4)XG7RQTpH0;}M^InXh5&B#XhuJujzoP5J`bONN^~e7+t3=_FSY4y|@fS5RF`Ne_zui zul48gfYe|aAc}F=1dA(pq%6(G5hUeEr-O0a%@A@HxOT@XyFk=Y4_qyUX@(?uy6)zS z3V(|vx`4w7ujzKF($Qb*$-3n92e3+MWZ&oD{izP-0#0< zajuQ1e1)|L*!u+!nBZIwDb@PUwIWyde0A+DU#l&JC9$ae(c0DtJZHq`XQ|%A$#_0p z)}xm60=55`MKI}qzId}UgPK30*=k1?d;i212P$jBtq|K(E*Mn#V256<_*CtFXl}Ii z$%>6nUJ|4t7x`@<$QVHLs+Dv*e^X(n(4OisSX1T0s3QP#W0Rr_PZ-7PmmS5R0@}po z91}X7MThH14?qbqKNTnY=-W~4LizJFXO`b%gehJ7YzBe6KEDNsh9kSbU5&G*-BzL` zaz*QN+oV1unj>-3ihhaa!#Q_A%1Ieh3bP8WcUgjNJ}fr62;PVnVB94NxqHA&c~$D{ zc)tS$MW3^>a{txZKUaLXKad!uP#<9-qwom&Dw9##uw+o7*hx)Y=y*-Y4@XbgLNjYG zww#nSVWi|qprbs8`AvF}KFwK!&){Dl(~Rtf=mIbaKlitK3jtj&fLVhe!Se{jO|3(` zsgy#}=OI6Ad@v;6+JK*29}|k1k^1Q=L@VrVN)$2z4*Eg6_XgVD((!`C(lpIL^JY{1 z8xZlNPPO;(nlp7Zz^1YO4!?czdA@^`eh%x&g=)4Qg&k4;?0eE-%Gd0ad0?;OCRRpB zvM8La7N9qgeN^Q;bi)1LUBBwyVru)V?~bJO;Jhaafj?Y8??$Vfo^?%~F2tZSvvv(! zexFJLlGUbPiGWbnPp3=O)xw5Goj|EFM(Cl9{EVm*#wR-&YL5Hrq6RS&cMQV$axslM z89ao4kKLsVqL800BRNCrrTTPKI=-I1UZ8VC-J6lsQVlYn=BD!5#sO2%I~P8#Pvwf- z+D4M%=x~pDXiS*AxoYa{-e?^>x}(h3y!dbqWDaTbc(w1asw}WxZ#ZB9Xn=n&j8e_N z0TzpE{+(ac#s@#G>bYFqlHra=t5M>{$u-z)7QYzSYf@MGPb7|kYU(y?_aotVd`kwx znApuMcA*RI-PtYtsJ8F55=cjuT0mk1kWmE&fzz-sdW`t&#-!E7L7QS0C9Pye_UC0& zaa<|FaaL(fby>C66*wEU&<@mU5mRttmf~@`N*rZByv8(#_4YR=8IIfZyH5y}s;;$O z1NYPKi%25IPnfhUeoXPbd6ekJr3krq@KH8!A{%aQ5_BY>Rr+<`oofKPfae`cshJQg zp{b^c(3{+0*S#QzXn7{7I-R+gIxWPM^n@B%nP{bcpBR}+iZWd=+R0Sg=|Im_rH8Z_ z+OX8Gzy_?nma1z`APJaexZX1pz;ofjx<^1EODrQ*2tzB+JyX;6#pqc}LCbb85QVhD z&uf=;nz#36A8JIk;S;BMoPlpIzwn%-lP4NmZv@Em&X|=xbdWm!{K@;S-~Cr!u4~^q ze1t)riJzAr7B#CkHQlnnOhjS*e+w6@6Ff|5dlW`S^N1-!-#aK@{=h#et5 zPQzZ1o^p;)7$TsMboyJf?J9Is264O>{_TsuvX+)MLglgK&bxH8bVdfdzm<}-aUQ~L zk8^Ha-WGJNn_GR6mWQ-&*`4~I&oChL2AVI=KKsNjjDV!YN-zj)!XiEWoff;gf{M}o+B>O*zDjP8HnxG`e%4}Q^XrDBKe>UbtXwSWjGrlU_ z608W!!)#x6v*jL;Bco0loqo1s>Q-64pGdFHCE&W)IpLZzv4V`O9UJUD!z#kh!4l8& ztr5>8=+f^=$t$4fII9;N^F;+b0&q_3Z2n@<242N&d12vaPNbkG#Jmp?l(eeoX4#Tk zst@IdeqfYV8{<$xsFRFlO0V66!yXVigPjfHx?!B!|j1E_X2~!HUaWJ31BKBBU0iNt5 z4T8}Uww`&q477WP*$*7!;i#p-$x}GZzGQj%F?$n+h_N@v=+k^#hs`SEY(41 z7nR(hQ`5fSHzB4ki;)@xmTq|WJ221uTiEOv=5R zCKbdA#8cs;Mr9zxl~!@ehx-N^1n4fZWp@sR{Ad}O8Nw}%kuv4Q4E&c&&Io|I# zJ2}vSxmA9ZUS%?2JJcsK6(SALzY?B3s+j^l6(zp%%H3d$P@PchVa@aW9hzPj;~52q zuAM`?6l@;s#X6Nu6&XKOt{WNd*MbrkPFrn~9O=wRcfpP>lrojjs88YOC=M9KxNiUL zhr`29;u|h^MRm#SXX01@C)#CMB$=Ef-BxY7xVfdxp$?^9$GD_kopTp_iNSru*w`Hz zYcY%<=cOK3;=c#h-Lw61O^$^Av1R!j_;FddhfE<1uBfJZ_bq(?!RuuS^4a|96=BZu z_?gA`I0RTS=f`bhpX&TJ_As|b6aI`Bv_d~<<^DX7g|fUDk8@|^Pcm1hM}>*N1r)k^ zFT(EBSR~FkYQh{CZ^k9Ks~^7)LO-yoZ$28W8C+SKGT*QYT|o_9JDxsRV5}cdd5X(N z8IzsATE?+v!Udu;oQsRPoZG^6zL1D7D#p&2H*XZo{j3~K2OeKZ>{-F?HLVN8Q>L3V z%%6b+DtM0PpHIr;i##C;+x8i+pM^C6ms>f?O6o1be}Lj1tGmY3qnBCkvF{L}(RT`8_2 z8GEFz`M27YX_h}oml>5KkZSMC`H zyni2IxQ1$kpY9*7S|6@%{<0R~!A529B~2wo+=qv)KhcfI(AOym|-Q9F8#2p9J>*(!5{xrUWF{hP@ps)e_{ZUAHvJKV;S z*HJzN!Y!DfDz2c!B$jsZ1v+AmG|#Ih&=ecS6n-Cy*+E5O_K}XKc>v#%nBp~sB945m zh3`4opiP)%043I;r=Wt);M67B?!RBHb-=tCD=D6iGNgODpMh40SMa^j_PbKAa`{?w z^vd80`pgbVS$*|H~(~wBd=HGx2I2vzD9=#=EeFH~(aTkfmH~t#&dP1tK+4 zl&{UfW9_1j=>H=i;~!e~4PUaz@kU(H5c zkvK_kqq(Qdwo9hGZBAj>LFk;Vz!~rqGTQ#byBv=16oR?Jon^(WXcgUngLlOGEnUkpk zyg?#yQh91Pyya+|CXfWv*KI34E;(|0DJXAMw#;{1%SnIz9ft z#vD%l;B}%p=nHh%8_MW!nJ>? znbp!6$ADvOx*gGH8VNXpyHL@GcqBb!cXR&NkTFNP0xWaBsBTPI`b5Z(aBUy>nD<&f zS5Wg>#2MVL^(5Ht{ngv+sUvwj4y0e;A_DsDX`#y6`I~=com+UjgYdX*$`|UMA9QA) z3?6YH9su_^^pfVfu}mXZI(dLyP&`Mv6Mcj%jvE=pv`*PNI=0j!2TlIXF=`Qe+p!4G zhhe6Nt~GCf6%c$eba9!wAI^&RJ>^-ofME{KRC4=t`(c5FLcwIMBOG|$&S{KxQd!MGtivT46>wesuBuY1B>Na~kO!036_$J(6N zM@oR!IdW#{^|2Az9B!4 z?qq(WYGr4r%J^tV)_-8=sY|8Ze(|TuweerHJeh~rhK@*C(z{v2`ZHrGG%e$w=loZw z1Ny$C%iUaU6>giG^1s6x6-nUt0k)@Yt~e86CMmH0>Mhe+E63Sow_m=v3E3r?6G{SK z@dTN)zh$%OD&3*<-)VJ^JfWUT(;sEQTa98vO;Z{2N5&0#m`XXl$ERT2Nm?{^7EzzD zif& zVkNcRo9nHmmtgYtY_iv6Z186Axr)MQ%ejJ{grBb;_WE`BBaA}E(v5kaZZnJq4dVvb z+5u5TZKmdkLZL{f7gLEFcYr>6wSbb$tPj*oxA)4*9k^{$iI?5=co@4Gwh1wNS~rQW zCGRO{&|pBAX&fy@R{WO0&n*ERs3NUdkzMR%zQ^So<(rq?Y+T!8OamyJ5;RRmCd&_8 z9zQk-CaZU&hVE^j)@-ZqFD-n}Y?axWHZ4`YnM@a(E|7c-QpO^+;F%x|7S;B_?t3b- zD8_K;fdvs6eKfwf*uS8*a-L^Lc8AD=&EB5U@7&00!#O9svZ5XDbwN`bIW>FFc*V1n zP`gP;nIm{GuVC-QJ_7A$HSx&o=@|Ze-Kv8Z^c*cq#&Ntrc;j3M*~%sI!+}QKVR9V# z*9>g&{E9J)QYk&f{B}T-*0J^}pkK$d^_0>Eu{b+;zESnxph6v7Gd#MWPn|581LyOn zRixf(wV(Nygm?$Yo`{@|3fK)*Mg(x)NGrNa?+Em4FqOr3ORpA86<)>b4kKyYbl212 z??KglZ+@*|b4~u3{{w^`6FhhDAQzwU?i21#aCz;CiBe*SE?Sf#;~HQPcj6|C7R*M1=JfjeG55(NML_S61*Q{5 z-jy#CdP3RlJ(y(q;&2Iynm(2sQvEA<_sA`s;*-@U{^}j~pYcsn7R-!$m*)|3p&;)v z3bKkXB%EHfY$&v~;Yy=d7PjQE`bYb%&!QUP_brO%UECYx)1h(U2GU_K34cm0$Xe4# zF97kttUA&l3{Qo0Pv(+fUvx?4yNBz?{(q8u(7wLQ5eMVO6S^*YtqylD2aZRh9T{dv zbyFKKG>*)*rile^piF4KPSkoS2aVPM!gN7j=04&yZ>j}!)1KnyIRrhv(5IZv$@>vQ zUtEeYyU|skL9HWncm*eL25W7Nh>1r#`7ZC36LPlu1|^{9Z&lD0$@&=Ga~2Q4pP__( zLa|o3L4kTowVwyTlZp$P+zgU%%|QaN+8|VI6>$Cz^Wy-!um&C8hu?%MFV!kA&aQ3> zA{#}Rt}Lw|faETK;_v6Xz4*D0eqM&wn1pTm^1NOuiFoI~GRWh)j1RK+h%#Fgmnyjm z5Y-XO_gnJ~T)%1ZS-nc|hm&s1u288{#A6RGo>3S1Wz6>a#Q$Y05vM0(>uwpEzCJ@$r%A~KT@ zf`GdL)h;M}?8%2}MnsAbM)P=Mjjw^t>>RtjU#m@8>86kr$K)`VH&5?q`&UHsEFJb#X@s=|seD9U&|(FAZsr-hc4;%o!u zOdV$RWwe!$>J6}~$sjMiid>8maA}A|u;3Vlz@~1KX9nHk_%W@==tnfP|HwDOhXh%G zBo|1}sh+;99Y+0m_^JnXvGM3gawrduCWSHrcL$snVMlQ7NZ%M1unEgRpxhpV*r}Q7 zXY+2rHl@XDn!msen3t_D*#sVSrD&g1a9jvH@P~}ubai!r)l>dk#NJL1`ttJleUd+Y zzQbkC*GKf`O{T2q2+b@A ztLG7%JHFe*Ga(Q^!J7}>QzLaK`@}G+_s|)3*aBPRw4Qxfr4xP+nC)aaV_`mBuTnUK z6|sufpB?V+H!UrB=7UtI84%?&T#>{+X5@j=_r+*qYs}37Ts1MkTafR?_BHj1#*0Mo z^!N9lX9n}+YyH=*p>{4HPj^!b_>{5s?Io7PzQ=og3mLNVh2;3Valq<^ZMrDiBv)$0 zOGTK{L#ADj&fAbA2TaLF%tV7MMuZbAaYf}F}uhnZ_Ow~jplPJS7Wo8I)hwEi%2Ce-O`RHYiAW?yn}Y5o}VEjR@LtiU`%_wG)wDBepAO>8tam6hfWDm zKw4&L?amXdaDBG4ja2;)L6~mKNy`|0_ap8z&!$%z*+;S1Qc$6jzH zO@OC{Qu{Y#hk-0#U0mc;TJ?3q&v*w_of{E$&u9y9lw*>hBPu>Xjr-!!3`b$jK*T{-T4)*Xr zct_i#5n{g(_w1N37h;)TWSC; zMW5H7Pr(-Thprxe3=Cc<67SK+e(>cI>?H)|(e`GdM>6}0^PL7935 z>sj&D6_8?5Of^9FJ}E0@)c9AxgRC*ng7sWIf|aWcK$Iv~vSzab`T(=cwoOX2nspwS zrUxoyE`(9-)$!J8^=tpZbQ^rr!H*k1WG1CM-^jy}+@RCK>m&-&lD z#nky=s8elUQg&EKAe+vN50LcqHg`T1sS&*3UHZ`e;22#$BNJ!sP2a!_O zc$LsQrf)M*Z0kOIV4fH3-2qCePI|ZFx3VJm)50S-3r`XQ>j#5%`<=ep7WV<(3sy%U zE-|EL9yfOl*Y&Q6oi2_=f0lBYbVX1xZc?}EyxgQPFg;NXB--*maLg~968?+{d?a(6 zIQ=&|yo$AXAbyMiA~)$(Uvv2u``K&j)~Bv4{<`!n+U*aLO|9HDnbI|Nw2r)*vZ-?a zq+Y5KO|;Ig4(n69rOBpk>#7xhOc=Z}tgqqEKMosy{T%CLl=A#i(B8^sPeJdUPcW5S zckupV9v)=P1 z=6whFKm=s`6Yr9NmvX5*+)>k-8GjJetou;#oz2lTHy#Uv ztnikto~^zcfyO;F7&bHYIIq449ijERrpn$D9VeaYSMg6Z=f=yu~t9riyW8s z0cgbMFuA^!@h83?S)SuT%QxB=JYK;(_`PrV=j~F!b=bk)e(O_Aw^n7uB{?9Azllb8 zlN7oIy(uI7wtB3pkCi3+!Xwu9y!ObjHsSpECygg+gLHl@>$m*vYs=Jo2M0rHQ+4h? z9VV}*{`{M^p8EZJ8l`@6{AB%pz@q(?SSE=0ILI*d7-TDl*T`X_B@1rku1{>7e;%eFq#e<_fV`5&PL=u} zfhw0b*M`5)bC`Xk5h-}AlU_-wZj`(J402409@8~2oO?31=y9!MGixyL(iQfl6#r*5 zuBU)+z>9+$hi&8y7`mZ3w@Ajkd9rHoZeyzbSNV>pH+AmiZi=AK5w>GQSvUEy^zKYh9xL zcgnl$XzgjiXCY1hE6YHFv6@20-o8j_VkV~iIaLz;IQ37uEXnCj3vdxzalr|FA(HO> zeM!o|GGs4sD^8eFv!;*MNf4qZbUOreWGb6gK>i9m7OZA|1Lsv}`ol6#gJdYD&hD9; zlaLsqQL{J6iTOq4xSJMTr_z1;b$Nq=7GzT7IQBv7)3ZzYUyP{FMLMcfO@zcc6wmeC z3%(SBO2=~-5Qf}yb4R9lJK;5#M_5ky#BP1_=8JJ$9Lc^{|b_hs+Sgr_!xLVB-jS+n^{)@U82!bD7;eE34LajW{Nf&rv z+gIZP(T2z-e?I{NwvDQeyQ4NJUlq3<*%cB;|d9oN(s zq;@vEPqnzxvve%oQSym{m|yK4_ur5rj4Nkr?Q<&+W5w3rB${QL(UAS==zZu|4E&{F zUnw=RJhCFuU#Xw&V__=TZS}gq;S**{rVd$-{6+bs+%vCT-uEX3+GT{($#+}Z^m!NE z6W8?{b2W7$-KQrDnr<#u)J%9cMp4eVmma49_PRU^y&m#K z@jmw}vQh`je?#Lx7=wtvw;Lul4HqM1pFW`i+pBx1GviEYuG7^4nHDjkhZkrW __defProp(target, "name", { value, configurable: true }); -import { bG as BaseStyle, bX as script$5, o as openBlock, f as createElementBlock, at as mergeProps, m as createBaseVNode, bH as script$6, cF as script$7, cG as script$8, cl as script$9, bO as Ripple, r as resolveDirective, y as createBlock, C as resolveDynamicComponent, F as Fragment, E as toDisplayString, cx as normalizeProps, i as withDirectives, B as createCommentVNode, dg as ToastEventBus, bZ as ZIndex, ci as isEmpty, c8 as setAttribute, ca as script$a, bR as resolveComponent, z as withCtx, k as createVNode, dh as TransitionGroup, D as renderList } from "./index-Bv0b06LE.js"; -function _typeof$2(o) { - "@babel/helpers - typeof"; - return _typeof$2 = "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$2(o); -} -__name(_typeof$2, "_typeof$2"); -function _defineProperty$2(e, r, t) { - return (r = _toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; -} -__name(_defineProperty$2, "_defineProperty$2"); -function _toPropertyKey$2(t) { - var i = _toPrimitive$2(t, "string"); - return "symbol" == _typeof$2(i) ? i : i + ""; -} -__name(_toPropertyKey$2, "_toPropertyKey$2"); -function _toPrimitive$2(t, r) { - if ("object" != _typeof$2(t) || !t) return t; - var e = t[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t, r || "default"); - if ("object" != _typeof$2(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t); -} -__name(_toPrimitive$2, "_toPrimitive$2"); -var theme = /* @__PURE__ */ __name(function theme2(_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-close-button:dir(rtl) {\n margin: -25% 0 0 auto;\n left: -25%;\n right: auto;\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"); -var inlineStyles = { - root: /* @__PURE__ */ __name(function root(_ref2) { - var position = _ref2.position; - return { - position: "fixed", - top: position === "top-right" || position === "top-left" || position === "top-center" ? "20px" : position === "center" ? "50%" : null, - right: (position === "top-right" || position === "bottom-right") && "20px", - bottom: (position === "bottom-left" || position === "bottom-right" || position === "bottom-center") && "20px", - left: position === "top-left" || position === "bottom-left" ? "20px" : position === "center" || position === "top-center" || position === "bottom-center" ? "50%" : null - }; - }, "root") -}; -var classes = { - root: /* @__PURE__ */ __name(function root2(_ref3) { - var props = _ref3.props; - return ["p-toast p-component p-toast-" + props.position]; - }, "root"), - message: /* @__PURE__ */ __name(function message(_ref4) { - var props = _ref4.props; - return ["p-toast-message", { - "p-toast-message-info": props.message.severity === "info" || props.message.severity === void 0, - "p-toast-message-warn": props.message.severity === "warn", - "p-toast-message-error": props.message.severity === "error", - "p-toast-message-success": props.message.severity === "success", - "p-toast-message-secondary": props.message.severity === "secondary", - "p-toast-message-contrast": props.message.severity === "contrast" - }]; - }, "message"), - messageContent: "p-toast-message-content", - messageIcon: /* @__PURE__ */ __name(function messageIcon(_ref5) { - var props = _ref5.props; - return ["p-toast-message-icon", _defineProperty$2(_defineProperty$2(_defineProperty$2(_defineProperty$2({}, props.infoIcon, props.message.severity === "info"), props.warnIcon, props.message.severity === "warn"), props.errorIcon, props.message.severity === "error"), props.successIcon, props.message.severity === "success")]; - }, "messageIcon"), - messageText: "p-toast-message-text", - summary: "p-toast-summary", - detail: "p-toast-detail", - closeButton: "p-toast-close-button", - closeIcon: "p-toast-close-icon" -}; -var ToastStyle = BaseStyle.extend({ - name: "toast", - theme, - classes, - inlineStyles -}); -var script$4 = { - name: "ExclamationTriangleIcon", - "extends": script$5 -}; -function render$3(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - 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", - fill: "currentColor" - }, null, -1), createBaseVNode("path", { - 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", - fill: "currentColor" - }, null, -1), createBaseVNode("path", { - 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", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$3, "render$3"); -script$4.render = render$3; -var script$3 = { - name: "InfoCircleIcon", - "extends": script$5 -}; -function render$2(_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()), _cache[0] || (_cache[0] = [createBaseVNode("path", { - "fill-rule": "evenodd", - "clip-rule": "evenodd", - 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", - fill: "currentColor" - }, null, -1)]), 16); -} -__name(render$2, "render$2"); -script$3.render = render$2; -var script$2 = { - name: "BaseToast", - "extends": script$6, - props: { - group: { - type: String, - "default": null - }, - position: { - type: String, - "default": "top-right" - }, - autoZIndex: { - type: Boolean, - "default": true - }, - baseZIndex: { - type: Number, - "default": 0 - }, - breakpoints: { - type: Object, - "default": null - }, - closeIcon: { - type: String, - "default": void 0 - }, - infoIcon: { - type: String, - "default": void 0 - }, - warnIcon: { - type: String, - "default": void 0 - }, - errorIcon: { - type: String, - "default": void 0 - }, - successIcon: { - type: String, - "default": void 0 - }, - closeButtonProps: { - type: null, - "default": null - } - }, - style: ToastStyle, - provide: /* @__PURE__ */ __name(function provide() { - return { - $pcToast: this, - $parentInstance: this - }; - }, "provide") -}; -var script$1 = { - name: "ToastMessage", - hostName: "Toast", - "extends": script$6, - emits: ["close"], - closeTimeout: null, - props: { - message: { - type: null, - "default": null - }, - templates: { - type: Object, - "default": null - }, - closeIcon: { - type: String, - "default": null - }, - infoIcon: { - type: String, - "default": null - }, - warnIcon: { - type: String, - "default": null - }, - errorIcon: { - type: String, - "default": null - }, - successIcon: { - type: String, - "default": null - }, - closeButtonProps: { - type: null, - "default": null - } - }, - mounted: /* @__PURE__ */ __name(function mounted() { - var _this = this; - if (this.message.life) { - this.closeTimeout = setTimeout(function() { - _this.close({ - message: _this.message, - type: "life-end" - }); - }, this.message.life); - } - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount() { - this.clearCloseTimeout(); - }, "beforeUnmount"), - methods: { - close: /* @__PURE__ */ __name(function close(params) { - this.$emit("close", params); - }, "close"), - onCloseClick: /* @__PURE__ */ __name(function onCloseClick() { - this.clearCloseTimeout(); - this.close({ - message: this.message, - type: "close" - }); - }, "onCloseClick"), - clearCloseTimeout: /* @__PURE__ */ __name(function clearCloseTimeout() { - if (this.closeTimeout) { - clearTimeout(this.closeTimeout); - this.closeTimeout = null; - } - }, "clearCloseTimeout") - }, - computed: { - iconComponent: /* @__PURE__ */ __name(function iconComponent() { - return { - info: !this.infoIcon && script$3, - success: !this.successIcon && script$7, - warn: !this.warnIcon && script$4, - error: !this.errorIcon && script$8 - }[this.message.severity]; - }, "iconComponent"), - closeAriaLabel: /* @__PURE__ */ __name(function closeAriaLabel() { - return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : void 0; - }, "closeAriaLabel") - }, - components: { - TimesIcon: script$9, - InfoCircleIcon: script$3, - CheckIcon: script$7, - ExclamationTriangleIcon: script$4, - TimesCircleIcon: script$8 - }, - directives: { - ripple: Ripple - } -}; -function _typeof$1(o) { - "@babel/helpers - typeof"; - return _typeof$1 = "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$1(o); -} -__name(_typeof$1, "_typeof$1"); -function ownKeys$1(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$1, "ownKeys$1"); -function _objectSpread$1(e) { - for (var r = 1; r < arguments.length; r++) { - var t = null != arguments[r] ? arguments[r] : {}; - r % 2 ? ownKeys$1(Object(t), true).forEach(function(r2) { - _defineProperty$1(e, r2, t[r2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r2) { - Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); - }); - } - return e; -} -__name(_objectSpread$1, "_objectSpread$1"); -function _defineProperty$1(e, r, t) { - return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; -} -__name(_defineProperty$1, "_defineProperty$1"); -function _toPropertyKey$1(t) { - var i = _toPrimitive$1(t, "string"); - return "symbol" == _typeof$1(i) ? i : i + ""; -} -__name(_toPropertyKey$1, "_toPropertyKey$1"); -function _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); -} -__name(_toPrimitive$1, "_toPrimitive$1"); -var _hoisted_1 = ["aria-label"]; -function render$1(_ctx, _cache, $props, $setup, $data, $options) { - var _directive_ripple = resolveDirective("ripple"); - return openBlock(), createElementBlock("div", mergeProps({ - "class": [_ctx.cx("message"), $props.message.styleClass], - role: "alert", - "aria-live": "assertive", - "aria-atomic": "true" - }, _ctx.ptm("message")), [$props.templates.container ? (openBlock(), createBlock(resolveDynamicComponent($props.templates.container), { - key: 0, - message: $props.message, - closeCallback: $options.onCloseClick - }, null, 8, ["message", "closeCallback"])) : (openBlock(), createElementBlock("div", mergeProps({ - key: 1, - "class": [_ctx.cx("messageContent"), $props.message.contentStyleClass] - }, _ctx.ptm("messageContent")), [!$props.templates.message ? (openBlock(), createElementBlock(Fragment, { - key: 0 - }, [(openBlock(), createBlock(resolveDynamicComponent($props.templates.messageicon ? $props.templates.messageicon : $props.templates.icon ? $props.templates.icon : $options.iconComponent && $options.iconComponent.name ? $options.iconComponent : "span"), mergeProps({ - "class": _ctx.cx("messageIcon") - }, _ctx.ptm("messageIcon")), null, 16, ["class"])), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("messageText") - }, _ctx.ptm("messageText")), [createBaseVNode("span", mergeProps({ - "class": _ctx.cx("summary") - }, _ctx.ptm("summary")), toDisplayString($props.message.summary), 17), createBaseVNode("div", mergeProps({ - "class": _ctx.cx("detail") - }, _ctx.ptm("detail")), toDisplayString($props.message.detail), 17)], 16)], 64)) : (openBlock(), createBlock(resolveDynamicComponent($props.templates.message), { - key: 1, - message: $props.message - }, null, 8, ["message"])), $props.message.closable !== false ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ - key: 2 - }, _ctx.ptm("buttonContainer"))), [withDirectives((openBlock(), createElementBlock("button", mergeProps({ - "class": _ctx.cx("closeButton"), - type: "button", - "aria-label": $options.closeAriaLabel, - onClick: _cache[0] || (_cache[0] = function() { - return $options.onCloseClick && $options.onCloseClick.apply($options, arguments); - }), - 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)), [[_directive_ripple]])], 16)) : createCommentVNode("", true)], 16))], 16); -} -__name(render$1, "render$1"); -script$1.render = render$1; -function _toConsumableArray(r) { - return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); -} -__name(_toConsumableArray, "_toConsumableArray"); -function _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."); -} -__name(_nonIterableSpread, "_nonIterableSpread"); -function _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; - } -} -__name(_unsupportedIterableToArray, "_unsupportedIterableToArray"); -function _iterableToArray(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -__name(_iterableToArray, "_iterableToArray"); -function _arrayWithoutHoles(r) { - if (Array.isArray(r)) return _arrayLikeToArray(r); -} -__name(_arrayWithoutHoles, "_arrayWithoutHoles"); -function _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; -} -__name(_arrayLikeToArray, "_arrayLikeToArray"); -var messageIdx = 0; -var script = { - name: "Toast", - "extends": script$2, - inheritAttrs: false, - emits: ["close", "life-end"], - data: /* @__PURE__ */ __name(function data() { - return { - messages: [] - }; - }, "data"), - styleElement: null, - mounted: /* @__PURE__ */ __name(function mounted2() { - ToastEventBus.on("add", this.onAdd); - ToastEventBus.on("remove", this.onRemove); - ToastEventBus.on("remove-group", this.onRemoveGroup); - ToastEventBus.on("remove-all-groups", this.onRemoveAllGroups); - if (this.breakpoints) { - this.createStyle(); - } - }, "mounted"), - beforeUnmount: /* @__PURE__ */ __name(function beforeUnmount2() { - this.destroyStyle(); - if (this.$refs.container && this.autoZIndex) { - ZIndex.clear(this.$refs.container); - } - ToastEventBus.off("add", this.onAdd); - ToastEventBus.off("remove", this.onRemove); - ToastEventBus.off("remove-group", this.onRemoveGroup); - ToastEventBus.off("remove-all-groups", this.onRemoveAllGroups); - }, "beforeUnmount"), - methods: { - add: /* @__PURE__ */ __name(function add(message2) { - if (message2.id == null) { - message2.id = messageIdx++; - } - this.messages = [].concat(_toConsumableArray(this.messages), [message2]); - }, "add"), - remove: /* @__PURE__ */ __name(function remove(params) { - var index = this.messages.findIndex(function(m) { - return m.id === params.message.id; - }); - if (index !== -1) { - this.messages.splice(index, 1); - this.$emit(params.type, { - message: params.message - }); - } - }, "remove"), - onAdd: /* @__PURE__ */ __name(function onAdd(message2) { - if (this.group == message2.group) { - this.add(message2); - } - }, "onAdd"), - onRemove: /* @__PURE__ */ __name(function onRemove(message2) { - this.remove({ - message: message2, - type: "close" - }); - }, "onRemove"), - onRemoveGroup: /* @__PURE__ */ __name(function onRemoveGroup(group) { - if (this.group === group) { - this.messages = []; - } - }, "onRemoveGroup"), - onRemoveAllGroups: /* @__PURE__ */ __name(function onRemoveAllGroups() { - this.messages = []; - }, "onRemoveAllGroups"), - onEnter: /* @__PURE__ */ __name(function onEnter() { - if (this.autoZIndex) { - ZIndex.set("modal", this.$refs.container, this.baseZIndex || this.$primevue.config.zIndex.modal); - } - }, "onEnter"), - onLeave: /* @__PURE__ */ __name(function onLeave() { - var _this = this; - if (this.$refs.container && this.autoZIndex && isEmpty(this.messages)) { - setTimeout(function() { - ZIndex.clear(_this.$refs.container); - }, 200); - } - }, "onLeave"), - createStyle: /* @__PURE__ */ __name(function createStyle() { - if (!this.styleElement && !this.isUnstyled) { - var _this$$primevue; - this.styleElement = document.createElement("style"); - this.styleElement.type = "text/css"; - 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); - document.head.appendChild(this.styleElement); - var innerHTML = ""; - for (var breakpoint in this.breakpoints) { - var breakpointStyle = ""; - for (var styleProp in this.breakpoints[breakpoint]) { - breakpointStyle += styleProp + ":" + this.breakpoints[breakpoint][styleProp] + "!important;"; - } - innerHTML += "\n @media screen and (max-width: ".concat(breakpoint, ") {\n .p-toast[").concat(this.$attrSelector, "] {\n ").concat(breakpointStyle, "\n }\n }\n "); - } - this.styleElement.innerHTML = innerHTML; - } - }, "createStyle"), - destroyStyle: /* @__PURE__ */ __name(function destroyStyle() { - if (this.styleElement) { - document.head.removeChild(this.styleElement); - this.styleElement = null; - } - }, "destroyStyle") - }, - components: { - ToastMessage: script$1, - Portal: 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"); -function render(_ctx, _cache, $props, $setup, $data, $options) { - var _component_ToastMessage = resolveComponent("ToastMessage"); - var _component_Portal = resolveComponent("Portal"); - return openBlock(), createBlock(_component_Portal, null, { - "default": withCtx(function() { - return [createBaseVNode("div", mergeProps({ - ref: "container", - "class": _ctx.cx("root"), - style: _ctx.sx("root", true, { - position: _ctx.position - }) - }, _ctx.ptmi("root")), [createVNode(TransitionGroup, mergeProps({ - name: "p-toast-message", - tag: "div", - onEnter: $options.onEnter, - onLeave: $options.onLeave - }, _objectSpread({}, _ctx.ptm("transition"))), { - "default": withCtx(function() { - return [(openBlock(true), createElementBlock(Fragment, null, renderList($data.messages, function(msg) { - return openBlock(), createBlock(_component_ToastMessage, { - key: msg.id, - message: msg, - templates: _ctx.$slots, - closeIcon: _ctx.closeIcon, - infoIcon: _ctx.infoIcon, - warnIcon: _ctx.warnIcon, - errorIcon: _ctx.errorIcon, - successIcon: _ctx.successIcon, - closeButtonProps: _ctx.closeButtonProps, - unstyled: _ctx.unstyled, - onClose: _cache[0] || (_cache[0] = function($event) { - return $options.remove($event); - }), - pt: _ctx.pt - }, null, 8, ["message", "templates", "closeIcon", "infoIcon", "warnIcon", "errorIcon", "successIcon", "closeButtonProps", "unstyled", "pt"]); - }), 128))]; - }), - _: 1 - }, 16, ["onEnter", "onLeave"])], 16)]; - }), - _: 1 - }); -} -__name(render, "render"); -script.render = render; -export { - script$3 as a, - script$4 as b, - script as s -}; -//# sourceMappingURL=index-A_bXPJCN.js.map diff --git a/web/assets/index-B36GcHVN.js b/web/assets/index-B36GcHVN.js deleted file mode 100644 index 3aed3257e..000000000 --- a/web/assets/index-B36GcHVN.js +++ /dev/null @@ -1,54182 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -import { di as ComfyDialog, dj as $el, dk as ComfyApp, h as app, L as LiteGraph, aD as LGraphCanvas, dl as useExtensionService, dm as processDynamicPrompt, b8 as isElectron, b9 as electronAPI, b as useWorkflowStore, by as checkMirrorReachable, bb as useDialogService, bg as t, dn as DraggableList, aW as useToastStore, $ as LGraphNode, dp as applyTextReplacements, dq as ComfyWidgets, dr as addValueControlWidgets, O as useNodeDefStore, a as useSettingStore, ds as serialise, dt as deserialiseAndCreate, aL as api, Z as LGraphGroup, d as defineComponent, T as ref, p as onMounted, d8 as onUnmounted, r as resolveDirective, o as openBlock, f as createElementBlock, k as createVNode, j as unref, l as script, z as withCtx, i as withDirectives, m as createBaseVNode, y as createBlock, aj as normalizeClass, du as script$1, v as vShow, B as createCommentVNode, dv as createApp, cs as Tooltip, N as watch, bm as script$2, dw as PrimeVue, V as nextTick, b4 as lodashExports, aO as setStorageValue, aM as getStorageValue } from "./index-Bv0b06LE.js"; -import { P as PYTHON_MIRROR } from "./uvMirrors-B-HKMf6X.js"; -class ClipspaceDialog extends ComfyDialog { - static { - __name(this, "ClipspaceDialog"); - } - static items = []; - static instance = null; - static registerButton(name, contextPredicate, callback) { - const item = $el("button", { - type: "button", - textContent: name, - contextPredicate, - onclick: callback - }); - ClipspaceDialog.items.push(item); - } - static invalidatePreview() { - if (ComfyApp.clipspace && ComfyApp.clipspace.imgs && ComfyApp.clipspace.imgs.length > 0) { - const img_preview = document.getElementById( - "clipspace_preview" - ); - if (img_preview) { - img_preview.src = ComfyApp.clipspace.imgs[ComfyApp.clipspace["selectedIndex"]].src; - img_preview.style.maxHeight = "100%"; - img_preview.style.maxWidth = "100%"; - } - } - } - static invalidate() { - if (ClipspaceDialog.instance) { - const self2 = ClipspaceDialog.instance; - const children = $el("div.comfy-modal-content", [ - self2.createImgSettings(), - ...self2.createButtons() - ]); - if (self2.element) { - if (self2.element.firstChild) { - self2.element.removeChild(self2.element.firstChild); - } - self2.element.appendChild(children); - } else { - self2.element = $el("div.comfy-modal", { parent: document.body }, [ - children - ]); - } - if (self2.element.children[0].children.length <= 1) { - self2.element.children[0].appendChild( - $el("p", {}, [ - "Unable to find the features to edit content of a format stored in the current Clipspace." - ]) - ); - } - ClipspaceDialog.invalidatePreview(); - } - } - constructor() { - super(); - } - createButtons() { - const buttons = []; - for (let idx in ClipspaceDialog.items) { - const item = ClipspaceDialog.items[idx]; - if (!item.contextPredicate || item.contextPredicate()) - buttons.push(ClipspaceDialog.items[idx]); - } - buttons.push( - $el("button", { - type: "button", - textContent: "Close", - onclick: /* @__PURE__ */ __name(() => { - this.close(); - }, "onclick") - }) - ); - return buttons; - } - createImgSettings() { - if (ComfyApp.clipspace?.imgs) { - const combo_items = []; - const imgs = ComfyApp.clipspace.imgs; - for (let i = 0; i < imgs.length; i++) { - combo_items.push($el("option", { value: i }, [`${i}`])); - } - const combo1 = $el( - "select", - { - id: "clipspace_img_selector", - onchange: /* @__PURE__ */ __name((event) => { - if (event.target && ComfyApp.clipspace) { - ComfyApp.clipspace["selectedIndex"] = event.target.selectedIndex; - ClipspaceDialog.invalidatePreview(); - } - }, "onchange") - }, - combo_items - ); - const row1 = $el("tr", {}, [ - $el("td", {}, [$el("font", { color: "white" }, ["Select Image"])]), - $el("td", {}, [combo1]) - ]); - const combo2 = $el( - "select", - { - id: "clipspace_img_paste_mode", - onchange: /* @__PURE__ */ __name((event) => { - if (event.target && ComfyApp.clipspace) { - ComfyApp.clipspace["img_paste_mode"] = event.target.value; - } - }, "onchange") - }, - [ - $el("option", { value: "selected" }, "selected"), - $el("option", { value: "all" }, "all") - ] - ); - combo2.value = ComfyApp.clipspace["img_paste_mode"]; - const row2 = $el("tr", {}, [ - $el("td", {}, [$el("font", { color: "white" }, ["Paste Mode"])]), - $el("td", {}, [combo2]) - ]); - const td2 = $el( - "td", - { align: "center", width: "100px", height: "100px", colSpan: "2" }, - [$el("img", { id: "clipspace_preview", ondragstart: /* @__PURE__ */ __name(() => false, "ondragstart") }, [])] - ); - const row3 = $el("tr", {}, [td2]); - return $el("table", {}, [row1, row2, row3]); - } else { - return []; - } - } - createImgPreview() { - if (ComfyApp.clipspace?.imgs) { - return $el("img", { id: "clipspace_preview", ondragstart: /* @__PURE__ */ __name(() => false, "ondragstart") }); - } else return []; - } - show() { - const img_preview = document.getElementById("clipspace_preview"); - ClipspaceDialog.invalidate(); - this.element.style.display = "block"; - } -} -app.registerExtension({ - name: "Comfy.Clipspace", - init(app2) { - app2.openClipspace = function() { - if (!ClipspaceDialog.instance) { - ClipspaceDialog.instance = new ClipspaceDialog(); - ComfyApp.clipspace_invalidate_handler = ClipspaceDialog.invalidate; - } - if (ComfyApp.clipspace) { - ClipspaceDialog.instance.show(); - } else app2.ui.dialog.show("Clipspace is Empty!"); - }; - } -}); -window.comfyAPI = window.comfyAPI || {}; -window.comfyAPI.clipspace = window.comfyAPI.clipspace || {}; -window.comfyAPI.clipspace.ClipspaceDialog = ClipspaceDialog; -const ext$1 = { - name: "Comfy.ContextMenuFilter", - init() { - const ctxMenu = LiteGraph.ContextMenu; - LiteGraph.ContextMenu = function(values, options) { - const ctx = new ctxMenu(values, options); - if (options?.className === "dark" && values?.length > 4) { - const filter = document.createElement("input"); - filter.classList.add("comfy-context-menu-filter"); - filter.placeholder = "Filter list"; - ctx.root.prepend(filter); - const items = Array.from( - ctx.root.querySelectorAll(".litemenu-entry") - ); - let displayedItems = [...items]; - let itemCount = displayedItems.length; - requestAnimationFrame(() => { - const currentNode = LGraphCanvas.active_canvas.current_node; - const clickedComboValue = currentNode?.widgets?.filter( - (w) => w.type === "combo" && w.options.values?.length === values.length - ).find( - (w) => w.options.values?.every((v, i) => v === values[i]) - )?.value; - let selectedIndex = clickedComboValue ? values.findIndex((v) => v === clickedComboValue) : 0; - if (selectedIndex < 0) { - selectedIndex = 0; - } - let selectedItem = displayedItems[selectedIndex]; - updateSelected(); - function updateSelected() { - selectedItem?.style.setProperty("background-color", ""); - selectedItem?.style.setProperty("color", ""); - selectedItem = displayedItems[selectedIndex]; - selectedItem?.style.setProperty( - "background-color", - "#ccc", - "important" - ); - selectedItem?.style.setProperty("color", "#000", "important"); - } - __name(updateSelected, "updateSelected"); - const positionList = /* @__PURE__ */ __name(() => { - const rect = ctx.root.getBoundingClientRect(); - if (rect.top < 0) { - const scale = 1 - ctx.root.getBoundingClientRect().height / ctx.root.clientHeight; - const shift = ctx.root.clientHeight * scale / 2; - ctx.root.style.top = -shift + "px"; - } - }, "positionList"); - filter.addEventListener("keydown", (event) => { - switch (event.key) { - case "ArrowUp": - event.preventDefault(); - if (selectedIndex === 0) { - selectedIndex = itemCount - 1; - } else { - selectedIndex--; - } - updateSelected(); - break; - case "ArrowRight": - event.preventDefault(); - selectedIndex = itemCount - 1; - updateSelected(); - break; - case "ArrowDown": - event.preventDefault(); - if (selectedIndex === itemCount - 1) { - selectedIndex = 0; - } else { - selectedIndex++; - } - updateSelected(); - break; - case "ArrowLeft": - event.preventDefault(); - selectedIndex = 0; - updateSelected(); - break; - case "Enter": - selectedItem?.click(); - break; - case "Escape": - ctx.close(); - break; - } - }); - filter.addEventListener("input", () => { - const term = filter.value.toLocaleLowerCase(); - displayedItems = items.filter((item) => { - const isVisible = !term || item.textContent?.toLocaleLowerCase().includes(term); - item.style.display = isVisible ? "block" : "none"; - return isVisible; - }); - selectedIndex = 0; - if (displayedItems.includes(selectedItem)) { - selectedIndex = displayedItems.findIndex( - (d) => d === selectedItem - ); - } - itemCount = displayedItems.length; - updateSelected(); - if (options.event) { - let top = options.event.clientY - 10; - const bodyRect = document.body.getBoundingClientRect(); - const rootRect = ctx.root.getBoundingClientRect(); - if (bodyRect.height && top > bodyRect.height - rootRect.height - 10) { - top = Math.max(0, bodyRect.height - rootRect.height - 10); - } - ctx.root.style.top = top + "px"; - positionList(); - } - }); - requestAnimationFrame(() => { - filter.focus(); - positionList(); - }); - }); - } - return ctx; - }; - LiteGraph.ContextMenu.prototype = ctxMenu.prototype; - } -}; -app.registerExtension(ext$1); -useExtensionService().registerExtension({ - name: "Comfy.DynamicPrompts", - nodeCreated(node) { - if (node.widgets) { - const widgets = node.widgets.filter((w) => w.dynamicPrompts); - for (const widget of widgets) { - widget.serializeValue = (workflowNode, widgetIndex) => { - if (typeof widget.value !== "string") return widget.value; - const prompt = processDynamicPrompt(widget.value); - if (workflowNode?.widgets_values) - workflowNode.widgets_values[widgetIndex] = prompt; - return prompt; - }; - } - } - } -}); -app.registerExtension({ - name: "Comfy.EditAttention", - init() { - const editAttentionDelta = app.ui.settings.addSetting({ - id: "Comfy.EditAttention.Delta", - category: ["Comfy", "EditTokenWeight", "Delta"], - name: "Ctrl+up/down precision", - type: "slider", - attrs: { - min: 0.01, - max: 0.5, - step: 0.01 - }, - defaultValue: 0.05 - }); - function incrementWeight(weight, delta) { - const floatWeight = parseFloat(weight); - if (isNaN(floatWeight)) return weight; - const newWeight = floatWeight + delta; - return String(Number(newWeight.toFixed(10))); - } - __name(incrementWeight, "incrementWeight"); - function findNearestEnclosure(text, cursorPos) { - let start = cursorPos, end = cursorPos; - let openCount = 0, closeCount = 0; - while (start >= 0) { - start--; - if (text[start] === "(" && openCount === closeCount) break; - if (text[start] === "(") openCount++; - if (text[start] === ")") closeCount++; - } - if (start < 0) return null; - openCount = 0; - closeCount = 0; - while (end < text.length) { - if (text[end] === ")" && openCount === closeCount) break; - if (text[end] === "(") openCount++; - if (text[end] === ")") closeCount++; - end++; - } - if (end === text.length) return null; - return { start: start + 1, end }; - } - __name(findNearestEnclosure, "findNearestEnclosure"); - function addWeightToParentheses(text) { - const parenRegex = /^\((.*)\)$/; - const parenMatch = text.match(parenRegex); - const floatRegex = /:([+-]?(\d*\.)?\d+([eE][+-]?\d+)?)/; - const floatMatch = text.match(floatRegex); - if (parenMatch && !floatMatch) { - return `(${parenMatch[1]}:1.0)`; - } else { - return text; - } - } - __name(addWeightToParentheses, "addWeightToParentheses"); - function editAttention(event) { - const inputField = event.composedPath()[0]; - const delta = parseFloat(editAttentionDelta.value); - if (inputField.tagName !== "TEXTAREA") return; - if (!(event.key === "ArrowUp" || event.key === "ArrowDown")) return; - if (!event.ctrlKey && !event.metaKey) return; - event.preventDefault(); - let start = inputField.selectionStart; - let end = inputField.selectionEnd; - let selectedText = inputField.value.substring(start, end); - if (!selectedText) { - const nearestEnclosure = findNearestEnclosure(inputField.value, start); - if (nearestEnclosure) { - start = nearestEnclosure.start; - end = nearestEnclosure.end; - selectedText = inputField.value.substring(start, end); - } else { - const delimiters = " .,\\/!?%^*;:{}=-_`~()\r\n "; - while (!delimiters.includes(inputField.value[start - 1]) && start > 0) { - start--; - } - while (!delimiters.includes(inputField.value[end]) && end < inputField.value.length) { - end++; - } - selectedText = inputField.value.substring(start, end); - if (!selectedText) return; - } - } - if (selectedText[selectedText.length - 1] === " ") { - selectedText = selectedText.substring(0, selectedText.length - 1); - end -= 1; - } - if (inputField.value[start - 1] === "(" && inputField.value[end] === ")") { - start -= 1; - end += 1; - selectedText = inputField.value.substring(start, end); - } - if (selectedText[0] !== "(" || selectedText[selectedText.length - 1] !== ")") { - selectedText = `(${selectedText})`; - } - selectedText = addWeightToParentheses(selectedText); - const weightDelta = event.key === "ArrowUp" ? delta : -delta; - const updatedText = selectedText.replace( - /\((.*):([+-]?\d+(?:\.\d+)?)\)/, - (match, text, weight) => { - weight = incrementWeight(weight, weightDelta); - if (weight == 1) { - return text; - } else { - return `(${text}:${weight})`; - } - } - ); - inputField.setSelectionRange(start, end); - document.execCommand("insertText", false, updatedText); - inputField.setSelectionRange(start, start + updatedText.length); - } - __name(editAttention, "editAttention"); - window.addEventListener("keydown", editAttention); - } -}); -(async () => { - if (!isElectron()) return; - const electronAPI$1 = electronAPI(); - const desktopAppVersion = await electronAPI$1.getElectronVersion(); - const workflowStore = useWorkflowStore(); - 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 usage metrics", - type: "boolean", - defaultValue: true, - onChange: onChangeRestartApp - }, - { - id: "Comfy-Desktop.WindowStyle", - category: ["Comfy-Desktop", "General", "Window Style"], - name: "Window Style", - tooltip: "Custom: Replace the system title bar with ComfyUI's Top menu", - type: "combo", - experimental: true, - defaultValue: "default", - options: ["default", "custom"], - onChange: /* @__PURE__ */ __name((newValue, oldValue) => { - if (!oldValue) return; - electronAPI$1.Config.setWindowStyle(newValue); - }, "onChange") - }, - { - id: "Comfy-Desktop.UV.PythonInstallMirror", - name: "Python Install Mirror", - tooltip: `Managed Python installations are downloaded from the Astral python-build-standalone project. This variable can be set to a mirror URL to use a different source for Python installations. The provided URL will replace https://github.com/astral-sh/python-build-standalone/releases/download in, e.g., https://github.com/astral-sh/python-build-standalone/releases/download/20240713/cpython-3.12.4%2B20240713-aarch64-apple-darwin-install_only.tar.gz. Distributions can be read from a local directory by using the file:// URL scheme.`, - type: "url", - defaultValue: "", - attrs: { - validateUrlFn(mirror) { - return checkMirrorReachable( - mirror + PYTHON_MIRROR.validationPathSuffix - ); - } - } - }, - { - id: "Comfy-Desktop.UV.PypiInstallMirror", - name: "Pypi Install Mirror", - tooltip: `Default pip install mirror`, - type: "url", - defaultValue: "", - attrs: { - validateUrlFn: checkMirrorReachable - } - }, - { - id: "Comfy-Desktop.UV.TorchInstallMirror", - name: "Torch Install Mirror", - tooltip: `Pip install mirror for pytorch`, - type: "url", - defaultValue: "", - attrs: { - validateUrlFn: checkMirrorReachable - } - } - ], - 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.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(); - } - }, - { - id: "Comfy-Desktop.Quit", - label: "Quit", - icon: "pi pi-sign-out", - async function() { - if (workflowStore.modifiedWorkflows.length > 0) { - const confirmed = await useDialogService().confirm({ - message: t("desktopMenu.confirmQuit"), - title: t("desktopMenu.quit"), - type: "default" - }); - if (!confirmed) return; - } - electronAPI$1.quit(); - } - } - ], - menuCommands: [ - { - path: ["Help"], - commands: ["Comfy-Desktop.OpenUserGuide"] - }, - { - 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"] - } - ], - keybindings: [ - { - commandId: "Workspace.CloseWorkflow", - combo: { - key: "w", - ctrl: true - } - } - ], - 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 = ">"; -function merge(target, source) { - if (typeof target === "object" && typeof source === "object") { - for (const key in source) { - const sv = source[key]; - if (typeof sv === "object") { - let tv = target[key]; - if (!tv) tv = target[key] = {}; - merge(tv, source[key]); - } else { - target[key] = sv; - } - } - } - return target; -} -__name(merge, "merge"); -class ManageGroupDialog extends ComfyDialog { - static { - __name(this, "ManageGroupDialog"); - } - tabs; - selectedNodeIndex; - selectedTab = "Inputs"; - selectedGroup; - modifications = {}; - nodeItems; - app; - groupNodeType; - groupNodeDef; - groupData; - innerNodesList; - widgetsPage; - inputsPage; - outputsPage; - draggable; - get selectedNodeInnerIndex() { - return +this.nodeItems[this.selectedNodeIndex].dataset.nodeindex; - } - constructor(app2) { - super(); - this.app = app2; - this.element = $el("dialog.comfy-group-manage", { - parent: document.body - }); - } - changeTab(tab) { - this.tabs[this.selectedTab].tab.classList.remove("active"); - this.tabs[this.selectedTab].page.classList.remove("active"); - this.tabs[tab].tab.classList.add("active"); - this.tabs[tab].page.classList.add("active"); - this.selectedTab = tab; - } - changeNode(index, force) { - if (!force && this.selectedNodeIndex === index) return; - if (this.selectedNodeIndex != null) { - this.nodeItems[this.selectedNodeIndex].classList.remove("selected"); - } - this.nodeItems[index].classList.add("selected"); - this.selectedNodeIndex = index; - if (!this.buildInputsPage() && this.selectedTab === "Inputs") { - this.changeTab("Widgets"); - } - if (!this.buildWidgetsPage() && this.selectedTab === "Widgets") { - this.changeTab("Outputs"); - } - if (!this.buildOutputsPage() && this.selectedTab === "Outputs") { - this.changeTab("Inputs"); - } - this.changeTab(this.selectedTab); - } - getGroupData() { - this.groupNodeType = LiteGraph.registered_node_types[`${PREFIX$1}${SEPARATOR$1}` + this.selectedGroup]; - this.groupNodeDef = this.groupNodeType.nodeData; - this.groupData = GroupNodeHandler.getGroupData(this.groupNodeType); - } - changeGroup(group, reset = true) { - this.selectedGroup = group; - this.getGroupData(); - const nodes = this.groupData.nodeData.nodes; - this.nodeItems = nodes.map( - (n, i) => $el( - "li.draggable-item", - { - dataset: { - nodeindex: n.index + "" - }, - onclick: /* @__PURE__ */ __name(() => { - this.changeNode(i); - }, "onclick") - }, - [ - $el("span.drag-handle"), - $el( - "div", - { - textContent: n.title ?? n.type - }, - n.title ? $el("span", { - textContent: n.type - }) : [] - ) - ] - ) - ); - this.innerNodesList.replaceChildren(...this.nodeItems); - if (reset) { - this.selectedNodeIndex = null; - this.changeNode(0); - } else { - const items = this.draggable.getAllItems(); - let index = items.findIndex((item) => item.classList.contains("selected")); - if (index === -1) index = this.selectedNodeIndex; - this.changeNode(index, true); - } - const ordered = [...nodes]; - this.draggable?.dispose(); - this.draggable = new DraggableList(this.innerNodesList, "li"); - this.draggable.addEventListener( - "dragend", - ({ detail: { oldPosition, newPosition } }) => { - if (oldPosition === newPosition) return; - ordered.splice(newPosition, 0, ordered.splice(oldPosition, 1)[0]); - for (let i = 0; i < ordered.length; i++) { - this.storeModification({ - nodeIndex: ordered[i].index, - section: ORDER, - prop: "order", - value: i - }); - } - } - ); - } - storeModification(props) { - const { nodeIndex, section, prop, value } = props; - const groupMod = this.modifications[this.selectedGroup] ??= {}; - const nodesMod = groupMod.nodes ??= {}; - const nodeMod = nodesMod[nodeIndex ?? this.selectedNodeInnerIndex] ??= {}; - const typeMod = nodeMod[section] ??= {}; - if (typeof value === "object") { - const objMod = typeMod[prop] ??= {}; - Object.assign(objMod, value); - } else { - typeMod[prop] = value; - } - } - getEditElement(section, prop, value, placeholder, checked, checkable = true) { - if (value === placeholder) value = ""; - const mods = this.modifications[this.selectedGroup]?.nodes?.[this.selectedNodeInnerIndex]?.[section]?.[prop]; - if (mods) { - if (mods.name != null) { - value = mods.name; - } - if (mods.visible != null) { - checked = mods.visible; - } - } - return $el("div", [ - $el("input", { - value, - placeholder, - type: "text", - onchange: /* @__PURE__ */ __name((e) => { - this.storeModification({ - section, - prop, - value: { name: e.target.value } - }); - }, "onchange") - }), - $el("label", { textContent: "Visible" }, [ - $el("input", { - type: "checkbox", - checked, - disabled: !checkable, - onchange: /* @__PURE__ */ __name((e) => { - this.storeModification({ - section, - prop, - value: { visible: !!e.target.checked } - }); - }, "onchange") - }) - ]) - ]); - } - buildWidgetsPage() { - const widgets = this.groupData.oldToNewWidgetMap[this.selectedNodeInnerIndex]; - const items = Object.keys(widgets ?? {}); - const type = app.graph.extra.groupNodes[this.selectedGroup]; - const config = type.config?.[this.selectedNodeInnerIndex]?.input; - this.widgetsPage.replaceChildren( - ...items.map((oldName) => { - return this.getEditElement( - "input", - oldName, - widgets[oldName], - oldName, - config?.[oldName]?.visible !== false - ); - }) - ); - return !!items.length; - } - buildInputsPage() { - const inputs = this.groupData.nodeInputs[this.selectedNodeInnerIndex]; - const items = Object.keys(inputs ?? {}); - const type = app.graph.extra.groupNodes[this.selectedGroup]; - const config = type.config?.[this.selectedNodeInnerIndex]?.input; - this.inputsPage.replaceChildren( - ...items.map((oldName) => { - let value = inputs[oldName]; - if (!value) { - return; - } - return this.getEditElement( - "input", - oldName, - value, - oldName, - config?.[oldName]?.visible !== false - ); - }).filter(Boolean) - ); - return !!items.length; - } - buildOutputsPage() { - const nodes = this.groupData.nodeData.nodes; - const innerNodeDef = this.groupData.getNodeDef( - nodes[this.selectedNodeInnerIndex] - ); - const outputs = innerNodeDef?.output ?? []; - const groupOutputs = this.groupData.oldToNewOutputMap[this.selectedNodeInnerIndex]; - const type = app.graph.extra.groupNodes[this.selectedGroup]; - const config = type.config?.[this.selectedNodeInnerIndex]?.output; - const node = this.groupData.nodeData.nodes[this.selectedNodeInnerIndex]; - const checkable = node.type !== "PrimitiveNode"; - this.outputsPage.replaceChildren( - ...outputs.map((type2, slot) => { - const groupOutputIndex = groupOutputs?.[slot]; - const oldName = innerNodeDef.output_name?.[slot] ?? type2; - let value = config?.[slot]?.name; - const visible = config?.[slot]?.visible || groupOutputIndex != null; - if (!value || value === oldName) { - value = ""; - } - return this.getEditElement( - "output", - slot, - value, - oldName, - visible, - checkable - ); - }).filter(Boolean) - ); - return !!outputs.length; - } - show(type) { - const groupNodes = Object.keys(app.graph.extra?.groupNodes ?? {}).sort( - (a, b) => a.localeCompare(b) - ); - this.innerNodesList = $el( - "ul.comfy-group-manage-list-items" - ); - this.widgetsPage = $el("section.comfy-group-manage-node-page"); - this.inputsPage = $el("section.comfy-group-manage-node-page"); - this.outputsPage = $el("section.comfy-group-manage-node-page"); - const pages = $el("div", [ - this.widgetsPage, - this.inputsPage, - this.outputsPage - ]); - this.tabs = [ - ["Inputs", this.inputsPage], - ["Widgets", this.widgetsPage], - ["Outputs", this.outputsPage] - ].reduce((p, [name, page]) => { - p[name] = { - tab: $el("a", { - onclick: /* @__PURE__ */ __name(() => { - this.changeTab(name); - }, "onclick"), - textContent: name - }), - page - }; - return p; - }, {}); - const outer = $el("div.comfy-group-manage-outer", [ - $el("header", [ - $el("h2", "Group Nodes"), - $el( - "select", - { - onchange: /* @__PURE__ */ __name((e) => { - this.changeGroup(e.target.value); - }, "onchange") - }, - groupNodes.map( - (g) => $el("option", { - textContent: g, - selected: `${PREFIX$1}${SEPARATOR$1}${g}` === type, - value: g - }) - ) - ) - ]), - $el("main", [ - $el("section.comfy-group-manage-list", this.innerNodesList), - $el("section.comfy-group-manage-node", [ - $el( - "header", - Object.values(this.tabs).map((t2) => t2.tab) - ), - pages - ]) - ]), - $el("footer", [ - $el( - "button.comfy-btn", - { - onclick: /* @__PURE__ */ __name((e) => { - const node = app.graph.nodes.find( - (n) => n.type === `${PREFIX$1}${SEPARATOR$1}` + this.selectedGroup - ); - if (node) { - useToastStore().addAlert( - "This group node is in use in the current workflow, please first remove these." - ); - return; - } - if (confirm( - `Are you sure you want to remove the node: "${this.selectedGroup}"` - )) { - delete app.graph.extra.groupNodes[this.selectedGroup]; - LiteGraph.unregisterNodeType( - `${PREFIX$1}${SEPARATOR$1}` + this.selectedGroup - ); - } - this.show(); - }, "onclick") - }, - "Delete Group Node" - ), - $el( - "button.comfy-btn", - { - onclick: /* @__PURE__ */ __name(async () => { - let nodesByType; - let recreateNodes = []; - const types = {}; - for (const g in this.modifications) { - const type2 = app.graph.extra.groupNodes[g]; - let config = type2.config ??= {}; - let nodeMods = this.modifications[g]?.nodes; - if (nodeMods) { - const keys = Object.keys(nodeMods); - if (nodeMods[keys[0]][ORDER]) { - const orderedNodes = []; - const orderedMods = {}; - const orderedConfig = {}; - for (const n of keys) { - const order = nodeMods[n][ORDER].order; - orderedNodes[order] = type2.nodes[+n]; - orderedMods[order] = nodeMods[n]; - orderedNodes[order].index = order; - } - for (const l of type2.links) { - if (l[0] != null) l[0] = type2.nodes[l[0]].index; - if (l[2] != null) l[2] = type2.nodes[l[2]].index; - } - if (type2.external) { - for (const ext2 of type2.external) { - ext2[0] = type2.nodes[ext2[0]]; - } - } - for (const id2 of keys) { - if (config[id2]) { - orderedConfig[type2.nodes[id2].index] = config[id2]; - } - delete config[id2]; - } - type2.nodes = orderedNodes; - nodeMods = orderedMods; - type2.config = config = orderedConfig; - } - merge(config, nodeMods); - } - types[g] = type2; - if (!nodesByType) { - nodesByType = app.graph.nodes.reduce((p, n) => { - p[n.type] ??= []; - p[n.type].push(n); - return p; - }, {}); - } - const nodes = nodesByType[`${PREFIX$1}${SEPARATOR$1}` + g]; - if (nodes) recreateNodes.push(...nodes); - } - await GroupNodeConfig.registerFromWorkflow(types, {}); - for (const node of recreateNodes) { - node.recreate(); - } - this.modifications = {}; - this.app.graph.setDirtyCanvas(true, true); - this.changeGroup(this.selectedGroup, false); - }, "onclick") - }, - "Save" - ), - $el( - "button.comfy-btn", - { onclick: /* @__PURE__ */ __name(() => this.element.close(), "onclick") }, - "Close" - ) - ]) - ]); - this.element.replaceChildren(outer); - this.changeGroup( - type ? groupNodes.find((g) => `${PREFIX$1}${SEPARATOR$1}${g}` === type) ?? groupNodes[0] : groupNodes[0] - ); - this.element.showModal(); - this.element.addEventListener("close", () => { - this.draggable?.dispose(); - this.element.remove(); - }); - } -} -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"); -app.registerExtension({ - name: "Comfy.WidgetInputs", - settings: [ - { - 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.getExtraSlotMenuOptions = function(slot) { - if (!slot.input || !slot.input.widget) return []; - const widget = this.widgets.find((w) => w.name === slot.input.widget.name); - if (!widget) return []; - return [ - { - content: `Convert to widget`, - callback: /* @__PURE__ */ __name(() => convertToWidget(this, widget), "callback") - } - ]; - }; - nodeType.prototype.getExtraMenuOptions = function(_, options) { - const r = origGetExtraMenuOptions ? origGetExtraMenuOptions.apply(this, arguments) : void 0; - const getPointerCanvasPos = /* @__PURE__ */ __name(() => { - const pos = this.graph?.list_of_graphcanvas?.at(0)?.graph_mouse; - return pos ? { canvasX: pos[0], canvasY: pos[1] } : void 0; - }, "getPointerCanvasPos"); - if (this.widgets) { - const { canvasX, canvasY } = getPointerCanvasPos(); - const widget = this.getWidgetOnPos(canvasX, canvasY); - if (widget && widget.type !== CONVERTED_TYPE) { - const config = getConfig.call(this, widget.name) ?? [ - widget.type, - widget.options || {} - ]; - if (isConvertibleWidget(widget, config)) { - options.push({ - content: `Convert ${widget.name} to input`, - callback: /* @__PURE__ */ __name(() => convertToInput(this, widget, config) && false, "callback") - }); - } - } - 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 (useSettingStore().get("Comfy.NodeInputConversionSubmenus")) { - options.push({ - content: "Convert Widget to Input", - submenu: { - options: toInput - } - }); - } else { - options.push(...toInput, null); - } - } - if (toWidget.length) { - if (useSettingStore().get("Comfy.NodeInputConversionSubmenus")) { - 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] = () => 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 = ">"; -const Workflow = { - InUse: { - Free: 0, - Registered: 1, - InWorkflow: 2 - }, - isInUseGroupNode(name) { - const id2 = `${PREFIX}${SEPARATOR}${name}`; - if (app.graph.extra?.groupNodes?.[name]) { - if (app.graph.nodes.find((n) => n.type === id2)) { - return Workflow.InUse.InWorkflow; - } else { - return Workflow.InUse.Registered; - } - } - return Workflow.InUse.Free; - }, - storeGroupNode(name, data) { - let extra = app.graph.extra; - if (!extra) app.graph.extra = extra = {}; - let groupNodes = extra.groupNodes; - if (!groupNodes) extra.groupNodes = groupNodes = {}; - groupNodes[name] = data; - } -}; -class GroupNodeBuilder { - static { - __name(this, "GroupNodeBuilder"); - } - nodes; - nodeData; - constructor(nodes) { - this.nodes = nodes; - } - async build() { - const name = await this.getName(); - if (!name) return; - this.sortNodes(); - this.nodeData = this.getNodeData(); - Workflow.storeGroupNode(name, this.nodeData); - return { name, nodeData: this.nodeData }; - } - async getName() { - const name = await useDialogService().prompt({ - title: t("groupNode.create"), - message: t("groupNode.enterName"), - defaultValue: "" - }); - if (!name) return; - const used = Workflow.isInUseGroupNode(name); - switch (used) { - case Workflow.InUse.InWorkflow: - useToastStore().addAlert( - "An in use group node with this name already exists embedded in this workflow, please remove any instances or use a new name." - ); - return; - case Workflow.InUse.Registered: - if (!confirm( - "A group node with this name already exists embedded in this workflow, are you sure you want to overwrite it?" - )) { - return; - } - break; - } - return name; - } - sortNodes() { - const nodesInOrder = app.graph.computeExecutionOrder(false); - this.nodes = this.nodes.map((node) => ({ index: nodesInOrder.indexOf(node), node })).sort((a, b) => a.index - b.index || a.node.id - b.node.id).map(({ node }) => node); - } - getNodeData() { - const storeLinkTypes = /* @__PURE__ */ __name((config) => { - for (const link of config.links) { - const origin = app.graph.getNodeById(link[4]); - const type = origin.outputs[link[1]].type; - link.push(type); - } - }, "storeLinkTypes"); - const storeExternalLinks = /* @__PURE__ */ __name((config) => { - config.external = []; - for (let i = 0; i < this.nodes.length; i++) { - const node = this.nodes[i]; - if (!node.outputs?.length) continue; - for (let slot = 0; slot < node.outputs.length; slot++) { - let hasExternal = false; - const output = node.outputs[slot]; - let type = output.type; - if (!output.links?.length) continue; - for (const l of output.links) { - const link = app.graph.links[l]; - if (!link) continue; - if (type === "*") type = link.type; - if (!app.canvas.selected_nodes[link.target_id]) { - hasExternal = true; - break; - } - } - if (hasExternal) { - config.external.push([i, slot, type]); - } - } - } - }, "storeExternalLinks"); - try { - const serialised = serialise(this.nodes, app.canvas.graph); - const config = JSON.parse(serialised); - storeLinkTypes(config); - storeExternalLinks(config); - return config; - } finally { - } - } -} -class GroupNodeConfig { - static { - __name(this, "GroupNodeConfig"); - } - name; - nodeData; - inputCount; - oldToNewOutputMap; - newToOldOutputMap; - oldToNewInputMap; - oldToNewWidgetMap; - newToOldWidgetMap; - primitiveDefs; - widgetToPrimitive; - primitiveToWidget; - nodeInputs; - outputVisibility; - nodeDef; - inputs; - linksFrom; - linksTo; - externalFrom; - constructor(name, nodeData) { - this.name = name; - this.nodeData = nodeData; - this.getLinks(); - this.inputCount = 0; - this.oldToNewOutputMap = {}; - this.newToOldOutputMap = {}; - this.oldToNewInputMap = {}; - this.oldToNewWidgetMap = {}; - this.newToOldWidgetMap = {}; - this.primitiveDefs = {}; - this.widgetToPrimitive = {}; - this.primitiveToWidget = {}; - this.nodeInputs = {}; - this.outputVisibility = []; - } - async registerType(source = PREFIX) { - this.nodeDef = { - output: [], - output_name: [], - output_is_list: [], - // @ts-expect-error Unused, doesn't exist - output_is_hidden: [], - name: source + SEPARATOR + this.name, - display_name: this.name, - category: "group nodes" + (SEPARATOR + source), - input: { required: {} }, - description: `Group node combining ${this.nodeData.nodes.map((n) => n.type).join(", ")}`, - python_module: "custom_nodes." + this.name, - [GROUP]: this - }; - this.inputs = []; - const seenInputs = {}; - const seenOutputs = {}; - for (let i = 0; i < this.nodeData.nodes.length; i++) { - const node = this.nodeData.nodes[i]; - node.index = i; - this.processNode(node, seenInputs, seenOutputs); - } - for (const p of this.#convertedToProcess) { - p(); - } - this.#convertedToProcess = null; - await app.registerNodeDef(`${PREFIX}${SEPARATOR}` + this.name, this.nodeDef); - useNodeDefStore().addNodeDef(this.nodeDef); - } - getLinks() { - this.linksFrom = {}; - this.linksTo = {}; - this.externalFrom = {}; - for (const l of this.nodeData.links) { - const [sourceNodeId, sourceNodeSlot, targetNodeId, targetNodeSlot] = l; - if (sourceNodeId == null) continue; - if (!this.linksFrom[sourceNodeId]) { - this.linksFrom[sourceNodeId] = {}; - } - if (!this.linksFrom[sourceNodeId][sourceNodeSlot]) { - this.linksFrom[sourceNodeId][sourceNodeSlot] = []; - } - this.linksFrom[sourceNodeId][sourceNodeSlot].push(l); - if (!this.linksTo[targetNodeId]) { - this.linksTo[targetNodeId] = {}; - } - this.linksTo[targetNodeId][targetNodeSlot] = l; - } - if (this.nodeData.external) { - for (const ext2 of this.nodeData.external) { - if (!this.externalFrom[ext2[0]]) { - this.externalFrom[ext2[0]] = { [ext2[1]]: ext2[2] }; - } else { - this.externalFrom[ext2[0]][ext2[1]] = ext2[2]; - } - } - } - } - processNode(node, seenInputs, seenOutputs) { - const def = this.getNodeDef(node); - if (!def) return; - const inputs = { ...def.input?.required, ...def.input?.optional }; - this.inputs.push(this.processNodeInputs(node, seenInputs, inputs)); - if (def.output?.length) this.processNodeOutputs(node, seenOutputs, def); - } - getNodeDef(node) { - const def = globalDefs[node.type]; - if (def) return def; - const linksFrom = this.linksFrom[node.index]; - if (node.type === "PrimitiveNode") { - if (!linksFrom) return; - let type = linksFrom["0"][0][5]; - if (type === "COMBO") { - const source = node.outputs[0].widget.name; - const fromTypeName = this.nodeData.nodes[linksFrom["0"][0][2]].type; - const fromType = globalDefs[fromTypeName]; - const input = fromType.input.required[source] ?? fromType.input.optional[source]; - type = input[0]; - } - const def2 = this.primitiveDefs[node.index] = { - input: { - required: { - value: [type, {}] - } - }, - output: [type], - output_name: [], - output_is_list: [] - }; - return def2; - } else if (node.type === "Reroute") { - const linksTo = this.linksTo[node.index]; - if (linksTo && linksFrom && !this.externalFrom[node.index]?.[0]) { - return null; - } - let config = {}; - let rerouteType = "*"; - if (linksFrom) { - for (const [, , id2, slot] of linksFrom["0"]) { - const node2 = this.nodeData.nodes[id2]; - const input = node2.inputs[slot]; - if (rerouteType === "*") { - rerouteType = input.type; - } - if (input.widget) { - const targetDef = globalDefs[node2.type]; - const targetWidget = targetDef.input.required[input.widget.name] ?? targetDef.input.optional[input.widget.name]; - const widget = [targetWidget[0], config]; - const res = mergeIfValid( - { - widget - }, - targetWidget, - false, - null, - widget - ); - config = res?.customConfig ?? config; - } - } - } else if (linksTo) { - const [id2, slot] = linksTo["0"]; - rerouteType = this.nodeData.nodes[id2].outputs[slot].type; - } else { - for (const l of this.nodeData.links) { - if (l[2] === node.index) { - rerouteType = l[5]; - break; - } - } - if (rerouteType === "*") { - const t2 = this.externalFrom[node.index]?.[0]; - if (t2) { - rerouteType = t2; - } - } - } - config.forceInput = true; - return { - input: { - required: { - [rerouteType]: [rerouteType, config] - } - }, - output: [rerouteType], - output_name: [], - output_is_list: [] - }; - } - console.warn( - "Skipping virtual node " + node.type + " when building group node " + this.name - ); - } - getInputConfig(node, inputName, seenInputs, config, extra) { - const customConfig = this.nodeData.config?.[node.index]?.input?.[inputName]; - let name = customConfig?.name ?? node.inputs?.find((inp) => inp.name === inputName)?.label ?? inputName; - let key = name; - let prefix = ""; - if (node.type === "PrimitiveNode" && node.title || name in seenInputs) { - prefix = `${node.title ?? node.type} `; - key = name = `${prefix}${inputName}`; - if (name in seenInputs) { - name = `${prefix}${seenInputs[name]} ${inputName}`; - } - } - seenInputs[key] = (seenInputs[key] ?? 1) + 1; - if (inputName === "seed" || inputName === "noise_seed") { - if (!extra) extra = {}; - extra.control_after_generate = `${prefix}control_after_generate`; - } - if (config[0] === "IMAGEUPLOAD") { - if (!extra) extra = {}; - extra.widget = this.oldToNewWidgetMap[node.index]?.[config[1]?.widget ?? "image"] ?? "image"; - } - if (extra) { - config = [config[0], { ...config[1], ...extra }]; - } - return { name, config, customConfig }; - } - processWidgetInputs(inputs, node, inputNames, seenInputs) { - const slots = []; - const converted = /* @__PURE__ */ new Map(); - const widgetMap = this.oldToNewWidgetMap[node.index] = {}; - for (const inputName of inputNames) { - let widgetType = app.getWidgetType(inputs[inputName], inputName); - if (widgetType) { - const convertedIndex = node.inputs?.findIndex( - (inp) => inp.name === inputName && inp.widget?.name === inputName - ); - if (convertedIndex > -1) { - converted.set(convertedIndex, inputName); - widgetMap[inputName] = null; - } else { - const { name, config } = this.getInputConfig( - node, - inputName, - seenInputs, - inputs[inputName] - ); - this.nodeDef.input.required[name] = config; - widgetMap[inputName] = name; - this.newToOldWidgetMap[name] = { node, inputName }; - } - } else { - slots.push(inputName); - } - } - return { converted, slots }; - } - checkPrimitiveConnection(link, inputName, inputs) { - const sourceNode = this.nodeData.nodes[link[0]]; - if (sourceNode.type === "PrimitiveNode") { - const [sourceNodeId, _, targetNodeId, __] = link; - const primitiveDef = this.primitiveDefs[sourceNodeId]; - const targetWidget = inputs[inputName]; - const primitiveConfig = primitiveDef.input.required.value; - const output = { widget: primitiveConfig }; - const config = mergeIfValid( - output, - targetWidget, - false, - null, - primitiveConfig - ); - primitiveConfig[1] = config?.customConfig ?? inputs[inputName][1] ? { ...inputs[inputName][1] } : {}; - let name = this.oldToNewWidgetMap[sourceNodeId]["value"]; - name = name.substr(0, name.length - 6); - primitiveConfig[1].control_after_generate = true; - primitiveConfig[1].control_prefix = name; - let toPrimitive = this.widgetToPrimitive[targetNodeId]; - if (!toPrimitive) { - toPrimitive = this.widgetToPrimitive[targetNodeId] = {}; - } - if (toPrimitive[inputName]) { - toPrimitive[inputName].push(sourceNodeId); - } - toPrimitive[inputName] = sourceNodeId; - let toWidget = this.primitiveToWidget[sourceNodeId]; - if (!toWidget) { - toWidget = this.primitiveToWidget[sourceNodeId] = []; - } - toWidget.push({ nodeId: targetNodeId, inputName }); - } - } - processInputSlots(inputs, node, slots, linksTo, inputMap, seenInputs) { - this.nodeInputs[node.index] = {}; - for (let i = 0; i < slots.length; i++) { - const inputName = slots[i]; - if (linksTo[i]) { - this.checkPrimitiveConnection(linksTo[i], inputName, inputs); - continue; - } - const { name, config, customConfig } = this.getInputConfig( - node, - inputName, - seenInputs, - inputs[inputName] - ); - this.nodeInputs[node.index][inputName] = name; - if (customConfig?.visible === false) continue; - this.nodeDef.input.required[name] = config; - inputMap[i] = this.inputCount++; - } - } - processConvertedWidgets(inputs, node, slots, converted, linksTo, inputMap, seenInputs) { - const convertedSlots = [...converted.keys()].sort().map((k) => converted.get(k)); - for (let i = 0; i < convertedSlots.length; i++) { - const inputName = convertedSlots[i]; - if (linksTo[slots.length + i]) { - this.checkPrimitiveConnection( - linksTo[slots.length + i], - inputName, - inputs - ); - continue; - } - const { name, config } = this.getInputConfig( - node, - inputName, - seenInputs, - inputs[inputName], - { - defaultInput: true - } - ); - this.nodeDef.input.required[name] = config; - this.newToOldWidgetMap[name] = { node, inputName }; - if (!this.oldToNewWidgetMap[node.index]) { - this.oldToNewWidgetMap[node.index] = {}; - } - this.oldToNewWidgetMap[node.index][inputName] = name; - inputMap[slots.length + i] = this.inputCount++; - } - } - #convertedToProcess = []; - processNodeInputs(node, seenInputs, inputs) { - const inputMapping = []; - const inputNames = Object.keys(inputs); - if (!inputNames.length) return; - const { converted, slots } = this.processWidgetInputs( - inputs, - node, - inputNames, - seenInputs - ); - const linksTo = this.linksTo[node.index] ?? {}; - const inputMap = this.oldToNewInputMap[node.index] = {}; - this.processInputSlots(inputs, node, slots, linksTo, inputMap, seenInputs); - this.#convertedToProcess.push( - () => this.processConvertedWidgets( - inputs, - node, - slots, - converted, - linksTo, - inputMap, - seenInputs - ) - ); - return inputMapping; - } - processNodeOutputs(node, seenOutputs, def) { - const oldToNew = this.oldToNewOutputMap[node.index] = {}; - for (let outputId = 0; outputId < def.output.length; outputId++) { - const linksFrom = this.linksFrom[node.index]; - const hasLink = linksFrom?.[outputId] && !this.externalFrom[node.index]?.[outputId]; - const customConfig = this.nodeData.config?.[node.index]?.output?.[outputId]; - const visible = customConfig?.visible ?? !hasLink; - this.outputVisibility.push(visible); - if (!visible) { - continue; - } - oldToNew[outputId] = this.nodeDef.output.length; - this.newToOldOutputMap[this.nodeDef.output.length] = { - node, - slot: outputId - }; - this.nodeDef.output.push(def.output[outputId]); - this.nodeDef.output_is_list.push(def.output_is_list[outputId]); - let label = customConfig?.name; - if (!label) { - label = def.output_name?.[outputId] ?? def.output[outputId]; - const output = node.outputs.find((o) => o.name === label); - if (output?.label) { - label = output.label; - } - } - let name = label; - if (name in seenOutputs) { - const prefix = `${node.title ?? node.type} `; - name = `${prefix}${label}`; - if (name in seenOutputs) { - name = `${prefix}${node.index} ${label}`; - } - } - seenOutputs[name] = 1; - this.nodeDef.output_name.push(name); - } - } - static async registerFromWorkflow(groupNodes, missingNodeTypes) { - for (const g in groupNodes) { - const groupData = groupNodes[g]; - let hasMissing = false; - for (const n of groupData.nodes) { - if (!(n.type in LiteGraph.registered_node_types)) { - missingNodeTypes.push({ - type: n.type, - hint: ` (In group node '${PREFIX}${SEPARATOR}${g}')` - }); - missingNodeTypes.push({ - type: `${PREFIX}${SEPARATOR}` + g, - action: { - text: "Remove from workflow", - callback: /* @__PURE__ */ __name((e) => { - delete groupNodes[g]; - e.target.textContent = "Removed"; - e.target.style.pointerEvents = "none"; - e.target.style.opacity = 0.7; - }, "callback") - } - }); - hasMissing = true; - } - } - if (hasMissing) continue; - const config = new GroupNodeConfig(g, groupData); - await config.registerType(); - } - } -} -class GroupNodeHandler { - static { - __name(this, "GroupNodeHandler"); - } - node; - groupData; - innerNodes; - constructor(node) { - this.node = node; - this.groupData = node.constructor?.nodeData?.[GROUP]; - this.node.setInnerNodes = (innerNodes) => { - this.innerNodes = innerNodes; - for (let innerNodeIndex = 0; innerNodeIndex < this.innerNodes.length; innerNodeIndex++) { - const innerNode = this.innerNodes[innerNodeIndex]; - for (const w of innerNode.widgets ?? []) { - if (w.type === "converted-widget") { - w.serializeValue = w.origSerializeValue; - } - } - innerNode.index = innerNodeIndex; - innerNode.getInputNode = (slot) => { - const externalSlot = this.groupData.oldToNewInputMap[innerNode.index]?.[slot]; - if (externalSlot != null) { - return this.node.getInputNode(externalSlot); - } - const innerLink = this.groupData.linksTo[innerNode.index]?.[slot]; - if (!innerLink) return null; - const inputNode = innerNodes[innerLink[0]]; - if (inputNode.type === "PrimitiveNode") return null; - return inputNode; - }; - innerNode.getInputLink = (slot) => { - const externalSlot = this.groupData.oldToNewInputMap[innerNode.index]?.[slot]; - if (externalSlot != null) { - const linkId = this.node.inputs[externalSlot].link; - let link2 = app.graph.links[linkId]; - link2 = { - ...link2, - target_id: innerNode.id, - target_slot: +slot - }; - return link2; - } - let link = this.groupData.linksTo[innerNode.index]?.[slot]; - if (!link) return null; - link = { - origin_id: innerNodes[link[0]].id, - origin_slot: link[1], - target_id: innerNode.id, - target_slot: +slot - }; - return link; - }; - } - }; - this.node.updateLink = (link) => { - link = { ...link }; - const output = this.groupData.newToOldOutputMap[link.origin_slot]; - let innerNode = this.innerNodes[output.node.index]; - let l; - while (innerNode?.type === "Reroute") { - l = innerNode.getInputLink(0); - innerNode = innerNode.getInputNode(0); - } - if (!innerNode) { - return null; - } - if (l && GroupNodeHandler.isGroupNode(innerNode)) { - return innerNode.updateLink(l); - } - link.origin_id = innerNode.id; - link.origin_slot = l?.origin_slot ?? output.slot; - return link; - }; - this.node.getInnerNodes = () => { - if (!this.innerNodes) { - this.node.setInnerNodes( - this.groupData.nodeData.nodes.map((n, i) => { - const innerNode = LiteGraph.createNode(n.type); - innerNode.configure(n); - innerNode.id = `${this.node.id}:${i}`; - return innerNode; - }) - ); - } - this.updateInnerWidgets(); - return this.innerNodes; - }; - this.node.recreate = async () => { - const id2 = this.node.id; - const sz = this.node.size; - const nodes = this.node.convertToNodes(); - const groupNode = LiteGraph.createNode(this.node.type); - groupNode.id = id2; - groupNode.setInnerNodes(nodes); - groupNode[GROUP].populateWidgets(); - app.graph.add(groupNode); - groupNode.size = [ - Math.max(groupNode.size[0], sz[0]), - Math.max(groupNode.size[1], sz[1]) - ]; - const builder = new GroupNodeBuilder(nodes); - const nodeData = builder.getNodeData(); - groupNode[GROUP].groupData.nodeData.links = nodeData.links; - groupNode[GROUP].replaceNodes(nodes); - return groupNode; - }; - this.node.convertToNodes = () => { - const addInnerNodes = /* @__PURE__ */ __name(() => { - const c = { ...this.groupData.nodeData }; - c.nodes = [...c.nodes]; - const innerNodes = this.node.getInnerNodes(); - let ids = []; - for (let i = 0; i < c.nodes.length; i++) { - let id2 = innerNodes?.[i]?.id; - if (id2 == null || isNaN(id2)) { - id2 = void 0; - } else { - ids.push(id2); - } - c.nodes[i] = { ...c.nodes[i], id: id2 }; - } - deserialiseAndCreate(JSON.stringify(c), app.canvas); - const [x, y] = this.node.pos; - let top; - let left; - const selectedIds = ids.length ? ids : Object.keys(app.canvas.selected_nodes); - const newNodes = []; - for (let i = 0; i < selectedIds.length; i++) { - const id2 = selectedIds[i]; - const newNode = app.graph.getNodeById(id2); - const innerNode = innerNodes[i]; - newNodes.push(newNode); - if (left == null || newNode.pos[0] < left) { - left = newNode.pos[0]; - } - if (top == null || newNode.pos[1] < top) { - top = newNode.pos[1]; - } - if (!newNode.widgets) continue; - const map = this.groupData.oldToNewWidgetMap[innerNode.index]; - if (map) { - const widgets = Object.keys(map); - for (const oldName of widgets) { - const newName = map[oldName]; - if (!newName) continue; - const widgetIndex = this.node.widgets.findIndex( - (w) => w.name === newName - ); - if (widgetIndex === -1) continue; - if (innerNode.type === "PrimitiveNode") { - for (let i2 = 0; i2 < newNode.widgets.length; i2++) { - newNode.widgets[i2].value = this.node.widgets[widgetIndex + i2].value; - } - } else { - const outerWidget = this.node.widgets[widgetIndex]; - const newWidget = newNode.widgets.find( - (w) => w.name === oldName - ); - if (!newWidget) continue; - newWidget.value = outerWidget.value; - for (let w = 0; w < outerWidget.linkedWidgets?.length; w++) { - newWidget.linkedWidgets[w].value = outerWidget.linkedWidgets[w].value; - } - } - } - } - } - for (const newNode of newNodes) { - newNode.pos[0] -= left - x; - newNode.pos[1] -= top - y; - } - return { newNodes, selectedIds }; - }, "addInnerNodes"); - const reconnectInputs = /* @__PURE__ */ __name((selectedIds) => { - for (const innerNodeIndex in this.groupData.oldToNewInputMap) { - const id2 = selectedIds[innerNodeIndex]; - const newNode = app.graph.getNodeById(id2); - const map = this.groupData.oldToNewInputMap[innerNodeIndex]; - for (const innerInputId in map) { - const groupSlotId = map[innerInputId]; - if (groupSlotId == null) continue; - const slot = node.inputs[groupSlotId]; - if (slot.link == null) continue; - const link = app.graph.links[slot.link]; - if (!link) continue; - const originNode = app.graph.getNodeById(link.origin_id); - originNode.connect(link.origin_slot, newNode, +innerInputId); - } - } - }, "reconnectInputs"); - const reconnectOutputs = /* @__PURE__ */ __name((selectedIds) => { - for (let groupOutputId = 0; groupOutputId < node.outputs?.length; groupOutputId++) { - const output = node.outputs[groupOutputId]; - if (!output.links) continue; - const links = [...output.links]; - for (const l of links) { - const slot = this.groupData.newToOldOutputMap[groupOutputId]; - const link = app.graph.links[l]; - const targetNode = app.graph.getNodeById(link.target_id); - const newNode = app.graph.getNodeById(selectedIds[slot.node.index]); - newNode.connect(slot.slot, targetNode, link.target_slot); - } - } - }, "reconnectOutputs"); - app.canvas.emitBeforeChange(); - try { - const { newNodes, selectedIds } = addInnerNodes(); - reconnectInputs(selectedIds); - reconnectOutputs(selectedIds); - app.graph.remove(this.node); - return newNodes; - } finally { - app.canvas.emitAfterChange(); - } - }; - const getExtraMenuOptions = this.node.getExtraMenuOptions; - this.node.getExtraMenuOptions = function(_, options) { - getExtraMenuOptions?.apply(this, arguments); - let optionIndex = options.findIndex((o) => o.content === "Outputs"); - if (optionIndex === -1) optionIndex = options.length; - else optionIndex++; - options.splice( - optionIndex, - 0, - null, - { - content: "Convert to nodes", - // @ts-expect-error - callback: /* @__PURE__ */ __name(() => { - return this.convertToNodes(); - }, "callback") - }, - { - content: "Manage Group Node", - callback: /* @__PURE__ */ __name(() => manageGroupNodes(this.type), "callback") - } - ); - }; - const onDrawTitleBox = this.node.onDrawTitleBox; - this.node.onDrawTitleBox = function(ctx, height, size, scale) { - onDrawTitleBox?.apply(this, arguments); - const fill2 = ctx.fillStyle; - ctx.beginPath(); - ctx.rect(11, -height + 11, 2, 2); - ctx.rect(14, -height + 11, 2, 2); - ctx.rect(17, -height + 11, 2, 2); - ctx.rect(11, -height + 14, 2, 2); - ctx.rect(14, -height + 14, 2, 2); - ctx.rect(17, -height + 14, 2, 2); - ctx.rect(11, -height + 17, 2, 2); - ctx.rect(14, -height + 17, 2, 2); - ctx.rect(17, -height + 17, 2, 2); - ctx.fillStyle = this.boxcolor || LiteGraph.NODE_DEFAULT_BOXCOLOR; - ctx.fill(); - ctx.fillStyle = fill2; - }; - const onDrawForeground = node.onDrawForeground; - const groupData = this.groupData.nodeData; - node.onDrawForeground = function(ctx) { - const r = onDrawForeground?.apply?.(this, arguments); - if (+app.runningNodeId === this.id && this.runningInternalNodeId !== null) { - const n = groupData.nodes[this.runningInternalNodeId]; - if (!n) return; - const message = `Running ${n.title || n.type} (${this.runningInternalNodeId}/${groupData.nodes.length})`; - ctx.save(); - ctx.font = "12px sans-serif"; - const sz = ctx.measureText(message); - ctx.fillStyle = node.boxcolor || LiteGraph.NODE_DEFAULT_BOXCOLOR; - ctx.beginPath(); - ctx.roundRect( - 0, - -LiteGraph.NODE_TITLE_HEIGHT - 20, - sz.width + 12, - 20, - 5 - ); - ctx.fill(); - ctx.fillStyle = "#fff"; - ctx.fillText(message, 6, -LiteGraph.NODE_TITLE_HEIGHT - 6); - ctx.restore(); - } - }; - const onExecutionStart = this.node.onExecutionStart; - this.node.onExecutionStart = function() { - this.resetExecution = true; - return onExecutionStart?.apply(this, arguments); - }; - const self2 = this; - const onNodeCreated = this.node.onNodeCreated; - this.node.onNodeCreated = function() { - if (!this.widgets) { - return; - } - const config = self2.groupData.nodeData.config; - if (config) { - for (const n in config) { - const inputs = config[n]?.input; - for (const w in inputs) { - if (inputs[w].visible !== false) continue; - const widgetName = self2.groupData.oldToNewWidgetMap[n][w]; - const widget = this.widgets.find((w2) => w2.name === widgetName); - if (widget) { - widget.type = "hidden"; - widget.computeSize = () => [0, -4]; - } - } - } - } - return onNodeCreated?.apply(this, arguments); - }; - function handleEvent(type, getId, getEvent) { - const handler = /* @__PURE__ */ __name(({ detail }) => { - const id2 = getId(detail); - if (!id2) return; - const node2 = app.graph.getNodeById(id2); - if (node2) return; - const innerNodeIndex = this.innerNodes?.findIndex((n) => n.id == id2); - if (innerNodeIndex > -1) { - this.node.runningInternalNodeId = innerNodeIndex; - api.dispatchCustomEvent( - type, - getEvent(detail, `${this.node.id}`, this.node) - ); - } - }, "handler"); - api.addEventListener(type, handler); - return handler; - } - __name(handleEvent, "handleEvent"); - const executing = handleEvent.call( - this, - "executing", - (d) => d, - (d, id2, node2) => id2 - ); - const executed = handleEvent.call( - this, - "executed", - (d) => d?.display_node || d?.node, - (d, id2, node2) => ({ - ...d, - node: id2, - display_node: id2, - merge: !node2.resetExecution - }) - ); - const onRemoved = node.onRemoved; - this.node.onRemoved = function() { - onRemoved?.apply(this, arguments); - api.removeEventListener("executing", executing); - api.removeEventListener("executed", executed); - }; - this.node.refreshComboInNode = (defs) => { - for (const widgetName in this.groupData.newToOldWidgetMap) { - const widget = this.node.widgets.find((w) => w.name === widgetName); - if (widget?.type === "combo") { - const old = this.groupData.newToOldWidgetMap[widgetName]; - const def = defs[old.node.type]; - const input = def?.input?.required?.[old.inputName] ?? def?.input?.optional?.[old.inputName]; - if (!input) continue; - widget.options.values = input[0]; - if (old.inputName !== "image" && // @ts-expect-error Widget values - !widget.options.values.includes(widget.value)) { - widget.value = widget.options.values[0]; - widget.callback(widget.value); - } - } - } - }; - } - updateInnerWidgets() { - for (const newWidgetName in this.groupData.newToOldWidgetMap) { - const newWidget = this.node.widgets.find((w) => w.name === newWidgetName); - if (!newWidget) continue; - const newValue = newWidget.value; - const old = this.groupData.newToOldWidgetMap[newWidgetName]; - let innerNode = this.innerNodes[old.node.index]; - if (innerNode.type === "PrimitiveNode") { - innerNode.primitiveValue = newValue; - const primitiveLinked = this.groupData.primitiveToWidget[old.node.index]; - for (const linked of primitiveLinked ?? []) { - const node = this.innerNodes[linked.nodeId]; - const widget2 = node.widgets.find((w) => w.name === linked.inputName); - if (widget2) { - widget2.value = newValue; - } - } - continue; - } else if (innerNode.type === "Reroute") { - const rerouteLinks = this.groupData.linksFrom[old.node.index]; - if (rerouteLinks) { - for (const [_, , targetNodeId, targetSlot] of rerouteLinks["0"]) { - const node = this.innerNodes[targetNodeId]; - const input = node.inputs[targetSlot]; - if (input.widget) { - const widget2 = node.widgets?.find( - (w) => w.name === input.widget.name - ); - if (widget2) { - widget2.value = newValue; - } - } - } - } - } - const widget = innerNode.widgets?.find((w) => w.name === old.inputName); - if (widget) { - widget.value = newValue; - } - } - } - populatePrimitive(node, nodeId, oldName, i, linkedShift) { - const primitiveId = this.groupData.widgetToPrimitive[nodeId]?.[oldName]; - if (primitiveId == null) return; - const targetWidgetName = this.groupData.oldToNewWidgetMap[primitiveId]["value"]; - const targetWidgetIndex = this.node.widgets.findIndex( - (w) => w.name === targetWidgetName - ); - if (targetWidgetIndex > -1) { - const primitiveNode = this.innerNodes[primitiveId]; - let len = primitiveNode.widgets.length; - if (len - 1 !== this.node.widgets[targetWidgetIndex].linkedWidgets?.length) { - len = 1; - } - for (let i2 = 0; i2 < len; i2++) { - this.node.widgets[targetWidgetIndex + i2].value = primitiveNode.widgets[i2].value; - } - } - return true; - } - populateReroute(node, nodeId, map) { - if (node.type !== "Reroute") return; - const link = this.groupData.linksFrom[nodeId]?.[0]?.[0]; - if (!link) return; - const [, , targetNodeId, targetNodeSlot] = link; - const targetNode = this.groupData.nodeData.nodes[targetNodeId]; - const inputs = targetNode.inputs; - const targetWidget = inputs?.[targetNodeSlot]?.widget; - if (!targetWidget) return; - const offset = inputs.length - (targetNode.widgets_values?.length ?? 0); - const v = targetNode.widgets_values?.[targetNodeSlot - offset]; - if (v == null) return; - const widgetName = Object.values(map)[0]; - const widget = this.node.widgets.find((w) => w.name === widgetName); - if (widget) { - widget.value = v; - } - } - populateWidgets() { - if (!this.node.widgets) return; - for (let nodeId = 0; nodeId < this.groupData.nodeData.nodes.length; nodeId++) { - const node = this.groupData.nodeData.nodes[nodeId]; - const map = this.groupData.oldToNewWidgetMap[nodeId] ?? {}; - const widgets = Object.keys(map); - if (!node.widgets_values?.length) { - this.populateReroute(node, nodeId, map); - continue; - } - let linkedShift = 0; - for (let i = 0; i < widgets.length; i++) { - const oldName = widgets[i]; - const newName = map[oldName]; - const widgetIndex = this.node.widgets.findIndex( - (w) => w.name === newName - ); - const mainWidget = this.node.widgets[widgetIndex]; - if (this.populatePrimitive(node, nodeId, oldName, i, linkedShift) || widgetIndex === -1) { - const innerWidget = this.innerNodes[nodeId].widgets?.find( - (w) => w.name === oldName - ); - linkedShift += innerWidget?.linkedWidgets?.length ?? 0; - } - if (widgetIndex === -1) { - continue; - } - mainWidget.value = node.widgets_values[i + linkedShift]; - for (let w = 0; w < mainWidget.linkedWidgets?.length; w++) { - this.node.widgets[widgetIndex + w + 1].value = node.widgets_values[i + ++linkedShift]; - } - } - } - } - replaceNodes(nodes) { - let top; - let left; - for (let i = 0; i < nodes.length; i++) { - const node = nodes[i]; - if (left == null || node.pos[0] < left) { - left = node.pos[0]; - } - if (top == null || node.pos[1] < top) { - top = node.pos[1]; - } - this.linkOutputs(node, i); - app.graph.remove(node); - } - this.linkInputs(); - this.node.pos = [left, top]; - } - linkOutputs(originalNode, nodeId) { - if (!originalNode.outputs) return; - for (const output of originalNode.outputs) { - if (!output.links) continue; - const links = [...output.links]; - for (const l of links) { - const link = app.graph.links[l]; - if (!link) continue; - const targetNode = app.graph.getNodeById(link.target_id); - const newSlot = this.groupData.oldToNewOutputMap[nodeId]?.[link.origin_slot]; - if (newSlot != null) { - this.node.connect(newSlot, targetNode, link.target_slot); - } - } - } - } - linkInputs() { - for (const link of this.groupData.nodeData.links ?? []) { - const [, originSlot, targetId, targetSlot, actualOriginId] = link; - const originNode = app.graph.getNodeById(actualOriginId); - if (!originNode) continue; - originNode.connect( - originSlot, - // @ts-expect-error Valid - uses deprecated interface. Required check: if (graph.getNodeById(this.node.id) !== this.node) report() - this.node.id, - this.groupData.oldToNewInputMap[targetId][targetSlot] - ); - } - } - static getGroupData(node) { - return (node.nodeData ?? node.constructor?.nodeData)?.[GROUP]; - } - static isGroupNode(node) { - return !!node.constructor?.nodeData?.[GROUP]; - } - static async fromNodes(nodes) { - const builder = new GroupNodeBuilder(nodes); - const res = await builder.build(); - if (!res) return; - const { name, nodeData } = res; - const config = new GroupNodeConfig(name, nodeData); - await config.registerType(); - const groupNode = LiteGraph.createNode(`${PREFIX}${SEPARATOR}${name}`); - groupNode.setInnerNodes(builder.nodes); - groupNode[GROUP].populateWidgets(); - app.graph.add(groupNode); - groupNode[GROUP].replaceNodes(builder.nodes); - return groupNode; - } -} -function addConvertToGroupOptions() { - function addConvertOption(options, index) { - const selected = Object.values(app.canvas.selected_nodes ?? {}); - const disabled = selected.length < 2 || selected.find((n) => GroupNodeHandler.isGroupNode(n)); - options.splice(index + 1, null, { - content: `Convert to Group Node`, - disabled, - callback: convertSelectedNodesToGroupNode - }); - } - __name(addConvertOption, "addConvertOption"); - function addManageOption(options, index) { - const groups = app.graph.extra?.groupNodes; - const disabled = !groups || !Object.keys(groups).length; - options.splice(index + 1, null, { - content: `Manage Group Nodes`, - disabled, - callback: /* @__PURE__ */ __name(() => manageGroupNodes(), "callback") - }); - } - __name(addManageOption, "addManageOption"); - const getCanvasMenuOptions = LGraphCanvas.prototype.getCanvasMenuOptions; - LGraphCanvas.prototype.getCanvasMenuOptions = function() { - const options = getCanvasMenuOptions.apply(this, arguments); - const index = options.findIndex((o) => o?.content === "Add Group") + 1 || options.length; - addConvertOption(options, index); - addManageOption(options, index + 1); - return options; - }; - const getNodeMenuOptions = LGraphCanvas.prototype.getNodeMenuOptions; - LGraphCanvas.prototype.getNodeMenuOptions = function(node) { - const options = getNodeMenuOptions.apply(this, arguments); - if (!GroupNodeHandler.isGroupNode(node)) { - const index = options.findIndex((o) => o?.content === "Outputs") + 1 || options.length - 1; - addConvertOption(options, index); - } - return options; - }; -} -__name(addConvertToGroupOptions, "addConvertToGroupOptions"); -const replaceLegacySeparators = /* @__PURE__ */ __name((nodes) => { - for (const node of nodes) { - if (typeof node.type === "string" && node.type.startsWith("workflow/")) { - node.type = node.type.replace(/^workflow\//, `${PREFIX}${SEPARATOR}`); - } - } -}, "replaceLegacySeparators"); -async function convertSelectedNodesToGroupNode() { - const nodes = Object.values(app.canvas.selected_nodes ?? {}); - if (nodes.length === 0) { - throw new Error("No nodes selected"); - } - if (nodes.length === 1) { - throw new Error("Please select multiple nodes to convert to group node"); - } - if (nodes.some((n) => GroupNodeHandler.isGroupNode(n))) { - throw new Error("Selected nodes contain a group node"); - } - return await GroupNodeHandler.fromNodes(nodes); -} -__name(convertSelectedNodesToGroupNode, "convertSelectedNodesToGroupNode"); -function ungroupSelectedGroupNodes() { - const nodes = Object.values(app.canvas.selected_nodes ?? {}); - for (const node of nodes) { - if (GroupNodeHandler.isGroupNode(node)) { - node.convertToNodes?.(); - } - } -} -__name(ungroupSelectedGroupNodes, "ungroupSelectedGroupNodes"); -function manageGroupNodes(type) { - new ManageGroupDialog(app).show(type); -} -__name(manageGroupNodes, "manageGroupNodes"); -const id$1 = "Comfy.GroupNode"; -let globalDefs; -const ext = { - name: id$1, - commands: [ - { - id: "Comfy.GroupNode.ConvertSelectedNodesToGroupNode", - label: "Convert selected nodes to group node", - icon: "pi pi-sitemap", - versionAdded: "1.3.17", - function: convertSelectedNodesToGroupNode - }, - { - id: "Comfy.GroupNode.UngroupSelectedGroupNodes", - label: "Ungroup selected group nodes", - icon: "pi pi-sitemap", - versionAdded: "1.3.17", - function: ungroupSelectedGroupNodes - }, - { - id: "Comfy.GroupNode.ManageGroupNodes", - label: "Manage group nodes", - icon: "pi pi-cog", - versionAdded: "1.3.17", - function: manageGroupNodes - } - ], - keybindings: [ - { - commandId: "Comfy.GroupNode.ConvertSelectedNodesToGroupNode", - combo: { - alt: true, - key: "g" - } - }, - { - commandId: "Comfy.GroupNode.UngroupSelectedGroupNodes", - combo: { - alt: true, - shift: true, - key: "G" - } - } - ], - setup() { - addConvertToGroupOptions(); - }, - async beforeConfigureGraph(graphData, missingNodeTypes) { - const nodes = graphData?.extra?.groupNodes; - if (nodes) { - replaceLegacySeparators(graphData.nodes); - await GroupNodeConfig.registerFromWorkflow(nodes, missingNodeTypes); - } - }, - addCustomNodeDefs(defs) { - globalDefs = defs; - }, - nodeCreated(node) { - if (GroupNodeHandler.isGroupNode(node)) { - node[GROUP] = new GroupNodeHandler(node); - if (node.title && node[GROUP]?.groupData?.nodeData) { - Workflow.storeGroupNode(node.title, node[GROUP].groupData.nodeData); - } - } - }, - async refreshComboInNodes(defs) { - Object.assign(globalDefs, defs); - const nodes = app.graph.extra?.groupNodes; - if (nodes) { - await GroupNodeConfig.registerFromWorkflow(nodes, {}); - } - } -}; -app.registerExtension(ext); -window.comfyAPI = window.comfyAPI || {}; -window.comfyAPI.groupNode = window.comfyAPI.groupNode || {}; -window.comfyAPI.groupNode.GroupNodeConfig = GroupNodeConfig; -window.comfyAPI.groupNode.GroupNodeHandler = GroupNodeHandler; -function setNodeMode(node, mode) { - node.mode = mode; - node.graph?.change(); -} -__name(setNodeMode, "setNodeMode"); -function addNodesToGroup(group, items) { - const padding = useSettingStore().get("Comfy.GroupSelectedNodes.Padding"); - group.resizeTo([...group.children, ...items], padding); -} -__name(addNodesToGroup, "addNodesToGroup"); -app.registerExtension({ - name: "Comfy.GroupOptions", - setup() { - const orig = LGraphCanvas.prototype.getCanvasMenuOptions; - LGraphCanvas.prototype.getCanvasMenuOptions = function() { - const options = orig.apply(this, arguments); - const group = this.graph.getGroupOnPos( - this.graph_mouse[0], - this.graph_mouse[1] - ); - if (!group) { - options.push({ - content: "Add Group For Selected Nodes", - disabled: !this.selectedItems?.size, - callback: /* @__PURE__ */ __name(() => { - const group2 = new LGraphGroup(); - addNodesToGroup(group2, this.selectedItems); - this.graph.add(group2); - this.graph.change(); - }, "callback") - }); - return options; - } - group.recomputeInsideNodes(); - const nodesInGroup = group.nodes; - options.push({ - content: "Add Selected Nodes To Group", - disabled: !this.selectedItems?.size, - callback: /* @__PURE__ */ __name(() => { - addNodesToGroup(group, this.selectedItems); - this.graph.change(); - }, "callback") - }); - if (nodesInGroup.length === 0) { - return options; - } else { - options.push(null); - } - let allNodesAreSameMode = true; - for (let i = 1; i < nodesInGroup.length; i++) { - if (nodesInGroup[i].mode !== nodesInGroup[0].mode) { - allNodesAreSameMode = false; - break; - } - } - options.push({ - content: "Fit Group To Nodes", - callback: /* @__PURE__ */ __name(() => { - group.recomputeInsideNodes(); - const padding = useSettingStore().get( - "Comfy.GroupSelectedNodes.Padding" - ); - group.resizeTo(group.children, padding); - this.graph.change(); - }, "callback") - }); - options.push({ - content: "Select Nodes", - callback: /* @__PURE__ */ __name(() => { - this.selectNodes(nodesInGroup); - this.graph.change(); - this.canvas.focus(); - }, "callback") - }); - if (allNodesAreSameMode) { - const mode = nodesInGroup[0].mode; - switch (mode) { - case 0: - options.push({ - content: "Set Group Nodes to Never", - callback: /* @__PURE__ */ __name(() => { - for (const node of nodesInGroup) { - setNodeMode(node, 2); - } - }, "callback") - }); - options.push({ - content: "Bypass Group Nodes", - callback: /* @__PURE__ */ __name(() => { - for (const node of nodesInGroup) { - setNodeMode(node, 4); - } - }, "callback") - }); - break; - case 2: - options.push({ - content: "Set Group Nodes to Always", - callback: /* @__PURE__ */ __name(() => { - for (const node of nodesInGroup) { - setNodeMode(node, 0); - } - }, "callback") - }); - options.push({ - content: "Bypass Group Nodes", - callback: /* @__PURE__ */ __name(() => { - for (const node of nodesInGroup) { - setNodeMode(node, 4); - } - }, "callback") - }); - break; - case 4: - options.push({ - content: "Set Group Nodes to Always", - callback: /* @__PURE__ */ __name(() => { - for (const node of nodesInGroup) { - setNodeMode(node, 0); - } - }, "callback") - }); - options.push({ - content: "Set Group Nodes to Never", - callback: /* @__PURE__ */ __name(() => { - for (const node of nodesInGroup) { - setNodeMode(node, 2); - } - }, "callback") - }); - break; - default: - options.push({ - content: "Set Group Nodes to Always", - callback: /* @__PURE__ */ __name(() => { - for (const node of nodesInGroup) { - setNodeMode(node, 0); - } - }, "callback") - }); - options.push({ - content: "Set Group Nodes to Never", - callback: /* @__PURE__ */ __name(() => { - for (const node of nodesInGroup) { - setNodeMode(node, 2); - } - }, "callback") - }); - options.push({ - content: "Bypass Group Nodes", - callback: /* @__PURE__ */ __name(() => { - for (const node of nodesInGroup) { - setNodeMode(node, 4); - } - }, "callback") - }); - break; - } - } else { - options.push({ - content: "Set Group Nodes to Always", - callback: /* @__PURE__ */ __name(() => { - for (const node of nodesInGroup) { - setNodeMode(node, 0); - } - }, "callback") - }); - options.push({ - content: "Set Group Nodes to Never", - callback: /* @__PURE__ */ __name(() => { - for (const node of nodesInGroup) { - setNodeMode(node, 2); - } - }, "callback") - }); - options.push({ - content: "Bypass Group Nodes", - callback: /* @__PURE__ */ __name(() => { - for (const node of nodesInGroup) { - setNodeMode(node, 4); - } - }, "callback") - }); - } - return options; - }; - } -}); -class Load3dUtils { - static { - __name(this, "Load3dUtils"); - } - static async 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(); - } - static async uploadFile(load3d, file2, fileInput) { - let uploadPath; - try { - const body = new FormData(); - body.append("image", file2); - body.append("subfolder", "3d"); - 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; - uploadPath = path; - const modelUrl = api.apiURL( - this.getResourceURL(...this.splitFilePath(path), "input") - ); - await load3d.loadModel(modelUrl, file2.name); - const fileExt = file2.name.split(".").pop()?.toLowerCase(); - if (fileExt === "obj" && fileInput?.files) { - try { - const mtlFile = Array.from(fileInput.files).find( - (f) => f.name.toLowerCase().endsWith(".mtl") - ); - if (mtlFile) { - const mtlFormData = new FormData(); - mtlFormData.append("image", mtlFile); - mtlFormData.append("subfolder", "3d"); - await api.fetchApi("/upload/image", { - method: "POST", - body: mtlFormData - }); - } - } catch (mtlError) { - console.warn("Failed to upload MTL file:", mtlError); - } - } - } else { - useToastStore().addAlert(resp.status + " - " + resp.statusText); - } - } catch (error) { - console.error("Upload error:", error); - useToastStore().addAlert( - error instanceof Error ? error.message : "Upload failed" - ); - } - return uploadPath; - } - static splitFilePath(path) { - const folder_separator = path.lastIndexOf("/"); - if (folder_separator === -1) { - return ["", path]; - } - return [ - path.substring(0, folder_separator), - path.substring(folder_separator + 1) - ]; - } - static getResourceURL(subfolder, filename, type = "input") { - const params = [ - "filename=" + encodeURIComponent(filename), - "type=" + type, - "subfolder=" + subfolder, - app.getRandParam().substring(1) - ].join("&"); - return `/view?${params}`; - } -} -class Load3DConfiguration { - static { - __name(this, "Load3DConfiguration"); - } - constructor(load3d) { - this.load3d = load3d; - } - configure(loadFolder, modelWidget, material, upDirection, cameraState, width = null, height = null, postModelUpdateFunc) { - this.setupModelHandling( - modelWidget, - loadFolder, - cameraState, - postModelUpdateFunc - ); - this.setupMaterial(material); - this.setupDirection(upDirection); - this.setupTargetSize(width, height); - this.setupDefaultProperties(); - } - setupTargetSize(width, height) { - if (width && height) { - this.load3d.setTargetSize(width.value, height.value); - width.callback = (value) => { - this.load3d.setTargetSize(value, height.value); - }; - height.callback = (value) => { - this.load3d.setTargetSize(width.value, value); - }; - } - } - setupModelHandling(modelWidget, loadFolder, cameraState, postModelUpdateFunc) { - const onModelWidgetUpdate = this.createModelUpdateHandler( - loadFolder, - cameraState, - postModelUpdateFunc - ); - if (modelWidget.value) { - onModelWidgetUpdate(modelWidget.value); - } - modelWidget.callback = onModelWidgetUpdate; - } - setupMaterial(material) { - material.callback = (value) => { - this.load3d.setMaterialMode(value); - }; - this.load3d.setMaterialMode( - material.value - ); - } - setupDirection(upDirection) { - upDirection.callback = (value) => { - this.load3d.setUpDirection(value); - }; - this.load3d.setUpDirection( - upDirection.value - ); - } - setupDefaultProperties() { - const cameraType = this.load3d.loadNodeProperty( - "Camera Type", - "perspective" - ); - this.load3d.toggleCamera(cameraType); - const showGrid = this.load3d.loadNodeProperty("Show Grid", true); - this.load3d.toggleGrid(showGrid); - const bgColor = this.load3d.loadNodeProperty("Background Color", "#282828"); - this.load3d.setBackgroundColor(bgColor); - const lightIntensity = this.load3d.loadNodeProperty("Light Intensity", "5"); - this.load3d.setLightIntensity(lightIntensity); - const fov2 = this.load3d.loadNodeProperty("FOV", "75"); - this.load3d.setFOV(fov2); - } - createModelUpdateHandler(loadFolder, cameraState, postModelUpdateFunc) { - let isFirstLoad = true; - return async (value) => { - if (!value) return; - const filename = value; - const modelUrl = api.apiURL( - Load3dUtils.getResourceURL( - ...Load3dUtils.splitFilePath(filename), - loadFolder - ) - ); - await this.load3d.loadModel(modelUrl, filename); - if (postModelUpdateFunc) { - postModelUpdateFunc(this.load3d); - } - if (isFirstLoad && cameraState && typeof cameraState === "object") { - try { - this.load3d.setCameraState(cameraState); - } catch (error) { - console.warn("Failed to restore camera state:", error); - } - isFirstLoad = false; - } - }; - } -} -/** - * @license - * Copyright 2010-2024 Three.js Authors - * SPDX-License-Identifier: MIT - */ -const REVISION = "170"; -const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }; -const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }; -const CullFaceNone = 0; -const CullFaceBack = 1; -const CullFaceFront = 2; -const CullFaceFrontBack = 3; -const BasicShadowMap = 0; -const PCFShadowMap = 1; -const PCFSoftShadowMap = 2; -const VSMShadowMap = 3; -const FrontSide = 0; -const BackSide = 1; -const DoubleSide = 2; -const NoBlending = 0; -const NormalBlending = 1; -const AdditiveBlending = 2; -const SubtractiveBlending = 3; -const MultiplyBlending = 4; -const CustomBlending = 5; -const AddEquation = 100; -const SubtractEquation = 101; -const ReverseSubtractEquation = 102; -const MinEquation = 103; -const MaxEquation = 104; -const ZeroFactor = 200; -const OneFactor = 201; -const SrcColorFactor = 202; -const OneMinusSrcColorFactor = 203; -const SrcAlphaFactor = 204; -const OneMinusSrcAlphaFactor = 205; -const DstAlphaFactor = 206; -const OneMinusDstAlphaFactor = 207; -const DstColorFactor = 208; -const OneMinusDstColorFactor = 209; -const SrcAlphaSaturateFactor = 210; -const ConstantColorFactor = 211; -const OneMinusConstantColorFactor = 212; -const ConstantAlphaFactor = 213; -const OneMinusConstantAlphaFactor = 214; -const NeverDepth = 0; -const AlwaysDepth = 1; -const LessDepth = 2; -const LessEqualDepth = 3; -const EqualDepth = 4; -const GreaterEqualDepth = 5; -const GreaterDepth = 6; -const NotEqualDepth = 7; -const MultiplyOperation = 0; -const MixOperation = 1; -const AddOperation = 2; -const NoToneMapping = 0; -const LinearToneMapping = 1; -const ReinhardToneMapping = 2; -const CineonToneMapping = 3; -const ACESFilmicToneMapping = 4; -const CustomToneMapping = 5; -const AgXToneMapping = 6; -const NeutralToneMapping = 7; -const AttachedBindMode = "attached"; -const DetachedBindMode = "detached"; -const UVMapping = 300; -const CubeReflectionMapping = 301; -const CubeRefractionMapping = 302; -const EquirectangularReflectionMapping = 303; -const EquirectangularRefractionMapping = 304; -const CubeUVReflectionMapping = 306; -const RepeatWrapping = 1e3; -const ClampToEdgeWrapping = 1001; -const MirroredRepeatWrapping = 1002; -const NearestFilter = 1003; -const NearestMipmapNearestFilter = 1004; -const NearestMipMapNearestFilter = 1004; -const NearestMipmapLinearFilter = 1005; -const NearestMipMapLinearFilter = 1005; -const LinearFilter = 1006; -const LinearMipmapNearestFilter = 1007; -const LinearMipMapNearestFilter = 1007; -const LinearMipmapLinearFilter = 1008; -const LinearMipMapLinearFilter = 1008; -const UnsignedByteType = 1009; -const ByteType = 1010; -const ShortType = 1011; -const UnsignedShortType = 1012; -const IntType = 1013; -const UnsignedIntType = 1014; -const FloatType = 1015; -const HalfFloatType = 1016; -const UnsignedShort4444Type = 1017; -const UnsignedShort5551Type = 1018; -const UnsignedInt248Type = 1020; -const UnsignedInt5999Type = 35902; -const AlphaFormat = 1021; -const RGBFormat = 1022; -const RGBAFormat = 1023; -const LuminanceFormat = 1024; -const LuminanceAlphaFormat = 1025; -const DepthFormat = 1026; -const DepthStencilFormat = 1027; -const RedFormat = 1028; -const RedIntegerFormat = 1029; -const RGFormat = 1030; -const RGIntegerFormat = 1031; -const RGBIntegerFormat = 1032; -const RGBAIntegerFormat = 1033; -const RGB_S3TC_DXT1_Format = 33776; -const RGBA_S3TC_DXT1_Format = 33777; -const RGBA_S3TC_DXT3_Format = 33778; -const RGBA_S3TC_DXT5_Format = 33779; -const RGB_PVRTC_4BPPV1_Format = 35840; -const RGB_PVRTC_2BPPV1_Format = 35841; -const RGBA_PVRTC_4BPPV1_Format = 35842; -const RGBA_PVRTC_2BPPV1_Format = 35843; -const RGB_ETC1_Format = 36196; -const RGB_ETC2_Format = 37492; -const RGBA_ETC2_EAC_Format = 37496; -const RGBA_ASTC_4x4_Format = 37808; -const RGBA_ASTC_5x4_Format = 37809; -const RGBA_ASTC_5x5_Format = 37810; -const RGBA_ASTC_6x5_Format = 37811; -const RGBA_ASTC_6x6_Format = 37812; -const RGBA_ASTC_8x5_Format = 37813; -const RGBA_ASTC_8x6_Format = 37814; -const RGBA_ASTC_8x8_Format = 37815; -const RGBA_ASTC_10x5_Format = 37816; -const RGBA_ASTC_10x6_Format = 37817; -const RGBA_ASTC_10x8_Format = 37818; -const RGBA_ASTC_10x10_Format = 37819; -const RGBA_ASTC_12x10_Format = 37820; -const RGBA_ASTC_12x12_Format = 37821; -const RGBA_BPTC_Format = 36492; -const RGB_BPTC_SIGNED_Format = 36494; -const RGB_BPTC_UNSIGNED_Format = 36495; -const RED_RGTC1_Format = 36283; -const SIGNED_RED_RGTC1_Format = 36284; -const RED_GREEN_RGTC2_Format = 36285; -const SIGNED_RED_GREEN_RGTC2_Format = 36286; -const LoopOnce = 2200; -const LoopRepeat = 2201; -const LoopPingPong = 2202; -const InterpolateDiscrete = 2300; -const InterpolateLinear = 2301; -const InterpolateSmooth = 2302; -const ZeroCurvatureEnding = 2400; -const ZeroSlopeEnding = 2401; -const WrapAroundEnding = 2402; -const NormalAnimationBlendMode = 2500; -const AdditiveAnimationBlendMode = 2501; -const TrianglesDrawMode = 0; -const TriangleStripDrawMode = 1; -const TriangleFanDrawMode = 2; -const BasicDepthPacking = 3200; -const RGBADepthPacking = 3201; -const RGBDepthPacking = 3202; -const RGDepthPacking = 3203; -const TangentSpaceNormalMap = 0; -const ObjectSpaceNormalMap = 1; -const NoColorSpace = ""; -const SRGBColorSpace = "srgb"; -const LinearSRGBColorSpace = "srgb-linear"; -const LinearTransfer = "linear"; -const SRGBTransfer = "srgb"; -const ZeroStencilOp = 0; -const KeepStencilOp = 7680; -const ReplaceStencilOp = 7681; -const IncrementStencilOp = 7682; -const DecrementStencilOp = 7683; -const IncrementWrapStencilOp = 34055; -const DecrementWrapStencilOp = 34056; -const InvertStencilOp = 5386; -const NeverStencilFunc = 512; -const LessStencilFunc = 513; -const EqualStencilFunc = 514; -const LessEqualStencilFunc = 515; -const GreaterStencilFunc = 516; -const NotEqualStencilFunc = 517; -const GreaterEqualStencilFunc = 518; -const AlwaysStencilFunc = 519; -const NeverCompare = 512; -const LessCompare = 513; -const EqualCompare = 514; -const LessEqualCompare = 515; -const GreaterCompare = 516; -const NotEqualCompare = 517; -const GreaterEqualCompare = 518; -const AlwaysCompare = 519; -const StaticDrawUsage = 35044; -const DynamicDrawUsage = 35048; -const StreamDrawUsage = 35040; -const StaticReadUsage = 35045; -const DynamicReadUsage = 35049; -const StreamReadUsage = 35041; -const StaticCopyUsage = 35046; -const DynamicCopyUsage = 35050; -const StreamCopyUsage = 35042; -const GLSL1 = "100"; -const GLSL3 = "300 es"; -const WebGLCoordinateSystem = 2e3; -const WebGPUCoordinateSystem = 2001; -class EventDispatcher { - static { - __name(this, "EventDispatcher"); - } - addEventListener(type, listener) { - if (this._listeners === void 0) this._listeners = {}; - const listeners = this._listeners; - if (listeners[type] === void 0) { - listeners[type] = []; - } - if (listeners[type].indexOf(listener) === -1) { - listeners[type].push(listener); - } - } - hasEventListener(type, listener) { - if (this._listeners === void 0) return false; - const listeners = this._listeners; - return listeners[type] !== void 0 && listeners[type].indexOf(listener) !== -1; - } - removeEventListener(type, listener) { - if (this._listeners === void 0) return; - const listeners = this._listeners; - const listenerArray = listeners[type]; - if (listenerArray !== void 0) { - const index = listenerArray.indexOf(listener); - if (index !== -1) { - listenerArray.splice(index, 1); - } - } - } - dispatchEvent(event) { - if (this._listeners === void 0) return; - const listeners = this._listeners; - const listenerArray = listeners[event.type]; - if (listenerArray !== void 0) { - event.target = this; - const array = listenerArray.slice(0); - for (let i = 0, l = array.length; i < l; i++) { - array[i].call(this, event); - } - event.target = null; - } - } -} -const _lut = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"]; -let _seed = 1234567; -const DEG2RAD = Math.PI / 180; -const RAD2DEG = 180 / Math.PI; -function generateUUID() { - const d0 = Math.random() * 4294967295 | 0; - const d1 = Math.random() * 4294967295 | 0; - const d2 = Math.random() * 4294967295 | 0; - const d3 = Math.random() * 4294967295 | 0; - const uuid = _lut[d0 & 255] + _lut[d0 >> 8 & 255] + _lut[d0 >> 16 & 255] + _lut[d0 >> 24 & 255] + "-" + _lut[d1 & 255] + _lut[d1 >> 8 & 255] + "-" + _lut[d1 >> 16 & 15 | 64] + _lut[d1 >> 24 & 255] + "-" + _lut[d2 & 63 | 128] + _lut[d2 >> 8 & 255] + "-" + _lut[d2 >> 16 & 255] + _lut[d2 >> 24 & 255] + _lut[d3 & 255] + _lut[d3 >> 8 & 255] + _lut[d3 >> 16 & 255] + _lut[d3 >> 24 & 255]; - return uuid.toLowerCase(); -} -__name(generateUUID, "generateUUID"); -function clamp(value, min, max2) { - return Math.max(min, Math.min(max2, value)); -} -__name(clamp, "clamp"); -function euclideanModulo(n, m) { - return (n % m + m) % m; -} -__name(euclideanModulo, "euclideanModulo"); -function mapLinear(x, a1, a2, b1, b22) { - return b1 + (x - a1) * (b22 - b1) / (a2 - a1); -} -__name(mapLinear, "mapLinear"); -function inverseLerp(x, y, value) { - if (x !== y) { - return (value - x) / (y - x); - } else { - return 0; - } -} -__name(inverseLerp, "inverseLerp"); -function lerp(x, y, t2) { - return (1 - t2) * x + t2 * y; -} -__name(lerp, "lerp"); -function damp(x, y, lambda, dt) { - return lerp(x, y, 1 - Math.exp(-lambda * dt)); -} -__name(damp, "damp"); -function pingpong(x, length = 1) { - return length - Math.abs(euclideanModulo(x, length * 2) - length); -} -__name(pingpong, "pingpong"); -function smoothstep(x, min, max2) { - if (x <= min) return 0; - if (x >= max2) return 1; - x = (x - min) / (max2 - min); - return x * x * (3 - 2 * x); -} -__name(smoothstep, "smoothstep"); -function smootherstep(x, min, max2) { - if (x <= min) return 0; - if (x >= max2) return 1; - x = (x - min) / (max2 - min); - return x * x * x * (x * (x * 6 - 15) + 10); -} -__name(smootherstep, "smootherstep"); -function randInt(low, high) { - return low + Math.floor(Math.random() * (high - low + 1)); -} -__name(randInt, "randInt"); -function randFloat(low, high) { - return low + Math.random() * (high - low); -} -__name(randFloat, "randFloat"); -function randFloatSpread(range) { - return range * (0.5 - Math.random()); -} -__name(randFloatSpread, "randFloatSpread"); -function seededRandom(s) { - if (s !== void 0) _seed = s; - let t2 = _seed += 1831565813; - t2 = Math.imul(t2 ^ t2 >>> 15, t2 | 1); - t2 ^= t2 + Math.imul(t2 ^ t2 >>> 7, t2 | 61); - return ((t2 ^ t2 >>> 14) >>> 0) / 4294967296; -} -__name(seededRandom, "seededRandom"); -function degToRad(degrees) { - return degrees * DEG2RAD; -} -__name(degToRad, "degToRad"); -function radToDeg(radians) { - return radians * RAD2DEG; -} -__name(radToDeg, "radToDeg"); -function isPowerOfTwo(value) { - return (value & value - 1) === 0 && value !== 0; -} -__name(isPowerOfTwo, "isPowerOfTwo"); -function ceilPowerOfTwo(value) { - return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2)); -} -__name(ceilPowerOfTwo, "ceilPowerOfTwo"); -function floorPowerOfTwo(value) { - return Math.pow(2, Math.floor(Math.log(value) / Math.LN2)); -} -__name(floorPowerOfTwo, "floorPowerOfTwo"); -function setQuaternionFromProperEuler(q, a, b, c, order) { - const cos = Math.cos; - const sin = Math.sin; - const c2 = cos(b / 2); - const s2 = sin(b / 2); - const c13 = cos((a + c) / 2); - const s13 = sin((a + c) / 2); - const c1_3 = cos((a - c) / 2); - const s1_3 = sin((a - c) / 2); - const c3_1 = cos((c - a) / 2); - const s3_1 = sin((c - a) / 2); - switch (order) { - case "XYX": - q.set(c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13); - break; - case "YZY": - q.set(s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13); - break; - case "ZXZ": - q.set(s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13); - break; - case "XZX": - q.set(c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13); - break; - case "YXY": - q.set(s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13); - break; - case "ZYZ": - q.set(s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13); - break; - default: - console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + order); - } -} -__name(setQuaternionFromProperEuler, "setQuaternionFromProperEuler"); -function denormalize(value, array) { - switch (array.constructor) { - case Float32Array: - return value; - case Uint32Array: - return value / 4294967295; - case Uint16Array: - return value / 65535; - case Uint8Array: - return value / 255; - case Int32Array: - return Math.max(value / 2147483647, -1); - case Int16Array: - return Math.max(value / 32767, -1); - case Int8Array: - return Math.max(value / 127, -1); - default: - throw new Error("Invalid component type."); - } -} -__name(denormalize, "denormalize"); -function normalize(value, array) { - switch (array.constructor) { - case Float32Array: - return value; - case Uint32Array: - return Math.round(value * 4294967295); - case Uint16Array: - return Math.round(value * 65535); - case Uint8Array: - return Math.round(value * 255); - case Int32Array: - return Math.round(value * 2147483647); - case Int16Array: - return Math.round(value * 32767); - case Int8Array: - return Math.round(value * 127); - default: - throw new Error("Invalid component type."); - } -} -__name(normalize, "normalize"); -const MathUtils = { - DEG2RAD, - RAD2DEG, - generateUUID, - clamp, - euclideanModulo, - mapLinear, - inverseLerp, - lerp, - damp, - pingpong, - smoothstep, - smootherstep, - randInt, - randFloat, - randFloatSpread, - seededRandom, - degToRad, - radToDeg, - isPowerOfTwo, - ceilPowerOfTwo, - floorPowerOfTwo, - setQuaternionFromProperEuler, - normalize, - denormalize -}; -class Vector2 { - static { - __name(this, "Vector2"); - } - constructor(x = 0, y = 0) { - Vector2.prototype.isVector2 = true; - this.x = x; - this.y = y; - } - get width() { - return this.x; - } - set width(value) { - this.x = value; - } - get height() { - return this.y; - } - set height(value) { - this.y = value; - } - set(x, y) { - this.x = x; - this.y = y; - return this; - } - setScalar(scalar) { - this.x = scalar; - this.y = scalar; - return this; - } - setX(x) { - this.x = x; - return this; - } - setY(y) { - this.y = y; - return this; - } - setComponent(index, value) { - switch (index) { - case 0: - this.x = value; - break; - case 1: - this.y = value; - break; - default: - throw new Error("index is out of range: " + index); - } - return this; - } - getComponent(index) { - switch (index) { - case 0: - return this.x; - case 1: - return this.y; - default: - throw new Error("index is out of range: " + index); - } - } - clone() { - return new this.constructor(this.x, this.y); - } - copy(v) { - this.x = v.x; - this.y = v.y; - return this; - } - add(v) { - this.x += v.x; - this.y += v.y; - return this; - } - addScalar(s) { - this.x += s; - this.y += s; - return this; - } - addVectors(a, b) { - this.x = a.x + b.x; - this.y = a.y + b.y; - return this; - } - addScaledVector(v, s) { - this.x += v.x * s; - this.y += v.y * s; - return this; - } - sub(v) { - this.x -= v.x; - this.y -= v.y; - return this; - } - subScalar(s) { - this.x -= s; - this.y -= s; - return this; - } - subVectors(a, b) { - this.x = a.x - b.x; - this.y = a.y - b.y; - return this; - } - multiply(v) { - this.x *= v.x; - this.y *= v.y; - return this; - } - multiplyScalar(scalar) { - this.x *= scalar; - this.y *= scalar; - return this; - } - divide(v) { - this.x /= v.x; - this.y /= v.y; - return this; - } - divideScalar(scalar) { - return this.multiplyScalar(1 / scalar); - } - applyMatrix3(m) { - const x = this.x, y = this.y; - const e = m.elements; - this.x = e[0] * x + e[3] * y + e[6]; - this.y = e[1] * x + e[4] * y + e[7]; - return this; - } - min(v) { - this.x = Math.min(this.x, v.x); - this.y = Math.min(this.y, v.y); - return this; - } - max(v) { - this.x = Math.max(this.x, v.x); - this.y = Math.max(this.y, v.y); - return this; - } - clamp(min, max2) { - this.x = Math.max(min.x, Math.min(max2.x, this.x)); - this.y = Math.max(min.y, Math.min(max2.y, this.y)); - return this; - } - clampScalar(minVal, maxVal) { - this.x = Math.max(minVal, Math.min(maxVal, this.x)); - this.y = Math.max(minVal, Math.min(maxVal, this.y)); - return this; - } - clampLength(min, max2) { - const length = this.length(); - return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max2, length))); - } - floor() { - this.x = Math.floor(this.x); - this.y = Math.floor(this.y); - return this; - } - ceil() { - this.x = Math.ceil(this.x); - this.y = Math.ceil(this.y); - return this; - } - round() { - this.x = Math.round(this.x); - this.y = Math.round(this.y); - return this; - } - roundToZero() { - this.x = Math.trunc(this.x); - this.y = Math.trunc(this.y); - return this; - } - negate() { - this.x = -this.x; - this.y = -this.y; - return this; - } - dot(v) { - return this.x * v.x + this.y * v.y; - } - cross(v) { - return this.x * v.y - this.y * v.x; - } - lengthSq() { - return this.x * this.x + this.y * this.y; - } - length() { - return Math.sqrt(this.x * this.x + this.y * this.y); - } - manhattanLength() { - return Math.abs(this.x) + Math.abs(this.y); - } - normalize() { - return this.divideScalar(this.length() || 1); - } - angle() { - const angle = Math.atan2(-this.y, -this.x) + Math.PI; - return angle; - } - angleTo(v) { - const denominator = Math.sqrt(this.lengthSq() * v.lengthSq()); - if (denominator === 0) return Math.PI / 2; - const theta = this.dot(v) / denominator; - return Math.acos(clamp(theta, -1, 1)); - } - distanceTo(v) { - return Math.sqrt(this.distanceToSquared(v)); - } - distanceToSquared(v) { - const dx = this.x - v.x, dy = this.y - v.y; - return dx * dx + dy * dy; - } - manhattanDistanceTo(v) { - return Math.abs(this.x - v.x) + Math.abs(this.y - v.y); - } - setLength(length) { - return this.normalize().multiplyScalar(length); - } - lerp(v, alpha) { - this.x += (v.x - this.x) * alpha; - this.y += (v.y - this.y) * alpha; - return this; - } - lerpVectors(v1, v2, alpha) { - this.x = v1.x + (v2.x - v1.x) * alpha; - this.y = v1.y + (v2.y - v1.y) * alpha; - return this; - } - equals(v) { - return v.x === this.x && v.y === this.y; - } - fromArray(array, offset = 0) { - this.x = array[offset]; - this.y = array[offset + 1]; - return this; - } - toArray(array = [], offset = 0) { - array[offset] = this.x; - array[offset + 1] = this.y; - return array; - } - fromBufferAttribute(attribute, index) { - this.x = attribute.getX(index); - this.y = attribute.getY(index); - return this; - } - rotateAround(center, angle) { - const c = Math.cos(angle), s = Math.sin(angle); - const x = this.x - center.x; - const y = this.y - center.y; - this.x = x * c - y * s + center.x; - this.y = x * s + y * c + center.y; - return this; - } - random() { - this.x = Math.random(); - this.y = Math.random(); - return this; - } - *[Symbol.iterator]() { - yield this.x; - yield this.y; - } -} -class Matrix3 { - static { - __name(this, "Matrix3"); - } - constructor(n11, n12, n13, n21, n22, n23, n31, n32, n33) { - Matrix3.prototype.isMatrix3 = true; - this.elements = [ - 1, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 1 - ]; - if (n11 !== void 0) { - this.set(n11, n12, n13, n21, n22, n23, n31, n32, n33); - } - } - set(n11, n12, n13, n21, n22, n23, n31, n32, n33) { - const te2 = this.elements; - te2[0] = n11; - te2[1] = n21; - te2[2] = n31; - te2[3] = n12; - te2[4] = n22; - te2[5] = n32; - te2[6] = n13; - te2[7] = n23; - te2[8] = n33; - return this; - } - identity() { - this.set( - 1, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 1 - ); - return this; - } - copy(m) { - const te2 = this.elements; - const me = m.elements; - te2[0] = me[0]; - te2[1] = me[1]; - te2[2] = me[2]; - te2[3] = me[3]; - te2[4] = me[4]; - te2[5] = me[5]; - te2[6] = me[6]; - te2[7] = me[7]; - te2[8] = me[8]; - return this; - } - extractBasis(xAxis, yAxis, zAxis) { - xAxis.setFromMatrix3Column(this, 0); - yAxis.setFromMatrix3Column(this, 1); - zAxis.setFromMatrix3Column(this, 2); - return this; - } - setFromMatrix4(m) { - const me = m.elements; - this.set( - me[0], - me[4], - me[8], - me[1], - me[5], - me[9], - me[2], - me[6], - me[10] - ); - return this; - } - multiply(m) { - return this.multiplyMatrices(this, m); - } - premultiply(m) { - return this.multiplyMatrices(m, this); - } - multiplyMatrices(a, b) { - const ae = a.elements; - const be = b.elements; - const te2 = this.elements; - const a11 = ae[0], a12 = ae[3], a13 = ae[6]; - const a21 = ae[1], a22 = ae[4], a23 = ae[7]; - const a31 = ae[2], a32 = ae[5], a33 = ae[8]; - const b11 = be[0], b12 = be[3], b13 = be[6]; - const b21 = be[1], b22 = be[4], b23 = be[7]; - const b31 = be[2], b32 = be[5], b33 = be[8]; - te2[0] = a11 * b11 + a12 * b21 + a13 * b31; - te2[3] = a11 * b12 + a12 * b22 + a13 * b32; - te2[6] = a11 * b13 + a12 * b23 + a13 * b33; - te2[1] = a21 * b11 + a22 * b21 + a23 * b31; - te2[4] = a21 * b12 + a22 * b22 + a23 * b32; - te2[7] = a21 * b13 + a22 * b23 + a23 * b33; - te2[2] = a31 * b11 + a32 * b21 + a33 * b31; - te2[5] = a31 * b12 + a32 * b22 + a33 * b32; - te2[8] = a31 * b13 + a32 * b23 + a33 * b33; - return this; - } - multiplyScalar(s) { - const te2 = this.elements; - te2[0] *= s; - te2[3] *= s; - te2[6] *= s; - te2[1] *= s; - te2[4] *= s; - te2[7] *= s; - te2[2] *= s; - te2[5] *= s; - te2[8] *= s; - return this; - } - determinant() { - const te2 = this.elements; - const a = te2[0], b = te2[1], c = te2[2], d = te2[3], e = te2[4], f = te2[5], g = te2[6], h = te2[7], i = te2[8]; - return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g; - } - invert() { - const te2 = this.elements, n11 = te2[0], n21 = te2[1], n31 = te2[2], n12 = te2[3], n22 = te2[4], n32 = te2[5], n13 = te2[6], n23 = te2[7], n33 = te2[8], t11 = n33 * n22 - n32 * n23, t12 = n32 * n13 - n33 * n12, t13 = n23 * n12 - n22 * n13, det = n11 * t11 + n21 * t12 + n31 * t13; - if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); - const detInv = 1 / det; - te2[0] = t11 * detInv; - te2[1] = (n31 * n23 - n33 * n21) * detInv; - te2[2] = (n32 * n21 - n31 * n22) * detInv; - te2[3] = t12 * detInv; - te2[4] = (n33 * n11 - n31 * n13) * detInv; - te2[5] = (n31 * n12 - n32 * n11) * detInv; - te2[6] = t13 * detInv; - te2[7] = (n21 * n13 - n23 * n11) * detInv; - te2[8] = (n22 * n11 - n21 * n12) * detInv; - return this; - } - transpose() { - let tmp2; - const m = this.elements; - tmp2 = m[1]; - m[1] = m[3]; - m[3] = tmp2; - tmp2 = m[2]; - m[2] = m[6]; - m[6] = tmp2; - tmp2 = m[5]; - m[5] = m[7]; - m[7] = tmp2; - return this; - } - getNormalMatrix(matrix4) { - return this.setFromMatrix4(matrix4).invert().transpose(); - } - transposeIntoArray(r) { - const m = this.elements; - r[0] = m[0]; - r[1] = m[3]; - r[2] = m[6]; - r[3] = m[1]; - r[4] = m[4]; - r[5] = m[7]; - r[6] = m[2]; - r[7] = m[5]; - r[8] = m[8]; - return this; - } - setUvTransform(tx, ty, sx, sy, rotation, cx, cy) { - const c = Math.cos(rotation); - const s = Math.sin(rotation); - this.set( - sx * c, - sx * s, - -sx * (c * cx + s * cy) + cx + tx, - -sy * s, - sy * c, - -sy * (-s * cx + c * cy) + cy + ty, - 0, - 0, - 1 - ); - return this; - } - // - scale(sx, sy) { - this.premultiply(_m3.makeScale(sx, sy)); - return this; - } - rotate(theta) { - this.premultiply(_m3.makeRotation(-theta)); - return this; - } - translate(tx, ty) { - this.premultiply(_m3.makeTranslation(tx, ty)); - return this; - } - // for 2D Transforms - makeTranslation(x, y) { - if (x.isVector2) { - this.set( - 1, - 0, - x.x, - 0, - 1, - x.y, - 0, - 0, - 1 - ); - } else { - this.set( - 1, - 0, - x, - 0, - 1, - y, - 0, - 0, - 1 - ); - } - return this; - } - makeRotation(theta) { - const c = Math.cos(theta); - const s = Math.sin(theta); - this.set( - c, - -s, - 0, - s, - c, - 0, - 0, - 0, - 1 - ); - return this; - } - makeScale(x, y) { - this.set( - x, - 0, - 0, - 0, - y, - 0, - 0, - 0, - 1 - ); - return this; - } - // - equals(matrix) { - const te2 = this.elements; - const me = matrix.elements; - for (let i = 0; i < 9; i++) { - if (te2[i] !== me[i]) return false; - } - return true; - } - fromArray(array, offset = 0) { - for (let i = 0; i < 9; i++) { - this.elements[i] = array[i + offset]; - } - return this; - } - toArray(array = [], offset = 0) { - const te2 = this.elements; - array[offset] = te2[0]; - array[offset + 1] = te2[1]; - array[offset + 2] = te2[2]; - array[offset + 3] = te2[3]; - array[offset + 4] = te2[4]; - array[offset + 5] = te2[5]; - array[offset + 6] = te2[6]; - array[offset + 7] = te2[7]; - array[offset + 8] = te2[8]; - return array; - } - clone() { - return new this.constructor().fromArray(this.elements); - } -} -const _m3 = /* @__PURE__ */ new Matrix3(); -function arrayNeedsUint32(array) { - for (let i = array.length - 1; i >= 0; --i) { - if (array[i] >= 65535) return true; - } - return false; -} -__name(arrayNeedsUint32, "arrayNeedsUint32"); -const TYPED_ARRAYS = { - Int8Array, - Uint8Array, - Uint8ClampedArray, - Int16Array, - Uint16Array, - Int32Array, - Uint32Array, - Float32Array, - Float64Array -}; -function getTypedArray(type, buffer) { - return new TYPED_ARRAYS[type](buffer); -} -__name(getTypedArray, "getTypedArray"); -function createElementNS(name) { - return document.createElementNS("http://www.w3.org/1999/xhtml", name); -} -__name(createElementNS, "createElementNS"); -function createCanvasElement() { - const canvas = createElementNS("canvas"); - canvas.style.display = "block"; - return canvas; -} -__name(createCanvasElement, "createCanvasElement"); -const _cache = {}; -function warnOnce(message) { - if (message in _cache) return; - _cache[message] = true; - console.warn(message); -} -__name(warnOnce, "warnOnce"); -function probeAsync(gl, sync, interval) { - return new Promise(function(resolve, reject) { - function probe() { - switch (gl.clientWaitSync(sync, gl.SYNC_FLUSH_COMMANDS_BIT, 0)) { - case gl.WAIT_FAILED: - reject(); - break; - case gl.TIMEOUT_EXPIRED: - setTimeout(probe, interval); - break; - default: - resolve(); - } - } - __name(probe, "probe"); - setTimeout(probe, interval); - }); -} -__name(probeAsync, "probeAsync"); -function toNormalizedProjectionMatrix(projectionMatrix) { - const m = projectionMatrix.elements; - m[2] = 0.5 * m[2] + 0.5 * m[3]; - m[6] = 0.5 * m[6] + 0.5 * m[7]; - m[10] = 0.5 * m[10] + 0.5 * m[11]; - m[14] = 0.5 * m[14] + 0.5 * m[15]; -} -__name(toNormalizedProjectionMatrix, "toNormalizedProjectionMatrix"); -function toReversedProjectionMatrix(projectionMatrix) { - const m = projectionMatrix.elements; - const isPerspectiveMatrix = m[11] === -1; - if (isPerspectiveMatrix) { - m[10] = -m[10] - 1; - m[14] = -m[14]; - } else { - m[10] = -m[10]; - m[14] = -m[14] + 1; - } -} -__name(toReversedProjectionMatrix, "toReversedProjectionMatrix"); -const ColorManagement = { - enabled: true, - workingColorSpace: LinearSRGBColorSpace, - /** - * Implementations of supported color spaces. - * - * Required: - * - primaries: chromaticity coordinates [ rx ry gx gy bx by ] - * - whitePoint: reference white [ x y ] - * - transfer: transfer function (pre-defined) - * - toXYZ: Matrix3 RGB to XYZ transform - * - fromXYZ: Matrix3 XYZ to RGB transform - * - luminanceCoefficients: RGB luminance coefficients - * - * Optional: - * - outputColorSpaceConfig: { drawingBufferColorSpace: ColorSpace } - * - workingColorSpaceConfig: { unpackColorSpace: ColorSpace } - * - * Reference: - * - https://www.russellcottrell.com/photo/matrixCalculator.htm - */ - spaces: {}, - convert: /* @__PURE__ */ __name(function(color, sourceColorSpace, targetColorSpace) { - if (this.enabled === false || sourceColorSpace === targetColorSpace || !sourceColorSpace || !targetColorSpace) { - return color; - } - if (this.spaces[sourceColorSpace].transfer === SRGBTransfer) { - color.r = SRGBToLinear(color.r); - color.g = SRGBToLinear(color.g); - color.b = SRGBToLinear(color.b); - } - if (this.spaces[sourceColorSpace].primaries !== this.spaces[targetColorSpace].primaries) { - color.applyMatrix3(this.spaces[sourceColorSpace].toXYZ); - color.applyMatrix3(this.spaces[targetColorSpace].fromXYZ); - } - if (this.spaces[targetColorSpace].transfer === SRGBTransfer) { - color.r = LinearToSRGB(color.r); - color.g = LinearToSRGB(color.g); - color.b = LinearToSRGB(color.b); - } - return color; - }, "convert"), - fromWorkingColorSpace: /* @__PURE__ */ __name(function(color, targetColorSpace) { - return this.convert(color, this.workingColorSpace, targetColorSpace); - }, "fromWorkingColorSpace"), - toWorkingColorSpace: /* @__PURE__ */ __name(function(color, sourceColorSpace) { - return this.convert(color, sourceColorSpace, this.workingColorSpace); - }, "toWorkingColorSpace"), - getPrimaries: /* @__PURE__ */ __name(function(colorSpace) { - return this.spaces[colorSpace].primaries; - }, "getPrimaries"), - getTransfer: /* @__PURE__ */ __name(function(colorSpace) { - if (colorSpace === NoColorSpace) return LinearTransfer; - return this.spaces[colorSpace].transfer; - }, "getTransfer"), - getLuminanceCoefficients: /* @__PURE__ */ __name(function(target, colorSpace = this.workingColorSpace) { - return target.fromArray(this.spaces[colorSpace].luminanceCoefficients); - }, "getLuminanceCoefficients"), - define: /* @__PURE__ */ __name(function(colorSpaces) { - Object.assign(this.spaces, colorSpaces); - }, "define"), - // Internal APIs - _getMatrix: /* @__PURE__ */ __name(function(targetMatrix, sourceColorSpace, targetColorSpace) { - return targetMatrix.copy(this.spaces[sourceColorSpace].toXYZ).multiply(this.spaces[targetColorSpace].fromXYZ); - }, "_getMatrix"), - _getDrawingBufferColorSpace: /* @__PURE__ */ __name(function(colorSpace) { - return this.spaces[colorSpace].outputColorSpaceConfig.drawingBufferColorSpace; - }, "_getDrawingBufferColorSpace"), - _getUnpackColorSpace: /* @__PURE__ */ __name(function(colorSpace = this.workingColorSpace) { - return this.spaces[colorSpace].workingColorSpaceConfig.unpackColorSpace; - }, "_getUnpackColorSpace") -}; -function SRGBToLinear(c) { - return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4); -} -__name(SRGBToLinear, "SRGBToLinear"); -function LinearToSRGB(c) { - return c < 31308e-7 ? c * 12.92 : 1.055 * Math.pow(c, 0.41666) - 0.055; -} -__name(LinearToSRGB, "LinearToSRGB"); -const REC709_PRIMARIES = [0.64, 0.33, 0.3, 0.6, 0.15, 0.06]; -const REC709_LUMINANCE_COEFFICIENTS = [0.2126, 0.7152, 0.0722]; -const D65 = [0.3127, 0.329]; -const LINEAR_REC709_TO_XYZ = /* @__PURE__ */ new Matrix3().set( - 0.4123908, - 0.3575843, - 0.1804808, - 0.212639, - 0.7151687, - 0.0721923, - 0.0193308, - 0.1191948, - 0.9505322 -); -const XYZ_TO_LINEAR_REC709 = /* @__PURE__ */ new Matrix3().set( - 3.2409699, - -1.5373832, - -0.4986108, - -0.9692436, - 1.8759675, - 0.0415551, - 0.0556301, - -0.203977, - 1.0569715 -); -ColorManagement.define({ - [LinearSRGBColorSpace]: { - primaries: REC709_PRIMARIES, - whitePoint: D65, - transfer: LinearTransfer, - toXYZ: LINEAR_REC709_TO_XYZ, - fromXYZ: XYZ_TO_LINEAR_REC709, - luminanceCoefficients: REC709_LUMINANCE_COEFFICIENTS, - workingColorSpaceConfig: { unpackColorSpace: SRGBColorSpace }, - outputColorSpaceConfig: { drawingBufferColorSpace: SRGBColorSpace } - }, - [SRGBColorSpace]: { - primaries: REC709_PRIMARIES, - whitePoint: D65, - transfer: SRGBTransfer, - toXYZ: LINEAR_REC709_TO_XYZ, - fromXYZ: XYZ_TO_LINEAR_REC709, - luminanceCoefficients: REC709_LUMINANCE_COEFFICIENTS, - outputColorSpaceConfig: { drawingBufferColorSpace: SRGBColorSpace } - } -}); -let _canvas; -class ImageUtils { - static { - __name(this, "ImageUtils"); - } - static getDataURL(image) { - if (/^data:/i.test(image.src)) { - return image.src; - } - if (typeof HTMLCanvasElement === "undefined") { - return image.src; - } - let canvas; - if (image instanceof HTMLCanvasElement) { - canvas = image; - } else { - if (_canvas === void 0) _canvas = createElementNS("canvas"); - _canvas.width = image.width; - _canvas.height = image.height; - const context = _canvas.getContext("2d"); - if (image instanceof ImageData) { - context.putImageData(image, 0, 0); - } else { - context.drawImage(image, 0, 0, image.width, image.height); - } - canvas = _canvas; - } - if (canvas.width > 2048 || canvas.height > 2048) { - console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons", image); - return canvas.toDataURL("image/jpeg", 0.6); - } else { - return canvas.toDataURL("image/png"); - } - } - static sRGBToLinear(image) { - if (typeof HTMLImageElement !== "undefined" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== "undefined" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap) { - const canvas = createElementNS("canvas"); - canvas.width = image.width; - canvas.height = image.height; - const context = canvas.getContext("2d"); - context.drawImage(image, 0, 0, image.width, image.height); - const imageData = context.getImageData(0, 0, image.width, image.height); - const data = imageData.data; - for (let i = 0; i < data.length; i++) { - data[i] = SRGBToLinear(data[i] / 255) * 255; - } - context.putImageData(imageData, 0, 0); - return canvas; - } else if (image.data) { - const data = image.data.slice(0); - for (let i = 0; i < data.length; i++) { - if (data instanceof Uint8Array || data instanceof Uint8ClampedArray) { - data[i] = Math.floor(SRGBToLinear(data[i] / 255) * 255); - } else { - data[i] = SRGBToLinear(data[i]); - } - } - return { - data, - width: image.width, - height: image.height - }; - } else { - console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."); - return image; - } - } -} -let _sourceId = 0; -class Source { - static { - __name(this, "Source"); - } - constructor(data = null) { - this.isSource = true; - Object.defineProperty(this, "id", { value: _sourceId++ }); - this.uuid = generateUUID(); - this.data = data; - this.dataReady = true; - this.version = 0; - } - set needsUpdate(value) { - if (value === true) this.version++; - } - toJSON(meta) { - const isRootObject = meta === void 0 || typeof meta === "string"; - if (!isRootObject && meta.images[this.uuid] !== void 0) { - return meta.images[this.uuid]; - } - const output = { - uuid: this.uuid, - url: "" - }; - const data = this.data; - if (data !== null) { - let url; - if (Array.isArray(data)) { - url = []; - for (let i = 0, l = data.length; i < l; i++) { - if (data[i].isDataTexture) { - url.push(serializeImage(data[i].image)); - } else { - url.push(serializeImage(data[i])); - } - } - } else { - url = serializeImage(data); - } - output.url = url; - } - if (!isRootObject) { - meta.images[this.uuid] = output; - } - return output; - } -} -function serializeImage(image) { - if (typeof HTMLImageElement !== "undefined" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== "undefined" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap) { - return ImageUtils.getDataURL(image); - } else { - if (image.data) { - return { - data: Array.from(image.data), - width: image.width, - height: image.height, - type: image.data.constructor.name - }; - } else { - console.warn("THREE.Texture: Unable to serialize Texture."); - return {}; - } - } -} -__name(serializeImage, "serializeImage"); -let _textureId = 0; -class Texture extends EventDispatcher { - static { - __name(this, "Texture"); - } - constructor(image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, colorSpace = NoColorSpace) { - super(); - this.isTexture = true; - Object.defineProperty(this, "id", { value: _textureId++ }); - this.uuid = generateUUID(); - this.name = ""; - this.source = new Source(image); - this.mipmaps = []; - this.mapping = mapping; - this.channel = 0; - this.wrapS = wrapS; - this.wrapT = wrapT; - this.magFilter = magFilter; - this.minFilter = minFilter; - this.anisotropy = anisotropy; - this.format = format; - this.internalFormat = null; - this.type = type; - this.offset = new Vector2(0, 0); - this.repeat = new Vector2(1, 1); - this.center = new Vector2(0, 0); - this.rotation = 0; - this.matrixAutoUpdate = true; - this.matrix = new Matrix3(); - this.generateMipmaps = true; - this.premultiplyAlpha = false; - this.flipY = true; - this.unpackAlignment = 4; - this.colorSpace = colorSpace; - this.userData = {}; - this.version = 0; - this.onUpdate = null; - this.isRenderTargetTexture = false; - this.pmremVersion = 0; - } - get image() { - return this.source.data; - } - set image(value = null) { - this.source.data = value; - } - updateMatrix() { - this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y); - } - clone() { - return new this.constructor().copy(this); - } - copy(source) { - this.name = source.name; - this.source = source.source; - this.mipmaps = source.mipmaps.slice(0); - this.mapping = source.mapping; - this.channel = source.channel; - this.wrapS = source.wrapS; - this.wrapT = source.wrapT; - this.magFilter = source.magFilter; - this.minFilter = source.minFilter; - this.anisotropy = source.anisotropy; - this.format = source.format; - this.internalFormat = source.internalFormat; - this.type = source.type; - this.offset.copy(source.offset); - this.repeat.copy(source.repeat); - this.center.copy(source.center); - this.rotation = source.rotation; - this.matrixAutoUpdate = source.matrixAutoUpdate; - this.matrix.copy(source.matrix); - this.generateMipmaps = source.generateMipmaps; - this.premultiplyAlpha = source.premultiplyAlpha; - this.flipY = source.flipY; - this.unpackAlignment = source.unpackAlignment; - this.colorSpace = source.colorSpace; - this.userData = JSON.parse(JSON.stringify(source.userData)); - this.needsUpdate = true; - return this; - } - toJSON(meta) { - const isRootObject = meta === void 0 || typeof meta === "string"; - if (!isRootObject && meta.textures[this.uuid] !== void 0) { - return meta.textures[this.uuid]; - } - const output = { - metadata: { - version: 4.6, - type: "Texture", - generator: "Texture.toJSON" - }, - uuid: this.uuid, - name: this.name, - image: this.source.toJSON(meta).uuid, - mapping: this.mapping, - channel: this.channel, - repeat: [this.repeat.x, this.repeat.y], - offset: [this.offset.x, this.offset.y], - center: [this.center.x, this.center.y], - rotation: this.rotation, - wrap: [this.wrapS, this.wrapT], - format: this.format, - internalFormat: this.internalFormat, - type: this.type, - colorSpace: this.colorSpace, - minFilter: this.minFilter, - magFilter: this.magFilter, - anisotropy: this.anisotropy, - flipY: this.flipY, - generateMipmaps: this.generateMipmaps, - premultiplyAlpha: this.premultiplyAlpha, - unpackAlignment: this.unpackAlignment - }; - if (Object.keys(this.userData).length > 0) output.userData = this.userData; - if (!isRootObject) { - meta.textures[this.uuid] = output; - } - return output; - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } - transformUv(uv) { - if (this.mapping !== UVMapping) return uv; - uv.applyMatrix3(this.matrix); - if (uv.x < 0 || uv.x > 1) { - switch (this.wrapS) { - case RepeatWrapping: - uv.x = uv.x - Math.floor(uv.x); - break; - case ClampToEdgeWrapping: - uv.x = uv.x < 0 ? 0 : 1; - break; - case MirroredRepeatWrapping: - if (Math.abs(Math.floor(uv.x) % 2) === 1) { - uv.x = Math.ceil(uv.x) - uv.x; - } else { - uv.x = uv.x - Math.floor(uv.x); - } - break; - } - } - if (uv.y < 0 || uv.y > 1) { - switch (this.wrapT) { - case RepeatWrapping: - uv.y = uv.y - Math.floor(uv.y); - break; - case ClampToEdgeWrapping: - uv.y = uv.y < 0 ? 0 : 1; - break; - case MirroredRepeatWrapping: - if (Math.abs(Math.floor(uv.y) % 2) === 1) { - uv.y = Math.ceil(uv.y) - uv.y; - } else { - uv.y = uv.y - Math.floor(uv.y); - } - break; - } - } - if (this.flipY) { - uv.y = 1 - uv.y; - } - return uv; - } - set needsUpdate(value) { - if (value === true) { - this.version++; - this.source.needsUpdate = true; - } - } - set needsPMREMUpdate(value) { - if (value === true) { - this.pmremVersion++; - } - } -} -Texture.DEFAULT_IMAGE = null; -Texture.DEFAULT_MAPPING = UVMapping; -Texture.DEFAULT_ANISOTROPY = 1; -class Vector4 { - static { - __name(this, "Vector4"); - } - constructor(x = 0, y = 0, z = 0, w = 1) { - Vector4.prototype.isVector4 = true; - this.x = x; - this.y = y; - this.z = z; - this.w = w; - } - get width() { - return this.z; - } - set width(value) { - this.z = value; - } - get height() { - return this.w; - } - set height(value) { - this.w = value; - } - set(x, y, z, w) { - this.x = x; - this.y = y; - this.z = z; - this.w = w; - return this; - } - setScalar(scalar) { - this.x = scalar; - this.y = scalar; - this.z = scalar; - this.w = scalar; - return this; - } - setX(x) { - this.x = x; - return this; - } - setY(y) { - this.y = y; - return this; - } - setZ(z) { - this.z = z; - return this; - } - setW(w) { - this.w = w; - return this; - } - setComponent(index, value) { - switch (index) { - case 0: - this.x = value; - break; - case 1: - this.y = value; - break; - case 2: - this.z = value; - break; - case 3: - this.w = value; - break; - default: - throw new Error("index is out of range: " + index); - } - return this; - } - getComponent(index) { - switch (index) { - case 0: - return this.x; - case 1: - return this.y; - case 2: - return this.z; - case 3: - return this.w; - default: - throw new Error("index is out of range: " + index); - } - } - clone() { - return new this.constructor(this.x, this.y, this.z, this.w); - } - copy(v) { - this.x = v.x; - this.y = v.y; - this.z = v.z; - this.w = v.w !== void 0 ? v.w : 1; - return this; - } - add(v) { - this.x += v.x; - this.y += v.y; - this.z += v.z; - this.w += v.w; - return this; - } - addScalar(s) { - this.x += s; - this.y += s; - this.z += s; - this.w += s; - return this; - } - addVectors(a, b) { - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - this.w = a.w + b.w; - return this; - } - addScaledVector(v, s) { - this.x += v.x * s; - this.y += v.y * s; - this.z += v.z * s; - this.w += v.w * s; - return this; - } - sub(v) { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - this.w -= v.w; - return this; - } - subScalar(s) { - this.x -= s; - this.y -= s; - this.z -= s; - this.w -= s; - return this; - } - subVectors(a, b) { - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - this.w = a.w - b.w; - return this; - } - multiply(v) { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z; - this.w *= v.w; - return this; - } - multiplyScalar(scalar) { - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - this.w *= scalar; - return this; - } - applyMatrix4(m) { - const x = this.x, y = this.y, z = this.z, w = this.w; - const e = m.elements; - this.x = e[0] * x + e[4] * y + e[8] * z + e[12] * w; - this.y = e[1] * x + e[5] * y + e[9] * z + e[13] * w; - this.z = e[2] * x + e[6] * y + e[10] * z + e[14] * w; - this.w = e[3] * x + e[7] * y + e[11] * z + e[15] * w; - return this; - } - divide(v) { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z; - this.w /= v.w; - return this; - } - divideScalar(scalar) { - return this.multiplyScalar(1 / scalar); - } - setAxisAngleFromQuaternion(q) { - this.w = 2 * Math.acos(q.w); - const s = Math.sqrt(1 - q.w * q.w); - if (s < 1e-4) { - this.x = 1; - this.y = 0; - this.z = 0; - } else { - this.x = q.x / s; - this.y = q.y / s; - this.z = q.z / s; - } - return this; - } - setAxisAngleFromRotationMatrix(m) { - let angle, x, y, z; - const epsilon = 0.01, epsilon2 = 0.1, te2 = m.elements, m11 = te2[0], m12 = te2[4], m13 = te2[8], m21 = te2[1], m22 = te2[5], m23 = te2[9], m31 = te2[2], m32 = te2[6], m33 = te2[10]; - if (Math.abs(m12 - m21) < epsilon && Math.abs(m13 - m31) < epsilon && Math.abs(m23 - m32) < epsilon) { - if (Math.abs(m12 + m21) < epsilon2 && Math.abs(m13 + m31) < epsilon2 && Math.abs(m23 + m32) < epsilon2 && Math.abs(m11 + m22 + m33 - 3) < epsilon2) { - this.set(1, 0, 0, 0); - return this; - } - angle = Math.PI; - const xx = (m11 + 1) / 2; - const yy = (m22 + 1) / 2; - const zz = (m33 + 1) / 2; - const xy = (m12 + m21) / 4; - const xz = (m13 + m31) / 4; - const yz = (m23 + m32) / 4; - if (xx > yy && xx > zz) { - if (xx < epsilon) { - x = 0; - y = 0.707106781; - z = 0.707106781; - } else { - x = Math.sqrt(xx); - y = xy / x; - z = xz / x; - } - } else if (yy > zz) { - if (yy < epsilon) { - x = 0.707106781; - y = 0; - z = 0.707106781; - } else { - y = Math.sqrt(yy); - x = xy / y; - z = yz / y; - } - } else { - if (zz < epsilon) { - x = 0.707106781; - y = 0.707106781; - z = 0; - } else { - z = Math.sqrt(zz); - x = xz / z; - y = yz / z; - } - } - this.set(x, y, z, angle); - return this; - } - let s = Math.sqrt((m32 - m23) * (m32 - m23) + (m13 - m31) * (m13 - m31) + (m21 - m12) * (m21 - m12)); - if (Math.abs(s) < 1e-3) s = 1; - this.x = (m32 - m23) / s; - this.y = (m13 - m31) / s; - this.z = (m21 - m12) / s; - this.w = Math.acos((m11 + m22 + m33 - 1) / 2); - return this; - } - setFromMatrixPosition(m) { - const e = m.elements; - this.x = e[12]; - this.y = e[13]; - this.z = e[14]; - this.w = e[15]; - return this; - } - min(v) { - this.x = Math.min(this.x, v.x); - this.y = Math.min(this.y, v.y); - this.z = Math.min(this.z, v.z); - this.w = Math.min(this.w, v.w); - return this; - } - max(v) { - this.x = Math.max(this.x, v.x); - this.y = Math.max(this.y, v.y); - this.z = Math.max(this.z, v.z); - this.w = Math.max(this.w, v.w); - return this; - } - clamp(min, max2) { - this.x = Math.max(min.x, Math.min(max2.x, this.x)); - this.y = Math.max(min.y, Math.min(max2.y, this.y)); - this.z = Math.max(min.z, Math.min(max2.z, this.z)); - this.w = Math.max(min.w, Math.min(max2.w, this.w)); - return this; - } - clampScalar(minVal, maxVal) { - this.x = Math.max(minVal, Math.min(maxVal, this.x)); - this.y = Math.max(minVal, Math.min(maxVal, this.y)); - this.z = Math.max(minVal, Math.min(maxVal, this.z)); - this.w = Math.max(minVal, Math.min(maxVal, this.w)); - return this; - } - clampLength(min, max2) { - const length = this.length(); - return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max2, length))); - } - floor() { - this.x = Math.floor(this.x); - this.y = Math.floor(this.y); - this.z = Math.floor(this.z); - this.w = Math.floor(this.w); - return this; - } - ceil() { - this.x = Math.ceil(this.x); - this.y = Math.ceil(this.y); - this.z = Math.ceil(this.z); - this.w = Math.ceil(this.w); - return this; - } - round() { - this.x = Math.round(this.x); - this.y = Math.round(this.y); - this.z = Math.round(this.z); - this.w = Math.round(this.w); - return this; - } - roundToZero() { - this.x = Math.trunc(this.x); - this.y = Math.trunc(this.y); - this.z = Math.trunc(this.z); - this.w = Math.trunc(this.w); - return this; - } - negate() { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - this.w = -this.w; - return this; - } - dot(v) { - return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - } - lengthSq() { - return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; - } - length() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); - } - manhattanLength() { - return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w); - } - normalize() { - return this.divideScalar(this.length() || 1); - } - setLength(length) { - return this.normalize().multiplyScalar(length); - } - lerp(v, alpha) { - this.x += (v.x - this.x) * alpha; - this.y += (v.y - this.y) * alpha; - this.z += (v.z - this.z) * alpha; - this.w += (v.w - this.w) * alpha; - return this; - } - lerpVectors(v1, v2, alpha) { - this.x = v1.x + (v2.x - v1.x) * alpha; - this.y = v1.y + (v2.y - v1.y) * alpha; - this.z = v1.z + (v2.z - v1.z) * alpha; - this.w = v1.w + (v2.w - v1.w) * alpha; - return this; - } - equals(v) { - return v.x === this.x && v.y === this.y && v.z === this.z && v.w === this.w; - } - fromArray(array, offset = 0) { - this.x = array[offset]; - this.y = array[offset + 1]; - this.z = array[offset + 2]; - this.w = array[offset + 3]; - return this; - } - toArray(array = [], offset = 0) { - array[offset] = this.x; - array[offset + 1] = this.y; - array[offset + 2] = this.z; - array[offset + 3] = this.w; - return array; - } - fromBufferAttribute(attribute, index) { - this.x = attribute.getX(index); - this.y = attribute.getY(index); - this.z = attribute.getZ(index); - this.w = attribute.getW(index); - return this; - } - random() { - this.x = Math.random(); - this.y = Math.random(); - this.z = Math.random(); - this.w = Math.random(); - return this; - } - *[Symbol.iterator]() { - yield this.x; - yield this.y; - yield this.z; - yield this.w; - } -} -class RenderTarget extends EventDispatcher { - static { - __name(this, "RenderTarget"); - } - constructor(width = 1, height = 1, options = {}) { - super(); - this.isRenderTarget = true; - this.width = width; - this.height = height; - this.depth = 1; - this.scissor = new Vector4(0, 0, width, height); - this.scissorTest = false; - this.viewport = new Vector4(0, 0, width, height); - const image = { width, height, depth: 1 }; - options = Object.assign({ - generateMipmaps: false, - internalFormat: null, - minFilter: LinearFilter, - depthBuffer: true, - stencilBuffer: false, - resolveDepthBuffer: true, - resolveStencilBuffer: true, - depthTexture: null, - samples: 0, - count: 1 - }, options); - const texture = new Texture(image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace); - texture.flipY = false; - texture.generateMipmaps = options.generateMipmaps; - texture.internalFormat = options.internalFormat; - this.textures = []; - const count = options.count; - for (let i = 0; i < count; i++) { - this.textures[i] = texture.clone(); - this.textures[i].isRenderTargetTexture = true; - } - this.depthBuffer = options.depthBuffer; - this.stencilBuffer = options.stencilBuffer; - this.resolveDepthBuffer = options.resolveDepthBuffer; - this.resolveStencilBuffer = options.resolveStencilBuffer; - this.depthTexture = options.depthTexture; - this.samples = options.samples; - } - get texture() { - return this.textures[0]; - } - set texture(value) { - this.textures[0] = value; - } - setSize(width, height, depth = 1) { - if (this.width !== width || this.height !== height || this.depth !== depth) { - this.width = width; - this.height = height; - this.depth = depth; - for (let i = 0, il = this.textures.length; i < il; i++) { - this.textures[i].image.width = width; - this.textures[i].image.height = height; - this.textures[i].image.depth = depth; - } - this.dispose(); - } - this.viewport.set(0, 0, width, height); - this.scissor.set(0, 0, width, height); - } - clone() { - return new this.constructor().copy(this); - } - copy(source) { - this.width = source.width; - this.height = source.height; - this.depth = source.depth; - this.scissor.copy(source.scissor); - this.scissorTest = source.scissorTest; - this.viewport.copy(source.viewport); - this.textures.length = 0; - for (let i = 0, il = source.textures.length; i < il; i++) { - this.textures[i] = source.textures[i].clone(); - this.textures[i].isRenderTargetTexture = true; - } - const image = Object.assign({}, source.texture.image); - this.texture.source = new Source(image); - this.depthBuffer = source.depthBuffer; - this.stencilBuffer = source.stencilBuffer; - this.resolveDepthBuffer = source.resolveDepthBuffer; - this.resolveStencilBuffer = source.resolveStencilBuffer; - if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone(); - this.samples = source.samples; - return this; - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } -} -class WebGLRenderTarget extends RenderTarget { - static { - __name(this, "WebGLRenderTarget"); - } - constructor(width = 1, height = 1, options = {}) { - super(width, height, options); - this.isWebGLRenderTarget = true; - } -} -class DataArrayTexture extends Texture { - static { - __name(this, "DataArrayTexture"); - } - constructor(data = null, width = 1, height = 1, depth = 1) { - super(null); - this.isDataArrayTexture = true; - this.image = { data, width, height, depth }; - this.magFilter = NearestFilter; - this.minFilter = NearestFilter; - this.wrapR = ClampToEdgeWrapping; - this.generateMipmaps = false; - this.flipY = false; - this.unpackAlignment = 1; - this.layerUpdates = /* @__PURE__ */ new Set(); - } - addLayerUpdate(layerIndex) { - this.layerUpdates.add(layerIndex); - } - clearLayerUpdates() { - this.layerUpdates.clear(); - } -} -class WebGLArrayRenderTarget extends WebGLRenderTarget { - static { - __name(this, "WebGLArrayRenderTarget"); - } - constructor(width = 1, height = 1, depth = 1, options = {}) { - super(width, height, options); - this.isWebGLArrayRenderTarget = true; - this.depth = depth; - this.texture = new DataArrayTexture(null, width, height, depth); - this.texture.isRenderTargetTexture = true; - } -} -class Data3DTexture extends Texture { - static { - __name(this, "Data3DTexture"); - } - constructor(data = null, width = 1, height = 1, depth = 1) { - super(null); - this.isData3DTexture = true; - this.image = { data, width, height, depth }; - this.magFilter = NearestFilter; - this.minFilter = NearestFilter; - this.wrapR = ClampToEdgeWrapping; - this.generateMipmaps = false; - this.flipY = false; - this.unpackAlignment = 1; - } -} -class WebGL3DRenderTarget extends WebGLRenderTarget { - static { - __name(this, "WebGL3DRenderTarget"); - } - constructor(width = 1, height = 1, depth = 1, options = {}) { - super(width, height, options); - this.isWebGL3DRenderTarget = true; - this.depth = depth; - this.texture = new Data3DTexture(null, width, height, depth); - this.texture.isRenderTargetTexture = true; - } -} -class Quaternion { - static { - __name(this, "Quaternion"); - } - constructor(x = 0, y = 0, z = 0, w = 1) { - this.isQuaternion = true; - this._x = x; - this._y = y; - this._z = z; - this._w = w; - } - static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t2) { - let x0 = src0[srcOffset0 + 0], y0 = src0[srcOffset0 + 1], z0 = src0[srcOffset0 + 2], w0 = src0[srcOffset0 + 3]; - const x1 = src1[srcOffset1 + 0], y1 = src1[srcOffset1 + 1], z1 = src1[srcOffset1 + 2], w1 = src1[srcOffset1 + 3]; - if (t2 === 0) { - dst[dstOffset + 0] = x0; - dst[dstOffset + 1] = y0; - dst[dstOffset + 2] = z0; - dst[dstOffset + 3] = w0; - return; - } - if (t2 === 1) { - dst[dstOffset + 0] = x1; - dst[dstOffset + 1] = y1; - dst[dstOffset + 2] = z1; - dst[dstOffset + 3] = w1; - return; - } - if (w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1) { - let s = 1 - t2; - const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1, dir = cos >= 0 ? 1 : -1, sqrSin = 1 - cos * cos; - if (sqrSin > Number.EPSILON) { - const sin = Math.sqrt(sqrSin), len = Math.atan2(sin, cos * dir); - s = Math.sin(s * len) / sin; - t2 = Math.sin(t2 * len) / sin; - } - const tDir = t2 * dir; - x0 = x0 * s + x1 * tDir; - y0 = y0 * s + y1 * tDir; - z0 = z0 * s + z1 * tDir; - w0 = w0 * s + w1 * tDir; - if (s === 1 - t2) { - const f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0); - x0 *= f; - y0 *= f; - z0 *= f; - w0 *= f; - } - } - dst[dstOffset] = x0; - dst[dstOffset + 1] = y0; - dst[dstOffset + 2] = z0; - dst[dstOffset + 3] = w0; - } - static multiplyQuaternionsFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1) { - const x0 = src0[srcOffset0]; - const y0 = src0[srcOffset0 + 1]; - const z0 = src0[srcOffset0 + 2]; - const w0 = src0[srcOffset0 + 3]; - const x1 = src1[srcOffset1]; - const y1 = src1[srcOffset1 + 1]; - const z1 = src1[srcOffset1 + 2]; - const w1 = src1[srcOffset1 + 3]; - dst[dstOffset] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1; - dst[dstOffset + 1] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1; - dst[dstOffset + 2] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1; - dst[dstOffset + 3] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1; - return dst; - } - get x() { - return this._x; - } - set x(value) { - this._x = value; - this._onChangeCallback(); - } - get y() { - return this._y; - } - set y(value) { - this._y = value; - this._onChangeCallback(); - } - get z() { - return this._z; - } - set z(value) { - this._z = value; - this._onChangeCallback(); - } - get w() { - return this._w; - } - set w(value) { - this._w = value; - this._onChangeCallback(); - } - set(x, y, z, w) { - this._x = x; - this._y = y; - this._z = z; - this._w = w; - this._onChangeCallback(); - return this; - } - clone() { - return new this.constructor(this._x, this._y, this._z, this._w); - } - copy(quaternion) { - this._x = quaternion.x; - this._y = quaternion.y; - this._z = quaternion.z; - this._w = quaternion.w; - this._onChangeCallback(); - return this; - } - setFromEuler(euler, update = true) { - const x = euler._x, y = euler._y, z = euler._z, order = euler._order; - const cos = Math.cos; - const sin = Math.sin; - const c1 = cos(x / 2); - const c2 = cos(y / 2); - const c3 = cos(z / 2); - const s1 = sin(x / 2); - const s2 = sin(y / 2); - const s3 = sin(z / 2); - switch (order) { - case "XYZ": - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - break; - case "YXZ": - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - break; - case "ZXY": - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - break; - case "ZYX": - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - break; - case "YZX": - this._x = s1 * c2 * c3 + c1 * s2 * s3; - this._y = c1 * s2 * c3 + s1 * c2 * s3; - this._z = c1 * c2 * s3 - s1 * s2 * c3; - this._w = c1 * c2 * c3 - s1 * s2 * s3; - break; - case "XZY": - this._x = s1 * c2 * c3 - c1 * s2 * s3; - this._y = c1 * s2 * c3 - s1 * c2 * s3; - this._z = c1 * c2 * s3 + s1 * s2 * c3; - this._w = c1 * c2 * c3 + s1 * s2 * s3; - break; - default: - console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + order); - } - if (update === true) this._onChangeCallback(); - return this; - } - setFromAxisAngle(axis, angle) { - const halfAngle = angle / 2, s = Math.sin(halfAngle); - this._x = axis.x * s; - this._y = axis.y * s; - this._z = axis.z * s; - this._w = Math.cos(halfAngle); - this._onChangeCallback(); - return this; - } - setFromRotationMatrix(m) { - const te2 = m.elements, m11 = te2[0], m12 = te2[4], m13 = te2[8], m21 = te2[1], m22 = te2[5], m23 = te2[9], m31 = te2[2], m32 = te2[6], m33 = te2[10], trace = m11 + m22 + m33; - if (trace > 0) { - const s = 0.5 / Math.sqrt(trace + 1); - this._w = 0.25 / s; - this._x = (m32 - m23) * s; - this._y = (m13 - m31) * s; - this._z = (m21 - m12) * s; - } else if (m11 > m22 && m11 > m33) { - const s = 2 * Math.sqrt(1 + m11 - m22 - m33); - this._w = (m32 - m23) / s; - this._x = 0.25 * s; - this._y = (m12 + m21) / s; - this._z = (m13 + m31) / s; - } else if (m22 > m33) { - const s = 2 * Math.sqrt(1 + m22 - m11 - m33); - this._w = (m13 - m31) / s; - this._x = (m12 + m21) / s; - this._y = 0.25 * s; - this._z = (m23 + m32) / s; - } else { - const s = 2 * Math.sqrt(1 + m33 - m11 - m22); - this._w = (m21 - m12) / s; - this._x = (m13 + m31) / s; - this._y = (m23 + m32) / s; - this._z = 0.25 * s; - } - this._onChangeCallback(); - return this; - } - setFromUnitVectors(vFrom, vTo) { - let r = vFrom.dot(vTo) + 1; - if (r < Number.EPSILON) { - r = 0; - if (Math.abs(vFrom.x) > Math.abs(vFrom.z)) { - this._x = -vFrom.y; - this._y = vFrom.x; - this._z = 0; - this._w = r; - } else { - this._x = 0; - this._y = -vFrom.z; - this._z = vFrom.y; - this._w = r; - } - } else { - this._x = vFrom.y * vTo.z - vFrom.z * vTo.y; - this._y = vFrom.z * vTo.x - vFrom.x * vTo.z; - this._z = vFrom.x * vTo.y - vFrom.y * vTo.x; - this._w = r; - } - return this.normalize(); - } - angleTo(q) { - return 2 * Math.acos(Math.abs(clamp(this.dot(q), -1, 1))); - } - rotateTowards(q, step) { - const angle = this.angleTo(q); - if (angle === 0) return this; - const t2 = Math.min(1, step / angle); - this.slerp(q, t2); - return this; - } - identity() { - return this.set(0, 0, 0, 1); - } - invert() { - return this.conjugate(); - } - conjugate() { - this._x *= -1; - this._y *= -1; - this._z *= -1; - this._onChangeCallback(); - return this; - } - dot(v) { - return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w; - } - lengthSq() { - return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w; - } - length() { - return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w); - } - normalize() { - let l = this.length(); - if (l === 0) { - this._x = 0; - this._y = 0; - this._z = 0; - this._w = 1; - } else { - l = 1 / l; - this._x = this._x * l; - this._y = this._y * l; - this._z = this._z * l; - this._w = this._w * l; - } - this._onChangeCallback(); - return this; - } - multiply(q) { - return this.multiplyQuaternions(this, q); - } - premultiply(q) { - return this.multiplyQuaternions(q, this); - } - multiplyQuaternions(a, b) { - const qax = a._x, qay = a._y, qaz = a._z, qaw = a._w; - const qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w; - this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; - this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; - this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; - this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; - this._onChangeCallback(); - return this; - } - slerp(qb, t2) { - if (t2 === 0) return this; - if (t2 === 1) return this.copy(qb); - const x = this._x, y = this._y, z = this._z, w = this._w; - let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; - if (cosHalfTheta < 0) { - this._w = -qb._w; - this._x = -qb._x; - this._y = -qb._y; - this._z = -qb._z; - cosHalfTheta = -cosHalfTheta; - } else { - this.copy(qb); - } - if (cosHalfTheta >= 1) { - this._w = w; - this._x = x; - this._y = y; - this._z = z; - return this; - } - const sqrSinHalfTheta = 1 - cosHalfTheta * cosHalfTheta; - if (sqrSinHalfTheta <= Number.EPSILON) { - const s = 1 - t2; - this._w = s * w + t2 * this._w; - this._x = s * x + t2 * this._x; - this._y = s * y + t2 * this._y; - this._z = s * z + t2 * this._z; - this.normalize(); - return this; - } - const sinHalfTheta = Math.sqrt(sqrSinHalfTheta); - const halfTheta = Math.atan2(sinHalfTheta, cosHalfTheta); - const ratioA = Math.sin((1 - t2) * halfTheta) / sinHalfTheta, ratioB = Math.sin(t2 * halfTheta) / sinHalfTheta; - this._w = w * ratioA + this._w * ratioB; - this._x = x * ratioA + this._x * ratioB; - this._y = y * ratioA + this._y * ratioB; - this._z = z * ratioA + this._z * ratioB; - this._onChangeCallback(); - return this; - } - slerpQuaternions(qa, qb, t2) { - return this.copy(qa).slerp(qb, t2); - } - random() { - const theta1 = 2 * Math.PI * Math.random(); - const theta2 = 2 * Math.PI * Math.random(); - const x0 = Math.random(); - const r1 = Math.sqrt(1 - x0); - const r2 = Math.sqrt(x0); - return this.set( - r1 * Math.sin(theta1), - r1 * Math.cos(theta1), - r2 * Math.sin(theta2), - r2 * Math.cos(theta2) - ); - } - equals(quaternion) { - return quaternion._x === this._x && quaternion._y === this._y && quaternion._z === this._z && quaternion._w === this._w; - } - fromArray(array, offset = 0) { - this._x = array[offset]; - this._y = array[offset + 1]; - this._z = array[offset + 2]; - this._w = array[offset + 3]; - this._onChangeCallback(); - return this; - } - toArray(array = [], offset = 0) { - array[offset] = this._x; - array[offset + 1] = this._y; - array[offset + 2] = this._z; - array[offset + 3] = this._w; - return array; - } - fromBufferAttribute(attribute, index) { - this._x = attribute.getX(index); - this._y = attribute.getY(index); - this._z = attribute.getZ(index); - this._w = attribute.getW(index); - this._onChangeCallback(); - return this; - } - toJSON() { - return this.toArray(); - } - _onChange(callback) { - this._onChangeCallback = callback; - return this; - } - _onChangeCallback() { - } - *[Symbol.iterator]() { - yield this._x; - yield this._y; - yield this._z; - yield this._w; - } -} -class Vector3 { - static { - __name(this, "Vector3"); - } - constructor(x = 0, y = 0, z = 0) { - Vector3.prototype.isVector3 = true; - this.x = x; - this.y = y; - this.z = z; - } - set(x, y, z) { - if (z === void 0) z = this.z; - this.x = x; - this.y = y; - this.z = z; - return this; - } - setScalar(scalar) { - this.x = scalar; - this.y = scalar; - this.z = scalar; - return this; - } - setX(x) { - this.x = x; - return this; - } - setY(y) { - this.y = y; - return this; - } - setZ(z) { - this.z = z; - return this; - } - setComponent(index, value) { - switch (index) { - case 0: - this.x = value; - break; - case 1: - this.y = value; - break; - case 2: - this.z = value; - break; - default: - throw new Error("index is out of range: " + index); - } - return this; - } - getComponent(index) { - switch (index) { - case 0: - return this.x; - case 1: - return this.y; - case 2: - return this.z; - default: - throw new Error("index is out of range: " + index); - } - } - clone() { - return new this.constructor(this.x, this.y, this.z); - } - copy(v) { - this.x = v.x; - this.y = v.y; - this.z = v.z; - return this; - } - add(v) { - this.x += v.x; - this.y += v.y; - this.z += v.z; - return this; - } - addScalar(s) { - this.x += s; - this.y += s; - this.z += s; - return this; - } - addVectors(a, b) { - this.x = a.x + b.x; - this.y = a.y + b.y; - this.z = a.z + b.z; - return this; - } - addScaledVector(v, s) { - this.x += v.x * s; - this.y += v.y * s; - this.z += v.z * s; - return this; - } - sub(v) { - this.x -= v.x; - this.y -= v.y; - this.z -= v.z; - return this; - } - subScalar(s) { - this.x -= s; - this.y -= s; - this.z -= s; - return this; - } - subVectors(a, b) { - this.x = a.x - b.x; - this.y = a.y - b.y; - this.z = a.z - b.z; - return this; - } - multiply(v) { - this.x *= v.x; - this.y *= v.y; - this.z *= v.z; - return this; - } - multiplyScalar(scalar) { - this.x *= scalar; - this.y *= scalar; - this.z *= scalar; - return this; - } - multiplyVectors(a, b) { - this.x = a.x * b.x; - this.y = a.y * b.y; - this.z = a.z * b.z; - return this; - } - applyEuler(euler) { - return this.applyQuaternion(_quaternion$4.setFromEuler(euler)); - } - applyAxisAngle(axis, angle) { - return this.applyQuaternion(_quaternion$4.setFromAxisAngle(axis, angle)); - } - applyMatrix3(m) { - const x = this.x, y = this.y, z = this.z; - const e = m.elements; - this.x = e[0] * x + e[3] * y + e[6] * z; - this.y = e[1] * x + e[4] * y + e[7] * z; - this.z = e[2] * x + e[5] * y + e[8] * z; - return this; - } - applyNormalMatrix(m) { - return this.applyMatrix3(m).normalize(); - } - applyMatrix4(m) { - const x = this.x, y = this.y, z = this.z; - const e = m.elements; - const w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]); - this.x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w; - this.y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w; - this.z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w; - return this; - } - applyQuaternion(q) { - const vx = this.x, vy = this.y, vz = this.z; - const qx = q.x, qy = q.y, qz = q.z, qw = q.w; - const tx = 2 * (qy * vz - qz * vy); - const ty = 2 * (qz * vx - qx * vz); - const tz = 2 * (qx * vy - qy * vx); - this.x = vx + qw * tx + qy * tz - qz * ty; - this.y = vy + qw * ty + qz * tx - qx * tz; - this.z = vz + qw * tz + qx * ty - qy * tx; - return this; - } - project(camera) { - return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix); - } - unproject(camera) { - return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld); - } - transformDirection(m) { - const x = this.x, y = this.y, z = this.z; - const e = m.elements; - this.x = e[0] * x + e[4] * y + e[8] * z; - this.y = e[1] * x + e[5] * y + e[9] * z; - this.z = e[2] * x + e[6] * y + e[10] * z; - return this.normalize(); - } - divide(v) { - this.x /= v.x; - this.y /= v.y; - this.z /= v.z; - return this; - } - divideScalar(scalar) { - return this.multiplyScalar(1 / scalar); - } - min(v) { - this.x = Math.min(this.x, v.x); - this.y = Math.min(this.y, v.y); - this.z = Math.min(this.z, v.z); - return this; - } - max(v) { - this.x = Math.max(this.x, v.x); - this.y = Math.max(this.y, v.y); - this.z = Math.max(this.z, v.z); - return this; - } - clamp(min, max2) { - this.x = Math.max(min.x, Math.min(max2.x, this.x)); - this.y = Math.max(min.y, Math.min(max2.y, this.y)); - this.z = Math.max(min.z, Math.min(max2.z, this.z)); - return this; - } - clampScalar(minVal, maxVal) { - this.x = Math.max(minVal, Math.min(maxVal, this.x)); - this.y = Math.max(minVal, Math.min(maxVal, this.y)); - this.z = Math.max(minVal, Math.min(maxVal, this.z)); - return this; - } - clampLength(min, max2) { - const length = this.length(); - return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max2, length))); - } - floor() { - this.x = Math.floor(this.x); - this.y = Math.floor(this.y); - this.z = Math.floor(this.z); - return this; - } - ceil() { - this.x = Math.ceil(this.x); - this.y = Math.ceil(this.y); - this.z = Math.ceil(this.z); - return this; - } - round() { - this.x = Math.round(this.x); - this.y = Math.round(this.y); - this.z = Math.round(this.z); - return this; - } - roundToZero() { - this.x = Math.trunc(this.x); - this.y = Math.trunc(this.y); - this.z = Math.trunc(this.z); - return this; - } - negate() { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - return this; - } - dot(v) { - return this.x * v.x + this.y * v.y + this.z * v.z; - } - // TODO lengthSquared? - lengthSq() { - return this.x * this.x + this.y * this.y + this.z * this.z; - } - length() { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - } - manhattanLength() { - return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z); - } - normalize() { - return this.divideScalar(this.length() || 1); - } - setLength(length) { - return this.normalize().multiplyScalar(length); - } - lerp(v, alpha) { - this.x += (v.x - this.x) * alpha; - this.y += (v.y - this.y) * alpha; - this.z += (v.z - this.z) * alpha; - return this; - } - lerpVectors(v1, v2, alpha) { - this.x = v1.x + (v2.x - v1.x) * alpha; - this.y = v1.y + (v2.y - v1.y) * alpha; - this.z = v1.z + (v2.z - v1.z) * alpha; - return this; - } - cross(v) { - return this.crossVectors(this, v); - } - crossVectors(a, b) { - const ax = a.x, ay = a.y, az = a.z; - const bx = b.x, by = b.y, bz = b.z; - this.x = ay * bz - az * by; - this.y = az * bx - ax * bz; - this.z = ax * by - ay * bx; - return this; - } - projectOnVector(v) { - const denominator = v.lengthSq(); - if (denominator === 0) return this.set(0, 0, 0); - const scalar = v.dot(this) / denominator; - return this.copy(v).multiplyScalar(scalar); - } - projectOnPlane(planeNormal) { - _vector$c.copy(this).projectOnVector(planeNormal); - return this.sub(_vector$c); - } - reflect(normal) { - return this.sub(_vector$c.copy(normal).multiplyScalar(2 * this.dot(normal))); - } - angleTo(v) { - const denominator = Math.sqrt(this.lengthSq() * v.lengthSq()); - if (denominator === 0) return Math.PI / 2; - const theta = this.dot(v) / denominator; - return Math.acos(clamp(theta, -1, 1)); - } - distanceTo(v) { - return Math.sqrt(this.distanceToSquared(v)); - } - distanceToSquared(v) { - const dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z; - return dx * dx + dy * dy + dz * dz; - } - manhattanDistanceTo(v) { - return Math.abs(this.x - v.x) + Math.abs(this.y - v.y) + Math.abs(this.z - v.z); - } - setFromSpherical(s) { - return this.setFromSphericalCoords(s.radius, s.phi, s.theta); - } - setFromSphericalCoords(radius, phi, theta) { - const sinPhiRadius = Math.sin(phi) * radius; - this.x = sinPhiRadius * Math.sin(theta); - this.y = Math.cos(phi) * radius; - this.z = sinPhiRadius * Math.cos(theta); - return this; - } - setFromCylindrical(c) { - return this.setFromCylindricalCoords(c.radius, c.theta, c.y); - } - setFromCylindricalCoords(radius, theta, y) { - this.x = radius * Math.sin(theta); - this.y = y; - this.z = radius * Math.cos(theta); - return this; - } - setFromMatrixPosition(m) { - const e = m.elements; - this.x = e[12]; - this.y = e[13]; - this.z = e[14]; - return this; - } - setFromMatrixScale(m) { - const sx = this.setFromMatrixColumn(m, 0).length(); - const sy = this.setFromMatrixColumn(m, 1).length(); - const sz = this.setFromMatrixColumn(m, 2).length(); - this.x = sx; - this.y = sy; - this.z = sz; - return this; - } - setFromMatrixColumn(m, index) { - return this.fromArray(m.elements, index * 4); - } - setFromMatrix3Column(m, index) { - return this.fromArray(m.elements, index * 3); - } - setFromEuler(e) { - this.x = e._x; - this.y = e._y; - this.z = e._z; - return this; - } - setFromColor(c) { - this.x = c.r; - this.y = c.g; - this.z = c.b; - return this; - } - equals(v) { - return v.x === this.x && v.y === this.y && v.z === this.z; - } - fromArray(array, offset = 0) { - this.x = array[offset]; - this.y = array[offset + 1]; - this.z = array[offset + 2]; - return this; - } - toArray(array = [], offset = 0) { - array[offset] = this.x; - array[offset + 1] = this.y; - array[offset + 2] = this.z; - return array; - } - fromBufferAttribute(attribute, index) { - this.x = attribute.getX(index); - this.y = attribute.getY(index); - this.z = attribute.getZ(index); - return this; - } - random() { - this.x = Math.random(); - this.y = Math.random(); - this.z = Math.random(); - return this; - } - randomDirection() { - const theta = Math.random() * Math.PI * 2; - const u = Math.random() * 2 - 1; - const c = Math.sqrt(1 - u * u); - this.x = c * Math.cos(theta); - this.y = u; - this.z = c * Math.sin(theta); - return this; - } - *[Symbol.iterator]() { - yield this.x; - yield this.y; - yield this.z; - } -} -const _vector$c = /* @__PURE__ */ new Vector3(); -const _quaternion$4 = /* @__PURE__ */ new Quaternion(); -class Box3 { - static { - __name(this, "Box3"); - } - constructor(min = new Vector3(Infinity, Infinity, Infinity), max2 = new Vector3(-Infinity, -Infinity, -Infinity)) { - this.isBox3 = true; - this.min = min; - this.max = max2; - } - set(min, max2) { - this.min.copy(min); - this.max.copy(max2); - return this; - } - setFromArray(array) { - this.makeEmpty(); - for (let i = 0, il = array.length; i < il; i += 3) { - this.expandByPoint(_vector$b.fromArray(array, i)); - } - return this; - } - setFromBufferAttribute(attribute) { - this.makeEmpty(); - for (let i = 0, il = attribute.count; i < il; i++) { - this.expandByPoint(_vector$b.fromBufferAttribute(attribute, i)); - } - return this; - } - setFromPoints(points) { - this.makeEmpty(); - for (let i = 0, il = points.length; i < il; i++) { - this.expandByPoint(points[i]); - } - return this; - } - setFromCenterAndSize(center, size) { - const halfSize = _vector$b.copy(size).multiplyScalar(0.5); - this.min.copy(center).sub(halfSize); - this.max.copy(center).add(halfSize); - return this; - } - setFromObject(object, precise = false) { - this.makeEmpty(); - return this.expandByObject(object, precise); - } - clone() { - return new this.constructor().copy(this); - } - copy(box) { - this.min.copy(box.min); - this.max.copy(box.max); - return this; - } - makeEmpty() { - this.min.x = this.min.y = this.min.z = Infinity; - this.max.x = this.max.y = this.max.z = -Infinity; - return this; - } - isEmpty() { - return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z; - } - getCenter(target) { - return this.isEmpty() ? target.set(0, 0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5); - } - getSize(target) { - return this.isEmpty() ? target.set(0, 0, 0) : target.subVectors(this.max, this.min); - } - expandByPoint(point) { - this.min.min(point); - this.max.max(point); - return this; - } - expandByVector(vector) { - this.min.sub(vector); - this.max.add(vector); - return this; - } - expandByScalar(scalar) { - this.min.addScalar(-scalar); - this.max.addScalar(scalar); - return this; - } - expandByObject(object, precise = false) { - object.updateWorldMatrix(false, false); - const geometry = object.geometry; - if (geometry !== void 0) { - const positionAttribute = geometry.getAttribute("position"); - if (precise === true && positionAttribute !== void 0 && object.isInstancedMesh !== true) { - for (let i = 0, l = positionAttribute.count; i < l; i++) { - if (object.isMesh === true) { - object.getVertexPosition(i, _vector$b); - } else { - _vector$b.fromBufferAttribute(positionAttribute, i); - } - _vector$b.applyMatrix4(object.matrixWorld); - this.expandByPoint(_vector$b); - } - } else { - if (object.boundingBox !== void 0) { - if (object.boundingBox === null) { - object.computeBoundingBox(); - } - _box$4.copy(object.boundingBox); - } else { - if (geometry.boundingBox === null) { - geometry.computeBoundingBox(); - } - _box$4.copy(geometry.boundingBox); - } - _box$4.applyMatrix4(object.matrixWorld); - this.union(_box$4); - } - } - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { - this.expandByObject(children[i], precise); - } - return this; - } - containsPoint(point) { - return point.x >= this.min.x && point.x <= this.max.x && point.y >= this.min.y && point.y <= this.max.y && point.z >= this.min.z && point.z <= this.max.z; - } - containsBox(box) { - return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y && this.min.z <= box.min.z && box.max.z <= this.max.z; - } - getParameter(point, target) { - return target.set( - (point.x - this.min.x) / (this.max.x - this.min.x), - (point.y - this.min.y) / (this.max.y - this.min.y), - (point.z - this.min.z) / (this.max.z - this.min.z) - ); - } - intersectsBox(box) { - return box.max.x >= this.min.x && box.min.x <= this.max.x && box.max.y >= this.min.y && box.min.y <= this.max.y && box.max.z >= this.min.z && box.min.z <= this.max.z; - } - intersectsSphere(sphere) { - this.clampPoint(sphere.center, _vector$b); - return _vector$b.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius; - } - intersectsPlane(plane) { - let min, max2; - if (plane.normal.x > 0) { - min = plane.normal.x * this.min.x; - max2 = plane.normal.x * this.max.x; - } else { - min = plane.normal.x * this.max.x; - max2 = plane.normal.x * this.min.x; - } - if (plane.normal.y > 0) { - min += plane.normal.y * this.min.y; - max2 += plane.normal.y * this.max.y; - } else { - min += plane.normal.y * this.max.y; - max2 += plane.normal.y * this.min.y; - } - if (plane.normal.z > 0) { - min += plane.normal.z * this.min.z; - max2 += plane.normal.z * this.max.z; - } else { - min += plane.normal.z * this.max.z; - max2 += plane.normal.z * this.min.z; - } - return min <= -plane.constant && max2 >= -plane.constant; - } - intersectsTriangle(triangle) { - if (this.isEmpty()) { - return false; - } - this.getCenter(_center); - _extents.subVectors(this.max, _center); - _v0$3.subVectors(triangle.a, _center); - _v1$7.subVectors(triangle.b, _center); - _v2$4.subVectors(triangle.c, _center); - _f0.subVectors(_v1$7, _v0$3); - _f1.subVectors(_v2$4, _v1$7); - _f2.subVectors(_v0$3, _v2$4); - let axes = [ - 0, - -_f0.z, - _f0.y, - 0, - -_f1.z, - _f1.y, - 0, - -_f2.z, - _f2.y, - _f0.z, - 0, - -_f0.x, - _f1.z, - 0, - -_f1.x, - _f2.z, - 0, - -_f2.x, - -_f0.y, - _f0.x, - 0, - -_f1.y, - _f1.x, - 0, - -_f2.y, - _f2.x, - 0 - ]; - if (!satForAxes(axes, _v0$3, _v1$7, _v2$4, _extents)) { - return false; - } - axes = [1, 0, 0, 0, 1, 0, 0, 0, 1]; - if (!satForAxes(axes, _v0$3, _v1$7, _v2$4, _extents)) { - return false; - } - _triangleNormal.crossVectors(_f0, _f1); - axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z]; - return satForAxes(axes, _v0$3, _v1$7, _v2$4, _extents); - } - clampPoint(point, target) { - return target.copy(point).clamp(this.min, this.max); - } - distanceToPoint(point) { - return this.clampPoint(point, _vector$b).distanceTo(point); - } - getBoundingSphere(target) { - if (this.isEmpty()) { - target.makeEmpty(); - } else { - this.getCenter(target.center); - target.radius = this.getSize(_vector$b).length() * 0.5; - } - return target; - } - intersect(box) { - this.min.max(box.min); - this.max.min(box.max); - if (this.isEmpty()) this.makeEmpty(); - return this; - } - union(box) { - this.min.min(box.min); - this.max.max(box.max); - return this; - } - applyMatrix4(matrix) { - if (this.isEmpty()) return this; - _points[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(matrix); - _points[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(matrix); - _points[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(matrix); - _points[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(matrix); - _points[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(matrix); - _points[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(matrix); - _points[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(matrix); - _points[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(matrix); - this.setFromPoints(_points); - return this; - } - translate(offset) { - this.min.add(offset); - this.max.add(offset); - return this; - } - equals(box) { - return box.min.equals(this.min) && box.max.equals(this.max); - } -} -const _points = [ - /* @__PURE__ */ new Vector3(), - /* @__PURE__ */ new Vector3(), - /* @__PURE__ */ new Vector3(), - /* @__PURE__ */ new Vector3(), - /* @__PURE__ */ new Vector3(), - /* @__PURE__ */ new Vector3(), - /* @__PURE__ */ new Vector3(), - /* @__PURE__ */ new Vector3() -]; -const _vector$b = /* @__PURE__ */ new Vector3(); -const _box$4 = /* @__PURE__ */ new Box3(); -const _v0$3 = /* @__PURE__ */ new Vector3(); -const _v1$7 = /* @__PURE__ */ new Vector3(); -const _v2$4 = /* @__PURE__ */ new Vector3(); -const _f0 = /* @__PURE__ */ new Vector3(); -const _f1 = /* @__PURE__ */ new Vector3(); -const _f2 = /* @__PURE__ */ new Vector3(); -const _center = /* @__PURE__ */ new Vector3(); -const _extents = /* @__PURE__ */ new Vector3(); -const _triangleNormal = /* @__PURE__ */ new Vector3(); -const _testAxis = /* @__PURE__ */ new Vector3(); -function satForAxes(axes, v0, v1, v2, extents) { - for (let i = 0, j = axes.length - 3; i <= j; i += 3) { - _testAxis.fromArray(axes, i); - const r = extents.x * Math.abs(_testAxis.x) + extents.y * Math.abs(_testAxis.y) + extents.z * Math.abs(_testAxis.z); - const p0 = v0.dot(_testAxis); - const p1 = v1.dot(_testAxis); - const p2 = v2.dot(_testAxis); - if (Math.max(-Math.max(p0, p1, p2), Math.min(p0, p1, p2)) > r) { - return false; - } - } - return true; -} -__name(satForAxes, "satForAxes"); -const _box$3 = /* @__PURE__ */ new Box3(); -const _v1$6 = /* @__PURE__ */ new Vector3(); -const _v2$3 = /* @__PURE__ */ new Vector3(); -class Sphere { - static { - __name(this, "Sphere"); - } - constructor(center = new Vector3(), radius = -1) { - this.isSphere = true; - this.center = center; - this.radius = radius; - } - set(center, radius) { - this.center.copy(center); - this.radius = radius; - return this; - } - setFromPoints(points, optionalCenter) { - const center = this.center; - if (optionalCenter !== void 0) { - center.copy(optionalCenter); - } else { - _box$3.setFromPoints(points).getCenter(center); - } - let maxRadiusSq = 0; - for (let i = 0, il = points.length; i < il; i++) { - maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(points[i])); - } - this.radius = Math.sqrt(maxRadiusSq); - return this; - } - copy(sphere) { - this.center.copy(sphere.center); - this.radius = sphere.radius; - return this; - } - isEmpty() { - return this.radius < 0; - } - makeEmpty() { - this.center.set(0, 0, 0); - this.radius = -1; - return this; - } - containsPoint(point) { - return point.distanceToSquared(this.center) <= this.radius * this.radius; - } - distanceToPoint(point) { - return point.distanceTo(this.center) - this.radius; - } - intersectsSphere(sphere) { - const radiusSum = this.radius + sphere.radius; - return sphere.center.distanceToSquared(this.center) <= radiusSum * radiusSum; - } - intersectsBox(box) { - return box.intersectsSphere(this); - } - intersectsPlane(plane) { - return Math.abs(plane.distanceToPoint(this.center)) <= this.radius; - } - clampPoint(point, target) { - const deltaLengthSq = this.center.distanceToSquared(point); - target.copy(point); - if (deltaLengthSq > this.radius * this.radius) { - target.sub(this.center).normalize(); - target.multiplyScalar(this.radius).add(this.center); - } - return target; - } - getBoundingBox(target) { - if (this.isEmpty()) { - target.makeEmpty(); - return target; - } - target.set(this.center, this.center); - target.expandByScalar(this.radius); - return target; - } - applyMatrix4(matrix) { - this.center.applyMatrix4(matrix); - this.radius = this.radius * matrix.getMaxScaleOnAxis(); - return this; - } - translate(offset) { - this.center.add(offset); - return this; - } - expandByPoint(point) { - if (this.isEmpty()) { - this.center.copy(point); - this.radius = 0; - return this; - } - _v1$6.subVectors(point, this.center); - const lengthSq = _v1$6.lengthSq(); - if (lengthSq > this.radius * this.radius) { - const length = Math.sqrt(lengthSq); - const delta = (length - this.radius) * 0.5; - this.center.addScaledVector(_v1$6, delta / length); - this.radius += delta; - } - return this; - } - union(sphere) { - if (sphere.isEmpty()) { - return this; - } - if (this.isEmpty()) { - this.copy(sphere); - return this; - } - if (this.center.equals(sphere.center) === true) { - this.radius = Math.max(this.radius, sphere.radius); - } else { - _v2$3.subVectors(sphere.center, this.center).setLength(sphere.radius); - this.expandByPoint(_v1$6.copy(sphere.center).add(_v2$3)); - this.expandByPoint(_v1$6.copy(sphere.center).sub(_v2$3)); - } - return this; - } - equals(sphere) { - return sphere.center.equals(this.center) && sphere.radius === this.radius; - } - clone() { - return new this.constructor().copy(this); - } -} -const _vector$a = /* @__PURE__ */ new Vector3(); -const _segCenter = /* @__PURE__ */ new Vector3(); -const _segDir = /* @__PURE__ */ new Vector3(); -const _diff = /* @__PURE__ */ new Vector3(); -const _edge1 = /* @__PURE__ */ new Vector3(); -const _edge2 = /* @__PURE__ */ new Vector3(); -const _normal$1 = /* @__PURE__ */ new Vector3(); -class Ray { - static { - __name(this, "Ray"); - } - constructor(origin = new Vector3(), direction = new Vector3(0, 0, -1)) { - this.origin = origin; - this.direction = direction; - } - set(origin, direction) { - this.origin.copy(origin); - this.direction.copy(direction); - return this; - } - copy(ray) { - this.origin.copy(ray.origin); - this.direction.copy(ray.direction); - return this; - } - at(t2, target) { - return target.copy(this.origin).addScaledVector(this.direction, t2); - } - lookAt(v) { - this.direction.copy(v).sub(this.origin).normalize(); - return this; - } - recast(t2) { - this.origin.copy(this.at(t2, _vector$a)); - return this; - } - closestPointToPoint(point, target) { - target.subVectors(point, this.origin); - const directionDistance = target.dot(this.direction); - if (directionDistance < 0) { - return target.copy(this.origin); - } - return target.copy(this.origin).addScaledVector(this.direction, directionDistance); - } - distanceToPoint(point) { - return Math.sqrt(this.distanceSqToPoint(point)); - } - distanceSqToPoint(point) { - const directionDistance = _vector$a.subVectors(point, this.origin).dot(this.direction); - if (directionDistance < 0) { - return this.origin.distanceToSquared(point); - } - _vector$a.copy(this.origin).addScaledVector(this.direction, directionDistance); - return _vector$a.distanceToSquared(point); - } - distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) { - _segCenter.copy(v0).add(v1).multiplyScalar(0.5); - _segDir.copy(v1).sub(v0).normalize(); - _diff.copy(this.origin).sub(_segCenter); - const segExtent = v0.distanceTo(v1) * 0.5; - const a01 = -this.direction.dot(_segDir); - const b0 = _diff.dot(this.direction); - const b1 = -_diff.dot(_segDir); - const c = _diff.lengthSq(); - const det = Math.abs(1 - a01 * a01); - let s0, s1, sqrDist, extDet; - if (det > 0) { - s0 = a01 * b1 - b0; - s1 = a01 * b0 - b1; - extDet = segExtent * det; - if (s0 >= 0) { - if (s1 >= -extDet) { - if (s1 <= extDet) { - const invDet = 1 / det; - s0 *= invDet; - s1 *= invDet; - sqrDist = s0 * (s0 + a01 * s1 + 2 * b0) + s1 * (a01 * s0 + s1 + 2 * b1) + c; - } else { - s1 = segExtent; - s0 = Math.max(0, -(a01 * s1 + b0)); - sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; - } - } else { - s1 = -segExtent; - s0 = Math.max(0, -(a01 * s1 + b0)); - sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; - } - } else { - if (s1 <= -extDet) { - s0 = Math.max(0, -(-a01 * segExtent + b0)); - s1 = s0 > 0 ? -segExtent : Math.min(Math.max(-segExtent, -b1), segExtent); - sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; - } else if (s1 <= extDet) { - s0 = 0; - s1 = Math.min(Math.max(-segExtent, -b1), segExtent); - sqrDist = s1 * (s1 + 2 * b1) + c; - } else { - s0 = Math.max(0, -(a01 * segExtent + b0)); - s1 = s0 > 0 ? segExtent : Math.min(Math.max(-segExtent, -b1), segExtent); - sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; - } - } - } else { - s1 = a01 > 0 ? -segExtent : segExtent; - s0 = Math.max(0, -(a01 * s1 + b0)); - sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; - } - if (optionalPointOnRay) { - optionalPointOnRay.copy(this.origin).addScaledVector(this.direction, s0); - } - if (optionalPointOnSegment) { - optionalPointOnSegment.copy(_segCenter).addScaledVector(_segDir, s1); - } - return sqrDist; - } - intersectSphere(sphere, target) { - _vector$a.subVectors(sphere.center, this.origin); - const tca = _vector$a.dot(this.direction); - const d2 = _vector$a.dot(_vector$a) - tca * tca; - const radius2 = sphere.radius * sphere.radius; - if (d2 > radius2) return null; - const thc = Math.sqrt(radius2 - d2); - const t0 = tca - thc; - const t1 = tca + thc; - if (t1 < 0) return null; - if (t0 < 0) return this.at(t1, target); - return this.at(t0, target); - } - intersectsSphere(sphere) { - return this.distanceSqToPoint(sphere.center) <= sphere.radius * sphere.radius; - } - distanceToPlane(plane) { - const denominator = plane.normal.dot(this.direction); - if (denominator === 0) { - if (plane.distanceToPoint(this.origin) === 0) { - return 0; - } - return null; - } - const t2 = -(this.origin.dot(plane.normal) + plane.constant) / denominator; - return t2 >= 0 ? t2 : null; - } - intersectPlane(plane, target) { - const t2 = this.distanceToPlane(plane); - if (t2 === null) { - return null; - } - return this.at(t2, target); - } - intersectsPlane(plane) { - const distToPoint = plane.distanceToPoint(this.origin); - if (distToPoint === 0) { - return true; - } - const denominator = plane.normal.dot(this.direction); - if (denominator * distToPoint < 0) { - return true; - } - return false; - } - intersectBox(box, target) { - let tmin, tmax, tymin, tymax, tzmin, tzmax; - const invdirx = 1 / this.direction.x, invdiry = 1 / this.direction.y, invdirz = 1 / this.direction.z; - const origin = this.origin; - if (invdirx >= 0) { - tmin = (box.min.x - origin.x) * invdirx; - tmax = (box.max.x - origin.x) * invdirx; - } else { - tmin = (box.max.x - origin.x) * invdirx; - tmax = (box.min.x - origin.x) * invdirx; - } - if (invdiry >= 0) { - tymin = (box.min.y - origin.y) * invdiry; - tymax = (box.max.y - origin.y) * invdiry; - } else { - tymin = (box.max.y - origin.y) * invdiry; - tymax = (box.min.y - origin.y) * invdiry; - } - if (tmin > tymax || tymin > tmax) return null; - if (tymin > tmin || isNaN(tmin)) tmin = tymin; - if (tymax < tmax || isNaN(tmax)) tmax = tymax; - if (invdirz >= 0) { - tzmin = (box.min.z - origin.z) * invdirz; - tzmax = (box.max.z - origin.z) * invdirz; - } else { - tzmin = (box.max.z - origin.z) * invdirz; - tzmax = (box.min.z - origin.z) * invdirz; - } - if (tmin > tzmax || tzmin > tmax) return null; - if (tzmin > tmin || tmin !== tmin) tmin = tzmin; - if (tzmax < tmax || tmax !== tmax) tmax = tzmax; - if (tmax < 0) return null; - return this.at(tmin >= 0 ? tmin : tmax, target); - } - intersectsBox(box) { - return this.intersectBox(box, _vector$a) !== null; - } - intersectTriangle(a, b, c, backfaceCulling, target) { - _edge1.subVectors(b, a); - _edge2.subVectors(c, a); - _normal$1.crossVectors(_edge1, _edge2); - let DdN = this.direction.dot(_normal$1); - let sign2; - if (DdN > 0) { - if (backfaceCulling) return null; - sign2 = 1; - } else if (DdN < 0) { - sign2 = -1; - DdN = -DdN; - } else { - return null; - } - _diff.subVectors(this.origin, a); - const DdQxE2 = sign2 * this.direction.dot(_edge2.crossVectors(_diff, _edge2)); - if (DdQxE2 < 0) { - return null; - } - const DdE1xQ = sign2 * this.direction.dot(_edge1.cross(_diff)); - if (DdE1xQ < 0) { - return null; - } - if (DdQxE2 + DdE1xQ > DdN) { - return null; - } - const QdN = -sign2 * _diff.dot(_normal$1); - if (QdN < 0) { - return null; - } - return this.at(QdN / DdN, target); - } - applyMatrix4(matrix4) { - this.origin.applyMatrix4(matrix4); - this.direction.transformDirection(matrix4); - return this; - } - equals(ray) { - return ray.origin.equals(this.origin) && ray.direction.equals(this.direction); - } - clone() { - return new this.constructor().copy(this); - } -} -class Matrix4 { - static { - __name(this, "Matrix4"); - } - constructor(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) { - Matrix4.prototype.isMatrix4 = true; - this.elements = [ - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1 - ]; - if (n11 !== void 0) { - this.set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44); - } - } - set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) { - const te2 = this.elements; - te2[0] = n11; - te2[4] = n12; - te2[8] = n13; - te2[12] = n14; - te2[1] = n21; - te2[5] = n22; - te2[9] = n23; - te2[13] = n24; - te2[2] = n31; - te2[6] = n32; - te2[10] = n33; - te2[14] = n34; - te2[3] = n41; - te2[7] = n42; - te2[11] = n43; - te2[15] = n44; - return this; - } - identity() { - this.set( - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - clone() { - return new Matrix4().fromArray(this.elements); - } - copy(m) { - const te2 = this.elements; - const me = m.elements; - te2[0] = me[0]; - te2[1] = me[1]; - te2[2] = me[2]; - te2[3] = me[3]; - te2[4] = me[4]; - te2[5] = me[5]; - te2[6] = me[6]; - te2[7] = me[7]; - te2[8] = me[8]; - te2[9] = me[9]; - te2[10] = me[10]; - te2[11] = me[11]; - te2[12] = me[12]; - te2[13] = me[13]; - te2[14] = me[14]; - te2[15] = me[15]; - return this; - } - copyPosition(m) { - const te2 = this.elements, me = m.elements; - te2[12] = me[12]; - te2[13] = me[13]; - te2[14] = me[14]; - return this; - } - setFromMatrix3(m) { - const me = m.elements; - this.set( - me[0], - me[3], - me[6], - 0, - me[1], - me[4], - me[7], - 0, - me[2], - me[5], - me[8], - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - extractBasis(xAxis, yAxis, zAxis) { - xAxis.setFromMatrixColumn(this, 0); - yAxis.setFromMatrixColumn(this, 1); - zAxis.setFromMatrixColumn(this, 2); - return this; - } - makeBasis(xAxis, yAxis, zAxis) { - this.set( - xAxis.x, - yAxis.x, - zAxis.x, - 0, - xAxis.y, - yAxis.y, - zAxis.y, - 0, - xAxis.z, - yAxis.z, - zAxis.z, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - extractRotation(m) { - const te2 = this.elements; - const me = m.elements; - const scaleX = 1 / _v1$5.setFromMatrixColumn(m, 0).length(); - const scaleY = 1 / _v1$5.setFromMatrixColumn(m, 1).length(); - const scaleZ = 1 / _v1$5.setFromMatrixColumn(m, 2).length(); - te2[0] = me[0] * scaleX; - te2[1] = me[1] * scaleX; - te2[2] = me[2] * scaleX; - te2[3] = 0; - te2[4] = me[4] * scaleY; - te2[5] = me[5] * scaleY; - te2[6] = me[6] * scaleY; - te2[7] = 0; - te2[8] = me[8] * scaleZ; - te2[9] = me[9] * scaleZ; - te2[10] = me[10] * scaleZ; - te2[11] = 0; - te2[12] = 0; - te2[13] = 0; - te2[14] = 0; - te2[15] = 1; - return this; - } - makeRotationFromEuler(euler) { - const te2 = this.elements; - const x = euler.x, y = euler.y, z = euler.z; - const a = Math.cos(x), b = Math.sin(x); - const c = Math.cos(y), d = Math.sin(y); - const e = Math.cos(z), f = Math.sin(z); - if (euler.order === "XYZ") { - const ae = a * e, af = a * f, be = b * e, bf = b * f; - te2[0] = c * e; - te2[4] = -c * f; - te2[8] = d; - te2[1] = af + be * d; - te2[5] = ae - bf * d; - te2[9] = -b * c; - te2[2] = bf - ae * d; - te2[6] = be + af * d; - te2[10] = a * c; - } else if (euler.order === "YXZ") { - const ce = c * e, cf = c * f, de = d * e, df = d * f; - te2[0] = ce + df * b; - te2[4] = de * b - cf; - te2[8] = a * d; - te2[1] = a * f; - te2[5] = a * e; - te2[9] = -b; - te2[2] = cf * b - de; - te2[6] = df + ce * b; - te2[10] = a * c; - } else if (euler.order === "ZXY") { - const ce = c * e, cf = c * f, de = d * e, df = d * f; - te2[0] = ce - df * b; - te2[4] = -a * f; - te2[8] = de + cf * b; - te2[1] = cf + de * b; - te2[5] = a * e; - te2[9] = df - ce * b; - te2[2] = -a * d; - te2[6] = b; - te2[10] = a * c; - } else if (euler.order === "ZYX") { - const ae = a * e, af = a * f, be = b * e, bf = b * f; - te2[0] = c * e; - te2[4] = be * d - af; - te2[8] = ae * d + bf; - te2[1] = c * f; - te2[5] = bf * d + ae; - te2[9] = af * d - be; - te2[2] = -d; - te2[6] = b * c; - te2[10] = a * c; - } else if (euler.order === "YZX") { - const ac = a * c, ad = a * d, bc = b * c, bd = b * d; - te2[0] = c * e; - te2[4] = bd - ac * f; - te2[8] = bc * f + ad; - te2[1] = f; - te2[5] = a * e; - te2[9] = -b * e; - te2[2] = -d * e; - te2[6] = ad * f + bc; - te2[10] = ac - bd * f; - } else if (euler.order === "XZY") { - const ac = a * c, ad = a * d, bc = b * c, bd = b * d; - te2[0] = c * e; - te2[4] = -f; - te2[8] = d * e; - te2[1] = ac * f + bd; - te2[5] = a * e; - te2[9] = ad * f - bc; - te2[2] = bc * f - ad; - te2[6] = b * e; - te2[10] = bd * f + ac; - } - te2[3] = 0; - te2[7] = 0; - te2[11] = 0; - te2[12] = 0; - te2[13] = 0; - te2[14] = 0; - te2[15] = 1; - return this; - } - makeRotationFromQuaternion(q) { - return this.compose(_zero, q, _one); - } - lookAt(eye, target, up) { - const te2 = this.elements; - _z.subVectors(eye, target); - if (_z.lengthSq() === 0) { - _z.z = 1; - } - _z.normalize(); - _x.crossVectors(up, _z); - if (_x.lengthSq() === 0) { - if (Math.abs(up.z) === 1) { - _z.x += 1e-4; - } else { - _z.z += 1e-4; - } - _z.normalize(); - _x.crossVectors(up, _z); - } - _x.normalize(); - _y.crossVectors(_z, _x); - te2[0] = _x.x; - te2[4] = _y.x; - te2[8] = _z.x; - te2[1] = _x.y; - te2[5] = _y.y; - te2[9] = _z.y; - te2[2] = _x.z; - te2[6] = _y.z; - te2[10] = _z.z; - return this; - } - multiply(m) { - return this.multiplyMatrices(this, m); - } - premultiply(m) { - return this.multiplyMatrices(m, this); - } - multiplyMatrices(a, b) { - const ae = a.elements; - const be = b.elements; - const te2 = this.elements; - const a11 = ae[0], a12 = ae[4], a13 = ae[8], a14 = ae[12]; - const a21 = ae[1], a22 = ae[5], a23 = ae[9], a24 = ae[13]; - const a31 = ae[2], a32 = ae[6], a33 = ae[10], a34 = ae[14]; - const a41 = ae[3], a42 = ae[7], a43 = ae[11], a44 = ae[15]; - const b11 = be[0], b12 = be[4], b13 = be[8], b14 = be[12]; - const b21 = be[1], b22 = be[5], b23 = be[9], b24 = be[13]; - const b31 = be[2], b32 = be[6], b33 = be[10], b34 = be[14]; - const b41 = be[3], b42 = be[7], b43 = be[11], b44 = be[15]; - te2[0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41; - te2[4] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42; - te2[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43; - te2[12] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44; - te2[1] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41; - te2[5] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42; - te2[9] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43; - te2[13] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44; - te2[2] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41; - te2[6] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42; - te2[10] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43; - te2[14] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44; - te2[3] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41; - te2[7] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42; - te2[11] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43; - te2[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44; - return this; - } - multiplyScalar(s) { - const te2 = this.elements; - te2[0] *= s; - te2[4] *= s; - te2[8] *= s; - te2[12] *= s; - te2[1] *= s; - te2[5] *= s; - te2[9] *= s; - te2[13] *= s; - te2[2] *= s; - te2[6] *= s; - te2[10] *= s; - te2[14] *= s; - te2[3] *= s; - te2[7] *= s; - te2[11] *= s; - te2[15] *= s; - return this; - } - determinant() { - const te2 = this.elements; - const n11 = te2[0], n12 = te2[4], n13 = te2[8], n14 = te2[12]; - const n21 = te2[1], n22 = te2[5], n23 = te2[9], n24 = te2[13]; - const n31 = te2[2], n32 = te2[6], n33 = te2[10], n34 = te2[14]; - const n41 = te2[3], n42 = te2[7], n43 = te2[11], n44 = te2[15]; - return n41 * (+n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34) + n42 * (+n11 * n23 * n34 - n11 * n24 * n33 + n14 * n21 * n33 - n13 * n21 * n34 + n13 * n24 * n31 - n14 * n23 * n31) + n43 * (+n11 * n24 * n32 - n11 * n22 * n34 - n14 * n21 * n32 + n12 * n21 * n34 + n14 * n22 * n31 - n12 * n24 * n31) + n44 * (-n13 * n22 * n31 - n11 * n23 * n32 + n11 * n22 * n33 + n13 * n21 * n32 - n12 * n21 * n33 + n12 * n23 * n31); - } - transpose() { - const te2 = this.elements; - let tmp2; - tmp2 = te2[1]; - te2[1] = te2[4]; - te2[4] = tmp2; - tmp2 = te2[2]; - te2[2] = te2[8]; - te2[8] = tmp2; - tmp2 = te2[6]; - te2[6] = te2[9]; - te2[9] = tmp2; - tmp2 = te2[3]; - te2[3] = te2[12]; - te2[12] = tmp2; - tmp2 = te2[7]; - te2[7] = te2[13]; - te2[13] = tmp2; - tmp2 = te2[11]; - te2[11] = te2[14]; - te2[14] = tmp2; - return this; - } - setPosition(x, y, z) { - const te2 = this.elements; - if (x.isVector3) { - te2[12] = x.x; - te2[13] = x.y; - te2[14] = x.z; - } else { - te2[12] = x; - te2[13] = y; - te2[14] = z; - } - return this; - } - invert() { - const te2 = this.elements, n11 = te2[0], n21 = te2[1], n31 = te2[2], n41 = te2[3], n12 = te2[4], n22 = te2[5], n32 = te2[6], n42 = te2[7], n13 = te2[8], n23 = te2[9], n33 = te2[10], n43 = te2[11], n14 = te2[12], n24 = te2[13], n34 = te2[14], n44 = te2[15], t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44, t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44, t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44, t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34; - const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14; - if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - const detInv = 1 / det; - te2[0] = t11 * detInv; - te2[1] = (n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44) * detInv; - te2[2] = (n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44) * detInv; - te2[3] = (n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43) * detInv; - te2[4] = t12 * detInv; - te2[5] = (n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44) * detInv; - te2[6] = (n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44) * detInv; - te2[7] = (n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43) * detInv; - te2[8] = t13 * detInv; - te2[9] = (n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44) * detInv; - te2[10] = (n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44) * detInv; - te2[11] = (n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43) * detInv; - te2[12] = t14 * detInv; - te2[13] = (n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34) * detInv; - te2[14] = (n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34) * detInv; - te2[15] = (n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33) * detInv; - return this; - } - scale(v) { - const te2 = this.elements; - const x = v.x, y = v.y, z = v.z; - te2[0] *= x; - te2[4] *= y; - te2[8] *= z; - te2[1] *= x; - te2[5] *= y; - te2[9] *= z; - te2[2] *= x; - te2[6] *= y; - te2[10] *= z; - te2[3] *= x; - te2[7] *= y; - te2[11] *= z; - return this; - } - getMaxScaleOnAxis() { - const te2 = this.elements; - const scaleXSq = te2[0] * te2[0] + te2[1] * te2[1] + te2[2] * te2[2]; - const scaleYSq = te2[4] * te2[4] + te2[5] * te2[5] + te2[6] * te2[6]; - const scaleZSq = te2[8] * te2[8] + te2[9] * te2[9] + te2[10] * te2[10]; - return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq)); - } - makeTranslation(x, y, z) { - if (x.isVector3) { - this.set( - 1, - 0, - 0, - x.x, - 0, - 1, - 0, - x.y, - 0, - 0, - 1, - x.z, - 0, - 0, - 0, - 1 - ); - } else { - this.set( - 1, - 0, - 0, - x, - 0, - 1, - 0, - y, - 0, - 0, - 1, - z, - 0, - 0, - 0, - 1 - ); - } - return this; - } - makeRotationX(theta) { - const c = Math.cos(theta), s = Math.sin(theta); - this.set( - 1, - 0, - 0, - 0, - 0, - c, - -s, - 0, - 0, - s, - c, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - makeRotationY(theta) { - const c = Math.cos(theta), s = Math.sin(theta); - this.set( - c, - 0, - s, - 0, - 0, - 1, - 0, - 0, - -s, - 0, - c, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - makeRotationZ(theta) { - const c = Math.cos(theta), s = Math.sin(theta); - this.set( - c, - -s, - 0, - 0, - s, - c, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - makeRotationAxis(axis, angle) { - const c = Math.cos(angle); - const s = Math.sin(angle); - const t2 = 1 - c; - const x = axis.x, y = axis.y, z = axis.z; - const tx = t2 * x, ty = t2 * y; - this.set( - tx * x + c, - tx * y - s * z, - tx * z + s * y, - 0, - tx * y + s * z, - ty * y + c, - ty * z - s * x, - 0, - tx * z - s * y, - ty * z + s * x, - t2 * z * z + c, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - makeScale(x, y, z) { - this.set( - x, - 0, - 0, - 0, - 0, - y, - 0, - 0, - 0, - 0, - z, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - makeShear(xy, xz, yx, yz, zx, zy) { - this.set( - 1, - yx, - zx, - 0, - xy, - 1, - zy, - 0, - xz, - yz, - 1, - 0, - 0, - 0, - 0, - 1 - ); - return this; - } - compose(position, quaternion, scale) { - const te2 = this.elements; - const x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w; - const x2 = x + x, y2 = y + y, z2 = z + z; - const xx = x * x2, xy = x * y2, xz = x * z2; - const yy = y * y2, yz = y * z2, zz = z * z2; - const wx = w * x2, wy = w * y2, wz = w * z2; - const sx = scale.x, sy = scale.y, sz = scale.z; - te2[0] = (1 - (yy + zz)) * sx; - te2[1] = (xy + wz) * sx; - te2[2] = (xz - wy) * sx; - te2[3] = 0; - te2[4] = (xy - wz) * sy; - te2[5] = (1 - (xx + zz)) * sy; - te2[6] = (yz + wx) * sy; - te2[7] = 0; - te2[8] = (xz + wy) * sz; - te2[9] = (yz - wx) * sz; - te2[10] = (1 - (xx + yy)) * sz; - te2[11] = 0; - te2[12] = position.x; - te2[13] = position.y; - te2[14] = position.z; - te2[15] = 1; - return this; - } - decompose(position, quaternion, scale) { - const te2 = this.elements; - let sx = _v1$5.set(te2[0], te2[1], te2[2]).length(); - const sy = _v1$5.set(te2[4], te2[5], te2[6]).length(); - const sz = _v1$5.set(te2[8], te2[9], te2[10]).length(); - const det = this.determinant(); - if (det < 0) sx = -sx; - position.x = te2[12]; - position.y = te2[13]; - position.z = te2[14]; - _m1$4.copy(this); - const invSX = 1 / sx; - const invSY = 1 / sy; - const invSZ = 1 / sz; - _m1$4.elements[0] *= invSX; - _m1$4.elements[1] *= invSX; - _m1$4.elements[2] *= invSX; - _m1$4.elements[4] *= invSY; - _m1$4.elements[5] *= invSY; - _m1$4.elements[6] *= invSY; - _m1$4.elements[8] *= invSZ; - _m1$4.elements[9] *= invSZ; - _m1$4.elements[10] *= invSZ; - quaternion.setFromRotationMatrix(_m1$4); - scale.x = sx; - scale.y = sy; - scale.z = sz; - return this; - } - makePerspective(left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem) { - const te2 = this.elements; - const x = 2 * near / (right - left); - const y = 2 * near / (top - bottom); - const a = (right + left) / (right - left); - const b = (top + bottom) / (top - bottom); - let c, d; - if (coordinateSystem === WebGLCoordinateSystem) { - c = -(far + near) / (far - near); - d = -2 * far * near / (far - near); - } else if (coordinateSystem === WebGPUCoordinateSystem) { - c = -far / (far - near); - d = -far * near / (far - near); - } else { - throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: " + coordinateSystem); - } - te2[0] = x; - te2[4] = 0; - te2[8] = a; - te2[12] = 0; - te2[1] = 0; - te2[5] = y; - te2[9] = b; - te2[13] = 0; - te2[2] = 0; - te2[6] = 0; - te2[10] = c; - te2[14] = d; - te2[3] = 0; - te2[7] = 0; - te2[11] = -1; - te2[15] = 0; - return this; - } - makeOrthographic(left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem) { - const te2 = this.elements; - const w = 1 / (right - left); - const h = 1 / (top - bottom); - const p = 1 / (far - near); - const x = (right + left) * w; - const y = (top + bottom) * h; - let z, zInv; - if (coordinateSystem === WebGLCoordinateSystem) { - z = (far + near) * p; - zInv = -2 * p; - } else if (coordinateSystem === WebGPUCoordinateSystem) { - z = near * p; - zInv = -1 * p; - } else { - throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: " + coordinateSystem); - } - te2[0] = 2 * w; - te2[4] = 0; - te2[8] = 0; - te2[12] = -x; - te2[1] = 0; - te2[5] = 2 * h; - te2[9] = 0; - te2[13] = -y; - te2[2] = 0; - te2[6] = 0; - te2[10] = zInv; - te2[14] = -z; - te2[3] = 0; - te2[7] = 0; - te2[11] = 0; - te2[15] = 1; - return this; - } - equals(matrix) { - const te2 = this.elements; - const me = matrix.elements; - for (let i = 0; i < 16; i++) { - if (te2[i] !== me[i]) return false; - } - return true; - } - fromArray(array, offset = 0) { - for (let i = 0; i < 16; i++) { - this.elements[i] = array[i + offset]; - } - return this; - } - toArray(array = [], offset = 0) { - const te2 = this.elements; - array[offset] = te2[0]; - array[offset + 1] = te2[1]; - array[offset + 2] = te2[2]; - array[offset + 3] = te2[3]; - array[offset + 4] = te2[4]; - array[offset + 5] = te2[5]; - array[offset + 6] = te2[6]; - array[offset + 7] = te2[7]; - array[offset + 8] = te2[8]; - array[offset + 9] = te2[9]; - array[offset + 10] = te2[10]; - array[offset + 11] = te2[11]; - array[offset + 12] = te2[12]; - array[offset + 13] = te2[13]; - array[offset + 14] = te2[14]; - array[offset + 15] = te2[15]; - return array; - } -} -const _v1$5 = /* @__PURE__ */ new Vector3(); -const _m1$4 = /* @__PURE__ */ new Matrix4(); -const _zero = /* @__PURE__ */ new Vector3(0, 0, 0); -const _one = /* @__PURE__ */ new Vector3(1, 1, 1); -const _x = /* @__PURE__ */ new Vector3(); -const _y = /* @__PURE__ */ new Vector3(); -const _z = /* @__PURE__ */ new Vector3(); -const _matrix$2 = /* @__PURE__ */ new Matrix4(); -const _quaternion$3 = /* @__PURE__ */ new Quaternion(); -class Euler { - static { - __name(this, "Euler"); - } - constructor(x = 0, y = 0, z = 0, order = Euler.DEFAULT_ORDER) { - this.isEuler = true; - this._x = x; - this._y = y; - this._z = z; - this._order = order; - } - get x() { - return this._x; - } - set x(value) { - this._x = value; - this._onChangeCallback(); - } - get y() { - return this._y; - } - set y(value) { - this._y = value; - this._onChangeCallback(); - } - get z() { - return this._z; - } - set z(value) { - this._z = value; - this._onChangeCallback(); - } - get order() { - return this._order; - } - set order(value) { - this._order = value; - this._onChangeCallback(); - } - set(x, y, z, order = this._order) { - this._x = x; - this._y = y; - this._z = z; - this._order = order; - this._onChangeCallback(); - return this; - } - clone() { - return new this.constructor(this._x, this._y, this._z, this._order); - } - copy(euler) { - this._x = euler._x; - this._y = euler._y; - this._z = euler._z; - this._order = euler._order; - this._onChangeCallback(); - return this; - } - setFromRotationMatrix(m, order = this._order, update = true) { - const te2 = m.elements; - const m11 = te2[0], m12 = te2[4], m13 = te2[8]; - const m21 = te2[1], m22 = te2[5], m23 = te2[9]; - const m31 = te2[2], m32 = te2[6], m33 = te2[10]; - switch (order) { - case "XYZ": - this._y = Math.asin(clamp(m13, -1, 1)); - if (Math.abs(m13) < 0.9999999) { - this._x = Math.atan2(-m23, m33); - this._z = Math.atan2(-m12, m11); - } else { - this._x = Math.atan2(m32, m22); - this._z = 0; - } - break; - case "YXZ": - this._x = Math.asin(-clamp(m23, -1, 1)); - if (Math.abs(m23) < 0.9999999) { - this._y = Math.atan2(m13, m33); - this._z = Math.atan2(m21, m22); - } else { - this._y = Math.atan2(-m31, m11); - this._z = 0; - } - break; - case "ZXY": - this._x = Math.asin(clamp(m32, -1, 1)); - if (Math.abs(m32) < 0.9999999) { - this._y = Math.atan2(-m31, m33); - this._z = Math.atan2(-m12, m22); - } else { - this._y = 0; - this._z = Math.atan2(m21, m11); - } - break; - case "ZYX": - this._y = Math.asin(-clamp(m31, -1, 1)); - if (Math.abs(m31) < 0.9999999) { - this._x = Math.atan2(m32, m33); - this._z = Math.atan2(m21, m11); - } else { - this._x = 0; - this._z = Math.atan2(-m12, m22); - } - break; - case "YZX": - this._z = Math.asin(clamp(m21, -1, 1)); - if (Math.abs(m21) < 0.9999999) { - this._x = Math.atan2(-m23, m22); - this._y = Math.atan2(-m31, m11); - } else { - this._x = 0; - this._y = Math.atan2(m13, m33); - } - break; - case "XZY": - this._z = Math.asin(-clamp(m12, -1, 1)); - if (Math.abs(m12) < 0.9999999) { - this._x = Math.atan2(m32, m22); - this._y = Math.atan2(m13, m11); - } else { - this._x = Math.atan2(-m23, m33); - this._y = 0; - } - break; - default: - console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + order); - } - this._order = order; - if (update === true) this._onChangeCallback(); - return this; - } - setFromQuaternion(q, order, update) { - _matrix$2.makeRotationFromQuaternion(q); - return this.setFromRotationMatrix(_matrix$2, order, update); - } - setFromVector3(v, order = this._order) { - return this.set(v.x, v.y, v.z, order); - } - reorder(newOrder) { - _quaternion$3.setFromEuler(this); - return this.setFromQuaternion(_quaternion$3, newOrder); - } - equals(euler) { - return euler._x === this._x && euler._y === this._y && euler._z === this._z && euler._order === this._order; - } - fromArray(array) { - this._x = array[0]; - this._y = array[1]; - this._z = array[2]; - if (array[3] !== void 0) this._order = array[3]; - this._onChangeCallback(); - return this; - } - toArray(array = [], offset = 0) { - array[offset] = this._x; - array[offset + 1] = this._y; - array[offset + 2] = this._z; - array[offset + 3] = this._order; - return array; - } - _onChange(callback) { - this._onChangeCallback = callback; - return this; - } - _onChangeCallback() { - } - *[Symbol.iterator]() { - yield this._x; - yield this._y; - yield this._z; - yield this._order; - } -} -Euler.DEFAULT_ORDER = "XYZ"; -class Layers { - static { - __name(this, "Layers"); - } - constructor() { - this.mask = 1 | 0; - } - set(channel) { - this.mask = (1 << channel | 0) >>> 0; - } - enable(channel) { - this.mask |= 1 << channel | 0; - } - enableAll() { - this.mask = 4294967295 | 0; - } - toggle(channel) { - this.mask ^= 1 << channel | 0; - } - disable(channel) { - this.mask &= ~(1 << channel | 0); - } - disableAll() { - this.mask = 0; - } - test(layers) { - return (this.mask & layers.mask) !== 0; - } - isEnabled(channel) { - return (this.mask & (1 << channel | 0)) !== 0; - } -} -let _object3DId = 0; -const _v1$4 = /* @__PURE__ */ new Vector3(); -const _q1 = /* @__PURE__ */ new Quaternion(); -const _m1$3 = /* @__PURE__ */ new Matrix4(); -const _target = /* @__PURE__ */ new Vector3(); -const _position$3 = /* @__PURE__ */ new Vector3(); -const _scale$2 = /* @__PURE__ */ new Vector3(); -const _quaternion$2 = /* @__PURE__ */ new Quaternion(); -const _xAxis = /* @__PURE__ */ new Vector3(1, 0, 0); -const _yAxis = /* @__PURE__ */ new Vector3(0, 1, 0); -const _zAxis = /* @__PURE__ */ new Vector3(0, 0, 1); -const _addedEvent = { type: "added" }; -const _removedEvent = { type: "removed" }; -const _childaddedEvent = { type: "childadded", child: null }; -const _childremovedEvent = { type: "childremoved", child: null }; -class Object3D extends EventDispatcher { - static { - __name(this, "Object3D"); - } - constructor() { - super(); - this.isObject3D = true; - Object.defineProperty(this, "id", { value: _object3DId++ }); - this.uuid = generateUUID(); - this.name = ""; - this.type = "Object3D"; - this.parent = null; - this.children = []; - this.up = Object3D.DEFAULT_UP.clone(); - const position = new Vector3(); - const rotation = new Euler(); - const quaternion = new Quaternion(); - const scale = new Vector3(1, 1, 1); - function onRotationChange() { - quaternion.setFromEuler(rotation, false); - } - __name(onRotationChange, "onRotationChange"); - function onQuaternionChange() { - rotation.setFromQuaternion(quaternion, void 0, false); - } - __name(onQuaternionChange, "onQuaternionChange"); - rotation._onChange(onRotationChange); - quaternion._onChange(onQuaternionChange); - Object.defineProperties(this, { - position: { - configurable: true, - enumerable: true, - value: position - }, - rotation: { - configurable: true, - enumerable: true, - value: rotation - }, - quaternion: { - configurable: true, - enumerable: true, - value: quaternion - }, - scale: { - configurable: true, - enumerable: true, - value: scale - }, - modelViewMatrix: { - value: new Matrix4() - }, - normalMatrix: { - value: new Matrix3() - } - }); - this.matrix = new Matrix4(); - this.matrixWorld = new Matrix4(); - this.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE; - this.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; - this.matrixWorldNeedsUpdate = false; - this.layers = new Layers(); - this.visible = true; - this.castShadow = false; - this.receiveShadow = false; - this.frustumCulled = true; - this.renderOrder = 0; - this.animations = []; - this.userData = {}; - } - onBeforeShadow() { - } - onAfterShadow() { - } - onBeforeRender() { - } - onAfterRender() { - } - applyMatrix4(matrix) { - if (this.matrixAutoUpdate) this.updateMatrix(); - this.matrix.premultiply(matrix); - this.matrix.decompose(this.position, this.quaternion, this.scale); - } - applyQuaternion(q) { - this.quaternion.premultiply(q); - return this; - } - setRotationFromAxisAngle(axis, angle) { - this.quaternion.setFromAxisAngle(axis, angle); - } - setRotationFromEuler(euler) { - this.quaternion.setFromEuler(euler, true); - } - setRotationFromMatrix(m) { - this.quaternion.setFromRotationMatrix(m); - } - setRotationFromQuaternion(q) { - this.quaternion.copy(q); - } - rotateOnAxis(axis, angle) { - _q1.setFromAxisAngle(axis, angle); - this.quaternion.multiply(_q1); - return this; - } - rotateOnWorldAxis(axis, angle) { - _q1.setFromAxisAngle(axis, angle); - this.quaternion.premultiply(_q1); - return this; - } - rotateX(angle) { - return this.rotateOnAxis(_xAxis, angle); - } - rotateY(angle) { - return this.rotateOnAxis(_yAxis, angle); - } - rotateZ(angle) { - return this.rotateOnAxis(_zAxis, angle); - } - translateOnAxis(axis, distance) { - _v1$4.copy(axis).applyQuaternion(this.quaternion); - this.position.add(_v1$4.multiplyScalar(distance)); - return this; - } - translateX(distance) { - return this.translateOnAxis(_xAxis, distance); - } - translateY(distance) { - return this.translateOnAxis(_yAxis, distance); - } - translateZ(distance) { - return this.translateOnAxis(_zAxis, distance); - } - localToWorld(vector) { - this.updateWorldMatrix(true, false); - return vector.applyMatrix4(this.matrixWorld); - } - worldToLocal(vector) { - this.updateWorldMatrix(true, false); - return vector.applyMatrix4(_m1$3.copy(this.matrixWorld).invert()); - } - lookAt(x, y, z) { - if (x.isVector3) { - _target.copy(x); - } else { - _target.set(x, y, z); - } - const parent = this.parent; - this.updateWorldMatrix(true, false); - _position$3.setFromMatrixPosition(this.matrixWorld); - if (this.isCamera || this.isLight) { - _m1$3.lookAt(_position$3, _target, this.up); - } else { - _m1$3.lookAt(_target, _position$3, this.up); - } - this.quaternion.setFromRotationMatrix(_m1$3); - if (parent) { - _m1$3.extractRotation(parent.matrixWorld); - _q1.setFromRotationMatrix(_m1$3); - this.quaternion.premultiply(_q1.invert()); - } - } - add(object) { - if (arguments.length > 1) { - for (let i = 0; i < arguments.length; i++) { - this.add(arguments[i]); - } - return this; - } - if (object === this) { - console.error("THREE.Object3D.add: object can't be added as a child of itself.", object); - return this; - } - if (object && object.isObject3D) { - object.removeFromParent(); - object.parent = this; - this.children.push(object); - object.dispatchEvent(_addedEvent); - _childaddedEvent.child = object; - this.dispatchEvent(_childaddedEvent); - _childaddedEvent.child = null; - } else { - console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", object); - } - return this; - } - remove(object) { - if (arguments.length > 1) { - for (let i = 0; i < arguments.length; i++) { - this.remove(arguments[i]); - } - return this; - } - const index = this.children.indexOf(object); - if (index !== -1) { - object.parent = null; - this.children.splice(index, 1); - object.dispatchEvent(_removedEvent); - _childremovedEvent.child = object; - this.dispatchEvent(_childremovedEvent); - _childremovedEvent.child = null; - } - return this; - } - removeFromParent() { - const parent = this.parent; - if (parent !== null) { - parent.remove(this); - } - return this; - } - clear() { - return this.remove(...this.children); - } - attach(object) { - this.updateWorldMatrix(true, false); - _m1$3.copy(this.matrixWorld).invert(); - if (object.parent !== null) { - object.parent.updateWorldMatrix(true, false); - _m1$3.multiply(object.parent.matrixWorld); - } - object.applyMatrix4(_m1$3); - object.removeFromParent(); - object.parent = this; - this.children.push(object); - object.updateWorldMatrix(false, true); - object.dispatchEvent(_addedEvent); - _childaddedEvent.child = object; - this.dispatchEvent(_childaddedEvent); - _childaddedEvent.child = null; - return this; - } - getObjectById(id2) { - return this.getObjectByProperty("id", id2); - } - getObjectByName(name) { - return this.getObjectByProperty("name", name); - } - getObjectByProperty(name, value) { - if (this[name] === value) return this; - for (let i = 0, l = this.children.length; i < l; i++) { - const child = this.children[i]; - const object = child.getObjectByProperty(name, value); - if (object !== void 0) { - return object; - } - } - return void 0; - } - getObjectsByProperty(name, value, result = []) { - if (this[name] === value) result.push(this); - const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { - children[i].getObjectsByProperty(name, value, result); - } - return result; - } - getWorldPosition(target) { - this.updateWorldMatrix(true, false); - return target.setFromMatrixPosition(this.matrixWorld); - } - getWorldQuaternion(target) { - this.updateWorldMatrix(true, false); - this.matrixWorld.decompose(_position$3, target, _scale$2); - return target; - } - getWorldScale(target) { - this.updateWorldMatrix(true, false); - this.matrixWorld.decompose(_position$3, _quaternion$2, target); - return target; - } - getWorldDirection(target) { - this.updateWorldMatrix(true, false); - const e = this.matrixWorld.elements; - return target.set(e[8], e[9], e[10]).normalize(); - } - raycast() { - } - traverse(callback) { - callback(this); - const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { - children[i].traverse(callback); - } - } - traverseVisible(callback) { - if (this.visible === false) return; - callback(this); - const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { - children[i].traverseVisible(callback); - } - } - traverseAncestors(callback) { - const parent = this.parent; - if (parent !== null) { - callback(parent); - parent.traverseAncestors(callback); - } - } - updateMatrix() { - this.matrix.compose(this.position, this.quaternion, this.scale); - this.matrixWorldNeedsUpdate = true; - } - updateMatrixWorld(force) { - if (this.matrixAutoUpdate) this.updateMatrix(); - if (this.matrixWorldNeedsUpdate || force) { - if (this.matrixWorldAutoUpdate === true) { - if (this.parent === null) { - this.matrixWorld.copy(this.matrix); - } else { - this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix); - } - } - this.matrixWorldNeedsUpdate = false; - force = true; - } - const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { - const child = children[i]; - child.updateMatrixWorld(force); - } - } - updateWorldMatrix(updateParents, updateChildren) { - const parent = this.parent; - if (updateParents === true && parent !== null) { - parent.updateWorldMatrix(true, false); - } - if (this.matrixAutoUpdate) this.updateMatrix(); - if (this.matrixWorldAutoUpdate === true) { - if (this.parent === null) { - this.matrixWorld.copy(this.matrix); - } else { - this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix); - } - } - if (updateChildren === true) { - const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { - const child = children[i]; - child.updateWorldMatrix(false, true); - } - } - } - toJSON(meta) { - const isRootObject = meta === void 0 || typeof meta === "string"; - const output = {}; - if (isRootObject) { - meta = { - geometries: {}, - materials: {}, - textures: {}, - images: {}, - shapes: {}, - skeletons: {}, - animations: {}, - nodes: {} - }; - output.metadata = { - version: 4.6, - type: "Object", - generator: "Object3D.toJSON" - }; - } - const object = {}; - object.uuid = this.uuid; - object.type = this.type; - if (this.name !== "") object.name = this.name; - if (this.castShadow === true) object.castShadow = true; - if (this.receiveShadow === true) object.receiveShadow = true; - if (this.visible === false) object.visible = false; - if (this.frustumCulled === false) object.frustumCulled = false; - if (this.renderOrder !== 0) object.renderOrder = this.renderOrder; - if (Object.keys(this.userData).length > 0) object.userData = this.userData; - object.layers = this.layers.mask; - object.matrix = this.matrix.toArray(); - object.up = this.up.toArray(); - if (this.matrixAutoUpdate === false) object.matrixAutoUpdate = false; - if (this.isInstancedMesh) { - object.type = "InstancedMesh"; - object.count = this.count; - object.instanceMatrix = this.instanceMatrix.toJSON(); - if (this.instanceColor !== null) object.instanceColor = this.instanceColor.toJSON(); - } - if (this.isBatchedMesh) { - object.type = "BatchedMesh"; - object.perObjectFrustumCulled = this.perObjectFrustumCulled; - object.sortObjects = this.sortObjects; - object.drawRanges = this._drawRanges; - object.reservedRanges = this._reservedRanges; - object.visibility = this._visibility; - object.active = this._active; - object.bounds = this._bounds.map((bound) => ({ - boxInitialized: bound.boxInitialized, - boxMin: bound.box.min.toArray(), - boxMax: bound.box.max.toArray(), - sphereInitialized: bound.sphereInitialized, - sphereRadius: bound.sphere.radius, - sphereCenter: bound.sphere.center.toArray() - })); - object.maxInstanceCount = this._maxInstanceCount; - object.maxVertexCount = this._maxVertexCount; - object.maxIndexCount = this._maxIndexCount; - object.geometryInitialized = this._geometryInitialized; - object.geometryCount = this._geometryCount; - object.matricesTexture = this._matricesTexture.toJSON(meta); - if (this._colorsTexture !== null) object.colorsTexture = this._colorsTexture.toJSON(meta); - if (this.boundingSphere !== null) { - object.boundingSphere = { - center: object.boundingSphere.center.toArray(), - radius: object.boundingSphere.radius - }; - } - if (this.boundingBox !== null) { - object.boundingBox = { - min: object.boundingBox.min.toArray(), - max: object.boundingBox.max.toArray() - }; - } - } - function serialize(library, element) { - if (library[element.uuid] === void 0) { - library[element.uuid] = element.toJSON(meta); - } - return element.uuid; - } - __name(serialize, "serialize"); - if (this.isScene) { - if (this.background) { - if (this.background.isColor) { - object.background = this.background.toJSON(); - } else if (this.background.isTexture) { - object.background = this.background.toJSON(meta).uuid; - } - } - if (this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true) { - object.environment = this.environment.toJSON(meta).uuid; - } - } else if (this.isMesh || this.isLine || this.isPoints) { - object.geometry = serialize(meta.geometries, this.geometry); - const parameters = this.geometry.parameters; - if (parameters !== void 0 && parameters.shapes !== void 0) { - const shapes = parameters.shapes; - if (Array.isArray(shapes)) { - for (let i = 0, l = shapes.length; i < l; i++) { - const shape = shapes[i]; - serialize(meta.shapes, shape); - } - } else { - serialize(meta.shapes, shapes); - } - } - } - if (this.isSkinnedMesh) { - object.bindMode = this.bindMode; - object.bindMatrix = this.bindMatrix.toArray(); - if (this.skeleton !== void 0) { - serialize(meta.skeletons, this.skeleton); - object.skeleton = this.skeleton.uuid; - } - } - if (this.material !== void 0) { - if (Array.isArray(this.material)) { - const uuids = []; - for (let i = 0, l = this.material.length; i < l; i++) { - uuids.push(serialize(meta.materials, this.material[i])); - } - object.material = uuids; - } else { - object.material = serialize(meta.materials, this.material); - } - } - if (this.children.length > 0) { - object.children = []; - for (let i = 0; i < this.children.length; i++) { - object.children.push(this.children[i].toJSON(meta).object); - } - } - if (this.animations.length > 0) { - object.animations = []; - for (let i = 0; i < this.animations.length; i++) { - const animation = this.animations[i]; - object.animations.push(serialize(meta.animations, animation)); - } - } - if (isRootObject) { - const geometries = extractFromCache(meta.geometries); - const materials = extractFromCache(meta.materials); - const textures = extractFromCache(meta.textures); - const images = extractFromCache(meta.images); - const shapes = extractFromCache(meta.shapes); - const skeletons = extractFromCache(meta.skeletons); - const animations = extractFromCache(meta.animations); - const nodes = extractFromCache(meta.nodes); - if (geometries.length > 0) output.geometries = geometries; - if (materials.length > 0) output.materials = materials; - if (textures.length > 0) output.textures = textures; - if (images.length > 0) output.images = images; - if (shapes.length > 0) output.shapes = shapes; - if (skeletons.length > 0) output.skeletons = skeletons; - if (animations.length > 0) output.animations = animations; - if (nodes.length > 0) output.nodes = nodes; - } - output.object = object; - return output; - function extractFromCache(cache) { - const values = []; - for (const key in cache) { - const data = cache[key]; - delete data.metadata; - values.push(data); - } - return values; - } - __name(extractFromCache, "extractFromCache"); - } - clone(recursive) { - return new this.constructor().copy(this, recursive); - } - copy(source, recursive = true) { - this.name = source.name; - this.up.copy(source.up); - this.position.copy(source.position); - this.rotation.order = source.rotation.order; - this.quaternion.copy(source.quaternion); - this.scale.copy(source.scale); - this.matrix.copy(source.matrix); - this.matrixWorld.copy(source.matrixWorld); - this.matrixAutoUpdate = source.matrixAutoUpdate; - this.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate; - this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate; - this.layers.mask = source.layers.mask; - this.visible = source.visible; - this.castShadow = source.castShadow; - this.receiveShadow = source.receiveShadow; - this.frustumCulled = source.frustumCulled; - this.renderOrder = source.renderOrder; - this.animations = source.animations.slice(); - this.userData = JSON.parse(JSON.stringify(source.userData)); - if (recursive === true) { - for (let i = 0; i < source.children.length; i++) { - const child = source.children[i]; - this.add(child.clone()); - } - } - return this; - } -} -Object3D.DEFAULT_UP = /* @__PURE__ */ new Vector3(0, 1, 0); -Object3D.DEFAULT_MATRIX_AUTO_UPDATE = true; -Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true; -const _v0$2 = /* @__PURE__ */ new Vector3(); -const _v1$3 = /* @__PURE__ */ new Vector3(); -const _v2$2 = /* @__PURE__ */ new Vector3(); -const _v3$2 = /* @__PURE__ */ new Vector3(); -const _vab = /* @__PURE__ */ new Vector3(); -const _vac = /* @__PURE__ */ new Vector3(); -const _vbc = /* @__PURE__ */ new Vector3(); -const _vap = /* @__PURE__ */ new Vector3(); -const _vbp = /* @__PURE__ */ new Vector3(); -const _vcp = /* @__PURE__ */ new Vector3(); -const _v40 = /* @__PURE__ */ new Vector4(); -const _v41 = /* @__PURE__ */ new Vector4(); -const _v42 = /* @__PURE__ */ new Vector4(); -class Triangle { - static { - __name(this, "Triangle"); - } - constructor(a = new Vector3(), b = new Vector3(), c = new Vector3()) { - this.a = a; - this.b = b; - this.c = c; - } - static getNormal(a, b, c, target) { - target.subVectors(c, b); - _v0$2.subVectors(a, b); - target.cross(_v0$2); - const targetLengthSq = target.lengthSq(); - if (targetLengthSq > 0) { - return target.multiplyScalar(1 / Math.sqrt(targetLengthSq)); - } - return target.set(0, 0, 0); - } - // static/instance method to calculate barycentric coordinates - // based on: http://www.blackpawn.com/texts/pointinpoly/default.html - static getBarycoord(point, a, b, c, target) { - _v0$2.subVectors(c, a); - _v1$3.subVectors(b, a); - _v2$2.subVectors(point, a); - const dot00 = _v0$2.dot(_v0$2); - const dot01 = _v0$2.dot(_v1$3); - const dot02 = _v0$2.dot(_v2$2); - const dot11 = _v1$3.dot(_v1$3); - const dot12 = _v1$3.dot(_v2$2); - const denom = dot00 * dot11 - dot01 * dot01; - if (denom === 0) { - target.set(0, 0, 0); - return null; - } - const invDenom = 1 / denom; - const u = (dot11 * dot02 - dot01 * dot12) * invDenom; - const v = (dot00 * dot12 - dot01 * dot02) * invDenom; - return target.set(1 - u - v, v, u); - } - static containsPoint(point, a, b, c) { - if (this.getBarycoord(point, a, b, c, _v3$2) === null) { - return false; - } - return _v3$2.x >= 0 && _v3$2.y >= 0 && _v3$2.x + _v3$2.y <= 1; - } - static getInterpolation(point, p1, p2, p3, v1, v2, v3, target) { - if (this.getBarycoord(point, p1, p2, p3, _v3$2) === null) { - target.x = 0; - target.y = 0; - if ("z" in target) target.z = 0; - if ("w" in target) target.w = 0; - return null; - } - target.setScalar(0); - target.addScaledVector(v1, _v3$2.x); - target.addScaledVector(v2, _v3$2.y); - target.addScaledVector(v3, _v3$2.z); - return target; - } - static getInterpolatedAttribute(attr, i1, i2, i3, barycoord, target) { - _v40.setScalar(0); - _v41.setScalar(0); - _v42.setScalar(0); - _v40.fromBufferAttribute(attr, i1); - _v41.fromBufferAttribute(attr, i2); - _v42.fromBufferAttribute(attr, i3); - target.setScalar(0); - target.addScaledVector(_v40, barycoord.x); - target.addScaledVector(_v41, barycoord.y); - target.addScaledVector(_v42, barycoord.z); - return target; - } - static isFrontFacing(a, b, c, direction) { - _v0$2.subVectors(c, b); - _v1$3.subVectors(a, b); - return _v0$2.cross(_v1$3).dot(direction) < 0 ? true : false; - } - set(a, b, c) { - this.a.copy(a); - this.b.copy(b); - this.c.copy(c); - return this; - } - setFromPointsAndIndices(points, i0, i1, i2) { - this.a.copy(points[i0]); - this.b.copy(points[i1]); - this.c.copy(points[i2]); - return this; - } - setFromAttributeAndIndices(attribute, i0, i1, i2) { - this.a.fromBufferAttribute(attribute, i0); - this.b.fromBufferAttribute(attribute, i1); - this.c.fromBufferAttribute(attribute, i2); - return this; - } - clone() { - return new this.constructor().copy(this); - } - copy(triangle) { - this.a.copy(triangle.a); - this.b.copy(triangle.b); - this.c.copy(triangle.c); - return this; - } - getArea() { - _v0$2.subVectors(this.c, this.b); - _v1$3.subVectors(this.a, this.b); - return _v0$2.cross(_v1$3).length() * 0.5; - } - getMidpoint(target) { - return target.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3); - } - getNormal(target) { - return Triangle.getNormal(this.a, this.b, this.c, target); - } - getPlane(target) { - return target.setFromCoplanarPoints(this.a, this.b, this.c); - } - getBarycoord(point, target) { - return Triangle.getBarycoord(point, this.a, this.b, this.c, target); - } - getInterpolation(point, v1, v2, v3, target) { - return Triangle.getInterpolation(point, this.a, this.b, this.c, v1, v2, v3, target); - } - containsPoint(point) { - return Triangle.containsPoint(point, this.a, this.b, this.c); - } - isFrontFacing(direction) { - return Triangle.isFrontFacing(this.a, this.b, this.c, direction); - } - intersectsBox(box) { - return box.intersectsTriangle(this); - } - closestPointToPoint(p, target) { - const a = this.a, b = this.b, c = this.c; - let v, w; - _vab.subVectors(b, a); - _vac.subVectors(c, a); - _vap.subVectors(p, a); - const d1 = _vab.dot(_vap); - const d2 = _vac.dot(_vap); - if (d1 <= 0 && d2 <= 0) { - return target.copy(a); - } - _vbp.subVectors(p, b); - const d3 = _vab.dot(_vbp); - const d4 = _vac.dot(_vbp); - if (d3 >= 0 && d4 <= d3) { - return target.copy(b); - } - const vc = d1 * d4 - d3 * d2; - if (vc <= 0 && d1 >= 0 && d3 <= 0) { - v = d1 / (d1 - d3); - return target.copy(a).addScaledVector(_vab, v); - } - _vcp.subVectors(p, c); - const d5 = _vab.dot(_vcp); - const d6 = _vac.dot(_vcp); - if (d6 >= 0 && d5 <= d6) { - return target.copy(c); - } - const vb = d5 * d2 - d1 * d6; - if (vb <= 0 && d2 >= 0 && d6 <= 0) { - w = d2 / (d2 - d6); - return target.copy(a).addScaledVector(_vac, w); - } - const va = d3 * d6 - d5 * d4; - if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0) { - _vbc.subVectors(c, b); - w = (d4 - d3) / (d4 - d3 + (d5 - d6)); - return target.copy(b).addScaledVector(_vbc, w); - } - const denom = 1 / (va + vb + vc); - v = vb * denom; - w = vc * denom; - return target.copy(a).addScaledVector(_vab, v).addScaledVector(_vac, w); - } - equals(triangle) { - return triangle.a.equals(this.a) && triangle.b.equals(this.b) && triangle.c.equals(this.c); - } -} -const _colorKeywords = { - "aliceblue": 15792383, - "antiquewhite": 16444375, - "aqua": 65535, - "aquamarine": 8388564, - "azure": 15794175, - "beige": 16119260, - "bisque": 16770244, - "black": 0, - "blanchedalmond": 16772045, - "blue": 255, - "blueviolet": 9055202, - "brown": 10824234, - "burlywood": 14596231, - "cadetblue": 6266528, - "chartreuse": 8388352, - "chocolate": 13789470, - "coral": 16744272, - "cornflowerblue": 6591981, - "cornsilk": 16775388, - "crimson": 14423100, - "cyan": 65535, - "darkblue": 139, - "darkcyan": 35723, - "darkgoldenrod": 12092939, - "darkgray": 11119017, - "darkgreen": 25600, - "darkgrey": 11119017, - "darkkhaki": 12433259, - "darkmagenta": 9109643, - "darkolivegreen": 5597999, - "darkorange": 16747520, - "darkorchid": 10040012, - "darkred": 9109504, - "darksalmon": 15308410, - "darkseagreen": 9419919, - "darkslateblue": 4734347, - "darkslategray": 3100495, - "darkslategrey": 3100495, - "darkturquoise": 52945, - "darkviolet": 9699539, - "deeppink": 16716947, - "deepskyblue": 49151, - "dimgray": 6908265, - "dimgrey": 6908265, - "dodgerblue": 2003199, - "firebrick": 11674146, - "floralwhite": 16775920, - "forestgreen": 2263842, - "fuchsia": 16711935, - "gainsboro": 14474460, - "ghostwhite": 16316671, - "gold": 16766720, - "goldenrod": 14329120, - "gray": 8421504, - "green": 32768, - "greenyellow": 11403055, - "grey": 8421504, - "honeydew": 15794160, - "hotpink": 16738740, - "indianred": 13458524, - "indigo": 4915330, - "ivory": 16777200, - "khaki": 15787660, - "lavender": 15132410, - "lavenderblush": 16773365, - "lawngreen": 8190976, - "lemonchiffon": 16775885, - "lightblue": 11393254, - "lightcoral": 15761536, - "lightcyan": 14745599, - "lightgoldenrodyellow": 16448210, - "lightgray": 13882323, - "lightgreen": 9498256, - "lightgrey": 13882323, - "lightpink": 16758465, - "lightsalmon": 16752762, - "lightseagreen": 2142890, - "lightskyblue": 8900346, - "lightslategray": 7833753, - "lightslategrey": 7833753, - "lightsteelblue": 11584734, - "lightyellow": 16777184, - "lime": 65280, - "limegreen": 3329330, - "linen": 16445670, - "magenta": 16711935, - "maroon": 8388608, - "mediumaquamarine": 6737322, - "mediumblue": 205, - "mediumorchid": 12211667, - "mediumpurple": 9662683, - "mediumseagreen": 3978097, - "mediumslateblue": 8087790, - "mediumspringgreen": 64154, - "mediumturquoise": 4772300, - "mediumvioletred": 13047173, - "midnightblue": 1644912, - "mintcream": 16121850, - "mistyrose": 16770273, - "moccasin": 16770229, - "navajowhite": 16768685, - "navy": 128, - "oldlace": 16643558, - "olive": 8421376, - "olivedrab": 7048739, - "orange": 16753920, - "orangered": 16729344, - "orchid": 14315734, - "palegoldenrod": 15657130, - "palegreen": 10025880, - "paleturquoise": 11529966, - "palevioletred": 14381203, - "papayawhip": 16773077, - "peachpuff": 16767673, - "peru": 13468991, - "pink": 16761035, - "plum": 14524637, - "powderblue": 11591910, - "purple": 8388736, - "rebeccapurple": 6697881, - "red": 16711680, - "rosybrown": 12357519, - "royalblue": 4286945, - "saddlebrown": 9127187, - "salmon": 16416882, - "sandybrown": 16032864, - "seagreen": 3050327, - "seashell": 16774638, - "sienna": 10506797, - "silver": 12632256, - "skyblue": 8900331, - "slateblue": 6970061, - "slategray": 7372944, - "slategrey": 7372944, - "snow": 16775930, - "springgreen": 65407, - "steelblue": 4620980, - "tan": 13808780, - "teal": 32896, - "thistle": 14204888, - "tomato": 16737095, - "turquoise": 4251856, - "violet": 15631086, - "wheat": 16113331, - "white": 16777215, - "whitesmoke": 16119285, - "yellow": 16776960, - "yellowgreen": 10145074 -}; -const _hslA = { h: 0, s: 0, l: 0 }; -const _hslB = { h: 0, s: 0, l: 0 }; -function hue2rgb(p, q, t2) { - if (t2 < 0) t2 += 1; - if (t2 > 1) t2 -= 1; - if (t2 < 1 / 6) return p + (q - p) * 6 * t2; - if (t2 < 1 / 2) return q; - if (t2 < 2 / 3) return p + (q - p) * 6 * (2 / 3 - t2); - return p; -} -__name(hue2rgb, "hue2rgb"); -class Color { - static { - __name(this, "Color"); - } - constructor(r, g, b) { - this.isColor = true; - this.r = 1; - this.g = 1; - this.b = 1; - return this.set(r, g, b); - } - set(r, g, b) { - if (g === void 0 && b === void 0) { - const value = r; - if (value && value.isColor) { - this.copy(value); - } else if (typeof value === "number") { - this.setHex(value); - } else if (typeof value === "string") { - this.setStyle(value); - } - } else { - this.setRGB(r, g, b); - } - return this; - } - setScalar(scalar) { - this.r = scalar; - this.g = scalar; - this.b = scalar; - return this; - } - setHex(hex, colorSpace = SRGBColorSpace) { - hex = Math.floor(hex); - this.r = (hex >> 16 & 255) / 255; - this.g = (hex >> 8 & 255) / 255; - this.b = (hex & 255) / 255; - ColorManagement.toWorkingColorSpace(this, colorSpace); - return this; - } - setRGB(r, g, b, colorSpace = ColorManagement.workingColorSpace) { - this.r = r; - this.g = g; - this.b = b; - ColorManagement.toWorkingColorSpace(this, colorSpace); - return this; - } - setHSL(h, s, l, colorSpace = ColorManagement.workingColorSpace) { - h = euclideanModulo(h, 1); - s = clamp(s, 0, 1); - l = clamp(l, 0, 1); - if (s === 0) { - this.r = this.g = this.b = l; - } else { - const p = l <= 0.5 ? l * (1 + s) : l + s - l * s; - const q = 2 * l - p; - this.r = hue2rgb(q, p, h + 1 / 3); - this.g = hue2rgb(q, p, h); - this.b = hue2rgb(q, p, h - 1 / 3); - } - ColorManagement.toWorkingColorSpace(this, colorSpace); - return this; - } - setStyle(style, colorSpace = SRGBColorSpace) { - function handleAlpha(string) { - if (string === void 0) return; - if (parseFloat(string) < 1) { - console.warn("THREE.Color: Alpha component of " + style + " will be ignored."); - } - } - __name(handleAlpha, "handleAlpha"); - let m; - if (m = /^(\w+)\(([^\)]*)\)/.exec(style)) { - let color; - const name = m[1]; - const components = m[2]; - switch (name) { - case "rgb": - case "rgba": - if (color = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) { - handleAlpha(color[4]); - return this.setRGB( - Math.min(255, parseInt(color[1], 10)) / 255, - Math.min(255, parseInt(color[2], 10)) / 255, - Math.min(255, parseInt(color[3], 10)) / 255, - colorSpace - ); - } - if (color = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) { - handleAlpha(color[4]); - return this.setRGB( - Math.min(100, parseInt(color[1], 10)) / 100, - Math.min(100, parseInt(color[2], 10)) / 100, - Math.min(100, parseInt(color[3], 10)) / 100, - colorSpace - ); - } - break; - case "hsl": - case "hsla": - if (color = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) { - handleAlpha(color[4]); - return this.setHSL( - parseFloat(color[1]) / 360, - parseFloat(color[2]) / 100, - parseFloat(color[3]) / 100, - colorSpace - ); - } - break; - default: - console.warn("THREE.Color: Unknown color model " + style); - } - } else if (m = /^\#([A-Fa-f\d]+)$/.exec(style)) { - const hex = m[1]; - const size = hex.length; - if (size === 3) { - return this.setRGB( - parseInt(hex.charAt(0), 16) / 15, - parseInt(hex.charAt(1), 16) / 15, - parseInt(hex.charAt(2), 16) / 15, - colorSpace - ); - } else if (size === 6) { - return this.setHex(parseInt(hex, 16), colorSpace); - } else { - console.warn("THREE.Color: Invalid hex color " + style); - } - } else if (style && style.length > 0) { - return this.setColorName(style, colorSpace); - } - return this; - } - setColorName(style, colorSpace = SRGBColorSpace) { - const hex = _colorKeywords[style.toLowerCase()]; - if (hex !== void 0) { - this.setHex(hex, colorSpace); - } else { - console.warn("THREE.Color: Unknown color " + style); - } - return this; - } - clone() { - return new this.constructor(this.r, this.g, this.b); - } - copy(color) { - this.r = color.r; - this.g = color.g; - this.b = color.b; - return this; - } - copySRGBToLinear(color) { - this.r = SRGBToLinear(color.r); - this.g = SRGBToLinear(color.g); - this.b = SRGBToLinear(color.b); - return this; - } - copyLinearToSRGB(color) { - this.r = LinearToSRGB(color.r); - this.g = LinearToSRGB(color.g); - this.b = LinearToSRGB(color.b); - return this; - } - convertSRGBToLinear() { - this.copySRGBToLinear(this); - return this; - } - convertLinearToSRGB() { - this.copyLinearToSRGB(this); - return this; - } - getHex(colorSpace = SRGBColorSpace) { - ColorManagement.fromWorkingColorSpace(_color$1.copy(this), colorSpace); - return Math.round(clamp(_color$1.r * 255, 0, 255)) * 65536 + Math.round(clamp(_color$1.g * 255, 0, 255)) * 256 + Math.round(clamp(_color$1.b * 255, 0, 255)); - } - getHexString(colorSpace = SRGBColorSpace) { - return ("000000" + this.getHex(colorSpace).toString(16)).slice(-6); - } - getHSL(target, colorSpace = ColorManagement.workingColorSpace) { - ColorManagement.fromWorkingColorSpace(_color$1.copy(this), colorSpace); - const r = _color$1.r, g = _color$1.g, b = _color$1.b; - const max2 = Math.max(r, g, b); - const min = Math.min(r, g, b); - let hue, saturation; - const lightness = (min + max2) / 2; - if (min === max2) { - hue = 0; - saturation = 0; - } else { - const delta = max2 - min; - saturation = lightness <= 0.5 ? delta / (max2 + min) : delta / (2 - max2 - min); - switch (max2) { - case r: - hue = (g - b) / delta + (g < b ? 6 : 0); - break; - case g: - hue = (b - r) / delta + 2; - break; - case b: - hue = (r - g) / delta + 4; - break; - } - hue /= 6; - } - target.h = hue; - target.s = saturation; - target.l = lightness; - return target; - } - getRGB(target, colorSpace = ColorManagement.workingColorSpace) { - ColorManagement.fromWorkingColorSpace(_color$1.copy(this), colorSpace); - target.r = _color$1.r; - target.g = _color$1.g; - target.b = _color$1.b; - return target; - } - getStyle(colorSpace = SRGBColorSpace) { - ColorManagement.fromWorkingColorSpace(_color$1.copy(this), colorSpace); - const r = _color$1.r, g = _color$1.g, b = _color$1.b; - if (colorSpace !== SRGBColorSpace) { - return `color(${colorSpace} ${r.toFixed(3)} ${g.toFixed(3)} ${b.toFixed(3)})`; - } - return `rgb(${Math.round(r * 255)},${Math.round(g * 255)},${Math.round(b * 255)})`; - } - offsetHSL(h, s, l) { - this.getHSL(_hslA); - return this.setHSL(_hslA.h + h, _hslA.s + s, _hslA.l + l); - } - add(color) { - this.r += color.r; - this.g += color.g; - this.b += color.b; - return this; - } - addColors(color1, color2) { - this.r = color1.r + color2.r; - this.g = color1.g + color2.g; - this.b = color1.b + color2.b; - return this; - } - addScalar(s) { - this.r += s; - this.g += s; - this.b += s; - return this; - } - sub(color) { - this.r = Math.max(0, this.r - color.r); - this.g = Math.max(0, this.g - color.g); - this.b = Math.max(0, this.b - color.b); - return this; - } - multiply(color) { - this.r *= color.r; - this.g *= color.g; - this.b *= color.b; - return this; - } - multiplyScalar(s) { - this.r *= s; - this.g *= s; - this.b *= s; - return this; - } - lerp(color, alpha) { - this.r += (color.r - this.r) * alpha; - this.g += (color.g - this.g) * alpha; - this.b += (color.b - this.b) * alpha; - return this; - } - lerpColors(color1, color2, alpha) { - this.r = color1.r + (color2.r - color1.r) * alpha; - this.g = color1.g + (color2.g - color1.g) * alpha; - this.b = color1.b + (color2.b - color1.b) * alpha; - return this; - } - lerpHSL(color, alpha) { - this.getHSL(_hslA); - color.getHSL(_hslB); - const h = lerp(_hslA.h, _hslB.h, alpha); - const s = lerp(_hslA.s, _hslB.s, alpha); - const l = lerp(_hslA.l, _hslB.l, alpha); - this.setHSL(h, s, l); - return this; - } - setFromVector3(v) { - this.r = v.x; - this.g = v.y; - this.b = v.z; - return this; - } - applyMatrix3(m) { - const r = this.r, g = this.g, b = this.b; - const e = m.elements; - this.r = e[0] * r + e[3] * g + e[6] * b; - this.g = e[1] * r + e[4] * g + e[7] * b; - this.b = e[2] * r + e[5] * g + e[8] * b; - return this; - } - equals(c) { - return c.r === this.r && c.g === this.g && c.b === this.b; - } - fromArray(array, offset = 0) { - this.r = array[offset]; - this.g = array[offset + 1]; - this.b = array[offset + 2]; - return this; - } - toArray(array = [], offset = 0) { - array[offset] = this.r; - array[offset + 1] = this.g; - array[offset + 2] = this.b; - return array; - } - fromBufferAttribute(attribute, index) { - this.r = attribute.getX(index); - this.g = attribute.getY(index); - this.b = attribute.getZ(index); - return this; - } - toJSON() { - return this.getHex(); - } - *[Symbol.iterator]() { - yield this.r; - yield this.g; - yield this.b; - } -} -const _color$1 = /* @__PURE__ */ new Color(); -Color.NAMES = _colorKeywords; -let _materialId = 0; -class Material extends EventDispatcher { - static { - __name(this, "Material"); - } - static get type() { - return "Material"; - } - get type() { - return this.constructor.type; - } - set type(_value) { - } - constructor() { - super(); - this.isMaterial = true; - Object.defineProperty(this, "id", { value: _materialId++ }); - this.uuid = generateUUID(); - this.name = ""; - this.blending = NormalBlending; - this.side = FrontSide; - this.vertexColors = false; - this.opacity = 1; - this.transparent = false; - this.alphaHash = false; - this.blendSrc = SrcAlphaFactor; - this.blendDst = OneMinusSrcAlphaFactor; - this.blendEquation = AddEquation; - this.blendSrcAlpha = null; - this.blendDstAlpha = null; - this.blendEquationAlpha = null; - this.blendColor = new Color(0, 0, 0); - this.blendAlpha = 0; - this.depthFunc = LessEqualDepth; - this.depthTest = true; - this.depthWrite = true; - this.stencilWriteMask = 255; - this.stencilFunc = AlwaysStencilFunc; - this.stencilRef = 0; - this.stencilFuncMask = 255; - this.stencilFail = KeepStencilOp; - this.stencilZFail = KeepStencilOp; - this.stencilZPass = KeepStencilOp; - this.stencilWrite = false; - this.clippingPlanes = null; - this.clipIntersection = false; - this.clipShadows = false; - this.shadowSide = null; - this.colorWrite = true; - this.precision = null; - this.polygonOffset = false; - this.polygonOffsetFactor = 0; - this.polygonOffsetUnits = 0; - this.dithering = false; - this.alphaToCoverage = false; - this.premultipliedAlpha = false; - this.forceSinglePass = false; - this.visible = true; - this.toneMapped = true; - this.userData = {}; - this.version = 0; - this._alphaTest = 0; - } - get alphaTest() { - return this._alphaTest; - } - set alphaTest(value) { - if (this._alphaTest > 0 !== value > 0) { - this.version++; - } - this._alphaTest = value; - } - // onBeforeRender and onBeforeCompile only supported in WebGLRenderer - onBeforeRender() { - } - onBeforeCompile() { - } - customProgramCacheKey() { - return this.onBeforeCompile.toString(); - } - setValues(values) { - if (values === void 0) return; - for (const key in values) { - const newValue = values[key]; - if (newValue === void 0) { - console.warn(`THREE.Material: parameter '${key}' has value of undefined.`); - continue; - } - const currentValue = this[key]; - if (currentValue === void 0) { - console.warn(`THREE.Material: '${key}' is not a property of THREE.${this.type}.`); - continue; - } - if (currentValue && currentValue.isColor) { - currentValue.set(newValue); - } else if (currentValue && currentValue.isVector3 && (newValue && newValue.isVector3)) { - currentValue.copy(newValue); - } else { - this[key] = newValue; - } - } - } - toJSON(meta) { - const isRootObject = meta === void 0 || typeof meta === "string"; - if (isRootObject) { - meta = { - textures: {}, - images: {} - }; - } - const data = { - metadata: { - version: 4.6, - type: "Material", - generator: "Material.toJSON" - } - }; - data.uuid = this.uuid; - data.type = this.type; - if (this.name !== "") data.name = this.name; - if (this.color && this.color.isColor) data.color = this.color.getHex(); - if (this.roughness !== void 0) data.roughness = this.roughness; - if (this.metalness !== void 0) data.metalness = this.metalness; - if (this.sheen !== void 0) data.sheen = this.sheen; - if (this.sheenColor && this.sheenColor.isColor) data.sheenColor = this.sheenColor.getHex(); - if (this.sheenRoughness !== void 0) data.sheenRoughness = this.sheenRoughness; - if (this.emissive && this.emissive.isColor) data.emissive = this.emissive.getHex(); - if (this.emissiveIntensity !== void 0 && this.emissiveIntensity !== 1) data.emissiveIntensity = this.emissiveIntensity; - if (this.specular && this.specular.isColor) data.specular = this.specular.getHex(); - if (this.specularIntensity !== void 0) data.specularIntensity = this.specularIntensity; - if (this.specularColor && this.specularColor.isColor) data.specularColor = this.specularColor.getHex(); - if (this.shininess !== void 0) data.shininess = this.shininess; - if (this.clearcoat !== void 0) data.clearcoat = this.clearcoat; - if (this.clearcoatRoughness !== void 0) data.clearcoatRoughness = this.clearcoatRoughness; - if (this.clearcoatMap && this.clearcoatMap.isTexture) { - data.clearcoatMap = this.clearcoatMap.toJSON(meta).uuid; - } - if (this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture) { - data.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(meta).uuid; - } - if (this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture) { - data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(meta).uuid; - data.clearcoatNormalScale = this.clearcoatNormalScale.toArray(); - } - if (this.dispersion !== void 0) data.dispersion = this.dispersion; - if (this.iridescence !== void 0) data.iridescence = this.iridescence; - if (this.iridescenceIOR !== void 0) data.iridescenceIOR = this.iridescenceIOR; - if (this.iridescenceThicknessRange !== void 0) data.iridescenceThicknessRange = this.iridescenceThicknessRange; - if (this.iridescenceMap && this.iridescenceMap.isTexture) { - data.iridescenceMap = this.iridescenceMap.toJSON(meta).uuid; - } - if (this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture) { - data.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(meta).uuid; - } - if (this.anisotropy !== void 0) data.anisotropy = this.anisotropy; - if (this.anisotropyRotation !== void 0) data.anisotropyRotation = this.anisotropyRotation; - if (this.anisotropyMap && this.anisotropyMap.isTexture) { - data.anisotropyMap = this.anisotropyMap.toJSON(meta).uuid; - } - if (this.map && this.map.isTexture) data.map = this.map.toJSON(meta).uuid; - if (this.matcap && this.matcap.isTexture) data.matcap = this.matcap.toJSON(meta).uuid; - if (this.alphaMap && this.alphaMap.isTexture) data.alphaMap = this.alphaMap.toJSON(meta).uuid; - if (this.lightMap && this.lightMap.isTexture) { - data.lightMap = this.lightMap.toJSON(meta).uuid; - data.lightMapIntensity = this.lightMapIntensity; - } - if (this.aoMap && this.aoMap.isTexture) { - data.aoMap = this.aoMap.toJSON(meta).uuid; - data.aoMapIntensity = this.aoMapIntensity; - } - if (this.bumpMap && this.bumpMap.isTexture) { - data.bumpMap = this.bumpMap.toJSON(meta).uuid; - data.bumpScale = this.bumpScale; - } - if (this.normalMap && this.normalMap.isTexture) { - data.normalMap = this.normalMap.toJSON(meta).uuid; - data.normalMapType = this.normalMapType; - data.normalScale = this.normalScale.toArray(); - } - if (this.displacementMap && this.displacementMap.isTexture) { - data.displacementMap = this.displacementMap.toJSON(meta).uuid; - data.displacementScale = this.displacementScale; - data.displacementBias = this.displacementBias; - } - if (this.roughnessMap && this.roughnessMap.isTexture) data.roughnessMap = this.roughnessMap.toJSON(meta).uuid; - if (this.metalnessMap && this.metalnessMap.isTexture) data.metalnessMap = this.metalnessMap.toJSON(meta).uuid; - if (this.emissiveMap && this.emissiveMap.isTexture) data.emissiveMap = this.emissiveMap.toJSON(meta).uuid; - if (this.specularMap && this.specularMap.isTexture) data.specularMap = this.specularMap.toJSON(meta).uuid; - if (this.specularIntensityMap && this.specularIntensityMap.isTexture) data.specularIntensityMap = this.specularIntensityMap.toJSON(meta).uuid; - if (this.specularColorMap && this.specularColorMap.isTexture) data.specularColorMap = this.specularColorMap.toJSON(meta).uuid; - if (this.envMap && this.envMap.isTexture) { - data.envMap = this.envMap.toJSON(meta).uuid; - if (this.combine !== void 0) data.combine = this.combine; - } - if (this.envMapRotation !== void 0) data.envMapRotation = this.envMapRotation.toArray(); - if (this.envMapIntensity !== void 0) data.envMapIntensity = this.envMapIntensity; - if (this.reflectivity !== void 0) data.reflectivity = this.reflectivity; - if (this.refractionRatio !== void 0) data.refractionRatio = this.refractionRatio; - if (this.gradientMap && this.gradientMap.isTexture) { - data.gradientMap = this.gradientMap.toJSON(meta).uuid; - } - if (this.transmission !== void 0) data.transmission = this.transmission; - if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid; - if (this.thickness !== void 0) data.thickness = this.thickness; - if (this.thicknessMap && this.thicknessMap.isTexture) data.thicknessMap = this.thicknessMap.toJSON(meta).uuid; - if (this.attenuationDistance !== void 0 && this.attenuationDistance !== Infinity) data.attenuationDistance = this.attenuationDistance; - if (this.attenuationColor !== void 0) data.attenuationColor = this.attenuationColor.getHex(); - if (this.size !== void 0) data.size = this.size; - if (this.shadowSide !== null) data.shadowSide = this.shadowSide; - if (this.sizeAttenuation !== void 0) data.sizeAttenuation = this.sizeAttenuation; - if (this.blending !== NormalBlending) data.blending = this.blending; - if (this.side !== FrontSide) data.side = this.side; - if (this.vertexColors === true) data.vertexColors = true; - if (this.opacity < 1) data.opacity = this.opacity; - if (this.transparent === true) data.transparent = true; - if (this.blendSrc !== SrcAlphaFactor) data.blendSrc = this.blendSrc; - if (this.blendDst !== OneMinusSrcAlphaFactor) data.blendDst = this.blendDst; - if (this.blendEquation !== AddEquation) data.blendEquation = this.blendEquation; - if (this.blendSrcAlpha !== null) data.blendSrcAlpha = this.blendSrcAlpha; - if (this.blendDstAlpha !== null) data.blendDstAlpha = this.blendDstAlpha; - if (this.blendEquationAlpha !== null) data.blendEquationAlpha = this.blendEquationAlpha; - if (this.blendColor && this.blendColor.isColor) data.blendColor = this.blendColor.getHex(); - if (this.blendAlpha !== 0) data.blendAlpha = this.blendAlpha; - if (this.depthFunc !== LessEqualDepth) data.depthFunc = this.depthFunc; - if (this.depthTest === false) data.depthTest = this.depthTest; - if (this.depthWrite === false) data.depthWrite = this.depthWrite; - if (this.colorWrite === false) data.colorWrite = this.colorWrite; - if (this.stencilWriteMask !== 255) data.stencilWriteMask = this.stencilWriteMask; - if (this.stencilFunc !== AlwaysStencilFunc) data.stencilFunc = this.stencilFunc; - if (this.stencilRef !== 0) data.stencilRef = this.stencilRef; - if (this.stencilFuncMask !== 255) data.stencilFuncMask = this.stencilFuncMask; - if (this.stencilFail !== KeepStencilOp) data.stencilFail = this.stencilFail; - if (this.stencilZFail !== KeepStencilOp) data.stencilZFail = this.stencilZFail; - if (this.stencilZPass !== KeepStencilOp) data.stencilZPass = this.stencilZPass; - if (this.stencilWrite === true) data.stencilWrite = this.stencilWrite; - if (this.rotation !== void 0 && this.rotation !== 0) data.rotation = this.rotation; - if (this.polygonOffset === true) data.polygonOffset = true; - if (this.polygonOffsetFactor !== 0) data.polygonOffsetFactor = this.polygonOffsetFactor; - if (this.polygonOffsetUnits !== 0) data.polygonOffsetUnits = this.polygonOffsetUnits; - if (this.linewidth !== void 0 && this.linewidth !== 1) data.linewidth = this.linewidth; - if (this.dashSize !== void 0) data.dashSize = this.dashSize; - if (this.gapSize !== void 0) data.gapSize = this.gapSize; - if (this.scale !== void 0) data.scale = this.scale; - if (this.dithering === true) data.dithering = true; - if (this.alphaTest > 0) data.alphaTest = this.alphaTest; - if (this.alphaHash === true) data.alphaHash = true; - if (this.alphaToCoverage === true) data.alphaToCoverage = true; - if (this.premultipliedAlpha === true) data.premultipliedAlpha = true; - if (this.forceSinglePass === true) data.forceSinglePass = true; - if (this.wireframe === true) data.wireframe = true; - if (this.wireframeLinewidth > 1) data.wireframeLinewidth = this.wireframeLinewidth; - if (this.wireframeLinecap !== "round") data.wireframeLinecap = this.wireframeLinecap; - if (this.wireframeLinejoin !== "round") data.wireframeLinejoin = this.wireframeLinejoin; - if (this.flatShading === true) data.flatShading = true; - if (this.visible === false) data.visible = false; - if (this.toneMapped === false) data.toneMapped = false; - if (this.fog === false) data.fog = false; - if (Object.keys(this.userData).length > 0) data.userData = this.userData; - function extractFromCache(cache) { - const values = []; - for (const key in cache) { - const data2 = cache[key]; - delete data2.metadata; - values.push(data2); - } - return values; - } - __name(extractFromCache, "extractFromCache"); - if (isRootObject) { - const textures = extractFromCache(meta.textures); - const images = extractFromCache(meta.images); - if (textures.length > 0) data.textures = textures; - if (images.length > 0) data.images = images; - } - return data; - } - clone() { - return new this.constructor().copy(this); - } - copy(source) { - this.name = source.name; - this.blending = source.blending; - this.side = source.side; - this.vertexColors = source.vertexColors; - this.opacity = source.opacity; - this.transparent = source.transparent; - this.blendSrc = source.blendSrc; - this.blendDst = source.blendDst; - this.blendEquation = source.blendEquation; - this.blendSrcAlpha = source.blendSrcAlpha; - this.blendDstAlpha = source.blendDstAlpha; - this.blendEquationAlpha = source.blendEquationAlpha; - this.blendColor.copy(source.blendColor); - this.blendAlpha = source.blendAlpha; - this.depthFunc = source.depthFunc; - this.depthTest = source.depthTest; - this.depthWrite = source.depthWrite; - this.stencilWriteMask = source.stencilWriteMask; - this.stencilFunc = source.stencilFunc; - this.stencilRef = source.stencilRef; - this.stencilFuncMask = source.stencilFuncMask; - this.stencilFail = source.stencilFail; - this.stencilZFail = source.stencilZFail; - this.stencilZPass = source.stencilZPass; - this.stencilWrite = source.stencilWrite; - const srcPlanes = source.clippingPlanes; - let dstPlanes = null; - if (srcPlanes !== null) { - const n = srcPlanes.length; - dstPlanes = new Array(n); - for (let i = 0; i !== n; ++i) { - dstPlanes[i] = srcPlanes[i].clone(); - } - } - this.clippingPlanes = dstPlanes; - this.clipIntersection = source.clipIntersection; - this.clipShadows = source.clipShadows; - this.shadowSide = source.shadowSide; - this.colorWrite = source.colorWrite; - this.precision = source.precision; - this.polygonOffset = source.polygonOffset; - this.polygonOffsetFactor = source.polygonOffsetFactor; - this.polygonOffsetUnits = source.polygonOffsetUnits; - this.dithering = source.dithering; - this.alphaTest = source.alphaTest; - this.alphaHash = source.alphaHash; - this.alphaToCoverage = source.alphaToCoverage; - this.premultipliedAlpha = source.premultipliedAlpha; - this.forceSinglePass = source.forceSinglePass; - this.visible = source.visible; - this.toneMapped = source.toneMapped; - this.userData = JSON.parse(JSON.stringify(source.userData)); - return this; - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } - set needsUpdate(value) { - if (value === true) this.version++; - } - onBuild() { - console.warn("Material: onBuild() has been removed."); - } -} -class MeshBasicMaterial extends Material { - static { - __name(this, "MeshBasicMaterial"); - } - static get type() { - return "MeshBasicMaterial"; - } - constructor(parameters) { - super(); - this.isMeshBasicMaterial = true; - this.color = new Color(16777215); - this.map = null; - this.lightMap = null; - this.lightMapIntensity = 1; - this.aoMap = null; - this.aoMapIntensity = 1; - this.specularMap = null; - this.alphaMap = null; - this.envMap = null; - this.envMapRotation = new Euler(); - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = "round"; - this.wireframeLinejoin = "round"; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.map = source.map; - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - this.specularMap = source.specularMap; - this.alphaMap = source.alphaMap; - this.envMap = source.envMap; - this.envMapRotation.copy(source.envMapRotation); - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - this.fog = source.fog; - return this; - } -} -const _tables = /* @__PURE__ */ _generateTables(); -function _generateTables() { - const buffer = new ArrayBuffer(4); - const floatView = new Float32Array(buffer); - const uint32View = new Uint32Array(buffer); - const baseTable = new Uint32Array(512); - const shiftTable = new Uint32Array(512); - for (let i = 0; i < 256; ++i) { - const e = i - 127; - if (e < -27) { - baseTable[i] = 0; - baseTable[i | 256] = 32768; - shiftTable[i] = 24; - shiftTable[i | 256] = 24; - } else if (e < -14) { - baseTable[i] = 1024 >> -e - 14; - baseTable[i | 256] = 1024 >> -e - 14 | 32768; - shiftTable[i] = -e - 1; - shiftTable[i | 256] = -e - 1; - } else if (e <= 15) { - baseTable[i] = e + 15 << 10; - baseTable[i | 256] = e + 15 << 10 | 32768; - shiftTable[i] = 13; - shiftTable[i | 256] = 13; - } else if (e < 128) { - baseTable[i] = 31744; - baseTable[i | 256] = 64512; - shiftTable[i] = 24; - shiftTable[i | 256] = 24; - } else { - baseTable[i] = 31744; - baseTable[i | 256] = 64512; - shiftTable[i] = 13; - shiftTable[i | 256] = 13; - } - } - const mantissaTable = new Uint32Array(2048); - const exponentTable = new Uint32Array(64); - const offsetTable = new Uint32Array(64); - for (let i = 1; i < 1024; ++i) { - let m = i << 13; - let e = 0; - while ((m & 8388608) === 0) { - m <<= 1; - e -= 8388608; - } - m &= ~8388608; - e += 947912704; - mantissaTable[i] = m | e; - } - for (let i = 1024; i < 2048; ++i) { - mantissaTable[i] = 939524096 + (i - 1024 << 13); - } - for (let i = 1; i < 31; ++i) { - exponentTable[i] = i << 23; - } - exponentTable[31] = 1199570944; - exponentTable[32] = 2147483648; - for (let i = 33; i < 63; ++i) { - exponentTable[i] = 2147483648 + (i - 32 << 23); - } - exponentTable[63] = 3347054592; - for (let i = 1; i < 64; ++i) { - if (i !== 32) { - offsetTable[i] = 1024; - } - } - return { - floatView, - uint32View, - baseTable, - shiftTable, - mantissaTable, - exponentTable, - offsetTable - }; -} -__name(_generateTables, "_generateTables"); -function toHalfFloat(val) { - if (Math.abs(val) > 65504) console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."); - val = clamp(val, -65504, 65504); - _tables.floatView[0] = val; - const f = _tables.uint32View[0]; - const e = f >> 23 & 511; - return _tables.baseTable[e] + ((f & 8388607) >> _tables.shiftTable[e]); -} -__name(toHalfFloat, "toHalfFloat"); -function fromHalfFloat(val) { - const m = val >> 10; - _tables.uint32View[0] = _tables.mantissaTable[_tables.offsetTable[m] + (val & 1023)] + _tables.exponentTable[m]; - return _tables.floatView[0]; -} -__name(fromHalfFloat, "fromHalfFloat"); -const DataUtils = { - toHalfFloat, - fromHalfFloat -}; -const _vector$9 = /* @__PURE__ */ new Vector3(); -const _vector2$1 = /* @__PURE__ */ new Vector2(); -class BufferAttribute { - static { - __name(this, "BufferAttribute"); - } - constructor(array, itemSize, normalized = false) { - if (Array.isArray(array)) { - throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); - } - this.isBufferAttribute = true; - this.name = ""; - this.array = array; - this.itemSize = itemSize; - this.count = array !== void 0 ? array.length / itemSize : 0; - this.normalized = normalized; - this.usage = StaticDrawUsage; - this.updateRanges = []; - this.gpuType = FloatType; - this.version = 0; - } - onUploadCallback() { - } - set needsUpdate(value) { - if (value === true) this.version++; - } - setUsage(value) { - this.usage = value; - return this; - } - addUpdateRange(start, count) { - this.updateRanges.push({ start, count }); - } - clearUpdateRanges() { - this.updateRanges.length = 0; - } - copy(source) { - this.name = source.name; - this.array = new source.array.constructor(source.array); - this.itemSize = source.itemSize; - this.count = source.count; - this.normalized = source.normalized; - this.usage = source.usage; - this.gpuType = source.gpuType; - return this; - } - copyAt(index1, attribute, index2) { - index1 *= this.itemSize; - index2 *= attribute.itemSize; - for (let i = 0, l = this.itemSize; i < l; i++) { - this.array[index1 + i] = attribute.array[index2 + i]; - } - return this; - } - copyArray(array) { - this.array.set(array); - return this; - } - applyMatrix3(m) { - if (this.itemSize === 2) { - for (let i = 0, l = this.count; i < l; i++) { - _vector2$1.fromBufferAttribute(this, i); - _vector2$1.applyMatrix3(m); - this.setXY(i, _vector2$1.x, _vector2$1.y); - } - } else if (this.itemSize === 3) { - for (let i = 0, l = this.count; i < l; i++) { - _vector$9.fromBufferAttribute(this, i); - _vector$9.applyMatrix3(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); - } - } - return this; - } - applyMatrix4(m) { - for (let i = 0, l = this.count; i < l; i++) { - _vector$9.fromBufferAttribute(this, i); - _vector$9.applyMatrix4(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); - } - return this; - } - applyNormalMatrix(m) { - for (let i = 0, l = this.count; i < l; i++) { - _vector$9.fromBufferAttribute(this, i); - _vector$9.applyNormalMatrix(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); - } - return this; - } - transformDirection(m) { - for (let i = 0, l = this.count; i < l; i++) { - _vector$9.fromBufferAttribute(this, i); - _vector$9.transformDirection(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); - } - return this; - } - set(value, offset = 0) { - this.array.set(value, offset); - return this; - } - getComponent(index, component) { - let value = this.array[index * this.itemSize + component]; - if (this.normalized) value = denormalize(value, this.array); - return value; - } - setComponent(index, component, value) { - if (this.normalized) value = normalize(value, this.array); - this.array[index * this.itemSize + component] = value; - return this; - } - getX(index) { - let x = this.array[index * this.itemSize]; - if (this.normalized) x = denormalize(x, this.array); - return x; - } - setX(index, x) { - if (this.normalized) x = normalize(x, this.array); - this.array[index * this.itemSize] = x; - return this; - } - getY(index) { - let y = this.array[index * this.itemSize + 1]; - if (this.normalized) y = denormalize(y, this.array); - return y; - } - setY(index, y) { - if (this.normalized) y = normalize(y, this.array); - this.array[index * this.itemSize + 1] = y; - return this; - } - getZ(index) { - let z = this.array[index * this.itemSize + 2]; - if (this.normalized) z = denormalize(z, this.array); - return z; - } - setZ(index, z) { - if (this.normalized) z = normalize(z, this.array); - this.array[index * this.itemSize + 2] = z; - return this; - } - getW(index) { - let w = this.array[index * this.itemSize + 3]; - if (this.normalized) w = denormalize(w, this.array); - return w; - } - setW(index, w) { - if (this.normalized) w = normalize(w, this.array); - this.array[index * this.itemSize + 3] = w; - return this; - } - setXY(index, x, y) { - index *= this.itemSize; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - } - this.array[index + 0] = x; - this.array[index + 1] = y; - return this; - } - setXYZ(index, x, y, z) { - index *= this.itemSize; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - z = normalize(z, this.array); - } - this.array[index + 0] = x; - this.array[index + 1] = y; - this.array[index + 2] = z; - return this; - } - setXYZW(index, x, y, z, w) { - index *= this.itemSize; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - z = normalize(z, this.array); - w = normalize(w, this.array); - } - this.array[index + 0] = x; - this.array[index + 1] = y; - this.array[index + 2] = z; - this.array[index + 3] = w; - return this; - } - onUpload(callback) { - this.onUploadCallback = callback; - return this; - } - clone() { - return new this.constructor(this.array, this.itemSize).copy(this); - } - toJSON() { - const data = { - itemSize: this.itemSize, - type: this.array.constructor.name, - array: Array.from(this.array), - normalized: this.normalized - }; - if (this.name !== "") data.name = this.name; - if (this.usage !== StaticDrawUsage) data.usage = this.usage; - return data; - } -} -class Int8BufferAttribute extends BufferAttribute { - static { - __name(this, "Int8BufferAttribute"); - } - constructor(array, itemSize, normalized) { - super(new Int8Array(array), itemSize, normalized); - } -} -class Uint8BufferAttribute extends BufferAttribute { - static { - __name(this, "Uint8BufferAttribute"); - } - constructor(array, itemSize, normalized) { - super(new Uint8Array(array), itemSize, normalized); - } -} -class Uint8ClampedBufferAttribute extends BufferAttribute { - static { - __name(this, "Uint8ClampedBufferAttribute"); - } - constructor(array, itemSize, normalized) { - super(new Uint8ClampedArray(array), itemSize, normalized); - } -} -class Int16BufferAttribute extends BufferAttribute { - static { - __name(this, "Int16BufferAttribute"); - } - constructor(array, itemSize, normalized) { - super(new Int16Array(array), itemSize, normalized); - } -} -class Uint16BufferAttribute extends BufferAttribute { - static { - __name(this, "Uint16BufferAttribute"); - } - constructor(array, itemSize, normalized) { - super(new Uint16Array(array), itemSize, normalized); - } -} -class Int32BufferAttribute extends BufferAttribute { - static { - __name(this, "Int32BufferAttribute"); - } - constructor(array, itemSize, normalized) { - super(new Int32Array(array), itemSize, normalized); - } -} -class Uint32BufferAttribute extends BufferAttribute { - static { - __name(this, "Uint32BufferAttribute"); - } - constructor(array, itemSize, normalized) { - super(new Uint32Array(array), itemSize, normalized); - } -} -class Float16BufferAttribute extends BufferAttribute { - static { - __name(this, "Float16BufferAttribute"); - } - constructor(array, itemSize, normalized) { - super(new Uint16Array(array), itemSize, normalized); - this.isFloat16BufferAttribute = true; - } - getX(index) { - let x = fromHalfFloat(this.array[index * this.itemSize]); - if (this.normalized) x = denormalize(x, this.array); - return x; - } - setX(index, x) { - if (this.normalized) x = normalize(x, this.array); - this.array[index * this.itemSize] = toHalfFloat(x); - return this; - } - getY(index) { - let y = fromHalfFloat(this.array[index * this.itemSize + 1]); - if (this.normalized) y = denormalize(y, this.array); - return y; - } - setY(index, y) { - if (this.normalized) y = normalize(y, this.array); - this.array[index * this.itemSize + 1] = toHalfFloat(y); - return this; - } - getZ(index) { - let z = fromHalfFloat(this.array[index * this.itemSize + 2]); - if (this.normalized) z = denormalize(z, this.array); - return z; - } - setZ(index, z) { - if (this.normalized) z = normalize(z, this.array); - this.array[index * this.itemSize + 2] = toHalfFloat(z); - return this; - } - getW(index) { - let w = fromHalfFloat(this.array[index * this.itemSize + 3]); - if (this.normalized) w = denormalize(w, this.array); - return w; - } - setW(index, w) { - if (this.normalized) w = normalize(w, this.array); - this.array[index * this.itemSize + 3] = toHalfFloat(w); - return this; - } - setXY(index, x, y) { - index *= this.itemSize; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - } - this.array[index + 0] = toHalfFloat(x); - this.array[index + 1] = toHalfFloat(y); - return this; - } - setXYZ(index, x, y, z) { - index *= this.itemSize; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - z = normalize(z, this.array); - } - this.array[index + 0] = toHalfFloat(x); - this.array[index + 1] = toHalfFloat(y); - this.array[index + 2] = toHalfFloat(z); - return this; - } - setXYZW(index, x, y, z, w) { - index *= this.itemSize; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - z = normalize(z, this.array); - w = normalize(w, this.array); - } - this.array[index + 0] = toHalfFloat(x); - this.array[index + 1] = toHalfFloat(y); - this.array[index + 2] = toHalfFloat(z); - this.array[index + 3] = toHalfFloat(w); - return this; - } -} -class Float32BufferAttribute extends BufferAttribute { - static { - __name(this, "Float32BufferAttribute"); - } - constructor(array, itemSize, normalized) { - super(new Float32Array(array), itemSize, normalized); - } -} -let _id$2 = 0; -const _m1$2 = /* @__PURE__ */ new Matrix4(); -const _obj = /* @__PURE__ */ new Object3D(); -const _offset = /* @__PURE__ */ new Vector3(); -const _box$2 = /* @__PURE__ */ new Box3(); -const _boxMorphTargets = /* @__PURE__ */ new Box3(); -const _vector$8 = /* @__PURE__ */ new Vector3(); -class BufferGeometry extends EventDispatcher { - static { - __name(this, "BufferGeometry"); - } - constructor() { - super(); - this.isBufferGeometry = true; - Object.defineProperty(this, "id", { value: _id$2++ }); - this.uuid = generateUUID(); - this.name = ""; - this.type = "BufferGeometry"; - this.index = null; - this.indirect = null; - this.attributes = {}; - this.morphAttributes = {}; - this.morphTargetsRelative = false; - this.groups = []; - this.boundingBox = null; - this.boundingSphere = null; - this.drawRange = { start: 0, count: Infinity }; - this.userData = {}; - } - getIndex() { - return this.index; - } - setIndex(index) { - if (Array.isArray(index)) { - this.index = new (arrayNeedsUint32(index) ? Uint32BufferAttribute : Uint16BufferAttribute)(index, 1); - } else { - this.index = index; - } - return this; - } - setIndirect(indirect) { - this.indirect = indirect; - return this; - } - getIndirect() { - return this.indirect; - } - getAttribute(name) { - return this.attributes[name]; - } - setAttribute(name, attribute) { - this.attributes[name] = attribute; - return this; - } - deleteAttribute(name) { - delete this.attributes[name]; - return this; - } - hasAttribute(name) { - return this.attributes[name] !== void 0; - } - addGroup(start, count, materialIndex = 0) { - this.groups.push({ - start, - count, - materialIndex - }); - } - clearGroups() { - this.groups = []; - } - setDrawRange(start, count) { - this.drawRange.start = start; - this.drawRange.count = count; - } - applyMatrix4(matrix) { - const position = this.attributes.position; - if (position !== void 0) { - position.applyMatrix4(matrix); - position.needsUpdate = true; - } - const normal = this.attributes.normal; - if (normal !== void 0) { - const normalMatrix = new Matrix3().getNormalMatrix(matrix); - normal.applyNormalMatrix(normalMatrix); - normal.needsUpdate = true; - } - const tangent = this.attributes.tangent; - if (tangent !== void 0) { - tangent.transformDirection(matrix); - tangent.needsUpdate = true; - } - if (this.boundingBox !== null) { - this.computeBoundingBox(); - } - if (this.boundingSphere !== null) { - this.computeBoundingSphere(); - } - return this; - } - applyQuaternion(q) { - _m1$2.makeRotationFromQuaternion(q); - this.applyMatrix4(_m1$2); - return this; - } - rotateX(angle) { - _m1$2.makeRotationX(angle); - this.applyMatrix4(_m1$2); - return this; - } - rotateY(angle) { - _m1$2.makeRotationY(angle); - this.applyMatrix4(_m1$2); - return this; - } - rotateZ(angle) { - _m1$2.makeRotationZ(angle); - this.applyMatrix4(_m1$2); - return this; - } - translate(x, y, z) { - _m1$2.makeTranslation(x, y, z); - this.applyMatrix4(_m1$2); - return this; - } - scale(x, y, z) { - _m1$2.makeScale(x, y, z); - this.applyMatrix4(_m1$2); - return this; - } - lookAt(vector) { - _obj.lookAt(vector); - _obj.updateMatrix(); - this.applyMatrix4(_obj.matrix); - return this; - } - center() { - this.computeBoundingBox(); - this.boundingBox.getCenter(_offset).negate(); - this.translate(_offset.x, _offset.y, _offset.z); - return this; - } - setFromPoints(points) { - const positionAttribute = this.getAttribute("position"); - if (positionAttribute === void 0) { - const position = []; - for (let i = 0, l = points.length; i < l; i++) { - const point = points[i]; - position.push(point.x, point.y, point.z || 0); - } - this.setAttribute("position", new Float32BufferAttribute(position, 3)); - } else { - for (let i = 0, l = positionAttribute.count; i < l; i++) { - const point = points[i]; - positionAttribute.setXYZ(i, point.x, point.y, point.z || 0); - } - if (points.length > positionAttribute.count) { - console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."); - } - positionAttribute.needsUpdate = true; - } - return this; - } - computeBoundingBox() { - if (this.boundingBox === null) { - this.boundingBox = new Box3(); - } - const position = this.attributes.position; - const morphAttributesPosition = this.morphAttributes.position; - if (position && position.isGLBufferAttribute) { - console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.", this); - this.boundingBox.set( - new Vector3(-Infinity, -Infinity, -Infinity), - new Vector3(Infinity, Infinity, Infinity) - ); - return; - } - if (position !== void 0) { - this.boundingBox.setFromBufferAttribute(position); - if (morphAttributesPosition) { - for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { - const morphAttribute = morphAttributesPosition[i]; - _box$2.setFromBufferAttribute(morphAttribute); - if (this.morphTargetsRelative) { - _vector$8.addVectors(this.boundingBox.min, _box$2.min); - this.boundingBox.expandByPoint(_vector$8); - _vector$8.addVectors(this.boundingBox.max, _box$2.max); - this.boundingBox.expandByPoint(_vector$8); - } else { - this.boundingBox.expandByPoint(_box$2.min); - this.boundingBox.expandByPoint(_box$2.max); - } - } - } - } else { - this.boundingBox.makeEmpty(); - } - if (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) { - console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this); - } - } - computeBoundingSphere() { - if (this.boundingSphere === null) { - this.boundingSphere = new Sphere(); - } - const position = this.attributes.position; - const morphAttributesPosition = this.morphAttributes.position; - if (position && position.isGLBufferAttribute) { - console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.", this); - this.boundingSphere.set(new Vector3(), Infinity); - return; - } - if (position) { - const center = this.boundingSphere.center; - _box$2.setFromBufferAttribute(position); - if (morphAttributesPosition) { - for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { - const morphAttribute = morphAttributesPosition[i]; - _boxMorphTargets.setFromBufferAttribute(morphAttribute); - if (this.morphTargetsRelative) { - _vector$8.addVectors(_box$2.min, _boxMorphTargets.min); - _box$2.expandByPoint(_vector$8); - _vector$8.addVectors(_box$2.max, _boxMorphTargets.max); - _box$2.expandByPoint(_vector$8); - } else { - _box$2.expandByPoint(_boxMorphTargets.min); - _box$2.expandByPoint(_boxMorphTargets.max); - } - } - } - _box$2.getCenter(center); - let maxRadiusSq = 0; - for (let i = 0, il = position.count; i < il; i++) { - _vector$8.fromBufferAttribute(position, i); - maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$8)); - } - if (morphAttributesPosition) { - for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { - const morphAttribute = morphAttributesPosition[i]; - const morphTargetsRelative = this.morphTargetsRelative; - for (let j = 0, jl = morphAttribute.count; j < jl; j++) { - _vector$8.fromBufferAttribute(morphAttribute, j); - if (morphTargetsRelative) { - _offset.fromBufferAttribute(position, j); - _vector$8.add(_offset); - } - maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$8)); - } - } - } - this.boundingSphere.radius = Math.sqrt(maxRadiusSq); - if (isNaN(this.boundingSphere.radius)) { - console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this); - } - } - } - computeTangents() { - const index = this.index; - const attributes = this.attributes; - if (index === null || attributes.position === void 0 || attributes.normal === void 0 || attributes.uv === void 0) { - console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)"); - return; - } - const positionAttribute = attributes.position; - const normalAttribute = attributes.normal; - const uvAttribute = attributes.uv; - if (this.hasAttribute("tangent") === false) { - this.setAttribute("tangent", new BufferAttribute(new Float32Array(4 * positionAttribute.count), 4)); - } - const tangentAttribute = this.getAttribute("tangent"); - const tan1 = [], tan2 = []; - for (let i = 0; i < positionAttribute.count; i++) { - tan1[i] = new Vector3(); - tan2[i] = new Vector3(); - } - const vA = new Vector3(), vB = new Vector3(), vC = new Vector3(), uvA = new Vector2(), uvB = new Vector2(), uvC = new Vector2(), sdir = new Vector3(), tdir = new Vector3(); - function handleTriangle(a, b, c) { - vA.fromBufferAttribute(positionAttribute, a); - vB.fromBufferAttribute(positionAttribute, b); - vC.fromBufferAttribute(positionAttribute, c); - uvA.fromBufferAttribute(uvAttribute, a); - uvB.fromBufferAttribute(uvAttribute, b); - uvC.fromBufferAttribute(uvAttribute, c); - vB.sub(vA); - vC.sub(vA); - uvB.sub(uvA); - uvC.sub(uvA); - const r = 1 / (uvB.x * uvC.y - uvC.x * uvB.y); - if (!isFinite(r)) return; - sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC, -uvB.y).multiplyScalar(r); - tdir.copy(vC).multiplyScalar(uvB.x).addScaledVector(vB, -uvC.x).multiplyScalar(r); - tan1[a].add(sdir); - tan1[b].add(sdir); - tan1[c].add(sdir); - tan2[a].add(tdir); - tan2[b].add(tdir); - tan2[c].add(tdir); - } - __name(handleTriangle, "handleTriangle"); - let groups = this.groups; - if (groups.length === 0) { - groups = [{ - start: 0, - count: index.count - }]; - } - for (let i = 0, il = groups.length; i < il; ++i) { - const group = groups[i]; - const start = group.start; - const count = group.count; - for (let j = start, jl = start + count; j < jl; j += 3) { - handleTriangle( - index.getX(j + 0), - index.getX(j + 1), - index.getX(j + 2) - ); - } - } - const tmp2 = new Vector3(), tmp22 = new Vector3(); - const n = new Vector3(), n2 = new Vector3(); - function handleVertex(v) { - n.fromBufferAttribute(normalAttribute, v); - n2.copy(n); - const t2 = tan1[v]; - tmp2.copy(t2); - tmp2.sub(n.multiplyScalar(n.dot(t2))).normalize(); - tmp22.crossVectors(n2, t2); - const test = tmp22.dot(tan2[v]); - const w = test < 0 ? -1 : 1; - tangentAttribute.setXYZW(v, tmp2.x, tmp2.y, tmp2.z, w); - } - __name(handleVertex, "handleVertex"); - for (let i = 0, il = groups.length; i < il; ++i) { - const group = groups[i]; - const start = group.start; - const count = group.count; - for (let j = start, jl = start + count; j < jl; j += 3) { - handleVertex(index.getX(j + 0)); - handleVertex(index.getX(j + 1)); - handleVertex(index.getX(j + 2)); - } - } - } - computeVertexNormals() { - const index = this.index; - const positionAttribute = this.getAttribute("position"); - if (positionAttribute !== void 0) { - let normalAttribute = this.getAttribute("normal"); - if (normalAttribute === void 0) { - normalAttribute = new BufferAttribute(new Float32Array(positionAttribute.count * 3), 3); - this.setAttribute("normal", normalAttribute); - } else { - for (let i = 0, il = normalAttribute.count; i < il; i++) { - normalAttribute.setXYZ(i, 0, 0, 0); - } - } - const pA = new Vector3(), pB = new Vector3(), pC = new Vector3(); - const nA = new Vector3(), nB = new Vector3(), nC = new Vector3(); - const cb = new Vector3(), ab = new Vector3(); - if (index) { - for (let i = 0, il = index.count; i < il; i += 3) { - const vA = index.getX(i + 0); - const vB = index.getX(i + 1); - const vC = index.getX(i + 2); - pA.fromBufferAttribute(positionAttribute, vA); - pB.fromBufferAttribute(positionAttribute, vB); - pC.fromBufferAttribute(positionAttribute, vC); - cb.subVectors(pC, pB); - ab.subVectors(pA, pB); - cb.cross(ab); - nA.fromBufferAttribute(normalAttribute, vA); - nB.fromBufferAttribute(normalAttribute, vB); - nC.fromBufferAttribute(normalAttribute, vC); - nA.add(cb); - nB.add(cb); - nC.add(cb); - normalAttribute.setXYZ(vA, nA.x, nA.y, nA.z); - normalAttribute.setXYZ(vB, nB.x, nB.y, nB.z); - normalAttribute.setXYZ(vC, nC.x, nC.y, nC.z); - } - } else { - for (let i = 0, il = positionAttribute.count; i < il; i += 3) { - pA.fromBufferAttribute(positionAttribute, i + 0); - pB.fromBufferAttribute(positionAttribute, i + 1); - pC.fromBufferAttribute(positionAttribute, i + 2); - cb.subVectors(pC, pB); - ab.subVectors(pA, pB); - cb.cross(ab); - normalAttribute.setXYZ(i + 0, cb.x, cb.y, cb.z); - normalAttribute.setXYZ(i + 1, cb.x, cb.y, cb.z); - normalAttribute.setXYZ(i + 2, cb.x, cb.y, cb.z); - } - } - this.normalizeNormals(); - normalAttribute.needsUpdate = true; - } - } - normalizeNormals() { - const normals = this.attributes.normal; - for (let i = 0, il = normals.count; i < il; i++) { - _vector$8.fromBufferAttribute(normals, i); - _vector$8.normalize(); - normals.setXYZ(i, _vector$8.x, _vector$8.y, _vector$8.z); - } - } - toNonIndexed() { - function convertBufferAttribute(attribute, indices2) { - const array = attribute.array; - const itemSize = attribute.itemSize; - const normalized = attribute.normalized; - const array2 = new array.constructor(indices2.length * itemSize); - let index = 0, index2 = 0; - for (let i = 0, l = indices2.length; i < l; i++) { - if (attribute.isInterleavedBufferAttribute) { - index = indices2[i] * attribute.data.stride + attribute.offset; - } else { - index = indices2[i] * itemSize; - } - for (let j = 0; j < itemSize; j++) { - array2[index2++] = array[index++]; - } - } - return new BufferAttribute(array2, itemSize, normalized); - } - __name(convertBufferAttribute, "convertBufferAttribute"); - if (this.index === null) { - console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."); - return this; - } - const geometry2 = new BufferGeometry(); - const indices = this.index.array; - const attributes = this.attributes; - for (const name in attributes) { - const attribute = attributes[name]; - const newAttribute = convertBufferAttribute(attribute, indices); - geometry2.setAttribute(name, newAttribute); - } - const morphAttributes = this.morphAttributes; - for (const name in morphAttributes) { - const morphArray = []; - const morphAttribute = morphAttributes[name]; - for (let i = 0, il = morphAttribute.length; i < il; i++) { - const attribute = morphAttribute[i]; - const newAttribute = convertBufferAttribute(attribute, indices); - morphArray.push(newAttribute); - } - geometry2.morphAttributes[name] = morphArray; - } - geometry2.morphTargetsRelative = this.morphTargetsRelative; - const groups = this.groups; - for (let i = 0, l = groups.length; i < l; i++) { - const group = groups[i]; - geometry2.addGroup(group.start, group.count, group.materialIndex); - } - return geometry2; - } - toJSON() { - const data = { - metadata: { - version: 4.6, - type: "BufferGeometry", - generator: "BufferGeometry.toJSON" - } - }; - data.uuid = this.uuid; - data.type = this.type; - if (this.name !== "") data.name = this.name; - if (Object.keys(this.userData).length > 0) data.userData = this.userData; - if (this.parameters !== void 0) { - const parameters = this.parameters; - for (const key in parameters) { - if (parameters[key] !== void 0) data[key] = parameters[key]; - } - return data; - } - data.data = { attributes: {} }; - const index = this.index; - if (index !== null) { - data.data.index = { - type: index.array.constructor.name, - array: Array.prototype.slice.call(index.array) - }; - } - const attributes = this.attributes; - for (const key in attributes) { - const attribute = attributes[key]; - data.data.attributes[key] = attribute.toJSON(data.data); - } - const morphAttributes = {}; - let hasMorphAttributes = false; - for (const key in this.morphAttributes) { - const attributeArray = this.morphAttributes[key]; - const array = []; - for (let i = 0, il = attributeArray.length; i < il; i++) { - const attribute = attributeArray[i]; - array.push(attribute.toJSON(data.data)); - } - if (array.length > 0) { - morphAttributes[key] = array; - hasMorphAttributes = true; - } - } - if (hasMorphAttributes) { - data.data.morphAttributes = morphAttributes; - data.data.morphTargetsRelative = this.morphTargetsRelative; - } - const groups = this.groups; - if (groups.length > 0) { - data.data.groups = JSON.parse(JSON.stringify(groups)); - } - const boundingSphere = this.boundingSphere; - if (boundingSphere !== null) { - data.data.boundingSphere = { - center: boundingSphere.center.toArray(), - radius: boundingSphere.radius - }; - } - return data; - } - clone() { - return new this.constructor().copy(this); - } - copy(source) { - this.index = null; - this.attributes = {}; - this.morphAttributes = {}; - this.groups = []; - this.boundingBox = null; - this.boundingSphere = null; - const data = {}; - this.name = source.name; - const index = source.index; - if (index !== null) { - this.setIndex(index.clone(data)); - } - const attributes = source.attributes; - for (const name in attributes) { - const attribute = attributes[name]; - this.setAttribute(name, attribute.clone(data)); - } - const morphAttributes = source.morphAttributes; - for (const name in morphAttributes) { - const array = []; - const morphAttribute = morphAttributes[name]; - for (let i = 0, l = morphAttribute.length; i < l; i++) { - array.push(morphAttribute[i].clone(data)); - } - this.morphAttributes[name] = array; - } - this.morphTargetsRelative = source.morphTargetsRelative; - const groups = source.groups; - for (let i = 0, l = groups.length; i < l; i++) { - const group = groups[i]; - this.addGroup(group.start, group.count, group.materialIndex); - } - const boundingBox = source.boundingBox; - if (boundingBox !== null) { - this.boundingBox = boundingBox.clone(); - } - const boundingSphere = source.boundingSphere; - if (boundingSphere !== null) { - this.boundingSphere = boundingSphere.clone(); - } - this.drawRange.start = source.drawRange.start; - this.drawRange.count = source.drawRange.count; - this.userData = source.userData; - return this; - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - } -} -const _inverseMatrix$3 = /* @__PURE__ */ new Matrix4(); -const _ray$3 = /* @__PURE__ */ new Ray(); -const _sphere$6 = /* @__PURE__ */ new Sphere(); -const _sphereHitAt = /* @__PURE__ */ new Vector3(); -const _vA$1 = /* @__PURE__ */ new Vector3(); -const _vB$1 = /* @__PURE__ */ new Vector3(); -const _vC$1 = /* @__PURE__ */ new Vector3(); -const _tempA = /* @__PURE__ */ new Vector3(); -const _morphA = /* @__PURE__ */ new Vector3(); -const _intersectionPoint = /* @__PURE__ */ new Vector3(); -const _intersectionPointWorld = /* @__PURE__ */ new Vector3(); -class Mesh extends Object3D { - static { - __name(this, "Mesh"); - } - constructor(geometry = new BufferGeometry(), material = new MeshBasicMaterial()) { - super(); - this.isMesh = true; - this.type = "Mesh"; - this.geometry = geometry; - this.material = material; - this.updateMorphTargets(); - } - copy(source, recursive) { - super.copy(source, recursive); - if (source.morphTargetInfluences !== void 0) { - this.morphTargetInfluences = source.morphTargetInfluences.slice(); - } - if (source.morphTargetDictionary !== void 0) { - this.morphTargetDictionary = Object.assign({}, source.morphTargetDictionary); - } - this.material = Array.isArray(source.material) ? source.material.slice() : source.material; - this.geometry = source.geometry; - return this; - } - updateMorphTargets() { - const geometry = this.geometry; - const morphAttributes = geometry.morphAttributes; - const keys = Object.keys(morphAttributes); - if (keys.length > 0) { - const morphAttribute = morphAttributes[keys[0]]; - if (morphAttribute !== void 0) { - this.morphTargetInfluences = []; - this.morphTargetDictionary = {}; - for (let m = 0, ml = morphAttribute.length; m < ml; m++) { - const name = morphAttribute[m].name || String(m); - this.morphTargetInfluences.push(0); - this.morphTargetDictionary[name] = m; - } - } - } - } - getVertexPosition(index, target) { - const geometry = this.geometry; - const position = geometry.attributes.position; - const morphPosition = geometry.morphAttributes.position; - const morphTargetsRelative = geometry.morphTargetsRelative; - target.fromBufferAttribute(position, index); - const morphInfluences = this.morphTargetInfluences; - if (morphPosition && morphInfluences) { - _morphA.set(0, 0, 0); - for (let i = 0, il = morphPosition.length; i < il; i++) { - const influence = morphInfluences[i]; - const morphAttribute = morphPosition[i]; - if (influence === 0) continue; - _tempA.fromBufferAttribute(morphAttribute, index); - if (morphTargetsRelative) { - _morphA.addScaledVector(_tempA, influence); - } else { - _morphA.addScaledVector(_tempA.sub(target), influence); - } - } - target.add(_morphA); - } - return target; - } - raycast(raycaster, intersects2) { - const geometry = this.geometry; - const material = this.material; - const matrixWorld = this.matrixWorld; - if (material === void 0) return; - if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); - _sphere$6.copy(geometry.boundingSphere); - _sphere$6.applyMatrix4(matrixWorld); - _ray$3.copy(raycaster.ray).recast(raycaster.near); - if (_sphere$6.containsPoint(_ray$3.origin) === false) { - if (_ray$3.intersectSphere(_sphere$6, _sphereHitAt) === null) return; - if (_ray$3.origin.distanceToSquared(_sphereHitAt) > (raycaster.far - raycaster.near) ** 2) return; - } - _inverseMatrix$3.copy(matrixWorld).invert(); - _ray$3.copy(raycaster.ray).applyMatrix4(_inverseMatrix$3); - if (geometry.boundingBox !== null) { - if (_ray$3.intersectsBox(geometry.boundingBox) === false) return; - } - this._computeIntersections(raycaster, intersects2, _ray$3); - } - _computeIntersections(raycaster, intersects2, rayLocalSpace) { - let intersection; - const geometry = this.geometry; - const material = this.material; - const index = geometry.index; - const position = geometry.attributes.position; - const uv = geometry.attributes.uv; - const uv1 = geometry.attributes.uv1; - const normal = geometry.attributes.normal; - const groups = geometry.groups; - const drawRange = geometry.drawRange; - if (index !== null) { - if (Array.isArray(material)) { - for (let i = 0, il = groups.length; i < il; i++) { - const group = groups[i]; - const groupMaterial = material[group.materialIndex]; - const start = Math.max(group.start, drawRange.start); - const end = Math.min(index.count, Math.min(group.start + group.count, drawRange.start + drawRange.count)); - for (let j = start, jl = end; j < jl; j += 3) { - const a = index.getX(j); - const b = index.getX(j + 1); - const c = index.getX(j + 2); - intersection = checkGeometryIntersection(this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c); - if (intersection) { - intersection.faceIndex = Math.floor(j / 3); - intersection.face.materialIndex = group.materialIndex; - intersects2.push(intersection); - } - } - } - } else { - const start = Math.max(0, drawRange.start); - const end = Math.min(index.count, drawRange.start + drawRange.count); - for (let i = start, il = end; i < il; i += 3) { - const a = index.getX(i); - const b = index.getX(i + 1); - const c = index.getX(i + 2); - intersection = checkGeometryIntersection(this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c); - if (intersection) { - intersection.faceIndex = Math.floor(i / 3); - intersects2.push(intersection); - } - } - } - } else if (position !== void 0) { - if (Array.isArray(material)) { - for (let i = 0, il = groups.length; i < il; i++) { - const group = groups[i]; - const groupMaterial = material[group.materialIndex]; - const start = Math.max(group.start, drawRange.start); - const end = Math.min(position.count, Math.min(group.start + group.count, drawRange.start + drawRange.count)); - for (let j = start, jl = end; j < jl; j += 3) { - const a = j; - const b = j + 1; - const c = j + 2; - intersection = checkGeometryIntersection(this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c); - if (intersection) { - intersection.faceIndex = Math.floor(j / 3); - intersection.face.materialIndex = group.materialIndex; - intersects2.push(intersection); - } - } - } - } else { - const start = Math.max(0, drawRange.start); - const end = Math.min(position.count, drawRange.start + drawRange.count); - for (let i = start, il = end; i < il; i += 3) { - const a = i; - const b = i + 1; - const c = i + 2; - intersection = checkGeometryIntersection(this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c); - if (intersection) { - intersection.faceIndex = Math.floor(i / 3); - intersects2.push(intersection); - } - } - } - } - } -} -function checkIntersection$1(object, material, raycaster, ray, pA, pB, pC, point) { - let intersect2; - if (material.side === BackSide) { - intersect2 = ray.intersectTriangle(pC, pB, pA, true, point); - } else { - intersect2 = ray.intersectTriangle(pA, pB, pC, material.side === FrontSide, point); - } - if (intersect2 === null) return null; - _intersectionPointWorld.copy(point); - _intersectionPointWorld.applyMatrix4(object.matrixWorld); - const distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld); - if (distance < raycaster.near || distance > raycaster.far) return null; - return { - distance, - point: _intersectionPointWorld.clone(), - object - }; -} -__name(checkIntersection$1, "checkIntersection$1"); -function checkGeometryIntersection(object, material, raycaster, ray, uv, uv1, normal, a, b, c) { - object.getVertexPosition(a, _vA$1); - object.getVertexPosition(b, _vB$1); - object.getVertexPosition(c, _vC$1); - const intersection = checkIntersection$1(object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint); - if (intersection) { - const barycoord = new Vector3(); - Triangle.getBarycoord(_intersectionPoint, _vA$1, _vB$1, _vC$1, barycoord); - if (uv) { - intersection.uv = Triangle.getInterpolatedAttribute(uv, a, b, c, barycoord, new Vector2()); - } - if (uv1) { - intersection.uv1 = Triangle.getInterpolatedAttribute(uv1, a, b, c, barycoord, new Vector2()); - } - if (normal) { - intersection.normal = Triangle.getInterpolatedAttribute(normal, a, b, c, barycoord, new Vector3()); - if (intersection.normal.dot(ray.direction) > 0) { - intersection.normal.multiplyScalar(-1); - } - } - const face = { - a, - b, - c, - normal: new Vector3(), - materialIndex: 0 - }; - Triangle.getNormal(_vA$1, _vB$1, _vC$1, face.normal); - intersection.face = face; - intersection.barycoord = barycoord; - } - return intersection; -} -__name(checkGeometryIntersection, "checkGeometryIntersection"); -class BoxGeometry extends BufferGeometry { - static { - __name(this, "BoxGeometry"); - } - constructor(width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1) { - super(); - this.type = "BoxGeometry"; - this.parameters = { - width, - height, - depth, - widthSegments, - heightSegments, - depthSegments - }; - const scope = this; - widthSegments = Math.floor(widthSegments); - heightSegments = Math.floor(heightSegments); - depthSegments = Math.floor(depthSegments); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - let numberOfVertices = 0; - let groupStart = 0; - buildPlane("z", "y", "x", -1, -1, depth, height, width, depthSegments, heightSegments, 0); - buildPlane("z", "y", "x", 1, -1, depth, height, -width, depthSegments, heightSegments, 1); - buildPlane("x", "z", "y", 1, 1, width, depth, height, widthSegments, depthSegments, 2); - buildPlane("x", "z", "y", 1, -1, width, depth, -height, widthSegments, depthSegments, 3); - buildPlane("x", "y", "z", 1, -1, width, height, depth, widthSegments, heightSegments, 4); - buildPlane("x", "y", "z", -1, -1, width, height, -depth, widthSegments, heightSegments, 5); - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - function buildPlane(u, v, w, udir, vdir, width2, height2, depth2, gridX, gridY, materialIndex) { - const segmentWidth = width2 / gridX; - const segmentHeight = height2 / gridY; - const widthHalf = width2 / 2; - const heightHalf = height2 / 2; - const depthHalf = depth2 / 2; - const gridX1 = gridX + 1; - const gridY1 = gridY + 1; - let vertexCounter = 0; - let groupCount = 0; - const vector = new Vector3(); - for (let iy = 0; iy < gridY1; iy++) { - const y = iy * segmentHeight - heightHalf; - for (let ix = 0; ix < gridX1; ix++) { - const x = ix * segmentWidth - widthHalf; - vector[u] = x * udir; - vector[v] = y * vdir; - vector[w] = depthHalf; - vertices.push(vector.x, vector.y, vector.z); - vector[u] = 0; - vector[v] = 0; - vector[w] = depth2 > 0 ? 1 : -1; - normals.push(vector.x, vector.y, vector.z); - uvs.push(ix / gridX); - uvs.push(1 - iy / gridY); - vertexCounter += 1; - } - } - for (let iy = 0; iy < gridY; iy++) { - for (let ix = 0; ix < gridX; ix++) { - const a = numberOfVertices + ix + gridX1 * iy; - const b = numberOfVertices + ix + gridX1 * (iy + 1); - const c = numberOfVertices + (ix + 1) + gridX1 * (iy + 1); - const d = numberOfVertices + (ix + 1) + gridX1 * iy; - indices.push(a, b, d); - indices.push(b, c, d); - groupCount += 6; - } - } - scope.addGroup(groupStart, groupCount, materialIndex); - groupStart += groupCount; - numberOfVertices += vertexCounter; - } - __name(buildPlane, "buildPlane"); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new BoxGeometry(data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments); - } -} -function cloneUniforms(src) { - const dst = {}; - for (const u in src) { - dst[u] = {}; - for (const p in src[u]) { - const property = src[u][p]; - if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) { - if (property.isRenderTargetTexture) { - console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."); - dst[u][p] = null; - } else { - dst[u][p] = property.clone(); - } - } else if (Array.isArray(property)) { - dst[u][p] = property.slice(); - } else { - dst[u][p] = property; - } - } - } - return dst; -} -__name(cloneUniforms, "cloneUniforms"); -function mergeUniforms(uniforms) { - const merged = {}; - for (let u = 0; u < uniforms.length; u++) { - const tmp2 = cloneUniforms(uniforms[u]); - for (const p in tmp2) { - merged[p] = tmp2[p]; - } - } - return merged; -} -__name(mergeUniforms, "mergeUniforms"); -function cloneUniformsGroups(src) { - const dst = []; - for (let u = 0; u < src.length; u++) { - dst.push(src[u].clone()); - } - return dst; -} -__name(cloneUniformsGroups, "cloneUniformsGroups"); -function getUnlitUniformColorSpace(renderer) { - const currentRenderTarget = renderer.getRenderTarget(); - if (currentRenderTarget === null) { - return renderer.outputColorSpace; - } - if (currentRenderTarget.isXRRenderTarget === true) { - return currentRenderTarget.texture.colorSpace; - } - return ColorManagement.workingColorSpace; -} -__name(getUnlitUniformColorSpace, "getUnlitUniformColorSpace"); -const UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms }; -var default_vertex = "void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"; -var default_fragment = "void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}"; -class ShaderMaterial extends Material { - static { - __name(this, "ShaderMaterial"); - } - static get type() { - return "ShaderMaterial"; - } - constructor(parameters) { - super(); - this.isShaderMaterial = true; - this.defines = {}; - this.uniforms = {}; - this.uniformsGroups = []; - this.vertexShader = default_vertex; - this.fragmentShader = default_fragment; - this.linewidth = 1; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.fog = false; - this.lights = false; - this.clipping = false; - this.forceSinglePass = true; - this.extensions = { - clipCullDistance: false, - // set to use vertex shader clipping - multiDraw: false - // set to use vertex shader multi_draw / enable gl_DrawID - }; - this.defaultAttributeValues = { - "color": [1, 1, 1], - "uv": [0, 0], - "uv1": [0, 0] - }; - this.index0AttributeName = void 0; - this.uniformsNeedUpdate = false; - this.glslVersion = null; - if (parameters !== void 0) { - this.setValues(parameters); - } - } - copy(source) { - super.copy(source); - this.fragmentShader = source.fragmentShader; - this.vertexShader = source.vertexShader; - this.uniforms = cloneUniforms(source.uniforms); - this.uniformsGroups = cloneUniformsGroups(source.uniformsGroups); - this.defines = Object.assign({}, source.defines); - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.fog = source.fog; - this.lights = source.lights; - this.clipping = source.clipping; - this.extensions = Object.assign({}, source.extensions); - this.glslVersion = source.glslVersion; - return this; - } - toJSON(meta) { - const data = super.toJSON(meta); - data.glslVersion = this.glslVersion; - data.uniforms = {}; - for (const name in this.uniforms) { - const uniform = this.uniforms[name]; - const value = uniform.value; - if (value && value.isTexture) { - data.uniforms[name] = { - type: "t", - value: value.toJSON(meta).uuid - }; - } else if (value && value.isColor) { - data.uniforms[name] = { - type: "c", - value: value.getHex() - }; - } else if (value && value.isVector2) { - data.uniforms[name] = { - type: "v2", - value: value.toArray() - }; - } else if (value && value.isVector3) { - data.uniforms[name] = { - type: "v3", - value: value.toArray() - }; - } else if (value && value.isVector4) { - data.uniforms[name] = { - type: "v4", - value: value.toArray() - }; - } else if (value && value.isMatrix3) { - data.uniforms[name] = { - type: "m3", - value: value.toArray() - }; - } else if (value && value.isMatrix4) { - data.uniforms[name] = { - type: "m4", - value: value.toArray() - }; - } else { - data.uniforms[name] = { - value - }; - } - } - if (Object.keys(this.defines).length > 0) data.defines = this.defines; - data.vertexShader = this.vertexShader; - data.fragmentShader = this.fragmentShader; - data.lights = this.lights; - data.clipping = this.clipping; - const extensions = {}; - for (const key in this.extensions) { - if (this.extensions[key] === true) extensions[key] = true; - } - if (Object.keys(extensions).length > 0) data.extensions = extensions; - return data; - } -} -class Camera extends Object3D { - static { - __name(this, "Camera"); - } - constructor() { - super(); - this.isCamera = true; - this.type = "Camera"; - this.matrixWorldInverse = new Matrix4(); - this.projectionMatrix = new Matrix4(); - this.projectionMatrixInverse = new Matrix4(); - this.coordinateSystem = WebGLCoordinateSystem; - } - copy(source, recursive) { - super.copy(source, recursive); - this.matrixWorldInverse.copy(source.matrixWorldInverse); - this.projectionMatrix.copy(source.projectionMatrix); - this.projectionMatrixInverse.copy(source.projectionMatrixInverse); - this.coordinateSystem = source.coordinateSystem; - return this; - } - getWorldDirection(target) { - return super.getWorldDirection(target).negate(); - } - updateMatrixWorld(force) { - super.updateMatrixWorld(force); - this.matrixWorldInverse.copy(this.matrixWorld).invert(); - } - updateWorldMatrix(updateParents, updateChildren) { - super.updateWorldMatrix(updateParents, updateChildren); - this.matrixWorldInverse.copy(this.matrixWorld).invert(); - } - clone() { - return new this.constructor().copy(this); - } -} -const _v3$1 = /* @__PURE__ */ new Vector3(); -const _minTarget = /* @__PURE__ */ new Vector2(); -const _maxTarget = /* @__PURE__ */ new Vector2(); -class PerspectiveCamera extends Camera { - static { - __name(this, "PerspectiveCamera"); - } - constructor(fov2 = 50, aspect2 = 1, near = 0.1, far = 2e3) { - super(); - this.isPerspectiveCamera = true; - this.type = "PerspectiveCamera"; - this.fov = fov2; - this.zoom = 1; - this.near = near; - this.far = far; - this.focus = 10; - this.aspect = aspect2; - this.view = null; - this.filmGauge = 35; - this.filmOffset = 0; - this.updateProjectionMatrix(); - } - copy(source, recursive) { - super.copy(source, recursive); - this.fov = source.fov; - this.zoom = source.zoom; - this.near = source.near; - this.far = source.far; - this.focus = source.focus; - this.aspect = source.aspect; - this.view = source.view === null ? null : Object.assign({}, source.view); - this.filmGauge = source.filmGauge; - this.filmOffset = source.filmOffset; - return this; - } - /** - * Sets the FOV by focal length in respect to the current .filmGauge. - * - * The default film gauge is 35, so that the focal length can be specified for - * a 35mm (full frame) camera. - * - * Values for focal length and film gauge must have the same unit. - */ - setFocalLength(focalLength) { - const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; - this.fov = RAD2DEG * 2 * Math.atan(vExtentSlope); - this.updateProjectionMatrix(); - } - /** - * Calculates the focal length from the current .fov and .filmGauge. - */ - getFocalLength() { - const vExtentSlope = Math.tan(DEG2RAD * 0.5 * this.fov); - return 0.5 * this.getFilmHeight() / vExtentSlope; - } - getEffectiveFOV() { - return RAD2DEG * 2 * Math.atan( - Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom - ); - } - getFilmWidth() { - return this.filmGauge * Math.min(this.aspect, 1); - } - getFilmHeight() { - return this.filmGauge / Math.max(this.aspect, 1); - } - /** - * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction. - * Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle. - */ - getViewBounds(distance, minTarget, maxTarget) { - _v3$1.set(-1, -1, 0.5).applyMatrix4(this.projectionMatrixInverse); - minTarget.set(_v3$1.x, _v3$1.y).multiplyScalar(-distance / _v3$1.z); - _v3$1.set(1, 1, 0.5).applyMatrix4(this.projectionMatrixInverse); - maxTarget.set(_v3$1.x, _v3$1.y).multiplyScalar(-distance / _v3$1.z); - } - /** - * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction. - * Copies the result into the target Vector2, where x is width and y is height. - */ - getViewSize(distance, target) { - this.getViewBounds(distance, _minTarget, _maxTarget); - return target.subVectors(_maxTarget, _minTarget); - } - /** - * Sets an offset in a larger frustum. This is useful for multi-window or - * multi-monitor/multi-machine setups. - * - * For example, if you have 3x2 monitors and each monitor is 1920x1080 and - * the monitors are in grid like this - * - * +---+---+---+ - * | A | B | C | - * +---+---+---+ - * | D | E | F | - * +---+---+---+ - * - * then for each monitor you would call it like this - * - * const w = 1920; - * const h = 1080; - * const fullWidth = w * 3; - * const fullHeight = h * 2; - * - * --A-- - * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); - * --B-- - * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); - * --C-- - * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); - * --D-- - * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); - * --E-- - * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); - * --F-- - * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); - * - * Note there is no reason monitors have to be the same size or in a grid. - */ - setViewOffset(fullWidth, fullHeight, x, y, width, height) { - this.aspect = fullWidth / fullHeight; - if (this.view === null) { - this.view = { - enabled: true, - fullWidth: 1, - fullHeight: 1, - offsetX: 0, - offsetY: 0, - width: 1, - height: 1 - }; - } - this.view.enabled = true; - this.view.fullWidth = fullWidth; - this.view.fullHeight = fullHeight; - this.view.offsetX = x; - this.view.offsetY = y; - this.view.width = width; - this.view.height = height; - this.updateProjectionMatrix(); - } - clearViewOffset() { - if (this.view !== null) { - this.view.enabled = false; - } - this.updateProjectionMatrix(); - } - updateProjectionMatrix() { - const near = this.near; - let top = near * Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom; - let height = 2 * top; - let width = this.aspect * height; - let left = -0.5 * width; - const view = this.view; - if (this.view !== null && this.view.enabled) { - const fullWidth = view.fullWidth, fullHeight = view.fullHeight; - left += view.offsetX * width / fullWidth; - top -= view.offsetY * height / fullHeight; - width *= view.width / fullWidth; - height *= view.height / fullHeight; - } - const skew = this.filmOffset; - if (skew !== 0) left += near * skew / this.getFilmWidth(); - this.projectionMatrix.makePerspective(left, left + width, top, top - height, near, this.far, this.coordinateSystem); - this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); - } - toJSON(meta) { - const data = super.toJSON(meta); - data.object.fov = this.fov; - data.object.zoom = this.zoom; - data.object.near = this.near; - data.object.far = this.far; - data.object.focus = this.focus; - data.object.aspect = this.aspect; - if (this.view !== null) data.object.view = Object.assign({}, this.view); - data.object.filmGauge = this.filmGauge; - data.object.filmOffset = this.filmOffset; - return data; - } -} -const fov = -90; -const aspect = 1; -class CubeCamera extends Object3D { - static { - __name(this, "CubeCamera"); - } - constructor(near, far, renderTarget) { - super(); - this.type = "CubeCamera"; - this.renderTarget = renderTarget; - this.coordinateSystem = null; - this.activeMipmapLevel = 0; - const cameraPX = new PerspectiveCamera(fov, aspect, near, far); - cameraPX.layers = this.layers; - this.add(cameraPX); - const cameraNX = new PerspectiveCamera(fov, aspect, near, far); - cameraNX.layers = this.layers; - this.add(cameraNX); - const cameraPY = new PerspectiveCamera(fov, aspect, near, far); - cameraPY.layers = this.layers; - this.add(cameraPY); - const cameraNY = new PerspectiveCamera(fov, aspect, near, far); - cameraNY.layers = this.layers; - this.add(cameraNY); - const cameraPZ = new PerspectiveCamera(fov, aspect, near, far); - cameraPZ.layers = this.layers; - this.add(cameraPZ); - const cameraNZ = new PerspectiveCamera(fov, aspect, near, far); - cameraNZ.layers = this.layers; - this.add(cameraNZ); - } - updateCoordinateSystem() { - const coordinateSystem = this.coordinateSystem; - const cameras = this.children.concat(); - const [cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ] = cameras; - for (const camera of cameras) this.remove(camera); - if (coordinateSystem === WebGLCoordinateSystem) { - cameraPX.up.set(0, 1, 0); - cameraPX.lookAt(1, 0, 0); - cameraNX.up.set(0, 1, 0); - cameraNX.lookAt(-1, 0, 0); - cameraPY.up.set(0, 0, -1); - cameraPY.lookAt(0, 1, 0); - cameraNY.up.set(0, 0, 1); - cameraNY.lookAt(0, -1, 0); - cameraPZ.up.set(0, 1, 0); - cameraPZ.lookAt(0, 0, 1); - cameraNZ.up.set(0, 1, 0); - cameraNZ.lookAt(0, 0, -1); - } else if (coordinateSystem === WebGPUCoordinateSystem) { - cameraPX.up.set(0, -1, 0); - cameraPX.lookAt(-1, 0, 0); - cameraNX.up.set(0, -1, 0); - cameraNX.lookAt(1, 0, 0); - cameraPY.up.set(0, 0, 1); - cameraPY.lookAt(0, 1, 0); - cameraNY.up.set(0, 0, -1); - cameraNY.lookAt(0, -1, 0); - cameraPZ.up.set(0, -1, 0); - cameraPZ.lookAt(0, 0, 1); - cameraNZ.up.set(0, -1, 0); - cameraNZ.lookAt(0, 0, -1); - } else { - throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: " + coordinateSystem); - } - for (const camera of cameras) { - this.add(camera); - camera.updateMatrixWorld(); - } - } - update(renderer, scene) { - if (this.parent === null) this.updateMatrixWorld(); - const { renderTarget, activeMipmapLevel } = this; - if (this.coordinateSystem !== renderer.coordinateSystem) { - this.coordinateSystem = renderer.coordinateSystem; - this.updateCoordinateSystem(); - } - const [cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ] = this.children; - const currentRenderTarget = renderer.getRenderTarget(); - const currentActiveCubeFace = renderer.getActiveCubeFace(); - const currentActiveMipmapLevel = renderer.getActiveMipmapLevel(); - const currentXrEnabled = renderer.xr.enabled; - renderer.xr.enabled = false; - const generateMipmaps = renderTarget.texture.generateMipmaps; - renderTarget.texture.generateMipmaps = false; - renderer.setRenderTarget(renderTarget, 0, activeMipmapLevel); - renderer.render(scene, cameraPX); - renderer.setRenderTarget(renderTarget, 1, activeMipmapLevel); - renderer.render(scene, cameraNX); - renderer.setRenderTarget(renderTarget, 2, activeMipmapLevel); - renderer.render(scene, cameraPY); - renderer.setRenderTarget(renderTarget, 3, activeMipmapLevel); - renderer.render(scene, cameraNY); - renderer.setRenderTarget(renderTarget, 4, activeMipmapLevel); - renderer.render(scene, cameraPZ); - renderTarget.texture.generateMipmaps = generateMipmaps; - renderer.setRenderTarget(renderTarget, 5, activeMipmapLevel); - renderer.render(scene, cameraNZ); - renderer.setRenderTarget(currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel); - renderer.xr.enabled = currentXrEnabled; - renderTarget.texture.needsPMREMUpdate = true; - } -} -class CubeTexture extends Texture { - static { - __name(this, "CubeTexture"); - } - constructor(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace) { - images = images !== void 0 ? images : []; - mapping = mapping !== void 0 ? mapping : CubeReflectionMapping; - super(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace); - this.isCubeTexture = true; - this.flipY = false; - } - get images() { - return this.image; - } - set images(value) { - this.image = value; - } -} -class WebGLCubeRenderTarget extends WebGLRenderTarget { - static { - __name(this, "WebGLCubeRenderTarget"); - } - constructor(size = 1, options = {}) { - super(size, size, options); - this.isWebGLCubeRenderTarget = true; - const image = { width: size, height: size, depth: 1 }; - const images = [image, image, image, image, image, image]; - this.texture = new CubeTexture(images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace); - this.texture.isRenderTargetTexture = true; - this.texture.generateMipmaps = options.generateMipmaps !== void 0 ? options.generateMipmaps : false; - this.texture.minFilter = options.minFilter !== void 0 ? options.minFilter : LinearFilter; - } - fromEquirectangularTexture(renderer, texture) { - this.texture.type = texture.type; - this.texture.colorSpace = texture.colorSpace; - this.texture.generateMipmaps = texture.generateMipmaps; - this.texture.minFilter = texture.minFilter; - this.texture.magFilter = texture.magFilter; - const shader = { - uniforms: { - tEquirect: { value: null } - }, - vertexShader: ( - /* glsl */ - ` - - varying vec3 vWorldDirection; - - vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); - - } - - void main() { - - vWorldDirection = transformDirection( position, modelMatrix ); - - #include - #include - - } - ` - ), - fragmentShader: ( - /* glsl */ - ` - - uniform sampler2D tEquirect; - - varying vec3 vWorldDirection; - - #include - - void main() { - - vec3 direction = normalize( vWorldDirection ); - - vec2 sampleUV = equirectUv( direction ); - - gl_FragColor = texture2D( tEquirect, sampleUV ); - - } - ` - ) - }; - const geometry = new BoxGeometry(5, 5, 5); - const material = new ShaderMaterial({ - name: "CubemapFromEquirect", - uniforms: cloneUniforms(shader.uniforms), - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader, - side: BackSide, - blending: NoBlending - }); - material.uniforms.tEquirect.value = texture; - const mesh = new Mesh(geometry, material); - const currentMinFilter = texture.minFilter; - if (texture.minFilter === LinearMipmapLinearFilter) texture.minFilter = LinearFilter; - const camera = new CubeCamera(1, 10, this); - camera.update(renderer, mesh); - texture.minFilter = currentMinFilter; - mesh.geometry.dispose(); - mesh.material.dispose(); - return this; - } - clear(renderer, color, depth, stencil) { - const currentRenderTarget = renderer.getRenderTarget(); - for (let i = 0; i < 6; i++) { - renderer.setRenderTarget(this, i); - renderer.clear(color, depth, stencil); - } - renderer.setRenderTarget(currentRenderTarget); - } -} -const _vector1 = /* @__PURE__ */ new Vector3(); -const _vector2 = /* @__PURE__ */ new Vector3(); -const _normalMatrix = /* @__PURE__ */ new Matrix3(); -class Plane { - static { - __name(this, "Plane"); - } - constructor(normal = new Vector3(1, 0, 0), constant = 0) { - this.isPlane = true; - this.normal = normal; - this.constant = constant; - } - set(normal, constant) { - this.normal.copy(normal); - this.constant = constant; - return this; - } - setComponents(x, y, z, w) { - this.normal.set(x, y, z); - this.constant = w; - return this; - } - setFromNormalAndCoplanarPoint(normal, point) { - this.normal.copy(normal); - this.constant = -point.dot(this.normal); - return this; - } - setFromCoplanarPoints(a, b, c) { - const normal = _vector1.subVectors(c, b).cross(_vector2.subVectors(a, b)).normalize(); - this.setFromNormalAndCoplanarPoint(normal, a); - return this; - } - copy(plane) { - this.normal.copy(plane.normal); - this.constant = plane.constant; - return this; - } - normalize() { - const inverseNormalLength = 1 / this.normal.length(); - this.normal.multiplyScalar(inverseNormalLength); - this.constant *= inverseNormalLength; - return this; - } - negate() { - this.constant *= -1; - this.normal.negate(); - return this; - } - distanceToPoint(point) { - return this.normal.dot(point) + this.constant; - } - distanceToSphere(sphere) { - return this.distanceToPoint(sphere.center) - sphere.radius; - } - projectPoint(point, target) { - return target.copy(point).addScaledVector(this.normal, -this.distanceToPoint(point)); - } - intersectLine(line, target) { - const direction = line.delta(_vector1); - const denominator = this.normal.dot(direction); - if (denominator === 0) { - if (this.distanceToPoint(line.start) === 0) { - return target.copy(line.start); - } - return null; - } - const t2 = -(line.start.dot(this.normal) + this.constant) / denominator; - if (t2 < 0 || t2 > 1) { - return null; - } - return target.copy(line.start).addScaledVector(direction, t2); - } - intersectsLine(line) { - const startSign = this.distanceToPoint(line.start); - const endSign = this.distanceToPoint(line.end); - return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0; - } - intersectsBox(box) { - return box.intersectsPlane(this); - } - intersectsSphere(sphere) { - return sphere.intersectsPlane(this); - } - coplanarPoint(target) { - return target.copy(this.normal).multiplyScalar(-this.constant); - } - applyMatrix4(matrix, optionalNormalMatrix) { - const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix); - const referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix); - const normal = this.normal.applyMatrix3(normalMatrix).normalize(); - this.constant = -referencePoint.dot(normal); - return this; - } - translate(offset) { - this.constant -= offset.dot(this.normal); - return this; - } - equals(plane) { - return plane.normal.equals(this.normal) && plane.constant === this.constant; - } - clone() { - return new this.constructor().copy(this); - } -} -const _sphere$5 = /* @__PURE__ */ new Sphere(); -const _vector$7 = /* @__PURE__ */ new Vector3(); -class Frustum { - static { - __name(this, "Frustum"); - } - constructor(p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane()) { - this.planes = [p0, p1, p2, p3, p4, p5]; - } - set(p0, p1, p2, p3, p4, p5) { - const planes = this.planes; - planes[0].copy(p0); - planes[1].copy(p1); - planes[2].copy(p2); - planes[3].copy(p3); - planes[4].copy(p4); - planes[5].copy(p5); - return this; - } - copy(frustum) { - const planes = this.planes; - for (let i = 0; i < 6; i++) { - planes[i].copy(frustum.planes[i]); - } - return this; - } - setFromProjectionMatrix(m, coordinateSystem = WebGLCoordinateSystem) { - const planes = this.planes; - const me = m.elements; - const me0 = me[0], me1 = me[1], me2 = me[2], me3 = me[3]; - const me4 = me[4], me5 = me[5], me6 = me[6], me7 = me[7]; - const me8 = me[8], me9 = me[9], me10 = me[10], me11 = me[11]; - const me12 = me[12], me13 = me[13], me14 = me[14], me15 = me[15]; - planes[0].setComponents(me3 - me0, me7 - me4, me11 - me8, me15 - me12).normalize(); - planes[1].setComponents(me3 + me0, me7 + me4, me11 + me8, me15 + me12).normalize(); - planes[2].setComponents(me3 + me1, me7 + me5, me11 + me9, me15 + me13).normalize(); - planes[3].setComponents(me3 - me1, me7 - me5, me11 - me9, me15 - me13).normalize(); - planes[4].setComponents(me3 - me2, me7 - me6, me11 - me10, me15 - me14).normalize(); - if (coordinateSystem === WebGLCoordinateSystem) { - planes[5].setComponents(me3 + me2, me7 + me6, me11 + me10, me15 + me14).normalize(); - } else if (coordinateSystem === WebGPUCoordinateSystem) { - planes[5].setComponents(me2, me6, me10, me14).normalize(); - } else { - throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: " + coordinateSystem); - } - return this; - } - intersectsObject(object) { - if (object.boundingSphere !== void 0) { - if (object.boundingSphere === null) object.computeBoundingSphere(); - _sphere$5.copy(object.boundingSphere).applyMatrix4(object.matrixWorld); - } else { - const geometry = object.geometry; - if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); - _sphere$5.copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld); - } - return this.intersectsSphere(_sphere$5); - } - intersectsSprite(sprite) { - _sphere$5.center.set(0, 0, 0); - _sphere$5.radius = 0.7071067811865476; - _sphere$5.applyMatrix4(sprite.matrixWorld); - return this.intersectsSphere(_sphere$5); - } - intersectsSphere(sphere) { - const planes = this.planes; - const center = sphere.center; - const negRadius = -sphere.radius; - for (let i = 0; i < 6; i++) { - const distance = planes[i].distanceToPoint(center); - if (distance < negRadius) { - return false; - } - } - return true; - } - intersectsBox(box) { - const planes = this.planes; - for (let i = 0; i < 6; i++) { - const plane = planes[i]; - _vector$7.x = plane.normal.x > 0 ? box.max.x : box.min.x; - _vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y; - _vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z; - if (plane.distanceToPoint(_vector$7) < 0) { - return false; - } - } - return true; - } - containsPoint(point) { - const planes = this.planes; - for (let i = 0; i < 6; i++) { - if (planes[i].distanceToPoint(point) < 0) { - return false; - } - } - return true; - } - clone() { - return new this.constructor().copy(this); - } -} -function WebGLAnimation() { - let context = null; - let isAnimating = false; - let animationLoop = null; - let requestId = null; - function onAnimationFrame(time, frame) { - animationLoop(time, frame); - requestId = context.requestAnimationFrame(onAnimationFrame); - } - __name(onAnimationFrame, "onAnimationFrame"); - return { - start: /* @__PURE__ */ __name(function() { - if (isAnimating === true) return; - if (animationLoop === null) return; - requestId = context.requestAnimationFrame(onAnimationFrame); - isAnimating = true; - }, "start"), - stop: /* @__PURE__ */ __name(function() { - context.cancelAnimationFrame(requestId); - isAnimating = false; - }, "stop"), - setAnimationLoop: /* @__PURE__ */ __name(function(callback) { - animationLoop = callback; - }, "setAnimationLoop"), - setContext: /* @__PURE__ */ __name(function(value) { - context = value; - }, "setContext") - }; -} -__name(WebGLAnimation, "WebGLAnimation"); -function WebGLAttributes(gl) { - const buffers = /* @__PURE__ */ new WeakMap(); - function createBuffer(attribute, bufferType) { - const array = attribute.array; - const usage = attribute.usage; - const size = array.byteLength; - const buffer = gl.createBuffer(); - gl.bindBuffer(bufferType, buffer); - gl.bufferData(bufferType, array, usage); - attribute.onUploadCallback(); - let type; - if (array instanceof Float32Array) { - type = gl.FLOAT; - } else if (array instanceof Uint16Array) { - if (attribute.isFloat16BufferAttribute) { - type = gl.HALF_FLOAT; - } else { - type = gl.UNSIGNED_SHORT; - } - } else if (array instanceof Int16Array) { - type = gl.SHORT; - } else if (array instanceof Uint32Array) { - type = gl.UNSIGNED_INT; - } else if (array instanceof Int32Array) { - type = gl.INT; - } else if (array instanceof Int8Array) { - type = gl.BYTE; - } else if (array instanceof Uint8Array) { - type = gl.UNSIGNED_BYTE; - } else if (array instanceof Uint8ClampedArray) { - type = gl.UNSIGNED_BYTE; - } else { - throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: " + array); - } - return { - buffer, - type, - bytesPerElement: array.BYTES_PER_ELEMENT, - version: attribute.version, - size - }; - } - __name(createBuffer, "createBuffer"); - function updateBuffer(buffer, attribute, bufferType) { - const array = attribute.array; - const updateRanges = attribute.updateRanges; - gl.bindBuffer(bufferType, buffer); - if (updateRanges.length === 0) { - gl.bufferSubData(bufferType, 0, array); - } else { - updateRanges.sort((a, b) => a.start - b.start); - let mergeIndex = 0; - for (let i = 1; i < updateRanges.length; i++) { - const previousRange = updateRanges[mergeIndex]; - const range = updateRanges[i]; - if (range.start <= previousRange.start + previousRange.count + 1) { - previousRange.count = Math.max( - previousRange.count, - range.start + range.count - previousRange.start - ); - } else { - ++mergeIndex; - updateRanges[mergeIndex] = range; - } - } - updateRanges.length = mergeIndex + 1; - for (let i = 0, l = updateRanges.length; i < l; i++) { - const range = updateRanges[i]; - gl.bufferSubData( - bufferType, - range.start * array.BYTES_PER_ELEMENT, - array, - range.start, - range.count - ); - } - attribute.clearUpdateRanges(); - } - attribute.onUploadCallback(); - } - __name(updateBuffer, "updateBuffer"); - function get(attribute) { - if (attribute.isInterleavedBufferAttribute) attribute = attribute.data; - return buffers.get(attribute); - } - __name(get, "get"); - function remove(attribute) { - if (attribute.isInterleavedBufferAttribute) attribute = attribute.data; - const data = buffers.get(attribute); - if (data) { - gl.deleteBuffer(data.buffer); - buffers.delete(attribute); - } - } - __name(remove, "remove"); - function update(attribute, bufferType) { - if (attribute.isInterleavedBufferAttribute) attribute = attribute.data; - if (attribute.isGLBufferAttribute) { - const cached = buffers.get(attribute); - if (!cached || cached.version < attribute.version) { - buffers.set(attribute, { - buffer: attribute.buffer, - type: attribute.type, - bytesPerElement: attribute.elementSize, - version: attribute.version - }); - } - return; - } - const data = buffers.get(attribute); - if (data === void 0) { - buffers.set(attribute, createBuffer(attribute, bufferType)); - } else if (data.version < attribute.version) { - if (data.size !== attribute.array.byteLength) { - throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported."); - } - updateBuffer(data.buffer, attribute, bufferType); - data.version = attribute.version; - } - } - __name(update, "update"); - return { - get, - remove, - update - }; -} -__name(WebGLAttributes, "WebGLAttributes"); -class PlaneGeometry extends BufferGeometry { - static { - __name(this, "PlaneGeometry"); - } - constructor(width = 1, height = 1, widthSegments = 1, heightSegments = 1) { - super(); - this.type = "PlaneGeometry"; - this.parameters = { - width, - height, - widthSegments, - heightSegments - }; - const width_half = width / 2; - const height_half = height / 2; - const gridX = Math.floor(widthSegments); - const gridY = Math.floor(heightSegments); - const gridX1 = gridX + 1; - const gridY1 = gridY + 1; - const segment_width = width / gridX; - const segment_height = height / gridY; - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - for (let iy = 0; iy < gridY1; iy++) { - const y = iy * segment_height - height_half; - for (let ix = 0; ix < gridX1; ix++) { - const x = ix * segment_width - width_half; - vertices.push(x, -y, 0); - normals.push(0, 0, 1); - uvs.push(ix / gridX); - uvs.push(1 - iy / gridY); - } - } - for (let iy = 0; iy < gridY; iy++) { - for (let ix = 0; ix < gridX; ix++) { - const a = ix + gridX1 * iy; - const b = ix + gridX1 * (iy + 1); - const c = ix + 1 + gridX1 * (iy + 1); - const d = ix + 1 + gridX1 * iy; - indices.push(a, b, d); - indices.push(b, c, d); - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new PlaneGeometry(data.width, data.height, data.widthSegments, data.heightSegments); - } -} -var alphahash_fragment = "#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif"; -var alphahash_pars_fragment = "#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif"; -var alphamap_fragment = "#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif"; -var alphamap_pars_fragment = "#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif"; -var alphatest_fragment = "#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif"; -var alphatest_pars_fragment = "#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif"; -var aomap_fragment = "#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif"; -var aomap_pars_fragment = "#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif"; -var batching_pars_vertex = "#ifdef USE_BATCHING\n #if ! defined( GL_ANGLE_multi_draw )\n #define gl_DrawID _gl_DrawID\n uniform int _gl_DrawID;\n #endif\n uniform highp sampler2D batchingTexture;\n uniform highp usampler2D batchingIdTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n float getIndirectIndex( const in int i ) {\n int size = textureSize( batchingIdTexture, 0 ).x;\n int x = i % size;\n int y = i / size;\n return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec3 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n }\n#endif"; -var batching_vertex = "#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif"; -var begin_vertex = "vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif"; -var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif"; -var bsdfs = "float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated"; -var iridescence_fragment = "#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif"; -var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif"; -var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif"; -var clipping_planes_pars_fragment = "#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif"; -var clipping_planes_pars_vertex = "#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif"; -var clipping_planes_vertex = "#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif"; -var color_fragment = "#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif"; -var color_pars_fragment = "#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif"; -var color_pars_vertex = "#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif"; -var color_vertex = "#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.xyz;\n#endif"; -var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated"; -var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif"; -var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif"; -var displacementmap_pars_vertex = "#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif"; -var displacementmap_vertex = "#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif"; -var emissivemap_fragment = "#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif"; -var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif"; -var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );"; -var colorspace_pars_fragment = "vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}"; -var envmap_fragment = "#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif"; -var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif"; -var envmap_pars_fragment = "#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif"; -var envmap_pars_vertex = "#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif"; -var envmap_vertex = "#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif"; -var fog_vertex = "#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif"; -var fog_pars_vertex = "#ifdef USE_FOG\n varying float vFogDepth;\n#endif"; -var fog_fragment = "#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif"; -var fog_pars_fragment = "#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif"; -var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}"; -var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif"; -var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;"; -var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert"; -var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif"; -var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif"; -var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;"; -var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon"; -var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;"; -var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong"; -var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif"; -var lights_physical_pars_fragment = "struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}"; -var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif"; -var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif"; -var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif"; -var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif"; -var logdepthbuf_pars_fragment = "#if defined( USE_LOGDEPTHBUF )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif"; -var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif"; -var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif"; -var map_fragment = "#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif"; -var map_pars_fragment = "#ifdef USE_MAP\n uniform sampler2D map;\n#endif"; -var map_particle_fragment = "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif"; -var map_particle_pars_fragment = "#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif"; -var metalnessmap_fragment = "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif"; -var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif"; -var morphinstance_vertex = "#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif"; -var morphcolor_vertex = "#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif"; -var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif"; -var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif"; -var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif"; -var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;"; -var normal_fragment_maps = "#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif"; -var normal_pars_fragment = "#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif"; -var normal_pars_vertex = "#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif"; -var normal_vertex = "#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif"; -var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif"; -var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif"; -var clearcoat_normal_fragment_maps = "#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif"; -var clearcoat_pars_fragment = "#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif"; -var iridescence_pars_fragment = "#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif"; -var opaque_fragment = "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );"; -var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}"; -var premultiplied_alpha_fragment = "#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif"; -var project_vertex = "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;"; -var dithering_fragment = "#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif"; -var dithering_pars_fragment = "#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif"; -var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif"; -var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif"; -var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n \n float lightToPositionLength = length( lightToPosition );\n if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n shadow = (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n#endif"; -var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif"; -var shadowmap_vertex = "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif"; -var shadowmask_pars_fragment = "float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}"; -var skinbase_vertex = "#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif"; -var skinning_pars_vertex = "#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif"; -var skinning_vertex = "#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif"; -var skinnormal_vertex = "#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif"; -var specularmap_fragment = "float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif"; -var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif"; -var tonemapping_fragment = "#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif"; -var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }"; -var transmission_fragment = "#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif"; -var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n \n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n \n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n \n #else\n \n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n \n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif"; -var uv_pars_fragment = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif"; -var uv_pars_vertex = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif"; -var uv_vertex = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif"; -var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif"; -const vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}"; -const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}"; -const vertex$g = "varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}"; -const fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}"; -const vertex$f = "varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}"; -const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include \n #include \n}"; -const vertex$e = "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vHighPrecisionZW = gl_Position.zw;\n}"; -const fragment$e = "#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #include \n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}"; -const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition.xyz;\n}"; -const fragment$d = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #include \n #include \n #include \n #include \n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}"; -const vertex$c = "varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n}"; -const fragment$c = "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include \n #include \n}"; -const vertex$b = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vLineDistance = scale * lineDistance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}"; -const fragment$b = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}"; -const vertex$a = "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include \n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}"; -const fragment$a = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}"; -const vertex$9 = "#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}"; -const fragment$9 = "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}"; -const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n}"; -const fragment$8 = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include \n #include \n #include \n #include \n #include \n #include \n}"; -const vertex$7 = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}"; -const fragment$7 = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include \n #include \n #include \n #include \n gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}"; -const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}"; -const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}"; -const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}"; -const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include \n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n}"; -const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n}"; -const fragment$4 = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n}"; -const vertex$3 = "uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include \n #include \n #include \n #include \n}"; -const fragment$3 = "uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}"; -const vertex$2 = "#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}"; -const fragment$2 = "uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include \n #include \n #include \n}"; -const vertex$1 = "uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n #include \n}"; -const fragment$1 = "uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n}"; -const ShaderChunk = { - alphahash_fragment, - alphahash_pars_fragment, - alphamap_fragment, - alphamap_pars_fragment, - alphatest_fragment, - alphatest_pars_fragment, - aomap_fragment, - aomap_pars_fragment, - batching_pars_vertex, - batching_vertex, - begin_vertex, - beginnormal_vertex, - bsdfs, - iridescence_fragment, - bumpmap_pars_fragment, - clipping_planes_fragment, - clipping_planes_pars_fragment, - clipping_planes_pars_vertex, - clipping_planes_vertex, - color_fragment, - color_pars_fragment, - color_pars_vertex, - color_vertex, - common, - cube_uv_reflection_fragment, - defaultnormal_vertex, - displacementmap_pars_vertex, - displacementmap_vertex, - emissivemap_fragment, - emissivemap_pars_fragment, - colorspace_fragment, - colorspace_pars_fragment, - envmap_fragment, - envmap_common_pars_fragment, - envmap_pars_fragment, - envmap_pars_vertex, - envmap_physical_pars_fragment, - envmap_vertex, - fog_vertex, - fog_pars_vertex, - fog_fragment, - fog_pars_fragment, - gradientmap_pars_fragment, - lightmap_pars_fragment, - lights_lambert_fragment, - lights_lambert_pars_fragment, - lights_pars_begin, - lights_toon_fragment, - lights_toon_pars_fragment, - lights_phong_fragment, - lights_phong_pars_fragment, - lights_physical_fragment, - lights_physical_pars_fragment, - lights_fragment_begin, - lights_fragment_maps, - lights_fragment_end, - logdepthbuf_fragment, - logdepthbuf_pars_fragment, - logdepthbuf_pars_vertex, - logdepthbuf_vertex, - map_fragment, - map_pars_fragment, - map_particle_fragment, - map_particle_pars_fragment, - metalnessmap_fragment, - metalnessmap_pars_fragment, - morphinstance_vertex, - morphcolor_vertex, - morphnormal_vertex, - morphtarget_pars_vertex, - morphtarget_vertex, - normal_fragment_begin, - normal_fragment_maps, - normal_pars_fragment, - normal_pars_vertex, - normal_vertex, - normalmap_pars_fragment, - clearcoat_normal_fragment_begin, - clearcoat_normal_fragment_maps, - clearcoat_pars_fragment, - iridescence_pars_fragment, - opaque_fragment, - packing, - premultiplied_alpha_fragment, - project_vertex, - dithering_fragment, - dithering_pars_fragment, - roughnessmap_fragment, - roughnessmap_pars_fragment, - shadowmap_pars_fragment, - shadowmap_pars_vertex, - shadowmap_vertex, - shadowmask_pars_fragment, - skinbase_vertex, - skinning_pars_vertex, - skinning_vertex, - skinnormal_vertex, - specularmap_fragment, - specularmap_pars_fragment, - tonemapping_fragment, - tonemapping_pars_fragment, - transmission_fragment, - transmission_pars_fragment, - uv_pars_fragment, - uv_pars_vertex, - uv_vertex, - worldpos_vertex, - background_vert: vertex$h, - background_frag: fragment$h, - backgroundCube_vert: vertex$g, - backgroundCube_frag: fragment$g, - cube_vert: vertex$f, - cube_frag: fragment$f, - depth_vert: vertex$e, - depth_frag: fragment$e, - distanceRGBA_vert: vertex$d, - distanceRGBA_frag: fragment$d, - equirect_vert: vertex$c, - equirect_frag: fragment$c, - linedashed_vert: vertex$b, - linedashed_frag: fragment$b, - meshbasic_vert: vertex$a, - meshbasic_frag: fragment$a, - meshlambert_vert: vertex$9, - meshlambert_frag: fragment$9, - meshmatcap_vert: vertex$8, - meshmatcap_frag: fragment$8, - meshnormal_vert: vertex$7, - meshnormal_frag: fragment$7, - meshphong_vert: vertex$6, - meshphong_frag: fragment$6, - meshphysical_vert: vertex$5, - meshphysical_frag: fragment$5, - meshtoon_vert: vertex$4, - meshtoon_frag: fragment$4, - points_vert: vertex$3, - points_frag: fragment$3, - shadow_vert: vertex$2, - shadow_frag: fragment$2, - sprite_vert: vertex$1, - sprite_frag: fragment$1 -}; -const UniformsLib = { - common: { - diffuse: { value: /* @__PURE__ */ new Color(16777215) }, - opacity: { value: 1 }, - map: { value: null }, - mapTransform: { value: /* @__PURE__ */ new Matrix3() }, - alphaMap: { value: null }, - alphaMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - alphaTest: { value: 0 } - }, - specularmap: { - specularMap: { value: null }, - specularMapTransform: { value: /* @__PURE__ */ new Matrix3() } - }, - envmap: { - envMap: { value: null }, - envMapRotation: { value: /* @__PURE__ */ new Matrix3() }, - flipEnvMap: { value: -1 }, - reflectivity: { value: 1 }, - // basic, lambert, phong - ior: { value: 1.5 }, - // physical - refractionRatio: { value: 0.98 } - // basic, lambert, phong - }, - aomap: { - aoMap: { value: null }, - aoMapIntensity: { value: 1 }, - aoMapTransform: { value: /* @__PURE__ */ new Matrix3() } - }, - lightmap: { - lightMap: { value: null }, - lightMapIntensity: { value: 1 }, - lightMapTransform: { value: /* @__PURE__ */ new Matrix3() } - }, - bumpmap: { - bumpMap: { value: null }, - bumpMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - bumpScale: { value: 1 } - }, - normalmap: { - normalMap: { value: null }, - normalMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - normalScale: { value: /* @__PURE__ */ new Vector2(1, 1) } - }, - displacementmap: { - displacementMap: { value: null }, - displacementMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - displacementScale: { value: 1 }, - displacementBias: { value: 0 } - }, - emissivemap: { - emissiveMap: { value: null }, - emissiveMapTransform: { value: /* @__PURE__ */ new Matrix3() } - }, - metalnessmap: { - metalnessMap: { value: null }, - metalnessMapTransform: { value: /* @__PURE__ */ new Matrix3() } - }, - roughnessmap: { - roughnessMap: { value: null }, - roughnessMapTransform: { value: /* @__PURE__ */ new Matrix3() } - }, - gradientmap: { - gradientMap: { value: null } - }, - fog: { - fogDensity: { value: 25e-5 }, - fogNear: { value: 1 }, - fogFar: { value: 2e3 }, - fogColor: { value: /* @__PURE__ */ new Color(16777215) } - }, - lights: { - ambientLightColor: { value: [] }, - lightProbe: { value: [] }, - directionalLights: { value: [], properties: { - direction: {}, - color: {} - } }, - directionalLightShadows: { value: [], properties: { - shadowIntensity: 1, - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {} - } }, - directionalShadowMap: { value: [] }, - directionalShadowMatrix: { value: [] }, - spotLights: { value: [], properties: { - color: {}, - position: {}, - direction: {}, - distance: {}, - coneCos: {}, - penumbraCos: {}, - decay: {} - } }, - spotLightShadows: { value: [], properties: { - shadowIntensity: 1, - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {} - } }, - spotLightMap: { value: [] }, - spotShadowMap: { value: [] }, - spotLightMatrix: { value: [] }, - pointLights: { value: [], properties: { - color: {}, - position: {}, - decay: {}, - distance: {} - } }, - pointLightShadows: { value: [], properties: { - shadowIntensity: 1, - shadowBias: {}, - shadowNormalBias: {}, - shadowRadius: {}, - shadowMapSize: {}, - shadowCameraNear: {}, - shadowCameraFar: {} - } }, - pointShadowMap: { value: [] }, - pointShadowMatrix: { value: [] }, - hemisphereLights: { value: [], properties: { - direction: {}, - skyColor: {}, - groundColor: {} - } }, - // TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src - rectAreaLights: { value: [], properties: { - color: {}, - position: {}, - width: {}, - height: {} - } }, - ltc_1: { value: null }, - ltc_2: { value: null } - }, - points: { - diffuse: { value: /* @__PURE__ */ new Color(16777215) }, - opacity: { value: 1 }, - size: { value: 1 }, - scale: { value: 1 }, - map: { value: null }, - alphaMap: { value: null }, - alphaMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - alphaTest: { value: 0 }, - uvTransform: { value: /* @__PURE__ */ new Matrix3() } - }, - sprite: { - diffuse: { value: /* @__PURE__ */ new Color(16777215) }, - opacity: { value: 1 }, - center: { value: /* @__PURE__ */ new Vector2(0.5, 0.5) }, - rotation: { value: 0 }, - map: { value: null }, - mapTransform: { value: /* @__PURE__ */ new Matrix3() }, - alphaMap: { value: null }, - alphaMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - alphaTest: { value: 0 } - } -}; -const ShaderLib = { - basic: { - uniforms: /* @__PURE__ */ mergeUniforms([ - UniformsLib.common, - UniformsLib.specularmap, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.fog - ]), - vertexShader: ShaderChunk.meshbasic_vert, - fragmentShader: ShaderChunk.meshbasic_frag - }, - lambert: { - uniforms: /* @__PURE__ */ mergeUniforms([ - UniformsLib.common, - UniformsLib.specularmap, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: /* @__PURE__ */ new Color(0) } - } - ]), - vertexShader: ShaderChunk.meshlambert_vert, - fragmentShader: ShaderChunk.meshlambert_frag - }, - phong: { - uniforms: /* @__PURE__ */ mergeUniforms([ - UniformsLib.common, - UniformsLib.specularmap, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: /* @__PURE__ */ new Color(0) }, - specular: { value: /* @__PURE__ */ new Color(1118481) }, - shininess: { value: 30 } - } - ]), - vertexShader: ShaderChunk.meshphong_vert, - fragmentShader: ShaderChunk.meshphong_frag - }, - standard: { - uniforms: /* @__PURE__ */ mergeUniforms([ - UniformsLib.common, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.roughnessmap, - UniformsLib.metalnessmap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: /* @__PURE__ */ new Color(0) }, - roughness: { value: 1 }, - metalness: { value: 0 }, - envMapIntensity: { value: 1 } - } - ]), - vertexShader: ShaderChunk.meshphysical_vert, - fragmentShader: ShaderChunk.meshphysical_frag - }, - toon: { - uniforms: /* @__PURE__ */ mergeUniforms([ - UniformsLib.common, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.gradientmap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: /* @__PURE__ */ new Color(0) } - } - ]), - vertexShader: ShaderChunk.meshtoon_vert, - fragmentShader: ShaderChunk.meshtoon_frag - }, - matcap: { - uniforms: /* @__PURE__ */ mergeUniforms([ - UniformsLib.common, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - UniformsLib.fog, - { - matcap: { value: null } - } - ]), - vertexShader: ShaderChunk.meshmatcap_vert, - fragmentShader: ShaderChunk.meshmatcap_frag - }, - points: { - uniforms: /* @__PURE__ */ mergeUniforms([ - UniformsLib.points, - UniformsLib.fog - ]), - vertexShader: ShaderChunk.points_vert, - fragmentShader: ShaderChunk.points_frag - }, - dashed: { - uniforms: /* @__PURE__ */ mergeUniforms([ - UniformsLib.common, - UniformsLib.fog, - { - scale: { value: 1 }, - dashSize: { value: 1 }, - totalSize: { value: 2 } - } - ]), - vertexShader: ShaderChunk.linedashed_vert, - fragmentShader: ShaderChunk.linedashed_frag - }, - depth: { - uniforms: /* @__PURE__ */ mergeUniforms([ - UniformsLib.common, - UniformsLib.displacementmap - ]), - vertexShader: ShaderChunk.depth_vert, - fragmentShader: ShaderChunk.depth_frag - }, - normal: { - uniforms: /* @__PURE__ */ mergeUniforms([ - UniformsLib.common, - UniformsLib.bumpmap, - UniformsLib.normalmap, - UniformsLib.displacementmap, - { - opacity: { value: 1 } - } - ]), - vertexShader: ShaderChunk.meshnormal_vert, - fragmentShader: ShaderChunk.meshnormal_frag - }, - sprite: { - uniforms: /* @__PURE__ */ mergeUniforms([ - UniformsLib.sprite, - UniformsLib.fog - ]), - vertexShader: ShaderChunk.sprite_vert, - fragmentShader: ShaderChunk.sprite_frag - }, - background: { - uniforms: { - uvTransform: { value: /* @__PURE__ */ new Matrix3() }, - t2D: { value: null }, - backgroundIntensity: { value: 1 } - }, - vertexShader: ShaderChunk.background_vert, - fragmentShader: ShaderChunk.background_frag - }, - backgroundCube: { - uniforms: { - envMap: { value: null }, - flipEnvMap: { value: -1 }, - backgroundBlurriness: { value: 0 }, - backgroundIntensity: { value: 1 }, - backgroundRotation: { value: /* @__PURE__ */ new Matrix3() } - }, - vertexShader: ShaderChunk.backgroundCube_vert, - fragmentShader: ShaderChunk.backgroundCube_frag - }, - cube: { - uniforms: { - tCube: { value: null }, - tFlip: { value: -1 }, - opacity: { value: 1 } - }, - vertexShader: ShaderChunk.cube_vert, - fragmentShader: ShaderChunk.cube_frag - }, - equirect: { - uniforms: { - tEquirect: { value: null } - }, - vertexShader: ShaderChunk.equirect_vert, - fragmentShader: ShaderChunk.equirect_frag - }, - distanceRGBA: { - uniforms: /* @__PURE__ */ mergeUniforms([ - UniformsLib.common, - UniformsLib.displacementmap, - { - referencePosition: { value: /* @__PURE__ */ new Vector3() }, - nearDistance: { value: 1 }, - farDistance: { value: 1e3 } - } - ]), - vertexShader: ShaderChunk.distanceRGBA_vert, - fragmentShader: ShaderChunk.distanceRGBA_frag - }, - shadow: { - uniforms: /* @__PURE__ */ mergeUniforms([ - UniformsLib.lights, - UniformsLib.fog, - { - color: { value: /* @__PURE__ */ new Color(0) }, - opacity: { value: 1 } - } - ]), - vertexShader: ShaderChunk.shadow_vert, - fragmentShader: ShaderChunk.shadow_frag - } -}; -ShaderLib.physical = { - uniforms: /* @__PURE__ */ mergeUniforms([ - ShaderLib.standard.uniforms, - { - clearcoat: { value: 0 }, - clearcoatMap: { value: null }, - clearcoatMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - clearcoatNormalMap: { value: null }, - clearcoatNormalMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - clearcoatNormalScale: { value: /* @__PURE__ */ new Vector2(1, 1) }, - clearcoatRoughness: { value: 0 }, - clearcoatRoughnessMap: { value: null }, - clearcoatRoughnessMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - dispersion: { value: 0 }, - iridescence: { value: 0 }, - iridescenceMap: { value: null }, - iridescenceMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - iridescenceIOR: { value: 1.3 }, - iridescenceThicknessMinimum: { value: 100 }, - iridescenceThicknessMaximum: { value: 400 }, - iridescenceThicknessMap: { value: null }, - iridescenceThicknessMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - sheen: { value: 0 }, - sheenColor: { value: /* @__PURE__ */ new Color(0) }, - sheenColorMap: { value: null }, - sheenColorMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - sheenRoughness: { value: 1 }, - sheenRoughnessMap: { value: null }, - sheenRoughnessMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - transmission: { value: 0 }, - transmissionMap: { value: null }, - transmissionMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - transmissionSamplerSize: { value: /* @__PURE__ */ new Vector2() }, - transmissionSamplerMap: { value: null }, - thickness: { value: 0 }, - thicknessMap: { value: null }, - thicknessMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - attenuationDistance: { value: 0 }, - attenuationColor: { value: /* @__PURE__ */ new Color(0) }, - specularColor: { value: /* @__PURE__ */ new Color(1, 1, 1) }, - specularColorMap: { value: null }, - specularColorMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - specularIntensity: { value: 1 }, - specularIntensityMap: { value: null }, - specularIntensityMapTransform: { value: /* @__PURE__ */ new Matrix3() }, - anisotropyVector: { value: /* @__PURE__ */ new Vector2() }, - anisotropyMap: { value: null }, - anisotropyMapTransform: { value: /* @__PURE__ */ new Matrix3() } - } - ]), - vertexShader: ShaderChunk.meshphysical_vert, - fragmentShader: ShaderChunk.meshphysical_frag -}; -const _rgb = { r: 0, b: 0, g: 0 }; -const _e1$1 = /* @__PURE__ */ new Euler(); -const _m1$1 = /* @__PURE__ */ new Matrix4(); -function WebGLBackground(renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha) { - const clearColor = new Color(0); - let clearAlpha = alpha === true ? 0 : 1; - let planeMesh; - let boxMesh; - let currentBackground = null; - let currentBackgroundVersion = 0; - let currentTonemapping = null; - function getBackground(scene) { - let background = scene.isScene === true ? scene.background : null; - if (background && background.isTexture) { - const usePMREM = scene.backgroundBlurriness > 0; - background = (usePMREM ? cubeuvmaps : cubemaps).get(background); - } - return background; - } - __name(getBackground, "getBackground"); - function render(scene) { - let forceClear = false; - const background = getBackground(scene); - if (background === null) { - setClear(clearColor, clearAlpha); - } else if (background && background.isColor) { - setClear(background, 1); - forceClear = true; - } - const environmentBlendMode = renderer.xr.getEnvironmentBlendMode(); - if (environmentBlendMode === "additive") { - state.buffers.color.setClear(0, 0, 0, 1, premultipliedAlpha); - } else if (environmentBlendMode === "alpha-blend") { - state.buffers.color.setClear(0, 0, 0, 0, premultipliedAlpha); - } - if (renderer.autoClear || forceClear) { - state.buffers.depth.setTest(true); - state.buffers.depth.setMask(true); - state.buffers.color.setMask(true); - renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil); - } - } - __name(render, "render"); - function addToRenderList(renderList, scene) { - const background = getBackground(scene); - if (background && (background.isCubeTexture || background.mapping === CubeUVReflectionMapping)) { - if (boxMesh === void 0) { - boxMesh = new Mesh( - new BoxGeometry(1, 1, 1), - new ShaderMaterial({ - name: "BackgroundCubeMaterial", - uniforms: cloneUniforms(ShaderLib.backgroundCube.uniforms), - vertexShader: ShaderLib.backgroundCube.vertexShader, - fragmentShader: ShaderLib.backgroundCube.fragmentShader, - side: BackSide, - depthTest: false, - depthWrite: false, - fog: false - }) - ); - boxMesh.geometry.deleteAttribute("normal"); - boxMesh.geometry.deleteAttribute("uv"); - boxMesh.onBeforeRender = function(renderer2, scene2, camera) { - this.matrixWorld.copyPosition(camera.matrixWorld); - }; - Object.defineProperty(boxMesh.material, "envMap", { - get: /* @__PURE__ */ __name(function() { - return this.uniforms.envMap.value; - }, "get") - }); - objects.update(boxMesh); - } - _e1$1.copy(scene.backgroundRotation); - _e1$1.x *= -1; - _e1$1.y *= -1; - _e1$1.z *= -1; - if (background.isCubeTexture && background.isRenderTargetTexture === false) { - _e1$1.y *= -1; - _e1$1.z *= -1; - } - boxMesh.material.uniforms.envMap.value = background; - boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1; - boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness; - boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity; - boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4(_m1$1.makeRotationFromEuler(_e1$1)); - boxMesh.material.toneMapped = ColorManagement.getTransfer(background.colorSpace) !== SRGBTransfer; - if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) { - boxMesh.material.needsUpdate = true; - currentBackground = background; - currentBackgroundVersion = background.version; - currentTonemapping = renderer.toneMapping; - } - boxMesh.layers.enableAll(); - renderList.unshift(boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null); - } else if (background && background.isTexture) { - if (planeMesh === void 0) { - planeMesh = new Mesh( - new PlaneGeometry(2, 2), - new ShaderMaterial({ - name: "BackgroundMaterial", - uniforms: cloneUniforms(ShaderLib.background.uniforms), - vertexShader: ShaderLib.background.vertexShader, - fragmentShader: ShaderLib.background.fragmentShader, - side: FrontSide, - depthTest: false, - depthWrite: false, - fog: false - }) - ); - planeMesh.geometry.deleteAttribute("normal"); - Object.defineProperty(planeMesh.material, "map", { - get: /* @__PURE__ */ __name(function() { - return this.uniforms.t2D.value; - }, "get") - }); - objects.update(planeMesh); - } - planeMesh.material.uniforms.t2D.value = background; - planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity; - planeMesh.material.toneMapped = ColorManagement.getTransfer(background.colorSpace) !== SRGBTransfer; - if (background.matrixAutoUpdate === true) { - background.updateMatrix(); - } - planeMesh.material.uniforms.uvTransform.value.copy(background.matrix); - if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) { - planeMesh.material.needsUpdate = true; - currentBackground = background; - currentBackgroundVersion = background.version; - currentTonemapping = renderer.toneMapping; - } - planeMesh.layers.enableAll(); - renderList.unshift(planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null); - } - } - __name(addToRenderList, "addToRenderList"); - function setClear(color, alpha2) { - color.getRGB(_rgb, getUnlitUniformColorSpace(renderer)); - state.buffers.color.setClear(_rgb.r, _rgb.g, _rgb.b, alpha2, premultipliedAlpha); - } - __name(setClear, "setClear"); - return { - getClearColor: /* @__PURE__ */ __name(function() { - return clearColor; - }, "getClearColor"), - setClearColor: /* @__PURE__ */ __name(function(color, alpha2 = 1) { - clearColor.set(color); - clearAlpha = alpha2; - setClear(clearColor, clearAlpha); - }, "setClearColor"), - getClearAlpha: /* @__PURE__ */ __name(function() { - return clearAlpha; - }, "getClearAlpha"), - setClearAlpha: /* @__PURE__ */ __name(function(alpha2) { - clearAlpha = alpha2; - setClear(clearColor, clearAlpha); - }, "setClearAlpha"), - render, - addToRenderList - }; -} -__name(WebGLBackground, "WebGLBackground"); -function WebGLBindingStates(gl, attributes) { - const maxVertexAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS); - const bindingStates = {}; - const defaultState = createBindingState(null); - let currentState = defaultState; - let forceUpdate = false; - function setup(object, material, program, geometry, index) { - let updateBuffers = false; - const state = getBindingState(geometry, program, material); - if (currentState !== state) { - currentState = state; - bindVertexArrayObject(currentState.object); - } - updateBuffers = needsUpdate(object, geometry, program, index); - if (updateBuffers) saveCache(object, geometry, program, index); - if (index !== null) { - attributes.update(index, gl.ELEMENT_ARRAY_BUFFER); - } - if (updateBuffers || forceUpdate) { - forceUpdate = false; - setupVertexAttributes(object, material, program, geometry); - if (index !== null) { - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, attributes.get(index).buffer); - } - } - } - __name(setup, "setup"); - function createVertexArrayObject() { - return gl.createVertexArray(); - } - __name(createVertexArrayObject, "createVertexArrayObject"); - function bindVertexArrayObject(vao) { - return gl.bindVertexArray(vao); - } - __name(bindVertexArrayObject, "bindVertexArrayObject"); - function deleteVertexArrayObject(vao) { - return gl.deleteVertexArray(vao); - } - __name(deleteVertexArrayObject, "deleteVertexArrayObject"); - function getBindingState(geometry, program, material) { - const wireframe = material.wireframe === true; - let programMap = bindingStates[geometry.id]; - if (programMap === void 0) { - programMap = {}; - bindingStates[geometry.id] = programMap; - } - let stateMap = programMap[program.id]; - if (stateMap === void 0) { - stateMap = {}; - programMap[program.id] = stateMap; - } - let state = stateMap[wireframe]; - if (state === void 0) { - state = createBindingState(createVertexArrayObject()); - stateMap[wireframe] = state; - } - return state; - } - __name(getBindingState, "getBindingState"); - function createBindingState(vao) { - const newAttributes = []; - const enabledAttributes = []; - const attributeDivisors = []; - for (let i = 0; i < maxVertexAttributes; i++) { - newAttributes[i] = 0; - enabledAttributes[i] = 0; - attributeDivisors[i] = 0; - } - return { - // for backward compatibility on non-VAO support browser - geometry: null, - program: null, - wireframe: false, - newAttributes, - enabledAttributes, - attributeDivisors, - object: vao, - attributes: {}, - index: null - }; - } - __name(createBindingState, "createBindingState"); - function needsUpdate(object, geometry, program, index) { - const cachedAttributes = currentState.attributes; - const geometryAttributes = geometry.attributes; - let attributesNum = 0; - const programAttributes = program.getAttributes(); - for (const name in programAttributes) { - const programAttribute = programAttributes[name]; - if (programAttribute.location >= 0) { - const cachedAttribute = cachedAttributes[name]; - let geometryAttribute = geometryAttributes[name]; - if (geometryAttribute === void 0) { - if (name === "instanceMatrix" && object.instanceMatrix) geometryAttribute = object.instanceMatrix; - if (name === "instanceColor" && object.instanceColor) geometryAttribute = object.instanceColor; - } - if (cachedAttribute === void 0) return true; - if (cachedAttribute.attribute !== geometryAttribute) return true; - if (geometryAttribute && cachedAttribute.data !== geometryAttribute.data) return true; - attributesNum++; - } - } - if (currentState.attributesNum !== attributesNum) return true; - if (currentState.index !== index) return true; - return false; - } - __name(needsUpdate, "needsUpdate"); - function saveCache(object, geometry, program, index) { - const cache = {}; - const attributes2 = geometry.attributes; - let attributesNum = 0; - const programAttributes = program.getAttributes(); - for (const name in programAttributes) { - const programAttribute = programAttributes[name]; - if (programAttribute.location >= 0) { - let attribute = attributes2[name]; - if (attribute === void 0) { - if (name === "instanceMatrix" && object.instanceMatrix) attribute = object.instanceMatrix; - if (name === "instanceColor" && object.instanceColor) attribute = object.instanceColor; - } - const data = {}; - data.attribute = attribute; - if (attribute && attribute.data) { - data.data = attribute.data; - } - cache[name] = data; - attributesNum++; - } - } - currentState.attributes = cache; - currentState.attributesNum = attributesNum; - currentState.index = index; - } - __name(saveCache, "saveCache"); - function initAttributes() { - const newAttributes = currentState.newAttributes; - for (let i = 0, il = newAttributes.length; i < il; i++) { - newAttributes[i] = 0; - } - } - __name(initAttributes, "initAttributes"); - function enableAttribute(attribute) { - enableAttributeAndDivisor(attribute, 0); - } - __name(enableAttribute, "enableAttribute"); - function enableAttributeAndDivisor(attribute, meshPerAttribute) { - const newAttributes = currentState.newAttributes; - const enabledAttributes = currentState.enabledAttributes; - const attributeDivisors = currentState.attributeDivisors; - newAttributes[attribute] = 1; - if (enabledAttributes[attribute] === 0) { - gl.enableVertexAttribArray(attribute); - enabledAttributes[attribute] = 1; - } - if (attributeDivisors[attribute] !== meshPerAttribute) { - gl.vertexAttribDivisor(attribute, meshPerAttribute); - attributeDivisors[attribute] = meshPerAttribute; - } - } - __name(enableAttributeAndDivisor, "enableAttributeAndDivisor"); - function disableUnusedAttributes() { - const newAttributes = currentState.newAttributes; - const enabledAttributes = currentState.enabledAttributes; - for (let i = 0, il = enabledAttributes.length; i < il; i++) { - if (enabledAttributes[i] !== newAttributes[i]) { - gl.disableVertexAttribArray(i); - enabledAttributes[i] = 0; - } - } - } - __name(disableUnusedAttributes, "disableUnusedAttributes"); - function vertexAttribPointer(index, size, type, normalized, stride, offset, integer) { - if (integer === true) { - gl.vertexAttribIPointer(index, size, type, stride, offset); - } else { - gl.vertexAttribPointer(index, size, type, normalized, stride, offset); - } - } - __name(vertexAttribPointer, "vertexAttribPointer"); - function setupVertexAttributes(object, material, program, geometry) { - initAttributes(); - const geometryAttributes = geometry.attributes; - const programAttributes = program.getAttributes(); - const materialDefaultAttributeValues = material.defaultAttributeValues; - for (const name in programAttributes) { - const programAttribute = programAttributes[name]; - if (programAttribute.location >= 0) { - let geometryAttribute = geometryAttributes[name]; - if (geometryAttribute === void 0) { - if (name === "instanceMatrix" && object.instanceMatrix) geometryAttribute = object.instanceMatrix; - if (name === "instanceColor" && object.instanceColor) geometryAttribute = object.instanceColor; - } - if (geometryAttribute !== void 0) { - const normalized = geometryAttribute.normalized; - const size = geometryAttribute.itemSize; - const attribute = attributes.get(geometryAttribute); - if (attribute === void 0) continue; - const buffer = attribute.buffer; - const type = attribute.type; - const bytesPerElement = attribute.bytesPerElement; - const integer = type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType; - if (geometryAttribute.isInterleavedBufferAttribute) { - const data = geometryAttribute.data; - const stride = data.stride; - const offset = geometryAttribute.offset; - if (data.isInstancedInterleavedBuffer) { - for (let i = 0; i < programAttribute.locationSize; i++) { - enableAttributeAndDivisor(programAttribute.location + i, data.meshPerAttribute); - } - if (object.isInstancedMesh !== true && geometry._maxInstanceCount === void 0) { - geometry._maxInstanceCount = data.meshPerAttribute * data.count; - } - } else { - for (let i = 0; i < programAttribute.locationSize; i++) { - enableAttribute(programAttribute.location + i); - } - } - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - for (let i = 0; i < programAttribute.locationSize; i++) { - vertexAttribPointer( - programAttribute.location + i, - size / programAttribute.locationSize, - type, - normalized, - stride * bytesPerElement, - (offset + size / programAttribute.locationSize * i) * bytesPerElement, - integer - ); - } - } else { - if (geometryAttribute.isInstancedBufferAttribute) { - for (let i = 0; i < programAttribute.locationSize; i++) { - enableAttributeAndDivisor(programAttribute.location + i, geometryAttribute.meshPerAttribute); - } - if (object.isInstancedMesh !== true && geometry._maxInstanceCount === void 0) { - geometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count; - } - } else { - for (let i = 0; i < programAttribute.locationSize; i++) { - enableAttribute(programAttribute.location + i); - } - } - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - for (let i = 0; i < programAttribute.locationSize; i++) { - vertexAttribPointer( - programAttribute.location + i, - size / programAttribute.locationSize, - type, - normalized, - size * bytesPerElement, - size / programAttribute.locationSize * i * bytesPerElement, - integer - ); - } - } - } else if (materialDefaultAttributeValues !== void 0) { - const value = materialDefaultAttributeValues[name]; - if (value !== void 0) { - switch (value.length) { - case 2: - gl.vertexAttrib2fv(programAttribute.location, value); - break; - case 3: - gl.vertexAttrib3fv(programAttribute.location, value); - break; - case 4: - gl.vertexAttrib4fv(programAttribute.location, value); - break; - default: - gl.vertexAttrib1fv(programAttribute.location, value); - } - } - } - } - } - disableUnusedAttributes(); - } - __name(setupVertexAttributes, "setupVertexAttributes"); - function dispose() { - reset(); - for (const geometryId in bindingStates) { - const programMap = bindingStates[geometryId]; - for (const programId in programMap) { - const stateMap = programMap[programId]; - for (const wireframe in stateMap) { - deleteVertexArrayObject(stateMap[wireframe].object); - delete stateMap[wireframe]; - } - delete programMap[programId]; - } - delete bindingStates[geometryId]; - } - } - __name(dispose, "dispose"); - function releaseStatesOfGeometry(geometry) { - if (bindingStates[geometry.id] === void 0) return; - const programMap = bindingStates[geometry.id]; - for (const programId in programMap) { - const stateMap = programMap[programId]; - for (const wireframe in stateMap) { - deleteVertexArrayObject(stateMap[wireframe].object); - delete stateMap[wireframe]; - } - delete programMap[programId]; - } - delete bindingStates[geometry.id]; - } - __name(releaseStatesOfGeometry, "releaseStatesOfGeometry"); - function releaseStatesOfProgram(program) { - for (const geometryId in bindingStates) { - const programMap = bindingStates[geometryId]; - if (programMap[program.id] === void 0) continue; - const stateMap = programMap[program.id]; - for (const wireframe in stateMap) { - deleteVertexArrayObject(stateMap[wireframe].object); - delete stateMap[wireframe]; - } - delete programMap[program.id]; - } - } - __name(releaseStatesOfProgram, "releaseStatesOfProgram"); - function reset() { - resetDefaultState(); - forceUpdate = true; - if (currentState === defaultState) return; - currentState = defaultState; - bindVertexArrayObject(currentState.object); - } - __name(reset, "reset"); - function resetDefaultState() { - defaultState.geometry = null; - defaultState.program = null; - defaultState.wireframe = false; - } - __name(resetDefaultState, "resetDefaultState"); - return { - setup, - reset, - resetDefaultState, - dispose, - releaseStatesOfGeometry, - releaseStatesOfProgram, - initAttributes, - enableAttribute, - disableUnusedAttributes - }; -} -__name(WebGLBindingStates, "WebGLBindingStates"); -function WebGLBufferRenderer(gl, extensions, info) { - let mode; - function setMode(value) { - mode = value; - } - __name(setMode, "setMode"); - function render(start, count) { - gl.drawArrays(mode, start, count); - info.update(count, mode, 1); - } - __name(render, "render"); - function renderInstances(start, count, primcount) { - if (primcount === 0) return; - gl.drawArraysInstanced(mode, start, count, primcount); - info.update(count, mode, primcount); - } - __name(renderInstances, "renderInstances"); - function renderMultiDraw(starts, counts, drawCount) { - if (drawCount === 0) return; - const extension = extensions.get("WEBGL_multi_draw"); - extension.multiDrawArraysWEBGL(mode, starts, 0, counts, 0, drawCount); - let elementCount = 0; - for (let i = 0; i < drawCount; i++) { - elementCount += counts[i]; - } - info.update(elementCount, mode, 1); - } - __name(renderMultiDraw, "renderMultiDraw"); - function renderMultiDrawInstances(starts, counts, drawCount, primcount) { - if (drawCount === 0) return; - const extension = extensions.get("WEBGL_multi_draw"); - if (extension === null) { - for (let i = 0; i < starts.length; i++) { - renderInstances(starts[i], counts[i], primcount[i]); - } - } else { - extension.multiDrawArraysInstancedWEBGL(mode, starts, 0, counts, 0, primcount, 0, drawCount); - let elementCount = 0; - for (let i = 0; i < drawCount; i++) { - elementCount += counts[i] * primcount[i]; - } - info.update(elementCount, mode, 1); - } - } - __name(renderMultiDrawInstances, "renderMultiDrawInstances"); - this.setMode = setMode; - this.render = render; - this.renderInstances = renderInstances; - this.renderMultiDraw = renderMultiDraw; - this.renderMultiDrawInstances = renderMultiDrawInstances; -} -__name(WebGLBufferRenderer, "WebGLBufferRenderer"); -function WebGLCapabilities(gl, extensions, parameters, utils) { - let maxAnisotropy; - function getMaxAnisotropy() { - if (maxAnisotropy !== void 0) return maxAnisotropy; - if (extensions.has("EXT_texture_filter_anisotropic") === true) { - const extension = extensions.get("EXT_texture_filter_anisotropic"); - maxAnisotropy = gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT); - } else { - maxAnisotropy = 0; - } - return maxAnisotropy; - } - __name(getMaxAnisotropy, "getMaxAnisotropy"); - function textureFormatReadable(textureFormat) { - if (textureFormat !== RGBAFormat && utils.convert(textureFormat) !== gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT)) { - return false; - } - return true; - } - __name(textureFormatReadable, "textureFormatReadable"); - function textureTypeReadable(textureType) { - const halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has("EXT_color_buffer_half_float") || extensions.has("EXT_color_buffer_float")); - if (textureType !== UnsignedByteType && utils.convert(textureType) !== gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE) && // Edge and Chrome Mac < 52 (#9513) - textureType !== FloatType && !halfFloatSupportedByExt) { - return false; - } - return true; - } - __name(textureTypeReadable, "textureTypeReadable"); - function getMaxPrecision(precision2) { - if (precision2 === "highp") { - if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).precision > 0) { - return "highp"; - } - precision2 = "mediump"; - } - if (precision2 === "mediump") { - if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT).precision > 0) { - return "mediump"; - } - } - return "lowp"; - } - __name(getMaxPrecision, "getMaxPrecision"); - let precision = parameters.precision !== void 0 ? parameters.precision : "highp"; - const maxPrecision = getMaxPrecision(precision); - if (maxPrecision !== precision) { - console.warn("THREE.WebGLRenderer:", precision, "not supported, using", maxPrecision, "instead."); - precision = maxPrecision; - } - const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true; - const reverseDepthBuffer = parameters.reverseDepthBuffer === true && extensions.has("EXT_clip_control"); - const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); - const maxVertexTextures = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS); - const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE); - const maxCubemapSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE); - const maxAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS); - const maxVertexUniforms = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS); - const maxVaryings = gl.getParameter(gl.MAX_VARYING_VECTORS); - const maxFragmentUniforms = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS); - const vertexTextures = maxVertexTextures > 0; - const maxSamples = gl.getParameter(gl.MAX_SAMPLES); - return { - isWebGL2: true, - // keeping this for backwards compatibility - getMaxAnisotropy, - getMaxPrecision, - textureFormatReadable, - textureTypeReadable, - precision, - logarithmicDepthBuffer, - reverseDepthBuffer, - maxTextures, - maxVertexTextures, - maxTextureSize, - maxCubemapSize, - maxAttributes, - maxVertexUniforms, - maxVaryings, - maxFragmentUniforms, - vertexTextures, - maxSamples - }; -} -__name(WebGLCapabilities, "WebGLCapabilities"); -function WebGLClipping(properties) { - const scope = this; - let globalState = null, numGlobalPlanes = 0, localClippingEnabled = false, renderingShadows = false; - const plane = new Plane(), viewNormalMatrix = new Matrix3(), uniform = { value: null, needsUpdate: false }; - this.uniform = uniform; - this.numPlanes = 0; - this.numIntersection = 0; - this.init = function(planes, enableLocalClipping) { - const enabled = planes.length !== 0 || enableLocalClipping || // enable state of previous frame - the clipping code has to - // run another frame in order to reset the state: - numGlobalPlanes !== 0 || localClippingEnabled; - localClippingEnabled = enableLocalClipping; - numGlobalPlanes = planes.length; - return enabled; - }; - this.beginShadows = function() { - renderingShadows = true; - projectPlanes(null); - }; - this.endShadows = function() { - renderingShadows = false; - }; - this.setGlobalState = function(planes, camera) { - globalState = projectPlanes(planes, camera, 0); - }; - this.setState = function(material, camera, useCache) { - const planes = material.clippingPlanes, clipIntersection = material.clipIntersection, clipShadows = material.clipShadows; - const materialProperties = properties.get(material); - if (!localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && !clipShadows) { - if (renderingShadows) { - projectPlanes(null); - } else { - resetGlobalState(); - } - } else { - const nGlobal = renderingShadows ? 0 : numGlobalPlanes, lGlobal = nGlobal * 4; - let dstArray = materialProperties.clippingState || null; - uniform.value = dstArray; - dstArray = projectPlanes(planes, camera, lGlobal, useCache); - for (let i = 0; i !== lGlobal; ++i) { - dstArray[i] = globalState[i]; - } - materialProperties.clippingState = dstArray; - this.numIntersection = clipIntersection ? this.numPlanes : 0; - this.numPlanes += nGlobal; - } - }; - function resetGlobalState() { - if (uniform.value !== globalState) { - uniform.value = globalState; - uniform.needsUpdate = numGlobalPlanes > 0; - } - scope.numPlanes = numGlobalPlanes; - scope.numIntersection = 0; - } - __name(resetGlobalState, "resetGlobalState"); - function projectPlanes(planes, camera, dstOffset, skipTransform) { - const nPlanes = planes !== null ? planes.length : 0; - let dstArray = null; - if (nPlanes !== 0) { - dstArray = uniform.value; - if (skipTransform !== true || dstArray === null) { - const flatSize = dstOffset + nPlanes * 4, viewMatrix = camera.matrixWorldInverse; - viewNormalMatrix.getNormalMatrix(viewMatrix); - if (dstArray === null || dstArray.length < flatSize) { - dstArray = new Float32Array(flatSize); - } - for (let i = 0, i4 = dstOffset; i !== nPlanes; ++i, i4 += 4) { - plane.copy(planes[i]).applyMatrix4(viewMatrix, viewNormalMatrix); - plane.normal.toArray(dstArray, i4); - dstArray[i4 + 3] = plane.constant; - } - } - uniform.value = dstArray; - uniform.needsUpdate = true; - } - scope.numPlanes = nPlanes; - scope.numIntersection = 0; - return dstArray; - } - __name(projectPlanes, "projectPlanes"); -} -__name(WebGLClipping, "WebGLClipping"); -function WebGLCubeMaps(renderer) { - let cubemaps = /* @__PURE__ */ new WeakMap(); - function mapTextureMapping(texture, mapping) { - if (mapping === EquirectangularReflectionMapping) { - texture.mapping = CubeReflectionMapping; - } else if (mapping === EquirectangularRefractionMapping) { - texture.mapping = CubeRefractionMapping; - } - return texture; - } - __name(mapTextureMapping, "mapTextureMapping"); - function get(texture) { - if (texture && texture.isTexture) { - const mapping = texture.mapping; - if (mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping) { - if (cubemaps.has(texture)) { - const cubemap = cubemaps.get(texture).texture; - return mapTextureMapping(cubemap, texture.mapping); - } else { - const image = texture.image; - if (image && image.height > 0) { - const renderTarget = new WebGLCubeRenderTarget(image.height); - renderTarget.fromEquirectangularTexture(renderer, texture); - cubemaps.set(texture, renderTarget); - texture.addEventListener("dispose", onTextureDispose); - return mapTextureMapping(renderTarget.texture, texture.mapping); - } else { - return null; - } - } - } - } - return texture; - } - __name(get, "get"); - function onTextureDispose(event) { - const texture = event.target; - texture.removeEventListener("dispose", onTextureDispose); - const cubemap = cubemaps.get(texture); - if (cubemap !== void 0) { - cubemaps.delete(texture); - cubemap.dispose(); - } - } - __name(onTextureDispose, "onTextureDispose"); - function dispose() { - cubemaps = /* @__PURE__ */ new WeakMap(); - } - __name(dispose, "dispose"); - return { - get, - dispose - }; -} -__name(WebGLCubeMaps, "WebGLCubeMaps"); -class OrthographicCamera extends Camera { - static { - __name(this, "OrthographicCamera"); - } - constructor(left = -1, right = 1, top = 1, bottom = -1, near = 0.1, far = 2e3) { - super(); - this.isOrthographicCamera = true; - this.type = "OrthographicCamera"; - this.zoom = 1; - this.view = null; - this.left = left; - this.right = right; - this.top = top; - this.bottom = bottom; - this.near = near; - this.far = far; - this.updateProjectionMatrix(); - } - copy(source, recursive) { - super.copy(source, recursive); - this.left = source.left; - this.right = source.right; - this.top = source.top; - this.bottom = source.bottom; - this.near = source.near; - this.far = source.far; - this.zoom = source.zoom; - this.view = source.view === null ? null : Object.assign({}, source.view); - return this; - } - setViewOffset(fullWidth, fullHeight, x, y, width, height) { - if (this.view === null) { - this.view = { - enabled: true, - fullWidth: 1, - fullHeight: 1, - offsetX: 0, - offsetY: 0, - width: 1, - height: 1 - }; - } - this.view.enabled = true; - this.view.fullWidth = fullWidth; - this.view.fullHeight = fullHeight; - this.view.offsetX = x; - this.view.offsetY = y; - this.view.width = width; - this.view.height = height; - this.updateProjectionMatrix(); - } - clearViewOffset() { - if (this.view !== null) { - this.view.enabled = false; - } - this.updateProjectionMatrix(); - } - updateProjectionMatrix() { - const dx = (this.right - this.left) / (2 * this.zoom); - const dy = (this.top - this.bottom) / (2 * this.zoom); - const cx = (this.right + this.left) / 2; - const cy = (this.top + this.bottom) / 2; - let left = cx - dx; - let right = cx + dx; - let top = cy + dy; - let bottom = cy - dy; - if (this.view !== null && this.view.enabled) { - const scaleW = (this.right - this.left) / this.view.fullWidth / this.zoom; - const scaleH = (this.top - this.bottom) / this.view.fullHeight / this.zoom; - left += scaleW * this.view.offsetX; - right = left + scaleW * this.view.width; - top -= scaleH * this.view.offsetY; - bottom = top - scaleH * this.view.height; - } - this.projectionMatrix.makeOrthographic(left, right, top, bottom, this.near, this.far, this.coordinateSystem); - this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); - } - toJSON(meta) { - const data = super.toJSON(meta); - data.object.zoom = this.zoom; - data.object.left = this.left; - data.object.right = this.right; - data.object.top = this.top; - data.object.bottom = this.bottom; - data.object.near = this.near; - data.object.far = this.far; - if (this.view !== null) data.object.view = Object.assign({}, this.view); - return data; - } -} -const LOD_MIN = 4; -const EXTRA_LOD_SIGMA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582]; -const MAX_SAMPLES = 20; -const _flatCamera = /* @__PURE__ */ new OrthographicCamera(); -const _clearColor = /* @__PURE__ */ new Color(); -let _oldTarget = null; -let _oldActiveCubeFace = 0; -let _oldActiveMipmapLevel = 0; -let _oldXrEnabled = false; -const PHI = (1 + Math.sqrt(5)) / 2; -const INV_PHI = 1 / PHI; -const _axisDirections = [ - /* @__PURE__ */ new Vector3(-PHI, INV_PHI, 0), - /* @__PURE__ */ new Vector3(PHI, INV_PHI, 0), - /* @__PURE__ */ new Vector3(-INV_PHI, 0, PHI), - /* @__PURE__ */ new Vector3(INV_PHI, 0, PHI), - /* @__PURE__ */ new Vector3(0, PHI, -INV_PHI), - /* @__PURE__ */ new Vector3(0, PHI, INV_PHI), - /* @__PURE__ */ new Vector3(-1, 1, -1), - /* @__PURE__ */ new Vector3(1, 1, -1), - /* @__PURE__ */ new Vector3(-1, 1, 1), - /* @__PURE__ */ new Vector3(1, 1, 1) -]; -class PMREMGenerator { - static { - __name(this, "PMREMGenerator"); - } - constructor(renderer) { - this._renderer = renderer; - this._pingPongRenderTarget = null; - this._lodMax = 0; - this._cubeSize = 0; - this._lodPlanes = []; - this._sizeLods = []; - this._sigmas = []; - this._blurMaterial = null; - this._cubemapMaterial = null; - this._equirectMaterial = null; - this._compileMaterial(this._blurMaterial); - } - /** - * Generates a PMREM from a supplied Scene, which can be faster than using an - * image if networking bandwidth is low. Optional sigma specifies a blur radius - * in radians to be applied to the scene before PMREM generation. Optional near - * and far planes ensure the scene is rendered in its entirety (the cubeCamera - * is placed at the origin). - */ - fromScene(scene, sigma = 0, near = 0.1, far = 100) { - _oldTarget = this._renderer.getRenderTarget(); - _oldActiveCubeFace = this._renderer.getActiveCubeFace(); - _oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel(); - _oldXrEnabled = this._renderer.xr.enabled; - this._renderer.xr.enabled = false; - this._setSize(256); - const cubeUVRenderTarget = this._allocateTargets(); - cubeUVRenderTarget.depthBuffer = true; - this._sceneToCubeUV(scene, near, far, cubeUVRenderTarget); - if (sigma > 0) { - this._blur(cubeUVRenderTarget, 0, 0, sigma); - } - this._applyPMREM(cubeUVRenderTarget); - this._cleanup(cubeUVRenderTarget); - return cubeUVRenderTarget; - } - /** - * Generates a PMREM from an equirectangular texture, which can be either LDR - * or HDR. The ideal input image size is 1k (1024 x 512), - * as this matches best with the 256 x 256 cubemap output. - * The smallest supported equirectangular image size is 64 x 32. - */ - fromEquirectangular(equirectangular, renderTarget = null) { - return this._fromTexture(equirectangular, renderTarget); - } - /** - * Generates a PMREM from an cubemap texture, which can be either LDR - * or HDR. The ideal input cube size is 256 x 256, - * as this matches best with the 256 x 256 cubemap output. - * The smallest supported cube size is 16 x 16. - */ - fromCubemap(cubemap, renderTarget = null) { - return this._fromTexture(cubemap, renderTarget); - } - /** - * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - */ - compileCubemapShader() { - if (this._cubemapMaterial === null) { - this._cubemapMaterial = _getCubemapMaterial(); - this._compileMaterial(this._cubemapMaterial); - } - } - /** - * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - */ - compileEquirectangularShader() { - if (this._equirectMaterial === null) { - this._equirectMaterial = _getEquirectMaterial(); - this._compileMaterial(this._equirectMaterial); - } - } - /** - * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, - * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on - * one of them will cause any others to also become unusable. - */ - dispose() { - this._dispose(); - if (this._cubemapMaterial !== null) this._cubemapMaterial.dispose(); - if (this._equirectMaterial !== null) this._equirectMaterial.dispose(); - } - // private interface - _setSize(cubeSize) { - this._lodMax = Math.floor(Math.log2(cubeSize)); - this._cubeSize = Math.pow(2, this._lodMax); - } - _dispose() { - if (this._blurMaterial !== null) this._blurMaterial.dispose(); - if (this._pingPongRenderTarget !== null) this._pingPongRenderTarget.dispose(); - for (let i = 0; i < this._lodPlanes.length; i++) { - this._lodPlanes[i].dispose(); - } - } - _cleanup(outputTarget) { - this._renderer.setRenderTarget(_oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel); - this._renderer.xr.enabled = _oldXrEnabled; - outputTarget.scissorTest = false; - _setViewport(outputTarget, 0, 0, outputTarget.width, outputTarget.height); - } - _fromTexture(texture, renderTarget) { - if (texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping) { - this._setSize(texture.image.length === 0 ? 16 : texture.image[0].width || texture.image[0].image.width); - } else { - this._setSize(texture.image.width / 4); - } - _oldTarget = this._renderer.getRenderTarget(); - _oldActiveCubeFace = this._renderer.getActiveCubeFace(); - _oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel(); - _oldXrEnabled = this._renderer.xr.enabled; - this._renderer.xr.enabled = false; - const cubeUVRenderTarget = renderTarget || this._allocateTargets(); - this._textureToCubeUV(texture, cubeUVRenderTarget); - this._applyPMREM(cubeUVRenderTarget); - this._cleanup(cubeUVRenderTarget); - return cubeUVRenderTarget; - } - _allocateTargets() { - const width = 3 * Math.max(this._cubeSize, 16 * 7); - const height = 4 * this._cubeSize; - const params = { - magFilter: LinearFilter, - minFilter: LinearFilter, - generateMipmaps: false, - type: HalfFloatType, - format: RGBAFormat, - colorSpace: LinearSRGBColorSpace, - depthBuffer: false - }; - const cubeUVRenderTarget = _createRenderTarget(width, height, params); - if (this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height) { - if (this._pingPongRenderTarget !== null) { - this._dispose(); - } - this._pingPongRenderTarget = _createRenderTarget(width, height, params); - const { _lodMax } = this; - ({ sizeLods: this._sizeLods, lodPlanes: this._lodPlanes, sigmas: this._sigmas } = _createPlanes(_lodMax)); - this._blurMaterial = _getBlurShader(_lodMax, width, height); - } - return cubeUVRenderTarget; - } - _compileMaterial(material) { - const tmpMesh = new Mesh(this._lodPlanes[0], material); - this._renderer.compile(tmpMesh, _flatCamera); - } - _sceneToCubeUV(scene, near, far, cubeUVRenderTarget) { - const fov2 = 90; - const aspect2 = 1; - const cubeCamera = new PerspectiveCamera(fov2, aspect2, near, far); - const upSign = [1, -1, 1, 1, 1, 1]; - const forwardSign = [1, 1, 1, -1, -1, -1]; - const renderer = this._renderer; - const originalAutoClear = renderer.autoClear; - const toneMapping = renderer.toneMapping; - renderer.getClearColor(_clearColor); - renderer.toneMapping = NoToneMapping; - renderer.autoClear = false; - const backgroundMaterial = new MeshBasicMaterial({ - name: "PMREM.Background", - side: BackSide, - depthWrite: false, - depthTest: false - }); - const backgroundBox = new Mesh(new BoxGeometry(), backgroundMaterial); - let useSolidColor = false; - const background = scene.background; - if (background) { - if (background.isColor) { - backgroundMaterial.color.copy(background); - scene.background = null; - useSolidColor = true; - } - } else { - backgroundMaterial.color.copy(_clearColor); - useSolidColor = true; - } - for (let i = 0; i < 6; i++) { - const col = i % 3; - if (col === 0) { - cubeCamera.up.set(0, upSign[i], 0); - cubeCamera.lookAt(forwardSign[i], 0, 0); - } else if (col === 1) { - cubeCamera.up.set(0, 0, upSign[i]); - cubeCamera.lookAt(0, forwardSign[i], 0); - } else { - cubeCamera.up.set(0, upSign[i], 0); - cubeCamera.lookAt(0, 0, forwardSign[i]); - } - const size = this._cubeSize; - _setViewport(cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size); - renderer.setRenderTarget(cubeUVRenderTarget); - if (useSolidColor) { - renderer.render(backgroundBox, cubeCamera); - } - renderer.render(scene, cubeCamera); - } - backgroundBox.geometry.dispose(); - backgroundBox.material.dispose(); - renderer.toneMapping = toneMapping; - renderer.autoClear = originalAutoClear; - scene.background = background; - } - _textureToCubeUV(texture, cubeUVRenderTarget) { - const renderer = this._renderer; - const isCubeTexture = texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping; - if (isCubeTexture) { - if (this._cubemapMaterial === null) { - this._cubemapMaterial = _getCubemapMaterial(); - } - this._cubemapMaterial.uniforms.flipEnvMap.value = texture.isRenderTargetTexture === false ? -1 : 1; - } else { - if (this._equirectMaterial === null) { - this._equirectMaterial = _getEquirectMaterial(); - } - } - const material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial; - const mesh = new Mesh(this._lodPlanes[0], material); - const uniforms = material.uniforms; - uniforms["envMap"].value = texture; - const size = this._cubeSize; - _setViewport(cubeUVRenderTarget, 0, 0, 3 * size, 2 * size); - renderer.setRenderTarget(cubeUVRenderTarget); - renderer.render(mesh, _flatCamera); - } - _applyPMREM(cubeUVRenderTarget) { - const renderer = this._renderer; - const autoClear = renderer.autoClear; - renderer.autoClear = false; - const n = this._lodPlanes.length; - for (let i = 1; i < n; i++) { - const sigma = Math.sqrt(this._sigmas[i] * this._sigmas[i] - this._sigmas[i - 1] * this._sigmas[i - 1]); - const poleAxis = _axisDirections[(n - i - 1) % _axisDirections.length]; - this._blur(cubeUVRenderTarget, i - 1, i, sigma, poleAxis); - } - renderer.autoClear = autoClear; - } - /** - * This is a two-pass Gaussian blur for a cubemap. Normally this is done - * vertically and horizontally, but this breaks down on a cube. Here we apply - * the blur latitudinally (around the poles), and then longitudinally (towards - * the poles) to approximate the orthogonally-separable blur. It is least - * accurate at the poles, but still does a decent job. - */ - _blur(cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis) { - const pingPongRenderTarget = this._pingPongRenderTarget; - this._halfBlur( - cubeUVRenderTarget, - pingPongRenderTarget, - lodIn, - lodOut, - sigma, - "latitudinal", - poleAxis - ); - this._halfBlur( - pingPongRenderTarget, - cubeUVRenderTarget, - lodOut, - lodOut, - sigma, - "longitudinal", - poleAxis - ); - } - _halfBlur(targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis) { - const renderer = this._renderer; - const blurMaterial = this._blurMaterial; - if (direction !== "latitudinal" && direction !== "longitudinal") { - console.error( - "blur direction must be either latitudinal or longitudinal!" - ); - } - const STANDARD_DEVIATIONS = 3; - const blurMesh = new Mesh(this._lodPlanes[lodOut], blurMaterial); - const blurUniforms = blurMaterial.uniforms; - const pixels = this._sizeLods[lodIn] - 1; - const radiansPerPixel = isFinite(sigmaRadians) ? Math.PI / (2 * pixels) : 2 * Math.PI / (2 * MAX_SAMPLES - 1); - const sigmaPixels = sigmaRadians / radiansPerPixel; - const samples = isFinite(sigmaRadians) ? 1 + Math.floor(STANDARD_DEVIATIONS * sigmaPixels) : MAX_SAMPLES; - if (samples > MAX_SAMPLES) { - console.warn(`sigmaRadians, ${sigmaRadians}, is too large and will clip, as it requested ${samples} samples when the maximum is set to ${MAX_SAMPLES}`); - } - const weights = []; - let sum = 0; - for (let i = 0; i < MAX_SAMPLES; ++i) { - const x2 = i / sigmaPixels; - const weight = Math.exp(-x2 * x2 / 2); - weights.push(weight); - if (i === 0) { - sum += weight; - } else if (i < samples) { - sum += 2 * weight; - } - } - for (let i = 0; i < weights.length; i++) { - weights[i] = weights[i] / sum; - } - blurUniforms["envMap"].value = targetIn.texture; - blurUniforms["samples"].value = samples; - blurUniforms["weights"].value = weights; - blurUniforms["latitudinal"].value = direction === "latitudinal"; - if (poleAxis) { - blurUniforms["poleAxis"].value = poleAxis; - } - const { _lodMax } = this; - blurUniforms["dTheta"].value = radiansPerPixel; - blurUniforms["mipInt"].value = _lodMax - lodIn; - const outputSize = this._sizeLods[lodOut]; - const x = 3 * outputSize * (lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0); - const y = 4 * (this._cubeSize - outputSize); - _setViewport(targetOut, x, y, 3 * outputSize, 2 * outputSize); - renderer.setRenderTarget(targetOut); - renderer.render(blurMesh, _flatCamera); - } -} -function _createPlanes(lodMax) { - const lodPlanes = []; - const sizeLods = []; - const sigmas = []; - let lod = lodMax; - const totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length; - for (let i = 0; i < totalLods; i++) { - const sizeLod = Math.pow(2, lod); - sizeLods.push(sizeLod); - let sigma = 1 / sizeLod; - if (i > lodMax - LOD_MIN) { - sigma = EXTRA_LOD_SIGMA[i - lodMax + LOD_MIN - 1]; - } else if (i === 0) { - sigma = 0; - } - sigmas.push(sigma); - const texelSize = 1 / (sizeLod - 2); - const min = -texelSize; - const max2 = 1 + texelSize; - const uv1 = [min, min, max2, min, max2, max2, min, min, max2, max2, min, max2]; - const cubeFaces = 6; - const vertices = 6; - const positionSize = 3; - const uvSize = 2; - const faceIndexSize = 1; - const position = new Float32Array(positionSize * vertices * cubeFaces); - const uv = new Float32Array(uvSize * vertices * cubeFaces); - const faceIndex = new Float32Array(faceIndexSize * vertices * cubeFaces); - for (let face = 0; face < cubeFaces; face++) { - const x = face % 3 * 2 / 3 - 1; - const y = face > 2 ? 0 : -1; - const coordinates = [ - x, - y, - 0, - x + 2 / 3, - y, - 0, - x + 2 / 3, - y + 1, - 0, - x, - y, - 0, - x + 2 / 3, - y + 1, - 0, - x, - y + 1, - 0 - ]; - position.set(coordinates, positionSize * vertices * face); - uv.set(uv1, uvSize * vertices * face); - const fill2 = [face, face, face, face, face, face]; - faceIndex.set(fill2, faceIndexSize * vertices * face); - } - const planes = new BufferGeometry(); - planes.setAttribute("position", new BufferAttribute(position, positionSize)); - planes.setAttribute("uv", new BufferAttribute(uv, uvSize)); - planes.setAttribute("faceIndex", new BufferAttribute(faceIndex, faceIndexSize)); - lodPlanes.push(planes); - if (lod > LOD_MIN) { - lod--; - } - } - return { lodPlanes, sizeLods, sigmas }; -} -__name(_createPlanes, "_createPlanes"); -function _createRenderTarget(width, height, params) { - const cubeUVRenderTarget = new WebGLRenderTarget(width, height, params); - cubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping; - cubeUVRenderTarget.texture.name = "PMREM.cubeUv"; - cubeUVRenderTarget.scissorTest = true; - return cubeUVRenderTarget; -} -__name(_createRenderTarget, "_createRenderTarget"); -function _setViewport(target, x, y, width, height) { - target.viewport.set(x, y, width, height); - target.scissor.set(x, y, width, height); -} -__name(_setViewport, "_setViewport"); -function _getBlurShader(lodMax, width, height) { - const weights = new Float32Array(MAX_SAMPLES); - const poleAxis = new Vector3(0, 1, 0); - const shaderMaterial = new ShaderMaterial({ - name: "SphericalGaussianBlur", - defines: { - "n": MAX_SAMPLES, - "CUBEUV_TEXEL_WIDTH": 1 / width, - "CUBEUV_TEXEL_HEIGHT": 1 / height, - "CUBEUV_MAX_MIP": `${lodMax}.0` - }, - uniforms: { - "envMap": { value: null }, - "samples": { value: 1 }, - "weights": { value: weights }, - "latitudinal": { value: false }, - "dTheta": { value: 0 }, - "mipInt": { value: 0 }, - "poleAxis": { value: poleAxis } - }, - vertexShader: _getCommonVertexShader(), - fragmentShader: ( - /* glsl */ - ` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform int samples; - uniform float weights[ n ]; - uniform bool latitudinal; - uniform float dTheta; - uniform float mipInt; - uniform vec3 poleAxis; - - #define ENVMAP_TYPE_CUBE_UV - #include - - vec3 getSample( float theta, vec3 axis ) { - - float cosTheta = cos( theta ); - // Rodrigues' axis-angle rotation - vec3 sampleDirection = vOutputDirection * cosTheta - + cross( axis, vOutputDirection ) * sin( theta ) - + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); - - return bilinearCubeUV( envMap, sampleDirection, mipInt ); - - } - - void main() { - - vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); - - if ( all( equal( axis, vec3( 0.0 ) ) ) ) { - - axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); - - } - - axis = normalize( axis ); - - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); - - for ( int i = 1; i < n; i++ ) { - - if ( i >= samples ) { - - break; - - } - - float theta = dTheta * float( i ); - gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); - gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); - - } - - } - ` - ), - blending: NoBlending, - depthTest: false, - depthWrite: false - }); - return shaderMaterial; -} -__name(_getBlurShader, "_getBlurShader"); -function _getEquirectMaterial() { - return new ShaderMaterial({ - name: "EquirectangularToCubeUV", - uniforms: { - "envMap": { value: null } - }, - vertexShader: _getCommonVertexShader(), - fragmentShader: ( - /* glsl */ - ` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - - #include - - void main() { - - vec3 outputDirection = normalize( vOutputDirection ); - vec2 uv = equirectUv( outputDirection ); - - gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); - - } - ` - ), - blending: NoBlending, - depthTest: false, - depthWrite: false - }); -} -__name(_getEquirectMaterial, "_getEquirectMaterial"); -function _getCubemapMaterial() { - return new ShaderMaterial({ - name: "CubemapToCubeUV", - uniforms: { - "envMap": { value: null }, - "flipEnvMap": { value: -1 } - }, - vertexShader: _getCommonVertexShader(), - fragmentShader: ( - /* glsl */ - ` - - precision mediump float; - precision mediump int; - - uniform float flipEnvMap; - - varying vec3 vOutputDirection; - - uniform samplerCube envMap; - - void main() { - - gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); - - } - ` - ), - blending: NoBlending, - depthTest: false, - depthWrite: false - }); -} -__name(_getCubemapMaterial, "_getCubemapMaterial"); -function _getCommonVertexShader() { - return ( - /* glsl */ - ` - - precision mediump float; - precision mediump int; - - attribute float faceIndex; - - varying vec3 vOutputDirection; - - // RH coordinate system; PMREM face-indexing convention - vec3 getDirection( vec2 uv, float face ) { - - uv = 2.0 * uv - 1.0; - - vec3 direction = vec3( uv, 1.0 ); - - if ( face == 0.0 ) { - - direction = direction.zyx; // ( 1, v, u ) pos x - - } else if ( face == 1.0 ) { - - direction = direction.xzy; - direction.xz *= -1.0; // ( -u, 1, -v ) pos y - - } else if ( face == 2.0 ) { - - direction.x *= -1.0; // ( -u, v, 1 ) pos z - - } else if ( face == 3.0 ) { - - direction = direction.zyx; - direction.xz *= -1.0; // ( -1, v, -u ) neg x - - } else if ( face == 4.0 ) { - - direction = direction.xzy; - direction.xy *= -1.0; // ( -u, -1, v ) neg y - - } else if ( face == 5.0 ) { - - direction.z *= -1.0; // ( u, v, -1 ) neg z - - } - - return direction; - - } - - void main() { - - vOutputDirection = getDirection( uv, faceIndex ); - gl_Position = vec4( position, 1.0 ); - - } - ` - ); -} -__name(_getCommonVertexShader, "_getCommonVertexShader"); -function WebGLCubeUVMaps(renderer) { - let cubeUVmaps = /* @__PURE__ */ new WeakMap(); - let pmremGenerator = null; - function get(texture) { - if (texture && texture.isTexture) { - const mapping = texture.mapping; - const isEquirectMap = mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping; - const isCubeMap = mapping === CubeReflectionMapping || mapping === CubeRefractionMapping; - if (isEquirectMap || isCubeMap) { - let renderTarget = cubeUVmaps.get(texture); - const currentPMREMVersion = renderTarget !== void 0 ? renderTarget.texture.pmremVersion : 0; - if (texture.isRenderTargetTexture && texture.pmremVersion !== currentPMREMVersion) { - if (pmremGenerator === null) pmremGenerator = new PMREMGenerator(renderer); - renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture, renderTarget) : pmremGenerator.fromCubemap(texture, renderTarget); - renderTarget.texture.pmremVersion = texture.pmremVersion; - cubeUVmaps.set(texture, renderTarget); - return renderTarget.texture; - } else { - if (renderTarget !== void 0) { - return renderTarget.texture; - } else { - const image = texture.image; - if (isEquirectMap && image && image.height > 0 || isCubeMap && image && isCubeTextureComplete(image)) { - if (pmremGenerator === null) pmremGenerator = new PMREMGenerator(renderer); - renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture) : pmremGenerator.fromCubemap(texture); - renderTarget.texture.pmremVersion = texture.pmremVersion; - cubeUVmaps.set(texture, renderTarget); - texture.addEventListener("dispose", onTextureDispose); - return renderTarget.texture; - } else { - return null; - } - } - } - } - } - return texture; - } - __name(get, "get"); - function isCubeTextureComplete(image) { - let count = 0; - const length = 6; - for (let i = 0; i < length; i++) { - if (image[i] !== void 0) count++; - } - return count === length; - } - __name(isCubeTextureComplete, "isCubeTextureComplete"); - function onTextureDispose(event) { - const texture = event.target; - texture.removeEventListener("dispose", onTextureDispose); - const cubemapUV = cubeUVmaps.get(texture); - if (cubemapUV !== void 0) { - cubeUVmaps.delete(texture); - cubemapUV.dispose(); - } - } - __name(onTextureDispose, "onTextureDispose"); - function dispose() { - cubeUVmaps = /* @__PURE__ */ new WeakMap(); - if (pmremGenerator !== null) { - pmremGenerator.dispose(); - pmremGenerator = null; - } - } - __name(dispose, "dispose"); - return { - get, - dispose - }; -} -__name(WebGLCubeUVMaps, "WebGLCubeUVMaps"); -function WebGLExtensions(gl) { - const extensions = {}; - function getExtension(name) { - if (extensions[name] !== void 0) { - return extensions[name]; - } - let extension; - switch (name) { - case "WEBGL_depth_texture": - extension = gl.getExtension("WEBGL_depth_texture") || gl.getExtension("MOZ_WEBGL_depth_texture") || gl.getExtension("WEBKIT_WEBGL_depth_texture"); - break; - case "EXT_texture_filter_anisotropic": - extension = gl.getExtension("EXT_texture_filter_anisotropic") || gl.getExtension("MOZ_EXT_texture_filter_anisotropic") || gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic"); - break; - case "WEBGL_compressed_texture_s3tc": - extension = gl.getExtension("WEBGL_compressed_texture_s3tc") || gl.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"); - break; - case "WEBGL_compressed_texture_pvrtc": - extension = gl.getExtension("WEBGL_compressed_texture_pvrtc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"); - break; - default: - extension = gl.getExtension(name); - } - extensions[name] = extension; - return extension; - } - __name(getExtension, "getExtension"); - return { - has: /* @__PURE__ */ __name(function(name) { - return getExtension(name) !== null; - }, "has"), - init: /* @__PURE__ */ __name(function() { - getExtension("EXT_color_buffer_float"); - getExtension("WEBGL_clip_cull_distance"); - getExtension("OES_texture_float_linear"); - getExtension("EXT_color_buffer_half_float"); - getExtension("WEBGL_multisampled_render_to_texture"); - getExtension("WEBGL_render_shared_exponent"); - }, "init"), - get: /* @__PURE__ */ __name(function(name) { - const extension = getExtension(name); - if (extension === null) { - warnOnce("THREE.WebGLRenderer: " + name + " extension not supported."); - } - return extension; - }, "get") - }; -} -__name(WebGLExtensions, "WebGLExtensions"); -function WebGLGeometries(gl, attributes, info, bindingStates) { - const geometries = {}; - const wireframeAttributes = /* @__PURE__ */ new WeakMap(); - function onGeometryDispose(event) { - const geometry = event.target; - if (geometry.index !== null) { - attributes.remove(geometry.index); - } - for (const name in geometry.attributes) { - attributes.remove(geometry.attributes[name]); - } - for (const name in geometry.morphAttributes) { - const array = geometry.morphAttributes[name]; - for (let i = 0, l = array.length; i < l; i++) { - attributes.remove(array[i]); - } - } - geometry.removeEventListener("dispose", onGeometryDispose); - delete geometries[geometry.id]; - const attribute = wireframeAttributes.get(geometry); - if (attribute) { - attributes.remove(attribute); - wireframeAttributes.delete(geometry); - } - bindingStates.releaseStatesOfGeometry(geometry); - if (geometry.isInstancedBufferGeometry === true) { - delete geometry._maxInstanceCount; - } - info.memory.geometries--; - } - __name(onGeometryDispose, "onGeometryDispose"); - function get(object, geometry) { - if (geometries[geometry.id] === true) return geometry; - geometry.addEventListener("dispose", onGeometryDispose); - geometries[geometry.id] = true; - info.memory.geometries++; - return geometry; - } - __name(get, "get"); - function update(geometry) { - const geometryAttributes = geometry.attributes; - for (const name in geometryAttributes) { - attributes.update(geometryAttributes[name], gl.ARRAY_BUFFER); - } - const morphAttributes = geometry.morphAttributes; - for (const name in morphAttributes) { - const array = morphAttributes[name]; - for (let i = 0, l = array.length; i < l; i++) { - attributes.update(array[i], gl.ARRAY_BUFFER); - } - } - } - __name(update, "update"); - function updateWireframeAttribute(geometry) { - const indices = []; - const geometryIndex = geometry.index; - const geometryPosition = geometry.attributes.position; - let version = 0; - if (geometryIndex !== null) { - const array = geometryIndex.array; - version = geometryIndex.version; - for (let i = 0, l = array.length; i < l; i += 3) { - const a = array[i + 0]; - const b = array[i + 1]; - const c = array[i + 2]; - indices.push(a, b, b, c, c, a); - } - } else if (geometryPosition !== void 0) { - const array = geometryPosition.array; - version = geometryPosition.version; - for (let i = 0, l = array.length / 3 - 1; i < l; i += 3) { - const a = i + 0; - const b = i + 1; - const c = i + 2; - indices.push(a, b, b, c, c, a); - } - } else { - return; - } - const attribute = new (arrayNeedsUint32(indices) ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1); - attribute.version = version; - const previousAttribute = wireframeAttributes.get(geometry); - if (previousAttribute) attributes.remove(previousAttribute); - wireframeAttributes.set(geometry, attribute); - } - __name(updateWireframeAttribute, "updateWireframeAttribute"); - function getWireframeAttribute(geometry) { - const currentAttribute = wireframeAttributes.get(geometry); - if (currentAttribute) { - const geometryIndex = geometry.index; - if (geometryIndex !== null) { - if (currentAttribute.version < geometryIndex.version) { - updateWireframeAttribute(geometry); - } - } - } else { - updateWireframeAttribute(geometry); - } - return wireframeAttributes.get(geometry); - } - __name(getWireframeAttribute, "getWireframeAttribute"); - return { - get, - update, - getWireframeAttribute - }; -} -__name(WebGLGeometries, "WebGLGeometries"); -function WebGLIndexedBufferRenderer(gl, extensions, info) { - let mode; - function setMode(value) { - mode = value; - } - __name(setMode, "setMode"); - let type, bytesPerElement; - function setIndex(value) { - type = value.type; - bytesPerElement = value.bytesPerElement; - } - __name(setIndex, "setIndex"); - function render(start, count) { - gl.drawElements(mode, count, type, start * bytesPerElement); - info.update(count, mode, 1); - } - __name(render, "render"); - function renderInstances(start, count, primcount) { - if (primcount === 0) return; - gl.drawElementsInstanced(mode, count, type, start * bytesPerElement, primcount); - info.update(count, mode, primcount); - } - __name(renderInstances, "renderInstances"); - function renderMultiDraw(starts, counts, drawCount) { - if (drawCount === 0) return; - const extension = extensions.get("WEBGL_multi_draw"); - extension.multiDrawElementsWEBGL(mode, counts, 0, type, starts, 0, drawCount); - let elementCount = 0; - for (let i = 0; i < drawCount; i++) { - elementCount += counts[i]; - } - info.update(elementCount, mode, 1); - } - __name(renderMultiDraw, "renderMultiDraw"); - function renderMultiDrawInstances(starts, counts, drawCount, primcount) { - if (drawCount === 0) return; - const extension = extensions.get("WEBGL_multi_draw"); - if (extension === null) { - for (let i = 0; i < starts.length; i++) { - renderInstances(starts[i] / bytesPerElement, counts[i], primcount[i]); - } - } else { - extension.multiDrawElementsInstancedWEBGL(mode, counts, 0, type, starts, 0, primcount, 0, drawCount); - let elementCount = 0; - for (let i = 0; i < drawCount; i++) { - elementCount += counts[i] * primcount[i]; - } - info.update(elementCount, mode, 1); - } - } - __name(renderMultiDrawInstances, "renderMultiDrawInstances"); - this.setMode = setMode; - this.setIndex = setIndex; - this.render = render; - this.renderInstances = renderInstances; - this.renderMultiDraw = renderMultiDraw; - this.renderMultiDrawInstances = renderMultiDrawInstances; -} -__name(WebGLIndexedBufferRenderer, "WebGLIndexedBufferRenderer"); -function WebGLInfo(gl) { - const memory = { - geometries: 0, - textures: 0 - }; - const render = { - frame: 0, - calls: 0, - triangles: 0, - points: 0, - lines: 0 - }; - function update(count, mode, instanceCount) { - render.calls++; - switch (mode) { - case gl.TRIANGLES: - render.triangles += instanceCount * (count / 3); - break; - case gl.LINES: - render.lines += instanceCount * (count / 2); - break; - case gl.LINE_STRIP: - render.lines += instanceCount * (count - 1); - break; - case gl.LINE_LOOP: - render.lines += instanceCount * count; - break; - case gl.POINTS: - render.points += instanceCount * count; - break; - default: - console.error("THREE.WebGLInfo: Unknown draw mode:", mode); - break; - } - } - __name(update, "update"); - function reset() { - render.calls = 0; - render.triangles = 0; - render.points = 0; - render.lines = 0; - } - __name(reset, "reset"); - return { - memory, - render, - programs: null, - autoReset: true, - reset, - update - }; -} -__name(WebGLInfo, "WebGLInfo"); -function WebGLMorphtargets(gl, capabilities, textures) { - const morphTextures = /* @__PURE__ */ new WeakMap(); - const morph = new Vector4(); - function update(object, geometry, program) { - const objectInfluences = object.morphTargetInfluences; - const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color; - const morphTargetsCount = morphAttribute !== void 0 ? morphAttribute.length : 0; - let entry = morphTextures.get(geometry); - if (entry === void 0 || entry.count !== morphTargetsCount) { - let disposeTexture = function() { - texture.dispose(); - morphTextures.delete(geometry); - geometry.removeEventListener("dispose", disposeTexture); - }; - __name(disposeTexture, "disposeTexture"); - if (entry !== void 0) entry.texture.dispose(); - const hasMorphPosition = geometry.morphAttributes.position !== void 0; - const hasMorphNormals = geometry.morphAttributes.normal !== void 0; - const hasMorphColors = geometry.morphAttributes.color !== void 0; - const morphTargets = geometry.morphAttributes.position || []; - const morphNormals = geometry.morphAttributes.normal || []; - const morphColors = geometry.morphAttributes.color || []; - let vertexDataCount = 0; - if (hasMorphPosition === true) vertexDataCount = 1; - if (hasMorphNormals === true) vertexDataCount = 2; - if (hasMorphColors === true) vertexDataCount = 3; - let width = geometry.attributes.position.count * vertexDataCount; - let height = 1; - if (width > capabilities.maxTextureSize) { - height = Math.ceil(width / capabilities.maxTextureSize); - width = capabilities.maxTextureSize; - } - const buffer = new Float32Array(width * height * 4 * morphTargetsCount); - const texture = new DataArrayTexture(buffer, width, height, morphTargetsCount); - texture.type = FloatType; - texture.needsUpdate = true; - const vertexDataStride = vertexDataCount * 4; - for (let i = 0; i < morphTargetsCount; i++) { - const morphTarget = morphTargets[i]; - const morphNormal = morphNormals[i]; - const morphColor = morphColors[i]; - const offset = width * height * 4 * i; - for (let j = 0; j < morphTarget.count; j++) { - const stride = j * vertexDataStride; - if (hasMorphPosition === true) { - morph.fromBufferAttribute(morphTarget, j); - buffer[offset + stride + 0] = morph.x; - buffer[offset + stride + 1] = morph.y; - buffer[offset + stride + 2] = morph.z; - buffer[offset + stride + 3] = 0; - } - if (hasMorphNormals === true) { - morph.fromBufferAttribute(morphNormal, j); - buffer[offset + stride + 4] = morph.x; - buffer[offset + stride + 5] = morph.y; - buffer[offset + stride + 6] = morph.z; - buffer[offset + stride + 7] = 0; - } - if (hasMorphColors === true) { - morph.fromBufferAttribute(morphColor, j); - buffer[offset + stride + 8] = morph.x; - buffer[offset + stride + 9] = morph.y; - buffer[offset + stride + 10] = morph.z; - buffer[offset + stride + 11] = morphColor.itemSize === 4 ? morph.w : 1; - } - } - } - entry = { - count: morphTargetsCount, - texture, - size: new Vector2(width, height) - }; - morphTextures.set(geometry, entry); - geometry.addEventListener("dispose", disposeTexture); - } - if (object.isInstancedMesh === true && object.morphTexture !== null) { - program.getUniforms().setValue(gl, "morphTexture", object.morphTexture, textures); - } else { - let morphInfluencesSum = 0; - for (let i = 0; i < objectInfluences.length; i++) { - morphInfluencesSum += objectInfluences[i]; - } - const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum; - program.getUniforms().setValue(gl, "morphTargetBaseInfluence", morphBaseInfluence); - program.getUniforms().setValue(gl, "morphTargetInfluences", objectInfluences); - } - program.getUniforms().setValue(gl, "morphTargetsTexture", entry.texture, textures); - program.getUniforms().setValue(gl, "morphTargetsTextureSize", entry.size); - } - __name(update, "update"); - return { - update - }; -} -__name(WebGLMorphtargets, "WebGLMorphtargets"); -function WebGLObjects(gl, geometries, attributes, info) { - let updateMap = /* @__PURE__ */ new WeakMap(); - function update(object) { - const frame = info.render.frame; - const geometry = object.geometry; - const buffergeometry = geometries.get(object, geometry); - if (updateMap.get(buffergeometry) !== frame) { - geometries.update(buffergeometry); - updateMap.set(buffergeometry, frame); - } - if (object.isInstancedMesh) { - if (object.hasEventListener("dispose", onInstancedMeshDispose) === false) { - object.addEventListener("dispose", onInstancedMeshDispose); - } - if (updateMap.get(object) !== frame) { - attributes.update(object.instanceMatrix, gl.ARRAY_BUFFER); - if (object.instanceColor !== null) { - attributes.update(object.instanceColor, gl.ARRAY_BUFFER); - } - updateMap.set(object, frame); - } - } - if (object.isSkinnedMesh) { - const skeleton = object.skeleton; - if (updateMap.get(skeleton) !== frame) { - skeleton.update(); - updateMap.set(skeleton, frame); - } - } - return buffergeometry; - } - __name(update, "update"); - function dispose() { - updateMap = /* @__PURE__ */ new WeakMap(); - } - __name(dispose, "dispose"); - function onInstancedMeshDispose(event) { - const instancedMesh = event.target; - instancedMesh.removeEventListener("dispose", onInstancedMeshDispose); - attributes.remove(instancedMesh.instanceMatrix); - if (instancedMesh.instanceColor !== null) attributes.remove(instancedMesh.instanceColor); - } - __name(onInstancedMeshDispose, "onInstancedMeshDispose"); - return { - update, - dispose - }; -} -__name(WebGLObjects, "WebGLObjects"); -class DepthTexture extends Texture { - static { - __name(this, "DepthTexture"); - } - constructor(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format = DepthFormat) { - if (format !== DepthFormat && format !== DepthStencilFormat) { - throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat"); - } - if (type === void 0 && format === DepthFormat) type = UnsignedIntType; - if (type === void 0 && format === DepthStencilFormat) type = UnsignedInt248Type; - super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); - this.isDepthTexture = true; - this.image = { width, height }; - this.magFilter = magFilter !== void 0 ? magFilter : NearestFilter; - this.minFilter = minFilter !== void 0 ? minFilter : NearestFilter; - this.flipY = false; - this.generateMipmaps = false; - this.compareFunction = null; - } - copy(source) { - super.copy(source); - this.compareFunction = source.compareFunction; - return this; - } - toJSON(meta) { - const data = super.toJSON(meta); - if (this.compareFunction !== null) data.compareFunction = this.compareFunction; - return data; - } -} -const emptyTexture = /* @__PURE__ */ new Texture(); -const emptyShadowTexture = /* @__PURE__ */ new DepthTexture(1, 1); -const emptyArrayTexture = /* @__PURE__ */ new DataArrayTexture(); -const empty3dTexture = /* @__PURE__ */ new Data3DTexture(); -const emptyCubeTexture = /* @__PURE__ */ new CubeTexture(); -const arrayCacheF32 = []; -const arrayCacheI32 = []; -const mat4array = new Float32Array(16); -const mat3array = new Float32Array(9); -const mat2array = new Float32Array(4); -function flatten(array, nBlocks, blockSize) { - const firstElem = array[0]; - if (firstElem <= 0 || firstElem > 0) return array; - const n = nBlocks * blockSize; - let r = arrayCacheF32[n]; - if (r === void 0) { - r = new Float32Array(n); - arrayCacheF32[n] = r; - } - if (nBlocks !== 0) { - firstElem.toArray(r, 0); - for (let i = 1, offset = 0; i !== nBlocks; ++i) { - offset += blockSize; - array[i].toArray(r, offset); - } - } - return r; -} -__name(flatten, "flatten"); -function arraysEqual(a, b) { - if (a.length !== b.length) return false; - for (let i = 0, l = a.length; i < l; i++) { - if (a[i] !== b[i]) return false; - } - return true; -} -__name(arraysEqual, "arraysEqual"); -function copyArray(a, b) { - for (let i = 0, l = b.length; i < l; i++) { - a[i] = b[i]; - } -} -__name(copyArray, "copyArray"); -function allocTexUnits(textures, n) { - let r = arrayCacheI32[n]; - if (r === void 0) { - r = new Int32Array(n); - arrayCacheI32[n] = r; - } - for (let i = 0; i !== n; ++i) { - r[i] = textures.allocateTextureUnit(); - } - return r; -} -__name(allocTexUnits, "allocTexUnits"); -function setValueV1f(gl, v) { - const cache = this.cache; - if (cache[0] === v) return; - gl.uniform1f(this.addr, v); - cache[0] = v; -} -__name(setValueV1f, "setValueV1f"); -function setValueV2f(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y) { - gl.uniform2f(this.addr, v.x, v.y); - cache[0] = v.x; - cache[1] = v.y; - } - } else { - if (arraysEqual(cache, v)) return; - gl.uniform2fv(this.addr, v); - copyArray(cache, v); - } -} -__name(setValueV2f, "setValueV2f"); -function setValueV3f(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) { - gl.uniform3f(this.addr, v.x, v.y, v.z); - cache[0] = v.x; - cache[1] = v.y; - cache[2] = v.z; - } - } else if (v.r !== void 0) { - if (cache[0] !== v.r || cache[1] !== v.g || cache[2] !== v.b) { - gl.uniform3f(this.addr, v.r, v.g, v.b); - cache[0] = v.r; - cache[1] = v.g; - cache[2] = v.b; - } - } else { - if (arraysEqual(cache, v)) return; - gl.uniform3fv(this.addr, v); - copyArray(cache, v); - } -} -__name(setValueV3f, "setValueV3f"); -function setValueV4f(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) { - gl.uniform4f(this.addr, v.x, v.y, v.z, v.w); - cache[0] = v.x; - cache[1] = v.y; - cache[2] = v.z; - cache[3] = v.w; - } - } else { - if (arraysEqual(cache, v)) return; - gl.uniform4fv(this.addr, v); - copyArray(cache, v); - } -} -__name(setValueV4f, "setValueV4f"); -function setValueM2(gl, v) { - const cache = this.cache; - const elements = v.elements; - if (elements === void 0) { - if (arraysEqual(cache, v)) return; - gl.uniformMatrix2fv(this.addr, false, v); - copyArray(cache, v); - } else { - if (arraysEqual(cache, elements)) return; - mat2array.set(elements); - gl.uniformMatrix2fv(this.addr, false, mat2array); - copyArray(cache, elements); - } -} -__name(setValueM2, "setValueM2"); -function setValueM3(gl, v) { - const cache = this.cache; - const elements = v.elements; - if (elements === void 0) { - if (arraysEqual(cache, v)) return; - gl.uniformMatrix3fv(this.addr, false, v); - copyArray(cache, v); - } else { - if (arraysEqual(cache, elements)) return; - mat3array.set(elements); - gl.uniformMatrix3fv(this.addr, false, mat3array); - copyArray(cache, elements); - } -} -__name(setValueM3, "setValueM3"); -function setValueM4(gl, v) { - const cache = this.cache; - const elements = v.elements; - if (elements === void 0) { - if (arraysEqual(cache, v)) return; - gl.uniformMatrix4fv(this.addr, false, v); - copyArray(cache, v); - } else { - if (arraysEqual(cache, elements)) return; - mat4array.set(elements); - gl.uniformMatrix4fv(this.addr, false, mat4array); - copyArray(cache, elements); - } -} -__name(setValueM4, "setValueM4"); -function setValueV1i(gl, v) { - const cache = this.cache; - if (cache[0] === v) return; - gl.uniform1i(this.addr, v); - cache[0] = v; -} -__name(setValueV1i, "setValueV1i"); -function setValueV2i(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y) { - gl.uniform2i(this.addr, v.x, v.y); - cache[0] = v.x; - cache[1] = v.y; - } - } else { - if (arraysEqual(cache, v)) return; - gl.uniform2iv(this.addr, v); - copyArray(cache, v); - } -} -__name(setValueV2i, "setValueV2i"); -function setValueV3i(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) { - gl.uniform3i(this.addr, v.x, v.y, v.z); - cache[0] = v.x; - cache[1] = v.y; - cache[2] = v.z; - } - } else { - if (arraysEqual(cache, v)) return; - gl.uniform3iv(this.addr, v); - copyArray(cache, v); - } -} -__name(setValueV3i, "setValueV3i"); -function setValueV4i(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) { - gl.uniform4i(this.addr, v.x, v.y, v.z, v.w); - cache[0] = v.x; - cache[1] = v.y; - cache[2] = v.z; - cache[3] = v.w; - } - } else { - if (arraysEqual(cache, v)) return; - gl.uniform4iv(this.addr, v); - copyArray(cache, v); - } -} -__name(setValueV4i, "setValueV4i"); -function setValueV1ui(gl, v) { - const cache = this.cache; - if (cache[0] === v) return; - gl.uniform1ui(this.addr, v); - cache[0] = v; -} -__name(setValueV1ui, "setValueV1ui"); -function setValueV2ui(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y) { - gl.uniform2ui(this.addr, v.x, v.y); - cache[0] = v.x; - cache[1] = v.y; - } - } else { - if (arraysEqual(cache, v)) return; - gl.uniform2uiv(this.addr, v); - copyArray(cache, v); - } -} -__name(setValueV2ui, "setValueV2ui"); -function setValueV3ui(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) { - gl.uniform3ui(this.addr, v.x, v.y, v.z); - cache[0] = v.x; - cache[1] = v.y; - cache[2] = v.z; - } - } else { - if (arraysEqual(cache, v)) return; - gl.uniform3uiv(this.addr, v); - copyArray(cache, v); - } -} -__name(setValueV3ui, "setValueV3ui"); -function setValueV4ui(gl, v) { - const cache = this.cache; - if (v.x !== void 0) { - if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) { - gl.uniform4ui(this.addr, v.x, v.y, v.z, v.w); - cache[0] = v.x; - cache[1] = v.y; - cache[2] = v.z; - cache[3] = v.w; - } - } else { - if (arraysEqual(cache, v)) return; - gl.uniform4uiv(this.addr, v); - copyArray(cache, v); - } -} -__name(setValueV4ui, "setValueV4ui"); -function setValueT1(gl, v, textures) { - const cache = this.cache; - const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { - gl.uniform1i(this.addr, unit); - cache[0] = unit; - } - let emptyTexture2D; - if (this.type === gl.SAMPLER_2D_SHADOW) { - emptyShadowTexture.compareFunction = LessEqualCompare; - emptyTexture2D = emptyShadowTexture; - } else { - emptyTexture2D = emptyTexture; - } - textures.setTexture2D(v || emptyTexture2D, unit); -} -__name(setValueT1, "setValueT1"); -function setValueT3D1(gl, v, textures) { - const cache = this.cache; - const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { - gl.uniform1i(this.addr, unit); - cache[0] = unit; - } - textures.setTexture3D(v || empty3dTexture, unit); -} -__name(setValueT3D1, "setValueT3D1"); -function setValueT6(gl, v, textures) { - const cache = this.cache; - const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { - gl.uniform1i(this.addr, unit); - cache[0] = unit; - } - textures.setTextureCube(v || emptyCubeTexture, unit); -} -__name(setValueT6, "setValueT6"); -function setValueT2DArray1(gl, v, textures) { - const cache = this.cache; - const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { - gl.uniform1i(this.addr, unit); - cache[0] = unit; - } - textures.setTexture2DArray(v || emptyArrayTexture, unit); -} -__name(setValueT2DArray1, "setValueT2DArray1"); -function getSingularSetter(type) { - switch (type) { - case 5126: - return setValueV1f; - case 35664: - return setValueV2f; - case 35665: - return setValueV3f; - case 35666: - return setValueV4f; - case 35674: - return setValueM2; - case 35675: - return setValueM3; - case 35676: - return setValueM4; - case 5124: - case 35670: - return setValueV1i; - case 35667: - case 35671: - return setValueV2i; - case 35668: - case 35672: - return setValueV3i; - case 35669: - case 35673: - return setValueV4i; - case 5125: - return setValueV1ui; - case 36294: - return setValueV2ui; - case 36295: - return setValueV3ui; - case 36296: - return setValueV4ui; - case 35678: - case 36198: - case 36298: - case 36306: - case 35682: - return setValueT1; - case 35679: - case 36299: - case 36307: - return setValueT3D1; - case 35680: - case 36300: - case 36308: - case 36293: - return setValueT6; - case 36289: - case 36303: - case 36311: - case 36292: - return setValueT2DArray1; - } -} -__name(getSingularSetter, "getSingularSetter"); -function setValueV1fArray(gl, v) { - gl.uniform1fv(this.addr, v); -} -__name(setValueV1fArray, "setValueV1fArray"); -function setValueV2fArray(gl, v) { - const data = flatten(v, this.size, 2); - gl.uniform2fv(this.addr, data); -} -__name(setValueV2fArray, "setValueV2fArray"); -function setValueV3fArray(gl, v) { - const data = flatten(v, this.size, 3); - gl.uniform3fv(this.addr, data); -} -__name(setValueV3fArray, "setValueV3fArray"); -function setValueV4fArray(gl, v) { - const data = flatten(v, this.size, 4); - gl.uniform4fv(this.addr, data); -} -__name(setValueV4fArray, "setValueV4fArray"); -function setValueM2Array(gl, v) { - const data = flatten(v, this.size, 4); - gl.uniformMatrix2fv(this.addr, false, data); -} -__name(setValueM2Array, "setValueM2Array"); -function setValueM3Array(gl, v) { - const data = flatten(v, this.size, 9); - gl.uniformMatrix3fv(this.addr, false, data); -} -__name(setValueM3Array, "setValueM3Array"); -function setValueM4Array(gl, v) { - const data = flatten(v, this.size, 16); - gl.uniformMatrix4fv(this.addr, false, data); -} -__name(setValueM4Array, "setValueM4Array"); -function setValueV1iArray(gl, v) { - gl.uniform1iv(this.addr, v); -} -__name(setValueV1iArray, "setValueV1iArray"); -function setValueV2iArray(gl, v) { - gl.uniform2iv(this.addr, v); -} -__name(setValueV2iArray, "setValueV2iArray"); -function setValueV3iArray(gl, v) { - gl.uniform3iv(this.addr, v); -} -__name(setValueV3iArray, "setValueV3iArray"); -function setValueV4iArray(gl, v) { - gl.uniform4iv(this.addr, v); -} -__name(setValueV4iArray, "setValueV4iArray"); -function setValueV1uiArray(gl, v) { - gl.uniform1uiv(this.addr, v); -} -__name(setValueV1uiArray, "setValueV1uiArray"); -function setValueV2uiArray(gl, v) { - gl.uniform2uiv(this.addr, v); -} -__name(setValueV2uiArray, "setValueV2uiArray"); -function setValueV3uiArray(gl, v) { - gl.uniform3uiv(this.addr, v); -} -__name(setValueV3uiArray, "setValueV3uiArray"); -function setValueV4uiArray(gl, v) { - gl.uniform4uiv(this.addr, v); -} -__name(setValueV4uiArray, "setValueV4uiArray"); -function setValueT1Array(gl, v, textures) { - const cache = this.cache; - const n = v.length; - const units = allocTexUnits(textures, n); - if (!arraysEqual(cache, units)) { - gl.uniform1iv(this.addr, units); - copyArray(cache, units); - } - for (let i = 0; i !== n; ++i) { - textures.setTexture2D(v[i] || emptyTexture, units[i]); - } -} -__name(setValueT1Array, "setValueT1Array"); -function setValueT3DArray(gl, v, textures) { - const cache = this.cache; - const n = v.length; - const units = allocTexUnits(textures, n); - if (!arraysEqual(cache, units)) { - gl.uniform1iv(this.addr, units); - copyArray(cache, units); - } - for (let i = 0; i !== n; ++i) { - textures.setTexture3D(v[i] || empty3dTexture, units[i]); - } -} -__name(setValueT3DArray, "setValueT3DArray"); -function setValueT6Array(gl, v, textures) { - const cache = this.cache; - const n = v.length; - const units = allocTexUnits(textures, n); - if (!arraysEqual(cache, units)) { - gl.uniform1iv(this.addr, units); - copyArray(cache, units); - } - for (let i = 0; i !== n; ++i) { - textures.setTextureCube(v[i] || emptyCubeTexture, units[i]); - } -} -__name(setValueT6Array, "setValueT6Array"); -function setValueT2DArrayArray(gl, v, textures) { - const cache = this.cache; - const n = v.length; - const units = allocTexUnits(textures, n); - if (!arraysEqual(cache, units)) { - gl.uniform1iv(this.addr, units); - copyArray(cache, units); - } - for (let i = 0; i !== n; ++i) { - textures.setTexture2DArray(v[i] || emptyArrayTexture, units[i]); - } -} -__name(setValueT2DArrayArray, "setValueT2DArrayArray"); -function getPureArraySetter(type) { - switch (type) { - case 5126: - return setValueV1fArray; - case 35664: - return setValueV2fArray; - case 35665: - return setValueV3fArray; - case 35666: - return setValueV4fArray; - case 35674: - return setValueM2Array; - case 35675: - return setValueM3Array; - case 35676: - return setValueM4Array; - case 5124: - case 35670: - return setValueV1iArray; - case 35667: - case 35671: - return setValueV2iArray; - case 35668: - case 35672: - return setValueV3iArray; - case 35669: - case 35673: - return setValueV4iArray; - case 5125: - return setValueV1uiArray; - case 36294: - return setValueV2uiArray; - case 36295: - return setValueV3uiArray; - case 36296: - return setValueV4uiArray; - case 35678: - case 36198: - case 36298: - case 36306: - case 35682: - return setValueT1Array; - case 35679: - case 36299: - case 36307: - return setValueT3DArray; - case 35680: - case 36300: - case 36308: - case 36293: - return setValueT6Array; - case 36289: - case 36303: - case 36311: - case 36292: - return setValueT2DArrayArray; - } -} -__name(getPureArraySetter, "getPureArraySetter"); -class SingleUniform { - static { - __name(this, "SingleUniform"); - } - constructor(id2, activeInfo, addr) { - this.id = id2; - this.addr = addr; - this.cache = []; - this.type = activeInfo.type; - this.setValue = getSingularSetter(activeInfo.type); - } -} -class PureArrayUniform { - static { - __name(this, "PureArrayUniform"); - } - constructor(id2, activeInfo, addr) { - this.id = id2; - this.addr = addr; - this.cache = []; - this.type = activeInfo.type; - this.size = activeInfo.size; - this.setValue = getPureArraySetter(activeInfo.type); - } -} -class StructuredUniform { - static { - __name(this, "StructuredUniform"); - } - constructor(id2) { - this.id = id2; - this.seq = []; - this.map = {}; - } - setValue(gl, value, textures) { - const seq = this.seq; - for (let i = 0, n = seq.length; i !== n; ++i) { - const u = seq[i]; - u.setValue(gl, value[u.id], textures); - } - } -} -const RePathPart = /(\w+)(\])?(\[|\.)?/g; -function addUniform(container, uniformObject) { - container.seq.push(uniformObject); - container.map[uniformObject.id] = uniformObject; -} -__name(addUniform, "addUniform"); -function parseUniform(activeInfo, addr, container) { - const path = activeInfo.name, pathLength = path.length; - RePathPart.lastIndex = 0; - while (true) { - const match = RePathPart.exec(path), matchEnd = RePathPart.lastIndex; - let id2 = match[1]; - const idIsIndex = match[2] === "]", subscript = match[3]; - if (idIsIndex) id2 = id2 | 0; - if (subscript === void 0 || subscript === "[" && matchEnd + 2 === pathLength) { - addUniform(container, subscript === void 0 ? new SingleUniform(id2, activeInfo, addr) : new PureArrayUniform(id2, activeInfo, addr)); - break; - } else { - const map = container.map; - let next = map[id2]; - if (next === void 0) { - next = new StructuredUniform(id2); - addUniform(container, next); - } - container = next; - } - } -} -__name(parseUniform, "parseUniform"); -class WebGLUniforms { - static { - __name(this, "WebGLUniforms"); - } - constructor(gl, program) { - this.seq = []; - this.map = {}; - const n = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); - for (let i = 0; i < n; ++i) { - const info = gl.getActiveUniform(program, i), addr = gl.getUniformLocation(program, info.name); - parseUniform(info, addr, this); - } - } - setValue(gl, name, value, textures) { - const u = this.map[name]; - if (u !== void 0) u.setValue(gl, value, textures); - } - setOptional(gl, object, name) { - const v = object[name]; - if (v !== void 0) this.setValue(gl, name, v); - } - static upload(gl, seq, values, textures) { - for (let i = 0, n = seq.length; i !== n; ++i) { - const u = seq[i], v = values[u.id]; - if (v.needsUpdate !== false) { - u.setValue(gl, v.value, textures); - } - } - } - static seqWithValue(seq, values) { - const r = []; - for (let i = 0, n = seq.length; i !== n; ++i) { - const u = seq[i]; - if (u.id in values) r.push(u); - } - return r; - } -} -function WebGLShader(gl, type, string) { - const shader = gl.createShader(type); - gl.shaderSource(shader, string); - gl.compileShader(shader); - return shader; -} -__name(WebGLShader, "WebGLShader"); -const COMPLETION_STATUS_KHR = 37297; -let programIdCount = 0; -function handleSource(string, errorLine) { - const lines = string.split("\n"); - const lines2 = []; - const from = Math.max(errorLine - 6, 0); - const to = Math.min(errorLine + 6, lines.length); - for (let i = from; i < to; i++) { - const line = i + 1; - lines2.push(`${line === errorLine ? ">" : " "} ${line}: ${lines[i]}`); - } - return lines2.join("\n"); -} -__name(handleSource, "handleSource"); -const _m0 = /* @__PURE__ */ new Matrix3(); -function getEncodingComponents(colorSpace) { - ColorManagement._getMatrix(_m0, ColorManagement.workingColorSpace, colorSpace); - const encodingMatrix = `mat3( ${_m0.elements.map((v) => v.toFixed(4))} )`; - switch (ColorManagement.getTransfer(colorSpace)) { - case LinearTransfer: - return [encodingMatrix, "LinearTransferOETF"]; - case SRGBTransfer: - return [encodingMatrix, "sRGBTransferOETF"]; - default: - console.warn("THREE.WebGLProgram: Unsupported color space: ", colorSpace); - return [encodingMatrix, "LinearTransferOETF"]; - } -} -__name(getEncodingComponents, "getEncodingComponents"); -function getShaderErrors(gl, shader, type) { - const status = gl.getShaderParameter(shader, gl.COMPILE_STATUS); - const errors = gl.getShaderInfoLog(shader).trim(); - if (status && errors === "") return ""; - const errorMatches = /ERROR: 0:(\d+)/.exec(errors); - if (errorMatches) { - const errorLine = parseInt(errorMatches[1]); - return type.toUpperCase() + "\n\n" + errors + "\n\n" + handleSource(gl.getShaderSource(shader), errorLine); - } else { - return errors; - } -} -__name(getShaderErrors, "getShaderErrors"); -function getTexelEncodingFunction(functionName, colorSpace) { - const components = getEncodingComponents(colorSpace); - return [ - `vec4 ${functionName}( vec4 value ) {`, - ` return ${components[1]}( vec4( value.rgb * ${components[0]}, value.a ) );`, - "}" - ].join("\n"); -} -__name(getTexelEncodingFunction, "getTexelEncodingFunction"); -function getToneMappingFunction(functionName, toneMapping) { - let toneMappingName; - switch (toneMapping) { - case LinearToneMapping: - toneMappingName = "Linear"; - break; - case ReinhardToneMapping: - toneMappingName = "Reinhard"; - break; - case CineonToneMapping: - toneMappingName = "Cineon"; - break; - case ACESFilmicToneMapping: - toneMappingName = "ACESFilmic"; - break; - case AgXToneMapping: - toneMappingName = "AgX"; - break; - case NeutralToneMapping: - toneMappingName = "Neutral"; - break; - case CustomToneMapping: - toneMappingName = "Custom"; - break; - default: - console.warn("THREE.WebGLProgram: Unsupported toneMapping:", toneMapping); - toneMappingName = "Linear"; - } - return "vec3 " + functionName + "( vec3 color ) { return " + toneMappingName + "ToneMapping( color ); }"; -} -__name(getToneMappingFunction, "getToneMappingFunction"); -const _v0$1 = /* @__PURE__ */ new Vector3(); -function getLuminanceFunction() { - ColorManagement.getLuminanceCoefficients(_v0$1); - const r = _v0$1.x.toFixed(4); - const g = _v0$1.y.toFixed(4); - const b = _v0$1.z.toFixed(4); - return [ - "float luminance( const in vec3 rgb ) {", - ` const vec3 weights = vec3( ${r}, ${g}, ${b} );`, - " return dot( weights, rgb );", - "}" - ].join("\n"); -} -__name(getLuminanceFunction, "getLuminanceFunction"); -function generateVertexExtensions(parameters) { - const chunks = [ - parameters.extensionClipCullDistance ? "#extension GL_ANGLE_clip_cull_distance : require" : "", - parameters.extensionMultiDraw ? "#extension GL_ANGLE_multi_draw : require" : "" - ]; - return chunks.filter(filterEmptyLine).join("\n"); -} -__name(generateVertexExtensions, "generateVertexExtensions"); -function generateDefines(defines) { - const chunks = []; - for (const name in defines) { - const value = defines[name]; - if (value === false) continue; - chunks.push("#define " + name + " " + value); - } - return chunks.join("\n"); -} -__name(generateDefines, "generateDefines"); -function fetchAttributeLocations(gl, program) { - const attributes = {}; - const n = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); - for (let i = 0; i < n; i++) { - const info = gl.getActiveAttrib(program, i); - const name = info.name; - let locationSize = 1; - if (info.type === gl.FLOAT_MAT2) locationSize = 2; - if (info.type === gl.FLOAT_MAT3) locationSize = 3; - if (info.type === gl.FLOAT_MAT4) locationSize = 4; - attributes[name] = { - type: info.type, - location: gl.getAttribLocation(program, name), - locationSize - }; - } - return attributes; -} -__name(fetchAttributeLocations, "fetchAttributeLocations"); -function filterEmptyLine(string) { - return string !== ""; -} -__name(filterEmptyLine, "filterEmptyLine"); -function replaceLightNums(string, parameters) { - const numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps; - return string.replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows); -} -__name(replaceLightNums, "replaceLightNums"); -function replaceClippingPlaneNums(string, parameters) { - return string.replace(/NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, parameters.numClippingPlanes - parameters.numClipIntersection); -} -__name(replaceClippingPlaneNums, "replaceClippingPlaneNums"); -const includePattern = /^[ \t]*#include +<([\w\d./]+)>/gm; -function resolveIncludes(string) { - return string.replace(includePattern, includeReplacer); -} -__name(resolveIncludes, "resolveIncludes"); -const shaderChunkMap = /* @__PURE__ */ new Map(); -function includeReplacer(match, include) { - let string = ShaderChunk[include]; - if (string === void 0) { - const newInclude = shaderChunkMap.get(include); - if (newInclude !== void 0) { - string = ShaderChunk[newInclude]; - console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', include, newInclude); - } else { - throw new Error("Can not resolve #include <" + include + ">"); - } - } - return resolveIncludes(string); -} -__name(includeReplacer, "includeReplacer"); -const unrollLoopPattern = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g; -function unrollLoops(string) { - return string.replace(unrollLoopPattern, loopReplacer); -} -__name(unrollLoops, "unrollLoops"); -function loopReplacer(match, start, end, snippet) { - let string = ""; - for (let i = parseInt(start); i < parseInt(end); i++) { - string += snippet.replace(/\[\s*i\s*\]/g, "[ " + i + " ]").replace(/UNROLLED_LOOP_INDEX/g, i); - } - return string; -} -__name(loopReplacer, "loopReplacer"); -function generatePrecision(parameters) { - let precisionstring = `precision ${parameters.precision} float; - precision ${parameters.precision} int; - precision ${parameters.precision} sampler2D; - precision ${parameters.precision} samplerCube; - precision ${parameters.precision} sampler3D; - precision ${parameters.precision} sampler2DArray; - precision ${parameters.precision} sampler2DShadow; - precision ${parameters.precision} samplerCubeShadow; - precision ${parameters.precision} sampler2DArrayShadow; - precision ${parameters.precision} isampler2D; - precision ${parameters.precision} isampler3D; - precision ${parameters.precision} isamplerCube; - precision ${parameters.precision} isampler2DArray; - precision ${parameters.precision} usampler2D; - precision ${parameters.precision} usampler3D; - precision ${parameters.precision} usamplerCube; - precision ${parameters.precision} usampler2DArray; - `; - if (parameters.precision === "highp") { - precisionstring += "\n#define HIGH_PRECISION"; - } else if (parameters.precision === "mediump") { - precisionstring += "\n#define MEDIUM_PRECISION"; - } else if (parameters.precision === "lowp") { - precisionstring += "\n#define LOW_PRECISION"; - } - return precisionstring; -} -__name(generatePrecision, "generatePrecision"); -function generateShadowMapTypeDefine(parameters) { - let shadowMapTypeDefine = "SHADOWMAP_TYPE_BASIC"; - if (parameters.shadowMapType === PCFShadowMap) { - shadowMapTypeDefine = "SHADOWMAP_TYPE_PCF"; - } else if (parameters.shadowMapType === PCFSoftShadowMap) { - shadowMapTypeDefine = "SHADOWMAP_TYPE_PCF_SOFT"; - } else if (parameters.shadowMapType === VSMShadowMap) { - shadowMapTypeDefine = "SHADOWMAP_TYPE_VSM"; - } - return shadowMapTypeDefine; -} -__name(generateShadowMapTypeDefine, "generateShadowMapTypeDefine"); -function generateEnvMapTypeDefine(parameters) { - let envMapTypeDefine = "ENVMAP_TYPE_CUBE"; - if (parameters.envMap) { - switch (parameters.envMapMode) { - case CubeReflectionMapping: - case CubeRefractionMapping: - envMapTypeDefine = "ENVMAP_TYPE_CUBE"; - break; - case CubeUVReflectionMapping: - envMapTypeDefine = "ENVMAP_TYPE_CUBE_UV"; - break; - } - } - return envMapTypeDefine; -} -__name(generateEnvMapTypeDefine, "generateEnvMapTypeDefine"); -function generateEnvMapModeDefine(parameters) { - let envMapModeDefine = "ENVMAP_MODE_REFLECTION"; - if (parameters.envMap) { - switch (parameters.envMapMode) { - case CubeRefractionMapping: - envMapModeDefine = "ENVMAP_MODE_REFRACTION"; - break; - } - } - return envMapModeDefine; -} -__name(generateEnvMapModeDefine, "generateEnvMapModeDefine"); -function generateEnvMapBlendingDefine(parameters) { - let envMapBlendingDefine = "ENVMAP_BLENDING_NONE"; - if (parameters.envMap) { - switch (parameters.combine) { - case MultiplyOperation: - envMapBlendingDefine = "ENVMAP_BLENDING_MULTIPLY"; - break; - case MixOperation: - envMapBlendingDefine = "ENVMAP_BLENDING_MIX"; - break; - case AddOperation: - envMapBlendingDefine = "ENVMAP_BLENDING_ADD"; - break; - } - } - return envMapBlendingDefine; -} -__name(generateEnvMapBlendingDefine, "generateEnvMapBlendingDefine"); -function generateCubeUVSize(parameters) { - const imageHeight = parameters.envMapCubeUVHeight; - if (imageHeight === null) return null; - const maxMip = Math.log2(imageHeight) - 2; - const texelHeight = 1 / imageHeight; - const texelWidth = 1 / (3 * Math.max(Math.pow(2, maxMip), 7 * 16)); - return { texelWidth, texelHeight, maxMip }; -} -__name(generateCubeUVSize, "generateCubeUVSize"); -function WebGLProgram(renderer, cacheKey, parameters, bindingStates) { - const gl = renderer.getContext(); - const defines = parameters.defines; - let vertexShader = parameters.vertexShader; - let fragmentShader = parameters.fragmentShader; - const shadowMapTypeDefine = generateShadowMapTypeDefine(parameters); - const envMapTypeDefine = generateEnvMapTypeDefine(parameters); - const envMapModeDefine = generateEnvMapModeDefine(parameters); - const envMapBlendingDefine = generateEnvMapBlendingDefine(parameters); - const envMapCubeUVSize = generateCubeUVSize(parameters); - const customVertexExtensions = generateVertexExtensions(parameters); - const customDefines = generateDefines(defines); - const program = gl.createProgram(); - let prefixVertex, prefixFragment; - let versionString = parameters.glslVersion ? "#version " + parameters.glslVersion + "\n" : ""; - if (parameters.isRawShaderMaterial) { - prefixVertex = [ - "#define SHADER_TYPE " + parameters.shaderType, - "#define SHADER_NAME " + parameters.shaderName, - customDefines - ].filter(filterEmptyLine).join("\n"); - if (prefixVertex.length > 0) { - prefixVertex += "\n"; - } - prefixFragment = [ - "#define SHADER_TYPE " + parameters.shaderType, - "#define SHADER_NAME " + parameters.shaderName, - customDefines - ].filter(filterEmptyLine).join("\n"); - if (prefixFragment.length > 0) { - prefixFragment += "\n"; - } - } else { - prefixVertex = [ - generatePrecision(parameters), - "#define SHADER_TYPE " + parameters.shaderType, - "#define SHADER_NAME " + parameters.shaderName, - customDefines, - parameters.extensionClipCullDistance ? "#define USE_CLIP_DISTANCE" : "", - parameters.batching ? "#define USE_BATCHING" : "", - parameters.batchingColor ? "#define USE_BATCHING_COLOR" : "", - parameters.instancing ? "#define USE_INSTANCING" : "", - parameters.instancingColor ? "#define USE_INSTANCING_COLOR" : "", - parameters.instancingMorph ? "#define USE_INSTANCING_MORPH" : "", - parameters.useFog && parameters.fog ? "#define USE_FOG" : "", - parameters.useFog && parameters.fogExp2 ? "#define FOG_EXP2" : "", - parameters.map ? "#define USE_MAP" : "", - parameters.envMap ? "#define USE_ENVMAP" : "", - parameters.envMap ? "#define " + envMapModeDefine : "", - parameters.lightMap ? "#define USE_LIGHTMAP" : "", - parameters.aoMap ? "#define USE_AOMAP" : "", - parameters.bumpMap ? "#define USE_BUMPMAP" : "", - parameters.normalMap ? "#define USE_NORMALMAP" : "", - parameters.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "", - parameters.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "", - parameters.displacementMap ? "#define USE_DISPLACEMENTMAP" : "", - parameters.emissiveMap ? "#define USE_EMISSIVEMAP" : "", - parameters.anisotropy ? "#define USE_ANISOTROPY" : "", - parameters.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "", - parameters.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", - parameters.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", - parameters.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", - parameters.iridescenceMap ? "#define USE_IRIDESCENCEMAP" : "", - parameters.iridescenceThicknessMap ? "#define USE_IRIDESCENCE_THICKNESSMAP" : "", - parameters.specularMap ? "#define USE_SPECULARMAP" : "", - parameters.specularColorMap ? "#define USE_SPECULAR_COLORMAP" : "", - parameters.specularIntensityMap ? "#define USE_SPECULAR_INTENSITYMAP" : "", - parameters.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", - parameters.metalnessMap ? "#define USE_METALNESSMAP" : "", - parameters.alphaMap ? "#define USE_ALPHAMAP" : "", - parameters.alphaHash ? "#define USE_ALPHAHASH" : "", - parameters.transmission ? "#define USE_TRANSMISSION" : "", - parameters.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", - parameters.thicknessMap ? "#define USE_THICKNESSMAP" : "", - parameters.sheenColorMap ? "#define USE_SHEEN_COLORMAP" : "", - parameters.sheenRoughnessMap ? "#define USE_SHEEN_ROUGHNESSMAP" : "", - // - parameters.mapUv ? "#define MAP_UV " + parameters.mapUv : "", - parameters.alphaMapUv ? "#define ALPHAMAP_UV " + parameters.alphaMapUv : "", - parameters.lightMapUv ? "#define LIGHTMAP_UV " + parameters.lightMapUv : "", - parameters.aoMapUv ? "#define AOMAP_UV " + parameters.aoMapUv : "", - parameters.emissiveMapUv ? "#define EMISSIVEMAP_UV " + parameters.emissiveMapUv : "", - parameters.bumpMapUv ? "#define BUMPMAP_UV " + parameters.bumpMapUv : "", - parameters.normalMapUv ? "#define NORMALMAP_UV " + parameters.normalMapUv : "", - parameters.displacementMapUv ? "#define DISPLACEMENTMAP_UV " + parameters.displacementMapUv : "", - parameters.metalnessMapUv ? "#define METALNESSMAP_UV " + parameters.metalnessMapUv : "", - parameters.roughnessMapUv ? "#define ROUGHNESSMAP_UV " + parameters.roughnessMapUv : "", - parameters.anisotropyMapUv ? "#define ANISOTROPYMAP_UV " + parameters.anisotropyMapUv : "", - parameters.clearcoatMapUv ? "#define CLEARCOATMAP_UV " + parameters.clearcoatMapUv : "", - parameters.clearcoatNormalMapUv ? "#define CLEARCOAT_NORMALMAP_UV " + parameters.clearcoatNormalMapUv : "", - parameters.clearcoatRoughnessMapUv ? "#define CLEARCOAT_ROUGHNESSMAP_UV " + parameters.clearcoatRoughnessMapUv : "", - parameters.iridescenceMapUv ? "#define IRIDESCENCEMAP_UV " + parameters.iridescenceMapUv : "", - parameters.iridescenceThicknessMapUv ? "#define IRIDESCENCE_THICKNESSMAP_UV " + parameters.iridescenceThicknessMapUv : "", - parameters.sheenColorMapUv ? "#define SHEEN_COLORMAP_UV " + parameters.sheenColorMapUv : "", - parameters.sheenRoughnessMapUv ? "#define SHEEN_ROUGHNESSMAP_UV " + parameters.sheenRoughnessMapUv : "", - parameters.specularMapUv ? "#define SPECULARMAP_UV " + parameters.specularMapUv : "", - parameters.specularColorMapUv ? "#define SPECULAR_COLORMAP_UV " + parameters.specularColorMapUv : "", - parameters.specularIntensityMapUv ? "#define SPECULAR_INTENSITYMAP_UV " + parameters.specularIntensityMapUv : "", - parameters.transmissionMapUv ? "#define TRANSMISSIONMAP_UV " + parameters.transmissionMapUv : "", - parameters.thicknessMapUv ? "#define THICKNESSMAP_UV " + parameters.thicknessMapUv : "", - // - parameters.vertexTangents && parameters.flatShading === false ? "#define USE_TANGENT" : "", - parameters.vertexColors ? "#define USE_COLOR" : "", - parameters.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", - parameters.vertexUv1s ? "#define USE_UV1" : "", - parameters.vertexUv2s ? "#define USE_UV2" : "", - parameters.vertexUv3s ? "#define USE_UV3" : "", - parameters.pointsUvs ? "#define USE_POINTS_UV" : "", - parameters.flatShading ? "#define FLAT_SHADED" : "", - parameters.skinning ? "#define USE_SKINNING" : "", - parameters.morphTargets ? "#define USE_MORPHTARGETS" : "", - parameters.morphNormals && parameters.flatShading === false ? "#define USE_MORPHNORMALS" : "", - parameters.morphColors ? "#define USE_MORPHCOLORS" : "", - parameters.morphTargetsCount > 0 ? "#define MORPHTARGETS_TEXTURE_STRIDE " + parameters.morphTextureStride : "", - parameters.morphTargetsCount > 0 ? "#define MORPHTARGETS_COUNT " + parameters.morphTargetsCount : "", - parameters.doubleSided ? "#define DOUBLE_SIDED" : "", - parameters.flipSided ? "#define FLIP_SIDED" : "", - parameters.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", - parameters.shadowMapEnabled ? "#define " + shadowMapTypeDefine : "", - parameters.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", - parameters.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "", - parameters.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", - parameters.reverseDepthBuffer ? "#define USE_REVERSEDEPTHBUF" : "", - "uniform mat4 modelMatrix;", - "uniform mat4 modelViewMatrix;", - "uniform mat4 projectionMatrix;", - "uniform mat4 viewMatrix;", - "uniform mat3 normalMatrix;", - "uniform vec3 cameraPosition;", - "uniform bool isOrthographic;", - "#ifdef USE_INSTANCING", - " attribute mat4 instanceMatrix;", - "#endif", - "#ifdef USE_INSTANCING_COLOR", - " attribute vec3 instanceColor;", - "#endif", - "#ifdef USE_INSTANCING_MORPH", - " uniform sampler2D morphTexture;", - "#endif", - "attribute vec3 position;", - "attribute vec3 normal;", - "attribute vec2 uv;", - "#ifdef USE_UV1", - " attribute vec2 uv1;", - "#endif", - "#ifdef USE_UV2", - " attribute vec2 uv2;", - "#endif", - "#ifdef USE_UV3", - " attribute vec2 uv3;", - "#endif", - "#ifdef USE_TANGENT", - " attribute vec4 tangent;", - "#endif", - "#if defined( USE_COLOR_ALPHA )", - " attribute vec4 color;", - "#elif defined( USE_COLOR )", - " attribute vec3 color;", - "#endif", - "#ifdef USE_SKINNING", - " attribute vec4 skinIndex;", - " attribute vec4 skinWeight;", - "#endif", - "\n" - ].filter(filterEmptyLine).join("\n"); - prefixFragment = [ - generatePrecision(parameters), - "#define SHADER_TYPE " + parameters.shaderType, - "#define SHADER_NAME " + parameters.shaderName, - customDefines, - parameters.useFog && parameters.fog ? "#define USE_FOG" : "", - parameters.useFog && parameters.fogExp2 ? "#define FOG_EXP2" : "", - parameters.alphaToCoverage ? "#define ALPHA_TO_COVERAGE" : "", - parameters.map ? "#define USE_MAP" : "", - parameters.matcap ? "#define USE_MATCAP" : "", - parameters.envMap ? "#define USE_ENVMAP" : "", - parameters.envMap ? "#define " + envMapTypeDefine : "", - parameters.envMap ? "#define " + envMapModeDefine : "", - parameters.envMap ? "#define " + envMapBlendingDefine : "", - envMapCubeUVSize ? "#define CUBEUV_TEXEL_WIDTH " + envMapCubeUVSize.texelWidth : "", - envMapCubeUVSize ? "#define CUBEUV_TEXEL_HEIGHT " + envMapCubeUVSize.texelHeight : "", - envMapCubeUVSize ? "#define CUBEUV_MAX_MIP " + envMapCubeUVSize.maxMip + ".0" : "", - parameters.lightMap ? "#define USE_LIGHTMAP" : "", - parameters.aoMap ? "#define USE_AOMAP" : "", - parameters.bumpMap ? "#define USE_BUMPMAP" : "", - parameters.normalMap ? "#define USE_NORMALMAP" : "", - parameters.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "", - parameters.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "", - parameters.emissiveMap ? "#define USE_EMISSIVEMAP" : "", - parameters.anisotropy ? "#define USE_ANISOTROPY" : "", - parameters.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "", - parameters.clearcoat ? "#define USE_CLEARCOAT" : "", - parameters.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", - parameters.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", - parameters.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", - parameters.dispersion ? "#define USE_DISPERSION" : "", - parameters.iridescence ? "#define USE_IRIDESCENCE" : "", - parameters.iridescenceMap ? "#define USE_IRIDESCENCEMAP" : "", - parameters.iridescenceThicknessMap ? "#define USE_IRIDESCENCE_THICKNESSMAP" : "", - parameters.specularMap ? "#define USE_SPECULARMAP" : "", - parameters.specularColorMap ? "#define USE_SPECULAR_COLORMAP" : "", - parameters.specularIntensityMap ? "#define USE_SPECULAR_INTENSITYMAP" : "", - parameters.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", - parameters.metalnessMap ? "#define USE_METALNESSMAP" : "", - parameters.alphaMap ? "#define USE_ALPHAMAP" : "", - parameters.alphaTest ? "#define USE_ALPHATEST" : "", - parameters.alphaHash ? "#define USE_ALPHAHASH" : "", - parameters.sheen ? "#define USE_SHEEN" : "", - parameters.sheenColorMap ? "#define USE_SHEEN_COLORMAP" : "", - parameters.sheenRoughnessMap ? "#define USE_SHEEN_ROUGHNESSMAP" : "", - parameters.transmission ? "#define USE_TRANSMISSION" : "", - parameters.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", - parameters.thicknessMap ? "#define USE_THICKNESSMAP" : "", - parameters.vertexTangents && parameters.flatShading === false ? "#define USE_TANGENT" : "", - parameters.vertexColors || parameters.instancingColor || parameters.batchingColor ? "#define USE_COLOR" : "", - parameters.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", - parameters.vertexUv1s ? "#define USE_UV1" : "", - parameters.vertexUv2s ? "#define USE_UV2" : "", - parameters.vertexUv3s ? "#define USE_UV3" : "", - parameters.pointsUvs ? "#define USE_POINTS_UV" : "", - parameters.gradientMap ? "#define USE_GRADIENTMAP" : "", - parameters.flatShading ? "#define FLAT_SHADED" : "", - parameters.doubleSided ? "#define DOUBLE_SIDED" : "", - parameters.flipSided ? "#define FLIP_SIDED" : "", - parameters.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", - parameters.shadowMapEnabled ? "#define " + shadowMapTypeDefine : "", - parameters.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "", - parameters.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "", - parameters.decodeVideoTexture ? "#define DECODE_VIDEO_TEXTURE" : "", - parameters.decodeVideoTextureEmissive ? "#define DECODE_VIDEO_TEXTURE_EMISSIVE" : "", - parameters.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", - parameters.reverseDepthBuffer ? "#define USE_REVERSEDEPTHBUF" : "", - "uniform mat4 viewMatrix;", - "uniform vec3 cameraPosition;", - "uniform bool isOrthographic;", - parameters.toneMapping !== NoToneMapping ? "#define TONE_MAPPING" : "", - parameters.toneMapping !== NoToneMapping ? ShaderChunk["tonemapping_pars_fragment"] : "", - // this code is required here because it is used by the toneMapping() function defined below - parameters.toneMapping !== NoToneMapping ? getToneMappingFunction("toneMapping", parameters.toneMapping) : "", - parameters.dithering ? "#define DITHERING" : "", - parameters.opaque ? "#define OPAQUE" : "", - ShaderChunk["colorspace_pars_fragment"], - // this code is required here because it is used by the various encoding/decoding function defined below - getTexelEncodingFunction("linearToOutputTexel", parameters.outputColorSpace), - getLuminanceFunction(), - parameters.useDepthPacking ? "#define DEPTH_PACKING " + parameters.depthPacking : "", - "\n" - ].filter(filterEmptyLine).join("\n"); - } - vertexShader = resolveIncludes(vertexShader); - vertexShader = replaceLightNums(vertexShader, parameters); - vertexShader = replaceClippingPlaneNums(vertexShader, parameters); - fragmentShader = resolveIncludes(fragmentShader); - fragmentShader = replaceLightNums(fragmentShader, parameters); - fragmentShader = replaceClippingPlaneNums(fragmentShader, parameters); - vertexShader = unrollLoops(vertexShader); - fragmentShader = unrollLoops(fragmentShader); - if (parameters.isRawShaderMaterial !== true) { - versionString = "#version 300 es\n"; - prefixVertex = [ - customVertexExtensions, - "#define attribute in", - "#define varying out", - "#define texture2D texture" - ].join("\n") + "\n" + prefixVertex; - prefixFragment = [ - "#define varying in", - parameters.glslVersion === GLSL3 ? "" : "layout(location = 0) out highp vec4 pc_fragColor;", - parameters.glslVersion === GLSL3 ? "" : "#define gl_FragColor pc_fragColor", - "#define gl_FragDepthEXT gl_FragDepth", - "#define texture2D texture", - "#define textureCube texture", - "#define texture2DProj textureProj", - "#define texture2DLodEXT textureLod", - "#define texture2DProjLodEXT textureProjLod", - "#define textureCubeLodEXT textureLod", - "#define texture2DGradEXT textureGrad", - "#define texture2DProjGradEXT textureProjGrad", - "#define textureCubeGradEXT textureGrad" - ].join("\n") + "\n" + prefixFragment; - } - const vertexGlsl = versionString + prefixVertex + vertexShader; - const fragmentGlsl = versionString + prefixFragment + fragmentShader; - const glVertexShader = WebGLShader(gl, gl.VERTEX_SHADER, vertexGlsl); - const glFragmentShader = WebGLShader(gl, gl.FRAGMENT_SHADER, fragmentGlsl); - gl.attachShader(program, glVertexShader); - gl.attachShader(program, glFragmentShader); - if (parameters.index0AttributeName !== void 0) { - gl.bindAttribLocation(program, 0, parameters.index0AttributeName); - } else if (parameters.morphTargets === true) { - gl.bindAttribLocation(program, 0, "position"); - } - gl.linkProgram(program); - function onFirstUse(self2) { - if (renderer.debug.checkShaderErrors) { - const programLog = gl.getProgramInfoLog(program).trim(); - const vertexLog = gl.getShaderInfoLog(glVertexShader).trim(); - const fragmentLog = gl.getShaderInfoLog(glFragmentShader).trim(); - let runnable = true; - let haveDiagnostics = true; - if (gl.getProgramParameter(program, gl.LINK_STATUS) === false) { - runnable = false; - if (typeof renderer.debug.onShaderError === "function") { - renderer.debug.onShaderError(gl, program, glVertexShader, glFragmentShader); - } else { - const vertexErrors = getShaderErrors(gl, glVertexShader, "vertex"); - const fragmentErrors = getShaderErrors(gl, glFragmentShader, "fragment"); - console.error( - "THREE.WebGLProgram: Shader Error " + gl.getError() + " - VALIDATE_STATUS " + gl.getProgramParameter(program, gl.VALIDATE_STATUS) + "\n\nMaterial Name: " + self2.name + "\nMaterial Type: " + self2.type + "\n\nProgram Info Log: " + programLog + "\n" + vertexErrors + "\n" + fragmentErrors - ); - } - } else if (programLog !== "") { - console.warn("THREE.WebGLProgram: Program Info Log:", programLog); - } else if (vertexLog === "" || fragmentLog === "") { - haveDiagnostics = false; - } - if (haveDiagnostics) { - self2.diagnostics = { - runnable, - programLog, - vertexShader: { - log: vertexLog, - prefix: prefixVertex - }, - fragmentShader: { - log: fragmentLog, - prefix: prefixFragment - } - }; - } - } - gl.deleteShader(glVertexShader); - gl.deleteShader(glFragmentShader); - cachedUniforms = new WebGLUniforms(gl, program); - cachedAttributes = fetchAttributeLocations(gl, program); - } - __name(onFirstUse, "onFirstUse"); - let cachedUniforms; - this.getUniforms = function() { - if (cachedUniforms === void 0) { - onFirstUse(this); - } - return cachedUniforms; - }; - let cachedAttributes; - this.getAttributes = function() { - if (cachedAttributes === void 0) { - onFirstUse(this); - } - return cachedAttributes; - }; - let programReady = parameters.rendererExtensionParallelShaderCompile === false; - this.isReady = function() { - if (programReady === false) { - programReady = gl.getProgramParameter(program, COMPLETION_STATUS_KHR); - } - return programReady; - }; - this.destroy = function() { - bindingStates.releaseStatesOfProgram(this); - gl.deleteProgram(program); - this.program = void 0; - }; - this.type = parameters.shaderType; - this.name = parameters.shaderName; - this.id = programIdCount++; - this.cacheKey = cacheKey; - this.usedTimes = 1; - this.program = program; - this.vertexShader = glVertexShader; - this.fragmentShader = glFragmentShader; - return this; -} -__name(WebGLProgram, "WebGLProgram"); -let _id$1 = 0; -class WebGLShaderCache { - static { - __name(this, "WebGLShaderCache"); - } - constructor() { - this.shaderCache = /* @__PURE__ */ new Map(); - this.materialCache = /* @__PURE__ */ new Map(); - } - update(material) { - const vertexShader = material.vertexShader; - const fragmentShader = material.fragmentShader; - const vertexShaderStage = this._getShaderStage(vertexShader); - const fragmentShaderStage = this._getShaderStage(fragmentShader); - const materialShaders = this._getShaderCacheForMaterial(material); - if (materialShaders.has(vertexShaderStage) === false) { - materialShaders.add(vertexShaderStage); - vertexShaderStage.usedTimes++; - } - if (materialShaders.has(fragmentShaderStage) === false) { - materialShaders.add(fragmentShaderStage); - fragmentShaderStage.usedTimes++; - } - return this; - } - remove(material) { - const materialShaders = this.materialCache.get(material); - for (const shaderStage of materialShaders) { - shaderStage.usedTimes--; - if (shaderStage.usedTimes === 0) this.shaderCache.delete(shaderStage.code); - } - this.materialCache.delete(material); - return this; - } - getVertexShaderID(material) { - return this._getShaderStage(material.vertexShader).id; - } - getFragmentShaderID(material) { - return this._getShaderStage(material.fragmentShader).id; - } - dispose() { - this.shaderCache.clear(); - this.materialCache.clear(); - } - _getShaderCacheForMaterial(material) { - const cache = this.materialCache; - let set = cache.get(material); - if (set === void 0) { - set = /* @__PURE__ */ new Set(); - cache.set(material, set); - } - return set; - } - _getShaderStage(code) { - const cache = this.shaderCache; - let stage = cache.get(code); - if (stage === void 0) { - stage = new WebGLShaderStage(code); - cache.set(code, stage); - } - return stage; - } -} -class WebGLShaderStage { - static { - __name(this, "WebGLShaderStage"); - } - constructor(code) { - this.id = _id$1++; - this.code = code; - this.usedTimes = 0; - } -} -function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping) { - const _programLayers = new Layers(); - const _customShaders = new WebGLShaderCache(); - const _activeChannels = /* @__PURE__ */ new Set(); - const programs = []; - const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer; - const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures; - let precision = capabilities.precision; - const shaderIDs = { - MeshDepthMaterial: "depth", - MeshDistanceMaterial: "distanceRGBA", - MeshNormalMaterial: "normal", - MeshBasicMaterial: "basic", - MeshLambertMaterial: "lambert", - MeshPhongMaterial: "phong", - MeshToonMaterial: "toon", - MeshStandardMaterial: "physical", - MeshPhysicalMaterial: "physical", - MeshMatcapMaterial: "matcap", - LineBasicMaterial: "basic", - LineDashedMaterial: "dashed", - PointsMaterial: "points", - ShadowMaterial: "shadow", - SpriteMaterial: "sprite" - }; - function getChannel(value) { - _activeChannels.add(value); - if (value === 0) return "uv"; - return `uv${value}`; - } - __name(getChannel, "getChannel"); - function getParameters(material, lights, shadows, scene, object) { - const fog = scene.fog; - const geometry = object.geometry; - const environment = material.isMeshStandardMaterial ? scene.environment : null; - const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment); - const envMapCubeUVHeight = !!envMap && envMap.mapping === CubeUVReflectionMapping ? envMap.image.height : null; - const shaderID = shaderIDs[material.type]; - if (material.precision !== null) { - precision = capabilities.getMaxPrecision(material.precision); - if (precision !== material.precision) { - console.warn("THREE.WebGLProgram.getParameters:", material.precision, "not supported, using", precision, "instead."); - } - } - const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color; - const morphTargetsCount = morphAttribute !== void 0 ? morphAttribute.length : 0; - let morphTextureStride = 0; - if (geometry.morphAttributes.position !== void 0) morphTextureStride = 1; - if (geometry.morphAttributes.normal !== void 0) morphTextureStride = 2; - if (geometry.morphAttributes.color !== void 0) morphTextureStride = 3; - let vertexShader, fragmentShader; - let customVertexShaderID, customFragmentShaderID; - if (shaderID) { - const shader = ShaderLib[shaderID]; - vertexShader = shader.vertexShader; - fragmentShader = shader.fragmentShader; - } else { - vertexShader = material.vertexShader; - fragmentShader = material.fragmentShader; - _customShaders.update(material); - customVertexShaderID = _customShaders.getVertexShaderID(material); - customFragmentShaderID = _customShaders.getFragmentShaderID(material); - } - const currentRenderTarget = renderer.getRenderTarget(); - const reverseDepthBuffer = renderer.state.buffers.depth.getReversed(); - const IS_INSTANCEDMESH = object.isInstancedMesh === true; - const IS_BATCHEDMESH = object.isBatchedMesh === true; - const HAS_MAP = !!material.map; - const HAS_MATCAP = !!material.matcap; - const HAS_ENVMAP = !!envMap; - const HAS_AOMAP = !!material.aoMap; - const HAS_LIGHTMAP = !!material.lightMap; - const HAS_BUMPMAP = !!material.bumpMap; - const HAS_NORMALMAP = !!material.normalMap; - const HAS_DISPLACEMENTMAP = !!material.displacementMap; - const HAS_EMISSIVEMAP = !!material.emissiveMap; - const HAS_METALNESSMAP = !!material.metalnessMap; - const HAS_ROUGHNESSMAP = !!material.roughnessMap; - const HAS_ANISOTROPY = material.anisotropy > 0; - const HAS_CLEARCOAT = material.clearcoat > 0; - const HAS_DISPERSION = material.dispersion > 0; - const HAS_IRIDESCENCE = material.iridescence > 0; - const HAS_SHEEN = material.sheen > 0; - const HAS_TRANSMISSION = material.transmission > 0; - const HAS_ANISOTROPYMAP = HAS_ANISOTROPY && !!material.anisotropyMap; - const HAS_CLEARCOATMAP = HAS_CLEARCOAT && !!material.clearcoatMap; - const HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !!material.clearcoatNormalMap; - const HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !!material.clearcoatRoughnessMap; - const HAS_IRIDESCENCEMAP = HAS_IRIDESCENCE && !!material.iridescenceMap; - const HAS_IRIDESCENCE_THICKNESSMAP = HAS_IRIDESCENCE && !!material.iridescenceThicknessMap; - const HAS_SHEEN_COLORMAP = HAS_SHEEN && !!material.sheenColorMap; - const HAS_SHEEN_ROUGHNESSMAP = HAS_SHEEN && !!material.sheenRoughnessMap; - const HAS_SPECULARMAP = !!material.specularMap; - const HAS_SPECULAR_COLORMAP = !!material.specularColorMap; - const HAS_SPECULAR_INTENSITYMAP = !!material.specularIntensityMap; - const HAS_TRANSMISSIONMAP = HAS_TRANSMISSION && !!material.transmissionMap; - const HAS_THICKNESSMAP = HAS_TRANSMISSION && !!material.thicknessMap; - const HAS_GRADIENTMAP = !!material.gradientMap; - const HAS_ALPHAMAP = !!material.alphaMap; - const HAS_ALPHATEST = material.alphaTest > 0; - const HAS_ALPHAHASH = !!material.alphaHash; - const HAS_EXTENSIONS = !!material.extensions; - let toneMapping = NoToneMapping; - if (material.toneMapped) { - if (currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true) { - toneMapping = renderer.toneMapping; - } - } - const parameters = { - shaderID, - shaderType: material.type, - shaderName: material.name, - vertexShader, - fragmentShader, - defines: material.defines, - customVertexShaderID, - customFragmentShaderID, - isRawShaderMaterial: material.isRawShaderMaterial === true, - glslVersion: material.glslVersion, - precision, - batching: IS_BATCHEDMESH, - batchingColor: IS_BATCHEDMESH && object._colorsTexture !== null, - instancing: IS_INSTANCEDMESH, - instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null, - instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null, - supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES, - outputColorSpace: currentRenderTarget === null ? renderer.outputColorSpace : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace, - alphaToCoverage: !!material.alphaToCoverage, - map: HAS_MAP, - matcap: HAS_MATCAP, - envMap: HAS_ENVMAP, - envMapMode: HAS_ENVMAP && envMap.mapping, - envMapCubeUVHeight, - aoMap: HAS_AOMAP, - lightMap: HAS_LIGHTMAP, - bumpMap: HAS_BUMPMAP, - normalMap: HAS_NORMALMAP, - displacementMap: SUPPORTS_VERTEX_TEXTURES && HAS_DISPLACEMENTMAP, - emissiveMap: HAS_EMISSIVEMAP, - normalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap, - normalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap, - metalnessMap: HAS_METALNESSMAP, - roughnessMap: HAS_ROUGHNESSMAP, - anisotropy: HAS_ANISOTROPY, - anisotropyMap: HAS_ANISOTROPYMAP, - clearcoat: HAS_CLEARCOAT, - clearcoatMap: HAS_CLEARCOATMAP, - clearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP, - clearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP, - dispersion: HAS_DISPERSION, - iridescence: HAS_IRIDESCENCE, - iridescenceMap: HAS_IRIDESCENCEMAP, - iridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP, - sheen: HAS_SHEEN, - sheenColorMap: HAS_SHEEN_COLORMAP, - sheenRoughnessMap: HAS_SHEEN_ROUGHNESSMAP, - specularMap: HAS_SPECULARMAP, - specularColorMap: HAS_SPECULAR_COLORMAP, - specularIntensityMap: HAS_SPECULAR_INTENSITYMAP, - transmission: HAS_TRANSMISSION, - transmissionMap: HAS_TRANSMISSIONMAP, - thicknessMap: HAS_THICKNESSMAP, - gradientMap: HAS_GRADIENTMAP, - opaque: material.transparent === false && material.blending === NormalBlending && material.alphaToCoverage === false, - alphaMap: HAS_ALPHAMAP, - alphaTest: HAS_ALPHATEST, - alphaHash: HAS_ALPHAHASH, - combine: material.combine, - // - mapUv: HAS_MAP && getChannel(material.map.channel), - aoMapUv: HAS_AOMAP && getChannel(material.aoMap.channel), - lightMapUv: HAS_LIGHTMAP && getChannel(material.lightMap.channel), - bumpMapUv: HAS_BUMPMAP && getChannel(material.bumpMap.channel), - normalMapUv: HAS_NORMALMAP && getChannel(material.normalMap.channel), - displacementMapUv: HAS_DISPLACEMENTMAP && getChannel(material.displacementMap.channel), - emissiveMapUv: HAS_EMISSIVEMAP && getChannel(material.emissiveMap.channel), - metalnessMapUv: HAS_METALNESSMAP && getChannel(material.metalnessMap.channel), - roughnessMapUv: HAS_ROUGHNESSMAP && getChannel(material.roughnessMap.channel), - anisotropyMapUv: HAS_ANISOTROPYMAP && getChannel(material.anisotropyMap.channel), - clearcoatMapUv: HAS_CLEARCOATMAP && getChannel(material.clearcoatMap.channel), - clearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel(material.clearcoatNormalMap.channel), - clearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel(material.clearcoatRoughnessMap.channel), - iridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel(material.iridescenceMap.channel), - iridescenceThicknessMapUv: HAS_IRIDESCENCE_THICKNESSMAP && getChannel(material.iridescenceThicknessMap.channel), - sheenColorMapUv: HAS_SHEEN_COLORMAP && getChannel(material.sheenColorMap.channel), - sheenRoughnessMapUv: HAS_SHEEN_ROUGHNESSMAP && getChannel(material.sheenRoughnessMap.channel), - specularMapUv: HAS_SPECULARMAP && getChannel(material.specularMap.channel), - specularColorMapUv: HAS_SPECULAR_COLORMAP && getChannel(material.specularColorMap.channel), - specularIntensityMapUv: HAS_SPECULAR_INTENSITYMAP && getChannel(material.specularIntensityMap.channel), - transmissionMapUv: HAS_TRANSMISSIONMAP && getChannel(material.transmissionMap.channel), - thicknessMapUv: HAS_THICKNESSMAP && getChannel(material.thicknessMap.channel), - alphaMapUv: HAS_ALPHAMAP && getChannel(material.alphaMap.channel), - // - vertexTangents: !!geometry.attributes.tangent && (HAS_NORMALMAP || HAS_ANISOTROPY), - vertexColors: material.vertexColors, - vertexAlphas: material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4, - pointsUvs: object.isPoints === true && !!geometry.attributes.uv && (HAS_MAP || HAS_ALPHAMAP), - fog: !!fog, - useFog: material.fog === true, - fogExp2: !!fog && fog.isFogExp2, - flatShading: material.flatShading === true, - sizeAttenuation: material.sizeAttenuation === true, - logarithmicDepthBuffer, - reverseDepthBuffer, - skinning: object.isSkinnedMesh === true, - morphTargets: geometry.morphAttributes.position !== void 0, - morphNormals: geometry.morphAttributes.normal !== void 0, - morphColors: geometry.morphAttributes.color !== void 0, - morphTargetsCount, - morphTextureStride, - numDirLights: lights.directional.length, - numPointLights: lights.point.length, - numSpotLights: lights.spot.length, - numSpotLightMaps: lights.spotLightMap.length, - numRectAreaLights: lights.rectArea.length, - numHemiLights: lights.hemi.length, - numDirLightShadows: lights.directionalShadowMap.length, - numPointLightShadows: lights.pointShadowMap.length, - numSpotLightShadows: lights.spotShadowMap.length, - numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps, - numLightProbes: lights.numLightProbes, - numClippingPlanes: clipping.numPlanes, - numClipIntersection: clipping.numIntersection, - dithering: material.dithering, - shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0, - shadowMapType: renderer.shadowMap.type, - toneMapping, - decodeVideoTexture: HAS_MAP && material.map.isVideoTexture === true && ColorManagement.getTransfer(material.map.colorSpace) === SRGBTransfer, - decodeVideoTextureEmissive: HAS_EMISSIVEMAP && material.emissiveMap.isVideoTexture === true && ColorManagement.getTransfer(material.emissiveMap.colorSpace) === SRGBTransfer, - premultipliedAlpha: material.premultipliedAlpha, - doubleSided: material.side === DoubleSide, - flipSided: material.side === BackSide, - useDepthPacking: material.depthPacking >= 0, - depthPacking: material.depthPacking || 0, - index0AttributeName: material.index0AttributeName, - extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has("WEBGL_clip_cull_distance"), - extensionMultiDraw: (HAS_EXTENSIONS && material.extensions.multiDraw === true || IS_BATCHEDMESH) && extensions.has("WEBGL_multi_draw"), - rendererExtensionParallelShaderCompile: extensions.has("KHR_parallel_shader_compile"), - customProgramCacheKey: material.customProgramCacheKey() - }; - parameters.vertexUv1s = _activeChannels.has(1); - parameters.vertexUv2s = _activeChannels.has(2); - parameters.vertexUv3s = _activeChannels.has(3); - _activeChannels.clear(); - return parameters; - } - __name(getParameters, "getParameters"); - function getProgramCacheKey(parameters) { - const array = []; - if (parameters.shaderID) { - array.push(parameters.shaderID); - } else { - array.push(parameters.customVertexShaderID); - array.push(parameters.customFragmentShaderID); - } - if (parameters.defines !== void 0) { - for (const name in parameters.defines) { - array.push(name); - array.push(parameters.defines[name]); - } - } - if (parameters.isRawShaderMaterial === false) { - getProgramCacheKeyParameters(array, parameters); - getProgramCacheKeyBooleans(array, parameters); - array.push(renderer.outputColorSpace); - } - array.push(parameters.customProgramCacheKey); - return array.join(); - } - __name(getProgramCacheKey, "getProgramCacheKey"); - function getProgramCacheKeyParameters(array, parameters) { - array.push(parameters.precision); - array.push(parameters.outputColorSpace); - array.push(parameters.envMapMode); - array.push(parameters.envMapCubeUVHeight); - array.push(parameters.mapUv); - array.push(parameters.alphaMapUv); - array.push(parameters.lightMapUv); - array.push(parameters.aoMapUv); - array.push(parameters.bumpMapUv); - array.push(parameters.normalMapUv); - array.push(parameters.displacementMapUv); - array.push(parameters.emissiveMapUv); - array.push(parameters.metalnessMapUv); - array.push(parameters.roughnessMapUv); - array.push(parameters.anisotropyMapUv); - array.push(parameters.clearcoatMapUv); - array.push(parameters.clearcoatNormalMapUv); - array.push(parameters.clearcoatRoughnessMapUv); - array.push(parameters.iridescenceMapUv); - array.push(parameters.iridescenceThicknessMapUv); - array.push(parameters.sheenColorMapUv); - array.push(parameters.sheenRoughnessMapUv); - array.push(parameters.specularMapUv); - array.push(parameters.specularColorMapUv); - array.push(parameters.specularIntensityMapUv); - array.push(parameters.transmissionMapUv); - array.push(parameters.thicknessMapUv); - array.push(parameters.combine); - array.push(parameters.fogExp2); - array.push(parameters.sizeAttenuation); - array.push(parameters.morphTargetsCount); - array.push(parameters.morphAttributeCount); - array.push(parameters.numDirLights); - array.push(parameters.numPointLights); - array.push(parameters.numSpotLights); - array.push(parameters.numSpotLightMaps); - array.push(parameters.numHemiLights); - array.push(parameters.numRectAreaLights); - array.push(parameters.numDirLightShadows); - array.push(parameters.numPointLightShadows); - array.push(parameters.numSpotLightShadows); - array.push(parameters.numSpotLightShadowsWithMaps); - array.push(parameters.numLightProbes); - array.push(parameters.shadowMapType); - array.push(parameters.toneMapping); - array.push(parameters.numClippingPlanes); - array.push(parameters.numClipIntersection); - array.push(parameters.depthPacking); - } - __name(getProgramCacheKeyParameters, "getProgramCacheKeyParameters"); - function getProgramCacheKeyBooleans(array, parameters) { - _programLayers.disableAll(); - if (parameters.supportsVertexTextures) - _programLayers.enable(0); - if (parameters.instancing) - _programLayers.enable(1); - if (parameters.instancingColor) - _programLayers.enable(2); - if (parameters.instancingMorph) - _programLayers.enable(3); - if (parameters.matcap) - _programLayers.enable(4); - if (parameters.envMap) - _programLayers.enable(5); - if (parameters.normalMapObjectSpace) - _programLayers.enable(6); - if (parameters.normalMapTangentSpace) - _programLayers.enable(7); - if (parameters.clearcoat) - _programLayers.enable(8); - if (parameters.iridescence) - _programLayers.enable(9); - if (parameters.alphaTest) - _programLayers.enable(10); - if (parameters.vertexColors) - _programLayers.enable(11); - if (parameters.vertexAlphas) - _programLayers.enable(12); - if (parameters.vertexUv1s) - _programLayers.enable(13); - if (parameters.vertexUv2s) - _programLayers.enable(14); - if (parameters.vertexUv3s) - _programLayers.enable(15); - if (parameters.vertexTangents) - _programLayers.enable(16); - if (parameters.anisotropy) - _programLayers.enable(17); - if (parameters.alphaHash) - _programLayers.enable(18); - if (parameters.batching) - _programLayers.enable(19); - if (parameters.dispersion) - _programLayers.enable(20); - if (parameters.batchingColor) - _programLayers.enable(21); - array.push(_programLayers.mask); - _programLayers.disableAll(); - if (parameters.fog) - _programLayers.enable(0); - if (parameters.useFog) - _programLayers.enable(1); - if (parameters.flatShading) - _programLayers.enable(2); - if (parameters.logarithmicDepthBuffer) - _programLayers.enable(3); - if (parameters.reverseDepthBuffer) - _programLayers.enable(4); - if (parameters.skinning) - _programLayers.enable(5); - if (parameters.morphTargets) - _programLayers.enable(6); - if (parameters.morphNormals) - _programLayers.enable(7); - if (parameters.morphColors) - _programLayers.enable(8); - if (parameters.premultipliedAlpha) - _programLayers.enable(9); - if (parameters.shadowMapEnabled) - _programLayers.enable(10); - if (parameters.doubleSided) - _programLayers.enable(11); - if (parameters.flipSided) - _programLayers.enable(12); - if (parameters.useDepthPacking) - _programLayers.enable(13); - if (parameters.dithering) - _programLayers.enable(14); - if (parameters.transmission) - _programLayers.enable(15); - if (parameters.sheen) - _programLayers.enable(16); - if (parameters.opaque) - _programLayers.enable(17); - if (parameters.pointsUvs) - _programLayers.enable(18); - if (parameters.decodeVideoTexture) - _programLayers.enable(19); - if (parameters.decodeVideoTextureEmissive) - _programLayers.enable(20); - if (parameters.alphaToCoverage) - _programLayers.enable(21); - array.push(_programLayers.mask); - } - __name(getProgramCacheKeyBooleans, "getProgramCacheKeyBooleans"); - function getUniforms(material) { - const shaderID = shaderIDs[material.type]; - let uniforms; - if (shaderID) { - const shader = ShaderLib[shaderID]; - uniforms = UniformsUtils.clone(shader.uniforms); - } else { - uniforms = material.uniforms; - } - return uniforms; - } - __name(getUniforms, "getUniforms"); - function acquireProgram(parameters, cacheKey) { - let program; - for (let p = 0, pl = programs.length; p < pl; p++) { - const preexistingProgram = programs[p]; - if (preexistingProgram.cacheKey === cacheKey) { - program = preexistingProgram; - ++program.usedTimes; - break; - } - } - if (program === void 0) { - program = new WebGLProgram(renderer, cacheKey, parameters, bindingStates); - programs.push(program); - } - return program; - } - __name(acquireProgram, "acquireProgram"); - function releaseProgram(program) { - if (--program.usedTimes === 0) { - const i = programs.indexOf(program); - programs[i] = programs[programs.length - 1]; - programs.pop(); - program.destroy(); - } - } - __name(releaseProgram, "releaseProgram"); - function releaseShaderCache(material) { - _customShaders.remove(material); - } - __name(releaseShaderCache, "releaseShaderCache"); - function dispose() { - _customShaders.dispose(); - } - __name(dispose, "dispose"); - return { - getParameters, - getProgramCacheKey, - getUniforms, - acquireProgram, - releaseProgram, - releaseShaderCache, - // Exposed for resource monitoring & error feedback via renderer.info: - programs, - dispose - }; -} -__name(WebGLPrograms, "WebGLPrograms"); -function WebGLProperties() { - let properties = /* @__PURE__ */ new WeakMap(); - function has(object) { - return properties.has(object); - } - __name(has, "has"); - function get(object) { - let map = properties.get(object); - if (map === void 0) { - map = {}; - properties.set(object, map); - } - return map; - } - __name(get, "get"); - function remove(object) { - properties.delete(object); - } - __name(remove, "remove"); - function update(object, key, value) { - properties.get(object)[key] = value; - } - __name(update, "update"); - function dispose() { - properties = /* @__PURE__ */ new WeakMap(); - } - __name(dispose, "dispose"); - return { - has, - get, - remove, - update, - dispose - }; -} -__name(WebGLProperties, "WebGLProperties"); -function painterSortStable(a, b) { - if (a.groupOrder !== b.groupOrder) { - return a.groupOrder - b.groupOrder; - } else if (a.renderOrder !== b.renderOrder) { - return a.renderOrder - b.renderOrder; - } else if (a.material.id !== b.material.id) { - return a.material.id - b.material.id; - } else if (a.z !== b.z) { - return a.z - b.z; - } else { - return a.id - b.id; - } -} -__name(painterSortStable, "painterSortStable"); -function reversePainterSortStable(a, b) { - if (a.groupOrder !== b.groupOrder) { - return a.groupOrder - b.groupOrder; - } else if (a.renderOrder !== b.renderOrder) { - return a.renderOrder - b.renderOrder; - } else if (a.z !== b.z) { - return b.z - a.z; - } else { - return a.id - b.id; - } -} -__name(reversePainterSortStable, "reversePainterSortStable"); -function WebGLRenderList() { - const renderItems = []; - let renderItemsIndex = 0; - const opaque = []; - const transmissive = []; - const transparent = []; - function init() { - renderItemsIndex = 0; - opaque.length = 0; - transmissive.length = 0; - transparent.length = 0; - } - __name(init, "init"); - function getNextRenderItem(object, geometry, material, groupOrder, z, group) { - let renderItem = renderItems[renderItemsIndex]; - if (renderItem === void 0) { - renderItem = { - id: object.id, - object, - geometry, - material, - groupOrder, - renderOrder: object.renderOrder, - z, - group - }; - renderItems[renderItemsIndex] = renderItem; - } else { - renderItem.id = object.id; - renderItem.object = object; - renderItem.geometry = geometry; - renderItem.material = material; - renderItem.groupOrder = groupOrder; - renderItem.renderOrder = object.renderOrder; - renderItem.z = z; - renderItem.group = group; - } - renderItemsIndex++; - return renderItem; - } - __name(getNextRenderItem, "getNextRenderItem"); - function push(object, geometry, material, groupOrder, z, group) { - const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); - if (material.transmission > 0) { - transmissive.push(renderItem); - } else if (material.transparent === true) { - transparent.push(renderItem); - } else { - opaque.push(renderItem); - } - } - __name(push, "push"); - function unshift(object, geometry, material, groupOrder, z, group) { - const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); - if (material.transmission > 0) { - transmissive.unshift(renderItem); - } else if (material.transparent === true) { - transparent.unshift(renderItem); - } else { - opaque.unshift(renderItem); - } - } - __name(unshift, "unshift"); - function sort(customOpaqueSort, customTransparentSort) { - if (opaque.length > 1) opaque.sort(customOpaqueSort || painterSortStable); - if (transmissive.length > 1) transmissive.sort(customTransparentSort || reversePainterSortStable); - if (transparent.length > 1) transparent.sort(customTransparentSort || reversePainterSortStable); - } - __name(sort, "sort"); - function finish() { - for (let i = renderItemsIndex, il = renderItems.length; i < il; i++) { - const renderItem = renderItems[i]; - if (renderItem.id === null) break; - renderItem.id = null; - renderItem.object = null; - renderItem.geometry = null; - renderItem.material = null; - renderItem.group = null; - } - } - __name(finish, "finish"); - return { - opaque, - transmissive, - transparent, - init, - push, - unshift, - finish, - sort - }; -} -__name(WebGLRenderList, "WebGLRenderList"); -function WebGLRenderLists() { - let lists = /* @__PURE__ */ new WeakMap(); - function get(scene, renderCallDepth) { - const listArray = lists.get(scene); - let list; - if (listArray === void 0) { - list = new WebGLRenderList(); - lists.set(scene, [list]); - } else { - if (renderCallDepth >= listArray.length) { - list = new WebGLRenderList(); - listArray.push(list); - } else { - list = listArray[renderCallDepth]; - } - } - return list; - } - __name(get, "get"); - function dispose() { - lists = /* @__PURE__ */ new WeakMap(); - } - __name(dispose, "dispose"); - return { - get, - dispose - }; -} -__name(WebGLRenderLists, "WebGLRenderLists"); -function UniformsCache() { - const lights = {}; - return { - get: /* @__PURE__ */ __name(function(light) { - if (lights[light.id] !== void 0) { - return lights[light.id]; - } - let uniforms; - switch (light.type) { - case "DirectionalLight": - uniforms = { - direction: new Vector3(), - color: new Color() - }; - break; - case "SpotLight": - uniforms = { - position: new Vector3(), - direction: new Vector3(), - color: new Color(), - distance: 0, - coneCos: 0, - penumbraCos: 0, - decay: 0 - }; - break; - case "PointLight": - uniforms = { - position: new Vector3(), - color: new Color(), - distance: 0, - decay: 0 - }; - break; - case "HemisphereLight": - uniforms = { - direction: new Vector3(), - skyColor: new Color(), - groundColor: new Color() - }; - break; - case "RectAreaLight": - uniforms = { - color: new Color(), - position: new Vector3(), - halfWidth: new Vector3(), - halfHeight: new Vector3() - }; - break; - } - lights[light.id] = uniforms; - return uniforms; - }, "get") - }; -} -__name(UniformsCache, "UniformsCache"); -function ShadowUniformsCache() { - const lights = {}; - return { - get: /* @__PURE__ */ __name(function(light) { - if (lights[light.id] !== void 0) { - return lights[light.id]; - } - let uniforms; - switch (light.type) { - case "DirectionalLight": - uniforms = { - shadowIntensity: 1, - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2() - }; - break; - case "SpotLight": - uniforms = { - shadowIntensity: 1, - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2() - }; - break; - case "PointLight": - uniforms = { - shadowIntensity: 1, - shadowBias: 0, - shadowNormalBias: 0, - shadowRadius: 1, - shadowMapSize: new Vector2(), - shadowCameraNear: 1, - shadowCameraFar: 1e3 - }; - break; - } - lights[light.id] = uniforms; - return uniforms; - }, "get") - }; -} -__name(ShadowUniformsCache, "ShadowUniformsCache"); -let nextVersion = 0; -function shadowCastingAndTexturingLightsFirst(lightA, lightB) { - return (lightB.castShadow ? 2 : 0) - (lightA.castShadow ? 2 : 0) + (lightB.map ? 1 : 0) - (lightA.map ? 1 : 0); -} -__name(shadowCastingAndTexturingLightsFirst, "shadowCastingAndTexturingLightsFirst"); -function WebGLLights(extensions) { - const cache = new UniformsCache(); - const shadowCache = ShadowUniformsCache(); - const state = { - version: 0, - hash: { - directionalLength: -1, - pointLength: -1, - spotLength: -1, - rectAreaLength: -1, - hemiLength: -1, - numDirectionalShadows: -1, - numPointShadows: -1, - numSpotShadows: -1, - numSpotMaps: -1, - numLightProbes: -1 - }, - ambient: [0, 0, 0], - probe: [], - directional: [], - directionalShadow: [], - directionalShadowMap: [], - directionalShadowMatrix: [], - spot: [], - spotLightMap: [], - spotShadow: [], - spotShadowMap: [], - spotLightMatrix: [], - rectArea: [], - rectAreaLTC1: null, - rectAreaLTC2: null, - point: [], - pointShadow: [], - pointShadowMap: [], - pointShadowMatrix: [], - hemi: [], - numSpotLightShadowsWithMaps: 0, - numLightProbes: 0 - }; - for (let i = 0; i < 9; i++) state.probe.push(new Vector3()); - const vector3 = new Vector3(); - const matrix4 = new Matrix4(); - const matrix42 = new Matrix4(); - function setup(lights) { - let r = 0, g = 0, b = 0; - for (let i = 0; i < 9; i++) state.probe[i].set(0, 0, 0); - let directionalLength = 0; - let pointLength = 0; - let spotLength = 0; - let rectAreaLength = 0; - let hemiLength = 0; - let numDirectionalShadows = 0; - let numPointShadows = 0; - let numSpotShadows = 0; - let numSpotMaps = 0; - let numSpotShadowsWithMaps = 0; - let numLightProbes = 0; - lights.sort(shadowCastingAndTexturingLightsFirst); - for (let i = 0, l = lights.length; i < l; i++) { - const light = lights[i]; - const color = light.color; - const intensity = light.intensity; - const distance = light.distance; - const shadowMap = light.shadow && light.shadow.map ? light.shadow.map.texture : null; - if (light.isAmbientLight) { - r += color.r * intensity; - g += color.g * intensity; - b += color.b * intensity; - } else if (light.isLightProbe) { - for (let j = 0; j < 9; j++) { - state.probe[j].addScaledVector(light.sh.coefficients[j], intensity); - } - numLightProbes++; - } else if (light.isDirectionalLight) { - const uniforms = cache.get(light); - uniforms.color.copy(light.color).multiplyScalar(light.intensity); - if (light.castShadow) { - const shadow = light.shadow; - const shadowUniforms = shadowCache.get(light); - shadowUniforms.shadowIntensity = shadow.intensity; - shadowUniforms.shadowBias = shadow.bias; - shadowUniforms.shadowNormalBias = shadow.normalBias; - shadowUniforms.shadowRadius = shadow.radius; - shadowUniforms.shadowMapSize = shadow.mapSize; - state.directionalShadow[directionalLength] = shadowUniforms; - state.directionalShadowMap[directionalLength] = shadowMap; - state.directionalShadowMatrix[directionalLength] = light.shadow.matrix; - numDirectionalShadows++; - } - state.directional[directionalLength] = uniforms; - directionalLength++; - } else if (light.isSpotLight) { - const uniforms = cache.get(light); - uniforms.position.setFromMatrixPosition(light.matrixWorld); - uniforms.color.copy(color).multiplyScalar(intensity); - uniforms.distance = distance; - uniforms.coneCos = Math.cos(light.angle); - uniforms.penumbraCos = Math.cos(light.angle * (1 - light.penumbra)); - uniforms.decay = light.decay; - state.spot[spotLength] = uniforms; - const shadow = light.shadow; - if (light.map) { - state.spotLightMap[numSpotMaps] = light.map; - numSpotMaps++; - shadow.updateMatrices(light); - if (light.castShadow) numSpotShadowsWithMaps++; - } - state.spotLightMatrix[spotLength] = shadow.matrix; - if (light.castShadow) { - const shadowUniforms = shadowCache.get(light); - shadowUniforms.shadowIntensity = shadow.intensity; - shadowUniforms.shadowBias = shadow.bias; - shadowUniforms.shadowNormalBias = shadow.normalBias; - shadowUniforms.shadowRadius = shadow.radius; - shadowUniforms.shadowMapSize = shadow.mapSize; - state.spotShadow[spotLength] = shadowUniforms; - state.spotShadowMap[spotLength] = shadowMap; - numSpotShadows++; - } - spotLength++; - } else if (light.isRectAreaLight) { - const uniforms = cache.get(light); - uniforms.color.copy(color).multiplyScalar(intensity); - uniforms.halfWidth.set(light.width * 0.5, 0, 0); - uniforms.halfHeight.set(0, light.height * 0.5, 0); - state.rectArea[rectAreaLength] = uniforms; - rectAreaLength++; - } else if (light.isPointLight) { - const uniforms = cache.get(light); - uniforms.color.copy(light.color).multiplyScalar(light.intensity); - uniforms.distance = light.distance; - uniforms.decay = light.decay; - if (light.castShadow) { - const shadow = light.shadow; - const shadowUniforms = shadowCache.get(light); - shadowUniforms.shadowIntensity = shadow.intensity; - shadowUniforms.shadowBias = shadow.bias; - shadowUniforms.shadowNormalBias = shadow.normalBias; - shadowUniforms.shadowRadius = shadow.radius; - shadowUniforms.shadowMapSize = shadow.mapSize; - shadowUniforms.shadowCameraNear = shadow.camera.near; - shadowUniforms.shadowCameraFar = shadow.camera.far; - state.pointShadow[pointLength] = shadowUniforms; - state.pointShadowMap[pointLength] = shadowMap; - state.pointShadowMatrix[pointLength] = light.shadow.matrix; - numPointShadows++; - } - state.point[pointLength] = uniforms; - pointLength++; - } else if (light.isHemisphereLight) { - const uniforms = cache.get(light); - uniforms.skyColor.copy(light.color).multiplyScalar(intensity); - uniforms.groundColor.copy(light.groundColor).multiplyScalar(intensity); - state.hemi[hemiLength] = uniforms; - hemiLength++; - } - } - if (rectAreaLength > 0) { - if (extensions.has("OES_texture_float_linear") === true) { - state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1; - state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2; - } else { - state.rectAreaLTC1 = UniformsLib.LTC_HALF_1; - state.rectAreaLTC2 = UniformsLib.LTC_HALF_2; - } - } - state.ambient[0] = r; - state.ambient[1] = g; - state.ambient[2] = b; - const hash = state.hash; - if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows || hash.numSpotMaps !== numSpotMaps || hash.numLightProbes !== numLightProbes) { - state.directional.length = directionalLength; - state.spot.length = spotLength; - state.rectArea.length = rectAreaLength; - state.point.length = pointLength; - state.hemi.length = hemiLength; - state.directionalShadow.length = numDirectionalShadows; - state.directionalShadowMap.length = numDirectionalShadows; - state.pointShadow.length = numPointShadows; - state.pointShadowMap.length = numPointShadows; - state.spotShadow.length = numSpotShadows; - state.spotShadowMap.length = numSpotShadows; - state.directionalShadowMatrix.length = numDirectionalShadows; - state.pointShadowMatrix.length = numPointShadows; - state.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps; - state.spotLightMap.length = numSpotMaps; - state.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps; - state.numLightProbes = numLightProbes; - hash.directionalLength = directionalLength; - hash.pointLength = pointLength; - hash.spotLength = spotLength; - hash.rectAreaLength = rectAreaLength; - hash.hemiLength = hemiLength; - hash.numDirectionalShadows = numDirectionalShadows; - hash.numPointShadows = numPointShadows; - hash.numSpotShadows = numSpotShadows; - hash.numSpotMaps = numSpotMaps; - hash.numLightProbes = numLightProbes; - state.version = nextVersion++; - } - } - __name(setup, "setup"); - function setupView(lights, camera) { - let directionalLength = 0; - let pointLength = 0; - let spotLength = 0; - let rectAreaLength = 0; - let hemiLength = 0; - const viewMatrix = camera.matrixWorldInverse; - for (let i = 0, l = lights.length; i < l; i++) { - const light = lights[i]; - if (light.isDirectionalLight) { - const uniforms = state.directional[directionalLength]; - uniforms.direction.setFromMatrixPosition(light.matrixWorld); - vector3.setFromMatrixPosition(light.target.matrixWorld); - uniforms.direction.sub(vector3); - uniforms.direction.transformDirection(viewMatrix); - directionalLength++; - } else if (light.isSpotLight) { - const uniforms = state.spot[spotLength]; - uniforms.position.setFromMatrixPosition(light.matrixWorld); - uniforms.position.applyMatrix4(viewMatrix); - uniforms.direction.setFromMatrixPosition(light.matrixWorld); - vector3.setFromMatrixPosition(light.target.matrixWorld); - uniforms.direction.sub(vector3); - uniforms.direction.transformDirection(viewMatrix); - spotLength++; - } else if (light.isRectAreaLight) { - const uniforms = state.rectArea[rectAreaLength]; - uniforms.position.setFromMatrixPosition(light.matrixWorld); - uniforms.position.applyMatrix4(viewMatrix); - matrix42.identity(); - matrix4.copy(light.matrixWorld); - matrix4.premultiply(viewMatrix); - matrix42.extractRotation(matrix4); - uniforms.halfWidth.set(light.width * 0.5, 0, 0); - uniforms.halfHeight.set(0, light.height * 0.5, 0); - uniforms.halfWidth.applyMatrix4(matrix42); - uniforms.halfHeight.applyMatrix4(matrix42); - rectAreaLength++; - } else if (light.isPointLight) { - const uniforms = state.point[pointLength]; - uniforms.position.setFromMatrixPosition(light.matrixWorld); - uniforms.position.applyMatrix4(viewMatrix); - pointLength++; - } else if (light.isHemisphereLight) { - const uniforms = state.hemi[hemiLength]; - uniforms.direction.setFromMatrixPosition(light.matrixWorld); - uniforms.direction.transformDirection(viewMatrix); - hemiLength++; - } - } - } - __name(setupView, "setupView"); - return { - setup, - setupView, - state - }; -} -__name(WebGLLights, "WebGLLights"); -function WebGLRenderState(extensions) { - const lights = new WebGLLights(extensions); - const lightsArray = []; - const shadowsArray = []; - function init(camera) { - state.camera = camera; - lightsArray.length = 0; - shadowsArray.length = 0; - } - __name(init, "init"); - function pushLight(light) { - lightsArray.push(light); - } - __name(pushLight, "pushLight"); - function pushShadow(shadowLight) { - shadowsArray.push(shadowLight); - } - __name(pushShadow, "pushShadow"); - function setupLights() { - lights.setup(lightsArray); - } - __name(setupLights, "setupLights"); - function setupLightsView(camera) { - lights.setupView(lightsArray, camera); - } - __name(setupLightsView, "setupLightsView"); - const state = { - lightsArray, - shadowsArray, - camera: null, - lights, - transmissionRenderTarget: {} - }; - return { - init, - state, - setupLights, - setupLightsView, - pushLight, - pushShadow - }; -} -__name(WebGLRenderState, "WebGLRenderState"); -function WebGLRenderStates(extensions) { - let renderStates = /* @__PURE__ */ new WeakMap(); - function get(scene, renderCallDepth = 0) { - const renderStateArray = renderStates.get(scene); - let renderState; - if (renderStateArray === void 0) { - renderState = new WebGLRenderState(extensions); - renderStates.set(scene, [renderState]); - } else { - if (renderCallDepth >= renderStateArray.length) { - renderState = new WebGLRenderState(extensions); - renderStateArray.push(renderState); - } else { - renderState = renderStateArray[renderCallDepth]; - } - } - return renderState; - } - __name(get, "get"); - function dispose() { - renderStates = /* @__PURE__ */ new WeakMap(); - } - __name(dispose, "dispose"); - return { - get, - dispose - }; -} -__name(WebGLRenderStates, "WebGLRenderStates"); -class MeshDepthMaterial extends Material { - static { - __name(this, "MeshDepthMaterial"); - } - static get type() { - return "MeshDepthMaterial"; - } - constructor(parameters) { - super(); - this.isMeshDepthMaterial = true; - this.depthPacking = BasicDepthPacking; - this.map = null; - this.alphaMap = null; - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.depthPacking = source.depthPacking; - this.map = source.map; - this.alphaMap = source.alphaMap; - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - return this; - } -} -class MeshDistanceMaterial extends Material { - static { - __name(this, "MeshDistanceMaterial"); - } - static get type() { - return "MeshDistanceMaterial"; - } - constructor(parameters) { - super(); - this.isMeshDistanceMaterial = true; - this.map = null; - this.alphaMap = null; - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.map = source.map; - this.alphaMap = source.alphaMap; - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - return this; - } -} -const vertex = "void main() {\n gl_Position = vec4( position, 1.0 );\n}"; -const fragment = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"; -function WebGLShadowMap(renderer, objects, capabilities) { - let _frustum2 = new Frustum(); - const _shadowMapSize = new Vector2(), _viewportSize = new Vector2(), _viewport = new Vector4(), _depthMaterial = new MeshDepthMaterial({ depthPacking: RGBADepthPacking }), _distanceMaterial = new MeshDistanceMaterial(), _materialCache = {}, _maxTextureSize = capabilities.maxTextureSize; - const shadowSide = { [FrontSide]: BackSide, [BackSide]: FrontSide, [DoubleSide]: DoubleSide }; - const shadowMaterialVertical = new ShaderMaterial({ - defines: { - VSM_SAMPLES: 8 - }, - uniforms: { - shadow_pass: { value: null }, - resolution: { value: new Vector2() }, - radius: { value: 4 } - }, - vertexShader: vertex, - fragmentShader: fragment - }); - const shadowMaterialHorizontal = shadowMaterialVertical.clone(); - shadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1; - const fullScreenTri = new BufferGeometry(); - fullScreenTri.setAttribute( - "position", - new BufferAttribute( - new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]), - 3 - ) - ); - const fullScreenMesh = new Mesh(fullScreenTri, shadowMaterialVertical); - const scope = this; - this.enabled = false; - this.autoUpdate = true; - this.needsUpdate = false; - this.type = PCFShadowMap; - let _previousType = this.type; - this.render = function(lights, scene, camera) { - if (scope.enabled === false) return; - if (scope.autoUpdate === false && scope.needsUpdate === false) return; - if (lights.length === 0) return; - const currentRenderTarget = renderer.getRenderTarget(); - const activeCubeFace = renderer.getActiveCubeFace(); - const activeMipmapLevel = renderer.getActiveMipmapLevel(); - const _state = renderer.state; - _state.setBlending(NoBlending); - _state.buffers.color.setClear(1, 1, 1, 1); - _state.buffers.depth.setTest(true); - _state.setScissorTest(false); - const toVSM = _previousType !== VSMShadowMap && this.type === VSMShadowMap; - const fromVSM = _previousType === VSMShadowMap && this.type !== VSMShadowMap; - for (let i = 0, il = lights.length; i < il; i++) { - const light = lights[i]; - const shadow = light.shadow; - if (shadow === void 0) { - console.warn("THREE.WebGLShadowMap:", light, "has no shadow."); - continue; - } - if (shadow.autoUpdate === false && shadow.needsUpdate === false) continue; - _shadowMapSize.copy(shadow.mapSize); - const shadowFrameExtents = shadow.getFrameExtents(); - _shadowMapSize.multiply(shadowFrameExtents); - _viewportSize.copy(shadow.mapSize); - if (_shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize) { - if (_shadowMapSize.x > _maxTextureSize) { - _viewportSize.x = Math.floor(_maxTextureSize / shadowFrameExtents.x); - _shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x; - shadow.mapSize.x = _viewportSize.x; - } - if (_shadowMapSize.y > _maxTextureSize) { - _viewportSize.y = Math.floor(_maxTextureSize / shadowFrameExtents.y); - _shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y; - shadow.mapSize.y = _viewportSize.y; - } - } - if (shadow.map === null || toVSM === true || fromVSM === true) { - const pars = this.type !== VSMShadowMap ? { minFilter: NearestFilter, magFilter: NearestFilter } : {}; - if (shadow.map !== null) { - shadow.map.dispose(); - } - shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars); - shadow.map.texture.name = light.name + ".shadowMap"; - shadow.camera.updateProjectionMatrix(); - } - renderer.setRenderTarget(shadow.map); - renderer.clear(); - const viewportCount = shadow.getViewportCount(); - for (let vp = 0; vp < viewportCount; vp++) { - const viewport = shadow.getViewport(vp); - _viewport.set( - _viewportSize.x * viewport.x, - _viewportSize.y * viewport.y, - _viewportSize.x * viewport.z, - _viewportSize.y * viewport.w - ); - _state.viewport(_viewport); - shadow.updateMatrices(light, vp); - _frustum2 = shadow.getFrustum(); - renderObject(scene, camera, shadow.camera, light, this.type); - } - if (shadow.isPointLightShadow !== true && this.type === VSMShadowMap) { - VSMPass(shadow, camera); - } - shadow.needsUpdate = false; - } - _previousType = this.type; - scope.needsUpdate = false; - renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel); - }; - function VSMPass(shadow, camera) { - const geometry = objects.update(fullScreenMesh); - if (shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples) { - shadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples; - shadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples; - shadowMaterialVertical.needsUpdate = true; - shadowMaterialHorizontal.needsUpdate = true; - } - if (shadow.mapPass === null) { - shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y); - } - shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture; - shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize; - shadowMaterialVertical.uniforms.radius.value = shadow.radius; - renderer.setRenderTarget(shadow.mapPass); - renderer.clear(); - renderer.renderBufferDirect(camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null); - shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture; - shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize; - shadowMaterialHorizontal.uniforms.radius.value = shadow.radius; - renderer.setRenderTarget(shadow.map); - renderer.clear(); - renderer.renderBufferDirect(camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null); - } - __name(VSMPass, "VSMPass"); - function getDepthMaterial(object, material, light, type) { - let result = null; - const customMaterial = light.isPointLight === true ? object.customDistanceMaterial : object.customDepthMaterial; - if (customMaterial !== void 0) { - result = customMaterial; - } else { - result = light.isPointLight === true ? _distanceMaterial : _depthMaterial; - if (renderer.localClippingEnabled && material.clipShadows === true && Array.isArray(material.clippingPlanes) && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0 || material.map && material.alphaTest > 0) { - const keyA = result.uuid, keyB = material.uuid; - let materialsForVariant = _materialCache[keyA]; - if (materialsForVariant === void 0) { - materialsForVariant = {}; - _materialCache[keyA] = materialsForVariant; - } - let cachedMaterial = materialsForVariant[keyB]; - if (cachedMaterial === void 0) { - cachedMaterial = result.clone(); - materialsForVariant[keyB] = cachedMaterial; - material.addEventListener("dispose", onMaterialDispose); - } - result = cachedMaterial; - } - } - result.visible = material.visible; - result.wireframe = material.wireframe; - if (type === VSMShadowMap) { - result.side = material.shadowSide !== null ? material.shadowSide : material.side; - } else { - result.side = material.shadowSide !== null ? material.shadowSide : shadowSide[material.side]; - } - result.alphaMap = material.alphaMap; - result.alphaTest = material.alphaTest; - result.map = material.map; - result.clipShadows = material.clipShadows; - result.clippingPlanes = material.clippingPlanes; - result.clipIntersection = material.clipIntersection; - result.displacementMap = material.displacementMap; - result.displacementScale = material.displacementScale; - result.displacementBias = material.displacementBias; - result.wireframeLinewidth = material.wireframeLinewidth; - result.linewidth = material.linewidth; - if (light.isPointLight === true && result.isMeshDistanceMaterial === true) { - const materialProperties = renderer.properties.get(result); - materialProperties.light = light; - } - return result; - } - __name(getDepthMaterial, "getDepthMaterial"); - function renderObject(object, camera, shadowCamera, light, type) { - if (object.visible === false) return; - const visible = object.layers.test(camera.layers); - if (visible && (object.isMesh || object.isLine || object.isPoints)) { - if ((object.castShadow || object.receiveShadow && type === VSMShadowMap) && (!object.frustumCulled || _frustum2.intersectsObject(object))) { - object.modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse, object.matrixWorld); - const geometry = objects.update(object); - const material = object.material; - if (Array.isArray(material)) { - const groups = geometry.groups; - for (let k = 0, kl = groups.length; k < kl; k++) { - const group = groups[k]; - const groupMaterial = material[group.materialIndex]; - if (groupMaterial && groupMaterial.visible) { - const depthMaterial = getDepthMaterial(object, groupMaterial, light, type); - object.onBeforeShadow(renderer, object, camera, shadowCamera, geometry, depthMaterial, group); - renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, group); - object.onAfterShadow(renderer, object, camera, shadowCamera, geometry, depthMaterial, group); - } - } - } else if (material.visible) { - const depthMaterial = getDepthMaterial(object, material, light, type); - object.onBeforeShadow(renderer, object, camera, shadowCamera, geometry, depthMaterial, null); - renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, null); - object.onAfterShadow(renderer, object, camera, shadowCamera, geometry, depthMaterial, null); - } - } - } - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { - renderObject(children[i], camera, shadowCamera, light, type); - } - } - __name(renderObject, "renderObject"); - function onMaterialDispose(event) { - const material = event.target; - material.removeEventListener("dispose", onMaterialDispose); - for (const id2 in _materialCache) { - const cache = _materialCache[id2]; - const uuid = event.target.uuid; - if (uuid in cache) { - const shadowMaterial = cache[uuid]; - shadowMaterial.dispose(); - delete cache[uuid]; - } - } - } - __name(onMaterialDispose, "onMaterialDispose"); -} -__name(WebGLShadowMap, "WebGLShadowMap"); -const reversedFuncs = { - [NeverDepth]: AlwaysDepth, - [LessDepth]: GreaterDepth, - [EqualDepth]: NotEqualDepth, - [LessEqualDepth]: GreaterEqualDepth, - [AlwaysDepth]: NeverDepth, - [GreaterDepth]: LessDepth, - [NotEqualDepth]: EqualDepth, - [GreaterEqualDepth]: LessEqualDepth -}; -function WebGLState(gl, extensions) { - function ColorBuffer() { - let locked = false; - const color = new Vector4(); - let currentColorMask = null; - const currentColorClear = new Vector4(0, 0, 0, 0); - return { - setMask: /* @__PURE__ */ __name(function(colorMask) { - if (currentColorMask !== colorMask && !locked) { - gl.colorMask(colorMask, colorMask, colorMask, colorMask); - currentColorMask = colorMask; - } - }, "setMask"), - setLocked: /* @__PURE__ */ __name(function(lock) { - locked = lock; - }, "setLocked"), - setClear: /* @__PURE__ */ __name(function(r, g, b, a, premultipliedAlpha) { - if (premultipliedAlpha === true) { - r *= a; - g *= a; - b *= a; - } - color.set(r, g, b, a); - if (currentColorClear.equals(color) === false) { - gl.clearColor(r, g, b, a); - currentColorClear.copy(color); - } - }, "setClear"), - reset: /* @__PURE__ */ __name(function() { - locked = false; - currentColorMask = null; - currentColorClear.set(-1, 0, 0, 0); - }, "reset") - }; - } - __name(ColorBuffer, "ColorBuffer"); - function DepthBuffer() { - let locked = false; - let reversed = false; - let currentDepthMask = null; - let currentDepthFunc = null; - let currentDepthClear = null; - return { - setReversed: /* @__PURE__ */ __name(function(value) { - if (reversed !== value) { - const ext2 = extensions.get("EXT_clip_control"); - if (reversed) { - ext2.clipControlEXT(ext2.LOWER_LEFT_EXT, ext2.ZERO_TO_ONE_EXT); - } else { - ext2.clipControlEXT(ext2.LOWER_LEFT_EXT, ext2.NEGATIVE_ONE_TO_ONE_EXT); - } - const oldDepth = currentDepthClear; - currentDepthClear = null; - this.setClear(oldDepth); - } - reversed = value; - }, "setReversed"), - getReversed: /* @__PURE__ */ __name(function() { - return reversed; - }, "getReversed"), - setTest: /* @__PURE__ */ __name(function(depthTest) { - if (depthTest) { - enable(gl.DEPTH_TEST); - } else { - disable(gl.DEPTH_TEST); - } - }, "setTest"), - setMask: /* @__PURE__ */ __name(function(depthMask) { - if (currentDepthMask !== depthMask && !locked) { - gl.depthMask(depthMask); - currentDepthMask = depthMask; - } - }, "setMask"), - setFunc: /* @__PURE__ */ __name(function(depthFunc) { - if (reversed) depthFunc = reversedFuncs[depthFunc]; - if (currentDepthFunc !== depthFunc) { - switch (depthFunc) { - case NeverDepth: - gl.depthFunc(gl.NEVER); - break; - case AlwaysDepth: - gl.depthFunc(gl.ALWAYS); - break; - case LessDepth: - gl.depthFunc(gl.LESS); - break; - case LessEqualDepth: - gl.depthFunc(gl.LEQUAL); - break; - case EqualDepth: - gl.depthFunc(gl.EQUAL); - break; - case GreaterEqualDepth: - gl.depthFunc(gl.GEQUAL); - break; - case GreaterDepth: - gl.depthFunc(gl.GREATER); - break; - case NotEqualDepth: - gl.depthFunc(gl.NOTEQUAL); - break; - default: - gl.depthFunc(gl.LEQUAL); - } - currentDepthFunc = depthFunc; - } - }, "setFunc"), - setLocked: /* @__PURE__ */ __name(function(lock) { - locked = lock; - }, "setLocked"), - setClear: /* @__PURE__ */ __name(function(depth) { - if (currentDepthClear !== depth) { - if (reversed) { - depth = 1 - depth; - } - gl.clearDepth(depth); - currentDepthClear = depth; - } - }, "setClear"), - reset: /* @__PURE__ */ __name(function() { - locked = false; - currentDepthMask = null; - currentDepthFunc = null; - currentDepthClear = null; - reversed = false; - }, "reset") - }; - } - __name(DepthBuffer, "DepthBuffer"); - function StencilBuffer() { - let locked = false; - let currentStencilMask = null; - let currentStencilFunc = null; - let currentStencilRef = null; - let currentStencilFuncMask = null; - let currentStencilFail = null; - let currentStencilZFail = null; - let currentStencilZPass = null; - let currentStencilClear = null; - return { - setTest: /* @__PURE__ */ __name(function(stencilTest) { - if (!locked) { - if (stencilTest) { - enable(gl.STENCIL_TEST); - } else { - disable(gl.STENCIL_TEST); - } - } - }, "setTest"), - setMask: /* @__PURE__ */ __name(function(stencilMask) { - if (currentStencilMask !== stencilMask && !locked) { - gl.stencilMask(stencilMask); - currentStencilMask = stencilMask; - } - }, "setMask"), - setFunc: /* @__PURE__ */ __name(function(stencilFunc, stencilRef, stencilMask) { - if (currentStencilFunc !== stencilFunc || currentStencilRef !== stencilRef || currentStencilFuncMask !== stencilMask) { - gl.stencilFunc(stencilFunc, stencilRef, stencilMask); - currentStencilFunc = stencilFunc; - currentStencilRef = stencilRef; - currentStencilFuncMask = stencilMask; - } - }, "setFunc"), - setOp: /* @__PURE__ */ __name(function(stencilFail, stencilZFail, stencilZPass) { - if (currentStencilFail !== stencilFail || currentStencilZFail !== stencilZFail || currentStencilZPass !== stencilZPass) { - gl.stencilOp(stencilFail, stencilZFail, stencilZPass); - currentStencilFail = stencilFail; - currentStencilZFail = stencilZFail; - currentStencilZPass = stencilZPass; - } - }, "setOp"), - setLocked: /* @__PURE__ */ __name(function(lock) { - locked = lock; - }, "setLocked"), - setClear: /* @__PURE__ */ __name(function(stencil) { - if (currentStencilClear !== stencil) { - gl.clearStencil(stencil); - currentStencilClear = stencil; - } - }, "setClear"), - reset: /* @__PURE__ */ __name(function() { - locked = false; - currentStencilMask = null; - currentStencilFunc = null; - currentStencilRef = null; - currentStencilFuncMask = null; - currentStencilFail = null; - currentStencilZFail = null; - currentStencilZPass = null; - currentStencilClear = null; - }, "reset") - }; - } - __name(StencilBuffer, "StencilBuffer"); - const colorBuffer = new ColorBuffer(); - const depthBuffer = new DepthBuffer(); - const stencilBuffer = new StencilBuffer(); - const uboBindings = /* @__PURE__ */ new WeakMap(); - const uboProgramMap = /* @__PURE__ */ new WeakMap(); - let enabledCapabilities = {}; - let currentBoundFramebuffers = {}; - let currentDrawbuffers = /* @__PURE__ */ new WeakMap(); - let defaultDrawbuffers = []; - let currentProgram = null; - let currentBlendingEnabled = false; - let currentBlending = null; - let currentBlendEquation = null; - let currentBlendSrc = null; - let currentBlendDst = null; - let currentBlendEquationAlpha = null; - let currentBlendSrcAlpha = null; - let currentBlendDstAlpha = null; - let currentBlendColor = new Color(0, 0, 0); - let currentBlendAlpha = 0; - let currentPremultipledAlpha = false; - let currentFlipSided = null; - let currentCullFace = null; - let currentLineWidth = null; - let currentPolygonOffsetFactor = null; - let currentPolygonOffsetUnits = null; - const maxTextures = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS); - let lineWidthAvailable = false; - let version = 0; - const glVersion = gl.getParameter(gl.VERSION); - if (glVersion.indexOf("WebGL") !== -1) { - version = parseFloat(/^WebGL (\d)/.exec(glVersion)[1]); - lineWidthAvailable = version >= 1; - } else if (glVersion.indexOf("OpenGL ES") !== -1) { - version = parseFloat(/^OpenGL ES (\d)/.exec(glVersion)[1]); - lineWidthAvailable = version >= 2; - } - let currentTextureSlot = null; - let currentBoundTextures = {}; - const scissorParam = gl.getParameter(gl.SCISSOR_BOX); - const viewportParam = gl.getParameter(gl.VIEWPORT); - const currentScissor = new Vector4().fromArray(scissorParam); - const currentViewport = new Vector4().fromArray(viewportParam); - function createTexture(type, target, count, dimensions) { - const data = new Uint8Array(4); - const texture = gl.createTexture(); - gl.bindTexture(type, texture); - gl.texParameteri(type, gl.TEXTURE_MIN_FILTER, gl.NEAREST); - gl.texParameteri(type, gl.TEXTURE_MAG_FILTER, gl.NEAREST); - for (let i = 0; i < count; i++) { - if (type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY) { - gl.texImage3D(target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); - } else { - gl.texImage2D(target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); - } - } - return texture; - } - __name(createTexture, "createTexture"); - const emptyTextures = {}; - emptyTextures[gl.TEXTURE_2D] = createTexture(gl.TEXTURE_2D, gl.TEXTURE_2D, 1); - emptyTextures[gl.TEXTURE_CUBE_MAP] = createTexture(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6); - emptyTextures[gl.TEXTURE_2D_ARRAY] = createTexture(gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1); - emptyTextures[gl.TEXTURE_3D] = createTexture(gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1); - colorBuffer.setClear(0, 0, 0, 1); - depthBuffer.setClear(1); - stencilBuffer.setClear(0); - enable(gl.DEPTH_TEST); - depthBuffer.setFunc(LessEqualDepth); - setFlipSided(false); - setCullFace(CullFaceBack); - enable(gl.CULL_FACE); - setBlending(NoBlending); - function enable(id2) { - if (enabledCapabilities[id2] !== true) { - gl.enable(id2); - enabledCapabilities[id2] = true; - } - } - __name(enable, "enable"); - function disable(id2) { - if (enabledCapabilities[id2] !== false) { - gl.disable(id2); - enabledCapabilities[id2] = false; - } - } - __name(disable, "disable"); - function bindFramebuffer(target, framebuffer) { - if (currentBoundFramebuffers[target] !== framebuffer) { - gl.bindFramebuffer(target, framebuffer); - currentBoundFramebuffers[target] = framebuffer; - if (target === gl.DRAW_FRAMEBUFFER) { - currentBoundFramebuffers[gl.FRAMEBUFFER] = framebuffer; - } - if (target === gl.FRAMEBUFFER) { - currentBoundFramebuffers[gl.DRAW_FRAMEBUFFER] = framebuffer; - } - return true; - } - return false; - } - __name(bindFramebuffer, "bindFramebuffer"); - function drawBuffers(renderTarget, framebuffer) { - let drawBuffers2 = defaultDrawbuffers; - let needsUpdate = false; - if (renderTarget) { - drawBuffers2 = currentDrawbuffers.get(framebuffer); - if (drawBuffers2 === void 0) { - drawBuffers2 = []; - currentDrawbuffers.set(framebuffer, drawBuffers2); - } - const textures = renderTarget.textures; - if (drawBuffers2.length !== textures.length || drawBuffers2[0] !== gl.COLOR_ATTACHMENT0) { - for (let i = 0, il = textures.length; i < il; i++) { - drawBuffers2[i] = gl.COLOR_ATTACHMENT0 + i; - } - drawBuffers2.length = textures.length; - needsUpdate = true; - } - } else { - if (drawBuffers2[0] !== gl.BACK) { - drawBuffers2[0] = gl.BACK; - needsUpdate = true; - } - } - if (needsUpdate) { - gl.drawBuffers(drawBuffers2); - } - } - __name(drawBuffers, "drawBuffers"); - function useProgram(program) { - if (currentProgram !== program) { - gl.useProgram(program); - currentProgram = program; - return true; - } - return false; - } - __name(useProgram, "useProgram"); - const equationToGL = { - [AddEquation]: gl.FUNC_ADD, - [SubtractEquation]: gl.FUNC_SUBTRACT, - [ReverseSubtractEquation]: gl.FUNC_REVERSE_SUBTRACT - }; - equationToGL[MinEquation] = gl.MIN; - equationToGL[MaxEquation] = gl.MAX; - const factorToGL = { - [ZeroFactor]: gl.ZERO, - [OneFactor]: gl.ONE, - [SrcColorFactor]: gl.SRC_COLOR, - [SrcAlphaFactor]: gl.SRC_ALPHA, - [SrcAlphaSaturateFactor]: gl.SRC_ALPHA_SATURATE, - [DstColorFactor]: gl.DST_COLOR, - [DstAlphaFactor]: gl.DST_ALPHA, - [OneMinusSrcColorFactor]: gl.ONE_MINUS_SRC_COLOR, - [OneMinusSrcAlphaFactor]: gl.ONE_MINUS_SRC_ALPHA, - [OneMinusDstColorFactor]: gl.ONE_MINUS_DST_COLOR, - [OneMinusDstAlphaFactor]: gl.ONE_MINUS_DST_ALPHA, - [ConstantColorFactor]: gl.CONSTANT_COLOR, - [OneMinusConstantColorFactor]: gl.ONE_MINUS_CONSTANT_COLOR, - [ConstantAlphaFactor]: gl.CONSTANT_ALPHA, - [OneMinusConstantAlphaFactor]: gl.ONE_MINUS_CONSTANT_ALPHA - }; - function setBlending(blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, blendColor, blendAlpha, premultipliedAlpha) { - if (blending === NoBlending) { - if (currentBlendingEnabled === true) { - disable(gl.BLEND); - currentBlendingEnabled = false; - } - return; - } - if (currentBlendingEnabled === false) { - enable(gl.BLEND); - currentBlendingEnabled = true; - } - if (blending !== CustomBlending) { - if (blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha) { - if (currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation) { - gl.blendEquation(gl.FUNC_ADD); - currentBlendEquation = AddEquation; - currentBlendEquationAlpha = AddEquation; - } - if (premultipliedAlpha) { - switch (blending) { - case NormalBlending: - gl.blendFuncSeparate(gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - break; - case AdditiveBlending: - gl.blendFunc(gl.ONE, gl.ONE); - break; - case SubtractiveBlending: - gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE); - break; - case MultiplyBlending: - gl.blendFuncSeparate(gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA); - break; - default: - console.error("THREE.WebGLState: Invalid blending: ", blending); - break; - } - } else { - switch (blending) { - case NormalBlending: - gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - break; - case AdditiveBlending: - gl.blendFunc(gl.SRC_ALPHA, gl.ONE); - break; - case SubtractiveBlending: - gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE); - break; - case MultiplyBlending: - gl.blendFunc(gl.ZERO, gl.SRC_COLOR); - break; - default: - console.error("THREE.WebGLState: Invalid blending: ", blending); - break; - } - } - currentBlendSrc = null; - currentBlendDst = null; - currentBlendSrcAlpha = null; - currentBlendDstAlpha = null; - currentBlendColor.set(0, 0, 0); - currentBlendAlpha = 0; - currentBlending = blending; - currentPremultipledAlpha = premultipliedAlpha; - } - return; - } - blendEquationAlpha = blendEquationAlpha || blendEquation; - blendSrcAlpha = blendSrcAlpha || blendSrc; - blendDstAlpha = blendDstAlpha || blendDst; - if (blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha) { - gl.blendEquationSeparate(equationToGL[blendEquation], equationToGL[blendEquationAlpha]); - currentBlendEquation = blendEquation; - currentBlendEquationAlpha = blendEquationAlpha; - } - if (blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha) { - gl.blendFuncSeparate(factorToGL[blendSrc], factorToGL[blendDst], factorToGL[blendSrcAlpha], factorToGL[blendDstAlpha]); - currentBlendSrc = blendSrc; - currentBlendDst = blendDst; - currentBlendSrcAlpha = blendSrcAlpha; - currentBlendDstAlpha = blendDstAlpha; - } - if (blendColor.equals(currentBlendColor) === false || blendAlpha !== currentBlendAlpha) { - gl.blendColor(blendColor.r, blendColor.g, blendColor.b, blendAlpha); - currentBlendColor.copy(blendColor); - currentBlendAlpha = blendAlpha; - } - currentBlending = blending; - currentPremultipledAlpha = false; - } - __name(setBlending, "setBlending"); - function setMaterial(material, frontFaceCW) { - material.side === DoubleSide ? disable(gl.CULL_FACE) : enable(gl.CULL_FACE); - let flipSided = material.side === BackSide; - if (frontFaceCW) flipSided = !flipSided; - setFlipSided(flipSided); - material.blending === NormalBlending && material.transparent === false ? setBlending(NoBlending) : setBlending(material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.blendColor, material.blendAlpha, material.premultipliedAlpha); - depthBuffer.setFunc(material.depthFunc); - depthBuffer.setTest(material.depthTest); - depthBuffer.setMask(material.depthWrite); - colorBuffer.setMask(material.colorWrite); - const stencilWrite = material.stencilWrite; - stencilBuffer.setTest(stencilWrite); - if (stencilWrite) { - stencilBuffer.setMask(material.stencilWriteMask); - stencilBuffer.setFunc(material.stencilFunc, material.stencilRef, material.stencilFuncMask); - stencilBuffer.setOp(material.stencilFail, material.stencilZFail, material.stencilZPass); - } - setPolygonOffset(material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits); - material.alphaToCoverage === true ? enable(gl.SAMPLE_ALPHA_TO_COVERAGE) : disable(gl.SAMPLE_ALPHA_TO_COVERAGE); - } - __name(setMaterial, "setMaterial"); - function setFlipSided(flipSided) { - if (currentFlipSided !== flipSided) { - if (flipSided) { - gl.frontFace(gl.CW); - } else { - gl.frontFace(gl.CCW); - } - currentFlipSided = flipSided; - } - } - __name(setFlipSided, "setFlipSided"); - function setCullFace(cullFace) { - if (cullFace !== CullFaceNone) { - enable(gl.CULL_FACE); - if (cullFace !== currentCullFace) { - if (cullFace === CullFaceBack) { - gl.cullFace(gl.BACK); - } else if (cullFace === CullFaceFront) { - gl.cullFace(gl.FRONT); - } else { - gl.cullFace(gl.FRONT_AND_BACK); - } - } - } else { - disable(gl.CULL_FACE); - } - currentCullFace = cullFace; - } - __name(setCullFace, "setCullFace"); - function setLineWidth(width) { - if (width !== currentLineWidth) { - if (lineWidthAvailable) gl.lineWidth(width); - currentLineWidth = width; - } - } - __name(setLineWidth, "setLineWidth"); - function setPolygonOffset(polygonOffset, factor, units) { - if (polygonOffset) { - enable(gl.POLYGON_OFFSET_FILL); - if (currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units) { - gl.polygonOffset(factor, units); - currentPolygonOffsetFactor = factor; - currentPolygonOffsetUnits = units; - } - } else { - disable(gl.POLYGON_OFFSET_FILL); - } - } - __name(setPolygonOffset, "setPolygonOffset"); - function setScissorTest(scissorTest) { - if (scissorTest) { - enable(gl.SCISSOR_TEST); - } else { - disable(gl.SCISSOR_TEST); - } - } - __name(setScissorTest, "setScissorTest"); - function activeTexture(webglSlot) { - if (webglSlot === void 0) webglSlot = gl.TEXTURE0 + maxTextures - 1; - if (currentTextureSlot !== webglSlot) { - gl.activeTexture(webglSlot); - currentTextureSlot = webglSlot; - } - } - __name(activeTexture, "activeTexture"); - function bindTexture(webglType, webglTexture, webglSlot) { - if (webglSlot === void 0) { - if (currentTextureSlot === null) { - webglSlot = gl.TEXTURE0 + maxTextures - 1; - } else { - webglSlot = currentTextureSlot; - } - } - let boundTexture = currentBoundTextures[webglSlot]; - if (boundTexture === void 0) { - boundTexture = { type: void 0, texture: void 0 }; - currentBoundTextures[webglSlot] = boundTexture; - } - if (boundTexture.type !== webglType || boundTexture.texture !== webglTexture) { - if (currentTextureSlot !== webglSlot) { - gl.activeTexture(webglSlot); - currentTextureSlot = webglSlot; - } - gl.bindTexture(webglType, webglTexture || emptyTextures[webglType]); - boundTexture.type = webglType; - boundTexture.texture = webglTexture; - } - } - __name(bindTexture, "bindTexture"); - function unbindTexture() { - const boundTexture = currentBoundTextures[currentTextureSlot]; - if (boundTexture !== void 0 && boundTexture.type !== void 0) { - gl.bindTexture(boundTexture.type, null); - boundTexture.type = void 0; - boundTexture.texture = void 0; - } - } - __name(unbindTexture, "unbindTexture"); - function compressedTexImage2D() { - try { - gl.compressedTexImage2D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - __name(compressedTexImage2D, "compressedTexImage2D"); - function compressedTexImage3D() { - try { - gl.compressedTexImage3D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - __name(compressedTexImage3D, "compressedTexImage3D"); - function texSubImage2D() { - try { - gl.texSubImage2D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - __name(texSubImage2D, "texSubImage2D"); - function texSubImage3D() { - try { - gl.texSubImage3D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - __name(texSubImage3D, "texSubImage3D"); - function compressedTexSubImage2D() { - try { - gl.compressedTexSubImage2D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - __name(compressedTexSubImage2D, "compressedTexSubImage2D"); - function compressedTexSubImage3D() { - try { - gl.compressedTexSubImage3D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - __name(compressedTexSubImage3D, "compressedTexSubImage3D"); - function texStorage2D() { - try { - gl.texStorage2D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - __name(texStorage2D, "texStorage2D"); - function texStorage3D() { - try { - gl.texStorage3D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - __name(texStorage3D, "texStorage3D"); - function texImage2D() { - try { - gl.texImage2D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - __name(texImage2D, "texImage2D"); - function texImage3D() { - try { - gl.texImage3D.apply(gl, arguments); - } catch (error) { - console.error("THREE.WebGLState:", error); - } - } - __name(texImage3D, "texImage3D"); - function scissor(scissor2) { - if (currentScissor.equals(scissor2) === false) { - gl.scissor(scissor2.x, scissor2.y, scissor2.z, scissor2.w); - currentScissor.copy(scissor2); - } - } - __name(scissor, "scissor"); - function viewport(viewport2) { - if (currentViewport.equals(viewport2) === false) { - gl.viewport(viewport2.x, viewport2.y, viewport2.z, viewport2.w); - currentViewport.copy(viewport2); - } - } - __name(viewport, "viewport"); - function updateUBOMapping(uniformsGroup, program) { - let mapping = uboProgramMap.get(program); - if (mapping === void 0) { - mapping = /* @__PURE__ */ new WeakMap(); - uboProgramMap.set(program, mapping); - } - let blockIndex = mapping.get(uniformsGroup); - if (blockIndex === void 0) { - blockIndex = gl.getUniformBlockIndex(program, uniformsGroup.name); - mapping.set(uniformsGroup, blockIndex); - } - } - __name(updateUBOMapping, "updateUBOMapping"); - function uniformBlockBinding(uniformsGroup, program) { - const mapping = uboProgramMap.get(program); - const blockIndex = mapping.get(uniformsGroup); - if (uboBindings.get(program) !== blockIndex) { - gl.uniformBlockBinding(program, blockIndex, uniformsGroup.__bindingPointIndex); - uboBindings.set(program, blockIndex); - } - } - __name(uniformBlockBinding, "uniformBlockBinding"); - function reset() { - gl.disable(gl.BLEND); - gl.disable(gl.CULL_FACE); - gl.disable(gl.DEPTH_TEST); - gl.disable(gl.POLYGON_OFFSET_FILL); - gl.disable(gl.SCISSOR_TEST); - gl.disable(gl.STENCIL_TEST); - gl.disable(gl.SAMPLE_ALPHA_TO_COVERAGE); - gl.blendEquation(gl.FUNC_ADD); - gl.blendFunc(gl.ONE, gl.ZERO); - gl.blendFuncSeparate(gl.ONE, gl.ZERO, gl.ONE, gl.ZERO); - gl.blendColor(0, 0, 0, 0); - gl.colorMask(true, true, true, true); - gl.clearColor(0, 0, 0, 0); - gl.depthMask(true); - gl.depthFunc(gl.LESS); - depthBuffer.setReversed(false); - gl.clearDepth(1); - gl.stencilMask(4294967295); - gl.stencilFunc(gl.ALWAYS, 0, 4294967295); - gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); - gl.clearStencil(0); - gl.cullFace(gl.BACK); - gl.frontFace(gl.CCW); - gl.polygonOffset(0, 0); - gl.activeTexture(gl.TEXTURE0); - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null); - gl.bindFramebuffer(gl.READ_FRAMEBUFFER, null); - gl.useProgram(null); - gl.lineWidth(1); - gl.scissor(0, 0, gl.canvas.width, gl.canvas.height); - gl.viewport(0, 0, gl.canvas.width, gl.canvas.height); - enabledCapabilities = {}; - currentTextureSlot = null; - currentBoundTextures = {}; - currentBoundFramebuffers = {}; - currentDrawbuffers = /* @__PURE__ */ new WeakMap(); - defaultDrawbuffers = []; - currentProgram = null; - currentBlendingEnabled = false; - currentBlending = null; - currentBlendEquation = null; - currentBlendSrc = null; - currentBlendDst = null; - currentBlendEquationAlpha = null; - currentBlendSrcAlpha = null; - currentBlendDstAlpha = null; - currentBlendColor = new Color(0, 0, 0); - currentBlendAlpha = 0; - currentPremultipledAlpha = false; - currentFlipSided = null; - currentCullFace = null; - currentLineWidth = null; - currentPolygonOffsetFactor = null; - currentPolygonOffsetUnits = null; - currentScissor.set(0, 0, gl.canvas.width, gl.canvas.height); - currentViewport.set(0, 0, gl.canvas.width, gl.canvas.height); - colorBuffer.reset(); - depthBuffer.reset(); - stencilBuffer.reset(); - } - __name(reset, "reset"); - return { - buffers: { - color: colorBuffer, - depth: depthBuffer, - stencil: stencilBuffer - }, - enable, - disable, - bindFramebuffer, - drawBuffers, - useProgram, - setBlending, - setMaterial, - setFlipSided, - setCullFace, - setLineWidth, - setPolygonOffset, - setScissorTest, - activeTexture, - bindTexture, - unbindTexture, - compressedTexImage2D, - compressedTexImage3D, - texImage2D, - texImage3D, - updateUBOMapping, - uniformBlockBinding, - texStorage2D, - texStorage3D, - texSubImage2D, - texSubImage3D, - compressedTexSubImage2D, - compressedTexSubImage3D, - scissor, - viewport, - reset - }; -} -__name(WebGLState, "WebGLState"); -function contain(texture, aspect2) { - const imageAspect = texture.image && texture.image.width ? texture.image.width / texture.image.height : 1; - if (imageAspect > aspect2) { - texture.repeat.x = 1; - texture.repeat.y = imageAspect / aspect2; - texture.offset.x = 0; - texture.offset.y = (1 - texture.repeat.y) / 2; - } else { - texture.repeat.x = aspect2 / imageAspect; - texture.repeat.y = 1; - texture.offset.x = (1 - texture.repeat.x) / 2; - texture.offset.y = 0; - } - return texture; -} -__name(contain, "contain"); -function cover(texture, aspect2) { - const imageAspect = texture.image && texture.image.width ? texture.image.width / texture.image.height : 1; - if (imageAspect > aspect2) { - texture.repeat.x = aspect2 / imageAspect; - texture.repeat.y = 1; - texture.offset.x = (1 - texture.repeat.x) / 2; - texture.offset.y = 0; - } else { - texture.repeat.x = 1; - texture.repeat.y = imageAspect / aspect2; - texture.offset.x = 0; - texture.offset.y = (1 - texture.repeat.y) / 2; - } - return texture; -} -__name(cover, "cover"); -function fill(texture) { - texture.repeat.x = 1; - texture.repeat.y = 1; - texture.offset.x = 0; - texture.offset.y = 0; - return texture; -} -__name(fill, "fill"); -function getByteLength(width, height, format, type) { - const typeByteLength = getTextureTypeByteLength(type); - switch (format) { - case AlphaFormat: - return width * height; - case LuminanceFormat: - return width * height; - case LuminanceAlphaFormat: - return width * height * 2; - case RedFormat: - return width * height / typeByteLength.components * typeByteLength.byteLength; - case RedIntegerFormat: - return width * height / typeByteLength.components * typeByteLength.byteLength; - case RGFormat: - return width * height * 2 / typeByteLength.components * typeByteLength.byteLength; - case RGIntegerFormat: - return width * height * 2 / typeByteLength.components * typeByteLength.byteLength; - case RGBFormat: - return width * height * 3 / typeByteLength.components * typeByteLength.byteLength; - case RGBAFormat: - return width * height * 4 / typeByteLength.components * typeByteLength.byteLength; - case RGBAIntegerFormat: - return width * height * 4 / typeByteLength.components * typeByteLength.byteLength; - case RGB_S3TC_DXT1_Format: - case RGBA_S3TC_DXT1_Format: - return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 8; - case RGBA_S3TC_DXT3_Format: - case RGBA_S3TC_DXT5_Format: - return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 16; - case RGB_PVRTC_2BPPV1_Format: - case RGBA_PVRTC_2BPPV1_Format: - return Math.max(width, 16) * Math.max(height, 8) / 4; - case RGB_PVRTC_4BPPV1_Format: - case RGBA_PVRTC_4BPPV1_Format: - return Math.max(width, 8) * Math.max(height, 8) / 2; - case RGB_ETC1_Format: - case RGB_ETC2_Format: - return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 8; - case RGBA_ETC2_EAC_Format: - return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 16; - case RGBA_ASTC_4x4_Format: - return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 16; - case RGBA_ASTC_5x4_Format: - return Math.floor((width + 4) / 5) * Math.floor((height + 3) / 4) * 16; - case RGBA_ASTC_5x5_Format: - return Math.floor((width + 4) / 5) * Math.floor((height + 4) / 5) * 16; - case RGBA_ASTC_6x5_Format: - return Math.floor((width + 5) / 6) * Math.floor((height + 4) / 5) * 16; - case RGBA_ASTC_6x6_Format: - return Math.floor((width + 5) / 6) * Math.floor((height + 5) / 6) * 16; - case RGBA_ASTC_8x5_Format: - return Math.floor((width + 7) / 8) * Math.floor((height + 4) / 5) * 16; - case RGBA_ASTC_8x6_Format: - return Math.floor((width + 7) / 8) * Math.floor((height + 5) / 6) * 16; - case RGBA_ASTC_8x8_Format: - return Math.floor((width + 7) / 8) * Math.floor((height + 7) / 8) * 16; - case RGBA_ASTC_10x5_Format: - return Math.floor((width + 9) / 10) * Math.floor((height + 4) / 5) * 16; - case RGBA_ASTC_10x6_Format: - return Math.floor((width + 9) / 10) * Math.floor((height + 5) / 6) * 16; - case RGBA_ASTC_10x8_Format: - return Math.floor((width + 9) / 10) * Math.floor((height + 7) / 8) * 16; - case RGBA_ASTC_10x10_Format: - return Math.floor((width + 9) / 10) * Math.floor((height + 9) / 10) * 16; - case RGBA_ASTC_12x10_Format: - return Math.floor((width + 11) / 12) * Math.floor((height + 9) / 10) * 16; - case RGBA_ASTC_12x12_Format: - return Math.floor((width + 11) / 12) * Math.floor((height + 11) / 12) * 16; - case RGBA_BPTC_Format: - case RGB_BPTC_SIGNED_Format: - case RGB_BPTC_UNSIGNED_Format: - return Math.ceil(width / 4) * Math.ceil(height / 4) * 16; - case RED_RGTC1_Format: - case SIGNED_RED_RGTC1_Format: - return Math.ceil(width / 4) * Math.ceil(height / 4) * 8; - case RED_GREEN_RGTC2_Format: - case SIGNED_RED_GREEN_RGTC2_Format: - return Math.ceil(width / 4) * Math.ceil(height / 4) * 16; - } - throw new Error( - `Unable to determine texture byte length for ${format} format.` - ); -} -__name(getByteLength, "getByteLength"); -function getTextureTypeByteLength(type) { - switch (type) { - case UnsignedByteType: - case ByteType: - return { byteLength: 1, components: 1 }; - case UnsignedShortType: - case ShortType: - case HalfFloatType: - return { byteLength: 2, components: 1 }; - case UnsignedShort4444Type: - case UnsignedShort5551Type: - return { byteLength: 2, components: 4 }; - case UnsignedIntType: - case IntType: - case FloatType: - return { byteLength: 4, components: 1 }; - case UnsignedInt5999Type: - return { byteLength: 4, components: 3 }; - } - throw new Error(`Unknown texture type ${type}.`); -} -__name(getTextureTypeByteLength, "getTextureTypeByteLength"); -const TextureUtils = { - contain, - cover, - fill, - getByteLength -}; -function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info) { - const multisampledRTTExt = extensions.has("WEBGL_multisampled_render_to_texture") ? extensions.get("WEBGL_multisampled_render_to_texture") : null; - const supportsInvalidateFramebuffer = typeof navigator === "undefined" ? false : /OculusBrowser/g.test(navigator.userAgent); - const _imageDimensions = new Vector2(); - const _videoTextures = /* @__PURE__ */ new WeakMap(); - let _canvas2; - const _sources = /* @__PURE__ */ new WeakMap(); - let useOffscreenCanvas = false; - try { - useOffscreenCanvas = typeof OffscreenCanvas !== "undefined" && new OffscreenCanvas(1, 1).getContext("2d") !== null; - } catch (err2) { - } - function createCanvas(width, height) { - return useOffscreenCanvas ? ( - // eslint-disable-next-line compat/compat - new OffscreenCanvas(width, height) - ) : createElementNS("canvas"); - } - __name(createCanvas, "createCanvas"); - function resizeImage(image, needsNewCanvas, maxSize) { - let scale = 1; - const dimensions = getDimensions(image); - if (dimensions.width > maxSize || dimensions.height > maxSize) { - scale = maxSize / Math.max(dimensions.width, dimensions.height); - } - if (scale < 1) { - if (typeof HTMLImageElement !== "undefined" && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== "undefined" && image instanceof HTMLCanvasElement || typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap || typeof VideoFrame !== "undefined" && image instanceof VideoFrame) { - const width = Math.floor(scale * dimensions.width); - const height = Math.floor(scale * dimensions.height); - if (_canvas2 === void 0) _canvas2 = createCanvas(width, height); - const canvas = needsNewCanvas ? createCanvas(width, height) : _canvas2; - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.drawImage(image, 0, 0, width, height); - console.warn("THREE.WebGLRenderer: Texture has been resized from (" + dimensions.width + "x" + dimensions.height + ") to (" + width + "x" + height + ")."); - return canvas; - } else { - if ("data" in image) { - console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + dimensions.width + "x" + dimensions.height + ")."); - } - return image; - } - } - return image; - } - __name(resizeImage, "resizeImage"); - function textureNeedsGenerateMipmaps(texture) { - return texture.generateMipmaps; - } - __name(textureNeedsGenerateMipmaps, "textureNeedsGenerateMipmaps"); - function generateMipmap(target) { - _gl.generateMipmap(target); - } - __name(generateMipmap, "generateMipmap"); - function getTargetType(texture) { - if (texture.isWebGLCubeRenderTarget) return _gl.TEXTURE_CUBE_MAP; - if (texture.isWebGL3DRenderTarget) return _gl.TEXTURE_3D; - if (texture.isWebGLArrayRenderTarget || texture.isCompressedArrayTexture) return _gl.TEXTURE_2D_ARRAY; - return _gl.TEXTURE_2D; - } - __name(getTargetType, "getTargetType"); - function getInternalFormat(internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false) { - if (internalFormatName !== null) { - if (_gl[internalFormatName] !== void 0) return _gl[internalFormatName]; - console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + internalFormatName + "'"); - } - let internalFormat = glFormat; - if (glFormat === _gl.RED) { - if (glType === _gl.FLOAT) internalFormat = _gl.R32F; - if (glType === _gl.HALF_FLOAT) internalFormat = _gl.R16F; - if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8; - } - if (glFormat === _gl.RED_INTEGER) { - if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8UI; - if (glType === _gl.UNSIGNED_SHORT) internalFormat = _gl.R16UI; - if (glType === _gl.UNSIGNED_INT) internalFormat = _gl.R32UI; - if (glType === _gl.BYTE) internalFormat = _gl.R8I; - if (glType === _gl.SHORT) internalFormat = _gl.R16I; - if (glType === _gl.INT) internalFormat = _gl.R32I; - } - if (glFormat === _gl.RG) { - if (glType === _gl.FLOAT) internalFormat = _gl.RG32F; - if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RG16F; - if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8; - } - if (glFormat === _gl.RG_INTEGER) { - if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8UI; - if (glType === _gl.UNSIGNED_SHORT) internalFormat = _gl.RG16UI; - if (glType === _gl.UNSIGNED_INT) internalFormat = _gl.RG32UI; - if (glType === _gl.BYTE) internalFormat = _gl.RG8I; - if (glType === _gl.SHORT) internalFormat = _gl.RG16I; - if (glType === _gl.INT) internalFormat = _gl.RG32I; - } - if (glFormat === _gl.RGB_INTEGER) { - if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RGB8UI; - if (glType === _gl.UNSIGNED_SHORT) internalFormat = _gl.RGB16UI; - if (glType === _gl.UNSIGNED_INT) internalFormat = _gl.RGB32UI; - if (glType === _gl.BYTE) internalFormat = _gl.RGB8I; - if (glType === _gl.SHORT) internalFormat = _gl.RGB16I; - if (glType === _gl.INT) internalFormat = _gl.RGB32I; - } - if (glFormat === _gl.RGBA_INTEGER) { - if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RGBA8UI; - if (glType === _gl.UNSIGNED_SHORT) internalFormat = _gl.RGBA16UI; - if (glType === _gl.UNSIGNED_INT) internalFormat = _gl.RGBA32UI; - if (glType === _gl.BYTE) internalFormat = _gl.RGBA8I; - if (glType === _gl.SHORT) internalFormat = _gl.RGBA16I; - if (glType === _gl.INT) internalFormat = _gl.RGBA32I; - } - if (glFormat === _gl.RGB) { - if (glType === _gl.UNSIGNED_INT_5_9_9_9_REV) internalFormat = _gl.RGB9_E5; - } - if (glFormat === _gl.RGBA) { - const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer(colorSpace); - if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F; - if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F; - if (glType === _gl.UNSIGNED_BYTE) internalFormat = transfer === SRGBTransfer ? _gl.SRGB8_ALPHA8 : _gl.RGBA8; - if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4; - if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1; - } - if (internalFormat === _gl.R16F || internalFormat === _gl.R32F || internalFormat === _gl.RG16F || internalFormat === _gl.RG32F || internalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F) { - extensions.get("EXT_color_buffer_float"); - } - return internalFormat; - } - __name(getInternalFormat, "getInternalFormat"); - function getInternalDepthFormat(useStencil, depthType) { - let glInternalFormat; - if (useStencil) { - if (depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type) { - glInternalFormat = _gl.DEPTH24_STENCIL8; - } else if (depthType === FloatType) { - glInternalFormat = _gl.DEPTH32F_STENCIL8; - } else if (depthType === UnsignedShortType) { - glInternalFormat = _gl.DEPTH24_STENCIL8; - console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment."); - } - } else { - if (depthType === null || depthType === UnsignedIntType || depthType === UnsignedInt248Type) { - glInternalFormat = _gl.DEPTH_COMPONENT24; - } else if (depthType === FloatType) { - glInternalFormat = _gl.DEPTH_COMPONENT32F; - } else if (depthType === UnsignedShortType) { - glInternalFormat = _gl.DEPTH_COMPONENT16; - } - } - return glInternalFormat; - } - __name(getInternalDepthFormat, "getInternalDepthFormat"); - function getMipLevels(texture, image) { - if (textureNeedsGenerateMipmaps(texture) === true || texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter) { - return Math.log2(Math.max(image.width, image.height)) + 1; - } else if (texture.mipmaps !== void 0 && texture.mipmaps.length > 0) { - return texture.mipmaps.length; - } else if (texture.isCompressedTexture && Array.isArray(texture.image)) { - return image.mipmaps.length; - } else { - return 1; - } - } - __name(getMipLevels, "getMipLevels"); - function onTextureDispose(event) { - const texture = event.target; - texture.removeEventListener("dispose", onTextureDispose); - deallocateTexture(texture); - if (texture.isVideoTexture) { - _videoTextures.delete(texture); - } - } - __name(onTextureDispose, "onTextureDispose"); - function onRenderTargetDispose(event) { - const renderTarget = event.target; - renderTarget.removeEventListener("dispose", onRenderTargetDispose); - deallocateRenderTarget(renderTarget); - } - __name(onRenderTargetDispose, "onRenderTargetDispose"); - function deallocateTexture(texture) { - const textureProperties = properties.get(texture); - if (textureProperties.__webglInit === void 0) return; - const source = texture.source; - const webglTextures = _sources.get(source); - if (webglTextures) { - const webglTexture = webglTextures[textureProperties.__cacheKey]; - webglTexture.usedTimes--; - if (webglTexture.usedTimes === 0) { - deleteTexture(texture); - } - if (Object.keys(webglTextures).length === 0) { - _sources.delete(source); - } - } - properties.remove(texture); - } - __name(deallocateTexture, "deallocateTexture"); - function deleteTexture(texture) { - const textureProperties = properties.get(texture); - _gl.deleteTexture(textureProperties.__webglTexture); - const source = texture.source; - const webglTextures = _sources.get(source); - delete webglTextures[textureProperties.__cacheKey]; - info.memory.textures--; - } - __name(deleteTexture, "deleteTexture"); - function deallocateRenderTarget(renderTarget) { - const renderTargetProperties = properties.get(renderTarget); - if (renderTarget.depthTexture) { - renderTarget.depthTexture.dispose(); - properties.remove(renderTarget.depthTexture); - } - if (renderTarget.isWebGLCubeRenderTarget) { - for (let i = 0; i < 6; i++) { - if (Array.isArray(renderTargetProperties.__webglFramebuffer[i])) { - for (let level = 0; level < renderTargetProperties.__webglFramebuffer[i].length; level++) _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i][level]); - } else { - _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i]); - } - if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer[i]); - } - } else { - if (Array.isArray(renderTargetProperties.__webglFramebuffer)) { - for (let level = 0; level < renderTargetProperties.__webglFramebuffer.length; level++) _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[level]); - } else { - _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer); - } - if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer); - if (renderTargetProperties.__webglMultisampledFramebuffer) _gl.deleteFramebuffer(renderTargetProperties.__webglMultisampledFramebuffer); - if (renderTargetProperties.__webglColorRenderbuffer) { - for (let i = 0; i < renderTargetProperties.__webglColorRenderbuffer.length; i++) { - if (renderTargetProperties.__webglColorRenderbuffer[i]) _gl.deleteRenderbuffer(renderTargetProperties.__webglColorRenderbuffer[i]); - } - } - if (renderTargetProperties.__webglDepthRenderbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthRenderbuffer); - } - const textures = renderTarget.textures; - for (let i = 0, il = textures.length; i < il; i++) { - const attachmentProperties = properties.get(textures[i]); - if (attachmentProperties.__webglTexture) { - _gl.deleteTexture(attachmentProperties.__webglTexture); - info.memory.textures--; - } - properties.remove(textures[i]); - } - properties.remove(renderTarget); - } - __name(deallocateRenderTarget, "deallocateRenderTarget"); - let textureUnits = 0; - function resetTextureUnits() { - textureUnits = 0; - } - __name(resetTextureUnits, "resetTextureUnits"); - function allocateTextureUnit() { - const textureUnit = textureUnits; - if (textureUnit >= capabilities.maxTextures) { - console.warn("THREE.WebGLTextures: Trying to use " + textureUnit + " texture units while this GPU supports only " + capabilities.maxTextures); - } - textureUnits += 1; - return textureUnit; - } - __name(allocateTextureUnit, "allocateTextureUnit"); - function getTextureCacheKey(texture) { - const array = []; - array.push(texture.wrapS); - array.push(texture.wrapT); - array.push(texture.wrapR || 0); - array.push(texture.magFilter); - array.push(texture.minFilter); - array.push(texture.anisotropy); - array.push(texture.internalFormat); - array.push(texture.format); - array.push(texture.type); - array.push(texture.generateMipmaps); - array.push(texture.premultiplyAlpha); - array.push(texture.flipY); - array.push(texture.unpackAlignment); - array.push(texture.colorSpace); - return array.join(); - } - __name(getTextureCacheKey, "getTextureCacheKey"); - function setTexture2D(texture, slot) { - const textureProperties = properties.get(texture); - if (texture.isVideoTexture) updateVideoTexture(texture); - if (texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version) { - const image = texture.image; - if (image === null) { - console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found."); - } else if (image.complete === false) { - console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete"); - } else { - uploadTexture(textureProperties, texture, slot); - return; - } - } - state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot); - } - __name(setTexture2D, "setTexture2D"); - function setTexture2DArray(texture, slot) { - const textureProperties = properties.get(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { - uploadTexture(textureProperties, texture, slot); - return; - } - state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot); - } - __name(setTexture2DArray, "setTexture2DArray"); - function setTexture3D(texture, slot) { - const textureProperties = properties.get(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { - uploadTexture(textureProperties, texture, slot); - return; - } - state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot); - } - __name(setTexture3D, "setTexture3D"); - function setTextureCube(texture, slot) { - const textureProperties = properties.get(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { - uploadCubeTexture(textureProperties, texture, slot); - return; - } - state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot); - } - __name(setTextureCube, "setTextureCube"); - const wrappingToGL = { - [RepeatWrapping]: _gl.REPEAT, - [ClampToEdgeWrapping]: _gl.CLAMP_TO_EDGE, - [MirroredRepeatWrapping]: _gl.MIRRORED_REPEAT - }; - const filterToGL = { - [NearestFilter]: _gl.NEAREST, - [NearestMipmapNearestFilter]: _gl.NEAREST_MIPMAP_NEAREST, - [NearestMipmapLinearFilter]: _gl.NEAREST_MIPMAP_LINEAR, - [LinearFilter]: _gl.LINEAR, - [LinearMipmapNearestFilter]: _gl.LINEAR_MIPMAP_NEAREST, - [LinearMipmapLinearFilter]: _gl.LINEAR_MIPMAP_LINEAR - }; - const compareToGL = { - [NeverCompare]: _gl.NEVER, - [AlwaysCompare]: _gl.ALWAYS, - [LessCompare]: _gl.LESS, - [LessEqualCompare]: _gl.LEQUAL, - [EqualCompare]: _gl.EQUAL, - [GreaterEqualCompare]: _gl.GEQUAL, - [GreaterCompare]: _gl.GREATER, - [NotEqualCompare]: _gl.NOTEQUAL - }; - function setTextureParameters(textureType, texture) { - if (texture.type === FloatType && extensions.has("OES_texture_float_linear") === false && (texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter || texture.minFilter === LinearFilter || texture.minFilter === LinearMipmapNearestFilter || texture.minFilter === NearestMipmapLinearFilter || texture.minFilter === LinearMipmapLinearFilter)) { - console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."); - } - _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[texture.wrapS]); - _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[texture.wrapT]); - if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) { - _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[texture.wrapR]); - } - _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[texture.magFilter]); - _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[texture.minFilter]); - if (texture.compareFunction) { - _gl.texParameteri(textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE); - _gl.texParameteri(textureType, _gl.TEXTURE_COMPARE_FUNC, compareToGL[texture.compareFunction]); - } - if (extensions.has("EXT_texture_filter_anisotropic") === true) { - if (texture.magFilter === NearestFilter) return; - if (texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter) return; - if (texture.type === FloatType && extensions.has("OES_texture_float_linear") === false) return; - if (texture.anisotropy > 1 || properties.get(texture).__currentAnisotropy) { - const extension = extensions.get("EXT_texture_filter_anisotropic"); - _gl.texParameterf(textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(texture.anisotropy, capabilities.getMaxAnisotropy())); - properties.get(texture).__currentAnisotropy = texture.anisotropy; - } - } - } - __name(setTextureParameters, "setTextureParameters"); - function initTexture(textureProperties, texture) { - let forceUpload = false; - if (textureProperties.__webglInit === void 0) { - textureProperties.__webglInit = true; - texture.addEventListener("dispose", onTextureDispose); - } - const source = texture.source; - let webglTextures = _sources.get(source); - if (webglTextures === void 0) { - webglTextures = {}; - _sources.set(source, webglTextures); - } - const textureCacheKey = getTextureCacheKey(texture); - if (textureCacheKey !== textureProperties.__cacheKey) { - if (webglTextures[textureCacheKey] === void 0) { - webglTextures[textureCacheKey] = { - texture: _gl.createTexture(), - usedTimes: 0 - }; - info.memory.textures++; - forceUpload = true; - } - webglTextures[textureCacheKey].usedTimes++; - const webglTexture = webglTextures[textureProperties.__cacheKey]; - if (webglTexture !== void 0) { - webglTextures[textureProperties.__cacheKey].usedTimes--; - if (webglTexture.usedTimes === 0) { - deleteTexture(texture); - } - } - textureProperties.__cacheKey = textureCacheKey; - textureProperties.__webglTexture = webglTextures[textureCacheKey].texture; - } - return forceUpload; - } - __name(initTexture, "initTexture"); - function uploadTexture(textureProperties, texture, slot) { - let textureType = _gl.TEXTURE_2D; - if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) textureType = _gl.TEXTURE_2D_ARRAY; - if (texture.isData3DTexture) textureType = _gl.TEXTURE_3D; - const forceUpload = initTexture(textureProperties, texture); - const source = texture.source; - state.bindTexture(textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot); - const sourceProperties = properties.get(source); - if (source.version !== sourceProperties.__version || forceUpload === true) { - state.activeTexture(_gl.TEXTURE0 + slot); - const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace); - const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace); - const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL; - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment); - _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion); - let image = resizeImage(texture.image, false, capabilities.maxTextureSize); - image = verifyColorSpace(texture, image); - const glFormat = utils.convert(texture.format, texture.colorSpace); - const glType = utils.convert(texture.type); - let glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture); - setTextureParameters(textureType, texture); - let mipmap; - const mipmaps = texture.mipmaps; - const useTexStorage = texture.isVideoTexture !== true; - const allocateMemory = sourceProperties.__version === void 0 || forceUpload === true; - const dataReady = source.dataReady; - const levels = getMipLevels(texture, image); - if (texture.isDepthTexture) { - glInternalFormat = getInternalDepthFormat(texture.format === DepthStencilFormat, texture.type); - if (allocateMemory) { - if (useTexStorage) { - state.texStorage2D(_gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height); - } else { - state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null); - } - } - } else if (texture.isDataTexture) { - if (mipmaps.length > 0) { - if (useTexStorage && allocateMemory) { - state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height); - } - for (let i = 0, il = mipmaps.length; i < il; i++) { - mipmap = mipmaps[i]; - if (useTexStorage) { - if (dataReady) { - state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data); - } - } else { - state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); - } - } - texture.generateMipmaps = false; - } else { - if (useTexStorage) { - if (allocateMemory) { - state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height); - } - if (dataReady) { - state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data); - } - } else { - state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data); - } - } - } else if (texture.isCompressedTexture) { - if (texture.isCompressedArrayTexture) { - if (useTexStorage && allocateMemory) { - state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height, image.depth); - } - for (let i = 0, il = mipmaps.length; i < il; i++) { - mipmap = mipmaps[i]; - if (texture.format !== RGBAFormat) { - if (glFormat !== null) { - if (useTexStorage) { - if (dataReady) { - if (texture.layerUpdates.size > 0) { - const layerByteLength = getByteLength(mipmap.width, mipmap.height, texture.format, texture.type); - for (const layerIndex of texture.layerUpdates) { - const layerData = mipmap.data.subarray( - layerIndex * layerByteLength / mipmap.data.BYTES_PER_ELEMENT, - (layerIndex + 1) * layerByteLength / mipmap.data.BYTES_PER_ELEMENT - ); - state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, layerData); - } - texture.clearLayerUpdates(); - } else { - state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data); - } - } - } else { - state.compressedTexImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0); - } - } else { - console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"); - } - } else { - if (useTexStorage) { - if (dataReady) { - state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data); - } - } else { - state.texImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data); - } - } - } - } else { - if (useTexStorage && allocateMemory) { - state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height); - } - for (let i = 0, il = mipmaps.length; i < il; i++) { - mipmap = mipmaps[i]; - if (texture.format !== RGBAFormat) { - if (glFormat !== null) { - if (useTexStorage) { - if (dataReady) { - state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data); - } - } else { - state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data); - } - } else { - console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"); - } - } else { - if (useTexStorage) { - if (dataReady) { - state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data); - } - } else { - state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); - } - } - } - } - } else if (texture.isDataArrayTexture) { - if (useTexStorage) { - if (allocateMemory) { - state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth); - } - if (dataReady) { - if (texture.layerUpdates.size > 0) { - const layerByteLength = getByteLength(image.width, image.height, texture.format, texture.type); - for (const layerIndex of texture.layerUpdates) { - const layerData = image.data.subarray( - layerIndex * layerByteLength / image.data.BYTES_PER_ELEMENT, - (layerIndex + 1) * layerByteLength / image.data.BYTES_PER_ELEMENT - ); - state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, 0, 0, 0, layerIndex, image.width, image.height, 1, glFormat, glType, layerData); - } - texture.clearLayerUpdates(); - } else { - state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data); - } - } - } else { - state.texImage3D(_gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data); - } - } else if (texture.isData3DTexture) { - if (useTexStorage) { - if (allocateMemory) { - state.texStorage3D(_gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth); - } - if (dataReady) { - state.texSubImage3D(_gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data); - } - } else { - state.texImage3D(_gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data); - } - } else if (texture.isFramebufferTexture) { - if (allocateMemory) { - if (useTexStorage) { - state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height); - } else { - let width = image.width, height = image.height; - for (let i = 0; i < levels; i++) { - state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null); - width >>= 1; - height >>= 1; - } - } - } - } else { - if (mipmaps.length > 0) { - if (useTexStorage && allocateMemory) { - const dimensions = getDimensions(mipmaps[0]); - state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height); - } - for (let i = 0, il = mipmaps.length; i < il; i++) { - mipmap = mipmaps[i]; - if (useTexStorage) { - if (dataReady) { - state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap); - } - } else { - state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap); - } - } - texture.generateMipmaps = false; - } else { - if (useTexStorage) { - if (allocateMemory) { - const dimensions = getDimensions(image); - state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height); - } - if (dataReady) { - state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image); - } - } else { - state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image); - } - } - } - if (textureNeedsGenerateMipmaps(texture)) { - generateMipmap(textureType); - } - sourceProperties.__version = source.version; - if (texture.onUpdate) texture.onUpdate(texture); - } - textureProperties.__version = texture.version; - } - __name(uploadTexture, "uploadTexture"); - function uploadCubeTexture(textureProperties, texture, slot) { - if (texture.image.length !== 6) return; - const forceUpload = initTexture(textureProperties, texture); - const source = texture.source; - state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot); - const sourceProperties = properties.get(source); - if (source.version !== sourceProperties.__version || forceUpload === true) { - state.activeTexture(_gl.TEXTURE0 + slot); - const workingPrimaries = ColorManagement.getPrimaries(ColorManagement.workingColorSpace); - const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries(texture.colorSpace); - const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL; - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment); - _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion); - const isCompressed = texture.isCompressedTexture || texture.image[0].isCompressedTexture; - const isDataTexture = texture.image[0] && texture.image[0].isDataTexture; - const cubeImage = []; - for (let i = 0; i < 6; i++) { - if (!isCompressed && !isDataTexture) { - cubeImage[i] = resizeImage(texture.image[i], true, capabilities.maxCubemapSize); - } else { - cubeImage[i] = isDataTexture ? texture.image[i].image : texture.image[i]; - } - cubeImage[i] = verifyColorSpace(texture, cubeImage[i]); - } - const image = cubeImage[0], glFormat = utils.convert(texture.format, texture.colorSpace), glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace); - const useTexStorage = texture.isVideoTexture !== true; - const allocateMemory = sourceProperties.__version === void 0 || forceUpload === true; - const dataReady = source.dataReady; - let levels = getMipLevels(texture, image); - setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture); - let mipmaps; - if (isCompressed) { - if (useTexStorage && allocateMemory) { - state.texStorage2D(_gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height); - } - for (let i = 0; i < 6; i++) { - mipmaps = cubeImage[i].mipmaps; - for (let j = 0; j < mipmaps.length; j++) { - const mipmap = mipmaps[j]; - if (texture.format !== RGBAFormat) { - if (glFormat !== null) { - if (useTexStorage) { - if (dataReady) { - state.compressedTexSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data); - } - } else { - state.compressedTexImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data); - } - } else { - console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"); - } - } else { - if (useTexStorage) { - if (dataReady) { - state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data); - } - } else { - state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); - } - } - } - } - } else { - mipmaps = texture.mipmaps; - if (useTexStorage && allocateMemory) { - if (mipmaps.length > 0) levels++; - const dimensions = getDimensions(cubeImage[0]); - state.texStorage2D(_gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, dimensions.width, dimensions.height); - } - for (let i = 0; i < 6; i++) { - if (isDataTexture) { - if (useTexStorage) { - if (dataReady) { - state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[i].width, cubeImage[i].height, glFormat, glType, cubeImage[i].data); - } - } else { - state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[i].width, cubeImage[i].height, 0, glFormat, glType, cubeImage[i].data); - } - for (let j = 0; j < mipmaps.length; j++) { - const mipmap = mipmaps[j]; - const mipmapImage = mipmap.image[i].image; - if (useTexStorage) { - if (dataReady) { - state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data); - } - } else { - state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data); - } - } - } else { - if (useTexStorage) { - if (dataReady) { - state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[i]); - } - } else { - state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[i]); - } - for (let j = 0; j < mipmaps.length; j++) { - const mipmap = mipmaps[j]; - if (useTexStorage) { - if (dataReady) { - state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[i]); - } - } else { - state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[i]); - } - } - } - } - } - if (textureNeedsGenerateMipmaps(texture)) { - generateMipmap(_gl.TEXTURE_CUBE_MAP); - } - sourceProperties.__version = source.version; - if (texture.onUpdate) texture.onUpdate(texture); - } - textureProperties.__version = texture.version; - } - __name(uploadCubeTexture, "uploadCubeTexture"); - function setupFrameBufferTexture(framebuffer, renderTarget, texture, attachment, textureTarget, level) { - const glFormat = utils.convert(texture.format, texture.colorSpace); - const glType = utils.convert(texture.type); - const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace); - const renderTargetProperties = properties.get(renderTarget); - const textureProperties = properties.get(texture); - textureProperties.__renderTarget = renderTarget; - if (!renderTargetProperties.__hasExternalTextures) { - const width = Math.max(1, renderTarget.width >> level); - const height = Math.max(1, renderTarget.height >> level); - if (textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY) { - state.texImage3D(textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null); - } else { - state.texImage2D(textureTarget, level, glInternalFormat, width, height, 0, glFormat, glType, null); - } - } - state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - if (useMultisampledRTT(renderTarget)) { - multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, 0, getRenderTargetSamples(renderTarget)); - } else if (textureTarget === _gl.TEXTURE_2D || textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z) { - _gl.framebufferTexture2D(_gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, level); - } - state.bindFramebuffer(_gl.FRAMEBUFFER, null); - } - __name(setupFrameBufferTexture, "setupFrameBufferTexture"); - function setupRenderBufferStorage(renderbuffer, renderTarget, isMultisample) { - _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderbuffer); - if (renderTarget.depthBuffer) { - const depthTexture = renderTarget.depthTexture; - const depthType = depthTexture && depthTexture.isDepthTexture ? depthTexture.type : null; - const glInternalFormat = getInternalDepthFormat(renderTarget.stencilBuffer, depthType); - const glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT; - const samples = getRenderTargetSamples(renderTarget); - const isUseMultisampledRTT = useMultisampledRTT(renderTarget); - if (isUseMultisampledRTT) { - multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); - } else if (isMultisample) { - _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); - } else { - _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height); - } - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer); - } else { - const textures = renderTarget.textures; - for (let i = 0; i < textures.length; i++) { - const texture = textures[i]; - const glFormat = utils.convert(texture.format, texture.colorSpace); - const glType = utils.convert(texture.type); - const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.colorSpace); - const samples = getRenderTargetSamples(renderTarget); - if (isMultisample && useMultisampledRTT(renderTarget) === false) { - _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); - } else if (useMultisampledRTT(renderTarget)) { - multisampledRTTExt.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); - } else { - _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height); - } - } - } - _gl.bindRenderbuffer(_gl.RENDERBUFFER, null); - } - __name(setupRenderBufferStorage, "setupRenderBufferStorage"); - function setupDepthTexture(framebuffer, renderTarget) { - const isCube = renderTarget && renderTarget.isWebGLCubeRenderTarget; - if (isCube) throw new Error("Depth Texture with cube render targets is not supported"); - state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - if (!(renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture)) { - throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture"); - } - const textureProperties = properties.get(renderTarget.depthTexture); - textureProperties.__renderTarget = renderTarget; - if (!textureProperties.__webglTexture || renderTarget.depthTexture.image.width !== renderTarget.width || renderTarget.depthTexture.image.height !== renderTarget.height) { - renderTarget.depthTexture.image.width = renderTarget.width; - renderTarget.depthTexture.image.height = renderTarget.height; - renderTarget.depthTexture.needsUpdate = true; - } - setTexture2D(renderTarget.depthTexture, 0); - const webglDepthTexture = textureProperties.__webglTexture; - const samples = getRenderTargetSamples(renderTarget); - if (renderTarget.depthTexture.format === DepthFormat) { - if (useMultisampledRTT(renderTarget)) { - multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples); - } else { - _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0); - } - } else if (renderTarget.depthTexture.format === DepthStencilFormat) { - if (useMultisampledRTT(renderTarget)) { - multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples); - } else { - _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0); - } - } else { - throw new Error("Unknown depthTexture format"); - } - } - __name(setupDepthTexture, "setupDepthTexture"); - function setupDepthRenderbuffer(renderTarget) { - const renderTargetProperties = properties.get(renderTarget); - const isCube = renderTarget.isWebGLCubeRenderTarget === true; - if (renderTargetProperties.__boundDepthTexture !== renderTarget.depthTexture) { - const depthTexture = renderTarget.depthTexture; - if (renderTargetProperties.__depthDisposeCallback) { - renderTargetProperties.__depthDisposeCallback(); - } - if (depthTexture) { - const disposeEvent = /* @__PURE__ */ __name(() => { - delete renderTargetProperties.__boundDepthTexture; - delete renderTargetProperties.__depthDisposeCallback; - depthTexture.removeEventListener("dispose", disposeEvent); - }, "disposeEvent"); - depthTexture.addEventListener("dispose", disposeEvent); - renderTargetProperties.__depthDisposeCallback = disposeEvent; - } - renderTargetProperties.__boundDepthTexture = depthTexture; - } - if (renderTarget.depthTexture && !renderTargetProperties.__autoAllocateDepthBuffer) { - if (isCube) throw new Error("target.depthTexture not supported in Cube render targets"); - setupDepthTexture(renderTargetProperties.__webglFramebuffer, renderTarget); - } else { - if (isCube) { - renderTargetProperties.__webglDepthbuffer = []; - for (let i = 0; i < 6; i++) { - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[i]); - if (renderTargetProperties.__webglDepthbuffer[i] === void 0) { - renderTargetProperties.__webglDepthbuffer[i] = _gl.createRenderbuffer(); - setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer[i], renderTarget, false); - } else { - const glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT; - const renderbuffer = renderTargetProperties.__webglDepthbuffer[i]; - _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderbuffer); - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer); - } - } - } else { - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer); - if (renderTargetProperties.__webglDepthbuffer === void 0) { - renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer(); - setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer, renderTarget, false); - } else { - const glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT; - const renderbuffer = renderTargetProperties.__webglDepthbuffer; - _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderbuffer); - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer); - } - } - } - state.bindFramebuffer(_gl.FRAMEBUFFER, null); - } - __name(setupDepthRenderbuffer, "setupDepthRenderbuffer"); - function rebindTextures(renderTarget, colorTexture, depthTexture) { - const renderTargetProperties = properties.get(renderTarget); - if (colorTexture !== void 0) { - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, 0); - } - if (depthTexture !== void 0) { - setupDepthRenderbuffer(renderTarget); - } - } - __name(rebindTextures, "rebindTextures"); - function setupRenderTarget(renderTarget) { - const texture = renderTarget.texture; - const renderTargetProperties = properties.get(renderTarget); - const textureProperties = properties.get(texture); - renderTarget.addEventListener("dispose", onRenderTargetDispose); - const textures = renderTarget.textures; - const isCube = renderTarget.isWebGLCubeRenderTarget === true; - const isMultipleRenderTargets = textures.length > 1; - if (!isMultipleRenderTargets) { - if (textureProperties.__webglTexture === void 0) { - textureProperties.__webglTexture = _gl.createTexture(); - } - textureProperties.__version = texture.version; - info.memory.textures++; - } - if (isCube) { - renderTargetProperties.__webglFramebuffer = []; - for (let i = 0; i < 6; i++) { - if (texture.mipmaps && texture.mipmaps.length > 0) { - renderTargetProperties.__webglFramebuffer[i] = []; - for (let level = 0; level < texture.mipmaps.length; level++) { - renderTargetProperties.__webglFramebuffer[i][level] = _gl.createFramebuffer(); - } - } else { - renderTargetProperties.__webglFramebuffer[i] = _gl.createFramebuffer(); - } - } - } else { - if (texture.mipmaps && texture.mipmaps.length > 0) { - renderTargetProperties.__webglFramebuffer = []; - for (let level = 0; level < texture.mipmaps.length; level++) { - renderTargetProperties.__webglFramebuffer[level] = _gl.createFramebuffer(); - } - } else { - renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer(); - } - if (isMultipleRenderTargets) { - for (let i = 0, il = textures.length; i < il; i++) { - const attachmentProperties = properties.get(textures[i]); - if (attachmentProperties.__webglTexture === void 0) { - attachmentProperties.__webglTexture = _gl.createTexture(); - info.memory.textures++; - } - } - } - if (renderTarget.samples > 0 && useMultisampledRTT(renderTarget) === false) { - renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer(); - renderTargetProperties.__webglColorRenderbuffer = []; - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); - for (let i = 0; i < textures.length; i++) { - const texture2 = textures[i]; - renderTargetProperties.__webglColorRenderbuffer[i] = _gl.createRenderbuffer(); - _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]); - const glFormat = utils.convert(texture2.format, texture2.colorSpace); - const glType = utils.convert(texture2.type); - const glInternalFormat = getInternalFormat(texture2.internalFormat, glFormat, glType, texture2.colorSpace, renderTarget.isXRRenderTarget === true); - const samples = getRenderTargetSamples(renderTarget); - _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]); - } - _gl.bindRenderbuffer(_gl.RENDERBUFFER, null); - if (renderTarget.depthBuffer) { - renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer(); - setupRenderBufferStorage(renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true); - } - state.bindFramebuffer(_gl.FRAMEBUFFER, null); - } - } - if (isCube) { - state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture); - setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture); - for (let i = 0; i < 6; i++) { - if (texture.mipmaps && texture.mipmaps.length > 0) { - for (let level = 0; level < texture.mipmaps.length; level++) { - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i][level], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level); - } - } else { - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0); - } - } - if (textureNeedsGenerateMipmaps(texture)) { - generateMipmap(_gl.TEXTURE_CUBE_MAP); - } - state.unbindTexture(); - } else if (isMultipleRenderTargets) { - for (let i = 0, il = textures.length; i < il; i++) { - const attachment = textures[i]; - const attachmentProperties = properties.get(attachment); - state.bindTexture(_gl.TEXTURE_2D, attachmentProperties.__webglTexture); - setTextureParameters(_gl.TEXTURE_2D, attachment); - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0); - if (textureNeedsGenerateMipmaps(attachment)) { - generateMipmap(_gl.TEXTURE_2D); - } - } - state.unbindTexture(); - } else { - let glTextureType = _gl.TEXTURE_2D; - if (renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget) { - glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY; - } - state.bindTexture(glTextureType, textureProperties.__webglTexture); - setTextureParameters(glTextureType, texture); - if (texture.mipmaps && texture.mipmaps.length > 0) { - for (let level = 0; level < texture.mipmaps.length; level++) { - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[level], renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, level); - } - } else { - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType, 0); - } - if (textureNeedsGenerateMipmaps(texture)) { - generateMipmap(glTextureType); - } - state.unbindTexture(); - } - if (renderTarget.depthBuffer) { - setupDepthRenderbuffer(renderTarget); - } - } - __name(setupRenderTarget, "setupRenderTarget"); - function updateRenderTargetMipmap(renderTarget) { - const textures = renderTarget.textures; - for (let i = 0, il = textures.length; i < il; i++) { - const texture = textures[i]; - if (textureNeedsGenerateMipmaps(texture)) { - const targetType = getTargetType(renderTarget); - const webglTexture = properties.get(texture).__webglTexture; - state.bindTexture(targetType, webglTexture); - generateMipmap(targetType); - state.unbindTexture(); - } - } - } - __name(updateRenderTargetMipmap, "updateRenderTargetMipmap"); - const invalidationArrayRead = []; - const invalidationArrayDraw = []; - function updateMultisampleRenderTarget(renderTarget) { - if (renderTarget.samples > 0) { - if (useMultisampledRTT(renderTarget) === false) { - const textures = renderTarget.textures; - const width = renderTarget.width; - const height = renderTarget.height; - let mask = _gl.COLOR_BUFFER_BIT; - const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT; - const renderTargetProperties = properties.get(renderTarget); - const isMultipleRenderTargets = textures.length > 1; - if (isMultipleRenderTargets) { - for (let i = 0; i < textures.length; i++) { - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, null); - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer); - _gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, null, 0); - } - } - state.bindFramebuffer(_gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); - state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer); - for (let i = 0; i < textures.length; i++) { - if (renderTarget.resolveDepthBuffer) { - if (renderTarget.depthBuffer) mask |= _gl.DEPTH_BUFFER_BIT; - if (renderTarget.stencilBuffer && renderTarget.resolveStencilBuffer) mask |= _gl.STENCIL_BUFFER_BIT; - } - if (isMultipleRenderTargets) { - _gl.framebufferRenderbuffer(_gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]); - const webglTexture = properties.get(textures[i]).__webglTexture; - _gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, webglTexture, 0); - } - _gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST); - if (supportsInvalidateFramebuffer === true) { - invalidationArrayRead.length = 0; - invalidationArrayDraw.length = 0; - invalidationArrayRead.push(_gl.COLOR_ATTACHMENT0 + i); - if (renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false) { - invalidationArrayRead.push(depthStyle); - invalidationArrayDraw.push(depthStyle); - _gl.invalidateFramebuffer(_gl.DRAW_FRAMEBUFFER, invalidationArrayDraw); - } - _gl.invalidateFramebuffer(_gl.READ_FRAMEBUFFER, invalidationArrayRead); - } - } - state.bindFramebuffer(_gl.READ_FRAMEBUFFER, null); - state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, null); - if (isMultipleRenderTargets) { - for (let i = 0; i < textures.length; i++) { - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer[i]); - const webglTexture = properties.get(textures[i]).__webglTexture; - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer); - _gl.framebufferTexture2D(_gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, webglTexture, 0); - } - } - state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); - } else { - if (renderTarget.depthBuffer && renderTarget.resolveDepthBuffer === false && supportsInvalidateFramebuffer) { - const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT; - _gl.invalidateFramebuffer(_gl.DRAW_FRAMEBUFFER, [depthStyle]); - } - } - } - } - __name(updateMultisampleRenderTarget, "updateMultisampleRenderTarget"); - function getRenderTargetSamples(renderTarget) { - return Math.min(capabilities.maxSamples, renderTarget.samples); - } - __name(getRenderTargetSamples, "getRenderTargetSamples"); - function useMultisampledRTT(renderTarget) { - const renderTargetProperties = properties.get(renderTarget); - return renderTarget.samples > 0 && extensions.has("WEBGL_multisampled_render_to_texture") === true && renderTargetProperties.__useRenderToTexture !== false; - } - __name(useMultisampledRTT, "useMultisampledRTT"); - function updateVideoTexture(texture) { - const frame = info.render.frame; - if (_videoTextures.get(texture) !== frame) { - _videoTextures.set(texture, frame); - texture.update(); - } - } - __name(updateVideoTexture, "updateVideoTexture"); - function verifyColorSpace(texture, image) { - const colorSpace = texture.colorSpace; - const format = texture.format; - const type = texture.type; - if (texture.isCompressedTexture === true || texture.isVideoTexture === true) return image; - if (colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace) { - if (ColorManagement.getTransfer(colorSpace) === SRGBTransfer) { - if (format !== RGBAFormat || type !== UnsignedByteType) { - console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."); - } - } else { - console.error("THREE.WebGLTextures: Unsupported texture color space:", colorSpace); - } - } - return image; - } - __name(verifyColorSpace, "verifyColorSpace"); - function getDimensions(image) { - if (typeof HTMLImageElement !== "undefined" && image instanceof HTMLImageElement) { - _imageDimensions.width = image.naturalWidth || image.width; - _imageDimensions.height = image.naturalHeight || image.height; - } else if (typeof VideoFrame !== "undefined" && image instanceof VideoFrame) { - _imageDimensions.width = image.displayWidth; - _imageDimensions.height = image.displayHeight; - } else { - _imageDimensions.width = image.width; - _imageDimensions.height = image.height; - } - return _imageDimensions; - } - __name(getDimensions, "getDimensions"); - this.allocateTextureUnit = allocateTextureUnit; - this.resetTextureUnits = resetTextureUnits; - this.setTexture2D = setTexture2D; - this.setTexture2DArray = setTexture2DArray; - this.setTexture3D = setTexture3D; - this.setTextureCube = setTextureCube; - this.rebindTextures = rebindTextures; - this.setupRenderTarget = setupRenderTarget; - this.updateRenderTargetMipmap = updateRenderTargetMipmap; - this.updateMultisampleRenderTarget = updateMultisampleRenderTarget; - this.setupDepthRenderbuffer = setupDepthRenderbuffer; - this.setupFrameBufferTexture = setupFrameBufferTexture; - this.useMultisampledRTT = useMultisampledRTT; -} -__name(WebGLTextures, "WebGLTextures"); -function WebGLUtils(gl, extensions) { - function convert(p, colorSpace = NoColorSpace) { - let extension; - const transfer = ColorManagement.getTransfer(colorSpace); - if (p === UnsignedByteType) return gl.UNSIGNED_BYTE; - if (p === UnsignedShort4444Type) return gl.UNSIGNED_SHORT_4_4_4_4; - if (p === UnsignedShort5551Type) return gl.UNSIGNED_SHORT_5_5_5_1; - if (p === UnsignedInt5999Type) return gl.UNSIGNED_INT_5_9_9_9_REV; - if (p === ByteType) return gl.BYTE; - if (p === ShortType) return gl.SHORT; - if (p === UnsignedShortType) return gl.UNSIGNED_SHORT; - if (p === IntType) return gl.INT; - if (p === UnsignedIntType) return gl.UNSIGNED_INT; - if (p === FloatType) return gl.FLOAT; - if (p === HalfFloatType) return gl.HALF_FLOAT; - if (p === AlphaFormat) return gl.ALPHA; - if (p === RGBFormat) return gl.RGB; - if (p === RGBAFormat) return gl.RGBA; - if (p === LuminanceFormat) return gl.LUMINANCE; - if (p === LuminanceAlphaFormat) return gl.LUMINANCE_ALPHA; - if (p === DepthFormat) return gl.DEPTH_COMPONENT; - if (p === DepthStencilFormat) return gl.DEPTH_STENCIL; - if (p === RedFormat) return gl.RED; - if (p === RedIntegerFormat) return gl.RED_INTEGER; - if (p === RGFormat) return gl.RG; - if (p === RGIntegerFormat) return gl.RG_INTEGER; - if (p === RGBAIntegerFormat) return gl.RGBA_INTEGER; - if (p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format) { - if (transfer === SRGBTransfer) { - extension = extensions.get("WEBGL_compressed_texture_s3tc_srgb"); - if (extension !== null) { - if (p === RGB_S3TC_DXT1_Format) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT; - if (p === RGBA_S3TC_DXT1_Format) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; - if (p === RGBA_S3TC_DXT3_Format) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; - if (p === RGBA_S3TC_DXT5_Format) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; - } else { - return null; - } - } else { - extension = extensions.get("WEBGL_compressed_texture_s3tc"); - if (extension !== null) { - if (p === RGB_S3TC_DXT1_Format) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT; - if (p === RGBA_S3TC_DXT1_Format) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT; - if (p === RGBA_S3TC_DXT3_Format) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT; - if (p === RGBA_S3TC_DXT5_Format) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT; - } else { - return null; - } - } - } - if (p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format) { - extension = extensions.get("WEBGL_compressed_texture_pvrtc"); - if (extension !== null) { - if (p === RGB_PVRTC_4BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; - if (p === RGB_PVRTC_2BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; - if (p === RGBA_PVRTC_4BPPV1_Format) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; - if (p === RGBA_PVRTC_2BPPV1_Format) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; - } else { - return null; - } - } - if (p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format) { - extension = extensions.get("WEBGL_compressed_texture_etc"); - if (extension !== null) { - if (p === RGB_ETC1_Format || p === RGB_ETC2_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2; - if (p === RGBA_ETC2_EAC_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC; - } else { - return null; - } - } - if (p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format || p === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format || p === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format || p === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format || p === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format) { - extension = extensions.get("WEBGL_compressed_texture_astc"); - if (extension !== null) { - if (p === RGBA_ASTC_4x4_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR; - if (p === RGBA_ASTC_5x4_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR; - if (p === RGBA_ASTC_5x5_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR; - if (p === RGBA_ASTC_6x5_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR; - if (p === RGBA_ASTC_6x6_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR; - if (p === RGBA_ASTC_8x5_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR; - if (p === RGBA_ASTC_8x6_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR; - if (p === RGBA_ASTC_8x8_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR; - if (p === RGBA_ASTC_10x5_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR; - if (p === RGBA_ASTC_10x6_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR; - if (p === RGBA_ASTC_10x8_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR; - if (p === RGBA_ASTC_10x10_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR; - if (p === RGBA_ASTC_12x10_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR; - if (p === RGBA_ASTC_12x12_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR; - } else { - return null; - } - } - if (p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format) { - extension = extensions.get("EXT_texture_compression_bptc"); - if (extension !== null) { - if (p === RGBA_BPTC_Format) return transfer === SRGBTransfer ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT; - if (p === RGB_BPTC_SIGNED_Format) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT; - if (p === RGB_BPTC_UNSIGNED_Format) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT; - } else { - return null; - } - } - if (p === RED_RGTC1_Format || p === SIGNED_RED_RGTC1_Format || p === RED_GREEN_RGTC2_Format || p === SIGNED_RED_GREEN_RGTC2_Format) { - extension = extensions.get("EXT_texture_compression_rgtc"); - if (extension !== null) { - if (p === RGBA_BPTC_Format) return extension.COMPRESSED_RED_RGTC1_EXT; - if (p === SIGNED_RED_RGTC1_Format) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT; - if (p === RED_GREEN_RGTC2_Format) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT; - if (p === SIGNED_RED_GREEN_RGTC2_Format) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT; - } else { - return null; - } - } - if (p === UnsignedInt248Type) return gl.UNSIGNED_INT_24_8; - return gl[p] !== void 0 ? gl[p] : null; - } - __name(convert, "convert"); - return { convert }; -} -__name(WebGLUtils, "WebGLUtils"); -class ArrayCamera extends PerspectiveCamera { - static { - __name(this, "ArrayCamera"); - } - constructor(array = []) { - super(); - this.isArrayCamera = true; - this.cameras = array; - } -} -class Group extends Object3D { - static { - __name(this, "Group"); - } - constructor() { - super(); - this.isGroup = true; - this.type = "Group"; - } -} -const _moveEvent = { type: "move" }; -class WebXRController { - static { - __name(this, "WebXRController"); - } - constructor() { - this._targetRay = null; - this._grip = null; - this._hand = null; - } - getHandSpace() { - if (this._hand === null) { - this._hand = new Group(); - this._hand.matrixAutoUpdate = false; - this._hand.visible = false; - this._hand.joints = {}; - this._hand.inputState = { pinching: false }; - } - return this._hand; - } - getTargetRaySpace() { - if (this._targetRay === null) { - this._targetRay = new Group(); - this._targetRay.matrixAutoUpdate = false; - this._targetRay.visible = false; - this._targetRay.hasLinearVelocity = false; - this._targetRay.linearVelocity = new Vector3(); - this._targetRay.hasAngularVelocity = false; - this._targetRay.angularVelocity = new Vector3(); - } - return this._targetRay; - } - getGripSpace() { - if (this._grip === null) { - this._grip = new Group(); - this._grip.matrixAutoUpdate = false; - this._grip.visible = false; - this._grip.hasLinearVelocity = false; - this._grip.linearVelocity = new Vector3(); - this._grip.hasAngularVelocity = false; - this._grip.angularVelocity = new Vector3(); - } - return this._grip; - } - dispatchEvent(event) { - if (this._targetRay !== null) { - this._targetRay.dispatchEvent(event); - } - if (this._grip !== null) { - this._grip.dispatchEvent(event); - } - if (this._hand !== null) { - this._hand.dispatchEvent(event); - } - return this; - } - connect(inputSource) { - if (inputSource && inputSource.hand) { - const hand = this._hand; - if (hand) { - for (const inputjoint of inputSource.hand.values()) { - this._getHandJoint(hand, inputjoint); - } - } - } - this.dispatchEvent({ type: "connected", data: inputSource }); - return this; - } - disconnect(inputSource) { - this.dispatchEvent({ type: "disconnected", data: inputSource }); - if (this._targetRay !== null) { - this._targetRay.visible = false; - } - if (this._grip !== null) { - this._grip.visible = false; - } - if (this._hand !== null) { - this._hand.visible = false; - } - return this; - } - update(inputSource, frame, referenceSpace) { - let inputPose = null; - let gripPose = null; - let handPose = null; - const targetRay = this._targetRay; - const grip = this._grip; - const hand = this._hand; - if (inputSource && frame.session.visibilityState !== "visible-blurred") { - if (hand && inputSource.hand) { - handPose = true; - for (const inputjoint of inputSource.hand.values()) { - const jointPose = frame.getJointPose(inputjoint, referenceSpace); - const joint = this._getHandJoint(hand, inputjoint); - if (jointPose !== null) { - joint.matrix.fromArray(jointPose.transform.matrix); - joint.matrix.decompose(joint.position, joint.rotation, joint.scale); - joint.matrixWorldNeedsUpdate = true; - joint.jointRadius = jointPose.radius; - } - joint.visible = jointPose !== null; - } - const indexTip = hand.joints["index-finger-tip"]; - const thumbTip = hand.joints["thumb-tip"]; - const distance = indexTip.position.distanceTo(thumbTip.position); - const distanceToPinch = 0.02; - const threshold = 5e-3; - if (hand.inputState.pinching && distance > distanceToPinch + threshold) { - hand.inputState.pinching = false; - this.dispatchEvent({ - type: "pinchend", - handedness: inputSource.handedness, - target: this - }); - } else if (!hand.inputState.pinching && distance <= distanceToPinch - threshold) { - hand.inputState.pinching = true; - this.dispatchEvent({ - type: "pinchstart", - handedness: inputSource.handedness, - target: this - }); - } - } else { - if (grip !== null && inputSource.gripSpace) { - gripPose = frame.getPose(inputSource.gripSpace, referenceSpace); - if (gripPose !== null) { - grip.matrix.fromArray(gripPose.transform.matrix); - grip.matrix.decompose(grip.position, grip.rotation, grip.scale); - grip.matrixWorldNeedsUpdate = true; - if (gripPose.linearVelocity) { - grip.hasLinearVelocity = true; - grip.linearVelocity.copy(gripPose.linearVelocity); - } else { - grip.hasLinearVelocity = false; - } - if (gripPose.angularVelocity) { - grip.hasAngularVelocity = true; - grip.angularVelocity.copy(gripPose.angularVelocity); - } else { - grip.hasAngularVelocity = false; - } - } - } - } - if (targetRay !== null) { - inputPose = frame.getPose(inputSource.targetRaySpace, referenceSpace); - if (inputPose === null && gripPose !== null) { - inputPose = gripPose; - } - if (inputPose !== null) { - targetRay.matrix.fromArray(inputPose.transform.matrix); - targetRay.matrix.decompose(targetRay.position, targetRay.rotation, targetRay.scale); - targetRay.matrixWorldNeedsUpdate = true; - if (inputPose.linearVelocity) { - targetRay.hasLinearVelocity = true; - targetRay.linearVelocity.copy(inputPose.linearVelocity); - } else { - targetRay.hasLinearVelocity = false; - } - if (inputPose.angularVelocity) { - targetRay.hasAngularVelocity = true; - targetRay.angularVelocity.copy(inputPose.angularVelocity); - } else { - targetRay.hasAngularVelocity = false; - } - this.dispatchEvent(_moveEvent); - } - } - } - if (targetRay !== null) { - targetRay.visible = inputPose !== null; - } - if (grip !== null) { - grip.visible = gripPose !== null; - } - if (hand !== null) { - hand.visible = handPose !== null; - } - return this; - } - // private method - _getHandJoint(hand, inputjoint) { - if (hand.joints[inputjoint.jointName] === void 0) { - const joint = new Group(); - joint.matrixAutoUpdate = false; - joint.visible = false; - hand.joints[inputjoint.jointName] = joint; - hand.add(joint); - } - return hand.joints[inputjoint.jointName]; - } -} -const _occlusion_vertex = ` -void main() { - - gl_Position = vec4( position, 1.0 ); - -}`; -const _occlusion_fragment = ` -uniform sampler2DArray depthColor; -uniform float depthWidth; -uniform float depthHeight; - -void main() { - - vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); - - if ( coord.x >= 1.0 ) { - - gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; - - } else { - - gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; - - } - -}`; -class WebXRDepthSensing { - static { - __name(this, "WebXRDepthSensing"); - } - constructor() { - this.texture = null; - this.mesh = null; - this.depthNear = 0; - this.depthFar = 0; - } - init(renderer, depthData, renderState) { - if (this.texture === null) { - const texture = new Texture(); - const texProps = renderer.properties.get(texture); - texProps.__webglTexture = depthData.texture; - if (depthData.depthNear != renderState.depthNear || depthData.depthFar != renderState.depthFar) { - this.depthNear = depthData.depthNear; - this.depthFar = depthData.depthFar; - } - this.texture = texture; - } - } - getMesh(cameraXR) { - if (this.texture !== null) { - if (this.mesh === null) { - const viewport = cameraXR.cameras[0].viewport; - const material = new ShaderMaterial({ - vertexShader: _occlusion_vertex, - fragmentShader: _occlusion_fragment, - uniforms: { - depthColor: { value: this.texture }, - depthWidth: { value: viewport.z }, - depthHeight: { value: viewport.w } - } - }); - this.mesh = new Mesh(new PlaneGeometry(20, 20), material); - } - } - return this.mesh; - } - reset() { - this.texture = null; - this.mesh = null; - } - getDepthTexture() { - return this.texture; - } -} -class WebXRManager extends EventDispatcher { - static { - __name(this, "WebXRManager"); - } - constructor(renderer, gl) { - super(); - const scope = this; - let session = null; - let framebufferScaleFactor = 1; - let referenceSpace = null; - let referenceSpaceType = "local-floor"; - let foveation = 1; - let customReferenceSpace = null; - let pose = null; - let glBinding = null; - let glProjLayer = null; - let glBaseLayer = null; - let xrFrame = null; - const depthSensing = new WebXRDepthSensing(); - const attributes = gl.getContextAttributes(); - let initialRenderTarget = null; - let newRenderTarget = null; - const controllers = []; - const controllerInputSources = []; - const currentSize = new Vector2(); - let currentPixelRatio = null; - const cameraL = new PerspectiveCamera(); - cameraL.viewport = new Vector4(); - const cameraR = new PerspectiveCamera(); - cameraR.viewport = new Vector4(); - const cameras = [cameraL, cameraR]; - const cameraXR = new ArrayCamera(); - let _currentDepthNear = null; - let _currentDepthFar = null; - this.cameraAutoUpdate = true; - this.enabled = false; - this.isPresenting = false; - this.getController = function(index) { - let controller = controllers[index]; - if (controller === void 0) { - controller = new WebXRController(); - controllers[index] = controller; - } - return controller.getTargetRaySpace(); - }; - this.getControllerGrip = function(index) { - let controller = controllers[index]; - if (controller === void 0) { - controller = new WebXRController(); - controllers[index] = controller; - } - return controller.getGripSpace(); - }; - this.getHand = function(index) { - let controller = controllers[index]; - if (controller === void 0) { - controller = new WebXRController(); - controllers[index] = controller; - } - return controller.getHandSpace(); - }; - function onSessionEvent(event) { - const controllerIndex = controllerInputSources.indexOf(event.inputSource); - if (controllerIndex === -1) { - return; - } - const controller = controllers[controllerIndex]; - if (controller !== void 0) { - controller.update(event.inputSource, event.frame, customReferenceSpace || referenceSpace); - controller.dispatchEvent({ type: event.type, data: event.inputSource }); - } - } - __name(onSessionEvent, "onSessionEvent"); - function onSessionEnd() { - session.removeEventListener("select", onSessionEvent); - session.removeEventListener("selectstart", onSessionEvent); - session.removeEventListener("selectend", onSessionEvent); - session.removeEventListener("squeeze", onSessionEvent); - session.removeEventListener("squeezestart", onSessionEvent); - session.removeEventListener("squeezeend", onSessionEvent); - session.removeEventListener("end", onSessionEnd); - session.removeEventListener("inputsourceschange", onInputSourcesChange); - for (let i = 0; i < controllers.length; i++) { - const inputSource = controllerInputSources[i]; - if (inputSource === null) continue; - controllerInputSources[i] = null; - controllers[i].disconnect(inputSource); - } - _currentDepthNear = null; - _currentDepthFar = null; - depthSensing.reset(); - renderer.setRenderTarget(initialRenderTarget); - glBaseLayer = null; - glProjLayer = null; - glBinding = null; - session = null; - newRenderTarget = null; - animation.stop(); - scope.isPresenting = false; - renderer.setPixelRatio(currentPixelRatio); - renderer.setSize(currentSize.width, currentSize.height, false); - scope.dispatchEvent({ type: "sessionend" }); - } - __name(onSessionEnd, "onSessionEnd"); - this.setFramebufferScaleFactor = function(value) { - framebufferScaleFactor = value; - if (scope.isPresenting === true) { - console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting."); - } - }; - this.setReferenceSpaceType = function(value) { - referenceSpaceType = value; - if (scope.isPresenting === true) { - console.warn("THREE.WebXRManager: Cannot change reference space type while presenting."); - } - }; - this.getReferenceSpace = function() { - return customReferenceSpace || referenceSpace; - }; - this.setReferenceSpace = function(space) { - customReferenceSpace = space; - }; - this.getBaseLayer = function() { - return glProjLayer !== null ? glProjLayer : glBaseLayer; - }; - this.getBinding = function() { - return glBinding; - }; - this.getFrame = function() { - return xrFrame; - }; - this.getSession = function() { - return session; - }; - this.setSession = async function(value) { - session = value; - if (session !== null) { - initialRenderTarget = renderer.getRenderTarget(); - session.addEventListener("select", onSessionEvent); - session.addEventListener("selectstart", onSessionEvent); - session.addEventListener("selectend", onSessionEvent); - session.addEventListener("squeeze", onSessionEvent); - session.addEventListener("squeezestart", onSessionEvent); - session.addEventListener("squeezeend", onSessionEvent); - session.addEventListener("end", onSessionEnd); - session.addEventListener("inputsourceschange", onInputSourcesChange); - if (attributes.xrCompatible !== true) { - await gl.makeXRCompatible(); - } - currentPixelRatio = renderer.getPixelRatio(); - renderer.getSize(currentSize); - if (session.renderState.layers === void 0) { - const layerInit = { - antialias: attributes.antialias, - alpha: true, - depth: attributes.depth, - stencil: attributes.stencil, - framebufferScaleFactor - }; - glBaseLayer = new XRWebGLLayer(session, gl, layerInit); - session.updateRenderState({ baseLayer: glBaseLayer }); - renderer.setPixelRatio(1); - renderer.setSize(glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false); - newRenderTarget = new WebGLRenderTarget( - glBaseLayer.framebufferWidth, - glBaseLayer.framebufferHeight, - { - format: RGBAFormat, - type: UnsignedByteType, - colorSpace: renderer.outputColorSpace, - stencilBuffer: attributes.stencil - } - ); - } else { - let depthFormat = null; - let depthType = null; - let glDepthFormat = null; - if (attributes.depth) { - glDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24; - depthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat; - depthType = attributes.stencil ? UnsignedInt248Type : UnsignedIntType; - } - const projectionlayerInit = { - colorFormat: gl.RGBA8, - depthFormat: glDepthFormat, - scaleFactor: framebufferScaleFactor - }; - glBinding = new XRWebGLBinding(session, gl); - glProjLayer = glBinding.createProjectionLayer(projectionlayerInit); - session.updateRenderState({ layers: [glProjLayer] }); - renderer.setPixelRatio(1); - renderer.setSize(glProjLayer.textureWidth, glProjLayer.textureHeight, false); - newRenderTarget = new WebGLRenderTarget( - glProjLayer.textureWidth, - glProjLayer.textureHeight, - { - format: RGBAFormat, - type: UnsignedByteType, - depthTexture: new DepthTexture(glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, void 0, void 0, void 0, void 0, void 0, void 0, depthFormat), - stencilBuffer: attributes.stencil, - colorSpace: renderer.outputColorSpace, - samples: attributes.antialias ? 4 : 0, - resolveDepthBuffer: glProjLayer.ignoreDepthValues === false - } - ); - } - newRenderTarget.isXRRenderTarget = true; - this.setFoveation(foveation); - customReferenceSpace = null; - referenceSpace = await session.requestReferenceSpace(referenceSpaceType); - animation.setContext(session); - animation.start(); - scope.isPresenting = true; - scope.dispatchEvent({ type: "sessionstart" }); - } - }; - this.getEnvironmentBlendMode = function() { - if (session !== null) { - return session.environmentBlendMode; - } - }; - this.getDepthTexture = function() { - return depthSensing.getDepthTexture(); - }; - function onInputSourcesChange(event) { - for (let i = 0; i < event.removed.length; i++) { - const inputSource = event.removed[i]; - const index = controllerInputSources.indexOf(inputSource); - if (index >= 0) { - controllerInputSources[index] = null; - controllers[index].disconnect(inputSource); - } - } - for (let i = 0; i < event.added.length; i++) { - const inputSource = event.added[i]; - let controllerIndex = controllerInputSources.indexOf(inputSource); - if (controllerIndex === -1) { - for (let i2 = 0; i2 < controllers.length; i2++) { - if (i2 >= controllerInputSources.length) { - controllerInputSources.push(inputSource); - controllerIndex = i2; - break; - } else if (controllerInputSources[i2] === null) { - controllerInputSources[i2] = inputSource; - controllerIndex = i2; - break; - } - } - if (controllerIndex === -1) break; - } - const controller = controllers[controllerIndex]; - if (controller) { - controller.connect(inputSource); - } - } - } - __name(onInputSourcesChange, "onInputSourcesChange"); - const cameraLPos = new Vector3(); - const cameraRPos = new Vector3(); - function setProjectionFromUnion(camera, cameraL2, cameraR2) { - cameraLPos.setFromMatrixPosition(cameraL2.matrixWorld); - cameraRPos.setFromMatrixPosition(cameraR2.matrixWorld); - const ipd = cameraLPos.distanceTo(cameraRPos); - const projL = cameraL2.projectionMatrix.elements; - const projR = cameraR2.projectionMatrix.elements; - const near = projL[14] / (projL[10] - 1); - const far = projL[14] / (projL[10] + 1); - const topFov = (projL[9] + 1) / projL[5]; - const bottomFov = (projL[9] - 1) / projL[5]; - const leftFov = (projL[8] - 1) / projL[0]; - const rightFov = (projR[8] + 1) / projR[0]; - const left = near * leftFov; - const right = near * rightFov; - const zOffset = ipd / (-leftFov + rightFov); - const xOffset = zOffset * -leftFov; - cameraL2.matrixWorld.decompose(camera.position, camera.quaternion, camera.scale); - camera.translateX(xOffset); - camera.translateZ(zOffset); - camera.matrixWorld.compose(camera.position, camera.quaternion, camera.scale); - camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); - if (projL[10] === -1) { - camera.projectionMatrix.copy(cameraL2.projectionMatrix); - camera.projectionMatrixInverse.copy(cameraL2.projectionMatrixInverse); - } else { - const near2 = near + zOffset; - const far2 = far + zOffset; - const left2 = left - xOffset; - const right2 = right + (ipd - xOffset); - const top2 = topFov * far / far2 * near2; - const bottom2 = bottomFov * far / far2 * near2; - camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2); - camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert(); - } - } - __name(setProjectionFromUnion, "setProjectionFromUnion"); - function updateCamera(camera, parent) { - if (parent === null) { - camera.matrixWorld.copy(camera.matrix); - } else { - camera.matrixWorld.multiplyMatrices(parent.matrixWorld, camera.matrix); - } - camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); - } - __name(updateCamera, "updateCamera"); - this.updateCamera = function(camera) { - if (session === null) return; - let depthNear = camera.near; - let depthFar = camera.far; - if (depthSensing.texture !== null) { - if (depthSensing.depthNear > 0) depthNear = depthSensing.depthNear; - if (depthSensing.depthFar > 0) depthFar = depthSensing.depthFar; - } - cameraXR.near = cameraR.near = cameraL.near = depthNear; - cameraXR.far = cameraR.far = cameraL.far = depthFar; - if (_currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far) { - session.updateRenderState({ - depthNear: cameraXR.near, - depthFar: cameraXR.far - }); - _currentDepthNear = cameraXR.near; - _currentDepthFar = cameraXR.far; - } - cameraL.layers.mask = camera.layers.mask | 2; - cameraR.layers.mask = camera.layers.mask | 4; - cameraXR.layers.mask = cameraL.layers.mask | cameraR.layers.mask; - const parent = camera.parent; - const cameras2 = cameraXR.cameras; - updateCamera(cameraXR, parent); - for (let i = 0; i < cameras2.length; i++) { - updateCamera(cameras2[i], parent); - } - if (cameras2.length === 2) { - setProjectionFromUnion(cameraXR, cameraL, cameraR); - } else { - cameraXR.projectionMatrix.copy(cameraL.projectionMatrix); - } - updateUserCamera(camera, cameraXR, parent); - }; - function updateUserCamera(camera, cameraXR2, parent) { - if (parent === null) { - camera.matrix.copy(cameraXR2.matrixWorld); - } else { - camera.matrix.copy(parent.matrixWorld); - camera.matrix.invert(); - camera.matrix.multiply(cameraXR2.matrixWorld); - } - camera.matrix.decompose(camera.position, camera.quaternion, camera.scale); - camera.updateMatrixWorld(true); - camera.projectionMatrix.copy(cameraXR2.projectionMatrix); - camera.projectionMatrixInverse.copy(cameraXR2.projectionMatrixInverse); - if (camera.isPerspectiveCamera) { - camera.fov = RAD2DEG * 2 * Math.atan(1 / camera.projectionMatrix.elements[5]); - camera.zoom = 1; - } - } - __name(updateUserCamera, "updateUserCamera"); - this.getCamera = function() { - return cameraXR; - }; - this.getFoveation = function() { - if (glProjLayer === null && glBaseLayer === null) { - return void 0; - } - return foveation; - }; - this.setFoveation = function(value) { - foveation = value; - if (glProjLayer !== null) { - glProjLayer.fixedFoveation = value; - } - if (glBaseLayer !== null && glBaseLayer.fixedFoveation !== void 0) { - glBaseLayer.fixedFoveation = value; - } - }; - this.hasDepthSensing = function() { - return depthSensing.texture !== null; - }; - this.getDepthSensingMesh = function() { - return depthSensing.getMesh(cameraXR); - }; - let onAnimationFrameCallback = null; - function onAnimationFrame(time, frame) { - pose = frame.getViewerPose(customReferenceSpace || referenceSpace); - xrFrame = frame; - if (pose !== null) { - const views = pose.views; - if (glBaseLayer !== null) { - renderer.setRenderTargetFramebuffer(newRenderTarget, glBaseLayer.framebuffer); - renderer.setRenderTarget(newRenderTarget); - } - let cameraXRNeedsUpdate = false; - if (views.length !== cameraXR.cameras.length) { - cameraXR.cameras.length = 0; - cameraXRNeedsUpdate = true; - } - for (let i = 0; i < views.length; i++) { - const view = views[i]; - let viewport = null; - if (glBaseLayer !== null) { - viewport = glBaseLayer.getViewport(view); - } else { - const glSubImage = glBinding.getViewSubImage(glProjLayer, view); - viewport = glSubImage.viewport; - if (i === 0) { - renderer.setRenderTargetTextures( - newRenderTarget, - glSubImage.colorTexture, - glProjLayer.ignoreDepthValues ? void 0 : glSubImage.depthStencilTexture - ); - renderer.setRenderTarget(newRenderTarget); - } - } - let camera = cameras[i]; - if (camera === void 0) { - camera = new PerspectiveCamera(); - camera.layers.enable(i); - camera.viewport = new Vector4(); - cameras[i] = camera; - } - camera.matrix.fromArray(view.transform.matrix); - camera.matrix.decompose(camera.position, camera.quaternion, camera.scale); - camera.projectionMatrix.fromArray(view.projectionMatrix); - camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert(); - camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height); - if (i === 0) { - cameraXR.matrix.copy(camera.matrix); - cameraXR.matrix.decompose(cameraXR.position, cameraXR.quaternion, cameraXR.scale); - } - if (cameraXRNeedsUpdate === true) { - cameraXR.cameras.push(camera); - } - } - const enabledFeatures = session.enabledFeatures; - if (enabledFeatures && enabledFeatures.includes("depth-sensing")) { - const depthData = glBinding.getDepthInformation(views[0]); - if (depthData && depthData.isValid && depthData.texture) { - depthSensing.init(renderer, depthData, session.renderState); - } - } - } - for (let i = 0; i < controllers.length; i++) { - const inputSource = controllerInputSources[i]; - const controller = controllers[i]; - if (inputSource !== null && controller !== void 0) { - controller.update(inputSource, frame, customReferenceSpace || referenceSpace); - } - } - if (onAnimationFrameCallback) onAnimationFrameCallback(time, frame); - if (frame.detectedPlanes) { - scope.dispatchEvent({ type: "planesdetected", data: frame }); - } - xrFrame = null; - } - __name(onAnimationFrame, "onAnimationFrame"); - const animation = new WebGLAnimation(); - animation.setAnimationLoop(onAnimationFrame); - this.setAnimationLoop = function(callback) { - onAnimationFrameCallback = callback; - }; - this.dispose = function() { - }; - } -} -const _e1 = /* @__PURE__ */ new Euler(); -const _m1 = /* @__PURE__ */ new Matrix4(); -function WebGLMaterials(renderer, properties) { - function refreshTransformUniform(map, uniform) { - if (map.matrixAutoUpdate === true) { - map.updateMatrix(); - } - uniform.value.copy(map.matrix); - } - __name(refreshTransformUniform, "refreshTransformUniform"); - function refreshFogUniforms(uniforms, fog) { - fog.color.getRGB(uniforms.fogColor.value, getUnlitUniformColorSpace(renderer)); - if (fog.isFog) { - uniforms.fogNear.value = fog.near; - uniforms.fogFar.value = fog.far; - } else if (fog.isFogExp2) { - uniforms.fogDensity.value = fog.density; - } - } - __name(refreshFogUniforms, "refreshFogUniforms"); - function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) { - if (material.isMeshBasicMaterial) { - refreshUniformsCommon(uniforms, material); - } else if (material.isMeshLambertMaterial) { - refreshUniformsCommon(uniforms, material); - } else if (material.isMeshToonMaterial) { - refreshUniformsCommon(uniforms, material); - refreshUniformsToon(uniforms, material); - } else if (material.isMeshPhongMaterial) { - refreshUniformsCommon(uniforms, material); - refreshUniformsPhong(uniforms, material); - } else if (material.isMeshStandardMaterial) { - refreshUniformsCommon(uniforms, material); - refreshUniformsStandard(uniforms, material); - if (material.isMeshPhysicalMaterial) { - refreshUniformsPhysical(uniforms, material, transmissionRenderTarget); - } - } else if (material.isMeshMatcapMaterial) { - refreshUniformsCommon(uniforms, material); - refreshUniformsMatcap(uniforms, material); - } else if (material.isMeshDepthMaterial) { - refreshUniformsCommon(uniforms, material); - } else if (material.isMeshDistanceMaterial) { - refreshUniformsCommon(uniforms, material); - refreshUniformsDistance(uniforms, material); - } else if (material.isMeshNormalMaterial) { - refreshUniformsCommon(uniforms, material); - } else if (material.isLineBasicMaterial) { - refreshUniformsLine(uniforms, material); - if (material.isLineDashedMaterial) { - refreshUniformsDash(uniforms, material); - } - } else if (material.isPointsMaterial) { - refreshUniformsPoints(uniforms, material, pixelRatio, height); - } else if (material.isSpriteMaterial) { - refreshUniformsSprites(uniforms, material); - } else if (material.isShadowMaterial) { - uniforms.color.value.copy(material.color); - uniforms.opacity.value = material.opacity; - } else if (material.isShaderMaterial) { - material.uniformsNeedUpdate = false; - } - } - __name(refreshMaterialUniforms, "refreshMaterialUniforms"); - function refreshUniformsCommon(uniforms, material) { - uniforms.opacity.value = material.opacity; - if (material.color) { - uniforms.diffuse.value.copy(material.color); - } - if (material.emissive) { - uniforms.emissive.value.copy(material.emissive).multiplyScalar(material.emissiveIntensity); - } - if (material.map) { - uniforms.map.value = material.map; - refreshTransformUniform(material.map, uniforms.mapTransform); - } - if (material.alphaMap) { - uniforms.alphaMap.value = material.alphaMap; - refreshTransformUniform(material.alphaMap, uniforms.alphaMapTransform); - } - if (material.bumpMap) { - uniforms.bumpMap.value = material.bumpMap; - refreshTransformUniform(material.bumpMap, uniforms.bumpMapTransform); - uniforms.bumpScale.value = material.bumpScale; - if (material.side === BackSide) { - uniforms.bumpScale.value *= -1; - } - } - if (material.normalMap) { - uniforms.normalMap.value = material.normalMap; - refreshTransformUniform(material.normalMap, uniforms.normalMapTransform); - uniforms.normalScale.value.copy(material.normalScale); - if (material.side === BackSide) { - uniforms.normalScale.value.negate(); - } - } - if (material.displacementMap) { - uniforms.displacementMap.value = material.displacementMap; - refreshTransformUniform(material.displacementMap, uniforms.displacementMapTransform); - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; - } - if (material.emissiveMap) { - uniforms.emissiveMap.value = material.emissiveMap; - refreshTransformUniform(material.emissiveMap, uniforms.emissiveMapTransform); - } - if (material.specularMap) { - uniforms.specularMap.value = material.specularMap; - refreshTransformUniform(material.specularMap, uniforms.specularMapTransform); - } - if (material.alphaTest > 0) { - uniforms.alphaTest.value = material.alphaTest; - } - const materialProperties = properties.get(material); - const envMap = materialProperties.envMap; - const envMapRotation = materialProperties.envMapRotation; - if (envMap) { - uniforms.envMap.value = envMap; - _e1.copy(envMapRotation); - _e1.x *= -1; - _e1.y *= -1; - _e1.z *= -1; - if (envMap.isCubeTexture && envMap.isRenderTargetTexture === false) { - _e1.y *= -1; - _e1.z *= -1; - } - uniforms.envMapRotation.value.setFromMatrix4(_m1.makeRotationFromEuler(_e1)); - uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1; - uniforms.reflectivity.value = material.reflectivity; - uniforms.ior.value = material.ior; - uniforms.refractionRatio.value = material.refractionRatio; - } - if (material.lightMap) { - uniforms.lightMap.value = material.lightMap; - uniforms.lightMapIntensity.value = material.lightMapIntensity; - refreshTransformUniform(material.lightMap, uniforms.lightMapTransform); - } - if (material.aoMap) { - uniforms.aoMap.value = material.aoMap; - uniforms.aoMapIntensity.value = material.aoMapIntensity; - refreshTransformUniform(material.aoMap, uniforms.aoMapTransform); - } - } - __name(refreshUniformsCommon, "refreshUniformsCommon"); - function refreshUniformsLine(uniforms, material) { - uniforms.diffuse.value.copy(material.color); - uniforms.opacity.value = material.opacity; - if (material.map) { - uniforms.map.value = material.map; - refreshTransformUniform(material.map, uniforms.mapTransform); - } - } - __name(refreshUniformsLine, "refreshUniformsLine"); - function refreshUniformsDash(uniforms, material) { - uniforms.dashSize.value = material.dashSize; - uniforms.totalSize.value = material.dashSize + material.gapSize; - uniforms.scale.value = material.scale; - } - __name(refreshUniformsDash, "refreshUniformsDash"); - function refreshUniformsPoints(uniforms, material, pixelRatio, height) { - uniforms.diffuse.value.copy(material.color); - uniforms.opacity.value = material.opacity; - uniforms.size.value = material.size * pixelRatio; - uniforms.scale.value = height * 0.5; - if (material.map) { - uniforms.map.value = material.map; - refreshTransformUniform(material.map, uniforms.uvTransform); - } - if (material.alphaMap) { - uniforms.alphaMap.value = material.alphaMap; - refreshTransformUniform(material.alphaMap, uniforms.alphaMapTransform); - } - if (material.alphaTest > 0) { - uniforms.alphaTest.value = material.alphaTest; - } - } - __name(refreshUniformsPoints, "refreshUniformsPoints"); - function refreshUniformsSprites(uniforms, material) { - uniforms.diffuse.value.copy(material.color); - uniforms.opacity.value = material.opacity; - uniforms.rotation.value = material.rotation; - if (material.map) { - uniforms.map.value = material.map; - refreshTransformUniform(material.map, uniforms.mapTransform); - } - if (material.alphaMap) { - uniforms.alphaMap.value = material.alphaMap; - refreshTransformUniform(material.alphaMap, uniforms.alphaMapTransform); - } - if (material.alphaTest > 0) { - uniforms.alphaTest.value = material.alphaTest; - } - } - __name(refreshUniformsSprites, "refreshUniformsSprites"); - function refreshUniformsPhong(uniforms, material) { - uniforms.specular.value.copy(material.specular); - uniforms.shininess.value = Math.max(material.shininess, 1e-4); - } - __name(refreshUniformsPhong, "refreshUniformsPhong"); - function refreshUniformsToon(uniforms, material) { - if (material.gradientMap) { - uniforms.gradientMap.value = material.gradientMap; - } - } - __name(refreshUniformsToon, "refreshUniformsToon"); - function refreshUniformsStandard(uniforms, material) { - uniforms.metalness.value = material.metalness; - if (material.metalnessMap) { - uniforms.metalnessMap.value = material.metalnessMap; - refreshTransformUniform(material.metalnessMap, uniforms.metalnessMapTransform); - } - uniforms.roughness.value = material.roughness; - if (material.roughnessMap) { - uniforms.roughnessMap.value = material.roughnessMap; - refreshTransformUniform(material.roughnessMap, uniforms.roughnessMapTransform); - } - if (material.envMap) { - uniforms.envMapIntensity.value = material.envMapIntensity; - } - } - __name(refreshUniformsStandard, "refreshUniformsStandard"); - function refreshUniformsPhysical(uniforms, material, transmissionRenderTarget) { - uniforms.ior.value = material.ior; - if (material.sheen > 0) { - uniforms.sheenColor.value.copy(material.sheenColor).multiplyScalar(material.sheen); - uniforms.sheenRoughness.value = material.sheenRoughness; - if (material.sheenColorMap) { - uniforms.sheenColorMap.value = material.sheenColorMap; - refreshTransformUniform(material.sheenColorMap, uniforms.sheenColorMapTransform); - } - if (material.sheenRoughnessMap) { - uniforms.sheenRoughnessMap.value = material.sheenRoughnessMap; - refreshTransformUniform(material.sheenRoughnessMap, uniforms.sheenRoughnessMapTransform); - } - } - if (material.clearcoat > 0) { - uniforms.clearcoat.value = material.clearcoat; - uniforms.clearcoatRoughness.value = material.clearcoatRoughness; - if (material.clearcoatMap) { - uniforms.clearcoatMap.value = material.clearcoatMap; - refreshTransformUniform(material.clearcoatMap, uniforms.clearcoatMapTransform); - } - if (material.clearcoatRoughnessMap) { - uniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap; - refreshTransformUniform(material.clearcoatRoughnessMap, uniforms.clearcoatRoughnessMapTransform); - } - if (material.clearcoatNormalMap) { - uniforms.clearcoatNormalMap.value = material.clearcoatNormalMap; - refreshTransformUniform(material.clearcoatNormalMap, uniforms.clearcoatNormalMapTransform); - uniforms.clearcoatNormalScale.value.copy(material.clearcoatNormalScale); - if (material.side === BackSide) { - uniforms.clearcoatNormalScale.value.negate(); - } - } - } - if (material.dispersion > 0) { - uniforms.dispersion.value = material.dispersion; - } - if (material.iridescence > 0) { - uniforms.iridescence.value = material.iridescence; - uniforms.iridescenceIOR.value = material.iridescenceIOR; - uniforms.iridescenceThicknessMinimum.value = material.iridescenceThicknessRange[0]; - uniforms.iridescenceThicknessMaximum.value = material.iridescenceThicknessRange[1]; - if (material.iridescenceMap) { - uniforms.iridescenceMap.value = material.iridescenceMap; - refreshTransformUniform(material.iridescenceMap, uniforms.iridescenceMapTransform); - } - if (material.iridescenceThicknessMap) { - uniforms.iridescenceThicknessMap.value = material.iridescenceThicknessMap; - refreshTransformUniform(material.iridescenceThicknessMap, uniforms.iridescenceThicknessMapTransform); - } - } - if (material.transmission > 0) { - uniforms.transmission.value = material.transmission; - uniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture; - uniforms.transmissionSamplerSize.value.set(transmissionRenderTarget.width, transmissionRenderTarget.height); - if (material.transmissionMap) { - uniforms.transmissionMap.value = material.transmissionMap; - refreshTransformUniform(material.transmissionMap, uniforms.transmissionMapTransform); - } - uniforms.thickness.value = material.thickness; - if (material.thicknessMap) { - uniforms.thicknessMap.value = material.thicknessMap; - refreshTransformUniform(material.thicknessMap, uniforms.thicknessMapTransform); - } - uniforms.attenuationDistance.value = material.attenuationDistance; - uniforms.attenuationColor.value.copy(material.attenuationColor); - } - if (material.anisotropy > 0) { - uniforms.anisotropyVector.value.set(material.anisotropy * Math.cos(material.anisotropyRotation), material.anisotropy * Math.sin(material.anisotropyRotation)); - if (material.anisotropyMap) { - uniforms.anisotropyMap.value = material.anisotropyMap; - refreshTransformUniform(material.anisotropyMap, uniforms.anisotropyMapTransform); - } - } - uniforms.specularIntensity.value = material.specularIntensity; - uniforms.specularColor.value.copy(material.specularColor); - if (material.specularColorMap) { - uniforms.specularColorMap.value = material.specularColorMap; - refreshTransformUniform(material.specularColorMap, uniforms.specularColorMapTransform); - } - if (material.specularIntensityMap) { - uniforms.specularIntensityMap.value = material.specularIntensityMap; - refreshTransformUniform(material.specularIntensityMap, uniforms.specularIntensityMapTransform); - } - } - __name(refreshUniformsPhysical, "refreshUniformsPhysical"); - function refreshUniformsMatcap(uniforms, material) { - if (material.matcap) { - uniforms.matcap.value = material.matcap; - } - } - __name(refreshUniformsMatcap, "refreshUniformsMatcap"); - function refreshUniformsDistance(uniforms, material) { - const light = properties.get(material).light; - uniforms.referencePosition.value.setFromMatrixPosition(light.matrixWorld); - uniforms.nearDistance.value = light.shadow.camera.near; - uniforms.farDistance.value = light.shadow.camera.far; - } - __name(refreshUniformsDistance, "refreshUniformsDistance"); - return { - refreshFogUniforms, - refreshMaterialUniforms - }; -} -__name(WebGLMaterials, "WebGLMaterials"); -function WebGLUniformsGroups(gl, info, capabilities, state) { - let buffers = {}; - let updateList = {}; - let allocatedBindingPoints = []; - const maxBindingPoints = gl.getParameter(gl.MAX_UNIFORM_BUFFER_BINDINGS); - function bind(uniformsGroup, program) { - const webglProgram = program.program; - state.uniformBlockBinding(uniformsGroup, webglProgram); - } - __name(bind, "bind"); - function update(uniformsGroup, program) { - let buffer = buffers[uniformsGroup.id]; - if (buffer === void 0) { - prepareUniformsGroup(uniformsGroup); - buffer = createBuffer(uniformsGroup); - buffers[uniformsGroup.id] = buffer; - uniformsGroup.addEventListener("dispose", onUniformsGroupsDispose); - } - const webglProgram = program.program; - state.updateUBOMapping(uniformsGroup, webglProgram); - const frame = info.render.frame; - if (updateList[uniformsGroup.id] !== frame) { - updateBufferData(uniformsGroup); - updateList[uniformsGroup.id] = frame; - } - } - __name(update, "update"); - function createBuffer(uniformsGroup) { - const bindingPointIndex = allocateBindingPointIndex(); - uniformsGroup.__bindingPointIndex = bindingPointIndex; - const buffer = gl.createBuffer(); - const size = uniformsGroup.__size; - const usage = uniformsGroup.usage; - gl.bindBuffer(gl.UNIFORM_BUFFER, buffer); - gl.bufferData(gl.UNIFORM_BUFFER, size, usage); - gl.bindBuffer(gl.UNIFORM_BUFFER, null); - gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPointIndex, buffer); - return buffer; - } - __name(createBuffer, "createBuffer"); - function allocateBindingPointIndex() { - for (let i = 0; i < maxBindingPoints; i++) { - if (allocatedBindingPoints.indexOf(i) === -1) { - allocatedBindingPoints.push(i); - return i; - } - } - console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."); - return 0; - } - __name(allocateBindingPointIndex, "allocateBindingPointIndex"); - function updateBufferData(uniformsGroup) { - const buffer = buffers[uniformsGroup.id]; - const uniforms = uniformsGroup.uniforms; - const cache = uniformsGroup.__cache; - gl.bindBuffer(gl.UNIFORM_BUFFER, buffer); - for (let i = 0, il = uniforms.length; i < il; i++) { - const uniformArray = Array.isArray(uniforms[i]) ? uniforms[i] : [uniforms[i]]; - for (let j = 0, jl = uniformArray.length; j < jl; j++) { - const uniform = uniformArray[j]; - if (hasUniformChanged(uniform, i, j, cache) === true) { - const offset = uniform.__offset; - const values = Array.isArray(uniform.value) ? uniform.value : [uniform.value]; - let arrayOffset = 0; - for (let k = 0; k < values.length; k++) { - const value = values[k]; - const info2 = getUniformSize(value); - if (typeof value === "number" || typeof value === "boolean") { - uniform.__data[0] = value; - gl.bufferSubData(gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data); - } else if (value.isMatrix3) { - uniform.__data[0] = value.elements[0]; - uniform.__data[1] = value.elements[1]; - uniform.__data[2] = value.elements[2]; - uniform.__data[3] = 0; - uniform.__data[4] = value.elements[3]; - uniform.__data[5] = value.elements[4]; - uniform.__data[6] = value.elements[5]; - uniform.__data[7] = 0; - uniform.__data[8] = value.elements[6]; - uniform.__data[9] = value.elements[7]; - uniform.__data[10] = value.elements[8]; - uniform.__data[11] = 0; - } else { - value.toArray(uniform.__data, arrayOffset); - arrayOffset += info2.storage / Float32Array.BYTES_PER_ELEMENT; - } - } - gl.bufferSubData(gl.UNIFORM_BUFFER, offset, uniform.__data); - } - } - } - gl.bindBuffer(gl.UNIFORM_BUFFER, null); - } - __name(updateBufferData, "updateBufferData"); - function hasUniformChanged(uniform, index, indexArray, cache) { - const value = uniform.value; - const indexString = index + "_" + indexArray; - if (cache[indexString] === void 0) { - if (typeof value === "number" || typeof value === "boolean") { - cache[indexString] = value; - } else { - cache[indexString] = value.clone(); - } - return true; - } else { - const cachedObject = cache[indexString]; - if (typeof value === "number" || typeof value === "boolean") { - if (cachedObject !== value) { - cache[indexString] = value; - return true; - } - } else { - if (cachedObject.equals(value) === false) { - cachedObject.copy(value); - return true; - } - } - } - return false; - } - __name(hasUniformChanged, "hasUniformChanged"); - function prepareUniformsGroup(uniformsGroup) { - const uniforms = uniformsGroup.uniforms; - let offset = 0; - const chunkSize = 16; - for (let i = 0, l = uniforms.length; i < l; i++) { - const uniformArray = Array.isArray(uniforms[i]) ? uniforms[i] : [uniforms[i]]; - for (let j = 0, jl = uniformArray.length; j < jl; j++) { - const uniform = uniformArray[j]; - const values = Array.isArray(uniform.value) ? uniform.value : [uniform.value]; - for (let k = 0, kl = values.length; k < kl; k++) { - const value = values[k]; - const info2 = getUniformSize(value); - const chunkOffset2 = offset % chunkSize; - const chunkPadding = chunkOffset2 % info2.boundary; - const chunkStart = chunkOffset2 + chunkPadding; - offset += chunkPadding; - if (chunkStart !== 0 && chunkSize - chunkStart < info2.storage) { - offset += chunkSize - chunkStart; - } - uniform.__data = new Float32Array(info2.storage / Float32Array.BYTES_PER_ELEMENT); - uniform.__offset = offset; - offset += info2.storage; - } - } - } - const chunkOffset = offset % chunkSize; - if (chunkOffset > 0) offset += chunkSize - chunkOffset; - uniformsGroup.__size = offset; - uniformsGroup.__cache = {}; - return this; - } - __name(prepareUniformsGroup, "prepareUniformsGroup"); - function getUniformSize(value) { - const info2 = { - boundary: 0, - // bytes - storage: 0 - // bytes - }; - if (typeof value === "number" || typeof value === "boolean") { - info2.boundary = 4; - info2.storage = 4; - } else if (value.isVector2) { - info2.boundary = 8; - info2.storage = 8; - } else if (value.isVector3 || value.isColor) { - info2.boundary = 16; - info2.storage = 12; - } else if (value.isVector4) { - info2.boundary = 16; - info2.storage = 16; - } else if (value.isMatrix3) { - info2.boundary = 48; - info2.storage = 48; - } else if (value.isMatrix4) { - info2.boundary = 64; - info2.storage = 64; - } else if (value.isTexture) { - console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."); - } else { - console.warn("THREE.WebGLRenderer: Unsupported uniform value type.", value); - } - return info2; - } - __name(getUniformSize, "getUniformSize"); - function onUniformsGroupsDispose(event) { - const uniformsGroup = event.target; - uniformsGroup.removeEventListener("dispose", onUniformsGroupsDispose); - const index = allocatedBindingPoints.indexOf(uniformsGroup.__bindingPointIndex); - allocatedBindingPoints.splice(index, 1); - gl.deleteBuffer(buffers[uniformsGroup.id]); - delete buffers[uniformsGroup.id]; - delete updateList[uniformsGroup.id]; - } - __name(onUniformsGroupsDispose, "onUniformsGroupsDispose"); - function dispose() { - for (const id2 in buffers) { - gl.deleteBuffer(buffers[id2]); - } - allocatedBindingPoints = []; - buffers = {}; - updateList = {}; - } - __name(dispose, "dispose"); - return { - bind, - update, - dispose - }; -} -__name(WebGLUniformsGroups, "WebGLUniformsGroups"); -class WebGLRenderer { - static { - __name(this, "WebGLRenderer"); - } - constructor(parameters = {}) { - const { - canvas = createCanvasElement(), - context = null, - depth = true, - stencil = false, - alpha = false, - antialias = false, - premultipliedAlpha = true, - preserveDrawingBuffer = false, - powerPreference = "default", - failIfMajorPerformanceCaveat = false, - reverseDepthBuffer = false - } = parameters; - this.isWebGLRenderer = true; - let _alpha; - if (context !== null) { - if (typeof WebGLRenderingContext !== "undefined" && context instanceof WebGLRenderingContext) { - throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163."); - } - _alpha = context.getContextAttributes().alpha; - } else { - _alpha = alpha; - } - const uintClearColor = new Uint32Array(4); - const intClearColor = new Int32Array(4); - let currentRenderList = null; - let currentRenderState = null; - const renderListStack = []; - const renderStateStack = []; - this.domElement = canvas; - this.debug = { - /** - * Enables error checking and reporting when shader programs are being compiled - * @type {boolean} - */ - checkShaderErrors: true, - /** - * Callback for custom error reporting. - * @type {?Function} - */ - onShaderError: null - }; - this.autoClear = true; - this.autoClearColor = true; - this.autoClearDepth = true; - this.autoClearStencil = true; - this.sortObjects = true; - this.clippingPlanes = []; - this.localClippingEnabled = false; - this._outputColorSpace = SRGBColorSpace; - this.toneMapping = NoToneMapping; - this.toneMappingExposure = 1; - const _this = this; - let _isContextLost = false; - let _currentActiveCubeFace = 0; - let _currentActiveMipmapLevel = 0; - let _currentRenderTarget = null; - let _currentMaterialId = -1; - let _currentCamera = null; - const _currentViewport = new Vector4(); - const _currentScissor = new Vector4(); - let _currentScissorTest = null; - const _currentClearColor = new Color(0); - let _currentClearAlpha = 0; - let _width = canvas.width; - let _height = canvas.height; - let _pixelRatio = 1; - let _opaqueSort = null; - let _transparentSort = null; - const _viewport = new Vector4(0, 0, _width, _height); - const _scissor = new Vector4(0, 0, _width, _height); - let _scissorTest = false; - const _frustum2 = new Frustum(); - let _clippingEnabled = false; - let _localClippingEnabled = false; - const _currentProjectionMatrix = new Matrix4(); - const _projScreenMatrix2 = new Matrix4(); - const _vector32 = new Vector3(); - const _vector4 = new Vector4(); - const _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true }; - let _renderBackground = false; - function getTargetPixelRatio() { - return _currentRenderTarget === null ? _pixelRatio : 1; - } - __name(getTargetPixelRatio, "getTargetPixelRatio"); - let _gl = context; - function getContext(contextName, contextAttributes) { - return canvas.getContext(contextName, contextAttributes); - } - __name(getContext, "getContext"); - try { - const contextAttributes = { - alpha: true, - depth, - stencil, - antialias, - premultipliedAlpha, - preserveDrawingBuffer, - powerPreference, - failIfMajorPerformanceCaveat - }; - if ("setAttribute" in canvas) canvas.setAttribute("data-engine", `three.js r${REVISION}`); - canvas.addEventListener("webglcontextlost", onContextLost, false); - canvas.addEventListener("webglcontextrestored", onContextRestore, false); - canvas.addEventListener("webglcontextcreationerror", onContextCreationError, false); - if (_gl === null) { - const contextName = "webgl2"; - _gl = getContext(contextName, contextAttributes); - if (_gl === null) { - if (getContext(contextName)) { - throw new Error("Error creating WebGL context with your selected attributes."); - } else { - throw new Error("Error creating WebGL context."); - } - } - } - } catch (error) { - console.error("THREE.WebGLRenderer: " + error.message); - throw error; - } - let extensions, capabilities, state, info; - let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects; - let programCache, materials, renderLists, renderStates, clipping, shadowMap; - let background, morphtargets, bufferRenderer, indexedBufferRenderer; - let utils, bindingStates, uniformsGroups; - function initGLContext() { - extensions = new WebGLExtensions(_gl); - extensions.init(); - utils = new WebGLUtils(_gl, extensions); - capabilities = new WebGLCapabilities(_gl, extensions, parameters, utils); - state = new WebGLState(_gl, extensions); - if (capabilities.reverseDepthBuffer && reverseDepthBuffer) { - state.buffers.depth.setReversed(true); - } - info = new WebGLInfo(_gl); - properties = new WebGLProperties(); - textures = new WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info); - cubemaps = new WebGLCubeMaps(_this); - cubeuvmaps = new WebGLCubeUVMaps(_this); - attributes = new WebGLAttributes(_gl); - bindingStates = new WebGLBindingStates(_gl, attributes); - geometries = new WebGLGeometries(_gl, attributes, info, bindingStates); - objects = new WebGLObjects(_gl, geometries, attributes, info); - morphtargets = new WebGLMorphtargets(_gl, capabilities, textures); - clipping = new WebGLClipping(properties); - programCache = new WebGLPrograms(_this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping); - materials = new WebGLMaterials(_this, properties); - renderLists = new WebGLRenderLists(); - renderStates = new WebGLRenderStates(extensions); - background = new WebGLBackground(_this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha); - shadowMap = new WebGLShadowMap(_this, objects, capabilities); - uniformsGroups = new WebGLUniformsGroups(_gl, info, capabilities, state); - bufferRenderer = new WebGLBufferRenderer(_gl, extensions, info); - indexedBufferRenderer = new WebGLIndexedBufferRenderer(_gl, extensions, info); - info.programs = programCache.programs; - _this.capabilities = capabilities; - _this.extensions = extensions; - _this.properties = properties; - _this.renderLists = renderLists; - _this.shadowMap = shadowMap; - _this.state = state; - _this.info = info; - } - __name(initGLContext, "initGLContext"); - initGLContext(); - const xr = new WebXRManager(_this, _gl); - this.xr = xr; - this.getContext = function() { - return _gl; - }; - this.getContextAttributes = function() { - return _gl.getContextAttributes(); - }; - this.forceContextLoss = function() { - const extension = extensions.get("WEBGL_lose_context"); - if (extension) extension.loseContext(); - }; - this.forceContextRestore = function() { - const extension = extensions.get("WEBGL_lose_context"); - if (extension) extension.restoreContext(); - }; - this.getPixelRatio = function() { - return _pixelRatio; - }; - this.setPixelRatio = function(value) { - if (value === void 0) return; - _pixelRatio = value; - this.setSize(_width, _height, false); - }; - this.getSize = function(target) { - return target.set(_width, _height); - }; - this.setSize = function(width, height, updateStyle = true) { - if (xr.isPresenting) { - console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."); - return; - } - _width = width; - _height = height; - canvas.width = Math.floor(width * _pixelRatio); - canvas.height = Math.floor(height * _pixelRatio); - if (updateStyle === true) { - canvas.style.width = width + "px"; - canvas.style.height = height + "px"; - } - this.setViewport(0, 0, width, height); - }; - this.getDrawingBufferSize = function(target) { - return target.set(_width * _pixelRatio, _height * _pixelRatio).floor(); - }; - this.setDrawingBufferSize = function(width, height, pixelRatio) { - _width = width; - _height = height; - _pixelRatio = pixelRatio; - canvas.width = Math.floor(width * pixelRatio); - canvas.height = Math.floor(height * pixelRatio); - this.setViewport(0, 0, width, height); - }; - this.getCurrentViewport = function(target) { - return target.copy(_currentViewport); - }; - this.getViewport = function(target) { - return target.copy(_viewport); - }; - this.setViewport = function(x, y, width, height) { - if (x.isVector4) { - _viewport.set(x.x, x.y, x.z, x.w); - } else { - _viewport.set(x, y, width, height); - } - state.viewport(_currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).round()); - }; - this.getScissor = function(target) { - return target.copy(_scissor); - }; - this.setScissor = function(x, y, width, height) { - if (x.isVector4) { - _scissor.set(x.x, x.y, x.z, x.w); - } else { - _scissor.set(x, y, width, height); - } - state.scissor(_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).round()); - }; - this.getScissorTest = function() { - return _scissorTest; - }; - this.setScissorTest = function(boolean) { - state.setScissorTest(_scissorTest = boolean); - }; - this.setOpaqueSort = function(method) { - _opaqueSort = method; - }; - this.setTransparentSort = function(method) { - _transparentSort = method; - }; - this.getClearColor = function(target) { - return target.copy(background.getClearColor()); - }; - this.setClearColor = function() { - background.setClearColor.apply(background, arguments); - }; - this.getClearAlpha = function() { - return background.getClearAlpha(); - }; - this.setClearAlpha = function() { - background.setClearAlpha.apply(background, arguments); - }; - this.clear = function(color = true, depth2 = true, stencil2 = true) { - let bits2 = 0; - if (color) { - let isIntegerFormat = false; - if (_currentRenderTarget !== null) { - const targetFormat = _currentRenderTarget.texture.format; - isIntegerFormat = targetFormat === RGBAIntegerFormat || targetFormat === RGIntegerFormat || targetFormat === RedIntegerFormat; - } - if (isIntegerFormat) { - const targetType = _currentRenderTarget.texture.type; - const isUnsignedType = targetType === UnsignedByteType || targetType === UnsignedIntType || targetType === UnsignedShortType || targetType === UnsignedInt248Type || targetType === UnsignedShort4444Type || targetType === UnsignedShort5551Type; - const clearColor = background.getClearColor(); - const a = background.getClearAlpha(); - const r = clearColor.r; - const g = clearColor.g; - const b = clearColor.b; - if (isUnsignedType) { - uintClearColor[0] = r; - uintClearColor[1] = g; - uintClearColor[2] = b; - uintClearColor[3] = a; - _gl.clearBufferuiv(_gl.COLOR, 0, uintClearColor); - } else { - intClearColor[0] = r; - intClearColor[1] = g; - intClearColor[2] = b; - intClearColor[3] = a; - _gl.clearBufferiv(_gl.COLOR, 0, intClearColor); - } - } else { - bits2 |= _gl.COLOR_BUFFER_BIT; - } - } - if (depth2) { - bits2 |= _gl.DEPTH_BUFFER_BIT; - } - if (stencil2) { - bits2 |= _gl.STENCIL_BUFFER_BIT; - this.state.buffers.stencil.setMask(4294967295); - } - _gl.clear(bits2); - }; - this.clearColor = function() { - this.clear(true, false, false); - }; - this.clearDepth = function() { - this.clear(false, true, false); - }; - this.clearStencil = function() { - this.clear(false, false, true); - }; - this.dispose = function() { - canvas.removeEventListener("webglcontextlost", onContextLost, false); - canvas.removeEventListener("webglcontextrestored", onContextRestore, false); - canvas.removeEventListener("webglcontextcreationerror", onContextCreationError, false); - renderLists.dispose(); - renderStates.dispose(); - properties.dispose(); - cubemaps.dispose(); - cubeuvmaps.dispose(); - objects.dispose(); - bindingStates.dispose(); - uniformsGroups.dispose(); - programCache.dispose(); - xr.dispose(); - xr.removeEventListener("sessionstart", onXRSessionStart); - xr.removeEventListener("sessionend", onXRSessionEnd); - animation.stop(); - }; - function onContextLost(event) { - event.preventDefault(); - console.log("THREE.WebGLRenderer: Context Lost."); - _isContextLost = true; - } - __name(onContextLost, "onContextLost"); - function onContextRestore() { - console.log("THREE.WebGLRenderer: Context Restored."); - _isContextLost = false; - const infoAutoReset = info.autoReset; - const shadowMapEnabled = shadowMap.enabled; - const shadowMapAutoUpdate = shadowMap.autoUpdate; - const shadowMapNeedsUpdate = shadowMap.needsUpdate; - const shadowMapType = shadowMap.type; - initGLContext(); - info.autoReset = infoAutoReset; - shadowMap.enabled = shadowMapEnabled; - shadowMap.autoUpdate = shadowMapAutoUpdate; - shadowMap.needsUpdate = shadowMapNeedsUpdate; - shadowMap.type = shadowMapType; - } - __name(onContextRestore, "onContextRestore"); - function onContextCreationError(event) { - console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ", event.statusMessage); - } - __name(onContextCreationError, "onContextCreationError"); - function onMaterialDispose(event) { - const material = event.target; - material.removeEventListener("dispose", onMaterialDispose); - deallocateMaterial(material); - } - __name(onMaterialDispose, "onMaterialDispose"); - function deallocateMaterial(material) { - releaseMaterialProgramReferences(material); - properties.remove(material); - } - __name(deallocateMaterial, "deallocateMaterial"); - function releaseMaterialProgramReferences(material) { - const programs = properties.get(material).programs; - if (programs !== void 0) { - programs.forEach(function(program) { - programCache.releaseProgram(program); - }); - if (material.isShaderMaterial) { - programCache.releaseShaderCache(material); - } - } - } - __name(releaseMaterialProgramReferences, "releaseMaterialProgramReferences"); - this.renderBufferDirect = function(camera, scene, geometry, material, object, group) { - if (scene === null) scene = _emptyScene; - const frontFaceCW = object.isMesh && object.matrixWorld.determinant() < 0; - const program = setProgram(camera, scene, geometry, material, object); - state.setMaterial(material, frontFaceCW); - let index = geometry.index; - let rangeFactor = 1; - if (material.wireframe === true) { - index = geometries.getWireframeAttribute(geometry); - if (index === void 0) return; - rangeFactor = 2; - } - const drawRange = geometry.drawRange; - const position = geometry.attributes.position; - let drawStart = drawRange.start * rangeFactor; - let drawEnd = (drawRange.start + drawRange.count) * rangeFactor; - if (group !== null) { - drawStart = Math.max(drawStart, group.start * rangeFactor); - drawEnd = Math.min(drawEnd, (group.start + group.count) * rangeFactor); - } - if (index !== null) { - drawStart = Math.max(drawStart, 0); - drawEnd = Math.min(drawEnd, index.count); - } else if (position !== void 0 && position !== null) { - drawStart = Math.max(drawStart, 0); - drawEnd = Math.min(drawEnd, position.count); - } - const drawCount = drawEnd - drawStart; - if (drawCount < 0 || drawCount === Infinity) return; - bindingStates.setup(object, material, program, geometry, index); - let attribute; - let renderer = bufferRenderer; - if (index !== null) { - attribute = attributes.get(index); - renderer = indexedBufferRenderer; - renderer.setIndex(attribute); - } - if (object.isMesh) { - if (material.wireframe === true) { - state.setLineWidth(material.wireframeLinewidth * getTargetPixelRatio()); - renderer.setMode(_gl.LINES); - } else { - renderer.setMode(_gl.TRIANGLES); - } - } else if (object.isLine) { - let lineWidth = material.linewidth; - if (lineWidth === void 0) lineWidth = 1; - state.setLineWidth(lineWidth * getTargetPixelRatio()); - if (object.isLineSegments) { - renderer.setMode(_gl.LINES); - } else if (object.isLineLoop) { - renderer.setMode(_gl.LINE_LOOP); - } else { - renderer.setMode(_gl.LINE_STRIP); - } - } else if (object.isPoints) { - renderer.setMode(_gl.POINTS); - } else if (object.isSprite) { - renderer.setMode(_gl.TRIANGLES); - } - if (object.isBatchedMesh) { - if (object._multiDrawInstances !== null) { - renderer.renderMultiDrawInstances(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances); - } else { - if (!extensions.get("WEBGL_multi_draw")) { - const starts = object._multiDrawStarts; - const counts = object._multiDrawCounts; - const drawCount2 = object._multiDrawCount; - const bytesPerElement = index ? attributes.get(index).bytesPerElement : 1; - const uniforms = properties.get(material).currentProgram.getUniforms(); - for (let i = 0; i < drawCount2; i++) { - uniforms.setValue(_gl, "_gl_DrawID", i); - renderer.render(starts[i] / bytesPerElement, counts[i]); - } - } else { - renderer.renderMultiDraw(object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount); - } - } - } else if (object.isInstancedMesh) { - renderer.renderInstances(drawStart, drawCount, object.count); - } else if (geometry.isInstancedBufferGeometry) { - const maxInstanceCount = geometry._maxInstanceCount !== void 0 ? geometry._maxInstanceCount : Infinity; - const instanceCount = Math.min(geometry.instanceCount, maxInstanceCount); - renderer.renderInstances(drawStart, drawCount, instanceCount); - } else { - renderer.render(drawStart, drawCount); - } - }; - function prepareMaterial(material, scene, object) { - if (material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false) { - material.side = BackSide; - material.needsUpdate = true; - getProgram(material, scene, object); - material.side = FrontSide; - material.needsUpdate = true; - getProgram(material, scene, object); - material.side = DoubleSide; - } else { - getProgram(material, scene, object); - } - } - __name(prepareMaterial, "prepareMaterial"); - this.compile = function(scene, camera, targetScene = null) { - if (targetScene === null) targetScene = scene; - currentRenderState = renderStates.get(targetScene); - currentRenderState.init(camera); - renderStateStack.push(currentRenderState); - targetScene.traverseVisible(function(object) { - if (object.isLight && object.layers.test(camera.layers)) { - currentRenderState.pushLight(object); - if (object.castShadow) { - currentRenderState.pushShadow(object); - } - } - }); - if (scene !== targetScene) { - scene.traverseVisible(function(object) { - if (object.isLight && object.layers.test(camera.layers)) { - currentRenderState.pushLight(object); - if (object.castShadow) { - currentRenderState.pushShadow(object); - } - } - }); - } - currentRenderState.setupLights(); - const materials2 = /* @__PURE__ */ new Set(); - scene.traverse(function(object) { - if (!(object.isMesh || object.isPoints || object.isLine || object.isSprite)) { - return; - } - const material = object.material; - if (material) { - if (Array.isArray(material)) { - for (let i = 0; i < material.length; i++) { - const material2 = material[i]; - prepareMaterial(material2, targetScene, object); - materials2.add(material2); - } - } else { - prepareMaterial(material, targetScene, object); - materials2.add(material); - } - } - }); - renderStateStack.pop(); - currentRenderState = null; - return materials2; - }; - this.compileAsync = function(scene, camera, targetScene = null) { - const materials2 = this.compile(scene, camera, targetScene); - return new Promise((resolve) => { - function checkMaterialsReady() { - materials2.forEach(function(material) { - const materialProperties = properties.get(material); - const program = materialProperties.currentProgram; - if (program.isReady()) { - materials2.delete(material); - } - }); - if (materials2.size === 0) { - resolve(scene); - return; - } - setTimeout(checkMaterialsReady, 10); - } - __name(checkMaterialsReady, "checkMaterialsReady"); - if (extensions.get("KHR_parallel_shader_compile") !== null) { - checkMaterialsReady(); - } else { - setTimeout(checkMaterialsReady, 10); - } - }); - }; - let onAnimationFrameCallback = null; - function onAnimationFrame(time) { - if (onAnimationFrameCallback) onAnimationFrameCallback(time); - } - __name(onAnimationFrame, "onAnimationFrame"); - function onXRSessionStart() { - animation.stop(); - } - __name(onXRSessionStart, "onXRSessionStart"); - function onXRSessionEnd() { - animation.start(); - } - __name(onXRSessionEnd, "onXRSessionEnd"); - const animation = new WebGLAnimation(); - animation.setAnimationLoop(onAnimationFrame); - if (typeof self !== "undefined") animation.setContext(self); - this.setAnimationLoop = function(callback) { - onAnimationFrameCallback = callback; - xr.setAnimationLoop(callback); - callback === null ? animation.stop() : animation.start(); - }; - xr.addEventListener("sessionstart", onXRSessionStart); - xr.addEventListener("sessionend", onXRSessionEnd); - this.render = function(scene, camera) { - if (camera !== void 0 && camera.isCamera !== true) { - console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera."); - return; - } - if (_isContextLost === true) return; - if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld(); - if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld(); - if (xr.enabled === true && xr.isPresenting === true) { - if (xr.cameraAutoUpdate === true) xr.updateCamera(camera); - camera = xr.getCamera(); - } - if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget); - currentRenderState = renderStates.get(scene, renderStateStack.length); - currentRenderState.init(camera); - renderStateStack.push(currentRenderState); - _projScreenMatrix2.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); - _frustum2.setFromProjectionMatrix(_projScreenMatrix2); - _localClippingEnabled = this.localClippingEnabled; - _clippingEnabled = clipping.init(this.clippingPlanes, _localClippingEnabled); - currentRenderList = renderLists.get(scene, renderListStack.length); - currentRenderList.init(); - renderListStack.push(currentRenderList); - if (xr.enabled === true && xr.isPresenting === true) { - const depthSensingMesh = _this.xr.getDepthSensingMesh(); - if (depthSensingMesh !== null) { - projectObject(depthSensingMesh, camera, -Infinity, _this.sortObjects); - } - } - projectObject(scene, camera, 0, _this.sortObjects); - currentRenderList.finish(); - if (_this.sortObjects === true) { - currentRenderList.sort(_opaqueSort, _transparentSort); - } - _renderBackground = xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false; - if (_renderBackground) { - background.addToRenderList(currentRenderList, scene); - } - this.info.render.frame++; - if (_clippingEnabled === true) clipping.beginShadows(); - const shadowsArray = currentRenderState.state.shadowsArray; - shadowMap.render(shadowsArray, scene, camera); - if (_clippingEnabled === true) clipping.endShadows(); - if (this.info.autoReset === true) this.info.reset(); - const opaqueObjects = currentRenderList.opaque; - const transmissiveObjects = currentRenderList.transmissive; - currentRenderState.setupLights(); - if (camera.isArrayCamera) { - const cameras = camera.cameras; - if (transmissiveObjects.length > 0) { - for (let i = 0, l = cameras.length; i < l; i++) { - const camera2 = cameras[i]; - renderTransmissionPass(opaqueObjects, transmissiveObjects, scene, camera2); - } - } - if (_renderBackground) background.render(scene); - for (let i = 0, l = cameras.length; i < l; i++) { - const camera2 = cameras[i]; - renderScene(currentRenderList, scene, camera2, camera2.viewport); - } - } else { - if (transmissiveObjects.length > 0) renderTransmissionPass(opaqueObjects, transmissiveObjects, scene, camera); - if (_renderBackground) background.render(scene); - renderScene(currentRenderList, scene, camera); - } - if (_currentRenderTarget !== null) { - textures.updateMultisampleRenderTarget(_currentRenderTarget); - textures.updateRenderTargetMipmap(_currentRenderTarget); - } - if (scene.isScene === true) scene.onAfterRender(_this, scene, camera); - bindingStates.resetDefaultState(); - _currentMaterialId = -1; - _currentCamera = null; - renderStateStack.pop(); - if (renderStateStack.length > 0) { - currentRenderState = renderStateStack[renderStateStack.length - 1]; - if (_clippingEnabled === true) clipping.setGlobalState(_this.clippingPlanes, currentRenderState.state.camera); - } else { - currentRenderState = null; - } - renderListStack.pop(); - if (renderListStack.length > 0) { - currentRenderList = renderListStack[renderListStack.length - 1]; - } else { - currentRenderList = null; - } - }; - function projectObject(object, camera, groupOrder, sortObjects) { - if (object.visible === false) return; - const visible = object.layers.test(camera.layers); - if (visible) { - if (object.isGroup) { - groupOrder = object.renderOrder; - } else if (object.isLOD) { - if (object.autoUpdate === true) object.update(camera); - } else if (object.isLight) { - currentRenderState.pushLight(object); - if (object.castShadow) { - currentRenderState.pushShadow(object); - } - } else if (object.isSprite) { - if (!object.frustumCulled || _frustum2.intersectsSprite(object)) { - if (sortObjects) { - _vector4.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix2); - } - const geometry = objects.update(object); - const material = object.material; - if (material.visible) { - currentRenderList.push(object, geometry, material, groupOrder, _vector4.z, null); - } - } - } else if (object.isMesh || object.isLine || object.isPoints) { - if (!object.frustumCulled || _frustum2.intersectsObject(object)) { - const geometry = objects.update(object); - const material = object.material; - if (sortObjects) { - if (object.boundingSphere !== void 0) { - if (object.boundingSphere === null) object.computeBoundingSphere(); - _vector4.copy(object.boundingSphere.center); - } else { - if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); - _vector4.copy(geometry.boundingSphere.center); - } - _vector4.applyMatrix4(object.matrixWorld).applyMatrix4(_projScreenMatrix2); - } - if (Array.isArray(material)) { - const groups = geometry.groups; - for (let i = 0, l = groups.length; i < l; i++) { - const group = groups[i]; - const groupMaterial = material[group.materialIndex]; - if (groupMaterial && groupMaterial.visible) { - currentRenderList.push(object, geometry, groupMaterial, groupOrder, _vector4.z, group); - } - } - } else if (material.visible) { - currentRenderList.push(object, geometry, material, groupOrder, _vector4.z, null); - } - } - } - } - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { - projectObject(children[i], camera, groupOrder, sortObjects); - } - } - __name(projectObject, "projectObject"); - function renderScene(currentRenderList2, scene, camera, viewport) { - const opaqueObjects = currentRenderList2.opaque; - const transmissiveObjects = currentRenderList2.transmissive; - const transparentObjects = currentRenderList2.transparent; - currentRenderState.setupLightsView(camera); - if (_clippingEnabled === true) clipping.setGlobalState(_this.clippingPlanes, camera); - if (viewport) state.viewport(_currentViewport.copy(viewport)); - if (opaqueObjects.length > 0) renderObjects(opaqueObjects, scene, camera); - if (transmissiveObjects.length > 0) renderObjects(transmissiveObjects, scene, camera); - if (transparentObjects.length > 0) renderObjects(transparentObjects, scene, camera); - state.buffers.depth.setTest(true); - state.buffers.depth.setMask(true); - state.buffers.color.setMask(true); - state.setPolygonOffset(false); - } - __name(renderScene, "renderScene"); - function renderTransmissionPass(opaqueObjects, transmissiveObjects, scene, camera) { - const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null; - if (overrideMaterial !== null) { - return; - } - if (currentRenderState.state.transmissionRenderTarget[camera.id] === void 0) { - currentRenderState.state.transmissionRenderTarget[camera.id] = new WebGLRenderTarget(1, 1, { - generateMipmaps: true, - type: extensions.has("EXT_color_buffer_half_float") || extensions.has("EXT_color_buffer_float") ? HalfFloatType : UnsignedByteType, - minFilter: LinearMipmapLinearFilter, - samples: 4, - stencilBuffer: stencil, - resolveDepthBuffer: false, - resolveStencilBuffer: false, - colorSpace: ColorManagement.workingColorSpace - }); - } - const transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget[camera.id]; - const activeViewport = camera.viewport || _currentViewport; - transmissionRenderTarget.setSize(activeViewport.z, activeViewport.w); - const currentRenderTarget = _this.getRenderTarget(); - _this.setRenderTarget(transmissionRenderTarget); - _this.getClearColor(_currentClearColor); - _currentClearAlpha = _this.getClearAlpha(); - if (_currentClearAlpha < 1) _this.setClearColor(16777215, 0.5); - _this.clear(); - if (_renderBackground) background.render(scene); - const currentToneMapping = _this.toneMapping; - _this.toneMapping = NoToneMapping; - const currentCameraViewport = camera.viewport; - if (camera.viewport !== void 0) camera.viewport = void 0; - currentRenderState.setupLightsView(camera); - if (_clippingEnabled === true) clipping.setGlobalState(_this.clippingPlanes, camera); - renderObjects(opaqueObjects, scene, camera); - textures.updateMultisampleRenderTarget(transmissionRenderTarget); - textures.updateRenderTargetMipmap(transmissionRenderTarget); - if (extensions.has("WEBGL_multisampled_render_to_texture") === false) { - let renderTargetNeedsUpdate = false; - for (let i = 0, l = transmissiveObjects.length; i < l; i++) { - const renderItem = transmissiveObjects[i]; - const object = renderItem.object; - const geometry = renderItem.geometry; - const material = renderItem.material; - const group = renderItem.group; - if (material.side === DoubleSide && object.layers.test(camera.layers)) { - const currentSide = material.side; - material.side = BackSide; - material.needsUpdate = true; - renderObject(object, scene, camera, geometry, material, group); - material.side = currentSide; - material.needsUpdate = true; - renderTargetNeedsUpdate = true; - } - } - if (renderTargetNeedsUpdate === true) { - textures.updateMultisampleRenderTarget(transmissionRenderTarget); - textures.updateRenderTargetMipmap(transmissionRenderTarget); - } - } - _this.setRenderTarget(currentRenderTarget); - _this.setClearColor(_currentClearColor, _currentClearAlpha); - if (currentCameraViewport !== void 0) camera.viewport = currentCameraViewport; - _this.toneMapping = currentToneMapping; - } - __name(renderTransmissionPass, "renderTransmissionPass"); - function renderObjects(renderList, scene, camera) { - const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null; - for (let i = 0, l = renderList.length; i < l; i++) { - const renderItem = renderList[i]; - const object = renderItem.object; - const geometry = renderItem.geometry; - const material = overrideMaterial === null ? renderItem.material : overrideMaterial; - const group = renderItem.group; - if (object.layers.test(camera.layers)) { - renderObject(object, scene, camera, geometry, material, group); - } - } - } - __name(renderObjects, "renderObjects"); - function renderObject(object, scene, camera, geometry, material, group) { - object.onBeforeRender(_this, scene, camera, geometry, material, group); - object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, object.matrixWorld); - object.normalMatrix.getNormalMatrix(object.modelViewMatrix); - material.onBeforeRender(_this, scene, camera, geometry, object, group); - if (material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false) { - material.side = BackSide; - material.needsUpdate = true; - _this.renderBufferDirect(camera, scene, geometry, material, object, group); - material.side = FrontSide; - material.needsUpdate = true; - _this.renderBufferDirect(camera, scene, geometry, material, object, group); - material.side = DoubleSide; - } else { - _this.renderBufferDirect(camera, scene, geometry, material, object, group); - } - object.onAfterRender(_this, scene, camera, geometry, material, group); - } - __name(renderObject, "renderObject"); - function getProgram(material, scene, object) { - if (scene.isScene !== true) scene = _emptyScene; - const materialProperties = properties.get(material); - const lights = currentRenderState.state.lights; - const shadowsArray = currentRenderState.state.shadowsArray; - const lightsStateVersion = lights.state.version; - const parameters2 = programCache.getParameters(material, lights.state, shadowsArray, scene, object); - const programCacheKey = programCache.getProgramCacheKey(parameters2); - let programs = materialProperties.programs; - materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null; - materialProperties.fog = scene.fog; - materialProperties.envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || materialProperties.environment); - materialProperties.envMapRotation = materialProperties.environment !== null && material.envMap === null ? scene.environmentRotation : material.envMapRotation; - if (programs === void 0) { - material.addEventListener("dispose", onMaterialDispose); - programs = /* @__PURE__ */ new Map(); - materialProperties.programs = programs; - } - let program = programs.get(programCacheKey); - if (program !== void 0) { - if (materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion) { - updateCommonMaterialProperties(material, parameters2); - return program; - } - } else { - parameters2.uniforms = programCache.getUniforms(material); - material.onBeforeCompile(parameters2, _this); - program = programCache.acquireProgram(parameters2, programCacheKey); - programs.set(programCacheKey, program); - materialProperties.uniforms = parameters2.uniforms; - } - const uniforms = materialProperties.uniforms; - if (!material.isShaderMaterial && !material.isRawShaderMaterial || material.clipping === true) { - uniforms.clippingPlanes = clipping.uniform; - } - updateCommonMaterialProperties(material, parameters2); - materialProperties.needsLights = materialNeedsLights(material); - materialProperties.lightsStateVersion = lightsStateVersion; - if (materialProperties.needsLights) { - uniforms.ambientLightColor.value = lights.state.ambient; - uniforms.lightProbe.value = lights.state.probe; - uniforms.directionalLights.value = lights.state.directional; - uniforms.directionalLightShadows.value = lights.state.directionalShadow; - uniforms.spotLights.value = lights.state.spot; - uniforms.spotLightShadows.value = lights.state.spotShadow; - uniforms.rectAreaLights.value = lights.state.rectArea; - uniforms.ltc_1.value = lights.state.rectAreaLTC1; - uniforms.ltc_2.value = lights.state.rectAreaLTC2; - uniforms.pointLights.value = lights.state.point; - uniforms.pointLightShadows.value = lights.state.pointShadow; - uniforms.hemisphereLights.value = lights.state.hemi; - uniforms.directionalShadowMap.value = lights.state.directionalShadowMap; - uniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix; - uniforms.spotShadowMap.value = lights.state.spotShadowMap; - uniforms.spotLightMatrix.value = lights.state.spotLightMatrix; - uniforms.spotLightMap.value = lights.state.spotLightMap; - uniforms.pointShadowMap.value = lights.state.pointShadowMap; - uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix; - } - materialProperties.currentProgram = program; - materialProperties.uniformsList = null; - return program; - } - __name(getProgram, "getProgram"); - function getUniformList(materialProperties) { - if (materialProperties.uniformsList === null) { - const progUniforms = materialProperties.currentProgram.getUniforms(); - materialProperties.uniformsList = WebGLUniforms.seqWithValue(progUniforms.seq, materialProperties.uniforms); - } - return materialProperties.uniformsList; - } - __name(getUniformList, "getUniformList"); - function updateCommonMaterialProperties(material, parameters2) { - const materialProperties = properties.get(material); - materialProperties.outputColorSpace = parameters2.outputColorSpace; - materialProperties.batching = parameters2.batching; - materialProperties.batchingColor = parameters2.batchingColor; - materialProperties.instancing = parameters2.instancing; - materialProperties.instancingColor = parameters2.instancingColor; - materialProperties.instancingMorph = parameters2.instancingMorph; - materialProperties.skinning = parameters2.skinning; - materialProperties.morphTargets = parameters2.morphTargets; - materialProperties.morphNormals = parameters2.morphNormals; - materialProperties.morphColors = parameters2.morphColors; - materialProperties.morphTargetsCount = parameters2.morphTargetsCount; - materialProperties.numClippingPlanes = parameters2.numClippingPlanes; - materialProperties.numIntersection = parameters2.numClipIntersection; - materialProperties.vertexAlphas = parameters2.vertexAlphas; - materialProperties.vertexTangents = parameters2.vertexTangents; - materialProperties.toneMapping = parameters2.toneMapping; - } - __name(updateCommonMaterialProperties, "updateCommonMaterialProperties"); - function setProgram(camera, scene, geometry, material, object) { - if (scene.isScene !== true) scene = _emptyScene; - textures.resetTextureUnits(); - const fog = scene.fog; - const environment = material.isMeshStandardMaterial ? scene.environment : null; - const colorSpace = _currentRenderTarget === null ? _this.outputColorSpace : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace; - const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment); - const vertexAlphas = material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4; - const vertexTangents = !!geometry.attributes.tangent && (!!material.normalMap || material.anisotropy > 0); - const morphTargets = !!geometry.morphAttributes.position; - const morphNormals = !!geometry.morphAttributes.normal; - const morphColors = !!geometry.morphAttributes.color; - let toneMapping = NoToneMapping; - if (material.toneMapped) { - if (_currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true) { - toneMapping = _this.toneMapping; - } - } - const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color; - const morphTargetsCount = morphAttribute !== void 0 ? morphAttribute.length : 0; - const materialProperties = properties.get(material); - const lights = currentRenderState.state.lights; - if (_clippingEnabled === true) { - if (_localClippingEnabled === true || camera !== _currentCamera) { - const useCache = camera === _currentCamera && material.id === _currentMaterialId; - clipping.setState(material, camera, useCache); - } - } - let needsProgramChange = false; - if (material.version === materialProperties.__version) { - if (materialProperties.needsLights && materialProperties.lightsStateVersion !== lights.state.version) { - needsProgramChange = true; - } else if (materialProperties.outputColorSpace !== colorSpace) { - needsProgramChange = true; - } else if (object.isBatchedMesh && materialProperties.batching === false) { - needsProgramChange = true; - } else if (!object.isBatchedMesh && materialProperties.batching === true) { - needsProgramChange = true; - } else if (object.isBatchedMesh && materialProperties.batchingColor === true && object.colorTexture === null) { - needsProgramChange = true; - } else if (object.isBatchedMesh && materialProperties.batchingColor === false && object.colorTexture !== null) { - needsProgramChange = true; - } else if (object.isInstancedMesh && materialProperties.instancing === false) { - needsProgramChange = true; - } else if (!object.isInstancedMesh && materialProperties.instancing === true) { - needsProgramChange = true; - } else if (object.isSkinnedMesh && materialProperties.skinning === false) { - needsProgramChange = true; - } else if (!object.isSkinnedMesh && materialProperties.skinning === true) { - needsProgramChange = true; - } else if (object.isInstancedMesh && materialProperties.instancingColor === true && object.instanceColor === null) { - needsProgramChange = true; - } else if (object.isInstancedMesh && materialProperties.instancingColor === false && object.instanceColor !== null) { - needsProgramChange = true; - } else if (object.isInstancedMesh && materialProperties.instancingMorph === true && object.morphTexture === null) { - needsProgramChange = true; - } else if (object.isInstancedMesh && materialProperties.instancingMorph === false && object.morphTexture !== null) { - needsProgramChange = true; - } else if (materialProperties.envMap !== envMap) { - needsProgramChange = true; - } else if (material.fog === true && materialProperties.fog !== fog) { - needsProgramChange = true; - } else if (materialProperties.numClippingPlanes !== void 0 && (materialProperties.numClippingPlanes !== clipping.numPlanes || materialProperties.numIntersection !== clipping.numIntersection)) { - needsProgramChange = true; - } else if (materialProperties.vertexAlphas !== vertexAlphas) { - needsProgramChange = true; - } else if (materialProperties.vertexTangents !== vertexTangents) { - needsProgramChange = true; - } else if (materialProperties.morphTargets !== morphTargets) { - needsProgramChange = true; - } else if (materialProperties.morphNormals !== morphNormals) { - needsProgramChange = true; - } else if (materialProperties.morphColors !== morphColors) { - needsProgramChange = true; - } else if (materialProperties.toneMapping !== toneMapping) { - needsProgramChange = true; - } else if (materialProperties.morphTargetsCount !== morphTargetsCount) { - needsProgramChange = true; - } - } else { - needsProgramChange = true; - materialProperties.__version = material.version; - } - let program = materialProperties.currentProgram; - if (needsProgramChange === true) { - program = getProgram(material, scene, object); - } - let refreshProgram = false; - let refreshMaterial = false; - let refreshLights = false; - const p_uniforms = program.getUniforms(), m_uniforms = materialProperties.uniforms; - if (state.useProgram(program.program)) { - refreshProgram = true; - refreshMaterial = true; - refreshLights = true; - } - if (material.id !== _currentMaterialId) { - _currentMaterialId = material.id; - refreshMaterial = true; - } - if (refreshProgram || _currentCamera !== camera) { - const reverseDepthBuffer2 = state.buffers.depth.getReversed(); - if (reverseDepthBuffer2) { - _currentProjectionMatrix.copy(camera.projectionMatrix); - toNormalizedProjectionMatrix(_currentProjectionMatrix); - toReversedProjectionMatrix(_currentProjectionMatrix); - p_uniforms.setValue(_gl, "projectionMatrix", _currentProjectionMatrix); - } else { - p_uniforms.setValue(_gl, "projectionMatrix", camera.projectionMatrix); - } - p_uniforms.setValue(_gl, "viewMatrix", camera.matrixWorldInverse); - const uCamPos = p_uniforms.map.cameraPosition; - if (uCamPos !== void 0) { - uCamPos.setValue(_gl, _vector32.setFromMatrixPosition(camera.matrixWorld)); - } - if (capabilities.logarithmicDepthBuffer) { - p_uniforms.setValue( - _gl, - "logDepthBufFC", - 2 / (Math.log(camera.far + 1) / Math.LN2) - ); - } - if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial) { - p_uniforms.setValue(_gl, "isOrthographic", camera.isOrthographicCamera === true); - } - if (_currentCamera !== camera) { - _currentCamera = camera; - refreshMaterial = true; - refreshLights = true; - } - } - if (object.isSkinnedMesh) { - p_uniforms.setOptional(_gl, object, "bindMatrix"); - p_uniforms.setOptional(_gl, object, "bindMatrixInverse"); - const skeleton = object.skeleton; - if (skeleton) { - if (skeleton.boneTexture === null) skeleton.computeBoneTexture(); - p_uniforms.setValue(_gl, "boneTexture", skeleton.boneTexture, textures); - } - } - if (object.isBatchedMesh) { - p_uniforms.setOptional(_gl, object, "batchingTexture"); - p_uniforms.setValue(_gl, "batchingTexture", object._matricesTexture, textures); - p_uniforms.setOptional(_gl, object, "batchingIdTexture"); - p_uniforms.setValue(_gl, "batchingIdTexture", object._indirectTexture, textures); - p_uniforms.setOptional(_gl, object, "batchingColorTexture"); - if (object._colorsTexture !== null) { - p_uniforms.setValue(_gl, "batchingColorTexture", object._colorsTexture, textures); - } - } - const morphAttributes = geometry.morphAttributes; - if (morphAttributes.position !== void 0 || morphAttributes.normal !== void 0 || morphAttributes.color !== void 0) { - morphtargets.update(object, geometry, program); - } - if (refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow) { - materialProperties.receiveShadow = object.receiveShadow; - p_uniforms.setValue(_gl, "receiveShadow", object.receiveShadow); - } - if (material.isMeshGouraudMaterial && material.envMap !== null) { - m_uniforms.envMap.value = envMap; - m_uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1; - } - if (material.isMeshStandardMaterial && material.envMap === null && scene.environment !== null) { - m_uniforms.envMapIntensity.value = scene.environmentIntensity; - } - if (refreshMaterial) { - p_uniforms.setValue(_gl, "toneMappingExposure", _this.toneMappingExposure); - if (materialProperties.needsLights) { - markUniformsLightsNeedsUpdate(m_uniforms, refreshLights); - } - if (fog && material.fog === true) { - materials.refreshFogUniforms(m_uniforms, fog); - } - materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget[camera.id]); - WebGLUniforms.upload(_gl, getUniformList(materialProperties), m_uniforms, textures); - } - if (material.isShaderMaterial && material.uniformsNeedUpdate === true) { - WebGLUniforms.upload(_gl, getUniformList(materialProperties), m_uniforms, textures); - material.uniformsNeedUpdate = false; - } - if (material.isSpriteMaterial) { - p_uniforms.setValue(_gl, "center", object.center); - } - p_uniforms.setValue(_gl, "modelViewMatrix", object.modelViewMatrix); - p_uniforms.setValue(_gl, "normalMatrix", object.normalMatrix); - p_uniforms.setValue(_gl, "modelMatrix", object.matrixWorld); - if (material.isShaderMaterial || material.isRawShaderMaterial) { - const groups = material.uniformsGroups; - for (let i = 0, l = groups.length; i < l; i++) { - const group = groups[i]; - uniformsGroups.update(group, program); - uniformsGroups.bind(group, program); - } - } - return program; - } - __name(setProgram, "setProgram"); - function markUniformsLightsNeedsUpdate(uniforms, value) { - uniforms.ambientLightColor.needsUpdate = value; - uniforms.lightProbe.needsUpdate = value; - uniforms.directionalLights.needsUpdate = value; - uniforms.directionalLightShadows.needsUpdate = value; - uniforms.pointLights.needsUpdate = value; - uniforms.pointLightShadows.needsUpdate = value; - uniforms.spotLights.needsUpdate = value; - uniforms.spotLightShadows.needsUpdate = value; - uniforms.rectAreaLights.needsUpdate = value; - uniforms.hemisphereLights.needsUpdate = value; - } - __name(markUniformsLightsNeedsUpdate, "markUniformsLightsNeedsUpdate"); - function materialNeedsLights(material) { - return material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial || material.isMeshStandardMaterial || material.isShadowMaterial || material.isShaderMaterial && material.lights === true; - } - __name(materialNeedsLights, "materialNeedsLights"); - this.getActiveCubeFace = function() { - return _currentActiveCubeFace; - }; - this.getActiveMipmapLevel = function() { - return _currentActiveMipmapLevel; - }; - this.getRenderTarget = function() { - return _currentRenderTarget; - }; - this.setRenderTargetTextures = function(renderTarget, colorTexture, depthTexture) { - properties.get(renderTarget.texture).__webglTexture = colorTexture; - properties.get(renderTarget.depthTexture).__webglTexture = depthTexture; - const renderTargetProperties = properties.get(renderTarget); - renderTargetProperties.__hasExternalTextures = true; - renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === void 0; - if (!renderTargetProperties.__autoAllocateDepthBuffer) { - if (extensions.has("WEBGL_multisampled_render_to_texture") === true) { - console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"); - renderTargetProperties.__useRenderToTexture = false; - } - } - }; - this.setRenderTargetFramebuffer = function(renderTarget, defaultFramebuffer) { - const renderTargetProperties = properties.get(renderTarget); - renderTargetProperties.__webglFramebuffer = defaultFramebuffer; - renderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === void 0; - }; - this.setRenderTarget = function(renderTarget, activeCubeFace = 0, activeMipmapLevel = 0) { - _currentRenderTarget = renderTarget; - _currentActiveCubeFace = activeCubeFace; - _currentActiveMipmapLevel = activeMipmapLevel; - let useDefaultFramebuffer = true; - let framebuffer = null; - let isCube = false; - let isRenderTarget3D = false; - if (renderTarget) { - const renderTargetProperties = properties.get(renderTarget); - if (renderTargetProperties.__useDefaultFramebuffer !== void 0) { - state.bindFramebuffer(_gl.FRAMEBUFFER, null); - useDefaultFramebuffer = false; - } else if (renderTargetProperties.__webglFramebuffer === void 0) { - textures.setupRenderTarget(renderTarget); - } else if (renderTargetProperties.__hasExternalTextures) { - textures.rebindTextures(renderTarget, properties.get(renderTarget.texture).__webglTexture, properties.get(renderTarget.depthTexture).__webglTexture); - } else if (renderTarget.depthBuffer) { - const depthTexture = renderTarget.depthTexture; - if (renderTargetProperties.__boundDepthTexture !== depthTexture) { - if (depthTexture !== null && properties.has(depthTexture) && (renderTarget.width !== depthTexture.image.width || renderTarget.height !== depthTexture.image.height)) { - throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size."); - } - textures.setupDepthRenderbuffer(renderTarget); - } - } - const texture = renderTarget.texture; - if (texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture) { - isRenderTarget3D = true; - } - const __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer; - if (renderTarget.isWebGLCubeRenderTarget) { - if (Array.isArray(__webglFramebuffer[activeCubeFace])) { - framebuffer = __webglFramebuffer[activeCubeFace][activeMipmapLevel]; - } else { - framebuffer = __webglFramebuffer[activeCubeFace]; - } - isCube = true; - } else if (renderTarget.samples > 0 && textures.useMultisampledRTT(renderTarget) === false) { - framebuffer = properties.get(renderTarget).__webglMultisampledFramebuffer; - } else { - if (Array.isArray(__webglFramebuffer)) { - framebuffer = __webglFramebuffer[activeMipmapLevel]; - } else { - framebuffer = __webglFramebuffer; - } - } - _currentViewport.copy(renderTarget.viewport); - _currentScissor.copy(renderTarget.scissor); - _currentScissorTest = renderTarget.scissorTest; - } else { - _currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor(); - _currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor(); - _currentScissorTest = _scissorTest; - } - const framebufferBound = state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - if (framebufferBound && useDefaultFramebuffer) { - state.drawBuffers(renderTarget, framebuffer); - } - state.viewport(_currentViewport); - state.scissor(_currentScissor); - state.setScissorTest(_currentScissorTest); - if (isCube) { - const textureProperties = properties.get(renderTarget.texture); - _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel); - } else if (isRenderTarget3D) { - const textureProperties = properties.get(renderTarget.texture); - const layer = activeCubeFace || 0; - _gl.framebufferTextureLayer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer); - } - _currentMaterialId = -1; - }; - this.readRenderTargetPixels = function(renderTarget, x, y, width, height, buffer, activeCubeFaceIndex) { - if (!(renderTarget && renderTarget.isWebGLRenderTarget)) { - console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); - return; - } - let framebuffer = properties.get(renderTarget).__webglFramebuffer; - if (renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== void 0) { - framebuffer = framebuffer[activeCubeFaceIndex]; - } - if (framebuffer) { - state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - try { - const texture = renderTarget.texture; - const textureFormat = texture.format; - const textureType = texture.type; - if (!capabilities.textureFormatReadable(textureFormat)) { - console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."); - return; - } - if (!capabilities.textureTypeReadable(textureType)) { - console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type."); - return; - } - if (x >= 0 && x <= renderTarget.width - width && (y >= 0 && y <= renderTarget.height - height)) { - _gl.readPixels(x, y, width, height, utils.convert(textureFormat), utils.convert(textureType), buffer); - } - } finally { - const framebuffer2 = _currentRenderTarget !== null ? properties.get(_currentRenderTarget).__webglFramebuffer : null; - state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer2); - } - } - }; - this.readRenderTargetPixelsAsync = async function(renderTarget, x, y, width, height, buffer, activeCubeFaceIndex) { - if (!(renderTarget && renderTarget.isWebGLRenderTarget)) { - throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); - } - let framebuffer = properties.get(renderTarget).__webglFramebuffer; - if (renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== void 0) { - framebuffer = framebuffer[activeCubeFaceIndex]; - } - if (framebuffer) { - const texture = renderTarget.texture; - const textureFormat = texture.format; - const textureType = texture.type; - if (!capabilities.textureFormatReadable(textureFormat)) { - throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format."); - } - if (!capabilities.textureTypeReadable(textureType)) { - throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type."); - } - if (x >= 0 && x <= renderTarget.width - width && (y >= 0 && y <= renderTarget.height - height)) { - state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - const glBuffer = _gl.createBuffer(); - _gl.bindBuffer(_gl.PIXEL_PACK_BUFFER, glBuffer); - _gl.bufferData(_gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ); - _gl.readPixels(x, y, width, height, utils.convert(textureFormat), utils.convert(textureType), 0); - const currFramebuffer = _currentRenderTarget !== null ? properties.get(_currentRenderTarget).__webglFramebuffer : null; - state.bindFramebuffer(_gl.FRAMEBUFFER, currFramebuffer); - const sync = _gl.fenceSync(_gl.SYNC_GPU_COMMANDS_COMPLETE, 0); - _gl.flush(); - await probeAsync(_gl, sync, 4); - _gl.bindBuffer(_gl.PIXEL_PACK_BUFFER, glBuffer); - _gl.getBufferSubData(_gl.PIXEL_PACK_BUFFER, 0, buffer); - _gl.deleteBuffer(glBuffer); - _gl.deleteSync(sync); - return buffer; - } else { - throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range."); - } - } - }; - this.copyFramebufferToTexture = function(texture, position = null, level = 0) { - if (texture.isTexture !== true) { - warnOnce("WebGLRenderer: copyFramebufferToTexture function signature has changed."); - position = arguments[0] || null; - texture = arguments[1]; - } - const levelScale = Math.pow(2, -level); - const width = Math.floor(texture.image.width * levelScale); - const height = Math.floor(texture.image.height * levelScale); - const x = position !== null ? position.x : 0; - const y = position !== null ? position.y : 0; - textures.setTexture2D(texture, 0); - _gl.copyTexSubImage2D(_gl.TEXTURE_2D, level, 0, 0, x, y, width, height); - state.unbindTexture(); - }; - this.copyTextureToTexture = function(srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0) { - if (srcTexture.isTexture !== true) { - warnOnce("WebGLRenderer: copyTextureToTexture function signature has changed."); - dstPosition = arguments[0] || null; - srcTexture = arguments[1]; - dstTexture = arguments[2]; - level = arguments[3] || 0; - srcRegion = null; - } - let width, height, depth2, minX, minY, minZ; - let dstX, dstY, dstZ; - const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[level] : srcTexture.image; - if (srcRegion !== null) { - width = srcRegion.max.x - srcRegion.min.x; - height = srcRegion.max.y - srcRegion.min.y; - depth2 = srcRegion.isBox3 ? srcRegion.max.z - srcRegion.min.z : 1; - minX = srcRegion.min.x; - minY = srcRegion.min.y; - minZ = srcRegion.isBox3 ? srcRegion.min.z : 0; - } else { - width = image.width; - height = image.height; - depth2 = image.depth || 1; - minX = 0; - minY = 0; - minZ = 0; - } - if (dstPosition !== null) { - dstX = dstPosition.x; - dstY = dstPosition.y; - dstZ = dstPosition.z; - } else { - dstX = 0; - dstY = 0; - dstZ = 0; - } - const glFormat = utils.convert(dstTexture.format); - const glType = utils.convert(dstTexture.type); - let glTarget; - if (dstTexture.isData3DTexture) { - textures.setTexture3D(dstTexture, 0); - glTarget = _gl.TEXTURE_3D; - } else if (dstTexture.isDataArrayTexture || dstTexture.isCompressedArrayTexture) { - textures.setTexture2DArray(dstTexture, 0); - glTarget = _gl.TEXTURE_2D_ARRAY; - } else { - textures.setTexture2D(dstTexture, 0); - glTarget = _gl.TEXTURE_2D; - } - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment); - const currentUnpackRowLen = _gl.getParameter(_gl.UNPACK_ROW_LENGTH); - const currentUnpackImageHeight = _gl.getParameter(_gl.UNPACK_IMAGE_HEIGHT); - const currentUnpackSkipPixels = _gl.getParameter(_gl.UNPACK_SKIP_PIXELS); - const currentUnpackSkipRows = _gl.getParameter(_gl.UNPACK_SKIP_ROWS); - const currentUnpackSkipImages = _gl.getParameter(_gl.UNPACK_SKIP_IMAGES); - _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width); - _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height); - _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, minX); - _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, minY); - _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, minZ); - const isSrc3D = srcTexture.isDataArrayTexture || srcTexture.isData3DTexture; - const isDst3D = dstTexture.isDataArrayTexture || dstTexture.isData3DTexture; - if (srcTexture.isRenderTargetTexture || srcTexture.isDepthTexture) { - const srcTextureProperties = properties.get(srcTexture); - const dstTextureProperties = properties.get(dstTexture); - const srcRenderTargetProperties = properties.get(srcTextureProperties.__renderTarget); - const dstRenderTargetProperties = properties.get(dstTextureProperties.__renderTarget); - state.bindFramebuffer(_gl.READ_FRAMEBUFFER, srcRenderTargetProperties.__webglFramebuffer); - state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, dstRenderTargetProperties.__webglFramebuffer); - for (let i = 0; i < depth2; i++) { - if (isSrc3D) { - _gl.framebufferTextureLayer(_gl.READ_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, properties.get(srcTexture).__webglTexture, level, minZ + i); - } - if (srcTexture.isDepthTexture) { - if (isDst3D) { - _gl.framebufferTextureLayer(_gl.DRAW_FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, properties.get(dstTexture).__webglTexture, level, dstZ + i); - } - _gl.blitFramebuffer(minX, minY, width, height, dstX, dstY, width, height, _gl.DEPTH_BUFFER_BIT, _gl.NEAREST); - } else if (isDst3D) { - _gl.copyTexSubImage3D(glTarget, level, dstX, dstY, dstZ + i, minX, minY, width, height); - } else { - _gl.copyTexSubImage2D(glTarget, level, dstX, dstY, dstZ + i, minX, minY, width, height); - } - } - state.bindFramebuffer(_gl.READ_FRAMEBUFFER, null); - state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, null); - } else { - if (isDst3D) { - if (srcTexture.isDataTexture || srcTexture.isData3DTexture) { - _gl.texSubImage3D(glTarget, level, dstX, dstY, dstZ, width, height, depth2, glFormat, glType, image.data); - } else if (dstTexture.isCompressedArrayTexture) { - _gl.compressedTexSubImage3D(glTarget, level, dstX, dstY, dstZ, width, height, depth2, glFormat, image.data); - } else { - _gl.texSubImage3D(glTarget, level, dstX, dstY, dstZ, width, height, depth2, glFormat, glType, image); - } - } else { - if (srcTexture.isDataTexture) { - _gl.texSubImage2D(_gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, image.data); - } else if (srcTexture.isCompressedTexture) { - _gl.compressedTexSubImage2D(_gl.TEXTURE_2D, level, dstX, dstY, image.width, image.height, glFormat, image.data); - } else { - _gl.texSubImage2D(_gl.TEXTURE_2D, level, dstX, dstY, width, height, glFormat, glType, image); - } - } - } - _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, currentUnpackRowLen); - _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight); - _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels); - _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows); - _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages); - if (level === 0 && dstTexture.generateMipmaps) { - _gl.generateMipmap(glTarget); - } - state.unbindTexture(); - }; - this.copyTextureToTexture3D = function(srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0) { - if (srcTexture.isTexture !== true) { - warnOnce("WebGLRenderer: copyTextureToTexture3D function signature has changed."); - srcRegion = arguments[0] || null; - dstPosition = arguments[1] || null; - srcTexture = arguments[2]; - dstTexture = arguments[3]; - level = arguments[4] || 0; - } - warnOnce('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'); - return this.copyTextureToTexture(srcTexture, dstTexture, srcRegion, dstPosition, level); - }; - this.initRenderTarget = function(target) { - if (properties.get(target).__webglFramebuffer === void 0) { - textures.setupRenderTarget(target); - } - }; - this.initTexture = function(texture) { - if (texture.isCubeTexture) { - textures.setTextureCube(texture, 0); - } else if (texture.isData3DTexture) { - textures.setTexture3D(texture, 0); - } else if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) { - textures.setTexture2DArray(texture, 0); - } else { - textures.setTexture2D(texture, 0); - } - state.unbindTexture(); - }; - this.resetState = function() { - _currentActiveCubeFace = 0; - _currentActiveMipmapLevel = 0; - _currentRenderTarget = null; - state.reset(); - bindingStates.reset(); - }; - if (typeof __THREE_DEVTOOLS__ !== "undefined") { - __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this })); - } - } - get coordinateSystem() { - return WebGLCoordinateSystem; - } - get outputColorSpace() { - return this._outputColorSpace; - } - set outputColorSpace(colorSpace) { - this._outputColorSpace = colorSpace; - const gl = this.getContext(); - gl.drawingBufferColorspace = ColorManagement._getDrawingBufferColorSpace(colorSpace); - gl.unpackColorSpace = ColorManagement._getUnpackColorSpace(); - } -} -class FogExp2 { - static { - __name(this, "FogExp2"); - } - constructor(color, density = 25e-5) { - this.isFogExp2 = true; - this.name = ""; - this.color = new Color(color); - this.density = density; - } - clone() { - return new FogExp2(this.color, this.density); - } - toJSON() { - return { - type: "FogExp2", - name: this.name, - color: this.color.getHex(), - density: this.density - }; - } -} -class Fog { - static { - __name(this, "Fog"); - } - constructor(color, near = 1, far = 1e3) { - this.isFog = true; - this.name = ""; - this.color = new Color(color); - this.near = near; - this.far = far; - } - clone() { - return new Fog(this.color, this.near, this.far); - } - toJSON() { - return { - type: "Fog", - name: this.name, - color: this.color.getHex(), - near: this.near, - far: this.far - }; - } -} -class Scene extends Object3D { - static { - __name(this, "Scene"); - } - constructor() { - super(); - this.isScene = true; - this.type = "Scene"; - this.background = null; - this.environment = null; - this.fog = null; - this.backgroundBlurriness = 0; - this.backgroundIntensity = 1; - this.backgroundRotation = new Euler(); - this.environmentIntensity = 1; - this.environmentRotation = new Euler(); - this.overrideMaterial = null; - if (typeof __THREE_DEVTOOLS__ !== "undefined") { - __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this })); - } - } - copy(source, recursive) { - super.copy(source, recursive); - if (source.background !== null) this.background = source.background.clone(); - if (source.environment !== null) this.environment = source.environment.clone(); - if (source.fog !== null) this.fog = source.fog.clone(); - this.backgroundBlurriness = source.backgroundBlurriness; - this.backgroundIntensity = source.backgroundIntensity; - this.backgroundRotation.copy(source.backgroundRotation); - this.environmentIntensity = source.environmentIntensity; - this.environmentRotation.copy(source.environmentRotation); - if (source.overrideMaterial !== null) this.overrideMaterial = source.overrideMaterial.clone(); - this.matrixAutoUpdate = source.matrixAutoUpdate; - return this; - } - toJSON(meta) { - const data = super.toJSON(meta); - if (this.fog !== null) data.object.fog = this.fog.toJSON(); - if (this.backgroundBlurriness > 0) data.object.backgroundBlurriness = this.backgroundBlurriness; - if (this.backgroundIntensity !== 1) data.object.backgroundIntensity = this.backgroundIntensity; - data.object.backgroundRotation = this.backgroundRotation.toArray(); - if (this.environmentIntensity !== 1) data.object.environmentIntensity = this.environmentIntensity; - data.object.environmentRotation = this.environmentRotation.toArray(); - return data; - } -} -class InterleavedBuffer { - static { - __name(this, "InterleavedBuffer"); - } - constructor(array, stride) { - this.isInterleavedBuffer = true; - this.array = array; - this.stride = stride; - this.count = array !== void 0 ? array.length / stride : 0; - this.usage = StaticDrawUsage; - this.updateRanges = []; - this.version = 0; - this.uuid = generateUUID(); - } - onUploadCallback() { - } - set needsUpdate(value) { - if (value === true) this.version++; - } - setUsage(value) { - this.usage = value; - return this; - } - addUpdateRange(start, count) { - this.updateRanges.push({ start, count }); - } - clearUpdateRanges() { - this.updateRanges.length = 0; - } - copy(source) { - this.array = new source.array.constructor(source.array); - this.count = source.count; - this.stride = source.stride; - this.usage = source.usage; - return this; - } - copyAt(index1, attribute, index2) { - index1 *= this.stride; - index2 *= attribute.stride; - for (let i = 0, l = this.stride; i < l; i++) { - this.array[index1 + i] = attribute.array[index2 + i]; - } - return this; - } - set(value, offset = 0) { - this.array.set(value, offset); - return this; - } - clone(data) { - if (data.arrayBuffers === void 0) { - data.arrayBuffers = {}; - } - if (this.array.buffer._uuid === void 0) { - this.array.buffer._uuid = generateUUID(); - } - if (data.arrayBuffers[this.array.buffer._uuid] === void 0) { - data.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer; - } - const array = new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]); - const ib = new this.constructor(array, this.stride); - ib.setUsage(this.usage); - return ib; - } - onUpload(callback) { - this.onUploadCallback = callback; - return this; - } - toJSON(data) { - if (data.arrayBuffers === void 0) { - data.arrayBuffers = {}; - } - if (this.array.buffer._uuid === void 0) { - this.array.buffer._uuid = generateUUID(); - } - if (data.arrayBuffers[this.array.buffer._uuid] === void 0) { - data.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer)); - } - return { - uuid: this.uuid, - buffer: this.array.buffer._uuid, - type: this.array.constructor.name, - stride: this.stride - }; - } -} -const _vector$6 = /* @__PURE__ */ new Vector3(); -class InterleavedBufferAttribute { - static { - __name(this, "InterleavedBufferAttribute"); - } - constructor(interleavedBuffer, itemSize, offset, normalized = false) { - this.isInterleavedBufferAttribute = true; - this.name = ""; - this.data = interleavedBuffer; - this.itemSize = itemSize; - this.offset = offset; - this.normalized = normalized; - } - get count() { - return this.data.count; - } - get array() { - return this.data.array; - } - set needsUpdate(value) { - this.data.needsUpdate = value; - } - applyMatrix4(m) { - for (let i = 0, l = this.data.count; i < l; i++) { - _vector$6.fromBufferAttribute(this, i); - _vector$6.applyMatrix4(m); - this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z); - } - return this; - } - applyNormalMatrix(m) { - for (let i = 0, l = this.count; i < l; i++) { - _vector$6.fromBufferAttribute(this, i); - _vector$6.applyNormalMatrix(m); - this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z); - } - return this; - } - transformDirection(m) { - for (let i = 0, l = this.count; i < l; i++) { - _vector$6.fromBufferAttribute(this, i); - _vector$6.transformDirection(m); - this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z); - } - return this; - } - getComponent(index, component) { - let value = this.array[index * this.data.stride + this.offset + component]; - if (this.normalized) value = denormalize(value, this.array); - return value; - } - setComponent(index, component, value) { - if (this.normalized) value = normalize(value, this.array); - this.data.array[index * this.data.stride + this.offset + component] = value; - return this; - } - setX(index, x) { - if (this.normalized) x = normalize(x, this.array); - this.data.array[index * this.data.stride + this.offset] = x; - return this; - } - setY(index, y) { - if (this.normalized) y = normalize(y, this.array); - this.data.array[index * this.data.stride + this.offset + 1] = y; - return this; - } - setZ(index, z) { - if (this.normalized) z = normalize(z, this.array); - this.data.array[index * this.data.stride + this.offset + 2] = z; - return this; - } - setW(index, w) { - if (this.normalized) w = normalize(w, this.array); - this.data.array[index * this.data.stride + this.offset + 3] = w; - return this; - } - getX(index) { - let x = this.data.array[index * this.data.stride + this.offset]; - if (this.normalized) x = denormalize(x, this.array); - return x; - } - getY(index) { - let y = this.data.array[index * this.data.stride + this.offset + 1]; - if (this.normalized) y = denormalize(y, this.array); - return y; - } - getZ(index) { - let z = this.data.array[index * this.data.stride + this.offset + 2]; - if (this.normalized) z = denormalize(z, this.array); - return z; - } - getW(index) { - let w = this.data.array[index * this.data.stride + this.offset + 3]; - if (this.normalized) w = denormalize(w, this.array); - return w; - } - setXY(index, x, y) { - index = index * this.data.stride + this.offset; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - } - this.data.array[index + 0] = x; - this.data.array[index + 1] = y; - return this; - } - setXYZ(index, x, y, z) { - index = index * this.data.stride + this.offset; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - z = normalize(z, this.array); - } - this.data.array[index + 0] = x; - this.data.array[index + 1] = y; - this.data.array[index + 2] = z; - return this; - } - setXYZW(index, x, y, z, w) { - index = index * this.data.stride + this.offset; - if (this.normalized) { - x = normalize(x, this.array); - y = normalize(y, this.array); - z = normalize(z, this.array); - w = normalize(w, this.array); - } - this.data.array[index + 0] = x; - this.data.array[index + 1] = y; - this.data.array[index + 2] = z; - this.data.array[index + 3] = w; - return this; - } - clone(data) { - if (data === void 0) { - console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data."); - const array = []; - for (let i = 0; i < this.count; i++) { - const index = i * this.data.stride + this.offset; - for (let j = 0; j < this.itemSize; j++) { - array.push(this.data.array[index + j]); - } - } - return new BufferAttribute(new this.array.constructor(array), this.itemSize, this.normalized); - } else { - if (data.interleavedBuffers === void 0) { - data.interleavedBuffers = {}; - } - if (data.interleavedBuffers[this.data.uuid] === void 0) { - data.interleavedBuffers[this.data.uuid] = this.data.clone(data); - } - return new InterleavedBufferAttribute(data.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized); - } - } - toJSON(data) { - if (data === void 0) { - console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data."); - const array = []; - for (let i = 0; i < this.count; i++) { - const index = i * this.data.stride + this.offset; - for (let j = 0; j < this.itemSize; j++) { - array.push(this.data.array[index + j]); - } - } - return { - itemSize: this.itemSize, - type: this.array.constructor.name, - array, - normalized: this.normalized - }; - } else { - if (data.interleavedBuffers === void 0) { - data.interleavedBuffers = {}; - } - if (data.interleavedBuffers[this.data.uuid] === void 0) { - data.interleavedBuffers[this.data.uuid] = this.data.toJSON(data); - } - return { - isInterleavedBufferAttribute: true, - itemSize: this.itemSize, - data: this.data.uuid, - offset: this.offset, - normalized: this.normalized - }; - } - } -} -class SpriteMaterial extends Material { - static { - __name(this, "SpriteMaterial"); - } - static get type() { - return "SpriteMaterial"; - } - constructor(parameters) { - super(); - this.isSpriteMaterial = true; - this.color = new Color(16777215); - this.map = null; - this.alphaMap = null; - this.rotation = 0; - this.sizeAttenuation = true; - this.transparent = true; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.map = source.map; - this.alphaMap = source.alphaMap; - this.rotation = source.rotation; - this.sizeAttenuation = source.sizeAttenuation; - this.fog = source.fog; - return this; - } -} -let _geometry; -const _intersectPoint = /* @__PURE__ */ new Vector3(); -const _worldScale = /* @__PURE__ */ new Vector3(); -const _mvPosition = /* @__PURE__ */ new Vector3(); -const _alignedPosition = /* @__PURE__ */ new Vector2(); -const _rotatedPosition = /* @__PURE__ */ new Vector2(); -const _viewWorldMatrix = /* @__PURE__ */ new Matrix4(); -const _vA$2 = /* @__PURE__ */ new Vector3(); -const _vB$2 = /* @__PURE__ */ new Vector3(); -const _vC$2 = /* @__PURE__ */ new Vector3(); -const _uvA = /* @__PURE__ */ new Vector2(); -const _uvB = /* @__PURE__ */ new Vector2(); -const _uvC = /* @__PURE__ */ new Vector2(); -class Sprite extends Object3D { - static { - __name(this, "Sprite"); - } - constructor(material = new SpriteMaterial()) { - super(); - this.isSprite = true; - this.type = "Sprite"; - if (_geometry === void 0) { - _geometry = new BufferGeometry(); - const float32Array = new Float32Array([ - -0.5, - -0.5, - 0, - 0, - 0, - 0.5, - -0.5, - 0, - 1, - 0, - 0.5, - 0.5, - 0, - 1, - 1, - -0.5, - 0.5, - 0, - 0, - 1 - ]); - const interleavedBuffer = new InterleavedBuffer(float32Array, 5); - _geometry.setIndex([0, 1, 2, 0, 2, 3]); - _geometry.setAttribute("position", new InterleavedBufferAttribute(interleavedBuffer, 3, 0, false)); - _geometry.setAttribute("uv", new InterleavedBufferAttribute(interleavedBuffer, 2, 3, false)); - } - this.geometry = _geometry; - this.material = material; - this.center = new Vector2(0.5, 0.5); - } - raycast(raycaster, intersects2) { - if (raycaster.camera === null) { - console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'); - } - _worldScale.setFromMatrixScale(this.matrixWorld); - _viewWorldMatrix.copy(raycaster.camera.matrixWorld); - this.modelViewMatrix.multiplyMatrices(raycaster.camera.matrixWorldInverse, this.matrixWorld); - _mvPosition.setFromMatrixPosition(this.modelViewMatrix); - if (raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false) { - _worldScale.multiplyScalar(-_mvPosition.z); - } - const rotation = this.material.rotation; - let sin, cos; - if (rotation !== 0) { - cos = Math.cos(rotation); - sin = Math.sin(rotation); - } - const center = this.center; - transformVertex(_vA$2.set(-0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos); - transformVertex(_vB$2.set(0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos); - transformVertex(_vC$2.set(0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos); - _uvA.set(0, 0); - _uvB.set(1, 0); - _uvC.set(1, 1); - let intersect2 = raycaster.ray.intersectTriangle(_vA$2, _vB$2, _vC$2, false, _intersectPoint); - if (intersect2 === null) { - transformVertex(_vB$2.set(-0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos); - _uvB.set(0, 1); - intersect2 = raycaster.ray.intersectTriangle(_vA$2, _vC$2, _vB$2, false, _intersectPoint); - if (intersect2 === null) { - return; - } - } - const distance = raycaster.ray.origin.distanceTo(_intersectPoint); - if (distance < raycaster.near || distance > raycaster.far) return; - intersects2.push({ - distance, - point: _intersectPoint.clone(), - uv: Triangle.getInterpolation(_intersectPoint, _vA$2, _vB$2, _vC$2, _uvA, _uvB, _uvC, new Vector2()), - face: null, - object: this - }); - } - copy(source, recursive) { - super.copy(source, recursive); - if (source.center !== void 0) this.center.copy(source.center); - this.material = source.material; - return this; - } -} -function transformVertex(vertexPosition, mvPosition, center, scale, sin, cos) { - _alignedPosition.subVectors(vertexPosition, center).addScalar(0.5).multiply(scale); - if (sin !== void 0) { - _rotatedPosition.x = cos * _alignedPosition.x - sin * _alignedPosition.y; - _rotatedPosition.y = sin * _alignedPosition.x + cos * _alignedPosition.y; - } else { - _rotatedPosition.copy(_alignedPosition); - } - vertexPosition.copy(mvPosition); - vertexPosition.x += _rotatedPosition.x; - vertexPosition.y += _rotatedPosition.y; - vertexPosition.applyMatrix4(_viewWorldMatrix); -} -__name(transformVertex, "transformVertex"); -const _v1$2 = /* @__PURE__ */ new Vector3(); -const _v2$1 = /* @__PURE__ */ new Vector3(); -class LOD extends Object3D { - static { - __name(this, "LOD"); - } - constructor() { - super(); - this._currentLevel = 0; - this.type = "LOD"; - Object.defineProperties(this, { - levels: { - enumerable: true, - value: [] - }, - isLOD: { - value: true - } - }); - this.autoUpdate = true; - } - copy(source) { - super.copy(source, false); - const levels = source.levels; - for (let i = 0, l = levels.length; i < l; i++) { - const level = levels[i]; - this.addLevel(level.object.clone(), level.distance, level.hysteresis); - } - this.autoUpdate = source.autoUpdate; - return this; - } - addLevel(object, distance = 0, hysteresis = 0) { - distance = Math.abs(distance); - const levels = this.levels; - let l; - for (l = 0; l < levels.length; l++) { - if (distance < levels[l].distance) { - break; - } - } - levels.splice(l, 0, { distance, hysteresis, object }); - this.add(object); - return this; - } - removeLevel(distance) { - const levels = this.levels; - for (let i = 0; i < levels.length; i++) { - if (levels[i].distance === distance) { - const removedElements = levels.splice(i, 1); - this.remove(removedElements[0].object); - return true; - } - } - return false; - } - getCurrentLevel() { - return this._currentLevel; - } - getObjectForDistance(distance) { - const levels = this.levels; - if (levels.length > 0) { - let i, l; - for (i = 1, l = levels.length; i < l; i++) { - let levelDistance = levels[i].distance; - if (levels[i].object.visible) { - levelDistance -= levelDistance * levels[i].hysteresis; - } - if (distance < levelDistance) { - break; - } - } - return levels[i - 1].object; - } - return null; - } - raycast(raycaster, intersects2) { - const levels = this.levels; - if (levels.length > 0) { - _v1$2.setFromMatrixPosition(this.matrixWorld); - const distance = raycaster.ray.origin.distanceTo(_v1$2); - this.getObjectForDistance(distance).raycast(raycaster, intersects2); - } - } - update(camera) { - const levels = this.levels; - if (levels.length > 1) { - _v1$2.setFromMatrixPosition(camera.matrixWorld); - _v2$1.setFromMatrixPosition(this.matrixWorld); - const distance = _v1$2.distanceTo(_v2$1) / camera.zoom; - levels[0].object.visible = true; - let i, l; - for (i = 1, l = levels.length; i < l; i++) { - let levelDistance = levels[i].distance; - if (levels[i].object.visible) { - levelDistance -= levelDistance * levels[i].hysteresis; - } - if (distance >= levelDistance) { - levels[i - 1].object.visible = false; - levels[i].object.visible = true; - } else { - break; - } - } - this._currentLevel = i - 1; - for (; i < l; i++) { - levels[i].object.visible = false; - } - } - } - toJSON(meta) { - const data = super.toJSON(meta); - if (this.autoUpdate === false) data.object.autoUpdate = false; - data.object.levels = []; - const levels = this.levels; - for (let i = 0, l = levels.length; i < l; i++) { - const level = levels[i]; - data.object.levels.push({ - object: level.object.uuid, - distance: level.distance, - hysteresis: level.hysteresis - }); - } - return data; - } -} -const _basePosition = /* @__PURE__ */ new Vector3(); -const _skinIndex = /* @__PURE__ */ new Vector4(); -const _skinWeight = /* @__PURE__ */ new Vector4(); -const _vector3 = /* @__PURE__ */ new Vector3(); -const _matrix4 = /* @__PURE__ */ new Matrix4(); -const _vertex = /* @__PURE__ */ new Vector3(); -const _sphere$4 = /* @__PURE__ */ new Sphere(); -const _inverseMatrix$2 = /* @__PURE__ */ new Matrix4(); -const _ray$2 = /* @__PURE__ */ new Ray(); -class SkinnedMesh extends Mesh { - static { - __name(this, "SkinnedMesh"); - } - constructor(geometry, material) { - super(geometry, material); - this.isSkinnedMesh = true; - this.type = "SkinnedMesh"; - this.bindMode = AttachedBindMode; - this.bindMatrix = new Matrix4(); - this.bindMatrixInverse = new Matrix4(); - this.boundingBox = null; - this.boundingSphere = null; - } - computeBoundingBox() { - const geometry = this.geometry; - if (this.boundingBox === null) { - this.boundingBox = new Box3(); - } - this.boundingBox.makeEmpty(); - const positionAttribute = geometry.getAttribute("position"); - for (let i = 0; i < positionAttribute.count; i++) { - this.getVertexPosition(i, _vertex); - this.boundingBox.expandByPoint(_vertex); - } - } - computeBoundingSphere() { - const geometry = this.geometry; - if (this.boundingSphere === null) { - this.boundingSphere = new Sphere(); - } - this.boundingSphere.makeEmpty(); - const positionAttribute = geometry.getAttribute("position"); - for (let i = 0; i < positionAttribute.count; i++) { - this.getVertexPosition(i, _vertex); - this.boundingSphere.expandByPoint(_vertex); - } - } - copy(source, recursive) { - super.copy(source, recursive); - this.bindMode = source.bindMode; - this.bindMatrix.copy(source.bindMatrix); - this.bindMatrixInverse.copy(source.bindMatrixInverse); - this.skeleton = source.skeleton; - if (source.boundingBox !== null) this.boundingBox = source.boundingBox.clone(); - if (source.boundingSphere !== null) this.boundingSphere = source.boundingSphere.clone(); - return this; - } - raycast(raycaster, intersects2) { - const material = this.material; - const matrixWorld = this.matrixWorld; - if (material === void 0) return; - if (this.boundingSphere === null) this.computeBoundingSphere(); - _sphere$4.copy(this.boundingSphere); - _sphere$4.applyMatrix4(matrixWorld); - if (raycaster.ray.intersectsSphere(_sphere$4) === false) return; - _inverseMatrix$2.copy(matrixWorld).invert(); - _ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2); - if (this.boundingBox !== null) { - if (_ray$2.intersectsBox(this.boundingBox) === false) return; - } - this._computeIntersections(raycaster, intersects2, _ray$2); - } - getVertexPosition(index, target) { - super.getVertexPosition(index, target); - this.applyBoneTransform(index, target); - return target; - } - bind(skeleton, bindMatrix) { - this.skeleton = skeleton; - if (bindMatrix === void 0) { - this.updateMatrixWorld(true); - this.skeleton.calculateInverses(); - bindMatrix = this.matrixWorld; - } - this.bindMatrix.copy(bindMatrix); - this.bindMatrixInverse.copy(bindMatrix).invert(); - } - pose() { - this.skeleton.pose(); - } - normalizeSkinWeights() { - const vector = new Vector4(); - const skinWeight = this.geometry.attributes.skinWeight; - for (let i = 0, l = skinWeight.count; i < l; i++) { - vector.fromBufferAttribute(skinWeight, i); - const scale = 1 / vector.manhattanLength(); - if (scale !== Infinity) { - vector.multiplyScalar(scale); - } else { - vector.set(1, 0, 0, 0); - } - skinWeight.setXYZW(i, vector.x, vector.y, vector.z, vector.w); - } - } - updateMatrixWorld(force) { - super.updateMatrixWorld(force); - if (this.bindMode === AttachedBindMode) { - this.bindMatrixInverse.copy(this.matrixWorld).invert(); - } else if (this.bindMode === DetachedBindMode) { - this.bindMatrixInverse.copy(this.bindMatrix).invert(); - } else { - console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode); - } - } - applyBoneTransform(index, vector) { - const skeleton = this.skeleton; - const geometry = this.geometry; - _skinIndex.fromBufferAttribute(geometry.attributes.skinIndex, index); - _skinWeight.fromBufferAttribute(geometry.attributes.skinWeight, index); - _basePosition.copy(vector).applyMatrix4(this.bindMatrix); - vector.set(0, 0, 0); - for (let i = 0; i < 4; i++) { - const weight = _skinWeight.getComponent(i); - if (weight !== 0) { - const boneIndex = _skinIndex.getComponent(i); - _matrix4.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]); - vector.addScaledVector(_vector3.copy(_basePosition).applyMatrix4(_matrix4), weight); - } - } - return vector.applyMatrix4(this.bindMatrixInverse); - } -} -class Bone extends Object3D { - static { - __name(this, "Bone"); - } - constructor() { - super(); - this.isBone = true; - this.type = "Bone"; - } -} -class DataTexture extends Texture { - static { - __name(this, "DataTexture"); - } - constructor(data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, colorSpace) { - super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace); - this.isDataTexture = true; - this.image = { data, width, height }; - this.generateMipmaps = false; - this.flipY = false; - this.unpackAlignment = 1; - } -} -const _offsetMatrix = /* @__PURE__ */ new Matrix4(); -const _identityMatrix$1 = /* @__PURE__ */ new Matrix4(); -class Skeleton { - static { - __name(this, "Skeleton"); - } - constructor(bones = [], boneInverses = []) { - this.uuid = generateUUID(); - this.bones = bones.slice(0); - this.boneInverses = boneInverses; - this.boneMatrices = null; - this.boneTexture = null; - this.init(); - } - init() { - const bones = this.bones; - const boneInverses = this.boneInverses; - this.boneMatrices = new Float32Array(bones.length * 16); - if (boneInverses.length === 0) { - this.calculateInverses(); - } else { - if (bones.length !== boneInverses.length) { - console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."); - this.boneInverses = []; - for (let i = 0, il = this.bones.length; i < il; i++) { - this.boneInverses.push(new Matrix4()); - } - } - } - } - calculateInverses() { - this.boneInverses.length = 0; - for (let i = 0, il = this.bones.length; i < il; i++) { - const inverse = new Matrix4(); - if (this.bones[i]) { - inverse.copy(this.bones[i].matrixWorld).invert(); - } - this.boneInverses.push(inverse); - } - } - pose() { - for (let i = 0, il = this.bones.length; i < il; i++) { - const bone = this.bones[i]; - if (bone) { - bone.matrixWorld.copy(this.boneInverses[i]).invert(); - } - } - for (let i = 0, il = this.bones.length; i < il; i++) { - const bone = this.bones[i]; - if (bone) { - if (bone.parent && bone.parent.isBone) { - bone.matrix.copy(bone.parent.matrixWorld).invert(); - bone.matrix.multiply(bone.matrixWorld); - } else { - bone.matrix.copy(bone.matrixWorld); - } - bone.matrix.decompose(bone.position, bone.quaternion, bone.scale); - } - } - } - update() { - const bones = this.bones; - const boneInverses = this.boneInverses; - const boneMatrices = this.boneMatrices; - const boneTexture = this.boneTexture; - for (let i = 0, il = bones.length; i < il; i++) { - const matrix = bones[i] ? bones[i].matrixWorld : _identityMatrix$1; - _offsetMatrix.multiplyMatrices(matrix, boneInverses[i]); - _offsetMatrix.toArray(boneMatrices, i * 16); - } - if (boneTexture !== null) { - boneTexture.needsUpdate = true; - } - } - clone() { - return new Skeleton(this.bones, this.boneInverses); - } - computeBoneTexture() { - let size = Math.sqrt(this.bones.length * 4); - size = Math.ceil(size / 4) * 4; - size = Math.max(size, 4); - const boneMatrices = new Float32Array(size * size * 4); - boneMatrices.set(this.boneMatrices); - const boneTexture = new DataTexture(boneMatrices, size, size, RGBAFormat, FloatType); - boneTexture.needsUpdate = true; - this.boneMatrices = boneMatrices; - this.boneTexture = boneTexture; - return this; - } - getBoneByName(name) { - for (let i = 0, il = this.bones.length; i < il; i++) { - const bone = this.bones[i]; - if (bone.name === name) { - return bone; - } - } - return void 0; - } - dispose() { - if (this.boneTexture !== null) { - this.boneTexture.dispose(); - this.boneTexture = null; - } - } - fromJSON(json, bones) { - this.uuid = json.uuid; - for (let i = 0, l = json.bones.length; i < l; i++) { - const uuid = json.bones[i]; - let bone = bones[uuid]; - if (bone === void 0) { - console.warn("THREE.Skeleton: No bone found with UUID:", uuid); - bone = new Bone(); - } - this.bones.push(bone); - this.boneInverses.push(new Matrix4().fromArray(json.boneInverses[i])); - } - this.init(); - return this; - } - toJSON() { - const data = { - metadata: { - version: 4.6, - type: "Skeleton", - generator: "Skeleton.toJSON" - }, - bones: [], - boneInverses: [] - }; - data.uuid = this.uuid; - const bones = this.bones; - const boneInverses = this.boneInverses; - for (let i = 0, l = bones.length; i < l; i++) { - const bone = bones[i]; - data.bones.push(bone.uuid); - const boneInverse = boneInverses[i]; - data.boneInverses.push(boneInverse.toArray()); - } - return data; - } -} -class InstancedBufferAttribute extends BufferAttribute { - static { - __name(this, "InstancedBufferAttribute"); - } - constructor(array, itemSize, normalized, meshPerAttribute = 1) { - super(array, itemSize, normalized); - this.isInstancedBufferAttribute = true; - this.meshPerAttribute = meshPerAttribute; - } - copy(source) { - super.copy(source); - this.meshPerAttribute = source.meshPerAttribute; - return this; - } - toJSON() { - const data = super.toJSON(); - data.meshPerAttribute = this.meshPerAttribute; - data.isInstancedBufferAttribute = true; - return data; - } -} -const _instanceLocalMatrix = /* @__PURE__ */ new Matrix4(); -const _instanceWorldMatrix = /* @__PURE__ */ new Matrix4(); -const _instanceIntersects = []; -const _box3 = /* @__PURE__ */ new Box3(); -const _identity = /* @__PURE__ */ new Matrix4(); -const _mesh$1 = /* @__PURE__ */ new Mesh(); -const _sphere$3 = /* @__PURE__ */ new Sphere(); -class InstancedMesh extends Mesh { - static { - __name(this, "InstancedMesh"); - } - constructor(geometry, material, count) { - super(geometry, material); - this.isInstancedMesh = true; - this.instanceMatrix = new InstancedBufferAttribute(new Float32Array(count * 16), 16); - this.instanceColor = null; - this.morphTexture = null; - this.count = count; - this.boundingBox = null; - this.boundingSphere = null; - for (let i = 0; i < count; i++) { - this.setMatrixAt(i, _identity); - } - } - computeBoundingBox() { - const geometry = this.geometry; - const count = this.count; - if (this.boundingBox === null) { - this.boundingBox = new Box3(); - } - if (geometry.boundingBox === null) { - geometry.computeBoundingBox(); - } - this.boundingBox.makeEmpty(); - for (let i = 0; i < count; i++) { - this.getMatrixAt(i, _instanceLocalMatrix); - _box3.copy(geometry.boundingBox).applyMatrix4(_instanceLocalMatrix); - this.boundingBox.union(_box3); - } - } - computeBoundingSphere() { - const geometry = this.geometry; - const count = this.count; - if (this.boundingSphere === null) { - this.boundingSphere = new Sphere(); - } - if (geometry.boundingSphere === null) { - geometry.computeBoundingSphere(); - } - this.boundingSphere.makeEmpty(); - for (let i = 0; i < count; i++) { - this.getMatrixAt(i, _instanceLocalMatrix); - _sphere$3.copy(geometry.boundingSphere).applyMatrix4(_instanceLocalMatrix); - this.boundingSphere.union(_sphere$3); - } - } - copy(source, recursive) { - super.copy(source, recursive); - this.instanceMatrix.copy(source.instanceMatrix); - if (source.morphTexture !== null) this.morphTexture = source.morphTexture.clone(); - if (source.instanceColor !== null) this.instanceColor = source.instanceColor.clone(); - this.count = source.count; - if (source.boundingBox !== null) this.boundingBox = source.boundingBox.clone(); - if (source.boundingSphere !== null) this.boundingSphere = source.boundingSphere.clone(); - return this; - } - getColorAt(index, color) { - color.fromArray(this.instanceColor.array, index * 3); - } - getMatrixAt(index, matrix) { - matrix.fromArray(this.instanceMatrix.array, index * 16); - } - getMorphAt(index, object) { - const objectInfluences = object.morphTargetInfluences; - const array = this.morphTexture.source.data.data; - const len = objectInfluences.length + 1; - const dataIndex = index * len + 1; - for (let i = 0; i < objectInfluences.length; i++) { - objectInfluences[i] = array[dataIndex + i]; - } - } - raycast(raycaster, intersects2) { - const matrixWorld = this.matrixWorld; - const raycastTimes = this.count; - _mesh$1.geometry = this.geometry; - _mesh$1.material = this.material; - if (_mesh$1.material === void 0) return; - if (this.boundingSphere === null) this.computeBoundingSphere(); - _sphere$3.copy(this.boundingSphere); - _sphere$3.applyMatrix4(matrixWorld); - if (raycaster.ray.intersectsSphere(_sphere$3) === false) return; - for (let instanceId = 0; instanceId < raycastTimes; instanceId++) { - this.getMatrixAt(instanceId, _instanceLocalMatrix); - _instanceWorldMatrix.multiplyMatrices(matrixWorld, _instanceLocalMatrix); - _mesh$1.matrixWorld = _instanceWorldMatrix; - _mesh$1.raycast(raycaster, _instanceIntersects); - for (let i = 0, l = _instanceIntersects.length; i < l; i++) { - const intersect2 = _instanceIntersects[i]; - intersect2.instanceId = instanceId; - intersect2.object = this; - intersects2.push(intersect2); - } - _instanceIntersects.length = 0; - } - } - setColorAt(index, color) { - if (this.instanceColor === null) { - this.instanceColor = new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count * 3).fill(1), 3); - } - color.toArray(this.instanceColor.array, index * 3); - } - setMatrixAt(index, matrix) { - matrix.toArray(this.instanceMatrix.array, index * 16); - } - setMorphAt(index, object) { - const objectInfluences = object.morphTargetInfluences; - const len = objectInfluences.length + 1; - if (this.morphTexture === null) { - this.morphTexture = new DataTexture(new Float32Array(len * this.count), len, this.count, RedFormat, FloatType); - } - const array = this.morphTexture.source.data.data; - let morphInfluencesSum = 0; - for (let i = 0; i < objectInfluences.length; i++) { - morphInfluencesSum += objectInfluences[i]; - } - const morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum; - const dataIndex = len * index; - array[dataIndex] = morphBaseInfluence; - array.set(objectInfluences, dataIndex + 1); - } - updateMorphTargets() { - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - if (this.morphTexture !== null) { - this.morphTexture.dispose(); - this.morphTexture = null; - } - return this; - } -} -function ascIdSort(a, b) { - return a - b; -} -__name(ascIdSort, "ascIdSort"); -function sortOpaque(a, b) { - return a.z - b.z; -} -__name(sortOpaque, "sortOpaque"); -function sortTransparent(a, b) { - return b.z - a.z; -} -__name(sortTransparent, "sortTransparent"); -class MultiDrawRenderList { - static { - __name(this, "MultiDrawRenderList"); - } - constructor() { - this.index = 0; - this.pool = []; - this.list = []; - } - push(start, count, z, index) { - const pool = this.pool; - const list = this.list; - if (this.index >= pool.length) { - pool.push({ - start: -1, - count: -1, - z: -1, - index: -1 - }); - } - const item = pool[this.index]; - list.push(item); - this.index++; - item.start = start; - item.count = count; - item.z = z; - item.index = index; - } - reset() { - this.list.length = 0; - this.index = 0; - } -} -const _matrix$1 = /* @__PURE__ */ new Matrix4(); -const _whiteColor = /* @__PURE__ */ new Color(1, 1, 1); -const _frustum = /* @__PURE__ */ new Frustum(); -const _box$1 = /* @__PURE__ */ new Box3(); -const _sphere$2 = /* @__PURE__ */ new Sphere(); -const _vector$5 = /* @__PURE__ */ new Vector3(); -const _forward = /* @__PURE__ */ new Vector3(); -const _temp = /* @__PURE__ */ new Vector3(); -const _renderList = /* @__PURE__ */ new MultiDrawRenderList(); -const _mesh = /* @__PURE__ */ new Mesh(); -const _batchIntersects = []; -function copyAttributeData(src, target, targetOffset = 0) { - const itemSize = target.itemSize; - if (src.isInterleavedBufferAttribute || src.array.constructor !== target.array.constructor) { - const vertexCount = src.count; - for (let i = 0; i < vertexCount; i++) { - for (let c = 0; c < itemSize; c++) { - target.setComponent(i + targetOffset, c, src.getComponent(i, c)); - } - } - } else { - target.array.set(src.array, targetOffset * itemSize); - } - target.needsUpdate = true; -} -__name(copyAttributeData, "copyAttributeData"); -function copyArrayContents(src, target) { - if (src.constructor !== target.constructor) { - const len = Math.min(src.length, target.length); - for (let i = 0; i < len; i++) { - target[i] = src[i]; - } - } else { - const len = Math.min(src.length, target.length); - target.set(new src.constructor(src.buffer, 0, len)); - } -} -__name(copyArrayContents, "copyArrayContents"); -class BatchedMesh extends Mesh { - static { - __name(this, "BatchedMesh"); - } - get maxInstanceCount() { - return this._maxInstanceCount; - } - get instanceCount() { - return this._instanceInfo.length - this._availableInstanceIds.length; - } - get unusedVertexCount() { - return this._maxVertexCount - this._nextVertexStart; - } - get unusedIndexCount() { - return this._maxIndexCount - this._nextIndexStart; - } - constructor(maxInstanceCount, maxVertexCount, maxIndexCount = maxVertexCount * 2, material) { - super(new BufferGeometry(), material); - this.isBatchedMesh = true; - this.perObjectFrustumCulled = true; - this.sortObjects = true; - this.boundingBox = null; - this.boundingSphere = null; - this.customSort = null; - this._instanceInfo = []; - this._geometryInfo = []; - this._availableInstanceIds = []; - this._availableGeometryIds = []; - this._nextIndexStart = 0; - this._nextVertexStart = 0; - this._geometryCount = 0; - this._visibilityChanged = true; - this._geometryInitialized = false; - this._maxInstanceCount = maxInstanceCount; - this._maxVertexCount = maxVertexCount; - this._maxIndexCount = maxIndexCount; - this._multiDrawCounts = new Int32Array(maxInstanceCount); - this._multiDrawStarts = new Int32Array(maxInstanceCount); - this._multiDrawCount = 0; - this._multiDrawInstances = null; - this._matricesTexture = null; - this._indirectTexture = null; - this._colorsTexture = null; - this._initMatricesTexture(); - this._initIndirectTexture(); - } - _initMatricesTexture() { - let size = Math.sqrt(this._maxInstanceCount * 4); - size = Math.ceil(size / 4) * 4; - size = Math.max(size, 4); - const matricesArray = new Float32Array(size * size * 4); - const matricesTexture = new DataTexture(matricesArray, size, size, RGBAFormat, FloatType); - this._matricesTexture = matricesTexture; - } - _initIndirectTexture() { - let size = Math.sqrt(this._maxInstanceCount); - size = Math.ceil(size); - const indirectArray = new Uint32Array(size * size); - const indirectTexture = new DataTexture(indirectArray, size, size, RedIntegerFormat, UnsignedIntType); - this._indirectTexture = indirectTexture; - } - _initColorsTexture() { - let size = Math.sqrt(this._maxInstanceCount); - size = Math.ceil(size); - const colorsArray = new Float32Array(size * size * 4).fill(1); - const colorsTexture = new DataTexture(colorsArray, size, size, RGBAFormat, FloatType); - colorsTexture.colorSpace = ColorManagement.workingColorSpace; - this._colorsTexture = colorsTexture; - } - _initializeGeometry(reference) { - const geometry = this.geometry; - const maxVertexCount = this._maxVertexCount; - const maxIndexCount = this._maxIndexCount; - if (this._geometryInitialized === false) { - for (const attributeName in reference.attributes) { - const srcAttribute = reference.getAttribute(attributeName); - const { array, itemSize, normalized } = srcAttribute; - const dstArray = new array.constructor(maxVertexCount * itemSize); - const dstAttribute = new BufferAttribute(dstArray, itemSize, normalized); - geometry.setAttribute(attributeName, dstAttribute); - } - if (reference.getIndex() !== null) { - const indexArray = maxVertexCount > 65535 ? new Uint32Array(maxIndexCount) : new Uint16Array(maxIndexCount); - geometry.setIndex(new BufferAttribute(indexArray, 1)); - } - this._geometryInitialized = true; - } - } - // Make sure the geometry is compatible with the existing combined geometry attributes - _validateGeometry(geometry) { - const batchGeometry = this.geometry; - if (Boolean(geometry.getIndex()) !== Boolean(batchGeometry.getIndex())) { - throw new Error('BatchedMesh: All geometries must consistently have "index".'); - } - for (const attributeName in batchGeometry.attributes) { - if (!geometry.hasAttribute(attributeName)) { - throw new Error(`BatchedMesh: Added geometry missing "${attributeName}". All geometries must have consistent attributes.`); - } - const srcAttribute = geometry.getAttribute(attributeName); - const dstAttribute = batchGeometry.getAttribute(attributeName); - if (srcAttribute.itemSize !== dstAttribute.itemSize || srcAttribute.normalized !== dstAttribute.normalized) { - throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value."); - } - } - } - setCustomSort(func) { - this.customSort = func; - return this; - } - computeBoundingBox() { - if (this.boundingBox === null) { - this.boundingBox = new Box3(); - } - const boundingBox = this.boundingBox; - const instanceInfo = this._instanceInfo; - boundingBox.makeEmpty(); - for (let i = 0, l = instanceInfo.length; i < l; i++) { - if (instanceInfo[i].active === false) continue; - const geometryId = instanceInfo[i].geometryIndex; - this.getMatrixAt(i, _matrix$1); - this.getBoundingBoxAt(geometryId, _box$1).applyMatrix4(_matrix$1); - boundingBox.union(_box$1); - } - } - computeBoundingSphere() { - if (this.boundingSphere === null) { - this.boundingSphere = new Sphere(); - } - const boundingSphere = this.boundingSphere; - const instanceInfo = this._instanceInfo; - boundingSphere.makeEmpty(); - for (let i = 0, l = instanceInfo.length; i < l; i++) { - if (instanceInfo[i].active === false) continue; - const geometryId = instanceInfo[i].geometryIndex; - this.getMatrixAt(i, _matrix$1); - this.getBoundingSphereAt(geometryId, _sphere$2).applyMatrix4(_matrix$1); - boundingSphere.union(_sphere$2); - } - } - addInstance(geometryId) { - const atCapacity = this._instanceInfo.length >= this.maxInstanceCount; - if (atCapacity && this._availableInstanceIds.length === 0) { - throw new Error("BatchedMesh: Maximum item count reached."); - } - const instanceInfo = { - visible: true, - active: true, - geometryIndex: geometryId - }; - let drawId = null; - if (this._availableInstanceIds.length > 0) { - this._availableInstanceIds.sort(ascIdSort); - drawId = this._availableInstanceIds.shift(); - this._instanceInfo[drawId] = instanceInfo; - } else { - drawId = this._instanceInfo.length; - this._instanceInfo.push(instanceInfo); - } - const matricesTexture = this._matricesTexture; - _matrix$1.identity().toArray(matricesTexture.image.data, drawId * 16); - matricesTexture.needsUpdate = true; - const colorsTexture = this._colorsTexture; - if (colorsTexture) { - _whiteColor.toArray(colorsTexture.image.data, drawId * 4); - colorsTexture.needsUpdate = true; - } - this._visibilityChanged = true; - return drawId; - } - addGeometry(geometry, reservedVertexCount = -1, reservedIndexCount = -1) { - this._initializeGeometry(geometry); - this._validateGeometry(geometry); - const geometryInfo = { - // geometry information - vertexStart: -1, - vertexCount: -1, - reservedVertexCount: -1, - indexStart: -1, - indexCount: -1, - reservedIndexCount: -1, - // draw range information - start: -1, - count: -1, - // state - boundingBox: null, - boundingSphere: null, - active: true - }; - const geometryInfoList = this._geometryInfo; - geometryInfo.vertexStart = this._nextVertexStart; - geometryInfo.reservedVertexCount = reservedVertexCount === -1 ? geometry.getAttribute("position").count : reservedVertexCount; - const index = geometry.getIndex(); - const hasIndex = index !== null; - if (hasIndex) { - geometryInfo.indexStart = this._nextIndexStart; - geometryInfo.reservedIndexCount = reservedIndexCount === -1 ? index.count : reservedIndexCount; - } - if (geometryInfo.indexStart !== -1 && geometryInfo.indexStart + geometryInfo.reservedIndexCount > this._maxIndexCount || geometryInfo.vertexStart + geometryInfo.reservedVertexCount > this._maxVertexCount) { - throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size."); - } - let geometryId; - if (this._availableGeometryIds.length > 0) { - this._availableGeometryIds.sort(ascIdSort); - geometryId = this._availableGeometryIds.shift(); - geometryInfoList[geometryId] = geometryInfo; - } else { - geometryId = this._geometryCount; - this._geometryCount++; - geometryInfoList.push(geometryInfo); - } - this.setGeometryAt(geometryId, geometry); - this._nextIndexStart = geometryInfo.indexStart + geometryInfo.reservedIndexCount; - this._nextVertexStart = geometryInfo.vertexStart + geometryInfo.reservedVertexCount; - return geometryId; - } - setGeometryAt(geometryId, geometry) { - if (geometryId >= this._geometryCount) { - throw new Error("BatchedMesh: Maximum geometry count reached."); - } - this._validateGeometry(geometry); - const batchGeometry = this.geometry; - const hasIndex = batchGeometry.getIndex() !== null; - const dstIndex = batchGeometry.getIndex(); - const srcIndex = geometry.getIndex(); - const geometryInfo = this._geometryInfo[geometryId]; - if (hasIndex && srcIndex.count > geometryInfo.reservedIndexCount || geometry.attributes.position.count > geometryInfo.reservedVertexCount) { - throw new Error("BatchedMesh: Reserved space not large enough for provided geometry."); - } - const vertexStart = geometryInfo.vertexStart; - const reservedVertexCount = geometryInfo.reservedVertexCount; - geometryInfo.vertexCount = geometry.getAttribute("position").count; - for (const attributeName in batchGeometry.attributes) { - const srcAttribute = geometry.getAttribute(attributeName); - const dstAttribute = batchGeometry.getAttribute(attributeName); - copyAttributeData(srcAttribute, dstAttribute, vertexStart); - const itemSize = srcAttribute.itemSize; - for (let i = srcAttribute.count, l = reservedVertexCount; i < l; i++) { - const index = vertexStart + i; - for (let c = 0; c < itemSize; c++) { - dstAttribute.setComponent(index, c, 0); - } - } - dstAttribute.needsUpdate = true; - dstAttribute.addUpdateRange(vertexStart * itemSize, reservedVertexCount * itemSize); - } - if (hasIndex) { - const indexStart = geometryInfo.indexStart; - const reservedIndexCount = geometryInfo.reservedIndexCount; - geometryInfo.indexCount = geometry.getIndex().count; - for (let i = 0; i < srcIndex.count; i++) { - dstIndex.setX(indexStart + i, vertexStart + srcIndex.getX(i)); - } - for (let i = srcIndex.count, l = reservedIndexCount; i < l; i++) { - dstIndex.setX(indexStart + i, vertexStart); - } - dstIndex.needsUpdate = true; - dstIndex.addUpdateRange(indexStart, geometryInfo.reservedIndexCount); - } - geometryInfo.start = hasIndex ? geometryInfo.indexStart : geometryInfo.vertexStart; - geometryInfo.count = hasIndex ? geometryInfo.indexCount : geometryInfo.vertexCount; - geometryInfo.boundingBox = null; - if (geometry.boundingBox !== null) { - geometryInfo.boundingBox = geometry.boundingBox.clone(); - } - geometryInfo.boundingSphere = null; - if (geometry.boundingSphere !== null) { - geometryInfo.boundingSphere = geometry.boundingSphere.clone(); - } - this._visibilityChanged = true; - return geometryId; - } - deleteGeometry(geometryId) { - const geometryInfoList = this._geometryInfo; - if (geometryId >= geometryInfoList.length || geometryInfoList[geometryId].active === false) { - return this; - } - const instanceInfo = this._instanceInfo; - for (let i = 0, l = instanceInfo.length; i < l; i++) { - if (instanceInfo[i].geometryIndex === geometryId) { - this.deleteInstance(i); - } - } - geometryInfoList[geometryId].active = false; - this._availableGeometryIds.push(geometryId); - this._visibilityChanged = true; - return this; - } - deleteInstance(instanceId) { - const instanceInfo = this._instanceInfo; - if (instanceId >= instanceInfo.length || instanceInfo[instanceId].active === false) { - return this; - } - instanceInfo[instanceId].active = false; - this._availableInstanceIds.push(instanceId); - this._visibilityChanged = true; - return this; - } - optimize() { - let nextVertexStart = 0; - let nextIndexStart = 0; - const geometryInfoList = this._geometryInfo; - const indices = geometryInfoList.map((e, i) => i).sort((a, b) => { - return geometryInfoList[a].vertexStart - geometryInfoList[b].vertexStart; - }); - const geometry = this.geometry; - for (let i = 0, l = geometryInfoList.length; i < l; i++) { - const index = indices[i]; - const geometryInfo = geometryInfoList[index]; - if (geometryInfo.active === false) { - continue; - } - if (geometry.index !== null) { - if (geometryInfo.indexStart !== nextIndexStart) { - const { indexStart, vertexStart, reservedIndexCount } = geometryInfo; - const index2 = geometry.index; - const array = index2.array; - const elementDelta = nextVertexStart - vertexStart; - for (let j = indexStart; j < indexStart + reservedIndexCount; j++) { - array[j] = array[j] + elementDelta; - } - index2.array.copyWithin(nextIndexStart, indexStart, indexStart + reservedIndexCount); - index2.addUpdateRange(nextIndexStart, reservedIndexCount); - geometryInfo.indexStart = nextIndexStart; - } - nextIndexStart += geometryInfo.reservedIndexCount; - } - if (geometryInfo.vertexStart !== nextVertexStart) { - const { vertexStart, reservedVertexCount } = geometryInfo; - const attributes = geometry.attributes; - for (const key in attributes) { - const attribute = attributes[key]; - const { array, itemSize } = attribute; - array.copyWithin(nextVertexStart * itemSize, vertexStart * itemSize, (vertexStart + reservedVertexCount) * itemSize); - attribute.addUpdateRange(nextVertexStart * itemSize, reservedVertexCount * itemSize); - } - geometryInfo.vertexStart = nextVertexStart; - } - nextVertexStart += geometryInfo.reservedVertexCount; - geometryInfo.start = geometry.index ? geometryInfo.indexStart : geometryInfo.vertexStart; - this._nextIndexStart = geometry.index ? geometryInfo.indexStart + geometryInfo.reservedIndexCount : 0; - this._nextVertexStart = geometryInfo.vertexStart + geometryInfo.reservedVertexCount; - } - return this; - } - // get bounding box and compute it if it doesn't exist - getBoundingBoxAt(geometryId, target) { - if (geometryId >= this._geometryCount) { - return null; - } - const geometry = this.geometry; - const geometryInfo = this._geometryInfo[geometryId]; - if (geometryInfo.boundingBox === null) { - const box = new Box3(); - const index = geometry.index; - const position = geometry.attributes.position; - for (let i = geometryInfo.start, l = geometryInfo.start + geometryInfo.count; i < l; i++) { - let iv = i; - if (index) { - iv = index.getX(iv); - } - box.expandByPoint(_vector$5.fromBufferAttribute(position, iv)); - } - geometryInfo.boundingBox = box; - } - target.copy(geometryInfo.boundingBox); - return target; - } - // get bounding sphere and compute it if it doesn't exist - getBoundingSphereAt(geometryId, target) { - if (geometryId >= this._geometryCount) { - return null; - } - const geometry = this.geometry; - const geometryInfo = this._geometryInfo[geometryId]; - if (geometryInfo.boundingSphere === null) { - const sphere = new Sphere(); - this.getBoundingBoxAt(geometryId, _box$1); - _box$1.getCenter(sphere.center); - const index = geometry.index; - const position = geometry.attributes.position; - let maxRadiusSq = 0; - for (let i = geometryInfo.start, l = geometryInfo.start + geometryInfo.count; i < l; i++) { - let iv = i; - if (index) { - iv = index.getX(iv); - } - _vector$5.fromBufferAttribute(position, iv); - maxRadiusSq = Math.max(maxRadiusSq, sphere.center.distanceToSquared(_vector$5)); - } - sphere.radius = Math.sqrt(maxRadiusSq); - geometryInfo.boundingSphere = sphere; - } - target.copy(geometryInfo.boundingSphere); - return target; - } - setMatrixAt(instanceId, matrix) { - const instanceInfo = this._instanceInfo; - const matricesTexture = this._matricesTexture; - const matricesArray = this._matricesTexture.image.data; - if (instanceId >= instanceInfo.length || instanceInfo[instanceId].active === false) { - return this; - } - matrix.toArray(matricesArray, instanceId * 16); - matricesTexture.needsUpdate = true; - return this; - } - getMatrixAt(instanceId, matrix) { - const instanceInfo = this._instanceInfo; - const matricesArray = this._matricesTexture.image.data; - if (instanceId >= instanceInfo.length || instanceInfo[instanceId].active === false) { - return null; - } - return matrix.fromArray(matricesArray, instanceId * 16); - } - setColorAt(instanceId, color) { - if (this._colorsTexture === null) { - this._initColorsTexture(); - } - const colorsTexture = this._colorsTexture; - const colorsArray = this._colorsTexture.image.data; - const instanceInfo = this._instanceInfo; - if (instanceId >= instanceInfo.length || instanceInfo[instanceId].active === false) { - return this; - } - color.toArray(colorsArray, instanceId * 4); - colorsTexture.needsUpdate = true; - return this; - } - getColorAt(instanceId, color) { - const colorsArray = this._colorsTexture.image.data; - const instanceInfo = this._instanceInfo; - if (instanceId >= instanceInfo.length || instanceInfo[instanceId].active === false) { - return null; - } - return color.fromArray(colorsArray, instanceId * 4); - } - setVisibleAt(instanceId, value) { - const instanceInfo = this._instanceInfo; - if (instanceId >= instanceInfo.length || instanceInfo[instanceId].active === false || instanceInfo[instanceId].visible === value) { - return this; - } - instanceInfo[instanceId].visible = value; - this._visibilityChanged = true; - return this; - } - getVisibleAt(instanceId) { - const instanceInfo = this._instanceInfo; - if (instanceId >= instanceInfo.length || instanceInfo[instanceId].active === false) { - return false; - } - return instanceInfo[instanceId].visible; - } - setGeometryIdAt(instanceId, geometryId) { - const instanceInfo = this._instanceInfo; - const geometryInfoList = this._geometryInfo; - if (instanceId >= instanceInfo.length || instanceInfo[instanceId].active === false) { - return null; - } - if (geometryId >= geometryInfoList.length || geometryInfoList[geometryId].active === false) { - return null; - } - instanceInfo[instanceId].geometryIndex = geometryId; - return this; - } - getGeometryIdAt(instanceId) { - const instanceInfo = this._instanceInfo; - if (instanceId >= instanceInfo.length || instanceInfo[instanceId].active === false) { - return -1; - } - return instanceInfo[instanceId].geometryIndex; - } - getGeometryRangeAt(geometryId, target = {}) { - if (geometryId < 0 || geometryId >= this._geometryCount) { - return null; - } - const geometryInfo = this._geometryInfo[geometryId]; - target.vertexStart = geometryInfo.vertexStart; - target.vertexCount = geometryInfo.vertexCount; - target.reservedVertexCount = geometryInfo.reservedVertexCount; - target.indexStart = geometryInfo.indexStart; - target.indexCount = geometryInfo.indexCount; - target.reservedIndexCount = geometryInfo.reservedIndexCount; - target.start = geometryInfo.start; - target.count = geometryInfo.count; - return target; - } - setInstanceCount(maxInstanceCount) { - const availableInstanceIds = this._availableInstanceIds; - const instanceInfo = this._instanceInfo; - availableInstanceIds.sort(ascIdSort); - while (availableInstanceIds[availableInstanceIds.length - 1] === instanceInfo.length) { - instanceInfo.pop(); - availableInstanceIds.pop(); - } - if (maxInstanceCount < instanceInfo.length) { - throw new Error(`BatchedMesh: Instance ids outside the range ${maxInstanceCount} are being used. Cannot shrink instance count.`); - } - const multiDrawCounts = new Int32Array(maxInstanceCount); - const multiDrawStarts = new Int32Array(maxInstanceCount); - copyArrayContents(this._multiDrawCounts, multiDrawCounts); - copyArrayContents(this._multiDrawStarts, multiDrawStarts); - this._multiDrawCounts = multiDrawCounts; - this._multiDrawStarts = multiDrawStarts; - this._maxInstanceCount = maxInstanceCount; - const indirectTexture = this._indirectTexture; - const matricesTexture = this._matricesTexture; - const colorsTexture = this._colorsTexture; - indirectTexture.dispose(); - this._initIndirectTexture(); - copyArrayContents(indirectTexture.image.data, this._indirectTexture.image.data); - matricesTexture.dispose(); - this._initMatricesTexture(); - copyArrayContents(matricesTexture.image.data, this._matricesTexture.image.data); - if (colorsTexture) { - colorsTexture.dispose(); - this._initColorsTexture(); - copyArrayContents(colorsTexture.image.data, this._colorsTexture.image.data); - } - } - setGeometrySize(maxVertexCount, maxIndexCount) { - const validRanges = [...this._geometryInfo].filter((info) => info.active); - const requiredVertexLength = Math.max(...validRanges.map((range) => range.vertexStart + range.reservedVertexCount)); - if (requiredVertexLength > maxVertexCount) { - throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${maxIndexCount}. Cannot shrink further.`); - } - if (this.geometry.index) { - const requiredIndexLength = Math.max(...validRanges.map((range) => range.indexStart + range.reservedIndexCount)); - if (requiredIndexLength > maxIndexCount) { - throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${maxIndexCount}. Cannot shrink further.`); - } - } - const oldGeometry = this.geometry; - oldGeometry.dispose(); - this._maxVertexCount = maxVertexCount; - this._maxIndexCount = maxIndexCount; - if (this._geometryInitialized) { - this._geometryInitialized = false; - this.geometry = new BufferGeometry(); - this._initializeGeometry(oldGeometry); - } - const geometry = this.geometry; - if (oldGeometry.index) { - copyArrayContents(oldGeometry.index.array, geometry.index.array); - } - for (const key in oldGeometry.attributes) { - copyArrayContents(oldGeometry.attributes[key].array, geometry.attributes[key].array); - } - } - raycast(raycaster, intersects2) { - const instanceInfo = this._instanceInfo; - const geometryInfoList = this._geometryInfo; - const matrixWorld = this.matrixWorld; - const batchGeometry = this.geometry; - _mesh.material = this.material; - _mesh.geometry.index = batchGeometry.index; - _mesh.geometry.attributes = batchGeometry.attributes; - if (_mesh.geometry.boundingBox === null) { - _mesh.geometry.boundingBox = new Box3(); - } - if (_mesh.geometry.boundingSphere === null) { - _mesh.geometry.boundingSphere = new Sphere(); - } - for (let i = 0, l = instanceInfo.length; i < l; i++) { - if (!instanceInfo[i].visible || !instanceInfo[i].active) { - continue; - } - const geometryId = instanceInfo[i].geometryIndex; - const geometryInfo = geometryInfoList[geometryId]; - _mesh.geometry.setDrawRange(geometryInfo.start, geometryInfo.count); - this.getMatrixAt(i, _mesh.matrixWorld).premultiply(matrixWorld); - this.getBoundingBoxAt(geometryId, _mesh.geometry.boundingBox); - this.getBoundingSphereAt(geometryId, _mesh.geometry.boundingSphere); - _mesh.raycast(raycaster, _batchIntersects); - for (let j = 0, l2 = _batchIntersects.length; j < l2; j++) { - const intersect2 = _batchIntersects[j]; - intersect2.object = this; - intersect2.batchId = i; - intersects2.push(intersect2); - } - _batchIntersects.length = 0; - } - _mesh.material = null; - _mesh.geometry.index = null; - _mesh.geometry.attributes = {}; - _mesh.geometry.setDrawRange(0, Infinity); - } - copy(source) { - super.copy(source); - this.geometry = source.geometry.clone(); - this.perObjectFrustumCulled = source.perObjectFrustumCulled; - this.sortObjects = source.sortObjects; - this.boundingBox = source.boundingBox !== null ? source.boundingBox.clone() : null; - this.boundingSphere = source.boundingSphere !== null ? source.boundingSphere.clone() : null; - this._geometryInfo = source._geometryInfo.map((info) => ({ - ...info, - boundingBox: info.boundingBox !== null ? info.boundingBox.clone() : null, - boundingSphere: info.boundingSphere !== null ? info.boundingSphere.clone() : null - })); - this._instanceInfo = source._instanceInfo.map((info) => ({ ...info })); - this._maxInstanceCount = source._maxInstanceCount; - this._maxVertexCount = source._maxVertexCount; - this._maxIndexCount = source._maxIndexCount; - this._geometryInitialized = source._geometryInitialized; - this._geometryCount = source._geometryCount; - this._multiDrawCounts = source._multiDrawCounts.slice(); - this._multiDrawStarts = source._multiDrawStarts.slice(); - this._matricesTexture = source._matricesTexture.clone(); - this._matricesTexture.image.data = this._matricesTexture.image.data.slice(); - if (this._colorsTexture !== null) { - this._colorsTexture = source._colorsTexture.clone(); - this._colorsTexture.image.data = this._colorsTexture.image.data.slice(); - } - return this; - } - dispose() { - this.geometry.dispose(); - this._matricesTexture.dispose(); - this._matricesTexture = null; - this._indirectTexture.dispose(); - this._indirectTexture = null; - if (this._colorsTexture !== null) { - this._colorsTexture.dispose(); - this._colorsTexture = null; - } - return this; - } - onBeforeRender(renderer, scene, camera, geometry, material) { - if (!this._visibilityChanged && !this.perObjectFrustumCulled && !this.sortObjects) { - return; - } - const index = geometry.getIndex(); - const bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT; - const instanceInfo = this._instanceInfo; - const multiDrawStarts = this._multiDrawStarts; - const multiDrawCounts = this._multiDrawCounts; - const geometryInfoList = this._geometryInfo; - const perObjectFrustumCulled = this.perObjectFrustumCulled; - const indirectTexture = this._indirectTexture; - const indirectArray = indirectTexture.image.data; - if (perObjectFrustumCulled) { - _matrix$1.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse).multiply(this.matrixWorld); - _frustum.setFromProjectionMatrix( - _matrix$1, - renderer.coordinateSystem - ); - } - let multiDrawCount = 0; - if (this.sortObjects) { - _matrix$1.copy(this.matrixWorld).invert(); - _vector$5.setFromMatrixPosition(camera.matrixWorld).applyMatrix4(_matrix$1); - _forward.set(0, 0, -1).transformDirection(camera.matrixWorld).transformDirection(_matrix$1); - for (let i = 0, l = instanceInfo.length; i < l; i++) { - if (instanceInfo[i].visible && instanceInfo[i].active) { - const geometryId = instanceInfo[i].geometryIndex; - this.getMatrixAt(i, _matrix$1); - this.getBoundingSphereAt(geometryId, _sphere$2).applyMatrix4(_matrix$1); - let culled = false; - if (perObjectFrustumCulled) { - culled = !_frustum.intersectsSphere(_sphere$2); - } - if (!culled) { - const geometryInfo = geometryInfoList[geometryId]; - const z = _temp.subVectors(_sphere$2.center, _vector$5).dot(_forward); - _renderList.push(geometryInfo.start, geometryInfo.count, z, i); - } - } - } - const list = _renderList.list; - const customSort = this.customSort; - if (customSort === null) { - list.sort(material.transparent ? sortTransparent : sortOpaque); - } else { - customSort.call(this, list, camera); - } - for (let i = 0, l = list.length; i < l; i++) { - const item = list[i]; - multiDrawStarts[multiDrawCount] = item.start * bytesPerElement; - multiDrawCounts[multiDrawCount] = item.count; - indirectArray[multiDrawCount] = item.index; - multiDrawCount++; - } - _renderList.reset(); - } else { - for (let i = 0, l = instanceInfo.length; i < l; i++) { - if (instanceInfo[i].visible && instanceInfo[i].active) { - const geometryId = instanceInfo[i].geometryIndex; - let culled = false; - if (perObjectFrustumCulled) { - this.getMatrixAt(i, _matrix$1); - this.getBoundingSphereAt(geometryId, _sphere$2).applyMatrix4(_matrix$1); - culled = !_frustum.intersectsSphere(_sphere$2); - } - if (!culled) { - const geometryInfo = geometryInfoList[geometryId]; - multiDrawStarts[multiDrawCount] = geometryInfo.start * bytesPerElement; - multiDrawCounts[multiDrawCount] = geometryInfo.count; - indirectArray[multiDrawCount] = i; - multiDrawCount++; - } - } - } - } - indirectTexture.needsUpdate = true; - this._multiDrawCount = multiDrawCount; - this._visibilityChanged = false; - } - onBeforeShadow(renderer, object, camera, shadowCamera, geometry, depthMaterial) { - this.onBeforeRender(renderer, null, shadowCamera, geometry, depthMaterial); - } -} -class LineBasicMaterial extends Material { - static { - __name(this, "LineBasicMaterial"); - } - static get type() { - return "LineBasicMaterial"; - } - constructor(parameters) { - super(); - this.isLineBasicMaterial = true; - this.color = new Color(16777215); - this.map = null; - this.linewidth = 1; - this.linecap = "round"; - this.linejoin = "round"; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.map = source.map; - this.linewidth = source.linewidth; - this.linecap = source.linecap; - this.linejoin = source.linejoin; - this.fog = source.fog; - return this; - } -} -const _vStart = /* @__PURE__ */ new Vector3(); -const _vEnd = /* @__PURE__ */ new Vector3(); -const _inverseMatrix$1 = /* @__PURE__ */ new Matrix4(); -const _ray$1 = /* @__PURE__ */ new Ray(); -const _sphere$1 = /* @__PURE__ */ new Sphere(); -const _intersectPointOnRay = /* @__PURE__ */ new Vector3(); -const _intersectPointOnSegment = /* @__PURE__ */ new Vector3(); -class Line extends Object3D { - static { - __name(this, "Line"); - } - constructor(geometry = new BufferGeometry(), material = new LineBasicMaterial()) { - super(); - this.isLine = true; - this.type = "Line"; - this.geometry = geometry; - this.material = material; - this.updateMorphTargets(); - } - copy(source, recursive) { - super.copy(source, recursive); - this.material = Array.isArray(source.material) ? source.material.slice() : source.material; - this.geometry = source.geometry; - return this; - } - computeLineDistances() { - const geometry = this.geometry; - if (geometry.index === null) { - const positionAttribute = geometry.attributes.position; - const lineDistances = [0]; - for (let i = 1, l = positionAttribute.count; i < l; i++) { - _vStart.fromBufferAttribute(positionAttribute, i - 1); - _vEnd.fromBufferAttribute(positionAttribute, i); - lineDistances[i] = lineDistances[i - 1]; - lineDistances[i] += _vStart.distanceTo(_vEnd); - } - geometry.setAttribute("lineDistance", new Float32BufferAttribute(lineDistances, 1)); - } else { - console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); - } - return this; - } - raycast(raycaster, intersects2) { - const geometry = this.geometry; - const matrixWorld = this.matrixWorld; - const threshold = raycaster.params.Line.threshold; - const drawRange = geometry.drawRange; - if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); - _sphere$1.copy(geometry.boundingSphere); - _sphere$1.applyMatrix4(matrixWorld); - _sphere$1.radius += threshold; - if (raycaster.ray.intersectsSphere(_sphere$1) === false) return; - _inverseMatrix$1.copy(matrixWorld).invert(); - _ray$1.copy(raycaster.ray).applyMatrix4(_inverseMatrix$1); - const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3); - const localThresholdSq = localThreshold * localThreshold; - const step = this.isLineSegments ? 2 : 1; - const index = geometry.index; - const attributes = geometry.attributes; - const positionAttribute = attributes.position; - if (index !== null) { - const start = Math.max(0, drawRange.start); - const end = Math.min(index.count, drawRange.start + drawRange.count); - for (let i = start, l = end - 1; i < l; i += step) { - const a = index.getX(i); - const b = index.getX(i + 1); - const intersect2 = checkIntersection(this, raycaster, _ray$1, localThresholdSq, a, b); - if (intersect2) { - intersects2.push(intersect2); - } - } - if (this.isLineLoop) { - const a = index.getX(end - 1); - const b = index.getX(start); - const intersect2 = checkIntersection(this, raycaster, _ray$1, localThresholdSq, a, b); - if (intersect2) { - intersects2.push(intersect2); - } - } - } else { - const start = Math.max(0, drawRange.start); - const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count); - for (let i = start, l = end - 1; i < l; i += step) { - const intersect2 = checkIntersection(this, raycaster, _ray$1, localThresholdSq, i, i + 1); - if (intersect2) { - intersects2.push(intersect2); - } - } - if (this.isLineLoop) { - const intersect2 = checkIntersection(this, raycaster, _ray$1, localThresholdSq, end - 1, start); - if (intersect2) { - intersects2.push(intersect2); - } - } - } - } - updateMorphTargets() { - const geometry = this.geometry; - const morphAttributes = geometry.morphAttributes; - const keys = Object.keys(morphAttributes); - if (keys.length > 0) { - const morphAttribute = morphAttributes[keys[0]]; - if (morphAttribute !== void 0) { - this.morphTargetInfluences = []; - this.morphTargetDictionary = {}; - for (let m = 0, ml = morphAttribute.length; m < ml; m++) { - const name = morphAttribute[m].name || String(m); - this.morphTargetInfluences.push(0); - this.morphTargetDictionary[name] = m; - } - } - } - } -} -function checkIntersection(object, raycaster, ray, thresholdSq, a, b) { - const positionAttribute = object.geometry.attributes.position; - _vStart.fromBufferAttribute(positionAttribute, a); - _vEnd.fromBufferAttribute(positionAttribute, b); - const distSq = ray.distanceSqToSegment(_vStart, _vEnd, _intersectPointOnRay, _intersectPointOnSegment); - if (distSq > thresholdSq) return; - _intersectPointOnRay.applyMatrix4(object.matrixWorld); - const distance = raycaster.ray.origin.distanceTo(_intersectPointOnRay); - if (distance < raycaster.near || distance > raycaster.far) return; - return { - distance, - // What do we want? intersection point on the ray or on the segment?? - // point: raycaster.ray.at( distance ), - point: _intersectPointOnSegment.clone().applyMatrix4(object.matrixWorld), - index: a, - face: null, - faceIndex: null, - barycoord: null, - object - }; -} -__name(checkIntersection, "checkIntersection"); -const _start = /* @__PURE__ */ new Vector3(); -const _end = /* @__PURE__ */ new Vector3(); -class LineSegments extends Line { - static { - __name(this, "LineSegments"); - } - constructor(geometry, material) { - super(geometry, material); - this.isLineSegments = true; - this.type = "LineSegments"; - } - computeLineDistances() { - const geometry = this.geometry; - if (geometry.index === null) { - const positionAttribute = geometry.attributes.position; - const lineDistances = []; - for (let i = 0, l = positionAttribute.count; i < l; i += 2) { - _start.fromBufferAttribute(positionAttribute, i); - _end.fromBufferAttribute(positionAttribute, i + 1); - lineDistances[i] = i === 0 ? 0 : lineDistances[i - 1]; - lineDistances[i + 1] = lineDistances[i] + _start.distanceTo(_end); - } - geometry.setAttribute("lineDistance", new Float32BufferAttribute(lineDistances, 1)); - } else { - console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); - } - return this; - } -} -class LineLoop extends Line { - static { - __name(this, "LineLoop"); - } - constructor(geometry, material) { - super(geometry, material); - this.isLineLoop = true; - this.type = "LineLoop"; - } -} -class PointsMaterial extends Material { - static { - __name(this, "PointsMaterial"); - } - static get type() { - return "PointsMaterial"; - } - constructor(parameters) { - super(); - this.isPointsMaterial = true; - this.color = new Color(16777215); - this.map = null; - this.alphaMap = null; - this.size = 1; - this.sizeAttenuation = true; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.map = source.map; - this.alphaMap = source.alphaMap; - this.size = source.size; - this.sizeAttenuation = source.sizeAttenuation; - this.fog = source.fog; - return this; - } -} -const _inverseMatrix = /* @__PURE__ */ new Matrix4(); -const _ray$4 = /* @__PURE__ */ new Ray(); -const _sphere = /* @__PURE__ */ new Sphere(); -const _position$2 = /* @__PURE__ */ new Vector3(); -class Points extends Object3D { - static { - __name(this, "Points"); - } - constructor(geometry = new BufferGeometry(), material = new PointsMaterial()) { - super(); - this.isPoints = true; - this.type = "Points"; - this.geometry = geometry; - this.material = material; - this.updateMorphTargets(); - } - copy(source, recursive) { - super.copy(source, recursive); - this.material = Array.isArray(source.material) ? source.material.slice() : source.material; - this.geometry = source.geometry; - return this; - } - raycast(raycaster, intersects2) { - const geometry = this.geometry; - const matrixWorld = this.matrixWorld; - const threshold = raycaster.params.Points.threshold; - const drawRange = geometry.drawRange; - if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); - _sphere.copy(geometry.boundingSphere); - _sphere.applyMatrix4(matrixWorld); - _sphere.radius += threshold; - if (raycaster.ray.intersectsSphere(_sphere) === false) return; - _inverseMatrix.copy(matrixWorld).invert(); - _ray$4.copy(raycaster.ray).applyMatrix4(_inverseMatrix); - const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3); - const localThresholdSq = localThreshold * localThreshold; - const index = geometry.index; - const attributes = geometry.attributes; - const positionAttribute = attributes.position; - if (index !== null) { - const start = Math.max(0, drawRange.start); - const end = Math.min(index.count, drawRange.start + drawRange.count); - for (let i = start, il = end; i < il; i++) { - const a = index.getX(i); - _position$2.fromBufferAttribute(positionAttribute, a); - testPoint(_position$2, a, localThresholdSq, matrixWorld, raycaster, intersects2, this); - } - } else { - const start = Math.max(0, drawRange.start); - const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count); - for (let i = start, l = end; i < l; i++) { - _position$2.fromBufferAttribute(positionAttribute, i); - testPoint(_position$2, i, localThresholdSq, matrixWorld, raycaster, intersects2, this); - } - } - } - updateMorphTargets() { - const geometry = this.geometry; - const morphAttributes = geometry.morphAttributes; - const keys = Object.keys(morphAttributes); - if (keys.length > 0) { - const morphAttribute = morphAttributes[keys[0]]; - if (morphAttribute !== void 0) { - this.morphTargetInfluences = []; - this.morphTargetDictionary = {}; - for (let m = 0, ml = morphAttribute.length; m < ml; m++) { - const name = morphAttribute[m].name || String(m); - this.morphTargetInfluences.push(0); - this.morphTargetDictionary[name] = m; - } - } - } - } -} -function testPoint(point, index, localThresholdSq, matrixWorld, raycaster, intersects2, object) { - const rayPointDistanceSq = _ray$4.distanceSqToPoint(point); - if (rayPointDistanceSq < localThresholdSq) { - const intersectPoint = new Vector3(); - _ray$4.closestPointToPoint(point, intersectPoint); - intersectPoint.applyMatrix4(matrixWorld); - const distance = raycaster.ray.origin.distanceTo(intersectPoint); - if (distance < raycaster.near || distance > raycaster.far) return; - intersects2.push({ - distance, - distanceToRay: Math.sqrt(rayPointDistanceSq), - point: intersectPoint, - index, - face: null, - faceIndex: null, - barycoord: null, - object - }); - } -} -__name(testPoint, "testPoint"); -class VideoTexture extends Texture { - static { - __name(this, "VideoTexture"); - } - constructor(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) { - super(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); - this.isVideoTexture = true; - this.minFilter = minFilter !== void 0 ? minFilter : LinearFilter; - this.magFilter = magFilter !== void 0 ? magFilter : LinearFilter; - this.generateMipmaps = false; - const scope = this; - function updateVideo() { - scope.needsUpdate = true; - video.requestVideoFrameCallback(updateVideo); - } - __name(updateVideo, "updateVideo"); - if ("requestVideoFrameCallback" in video) { - video.requestVideoFrameCallback(updateVideo); - } - } - clone() { - return new this.constructor(this.image).copy(this); - } - update() { - const video = this.image; - const hasVideoFrameCallback = "requestVideoFrameCallback" in video; - if (hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA) { - this.needsUpdate = true; - } - } -} -class FramebufferTexture extends Texture { - static { - __name(this, "FramebufferTexture"); - } - constructor(width, height) { - super({ width, height }); - this.isFramebufferTexture = true; - this.magFilter = NearestFilter; - this.minFilter = NearestFilter; - this.generateMipmaps = false; - this.needsUpdate = true; - } -} -class CompressedTexture extends Texture { - static { - __name(this, "CompressedTexture"); - } - constructor(mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, colorSpace) { - super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, colorSpace); - this.isCompressedTexture = true; - this.image = { width, height }; - this.mipmaps = mipmaps; - this.flipY = false; - this.generateMipmaps = false; - } -} -class CompressedArrayTexture extends CompressedTexture { - static { - __name(this, "CompressedArrayTexture"); - } - constructor(mipmaps, width, height, depth, format, type) { - super(mipmaps, width, height, format, type); - this.isCompressedArrayTexture = true; - this.image.depth = depth; - this.wrapR = ClampToEdgeWrapping; - this.layerUpdates = /* @__PURE__ */ new Set(); - } - addLayerUpdate(layerIndex) { - this.layerUpdates.add(layerIndex); - } - clearLayerUpdates() { - this.layerUpdates.clear(); - } -} -class CompressedCubeTexture extends CompressedTexture { - static { - __name(this, "CompressedCubeTexture"); - } - constructor(images, format, type) { - super(void 0, images[0].width, images[0].height, format, type, CubeReflectionMapping); - this.isCompressedCubeTexture = true; - this.isCubeTexture = true; - this.image = images; - } -} -class CanvasTexture extends Texture { - static { - __name(this, "CanvasTexture"); - } - constructor(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) { - super(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); - this.isCanvasTexture = true; - this.needsUpdate = true; - } -} -class Curve { - static { - __name(this, "Curve"); - } - constructor() { - this.type = "Curve"; - this.arcLengthDivisions = 200; - } - // Virtual base class method to overwrite and implement in subclasses - // - t [0 .. 1] - getPoint() { - console.warn("THREE.Curve: .getPoint() not implemented."); - return null; - } - // Get point at relative position in curve according to arc length - // - u [0 .. 1] - getPointAt(u, optionalTarget) { - const t2 = this.getUtoTmapping(u); - return this.getPoint(t2, optionalTarget); - } - // Get sequence of points using getPoint( t ) - getPoints(divisions = 5) { - const points = []; - for (let d = 0; d <= divisions; d++) { - points.push(this.getPoint(d / divisions)); - } - return points; - } - // Get sequence of points using getPointAt( u ) - getSpacedPoints(divisions = 5) { - const points = []; - for (let d = 0; d <= divisions; d++) { - points.push(this.getPointAt(d / divisions)); - } - return points; - } - // Get total curve arc length - getLength() { - const lengths = this.getLengths(); - return lengths[lengths.length - 1]; - } - // Get list of cumulative segment lengths - getLengths(divisions = this.arcLengthDivisions) { - if (this.cacheArcLengths && this.cacheArcLengths.length === divisions + 1 && !this.needsUpdate) { - return this.cacheArcLengths; - } - this.needsUpdate = false; - const cache = []; - let current, last = this.getPoint(0); - let sum = 0; - cache.push(0); - for (let p = 1; p <= divisions; p++) { - current = this.getPoint(p / divisions); - sum += current.distanceTo(last); - cache.push(sum); - last = current; - } - this.cacheArcLengths = cache; - return cache; - } - updateArcLengths() { - this.needsUpdate = true; - this.getLengths(); - } - // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant - getUtoTmapping(u, distance) { - const arcLengths = this.getLengths(); - let i = 0; - const il = arcLengths.length; - let targetArcLength; - if (distance) { - targetArcLength = distance; - } else { - targetArcLength = u * arcLengths[il - 1]; - } - let low = 0, high = il - 1, comparison; - while (low <= high) { - i = Math.floor(low + (high - low) / 2); - comparison = arcLengths[i] - targetArcLength; - if (comparison < 0) { - low = i + 1; - } else if (comparison > 0) { - high = i - 1; - } else { - high = i; - break; - } - } - i = high; - if (arcLengths[i] === targetArcLength) { - return i / (il - 1); - } - const lengthBefore = arcLengths[i]; - const lengthAfter = arcLengths[i + 1]; - const segmentLength = lengthAfter - lengthBefore; - const segmentFraction = (targetArcLength - lengthBefore) / segmentLength; - const t2 = (i + segmentFraction) / (il - 1); - return t2; - } - // Returns a unit vector tangent at t - // In case any sub curve does not implement its tangent derivation, - // 2 points a small delta apart will be used to find its gradient - // which seems to give a reasonable approximation - getTangent(t2, optionalTarget) { - const delta = 1e-4; - let t1 = t2 - delta; - let t22 = t2 + delta; - if (t1 < 0) t1 = 0; - if (t22 > 1) t22 = 1; - const pt1 = this.getPoint(t1); - const pt2 = this.getPoint(t22); - const tangent = optionalTarget || (pt1.isVector2 ? new Vector2() : new Vector3()); - tangent.copy(pt2).sub(pt1).normalize(); - return tangent; - } - getTangentAt(u, optionalTarget) { - const t2 = this.getUtoTmapping(u); - return this.getTangent(t2, optionalTarget); - } - computeFrenetFrames(segments, closed) { - const normal = new Vector3(); - const tangents = []; - const normals = []; - const binormals = []; - const vec = new Vector3(); - const mat = new Matrix4(); - for (let i = 0; i <= segments; i++) { - const u = i / segments; - tangents[i] = this.getTangentAt(u, new Vector3()); - } - normals[0] = new Vector3(); - binormals[0] = new Vector3(); - let min = Number.MAX_VALUE; - const tx = Math.abs(tangents[0].x); - const ty = Math.abs(tangents[0].y); - const tz = Math.abs(tangents[0].z); - if (tx <= min) { - min = tx; - normal.set(1, 0, 0); - } - if (ty <= min) { - min = ty; - normal.set(0, 1, 0); - } - if (tz <= min) { - normal.set(0, 0, 1); - } - vec.crossVectors(tangents[0], normal).normalize(); - normals[0].crossVectors(tangents[0], vec); - binormals[0].crossVectors(tangents[0], normals[0]); - for (let i = 1; i <= segments; i++) { - normals[i] = normals[i - 1].clone(); - binormals[i] = binormals[i - 1].clone(); - vec.crossVectors(tangents[i - 1], tangents[i]); - if (vec.length() > Number.EPSILON) { - vec.normalize(); - const theta = Math.acos(clamp(tangents[i - 1].dot(tangents[i]), -1, 1)); - normals[i].applyMatrix4(mat.makeRotationAxis(vec, theta)); - } - binormals[i].crossVectors(tangents[i], normals[i]); - } - if (closed === true) { - let theta = Math.acos(clamp(normals[0].dot(normals[segments]), -1, 1)); - theta /= segments; - if (tangents[0].dot(vec.crossVectors(normals[0], normals[segments])) > 0) { - theta = -theta; - } - for (let i = 1; i <= segments; i++) { - normals[i].applyMatrix4(mat.makeRotationAxis(tangents[i], theta * i)); - binormals[i].crossVectors(tangents[i], normals[i]); - } - } - return { - tangents, - normals, - binormals - }; - } - clone() { - return new this.constructor().copy(this); - } - copy(source) { - this.arcLengthDivisions = source.arcLengthDivisions; - return this; - } - toJSON() { - const data = { - metadata: { - version: 4.6, - type: "Curve", - generator: "Curve.toJSON" - } - }; - data.arcLengthDivisions = this.arcLengthDivisions; - data.type = this.type; - return data; - } - fromJSON(json) { - this.arcLengthDivisions = json.arcLengthDivisions; - return this; - } -} -class EllipseCurve extends Curve { - static { - __name(this, "EllipseCurve"); - } - constructor(aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0) { - super(); - this.isEllipseCurve = true; - this.type = "EllipseCurve"; - this.aX = aX; - this.aY = aY; - this.xRadius = xRadius; - this.yRadius = yRadius; - this.aStartAngle = aStartAngle; - this.aEndAngle = aEndAngle; - this.aClockwise = aClockwise; - this.aRotation = aRotation; - } - getPoint(t2, optionalTarget = new Vector2()) { - const point = optionalTarget; - const twoPi = Math.PI * 2; - let deltaAngle = this.aEndAngle - this.aStartAngle; - const samePoints = Math.abs(deltaAngle) < Number.EPSILON; - while (deltaAngle < 0) deltaAngle += twoPi; - while (deltaAngle > twoPi) deltaAngle -= twoPi; - if (deltaAngle < Number.EPSILON) { - if (samePoints) { - deltaAngle = 0; - } else { - deltaAngle = twoPi; - } - } - if (this.aClockwise === true && !samePoints) { - if (deltaAngle === twoPi) { - deltaAngle = -twoPi; - } else { - deltaAngle = deltaAngle - twoPi; - } - } - const angle = this.aStartAngle + t2 * deltaAngle; - let x = this.aX + this.xRadius * Math.cos(angle); - let y = this.aY + this.yRadius * Math.sin(angle); - if (this.aRotation !== 0) { - const cos = Math.cos(this.aRotation); - const sin = Math.sin(this.aRotation); - const tx = x - this.aX; - const ty = y - this.aY; - x = tx * cos - ty * sin + this.aX; - y = tx * sin + ty * cos + this.aY; - } - return point.set(x, y); - } - copy(source) { - super.copy(source); - this.aX = source.aX; - this.aY = source.aY; - this.xRadius = source.xRadius; - this.yRadius = source.yRadius; - this.aStartAngle = source.aStartAngle; - this.aEndAngle = source.aEndAngle; - this.aClockwise = source.aClockwise; - this.aRotation = source.aRotation; - return this; - } - toJSON() { - const data = super.toJSON(); - data.aX = this.aX; - data.aY = this.aY; - data.xRadius = this.xRadius; - data.yRadius = this.yRadius; - data.aStartAngle = this.aStartAngle; - data.aEndAngle = this.aEndAngle; - data.aClockwise = this.aClockwise; - data.aRotation = this.aRotation; - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.aX = json.aX; - this.aY = json.aY; - this.xRadius = json.xRadius; - this.yRadius = json.yRadius; - this.aStartAngle = json.aStartAngle; - this.aEndAngle = json.aEndAngle; - this.aClockwise = json.aClockwise; - this.aRotation = json.aRotation; - return this; - } -} -class ArcCurve extends EllipseCurve { - static { - __name(this, "ArcCurve"); - } - constructor(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { - super(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); - this.isArcCurve = true; - this.type = "ArcCurve"; - } -} -function CubicPoly() { - let c0 = 0, c1 = 0, c2 = 0, c3 = 0; - function init(x0, x1, t0, t1) { - c0 = x0; - c1 = t0; - c2 = -3 * x0 + 3 * x1 - 2 * t0 - t1; - c3 = 2 * x0 - 2 * x1 + t0 + t1; - } - __name(init, "init"); - return { - initCatmullRom: /* @__PURE__ */ __name(function(x0, x1, x2, x3, tension) { - init(x1, x2, tension * (x2 - x0), tension * (x3 - x1)); - }, "initCatmullRom"), - initNonuniformCatmullRom: /* @__PURE__ */ __name(function(x0, x1, x2, x3, dt0, dt1, dt2) { - let t1 = (x1 - x0) / dt0 - (x2 - x0) / (dt0 + dt1) + (x2 - x1) / dt1; - let t2 = (x2 - x1) / dt1 - (x3 - x1) / (dt1 + dt2) + (x3 - x2) / dt2; - t1 *= dt1; - t2 *= dt1; - init(x1, x2, t1, t2); - }, "initNonuniformCatmullRom"), - calc: /* @__PURE__ */ __name(function(t2) { - const t22 = t2 * t2; - const t3 = t22 * t2; - return c0 + c1 * t2 + c2 * t22 + c3 * t3; - }, "calc") - }; -} -__name(CubicPoly, "CubicPoly"); -const tmp = /* @__PURE__ */ new Vector3(); -const px = /* @__PURE__ */ new CubicPoly(); -const py = /* @__PURE__ */ new CubicPoly(); -const pz = /* @__PURE__ */ new CubicPoly(); -class CatmullRomCurve3 extends Curve { - static { - __name(this, "CatmullRomCurve3"); - } - constructor(points = [], closed = false, curveType = "centripetal", tension = 0.5) { - super(); - this.isCatmullRomCurve3 = true; - this.type = "CatmullRomCurve3"; - this.points = points; - this.closed = closed; - this.curveType = curveType; - this.tension = tension; - } - getPoint(t2, optionalTarget = new Vector3()) { - const point = optionalTarget; - const points = this.points; - const l = points.length; - const p = (l - (this.closed ? 0 : 1)) * t2; - let intPoint = Math.floor(p); - let weight = p - intPoint; - if (this.closed) { - intPoint += intPoint > 0 ? 0 : (Math.floor(Math.abs(intPoint) / l) + 1) * l; - } else if (weight === 0 && intPoint === l - 1) { - intPoint = l - 2; - weight = 1; - } - let p0, p3; - if (this.closed || intPoint > 0) { - p0 = points[(intPoint - 1) % l]; - } else { - tmp.subVectors(points[0], points[1]).add(points[0]); - p0 = tmp; - } - const p1 = points[intPoint % l]; - const p2 = points[(intPoint + 1) % l]; - if (this.closed || intPoint + 2 < l) { - p3 = points[(intPoint + 2) % l]; - } else { - tmp.subVectors(points[l - 1], points[l - 2]).add(points[l - 1]); - p3 = tmp; - } - if (this.curveType === "centripetal" || this.curveType === "chordal") { - const pow = this.curveType === "chordal" ? 0.5 : 0.25; - let dt0 = Math.pow(p0.distanceToSquared(p1), pow); - let dt1 = Math.pow(p1.distanceToSquared(p2), pow); - let dt2 = Math.pow(p2.distanceToSquared(p3), pow); - if (dt1 < 1e-4) dt1 = 1; - if (dt0 < 1e-4) dt0 = dt1; - if (dt2 < 1e-4) dt2 = dt1; - px.initNonuniformCatmullRom(p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2); - py.initNonuniformCatmullRom(p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2); - pz.initNonuniformCatmullRom(p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2); - } else if (this.curveType === "catmullrom") { - px.initCatmullRom(p0.x, p1.x, p2.x, p3.x, this.tension); - py.initCatmullRom(p0.y, p1.y, p2.y, p3.y, this.tension); - pz.initCatmullRom(p0.z, p1.z, p2.z, p3.z, this.tension); - } - point.set( - px.calc(weight), - py.calc(weight), - pz.calc(weight) - ); - return point; - } - copy(source) { - super.copy(source); - this.points = []; - for (let i = 0, l = source.points.length; i < l; i++) { - const point = source.points[i]; - this.points.push(point.clone()); - } - this.closed = source.closed; - this.curveType = source.curveType; - this.tension = source.tension; - return this; - } - toJSON() { - const data = super.toJSON(); - data.points = []; - for (let i = 0, l = this.points.length; i < l; i++) { - const point = this.points[i]; - data.points.push(point.toArray()); - } - data.closed = this.closed; - data.curveType = this.curveType; - data.tension = this.tension; - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.points = []; - for (let i = 0, l = json.points.length; i < l; i++) { - const point = json.points[i]; - this.points.push(new Vector3().fromArray(point)); - } - this.closed = json.closed; - this.curveType = json.curveType; - this.tension = json.tension; - return this; - } -} -function CatmullRom(t2, p0, p1, p2, p3) { - const v0 = (p2 - p0) * 0.5; - const v1 = (p3 - p1) * 0.5; - const t22 = t2 * t2; - const t3 = t2 * t22; - return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t22 + v0 * t2 + p1; -} -__name(CatmullRom, "CatmullRom"); -function QuadraticBezierP0(t2, p) { - const k = 1 - t2; - return k * k * p; -} -__name(QuadraticBezierP0, "QuadraticBezierP0"); -function QuadraticBezierP1(t2, p) { - return 2 * (1 - t2) * t2 * p; -} -__name(QuadraticBezierP1, "QuadraticBezierP1"); -function QuadraticBezierP2(t2, p) { - return t2 * t2 * p; -} -__name(QuadraticBezierP2, "QuadraticBezierP2"); -function QuadraticBezier(t2, p0, p1, p2) { - return QuadraticBezierP0(t2, p0) + QuadraticBezierP1(t2, p1) + QuadraticBezierP2(t2, p2); -} -__name(QuadraticBezier, "QuadraticBezier"); -function CubicBezierP0(t2, p) { - const k = 1 - t2; - return k * k * k * p; -} -__name(CubicBezierP0, "CubicBezierP0"); -function CubicBezierP1(t2, p) { - const k = 1 - t2; - return 3 * k * k * t2 * p; -} -__name(CubicBezierP1, "CubicBezierP1"); -function CubicBezierP2(t2, p) { - return 3 * (1 - t2) * t2 * t2 * p; -} -__name(CubicBezierP2, "CubicBezierP2"); -function CubicBezierP3(t2, p) { - return t2 * t2 * t2 * p; -} -__name(CubicBezierP3, "CubicBezierP3"); -function CubicBezier(t2, p0, p1, p2, p3) { - return CubicBezierP0(t2, p0) + CubicBezierP1(t2, p1) + CubicBezierP2(t2, p2) + CubicBezierP3(t2, p3); -} -__name(CubicBezier, "CubicBezier"); -class CubicBezierCurve extends Curve { - static { - __name(this, "CubicBezierCurve"); - } - constructor(v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2()) { - super(); - this.isCubicBezierCurve = true; - this.type = "CubicBezierCurve"; - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - } - getPoint(t2, optionalTarget = new Vector2()) { - const point = optionalTarget; - const v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3; - point.set( - CubicBezier(t2, v0.x, v1.x, v2.x, v3.x), - CubicBezier(t2, v0.y, v1.y, v2.y, v3.y) - ); - return point; - } - copy(source) { - super.copy(source); - this.v0.copy(source.v0); - this.v1.copy(source.v1); - this.v2.copy(source.v2); - this.v3.copy(source.v3); - return this; - } - toJSON() { - const data = super.toJSON(); - data.v0 = this.v0.toArray(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - data.v3 = this.v3.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.v0.fromArray(json.v0); - this.v1.fromArray(json.v1); - this.v2.fromArray(json.v2); - this.v3.fromArray(json.v3); - return this; - } -} -class CubicBezierCurve3 extends Curve { - static { - __name(this, "CubicBezierCurve3"); - } - constructor(v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3()) { - super(); - this.isCubicBezierCurve3 = true; - this.type = "CubicBezierCurve3"; - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - } - getPoint(t2, optionalTarget = new Vector3()) { - const point = optionalTarget; - const v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3; - point.set( - CubicBezier(t2, v0.x, v1.x, v2.x, v3.x), - CubicBezier(t2, v0.y, v1.y, v2.y, v3.y), - CubicBezier(t2, v0.z, v1.z, v2.z, v3.z) - ); - return point; - } - copy(source) { - super.copy(source); - this.v0.copy(source.v0); - this.v1.copy(source.v1); - this.v2.copy(source.v2); - this.v3.copy(source.v3); - return this; - } - toJSON() { - const data = super.toJSON(); - data.v0 = this.v0.toArray(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - data.v3 = this.v3.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.v0.fromArray(json.v0); - this.v1.fromArray(json.v1); - this.v2.fromArray(json.v2); - this.v3.fromArray(json.v3); - return this; - } -} -class LineCurve extends Curve { - static { - __name(this, "LineCurve"); - } - constructor(v1 = new Vector2(), v2 = new Vector2()) { - super(); - this.isLineCurve = true; - this.type = "LineCurve"; - this.v1 = v1; - this.v2 = v2; - } - getPoint(t2, optionalTarget = new Vector2()) { - const point = optionalTarget; - if (t2 === 1) { - point.copy(this.v2); - } else { - point.copy(this.v2).sub(this.v1); - point.multiplyScalar(t2).add(this.v1); - } - return point; - } - // Line curve is linear, so we can overwrite default getPointAt - getPointAt(u, optionalTarget) { - return this.getPoint(u, optionalTarget); - } - getTangent(t2, optionalTarget = new Vector2()) { - return optionalTarget.subVectors(this.v2, this.v1).normalize(); - } - getTangentAt(u, optionalTarget) { - return this.getTangent(u, optionalTarget); - } - copy(source) { - super.copy(source); - this.v1.copy(source.v1); - this.v2.copy(source.v2); - return this; - } - toJSON() { - const data = super.toJSON(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.v1.fromArray(json.v1); - this.v2.fromArray(json.v2); - return this; - } -} -class LineCurve3 extends Curve { - static { - __name(this, "LineCurve3"); - } - constructor(v1 = new Vector3(), v2 = new Vector3()) { - super(); - this.isLineCurve3 = true; - this.type = "LineCurve3"; - this.v1 = v1; - this.v2 = v2; - } - getPoint(t2, optionalTarget = new Vector3()) { - const point = optionalTarget; - if (t2 === 1) { - point.copy(this.v2); - } else { - point.copy(this.v2).sub(this.v1); - point.multiplyScalar(t2).add(this.v1); - } - return point; - } - // Line curve is linear, so we can overwrite default getPointAt - getPointAt(u, optionalTarget) { - return this.getPoint(u, optionalTarget); - } - getTangent(t2, optionalTarget = new Vector3()) { - return optionalTarget.subVectors(this.v2, this.v1).normalize(); - } - getTangentAt(u, optionalTarget) { - return this.getTangent(u, optionalTarget); - } - copy(source) { - super.copy(source); - this.v1.copy(source.v1); - this.v2.copy(source.v2); - return this; - } - toJSON() { - const data = super.toJSON(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.v1.fromArray(json.v1); - this.v2.fromArray(json.v2); - return this; - } -} -class QuadraticBezierCurve extends Curve { - static { - __name(this, "QuadraticBezierCurve"); - } - constructor(v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2()) { - super(); - this.isQuadraticBezierCurve = true; - this.type = "QuadraticBezierCurve"; - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - } - getPoint(t2, optionalTarget = new Vector2()) { - const point = optionalTarget; - const v0 = this.v0, v1 = this.v1, v2 = this.v2; - point.set( - QuadraticBezier(t2, v0.x, v1.x, v2.x), - QuadraticBezier(t2, v0.y, v1.y, v2.y) - ); - return point; - } - copy(source) { - super.copy(source); - this.v0.copy(source.v0); - this.v1.copy(source.v1); - this.v2.copy(source.v2); - return this; - } - toJSON() { - const data = super.toJSON(); - data.v0 = this.v0.toArray(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.v0.fromArray(json.v0); - this.v1.fromArray(json.v1); - this.v2.fromArray(json.v2); - return this; - } -} -class QuadraticBezierCurve3 extends Curve { - static { - __name(this, "QuadraticBezierCurve3"); - } - constructor(v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3()) { - super(); - this.isQuadraticBezierCurve3 = true; - this.type = "QuadraticBezierCurve3"; - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; - } - getPoint(t2, optionalTarget = new Vector3()) { - const point = optionalTarget; - const v0 = this.v0, v1 = this.v1, v2 = this.v2; - point.set( - QuadraticBezier(t2, v0.x, v1.x, v2.x), - QuadraticBezier(t2, v0.y, v1.y, v2.y), - QuadraticBezier(t2, v0.z, v1.z, v2.z) - ); - return point; - } - copy(source) { - super.copy(source); - this.v0.copy(source.v0); - this.v1.copy(source.v1); - this.v2.copy(source.v2); - return this; - } - toJSON() { - const data = super.toJSON(); - data.v0 = this.v0.toArray(); - data.v1 = this.v1.toArray(); - data.v2 = this.v2.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.v0.fromArray(json.v0); - this.v1.fromArray(json.v1); - this.v2.fromArray(json.v2); - return this; - } -} -class SplineCurve extends Curve { - static { - __name(this, "SplineCurve"); - } - constructor(points = []) { - super(); - this.isSplineCurve = true; - this.type = "SplineCurve"; - this.points = points; - } - getPoint(t2, optionalTarget = new Vector2()) { - const point = optionalTarget; - const points = this.points; - const p = (points.length - 1) * t2; - const intPoint = Math.floor(p); - const weight = p - intPoint; - const p0 = points[intPoint === 0 ? intPoint : intPoint - 1]; - const p1 = points[intPoint]; - const p2 = points[intPoint > points.length - 2 ? points.length - 1 : intPoint + 1]; - const p3 = points[intPoint > points.length - 3 ? points.length - 1 : intPoint + 2]; - point.set( - CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), - CatmullRom(weight, p0.y, p1.y, p2.y, p3.y) - ); - return point; - } - copy(source) { - super.copy(source); - this.points = []; - for (let i = 0, l = source.points.length; i < l; i++) { - const point = source.points[i]; - this.points.push(point.clone()); - } - return this; - } - toJSON() { - const data = super.toJSON(); - data.points = []; - for (let i = 0, l = this.points.length; i < l; i++) { - const point = this.points[i]; - data.points.push(point.toArray()); - } - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.points = []; - for (let i = 0, l = json.points.length; i < l; i++) { - const point = json.points[i]; - this.points.push(new Vector2().fromArray(point)); - } - return this; - } -} -var Curves = /* @__PURE__ */ Object.freeze({ - __proto__: null, - ArcCurve, - CatmullRomCurve3, - CubicBezierCurve, - CubicBezierCurve3, - EllipseCurve, - LineCurve, - LineCurve3, - QuadraticBezierCurve, - QuadraticBezierCurve3, - SplineCurve -}); -class CurvePath extends Curve { - static { - __name(this, "CurvePath"); - } - constructor() { - super(); - this.type = "CurvePath"; - this.curves = []; - this.autoClose = false; - } - add(curve) { - this.curves.push(curve); - } - closePath() { - const startPoint = this.curves[0].getPoint(0); - const endPoint = this.curves[this.curves.length - 1].getPoint(1); - if (!startPoint.equals(endPoint)) { - const lineType = startPoint.isVector2 === true ? "LineCurve" : "LineCurve3"; - this.curves.push(new Curves[lineType](endPoint, startPoint)); - } - return this; - } - // To get accurate point with reference to - // entire path distance at time t, - // following has to be done: - // 1. Length of each sub path have to be known - // 2. Locate and identify type of curve - // 3. Get t for the curve - // 4. Return curve.getPointAt(t') - getPoint(t2, optionalTarget) { - const d = t2 * this.getLength(); - const curveLengths = this.getCurveLengths(); - let i = 0; - while (i < curveLengths.length) { - if (curveLengths[i] >= d) { - const diff = curveLengths[i] - d; - const curve = this.curves[i]; - const segmentLength = curve.getLength(); - const u = segmentLength === 0 ? 0 : 1 - diff / segmentLength; - return curve.getPointAt(u, optionalTarget); - } - i++; - } - return null; - } - // We cannot use the default THREE.Curve getPoint() with getLength() because in - // THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath - // getPoint() depends on getLength - getLength() { - const lens = this.getCurveLengths(); - return lens[lens.length - 1]; - } - // cacheLengths must be recalculated. - updateArcLengths() { - this.needsUpdate = true; - this.cacheLengths = null; - this.getCurveLengths(); - } - // Compute lengths and cache them - // We cannot overwrite getLengths() because UtoT mapping uses it. - getCurveLengths() { - if (this.cacheLengths && this.cacheLengths.length === this.curves.length) { - return this.cacheLengths; - } - const lengths = []; - let sums = 0; - for (let i = 0, l = this.curves.length; i < l; i++) { - sums += this.curves[i].getLength(); - lengths.push(sums); - } - this.cacheLengths = lengths; - return lengths; - } - getSpacedPoints(divisions = 40) { - const points = []; - for (let i = 0; i <= divisions; i++) { - points.push(this.getPoint(i / divisions)); - } - if (this.autoClose) { - points.push(points[0]); - } - return points; - } - getPoints(divisions = 12) { - const points = []; - let last; - for (let i = 0, curves = this.curves; i < curves.length; i++) { - const curve = curves[i]; - const resolution = curve.isEllipseCurve ? divisions * 2 : curve.isLineCurve || curve.isLineCurve3 ? 1 : curve.isSplineCurve ? divisions * curve.points.length : divisions; - const pts = curve.getPoints(resolution); - for (let j = 0; j < pts.length; j++) { - const point = pts[j]; - if (last && last.equals(point)) continue; - points.push(point); - last = point; - } - } - if (this.autoClose && points.length > 1 && !points[points.length - 1].equals(points[0])) { - points.push(points[0]); - } - return points; - } - copy(source) { - super.copy(source); - this.curves = []; - for (let i = 0, l = source.curves.length; i < l; i++) { - const curve = source.curves[i]; - this.curves.push(curve.clone()); - } - this.autoClose = source.autoClose; - return this; - } - toJSON() { - const data = super.toJSON(); - data.autoClose = this.autoClose; - data.curves = []; - for (let i = 0, l = this.curves.length; i < l; i++) { - const curve = this.curves[i]; - data.curves.push(curve.toJSON()); - } - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.autoClose = json.autoClose; - this.curves = []; - for (let i = 0, l = json.curves.length; i < l; i++) { - const curve = json.curves[i]; - this.curves.push(new Curves[curve.type]().fromJSON(curve)); - } - return this; - } -} -class Path extends CurvePath { - static { - __name(this, "Path"); - } - constructor(points) { - super(); - this.type = "Path"; - this.currentPoint = new Vector2(); - if (points) { - this.setFromPoints(points); - } - } - setFromPoints(points) { - this.moveTo(points[0].x, points[0].y); - for (let i = 1, l = points.length; i < l; i++) { - this.lineTo(points[i].x, points[i].y); - } - return this; - } - moveTo(x, y) { - this.currentPoint.set(x, y); - return this; - } - lineTo(x, y) { - const curve = new LineCurve(this.currentPoint.clone(), new Vector2(x, y)); - this.curves.push(curve); - this.currentPoint.set(x, y); - return this; - } - quadraticCurveTo(aCPx, aCPy, aX, aY) { - const curve = new QuadraticBezierCurve( - this.currentPoint.clone(), - new Vector2(aCPx, aCPy), - new Vector2(aX, aY) - ); - this.curves.push(curve); - this.currentPoint.set(aX, aY); - return this; - } - bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { - const curve = new CubicBezierCurve( - this.currentPoint.clone(), - new Vector2(aCP1x, aCP1y), - new Vector2(aCP2x, aCP2y), - new Vector2(aX, aY) - ); - this.curves.push(curve); - this.currentPoint.set(aX, aY); - return this; - } - splineThru(pts) { - const npts = [this.currentPoint.clone()].concat(pts); - const curve = new SplineCurve(npts); - this.curves.push(curve); - this.currentPoint.copy(pts[pts.length - 1]); - return this; - } - arc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { - const x0 = this.currentPoint.x; - const y0 = this.currentPoint.y; - this.absarc( - aX + x0, - aY + y0, - aRadius, - aStartAngle, - aEndAngle, - aClockwise - ); - return this; - } - absarc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { - this.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); - return this; - } - ellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { - const x0 = this.currentPoint.x; - const y0 = this.currentPoint.y; - this.absellipse(aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation); - return this; - } - absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { - const curve = new EllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation); - if (this.curves.length > 0) { - const firstPoint = curve.getPoint(0); - if (!firstPoint.equals(this.currentPoint)) { - this.lineTo(firstPoint.x, firstPoint.y); - } - } - this.curves.push(curve); - const lastPoint = curve.getPoint(1); - this.currentPoint.copy(lastPoint); - return this; - } - copy(source) { - super.copy(source); - this.currentPoint.copy(source.currentPoint); - return this; - } - toJSON() { - const data = super.toJSON(); - data.currentPoint = this.currentPoint.toArray(); - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.currentPoint.fromArray(json.currentPoint); - return this; - } -} -class LatheGeometry extends BufferGeometry { - static { - __name(this, "LatheGeometry"); - } - constructor(points = [new Vector2(0, -0.5), new Vector2(0.5, 0), new Vector2(0, 0.5)], segments = 12, phiStart = 0, phiLength = Math.PI * 2) { - super(); - this.type = "LatheGeometry"; - this.parameters = { - points, - segments, - phiStart, - phiLength - }; - segments = Math.floor(segments); - phiLength = clamp(phiLength, 0, Math.PI * 2); - const indices = []; - const vertices = []; - const uvs = []; - const initNormals = []; - const normals = []; - const inverseSegments = 1 / segments; - const vertex2 = new Vector3(); - const uv = new Vector2(); - const normal = new Vector3(); - const curNormal = new Vector3(); - const prevNormal = new Vector3(); - let dx = 0; - let dy = 0; - for (let j = 0; j <= points.length - 1; j++) { - switch (j) { - case 0: - dx = points[j + 1].x - points[j].x; - dy = points[j + 1].y - points[j].y; - normal.x = dy * 1; - normal.y = -dx; - normal.z = dy * 0; - prevNormal.copy(normal); - normal.normalize(); - initNormals.push(normal.x, normal.y, normal.z); - break; - case points.length - 1: - initNormals.push(prevNormal.x, prevNormal.y, prevNormal.z); - break; - default: - dx = points[j + 1].x - points[j].x; - dy = points[j + 1].y - points[j].y; - normal.x = dy * 1; - normal.y = -dx; - normal.z = dy * 0; - curNormal.copy(normal); - normal.x += prevNormal.x; - normal.y += prevNormal.y; - normal.z += prevNormal.z; - normal.normalize(); - initNormals.push(normal.x, normal.y, normal.z); - prevNormal.copy(curNormal); - } - } - for (let i = 0; i <= segments; i++) { - const phi = phiStart + i * inverseSegments * phiLength; - const sin = Math.sin(phi); - const cos = Math.cos(phi); - for (let j = 0; j <= points.length - 1; j++) { - vertex2.x = points[j].x * sin; - vertex2.y = points[j].y; - vertex2.z = points[j].x * cos; - vertices.push(vertex2.x, vertex2.y, vertex2.z); - uv.x = i / segments; - uv.y = j / (points.length - 1); - uvs.push(uv.x, uv.y); - const x = initNormals[3 * j + 0] * sin; - const y = initNormals[3 * j + 1]; - const z = initNormals[3 * j + 0] * cos; - normals.push(x, y, z); - } - } - for (let i = 0; i < segments; i++) { - for (let j = 0; j < points.length - 1; j++) { - const base = j + i * points.length; - const a = base; - const b = base + points.length; - const c = base + points.length + 1; - const d = base + 1; - indices.push(a, b, d); - indices.push(c, d, b); - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new LatheGeometry(data.points, data.segments, data.phiStart, data.phiLength); - } -} -class CapsuleGeometry extends LatheGeometry { - static { - __name(this, "CapsuleGeometry"); - } - constructor(radius = 1, length = 1, capSegments = 4, radialSegments = 8) { - const path = new Path(); - path.absarc(0, -length / 2, radius, Math.PI * 1.5, 0); - path.absarc(0, length / 2, radius, 0, Math.PI * 0.5); - super(path.getPoints(capSegments), radialSegments); - this.type = "CapsuleGeometry"; - this.parameters = { - radius, - length, - capSegments, - radialSegments - }; - } - static fromJSON(data) { - return new CapsuleGeometry(data.radius, data.length, data.capSegments, data.radialSegments); - } -} -class CircleGeometry extends BufferGeometry { - static { - __name(this, "CircleGeometry"); - } - constructor(radius = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2) { - super(); - this.type = "CircleGeometry"; - this.parameters = { - radius, - segments, - thetaStart, - thetaLength - }; - segments = Math.max(3, segments); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - const vertex2 = new Vector3(); - const uv = new Vector2(); - vertices.push(0, 0, 0); - normals.push(0, 0, 1); - uvs.push(0.5, 0.5); - for (let s = 0, i = 3; s <= segments; s++, i += 3) { - const segment = thetaStart + s / segments * thetaLength; - vertex2.x = radius * Math.cos(segment); - vertex2.y = radius * Math.sin(segment); - vertices.push(vertex2.x, vertex2.y, vertex2.z); - normals.push(0, 0, 1); - uv.x = (vertices[i] / radius + 1) / 2; - uv.y = (vertices[i + 1] / radius + 1) / 2; - uvs.push(uv.x, uv.y); - } - for (let i = 1; i <= segments; i++) { - indices.push(i, i + 1, 0); - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new CircleGeometry(data.radius, data.segments, data.thetaStart, data.thetaLength); - } -} -class CylinderGeometry extends BufferGeometry { - static { - __name(this, "CylinderGeometry"); - } - constructor(radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2) { - super(); - this.type = "CylinderGeometry"; - this.parameters = { - radiusTop, - radiusBottom, - height, - radialSegments, - heightSegments, - openEnded, - thetaStart, - thetaLength - }; - const scope = this; - radialSegments = Math.floor(radialSegments); - heightSegments = Math.floor(heightSegments); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - let index = 0; - const indexArray = []; - const halfHeight = height / 2; - let groupStart = 0; - generateTorso(); - if (openEnded === false) { - if (radiusTop > 0) generateCap(true); - if (radiusBottom > 0) generateCap(false); - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - function generateTorso() { - const normal = new Vector3(); - const vertex2 = new Vector3(); - let groupCount = 0; - const slope = (radiusBottom - radiusTop) / height; - for (let y = 0; y <= heightSegments; y++) { - const indexRow = []; - const v = y / heightSegments; - const radius = v * (radiusBottom - radiusTop) + radiusTop; - for (let x = 0; x <= radialSegments; x++) { - const u = x / radialSegments; - const theta = u * thetaLength + thetaStart; - const sinTheta = Math.sin(theta); - const cosTheta = Math.cos(theta); - vertex2.x = radius * sinTheta; - vertex2.y = -v * height + halfHeight; - vertex2.z = radius * cosTheta; - vertices.push(vertex2.x, vertex2.y, vertex2.z); - normal.set(sinTheta, slope, cosTheta).normalize(); - normals.push(normal.x, normal.y, normal.z); - uvs.push(u, 1 - v); - indexRow.push(index++); - } - indexArray.push(indexRow); - } - for (let x = 0; x < radialSegments; x++) { - for (let y = 0; y < heightSegments; y++) { - const a = indexArray[y][x]; - const b = indexArray[y + 1][x]; - const c = indexArray[y + 1][x + 1]; - const d = indexArray[y][x + 1]; - if (radiusTop > 0 || y !== 0) { - indices.push(a, b, d); - groupCount += 3; - } - if (radiusBottom > 0 || y !== heightSegments - 1) { - indices.push(b, c, d); - groupCount += 3; - } - } - } - scope.addGroup(groupStart, groupCount, 0); - groupStart += groupCount; - } - __name(generateTorso, "generateTorso"); - function generateCap(top) { - const centerIndexStart = index; - const uv = new Vector2(); - const vertex2 = new Vector3(); - let groupCount = 0; - const radius = top === true ? radiusTop : radiusBottom; - const sign2 = top === true ? 1 : -1; - for (let x = 1; x <= radialSegments; x++) { - vertices.push(0, halfHeight * sign2, 0); - normals.push(0, sign2, 0); - uvs.push(0.5, 0.5); - index++; - } - const centerIndexEnd = index; - for (let x = 0; x <= radialSegments; x++) { - const u = x / radialSegments; - const theta = u * thetaLength + thetaStart; - const cosTheta = Math.cos(theta); - const sinTheta = Math.sin(theta); - vertex2.x = radius * sinTheta; - vertex2.y = halfHeight * sign2; - vertex2.z = radius * cosTheta; - vertices.push(vertex2.x, vertex2.y, vertex2.z); - normals.push(0, sign2, 0); - uv.x = cosTheta * 0.5 + 0.5; - uv.y = sinTheta * 0.5 * sign2 + 0.5; - uvs.push(uv.x, uv.y); - index++; - } - for (let x = 0; x < radialSegments; x++) { - const c = centerIndexStart + x; - const i = centerIndexEnd + x; - if (top === true) { - indices.push(i, i + 1, c); - } else { - indices.push(i + 1, i, c); - } - groupCount += 3; - } - scope.addGroup(groupStart, groupCount, top === true ? 1 : 2); - groupStart += groupCount; - } - __name(generateCap, "generateCap"); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new CylinderGeometry(data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength); - } -} -class ConeGeometry extends CylinderGeometry { - static { - __name(this, "ConeGeometry"); - } - constructor(radius = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2) { - super(0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength); - this.type = "ConeGeometry"; - this.parameters = { - radius, - height, - radialSegments, - heightSegments, - openEnded, - thetaStart, - thetaLength - }; - } - static fromJSON(data) { - return new ConeGeometry(data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength); - } -} -class PolyhedronGeometry extends BufferGeometry { - static { - __name(this, "PolyhedronGeometry"); - } - constructor(vertices = [], indices = [], radius = 1, detail = 0) { - super(); - this.type = "PolyhedronGeometry"; - this.parameters = { - vertices, - indices, - radius, - detail - }; - const vertexBuffer = []; - const uvBuffer = []; - subdivide(detail); - applyRadius(radius); - generateUVs(); - this.setAttribute("position", new Float32BufferAttribute(vertexBuffer, 3)); - this.setAttribute("normal", new Float32BufferAttribute(vertexBuffer.slice(), 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvBuffer, 2)); - if (detail === 0) { - this.computeVertexNormals(); - } else { - this.normalizeNormals(); - } - function subdivide(detail2) { - const a = new Vector3(); - const b = new Vector3(); - const c = new Vector3(); - for (let i = 0; i < indices.length; i += 3) { - getVertexByIndex(indices[i + 0], a); - getVertexByIndex(indices[i + 1], b); - getVertexByIndex(indices[i + 2], c); - subdivideFace(a, b, c, detail2); - } - } - __name(subdivide, "subdivide"); - function subdivideFace(a, b, c, detail2) { - const cols = detail2 + 1; - const v = []; - for (let i = 0; i <= cols; i++) { - v[i] = []; - const aj = a.clone().lerp(c, i / cols); - const bj = b.clone().lerp(c, i / cols); - const rows = cols - i; - for (let j = 0; j <= rows; j++) { - if (j === 0 && i === cols) { - v[i][j] = aj; - } else { - v[i][j] = aj.clone().lerp(bj, j / rows); - } - } - } - for (let i = 0; i < cols; i++) { - for (let j = 0; j < 2 * (cols - i) - 1; j++) { - const k = Math.floor(j / 2); - if (j % 2 === 0) { - pushVertex(v[i][k + 1]); - pushVertex(v[i + 1][k]); - pushVertex(v[i][k]); - } else { - pushVertex(v[i][k + 1]); - pushVertex(v[i + 1][k + 1]); - pushVertex(v[i + 1][k]); - } - } - } - } - __name(subdivideFace, "subdivideFace"); - function applyRadius(radius2) { - const vertex2 = new Vector3(); - for (let i = 0; i < vertexBuffer.length; i += 3) { - vertex2.x = vertexBuffer[i + 0]; - vertex2.y = vertexBuffer[i + 1]; - vertex2.z = vertexBuffer[i + 2]; - vertex2.normalize().multiplyScalar(radius2); - vertexBuffer[i + 0] = vertex2.x; - vertexBuffer[i + 1] = vertex2.y; - vertexBuffer[i + 2] = vertex2.z; - } - } - __name(applyRadius, "applyRadius"); - function generateUVs() { - const vertex2 = new Vector3(); - for (let i = 0; i < vertexBuffer.length; i += 3) { - vertex2.x = vertexBuffer[i + 0]; - vertex2.y = vertexBuffer[i + 1]; - vertex2.z = vertexBuffer[i + 2]; - const u = azimuth(vertex2) / 2 / Math.PI + 0.5; - const v = inclination(vertex2) / Math.PI + 0.5; - uvBuffer.push(u, 1 - v); - } - correctUVs(); - correctSeam(); - } - __name(generateUVs, "generateUVs"); - function correctSeam() { - for (let i = 0; i < uvBuffer.length; i += 6) { - const x0 = uvBuffer[i + 0]; - const x1 = uvBuffer[i + 2]; - const x2 = uvBuffer[i + 4]; - const max2 = Math.max(x0, x1, x2); - const min = Math.min(x0, x1, x2); - if (max2 > 0.9 && min < 0.1) { - if (x0 < 0.2) uvBuffer[i + 0] += 1; - if (x1 < 0.2) uvBuffer[i + 2] += 1; - if (x2 < 0.2) uvBuffer[i + 4] += 1; - } - } - } - __name(correctSeam, "correctSeam"); - function pushVertex(vertex2) { - vertexBuffer.push(vertex2.x, vertex2.y, vertex2.z); - } - __name(pushVertex, "pushVertex"); - function getVertexByIndex(index, vertex2) { - const stride = index * 3; - vertex2.x = vertices[stride + 0]; - vertex2.y = vertices[stride + 1]; - vertex2.z = vertices[stride + 2]; - } - __name(getVertexByIndex, "getVertexByIndex"); - function correctUVs() { - const a = new Vector3(); - const b = new Vector3(); - const c = new Vector3(); - const centroid = new Vector3(); - const uvA = new Vector2(); - const uvB = new Vector2(); - const uvC = new Vector2(); - for (let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6) { - a.set(vertexBuffer[i + 0], vertexBuffer[i + 1], vertexBuffer[i + 2]); - b.set(vertexBuffer[i + 3], vertexBuffer[i + 4], vertexBuffer[i + 5]); - c.set(vertexBuffer[i + 6], vertexBuffer[i + 7], vertexBuffer[i + 8]); - uvA.set(uvBuffer[j + 0], uvBuffer[j + 1]); - uvB.set(uvBuffer[j + 2], uvBuffer[j + 3]); - uvC.set(uvBuffer[j + 4], uvBuffer[j + 5]); - centroid.copy(a).add(b).add(c).divideScalar(3); - const azi = azimuth(centroid); - correctUV(uvA, j + 0, a, azi); - correctUV(uvB, j + 2, b, azi); - correctUV(uvC, j + 4, c, azi); - } - } - __name(correctUVs, "correctUVs"); - function correctUV(uv, stride, vector, azimuth2) { - if (azimuth2 < 0 && uv.x === 1) { - uvBuffer[stride] = uv.x - 1; - } - if (vector.x === 0 && vector.z === 0) { - uvBuffer[stride] = azimuth2 / 2 / Math.PI + 0.5; - } - } - __name(correctUV, "correctUV"); - function azimuth(vector) { - return Math.atan2(vector.z, -vector.x); - } - __name(azimuth, "azimuth"); - function inclination(vector) { - return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z)); - } - __name(inclination, "inclination"); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new PolyhedronGeometry(data.vertices, data.indices, data.radius, data.details); - } -} -class DodecahedronGeometry extends PolyhedronGeometry { - static { - __name(this, "DodecahedronGeometry"); - } - constructor(radius = 1, detail = 0) { - const t2 = (1 + Math.sqrt(5)) / 2; - const r = 1 / t2; - const vertices = [ - // (±1, ±1, ±1) - -1, - -1, - -1, - -1, - -1, - 1, - -1, - 1, - -1, - -1, - 1, - 1, - 1, - -1, - -1, - 1, - -1, - 1, - 1, - 1, - -1, - 1, - 1, - 1, - // (0, ±1/φ, ±φ) - 0, - -r, - -t2, - 0, - -r, - t2, - 0, - r, - -t2, - 0, - r, - t2, - // (±1/φ, ±φ, 0) - -r, - -t2, - 0, - -r, - t2, - 0, - r, - -t2, - 0, - r, - t2, - 0, - // (±φ, 0, ±1/φ) - -t2, - 0, - -r, - t2, - 0, - -r, - -t2, - 0, - r, - t2, - 0, - r - ]; - const indices = [ - 3, - 11, - 7, - 3, - 7, - 15, - 3, - 15, - 13, - 7, - 19, - 17, - 7, - 17, - 6, - 7, - 6, - 15, - 17, - 4, - 8, - 17, - 8, - 10, - 17, - 10, - 6, - 8, - 0, - 16, - 8, - 16, - 2, - 8, - 2, - 10, - 0, - 12, - 1, - 0, - 1, - 18, - 0, - 18, - 16, - 6, - 10, - 2, - 6, - 2, - 13, - 6, - 13, - 15, - 2, - 16, - 18, - 2, - 18, - 3, - 2, - 3, - 13, - 18, - 1, - 9, - 18, - 9, - 11, - 18, - 11, - 3, - 4, - 14, - 12, - 4, - 12, - 0, - 4, - 0, - 8, - 11, - 9, - 5, - 11, - 5, - 19, - 11, - 19, - 7, - 19, - 5, - 14, - 19, - 14, - 4, - 19, - 4, - 17, - 1, - 12, - 14, - 1, - 14, - 5, - 1, - 5, - 9 - ]; - super(vertices, indices, radius, detail); - this.type = "DodecahedronGeometry"; - this.parameters = { - radius, - detail - }; - } - static fromJSON(data) { - return new DodecahedronGeometry(data.radius, data.detail); - } -} -const _v0 = /* @__PURE__ */ new Vector3(); -const _v1$1 = /* @__PURE__ */ new Vector3(); -const _normal = /* @__PURE__ */ new Vector3(); -const _triangle = /* @__PURE__ */ new Triangle(); -class EdgesGeometry extends BufferGeometry { - static { - __name(this, "EdgesGeometry"); - } - constructor(geometry = null, thresholdAngle = 1) { - super(); - this.type = "EdgesGeometry"; - this.parameters = { - geometry, - thresholdAngle - }; - if (geometry !== null) { - const precisionPoints = 4; - const precision = Math.pow(10, precisionPoints); - const thresholdDot = Math.cos(DEG2RAD * thresholdAngle); - const indexAttr = geometry.getIndex(); - const positionAttr = geometry.getAttribute("position"); - const indexCount = indexAttr ? indexAttr.count : positionAttr.count; - const indexArr = [0, 0, 0]; - const vertKeys = ["a", "b", "c"]; - const hashes = new Array(3); - const edgeData = {}; - const vertices = []; - for (let i = 0; i < indexCount; i += 3) { - if (indexAttr) { - indexArr[0] = indexAttr.getX(i); - indexArr[1] = indexAttr.getX(i + 1); - indexArr[2] = indexAttr.getX(i + 2); - } else { - indexArr[0] = i; - indexArr[1] = i + 1; - indexArr[2] = i + 2; - } - const { a, b, c } = _triangle; - a.fromBufferAttribute(positionAttr, indexArr[0]); - b.fromBufferAttribute(positionAttr, indexArr[1]); - c.fromBufferAttribute(positionAttr, indexArr[2]); - _triangle.getNormal(_normal); - hashes[0] = `${Math.round(a.x * precision)},${Math.round(a.y * precision)},${Math.round(a.z * precision)}`; - hashes[1] = `${Math.round(b.x * precision)},${Math.round(b.y * precision)},${Math.round(b.z * precision)}`; - hashes[2] = `${Math.round(c.x * precision)},${Math.round(c.y * precision)},${Math.round(c.z * precision)}`; - if (hashes[0] === hashes[1] || hashes[1] === hashes[2] || hashes[2] === hashes[0]) { - continue; - } - for (let j = 0; j < 3; j++) { - const jNext = (j + 1) % 3; - const vecHash0 = hashes[j]; - const vecHash1 = hashes[jNext]; - const v0 = _triangle[vertKeys[j]]; - const v1 = _triangle[vertKeys[jNext]]; - const hash = `${vecHash0}_${vecHash1}`; - const reverseHash = `${vecHash1}_${vecHash0}`; - if (reverseHash in edgeData && edgeData[reverseHash]) { - if (_normal.dot(edgeData[reverseHash].normal) <= thresholdDot) { - vertices.push(v0.x, v0.y, v0.z); - vertices.push(v1.x, v1.y, v1.z); - } - edgeData[reverseHash] = null; - } else if (!(hash in edgeData)) { - edgeData[hash] = { - index0: indexArr[j], - index1: indexArr[jNext], - normal: _normal.clone() - }; - } - } - } - for (const key in edgeData) { - if (edgeData[key]) { - const { index0, index1 } = edgeData[key]; - _v0.fromBufferAttribute(positionAttr, index0); - _v1$1.fromBufferAttribute(positionAttr, index1); - vertices.push(_v0.x, _v0.y, _v0.z); - vertices.push(_v1$1.x, _v1$1.y, _v1$1.z); - } - } - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - } - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } -} -class Shape extends Path { - static { - __name(this, "Shape"); - } - constructor(points) { - super(points); - this.uuid = generateUUID(); - this.type = "Shape"; - this.holes = []; - } - getPointsHoles(divisions) { - const holesPts = []; - for (let i = 0, l = this.holes.length; i < l; i++) { - holesPts[i] = this.holes[i].getPoints(divisions); - } - return holesPts; - } - // get points of shape and holes (keypoints based on segments parameter) - extractPoints(divisions) { - return { - shape: this.getPoints(divisions), - holes: this.getPointsHoles(divisions) - }; - } - copy(source) { - super.copy(source); - this.holes = []; - for (let i = 0, l = source.holes.length; i < l; i++) { - const hole = source.holes[i]; - this.holes.push(hole.clone()); - } - return this; - } - toJSON() { - const data = super.toJSON(); - data.uuid = this.uuid; - data.holes = []; - for (let i = 0, l = this.holes.length; i < l; i++) { - const hole = this.holes[i]; - data.holes.push(hole.toJSON()); - } - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.uuid = json.uuid; - this.holes = []; - for (let i = 0, l = json.holes.length; i < l; i++) { - const hole = json.holes[i]; - this.holes.push(new Path().fromJSON(hole)); - } - return this; - } -} -const Earcut = { - triangulate: /* @__PURE__ */ __name(function(data, holeIndices, dim = 2) { - const hasHoles = holeIndices && holeIndices.length; - const outerLen = hasHoles ? holeIndices[0] * dim : data.length; - let outerNode = linkedList(data, 0, outerLen, dim, true); - const triangles = []; - if (!outerNode || outerNode.next === outerNode.prev) return triangles; - let minX, minY, maxX, maxY, x, y, invSize; - if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); - if (data.length > 80 * dim) { - minX = maxX = data[0]; - minY = maxY = data[1]; - for (let i = dim; i < outerLen; i += dim) { - x = data[i]; - y = data[i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - } - invSize = Math.max(maxX - minX, maxY - minY); - invSize = invSize !== 0 ? 32767 / invSize : 0; - } - earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0); - return triangles; - }, "triangulate") -}; -function linkedList(data, start, end, dim, clockwise) { - let i, last; - if (clockwise === signedArea(data, start, end, dim) > 0) { - for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); - } else { - for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); - } - if (last && equals(last, last.next)) { - removeNode(last); - last = last.next; - } - return last; -} -__name(linkedList, "linkedList"); -function filterPoints(start, end) { - if (!start) return start; - if (!end) end = start; - let p = start, again; - do { - again = false; - if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { - removeNode(p); - p = end = p.prev; - if (p === p.next) break; - again = true; - } else { - p = p.next; - } - } while (again || p !== end); - return end; -} -__name(filterPoints, "filterPoints"); -function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { - if (!ear) return; - if (!pass && invSize) indexCurve(ear, minX, minY, invSize); - let stop = ear, prev, next; - while (ear.prev !== ear.next) { - prev = ear.prev; - next = ear.next; - if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { - triangles.push(prev.i / dim | 0); - triangles.push(ear.i / dim | 0); - triangles.push(next.i / dim | 0); - removeNode(ear); - ear = next.next; - stop = next.next; - continue; - } - ear = next; - if (ear === stop) { - if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); - } else if (pass === 1) { - ear = cureLocalIntersections(filterPoints(ear), triangles, dim); - earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); - } else if (pass === 2) { - splitEarcut(ear, triangles, dim, minX, minY, invSize); - } - break; - } - } -} -__name(earcutLinked, "earcutLinked"); -function isEar(ear) { - const a = ear.prev, b = ear, c = ear.next; - if (area(a, b, c) >= 0) return false; - const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y; - const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy; - let p = c.next; - while (p !== a) { - if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; - p = p.next; - } - return true; -} -__name(isEar, "isEar"); -function isEarHashed(ear, minX, minY, invSize) { - const a = ear.prev, b = ear, c = ear.next; - if (area(a, b, c) >= 0) return false; - const ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y; - const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy; - const minZ = zOrder(x0, y0, minX, minY, invSize), maxZ = zOrder(x1, y1, minX, minY, invSize); - let p = ear.prevZ, n = ear.nextZ; - while (p && p.z >= minZ && n && n.z <= maxZ) { - if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; - p = p.prevZ; - if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; - n = n.nextZ; - } - while (p && p.z >= minZ) { - if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; - p = p.prevZ; - } - while (n && n.z <= maxZ) { - if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; - n = n.nextZ; - } - return true; -} -__name(isEarHashed, "isEarHashed"); -function cureLocalIntersections(start, triangles, dim) { - let p = start; - do { - const a = p.prev, b = p.next.next; - if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { - triangles.push(a.i / dim | 0); - triangles.push(p.i / dim | 0); - triangles.push(b.i / dim | 0); - removeNode(p); - removeNode(p.next); - p = start = b; - } - p = p.next; - } while (p !== start); - return filterPoints(p); -} -__name(cureLocalIntersections, "cureLocalIntersections"); -function splitEarcut(start, triangles, dim, minX, minY, invSize) { - let a = start; - do { - let b = a.next.next; - while (b !== a.prev) { - if (a.i !== b.i && isValidDiagonal(a, b)) { - let c = splitPolygon(a, b); - a = filterPoints(a, a.next); - c = filterPoints(c, c.next); - earcutLinked(a, triangles, dim, minX, minY, invSize, 0); - earcutLinked(c, triangles, dim, minX, minY, invSize, 0); - return; - } - b = b.next; - } - a = a.next; - } while (a !== start); -} -__name(splitEarcut, "splitEarcut"); -function eliminateHoles(data, holeIndices, outerNode, dim) { - const queue = []; - let i, len, start, end, list; - for (i = 0, len = holeIndices.length; i < len; i++) { - start = holeIndices[i] * dim; - end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - list = linkedList(data, start, end, dim, false); - if (list === list.next) list.steiner = true; - queue.push(getLeftmost(list)); - } - queue.sort(compareX); - for (i = 0; i < queue.length; i++) { - outerNode = eliminateHole(queue[i], outerNode); - } - return outerNode; -} -__name(eliminateHoles, "eliminateHoles"); -function compareX(a, b) { - return a.x - b.x; -} -__name(compareX, "compareX"); -function eliminateHole(hole, outerNode) { - const bridge = findHoleBridge(hole, outerNode); - if (!bridge) { - return outerNode; - } - const bridgeReverse = splitPolygon(bridge, hole); - filterPoints(bridgeReverse, bridgeReverse.next); - return filterPoints(bridge, bridge.next); -} -__name(eliminateHole, "eliminateHole"); -function findHoleBridge(hole, outerNode) { - let p = outerNode, qx = -Infinity, m; - const hx = hole.x, hy = hole.y; - do { - if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { - const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); - if (x <= hx && x > qx) { - qx = x; - m = p.x < p.next.x ? p : p.next; - if (x === hx) return m; - } - } - p = p.next; - } while (p !== outerNode); - if (!m) return null; - const stop = m, mx = m.x, my = m.y; - let tanMin = Infinity, tan; - p = m; - do { - if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { - tan = Math.abs(hy - p.y) / (hx - p.x); - if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) { - m = p; - tanMin = tan; - } - } - p = p.next; - } while (p !== stop); - return m; -} -__name(findHoleBridge, "findHoleBridge"); -function sectorContainsSector(m, p) { - return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0; -} -__name(sectorContainsSector, "sectorContainsSector"); -function indexCurve(start, minX, minY, invSize) { - let p = start; - do { - if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize); - p.prevZ = p.prev; - p.nextZ = p.next; - p = p.next; - } while (p !== start); - p.prevZ.nextZ = null; - p.prevZ = null; - sortLinked(p); -} -__name(indexCurve, "indexCurve"); -function sortLinked(list) { - let i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1; - do { - p = list; - list = null; - tail = null; - numMerges = 0; - while (p) { - numMerges++; - q = p; - pSize = 0; - for (i = 0; i < inSize; i++) { - pSize++; - q = q.nextZ; - if (!q) break; - } - qSize = inSize; - while (pSize > 0 || qSize > 0 && q) { - if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { - e = p; - p = p.nextZ; - pSize--; - } else { - e = q; - q = q.nextZ; - qSize--; - } - if (tail) tail.nextZ = e; - else list = e; - e.prevZ = tail; - tail = e; - } - p = q; - } - tail.nextZ = null; - inSize *= 2; - } while (numMerges > 1); - return list; -} -__name(sortLinked, "sortLinked"); -function zOrder(x, y, minX, minY, invSize) { - x = (x - minX) * invSize | 0; - y = (y - minY) * invSize | 0; - x = (x | x << 8) & 16711935; - x = (x | x << 4) & 252645135; - x = (x | x << 2) & 858993459; - x = (x | x << 1) & 1431655765; - y = (y | y << 8) & 16711935; - y = (y | y << 4) & 252645135; - y = (y | y << 2) & 858993459; - y = (y | y << 1) & 1431655765; - return x | y << 1; -} -__name(zOrder, "zOrder"); -function getLeftmost(start) { - let p = start, leftmost = start; - do { - if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p; - p = p.next; - } while (p !== start); - return leftmost; -} -__name(getLeftmost, "getLeftmost"); -function pointInTriangle(ax, ay, bx, by, cx, cy, px2, py2) { - return (cx - px2) * (ay - py2) >= (ax - px2) * (cy - py2) && (ax - px2) * (by - py2) >= (bx - px2) * (ay - py2) && (bx - px2) * (cy - py2) >= (cx - px2) * (by - py2); -} -__name(pointInTriangle, "pointInTriangle"); -function isValidDiagonal(a, b) { - return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges - (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible - (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors - equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); -} -__name(isValidDiagonal, "isValidDiagonal"); -function area(p, q, r) { - return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); -} -__name(area, "area"); -function equals(p1, p2) { - return p1.x === p2.x && p1.y === p2.y; -} -__name(equals, "equals"); -function intersects(p1, q1, p2, q2) { - const o1 = sign(area(p1, q1, p2)); - const o2 = sign(area(p1, q1, q2)); - const o3 = sign(area(p2, q2, p1)); - const o4 = sign(area(p2, q2, q1)); - if (o1 !== o2 && o3 !== o4) return true; - if (o1 === 0 && onSegment(p1, p2, q1)) return true; - if (o2 === 0 && onSegment(p1, q2, q1)) return true; - if (o3 === 0 && onSegment(p2, p1, q2)) return true; - if (o4 === 0 && onSegment(p2, q1, q2)) return true; - return false; -} -__name(intersects, "intersects"); -function onSegment(p, q, r) { - return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y); -} -__name(onSegment, "onSegment"); -function sign(num) { - return num > 0 ? 1 : num < 0 ? -1 : 0; -} -__name(sign, "sign"); -function intersectsPolygon(a, b) { - let p = a; - do { - if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true; - p = p.next; - } while (p !== a); - return false; -} -__name(intersectsPolygon, "intersectsPolygon"); -function locallyInside(a, b) { - return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; -} -__name(locallyInside, "locallyInside"); -function middleInside(a, b) { - let p = a, inside = false; - const px2 = (a.x + b.x) / 2, py2 = (a.y + b.y) / 2; - do { - if (p.y > py2 !== p.next.y > py2 && p.next.y !== p.y && px2 < (p.next.x - p.x) * (py2 - p.y) / (p.next.y - p.y) + p.x) - inside = !inside; - p = p.next; - } while (p !== a); - return inside; -} -__name(middleInside, "middleInside"); -function splitPolygon(a, b) { - const a2 = new Node(a.i, a.x, a.y), b22 = new Node(b.i, b.x, b.y), an = a.next, bp = b.prev; - a.next = b; - b.prev = a; - a2.next = an; - an.prev = a2; - b22.next = a2; - a2.prev = b22; - bp.next = b22; - b22.prev = bp; - return b22; -} -__name(splitPolygon, "splitPolygon"); -function insertNode(i, x, y, last) { - const p = new Node(i, x, y); - if (!last) { - p.prev = p; - p.next = p; - } else { - p.next = last.next; - p.prev = last; - last.next.prev = p; - last.next = p; - } - return p; -} -__name(insertNode, "insertNode"); -function removeNode(p) { - p.next.prev = p.prev; - p.prev.next = p.next; - if (p.prevZ) p.prevZ.nextZ = p.nextZ; - if (p.nextZ) p.nextZ.prevZ = p.prevZ; -} -__name(removeNode, "removeNode"); -function Node(i, x, y) { - this.i = i; - this.x = x; - this.y = y; - this.prev = null; - this.next = null; - this.z = 0; - this.prevZ = null; - this.nextZ = null; - this.steiner = false; -} -__name(Node, "Node"); -function signedArea(data, start, end, dim) { - let sum = 0; - for (let i = start, j = end - dim; i < end; i += dim) { - sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); - j = i; - } - return sum; -} -__name(signedArea, "signedArea"); -class ShapeUtils { - static { - __name(this, "ShapeUtils"); - } - // calculate area of the contour polygon - static area(contour) { - const n = contour.length; - let a = 0; - for (let p = n - 1, q = 0; q < n; p = q++) { - a += contour[p].x * contour[q].y - contour[q].x * contour[p].y; - } - return a * 0.5; - } - static isClockWise(pts) { - return ShapeUtils.area(pts) < 0; - } - static triangulateShape(contour, holes) { - const vertices = []; - const holeIndices = []; - const faces = []; - removeDupEndPts(contour); - addContour(vertices, contour); - let holeIndex = contour.length; - holes.forEach(removeDupEndPts); - for (let i = 0; i < holes.length; i++) { - holeIndices.push(holeIndex); - holeIndex += holes[i].length; - addContour(vertices, holes[i]); - } - const triangles = Earcut.triangulate(vertices, holeIndices); - for (let i = 0; i < triangles.length; i += 3) { - faces.push(triangles.slice(i, i + 3)); - } - return faces; - } -} -function removeDupEndPts(points) { - const l = points.length; - if (l > 2 && points[l - 1].equals(points[0])) { - points.pop(); - } -} -__name(removeDupEndPts, "removeDupEndPts"); -function addContour(vertices, contour) { - for (let i = 0; i < contour.length; i++) { - vertices.push(contour[i].x); - vertices.push(contour[i].y); - } -} -__name(addContour, "addContour"); -class ExtrudeGeometry extends BufferGeometry { - static { - __name(this, "ExtrudeGeometry"); - } - constructor(shapes = new Shape([new Vector2(0.5, 0.5), new Vector2(-0.5, 0.5), new Vector2(-0.5, -0.5), new Vector2(0.5, -0.5)]), options = {}) { - super(); - this.type = "ExtrudeGeometry"; - this.parameters = { - shapes, - options - }; - shapes = Array.isArray(shapes) ? shapes : [shapes]; - const scope = this; - const verticesArray = []; - const uvArray = []; - for (let i = 0, l = shapes.length; i < l; i++) { - const shape = shapes[i]; - addShape(shape); - } - this.setAttribute("position", new Float32BufferAttribute(verticesArray, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvArray, 2)); - this.computeVertexNormals(); - function addShape(shape) { - const placeholder = []; - const curveSegments = options.curveSegments !== void 0 ? options.curveSegments : 12; - const steps = options.steps !== void 0 ? options.steps : 1; - const depth = options.depth !== void 0 ? options.depth : 1; - let bevelEnabled = options.bevelEnabled !== void 0 ? options.bevelEnabled : true; - let bevelThickness = options.bevelThickness !== void 0 ? options.bevelThickness : 0.2; - let bevelSize = options.bevelSize !== void 0 ? options.bevelSize : bevelThickness - 0.1; - let bevelOffset = options.bevelOffset !== void 0 ? options.bevelOffset : 0; - let bevelSegments = options.bevelSegments !== void 0 ? options.bevelSegments : 3; - const extrudePath = options.extrudePath; - const uvgen = options.UVGenerator !== void 0 ? options.UVGenerator : WorldUVGenerator; - let extrudePts, extrudeByPath = false; - let splineTube, binormal, normal, position2; - if (extrudePath) { - extrudePts = extrudePath.getSpacedPoints(steps); - extrudeByPath = true; - bevelEnabled = false; - splineTube = extrudePath.computeFrenetFrames(steps, false); - binormal = new Vector3(); - normal = new Vector3(); - position2 = new Vector3(); - } - if (!bevelEnabled) { - bevelSegments = 0; - bevelThickness = 0; - bevelSize = 0; - bevelOffset = 0; - } - const shapePoints = shape.extractPoints(curveSegments); - let vertices = shapePoints.shape; - const holes = shapePoints.holes; - const reverse = !ShapeUtils.isClockWise(vertices); - if (reverse) { - vertices = vertices.reverse(); - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - if (ShapeUtils.isClockWise(ahole)) { - holes[h] = ahole.reverse(); - } - } - } - const faces = ShapeUtils.triangulateShape(vertices, holes); - const contour = vertices; - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - vertices = vertices.concat(ahole); - } - function scalePt2(pt, vec, size) { - if (!vec) console.error("THREE.ExtrudeGeometry: vec does not exist"); - return pt.clone().addScaledVector(vec, size); - } - __name(scalePt2, "scalePt2"); - const vlen = vertices.length, flen = faces.length; - function getBevelVec(inPt, inPrev, inNext) { - let v_trans_x, v_trans_y, shrink_by; - const v_prev_x = inPt.x - inPrev.x, v_prev_y = inPt.y - inPrev.y; - const v_next_x = inNext.x - inPt.x, v_next_y = inNext.y - inPt.y; - const v_prev_lensq = v_prev_x * v_prev_x + v_prev_y * v_prev_y; - const collinear0 = v_prev_x * v_next_y - v_prev_y * v_next_x; - if (Math.abs(collinear0) > Number.EPSILON) { - const v_prev_len = Math.sqrt(v_prev_lensq); - const v_next_len = Math.sqrt(v_next_x * v_next_x + v_next_y * v_next_y); - const ptPrevShift_x = inPrev.x - v_prev_y / v_prev_len; - const ptPrevShift_y = inPrev.y + v_prev_x / v_prev_len; - const ptNextShift_x = inNext.x - v_next_y / v_next_len; - const ptNextShift_y = inNext.y + v_next_x / v_next_len; - const sf = ((ptNextShift_x - ptPrevShift_x) * v_next_y - (ptNextShift_y - ptPrevShift_y) * v_next_x) / (v_prev_x * v_next_y - v_prev_y * v_next_x); - v_trans_x = ptPrevShift_x + v_prev_x * sf - inPt.x; - v_trans_y = ptPrevShift_y + v_prev_y * sf - inPt.y; - const v_trans_lensq = v_trans_x * v_trans_x + v_trans_y * v_trans_y; - if (v_trans_lensq <= 2) { - return new Vector2(v_trans_x, v_trans_y); - } else { - shrink_by = Math.sqrt(v_trans_lensq / 2); - } - } else { - let direction_eq = false; - if (v_prev_x > Number.EPSILON) { - if (v_next_x > Number.EPSILON) { - direction_eq = true; - } - } else { - if (v_prev_x < -Number.EPSILON) { - if (v_next_x < -Number.EPSILON) { - direction_eq = true; - } - } else { - if (Math.sign(v_prev_y) === Math.sign(v_next_y)) { - direction_eq = true; - } - } - } - if (direction_eq) { - v_trans_x = -v_prev_y; - v_trans_y = v_prev_x; - shrink_by = Math.sqrt(v_prev_lensq); - } else { - v_trans_x = v_prev_x; - v_trans_y = v_prev_y; - shrink_by = Math.sqrt(v_prev_lensq / 2); - } - } - return new Vector2(v_trans_x / shrink_by, v_trans_y / shrink_by); - } - __name(getBevelVec, "getBevelVec"); - const contourMovements = []; - for (let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) { - if (j === il) j = 0; - if (k === il) k = 0; - contourMovements[i] = getBevelVec(contour[i], contour[j], contour[k]); - } - const holesMovements = []; - let oneHoleMovements, verticesMovements = contourMovements.concat(); - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - oneHoleMovements = []; - for (let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) { - if (j === il) j = 0; - if (k === il) k = 0; - oneHoleMovements[i] = getBevelVec(ahole[i], ahole[j], ahole[k]); - } - holesMovements.push(oneHoleMovements); - verticesMovements = verticesMovements.concat(oneHoleMovements); - } - for (let b = 0; b < bevelSegments; b++) { - const t2 = b / bevelSegments; - const z = bevelThickness * Math.cos(t2 * Math.PI / 2); - const bs2 = bevelSize * Math.sin(t2 * Math.PI / 2) + bevelOffset; - for (let i = 0, il = contour.length; i < il; i++) { - const vert = scalePt2(contour[i], contourMovements[i], bs2); - v(vert.x, vert.y, -z); - } - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - oneHoleMovements = holesMovements[h]; - for (let i = 0, il = ahole.length; i < il; i++) { - const vert = scalePt2(ahole[i], oneHoleMovements[i], bs2); - v(vert.x, vert.y, -z); - } - } - } - const bs = bevelSize + bevelOffset; - for (let i = 0; i < vlen; i++) { - const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i]; - if (!extrudeByPath) { - v(vert.x, vert.y, 0); - } else { - normal.copy(splineTube.normals[0]).multiplyScalar(vert.x); - binormal.copy(splineTube.binormals[0]).multiplyScalar(vert.y); - position2.copy(extrudePts[0]).add(normal).add(binormal); - v(position2.x, position2.y, position2.z); - } - } - for (let s = 1; s <= steps; s++) { - for (let i = 0; i < vlen; i++) { - const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i]; - if (!extrudeByPath) { - v(vert.x, vert.y, depth / steps * s); - } else { - normal.copy(splineTube.normals[s]).multiplyScalar(vert.x); - binormal.copy(splineTube.binormals[s]).multiplyScalar(vert.y); - position2.copy(extrudePts[s]).add(normal).add(binormal); - v(position2.x, position2.y, position2.z); - } - } - } - for (let b = bevelSegments - 1; b >= 0; b--) { - const t2 = b / bevelSegments; - const z = bevelThickness * Math.cos(t2 * Math.PI / 2); - const bs2 = bevelSize * Math.sin(t2 * Math.PI / 2) + bevelOffset; - for (let i = 0, il = contour.length; i < il; i++) { - const vert = scalePt2(contour[i], contourMovements[i], bs2); - v(vert.x, vert.y, depth + z); - } - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - oneHoleMovements = holesMovements[h]; - for (let i = 0, il = ahole.length; i < il; i++) { - const vert = scalePt2(ahole[i], oneHoleMovements[i], bs2); - if (!extrudeByPath) { - v(vert.x, vert.y, depth + z); - } else { - v(vert.x, vert.y + extrudePts[steps - 1].y, extrudePts[steps - 1].x + z); - } - } - } - } - buildLidFaces(); - buildSideFaces(); - function buildLidFaces() { - const start = verticesArray.length / 3; - if (bevelEnabled) { - let layer = 0; - let offset = vlen * layer; - for (let i = 0; i < flen; i++) { - const face = faces[i]; - f3(face[2] + offset, face[1] + offset, face[0] + offset); - } - layer = steps + bevelSegments * 2; - offset = vlen * layer; - for (let i = 0; i < flen; i++) { - const face = faces[i]; - f3(face[0] + offset, face[1] + offset, face[2] + offset); - } - } else { - for (let i = 0; i < flen; i++) { - const face = faces[i]; - f3(face[2], face[1], face[0]); - } - for (let i = 0; i < flen; i++) { - const face = faces[i]; - f3(face[0] + vlen * steps, face[1] + vlen * steps, face[2] + vlen * steps); - } - } - scope.addGroup(start, verticesArray.length / 3 - start, 0); - } - __name(buildLidFaces, "buildLidFaces"); - function buildSideFaces() { - const start = verticesArray.length / 3; - let layeroffset = 0; - sidewalls(contour, layeroffset); - layeroffset += contour.length; - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - sidewalls(ahole, layeroffset); - layeroffset += ahole.length; - } - scope.addGroup(start, verticesArray.length / 3 - start, 1); - } - __name(buildSideFaces, "buildSideFaces"); - function sidewalls(contour2, layeroffset) { - let i = contour2.length; - while (--i >= 0) { - const j = i; - let k = i - 1; - if (k < 0) k = contour2.length - 1; - for (let s = 0, sl = steps + bevelSegments * 2; s < sl; s++) { - const slen1 = vlen * s; - const slen2 = vlen * (s + 1); - const a = layeroffset + j + slen1, b = layeroffset + k + slen1, c = layeroffset + k + slen2, d = layeroffset + j + slen2; - f4(a, b, c, d); - } - } - } - __name(sidewalls, "sidewalls"); - function v(x, y, z) { - placeholder.push(x); - placeholder.push(y); - placeholder.push(z); - } - __name(v, "v"); - function f3(a, b, c) { - addVertex(a); - addVertex(b); - addVertex(c); - const nextIndex = verticesArray.length / 3; - const uvs = uvgen.generateTopUV(scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1); - addUV(uvs[0]); - addUV(uvs[1]); - addUV(uvs[2]); - } - __name(f3, "f3"); - function f4(a, b, c, d) { - addVertex(a); - addVertex(b); - addVertex(d); - addVertex(b); - addVertex(c); - addVertex(d); - const nextIndex = verticesArray.length / 3; - const uvs = uvgen.generateSideWallUV(scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1); - addUV(uvs[0]); - addUV(uvs[1]); - addUV(uvs[3]); - addUV(uvs[1]); - addUV(uvs[2]); - addUV(uvs[3]); - } - __name(f4, "f4"); - function addVertex(index) { - verticesArray.push(placeholder[index * 3 + 0]); - verticesArray.push(placeholder[index * 3 + 1]); - verticesArray.push(placeholder[index * 3 + 2]); - } - __name(addVertex, "addVertex"); - function addUV(vector2) { - uvArray.push(vector2.x); - uvArray.push(vector2.y); - } - __name(addUV, "addUV"); - } - __name(addShape, "addShape"); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - toJSON() { - const data = super.toJSON(); - const shapes = this.parameters.shapes; - const options = this.parameters.options; - return toJSON$1(shapes, options, data); - } - static fromJSON(data, shapes) { - const geometryShapes = []; - for (let j = 0, jl = data.shapes.length; j < jl; j++) { - const shape = shapes[data.shapes[j]]; - geometryShapes.push(shape); - } - const extrudePath = data.options.extrudePath; - if (extrudePath !== void 0) { - data.options.extrudePath = new Curves[extrudePath.type]().fromJSON(extrudePath); - } - return new ExtrudeGeometry(geometryShapes, data.options); - } -} -const WorldUVGenerator = { - generateTopUV: /* @__PURE__ */ __name(function(geometry, vertices, indexA, indexB, indexC) { - const a_x = vertices[indexA * 3]; - const a_y = vertices[indexA * 3 + 1]; - const b_x = vertices[indexB * 3]; - const b_y = vertices[indexB * 3 + 1]; - const c_x = vertices[indexC * 3]; - const c_y = vertices[indexC * 3 + 1]; - return [ - new Vector2(a_x, a_y), - new Vector2(b_x, b_y), - new Vector2(c_x, c_y) - ]; - }, "generateTopUV"), - generateSideWallUV: /* @__PURE__ */ __name(function(geometry, vertices, indexA, indexB, indexC, indexD) { - const a_x = vertices[indexA * 3]; - const a_y = vertices[indexA * 3 + 1]; - const a_z = vertices[indexA * 3 + 2]; - const b_x = vertices[indexB * 3]; - const b_y = vertices[indexB * 3 + 1]; - const b_z = vertices[indexB * 3 + 2]; - const c_x = vertices[indexC * 3]; - const c_y = vertices[indexC * 3 + 1]; - const c_z = vertices[indexC * 3 + 2]; - const d_x = vertices[indexD * 3]; - const d_y = vertices[indexD * 3 + 1]; - const d_z = vertices[indexD * 3 + 2]; - if (Math.abs(a_y - b_y) < Math.abs(a_x - b_x)) { - return [ - new Vector2(a_x, 1 - a_z), - new Vector2(b_x, 1 - b_z), - new Vector2(c_x, 1 - c_z), - new Vector2(d_x, 1 - d_z) - ]; - } else { - return [ - new Vector2(a_y, 1 - a_z), - new Vector2(b_y, 1 - b_z), - new Vector2(c_y, 1 - c_z), - new Vector2(d_y, 1 - d_z) - ]; - } - }, "generateSideWallUV") -}; -function toJSON$1(shapes, options, data) { - data.shapes = []; - if (Array.isArray(shapes)) { - for (let i = 0, l = shapes.length; i < l; i++) { - const shape = shapes[i]; - data.shapes.push(shape.uuid); - } - } else { - data.shapes.push(shapes.uuid); - } - data.options = Object.assign({}, options); - if (options.extrudePath !== void 0) data.options.extrudePath = options.extrudePath.toJSON(); - return data; -} -__name(toJSON$1, "toJSON$1"); -class IcosahedronGeometry extends PolyhedronGeometry { - static { - __name(this, "IcosahedronGeometry"); - } - constructor(radius = 1, detail = 0) { - const t2 = (1 + Math.sqrt(5)) / 2; - const vertices = [ - -1, - t2, - 0, - 1, - t2, - 0, - -1, - -t2, - 0, - 1, - -t2, - 0, - 0, - -1, - t2, - 0, - 1, - t2, - 0, - -1, - -t2, - 0, - 1, - -t2, - t2, - 0, - -1, - t2, - 0, - 1, - -t2, - 0, - -1, - -t2, - 0, - 1 - ]; - const indices = [ - 0, - 11, - 5, - 0, - 5, - 1, - 0, - 1, - 7, - 0, - 7, - 10, - 0, - 10, - 11, - 1, - 5, - 9, - 5, - 11, - 4, - 11, - 10, - 2, - 10, - 7, - 6, - 7, - 1, - 8, - 3, - 9, - 4, - 3, - 4, - 2, - 3, - 2, - 6, - 3, - 6, - 8, - 3, - 8, - 9, - 4, - 9, - 5, - 2, - 4, - 11, - 6, - 2, - 10, - 8, - 6, - 7, - 9, - 8, - 1 - ]; - super(vertices, indices, radius, detail); - this.type = "IcosahedronGeometry"; - this.parameters = { - radius, - detail - }; - } - static fromJSON(data) { - return new IcosahedronGeometry(data.radius, data.detail); - } -} -class OctahedronGeometry extends PolyhedronGeometry { - static { - __name(this, "OctahedronGeometry"); - } - constructor(radius = 1, detail = 0) { - const vertices = [ - 1, - 0, - 0, - -1, - 0, - 0, - 0, - 1, - 0, - 0, - -1, - 0, - 0, - 0, - 1, - 0, - 0, - -1 - ]; - const indices = [ - 0, - 2, - 4, - 0, - 4, - 3, - 0, - 3, - 5, - 0, - 5, - 2, - 1, - 2, - 5, - 1, - 5, - 3, - 1, - 3, - 4, - 1, - 4, - 2 - ]; - super(vertices, indices, radius, detail); - this.type = "OctahedronGeometry"; - this.parameters = { - radius, - detail - }; - } - static fromJSON(data) { - return new OctahedronGeometry(data.radius, data.detail); - } -} -class RingGeometry extends BufferGeometry { - static { - __name(this, "RingGeometry"); - } - constructor(innerRadius = 0.5, outerRadius = 1, thetaSegments = 32, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2) { - super(); - this.type = "RingGeometry"; - this.parameters = { - innerRadius, - outerRadius, - thetaSegments, - phiSegments, - thetaStart, - thetaLength - }; - thetaSegments = Math.max(3, thetaSegments); - phiSegments = Math.max(1, phiSegments); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - let radius = innerRadius; - const radiusStep = (outerRadius - innerRadius) / phiSegments; - const vertex2 = new Vector3(); - const uv = new Vector2(); - for (let j = 0; j <= phiSegments; j++) { - for (let i = 0; i <= thetaSegments; i++) { - const segment = thetaStart + i / thetaSegments * thetaLength; - vertex2.x = radius * Math.cos(segment); - vertex2.y = radius * Math.sin(segment); - vertices.push(vertex2.x, vertex2.y, vertex2.z); - normals.push(0, 0, 1); - uv.x = (vertex2.x / outerRadius + 1) / 2; - uv.y = (vertex2.y / outerRadius + 1) / 2; - uvs.push(uv.x, uv.y); - } - radius += radiusStep; - } - for (let j = 0; j < phiSegments; j++) { - const thetaSegmentLevel = j * (thetaSegments + 1); - for (let i = 0; i < thetaSegments; i++) { - const segment = i + thetaSegmentLevel; - const a = segment; - const b = segment + thetaSegments + 1; - const c = segment + thetaSegments + 2; - const d = segment + 1; - indices.push(a, b, d); - indices.push(b, c, d); - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new RingGeometry(data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength); - } -} -class ShapeGeometry extends BufferGeometry { - static { - __name(this, "ShapeGeometry"); - } - constructor(shapes = new Shape([new Vector2(0, 0.5), new Vector2(-0.5, -0.5), new Vector2(0.5, -0.5)]), curveSegments = 12) { - super(); - this.type = "ShapeGeometry"; - this.parameters = { - shapes, - curveSegments - }; - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - let groupStart = 0; - let groupCount = 0; - if (Array.isArray(shapes) === false) { - addShape(shapes); - } else { - for (let i = 0; i < shapes.length; i++) { - addShape(shapes[i]); - this.addGroup(groupStart, groupCount, i); - groupStart += groupCount; - groupCount = 0; - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - function addShape(shape) { - const indexOffset = vertices.length / 3; - const points = shape.extractPoints(curveSegments); - let shapeVertices = points.shape; - const shapeHoles = points.holes; - if (ShapeUtils.isClockWise(shapeVertices) === false) { - shapeVertices = shapeVertices.reverse(); - } - for (let i = 0, l = shapeHoles.length; i < l; i++) { - const shapeHole = shapeHoles[i]; - if (ShapeUtils.isClockWise(shapeHole) === true) { - shapeHoles[i] = shapeHole.reverse(); - } - } - const faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles); - for (let i = 0, l = shapeHoles.length; i < l; i++) { - const shapeHole = shapeHoles[i]; - shapeVertices = shapeVertices.concat(shapeHole); - } - for (let i = 0, l = shapeVertices.length; i < l; i++) { - const vertex2 = shapeVertices[i]; - vertices.push(vertex2.x, vertex2.y, 0); - normals.push(0, 0, 1); - uvs.push(vertex2.x, vertex2.y); - } - for (let i = 0, l = faces.length; i < l; i++) { - const face = faces[i]; - const a = face[0] + indexOffset; - const b = face[1] + indexOffset; - const c = face[2] + indexOffset; - indices.push(a, b, c); - groupCount += 3; - } - } - __name(addShape, "addShape"); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - toJSON() { - const data = super.toJSON(); - const shapes = this.parameters.shapes; - return toJSON(shapes, data); - } - static fromJSON(data, shapes) { - const geometryShapes = []; - for (let j = 0, jl = data.shapes.length; j < jl; j++) { - const shape = shapes[data.shapes[j]]; - geometryShapes.push(shape); - } - return new ShapeGeometry(geometryShapes, data.curveSegments); - } -} -function toJSON(shapes, data) { - data.shapes = []; - if (Array.isArray(shapes)) { - for (let i = 0, l = shapes.length; i < l; i++) { - const shape = shapes[i]; - data.shapes.push(shape.uuid); - } - } else { - data.shapes.push(shapes.uuid); - } - return data; -} -__name(toJSON, "toJSON"); -class SphereGeometry extends BufferGeometry { - static { - __name(this, "SphereGeometry"); - } - constructor(radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI) { - super(); - this.type = "SphereGeometry"; - this.parameters = { - radius, - widthSegments, - heightSegments, - phiStart, - phiLength, - thetaStart, - thetaLength - }; - widthSegments = Math.max(3, Math.floor(widthSegments)); - heightSegments = Math.max(2, Math.floor(heightSegments)); - const thetaEnd = Math.min(thetaStart + thetaLength, Math.PI); - let index = 0; - const grid = []; - const vertex2 = new Vector3(); - const normal = new Vector3(); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - for (let iy = 0; iy <= heightSegments; iy++) { - const verticesRow = []; - const v = iy / heightSegments; - let uOffset = 0; - if (iy === 0 && thetaStart === 0) { - uOffset = 0.5 / widthSegments; - } else if (iy === heightSegments && thetaEnd === Math.PI) { - uOffset = -0.5 / widthSegments; - } - for (let ix = 0; ix <= widthSegments; ix++) { - const u = ix / widthSegments; - vertex2.x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength); - vertex2.y = radius * Math.cos(thetaStart + v * thetaLength); - vertex2.z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength); - vertices.push(vertex2.x, vertex2.y, vertex2.z); - normal.copy(vertex2).normalize(); - normals.push(normal.x, normal.y, normal.z); - uvs.push(u + uOffset, 1 - v); - verticesRow.push(index++); - } - grid.push(verticesRow); - } - for (let iy = 0; iy < heightSegments; iy++) { - for (let ix = 0; ix < widthSegments; ix++) { - const a = grid[iy][ix + 1]; - const b = grid[iy][ix]; - const c = grid[iy + 1][ix]; - const d = grid[iy + 1][ix + 1]; - if (iy !== 0 || thetaStart > 0) indices.push(a, b, d); - if (iy !== heightSegments - 1 || thetaEnd < Math.PI) indices.push(b, c, d); - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new SphereGeometry(data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength); - } -} -class TetrahedronGeometry extends PolyhedronGeometry { - static { - __name(this, "TetrahedronGeometry"); - } - constructor(radius = 1, detail = 0) { - const vertices = [ - 1, - 1, - 1, - -1, - -1, - 1, - -1, - 1, - -1, - 1, - -1, - -1 - ]; - const indices = [ - 2, - 1, - 0, - 0, - 3, - 2, - 1, - 3, - 0, - 2, - 3, - 1 - ]; - super(vertices, indices, radius, detail); - this.type = "TetrahedronGeometry"; - this.parameters = { - radius, - detail - }; - } - static fromJSON(data) { - return new TetrahedronGeometry(data.radius, data.detail); - } -} -class TorusGeometry extends BufferGeometry { - static { - __name(this, "TorusGeometry"); - } - constructor(radius = 1, tube = 0.4, radialSegments = 12, tubularSegments = 48, arc = Math.PI * 2) { - super(); - this.type = "TorusGeometry"; - this.parameters = { - radius, - tube, - radialSegments, - tubularSegments, - arc - }; - radialSegments = Math.floor(radialSegments); - tubularSegments = Math.floor(tubularSegments); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - const center = new Vector3(); - const vertex2 = new Vector3(); - const normal = new Vector3(); - for (let j = 0; j <= radialSegments; j++) { - for (let i = 0; i <= tubularSegments; i++) { - const u = i / tubularSegments * arc; - const v = j / radialSegments * Math.PI * 2; - vertex2.x = (radius + tube * Math.cos(v)) * Math.cos(u); - vertex2.y = (radius + tube * Math.cos(v)) * Math.sin(u); - vertex2.z = tube * Math.sin(v); - vertices.push(vertex2.x, vertex2.y, vertex2.z); - center.x = radius * Math.cos(u); - center.y = radius * Math.sin(u); - normal.subVectors(vertex2, center).normalize(); - normals.push(normal.x, normal.y, normal.z); - uvs.push(i / tubularSegments); - uvs.push(j / radialSegments); - } - } - for (let j = 1; j <= radialSegments; j++) { - for (let i = 1; i <= tubularSegments; i++) { - const a = (tubularSegments + 1) * j + i - 1; - const b = (tubularSegments + 1) * (j - 1) + i - 1; - const c = (tubularSegments + 1) * (j - 1) + i; - const d = (tubularSegments + 1) * j + i; - indices.push(a, b, d); - indices.push(b, c, d); - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new TorusGeometry(data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc); - } -} -class TorusKnotGeometry extends BufferGeometry { - static { - __name(this, "TorusKnotGeometry"); - } - constructor(radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3) { - super(); - this.type = "TorusKnotGeometry"; - this.parameters = { - radius, - tube, - tubularSegments, - radialSegments, - p, - q - }; - tubularSegments = Math.floor(tubularSegments); - radialSegments = Math.floor(radialSegments); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - const vertex2 = new Vector3(); - const normal = new Vector3(); - const P1 = new Vector3(); - const P2 = new Vector3(); - const B = new Vector3(); - const T = new Vector3(); - const N = new Vector3(); - for (let i = 0; i <= tubularSegments; ++i) { - const u = i / tubularSegments * p * Math.PI * 2; - calculatePositionOnCurve(u, p, q, radius, P1); - calculatePositionOnCurve(u + 0.01, p, q, radius, P2); - T.subVectors(P2, P1); - N.addVectors(P2, P1); - B.crossVectors(T, N); - N.crossVectors(B, T); - B.normalize(); - N.normalize(); - for (let j = 0; j <= radialSegments; ++j) { - const v = j / radialSegments * Math.PI * 2; - const cx = -tube * Math.cos(v); - const cy = tube * Math.sin(v); - vertex2.x = P1.x + (cx * N.x + cy * B.x); - vertex2.y = P1.y + (cx * N.y + cy * B.y); - vertex2.z = P1.z + (cx * N.z + cy * B.z); - vertices.push(vertex2.x, vertex2.y, vertex2.z); - normal.subVectors(vertex2, P1).normalize(); - normals.push(normal.x, normal.y, normal.z); - uvs.push(i / tubularSegments); - uvs.push(j / radialSegments); - } - } - for (let j = 1; j <= tubularSegments; j++) { - for (let i = 1; i <= radialSegments; i++) { - const a = (radialSegments + 1) * (j - 1) + (i - 1); - const b = (radialSegments + 1) * j + (i - 1); - const c = (radialSegments + 1) * j + i; - const d = (radialSegments + 1) * (j - 1) + i; - indices.push(a, b, d); - indices.push(b, c, d); - } - } - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - function calculatePositionOnCurve(u, p2, q2, radius2, position) { - const cu = Math.cos(u); - const su = Math.sin(u); - const quOverP = q2 / p2 * u; - const cs = Math.cos(quOverP); - position.x = radius2 * (2 + cs) * 0.5 * cu; - position.y = radius2 * (2 + cs) * su * 0.5; - position.z = radius2 * Math.sin(quOverP) * 0.5; - } - __name(calculatePositionOnCurve, "calculatePositionOnCurve"); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - static fromJSON(data) { - return new TorusKnotGeometry(data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q); - } -} -class TubeGeometry extends BufferGeometry { - static { - __name(this, "TubeGeometry"); - } - constructor(path = new QuadraticBezierCurve3(new Vector3(-1, -1, 0), new Vector3(-1, 1, 0), new Vector3(1, 1, 0)), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false) { - super(); - this.type = "TubeGeometry"; - this.parameters = { - path, - tubularSegments, - radius, - radialSegments, - closed - }; - const frames = path.computeFrenetFrames(tubularSegments, closed); - this.tangents = frames.tangents; - this.normals = frames.normals; - this.binormals = frames.binormals; - const vertex2 = new Vector3(); - const normal = new Vector3(); - const uv = new Vector2(); - let P = new Vector3(); - const vertices = []; - const normals = []; - const uvs = []; - const indices = []; - generateBufferData(); - this.setIndex(indices); - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - this.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - this.setAttribute("uv", new Float32BufferAttribute(uvs, 2)); - function generateBufferData() { - for (let i = 0; i < tubularSegments; i++) { - generateSegment(i); - } - generateSegment(closed === false ? tubularSegments : 0); - generateUVs(); - generateIndices(); - } - __name(generateBufferData, "generateBufferData"); - function generateSegment(i) { - P = path.getPointAt(i / tubularSegments, P); - const N = frames.normals[i]; - const B = frames.binormals[i]; - for (let j = 0; j <= radialSegments; j++) { - const v = j / radialSegments * Math.PI * 2; - const sin = Math.sin(v); - const cos = -Math.cos(v); - normal.x = cos * N.x + sin * B.x; - normal.y = cos * N.y + sin * B.y; - normal.z = cos * N.z + sin * B.z; - normal.normalize(); - normals.push(normal.x, normal.y, normal.z); - vertex2.x = P.x + radius * normal.x; - vertex2.y = P.y + radius * normal.y; - vertex2.z = P.z + radius * normal.z; - vertices.push(vertex2.x, vertex2.y, vertex2.z); - } - } - __name(generateSegment, "generateSegment"); - function generateIndices() { - for (let j = 1; j <= tubularSegments; j++) { - for (let i = 1; i <= radialSegments; i++) { - const a = (radialSegments + 1) * (j - 1) + (i - 1); - const b = (radialSegments + 1) * j + (i - 1); - const c = (radialSegments + 1) * j + i; - const d = (radialSegments + 1) * (j - 1) + i; - indices.push(a, b, d); - indices.push(b, c, d); - } - } - } - __name(generateIndices, "generateIndices"); - function generateUVs() { - for (let i = 0; i <= tubularSegments; i++) { - for (let j = 0; j <= radialSegments; j++) { - uv.x = i / tubularSegments; - uv.y = j / radialSegments; - uvs.push(uv.x, uv.y); - } - } - } - __name(generateUVs, "generateUVs"); - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } - toJSON() { - const data = super.toJSON(); - data.path = this.parameters.path.toJSON(); - return data; - } - static fromJSON(data) { - return new TubeGeometry( - new Curves[data.path.type]().fromJSON(data.path), - data.tubularSegments, - data.radius, - data.radialSegments, - data.closed - ); - } -} -class WireframeGeometry extends BufferGeometry { - static { - __name(this, "WireframeGeometry"); - } - constructor(geometry = null) { - super(); - this.type = "WireframeGeometry"; - this.parameters = { - geometry - }; - if (geometry !== null) { - const vertices = []; - const edges = /* @__PURE__ */ new Set(); - const start = new Vector3(); - const end = new Vector3(); - if (geometry.index !== null) { - const position = geometry.attributes.position; - const indices = geometry.index; - let groups = geometry.groups; - if (groups.length === 0) { - groups = [{ start: 0, count: indices.count, materialIndex: 0 }]; - } - for (let o = 0, ol = groups.length; o < ol; ++o) { - const group = groups[o]; - const groupStart = group.start; - const groupCount = group.count; - for (let i = groupStart, l = groupStart + groupCount; i < l; i += 3) { - for (let j = 0; j < 3; j++) { - const index1 = indices.getX(i + j); - const index2 = indices.getX(i + (j + 1) % 3); - start.fromBufferAttribute(position, index1); - end.fromBufferAttribute(position, index2); - if (isUniqueEdge(start, end, edges) === true) { - vertices.push(start.x, start.y, start.z); - vertices.push(end.x, end.y, end.z); - } - } - } - } - } else { - const position = geometry.attributes.position; - for (let i = 0, l = position.count / 3; i < l; i++) { - for (let j = 0; j < 3; j++) { - const index1 = 3 * i + j; - const index2 = 3 * i + (j + 1) % 3; - start.fromBufferAttribute(position, index1); - end.fromBufferAttribute(position, index2); - if (isUniqueEdge(start, end, edges) === true) { - vertices.push(start.x, start.y, start.z); - vertices.push(end.x, end.y, end.z); - } - } - } - } - this.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - } - } - copy(source) { - super.copy(source); - this.parameters = Object.assign({}, source.parameters); - return this; - } -} -function isUniqueEdge(start, end, edges) { - const hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`; - const hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; - if (edges.has(hash1) === true || edges.has(hash2) === true) { - return false; - } else { - edges.add(hash1); - edges.add(hash2); - return true; - } -} -__name(isUniqueEdge, "isUniqueEdge"); -var Geometries = /* @__PURE__ */ Object.freeze({ - __proto__: null, - BoxGeometry, - CapsuleGeometry, - CircleGeometry, - ConeGeometry, - CylinderGeometry, - DodecahedronGeometry, - EdgesGeometry, - ExtrudeGeometry, - IcosahedronGeometry, - LatheGeometry, - OctahedronGeometry, - PlaneGeometry, - PolyhedronGeometry, - RingGeometry, - ShapeGeometry, - SphereGeometry, - TetrahedronGeometry, - TorusGeometry, - TorusKnotGeometry, - TubeGeometry, - WireframeGeometry -}); -class ShadowMaterial extends Material { - static { - __name(this, "ShadowMaterial"); - } - static get type() { - return "ShadowMaterial"; - } - constructor(parameters) { - super(); - this.isShadowMaterial = true; - this.color = new Color(0); - this.transparent = true; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.fog = source.fog; - return this; - } -} -class RawShaderMaterial extends ShaderMaterial { - static { - __name(this, "RawShaderMaterial"); - } - static get type() { - return "RawShaderMaterial"; - } - constructor(parameters) { - super(parameters); - this.isRawShaderMaterial = true; - } -} -class MeshStandardMaterial extends Material { - static { - __name(this, "MeshStandardMaterial"); - } - static get type() { - return "MeshStandardMaterial"; - } - constructor(parameters) { - super(); - this.isMeshStandardMaterial = true; - this.defines = { "STANDARD": "" }; - this.color = new Color(16777215); - this.roughness = 1; - this.metalness = 0; - this.map = null; - this.lightMap = null; - this.lightMapIntensity = 1; - this.aoMap = null; - this.aoMapIntensity = 1; - this.emissive = new Color(0); - this.emissiveIntensity = 1; - this.emissiveMap = null; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.roughnessMap = null; - this.metalnessMap = null; - this.alphaMap = null; - this.envMap = null; - this.envMapRotation = new Euler(); - this.envMapIntensity = 1; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = "round"; - this.wireframeLinejoin = "round"; - this.flatShading = false; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.defines = { "STANDARD": "" }; - this.color.copy(source.color); - this.roughness = source.roughness; - this.metalness = source.metalness; - this.map = source.map; - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - this.emissive.copy(source.emissive); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy(source.normalScale); - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.roughnessMap = source.roughnessMap; - this.metalnessMap = source.metalnessMap; - this.alphaMap = source.alphaMap; - this.envMap = source.envMap; - this.envMapRotation.copy(source.envMapRotation); - this.envMapIntensity = source.envMapIntensity; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - this.flatShading = source.flatShading; - this.fog = source.fog; - return this; - } -} -class MeshPhysicalMaterial extends MeshStandardMaterial { - static { - __name(this, "MeshPhysicalMaterial"); - } - static get type() { - return "MeshPhysicalMaterial"; - } - constructor(parameters) { - super(); - this.isMeshPhysicalMaterial = true; - this.defines = { - "STANDARD": "", - "PHYSICAL": "" - }; - this.anisotropyRotation = 0; - this.anisotropyMap = null; - this.clearcoatMap = null; - this.clearcoatRoughness = 0; - this.clearcoatRoughnessMap = null; - this.clearcoatNormalScale = new Vector2(1, 1); - this.clearcoatNormalMap = null; - this.ior = 1.5; - Object.defineProperty(this, "reflectivity", { - get: /* @__PURE__ */ __name(function() { - return clamp(2.5 * (this.ior - 1) / (this.ior + 1), 0, 1); - }, "get"), - set: /* @__PURE__ */ __name(function(reflectivity) { - this.ior = (1 + 0.4 * reflectivity) / (1 - 0.4 * reflectivity); - }, "set") - }); - this.iridescenceMap = null; - this.iridescenceIOR = 1.3; - this.iridescenceThicknessRange = [100, 400]; - this.iridescenceThicknessMap = null; - this.sheenColor = new Color(0); - this.sheenColorMap = null; - this.sheenRoughness = 1; - this.sheenRoughnessMap = null; - this.transmissionMap = null; - this.thickness = 0; - this.thicknessMap = null; - this.attenuationDistance = Infinity; - this.attenuationColor = new Color(1, 1, 1); - this.specularIntensity = 1; - this.specularIntensityMap = null; - this.specularColor = new Color(1, 1, 1); - this.specularColorMap = null; - this._anisotropy = 0; - this._clearcoat = 0; - this._dispersion = 0; - this._iridescence = 0; - this._sheen = 0; - this._transmission = 0; - this.setValues(parameters); - } - get anisotropy() { - return this._anisotropy; - } - set anisotropy(value) { - if (this._anisotropy > 0 !== value > 0) { - this.version++; - } - this._anisotropy = value; - } - get clearcoat() { - return this._clearcoat; - } - set clearcoat(value) { - if (this._clearcoat > 0 !== value > 0) { - this.version++; - } - this._clearcoat = value; - } - get iridescence() { - return this._iridescence; - } - set iridescence(value) { - if (this._iridescence > 0 !== value > 0) { - this.version++; - } - this._iridescence = value; - } - get dispersion() { - return this._dispersion; - } - set dispersion(value) { - if (this._dispersion > 0 !== value > 0) { - this.version++; - } - this._dispersion = value; - } - get sheen() { - return this._sheen; - } - set sheen(value) { - if (this._sheen > 0 !== value > 0) { - this.version++; - } - this._sheen = value; - } - get transmission() { - return this._transmission; - } - set transmission(value) { - if (this._transmission > 0 !== value > 0) { - this.version++; - } - this._transmission = value; - } - copy(source) { - super.copy(source); - this.defines = { - "STANDARD": "", - "PHYSICAL": "" - }; - this.anisotropy = source.anisotropy; - this.anisotropyRotation = source.anisotropyRotation; - this.anisotropyMap = source.anisotropyMap; - this.clearcoat = source.clearcoat; - this.clearcoatMap = source.clearcoatMap; - this.clearcoatRoughness = source.clearcoatRoughness; - this.clearcoatRoughnessMap = source.clearcoatRoughnessMap; - this.clearcoatNormalMap = source.clearcoatNormalMap; - this.clearcoatNormalScale.copy(source.clearcoatNormalScale); - this.dispersion = source.dispersion; - this.ior = source.ior; - this.iridescence = source.iridescence; - this.iridescenceMap = source.iridescenceMap; - this.iridescenceIOR = source.iridescenceIOR; - this.iridescenceThicknessRange = [...source.iridescenceThicknessRange]; - this.iridescenceThicknessMap = source.iridescenceThicknessMap; - this.sheen = source.sheen; - this.sheenColor.copy(source.sheenColor); - this.sheenColorMap = source.sheenColorMap; - this.sheenRoughness = source.sheenRoughness; - this.sheenRoughnessMap = source.sheenRoughnessMap; - this.transmission = source.transmission; - this.transmissionMap = source.transmissionMap; - this.thickness = source.thickness; - this.thicknessMap = source.thicknessMap; - this.attenuationDistance = source.attenuationDistance; - this.attenuationColor.copy(source.attenuationColor); - this.specularIntensity = source.specularIntensity; - this.specularIntensityMap = source.specularIntensityMap; - this.specularColor.copy(source.specularColor); - this.specularColorMap = source.specularColorMap; - return this; - } -} -class MeshPhongMaterial extends Material { - static { - __name(this, "MeshPhongMaterial"); - } - static get type() { - return "MeshPhongMaterial"; - } - constructor(parameters) { - super(); - this.isMeshPhongMaterial = true; - this.color = new Color(16777215); - this.specular = new Color(1118481); - this.shininess = 30; - this.map = null; - this.lightMap = null; - this.lightMapIntensity = 1; - this.aoMap = null; - this.aoMapIntensity = 1; - this.emissive = new Color(0); - this.emissiveIntensity = 1; - this.emissiveMap = null; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.specularMap = null; - this.alphaMap = null; - this.envMap = null; - this.envMapRotation = new Euler(); - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = "round"; - this.wireframeLinejoin = "round"; - this.flatShading = false; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.specular.copy(source.specular); - this.shininess = source.shininess; - this.map = source.map; - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - this.emissive.copy(source.emissive); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy(source.normalScale); - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.specularMap = source.specularMap; - this.alphaMap = source.alphaMap; - this.envMap = source.envMap; - this.envMapRotation.copy(source.envMapRotation); - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - this.flatShading = source.flatShading; - this.fog = source.fog; - return this; - } -} -class MeshToonMaterial extends Material { - static { - __name(this, "MeshToonMaterial"); - } - static get type() { - return "MeshToonMaterial"; - } - constructor(parameters) { - super(); - this.isMeshToonMaterial = true; - this.defines = { "TOON": "" }; - this.color = new Color(16777215); - this.map = null; - this.gradientMap = null; - this.lightMap = null; - this.lightMapIntensity = 1; - this.aoMap = null; - this.aoMapIntensity = 1; - this.emissive = new Color(0); - this.emissiveIntensity = 1; - this.emissiveMap = null; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.alphaMap = null; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = "round"; - this.wireframeLinejoin = "round"; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.map = source.map; - this.gradientMap = source.gradientMap; - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - this.emissive.copy(source.emissive); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy(source.normalScale); - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.alphaMap = source.alphaMap; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - this.fog = source.fog; - return this; - } -} -class MeshNormalMaterial extends Material { - static { - __name(this, "MeshNormalMaterial"); - } - static get type() { - return "MeshNormalMaterial"; - } - constructor(parameters) { - super(); - this.isMeshNormalMaterial = true; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.flatShading = false; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy(source.normalScale); - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.flatShading = source.flatShading; - return this; - } -} -class MeshLambertMaterial extends Material { - static { - __name(this, "MeshLambertMaterial"); - } - static get type() { - return "MeshLambertMaterial"; - } - constructor(parameters) { - super(); - this.isMeshLambertMaterial = true; - this.color = new Color(16777215); - this.map = null; - this.lightMap = null; - this.lightMapIntensity = 1; - this.aoMap = null; - this.aoMapIntensity = 1; - this.emissive = new Color(0); - this.emissiveIntensity = 1; - this.emissiveMap = null; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.specularMap = null; - this.alphaMap = null; - this.envMap = null; - this.envMapRotation = new Euler(); - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = "round"; - this.wireframeLinejoin = "round"; - this.flatShading = false; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.color.copy(source.color); - this.map = source.map; - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - this.emissive.copy(source.emissive); - this.emissiveMap = source.emissiveMap; - this.emissiveIntensity = source.emissiveIntensity; - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy(source.normalScale); - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.specularMap = source.specularMap; - this.alphaMap = source.alphaMap; - this.envMap = source.envMap; - this.envMapRotation.copy(source.envMapRotation); - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - this.flatShading = source.flatShading; - this.fog = source.fog; - return this; - } -} -class MeshMatcapMaterial extends Material { - static { - __name(this, "MeshMatcapMaterial"); - } - static get type() { - return "MeshMatcapMaterial"; - } - constructor(parameters) { - super(); - this.isMeshMatcapMaterial = true; - this.defines = { "MATCAP": "" }; - this.color = new Color(16777215); - this.matcap = null; - this.map = null; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.alphaMap = null; - this.flatShading = false; - this.fog = true; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.defines = { "MATCAP": "" }; - this.color.copy(source.color); - this.matcap = source.matcap; - this.map = source.map; - this.bumpMap = source.bumpMap; - this.bumpScale = source.bumpScale; - this.normalMap = source.normalMap; - this.normalMapType = source.normalMapType; - this.normalScale.copy(source.normalScale); - this.displacementMap = source.displacementMap; - this.displacementScale = source.displacementScale; - this.displacementBias = source.displacementBias; - this.alphaMap = source.alphaMap; - this.flatShading = source.flatShading; - this.fog = source.fog; - return this; - } -} -class LineDashedMaterial extends LineBasicMaterial { - static { - __name(this, "LineDashedMaterial"); - } - static get type() { - return "LineDashedMaterial"; - } - constructor(parameters) { - super(); - this.isLineDashedMaterial = true; - this.scale = 1; - this.dashSize = 3; - this.gapSize = 1; - this.setValues(parameters); - } - copy(source) { - super.copy(source); - this.scale = source.scale; - this.dashSize = source.dashSize; - this.gapSize = source.gapSize; - return this; - } -} -function convertArray(array, type, forceClone) { - if (!array || // let 'undefined' and 'null' pass - !forceClone && array.constructor === type) return array; - if (typeof type.BYTES_PER_ELEMENT === "number") { - return new type(array); - } - return Array.prototype.slice.call(array); -} -__name(convertArray, "convertArray"); -function isTypedArray(object) { - return ArrayBuffer.isView(object) && !(object instanceof DataView); -} -__name(isTypedArray, "isTypedArray"); -function getKeyframeOrder(times) { - function compareTime(i, j) { - return times[i] - times[j]; - } - __name(compareTime, "compareTime"); - const n = times.length; - const result = new Array(n); - for (let i = 0; i !== n; ++i) result[i] = i; - result.sort(compareTime); - return result; -} -__name(getKeyframeOrder, "getKeyframeOrder"); -function sortedArray(values, stride, order) { - const nValues = values.length; - const result = new values.constructor(nValues); - for (let i = 0, dstOffset = 0; dstOffset !== nValues; ++i) { - const srcOffset = order[i] * stride; - for (let j = 0; j !== stride; ++j) { - result[dstOffset++] = values[srcOffset + j]; - } - } - return result; -} -__name(sortedArray, "sortedArray"); -function flattenJSON(jsonKeys, times, values, valuePropertyName) { - let i = 1, key = jsonKeys[0]; - while (key !== void 0 && key[valuePropertyName] === void 0) { - key = jsonKeys[i++]; - } - if (key === void 0) return; - let value = key[valuePropertyName]; - if (value === void 0) return; - if (Array.isArray(value)) { - do { - value = key[valuePropertyName]; - if (value !== void 0) { - times.push(key.time); - values.push.apply(values, value); - } - key = jsonKeys[i++]; - } while (key !== void 0); - } else if (value.toArray !== void 0) { - do { - value = key[valuePropertyName]; - if (value !== void 0) { - times.push(key.time); - value.toArray(values, values.length); - } - key = jsonKeys[i++]; - } while (key !== void 0); - } else { - do { - value = key[valuePropertyName]; - if (value !== void 0) { - times.push(key.time); - values.push(value); - } - key = jsonKeys[i++]; - } while (key !== void 0); - } -} -__name(flattenJSON, "flattenJSON"); -function subclip(sourceClip, name, startFrame, endFrame, fps = 30) { - const clip = sourceClip.clone(); - clip.name = name; - const tracks = []; - for (let i = 0; i < clip.tracks.length; ++i) { - const track = clip.tracks[i]; - const valueSize = track.getValueSize(); - const times = []; - const values = []; - for (let j = 0; j < track.times.length; ++j) { - const frame = track.times[j] * fps; - if (frame < startFrame || frame >= endFrame) continue; - times.push(track.times[j]); - for (let k = 0; k < valueSize; ++k) { - values.push(track.values[j * valueSize + k]); - } - } - if (times.length === 0) continue; - track.times = convertArray(times, track.times.constructor); - track.values = convertArray(values, track.values.constructor); - tracks.push(track); - } - clip.tracks = tracks; - let minStartTime = Infinity; - for (let i = 0; i < clip.tracks.length; ++i) { - if (minStartTime > clip.tracks[i].times[0]) { - minStartTime = clip.tracks[i].times[0]; - } - } - for (let i = 0; i < clip.tracks.length; ++i) { - clip.tracks[i].shift(-1 * minStartTime); - } - clip.resetDuration(); - return clip; -} -__name(subclip, "subclip"); -function makeClipAdditive(targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) { - if (fps <= 0) fps = 30; - const numTracks = referenceClip.tracks.length; - const referenceTime = referenceFrame / fps; - for (let i = 0; i < numTracks; ++i) { - const referenceTrack = referenceClip.tracks[i]; - const referenceTrackType = referenceTrack.ValueTypeName; - if (referenceTrackType === "bool" || referenceTrackType === "string") continue; - const targetTrack = targetClip.tracks.find(function(track) { - return track.name === referenceTrack.name && track.ValueTypeName === referenceTrackType; - }); - if (targetTrack === void 0) continue; - let referenceOffset = 0; - const referenceValueSize = referenceTrack.getValueSize(); - if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) { - referenceOffset = referenceValueSize / 3; - } - let targetOffset = 0; - const targetValueSize = targetTrack.getValueSize(); - if (targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) { - targetOffset = targetValueSize / 3; - } - const lastIndex = referenceTrack.times.length - 1; - let referenceValue; - if (referenceTime <= referenceTrack.times[0]) { - const startIndex = referenceOffset; - const endIndex = referenceValueSize - referenceOffset; - referenceValue = referenceTrack.values.slice(startIndex, endIndex); - } else if (referenceTime >= referenceTrack.times[lastIndex]) { - const startIndex = lastIndex * referenceValueSize + referenceOffset; - const endIndex = startIndex + referenceValueSize - referenceOffset; - referenceValue = referenceTrack.values.slice(startIndex, endIndex); - } else { - const interpolant = referenceTrack.createInterpolant(); - const startIndex = referenceOffset; - const endIndex = referenceValueSize - referenceOffset; - interpolant.evaluate(referenceTime); - referenceValue = interpolant.resultBuffer.slice(startIndex, endIndex); - } - if (referenceTrackType === "quaternion") { - const referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate(); - referenceQuat.toArray(referenceValue); - } - const numTimes = targetTrack.times.length; - for (let j = 0; j < numTimes; ++j) { - const valueStart = j * targetValueSize + targetOffset; - if (referenceTrackType === "quaternion") { - Quaternion.multiplyQuaternionsFlat( - targetTrack.values, - valueStart, - referenceValue, - 0, - targetTrack.values, - valueStart - ); - } else { - const valueEnd = targetValueSize - targetOffset * 2; - for (let k = 0; k < valueEnd; ++k) { - targetTrack.values[valueStart + k] -= referenceValue[k]; - } - } - } - } - targetClip.blendMode = AdditiveAnimationBlendMode; - return targetClip; -} -__name(makeClipAdditive, "makeClipAdditive"); -const AnimationUtils = { - convertArray, - isTypedArray, - getKeyframeOrder, - sortedArray, - flattenJSON, - subclip, - makeClipAdditive -}; -class Interpolant { - static { - __name(this, "Interpolant"); - } - constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { - this.parameterPositions = parameterPositions; - this._cachedIndex = 0; - this.resultBuffer = resultBuffer !== void 0 ? resultBuffer : new sampleValues.constructor(sampleSize); - this.sampleValues = sampleValues; - this.valueSize = sampleSize; - this.settings = null; - this.DefaultSettings_ = {}; - } - evaluate(t2) { - const pp = this.parameterPositions; - let i1 = this._cachedIndex, t1 = pp[i1], t0 = pp[i1 - 1]; - validate_interval: { - seek: { - let right; - linear_scan: { - forward_scan: if (!(t2 < t1)) { - for (let giveUpAt = i1 + 2; ; ) { - if (t1 === void 0) { - if (t2 < t0) break forward_scan; - i1 = pp.length; - this._cachedIndex = i1; - return this.copySampleValue_(i1 - 1); - } - if (i1 === giveUpAt) break; - t0 = t1; - t1 = pp[++i1]; - if (t2 < t1) { - break seek; - } - } - right = pp.length; - break linear_scan; - } - if (!(t2 >= t0)) { - const t1global = pp[1]; - if (t2 < t1global) { - i1 = 2; - t0 = t1global; - } - for (let giveUpAt = i1 - 2; ; ) { - if (t0 === void 0) { - this._cachedIndex = 0; - return this.copySampleValue_(0); - } - if (i1 === giveUpAt) break; - t1 = t0; - t0 = pp[--i1 - 1]; - if (t2 >= t0) { - break seek; - } - } - right = i1; - i1 = 0; - break linear_scan; - } - break validate_interval; - } - while (i1 < right) { - const mid = i1 + right >>> 1; - if (t2 < pp[mid]) { - right = mid; - } else { - i1 = mid + 1; - } - } - t1 = pp[i1]; - t0 = pp[i1 - 1]; - if (t0 === void 0) { - this._cachedIndex = 0; - return this.copySampleValue_(0); - } - if (t1 === void 0) { - i1 = pp.length; - this._cachedIndex = i1; - return this.copySampleValue_(i1 - 1); - } - } - this._cachedIndex = i1; - this.intervalChanged_(i1, t0, t1); - } - return this.interpolate_(i1, t0, t2, t1); - } - getSettings_() { - return this.settings || this.DefaultSettings_; - } - copySampleValue_(index) { - const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, offset = index * stride; - for (let i = 0; i !== stride; ++i) { - result[i] = values[offset + i]; - } - return result; - } - // Template methods for derived classes: - interpolate_() { - throw new Error("call to abstract method"); - } - intervalChanged_() { - } -} -class CubicInterpolant extends Interpolant { - static { - __name(this, "CubicInterpolant"); - } - constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { - super(parameterPositions, sampleValues, sampleSize, resultBuffer); - this._weightPrev = -0; - this._offsetPrev = -0; - this._weightNext = -0; - this._offsetNext = -0; - this.DefaultSettings_ = { - endingStart: ZeroCurvatureEnding, - endingEnd: ZeroCurvatureEnding - }; - } - intervalChanged_(i1, t0, t1) { - const pp = this.parameterPositions; - let iPrev = i1 - 2, iNext = i1 + 1, tPrev = pp[iPrev], tNext = pp[iNext]; - if (tPrev === void 0) { - switch (this.getSettings_().endingStart) { - case ZeroSlopeEnding: - iPrev = i1; - tPrev = 2 * t0 - t1; - break; - case WrapAroundEnding: - iPrev = pp.length - 2; - tPrev = t0 + pp[iPrev] - pp[iPrev + 1]; - break; - default: - iPrev = i1; - tPrev = t1; - } - } - if (tNext === void 0) { - switch (this.getSettings_().endingEnd) { - case ZeroSlopeEnding: - iNext = i1; - tNext = 2 * t1 - t0; - break; - case WrapAroundEnding: - iNext = 1; - tNext = t1 + pp[1] - pp[0]; - break; - default: - iNext = i1 - 1; - tNext = t0; - } - } - const halfDt = (t1 - t0) * 0.5, stride = this.valueSize; - this._weightPrev = halfDt / (t0 - tPrev); - this._weightNext = halfDt / (tNext - t1); - this._offsetPrev = iPrev * stride; - this._offsetNext = iNext * stride; - } - interpolate_(i1, t0, t2, t1) { - const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, o1 = i1 * stride, o0 = o1 - stride, oP = this._offsetPrev, oN = this._offsetNext, wP = this._weightPrev, wN = this._weightNext, p = (t2 - t0) / (t1 - t0), pp = p * p, ppp = pp * p; - const sP = -wP * ppp + 2 * wP * pp - wP * p; - const s0 = (1 + wP) * ppp + (-1.5 - 2 * wP) * pp + (-0.5 + wP) * p + 1; - const s1 = (-1 - wN) * ppp + (1.5 + wN) * pp + 0.5 * p; - const sN = wN * ppp - wN * pp; - for (let i = 0; i !== stride; ++i) { - result[i] = sP * values[oP + i] + s0 * values[o0 + i] + s1 * values[o1 + i] + sN * values[oN + i]; - } - return result; - } -} -class LinearInterpolant extends Interpolant { - static { - __name(this, "LinearInterpolant"); - } - constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { - super(parameterPositions, sampleValues, sampleSize, resultBuffer); - } - interpolate_(i1, t0, t2, t1) { - const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, offset1 = i1 * stride, offset0 = offset1 - stride, weight1 = (t2 - t0) / (t1 - t0), weight0 = 1 - weight1; - for (let i = 0; i !== stride; ++i) { - result[i] = values[offset0 + i] * weight0 + values[offset1 + i] * weight1; - } - return result; - } -} -class DiscreteInterpolant extends Interpolant { - static { - __name(this, "DiscreteInterpolant"); - } - constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { - super(parameterPositions, sampleValues, sampleSize, resultBuffer); - } - interpolate_(i1) { - return this.copySampleValue_(i1 - 1); - } -} -class KeyframeTrack { - static { - __name(this, "KeyframeTrack"); - } - constructor(name, times, values, interpolation) { - if (name === void 0) throw new Error("THREE.KeyframeTrack: track name is undefined"); - if (times === void 0 || times.length === 0) throw new Error("THREE.KeyframeTrack: no keyframes in track named " + name); - this.name = name; - this.times = convertArray(times, this.TimeBufferType); - this.values = convertArray(values, this.ValueBufferType); - this.setInterpolation(interpolation || this.DefaultInterpolation); - } - // Serialization (in static context, because of constructor invocation - // and automatic invocation of .toJSON): - static toJSON(track) { - const trackType = track.constructor; - let json; - if (trackType.toJSON !== this.toJSON) { - json = trackType.toJSON(track); - } else { - json = { - "name": track.name, - "times": convertArray(track.times, Array), - "values": convertArray(track.values, Array) - }; - const interpolation = track.getInterpolation(); - if (interpolation !== track.DefaultInterpolation) { - json.interpolation = interpolation; - } - } - json.type = track.ValueTypeName; - return json; - } - InterpolantFactoryMethodDiscrete(result) { - return new DiscreteInterpolant(this.times, this.values, this.getValueSize(), result); - } - InterpolantFactoryMethodLinear(result) { - return new LinearInterpolant(this.times, this.values, this.getValueSize(), result); - } - InterpolantFactoryMethodSmooth(result) { - return new CubicInterpolant(this.times, this.values, this.getValueSize(), result); - } - setInterpolation(interpolation) { - let factoryMethod; - switch (interpolation) { - case InterpolateDiscrete: - factoryMethod = this.InterpolantFactoryMethodDiscrete; - break; - case InterpolateLinear: - factoryMethod = this.InterpolantFactoryMethodLinear; - break; - case InterpolateSmooth: - factoryMethod = this.InterpolantFactoryMethodSmooth; - break; - } - if (factoryMethod === void 0) { - const message = "unsupported interpolation for " + this.ValueTypeName + " keyframe track named " + this.name; - if (this.createInterpolant === void 0) { - if (interpolation !== this.DefaultInterpolation) { - this.setInterpolation(this.DefaultInterpolation); - } else { - throw new Error(message); - } - } - console.warn("THREE.KeyframeTrack:", message); - return this; - } - this.createInterpolant = factoryMethod; - return this; - } - getInterpolation() { - switch (this.createInterpolant) { - case this.InterpolantFactoryMethodDiscrete: - return InterpolateDiscrete; - case this.InterpolantFactoryMethodLinear: - return InterpolateLinear; - case this.InterpolantFactoryMethodSmooth: - return InterpolateSmooth; - } - } - getValueSize() { - return this.values.length / this.times.length; - } - // move all keyframes either forwards or backwards in time - shift(timeOffset) { - if (timeOffset !== 0) { - const times = this.times; - for (let i = 0, n = times.length; i !== n; ++i) { - times[i] += timeOffset; - } - } - return this; - } - // scale all keyframe times by a factor (useful for frame <-> seconds conversions) - scale(timeScale) { - if (timeScale !== 1) { - const times = this.times; - for (let i = 0, n = times.length; i !== n; ++i) { - times[i] *= timeScale; - } - } - return this; - } - // removes keyframes before and after animation without changing any values within the range [startTime, endTime]. - // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values - trim(startTime, endTime) { - const times = this.times, nKeys = times.length; - let from = 0, to = nKeys - 1; - while (from !== nKeys && times[from] < startTime) { - ++from; - } - while (to !== -1 && times[to] > endTime) { - --to; - } - ++to; - if (from !== 0 || to !== nKeys) { - if (from >= to) { - to = Math.max(to, 1); - from = to - 1; - } - const stride = this.getValueSize(); - this.times = times.slice(from, to); - this.values = this.values.slice(from * stride, to * stride); - } - return this; - } - // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable - validate() { - let valid = true; - const valueSize = this.getValueSize(); - if (valueSize - Math.floor(valueSize) !== 0) { - console.error("THREE.KeyframeTrack: Invalid value size in track.", this); - valid = false; - } - const times = this.times, values = this.values, nKeys = times.length; - if (nKeys === 0) { - console.error("THREE.KeyframeTrack: Track is empty.", this); - valid = false; - } - let prevTime = null; - for (let i = 0; i !== nKeys; i++) { - const currTime = times[i]; - if (typeof currTime === "number" && isNaN(currTime)) { - console.error("THREE.KeyframeTrack: Time is not a valid number.", this, i, currTime); - valid = false; - break; - } - if (prevTime !== null && prevTime > currTime) { - console.error("THREE.KeyframeTrack: Out of order keys.", this, i, currTime, prevTime); - valid = false; - break; - } - prevTime = currTime; - } - if (values !== void 0) { - if (isTypedArray(values)) { - for (let i = 0, n = values.length; i !== n; ++i) { - const value = values[i]; - if (isNaN(value)) { - console.error("THREE.KeyframeTrack: Value is not a valid number.", this, i, value); - valid = false; - break; - } - } - } - } - return valid; - } - // removes equivalent sequential keys as common in morph target sequences - // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0) - optimize() { - const times = this.times.slice(), values = this.values.slice(), stride = this.getValueSize(), smoothInterpolation = this.getInterpolation() === InterpolateSmooth, lastIndex = times.length - 1; - let writeIndex = 1; - for (let i = 1; i < lastIndex; ++i) { - let keep = false; - const time = times[i]; - const timeNext = times[i + 1]; - if (time !== timeNext && (i !== 1 || time !== times[0])) { - if (!smoothInterpolation) { - const offset = i * stride, offsetP = offset - stride, offsetN = offset + stride; - for (let j = 0; j !== stride; ++j) { - const value = values[offset + j]; - if (value !== values[offsetP + j] || value !== values[offsetN + j]) { - keep = true; - break; - } - } - } else { - keep = true; - } - } - if (keep) { - if (i !== writeIndex) { - times[writeIndex] = times[i]; - const readOffset = i * stride, writeOffset = writeIndex * stride; - for (let j = 0; j !== stride; ++j) { - values[writeOffset + j] = values[readOffset + j]; - } - } - ++writeIndex; - } - } - if (lastIndex > 0) { - times[writeIndex] = times[lastIndex]; - for (let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++j) { - values[writeOffset + j] = values[readOffset + j]; - } - ++writeIndex; - } - if (writeIndex !== times.length) { - this.times = times.slice(0, writeIndex); - this.values = values.slice(0, writeIndex * stride); - } else { - this.times = times; - this.values = values; - } - return this; - } - clone() { - const times = this.times.slice(); - const values = this.values.slice(); - const TypedKeyframeTrack = this.constructor; - const track = new TypedKeyframeTrack(this.name, times, values); - track.createInterpolant = this.createInterpolant; - return track; - } -} -KeyframeTrack.prototype.TimeBufferType = Float32Array; -KeyframeTrack.prototype.ValueBufferType = Float32Array; -KeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear; -class BooleanKeyframeTrack extends KeyframeTrack { - static { - __name(this, "BooleanKeyframeTrack"); - } - // No interpolation parameter because only InterpolateDiscrete is valid. - constructor(name, times, values) { - super(name, times, values); - } -} -BooleanKeyframeTrack.prototype.ValueTypeName = "bool"; -BooleanKeyframeTrack.prototype.ValueBufferType = Array; -BooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete; -BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = void 0; -BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = void 0; -class ColorKeyframeTrack extends KeyframeTrack { - static { - __name(this, "ColorKeyframeTrack"); - } -} -ColorKeyframeTrack.prototype.ValueTypeName = "color"; -class NumberKeyframeTrack extends KeyframeTrack { - static { - __name(this, "NumberKeyframeTrack"); - } -} -NumberKeyframeTrack.prototype.ValueTypeName = "number"; -class QuaternionLinearInterpolant extends Interpolant { - static { - __name(this, "QuaternionLinearInterpolant"); - } - constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { - super(parameterPositions, sampleValues, sampleSize, resultBuffer); - } - interpolate_(i1, t0, t2, t1) { - const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, alpha = (t2 - t0) / (t1 - t0); - let offset = i1 * stride; - for (let end = offset + stride; offset !== end; offset += 4) { - Quaternion.slerpFlat(result, 0, values, offset - stride, values, offset, alpha); - } - return result; - } -} -class QuaternionKeyframeTrack extends KeyframeTrack { - static { - __name(this, "QuaternionKeyframeTrack"); - } - InterpolantFactoryMethodLinear(result) { - return new QuaternionLinearInterpolant(this.times, this.values, this.getValueSize(), result); - } -} -QuaternionKeyframeTrack.prototype.ValueTypeName = "quaternion"; -QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = void 0; -class StringKeyframeTrack extends KeyframeTrack { - static { - __name(this, "StringKeyframeTrack"); - } - // No interpolation parameter because only InterpolateDiscrete is valid. - constructor(name, times, values) { - super(name, times, values); - } -} -StringKeyframeTrack.prototype.ValueTypeName = "string"; -StringKeyframeTrack.prototype.ValueBufferType = Array; -StringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete; -StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = void 0; -StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = void 0; -class VectorKeyframeTrack extends KeyframeTrack { - static { - __name(this, "VectorKeyframeTrack"); - } -} -VectorKeyframeTrack.prototype.ValueTypeName = "vector"; -class AnimationClip { - static { - __name(this, "AnimationClip"); - } - constructor(name = "", duration = -1, tracks = [], blendMode = NormalAnimationBlendMode) { - this.name = name; - this.tracks = tracks; - this.duration = duration; - this.blendMode = blendMode; - this.uuid = generateUUID(); - if (this.duration < 0) { - this.resetDuration(); - } - } - static parse(json) { - const tracks = [], jsonTracks = json.tracks, frameTime = 1 / (json.fps || 1); - for (let i = 0, n = jsonTracks.length; i !== n; ++i) { - tracks.push(parseKeyframeTrack(jsonTracks[i]).scale(frameTime)); - } - const clip = new this(json.name, json.duration, tracks, json.blendMode); - clip.uuid = json.uuid; - return clip; - } - static toJSON(clip) { - const tracks = [], clipTracks = clip.tracks; - const json = { - "name": clip.name, - "duration": clip.duration, - "tracks": tracks, - "uuid": clip.uuid, - "blendMode": clip.blendMode - }; - for (let i = 0, n = clipTracks.length; i !== n; ++i) { - tracks.push(KeyframeTrack.toJSON(clipTracks[i])); - } - return json; - } - static CreateFromMorphTargetSequence(name, morphTargetSequence, fps, noLoop) { - const numMorphTargets = morphTargetSequence.length; - const tracks = []; - for (let i = 0; i < numMorphTargets; i++) { - let times = []; - let values = []; - times.push( - (i + numMorphTargets - 1) % numMorphTargets, - i, - (i + 1) % numMorphTargets - ); - values.push(0, 1, 0); - const order = getKeyframeOrder(times); - times = sortedArray(times, 1, order); - values = sortedArray(values, 1, order); - if (!noLoop && times[0] === 0) { - times.push(numMorphTargets); - values.push(values[0]); - } - tracks.push( - new NumberKeyframeTrack( - ".morphTargetInfluences[" + morphTargetSequence[i].name + "]", - times, - values - ).scale(1 / fps) - ); - } - return new this(name, -1, tracks); - } - static findByName(objectOrClipArray, name) { - let clipArray = objectOrClipArray; - if (!Array.isArray(objectOrClipArray)) { - const o = objectOrClipArray; - clipArray = o.geometry && o.geometry.animations || o.animations; - } - for (let i = 0; i < clipArray.length; i++) { - if (clipArray[i].name === name) { - return clipArray[i]; - } - } - return null; - } - static CreateClipsFromMorphTargetSequences(morphTargets, fps, noLoop) { - const animationToMorphTargets = {}; - const pattern = /^([\w-]*?)([\d]+)$/; - for (let i = 0, il = morphTargets.length; i < il; i++) { - const morphTarget = morphTargets[i]; - const parts = morphTarget.name.match(pattern); - if (parts && parts.length > 1) { - const name = parts[1]; - let animationMorphTargets = animationToMorphTargets[name]; - if (!animationMorphTargets) { - animationToMorphTargets[name] = animationMorphTargets = []; - } - animationMorphTargets.push(morphTarget); - } - } - const clips = []; - for (const name in animationToMorphTargets) { - clips.push(this.CreateFromMorphTargetSequence(name, animationToMorphTargets[name], fps, noLoop)); - } - return clips; - } - // parse the animation.hierarchy format - static parseAnimation(animation, bones) { - if (!animation) { - console.error("THREE.AnimationClip: No animation in JSONLoader data."); - return null; - } - const addNonemptyTrack = /* @__PURE__ */ __name(function(trackType, trackName, animationKeys, propertyName, destTracks) { - if (animationKeys.length !== 0) { - const times = []; - const values = []; - flattenJSON(animationKeys, times, values, propertyName); - if (times.length !== 0) { - destTracks.push(new trackType(trackName, times, values)); - } - } - }, "addNonemptyTrack"); - const tracks = []; - const clipName = animation.name || "default"; - const fps = animation.fps || 30; - const blendMode = animation.blendMode; - let duration = animation.length || -1; - const hierarchyTracks = animation.hierarchy || []; - for (let h = 0; h < hierarchyTracks.length; h++) { - const animationKeys = hierarchyTracks[h].keys; - if (!animationKeys || animationKeys.length === 0) continue; - if (animationKeys[0].morphTargets) { - const morphTargetNames = {}; - let k; - for (k = 0; k < animationKeys.length; k++) { - if (animationKeys[k].morphTargets) { - for (let m = 0; m < animationKeys[k].morphTargets.length; m++) { - morphTargetNames[animationKeys[k].morphTargets[m]] = -1; - } - } - } - for (const morphTargetName in morphTargetNames) { - const times = []; - const values = []; - for (let m = 0; m !== animationKeys[k].morphTargets.length; ++m) { - const animationKey = animationKeys[k]; - times.push(animationKey.time); - values.push(animationKey.morphTarget === morphTargetName ? 1 : 0); - } - tracks.push(new NumberKeyframeTrack(".morphTargetInfluence[" + morphTargetName + "]", times, values)); - } - duration = morphTargetNames.length * fps; - } else { - const boneName = ".bones[" + bones[h].name + "]"; - addNonemptyTrack( - VectorKeyframeTrack, - boneName + ".position", - animationKeys, - "pos", - tracks - ); - addNonemptyTrack( - QuaternionKeyframeTrack, - boneName + ".quaternion", - animationKeys, - "rot", - tracks - ); - addNonemptyTrack( - VectorKeyframeTrack, - boneName + ".scale", - animationKeys, - "scl", - tracks - ); - } - } - if (tracks.length === 0) { - return null; - } - const clip = new this(clipName, duration, tracks, blendMode); - return clip; - } - resetDuration() { - const tracks = this.tracks; - let duration = 0; - for (let i = 0, n = tracks.length; i !== n; ++i) { - const track = this.tracks[i]; - duration = Math.max(duration, track.times[track.times.length - 1]); - } - this.duration = duration; - return this; - } - trim() { - for (let i = 0; i < this.tracks.length; i++) { - this.tracks[i].trim(0, this.duration); - } - return this; - } - validate() { - let valid = true; - for (let i = 0; i < this.tracks.length; i++) { - valid = valid && this.tracks[i].validate(); - } - return valid; - } - optimize() { - for (let i = 0; i < this.tracks.length; i++) { - this.tracks[i].optimize(); - } - return this; - } - clone() { - const tracks = []; - for (let i = 0; i < this.tracks.length; i++) { - tracks.push(this.tracks[i].clone()); - } - return new this.constructor(this.name, this.duration, tracks, this.blendMode); - } - toJSON() { - return this.constructor.toJSON(this); - } -} -function getTrackTypeForValueTypeName(typeName) { - switch (typeName.toLowerCase()) { - case "scalar": - case "double": - case "float": - case "number": - case "integer": - return NumberKeyframeTrack; - case "vector": - case "vector2": - case "vector3": - case "vector4": - return VectorKeyframeTrack; - case "color": - return ColorKeyframeTrack; - case "quaternion": - return QuaternionKeyframeTrack; - case "bool": - case "boolean": - return BooleanKeyframeTrack; - case "string": - return StringKeyframeTrack; - } - throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + typeName); -} -__name(getTrackTypeForValueTypeName, "getTrackTypeForValueTypeName"); -function parseKeyframeTrack(json) { - if (json.type === void 0) { - throw new Error("THREE.KeyframeTrack: track type undefined, can not parse"); - } - const trackType = getTrackTypeForValueTypeName(json.type); - if (json.times === void 0) { - const times = [], values = []; - flattenJSON(json.keys, times, values, "value"); - json.times = times; - json.values = values; - } - if (trackType.parse !== void 0) { - return trackType.parse(json); - } else { - return new trackType(json.name, json.times, json.values, json.interpolation); - } -} -__name(parseKeyframeTrack, "parseKeyframeTrack"); -const Cache = { - enabled: false, - files: {}, - add: /* @__PURE__ */ __name(function(key, file2) { - if (this.enabled === false) return; - this.files[key] = file2; - }, "add"), - get: /* @__PURE__ */ __name(function(key) { - if (this.enabled === false) return; - return this.files[key]; - }, "get"), - remove: /* @__PURE__ */ __name(function(key) { - delete this.files[key]; - }, "remove"), - clear: /* @__PURE__ */ __name(function() { - this.files = {}; - }, "clear") -}; -class LoadingManager { - static { - __name(this, "LoadingManager"); - } - constructor(onLoad, onProgress, onError) { - const scope = this; - let isLoading = false; - let itemsLoaded = 0; - let itemsTotal = 0; - let urlModifier = void 0; - const handlers = []; - this.onStart = void 0; - this.onLoad = onLoad; - this.onProgress = onProgress; - this.onError = onError; - this.itemStart = function(url) { - itemsTotal++; - if (isLoading === false) { - if (scope.onStart !== void 0) { - scope.onStart(url, itemsLoaded, itemsTotal); - } - } - isLoading = true; - }; - this.itemEnd = function(url) { - itemsLoaded++; - if (scope.onProgress !== void 0) { - scope.onProgress(url, itemsLoaded, itemsTotal); - } - if (itemsLoaded === itemsTotal) { - isLoading = false; - if (scope.onLoad !== void 0) { - scope.onLoad(); - } - } - }; - this.itemError = function(url) { - if (scope.onError !== void 0) { - scope.onError(url); - } - }; - this.resolveURL = function(url) { - if (urlModifier) { - return urlModifier(url); - } - return url; - }; - this.setURLModifier = function(transform) { - urlModifier = transform; - return this; - }; - this.addHandler = function(regex, loader) { - handlers.push(regex, loader); - return this; - }; - this.removeHandler = function(regex) { - const index = handlers.indexOf(regex); - if (index !== -1) { - handlers.splice(index, 2); - } - return this; - }; - this.getHandler = function(file2) { - for (let i = 0, l = handlers.length; i < l; i += 2) { - const regex = handlers[i]; - const loader = handlers[i + 1]; - if (regex.global) regex.lastIndex = 0; - if (regex.test(file2)) { - return loader; - } - } - return null; - }; - } -} -const DefaultLoadingManager = /* @__PURE__ */ new LoadingManager(); -class Loader { - static { - __name(this, "Loader"); - } - constructor(manager) { - this.manager = manager !== void 0 ? manager : DefaultLoadingManager; - this.crossOrigin = "anonymous"; - this.withCredentials = false; - this.path = ""; - this.resourcePath = ""; - this.requestHeader = {}; - } - load() { - } - loadAsync(url, onProgress) { - const scope = this; - return new Promise(function(resolve, reject) { - scope.load(url, resolve, onProgress, reject); - }); - } - parse() { - } - setCrossOrigin(crossOrigin) { - this.crossOrigin = crossOrigin; - return this; - } - setWithCredentials(value) { - this.withCredentials = value; - return this; - } - setPath(path) { - this.path = path; - return this; - } - setResourcePath(resourcePath) { - this.resourcePath = resourcePath; - return this; - } - setRequestHeader(requestHeader) { - this.requestHeader = requestHeader; - return this; - } -} -Loader.DEFAULT_MATERIAL_NAME = "__DEFAULT"; -const loading = {}; -class HttpError extends Error { - static { - __name(this, "HttpError"); - } - constructor(message, response) { - super(message); - this.response = response; - } -} -class FileLoader extends Loader { - static { - __name(this, "FileLoader"); - } - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - if (url === void 0) url = ""; - if (this.path !== void 0) url = this.path + url; - url = this.manager.resolveURL(url); - const cached = Cache.get(url); - if (cached !== void 0) { - this.manager.itemStart(url); - setTimeout(() => { - if (onLoad) onLoad(cached); - this.manager.itemEnd(url); - }, 0); - return cached; - } - if (loading[url] !== void 0) { - loading[url].push({ - onLoad, - onProgress, - onError - }); - return; - } - loading[url] = []; - loading[url].push({ - onLoad, - onProgress, - onError - }); - const req = new Request(url, { - headers: new Headers(this.requestHeader), - credentials: this.withCredentials ? "include" : "same-origin" - // An abort controller could be added within a future PR - }); - const mimeType = this.mimeType; - const responseType = this.responseType; - fetch(req).then((response) => { - if (response.status === 200 || response.status === 0) { - if (response.status === 0) { - console.warn("THREE.FileLoader: HTTP Status 0 received."); - } - if (typeof ReadableStream === "undefined" || response.body === void 0 || response.body.getReader === void 0) { - return response; - } - const callbacks = loading[url]; - const reader = response.body.getReader(); - const contentLength = response.headers.get("X-File-Size") || response.headers.get("Content-Length"); - const total = contentLength ? parseInt(contentLength) : 0; - const lengthComputable = total !== 0; - let loaded = 0; - const stream = new ReadableStream({ - start(controller) { - readData(); - function readData() { - reader.read().then(({ done, value }) => { - if (done) { - controller.close(); - } else { - loaded += value.byteLength; - const event = new ProgressEvent("progress", { lengthComputable, loaded, total }); - for (let i = 0, il = callbacks.length; i < il; i++) { - const callback = callbacks[i]; - if (callback.onProgress) callback.onProgress(event); - } - controller.enqueue(value); - readData(); - } - }, (e) => { - controller.error(e); - }); - } - __name(readData, "readData"); - } - }); - return new Response(stream); - } else { - throw new HttpError(`fetch for "${response.url}" responded with ${response.status}: ${response.statusText}`, response); - } - }).then((response) => { - switch (responseType) { - case "arraybuffer": - return response.arrayBuffer(); - case "blob": - return response.blob(); - case "document": - return response.text().then((text) => { - const parser = new DOMParser(); - return parser.parseFromString(text, mimeType); - }); - case "json": - return response.json(); - default: - if (mimeType === void 0) { - return response.text(); - } else { - const re = /charset="?([^;"\s]*)"?/i; - const exec = re.exec(mimeType); - const label = exec && exec[1] ? exec[1].toLowerCase() : void 0; - const decoder = new TextDecoder(label); - return response.arrayBuffer().then((ab) => decoder.decode(ab)); - } - } - }).then((data) => { - Cache.add(url, data); - const callbacks = loading[url]; - delete loading[url]; - for (let i = 0, il = callbacks.length; i < il; i++) { - const callback = callbacks[i]; - if (callback.onLoad) callback.onLoad(data); - } - }).catch((err2) => { - const callbacks = loading[url]; - if (callbacks === void 0) { - this.manager.itemError(url); - throw err2; - } - delete loading[url]; - for (let i = 0, il = callbacks.length; i < il; i++) { - const callback = callbacks[i]; - if (callback.onError) callback.onError(err2); - } - this.manager.itemError(url); - }).finally(() => { - this.manager.itemEnd(url); - }); - this.manager.itemStart(url); - } - setResponseType(value) { - this.responseType = value; - return this; - } - setMimeType(value) { - this.mimeType = value; - return this; - } -} -class AnimationLoader extends Loader { - static { - __name(this, "AnimationLoader"); - } - constructor(manager) { - super(manager); - } - 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(JSON.parse(text))); - } catch (e) { - if (onError) { - onError(e); - } else { - console.error(e); - } - scope.manager.itemError(url); - } - }, onProgress, onError); - } - parse(json) { - const animations = []; - for (let i = 0; i < json.length; i++) { - const clip = AnimationClip.parse(json[i]); - animations.push(clip); - } - return animations; - } -} -class CompressedTextureLoader extends Loader { - static { - __name(this, "CompressedTextureLoader"); - } - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const images = []; - const texture = new CompressedTexture(); - const loader = new FileLoader(this.manager); - loader.setPath(this.path); - loader.setResponseType("arraybuffer"); - loader.setRequestHeader(this.requestHeader); - loader.setWithCredentials(scope.withCredentials); - let loaded = 0; - function loadTexture(i) { - loader.load(url[i], function(buffer) { - const texDatas = scope.parse(buffer, true); - images[i] = { - width: texDatas.width, - height: texDatas.height, - format: texDatas.format, - mipmaps: texDatas.mipmaps - }; - loaded += 1; - if (loaded === 6) { - if (texDatas.mipmapCount === 1) texture.minFilter = LinearFilter; - texture.image = images; - texture.format = texDatas.format; - texture.needsUpdate = true; - if (onLoad) onLoad(texture); - } - }, onProgress, onError); - } - __name(loadTexture, "loadTexture"); - if (Array.isArray(url)) { - for (let i = 0, il = url.length; i < il; ++i) { - loadTexture(i); - } - } else { - loader.load(url, function(buffer) { - const texDatas = scope.parse(buffer, true); - if (texDatas.isCubemap) { - const faces = texDatas.mipmaps.length / texDatas.mipmapCount; - for (let f = 0; f < faces; f++) { - images[f] = { mipmaps: [] }; - for (let i = 0; i < texDatas.mipmapCount; i++) { - images[f].mipmaps.push(texDatas.mipmaps[f * texDatas.mipmapCount + i]); - images[f].format = texDatas.format; - images[f].width = texDatas.width; - images[f].height = texDatas.height; - } - } - texture.image = images; - } else { - texture.image.width = texDatas.width; - texture.image.height = texDatas.height; - texture.mipmaps = texDatas.mipmaps; - } - if (texDatas.mipmapCount === 1) { - texture.minFilter = LinearFilter; - } - texture.format = texDatas.format; - texture.needsUpdate = true; - if (onLoad) onLoad(texture); - }, onProgress, onError); - } - return texture; - } -} -class ImageLoader extends Loader { - static { - __name(this, "ImageLoader"); - } - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - if (this.path !== void 0) url = this.path + url; - url = this.manager.resolveURL(url); - const scope = this; - const cached = Cache.get(url); - if (cached !== void 0) { - scope.manager.itemStart(url); - setTimeout(function() { - if (onLoad) onLoad(cached); - scope.manager.itemEnd(url); - }, 0); - return cached; - } - const image = createElementNS("img"); - function onImageLoad() { - removeEventListeners(); - Cache.add(url, this); - if (onLoad) onLoad(this); - scope.manager.itemEnd(url); - } - __name(onImageLoad, "onImageLoad"); - function onImageError(event) { - removeEventListeners(); - if (onError) onError(event); - scope.manager.itemError(url); - scope.manager.itemEnd(url); - } - __name(onImageError, "onImageError"); - function removeEventListeners() { - image.removeEventListener("load", onImageLoad, false); - image.removeEventListener("error", onImageError, false); - } - __name(removeEventListeners, "removeEventListeners"); - image.addEventListener("load", onImageLoad, false); - image.addEventListener("error", onImageError, false); - if (url.slice(0, 5) !== "data:") { - if (this.crossOrigin !== void 0) image.crossOrigin = this.crossOrigin; - } - scope.manager.itemStart(url); - image.src = url; - return image; - } -} -class CubeTextureLoader extends Loader { - static { - __name(this, "CubeTextureLoader"); - } - constructor(manager) { - super(manager); - } - load(urls, onLoad, onProgress, onError) { - const texture = new CubeTexture(); - texture.colorSpace = SRGBColorSpace; - const loader = new ImageLoader(this.manager); - loader.setCrossOrigin(this.crossOrigin); - loader.setPath(this.path); - let loaded = 0; - function loadTexture(i) { - loader.load(urls[i], function(image) { - texture.images[i] = image; - loaded++; - if (loaded === 6) { - texture.needsUpdate = true; - if (onLoad) onLoad(texture); - } - }, void 0, onError); - } - __name(loadTexture, "loadTexture"); - for (let i = 0; i < urls.length; ++i) { - loadTexture(i); - } - return texture; - } -} -class DataTextureLoader extends Loader { - static { - __name(this, "DataTextureLoader"); - } - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const texture = new DataTexture(); - const loader = new FileLoader(this.manager); - loader.setResponseType("arraybuffer"); - loader.setRequestHeader(this.requestHeader); - loader.setPath(this.path); - loader.setWithCredentials(scope.withCredentials); - loader.load(url, function(buffer) { - let texData; - try { - texData = scope.parse(buffer); - } catch (error) { - if (onError !== void 0) { - onError(error); - } else { - console.error(error); - return; - } - } - if (texData.image !== void 0) { - texture.image = texData.image; - } else if (texData.data !== void 0) { - texture.image.width = texData.width; - texture.image.height = texData.height; - texture.image.data = texData.data; - } - texture.wrapS = texData.wrapS !== void 0 ? texData.wrapS : ClampToEdgeWrapping; - texture.wrapT = texData.wrapT !== void 0 ? texData.wrapT : ClampToEdgeWrapping; - texture.magFilter = texData.magFilter !== void 0 ? texData.magFilter : LinearFilter; - texture.minFilter = texData.minFilter !== void 0 ? texData.minFilter : LinearFilter; - texture.anisotropy = texData.anisotropy !== void 0 ? texData.anisotropy : 1; - if (texData.colorSpace !== void 0) { - texture.colorSpace = texData.colorSpace; - } - if (texData.flipY !== void 0) { - texture.flipY = texData.flipY; - } - if (texData.format !== void 0) { - texture.format = texData.format; - } - if (texData.type !== void 0) { - texture.type = texData.type; - } - if (texData.mipmaps !== void 0) { - texture.mipmaps = texData.mipmaps; - texture.minFilter = LinearMipmapLinearFilter; - } - if (texData.mipmapCount === 1) { - texture.minFilter = LinearFilter; - } - if (texData.generateMipmaps !== void 0) { - texture.generateMipmaps = texData.generateMipmaps; - } - texture.needsUpdate = true; - if (onLoad) onLoad(texture, texData); - }, onProgress, onError); - return texture; - } -} -class TextureLoader extends Loader { - static { - __name(this, "TextureLoader"); - } - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const texture = new Texture(); - const loader = new ImageLoader(this.manager); - loader.setCrossOrigin(this.crossOrigin); - loader.setPath(this.path); - loader.load(url, function(image) { - texture.image = image; - texture.needsUpdate = true; - if (onLoad !== void 0) { - onLoad(texture); - } - }, onProgress, onError); - return texture; - } -} -class Light extends Object3D { - static { - __name(this, "Light"); - } - constructor(color, intensity = 1) { - super(); - this.isLight = true; - this.type = "Light"; - this.color = new Color(color); - this.intensity = intensity; - } - dispose() { - } - copy(source, recursive) { - super.copy(source, recursive); - this.color.copy(source.color); - this.intensity = source.intensity; - return this; - } - toJSON(meta) { - const data = super.toJSON(meta); - data.object.color = this.color.getHex(); - data.object.intensity = this.intensity; - if (this.groundColor !== void 0) data.object.groundColor = this.groundColor.getHex(); - if (this.distance !== void 0) data.object.distance = this.distance; - if (this.angle !== void 0) data.object.angle = this.angle; - if (this.decay !== void 0) data.object.decay = this.decay; - if (this.penumbra !== void 0) data.object.penumbra = this.penumbra; - if (this.shadow !== void 0) data.object.shadow = this.shadow.toJSON(); - if (this.target !== void 0) data.object.target = this.target.uuid; - return data; - } -} -class HemisphereLight extends Light { - static { - __name(this, "HemisphereLight"); - } - constructor(skyColor, groundColor, intensity) { - super(skyColor, intensity); - this.isHemisphereLight = true; - this.type = "HemisphereLight"; - this.position.copy(Object3D.DEFAULT_UP); - this.updateMatrix(); - this.groundColor = new Color(groundColor); - } - copy(source, recursive) { - super.copy(source, recursive); - this.groundColor.copy(source.groundColor); - return this; - } -} -const _projScreenMatrix$1 = /* @__PURE__ */ new Matrix4(); -const _lightPositionWorld$1 = /* @__PURE__ */ new Vector3(); -const _lookTarget$1 = /* @__PURE__ */ new Vector3(); -class LightShadow { - static { - __name(this, "LightShadow"); - } - constructor(camera) { - this.camera = camera; - this.intensity = 1; - this.bias = 0; - this.normalBias = 0; - this.radius = 1; - this.blurSamples = 8; - this.mapSize = new Vector2(512, 512); - this.map = null; - this.mapPass = null; - this.matrix = new Matrix4(); - this.autoUpdate = true; - this.needsUpdate = false; - this._frustum = new Frustum(); - this._frameExtents = new Vector2(1, 1); - this._viewportCount = 1; - this._viewports = [ - new Vector4(0, 0, 1, 1) - ]; - } - getViewportCount() { - return this._viewportCount; - } - getFrustum() { - return this._frustum; - } - updateMatrices(light) { - const shadowCamera = this.camera; - const shadowMatrix = this.matrix; - _lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld); - shadowCamera.position.copy(_lightPositionWorld$1); - _lookTarget$1.setFromMatrixPosition(light.target.matrixWorld); - shadowCamera.lookAt(_lookTarget$1); - shadowCamera.updateMatrixWorld(); - _projScreenMatrix$1.multiplyMatrices(shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse); - this._frustum.setFromProjectionMatrix(_projScreenMatrix$1); - shadowMatrix.set( - 0.5, - 0, - 0, - 0.5, - 0, - 0.5, - 0, - 0.5, - 0, - 0, - 0.5, - 0.5, - 0, - 0, - 0, - 1 - ); - shadowMatrix.multiply(_projScreenMatrix$1); - } - getViewport(viewportIndex) { - return this._viewports[viewportIndex]; - } - getFrameExtents() { - return this._frameExtents; - } - dispose() { - if (this.map) { - this.map.dispose(); - } - if (this.mapPass) { - this.mapPass.dispose(); - } - } - copy(source) { - this.camera = source.camera.clone(); - this.intensity = source.intensity; - this.bias = source.bias; - this.radius = source.radius; - this.mapSize.copy(source.mapSize); - return this; - } - clone() { - return new this.constructor().copy(this); - } - toJSON() { - const object = {}; - if (this.intensity !== 1) object.intensity = this.intensity; - if (this.bias !== 0) object.bias = this.bias; - if (this.normalBias !== 0) object.normalBias = this.normalBias; - if (this.radius !== 1) object.radius = this.radius; - if (this.mapSize.x !== 512 || this.mapSize.y !== 512) object.mapSize = this.mapSize.toArray(); - object.camera = this.camera.toJSON(false).object; - delete object.camera.matrix; - return object; - } -} -class SpotLightShadow extends LightShadow { - static { - __name(this, "SpotLightShadow"); - } - constructor() { - super(new PerspectiveCamera(50, 1, 0.5, 500)); - this.isSpotLightShadow = true; - this.focus = 1; - } - updateMatrices(light) { - const camera = this.camera; - const fov2 = RAD2DEG * 2 * light.angle * this.focus; - const aspect2 = this.mapSize.width / this.mapSize.height; - const far = light.distance || camera.far; - if (fov2 !== camera.fov || aspect2 !== camera.aspect || far !== camera.far) { - camera.fov = fov2; - camera.aspect = aspect2; - camera.far = far; - camera.updateProjectionMatrix(); - } - super.updateMatrices(light); - } - copy(source) { - super.copy(source); - this.focus = source.focus; - return this; - } -} -class SpotLight extends Light { - static { - __name(this, "SpotLight"); - } - constructor(color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2) { - super(color, intensity); - this.isSpotLight = true; - this.type = "SpotLight"; - this.position.copy(Object3D.DEFAULT_UP); - this.updateMatrix(); - this.target = new Object3D(); - this.distance = distance; - this.angle = angle; - this.penumbra = penumbra; - this.decay = decay; - this.map = null; - this.shadow = new SpotLightShadow(); - } - get power() { - return this.intensity * Math.PI; - } - set power(power) { - this.intensity = power / Math.PI; - } - dispose() { - this.shadow.dispose(); - } - copy(source, recursive) { - super.copy(source, recursive); - this.distance = source.distance; - this.angle = source.angle; - this.penumbra = source.penumbra; - this.decay = source.decay; - this.target = source.target.clone(); - this.shadow = source.shadow.clone(); - return this; - } -} -const _projScreenMatrix = /* @__PURE__ */ new Matrix4(); -const _lightPositionWorld = /* @__PURE__ */ new Vector3(); -const _lookTarget = /* @__PURE__ */ new Vector3(); -class PointLightShadow extends LightShadow { - static { - __name(this, "PointLightShadow"); - } - constructor() { - super(new PerspectiveCamera(90, 1, 0.5, 500)); - this.isPointLightShadow = true; - this._frameExtents = new Vector2(4, 2); - this._viewportCount = 6; - this._viewports = [ - // These viewports map a cube-map onto a 2D texture with the - // following orientation: - // - // xzXZ - // y Y - // - // X - Positive x direction - // x - Negative x direction - // Y - Positive y direction - // y - Negative y direction - // Z - Positive z direction - // z - Negative z direction - // positive X - new Vector4(2, 1, 1, 1), - // negative X - new Vector4(0, 1, 1, 1), - // positive Z - new Vector4(3, 1, 1, 1), - // negative Z - new Vector4(1, 1, 1, 1), - // positive Y - new Vector4(3, 0, 1, 1), - // negative Y - new Vector4(1, 0, 1, 1) - ]; - this._cubeDirections = [ - new Vector3(1, 0, 0), - new Vector3(-1, 0, 0), - new Vector3(0, 0, 1), - new Vector3(0, 0, -1), - new Vector3(0, 1, 0), - new Vector3(0, -1, 0) - ]; - this._cubeUps = [ - new Vector3(0, 1, 0), - new Vector3(0, 1, 0), - new Vector3(0, 1, 0), - new Vector3(0, 1, 0), - new Vector3(0, 0, 1), - new Vector3(0, 0, -1) - ]; - } - updateMatrices(light, viewportIndex = 0) { - const camera = this.camera; - const shadowMatrix = this.matrix; - const far = light.distance || camera.far; - if (far !== camera.far) { - camera.far = far; - camera.updateProjectionMatrix(); - } - _lightPositionWorld.setFromMatrixPosition(light.matrixWorld); - camera.position.copy(_lightPositionWorld); - _lookTarget.copy(camera.position); - _lookTarget.add(this._cubeDirections[viewportIndex]); - camera.up.copy(this._cubeUps[viewportIndex]); - camera.lookAt(_lookTarget); - camera.updateMatrixWorld(); - shadowMatrix.makeTranslation(-_lightPositionWorld.x, -_lightPositionWorld.y, -_lightPositionWorld.z); - _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); - this._frustum.setFromProjectionMatrix(_projScreenMatrix); - } -} -class PointLight extends Light { - static { - __name(this, "PointLight"); - } - constructor(color, intensity, distance = 0, decay = 2) { - super(color, intensity); - this.isPointLight = true; - this.type = "PointLight"; - this.distance = distance; - this.decay = decay; - this.shadow = new PointLightShadow(); - } - get power() { - return this.intensity * 4 * Math.PI; - } - set power(power) { - this.intensity = power / (4 * Math.PI); - } - dispose() { - this.shadow.dispose(); - } - copy(source, recursive) { - super.copy(source, recursive); - this.distance = source.distance; - this.decay = source.decay; - this.shadow = source.shadow.clone(); - return this; - } -} -class DirectionalLightShadow extends LightShadow { - static { - __name(this, "DirectionalLightShadow"); - } - constructor() { - super(new OrthographicCamera(-5, 5, 5, -5, 0.5, 500)); - this.isDirectionalLightShadow = true; - } -} -class DirectionalLight extends Light { - static { - __name(this, "DirectionalLight"); - } - constructor(color, intensity) { - super(color, intensity); - this.isDirectionalLight = true; - this.type = "DirectionalLight"; - this.position.copy(Object3D.DEFAULT_UP); - this.updateMatrix(); - this.target = new Object3D(); - this.shadow = new DirectionalLightShadow(); - } - dispose() { - this.shadow.dispose(); - } - copy(source) { - super.copy(source); - this.target = source.target.clone(); - this.shadow = source.shadow.clone(); - return this; - } -} -class AmbientLight extends Light { - static { - __name(this, "AmbientLight"); - } - constructor(color, intensity) { - super(color, intensity); - this.isAmbientLight = true; - this.type = "AmbientLight"; - } -} -class RectAreaLight extends Light { - static { - __name(this, "RectAreaLight"); - } - constructor(color, intensity, width = 10, height = 10) { - super(color, intensity); - this.isRectAreaLight = true; - this.type = "RectAreaLight"; - this.width = width; - this.height = height; - } - get power() { - return this.intensity * this.width * this.height * Math.PI; - } - set power(power) { - this.intensity = power / (this.width * this.height * Math.PI); - } - copy(source) { - super.copy(source); - this.width = source.width; - this.height = source.height; - return this; - } - toJSON(meta) { - const data = super.toJSON(meta); - data.object.width = this.width; - data.object.height = this.height; - return data; - } -} -class SphericalHarmonics3 { - static { - __name(this, "SphericalHarmonics3"); - } - constructor() { - this.isSphericalHarmonics3 = true; - this.coefficients = []; - for (let i = 0; i < 9; i++) { - this.coefficients.push(new Vector3()); - } - } - set(coefficients) { - for (let i = 0; i < 9; i++) { - this.coefficients[i].copy(coefficients[i]); - } - return this; - } - zero() { - for (let i = 0; i < 9; i++) { - this.coefficients[i].set(0, 0, 0); - } - return this; - } - // get the radiance in the direction of the normal - // target is a Vector3 - getAt(normal, target) { - const x = normal.x, y = normal.y, z = normal.z; - const coeff = this.coefficients; - target.copy(coeff[0]).multiplyScalar(0.282095); - target.addScaledVector(coeff[1], 0.488603 * y); - target.addScaledVector(coeff[2], 0.488603 * z); - target.addScaledVector(coeff[3], 0.488603 * x); - target.addScaledVector(coeff[4], 1.092548 * (x * y)); - target.addScaledVector(coeff[5], 1.092548 * (y * z)); - target.addScaledVector(coeff[6], 0.315392 * (3 * z * z - 1)); - target.addScaledVector(coeff[7], 1.092548 * (x * z)); - target.addScaledVector(coeff[8], 0.546274 * (x * x - y * y)); - return target; - } - // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal - // target is a Vector3 - // https://graphics.stanford.edu/papers/envmap/envmap.pdf - getIrradianceAt(normal, target) { - const x = normal.x, y = normal.y, z = normal.z; - const coeff = this.coefficients; - target.copy(coeff[0]).multiplyScalar(0.886227); - target.addScaledVector(coeff[1], 2 * 0.511664 * y); - target.addScaledVector(coeff[2], 2 * 0.511664 * z); - target.addScaledVector(coeff[3], 2 * 0.511664 * x); - target.addScaledVector(coeff[4], 2 * 0.429043 * x * y); - target.addScaledVector(coeff[5], 2 * 0.429043 * y * z); - target.addScaledVector(coeff[6], 0.743125 * z * z - 0.247708); - target.addScaledVector(coeff[7], 2 * 0.429043 * x * z); - target.addScaledVector(coeff[8], 0.429043 * (x * x - y * y)); - return target; - } - add(sh) { - for (let i = 0; i < 9; i++) { - this.coefficients[i].add(sh.coefficients[i]); - } - return this; - } - addScaledSH(sh, s) { - for (let i = 0; i < 9; i++) { - this.coefficients[i].addScaledVector(sh.coefficients[i], s); - } - return this; - } - scale(s) { - for (let i = 0; i < 9; i++) { - this.coefficients[i].multiplyScalar(s); - } - return this; - } - lerp(sh, alpha) { - for (let i = 0; i < 9; i++) { - this.coefficients[i].lerp(sh.coefficients[i], alpha); - } - return this; - } - equals(sh) { - for (let i = 0; i < 9; i++) { - if (!this.coefficients[i].equals(sh.coefficients[i])) { - return false; - } - } - return true; - } - copy(sh) { - return this.set(sh.coefficients); - } - clone() { - return new this.constructor().copy(this); - } - fromArray(array, offset = 0) { - const coefficients = this.coefficients; - for (let i = 0; i < 9; i++) { - coefficients[i].fromArray(array, offset + i * 3); - } - return this; - } - toArray(array = [], offset = 0) { - const coefficients = this.coefficients; - for (let i = 0; i < 9; i++) { - coefficients[i].toArray(array, offset + i * 3); - } - return array; - } - // evaluate the basis functions - // shBasis is an Array[ 9 ] - static getBasisAt(normal, shBasis) { - const x = normal.x, y = normal.y, z = normal.z; - shBasis[0] = 0.282095; - shBasis[1] = 0.488603 * y; - shBasis[2] = 0.488603 * z; - shBasis[3] = 0.488603 * x; - shBasis[4] = 1.092548 * x * y; - shBasis[5] = 1.092548 * y * z; - shBasis[6] = 0.315392 * (3 * z * z - 1); - shBasis[7] = 1.092548 * x * z; - shBasis[8] = 0.546274 * (x * x - y * y); - } -} -class LightProbe extends Light { - static { - __name(this, "LightProbe"); - } - constructor(sh = new SphericalHarmonics3(), intensity = 1) { - super(void 0, intensity); - this.isLightProbe = true; - this.sh = sh; - } - copy(source) { - super.copy(source); - this.sh.copy(source.sh); - return this; - } - fromJSON(json) { - this.intensity = json.intensity; - this.sh.fromArray(json.sh); - return this; - } - toJSON(meta) { - const data = super.toJSON(meta); - data.object.sh = this.sh.toArray(); - return data; - } -} -class MaterialLoader extends Loader { - static { - __name(this, "MaterialLoader"); - } - constructor(manager) { - super(manager); - this.textures = {}; - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(scope.manager); - loader.setPath(scope.path); - loader.setRequestHeader(scope.requestHeader); - loader.setWithCredentials(scope.withCredentials); - loader.load(url, function(text) { - try { - onLoad(scope.parse(JSON.parse(text))); - } catch (e) { - if (onError) { - onError(e); - } else { - console.error(e); - } - scope.manager.itemError(url); - } - }, onProgress, onError); - } - parse(json) { - const textures = this.textures; - function getTexture(name) { - if (textures[name] === void 0) { - console.warn("THREE.MaterialLoader: Undefined texture", name); - } - return textures[name]; - } - __name(getTexture, "getTexture"); - const material = this.createMaterialFromType(json.type); - if (json.uuid !== void 0) material.uuid = json.uuid; - if (json.name !== void 0) material.name = json.name; - if (json.color !== void 0 && material.color !== void 0) material.color.setHex(json.color); - if (json.roughness !== void 0) material.roughness = json.roughness; - if (json.metalness !== void 0) material.metalness = json.metalness; - if (json.sheen !== void 0) material.sheen = json.sheen; - if (json.sheenColor !== void 0) material.sheenColor = new Color().setHex(json.sheenColor); - if (json.sheenRoughness !== void 0) material.sheenRoughness = json.sheenRoughness; - if (json.emissive !== void 0 && material.emissive !== void 0) material.emissive.setHex(json.emissive); - if (json.specular !== void 0 && material.specular !== void 0) material.specular.setHex(json.specular); - if (json.specularIntensity !== void 0) material.specularIntensity = json.specularIntensity; - if (json.specularColor !== void 0 && material.specularColor !== void 0) material.specularColor.setHex(json.specularColor); - if (json.shininess !== void 0) material.shininess = json.shininess; - if (json.clearcoat !== void 0) material.clearcoat = json.clearcoat; - if (json.clearcoatRoughness !== void 0) material.clearcoatRoughness = json.clearcoatRoughness; - if (json.dispersion !== void 0) material.dispersion = json.dispersion; - if (json.iridescence !== void 0) material.iridescence = json.iridescence; - if (json.iridescenceIOR !== void 0) material.iridescenceIOR = json.iridescenceIOR; - if (json.iridescenceThicknessRange !== void 0) material.iridescenceThicknessRange = json.iridescenceThicknessRange; - if (json.transmission !== void 0) material.transmission = json.transmission; - if (json.thickness !== void 0) material.thickness = json.thickness; - if (json.attenuationDistance !== void 0) material.attenuationDistance = json.attenuationDistance; - if (json.attenuationColor !== void 0 && material.attenuationColor !== void 0) material.attenuationColor.setHex(json.attenuationColor); - if (json.anisotropy !== void 0) material.anisotropy = json.anisotropy; - if (json.anisotropyRotation !== void 0) material.anisotropyRotation = json.anisotropyRotation; - if (json.fog !== void 0) material.fog = json.fog; - if (json.flatShading !== void 0) material.flatShading = json.flatShading; - if (json.blending !== void 0) material.blending = json.blending; - if (json.combine !== void 0) material.combine = json.combine; - if (json.side !== void 0) material.side = json.side; - if (json.shadowSide !== void 0) material.shadowSide = json.shadowSide; - if (json.opacity !== void 0) material.opacity = json.opacity; - if (json.transparent !== void 0) material.transparent = json.transparent; - if (json.alphaTest !== void 0) material.alphaTest = json.alphaTest; - if (json.alphaHash !== void 0) material.alphaHash = json.alphaHash; - if (json.depthFunc !== void 0) material.depthFunc = json.depthFunc; - if (json.depthTest !== void 0) material.depthTest = json.depthTest; - if (json.depthWrite !== void 0) material.depthWrite = json.depthWrite; - if (json.colorWrite !== void 0) material.colorWrite = json.colorWrite; - if (json.blendSrc !== void 0) material.blendSrc = json.blendSrc; - if (json.blendDst !== void 0) material.blendDst = json.blendDst; - if (json.blendEquation !== void 0) material.blendEquation = json.blendEquation; - if (json.blendSrcAlpha !== void 0) material.blendSrcAlpha = json.blendSrcAlpha; - if (json.blendDstAlpha !== void 0) material.blendDstAlpha = json.blendDstAlpha; - if (json.blendEquationAlpha !== void 0) material.blendEquationAlpha = json.blendEquationAlpha; - if (json.blendColor !== void 0 && material.blendColor !== void 0) material.blendColor.setHex(json.blendColor); - if (json.blendAlpha !== void 0) material.blendAlpha = json.blendAlpha; - if (json.stencilWriteMask !== void 0) material.stencilWriteMask = json.stencilWriteMask; - if (json.stencilFunc !== void 0) material.stencilFunc = json.stencilFunc; - if (json.stencilRef !== void 0) material.stencilRef = json.stencilRef; - if (json.stencilFuncMask !== void 0) material.stencilFuncMask = json.stencilFuncMask; - if (json.stencilFail !== void 0) material.stencilFail = json.stencilFail; - if (json.stencilZFail !== void 0) material.stencilZFail = json.stencilZFail; - if (json.stencilZPass !== void 0) material.stencilZPass = json.stencilZPass; - if (json.stencilWrite !== void 0) material.stencilWrite = json.stencilWrite; - if (json.wireframe !== void 0) material.wireframe = json.wireframe; - if (json.wireframeLinewidth !== void 0) material.wireframeLinewidth = json.wireframeLinewidth; - if (json.wireframeLinecap !== void 0) material.wireframeLinecap = json.wireframeLinecap; - if (json.wireframeLinejoin !== void 0) material.wireframeLinejoin = json.wireframeLinejoin; - if (json.rotation !== void 0) material.rotation = json.rotation; - if (json.linewidth !== void 0) material.linewidth = json.linewidth; - if (json.dashSize !== void 0) material.dashSize = json.dashSize; - if (json.gapSize !== void 0) material.gapSize = json.gapSize; - if (json.scale !== void 0) material.scale = json.scale; - if (json.polygonOffset !== void 0) material.polygonOffset = json.polygonOffset; - if (json.polygonOffsetFactor !== void 0) material.polygonOffsetFactor = json.polygonOffsetFactor; - if (json.polygonOffsetUnits !== void 0) material.polygonOffsetUnits = json.polygonOffsetUnits; - if (json.dithering !== void 0) material.dithering = json.dithering; - if (json.alphaToCoverage !== void 0) material.alphaToCoverage = json.alphaToCoverage; - if (json.premultipliedAlpha !== void 0) material.premultipliedAlpha = json.premultipliedAlpha; - if (json.forceSinglePass !== void 0) material.forceSinglePass = json.forceSinglePass; - if (json.visible !== void 0) material.visible = json.visible; - if (json.toneMapped !== void 0) material.toneMapped = json.toneMapped; - if (json.userData !== void 0) material.userData = json.userData; - if (json.vertexColors !== void 0) { - if (typeof json.vertexColors === "number") { - material.vertexColors = json.vertexColors > 0 ? true : false; - } else { - material.vertexColors = json.vertexColors; - } - } - if (json.uniforms !== void 0) { - for (const name in json.uniforms) { - const uniform = json.uniforms[name]; - material.uniforms[name] = {}; - switch (uniform.type) { - case "t": - material.uniforms[name].value = getTexture(uniform.value); - break; - case "c": - material.uniforms[name].value = new Color().setHex(uniform.value); - break; - case "v2": - material.uniforms[name].value = new Vector2().fromArray(uniform.value); - break; - case "v3": - material.uniforms[name].value = new Vector3().fromArray(uniform.value); - break; - case "v4": - material.uniforms[name].value = new Vector4().fromArray(uniform.value); - break; - case "m3": - material.uniforms[name].value = new Matrix3().fromArray(uniform.value); - break; - case "m4": - material.uniforms[name].value = new Matrix4().fromArray(uniform.value); - break; - default: - material.uniforms[name].value = uniform.value; - } - } - } - if (json.defines !== void 0) material.defines = json.defines; - if (json.vertexShader !== void 0) material.vertexShader = json.vertexShader; - if (json.fragmentShader !== void 0) material.fragmentShader = json.fragmentShader; - if (json.glslVersion !== void 0) material.glslVersion = json.glslVersion; - if (json.extensions !== void 0) { - for (const key in json.extensions) { - material.extensions[key] = json.extensions[key]; - } - } - if (json.lights !== void 0) material.lights = json.lights; - if (json.clipping !== void 0) material.clipping = json.clipping; - if (json.size !== void 0) material.size = json.size; - if (json.sizeAttenuation !== void 0) material.sizeAttenuation = json.sizeAttenuation; - if (json.map !== void 0) material.map = getTexture(json.map); - if (json.matcap !== void 0) material.matcap = getTexture(json.matcap); - if (json.alphaMap !== void 0) material.alphaMap = getTexture(json.alphaMap); - if (json.bumpMap !== void 0) material.bumpMap = getTexture(json.bumpMap); - if (json.bumpScale !== void 0) material.bumpScale = json.bumpScale; - if (json.normalMap !== void 0) material.normalMap = getTexture(json.normalMap); - if (json.normalMapType !== void 0) material.normalMapType = json.normalMapType; - if (json.normalScale !== void 0) { - let normalScale = json.normalScale; - if (Array.isArray(normalScale) === false) { - normalScale = [normalScale, normalScale]; - } - material.normalScale = new Vector2().fromArray(normalScale); - } - if (json.displacementMap !== void 0) material.displacementMap = getTexture(json.displacementMap); - if (json.displacementScale !== void 0) material.displacementScale = json.displacementScale; - if (json.displacementBias !== void 0) material.displacementBias = json.displacementBias; - if (json.roughnessMap !== void 0) material.roughnessMap = getTexture(json.roughnessMap); - if (json.metalnessMap !== void 0) material.metalnessMap = getTexture(json.metalnessMap); - if (json.emissiveMap !== void 0) material.emissiveMap = getTexture(json.emissiveMap); - if (json.emissiveIntensity !== void 0) material.emissiveIntensity = json.emissiveIntensity; - if (json.specularMap !== void 0) material.specularMap = getTexture(json.specularMap); - if (json.specularIntensityMap !== void 0) material.specularIntensityMap = getTexture(json.specularIntensityMap); - if (json.specularColorMap !== void 0) material.specularColorMap = getTexture(json.specularColorMap); - if (json.envMap !== void 0) material.envMap = getTexture(json.envMap); - if (json.envMapRotation !== void 0) material.envMapRotation.fromArray(json.envMapRotation); - if (json.envMapIntensity !== void 0) material.envMapIntensity = json.envMapIntensity; - if (json.reflectivity !== void 0) material.reflectivity = json.reflectivity; - if (json.refractionRatio !== void 0) material.refractionRatio = json.refractionRatio; - if (json.lightMap !== void 0) material.lightMap = getTexture(json.lightMap); - if (json.lightMapIntensity !== void 0) material.lightMapIntensity = json.lightMapIntensity; - if (json.aoMap !== void 0) material.aoMap = getTexture(json.aoMap); - if (json.aoMapIntensity !== void 0) material.aoMapIntensity = json.aoMapIntensity; - if (json.gradientMap !== void 0) material.gradientMap = getTexture(json.gradientMap); - if (json.clearcoatMap !== void 0) material.clearcoatMap = getTexture(json.clearcoatMap); - if (json.clearcoatRoughnessMap !== void 0) material.clearcoatRoughnessMap = getTexture(json.clearcoatRoughnessMap); - if (json.clearcoatNormalMap !== void 0) material.clearcoatNormalMap = getTexture(json.clearcoatNormalMap); - if (json.clearcoatNormalScale !== void 0) material.clearcoatNormalScale = new Vector2().fromArray(json.clearcoatNormalScale); - if (json.iridescenceMap !== void 0) material.iridescenceMap = getTexture(json.iridescenceMap); - if (json.iridescenceThicknessMap !== void 0) material.iridescenceThicknessMap = getTexture(json.iridescenceThicknessMap); - if (json.transmissionMap !== void 0) material.transmissionMap = getTexture(json.transmissionMap); - if (json.thicknessMap !== void 0) material.thicknessMap = getTexture(json.thicknessMap); - if (json.anisotropyMap !== void 0) material.anisotropyMap = getTexture(json.anisotropyMap); - if (json.sheenColorMap !== void 0) material.sheenColorMap = getTexture(json.sheenColorMap); - if (json.sheenRoughnessMap !== void 0) material.sheenRoughnessMap = getTexture(json.sheenRoughnessMap); - return material; - } - setTextures(value) { - this.textures = value; - return this; - } - createMaterialFromType(type) { - return MaterialLoader.createMaterialFromType(type); - } - static createMaterialFromType(type) { - const materialLib = { - ShadowMaterial, - SpriteMaterial, - RawShaderMaterial, - ShaderMaterial, - PointsMaterial, - MeshPhysicalMaterial, - MeshStandardMaterial, - MeshPhongMaterial, - MeshToonMaterial, - MeshNormalMaterial, - MeshLambertMaterial, - MeshDepthMaterial, - MeshDistanceMaterial, - MeshBasicMaterial, - MeshMatcapMaterial, - LineDashedMaterial, - LineBasicMaterial, - Material - }; - return new materialLib[type](); - } -} -class LoaderUtils { - static { - __name(this, "LoaderUtils"); - } - static decodeText(array) { - console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."); - if (typeof TextDecoder !== "undefined") { - return new TextDecoder().decode(array); - } - let s = ""; - for (let i = 0, il = array.length; i < il; i++) { - s += String.fromCharCode(array[i]); - } - try { - return decodeURIComponent(escape(s)); - } catch (e) { - return s; - } - } - static extractUrlBase(url) { - const index = url.lastIndexOf("/"); - if (index === -1) return "./"; - return url.slice(0, index + 1); - } - static resolveURL(url, path) { - if (typeof url !== "string" || url === "") return ""; - if (/^https?:\/\//i.test(path) && /^\//.test(url)) { - path = path.replace(/(^https?:\/\/[^\/]+).*/i, "$1"); - } - if (/^(https?:)?\/\//i.test(url)) return url; - if (/^data:.*,.*$/i.test(url)) return url; - if (/^blob:.*$/i.test(url)) return url; - return path + url; - } -} -class InstancedBufferGeometry extends BufferGeometry { - static { - __name(this, "InstancedBufferGeometry"); - } - constructor() { - super(); - this.isInstancedBufferGeometry = true; - this.type = "InstancedBufferGeometry"; - this.instanceCount = Infinity; - } - copy(source) { - super.copy(source); - this.instanceCount = source.instanceCount; - return this; - } - toJSON() { - const data = super.toJSON(); - data.instanceCount = this.instanceCount; - data.isInstancedBufferGeometry = true; - return data; - } -} -class BufferGeometryLoader extends Loader { - static { - __name(this, "BufferGeometryLoader"); - } - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(scope.manager); - loader.setPath(scope.path); - loader.setRequestHeader(scope.requestHeader); - loader.setWithCredentials(scope.withCredentials); - loader.load(url, function(text) { - try { - onLoad(scope.parse(JSON.parse(text))); - } catch (e) { - if (onError) { - onError(e); - } else { - console.error(e); - } - scope.manager.itemError(url); - } - }, onProgress, onError); - } - parse(json) { - const interleavedBufferMap = {}; - const arrayBufferMap = {}; - function getInterleavedBuffer(json2, uuid) { - if (interleavedBufferMap[uuid] !== void 0) return interleavedBufferMap[uuid]; - const interleavedBuffers = json2.interleavedBuffers; - const interleavedBuffer = interleavedBuffers[uuid]; - const buffer = getArrayBuffer(json2, interleavedBuffer.buffer); - const array = getTypedArray(interleavedBuffer.type, buffer); - const ib = new InterleavedBuffer(array, interleavedBuffer.stride); - ib.uuid = interleavedBuffer.uuid; - interleavedBufferMap[uuid] = ib; - return ib; - } - __name(getInterleavedBuffer, "getInterleavedBuffer"); - function getArrayBuffer(json2, uuid) { - if (arrayBufferMap[uuid] !== void 0) return arrayBufferMap[uuid]; - const arrayBuffers = json2.arrayBuffers; - const arrayBuffer = arrayBuffers[uuid]; - const ab = new Uint32Array(arrayBuffer).buffer; - arrayBufferMap[uuid] = ab; - return ab; - } - __name(getArrayBuffer, "getArrayBuffer"); - const geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry(); - const index = json.data.index; - if (index !== void 0) { - const typedArray = getTypedArray(index.type, index.array); - geometry.setIndex(new BufferAttribute(typedArray, 1)); - } - const attributes = json.data.attributes; - for (const key in attributes) { - const attribute = attributes[key]; - let bufferAttribute; - if (attribute.isInterleavedBufferAttribute) { - const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); - bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized); - } else { - const typedArray = getTypedArray(attribute.type, attribute.array); - const bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute; - bufferAttribute = new bufferAttributeConstr(typedArray, attribute.itemSize, attribute.normalized); - } - if (attribute.name !== void 0) bufferAttribute.name = attribute.name; - if (attribute.usage !== void 0) bufferAttribute.setUsage(attribute.usage); - geometry.setAttribute(key, bufferAttribute); - } - const morphAttributes = json.data.morphAttributes; - if (morphAttributes) { - for (const key in morphAttributes) { - const attributeArray = morphAttributes[key]; - const array = []; - for (let i = 0, il = attributeArray.length; i < il; i++) { - const attribute = attributeArray[i]; - let bufferAttribute; - if (attribute.isInterleavedBufferAttribute) { - const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); - bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized); - } else { - const typedArray = getTypedArray(attribute.type, attribute.array); - bufferAttribute = new BufferAttribute(typedArray, attribute.itemSize, attribute.normalized); - } - if (attribute.name !== void 0) bufferAttribute.name = attribute.name; - array.push(bufferAttribute); - } - geometry.morphAttributes[key] = array; - } - } - const morphTargetsRelative = json.data.morphTargetsRelative; - if (morphTargetsRelative) { - geometry.morphTargetsRelative = true; - } - const groups = json.data.groups || json.data.drawcalls || json.data.offsets; - if (groups !== void 0) { - for (let i = 0, n = groups.length; i !== n; ++i) { - const group = groups[i]; - geometry.addGroup(group.start, group.count, group.materialIndex); - } - } - const boundingSphere = json.data.boundingSphere; - if (boundingSphere !== void 0) { - const center = new Vector3(); - if (boundingSphere.center !== void 0) { - center.fromArray(boundingSphere.center); - } - geometry.boundingSphere = new Sphere(center, boundingSphere.radius); - } - if (json.name) geometry.name = json.name; - if (json.userData) geometry.userData = json.userData; - return geometry; - } -} -class ObjectLoader extends Loader { - static { - __name(this, "ObjectLoader"); - } - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const path = this.path === "" ? LoaderUtils.extractUrlBase(url) : this.path; - this.resourcePath = this.resourcePath || path; - const loader = new FileLoader(this.manager); - loader.setPath(this.path); - loader.setRequestHeader(this.requestHeader); - loader.setWithCredentials(this.withCredentials); - loader.load(url, function(text) { - let json = null; - try { - json = JSON.parse(text); - } catch (error) { - if (onError !== void 0) onError(error); - console.error("THREE:ObjectLoader: Can't parse " + url + ".", error.message); - return; - } - const metadata = json.metadata; - if (metadata === void 0 || metadata.type === void 0 || metadata.type.toLowerCase() === "geometry") { - if (onError !== void 0) onError(new Error("THREE.ObjectLoader: Can't load " + url)); - console.error("THREE.ObjectLoader: Can't load " + url); - return; - } - scope.parse(json, onLoad); - }, onProgress, onError); - } - async loadAsync(url, onProgress) { - const scope = this; - const path = this.path === "" ? LoaderUtils.extractUrlBase(url) : this.path; - this.resourcePath = this.resourcePath || path; - const loader = new FileLoader(this.manager); - loader.setPath(this.path); - loader.setRequestHeader(this.requestHeader); - loader.setWithCredentials(this.withCredentials); - const text = await loader.loadAsync(url, onProgress); - const json = JSON.parse(text); - const metadata = json.metadata; - if (metadata === void 0 || metadata.type === void 0 || metadata.type.toLowerCase() === "geometry") { - throw new Error("THREE.ObjectLoader: Can't load " + url); - } - return await scope.parseAsync(json); - } - parse(json, onLoad) { - const animations = this.parseAnimations(json.animations); - const shapes = this.parseShapes(json.shapes); - const geometries = this.parseGeometries(json.geometries, shapes); - const images = this.parseImages(json.images, function() { - if (onLoad !== void 0) onLoad(object); - }); - const textures = this.parseTextures(json.textures, images); - const materials = this.parseMaterials(json.materials, textures); - const object = this.parseObject(json.object, geometries, materials, textures, animations); - const skeletons = this.parseSkeletons(json.skeletons, object); - this.bindSkeletons(object, skeletons); - this.bindLightTargets(object); - if (onLoad !== void 0) { - let hasImages = false; - for (const uuid in images) { - if (images[uuid].data instanceof HTMLImageElement) { - hasImages = true; - break; - } - } - if (hasImages === false) onLoad(object); - } - return object; - } - async parseAsync(json) { - const animations = this.parseAnimations(json.animations); - const shapes = this.parseShapes(json.shapes); - const geometries = this.parseGeometries(json.geometries, shapes); - const images = await this.parseImagesAsync(json.images); - const textures = this.parseTextures(json.textures, images); - const materials = this.parseMaterials(json.materials, textures); - const object = this.parseObject(json.object, geometries, materials, textures, animations); - const skeletons = this.parseSkeletons(json.skeletons, object); - this.bindSkeletons(object, skeletons); - this.bindLightTargets(object); - return object; - } - parseShapes(json) { - const shapes = {}; - if (json !== void 0) { - for (let i = 0, l = json.length; i < l; i++) { - const shape = new Shape().fromJSON(json[i]); - shapes[shape.uuid] = shape; - } - } - return shapes; - } - parseSkeletons(json, object) { - const skeletons = {}; - const bones = {}; - object.traverse(function(child) { - if (child.isBone) bones[child.uuid] = child; - }); - if (json !== void 0) { - for (let i = 0, l = json.length; i < l; i++) { - const skeleton = new Skeleton().fromJSON(json[i], bones); - skeletons[skeleton.uuid] = skeleton; - } - } - return skeletons; - } - parseGeometries(json, shapes) { - const geometries = {}; - if (json !== void 0) { - const bufferGeometryLoader = new BufferGeometryLoader(); - for (let i = 0, l = json.length; i < l; i++) { - let geometry; - const data = json[i]; - switch (data.type) { - case "BufferGeometry": - case "InstancedBufferGeometry": - geometry = bufferGeometryLoader.parse(data); - break; - default: - if (data.type in Geometries) { - geometry = Geometries[data.type].fromJSON(data, shapes); - } else { - console.warn(`THREE.ObjectLoader: Unsupported geometry type "${data.type}"`); - } - } - geometry.uuid = data.uuid; - if (data.name !== void 0) geometry.name = data.name; - if (data.userData !== void 0) geometry.userData = data.userData; - geometries[data.uuid] = geometry; - } - } - return geometries; - } - parseMaterials(json, textures) { - const cache = {}; - const materials = {}; - if (json !== void 0) { - const loader = new MaterialLoader(); - loader.setTextures(textures); - for (let i = 0, l = json.length; i < l; i++) { - const data = json[i]; - if (cache[data.uuid] === void 0) { - cache[data.uuid] = loader.parse(data); - } - materials[data.uuid] = cache[data.uuid]; - } - } - return materials; - } - parseAnimations(json) { - const animations = {}; - if (json !== void 0) { - for (let i = 0; i < json.length; i++) { - const data = json[i]; - const clip = AnimationClip.parse(data); - animations[clip.uuid] = clip; - } - } - return animations; - } - parseImages(json, onLoad) { - const scope = this; - const images = {}; - let loader; - function loadImage2(url) { - scope.manager.itemStart(url); - return loader.load(url, function() { - scope.manager.itemEnd(url); - }, void 0, function() { - scope.manager.itemError(url); - scope.manager.itemEnd(url); - }); - } - __name(loadImage2, "loadImage"); - function deserializeImage(image) { - if (typeof image === "string") { - const url = image; - const path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(url) ? url : scope.resourcePath + url; - return loadImage2(path); - } else { - if (image.data) { - return { - data: getTypedArray(image.type, image.data), - width: image.width, - height: image.height - }; - } else { - return null; - } - } - } - __name(deserializeImage, "deserializeImage"); - if (json !== void 0 && json.length > 0) { - const manager = new LoadingManager(onLoad); - loader = new ImageLoader(manager); - loader.setCrossOrigin(this.crossOrigin); - for (let i = 0, il = json.length; i < il; i++) { - const image = json[i]; - const url = image.url; - if (Array.isArray(url)) { - const imageArray = []; - for (let j = 0, jl = url.length; j < jl; j++) { - const currentUrl = url[j]; - const deserializedImage = deserializeImage(currentUrl); - if (deserializedImage !== null) { - if (deserializedImage instanceof HTMLImageElement) { - imageArray.push(deserializedImage); - } else { - imageArray.push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height)); - } - } - } - images[image.uuid] = new Source(imageArray); - } else { - const deserializedImage = deserializeImage(image.url); - images[image.uuid] = new Source(deserializedImage); - } - } - } - return images; - } - async parseImagesAsync(json) { - const scope = this; - const images = {}; - let loader; - async function deserializeImage(image) { - if (typeof image === "string") { - const url = image; - const path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(url) ? url : scope.resourcePath + url; - return await loader.loadAsync(path); - } else { - if (image.data) { - return { - data: getTypedArray(image.type, image.data), - width: image.width, - height: image.height - }; - } else { - return null; - } - } - } - __name(deserializeImage, "deserializeImage"); - if (json !== void 0 && json.length > 0) { - loader = new ImageLoader(this.manager); - loader.setCrossOrigin(this.crossOrigin); - for (let i = 0, il = json.length; i < il; i++) { - const image = json[i]; - const url = image.url; - if (Array.isArray(url)) { - const imageArray = []; - for (let j = 0, jl = url.length; j < jl; j++) { - const currentUrl = url[j]; - const deserializedImage = await deserializeImage(currentUrl); - if (deserializedImage !== null) { - if (deserializedImage instanceof HTMLImageElement) { - imageArray.push(deserializedImage); - } else { - imageArray.push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height)); - } - } - } - images[image.uuid] = new Source(imageArray); - } else { - const deserializedImage = await deserializeImage(image.url); - images[image.uuid] = new Source(deserializedImage); - } - } - } - return images; - } - parseTextures(json, images) { - function parseConstant(value, type) { - if (typeof value === "number") return value; - console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.", value); - return type[value]; - } - __name(parseConstant, "parseConstant"); - const textures = {}; - if (json !== void 0) { - for (let i = 0, l = json.length; i < l; i++) { - const data = json[i]; - if (data.image === void 0) { - console.warn('THREE.ObjectLoader: No "image" specified for', data.uuid); - } - if (images[data.image] === void 0) { - console.warn("THREE.ObjectLoader: Undefined image", data.image); - } - const source = images[data.image]; - const image = source.data; - let texture; - if (Array.isArray(image)) { - texture = new CubeTexture(); - if (image.length === 6) texture.needsUpdate = true; - } else { - if (image && image.data) { - texture = new DataTexture(); - } else { - texture = new Texture(); - } - if (image) texture.needsUpdate = true; - } - texture.source = source; - texture.uuid = data.uuid; - if (data.name !== void 0) texture.name = data.name; - if (data.mapping !== void 0) texture.mapping = parseConstant(data.mapping, TEXTURE_MAPPING); - if (data.channel !== void 0) texture.channel = data.channel; - if (data.offset !== void 0) texture.offset.fromArray(data.offset); - if (data.repeat !== void 0) texture.repeat.fromArray(data.repeat); - if (data.center !== void 0) texture.center.fromArray(data.center); - if (data.rotation !== void 0) texture.rotation = data.rotation; - if (data.wrap !== void 0) { - texture.wrapS = parseConstant(data.wrap[0], TEXTURE_WRAPPING); - texture.wrapT = parseConstant(data.wrap[1], TEXTURE_WRAPPING); - } - if (data.format !== void 0) texture.format = data.format; - if (data.internalFormat !== void 0) texture.internalFormat = data.internalFormat; - if (data.type !== void 0) texture.type = data.type; - if (data.colorSpace !== void 0) texture.colorSpace = data.colorSpace; - if (data.minFilter !== void 0) texture.minFilter = parseConstant(data.minFilter, TEXTURE_FILTER); - if (data.magFilter !== void 0) texture.magFilter = parseConstant(data.magFilter, TEXTURE_FILTER); - if (data.anisotropy !== void 0) texture.anisotropy = data.anisotropy; - if (data.flipY !== void 0) texture.flipY = data.flipY; - if (data.generateMipmaps !== void 0) texture.generateMipmaps = data.generateMipmaps; - if (data.premultiplyAlpha !== void 0) texture.premultiplyAlpha = data.premultiplyAlpha; - if (data.unpackAlignment !== void 0) texture.unpackAlignment = data.unpackAlignment; - if (data.compareFunction !== void 0) texture.compareFunction = data.compareFunction; - if (data.userData !== void 0) texture.userData = data.userData; - textures[data.uuid] = texture; - } - } - return textures; - } - parseObject(data, geometries, materials, textures, animations) { - let object; - function getGeometry(name) { - if (geometries[name] === void 0) { - console.warn("THREE.ObjectLoader: Undefined geometry", name); - } - return geometries[name]; - } - __name(getGeometry, "getGeometry"); - function getMaterial(name) { - if (name === void 0) return void 0; - if (Array.isArray(name)) { - const array = []; - for (let i = 0, l = name.length; i < l; i++) { - const uuid = name[i]; - if (materials[uuid] === void 0) { - console.warn("THREE.ObjectLoader: Undefined material", uuid); - } - array.push(materials[uuid]); - } - return array; - } - if (materials[name] === void 0) { - console.warn("THREE.ObjectLoader: Undefined material", name); - } - return materials[name]; - } - __name(getMaterial, "getMaterial"); - function getTexture(uuid) { - if (textures[uuid] === void 0) { - console.warn("THREE.ObjectLoader: Undefined texture", uuid); - } - return textures[uuid]; - } - __name(getTexture, "getTexture"); - let geometry, material; - switch (data.type) { - case "Scene": - object = new Scene(); - if (data.background !== void 0) { - if (Number.isInteger(data.background)) { - object.background = new Color(data.background); - } else { - object.background = getTexture(data.background); - } - } - if (data.environment !== void 0) { - object.environment = getTexture(data.environment); - } - if (data.fog !== void 0) { - if (data.fog.type === "Fog") { - object.fog = new Fog(data.fog.color, data.fog.near, data.fog.far); - } else if (data.fog.type === "FogExp2") { - object.fog = new FogExp2(data.fog.color, data.fog.density); - } - if (data.fog.name !== "") { - object.fog.name = data.fog.name; - } - } - if (data.backgroundBlurriness !== void 0) object.backgroundBlurriness = data.backgroundBlurriness; - if (data.backgroundIntensity !== void 0) object.backgroundIntensity = data.backgroundIntensity; - if (data.backgroundRotation !== void 0) object.backgroundRotation.fromArray(data.backgroundRotation); - if (data.environmentIntensity !== void 0) object.environmentIntensity = data.environmentIntensity; - if (data.environmentRotation !== void 0) object.environmentRotation.fromArray(data.environmentRotation); - break; - case "PerspectiveCamera": - object = new PerspectiveCamera(data.fov, data.aspect, data.near, data.far); - if (data.focus !== void 0) object.focus = data.focus; - if (data.zoom !== void 0) object.zoom = data.zoom; - if (data.filmGauge !== void 0) object.filmGauge = data.filmGauge; - if (data.filmOffset !== void 0) object.filmOffset = data.filmOffset; - if (data.view !== void 0) object.view = Object.assign({}, data.view); - break; - case "OrthographicCamera": - object = new OrthographicCamera(data.left, data.right, data.top, data.bottom, data.near, data.far); - if (data.zoom !== void 0) object.zoom = data.zoom; - if (data.view !== void 0) object.view = Object.assign({}, data.view); - break; - case "AmbientLight": - object = new AmbientLight(data.color, data.intensity); - break; - case "DirectionalLight": - object = new DirectionalLight(data.color, data.intensity); - object.target = data.target || ""; - break; - case "PointLight": - object = new PointLight(data.color, data.intensity, data.distance, data.decay); - break; - case "RectAreaLight": - object = new RectAreaLight(data.color, data.intensity, data.width, data.height); - break; - case "SpotLight": - object = new SpotLight(data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay); - object.target = data.target || ""; - break; - case "HemisphereLight": - object = new HemisphereLight(data.color, data.groundColor, data.intensity); - break; - case "LightProbe": - object = new LightProbe().fromJSON(data); - break; - case "SkinnedMesh": - geometry = getGeometry(data.geometry); - material = getMaterial(data.material); - object = new SkinnedMesh(geometry, material); - if (data.bindMode !== void 0) object.bindMode = data.bindMode; - if (data.bindMatrix !== void 0) object.bindMatrix.fromArray(data.bindMatrix); - if (data.skeleton !== void 0) object.skeleton = data.skeleton; - break; - case "Mesh": - geometry = getGeometry(data.geometry); - material = getMaterial(data.material); - object = new Mesh(geometry, material); - break; - case "InstancedMesh": - geometry = getGeometry(data.geometry); - material = getMaterial(data.material); - const count = data.count; - const instanceMatrix = data.instanceMatrix; - const instanceColor = data.instanceColor; - object = new InstancedMesh(geometry, material, count); - object.instanceMatrix = new InstancedBufferAttribute(new Float32Array(instanceMatrix.array), 16); - if (instanceColor !== void 0) object.instanceColor = new InstancedBufferAttribute(new Float32Array(instanceColor.array), instanceColor.itemSize); - break; - case "BatchedMesh": - geometry = getGeometry(data.geometry); - material = getMaterial(data.material); - object = new BatchedMesh(data.maxInstanceCount, data.maxVertexCount, data.maxIndexCount, material); - object.geometry = geometry; - object.perObjectFrustumCulled = data.perObjectFrustumCulled; - object.sortObjects = data.sortObjects; - object._drawRanges = data.drawRanges; - object._reservedRanges = data.reservedRanges; - object._visibility = data.visibility; - object._active = data.active; - object._bounds = data.bounds.map((bound) => { - const box = new Box3(); - box.min.fromArray(bound.boxMin); - box.max.fromArray(bound.boxMax); - const sphere = new Sphere(); - sphere.radius = bound.sphereRadius; - sphere.center.fromArray(bound.sphereCenter); - return { - boxInitialized: bound.boxInitialized, - box, - sphereInitialized: bound.sphereInitialized, - sphere - }; - }); - object._maxInstanceCount = data.maxInstanceCount; - object._maxVertexCount = data.maxVertexCount; - object._maxIndexCount = data.maxIndexCount; - object._geometryInitialized = data.geometryInitialized; - object._geometryCount = data.geometryCount; - object._matricesTexture = getTexture(data.matricesTexture.uuid); - if (data.colorsTexture !== void 0) object._colorsTexture = getTexture(data.colorsTexture.uuid); - break; - case "LOD": - object = new LOD(); - break; - case "Line": - object = new Line(getGeometry(data.geometry), getMaterial(data.material)); - break; - case "LineLoop": - object = new LineLoop(getGeometry(data.geometry), getMaterial(data.material)); - break; - case "LineSegments": - object = new LineSegments(getGeometry(data.geometry), getMaterial(data.material)); - break; - case "PointCloud": - case "Points": - object = new Points(getGeometry(data.geometry), getMaterial(data.material)); - break; - case "Sprite": - object = new Sprite(getMaterial(data.material)); - break; - case "Group": - object = new Group(); - break; - case "Bone": - object = new Bone(); - break; - default: - object = new Object3D(); - } - object.uuid = data.uuid; - if (data.name !== void 0) object.name = data.name; - if (data.matrix !== void 0) { - object.matrix.fromArray(data.matrix); - if (data.matrixAutoUpdate !== void 0) object.matrixAutoUpdate = data.matrixAutoUpdate; - if (object.matrixAutoUpdate) object.matrix.decompose(object.position, object.quaternion, object.scale); - } else { - if (data.position !== void 0) object.position.fromArray(data.position); - if (data.rotation !== void 0) object.rotation.fromArray(data.rotation); - if (data.quaternion !== void 0) object.quaternion.fromArray(data.quaternion); - if (data.scale !== void 0) object.scale.fromArray(data.scale); - } - if (data.up !== void 0) object.up.fromArray(data.up); - if (data.castShadow !== void 0) object.castShadow = data.castShadow; - if (data.receiveShadow !== void 0) object.receiveShadow = data.receiveShadow; - if (data.shadow) { - if (data.shadow.intensity !== void 0) object.shadow.intensity = data.shadow.intensity; - if (data.shadow.bias !== void 0) object.shadow.bias = data.shadow.bias; - if (data.shadow.normalBias !== void 0) object.shadow.normalBias = data.shadow.normalBias; - if (data.shadow.radius !== void 0) object.shadow.radius = data.shadow.radius; - if (data.shadow.mapSize !== void 0) object.shadow.mapSize.fromArray(data.shadow.mapSize); - if (data.shadow.camera !== void 0) object.shadow.camera = this.parseObject(data.shadow.camera); - } - if (data.visible !== void 0) object.visible = data.visible; - if (data.frustumCulled !== void 0) object.frustumCulled = data.frustumCulled; - if (data.renderOrder !== void 0) object.renderOrder = data.renderOrder; - if (data.userData !== void 0) object.userData = data.userData; - if (data.layers !== void 0) object.layers.mask = data.layers; - if (data.children !== void 0) { - const children = data.children; - for (let i = 0; i < children.length; i++) { - object.add(this.parseObject(children[i], geometries, materials, textures, animations)); - } - } - if (data.animations !== void 0) { - const objectAnimations = data.animations; - for (let i = 0; i < objectAnimations.length; i++) { - const uuid = objectAnimations[i]; - object.animations.push(animations[uuid]); - } - } - if (data.type === "LOD") { - if (data.autoUpdate !== void 0) object.autoUpdate = data.autoUpdate; - const levels = data.levels; - for (let l = 0; l < levels.length; l++) { - const level = levels[l]; - const child = object.getObjectByProperty("uuid", level.object); - if (child !== void 0) { - object.addLevel(child, level.distance, level.hysteresis); - } - } - } - return object; - } - bindSkeletons(object, skeletons) { - if (Object.keys(skeletons).length === 0) return; - object.traverse(function(child) { - if (child.isSkinnedMesh === true && child.skeleton !== void 0) { - const skeleton = skeletons[child.skeleton]; - if (skeleton === void 0) { - console.warn("THREE.ObjectLoader: No skeleton found with UUID:", child.skeleton); - } else { - child.bind(skeleton, child.bindMatrix); - } - } - }); - } - bindLightTargets(object) { - object.traverse(function(child) { - if (child.isDirectionalLight || child.isSpotLight) { - const uuid = child.target; - const target = object.getObjectByProperty("uuid", uuid); - if (target !== void 0) { - child.target = target; - } else { - child.target = new Object3D(); - } - } - }); - } -} -const TEXTURE_MAPPING = { - UVMapping, - CubeReflectionMapping, - CubeRefractionMapping, - EquirectangularReflectionMapping, - EquirectangularRefractionMapping, - CubeUVReflectionMapping -}; -const TEXTURE_WRAPPING = { - RepeatWrapping, - ClampToEdgeWrapping, - MirroredRepeatWrapping -}; -const TEXTURE_FILTER = { - NearestFilter, - NearestMipmapNearestFilter, - NearestMipmapLinearFilter, - LinearFilter, - LinearMipmapNearestFilter, - LinearMipmapLinearFilter -}; -class ImageBitmapLoader extends Loader { - static { - __name(this, "ImageBitmapLoader"); - } - constructor(manager) { - super(manager); - this.isImageBitmapLoader = true; - if (typeof createImageBitmap === "undefined") { - console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."); - } - if (typeof fetch === "undefined") { - console.warn("THREE.ImageBitmapLoader: fetch() not supported."); - } - this.options = { premultiplyAlpha: "none" }; - } - setOptions(options) { - this.options = options; - return this; - } - load(url, onLoad, onProgress, onError) { - if (url === void 0) url = ""; - if (this.path !== void 0) url = this.path + url; - url = this.manager.resolveURL(url); - const scope = this; - const cached = Cache.get(url); - if (cached !== void 0) { - scope.manager.itemStart(url); - if (cached.then) { - cached.then((imageBitmap) => { - if (onLoad) onLoad(imageBitmap); - scope.manager.itemEnd(url); - }).catch((e) => { - if (onError) onError(e); - }); - return; - } - setTimeout(function() { - if (onLoad) onLoad(cached); - scope.manager.itemEnd(url); - }, 0); - return cached; - } - const fetchOptions = {}; - fetchOptions.credentials = this.crossOrigin === "anonymous" ? "same-origin" : "include"; - fetchOptions.headers = this.requestHeader; - const promise = fetch(url, fetchOptions).then(function(res) { - return res.blob(); - }).then(function(blob) { - return createImageBitmap(blob, Object.assign(scope.options, { colorSpaceConversion: "none" })); - }).then(function(imageBitmap) { - Cache.add(url, imageBitmap); - if (onLoad) onLoad(imageBitmap); - scope.manager.itemEnd(url); - return imageBitmap; - }).catch(function(e) { - if (onError) onError(e); - Cache.remove(url); - scope.manager.itemError(url); - scope.manager.itemEnd(url); - }); - Cache.add(url, promise); - scope.manager.itemStart(url); - } -} -let _context; -class AudioContext { - static { - __name(this, "AudioContext"); - } - static getContext() { - if (_context === void 0) { - _context = new (window.AudioContext || window.webkitAudioContext)(); - } - return _context; - } - static setContext(value) { - _context = value; - } -} -class AudioLoader extends Loader { - static { - __name(this, "AudioLoader"); - } - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(this.manager); - loader.setResponseType("arraybuffer"); - loader.setPath(this.path); - loader.setRequestHeader(this.requestHeader); - loader.setWithCredentials(this.withCredentials); - loader.load(url, function(buffer) { - try { - const bufferCopy = buffer.slice(0); - const context = AudioContext.getContext(); - context.decodeAudioData(bufferCopy, function(audioBuffer) { - onLoad(audioBuffer); - }).catch(handleError); - } catch (e) { - handleError(e); - } - }, onProgress, onError); - function handleError(e) { - if (onError) { - onError(e); - } else { - console.error(e); - } - scope.manager.itemError(url); - } - __name(handleError, "handleError"); - } -} -const _eyeRight = /* @__PURE__ */ new Matrix4(); -const _eyeLeft = /* @__PURE__ */ new Matrix4(); -const _projectionMatrix = /* @__PURE__ */ new Matrix4(); -class StereoCamera { - static { - __name(this, "StereoCamera"); - } - constructor() { - this.type = "StereoCamera"; - this.aspect = 1; - this.eyeSep = 0.064; - this.cameraL = new PerspectiveCamera(); - this.cameraL.layers.enable(1); - this.cameraL.matrixAutoUpdate = false; - this.cameraR = new PerspectiveCamera(); - this.cameraR.layers.enable(2); - this.cameraR.matrixAutoUpdate = false; - this._cache = { - focus: null, - fov: null, - aspect: null, - near: null, - far: null, - zoom: null, - eyeSep: null - }; - } - update(camera) { - const cache = this._cache; - const needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov || cache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near || cache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep; - if (needsUpdate) { - cache.focus = camera.focus; - cache.fov = camera.fov; - cache.aspect = camera.aspect * this.aspect; - cache.near = camera.near; - cache.far = camera.far; - cache.zoom = camera.zoom; - cache.eyeSep = this.eyeSep; - _projectionMatrix.copy(camera.projectionMatrix); - const eyeSepHalf = cache.eyeSep / 2; - const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus; - const ymax = cache.near * Math.tan(DEG2RAD * cache.fov * 0.5) / cache.zoom; - let xmin, xmax; - _eyeLeft.elements[12] = -eyeSepHalf; - _eyeRight.elements[12] = eyeSepHalf; - xmin = -ymax * cache.aspect + eyeSepOnProjection; - xmax = ymax * cache.aspect + eyeSepOnProjection; - _projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin); - _projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin); - this.cameraL.projectionMatrix.copy(_projectionMatrix); - xmin = -ymax * cache.aspect - eyeSepOnProjection; - xmax = ymax * cache.aspect - eyeSepOnProjection; - _projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin); - _projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin); - this.cameraR.projectionMatrix.copy(_projectionMatrix); - } - this.cameraL.matrixWorld.copy(camera.matrixWorld).multiply(_eyeLeft); - this.cameraR.matrixWorld.copy(camera.matrixWorld).multiply(_eyeRight); - } -} -class Clock { - static { - __name(this, "Clock"); - } - constructor(autoStart = true) { - this.autoStart = autoStart; - this.startTime = 0; - this.oldTime = 0; - this.elapsedTime = 0; - this.running = false; - } - start() { - this.startTime = now(); - this.oldTime = this.startTime; - this.elapsedTime = 0; - this.running = true; - } - stop() { - this.getElapsedTime(); - this.running = false; - this.autoStart = false; - } - getElapsedTime() { - this.getDelta(); - return this.elapsedTime; - } - getDelta() { - let diff = 0; - if (this.autoStart && !this.running) { - this.start(); - return 0; - } - if (this.running) { - const newTime = now(); - diff = (newTime - this.oldTime) / 1e3; - this.oldTime = newTime; - this.elapsedTime += diff; - } - return diff; - } -} -function now() { - return performance.now(); -} -__name(now, "now"); -const _position$1 = /* @__PURE__ */ new Vector3(); -const _quaternion$1 = /* @__PURE__ */ new Quaternion(); -const _scale$1 = /* @__PURE__ */ new Vector3(); -const _orientation$1 = /* @__PURE__ */ new Vector3(); -class AudioListener extends Object3D { - static { - __name(this, "AudioListener"); - } - constructor() { - super(); - this.type = "AudioListener"; - this.context = AudioContext.getContext(); - this.gain = this.context.createGain(); - this.gain.connect(this.context.destination); - this.filter = null; - this.timeDelta = 0; - this._clock = new Clock(); - } - getInput() { - return this.gain; - } - removeFilter() { - if (this.filter !== null) { - this.gain.disconnect(this.filter); - this.filter.disconnect(this.context.destination); - this.gain.connect(this.context.destination); - this.filter = null; - } - return this; - } - getFilter() { - return this.filter; - } - setFilter(value) { - if (this.filter !== null) { - this.gain.disconnect(this.filter); - this.filter.disconnect(this.context.destination); - } else { - this.gain.disconnect(this.context.destination); - } - this.filter = value; - this.gain.connect(this.filter); - this.filter.connect(this.context.destination); - return this; - } - getMasterVolume() { - return this.gain.gain.value; - } - setMasterVolume(value) { - this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01); - return this; - } - updateMatrixWorld(force) { - super.updateMatrixWorld(force); - const listener = this.context.listener; - const up = this.up; - this.timeDelta = this._clock.getDelta(); - this.matrixWorld.decompose(_position$1, _quaternion$1, _scale$1); - _orientation$1.set(0, 0, -1).applyQuaternion(_quaternion$1); - if (listener.positionX) { - const endTime = this.context.currentTime + this.timeDelta; - listener.positionX.linearRampToValueAtTime(_position$1.x, endTime); - listener.positionY.linearRampToValueAtTime(_position$1.y, endTime); - listener.positionZ.linearRampToValueAtTime(_position$1.z, endTime); - listener.forwardX.linearRampToValueAtTime(_orientation$1.x, endTime); - listener.forwardY.linearRampToValueAtTime(_orientation$1.y, endTime); - listener.forwardZ.linearRampToValueAtTime(_orientation$1.z, endTime); - listener.upX.linearRampToValueAtTime(up.x, endTime); - listener.upY.linearRampToValueAtTime(up.y, endTime); - listener.upZ.linearRampToValueAtTime(up.z, endTime); - } else { - listener.setPosition(_position$1.x, _position$1.y, _position$1.z); - listener.setOrientation(_orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z); - } - } -} -class Audio extends Object3D { - static { - __name(this, "Audio"); - } - constructor(listener) { - super(); - this.type = "Audio"; - this.listener = listener; - this.context = listener.context; - this.gain = this.context.createGain(); - this.gain.connect(listener.getInput()); - this.autoplay = false; - this.buffer = null; - this.detune = 0; - this.loop = false; - this.loopStart = 0; - this.loopEnd = 0; - this.offset = 0; - this.duration = void 0; - this.playbackRate = 1; - this.isPlaying = false; - this.hasPlaybackControl = true; - this.source = null; - this.sourceType = "empty"; - this._startedAt = 0; - this._progress = 0; - this._connected = false; - this.filters = []; - } - getOutput() { - return this.gain; - } - setNodeSource(audioNode) { - this.hasPlaybackControl = false; - this.sourceType = "audioNode"; - this.source = audioNode; - this.connect(); - return this; - } - setMediaElementSource(mediaElement) { - this.hasPlaybackControl = false; - this.sourceType = "mediaNode"; - this.source = this.context.createMediaElementSource(mediaElement); - this.connect(); - return this; - } - setMediaStreamSource(mediaStream) { - this.hasPlaybackControl = false; - this.sourceType = "mediaStreamNode"; - this.source = this.context.createMediaStreamSource(mediaStream); - this.connect(); - return this; - } - setBuffer(audioBuffer) { - this.buffer = audioBuffer; - this.sourceType = "buffer"; - if (this.autoplay) this.play(); - return this; - } - play(delay = 0) { - if (this.isPlaying === true) { - console.warn("THREE.Audio: Audio is already playing."); - return; - } - if (this.hasPlaybackControl === false) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; - } - this._startedAt = this.context.currentTime + delay; - const source = this.context.createBufferSource(); - source.buffer = this.buffer; - source.loop = this.loop; - source.loopStart = this.loopStart; - source.loopEnd = this.loopEnd; - source.onended = this.onEnded.bind(this); - source.start(this._startedAt, this._progress + this.offset, this.duration); - this.isPlaying = true; - this.source = source; - this.setDetune(this.detune); - this.setPlaybackRate(this.playbackRate); - return this.connect(); - } - pause() { - if (this.hasPlaybackControl === false) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; - } - if (this.isPlaying === true) { - this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate; - if (this.loop === true) { - this._progress = this._progress % (this.duration || this.buffer.duration); - } - this.source.stop(); - this.source.onended = null; - this.isPlaying = false; - } - return this; - } - stop(delay = 0) { - if (this.hasPlaybackControl === false) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; - } - this._progress = 0; - if (this.source !== null) { - this.source.stop(this.context.currentTime + delay); - this.source.onended = null; - } - this.isPlaying = false; - return this; - } - connect() { - if (this.filters.length > 0) { - this.source.connect(this.filters[0]); - for (let i = 1, l = this.filters.length; i < l; i++) { - this.filters[i - 1].connect(this.filters[i]); - } - this.filters[this.filters.length - 1].connect(this.getOutput()); - } else { - this.source.connect(this.getOutput()); - } - this._connected = true; - return this; - } - disconnect() { - if (this._connected === false) { - return; - } - if (this.filters.length > 0) { - this.source.disconnect(this.filters[0]); - for (let i = 1, l = this.filters.length; i < l; i++) { - this.filters[i - 1].disconnect(this.filters[i]); - } - this.filters[this.filters.length - 1].disconnect(this.getOutput()); - } else { - this.source.disconnect(this.getOutput()); - } - this._connected = false; - return this; - } - getFilters() { - return this.filters; - } - setFilters(value) { - if (!value) value = []; - if (this._connected === true) { - this.disconnect(); - this.filters = value.slice(); - this.connect(); - } else { - this.filters = value.slice(); - } - return this; - } - setDetune(value) { - this.detune = value; - if (this.isPlaying === true && this.source.detune !== void 0) { - this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, 0.01); - } - return this; - } - getDetune() { - return this.detune; - } - getFilter() { - return this.getFilters()[0]; - } - setFilter(filter) { - return this.setFilters(filter ? [filter] : []); - } - setPlaybackRate(value) { - if (this.hasPlaybackControl === false) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; - } - this.playbackRate = value; - if (this.isPlaying === true) { - this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, 0.01); - } - return this; - } - getPlaybackRate() { - return this.playbackRate; - } - onEnded() { - this.isPlaying = false; - } - getLoop() { - if (this.hasPlaybackControl === false) { - console.warn("THREE.Audio: this Audio has no playback control."); - return false; - } - return this.loop; - } - setLoop(value) { - if (this.hasPlaybackControl === false) { - console.warn("THREE.Audio: this Audio has no playback control."); - return; - } - this.loop = value; - if (this.isPlaying === true) { - this.source.loop = this.loop; - } - return this; - } - setLoopStart(value) { - this.loopStart = value; - return this; - } - setLoopEnd(value) { - this.loopEnd = value; - return this; - } - getVolume() { - return this.gain.gain.value; - } - setVolume(value) { - this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01); - return this; - } -} -const _position = /* @__PURE__ */ new Vector3(); -const _quaternion = /* @__PURE__ */ new Quaternion(); -const _scale = /* @__PURE__ */ new Vector3(); -const _orientation = /* @__PURE__ */ new Vector3(); -class PositionalAudio extends Audio { - static { - __name(this, "PositionalAudio"); - } - constructor(listener) { - super(listener); - this.panner = this.context.createPanner(); - this.panner.panningModel = "HRTF"; - this.panner.connect(this.gain); - } - connect() { - super.connect(); - this.panner.connect(this.gain); - } - disconnect() { - super.disconnect(); - this.panner.disconnect(this.gain); - } - getOutput() { - return this.panner; - } - getRefDistance() { - return this.panner.refDistance; - } - setRefDistance(value) { - this.panner.refDistance = value; - return this; - } - getRolloffFactor() { - return this.panner.rolloffFactor; - } - setRolloffFactor(value) { - this.panner.rolloffFactor = value; - return this; - } - getDistanceModel() { - return this.panner.distanceModel; - } - setDistanceModel(value) { - this.panner.distanceModel = value; - return this; - } - getMaxDistance() { - return this.panner.maxDistance; - } - setMaxDistance(value) { - this.panner.maxDistance = value; - return this; - } - setDirectionalCone(coneInnerAngle, coneOuterAngle, coneOuterGain) { - this.panner.coneInnerAngle = coneInnerAngle; - this.panner.coneOuterAngle = coneOuterAngle; - this.panner.coneOuterGain = coneOuterGain; - return this; - } - updateMatrixWorld(force) { - super.updateMatrixWorld(force); - if (this.hasPlaybackControl === true && this.isPlaying === false) return; - this.matrixWorld.decompose(_position, _quaternion, _scale); - _orientation.set(0, 0, 1).applyQuaternion(_quaternion); - const panner = this.panner; - if (panner.positionX) { - const endTime = this.context.currentTime + this.listener.timeDelta; - panner.positionX.linearRampToValueAtTime(_position.x, endTime); - panner.positionY.linearRampToValueAtTime(_position.y, endTime); - panner.positionZ.linearRampToValueAtTime(_position.z, endTime); - panner.orientationX.linearRampToValueAtTime(_orientation.x, endTime); - panner.orientationY.linearRampToValueAtTime(_orientation.y, endTime); - panner.orientationZ.linearRampToValueAtTime(_orientation.z, endTime); - } else { - panner.setPosition(_position.x, _position.y, _position.z); - panner.setOrientation(_orientation.x, _orientation.y, _orientation.z); - } - } -} -class AudioAnalyser { - static { - __name(this, "AudioAnalyser"); - } - constructor(audio, fftSize = 2048) { - this.analyser = audio.context.createAnalyser(); - this.analyser.fftSize = fftSize; - this.data = new Uint8Array(this.analyser.frequencyBinCount); - audio.getOutput().connect(this.analyser); - } - getFrequencyData() { - this.analyser.getByteFrequencyData(this.data); - return this.data; - } - getAverageFrequency() { - let value = 0; - const data = this.getFrequencyData(); - for (let i = 0; i < data.length; i++) { - value += data[i]; - } - return value / data.length; - } -} -class PropertyMixer { - static { - __name(this, "PropertyMixer"); - } - constructor(binding, typeName, valueSize) { - this.binding = binding; - this.valueSize = valueSize; - let mixFunction, mixFunctionAdditive, setIdentity; - switch (typeName) { - case "quaternion": - mixFunction = this._slerp; - mixFunctionAdditive = this._slerpAdditive; - setIdentity = this._setAdditiveIdentityQuaternion; - this.buffer = new Float64Array(valueSize * 6); - this._workIndex = 5; - break; - case "string": - case "bool": - mixFunction = this._select; - mixFunctionAdditive = this._select; - setIdentity = this._setAdditiveIdentityOther; - this.buffer = new Array(valueSize * 5); - break; - default: - mixFunction = this._lerp; - mixFunctionAdditive = this._lerpAdditive; - setIdentity = this._setAdditiveIdentityNumeric; - this.buffer = new Float64Array(valueSize * 5); - } - this._mixBufferRegion = mixFunction; - this._mixBufferRegionAdditive = mixFunctionAdditive; - this._setIdentity = setIdentity; - this._origIndex = 3; - this._addIndex = 4; - this.cumulativeWeight = 0; - this.cumulativeWeightAdditive = 0; - this.useCount = 0; - this.referenceCount = 0; - } - // accumulate data in the 'incoming' region into 'accu' - accumulate(accuIndex, weight) { - const buffer = this.buffer, stride = this.valueSize, offset = accuIndex * stride + stride; - let currentWeight = this.cumulativeWeight; - if (currentWeight === 0) { - for (let i = 0; i !== stride; ++i) { - buffer[offset + i] = buffer[i]; - } - currentWeight = weight; - } else { - currentWeight += weight; - const mix = weight / currentWeight; - this._mixBufferRegion(buffer, offset, 0, mix, stride); - } - this.cumulativeWeight = currentWeight; - } - // accumulate data in the 'incoming' region into 'add' - accumulateAdditive(weight) { - const buffer = this.buffer, stride = this.valueSize, offset = stride * this._addIndex; - if (this.cumulativeWeightAdditive === 0) { - this._setIdentity(); - } - this._mixBufferRegionAdditive(buffer, offset, 0, weight, stride); - this.cumulativeWeightAdditive += weight; - } - // apply the state of 'accu' to the binding when accus differ - apply(accuIndex) { - const stride = this.valueSize, buffer = this.buffer, offset = accuIndex * stride + stride, weight = this.cumulativeWeight, weightAdditive = this.cumulativeWeightAdditive, binding = this.binding; - this.cumulativeWeight = 0; - this.cumulativeWeightAdditive = 0; - if (weight < 1) { - const originalValueOffset = stride * this._origIndex; - this._mixBufferRegion( - buffer, - offset, - originalValueOffset, - 1 - weight, - stride - ); - } - if (weightAdditive > 0) { - this._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride); - } - for (let i = stride, e = stride + stride; i !== e; ++i) { - if (buffer[i] !== buffer[i + stride]) { - binding.setValue(buffer, offset); - break; - } - } - } - // remember the state of the bound property and copy it to both accus - saveOriginalState() { - const binding = this.binding; - const buffer = this.buffer, stride = this.valueSize, originalValueOffset = stride * this._origIndex; - binding.getValue(buffer, originalValueOffset); - for (let i = stride, e = originalValueOffset; i !== e; ++i) { - buffer[i] = buffer[originalValueOffset + i % stride]; - } - this._setIdentity(); - this.cumulativeWeight = 0; - this.cumulativeWeightAdditive = 0; - } - // apply the state previously taken via 'saveOriginalState' to the binding - restoreOriginalState() { - const originalValueOffset = this.valueSize * 3; - this.binding.setValue(this.buffer, originalValueOffset); - } - _setAdditiveIdentityNumeric() { - const startIndex = this._addIndex * this.valueSize; - const endIndex = startIndex + this.valueSize; - for (let i = startIndex; i < endIndex; i++) { - this.buffer[i] = 0; - } - } - _setAdditiveIdentityQuaternion() { - this._setAdditiveIdentityNumeric(); - this.buffer[this._addIndex * this.valueSize + 3] = 1; - } - _setAdditiveIdentityOther() { - const startIndex = this._origIndex * this.valueSize; - const targetIndex = this._addIndex * this.valueSize; - for (let i = 0; i < this.valueSize; i++) { - this.buffer[targetIndex + i] = this.buffer[startIndex + i]; - } - } - // mix functions - _select(buffer, dstOffset, srcOffset, t2, stride) { - if (t2 >= 0.5) { - for (let i = 0; i !== stride; ++i) { - buffer[dstOffset + i] = buffer[srcOffset + i]; - } - } - } - _slerp(buffer, dstOffset, srcOffset, t2) { - Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t2); - } - _slerpAdditive(buffer, dstOffset, srcOffset, t2, stride) { - const workOffset = this._workIndex * stride; - Quaternion.multiplyQuaternionsFlat(buffer, workOffset, buffer, dstOffset, buffer, srcOffset); - Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t2); - } - _lerp(buffer, dstOffset, srcOffset, t2, stride) { - const s = 1 - t2; - for (let i = 0; i !== stride; ++i) { - const j = dstOffset + i; - buffer[j] = buffer[j] * s + buffer[srcOffset + i] * t2; - } - } - _lerpAdditive(buffer, dstOffset, srcOffset, t2, stride) { - for (let i = 0; i !== stride; ++i) { - const j = dstOffset + i; - buffer[j] = buffer[j] + buffer[srcOffset + i] * t2; - } - } -} -const _RESERVED_CHARS_RE = "\\[\\]\\.:\\/"; -const _reservedRe = new RegExp("[" + _RESERVED_CHARS_RE + "]", "g"); -const _wordChar = "[^" + _RESERVED_CHARS_RE + "]"; -const _wordCharOrDot = "[^" + _RESERVED_CHARS_RE.replace("\\.", "") + "]"; -const _directoryRe = /* @__PURE__ */ /((?:WC+[\/:])*)/.source.replace("WC", _wordChar); -const _nodeRe = /* @__PURE__ */ /(WCOD+)?/.source.replace("WCOD", _wordCharOrDot); -const _objectRe = /* @__PURE__ */ /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", _wordChar); -const _propertyRe = /* @__PURE__ */ /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", _wordChar); -const _trackRe = new RegExp( - "^" + _directoryRe + _nodeRe + _objectRe + _propertyRe + "$" -); -const _supportedObjectNames = ["material", "materials", "bones", "map"]; -class Composite { - static { - __name(this, "Composite"); - } - constructor(targetGroup, path, optionalParsedPath) { - const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path); - this._targetGroup = targetGroup; - this._bindings = targetGroup.subscribe_(path, parsedPath); - } - getValue(array, offset) { - this.bind(); - const firstValidIndex = this._targetGroup.nCachedObjects_, binding = this._bindings[firstValidIndex]; - if (binding !== void 0) binding.getValue(array, offset); - } - setValue(array, offset) { - const bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { - bindings[i].setValue(array, offset); - } - } - bind() { - const bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { - bindings[i].bind(); - } - } - unbind() { - const bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { - bindings[i].unbind(); - } - } -} -class PropertyBinding { - static { - __name(this, "PropertyBinding"); - } - constructor(rootNode, path, parsedPath) { - this.path = path; - this.parsedPath = parsedPath || PropertyBinding.parseTrackName(path); - this.node = PropertyBinding.findNode(rootNode, this.parsedPath.nodeName); - this.rootNode = rootNode; - this.getValue = this._getValue_unbound; - this.setValue = this._setValue_unbound; - } - static create(root, path, parsedPath) { - if (!(root && root.isAnimationObjectGroup)) { - return new PropertyBinding(root, path, parsedPath); - } else { - return new PropertyBinding.Composite(root, path, parsedPath); - } - } - /** - * Replaces spaces with underscores and removes unsupported characters from - * node names, to ensure compatibility with parseTrackName(). - * - * @param {string} name Node name to be sanitized. - * @return {string} - */ - static sanitizeNodeName(name) { - return name.replace(/\s/g, "_").replace(_reservedRe, ""); - } - static parseTrackName(trackName) { - const matches = _trackRe.exec(trackName); - if (matches === null) { - throw new Error("PropertyBinding: Cannot parse trackName: " + trackName); - } - const results = { - // directoryName: matches[ 1 ], // (tschw) currently unused - nodeName: matches[2], - objectName: matches[3], - objectIndex: matches[4], - propertyName: matches[5], - // required - propertyIndex: matches[6] - }; - const lastDot = results.nodeName && results.nodeName.lastIndexOf("."); - if (lastDot !== void 0 && lastDot !== -1) { - const objectName = results.nodeName.substring(lastDot + 1); - if (_supportedObjectNames.indexOf(objectName) !== -1) { - results.nodeName = results.nodeName.substring(0, lastDot); - results.objectName = objectName; - } - } - if (results.propertyName === null || results.propertyName.length === 0) { - throw new Error("PropertyBinding: can not parse propertyName from trackName: " + trackName); - } - return results; - } - static findNode(root, nodeName) { - if (nodeName === void 0 || nodeName === "" || nodeName === "." || nodeName === -1 || nodeName === root.name || nodeName === root.uuid) { - return root; - } - if (root.skeleton) { - const bone = root.skeleton.getBoneByName(nodeName); - if (bone !== void 0) { - return bone; - } - } - if (root.children) { - const searchNodeSubtree = /* @__PURE__ */ __name(function(children) { - for (let i = 0; i < children.length; i++) { - const childNode = children[i]; - if (childNode.name === nodeName || childNode.uuid === nodeName) { - return childNode; - } - const result = searchNodeSubtree(childNode.children); - if (result) return result; - } - return null; - }, "searchNodeSubtree"); - const subTreeNode = searchNodeSubtree(root.children); - if (subTreeNode) { - return subTreeNode; - } - } - return null; - } - // these are used to "bind" a nonexistent property - _getValue_unavailable() { - } - _setValue_unavailable() { - } - // Getters - _getValue_direct(buffer, offset) { - buffer[offset] = this.targetObject[this.propertyName]; - } - _getValue_array(buffer, offset) { - const source = this.resolvedProperty; - for (let i = 0, n = source.length; i !== n; ++i) { - buffer[offset++] = source[i]; - } - } - _getValue_arrayElement(buffer, offset) { - buffer[offset] = this.resolvedProperty[this.propertyIndex]; - } - _getValue_toArray(buffer, offset) { - this.resolvedProperty.toArray(buffer, offset); - } - // Direct - _setValue_direct(buffer, offset) { - this.targetObject[this.propertyName] = buffer[offset]; - } - _setValue_direct_setNeedsUpdate(buffer, offset) { - this.targetObject[this.propertyName] = buffer[offset]; - this.targetObject.needsUpdate = true; - } - _setValue_direct_setMatrixWorldNeedsUpdate(buffer, offset) { - this.targetObject[this.propertyName] = buffer[offset]; - this.targetObject.matrixWorldNeedsUpdate = true; - } - // EntireArray - _setValue_array(buffer, offset) { - const dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { - dest[i] = buffer[offset++]; - } - } - _setValue_array_setNeedsUpdate(buffer, offset) { - const dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { - dest[i] = buffer[offset++]; - } - this.targetObject.needsUpdate = true; - } - _setValue_array_setMatrixWorldNeedsUpdate(buffer, offset) { - const dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { - dest[i] = buffer[offset++]; - } - this.targetObject.matrixWorldNeedsUpdate = true; - } - // ArrayElement - _setValue_arrayElement(buffer, offset) { - this.resolvedProperty[this.propertyIndex] = buffer[offset]; - } - _setValue_arrayElement_setNeedsUpdate(buffer, offset) { - this.resolvedProperty[this.propertyIndex] = buffer[offset]; - this.targetObject.needsUpdate = true; - } - _setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer, offset) { - this.resolvedProperty[this.propertyIndex] = buffer[offset]; - this.targetObject.matrixWorldNeedsUpdate = true; - } - // HasToFromArray - _setValue_fromArray(buffer, offset) { - this.resolvedProperty.fromArray(buffer, offset); - } - _setValue_fromArray_setNeedsUpdate(buffer, offset) { - this.resolvedProperty.fromArray(buffer, offset); - this.targetObject.needsUpdate = true; - } - _setValue_fromArray_setMatrixWorldNeedsUpdate(buffer, offset) { - this.resolvedProperty.fromArray(buffer, offset); - this.targetObject.matrixWorldNeedsUpdate = true; - } - _getValue_unbound(targetArray, offset) { - this.bind(); - this.getValue(targetArray, offset); - } - _setValue_unbound(sourceArray, offset) { - this.bind(); - this.setValue(sourceArray, offset); - } - // create getter / setter pair for a property in the scene graph - bind() { - let targetObject = this.node; - const parsedPath = this.parsedPath; - const objectName = parsedPath.objectName; - const propertyName = parsedPath.propertyName; - let propertyIndex = parsedPath.propertyIndex; - if (!targetObject) { - targetObject = PropertyBinding.findNode(this.rootNode, parsedPath.nodeName); - this.node = targetObject; - } - this.getValue = this._getValue_unavailable; - this.setValue = this._setValue_unavailable; - if (!targetObject) { - console.warn("THREE.PropertyBinding: No target node found for track: " + this.path + "."); - return; - } - if (objectName) { - let objectIndex = parsedPath.objectIndex; - switch (objectName) { - case "materials": - if (!targetObject.material) { - console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this); - return; - } - if (!targetObject.material.materials) { - console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this); - return; - } - targetObject = targetObject.material.materials; - break; - case "bones": - if (!targetObject.skeleton) { - console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this); - return; - } - targetObject = targetObject.skeleton.bones; - for (let i = 0; i < targetObject.length; i++) { - if (targetObject[i].name === objectIndex) { - objectIndex = i; - break; - } - } - break; - case "map": - if ("map" in targetObject) { - targetObject = targetObject.map; - break; - } - if (!targetObject.material) { - console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this); - return; - } - if (!targetObject.material.map) { - console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.", this); - return; - } - targetObject = targetObject.material.map; - break; - default: - if (targetObject[objectName] === void 0) { - console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this); - return; - } - targetObject = targetObject[objectName]; - } - if (objectIndex !== void 0) { - if (targetObject[objectIndex] === void 0) { - console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, targetObject); - return; - } - targetObject = targetObject[objectIndex]; - } - } - const nodeProperty = targetObject[propertyName]; - if (nodeProperty === void 0) { - const nodeName = parsedPath.nodeName; - console.error("THREE.PropertyBinding: Trying to update property for track: " + nodeName + "." + propertyName + " but it wasn't found.", targetObject); - return; - } - let versioning = this.Versioning.None; - this.targetObject = targetObject; - if (targetObject.needsUpdate !== void 0) { - versioning = this.Versioning.NeedsUpdate; - } else if (targetObject.matrixWorldNeedsUpdate !== void 0) { - versioning = this.Versioning.MatrixWorldNeedsUpdate; - } - let bindingType = this.BindingType.Direct; - if (propertyIndex !== void 0) { - if (propertyName === "morphTargetInfluences") { - if (!targetObject.geometry) { - console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this); - return; - } - if (!targetObject.geometry.morphAttributes) { - console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this); - return; - } - if (targetObject.morphTargetDictionary[propertyIndex] !== void 0) { - propertyIndex = targetObject.morphTargetDictionary[propertyIndex]; - } - } - bindingType = this.BindingType.ArrayElement; - this.resolvedProperty = nodeProperty; - this.propertyIndex = propertyIndex; - } else if (nodeProperty.fromArray !== void 0 && nodeProperty.toArray !== void 0) { - bindingType = this.BindingType.HasFromToArray; - this.resolvedProperty = nodeProperty; - } else if (Array.isArray(nodeProperty)) { - bindingType = this.BindingType.EntireArray; - this.resolvedProperty = nodeProperty; - } else { - this.propertyName = propertyName; - } - this.getValue = this.GetterByBindingType[bindingType]; - this.setValue = this.SetterByBindingTypeAndVersioning[bindingType][versioning]; - } - unbind() { - this.node = null; - this.getValue = this._getValue_unbound; - this.setValue = this._setValue_unbound; - } -} -PropertyBinding.Composite = Composite; -PropertyBinding.prototype.BindingType = { - Direct: 0, - EntireArray: 1, - ArrayElement: 2, - HasFromToArray: 3 -}; -PropertyBinding.prototype.Versioning = { - None: 0, - NeedsUpdate: 1, - MatrixWorldNeedsUpdate: 2 -}; -PropertyBinding.prototype.GetterByBindingType = [ - PropertyBinding.prototype._getValue_direct, - PropertyBinding.prototype._getValue_array, - PropertyBinding.prototype._getValue_arrayElement, - PropertyBinding.prototype._getValue_toArray -]; -PropertyBinding.prototype.SetterByBindingTypeAndVersioning = [ - [ - // Direct - PropertyBinding.prototype._setValue_direct, - PropertyBinding.prototype._setValue_direct_setNeedsUpdate, - PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate - ], - [ - // EntireArray - PropertyBinding.prototype._setValue_array, - PropertyBinding.prototype._setValue_array_setNeedsUpdate, - PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate - ], - [ - // ArrayElement - PropertyBinding.prototype._setValue_arrayElement, - PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate, - PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate - ], - [ - // HasToFromArray - PropertyBinding.prototype._setValue_fromArray, - PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate, - PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate - ] -]; -class AnimationObjectGroup { - static { - __name(this, "AnimationObjectGroup"); - } - constructor() { - this.isAnimationObjectGroup = true; - this.uuid = generateUUID(); - this._objects = Array.prototype.slice.call(arguments); - this.nCachedObjects_ = 0; - const indices = {}; - this._indicesByUUID = indices; - for (let i = 0, n = arguments.length; i !== n; ++i) { - indices[arguments[i].uuid] = i; - } - this._paths = []; - this._parsedPaths = []; - this._bindings = []; - this._bindingsIndicesByPath = {}; - const scope = this; - this.stats = { - objects: { - get total() { - return scope._objects.length; - }, - get inUse() { - return this.total - scope.nCachedObjects_; - } - }, - get bindingsPerObject() { - return scope._bindings.length; - } - }; - } - add() { - const objects = this._objects, indicesByUUID = this._indicesByUUID, paths = this._paths, parsedPaths = this._parsedPaths, bindings = this._bindings, nBindings = bindings.length; - let knownObject = void 0, nObjects = objects.length, nCachedObjects = this.nCachedObjects_; - for (let i = 0, n = arguments.length; i !== n; ++i) { - const object = arguments[i], uuid = object.uuid; - let index = indicesByUUID[uuid]; - if (index === void 0) { - index = nObjects++; - indicesByUUID[uuid] = index; - objects.push(object); - for (let j = 0, m = nBindings; j !== m; ++j) { - bindings[j].push(new PropertyBinding(object, paths[j], parsedPaths[j])); - } - } else if (index < nCachedObjects) { - knownObject = objects[index]; - const firstActiveIndex = --nCachedObjects, lastCachedObject = objects[firstActiveIndex]; - indicesByUUID[lastCachedObject.uuid] = index; - objects[index] = lastCachedObject; - indicesByUUID[uuid] = firstActiveIndex; - objects[firstActiveIndex] = object; - for (let j = 0, m = nBindings; j !== m; ++j) { - const bindingsForPath = bindings[j], lastCached = bindingsForPath[firstActiveIndex]; - let binding = bindingsForPath[index]; - bindingsForPath[index] = lastCached; - if (binding === void 0) { - binding = new PropertyBinding(object, paths[j], parsedPaths[j]); - } - bindingsForPath[firstActiveIndex] = binding; - } - } else if (objects[index] !== knownObject) { - console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes."); - } - } - this.nCachedObjects_ = nCachedObjects; - } - remove() { - const objects = this._objects, indicesByUUID = this._indicesByUUID, bindings = this._bindings, nBindings = bindings.length; - let nCachedObjects = this.nCachedObjects_; - for (let i = 0, n = arguments.length; i !== n; ++i) { - const object = arguments[i], uuid = object.uuid, index = indicesByUUID[uuid]; - if (index !== void 0 && index >= nCachedObjects) { - const lastCachedIndex = nCachedObjects++, firstActiveObject = objects[lastCachedIndex]; - indicesByUUID[firstActiveObject.uuid] = index; - objects[index] = firstActiveObject; - indicesByUUID[uuid] = lastCachedIndex; - objects[lastCachedIndex] = object; - for (let j = 0, m = nBindings; j !== m; ++j) { - const bindingsForPath = bindings[j], firstActive = bindingsForPath[lastCachedIndex], binding = bindingsForPath[index]; - bindingsForPath[index] = firstActive; - bindingsForPath[lastCachedIndex] = binding; - } - } - } - this.nCachedObjects_ = nCachedObjects; - } - // remove & forget - uncache() { - const objects = this._objects, indicesByUUID = this._indicesByUUID, bindings = this._bindings, nBindings = bindings.length; - let nCachedObjects = this.nCachedObjects_, nObjects = objects.length; - for (let i = 0, n = arguments.length; i !== n; ++i) { - const object = arguments[i], uuid = object.uuid, index = indicesByUUID[uuid]; - if (index !== void 0) { - delete indicesByUUID[uuid]; - if (index < nCachedObjects) { - const firstActiveIndex = --nCachedObjects, lastCachedObject = objects[firstActiveIndex], lastIndex = --nObjects, lastObject = objects[lastIndex]; - indicesByUUID[lastCachedObject.uuid] = index; - objects[index] = lastCachedObject; - indicesByUUID[lastObject.uuid] = firstActiveIndex; - objects[firstActiveIndex] = lastObject; - objects.pop(); - for (let j = 0, m = nBindings; j !== m; ++j) { - const bindingsForPath = bindings[j], lastCached = bindingsForPath[firstActiveIndex], last = bindingsForPath[lastIndex]; - bindingsForPath[index] = lastCached; - bindingsForPath[firstActiveIndex] = last; - bindingsForPath.pop(); - } - } else { - const lastIndex = --nObjects, lastObject = objects[lastIndex]; - if (lastIndex > 0) { - indicesByUUID[lastObject.uuid] = index; - } - objects[index] = lastObject; - objects.pop(); - for (let j = 0, m = nBindings; j !== m; ++j) { - const bindingsForPath = bindings[j]; - bindingsForPath[index] = bindingsForPath[lastIndex]; - bindingsForPath.pop(); - } - } - } - } - this.nCachedObjects_ = nCachedObjects; - } - // Internal interface used by befriended PropertyBinding.Composite: - subscribe_(path, parsedPath) { - const indicesByPath = this._bindingsIndicesByPath; - let index = indicesByPath[path]; - const bindings = this._bindings; - if (index !== void 0) return bindings[index]; - const paths = this._paths, parsedPaths = this._parsedPaths, objects = this._objects, nObjects = objects.length, nCachedObjects = this.nCachedObjects_, bindingsForPath = new Array(nObjects); - index = bindings.length; - indicesByPath[path] = index; - paths.push(path); - parsedPaths.push(parsedPath); - bindings.push(bindingsForPath); - for (let i = nCachedObjects, n = objects.length; i !== n; ++i) { - const object = objects[i]; - bindingsForPath[i] = new PropertyBinding(object, path, parsedPath); - } - return bindingsForPath; - } - unsubscribe_(path) { - const indicesByPath = this._bindingsIndicesByPath, index = indicesByPath[path]; - if (index !== void 0) { - const paths = this._paths, parsedPaths = this._parsedPaths, bindings = this._bindings, lastBindingsIndex = bindings.length - 1, lastBindings = bindings[lastBindingsIndex], lastBindingsPath = path[lastBindingsIndex]; - indicesByPath[lastBindingsPath] = index; - bindings[index] = lastBindings; - bindings.pop(); - parsedPaths[index] = parsedPaths[lastBindingsIndex]; - parsedPaths.pop(); - paths[index] = paths[lastBindingsIndex]; - paths.pop(); - } - } -} -class AnimationAction { - static { - __name(this, "AnimationAction"); - } - constructor(mixer, clip, localRoot = null, blendMode = clip.blendMode) { - this._mixer = mixer; - this._clip = clip; - this._localRoot = localRoot; - this.blendMode = blendMode; - const tracks = clip.tracks, nTracks = tracks.length, interpolants = new Array(nTracks); - const interpolantSettings = { - endingStart: ZeroCurvatureEnding, - endingEnd: ZeroCurvatureEnding - }; - for (let i = 0; i !== nTracks; ++i) { - const interpolant = tracks[i].createInterpolant(null); - interpolants[i] = interpolant; - interpolant.settings = interpolantSettings; - } - this._interpolantSettings = interpolantSettings; - this._interpolants = interpolants; - this._propertyBindings = new Array(nTracks); - this._cacheIndex = null; - this._byClipCacheIndex = null; - this._timeScaleInterpolant = null; - this._weightInterpolant = null; - this.loop = LoopRepeat; - this._loopCount = -1; - this._startTime = null; - this.time = 0; - this.timeScale = 1; - this._effectiveTimeScale = 1; - this.weight = 1; - this._effectiveWeight = 1; - this.repetitions = Infinity; - this.paused = false; - this.enabled = true; - this.clampWhenFinished = false; - this.zeroSlopeAtStart = true; - this.zeroSlopeAtEnd = true; - } - // State & Scheduling - play() { - this._mixer._activateAction(this); - return this; - } - stop() { - this._mixer._deactivateAction(this); - return this.reset(); - } - reset() { - this.paused = false; - this.enabled = true; - this.time = 0; - this._loopCount = -1; - this._startTime = null; - return this.stopFading().stopWarping(); - } - isRunning() { - return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this); - } - // return true when play has been called - isScheduled() { - return this._mixer._isActiveAction(this); - } - startAt(time) { - this._startTime = time; - return this; - } - setLoop(mode, repetitions) { - this.loop = mode; - this.repetitions = repetitions; - return this; - } - // Weight - // set the weight stopping any scheduled fading - // although .enabled = false yields an effective weight of zero, this - // method does *not* change .enabled, because it would be confusing - setEffectiveWeight(weight) { - this.weight = weight; - this._effectiveWeight = this.enabled ? weight : 0; - return this.stopFading(); - } - // return the weight considering fading and .enabled - getEffectiveWeight() { - return this._effectiveWeight; - } - fadeIn(duration) { - return this._scheduleFading(duration, 0, 1); - } - fadeOut(duration) { - return this._scheduleFading(duration, 1, 0); - } - crossFadeFrom(fadeOutAction, duration, warp) { - fadeOutAction.fadeOut(duration); - this.fadeIn(duration); - if (warp) { - const fadeInDuration = this._clip.duration, fadeOutDuration = fadeOutAction._clip.duration, startEndRatio = fadeOutDuration / fadeInDuration, endStartRatio = fadeInDuration / fadeOutDuration; - fadeOutAction.warp(1, startEndRatio, duration); - this.warp(endStartRatio, 1, duration); - } - return this; - } - crossFadeTo(fadeInAction, duration, warp) { - return fadeInAction.crossFadeFrom(this, duration, warp); - } - stopFading() { - const weightInterpolant = this._weightInterpolant; - if (weightInterpolant !== null) { - this._weightInterpolant = null; - this._mixer._takeBackControlInterpolant(weightInterpolant); - } - return this; - } - // Time Scale Control - // set the time scale stopping any scheduled warping - // although .paused = true yields an effective time scale of zero, this - // method does *not* change .paused, because it would be confusing - setEffectiveTimeScale(timeScale) { - this.timeScale = timeScale; - this._effectiveTimeScale = this.paused ? 0 : timeScale; - return this.stopWarping(); - } - // return the time scale considering warping and .paused - getEffectiveTimeScale() { - return this._effectiveTimeScale; - } - setDuration(duration) { - this.timeScale = this._clip.duration / duration; - return this.stopWarping(); - } - syncWith(action) { - this.time = action.time; - this.timeScale = action.timeScale; - return this.stopWarping(); - } - halt(duration) { - return this.warp(this._effectiveTimeScale, 0, duration); - } - warp(startTimeScale, endTimeScale, duration) { - const mixer = this._mixer, now2 = mixer.time, timeScale = this.timeScale; - let interpolant = this._timeScaleInterpolant; - if (interpolant === null) { - interpolant = mixer._lendControlInterpolant(); - this._timeScaleInterpolant = interpolant; - } - const times = interpolant.parameterPositions, values = interpolant.sampleValues; - times[0] = now2; - times[1] = now2 + duration; - values[0] = startTimeScale / timeScale; - values[1] = endTimeScale / timeScale; - return this; - } - stopWarping() { - const timeScaleInterpolant = this._timeScaleInterpolant; - if (timeScaleInterpolant !== null) { - this._timeScaleInterpolant = null; - this._mixer._takeBackControlInterpolant(timeScaleInterpolant); - } - return this; - } - // Object Accessors - getMixer() { - return this._mixer; - } - getClip() { - return this._clip; - } - getRoot() { - return this._localRoot || this._mixer._root; - } - // Interna - _update(time, deltaTime, timeDirection, accuIndex) { - if (!this.enabled) { - this._updateWeight(time); - return; - } - const startTime = this._startTime; - if (startTime !== null) { - const timeRunning = (time - startTime) * timeDirection; - if (timeRunning < 0 || timeDirection === 0) { - deltaTime = 0; - } else { - this._startTime = null; - deltaTime = timeDirection * timeRunning; - } - } - deltaTime *= this._updateTimeScale(time); - const clipTime = this._updateTime(deltaTime); - const weight = this._updateWeight(time); - if (weight > 0) { - const interpolants = this._interpolants; - const propertyMixers = this._propertyBindings; - switch (this.blendMode) { - case AdditiveAnimationBlendMode: - for (let j = 0, m = interpolants.length; j !== m; ++j) { - interpolants[j].evaluate(clipTime); - propertyMixers[j].accumulateAdditive(weight); - } - break; - case NormalAnimationBlendMode: - default: - for (let j = 0, m = interpolants.length; j !== m; ++j) { - interpolants[j].evaluate(clipTime); - propertyMixers[j].accumulate(accuIndex, weight); - } - } - } - } - _updateWeight(time) { - let weight = 0; - if (this.enabled) { - weight = this.weight; - const interpolant = this._weightInterpolant; - if (interpolant !== null) { - const interpolantValue = interpolant.evaluate(time)[0]; - weight *= interpolantValue; - if (time > interpolant.parameterPositions[1]) { - this.stopFading(); - if (interpolantValue === 0) { - this.enabled = false; - } - } - } - } - this._effectiveWeight = weight; - return weight; - } - _updateTimeScale(time) { - let timeScale = 0; - if (!this.paused) { - timeScale = this.timeScale; - const interpolant = this._timeScaleInterpolant; - if (interpolant !== null) { - const interpolantValue = interpolant.evaluate(time)[0]; - timeScale *= interpolantValue; - if (time > interpolant.parameterPositions[1]) { - this.stopWarping(); - if (timeScale === 0) { - this.paused = true; - } else { - this.timeScale = timeScale; - } - } - } - } - this._effectiveTimeScale = timeScale; - return timeScale; - } - _updateTime(deltaTime) { - const duration = this._clip.duration; - const loop = this.loop; - let time = this.time + deltaTime; - let loopCount = this._loopCount; - const pingPong = loop === LoopPingPong; - if (deltaTime === 0) { - if (loopCount === -1) return time; - return pingPong && (loopCount & 1) === 1 ? duration - time : time; - } - if (loop === LoopOnce) { - if (loopCount === -1) { - this._loopCount = 0; - this._setEndings(true, true, false); - } - handle_stop: { - if (time >= duration) { - time = duration; - } else if (time < 0) { - time = 0; - } else { - this.time = time; - break handle_stop; - } - if (this.clampWhenFinished) this.paused = true; - else this.enabled = false; - this.time = time; - this._mixer.dispatchEvent({ - type: "finished", - action: this, - direction: deltaTime < 0 ? -1 : 1 - }); - } - } else { - if (loopCount === -1) { - if (deltaTime >= 0) { - loopCount = 0; - this._setEndings(true, this.repetitions === 0, pingPong); - } else { - this._setEndings(this.repetitions === 0, true, pingPong); - } - } - if (time >= duration || time < 0) { - const loopDelta = Math.floor(time / duration); - time -= duration * loopDelta; - loopCount += Math.abs(loopDelta); - const pending = this.repetitions - loopCount; - if (pending <= 0) { - if (this.clampWhenFinished) this.paused = true; - else this.enabled = false; - time = deltaTime > 0 ? duration : 0; - this.time = time; - this._mixer.dispatchEvent({ - type: "finished", - action: this, - direction: deltaTime > 0 ? 1 : -1 - }); - } else { - if (pending === 1) { - const atStart = deltaTime < 0; - this._setEndings(atStart, !atStart, pingPong); - } else { - this._setEndings(false, false, pingPong); - } - this._loopCount = loopCount; - this.time = time; - this._mixer.dispatchEvent({ - type: "loop", - action: this, - loopDelta - }); - } - } else { - this.time = time; - } - if (pingPong && (loopCount & 1) === 1) { - return duration - time; - } - } - return time; - } - _setEndings(atStart, atEnd, pingPong) { - const settings = this._interpolantSettings; - if (pingPong) { - settings.endingStart = ZeroSlopeEnding; - settings.endingEnd = ZeroSlopeEnding; - } else { - if (atStart) { - settings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding; - } else { - settings.endingStart = WrapAroundEnding; - } - if (atEnd) { - settings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding; - } else { - settings.endingEnd = WrapAroundEnding; - } - } - } - _scheduleFading(duration, weightNow, weightThen) { - const mixer = this._mixer, now2 = mixer.time; - let interpolant = this._weightInterpolant; - if (interpolant === null) { - interpolant = mixer._lendControlInterpolant(); - this._weightInterpolant = interpolant; - } - const times = interpolant.parameterPositions, values = interpolant.sampleValues; - times[0] = now2; - values[0] = weightNow; - times[1] = now2 + duration; - values[1] = weightThen; - return this; - } -} -const _controlInterpolantsResultBuffer = new Float32Array(1); -class AnimationMixer extends EventDispatcher { - static { - __name(this, "AnimationMixer"); - } - constructor(root) { - super(); - this._root = root; - this._initMemoryManager(); - this._accuIndex = 0; - this.time = 0; - this.timeScale = 1; - } - _bindAction(action, prototypeAction) { - const root = action._localRoot || this._root, tracks = action._clip.tracks, nTracks = tracks.length, bindings = action._propertyBindings, interpolants = action._interpolants, rootUuid = root.uuid, bindingsByRoot = this._bindingsByRootAndName; - let bindingsByName = bindingsByRoot[rootUuid]; - if (bindingsByName === void 0) { - bindingsByName = {}; - bindingsByRoot[rootUuid] = bindingsByName; - } - for (let i = 0; i !== nTracks; ++i) { - const track = tracks[i], trackName = track.name; - let binding = bindingsByName[trackName]; - if (binding !== void 0) { - ++binding.referenceCount; - bindings[i] = binding; - } else { - binding = bindings[i]; - if (binding !== void 0) { - if (binding._cacheIndex === null) { - ++binding.referenceCount; - this._addInactiveBinding(binding, rootUuid, trackName); - } - continue; - } - const path = prototypeAction && prototypeAction._propertyBindings[i].binding.parsedPath; - binding = new PropertyMixer( - PropertyBinding.create(root, trackName, path), - track.ValueTypeName, - track.getValueSize() - ); - ++binding.referenceCount; - this._addInactiveBinding(binding, rootUuid, trackName); - bindings[i] = binding; - } - interpolants[i].resultBuffer = binding.buffer; - } - } - _activateAction(action) { - if (!this._isActiveAction(action)) { - if (action._cacheIndex === null) { - const rootUuid = (action._localRoot || this._root).uuid, clipUuid = action._clip.uuid, actionsForClip = this._actionsByClip[clipUuid]; - this._bindAction( - action, - actionsForClip && actionsForClip.knownActions[0] - ); - this._addInactiveAction(action, clipUuid, rootUuid); - } - const bindings = action._propertyBindings; - for (let i = 0, n = bindings.length; i !== n; ++i) { - const binding = bindings[i]; - if (binding.useCount++ === 0) { - this._lendBinding(binding); - binding.saveOriginalState(); - } - } - this._lendAction(action); - } - } - _deactivateAction(action) { - if (this._isActiveAction(action)) { - const bindings = action._propertyBindings; - for (let i = 0, n = bindings.length; i !== n; ++i) { - const binding = bindings[i]; - if (--binding.useCount === 0) { - binding.restoreOriginalState(); - this._takeBackBinding(binding); - } - } - this._takeBackAction(action); - } - } - // Memory manager - _initMemoryManager() { - this._actions = []; - this._nActiveActions = 0; - this._actionsByClip = {}; - this._bindings = []; - this._nActiveBindings = 0; - this._bindingsByRootAndName = {}; - this._controlInterpolants = []; - this._nActiveControlInterpolants = 0; - const scope = this; - this.stats = { - actions: { - get total() { - return scope._actions.length; - }, - get inUse() { - return scope._nActiveActions; - } - }, - bindings: { - get total() { - return scope._bindings.length; - }, - get inUse() { - return scope._nActiveBindings; - } - }, - controlInterpolants: { - get total() { - return scope._controlInterpolants.length; - }, - get inUse() { - return scope._nActiveControlInterpolants; - } - } - }; - } - // Memory management for AnimationAction objects - _isActiveAction(action) { - const index = action._cacheIndex; - return index !== null && index < this._nActiveActions; - } - _addInactiveAction(action, clipUuid, rootUuid) { - const actions = this._actions, actionsByClip = this._actionsByClip; - let actionsForClip = actionsByClip[clipUuid]; - if (actionsForClip === void 0) { - actionsForClip = { - knownActions: [action], - actionByRoot: {} - }; - action._byClipCacheIndex = 0; - actionsByClip[clipUuid] = actionsForClip; - } else { - const knownActions = actionsForClip.knownActions; - action._byClipCacheIndex = knownActions.length; - knownActions.push(action); - } - action._cacheIndex = actions.length; - actions.push(action); - actionsForClip.actionByRoot[rootUuid] = action; - } - _removeInactiveAction(action) { - const actions = this._actions, lastInactiveAction = actions[actions.length - 1], cacheIndex = action._cacheIndex; - lastInactiveAction._cacheIndex = cacheIndex; - actions[cacheIndex] = lastInactiveAction; - actions.pop(); - action._cacheIndex = null; - const clipUuid = action._clip.uuid, actionsByClip = this._actionsByClip, actionsForClip = actionsByClip[clipUuid], knownActionsForClip = actionsForClip.knownActions, lastKnownAction = knownActionsForClip[knownActionsForClip.length - 1], byClipCacheIndex = action._byClipCacheIndex; - lastKnownAction._byClipCacheIndex = byClipCacheIndex; - knownActionsForClip[byClipCacheIndex] = lastKnownAction; - knownActionsForClip.pop(); - action._byClipCacheIndex = null; - const actionByRoot = actionsForClip.actionByRoot, rootUuid = (action._localRoot || this._root).uuid; - delete actionByRoot[rootUuid]; - if (knownActionsForClip.length === 0) { - delete actionsByClip[clipUuid]; - } - this._removeInactiveBindingsForAction(action); - } - _removeInactiveBindingsForAction(action) { - const bindings = action._propertyBindings; - for (let i = 0, n = bindings.length; i !== n; ++i) { - const binding = bindings[i]; - if (--binding.referenceCount === 0) { - this._removeInactiveBinding(binding); - } - } - } - _lendAction(action) { - const actions = this._actions, prevIndex = action._cacheIndex, lastActiveIndex = this._nActiveActions++, firstInactiveAction = actions[lastActiveIndex]; - action._cacheIndex = lastActiveIndex; - actions[lastActiveIndex] = action; - firstInactiveAction._cacheIndex = prevIndex; - actions[prevIndex] = firstInactiveAction; - } - _takeBackAction(action) { - const actions = this._actions, prevIndex = action._cacheIndex, firstInactiveIndex = --this._nActiveActions, lastActiveAction = actions[firstInactiveIndex]; - action._cacheIndex = firstInactiveIndex; - actions[firstInactiveIndex] = action; - lastActiveAction._cacheIndex = prevIndex; - actions[prevIndex] = lastActiveAction; - } - // Memory management for PropertyMixer objects - _addInactiveBinding(binding, rootUuid, trackName) { - const bindingsByRoot = this._bindingsByRootAndName, bindings = this._bindings; - let bindingByName = bindingsByRoot[rootUuid]; - if (bindingByName === void 0) { - bindingByName = {}; - bindingsByRoot[rootUuid] = bindingByName; - } - bindingByName[trackName] = binding; - binding._cacheIndex = bindings.length; - bindings.push(binding); - } - _removeInactiveBinding(binding) { - const bindings = this._bindings, propBinding = binding.binding, rootUuid = propBinding.rootNode.uuid, trackName = propBinding.path, bindingsByRoot = this._bindingsByRootAndName, bindingByName = bindingsByRoot[rootUuid], lastInactiveBinding = bindings[bindings.length - 1], cacheIndex = binding._cacheIndex; - lastInactiveBinding._cacheIndex = cacheIndex; - bindings[cacheIndex] = lastInactiveBinding; - bindings.pop(); - delete bindingByName[trackName]; - if (Object.keys(bindingByName).length === 0) { - delete bindingsByRoot[rootUuid]; - } - } - _lendBinding(binding) { - const bindings = this._bindings, prevIndex = binding._cacheIndex, lastActiveIndex = this._nActiveBindings++, firstInactiveBinding = bindings[lastActiveIndex]; - binding._cacheIndex = lastActiveIndex; - bindings[lastActiveIndex] = binding; - firstInactiveBinding._cacheIndex = prevIndex; - bindings[prevIndex] = firstInactiveBinding; - } - _takeBackBinding(binding) { - const bindings = this._bindings, prevIndex = binding._cacheIndex, firstInactiveIndex = --this._nActiveBindings, lastActiveBinding = bindings[firstInactiveIndex]; - binding._cacheIndex = firstInactiveIndex; - bindings[firstInactiveIndex] = binding; - lastActiveBinding._cacheIndex = prevIndex; - bindings[prevIndex] = lastActiveBinding; - } - // Memory management of Interpolants for weight and time scale - _lendControlInterpolant() { - const interpolants = this._controlInterpolants, lastActiveIndex = this._nActiveControlInterpolants++; - let interpolant = interpolants[lastActiveIndex]; - if (interpolant === void 0) { - interpolant = new LinearInterpolant( - new Float32Array(2), - new Float32Array(2), - 1, - _controlInterpolantsResultBuffer - ); - interpolant.__cacheIndex = lastActiveIndex; - interpolants[lastActiveIndex] = interpolant; - } - return interpolant; - } - _takeBackControlInterpolant(interpolant) { - const interpolants = this._controlInterpolants, prevIndex = interpolant.__cacheIndex, firstInactiveIndex = --this._nActiveControlInterpolants, lastActiveInterpolant = interpolants[firstInactiveIndex]; - interpolant.__cacheIndex = firstInactiveIndex; - interpolants[firstInactiveIndex] = interpolant; - lastActiveInterpolant.__cacheIndex = prevIndex; - interpolants[prevIndex] = lastActiveInterpolant; - } - // return an action for a clip optionally using a custom root target - // object (this method allocates a lot of dynamic memory in case a - // previously unknown clip/root combination is specified) - clipAction(clip, optionalRoot, blendMode) { - const root = optionalRoot || this._root, rootUuid = root.uuid; - let clipObject = typeof clip === "string" ? AnimationClip.findByName(root, clip) : clip; - const clipUuid = clipObject !== null ? clipObject.uuid : clip; - const actionsForClip = this._actionsByClip[clipUuid]; - let prototypeAction = null; - if (blendMode === void 0) { - if (clipObject !== null) { - blendMode = clipObject.blendMode; - } else { - blendMode = NormalAnimationBlendMode; - } - } - if (actionsForClip !== void 0) { - const existingAction = actionsForClip.actionByRoot[rootUuid]; - if (existingAction !== void 0 && existingAction.blendMode === blendMode) { - return existingAction; - } - prototypeAction = actionsForClip.knownActions[0]; - if (clipObject === null) - clipObject = prototypeAction._clip; - } - if (clipObject === null) return null; - const newAction = new AnimationAction(this, clipObject, optionalRoot, blendMode); - this._bindAction(newAction, prototypeAction); - this._addInactiveAction(newAction, clipUuid, rootUuid); - return newAction; - } - // get an existing action - existingAction(clip, optionalRoot) { - const root = optionalRoot || this._root, rootUuid = root.uuid, clipObject = typeof clip === "string" ? AnimationClip.findByName(root, clip) : clip, clipUuid = clipObject ? clipObject.uuid : clip, actionsForClip = this._actionsByClip[clipUuid]; - if (actionsForClip !== void 0) { - return actionsForClip.actionByRoot[rootUuid] || null; - } - return null; - } - // deactivates all previously scheduled actions - stopAllAction() { - const actions = this._actions, nActions = this._nActiveActions; - for (let i = nActions - 1; i >= 0; --i) { - actions[i].stop(); - } - return this; - } - // advance the time and update apply the animation - update(deltaTime) { - deltaTime *= this.timeScale; - const actions = this._actions, nActions = this._nActiveActions, time = this.time += deltaTime, timeDirection = Math.sign(deltaTime), accuIndex = this._accuIndex ^= 1; - for (let i = 0; i !== nActions; ++i) { - const action = actions[i]; - action._update(time, deltaTime, timeDirection, accuIndex); - } - const bindings = this._bindings, nBindings = this._nActiveBindings; - for (let i = 0; i !== nBindings; ++i) { - bindings[i].apply(accuIndex); - } - return this; - } - // Allows you to seek to a specific time in an animation. - setTime(timeInSeconds) { - this.time = 0; - for (let i = 0; i < this._actions.length; i++) { - this._actions[i].time = 0; - } - return this.update(timeInSeconds); - } - // return this mixer's root target object - getRoot() { - return this._root; - } - // free all resources specific to a particular clip - uncacheClip(clip) { - const actions = this._actions, clipUuid = clip.uuid, actionsByClip = this._actionsByClip, actionsForClip = actionsByClip[clipUuid]; - if (actionsForClip !== void 0) { - const actionsToRemove = actionsForClip.knownActions; - for (let i = 0, n = actionsToRemove.length; i !== n; ++i) { - const action = actionsToRemove[i]; - this._deactivateAction(action); - const cacheIndex = action._cacheIndex, lastInactiveAction = actions[actions.length - 1]; - action._cacheIndex = null; - action._byClipCacheIndex = null; - lastInactiveAction._cacheIndex = cacheIndex; - actions[cacheIndex] = lastInactiveAction; - actions.pop(); - this._removeInactiveBindingsForAction(action); - } - delete actionsByClip[clipUuid]; - } - } - // free all resources specific to a particular root target object - uncacheRoot(root) { - const rootUuid = root.uuid, actionsByClip = this._actionsByClip; - for (const clipUuid in actionsByClip) { - const actionByRoot = actionsByClip[clipUuid].actionByRoot, action = actionByRoot[rootUuid]; - if (action !== void 0) { - this._deactivateAction(action); - this._removeInactiveAction(action); - } - } - const bindingsByRoot = this._bindingsByRootAndName, bindingByName = bindingsByRoot[rootUuid]; - if (bindingByName !== void 0) { - for (const trackName in bindingByName) { - const binding = bindingByName[trackName]; - binding.restoreOriginalState(); - this._removeInactiveBinding(binding); - } - } - } - // remove a targeted clip from the cache - uncacheAction(clip, optionalRoot) { - const action = this.existingAction(clip, optionalRoot); - if (action !== null) { - this._deactivateAction(action); - this._removeInactiveAction(action); - } - } -} -class Uniform { - static { - __name(this, "Uniform"); - } - constructor(value) { - this.value = value; - } - clone() { - return new Uniform(this.value.clone === void 0 ? this.value : this.value.clone()); - } -} -let _id = 0; -class UniformsGroup extends EventDispatcher { - static { - __name(this, "UniformsGroup"); - } - constructor() { - super(); - this.isUniformsGroup = true; - Object.defineProperty(this, "id", { value: _id++ }); - this.name = ""; - this.usage = StaticDrawUsage; - this.uniforms = []; - } - add(uniform) { - this.uniforms.push(uniform); - return this; - } - remove(uniform) { - const index = this.uniforms.indexOf(uniform); - if (index !== -1) this.uniforms.splice(index, 1); - return this; - } - setName(name) { - this.name = name; - return this; - } - setUsage(value) { - this.usage = value; - return this; - } - dispose() { - this.dispatchEvent({ type: "dispose" }); - return this; - } - copy(source) { - this.name = source.name; - this.usage = source.usage; - const uniformsSource = source.uniforms; - this.uniforms.length = 0; - for (let i = 0, l = uniformsSource.length; i < l; i++) { - const uniforms = Array.isArray(uniformsSource[i]) ? uniformsSource[i] : [uniformsSource[i]]; - for (let j = 0; j < uniforms.length; j++) { - this.uniforms.push(uniforms[j].clone()); - } - } - return this; - } - clone() { - return new this.constructor().copy(this); - } -} -class InstancedInterleavedBuffer extends InterleavedBuffer { - static { - __name(this, "InstancedInterleavedBuffer"); - } - constructor(array, stride, meshPerAttribute = 1) { - super(array, stride); - this.isInstancedInterleavedBuffer = true; - this.meshPerAttribute = meshPerAttribute; - } - copy(source) { - super.copy(source); - this.meshPerAttribute = source.meshPerAttribute; - return this; - } - clone(data) { - const ib = super.clone(data); - ib.meshPerAttribute = this.meshPerAttribute; - return ib; - } - toJSON(data) { - const json = super.toJSON(data); - json.isInstancedInterleavedBuffer = true; - json.meshPerAttribute = this.meshPerAttribute; - return json; - } -} -class GLBufferAttribute { - static { - __name(this, "GLBufferAttribute"); - } - constructor(buffer, type, itemSize, elementSize, count) { - this.isGLBufferAttribute = true; - this.name = ""; - this.buffer = buffer; - this.type = type; - this.itemSize = itemSize; - this.elementSize = elementSize; - this.count = count; - this.version = 0; - } - set needsUpdate(value) { - if (value === true) this.version++; - } - setBuffer(buffer) { - this.buffer = buffer; - return this; - } - setType(type, elementSize) { - this.type = type; - this.elementSize = elementSize; - return this; - } - setItemSize(itemSize) { - this.itemSize = itemSize; - return this; - } - setCount(count) { - this.count = count; - return this; - } -} -const _matrix = /* @__PURE__ */ new Matrix4(); -class Raycaster { - static { - __name(this, "Raycaster"); - } - constructor(origin, direction, near = 0, far = Infinity) { - this.ray = new Ray(origin, direction); - this.near = near; - this.far = far; - this.camera = null; - this.layers = new Layers(); - this.params = { - Mesh: {}, - Line: { threshold: 1 }, - LOD: {}, - Points: { threshold: 1 }, - Sprite: {} - }; - } - set(origin, direction) { - this.ray.set(origin, direction); - } - setFromCamera(coords, camera) { - if (camera.isPerspectiveCamera) { - this.ray.origin.setFromMatrixPosition(camera.matrixWorld); - this.ray.direction.set(coords.x, coords.y, 0.5).unproject(camera).sub(this.ray.origin).normalize(); - this.camera = camera; - } else if (camera.isOrthographicCamera) { - this.ray.origin.set(coords.x, coords.y, (camera.near + camera.far) / (camera.near - camera.far)).unproject(camera); - this.ray.direction.set(0, 0, -1).transformDirection(camera.matrixWorld); - this.camera = camera; - } else { - console.error("THREE.Raycaster: Unsupported camera type: " + camera.type); - } - } - setFromXRController(controller) { - _matrix.identity().extractRotation(controller.matrixWorld); - this.ray.origin.setFromMatrixPosition(controller.matrixWorld); - this.ray.direction.set(0, 0, -1).applyMatrix4(_matrix); - return this; - } - intersectObject(object, recursive = true, intersects2 = []) { - intersect(object, this, intersects2, recursive); - intersects2.sort(ascSort); - return intersects2; - } - intersectObjects(objects, recursive = true, intersects2 = []) { - for (let i = 0, l = objects.length; i < l; i++) { - intersect(objects[i], this, intersects2, recursive); - } - intersects2.sort(ascSort); - return intersects2; - } -} -function ascSort(a, b) { - return a.distance - b.distance; -} -__name(ascSort, "ascSort"); -function intersect(object, raycaster, intersects2, recursive) { - let propagate = true; - if (object.layers.test(raycaster.layers)) { - const result = object.raycast(raycaster, intersects2); - if (result === false) propagate = false; - } - if (propagate === true && recursive === true) { - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { - intersect(children[i], raycaster, intersects2, true); - } - } -} -__name(intersect, "intersect"); -class Spherical { - static { - __name(this, "Spherical"); - } - constructor(radius = 1, phi = 0, theta = 0) { - this.radius = radius; - this.phi = phi; - this.theta = theta; - return this; - } - set(radius, phi, theta) { - this.radius = radius; - this.phi = phi; - this.theta = theta; - return this; - } - copy(other) { - this.radius = other.radius; - this.phi = other.phi; - this.theta = other.theta; - return this; - } - // restrict phi to be between EPS and PI-EPS - makeSafe() { - const EPS = 1e-6; - this.phi = Math.max(EPS, Math.min(Math.PI - EPS, this.phi)); - return this; - } - setFromVector3(v) { - return this.setFromCartesianCoords(v.x, v.y, v.z); - } - setFromCartesianCoords(x, y, z) { - this.radius = Math.sqrt(x * x + y * y + z * z); - if (this.radius === 0) { - this.theta = 0; - this.phi = 0; - } else { - this.theta = Math.atan2(x, z); - this.phi = Math.acos(clamp(y / this.radius, -1, 1)); - } - return this; - } - clone() { - return new this.constructor().copy(this); - } -} -class Cylindrical { - static { - __name(this, "Cylindrical"); - } - constructor(radius = 1, theta = 0, y = 0) { - this.radius = radius; - this.theta = theta; - this.y = y; - return this; - } - set(radius, theta, y) { - this.radius = radius; - this.theta = theta; - this.y = y; - return this; - } - copy(other) { - this.radius = other.radius; - this.theta = other.theta; - this.y = other.y; - return this; - } - setFromVector3(v) { - return this.setFromCartesianCoords(v.x, v.y, v.z); - } - setFromCartesianCoords(x, y, z) { - this.radius = Math.sqrt(x * x + z * z); - this.theta = Math.atan2(x, z); - this.y = y; - return this; - } - clone() { - return new this.constructor().copy(this); - } -} -class Matrix2 { - static { - __name(this, "Matrix2"); - } - constructor(n11, n12, n21, n22) { - Matrix2.prototype.isMatrix2 = true; - this.elements = [ - 1, - 0, - 0, - 1 - ]; - if (n11 !== void 0) { - this.set(n11, n12, n21, n22); - } - } - identity() { - this.set( - 1, - 0, - 0, - 1 - ); - return this; - } - fromArray(array, offset = 0) { - for (let i = 0; i < 4; i++) { - this.elements[i] = array[i + offset]; - } - return this; - } - set(n11, n12, n21, n22) { - const te2 = this.elements; - te2[0] = n11; - te2[2] = n12; - te2[1] = n21; - te2[3] = n22; - return this; - } -} -const _vector$4 = /* @__PURE__ */ new Vector2(); -class Box2 { - static { - __name(this, "Box2"); - } - constructor(min = new Vector2(Infinity, Infinity), max2 = new Vector2(-Infinity, -Infinity)) { - this.isBox2 = true; - this.min = min; - this.max = max2; - } - set(min, max2) { - this.min.copy(min); - this.max.copy(max2); - return this; - } - setFromPoints(points) { - this.makeEmpty(); - for (let i = 0, il = points.length; i < il; i++) { - this.expandByPoint(points[i]); - } - return this; - } - setFromCenterAndSize(center, size) { - const halfSize = _vector$4.copy(size).multiplyScalar(0.5); - this.min.copy(center).sub(halfSize); - this.max.copy(center).add(halfSize); - return this; - } - clone() { - return new this.constructor().copy(this); - } - copy(box) { - this.min.copy(box.min); - this.max.copy(box.max); - return this; - } - makeEmpty() { - this.min.x = this.min.y = Infinity; - this.max.x = this.max.y = -Infinity; - return this; - } - isEmpty() { - return this.max.x < this.min.x || this.max.y < this.min.y; - } - getCenter(target) { - return this.isEmpty() ? target.set(0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5); - } - getSize(target) { - return this.isEmpty() ? target.set(0, 0) : target.subVectors(this.max, this.min); - } - expandByPoint(point) { - this.min.min(point); - this.max.max(point); - return this; - } - expandByVector(vector) { - this.min.sub(vector); - this.max.add(vector); - return this; - } - expandByScalar(scalar) { - this.min.addScalar(-scalar); - this.max.addScalar(scalar); - return this; - } - containsPoint(point) { - return point.x >= this.min.x && point.x <= this.max.x && point.y >= this.min.y && point.y <= this.max.y; - } - containsBox(box) { - return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y; - } - getParameter(point, target) { - return target.set( - (point.x - this.min.x) / (this.max.x - this.min.x), - (point.y - this.min.y) / (this.max.y - this.min.y) - ); - } - intersectsBox(box) { - return box.max.x >= this.min.x && box.min.x <= this.max.x && box.max.y >= this.min.y && box.min.y <= this.max.y; - } - clampPoint(point, target) { - return target.copy(point).clamp(this.min, this.max); - } - distanceToPoint(point) { - return this.clampPoint(point, _vector$4).distanceTo(point); - } - intersect(box) { - this.min.max(box.min); - this.max.min(box.max); - if (this.isEmpty()) this.makeEmpty(); - return this; - } - union(box) { - this.min.min(box.min); - this.max.max(box.max); - return this; - } - translate(offset) { - this.min.add(offset); - this.max.add(offset); - return this; - } - equals(box) { - return box.min.equals(this.min) && box.max.equals(this.max); - } -} -const _startP = /* @__PURE__ */ new Vector3(); -const _startEnd = /* @__PURE__ */ new Vector3(); -class Line3 { - static { - __name(this, "Line3"); - } - constructor(start = new Vector3(), end = new Vector3()) { - this.start = start; - this.end = end; - } - set(start, end) { - this.start.copy(start); - this.end.copy(end); - return this; - } - copy(line) { - this.start.copy(line.start); - this.end.copy(line.end); - return this; - } - getCenter(target) { - return target.addVectors(this.start, this.end).multiplyScalar(0.5); - } - delta(target) { - return target.subVectors(this.end, this.start); - } - distanceSq() { - return this.start.distanceToSquared(this.end); - } - distance() { - return this.start.distanceTo(this.end); - } - at(t2, target) { - return this.delta(target).multiplyScalar(t2).add(this.start); - } - closestPointToPointParameter(point, clampToLine) { - _startP.subVectors(point, this.start); - _startEnd.subVectors(this.end, this.start); - const startEnd2 = _startEnd.dot(_startEnd); - const startEnd_startP = _startEnd.dot(_startP); - let t2 = startEnd_startP / startEnd2; - if (clampToLine) { - t2 = clamp(t2, 0, 1); - } - return t2; - } - closestPointToPoint(point, clampToLine, target) { - const t2 = this.closestPointToPointParameter(point, clampToLine); - return this.delta(target).multiplyScalar(t2).add(this.start); - } - applyMatrix4(matrix) { - this.start.applyMatrix4(matrix); - this.end.applyMatrix4(matrix); - return this; - } - equals(line) { - return line.start.equals(this.start) && line.end.equals(this.end); - } - clone() { - return new this.constructor().copy(this); - } -} -const _vector$3 = /* @__PURE__ */ new Vector3(); -class SpotLightHelper extends Object3D { - static { - __name(this, "SpotLightHelper"); - } - constructor(light, color) { - super(); - this.light = light; - this.matrixAutoUpdate = false; - this.color = color; - this.type = "SpotLightHelper"; - const geometry = new BufferGeometry(); - const positions = [ - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - -1, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 1, - 0, - 0, - 0, - 0, - -1, - 1 - ]; - for (let i = 0, j = 1, l = 32; i < l; i++, j++) { - const p1 = i / l * Math.PI * 2; - const p2 = j / l * Math.PI * 2; - positions.push( - Math.cos(p1), - Math.sin(p1), - 1, - Math.cos(p2), - Math.sin(p2), - 1 - ); - } - geometry.setAttribute("position", new Float32BufferAttribute(positions, 3)); - const material = new LineBasicMaterial({ fog: false, toneMapped: false }); - this.cone = new LineSegments(geometry, material); - this.add(this.cone); - this.update(); - } - dispose() { - this.cone.geometry.dispose(); - this.cone.material.dispose(); - } - update() { - this.light.updateWorldMatrix(true, false); - this.light.target.updateWorldMatrix(true, false); - if (this.parent) { - this.parent.updateWorldMatrix(true); - this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld); - } else { - this.matrix.copy(this.light.matrixWorld); - } - this.matrixWorld.copy(this.light.matrixWorld); - const coneLength = this.light.distance ? this.light.distance : 1e3; - const coneWidth = coneLength * Math.tan(this.light.angle); - this.cone.scale.set(coneWidth, coneWidth, coneLength); - _vector$3.setFromMatrixPosition(this.light.target.matrixWorld); - this.cone.lookAt(_vector$3); - if (this.color !== void 0) { - this.cone.material.color.set(this.color); - } else { - this.cone.material.color.copy(this.light.color); - } - } -} -const _vector$2 = /* @__PURE__ */ new Vector3(); -const _boneMatrix = /* @__PURE__ */ new Matrix4(); -const _matrixWorldInv = /* @__PURE__ */ new Matrix4(); -class SkeletonHelper extends LineSegments { - static { - __name(this, "SkeletonHelper"); - } - constructor(object) { - const bones = getBoneList(object); - const geometry = new BufferGeometry(); - const vertices = []; - const colors = []; - const color1 = new Color(0, 0, 1); - const color2 = new Color(0, 1, 0); - for (let i = 0; i < bones.length; i++) { - const bone = bones[i]; - if (bone.parent && bone.parent.isBone) { - vertices.push(0, 0, 0); - vertices.push(0, 0, 0); - colors.push(color1.r, color1.g, color1.b); - colors.push(color2.r, color2.g, color2.b); - } - } - geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - geometry.setAttribute("color", new Float32BufferAttribute(colors, 3)); - const material = new LineBasicMaterial({ vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true }); - super(geometry, material); - this.isSkeletonHelper = true; - this.type = "SkeletonHelper"; - this.root = object; - this.bones = bones; - this.matrix = object.matrixWorld; - this.matrixAutoUpdate = false; - } - updateMatrixWorld(force) { - const bones = this.bones; - const geometry = this.geometry; - const position = geometry.getAttribute("position"); - _matrixWorldInv.copy(this.root.matrixWorld).invert(); - for (let i = 0, j = 0; i < bones.length; i++) { - const bone = bones[i]; - if (bone.parent && bone.parent.isBone) { - _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.matrixWorld); - _vector$2.setFromMatrixPosition(_boneMatrix); - position.setXYZ(j, _vector$2.x, _vector$2.y, _vector$2.z); - _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.parent.matrixWorld); - _vector$2.setFromMatrixPosition(_boneMatrix); - position.setXYZ(j + 1, _vector$2.x, _vector$2.y, _vector$2.z); - j += 2; - } - } - geometry.getAttribute("position").needsUpdate = true; - super.updateMatrixWorld(force); - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -} -function getBoneList(object) { - const boneList = []; - if (object.isBone === true) { - boneList.push(object); - } - for (let i = 0; i < object.children.length; i++) { - boneList.push.apply(boneList, getBoneList(object.children[i])); - } - return boneList; -} -__name(getBoneList, "getBoneList"); -class PointLightHelper extends Mesh { - static { - __name(this, "PointLightHelper"); - } - constructor(light, sphereSize, color) { - const geometry = new SphereGeometry(sphereSize, 4, 2); - const material = new MeshBasicMaterial({ wireframe: true, fog: false, toneMapped: false }); - super(geometry, material); - this.light = light; - this.color = color; - this.type = "PointLightHelper"; - this.matrix = this.light.matrixWorld; - this.matrixAutoUpdate = false; - this.update(); - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } - update() { - this.light.updateWorldMatrix(true, false); - if (this.color !== void 0) { - this.material.color.set(this.color); - } else { - this.material.color.copy(this.light.color); - } - } -} -const _vector$1 = /* @__PURE__ */ new Vector3(); -const _color1 = /* @__PURE__ */ new Color(); -const _color2 = /* @__PURE__ */ new Color(); -class HemisphereLightHelper extends Object3D { - static { - __name(this, "HemisphereLightHelper"); - } - constructor(light, size, color) { - super(); - this.light = light; - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - this.color = color; - this.type = "HemisphereLightHelper"; - const geometry = new OctahedronGeometry(size); - geometry.rotateY(Math.PI * 0.5); - this.material = new MeshBasicMaterial({ wireframe: true, fog: false, toneMapped: false }); - if (this.color === void 0) this.material.vertexColors = true; - const position = geometry.getAttribute("position"); - const colors = new Float32Array(position.count * 3); - geometry.setAttribute("color", new BufferAttribute(colors, 3)); - this.add(new Mesh(geometry, this.material)); - this.update(); - } - dispose() { - this.children[0].geometry.dispose(); - this.children[0].material.dispose(); - } - update() { - const mesh = this.children[0]; - if (this.color !== void 0) { - this.material.color.set(this.color); - } else { - const colors = mesh.geometry.getAttribute("color"); - _color1.copy(this.light.color); - _color2.copy(this.light.groundColor); - for (let i = 0, l = colors.count; i < l; i++) { - const color = i < l / 2 ? _color1 : _color2; - colors.setXYZ(i, color.r, color.g, color.b); - } - colors.needsUpdate = true; - } - this.light.updateWorldMatrix(true, false); - mesh.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate()); - } -} -class GridHelper extends LineSegments { - static { - __name(this, "GridHelper"); - } - constructor(size = 10, divisions = 10, color1 = 4473924, color2 = 8947848) { - color1 = new Color(color1); - color2 = new Color(color2); - const center = divisions / 2; - const step = size / divisions; - const halfSize = size / 2; - const vertices = [], colors = []; - for (let i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step) { - vertices.push(-halfSize, 0, k, halfSize, 0, k); - vertices.push(k, 0, -halfSize, k, 0, halfSize); - const color = i === center ? color1 : color2; - color.toArray(colors, j); - j += 3; - color.toArray(colors, j); - j += 3; - color.toArray(colors, j); - j += 3; - color.toArray(colors, j); - j += 3; - } - const geometry = new BufferGeometry(); - geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - geometry.setAttribute("color", new Float32BufferAttribute(colors, 3)); - const material = new LineBasicMaterial({ vertexColors: true, toneMapped: false }); - super(geometry, material); - this.type = "GridHelper"; - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -} -class PolarGridHelper extends LineSegments { - static { - __name(this, "PolarGridHelper"); - } - constructor(radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 4473924, color2 = 8947848) { - color1 = new Color(color1); - color2 = new Color(color2); - const vertices = []; - const colors = []; - if (sectors > 1) { - for (let i = 0; i < sectors; i++) { - const v = i / sectors * (Math.PI * 2); - const x = Math.sin(v) * radius; - const z = Math.cos(v) * radius; - vertices.push(0, 0, 0); - vertices.push(x, 0, z); - const color = i & 1 ? color1 : color2; - colors.push(color.r, color.g, color.b); - colors.push(color.r, color.g, color.b); - } - } - for (let i = 0; i < rings; i++) { - const color = i & 1 ? color1 : color2; - const r = radius - radius / rings * i; - for (let j = 0; j < divisions; j++) { - let v = j / divisions * (Math.PI * 2); - let x = Math.sin(v) * r; - let z = Math.cos(v) * r; - vertices.push(x, 0, z); - colors.push(color.r, color.g, color.b); - v = (j + 1) / divisions * (Math.PI * 2); - x = Math.sin(v) * r; - z = Math.cos(v) * r; - vertices.push(x, 0, z); - colors.push(color.r, color.g, color.b); - } - } - const geometry = new BufferGeometry(); - geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - geometry.setAttribute("color", new Float32BufferAttribute(colors, 3)); - const material = new LineBasicMaterial({ vertexColors: true, toneMapped: false }); - super(geometry, material); - this.type = "PolarGridHelper"; - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -} -const _v1 = /* @__PURE__ */ new Vector3(); -const _v2 = /* @__PURE__ */ new Vector3(); -const _v3 = /* @__PURE__ */ new Vector3(); -class DirectionalLightHelper extends Object3D { - static { - __name(this, "DirectionalLightHelper"); - } - constructor(light, size, color) { - super(); - this.light = light; - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - this.color = color; - this.type = "DirectionalLightHelper"; - if (size === void 0) size = 1; - let geometry = new BufferGeometry(); - geometry.setAttribute("position", new Float32BufferAttribute([ - -size, - size, - 0, - size, - size, - 0, - size, - -size, - 0, - -size, - -size, - 0, - -size, - size, - 0 - ], 3)); - const material = new LineBasicMaterial({ fog: false, toneMapped: false }); - this.lightPlane = new Line(geometry, material); - this.add(this.lightPlane); - geometry = new BufferGeometry(); - geometry.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 0, 0, 1], 3)); - this.targetLine = new Line(geometry, material); - this.add(this.targetLine); - this.update(); - } - dispose() { - this.lightPlane.geometry.dispose(); - this.lightPlane.material.dispose(); - this.targetLine.geometry.dispose(); - this.targetLine.material.dispose(); - } - update() { - this.light.updateWorldMatrix(true, false); - this.light.target.updateWorldMatrix(true, false); - _v1.setFromMatrixPosition(this.light.matrixWorld); - _v2.setFromMatrixPosition(this.light.target.matrixWorld); - _v3.subVectors(_v2, _v1); - this.lightPlane.lookAt(_v2); - if (this.color !== void 0) { - this.lightPlane.material.color.set(this.color); - this.targetLine.material.color.set(this.color); - } else { - this.lightPlane.material.color.copy(this.light.color); - this.targetLine.material.color.copy(this.light.color); - } - this.targetLine.lookAt(_v2); - this.targetLine.scale.z = _v3.length(); - } -} -const _vector = /* @__PURE__ */ new Vector3(); -const _camera = /* @__PURE__ */ new Camera(); -class CameraHelper extends LineSegments { - static { - __name(this, "CameraHelper"); - } - constructor(camera) { - const geometry = new BufferGeometry(); - const material = new LineBasicMaterial({ color: 16777215, vertexColors: true, toneMapped: false }); - const vertices = []; - const colors = []; - const pointMap = {}; - addLine("n1", "n2"); - addLine("n2", "n4"); - addLine("n4", "n3"); - addLine("n3", "n1"); - addLine("f1", "f2"); - addLine("f2", "f4"); - addLine("f4", "f3"); - addLine("f3", "f1"); - addLine("n1", "f1"); - addLine("n2", "f2"); - addLine("n3", "f3"); - addLine("n4", "f4"); - addLine("p", "n1"); - addLine("p", "n2"); - addLine("p", "n3"); - addLine("p", "n4"); - addLine("u1", "u2"); - addLine("u2", "u3"); - addLine("u3", "u1"); - addLine("c", "t"); - addLine("p", "c"); - addLine("cn1", "cn2"); - addLine("cn3", "cn4"); - addLine("cf1", "cf2"); - addLine("cf3", "cf4"); - function addLine(a, b) { - addPoint(a); - addPoint(b); - } - __name(addLine, "addLine"); - function addPoint(id2) { - vertices.push(0, 0, 0); - colors.push(0, 0, 0); - if (pointMap[id2] === void 0) { - pointMap[id2] = []; - } - pointMap[id2].push(vertices.length / 3 - 1); - } - __name(addPoint, "addPoint"); - geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - geometry.setAttribute("color", new Float32BufferAttribute(colors, 3)); - super(geometry, material); - this.type = "CameraHelper"; - this.camera = camera; - if (this.camera.updateProjectionMatrix) this.camera.updateProjectionMatrix(); - this.matrix = camera.matrixWorld; - this.matrixAutoUpdate = false; - this.pointMap = pointMap; - this.update(); - const colorFrustum = new Color(16755200); - const colorCone = new Color(16711680); - const colorUp = new Color(43775); - const colorTarget = new Color(16777215); - const colorCross = new Color(3355443); - this.setColors(colorFrustum, colorCone, colorUp, colorTarget, colorCross); - } - setColors(frustum, cone, up, target, cross) { - const geometry = this.geometry; - const colorAttribute = geometry.getAttribute("color"); - colorAttribute.setXYZ(0, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(1, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(2, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(3, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(4, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(5, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(6, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(7, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(8, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(9, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(10, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(11, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(12, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(13, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(14, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(15, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(16, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(17, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(18, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(19, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(20, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(21, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(22, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(23, frustum.r, frustum.g, frustum.b); - colorAttribute.setXYZ(24, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(25, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(26, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(27, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(28, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(29, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(30, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(31, cone.r, cone.g, cone.b); - colorAttribute.setXYZ(32, up.r, up.g, up.b); - colorAttribute.setXYZ(33, up.r, up.g, up.b); - colorAttribute.setXYZ(34, up.r, up.g, up.b); - colorAttribute.setXYZ(35, up.r, up.g, up.b); - colorAttribute.setXYZ(36, up.r, up.g, up.b); - colorAttribute.setXYZ(37, up.r, up.g, up.b); - colorAttribute.setXYZ(38, target.r, target.g, target.b); - colorAttribute.setXYZ(39, target.r, target.g, target.b); - colorAttribute.setXYZ(40, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(41, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(42, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(43, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(44, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(45, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(46, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(47, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(48, cross.r, cross.g, cross.b); - colorAttribute.setXYZ(49, cross.r, cross.g, cross.b); - colorAttribute.needsUpdate = true; - } - update() { - const geometry = this.geometry; - const pointMap = this.pointMap; - const w = 1, h = 1; - _camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse); - setPoint("c", pointMap, geometry, _camera, 0, 0, -1); - setPoint("t", pointMap, geometry, _camera, 0, 0, 1); - setPoint("n1", pointMap, geometry, _camera, -w, -h, -1); - setPoint("n2", pointMap, geometry, _camera, w, -h, -1); - setPoint("n3", pointMap, geometry, _camera, -w, h, -1); - setPoint("n4", pointMap, geometry, _camera, w, h, -1); - setPoint("f1", pointMap, geometry, _camera, -w, -h, 1); - setPoint("f2", pointMap, geometry, _camera, w, -h, 1); - setPoint("f3", pointMap, geometry, _camera, -w, h, 1); - setPoint("f4", pointMap, geometry, _camera, w, h, 1); - setPoint("u1", pointMap, geometry, _camera, w * 0.7, h * 1.1, -1); - setPoint("u2", pointMap, geometry, _camera, -w * 0.7, h * 1.1, -1); - setPoint("u3", pointMap, geometry, _camera, 0, h * 2, -1); - setPoint("cf1", pointMap, geometry, _camera, -w, 0, 1); - setPoint("cf2", pointMap, geometry, _camera, w, 0, 1); - setPoint("cf3", pointMap, geometry, _camera, 0, -h, 1); - setPoint("cf4", pointMap, geometry, _camera, 0, h, 1); - setPoint("cn1", pointMap, geometry, _camera, -w, 0, -1); - setPoint("cn2", pointMap, geometry, _camera, w, 0, -1); - setPoint("cn3", pointMap, geometry, _camera, 0, -h, -1); - setPoint("cn4", pointMap, geometry, _camera, 0, h, -1); - geometry.getAttribute("position").needsUpdate = true; - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -} -function setPoint(point, pointMap, geometry, camera, x, y, z) { - _vector.set(x, y, z).unproject(camera); - const points = pointMap[point]; - if (points !== void 0) { - const position = geometry.getAttribute("position"); - for (let i = 0, l = points.length; i < l; i++) { - position.setXYZ(points[i], _vector.x, _vector.y, _vector.z); - } - } -} -__name(setPoint, "setPoint"); -const _box = /* @__PURE__ */ new Box3(); -class BoxHelper extends LineSegments { - static { - __name(this, "BoxHelper"); - } - constructor(object, color = 16776960) { - const indices = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]); - const positions = new Float32Array(8 * 3); - const geometry = new BufferGeometry(); - geometry.setIndex(new BufferAttribute(indices, 1)); - geometry.setAttribute("position", new BufferAttribute(positions, 3)); - super(geometry, new LineBasicMaterial({ color, toneMapped: false })); - this.object = object; - this.type = "BoxHelper"; - this.matrixAutoUpdate = false; - this.update(); - } - update(object) { - if (object !== void 0) { - console.warn("THREE.BoxHelper: .update() has no longer arguments."); - } - if (this.object !== void 0) { - _box.setFromObject(this.object); - } - if (_box.isEmpty()) return; - const min = _box.min; - const max2 = _box.max; - const position = this.geometry.attributes.position; - const array = position.array; - array[0] = max2.x; - array[1] = max2.y; - array[2] = max2.z; - array[3] = min.x; - array[4] = max2.y; - array[5] = max2.z; - array[6] = min.x; - array[7] = min.y; - array[8] = max2.z; - array[9] = max2.x; - array[10] = min.y; - array[11] = max2.z; - array[12] = max2.x; - array[13] = max2.y; - array[14] = min.z; - array[15] = min.x; - array[16] = max2.y; - array[17] = min.z; - array[18] = min.x; - array[19] = min.y; - array[20] = min.z; - array[21] = max2.x; - array[22] = min.y; - array[23] = min.z; - position.needsUpdate = true; - this.geometry.computeBoundingSphere(); - } - setFromObject(object) { - this.object = object; - this.update(); - return this; - } - copy(source, recursive) { - super.copy(source, recursive); - this.object = source.object; - return this; - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -} -class Box3Helper extends LineSegments { - static { - __name(this, "Box3Helper"); - } - constructor(box, color = 16776960) { - const indices = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]); - const positions = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1]; - const geometry = new BufferGeometry(); - geometry.setIndex(new BufferAttribute(indices, 1)); - geometry.setAttribute("position", new Float32BufferAttribute(positions, 3)); - super(geometry, new LineBasicMaterial({ color, toneMapped: false })); - this.box = box; - this.type = "Box3Helper"; - this.geometry.computeBoundingSphere(); - } - updateMatrixWorld(force) { - const box = this.box; - if (box.isEmpty()) return; - box.getCenter(this.position); - box.getSize(this.scale); - this.scale.multiplyScalar(0.5); - super.updateMatrixWorld(force); - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -} -class PlaneHelper extends Line { - static { - __name(this, "PlaneHelper"); - } - constructor(plane, size = 1, hex = 16776960) { - const color = hex; - const positions = [1, -1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0]; - const geometry = new BufferGeometry(); - geometry.setAttribute("position", new Float32BufferAttribute(positions, 3)); - geometry.computeBoundingSphere(); - super(geometry, new LineBasicMaterial({ color, toneMapped: false })); - this.type = "PlaneHelper"; - this.plane = plane; - this.size = size; - const positions2 = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0]; - const geometry2 = new BufferGeometry(); - geometry2.setAttribute("position", new Float32BufferAttribute(positions2, 3)); - geometry2.computeBoundingSphere(); - this.add(new Mesh(geometry2, new MeshBasicMaterial({ color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false }))); - } - updateMatrixWorld(force) { - this.position.set(0, 0, 0); - this.scale.set(0.5 * this.size, 0.5 * this.size, 1); - this.lookAt(this.plane.normal); - this.translateZ(-this.plane.constant); - super.updateMatrixWorld(force); - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - this.children[0].geometry.dispose(); - this.children[0].material.dispose(); - } -} -const _axis = /* @__PURE__ */ new Vector3(); -let _lineGeometry, _coneGeometry; -class ArrowHelper extends Object3D { - static { - __name(this, "ArrowHelper"); - } - // dir is assumed to be normalized - constructor(dir = new Vector3(0, 0, 1), origin = new Vector3(0, 0, 0), length = 1, color = 16776960, headLength = length * 0.2, headWidth = headLength * 0.2) { - super(); - this.type = "ArrowHelper"; - if (_lineGeometry === void 0) { - _lineGeometry = new BufferGeometry(); - _lineGeometry.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 0, 1, 0], 3)); - _coneGeometry = new CylinderGeometry(0, 0.5, 1, 5, 1); - _coneGeometry.translate(0, -0.5, 0); - } - this.position.copy(origin); - this.line = new Line(_lineGeometry, new LineBasicMaterial({ color, toneMapped: false })); - this.line.matrixAutoUpdate = false; - this.add(this.line); - this.cone = new Mesh(_coneGeometry, new MeshBasicMaterial({ color, toneMapped: false })); - this.cone.matrixAutoUpdate = false; - this.add(this.cone); - this.setDirection(dir); - this.setLength(length, headLength, headWidth); - } - setDirection(dir) { - if (dir.y > 0.99999) { - this.quaternion.set(0, 0, 0, 1); - } else if (dir.y < -0.99999) { - this.quaternion.set(1, 0, 0, 0); - } else { - _axis.set(dir.z, 0, -dir.x).normalize(); - const radians = Math.acos(dir.y); - this.quaternion.setFromAxisAngle(_axis, radians); - } - } - setLength(length, headLength = length * 0.2, headWidth = headLength * 0.2) { - this.line.scale.set(1, Math.max(1e-4, length - headLength), 1); - this.line.updateMatrix(); - this.cone.scale.set(headWidth, headLength, headWidth); - this.cone.position.y = length; - this.cone.updateMatrix(); - } - setColor(color) { - this.line.material.color.set(color); - this.cone.material.color.set(color); - } - copy(source) { - super.copy(source, false); - this.line.copy(source.line); - this.cone.copy(source.cone); - return this; - } - dispose() { - this.line.geometry.dispose(); - this.line.material.dispose(); - this.cone.geometry.dispose(); - this.cone.material.dispose(); - } -} -class AxesHelper extends LineSegments { - static { - __name(this, "AxesHelper"); - } - constructor(size = 1) { - const vertices = [ - 0, - 0, - 0, - size, - 0, - 0, - 0, - 0, - 0, - 0, - size, - 0, - 0, - 0, - 0, - 0, - 0, - size - ]; - const colors = [ - 1, - 0, - 0, - 1, - 0.6, - 0, - 0, - 1, - 0, - 0.6, - 1, - 0, - 0, - 0, - 1, - 0, - 0.6, - 1 - ]; - const geometry = new BufferGeometry(); - geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - geometry.setAttribute("color", new Float32BufferAttribute(colors, 3)); - const material = new LineBasicMaterial({ vertexColors: true, toneMapped: false }); - super(geometry, material); - this.type = "AxesHelper"; - } - setColors(xAxisColor, yAxisColor, zAxisColor) { - const color = new Color(); - const array = this.geometry.attributes.color.array; - color.set(xAxisColor); - color.toArray(array, 0); - color.toArray(array, 3); - color.set(yAxisColor); - color.toArray(array, 6); - color.toArray(array, 9); - color.set(zAxisColor); - color.toArray(array, 12); - color.toArray(array, 15); - this.geometry.attributes.color.needsUpdate = true; - return this; - } - dispose() { - this.geometry.dispose(); - this.material.dispose(); - } -} -class ShapePath { - static { - __name(this, "ShapePath"); - } - constructor() { - this.type = "ShapePath"; - this.color = new Color(); - this.subPaths = []; - this.currentPath = null; - } - moveTo(x, y) { - this.currentPath = new Path(); - this.subPaths.push(this.currentPath); - this.currentPath.moveTo(x, y); - return this; - } - lineTo(x, y) { - this.currentPath.lineTo(x, y); - return this; - } - quadraticCurveTo(aCPx, aCPy, aX, aY) { - this.currentPath.quadraticCurveTo(aCPx, aCPy, aX, aY); - return this; - } - bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { - this.currentPath.bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY); - return this; - } - splineThru(pts) { - this.currentPath.splineThru(pts); - return this; - } - toShapes(isCCW) { - function toShapesNoHoles(inSubpaths) { - const shapes2 = []; - for (let i = 0, l = inSubpaths.length; i < l; i++) { - const tmpPath2 = inSubpaths[i]; - const tmpShape2 = new Shape(); - tmpShape2.curves = tmpPath2.curves; - shapes2.push(tmpShape2); - } - return shapes2; - } - __name(toShapesNoHoles, "toShapesNoHoles"); - function isPointInsidePolygon(inPt, inPolygon) { - const polyLen = inPolygon.length; - let inside = false; - for (let p = polyLen - 1, q = 0; q < polyLen; p = q++) { - let edgeLowPt = inPolygon[p]; - let edgeHighPt = inPolygon[q]; - let edgeDx = edgeHighPt.x - edgeLowPt.x; - let edgeDy = edgeHighPt.y - edgeLowPt.y; - if (Math.abs(edgeDy) > Number.EPSILON) { - if (edgeDy < 0) { - edgeLowPt = inPolygon[q]; - edgeDx = -edgeDx; - edgeHighPt = inPolygon[p]; - edgeDy = -edgeDy; - } - if (inPt.y < edgeLowPt.y || inPt.y > edgeHighPt.y) continue; - if (inPt.y === edgeLowPt.y) { - if (inPt.x === edgeLowPt.x) return true; - } else { - const perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y); - if (perpEdge === 0) return true; - if (perpEdge < 0) continue; - inside = !inside; - } - } else { - if (inPt.y !== edgeLowPt.y) continue; - if (edgeHighPt.x <= inPt.x && inPt.x <= edgeLowPt.x || edgeLowPt.x <= inPt.x && inPt.x <= edgeHighPt.x) return true; - } - } - return inside; - } - __name(isPointInsidePolygon, "isPointInsidePolygon"); - const isClockWise = ShapeUtils.isClockWise; - const subPaths = this.subPaths; - if (subPaths.length === 0) return []; - let solid, tmpPath, tmpShape; - const shapes = []; - if (subPaths.length === 1) { - tmpPath = subPaths[0]; - tmpShape = new Shape(); - tmpShape.curves = tmpPath.curves; - shapes.push(tmpShape); - return shapes; - } - let holesFirst = !isClockWise(subPaths[0].getPoints()); - holesFirst = isCCW ? !holesFirst : holesFirst; - const betterShapeHoles = []; - const newShapes = []; - let newShapeHoles = []; - let mainIdx = 0; - let tmpPoints; - newShapes[mainIdx] = void 0; - newShapeHoles[mainIdx] = []; - for (let i = 0, l = subPaths.length; i < l; i++) { - tmpPath = subPaths[i]; - tmpPoints = tmpPath.getPoints(); - solid = isClockWise(tmpPoints); - solid = isCCW ? !solid : solid; - if (solid) { - if (!holesFirst && newShapes[mainIdx]) mainIdx++; - newShapes[mainIdx] = { s: new Shape(), p: tmpPoints }; - newShapes[mainIdx].s.curves = tmpPath.curves; - if (holesFirst) mainIdx++; - newShapeHoles[mainIdx] = []; - } else { - newShapeHoles[mainIdx].push({ h: tmpPath, p: tmpPoints[0] }); - } - } - if (!newShapes[0]) return toShapesNoHoles(subPaths); - if (newShapes.length > 1) { - let ambiguous = false; - let toChange = 0; - for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) { - betterShapeHoles[sIdx] = []; - } - for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) { - const sho = newShapeHoles[sIdx]; - for (let hIdx = 0; hIdx < sho.length; hIdx++) { - const ho = sho[hIdx]; - let hole_unassigned = true; - for (let s2Idx = 0; s2Idx < newShapes.length; s2Idx++) { - if (isPointInsidePolygon(ho.p, newShapes[s2Idx].p)) { - if (sIdx !== s2Idx) toChange++; - if (hole_unassigned) { - hole_unassigned = false; - betterShapeHoles[s2Idx].push(ho); - } else { - ambiguous = true; - } - } - } - if (hole_unassigned) { - betterShapeHoles[sIdx].push(ho); - } - } - } - if (toChange > 0 && ambiguous === false) { - newShapeHoles = betterShapeHoles; - } - } - let tmpHoles; - for (let i = 0, il = newShapes.length; i < il; i++) { - tmpShape = newShapes[i].s; - shapes.push(tmpShape); - tmpHoles = newShapeHoles[i]; - for (let j = 0, jl = tmpHoles.length; j < jl; j++) { - tmpShape.holes.push(tmpHoles[j].h); - } - } - return shapes; - } -} -class Controls extends EventDispatcher { - static { - __name(this, "Controls"); - } - constructor(object, domElement = null) { - super(); - this.object = object; - this.domElement = domElement; - this.enabled = true; - this.state = -1; - this.keys = {}; - this.mouseButtons = { LEFT: null, MIDDLE: null, RIGHT: null }; - this.touches = { ONE: null, TWO: null }; - } - connect() { - } - disconnect() { - } - dispose() { - } - update() { - } -} -class WebGLMultipleRenderTargets extends WebGLRenderTarget { - static { - __name(this, "WebGLMultipleRenderTargets"); - } - // @deprecated, r162 - constructor(width = 1, height = 1, count = 1, options = {}) { - console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'); - super(width, height, { ...options, count }); - this.isWebGLMultipleRenderTargets = true; - } - get texture() { - return this.textures; - } -} -if (typeof __THREE_DEVTOOLS__ !== "undefined") { - __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: { - revision: REVISION - } })); -} -if (typeof window !== "undefined") { - if (window.__THREE__) { - console.warn("WARNING: Multiple instances of Three.js being imported."); - } else { - window.__THREE__ = REVISION; - } -} -const _changeEvent = { type: "change" }; -const _startEvent = { type: "start" }; -const _endEvent = { type: "end" }; -const _ray = new Ray(); -const _plane = new Plane(); -const _TILT_LIMIT = Math.cos(70 * MathUtils.DEG2RAD); -const _v = new Vector3(); -const _twoPI = 2 * Math.PI; -const _STATE = { - NONE: -1, - ROTATE: 0, - DOLLY: 1, - PAN: 2, - TOUCH_ROTATE: 3, - TOUCH_PAN: 4, - TOUCH_DOLLY_PAN: 5, - TOUCH_DOLLY_ROTATE: 6 -}; -const _EPS = 1e-6; -class OrbitControls extends Controls { - static { - __name(this, "OrbitControls"); - } - constructor(object, domElement = null) { - super(object, domElement); - this.state = _STATE.NONE; - this.enabled = true; - this.target = new Vector3(); - this.cursor = new Vector3(); - this.minDistance = 0; - this.maxDistance = Infinity; - this.minZoom = 0; - this.maxZoom = Infinity; - this.minTargetRadius = 0; - this.maxTargetRadius = Infinity; - this.minPolarAngle = 0; - this.maxPolarAngle = Math.PI; - this.minAzimuthAngle = -Infinity; - this.maxAzimuthAngle = Infinity; - this.enableDamping = false; - this.dampingFactor = 0.05; - this.enableZoom = true; - this.zoomSpeed = 1; - this.enableRotate = true; - this.rotateSpeed = 1; - this.enablePan = true; - this.panSpeed = 1; - this.screenSpacePanning = true; - this.keyPanSpeed = 7; - this.zoomToCursor = false; - this.autoRotate = false; - this.autoRotateSpeed = 2; - this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }; - this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN }; - this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN }; - this.target0 = this.target.clone(); - this.position0 = this.object.position.clone(); - this.zoom0 = this.object.zoom; - this._domElementKeyEvents = null; - this._lastPosition = new Vector3(); - this._lastQuaternion = new Quaternion(); - this._lastTargetPosition = new Vector3(); - this._quat = new Quaternion().setFromUnitVectors(object.up, new Vector3(0, 1, 0)); - this._quatInverse = this._quat.clone().invert(); - this._spherical = new Spherical(); - this._sphericalDelta = new Spherical(); - this._scale = 1; - this._panOffset = new Vector3(); - this._rotateStart = new Vector2(); - this._rotateEnd = new Vector2(); - this._rotateDelta = new Vector2(); - this._panStart = new Vector2(); - this._panEnd = new Vector2(); - this._panDelta = new Vector2(); - this._dollyStart = new Vector2(); - this._dollyEnd = new Vector2(); - this._dollyDelta = new Vector2(); - this._dollyDirection = new Vector3(); - this._mouse = new Vector2(); - this._performCursorZoom = false; - this._pointers = []; - this._pointerPositions = {}; - this._controlActive = false; - this._onPointerMove = onPointerMove.bind(this); - this._onPointerDown = onPointerDown.bind(this); - this._onPointerUp = onPointerUp.bind(this); - this._onContextMenu = onContextMenu.bind(this); - this._onMouseWheel = onMouseWheel.bind(this); - this._onKeyDown = onKeyDown.bind(this); - this._onTouchStart = onTouchStart.bind(this); - this._onTouchMove = onTouchMove.bind(this); - this._onMouseDown = onMouseDown.bind(this); - this._onMouseMove = onMouseMove.bind(this); - this._interceptControlDown = interceptControlDown.bind(this); - this._interceptControlUp = interceptControlUp.bind(this); - if (this.domElement !== null) { - this.connect(); - } - this.update(); - } - connect() { - this.domElement.addEventListener("pointerdown", this._onPointerDown); - this.domElement.addEventListener("pointercancel", this._onPointerUp); - this.domElement.addEventListener("contextmenu", this._onContextMenu); - this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: false }); - const document2 = this.domElement.getRootNode(); - document2.addEventListener("keydown", this._interceptControlDown, { passive: true, capture: true }); - this.domElement.style.touchAction = "none"; - } - disconnect() { - this.domElement.removeEventListener("pointerdown", this._onPointerDown); - this.domElement.removeEventListener("pointermove", this._onPointerMove); - this.domElement.removeEventListener("pointerup", this._onPointerUp); - this.domElement.removeEventListener("pointercancel", this._onPointerUp); - this.domElement.removeEventListener("wheel", this._onMouseWheel); - this.domElement.removeEventListener("contextmenu", this._onContextMenu); - this.stopListenToKeyEvents(); - const document2 = this.domElement.getRootNode(); - document2.removeEventListener("keydown", this._interceptControlDown, { capture: true }); - this.domElement.style.touchAction = "auto"; - } - dispose() { - this.disconnect(); - } - getPolarAngle() { - return this._spherical.phi; - } - getAzimuthalAngle() { - return this._spherical.theta; - } - getDistance() { - return this.object.position.distanceTo(this.target); - } - listenToKeyEvents(domElement) { - domElement.addEventListener("keydown", this._onKeyDown); - this._domElementKeyEvents = domElement; - } - stopListenToKeyEvents() { - if (this._domElementKeyEvents !== null) { - this._domElementKeyEvents.removeEventListener("keydown", this._onKeyDown); - this._domElementKeyEvents = null; - } - } - saveState() { - this.target0.copy(this.target); - this.position0.copy(this.object.position); - this.zoom0 = this.object.zoom; - } - reset() { - this.target.copy(this.target0); - this.object.position.copy(this.position0); - this.object.zoom = this.zoom0; - this.object.updateProjectionMatrix(); - this.dispatchEvent(_changeEvent); - this.update(); - this.state = _STATE.NONE; - } - update(deltaTime = null) { - const position = this.object.position; - _v.copy(position).sub(this.target); - _v.applyQuaternion(this._quat); - this._spherical.setFromVector3(_v); - if (this.autoRotate && this.state === _STATE.NONE) { - this._rotateLeft(this._getAutoRotationAngle(deltaTime)); - } - if (this.enableDamping) { - this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor; - this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor; - } else { - this._spherical.theta += this._sphericalDelta.theta; - this._spherical.phi += this._sphericalDelta.phi; - } - let min = this.minAzimuthAngle; - let max2 = this.maxAzimuthAngle; - if (isFinite(min) && isFinite(max2)) { - if (min < -Math.PI) min += _twoPI; - else if (min > Math.PI) min -= _twoPI; - if (max2 < -Math.PI) max2 += _twoPI; - else if (max2 > Math.PI) max2 -= _twoPI; - if (min <= max2) { - this._spherical.theta = Math.max(min, Math.min(max2, this._spherical.theta)); - } else { - this._spherical.theta = this._spherical.theta > (min + max2) / 2 ? Math.max(min, this._spherical.theta) : Math.min(max2, this._spherical.theta); - } - } - this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)); - this._spherical.makeSafe(); - if (this.enableDamping === true) { - this.target.addScaledVector(this._panOffset, this.dampingFactor); - } else { - this.target.add(this._panOffset); - } - this.target.sub(this.cursor); - this.target.clampLength(this.minTargetRadius, this.maxTargetRadius); - this.target.add(this.cursor); - let zoomChanged = false; - if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera) { - this._spherical.radius = this._clampDistance(this._spherical.radius); - } else { - const prevRadius = this._spherical.radius; - this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale); - zoomChanged = prevRadius != this._spherical.radius; - } - _v.setFromSpherical(this._spherical); - _v.applyQuaternion(this._quatInverse); - position.copy(this.target).add(_v); - this.object.lookAt(this.target); - if (this.enableDamping === true) { - this._sphericalDelta.theta *= 1 - this.dampingFactor; - this._sphericalDelta.phi *= 1 - this.dampingFactor; - this._panOffset.multiplyScalar(1 - this.dampingFactor); - } else { - this._sphericalDelta.set(0, 0, 0); - this._panOffset.set(0, 0, 0); - } - if (this.zoomToCursor && this._performCursorZoom) { - let newRadius = null; - if (this.object.isPerspectiveCamera) { - const prevRadius = _v.length(); - newRadius = this._clampDistance(prevRadius * this._scale); - const radiusDelta = prevRadius - newRadius; - this.object.position.addScaledVector(this._dollyDirection, radiusDelta); - this.object.updateMatrixWorld(); - zoomChanged = !!radiusDelta; - } else if (this.object.isOrthographicCamera) { - const mouseBefore = new Vector3(this._mouse.x, this._mouse.y, 0); - mouseBefore.unproject(this.object); - const prevZoom = this.object.zoom; - this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)); - this.object.updateProjectionMatrix(); - zoomChanged = prevZoom !== this.object.zoom; - const mouseAfter = new Vector3(this._mouse.x, this._mouse.y, 0); - mouseAfter.unproject(this.object); - this.object.position.sub(mouseAfter).add(mouseBefore); - this.object.updateMatrixWorld(); - newRadius = _v.length(); - } else { - console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."); - this.zoomToCursor = false; - } - if (newRadius !== null) { - if (this.screenSpacePanning) { - this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(newRadius).add(this.object.position); - } else { - _ray.origin.copy(this.object.position); - _ray.direction.set(0, 0, -1).transformDirection(this.object.matrix); - if (Math.abs(this.object.up.dot(_ray.direction)) < _TILT_LIMIT) { - this.object.lookAt(this.target); - } else { - _plane.setFromNormalAndCoplanarPoint(this.object.up, this.target); - _ray.intersectPlane(_plane, this.target); - } - } - } - } else if (this.object.isOrthographicCamera) { - const prevZoom = this.object.zoom; - this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)); - if (prevZoom !== this.object.zoom) { - this.object.updateProjectionMatrix(); - zoomChanged = true; - } - } - this._scale = 1; - this._performCursorZoom = false; - if (zoomChanged || this._lastPosition.distanceToSquared(this.object.position) > _EPS || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > _EPS || this._lastTargetPosition.distanceToSquared(this.target) > _EPS) { - this.dispatchEvent(_changeEvent); - this._lastPosition.copy(this.object.position); - this._lastQuaternion.copy(this.object.quaternion); - this._lastTargetPosition.copy(this.target); - return true; - } - return false; - } - _getAutoRotationAngle(deltaTime) { - if (deltaTime !== null) { - return _twoPI / 60 * this.autoRotateSpeed * deltaTime; - } else { - return _twoPI / 60 / 60 * this.autoRotateSpeed; - } - } - _getZoomScale(delta) { - const normalizedDelta = Math.abs(delta * 0.01); - return Math.pow(0.95, this.zoomSpeed * normalizedDelta); - } - _rotateLeft(angle) { - this._sphericalDelta.theta -= angle; - } - _rotateUp(angle) { - this._sphericalDelta.phi -= angle; - } - _panLeft(distance, objectMatrix) { - _v.setFromMatrixColumn(objectMatrix, 0); - _v.multiplyScalar(-distance); - this._panOffset.add(_v); - } - _panUp(distance, objectMatrix) { - if (this.screenSpacePanning === true) { - _v.setFromMatrixColumn(objectMatrix, 1); - } else { - _v.setFromMatrixColumn(objectMatrix, 0); - _v.crossVectors(this.object.up, _v); - } - _v.multiplyScalar(distance); - this._panOffset.add(_v); - } - // deltaX and deltaY are in pixels; right and down are positive - _pan(deltaX, deltaY) { - const element = this.domElement; - if (this.object.isPerspectiveCamera) { - const position = this.object.position; - _v.copy(position).sub(this.target); - let targetDistance = _v.length(); - targetDistance *= Math.tan(this.object.fov / 2 * Math.PI / 180); - this._panLeft(2 * deltaX * targetDistance / element.clientHeight, this.object.matrix); - this._panUp(2 * deltaY * targetDistance / element.clientHeight, this.object.matrix); - } else if (this.object.isOrthographicCamera) { - this._panLeft(deltaX * (this.object.right - this.object.left) / this.object.zoom / element.clientWidth, this.object.matrix); - this._panUp(deltaY * (this.object.top - this.object.bottom) / this.object.zoom / element.clientHeight, this.object.matrix); - } else { - console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."); - this.enablePan = false; - } - } - _dollyOut(dollyScale) { - if (this.object.isPerspectiveCamera || this.object.isOrthographicCamera) { - this._scale /= dollyScale; - } else { - console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."); - this.enableZoom = false; - } - } - _dollyIn(dollyScale) { - if (this.object.isPerspectiveCamera || this.object.isOrthographicCamera) { - this._scale *= dollyScale; - } else { - console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."); - this.enableZoom = false; - } - } - _updateZoomParameters(x, y) { - if (!this.zoomToCursor) { - return; - } - this._performCursorZoom = true; - const rect = this.domElement.getBoundingClientRect(); - const dx = x - rect.left; - const dy = y - rect.top; - const w = rect.width; - const h = rect.height; - this._mouse.x = dx / w * 2 - 1; - this._mouse.y = -(dy / h) * 2 + 1; - this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize(); - } - _clampDistance(dist) { - return Math.max(this.minDistance, Math.min(this.maxDistance, dist)); - } - // - // event callbacks - update the object state - // - _handleMouseDownRotate(event) { - this._rotateStart.set(event.clientX, event.clientY); - } - _handleMouseDownDolly(event) { - this._updateZoomParameters(event.clientX, event.clientX); - this._dollyStart.set(event.clientX, event.clientY); - } - _handleMouseDownPan(event) { - this._panStart.set(event.clientX, event.clientY); - } - _handleMouseMoveRotate(event) { - this._rotateEnd.set(event.clientX, event.clientY); - this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed); - const element = this.domElement; - this._rotateLeft(_twoPI * this._rotateDelta.x / element.clientHeight); - this._rotateUp(_twoPI * this._rotateDelta.y / element.clientHeight); - this._rotateStart.copy(this._rotateEnd); - this.update(); - } - _handleMouseMoveDolly(event) { - this._dollyEnd.set(event.clientX, event.clientY); - this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart); - if (this._dollyDelta.y > 0) { - this._dollyOut(this._getZoomScale(this._dollyDelta.y)); - } else if (this._dollyDelta.y < 0) { - this._dollyIn(this._getZoomScale(this._dollyDelta.y)); - } - this._dollyStart.copy(this._dollyEnd); - this.update(); - } - _handleMouseMovePan(event) { - this._panEnd.set(event.clientX, event.clientY); - this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed); - this._pan(this._panDelta.x, this._panDelta.y); - this._panStart.copy(this._panEnd); - this.update(); - } - _handleMouseWheel(event) { - this._updateZoomParameters(event.clientX, event.clientY); - if (event.deltaY < 0) { - this._dollyIn(this._getZoomScale(event.deltaY)); - } else if (event.deltaY > 0) { - this._dollyOut(this._getZoomScale(event.deltaY)); - } - this.update(); - } - _handleKeyDown(event) { - let needsUpdate = false; - switch (event.code) { - case this.keys.UP: - if (event.ctrlKey || event.metaKey || event.shiftKey) { - this._rotateUp(_twoPI * this.rotateSpeed / this.domElement.clientHeight); - } else { - this._pan(0, this.keyPanSpeed); - } - needsUpdate = true; - break; - case this.keys.BOTTOM: - if (event.ctrlKey || event.metaKey || event.shiftKey) { - this._rotateUp(-_twoPI * this.rotateSpeed / this.domElement.clientHeight); - } else { - this._pan(0, -this.keyPanSpeed); - } - needsUpdate = true; - break; - case this.keys.LEFT: - if (event.ctrlKey || event.metaKey || event.shiftKey) { - this._rotateLeft(_twoPI * this.rotateSpeed / this.domElement.clientHeight); - } else { - this._pan(this.keyPanSpeed, 0); - } - needsUpdate = true; - break; - case this.keys.RIGHT: - if (event.ctrlKey || event.metaKey || event.shiftKey) { - this._rotateLeft(-_twoPI * this.rotateSpeed / this.domElement.clientHeight); - } else { - this._pan(-this.keyPanSpeed, 0); - } - needsUpdate = true; - break; - } - if (needsUpdate) { - event.preventDefault(); - this.update(); - } - } - _handleTouchStartRotate(event) { - if (this._pointers.length === 1) { - this._rotateStart.set(event.pageX, event.pageY); - } else { - const position = this._getSecondPointerPosition(event); - const x = 0.5 * (event.pageX + position.x); - const y = 0.5 * (event.pageY + position.y); - this._rotateStart.set(x, y); - } - } - _handleTouchStartPan(event) { - if (this._pointers.length === 1) { - this._panStart.set(event.pageX, event.pageY); - } else { - const position = this._getSecondPointerPosition(event); - const x = 0.5 * (event.pageX + position.x); - const y = 0.5 * (event.pageY + position.y); - this._panStart.set(x, y); - } - } - _handleTouchStartDolly(event) { - const position = this._getSecondPointerPosition(event); - const dx = event.pageX - position.x; - const dy = event.pageY - position.y; - const distance = Math.sqrt(dx * dx + dy * dy); - this._dollyStart.set(0, distance); - } - _handleTouchStartDollyPan(event) { - if (this.enableZoom) this._handleTouchStartDolly(event); - if (this.enablePan) this._handleTouchStartPan(event); - } - _handleTouchStartDollyRotate(event) { - if (this.enableZoom) this._handleTouchStartDolly(event); - if (this.enableRotate) this._handleTouchStartRotate(event); - } - _handleTouchMoveRotate(event) { - if (this._pointers.length == 1) { - this._rotateEnd.set(event.pageX, event.pageY); - } else { - const position = this._getSecondPointerPosition(event); - const x = 0.5 * (event.pageX + position.x); - const y = 0.5 * (event.pageY + position.y); - this._rotateEnd.set(x, y); - } - this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed); - const element = this.domElement; - this._rotateLeft(_twoPI * this._rotateDelta.x / element.clientHeight); - this._rotateUp(_twoPI * this._rotateDelta.y / element.clientHeight); - this._rotateStart.copy(this._rotateEnd); - } - _handleTouchMovePan(event) { - if (this._pointers.length === 1) { - this._panEnd.set(event.pageX, event.pageY); - } else { - const position = this._getSecondPointerPosition(event); - const x = 0.5 * (event.pageX + position.x); - const y = 0.5 * (event.pageY + position.y); - this._panEnd.set(x, y); - } - this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed); - this._pan(this._panDelta.x, this._panDelta.y); - this._panStart.copy(this._panEnd); - } - _handleTouchMoveDolly(event) { - const position = this._getSecondPointerPosition(event); - const dx = event.pageX - position.x; - const dy = event.pageY - position.y; - const distance = Math.sqrt(dx * dx + dy * dy); - this._dollyEnd.set(0, distance); - this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)); - this._dollyOut(this._dollyDelta.y); - this._dollyStart.copy(this._dollyEnd); - const centerX = (event.pageX + position.x) * 0.5; - const centerY = (event.pageY + position.y) * 0.5; - this._updateZoomParameters(centerX, centerY); - } - _handleTouchMoveDollyPan(event) { - if (this.enableZoom) this._handleTouchMoveDolly(event); - if (this.enablePan) this._handleTouchMovePan(event); - } - _handleTouchMoveDollyRotate(event) { - if (this.enableZoom) this._handleTouchMoveDolly(event); - if (this.enableRotate) this._handleTouchMoveRotate(event); - } - // pointers - _addPointer(event) { - this._pointers.push(event.pointerId); - } - _removePointer(event) { - delete this._pointerPositions[event.pointerId]; - for (let i = 0; i < this._pointers.length; i++) { - if (this._pointers[i] == event.pointerId) { - this._pointers.splice(i, 1); - return; - } - } - } - _isTrackingPointer(event) { - for (let i = 0; i < this._pointers.length; i++) { - if (this._pointers[i] == event.pointerId) return true; - } - return false; - } - _trackPointer(event) { - let position = this._pointerPositions[event.pointerId]; - if (position === void 0) { - position = new Vector2(); - this._pointerPositions[event.pointerId] = position; - } - position.set(event.pageX, event.pageY); - } - _getSecondPointerPosition(event) { - const pointerId = event.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0]; - return this._pointerPositions[pointerId]; - } - // - _customWheelEvent(event) { - const mode = event.deltaMode; - const newEvent = { - clientX: event.clientX, - clientY: event.clientY, - deltaY: event.deltaY - }; - switch (mode) { - case 1: - newEvent.deltaY *= 16; - break; - case 2: - newEvent.deltaY *= 100; - break; - } - if (event.ctrlKey && !this._controlActive) { - newEvent.deltaY *= 10; - } - return newEvent; - } -} -function onPointerDown(event) { - if (this.enabled === false) return; - if (this._pointers.length === 0) { - this.domElement.setPointerCapture(event.pointerId); - this.domElement.addEventListener("pointermove", this._onPointerMove); - this.domElement.addEventListener("pointerup", this._onPointerUp); - } - if (this._isTrackingPointer(event)) return; - this._addPointer(event); - if (event.pointerType === "touch") { - this._onTouchStart(event); - } else { - this._onMouseDown(event); - } -} -__name(onPointerDown, "onPointerDown"); -function onPointerMove(event) { - if (this.enabled === false) return; - if (event.pointerType === "touch") { - this._onTouchMove(event); - } else { - this._onMouseMove(event); - } -} -__name(onPointerMove, "onPointerMove"); -function onPointerUp(event) { - this._removePointer(event); - switch (this._pointers.length) { - case 0: - this.domElement.releasePointerCapture(event.pointerId); - this.domElement.removeEventListener("pointermove", this._onPointerMove); - this.domElement.removeEventListener("pointerup", this._onPointerUp); - this.dispatchEvent(_endEvent); - this.state = _STATE.NONE; - break; - case 1: - const pointerId = this._pointers[0]; - const position = this._pointerPositions[pointerId]; - this._onTouchStart({ pointerId, pageX: position.x, pageY: position.y }); - break; - } -} -__name(onPointerUp, "onPointerUp"); -function onMouseDown(event) { - let mouseAction; - switch (event.button) { - case 0: - mouseAction = this.mouseButtons.LEFT; - break; - case 1: - mouseAction = this.mouseButtons.MIDDLE; - break; - case 2: - mouseAction = this.mouseButtons.RIGHT; - break; - default: - mouseAction = -1; - } - switch (mouseAction) { - case MOUSE.DOLLY: - if (this.enableZoom === false) return; - this._handleMouseDownDolly(event); - this.state = _STATE.DOLLY; - break; - case MOUSE.ROTATE: - if (event.ctrlKey || event.metaKey || event.shiftKey) { - if (this.enablePan === false) return; - this._handleMouseDownPan(event); - this.state = _STATE.PAN; - } else { - if (this.enableRotate === false) return; - this._handleMouseDownRotate(event); - this.state = _STATE.ROTATE; - } - break; - case MOUSE.PAN: - if (event.ctrlKey || event.metaKey || event.shiftKey) { - if (this.enableRotate === false) return; - this._handleMouseDownRotate(event); - this.state = _STATE.ROTATE; - } else { - if (this.enablePan === false) return; - this._handleMouseDownPan(event); - this.state = _STATE.PAN; - } - break; - default: - this.state = _STATE.NONE; - } - if (this.state !== _STATE.NONE) { - this.dispatchEvent(_startEvent); - } -} -__name(onMouseDown, "onMouseDown"); -function onMouseMove(event) { - switch (this.state) { - case _STATE.ROTATE: - if (this.enableRotate === false) return; - this._handleMouseMoveRotate(event); - break; - case _STATE.DOLLY: - if (this.enableZoom === false) return; - this._handleMouseMoveDolly(event); - break; - case _STATE.PAN: - if (this.enablePan === false) return; - this._handleMouseMovePan(event); - break; - } -} -__name(onMouseMove, "onMouseMove"); -function onMouseWheel(event) { - if (this.enabled === false || this.enableZoom === false || this.state !== _STATE.NONE) return; - event.preventDefault(); - this.dispatchEvent(_startEvent); - this._handleMouseWheel(this._customWheelEvent(event)); - this.dispatchEvent(_endEvent); -} -__name(onMouseWheel, "onMouseWheel"); -function onKeyDown(event) { - if (this.enabled === false || this.enablePan === false) return; - this._handleKeyDown(event); -} -__name(onKeyDown, "onKeyDown"); -function onTouchStart(event) { - this._trackPointer(event); - switch (this._pointers.length) { - case 1: - switch (this.touches.ONE) { - case TOUCH.ROTATE: - if (this.enableRotate === false) return; - this._handleTouchStartRotate(event); - this.state = _STATE.TOUCH_ROTATE; - break; - case TOUCH.PAN: - if (this.enablePan === false) return; - this._handleTouchStartPan(event); - this.state = _STATE.TOUCH_PAN; - break; - default: - this.state = _STATE.NONE; - } - break; - case 2: - switch (this.touches.TWO) { - case TOUCH.DOLLY_PAN: - if (this.enableZoom === false && this.enablePan === false) return; - this._handleTouchStartDollyPan(event); - this.state = _STATE.TOUCH_DOLLY_PAN; - break; - case TOUCH.DOLLY_ROTATE: - if (this.enableZoom === false && this.enableRotate === false) return; - this._handleTouchStartDollyRotate(event); - this.state = _STATE.TOUCH_DOLLY_ROTATE; - break; - default: - this.state = _STATE.NONE; - } - break; - default: - this.state = _STATE.NONE; - } - if (this.state !== _STATE.NONE) { - this.dispatchEvent(_startEvent); - } -} -__name(onTouchStart, "onTouchStart"); -function onTouchMove(event) { - this._trackPointer(event); - switch (this.state) { - case _STATE.TOUCH_ROTATE: - if (this.enableRotate === false) return; - this._handleTouchMoveRotate(event); - this.update(); - break; - case _STATE.TOUCH_PAN: - if (this.enablePan === false) return; - this._handleTouchMovePan(event); - this.update(); - break; - case _STATE.TOUCH_DOLLY_PAN: - if (this.enableZoom === false && this.enablePan === false) return; - this._handleTouchMoveDollyPan(event); - this.update(); - break; - case _STATE.TOUCH_DOLLY_ROTATE: - if (this.enableZoom === false && this.enableRotate === false) return; - this._handleTouchMoveDollyRotate(event); - this.update(); - break; - default: - this.state = _STATE.NONE; - } -} -__name(onTouchMove, "onTouchMove"); -function onContextMenu(event) { - if (this.enabled === false) return; - event.preventDefault(); -} -__name(onContextMenu, "onContextMenu"); -function interceptControlDown(event) { - if (event.key === "Control") { - this._controlActive = true; - const document2 = this.domElement.getRootNode(); - document2.addEventListener("keyup", this._interceptControlUp, { passive: true, capture: true }); - } -} -__name(interceptControlDown, "interceptControlDown"); -function interceptControlUp(event) { - if (event.key === "Control") { - this._controlActive = false; - const document2 = this.domElement.getRootNode(); - document2.removeEventListener("keyup", this._interceptControlUp, { passive: true, capture: true }); - } -} -__name(interceptControlUp, "interceptControlUp"); -class ViewHelper extends Object3D { - static { - __name(this, "ViewHelper"); - } - constructor(camera, domElement) { - super(); - this.isViewHelper = true; - this.animating = false; - this.center = new Vector3(); - const color1 = new Color("#ff4466"); - const color2 = new Color("#88ff44"); - const color3 = new Color("#4488ff"); - const color4 = new Color("#000000"); - const options = {}; - const interactiveObjects = []; - const raycaster = new Raycaster(); - const mouse = new Vector2(); - const dummy = new Object3D(); - const orthoCamera = new OrthographicCamera(-2, 2, 2, -2, 0, 4); - orthoCamera.position.set(0, 0, 2); - const geometry = new CylinderGeometry(0.04, 0.04, 0.8, 5).rotateZ(-Math.PI / 2).translate(0.4, 0, 0); - const xAxis = new Mesh(geometry, getAxisMaterial(color1)); - const yAxis = new Mesh(geometry, getAxisMaterial(color2)); - const zAxis = new Mesh(geometry, getAxisMaterial(color3)); - yAxis.rotation.z = Math.PI / 2; - zAxis.rotation.y = -Math.PI / 2; - this.add(xAxis); - this.add(zAxis); - this.add(yAxis); - const spriteMaterial1 = getSpriteMaterial(color1); - const spriteMaterial2 = getSpriteMaterial(color2); - const spriteMaterial3 = getSpriteMaterial(color3); - const spriteMaterial4 = getSpriteMaterial(color4); - const posXAxisHelper = new Sprite(spriteMaterial1); - const posYAxisHelper = new Sprite(spriteMaterial2); - const posZAxisHelper = new Sprite(spriteMaterial3); - const negXAxisHelper = new Sprite(spriteMaterial4); - const negYAxisHelper = new Sprite(spriteMaterial4); - const negZAxisHelper = new Sprite(spriteMaterial4); - posXAxisHelper.position.x = 1; - posYAxisHelper.position.y = 1; - posZAxisHelper.position.z = 1; - negXAxisHelper.position.x = -1; - negYAxisHelper.position.y = -1; - negZAxisHelper.position.z = -1; - negXAxisHelper.material.opacity = 0.2; - negYAxisHelper.material.opacity = 0.2; - negZAxisHelper.material.opacity = 0.2; - posXAxisHelper.userData.type = "posX"; - posYAxisHelper.userData.type = "posY"; - posZAxisHelper.userData.type = "posZ"; - negXAxisHelper.userData.type = "negX"; - negYAxisHelper.userData.type = "negY"; - negZAxisHelper.userData.type = "negZ"; - this.add(posXAxisHelper); - this.add(posYAxisHelper); - this.add(posZAxisHelper); - this.add(negXAxisHelper); - this.add(negYAxisHelper); - this.add(negZAxisHelper); - interactiveObjects.push(posXAxisHelper); - interactiveObjects.push(posYAxisHelper); - interactiveObjects.push(posZAxisHelper); - interactiveObjects.push(negXAxisHelper); - interactiveObjects.push(negYAxisHelper); - interactiveObjects.push(negZAxisHelper); - const point = new Vector3(); - const dim = 128; - const turnRate = 2 * Math.PI; - this.render = function(renderer) { - this.quaternion.copy(camera.quaternion).invert(); - this.updateMatrixWorld(); - point.set(0, 0, 1); - point.applyQuaternion(camera.quaternion); - const x = domElement.offsetWidth - dim; - renderer.clearDepth(); - renderer.getViewport(viewport); - renderer.setViewport(x, 0, dim, dim); - renderer.render(this, orthoCamera); - renderer.setViewport(viewport.x, viewport.y, viewport.z, viewport.w); - }; - const targetPosition = new Vector3(); - const targetQuaternion = new Quaternion(); - const q1 = new Quaternion(); - const q2 = new Quaternion(); - const viewport = new Vector4(); - let radius = 0; - this.handleClick = function(event) { - if (this.animating === true) return false; - const rect = domElement.getBoundingClientRect(); - const offsetX = rect.left + (domElement.offsetWidth - dim); - const offsetY = rect.top + (domElement.offsetHeight - dim); - mouse.x = (event.clientX - offsetX) / (rect.right - offsetX) * 2 - 1; - mouse.y = -((event.clientY - offsetY) / (rect.bottom - offsetY)) * 2 + 1; - raycaster.setFromCamera(mouse, orthoCamera); - const intersects2 = raycaster.intersectObjects(interactiveObjects); - if (intersects2.length > 0) { - const intersection = intersects2[0]; - const object = intersection.object; - prepareAnimationData(object, this.center); - this.animating = true; - return true; - } else { - return false; - } - }; - this.setLabels = function(labelX, labelY, labelZ) { - options.labelX = labelX; - options.labelY = labelY; - options.labelZ = labelZ; - updateLabels(); - }; - this.setLabelStyle = function(font, color, radius2) { - options.font = font; - options.color = color; - options.radius = radius2; - updateLabels(); - }; - this.update = function(delta) { - const step = delta * turnRate; - q1.rotateTowards(q2, step); - camera.position.set(0, 0, 1).applyQuaternion(q1).multiplyScalar(radius).add(this.center); - camera.quaternion.rotateTowards(targetQuaternion, step); - if (q1.angleTo(q2) === 0) { - this.animating = false; - } - }; - this.dispose = function() { - geometry.dispose(); - xAxis.material.dispose(); - yAxis.material.dispose(); - zAxis.material.dispose(); - posXAxisHelper.material.map.dispose(); - posYAxisHelper.material.map.dispose(); - posZAxisHelper.material.map.dispose(); - negXAxisHelper.material.map.dispose(); - negYAxisHelper.material.map.dispose(); - negZAxisHelper.material.map.dispose(); - posXAxisHelper.material.dispose(); - posYAxisHelper.material.dispose(); - posZAxisHelper.material.dispose(); - negXAxisHelper.material.dispose(); - negYAxisHelper.material.dispose(); - negZAxisHelper.material.dispose(); - }; - function prepareAnimationData(object, focusPoint) { - switch (object.userData.type) { - case "posX": - targetPosition.set(1, 0, 0); - targetQuaternion.setFromEuler(new Euler(0, Math.PI * 0.5, 0)); - break; - case "posY": - targetPosition.set(0, 1, 0); - targetQuaternion.setFromEuler(new Euler(-Math.PI * 0.5, 0, 0)); - break; - case "posZ": - targetPosition.set(0, 0, 1); - targetQuaternion.setFromEuler(new Euler()); - break; - case "negX": - targetPosition.set(-1, 0, 0); - targetQuaternion.setFromEuler(new Euler(0, -Math.PI * 0.5, 0)); - break; - case "negY": - targetPosition.set(0, -1, 0); - targetQuaternion.setFromEuler(new Euler(Math.PI * 0.5, 0, 0)); - break; - case "negZ": - targetPosition.set(0, 0, -1); - targetQuaternion.setFromEuler(new Euler(0, Math.PI, 0)); - break; - default: - console.error("ViewHelper: Invalid axis."); - } - radius = camera.position.distanceTo(focusPoint); - targetPosition.multiplyScalar(radius).add(focusPoint); - dummy.position.copy(focusPoint); - dummy.lookAt(camera.position); - q1.copy(dummy.quaternion); - dummy.lookAt(targetPosition); - q2.copy(dummy.quaternion); - } - __name(prepareAnimationData, "prepareAnimationData"); - function getAxisMaterial(color) { - return new MeshBasicMaterial({ color, toneMapped: false }); - } - __name(getAxisMaterial, "getAxisMaterial"); - function getSpriteMaterial(color, text) { - const { font = "24px Arial", color: labelColor = "#000000", radius: radius2 = 14 } = options; - const canvas = document.createElement("canvas"); - canvas.width = 64; - canvas.height = 64; - const context = canvas.getContext("2d"); - context.beginPath(); - context.arc(32, 32, radius2, 0, 2 * Math.PI); - context.closePath(); - context.fillStyle = color.getStyle(); - context.fill(); - if (text) { - context.font = font; - context.textAlign = "center"; - context.fillStyle = labelColor; - context.fillText(text, 32, 41); - } - const texture = new CanvasTexture(canvas); - texture.colorSpace = SRGBColorSpace; - return new SpriteMaterial({ map: texture, toneMapped: false }); - } - __name(getSpriteMaterial, "getSpriteMaterial"); - function updateLabels() { - posXAxisHelper.material.map.dispose(); - posYAxisHelper.material.map.dispose(); - posZAxisHelper.material.map.dispose(); - posXAxisHelper.material.dispose(); - posYAxisHelper.material.dispose(); - posZAxisHelper.material.dispose(); - posXAxisHelper.material = getSpriteMaterial(color1, options.labelX); - posYAxisHelper.material = getSpriteMaterial(color2, options.labelY); - posZAxisHelper.material = getSpriteMaterial(color3, options.labelZ); - } - __name(updateLabels, "updateLabels"); - } -} -/*! -fflate - fast JavaScript compression/decompression - -Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE -version 0.8.2 -*/ -var ch2 = {}; -var wk = /* @__PURE__ */ __name(function(c, id2, msg, transfer, cb) { - var w = new Worker(ch2[id2] || (ch2[id2] = URL.createObjectURL(new Blob([ - c + ';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})' - ], { type: "text/javascript" })))); - w.onmessage = function(e) { - var d = e.data, ed = d.$e$; - if (ed) { - var err2 = new Error(ed[0]); - err2["code"] = ed[1]; - err2.stack = ed[2]; - cb(err2, null); - } else - cb(null, d); - }; - w.postMessage(msg, transfer); - return w; -}, "wk"); -var u8 = Uint8Array, u16 = Uint16Array, i32 = Int32Array; -var fleb = new u8([ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1, - 2, - 2, - 2, - 2, - 3, - 3, - 3, - 3, - 4, - 4, - 4, - 4, - 5, - 5, - 5, - 5, - 0, - /* unused */ - 0, - 0, - /* impossible */ - 0 -]); -var fdeb = new u8([ - 0, - 0, - 0, - 0, - 1, - 1, - 2, - 2, - 3, - 3, - 4, - 4, - 5, - 5, - 6, - 6, - 7, - 7, - 8, - 8, - 9, - 9, - 10, - 10, - 11, - 11, - 12, - 12, - 13, - 13, - /* unused */ - 0, - 0 -]); -var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); -var freb = /* @__PURE__ */ __name(function(eb, start) { - var b = new u16(31); - for (var i = 0; i < 31; ++i) { - b[i] = start += 1 << eb[i - 1]; - } - var r = new i32(b[30]); - for (var i = 1; i < 30; ++i) { - for (var j = b[i]; j < b[i + 1]; ++j) { - r[j] = j - b[i] << 5 | i; - } - } - return { b, r }; -}, "freb"); -var _a = freb(fleb, 2), fl = _a.b, revfl = _a.r; -fl[28] = 258, revfl[258] = 28; -var _b = freb(fdeb, 0), fd = _b.b, revfd = _b.r; -var rev = new u16(32768); -for (var i = 0; i < 32768; ++i) { - var x = (i & 43690) >> 1 | (i & 21845) << 1; - x = (x & 52428) >> 2 | (x & 13107) << 2; - x = (x & 61680) >> 4 | (x & 3855) << 4; - rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1; -} -var hMap = /* @__PURE__ */ __name(function(cd, mb, r) { - var s = cd.length; - var i = 0; - var l = new u16(mb); - for (; i < s; ++i) { - if (cd[i]) - ++l[cd[i] - 1]; - } - var le = new u16(mb); - for (i = 1; i < mb; ++i) { - le[i] = le[i - 1] + l[i - 1] << 1; - } - var co; - if (r) { - co = new u16(1 << mb); - var rvb = 15 - mb; - for (i = 0; i < s; ++i) { - if (cd[i]) { - var sv = i << 4 | cd[i]; - var r_1 = mb - cd[i]; - var v = le[cd[i] - 1]++ << r_1; - for (var m = v | (1 << r_1) - 1; v <= m; ++v) { - co[rev[v] >> rvb] = sv; - } - } - } - } else { - co = new u16(s); - for (i = 0; i < s; ++i) { - if (cd[i]) { - co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i]; - } - } - } - return co; -}, "hMap"); -var flt = new u8(288); -for (var i = 0; i < 144; ++i) - flt[i] = 8; -for (var i = 144; i < 256; ++i) - flt[i] = 9; -for (var i = 256; i < 280; ++i) - flt[i] = 7; -for (var i = 280; i < 288; ++i) - flt[i] = 8; -var fdt = new u8(32); -for (var i = 0; i < 32; ++i) - fdt[i] = 5; -var flm = /* @__PURE__ */ hMap(flt, 9, 0), flrm = /* @__PURE__ */ hMap(flt, 9, 1); -var fdm = /* @__PURE__ */ hMap(fdt, 5, 0), fdrm = /* @__PURE__ */ hMap(fdt, 5, 1); -var max = /* @__PURE__ */ __name(function(a) { - var m = a[0]; - for (var i = 1; i < a.length; ++i) { - if (a[i] > m) - m = a[i]; - } - return m; -}, "max"); -var bits = /* @__PURE__ */ __name(function(d, p, m) { - var o = p / 8 | 0; - return (d[o] | d[o + 1] << 8) >> (p & 7) & m; -}, "bits"); -var bits16 = /* @__PURE__ */ __name(function(d, p) { - var o = p / 8 | 0; - return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (p & 7); -}, "bits16"); -var shft = /* @__PURE__ */ __name(function(p) { - return (p + 7) / 8 | 0; -}, "shft"); -var slc = /* @__PURE__ */ __name(function(v, s, e) { - if (s == null || s < 0) - s = 0; - if (e == null || e > v.length) - e = v.length; - return new u8(v.subarray(s, e)); -}, "slc"); -var FlateErrorCode = { - UnexpectedEOF: 0, - InvalidBlockType: 1, - InvalidLengthLiteral: 2, - InvalidDistance: 3, - StreamFinished: 4, - NoStreamHandler: 5, - InvalidHeader: 6, - NoCallback: 7, - InvalidUTF8: 8, - ExtraFieldTooLong: 9, - InvalidDate: 10, - FilenameTooLong: 11, - StreamFinishing: 12, - InvalidZipData: 13, - UnknownCompressionMethod: 14 -}; -var ec = [ - "unexpected EOF", - "invalid block type", - "invalid length/literal", - "invalid distance", - "stream finished", - "no stream handler", - , - "no callback", - "invalid UTF-8 data", - "extra field too long", - "date not in range 1980-2099", - "filename too long", - "stream finishing", - "invalid zip data" - // determined by unknown compression method -]; -; -var err = /* @__PURE__ */ __name(function(ind, msg, nt) { - var e = new Error(msg || ec[ind]); - e.code = ind; - if (Error.captureStackTrace) - Error.captureStackTrace(e, err); - if (!nt) - throw e; - return e; -}, "err"); -var inflt = /* @__PURE__ */ __name(function(dat, st, buf, dict) { - var sl = dat.length, dl = dict ? dict.length : 0; - if (!sl || st.f && !st.l) - return buf || new u8(0); - var noBuf = !buf; - var resize = noBuf || st.i != 2; - var noSt = st.i; - if (noBuf) - buf = new u8(sl * 3); - var cbuf = /* @__PURE__ */ __name(function(l2) { - var bl = buf.length; - if (l2 > bl) { - var nbuf = new u8(Math.max(bl * 2, l2)); - nbuf.set(buf); - buf = nbuf; - } - }, "cbuf"); - var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n; - var tbts = sl * 8; - do { - if (!lm) { - final = bits(dat, pos, 1); - var type = bits(dat, pos + 1, 3); - pos += 3; - if (!type) { - var s = shft(pos) + 4, l = dat[s - 4] | dat[s - 3] << 8, t2 = s + l; - if (t2 > sl) { - if (noSt) - err(0); - break; - } - if (resize) - cbuf(bt + l); - buf.set(dat.subarray(s, t2), bt); - st.b = bt += l, st.p = pos = t2 * 8, st.f = final; - continue; - } else if (type == 1) - lm = flrm, dm = fdrm, lbt = 9, dbt = 5; - else if (type == 2) { - var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4; - var tl = hLit + bits(dat, pos + 5, 31) + 1; - pos += 14; - var ldt = new u8(tl); - var clt = new u8(19); - for (var i = 0; i < hcLen; ++i) { - clt[clim[i]] = bits(dat, pos + i * 3, 7); - } - pos += hcLen * 3; - var clb = max(clt), clbmsk = (1 << clb) - 1; - var clm = hMap(clt, clb, 1); - for (var i = 0; i < tl; ) { - var r = clm[bits(dat, pos, clbmsk)]; - pos += r & 15; - var s = r >> 4; - if (s < 16) { - ldt[i++] = s; - } else { - var c = 0, n = 0; - if (s == 16) - n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1]; - else if (s == 17) - n = 3 + bits(dat, pos, 7), pos += 3; - else if (s == 18) - n = 11 + bits(dat, pos, 127), pos += 7; - while (n--) - ldt[i++] = c; - } - } - var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit); - lbt = max(lt); - dbt = max(dt); - lm = hMap(lt, lbt, 1); - dm = hMap(dt, dbt, 1); - } else - err(1); - if (pos > tbts) { - if (noSt) - err(0); - break; - } - } - if (resize) - cbuf(bt + 131072); - var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1; - var lpos = pos; - for (; ; lpos = pos) { - var c = lm[bits16(dat, pos) & lms], sym = c >> 4; - pos += c & 15; - if (pos > tbts) { - if (noSt) - err(0); - break; - } - if (!c) - err(2); - if (sym < 256) - buf[bt++] = sym; - else if (sym == 256) { - lpos = pos, lm = null; - break; - } else { - var add = sym - 254; - if (sym > 264) { - var i = sym - 257, b = fleb[i]; - add = bits(dat, pos, (1 << b) - 1) + fl[i]; - pos += b; - } - var d = dm[bits16(dat, pos) & dms], dsym = d >> 4; - if (!d) - err(3); - pos += d & 15; - var dt = fd[dsym]; - if (dsym > 3) { - var b = fdeb[dsym]; - dt += bits16(dat, pos) & (1 << b) - 1, pos += b; - } - if (pos > tbts) { - if (noSt) - err(0); - break; - } - if (resize) - cbuf(bt + 131072); - var end = bt + add; - if (bt < dt) { - var shift = dl - dt, dend = Math.min(dt, end); - if (shift + bt < 0) - err(3); - for (; bt < dend; ++bt) - buf[bt] = dict[shift + bt]; - } - for (; bt < end; ++bt) - buf[bt] = buf[bt - dt]; - } - } - st.l = lm, st.p = lpos, st.b = bt, st.f = final; - if (lm) - final = 1, st.m = lbt, st.d = dm, st.n = dbt; - } while (!final); - return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt); -}, "inflt"); -var wbits = /* @__PURE__ */ __name(function(d, p, v) { - v <<= p & 7; - var o = p / 8 | 0; - d[o] |= v; - d[o + 1] |= v >> 8; -}, "wbits"); -var wbits16 = /* @__PURE__ */ __name(function(d, p, v) { - v <<= p & 7; - var o = p / 8 | 0; - d[o] |= v; - d[o + 1] |= v >> 8; - d[o + 2] |= v >> 16; -}, "wbits16"); -var hTree = /* @__PURE__ */ __name(function(d, mb) { - var t2 = []; - for (var i = 0; i < d.length; ++i) { - if (d[i]) - t2.push({ s: i, f: d[i] }); - } - var s = t2.length; - var t22 = t2.slice(); - if (!s) - return { t: et, l: 0 }; - if (s == 1) { - var v = new u8(t2[0].s + 1); - v[t2[0].s] = 1; - return { t: v, l: 1 }; - } - t2.sort(function(a, b) { - return a.f - b.f; - }); - t2.push({ s: -1, f: 25001 }); - var l = t2[0], r = t2[1], i0 = 0, i1 = 1, i2 = 2; - t2[0] = { s: -1, f: l.f + r.f, l, r }; - while (i1 != s - 1) { - l = t2[t2[i0].f < t2[i2].f ? i0++ : i2++]; - r = t2[i0 != i1 && t2[i0].f < t2[i2].f ? i0++ : i2++]; - t2[i1++] = { s: -1, f: l.f + r.f, l, r }; - } - var maxSym = t22[0].s; - for (var i = 1; i < s; ++i) { - if (t22[i].s > maxSym) - maxSym = t22[i].s; - } - var tr = new u16(maxSym + 1); - var mbt = ln(t2[i1 - 1], tr, 0); - if (mbt > mb) { - var i = 0, dt = 0; - var lft = mbt - mb, cst = 1 << lft; - t22.sort(function(a, b) { - return tr[b.s] - tr[a.s] || a.f - b.f; - }); - for (; i < s; ++i) { - var i2_1 = t22[i].s; - if (tr[i2_1] > mb) { - dt += cst - (1 << mbt - tr[i2_1]); - tr[i2_1] = mb; - } else - break; - } - dt >>= lft; - while (dt > 0) { - var i2_2 = t22[i].s; - if (tr[i2_2] < mb) - dt -= 1 << mb - tr[i2_2]++ - 1; - else - ++i; - } - for (; i >= 0 && dt; --i) { - var i2_3 = t22[i].s; - if (tr[i2_3] == mb) { - --tr[i2_3]; - ++dt; - } - } - mbt = mb; - } - return { t: new u8(tr), l: mbt }; -}, "hTree"); -var ln = /* @__PURE__ */ __name(function(n, l, d) { - return n.s == -1 ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1)) : l[n.s] = d; -}, "ln"); -var lc = /* @__PURE__ */ __name(function(c) { - var s = c.length; - while (s && !c[--s]) - ; - var cl = new u16(++s); - var cli = 0, cln = c[0], cls = 1; - var w = /* @__PURE__ */ __name(function(v) { - cl[cli++] = v; - }, "w"); - for (var i = 1; i <= s; ++i) { - if (c[i] == cln && i != s) - ++cls; - else { - if (!cln && cls > 2) { - for (; cls > 138; cls -= 138) - w(32754); - if (cls > 2) { - w(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305); - cls = 0; - } - } else if (cls > 3) { - w(cln), --cls; - for (; cls > 6; cls -= 6) - w(8304); - if (cls > 2) - w(cls - 3 << 5 | 8208), cls = 0; - } - while (cls--) - w(cln); - cls = 1; - cln = c[i]; - } - } - return { c: cl.subarray(0, cli), n: s }; -}, "lc"); -var clen = /* @__PURE__ */ __name(function(cf, cl) { - var l = 0; - for (var i = 0; i < cl.length; ++i) - l += cf[i] * cl[i]; - return l; -}, "clen"); -var wfblk = /* @__PURE__ */ __name(function(out, pos, dat) { - var s = dat.length; - var o = shft(pos + 2); - out[o] = s & 255; - out[o + 1] = s >> 8; - out[o + 2] = out[o] ^ 255; - out[o + 3] = out[o + 1] ^ 255; - for (var i = 0; i < s; ++i) - out[o + i + 4] = dat[i]; - return (o + 4 + s) * 8; -}, "wfblk"); -var wblk = /* @__PURE__ */ __name(function(dat, out, final, syms, lf, df, eb, li, bs, bl, p) { - wbits(out, p++, final); - ++lf[256]; - var _a2 = hTree(lf, 15), dlt = _a2.t, mlb = _a2.l; - var _b2 = hTree(df, 15), ddt = _b2.t, mdb = _b2.l; - var _c = lc(dlt), lclt = _c.c, nlc = _c.n; - var _d = lc(ddt), lcdt = _d.c, ndc = _d.n; - var lcfreq = new u16(19); - for (var i = 0; i < lclt.length; ++i) - ++lcfreq[lclt[i] & 31]; - for (var i = 0; i < lcdt.length; ++i) - ++lcfreq[lcdt[i] & 31]; - var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l; - var nlcc = 19; - for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc) - ; - var flen = bl + 5 << 3; - var ftlen = clen(lf, flt) + clen(df, fdt) + eb; - var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18]; - if (bs >= 0 && flen <= ftlen && flen <= dtlen) - return wfblk(out, p, dat.subarray(bs, bs + bl)); - var lm, ll, dm, dl; - wbits(out, p, 1 + (dtlen < ftlen)), p += 2; - if (dtlen < ftlen) { - lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt; - var llm = hMap(lct, mlcb, 0); - wbits(out, p, nlc - 257); - wbits(out, p + 5, ndc - 1); - wbits(out, p + 10, nlcc - 4); - p += 14; - for (var i = 0; i < nlcc; ++i) - wbits(out, p + 3 * i, lct[clim[i]]); - p += 3 * nlcc; - var lcts = [lclt, lcdt]; - for (var it = 0; it < 2; ++it) { - var clct = lcts[it]; - for (var i = 0; i < clct.length; ++i) { - var len = clct[i] & 31; - wbits(out, p, llm[len]), p += lct[len]; - if (len > 15) - wbits(out, p, clct[i] >> 5 & 127), p += clct[i] >> 12; - } - } - } else { - lm = flm, ll = flt, dm = fdm, dl = fdt; - } - for (var i = 0; i < li; ++i) { - var sym = syms[i]; - if (sym > 255) { - var len = sym >> 18 & 31; - wbits16(out, p, lm[len + 257]), p += ll[len + 257]; - if (len > 7) - wbits(out, p, sym >> 23 & 31), p += fleb[len]; - var dst = sym & 31; - wbits16(out, p, dm[dst]), p += dl[dst]; - if (dst > 3) - wbits16(out, p, sym >> 5 & 8191), p += fdeb[dst]; - } else { - wbits16(out, p, lm[sym]), p += ll[sym]; - } - } - wbits16(out, p, lm[256]); - return p + ll[256]; -}, "wblk"); -var deo = /* @__PURE__ */ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]); -var et = /* @__PURE__ */ new u8(0); -var dflt = /* @__PURE__ */ __name(function(dat, lvl, plvl, pre, post, st) { - var s = st.z || dat.length; - var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7e3)) + post); - var w = o.subarray(pre, o.length - post); - var lst = st.l; - var pos = (st.r || 0) & 7; - if (lvl) { - if (pos) - w[0] = st.r >> 3; - var opt = deo[lvl - 1]; - var n = opt >> 13, c = opt & 8191; - var msk_1 = (1 << plvl) - 1; - var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1); - var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1; - var hsh = /* @__PURE__ */ __name(function(i2) { - return (dat[i2] ^ dat[i2 + 1] << bs1_1 ^ dat[i2 + 2] << bs2_1) & msk_1; - }, "hsh"); - var syms = new i32(25e3); - var lf = new u16(288), df = new u16(32); - var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0; - for (; i + 2 < s; ++i) { - var hv = hsh(i); - var imod = i & 32767, pimod = head[hv]; - prev[imod] = pimod; - head[hv] = imod; - if (wi <= i) { - var rem = s - i; - if ((lc_1 > 7e3 || li > 24576) && (rem > 423 || !lst)) { - pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos); - li = lc_1 = eb = 0, bs = i; - for (var j = 0; j < 286; ++j) - lf[j] = 0; - for (var j = 0; j < 30; ++j) - df[j] = 0; - } - var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767; - if (rem > 2 && hv == hsh(i - dif)) { - var maxn = Math.min(n, rem) - 1; - var maxd = Math.min(32767, i); - var ml = Math.min(258, rem); - while (dif <= maxd && --ch_1 && imod != pimod) { - if (dat[i + l] == dat[i + l - dif]) { - var nl = 0; - for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl) - ; - if (nl > l) { - l = nl, d = dif; - if (nl > maxn) - break; - var mmd = Math.min(dif, nl - 2); - var md = 0; - for (var j = 0; j < mmd; ++j) { - var ti = i - dif + j & 32767; - var pti = prev[ti]; - var cd = ti - pti & 32767; - if (cd > md) - md = cd, pimod = ti; - } - } - } - imod = pimod, pimod = prev[imod]; - dif += imod - pimod & 32767; - } - } - if (d) { - syms[li++] = 268435456 | revfl[l] << 18 | revfd[d]; - var lin = revfl[l] & 31, din = revfd[d] & 31; - eb += fleb[lin] + fdeb[din]; - ++lf[257 + lin]; - ++df[din]; - wi = i + l; - ++lc_1; - } else { - syms[li++] = dat[i]; - ++lf[dat[i]]; - } - } - } - for (i = Math.max(i, wi); i < s; ++i) { - syms[li++] = dat[i]; - ++lf[dat[i]]; - } - pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos); - if (!lst) { - st.r = pos & 7 | w[pos / 8 | 0] << 3; - pos -= 7; - st.h = head, st.p = prev, st.i = i, st.w = wi; - } - } else { - for (var i = st.w || 0; i < s + lst; i += 65535) { - var e = i + 65535; - if (e >= s) { - w[pos / 8 | 0] = lst; - e = s; - } - pos = wfblk(w, pos + 1, dat.subarray(i, e)); - } - st.i = s; - } - return slc(o, 0, pre + shft(pos) + post); -}, "dflt"); -var crct = /* @__PURE__ */ function() { - var t2 = new Int32Array(256); - for (var i = 0; i < 256; ++i) { - var c = i, k = 9; - while (--k) - c = (c & 1 && -306674912) ^ c >>> 1; - t2[i] = c; - } - return t2; -}(); -var crc = /* @__PURE__ */ __name(function() { - var c = -1; - return { - p: /* @__PURE__ */ __name(function(d) { - var cr = c; - for (var i = 0; i < d.length; ++i) - cr = crct[cr & 255 ^ d[i]] ^ cr >>> 8; - c = cr; - }, "p"), - d: /* @__PURE__ */ __name(function() { - return ~c; - }, "d") - }; -}, "crc"); -var adler = /* @__PURE__ */ __name(function() { - var a = 1, b = 0; - return { - p: /* @__PURE__ */ __name(function(d) { - var n = a, m = b; - var l = d.length | 0; - for (var i = 0; i != l; ) { - var e = Math.min(i + 2655, l); - for (; i < e; ++i) - m += n += d[i]; - n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16); - } - a = n, b = m; - }, "p"), - d: /* @__PURE__ */ __name(function() { - a %= 65521, b %= 65521; - return (a & 255) << 24 | (a & 65280) << 8 | (b & 255) << 8 | b >> 8; - }, "d") - }; -}, "adler"); -; -var dopt = /* @__PURE__ */ __name(function(dat, opt, pre, post, st) { - if (!st) { - st = { l: 1 }; - if (opt.dictionary) { - var dict = opt.dictionary.subarray(-32768); - var newDat = new u8(dict.length + dat.length); - newDat.set(dict); - newDat.set(dat, dict.length); - dat = newDat; - st.w = dict.length; - } - } - return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st); -}, "dopt"); -var mrg = /* @__PURE__ */ __name(function(a, b) { - var o = {}; - for (var k in a) - o[k] = a[k]; - for (var k in b) - o[k] = b[k]; - return o; -}, "mrg"); -var wcln = /* @__PURE__ */ __name(function(fn, fnStr, td2) { - var dt = fn(); - var st = fn.toString(); - var ks = st.slice(st.indexOf("[") + 1, st.lastIndexOf("]")).replace(/\s+/g, "").split(","); - for (var i = 0; i < dt.length; ++i) { - var v = dt[i], k = ks[i]; - if (typeof v == "function") { - fnStr += ";" + k + "="; - var st_1 = v.toString(); - if (v.prototype) { - if (st_1.indexOf("[native code]") != -1) { - var spInd = st_1.indexOf(" ", 8) + 1; - fnStr += st_1.slice(spInd, st_1.indexOf("(", spInd)); - } else { - fnStr += st_1; - for (var t2 in v.prototype) - fnStr += ";" + k + ".prototype." + t2 + "=" + v.prototype[t2].toString(); - } - } else - fnStr += st_1; - } else - td2[k] = v; - } - return fnStr; -}, "wcln"); -var ch = []; -var cbfs = /* @__PURE__ */ __name(function(v) { - var tl = []; - for (var k in v) { - if (v[k].buffer) { - tl.push((v[k] = new v[k].constructor(v[k])).buffer); - } - } - return tl; -}, "cbfs"); -var wrkr = /* @__PURE__ */ __name(function(fns, init, id2, cb) { - if (!ch[id2]) { - var fnStr = "", td_1 = {}, m = fns.length - 1; - for (var i = 0; i < m; ++i) - fnStr = wcln(fns[i], fnStr, td_1); - ch[id2] = { c: wcln(fns[m], fnStr, td_1), e: td_1 }; - } - var td2 = mrg({}, ch[id2].e); - return wk(ch[id2].c + ";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=" + init.toString() + "}", id2, td2, cbfs(td2), cb); -}, "wrkr"); -var bInflt = /* @__PURE__ */ __name(function() { - return [u8, u16, i32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gopt]; -}, "bInflt"); -var bDflt = /* @__PURE__ */ __name(function() { - return [u8, u16, i32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; -}, "bDflt"); -var gze = /* @__PURE__ */ __name(function() { - return [gzh, gzhl, wbytes, crc, crct]; -}, "gze"); -var guze = /* @__PURE__ */ __name(function() { - return [gzs, gzl]; -}, "guze"); -var zle = /* @__PURE__ */ __name(function() { - return [zlh, wbytes, adler]; -}, "zle"); -var zule = /* @__PURE__ */ __name(function() { - return [zls]; -}, "zule"); -var pbf = /* @__PURE__ */ __name(function(msg) { - return postMessage(msg, [msg.buffer]); -}, "pbf"); -var gopt = /* @__PURE__ */ __name(function(o) { - return o && { - out: o.size && new u8(o.size), - dictionary: o.dictionary - }; -}, "gopt"); -var cbify = /* @__PURE__ */ __name(function(dat, opts, fns, init, id2, cb) { - var w = wrkr(fns, init, id2, function(err2, dat2) { - w.terminate(); - cb(err2, dat2); - }); - w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []); - return function() { - w.terminate(); - }; -}, "cbify"); -var astrm = /* @__PURE__ */ __name(function(strm) { - strm.ondata = function(dat, final) { - return postMessage([dat, final], [dat.buffer]); - }; - return function(ev) { - if (ev.data.length) { - strm.push(ev.data[0], ev.data[1]); - postMessage([ev.data[0].length]); - } else - strm.flush(); - }; -}, "astrm"); -var astrmify = /* @__PURE__ */ __name(function(fns, strm, opts, init, id2, flush, ext2) { - var t2; - var w = wrkr(fns, init, id2, function(err2, dat) { - if (err2) - w.terminate(), strm.ondata.call(strm, err2); - else if (!Array.isArray(dat)) - ext2(dat); - else if (dat.length == 1) { - strm.queuedSize -= dat[0]; - if (strm.ondrain) - strm.ondrain(dat[0]); - } else { - if (dat[1]) - w.terminate(); - strm.ondata.call(strm, err2, dat[0], dat[1]); - } - }); - w.postMessage(opts); - strm.queuedSize = 0; - strm.push = function(d, f) { - if (!strm.ondata) - err(5); - if (t2) - strm.ondata(err(4, 0, 1), null, !!f); - strm.queuedSize += d.length; - w.postMessage([d, t2 = f], [d.buffer]); - }; - strm.terminate = function() { - w.terminate(); - }; - if (flush) { - strm.flush = function() { - w.postMessage([]); - }; - } -}, "astrmify"); -var b2 = /* @__PURE__ */ __name(function(d, b) { - return d[b] | d[b + 1] << 8; -}, "b2"); -var b4 = /* @__PURE__ */ __name(function(d, b) { - return (d[b] | d[b + 1] << 8 | d[b + 2] << 16 | d[b + 3] << 24) >>> 0; -}, "b4"); -var b8 = /* @__PURE__ */ __name(function(d, b) { - return b4(d, b) + b4(d, b + 4) * 4294967296; -}, "b8"); -var wbytes = /* @__PURE__ */ __name(function(d, b, v) { - for (; v; ++b) - d[b] = v, v >>>= 8; -}, "wbytes"); -var gzh = /* @__PURE__ */ __name(function(c, o) { - var fn = o.filename; - c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; - if (o.mtime != 0) - wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1e3)); - if (fn) { - c[3] = 8; - for (var i = 0; i <= fn.length; ++i) - c[i + 10] = fn.charCodeAt(i); - } -}, "gzh"); -var gzs = /* @__PURE__ */ __name(function(d) { - if (d[0] != 31 || d[1] != 139 || d[2] != 8) - err(6, "invalid gzip data"); - var flg = d[3]; - var st = 10; - if (flg & 4) - st += (d[10] | d[11] << 8) + 2; - for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++]) - ; - return st + (flg & 2); -}, "gzs"); -var gzl = /* @__PURE__ */ __name(function(d) { - var l = d.length; - return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0; -}, "gzl"); -var gzhl = /* @__PURE__ */ __name(function(o) { - return 10 + (o.filename ? o.filename.length + 1 : 0); -}, "gzhl"); -var zlh = /* @__PURE__ */ __name(function(c, o) { - var lv = o.level, fl2 = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2; - c[0] = 120, c[1] = fl2 << 6 | (o.dictionary && 32); - c[1] |= 31 - (c[0] << 8 | c[1]) % 31; - if (o.dictionary) { - var h = adler(); - h.p(o.dictionary); - wbytes(c, 2, h.d()); - } -}, "zlh"); -var zls = /* @__PURE__ */ __name(function(d, dict) { - if ((d[0] & 15) != 8 || d[0] >> 4 > 7 || (d[0] << 8 | d[1]) % 31) - err(6, "invalid zlib data"); - if ((d[1] >> 5 & 1) == +!dict) - err(6, "invalid zlib data: " + (d[1] & 32 ? "need" : "unexpected") + " dictionary"); - return (d[1] >> 3 & 4) + 2; -}, "zls"); -function StrmOpt(opts, cb) { - if (typeof opts == "function") - cb = opts, opts = {}; - this.ondata = cb; - return opts; -} -__name(StrmOpt, "StrmOpt"); -var Deflate = /* @__PURE__ */ function() { - function Deflate2(opts, cb) { - if (typeof opts == "function") - cb = opts, opts = {}; - this.ondata = cb; - this.o = opts || {}; - this.s = { l: 0, i: 32768, w: 32768, z: 32768 }; - this.b = new u8(98304); - if (this.o.dictionary) { - var dict = this.o.dictionary.subarray(-32768); - this.b.set(dict, 32768 - dict.length); - this.s.i = 32768 - dict.length; - } - } - __name(Deflate2, "Deflate"); - Deflate2.prototype.p = function(c, f) { - this.ondata(dopt(c, this.o, 0, 0, this.s), f); - }; - Deflate2.prototype.push = function(chunk, final) { - if (!this.ondata) - err(5); - if (this.s.l) - err(4); - var endLen = chunk.length + this.s.z; - if (endLen > this.b.length) { - if (endLen > 2 * this.b.length - 32768) { - var newBuf = new u8(endLen & -32768); - newBuf.set(this.b.subarray(0, this.s.z)); - this.b = newBuf; - } - var split = this.b.length - this.s.z; - this.b.set(chunk.subarray(0, split), this.s.z); - this.s.z = this.b.length; - this.p(this.b, false); - this.b.set(this.b.subarray(-32768)); - this.b.set(chunk.subarray(split), 32768); - this.s.z = chunk.length - split + 32768; - this.s.i = 32766, this.s.w = 32768; - } else { - this.b.set(chunk, this.s.z); - this.s.z += chunk.length; - } - this.s.l = final & 1; - if (this.s.z > this.s.w + 8191 || final) { - this.p(this.b, final || false); - this.s.w = this.s.i, this.s.i -= 2; - } - }; - Deflate2.prototype.flush = function() { - if (!this.ondata) - err(5); - if (this.s.l) - err(4); - this.p(this.b, false); - this.s.w = this.s.i, this.s.i -= 2; - }; - return Deflate2; -}(); -var AsyncDeflate = /* @__PURE__ */ function() { - function AsyncDeflate2(opts, cb) { - astrmify([ - bDflt, - function() { - return [astrm, Deflate]; - } - ], this, StrmOpt.call(this, opts, cb), function(ev) { - var strm = new Deflate(ev.data); - onmessage = astrm(strm); - }, 6, 1); - } - __name(AsyncDeflate2, "AsyncDeflate"); - return AsyncDeflate2; -}(); -function deflate(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != "function") - err(7); - return cbify(data, opts, [ - bDflt - ], function(ev) { - return pbf(deflateSync(ev.data[0], ev.data[1])); - }, 0, cb); -} -__name(deflate, "deflate"); -function deflateSync(data, opts) { - return dopt(data, opts || {}, 0, 0); -} -__name(deflateSync, "deflateSync"); -var Inflate = /* @__PURE__ */ function() { - function Inflate2(opts, cb) { - if (typeof opts == "function") - cb = opts, opts = {}; - this.ondata = cb; - var dict = opts && opts.dictionary && opts.dictionary.subarray(-32768); - this.s = { i: 0, b: dict ? dict.length : 0 }; - this.o = new u8(32768); - this.p = new u8(0); - if (dict) - this.o.set(dict); - } - __name(Inflate2, "Inflate"); - Inflate2.prototype.e = function(c) { - if (!this.ondata) - err(5); - if (this.d) - err(4); - if (!this.p.length) - this.p = c; - else if (c.length) { - var n = new u8(this.p.length + c.length); - n.set(this.p), n.set(c, this.p.length), this.p = n; - } - }; - Inflate2.prototype.c = function(final) { - this.s.i = +(this.d = final || false); - var bts = this.s.b; - var dt = inflt(this.p, this.s, this.o); - this.ondata(slc(dt, bts, this.s.b), this.d); - this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length; - this.p = slc(this.p, this.s.p / 8 | 0), this.s.p &= 7; - }; - Inflate2.prototype.push = function(chunk, final) { - this.e(chunk), this.c(final); - }; - return Inflate2; -}(); -var AsyncInflate = /* @__PURE__ */ function() { - function AsyncInflate2(opts, cb) { - astrmify([ - bInflt, - function() { - return [astrm, Inflate]; - } - ], this, StrmOpt.call(this, opts, cb), function(ev) { - var strm = new Inflate(ev.data); - onmessage = astrm(strm); - }, 7, 0); - } - __name(AsyncInflate2, "AsyncInflate"); - return AsyncInflate2; -}(); -function inflate(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != "function") - err(7); - return cbify(data, opts, [ - bInflt - ], function(ev) { - return pbf(inflateSync(ev.data[0], gopt(ev.data[1]))); - }, 1, cb); -} -__name(inflate, "inflate"); -function inflateSync(data, opts) { - return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary); -} -__name(inflateSync, "inflateSync"); -var Gzip = /* @__PURE__ */ function() { - function Gzip2(opts, cb) { - this.c = crc(); - this.l = 0; - this.v = 1; - Deflate.call(this, opts, cb); - } - __name(Gzip2, "Gzip"); - Gzip2.prototype.push = function(chunk, final) { - this.c.p(chunk); - this.l += chunk.length; - Deflate.prototype.push.call(this, chunk, final); - }; - Gzip2.prototype.p = function(c, f) { - var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, this.s); - if (this.v) - gzh(raw, this.o), this.v = 0; - if (f) - wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l); - this.ondata(raw, f); - }; - Gzip2.prototype.flush = function() { - Deflate.prototype.flush.call(this); - }; - return Gzip2; -}(); -var AsyncGzip = /* @__PURE__ */ function() { - function AsyncGzip2(opts, cb) { - astrmify([ - bDflt, - gze, - function() { - return [astrm, Deflate, Gzip]; - } - ], this, StrmOpt.call(this, opts, cb), function(ev) { - var strm = new Gzip(ev.data); - onmessage = astrm(strm); - }, 8, 1); - } - __name(AsyncGzip2, "AsyncGzip"); - return AsyncGzip2; -}(); -function gzip(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != "function") - err(7); - return cbify(data, opts, [ - bDflt, - gze, - function() { - return [gzipSync]; - } - ], function(ev) { - return pbf(gzipSync(ev.data[0], ev.data[1])); - }, 2, cb); -} -__name(gzip, "gzip"); -function gzipSync(data, opts) { - if (!opts) - opts = {}; - var c = crc(), l = data.length; - c.p(data); - var d = dopt(data, opts, gzhl(opts), 8), s = d.length; - return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d; -} -__name(gzipSync, "gzipSync"); -var Gunzip = /* @__PURE__ */ function() { - function Gunzip2(opts, cb) { - this.v = 1; - this.r = 0; - Inflate.call(this, opts, cb); - } - __name(Gunzip2, "Gunzip"); - Gunzip2.prototype.push = function(chunk, final) { - Inflate.prototype.e.call(this, chunk); - this.r += chunk.length; - if (this.v) { - var p = this.p.subarray(this.v - 1); - var s = p.length > 3 ? gzs(p) : 4; - if (s > p.length) { - if (!final) - return; - } else if (this.v > 1 && this.onmember) { - this.onmember(this.r - p.length); - } - this.p = p.subarray(s), this.v = 0; - } - Inflate.prototype.c.call(this, final); - if (this.s.f && !this.s.l && !final) { - this.v = shft(this.s.p) + 9; - this.s = { i: 0 }; - this.o = new u8(0); - this.push(new u8(0), final); - } - }; - return Gunzip2; -}(); -var AsyncGunzip = /* @__PURE__ */ function() { - function AsyncGunzip2(opts, cb) { - var _this = this; - astrmify([ - bInflt, - guze, - function() { - return [astrm, Inflate, Gunzip]; - } - ], this, StrmOpt.call(this, opts, cb), function(ev) { - var strm = new Gunzip(ev.data); - strm.onmember = function(offset) { - return postMessage(offset); - }; - onmessage = astrm(strm); - }, 9, 0, function(offset) { - return _this.onmember && _this.onmember(offset); - }); - } - __name(AsyncGunzip2, "AsyncGunzip"); - return AsyncGunzip2; -}(); -function gunzip(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != "function") - err(7); - return cbify(data, opts, [ - bInflt, - guze, - function() { - return [gunzipSync]; - } - ], function(ev) { - return pbf(gunzipSync(ev.data[0], ev.data[1])); - }, 3, cb); -} -__name(gunzip, "gunzip"); -function gunzipSync(data, opts) { - var st = gzs(data); - if (st + 8 > data.length) - err(6, "invalid gzip data"); - return inflt(data.subarray(st, -8), { i: 2 }, opts && opts.out || new u8(gzl(data)), opts && opts.dictionary); -} -__name(gunzipSync, "gunzipSync"); -var Zlib = /* @__PURE__ */ function() { - function Zlib2(opts, cb) { - this.c = adler(); - this.v = 1; - Deflate.call(this, opts, cb); - } - __name(Zlib2, "Zlib"); - Zlib2.prototype.push = function(chunk, final) { - this.c.p(chunk); - Deflate.prototype.push.call(this, chunk, final); - }; - Zlib2.prototype.p = function(c, f) { - var raw = dopt(c, this.o, this.v && (this.o.dictionary ? 6 : 2), f && 4, this.s); - if (this.v) - zlh(raw, this.o), this.v = 0; - if (f) - wbytes(raw, raw.length - 4, this.c.d()); - this.ondata(raw, f); - }; - Zlib2.prototype.flush = function() { - Deflate.prototype.flush.call(this); - }; - return Zlib2; -}(); -var AsyncZlib = /* @__PURE__ */ function() { - function AsyncZlib2(opts, cb) { - astrmify([ - bDflt, - zle, - function() { - return [astrm, Deflate, Zlib]; - } - ], this, StrmOpt.call(this, opts, cb), function(ev) { - var strm = new Zlib(ev.data); - onmessage = astrm(strm); - }, 10, 1); - } - __name(AsyncZlib2, "AsyncZlib"); - return AsyncZlib2; -}(); -function zlib(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != "function") - err(7); - return cbify(data, opts, [ - bDflt, - zle, - function() { - return [zlibSync]; - } - ], function(ev) { - return pbf(zlibSync(ev.data[0], ev.data[1])); - }, 4, cb); -} -__name(zlib, "zlib"); -function zlibSync(data, opts) { - if (!opts) - opts = {}; - var a = adler(); - a.p(data); - var d = dopt(data, opts, opts.dictionary ? 6 : 2, 4); - return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d; -} -__name(zlibSync, "zlibSync"); -var Unzlib = /* @__PURE__ */ function() { - function Unzlib2(opts, cb) { - Inflate.call(this, opts, cb); - this.v = opts && opts.dictionary ? 2 : 1; - } - __name(Unzlib2, "Unzlib"); - Unzlib2.prototype.push = function(chunk, final) { - Inflate.prototype.e.call(this, chunk); - if (this.v) { - if (this.p.length < 6 && !final) - return; - this.p = this.p.subarray(zls(this.p, this.v - 1)), this.v = 0; - } - if (final) { - if (this.p.length < 4) - err(6, "invalid zlib data"); - this.p = this.p.subarray(0, -4); - } - Inflate.prototype.c.call(this, final); - }; - return Unzlib2; -}(); -var AsyncUnzlib = /* @__PURE__ */ function() { - function AsyncUnzlib2(opts, cb) { - astrmify([ - bInflt, - zule, - function() { - return [astrm, Inflate, Unzlib]; - } - ], this, StrmOpt.call(this, opts, cb), function(ev) { - var strm = new Unzlib(ev.data); - onmessage = astrm(strm); - }, 11, 0); - } - __name(AsyncUnzlib2, "AsyncUnzlib"); - return AsyncUnzlib2; -}(); -function unzlib(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != "function") - err(7); - return cbify(data, opts, [ - bInflt, - zule, - function() { - return [unzlibSync]; - } - ], function(ev) { - return pbf(unzlibSync(ev.data[0], gopt(ev.data[1]))); - }, 5, cb); -} -__name(unzlib, "unzlib"); -function unzlibSync(data, opts) { - return inflt(data.subarray(zls(data, opts && opts.dictionary), -4), { i: 2 }, opts && opts.out, opts && opts.dictionary); -} -__name(unzlibSync, "unzlibSync"); -var Decompress = /* @__PURE__ */ function() { - function Decompress2(opts, cb) { - this.o = StrmOpt.call(this, opts, cb) || {}; - this.G = Gunzip; - this.I = Inflate; - this.Z = Unzlib; - } - __name(Decompress2, "Decompress"); - Decompress2.prototype.i = function() { - var _this = this; - this.s.ondata = function(dat, final) { - _this.ondata(dat, final); - }; - }; - Decompress2.prototype.push = function(chunk, final) { - if (!this.ondata) - err(5); - if (!this.s) { - if (this.p && this.p.length) { - var n = new u8(this.p.length + chunk.length); - n.set(this.p), n.set(chunk, this.p.length); - } else - this.p = chunk; - if (this.p.length > 2) { - this.s = this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8 ? new this.G(this.o) : (this.p[0] & 15) != 8 || this.p[0] >> 4 > 7 || (this.p[0] << 8 | this.p[1]) % 31 ? new this.I(this.o) : new this.Z(this.o); - this.i(); - this.s.push(this.p, final); - this.p = null; - } - } else - this.s.push(chunk, final); - }; - return Decompress2; -}(); -var AsyncDecompress = /* @__PURE__ */ function() { - function AsyncDecompress2(opts, cb) { - Decompress.call(this, opts, cb); - this.queuedSize = 0; - this.G = AsyncGunzip; - this.I = AsyncInflate; - this.Z = AsyncUnzlib; - } - __name(AsyncDecompress2, "AsyncDecompress"); - AsyncDecompress2.prototype.i = function() { - var _this = this; - this.s.ondata = function(err2, dat, final) { - _this.ondata(err2, dat, final); - }; - this.s.ondrain = function(size) { - _this.queuedSize -= size; - if (_this.ondrain) - _this.ondrain(size); - }; - }; - AsyncDecompress2.prototype.push = function(chunk, final) { - this.queuedSize += chunk.length; - Decompress.prototype.push.call(this, chunk, final); - }; - return AsyncDecompress2; -}(); -function decompress(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != "function") - err(7); - return data[0] == 31 && data[1] == 139 && data[2] == 8 ? gunzip(data, opts, cb) : (data[0] & 15) != 8 || data[0] >> 4 > 7 || (data[0] << 8 | data[1]) % 31 ? inflate(data, opts, cb) : unzlib(data, opts, cb); -} -__name(decompress, "decompress"); -function decompressSync(data, opts) { - return data[0] == 31 && data[1] == 139 && data[2] == 8 ? gunzipSync(data, opts) : (data[0] & 15) != 8 || data[0] >> 4 > 7 || (data[0] << 8 | data[1]) % 31 ? inflateSync(data, opts) : unzlibSync(data, opts); -} -__name(decompressSync, "decompressSync"); -var fltn = /* @__PURE__ */ __name(function(d, p, t2, o) { - for (var k in d) { - var val = d[k], n = p + k, op = o; - if (Array.isArray(val)) - op = mrg(o, val[1]), val = val[0]; - if (val instanceof u8) - t2[n] = [val, op]; - else { - t2[n += "/"] = [new u8(0), op]; - fltn(val, n, t2, o); - } - } -}, "fltn"); -var te = typeof TextEncoder != "undefined" && /* @__PURE__ */ new TextEncoder(); -var td = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder(); -var tds = 0; -try { - td.decode(et, { stream: true }); - tds = 1; -} catch (e) { -} -var dutf8 = /* @__PURE__ */ __name(function(d) { - for (var r = "", i = 0; ; ) { - var c = d[i++]; - var eb = (c > 127) + (c > 223) + (c > 239); - if (i + eb > d.length) - return { s: r, r: slc(d, i - 1) }; - if (!eb) - r += String.fromCharCode(c); - else if (eb == 3) { - c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | d[i++] & 63) - 65536, r += String.fromCharCode(55296 | c >> 10, 56320 | c & 1023); - } else if (eb & 1) - r += String.fromCharCode((c & 31) << 6 | d[i++] & 63); - else - r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | d[i++] & 63); - } -}, "dutf8"); -var DecodeUTF8 = /* @__PURE__ */ function() { - function DecodeUTF82(cb) { - this.ondata = cb; - if (tds) - this.t = new TextDecoder(); - else - this.p = et; - } - __name(DecodeUTF82, "DecodeUTF8"); - DecodeUTF82.prototype.push = function(chunk, final) { - if (!this.ondata) - err(5); - final = !!final; - if (this.t) { - this.ondata(this.t.decode(chunk, { stream: true }), final); - if (final) { - if (this.t.decode().length) - err(8); - this.t = null; - } - return; - } - if (!this.p) - err(4); - var dat = new u8(this.p.length + chunk.length); - dat.set(this.p); - dat.set(chunk, this.p.length); - var _a2 = dutf8(dat), s = _a2.s, r = _a2.r; - if (final) { - if (r.length) - err(8); - this.p = null; - } else - this.p = r; - this.ondata(s, final); - }; - return DecodeUTF82; -}(); -var EncodeUTF8 = /* @__PURE__ */ function() { - function EncodeUTF82(cb) { - this.ondata = cb; - } - __name(EncodeUTF82, "EncodeUTF8"); - EncodeUTF82.prototype.push = function(chunk, final) { - if (!this.ondata) - err(5); - if (this.d) - err(4); - this.ondata(strToU8(chunk), this.d = final || false); - }; - return EncodeUTF82; -}(); -function strToU8(str, latin1) { - if (latin1) { - var ar_1 = new u8(str.length); - for (var i = 0; i < str.length; ++i) - ar_1[i] = str.charCodeAt(i); - return ar_1; - } - if (te) - return te.encode(str); - var l = str.length; - var ar = new u8(str.length + (str.length >> 1)); - var ai = 0; - var w = /* @__PURE__ */ __name(function(v) { - ar[ai++] = v; - }, "w"); - for (var i = 0; i < l; ++i) { - if (ai + 5 > ar.length) { - var n = new u8(ai + 8 + (l - i << 1)); - n.set(ar); - ar = n; - } - var c = str.charCodeAt(i); - if (c < 128 || latin1) - w(c); - else if (c < 2048) - w(192 | c >> 6), w(128 | c & 63); - else if (c > 55295 && c < 57344) - c = 65536 + (c & 1023 << 10) | str.charCodeAt(++i) & 1023, w(240 | c >> 18), w(128 | c >> 12 & 63), w(128 | c >> 6 & 63), w(128 | c & 63); - else - w(224 | c >> 12), w(128 | c >> 6 & 63), w(128 | c & 63); - } - return slc(ar, 0, ai); -} -__name(strToU8, "strToU8"); -function strFromU8(dat, latin1) { - if (latin1) { - var r = ""; - for (var i = 0; i < dat.length; i += 16384) - r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384)); - return r; - } else if (td) { - return td.decode(dat); - } else { - var _a2 = dutf8(dat), s = _a2.s, r = _a2.r; - if (r.length) - err(8); - return s; - } -} -__name(strFromU8, "strFromU8"); -; -var dbf = /* @__PURE__ */ __name(function(l) { - return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; -}, "dbf"); -var slzh = /* @__PURE__ */ __name(function(d, b) { - return b + 30 + b2(d, b + 26) + b2(d, b + 28); -}, "slzh"); -var zh = /* @__PURE__ */ __name(function(d, b, z) { - var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl, bs = b4(d, b + 20); - var _a2 = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)], sc = _a2[0], su = _a2[1], off = _a2[2]; - return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off]; -}, "zh"); -var z64e = /* @__PURE__ */ __name(function(d, b) { - for (; b2(d, b) != 1; b += 4 + b2(d, b + 2)) - ; - return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)]; -}, "z64e"); -var exfl = /* @__PURE__ */ __name(function(ex) { - var le = 0; - if (ex) { - for (var k in ex) { - var l = ex[k].length; - if (l > 65535) - err(9); - le += l + 4; - } - } - return le; -}, "exfl"); -var wzh = /* @__PURE__ */ __name(function(d, b, f, fn, u, c, ce, co) { - var fl2 = fn.length, ex = f.extra, col = co && co.length; - var exl = exfl(ex); - wbytes(d, b, ce != null ? 33639248 : 67324752), b += 4; - if (ce != null) - d[b++] = 20, d[b++] = f.os; - d[b] = 20, b += 2; - d[b++] = f.flag << 1 | (c < 0 && 8), d[b++] = u && 8; - d[b++] = f.compression & 255, d[b++] = f.compression >> 8; - var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980; - if (y < 0 || y > 119) - err(10); - wbytes(d, b, y << 25 | dt.getMonth() + 1 << 21 | dt.getDate() << 16 | dt.getHours() << 11 | dt.getMinutes() << 5 | dt.getSeconds() >> 1), b += 4; - if (c != -1) { - wbytes(d, b, f.crc); - wbytes(d, b + 4, c < 0 ? -c - 2 : c); - wbytes(d, b + 8, f.size); - } - wbytes(d, b + 12, fl2); - wbytes(d, b + 14, exl), b += 16; - if (ce != null) { - wbytes(d, b, col); - wbytes(d, b + 6, f.attrs); - wbytes(d, b + 10, ce), b += 14; - } - d.set(fn, b); - b += fl2; - if (exl) { - for (var k in ex) { - var exf = ex[k], l = exf.length; - wbytes(d, b, +k); - wbytes(d, b + 2, l); - d.set(exf, b + 4), b += 4 + l; - } - } - if (col) - d.set(co, b), b += col; - return b; -}, "wzh"); -var wzf = /* @__PURE__ */ __name(function(o, b, c, d, e) { - wbytes(o, b, 101010256); - wbytes(o, b + 8, c); - wbytes(o, b + 10, c); - wbytes(o, b + 12, d); - wbytes(o, b + 16, e); -}, "wzf"); -var ZipPassThrough = /* @__PURE__ */ function() { - function ZipPassThrough2(filename) { - this.filename = filename; - this.c = crc(); - this.size = 0; - this.compression = 0; - } - __name(ZipPassThrough2, "ZipPassThrough"); - ZipPassThrough2.prototype.process = function(chunk, final) { - this.ondata(null, chunk, final); - }; - ZipPassThrough2.prototype.push = function(chunk, final) { - if (!this.ondata) - err(5); - this.c.p(chunk); - this.size += chunk.length; - if (final) - this.crc = this.c.d(); - this.process(chunk, final || false); - }; - return ZipPassThrough2; -}(); -var ZipDeflate = /* @__PURE__ */ function() { - function ZipDeflate2(filename, opts) { - var _this = this; - if (!opts) - opts = {}; - ZipPassThrough.call(this, filename); - this.d = new Deflate(opts, function(dat, final) { - _this.ondata(null, dat, final); - }); - this.compression = 8; - this.flag = dbf(opts.level); - } - __name(ZipDeflate2, "ZipDeflate"); - ZipDeflate2.prototype.process = function(chunk, final) { - try { - this.d.push(chunk, final); - } catch (e) { - this.ondata(e, null, final); - } - }; - ZipDeflate2.prototype.push = function(chunk, final) { - ZipPassThrough.prototype.push.call(this, chunk, final); - }; - return ZipDeflate2; -}(); -var AsyncZipDeflate = /* @__PURE__ */ function() { - function AsyncZipDeflate2(filename, opts) { - var _this = this; - if (!opts) - opts = {}; - ZipPassThrough.call(this, filename); - this.d = new AsyncDeflate(opts, function(err2, dat, final) { - _this.ondata(err2, dat, final); - }); - this.compression = 8; - this.flag = dbf(opts.level); - this.terminate = this.d.terminate; - } - __name(AsyncZipDeflate2, "AsyncZipDeflate"); - AsyncZipDeflate2.prototype.process = function(chunk, final) { - this.d.push(chunk, final); - }; - AsyncZipDeflate2.prototype.push = function(chunk, final) { - ZipPassThrough.prototype.push.call(this, chunk, final); - }; - return AsyncZipDeflate2; -}(); -var Zip = /* @__PURE__ */ function() { - function Zip2(cb) { - this.ondata = cb; - this.u = []; - this.d = 1; - } - __name(Zip2, "Zip"); - Zip2.prototype.add = function(file2) { - var _this = this; - if (!this.ondata) - err(5); - if (this.d & 2) - this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, false); - else { - var f = strToU8(file2.filename), fl_1 = f.length; - var com = file2.comment, o = com && strToU8(com); - var u = fl_1 != file2.filename.length || o && com.length != o.length; - var hl_1 = fl_1 + exfl(file2.extra) + 30; - if (fl_1 > 65535) - this.ondata(err(11, 0, 1), null, false); - var header = new u8(hl_1); - wzh(header, 0, file2, f, u, -1); - var chks_1 = [header]; - var pAll_1 = /* @__PURE__ */ __name(function() { - for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) { - var chk = chks_2[_i]; - _this.ondata(null, chk, false); - } - chks_1 = []; - }, "pAll_1"); - var tr_1 = this.d; - this.d = 0; - var ind_1 = this.u.length; - var uf_1 = mrg(file2, { - f, - u, - o, - t: /* @__PURE__ */ __name(function() { - if (file2.terminate) - file2.terminate(); - }, "t"), - r: /* @__PURE__ */ __name(function() { - pAll_1(); - if (tr_1) { - var nxt = _this.u[ind_1 + 1]; - if (nxt) - nxt.r(); - else - _this.d = 1; - } - tr_1 = 1; - }, "r") - }); - var cl_1 = 0; - file2.ondata = function(err2, dat, final) { - if (err2) { - _this.ondata(err2, dat, final); - _this.terminate(); - } else { - cl_1 += dat.length; - chks_1.push(dat); - if (final) { - var dd = new u8(16); - wbytes(dd, 0, 134695760); - wbytes(dd, 4, file2.crc); - wbytes(dd, 8, cl_1); - wbytes(dd, 12, file2.size); - chks_1.push(dd); - uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file2.crc, uf_1.size = file2.size; - if (tr_1) - uf_1.r(); - tr_1 = 1; - } else if (tr_1) - pAll_1(); - } - }; - this.u.push(uf_1); - } - }; - Zip2.prototype.end = function() { - var _this = this; - if (this.d & 2) { - this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, true); - return; - } - if (this.d) - this.e(); - else - this.u.push({ - r: /* @__PURE__ */ __name(function() { - if (!(_this.d & 1)) - return; - _this.u.splice(-1, 1); - _this.e(); - }, "r"), - t: /* @__PURE__ */ __name(function() { - }, "t") - }); - this.d = 3; - }; - Zip2.prototype.e = function() { - var bt = 0, l = 0, tl = 0; - for (var _i = 0, _a2 = this.u; _i < _a2.length; _i++) { - var f = _a2[_i]; - tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0); - } - var out = new u8(tl + 22); - for (var _b2 = 0, _c = this.u; _b2 < _c.length; _b2++) { - var f = _c[_b2]; - wzh(out, bt, f, f.f, f.u, -f.c - 2, l, f.o); - bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b; - } - wzf(out, bt, this.u.length, tl, l); - this.ondata(null, out, true); - this.d = 2; - }; - Zip2.prototype.terminate = function() { - for (var _i = 0, _a2 = this.u; _i < _a2.length; _i++) { - var f = _a2[_i]; - f.t(); - } - this.d = 2; - }; - return Zip2; -}(); -function zip(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != "function") - err(7); - var r = {}; - fltn(data, "", r, opts); - var k = Object.keys(r); - var lft = k.length, o = 0, tot = 0; - var slft = lft, files = new Array(lft); - var term = []; - var tAll = /* @__PURE__ */ __name(function() { - for (var i2 = 0; i2 < term.length; ++i2) - term[i2](); - }, "tAll"); - var cbd = /* @__PURE__ */ __name(function(a, b) { - mt(function() { - cb(a, b); - }); - }, "cbd"); - mt(function() { - cbd = cb; - }); - var cbf = /* @__PURE__ */ __name(function() { - var out = new u8(tot + 22), oe = o, cdl = tot - o; - tot = 0; - for (var i2 = 0; i2 < slft; ++i2) { - var f = files[i2]; - try { - var l = f.c.length; - wzh(out, tot, f, f.f, f.u, l); - var badd = 30 + f.f.length + exfl(f.extra); - var loc = tot + badd; - out.set(f.c, loc); - wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l; - } catch (e) { - return cbd(e, null); - } - } - wzf(out, o, files.length, cdl, oe); - cbd(null, out); - }, "cbf"); - if (!lft) - cbf(); - var _loop_1 = /* @__PURE__ */ __name(function(i2) { - var fn = k[i2]; - var _a2 = r[fn], file2 = _a2[0], p = _a2[1]; - var c = crc(), size = file2.length; - c.p(file2); - var f = strToU8(fn), s = f.length; - var com = p.comment, m = com && strToU8(com), ms = m && m.length; - var exl = exfl(p.extra); - var compression = p.level == 0 ? 0 : 8; - var cbl = /* @__PURE__ */ __name(function(e, d) { - if (e) { - tAll(); - cbd(e, null); - } else { - var l = d.length; - files[i2] = mrg(p, { - size, - crc: c.d(), - c: d, - f, - m, - u: s != fn.length || m && com.length != ms, - compression - }); - o += 30 + s + exl + l; - tot += 76 + 2 * (s + exl) + (ms || 0) + l; - if (!--lft) - cbf(); - } - }, "cbl"); - if (s > 65535) - cbl(err(11, 0, 1), null); - if (!compression) - cbl(null, file2); - else if (size < 16e4) { - try { - cbl(null, deflateSync(file2, p)); - } catch (e) { - cbl(e, null); - } - } else - term.push(deflate(file2, p, cbl)); - }, "_loop_1"); - for (var i = 0; i < slft; ++i) { - _loop_1(i); - } - return tAll; -} -__name(zip, "zip"); -function zipSync(data, opts) { - if (!opts) - opts = {}; - var r = {}; - var files = []; - fltn(data, "", r, opts); - var o = 0; - var tot = 0; - for (var fn in r) { - var _a2 = r[fn], file2 = _a2[0], p = _a2[1]; - var compression = p.level == 0 ? 0 : 8; - var f = strToU8(fn), s = f.length; - var com = p.comment, m = com && strToU8(com), ms = m && m.length; - var exl = exfl(p.extra); - if (s > 65535) - err(11); - var d = compression ? deflateSync(file2, p) : file2, l = d.length; - var c = crc(); - c.p(file2); - files.push(mrg(p, { - size: file2.length, - crc: c.d(), - c: d, - f, - m, - u: s != fn.length || m && com.length != ms, - o, - compression - })); - o += 30 + s + exl + l; - tot += 76 + 2 * (s + exl) + (ms || 0) + l; - } - var out = new u8(tot + 22), oe = o, cdl = tot - o; - for (var i = 0; i < files.length; ++i) { - var f = files[i]; - wzh(out, f.o, f, f.f, f.u, f.c.length); - var badd = 30 + f.f.length + exfl(f.extra); - out.set(f.c, f.o + badd); - wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0); - } - wzf(out, o, files.length, cdl, oe); - return out; -} -__name(zipSync, "zipSync"); -var UnzipPassThrough = /* @__PURE__ */ function() { - function UnzipPassThrough2() { - } - __name(UnzipPassThrough2, "UnzipPassThrough"); - UnzipPassThrough2.prototype.push = function(data, final) { - this.ondata(null, data, final); - }; - UnzipPassThrough2.compression = 0; - return UnzipPassThrough2; -}(); -var UnzipInflate = /* @__PURE__ */ function() { - function UnzipInflate2() { - var _this = this; - this.i = new Inflate(function(dat, final) { - _this.ondata(null, dat, final); - }); - } - __name(UnzipInflate2, "UnzipInflate"); - UnzipInflate2.prototype.push = function(data, final) { - try { - this.i.push(data, final); - } catch (e) { - this.ondata(e, null, final); - } - }; - UnzipInflate2.compression = 8; - return UnzipInflate2; -}(); -var AsyncUnzipInflate = /* @__PURE__ */ function() { - function AsyncUnzipInflate2(_, sz) { - var _this = this; - if (sz < 32e4) { - this.i = new Inflate(function(dat, final) { - _this.ondata(null, dat, final); - }); - } else { - this.i = new AsyncInflate(function(err2, dat, final) { - _this.ondata(err2, dat, final); - }); - this.terminate = this.i.terminate; - } - } - __name(AsyncUnzipInflate2, "AsyncUnzipInflate"); - AsyncUnzipInflate2.prototype.push = function(data, final) { - if (this.i.terminate) - data = slc(data, 0); - this.i.push(data, final); - }; - AsyncUnzipInflate2.compression = 8; - return AsyncUnzipInflate2; -}(); -var Unzip = /* @__PURE__ */ function() { - function Unzip2(cb) { - this.onfile = cb; - this.k = []; - this.o = { - 0: UnzipPassThrough - }; - this.p = et; - } - __name(Unzip2, "Unzip"); - Unzip2.prototype.push = function(chunk, final) { - var _this = this; - if (!this.onfile) - err(5); - if (!this.p) - err(4); - if (this.c > 0) { - var len = Math.min(this.c, chunk.length); - var toAdd = chunk.subarray(0, len); - this.c -= len; - if (this.d) - this.d.push(toAdd, !this.c); - else - this.k[0].push(toAdd); - chunk = chunk.subarray(len); - if (chunk.length) - return this.push(chunk, final); - } else { - var f = 0, i = 0, is = void 0, buf = void 0; - if (!this.p.length) - buf = chunk; - else if (!chunk.length) - buf = this.p; - else { - buf = new u8(this.p.length + chunk.length); - buf.set(this.p), buf.set(chunk, this.p.length); - } - var l = buf.length, oc = this.c, add = oc && this.d; - var _loop_2 = /* @__PURE__ */ __name(function() { - var _a2; - var sig = b4(buf, i); - if (sig == 67324752) { - f = 1, is = i; - this_1.d = null; - this_1.c = 0; - var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28); - if (l > i + 30 + fnl + es) { - var chks_3 = []; - this_1.k.unshift(chks_3); - f = 2; - var sc_1 = b4(buf, i + 18), su_1 = b4(buf, i + 22); - var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u); - if (sc_1 == 4294967295) { - _a2 = dd ? [-2] : z64e(buf, i), sc_1 = _a2[0], su_1 = _a2[1]; - } else if (dd) - sc_1 = -1; - i += es; - this_1.c = sc_1; - var d_1; - var file_1 = { - name: fn_1, - compression: cmp_1, - start: /* @__PURE__ */ __name(function() { - if (!file_1.ondata) - err(5); - if (!sc_1) - file_1.ondata(null, et, true); - else { - var ctr = _this.o[cmp_1]; - if (!ctr) - file_1.ondata(err(14, "unknown compression type " + cmp_1, 1), null, false); - d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1); - d_1.ondata = function(err2, dat3, final2) { - file_1.ondata(err2, dat3, final2); - }; - for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) { - var dat2 = chks_4[_i]; - d_1.push(dat2, false); - } - if (_this.k[0] == chks_3 && _this.c) - _this.d = d_1; - else - d_1.push(et, true); - } - }, "start"), - terminate: /* @__PURE__ */ __name(function() { - if (d_1 && d_1.terminate) - d_1.terminate(); - }, "terminate") - }; - if (sc_1 >= 0) - file_1.size = sc_1, file_1.originalSize = su_1; - this_1.onfile(file_1); - } - return "break"; - } else if (oc) { - if (sig == 134695760) { - is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0; - return "break"; - } else if (sig == 33639248) { - is = i -= 4, f = 3, this_1.c = 0; - return "break"; - } - } - }, "_loop_2"); - var this_1 = this; - for (; i < l - 4; ++i) { - var state_1 = _loop_2(); - if (state_1 === "break") - break; - } - this.p = et; - if (oc < 0) { - var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 134695760 && 4)) : buf.subarray(0, i); - if (add) - add.push(dat, !!f); - else - this.k[+(f == 2)].push(dat); - } - if (f & 2) - return this.push(buf.subarray(i), final); - this.p = buf.subarray(i); - } - if (final) { - if (this.c) - err(13); - this.p = null; - } - }; - Unzip2.prototype.register = function(decoder) { - this.o[decoder.compression] = decoder; - }; - return Unzip2; -}(); -var mt = typeof queueMicrotask == "function" ? queueMicrotask : typeof setTimeout == "function" ? setTimeout : function(fn) { - fn(); -}; -function unzip(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != "function") - err(7); - var term = []; - var tAll = /* @__PURE__ */ __name(function() { - for (var i2 = 0; i2 < term.length; ++i2) - term[i2](); - }, "tAll"); - var files = {}; - var cbd = /* @__PURE__ */ __name(function(a, b) { - mt(function() { - cb(a, b); - }); - }, "cbd"); - mt(function() { - cbd = cb; - }); - var e = data.length - 22; - for (; b4(data, e) != 101010256; --e) { - if (!e || data.length - e > 65558) { - cbd(err(13, 0, 1), null); - return tAll; - } - } - ; - var lft = b2(data, e + 8); - if (lft) { - var c = lft; - var o = b4(data, e + 16); - var z = o == 4294967295 || c == 65535; - if (z) { - var ze = b4(data, e - 12); - z = b4(data, ze) == 101075792; - if (z) { - c = lft = b4(data, ze + 32); - o = b4(data, ze + 48); - } - } - var fltr = opts && opts.filter; - var _loop_3 = /* @__PURE__ */ __name(function(i2) { - var _a2 = zh(data, o, z), c_1 = _a2[0], sc = _a2[1], su = _a2[2], fn = _a2[3], no = _a2[4], off = _a2[5], b = slzh(data, off); - o = no; - var cbl = /* @__PURE__ */ __name(function(e2, d) { - if (e2) { - tAll(); - cbd(e2, null); - } else { - if (d) - files[fn] = d; - if (!--lft) - cbd(null, files); - } - }, "cbl"); - if (!fltr || fltr({ - name: fn, - size: sc, - originalSize: su, - compression: c_1 - })) { - if (!c_1) - cbl(null, slc(data, b, b + sc)); - else if (c_1 == 8) { - var infl = data.subarray(b, b + sc); - if (su < 524288 || sc > 0.8 * su) { - try { - cbl(null, inflateSync(infl, { out: new u8(su) })); - } catch (e2) { - cbl(e2, null); - } - } else - term.push(inflate(infl, { size: su }, cbl)); - } else - cbl(err(14, "unknown compression type " + c_1, 1), null); - } else - cbl(null, null); - }, "_loop_3"); - for (var i = 0; i < c; ++i) { - _loop_3(i); - } - } else - cbd(null, {}); - return tAll; -} -__name(unzip, "unzip"); -function unzipSync(data, opts) { - var files = {}; - var e = data.length - 22; - for (; b4(data, e) != 101010256; --e) { - if (!e || data.length - e > 65558) - err(13); - } - ; - var c = b2(data, e + 8); - if (!c) - return {}; - var o = b4(data, e + 16); - var z = o == 4294967295 || c == 65535; - if (z) { - var ze = b4(data, e - 12); - z = b4(data, ze) == 101075792; - if (z) { - c = b4(data, ze + 32); - o = b4(data, ze + 48); - } - } - var fltr = opts && opts.filter; - for (var i = 0; i < c; ++i) { - var _a2 = zh(data, o, z), c_2 = _a2[0], sc = _a2[1], su = _a2[2], fn = _a2[3], no = _a2[4], off = _a2[5], b = slzh(data, off); - o = no; - if (!fltr || fltr({ - name: fn, - size: sc, - originalSize: su, - compression: c_2 - })) { - if (!c_2) - files[fn] = slc(data, b, b + sc); - else if (c_2 == 8) - files[fn] = inflateSync(data.subarray(b, b + sc), { out: new u8(su) }); - else - err(14, "unknown compression type " + c_2); - } - } - return files; -} -__name(unzipSync, "unzipSync"); -function findSpan(p, u, U) { - const n = U.length - p - 1; - if (u >= U[n]) { - return n - 1; - } - if (u <= U[p]) { - return p; - } - let low = p; - let high = n; - let mid = Math.floor((low + high) / 2); - while (u < U[mid] || u >= U[mid + 1]) { - if (u < U[mid]) { - high = mid; - } else { - low = mid; - } - mid = Math.floor((low + high) / 2); - } - return mid; -} -__name(findSpan, "findSpan"); -function calcBasisFunctions(span, u, p, U) { - const N = []; - const left = []; - const right = []; - N[0] = 1; - for (let j = 1; j <= p; ++j) { - left[j] = u - U[span + 1 - j]; - right[j] = U[span + j] - u; - let saved = 0; - for (let r = 0; r < j; ++r) { - const rv = right[r + 1]; - const lv = left[j - r]; - const temp = N[r] / (rv + lv); - N[r] = saved + rv * temp; - saved = lv * temp; - } - N[j] = saved; - } - return N; -} -__name(calcBasisFunctions, "calcBasisFunctions"); -function calcBSplinePoint(p, U, P, u) { - const span = findSpan(p, u, U); - const N = calcBasisFunctions(span, u, p, U); - const C = new Vector4(0, 0, 0, 0); - for (let j = 0; j <= p; ++j) { - const point = P[span - p + j]; - const Nj = N[j]; - const wNj = point.w * Nj; - C.x += point.x * wNj; - C.y += point.y * wNj; - C.z += point.z * wNj; - C.w += point.w * Nj; - } - return C; -} -__name(calcBSplinePoint, "calcBSplinePoint"); -function calcBasisFunctionDerivatives(span, u, p, n, U) { - const zeroArr = []; - for (let i = 0; i <= p; ++i) - zeroArr[i] = 0; - const ders = []; - for (let i = 0; i <= n; ++i) - ders[i] = zeroArr.slice(0); - const ndu = []; - for (let i = 0; i <= p; ++i) - ndu[i] = zeroArr.slice(0); - ndu[0][0] = 1; - const left = zeroArr.slice(0); - const right = zeroArr.slice(0); - for (let j = 1; j <= p; ++j) { - left[j] = u - U[span + 1 - j]; - right[j] = U[span + j] - u; - let saved = 0; - for (let r2 = 0; r2 < j; ++r2) { - const rv = right[r2 + 1]; - const lv = left[j - r2]; - ndu[j][r2] = rv + lv; - const temp = ndu[r2][j - 1] / ndu[j][r2]; - ndu[r2][j] = saved + rv * temp; - saved = lv * temp; - } - ndu[j][j] = saved; - } - for (let j = 0; j <= p; ++j) { - ders[0][j] = ndu[j][p]; - } - for (let r2 = 0; r2 <= p; ++r2) { - let s1 = 0; - let s2 = 1; - const a = []; - for (let i = 0; i <= p; ++i) { - a[i] = zeroArr.slice(0); - } - a[0][0] = 1; - for (let k = 1; k <= n; ++k) { - let d = 0; - const rk = r2 - k; - const pk = p - k; - if (r2 >= k) { - a[s2][0] = a[s1][0] / ndu[pk + 1][rk]; - d = a[s2][0] * ndu[rk][pk]; - } - const j1 = rk >= -1 ? 1 : -rk; - const j2 = r2 - 1 <= pk ? k - 1 : p - r2; - for (let j3 = j1; j3 <= j2; ++j3) { - a[s2][j3] = (a[s1][j3] - a[s1][j3 - 1]) / ndu[pk + 1][rk + j3]; - d += a[s2][j3] * ndu[rk + j3][pk]; - } - if (r2 <= pk) { - a[s2][k] = -a[s1][k - 1] / ndu[pk + 1][r2]; - d += a[s2][k] * ndu[r2][pk]; - } - ders[k][r2] = d; - const j = s1; - s1 = s2; - s2 = j; - } - } - let r = p; - for (let k = 1; k <= n; ++k) { - for (let j = 0; j <= p; ++j) { - ders[k][j] *= r; - } - r *= p - k; - } - return ders; -} -__name(calcBasisFunctionDerivatives, "calcBasisFunctionDerivatives"); -function calcBSplineDerivatives(p, U, P, u, nd) { - const du = nd < p ? nd : p; - const CK = []; - const span = findSpan(p, u, U); - const nders = calcBasisFunctionDerivatives(span, u, p, du, U); - const Pw = []; - for (let i = 0; i < P.length; ++i) { - const point = P[i].clone(); - const w = point.w; - point.x *= w; - point.y *= w; - point.z *= w; - Pw[i] = point; - } - for (let k = 0; k <= du; ++k) { - const point = Pw[span - p].clone().multiplyScalar(nders[k][0]); - for (let j = 1; j <= p; ++j) { - point.add(Pw[span - p + j].clone().multiplyScalar(nders[k][j])); - } - CK[k] = point; - } - for (let k = du + 1; k <= nd + 1; ++k) { - CK[k] = new Vector4(0, 0, 0); - } - return CK; -} -__name(calcBSplineDerivatives, "calcBSplineDerivatives"); -function calcKoverI(k, i) { - let nom = 1; - for (let j = 2; j <= k; ++j) { - nom *= j; - } - let denom = 1; - for (let j = 2; j <= i; ++j) { - denom *= j; - } - for (let j = 2; j <= k - i; ++j) { - denom *= j; - } - return nom / denom; -} -__name(calcKoverI, "calcKoverI"); -function calcRationalCurveDerivatives(Pders) { - const nd = Pders.length; - const Aders = []; - const wders = []; - for (let i = 0; i < nd; ++i) { - const point = Pders[i]; - Aders[i] = new Vector3(point.x, point.y, point.z); - wders[i] = point.w; - } - const CK = []; - for (let k = 0; k < nd; ++k) { - const v = Aders[k].clone(); - for (let i = 1; i <= k; ++i) { - v.sub(CK[k - i].clone().multiplyScalar(calcKoverI(k, i) * wders[i])); - } - CK[k] = v.divideScalar(wders[0]); - } - return CK; -} -__name(calcRationalCurveDerivatives, "calcRationalCurveDerivatives"); -function calcNURBSDerivatives(p, U, P, u, nd) { - const Pders = calcBSplineDerivatives(p, U, P, u, nd); - return calcRationalCurveDerivatives(Pders); -} -__name(calcNURBSDerivatives, "calcNURBSDerivatives"); -function calcSurfacePoint(p, q, U, V, P, u, v, target) { - const uspan = findSpan(p, u, U); - const vspan = findSpan(q, v, V); - const Nu = calcBasisFunctions(uspan, u, p, U); - const Nv = calcBasisFunctions(vspan, v, q, V); - const temp = []; - for (let l = 0; l <= q; ++l) { - temp[l] = new Vector4(0, 0, 0, 0); - for (let k = 0; k <= p; ++k) { - const point = P[uspan - p + k][vspan - q + l].clone(); - const w = point.w; - point.x *= w; - point.y *= w; - point.z *= w; - temp[l].add(point.multiplyScalar(Nu[k])); - } - } - const Sw = new Vector4(0, 0, 0, 0); - for (let l = 0; l <= q; ++l) { - Sw.add(temp[l].multiplyScalar(Nv[l])); - } - Sw.divideScalar(Sw.w); - target.set(Sw.x, Sw.y, Sw.z); -} -__name(calcSurfacePoint, "calcSurfacePoint"); -function calcVolumePoint(p, q, r, U, V, W, P, u, v, w, target) { - const uspan = findSpan(p, u, U); - const vspan = findSpan(q, v, V); - const wspan = findSpan(r, w, W); - const Nu = calcBasisFunctions(uspan, u, p, U); - const Nv = calcBasisFunctions(vspan, v, q, V); - const Nw = calcBasisFunctions(wspan, w, r, W); - const temp = []; - for (let m = 0; m <= r; ++m) { - temp[m] = []; - for (let l = 0; l <= q; ++l) { - temp[m][l] = new Vector4(0, 0, 0, 0); - for (let k = 0; k <= p; ++k) { - const point = P[uspan - p + k][vspan - q + l][wspan - r + m].clone(); - const w2 = point.w; - point.x *= w2; - point.y *= w2; - point.z *= w2; - temp[m][l].add(point.multiplyScalar(Nu[k])); - } - } - } - const Sw = new Vector4(0, 0, 0, 0); - for (let m = 0; m <= r; ++m) { - for (let l = 0; l <= q; ++l) { - Sw.add(temp[m][l].multiplyScalar(Nw[m]).multiplyScalar(Nv[l])); - } - } - Sw.divideScalar(Sw.w); - target.set(Sw.x, Sw.y, Sw.z); -} -__name(calcVolumePoint, "calcVolumePoint"); -class NURBSCurve extends Curve { - static { - __name(this, "NURBSCurve"); - } - constructor(degree, knots, controlPoints, startKnot, endKnot) { - super(); - const knotsLength = knots ? knots.length - 1 : 0; - const pointsLength = controlPoints ? controlPoints.length : 0; - this.degree = degree; - this.knots = knots; - this.controlPoints = []; - this.startKnot = startKnot || 0; - this.endKnot = endKnot || knotsLength; - for (let i = 0; i < pointsLength; ++i) { - const point = controlPoints[i]; - this.controlPoints[i] = new Vector4(point.x, point.y, point.z, point.w); - } - } - getPoint(t2, optionalTarget = new Vector3()) { - const point = optionalTarget; - const u = this.knots[this.startKnot] + t2 * (this.knots[this.endKnot] - this.knots[this.startKnot]); - const hpoint = calcBSplinePoint(this.degree, this.knots, this.controlPoints, u); - if (hpoint.w !== 1) { - hpoint.divideScalar(hpoint.w); - } - return point.set(hpoint.x, hpoint.y, hpoint.z); - } - getTangent(t2, optionalTarget = new Vector3()) { - const tangent = optionalTarget; - const u = this.knots[0] + t2 * (this.knots[this.knots.length - 1] - this.knots[0]); - const ders = calcNURBSDerivatives(this.degree, this.knots, this.controlPoints, u, 1); - tangent.copy(ders[1]).normalize(); - return tangent; - } - toJSON() { - const data = super.toJSON(); - data.degree = this.degree; - data.knots = [...this.knots]; - data.controlPoints = this.controlPoints.map((p) => p.toArray()); - data.startKnot = this.startKnot; - data.endKnot = this.endKnot; - return data; - } - fromJSON(json) { - super.fromJSON(json); - this.degree = json.degree; - this.knots = [...json.knots]; - this.controlPoints = json.controlPoints.map((p) => new Vector4(p[0], p[1], p[2], p[3])); - this.startKnot = json.startKnot; - this.endKnot = json.endKnot; - return this; - } -} -let fbxTree; -let connections; -let sceneGraph; -class FBXLoader extends Loader { - static { - __name(this, "FBXLoader"); - } - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - const path = scope.path === "" ? LoaderUtils.extractUrlBase(url) : scope.path; - const loader = new FileLoader(this.manager); - loader.setPath(scope.path); - loader.setResponseType("arraybuffer"); - loader.setRequestHeader(scope.requestHeader); - loader.setWithCredentials(scope.withCredentials); - loader.load(url, function(buffer) { - try { - onLoad(scope.parse(buffer, path)); - } catch (e) { - if (onError) { - onError(e); - } else { - console.error(e); - } - scope.manager.itemError(url); - } - }, onProgress, onError); - } - parse(FBXBuffer, path) { - if (isFbxFormatBinary(FBXBuffer)) { - fbxTree = new BinaryParser().parse(FBXBuffer); - } else { - const FBXText = convertArrayBufferToString(FBXBuffer); - if (!isFbxFormatASCII(FBXText)) { - throw new Error("THREE.FBXLoader: Unknown format."); - } - if (getFbxVersion(FBXText) < 7e3) { - throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + getFbxVersion(FBXText)); - } - fbxTree = new TextParser().parse(FBXText); - } - const textureLoader = new TextureLoader(this.manager).setPath(this.resourcePath || path).setCrossOrigin(this.crossOrigin); - return new FBXTreeParser(textureLoader, this.manager).parse(fbxTree); - } -} -class FBXTreeParser { - static { - __name(this, "FBXTreeParser"); - } - constructor(textureLoader, manager) { - this.textureLoader = textureLoader; - this.manager = manager; - } - parse() { - connections = this.parseConnections(); - const images = this.parseImages(); - const textures = this.parseTextures(images); - const materials = this.parseMaterials(textures); - const deformers = this.parseDeformers(); - const geometryMap = new GeometryParser().parse(deformers); - this.parseScene(deformers, geometryMap, materials); - return sceneGraph; - } - // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry ) - // and details the connection type - parseConnections() { - const connectionMap = /* @__PURE__ */ new Map(); - if ("Connections" in fbxTree) { - const rawConnections = fbxTree.Connections.connections; - rawConnections.forEach(function(rawConnection) { - const fromID = rawConnection[0]; - const toID = rawConnection[1]; - const relationship = rawConnection[2]; - if (!connectionMap.has(fromID)) { - connectionMap.set(fromID, { - parents: [], - children: [] - }); - } - const parentRelationship = { ID: toID, relationship }; - connectionMap.get(fromID).parents.push(parentRelationship); - if (!connectionMap.has(toID)) { - connectionMap.set(toID, { - parents: [], - children: [] - }); - } - const childRelationship = { ID: fromID, relationship }; - connectionMap.get(toID).children.push(childRelationship); - }); - } - return connectionMap; - } - // Parse FBXTree.Objects.Video for embedded image data - // These images are connected to textures in FBXTree.Objects.Textures - // via FBXTree.Connections. - parseImages() { - const images = {}; - const blobs = {}; - if ("Video" in fbxTree.Objects) { - const videoNodes = fbxTree.Objects.Video; - for (const nodeID in videoNodes) { - const videoNode = videoNodes[nodeID]; - const id2 = parseInt(nodeID); - images[id2] = videoNode.RelativeFilename || videoNode.Filename; - if ("Content" in videoNode) { - const arrayBufferContent = videoNode.Content instanceof ArrayBuffer && videoNode.Content.byteLength > 0; - const base64Content = typeof videoNode.Content === "string" && videoNode.Content !== ""; - if (arrayBufferContent || base64Content) { - const image = this.parseImage(videoNodes[nodeID]); - blobs[videoNode.RelativeFilename || videoNode.Filename] = image; - } - } - } - } - for (const id2 in images) { - const filename = images[id2]; - if (blobs[filename] !== void 0) images[id2] = blobs[filename]; - else images[id2] = images[id2].split("\\").pop(); - } - return images; - } - // Parse embedded image data in FBXTree.Video.Content - parseImage(videoNode) { - const content = videoNode.Content; - const fileName = videoNode.RelativeFilename || videoNode.Filename; - const extension = fileName.slice(fileName.lastIndexOf(".") + 1).toLowerCase(); - let type; - switch (extension) { - case "bmp": - type = "image/bmp"; - break; - case "jpg": - case "jpeg": - type = "image/jpeg"; - break; - case "png": - type = "image/png"; - break; - case "tif": - type = "image/tiff"; - break; - case "tga": - if (this.manager.getHandler(".tga") === null) { - console.warn("FBXLoader: TGA loader not found, skipping ", fileName); - } - type = "image/tga"; - break; - default: - console.warn('FBXLoader: Image type "' + extension + '" is not supported.'); - return; - } - if (typeof content === "string") { - return "data:" + type + ";base64," + content; - } else { - const array = new Uint8Array(content); - return window.URL.createObjectURL(new Blob([array], { type })); - } - } - // Parse nodes in FBXTree.Objects.Texture - // These contain details such as UV scaling, cropping, rotation etc and are connected - // to images in FBXTree.Objects.Video - parseTextures(images) { - const textureMap = /* @__PURE__ */ new Map(); - if ("Texture" in fbxTree.Objects) { - const textureNodes = fbxTree.Objects.Texture; - for (const nodeID in textureNodes) { - const texture = this.parseTexture(textureNodes[nodeID], images); - textureMap.set(parseInt(nodeID), texture); - } - } - return textureMap; - } - // Parse individual node in FBXTree.Objects.Texture - parseTexture(textureNode, images) { - const texture = this.loadTexture(textureNode, images); - texture.ID = textureNode.id; - texture.name = textureNode.attrName; - const wrapModeU = textureNode.WrapModeU; - const wrapModeV = textureNode.WrapModeV; - const valueU = wrapModeU !== void 0 ? wrapModeU.value : 0; - const valueV = wrapModeV !== void 0 ? wrapModeV.value : 0; - texture.wrapS = valueU === 0 ? RepeatWrapping : ClampToEdgeWrapping; - texture.wrapT = valueV === 0 ? RepeatWrapping : ClampToEdgeWrapping; - if ("Scaling" in textureNode) { - const values = textureNode.Scaling.value; - texture.repeat.x = values[0]; - texture.repeat.y = values[1]; - } - if ("Translation" in textureNode) { - const values = textureNode.Translation.value; - texture.offset.x = values[0]; - texture.offset.y = values[1]; - } - return texture; - } - // load a texture specified as a blob or data URI, or via an external URL using TextureLoader - loadTexture(textureNode, images) { - const nonNativeExtensions = /* @__PURE__ */ new Set(["tga", "tif", "tiff", "exr", "dds", "hdr", "ktx2"]); - const extension = textureNode.FileName.split(".").pop().toLowerCase(); - const loader = nonNativeExtensions.has(extension) ? this.manager.getHandler(`.${extension}`) : this.textureLoader; - if (!loader) { - console.warn( - `FBXLoader: ${extension.toUpperCase()} loader not found, creating placeholder texture for`, - textureNode.RelativeFilename - ); - return new Texture(); - } - const loaderPath = loader.path; - if (!loaderPath) { - loader.setPath(this.textureLoader.path); - } - const children = connections.get(textureNode.id).children; - let fileName; - if (children !== void 0 && children.length > 0 && images[children[0].ID] !== void 0) { - fileName = images[children[0].ID]; - if (fileName.indexOf("blob:") === 0 || fileName.indexOf("data:") === 0) { - loader.setPath(void 0); - } - } - const texture = loader.load(fileName); - loader.setPath(loaderPath); - return texture; - } - // Parse nodes in FBXTree.Objects.Material - parseMaterials(textureMap) { - const materialMap = /* @__PURE__ */ new Map(); - if ("Material" in fbxTree.Objects) { - const materialNodes = fbxTree.Objects.Material; - for (const nodeID in materialNodes) { - const material = this.parseMaterial(materialNodes[nodeID], textureMap); - if (material !== null) materialMap.set(parseInt(nodeID), material); - } - } - return materialMap; - } - // Parse single node in FBXTree.Objects.Material - // Materials are connected to texture maps in FBXTree.Objects.Textures - // FBX format currently only supports Lambert and Phong shading models - parseMaterial(materialNode, textureMap) { - const ID = materialNode.id; - const name = materialNode.attrName; - let type = materialNode.ShadingModel; - if (typeof type === "object") { - type = type.value; - } - if (!connections.has(ID)) return null; - const parameters = this.parseParameters(materialNode, textureMap, ID); - let material; - switch (type.toLowerCase()) { - case "phong": - material = new MeshPhongMaterial(); - break; - case "lambert": - material = new MeshLambertMaterial(); - break; - default: - console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', type); - material = new MeshPhongMaterial(); - break; - } - material.setValues(parameters); - material.name = name; - return material; - } - // Parse FBX material and return parameters suitable for a three.js material - // Also parse the texture map and return any textures associated with the material - parseParameters(materialNode, textureMap, ID) { - const parameters = {}; - if (materialNode.BumpFactor) { - parameters.bumpScale = materialNode.BumpFactor.value; - } - if (materialNode.Diffuse) { - parameters.color = ColorManagement.toWorkingColorSpace(new Color().fromArray(materialNode.Diffuse.value), SRGBColorSpace); - } else if (materialNode.DiffuseColor && (materialNode.DiffuseColor.type === "Color" || materialNode.DiffuseColor.type === "ColorRGB")) { - parameters.color = ColorManagement.toWorkingColorSpace(new Color().fromArray(materialNode.DiffuseColor.value), SRGBColorSpace); - } - if (materialNode.DisplacementFactor) { - parameters.displacementScale = materialNode.DisplacementFactor.value; - } - if (materialNode.Emissive) { - parameters.emissive = ColorManagement.toWorkingColorSpace(new Color().fromArray(materialNode.Emissive.value), SRGBColorSpace); - } else if (materialNode.EmissiveColor && (materialNode.EmissiveColor.type === "Color" || materialNode.EmissiveColor.type === "ColorRGB")) { - parameters.emissive = ColorManagement.toWorkingColorSpace(new Color().fromArray(materialNode.EmissiveColor.value), SRGBColorSpace); - } - if (materialNode.EmissiveFactor) { - parameters.emissiveIntensity = parseFloat(materialNode.EmissiveFactor.value); - } - parameters.opacity = 1 - (materialNode.TransparencyFactor ? parseFloat(materialNode.TransparencyFactor.value) : 0); - if (parameters.opacity === 1 || parameters.opacity === 0) { - parameters.opacity = materialNode.Opacity ? parseFloat(materialNode.Opacity.value) : null; - if (parameters.opacity === null) { - parameters.opacity = 1 - (materialNode.TransparentColor ? parseFloat(materialNode.TransparentColor.value[0]) : 0); - } - } - if (parameters.opacity < 1) { - parameters.transparent = true; - } - if (materialNode.ReflectionFactor) { - parameters.reflectivity = materialNode.ReflectionFactor.value; - } - if (materialNode.Shininess) { - parameters.shininess = materialNode.Shininess.value; - } - if (materialNode.Specular) { - parameters.specular = ColorManagement.toWorkingColorSpace(new Color().fromArray(materialNode.Specular.value), SRGBColorSpace); - } else if (materialNode.SpecularColor && materialNode.SpecularColor.type === "Color") { - parameters.specular = ColorManagement.toWorkingColorSpace(new Color().fromArray(materialNode.SpecularColor.value), SRGBColorSpace); - } - const scope = this; - connections.get(ID).children.forEach(function(child) { - const type = child.relationship; - switch (type) { - case "Bump": - parameters.bumpMap = scope.getTexture(textureMap, child.ID); - break; - case "Maya|TEX_ao_map": - parameters.aoMap = scope.getTexture(textureMap, child.ID); - break; - case "DiffuseColor": - case "Maya|TEX_color_map": - parameters.map = scope.getTexture(textureMap, child.ID); - if (parameters.map !== void 0) { - parameters.map.colorSpace = SRGBColorSpace; - } - break; - case "DisplacementColor": - parameters.displacementMap = scope.getTexture(textureMap, child.ID); - break; - case "EmissiveColor": - parameters.emissiveMap = scope.getTexture(textureMap, child.ID); - if (parameters.emissiveMap !== void 0) { - parameters.emissiveMap.colorSpace = SRGBColorSpace; - } - break; - case "NormalMap": - case "Maya|TEX_normal_map": - parameters.normalMap = scope.getTexture(textureMap, child.ID); - break; - case "ReflectionColor": - parameters.envMap = scope.getTexture(textureMap, child.ID); - if (parameters.envMap !== void 0) { - parameters.envMap.mapping = EquirectangularReflectionMapping; - parameters.envMap.colorSpace = SRGBColorSpace; - } - break; - case "SpecularColor": - parameters.specularMap = scope.getTexture(textureMap, child.ID); - if (parameters.specularMap !== void 0) { - parameters.specularMap.colorSpace = SRGBColorSpace; - } - break; - case "TransparentColor": - case "TransparencyFactor": - parameters.alphaMap = scope.getTexture(textureMap, child.ID); - parameters.transparent = true; - break; - case "AmbientColor": - case "ShininessExponent": - case "SpecularFactor": - case "VectorDisplacementColor": - default: - console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.", type); - break; - } - }); - return parameters; - } - // get a texture from the textureMap for use by a material. - getTexture(textureMap, id2) { - if ("LayeredTexture" in fbxTree.Objects && id2 in fbxTree.Objects.LayeredTexture) { - console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."); - id2 = connections.get(id2).children[0].ID; - } - return textureMap.get(id2); - } - // Parse nodes in FBXTree.Objects.Deformer - // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here - // Generates map of Skeleton-like objects for use later when generating and binding skeletons. - parseDeformers() { - const skeletons = {}; - const morphTargets = {}; - if ("Deformer" in fbxTree.Objects) { - const DeformerNodes = fbxTree.Objects.Deformer; - for (const nodeID in DeformerNodes) { - const deformerNode = DeformerNodes[nodeID]; - const relationships = connections.get(parseInt(nodeID)); - if (deformerNode.attrType === "Skin") { - const skeleton = this.parseSkeleton(relationships, DeformerNodes); - skeleton.ID = nodeID; - if (relationships.parents.length > 1) console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."); - skeleton.geometryID = relationships.parents[0].ID; - skeletons[nodeID] = skeleton; - } else if (deformerNode.attrType === "BlendShape") { - const morphTarget = { - id: nodeID - }; - morphTarget.rawTargets = this.parseMorphTargets(relationships, DeformerNodes); - morphTarget.id = nodeID; - if (relationships.parents.length > 1) console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."); - morphTargets[nodeID] = morphTarget; - } - } - } - return { - skeletons, - morphTargets - }; - } - // Parse single nodes in FBXTree.Objects.Deformer - // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster' - // Each skin node represents a skeleton and each cluster node represents a bone - parseSkeleton(relationships, deformerNodes) { - const rawBones = []; - relationships.children.forEach(function(child) { - const boneNode = deformerNodes[child.ID]; - if (boneNode.attrType !== "Cluster") return; - const rawBone = { - ID: child.ID, - indices: [], - weights: [], - transformLink: new Matrix4().fromArray(boneNode.TransformLink.a) - // transform: new Matrix4().fromArray( boneNode.Transform.a ), - // linkMode: boneNode.Mode, - }; - if ("Indexes" in boneNode) { - rawBone.indices = boneNode.Indexes.a; - rawBone.weights = boneNode.Weights.a; - } - rawBones.push(rawBone); - }); - return { - rawBones, - bones: [] - }; - } - // The top level morph deformer node has type "BlendShape" and sub nodes have type "BlendShapeChannel" - parseMorphTargets(relationships, deformerNodes) { - const rawMorphTargets = []; - for (let i = 0; i < relationships.children.length; i++) { - const child = relationships.children[i]; - const morphTargetNode = deformerNodes[child.ID]; - const rawMorphTarget = { - name: morphTargetNode.attrName, - initialWeight: morphTargetNode.DeformPercent, - id: morphTargetNode.id, - fullWeights: morphTargetNode.FullWeights.a - }; - if (morphTargetNode.attrType !== "BlendShapeChannel") return; - rawMorphTarget.geoID = connections.get(parseInt(child.ID)).children.filter(function(child2) { - return child2.relationship === void 0; - })[0].ID; - rawMorphTargets.push(rawMorphTarget); - } - return rawMorphTargets; - } - // create the main Group() to be returned by the loader - parseScene(deformers, geometryMap, materialMap) { - sceneGraph = new Group(); - const modelMap = this.parseModels(deformers.skeletons, geometryMap, materialMap); - const modelNodes = fbxTree.Objects.Model; - const scope = this; - modelMap.forEach(function(model) { - const modelNode = modelNodes[model.ID]; - scope.setLookAtProperties(model, modelNode); - const parentConnections = connections.get(model.ID).parents; - parentConnections.forEach(function(connection) { - const parent = modelMap.get(connection.ID); - if (parent !== void 0) parent.add(model); - }); - if (model.parent === null) { - sceneGraph.add(model); - } - }); - this.bindSkeleton(deformers.skeletons, geometryMap, modelMap); - this.addGlobalSceneSettings(); - sceneGraph.traverse(function(node) { - if (node.userData.transformData) { - if (node.parent) { - node.userData.transformData.parentMatrix = node.parent.matrix; - node.userData.transformData.parentMatrixWorld = node.parent.matrixWorld; - } - const transform = generateTransform(node.userData.transformData); - node.applyMatrix4(transform); - node.updateWorldMatrix(); - } - }); - const animations = new AnimationParser().parse(); - if (sceneGraph.children.length === 1 && sceneGraph.children[0].isGroup) { - sceneGraph.children[0].animations = animations; - sceneGraph = sceneGraph.children[0]; - } - sceneGraph.animations = animations; - } - // parse nodes in FBXTree.Objects.Model - parseModels(skeletons, geometryMap, materialMap) { - const modelMap = /* @__PURE__ */ new Map(); - const modelNodes = fbxTree.Objects.Model; - for (const nodeID in modelNodes) { - const id2 = parseInt(nodeID); - const node = modelNodes[nodeID]; - const relationships = connections.get(id2); - let model = this.buildSkeleton(relationships, skeletons, id2, node.attrName); - if (!model) { - switch (node.attrType) { - case "Camera": - model = this.createCamera(relationships); - break; - case "Light": - model = this.createLight(relationships); - break; - case "Mesh": - model = this.createMesh(relationships, geometryMap, materialMap); - break; - case "NurbsCurve": - model = this.createCurve(relationships, geometryMap); - break; - case "LimbNode": - case "Root": - model = new Bone(); - break; - case "Null": - default: - model = new Group(); - break; - } - model.name = node.attrName ? PropertyBinding.sanitizeNodeName(node.attrName) : ""; - model.userData.originalName = node.attrName; - model.ID = id2; - } - this.getTransformData(model, node); - modelMap.set(id2, model); - } - return modelMap; - } - buildSkeleton(relationships, skeletons, id2, name) { - let bone = null; - relationships.parents.forEach(function(parent) { - for (const ID in skeletons) { - const skeleton = skeletons[ID]; - skeleton.rawBones.forEach(function(rawBone, i) { - if (rawBone.ID === parent.ID) { - const subBone = bone; - bone = new Bone(); - bone.matrixWorld.copy(rawBone.transformLink); - bone.name = name ? PropertyBinding.sanitizeNodeName(name) : ""; - bone.userData.originalName = name; - bone.ID = id2; - skeleton.bones[i] = bone; - if (subBone !== null) { - bone.add(subBone); - } - } - }); - } - }); - return bone; - } - // create a PerspectiveCamera or OrthographicCamera - createCamera(relationships) { - let model; - let cameraAttribute; - relationships.children.forEach(function(child) { - const attr = fbxTree.Objects.NodeAttribute[child.ID]; - if (attr !== void 0) { - cameraAttribute = attr; - } - }); - if (cameraAttribute === void 0) { - model = new Object3D(); - } else { - let type = 0; - if (cameraAttribute.CameraProjectionType !== void 0 && cameraAttribute.CameraProjectionType.value === 1) { - type = 1; - } - let nearClippingPlane = 1; - if (cameraAttribute.NearPlane !== void 0) { - nearClippingPlane = cameraAttribute.NearPlane.value / 1e3; - } - let farClippingPlane = 1e3; - if (cameraAttribute.FarPlane !== void 0) { - farClippingPlane = cameraAttribute.FarPlane.value / 1e3; - } - let width = window.innerWidth; - let height = window.innerHeight; - if (cameraAttribute.AspectWidth !== void 0 && cameraAttribute.AspectHeight !== void 0) { - width = cameraAttribute.AspectWidth.value; - height = cameraAttribute.AspectHeight.value; - } - const aspect2 = width / height; - let fov2 = 45; - if (cameraAttribute.FieldOfView !== void 0) { - fov2 = cameraAttribute.FieldOfView.value; - } - const focalLength = cameraAttribute.FocalLength ? cameraAttribute.FocalLength.value : null; - switch (type) { - case 0: - model = new PerspectiveCamera(fov2, aspect2, nearClippingPlane, farClippingPlane); - if (focalLength !== null) model.setFocalLength(focalLength); - break; - case 1: - console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."); - model = new Object3D(); - break; - default: - console.warn("THREE.FBXLoader: Unknown camera type " + type + "."); - model = new Object3D(); - break; - } - } - return model; - } - // Create a DirectionalLight, PointLight or SpotLight - createLight(relationships) { - let model; - let lightAttribute; - relationships.children.forEach(function(child) { - const attr = fbxTree.Objects.NodeAttribute[child.ID]; - if (attr !== void 0) { - lightAttribute = attr; - } - }); - if (lightAttribute === void 0) { - model = new Object3D(); - } else { - let type; - if (lightAttribute.LightType === void 0) { - type = 0; - } else { - type = lightAttribute.LightType.value; - } - let color = 16777215; - if (lightAttribute.Color !== void 0) { - color = ColorManagement.toWorkingColorSpace(new Color().fromArray(lightAttribute.Color.value), SRGBColorSpace); - } - let intensity = lightAttribute.Intensity === void 0 ? 1 : lightAttribute.Intensity.value / 100; - if (lightAttribute.CastLightOnObject !== void 0 && lightAttribute.CastLightOnObject.value === 0) { - intensity = 0; - } - let distance = 0; - if (lightAttribute.FarAttenuationEnd !== void 0) { - if (lightAttribute.EnableFarAttenuation !== void 0 && lightAttribute.EnableFarAttenuation.value === 0) { - distance = 0; - } else { - distance = lightAttribute.FarAttenuationEnd.value; - } - } - const decay = 1; - switch (type) { - case 0: - model = new PointLight(color, intensity, distance, decay); - break; - case 1: - model = new DirectionalLight(color, intensity); - break; - case 2: - let angle = Math.PI / 3; - if (lightAttribute.InnerAngle !== void 0) { - angle = MathUtils.degToRad(lightAttribute.InnerAngle.value); - } - let penumbra = 0; - if (lightAttribute.OuterAngle !== void 0) { - penumbra = MathUtils.degToRad(lightAttribute.OuterAngle.value); - penumbra = Math.max(penumbra, 1); - } - model = new SpotLight(color, intensity, distance, angle, penumbra, decay); - break; - default: - console.warn("THREE.FBXLoader: Unknown light type " + lightAttribute.LightType.value + ", defaulting to a PointLight."); - model = new PointLight(color, intensity); - break; - } - if (lightAttribute.CastShadows !== void 0 && lightAttribute.CastShadows.value === 1) { - model.castShadow = true; - } - } - return model; - } - createMesh(relationships, geometryMap, materialMap) { - let model; - let geometry = null; - let material = null; - const materials = []; - relationships.children.forEach(function(child) { - if (geometryMap.has(child.ID)) { - geometry = geometryMap.get(child.ID); - } - if (materialMap.has(child.ID)) { - materials.push(materialMap.get(child.ID)); - } - }); - if (materials.length > 1) { - material = materials; - } else if (materials.length > 0) { - material = materials[0]; - } else { - material = new MeshPhongMaterial({ - name: Loader.DEFAULT_MATERIAL_NAME, - color: 13421772 - }); - materials.push(material); - } - if ("color" in geometry.attributes) { - materials.forEach(function(material2) { - material2.vertexColors = true; - }); - } - if (geometry.FBX_Deformer) { - model = new SkinnedMesh(geometry, material); - model.normalizeSkinWeights(); - } else { - model = new Mesh(geometry, material); - } - return model; - } - createCurve(relationships, geometryMap) { - const geometry = relationships.children.reduce(function(geo, child) { - if (geometryMap.has(child.ID)) geo = geometryMap.get(child.ID); - return geo; - }, null); - const material = new LineBasicMaterial({ - name: Loader.DEFAULT_MATERIAL_NAME, - color: 3342591, - linewidth: 1 - }); - return new Line(geometry, material); - } - // parse the model node for transform data - getTransformData(model, modelNode) { - const transformData = {}; - if ("InheritType" in modelNode) transformData.inheritType = parseInt(modelNode.InheritType.value); - if ("RotationOrder" in modelNode) transformData.eulerOrder = getEulerOrder(modelNode.RotationOrder.value); - else transformData.eulerOrder = getEulerOrder(0); - if ("Lcl_Translation" in modelNode) transformData.translation = modelNode.Lcl_Translation.value; - if ("PreRotation" in modelNode) transformData.preRotation = modelNode.PreRotation.value; - if ("Lcl_Rotation" in modelNode) transformData.rotation = modelNode.Lcl_Rotation.value; - if ("PostRotation" in modelNode) transformData.postRotation = modelNode.PostRotation.value; - if ("Lcl_Scaling" in modelNode) transformData.scale = modelNode.Lcl_Scaling.value; - if ("ScalingOffset" in modelNode) transformData.scalingOffset = modelNode.ScalingOffset.value; - if ("ScalingPivot" in modelNode) transformData.scalingPivot = modelNode.ScalingPivot.value; - if ("RotationOffset" in modelNode) transformData.rotationOffset = modelNode.RotationOffset.value; - if ("RotationPivot" in modelNode) transformData.rotationPivot = modelNode.RotationPivot.value; - model.userData.transformData = transformData; - } - setLookAtProperties(model, modelNode) { - if ("LookAtProperty" in modelNode) { - const children = connections.get(model.ID).children; - children.forEach(function(child) { - if (child.relationship === "LookAtProperty") { - const lookAtTarget = fbxTree.Objects.Model[child.ID]; - if ("Lcl_Translation" in lookAtTarget) { - const pos = lookAtTarget.Lcl_Translation.value; - if (model.target !== void 0) { - model.target.position.fromArray(pos); - sceneGraph.add(model.target); - } else { - model.lookAt(new Vector3().fromArray(pos)); - } - } - } - }); - } - } - bindSkeleton(skeletons, geometryMap, modelMap) { - const bindMatrices = this.parsePoseNodes(); - for (const ID in skeletons) { - const skeleton = skeletons[ID]; - const parents = connections.get(parseInt(skeleton.ID)).parents; - parents.forEach(function(parent) { - if (geometryMap.has(parent.ID)) { - const geoID = parent.ID; - const geoRelationships = connections.get(geoID); - geoRelationships.parents.forEach(function(geoConnParent) { - if (modelMap.has(geoConnParent.ID)) { - const model = modelMap.get(geoConnParent.ID); - model.bind(new Skeleton(skeleton.bones), bindMatrices[geoConnParent.ID]); - } - }); - } - }); - } - } - parsePoseNodes() { - const bindMatrices = {}; - if ("Pose" in fbxTree.Objects) { - const BindPoseNode = fbxTree.Objects.Pose; - for (const nodeID in BindPoseNode) { - if (BindPoseNode[nodeID].attrType === "BindPose" && BindPoseNode[nodeID].NbPoseNodes > 0) { - const poseNodes = BindPoseNode[nodeID].PoseNode; - if (Array.isArray(poseNodes)) { - poseNodes.forEach(function(poseNode) { - bindMatrices[poseNode.Node] = new Matrix4().fromArray(poseNode.Matrix.a); - }); - } else { - bindMatrices[poseNodes.Node] = new Matrix4().fromArray(poseNodes.Matrix.a); - } - } - } - } - return bindMatrices; - } - addGlobalSceneSettings() { - if ("GlobalSettings" in fbxTree) { - if ("AmbientColor" in fbxTree.GlobalSettings) { - const ambientColor = fbxTree.GlobalSettings.AmbientColor.value; - const r = ambientColor[0]; - const g = ambientColor[1]; - const b = ambientColor[2]; - if (r !== 0 || g !== 0 || b !== 0) { - const color = new Color().setRGB(r, g, b, SRGBColorSpace); - sceneGraph.add(new AmbientLight(color, 1)); - } - } - if ("UnitScaleFactor" in fbxTree.GlobalSettings) { - sceneGraph.userData.unitScaleFactor = fbxTree.GlobalSettings.UnitScaleFactor.value; - } - } - } -} -class GeometryParser { - static { - __name(this, "GeometryParser"); - } - constructor() { - this.negativeMaterialIndices = false; - } - // Parse nodes in FBXTree.Objects.Geometry - parse(deformers) { - const geometryMap = /* @__PURE__ */ new Map(); - if ("Geometry" in fbxTree.Objects) { - const geoNodes = fbxTree.Objects.Geometry; - for (const nodeID in geoNodes) { - const relationships = connections.get(parseInt(nodeID)); - const geo = this.parseGeometry(relationships, geoNodes[nodeID], deformers); - geometryMap.set(parseInt(nodeID), geo); - } - } - if (this.negativeMaterialIndices === true) { - console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."); - } - return geometryMap; - } - // Parse single node in FBXTree.Objects.Geometry - parseGeometry(relationships, geoNode, deformers) { - switch (geoNode.attrType) { - case "Mesh": - return this.parseMeshGeometry(relationships, geoNode, deformers); - break; - case "NurbsCurve": - return this.parseNurbsGeometry(geoNode); - break; - } - } - // Parse single node mesh geometry in FBXTree.Objects.Geometry - parseMeshGeometry(relationships, geoNode, deformers) { - const skeletons = deformers.skeletons; - const morphTargets = []; - const modelNodes = relationships.parents.map(function(parent) { - return fbxTree.Objects.Model[parent.ID]; - }); - if (modelNodes.length === 0) return; - const skeleton = relationships.children.reduce(function(skeleton2, child) { - if (skeletons[child.ID] !== void 0) skeleton2 = skeletons[child.ID]; - return skeleton2; - }, null); - relationships.children.forEach(function(child) { - if (deformers.morphTargets[child.ID] !== void 0) { - morphTargets.push(deformers.morphTargets[child.ID]); - } - }); - const modelNode = modelNodes[0]; - const transformData = {}; - if ("RotationOrder" in modelNode) transformData.eulerOrder = getEulerOrder(modelNode.RotationOrder.value); - if ("InheritType" in modelNode) transformData.inheritType = parseInt(modelNode.InheritType.value); - if ("GeometricTranslation" in modelNode) transformData.translation = modelNode.GeometricTranslation.value; - if ("GeometricRotation" in modelNode) transformData.rotation = modelNode.GeometricRotation.value; - if ("GeometricScaling" in modelNode) transformData.scale = modelNode.GeometricScaling.value; - const transform = generateTransform(transformData); - return this.genGeometry(geoNode, skeleton, morphTargets, transform); - } - // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry - genGeometry(geoNode, skeleton, morphTargets, preTransform) { - const geo = new BufferGeometry(); - if (geoNode.attrName) geo.name = geoNode.attrName; - const geoInfo = this.parseGeoNode(geoNode, skeleton); - const buffers = this.genBuffers(geoInfo); - const positionAttribute = new Float32BufferAttribute(buffers.vertex, 3); - positionAttribute.applyMatrix4(preTransform); - geo.setAttribute("position", positionAttribute); - if (buffers.colors.length > 0) { - geo.setAttribute("color", new Float32BufferAttribute(buffers.colors, 3)); - } - if (skeleton) { - geo.setAttribute("skinIndex", new Uint16BufferAttribute(buffers.weightsIndices, 4)); - geo.setAttribute("skinWeight", new Float32BufferAttribute(buffers.vertexWeights, 4)); - geo.FBX_Deformer = skeleton; - } - if (buffers.normal.length > 0) { - const normalMatrix = new Matrix3().getNormalMatrix(preTransform); - const normalAttribute = new Float32BufferAttribute(buffers.normal, 3); - normalAttribute.applyNormalMatrix(normalMatrix); - geo.setAttribute("normal", normalAttribute); - } - buffers.uvs.forEach(function(uvBuffer, i) { - const name = i === 0 ? "uv" : `uv${i}`; - geo.setAttribute(name, new Float32BufferAttribute(buffers.uvs[i], 2)); - }); - if (geoInfo.material && geoInfo.material.mappingType !== "AllSame") { - let prevMaterialIndex = buffers.materialIndex[0]; - let startIndex = 0; - buffers.materialIndex.forEach(function(currentIndex, i) { - if (currentIndex !== prevMaterialIndex) { - geo.addGroup(startIndex, i - startIndex, prevMaterialIndex); - prevMaterialIndex = currentIndex; - startIndex = i; - } - }); - if (geo.groups.length > 0) { - const lastGroup = geo.groups[geo.groups.length - 1]; - const lastIndex = lastGroup.start + lastGroup.count; - if (lastIndex !== buffers.materialIndex.length) { - geo.addGroup(lastIndex, buffers.materialIndex.length - lastIndex, prevMaterialIndex); - } - } - if (geo.groups.length === 0) { - geo.addGroup(0, buffers.materialIndex.length, buffers.materialIndex[0]); - } - } - this.addMorphTargets(geo, geoNode, morphTargets, preTransform); - return geo; - } - parseGeoNode(geoNode, skeleton) { - const geoInfo = {}; - geoInfo.vertexPositions = geoNode.Vertices !== void 0 ? geoNode.Vertices.a : []; - geoInfo.vertexIndices = geoNode.PolygonVertexIndex !== void 0 ? geoNode.PolygonVertexIndex.a : []; - if (geoNode.LayerElementColor) { - geoInfo.color = this.parseVertexColors(geoNode.LayerElementColor[0]); - } - if (geoNode.LayerElementMaterial) { - geoInfo.material = this.parseMaterialIndices(geoNode.LayerElementMaterial[0]); - } - if (geoNode.LayerElementNormal) { - geoInfo.normal = this.parseNormals(geoNode.LayerElementNormal[0]); - } - if (geoNode.LayerElementUV) { - geoInfo.uv = []; - let i = 0; - while (geoNode.LayerElementUV[i]) { - if (geoNode.LayerElementUV[i].UV) { - geoInfo.uv.push(this.parseUVs(geoNode.LayerElementUV[i])); - } - i++; - } - } - geoInfo.weightTable = {}; - if (skeleton !== null) { - geoInfo.skeleton = skeleton; - skeleton.rawBones.forEach(function(rawBone, i) { - rawBone.indices.forEach(function(index, j) { - if (geoInfo.weightTable[index] === void 0) geoInfo.weightTable[index] = []; - geoInfo.weightTable[index].push({ - id: i, - weight: rawBone.weights[j] - }); - }); - }); - } - return geoInfo; - } - genBuffers(geoInfo) { - const buffers = { - vertex: [], - normal: [], - colors: [], - uvs: [], - materialIndex: [], - vertexWeights: [], - weightsIndices: [] - }; - let polygonIndex = 0; - let faceLength = 0; - let displayedWeightsWarning = false; - let facePositionIndexes = []; - let faceNormals = []; - let faceColors = []; - let faceUVs = []; - let faceWeights = []; - let faceWeightIndices = []; - const scope = this; - geoInfo.vertexIndices.forEach(function(vertexIndex, polygonVertexIndex) { - let materialIndex; - let endOfFace = false; - if (vertexIndex < 0) { - vertexIndex = vertexIndex ^ -1; - endOfFace = true; - } - let weightIndices = []; - let weights = []; - facePositionIndexes.push(vertexIndex * 3, vertexIndex * 3 + 1, vertexIndex * 3 + 2); - if (geoInfo.color) { - const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.color); - faceColors.push(data[0], data[1], data[2]); - } - if (geoInfo.skeleton) { - if (geoInfo.weightTable[vertexIndex] !== void 0) { - geoInfo.weightTable[vertexIndex].forEach(function(wt) { - weights.push(wt.weight); - weightIndices.push(wt.id); - }); - } - if (weights.length > 4) { - if (!displayedWeightsWarning) { - console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."); - displayedWeightsWarning = true; - } - const wIndex = [0, 0, 0, 0]; - const Weight = [0, 0, 0, 0]; - weights.forEach(function(weight, weightIndex) { - let currentWeight = weight; - let currentIndex = weightIndices[weightIndex]; - Weight.forEach(function(comparedWeight, comparedWeightIndex, comparedWeightArray) { - if (currentWeight > comparedWeight) { - comparedWeightArray[comparedWeightIndex] = currentWeight; - currentWeight = comparedWeight; - const tmp2 = wIndex[comparedWeightIndex]; - wIndex[comparedWeightIndex] = currentIndex; - currentIndex = tmp2; - } - }); - }); - weightIndices = wIndex; - weights = Weight; - } - while (weights.length < 4) { - weights.push(0); - weightIndices.push(0); - } - for (let i = 0; i < 4; ++i) { - faceWeights.push(weights[i]); - faceWeightIndices.push(weightIndices[i]); - } - } - if (geoInfo.normal) { - const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.normal); - faceNormals.push(data[0], data[1], data[2]); - } - if (geoInfo.material && geoInfo.material.mappingType !== "AllSame") { - materialIndex = getData(polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.material)[0]; - if (materialIndex < 0) { - scope.negativeMaterialIndices = true; - materialIndex = 0; - } - } - if (geoInfo.uv) { - geoInfo.uv.forEach(function(uv, i) { - const data = getData(polygonVertexIndex, polygonIndex, vertexIndex, uv); - if (faceUVs[i] === void 0) { - faceUVs[i] = []; - } - faceUVs[i].push(data[0]); - faceUVs[i].push(data[1]); - }); - } - faceLength++; - if (endOfFace) { - scope.genFace(buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength); - polygonIndex++; - faceLength = 0; - facePositionIndexes = []; - faceNormals = []; - faceColors = []; - faceUVs = []; - faceWeights = []; - faceWeightIndices = []; - } - }); - return buffers; - } - // See https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal - getNormalNewell(vertices) { - const normal = new Vector3(0, 0, 0); - for (let i = 0; i < vertices.length; i++) { - const current = vertices[i]; - const next = vertices[(i + 1) % vertices.length]; - normal.x += (current.y - next.y) * (current.z + next.z); - normal.y += (current.z - next.z) * (current.x + next.x); - normal.z += (current.x - next.x) * (current.y + next.y); - } - normal.normalize(); - return normal; - } - getNormalTangentAndBitangent(vertices) { - const normalVector = this.getNormalNewell(vertices); - const up = Math.abs(normalVector.z) > 0.5 ? new Vector3(0, 1, 0) : new Vector3(0, 0, 1); - const tangent = up.cross(normalVector).normalize(); - const bitangent = normalVector.clone().cross(tangent).normalize(); - return { - normal: normalVector, - tangent, - bitangent - }; - } - flattenVertex(vertex2, normalTangent, normalBitangent) { - return new Vector2( - vertex2.dot(normalTangent), - vertex2.dot(normalBitangent) - ); - } - // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris - genFace(buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength) { - let triangles; - if (faceLength > 3) { - const vertices = []; - const positions = geoInfo.baseVertexPositions || geoInfo.vertexPositions; - for (let i = 0; i < facePositionIndexes.length; i += 3) { - vertices.push( - new Vector3( - positions[facePositionIndexes[i]], - positions[facePositionIndexes[i + 1]], - positions[facePositionIndexes[i + 2]] - ) - ); - } - const { tangent, bitangent } = this.getNormalTangentAndBitangent(vertices); - const triangulationInput = []; - for (const vertex2 of vertices) { - triangulationInput.push(this.flattenVertex(vertex2, tangent, bitangent)); - } - triangles = ShapeUtils.triangulateShape(triangulationInput, []); - } else { - triangles = [[0, 1, 2]]; - } - for (const [i0, i1, i2] of triangles) { - buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i0 * 3]]); - buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i0 * 3 + 1]]); - buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i0 * 3 + 2]]); - buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i1 * 3]]); - buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i1 * 3 + 1]]); - buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i1 * 3 + 2]]); - buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i2 * 3]]); - buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i2 * 3 + 1]]); - buffers.vertex.push(geoInfo.vertexPositions[facePositionIndexes[i2 * 3 + 2]]); - if (geoInfo.skeleton) { - buffers.vertexWeights.push(faceWeights[i0 * 4]); - buffers.vertexWeights.push(faceWeights[i0 * 4 + 1]); - buffers.vertexWeights.push(faceWeights[i0 * 4 + 2]); - buffers.vertexWeights.push(faceWeights[i0 * 4 + 3]); - buffers.vertexWeights.push(faceWeights[i1 * 4]); - buffers.vertexWeights.push(faceWeights[i1 * 4 + 1]); - buffers.vertexWeights.push(faceWeights[i1 * 4 + 2]); - buffers.vertexWeights.push(faceWeights[i1 * 4 + 3]); - buffers.vertexWeights.push(faceWeights[i2 * 4]); - buffers.vertexWeights.push(faceWeights[i2 * 4 + 1]); - buffers.vertexWeights.push(faceWeights[i2 * 4 + 2]); - buffers.vertexWeights.push(faceWeights[i2 * 4 + 3]); - buffers.weightsIndices.push(faceWeightIndices[i0 * 4]); - buffers.weightsIndices.push(faceWeightIndices[i0 * 4 + 1]); - buffers.weightsIndices.push(faceWeightIndices[i0 * 4 + 2]); - buffers.weightsIndices.push(faceWeightIndices[i0 * 4 + 3]); - buffers.weightsIndices.push(faceWeightIndices[i1 * 4]); - buffers.weightsIndices.push(faceWeightIndices[i1 * 4 + 1]); - buffers.weightsIndices.push(faceWeightIndices[i1 * 4 + 2]); - buffers.weightsIndices.push(faceWeightIndices[i1 * 4 + 3]); - buffers.weightsIndices.push(faceWeightIndices[i2 * 4]); - buffers.weightsIndices.push(faceWeightIndices[i2 * 4 + 1]); - buffers.weightsIndices.push(faceWeightIndices[i2 * 4 + 2]); - buffers.weightsIndices.push(faceWeightIndices[i2 * 4 + 3]); - } - if (geoInfo.color) { - buffers.colors.push(faceColors[i0 * 3]); - buffers.colors.push(faceColors[i0 * 3 + 1]); - buffers.colors.push(faceColors[i0 * 3 + 2]); - buffers.colors.push(faceColors[i1 * 3]); - buffers.colors.push(faceColors[i1 * 3 + 1]); - buffers.colors.push(faceColors[i1 * 3 + 2]); - buffers.colors.push(faceColors[i2 * 3]); - buffers.colors.push(faceColors[i2 * 3 + 1]); - buffers.colors.push(faceColors[i2 * 3 + 2]); - } - if (geoInfo.material && geoInfo.material.mappingType !== "AllSame") { - buffers.materialIndex.push(materialIndex); - buffers.materialIndex.push(materialIndex); - buffers.materialIndex.push(materialIndex); - } - if (geoInfo.normal) { - buffers.normal.push(faceNormals[i0 * 3]); - buffers.normal.push(faceNormals[i0 * 3 + 1]); - buffers.normal.push(faceNormals[i0 * 3 + 2]); - buffers.normal.push(faceNormals[i1 * 3]); - buffers.normal.push(faceNormals[i1 * 3 + 1]); - buffers.normal.push(faceNormals[i1 * 3 + 2]); - buffers.normal.push(faceNormals[i2 * 3]); - buffers.normal.push(faceNormals[i2 * 3 + 1]); - buffers.normal.push(faceNormals[i2 * 3 + 2]); - } - if (geoInfo.uv) { - geoInfo.uv.forEach(function(uv, j) { - if (buffers.uvs[j] === void 0) buffers.uvs[j] = []; - buffers.uvs[j].push(faceUVs[j][i0 * 2]); - buffers.uvs[j].push(faceUVs[j][i0 * 2 + 1]); - buffers.uvs[j].push(faceUVs[j][i1 * 2]); - buffers.uvs[j].push(faceUVs[j][i1 * 2 + 1]); - buffers.uvs[j].push(faceUVs[j][i2 * 2]); - buffers.uvs[j].push(faceUVs[j][i2 * 2 + 1]); - }); - } - } - } - addMorphTargets(parentGeo, parentGeoNode, morphTargets, preTransform) { - if (morphTargets.length === 0) return; - parentGeo.morphTargetsRelative = true; - parentGeo.morphAttributes.position = []; - const scope = this; - morphTargets.forEach(function(morphTarget) { - morphTarget.rawTargets.forEach(function(rawTarget) { - const morphGeoNode = fbxTree.Objects.Geometry[rawTarget.geoID]; - if (morphGeoNode !== void 0) { - scope.genMorphGeometry(parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name); - } - }); - }); - } - // a morph geometry node is similar to a standard node, and the node is also contained - // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal - // and a special attribute Index defining which vertices of the original geometry are affected - // Normal and position attributes only have data for the vertices that are affected by the morph - genMorphGeometry(parentGeo, parentGeoNode, morphGeoNode, preTransform, name) { - const basePositions = parentGeoNode.Vertices !== void 0 ? parentGeoNode.Vertices.a : []; - const baseIndices = parentGeoNode.PolygonVertexIndex !== void 0 ? parentGeoNode.PolygonVertexIndex.a : []; - const morphPositionsSparse = morphGeoNode.Vertices !== void 0 ? morphGeoNode.Vertices.a : []; - const morphIndices = morphGeoNode.Indexes !== void 0 ? morphGeoNode.Indexes.a : []; - const length = parentGeo.attributes.position.count * 3; - const morphPositions = new Float32Array(length); - for (let i = 0; i < morphIndices.length; i++) { - const morphIndex = morphIndices[i] * 3; - morphPositions[morphIndex] = morphPositionsSparse[i * 3]; - morphPositions[morphIndex + 1] = morphPositionsSparse[i * 3 + 1]; - morphPositions[morphIndex + 2] = morphPositionsSparse[i * 3 + 2]; - } - const morphGeoInfo = { - vertexIndices: baseIndices, - vertexPositions: morphPositions, - baseVertexPositions: basePositions - }; - const morphBuffers = this.genBuffers(morphGeoInfo); - const positionAttribute = new Float32BufferAttribute(morphBuffers.vertex, 3); - positionAttribute.name = name || morphGeoNode.attrName; - positionAttribute.applyMatrix4(preTransform); - parentGeo.morphAttributes.position.push(positionAttribute); - } - // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists - parseNormals(NormalNode) { - const mappingType = NormalNode.MappingInformationType; - const referenceType = NormalNode.ReferenceInformationType; - const buffer = NormalNode.Normals.a; - let indexBuffer = []; - if (referenceType === "IndexToDirect") { - if ("NormalIndex" in NormalNode) { - indexBuffer = NormalNode.NormalIndex.a; - } else if ("NormalsIndex" in NormalNode) { - indexBuffer = NormalNode.NormalsIndex.a; - } - } - return { - dataSize: 3, - buffer, - indices: indexBuffer, - mappingType, - referenceType - }; - } - // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists - parseUVs(UVNode) { - const mappingType = UVNode.MappingInformationType; - const referenceType = UVNode.ReferenceInformationType; - const buffer = UVNode.UV.a; - let indexBuffer = []; - if (referenceType === "IndexToDirect") { - indexBuffer = UVNode.UVIndex.a; - } - return { - dataSize: 2, - buffer, - indices: indexBuffer, - mappingType, - referenceType - }; - } - // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists - parseVertexColors(ColorNode) { - const mappingType = ColorNode.MappingInformationType; - const referenceType = ColorNode.ReferenceInformationType; - const buffer = ColorNode.Colors.a; - let indexBuffer = []; - if (referenceType === "IndexToDirect") { - indexBuffer = ColorNode.ColorIndex.a; - } - for (let i = 0, c = new Color(); i < buffer.length; i += 4) { - c.fromArray(buffer, i); - ColorManagement.toWorkingColorSpace(c, SRGBColorSpace); - c.toArray(buffer, i); - } - return { - dataSize: 4, - buffer, - indices: indexBuffer, - mappingType, - referenceType - }; - } - // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists - parseMaterialIndices(MaterialNode) { - const mappingType = MaterialNode.MappingInformationType; - const referenceType = MaterialNode.ReferenceInformationType; - if (mappingType === "NoMappingInformation") { - return { - dataSize: 1, - buffer: [0], - indices: [0], - mappingType: "AllSame", - referenceType - }; - } - const materialIndexBuffer = MaterialNode.Materials.a; - const materialIndices = []; - for (let i = 0; i < materialIndexBuffer.length; ++i) { - materialIndices.push(i); - } - return { - dataSize: 1, - buffer: materialIndexBuffer, - indices: materialIndices, - mappingType, - referenceType - }; - } - // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry - parseNurbsGeometry(geoNode) { - const order = parseInt(geoNode.Order); - if (isNaN(order)) { - console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s", geoNode.Order, geoNode.id); - return new BufferGeometry(); - } - const degree = order - 1; - const knots = geoNode.KnotVector.a; - const controlPoints = []; - const pointsValues = geoNode.Points.a; - for (let i = 0, l = pointsValues.length; i < l; i += 4) { - controlPoints.push(new Vector4().fromArray(pointsValues, i)); - } - let startKnot, endKnot; - if (geoNode.Form === "Closed") { - controlPoints.push(controlPoints[0]); - } else if (geoNode.Form === "Periodic") { - startKnot = degree; - endKnot = knots.length - 1 - startKnot; - for (let i = 0; i < degree; ++i) { - controlPoints.push(controlPoints[i]); - } - } - const curve = new NURBSCurve(degree, knots, controlPoints, startKnot, endKnot); - const points = curve.getPoints(controlPoints.length * 12); - return new BufferGeometry().setFromPoints(points); - } -} -class AnimationParser { - static { - __name(this, "AnimationParser"); - } - // take raw animation clips and turn them into three.js animation clips - parse() { - const animationClips = []; - const rawClips = this.parseClips(); - if (rawClips !== void 0) { - for (const key in rawClips) { - const rawClip = rawClips[key]; - const clip = this.addClip(rawClip); - animationClips.push(clip); - } - } - return animationClips; - } - parseClips() { - if (fbxTree.Objects.AnimationCurve === void 0) return void 0; - const curveNodesMap = this.parseAnimationCurveNodes(); - this.parseAnimationCurves(curveNodesMap); - const layersMap = this.parseAnimationLayers(curveNodesMap); - const rawClips = this.parseAnimStacks(layersMap); - return rawClips; - } - // parse nodes in FBXTree.Objects.AnimationCurveNode - // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation ) - // and is referenced by an AnimationLayer - parseAnimationCurveNodes() { - const rawCurveNodes = fbxTree.Objects.AnimationCurveNode; - const curveNodesMap = /* @__PURE__ */ new Map(); - for (const nodeID in rawCurveNodes) { - const rawCurveNode = rawCurveNodes[nodeID]; - if (rawCurveNode.attrName.match(/S|R|T|DeformPercent/) !== null) { - const curveNode = { - id: rawCurveNode.id, - attr: rawCurveNode.attrName, - curves: {} - }; - curveNodesMap.set(curveNode.id, curveNode); - } - } - return curveNodesMap; - } - // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to - // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated - // axis ( e.g. times and values of x rotation) - parseAnimationCurves(curveNodesMap) { - const rawCurves = fbxTree.Objects.AnimationCurve; - for (const nodeID in rawCurves) { - const animationCurve = { - id: rawCurves[nodeID].id, - times: rawCurves[nodeID].KeyTime.a.map(convertFBXTimeToSeconds), - values: rawCurves[nodeID].KeyValueFloat.a - }; - const relationships = connections.get(animationCurve.id); - if (relationships !== void 0) { - const animationCurveID = relationships.parents[0].ID; - const animationCurveRelationship = relationships.parents[0].relationship; - if (animationCurveRelationship.match(/X/)) { - curveNodesMap.get(animationCurveID).curves["x"] = animationCurve; - } else if (animationCurveRelationship.match(/Y/)) { - curveNodesMap.get(animationCurveID).curves["y"] = animationCurve; - } else if (animationCurveRelationship.match(/Z/)) { - curveNodesMap.get(animationCurveID).curves["z"] = animationCurve; - } else if (animationCurveRelationship.match(/DeformPercent/) && curveNodesMap.has(animationCurveID)) { - curveNodesMap.get(animationCurveID).curves["morph"] = animationCurve; - } - } - } - } - // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references - // to various AnimationCurveNodes and is referenced by an AnimationStack node - // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack - parseAnimationLayers(curveNodesMap) { - const rawLayers = fbxTree.Objects.AnimationLayer; - const layersMap = /* @__PURE__ */ new Map(); - for (const nodeID in rawLayers) { - const layerCurveNodes = []; - const connection = connections.get(parseInt(nodeID)); - if (connection !== void 0) { - const children = connection.children; - children.forEach(function(child, i) { - if (curveNodesMap.has(child.ID)) { - const curveNode = curveNodesMap.get(child.ID); - if (curveNode.curves.x !== void 0 || curveNode.curves.y !== void 0 || curveNode.curves.z !== void 0) { - if (layerCurveNodes[i] === void 0) { - const modelID = connections.get(child.ID).parents.filter(function(parent) { - return parent.relationship !== void 0; - })[0].ID; - if (modelID !== void 0) { - const rawModel = fbxTree.Objects.Model[modelID.toString()]; - if (rawModel === void 0) { - console.warn("THREE.FBXLoader: Encountered a unused curve.", child); - return; - } - const node = { - modelName: rawModel.attrName ? PropertyBinding.sanitizeNodeName(rawModel.attrName) : "", - ID: rawModel.id, - initialPosition: [0, 0, 0], - initialRotation: [0, 0, 0], - initialScale: [1, 1, 1] - }; - sceneGraph.traverse(function(child2) { - if (child2.ID === rawModel.id) { - node.transform = child2.matrix; - if (child2.userData.transformData) node.eulerOrder = child2.userData.transformData.eulerOrder; - } - }); - if (!node.transform) node.transform = new Matrix4(); - if ("PreRotation" in rawModel) node.preRotation = rawModel.PreRotation.value; - if ("PostRotation" in rawModel) node.postRotation = rawModel.PostRotation.value; - layerCurveNodes[i] = node; - } - } - if (layerCurveNodes[i]) layerCurveNodes[i][curveNode.attr] = curveNode; - } else if (curveNode.curves.morph !== void 0) { - if (layerCurveNodes[i] === void 0) { - const deformerID = connections.get(child.ID).parents.filter(function(parent) { - return parent.relationship !== void 0; - })[0].ID; - const morpherID = connections.get(deformerID).parents[0].ID; - const geoID = connections.get(morpherID).parents[0].ID; - const modelID = connections.get(geoID).parents[0].ID; - const rawModel = fbxTree.Objects.Model[modelID]; - const node = { - modelName: rawModel.attrName ? PropertyBinding.sanitizeNodeName(rawModel.attrName) : "", - morphName: fbxTree.Objects.Deformer[deformerID].attrName - }; - layerCurveNodes[i] = node; - } - layerCurveNodes[i][curveNode.attr] = curveNode; - } - } - }); - layersMap.set(parseInt(nodeID), layerCurveNodes); - } - } - return layersMap; - } - // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation - // hierarchy. Each Stack node will be used to create a AnimationClip - parseAnimStacks(layersMap) { - const rawStacks = fbxTree.Objects.AnimationStack; - const rawClips = {}; - for (const nodeID in rawStacks) { - const children = connections.get(parseInt(nodeID)).children; - if (children.length > 1) { - console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers."); - } - const layer = layersMap.get(children[0].ID); - rawClips[nodeID] = { - name: rawStacks[nodeID].attrName, - layer - }; - } - return rawClips; - } - addClip(rawClip) { - let tracks = []; - const scope = this; - rawClip.layer.forEach(function(rawTracks) { - tracks = tracks.concat(scope.generateTracks(rawTracks)); - }); - return new AnimationClip(rawClip.name, -1, tracks); - } - generateTracks(rawTracks) { - const tracks = []; - let initialPosition = new Vector3(); - let initialScale = new Vector3(); - if (rawTracks.transform) rawTracks.transform.decompose(initialPosition, new Quaternion(), initialScale); - initialPosition = initialPosition.toArray(); - initialScale = initialScale.toArray(); - if (rawTracks.T !== void 0 && Object.keys(rawTracks.T.curves).length > 0) { - const positionTrack = this.generateVectorTrack(rawTracks.modelName, rawTracks.T.curves, initialPosition, "position"); - if (positionTrack !== void 0) tracks.push(positionTrack); - } - if (rawTracks.R !== void 0 && Object.keys(rawTracks.R.curves).length > 0) { - const rotationTrack = this.generateRotationTrack(rawTracks.modelName, rawTracks.R.curves, rawTracks.preRotation, rawTracks.postRotation, rawTracks.eulerOrder); - if (rotationTrack !== void 0) tracks.push(rotationTrack); - } - if (rawTracks.S !== void 0 && Object.keys(rawTracks.S.curves).length > 0) { - const scaleTrack = this.generateVectorTrack(rawTracks.modelName, rawTracks.S.curves, initialScale, "scale"); - if (scaleTrack !== void 0) tracks.push(scaleTrack); - } - if (rawTracks.DeformPercent !== void 0) { - const morphTrack = this.generateMorphTrack(rawTracks); - if (morphTrack !== void 0) tracks.push(morphTrack); - } - return tracks; - } - generateVectorTrack(modelName, curves, initialValue, type) { - const times = this.getTimesForAllAxes(curves); - const values = this.getKeyframeTrackValues(times, curves, initialValue); - return new VectorKeyframeTrack(modelName + "." + type, times, values); - } - generateRotationTrack(modelName, curves, preRotation, postRotation, eulerOrder) { - let times; - let values; - if (curves.x !== void 0 && curves.y !== void 0 && curves.z !== void 0) { - const result = this.interpolateRotations(curves.x, curves.y, curves.z, eulerOrder); - times = result[0]; - values = result[1]; - } - const defaultEulerOrder = getEulerOrder(0); - if (preRotation !== void 0) { - preRotation = preRotation.map(MathUtils.degToRad); - preRotation.push(defaultEulerOrder); - preRotation = new Euler().fromArray(preRotation); - preRotation = new Quaternion().setFromEuler(preRotation); - } - if (postRotation !== void 0) { - postRotation = postRotation.map(MathUtils.degToRad); - postRotation.push(defaultEulerOrder); - postRotation = new Euler().fromArray(postRotation); - postRotation = new Quaternion().setFromEuler(postRotation).invert(); - } - const quaternion = new Quaternion(); - const euler = new Euler(); - const quaternionValues = []; - if (!values || !times) return new QuaternionKeyframeTrack(modelName + ".quaternion", [0], [0]); - for (let i = 0; i < values.length; i += 3) { - euler.set(values[i], values[i + 1], values[i + 2], eulerOrder); - quaternion.setFromEuler(euler); - if (preRotation !== void 0) quaternion.premultiply(preRotation); - if (postRotation !== void 0) quaternion.multiply(postRotation); - if (i > 2) { - const prevQuat = new Quaternion().fromArray( - quaternionValues, - (i - 3) / 3 * 4 - ); - if (prevQuat.dot(quaternion) < 0) { - quaternion.set(-quaternion.x, -quaternion.y, -quaternion.z, -quaternion.w); - } - } - quaternion.toArray(quaternionValues, i / 3 * 4); - } - return new QuaternionKeyframeTrack(modelName + ".quaternion", times, quaternionValues); - } - generateMorphTrack(rawTracks) { - const curves = rawTracks.DeformPercent.curves.morph; - const values = curves.values.map(function(val) { - return val / 100; - }); - const morphNum = sceneGraph.getObjectByName(rawTracks.modelName).morphTargetDictionary[rawTracks.morphName]; - return new NumberKeyframeTrack(rawTracks.modelName + ".morphTargetInfluences[" + morphNum + "]", curves.times, values); - } - // For all animated objects, times are defined separately for each axis - // Here we'll combine the times into one sorted array without duplicates - getTimesForAllAxes(curves) { - let times = []; - if (curves.x !== void 0) times = times.concat(curves.x.times); - if (curves.y !== void 0) times = times.concat(curves.y.times); - if (curves.z !== void 0) times = times.concat(curves.z.times); - times = times.sort(function(a, b) { - return a - b; - }); - if (times.length > 1) { - let targetIndex = 1; - let lastValue = times[0]; - for (let i = 1; i < times.length; i++) { - const currentValue = times[i]; - if (currentValue !== lastValue) { - times[targetIndex] = currentValue; - lastValue = currentValue; - targetIndex++; - } - } - times = times.slice(0, targetIndex); - } - return times; - } - getKeyframeTrackValues(times, curves, initialValue) { - const prevValue = initialValue; - const values = []; - let xIndex = -1; - let yIndex = -1; - let zIndex = -1; - times.forEach(function(time) { - if (curves.x) xIndex = curves.x.times.indexOf(time); - if (curves.y) yIndex = curves.y.times.indexOf(time); - if (curves.z) zIndex = curves.z.times.indexOf(time); - if (xIndex !== -1) { - const xValue = curves.x.values[xIndex]; - values.push(xValue); - prevValue[0] = xValue; - } else { - values.push(prevValue[0]); - } - if (yIndex !== -1) { - const yValue = curves.y.values[yIndex]; - values.push(yValue); - prevValue[1] = yValue; - } else { - values.push(prevValue[1]); - } - if (zIndex !== -1) { - const zValue = curves.z.values[zIndex]; - values.push(zValue); - prevValue[2] = zValue; - } else { - values.push(prevValue[2]); - } - }); - return values; - } - // Rotations are defined as Euler angles which can have values of any size - // These will be converted to quaternions which don't support values greater than - // PI, so we'll interpolate large rotations - interpolateRotations(curvex, curvey, curvez, eulerOrder) { - const times = []; - const values = []; - times.push(curvex.times[0]); - values.push(MathUtils.degToRad(curvex.values[0])); - values.push(MathUtils.degToRad(curvey.values[0])); - values.push(MathUtils.degToRad(curvez.values[0])); - for (let i = 1; i < curvex.values.length; i++) { - const initialValue = [ - curvex.values[i - 1], - curvey.values[i - 1], - curvez.values[i - 1] - ]; - if (isNaN(initialValue[0]) || isNaN(initialValue[1]) || isNaN(initialValue[2])) { - continue; - } - const initialValueRad = initialValue.map(MathUtils.degToRad); - const currentValue = [ - curvex.values[i], - curvey.values[i], - curvez.values[i] - ]; - if (isNaN(currentValue[0]) || isNaN(currentValue[1]) || isNaN(currentValue[2])) { - continue; - } - const currentValueRad = currentValue.map(MathUtils.degToRad); - const valuesSpan = [ - currentValue[0] - initialValue[0], - currentValue[1] - initialValue[1], - currentValue[2] - initialValue[2] - ]; - const absoluteSpan = [ - Math.abs(valuesSpan[0]), - Math.abs(valuesSpan[1]), - Math.abs(valuesSpan[2]) - ]; - if (absoluteSpan[0] >= 180 || absoluteSpan[1] >= 180 || absoluteSpan[2] >= 180) { - const maxAbsSpan = Math.max(...absoluteSpan); - const numSubIntervals = maxAbsSpan / 180; - const E1 = new Euler(...initialValueRad, eulerOrder); - const E2 = new Euler(...currentValueRad, eulerOrder); - const Q1 = new Quaternion().setFromEuler(E1); - const Q2 = new Quaternion().setFromEuler(E2); - if (Q1.dot(Q2)) { - Q2.set(-Q2.x, -Q2.y, -Q2.z, -Q2.w); - } - const initialTime = curvex.times[i - 1]; - const timeSpan = curvex.times[i] - initialTime; - const Q = new Quaternion(); - const E = new Euler(); - for (let t2 = 0; t2 < 1; t2 += 1 / numSubIntervals) { - Q.copy(Q1.clone().slerp(Q2.clone(), t2)); - times.push(initialTime + t2 * timeSpan); - E.setFromQuaternion(Q, eulerOrder); - values.push(E.x); - values.push(E.y); - values.push(E.z); - } - } else { - times.push(curvex.times[i]); - values.push(MathUtils.degToRad(curvex.values[i])); - values.push(MathUtils.degToRad(curvey.values[i])); - values.push(MathUtils.degToRad(curvez.values[i])); - } - } - return [times, values]; - } -} -class TextParser { - static { - __name(this, "TextParser"); - } - getPrevNode() { - return this.nodeStack[this.currentIndent - 2]; - } - getCurrentNode() { - return this.nodeStack[this.currentIndent - 1]; - } - getCurrentProp() { - return this.currentProp; - } - pushStack(node) { - this.nodeStack.push(node); - this.currentIndent += 1; - } - popStack() { - this.nodeStack.pop(); - this.currentIndent -= 1; - } - setCurrentProp(val, name) { - this.currentProp = val; - this.currentPropName = name; - } - parse(text) { - this.currentIndent = 0; - this.allNodes = new FBXTree(); - this.nodeStack = []; - this.currentProp = []; - this.currentPropName = ""; - const scope = this; - const split = text.split(/[\r\n]+/); - split.forEach(function(line, i) { - const matchComment = line.match(/^[\s\t]*;/); - const matchEmpty = line.match(/^[\s\t]*$/); - if (matchComment || matchEmpty) return; - const matchBeginning = line.match("^\\t{" + scope.currentIndent + "}(\\w+):(.*){", ""); - const matchProperty = line.match("^\\t{" + scope.currentIndent + "}(\\w+):[\\s\\t\\r\\n](.*)"); - const matchEnd = line.match("^\\t{" + (scope.currentIndent - 1) + "}}"); - if (matchBeginning) { - scope.parseNodeBegin(line, matchBeginning); - } else if (matchProperty) { - scope.parseNodeProperty(line, matchProperty, split[++i]); - } else if (matchEnd) { - scope.popStack(); - } else if (line.match(/^[^\s\t}]/)) { - scope.parseNodePropertyContinued(line); - } - }); - return this.allNodes; - } - parseNodeBegin(line, property) { - const nodeName = property[1].trim().replace(/^"/, "").replace(/"$/, ""); - const nodeAttrs = property[2].split(",").map(function(attr) { - return attr.trim().replace(/^"/, "").replace(/"$/, ""); - }); - const node = { name: nodeName }; - const attrs = this.parseNodeAttr(nodeAttrs); - const currentNode = this.getCurrentNode(); - if (this.currentIndent === 0) { - this.allNodes.add(nodeName, node); - } else { - if (nodeName in currentNode) { - if (nodeName === "PoseNode") { - currentNode.PoseNode.push(node); - } else if (currentNode[nodeName].id !== void 0) { - currentNode[nodeName] = {}; - currentNode[nodeName][currentNode[nodeName].id] = currentNode[nodeName]; - } - if (attrs.id !== "") currentNode[nodeName][attrs.id] = node; - } else if (typeof attrs.id === "number") { - currentNode[nodeName] = {}; - currentNode[nodeName][attrs.id] = node; - } else if (nodeName !== "Properties70") { - if (nodeName === "PoseNode") currentNode[nodeName] = [node]; - else currentNode[nodeName] = node; - } - } - if (typeof attrs.id === "number") node.id = attrs.id; - if (attrs.name !== "") node.attrName = attrs.name; - if (attrs.type !== "") node.attrType = attrs.type; - this.pushStack(node); - } - parseNodeAttr(attrs) { - let id2 = attrs[0]; - if (attrs[0] !== "") { - id2 = parseInt(attrs[0]); - if (isNaN(id2)) { - id2 = attrs[0]; - } - } - let name = "", type = ""; - if (attrs.length > 1) { - name = attrs[1].replace(/^(\w+)::/, ""); - type = attrs[2]; - } - return { id: id2, name, type }; - } - parseNodeProperty(line, property, contentLine) { - let propName = property[1].replace(/^"/, "").replace(/"$/, "").trim(); - let propValue = property[2].replace(/^"/, "").replace(/"$/, "").trim(); - if (propName === "Content" && propValue === ",") { - propValue = contentLine.replace(/"/g, "").replace(/,$/, "").trim(); - } - const currentNode = this.getCurrentNode(); - const parentName = currentNode.name; - if (parentName === "Properties70") { - this.parseNodeSpecialProperty(line, propName, propValue); - return; - } - if (propName === "C") { - const connProps = propValue.split(",").slice(1); - const from = parseInt(connProps[0]); - const to = parseInt(connProps[1]); - let rest = propValue.split(",").slice(3); - rest = rest.map(function(elem) { - return elem.trim().replace(/^"/, ""); - }); - propName = "connections"; - propValue = [from, to]; - append(propValue, rest); - if (currentNode[propName] === void 0) { - currentNode[propName] = []; - } - } - if (propName === "Node") currentNode.id = propValue; - if (propName in currentNode && Array.isArray(currentNode[propName])) { - currentNode[propName].push(propValue); - } else { - if (propName !== "a") currentNode[propName] = propValue; - else currentNode.a = propValue; - } - this.setCurrentProp(currentNode, propName); - if (propName === "a" && propValue.slice(-1) !== ",") { - currentNode.a = parseNumberArray(propValue); - } - } - parseNodePropertyContinued(line) { - const currentNode = this.getCurrentNode(); - currentNode.a += line; - if (line.slice(-1) !== ",") { - currentNode.a = parseNumberArray(currentNode.a); - } - } - // parse "Property70" - parseNodeSpecialProperty(line, propName, propValue) { - const props = propValue.split('",').map(function(prop) { - return prop.trim().replace(/^\"/, "").replace(/\s/, "_"); - }); - const innerPropName = props[0]; - const innerPropType1 = props[1]; - const innerPropType2 = props[2]; - const innerPropFlag = props[3]; - let innerPropValue = props[4]; - switch (innerPropType1) { - case "int": - case "enum": - case "bool": - case "ULongLong": - case "double": - case "Number": - case "FieldOfView": - innerPropValue = parseFloat(innerPropValue); - break; - case "Color": - case "ColorRGB": - case "Vector3D": - case "Lcl_Translation": - case "Lcl_Rotation": - case "Lcl_Scaling": - innerPropValue = parseNumberArray(innerPropValue); - break; - } - this.getPrevNode()[innerPropName] = { - "type": innerPropType1, - "type2": innerPropType2, - "flag": innerPropFlag, - "value": innerPropValue - }; - this.setCurrentProp(this.getPrevNode(), innerPropName); - } -} -class BinaryParser { - static { - __name(this, "BinaryParser"); - } - parse(buffer) { - const reader = new BinaryReader(buffer); - reader.skip(23); - const version = reader.getUint32(); - if (version < 6400) { - throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + version); - } - const allNodes = new FBXTree(); - while (!this.endOfContent(reader)) { - const node = this.parseNode(reader, version); - if (node !== null) allNodes.add(node.name, node); - } - return allNodes; - } - // Check if reader has reached the end of content. - endOfContent(reader) { - if (reader.size() % 16 === 0) { - return (reader.getOffset() + 160 + 16 & ~15) >= reader.size(); - } else { - return reader.getOffset() + 160 + 16 >= reader.size(); - } - } - // recursively parse nodes until the end of the file is reached - parseNode(reader, version) { - const node = {}; - const endOffset = version >= 7500 ? reader.getUint64() : reader.getUint32(); - const numProperties = version >= 7500 ? reader.getUint64() : reader.getUint32(); - version >= 7500 ? reader.getUint64() : reader.getUint32(); - const nameLen = reader.getUint8(); - const name = reader.getString(nameLen); - if (endOffset === 0) return null; - const propertyList = []; - for (let i = 0; i < numProperties; i++) { - propertyList.push(this.parseProperty(reader)); - } - const id2 = propertyList.length > 0 ? propertyList[0] : ""; - const attrName = propertyList.length > 1 ? propertyList[1] : ""; - const attrType = propertyList.length > 2 ? propertyList[2] : ""; - node.singleProperty = numProperties === 1 && reader.getOffset() === endOffset ? true : false; - while (endOffset > reader.getOffset()) { - const subNode = this.parseNode(reader, version); - if (subNode !== null) this.parseSubNode(name, node, subNode); - } - node.propertyList = propertyList; - if (typeof id2 === "number") node.id = id2; - if (attrName !== "") node.attrName = attrName; - if (attrType !== "") node.attrType = attrType; - if (name !== "") node.name = name; - return node; - } - parseSubNode(name, node, subNode) { - if (subNode.singleProperty === true) { - const value = subNode.propertyList[0]; - if (Array.isArray(value)) { - node[subNode.name] = subNode; - subNode.a = value; - } else { - node[subNode.name] = value; - } - } else if (name === "Connections" && subNode.name === "C") { - const array = []; - subNode.propertyList.forEach(function(property, i) { - if (i !== 0) array.push(property); - }); - if (node.connections === void 0) { - node.connections = []; - } - node.connections.push(array); - } else if (subNode.name === "Properties70") { - const keys = Object.keys(subNode); - keys.forEach(function(key) { - node[key] = subNode[key]; - }); - } else if (name === "Properties70" && subNode.name === "P") { - let innerPropName = subNode.propertyList[0]; - let innerPropType1 = subNode.propertyList[1]; - const innerPropType2 = subNode.propertyList[2]; - const innerPropFlag = subNode.propertyList[3]; - let innerPropValue; - if (innerPropName.indexOf("Lcl ") === 0) innerPropName = innerPropName.replace("Lcl ", "Lcl_"); - if (innerPropType1.indexOf("Lcl ") === 0) innerPropType1 = innerPropType1.replace("Lcl ", "Lcl_"); - if (innerPropType1 === "Color" || innerPropType1 === "ColorRGB" || innerPropType1 === "Vector" || innerPropType1 === "Vector3D" || innerPropType1.indexOf("Lcl_") === 0) { - innerPropValue = [ - subNode.propertyList[4], - subNode.propertyList[5], - subNode.propertyList[6] - ]; - } else { - innerPropValue = subNode.propertyList[4]; - } - node[innerPropName] = { - "type": innerPropType1, - "type2": innerPropType2, - "flag": innerPropFlag, - "value": innerPropValue - }; - } else if (node[subNode.name] === void 0) { - if (typeof subNode.id === "number") { - node[subNode.name] = {}; - node[subNode.name][subNode.id] = subNode; - } else { - node[subNode.name] = subNode; - } - } else { - if (subNode.name === "PoseNode") { - if (!Array.isArray(node[subNode.name])) { - node[subNode.name] = [node[subNode.name]]; - } - node[subNode.name].push(subNode); - } else if (node[subNode.name][subNode.id] === void 0) { - node[subNode.name][subNode.id] = subNode; - } - } - } - parseProperty(reader) { - const type = reader.getString(1); - let length; - switch (type) { - case "C": - return reader.getBoolean(); - case "D": - return reader.getFloat64(); - case "F": - return reader.getFloat32(); - case "I": - return reader.getInt32(); - case "L": - return reader.getInt64(); - case "R": - length = reader.getUint32(); - return reader.getArrayBuffer(length); - case "S": - length = reader.getUint32(); - return reader.getString(length); - case "Y": - return reader.getInt16(); - case "b": - case "c": - case "d": - case "f": - case "i": - case "l": - const arrayLength = reader.getUint32(); - const encoding = reader.getUint32(); - const compressedLength = reader.getUint32(); - if (encoding === 0) { - switch (type) { - case "b": - case "c": - return reader.getBooleanArray(arrayLength); - case "d": - return reader.getFloat64Array(arrayLength); - case "f": - return reader.getFloat32Array(arrayLength); - case "i": - return reader.getInt32Array(arrayLength); - case "l": - return reader.getInt64Array(arrayLength); - } - } - const data = unzlibSync(new Uint8Array(reader.getArrayBuffer(compressedLength))); - const reader2 = new BinaryReader(data.buffer); - switch (type) { - case "b": - case "c": - return reader2.getBooleanArray(arrayLength); - case "d": - return reader2.getFloat64Array(arrayLength); - case "f": - return reader2.getFloat32Array(arrayLength); - case "i": - return reader2.getInt32Array(arrayLength); - case "l": - return reader2.getInt64Array(arrayLength); - } - break; - default: - throw new Error("THREE.FBXLoader: Unknown property type " + type); - } - } -} -class BinaryReader { - static { - __name(this, "BinaryReader"); - } - constructor(buffer, littleEndian) { - this.dv = new DataView(buffer); - this.offset = 0; - this.littleEndian = littleEndian !== void 0 ? littleEndian : true; - this._textDecoder = new TextDecoder(); - } - getOffset() { - return this.offset; - } - size() { - return this.dv.buffer.byteLength; - } - skip(length) { - this.offset += length; - } - // seems like true/false representation depends on exporter. - // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54) - // then sees LSB. - getBoolean() { - return (this.getUint8() & 1) === 1; - } - getBooleanArray(size) { - const a = []; - for (let i = 0; i < size; i++) { - a.push(this.getBoolean()); - } - return a; - } - getUint8() { - const value = this.dv.getUint8(this.offset); - this.offset += 1; - return value; - } - getInt16() { - const value = this.dv.getInt16(this.offset, this.littleEndian); - this.offset += 2; - return value; - } - getInt32() { - const value = this.dv.getInt32(this.offset, this.littleEndian); - this.offset += 4; - return value; - } - getInt32Array(size) { - const a = []; - for (let i = 0; i < size; i++) { - a.push(this.getInt32()); - } - return a; - } - getUint32() { - const value = this.dv.getUint32(this.offset, this.littleEndian); - this.offset += 4; - return value; - } - // JavaScript doesn't support 64-bit integer so calculate this here - // 1 << 32 will return 1 so using multiply operation instead here. - // There's a possibility that this method returns wrong value if the value - // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER. - // TODO: safely handle 64-bit integer - getInt64() { - let low, high; - if (this.littleEndian) { - low = this.getUint32(); - high = this.getUint32(); - } else { - high = this.getUint32(); - low = this.getUint32(); - } - if (high & 2147483648) { - high = ~high & 4294967295; - low = ~low & 4294967295; - if (low === 4294967295) high = high + 1 & 4294967295; - low = low + 1 & 4294967295; - return -(high * 4294967296 + low); - } - return high * 4294967296 + low; - } - getInt64Array(size) { - const a = []; - for (let i = 0; i < size; i++) { - a.push(this.getInt64()); - } - return a; - } - // Note: see getInt64() comment - getUint64() { - let low, high; - if (this.littleEndian) { - low = this.getUint32(); - high = this.getUint32(); - } else { - high = this.getUint32(); - low = this.getUint32(); - } - return high * 4294967296 + low; - } - getFloat32() { - const value = this.dv.getFloat32(this.offset, this.littleEndian); - this.offset += 4; - return value; - } - getFloat32Array(size) { - const a = []; - for (let i = 0; i < size; i++) { - a.push(this.getFloat32()); - } - return a; - } - getFloat64() { - const value = this.dv.getFloat64(this.offset, this.littleEndian); - this.offset += 8; - return value; - } - getFloat64Array(size) { - const a = []; - for (let i = 0; i < size; i++) { - a.push(this.getFloat64()); - } - return a; - } - getArrayBuffer(size) { - const value = this.dv.buffer.slice(this.offset, this.offset + size); - this.offset += size; - return value; - } - getString(size) { - const start = this.offset; - let a = new Uint8Array(this.dv.buffer, start, size); - this.skip(size); - const nullByte = a.indexOf(0); - if (nullByte >= 0) a = new Uint8Array(this.dv.buffer, start, nullByte); - return this._textDecoder.decode(a); - } -} -class FBXTree { - static { - __name(this, "FBXTree"); - } - add(key, val) { - this[key] = val; - } -} -function isFbxFormatBinary(buffer) { - const CORRECT = "Kaydara FBX Binary \0"; - return buffer.byteLength >= CORRECT.length && CORRECT === convertArrayBufferToString(buffer, 0, CORRECT.length); -} -__name(isFbxFormatBinary, "isFbxFormatBinary"); -function isFbxFormatASCII(text) { - const CORRECT = ["K", "a", "y", "d", "a", "r", "a", "\\", "F", "B", "X", "\\", "B", "i", "n", "a", "r", "y", "\\", "\\"]; - let cursor = 0; - function read(offset) { - const result = text[offset - 1]; - text = text.slice(cursor + offset); - cursor++; - return result; - } - __name(read, "read"); - for (let i = 0; i < CORRECT.length; ++i) { - const num = read(1); - if (num === CORRECT[i]) { - return false; - } - } - return true; -} -__name(isFbxFormatASCII, "isFbxFormatASCII"); -function getFbxVersion(text) { - const versionRegExp = /FBXVersion: (\d+)/; - const match = text.match(versionRegExp); - if (match) { - const version = parseInt(match[1]); - return version; - } - throw new Error("THREE.FBXLoader: Cannot find the version number for the file given."); -} -__name(getFbxVersion, "getFbxVersion"); -function convertFBXTimeToSeconds(time) { - return time / 46186158e3; -} -__name(convertFBXTimeToSeconds, "convertFBXTimeToSeconds"); -const dataArray = []; -function getData(polygonVertexIndex, polygonIndex, vertexIndex, infoObject) { - let index; - switch (infoObject.mappingType) { - case "ByPolygonVertex": - index = polygonVertexIndex; - break; - case "ByPolygon": - index = polygonIndex; - break; - case "ByVertice": - index = vertexIndex; - break; - case "AllSame": - index = infoObject.indices[0]; - break; - default: - console.warn("THREE.FBXLoader: unknown attribute mapping type " + infoObject.mappingType); - } - if (infoObject.referenceType === "IndexToDirect") index = infoObject.indices[index]; - const from = index * infoObject.dataSize; - const to = from + infoObject.dataSize; - return slice(dataArray, infoObject.buffer, from, to); -} -__name(getData, "getData"); -const tempEuler = new Euler(); -const tempVec = new Vector3(); -function generateTransform(transformData) { - const lTranslationM = new Matrix4(); - const lPreRotationM = new Matrix4(); - const lRotationM = new Matrix4(); - const lPostRotationM = new Matrix4(); - const lScalingM = new Matrix4(); - const lScalingPivotM = new Matrix4(); - const lScalingOffsetM = new Matrix4(); - const lRotationOffsetM = new Matrix4(); - const lRotationPivotM = new Matrix4(); - const lParentGX = new Matrix4(); - const lParentLX = new Matrix4(); - const lGlobalT = new Matrix4(); - const inheritType = transformData.inheritType ? transformData.inheritType : 0; - if (transformData.translation) lTranslationM.setPosition(tempVec.fromArray(transformData.translation)); - const defaultEulerOrder = getEulerOrder(0); - if (transformData.preRotation) { - const array = transformData.preRotation.map(MathUtils.degToRad); - array.push(defaultEulerOrder); - lPreRotationM.makeRotationFromEuler(tempEuler.fromArray(array)); - } - if (transformData.rotation) { - const array = transformData.rotation.map(MathUtils.degToRad); - array.push(transformData.eulerOrder || defaultEulerOrder); - lRotationM.makeRotationFromEuler(tempEuler.fromArray(array)); - } - if (transformData.postRotation) { - const array = transformData.postRotation.map(MathUtils.degToRad); - array.push(defaultEulerOrder); - lPostRotationM.makeRotationFromEuler(tempEuler.fromArray(array)); - lPostRotationM.invert(); - } - if (transformData.scale) lScalingM.scale(tempVec.fromArray(transformData.scale)); - if (transformData.scalingOffset) lScalingOffsetM.setPosition(tempVec.fromArray(transformData.scalingOffset)); - if (transformData.scalingPivot) lScalingPivotM.setPosition(tempVec.fromArray(transformData.scalingPivot)); - if (transformData.rotationOffset) lRotationOffsetM.setPosition(tempVec.fromArray(transformData.rotationOffset)); - if (transformData.rotationPivot) lRotationPivotM.setPosition(tempVec.fromArray(transformData.rotationPivot)); - if (transformData.parentMatrixWorld) { - lParentLX.copy(transformData.parentMatrix); - lParentGX.copy(transformData.parentMatrixWorld); - } - const lLRM = lPreRotationM.clone().multiply(lRotationM).multiply(lPostRotationM); - const lParentGRM = new Matrix4(); - lParentGRM.extractRotation(lParentGX); - const lParentTM = new Matrix4(); - lParentTM.copyPosition(lParentGX); - const lParentGRSM = lParentTM.clone().invert().multiply(lParentGX); - const lParentGSM = lParentGRM.clone().invert().multiply(lParentGRSM); - const lLSM = lScalingM; - const lGlobalRS = new Matrix4(); - if (inheritType === 0) { - lGlobalRS.copy(lParentGRM).multiply(lLRM).multiply(lParentGSM).multiply(lLSM); - } else if (inheritType === 1) { - lGlobalRS.copy(lParentGRM).multiply(lParentGSM).multiply(lLRM).multiply(lLSM); - } else { - const lParentLSM = new Matrix4().scale(new Vector3().setFromMatrixScale(lParentLX)); - const lParentLSM_inv = lParentLSM.clone().invert(); - const lParentGSM_noLocal = lParentGSM.clone().multiply(lParentLSM_inv); - lGlobalRS.copy(lParentGRM).multiply(lLRM).multiply(lParentGSM_noLocal).multiply(lLSM); - } - const lRotationPivotM_inv = lRotationPivotM.clone().invert(); - const lScalingPivotM_inv = lScalingPivotM.clone().invert(); - let lTransform = lTranslationM.clone().multiply(lRotationOffsetM).multiply(lRotationPivotM).multiply(lPreRotationM).multiply(lRotationM).multiply(lPostRotationM).multiply(lRotationPivotM_inv).multiply(lScalingOffsetM).multiply(lScalingPivotM).multiply(lScalingM).multiply(lScalingPivotM_inv); - const lLocalTWithAllPivotAndOffsetInfo = new Matrix4().copyPosition(lTransform); - const lGlobalTranslation = lParentGX.clone().multiply(lLocalTWithAllPivotAndOffsetInfo); - lGlobalT.copyPosition(lGlobalTranslation); - lTransform = lGlobalT.clone().multiply(lGlobalRS); - lTransform.premultiply(lParentGX.invert()); - return lTransform; -} -__name(generateTransform, "generateTransform"); -function getEulerOrder(order) { - order = order || 0; - const enums = [ - "ZYX", - // -> XYZ extrinsic - "YZX", - // -> XZY extrinsic - "XZY", - // -> YZX extrinsic - "ZXY", - // -> YXZ extrinsic - "YXZ", - // -> ZXY extrinsic - "XYZ" - // -> ZYX extrinsic - //'SphericXYZ', // not possible to support - ]; - if (order === 6) { - console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."); - return enums[0]; - } - return enums[order]; -} -__name(getEulerOrder, "getEulerOrder"); -function parseNumberArray(value) { - const array = value.split(",").map(function(val) { - return parseFloat(val); - }); - return array; -} -__name(parseNumberArray, "parseNumberArray"); -function convertArrayBufferToString(buffer, from, to) { - if (from === void 0) from = 0; - if (to === void 0) to = buffer.byteLength; - return new TextDecoder().decode(new Uint8Array(buffer, from, to)); -} -__name(convertArrayBufferToString, "convertArrayBufferToString"); -function append(a, b) { - for (let i = 0, j = a.length, l = b.length; i < l; i++, j++) { - a[j] = b[i]; - } -} -__name(append, "append"); -function slice(a, b, from, to) { - for (let i = from, j = 0; i < to; i++, j++) { - a[j] = b[i]; - } - 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 ref2 = 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, ref2); - ref2.name += "_instance_" + cache.uses[index]++; - return ref2; - } - _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"); - } - constructor(manager) { - super(manager); - } - load(url, onLoad, onProgress, onError) { - const scope = this; - 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(text) { - try { - onLoad(scope.parse(text)); - } catch (e) { - if (onError) { - onError(e); - } else { - console.error(e); - } - scope.manager.itemError(url); - } - }, onProgress, onError); - } - parse(data) { - function isBinary(data2) { - const reader = new DataView(data2); - const face_size = 32 / 8 * 3 + 32 / 8 * 3 * 3 + 16 / 8; - const n_faces = reader.getUint32(80, true); - const expect = 80 + 32 / 8 + n_faces * face_size; - if (expect === reader.byteLength) { - return true; - } - const solid = [115, 111, 108, 105, 100]; - for (let off = 0; off < 5; off++) { - if (matchDataViewAt(solid, reader, off)) return false; - } - return true; - } - __name(isBinary, "isBinary"); - function matchDataViewAt(query, reader, offset) { - for (let i = 0, il = query.length; i < il; i++) { - if (query[i] !== reader.getUint8(offset + i)) return false; - } - return true; - } - __name(matchDataViewAt, "matchDataViewAt"); - function parseBinary(data2) { - const reader = new DataView(data2); - const faces = reader.getUint32(80, true); - let r, g, b, hasColors = false, colors; - let defaultR, defaultG, defaultB, alpha; - for (let index = 0; index < 80 - 10; index++) { - if (reader.getUint32(index, false) == 1129270351 && reader.getUint8(index + 4) == 82 && reader.getUint8(index + 5) == 61) { - hasColors = true; - colors = new Float32Array(faces * 3 * 3); - defaultR = reader.getUint8(index + 6) / 255; - defaultG = reader.getUint8(index + 7) / 255; - defaultB = reader.getUint8(index + 8) / 255; - alpha = reader.getUint8(index + 9) / 255; - } - } - const dataOffset = 84; - const faceLength = 12 * 4 + 2; - const geometry = new BufferGeometry(); - const vertices = new Float32Array(faces * 3 * 3); - const normals = new Float32Array(faces * 3 * 3); - const color = new Color(); - for (let face = 0; face < faces; face++) { - const start = dataOffset + face * faceLength; - const normalX = reader.getFloat32(start, true); - const normalY = reader.getFloat32(start + 4, true); - const normalZ = reader.getFloat32(start + 8, true); - if (hasColors) { - const packedColor = reader.getUint16(start + 48, true); - if ((packedColor & 32768) === 0) { - r = (packedColor & 31) / 31; - g = (packedColor >> 5 & 31) / 31; - b = (packedColor >> 10 & 31) / 31; - } else { - r = defaultR; - g = defaultG; - b = defaultB; - } - } - for (let i = 1; i <= 3; i++) { - const vertexstart = start + i * 12; - const componentIdx = face * 3 * 3 + (i - 1) * 3; - vertices[componentIdx] = reader.getFloat32(vertexstart, true); - vertices[componentIdx + 1] = reader.getFloat32(vertexstart + 4, true); - vertices[componentIdx + 2] = reader.getFloat32(vertexstart + 8, true); - normals[componentIdx] = normalX; - normals[componentIdx + 1] = normalY; - normals[componentIdx + 2] = normalZ; - if (hasColors) { - color.setRGB(r, g, b, SRGBColorSpace); - colors[componentIdx] = color.r; - colors[componentIdx + 1] = color.g; - colors[componentIdx + 2] = color.b; - } - } - } - geometry.setAttribute("position", new BufferAttribute(vertices, 3)); - geometry.setAttribute("normal", new BufferAttribute(normals, 3)); - if (hasColors) { - geometry.setAttribute("color", new BufferAttribute(colors, 3)); - geometry.hasColors = true; - geometry.alpha = alpha; - } - return geometry; - } - __name(parseBinary, "parseBinary"); - function parseASCII(data2) { - const geometry = new BufferGeometry(); - const patternSolid = /solid([\s\S]*?)endsolid/g; - const patternFace = /facet([\s\S]*?)endfacet/g; - const patternName = /solid\s(.+)/; - let faceCounter = 0; - const patternFloat = /[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source; - const patternVertex = new RegExp("vertex" + patternFloat + patternFloat + patternFloat, "g"); - const patternNormal = new RegExp("normal" + patternFloat + patternFloat + patternFloat, "g"); - const vertices = []; - const normals = []; - const groupNames = []; - const normal = new Vector3(); - let result; - let groupCount = 0; - let startVertex = 0; - let endVertex = 0; - while ((result = patternSolid.exec(data2)) !== null) { - startVertex = endVertex; - const solid = result[0]; - const name = (result = patternName.exec(solid)) !== null ? result[1] : ""; - groupNames.push(name); - while ((result = patternFace.exec(solid)) !== null) { - let vertexCountPerFace = 0; - let normalCountPerFace = 0; - const text = result[0]; - while ((result = patternNormal.exec(text)) !== null) { - normal.x = parseFloat(result[1]); - normal.y = parseFloat(result[2]); - normal.z = parseFloat(result[3]); - normalCountPerFace++; - } - while ((result = patternVertex.exec(text)) !== null) { - vertices.push(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])); - normals.push(normal.x, normal.y, normal.z); - vertexCountPerFace++; - endVertex++; - } - if (normalCountPerFace !== 1) { - console.error("THREE.STLLoader: Something isn't right with the normal of face number " + faceCounter); - } - if (vertexCountPerFace !== 3) { - console.error("THREE.STLLoader: Something isn't right with the vertices of face number " + faceCounter); - } - faceCounter++; - } - const start = startVertex; - const count = endVertex - startVertex; - geometry.userData.groupNames = groupNames; - geometry.addGroup(start, count, groupCount); - groupCount++; - } - geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3)); - geometry.setAttribute("normal", new Float32BufferAttribute(normals, 3)); - return geometry; - } - __name(parseASCII, "parseASCII"); - function ensureString(buffer) { - if (typeof buffer !== "string") { - return new TextDecoder().decode(buffer); - } - return buffer; - } - __name(ensureString, "ensureString"); - function ensureBinary(buffer) { - if (typeof buffer === "string") { - const array_buffer = new Uint8Array(buffer.length); - for (let i = 0; i < buffer.length; i++) { - array_buffer[i] = buffer.charCodeAt(i) & 255; - } - return array_buffer.buffer || array_buffer; - } else { - return buffer; - } - } - __name(ensureBinary, "ensureBinary"); - const binData = ensureBinary(data); - return isBinary(binData) ? parseBinary(binData) : parseASCII(ensureString(data)); - } -} -const _hoisted_1$1 = { class: "absolute top-2 left-2 flex flex-col gap-2 pointer-events-auto z-20" }; -const _hoisted_2$1 = { class: "pi pi-camera text-white text-lg" }; -const _hoisted_3 = { class: "pi pi-palette text-white text-lg" }; -const _hoisted_4 = ["value"]; -const _hoisted_5 = { - key: 0, - class: "relative" -}; -const _hoisted_6 = { class: "pi pi-sun text-white text-lg" }; -const _hoisted_7 = { - class: "absolute left-12 top-0 bg-black bg-opacity-50 p-4 rounded-lg shadow-lg", - style: { "width": "150px" } -}; -const _hoisted_8 = { - key: 1, - class: "relative" -}; -const _hoisted_9 = { class: "pi pi-expand text-white text-lg" }; -const _hoisted_10 = { - class: "absolute left-12 top-0 bg-black bg-opacity-50 p-4 rounded-lg shadow-lg", - style: { "width": "150px" } -}; -const _hoisted_11 = { key: 2 }; -const _sfc_main$1 = /* @__PURE__ */ defineComponent({ - __name: "Load3DControls", - props: { - backgroundColor: {}, - showGrid: { type: Boolean }, - showPreview: { type: Boolean }, - lightIntensity: {}, - showLightIntensityButton: { type: Boolean }, - fov: {}, - showFOVButton: { type: Boolean }, - showPreviewButton: { type: Boolean } - }, - emits: ["toggleCamera", "toggleGrid", "updateBackgroundColor", "updateLightIntensity", "updateFOV", "togglePreview"], - setup(__props, { expose: __expose, emit: __emit }) { - const props = __props; - const emit = __emit; - const backgroundColor = ref(props.backgroundColor); - const showGrid = ref(props.showGrid); - const showPreview = ref(props.showPreview); - const colorPickerRef = ref(null); - const lightIntensity = ref(props.lightIntensity); - const showLightIntensity = ref(false); - const showLightIntensityButton = ref(props.showLightIntensityButton); - const fov2 = ref(props.fov); - const showFOV = ref(false); - const showFOVButton = ref(props.showFOVButton); - const showPreviewButton = ref(props.showPreviewButton); - const toggleCamera = /* @__PURE__ */ __name(() => { - emit("toggleCamera"); - }, "toggleCamera"); - const toggleGrid = /* @__PURE__ */ __name(() => { - showGrid.value = !showGrid.value; - emit("toggleGrid", showGrid.value); - }, "toggleGrid"); - const togglePreview = /* @__PURE__ */ __name(() => { - showPreview.value = !showPreview.value; - emit("togglePreview", showPreview.value); - }, "togglePreview"); - const updateBackgroundColor = /* @__PURE__ */ __name((color) => { - emit("updateBackgroundColor", color); - }, "updateBackgroundColor"); - const openColorPicker = /* @__PURE__ */ __name(() => { - colorPickerRef.value?.click(); - }, "openColorPicker"); - const toggleLightIntensity = /* @__PURE__ */ __name(() => { - showLightIntensity.value = !showLightIntensity.value; - }, "toggleLightIntensity"); - const updateLightIntensity = /* @__PURE__ */ __name(() => { - emit("updateLightIntensity", lightIntensity.value); - }, "updateLightIntensity"); - const toggleFOV = /* @__PURE__ */ __name(() => { - showFOV.value = !showFOV.value; - }, "toggleFOV"); - const updateFOV = /* @__PURE__ */ __name(() => { - emit("updateFOV", fov2.value); - }, "updateFOV"); - const closeSlider = /* @__PURE__ */ __name((e) => { - const target = e.target; - if (!target.closest(".relative")) { - showLightIntensity.value = false; - showFOV.value = false; - } - }, "closeSlider"); - onMounted(() => { - document.addEventListener("click", closeSlider); - }); - onUnmounted(() => { - document.removeEventListener("click", closeSlider); - }); - __expose({ - backgroundColor, - showGrid, - lightIntensity, - showLightIntensityButton, - fov: fov2, - showFOVButton, - showPreviewButton - }); - return (_ctx, _cache2) => { - const _directive_tooltip = resolveDirective("tooltip"); - return openBlock(), createElementBlock("div", _hoisted_1$1, [ - createVNode(unref(script), { - class: "p-button-rounded p-button-text", - onClick: toggleCamera - }, { - default: withCtx(() => [ - withDirectives(createBaseVNode("i", _hoisted_2$1, null, 512), [ - [ - _directive_tooltip, - { value: unref(t)("load3d.switchCamera"), showDelay: 300 }, - void 0, - { right: true } - ] - ]) - ]), - _: 1 - }), - withDirectives((openBlock(), createBlock(unref(script), { - class: normalizeClass(["p-button-rounded p-button-text", { "p-button-outlined": showGrid.value }]), - onClick: toggleGrid - }, { - default: withCtx(() => _cache2[3] || (_cache2[3] = [ - createBaseVNode("i", { class: "pi pi-table text-white text-lg" }, null, -1) - ])), - _: 1 - }, 8, ["class"])), [ - [ - _directive_tooltip, - { value: unref(t)("load3d.showGrid"), showDelay: 300 }, - void 0, - { right: true } - ] - ]), - createVNode(unref(script), { - class: "p-button-rounded p-button-text", - onClick: openColorPicker - }, { - default: withCtx(() => [ - withDirectives(createBaseVNode("i", _hoisted_3, null, 512), [ - [ - _directive_tooltip, - { value: unref(t)("load3d.backgroundColor"), showDelay: 300 }, - void 0, - { right: true } - ] - ]), - createBaseVNode("input", { - type: "color", - ref_key: "colorPickerRef", - ref: colorPickerRef, - value: backgroundColor.value, - onInput: _cache2[0] || (_cache2[0] = ($event) => updateBackgroundColor($event.target.value)), - class: "absolute opacity-0 w-0 h-0 p-0 m-0 pointer-events-none" - }, null, 40, _hoisted_4) - ]), - _: 1 - }), - showLightIntensityButton.value ? (openBlock(), createElementBlock("div", _hoisted_5, [ - createVNode(unref(script), { - class: "p-button-rounded p-button-text", - onClick: toggleLightIntensity - }, { - default: withCtx(() => [ - withDirectives(createBaseVNode("i", _hoisted_6, null, 512), [ - [ - _directive_tooltip, - { - value: unref(t)("load3d.lightIntensity"), - showDelay: 300 - }, - void 0, - { right: true } - ] - ]) - ]), - _: 1 - }), - withDirectives(createBaseVNode("div", _hoisted_7, [ - createVNode(unref(script$1), { - modelValue: lightIntensity.value, - "onUpdate:modelValue": _cache2[1] || (_cache2[1] = ($event) => lightIntensity.value = $event), - class: "w-full", - onChange: updateLightIntensity, - min: 1, - max: 20, - step: 1 - }, null, 8, ["modelValue"]) - ], 512), [ - [vShow, showLightIntensity.value] - ]) - ])) : createCommentVNode("", true), - showFOVButton.value ? (openBlock(), createElementBlock("div", _hoisted_8, [ - createVNode(unref(script), { - class: "p-button-rounded p-button-text", - onClick: toggleFOV - }, { - default: withCtx(() => [ - withDirectives(createBaseVNode("i", _hoisted_9, null, 512), [ - [ - _directive_tooltip, - { value: unref(t)("load3d.fov"), showDelay: 300 }, - void 0, - { right: true } - ] - ]) - ]), - _: 1 - }), - withDirectives(createBaseVNode("div", _hoisted_10, [ - createVNode(unref(script$1), { - modelValue: fov2.value, - "onUpdate:modelValue": _cache2[2] || (_cache2[2] = ($event) => fov2.value = $event), - class: "w-full", - onChange: updateFOV, - min: 10, - max: 150, - step: 1 - }, null, 8, ["modelValue"]) - ], 512), [ - [vShow, showFOV.value] - ]) - ])) : createCommentVNode("", true), - showPreviewButton.value ? (openBlock(), createElementBlock("div", _hoisted_11, [ - createVNode(unref(script), { - class: "p-button-rounded p-button-text", - onClick: togglePreview - }, { - default: withCtx(() => [ - withDirectives(createBaseVNode("i", { - class: normalizeClass([ - "pi", - showPreview.value ? "pi-eye" : "pi-eye-slash", - "text-white text-lg" - ]) - }, null, 2), [ - [ - _directive_tooltip, - { value: unref(t)("load3d.previewOutput"), showDelay: 300 }, - void 0, - { right: true } - ] - ]) - ]), - _: 1 - }) - ])) : createCommentVNode("", true) - ]); - }; - } -}); -class Load3d { - static { - __name(this, "Load3d"); - } - scene; - perspectiveCamera; - orthographicCamera; - activeCamera; - renderer; - controls; - gltfLoader; - objLoader; - mtlLoader; - fbxLoader; - stlLoader; - currentModel = null; - originalModel = null; - animationFrameId = null; - gridHelper; - lights = []; - clock; - normalMaterial; - standardMaterial; - wireframeMaterial; - depthMaterial; - originalMaterials = /* @__PURE__ */ new WeakMap(); - materialMode = "original"; - currentUpDirection = "original"; - originalRotation = null; - viewHelper = {}; - viewHelperContainer = {}; - previewRenderer = null; - previewCamera = null; - previewContainer = {}; - targetWidth = 1024; - targetHeight = 1024; - showPreview = true; - node = {}; - controlsApp = null; - controlsContainer; - constructor(container, options = {}) { - this.scene = new Scene(); - this.perspectiveCamera = new PerspectiveCamera(75, 1, 0.1, 1e3); - this.perspectiveCamera.position.set(5, 5, 5); - const frustumSize = 10; - this.orthographicCamera = new OrthographicCamera( - -frustumSize / 2, - frustumSize / 2, - frustumSize / 2, - -frustumSize / 2, - 0.1, - 1e3 - ); - this.orthographicCamera.position.set(5, 5, 5); - this.activeCamera = this.perspectiveCamera; - this.perspectiveCamera.lookAt(0, 0, 0); - this.orthographicCamera.lookAt(0, 0, 0); - this.renderer = new WebGLRenderer({ alpha: true, antialias: true }); - this.renderer.setSize(300, 300); - this.renderer.setClearColor(2631720); - this.renderer.autoClear = false; - const rendererDomElement = this.renderer.domElement; - container.appendChild(rendererDomElement); - this.controls = new OrbitControls( - this.activeCamera, - this.renderer.domElement - ); - this.controls.enableDamping = true; - this.controls.addEventListener("end", () => { - this.storeNodeProperty("Camera Info", this.getCameraState()); - }); - this.gltfLoader = new GLTFLoader(); - this.objLoader = new OBJLoader(); - this.mtlLoader = new MTLLoader(); - this.fbxLoader = new FBXLoader(); - this.stlLoader = new STLLoader(); - this.clock = new Clock(); - this.setupLights(); - this.gridHelper = new GridHelper(10, 10); - this.gridHelper.position.set(0, 0, 0); - this.scene.add(this.gridHelper); - this.normalMaterial = new MeshNormalMaterial({ - flatShading: false, - side: DoubleSide, - normalScale: new Vector2(1, 1), - transparent: false, - opacity: 1 - }); - this.wireframeMaterial = new MeshBasicMaterial({ - color: 16777215, - wireframe: true, - transparent: false, - opacity: 1 - }); - this.depthMaterial = new MeshDepthMaterial({ - depthPacking: BasicDepthPacking, - side: DoubleSide - }); - this.standardMaterial = this.createSTLMaterial(); - this.createViewHelper(container); - if (options && options.createPreview) { - this.createCapturePreview(container); - } - this.controlsContainer = document.createElement("div"); - this.controlsContainer.style.position = "absolute"; - this.controlsContainer.style.top = "0"; - this.controlsContainer.style.left = "0"; - this.controlsContainer.style.width = "100%"; - this.controlsContainer.style.height = "100%"; - this.controlsContainer.style.pointerEvents = "none"; - this.controlsContainer.style.zIndex = "1"; - container.appendChild(this.controlsContainer); - this.mountControls(options); - this.handleResize(); - this.startAnimation(); - } - mountControls(options = {}) { - const controlsMount = document.createElement("div"); - controlsMount.style.pointerEvents = "auto"; - this.controlsContainer.appendChild(controlsMount); - this.controlsApp = createApp(_sfc_main$1, { - backgroundColor: "#282828", - showGrid: true, - showPreview: options.createPreview, - lightIntensity: 5, - showLightIntensityButton: true, - fov: 75, - showFOVButton: true, - showPreviewButton: options.createPreview, - onToggleCamera: /* @__PURE__ */ __name(() => this.toggleCamera(), "onToggleCamera"), - onToggleGrid: /* @__PURE__ */ __name((show) => this.toggleGrid(show), "onToggleGrid"), - onTogglePreview: /* @__PURE__ */ __name((show) => this.togglePreview(show), "onTogglePreview"), - onUpdateBackgroundColor: /* @__PURE__ */ __name((color) => this.setBackgroundColor(color), "onUpdateBackgroundColor"), - onUpdateLightIntensity: /* @__PURE__ */ __name((lightIntensity) => this.setLightIntensity(lightIntensity), "onUpdateLightIntensity"), - onUpdateFOV: /* @__PURE__ */ __name((fov2) => this.setFOV(fov2), "onUpdateFOV") - }); - this.controlsApp.directive("tooltip", Tooltip); - this.controlsApp.mount(controlsMount); - } - setNode(node) { - this.node = node; - } - storeNodeProperty(name, value) { - if (this.node) { - this.node.properties[name] = value; - } - } - loadNodeProperty(name, defaultValue) { - if (!this.node || !this.node.properties || !(name in this.node.properties)) { - return defaultValue; - } - return this.node.properties[name]; - } - createCapturePreview(container) { - this.previewRenderer = new WebGLRenderer({ - alpha: true, - antialias: true - }); - this.previewRenderer.setSize(this.targetWidth, this.targetHeight); - this.previewRenderer.setClearColor(2631720); - this.previewContainer = document.createElement("div"); - this.previewContainer.style.cssText = ` - position: absolute; - right: 0px; - bottom: 0px; - background: rgba(0, 0, 0, 0.2); - display: block; - `; - this.previewContainer.appendChild(this.previewRenderer.domElement); - this.previewContainer.style.display = this.showPreview ? "block" : "none"; - container.appendChild(this.previewContainer); - } - updatePreviewRender() { - if (!this.previewRenderer || !this.previewContainer || !this.showPreview) - return; - if (!this.previewCamera || this.activeCamera instanceof PerspectiveCamera && !(this.previewCamera instanceof PerspectiveCamera) || this.activeCamera instanceof OrthographicCamera && !(this.previewCamera instanceof OrthographicCamera)) { - this.previewCamera = this.activeCamera.clone(); - } - this.previewCamera.position.copy(this.activeCamera.position); - this.previewCamera.rotation.copy(this.activeCamera.rotation); - const aspect2 = this.targetWidth / this.targetHeight; - if (this.activeCamera instanceof OrthographicCamera) { - const activeOrtho = this.activeCamera; - const previewOrtho = this.previewCamera; - const frustumHeight = (activeOrtho.top - activeOrtho.bottom) / activeOrtho.zoom; - const frustumWidth = frustumHeight * aspect2; - previewOrtho.top = frustumHeight / 2; - previewOrtho.left = -frustumWidth / 2; - previewOrtho.right = frustumWidth / 2; - previewOrtho.bottom = -frustumHeight / 2; - previewOrtho.zoom = 1; - previewOrtho.updateProjectionMatrix(); - } else { - ; - this.previewCamera.aspect = aspect2; - this.previewCamera.fov = this.activeCamera.fov; - } - this.previewCamera.lookAt(this.controls.target); - const previewWidth = 120; - const previewHeight = previewWidth * this.targetHeight / this.targetWidth; - this.previewRenderer.setSize(previewWidth, previewHeight, false); - this.previewRenderer.render(this.scene, this.previewCamera); - } - updatePreviewSize() { - if (!this.previewContainer) return; - const previewWidth = 120; - const previewHeight = previewWidth * this.targetHeight / this.targetWidth; - this.previewRenderer?.setSize(previewWidth, previewHeight, false); - } - setTargetSize(width, height) { - this.targetWidth = width; - this.targetHeight = height; - this.updatePreviewSize(); - if (this.previewRenderer && this.previewCamera) { - if (this.previewCamera instanceof PerspectiveCamera) { - this.previewCamera.aspect = width / height; - this.previewCamera.updateProjectionMatrix(); - } else if (this.previewCamera instanceof OrthographicCamera) { - const frustumSize = 10; - const aspect2 = width / height; - this.previewCamera.left = -frustumSize * aspect2 / 2; - this.previewCamera.right = frustumSize * aspect2 / 2; - this.previewCamera.updateProjectionMatrix(); - } - } - } - createViewHelper(container) { - this.viewHelperContainer = document.createElement("div"); - this.viewHelperContainer.style.position = "absolute"; - this.viewHelperContainer.style.bottom = "0"; - this.viewHelperContainer.style.left = "0"; - this.viewHelperContainer.style.width = "128px"; - this.viewHelperContainer.style.height = "128px"; - this.viewHelperContainer.addEventListener("pointerup", (event) => { - event.stopPropagation(); - this.viewHelper.handleClick(event); - }); - this.viewHelperContainer.addEventListener("pointerdown", (event) => { - event.stopPropagation(); - }); - container.appendChild(this.viewHelperContainer); - this.viewHelper = new ViewHelper( - this.activeCamera, - this.viewHelperContainer - ); - this.viewHelper.center = this.controls.target; - } - setFOV(fov2) { - if (this.activeCamera === this.perspectiveCamera) { - this.perspectiveCamera.fov = fov2; - this.perspectiveCamera.updateProjectionMatrix(); - this.renderer.render(this.scene, this.activeCamera); - this.storeNodeProperty("FOV", fov2); - } - if (this.previewRenderer && this.previewCamera instanceof PerspectiveCamera) { - this.previewCamera.fov = fov2; - this.previewCamera.updateProjectionMatrix(); - this.previewRenderer.render(this.scene, this.previewCamera); - } - } - getCameraState() { - const currentType = this.getCurrentCameraType(); - return { - position: this.activeCamera.position.clone(), - target: this.controls.target.clone(), - zoom: this.activeCamera instanceof OrthographicCamera ? this.activeCamera.zoom : this.activeCamera.zoom, - cameraType: currentType - }; - } - setCameraState(state) { - this.activeCamera.position.copy(state.position); - this.controls.target.copy(state.target); - if (this.activeCamera instanceof OrthographicCamera) { - this.activeCamera.zoom = state.zoom; - this.activeCamera.updateProjectionMatrix(); - } else if (this.activeCamera instanceof PerspectiveCamera) { - this.activeCamera.zoom = state.zoom; - this.activeCamera.updateProjectionMatrix(); - } - this.controls.update(); - } - setUpDirection(direction) { - if (!this.currentModel) return; - if (!this.originalRotation && this.currentModel.rotation) { - this.originalRotation = this.currentModel.rotation.clone(); - } - this.currentUpDirection = direction; - if (this.originalRotation) { - this.currentModel.rotation.copy(this.originalRotation); - } - switch (direction) { - case "original": - break; - case "-x": - this.currentModel.rotation.z = Math.PI / 2; - break; - case "+x": - this.currentModel.rotation.z = -Math.PI / 2; - break; - case "-y": - this.currentModel.rotation.x = Math.PI; - break; - case "+y": - break; - case "-z": - this.currentModel.rotation.x = Math.PI / 2; - break; - case "+z": - this.currentModel.rotation.x = -Math.PI / 2; - break; - } - this.renderer.render(this.scene, this.activeCamera); - } - setMaterialMode(mode) { - this.materialMode = mode; - if (this.controlsApp?._instance?.exposed) { - this.controlsApp._instance.exposed.showLightIntensityButton.value = mode == "original"; - } - if (this.currentModel) { - if (mode === "depth") { - this.renderer.outputColorSpace = LinearSRGBColorSpace; - } else { - this.renderer.outputColorSpace = SRGBColorSpace; - } - this.currentModel.traverse((child) => { - if (child instanceof Mesh) { - switch (mode) { - case "depth": - if (!this.originalMaterials.has(child)) { - this.originalMaterials.set(child, child.material); - } - const depthMat = new MeshDepthMaterial({ - depthPacking: BasicDepthPacking, - side: DoubleSide - }); - depthMat.onBeforeCompile = (shader) => { - shader.uniforms.cameraType = { - value: this.activeCamera instanceof OrthographicCamera ? 1 : 0 - }; - shader.fragmentShader = ` - uniform float cameraType; - ${shader.fragmentShader} - `; - shader.fragmentShader = shader.fragmentShader.replace( - /gl_FragColor\s*=\s*vec4\(\s*vec3\(\s*1.0\s*-\s*fragCoordZ\s*\)\s*,\s*opacity\s*\)\s*;/, - ` - float depth = 1.0 - fragCoordZ; - if (cameraType > 0.5) { - depth = pow(depth, 400.0); - } else { - depth = pow(depth, 0.6); - } - gl_FragColor = vec4(vec3(depth), opacity); - ` - ); - }; - depthMat.customProgramCacheKey = () => { - return this.activeCamera instanceof OrthographicCamera ? "ortho" : "persp"; - }; - child.material = depthMat; - break; - case "normal": - if (!this.originalMaterials.has(child)) { - this.originalMaterials.set(child, child.material); - } - child.material = new MeshNormalMaterial({ - flatShading: false, - side: DoubleSide, - normalScale: new Vector2(1, 1), - transparent: false, - opacity: 1 - }); - child.geometry.computeVertexNormals(); - break; - case "wireframe": - if (!this.originalMaterials.has(child)) { - this.originalMaterials.set(child, child.material); - } - child.material = new MeshBasicMaterial({ - color: 16777215, - wireframe: true, - transparent: false, - opacity: 1 - }); - break; - case "original": - const originalMaterial = this.originalMaterials.get(child); - if (originalMaterial) { - child.material = originalMaterial; - } else { - child.material = this.standardMaterial; - } - break; - } - } - }); - this.renderer.render(this.scene, this.activeCamera); - } - } - setupLights() { - const ambientLight = new AmbientLight(16777215, 0.5); - this.scene.add(ambientLight); - this.lights.push(ambientLight); - const mainLight = new DirectionalLight(16777215, 0.8); - mainLight.position.set(0, 10, 10); - this.scene.add(mainLight); - this.lights.push(mainLight); - const backLight = new DirectionalLight(16777215, 0.5); - backLight.position.set(0, 10, -10); - this.scene.add(backLight); - this.lights.push(backLight); - const leftFillLight = new DirectionalLight(16777215, 0.3); - leftFillLight.position.set(-10, 0, 0); - this.scene.add(leftFillLight); - this.lights.push(leftFillLight); - const rightFillLight = new DirectionalLight(16777215, 0.3); - rightFillLight.position.set(10, 0, 0); - this.scene.add(rightFillLight); - this.lights.push(rightFillLight); - const bottomLight = new DirectionalLight(16777215, 0.2); - bottomLight.position.set(0, -10, 0); - this.scene.add(bottomLight); - this.lights.push(bottomLight); - } - toggleCamera(cameraType) { - const oldCamera = this.activeCamera; - const position = oldCamera.position.clone(); - const rotation = oldCamera.rotation.clone(); - const target = this.controls.target.clone(); - if (!cameraType) { - this.activeCamera = oldCamera === this.perspectiveCamera ? this.orthographicCamera : this.perspectiveCamera; - } else { - this.activeCamera = cameraType === "perspective" ? this.perspectiveCamera : this.orthographicCamera; - if (oldCamera === this.activeCamera) { - return; - } - } - if (this.previewCamera) { - this.previewCamera = null; - } - this.previewCamera = this.activeCamera.clone(); - this.activeCamera.position.copy(position); - this.activeCamera.rotation.copy(rotation); - if (this.materialMode === "depth" && oldCamera !== this.activeCamera) { - this.setMaterialMode("depth"); - } - this.controls.object = this.activeCamera; - this.controls.target.copy(target); - this.controls.update(); - this.viewHelper.dispose(); - this.viewHelper = new ViewHelper( - this.activeCamera, - this.viewHelperContainer - ); - this.viewHelper.center = this.controls.target; - if (this.controlsApp?._instance?.exposed) { - this.controlsApp._instance.exposed.showFOVButton.value = this.getCurrentCameraType() == "perspective"; - } - this.storeNodeProperty("Camera Type", this.getCurrentCameraType()); - this.handleResize(); - this.updatePreviewRender(); - } - getCurrentCameraType() { - return this.activeCamera === this.perspectiveCamera ? "perspective" : "orthographic"; - } - toggleGrid(showGrid) { - if (this.gridHelper) { - this.gridHelper.visible = showGrid; - this.storeNodeProperty("Show Grid", showGrid); - } - } - togglePreview(showPreview) { - if (this.previewRenderer) { - this.showPreview = showPreview; - this.previewContainer.style.display = this.showPreview ? "block" : "none"; - this.storeNodeProperty("Show Preview", showPreview); - } - } - setLightIntensity(intensity) { - this.lights.forEach((light) => { - if (light instanceof DirectionalLight) { - if (light === this.lights[1]) { - light.intensity = intensity * 0.8; - } else if (light === this.lights[2]) { - light.intensity = intensity * 0.5; - } else if (light === this.lights[5]) { - light.intensity = intensity * 0.2; - } else { - light.intensity = intensity * 0.3; - } - } else if (light instanceof AmbientLight) { - light.intensity = intensity * 0.5; - } - }); - this.storeNodeProperty("Light Intensity", intensity); - } - startAnimation() { - const animate = /* @__PURE__ */ __name(() => { - this.animationFrameId = requestAnimationFrame(animate); - if (this.showPreview) { - this.updatePreviewRender(); - } - const delta = this.clock.getDelta(); - if (this.viewHelper.animating) { - this.viewHelper.update(delta); - if (!this.viewHelper.animating) { - this.storeNodeProperty("Camera Info", this.getCameraState()); - } - } - this.renderer.clear(); - this.controls.update(); - this.renderer.render(this.scene, this.activeCamera); - this.viewHelper.render(this.renderer); - }, "animate"); - animate(); - } - clearModel() { - const objectsToRemove = []; - this.scene.traverse((object) => { - const isEnvironmentObject = object === this.gridHelper || this.lights.includes(object) || object === this.perspectiveCamera || object === this.orthographicCamera; - if (!isEnvironmentObject) { - objectsToRemove.push(object); - } - }); - objectsToRemove.forEach((obj) => { - if (obj.parent && obj.parent !== this.scene) { - obj.parent.remove(obj); - } else { - this.scene.remove(obj); - } - if (obj instanceof Mesh) { - obj.geometry?.dispose(); - if (Array.isArray(obj.material)) { - obj.material.forEach((material) => material.dispose()); - } else { - obj.material?.dispose(); - } - } - }); - this.resetScene(); - } - resetScene() { - this.currentModel = null; - this.originalRotation = null; - const defaultDistance = 10; - this.perspectiveCamera.position.set( - defaultDistance, - defaultDistance, - defaultDistance - ); - this.orthographicCamera.position.set( - defaultDistance, - defaultDistance, - defaultDistance - ); - this.perspectiveCamera.lookAt(0, 0, 0); - this.orthographicCamera.lookAt(0, 0, 0); - const frustumSize = 10; - const aspect2 = this.renderer.domElement.width / this.renderer.domElement.height; - this.orthographicCamera.left = -frustumSize * aspect2 / 2; - this.orthographicCamera.right = frustumSize * aspect2 / 2; - this.orthographicCamera.top = frustumSize / 2; - this.orthographicCamera.bottom = -frustumSize / 2; - this.perspectiveCamera.updateProjectionMatrix(); - this.orthographicCamera.updateProjectionMatrix(); - this.controls.target.set(0, 0, 0); - this.controls.update(); - this.renderer.render(this.scene, this.activeCamera); - this.materialMode = "original"; - this.originalMaterials = /* @__PURE__ */ new WeakMap(); - this.renderer.outputColorSpace = SRGBColorSpace; - } - remove() { - if (this.animationFrameId !== null) { - cancelAnimationFrame(this.animationFrameId); - } - this.controls.dispose(); - this.viewHelper.dispose(); - this.renderer.dispose(); - if (this.controlsApp) { - this.controlsApp.unmount(); - this.controlsApp = null; - } - this.renderer.domElement.remove(); - this.scene.clear(); - } - async loadModelInternal(url, fileExtension) { - let model = null; - switch (fileExtension) { - case "stl": - const geometry = await this.stlLoader.loadAsync(url); - this.originalModel = geometry; - geometry.computeVertexNormals(); - const mesh = new Mesh(geometry, this.standardMaterial); - const group = new Group(); - group.add(mesh); - model = group; - break; - case "fbx": - const fbxModel = await this.fbxLoader.loadAsync(url); - this.originalModel = fbxModel; - model = fbxModel; - fbxModel.traverse((child) => { - if (child instanceof Mesh) { - this.originalMaterials.set(child, child.material); - } - }); - break; - case "obj": - if (this.materialMode === "original") { - const mtlUrl = url.replace(/\.obj([^.]*$)/, ".mtl$1"); - try { - const materials = await this.mtlLoader.loadAsync(mtlUrl); - materials.preload(); - this.objLoader.setMaterials(materials); - } catch (e) { - console.log( - "No MTL file found or error loading it, continuing without materials" - ); - } - } - model = await this.objLoader.loadAsync(url); - model.traverse((child) => { - if (child instanceof Mesh) { - this.originalMaterials.set(child, child.material); - } - }); - break; - case "gltf": - case "glb": - const gltf = await this.gltfLoader.loadAsync(url); - this.originalModel = gltf; - model = gltf.scene; - gltf.scene.traverse((child) => { - if (child instanceof Mesh) { - child.geometry.computeVertexNormals(); - this.originalMaterials.set(child, child.material); - } - }); - break; - } - return model; - } - async loadModel(url, originalFileName) { - try { - this.clearModel(); - let fileExtension; - if (originalFileName) { - fileExtension = originalFileName.split(".").pop()?.toLowerCase(); - } else { - const filename = new URLSearchParams(url.split("?")[1]).get("filename"); - fileExtension = filename?.split(".").pop()?.toLowerCase(); - } - if (!fileExtension) { - useToastStore().addAlert("Could not determine file type"); - return; - } - let model = await this.loadModelInternal(url, fileExtension); - if (model) { - this.currentModel = model; - await this.setupModel(model); - } - } catch (error) { - console.error("Error loading model:", error); - } - } - async setupModel(model) { - const box = new Box3().setFromObject(model); - const size = box.getSize(new Vector3()); - const center = box.getCenter(new Vector3()); - const maxDim = Math.max(size.x, size.y, size.z); - const targetSize = 5; - const scale = targetSize / maxDim; - model.scale.multiplyScalar(scale); - box.setFromObject(model); - box.getCenter(center); - box.getSize(size); - model.position.set(-center.x, -box.min.y, -center.z); - this.scene.add(model); - if (this.materialMode !== "original") { - this.setMaterialMode(this.materialMode); - } - if (this.currentUpDirection !== "original") { - this.setUpDirection(this.currentUpDirection); - } - await this.setupCamera(size); - } - async setupCamera(size) { - const distance = Math.max(size.x, size.z) * 2; - const height = size.y * 2; - this.perspectiveCamera.position.set(distance, height, distance); - this.orthographicCamera.position.set(distance, height, distance); - if (this.activeCamera === this.perspectiveCamera) { - this.perspectiveCamera.lookAt(0, size.y / 2, 0); - this.perspectiveCamera.updateProjectionMatrix(); - } else { - const frustumSize = Math.max(size.x, size.y, size.z) * 2; - const aspect2 = this.renderer.domElement.width / this.renderer.domElement.height; - this.orthographicCamera.left = -frustumSize * aspect2 / 2; - this.orthographicCamera.right = frustumSize * aspect2 / 2; - this.orthographicCamera.top = frustumSize / 2; - this.orthographicCamera.bottom = -frustumSize / 2; - this.orthographicCamera.lookAt(0, size.y / 2, 0); - this.orthographicCamera.updateProjectionMatrix(); - } - this.controls.target.set(0, size.y / 2, 0); - this.controls.update(); - this.renderer.outputColorSpace = SRGBColorSpace; - this.renderer.toneMapping = ACESFilmicToneMapping; - this.renderer.toneMappingExposure = 1; - this.handleResize(); - } - refreshViewport() { - this.handleResize(); - } - handleResize() { - const parentElement = this.renderer?.domElement?.parentElement; - if (!parentElement) { - console.warn("Parent element not found"); - return; - } - const width = parentElement?.clientWidth; - const height = parentElement?.clientHeight; - if (this.activeCamera === this.perspectiveCamera) { - this.perspectiveCamera.aspect = width / height; - this.perspectiveCamera.updateProjectionMatrix(); - } else { - const frustumSize = 10; - const aspect2 = width / height; - this.orthographicCamera.left = -frustumSize * aspect2 / 2; - this.orthographicCamera.right = frustumSize * aspect2 / 2; - this.orthographicCamera.top = frustumSize / 2; - this.orthographicCamera.bottom = -frustumSize / 2; - this.orthographicCamera.updateProjectionMatrix(); - } - this.renderer.setSize(width, height); - this.setTargetSize(this.targetWidth, this.targetHeight); - } - animate = /* @__PURE__ */ __name(() => { - requestAnimationFrame(this.animate); - this.controls.update(); - this.renderer.render(this.scene, this.activeCamera); - }, "animate"); - captureScene(width, height) { - return new Promise(async (resolve, reject) => { - try { - this.updatePreviewSize(); - 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; - this.perspectiveCamera.updateProjectionMatrix(); - } else { - const frustumSize = 10; - const aspect2 = width / height; - this.orthographicCamera.left = -frustumSize * aspect2 / 2; - this.orthographicCamera.right = frustumSize * aspect2 / 2; - this.orthographicCamera.top = frustumSize / 2; - this.orthographicCamera.bottom = -frustumSize / 2; - this.orthographicCamera.updateProjectionMatrix(); - } - this.renderer.clear(); - this.renderer.render(this.scene, this.activeCamera); - const sceneData = this.renderer.domElement.toDataURL("image/png"); - this.renderer.setClearColor(0, 0); - this.renderer.clear(); - 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({ scene: sceneData, mask: maskData }); - } catch (error) { - reject(error); - } - }); - } - createSTLMaterial() { - return new MeshStandardMaterial({ - color: 8421504, - metalness: 0.1, - roughness: 0.8, - flatShading: false, - side: DoubleSide - }); - } - setBackgroundColor(color) { - this.renderer.setClearColor(new Color(color)); - this.renderer.render(this.scene, this.activeCamera); - if (this.controlsApp?._instance?.exposed) { - this.controlsApp._instance.exposed.backgroundColor.value = color; - } - this.storeNodeProperty("Background Color", color); - } -} -const _hoisted_1 = { class: "absolute top-0 left-0 w-full h-full pointer-events-none" }; -const _hoisted_2 = { - key: 0, - class: "absolute top-0 left-0 w-full flex justify-center pt-2 gap-2 items-center pointer-events-auto z-10" -}; -const _sfc_main = /* @__PURE__ */ defineComponent({ - __name: "Load3DAnimationControls", - props: { - animations: {}, - playing: { type: Boolean }, - backgroundColor: {}, - showGrid: { type: Boolean }, - showPreview: { type: Boolean }, - lightIntensity: {}, - showLightIntensityButton: { type: Boolean }, - fov: {}, - showFOVButton: { type: Boolean }, - showPreviewButton: { type: Boolean } - }, - emits: ["toggleCamera", "toggleGrid", "togglePreview", "updateBackgroundColor", "togglePlay", "speedChange", "animationChange", "updateLightIntensity", "updateFOV"], - setup(__props, { expose: __expose, emit: __emit }) { - const props = __props; - const emit = __emit; - const animations = ref(props.animations); - const playing = ref(props.playing); - const selectedSpeed = ref(1); - const selectedAnimation = ref(0); - const backgroundColor = ref(props.backgroundColor); - const showGrid = ref(props.showGrid); - const showPreview = ref(props.showPreview); - const lightIntensity = ref(props.lightIntensity); - const showLightIntensityButton = ref(props.showLightIntensityButton); - const fov2 = ref(props.fov); - const showFOVButton = ref(props.showFOVButton); - const showPreviewButton = ref(props.showPreviewButton); - const load3dControlsRef = ref(null); - const speedOptions = [ - { name: "0.1x", value: 0.1 }, - { name: "0.5x", value: 0.5 }, - { name: "1x", value: 1 }, - { name: "1.5x", value: 1.5 }, - { name: "2x", value: 2 } - ]; - watch(backgroundColor, (newValue) => { - load3dControlsRef.value.backgroundColor = newValue; - }); - watch(showLightIntensityButton, (newValue) => { - load3dControlsRef.value.showLightIntensityButton = newValue; - }); - watch(showFOVButton, (newValue) => { - load3dControlsRef.value.showFOVButton = newValue; - }); - watch(showPreviewButton, (newValue) => { - load3dControlsRef.value.showPreviewButton = newValue; - }); - const onToggleCamera = /* @__PURE__ */ __name(() => { - emit("toggleCamera"); - }, "onToggleCamera"); - const onToggleGrid = /* @__PURE__ */ __name((value) => emit("toggleGrid", value), "onToggleGrid"); - const onTogglePreview = /* @__PURE__ */ __name((value) => { - emit("togglePreview", value); - }, "onTogglePreview"); - const onUpdateBackgroundColor = /* @__PURE__ */ __name((color) => emit("updateBackgroundColor", color), "onUpdateBackgroundColor"); - const onUpdateLightIntensity = /* @__PURE__ */ __name((lightIntensity2) => { - emit("updateLightIntensity", lightIntensity2); - }, "onUpdateLightIntensity"); - const onUpdateFOV = /* @__PURE__ */ __name((fov22) => { - emit("updateFOV", fov22); - }, "onUpdateFOV"); - const togglePlay = /* @__PURE__ */ __name(() => { - playing.value = !playing.value; - emit("togglePlay", playing.value); - }, "togglePlay"); - const speedChange = /* @__PURE__ */ __name(() => { - emit("speedChange", selectedSpeed.value); - }, "speedChange"); - const animationChange = /* @__PURE__ */ __name(() => { - emit("animationChange", selectedAnimation.value); - }, "animationChange"); - __expose({ - animations, - selectedAnimation, - playing, - backgroundColor, - showGrid, - lightIntensity, - showLightIntensityButton, - fov: fov2, - showFOVButton - }); - return (_ctx, _cache2) => { - return openBlock(), createElementBlock("div", _hoisted_1, [ - createVNode(_sfc_main$1, { - backgroundColor: backgroundColor.value, - showGrid: showGrid.value, - showPreview: showPreview.value, - lightIntensity: lightIntensity.value, - showLightIntensityButton: showLightIntensityButton.value, - fov: fov2.value, - showFOVButton: showFOVButton.value, - showPreviewButton: showPreviewButton.value, - onToggleCamera, - onToggleGrid, - onTogglePreview, - onUpdateBackgroundColor, - onUpdateLightIntensity, - onUpdateFOV, - ref_key: "load3dControlsRef", - ref: load3dControlsRef - }, null, 8, ["backgroundColor", "showGrid", "showPreview", "lightIntensity", "showLightIntensityButton", "fov", "showFOVButton", "showPreviewButton"]), - animations.value && animations.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_2, [ - createVNode(unref(script), { - class: "p-button-rounded p-button-text", - onClick: togglePlay - }, { - default: withCtx(() => [ - createBaseVNode("i", { - class: normalizeClass([ - "pi", - playing.value ? "pi-pause" : "pi-play", - "text-white text-lg" - ]) - }, null, 2) - ]), - _: 1 - }), - createVNode(unref(script$2), { - modelValue: selectedSpeed.value, - "onUpdate:modelValue": _cache2[0] || (_cache2[0] = ($event) => selectedSpeed.value = $event), - options: speedOptions, - optionLabel: "name", - optionValue: "value", - onChange: speedChange, - class: "w-24" - }, null, 8, ["modelValue"]), - createVNode(unref(script$2), { - modelValue: selectedAnimation.value, - "onUpdate:modelValue": _cache2[1] || (_cache2[1] = ($event) => selectedAnimation.value = $event), - options: animations.value, - optionLabel: "name", - optionValue: "index", - onChange: animationChange, - class: "w-32" - }, null, 8, ["modelValue", "options"]) - ])) : createCommentVNode("", true) - ]); - }; - } -}); -class Load3dAnimation extends Load3d { - static { - __name(this, "Load3dAnimation"); - } - currentAnimation = null; - animationActions = []; - animationClips = []; - selectedAnimationIndex = 0; - isAnimationPlaying = false; - animationSpeed = 1; - constructor(container, options = {}) { - super(container, options); - } - mountControls(options = {}) { - const controlsMount = document.createElement("div"); - controlsMount.style.pointerEvents = "auto"; - this.controlsContainer.appendChild(controlsMount); - this.controlsApp = createApp(_sfc_main, { - backgroundColor: "#282828", - showGrid: true, - showPreview: options.createPreview, - animations: [], - playing: false, - lightIntensity: 5, - showLightIntensityButton: true, - fov: 75, - showFOVButton: true, - showPreviewButton: options.createPreview, - onToggleCamera: /* @__PURE__ */ __name(() => this.toggleCamera(), "onToggleCamera"), - onToggleGrid: /* @__PURE__ */ __name((show) => this.toggleGrid(show), "onToggleGrid"), - onTogglePreview: /* @__PURE__ */ __name((show) => this.togglePreview(show), "onTogglePreview"), - onUpdateBackgroundColor: /* @__PURE__ */ __name((color) => this.setBackgroundColor(color), "onUpdateBackgroundColor"), - onTogglePlay: /* @__PURE__ */ __name((play) => this.toggleAnimation(play), "onTogglePlay"), - onSpeedChange: /* @__PURE__ */ __name((speed) => this.setAnimationSpeed(speed), "onSpeedChange"), - onAnimationChange: /* @__PURE__ */ __name((selectedAnimation) => this.updateSelectedAnimation(selectedAnimation), "onAnimationChange"), - onUpdateLightIntensity: /* @__PURE__ */ __name((lightIntensity) => this.setLightIntensity(lightIntensity), "onUpdateLightIntensity"), - onUpdateFOV: /* @__PURE__ */ __name((fov2) => this.setFOV(fov2), "onUpdateFOV") - }); - this.controlsApp.use(PrimeVue); - this.controlsApp.directive("tooltip", Tooltip); - this.controlsApp.mount(controlsMount); - } - updateAnimationList() { - if (this.controlsApp?._instance?.exposed) { - if (this.animationClips.length > 0) { - this.controlsApp._instance.exposed.animations.value = this.animationClips.map((clip, index) => ({ - name: clip.name || `Animation ${index + 1}`, - index - })); - } else { - this.controlsApp._instance.exposed.animations.value = []; - } - } - } - async setupModel(model) { - await super.setupModel(model); - if (this.currentAnimation) { - this.currentAnimation.stopAllAction(); - this.animationActions = []; - } - let animations = []; - if (model.animations?.length > 0) { - animations = model.animations; - } else if (this.originalModel && "animations" in this.originalModel) { - animations = this.originalModel.animations; - } - if (animations.length > 0) { - this.animationClips = animations; - if (model.type === "Scene") { - this.currentAnimation = new AnimationMixer(model); - } else { - this.currentAnimation = new AnimationMixer(this.currentModel); - } - if (this.animationClips.length > 0) { - this.updateSelectedAnimation(0); - } - } - this.updateAnimationList(); - } - setAnimationSpeed(speed) { - this.animationSpeed = speed; - this.animationActions.forEach((action) => { - action.setEffectiveTimeScale(speed); - }); - } - updateSelectedAnimation(index) { - if (!this.currentAnimation || !this.animationClips || index >= this.animationClips.length) { - console.warn("Invalid animation update request"); - return; - } - this.animationActions.forEach((action2) => { - action2.stop(); - }); - this.currentAnimation.stopAllAction(); - this.animationActions = []; - this.selectedAnimationIndex = index; - const clip = this.animationClips[index]; - const action = this.currentAnimation.clipAction(clip); - action.setEffectiveTimeScale(this.animationSpeed); - action.reset(); - action.clampWhenFinished = false; - action.loop = LoopRepeat; - if (this.isAnimationPlaying) { - action.play(); - } else { - action.play(); - action.paused = true; - } - this.animationActions = [action]; - if (this.controlsApp?._instance?.exposed) { - this.controlsApp._instance.exposed.selectedAnimation.value = index; - } - } - clearModel() { - if (this.currentAnimation) { - this.animationActions.forEach((action) => { - action.stop(); - }); - this.currentAnimation = null; - } - this.animationActions = []; - this.animationClips = []; - this.selectedAnimationIndex = 0; - this.isAnimationPlaying = false; - this.animationSpeed = 1; - if (this.controlsApp?._instance?.exposed) { - this.controlsApp._instance.exposed.animations.value = []; - this.controlsApp._instance.exposed.selectedAnimation.value = 0; - } - super.clearModel(); - } - toggleAnimation(play) { - if (!this.currentAnimation || this.animationActions.length === 0) { - console.warn("No animation to toggle"); - return; - } - this.isAnimationPlaying = play ?? !this.isAnimationPlaying; - if (this.controlsApp?._instance?.exposed) { - this.controlsApp._instance.exposed.playing.value = this.isAnimationPlaying; - } - this.animationActions.forEach((action) => { - if (this.isAnimationPlaying) { - action.paused = false; - if (action.time === 0 || action.time === action.getClip().duration) { - action.reset(); - } - } else { - action.paused = true; - } - }); - } - startAnimation() { - const animate = /* @__PURE__ */ __name(() => { - this.animationFrameId = requestAnimationFrame(animate); - if (this.showPreview) { - this.updatePreviewRender(); - } - const delta = this.clock.getDelta(); - if (this.currentAnimation && this.isAnimationPlaying) { - this.currentAnimation.update(delta); - } - this.controls.update(); - this.renderer.clear(); - this.renderer.render(this.scene, this.activeCamera); - if (this.viewHelper.animating) { - this.viewHelper.update(delta); - if (!this.viewHelper.animating) { - this.storeNodeProperty("Camera Info", this.getCameraState()); - } - } - this.viewHelper.render(this.renderer); - }, "animate"); - animate(); - } -} -class Load3dService { - static { - __name(this, "Load3dService"); - } - static instance; - nodeToLoad3dMap = /* @__PURE__ */ new Map(); - constructor() { - } - static getInstance() { - if (!Load3dService.instance) { - Load3dService.instance = new Load3dService(); - } - return Load3dService.instance; - } - registerLoad3d(node, container, type) { - if (this.nodeToLoad3dMap.has(node)) { - this.removeLoad3d(node); - } - const isAnimation = type.includes("Animation"); - const Load3dClass = isAnimation ? Load3dAnimation : Load3d; - const isPreview = type.includes("Preview"); - const instance = new Load3dClass(container, { createPreview: !isPreview }); - instance.setNode(node); - this.nodeToLoad3dMap.set(node, instance); - return instance; - } - getLoad3d(node) { - return this.nodeToLoad3dMap.get(node) || null; - } - getNodeByLoad3d(load3d) { - for (const [node, instance] of this.nodeToLoad3dMap) { - if (instance === load3d) { - return node; - } - } - return null; - } - removeLoad3d(node) { - const instance = this.nodeToLoad3dMap.get(node); - if (instance) { - instance.remove(); - this.nodeToLoad3dMap.delete(node); - } - } - clear() { - for (const [node] of this.nodeToLoad3dMap) { - this.removeLoad3d(node); - } - } -} -const useLoad3dService = /* @__PURE__ */ __name(() => { - return Load3dService.getInstance(); -}, "useLoad3dService"); -app.registerExtension({ - name: "Comfy.Load3D", - getCustomWidgets(app2) { - return { - LOAD_3D(node, inputName) { - node.addProperty("Camera Info", ""); - const container = document.createElement("div"); - container.classList.add("comfy-load-3d"); - const load3d = useLoad3dService().registerLoad3d( - node, - container, - "Load3D" - ); - node.onMouseEnter = function() { - if (load3d) { - load3d.refreshViewport(); - } - }; - node.onResize = function() { - if (load3d) { - load3d.handleResize(); - } - }; - const origOnRemoved = node.onRemoved; - node.onRemoved = function() { - if (load3d) { - load3d.remove(); - } - useLoad3dService().removeLoad3d(node); - origOnRemoved?.apply(this, []); - }; - node.onDrawBackground = function() { - load3d.renderer.domElement.hidden = this.flags.collapsed ?? false; - }; - const fileInput = document.createElement("input"); - fileInput.type = "file"; - fileInput.accept = ".gltf,.glb,.obj,.mtl,.fbx,.stl"; - fileInput.style.display = "none"; - fileInput.onchange = async () => { - if (fileInput.files?.length) { - const modelWidget = node.widgets?.find( - (w) => w.name === "model_file" - ); - const uploadPath = await Load3dUtils.uploadFile( - load3d, - fileInput.files[0], - fileInput - ).catch((error) => { - console.error("File upload failed:", error); - useToastStore().addAlert("File upload failed"); - }); - if (uploadPath && modelWidget) { - if (!modelWidget.options?.values?.includes(uploadPath)) { - modelWidget.options?.values?.push(uploadPath); - } - modelWidget.value = uploadPath; - } - } - }; - node.addWidget("button", "upload 3d model", "upload3dmodel", () => { - fileInput.click(); - }); - node.addWidget("button", "clear", "clear", () => { - load3d.clearModel(); - const modelWidget = node.widgets?.find( - (w) => w.name === "model_file" - ); - if (modelWidget) { - modelWidget.value = ""; - } - }); - return { - widget: node.addDOMWidget(inputName, "LOAD_3D", container) - }; - } - }; - }, - async nodeCreated(node) { - if (node.constructor.comfyClass !== "Load3D") return; - const [oldWidth, oldHeight] = node.size; - node.setSize([Math.max(oldWidth, 300), Math.max(oldHeight, 600)]); - await nextTick(); - const sceneWidget = node.widgets.find((w) => w.name === "image"); - const load3d = useLoad3dService().getLoad3d(node); - const modelWidget = node.widgets.find( - (w) => w.name === "model_file" - ); - const material = node.widgets.find((w) => w.name === "material"); - const upDirection = node.widgets.find( - (w) => w.name === "up_direction" - ); - let cameraState = node.properties["Camera Info"]; - const config = new Load3DConfiguration(load3d); - const width = node.widgets.find((w) => w.name === "width"); - const height = node.widgets.find((w) => w.name === "height"); - config.configure( - "input", - modelWidget, - material, - upDirection, - cameraState, - width, - height - ); - sceneWidget.serializeValue = async () => { - node.properties["Camera Info"] = load3d.getCameraState(); - const { scene: imageData, mask: maskData } = await load3d.captureScene( - width.value, - height.value - ); - const [data, dataMask] = await Promise.all([ - Load3dUtils.uploadTempImage(imageData, "scene"), - Load3dUtils.uploadTempImage(maskData, "scene_mask") - ]); - return { - image: `threed/${data.name} [temp]`, - mask: `threed/${dataMask.name} [temp]` - }; - }; - } -}); -app.registerExtension({ - name: "Comfy.Load3DAnimation", - getCustomWidgets(app2) { - return { - LOAD_3D_ANIMATION(node, inputName) { - node.addProperty("Camera Info", ""); - const container = document.createElement("div"); - container.classList.add("comfy-load-3d-animation"); - const load3d = useLoad3dService().registerLoad3d( - node, - container, - "Load3DAnimation" - ); - node.onMouseEnter = function() { - if (load3d) { - load3d.refreshViewport(); - } - }; - node.onResize = function() { - if (load3d) { - load3d.handleResize(); - } - }; - const origOnRemoved = node.onRemoved; - node.onRemoved = function() { - if (load3d) { - load3d.remove(); - } - useLoad3dService().removeLoad3d(node); - origOnRemoved?.apply(this, []); - }; - node.onDrawBackground = function() { - load3d.renderer.domElement.hidden = this.flags.collapsed ?? false; - }; - const fileInput = document.createElement("input"); - fileInput.type = "file"; - fileInput.accept = ".fbx,glb,gltf"; - fileInput.style.display = "none"; - fileInput.onchange = async () => { - if (fileInput.files?.length) { - const modelWidget = node.widgets?.find( - (w) => w.name === "model_file" - ); - const uploadPath = await Load3dUtils.uploadFile( - load3d, - fileInput.files[0], - fileInput - ).catch((error) => { - console.error("File upload failed:", error); - useToastStore().addAlert("File upload failed"); - }); - if (uploadPath && modelWidget) { - if (!modelWidget.options?.values?.includes(uploadPath)) { - modelWidget.options?.values?.push(uploadPath); - } - modelWidget.value = uploadPath; - } - } - }; - node.addWidget("button", "upload 3d model", "upload3dmodel", () => { - fileInput.click(); - }); - node.addWidget("button", "clear", "clear", () => { - load3d.clearModel(); - const modelWidget = node.widgets?.find( - (w) => w.name === "model_file" - ); - if (modelWidget) { - modelWidget.value = ""; - } - }); - return { - widget: node.addDOMWidget(inputName, "LOAD_3D_ANIMATION", container) - }; - } - }; - }, - async nodeCreated(node) { - if (node.constructor.comfyClass !== "Load3DAnimation") return; - const [oldWidth, oldHeight] = node.size; - node.setSize([Math.max(oldWidth, 400), Math.max(oldHeight, 700)]); - await nextTick(); - const sceneWidget = node.widgets.find((w) => w.name === "image"); - const load3d = useLoad3dService().getLoad3d(node); - const modelWidget = node.widgets.find( - (w) => w.name === "model_file" - ); - const material = node.widgets.find((w) => w.name === "material"); - const upDirection = node.widgets.find( - (w) => w.name === "up_direction" - ); - let cameraState = node.properties["Camera Info"]; - const config = new Load3DConfiguration(load3d); - const width = node.widgets.find((w) => w.name === "width"); - const height = node.widgets.find((w) => w.name === "height"); - config.configure( - "input", - modelWidget, - material, - upDirection, - cameraState, - width, - height - ); - sceneWidget.serializeValue = async () => { - node.properties["Camera Info"] = load3d.getCameraState(); - load3d.toggleAnimation(false); - const { scene: imageData, mask: maskData } = await load3d.captureScene( - width.value, - height.value - ); - const [data, dataMask] = await Promise.all([ - Load3dUtils.uploadTempImage(imageData, "scene"), - Load3dUtils.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) { - const container = document.createElement("div"); - container.classList.add("comfy-preview-3d"); - const load3d = useLoad3dService().registerLoad3d( - node, - container, - "Preview3D" - ); - node.onMouseEnter = function() { - if (load3d) { - load3d.refreshViewport(); - } - }; - node.onResize = function() { - if (load3d) { - load3d.handleResize(); - } - }; - const origOnRemoved = node.onRemoved; - node.onRemoved = function() { - if (load3d) { - load3d.remove(); - } - useLoad3dService().removeLoad3d(node); - origOnRemoved?.apply(this, []); - }; - node.onDrawBackground = function() { - load3d.renderer.domElement.hidden = this.flags.collapsed ?? false; - }; - return { - widget: node.addDOMWidget(inputName, "PREVIEW_3D", container) - }; - } - }; - }, - async nodeCreated(node) { - if (node.constructor.comfyClass !== "Preview3D") return; - const [oldWidth, oldHeight] = node.size; - node.setSize([Math.max(oldWidth, 400), Math.max(oldHeight, 550)]); - await nextTick(); - const load3d = useLoad3dService().getLoad3d(node); - const modelWidget = node.widgets.find( - (w) => w.name === "model_file" - ); - const material = node.widgets.find((w) => w.name === "material"); - const upDirection = node.widgets.find( - (w) => w.name === "up_direction" - ); - 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("\\", "/"); - const config = new Load3DConfiguration(load3d); - config.configure("output", modelWidget, material, upDirection); - }; - } -}); -app.registerExtension({ - name: "Comfy.Preview3DAnimation", - async beforeRegisterNodeDef(nodeType, nodeData) { - if ( - // @ts-expect-error ComfyNode - ["Preview3DAnimation"].includes(nodeType.comfyClass) - ) { - nodeData.input.required.image = ["PREVIEW_3D_ANIMATION"]; - } - }, - getCustomWidgets(app2) { - return { - PREVIEW_3D_ANIMATION(node, inputName) { - const container = document.createElement("div"); - container.classList.add("comfy-preview-3d-animation"); - const load3d = useLoad3dService().registerLoad3d( - node, - container, - "Preview3DAnimation" - ); - node.onMouseEnter = function() { - if (load3d) { - load3d.refreshViewport(); - } - }; - node.onResize = function() { - if (load3d) { - load3d.handleResize(); - } - }; - const origOnRemoved = node.onRemoved; - node.onRemoved = function() { - if (load3d) { - load3d.remove(); - } - useLoad3dService().removeLoad3d(node); - origOnRemoved?.apply(this, []); - }; - node.onDrawBackground = function() { - load3d.renderer.domElement.hidden = this.flags.collapsed ?? false; - }; - return { - widget: node.addDOMWidget( - inputName, - "PREVIEW_3D_ANIMATION", - container - ) - }; - } - }; - }, - async nodeCreated(node) { - if (node.constructor.comfyClass !== "Preview3DAnimation") return; - const [oldWidth, oldHeight] = node.size; - node.setSize([Math.max(oldWidth, 300), Math.max(oldHeight, 550)]); - await nextTick(); - const load3d = useLoad3dService().getLoad3d(node); - const modelWidget = node.widgets.find( - (w) => w.name === "model_file" - ); - const material = node.widgets.find((w) => w.name === "material"); - const upDirection = node.widgets.find( - (w) => w.name === "up_direction" - ); - 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("\\", "/"); - const config = new Load3DConfiguration(load3d); - config.configure("output", modelWidget, material, upDirection); - }; - } -}); -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: 4rem; - z-index: 8888; - background: var(--comfy-menu-bg); - display: flex; - flex-direction: column; - } - .maskEditor_toolPanelContainer { - width: 4rem; - height: 4rem; - 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% - 4rem - 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: 4rem; - height: 4rem; - 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 || {}); -const saveBrushToCache = lodashExports.debounce(function(key, brush) { - try { - const brushString = JSON.stringify(brush); - setStorageValue(key, brushString); - } catch (error) { - console.error("Failed to save brush to cache:", error); - } -}, 300); -function loadBrushFromCache(key) { - try { - const brushString = getStorageValue(key); - if (brushString) { - const brush = JSON.parse(brushString); - console.log("Loaded brush from cache:", brush); - return brush; - } else { - console.log("No brush found in cache."); - return null; - } - } catch (error) { - console.error("Failed to load brush from cache:", error); - return null; - } -} -__name(loadBrushFromCache, "loadBrushFromCache"); -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, retries - 1); - } - }).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" - ); - const cachedBrushSettings = loadBrushFromCache("maskeditor_brush_settings"); - if (cachedBrushSettings) { - this.brushSettings = cachedBrushSettings; - } else { - this.brushSettings = { - type: "arc", - size: 10, - opacity: 0.7, - hardness: 1, - smoothingPrecision: 10 - }; - } - 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( - "brushSmoothingPrecision", - async () => this.brushSettings.smoothingPrecision - ); - 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.brushSettings.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.brushSettings.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; - saveBrushToCache("maskeditor_brush_settings", this.brushSettings); - } - setBrushOpacity(opacity) { - this.brushSettings.opacity = opacity; - saveBrushToCache("maskeditor_brush_settings", this.brushSettings); - } - setBrushHardness(hardness) { - this.brushSettings.hardness = hardness; - saveBrushToCache("maskeditor_brush_settings", this.brushSettings); - } - setBrushType(type) { - this.brushSettings.type = type; - saveBrushToCache("maskeditor_brush_settings", this.brushSettings); - } - setBrushSmoothingPrecision(precision) { - this.brushSettings.smoothingPrecision = precision; - saveBrushToCache("maskeditor_brush_settings", this.brushSettings); - } -} -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.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.addEventListener("click", () => { - this.messageBroker.publish( - "setBrushShape", - "rect" - /* Rect */ - ); - this.setBrushBorderRadius(); - square_shape.style.background = "var(--p-button-text-primary-color)"; - circle_shape.style.background = ""; - }); - if ((await this.messageBroker.pull("brushSettings")).type === "arc") { - circle_shape.style.background = "var(--p-button-text-primary-color)"; - square_shape.style.background = ""; - } else { - circle_shape.style.background = ""; - square_shape.style.background = "var(--p-button-text-primary-color)"; - } - 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, - (await this.messageBroker.pull("brushSettings")).size, - (event, value) => { - this.messageBroker.publish("setBrushSize", parseInt(value)); - this.updateBrushPreview(); - } - ); - this.brushSizeSlider = thicknesSliderObj.slider; - const opacitySliderObj = this.createSlider( - "Opacity", - 0, - 1, - 0.01, - (await this.messageBroker.pull("brushSettings")).opacity, - (event, value) => { - this.messageBroker.publish("setBrushOpacity", parseFloat(value)); - this.updateBrushPreview(); - } - ); - this.brushOpacitySlider = opacitySliderObj.slider; - const hardnessSliderObj = this.createSlider( - "Hardness", - 0, - 1, - 0.01, - (await this.messageBroker.pull("brushSettings")).hardness, - (event, value) => { - this.messageBroker.publish("setBrushHardness", parseFloat(value)); - this.updateBrushPreview(); - } - ); - this.brushHardnessSlider = hardnessSliderObj.slider; - const brushSmoothingPrecisionSliderObj = this.createSlider( - "Smoothing Precision", - 1, - 100, - 1, - (await this.messageBroker.pull("brushSettings")).smoothingPrecision, - (event, value) => { - this.messageBroker.publish( - "setBrushSmoothingPrecision", - parseInt(value) - ); - } - ); - const resetBrushSettingsButton = document.createElement("button"); - resetBrushSettingsButton.id = "resetBrushSettingsButton"; - resetBrushSettingsButton.innerText = "Reset to Default"; - resetBrushSettingsButton.addEventListener("click", () => { - this.messageBroker.publish( - "setBrushShape", - "arc" - /* Arc */ - ); - this.messageBroker.publish("setBrushSize", 10); - this.messageBroker.publish("setBrushOpacity", 0.7); - this.messageBroker.publish("setBrushHardness", 1); - this.messageBroker.publish("setBrushSmoothingPrecision", 10); - circle_shape.style.background = "var(--p-button-text-primary-color)"; - square_shape.style.background = ""; - thicknesSliderObj.slider.value = "10"; - opacitySliderObj.slider.value = "0.7"; - hardnessSliderObj.slider.value = "1"; - brushSmoothingPrecisionSliderObj.slider.value = "10"; - this.setBrushBorderRadius(); - this.updateBrushPreview(); - }); - brush_settings_container.appendChild(brush_settings_title); - brush_settings_container.appendChild(resetBrushSettingsButton); - 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 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; - static collapsable; - static title_mode; - color = LGraphCanvas.node_colors.yellow.color; - bgcolor = LGraphCanvas.node_colors.yellow.bgcolor; - groupcolor = LGraphCanvas.node_colors.yellow.groupcolor; - isVirtualNode; - 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; - 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(); - 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(); - app2.graph.setDirtyCanvas(true, true); - }, "callback") - }, - { - content: (RerouteNode.defaultVisibility ? "Hide" : "Show") + " Type By Default", - callback: /* @__PURE__ */ __name(() => { - RerouteNode.setDefaultTextVisibility( - !RerouteNode.defaultVisibility - ); - }, "callback") - } - ); - return []; - } - 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) { - const imageInputSpec = nodeData?.input?.required?.image; - const config = imageInputSpec?.[1] ?? {}; - const { image_upload = false, image_folder = "input" } = config; - if (image_upload && nodeData?.input?.required) { - nodeData.input.required.upload = ["IMAGEUPLOAD", { image_folder }]; - } - } -}); -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-B36GcHVN.js.map diff --git a/web/assets/index-BRhY6FpL.css b/web/assets/index-BRhY6FpL.css deleted file mode 100644 index 5470ecb5e..000000000 --- a/web/assets/index-BRhY6FpL.css +++ /dev/null @@ -1,149 +0,0 @@ -.comfy-group-manage { - background: var(--bg-color); - color: var(--fg-color); - padding: 0; - font-family: Arial, Helvetica, sans-serif; - border-color: black; - margin: 20vh auto; - max-height: 60vh; -} -.comfy-group-manage-outer { - max-height: 60vh; - min-width: 500px; - display: flex; - flex-direction: column; -} -.comfy-group-manage-outer > header { - display: flex; - align-items: center; - gap: 10px; - justify-content: space-between; - background: var(--comfy-menu-bg); - padding: 15px 20px; -} -.comfy-group-manage-outer > header select { - background: var(--comfy-input-bg); - border: 1px solid var(--border-color); - color: var(--input-text); - padding: 5px 10px; - border-radius: 5px; -} -.comfy-group-manage h2 { - margin: 0; - font-weight: normal; -} -.comfy-group-manage main { - display: flex; - overflow: hidden; -} -.comfy-group-manage .drag-handle { - font-weight: bold; -} -.comfy-group-manage-list { - border-right: 1px solid var(--comfy-menu-bg); -} -.comfy-group-manage-list ul { - margin: 40px 0 0; - padding: 0; - list-style: none; -} -.comfy-group-manage-list-items { - max-height: calc(100% - 40px); - overflow-y: scroll; - overflow-x: hidden; -} -.comfy-group-manage-list li { - display: flex; - padding: 10px 20px 10px 10px; - cursor: pointer; - align-items: center; - gap: 5px; -} -.comfy-group-manage-list div { - display: flex; - flex-direction: column; -} -.comfy-group-manage-list li:not(.selected):hover div { - text-decoration: underline; -} -.comfy-group-manage-list li.selected { - background: var(--border-color); -} -.comfy-group-manage-list li span { - opacity: 0.7; - font-size: smaller; -} -.comfy-group-manage-node { - flex: auto; - background: var(--border-color); - display: flex; - flex-direction: column; -} -.comfy-group-manage-node > div { - overflow: auto; -} -.comfy-group-manage-node header { - display: flex; - background: var(--bg-color); - height: 40px; -} -.comfy-group-manage-node header a { - text-align: center; - flex: auto; - border-right: 1px solid var(--comfy-menu-bg); - border-bottom: 1px solid var(--comfy-menu-bg); - padding: 10px; - cursor: pointer; - font-size: 15px; -} -.comfy-group-manage-node header a:last-child { - border-right: none; -} -.comfy-group-manage-node header a:not(.active):hover { - text-decoration: underline; -} -.comfy-group-manage-node header a.active { - background: var(--border-color); - border-bottom: none; -} -.comfy-group-manage-node-page { - display: none; - overflow: auto; -} -.comfy-group-manage-node-page.active { - display: block; -} -.comfy-group-manage-node-page div { - padding: 10px; - display: flex; - align-items: center; - gap: 10px; -} -.comfy-group-manage-node-page input { - border: none; - color: var(--input-text); - background: var(--comfy-input-bg); - padding: 5px 10px; -} -.comfy-group-manage-node-page input[type="text"] { - flex: auto; -} -.comfy-group-manage-node-page label { - display: flex; - gap: 5px; - align-items: center; -} -.comfy-group-manage footer { - border-top: 1px solid var(--comfy-menu-bg); - padding: 10px; - display: flex; - gap: 10px; -} -.comfy-group-manage footer button { - font-size: 14px; - padding: 5px 10px; - border-radius: 0; -} -.comfy-group-manage footer button:first-child { - margin-right: auto; -} diff --git a/web/assets/index-Bv0b06LE.js b/web/assets/index-Bv0b06LE.js deleted file mode 100644 index b91de40d7..000000000 --- a/web/assets/index-Bv0b06LE.js +++ /dev/null @@ -1,221040 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GraphView-B_UDZi95.js","./index-C068lYT4.js","./index-Dzu9WL4p.js","./index-A_bXPJCN.js","./keybindingService-DyjX-nxF.js","./serverConfigStore-D2Vr0L0h.js","./GraphView-Bo28XDd0.css","./UserSelectView-C703HOyO.js","./BaseViewTemplate-BTbuZf5t.js","./ServerStartView-B7TlHxYo.js","./ServerStartView-BZ7uhZHv.css","./InstallView-DW9xwU_F.js","./index-SeIZOWJp.js","./uvMirrors-B-HKMf6X.js","./InstallView-DbJ2cGfL.css","./WelcomeView-DIFvbWc2.js","./WelcomeView-Brz3-luE.css","./NotSupportedView-B78ZVR9Z.js","./NotSupportedView-RFx6eCkN.css","./DownloadGitView-PWqK5ke4.js","./ManualConfigurationView-DTLyJ3VG.js","./ManualConfigurationView-CsirlNfV.css","./MetricsConsentView-C80fk2cl.js","./DesktopStartView-D9r53Bue.js","./MaintenanceView-Bh8OZpgl.js","./index-CgMyWf7n.js","./TerminalOutputDrawer-CKr7Br7O.js","./MaintenanceView-DEJCj8SR.css","./DesktopUpdateView-C-R0415K.js","./DesktopUpdateView-CxchaIvw.css","./KeybindingPanel-oavhFdkz.js","./KeybindingPanel-CDYVPYDp.css","./ExtensionPanel-Ba57xrmg.js","./ServerConfigPanel-BYrt6wyr.js","./index-B36GcHVN.js","./index-BRhY6FpL.css"])))=>i.map(i=>d[i]); -var __defProp2 = Object.defineProperty; -var __name = (target2, value4) => __defProp2(target2, "name", { value: value4, configurable: true }); -(/* @__PURE__ */ __name(function polyfill2() { - const relList = document.createElement("link").relList; - if (relList && relList.supports && relList.supports("modulepreload")) { - return; - } - for (const link2 of document.querySelectorAll('link[rel="modulepreload"]')) { - processPreload(link2); - } - new MutationObserver((mutations) => { - for (const mutation of mutations) { - if (mutation.type !== "childList") { - continue; - } - for (const node3 of mutation.addedNodes) { - if (node3.tagName === "LINK" && node3.rel === "modulepreload") - processPreload(node3); - } - } - }).observe(document, { childList: true, subtree: true }); - function getFetchOpts(link2) { - const fetchOpts = {}; - if (link2.integrity) fetchOpts.integrity = link2.integrity; - if (link2.referrerPolicy) fetchOpts.referrerPolicy = link2.referrerPolicy; - if (link2.crossOrigin === "use-credentials") - fetchOpts.credentials = "include"; - else if (link2.crossOrigin === "anonymous") fetchOpts.credentials = "omit"; - else fetchOpts.credentials = "same-origin"; - return fetchOpts; - } - __name(getFetchOpts, "getFetchOpts"); - function processPreload(link2) { - if (link2.ep) - return; - link2.ep = true; - const fetchOpts = getFetchOpts(link2); - fetch(link2.href, fetchOpts); - } - __name(processPreload, "processPreload"); -}, "polyfill"))(); -var __defProp$7 = Object.defineProperty; -var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols; -var __hasOwnProp$6 = Object.prototype.hasOwnProperty; -var __propIsEnum$6 = Object.prototype.propertyIsEnumerable; -var __defNormalProp$7 = /* @__PURE__ */ __name((obj, key, value4) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value: value4 }) : obj[key] = value4, "__defNormalProp$7"); -var __spreadValues$6 = /* @__PURE__ */ __name((a2, b2) => { - for (var prop2 in b2 || (b2 = {})) - if (__hasOwnProp$6.call(b2, prop2)) - __defNormalProp$7(a2, prop2, b2[prop2]); - if (__getOwnPropSymbols$6) - for (var prop2 of __getOwnPropSymbols$6(b2)) { - if (__propIsEnum$6.call(b2, prop2)) - __defNormalProp$7(a2, prop2, b2[prop2]); - } - return a2; -}, "__spreadValues$6"); -function isEmpty$3(value4) { - return value4 === null || value4 === void 0 || value4 === "" || Array.isArray(value4) && value4.length === 0 || !(value4 instanceof Date) && typeof value4 === "object" && Object.keys(value4).length === 0; -} -__name(isEmpty$3, "isEmpty$3"); -function compare$3(value1, value22, comparator, order = 1) { - let result = -1; - const emptyValue1 = isEmpty$3(value1); - const emptyValue2 = isEmpty$3(value22); - if (emptyValue1 && emptyValue2) result = 0; - else if (emptyValue1) result = order; - else if (emptyValue2) result = -order; - else if (typeof value1 === "string" && typeof value22 === "string") result = comparator(value1, value22); - else result = value1 < value22 ? -1 : value1 > value22 ? 1 : 0; - return result; -} -__name(compare$3, "compare$3"); -function _deepEquals$2(obj1, obj2, visited = /* @__PURE__ */ new WeakSet()) { - if (obj1 === obj2) return true; - if (!obj1 || !obj2 || typeof obj1 !== "object" || typeof obj2 !== "object") return false; - if (visited.has(obj1) || visited.has(obj2)) return false; - visited.add(obj1).add(obj2); - let arrObj1 = Array.isArray(obj1), arrObj2 = Array.isArray(obj2), i2, length, key; - if (arrObj1 && arrObj2) { - length = obj1.length; - if (length != obj2.length) return false; - for (i2 = length; i2-- !== 0; ) if (!_deepEquals$2(obj1[i2], obj2[i2], visited)) return false; - return true; - } - if (arrObj1 != arrObj2) return false; - let dateObj1 = obj1 instanceof Date, dateObj2 = obj2 instanceof Date; - if (dateObj1 != dateObj2) return false; - if (dateObj1 && dateObj2) return obj1.getTime() == obj2.getTime(); - let regexpObj1 = obj1 instanceof RegExp, regexpObj2 = obj2 instanceof RegExp; - if (regexpObj1 != regexpObj2) return false; - if (regexpObj1 && regexpObj2) return obj1.toString() == obj2.toString(); - let keys2 = Object.keys(obj1); - length = keys2.length; - if (length !== Object.keys(obj2).length) return false; - for (i2 = length; i2-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(obj2, keys2[i2])) return false; - for (i2 = length; i2-- !== 0; ) { - key = keys2[i2]; - if (!_deepEquals$2(obj1[key], obj2[key], visited)) return false; - } - return true; -} -__name(_deepEquals$2, "_deepEquals$2"); -function deepEquals$2(obj1, obj2) { - return _deepEquals$2(obj1, obj2); -} -__name(deepEquals$2, "deepEquals$2"); -function isFunction$d(value4) { - return !!(value4 && value4.constructor && value4.call && value4.apply); -} -__name(isFunction$d, "isFunction$d"); -function isNotEmpty$2(value4) { - return !isEmpty$3(value4); -} -__name(isNotEmpty$2, "isNotEmpty$2"); -function resolveFieldData$2(data26, field2) { - if (!data26 || !field2) { - return null; - } - try { - const value4 = data26[field2]; - if (isNotEmpty$2(value4)) return value4; - } catch (e2) { - } - if (Object.keys(data26).length) { - if (isFunction$d(field2)) { - return field2(data26); - } else if (field2.indexOf(".") === -1) { - return data26[field2]; - } else { - let fields = field2.split("."); - let value4 = data26; - for (let i2 = 0, len = fields.length; i2 < len; ++i2) { - if (value4 == null) { - return null; - } - value4 = value4[fields[i2]]; - } - return value4; - } - } - return null; -} -__name(resolveFieldData$2, "resolveFieldData$2"); -function equals$2(obj1, obj2, field2) { - if (field2) return resolveFieldData$2(obj1, field2) === resolveFieldData$2(obj2, field2); - else return deepEquals$2(obj1, obj2); -} -__name(equals$2, "equals$2"); -function contains$2(value4, list2) { - if (value4 != null && list2 && list2.length) { - for (let val of list2) { - if (equals$2(value4, val)) return true; - } - } - return false; -} -__name(contains$2, "contains$2"); -function filter$2(value4, fields, filterValue) { - let filteredItems = []; - if (value4) { - for (let item3 of value4) { - for (let field2 of fields) { - if (String(resolveFieldData$2(item3, field2)).toLowerCase().indexOf(filterValue.toLowerCase()) > -1) { - filteredItems.push(item3); - break; - } - } - } - } - return filteredItems; -} -__name(filter$2, "filter$2"); -function findIndexInList$2(value4, list2) { - let index2 = -1; - if (list2) { - for (let i2 = 0; i2 < list2.length; i2++) { - if (list2[i2] === value4) { - index2 = i2; - break; - } - } - } - return index2; -} -__name(findIndexInList$2, "findIndexInList$2"); -function findLast$3(arr, callback) { - let item3; - if (isNotEmpty$2(arr)) { - try { - item3 = arr.findLast(callback); - } catch (e2) { - item3 = [...arr].reverse().find(callback); - } - } - return item3; -} -__name(findLast$3, "findLast$3"); -function findLastIndex$2(arr, callback) { - let index2 = -1; - if (isNotEmpty$2(arr)) { - try { - index2 = arr.findLastIndex(callback); - } catch (e2) { - index2 = arr.lastIndexOf([...arr].reverse().find(callback)); - } - } - return index2; -} -__name(findLastIndex$2, "findLastIndex$2"); -function isObject$g(value4, empty3 = true) { - return value4 instanceof Object && value4.constructor === Object && (empty3 || Object.keys(value4).length !== 0); -} -__name(isObject$g, "isObject$g"); -function resolve$4(obj, ...params) { - return isFunction$d(obj) ? obj(...params) : obj; -} -__name(resolve$4, "resolve$4"); -function isString$b(value4, empty3 = true) { - return typeof value4 === "string" && (empty3 || value4 !== ""); -} -__name(isString$b, "isString$b"); -function toFlatCase$2(str) { - return isString$b(str) ? str.replace(/(-|_)/g, "").toLowerCase() : str; -} -__name(toFlatCase$2, "toFlatCase$2"); -function getKeyValue$2(obj, key = "", params = {}) { - const fKeys = toFlatCase$2(key).split("."); - const fKey = fKeys.shift(); - return fKey ? isObject$g(obj) ? getKeyValue$2(resolve$4(obj[Object.keys(obj).find((k2) => toFlatCase$2(k2) === fKey) || ""], params), fKeys.join("."), params) : void 0 : resolve$4(obj, params); -} -__name(getKeyValue$2, "getKeyValue$2"); -function insertIntoOrderedArray$2(item3, index2, arr, sourceArr) { - if (arr.length > 0) { - let injected = false; - for (let i2 = 0; i2 < arr.length; i2++) { - let currentItemIndex = findIndexInList$2(arr[i2], sourceArr); - if (currentItemIndex > index2) { - arr.splice(i2, 0, item3); - injected = true; - break; - } - } - if (!injected) { - arr.push(item3); - } - } else { - arr.push(item3); - } -} -__name(insertIntoOrderedArray$2, "insertIntoOrderedArray$2"); -function isArray$c(value4, empty3 = true) { - return Array.isArray(value4) && (empty3 || value4.length !== 0); -} -__name(isArray$c, "isArray$c"); -function isDate$5(value4) { - return value4 instanceof Date && value4.constructor === Date; -} -__name(isDate$5, "isDate$5"); -function isLetter$3(char) { - return /^[a-zA-Z\u00C0-\u017F]$/.test(char); -} -__name(isLetter$3, "isLetter$3"); -function isNumber$7(value4) { - return isNotEmpty$2(value4) && !isNaN(value4); -} -__name(isNumber$7, "isNumber$7"); -function isPrintableCharacter$2(char = "") { - return isNotEmpty$2(char) && char.length === 1 && !!char.match(/\S| /); -} -__name(isPrintableCharacter$2, "isPrintableCharacter$2"); -function isScalar$2(value4) { - return value4 != null && (typeof value4 === "string" || typeof value4 === "number" || typeof value4 === "bigint" || typeof value4 === "boolean"); -} -__name(isScalar$2, "isScalar$2"); -function localeComparator$2() { - return new Intl.Collator(void 0, { numeric: true }).compare; -} -__name(localeComparator$2, "localeComparator$2"); -function matchRegex$2(str, regex2) { - if (regex2) { - const match2 = regex2.test(str); - regex2.lastIndex = 0; - return match2; - } - return false; -} -__name(matchRegex$2, "matchRegex$2"); -function mergeKeys$2(...args) { - const _mergeKeys = /* @__PURE__ */ __name((target2 = {}, source = {}) => { - const mergedObj = __spreadValues$6({}, target2); - Object.keys(source).forEach((key) => { - if (isObject$g(source[key]) && key in target2 && isObject$g(target2[key])) { - mergedObj[key] = _mergeKeys(target2[key], source[key]); - } else { - mergedObj[key] = source[key]; - } - }); - return mergedObj; - }, "_mergeKeys"); - return args.reduce((acc, obj, i2) => i2 === 0 ? obj : _mergeKeys(acc, obj), {}); -} -__name(mergeKeys$2, "mergeKeys$2"); -function minifyCSS$2(css4) { - return css4 ? css4.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, "").replace(/ {2,}/g, " ").replace(/ ([{:}]) /g, "$1").replace(/([;,]) /g, "$1").replace(/ !/g, "!").replace(/: /g, ":") : css4; -} -__name(minifyCSS$2, "minifyCSS$2"); -function nestedKeys$2(obj = {}, parentKey = "") { - return Object.entries(obj).reduce((o2, [key, value4]) => { - const currentKey = parentKey ? `${parentKey}.${key}` : key; - isObject$g(value4) ? o2 = o2.concat(nestedKeys$2(value4, currentKey)) : o2.push(currentKey); - return o2; - }, []); -} -__name(nestedKeys$2, "nestedKeys$2"); -function omit$3(obj, ...keys2) { - if (!isObject$g(obj)) return obj; - const copy2 = __spreadValues$6({}, obj); - keys2 == null ? void 0 : keys2.flat().forEach((key) => delete copy2[key]); - return copy2; -} -__name(omit$3, "omit$3"); -function removeAccents$2(str) { - const accentCheckRegex = /[\xC0-\xFF\u0100-\u017E]/; - if (str && accentCheckRegex.test(str)) { - const accentsMap = { - A: /[\xC0-\xC5\u0100\u0102\u0104]/g, - AE: /[\xC6]/g, - C: /[\xC7\u0106\u0108\u010A\u010C]/g, - D: /[\xD0\u010E\u0110]/g, - E: /[\xC8-\xCB\u0112\u0114\u0116\u0118\u011A]/g, - G: /[\u011C\u011E\u0120\u0122]/g, - H: /[\u0124\u0126]/g, - I: /[\xCC-\xCF\u0128\u012A\u012C\u012E\u0130]/g, - IJ: /[\u0132]/g, - J: /[\u0134]/g, - K: /[\u0136]/g, - L: /[\u0139\u013B\u013D\u013F\u0141]/g, - N: /[\xD1\u0143\u0145\u0147\u014A]/g, - O: /[\xD2-\xD6\xD8\u014C\u014E\u0150]/g, - OE: /[\u0152]/g, - R: /[\u0154\u0156\u0158]/g, - S: /[\u015A\u015C\u015E\u0160]/g, - T: /[\u0162\u0164\u0166]/g, - U: /[\xD9-\xDC\u0168\u016A\u016C\u016E\u0170\u0172]/g, - W: /[\u0174]/g, - Y: /[\xDD\u0176\u0178]/g, - Z: /[\u0179\u017B\u017D]/g, - a: /[\xE0-\xE5\u0101\u0103\u0105]/g, - ae: /[\xE6]/g, - c: /[\xE7\u0107\u0109\u010B\u010D]/g, - d: /[\u010F\u0111]/g, - e: /[\xE8-\xEB\u0113\u0115\u0117\u0119\u011B]/g, - g: /[\u011D\u011F\u0121\u0123]/g, - i: /[\xEC-\xEF\u0129\u012B\u012D\u012F\u0131]/g, - ij: /[\u0133]/g, - j: /[\u0135]/g, - k: /[\u0137,\u0138]/g, - l: /[\u013A\u013C\u013E\u0140\u0142]/g, - n: /[\xF1\u0144\u0146\u0148\u014B]/g, - p: /[\xFE]/g, - o: /[\xF2-\xF6\xF8\u014D\u014F\u0151]/g, - oe: /[\u0153]/g, - r: /[\u0155\u0157\u0159]/g, - s: /[\u015B\u015D\u015F\u0161]/g, - t: /[\u0163\u0165\u0167]/g, - u: /[\xF9-\xFC\u0169\u016B\u016D\u016F\u0171\u0173]/g, - w: /[\u0175]/g, - y: /[\xFD\xFF\u0177]/g, - z: /[\u017A\u017C\u017E]/g - }; - for (let key in accentsMap) { - str = str.replace(accentsMap[key], key); - } - } - return str; -} -__name(removeAccents$2, "removeAccents$2"); -function reorderArray$2(value4, from2, to) { - if (value4 && from2 !== to) { - if (to >= value4.length) { - to %= value4.length; - from2 %= value4.length; - } - value4.splice(to, 0, value4.splice(from2, 1)[0]); - } -} -__name(reorderArray$2, "reorderArray$2"); -function sort$2(value1, value22, order = 1, comparator, nullSortOrder = 1) { - const result = compare$3(value1, value22, comparator, order); - let finalSortOrder = order; - if (isEmpty$3(value1) || isEmpty$3(value22)) { - finalSortOrder = nullSortOrder === 1 ? order : nullSortOrder; - } - return finalSortOrder * result; -} -__name(sort$2, "sort$2"); -function stringify$2(value4, indent = 2, currentIndent = 0) { - const currentIndentStr = " ".repeat(currentIndent); - const nextIndentStr = " ".repeat(currentIndent + indent); - if (isArray$c(value4)) { - return "[" + value4.map((v2) => stringify$2(v2, indent, currentIndent + indent)).join(", ") + "]"; - } else if (isDate$5(value4)) { - return value4.toISOString(); - } else if (isFunction$d(value4)) { - return value4.toString(); - } else if (isObject$g(value4)) { - return "{\n" + Object.entries(value4).map(([k2, v2]) => `${nextIndentStr}${k2}: ${stringify$2(v2, indent, currentIndent + indent)}`).join(",\n") + ` -${currentIndentStr}}`; - } else { - return JSON.stringify(value4); - } -} -__name(stringify$2, "stringify$2"); -function toCapitalCase$2(str) { - return isString$b(str, false) ? str[0].toUpperCase() + str.slice(1) : str; -} -__name(toCapitalCase$2, "toCapitalCase$2"); -function toKebabCase$2(str) { - return isString$b(str) ? str.replace(/(_)/g, "-").replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "-" + c2.toLowerCase()).toLowerCase() : str; -} -__name(toKebabCase$2, "toKebabCase$2"); -function toTokenKey$4(str) { - return isString$b(str) ? str.replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "." + c2.toLowerCase()).toLowerCase() : str; -} -__name(toTokenKey$4, "toTokenKey$4"); -function toValue$6(value4) { - if (value4 && typeof value4 === "object") { - if (value4.hasOwnProperty("current")) { - return value4.current; - } else if (value4.hasOwnProperty("value")) { - return value4.value; - } - } - return resolve$4(value4); -} -__name(toValue$6, "toValue$6"); -function EventBus$1() { - const allHandlers = /* @__PURE__ */ new Map(); - return { - on(type, handler12) { - let handlers2 = allHandlers.get(type); - if (!handlers2) handlers2 = [handler12]; - else handlers2.push(handler12); - allHandlers.set(type, handlers2); - return this; - }, - off(type, handler12) { - let handlers2 = allHandlers.get(type); - if (handlers2) { - handlers2.splice(handlers2.indexOf(handler12) >>> 0, 1); - } - return this; - }, - emit(type, evt) { - let handlers2 = allHandlers.get(type); - if (handlers2) { - handlers2.slice().map((handler12) => { - handler12(evt); - }); - } - }, - clear() { - allHandlers.clear(); - } - }; -} -__name(EventBus$1, "EventBus$1"); -var __defProp$6 = Object.defineProperty; -var __defProps$1 = Object.defineProperties; -var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols; -var __hasOwnProp$5 = Object.prototype.hasOwnProperty; -var __propIsEnum$5 = Object.prototype.propertyIsEnumerable; -var __defNormalProp$6 = /* @__PURE__ */ __name((obj, key, value4) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value: value4 }) : obj[key] = value4, "__defNormalProp$6"); -var __spreadValues$5 = /* @__PURE__ */ __name((a2, b2) => { - for (var prop2 in b2 || (b2 = {})) - if (__hasOwnProp$5.call(b2, prop2)) - __defNormalProp$6(a2, prop2, b2[prop2]); - if (__getOwnPropSymbols$5) - for (var prop2 of __getOwnPropSymbols$5(b2)) { - if (__propIsEnum$5.call(b2, prop2)) - __defNormalProp$6(a2, prop2, b2[prop2]); - } - return a2; -}, "__spreadValues$5"); -var __spreadProps$1 = /* @__PURE__ */ __name((a2, b2) => __defProps$1(a2, __getOwnPropDescs$1(b2)), "__spreadProps$1"); -var __objRest$1 = /* @__PURE__ */ __name((source, exclude) => { - var target2 = {}; - for (var prop2 in source) - if (__hasOwnProp$5.call(source, prop2) && exclude.indexOf(prop2) < 0) - target2[prop2] = source[prop2]; - if (source != null && __getOwnPropSymbols$5) - for (var prop2 of __getOwnPropSymbols$5(source)) { - if (exclude.indexOf(prop2) < 0 && __propIsEnum$5.call(source, prop2)) - target2[prop2] = source[prop2]; - } - return target2; -}, "__objRest$1"); -function definePreset$1(...presets) { - return mergeKeys$2(...presets); -} -__name(definePreset$1, "definePreset$1"); -var ThemeService$1 = EventBus$1(); -var service_default$1 = ThemeService$1; -function toTokenKey$3(str) { - return isString$b(str) ? str.replace(/[A-Z]/g, (c2, i2) => i2 === 0 ? c2 : "." + c2.toLowerCase()).toLowerCase() : str; -} -__name(toTokenKey$3, "toTokenKey$3"); -function merge$3(value1, value22) { - if (isArray$c(value1)) { - value1.push(...value22 || []); - } else if (isObject$g(value1)) { - Object.assign(value1, value22); - } -} -__name(merge$3, "merge$3"); -function toValue$5(value4) { - return isObject$g(value4) && value4.hasOwnProperty("value") && value4.hasOwnProperty("type") ? value4.value : value4; -} -__name(toValue$5, "toValue$5"); -function toUnit$1(value4, variable = "") { - const excludedProperties = ["opacity", "z-index", "line-height", "font-weight", "flex", "flex-grow", "flex-shrink", "order"]; - if (!excludedProperties.some((property) => variable.endsWith(property))) { - const val = `${value4}`.trim(); - const valArr = val.split(" "); - return valArr.map((v2) => isNumber$7(v2) ? `${v2}px` : v2).join(" "); - } - return value4; -} -__name(toUnit$1, "toUnit$1"); -function toNormalizePrefix$1(prefix2) { - return prefix2.replaceAll(/ /g, "").replace(/[^\w]/g, "-"); -} -__name(toNormalizePrefix$1, "toNormalizePrefix$1"); -function toNormalizeVariable$1(prefix2 = "", variable = "") { - return toNormalizePrefix$1(`${isString$b(prefix2, false) && isString$b(variable, false) ? `${prefix2}-` : prefix2}${variable}`); -} -__name(toNormalizeVariable$1, "toNormalizeVariable$1"); -function getVariableName$1(prefix2 = "", variable = "") { - return `--${toNormalizeVariable$1(prefix2, variable)}`; -} -__name(getVariableName$1, "getVariableName$1"); -function hasOddBraces$1(str = "") { - const openBraces = (str.match(/{/g) || []).length; - const closeBraces = (str.match(/}/g) || []).length; - return (openBraces + closeBraces) % 2 !== 0; -} -__name(hasOddBraces$1, "hasOddBraces$1"); -function getVariableValue$1(value4, variable = "", prefix2 = "", excludedKeyRegexes = [], fallback) { - if (isString$b(value4)) { - const regex2 = /{([^}]*)}/g; - const val = value4.trim(); - if (hasOddBraces$1(val)) { - return void 0; - } else if (matchRegex$2(val, regex2)) { - const _val = val.replaceAll(regex2, (v2) => { - const path = v2.replace(/{|}/g, ""); - const keys2 = path.split(".").filter((_v) => !excludedKeyRegexes.some((_r) => matchRegex$2(_v, _r))); - return `var(${getVariableName$1(prefix2, toKebabCase$2(keys2.join("-")))}${isNotEmpty$2(fallback) ? `, ${fallback}` : ""})`; - }); - const calculationRegex = /(\d+\s+[\+\-\*\/]\s+\d+)/g; - const cleanedVarRegex = /var\([^)]+\)/g; - return matchRegex$2(_val.replace(cleanedVarRegex, "0"), calculationRegex) ? `calc(${_val})` : _val; - } - return val; - } else if (isNumber$7(value4)) { - return value4; - } - return void 0; -} -__name(getVariableValue$1, "getVariableValue$1"); -function getComputedValue$1(obj = {}, value4) { - if (isString$b(value4)) { - const regex2 = /{([^}]*)}/g; - const val = value4.trim(); - return matchRegex$2(val, regex2) ? val.replaceAll(regex2, (v2) => getKeyValue$2(obj, v2.replace(/{|}/g, ""))) : val; - } else if (isNumber$7(value4)) { - return value4; - } - return void 0; -} -__name(getComputedValue$1, "getComputedValue$1"); -function setProperty$1(properties, key, value4) { - if (isString$b(key, false)) { - properties.push(`${key}:${value4};`); - } -} -__name(setProperty$1, "setProperty$1"); -function getRule$1(selector, properties) { - if (selector) { - return `${selector}{${properties}}`; - } - return ""; -} -__name(getRule$1, "getRule$1"); -function normalizeColor$1(color2) { - if (color2.length === 4) { - return `#${color2[1]}${color2[1]}${color2[2]}${color2[2]}${color2[3]}${color2[3]}`; - } - return color2; -} -__name(normalizeColor$1, "normalizeColor$1"); -function hexToRgb$2(hex) { - var bigint = parseInt(hex.substring(1), 16); - var r2 = bigint >> 16 & 255; - var g2 = bigint >> 8 & 255; - var b2 = bigint & 255; - return { r: r2, g: g2, b: b2 }; -} -__name(hexToRgb$2, "hexToRgb$2"); -function rgbToHex$1(r2, g2, b2) { - return `#${r2.toString(16).padStart(2, "0")}${g2.toString(16).padStart(2, "0")}${b2.toString(16).padStart(2, "0")}`; -} -__name(rgbToHex$1, "rgbToHex$1"); -var mix_default$1 = /* @__PURE__ */ __name((color1, color2, weight) => { - color1 = normalizeColor$1(color1); - color2 = normalizeColor$1(color2); - var p2 = weight / 100; - var w2 = p2 * 2 - 1; - var w1 = (w2 + 1) / 2; - var w22 = 1 - w1; - var rgb1 = hexToRgb$2(color1); - var rgb2 = hexToRgb$2(color2); - var r2 = Math.round(rgb1.r * w1 + rgb2.r * w22); - var g2 = Math.round(rgb1.g * w1 + rgb2.g * w22); - var b2 = Math.round(rgb1.b * w1 + rgb2.b * w22); - return rgbToHex$1(r2, g2, b2); -}, "mix_default$1"); -var shade_default$1 = /* @__PURE__ */ __name((color2, percent) => mix_default$1("#000000", color2, percent), "shade_default$1"); -var tint_default$1 = /* @__PURE__ */ __name((color2, percent) => mix_default$1("#ffffff", color2, percent), "tint_default$1"); -var scales$1 = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]; -var palette_default$1 = /* @__PURE__ */ __name((color2) => { - if (/{([^}]*)}/g.test(color2)) { - const token = color2.replace(/{|}/g, ""); - return scales$1.reduce((acc, scale) => (acc[scale] = `{${token}.${scale}}`, acc), {}); - } - return typeof color2 === "string" ? scales$1.reduce((acc, scale, i2) => (acc[scale] = i2 <= 5 ? tint_default$1(color2, (5 - i2) * 19) : shade_default$1(color2, (i2 - 5) * 15), acc), {}) : color2; -}, "palette_default$1"); -var $dt$1 = /* @__PURE__ */ __name((tokenPath) => { - var _a2; - const theme43 = config_default$1.getTheme(); - const variable = dtwt$1(theme43, tokenPath, void 0, "variable"); - const name2 = (_a2 = variable == null ? void 0 : variable.match(/--[\w-]+/g)) == null ? void 0 : _a2[0]; - const value4 = dtwt$1(theme43, tokenPath, void 0, "value"); - return { - name: name2, - variable, - value: value4 - }; -}, "$dt$1"); -var dt$1 = /* @__PURE__ */ __name((...args) => { - return dtwt$1(config_default$1.getTheme(), ...args); -}, "dt$1"); -var dtwt$1 = /* @__PURE__ */ __name((theme43 = {}, tokenPath, fallback, type) => { - if (tokenPath) { - const { variable: VARIABLE, options: OPTIONS } = config_default$1.defaults || {}; - const { prefix: prefix2, transform: transform2 } = (theme43 == null ? void 0 : theme43.options) || OPTIONS || {}; - const regex2 = /{([^}]*)}/g; - const token = matchRegex$2(tokenPath, regex2) ? tokenPath : `{${tokenPath}}`; - const isStrictTransform = type === "value" || isEmpty$3(type) && transform2 === "strict"; - return isStrictTransform ? config_default$1.getTokenValue(tokenPath) : getVariableValue$1(token, void 0, prefix2, [VARIABLE.excludedKeyRegex], fallback); - } - return ""; -}, "dtwt$1"); -function css$5(style2) { - return resolve$4(style2, { dt: dt$1 }); -} -__name(css$5, "css$5"); -var $t$1 = /* @__PURE__ */ __name((theme43 = {}) => { - let { preset: _preset, options: _options } = theme43; - return { - preset(value4) { - _preset = _preset ? mergeKeys$2(_preset, value4) : value4; - return this; - }, - options(value4) { - _options = _options ? __spreadValues$5(__spreadValues$5({}, _options), value4) : value4; - return this; - }, - // features - primaryPalette(primary) { - const { semantic } = _preset || {}; - _preset = __spreadProps$1(__spreadValues$5({}, _preset), { semantic: __spreadProps$1(__spreadValues$5({}, semantic), { primary }) }); - return this; - }, - surfacePalette(surface) { - var _a2, _b; - const { semantic } = _preset || {}; - const lightSurface = (surface == null ? void 0 : surface.hasOwnProperty("light")) ? surface == null ? void 0 : surface.light : surface; - const darkSurface = (surface == null ? void 0 : surface.hasOwnProperty("dark")) ? surface == null ? void 0 : surface.dark : surface; - const newColorScheme = { - colorScheme: { - light: __spreadValues$5(__spreadValues$5({}, (_a2 = semantic == null ? void 0 : semantic.colorScheme) == null ? void 0 : _a2.light), !!lightSurface && { surface: lightSurface }), - dark: __spreadValues$5(__spreadValues$5({}, (_b = semantic == null ? void 0 : semantic.colorScheme) == null ? void 0 : _b.dark), !!darkSurface && { surface: darkSurface }) - } - }; - _preset = __spreadProps$1(__spreadValues$5({}, _preset), { semantic: __spreadValues$5(__spreadValues$5({}, semantic), newColorScheme) }); - return this; - }, - // actions - define({ useDefaultPreset = false, useDefaultOptions = false } = {}) { - return { - preset: useDefaultPreset ? config_default$1.getPreset() : _preset, - options: useDefaultOptions ? config_default$1.getOptions() : _options - }; - }, - update({ mergePresets = true, mergeOptions: mergeOptions2 = true } = {}) { - const newTheme = { - preset: mergePresets ? mergeKeys$2(config_default$1.getPreset(), _preset) : _preset, - options: mergeOptions2 ? __spreadValues$5(__spreadValues$5({}, config_default$1.getOptions()), _options) : _options - }; - config_default$1.setTheme(newTheme); - return newTheme; - }, - use(options4) { - const newTheme = this.define(options4); - config_default$1.setTheme(newTheme); - return newTheme; - } - }; -}, "$t$1"); -function toVariables_default$1(theme43, options4 = {}) { - const VARIABLE = config_default$1.defaults.variable; - const { prefix: prefix2 = VARIABLE.prefix, selector = VARIABLE.selector, excludedKeyRegex = VARIABLE.excludedKeyRegex } = options4; - const _toVariables = /* @__PURE__ */ __name((_theme, _prefix = "") => { - return Object.entries(_theme).reduce( - (acc, [key, value4]) => { - const px = matchRegex$2(key, excludedKeyRegex) ? toNormalizeVariable$1(_prefix) : toNormalizeVariable$1(_prefix, toKebabCase$2(key)); - const v2 = toValue$5(value4); - if (isObject$g(v2)) { - const { variables: variables2, tokens: tokens2 } = _toVariables(v2, px); - merge$3(acc["tokens"], tokens2); - merge$3(acc["variables"], variables2); - } else { - acc["tokens"].push((prefix2 ? px.replace(`${prefix2}-`, "") : px).replaceAll("-", ".")); - setProperty$1(acc["variables"], getVariableName$1(px), getVariableValue$1(v2, px, prefix2, [excludedKeyRegex])); - } - return acc; - }, - { variables: [], tokens: [] } - ); - }, "_toVariables"); - const { variables, tokens } = _toVariables(theme43, prefix2); - return { - value: variables, - tokens, - declarations: variables.join(""), - css: getRule$1(selector, variables.join("")) - }; -} -__name(toVariables_default$1, "toVariables_default$1"); -var themeUtils_default$1 = { - regex: { - rules: { - class: { - pattern: /^\.([a-zA-Z][\w-]*)$/, - resolve(value4) { - return { type: "class", selector: value4, matched: this.pattern.test(value4.trim()) }; - } - }, - attr: { - pattern: /^\[(.*)\]$/, - resolve(value4) { - return { type: "attr", selector: `:root${value4}`, matched: this.pattern.test(value4.trim()) }; - } - }, - media: { - pattern: /^@media (.*)$/, - resolve(value4) { - return { type: "media", selector: `${value4}{:root{[CSS]}}`, matched: this.pattern.test(value4.trim()) }; - } - }, - system: { - pattern: /^system$/, - resolve(value4) { - return { type: "system", selector: "@media (prefers-color-scheme: dark){:root{[CSS]}}", matched: this.pattern.test(value4.trim()) }; - } - }, - custom: { - resolve(value4) { - return { type: "custom", selector: value4, matched: true }; - } - } - }, - resolve(value4) { - const rules = Object.keys(this.rules).filter((k2) => k2 !== "custom").map((r2) => this.rules[r2]); - return [value4].flat().map((v2) => { - var _a2; - return (_a2 = rules.map((r2) => r2.resolve(v2)).find((rr) => rr.matched)) != null ? _a2 : this.rules.custom.resolve(v2); - }); - } - }, - _toVariables(theme43, options4) { - return toVariables_default$1(theme43, { prefix: options4 == null ? void 0 : options4.prefix }); - }, - getCommon({ name: name2 = "", theme: theme43 = {}, params, set: set3, defaults: defaults2 }) { - var _e, _f, _g, _h, _i, _j, _k; - const { preset, options: options4 } = theme43; - let primitive_css, primitive_tokens, semantic_css, semantic_tokens, global_css, global_tokens, style2; - if (isNotEmpty$2(preset) && options4.transform !== "strict") { - const { primitive, semantic, extend: extend5 } = preset; - const _a2 = semantic || {}, { colorScheme } = _a2, sRest = __objRest$1(_a2, ["colorScheme"]); - const _b = extend5 || {}, { colorScheme: eColorScheme } = _b, eRest = __objRest$1(_b, ["colorScheme"]); - const _c = colorScheme || {}, { dark: dark2 } = _c, csRest = __objRest$1(_c, ["dark"]); - const _d = eColorScheme || {}, { dark: eDark } = _d, ecsRest = __objRest$1(_d, ["dark"]); - const prim_var = isNotEmpty$2(primitive) ? this._toVariables({ primitive }, options4) : {}; - const sRest_var = isNotEmpty$2(sRest) ? this._toVariables({ semantic: sRest }, options4) : {}; - const csRest_var = isNotEmpty$2(csRest) ? this._toVariables({ light: csRest }, options4) : {}; - const csDark_var = isNotEmpty$2(dark2) ? this._toVariables({ dark: dark2 }, options4) : {}; - const eRest_var = isNotEmpty$2(eRest) ? this._toVariables({ semantic: eRest }, options4) : {}; - const ecsRest_var = isNotEmpty$2(ecsRest) ? this._toVariables({ light: ecsRest }, options4) : {}; - const ecsDark_var = isNotEmpty$2(eDark) ? this._toVariables({ dark: eDark }, options4) : {}; - const [prim_css, prim_tokens] = [(_e = prim_var.declarations) != null ? _e : "", prim_var.tokens]; - const [sRest_css, sRest_tokens] = [(_f = sRest_var.declarations) != null ? _f : "", sRest_var.tokens || []]; - const [csRest_css, csRest_tokens] = [(_g = csRest_var.declarations) != null ? _g : "", csRest_var.tokens || []]; - const [csDark_css, csDark_tokens] = [(_h = csDark_var.declarations) != null ? _h : "", csDark_var.tokens || []]; - const [eRest_css, eRest_tokens] = [(_i = eRest_var.declarations) != null ? _i : "", eRest_var.tokens || []]; - const [ecsRest_css, ecsRest_tokens] = [(_j = ecsRest_var.declarations) != null ? _j : "", ecsRest_var.tokens || []]; - const [ecsDark_css, ecsDark_tokens] = [(_k = ecsDark_var.declarations) != null ? _k : "", ecsDark_var.tokens || []]; - primitive_css = this.transformCSS(name2, prim_css, "light", "variable", options4, set3, defaults2); - primitive_tokens = prim_tokens; - const semantic_light_css = this.transformCSS(name2, `${sRest_css}${csRest_css}`, "light", "variable", options4, set3, defaults2); - const semantic_dark_css = this.transformCSS(name2, `${csDark_css}`, "dark", "variable", options4, set3, defaults2); - semantic_css = `${semantic_light_css}${semantic_dark_css}`; - semantic_tokens = [.../* @__PURE__ */ new Set([...sRest_tokens, ...csRest_tokens, ...csDark_tokens])]; - const global_light_css = this.transformCSS(name2, `${eRest_css}${ecsRest_css}color-scheme:light`, "light", "variable", options4, set3, defaults2); - const global_dark_css = this.transformCSS(name2, `${ecsDark_css}color-scheme:dark`, "dark", "variable", options4, set3, defaults2); - global_css = `${global_light_css}${global_dark_css}`; - global_tokens = [.../* @__PURE__ */ new Set([...eRest_tokens, ...ecsRest_tokens, ...ecsDark_tokens])]; - style2 = resolve$4(preset.css, { dt: dt$1 }); - } - return { - primitive: { - css: primitive_css, - tokens: primitive_tokens - }, - semantic: { - css: semantic_css, - tokens: semantic_tokens - }, - global: { - css: global_css, - tokens: global_tokens - }, - style: style2 - }; - }, - getPreset({ name: name2 = "", preset = {}, options: options4, params, set: set3, defaults: defaults2, selector }) { - var _e, _f, _g; - let p_css, p_tokens, p_style; - if (isNotEmpty$2(preset) && options4.transform !== "strict") { - const _name = name2.replace("-directive", ""); - const _a2 = preset, { colorScheme, extend: extend5, css: css22 } = _a2, vRest = __objRest$1(_a2, ["colorScheme", "extend", "css"]); - const _b = extend5 || {}, { colorScheme: eColorScheme } = _b, evRest = __objRest$1(_b, ["colorScheme"]); - const _c = colorScheme || {}, { dark: dark2 } = _c, csRest = __objRest$1(_c, ["dark"]); - const _d = eColorScheme || {}, { dark: ecsDark } = _d, ecsRest = __objRest$1(_d, ["dark"]); - const vRest_var = isNotEmpty$2(vRest) ? this._toVariables({ [_name]: __spreadValues$5(__spreadValues$5({}, vRest), evRest) }, options4) : {}; - const csRest_var = isNotEmpty$2(csRest) ? this._toVariables({ [_name]: __spreadValues$5(__spreadValues$5({}, csRest), ecsRest) }, options4) : {}; - const csDark_var = isNotEmpty$2(dark2) ? this._toVariables({ [_name]: __spreadValues$5(__spreadValues$5({}, dark2), ecsDark) }, options4) : {}; - const [vRest_css, vRest_tokens] = [(_e = vRest_var.declarations) != null ? _e : "", vRest_var.tokens || []]; - const [csRest_css, csRest_tokens] = [(_f = csRest_var.declarations) != null ? _f : "", csRest_var.tokens || []]; - const [csDark_css, csDark_tokens] = [(_g = csDark_var.declarations) != null ? _g : "", csDark_var.tokens || []]; - const light_variable_css = this.transformCSS(_name, `${vRest_css}${csRest_css}`, "light", "variable", options4, set3, defaults2, selector); - const dark_variable_css = this.transformCSS(_name, csDark_css, "dark", "variable", options4, set3, defaults2, selector); - p_css = `${light_variable_css}${dark_variable_css}`; - p_tokens = [.../* @__PURE__ */ new Set([...vRest_tokens, ...csRest_tokens, ...csDark_tokens])]; - p_style = resolve$4(css22, { dt: dt$1 }); - } - return { - css: p_css, - tokens: p_tokens, - style: p_style - }; - }, - getPresetC({ name: name2 = "", theme: theme43 = {}, params, set: set3, defaults: defaults2 }) { - var _a2; - const { preset, options: options4 } = theme43; - const cPreset = (_a2 = preset == null ? void 0 : preset.components) == null ? void 0 : _a2[name2]; - return this.getPreset({ name: name2, preset: cPreset, options: options4, params, set: set3, defaults: defaults2 }); - }, - getPresetD({ name: name2 = "", theme: theme43 = {}, params, set: set3, defaults: defaults2 }) { - var _a2; - const dName = name2.replace("-directive", ""); - const { preset, options: options4 } = theme43; - const dPreset = (_a2 = preset == null ? void 0 : preset.directives) == null ? void 0 : _a2[dName]; - return this.getPreset({ name: dName, preset: dPreset, options: options4, params, set: set3, defaults: defaults2 }); - }, - applyDarkColorScheme(options4) { - return !(options4.darkModeSelector === "none" || options4.darkModeSelector === false); - }, - getColorSchemeOption(options4, defaults2) { - var _a2; - return this.applyDarkColorScheme(options4) ? this.regex.resolve(options4.darkModeSelector === true ? defaults2.options.darkModeSelector : (_a2 = options4.darkModeSelector) != null ? _a2 : defaults2.options.darkModeSelector) : []; - }, - getLayerOrder(name2, options4 = {}, params, defaults2) { - const { cssLayer } = options4; - if (cssLayer) { - const order = resolve$4(cssLayer.order || "primeui", params); - return `@layer ${order}`; - } - return ""; - }, - getCommonStyleSheet({ name: name2 = "", theme: theme43 = {}, params, props = {}, set: set3, defaults: defaults2 }) { - const common = this.getCommon({ name: name2, theme: theme43, params, set: set3, defaults: defaults2 }); - const _props = Object.entries(props).reduce((acc, [k2, v2]) => acc.push(`${k2}="${v2}"`) && acc, []).join(" "); - return Object.entries(common || {}).reduce((acc, [key, value4]) => { - if (value4 == null ? void 0 : value4.css) { - const _css = minifyCSS$2(value4 == null ? void 0 : value4.css); - const id3 = `${key}-variables`; - acc.push(``); - } - return acc; - }, []).join(""); - }, - getStyleSheet({ name: name2 = "", theme: theme43 = {}, params, props = {}, set: set3, defaults: defaults2 }) { - var _a2; - const options4 = { name: name2, theme: theme43, params, set: set3, defaults: defaults2 }; - const preset_css = (_a2 = name2.includes("-directive") ? this.getPresetD(options4) : this.getPresetC(options4)) == null ? void 0 : _a2.css; - const _props = Object.entries(props).reduce((acc, [k2, v2]) => acc.push(`${k2}="${v2}"`) && acc, []).join(" "); - return preset_css ? `` : ""; - }, - createTokens(obj = {}, defaults2, parentKey = "", parentPath = "", tokens = {}) { - Object.entries(obj).forEach(([key, value4]) => { - const currentKey = matchRegex$2(key, defaults2.variable.excludedKeyRegex) ? parentKey : parentKey ? `${parentKey}.${toTokenKey$4(key)}` : toTokenKey$4(key); - const currentPath = parentPath ? `${parentPath}.${key}` : key; - if (isObject$g(value4)) { - this.createTokens(value4, defaults2, currentKey, currentPath, tokens); - } else { - tokens[currentKey] || (tokens[currentKey] = { - paths: [], - computed(colorScheme, tokenPathMap = {}) { - var _a2, _b; - if (this.paths.length === 1) { - return (_a2 = this.paths[0]) == null ? void 0 : _a2.computed(this.paths[0].scheme, tokenPathMap["binding"]); - } else if (colorScheme && colorScheme !== "none") { - return (_b = this.paths.find((p2) => p2.scheme === colorScheme)) == null ? void 0 : _b.computed(colorScheme, tokenPathMap["binding"]); - } - return this.paths.map((p2) => p2.computed(p2.scheme, tokenPathMap[p2.scheme])); - } - }); - tokens[currentKey].paths.push({ - path: currentPath, - value: value4, - scheme: currentPath.includes("colorScheme.light") ? "light" : currentPath.includes("colorScheme.dark") ? "dark" : "none", - computed(colorScheme, tokenPathMap = {}) { - const regex2 = /{([^}]*)}/g; - let computedValue = value4; - tokenPathMap["name"] = this.path; - tokenPathMap["binding"] || (tokenPathMap["binding"] = {}); - if (matchRegex$2(value4, regex2)) { - const val = value4.trim(); - const _val = val.replaceAll(regex2, (v2) => { - var _a2; - const path = v2.replace(/{|}/g, ""); - const computed2 = (_a2 = tokens[path]) == null ? void 0 : _a2.computed(colorScheme, tokenPathMap); - return isArray$c(computed2) && computed2.length === 2 ? `light-dark(${computed2[0].value},${computed2[1].value})` : computed2 == null ? void 0 : computed2.value; - }); - const calculationRegex = /(\d+\w*\s+[\+\-\*\/]\s+\d+\w*)/g; - const cleanedVarRegex = /var\([^)]+\)/g; - computedValue = matchRegex$2(_val.replace(cleanedVarRegex, "0"), calculationRegex) ? `calc(${_val})` : _val; - } - isEmpty$3(tokenPathMap["binding"]) && delete tokenPathMap["binding"]; - return { - colorScheme, - path: this.path, - paths: tokenPathMap, - value: computedValue.includes("undefined") ? void 0 : computedValue - }; - } - }); - } - }); - return tokens; - }, - getTokenValue(tokens, path, defaults2) { - var _a2; - const normalizePath2 = /* @__PURE__ */ __name((str) => { - const strArr = str.split("."); - return strArr.filter((s2) => !matchRegex$2(s2.toLowerCase(), defaults2.variable.excludedKeyRegex)).join("."); - }, "normalizePath"); - const token = normalizePath2(path); - const colorScheme = path.includes("colorScheme.light") ? "light" : path.includes("colorScheme.dark") ? "dark" : void 0; - const computedValues = [(_a2 = tokens[token]) == null ? void 0 : _a2.computed(colorScheme)].flat().filter((computed2) => computed2); - return computedValues.length === 1 ? computedValues[0].value : computedValues.reduce((acc = {}, computed2) => { - const _a22 = computed2, { colorScheme: cs } = _a22, rest = __objRest$1(_a22, ["colorScheme"]); - acc[cs] = rest; - return acc; - }, void 0); - }, - getSelectorRule(selector1, selector2, type, css22) { - return type === "class" || type === "attr" ? getRule$1(isNotEmpty$2(selector2) ? `${selector1}${selector2},${selector1} ${selector2}` : selector1, css22) : getRule$1(selector1, isNotEmpty$2(selector2) ? getRule$1(selector2, css22) : css22); - }, - transformCSS(name2, css22, mode2, type, options4 = {}, set3, defaults2, selector) { - if (isNotEmpty$2(css22)) { - const { cssLayer } = options4; - if (type !== "style") { - const colorSchemeOption = this.getColorSchemeOption(options4, defaults2); - css22 = mode2 === "dark" ? colorSchemeOption.reduce((acc, { type: type2, selector: _selector }) => { - if (isNotEmpty$2(_selector)) { - acc += _selector.includes("[CSS]") ? _selector.replace("[CSS]", css22) : this.getSelectorRule(_selector, selector, type2, css22); - } - return acc; - }, "") : getRule$1(selector != null ? selector : ":root", css22); - } - if (cssLayer) { - const layerOptions = { - name: "primeui", - order: "primeui" - }; - isObject$g(cssLayer) && (layerOptions.name = resolve$4(cssLayer.name, { name: name2, type })); - if (isNotEmpty$2(layerOptions.name)) { - css22 = getRule$1(`@layer ${layerOptions.name}`, css22); - set3 == null ? void 0 : set3.layerNames(layerOptions.name); - } - } - return css22; - } - return ""; - } -}; -var config_default$1 = { - defaults: { - variable: { - prefix: "p", - selector: ":root", - excludedKeyRegex: /^(primitive|semantic|components|directives|variables|colorscheme|light|dark|common|root|states|extend|css)$/gi - }, - options: { - prefix: "p", - darkModeSelector: "system", - cssLayer: false - } - }, - _theme: void 0, - _layerNames: /* @__PURE__ */ new Set(), - _loadedStyleNames: /* @__PURE__ */ new Set(), - _loadingStyles: /* @__PURE__ */ new Set(), - _tokens: {}, - update(newValues = {}) { - const { theme: theme43 } = newValues; - if (theme43) { - this._theme = __spreadProps$1(__spreadValues$5({}, theme43), { - options: __spreadValues$5(__spreadValues$5({}, this.defaults.options), theme43.options) - }); - this._tokens = themeUtils_default$1.createTokens(this.preset, this.defaults); - this.clearLoadedStyleNames(); - } - }, - get theme() { - return this._theme; - }, - get preset() { - var _a2; - return ((_a2 = this.theme) == null ? void 0 : _a2.preset) || {}; - }, - get options() { - var _a2; - return ((_a2 = this.theme) == null ? void 0 : _a2.options) || {}; - }, - get tokens() { - return this._tokens; - }, - getTheme() { - return this.theme; - }, - setTheme(newValue2) { - this.update({ theme: newValue2 }); - service_default$1.emit("theme:change", newValue2); - }, - getPreset() { - return this.preset; - }, - setPreset(newValue2) { - this._theme = __spreadProps$1(__spreadValues$5({}, this.theme), { preset: newValue2 }); - this._tokens = themeUtils_default$1.createTokens(newValue2, this.defaults); - this.clearLoadedStyleNames(); - service_default$1.emit("preset:change", newValue2); - service_default$1.emit("theme:change", this.theme); - }, - getOptions() { - return this.options; - }, - setOptions(newValue2) { - this._theme = __spreadProps$1(__spreadValues$5({}, this.theme), { options: newValue2 }); - this.clearLoadedStyleNames(); - service_default$1.emit("options:change", newValue2); - service_default$1.emit("theme:change", this.theme); - }, - getLayerNames() { - return [...this._layerNames]; - }, - setLayerNames(layerName) { - this._layerNames.add(layerName); - }, - getLoadedStyleNames() { - return this._loadedStyleNames; - }, - isStyleNameLoaded(name2) { - return this._loadedStyleNames.has(name2); - }, - setLoadedStyleName(name2) { - this._loadedStyleNames.add(name2); - }, - deleteLoadedStyleName(name2) { - this._loadedStyleNames.delete(name2); - }, - clearLoadedStyleNames() { - this._loadedStyleNames.clear(); - }, - getTokenValue(tokenPath) { - return themeUtils_default$1.getTokenValue(this.tokens, tokenPath, this.defaults); - }, - getCommon(name2 = "", params) { - return themeUtils_default$1.getCommon({ name: name2, theme: this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }); - }, - getComponent(name2 = "", params) { - const options4 = { name: name2, theme: this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }; - return themeUtils_default$1.getPresetC(options4); - }, - getDirective(name2 = "", params) { - const options4 = { name: name2, theme: this.theme, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }; - return themeUtils_default$1.getPresetD(options4); - }, - getCustomPreset(name2 = "", preset, selector, params) { - const options4 = { name: name2, preset, options: this.options, selector, params, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }; - return themeUtils_default$1.getPreset(options4); - }, - getLayerOrderCSS(name2 = "") { - return themeUtils_default$1.getLayerOrder(name2, this.options, { names: this.getLayerNames() }, this.defaults); - }, - transformCSS(name2 = "", css22, type = "style", mode2) { - return themeUtils_default$1.transformCSS(name2, css22, mode2, type, this.options, { layerNames: this.setLayerNames.bind(this) }, this.defaults); - }, - getCommonStyleSheet(name2 = "", params, props = {}) { - return themeUtils_default$1.getCommonStyleSheet({ name: name2, theme: this.theme, params, props, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }); - }, - getStyleSheet(name2, params, props = {}) { - return themeUtils_default$1.getStyleSheet({ name: name2, theme: this.theme, params, props, defaults: this.defaults, set: { layerNames: this.setLayerNames.bind(this) } }); - }, - onStyleMounted(name2) { - this._loadingStyles.add(name2); - }, - onStyleUpdated(name2) { - this._loadingStyles.add(name2); - }, - onStyleLoaded(event, { name: name2 }) { - if (this._loadingStyles.size) { - this._loadingStyles.delete(name2); - service_default$1.emit(`theme:${name2}:load`, event); - !this._loadingStyles.size && service_default$1.emit("theme:load"); - } - } -}; -function updatePreset$1(...presets) { - const newPreset = mergeKeys$2(config_default$1.getPreset(), ...presets); - config_default$1.setPreset(newPreset); - return newPreset; -} -__name(updatePreset$1, "updatePreset$1"); -function updatePrimaryPalette$1(primary) { - return $t$1().primaryPalette(primary).update().preset; -} -__name(updatePrimaryPalette$1, "updatePrimaryPalette$1"); -function updateSurfacePalette$1(palette) { - return $t$1().surfacePalette(palette).update().preset; -} -__name(updateSurfacePalette$1, "updateSurfacePalette$1"); -function usePreset$1(...presets) { - const newPreset = mergeKeys$2(...presets); - config_default$1.setPreset(newPreset); - return newPreset; -} -__name(usePreset$1, "usePreset$1"); -function useTheme$1(theme43) { - return $t$1(theme43).update({ mergePresets: false }); -} -__name(useTheme$1, "useTheme$1"); -var index$1r = { - root: { - transitionDuration: "{transition.duration}" - }, - panel: { - borderWidth: "0 0 1px 0", - borderColor: "{content.border.color}" - }, - header: { - color: "{text.muted.color}", - hoverColor: "{text.color}", - activeColor: "{text.color}", - padding: "1.125rem", - fontWeight: "600", - borderRadius: "0", - borderWidth: "0", - borderColor: "{content.border.color}", - background: "{content.background}", - hoverBackground: "{content.background}", - activeBackground: "{content.background}", - activeHoverBackground: "{content.background}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - }, - toggleIcon: { - color: "{text.muted.color}", - hoverColor: "{text.color}", - activeColor: "{text.color}", - activeHoverColor: "{text.color}" - }, - first: { - topBorderRadius: "{content.border.radius}", - borderWidth: "0" - }, - last: { - bottomBorderRadius: "{content.border.radius}", - activeBottomBorderRadius: "0" - } - }, - content: { - borderWidth: "0", - borderColor: "{content.border.color}", - background: "{content.background}", - color: "{text.color}", - padding: "0 1.125rem 1.125rem 1.125rem" - } -}; -var index$1q = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledHoverBackground: "{form.field.filled.hover.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}" - }, - overlay: { - background: "{overlay.select.background}", - borderColor: "{overlay.select.border.color}", - borderRadius: "{overlay.select.border.radius}", - color: "{overlay.select.color}", - shadow: "{overlay.select.shadow}" - }, - list: { - padding: "{list.padding}", - gap: "{list.gap}" - }, - option: { - focusBackground: "{list.option.focus.background}", - selectedBackground: "{list.option.selected.background}", - selectedFocusBackground: "{list.option.selected.focus.background}", - color: "{list.option.color}", - focusColor: "{list.option.focus.color}", - selectedColor: "{list.option.selected.color}", - selectedFocusColor: "{list.option.selected.focus.color}", - padding: "{list.option.padding}", - borderRadius: "{list.option.border.radius}" - }, - optionGroup: { - background: "{list.option.group.background}", - color: "{list.option.group.color}", - fontWeight: "{list.option.group.font.weight}", - padding: "{list.option.group.padding}" - }, - dropdown: { - width: "2.5rem", - sm: { - width: "2rem" - }, - lg: { - width: "3rem" - }, - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.border.color}", - activeBorderColor: "{form.field.border.color}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - chip: { - borderRadius: "{border.radius.sm}" - }, - emptyMessage: { - padding: "{list.option.padding}" - }, - colorScheme: { - light: { - chip: { - focusBackground: "{surface.200}", - focusColor: "{surface.800}" - }, - dropdown: { - background: "{surface.100}", - hoverBackground: "{surface.200}", - activeBackground: "{surface.300}", - color: "{surface.600}", - hoverColor: "{surface.700}", - activeColor: "{surface.800}" - } - }, - dark: { - chip: { - focusBackground: "{surface.700}", - focusColor: "{surface.0}" - }, - dropdown: { - background: "{surface.800}", - hoverBackground: "{surface.700}", - activeBackground: "{surface.600}", - color: "{surface.300}", - hoverColor: "{surface.200}", - activeColor: "{surface.100}" - } - } - } -}; -var index$1p = { - root: { - width: "2rem", - height: "2rem", - fontSize: "1rem", - background: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}" - }, - icon: { - size: "1rem" - }, - group: { - borderColor: "{content.background}", - offset: "-0.75rem" - }, - lg: { - width: "3rem", - height: "3rem", - fontSize: "1.5rem", - icon: { - size: "1.5rem" - }, - group: { - offset: "-1rem" - } - }, - xl: { - width: "4rem", - height: "4rem", - fontSize: "2rem", - icon: { - size: "2rem" - }, - group: { - offset: "-1.5rem" - } - } -}; -var index$1o = { - root: { - borderRadius: "{border.radius.md}", - padding: "0 0.5rem", - fontSize: "0.75rem", - fontWeight: "700", - minWidth: "1.5rem", - height: "1.5rem" - }, - dot: { - size: "0.5rem" - }, - sm: { - fontSize: "0.625rem", - minWidth: "1.25rem", - height: "1.25rem" - }, - lg: { - fontSize: "0.875rem", - minWidth: "1.75rem", - height: "1.75rem" - }, - xl: { - fontSize: "1rem", - minWidth: "2rem", - height: "2rem" - }, - colorScheme: { - light: { - primary: { - background: "{primary.color}", - color: "{primary.contrast.color}" - }, - secondary: { - background: "{surface.100}", - color: "{surface.600}" - }, - success: { - background: "{green.500}", - color: "{surface.0}" - }, - info: { - background: "{sky.500}", - color: "{surface.0}" - }, - warn: { - background: "{orange.500}", - color: "{surface.0}" - }, - danger: { - background: "{red.500}", - color: "{surface.0}" - }, - contrast: { - background: "{surface.950}", - color: "{surface.0}" - } - }, - dark: { - primary: { - background: "{primary.color}", - color: "{primary.contrast.color}" - }, - secondary: { - background: "{surface.800}", - color: "{surface.300}" - }, - success: { - background: "{green.400}", - color: "{green.950}" - }, - info: { - background: "{sky.400}", - color: "{sky.950}" - }, - warn: { - background: "{orange.400}", - color: "{orange.950}" - }, - danger: { - background: "{red.400}", - color: "{red.950}" - }, - contrast: { - background: "{surface.0}", - color: "{surface.950}" - } - } - } -}; -var index$1n = { - primitive: { - borderRadius: { - none: "0", - xs: "2px", - sm: "4px", - md: "6px", - lg: "8px", - xl: "12px" - }, - emerald: { - 50: "#ecfdf5", - 100: "#d1fae5", - 200: "#a7f3d0", - 300: "#6ee7b7", - 400: "#34d399", - 500: "#10b981", - 600: "#059669", - 700: "#047857", - 800: "#065f46", - 900: "#064e3b", - 950: "#022c22" - }, - green: { - 50: "#f0fdf4", - 100: "#dcfce7", - 200: "#bbf7d0", - 300: "#86efac", - 400: "#4ade80", - 500: "#22c55e", - 600: "#16a34a", - 700: "#15803d", - 800: "#166534", - 900: "#14532d", - 950: "#052e16" - }, - lime: { - 50: "#f7fee7", - 100: "#ecfccb", - 200: "#d9f99d", - 300: "#bef264", - 400: "#a3e635", - 500: "#84cc16", - 600: "#65a30d", - 700: "#4d7c0f", - 800: "#3f6212", - 900: "#365314", - 950: "#1a2e05" - }, - red: { - 50: "#fef2f2", - 100: "#fee2e2", - 200: "#fecaca", - 300: "#fca5a5", - 400: "#f87171", - 500: "#ef4444", - 600: "#dc2626", - 700: "#b91c1c", - 800: "#991b1b", - 900: "#7f1d1d", - 950: "#450a0a" - }, - orange: { - 50: "#fff7ed", - 100: "#ffedd5", - 200: "#fed7aa", - 300: "#fdba74", - 400: "#fb923c", - 500: "#f97316", - 600: "#ea580c", - 700: "#c2410c", - 800: "#9a3412", - 900: "#7c2d12", - 950: "#431407" - }, - amber: { - 50: "#fffbeb", - 100: "#fef3c7", - 200: "#fde68a", - 300: "#fcd34d", - 400: "#fbbf24", - 500: "#f59e0b", - 600: "#d97706", - 700: "#b45309", - 800: "#92400e", - 900: "#78350f", - 950: "#451a03" - }, - yellow: { - 50: "#fefce8", - 100: "#fef9c3", - 200: "#fef08a", - 300: "#fde047", - 400: "#facc15", - 500: "#eab308", - 600: "#ca8a04", - 700: "#a16207", - 800: "#854d0e", - 900: "#713f12", - 950: "#422006" - }, - teal: { - 50: "#f0fdfa", - 100: "#ccfbf1", - 200: "#99f6e4", - 300: "#5eead4", - 400: "#2dd4bf", - 500: "#14b8a6", - 600: "#0d9488", - 700: "#0f766e", - 800: "#115e59", - 900: "#134e4a", - 950: "#042f2e" - }, - cyan: { - 50: "#ecfeff", - 100: "#cffafe", - 200: "#a5f3fc", - 300: "#67e8f9", - 400: "#22d3ee", - 500: "#06b6d4", - 600: "#0891b2", - 700: "#0e7490", - 800: "#155e75", - 900: "#164e63", - 950: "#083344" - }, - sky: { - 50: "#f0f9ff", - 100: "#e0f2fe", - 200: "#bae6fd", - 300: "#7dd3fc", - 400: "#38bdf8", - 500: "#0ea5e9", - 600: "#0284c7", - 700: "#0369a1", - 800: "#075985", - 900: "#0c4a6e", - 950: "#082f49" - }, - blue: { - 50: "#eff6ff", - 100: "#dbeafe", - 200: "#bfdbfe", - 300: "#93c5fd", - 400: "#60a5fa", - 500: "#3b82f6", - 600: "#2563eb", - 700: "#1d4ed8", - 800: "#1e40af", - 900: "#1e3a8a", - 950: "#172554" - }, - indigo: { - 50: "#eef2ff", - 100: "#e0e7ff", - 200: "#c7d2fe", - 300: "#a5b4fc", - 400: "#818cf8", - 500: "#6366f1", - 600: "#4f46e5", - 700: "#4338ca", - 800: "#3730a3", - 900: "#312e81", - 950: "#1e1b4b" - }, - violet: { - 50: "#f5f3ff", - 100: "#ede9fe", - 200: "#ddd6fe", - 300: "#c4b5fd", - 400: "#a78bfa", - 500: "#8b5cf6", - 600: "#7c3aed", - 700: "#6d28d9", - 800: "#5b21b6", - 900: "#4c1d95", - 950: "#2e1065" - }, - purple: { - 50: "#faf5ff", - 100: "#f3e8ff", - 200: "#e9d5ff", - 300: "#d8b4fe", - 400: "#c084fc", - 500: "#a855f7", - 600: "#9333ea", - 700: "#7e22ce", - 800: "#6b21a8", - 900: "#581c87", - 950: "#3b0764" - }, - fuchsia: { - 50: "#fdf4ff", - 100: "#fae8ff", - 200: "#f5d0fe", - 300: "#f0abfc", - 400: "#e879f9", - 500: "#d946ef", - 600: "#c026d3", - 700: "#a21caf", - 800: "#86198f", - 900: "#701a75", - 950: "#4a044e" - }, - pink: { - 50: "#fdf2f8", - 100: "#fce7f3", - 200: "#fbcfe8", - 300: "#f9a8d4", - 400: "#f472b6", - 500: "#ec4899", - 600: "#db2777", - 700: "#be185d", - 800: "#9d174d", - 900: "#831843", - 950: "#500724" - }, - rose: { - 50: "#fff1f2", - 100: "#ffe4e6", - 200: "#fecdd3", - 300: "#fda4af", - 400: "#fb7185", - 500: "#f43f5e", - 600: "#e11d48", - 700: "#be123c", - 800: "#9f1239", - 900: "#881337", - 950: "#4c0519" - }, - slate: { - 50: "#f8fafc", - 100: "#f1f5f9", - 200: "#e2e8f0", - 300: "#cbd5e1", - 400: "#94a3b8", - 500: "#64748b", - 600: "#475569", - 700: "#334155", - 800: "#1e293b", - 900: "#0f172a", - 950: "#020617" - }, - gray: { - 50: "#f9fafb", - 100: "#f3f4f6", - 200: "#e5e7eb", - 300: "#d1d5db", - 400: "#9ca3af", - 500: "#6b7280", - 600: "#4b5563", - 700: "#374151", - 800: "#1f2937", - 900: "#111827", - 950: "#030712" - }, - zinc: { - 50: "#fafafa", - 100: "#f4f4f5", - 200: "#e4e4e7", - 300: "#d4d4d8", - 400: "#a1a1aa", - 500: "#71717a", - 600: "#52525b", - 700: "#3f3f46", - 800: "#27272a", - 900: "#18181b", - 950: "#09090b" - }, - neutral: { - 50: "#fafafa", - 100: "#f5f5f5", - 200: "#e5e5e5", - 300: "#d4d4d4", - 400: "#a3a3a3", - 500: "#737373", - 600: "#525252", - 700: "#404040", - 800: "#262626", - 900: "#171717", - 950: "#0a0a0a" - }, - stone: { - 50: "#fafaf9", - 100: "#f5f5f4", - 200: "#e7e5e4", - 300: "#d6d3d1", - 400: "#a8a29e", - 500: "#78716c", - 600: "#57534e", - 700: "#44403c", - 800: "#292524", - 900: "#1c1917", - 950: "#0c0a09" - } - }, - semantic: { - transitionDuration: "0.2s", - focusRing: { - width: "1px", - style: "solid", - color: "{primary.color}", - offset: "2px", - shadow: "none" - }, - disabledOpacity: "0.6", - iconSize: "1rem", - anchorGutter: "2px", - primary: { - 50: "{emerald.50}", - 100: "{emerald.100}", - 200: "{emerald.200}", - 300: "{emerald.300}", - 400: "{emerald.400}", - 500: "{emerald.500}", - 600: "{emerald.600}", - 700: "{emerald.700}", - 800: "{emerald.800}", - 900: "{emerald.900}", - 950: "{emerald.950}" - }, - formField: { - paddingX: "0.75rem", - paddingY: "0.5rem", - sm: { - fontSize: "0.875rem", - paddingX: "0.625rem", - paddingY: "0.375rem" - }, - lg: { - fontSize: "1.125rem", - paddingX: "0.875rem", - paddingY: "0.625rem" - }, - borderRadius: "{border.radius.md}", - focusRing: { - width: "0", - style: "none", - color: "transparent", - offset: "0", - shadow: "none" - }, - transitionDuration: "{transition.duration}" - }, - list: { - padding: "0.25rem 0.25rem", - gap: "2px", - header: { - padding: "0.5rem 1rem 0.25rem 1rem" - }, - option: { - padding: "0.5rem 0.75rem", - borderRadius: "{border.radius.sm}" - }, - optionGroup: { - padding: "0.5rem 0.75rem", - fontWeight: "600" - } - }, - content: { - borderRadius: "{border.radius.md}" - }, - mask: { - transitionDuration: "0.15s" - }, - navigation: { - list: { - padding: "0.25rem 0.25rem", - gap: "2px" - }, - item: { - padding: "0.5rem 0.75rem", - borderRadius: "{border.radius.sm}", - gap: "0.5rem" - }, - submenuLabel: { - padding: "0.5rem 0.75rem", - fontWeight: "600" - }, - submenuIcon: { - size: "0.875rem" - } - }, - overlay: { - select: { - borderRadius: "{border.radius.md}", - shadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)" - }, - popover: { - borderRadius: "{border.radius.md}", - padding: "0.75rem", - shadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)" - }, - modal: { - borderRadius: "{border.radius.xl}", - padding: "1.25rem", - shadow: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)" - }, - navigation: { - shadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)" - } - }, - colorScheme: { - light: { - surface: { - 0: "#ffffff", - 50: "{slate.50}", - 100: "{slate.100}", - 200: "{slate.200}", - 300: "{slate.300}", - 400: "{slate.400}", - 500: "{slate.500}", - 600: "{slate.600}", - 700: "{slate.700}", - 800: "{slate.800}", - 900: "{slate.900}", - 950: "{slate.950}" - }, - primary: { - color: "{primary.500}", - contrastColor: "#ffffff", - hoverColor: "{primary.600}", - activeColor: "{primary.700}" - }, - highlight: { - background: "{primary.50}", - focusBackground: "{primary.100}", - color: "{primary.700}", - focusColor: "{primary.800}" - }, - mask: { - background: "rgba(0,0,0,0.4)", - color: "{surface.200}" - }, - formField: { - background: "{surface.0}", - disabledBackground: "{surface.200}", - filledBackground: "{surface.50}", - filledHoverBackground: "{surface.50}", - filledFocusBackground: "{surface.50}", - borderColor: "{surface.300}", - hoverBorderColor: "{surface.400}", - focusBorderColor: "{primary.color}", - invalidBorderColor: "{red.400}", - color: "{surface.700}", - disabledColor: "{surface.500}", - placeholderColor: "{surface.500}", - invalidPlaceholderColor: "{red.600}", - floatLabelColor: "{surface.500}", - floatLabelFocusColor: "{primary.600}", - floatLabelActiveColor: "{surface.500}", - floatLabelInvalidColor: "{form.field.invalid.placeholder.color}", - iconColor: "{surface.400}", - shadow: "0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgba(18, 18, 23, 0.05)" - }, - text: { - color: "{surface.700}", - hoverColor: "{surface.800}", - mutedColor: "{surface.500}", - hoverMutedColor: "{surface.600}" - }, - content: { - background: "{surface.0}", - hoverBackground: "{surface.100}", - borderColor: "{surface.200}", - color: "{text.color}", - hoverColor: "{text.hover.color}" - }, - overlay: { - select: { - background: "{surface.0}", - borderColor: "{surface.200}", - color: "{text.color}" - }, - popover: { - background: "{surface.0}", - borderColor: "{surface.200}", - color: "{text.color}" - }, - modal: { - background: "{surface.0}", - borderColor: "{surface.200}", - color: "{text.color}" - } - }, - list: { - option: { - focusBackground: "{surface.100}", - selectedBackground: "{highlight.background}", - selectedFocusBackground: "{highlight.focus.background}", - color: "{text.color}", - focusColor: "{text.hover.color}", - selectedColor: "{highlight.color}", - selectedFocusColor: "{highlight.focus.color}", - icon: { - color: "{surface.400}", - focusColor: "{surface.500}" - } - }, - optionGroup: { - background: "transparent", - color: "{text.muted.color}" - } - }, - navigation: { - item: { - focusBackground: "{surface.100}", - activeBackground: "{surface.100}", - color: "{text.color}", - focusColor: "{text.hover.color}", - activeColor: "{text.hover.color}", - icon: { - color: "{surface.400}", - focusColor: "{surface.500}", - activeColor: "{surface.500}" - } - }, - submenuLabel: { - background: "transparent", - color: "{text.muted.color}" - }, - submenuIcon: { - color: "{surface.400}", - focusColor: "{surface.500}", - activeColor: "{surface.500}" - } - } - }, - dark: { - surface: { - 0: "#ffffff", - 50: "{zinc.50}", - 100: "{zinc.100}", - 200: "{zinc.200}", - 300: "{zinc.300}", - 400: "{zinc.400}", - 500: "{zinc.500}", - 600: "{zinc.600}", - 700: "{zinc.700}", - 800: "{zinc.800}", - 900: "{zinc.900}", - 950: "{zinc.950}" - }, - primary: { - color: "{primary.400}", - contrastColor: "{surface.900}", - hoverColor: "{primary.300}", - activeColor: "{primary.200}" - }, - highlight: { - background: "color-mix(in srgb, {primary.400}, transparent 84%)", - focusBackground: "color-mix(in srgb, {primary.400}, transparent 76%)", - color: "rgba(255,255,255,.87)", - focusColor: "rgba(255,255,255,.87)" - }, - mask: { - background: "rgba(0,0,0,0.6)", - color: "{surface.200}" - }, - formField: { - background: "{surface.950}", - disabledBackground: "{surface.700}", - filledBackground: "{surface.800}", - filledHoverBackground: "{surface.800}", - filledFocusBackground: "{surface.800}", - borderColor: "{surface.600}", - hoverBorderColor: "{surface.500}", - focusBorderColor: "{primary.color}", - invalidBorderColor: "{red.300}", - color: "{surface.0}", - disabledColor: "{surface.400}", - placeholderColor: "{surface.400}", - invalidPlaceholderColor: "{red.400}", - floatLabelColor: "{surface.400}", - floatLabelFocusColor: "{primary.color}", - floatLabelActiveColor: "{surface.400}", - floatLabelInvalidColor: "{form.field.invalid.placeholder.color}", - iconColor: "{surface.400}", - shadow: "0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgba(18, 18, 23, 0.05)" - }, - text: { - color: "{surface.0}", - hoverColor: "{surface.0}", - mutedColor: "{surface.400}", - hoverMutedColor: "{surface.300}" - }, - content: { - background: "{surface.900}", - hoverBackground: "{surface.800}", - borderColor: "{surface.700}", - color: "{text.color}", - hoverColor: "{text.hover.color}" - }, - overlay: { - select: { - background: "{surface.900}", - borderColor: "{surface.700}", - color: "{text.color}" - }, - popover: { - background: "{surface.900}", - borderColor: "{surface.700}", - color: "{text.color}" - }, - modal: { - background: "{surface.900}", - borderColor: "{surface.700}", - color: "{text.color}" - } - }, - list: { - option: { - focusBackground: "{surface.800}", - selectedBackground: "{highlight.background}", - selectedFocusBackground: "{highlight.focus.background}", - color: "{text.color}", - focusColor: "{text.hover.color}", - selectedColor: "{highlight.color}", - selectedFocusColor: "{highlight.focus.color}", - icon: { - color: "{surface.500}", - focusColor: "{surface.400}" - } - }, - optionGroup: { - background: "transparent", - color: "{text.muted.color}" - } - }, - navigation: { - item: { - focusBackground: "{surface.800}", - activeBackground: "{surface.800}", - color: "{text.color}", - focusColor: "{text.hover.color}", - activeColor: "{text.hover.color}", - icon: { - color: "{surface.500}", - focusColor: "{surface.400}", - activeColor: "{surface.400}" - } - }, - submenuLabel: { - background: "transparent", - color: "{text.muted.color}" - }, - submenuIcon: { - color: "{surface.500}", - focusColor: "{surface.400}", - activeColor: "{surface.400}" - } - } - } - } - } -}; -var index$1m = { - root: { - borderRadius: "{content.border.radius}" - } -}; -var index$1l = { - root: { - padding: "1rem", - background: "{content.background}", - gap: "0.5rem", - transitionDuration: "{transition.duration}" - }, - item: { - color: "{text.muted.color}", - hoverColor: "{text.color}", - borderRadius: "{content.border.radius}", - gap: "{navigation.item.gap}", - icon: { - color: "{navigation.item.icon.color}", - hoverColor: "{navigation.item.icon.focus.color}" - }, - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - separator: { - color: "{navigation.item.icon.color}" - } -}; -var index$1k = { - root: { - borderRadius: "{form.field.border.radius}", - roundedBorderRadius: "2rem", - gap: "0.5rem", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - iconOnlyWidth: "2.5rem", - sm: { - fontSize: "{form.field.sm.font.size}", - paddingX: "{form.field.sm.padding.x}", - paddingY: "{form.field.sm.padding.y}" - }, - lg: { - fontSize: "{form.field.lg.font.size}", - paddingX: "{form.field.lg.padding.x}", - paddingY: "{form.field.lg.padding.y}" - }, - label: { - fontWeight: "500" - }, - raisedShadow: "0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - offset: "{focus.ring.offset}" - }, - badgeSize: "1rem", - transitionDuration: "{form.field.transition.duration}" - }, - colorScheme: { - light: { - root: { - primary: { - background: "{primary.color}", - hoverBackground: "{primary.hover.color}", - activeBackground: "{primary.active.color}", - borderColor: "{primary.color}", - hoverBorderColor: "{primary.hover.color}", - activeBorderColor: "{primary.active.color}", - color: "{primary.contrast.color}", - hoverColor: "{primary.contrast.color}", - activeColor: "{primary.contrast.color}", - focusRing: { - color: "{primary.color}", - shadow: "none" - } - }, - secondary: { - background: "{surface.100}", - hoverBackground: "{surface.200}", - activeBackground: "{surface.300}", - borderColor: "{surface.100}", - hoverBorderColor: "{surface.200}", - activeBorderColor: "{surface.300}", - color: "{surface.600}", - hoverColor: "{surface.700}", - activeColor: "{surface.800}", - focusRing: { - color: "{surface.600}", - shadow: "none" - } - }, - info: { - background: "{sky.500}", - hoverBackground: "{sky.600}", - activeBackground: "{sky.700}", - borderColor: "{sky.500}", - hoverBorderColor: "{sky.600}", - activeBorderColor: "{sky.700}", - color: "#ffffff", - hoverColor: "#ffffff", - activeColor: "#ffffff", - focusRing: { - color: "{sky.500}", - shadow: "none" - } - }, - success: { - background: "{green.500}", - hoverBackground: "{green.600}", - activeBackground: "{green.700}", - borderColor: "{green.500}", - hoverBorderColor: "{green.600}", - activeBorderColor: "{green.700}", - color: "#ffffff", - hoverColor: "#ffffff", - activeColor: "#ffffff", - focusRing: { - color: "{green.500}", - shadow: "none" - } - }, - warn: { - background: "{orange.500}", - hoverBackground: "{orange.600}", - activeBackground: "{orange.700}", - borderColor: "{orange.500}", - hoverBorderColor: "{orange.600}", - activeBorderColor: "{orange.700}", - color: "#ffffff", - hoverColor: "#ffffff", - activeColor: "#ffffff", - focusRing: { - color: "{orange.500}", - shadow: "none" - } - }, - help: { - background: "{purple.500}", - hoverBackground: "{purple.600}", - activeBackground: "{purple.700}", - borderColor: "{purple.500}", - hoverBorderColor: "{purple.600}", - activeBorderColor: "{purple.700}", - color: "#ffffff", - hoverColor: "#ffffff", - activeColor: "#ffffff", - focusRing: { - color: "{purple.500}", - shadow: "none" - } - }, - danger: { - background: "{red.500}", - hoverBackground: "{red.600}", - activeBackground: "{red.700}", - borderColor: "{red.500}", - hoverBorderColor: "{red.600}", - activeBorderColor: "{red.700}", - color: "#ffffff", - hoverColor: "#ffffff", - activeColor: "#ffffff", - focusRing: { - color: "{red.500}", - shadow: "none" - } - }, - contrast: { - background: "{surface.950}", - hoverBackground: "{surface.900}", - activeBackground: "{surface.800}", - borderColor: "{surface.950}", - hoverBorderColor: "{surface.900}", - activeBorderColor: "{surface.800}", - color: "{surface.0}", - hoverColor: "{surface.0}", - activeColor: "{surface.0}", - focusRing: { - color: "{surface.950}", - shadow: "none" - } - } - }, - outlined: { - primary: { - hoverBackground: "{primary.50}", - activeBackground: "{primary.100}", - borderColor: "{primary.200}", - color: "{primary.color}" - }, - secondary: { - hoverBackground: "{surface.50}", - activeBackground: "{surface.100}", - borderColor: "{surface.200}", - color: "{surface.500}" - }, - success: { - hoverBackground: "{green.50}", - activeBackground: "{green.100}", - borderColor: "{green.200}", - color: "{green.500}" - }, - info: { - hoverBackground: "{sky.50}", - activeBackground: "{sky.100}", - borderColor: "{sky.200}", - color: "{sky.500}" - }, - warn: { - hoverBackground: "{orange.50}", - activeBackground: "{orange.100}", - borderColor: "{orange.200}", - color: "{orange.500}" - }, - help: { - hoverBackground: "{purple.50}", - activeBackground: "{purple.100}", - borderColor: "{purple.200}", - color: "{purple.500}" - }, - danger: { - hoverBackground: "{red.50}", - activeBackground: "{red.100}", - borderColor: "{red.200}", - color: "{red.500}" - }, - contrast: { - hoverBackground: "{surface.50}", - activeBackground: "{surface.100}", - borderColor: "{surface.700}", - color: "{surface.950}" - }, - plain: { - hoverBackground: "{surface.50}", - activeBackground: "{surface.100}", - borderColor: "{surface.200}", - color: "{surface.700}" - } - }, - text: { - primary: { - hoverBackground: "{primary.50}", - activeBackground: "{primary.100}", - color: "{primary.color}" - }, - secondary: { - hoverBackground: "{surface.50}", - activeBackground: "{surface.100}", - color: "{surface.500}" - }, - success: { - hoverBackground: "{green.50}", - activeBackground: "{green.100}", - color: "{green.500}" - }, - info: { - hoverBackground: "{sky.50}", - activeBackground: "{sky.100}", - color: "{sky.500}" - }, - warn: { - hoverBackground: "{orange.50}", - activeBackground: "{orange.100}", - color: "{orange.500}" - }, - help: { - hoverBackground: "{purple.50}", - activeBackground: "{purple.100}", - color: "{purple.500}" - }, - danger: { - hoverBackground: "{red.50}", - activeBackground: "{red.100}", - color: "{red.500}" - }, - contrast: { - hoverBackground: "{surface.50}", - activeBackground: "{surface.100}", - color: "{surface.950}" - }, - plain: { - hoverBackground: "{surface.50}", - activeBackground: "{surface.100}", - color: "{surface.700}" - } - }, - link: { - color: "{primary.color}", - hoverColor: "{primary.color}", - activeColor: "{primary.color}" - } - }, - dark: { - root: { - primary: { - background: "{primary.color}", - hoverBackground: "{primary.hover.color}", - activeBackground: "{primary.active.color}", - borderColor: "{primary.color}", - hoverBorderColor: "{primary.hover.color}", - activeBorderColor: "{primary.active.color}", - color: "{primary.contrast.color}", - hoverColor: "{primary.contrast.color}", - activeColor: "{primary.contrast.color}", - focusRing: { - color: "{primary.color}", - shadow: "none" - } - }, - secondary: { - background: "{surface.800}", - hoverBackground: "{surface.700}", - activeBackground: "{surface.600}", - borderColor: "{surface.800}", - hoverBorderColor: "{surface.700}", - activeBorderColor: "{surface.600}", - color: "{surface.300}", - hoverColor: "{surface.200}", - activeColor: "{surface.100}", - focusRing: { - color: "{surface.300}", - shadow: "none" - } - }, - info: { - background: "{sky.400}", - hoverBackground: "{sky.300}", - activeBackground: "{sky.200}", - borderColor: "{sky.400}", - hoverBorderColor: "{sky.300}", - activeBorderColor: "{sky.200}", - color: "{sky.950}", - hoverColor: "{sky.950}", - activeColor: "{sky.950}", - focusRing: { - color: "{sky.400}", - shadow: "none" - } - }, - success: { - background: "{green.400}", - hoverBackground: "{green.300}", - activeBackground: "{green.200}", - borderColor: "{green.400}", - hoverBorderColor: "{green.300}", - activeBorderColor: "{green.200}", - color: "{green.950}", - hoverColor: "{green.950}", - activeColor: "{green.950}", - focusRing: { - color: "{green.400}", - shadow: "none" - } - }, - warn: { - background: "{orange.400}", - hoverBackground: "{orange.300}", - activeBackground: "{orange.200}", - borderColor: "{orange.400}", - hoverBorderColor: "{orange.300}", - activeBorderColor: "{orange.200}", - color: "{orange.950}", - hoverColor: "{orange.950}", - activeColor: "{orange.950}", - focusRing: { - color: "{orange.400}", - shadow: "none" - } - }, - help: { - background: "{purple.400}", - hoverBackground: "{purple.300}", - activeBackground: "{purple.200}", - borderColor: "{purple.400}", - hoverBorderColor: "{purple.300}", - activeBorderColor: "{purple.200}", - color: "{purple.950}", - hoverColor: "{purple.950}", - activeColor: "{purple.950}", - focusRing: { - color: "{purple.400}", - shadow: "none" - } - }, - danger: { - background: "{red.400}", - hoverBackground: "{red.300}", - activeBackground: "{red.200}", - borderColor: "{red.400}", - hoverBorderColor: "{red.300}", - activeBorderColor: "{red.200}", - color: "{red.950}", - hoverColor: "{red.950}", - activeColor: "{red.950}", - focusRing: { - color: "{red.400}", - shadow: "none" - } - }, - contrast: { - background: "{surface.0}", - hoverBackground: "{surface.100}", - activeBackground: "{surface.200}", - borderColor: "{surface.0}", - hoverBorderColor: "{surface.100}", - activeBorderColor: "{surface.200}", - color: "{surface.950}", - hoverColor: "{surface.950}", - activeColor: "{surface.950}", - focusRing: { - color: "{surface.0}", - shadow: "none" - } - } - }, - outlined: { - primary: { - hoverBackground: "color-mix(in srgb, {primary.color}, transparent 96%)", - activeBackground: "color-mix(in srgb, {primary.color}, transparent 84%)", - borderColor: "{primary.700}", - color: "{primary.color}" - }, - secondary: { - hoverBackground: "rgba(255,255,255,0.04)", - activeBackground: "rgba(255,255,255,0.16)", - borderColor: "{surface.700}", - color: "{surface.400}" - }, - success: { - hoverBackground: "color-mix(in srgb, {green.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {green.400}, transparent 84%)", - borderColor: "{green.700}", - color: "{green.400}" - }, - info: { - hoverBackground: "color-mix(in srgb, {sky.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {sky.400}, transparent 84%)", - borderColor: "{sky.700}", - color: "{sky.400}" - }, - warn: { - hoverBackground: "color-mix(in srgb, {orange.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {orange.400}, transparent 84%)", - borderColor: "{orange.700}", - color: "{orange.400}" - }, - help: { - hoverBackground: "color-mix(in srgb, {purple.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {purple.400}, transparent 84%)", - borderColor: "{purple.700}", - color: "{purple.400}" - }, - danger: { - hoverBackground: "color-mix(in srgb, {red.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {red.400}, transparent 84%)", - borderColor: "{red.700}", - color: "{red.400}" - }, - contrast: { - hoverBackground: "{surface.800}", - activeBackground: "{surface.700}", - borderColor: "{surface.500}", - color: "{surface.0}" - }, - plain: { - hoverBackground: "{surface.800}", - activeBackground: "{surface.700}", - borderColor: "{surface.600}", - color: "{surface.0}" - } - }, - text: { - primary: { - hoverBackground: "color-mix(in srgb, {primary.color}, transparent 96%)", - activeBackground: "color-mix(in srgb, {primary.color}, transparent 84%)", - color: "{primary.color}" - }, - secondary: { - hoverBackground: "{surface.800}", - activeBackground: "{surface.700}", - color: "{surface.400}" - }, - success: { - hoverBackground: "color-mix(in srgb, {green.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {green.400}, transparent 84%)", - color: "{green.400}" - }, - info: { - hoverBackground: "color-mix(in srgb, {sky.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {sky.400}, transparent 84%)", - color: "{sky.400}" - }, - warn: { - hoverBackground: "color-mix(in srgb, {orange.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {orange.400}, transparent 84%)", - color: "{orange.400}" - }, - help: { - hoverBackground: "color-mix(in srgb, {purple.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {purple.400}, transparent 84%)", - color: "{purple.400}" - }, - danger: { - hoverBackground: "color-mix(in srgb, {red.400}, transparent 96%)", - activeBackground: "color-mix(in srgb, {red.400}, transparent 84%)", - color: "{red.400}" - }, - contrast: { - hoverBackground: "{surface.800}", - activeBackground: "{surface.700}", - color: "{surface.0}" - }, - plain: { - hoverBackground: "{surface.800}", - activeBackground: "{surface.700}", - color: "{surface.0}" - } - }, - link: { - color: "{primary.color}", - hoverColor: "{primary.color}", - activeColor: "{primary.color}" - } - } - } -}; -var index$1j = { - root: { - background: "{content.background}", - borderRadius: "{border.radius.xl}", - color: "{content.color}", - shadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)" - }, - body: { - padding: "1.25rem", - gap: "0.5rem" - }, - caption: { - gap: "0.5rem" - }, - title: { - fontSize: "1.25rem", - fontWeight: "500" - }, - subtitle: { - color: "{text.muted.color}" - } -}; -var index$1i = { - root: { - transitionDuration: "{transition.duration}" - }, - content: { - gap: "0.25rem" - }, - indicatorList: { - padding: "1rem", - gap: "0.5rem" - }, - indicator: { - width: "2rem", - height: "0.5rem", - borderRadius: "{content.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - colorScheme: { - light: { - indicator: { - background: "{surface.200}", - hoverBackground: "{surface.300}", - activeBackground: "{primary.color}" - } - }, - dark: { - indicator: { - background: "{surface.700}", - hoverBackground: "{surface.600}", - activeBackground: "{primary.color}" - } - } - } -}; -var index$1h = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledHoverBackground: "{form.field.filled.hover.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}", - sm: { - fontSize: "{form.field.sm.font.size}", - paddingX: "{form.field.sm.padding.x}", - paddingY: "{form.field.sm.padding.y}" - }, - lg: { - fontSize: "{form.field.lg.font.size}", - paddingX: "{form.field.lg.padding.x}", - paddingY: "{form.field.lg.padding.y}" - } - }, - dropdown: { - width: "2.5rem", - color: "{form.field.icon.color}" - }, - overlay: { - background: "{overlay.select.background}", - borderColor: "{overlay.select.border.color}", - borderRadius: "{overlay.select.border.radius}", - color: "{overlay.select.color}", - shadow: "{overlay.select.shadow}" - }, - list: { - padding: "{list.padding}", - gap: "{list.gap}", - mobileIndent: "1rem" - }, - option: { - focusBackground: "{list.option.focus.background}", - selectedBackground: "{list.option.selected.background}", - selectedFocusBackground: "{list.option.selected.focus.background}", - color: "{list.option.color}", - focusColor: "{list.option.focus.color}", - selectedColor: "{list.option.selected.color}", - selectedFocusColor: "{list.option.selected.focus.color}", - padding: "{list.option.padding}", - borderRadius: "{list.option.border.radius}", - icon: { - color: "{list.option.icon.color}", - focusColor: "{list.option.icon.focus.color}", - size: "0.875rem" - } - }, - clearIcon: { - color: "{form.field.icon.color}" - } -}; -var index$1g = { - root: { - borderRadius: "{border.radius.sm}", - width: "1.25rem", - height: "1.25rem", - background: "{form.field.background}", - checkedBackground: "{primary.color}", - checkedHoverBackground: "{primary.hover.color}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.border.color}", - checkedBorderColor: "{primary.color}", - checkedHoverBorderColor: "{primary.hover.color}", - checkedFocusBorderColor: "{primary.color}", - checkedDisabledBorderColor: "{form.field.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - shadow: "{form.field.shadow}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}", - sm: { - width: "1rem", - height: "1rem" - }, - lg: { - width: "1.5rem", - height: "1.5rem" - } - }, - icon: { - size: "0.875rem", - color: "{form.field.color}", - checkedColor: "{primary.contrast.color}", - checkedHoverColor: "{primary.contrast.color}", - disabledColor: "{form.field.disabled.color}", - sm: { - size: "0.75rem" - }, - lg: { - size: "1rem" - } - } -}; -var index$1f = { - root: { - borderRadius: "16px", - paddingX: "0.75rem", - paddingY: "0.5rem", - gap: "0.5rem", - transitionDuration: "{transition.duration}" - }, - image: { - width: "2rem", - height: "2rem" - }, - icon: { - size: "1rem" - }, - removeIcon: { - size: "1rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - } - }, - colorScheme: { - light: { - root: { - background: "{surface.100}", - color: "{surface.800}" - }, - icon: { - color: "{surface.800}" - }, - removeIcon: { - color: "{surface.800}" - } - }, - dark: { - root: { - background: "{surface.800}", - color: "{surface.0}" - }, - icon: { - color: "{surface.0}" - }, - removeIcon: { - color: "{surface.0}" - } - } - } -}; -var index$1e = { - root: { - transitionDuration: "{transition.duration}" - }, - preview: { - width: "1.5rem", - height: "1.5rem", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - panel: { - shadow: "{overlay.popover.shadow}", - borderRadius: "{overlay.popover.borderRadius}" - }, - colorScheme: { - light: { - panel: { - background: "{surface.800}", - borderColor: "{surface.900}" - }, - handle: { - color: "{surface.0}" - } - }, - dark: { - panel: { - background: "{surface.900}", - borderColor: "{surface.700}" - }, - handle: { - color: "{surface.0}" - } - } - } -}; -var index$1d = { - icon: { - size: "2rem", - color: "{overlay.modal.color}" - }, - content: { - gap: "1rem" - } -}; -var index$1c = { - root: { - background: "{overlay.popover.background}", - borderColor: "{overlay.popover.border.color}", - color: "{overlay.popover.color}", - borderRadius: "{overlay.popover.border.radius}", - shadow: "{overlay.popover.shadow}", - gutter: "10px", - arrowOffset: "1.25rem" - }, - content: { - padding: "{overlay.popover.padding}", - gap: "1rem" - }, - icon: { - size: "1.5rem", - color: "{overlay.popover.color}" - }, - footer: { - gap: "0.5rem", - padding: "0 {overlay.popover.padding} {overlay.popover.padding} {overlay.popover.padding}" - } -}; -var index$1b = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}", - shadow: "{overlay.navigation.shadow}", - transitionDuration: "{transition.duration}" - }, - list: { - padding: "{navigation.list.padding}", - gap: "{navigation.list.gap}" - }, - item: { - focusBackground: "{navigation.item.focus.background}", - activeBackground: "{navigation.item.active.background}", - color: "{navigation.item.color}", - focusColor: "{navigation.item.focus.color}", - activeColor: "{navigation.item.active.color}", - padding: "{navigation.item.padding}", - borderRadius: "{navigation.item.border.radius}", - gap: "{navigation.item.gap}", - icon: { - color: "{navigation.item.icon.color}", - focusColor: "{navigation.item.icon.focus.color}", - activeColor: "{navigation.item.icon.active.color}" - } - }, - submenu: { - mobileIndent: "1rem" - }, - submenuIcon: { - size: "{navigation.submenu.icon.size}", - color: "{navigation.submenu.icon.color}", - focusColor: "{navigation.submenu.icon.focus.color}", - activeColor: "{navigation.submenu.icon.active.color}" - }, - separator: { - borderColor: "{content.border.color}" - } -}; -var index$1a = { - root: { - transitionDuration: "{transition.duration}" - }, - header: { - background: "{content.background}", - borderColor: "{datatable.border.color}", - color: "{content.color}", - borderWidth: "0 0 1px 0", - padding: "0.75rem 1rem" - }, - headerCell: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - borderColor: "{datatable.border.color}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - selectedColor: "{highlight.color}", - gap: "0.5rem", - padding: "0.75rem 1rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - } - }, - columnTitle: { - fontWeight: "600" - }, - row: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - selectedColor: "{highlight.color}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - } - }, - bodyCell: { - borderColor: "{datatable.border.color}", - padding: "0.75rem 1rem" - }, - footerCell: { - background: "{content.background}", - borderColor: "{datatable.border.color}", - color: "{content.color}", - padding: "0.75rem 1rem" - }, - columnFooter: { - fontWeight: "600" - }, - footer: { - background: "{content.background}", - borderColor: "{datatable.border.color}", - color: "{content.color}", - borderWidth: "0 0 1px 0", - padding: "0.75rem 1rem" - }, - dropPoint: { - color: "{primary.color}" - }, - columnResizerWidth: "0.5rem", - resizeIndicator: { - width: "1px", - color: "{primary.color}" - }, - sortIcon: { - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}", - size: "0.875rem" - }, - loadingIcon: { - size: "2rem" - }, - rowToggleButton: { - hoverBackground: "{content.hover.background}", - selectedHoverBackground: "{content.background}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - selectedHoverColor: "{primary.color}", - size: "1.75rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - filter: { - inlineGap: "0.5rem", - overlaySelect: { - background: "{overlay.select.background}", - borderColor: "{overlay.select.border.color}", - borderRadius: "{overlay.select.border.radius}", - color: "{overlay.select.color}", - shadow: "{overlay.select.shadow}" - }, - overlayPopover: { - background: "{overlay.popover.background}", - borderColor: "{overlay.popover.border.color}", - borderRadius: "{overlay.popover.border.radius}", - color: "{overlay.popover.color}", - shadow: "{overlay.popover.shadow}", - padding: "{overlay.popover.padding}", - gap: "0.5rem" - }, - rule: { - borderColor: "{content.border.color}" - }, - constraintList: { - padding: "{list.padding}", - gap: "{list.gap}" - }, - constraint: { - focusBackground: "{list.option.focus.background}", - selectedBackground: "{list.option.selected.background}", - selectedFocusBackground: "{list.option.selected.focus.background}", - color: "{list.option.color}", - focusColor: "{list.option.focus.color}", - selectedColor: "{list.option.selected.color}", - selectedFocusColor: "{list.option.selected.focus.color}", - separator: { - borderColor: "{content.border.color}" - }, - padding: "{list.option.padding}", - borderRadius: "{list.option.border.radius}" - } - }, - paginatorTop: { - borderColor: "{datatable.border.color}", - borderWidth: "0 0 1px 0" - }, - paginatorBottom: { - borderColor: "{datatable.border.color}", - borderWidth: "0 0 1px 0" - }, - colorScheme: { - light: { - root: { - borderColor: "{content.border.color}" - }, - row: { - stripedBackground: "{surface.50}" - }, - bodyCell: { - selectedBorderColor: "{primary.100}" - } - }, - dark: { - root: { - borderColor: "{surface.800}" - }, - row: { - stripedBackground: "{surface.950}" - }, - bodyCell: { - selectedBorderColor: "{primary.900}" - } - } - } -}; -var index$19 = { - root: { - borderColor: "transparent", - borderWidth: "0", - borderRadius: "0", - padding: "0" - }, - header: { - background: "{content.background}", - color: "{content.color}", - borderColor: "{content.border.color}", - borderWidth: "0 0 1px 0", - padding: "0.75rem 1rem", - borderRadius: "0" - }, - content: { - background: "{content.background}", - color: "{content.color}", - borderColor: "transparent", - borderWidth: "0", - padding: "0", - borderRadius: "0" - }, - footer: { - background: "{content.background}", - color: "{content.color}", - borderColor: "{content.border.color}", - borderWidth: "1px 0 0 0", - padding: "0.75rem 1rem", - borderRadius: "0" - }, - paginatorTop: { - borderColor: "{content.border.color}", - borderWidth: "0 0 1px 0" - }, - paginatorBottom: { - borderColor: "{content.border.color}", - borderWidth: "1px 0 0 0" - } -}; -var index$18 = { - root: { - transitionDuration: "{transition.duration}" - }, - panel: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}", - shadow: "{overlay.popover.shadow}", - padding: "{overlay.popover.padding}" - }, - header: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - padding: "0 0 0.5rem 0" - }, - title: { - gap: "0.5rem", - fontWeight: "500" - }, - dropdown: { - width: "2.5rem", - sm: { - width: "2rem" - }, - lg: { - width: "3rem" - }, - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.border.color}", - activeBorderColor: "{form.field.border.color}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - inputIcon: { - color: "{form.field.icon.color}" - }, - selectMonth: { - hoverBackground: "{content.hover.background}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - padding: "0.25rem 0.5rem", - borderRadius: "{content.border.radius}" - }, - selectYear: { - hoverBackground: "{content.hover.background}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - padding: "0.25rem 0.5rem", - borderRadius: "{content.border.radius}" - }, - group: { - borderColor: "{content.border.color}", - gap: "{overlay.popover.padding}" - }, - dayView: { - margin: "0.5rem 0 0 0" - }, - weekDay: { - padding: "0.25rem", - fontWeight: "500", - color: "{content.color}" - }, - date: { - hoverBackground: "{content.hover.background}", - selectedBackground: "{primary.color}", - rangeSelectedBackground: "{highlight.background}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - selectedColor: "{primary.contrast.color}", - rangeSelectedColor: "{highlight.color}", - width: "2rem", - height: "2rem", - borderRadius: "50%", - padding: "0.25rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - monthView: { - margin: "0.5rem 0 0 0" - }, - month: { - padding: "0.375rem", - borderRadius: "{content.border.radius}" - }, - yearView: { - margin: "0.5rem 0 0 0" - }, - year: { - padding: "0.375rem", - borderRadius: "{content.border.radius}" - }, - buttonbar: { - padding: "0.5rem 0 0 0", - borderColor: "{content.border.color}" - }, - timePicker: { - padding: "0.5rem 0 0 0", - borderColor: "{content.border.color}", - gap: "0.5rem", - buttonGap: "0.25rem" - }, - colorScheme: { - light: { - dropdown: { - background: "{surface.100}", - hoverBackground: "{surface.200}", - activeBackground: "{surface.300}", - color: "{surface.600}", - hoverColor: "{surface.700}", - activeColor: "{surface.800}" - }, - today: { - background: "{surface.200}", - color: "{surface.900}" - } - }, - dark: { - dropdown: { - background: "{surface.800}", - hoverBackground: "{surface.700}", - activeBackground: "{surface.600}", - color: "{surface.300}", - hoverColor: "{surface.200}", - activeColor: "{surface.100}" - }, - today: { - background: "{surface.700}", - color: "{surface.0}" - } - } - } -}; -var index$17 = { - root: { - background: "{overlay.modal.background}", - borderColor: "{overlay.modal.border.color}", - color: "{overlay.modal.color}", - borderRadius: "{overlay.modal.border.radius}", - shadow: "{overlay.modal.shadow}" - }, - header: { - padding: "{overlay.modal.padding}", - gap: "0.5rem" - }, - title: { - fontSize: "1.25rem", - fontWeight: "600" - }, - content: { - padding: "0 {overlay.modal.padding} {overlay.modal.padding} {overlay.modal.padding}" - }, - footer: { - padding: "0 {overlay.modal.padding} {overlay.modal.padding} {overlay.modal.padding}", - gap: "0.5rem" - } -}; -var index$16 = { - root: { - borderColor: "{content.border.color}" - }, - content: { - background: "{content.background}", - color: "{text.color}" - }, - horizontal: { - margin: "1rem 0", - padding: "0 1rem", - content: { - padding: "0 0.5rem" - } - }, - vertical: { - margin: "0 1rem", - padding: "0.5rem 0", - content: { - padding: "0.5rem 0" - } - } -}; -var index$15 = { - root: { - background: "rgba(255, 255, 255, 0.1)", - borderColor: "rgba(255, 255, 255, 0.2)", - padding: "0.5rem", - borderRadius: "{border.radius.xl}" - }, - item: { - borderRadius: "{content.border.radius}", - padding: "0.5rem", - size: "3rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - } -}; -var index$14 = { - root: { - background: "{overlay.modal.background}", - borderColor: "{overlay.modal.border.color}", - color: "{overlay.modal.color}", - shadow: "{overlay.modal.shadow}" - }, - header: { - padding: "{overlay.modal.padding}" - }, - title: { - fontSize: "1.5rem", - fontWeight: "600" - }, - content: { - padding: "0 {overlay.modal.padding} {overlay.modal.padding} {overlay.modal.padding}" - }, - footer: { - padding: "{overlay.modal.padding}" - } -}; -var index$13 = { - toolbar: { - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}" - }, - toolbarItem: { - color: "{text.muted.color}", - hoverColor: "{text.color}", - activeColor: "{primary.color}" - }, - overlay: { - background: "{overlay.select.background}", - borderColor: "{overlay.select.border.color}", - borderRadius: "{overlay.select.border.radius}", - color: "{overlay.select.color}", - shadow: "{overlay.select.shadow}", - padding: "{list.padding}" - }, - overlayOption: { - focusBackground: "{list.option.focus.background}", - color: "{list.option.color}", - focusColor: "{list.option.focus.color}", - padding: "{list.option.padding}", - borderRadius: "{list.option.border.radius}" - }, - content: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}" - } -}; -var index$12 = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - color: "{content.color}", - padding: "0 1.125rem 1.125rem 1.125rem", - transitionDuration: "{transition.duration}" - }, - legend: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - borderRadius: "{content.border.radius}", - borderWidth: "1px", - borderColor: "transparent", - padding: "0.5rem 0.75rem", - gap: "0.5rem", - fontWeight: "600", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - toggleIcon: { - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}" - }, - content: { - padding: "0" - } -}; -var index$11 = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}", - transitionDuration: "{transition.duration}" - }, - header: { - background: "transparent", - color: "{text.color}", - padding: "1.125rem", - borderColor: "unset", - borderWidth: "0", - borderRadius: "0", - gap: "0.5rem" - }, - content: { - highlightBorderColor: "{primary.color}", - padding: "0 1.125rem 1.125rem 1.125rem", - gap: "1rem" - }, - file: { - padding: "1rem", - gap: "1rem", - borderColor: "{content.border.color}", - info: { - gap: "0.5rem" - } - }, - fileList: { - gap: "0.5rem" - }, - progressbar: { - height: "0.25rem" - }, - basic: { - gap: "0.5rem" - } -}; -var index$10 = { - root: { - color: "{form.field.float.label.color}", - focusColor: "{form.field.float.label.focus.color}", - activeColor: "{form.field.float.label.active.color}", - invalidColor: "{form.field.float.label.invalid.color}", - transitionDuration: "0.2s", - positionX: "{form.field.padding.x}", - positionY: "{form.field.padding.y}", - fontWeight: "500", - active: { - fontSize: "0.75rem", - fontWeight: "400" - } - }, - over: { - active: { - top: "-1.25rem" - } - }, - "in": { - input: { - paddingTop: "1.5rem", - paddingBottom: "{form.field.padding.y}" - }, - active: { - top: "{form.field.padding.y}" - } - }, - on: { - borderRadius: "{border.radius.xs}", - active: { - background: "{form.field.background}", - padding: "0 0.125rem" - } - } -}; -var index$$ = { - root: { - borderWidth: "1px", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - transitionDuration: "{transition.duration}" - }, - navButton: { - background: "rgba(255, 255, 255, 0.1)", - hoverBackground: "rgba(255, 255, 255, 0.2)", - color: "{surface.100}", - hoverColor: "{surface.0}", - size: "3rem", - gutter: "0.5rem", - prev: { - borderRadius: "50%" - }, - next: { - borderRadius: "50%" - }, - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - navIcon: { - size: "1.5rem" - }, - thumbnailsContent: { - background: "{content.background}", - padding: "1rem 0.25rem" - }, - thumbnailNavButton: { - size: "2rem", - borderRadius: "{content.border.radius}", - gutter: "0.5rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - thumbnailNavButtonIcon: { - size: "1rem" - }, - caption: { - background: "rgba(0, 0, 0, 0.5)", - color: "{surface.100}", - padding: "1rem" - }, - indicatorList: { - gap: "0.5rem", - padding: "1rem" - }, - indicatorButton: { - width: "1rem", - height: "1rem", - activeBackground: "{primary.color}", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - insetIndicatorList: { - background: "rgba(0, 0, 0, 0.5)" - }, - insetIndicatorButton: { - background: "rgba(255, 255, 255, 0.4)", - hoverBackground: "rgba(255, 255, 255, 0.6)", - activeBackground: "rgba(255, 255, 255, 0.9)" - }, - closeButton: { - size: "3rem", - gutter: "0.5rem", - background: "rgba(255, 255, 255, 0.1)", - hoverBackground: "rgba(255, 255, 255, 0.2)", - color: "{surface.50}", - hoverColor: "{surface.0}", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - closeButtonIcon: { - size: "1.5rem" - }, - colorScheme: { - light: { - thumbnailNavButton: { - hoverBackground: "{surface.100}", - color: "{surface.600}", - hoverColor: "{surface.700}" - }, - indicatorButton: { - background: "{surface.200}", - hoverBackground: "{surface.300}" - } - }, - dark: { - thumbnailNavButton: { - hoverBackground: "{surface.700}", - color: "{surface.400}", - hoverColor: "{surface.0}" - }, - indicatorButton: { - background: "{surface.700}", - hoverBackground: "{surface.600}" - } - } - } -}; -var index$_ = { - icon: { - color: "{form.field.icon.color}" - } -}; -var index$Z = { - root: { - color: "{form.field.float.label.color}", - focusColor: "{form.field.float.label.focus.color}", - invalidColor: "{form.field.float.label.invalid.color}", - transitionDuration: "0.2s", - positionX: "{form.field.padding.x}", - top: "{form.field.padding.y}", - fontSize: "0.75rem", - fontWeight: "400" - }, - input: { - paddingTop: "1.5rem", - paddingBottom: "{form.field.padding.y}" - } -}; -var index$Y = { - root: { - transitionDuration: "{transition.duration}" - }, - preview: { - icon: { - size: "1.5rem" - }, - mask: { - background: "{mask.background}", - color: "{mask.color}" - } - }, - toolbar: { - position: { - left: "auto", - right: "1rem", - top: "1rem", - bottom: "auto" - }, - blur: "8px", - background: "rgba(255,255,255,0.1)", - borderColor: "rgba(255,255,255,0.2)", - borderWidth: "1px", - borderRadius: "30px", - padding: ".5rem", - gap: "0.5rem" - }, - action: { - hoverBackground: "rgba(255,255,255,0.1)", - color: "{surface.50}", - hoverColor: "{surface.0}", - size: "3rem", - iconSize: "1.5rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - } -}; -var index$X = { - handle: { - size: "15px", - hoverSize: "30px", - background: "rgba(255,255,255,0.3)", - hoverBackground: "rgba(255,255,255,0.3)", - borderColor: "unset", - hoverBorderColor: "unset", - borderWidth: "0", - borderRadius: "50%", - transitionDuration: "{transition.duration}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "rgba(255,255,255,0.3)", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - } -}; -var index$W = { - root: { - padding: "{form.field.padding.y} {form.field.padding.x}", - borderRadius: "{content.border.radius}", - gap: "0.5rem" - }, - text: { - fontWeight: "500" - }, - icon: { - size: "1rem" - }, - colorScheme: { - light: { - info: { - background: "color-mix(in srgb, {blue.50}, transparent 5%)", - borderColor: "{blue.200}", - color: "{blue.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)" - }, - success: { - background: "color-mix(in srgb, {green.50}, transparent 5%)", - borderColor: "{green.200}", - color: "{green.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)" - }, - warn: { - background: "color-mix(in srgb,{yellow.50}, transparent 5%)", - borderColor: "{yellow.200}", - color: "{yellow.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)" - }, - error: { - background: "color-mix(in srgb, {red.50}, transparent 5%)", - borderColor: "{red.200}", - color: "{red.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)" - }, - secondary: { - background: "{surface.100}", - borderColor: "{surface.200}", - color: "{surface.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)" - }, - contrast: { - background: "{surface.900}", - borderColor: "{surface.950}", - color: "{surface.50}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)" - } - }, - dark: { - info: { - background: "color-mix(in srgb, {blue.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {blue.700}, transparent 64%)", - color: "{blue.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)" - }, - success: { - background: "color-mix(in srgb, {green.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {green.700}, transparent 64%)", - color: "{green.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)" - }, - warn: { - background: "color-mix(in srgb, {yellow.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {yellow.700}, transparent 64%)", - color: "{yellow.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)" - }, - error: { - background: "color-mix(in srgb, {red.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {red.700}, transparent 64%)", - color: "{red.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)" - }, - secondary: { - background: "{surface.800}", - borderColor: "{surface.700}", - color: "{surface.300}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)" - }, - contrast: { - background: "{surface.0}", - borderColor: "{surface.100}", - color: "{surface.950}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)" - } - } - } -}; -var index$V = { - root: { - padding: "{form.field.padding.y} {form.field.padding.x}", - borderRadius: "{content.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - transitionDuration: "{transition.duration}" - }, - display: { - hoverBackground: "{content.hover.background}", - hoverColor: "{content.hover.color}" - } -}; -var index$U = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}" - }, - chip: { - borderRadius: "{border.radius.sm}" - }, - colorScheme: { - light: { - chip: { - focusBackground: "{surface.200}", - color: "{surface.800}" - } - }, - dark: { - chip: { - focusBackground: "{surface.700}", - color: "{surface.0}" - } - } - } -}; -var index$T = { - addon: { - background: "{form.field.background}", - borderColor: "{form.field.border.color}", - color: "{form.field.icon.color}", - borderRadius: "{form.field.border.radius}", - padding: "0.5rem", - minWidth: "2.5rem" - } -}; -var index$S = { - root: { - transitionDuration: "{transition.duration}" - }, - button: { - width: "2.5rem", - borderRadius: "{form.field.border.radius}", - verticalPadding: "{form.field.padding.y}" - }, - colorScheme: { - light: { - button: { - background: "transparent", - hoverBackground: "{surface.100}", - activeBackground: "{surface.200}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.border.color}", - activeBorderColor: "{form.field.border.color}", - color: "{surface.400}", - hoverColor: "{surface.500}", - activeColor: "{surface.600}" - } - }, - dark: { - button: { - background: "transparent", - hoverBackground: "{surface.800}", - activeBackground: "{surface.700}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.border.color}", - activeBorderColor: "{form.field.border.color}", - color: "{surface.400}", - hoverColor: "{surface.300}", - activeColor: "{surface.200}" - } - } - } -}; -var index$R = { - root: { - gap: "0.5rem" - }, - input: { - width: "2.5rem", - sm: { - width: "2rem" - }, - lg: { - width: "3rem" - } - } -}; -var index$Q = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledHoverBackground: "{form.field.filled.hover.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}", - sm: { - fontSize: "{form.field.sm.font.size}", - paddingX: "{form.field.sm.padding.x}", - paddingY: "{form.field.sm.padding.y}" - }, - lg: { - fontSize: "{form.field.lg.font.size}", - paddingX: "{form.field.lg.padding.x}", - paddingY: "{form.field.lg.padding.y}" - } - } -}; -var index$P = { - root: { - transitionDuration: "{transition.duration}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - value: { - background: "{primary.color}" - }, - range: { - background: "{content.border.color}" - }, - text: { - color: "{text.muted.color}" - } -}; -var index$O = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - borderColor: "{form.field.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - shadow: "{form.field.shadow}", - borderRadius: "{form.field.border.radius}", - transitionDuration: "{form.field.transition.duration}" - }, - list: { - padding: "{list.padding}", - gap: "{list.gap}", - header: { - padding: "{list.header.padding}" - } - }, - option: { - focusBackground: "{list.option.focus.background}", - selectedBackground: "{list.option.selected.background}", - selectedFocusBackground: "{list.option.selected.focus.background}", - color: "{list.option.color}", - focusColor: "{list.option.focus.color}", - selectedColor: "{list.option.selected.color}", - selectedFocusColor: "{list.option.selected.focus.color}", - padding: "{list.option.padding}", - borderRadius: "{list.option.border.radius}" - }, - optionGroup: { - background: "{list.option.group.background}", - color: "{list.option.group.color}", - fontWeight: "{list.option.group.font.weight}", - padding: "{list.option.group.padding}" - }, - checkmark: { - color: "{list.option.color}", - gutterStart: "-0.375rem", - gutterEnd: "0.375rem" - }, - emptyMessage: { - padding: "{list.option.padding}" - }, - colorScheme: { - light: { - option: { - stripedBackground: "{surface.50}" - } - }, - dark: { - option: { - stripedBackground: "{surface.900}" - } - } - } -}; -var index$N = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - color: "{content.color}", - gap: "0.5rem", - verticalOrientation: { - padding: "{navigation.list.padding}", - gap: "{navigation.list.gap}" - }, - horizontalOrientation: { - padding: "0.5rem 0.75rem", - gap: "0.5rem" - }, - transitionDuration: "{transition.duration}" - }, - baseItem: { - borderRadius: "{content.border.radius}", - padding: "{navigation.item.padding}" - }, - item: { - focusBackground: "{navigation.item.focus.background}", - activeBackground: "{navigation.item.active.background}", - color: "{navigation.item.color}", - focusColor: "{navigation.item.focus.color}", - activeColor: "{navigation.item.active.color}", - padding: "{navigation.item.padding}", - borderRadius: "{navigation.item.border.radius}", - gap: "{navigation.item.gap}", - icon: { - color: "{navigation.item.icon.color}", - focusColor: "{navigation.item.icon.focus.color}", - activeColor: "{navigation.item.icon.active.color}" - } - }, - overlay: { - padding: "0", - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - color: "{content.color}", - shadow: "{overlay.navigation.shadow}", - gap: "0.5rem" - }, - submenu: { - padding: "{navigation.list.padding}", - gap: "{navigation.list.gap}" - }, - submenuLabel: { - padding: "{navigation.submenu.label.padding}", - fontWeight: "{navigation.submenu.label.font.weight}", - background: "{navigation.submenu.label.background.}", - color: "{navigation.submenu.label.color}" - }, - submenuIcon: { - size: "{navigation.submenu.icon.size}", - color: "{navigation.submenu.icon.color}", - focusColor: "{navigation.submenu.icon.focus.color}", - activeColor: "{navigation.submenu.icon.active.color}" - }, - separator: { - borderColor: "{content.border.color}" - }, - mobileButton: { - borderRadius: "50%", - size: "1.75rem", - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}", - hoverBackground: "{content.hover.background}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - } -}; -var index$M = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}", - shadow: "{overlay.navigation.shadow}", - transitionDuration: "{transition.duration}" - }, - list: { - padding: "{navigation.list.padding}", - gap: "{navigation.list.gap}" - }, - item: { - focusBackground: "{navigation.item.focus.background}", - color: "{navigation.item.color}", - focusColor: "{navigation.item.focus.color}", - padding: "{navigation.item.padding}", - borderRadius: "{navigation.item.border.radius}", - gap: "{navigation.item.gap}", - icon: { - color: "{navigation.item.icon.color}", - focusColor: "{navigation.item.icon.focus.color}" - } - }, - submenuLabel: { - padding: "{navigation.submenu.label.padding}", - fontWeight: "{navigation.submenu.label.font.weight}", - background: "{navigation.submenu.label.background}", - color: "{navigation.submenu.label.color}" - }, - separator: { - borderColor: "{content.border.color}" - } -}; -var index$L = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - color: "{content.color}", - gap: "0.5rem", - padding: "0.5rem 0.75rem", - transitionDuration: "{transition.duration}" - }, - baseItem: { - borderRadius: "{content.border.radius}", - padding: "{navigation.item.padding}" - }, - item: { - focusBackground: "{navigation.item.focus.background}", - activeBackground: "{navigation.item.active.background}", - color: "{navigation.item.color}", - focusColor: "{navigation.item.focus.color}", - activeColor: "{navigation.item.active.color}", - padding: "{navigation.item.padding}", - borderRadius: "{navigation.item.border.radius}", - gap: "{navigation.item.gap}", - icon: { - color: "{navigation.item.icon.color}", - focusColor: "{navigation.item.icon.focus.color}", - activeColor: "{navigation.item.icon.active.color}" - } - }, - submenu: { - padding: "{navigation.list.padding}", - gap: "{navigation.list.gap}", - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - shadow: "{overlay.navigation.shadow}", - mobileIndent: "1rem", - icon: { - size: "{navigation.submenu.icon.size}", - color: "{navigation.submenu.icon.color}", - focusColor: "{navigation.submenu.icon.focus.color}", - activeColor: "{navigation.submenu.icon.active.color}" - } - }, - separator: { - borderColor: "{content.border.color}" - }, - mobileButton: { - borderRadius: "50%", - size: "1.75rem", - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}", - hoverBackground: "{content.hover.background}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - } -}; -var index$K = { - root: { - borderRadius: "{content.border.radius}", - borderWidth: "1px", - transitionDuration: "{transition.duration}" - }, - content: { - padding: "0.5rem 0.75rem", - gap: "0.5rem", - sm: { - padding: "0.375rem 0.625rem" - }, - lg: { - padding: "0.625rem 0.875rem" - } - }, - text: { - fontSize: "1rem", - fontWeight: "500", - sm: { - fontSize: "0.875rem" - }, - lg: { - fontSize: "1.125rem" - } - }, - icon: { - size: "1.125rem", - sm: { - size: "1rem" - }, - lg: { - size: "1.25rem" - } - }, - closeButton: { - width: "1.75rem", - height: "1.75rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - offset: "{focus.ring.offset}" - } - }, - closeIcon: { - size: "1rem", - sm: { - size: "0.875rem" - }, - lg: { - size: "1.125rem" - } - }, - outlined: { - root: { - borderWidth: "1px" - } - }, - simple: { - content: { - padding: "0" - } - }, - colorScheme: { - light: { - info: { - background: "color-mix(in srgb, {blue.50}, transparent 5%)", - borderColor: "{blue.200}", - color: "{blue.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)", - closeButton: { - hoverBackground: "{blue.100}", - focusRing: { - color: "{blue.600}", - shadow: "none" - } - }, - outlined: { - color: "{blue.600}", - borderColor: "{blue.600}" - }, - simple: { - color: "{blue.600}" - } - }, - success: { - background: "color-mix(in srgb, {green.50}, transparent 5%)", - borderColor: "{green.200}", - color: "{green.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)", - closeButton: { - hoverBackground: "{green.100}", - focusRing: { - color: "{green.600}", - shadow: "none" - } - }, - outlined: { - color: "{green.600}", - borderColor: "{green.600}" - }, - simple: { - color: "{green.600}" - } - }, - warn: { - background: "color-mix(in srgb,{yellow.50}, transparent 5%)", - borderColor: "{yellow.200}", - color: "{yellow.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)", - closeButton: { - hoverBackground: "{yellow.100}", - focusRing: { - color: "{yellow.600}", - shadow: "none" - } - }, - outlined: { - color: "{yellow.600}", - borderColor: "{yellow.600}" - }, - simple: { - color: "{yellow.600}" - } - }, - error: { - background: "color-mix(in srgb, {red.50}, transparent 5%)", - borderColor: "{red.200}", - color: "{red.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)", - closeButton: { - hoverBackground: "{red.100}", - focusRing: { - color: "{red.600}", - shadow: "none" - } - }, - outlined: { - color: "{red.600}", - borderColor: "{red.600}" - }, - simple: { - color: "{red.600}" - } - }, - secondary: { - background: "{surface.100}", - borderColor: "{surface.200}", - color: "{surface.600}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.200}", - focusRing: { - color: "{surface.600}", - shadow: "none" - } - }, - outlined: { - color: "{surface.500}", - borderColor: "{surface.500}" - }, - simple: { - color: "{surface.500}" - } - }, - contrast: { - background: "{surface.900}", - borderColor: "{surface.950}", - color: "{surface.50}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.800}", - focusRing: { - color: "{surface.50}", - shadow: "none" - } - }, - outlined: { - color: "{surface.950}", - borderColor: "{surface.950}" - }, - simple: { - color: "{surface.950}" - } - } - }, - dark: { - info: { - background: "color-mix(in srgb, {blue.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {blue.700}, transparent 64%)", - color: "{blue.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{blue.500}", - shadow: "none" - } - }, - outlined: { - color: "{blue.500}", - borderColor: "{blue.500}" - }, - simple: { - color: "{blue.500}" - } - }, - success: { - background: "color-mix(in srgb, {green.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {green.700}, transparent 64%)", - color: "{green.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{green.500}", - shadow: "none" - } - }, - outlined: { - color: "{green.500}", - borderColor: "{green.500}" - }, - simple: { - color: "{green.500}" - } - }, - warn: { - background: "color-mix(in srgb, {yellow.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {yellow.700}, transparent 64%)", - color: "{yellow.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{yellow.500}", - shadow: "none" - } - }, - outlined: { - color: "{yellow.500}", - borderColor: "{yellow.500}" - }, - simple: { - color: "{yellow.500}" - } - }, - error: { - background: "color-mix(in srgb, {red.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {red.700}, transparent 64%)", - color: "{red.500}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{red.500}", - shadow: "none" - } - }, - outlined: { - color: "{red.500}", - borderColor: "{red.500}" - }, - simple: { - color: "{red.500}" - } - }, - secondary: { - background: "{surface.800}", - borderColor: "{surface.700}", - color: "{surface.300}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.700}", - focusRing: { - color: "{surface.300}", - shadow: "none" - } - }, - outlined: { - color: "{surface.400}", - borderColor: "{surface.400}" - }, - simple: { - color: "{surface.400}" - } - }, - contrast: { - background: "{surface.0}", - borderColor: "{surface.100}", - color: "{surface.950}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.100}", - focusRing: { - color: "{surface.950}", - shadow: "none" - } - }, - outlined: { - color: "{surface.0}", - borderColor: "{surface.0}" - }, - simple: { - color: "{surface.0}" - } - } - } - } -}; -var index$J = { - root: { - borderRadius: "{content.border.radius}", - gap: "1rem" - }, - meters: { - background: "{content.border.color}", - size: "0.5rem" - }, - label: { - gap: "0.5rem" - }, - labelMarker: { - size: "0.5rem" - }, - labelIcon: { - size: "1rem" - }, - labelList: { - verticalGap: "0.5rem", - horizontalGap: "1rem" - } -}; -var index$I = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledHoverBackground: "{form.field.filled.hover.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}", - sm: { - fontSize: "{form.field.sm.font.size}", - paddingX: "{form.field.sm.padding.x}", - paddingY: "{form.field.sm.padding.y}" - }, - lg: { - fontSize: "{form.field.lg.font.size}", - paddingX: "{form.field.lg.padding.x}", - paddingY: "{form.field.lg.padding.y}" - } - }, - dropdown: { - width: "2.5rem", - color: "{form.field.icon.color}" - }, - overlay: { - background: "{overlay.select.background}", - borderColor: "{overlay.select.border.color}", - borderRadius: "{overlay.select.border.radius}", - color: "{overlay.select.color}", - shadow: "{overlay.select.shadow}" - }, - list: { - padding: "{list.padding}", - gap: "{list.gap}", - header: { - padding: "{list.header.padding}" - } - }, - option: { - focusBackground: "{list.option.focus.background}", - selectedBackground: "{list.option.selected.background}", - selectedFocusBackground: "{list.option.selected.focus.background}", - color: "{list.option.color}", - focusColor: "{list.option.focus.color}", - selectedColor: "{list.option.selected.color}", - selectedFocusColor: "{list.option.selected.focus.color}", - padding: "{list.option.padding}", - borderRadius: "{list.option.border.radius}", - gap: "0.5rem" - }, - optionGroup: { - background: "{list.option.group.background}", - color: "{list.option.group.color}", - fontWeight: "{list.option.group.font.weight}", - padding: "{list.option.group.padding}" - }, - clearIcon: { - color: "{form.field.icon.color}" - }, - chip: { - borderRadius: "{border.radius.sm}" - }, - emptyMessage: { - padding: "{list.option.padding}" - } -}; -var index$H = { - root: { - gap: "1.125rem" - }, - controls: { - gap: "0.5rem" - } -}; -var index$G = { - root: { - gutter: "0.75rem", - transitionDuration: "{transition.duration}" - }, - node: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - selectedColor: "{highlight.color}", - hoverColor: "{content.hover.color}", - padding: "0.75rem 1rem", - toggleablePadding: "0.75rem 1rem 1.25rem 1rem", - borderRadius: "{content.border.radius}" - }, - nodeToggleButton: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - borderColor: "{content.border.color}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - size: "1.5rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - connector: { - color: "{content.border.color}", - borderRadius: "{content.border.radius}", - height: "24px" - } -}; -var index$F = { - root: { - outline: { - width: "2px", - color: "{content.background}" - } - } -}; -var index$E = { - root: { - padding: "0.5rem 1rem", - gap: "0.25rem", - borderRadius: "{content.border.radius}", - background: "{content.background}", - color: "{content.color}", - transitionDuration: "{transition.duration}" - }, - navButton: { - background: "transparent", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}", - selectedColor: "{highlight.color}", - width: "2.5rem", - height: "2.5rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - currentPageReport: { - color: "{text.muted.color}" - }, - jumpToPageInput: { - maxWidth: "2.5rem" - } -}; -var index$D = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}" - }, - header: { - background: "transparent", - color: "{text.color}", - padding: "1.125rem", - borderColor: "{content.border.color}", - borderWidth: "0", - borderRadius: "0" - }, - toggleableHeader: { - padding: "0.375rem 1.125rem" - }, - title: { - fontWeight: "600" - }, - content: { - padding: "0 1.125rem 1.125rem 1.125rem" - }, - footer: { - padding: "0 1.125rem 1.125rem 1.125rem" - } -}; -var index$C = { - root: { - gap: "0.5rem", - transitionDuration: "{transition.duration}" - }, - panel: { - background: "{content.background}", - borderColor: "{content.border.color}", - borderWidth: "1px", - color: "{content.color}", - padding: "0.25rem 0.25rem", - borderRadius: "{content.border.radius}", - first: { - borderWidth: "1px", - topBorderRadius: "{content.border.radius}" - }, - last: { - borderWidth: "1px", - bottomBorderRadius: "{content.border.radius}" - } - }, - item: { - focusBackground: "{navigation.item.focus.background}", - color: "{navigation.item.color}", - focusColor: "{navigation.item.focus.color}", - gap: "0.5rem", - padding: "{navigation.item.padding}", - borderRadius: "{content.border.radius}", - icon: { - color: "{navigation.item.icon.color}", - focusColor: "{navigation.item.icon.focus.color}" - } - }, - submenu: { - indent: "1rem" - }, - submenuIcon: { - color: "{navigation.submenu.icon.color}", - focusColor: "{navigation.submenu.icon.focus.color}" - } -}; -var index$B = { - meter: { - background: "{content.border.color}", - borderRadius: "{content.border.radius}", - height: ".75rem" - }, - icon: { - color: "{form.field.icon.color}" - }, - overlay: { - background: "{overlay.popover.background}", - borderColor: "{overlay.popover.border.color}", - borderRadius: "{overlay.popover.border.radius}", - color: "{overlay.popover.color}", - padding: "{overlay.popover.padding}", - shadow: "{overlay.popover.shadow}" - }, - content: { - gap: "0.5rem" - }, - colorScheme: { - light: { - strength: { - weakBackground: "{red.500}", - mediumBackground: "{amber.500}", - strongBackground: "{green.500}" - } - }, - dark: { - strength: { - weakBackground: "{red.400}", - mediumBackground: "{amber.400}", - strongBackground: "{green.400}" - } - } - } -}; -var index$A = { - root: { - gap: "1.125rem" - }, - controls: { - gap: "0.5rem" - } -}; -var index$z = { - root: { - background: "{overlay.popover.background}", - borderColor: "{overlay.popover.border.color}", - color: "{overlay.popover.color}", - borderRadius: "{overlay.popover.border.radius}", - shadow: "{overlay.popover.shadow}", - gutter: "10px", - arrowOffset: "1.25rem" - }, - content: { - padding: "{overlay.popover.padding}" - } -}; -var index$y = { - root: { - background: "{content.border.color}", - borderRadius: "{content.border.radius}", - height: "1.25rem" - }, - value: { - background: "{primary.color}" - }, - label: { - color: "{primary.contrast.color}", - fontSize: "0.75rem", - fontWeight: "600" - } -}; -var index$x = { - colorScheme: { - light: { - root: { - "color.1": "{red.500}", - "color.2": "{blue.500}", - "color.3": "{green.500}", - "color.4": "{yellow.500}" - } - }, - dark: { - root: { - "color.1": "{red.400}", - "color.2": "{blue.400}", - "color.3": "{green.400}", - "color.4": "{yellow.400}" - } - } - } -}; -var index$w = { - root: { - width: "1.25rem", - height: "1.25rem", - background: "{form.field.background}", - checkedBackground: "{primary.color}", - checkedHoverBackground: "{primary.hover.color}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.border.color}", - checkedBorderColor: "{primary.color}", - checkedHoverBorderColor: "{primary.hover.color}", - checkedFocusBorderColor: "{primary.color}", - checkedDisabledBorderColor: "{form.field.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - shadow: "{form.field.shadow}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}", - sm: { - width: "1rem", - height: "1rem" - }, - lg: { - width: "1.5rem", - height: "1.5rem" - } - }, - icon: { - size: "0.75rem", - checkedColor: "{primary.contrast.color}", - checkedHoverColor: "{primary.contrast.color}", - disabledColor: "{form.field.disabled.color}", - sm: { - size: "0.5rem" - }, - lg: { - size: "1rem" - } - } -}; -var index$v = { - root: { - gap: "0.25rem", - transitionDuration: "{transition.duration}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - icon: { - size: "1rem", - color: "{text.muted.color}", - hoverColor: "{primary.color}", - activeColor: "{primary.color}" - } -}; -var index$u = { - colorScheme: { - light: { - root: { - background: "rgba(0,0,0,0.1)" - } - }, - dark: { - root: { - background: "rgba(255,255,255,0.3)" - } - } - } -}; -var index$t = { - root: { - transitionDuration: "{transition.duration}" - }, - bar: { - size: "9px", - borderRadius: "{border.radius.sm}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - colorScheme: { - light: { - bar: { - background: "{surface.100}" - } - }, - dark: { - bar: { - background: "{surface.800}" - } - } - } -}; -var index$s = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledHoverBackground: "{form.field.filled.hover.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}", - sm: { - fontSize: "{form.field.sm.font.size}", - paddingX: "{form.field.sm.padding.x}", - paddingY: "{form.field.sm.padding.y}" - }, - lg: { - fontSize: "{form.field.lg.font.size}", - paddingX: "{form.field.lg.padding.x}", - paddingY: "{form.field.lg.padding.y}" - } - }, - dropdown: { - width: "2.5rem", - color: "{form.field.icon.color}" - }, - overlay: { - background: "{overlay.select.background}", - borderColor: "{overlay.select.border.color}", - borderRadius: "{overlay.select.border.radius}", - color: "{overlay.select.color}", - shadow: "{overlay.select.shadow}" - }, - list: { - padding: "{list.padding}", - gap: "{list.gap}", - header: { - padding: "{list.header.padding}" - } - }, - option: { - focusBackground: "{list.option.focus.background}", - selectedBackground: "{list.option.selected.background}", - selectedFocusBackground: "{list.option.selected.focus.background}", - color: "{list.option.color}", - focusColor: "{list.option.focus.color}", - selectedColor: "{list.option.selected.color}", - selectedFocusColor: "{list.option.selected.focus.color}", - padding: "{list.option.padding}", - borderRadius: "{list.option.border.radius}" - }, - optionGroup: { - background: "{list.option.group.background}", - color: "{list.option.group.color}", - fontWeight: "{list.option.group.font.weight}", - padding: "{list.option.group.padding}" - }, - clearIcon: { - color: "{form.field.icon.color}" - }, - checkmark: { - color: "{list.option.color}", - gutterStart: "-0.375rem", - gutterEnd: "0.375rem" - }, - emptyMessage: { - padding: "{list.option.padding}" - } -}; -var index$r = { - root: { - borderRadius: "{form.field.border.radius}" - }, - colorScheme: { - light: { - root: { - invalidBorderColor: "{form.field.invalid.border.color}" - } - }, - dark: { - root: { - invalidBorderColor: "{form.field.invalid.border.color}" - } - } - } -}; -var index$q = { - root: { - borderRadius: "{content.border.radius}" - }, - colorScheme: { - light: { - root: { - background: "{surface.200}", - animationBackground: "rgba(255,255,255,0.4)" - } - }, - dark: { - root: { - background: "rgba(255, 255, 255, 0.06)", - animationBackground: "rgba(255, 255, 255, 0.04)" - } - } - } -}; -var index$p = { - root: { - transitionDuration: "{transition.duration}" - }, - track: { - background: "{content.border.color}", - borderRadius: "{content.border.radius}", - size: "3px" - }, - range: { - background: "{primary.color}" - }, - handle: { - width: "20px", - height: "20px", - borderRadius: "50%", - background: "{content.border.color}", - hoverBackground: "{content.border.color}", - content: { - borderRadius: "50%", - hoverBackground: "{content.background}", - width: "16px", - height: "16px", - shadow: "0px 0.5px 0px 0px rgba(0, 0, 0, 0.08), 0px 1px 1px 0px rgba(0, 0, 0, 0.14)" - }, - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - colorScheme: { - light: { - handle: { - contentBackground: "{surface.0}" - } - }, - dark: { - handle: { - contentBackground: "{surface.950}" - } - } - } -}; -var index$o = { - root: { - gap: "0.5rem", - transitionDuration: "{transition.duration}" - } -}; -var index$n = { - root: { - borderRadius: "{form.field.border.radius}", - roundedBorderRadius: "2rem", - raisedShadow: "0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)" - } -}; -var index$m = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - transitionDuration: "{transition.duration}" - }, - gutter: { - background: "{content.border.color}" - }, - handle: { - size: "24px", - background: "transparent", - borderRadius: "{content.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - } -}; -var index$l = { - root: { - transitionDuration: "{transition.duration}" - }, - separator: { - background: "{content.border.color}", - activeBackground: "{primary.color}", - margin: "0 0 0 1.625rem", - size: "2px" - }, - step: { - padding: "0.5rem", - gap: "1rem" - }, - stepHeader: { - padding: "0", - borderRadius: "{content.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - gap: "0.5rem" - }, - stepTitle: { - color: "{text.muted.color}", - activeColor: "{primary.color}", - fontWeight: "500" - }, - stepNumber: { - background: "{content.background}", - activeBackground: "{content.background}", - borderColor: "{content.border.color}", - activeBorderColor: "{content.border.color}", - color: "{text.muted.color}", - activeColor: "{primary.color}", - size: "2rem", - fontSize: "1.143rem", - fontWeight: "500", - borderRadius: "50%", - shadow: "0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12)" - }, - steppanels: { - padding: "0.875rem 0.5rem 1.125rem 0.5rem" - }, - steppanel: { - background: "{content.background}", - color: "{content.color}", - padding: "0", - indent: "1rem" - } -}; -var index$k = { - root: { - transitionDuration: "{transition.duration}" - }, - separator: { - background: "{content.border.color}" - }, - itemLink: { - borderRadius: "{content.border.radius}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - gap: "0.5rem" - }, - itemLabel: { - color: "{text.muted.color}", - activeColor: "{primary.color}", - fontWeight: "500" - }, - itemNumber: { - background: "{content.background}", - activeBackground: "{content.background}", - borderColor: "{content.border.color}", - activeBorderColor: "{content.border.color}", - color: "{text.muted.color}", - activeColor: "{primary.color}", - size: "2rem", - fontSize: "1.143rem", - fontWeight: "500", - borderRadius: "50%", - shadow: "0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12)" - } -}; -var index$j = { - root: { - transitionDuration: "{transition.duration}" - }, - tablist: { - borderWidth: "0 0 1px 0", - background: "{content.background}", - borderColor: "{content.border.color}" - }, - item: { - background: "transparent", - hoverBackground: "transparent", - activeBackground: "transparent", - borderWidth: "0 0 1px 0", - borderColor: "{content.border.color}", - hoverBorderColor: "{content.border.color}", - activeBorderColor: "{primary.color}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - activeColor: "{primary.color}", - padding: "1rem 1.125rem", - fontWeight: "600", - margin: "0 0 -1px 0", - gap: "0.5rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - itemIcon: { - color: "{text.muted.color}", - hoverColor: "{text.color}", - activeColor: "{primary.color}" - }, - activeBar: { - height: "1px", - bottom: "-1px", - background: "{primary.color}" - } -}; -var index$i = { - root: { - transitionDuration: "{transition.duration}" - }, - tablist: { - borderWidth: "0 0 1px 0", - background: "{content.background}", - borderColor: "{content.border.color}" - }, - tab: { - background: "transparent", - hoverBackground: "transparent", - activeBackground: "transparent", - borderWidth: "0 0 1px 0", - borderColor: "{content.border.color}", - hoverBorderColor: "{content.border.color}", - activeBorderColor: "{primary.color}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - activeColor: "{primary.color}", - padding: "1rem 1.125rem", - fontWeight: "600", - margin: "0 0 -1px 0", - gap: "0.5rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - } - }, - tabpanel: { - background: "{content.background}", - color: "{content.color}", - padding: "0.875rem 1.125rem 1.125rem 1.125rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "inset {focus.ring.shadow}" - } - }, - navButton: { - background: "{content.background}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - width: "2.5rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - } - }, - activeBar: { - height: "1px", - bottom: "-1px", - background: "{primary.color}" - }, - colorScheme: { - light: { - navButton: { - shadow: "0px 0px 10px 50px rgba(255, 255, 255, 0.6)" - } - }, - dark: { - navButton: { - shadow: "0px 0px 10px 50px color-mix(in srgb, {content.background}, transparent 50%)" - } - } - } -}; -var index$h = { - root: { - transitionDuration: "{transition.duration}" - }, - tabList: { - background: "{content.background}", - borderColor: "{content.border.color}" - }, - tab: { - borderColor: "{content.border.color}", - activeBorderColor: "{primary.color}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - activeColor: "{primary.color}" - }, - tabPanel: { - background: "{content.background}", - color: "{content.color}" - }, - navButton: { - background: "{content.background}", - color: "{text.muted.color}", - hoverColor: "{text.color}" - }, - colorScheme: { - light: { - navButton: { - shadow: "0px 0px 10px 50px rgba(255, 255, 255, 0.6)" - } - }, - dark: { - navButton: { - shadow: "0px 0px 10px 50px color-mix(in srgb, {content.background}, transparent 50%)" - } - } - } -}; -var index$g = { - root: { - fontSize: "0.875rem", - fontWeight: "700", - padding: "0.25rem 0.5rem", - gap: "0.25rem", - borderRadius: "{content.border.radius}", - roundedBorderRadius: "{border.radius.xl}" - }, - icon: { - size: "0.75rem" - }, - colorScheme: { - light: { - primary: { - background: "{primary.100}", - color: "{primary.700}" - }, - secondary: { - background: "{surface.100}", - color: "{surface.600}" - }, - success: { - background: "{green.100}", - color: "{green.700}" - }, - info: { - background: "{sky.100}", - color: "{sky.700}" - }, - warn: { - background: "{orange.100}", - color: "{orange.700}" - }, - danger: { - background: "{red.100}", - color: "{red.700}" - }, - contrast: { - background: "{surface.950}", - color: "{surface.0}" - } - }, - dark: { - primary: { - background: "color-mix(in srgb, {primary.500}, transparent 84%)", - color: "{primary.300}" - }, - secondary: { - background: "{surface.800}", - color: "{surface.300}" - }, - success: { - background: "color-mix(in srgb, {green.500}, transparent 84%)", - color: "{green.300}" - }, - info: { - background: "color-mix(in srgb, {sky.500}, transparent 84%)", - color: "{sky.300}" - }, - warn: { - background: "color-mix(in srgb, {orange.500}, transparent 84%)", - color: "{orange.300}" - }, - danger: { - background: "color-mix(in srgb, {red.500}, transparent 84%)", - color: "{red.300}" - }, - contrast: { - background: "{surface.0}", - color: "{surface.950}" - } - } - } -}; -var index$f = { - root: { - background: "{form.field.background}", - borderColor: "{form.field.border.color}", - color: "{form.field.color}", - height: "18rem", - padding: "{form.field.padding.y} {form.field.padding.x}", - borderRadius: "{form.field.border.radius}" - }, - prompt: { - gap: "0.25rem" - }, - commandResponse: { - margin: "2px 0" - } -}; -var index$e = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}", - sm: { - fontSize: "{form.field.sm.font.size}", - paddingX: "{form.field.sm.padding.x}", - paddingY: "{form.field.sm.padding.y}" - }, - lg: { - fontSize: "{form.field.lg.font.size}", - paddingX: "{form.field.lg.padding.x}", - paddingY: "{form.field.lg.padding.y}" - } - } -}; -var index$d = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - color: "{content.color}", - borderRadius: "{content.border.radius}", - shadow: "{overlay.navigation.shadow}", - transitionDuration: "{transition.duration}" - }, - list: { - padding: "{navigation.list.padding}", - gap: "{navigation.list.gap}" - }, - item: { - focusBackground: "{navigation.item.focus.background}", - activeBackground: "{navigation.item.active.background}", - color: "{navigation.item.color}", - focusColor: "{navigation.item.focus.color}", - activeColor: "{navigation.item.active.color}", - padding: "{navigation.item.padding}", - borderRadius: "{navigation.item.border.radius}", - gap: "{navigation.item.gap}", - icon: { - color: "{navigation.item.icon.color}", - focusColor: "{navigation.item.icon.focus.color}", - activeColor: "{navigation.item.icon.active.color}" - } - }, - submenu: { - mobileIndent: "1rem" - }, - submenuIcon: { - size: "{navigation.submenu.icon.size}", - color: "{navigation.submenu.icon.color}", - focusColor: "{navigation.submenu.icon.focus.color}", - activeColor: "{navigation.submenu.icon.active.color}" - }, - separator: { - borderColor: "{content.border.color}" - } -}; -var index$c = { - event: { - minHeight: "5rem" - }, - horizontal: { - eventContent: { - padding: "1rem 0" - } - }, - vertical: { - eventContent: { - padding: "0 1rem" - } - }, - eventMarker: { - size: "1.125rem", - borderRadius: "50%", - borderWidth: "2px", - background: "{content.background}", - borderColor: "{content.border.color}", - content: { - borderRadius: "50%", - size: "0.375rem", - background: "{primary.color}", - insetShadow: "0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12)" - } - }, - eventConnector: { - color: "{content.border.color}", - size: "2px" - } -}; -var index$b = { - root: { - width: "25rem", - borderRadius: "{content.border.radius}", - borderWidth: "1px", - transitionDuration: "{transition.duration}" - }, - icon: { - size: "1.125rem" - }, - content: { - padding: "{overlay.popover.padding}", - gap: "0.5rem" - }, - text: { - gap: "0.5rem" - }, - summary: { - fontWeight: "500", - fontSize: "1rem" - }, - detail: { - fontWeight: "500", - fontSize: "0.875rem" - }, - closeButton: { - width: "1.75rem", - height: "1.75rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - offset: "{focus.ring.offset}" - } - }, - closeIcon: { - size: "1rem" - }, - colorScheme: { - light: { - blur: "1.5px", - info: { - background: "color-mix(in srgb, {blue.50}, transparent 5%)", - borderColor: "{blue.200}", - color: "{blue.600}", - detailColor: "{surface.700}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)", - closeButton: { - hoverBackground: "{blue.100}", - focusRing: { - color: "{blue.600}", - shadow: "none" - } - } - }, - success: { - background: "color-mix(in srgb, {green.50}, transparent 5%)", - borderColor: "{green.200}", - color: "{green.600}", - detailColor: "{surface.700}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)", - closeButton: { - hoverBackground: "{green.100}", - focusRing: { - color: "{green.600}", - shadow: "none" - } - } - }, - warn: { - background: "color-mix(in srgb,{yellow.50}, transparent 5%)", - borderColor: "{yellow.200}", - color: "{yellow.600}", - detailColor: "{surface.700}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)", - closeButton: { - hoverBackground: "{yellow.100}", - focusRing: { - color: "{yellow.600}", - shadow: "none" - } - } - }, - error: { - background: "color-mix(in srgb, {red.50}, transparent 5%)", - borderColor: "{red.200}", - color: "{red.600}", - detailColor: "{surface.700}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)", - closeButton: { - hoverBackground: "{red.100}", - focusRing: { - color: "{red.600}", - shadow: "none" - } - } - }, - secondary: { - background: "{surface.100}", - borderColor: "{surface.200}", - color: "{surface.600}", - detailColor: "{surface.700}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.200}", - focusRing: { - color: "{surface.600}", - shadow: "none" - } - } - }, - contrast: { - background: "{surface.900}", - borderColor: "{surface.950}", - color: "{surface.50}", - detailColor: "{surface.0}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.800}", - focusRing: { - color: "{surface.50}", - shadow: "none" - } - } - } - }, - dark: { - blur: "10px", - info: { - background: "color-mix(in srgb, {blue.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {blue.700}, transparent 64%)", - color: "{blue.500}", - detailColor: "{surface.0}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {blue.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{blue.500}", - shadow: "none" - } - } - }, - success: { - background: "color-mix(in srgb, {green.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {green.700}, transparent 64%)", - color: "{green.500}", - detailColor: "{surface.0}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {green.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{green.500}", - shadow: "none" - } - } - }, - warn: { - background: "color-mix(in srgb, {yellow.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {yellow.700}, transparent 64%)", - color: "{yellow.500}", - detailColor: "{surface.0}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {yellow.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{yellow.500}", - shadow: "none" - } - } - }, - error: { - background: "color-mix(in srgb, {red.500}, transparent 84%)", - borderColor: "color-mix(in srgb, {red.700}, transparent 64%)", - color: "{red.500}", - detailColor: "{surface.0}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {red.500}, transparent 96%)", - closeButton: { - hoverBackground: "rgba(255, 255, 255, 0.05)", - focusRing: { - color: "{red.500}", - shadow: "none" - } - } - }, - secondary: { - background: "{surface.800}", - borderColor: "{surface.700}", - color: "{surface.300}", - detailColor: "{surface.0}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.500}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.700}", - focusRing: { - color: "{surface.300}", - shadow: "none" - } - } - }, - contrast: { - background: "{surface.0}", - borderColor: "{surface.100}", - color: "{surface.950}", - detailColor: "{surface.950}", - shadow: "0px 4px 8px 0px color-mix(in srgb, {surface.950}, transparent 96%)", - closeButton: { - hoverBackground: "{surface.100}", - focusRing: { - color: "{surface.950}", - shadow: "none" - } - } - } - } - } -}; -var index$a = { - root: { - padding: "0.5rem 1rem", - borderRadius: "{content.border.radius}", - gap: "0.5rem", - fontWeight: "500", - disabledBackground: "{form.field.disabled.background}", - disabledBorderColor: "{form.field.disabled.background}", - disabledColor: "{form.field.disabled.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}", - sm: { - fontSize: "{form.field.sm.font.size}", - padding: "0.375rem 0.75rem" - }, - lg: { - fontSize: "{form.field.lg.font.size}", - padding: "0.625rem 1.25rem" - } - }, - icon: { - disabledColor: "{form.field.disabled.color}" - }, - content: { - left: "0.25rem", - top: "0.25rem", - checkedShadow: "0px 1px 2px 0px rgba(0, 0, 0, 0.02), 0px 1px 2px 0px rgba(0, 0, 0, 0.04)" - }, - colorScheme: { - light: { - root: { - background: "{surface.100}", - checkedBackground: "{surface.100}", - hoverBackground: "{surface.100}", - borderColor: "{surface.100}", - color: "{surface.500}", - hoverColor: "{surface.700}", - checkedColor: "{surface.900}", - checkedBorderColor: "{surface.100}" - }, - content: { - checkedBackground: "{surface.0}" - }, - icon: { - color: "{surface.500}", - hoverColor: "{surface.700}", - checkedColor: "{surface.900}" - } - }, - dark: { - root: { - background: "{surface.950}", - checkedBackground: "{surface.950}", - hoverBackground: "{surface.950}", - borderColor: "{surface.950}", - color: "{surface.400}", - hoverColor: "{surface.300}", - checkedColor: "{surface.0}", - checkedBorderColor: "{surface.950}" - }, - content: { - checkedBackground: "{surface.800}" - }, - icon: { - color: "{surface.400}", - hoverColor: "{surface.300}", - checkedColor: "{surface.0}" - } - } - } -}; -var index$9 = { - root: { - width: "2.5rem", - height: "1.5rem", - borderRadius: "30px", - gap: "0.25rem", - shadow: "{form.field.shadow}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - }, - borderWidth: "1px", - borderColor: "transparent", - hoverBorderColor: "transparent", - checkedBorderColor: "transparent", - checkedHoverBorderColor: "transparent", - invalidBorderColor: "{form.field.invalid.border.color}", - transitionDuration: "{form.field.transition.duration}", - slideDuration: "0.2s" - }, - handle: { - borderRadius: "50%", - size: "1rem" - }, - colorScheme: { - light: { - root: { - background: "{surface.300}", - disabledBackground: "{form.field.disabled.background}", - hoverBackground: "{surface.400}", - checkedBackground: "{primary.color}", - checkedHoverBackground: "{primary.hover.color}" - }, - handle: { - background: "{surface.0}", - disabledBackground: "{form.field.disabled.color}", - hoverBackground: "{surface.0}", - checkedBackground: "{surface.0}", - checkedHoverBackground: "{surface.0}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - checkedColor: "{primary.color}", - checkedHoverColor: "{primary.hover.color}" - } - }, - dark: { - root: { - background: "{surface.700}", - disabledBackground: "{surface.600}", - hoverBackground: "{surface.600}", - checkedBackground: "{primary.color}", - checkedHoverBackground: "{primary.hover.color}" - }, - handle: { - background: "{surface.400}", - disabledBackground: "{surface.900}", - hoverBackground: "{surface.300}", - checkedBackground: "{surface.900}", - checkedHoverBackground: "{surface.900}", - color: "{surface.900}", - hoverColor: "{surface.800}", - checkedColor: "{primary.color}", - checkedHoverColor: "{primary.hover.color}" - } - } - } -}; -var index$8 = { - root: { - background: "{content.background}", - borderColor: "{content.border.color}", - borderRadius: "{content.border.radius}", - color: "{content.color}", - gap: "0.5rem", - padding: "0.75rem" - } -}; -var index$7 = { - root: { - maxWidth: "12.5rem", - gutter: "0.25rem", - shadow: "{overlay.popover.shadow}", - padding: "0.5rem 0.75rem", - borderRadius: "{overlay.popover.border.radius}" - }, - colorScheme: { - light: { - root: { - background: "{surface.700}", - color: "{surface.0}" - } - }, - dark: { - root: { - background: "{surface.700}", - color: "{surface.0}" - } - } - } -}; -var index$6 = { - root: { - background: "{content.background}", - color: "{content.color}", - padding: "1rem", - gap: "2px", - indent: "1rem", - transitionDuration: "{transition.duration}" - }, - node: { - padding: "0.25rem 0.5rem", - borderRadius: "{content.border.radius}", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - color: "{text.color}", - hoverColor: "{text.hover.color}", - selectedColor: "{highlight.color}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - }, - gap: "0.25rem" - }, - nodeIcon: { - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}", - selectedColor: "{highlight.color}" - }, - nodeToggleButton: { - borderRadius: "50%", - size: "1.75rem", - hoverBackground: "{content.hover.background}", - selectedHoverBackground: "{content.background}", - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}", - selectedHoverColor: "{primary.color}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - loadingIcon: { - size: "2rem" - }, - filter: { - margin: "0 0 0.5rem 0" - } -}; -var index$5 = { - root: { - background: "{form.field.background}", - disabledBackground: "{form.field.disabled.background}", - filledBackground: "{form.field.filled.background}", - filledHoverBackground: "{form.field.filled.hover.background}", - filledFocusBackground: "{form.field.filled.focus.background}", - borderColor: "{form.field.border.color}", - hoverBorderColor: "{form.field.hover.border.color}", - focusBorderColor: "{form.field.focus.border.color}", - invalidBorderColor: "{form.field.invalid.border.color}", - color: "{form.field.color}", - disabledColor: "{form.field.disabled.color}", - placeholderColor: "{form.field.placeholder.color}", - invalidPlaceholderColor: "{form.field.invalid.placeholder.color}", - shadow: "{form.field.shadow}", - paddingX: "{form.field.padding.x}", - paddingY: "{form.field.padding.y}", - borderRadius: "{form.field.border.radius}", - focusRing: { - width: "{form.field.focus.ring.width}", - style: "{form.field.focus.ring.style}", - color: "{form.field.focus.ring.color}", - offset: "{form.field.focus.ring.offset}", - shadow: "{form.field.focus.ring.shadow}" - }, - transitionDuration: "{form.field.transition.duration}", - sm: { - fontSize: "{form.field.sm.font.size}", - paddingX: "{form.field.sm.padding.x}", - paddingY: "{form.field.sm.padding.y}" - }, - lg: { - fontSize: "{form.field.lg.font.size}", - paddingX: "{form.field.lg.padding.x}", - paddingY: "{form.field.lg.padding.y}" - } - }, - dropdown: { - width: "2.5rem", - color: "{form.field.icon.color}" - }, - overlay: { - background: "{overlay.select.background}", - borderColor: "{overlay.select.border.color}", - borderRadius: "{overlay.select.border.radius}", - color: "{overlay.select.color}", - shadow: "{overlay.select.shadow}" - }, - tree: { - padding: "{list.padding}" - }, - clearIcon: { - color: "{form.field.icon.color}" - }, - emptyMessage: { - padding: "{list.option.padding}" - }, - chip: { - borderRadius: "{border.radius.sm}" - } -}; -var index$4 = { - root: { - transitionDuration: "{transition.duration}" - }, - header: { - background: "{content.background}", - borderColor: "{treetable.border.color}", - color: "{content.color}", - borderWidth: "0 0 1px 0", - padding: "0.75rem 1rem" - }, - headerCell: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - borderColor: "{treetable.border.color}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - selectedColor: "{highlight.color}", - gap: "0.5rem", - padding: "0.75rem 1rem", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - } - }, - columnTitle: { - fontWeight: "600" - }, - row: { - background: "{content.background}", - hoverBackground: "{content.hover.background}", - selectedBackground: "{highlight.background}", - color: "{content.color}", - hoverColor: "{content.hover.color}", - selectedColor: "{highlight.color}", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "-1px", - shadow: "{focus.ring.shadow}" - } - }, - bodyCell: { - borderColor: "{treetable.border.color}", - padding: "0.75rem 1rem", - gap: "0.5rem" - }, - footerCell: { - background: "{content.background}", - borderColor: "{treetable.border.color}", - color: "{content.color}", - padding: "0.75rem 1rem" - }, - columnFooter: { - fontWeight: "600" - }, - footer: { - background: "{content.background}", - borderColor: "{treetable.border.color}", - color: "{content.color}", - borderWidth: "0 0 1px 0", - padding: "0.75rem 1rem" - }, - columnResizerWidth: "0.5rem", - resizeIndicator: { - width: "1px", - color: "{primary.color}" - }, - sortIcon: { - color: "{text.muted.color}", - hoverColor: "{text.hover.muted.color}", - size: "0.875rem" - }, - loadingIcon: { - size: "2rem" - }, - nodeToggleButton: { - hoverBackground: "{content.hover.background}", - selectedHoverBackground: "{content.background}", - color: "{text.muted.color}", - hoverColor: "{text.color}", - selectedHoverColor: "{primary.color}", - size: "1.75rem", - borderRadius: "50%", - focusRing: { - width: "{focus.ring.width}", - style: "{focus.ring.style}", - color: "{focus.ring.color}", - offset: "{focus.ring.offset}", - shadow: "{focus.ring.shadow}" - } - }, - paginatorTop: { - borderColor: "{content.border.color}", - borderWidth: "0 0 1px 0" - }, - paginatorBottom: { - borderColor: "{content.border.color}", - borderWidth: "0 0 1px 0" - }, - colorScheme: { - light: { - root: { - borderColor: "{content.border.color}" - }, - bodyCell: { - selectedBorderColor: "{primary.100}" - } - }, - dark: { - root: { - borderColor: "{surface.800}" - }, - bodyCell: { - selectedBorderColor: "{primary.900}" - } - } - } -}; -var index$3 = { - loader: { - mask: { - background: "{content.background}", - color: "{text.muted.color}" - }, - icon: { - size: "2rem" - } - } -}; -function _typeof$t(o2) { - "@babel/helpers - typeof"; - return _typeof$t = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { - return typeof o3; - } : function(o3) { - return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; - }, _typeof$t(o2); -} -__name(_typeof$t, "_typeof$t"); -function ownKeys$r(e2, r2) { - var t2 = Object.keys(e2); - if (Object.getOwnPropertySymbols) { - var o2 = Object.getOwnPropertySymbols(e2); - r2 && (o2 = o2.filter(function(r3) { - return Object.getOwnPropertyDescriptor(e2, r3).enumerable; - })), t2.push.apply(t2, o2); - } - return t2; -} -__name(ownKeys$r, "ownKeys$r"); -function _objectSpread$r(e2) { - for (var r2 = 1; r2 < arguments.length; r2++) { - var t2 = null != arguments[r2] ? arguments[r2] : {}; - r2 % 2 ? ownKeys$r(Object(t2), true).forEach(function(r3) { - _defineProperty$v(e2, r3, t2[r3]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$r(Object(t2)).forEach(function(r3) { - Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); - }); - } - return e2; -} -__name(_objectSpread$r, "_objectSpread$r"); -function _defineProperty$v(e2, r2, t2) { - return (r2 = _toPropertyKey$s(r2)) in e2 ? Object.defineProperty(e2, r2, { value: t2, enumerable: true, configurable: true, writable: true }) : e2[r2] = t2, e2; -} -__name(_defineProperty$v, "_defineProperty$v"); -function _toPropertyKey$s(t2) { - var i2 = _toPrimitive$s(t2, "string"); - return "symbol" == _typeof$t(i2) ? i2 : i2 + ""; -} -__name(_toPropertyKey$s, "_toPropertyKey$s"); -function _toPrimitive$s(t2, r2) { - if ("object" != _typeof$t(t2) || !t2) return t2; - var e2 = t2[Symbol.toPrimitive]; - if (void 0 !== e2) { - var i2 = e2.call(t2, r2 || "default"); - if ("object" != _typeof$t(i2)) return i2; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r2 ? String : Number)(t2); -} -__name(_toPrimitive$s, "_toPrimitive$s"); -var index$2 = _objectSpread$r(_objectSpread$r({}, index$1n), {}, { - components: { - accordion: index$1r, - autocomplete: index$1q, - avatar: index$1p, - badge: index$1o, - blockui: index$1m, - breadcrumb: index$1l, - button: index$1k, - datepicker: index$18, - card: index$1j, - carousel: index$1i, - cascadeselect: index$1h, - checkbox: index$1g, - chip: index$1f, - colorpicker: index$1e, - confirmdialog: index$1d, - confirmpopup: index$1c, - contextmenu: index$1b, - dataview: index$19, - datatable: index$1a, - dialog: index$17, - divider: index$16, - dock: index$15, - drawer: index$14, - editor: index$13, - fieldset: index$12, - fileupload: index$11, - iftalabel: index$Z, - floatlabel: index$10, - galleria: index$$, - iconfield: index$_, - image: index$Y, - imagecompare: index$X, - inlinemessage: index$W, - inplace: index$V, - inputchips: index$U, - inputgroup: index$T, - inputnumber: index$S, - inputotp: index$R, - inputtext: index$Q, - knob: index$P, - listbox: index$O, - megamenu: index$N, - menu: index$M, - menubar: index$L, - message: index$K, - metergroup: index$J, - multiselect: index$I, - orderlist: index$H, - organizationchart: index$G, - overlaybadge: index$F, - popover: index$z, - paginator: index$E, - password: index$B, - panel: index$D, - panelmenu: index$C, - picklist: index$A, - progressbar: index$y, - progressspinner: index$x, - radiobutton: index$w, - rating: index$v, - scrollpanel: index$t, - select: index$s, - selectbutton: index$r, - skeleton: index$q, - slider: index$p, - speeddial: index$o, - splitter: index$m, - splitbutton: index$n, - stepper: index$l, - steps: index$k, - tabmenu: index$j, - tabs: index$i, - tabview: index$h, - textarea: index$e, - tieredmenu: index$d, - tag: index$g, - terminal: index$f, - timeline: index$c, - togglebutton: index$a, - toggleswitch: index$9, - tree: index$6, - treeselect: index$5, - treetable: index$4, - toast: index$b, - toolbar: index$8, - virtualscroller: index$3 - }, - directives: { - tooltip: index$7, - ripple: index$u - } -}); -const DEBUG_BUILD$6 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; -const SDK_VERSION = "8.48.0"; -const GLOBAL_OBJ = globalThis; -function getGlobalSingleton(name2, creator, obj) { - const gbl = obj || GLOBAL_OBJ; - const __SENTRY__ = gbl.__SENTRY__ = gbl.__SENTRY__ || {}; - const versionedCarrier = __SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {}; - return versionedCarrier[name2] || (versionedCarrier[name2] = creator()); -} -__name(getGlobalSingleton, "getGlobalSingleton"); -const DEBUG_BUILD$5 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; -const PREFIX$2 = "Sentry Logger "; -const CONSOLE_LEVELS$1 = [ - "debug", - "info", - "warn", - "error", - "log", - "assert", - "trace" -]; -const originalConsoleMethods = {}; -function consoleSandbox(callback) { - if (!("console" in GLOBAL_OBJ)) { - return callback(); - } - const console2 = GLOBAL_OBJ.console; - const wrappedFuncs = {}; - const wrappedLevels = Object.keys(originalConsoleMethods); - wrappedLevels.forEach((level) => { - const originalConsoleMethod = originalConsoleMethods[level]; - wrappedFuncs[level] = console2[level]; - console2[level] = originalConsoleMethod; - }); - try { - return callback(); - } finally { - wrappedLevels.forEach((level) => { - console2[level] = wrappedFuncs[level]; - }); - } -} -__name(consoleSandbox, "consoleSandbox"); -function makeLogger() { - let enabled = false; - const logger2 = { - enable: /* @__PURE__ */ __name(() => { - enabled = true; - }, "enable"), - disable: /* @__PURE__ */ __name(() => { - enabled = false; - }, "disable"), - isEnabled: /* @__PURE__ */ __name(() => enabled, "isEnabled") - }; - if (DEBUG_BUILD$5) { - CONSOLE_LEVELS$1.forEach((name2) => { - logger2[name2] = (...args) => { - if (enabled) { - consoleSandbox(() => { - GLOBAL_OBJ.console[name2](`${PREFIX$2}[${name2}]:`, ...args); - }); - } - }; - }); - } else { - CONSOLE_LEVELS$1.forEach((name2) => { - logger2[name2] = () => void 0; - }); - } - return logger2; -} -__name(makeLogger, "makeLogger"); -const logger$2 = getGlobalSingleton("logger", makeLogger); -const STACKTRACE_FRAME_LIMIT = 50; -const UNKNOWN_FUNCTION = "?"; -const WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/; -const STRIP_FRAME_REGEXP = /captureMessage|captureException/; -function createStackParser(...parsers) { - const sortedParsers = parsers.sort((a2, b2) => a2[0] - b2[0]).map((p2) => p2[1]); - return (stack2, skipFirstLines = 0, framesToPop = 0) => { - const frames = []; - const lines = stack2.split("\n"); - for (let i2 = skipFirstLines; i2 < lines.length; i2++) { - const line = lines[i2]; - if (line.length > 1024) { - continue; - } - const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, "$1") : line; - if (cleanedLine.match(/\S*Error: /)) { - continue; - } - for (const parser of sortedParsers) { - const frame = parser(cleanedLine); - if (frame) { - frames.push(frame); - break; - } - } - if (frames.length >= STACKTRACE_FRAME_LIMIT + framesToPop) { - break; - } - } - return stripSentryFramesAndReverse(frames.slice(framesToPop)); - }; -} -__name(createStackParser, "createStackParser"); -function stackParserFromStackParserOptions(stackParser) { - if (Array.isArray(stackParser)) { - return createStackParser(...stackParser); - } - return stackParser; -} -__name(stackParserFromStackParserOptions, "stackParserFromStackParserOptions"); -function stripSentryFramesAndReverse(stack2) { - if (!stack2.length) { - return []; - } - const localStack = Array.from(stack2); - if (/sentryWrapped/.test(getLastStackFrame(localStack).function || "")) { - localStack.pop(); - } - localStack.reverse(); - if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || "")) { - localStack.pop(); - if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || "")) { - localStack.pop(); - } - } - return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map((frame) => ({ - ...frame, - filename: frame.filename || getLastStackFrame(localStack).filename, - function: frame.function || UNKNOWN_FUNCTION - })); -} -__name(stripSentryFramesAndReverse, "stripSentryFramesAndReverse"); -function getLastStackFrame(arr) { - return arr[arr.length - 1] || {}; -} -__name(getLastStackFrame, "getLastStackFrame"); -const defaultFunctionName = ""; -function getFunctionName(fn) { - try { - if (!fn || typeof fn !== "function") { - return defaultFunctionName; - } - return fn.name || defaultFunctionName; - } catch (e2) { - return defaultFunctionName; - } -} -__name(getFunctionName, "getFunctionName"); -function getFramesFromEvent(event) { - const exception = event.exception; - if (exception) { - const frames = []; - try { - exception.values.forEach((value4) => { - if (value4.stacktrace.frames) { - frames.push(...value4.stacktrace.frames); - } - }); - return frames; - } catch (_oO) { - return void 0; - } - } - return void 0; -} -__name(getFramesFromEvent, "getFramesFromEvent"); -const handlers$4 = {}; -const instrumented$1 = {}; -function addHandler$1(type, handler12) { - handlers$4[type] = handlers$4[type] || []; - handlers$4[type].push(handler12); -} -__name(addHandler$1, "addHandler$1"); -function resetInstrumentationHandlers() { - Object.keys(handlers$4).forEach((key) => { - handlers$4[key] = void 0; - }); -} -__name(resetInstrumentationHandlers, "resetInstrumentationHandlers"); -function maybeInstrument(type, instrumentFn) { - if (!instrumented$1[type]) { - instrumented$1[type] = true; - try { - instrumentFn(); - } catch (e2) { - DEBUG_BUILD$5 && logger$2.error(`Error while instrumenting ${type}`, e2); - } - } -} -__name(maybeInstrument, "maybeInstrument"); -function triggerHandlers$1(type, data26) { - const typeHandlers = type && handlers$4[type]; - if (!typeHandlers) { - return; - } - for (const handler12 of typeHandlers) { - try { - handler12(data26); - } catch (e2) { - DEBUG_BUILD$5 && logger$2.error( - `Error while triggering instrumentation handler. -Type: ${type} -Name: ${getFunctionName(handler12)} -Error:`, - e2 - ); - } - } -} -__name(triggerHandlers$1, "triggerHandlers$1"); -let _oldOnErrorHandler = null; -function addGlobalErrorInstrumentationHandler(handler12) { - const type = "error"; - addHandler$1(type, handler12); - maybeInstrument(type, instrumentError); -} -__name(addGlobalErrorInstrumentationHandler, "addGlobalErrorInstrumentationHandler"); -function instrumentError() { - _oldOnErrorHandler = GLOBAL_OBJ.onerror; - GLOBAL_OBJ.onerror = function(msg, url, line, column, error2) { - const handlerData = { - column, - error: error2, - line, - msg, - url - }; - triggerHandlers$1("error", handlerData); - if (_oldOnErrorHandler) { - return _oldOnErrorHandler.apply(this, arguments); - } - return false; - }; - GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true; -} -__name(instrumentError, "instrumentError"); -let _oldOnUnhandledRejectionHandler = null; -function addGlobalUnhandledRejectionInstrumentationHandler(handler12) { - const type = "unhandledrejection"; - addHandler$1(type, handler12); - maybeInstrument(type, instrumentUnhandledRejection); -} -__name(addGlobalUnhandledRejectionInstrumentationHandler, "addGlobalUnhandledRejectionInstrumentationHandler"); -function instrumentUnhandledRejection() { - _oldOnUnhandledRejectionHandler = GLOBAL_OBJ.onunhandledrejection; - GLOBAL_OBJ.onunhandledrejection = function(e2) { - const handlerData = e2; - triggerHandlers$1("unhandledrejection", handlerData); - if (_oldOnUnhandledRejectionHandler) { - return _oldOnUnhandledRejectionHandler.apply(this, arguments); - } - return true; - }; - GLOBAL_OBJ.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true; -} -__name(instrumentUnhandledRejection, "instrumentUnhandledRejection"); -function getMainCarrier() { - getSentryCarrier(GLOBAL_OBJ); - return GLOBAL_OBJ; -} -__name(getMainCarrier, "getMainCarrier"); -function getSentryCarrier(carrier) { - const __SENTRY__ = carrier.__SENTRY__ = carrier.__SENTRY__ || {}; - __SENTRY__.version = __SENTRY__.version || SDK_VERSION; - return __SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {}; -} -__name(getSentryCarrier, "getSentryCarrier"); -const objectToString$4 = Object.prototype.toString; -function isError(wat) { - switch (objectToString$4.call(wat)) { - case "[object Error]": - case "[object Exception]": - case "[object DOMException]": - case "[object WebAssembly.Exception]": - return true; - default: - return isInstanceOf(wat, Error); - } -} -__name(isError, "isError"); -function isBuiltin(wat, className) { - return objectToString$4.call(wat) === `[object ${className}]`; -} -__name(isBuiltin, "isBuiltin"); -function isErrorEvent$2(wat) { - return isBuiltin(wat, "ErrorEvent"); -} -__name(isErrorEvent$2, "isErrorEvent$2"); -function isDOMError(wat) { - return isBuiltin(wat, "DOMError"); -} -__name(isDOMError, "isDOMError"); -function isDOMException(wat) { - return isBuiltin(wat, "DOMException"); -} -__name(isDOMException, "isDOMException"); -function isString$a(wat) { - return isBuiltin(wat, "String"); -} -__name(isString$a, "isString$a"); -function isParameterizedString(wat) { - return typeof wat === "object" && wat !== null && "__sentry_template_string__" in wat && "__sentry_template_values__" in wat; -} -__name(isParameterizedString, "isParameterizedString"); -function isPrimitive(wat) { - return wat === null || isParameterizedString(wat) || typeof wat !== "object" && typeof wat !== "function"; -} -__name(isPrimitive, "isPrimitive"); -function isPlainObject$5(wat) { - return isBuiltin(wat, "Object"); -} -__name(isPlainObject$5, "isPlainObject$5"); -function isEvent(wat) { - return typeof Event !== "undefined" && isInstanceOf(wat, Event); -} -__name(isEvent, "isEvent"); -function isElement$3(wat) { - return typeof Element !== "undefined" && isInstanceOf(wat, Element); -} -__name(isElement$3, "isElement$3"); -function isRegExp$5(wat) { - return isBuiltin(wat, "RegExp"); -} -__name(isRegExp$5, "isRegExp$5"); -function isThenable$1(wat) { - return Boolean(wat && wat.then && typeof wat.then === "function"); -} -__name(isThenable$1, "isThenable$1"); -function isSyntheticEvent(wat) { - return isPlainObject$5(wat) && "nativeEvent" in wat && "preventDefault" in wat && "stopPropagation" in wat; -} -__name(isSyntheticEvent, "isSyntheticEvent"); -function isInstanceOf(wat, base2) { - try { - return wat instanceof base2; - } catch (_e) { - return false; - } -} -__name(isInstanceOf, "isInstanceOf"); -function isVueViewModel(wat) { - return !!(typeof wat === "object" && wat !== null && (wat.__isVue || wat._isVue)); -} -__name(isVueViewModel, "isVueViewModel"); -const WINDOW$8 = GLOBAL_OBJ; -const DEFAULT_MAX_STRING_LENGTH = 80; -function htmlTreeAsString(elem, options4 = {}) { - if (!elem) { - return ""; - } - try { - let currentElem = elem; - const MAX_TRAVERSE_HEIGHT = 5; - const out = []; - let height = 0; - let len = 0; - const separator = " > "; - const sepLength = separator.length; - let nextStr; - const keyAttrs = Array.isArray(options4) ? options4 : options4.keyAttrs; - const maxStringLength = !Array.isArray(options4) && options4.maxStringLength || DEFAULT_MAX_STRING_LENGTH; - while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) { - nextStr = _htmlElementAsString(currentElem, keyAttrs); - if (nextStr === "html" || height > 1 && len + out.length * sepLength + nextStr.length >= maxStringLength) { - break; - } - out.push(nextStr); - len += nextStr.length; - currentElem = currentElem.parentNode; - } - return out.reverse().join(separator); - } catch (_oO) { - return ""; - } -} -__name(htmlTreeAsString, "htmlTreeAsString"); -function _htmlElementAsString(el, keyAttrs) { - const elem = el; - const out = []; - if (!elem || !elem.tagName) { - return ""; - } - if (WINDOW$8.HTMLElement) { - if (elem instanceof HTMLElement && elem.dataset) { - if (elem.dataset["sentryComponent"]) { - return elem.dataset["sentryComponent"]; - } - if (elem.dataset["sentryElement"]) { - return elem.dataset["sentryElement"]; - } - } - } - out.push(elem.tagName.toLowerCase()); - const keyAttrPairs = keyAttrs && keyAttrs.length ? keyAttrs.filter((keyAttr) => elem.getAttribute(keyAttr)).map((keyAttr) => [keyAttr, elem.getAttribute(keyAttr)]) : null; - if (keyAttrPairs && keyAttrPairs.length) { - keyAttrPairs.forEach((keyAttrPair) => { - out.push(`[${keyAttrPair[0]}="${keyAttrPair[1]}"]`); - }); - } else { - if (elem.id) { - out.push(`#${elem.id}`); - } - const className = elem.className; - if (className && isString$a(className)) { - const classes2 = className.split(/\s+/); - for (const c2 of classes2) { - out.push(`.${c2}`); - } - } - } - const allowedAttrs = ["aria-label", "type", "name", "title", "alt"]; - for (const k2 of allowedAttrs) { - const attr = elem.getAttribute(k2); - if (attr) { - out.push(`[${k2}="${attr}"]`); - } - } - return out.join(""); -} -__name(_htmlElementAsString, "_htmlElementAsString"); -function getLocationHref() { - try { - return WINDOW$8.document.location.href; - } catch (oO) { - return ""; - } -} -__name(getLocationHref, "getLocationHref"); -function getDomElement(selector) { - if (WINDOW$8.document && WINDOW$8.document.querySelector) { - return WINDOW$8.document.querySelector(selector); - } - return null; -} -__name(getDomElement, "getDomElement"); -function getComponentName$1(elem) { - if (!WINDOW$8.HTMLElement) { - return null; - } - let currentElem = elem; - const MAX_TRAVERSE_HEIGHT = 5; - for (let i2 = 0; i2 < MAX_TRAVERSE_HEIGHT; i2++) { - if (!currentElem) { - return null; - } - if (currentElem instanceof HTMLElement) { - if (currentElem.dataset["sentryComponent"]) { - return currentElem.dataset["sentryComponent"]; - } - if (currentElem.dataset["sentryElement"]) { - return currentElem.dataset["sentryElement"]; - } - } - currentElem = currentElem.parentNode; - } - return null; -} -__name(getComponentName$1, "getComponentName$1"); -function truncate(str, max = 0) { - if (typeof str !== "string" || max === 0) { - return str; - } - return str.length <= max ? str : `${str.slice(0, max)}...`; -} -__name(truncate, "truncate"); -function snipLine(line, colno) { - let newLine = line; - const lineLength = newLine.length; - if (lineLength <= 150) { - return newLine; - } - if (colno > lineLength) { - colno = lineLength; - } - let start2 = Math.max(colno - 60, 0); - if (start2 < 5) { - start2 = 0; - } - let end = Math.min(start2 + 140, lineLength); - if (end > lineLength - 5) { - end = lineLength; - } - if (end === lineLength) { - start2 = Math.max(end - 140, 0); - } - newLine = newLine.slice(start2, end); - if (start2 > 0) { - newLine = `'{snip} ${newLine}`; - } - if (end < lineLength) { - newLine += " {snip}"; - } - return newLine; -} -__name(snipLine, "snipLine"); -function safeJoin(input, delimiter2) { - if (!Array.isArray(input)) { - return ""; - } - const output = []; - for (let i2 = 0; i2 < input.length; i2++) { - const value4 = input[i2]; - try { - if (isVueViewModel(value4)) { - output.push("[VueViewModel]"); - } else { - output.push(String(value4)); - } - } catch (e2) { - output.push("[value cannot be serialized]"); - } - } - return output.join(delimiter2); -} -__name(safeJoin, "safeJoin"); -function isMatchingPattern(value4, pattern, requireExactStringMatch = false) { - if (!isString$a(value4)) { - return false; - } - if (isRegExp$5(pattern)) { - return pattern.test(value4); - } - if (isString$a(pattern)) { - return requireExactStringMatch ? value4 === pattern : value4.includes(pattern); - } - return false; -} -__name(isMatchingPattern, "isMatchingPattern"); -function stringMatchesSomePattern(testString, patterns = [], requireExactStringMatch = false) { - return patterns.some((pattern) => isMatchingPattern(testString, pattern, requireExactStringMatch)); -} -__name(stringMatchesSomePattern, "stringMatchesSomePattern"); -function fill(source, name2, replacementFactory) { - if (!(name2 in source)) { - return; - } - const original = source[name2]; - const wrapped = replacementFactory(original); - if (typeof wrapped === "function") { - markFunctionWrapped(wrapped, original); - } - try { - source[name2] = wrapped; - } catch (e2) { - DEBUG_BUILD$5 && logger$2.log(`Failed to replace method "${name2}" in object`, source); - } -} -__name(fill, "fill"); -function addNonEnumerableProperty(obj, name2, value4) { - try { - Object.defineProperty(obj, name2, { - // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it - value: value4, - writable: true, - configurable: true - }); - } catch (o_O) { - DEBUG_BUILD$5 && logger$2.log(`Failed to add non-enumerable property "${name2}" to object`, obj); - } -} -__name(addNonEnumerableProperty, "addNonEnumerableProperty"); -function markFunctionWrapped(wrapped, original) { - try { - const proto = original.prototype || {}; - wrapped.prototype = original.prototype = proto; - addNonEnumerableProperty(wrapped, "__sentry_original__", original); - } catch (o_O) { - } -} -__name(markFunctionWrapped, "markFunctionWrapped"); -function getOriginalFunction(func) { - return func.__sentry_original__; -} -__name(getOriginalFunction, "getOriginalFunction"); -function urlEncode(object) { - return Object.entries(object).map(([key, value4]) => `${encodeURIComponent(key)}=${encodeURIComponent(value4)}`).join("&"); -} -__name(urlEncode, "urlEncode"); -function convertToPlainObject(value4) { - if (isError(value4)) { - return { - message: value4.message, - name: value4.name, - stack: value4.stack, - ...getOwnProperties(value4) - }; - } else if (isEvent(value4)) { - const newObj = { - type: value4.type, - target: serializeEventTarget(value4.target), - currentTarget: serializeEventTarget(value4.currentTarget), - ...getOwnProperties(value4) - }; - if (typeof CustomEvent !== "undefined" && isInstanceOf(value4, CustomEvent)) { - newObj.detail = value4.detail; - } - return newObj; - } else { - return value4; - } -} -__name(convertToPlainObject, "convertToPlainObject"); -function serializeEventTarget(target2) { - try { - return isElement$3(target2) ? htmlTreeAsString(target2) : Object.prototype.toString.call(target2); - } catch (_oO) { - return ""; - } -} -__name(serializeEventTarget, "serializeEventTarget"); -function getOwnProperties(obj) { - if (typeof obj === "object" && obj !== null) { - const extractedProps = {}; - for (const property in obj) { - if (Object.prototype.hasOwnProperty.call(obj, property)) { - extractedProps[property] = obj[property]; - } - } - return extractedProps; - } else { - return {}; - } -} -__name(getOwnProperties, "getOwnProperties"); -function extractExceptionKeysForMessage(exception, maxLength = 40) { - const keys2 = Object.keys(convertToPlainObject(exception)); - keys2.sort(); - const firstKey = keys2[0]; - if (!firstKey) { - return "[object has no keys]"; - } - if (firstKey.length >= maxLength) { - return truncate(firstKey, maxLength); - } - for (let includedKeys = keys2.length; includedKeys > 0; includedKeys--) { - const serialized = keys2.slice(0, includedKeys).join(", "); - if (serialized.length > maxLength) { - continue; - } - if (includedKeys === keys2.length) { - return serialized; - } - return truncate(serialized, maxLength); - } - return ""; -} -__name(extractExceptionKeysForMessage, "extractExceptionKeysForMessage"); -function dropUndefinedKeys(inputValue) { - const memoizationMap = /* @__PURE__ */ new Map(); - return _dropUndefinedKeys(inputValue, memoizationMap); -} -__name(dropUndefinedKeys, "dropUndefinedKeys"); -function _dropUndefinedKeys(inputValue, memoizationMap) { - if (isPojo(inputValue)) { - const memoVal = memoizationMap.get(inputValue); - if (memoVal !== void 0) { - return memoVal; - } - const returnValue = {}; - memoizationMap.set(inputValue, returnValue); - for (const key of Object.getOwnPropertyNames(inputValue)) { - if (typeof inputValue[key] !== "undefined") { - returnValue[key] = _dropUndefinedKeys(inputValue[key], memoizationMap); - } - } - return returnValue; - } - if (Array.isArray(inputValue)) { - const memoVal = memoizationMap.get(inputValue); - if (memoVal !== void 0) { - return memoVal; - } - const returnValue = []; - memoizationMap.set(inputValue, returnValue); - inputValue.forEach((item3) => { - returnValue.push(_dropUndefinedKeys(item3, memoizationMap)); - }); - return returnValue; - } - return inputValue; -} -__name(_dropUndefinedKeys, "_dropUndefinedKeys"); -function isPojo(input) { - if (!isPlainObject$5(input)) { - return false; - } - try { - const name2 = Object.getPrototypeOf(input).constructor.name; - return !name2 || name2 === "Object"; - } catch (e2) { - return true; - } -} -__name(isPojo, "isPojo"); -function objectify(wat) { - let objectified; - switch (true) { - case wat == void 0: - objectified = new String(wat); - break; - case (typeof wat === "symbol" || typeof wat === "bigint"): - objectified = Object(wat); - break; - case isPrimitive(wat): - objectified = new wat.constructor(wat); - break; - default: - objectified = wat; - break; - } - return objectified; -} -__name(objectify, "objectify"); -const ONE_SECOND_IN_MS = 1e3; -function dateTimestampInSeconds() { - return Date.now() / ONE_SECOND_IN_MS; -} -__name(dateTimestampInSeconds, "dateTimestampInSeconds"); -function createUnixTimestampInSecondsFunc() { - const { performance: performance2 } = GLOBAL_OBJ; - if (!performance2 || !performance2.now) { - return dateTimestampInSeconds; - } - const approxStartingTimeOrigin = Date.now() - performance2.now(); - const timeOrigin = performance2.timeOrigin == void 0 ? approxStartingTimeOrigin : performance2.timeOrigin; - return () => { - return (timeOrigin + performance2.now()) / ONE_SECOND_IN_MS; - }; -} -__name(createUnixTimestampInSecondsFunc, "createUnixTimestampInSecondsFunc"); -const timestampInSeconds = createUnixTimestampInSecondsFunc(); -let _browserPerformanceTimeOriginMode; -const browserPerformanceTimeOrigin = (() => { - const { performance: performance2 } = GLOBAL_OBJ; - if (!performance2 || !performance2.now) { - _browserPerformanceTimeOriginMode = "none"; - return void 0; - } - const threshold = 3600 * 1e3; - const performanceNow = performance2.now(); - const dateNow = Date.now(); - const timeOriginDelta = performance2.timeOrigin ? Math.abs(performance2.timeOrigin + performanceNow - dateNow) : threshold; - const timeOriginIsReliable = timeOriginDelta < threshold; - const navigationStart = performance2.timing && performance2.timing.navigationStart; - const hasNavigationStart = typeof navigationStart === "number"; - const navigationStartDelta = hasNavigationStart ? Math.abs(navigationStart + performanceNow - dateNow) : threshold; - const navigationStartIsReliable = navigationStartDelta < threshold; - if (timeOriginIsReliable || navigationStartIsReliable) { - if (timeOriginDelta <= navigationStartDelta) { - _browserPerformanceTimeOriginMode = "timeOrigin"; - return performance2.timeOrigin; - } else { - _browserPerformanceTimeOriginMode = "navigationStart"; - return navigationStart; - } - } - _browserPerformanceTimeOriginMode = "dateNow"; - return dateNow; -})(); -function uuid4() { - const gbl = GLOBAL_OBJ; - const crypto = gbl.crypto || gbl.msCrypto; - let getRandomByte = /* @__PURE__ */ __name(() => Math.random() * 16, "getRandomByte"); - try { - if (crypto && crypto.randomUUID) { - return crypto.randomUUID().replace(/-/g, ""); - } - if (crypto && crypto.getRandomValues) { - getRandomByte = /* @__PURE__ */ __name(() => { - const typedArray = new Uint8Array(1); - crypto.getRandomValues(typedArray); - return typedArray[0]; - }, "getRandomByte"); - } - } catch (_2) { - } - return ("10000000100040008000" + 1e11).replace( - /[018]/g, - (c2) => ( - // eslint-disable-next-line no-bitwise - (c2 ^ (getRandomByte() & 15) >> c2 / 4).toString(16) - ) - ); -} -__name(uuid4, "uuid4"); -function getFirstException(event) { - return event.exception && event.exception.values ? event.exception.values[0] : void 0; -} -__name(getFirstException, "getFirstException"); -function getEventDescription(event) { - const { message: message3, event_id: eventId } = event; - if (message3) { - return message3; - } - const firstException = getFirstException(event); - if (firstException) { - if (firstException.type && firstException.value) { - return `${firstException.type}: ${firstException.value}`; - } - return firstException.type || firstException.value || eventId || ""; - } - return eventId || ""; -} -__name(getEventDescription, "getEventDescription"); -function addExceptionTypeValue(event, value4, type) { - const exception = event.exception = event.exception || {}; - const values = exception.values = exception.values || []; - const firstException = values[0] = values[0] || {}; - if (!firstException.value) { - firstException.value = value4 || ""; - } - if (!firstException.type) { - firstException.type = type || "Error"; - } -} -__name(addExceptionTypeValue, "addExceptionTypeValue"); -function addExceptionMechanism(event, newMechanism) { - const firstException = getFirstException(event); - if (!firstException) { - return; - } - const defaultMechanism = { type: "generic", handled: true }; - const currentMechanism = firstException.mechanism; - firstException.mechanism = { ...defaultMechanism, ...currentMechanism, ...newMechanism }; - if (newMechanism && "data" in newMechanism) { - const mergedData = { ...currentMechanism && currentMechanism.data, ...newMechanism.data }; - firstException.mechanism.data = mergedData; - } -} -__name(addExceptionMechanism, "addExceptionMechanism"); -const SEMVER_REGEXP = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/; -function _parseInt(input) { - return parseInt(input || "", 10); -} -__name(_parseInt, "_parseInt"); -function parseSemver(input) { - const match2 = input.match(SEMVER_REGEXP) || []; - const major = _parseInt(match2[1]); - const minor = _parseInt(match2[2]); - const patch2 = _parseInt(match2[3]); - return { - buildmetadata: match2[5], - major: isNaN(major) ? void 0 : major, - minor: isNaN(minor) ? void 0 : minor, - patch: isNaN(patch2) ? void 0 : patch2, - prerelease: match2[4] - }; -} -__name(parseSemver, "parseSemver"); -function addContextToFrame(lines, frame, linesOfContext = 5) { - if (frame.lineno === void 0) { - return; - } - const maxLines = lines.length; - const sourceLine = Math.max(Math.min(maxLines - 1, frame.lineno - 1), 0); - frame.pre_context = lines.slice(Math.max(0, sourceLine - linesOfContext), sourceLine).map((line) => snipLine(line, 0)); - const lineIndex = Math.min(maxLines - 1, sourceLine); - frame.context_line = snipLine(lines[lineIndex], frame.colno || 0); - frame.post_context = lines.slice(Math.min(sourceLine + 1, maxLines), sourceLine + 1 + linesOfContext).map((line) => snipLine(line, 0)); -} -__name(addContextToFrame, "addContextToFrame"); -function checkOrSetAlreadyCaught(exception) { - if (isAlreadyCaptured(exception)) { - return true; - } - try { - addNonEnumerableProperty(exception, "__sentry_captured__", true); - } catch (err) { - } - return false; -} -__name(checkOrSetAlreadyCaught, "checkOrSetAlreadyCaught"); -function isAlreadyCaptured(exception) { - try { - return exception.__sentry_captured__; - } catch (e2) { - } -} -__name(isAlreadyCaptured, "isAlreadyCaptured"); -function arrayify(maybeArray) { - return Array.isArray(maybeArray) ? maybeArray : [maybeArray]; -} -__name(arrayify, "arrayify"); -var States; -(function(States2) { - const PENDING = 0; - States2[States2["PENDING"] = PENDING] = "PENDING"; - const RESOLVED = 1; - States2[States2["RESOLVED"] = RESOLVED] = "RESOLVED"; - const REJECTED = 2; - States2[States2["REJECTED"] = REJECTED] = "REJECTED"; -})(States || (States = {})); -function resolvedSyncPromise(value4) { - return new SyncPromise((resolve2) => { - resolve2(value4); - }); -} -__name(resolvedSyncPromise, "resolvedSyncPromise"); -function rejectedSyncPromise(reason) { - return new SyncPromise((_2, reject3) => { - reject3(reason); - }); -} -__name(rejectedSyncPromise, "rejectedSyncPromise"); -class SyncPromise { - static { - __name(this, "SyncPromise"); - } - constructor(executor) { - SyncPromise.prototype.__init.call(this); - SyncPromise.prototype.__init2.call(this); - SyncPromise.prototype.__init3.call(this); - SyncPromise.prototype.__init4.call(this); - this._state = States.PENDING; - this._handlers = []; - try { - executor(this._resolve, this._reject); - } catch (e2) { - this._reject(e2); - } - } - /** JSDoc */ - then(onfulfilled, onrejected) { - return new SyncPromise((resolve2, reject3) => { - this._handlers.push([ - false, - (result) => { - if (!onfulfilled) { - resolve2(result); - } else { - try { - resolve2(onfulfilled(result)); - } catch (e2) { - reject3(e2); - } - } - }, - (reason) => { - if (!onrejected) { - reject3(reason); - } else { - try { - resolve2(onrejected(reason)); - } catch (e2) { - reject3(e2); - } - } - } - ]); - this._executeHandlers(); - }); - } - /** JSDoc */ - catch(onrejected) { - return this.then((val) => val, onrejected); - } - /** JSDoc */ - finally(onfinally) { - return new SyncPromise((resolve2, reject3) => { - let val; - let isRejected; - return this.then( - (value4) => { - isRejected = false; - val = value4; - if (onfinally) { - onfinally(); - } - }, - (reason) => { - isRejected = true; - val = reason; - if (onfinally) { - onfinally(); - } - } - ).then(() => { - if (isRejected) { - reject3(val); - return; - } - resolve2(val); - }); - }); - } - /** JSDoc */ - __init() { - this._resolve = (value4) => { - this._setResult(States.RESOLVED, value4); - }; - } - /** JSDoc */ - __init2() { - this._reject = (reason) => { - this._setResult(States.REJECTED, reason); - }; - } - /** JSDoc */ - __init3() { - this._setResult = (state, value4) => { - if (this._state !== States.PENDING) { - return; - } - if (isThenable$1(value4)) { - void value4.then(this._resolve, this._reject); - return; - } - this._state = state; - this._value = value4; - this._executeHandlers(); - }; - } - /** JSDoc */ - __init4() { - this._executeHandlers = () => { - if (this._state === States.PENDING) { - return; - } - const cachedHandlers = this._handlers.slice(); - this._handlers = []; - cachedHandlers.forEach((handler12) => { - if (handler12[0]) { - return; - } - if (this._state === States.RESOLVED) { - handler12[1](this._value); - } - if (this._state === States.REJECTED) { - handler12[2](this._value); - } - handler12[0] = true; - }); - }; - } -} -function makeSession$1(context) { - const startingTime = timestampInSeconds(); - const session = { - sid: uuid4(), - init: true, - timestamp: startingTime, - started: startingTime, - duration: 0, - status: "ok", - errors: 0, - ignoreDuration: false, - toJSON: /* @__PURE__ */ __name(() => sessionToJSON(session), "toJSON") - }; - if (context) { - updateSession(session, context); - } - return session; -} -__name(makeSession$1, "makeSession$1"); -function updateSession(session, context = {}) { - if (context.user) { - if (!session.ipAddress && context.user.ip_address) { - session.ipAddress = context.user.ip_address; - } - if (!session.did && !context.did) { - session.did = context.user.id || context.user.email || context.user.username; - } - } - session.timestamp = context.timestamp || timestampInSeconds(); - if (context.abnormal_mechanism) { - session.abnormal_mechanism = context.abnormal_mechanism; - } - if (context.ignoreDuration) { - session.ignoreDuration = context.ignoreDuration; - } - if (context.sid) { - session.sid = context.sid.length === 32 ? context.sid : uuid4(); - } - if (context.init !== void 0) { - session.init = context.init; - } - if (!session.did && context.did) { - session.did = `${context.did}`; - } - if (typeof context.started === "number") { - session.started = context.started; - } - if (session.ignoreDuration) { - session.duration = void 0; - } else if (typeof context.duration === "number") { - session.duration = context.duration; - } else { - const duration = session.timestamp - session.started; - session.duration = duration >= 0 ? duration : 0; - } - if (context.release) { - session.release = context.release; - } - if (context.environment) { - session.environment = context.environment; - } - if (!session.ipAddress && context.ipAddress) { - session.ipAddress = context.ipAddress; - } - if (!session.userAgent && context.userAgent) { - session.userAgent = context.userAgent; - } - if (typeof context.errors === "number") { - session.errors = context.errors; - } - if (context.status) { - session.status = context.status; - } -} -__name(updateSession, "updateSession"); -function closeSession(session, status) { - let context = {}; - if (status) { - context = { status }; - } else if (session.status === "ok") { - context = { status: "exited" }; - } - updateSession(session, context); -} -__name(closeSession, "closeSession"); -function sessionToJSON(session) { - return dropUndefinedKeys({ - sid: `${session.sid}`, - init: session.init, - // Make sure that sec is converted to ms for date constructor - started: new Date(session.started * 1e3).toISOString(), - timestamp: new Date(session.timestamp * 1e3).toISOString(), - status: session.status, - errors: session.errors, - did: typeof session.did === "number" || typeof session.did === "string" ? `${session.did}` : void 0, - duration: session.duration, - abnormal_mechanism: session.abnormal_mechanism, - attrs: { - release: session.release, - environment: session.environment, - ip_address: session.ipAddress, - user_agent: session.userAgent - } - }); -} -__name(sessionToJSON, "sessionToJSON"); -function generatePropagationContext() { - return { - traceId: generateTraceId(), - spanId: generateSpanId() - }; -} -__name(generatePropagationContext, "generatePropagationContext"); -function generateTraceId() { - return uuid4(); -} -__name(generateTraceId, "generateTraceId"); -function generateSpanId() { - return uuid4().substring(16); -} -__name(generateSpanId, "generateSpanId"); -function merge$2(initialObj, mergeObj, levels = 2) { - if (!mergeObj || typeof mergeObj !== "object" || levels <= 0) { - return mergeObj; - } - if (initialObj && mergeObj && Object.keys(mergeObj).length === 0) { - return initialObj; - } - const output = { ...initialObj }; - for (const key in mergeObj) { - if (Object.prototype.hasOwnProperty.call(mergeObj, key)) { - output[key] = merge$2(output[key], mergeObj[key], levels - 1); - } - } - return output; -} -__name(merge$2, "merge$2"); -const SCOPE_SPAN_FIELD = "_sentrySpan"; -function _setSpanForScope(scope, span) { - if (span) { - addNonEnumerableProperty(scope, SCOPE_SPAN_FIELD, span); - } else { - delete scope[SCOPE_SPAN_FIELD]; - } -} -__name(_setSpanForScope, "_setSpanForScope"); -function _getSpanForScope(scope) { - return scope[SCOPE_SPAN_FIELD]; -} -__name(_getSpanForScope, "_getSpanForScope"); -const DEFAULT_MAX_BREADCRUMBS = 100; -class ScopeClass { - static { - __name(this, "ScopeClass"); - } - /** Flag if notifying is happening. */ - /** Callback for client to receive scope changes. */ - /** Callback list that will be called during event processing. */ - /** Array of breadcrumbs. */ - /** User */ - /** Tags */ - /** Extra */ - /** Contexts */ - /** Attachments */ - /** Propagation Context for distributed tracing */ - /** - * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get - * sent to Sentry - */ - /** Fingerprint */ - /** Severity */ - /** - * Transaction Name - * - * IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects. - * It's purpose is to assign a transaction to the scope that's added to non-transaction events. - */ - /** Session */ - /** Request Mode Session Status */ - // eslint-disable-next-line deprecation/deprecation - /** The client on this scope */ - /** Contains the last event id of a captured event. */ - // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method. - constructor() { - this._notifyingListeners = false; - this._scopeListeners = []; - this._eventProcessors = []; - this._breadcrumbs = []; - this._attachments = []; - this._user = {}; - this._tags = {}; - this._extra = {}; - this._contexts = {}; - this._sdkProcessingMetadata = {}; - this._propagationContext = { - traceId: generateTraceId(), - spanId: generateSpanId() - }; - } - /** - * @inheritDoc - */ - clone() { - const newScope = new ScopeClass(); - newScope._breadcrumbs = [...this._breadcrumbs]; - newScope._tags = { ...this._tags }; - newScope._extra = { ...this._extra }; - newScope._contexts = { ...this._contexts }; - if (this._contexts.flags) { - newScope._contexts.flags = { - values: [...this._contexts.flags.values] - }; - } - newScope._user = this._user; - newScope._level = this._level; - newScope._session = this._session; - newScope._transactionName = this._transactionName; - newScope._fingerprint = this._fingerprint; - newScope._eventProcessors = [...this._eventProcessors]; - newScope._requestSession = this._requestSession; - newScope._attachments = [...this._attachments]; - newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata }; - newScope._propagationContext = { ...this._propagationContext }; - newScope._client = this._client; - newScope._lastEventId = this._lastEventId; - _setSpanForScope(newScope, _getSpanForScope(this)); - return newScope; - } - /** - * @inheritDoc - */ - setClient(client) { - this._client = client; - } - /** - * @inheritDoc - */ - setLastEventId(lastEventId2) { - this._lastEventId = lastEventId2; - } - /** - * @inheritDoc - */ - getClient() { - return this._client; - } - /** - * @inheritDoc - */ - lastEventId() { - return this._lastEventId; - } - /** - * @inheritDoc - */ - addScopeListener(callback) { - this._scopeListeners.push(callback); - } - /** - * @inheritDoc - */ - addEventProcessor(callback) { - this._eventProcessors.push(callback); - return this; - } - /** - * @inheritDoc - */ - setUser(user) { - this._user = user || { - email: void 0, - id: void 0, - ip_address: void 0, - username: void 0 - }; - if (this._session) { - updateSession(this._session, { user }); - } - this._notifyScopeListeners(); - return this; - } - /** - * @inheritDoc - */ - getUser() { - return this._user; - } - /** - * @inheritDoc - */ - // eslint-disable-next-line deprecation/deprecation - getRequestSession() { - return this._requestSession; - } - /** - * @inheritDoc - */ - // eslint-disable-next-line deprecation/deprecation - setRequestSession(requestSession) { - this._requestSession = requestSession; - return this; - } - /** - * @inheritDoc - */ - setTags(tags) { - this._tags = { - ...this._tags, - ...tags - }; - this._notifyScopeListeners(); - return this; - } - /** - * @inheritDoc - */ - setTag(key, value4) { - this._tags = { ...this._tags, [key]: value4 }; - this._notifyScopeListeners(); - return this; - } - /** - * @inheritDoc - */ - setExtras(extras) { - this._extra = { - ...this._extra, - ...extras - }; - this._notifyScopeListeners(); - return this; - } - /** - * @inheritDoc - */ - setExtra(key, extra) { - this._extra = { ...this._extra, [key]: extra }; - this._notifyScopeListeners(); - return this; - } - /** - * @inheritDoc - */ - setFingerprint(fingerprint) { - this._fingerprint = fingerprint; - this._notifyScopeListeners(); - return this; - } - /** - * @inheritDoc - */ - setLevel(level) { - this._level = level; - this._notifyScopeListeners(); - return this; - } - /** - * @inheritDoc - */ - setTransactionName(name2) { - this._transactionName = name2; - this._notifyScopeListeners(); - return this; - } - /** - * @inheritDoc - */ - setContext(key, context) { - if (context === null) { - delete this._contexts[key]; - } else { - this._contexts[key] = context; - } - this._notifyScopeListeners(); - return this; - } - /** - * @inheritDoc - */ - setSession(session) { - if (!session) { - delete this._session; - } else { - this._session = session; - } - this._notifyScopeListeners(); - return this; - } - /** - * @inheritDoc - */ - getSession() { - return this._session; - } - /** - * @inheritDoc - */ - update(captureContext) { - if (!captureContext) { - return this; - } - const scopeToMerge = typeof captureContext === "function" ? captureContext(this) : captureContext; - const [scopeInstance, requestSession] = scopeToMerge instanceof Scope ? ( - // eslint-disable-next-line deprecation/deprecation - [scopeToMerge.getScopeData(), scopeToMerge.getRequestSession()] - ) : isPlainObject$5(scopeToMerge) ? [captureContext, captureContext.requestSession] : []; - const { tags, extra, user, contexts, level, fingerprint = [], propagationContext } = scopeInstance || {}; - this._tags = { ...this._tags, ...tags }; - this._extra = { ...this._extra, ...extra }; - this._contexts = { ...this._contexts, ...contexts }; - if (user && Object.keys(user).length) { - this._user = user; - } - if (level) { - this._level = level; - } - if (fingerprint.length) { - this._fingerprint = fingerprint; - } - if (propagationContext) { - this._propagationContext = propagationContext; - } - if (requestSession) { - this._requestSession = requestSession; - } - return this; - } - /** - * @inheritDoc - */ - clear() { - this._breadcrumbs = []; - this._tags = {}; - this._extra = {}; - this._user = {}; - this._contexts = {}; - this._level = void 0; - this._transactionName = void 0; - this._fingerprint = void 0; - this._requestSession = void 0; - this._session = void 0; - _setSpanForScope(this, void 0); - this._attachments = []; - this.setPropagationContext({ traceId: generateTraceId() }); - this._notifyScopeListeners(); - return this; - } - /** - * @inheritDoc - */ - addBreadcrumb(breadcrumb, maxBreadcrumbs) { - const maxCrumbs = typeof maxBreadcrumbs === "number" ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS; - if (maxCrumbs <= 0) { - return this; - } - const mergedBreadcrumb = { - timestamp: dateTimestampInSeconds(), - ...breadcrumb - }; - const breadcrumbs = this._breadcrumbs; - breadcrumbs.push(mergedBreadcrumb); - this._breadcrumbs = breadcrumbs.length > maxCrumbs ? breadcrumbs.slice(-maxCrumbs) : breadcrumbs; - this._notifyScopeListeners(); - return this; - } - /** - * @inheritDoc - */ - getLastBreadcrumb() { - return this._breadcrumbs[this._breadcrumbs.length - 1]; - } - /** - * @inheritDoc - */ - clearBreadcrumbs() { - this._breadcrumbs = []; - this._notifyScopeListeners(); - return this; - } - /** - * @inheritDoc - */ - addAttachment(attachment) { - this._attachments.push(attachment); - return this; - } - /** - * @inheritDoc - */ - clearAttachments() { - this._attachments = []; - return this; - } - /** @inheritDoc */ - getScopeData() { - return { - breadcrumbs: this._breadcrumbs, - attachments: this._attachments, - contexts: this._contexts, - tags: this._tags, - extra: this._extra, - user: this._user, - level: this._level, - fingerprint: this._fingerprint || [], - eventProcessors: this._eventProcessors, - propagationContext: this._propagationContext, - sdkProcessingMetadata: this._sdkProcessingMetadata, - transactionName: this._transactionName, - span: _getSpanForScope(this) - }; - } - /** - * @inheritDoc - */ - setSDKProcessingMetadata(newData) { - this._sdkProcessingMetadata = merge$2(this._sdkProcessingMetadata, newData, 2); - return this; - } - /** - * @inheritDoc - */ - setPropagationContext(context) { - this._propagationContext = { - // eslint-disable-next-line deprecation/deprecation - spanId: generateSpanId(), - ...context - }; - return this; - } - /** - * @inheritDoc - */ - getPropagationContext() { - return this._propagationContext; - } - /** - * @inheritDoc - */ - captureException(exception, hint) { - const eventId = hint && hint.event_id ? hint.event_id : uuid4(); - if (!this._client) { - logger$2.warn("No client configured on scope - will not capture exception!"); - return eventId; - } - const syntheticException = new Error("Sentry syntheticException"); - this._client.captureException( - exception, - { - originalException: exception, - syntheticException, - ...hint, - event_id: eventId - }, - this - ); - return eventId; - } - /** - * @inheritDoc - */ - captureMessage(message3, level, hint) { - const eventId = hint && hint.event_id ? hint.event_id : uuid4(); - if (!this._client) { - logger$2.warn("No client configured on scope - will not capture message!"); - return eventId; - } - const syntheticException = new Error(message3); - this._client.captureMessage( - message3, - level, - { - originalException: message3, - syntheticException, - ...hint, - event_id: eventId - }, - this - ); - return eventId; - } - /** - * @inheritDoc - */ - captureEvent(event, hint) { - const eventId = hint && hint.event_id ? hint.event_id : uuid4(); - if (!this._client) { - logger$2.warn("No client configured on scope - will not capture event!"); - return eventId; - } - this._client.captureEvent(event, { ...hint, event_id: eventId }, this); - return eventId; - } - /** - * This will be called on every set call. - */ - _notifyScopeListeners() { - if (!this._notifyingListeners) { - this._notifyingListeners = true; - this._scopeListeners.forEach((callback) => { - callback(this); - }); - this._notifyingListeners = false; - } - } -} -const Scope = ScopeClass; -function getDefaultCurrentScope() { - return getGlobalSingleton("defaultCurrentScope", () => new Scope()); -} -__name(getDefaultCurrentScope, "getDefaultCurrentScope"); -function getDefaultIsolationScope() { - return getGlobalSingleton("defaultIsolationScope", () => new Scope()); -} -__name(getDefaultIsolationScope, "getDefaultIsolationScope"); -class AsyncContextStack { - static { - __name(this, "AsyncContextStack"); - } - constructor(scope, isolationScope) { - let assignedScope; - if (!scope) { - assignedScope = new Scope(); - } else { - assignedScope = scope; - } - let assignedIsolationScope; - if (!isolationScope) { - assignedIsolationScope = new Scope(); - } else { - assignedIsolationScope = isolationScope; - } - this._stack = [{ scope: assignedScope }]; - this._isolationScope = assignedIsolationScope; - } - /** - * Fork a scope for the stack. - */ - withScope(callback) { - const scope = this._pushScope(); - let maybePromiseResult; - try { - maybePromiseResult = callback(scope); - } catch (e2) { - this._popScope(); - throw e2; - } - if (isThenable$1(maybePromiseResult)) { - return maybePromiseResult.then( - (res) => { - this._popScope(); - return res; - }, - (e2) => { - this._popScope(); - throw e2; - } - ); - } - this._popScope(); - return maybePromiseResult; - } - /** - * Get the client of the stack. - */ - getClient() { - return this.getStackTop().client; - } - /** - * Returns the scope of the top stack. - */ - getScope() { - return this.getStackTop().scope; - } - /** - * Get the isolation scope for the stack. - */ - getIsolationScope() { - return this._isolationScope; - } - /** - * Returns the topmost scope layer in the order domain > local > process. - */ - getStackTop() { - return this._stack[this._stack.length - 1]; - } - /** - * Push a scope to the stack. - */ - _pushScope() { - const scope = this.getScope().clone(); - this._stack.push({ - client: this.getClient(), - scope - }); - return scope; - } - /** - * Pop a scope from the stack. - */ - _popScope() { - if (this._stack.length <= 1) return false; - return !!this._stack.pop(); - } -} -function getAsyncContextStack() { - const registry = getMainCarrier(); - const sentry = getSentryCarrier(registry); - return sentry.stack = sentry.stack || new AsyncContextStack(getDefaultCurrentScope(), getDefaultIsolationScope()); -} -__name(getAsyncContextStack, "getAsyncContextStack"); -function withScope$1(callback) { - return getAsyncContextStack().withScope(callback); -} -__name(withScope$1, "withScope$1"); -function withSetScope(scope, callback) { - const stack2 = getAsyncContextStack(); - return stack2.withScope(() => { - stack2.getStackTop().scope = scope; - return callback(scope); - }); -} -__name(withSetScope, "withSetScope"); -function withIsolationScope$1(callback) { - return getAsyncContextStack().withScope(() => { - return callback(getAsyncContextStack().getIsolationScope()); - }); -} -__name(withIsolationScope$1, "withIsolationScope$1"); -function getStackAsyncContextStrategy() { - return { - withIsolationScope: withIsolationScope$1, - withScope: withScope$1, - withSetScope, - withSetIsolationScope: /* @__PURE__ */ __name((_isolationScope, callback) => { - return withIsolationScope$1(callback); - }, "withSetIsolationScope"), - getCurrentScope: /* @__PURE__ */ __name(() => getAsyncContextStack().getScope(), "getCurrentScope"), - getIsolationScope: /* @__PURE__ */ __name(() => getAsyncContextStack().getIsolationScope(), "getIsolationScope") - }; -} -__name(getStackAsyncContextStrategy, "getStackAsyncContextStrategy"); -function setAsyncContextStrategy(strategy) { - const registry = getMainCarrier(); - const sentry = getSentryCarrier(registry); - sentry.acs = strategy; -} -__name(setAsyncContextStrategy, "setAsyncContextStrategy"); -function getAsyncContextStrategy(carrier) { - const sentry = getSentryCarrier(carrier); - if (sentry.acs) { - return sentry.acs; - } - return getStackAsyncContextStrategy(); -} -__name(getAsyncContextStrategy, "getAsyncContextStrategy"); -function getCurrentScope$1() { - const carrier = getMainCarrier(); - const acs = getAsyncContextStrategy(carrier); - return acs.getCurrentScope(); -} -__name(getCurrentScope$1, "getCurrentScope$1"); -function getIsolationScope() { - const carrier = getMainCarrier(); - const acs = getAsyncContextStrategy(carrier); - return acs.getIsolationScope(); -} -__name(getIsolationScope, "getIsolationScope"); -function getGlobalScope() { - return getGlobalSingleton("globalScope", () => new Scope()); -} -__name(getGlobalScope, "getGlobalScope"); -function withScope(...rest) { - const carrier = getMainCarrier(); - const acs = getAsyncContextStrategy(carrier); - if (rest.length === 2) { - const [scope, callback] = rest; - if (!scope) { - return acs.withScope(callback); - } - return acs.withSetScope(scope, callback); - } - return acs.withScope(rest[0]); -} -__name(withScope, "withScope"); -function withIsolationScope(...rest) { - const carrier = getMainCarrier(); - const acs = getAsyncContextStrategy(carrier); - if (rest.length === 2) { - const [isolationScope, callback] = rest; - if (!isolationScope) { - return acs.withIsolationScope(callback); - } - return acs.withSetIsolationScope(isolationScope, callback); - } - return acs.withIsolationScope(rest[0]); -} -__name(withIsolationScope, "withIsolationScope"); -function getClient() { - return getCurrentScope$1().getClient(); -} -__name(getClient, "getClient"); -function getTraceContextFromScope(scope) { - const propagationContext = scope.getPropagationContext(); - const { traceId, spanId, parentSpanId } = propagationContext; - const traceContext = dropUndefinedKeys({ - trace_id: traceId, - span_id: spanId, - parent_span_id: parentSpanId - }); - return traceContext; -} -__name(getTraceContextFromScope, "getTraceContextFromScope"); -const METRICS_SPAN_FIELD = "_sentryMetrics"; -function getMetricSummaryJsonForSpan(span) { - const storage = span[METRICS_SPAN_FIELD]; - if (!storage) { - return void 0; - } - const output = {}; - for (const [, [exportKey, summary]] of storage) { - const arr = output[exportKey] || (output[exportKey] = []); - arr.push(dropUndefinedKeys(summary)); - } - return output; -} -__name(getMetricSummaryJsonForSpan, "getMetricSummaryJsonForSpan"); -function updateMetricSummaryOnSpan(span, metricType, sanitizedName, value4, unit, tags, bucketKey) { - const existingStorage = span[METRICS_SPAN_FIELD]; - const storage = existingStorage || (span[METRICS_SPAN_FIELD] = /* @__PURE__ */ new Map()); - const exportKey = `${metricType}:${sanitizedName}@${unit}`; - const bucketItem = storage.get(bucketKey); - if (bucketItem) { - const [, summary] = bucketItem; - storage.set(bucketKey, [ - exportKey, - { - min: Math.min(summary.min, value4), - max: Math.max(summary.max, value4), - count: summary.count += 1, - sum: summary.sum += value4, - tags: summary.tags - } - ]); - } else { - storage.set(bucketKey, [ - exportKey, - { - min: value4, - max: value4, - count: 1, - sum: value4, - tags - } - ]); - } -} -__name(updateMetricSummaryOnSpan, "updateMetricSummaryOnSpan"); -const SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = "sentry.source"; -const SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE = "sentry.sample_rate"; -const SEMANTIC_ATTRIBUTE_SENTRY_OP = "sentry.op"; -const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = "sentry.origin"; -const SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON = "sentry.idle_span_finish_reason"; -const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT = "sentry.measurement_unit"; -const SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE = "sentry.measurement_value"; -const SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME = "sentry.custom_span_name"; -const SEMANTIC_ATTRIBUTE_PROFILE_ID = "sentry.profile_id"; -const SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME = "sentry.exclusive_time"; -const SEMANTIC_ATTRIBUTE_CACHE_HIT = "cache.hit"; -const SEMANTIC_ATTRIBUTE_CACHE_KEY = "cache.key"; -const SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE = "cache.item_size"; -const SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD = "http.request.method"; -const SEMANTIC_ATTRIBUTE_URL_FULL = "url.full"; -const SPAN_STATUS_UNSET = 0; -const SPAN_STATUS_OK = 1; -const SPAN_STATUS_ERROR = 2; -function getSpanStatusFromHttpCode(httpStatus) { - if (httpStatus < 400 && httpStatus >= 100) { - return { code: SPAN_STATUS_OK }; - } - if (httpStatus >= 400 && httpStatus < 500) { - switch (httpStatus) { - case 401: - return { code: SPAN_STATUS_ERROR, message: "unauthenticated" }; - case 403: - return { code: SPAN_STATUS_ERROR, message: "permission_denied" }; - case 404: - return { code: SPAN_STATUS_ERROR, message: "not_found" }; - case 409: - return { code: SPAN_STATUS_ERROR, message: "already_exists" }; - case 413: - return { code: SPAN_STATUS_ERROR, message: "failed_precondition" }; - case 429: - return { code: SPAN_STATUS_ERROR, message: "resource_exhausted" }; - case 499: - return { code: SPAN_STATUS_ERROR, message: "cancelled" }; - default: - return { code: SPAN_STATUS_ERROR, message: "invalid_argument" }; - } - } - if (httpStatus >= 500 && httpStatus < 600) { - switch (httpStatus) { - case 501: - return { code: SPAN_STATUS_ERROR, message: "unimplemented" }; - case 503: - return { code: SPAN_STATUS_ERROR, message: "unavailable" }; - case 504: - return { code: SPAN_STATUS_ERROR, message: "deadline_exceeded" }; - default: - return { code: SPAN_STATUS_ERROR, message: "internal_error" }; - } - } - return { code: SPAN_STATUS_ERROR, message: "unknown_error" }; -} -__name(getSpanStatusFromHttpCode, "getSpanStatusFromHttpCode"); -function setHttpStatus(span, httpStatus) { - span.setAttribute("http.response.status_code", httpStatus); - const spanStatus = getSpanStatusFromHttpCode(httpStatus); - if (spanStatus.message !== "unknown_error") { - span.setStatus(spanStatus); - } -} -__name(setHttpStatus, "setHttpStatus"); -const BAGGAGE_HEADER_NAME = "baggage"; -const SENTRY_BAGGAGE_KEY_PREFIX = "sentry-"; -const SENTRY_BAGGAGE_KEY_PREFIX_REGEX = /^sentry-/; -const MAX_BAGGAGE_STRING_LENGTH = 8192; -function baggageHeaderToDynamicSamplingContext(baggageHeader) { - const baggageObject = parseBaggageHeader(baggageHeader); - if (!baggageObject) { - return void 0; - } - const dynamicSamplingContext = Object.entries(baggageObject).reduce((acc, [key, value4]) => { - if (key.match(SENTRY_BAGGAGE_KEY_PREFIX_REGEX)) { - const nonPrefixedKey = key.slice(SENTRY_BAGGAGE_KEY_PREFIX.length); - acc[nonPrefixedKey] = value4; - } - return acc; - }, {}); - if (Object.keys(dynamicSamplingContext).length > 0) { - return dynamicSamplingContext; - } else { - return void 0; - } -} -__name(baggageHeaderToDynamicSamplingContext, "baggageHeaderToDynamicSamplingContext"); -function dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext) { - if (!dynamicSamplingContext) { - return void 0; - } - const sentryPrefixedDSC = Object.entries(dynamicSamplingContext).reduce( - (acc, [dscKey, dscValue]) => { - if (dscValue) { - acc[`${SENTRY_BAGGAGE_KEY_PREFIX}${dscKey}`] = dscValue; - } - return acc; - }, - {} - ); - return objectToBaggageHeader(sentryPrefixedDSC); -} -__name(dynamicSamplingContextToSentryBaggageHeader, "dynamicSamplingContextToSentryBaggageHeader"); -function parseBaggageHeader(baggageHeader) { - if (!baggageHeader || !isString$a(baggageHeader) && !Array.isArray(baggageHeader)) { - return void 0; - } - if (Array.isArray(baggageHeader)) { - return baggageHeader.reduce((acc, curr) => { - const currBaggageObject = baggageHeaderToObject(curr); - Object.entries(currBaggageObject).forEach(([key, value4]) => { - acc[key] = value4; - }); - return acc; - }, {}); - } - return baggageHeaderToObject(baggageHeader); -} -__name(parseBaggageHeader, "parseBaggageHeader"); -function baggageHeaderToObject(baggageHeader) { - return baggageHeader.split(",").map((baggageEntry) => baggageEntry.split("=").map((keyOrValue) => decodeURIComponent(keyOrValue.trim()))).reduce((acc, [key, value4]) => { - if (key && value4) { - acc[key] = value4; - } - return acc; - }, {}); -} -__name(baggageHeaderToObject, "baggageHeaderToObject"); -function objectToBaggageHeader(object) { - if (Object.keys(object).length === 0) { - return void 0; - } - return Object.entries(object).reduce((baggageHeader, [objectKey, objectValue], currentIndex) => { - const baggageEntry = `${encodeURIComponent(objectKey)}=${encodeURIComponent(objectValue)}`; - const newBaggageHeader = currentIndex === 0 ? baggageEntry : `${baggageHeader},${baggageEntry}`; - if (newBaggageHeader.length > MAX_BAGGAGE_STRING_LENGTH) { - DEBUG_BUILD$5 && logger$2.warn( - `Not adding key: ${objectKey} with val: ${objectValue} to baggage header due to exceeding baggage size limits.` - ); - return baggageHeader; - } else { - return newBaggageHeader; - } - }, ""); -} -__name(objectToBaggageHeader, "objectToBaggageHeader"); -const TRACEPARENT_REGEXP = new RegExp( - "^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$" - // whitespace -); -function extractTraceparentData(traceparent) { - if (!traceparent) { - return void 0; - } - const matches2 = traceparent.match(TRACEPARENT_REGEXP); - if (!matches2) { - return void 0; - } - let parentSampled; - if (matches2[3] === "1") { - parentSampled = true; - } else if (matches2[3] === "0") { - parentSampled = false; - } - return { - traceId: matches2[1], - parentSampled, - parentSpanId: matches2[2] - }; -} -__name(extractTraceparentData, "extractTraceparentData"); -function propagationContextFromHeaders(sentryTrace, baggage) { - const traceparentData = extractTraceparentData(sentryTrace); - const dynamicSamplingContext = baggageHeaderToDynamicSamplingContext(baggage); - if (!traceparentData || !traceparentData.traceId) { - return { traceId: generateTraceId(), spanId: generateSpanId() }; - } - const { traceId, parentSpanId, parentSampled } = traceparentData; - const virtualSpanId = generateSpanId(); - return { - traceId, - parentSpanId, - spanId: virtualSpanId, - sampled: parentSampled, - dsc: dynamicSamplingContext || {} - // If we have traceparent data but no DSC it means we are not head of trace and we must freeze it - }; -} -__name(propagationContextFromHeaders, "propagationContextFromHeaders"); -function generateSentryTraceHeader(traceId = generateTraceId(), spanId = generateSpanId(), sampled) { - let sampledString = ""; - if (sampled !== void 0) { - sampledString = sampled ? "-1" : "-0"; - } - return `${traceId}-${spanId}${sampledString}`; -} -__name(generateSentryTraceHeader, "generateSentryTraceHeader"); -const TRACE_FLAG_NONE = 0; -const TRACE_FLAG_SAMPLED = 1; -let hasShownSpanDropWarning = false; -function spanToTransactionTraceContext(span) { - const { spanId: span_id, traceId: trace_id } = span.spanContext(); - const { data: data26, op, parent_span_id, status, origin: origin2 } = spanToJSON(span); - return dropUndefinedKeys({ - parent_span_id, - span_id, - trace_id, - data: data26, - op, - status, - origin: origin2 - }); -} -__name(spanToTransactionTraceContext, "spanToTransactionTraceContext"); -function spanToTraceContext(span) { - const { spanId, traceId: trace_id, isRemote } = span.spanContext(); - const parent_span_id = isRemote ? spanId : spanToJSON(span).parent_span_id; - const span_id = isRemote ? generateSpanId() : spanId; - return dropUndefinedKeys({ - parent_span_id, - span_id, - trace_id - }); -} -__name(spanToTraceContext, "spanToTraceContext"); -function spanToTraceHeader(span) { - const { traceId, spanId } = span.spanContext(); - const sampled = spanIsSampled(span); - return generateSentryTraceHeader(traceId, spanId, sampled); -} -__name(spanToTraceHeader, "spanToTraceHeader"); -function spanTimeInputToSeconds(input) { - if (typeof input === "number") { - return ensureTimestampInSeconds(input); - } - if (Array.isArray(input)) { - return input[0] + input[1] / 1e9; - } - if (input instanceof Date) { - return ensureTimestampInSeconds(input.getTime()); - } - return timestampInSeconds(); -} -__name(spanTimeInputToSeconds, "spanTimeInputToSeconds"); -function ensureTimestampInSeconds(timestamp2) { - const isMs = timestamp2 > 9999999999; - return isMs ? timestamp2 / 1e3 : timestamp2; -} -__name(ensureTimestampInSeconds, "ensureTimestampInSeconds"); -function spanToJSON(span) { - if (spanIsSentrySpan(span)) { - return span.getSpanJSON(); - } - try { - const { spanId: span_id, traceId: trace_id } = span.spanContext(); - if (spanIsOpenTelemetrySdkTraceBaseSpan(span)) { - const { attributes, startTime, name: name2, endTime, parentSpanId, status } = span; - return dropUndefinedKeys({ - span_id, - trace_id, - data: attributes, - description: name2, - parent_span_id: parentSpanId, - start_timestamp: spanTimeInputToSeconds(startTime), - // This is [0,0] by default in OTEL, in which case we want to interpret this as no end time - timestamp: spanTimeInputToSeconds(endTime) || void 0, - status: getStatusMessage(status), - op: attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP], - origin: attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN], - _metrics_summary: getMetricSummaryJsonForSpan(span) - }); - } - return { - span_id, - trace_id - }; - } catch (e2) { - return {}; - } -} -__name(spanToJSON, "spanToJSON"); -function spanIsOpenTelemetrySdkTraceBaseSpan(span) { - const castSpan = span; - return !!castSpan.attributes && !!castSpan.startTime && !!castSpan.name && !!castSpan.endTime && !!castSpan.status; -} -__name(spanIsOpenTelemetrySdkTraceBaseSpan, "spanIsOpenTelemetrySdkTraceBaseSpan"); -function spanIsSentrySpan(span) { - return typeof span.getSpanJSON === "function"; -} -__name(spanIsSentrySpan, "spanIsSentrySpan"); -function spanIsSampled(span) { - const { traceFlags } = span.spanContext(); - return traceFlags === TRACE_FLAG_SAMPLED; -} -__name(spanIsSampled, "spanIsSampled"); -function getStatusMessage(status) { - if (!status || status.code === SPAN_STATUS_UNSET) { - return void 0; - } - if (status.code === SPAN_STATUS_OK) { - return "ok"; - } - return status.message || "unknown_error"; -} -__name(getStatusMessage, "getStatusMessage"); -const CHILD_SPANS_FIELD = "_sentryChildSpans"; -const ROOT_SPAN_FIELD = "_sentryRootSpan"; -function addChildSpanToSpan(span, childSpan) { - const rootSpan = span[ROOT_SPAN_FIELD] || span; - addNonEnumerableProperty(childSpan, ROOT_SPAN_FIELD, rootSpan); - if (span[CHILD_SPANS_FIELD]) { - span[CHILD_SPANS_FIELD].add(childSpan); - } else { - addNonEnumerableProperty(span, CHILD_SPANS_FIELD, /* @__PURE__ */ new Set([childSpan])); - } -} -__name(addChildSpanToSpan, "addChildSpanToSpan"); -function removeChildSpanFromSpan(span, childSpan) { - if (span[CHILD_SPANS_FIELD]) { - span[CHILD_SPANS_FIELD].delete(childSpan); - } -} -__name(removeChildSpanFromSpan, "removeChildSpanFromSpan"); -function getSpanDescendants(span) { - const resultSet = /* @__PURE__ */ new Set(); - function addSpanChildren(span2) { - if (resultSet.has(span2)) { - return; - } else if (spanIsSampled(span2)) { - resultSet.add(span2); - const childSpans = span2[CHILD_SPANS_FIELD] ? Array.from(span2[CHILD_SPANS_FIELD]) : []; - for (const childSpan of childSpans) { - addSpanChildren(childSpan); - } - } - } - __name(addSpanChildren, "addSpanChildren"); - addSpanChildren(span); - return Array.from(resultSet); -} -__name(getSpanDescendants, "getSpanDescendants"); -function getRootSpan(span) { - return span[ROOT_SPAN_FIELD] || span; -} -__name(getRootSpan, "getRootSpan"); -function getActiveSpan() { - const carrier = getMainCarrier(); - const acs = getAsyncContextStrategy(carrier); - if (acs.getActiveSpan) { - return acs.getActiveSpan(); - } - return _getSpanForScope(getCurrentScope$1()); -} -__name(getActiveSpan, "getActiveSpan"); -function updateMetricSummaryOnActiveSpan(metricType, sanitizedName, value4, unit, tags, bucketKey) { - const span = getActiveSpan(); - if (span) { - updateMetricSummaryOnSpan(span, metricType, sanitizedName, value4, unit, tags, bucketKey); - } -} -__name(updateMetricSummaryOnActiveSpan, "updateMetricSummaryOnActiveSpan"); -function showSpanDropWarning() { - if (!hasShownSpanDropWarning) { - consoleSandbox(() => { - console.warn( - "[Sentry] Deprecation warning: Returning null from `beforeSendSpan` will be disallowed from SDK version 9.0.0 onwards. The callback will only support mutating spans. To drop certain spans, configure the respective integrations directly." - ); - }); - hasShownSpanDropWarning = true; - } -} -__name(showSpanDropWarning, "showSpanDropWarning"); -function updateSpanName(span, name2) { - span.updateName(name2); - span.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "custom", - [SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]: name2 - }); -} -__name(updateSpanName, "updateSpanName"); -let errorsInstrumented = false; -function registerSpanErrorInstrumentation() { - if (errorsInstrumented) { - return; - } - errorsInstrumented = true; - addGlobalErrorInstrumentationHandler(errorCallback); - addGlobalUnhandledRejectionInstrumentationHandler(errorCallback); -} -__name(registerSpanErrorInstrumentation, "registerSpanErrorInstrumentation"); -function errorCallback() { - const activeSpan = getActiveSpan(); - const rootSpan = activeSpan && getRootSpan(activeSpan); - if (rootSpan) { - const message3 = "internal_error"; - DEBUG_BUILD$6 && logger$2.log(`[Tracing] Root span: ${message3} -> Global error occurred`); - rootSpan.setStatus({ code: SPAN_STATUS_ERROR, message: message3 }); - } -} -__name(errorCallback, "errorCallback"); -errorCallback.tag = "sentry_tracingErrorCallback"; -const SCOPE_ON_START_SPAN_FIELD = "_sentryScope"; -const ISOLATION_SCOPE_ON_START_SPAN_FIELD = "_sentryIsolationScope"; -function setCapturedScopesOnSpan(span, scope, isolationScope) { - if (span) { - addNonEnumerableProperty(span, ISOLATION_SCOPE_ON_START_SPAN_FIELD, isolationScope); - addNonEnumerableProperty(span, SCOPE_ON_START_SPAN_FIELD, scope); - } -} -__name(setCapturedScopesOnSpan, "setCapturedScopesOnSpan"); -function getCapturedScopesOnSpan(span) { - return { - scope: span[SCOPE_ON_START_SPAN_FIELD], - isolationScope: span[ISOLATION_SCOPE_ON_START_SPAN_FIELD] - }; -} -__name(getCapturedScopesOnSpan, "getCapturedScopesOnSpan"); -function addTracingExtensions() { - registerSpanErrorInstrumentation(); -} -__name(addTracingExtensions, "addTracingExtensions"); -function hasTracingEnabled(maybeOptions) { - if (typeof __SENTRY_TRACING__ === "boolean" && !__SENTRY_TRACING__) { - return false; - } - const client = getClient(); - const options4 = maybeOptions || client && client.getOptions(); - return !!options4 && (options4.enableTracing || "tracesSampleRate" in options4 || "tracesSampler" in options4); -} -__name(hasTracingEnabled, "hasTracingEnabled"); -class SentryNonRecordingSpan { - static { - __name(this, "SentryNonRecordingSpan"); - } - constructor(spanContext = {}) { - this._traceId = spanContext.traceId || generateTraceId(); - this._spanId = spanContext.spanId || generateSpanId(); - } - /** @inheritdoc */ - spanContext() { - return { - spanId: this._spanId, - traceId: this._traceId, - traceFlags: TRACE_FLAG_NONE - }; - } - /** @inheritdoc */ - // eslint-disable-next-line @typescript-eslint/no-empty-function - end(_timestamp) { - } - /** @inheritdoc */ - setAttribute(_key, _value) { - return this; - } - /** @inheritdoc */ - setAttributes(_values) { - return this; - } - /** @inheritdoc */ - setStatus(_status) { - return this; - } - /** @inheritdoc */ - updateName(_name) { - return this; - } - /** @inheritdoc */ - isRecording() { - return false; - } - /** @inheritdoc */ - addEvent(_name, _attributesOrStartTime, _startTime) { - return this; - } - /** - * This should generally not be used, - * but we need it for being compliant with the OTEL Span interface. - * - * @hidden - * @internal - */ - addLink(_link) { - return this; - } - /** - * This should generally not be used, - * but we need it for being compliant with the OTEL Span interface. - * - * @hidden - * @internal - */ - addLinks(_links) { - return this; - } - /** - * This should generally not be used, - * but we need it for being compliant with the OTEL Span interface. - * - * @hidden - * @internal - */ - recordException(_exception, _time) { - } -} -function handleCallbackErrors(fn, onError, onFinally = () => { -}) { - let maybePromiseResult; - try { - maybePromiseResult = fn(); - } catch (e2) { - onError(e2); - onFinally(); - throw e2; - } - return maybeHandlePromiseRejection(maybePromiseResult, onError, onFinally); -} -__name(handleCallbackErrors, "handleCallbackErrors"); -function maybeHandlePromiseRejection(value4, onError, onFinally) { - if (isThenable$1(value4)) { - return value4.then( - (res) => { - onFinally(); - return res; - }, - (e2) => { - onError(e2); - onFinally(); - throw e2; - } - ); - } - onFinally(); - return value4; -} -__name(maybeHandlePromiseRejection, "maybeHandlePromiseRejection"); -const DEFAULT_ENVIRONMENT = "production"; -const FROZEN_DSC_FIELD = "_frozenDsc"; -function freezeDscOnSpan(span, dsc) { - const spanWithMaybeDsc = span; - addNonEnumerableProperty(spanWithMaybeDsc, FROZEN_DSC_FIELD, dsc); -} -__name(freezeDscOnSpan, "freezeDscOnSpan"); -function getDynamicSamplingContextFromClient(trace_id, client) { - const options4 = client.getOptions(); - const { publicKey: public_key } = client.getDsn() || {}; - const dsc = dropUndefinedKeys({ - environment: options4.environment || DEFAULT_ENVIRONMENT, - release: options4.release, - public_key, - trace_id - }); - client.emit("createDsc", dsc); - return dsc; -} -__name(getDynamicSamplingContextFromClient, "getDynamicSamplingContextFromClient"); -function getDynamicSamplingContextFromScope(client, scope) { - const propagationContext = scope.getPropagationContext(); - return propagationContext.dsc || getDynamicSamplingContextFromClient(propagationContext.traceId, client); -} -__name(getDynamicSamplingContextFromScope, "getDynamicSamplingContextFromScope"); -function getDynamicSamplingContextFromSpan(span) { - const client = getClient(); - if (!client) { - return {}; - } - const rootSpan = getRootSpan(span); - const frozenDsc = rootSpan[FROZEN_DSC_FIELD]; - if (frozenDsc) { - return frozenDsc; - } - const traceState = rootSpan.spanContext().traceState; - const traceStateDsc = traceState && traceState.get("sentry.dsc"); - const dscOnTraceState = traceStateDsc && baggageHeaderToDynamicSamplingContext(traceStateDsc); - if (dscOnTraceState) { - return dscOnTraceState; - } - const dsc = getDynamicSamplingContextFromClient(span.spanContext().traceId, client); - const jsonSpan = spanToJSON(rootSpan); - const attributes = jsonSpan.data || {}; - const maybeSampleRate = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]; - if (maybeSampleRate != null) { - dsc.sample_rate = `${maybeSampleRate}`; - } - const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; - const name2 = jsonSpan.description; - if (source !== "url" && name2) { - dsc.transaction = name2; - } - if (hasTracingEnabled()) { - dsc.sampled = String(spanIsSampled(rootSpan)); - } - client.emit("createDsc", dsc, rootSpan); - return dsc; -} -__name(getDynamicSamplingContextFromSpan, "getDynamicSamplingContextFromSpan"); -function spanToBaggageHeader(span) { - const dsc = getDynamicSamplingContextFromSpan(span); - return dynamicSamplingContextToSentryBaggageHeader(dsc); -} -__name(spanToBaggageHeader, "spanToBaggageHeader"); -function logSpanStart(span) { - if (!DEBUG_BUILD$6) return; - const { description = "< unknown name >", op = "< unknown op >", parent_span_id: parentSpanId } = spanToJSON(span); - const { spanId } = span.spanContext(); - const sampled = spanIsSampled(span); - const rootSpan = getRootSpan(span); - const isRootSpan = rootSpan === span; - const header3 = `[Tracing] Starting ${sampled ? "sampled" : "unsampled"} ${isRootSpan ? "root " : ""}span`; - const infoParts = [`op: ${op}`, `name: ${description}`, `ID: ${spanId}`]; - if (parentSpanId) { - infoParts.push(`parent ID: ${parentSpanId}`); - } - if (!isRootSpan) { - const { op: op2, description: description2 } = spanToJSON(rootSpan); - infoParts.push(`root ID: ${rootSpan.spanContext().spanId}`); - if (op2) { - infoParts.push(`root op: ${op2}`); - } - if (description2) { - infoParts.push(`root description: ${description2}`); - } - } - logger$2.log(`${header3} - ${infoParts.join("\n ")}`); -} -__name(logSpanStart, "logSpanStart"); -function logSpanEnd(span) { - if (!DEBUG_BUILD$6) return; - const { description = "< unknown name >", op = "< unknown op >" } = spanToJSON(span); - const { spanId } = span.spanContext(); - const rootSpan = getRootSpan(span); - const isRootSpan = rootSpan === span; - const msg = `[Tracing] Finishing "${op}" ${isRootSpan ? "root " : ""}span "${description}" with ID ${spanId}`; - logger$2.log(msg); -} -__name(logSpanEnd, "logSpanEnd"); -function parseSampleRate(sampleRate) { - if (typeof sampleRate === "boolean") { - return Number(sampleRate); - } - const rate = typeof sampleRate === "string" ? parseFloat(sampleRate) : sampleRate; - if (typeof rate !== "number" || isNaN(rate) || rate < 0 || rate > 1) { - DEBUG_BUILD$6 && logger$2.warn( - `[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify( - sampleRate - )} of type ${JSON.stringify(typeof sampleRate)}.` - ); - return void 0; - } - return rate; -} -__name(parseSampleRate, "parseSampleRate"); -function sampleSpan(options4, samplingContext) { - if (!hasTracingEnabled(options4)) { - return [false]; - } - const normalizedRequest = getIsolationScope().getScopeData().sdkProcessingMetadata.normalizedRequest; - const enhancedSamplingContext = { - ...samplingContext, - normalizedRequest: samplingContext.normalizedRequest || normalizedRequest - }; - let sampleRate; - if (typeof options4.tracesSampler === "function") { - sampleRate = options4.tracesSampler(enhancedSamplingContext); - } else if (enhancedSamplingContext.parentSampled !== void 0) { - sampleRate = enhancedSamplingContext.parentSampled; - } else if (typeof options4.tracesSampleRate !== "undefined") { - sampleRate = options4.tracesSampleRate; - } else { - sampleRate = 1; - } - const parsedSampleRate = parseSampleRate(sampleRate); - if (parsedSampleRate === void 0) { - DEBUG_BUILD$6 && logger$2.warn("[Tracing] Discarding transaction because of invalid sample rate."); - return [false]; - } - if (!parsedSampleRate) { - DEBUG_BUILD$6 && logger$2.log( - `[Tracing] Discarding transaction because ${typeof options4.tracesSampler === "function" ? "tracesSampler returned 0 or false" : "a negative sampling decision was inherited or tracesSampleRate is set to 0"}` - ); - return [false, parsedSampleRate]; - } - const shouldSample = Math.random() < parsedSampleRate; - if (!shouldSample) { - DEBUG_BUILD$6 && logger$2.log( - `[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number( - sampleRate - )})` - ); - return [false, parsedSampleRate]; - } - return [true, parsedSampleRate]; -} -__name(sampleSpan, "sampleSpan"); -const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/; -function isValidProtocol(protocol) { - return protocol === "http" || protocol === "https"; -} -__name(isValidProtocol, "isValidProtocol"); -function dsnToString(dsn, withPassword = false) { - const { host, path, pass, port, projectId, protocol, publicKey } = dsn; - return `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ""}@${host}${port ? `:${port}` : ""}/${path ? `${path}/` : path}${projectId}`; -} -__name(dsnToString, "dsnToString"); -function dsnFromString(str) { - const match2 = DSN_REGEX.exec(str); - if (!match2) { - consoleSandbox(() => { - console.error(`Invalid Sentry Dsn: ${str}`); - }); - return void 0; - } - const [protocol, publicKey, pass = "", host = "", port = "", lastPath = ""] = match2.slice(1); - let path = ""; - let projectId = lastPath; - const split2 = projectId.split("/"); - if (split2.length > 1) { - path = split2.slice(0, -1).join("/"); - projectId = split2.pop(); - } - if (projectId) { - const projectMatch = projectId.match(/^\d+/); - if (projectMatch) { - projectId = projectMatch[0]; - } - } - return dsnFromComponents({ host, pass, path, projectId, port, protocol, publicKey }); -} -__name(dsnFromString, "dsnFromString"); -function dsnFromComponents(components) { - return { - protocol: components.protocol, - publicKey: components.publicKey || "", - pass: components.pass || "", - host: components.host, - port: components.port || "", - path: components.path || "", - projectId: components.projectId - }; -} -__name(dsnFromComponents, "dsnFromComponents"); -function validateDsn(dsn) { - if (!DEBUG_BUILD$5) { - return true; - } - const { port, projectId, protocol } = dsn; - const requiredComponents = ["protocol", "publicKey", "host", "projectId"]; - const hasMissingRequiredComponent = requiredComponents.find((component) => { - if (!dsn[component]) { - logger$2.error(`Invalid Sentry Dsn: ${component} missing`); - return true; - } - return false; - }); - if (hasMissingRequiredComponent) { - return false; - } - if (!projectId.match(/^\d+$/)) { - logger$2.error(`Invalid Sentry Dsn: Invalid projectId ${projectId}`); - return false; - } - if (!isValidProtocol(protocol)) { - logger$2.error(`Invalid Sentry Dsn: Invalid protocol ${protocol}`); - return false; - } - if (port && isNaN(parseInt(port, 10))) { - logger$2.error(`Invalid Sentry Dsn: Invalid port ${port}`); - return false; - } - return true; -} -__name(validateDsn, "validateDsn"); -function makeDsn(from2) { - const components = typeof from2 === "string" ? dsnFromString(from2) : dsnFromComponents(from2); - if (!components || !validateDsn(components)) { - return void 0; - } - return components; -} -__name(makeDsn, "makeDsn"); -function memoBuilder() { - const hasWeakSet = typeof WeakSet === "function"; - const inner = hasWeakSet ? /* @__PURE__ */ new WeakSet() : []; - function memoize(obj) { - if (hasWeakSet) { - if (inner.has(obj)) { - return true; - } - inner.add(obj); - return false; - } - for (let i2 = 0; i2 < inner.length; i2++) { - const value4 = inner[i2]; - if (value4 === obj) { - return true; - } - } - inner.push(obj); - return false; - } - __name(memoize, "memoize"); - function unmemoize(obj) { - if (hasWeakSet) { - inner.delete(obj); - } else { - for (let i2 = 0; i2 < inner.length; i2++) { - if (inner[i2] === obj) { - inner.splice(i2, 1); - break; - } - } - } - } - __name(unmemoize, "unmemoize"); - return [memoize, unmemoize]; -} -__name(memoBuilder, "memoBuilder"); -function normalize$2(input, depth = 100, maxProperties = Infinity) { - try { - return visit("", input, depth, maxProperties); - } catch (err) { - return { ERROR: `**non-serializable** (${err})` }; - } -} -__name(normalize$2, "normalize$2"); -function normalizeToSize(object, depth = 3, maxSize = 100 * 1024) { - const normalized = normalize$2(object, depth); - if (jsonSize(normalized) > maxSize) { - return normalizeToSize(object, depth - 1, maxSize); - } - return normalized; -} -__name(normalizeToSize, "normalizeToSize"); -function visit(key, value4, depth = Infinity, maxProperties = Infinity, memo = memoBuilder()) { - const [memoize, unmemoize] = memo; - if (value4 == null || // this matches null and undefined -> eqeq not eqeqeq - ["boolean", "string"].includes(typeof value4) || typeof value4 === "number" && Number.isFinite(value4)) { - return value4; - } - const stringified = stringifyValue(key, value4); - if (!stringified.startsWith("[object ")) { - return stringified; - } - if (value4["__sentry_skip_normalization__"]) { - return value4; - } - const remainingDepth = typeof value4["__sentry_override_normalization_depth__"] === "number" ? value4["__sentry_override_normalization_depth__"] : depth; - if (remainingDepth === 0) { - return stringified.replace("object ", ""); - } - if (memoize(value4)) { - return "[Circular ~]"; - } - const valueWithToJSON = value4; - if (valueWithToJSON && typeof valueWithToJSON.toJSON === "function") { - try { - const jsonValue = valueWithToJSON.toJSON(); - return visit("", jsonValue, remainingDepth - 1, maxProperties, memo); - } catch (err) { - } - } - const normalized = Array.isArray(value4) ? [] : {}; - let numAdded = 0; - const visitable = convertToPlainObject(value4); - for (const visitKey in visitable) { - if (!Object.prototype.hasOwnProperty.call(visitable, visitKey)) { - continue; - } - if (numAdded >= maxProperties) { - normalized[visitKey] = "[MaxProperties ~]"; - break; - } - const visitValue = visitable[visitKey]; - normalized[visitKey] = visit(visitKey, visitValue, remainingDepth - 1, maxProperties, memo); - numAdded++; - } - unmemoize(value4); - return normalized; -} -__name(visit, "visit"); -function stringifyValue(key, value4) { - try { - if (key === "domain" && value4 && typeof value4 === "object" && value4._events) { - return "[Domain]"; - } - if (key === "domainEmitter") { - return "[DomainEmitter]"; - } - if (typeof global !== "undefined" && value4 === global) { - return "[Global]"; - } - if (typeof window !== "undefined" && value4 === window) { - return "[Window]"; - } - if (typeof document !== "undefined" && value4 === document) { - return "[Document]"; - } - if (isVueViewModel(value4)) { - return "[VueViewModel]"; - } - if (isSyntheticEvent(value4)) { - return "[SyntheticEvent]"; - } - if (typeof value4 === "number" && !Number.isFinite(value4)) { - return `[${value4}]`; - } - if (typeof value4 === "function") { - return `[Function: ${getFunctionName(value4)}]`; - } - if (typeof value4 === "symbol") { - return `[${String(value4)}]`; - } - if (typeof value4 === "bigint") { - return `[BigInt: ${String(value4)}]`; - } - const objName = getConstructorName(value4); - if (/^HTML(\w*)Element$/.test(objName)) { - return `[HTMLElement: ${objName}]`; - } - return `[object ${objName}]`; - } catch (err) { - return `**non-serializable** (${err})`; - } -} -__name(stringifyValue, "stringifyValue"); -function getConstructorName(value4) { - const prototype2 = Object.getPrototypeOf(value4); - return prototype2 ? prototype2.constructor.name : "null prototype"; -} -__name(getConstructorName, "getConstructorName"); -function utf8Length(value4) { - return ~-encodeURI(value4).split(/%..|./).length; -} -__name(utf8Length, "utf8Length"); -function jsonSize(value4) { - return utf8Length(JSON.stringify(value4)); -} -__name(jsonSize, "jsonSize"); -function normalizeUrlToBase(url, basePath2) { - const escapedBase = basePath2.replace(/\\/g, "/").replace(/[|\\{}()[\]^$+*?.]/g, "\\$&"); - let newUrl = url; - try { - newUrl = decodeURI(url); - } catch (_Oo) { - } - return newUrl.replace(/\\/g, "/").replace(/webpack:\/?/g, "").replace(new RegExp(`(file://)?/*${escapedBase}/*`, "ig"), "app:///"); -} -__name(normalizeUrlToBase, "normalizeUrlToBase"); -function createEnvelope(headers, items2 = []) { - return [headers, items2]; -} -__name(createEnvelope, "createEnvelope"); -function addItemToEnvelope(envelope, newItem) { - const [headers, items2] = envelope; - return [headers, [...items2, newItem]]; -} -__name(addItemToEnvelope, "addItemToEnvelope"); -function forEachEnvelopeItem(envelope, callback) { - const envelopeItems = envelope[1]; - for (const envelopeItem of envelopeItems) { - const envelopeItemType = envelopeItem[0].type; - const result = callback(envelopeItem, envelopeItemType); - if (result) { - return true; - } - } - return false; -} -__name(forEachEnvelopeItem, "forEachEnvelopeItem"); -function envelopeContainsItemType(envelope, types) { - return forEachEnvelopeItem(envelope, (_2, type) => types.includes(type)); -} -__name(envelopeContainsItemType, "envelopeContainsItemType"); -function encodeUTF8(input) { - return GLOBAL_OBJ.__SENTRY__ && GLOBAL_OBJ.__SENTRY__.encodePolyfill ? GLOBAL_OBJ.__SENTRY__.encodePolyfill(input) : new TextEncoder().encode(input); -} -__name(encodeUTF8, "encodeUTF8"); -function decodeUTF8(input) { - return GLOBAL_OBJ.__SENTRY__ && GLOBAL_OBJ.__SENTRY__.decodePolyfill ? GLOBAL_OBJ.__SENTRY__.decodePolyfill(input) : new TextDecoder().decode(input); -} -__name(decodeUTF8, "decodeUTF8"); -function serializeEnvelope(envelope) { - const [envHeaders, items2] = envelope; - let parts2 = JSON.stringify(envHeaders); - function append3(next2) { - if (typeof parts2 === "string") { - parts2 = typeof next2 === "string" ? parts2 + next2 : [encodeUTF8(parts2), next2]; - } else { - parts2.push(typeof next2 === "string" ? encodeUTF8(next2) : next2); - } - } - __name(append3, "append"); - for (const item3 of items2) { - const [itemHeaders, payload] = item3; - append3(` -${JSON.stringify(itemHeaders)} -`); - if (typeof payload === "string" || payload instanceof Uint8Array) { - append3(payload); - } else { - let stringifiedPayload; - try { - stringifiedPayload = JSON.stringify(payload); - } catch (e2) { - stringifiedPayload = JSON.stringify(normalize$2(payload)); - } - append3(stringifiedPayload); - } - } - return typeof parts2 === "string" ? parts2 : concatBuffers(parts2); -} -__name(serializeEnvelope, "serializeEnvelope"); -function concatBuffers(buffers) { - const totalLength = buffers.reduce((acc, buf) => acc + buf.length, 0); - const merged = new Uint8Array(totalLength); - let offset = 0; - for (const buffer2 of buffers) { - merged.set(buffer2, offset); - offset += buffer2.length; - } - return merged; -} -__name(concatBuffers, "concatBuffers"); -function parseEnvelope(env) { - let buffer2 = typeof env === "string" ? encodeUTF8(env) : env; - function readBinary(length) { - const bin = buffer2.subarray(0, length); - buffer2 = buffer2.subarray(length + 1); - return bin; - } - __name(readBinary, "readBinary"); - function readJson() { - let i2 = buffer2.indexOf(10); - if (i2 < 0) { - i2 = buffer2.length; - } - return JSON.parse(decodeUTF8(readBinary(i2))); - } - __name(readJson, "readJson"); - const envelopeHeader = readJson(); - const items2 = []; - while (buffer2.length) { - const itemHeader = readJson(); - const binaryLength = typeof itemHeader.length === "number" ? itemHeader.length : void 0; - items2.push([itemHeader, binaryLength ? readBinary(binaryLength) : readJson()]); - } - return [envelopeHeader, items2]; -} -__name(parseEnvelope, "parseEnvelope"); -function createSpanEnvelopeItem(spanJson) { - const spanHeaders = { - type: "span" - }; - return [spanHeaders, spanJson]; -} -__name(createSpanEnvelopeItem, "createSpanEnvelopeItem"); -function createAttachmentEnvelopeItem(attachment) { - const buffer2 = typeof attachment.data === "string" ? encodeUTF8(attachment.data) : attachment.data; - return [ - dropUndefinedKeys({ - type: "attachment", - length: buffer2.length, - filename: attachment.filename, - content_type: attachment.contentType, - attachment_type: attachment.attachmentType - }), - buffer2 - ]; -} -__name(createAttachmentEnvelopeItem, "createAttachmentEnvelopeItem"); -const ITEM_TYPE_TO_DATA_CATEGORY_MAP = { - session: "session", - sessions: "session", - attachment: "attachment", - transaction: "transaction", - event: "error", - client_report: "internal", - user_report: "default", - profile: "profile", - profile_chunk: "profile", - replay_event: "replay", - replay_recording: "replay", - check_in: "monitor", - feedback: "feedback", - span: "span", - statsd: "metric_bucket", - raw_security: "security" -}; -function envelopeItemTypeToDataCategory(type) { - return ITEM_TYPE_TO_DATA_CATEGORY_MAP[type]; -} -__name(envelopeItemTypeToDataCategory, "envelopeItemTypeToDataCategory"); -function getSdkMetadataForEnvelopeHeader(metadataOrEvent) { - if (!metadataOrEvent || !metadataOrEvent.sdk) { - return; - } - const { name: name2, version: version2 } = metadataOrEvent.sdk; - return { name: name2, version: version2 }; -} -__name(getSdkMetadataForEnvelopeHeader, "getSdkMetadataForEnvelopeHeader"); -function createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn) { - const dynamicSamplingContext = event.sdkProcessingMetadata && event.sdkProcessingMetadata.dynamicSamplingContext; - return { - event_id: event.event_id, - sent_at: (/* @__PURE__ */ new Date()).toISOString(), - ...sdkInfo && { sdk: sdkInfo }, - ...!!tunnel && dsn && { dsn: dsnToString(dsn) }, - ...dynamicSamplingContext && { - trace: dropUndefinedKeys({ ...dynamicSamplingContext }) - } - }; -} -__name(createEventEnvelopeHeaders, "createEventEnvelopeHeaders"); -function enhanceEventWithSdkInfo(event, sdkInfo) { - if (!sdkInfo) { - return event; - } - event.sdk = event.sdk || {}; - event.sdk.name = event.sdk.name || sdkInfo.name; - event.sdk.version = event.sdk.version || sdkInfo.version; - event.sdk.integrations = [...event.sdk.integrations || [], ...sdkInfo.integrations || []]; - event.sdk.packages = [...event.sdk.packages || [], ...sdkInfo.packages || []]; - return event; -} -__name(enhanceEventWithSdkInfo, "enhanceEventWithSdkInfo"); -function createSessionEnvelope(session, dsn, metadata, tunnel) { - const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata); - const envelopeHeaders = { - sent_at: (/* @__PURE__ */ new Date()).toISOString(), - ...sdkInfo && { sdk: sdkInfo }, - ...!!tunnel && dsn && { dsn: dsnToString(dsn) } - }; - const envelopeItem = "aggregates" in session ? [{ type: "sessions" }, session] : [{ type: "session" }, session.toJSON()]; - return createEnvelope(envelopeHeaders, [envelopeItem]); -} -__name(createSessionEnvelope, "createSessionEnvelope"); -function createEventEnvelope(event, dsn, metadata, tunnel) { - const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata); - const eventType = event.type && event.type !== "replay_event" ? event.type : "event"; - enhanceEventWithSdkInfo(event, metadata && metadata.sdk); - const envelopeHeaders = createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn); - delete event.sdkProcessingMetadata; - const eventItem = [{ type: eventType }, event]; - return createEnvelope(envelopeHeaders, [eventItem]); -} -__name(createEventEnvelope, "createEventEnvelope"); -function createSpanEnvelope(spans, client) { - function dscHasRequiredProps(dsc2) { - return !!dsc2.trace_id && !!dsc2.public_key; - } - __name(dscHasRequiredProps, "dscHasRequiredProps"); - const dsc = getDynamicSamplingContextFromSpan(spans[0]); - const dsn = client && client.getDsn(); - const tunnel = client && client.getOptions().tunnel; - const headers = { - sent_at: (/* @__PURE__ */ new Date()).toISOString(), - ...dscHasRequiredProps(dsc) && { trace: dsc }, - ...!!tunnel && dsn && { dsn: dsnToString(dsn) } - }; - const beforeSendSpan = client && client.getOptions().beforeSendSpan; - const convertToSpanJSON = beforeSendSpan ? (span) => { - const spanJson = beforeSendSpan(spanToJSON(span)); - if (!spanJson) { - showSpanDropWarning(); - } - return spanJson; - } : (span) => spanToJSON(span); - const items2 = []; - for (const span of spans) { - const spanJson = convertToSpanJSON(span); - if (spanJson) { - items2.push(createSpanEnvelopeItem(spanJson)); - } - } - return createEnvelope(headers, items2); -} -__name(createSpanEnvelope, "createSpanEnvelope"); -function setMeasurement(name2, value4, unit, activeSpan = getActiveSpan()) { - const rootSpan = activeSpan && getRootSpan(activeSpan); - if (rootSpan) { - DEBUG_BUILD$6 && logger$2.log(`[Measurement] Setting measurement on root span: ${name2} = ${value4} ${unit}`); - rootSpan.addEvent(name2, { - [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: value4, - [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: unit - }); - } -} -__name(setMeasurement, "setMeasurement"); -function timedEventsToMeasurements(events2) { - if (!events2 || events2.length === 0) { - return void 0; - } - const measurements = {}; - events2.forEach((event) => { - const attributes = event.attributes || {}; - const unit = attributes[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]; - const value4 = attributes[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]; - if (typeof unit === "string" && typeof value4 === "number") { - measurements[event.name] = { value: value4, unit }; - } - }); - return measurements; -} -__name(timedEventsToMeasurements, "timedEventsToMeasurements"); -const MAX_SPAN_COUNT = 1e3; -class SentrySpan { - static { - __name(this, "SentrySpan"); - } - /** Epoch timestamp in seconds when the span started. */ - /** Epoch timestamp in seconds when the span ended. */ - /** Internal keeper of the status */ - /** The timed events added to this span. */ - /** if true, treat span as a standalone span (not part of a transaction) */ - /** - * You should never call the constructor manually, always use `Sentry.startSpan()` - * or other span methods. - * @internal - * @hideconstructor - * @hidden - */ - constructor(spanContext = {}) { - this._traceId = spanContext.traceId || generateTraceId(); - this._spanId = spanContext.spanId || generateSpanId(); - this._startTime = spanContext.startTimestamp || timestampInSeconds(); - this._attributes = {}; - this.setAttributes({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "manual", - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: spanContext.op, - ...spanContext.attributes - }); - this._name = spanContext.name; - if (spanContext.parentSpanId) { - this._parentSpanId = spanContext.parentSpanId; - } - if ("sampled" in spanContext) { - this._sampled = spanContext.sampled; - } - if (spanContext.endTimestamp) { - this._endTime = spanContext.endTimestamp; - } - this._events = []; - this._isStandaloneSpan = spanContext.isStandalone; - if (this._endTime) { - this._onSpanEnded(); - } - } - /** - * This should generally not be used, - * but it is needed for being compliant with the OTEL Span interface. - * - * @hidden - * @internal - */ - addLink(_link) { - return this; - } - /** - * This should generally not be used, - * but it is needed for being compliant with the OTEL Span interface. - * - * @hidden - * @internal - */ - addLinks(_links) { - return this; - } - /** - * This should generally not be used, - * but it is needed for being compliant with the OTEL Span interface. - * - * @hidden - * @internal - */ - recordException(_exception, _time) { - } - /** @inheritdoc */ - spanContext() { - const { _spanId: spanId, _traceId: traceId, _sampled: sampled } = this; - return { - spanId, - traceId, - traceFlags: sampled ? TRACE_FLAG_SAMPLED : TRACE_FLAG_NONE - }; - } - /** @inheritdoc */ - setAttribute(key, value4) { - if (value4 === void 0) { - delete this._attributes[key]; - } else { - this._attributes[key] = value4; - } - return this; - } - /** @inheritdoc */ - setAttributes(attributes) { - Object.keys(attributes).forEach((key) => this.setAttribute(key, attributes[key])); - return this; - } - /** - * This should generally not be used, - * but we need it for browser tracing where we want to adjust the start time afterwards. - * USE THIS WITH CAUTION! - * - * @hidden - * @internal - */ - updateStartTime(timeInput) { - this._startTime = spanTimeInputToSeconds(timeInput); - } - /** - * @inheritDoc - */ - setStatus(value4) { - this._status = value4; - return this; - } - /** - * @inheritDoc - */ - updateName(name2) { - this._name = name2; - this.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, "custom"); - return this; - } - /** @inheritdoc */ - end(endTimestamp) { - if (this._endTime) { - return; - } - this._endTime = spanTimeInputToSeconds(endTimestamp); - logSpanEnd(this); - this._onSpanEnded(); - } - /** - * Get JSON representation of this span. - * - * @hidden - * @internal This method is purely for internal purposes and should not be used outside - * of SDK code. If you need to get a JSON representation of a span, - * use `spanToJSON(span)` instead. - */ - getSpanJSON() { - return dropUndefinedKeys({ - data: this._attributes, - description: this._name, - op: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP], - parent_span_id: this._parentSpanId, - span_id: this._spanId, - start_timestamp: this._startTime, - status: getStatusMessage(this._status), - timestamp: this._endTime, - trace_id: this._traceId, - origin: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN], - _metrics_summary: getMetricSummaryJsonForSpan(this), - profile_id: this._attributes[SEMANTIC_ATTRIBUTE_PROFILE_ID], - exclusive_time: this._attributes[SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME], - measurements: timedEventsToMeasurements(this._events), - is_segment: this._isStandaloneSpan && getRootSpan(this) === this || void 0, - segment_id: this._isStandaloneSpan ? getRootSpan(this).spanContext().spanId : void 0 - }); - } - /** @inheritdoc */ - isRecording() { - return !this._endTime && !!this._sampled; - } - /** - * @inheritdoc - */ - addEvent(name2, attributesOrStartTime, startTime) { - DEBUG_BUILD$6 && logger$2.log("[Tracing] Adding an event to span:", name2); - const time = isSpanTimeInput(attributesOrStartTime) ? attributesOrStartTime : startTime || timestampInSeconds(); - const attributes = isSpanTimeInput(attributesOrStartTime) ? {} : attributesOrStartTime || {}; - const event = { - name: name2, - time: spanTimeInputToSeconds(time), - attributes - }; - this._events.push(event); - return this; - } - /** - * This method should generally not be used, - * but for now we need a way to publicly check if the `_isStandaloneSpan` flag is set. - * USE THIS WITH CAUTION! - * @internal - * @hidden - * @experimental - */ - isStandaloneSpan() { - return !!this._isStandaloneSpan; - } - /** Emit `spanEnd` when the span is ended. */ - _onSpanEnded() { - const client = getClient(); - if (client) { - client.emit("spanEnd", this); - } - const isSegmentSpan = this._isStandaloneSpan || this === getRootSpan(this); - if (!isSegmentSpan) { - return; - } - if (this._isStandaloneSpan) { - if (this._sampled) { - sendSpanEnvelope(createSpanEnvelope([this], client)); - } else { - DEBUG_BUILD$6 && logger$2.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."); - if (client) { - client.recordDroppedEvent("sample_rate", "span"); - } - } - return; - } - const transactionEvent = this._convertSpanToTransaction(); - if (transactionEvent) { - const scope = getCapturedScopesOnSpan(this).scope || getCurrentScope$1(); - scope.captureEvent(transactionEvent); - } - } - /** - * Finish the transaction & prepare the event to send to Sentry. - */ - _convertSpanToTransaction() { - if (!isFullFinishedSpan(spanToJSON(this))) { - return void 0; - } - if (!this._name) { - DEBUG_BUILD$6 && logger$2.warn("Transaction has no name, falling back to ``."); - this._name = ""; - } - const { scope: capturedSpanScope, isolationScope: capturedSpanIsolationScope } = getCapturedScopesOnSpan(this); - const scope = capturedSpanScope || getCurrentScope$1(); - const client = scope.getClient() || getClient(); - if (this._sampled !== true) { - DEBUG_BUILD$6 && logger$2.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."); - if (client) { - client.recordDroppedEvent("sample_rate", "transaction"); - } - return void 0; - } - const finishedSpans = getSpanDescendants(this).filter((span) => span !== this && !isStandaloneSpan(span)); - const spans = finishedSpans.map((span) => spanToJSON(span)).filter(isFullFinishedSpan); - const source = this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; - delete this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]; - spans.forEach((span) => { - span.data && delete span.data[SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]; - }); - const transaction = { - contexts: { - trace: spanToTransactionTraceContext(this) - }, - spans: ( - // spans.sort() mutates the array, but `spans` is already a copy so we can safely do this here - // we do not use spans anymore after this point - spans.length > MAX_SPAN_COUNT ? spans.sort((a2, b2) => a2.start_timestamp - b2.start_timestamp).slice(0, MAX_SPAN_COUNT) : spans - ), - start_timestamp: this._startTime, - timestamp: this._endTime, - transaction: this._name, - type: "transaction", - sdkProcessingMetadata: { - capturedSpanScope, - capturedSpanIsolationScope, - ...dropUndefinedKeys({ - dynamicSamplingContext: getDynamicSamplingContextFromSpan(this) - }) - }, - _metrics_summary: getMetricSummaryJsonForSpan(this), - ...source && { - transaction_info: { - source - } - } - }; - const measurements = timedEventsToMeasurements(this._events); - const hasMeasurements = measurements && Object.keys(measurements).length; - if (hasMeasurements) { - DEBUG_BUILD$6 && logger$2.log( - "[Measurements] Adding measurements to transaction event", - JSON.stringify(measurements, void 0, 2) - ); - transaction.measurements = measurements; - } - return transaction; - } -} -function isSpanTimeInput(value4) { - return value4 && typeof value4 === "number" || value4 instanceof Date || Array.isArray(value4); -} -__name(isSpanTimeInput, "isSpanTimeInput"); -function isFullFinishedSpan(input) { - return !!input.start_timestamp && !!input.timestamp && !!input.span_id && !!input.trace_id; -} -__name(isFullFinishedSpan, "isFullFinishedSpan"); -function isStandaloneSpan(span) { - return span instanceof SentrySpan && span.isStandaloneSpan(); -} -__name(isStandaloneSpan, "isStandaloneSpan"); -function sendSpanEnvelope(envelope) { - const client = getClient(); - if (!client) { - return; - } - const spanItems = envelope[1]; - if (!spanItems || spanItems.length === 0) { - client.recordDroppedEvent("before_send", "span"); - return; - } - client.sendEnvelope(envelope); -} -__name(sendSpanEnvelope, "sendSpanEnvelope"); -const SUPPRESS_TRACING_KEY = "__SENTRY_SUPPRESS_TRACING__"; -function startSpan(options4, callback) { - const acs = getAcs(); - if (acs.startSpan) { - return acs.startSpan(options4, callback); - } - const spanArguments = parseSentrySpanArguments(options4); - const { forceTransaction, parentSpan: customParentSpan } = options4; - return withScope(options4.scope, () => { - const wrapper = getActiveSpanWrapper(customParentSpan); - return wrapper(() => { - const scope = getCurrentScope$1(); - const parentSpan = getParentSpan(scope); - const shouldSkipSpan = options4.onlyIfParent && !parentSpan; - const activeSpan = shouldSkipSpan ? new SentryNonRecordingSpan() : createChildOrRootSpan({ - parentSpan, - spanArguments, - forceTransaction, - scope - }); - _setSpanForScope(scope, activeSpan); - return handleCallbackErrors( - () => callback(activeSpan), - () => { - const { status } = spanToJSON(activeSpan); - if (activeSpan.isRecording() && (!status || status === "ok")) { - activeSpan.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" }); - } - }, - () => activeSpan.end() - ); - }); - }); -} -__name(startSpan, "startSpan"); -function startSpanManual(options4, callback) { - const acs = getAcs(); - if (acs.startSpanManual) { - return acs.startSpanManual(options4, callback); - } - const spanArguments = parseSentrySpanArguments(options4); - const { forceTransaction, parentSpan: customParentSpan } = options4; - return withScope(options4.scope, () => { - const wrapper = getActiveSpanWrapper(customParentSpan); - return wrapper(() => { - const scope = getCurrentScope$1(); - const parentSpan = getParentSpan(scope); - const shouldSkipSpan = options4.onlyIfParent && !parentSpan; - const activeSpan = shouldSkipSpan ? new SentryNonRecordingSpan() : createChildOrRootSpan({ - parentSpan, - spanArguments, - forceTransaction, - scope - }); - _setSpanForScope(scope, activeSpan); - function finishAndSetSpan() { - activeSpan.end(); - } - __name(finishAndSetSpan, "finishAndSetSpan"); - return handleCallbackErrors( - () => callback(activeSpan, finishAndSetSpan), - () => { - const { status } = spanToJSON(activeSpan); - if (activeSpan.isRecording() && (!status || status === "ok")) { - activeSpan.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" }); - } - } - ); - }); - }); -} -__name(startSpanManual, "startSpanManual"); -function startInactiveSpan(options4) { - const acs = getAcs(); - if (acs.startInactiveSpan) { - return acs.startInactiveSpan(options4); - } - const spanArguments = parseSentrySpanArguments(options4); - const { forceTransaction, parentSpan: customParentSpan } = options4; - const wrapper = options4.scope ? (callback) => withScope(options4.scope, callback) : customParentSpan !== void 0 ? (callback) => withActiveSpan(customParentSpan, callback) : (callback) => callback(); - return wrapper(() => { - const scope = getCurrentScope$1(); - const parentSpan = getParentSpan(scope); - const shouldSkipSpan = options4.onlyIfParent && !parentSpan; - if (shouldSkipSpan) { - return new SentryNonRecordingSpan(); - } - return createChildOrRootSpan({ - parentSpan, - spanArguments, - forceTransaction, - scope - }); - }); -} -__name(startInactiveSpan, "startInactiveSpan"); -const continueTrace = /* @__PURE__ */ __name((options4, callback) => { - const carrier = getMainCarrier(); - const acs = getAsyncContextStrategy(carrier); - if (acs.continueTrace) { - return acs.continueTrace(options4, callback); - } - const { sentryTrace, baggage } = options4; - return withScope((scope) => { - const propagationContext = propagationContextFromHeaders(sentryTrace, baggage); - scope.setPropagationContext(propagationContext); - return callback(); - }); -}, "continueTrace"); -function withActiveSpan(span, callback) { - const acs = getAcs(); - if (acs.withActiveSpan) { - return acs.withActiveSpan(span, callback); - } - return withScope((scope) => { - _setSpanForScope(scope, span || void 0); - return callback(scope); - }); -} -__name(withActiveSpan, "withActiveSpan"); -function suppressTracing(callback) { - const acs = getAcs(); - if (acs.suppressTracing) { - return acs.suppressTracing(callback); - } - return withScope((scope) => { - scope.setSDKProcessingMetadata({ [SUPPRESS_TRACING_KEY]: true }); - return callback(); - }); -} -__name(suppressTracing, "suppressTracing"); -function startNewTrace(callback) { - return withScope((scope) => { - scope.setPropagationContext({ traceId: generateTraceId() }); - DEBUG_BUILD$6 && logger$2.info(`Starting a new trace with id ${scope.getPropagationContext().traceId}`); - return withActiveSpan(null, callback); - }); -} -__name(startNewTrace, "startNewTrace"); -function createChildOrRootSpan({ - parentSpan, - spanArguments, - forceTransaction, - scope -}) { - if (!hasTracingEnabled()) { - return new SentryNonRecordingSpan(); - } - const isolationScope = getIsolationScope(); - let span; - if (parentSpan && !forceTransaction) { - span = _startChildSpan(parentSpan, scope, spanArguments); - addChildSpanToSpan(parentSpan, span); - } else if (parentSpan) { - const dsc = getDynamicSamplingContextFromSpan(parentSpan); - const { traceId, spanId: parentSpanId } = parentSpan.spanContext(); - const parentSampled = spanIsSampled(parentSpan); - span = _startRootSpan( - { - traceId, - parentSpanId, - ...spanArguments - }, - scope, - parentSampled - ); - freezeDscOnSpan(span, dsc); - } else { - const { - traceId, - dsc, - parentSpanId, - sampled: parentSampled - } = { - ...isolationScope.getPropagationContext(), - ...scope.getPropagationContext() - }; - span = _startRootSpan( - { - traceId, - parentSpanId, - ...spanArguments - }, - scope, - parentSampled - ); - if (dsc) { - freezeDscOnSpan(span, dsc); - } - } - logSpanStart(span); - setCapturedScopesOnSpan(span, scope, isolationScope); - return span; -} -__name(createChildOrRootSpan, "createChildOrRootSpan"); -function parseSentrySpanArguments(options4) { - const exp = options4.experimental || {}; - const initialCtx = { - isStandalone: exp.standalone, - ...options4 - }; - if (options4.startTime) { - const ctx = { ...initialCtx }; - ctx.startTimestamp = spanTimeInputToSeconds(options4.startTime); - delete ctx.startTime; - return ctx; - } - return initialCtx; -} -__name(parseSentrySpanArguments, "parseSentrySpanArguments"); -function getAcs() { - const carrier = getMainCarrier(); - return getAsyncContextStrategy(carrier); -} -__name(getAcs, "getAcs"); -function _startRootSpan(spanArguments, scope, parentSampled) { - const client = getClient(); - const options4 = client && client.getOptions() || {}; - const { name: name2 = "", attributes } = spanArguments; - const [sampled, sampleRate] = scope.getScopeData().sdkProcessingMetadata[SUPPRESS_TRACING_KEY] ? [false] : sampleSpan(options4, { - name: name2, - parentSampled, - attributes, - transactionContext: { - name: name2, - parentSampled - } - }); - const rootSpan = new SentrySpan({ - ...spanArguments, - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "custom", - ...spanArguments.attributes - }, - sampled - }); - if (sampleRate !== void 0) { - rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, sampleRate); - } - if (client) { - client.emit("spanStart", rootSpan); - } - return rootSpan; -} -__name(_startRootSpan, "_startRootSpan"); -function _startChildSpan(parentSpan, scope, spanArguments) { - const { spanId, traceId } = parentSpan.spanContext(); - const sampled = scope.getScopeData().sdkProcessingMetadata[SUPPRESS_TRACING_KEY] ? false : spanIsSampled(parentSpan); - const childSpan = sampled ? new SentrySpan({ - ...spanArguments, - parentSpanId: spanId, - traceId, - sampled - }) : new SentryNonRecordingSpan({ traceId }); - addChildSpanToSpan(parentSpan, childSpan); - const client = getClient(); - if (client) { - client.emit("spanStart", childSpan); - if (spanArguments.endTimestamp) { - client.emit("spanEnd", childSpan); - } - } - return childSpan; -} -__name(_startChildSpan, "_startChildSpan"); -function getParentSpan(scope) { - const span = _getSpanForScope(scope); - if (!span) { - return void 0; - } - const client = getClient(); - const options4 = client ? client.getOptions() : {}; - if (options4.parentSpanIsAlwaysRootSpan) { - return getRootSpan(span); - } - return span; -} -__name(getParentSpan, "getParentSpan"); -function getActiveSpanWrapper(parentSpan) { - return parentSpan !== void 0 ? (callback) => { - return withActiveSpan(parentSpan, callback); - } : (callback) => callback(); -} -__name(getActiveSpanWrapper, "getActiveSpanWrapper"); -const TRACING_DEFAULTS = { - idleTimeout: 1e3, - finalTimeout: 3e4, - childSpanTimeout: 15e3 -}; -const FINISH_REASON_HEARTBEAT_FAILED = "heartbeatFailed"; -const FINISH_REASON_IDLE_TIMEOUT = "idleTimeout"; -const FINISH_REASON_FINAL_TIMEOUT = "finalTimeout"; -const FINISH_REASON_EXTERNAL_FINISH = "externalFinish"; -function startIdleSpan(startSpanOptions, options4 = {}) { - const activities = /* @__PURE__ */ new Map(); - let _finished = false; - let _idleTimeoutID; - let _finishReason = FINISH_REASON_EXTERNAL_FINISH; - let _autoFinishAllowed = !options4.disableAutoFinish; - const _cleanupHooks = []; - const { - idleTimeout = TRACING_DEFAULTS.idleTimeout, - finalTimeout = TRACING_DEFAULTS.finalTimeout, - childSpanTimeout = TRACING_DEFAULTS.childSpanTimeout, - beforeSpanEnd - } = options4; - const client = getClient(); - if (!client || !hasTracingEnabled()) { - return new SentryNonRecordingSpan(); - } - const scope = getCurrentScope$1(); - const previousActiveSpan = getActiveSpan(); - const span = _startIdleSpan(startSpanOptions); - span.end = new Proxy(span.end, { - apply(target2, thisArg, args) { - if (beforeSpanEnd) { - beforeSpanEnd(span); - } - const [definedEndTimestamp, ...rest] = args; - const timestamp2 = definedEndTimestamp || timestampInSeconds(); - const spanEndTimestamp = spanTimeInputToSeconds(timestamp2); - const spans = getSpanDescendants(span).filter((child) => child !== span); - if (!spans.length) { - onIdleSpanEnded(spanEndTimestamp); - return Reflect.apply(target2, thisArg, [spanEndTimestamp, ...rest]); - } - const childEndTimestamps = spans.map((span2) => spanToJSON(span2).timestamp).filter((timestamp3) => !!timestamp3); - const latestSpanEndTimestamp = childEndTimestamps.length ? Math.max(...childEndTimestamps) : void 0; - const spanStartTimestamp = spanToJSON(span).start_timestamp; - const endTimestamp = Math.min( - spanStartTimestamp ? spanStartTimestamp + finalTimeout / 1e3 : Infinity, - Math.max(spanStartTimestamp || -Infinity, Math.min(spanEndTimestamp, latestSpanEndTimestamp || Infinity)) - ); - onIdleSpanEnded(endTimestamp); - return Reflect.apply(target2, thisArg, [endTimestamp, ...rest]); - } - }); - function _cancelIdleTimeout() { - if (_idleTimeoutID) { - clearTimeout(_idleTimeoutID); - _idleTimeoutID = void 0; - } - } - __name(_cancelIdleTimeout, "_cancelIdleTimeout"); - function _restartIdleTimeout(endTimestamp) { - _cancelIdleTimeout(); - _idleTimeoutID = setTimeout(() => { - if (!_finished && activities.size === 0 && _autoFinishAllowed) { - _finishReason = FINISH_REASON_IDLE_TIMEOUT; - span.end(endTimestamp); - } - }, idleTimeout); - } - __name(_restartIdleTimeout, "_restartIdleTimeout"); - function _restartChildSpanTimeout(endTimestamp) { - _idleTimeoutID = setTimeout(() => { - if (!_finished && _autoFinishAllowed) { - _finishReason = FINISH_REASON_HEARTBEAT_FAILED; - span.end(endTimestamp); - } - }, childSpanTimeout); - } - __name(_restartChildSpanTimeout, "_restartChildSpanTimeout"); - function _pushActivity(spanId) { - _cancelIdleTimeout(); - activities.set(spanId, true); - const endTimestamp = timestampInSeconds(); - _restartChildSpanTimeout(endTimestamp + childSpanTimeout / 1e3); - } - __name(_pushActivity, "_pushActivity"); - function _popActivity(spanId) { - if (activities.has(spanId)) { - activities.delete(spanId); - } - if (activities.size === 0) { - const endTimestamp = timestampInSeconds(); - _restartIdleTimeout(endTimestamp + idleTimeout / 1e3); - } - } - __name(_popActivity, "_popActivity"); - function onIdleSpanEnded(endTimestamp) { - _finished = true; - activities.clear(); - _cleanupHooks.forEach((cleanup) => cleanup()); - _setSpanForScope(scope, previousActiveSpan); - const spanJSON = spanToJSON(span); - const { start_timestamp: startTimestamp } = spanJSON; - if (!startTimestamp) { - return; - } - const attributes = spanJSON.data || {}; - if (!attributes[SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON]) { - span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, _finishReason); - } - logger$2.log(`[Tracing] Idle span "${spanJSON.op}" finished`); - const childSpans = getSpanDescendants(span).filter((child) => child !== span); - let discardedSpans = 0; - childSpans.forEach((childSpan) => { - if (childSpan.isRecording()) { - childSpan.setStatus({ code: SPAN_STATUS_ERROR, message: "cancelled" }); - childSpan.end(endTimestamp); - DEBUG_BUILD$6 && logger$2.log("[Tracing] Cancelling span since span ended early", JSON.stringify(childSpan, void 0, 2)); - } - const childSpanJSON = spanToJSON(childSpan); - const { timestamp: childEndTimestamp = 0, start_timestamp: childStartTimestamp = 0 } = childSpanJSON; - const spanStartedBeforeIdleSpanEnd = childStartTimestamp <= endTimestamp; - const timeoutWithMarginOfError = (finalTimeout + idleTimeout) / 1e3; - const spanEndedBeforeFinalTimeout = childEndTimestamp - childStartTimestamp <= timeoutWithMarginOfError; - if (DEBUG_BUILD$6) { - const stringifiedSpan = JSON.stringify(childSpan, void 0, 2); - if (!spanStartedBeforeIdleSpanEnd) { - logger$2.log("[Tracing] Discarding span since it happened after idle span was finished", stringifiedSpan); - } else if (!spanEndedBeforeFinalTimeout) { - logger$2.log("[Tracing] Discarding span since it finished after idle span final timeout", stringifiedSpan); - } - } - if (!spanEndedBeforeFinalTimeout || !spanStartedBeforeIdleSpanEnd) { - removeChildSpanFromSpan(span, childSpan); - discardedSpans++; - } - }); - if (discardedSpans > 0) { - span.setAttribute("sentry.idle_span_discarded_spans", discardedSpans); - } - } - __name(onIdleSpanEnded, "onIdleSpanEnded"); - _cleanupHooks.push( - client.on("spanStart", (startedSpan) => { - if (_finished || startedSpan === span || !!spanToJSON(startedSpan).timestamp) { - return; - } - const allSpans = getSpanDescendants(span); - if (allSpans.includes(startedSpan)) { - _pushActivity(startedSpan.spanContext().spanId); - } - }) - ); - _cleanupHooks.push( - client.on("spanEnd", (endedSpan) => { - if (_finished) { - return; - } - _popActivity(endedSpan.spanContext().spanId); - }) - ); - _cleanupHooks.push( - client.on("idleSpanEnableAutoFinish", (spanToAllowAutoFinish) => { - if (spanToAllowAutoFinish === span) { - _autoFinishAllowed = true; - _restartIdleTimeout(); - if (activities.size) { - _restartChildSpanTimeout(); - } - } - }) - ); - if (!options4.disableAutoFinish) { - _restartIdleTimeout(); - } - setTimeout(() => { - if (!_finished) { - span.setStatus({ code: SPAN_STATUS_ERROR, message: "deadline_exceeded" }); - _finishReason = FINISH_REASON_FINAL_TIMEOUT; - span.end(); - } - }, finalTimeout); - return span; -} -__name(startIdleSpan, "startIdleSpan"); -function _startIdleSpan(options4) { - const span = startInactiveSpan(options4); - _setSpanForScope(getCurrentScope$1(), span); - DEBUG_BUILD$6 && logger$2.log("[Tracing] Started span is an idle span"); - return span; -} -__name(_startIdleSpan, "_startIdleSpan"); -function notifyEventProcessors(processors, event, hint, index2 = 0) { - return new SyncPromise((resolve2, reject3) => { - const processor = processors[index2]; - if (event === null || typeof processor !== "function") { - resolve2(event); - } else { - const result = processor({ ...event }, hint); - DEBUG_BUILD$6 && processor.id && result === null && logger$2.log(`Event processor "${processor.id}" dropped event`); - if (isThenable$1(result)) { - void result.then((final) => notifyEventProcessors(processors, final, hint, index2 + 1).then(resolve2)).then(null, reject3); - } else { - void notifyEventProcessors(processors, result, hint, index2 + 1).then(resolve2).then(null, reject3); - } - } - }); -} -__name(notifyEventProcessors, "notifyEventProcessors"); -let parsedStackResults; -let lastKeysCount; -let cachedFilenameDebugIds; -function getFilenameToDebugIdMap(stackParser) { - const debugIdMap = GLOBAL_OBJ._sentryDebugIds; - if (!debugIdMap) { - return {}; - } - const debugIdKeys = Object.keys(debugIdMap); - if (cachedFilenameDebugIds && debugIdKeys.length === lastKeysCount) { - return cachedFilenameDebugIds; - } - lastKeysCount = debugIdKeys.length; - cachedFilenameDebugIds = debugIdKeys.reduce((acc, stackKey) => { - if (!parsedStackResults) { - parsedStackResults = {}; - } - const result = parsedStackResults[stackKey]; - if (result) { - acc[result[0]] = result[1]; - } else { - const parsedStack = stackParser(stackKey); - for (let i2 = parsedStack.length - 1; i2 >= 0; i2--) { - const stackFrame = parsedStack[i2]; - const filename = stackFrame && stackFrame.filename; - const debugId = debugIdMap[stackKey]; - if (filename && debugId) { - acc[filename] = debugId; - parsedStackResults[stackKey] = [filename, debugId]; - break; - } - } - } - return acc; - }, {}); - return cachedFilenameDebugIds; -} -__name(getFilenameToDebugIdMap, "getFilenameToDebugIdMap"); -function getDebugImagesForResources(stackParser, resource_paths) { - const filenameDebugIdMap = getFilenameToDebugIdMap(stackParser); - if (!filenameDebugIdMap) { - return []; - } - const images = []; - for (const path of resource_paths) { - if (path && filenameDebugIdMap[path]) { - images.push({ - type: "sourcemap", - code_file: path, - debug_id: filenameDebugIdMap[path] - }); - } - } - return images; -} -__name(getDebugImagesForResources, "getDebugImagesForResources"); -function applyScopeDataToEvent(event, data26) { - const { fingerprint, span, breadcrumbs, sdkProcessingMetadata } = data26; - applyDataToEvent(event, data26); - if (span) { - applySpanToEvent(event, span); - } - applyFingerprintToEvent(event, fingerprint); - applyBreadcrumbsToEvent(event, breadcrumbs); - applySdkMetadataToEvent(event, sdkProcessingMetadata); -} -__name(applyScopeDataToEvent, "applyScopeDataToEvent"); -function mergeScopeData(data26, mergeData) { - const { - extra, - tags, - user, - contexts, - level, - sdkProcessingMetadata, - breadcrumbs, - fingerprint, - eventProcessors, - attachments, - propagationContext, - transactionName, - span - } = mergeData; - mergeAndOverwriteScopeData(data26, "extra", extra); - mergeAndOverwriteScopeData(data26, "tags", tags); - mergeAndOverwriteScopeData(data26, "user", user); - mergeAndOverwriteScopeData(data26, "contexts", contexts); - data26.sdkProcessingMetadata = merge$2(data26.sdkProcessingMetadata, sdkProcessingMetadata, 2); - if (level) { - data26.level = level; - } - if (transactionName) { - data26.transactionName = transactionName; - } - if (span) { - data26.span = span; - } - if (breadcrumbs.length) { - data26.breadcrumbs = [...data26.breadcrumbs, ...breadcrumbs]; - } - if (fingerprint.length) { - data26.fingerprint = [...data26.fingerprint, ...fingerprint]; - } - if (eventProcessors.length) { - data26.eventProcessors = [...data26.eventProcessors, ...eventProcessors]; - } - if (attachments.length) { - data26.attachments = [...data26.attachments, ...attachments]; - } - data26.propagationContext = { ...data26.propagationContext, ...propagationContext }; -} -__name(mergeScopeData, "mergeScopeData"); -function mergeAndOverwriteScopeData(data26, prop2, mergeVal) { - data26[prop2] = merge$2(data26[prop2], mergeVal, 1); -} -__name(mergeAndOverwriteScopeData, "mergeAndOverwriteScopeData"); -function applyDataToEvent(event, data26) { - const { extra, tags, user, contexts, level, transactionName } = data26; - const cleanedExtra = dropUndefinedKeys(extra); - if (cleanedExtra && Object.keys(cleanedExtra).length) { - event.extra = { ...cleanedExtra, ...event.extra }; - } - const cleanedTags = dropUndefinedKeys(tags); - if (cleanedTags && Object.keys(cleanedTags).length) { - event.tags = { ...cleanedTags, ...event.tags }; - } - const cleanedUser = dropUndefinedKeys(user); - if (cleanedUser && Object.keys(cleanedUser).length) { - event.user = { ...cleanedUser, ...event.user }; - } - const cleanedContexts = dropUndefinedKeys(contexts); - if (cleanedContexts && Object.keys(cleanedContexts).length) { - event.contexts = { ...cleanedContexts, ...event.contexts }; - } - if (level) { - event.level = level; - } - if (transactionName && event.type !== "transaction") { - event.transaction = transactionName; - } -} -__name(applyDataToEvent, "applyDataToEvent"); -function applyBreadcrumbsToEvent(event, breadcrumbs) { - const mergedBreadcrumbs = [...event.breadcrumbs || [], ...breadcrumbs]; - event.breadcrumbs = mergedBreadcrumbs.length ? mergedBreadcrumbs : void 0; -} -__name(applyBreadcrumbsToEvent, "applyBreadcrumbsToEvent"); -function applySdkMetadataToEvent(event, sdkProcessingMetadata) { - event.sdkProcessingMetadata = { - ...event.sdkProcessingMetadata, - ...sdkProcessingMetadata - }; -} -__name(applySdkMetadataToEvent, "applySdkMetadataToEvent"); -function applySpanToEvent(event, span) { - event.contexts = { - trace: spanToTraceContext(span), - ...event.contexts - }; - event.sdkProcessingMetadata = { - dynamicSamplingContext: getDynamicSamplingContextFromSpan(span), - ...event.sdkProcessingMetadata - }; - const rootSpan = getRootSpan(span); - const transactionName = spanToJSON(rootSpan).description; - if (transactionName && !event.transaction && event.type === "transaction") { - event.transaction = transactionName; - } -} -__name(applySpanToEvent, "applySpanToEvent"); -function applyFingerprintToEvent(event, fingerprint) { - event.fingerprint = event.fingerprint ? Array.isArray(event.fingerprint) ? event.fingerprint : [event.fingerprint] : []; - if (fingerprint) { - event.fingerprint = event.fingerprint.concat(fingerprint); - } - if (event.fingerprint && !event.fingerprint.length) { - delete event.fingerprint; - } -} -__name(applyFingerprintToEvent, "applyFingerprintToEvent"); -function prepareEvent(options4, event, hint, scope, client, isolationScope) { - const { normalizeDepth = 3, normalizeMaxBreadth = 1e3 } = options4; - const prepared = { - ...event, - event_id: event.event_id || hint.event_id || uuid4(), - timestamp: event.timestamp || dateTimestampInSeconds() - }; - const integrations = hint.integrations || options4.integrations.map((i2) => i2.name); - applyClientOptions(prepared, options4); - applyIntegrationsMetadata(prepared, integrations); - if (client) { - client.emit("applyFrameMetadata", event); - } - if (event.type === void 0) { - applyDebugIds(prepared, options4.stackParser); - } - const finalScope = getFinalScope(scope, hint.captureContext); - if (hint.mechanism) { - addExceptionMechanism(prepared, hint.mechanism); - } - const clientEventProcessors = client ? client.getEventProcessors() : []; - const data26 = getGlobalScope().getScopeData(); - if (isolationScope) { - const isolationData = isolationScope.getScopeData(); - mergeScopeData(data26, isolationData); - } - if (finalScope) { - const finalScopeData = finalScope.getScopeData(); - mergeScopeData(data26, finalScopeData); - } - const attachments = [...hint.attachments || [], ...data26.attachments]; - if (attachments.length) { - hint.attachments = attachments; - } - applyScopeDataToEvent(prepared, data26); - const eventProcessors = [ - ...clientEventProcessors, - // Run scope event processors _after_ all other processors - ...data26.eventProcessors - ]; - const result = notifyEventProcessors(eventProcessors, prepared, hint); - return result.then((evt) => { - if (evt) { - applyDebugMeta(evt); - } - if (typeof normalizeDepth === "number" && normalizeDepth > 0) { - return normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth); - } - return evt; - }); -} -__name(prepareEvent, "prepareEvent"); -function applyClientOptions(event, options4) { - const { environment, release, dist: dist3, maxValueLength = 250 } = options4; - event.environment = event.environment || environment || DEFAULT_ENVIRONMENT; - if (!event.release && release) { - event.release = release; - } - if (!event.dist && dist3) { - event.dist = dist3; - } - if (event.message) { - event.message = truncate(event.message, maxValueLength); - } - const exception = event.exception && event.exception.values && event.exception.values[0]; - if (exception && exception.value) { - exception.value = truncate(exception.value, maxValueLength); - } - const request = event.request; - if (request && request.url) { - request.url = truncate(request.url, maxValueLength); - } -} -__name(applyClientOptions, "applyClientOptions"); -function applyDebugIds(event, stackParser) { - const filenameDebugIdMap = getFilenameToDebugIdMap(stackParser); - try { - event.exception.values.forEach((exception) => { - exception.stacktrace.frames.forEach((frame) => { - if (filenameDebugIdMap && frame.filename) { - frame.debug_id = filenameDebugIdMap[frame.filename]; - } - }); - }); - } catch (e2) { - } -} -__name(applyDebugIds, "applyDebugIds"); -function applyDebugMeta(event) { - const filenameDebugIdMap = {}; - try { - event.exception.values.forEach((exception) => { - exception.stacktrace.frames.forEach((frame) => { - if (frame.debug_id) { - if (frame.abs_path) { - filenameDebugIdMap[frame.abs_path] = frame.debug_id; - } else if (frame.filename) { - filenameDebugIdMap[frame.filename] = frame.debug_id; - } - delete frame.debug_id; - } - }); - }); - } catch (e2) { - } - if (Object.keys(filenameDebugIdMap).length === 0) { - return; - } - event.debug_meta = event.debug_meta || {}; - event.debug_meta.images = event.debug_meta.images || []; - const images = event.debug_meta.images; - Object.entries(filenameDebugIdMap).forEach(([filename, debug_id]) => { - images.push({ - type: "sourcemap", - code_file: filename, - debug_id - }); - }); -} -__name(applyDebugMeta, "applyDebugMeta"); -function applyIntegrationsMetadata(event, integrationNames) { - if (integrationNames.length > 0) { - event.sdk = event.sdk || {}; - event.sdk.integrations = [...event.sdk.integrations || [], ...integrationNames]; - } -} -__name(applyIntegrationsMetadata, "applyIntegrationsMetadata"); -function normalizeEvent(event, depth, maxBreadth) { - if (!event) { - return null; - } - const normalized = { - ...event, - ...event.breadcrumbs && { - breadcrumbs: event.breadcrumbs.map((b2) => ({ - ...b2, - ...b2.data && { - data: normalize$2(b2.data, depth, maxBreadth) - } - })) - }, - ...event.user && { - user: normalize$2(event.user, depth, maxBreadth) - }, - ...event.contexts && { - contexts: normalize$2(event.contexts, depth, maxBreadth) - }, - ...event.extra && { - extra: normalize$2(event.extra, depth, maxBreadth) - } - }; - if (event.contexts && event.contexts.trace && normalized.contexts) { - normalized.contexts.trace = event.contexts.trace; - if (event.contexts.trace.data) { - normalized.contexts.trace.data = normalize$2(event.contexts.trace.data, depth, maxBreadth); - } - } - if (event.spans) { - normalized.spans = event.spans.map((span) => { - return { - ...span, - ...span.data && { - data: normalize$2(span.data, depth, maxBreadth) - } - }; - }); - } - if (event.contexts && event.contexts.flags && normalized.contexts) { - normalized.contexts.flags = normalize$2(event.contexts.flags, 3, maxBreadth); - } - return normalized; -} -__name(normalizeEvent, "normalizeEvent"); -function getFinalScope(scope, captureContext) { - if (!captureContext) { - return scope; - } - const finalScope = scope ? scope.clone() : new Scope(); - finalScope.update(captureContext); - return finalScope; -} -__name(getFinalScope, "getFinalScope"); -function parseEventHintOrCaptureContext(hint) { - if (!hint) { - return void 0; - } - if (hintIsScopeOrFunction(hint)) { - return { captureContext: hint }; - } - if (hintIsScopeContext(hint)) { - return { - captureContext: hint - }; - } - return hint; -} -__name(parseEventHintOrCaptureContext, "parseEventHintOrCaptureContext"); -function hintIsScopeOrFunction(hint) { - return hint instanceof Scope || typeof hint === "function"; -} -__name(hintIsScopeOrFunction, "hintIsScopeOrFunction"); -const captureContextKeys = [ - "user", - "level", - "extra", - "contexts", - "tags", - "fingerprint", - "requestSession", - "propagationContext" -]; -function hintIsScopeContext(hint) { - return Object.keys(hint).some((key) => captureContextKeys.includes(key)); -} -__name(hintIsScopeContext, "hintIsScopeContext"); -function captureException(exception, hint) { - return getCurrentScope$1().captureException(exception, parseEventHintOrCaptureContext(hint)); -} -__name(captureException, "captureException"); -function captureMessage(message3, captureContext) { - const level = typeof captureContext === "string" ? captureContext : void 0; - const context = typeof captureContext !== "string" ? { captureContext } : void 0; - return getCurrentScope$1().captureMessage(message3, level, context); -} -__name(captureMessage, "captureMessage"); -function captureEvent(event, hint) { - return getCurrentScope$1().captureEvent(event, hint); -} -__name(captureEvent, "captureEvent"); -function setContext(name2, context) { - getIsolationScope().setContext(name2, context); -} -__name(setContext, "setContext"); -function setExtras(extras) { - getIsolationScope().setExtras(extras); -} -__name(setExtras, "setExtras"); -function setExtra(key, extra) { - getIsolationScope().setExtra(key, extra); -} -__name(setExtra, "setExtra"); -function setTags(tags) { - getIsolationScope().setTags(tags); -} -__name(setTags, "setTags"); -function setTag$5(key, value4) { - getIsolationScope().setTag(key, value4); -} -__name(setTag$5, "setTag$5"); -function setUser(user) { - getIsolationScope().setUser(user); -} -__name(setUser, "setUser"); -function lastEventId() { - return getIsolationScope().lastEventId(); -} -__name(lastEventId, "lastEventId"); -function captureCheckIn(checkIn, upsertMonitorConfig) { - const scope = getCurrentScope$1(); - const client = getClient(); - if (!client) { - DEBUG_BUILD$6 && logger$2.warn("Cannot capture check-in. No client defined."); - } else if (!client.captureCheckIn) { - DEBUG_BUILD$6 && logger$2.warn("Cannot capture check-in. Client does not support sending check-ins."); - } else { - return client.captureCheckIn(checkIn, upsertMonitorConfig, scope); - } - return uuid4(); -} -__name(captureCheckIn, "captureCheckIn"); -function withMonitor(monitorSlug, callback, upsertMonitorConfig) { - const checkInId = captureCheckIn({ monitorSlug, status: "in_progress" }, upsertMonitorConfig); - const now2 = timestampInSeconds(); - function finishCheckIn(status) { - captureCheckIn({ monitorSlug, status, checkInId, duration: timestampInSeconds() - now2 }); - } - __name(finishCheckIn, "finishCheckIn"); - return withIsolationScope(() => { - let maybePromiseResult; - try { - maybePromiseResult = callback(); - } catch (e2) { - finishCheckIn("error"); - throw e2; - } - if (isThenable$1(maybePromiseResult)) { - Promise.resolve(maybePromiseResult).then( - () => { - finishCheckIn("ok"); - }, - (e2) => { - finishCheckIn("error"); - throw e2; - } - ); - } else { - finishCheckIn("ok"); - } - return maybePromiseResult; - }); -} -__name(withMonitor, "withMonitor"); -async function flush(timeout) { - const client = getClient(); - if (client) { - return client.flush(timeout); - } - DEBUG_BUILD$6 && logger$2.warn("Cannot flush events. No client defined."); - return Promise.resolve(false); -} -__name(flush, "flush"); -async function close$1(timeout) { - const client = getClient(); - if (client) { - return client.close(timeout); - } - DEBUG_BUILD$6 && logger$2.warn("Cannot flush events and disable SDK. No client defined."); - return Promise.resolve(false); -} -__name(close$1, "close$1"); -function isInitialized$1() { - return !!getClient(); -} -__name(isInitialized$1, "isInitialized$1"); -function isEnabled() { - const client = getClient(); - return !!client && client.getOptions().enabled !== false && !!client.getTransport(); -} -__name(isEnabled, "isEnabled"); -function addEventProcessor(callback) { - getIsolationScope().addEventProcessor(callback); -} -__name(addEventProcessor, "addEventProcessor"); -function startSession(context) { - const client = getClient(); - const isolationScope = getIsolationScope(); - const currentScope = getCurrentScope$1(); - const { release, environment = DEFAULT_ENVIRONMENT } = client && client.getOptions() || {}; - const { userAgent } = GLOBAL_OBJ.navigator || {}; - const session = makeSession$1({ - release, - environment, - user: currentScope.getUser() || isolationScope.getUser(), - ...userAgent && { userAgent }, - ...context - }); - const currentSession = isolationScope.getSession(); - if (currentSession && currentSession.status === "ok") { - updateSession(currentSession, { status: "exited" }); - } - endSession(); - isolationScope.setSession(session); - currentScope.setSession(session); - return session; -} -__name(startSession, "startSession"); -function endSession() { - const isolationScope = getIsolationScope(); - const currentScope = getCurrentScope$1(); - const session = currentScope.getSession() || isolationScope.getSession(); - if (session) { - closeSession(session); - } - _sendSessionUpdate$1(); - isolationScope.setSession(); - currentScope.setSession(); -} -__name(endSession, "endSession"); -function _sendSessionUpdate$1() { - const isolationScope = getIsolationScope(); - const currentScope = getCurrentScope$1(); - const client = getClient(); - const session = currentScope.getSession() || isolationScope.getSession(); - if (session && client) { - client.captureSession(session); - } -} -__name(_sendSessionUpdate$1, "_sendSessionUpdate$1"); -function captureSession(end = false) { - if (end) { - endSession(); - return; - } - _sendSessionUpdate$1(); -} -__name(captureSession, "captureSession"); -class SessionFlusher { - static { - __name(this, "SessionFlusher"); - } - // We adjust the type here to add the `unref()` part, as setInterval can technically return a number or a NodeJS.Timer - constructor(client, attrs6) { - this._client = client; - this.flushTimeout = 60; - this._pendingAggregates = /* @__PURE__ */ new Map(); - this._isEnabled = true; - this._intervalId = setInterval(() => this.flush(), this.flushTimeout * 1e3); - if (this._intervalId.unref) { - this._intervalId.unref(); - } - this._sessionAttrs = attrs6; - } - /** Checks if `pendingAggregates` has entries, and if it does flushes them by calling `sendSession` */ - flush() { - const sessionAggregates = this.getSessionAggregates(); - if (sessionAggregates.aggregates.length === 0) { - return; - } - this._pendingAggregates = /* @__PURE__ */ new Map(); - this._client.sendSession(sessionAggregates); - } - /** Massages the entries in `pendingAggregates` and returns aggregated sessions */ - getSessionAggregates() { - const aggregates = Array.from(this._pendingAggregates.values()); - const sessionAggregates = { - attrs: this._sessionAttrs, - aggregates - }; - return dropUndefinedKeys(sessionAggregates); - } - /** JSDoc */ - close() { - clearInterval(this._intervalId); - this._isEnabled = false; - this.flush(); - } - /** - * Wrapper function for _incrementSessionStatusCount that checks if the instance of SessionFlusher is enabled then - * fetches the session status of the request from `Scope.getRequestSession().status` on the scope and passes them to - * `_incrementSessionStatusCount` along with the start date - */ - incrementSessionStatusCount() { - if (!this._isEnabled) { - return; - } - const isolationScope = getIsolationScope(); - const requestSession = isolationScope.getRequestSession(); - if (requestSession && requestSession.status) { - this._incrementSessionStatusCount(requestSession.status, /* @__PURE__ */ new Date()); - isolationScope.setRequestSession(void 0); - } - } - /** - * Increments status bucket in pendingAggregates buffer (internal state) corresponding to status of - * the session received - */ - // eslint-disable-next-line deprecation/deprecation - _incrementSessionStatusCount(status, date) { - const sessionStartedTrunc = new Date(date).setSeconds(0, 0); - let aggregationCounts = this._pendingAggregates.get(sessionStartedTrunc); - if (!aggregationCounts) { - aggregationCounts = { started: new Date(sessionStartedTrunc).toISOString() }; - this._pendingAggregates.set(sessionStartedTrunc, aggregationCounts); - } - switch (status) { - case "errored": - aggregationCounts.errored = (aggregationCounts.errored || 0) + 1; - return aggregationCounts.errored; - case "ok": - aggregationCounts.exited = (aggregationCounts.exited || 0) + 1; - return aggregationCounts.exited; - default: - aggregationCounts.crashed = (aggregationCounts.crashed || 0) + 1; - return aggregationCounts.crashed; - } - } -} -const SENTRY_API_VERSION = "7"; -function getBaseApiEndpoint(dsn) { - const protocol = dsn.protocol ? `${dsn.protocol}:` : ""; - const port = dsn.port ? `:${dsn.port}` : ""; - return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ""}/api/`; -} -__name(getBaseApiEndpoint, "getBaseApiEndpoint"); -function _getIngestEndpoint(dsn) { - return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`; -} -__name(_getIngestEndpoint, "_getIngestEndpoint"); -function _encodedAuth(dsn, sdkInfo) { - const params = { - sentry_version: SENTRY_API_VERSION - }; - if (dsn.publicKey) { - params.sentry_key = dsn.publicKey; - } - if (sdkInfo) { - params.sentry_client = `${sdkInfo.name}/${sdkInfo.version}`; - } - return new URLSearchParams(params).toString(); -} -__name(_encodedAuth, "_encodedAuth"); -function getEnvelopeEndpointWithUrlEncodedAuth(dsn, tunnel, sdkInfo) { - return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`; -} -__name(getEnvelopeEndpointWithUrlEncodedAuth, "getEnvelopeEndpointWithUrlEncodedAuth"); -function getReportDialogEndpoint(dsnLike, dialogOptions) { - const dsn = makeDsn(dsnLike); - if (!dsn) { - return ""; - } - const endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`; - let encodedOptions = `dsn=${dsnToString(dsn)}`; - for (const key in dialogOptions) { - if (key === "dsn") { - continue; - } - if (key === "onClose") { - continue; - } - if (key === "user") { - const user = dialogOptions.user; - if (!user) { - continue; - } - if (user.name) { - encodedOptions += `&name=${encodeURIComponent(user.name)}`; - } - if (user.email) { - encodedOptions += `&email=${encodeURIComponent(user.email)}`; - } - } else { - encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key])}`; - } - } - return `${endpoint}?${encodedOptions}`; -} -__name(getReportDialogEndpoint, "getReportDialogEndpoint"); -const installedIntegrations = []; -function filterDuplicates(integrations) { - const integrationsByName = {}; - integrations.forEach((currentInstance2) => { - const { name: name2 } = currentInstance2; - const existingInstance = integrationsByName[name2]; - if (existingInstance && !existingInstance.isDefaultInstance && currentInstance2.isDefaultInstance) { - return; - } - integrationsByName[name2] = currentInstance2; - }); - return Object.values(integrationsByName); -} -__name(filterDuplicates, "filterDuplicates"); -function getIntegrationsToSetup(options4) { - const defaultIntegrations = options4.defaultIntegrations || []; - const userIntegrations = options4.integrations; - defaultIntegrations.forEach((integration) => { - integration.isDefaultInstance = true; - }); - let integrations; - if (Array.isArray(userIntegrations)) { - integrations = [...defaultIntegrations, ...userIntegrations]; - } else if (typeof userIntegrations === "function") { - const resolvedUserIntegrations = userIntegrations(defaultIntegrations); - integrations = Array.isArray(resolvedUserIntegrations) ? resolvedUserIntegrations : [resolvedUserIntegrations]; - } else { - integrations = defaultIntegrations; - } - const finalIntegrations = filterDuplicates(integrations); - const debugIndex = finalIntegrations.findIndex((integration) => integration.name === "Debug"); - if (debugIndex > -1) { - const [debugInstance] = finalIntegrations.splice(debugIndex, 1); - finalIntegrations.push(debugInstance); - } - return finalIntegrations; -} -__name(getIntegrationsToSetup, "getIntegrationsToSetup"); -function setupIntegrations(client, integrations) { - const integrationIndex = {}; - integrations.forEach((integration) => { - if (integration) { - setupIntegration(client, integration, integrationIndex); - } - }); - return integrationIndex; -} -__name(setupIntegrations, "setupIntegrations"); -function afterSetupIntegrations(client, integrations) { - for (const integration of integrations) { - if (integration && integration.afterAllSetup) { - integration.afterAllSetup(client); - } - } -} -__name(afterSetupIntegrations, "afterSetupIntegrations"); -function setupIntegration(client, integration, integrationIndex) { - if (integrationIndex[integration.name]) { - DEBUG_BUILD$6 && logger$2.log(`Integration skipped because it was already installed: ${integration.name}`); - return; - } - integrationIndex[integration.name] = integration; - if (installedIntegrations.indexOf(integration.name) === -1 && typeof integration.setupOnce === "function") { - integration.setupOnce(); - installedIntegrations.push(integration.name); - } - if (integration.setup && typeof integration.setup === "function") { - integration.setup(client); - } - if (typeof integration.preprocessEvent === "function") { - const callback = integration.preprocessEvent.bind(integration); - client.on("preprocessEvent", (event, hint) => callback(event, hint, client)); - } - if (typeof integration.processEvent === "function") { - const callback = integration.processEvent.bind(integration); - const processor = Object.assign((event, hint) => callback(event, hint, client), { - id: integration.name - }); - client.addEventProcessor(processor); - } - DEBUG_BUILD$6 && logger$2.log(`Integration installed: ${integration.name}`); -} -__name(setupIntegration, "setupIntegration"); -function addIntegration(integration) { - const client = getClient(); - if (!client) { - DEBUG_BUILD$6 && logger$2.warn(`Cannot add integration "${integration.name}" because no SDK Client is available.`); - return; - } - client.addIntegration(integration); -} -__name(addIntegration, "addIntegration"); -function defineIntegration(fn) { - return fn; -} -__name(defineIntegration, "defineIntegration"); -function createClientReportEnvelope(discarded_events, dsn, timestamp2) { - const clientReportItem = [ - { type: "client_report" }, - { - timestamp: timestamp2 || dateTimestampInSeconds(), - discarded_events - } - ]; - return createEnvelope(dsn ? { dsn } : {}, [clientReportItem]); -} -__name(createClientReportEnvelope, "createClientReportEnvelope"); -class SentryError extends Error { - static { - __name(this, "SentryError"); - } - /** Display name of this error instance. */ - constructor(message3, logLevel = "warn") { - super(message3); - this.message = message3; - this.name = new.target.prototype.constructor.name; - Object.setPrototypeOf(this, new.target.prototype); - this.logLevel = logLevel; - } -} -const ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured."; -class BaseClient { - static { - __name(this, "BaseClient"); - } - /** Options passed to the SDK. */ - /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */ - /** Array of set up integrations. */ - /** Number of calls being processed */ - /** Holds flushable */ - // eslint-disable-next-line @typescript-eslint/ban-types - /** - * Initializes this client instance. - * - * @param options Options for the client. - */ - constructor(options4) { - this._options = options4; - this._integrations = {}; - this._numProcessing = 0; - this._outcomes = {}; - this._hooks = {}; - this._eventProcessors = []; - if (options4.dsn) { - this._dsn = makeDsn(options4.dsn); - } else { - DEBUG_BUILD$6 && logger$2.warn("No DSN provided, client will not send events."); - } - if (this._dsn) { - const url = getEnvelopeEndpointWithUrlEncodedAuth( - this._dsn, - options4.tunnel, - options4._metadata ? options4._metadata.sdk : void 0 - ); - this._transport = options4.transport({ - tunnel: this._options.tunnel, - recordDroppedEvent: this.recordDroppedEvent.bind(this), - ...options4.transportOptions, - url - }); - } - const tracingOptions = ["enableTracing", "tracesSampleRate", "tracesSampler"]; - const undefinedOption = tracingOptions.find((option3) => option3 in options4 && options4[option3] == void 0); - if (undefinedOption) { - consoleSandbox(() => { - console.warn( - `[Sentry] Deprecation warning: \`${undefinedOption}\` is set to undefined, which leads to tracing being enabled. In v9, a value of \`undefined\` will result in tracing being disabled.` - ); - }); - } - } - /** - * @inheritDoc - */ - captureException(exception, hint, scope) { - const eventId = uuid4(); - if (checkOrSetAlreadyCaught(exception)) { - DEBUG_BUILD$6 && logger$2.log(ALREADY_SEEN_ERROR); - return eventId; - } - const hintWithEventId = { - event_id: eventId, - ...hint - }; - this._process( - this.eventFromException(exception, hintWithEventId).then( - (event) => this._captureEvent(event, hintWithEventId, scope) - ) - ); - return hintWithEventId.event_id; - } - /** - * @inheritDoc - */ - captureMessage(message3, level, hint, currentScope) { - const hintWithEventId = { - event_id: uuid4(), - ...hint - }; - const eventMessage = isParameterizedString(message3) ? message3 : String(message3); - const promisedEvent = isPrimitive(message3) ? this.eventFromMessage(eventMessage, level, hintWithEventId) : this.eventFromException(message3, hintWithEventId); - this._process(promisedEvent.then((event) => this._captureEvent(event, hintWithEventId, currentScope))); - return hintWithEventId.event_id; - } - /** - * @inheritDoc - */ - captureEvent(event, hint, currentScope) { - const eventId = uuid4(); - if (hint && hint.originalException && checkOrSetAlreadyCaught(hint.originalException)) { - DEBUG_BUILD$6 && logger$2.log(ALREADY_SEEN_ERROR); - return eventId; - } - const hintWithEventId = { - event_id: eventId, - ...hint - }; - const sdkProcessingMetadata = event.sdkProcessingMetadata || {}; - const capturedSpanScope = sdkProcessingMetadata.capturedSpanScope; - this._process(this._captureEvent(event, hintWithEventId, capturedSpanScope || currentScope)); - return hintWithEventId.event_id; - } - /** - * @inheritDoc - */ - captureSession(session) { - if (!(typeof session.release === "string")) { - DEBUG_BUILD$6 && logger$2.warn("Discarded session because of missing or non-string release"); - } else { - this.sendSession(session); - updateSession(session, { init: false }); - } - } - /** - * @inheritDoc - */ - getDsn() { - return this._dsn; - } - /** - * @inheritDoc - */ - getOptions() { - return this._options; - } - /** - * @see SdkMetadata - * - * @return The metadata of the SDK - */ - getSdkMetadata() { - return this._options._metadata; - } - /** - * @inheritDoc - */ - getTransport() { - return this._transport; - } - /** - * @inheritDoc - */ - flush(timeout) { - const transport = this._transport; - if (transport) { - this.emit("flush"); - return this._isClientDoneProcessing(timeout).then((clientFinished) => { - return transport.flush(timeout).then((transportFlushed) => clientFinished && transportFlushed); - }); - } else { - return resolvedSyncPromise(true); - } - } - /** - * @inheritDoc - */ - close(timeout) { - return this.flush(timeout).then((result) => { - this.getOptions().enabled = false; - this.emit("close"); - return result; - }); - } - /** Get all installed event processors. */ - getEventProcessors() { - return this._eventProcessors; - } - /** @inheritDoc */ - addEventProcessor(eventProcessor) { - this._eventProcessors.push(eventProcessor); - } - /** @inheritdoc */ - init() { - if (this._isEnabled() || // Force integrations to be setup even if no DSN was set when we have - // Spotlight enabled. This is particularly important for browser as we - // don't support the `spotlight` option there and rely on the users - // adding the `spotlightBrowserIntegration()` to their integrations which - // wouldn't get initialized with the check below when there's no DSN set. - this._options.integrations.some(({ name: name2 }) => name2.startsWith("Spotlight"))) { - this._setupIntegrations(); - } - } - /** - * Gets an installed integration by its name. - * - * @returns The installed integration or `undefined` if no integration with that `name` was installed. - */ - getIntegrationByName(integrationName) { - return this._integrations[integrationName]; - } - /** - * @inheritDoc - */ - addIntegration(integration) { - const isAlreadyInstalled = this._integrations[integration.name]; - setupIntegration(this, integration, this._integrations); - if (!isAlreadyInstalled) { - afterSetupIntegrations(this, [integration]); - } - } - /** - * @inheritDoc - */ - sendEvent(event, hint = {}) { - this.emit("beforeSendEvent", event, hint); - let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel); - for (const attachment of hint.attachments || []) { - env = addItemToEnvelope(env, createAttachmentEnvelopeItem(attachment)); - } - const promise = this.sendEnvelope(env); - if (promise) { - promise.then((sendResponse) => this.emit("afterSendEvent", event, sendResponse), null); - } - } - /** - * @inheritDoc - */ - sendSession(session) { - const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel); - this.sendEnvelope(env); - } - /** - * @inheritDoc - */ - recordDroppedEvent(reason, category, eventOrCount) { - if (this._options.sendClientReports) { - const count = typeof eventOrCount === "number" ? eventOrCount : 1; - const key = `${reason}:${category}`; - DEBUG_BUILD$6 && logger$2.log(`Recording outcome: "${key}"${count > 1 ? ` (${count} times)` : ""}`); - this._outcomes[key] = (this._outcomes[key] || 0) + count; - } - } - // Keep on() & emit() signatures in sync with types' client.ts interface - /* eslint-disable @typescript-eslint/unified-signatures */ - /** @inheritdoc */ - /** @inheritdoc */ - on(hook, callback) { - const hooks2 = this._hooks[hook] = this._hooks[hook] || []; - hooks2.push(callback); - return () => { - const cbIndex = hooks2.indexOf(callback); - if (cbIndex > -1) { - hooks2.splice(cbIndex, 1); - } - }; - } - /** @inheritdoc */ - /** @inheritdoc */ - emit(hook, ...rest) { - const callbacks = this._hooks[hook]; - if (callbacks) { - callbacks.forEach((callback) => callback(...rest)); - } - } - /** - * @inheritdoc - */ - sendEnvelope(envelope) { - this.emit("beforeEnvelope", envelope); - if (this._isEnabled() && this._transport) { - return this._transport.send(envelope).then(null, (reason) => { - DEBUG_BUILD$6 && logger$2.error("Error while sending envelope:", reason); - return reason; - }); - } - DEBUG_BUILD$6 && logger$2.error("Transport disabled"); - return resolvedSyncPromise({}); - } - /* eslint-enable @typescript-eslint/unified-signatures */ - /** Setup integrations for this client. */ - _setupIntegrations() { - const { integrations } = this._options; - this._integrations = setupIntegrations(this, integrations); - afterSetupIntegrations(this, integrations); - } - /** Updates existing session based on the provided event */ - _updateSessionFromEvent(session, event) { - let crashed = false; - let errored = false; - const exceptions = event.exception && event.exception.values; - if (exceptions) { - errored = true; - for (const ex of exceptions) { - const mechanism = ex.mechanism; - if (mechanism && mechanism.handled === false) { - crashed = true; - break; - } - } - } - const sessionNonTerminal = session.status === "ok"; - const shouldUpdateAndSend = sessionNonTerminal && session.errors === 0 || sessionNonTerminal && crashed; - if (shouldUpdateAndSend) { - updateSession(session, { - ...crashed && { status: "crashed" }, - errors: session.errors || Number(errored || crashed) - }); - this.captureSession(session); - } - } - /** - * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying - * "no" (resolving to `false`) in order to give the client a chance to potentially finish first. - * - * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not - * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to - * `true`. - * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and - * `false` otherwise - */ - _isClientDoneProcessing(timeout) { - return new SyncPromise((resolve2) => { - let ticked = 0; - const tick = 1; - const interval = setInterval(() => { - if (this._numProcessing == 0) { - clearInterval(interval); - resolve2(true); - } else { - ticked += tick; - if (timeout && ticked >= timeout) { - clearInterval(interval); - resolve2(false); - } - } - }, tick); - }); - } - /** Determines whether this SDK is enabled and a transport is present. */ - _isEnabled() { - return this.getOptions().enabled !== false && this._transport !== void 0; - } - /** - * Adds common information to events. - * - * The information includes release and environment from `options`, - * breadcrumbs and context (extra, tags and user) from the scope. - * - * Information that is already present in the event is never overwritten. For - * nested objects, such as the context, keys are merged. - * - * @param event The original event. - * @param hint May contain additional information about the original exception. - * @param currentScope A scope containing event metadata. - * @returns A new event with more information. - */ - _prepareEvent(event, hint, currentScope = getCurrentScope$1(), isolationScope = getIsolationScope()) { - const options4 = this.getOptions(); - const integrations = Object.keys(this._integrations); - if (!hint.integrations && integrations.length > 0) { - hint.integrations = integrations; - } - this.emit("preprocessEvent", event, hint); - if (!event.type) { - isolationScope.setLastEventId(event.event_id || hint.event_id); - } - return prepareEvent(options4, event, hint, currentScope, this, isolationScope).then((evt) => { - if (evt === null) { - return evt; - } - evt.contexts = { - trace: getTraceContextFromScope(currentScope), - ...evt.contexts - }; - const dynamicSamplingContext = getDynamicSamplingContextFromScope(this, currentScope); - evt.sdkProcessingMetadata = { - dynamicSamplingContext, - ...evt.sdkProcessingMetadata - }; - return evt; - }); - } - /** - * Processes the event and logs an error in case of rejection - * @param event - * @param hint - * @param scope - */ - _captureEvent(event, hint = {}, scope) { - return this._processEvent(event, hint, scope).then( - (finalEvent) => { - return finalEvent.event_id; - }, - (reason) => { - if (DEBUG_BUILD$6) { - const sentryError = reason; - if (sentryError.logLevel === "log") { - logger$2.log(sentryError.message); - } else { - logger$2.warn(sentryError); - } - } - return void 0; - } - ); - } - /** - * Processes an event (either error or message) and sends it to Sentry. - * - * This also adds breadcrumbs and context information to the event. However, - * platform specific meta data (such as the User's IP address) must be added - * by the SDK implementor. - * - * - * @param event The event to send to Sentry. - * @param hint May contain additional information about the original exception. - * @param currentScope A scope containing event metadata. - * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send. - */ - _processEvent(event, hint, currentScope) { - const options4 = this.getOptions(); - const { sampleRate } = options4; - const isTransaction = isTransactionEvent$1(event); - const isError2 = isErrorEvent$1(event); - const eventType = event.type || "error"; - const beforeSendLabel = `before send for type \`${eventType}\``; - const parsedSampleRate = typeof sampleRate === "undefined" ? void 0 : parseSampleRate(sampleRate); - if (isError2 && typeof parsedSampleRate === "number" && Math.random() > parsedSampleRate) { - this.recordDroppedEvent("sample_rate", "error", event); - return rejectedSyncPromise( - new SentryError( - `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`, - "log" - ) - ); - } - const dataCategory = eventType === "replay_event" ? "replay" : eventType; - const sdkProcessingMetadata = event.sdkProcessingMetadata || {}; - const capturedSpanIsolationScope = sdkProcessingMetadata.capturedSpanIsolationScope; - return this._prepareEvent(event, hint, currentScope, capturedSpanIsolationScope).then((prepared) => { - if (prepared === null) { - this.recordDroppedEvent("event_processor", dataCategory, event); - throw new SentryError("An event processor returned `null`, will not send event.", "log"); - } - const isInternalException = hint.data && hint.data.__sentry__ === true; - if (isInternalException) { - return prepared; - } - const result = processBeforeSend(this, options4, prepared, hint); - return _validateBeforeSendResult(result, beforeSendLabel); - }).then((processedEvent) => { - if (processedEvent === null) { - this.recordDroppedEvent("before_send", dataCategory, event); - if (isTransaction) { - const spans = event.spans || []; - const spanCount = 1 + spans.length; - this.recordDroppedEvent("before_send", "span", spanCount); - } - throw new SentryError(`${beforeSendLabel} returned \`null\`, will not send event.`, "log"); - } - const session = currentScope && currentScope.getSession(); - if (!isTransaction && session) { - this._updateSessionFromEvent(session, processedEvent); - } - if (isTransaction) { - const spanCountBefore = processedEvent.sdkProcessingMetadata && processedEvent.sdkProcessingMetadata.spanCountBeforeProcessing || 0; - const spanCountAfter = processedEvent.spans ? processedEvent.spans.length : 0; - const droppedSpanCount = spanCountBefore - spanCountAfter; - if (droppedSpanCount > 0) { - this.recordDroppedEvent("before_send", "span", droppedSpanCount); - } - } - const transactionInfo = processedEvent.transaction_info; - if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) { - const source = "custom"; - processedEvent.transaction_info = { - ...transactionInfo, - source - }; - } - this.sendEvent(processedEvent, hint); - return processedEvent; - }).then(null, (reason) => { - if (reason instanceof SentryError) { - throw reason; - } - this.captureException(reason, { - data: { - __sentry__: true - }, - originalException: reason - }); - throw new SentryError( - `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event. -Reason: ${reason}` - ); - }); - } - /** - * Occupies the client with processing and event - */ - _process(promise) { - this._numProcessing++; - void promise.then( - (value4) => { - this._numProcessing--; - return value4; - }, - (reason) => { - this._numProcessing--; - return reason; - } - ); - } - /** - * Clears outcomes on this client and returns them. - */ - _clearOutcomes() { - const outcomes = this._outcomes; - this._outcomes = {}; - return Object.entries(outcomes).map(([key, quantity]) => { - const [reason, category] = key.split(":"); - return { - reason, - category, - quantity - }; - }); - } - /** - * Sends client reports as an envelope. - */ - _flushOutcomes() { - DEBUG_BUILD$6 && logger$2.log("Flushing outcomes..."); - const outcomes = this._clearOutcomes(); - if (outcomes.length === 0) { - DEBUG_BUILD$6 && logger$2.log("No outcomes to send"); - return; - } - if (!this._dsn) { - DEBUG_BUILD$6 && logger$2.log("No dsn provided, will not send outcomes"); - return; - } - DEBUG_BUILD$6 && logger$2.log("Sending outcomes:", outcomes); - const envelope = createClientReportEnvelope(outcomes, this._options.tunnel && dsnToString(this._dsn)); - this.sendEnvelope(envelope); - } - /** - * @inheritDoc - */ -} -function _validateBeforeSendResult(beforeSendResult, beforeSendLabel) { - const invalidValueError = `${beforeSendLabel} must return \`null\` or a valid event.`; - if (isThenable$1(beforeSendResult)) { - return beforeSendResult.then( - (event) => { - if (!isPlainObject$5(event) && event !== null) { - throw new SentryError(invalidValueError); - } - return event; - }, - (e2) => { - throw new SentryError(`${beforeSendLabel} rejected with ${e2}`); - } - ); - } else if (!isPlainObject$5(beforeSendResult) && beforeSendResult !== null) { - throw new SentryError(invalidValueError); - } - return beforeSendResult; -} -__name(_validateBeforeSendResult, "_validateBeforeSendResult"); -function processBeforeSend(client, options4, event, hint) { - const { beforeSend, beforeSendTransaction, beforeSendSpan } = options4; - if (isErrorEvent$1(event) && beforeSend) { - return beforeSend(event, hint); - } - if (isTransactionEvent$1(event)) { - if (event.spans && beforeSendSpan) { - const processedSpans = []; - for (const span of event.spans) { - const processedSpan = beforeSendSpan(span); - if (processedSpan) { - processedSpans.push(processedSpan); - } else { - showSpanDropWarning(); - client.recordDroppedEvent("before_send", "span"); - } - } - event.spans = processedSpans; - } - if (beforeSendTransaction) { - if (event.spans) { - const spanCountBefore = event.spans.length; - event.sdkProcessingMetadata = { - ...event.sdkProcessingMetadata, - spanCountBeforeProcessing: spanCountBefore - }; - } - return beforeSendTransaction(event, hint); - } - } - return event; -} -__name(processBeforeSend, "processBeforeSend"); -function isErrorEvent$1(event) { - return event.type === void 0; -} -__name(isErrorEvent$1, "isErrorEvent$1"); -function isTransactionEvent$1(event) { - return event.type === "transaction"; -} -__name(isTransactionEvent$1, "isTransactionEvent$1"); -function createCheckInEnvelope(checkIn, dynamicSamplingContext, metadata, tunnel, dsn) { - const headers = { - sent_at: (/* @__PURE__ */ new Date()).toISOString() - }; - if (metadata && metadata.sdk) { - headers.sdk = { - name: metadata.sdk.name, - version: metadata.sdk.version - }; - } - if (!!tunnel && !!dsn) { - headers.dsn = dsnToString(dsn); - } - if (dynamicSamplingContext) { - headers.trace = dropUndefinedKeys(dynamicSamplingContext); - } - const item3 = createCheckInEnvelopeItem(checkIn); - return createEnvelope(headers, [item3]); -} -__name(createCheckInEnvelope, "createCheckInEnvelope"); -function createCheckInEnvelopeItem(checkIn) { - const checkInHeaders = { - type: "check_in" - }; - return [checkInHeaders, checkIn]; -} -__name(createCheckInEnvelopeItem, "createCheckInEnvelopeItem"); -function parseStackFrames$1(stackParser, error2) { - return stackParser(error2.stack || "", 1); -} -__name(parseStackFrames$1, "parseStackFrames$1"); -function exceptionFromError$1(stackParser, error2) { - const exception = { - type: error2.name || error2.constructor.name, - value: error2.message - }; - const frames = parseStackFrames$1(stackParser, error2); - if (frames.length) { - exception.stacktrace = { frames }; - } - return exception; -} -__name(exceptionFromError$1, "exceptionFromError$1"); -function getErrorPropertyFromObject$1(obj) { - for (const prop2 in obj) { - if (Object.prototype.hasOwnProperty.call(obj, prop2)) { - const value4 = obj[prop2]; - if (value4 instanceof Error) { - return value4; - } - } - } - return void 0; -} -__name(getErrorPropertyFromObject$1, "getErrorPropertyFromObject$1"); -function getMessageForObject(exception) { - if ("name" in exception && typeof exception.name === "string") { - let message3 = `'${exception.name}' captured as exception`; - if ("message" in exception && typeof exception.message === "string") { - message3 += ` with message '${exception.message}'`; - } - return message3; - } else if ("message" in exception && typeof exception.message === "string") { - return exception.message; - } - const keys2 = extractExceptionKeysForMessage(exception); - if (isErrorEvent$2(exception)) { - return `Event \`ErrorEvent\` captured as exception with message \`${exception.message}\``; - } - const className = getObjectClassName$1(exception); - return `${className && className !== "Object" ? `'${className}'` : "Object"} captured as exception with keys: ${keys2}`; -} -__name(getMessageForObject, "getMessageForObject"); -function getObjectClassName$1(obj) { - try { - const prototype2 = Object.getPrototypeOf(obj); - return prototype2 ? prototype2.constructor.name : void 0; - } catch (e2) { - } -} -__name(getObjectClassName$1, "getObjectClassName$1"); -function getException(client, mechanism, exception, hint) { - if (isError(exception)) { - return [exception, void 0]; - } - mechanism.synthetic = true; - if (isPlainObject$5(exception)) { - const normalizeDepth = client && client.getOptions().normalizeDepth; - const extras = { ["__serialized__"]: normalizeToSize(exception, normalizeDepth) }; - const errorFromProp = getErrorPropertyFromObject$1(exception); - if (errorFromProp) { - return [errorFromProp, extras]; - } - const message3 = getMessageForObject(exception); - const ex2 = hint && hint.syntheticException || new Error(message3); - ex2.message = message3; - return [ex2, extras]; - } - const ex = hint && hint.syntheticException || new Error(exception); - ex.message = `${exception}`; - return [ex, void 0]; -} -__name(getException, "getException"); -function eventFromUnknownInput$1(client, stackParser, exception, hint) { - const providedMechanism = hint && hint.data && hint.data.mechanism; - const mechanism = providedMechanism || { - handled: true, - type: "generic" - }; - const [ex, extras] = getException(client, mechanism, exception, hint); - const event = { - exception: { - values: [exceptionFromError$1(stackParser, ex)] - } - }; - if (extras) { - event.extra = extras; - } - addExceptionTypeValue(event, void 0, void 0); - addExceptionMechanism(event, mechanism); - return { - ...event, - event_id: hint && hint.event_id - }; -} -__name(eventFromUnknownInput$1, "eventFromUnknownInput$1"); -function eventFromMessage$1(stackParser, message3, level = "info", hint, attachStacktrace) { - const event = { - event_id: hint && hint.event_id, - level - }; - if (attachStacktrace && hint && hint.syntheticException) { - const frames = parseStackFrames$1(stackParser, hint.syntheticException); - if (frames.length) { - event.exception = { - values: [ - { - value: message3, - stacktrace: { frames } - } - ] - }; - addExceptionMechanism(event, { synthetic: true }); - } - } - if (isParameterizedString(message3)) { - const { __sentry_template_string__, __sentry_template_values__ } = message3; - event.logentry = { - message: __sentry_template_string__, - params: __sentry_template_values__ - }; - return event; - } - event.message = message3; - return event; -} -__name(eventFromMessage$1, "eventFromMessage$1"); -class ServerRuntimeClient extends BaseClient { - static { - __name(this, "ServerRuntimeClient"); - } - // eslint-disable-next-line deprecation/deprecation - /** - * Creates a new Edge SDK instance. - * @param options Configuration options for this SDK. - */ - constructor(options4) { - registerSpanErrorInstrumentation(); - super(options4); - } - /** - * @inheritDoc - */ - eventFromException(exception, hint) { - const event = eventFromUnknownInput$1(this, this._options.stackParser, exception, hint); - event.level = "error"; - return resolvedSyncPromise(event); - } - /** - * @inheritDoc - */ - eventFromMessage(message3, level = "info", hint) { - return resolvedSyncPromise( - eventFromMessage$1(this._options.stackParser, message3, level, hint, this._options.attachStacktrace) - ); - } - /** - * @inheritDoc - */ - captureException(exception, hint, scope) { - if (this._options.autoSessionTracking && this._sessionFlusher) { - const requestSession = getIsolationScope().getRequestSession(); - if (requestSession && requestSession.status === "ok") { - requestSession.status = "errored"; - } - } - return super.captureException(exception, hint, scope); - } - /** - * @inheritDoc - */ - captureEvent(event, hint, scope) { - if (this._options.autoSessionTracking && this._sessionFlusher) { - const eventType = event.type || "exception"; - const isException = eventType === "exception" && event.exception && event.exception.values && event.exception.values.length > 0; - if (isException) { - const requestSession = getIsolationScope().getRequestSession(); - if (requestSession && requestSession.status === "ok") { - requestSession.status = "errored"; - } - } - } - return super.captureEvent(event, hint, scope); - } - /** - * - * @inheritdoc - */ - close(timeout) { - if (this._sessionFlusher) { - this._sessionFlusher.close(); - } - return super.close(timeout); - } - /** - * Initializes an instance of SessionFlusher on the client which will aggregate and periodically flush session data. - * - * NOTICE: This method will implicitly create an interval that is periodically called. - * To clean up this resources, call `.close()` when you no longer intend to use the client. - * Not doing so will result in a memory leak. - */ - initSessionFlusher() { - const { release, environment } = this._options; - if (!release) { - DEBUG_BUILD$6 && logger$2.warn("Cannot initialize an instance of SessionFlusher if no release is provided!"); - } else { - this._sessionFlusher = new SessionFlusher(this, { - release, - environment - }); - } - } - /** - * Create a cron monitor check in and send it to Sentry. - * - * @param checkIn An object that describes a check in. - * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want - * to create a monitor automatically when sending a check in. - */ - captureCheckIn(checkIn, monitorConfig, scope) { - const id3 = "checkInId" in checkIn && checkIn.checkInId ? checkIn.checkInId : uuid4(); - if (!this._isEnabled()) { - DEBUG_BUILD$6 && logger$2.warn("SDK not enabled, will not capture checkin."); - return id3; - } - const options4 = this.getOptions(); - const { release, environment, tunnel } = options4; - const serializedCheckIn = { - check_in_id: id3, - monitor_slug: checkIn.monitorSlug, - status: checkIn.status, - release, - environment - }; - if ("duration" in checkIn) { - serializedCheckIn.duration = checkIn.duration; - } - if (monitorConfig) { - serializedCheckIn.monitor_config = { - schedule: monitorConfig.schedule, - checkin_margin: monitorConfig.checkinMargin, - max_runtime: monitorConfig.maxRuntime, - timezone: monitorConfig.timezone, - failure_issue_threshold: monitorConfig.failureIssueThreshold, - recovery_threshold: monitorConfig.recoveryThreshold - }; - } - const [dynamicSamplingContext, traceContext] = this._getTraceInfoFromScope(scope); - if (traceContext) { - serializedCheckIn.contexts = { - trace: traceContext - }; - } - const envelope = createCheckInEnvelope( - serializedCheckIn, - dynamicSamplingContext, - this.getSdkMetadata(), - tunnel, - this.getDsn() - ); - DEBUG_BUILD$6 && logger$2.info("Sending checkin:", checkIn.monitorSlug, checkIn.status); - this.sendEnvelope(envelope); - return id3; - } - /** - * Method responsible for capturing/ending a request session by calling `incrementSessionStatusCount` to increment - * appropriate session aggregates bucket - * - * @deprecated This method should not be used or extended. It's functionality will move into the `httpIntegration` and not be part of any public API. - */ - _captureRequestSession() { - if (!this._sessionFlusher) { - DEBUG_BUILD$6 && logger$2.warn("Discarded request mode session because autoSessionTracking option was disabled"); - } else { - this._sessionFlusher.incrementSessionStatusCount(); - } - } - /** - * @inheritDoc - */ - _prepareEvent(event, hint, scope, isolationScope) { - if (this._options.platform) { - event.platform = event.platform || this._options.platform; - } - if (this._options.runtime) { - event.contexts = { - ...event.contexts, - runtime: (event.contexts || {}).runtime || this._options.runtime - }; - } - if (this._options.serverName) { - event.server_name = event.server_name || this._options.serverName; - } - return super._prepareEvent(event, hint, scope, isolationScope); - } - /** Extract trace information from scope */ - _getTraceInfoFromScope(scope) { - if (!scope) { - return [void 0, void 0]; - } - const span = _getSpanForScope(scope); - const traceContext = span ? spanToTraceContext(span) : getTraceContextFromScope(scope); - const dynamicSamplingContext = span ? getDynamicSamplingContextFromSpan(span) : getDynamicSamplingContextFromScope(this, scope); - return [dynamicSamplingContext, traceContext]; - } -} -function initAndBind(clientClass, options4) { - if (options4.debug === true) { - if (DEBUG_BUILD$6) { - logger$2.enable(); - } else { - consoleSandbox(() => { - console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle."); - }); - } - } - const scope = getCurrentScope$1(); - scope.update(options4.initialScope); - const client = new clientClass(options4); - setCurrentClient(client); - client.init(); - return client; -} -__name(initAndBind, "initAndBind"); -function setCurrentClient(client) { - getCurrentScope$1().setClient(client); -} -__name(setCurrentClient, "setCurrentClient"); -function makePromiseBuffer(limit) { - const buffer2 = []; - function isReady() { - return limit === void 0 || buffer2.length < limit; - } - __name(isReady, "isReady"); - function remove4(task) { - return buffer2.splice(buffer2.indexOf(task), 1)[0] || Promise.resolve(void 0); - } - __name(remove4, "remove"); - function add3(taskProducer) { - if (!isReady()) { - return rejectedSyncPromise(new SentryError("Not adding Promise because buffer limit was reached.")); - } - const task = taskProducer(); - if (buffer2.indexOf(task) === -1) { - buffer2.push(task); - } - void task.then(() => remove4(task)).then( - null, - () => remove4(task).then(null, () => { - }) - ); - return task; - } - __name(add3, "add"); - function drain(timeout) { - return new SyncPromise((resolve2, reject3) => { - let counter = buffer2.length; - if (!counter) { - return resolve2(true); - } - const capturedSetTimeout = setTimeout(() => { - if (timeout && timeout > 0) { - resolve2(false); - } - }, timeout); - buffer2.forEach((item3) => { - void resolvedSyncPromise(item3).then(() => { - if (!--counter) { - clearTimeout(capturedSetTimeout); - resolve2(true); - } - }, reject3); - }); - }); - } - __name(drain, "drain"); - return { - $: buffer2, - add: add3, - drain - }; -} -__name(makePromiseBuffer, "makePromiseBuffer"); -const DEFAULT_RETRY_AFTER = 60 * 1e3; -function parseRetryAfterHeader(header3, now2 = Date.now()) { - const headerDelay = parseInt(`${header3}`, 10); - if (!isNaN(headerDelay)) { - return headerDelay * 1e3; - } - const headerDate = Date.parse(`${header3}`); - if (!isNaN(headerDate)) { - return headerDate - now2; - } - return DEFAULT_RETRY_AFTER; -} -__name(parseRetryAfterHeader, "parseRetryAfterHeader"); -function disabledUntil(limits, dataCategory) { - return limits[dataCategory] || limits.all || 0; -} -__name(disabledUntil, "disabledUntil"); -function isRateLimited(limits, dataCategory, now2 = Date.now()) { - return disabledUntil(limits, dataCategory) > now2; -} -__name(isRateLimited, "isRateLimited"); -function updateRateLimits(limits, { statusCode, headers }, now2 = Date.now()) { - const updatedRateLimits = { - ...limits - }; - const rateLimitHeader = headers && headers["x-sentry-rate-limits"]; - const retryAfterHeader = headers && headers["retry-after"]; - if (rateLimitHeader) { - for (const limit of rateLimitHeader.trim().split(",")) { - const [retryAfter, categories, , , namespaces] = limit.split(":", 5); - const headerDelay = parseInt(retryAfter, 10); - const delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1e3; - if (!categories) { - updatedRateLimits.all = now2 + delay; - } else { - for (const category of categories.split(";")) { - if (category === "metric_bucket") { - if (!namespaces || namespaces.split(";").includes("custom")) { - updatedRateLimits[category] = now2 + delay; - } - } else { - updatedRateLimits[category] = now2 + delay; - } - } - } - } - } else if (retryAfterHeader) { - updatedRateLimits.all = now2 + parseRetryAfterHeader(retryAfterHeader, now2); - } else if (statusCode === 429) { - updatedRateLimits.all = now2 + 60 * 1e3; - } - return updatedRateLimits; -} -__name(updateRateLimits, "updateRateLimits"); -const DEFAULT_TRANSPORT_BUFFER_SIZE = 64; -function createTransport(options4, makeRequest, buffer2 = makePromiseBuffer( - options4.bufferSize || DEFAULT_TRANSPORT_BUFFER_SIZE -)) { - let rateLimits = {}; - const flush2 = /* @__PURE__ */ __name((timeout) => buffer2.drain(timeout), "flush"); - function send(envelope) { - const filteredEnvelopeItems = []; - forEachEnvelopeItem(envelope, (item3, type) => { - const dataCategory = envelopeItemTypeToDataCategory(type); - if (isRateLimited(rateLimits, dataCategory)) { - const event = getEventForEnvelopeItem(item3, type); - options4.recordDroppedEvent("ratelimit_backoff", dataCategory, event); - } else { - filteredEnvelopeItems.push(item3); - } - }); - if (filteredEnvelopeItems.length === 0) { - return resolvedSyncPromise({}); - } - const filteredEnvelope = createEnvelope(envelope[0], filteredEnvelopeItems); - const recordEnvelopeLoss = /* @__PURE__ */ __name((reason) => { - forEachEnvelopeItem(filteredEnvelope, (item3, type) => { - const event = getEventForEnvelopeItem(item3, type); - options4.recordDroppedEvent(reason, envelopeItemTypeToDataCategory(type), event); - }); - }, "recordEnvelopeLoss"); - const requestTask = /* @__PURE__ */ __name(() => makeRequest({ body: serializeEnvelope(filteredEnvelope) }).then( - (response) => { - if (response.statusCode !== void 0 && (response.statusCode < 200 || response.statusCode >= 300)) { - DEBUG_BUILD$6 && logger$2.warn(`Sentry responded with status code ${response.statusCode} to sent event.`); - } - rateLimits = updateRateLimits(rateLimits, response); - return response; - }, - (error2) => { - recordEnvelopeLoss("network_error"); - throw error2; - } - ), "requestTask"); - return buffer2.add(requestTask).then( - (result) => result, - (error2) => { - if (error2 instanceof SentryError) { - DEBUG_BUILD$6 && logger$2.error("Skipped sending event because buffer is full."); - recordEnvelopeLoss("queue_overflow"); - return resolvedSyncPromise({}); - } else { - throw error2; - } - } - ); - } - __name(send, "send"); - return { - send, - flush: flush2 - }; -} -__name(createTransport, "createTransport"); -function getEventForEnvelopeItem(item3, type) { - if (type !== "event" && type !== "transaction") { - return void 0; - } - return Array.isArray(item3) ? item3[1] : void 0; -} -__name(getEventForEnvelopeItem, "getEventForEnvelopeItem"); -const MIN_DELAY = 100; -const START_DELAY = 5e3; -const MAX_DELAY = 36e5; -function makeOfflineTransport(createTransport2) { - function log2(...args) { - DEBUG_BUILD$6 && logger$2.info("[Offline]:", ...args); - } - __name(log2, "log"); - return (options4) => { - const transport = createTransport2(options4); - if (!options4.createStore) { - throw new Error("No `createStore` function was provided"); - } - const store = options4.createStore(options4); - let retryDelay = START_DELAY; - let flushTimer; - function shouldQueue(env, error2, retryDelay2) { - if (envelopeContainsItemType(env, ["client_report"])) { - return false; - } - if (options4.shouldStore) { - return options4.shouldStore(env, error2, retryDelay2); - } - return true; - } - __name(shouldQueue, "shouldQueue"); - function flushIn(delay) { - if (flushTimer) { - clearTimeout(flushTimer); - } - flushTimer = setTimeout(async () => { - flushTimer = void 0; - const found2 = await store.shift(); - if (found2) { - log2("Attempting to send previously queued event"); - found2[0].sent_at = (/* @__PURE__ */ new Date()).toISOString(); - void send(found2, true).catch((e2) => { - log2("Failed to retry sending", e2); - }); - } - }, delay); - if (typeof flushTimer !== "number" && flushTimer.unref) { - flushTimer.unref(); - } - } - __name(flushIn, "flushIn"); - function flushWithBackOff() { - if (flushTimer) { - return; - } - flushIn(retryDelay); - retryDelay = Math.min(retryDelay * 2, MAX_DELAY); - } - __name(flushWithBackOff, "flushWithBackOff"); - async function send(envelope, isRetry = false) { - if (!isRetry && envelopeContainsItemType(envelope, ["replay_event", "replay_recording"])) { - await store.push(envelope); - flushIn(MIN_DELAY); - return {}; - } - try { - const result = await transport.send(envelope); - let delay = MIN_DELAY; - if (result) { - if (result.headers && result.headers["retry-after"]) { - delay = parseRetryAfterHeader(result.headers["retry-after"]); - } else if (result.headers && result.headers["x-sentry-rate-limits"]) { - delay = 6e4; - } else if ((result.statusCode || 0) >= 400) { - return result; - } - } - flushIn(delay); - retryDelay = START_DELAY; - return result; - } catch (e2) { - if (await shouldQueue(envelope, e2, retryDelay)) { - if (isRetry) { - await store.unshift(envelope); - } else { - await store.push(envelope); - } - flushWithBackOff(); - log2("Error sending. Event queued.", e2); - return {}; - } else { - throw e2; - } - } - } - __name(send, "send"); - if (options4.flushAtStartup) { - flushWithBackOff(); - } - return { - send, - flush: /* @__PURE__ */ __name((t2) => transport.flush(t2), "flush") - }; - }; -} -__name(makeOfflineTransport, "makeOfflineTransport"); -function eventFromEnvelope(env, types) { - let event; - forEachEnvelopeItem(env, (item3, type) => { - if (types.includes(type)) { - event = Array.isArray(item3) ? item3[1] : void 0; - } - return !!event; - }); - return event; -} -__name(eventFromEnvelope, "eventFromEnvelope"); -function makeOverrideReleaseTransport(createTransport2, release) { - return (options4) => { - const transport = createTransport2(options4); - return { - ...transport, - send: /* @__PURE__ */ __name(async (envelope) => { - const event = eventFromEnvelope(envelope, ["event", "transaction", "profile", "replay_event"]); - if (event) { - event.release = release; - } - return transport.send(envelope); - }, "send") - }; - }; -} -__name(makeOverrideReleaseTransport, "makeOverrideReleaseTransport"); -function overrideDsn(envelope, dsn) { - return createEnvelope( - dsn ? { - ...envelope[0], - dsn - } : envelope[0], - envelope[1] - ); -} -__name(overrideDsn, "overrideDsn"); -function makeMultiplexedTransport(createTransport2, matcher) { - return (options4) => { - const fallbackTransport = createTransport2(options4); - const otherTransports = /* @__PURE__ */ new Map(); - function getTransport(dsn, release) { - const key = release ? `${dsn}:${release}` : dsn; - let transport = otherTransports.get(key); - if (!transport) { - const validatedDsn = dsnFromString(dsn); - if (!validatedDsn) { - return void 0; - } - const url = getEnvelopeEndpointWithUrlEncodedAuth(validatedDsn, options4.tunnel); - transport = release ? makeOverrideReleaseTransport(createTransport2, release)({ ...options4, url }) : createTransport2({ ...options4, url }); - otherTransports.set(key, transport); - } - return [dsn, transport]; - } - __name(getTransport, "getTransport"); - async function send(envelope) { - function getEvent(types) { - const eventTypes = types && types.length ? types : ["event"]; - return eventFromEnvelope(envelope, eventTypes); - } - __name(getEvent, "getEvent"); - const transports = matcher({ envelope, getEvent }).map((result) => { - if (typeof result === "string") { - return getTransport(result, void 0); - } else { - return getTransport(result.dsn, result.release); - } - }).filter((t2) => !!t2); - const transportsWithFallback = transports.length ? transports : [["", fallbackTransport]]; - const results = await Promise.all( - transportsWithFallback.map(([dsn, transport]) => transport.send(overrideDsn(envelope, dsn))) - ); - return results[0]; - } - __name(send, "send"); - async function flush2(timeout) { - const allTransports = [...otherTransports.values(), fallbackTransport]; - const results = await Promise.all(allTransports.map((transport) => transport.flush(timeout))); - return results.every((r2) => r2); - } - __name(flush2, "flush"); - return { - send, - flush: flush2 - }; - }; -} -__name(makeMultiplexedTransport, "makeMultiplexedTransport"); -function isSentryRequestUrl(url, client) { - const dsn = client && client.getDsn(); - const tunnel = client && client.getOptions().tunnel; - return checkDsn(url, dsn) || checkTunnel(url, tunnel); -} -__name(isSentryRequestUrl, "isSentryRequestUrl"); -function checkTunnel(url, tunnel) { - if (!tunnel) { - return false; - } - return removeTrailingSlash$1(url) === removeTrailingSlash$1(tunnel); -} -__name(checkTunnel, "checkTunnel"); -function checkDsn(url, dsn) { - return dsn ? url.includes(dsn.host) : false; -} -__name(checkDsn, "checkDsn"); -function removeTrailingSlash$1(str) { - return str[str.length - 1] === "/" ? str.slice(0, -1) : str; -} -__name(removeTrailingSlash$1, "removeTrailingSlash$1"); -function parameterize(strings, ...values) { - const formatted = new String(String.raw(strings, ...values)); - formatted.__sentry_template_string__ = strings.join("\0").replace(/%/g, "%%").replace(/\0/g, "%s"); - formatted.__sentry_template_values__ = values; - return formatted; -} -__name(parameterize, "parameterize"); -function applySdkMetadata(options4, name2, names = [name2], source = "npm") { - const metadata = options4._metadata || {}; - if (!metadata.sdk) { - metadata.sdk = { - name: `sentry.javascript.${name2}`, - packages: names.map((name3) => ({ - name: `${source}:@sentry/${name3}`, - version: SDK_VERSION - })), - version: SDK_VERSION - }; - } - options4._metadata = metadata; -} -__name(applySdkMetadata, "applySdkMetadata"); -function getTraceData(options4 = {}) { - const client = getClient(); - if (!isEnabled() || !client) { - return {}; - } - const carrier = getMainCarrier(); - const acs = getAsyncContextStrategy(carrier); - if (acs.getTraceData) { - return acs.getTraceData(options4); - } - const scope = getCurrentScope$1(); - const span = options4.span || getActiveSpan(); - const sentryTrace = span ? spanToTraceHeader(span) : scopeToTraceHeader(scope); - const dsc = span ? getDynamicSamplingContextFromSpan(span) : getDynamicSamplingContextFromScope(client, scope); - const baggage = dynamicSamplingContextToSentryBaggageHeader(dsc); - const isValidSentryTraceHeader = TRACEPARENT_REGEXP.test(sentryTrace); - if (!isValidSentryTraceHeader) { - logger$2.warn("Invalid sentry-trace data. Cannot generate trace data"); - return {}; - } - return { - "sentry-trace": sentryTrace, - baggage - }; -} -__name(getTraceData, "getTraceData"); -function scopeToTraceHeader(scope) { - const { traceId, sampled, spanId } = scope.getPropagationContext(); - return generateSentryTraceHeader(traceId, spanId, sampled); -} -__name(scopeToTraceHeader, "scopeToTraceHeader"); -function getTraceMetaTags() { - return Object.entries(getTraceData()).map(([key, value4]) => ``).join("\n"); -} -__name(getTraceMetaTags, "getTraceMetaTags"); -const DEFAULT_BREADCRUMBS = 100; -function addBreadcrumb(breadcrumb, hint) { - const client = getClient(); - const isolationScope = getIsolationScope(); - if (!client) return; - const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } = client.getOptions(); - if (maxBreadcrumbs <= 0) return; - const timestamp2 = dateTimestampInSeconds(); - const mergedBreadcrumb = { timestamp: timestamp2, ...breadcrumb }; - const finalBreadcrumb = beforeBreadcrumb ? consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) : mergedBreadcrumb; - if (finalBreadcrumb === null) return; - if (client.emit) { - client.emit("beforeAddBreadcrumb", finalBreadcrumb, hint); - } - isolationScope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs); -} -__name(addBreadcrumb, "addBreadcrumb"); -let originalFunctionToString; -const INTEGRATION_NAME$l = "FunctionToString"; -const SETUP_CLIENTS$1 = /* @__PURE__ */ new WeakMap(); -const _functionToStringIntegration = /* @__PURE__ */ __name(() => { - return { - name: INTEGRATION_NAME$l, - setupOnce() { - originalFunctionToString = Function.prototype.toString; - try { - Function.prototype.toString = function(...args) { - const originalFunction = getOriginalFunction(this); - const context = SETUP_CLIENTS$1.has(getClient()) && originalFunction !== void 0 ? originalFunction : this; - return originalFunctionToString.apply(context, args); - }; - } catch (e2) { - } - }, - setup(client) { - SETUP_CLIENTS$1.set(client, true); - } - }; -}, "_functionToStringIntegration"); -const functionToStringIntegration = defineIntegration(_functionToStringIntegration); -const DEFAULT_IGNORE_ERRORS = [ - /^Script error\.?$/, - /^Javascript error: Script error\.? on line 0$/, - /^ResizeObserver loop completed with undelivered notifications.$/, - // The browser logs this when a ResizeObserver handler takes a bit longer. Usually this is not an actual issue though. It indicates slowness. - /^Cannot redefine property: googletag$/, - // This is thrown when google tag manager is used in combination with an ad blocker - "undefined is not an object (evaluating 'a.L')", - // Random error that happens but not actionable or noticeable to end-users. - `can't redefine non-configurable property "solana"`, - // Probably a browser extension or custom browser (Brave) throwing this error - "vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)", - // Error thrown by GTM, seemingly not affecting end-users - "Can't find variable: _AutofillCallbackHandler", - // Unactionable error in instagram webview https://developers.facebook.com/community/threads/320013549791141/ - /^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/ - // unactionable error from CEFSharp, a .NET library that embeds chromium in .NET apps -]; -const INTEGRATION_NAME$k = "InboundFilters"; -const _inboundFiltersIntegration = /* @__PURE__ */ __name((options4 = {}) => { - return { - name: INTEGRATION_NAME$k, - processEvent(event, _hint, client) { - const clientOptions = client.getOptions(); - const mergedOptions = _mergeOptions(options4, clientOptions); - return _shouldDropEvent$1(event, mergedOptions) ? null : event; - } - }; -}, "_inboundFiltersIntegration"); -const inboundFiltersIntegration = defineIntegration(_inboundFiltersIntegration); -function _mergeOptions(internalOptions = {}, clientOptions = {}) { - return { - allowUrls: [...internalOptions.allowUrls || [], ...clientOptions.allowUrls || []], - denyUrls: [...internalOptions.denyUrls || [], ...clientOptions.denyUrls || []], - ignoreErrors: [ - ...internalOptions.ignoreErrors || [], - ...clientOptions.ignoreErrors || [], - ...internalOptions.disableErrorDefaults ? [] : DEFAULT_IGNORE_ERRORS - ], - ignoreTransactions: [...internalOptions.ignoreTransactions || [], ...clientOptions.ignoreTransactions || []], - ignoreInternal: internalOptions.ignoreInternal !== void 0 ? internalOptions.ignoreInternal : true - }; -} -__name(_mergeOptions, "_mergeOptions"); -function _shouldDropEvent$1(event, options4) { - if (options4.ignoreInternal && _isSentryError(event)) { - DEBUG_BUILD$6 && logger$2.warn(`Event dropped due to being internal Sentry Error. -Event: ${getEventDescription(event)}`); - return true; - } - if (_isIgnoredError(event, options4.ignoreErrors)) { - DEBUG_BUILD$6 && logger$2.warn( - `Event dropped due to being matched by \`ignoreErrors\` option. -Event: ${getEventDescription(event)}` - ); - return true; - } - if (_isUselessError(event)) { - DEBUG_BUILD$6 && logger$2.warn( - `Event dropped due to not having an error message, error type or stacktrace. -Event: ${getEventDescription( - event - )}` - ); - return true; - } - if (_isIgnoredTransaction(event, options4.ignoreTransactions)) { - DEBUG_BUILD$6 && logger$2.warn( - `Event dropped due to being matched by \`ignoreTransactions\` option. -Event: ${getEventDescription(event)}` - ); - return true; - } - if (_isDeniedUrl(event, options4.denyUrls)) { - DEBUG_BUILD$6 && logger$2.warn( - `Event dropped due to being matched by \`denyUrls\` option. -Event: ${getEventDescription( - event - )}. -Url: ${_getEventFilterUrl(event)}` - ); - return true; - } - if (!_isAllowedUrl(event, options4.allowUrls)) { - DEBUG_BUILD$6 && logger$2.warn( - `Event dropped due to not being matched by \`allowUrls\` option. -Event: ${getEventDescription( - event - )}. -Url: ${_getEventFilterUrl(event)}` - ); - return true; - } - return false; -} -__name(_shouldDropEvent$1, "_shouldDropEvent$1"); -function _isIgnoredError(event, ignoreErrors) { - if (event.type || !ignoreErrors || !ignoreErrors.length) { - return false; - } - return _getPossibleEventMessages(event).some((message3) => stringMatchesSomePattern(message3, ignoreErrors)); -} -__name(_isIgnoredError, "_isIgnoredError"); -function _isIgnoredTransaction(event, ignoreTransactions) { - if (event.type !== "transaction" || !ignoreTransactions || !ignoreTransactions.length) { - return false; - } - const name2 = event.transaction; - return name2 ? stringMatchesSomePattern(name2, ignoreTransactions) : false; -} -__name(_isIgnoredTransaction, "_isIgnoredTransaction"); -function _isDeniedUrl(event, denyUrls) { - if (!denyUrls || !denyUrls.length) { - return false; - } - const url = _getEventFilterUrl(event); - return !url ? false : stringMatchesSomePattern(url, denyUrls); -} -__name(_isDeniedUrl, "_isDeniedUrl"); -function _isAllowedUrl(event, allowUrls) { - if (!allowUrls || !allowUrls.length) { - return true; - } - const url = _getEventFilterUrl(event); - return !url ? true : stringMatchesSomePattern(url, allowUrls); -} -__name(_isAllowedUrl, "_isAllowedUrl"); -function _getPossibleEventMessages(event) { - const possibleMessages = []; - if (event.message) { - possibleMessages.push(event.message); - } - let lastException; - try { - lastException = event.exception.values[event.exception.values.length - 1]; - } catch (e2) { - } - if (lastException) { - if (lastException.value) { - possibleMessages.push(lastException.value); - if (lastException.type) { - possibleMessages.push(`${lastException.type}: ${lastException.value}`); - } - } - } - return possibleMessages; -} -__name(_getPossibleEventMessages, "_getPossibleEventMessages"); -function _isSentryError(event) { - try { - return event.exception.values[0].type === "SentryError"; - } catch (e2) { - } - return false; -} -__name(_isSentryError, "_isSentryError"); -function _getLastValidUrl(frames = []) { - for (let i2 = frames.length - 1; i2 >= 0; i2--) { - const frame = frames[i2]; - if (frame && frame.filename !== "" && frame.filename !== "[native code]") { - return frame.filename || null; - } - } - return null; -} -__name(_getLastValidUrl, "_getLastValidUrl"); -function _getEventFilterUrl(event) { - try { - let frames; - try { - frames = event.exception.values[0].stacktrace.frames; - } catch (e2) { - } - return frames ? _getLastValidUrl(frames) : null; - } catch (oO) { - DEBUG_BUILD$6 && logger$2.error(`Cannot extract url for event ${getEventDescription(event)}`); - return null; - } -} -__name(_getEventFilterUrl, "_getEventFilterUrl"); -function _isUselessError(event) { - if (event.type) { - return false; - } - if (!event.exception || !event.exception.values || event.exception.values.length === 0) { - return false; - } - return ( - // No top-level message - !event.message && // There are no exception values that have a stacktrace, a non-generic-Error type or value - !event.exception.values.some((value4) => value4.stacktrace || value4.type && value4.type !== "Error" || value4.value) - ); -} -__name(_isUselessError, "_isUselessError"); -function applyAggregateErrorsToEvent(exceptionFromErrorImplementation, parser, maxValueLimit = 250, key, limit, event, hint) { - if (!event.exception || !event.exception.values || !hint || !isInstanceOf(hint.originalException, Error)) { - return; - } - const originalException = event.exception.values.length > 0 ? event.exception.values[event.exception.values.length - 1] : void 0; - if (originalException) { - event.exception.values = truncateAggregateExceptions( - aggregateExceptionsFromError( - exceptionFromErrorImplementation, - parser, - limit, - hint.originalException, - key, - event.exception.values, - originalException, - 0 - ), - maxValueLimit - ); - } -} -__name(applyAggregateErrorsToEvent, "applyAggregateErrorsToEvent"); -function aggregateExceptionsFromError(exceptionFromErrorImplementation, parser, limit, error2, key, prevExceptions, exception, exceptionId) { - if (prevExceptions.length >= limit + 1) { - return prevExceptions; - } - let newExceptions = [...prevExceptions]; - if (isInstanceOf(error2[key], Error)) { - applyExceptionGroupFieldsForParentException(exception, exceptionId); - const newException = exceptionFromErrorImplementation(parser, error2[key]); - const newExceptionId = newExceptions.length; - applyExceptionGroupFieldsForChildException(newException, key, newExceptionId, exceptionId); - newExceptions = aggregateExceptionsFromError( - exceptionFromErrorImplementation, - parser, - limit, - error2[key], - key, - [newException, ...newExceptions], - newException, - newExceptionId - ); - } - if (Array.isArray(error2.errors)) { - error2.errors.forEach((childError, i2) => { - if (isInstanceOf(childError, Error)) { - applyExceptionGroupFieldsForParentException(exception, exceptionId); - const newException = exceptionFromErrorImplementation(parser, childError); - const newExceptionId = newExceptions.length; - applyExceptionGroupFieldsForChildException(newException, `errors[${i2}]`, newExceptionId, exceptionId); - newExceptions = aggregateExceptionsFromError( - exceptionFromErrorImplementation, - parser, - limit, - childError, - key, - [newException, ...newExceptions], - newException, - newExceptionId - ); - } - }); - } - return newExceptions; -} -__name(aggregateExceptionsFromError, "aggregateExceptionsFromError"); -function applyExceptionGroupFieldsForParentException(exception, exceptionId) { - exception.mechanism = exception.mechanism || { type: "generic", handled: true }; - exception.mechanism = { - ...exception.mechanism, - ...exception.type === "AggregateError" && { is_exception_group: true }, - exception_id: exceptionId - }; -} -__name(applyExceptionGroupFieldsForParentException, "applyExceptionGroupFieldsForParentException"); -function applyExceptionGroupFieldsForChildException(exception, source, exceptionId, parentId) { - exception.mechanism = exception.mechanism || { type: "generic", handled: true }; - exception.mechanism = { - ...exception.mechanism, - type: "chained", - source, - exception_id: exceptionId, - parent_id: parentId - }; -} -__name(applyExceptionGroupFieldsForChildException, "applyExceptionGroupFieldsForChildException"); -function truncateAggregateExceptions(exceptions, maxValueLength) { - return exceptions.map((exception) => { - if (exception.value) { - exception.value = truncate(exception.value, maxValueLength); - } - return exception; - }); -} -__name(truncateAggregateExceptions, "truncateAggregateExceptions"); -const DEFAULT_KEY$1 = "cause"; -const DEFAULT_LIMIT$2 = 5; -const INTEGRATION_NAME$j = "LinkedErrors"; -const _linkedErrorsIntegration$1 = /* @__PURE__ */ __name((options4 = {}) => { - const limit = options4.limit || DEFAULT_LIMIT$2; - const key = options4.key || DEFAULT_KEY$1; - return { - name: INTEGRATION_NAME$j, - preprocessEvent(event, hint, client) { - const options5 = client.getOptions(); - applyAggregateErrorsToEvent( - exceptionFromError$1, - options5.stackParser, - options5.maxValueLength, - key, - limit, - event, - hint - ); - } - }; -}, "_linkedErrorsIntegration$1"); -const linkedErrorsIntegration$1 = defineIntegration(_linkedErrorsIntegration$1); -const filenameMetadataMap = /* @__PURE__ */ new Map(); -const parsedStacks = /* @__PURE__ */ new Set(); -function ensureMetadataStacksAreParsed(parser) { - if (!GLOBAL_OBJ._sentryModuleMetadata) { - return; - } - for (const stack2 of Object.keys(GLOBAL_OBJ._sentryModuleMetadata)) { - const metadata = GLOBAL_OBJ._sentryModuleMetadata[stack2]; - if (parsedStacks.has(stack2)) { - continue; - } - parsedStacks.add(stack2); - const frames = parser(stack2); - for (const frame of frames.reverse()) { - if (frame.filename) { - filenameMetadataMap.set(frame.filename, metadata); - break; - } - } - } -} -__name(ensureMetadataStacksAreParsed, "ensureMetadataStacksAreParsed"); -function getMetadataForUrl(parser, filename) { - ensureMetadataStacksAreParsed(parser); - return filenameMetadataMap.get(filename); -} -__name(getMetadataForUrl, "getMetadataForUrl"); -function addMetadataToStackFrames(parser, event) { - try { - event.exception.values.forEach((exception) => { - if (!exception.stacktrace) { - return; - } - for (const frame of exception.stacktrace.frames || []) { - if (!frame.filename || frame.module_metadata) { - continue; - } - const metadata = getMetadataForUrl(parser, frame.filename); - if (metadata) { - frame.module_metadata = metadata; - } - } - }); - } catch (_2) { - } -} -__name(addMetadataToStackFrames, "addMetadataToStackFrames"); -function stripMetadataFromStackFrames(event) { - try { - event.exception.values.forEach((exception) => { - if (!exception.stacktrace) { - return; - } - for (const frame of exception.stacktrace.frames || []) { - delete frame.module_metadata; - } - }); - } catch (_2) { - } -} -__name(stripMetadataFromStackFrames, "stripMetadataFromStackFrames"); -const moduleMetadataIntegration = defineIntegration(() => { - return { - name: "ModuleMetadata", - setup(client) { - client.on("beforeEnvelope", (envelope) => { - forEachEnvelopeItem(envelope, (item3, type) => { - if (type === "event") { - const event = Array.isArray(item3) ? item3[1] : void 0; - if (event) { - stripMetadataFromStackFrames(event); - item3[1] = event; - } - } - }); - }); - client.on("applyFrameMetadata", (event) => { - if (event.type) { - return; - } - const stackParser = client.getOptions().stackParser; - addMetadataToStackFrames(stackParser, event); - }); - } - }; -}); -function parseCookie(str) { - const obj = {}; - let index2 = 0; - while (index2 < str.length) { - const eqIdx = str.indexOf("=", index2); - if (eqIdx === -1) { - break; - } - let endIdx = str.indexOf(";", index2); - if (endIdx === -1) { - endIdx = str.length; - } else if (endIdx < eqIdx) { - index2 = str.lastIndexOf(";", eqIdx - 1) + 1; - continue; - } - const key = str.slice(index2, eqIdx).trim(); - if (void 0 === obj[key]) { - let val = str.slice(eqIdx + 1, endIdx).trim(); - if (val.charCodeAt(0) === 34) { - val = val.slice(1, -1); - } - try { - obj[key] = val.indexOf("%") !== -1 ? decodeURIComponent(val) : val; - } catch (e2) { - obj[key] = val; - } - } - index2 = endIdx + 1; - } - return obj; -} -__name(parseCookie, "parseCookie"); -function parseUrl$1(url) { - if (!url) { - return {}; - } - const match2 = url.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/); - if (!match2) { - return {}; - } - const query = match2[6] || ""; - const fragment = match2[8] || ""; - return { - host: match2[4], - path: match2[5], - protocol: match2[2], - search: query, - hash: fragment, - relative: match2[5] + query + fragment - // everything minus origin - }; -} -__name(parseUrl$1, "parseUrl$1"); -function stripUrlQueryAndFragment(urlPath) { - return urlPath.split(/[?#]/, 1)[0]; -} -__name(stripUrlQueryAndFragment, "stripUrlQueryAndFragment"); -function getNumberOfUrlSegments(url) { - return url.split(/\\?\//).filter((s2) => s2.length > 0 && s2 !== ",").length; -} -__name(getNumberOfUrlSegments, "getNumberOfUrlSegments"); -function getSanitizedUrlString(url) { - const { protocol, host, path } = url; - const filteredHost = host && host.replace(/^.*@/, "[filtered]:[filtered]@").replace(/(:80)$/, "").replace(/(:443)$/, "") || ""; - return `${protocol ? `${protocol}://` : ""}${filteredHost}${path}`; -} -__name(getSanitizedUrlString, "getSanitizedUrlString"); -const ipHeaderNames = [ - "X-Client-IP", - "X-Forwarded-For", - "Fly-Client-IP", - "CF-Connecting-IP", - "Fastly-Client-Ip", - "True-Client-Ip", - "X-Real-IP", - "X-Cluster-Client-IP", - "X-Forwarded", - "Forwarded-For", - "Forwarded", - "X-Vercel-Forwarded-For" -]; -function getClientIPAddress(headers) { - const headerValues = ipHeaderNames.map((headerName) => { - const rawValue = headers[headerName]; - const value4 = Array.isArray(rawValue) ? rawValue.join(";") : rawValue; - if (headerName === "Forwarded") { - return parseForwardedHeader(value4); - } - return value4 && value4.split(",").map((v2) => v2.trim()); - }); - const flattenedHeaderValues = headerValues.reduce((acc, val) => { - if (!val) { - return acc; - } - return acc.concat(val); - }, []); - const ipAddress = flattenedHeaderValues.find((ip) => ip !== null && isIP(ip)); - return ipAddress || null; -} -__name(getClientIPAddress, "getClientIPAddress"); -function parseForwardedHeader(value4) { - if (!value4) { - return null; - } - for (const part of value4.split(";")) { - if (part.startsWith("for=")) { - return part.slice(4); - } - } - return null; -} -__name(parseForwardedHeader, "parseForwardedHeader"); -function isIP(str) { - const regex2 = /(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/; - return regex2.test(str); -} -__name(isIP, "isIP"); -const DEFAULT_INCLUDES = { - ip: false, - request: true, - user: true -}; -const DEFAULT_REQUEST_INCLUDES = ["cookies", "data", "headers", "method", "query_string", "url"]; -const DEFAULT_USER_INCLUDES = ["id", "username", "email"]; -function extractPathForTransaction(req, options4 = {}) { - const method = req.method && req.method.toUpperCase(); - let path = ""; - let source = "url"; - if (options4.customRoute || req.route) { - path = options4.customRoute || `${req.baseUrl || ""}${req.route && req.route.path}`; - source = "route"; - } else if (req.originalUrl || req.url) { - path = stripUrlQueryAndFragment(req.originalUrl || req.url || ""); - } - let name2 = ""; - if (options4.method && method) { - name2 += method; - } - if (options4.method && options4.path) { - name2 += " "; - } - if (options4.path && path) { - name2 += path; - } - return [name2, source]; -} -__name(extractPathForTransaction, "extractPathForTransaction"); -function extractUserData(user, keys2) { - const extractedUser = {}; - const attributes = Array.isArray(keys2) ? keys2 : DEFAULT_USER_INCLUDES; - attributes.forEach((key) => { - if (user && key in user) { - extractedUser[key] = user[key]; - } - }); - return extractedUser; -} -__name(extractUserData, "extractUserData"); -function extractRequestData(req, options4 = {}) { - const { include = DEFAULT_REQUEST_INCLUDES } = options4; - const requestData = {}; - const headers = req.headers || {}; - const method = req.method; - const host = headers.host || req.hostname || req.host || ""; - const protocol = req.protocol === "https" || req.socket && req.socket.encrypted ? "https" : "http"; - const originalUrl = req.originalUrl || req.url || ""; - const absoluteUrl = originalUrl.startsWith(protocol) ? originalUrl : `${protocol}://${host}${originalUrl}`; - include.forEach((key) => { - switch (key) { - case "headers": { - requestData.headers = headers; - if (!include.includes("cookies")) { - delete requestData.headers.cookie; - } - if (!include.includes("ip")) { - ipHeaderNames.forEach((ipHeaderName) => { - delete requestData.headers[ipHeaderName]; - }); - } - break; - } - case "method": { - requestData.method = method; - break; - } - case "url": { - requestData.url = absoluteUrl; - break; - } - case "cookies": { - requestData.cookies = // TODO (v8 / #5257): We're only sending the empty object for backwards compatibility, so the last bit can - // come off in v8 - req.cookies || headers.cookie && parseCookie(headers.cookie) || {}; - break; - } - case "query_string": { - requestData.query_string = extractQueryParams(req); - break; - } - case "data": { - if (method === "GET" || method === "HEAD") { - break; - } - const body = req.body; - if (body !== void 0) { - const stringBody = isString$a(body) ? body : isPlainObject$5(body) ? JSON.stringify(normalize$2(body)) : truncate(`${body}`, 1024); - if (stringBody) { - requestData.data = stringBody; - } - } - break; - } - default: { - if ({}.hasOwnProperty.call(req, key)) { - requestData[key] = req[key]; - } - } - } - }); - return requestData; -} -__name(extractRequestData, "extractRequestData"); -function addNormalizedRequestDataToEvent(event, req, additionalData, options4) { - const include = { - ...DEFAULT_INCLUDES, - ...options4 && options4.include - }; - if (include.request) { - const includeRequest = Array.isArray(include.request) ? [...include.request] : [...DEFAULT_REQUEST_INCLUDES]; - if (include.ip) { - includeRequest.push("ip"); - } - const extractedRequestData = extractNormalizedRequestData(req, { include: includeRequest }); - event.request = { - ...event.request, - ...extractedRequestData - }; - } - if (include.user) { - const extractedUser = additionalData.user && isPlainObject$5(additionalData.user) ? extractUserData(additionalData.user, include.user) : {}; - if (Object.keys(extractedUser).length) { - event.user = { - ...extractedUser, - ...event.user - }; - } - } - if (include.ip) { - const ip = req.headers && getClientIPAddress(req.headers) || additionalData.ipAddress; - if (ip) { - event.user = { - ...event.user, - ip_address: ip - }; - } - } -} -__name(addNormalizedRequestDataToEvent, "addNormalizedRequestDataToEvent"); -function addRequestDataToEvent(event, req, options4) { - const include = { - ...DEFAULT_INCLUDES, - ...options4 && options4.include - }; - if (include.request) { - const includeRequest = Array.isArray(include.request) ? [...include.request] : [...DEFAULT_REQUEST_INCLUDES]; - if (include.ip) { - includeRequest.push("ip"); - } - const extractedRequestData = extractRequestData(req, { include: includeRequest }); - event.request = { - ...event.request, - ...extractedRequestData - }; - } - if (include.user) { - const extractedUser = req.user && isPlainObject$5(req.user) ? extractUserData(req.user, include.user) : {}; - if (Object.keys(extractedUser).length) { - event.user = { - ...event.user, - ...extractedUser - }; - } - } - if (include.ip) { - const ip = req.headers && getClientIPAddress(req.headers) || req.ip || req.socket && req.socket.remoteAddress; - if (ip) { - event.user = { - ...event.user, - ip_address: ip - }; - } - } - return event; -} -__name(addRequestDataToEvent, "addRequestDataToEvent"); -function extractQueryParams(req) { - let originalUrl = req.originalUrl || req.url || ""; - if (!originalUrl) { - return; - } - if (originalUrl.startsWith("/")) { - originalUrl = `http://dogs.are.great${originalUrl}`; - } - try { - const queryParams = req.query || new URL(originalUrl).search.slice(1); - return queryParams.length ? queryParams : void 0; - } catch (e2) { - return void 0; - } -} -__name(extractQueryParams, "extractQueryParams"); -function winterCGHeadersToDict(winterCGHeaders) { - const headers = {}; - try { - winterCGHeaders.forEach((value4, key) => { - if (typeof value4 === "string") { - headers[key] = value4; - } - }); - } catch (e2) { - DEBUG_BUILD$5 && logger$2.warn("Sentry failed extracting headers from a request object. If you see this, please file an issue."); - } - return headers; -} -__name(winterCGHeadersToDict, "winterCGHeadersToDict"); -function headersToDict(reqHeaders) { - const headers = /* @__PURE__ */ Object.create(null); - try { - Object.entries(reqHeaders).forEach(([key, value4]) => { - if (typeof value4 === "string") { - headers[key] = value4; - } - }); - } catch (e2) { - DEBUG_BUILD$5 && logger$2.warn("Sentry failed extracting headers from a request object. If you see this, please file an issue."); - } - return headers; -} -__name(headersToDict, "headersToDict"); -function winterCGRequestToRequestData(req) { - const headers = winterCGHeadersToDict(req.headers); - return { - method: req.method, - url: req.url, - query_string: extractQueryParamsFromUrl(req.url), - headers - // TODO: Can we extract body data from the request? - }; -} -__name(winterCGRequestToRequestData, "winterCGRequestToRequestData"); -function httpRequestToRequestData(request) { - const headers = request.headers || {}; - const host = headers.host || ""; - const protocol = request.socket && request.socket.encrypted ? "https" : "http"; - const originalUrl = request.url || ""; - const absoluteUrl = originalUrl.startsWith(protocol) ? originalUrl : `${protocol}://${host}${originalUrl}`; - const data26 = request.body || void 0; - const cookies2 = request.cookies; - return dropUndefinedKeys({ - url: absoluteUrl, - method: request.method, - query_string: extractQueryParamsFromUrl(originalUrl), - headers: headersToDict(headers), - cookies: cookies2, - data: data26 - }); -} -__name(httpRequestToRequestData, "httpRequestToRequestData"); -function extractQueryParamsFromUrl(url) { - if (!url) { - return; - } - try { - const queryParams = new URL(url, "http://dogs.are.great").search.slice(1); - return queryParams.length ? queryParams : void 0; - } catch (e3) { - return void 0; - } -} -__name(extractQueryParamsFromUrl, "extractQueryParamsFromUrl"); -function extractNormalizedRequestData(normalizedRequest, { include }) { - const includeKeys = include ? Array.isArray(include) ? include : DEFAULT_REQUEST_INCLUDES : []; - const requestData = {}; - const headers = { ...normalizedRequest.headers }; - if (includeKeys.includes("headers")) { - requestData.headers = headers; - if (!include.includes("cookies")) { - delete headers.cookie; - } - if (!include.includes("ip")) { - ipHeaderNames.forEach((ipHeaderName) => { - delete headers[ipHeaderName]; - }); - } - } - if (includeKeys.includes("method")) { - requestData.method = normalizedRequest.method; - } - if (includeKeys.includes("url")) { - requestData.url = normalizedRequest.url; - } - if (includeKeys.includes("cookies")) { - const cookies2 = normalizedRequest.cookies || (headers && headers.cookie ? parseCookie(headers.cookie) : void 0); - requestData.cookies = cookies2 || {}; - } - if (includeKeys.includes("query_string")) { - requestData.query_string = normalizedRequest.query_string; - } - if (includeKeys.includes("data")) { - requestData.data = normalizedRequest.data; - } - return requestData; -} -__name(extractNormalizedRequestData, "extractNormalizedRequestData"); -const DEFAULT_OPTIONS$1 = { - include: { - cookies: true, - data: true, - headers: true, - ip: false, - query_string: true, - url: true, - user: { - id: true, - username: true, - email: true - } - }, - transactionNamingScheme: "methodPath" -}; -const INTEGRATION_NAME$i = "RequestData"; -const _requestDataIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const _options = { - ...DEFAULT_OPTIONS$1, - ...options4, - include: { - ...DEFAULT_OPTIONS$1.include, - ...options4.include, - user: options4.include && typeof options4.include.user === "boolean" ? options4.include.user : { - ...DEFAULT_OPTIONS$1.include.user, - // Unclear why TS still thinks `options.include.user` could be a boolean at this point - ...(options4.include || {}).user - } - } - }; - return { - name: INTEGRATION_NAME$i, - processEvent(event) { - const { sdkProcessingMetadata = {} } = event; - const { request, normalizedRequest } = sdkProcessingMetadata; - const addRequestDataOptions = convertReqDataIntegrationOptsToAddReqDataOpts(_options); - if (normalizedRequest) { - const ipAddress = request ? request.ip || request.socket && request.socket.remoteAddress : void 0; - const user = request ? request.user : void 0; - addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress, user }, addRequestDataOptions); - return event; - } - if (!request) { - return event; - } - return addRequestDataToEvent(event, request, addRequestDataOptions); - } - }; -}, "_requestDataIntegration"); -const requestDataIntegration = defineIntegration(_requestDataIntegration); -function convertReqDataIntegrationOptsToAddReqDataOpts(integrationOptions) { - const { - // eslint-disable-next-line deprecation/deprecation - transactionNamingScheme, - include: { ip, user, ...requestOptions } - } = integrationOptions; - const requestIncludeKeys = ["method"]; - for (const [key, value4] of Object.entries(requestOptions)) { - if (value4) { - requestIncludeKeys.push(key); - } - } - let addReqDataUserOpt; - if (user === void 0) { - addReqDataUserOpt = true; - } else if (typeof user === "boolean") { - addReqDataUserOpt = user; - } else { - const userIncludeKeys = []; - for (const [key, value4] of Object.entries(user)) { - if (value4) { - userIncludeKeys.push(key); - } - } - addReqDataUserOpt = userIncludeKeys; - } - return { - include: { - ip, - user: addReqDataUserOpt, - request: requestIncludeKeys.length !== 0 ? requestIncludeKeys : void 0, - transaction: transactionNamingScheme - } - }; -} -__name(convertReqDataIntegrationOptsToAddReqDataOpts, "convertReqDataIntegrationOptsToAddReqDataOpts"); -function addConsoleInstrumentationHandler(handler12) { - const type = "console"; - addHandler$1(type, handler12); - maybeInstrument(type, instrumentConsole); -} -__name(addConsoleInstrumentationHandler, "addConsoleInstrumentationHandler"); -function instrumentConsole() { - if (!("console" in GLOBAL_OBJ)) { - return; - } - CONSOLE_LEVELS$1.forEach(function(level) { - if (!(level in GLOBAL_OBJ.console)) { - return; - } - fill(GLOBAL_OBJ.console, level, function(originalConsoleMethod) { - originalConsoleMethods[level] = originalConsoleMethod; - return function(...args) { - const handlerData = { args, level }; - triggerHandlers$1("console", handlerData); - const log2 = originalConsoleMethods[level]; - log2 && log2.apply(GLOBAL_OBJ.console, args); - }; - }); - }); -} -__name(instrumentConsole, "instrumentConsole"); -const validSeverityLevels = ["fatal", "error", "warning", "log", "info", "debug"]; -function severityLevelFromString(level) { - return level === "warn" ? "warning" : ["fatal", "error", "warning", "log", "info", "debug"].includes(level) ? level : "log"; -} -__name(severityLevelFromString, "severityLevelFromString"); -const INTEGRATION_NAME$h = "CaptureConsole"; -const _captureConsoleIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const levels = options4.levels || CONSOLE_LEVELS$1; - const handled = !!options4.handled; - return { - name: INTEGRATION_NAME$h, - setup(client) { - if (!("console" in GLOBAL_OBJ)) { - return; - } - addConsoleInstrumentationHandler(({ args, level }) => { - if (getClient() !== client || !levels.includes(level)) { - return; - } - consoleHandler(args, level, handled); - }); - } - }; -}, "_captureConsoleIntegration"); -const captureConsoleIntegration = defineIntegration(_captureConsoleIntegration); -function consoleHandler(args, level, handled) { - const captureContext = { - level: severityLevelFromString(level), - extra: { - arguments: args - } - }; - withScope((scope) => { - scope.addEventProcessor((event) => { - event.logger = "console"; - addExceptionMechanism(event, { - handled, - type: "console" - }); - return event; - }); - if (level === "assert") { - if (!args[0]) { - const message4 = `Assertion failed: ${safeJoin(args.slice(1), " ") || "console.assert"}`; - scope.setExtra("arguments", args.slice(1)); - captureMessage(message4, captureContext); - } - return; - } - const error2 = args.find((arg) => arg instanceof Error); - if (error2) { - captureException(error2, captureContext); - return; - } - const message3 = safeJoin(args, " "); - captureMessage(message3, captureContext); - }); -} -__name(consoleHandler, "consoleHandler"); -const INTEGRATION_NAME$g = "Debug"; -const _debugIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const _options = { - debugger: false, - stringify: false, - ...options4 - }; - return { - name: INTEGRATION_NAME$g, - setup(client) { - client.on("beforeSendEvent", (event, hint) => { - if (_options.debugger) { - debugger; - } - consoleSandbox(() => { - if (_options.stringify) { - console.log(JSON.stringify(event, null, 2)); - if (hint && Object.keys(hint).length) { - console.log(JSON.stringify(hint, null, 2)); - } - } else { - console.log(event); - if (hint && Object.keys(hint).length) { - console.log(hint); - } - } - }); - }); - } - }; -}, "_debugIntegration"); -const debugIntegration = defineIntegration(_debugIntegration); -const INTEGRATION_NAME$f = "Dedupe"; -const _dedupeIntegration = /* @__PURE__ */ __name(() => { - let previousEvent; - return { - name: INTEGRATION_NAME$f, - processEvent(currentEvent) { - if (currentEvent.type) { - return currentEvent; - } - try { - if (_shouldDropEvent(currentEvent, previousEvent)) { - DEBUG_BUILD$6 && logger$2.warn("Event dropped due to being a duplicate of previously captured event."); - return null; - } - } catch (_oO) { - } - return previousEvent = currentEvent; - } - }; -}, "_dedupeIntegration"); -const dedupeIntegration = defineIntegration(_dedupeIntegration); -function _shouldDropEvent(currentEvent, previousEvent) { - if (!previousEvent) { - return false; - } - if (_isSameMessageEvent(currentEvent, previousEvent)) { - return true; - } - if (_isSameExceptionEvent(currentEvent, previousEvent)) { - return true; - } - return false; -} -__name(_shouldDropEvent, "_shouldDropEvent"); -function _isSameMessageEvent(currentEvent, previousEvent) { - const currentMessage = currentEvent.message; - const previousMessage = previousEvent.message; - if (!currentMessage && !previousMessage) { - return false; - } - if (currentMessage && !previousMessage || !currentMessage && previousMessage) { - return false; - } - if (currentMessage !== previousMessage) { - return false; - } - if (!_isSameFingerprint(currentEvent, previousEvent)) { - return false; - } - if (!_isSameStacktrace(currentEvent, previousEvent)) { - return false; - } - return true; -} -__name(_isSameMessageEvent, "_isSameMessageEvent"); -function _isSameExceptionEvent(currentEvent, previousEvent) { - const previousException = _getExceptionFromEvent(previousEvent); - const currentException = _getExceptionFromEvent(currentEvent); - if (!previousException || !currentException) { - return false; - } - if (previousException.type !== currentException.type || previousException.value !== currentException.value) { - return false; - } - if (!_isSameFingerprint(currentEvent, previousEvent)) { - return false; - } - if (!_isSameStacktrace(currentEvent, previousEvent)) { - return false; - } - return true; -} -__name(_isSameExceptionEvent, "_isSameExceptionEvent"); -function _isSameStacktrace(currentEvent, previousEvent) { - let currentFrames = getFramesFromEvent(currentEvent); - let previousFrames = getFramesFromEvent(previousEvent); - if (!currentFrames && !previousFrames) { - return true; - } - if (currentFrames && !previousFrames || !currentFrames && previousFrames) { - return false; - } - currentFrames = currentFrames; - previousFrames = previousFrames; - if (previousFrames.length !== currentFrames.length) { - return false; - } - for (let i2 = 0; i2 < previousFrames.length; i2++) { - const frameA = previousFrames[i2]; - const frameB = currentFrames[i2]; - if (frameA.filename !== frameB.filename || frameA.lineno !== frameB.lineno || frameA.colno !== frameB.colno || frameA.function !== frameB.function) { - return false; - } - } - return true; -} -__name(_isSameStacktrace, "_isSameStacktrace"); -function _isSameFingerprint(currentEvent, previousEvent) { - let currentFingerprint = currentEvent.fingerprint; - let previousFingerprint = previousEvent.fingerprint; - if (!currentFingerprint && !previousFingerprint) { - return true; - } - if (currentFingerprint && !previousFingerprint || !currentFingerprint && previousFingerprint) { - return false; - } - currentFingerprint = currentFingerprint; - previousFingerprint = previousFingerprint; - try { - return !!(currentFingerprint.join("") === previousFingerprint.join("")); - } catch (_oO) { - return false; - } -} -__name(_isSameFingerprint, "_isSameFingerprint"); -function _getExceptionFromEvent(event) { - return event.exception && event.exception.values && event.exception.values[0]; -} -__name(_getExceptionFromEvent, "_getExceptionFromEvent"); -const INTEGRATION_NAME$e = "ExtraErrorData"; -const _extraErrorDataIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const { depth = 3, captureErrorCause = true } = options4; - return { - name: INTEGRATION_NAME$e, - processEvent(event, hint, client) { - const { maxValueLength = 250 } = client.getOptions(); - return _enhanceEventWithErrorData(event, hint, depth, captureErrorCause, maxValueLength); - } - }; -}, "_extraErrorDataIntegration"); -const extraErrorDataIntegration = defineIntegration(_extraErrorDataIntegration); -function _enhanceEventWithErrorData(event, hint = {}, depth, captureErrorCause, maxValueLength) { - if (!hint.originalException || !isError(hint.originalException)) { - return event; - } - const exceptionName = hint.originalException.name || hint.originalException.constructor.name; - const errorData = _extractErrorData(hint.originalException, captureErrorCause, maxValueLength); - if (errorData) { - const contexts = { - ...event.contexts - }; - const normalizedErrorData = normalize$2(errorData, depth); - if (isPlainObject$5(normalizedErrorData)) { - addNonEnumerableProperty(normalizedErrorData, "__sentry_skip_normalization__", true); - contexts[exceptionName] = normalizedErrorData; - } - return { - ...event, - contexts - }; - } - return event; -} -__name(_enhanceEventWithErrorData, "_enhanceEventWithErrorData"); -function _extractErrorData(error2, captureErrorCause, maxValueLength) { - try { - const nativeKeys2 = [ - "name", - "message", - "stack", - "line", - "column", - "fileName", - "lineNumber", - "columnNumber", - "toJSON" - ]; - const extraErrorInfo = {}; - for (const key of Object.keys(error2)) { - if (nativeKeys2.indexOf(key) !== -1) { - continue; - } - const value4 = error2[key]; - extraErrorInfo[key] = isError(value4) || typeof value4 === "string" ? truncate(`${value4}`, maxValueLength) : value4; - } - if (captureErrorCause && error2.cause !== void 0) { - extraErrorInfo.cause = isError(error2.cause) ? error2.cause.toString() : error2.cause; - } - if (typeof error2.toJSON === "function") { - const serializedError = error2.toJSON(); - for (const key of Object.keys(serializedError)) { - const value4 = serializedError[key]; - extraErrorInfo[key] = isError(value4) ? value4.toString() : value4; - } - } - return extraErrorInfo; - } catch (oO) { - DEBUG_BUILD$6 && logger$2.error("Unable to extract extra data from the Error object:", oO); - } - return null; -} -__name(_extractErrorData, "_extractErrorData"); -function normalizeArray(parts2, allowAboveRoot) { - let up = 0; - for (let i2 = parts2.length - 1; i2 >= 0; i2--) { - const last = parts2[i2]; - if (last === ".") { - parts2.splice(i2, 1); - } else if (last === "..") { - parts2.splice(i2, 1); - up++; - } else if (up) { - parts2.splice(i2, 1); - up--; - } - } - if (allowAboveRoot) { - for (; up--; up) { - parts2.unshift(".."); - } - } - return parts2; -} -__name(normalizeArray, "normalizeArray"); -const splitPathRe = /^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/; -function splitPath(filename) { - const truncated = filename.length > 1024 ? `${filename.slice(-1024)}` : filename; - const parts2 = splitPathRe.exec(truncated); - return parts2 ? parts2.slice(1) : []; -} -__name(splitPath, "splitPath"); -function resolve$3(...args) { - let resolvedPath = ""; - let resolvedAbsolute = false; - for (let i2 = args.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) { - const path = i2 >= 0 ? args[i2] : "/"; - if (!path) { - continue; - } - resolvedPath = `${path}/${resolvedPath}`; - resolvedAbsolute = path.charAt(0) === "/"; - } - resolvedPath = normalizeArray( - resolvedPath.split("/").filter((p2) => !!p2), - !resolvedAbsolute - ).join("/"); - return (resolvedAbsolute ? "/" : "") + resolvedPath || "."; -} -__name(resolve$3, "resolve$3"); -function trim$1(arr) { - let start2 = 0; - for (; start2 < arr.length; start2++) { - if (arr[start2] !== "") { - break; - } - } - let end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== "") { - break; - } - } - if (start2 > end) { - return []; - } - return arr.slice(start2, end - start2 + 1); -} -__name(trim$1, "trim$1"); -function relative(from2, to) { - from2 = resolve$3(from2).slice(1); - to = resolve$3(to).slice(1); - const fromParts = trim$1(from2.split("/")); - const toParts = trim$1(to.split("/")); - const length = Math.min(fromParts.length, toParts.length); - let samePartsLength = length; - for (let i2 = 0; i2 < length; i2++) { - if (fromParts[i2] !== toParts[i2]) { - samePartsLength = i2; - break; - } - } - let outputParts = []; - for (let i2 = samePartsLength; i2 < fromParts.length; i2++) { - outputParts.push(".."); - } - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - return outputParts.join("/"); -} -__name(relative, "relative"); -function normalizePath(path) { - const isPathAbsolute = isAbsolute(path); - const trailingSlash = path.slice(-1) === "/"; - let normalizedPath = normalizeArray( - path.split("/").filter((p2) => !!p2), - !isPathAbsolute - ).join("/"); - if (!normalizedPath && !isPathAbsolute) { - normalizedPath = "."; - } - if (normalizedPath && trailingSlash) { - normalizedPath += "/"; - } - return (isPathAbsolute ? "/" : "") + normalizedPath; -} -__name(normalizePath, "normalizePath"); -function isAbsolute(path) { - return path.charAt(0) === "/"; -} -__name(isAbsolute, "isAbsolute"); -function join$3(...args) { - return normalizePath(args.join("/")); -} -__name(join$3, "join$3"); -function dirname(path) { - const result = splitPath(path); - const root29 = result[0] || ""; - let dir = result[1]; - if (!root29 && !dir) { - return "."; - } - if (dir) { - dir = dir.slice(0, dir.length - 1); - } - return root29 + dir; -} -__name(dirname, "dirname"); -function basename(path, ext) { - let f2 = splitPath(path)[2] || ""; - if (ext && f2.slice(ext.length * -1) === ext) { - f2 = f2.slice(0, f2.length - ext.length); - } - return f2; -} -__name(basename, "basename"); -const INTEGRATION_NAME$d = "RewriteFrames"; -const rewriteFramesIntegration = defineIntegration((options4 = {}) => { - const root29 = options4.root; - const prefix2 = options4.prefix || "app:///"; - const isBrowser2 = "window" in GLOBAL_OBJ && GLOBAL_OBJ.window !== void 0; - const iteratee = options4.iteratee || generateIteratee({ isBrowser: isBrowser2, root: root29, prefix: prefix2 }); - function _processExceptionsEvent(event) { - try { - return { - ...event, - exception: { - ...event.exception, - // The check for this is performed inside `process` call itself, safe to skip here - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - values: event.exception.values.map((value4) => ({ - ...value4, - ...value4.stacktrace && { stacktrace: _processStacktrace(value4.stacktrace) } - })) - } - }; - } catch (_oO) { - return event; - } - } - __name(_processExceptionsEvent, "_processExceptionsEvent"); - function _processStacktrace(stacktrace) { - return { - ...stacktrace, - frames: stacktrace && stacktrace.frames && stacktrace.frames.map((f2) => iteratee(f2)) - }; - } - __name(_processStacktrace, "_processStacktrace"); - return { - name: INTEGRATION_NAME$d, - processEvent(originalEvent) { - let processedEvent = originalEvent; - if (originalEvent.exception && Array.isArray(originalEvent.exception.values)) { - processedEvent = _processExceptionsEvent(processedEvent); - } - return processedEvent; - } - }; -}); -function generateIteratee({ - isBrowser: isBrowser2, - root: root29, - prefix: prefix2 -}) { - return (frame) => { - if (!frame.filename) { - return frame; - } - const isWindowsFrame = /^[a-zA-Z]:\\/.test(frame.filename) || // or the presence of a backslash without a forward slash (which are not allowed on Windows) - frame.filename.includes("\\") && !frame.filename.includes("/"); - const startsWithSlash = /^\//.test(frame.filename); - if (isBrowser2) { - if (root29) { - const oldFilename = frame.filename; - if (oldFilename.indexOf(root29) === 0) { - frame.filename = oldFilename.replace(root29, prefix2); - } - } - } else { - if (isWindowsFrame || startsWithSlash) { - const filename = isWindowsFrame ? frame.filename.replace(/^[a-zA-Z]:/, "").replace(/\\/g, "/") : frame.filename; - const base2 = root29 ? relative(root29, filename) : basename(filename); - frame.filename = `${prefix2}${base2}`; - } - } - return frame; - }; -} -__name(generateIteratee, "generateIteratee"); -const INTEGRATION_NAME$c = "SessionTiming"; -const _sessionTimingIntegration = /* @__PURE__ */ __name(() => { - const startTime = timestampInSeconds() * 1e3; - return { - name: INTEGRATION_NAME$c, - processEvent(event) { - const now2 = timestampInSeconds() * 1e3; - return { - ...event, - extra: { - ...event.extra, - ["session:start"]: startTime, - ["session:duration"]: now2 - startTime, - ["session:end"]: now2 - } - }; - } - }; -}, "_sessionTimingIntegration"); -const sessionTimingIntegration = defineIntegration(_sessionTimingIntegration); -const DEFAULT_LIMIT$1 = 10; -const INTEGRATION_NAME$b = "ZodErrors"; -function originalExceptionIsZodError(originalException) { - return isError(originalException) && originalException.name === "ZodError" && Array.isArray(originalException.errors); -} -__name(originalExceptionIsZodError, "originalExceptionIsZodError"); -function formatIssueTitle(issue) { - return { - ...issue, - path: "path" in issue && Array.isArray(issue.path) ? issue.path.join(".") : void 0, - keys: "keys" in issue ? JSON.stringify(issue.keys) : void 0, - unionErrors: "unionErrors" in issue ? JSON.stringify(issue.unionErrors) : void 0 - }; -} -__name(formatIssueTitle, "formatIssueTitle"); -function formatIssueMessage(zodError) { - const errorKeyMap = /* @__PURE__ */ new Set(); - for (const iss of zodError.issues) { - if (iss.path && iss.path[0]) { - errorKeyMap.add(iss.path[0]); - } - } - const errorKeys = Array.from(errorKeyMap); - return `Failed to validate keys: ${truncate(errorKeys.join(", "), 100)}`; -} -__name(formatIssueMessage, "formatIssueMessage"); -function applyZodErrorsToEvent(limit, event, hint) { - if (!event.exception || !event.exception.values || !hint || !hint.originalException || !originalExceptionIsZodError(hint.originalException) || hint.originalException.issues.length === 0) { - return event; - } - return { - ...event, - exception: { - ...event.exception, - values: [ - { - ...event.exception.values[0], - value: formatIssueMessage(hint.originalException) - }, - ...event.exception.values.slice(1) - ] - }, - extra: { - ...event.extra, - "zoderror.issues": hint.originalException.errors.slice(0, limit).map(formatIssueTitle) - } - }; -} -__name(applyZodErrorsToEvent, "applyZodErrorsToEvent"); -const _zodErrorsIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const limit = options4.limit || DEFAULT_LIMIT$1; - return { - name: INTEGRATION_NAME$b, - processEvent(originalEvent, hint) { - const processedEvent = applyZodErrorsToEvent(limit, originalEvent, hint); - return processedEvent; - } - }; -}, "_zodErrorsIntegration"); -const zodErrorsIntegration = defineIntegration(_zodErrorsIntegration); -const thirdPartyErrorFilterIntegration = defineIntegration((options4) => { - return { - name: "ThirdPartyErrorsFilter", - setup(client) { - client.on("beforeEnvelope", (envelope) => { - forEachEnvelopeItem(envelope, (item3, type) => { - if (type === "event") { - const event = Array.isArray(item3) ? item3[1] : void 0; - if (event) { - stripMetadataFromStackFrames(event); - item3[1] = event; - } - } - }); - }); - client.on("applyFrameMetadata", (event) => { - if (event.type) { - return; - } - const stackParser = client.getOptions().stackParser; - addMetadataToStackFrames(stackParser, event); - }); - }, - processEvent(event) { - const frameKeys = getBundleKeysForAllFramesWithFilenames(event); - if (frameKeys) { - const arrayMethod = options4.behaviour === "drop-error-if-contains-third-party-frames" || options4.behaviour === "apply-tag-if-contains-third-party-frames" ? "some" : "every"; - const behaviourApplies = frameKeys[arrayMethod]((keys2) => !keys2.some((key) => options4.filterKeys.includes(key))); - if (behaviourApplies) { - const shouldDrop = options4.behaviour === "drop-error-if-contains-third-party-frames" || options4.behaviour === "drop-error-if-exclusively-contains-third-party-frames"; - if (shouldDrop) { - return null; - } else { - event.tags = { - ...event.tags, - third_party_code: true - }; - } - } - } - return event; - } - }; -}); -function getBundleKeysForAllFramesWithFilenames(event) { - const frames = getFramesFromEvent(event); - if (!frames) { - return void 0; - } - return frames.filter((frame) => !!frame.filename).map((frame) => { - if (frame.module_metadata) { - return Object.keys(frame.module_metadata).filter((key) => key.startsWith(BUNDLER_PLUGIN_APP_KEY_PREFIX)).map((key) => key.slice(BUNDLER_PLUGIN_APP_KEY_PREFIX.length)); - } - return []; - }); -} -__name(getBundleKeysForAllFramesWithFilenames, "getBundleKeysForAllFramesWithFilenames"); -const BUNDLER_PLUGIN_APP_KEY_PREFIX = "_sentryBundlerPluginAppKey:"; -const COUNTER_METRIC_TYPE = "c"; -const GAUGE_METRIC_TYPE = "g"; -const SET_METRIC_TYPE = "s"; -const DISTRIBUTION_METRIC_TYPE = "d"; -const DEFAULT_BROWSER_FLUSH_INTERVAL = 5e3; -const DEFAULT_FLUSH_INTERVAL = 1e4; -const MAX_WEIGHT = 1e4; -function getMetricsAggregatorForClient$1(client, Aggregator) { - const globalMetricsAggregators = getGlobalSingleton( - "globalMetricsAggregators", - () => /* @__PURE__ */ new WeakMap() - ); - const aggregator = globalMetricsAggregators.get(client); - if (aggregator) { - return aggregator; - } - const newAggregator = new Aggregator(client); - client.on("flush", () => newAggregator.flush()); - client.on("close", () => newAggregator.close()); - globalMetricsAggregators.set(client, newAggregator); - return newAggregator; -} -__name(getMetricsAggregatorForClient$1, "getMetricsAggregatorForClient$1"); -function addToMetricsAggregator(Aggregator, metricType, name2, value4, data26 = {}) { - const client = data26.client || getClient(); - if (!client) { - return; - } - const span = getActiveSpan(); - const rootSpan = span ? getRootSpan(span) : void 0; - const transactionName = rootSpan && spanToJSON(rootSpan).description; - const { unit, tags, timestamp: timestamp2 } = data26; - const { release, environment } = client.getOptions(); - const metricTags = {}; - if (release) { - metricTags.release = release; - } - if (environment) { - metricTags.environment = environment; - } - if (transactionName) { - metricTags.transaction = transactionName; - } - DEBUG_BUILD$6 && logger$2.log(`Adding value of ${value4} to ${metricType} metric ${name2}`); - const aggregator = getMetricsAggregatorForClient$1(client, Aggregator); - aggregator.add(metricType, name2, value4, unit, { ...metricTags, ...tags }, timestamp2); -} -__name(addToMetricsAggregator, "addToMetricsAggregator"); -function increment$2(aggregator, name2, value4 = 1, data26) { - addToMetricsAggregator(aggregator, COUNTER_METRIC_TYPE, name2, ensureNumber(value4), data26); -} -__name(increment$2, "increment$2"); -function distribution$2(aggregator, name2, value4, data26) { - addToMetricsAggregator(aggregator, DISTRIBUTION_METRIC_TYPE, name2, ensureNumber(value4), data26); -} -__name(distribution$2, "distribution$2"); -function timing$2(aggregator, name2, value4, unit = "second", data26) { - if (typeof value4 === "function") { - const startTime = timestampInSeconds(); - return startSpanManual( - { - op: "metrics.timing", - name: name2, - startTime, - onlyIfParent: true - }, - (span) => { - return handleCallbackErrors( - () => value4(), - () => { - }, - () => { - const endTime = timestampInSeconds(); - const timeDiff = endTime - startTime; - distribution$2(aggregator, name2, timeDiff, { ...data26, unit: "second" }); - span.end(endTime); - } - ); - } - ); - } - distribution$2(aggregator, name2, value4, { ...data26, unit }); -} -__name(timing$2, "timing$2"); -function set$6(aggregator, name2, value4, data26) { - addToMetricsAggregator(aggregator, SET_METRIC_TYPE, name2, value4, data26); -} -__name(set$6, "set$6"); -function gauge$2(aggregator, name2, value4, data26) { - addToMetricsAggregator(aggregator, GAUGE_METRIC_TYPE, name2, ensureNumber(value4), data26); -} -__name(gauge$2, "gauge$2"); -const metrics$1 = { - increment: increment$2, - distribution: distribution$2, - set: set$6, - gauge: gauge$2, - timing: timing$2, - /** - * @ignore This is for internal use only. - */ - getMetricsAggregatorForClient: getMetricsAggregatorForClient$1 -}; -function ensureNumber(number2) { - return typeof number2 === "string" ? parseInt(number2) : number2; -} -__name(ensureNumber, "ensureNumber"); -function isProfilingIntegrationWithProfiler(integration) { - return !!integration && typeof integration["_profiler"] !== "undefined" && typeof integration["_profiler"]["start"] === "function" && typeof integration["_profiler"]["stop"] === "function"; -} -__name(isProfilingIntegrationWithProfiler, "isProfilingIntegrationWithProfiler"); -function startProfiler() { - const client = getClient(); - if (!client) { - DEBUG_BUILD$6 && logger$2.warn("No Sentry client available, profiling is not started"); - return; - } - const integration = client.getIntegrationByName("ProfilingIntegration"); - if (!integration) { - DEBUG_BUILD$6 && logger$2.warn("ProfilingIntegration is not available"); - return; - } - if (!isProfilingIntegrationWithProfiler(integration)) { - DEBUG_BUILD$6 && logger$2.warn("Profiler is not available on profiling integration."); - return; - } - integration._profiler.start(); -} -__name(startProfiler, "startProfiler"); -function stopProfiler() { - const client = getClient(); - if (!client) { - DEBUG_BUILD$6 && logger$2.warn("No Sentry client available, profiling is not started"); - return; - } - const integration = client.getIntegrationByName("ProfilingIntegration"); - if (!integration) { - DEBUG_BUILD$6 && logger$2.warn("ProfilingIntegration is not available"); - return; - } - if (!isProfilingIntegrationWithProfiler(integration)) { - DEBUG_BUILD$6 && logger$2.warn("Profiler is not available on profiling integration."); - return; - } - integration._profiler.stop(); -} -__name(stopProfiler, "stopProfiler"); -const profiler = { - startProfiler, - stopProfiler -}; -function getBucketKey(metricType, name2, unit, tags) { - const stringifiedTags = Object.entries(dropUndefinedKeys(tags)).sort((a2, b2) => a2[0].localeCompare(b2[0])); - return `${metricType}${name2}${unit}${stringifiedTags}`; -} -__name(getBucketKey, "getBucketKey"); -function simpleHash(s2) { - let rv = 0; - for (let i2 = 0; i2 < s2.length; i2++) { - const c2 = s2.charCodeAt(i2); - rv = (rv << 5) - rv + c2; - rv &= rv; - } - return rv >>> 0; -} -__name(simpleHash, "simpleHash"); -function serializeMetricBuckets(metricBucketItems) { - let out = ""; - for (const item3 of metricBucketItems) { - const tagEntries = Object.entries(item3.tags); - const maybeTags = tagEntries.length > 0 ? `|#${tagEntries.map(([key, value4]) => `${key}:${value4}`).join(",")}` : ""; - out += `${item3.name}@${item3.unit}:${item3.metric}|${item3.metricType}${maybeTags}|T${item3.timestamp} -`; - } - return out; -} -__name(serializeMetricBuckets, "serializeMetricBuckets"); -function sanitizeUnit(unit) { - return unit.replace(/[^\w]+/gi, "_"); -} -__name(sanitizeUnit, "sanitizeUnit"); -function sanitizeMetricKey(key) { - return key.replace(/[^\w\-.]+/gi, "_"); -} -__name(sanitizeMetricKey, "sanitizeMetricKey"); -function sanitizeTagKey(key) { - return key.replace(/[^\w\-./]+/gi, ""); -} -__name(sanitizeTagKey, "sanitizeTagKey"); -const tagValueReplacements = [ - ["\n", "\\n"], - ["\r", "\\r"], - [" ", "\\t"], - ["\\", "\\\\"], - ["|", "\\u{7c}"], - [",", "\\u{2c}"] -]; -function getCharOrReplacement(input) { - for (const [search2, replacement] of tagValueReplacements) { - if (input === search2) { - return replacement; - } - } - return input; -} -__name(getCharOrReplacement, "getCharOrReplacement"); -function sanitizeTagValue(value4) { - return [...value4].reduce((acc, char) => acc + getCharOrReplacement(char), ""); -} -__name(sanitizeTagValue, "sanitizeTagValue"); -function sanitizeTags(unsanitizedTags) { - const tags = {}; - for (const key in unsanitizedTags) { - if (Object.prototype.hasOwnProperty.call(unsanitizedTags, key)) { - const sanitizedKey = sanitizeTagKey(key); - tags[sanitizedKey] = sanitizeTagValue(String(unsanitizedTags[key])); - } - } - return tags; -} -__name(sanitizeTags, "sanitizeTags"); -function captureAggregateMetrics(client, metricBucketItems) { - logger$2.log(`Flushing aggregated metrics, number of metrics: ${metricBucketItems.length}`); - const dsn = client.getDsn(); - const metadata = client.getSdkMetadata(); - const tunnel = client.getOptions().tunnel; - const metricsEnvelope = createMetricEnvelope(metricBucketItems, dsn, metadata, tunnel); - client.sendEnvelope(metricsEnvelope); -} -__name(captureAggregateMetrics, "captureAggregateMetrics"); -function createMetricEnvelope(metricBucketItems, dsn, metadata, tunnel) { - const headers = { - sent_at: (/* @__PURE__ */ new Date()).toISOString() - }; - if (metadata && metadata.sdk) { - headers.sdk = { - name: metadata.sdk.name, - version: metadata.sdk.version - }; - } - if (!!tunnel && dsn) { - headers.dsn = dsnToString(dsn); - } - const item3 = createMetricEnvelopeItem(metricBucketItems); - return createEnvelope(headers, [item3]); -} -__name(createMetricEnvelope, "createMetricEnvelope"); -function createMetricEnvelopeItem(metricBucketItems) { - const payload = serializeMetricBuckets(metricBucketItems); - const metricHeaders = { - type: "statsd", - length: payload.length - }; - return [metricHeaders, payload]; -} -__name(createMetricEnvelopeItem, "createMetricEnvelopeItem"); -class CounterMetric { - static { - __name(this, "CounterMetric"); - } - constructor(_value) { - this._value = _value; - } - /** @inheritDoc */ - get weight() { - return 1; - } - /** @inheritdoc */ - add(value4) { - this._value += value4; - } - /** @inheritdoc */ - toString() { - return `${this._value}`; - } -} -class GaugeMetric { - static { - __name(this, "GaugeMetric"); - } - constructor(value4) { - this._last = value4; - this._min = value4; - this._max = value4; - this._sum = value4; - this._count = 1; - } - /** @inheritDoc */ - get weight() { - return 5; - } - /** @inheritdoc */ - add(value4) { - this._last = value4; - if (value4 < this._min) { - this._min = value4; - } - if (value4 > this._max) { - this._max = value4; - } - this._sum += value4; - this._count++; - } - /** @inheritdoc */ - toString() { - return `${this._last}:${this._min}:${this._max}:${this._sum}:${this._count}`; - } -} -class DistributionMetric { - static { - __name(this, "DistributionMetric"); - } - constructor(first2) { - this._value = [first2]; - } - /** @inheritDoc */ - get weight() { - return this._value.length; - } - /** @inheritdoc */ - add(value4) { - this._value.push(value4); - } - /** @inheritdoc */ - toString() { - return this._value.join(":"); - } -} -class SetMetric { - static { - __name(this, "SetMetric"); - } - constructor(first2) { - this.first = first2; - this._value = /* @__PURE__ */ new Set([first2]); - } - /** @inheritDoc */ - get weight() { - return this._value.size; - } - /** @inheritdoc */ - add(value4) { - this._value.add(value4); - } - /** @inheritdoc */ - toString() { - return Array.from(this._value).map((val) => typeof val === "string" ? simpleHash(val) : val).join(":"); - } -} -const METRIC_MAP = { - [COUNTER_METRIC_TYPE]: CounterMetric, - [GAUGE_METRIC_TYPE]: GaugeMetric, - [DISTRIBUTION_METRIC_TYPE]: DistributionMetric, - [SET_METRIC_TYPE]: SetMetric -}; -class MetricsAggregator { - static { - __name(this, "MetricsAggregator"); - } - // TODO(@anonrig): Use FinalizationRegistry to have a proper way of flushing the buckets - // when the aggregator is garbage collected. - // Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry - // Different metrics have different weights. We use this to limit the number of metrics - // that we store in memory. - // We adjust the type here to add the `unref()` part, as setInterval can technically return a number or a NodeJS.Timer - // SDKs are required to shift the flush interval by random() * rollup_in_seconds. - // That shift is determined once per startup to create jittering. - // An SDK is required to perform force flushing ahead of scheduled time if the memory - // pressure is too high. There is no rule for this other than that SDKs should be tracking - // abstract aggregation complexity (eg: a counter only carries a single float, whereas a - // distribution is a float per emission). - // - // Force flush is used on either shutdown, flush() or when we exceed the max weight. - constructor(_client) { - this._client = _client; - this._buckets = /* @__PURE__ */ new Map(); - this._bucketsTotalWeight = 0; - this._interval = setInterval(() => this._flush(), DEFAULT_FLUSH_INTERVAL); - if (this._interval.unref) { - this._interval.unref(); - } - this._flushShift = Math.floor(Math.random() * DEFAULT_FLUSH_INTERVAL / 1e3); - this._forceFlush = false; - } - /** - * @inheritDoc - */ - add(metricType, unsanitizedName, value4, unsanitizedUnit = "none", unsanitizedTags = {}, maybeFloatTimestamp = timestampInSeconds()) { - const timestamp2 = Math.floor(maybeFloatTimestamp); - const name2 = sanitizeMetricKey(unsanitizedName); - const tags = sanitizeTags(unsanitizedTags); - const unit = sanitizeUnit(unsanitizedUnit); - const bucketKey = getBucketKey(metricType, name2, unit, tags); - let bucketItem = this._buckets.get(bucketKey); - const previousWeight = bucketItem && metricType === SET_METRIC_TYPE ? bucketItem.metric.weight : 0; - if (bucketItem) { - bucketItem.metric.add(value4); - if (bucketItem.timestamp < timestamp2) { - bucketItem.timestamp = timestamp2; - } - } else { - bucketItem = { - // @ts-expect-error we don't need to narrow down the type of value here, saves bundle size. - metric: new METRIC_MAP[metricType](value4), - timestamp: timestamp2, - metricType, - name: name2, - unit, - tags - }; - this._buckets.set(bucketKey, bucketItem); - } - const val = typeof value4 === "string" ? bucketItem.metric.weight - previousWeight : value4; - updateMetricSummaryOnActiveSpan(metricType, name2, val, unit, unsanitizedTags, bucketKey); - this._bucketsTotalWeight += bucketItem.metric.weight; - if (this._bucketsTotalWeight >= MAX_WEIGHT) { - this.flush(); - } - } - /** - * Flushes the current metrics to the transport via the transport. - */ - flush() { - this._forceFlush = true; - this._flush(); - } - /** - * Shuts down metrics aggregator and clears all metrics. - */ - close() { - this._forceFlush = true; - clearInterval(this._interval); - this._flush(); - } - /** - * Flushes the buckets according to the internal state of the aggregator. - * If it is a force flush, which happens on shutdown, it will flush all buckets. - * Otherwise, it will only flush buckets that are older than the flush interval, - * and according to the flush shift. - * - * This function mutates `_forceFlush` and `_bucketsTotalWeight` properties. - */ - _flush() { - if (this._forceFlush) { - this._forceFlush = false; - this._bucketsTotalWeight = 0; - this._captureMetrics(this._buckets); - this._buckets.clear(); - return; - } - const cutoffSeconds = Math.floor(timestampInSeconds()) - DEFAULT_FLUSH_INTERVAL / 1e3 - this._flushShift; - const flushedBuckets = /* @__PURE__ */ new Map(); - for (const [key, bucket] of this._buckets) { - if (bucket.timestamp <= cutoffSeconds) { - flushedBuckets.set(key, bucket); - this._bucketsTotalWeight -= bucket.metric.weight; - } - } - for (const [key] of flushedBuckets) { - this._buckets.delete(key); - } - this._captureMetrics(flushedBuckets); - } - /** - * Only captures a subset of the buckets passed to this function. - * @param flushedBuckets - */ - _captureMetrics(flushedBuckets) { - if (flushedBuckets.size > 0) { - const buckets = Array.from(flushedBuckets).map(([, bucketItem]) => bucketItem); - captureAggregateMetrics(this._client, buckets); - } - } -} -function increment$1(name2, value4 = 1, data26) { - metrics$1.increment(MetricsAggregator, name2, value4, data26); -} -__name(increment$1, "increment$1"); -function distribution$1(name2, value4, data26) { - metrics$1.distribution(MetricsAggregator, name2, value4, data26); -} -__name(distribution$1, "distribution$1"); -function set$5(name2, value4, data26) { - metrics$1.set(MetricsAggregator, name2, value4, data26); -} -__name(set$5, "set$5"); -function gauge$1(name2, value4, data26) { - metrics$1.gauge(MetricsAggregator, name2, value4, data26); -} -__name(gauge$1, "gauge$1"); -function timing$1(name2, value4, unit = "second", data26) { - return metrics$1.timing(MetricsAggregator, name2, value4, unit, data26); -} -__name(timing$1, "timing$1"); -function getMetricsAggregatorForClient(client) { - return metrics$1.getMetricsAggregatorForClient(client, MetricsAggregator); -} -__name(getMetricsAggregatorForClient, "getMetricsAggregatorForClient"); -const metricsDefault = { - increment: increment$1, - distribution: distribution$1, - set: set$5, - gauge: gauge$1, - timing: timing$1, - /** - * @ignore This is for internal use only. - */ - getMetricsAggregatorForClient -}; -class BrowserMetricsAggregator { - static { - __name(this, "BrowserMetricsAggregator"); - } - // TODO(@anonrig): Use FinalizationRegistry to have a proper way of flushing the buckets - // when the aggregator is garbage collected. - // Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry - constructor(_client) { - this._client = _client; - this._buckets = /* @__PURE__ */ new Map(); - this._interval = setInterval(() => this.flush(), DEFAULT_BROWSER_FLUSH_INTERVAL); - } - /** - * @inheritDoc - */ - add(metricType, unsanitizedName, value4, unsanitizedUnit = "none", unsanitizedTags = {}, maybeFloatTimestamp = timestampInSeconds()) { - const timestamp2 = Math.floor(maybeFloatTimestamp); - const name2 = sanitizeMetricKey(unsanitizedName); - const tags = sanitizeTags(unsanitizedTags); - const unit = sanitizeUnit(unsanitizedUnit); - const bucketKey = getBucketKey(metricType, name2, unit, tags); - let bucketItem = this._buckets.get(bucketKey); - const previousWeight = bucketItem && metricType === SET_METRIC_TYPE ? bucketItem.metric.weight : 0; - if (bucketItem) { - bucketItem.metric.add(value4); - if (bucketItem.timestamp < timestamp2) { - bucketItem.timestamp = timestamp2; - } - } else { - bucketItem = { - // @ts-expect-error we don't need to narrow down the type of value here, saves bundle size. - metric: new METRIC_MAP[metricType](value4), - timestamp: timestamp2, - metricType, - name: name2, - unit, - tags - }; - this._buckets.set(bucketKey, bucketItem); - } - const val = typeof value4 === "string" ? bucketItem.metric.weight - previousWeight : value4; - updateMetricSummaryOnActiveSpan(metricType, name2, val, unit, unsanitizedTags, bucketKey); - } - /** - * @inheritDoc - */ - flush() { - if (this._buckets.size === 0) { - return; - } - const metricBuckets = Array.from(this._buckets.values()); - captureAggregateMetrics(this._client, metricBuckets); - this._buckets.clear(); - } - /** - * @inheritDoc - */ - close() { - clearInterval(this._interval); - this.flush(); - } -} -function instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeaders2, spans, spanOrigin = "auto.http.browser") { - if (!handlerData.fetchData) { - return void 0; - } - const shouldCreateSpanResult = hasTracingEnabled() && shouldCreateSpan(handlerData.fetchData.url); - if (handlerData.endTimestamp && shouldCreateSpanResult) { - const spanId = handlerData.fetchData.__span; - if (!spanId) return; - const span2 = spans[spanId]; - if (span2) { - endSpan(span2, handlerData); - delete spans[spanId]; - } - return void 0; - } - const { method, url } = handlerData.fetchData; - const fullUrl = getFullURL$1(url); - const host = fullUrl ? parseUrl$1(fullUrl).host : void 0; - const hasParent = !!getActiveSpan(); - const span = shouldCreateSpanResult && hasParent ? startInactiveSpan({ - name: `${method} ${url}`, - attributes: { - url, - type: "fetch", - "http.method": method, - "http.url": fullUrl, - "server.address": host, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin, - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: "http.client" - } - }) : new SentryNonRecordingSpan(); - handlerData.fetchData.__span = span.spanContext().spanId; - spans[span.spanContext().spanId] = span; - if (shouldAttachHeaders2(handlerData.fetchData.url)) { - const request = handlerData.args[0]; - const options4 = handlerData.args[1] || {}; - const headers = _addTracingHeadersToFetchRequest( - request, - options4, - // If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction), - // we do not want to use the span as base for the trace headers, - // which means that the headers will be generated from the scope and the sampling decision is deferred - hasTracingEnabled() && hasParent ? span : void 0 - ); - if (headers) { - handlerData.args[1] = options4; - options4.headers = headers; - } - } - return span; -} -__name(instrumentFetchRequest, "instrumentFetchRequest"); -function _addTracingHeadersToFetchRequest(request, fetchOptionsObj, span) { - const traceHeaders = getTraceData({ span }); - const sentryTrace = traceHeaders["sentry-trace"]; - const baggage = traceHeaders.baggage; - if (!sentryTrace) { - return void 0; - } - const headers = fetchOptionsObj.headers || (isRequest$1(request) ? request.headers : void 0); - if (!headers) { - return { ...traceHeaders }; - } else if (isHeaders$1(headers)) { - const newHeaders = new Headers(headers); - newHeaders.set("sentry-trace", sentryTrace); - if (baggage) { - const prevBaggageHeader = newHeaders.get("baggage"); - if (prevBaggageHeader) { - const prevHeaderStrippedFromSentryBaggage = stripBaggageHeaderOfSentryBaggageValues(prevBaggageHeader); - newHeaders.set( - "baggage", - // If there are non-sentry entries (i.e. if the stripped string is non-empty/truthy) combine the stripped header and sentry baggage header - // otherwise just set the sentry baggage header - prevHeaderStrippedFromSentryBaggage ? `${prevHeaderStrippedFromSentryBaggage},${baggage}` : baggage - ); - } else { - newHeaders.set("baggage", baggage); - } - } - return newHeaders; - } else if (Array.isArray(headers)) { - const newHeaders = [ - ...headers.filter((header3) => { - return !(Array.isArray(header3) && header3[0] === "sentry-trace"); - }).map((header3) => { - if (Array.isArray(header3) && header3[0] === "baggage" && typeof header3[1] === "string") { - const [headerName, headerValue, ...rest] = header3; - return [headerName, stripBaggageHeaderOfSentryBaggageValues(headerValue), ...rest]; - } else { - return header3; - } - }), - // Attach the new sentry-trace header - ["sentry-trace", sentryTrace] - ]; - if (baggage) { - newHeaders.push(["baggage", baggage]); - } - return newHeaders; - } else { - const existingBaggageHeader = "baggage" in headers ? headers.baggage : void 0; - let newBaggageHeaders = []; - if (Array.isArray(existingBaggageHeader)) { - newBaggageHeaders = existingBaggageHeader.map( - (headerItem) => typeof headerItem === "string" ? stripBaggageHeaderOfSentryBaggageValues(headerItem) : headerItem - ).filter((headerItem) => headerItem === ""); - } else if (existingBaggageHeader) { - newBaggageHeaders.push(stripBaggageHeaderOfSentryBaggageValues(existingBaggageHeader)); - } - if (baggage) { - newBaggageHeaders.push(baggage); - } - return { - ...headers, - "sentry-trace": sentryTrace, - baggage: newBaggageHeaders.length > 0 ? newBaggageHeaders.join(",") : void 0 - }; - } -} -__name(_addTracingHeadersToFetchRequest, "_addTracingHeadersToFetchRequest"); -function addTracingHeadersToFetchRequest(request, _client, _scope, fetchOptionsObj, span) { - return _addTracingHeadersToFetchRequest(request, fetchOptionsObj, span); -} -__name(addTracingHeadersToFetchRequest, "addTracingHeadersToFetchRequest"); -function getFullURL$1(url) { - try { - const parsed = new URL(url); - return parsed.href; - } catch (e2) { - return void 0; - } -} -__name(getFullURL$1, "getFullURL$1"); -function endSpan(span, handlerData) { - if (handlerData.response) { - setHttpStatus(span, handlerData.response.status); - const contentLength = handlerData.response && handlerData.response.headers && handlerData.response.headers.get("content-length"); - if (contentLength) { - const contentLengthNum = parseInt(contentLength); - if (contentLengthNum > 0) { - span.setAttribute("http.response_content_length", contentLengthNum); - } - } - } else if (handlerData.error) { - span.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" }); - } - span.end(); -} -__name(endSpan, "endSpan"); -function stripBaggageHeaderOfSentryBaggageValues(baggageHeader) { - return baggageHeader.split(",").filter((baggageEntry) => !baggageEntry.split("=")[0].startsWith(SENTRY_BAGGAGE_KEY_PREFIX)).join(","); -} -__name(stripBaggageHeaderOfSentryBaggageValues, "stripBaggageHeaderOfSentryBaggageValues"); -function isRequest$1(request) { - return typeof Request !== "undefined" && isInstanceOf(request, Request); -} -__name(isRequest$1, "isRequest$1"); -function isHeaders$1(headers) { - return typeof Headers !== "undefined" && isInstanceOf(headers, Headers); -} -__name(isHeaders$1, "isHeaders$1"); -const trpcCaptureContext = { mechanism: { handled: false, data: { function: "trpcMiddleware" } } }; -function captureIfError(nextResult) { - if (typeof nextResult === "object" && nextResult !== null && "ok" in nextResult && !nextResult.ok && "error" in nextResult) { - captureException(nextResult.error, trpcCaptureContext); - } -} -__name(captureIfError, "captureIfError"); -function trpcMiddleware(options4 = {}) { - return async function(opts) { - const { path, type, next: next2, rawInput, getRawInput } = opts; - const client = getClient(); - const clientOptions = client && client.getOptions(); - const trpcContext = { - procedure_path: path, - procedure_type: type - }; - if (options4.attachRpcInput !== void 0 ? options4.attachRpcInput : clientOptions && clientOptions.sendDefaultPii) { - if (rawInput !== void 0) { - trpcContext.input = normalize$2(rawInput); - } - if (getRawInput !== void 0 && typeof getRawInput === "function") { - try { - const rawRes = await getRawInput(); - trpcContext.input = normalize$2(rawRes); - } catch (err) { - } - } - } - return withScope((scope) => { - scope.setContext("trpc", trpcContext); - return startSpanManual( - { - name: `trpc/${path}`, - op: "rpc.server", - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "route", - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.rpc.trpc" - } - }, - async (span) => { - try { - const nextResult = await next2(); - captureIfError(nextResult); - span.end(); - return nextResult; - } catch (e2) { - captureException(e2, trpcCaptureContext); - span.end(); - throw e2; - } - } - ); - }); - }; -} -__name(trpcMiddleware, "trpcMiddleware"); -function captureFeedback(params, hint = {}, scope = getCurrentScope$1()) { - const { message: message3, name: name2, email, url, source, associatedEventId, tags } = params; - const feedbackEvent = { - contexts: { - feedback: dropUndefinedKeys({ - contact_email: email, - name: name2, - message: message3, - url, - source, - associated_event_id: associatedEventId - }) - }, - type: "feedback", - level: "info", - tags - }; - const client = scope && scope.getClient() || getClient(); - if (client) { - client.emit("beforeSendFeedback", feedbackEvent, hint); - } - const eventId = scope.captureEvent(feedbackEvent, hint); - return eventId; -} -__name(captureFeedback, "captureFeedback"); -function getCurrentHubShim() { - return { - bindClient(client) { - const scope = getCurrentScope$1(); - scope.setClient(client); - }, - withScope, - getClient: /* @__PURE__ */ __name(() => getClient(), "getClient"), - getScope: getCurrentScope$1, - getIsolationScope, - captureException: /* @__PURE__ */ __name((exception, hint) => { - return getCurrentScope$1().captureException(exception, hint); - }, "captureException"), - captureMessage: /* @__PURE__ */ __name((message3, level, hint) => { - return getCurrentScope$1().captureMessage(message3, level, hint); - }, "captureMessage"), - captureEvent, - addBreadcrumb, - setUser, - setTags, - setTag: setTag$5, - setExtra, - setExtras, - setContext, - getIntegration(integration) { - const client = getClient(); - return client && client.getIntegrationByName(integration.id) || null; - }, - startSession, - endSession, - captureSession(end) { - if (end) { - return endSession(); - } - _sendSessionUpdate(); - } - }; -} -__name(getCurrentHubShim, "getCurrentHubShim"); -const getCurrentHub = getCurrentHubShim; -function _sendSessionUpdate() { - const scope = getCurrentScope$1(); - const client = getClient(); - const session = scope.getSession(); - if (client && session) { - client.captureSession(session); - } -} -__name(_sendSessionUpdate, "_sendSessionUpdate"); -function flatten(input) { - const result = []; - const flattenHelper = /* @__PURE__ */ __name((input2) => { - input2.forEach((el) => { - if (Array.isArray(el)) { - flattenHelper(el); - } else { - result.push(el); - } - }); - }, "flattenHelper"); - flattenHelper(input); - return result; -} -__name(flatten, "flatten"); -function getBreadcrumbLogLevelFromHttpStatusCode(statusCode) { - if (statusCode === void 0) { - return void 0; - } else if (statusCode >= 400 && statusCode < 500) { - return "warning"; - } else if (statusCode >= 500) { - return "error"; - } else { - return void 0; - } -} -__name(getBreadcrumbLogLevelFromHttpStatusCode, "getBreadcrumbLogLevelFromHttpStatusCode"); -const WINDOW$7 = GLOBAL_OBJ; -function supportsErrorEvent() { - try { - new ErrorEvent(""); - return true; - } catch (e2) { - return false; - } -} -__name(supportsErrorEvent, "supportsErrorEvent"); -function supportsDOMError() { - try { - new DOMError(""); - return true; - } catch (e2) { - return false; - } -} -__name(supportsDOMError, "supportsDOMError"); -function supportsDOMException() { - try { - new DOMException(""); - return true; - } catch (e2) { - return false; - } -} -__name(supportsDOMException, "supportsDOMException"); -function supportsFetch() { - if (!("fetch" in WINDOW$7)) { - return false; - } - try { - new Headers(); - new Request("http://www.example.com"); - new Response(); - return true; - } catch (e2) { - return false; - } -} -__name(supportsFetch, "supportsFetch"); -function isNativeFunction(func) { - return func && /^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(func.toString()); -} -__name(isNativeFunction, "isNativeFunction"); -function supportsNativeFetch() { - if (typeof EdgeRuntime === "string") { - return true; - } - if (!supportsFetch()) { - return false; - } - if (isNativeFunction(WINDOW$7.fetch)) { - return true; - } - let result = false; - const doc2 = WINDOW$7.document; - if (doc2 && typeof doc2.createElement === "function") { - try { - const sandbox = doc2.createElement("iframe"); - sandbox.hidden = true; - doc2.head.appendChild(sandbox); - if (sandbox.contentWindow && sandbox.contentWindow.fetch) { - result = isNativeFunction(sandbox.contentWindow.fetch); - } - doc2.head.removeChild(sandbox); - } catch (err) { - DEBUG_BUILD$5 && logger$2.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ", err); - } - } - return result; -} -__name(supportsNativeFetch, "supportsNativeFetch"); -function supportsReportingObserver() { - return "ReportingObserver" in WINDOW$7; -} -__name(supportsReportingObserver, "supportsReportingObserver"); -function supportsReferrerPolicy() { - if (!supportsFetch()) { - return false; - } - try { - new Request("_", { - referrerPolicy: "origin" - }); - return true; - } catch (e2) { - return false; - } -} -__name(supportsReferrerPolicy, "supportsReferrerPolicy"); -function addFetchInstrumentationHandler(handler12, skipNativeFetchCheck) { - const type = "fetch"; - addHandler$1(type, handler12); - maybeInstrument(type, () => instrumentFetch(void 0, skipNativeFetchCheck)); -} -__name(addFetchInstrumentationHandler, "addFetchInstrumentationHandler"); -function addFetchEndInstrumentationHandler(handler12) { - const type = "fetch-body-resolved"; - addHandler$1(type, handler12); - maybeInstrument(type, () => instrumentFetch(streamHandler)); -} -__name(addFetchEndInstrumentationHandler, "addFetchEndInstrumentationHandler"); -function instrumentFetch(onFetchResolved, skipNativeFetchCheck = false) { - if (skipNativeFetchCheck && !supportsNativeFetch()) { - return; - } - fill(GLOBAL_OBJ, "fetch", function(originalFetch) { - return function(...args) { - const virtualError = new Error(); - const { method, url } = parseFetchArgs(args); - const handlerData = { - args, - fetchData: { - method, - url - }, - startTimestamp: timestampInSeconds() * 1e3, - // // Adding the error to be able to fingerprint the failed fetch event in HttpClient instrumentation - virtualError - }; - if (!onFetchResolved) { - triggerHandlers$1("fetch", { - ...handlerData - }); - } - return originalFetch.apply(GLOBAL_OBJ, args).then( - async (response) => { - if (onFetchResolved) { - onFetchResolved(response); - } else { - triggerHandlers$1("fetch", { - ...handlerData, - endTimestamp: timestampInSeconds() * 1e3, - response - }); - } - return response; - }, - (error2) => { - triggerHandlers$1("fetch", { - ...handlerData, - endTimestamp: timestampInSeconds() * 1e3, - error: error2 - }); - if (isError(error2) && error2.stack === void 0) { - error2.stack = virtualError.stack; - addNonEnumerableProperty(error2, "framesToPop", 1); - } - throw error2; - } - ); - }; - }); -} -__name(instrumentFetch, "instrumentFetch"); -async function resolveResponse(res, onFinishedResolving) { - if (res && res.body) { - const body = res.body; - const responseReader = body.getReader(); - const maxFetchDurationTimeout = setTimeout( - () => { - body.cancel().then(null, () => { - }); - }, - 90 * 1e3 - // 90s - ); - let readingActive = true; - while (readingActive) { - let chunkTimeout; - try { - chunkTimeout = setTimeout(() => { - body.cancel().then(null, () => { - }); - }, 5e3); - const { done } = await responseReader.read(); - clearTimeout(chunkTimeout); - if (done) { - onFinishedResolving(); - readingActive = false; - } - } catch (error2) { - readingActive = false; - } finally { - clearTimeout(chunkTimeout); - } - } - clearTimeout(maxFetchDurationTimeout); - responseReader.releaseLock(); - body.cancel().then(null, () => { - }); - } -} -__name(resolveResponse, "resolveResponse"); -function streamHandler(response) { - let clonedResponseForResolving; - try { - clonedResponseForResolving = response.clone(); - } catch (e2) { - return; - } - resolveResponse(clonedResponseForResolving, () => { - triggerHandlers$1("fetch-body-resolved", { - endTimestamp: timestampInSeconds() * 1e3, - response - }); - }); -} -__name(streamHandler, "streamHandler"); -function hasProp(obj, prop2) { - return !!obj && typeof obj === "object" && !!obj[prop2]; -} -__name(hasProp, "hasProp"); -function getUrlFromResource(resource) { - if (typeof resource === "string") { - return resource; - } - if (!resource) { - return ""; - } - if (hasProp(resource, "url")) { - return resource.url; - } - if (resource.toString) { - return resource.toString(); - } - return ""; -} -__name(getUrlFromResource, "getUrlFromResource"); -function parseFetchArgs(fetchArgs) { - if (fetchArgs.length === 0) { - return { method: "GET", url: "" }; - } - if (fetchArgs.length === 2) { - const [url, options4] = fetchArgs; - return { - url: getUrlFromResource(url), - method: hasProp(options4, "method") ? String(options4.method).toUpperCase() : "GET" - }; - } - const arg = fetchArgs[0]; - return { - url: getUrlFromResource(arg), - method: hasProp(arg, "method") ? String(arg.method).toUpperCase() : "GET" - }; -} -__name(parseFetchArgs, "parseFetchArgs"); -function isBrowserBundle() { - return typeof __SENTRY_BROWSER_BUNDLE__ !== "undefined" && !!__SENTRY_BROWSER_BUNDLE__; -} -__name(isBrowserBundle, "isBrowserBundle"); -function getSDKSource() { - return "npm"; -} -__name(getSDKSource, "getSDKSource"); -function isNodeEnv() { - return !isBrowserBundle() && Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]"; -} -__name(isNodeEnv, "isNodeEnv"); -function dynamicRequire(mod, request) { - return mod.require(request); -} -__name(dynamicRequire, "dynamicRequire"); -function loadModule(moduleName) { - let mod; - try { - mod = dynamicRequire(module, moduleName); - } catch (e2) { - } - if (!mod) { - try { - const { cwd } = dynamicRequire(module, "process"); - mod = dynamicRequire(module, `${cwd()}/node_modules/${moduleName}`); - } catch (e2) { - } - } - return mod; -} -__name(loadModule, "loadModule"); -function isBrowser$1() { - return typeof window !== "undefined" && (!isNodeEnv() || isElectronNodeRenderer()); -} -__name(isBrowser$1, "isBrowser$1"); -function isElectronNodeRenderer() { - const process2 = GLOBAL_OBJ.process; - return !!process2 && process2.type === "renderer"; -} -__name(isElectronNodeRenderer, "isElectronNodeRenderer"); -function filenameIsInApp(filename, isNative = false) { - const isInternal = isNative || filename && // It's not internal if it's an absolute linux path - !filename.startsWith("/") && // It's not internal if it's an absolute windows path - !filename.match(/^[A-Z]:/) && // It's not internal if the path is starting with a dot - !filename.startsWith(".") && // It's not internal if the frame has a protocol. In node, this is usually the case if the file got pre-processed with a bundler like webpack - !filename.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//); - return !isInternal && filename !== void 0 && !filename.includes("node_modules/"); -} -__name(filenameIsInApp, "filenameIsInApp"); -function node(getModule) { - const FILENAME_MATCH = /^\s*[-]{4,}$/; - const FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/; - return (line) => { - const lineMatch = line.match(FULL_MATCH); - if (lineMatch) { - let object; - let method; - let functionName; - let typeName; - let methodName; - if (lineMatch[1]) { - functionName = lineMatch[1]; - let methodStart = functionName.lastIndexOf("."); - if (functionName[methodStart - 1] === ".") { - methodStart--; - } - if (methodStart > 0) { - object = functionName.slice(0, methodStart); - method = functionName.slice(methodStart + 1); - const objectEnd = object.indexOf(".Module"); - if (objectEnd > 0) { - functionName = functionName.slice(objectEnd + 1); - object = object.slice(0, objectEnd); - } - } - typeName = void 0; - } - if (method) { - typeName = object; - methodName = method; - } - if (method === "") { - methodName = void 0; - functionName = void 0; - } - if (functionName === void 0) { - methodName = methodName || UNKNOWN_FUNCTION; - functionName = typeName ? `${typeName}.${methodName}` : methodName; - } - let filename = lineMatch[2] && lineMatch[2].startsWith("file://") ? lineMatch[2].slice(7) : lineMatch[2]; - const isNative = lineMatch[5] === "native"; - if (filename && filename.match(/\/[A-Z]:/)) { - filename = filename.slice(1); - } - if (!filename && lineMatch[5] && !isNative) { - filename = lineMatch[5]; - } - return { - filename: filename ? decodeURI(filename) : void 0, - module: getModule ? getModule(filename) : void 0, - function: functionName, - lineno: _parseIntOrUndefined(lineMatch[3]), - colno: _parseIntOrUndefined(lineMatch[4]), - in_app: filenameIsInApp(filename || "", isNative) - }; - } - if (line.match(FILENAME_MATCH)) { - return { - filename: line - }; - } - return void 0; - }; -} -__name(node, "node"); -function nodeStackLineParser(getModule) { - return [90, node(getModule)]; -} -__name(nodeStackLineParser, "nodeStackLineParser"); -function _parseIntOrUndefined(input) { - return parseInt(input || "", 10) || void 0; -} -__name(_parseIntOrUndefined, "_parseIntOrUndefined"); -function makeFifoCache(size) { - let evictionOrder = []; - let cache2 = {}; - return { - add(key, value4) { - while (evictionOrder.length >= size) { - const evictCandidate = evictionOrder.shift(); - if (evictCandidate !== void 0) { - delete cache2[evictCandidate]; - } - } - if (cache2[key]) { - this.delete(key); - } - evictionOrder.push(key); - cache2[key] = value4; - }, - clear() { - cache2 = {}; - evictionOrder = []; - }, - get(key) { - return cache2[key]; - }, - size() { - return evictionOrder.length; - }, - // Delete cache key and return true if it existed, false otherwise. - delete(key) { - if (!cache2[key]) { - return false; - } - delete cache2[key]; - for (let i2 = 0; i2 < evictionOrder.length; i2++) { - if (evictionOrder[i2] === key) { - evictionOrder.splice(i2, 1); - break; - } - } - return true; - } - }; -} -__name(makeFifoCache, "makeFifoCache"); -function watchdogTimer(createTimer, pollInterval, anrThreshold, callback) { - const timer = createTimer(); - let triggered = false; - let enabled = true; - setInterval(() => { - const diffMs = timer.getTimeMs(); - if (triggered === false && diffMs > pollInterval + anrThreshold) { - triggered = true; - if (enabled) { - callback(); - } - } - if (diffMs < pollInterval + anrThreshold) { - triggered = false; - } - }, 20); - return { - poll: /* @__PURE__ */ __name(() => { - timer.reset(); - }, "poll"), - enabled: /* @__PURE__ */ __name((state) => { - enabled = state; - }, "enabled") - }; -} -__name(watchdogTimer, "watchdogTimer"); -function callFrameToStackFrame(frame, url, getModuleFromFilename) { - const filename = url ? url.replace(/^file:\/\//, "") : void 0; - const colno = frame.location.columnNumber ? frame.location.columnNumber + 1 : void 0; - const lineno = frame.location.lineNumber ? frame.location.lineNumber + 1 : void 0; - return dropUndefinedKeys({ - filename, - module: getModuleFromFilename(filename), - function: frame.functionName || UNKNOWN_FUNCTION, - colno, - lineno, - in_app: filename ? filenameIsInApp(filename) : void 0 - }); -} -__name(callFrameToStackFrame, "callFrameToStackFrame"); -class LRUMap { - static { - __name(this, "LRUMap"); - } - constructor(_maxSize) { - this._maxSize = _maxSize; - this._cache = /* @__PURE__ */ new Map(); - } - /** Get the current size of the cache */ - get size() { - return this._cache.size; - } - /** Get an entry or undefined if it was not in the cache. Re-inserts to update the recently used order */ - get(key) { - const value4 = this._cache.get(key); - if (value4 === void 0) { - return void 0; - } - this._cache.delete(key); - this._cache.set(key, value4); - return value4; - } - /** Insert an entry and evict an older entry if we've reached maxSize */ - set(key, value4) { - if (this._cache.size >= this._maxSize) { - this._cache.delete(this._cache.keys().next().value); - } - this._cache.set(key, value4); - } - /** Remove an entry and return the entry if it was in the cache */ - remove(key) { - const value4 = this._cache.get(key); - if (value4) { - this._cache.delete(key); - } - return value4; - } - /** Clear all entries */ - clear() { - this._cache.clear(); - } - /** Get all the keys */ - keys() { - return Array.from(this._cache.keys()); - } - /** Get all the values */ - values() { - const values = []; - this._cache.forEach((value4) => values.push(value4)); - return values; - } -} -function vercelWaitUntil(task) { - const vercelRequestContextGlobal = ( - // @ts-expect-error This is not typed - GLOBAL_OBJ[Symbol.for("@vercel/request-context")] - ); - const ctx = vercelRequestContextGlobal && vercelRequestContextGlobal.get && vercelRequestContextGlobal.get() ? vercelRequestContextGlobal.get() : {}; - if (ctx && ctx.waitUntil) { - ctx.waitUntil(task); - } -} -__name(vercelWaitUntil, "vercelWaitUntil"); -function escapeStringForRegex(regexString) { - return regexString.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); -} -__name(escapeStringForRegex, "escapeStringForRegex"); -const WINDOW$6 = GLOBAL_OBJ; -function supportsHistory() { - const chromeVar = WINDOW$6.chrome; - const isChromePackagedApp = chromeVar && chromeVar.app && chromeVar.app.runtime; - const hasHistoryApi = "history" in WINDOW$6 && !!WINDOW$6.history.pushState && !!WINDOW$6.history.replaceState; - return !isChromePackagedApp && hasHistoryApi; -} -__name(supportsHistory, "supportsHistory"); -function _nullishCoalesce(lhs, rhsFn) { - return lhs != null ? lhs : rhsFn(); -} -__name(_nullishCoalesce, "_nullishCoalesce"); -async function _asyncNullishCoalesce(lhs, rhsFn) { - return _nullishCoalesce(lhs, rhsFn); -} -__name(_asyncNullishCoalesce, "_asyncNullishCoalesce"); -async function _asyncOptionalChain(ops) { - let lastAccessLHS = void 0; - let value4 = ops[0]; - let i2 = 1; - while (i2 < ops.length) { - const op = ops[i2]; - const fn = ops[i2 + 1]; - i2 += 2; - if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { - return; - } - if (op === "access" || op === "optionalAccess") { - lastAccessLHS = value4; - value4 = await fn(value4); - } else if (op === "call" || op === "optionalCall") { - value4 = await fn((...args) => value4.call(lastAccessLHS, ...args)); - lastAccessLHS = void 0; - } - } - return value4; -} -__name(_asyncOptionalChain, "_asyncOptionalChain"); -async function _asyncOptionalChainDelete(ops) { - const result = await _asyncOptionalChain(ops); - return result == null ? true : result; -} -__name(_asyncOptionalChainDelete, "_asyncOptionalChainDelete"); -function _optionalChain(ops) { - let lastAccessLHS = void 0; - let value4 = ops[0]; - let i2 = 1; - while (i2 < ops.length) { - const op = ops[i2]; - const fn = ops[i2 + 1]; - i2 += 2; - if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { - return; - } - if (op === "access" || op === "optionalAccess") { - lastAccessLHS = value4; - value4 = fn(value4); - } else if (op === "call" || op === "optionalCall") { - value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); - lastAccessLHS = void 0; - } - } - return value4; -} -__name(_optionalChain, "_optionalChain"); -function _optionalChainDelete(ops) { - const result = _optionalChain(ops); - return result == null ? true : result; -} -__name(_optionalChainDelete, "_optionalChainDelete"); -const WINDOW$5 = GLOBAL_OBJ; -let ignoreOnError = 0; -function shouldIgnoreOnError() { - return ignoreOnError > 0; -} -__name(shouldIgnoreOnError, "shouldIgnoreOnError"); -function ignoreNextOnError() { - ignoreOnError++; - setTimeout(() => { - ignoreOnError--; - }); -} -__name(ignoreNextOnError, "ignoreNextOnError"); -function wrap$1(fn, options4 = {}) { - function isFunction2(fn2) { - return typeof fn2 === "function"; - } - __name(isFunction2, "isFunction"); - if (!isFunction2(fn)) { - return fn; - } - try { - const wrapper = fn.__sentry_wrapped__; - if (wrapper) { - if (typeof wrapper === "function") { - return wrapper; - } else { - return fn; - } - } - if (getOriginalFunction(fn)) { - return fn; - } - } catch (e2) { - return fn; - } - const sentryWrapped = /* @__PURE__ */ __name(function(...args) { - try { - const wrappedArguments = args.map((arg) => wrap$1(arg, options4)); - return fn.apply(this, wrappedArguments); - } catch (ex) { - ignoreNextOnError(); - withScope((scope) => { - scope.addEventProcessor((event) => { - if (options4.mechanism) { - addExceptionTypeValue(event, void 0, void 0); - addExceptionMechanism(event, options4.mechanism); - } - event.extra = { - ...event.extra, - arguments: args - }; - return event; - }); - captureException(ex); - }); - throw ex; - } - }, "sentryWrapped"); - try { - for (const property in fn) { - if (Object.prototype.hasOwnProperty.call(fn, property)) { - sentryWrapped[property] = fn[property]; - } - } - } catch (e2) { - } - markFunctionWrapped(sentryWrapped, fn); - addNonEnumerableProperty(fn, "__sentry_wrapped__", sentryWrapped); - try { - const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, "name"); - if (descriptor.configurable) { - Object.defineProperty(sentryWrapped, "name", { - get() { - return fn.name; - } - }); - } - } catch (e3) { - } - return sentryWrapped; -} -__name(wrap$1, "wrap$1"); -const DEBUG_BUILD$4 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; -function exceptionFromError(stackParser, ex) { - const frames = parseStackFrames(stackParser, ex); - const exception = { - type: extractType(ex), - value: extractMessage(ex) - }; - if (frames.length) { - exception.stacktrace = { frames }; - } - if (exception.type === void 0 && exception.value === "") { - exception.value = "Unrecoverable error caught"; - } - return exception; -} -__name(exceptionFromError, "exceptionFromError"); -function eventFromPlainObject(stackParser, exception, syntheticException, isUnhandledRejection) { - const client = getClient(); - const normalizeDepth = client && client.getOptions().normalizeDepth; - const errorFromProp = getErrorPropertyFromObject(exception); - const extra = { - __serialized__: normalizeToSize(exception, normalizeDepth) - }; - if (errorFromProp) { - return { - exception: { - values: [exceptionFromError(stackParser, errorFromProp)] - }, - extra - }; - } - const event = { - exception: { - values: [ - { - type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? "UnhandledRejection" : "Error", - value: getNonErrorObjectExceptionValue(exception, { isUnhandledRejection }) - } - ] - }, - extra - }; - if (syntheticException) { - const frames = parseStackFrames(stackParser, syntheticException); - if (frames.length) { - event.exception.values[0].stacktrace = { frames }; - } - } - return event; -} -__name(eventFromPlainObject, "eventFromPlainObject"); -function eventFromError(stackParser, ex) { - return { - exception: { - values: [exceptionFromError(stackParser, ex)] - } - }; -} -__name(eventFromError, "eventFromError"); -function parseStackFrames(stackParser, ex) { - const stacktrace = ex.stacktrace || ex.stack || ""; - const skipLines = getSkipFirstStackStringLines(ex); - const framesToPop = getPopFirstTopFrames(ex); - try { - return stackParser(stacktrace, skipLines, framesToPop); - } catch (e2) { - } - return []; -} -__name(parseStackFrames, "parseStackFrames"); -const reactMinifiedRegexp = /Minified React error #\d+;/i; -function getSkipFirstStackStringLines(ex) { - if (ex && reactMinifiedRegexp.test(ex.message)) { - return 1; - } - return 0; -} -__name(getSkipFirstStackStringLines, "getSkipFirstStackStringLines"); -function getPopFirstTopFrames(ex) { - if (typeof ex.framesToPop === "number") { - return ex.framesToPop; - } - return 0; -} -__name(getPopFirstTopFrames, "getPopFirstTopFrames"); -function isWebAssemblyException(exception) { - if (typeof WebAssembly !== "undefined" && typeof WebAssembly.Exception !== "undefined") { - return exception instanceof WebAssembly.Exception; - } else { - return false; - } -} -__name(isWebAssemblyException, "isWebAssemblyException"); -function extractType(ex) { - const name2 = ex && ex.name; - if (!name2 && isWebAssemblyException(ex)) { - const hasTypeInMessage = ex.message && Array.isArray(ex.message) && ex.message.length == 2; - return hasTypeInMessage ? ex.message[0] : "WebAssembly.Exception"; - } - return name2; -} -__name(extractType, "extractType"); -function extractMessage(ex) { - const message3 = ex && ex.message; - if (!message3) { - return "No error message"; - } - if (message3.error && typeof message3.error.message === "string") { - return message3.error.message; - } - if (isWebAssemblyException(ex) && Array.isArray(ex.message) && ex.message.length == 2) { - return ex.message[1]; - } - return message3; -} -__name(extractMessage, "extractMessage"); -function eventFromException(stackParser, exception, hint, attachStacktrace) { - const syntheticException = hint && hint.syntheticException || void 0; - const event = eventFromUnknownInput(stackParser, exception, syntheticException, attachStacktrace); - addExceptionMechanism(event); - event.level = "error"; - if (hint && hint.event_id) { - event.event_id = hint.event_id; - } - return resolvedSyncPromise(event); -} -__name(eventFromException, "eventFromException"); -function eventFromMessage(stackParser, message3, level = "info", hint, attachStacktrace) { - const syntheticException = hint && hint.syntheticException || void 0; - const event = eventFromString(stackParser, message3, syntheticException, attachStacktrace); - event.level = level; - if (hint && hint.event_id) { - event.event_id = hint.event_id; - } - return resolvedSyncPromise(event); -} -__name(eventFromMessage, "eventFromMessage"); -function eventFromUnknownInput(stackParser, exception, syntheticException, attachStacktrace, isUnhandledRejection) { - let event; - if (isErrorEvent$2(exception) && exception.error) { - const errorEvent = exception; - return eventFromError(stackParser, errorEvent.error); - } - if (isDOMError(exception) || isDOMException(exception)) { - const domException = exception; - if ("stack" in exception) { - event = eventFromError(stackParser, exception); - } else { - const name2 = domException.name || (isDOMError(domException) ? "DOMError" : "DOMException"); - const message3 = domException.message ? `${name2}: ${domException.message}` : name2; - event = eventFromString(stackParser, message3, syntheticException, attachStacktrace); - addExceptionTypeValue(event, message3); - } - if ("code" in domException) { - event.tags = { ...event.tags, "DOMException.code": `${domException.code}` }; - } - return event; - } - if (isError(exception)) { - return eventFromError(stackParser, exception); - } - if (isPlainObject$5(exception) || isEvent(exception)) { - const objectException = exception; - event = eventFromPlainObject(stackParser, objectException, syntheticException, isUnhandledRejection); - addExceptionMechanism(event, { - synthetic: true - }); - return event; - } - event = eventFromString(stackParser, exception, syntheticException, attachStacktrace); - addExceptionTypeValue(event, `${exception}`, void 0); - addExceptionMechanism(event, { - synthetic: true - }); - return event; -} -__name(eventFromUnknownInput, "eventFromUnknownInput"); -function eventFromString(stackParser, message3, syntheticException, attachStacktrace) { - const event = {}; - if (attachStacktrace && syntheticException) { - const frames = parseStackFrames(stackParser, syntheticException); - if (frames.length) { - event.exception = { - values: [{ value: message3, stacktrace: { frames } }] - }; - } - addExceptionMechanism(event, { synthetic: true }); - } - if (isParameterizedString(message3)) { - const { __sentry_template_string__, __sentry_template_values__ } = message3; - event.logentry = { - message: __sentry_template_string__, - params: __sentry_template_values__ - }; - return event; - } - event.message = message3; - return event; -} -__name(eventFromString, "eventFromString"); -function getNonErrorObjectExceptionValue(exception, { isUnhandledRejection }) { - const keys2 = extractExceptionKeysForMessage(exception); - const captureType = isUnhandledRejection ? "promise rejection" : "exception"; - if (isErrorEvent$2(exception)) { - return `Event \`ErrorEvent\` captured as ${captureType} with message \`${exception.message}\``; - } - if (isEvent(exception)) { - const className = getObjectClassName(exception); - return `Event \`${className}\` (type=${exception.type}) captured as ${captureType}`; - } - return `Object captured as ${captureType} with keys: ${keys2}`; -} -__name(getNonErrorObjectExceptionValue, "getNonErrorObjectExceptionValue"); -function getObjectClassName(obj) { - try { - const prototype2 = Object.getPrototypeOf(obj); - return prototype2 ? prototype2.constructor.name : void 0; - } catch (e2) { - } -} -__name(getObjectClassName, "getObjectClassName"); -function getErrorPropertyFromObject(obj) { - for (const prop2 in obj) { - if (Object.prototype.hasOwnProperty.call(obj, prop2)) { - const value4 = obj[prop2]; - if (value4 instanceof Error) { - return value4; - } - } - } - return void 0; -} -__name(getErrorPropertyFromObject, "getErrorPropertyFromObject"); -function createUserFeedbackEnvelope(feedback, { - metadata, - tunnel, - dsn -}) { - const headers = { - event_id: feedback.event_id, - sent_at: (/* @__PURE__ */ new Date()).toISOString(), - ...metadata && metadata.sdk && { - sdk: { - name: metadata.sdk.name, - version: metadata.sdk.version - } - }, - ...!!tunnel && !!dsn && { dsn: dsnToString(dsn) } - }; - const item3 = createUserFeedbackEnvelopeItem(feedback); - return createEnvelope(headers, [item3]); -} -__name(createUserFeedbackEnvelope, "createUserFeedbackEnvelope"); -function createUserFeedbackEnvelopeItem(feedback) { - const feedbackHeaders = { - type: "user_report" - }; - return [feedbackHeaders, feedback]; -} -__name(createUserFeedbackEnvelopeItem, "createUserFeedbackEnvelopeItem"); -class BrowserClient extends BaseClient { - static { - __name(this, "BrowserClient"); - } - /** - * Creates a new Browser SDK instance. - * - * @param options Configuration options for this SDK. - */ - constructor(options4) { - const opts = { - // We default this to true, as it is the safer scenario - parentSpanIsAlwaysRootSpan: true, - ...options4 - }; - const sdkSource = WINDOW$5.SENTRY_SDK_SOURCE || getSDKSource(); - applySdkMetadata(opts, "browser", ["browser"], sdkSource); - super(opts); - if (opts.sendClientReports && WINDOW$5.document) { - WINDOW$5.document.addEventListener("visibilitychange", () => { - if (WINDOW$5.document.visibilityState === "hidden") { - this._flushOutcomes(); - } - }); - } - } - /** - * @inheritDoc - */ - eventFromException(exception, hint) { - return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace); - } - /** - * @inheritDoc - */ - eventFromMessage(message3, level = "info", hint) { - return eventFromMessage(this._options.stackParser, message3, level, hint, this._options.attachStacktrace); - } - /** - * Sends user feedback to Sentry. - * - * @deprecated Use `captureFeedback` instead. - */ - captureUserFeedback(feedback) { - if (!this._isEnabled()) { - DEBUG_BUILD$4 && logger$2.warn("SDK not enabled, will not capture user feedback."); - return; - } - const envelope = createUserFeedbackEnvelope(feedback, { - metadata: this.getSdkMetadata(), - dsn: this.getDsn(), - tunnel: this.getOptions().tunnel - }); - this.sendEnvelope(envelope); - } - /** - * @inheritDoc - */ - _prepareEvent(event, hint, scope) { - event.platform = event.platform || "javascript"; - return super._prepareEvent(event, hint, scope); - } -} -const DEBUG_BUILD$3 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; -const getRating = /* @__PURE__ */ __name((value4, thresholds) => { - if (value4 > thresholds[1]) { - return "poor"; - } - if (value4 > thresholds[0]) { - return "needs-improvement"; - } - return "good"; -}, "getRating"); -const bindReporter = /* @__PURE__ */ __name((callback, metric, thresholds, reportAllChanges) => { - let prevValue; - let delta2; - return (forceReport) => { - if (metric.value >= 0) { - if (forceReport || reportAllChanges) { - delta2 = metric.value - (prevValue || 0); - if (delta2 || prevValue === void 0) { - prevValue = metric.value; - metric.delta = delta2; - metric.rating = getRating(metric.value, thresholds); - callback(metric); - } - } - } - }; -}, "bindReporter"); -const WINDOW$4 = GLOBAL_OBJ; -const generateUniqueID = /* @__PURE__ */ __name(() => { - return `v4-${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`; -}, "generateUniqueID"); -const getNavigationEntry = /* @__PURE__ */ __name((checkResponseStart = true) => { - const navigationEntry = WINDOW$4.performance && WINDOW$4.performance.getEntriesByType && WINDOW$4.performance.getEntriesByType("navigation")[0]; - if ( - // sentry-specific change: - // We don't want to check for responseStart for our own use of `getNavigationEntry` - !checkResponseStart || navigationEntry && navigationEntry.responseStart > 0 && navigationEntry.responseStart < performance.now() - ) { - return navigationEntry; - } -}, "getNavigationEntry"); -const getActivationStart = /* @__PURE__ */ __name(() => { - const navEntry = getNavigationEntry(); - return navEntry && navEntry.activationStart || 0; -}, "getActivationStart"); -const initMetric = /* @__PURE__ */ __name((name2, value4) => { - const navEntry = getNavigationEntry(); - let navigationType = "navigate"; - if (navEntry) { - if (WINDOW$4.document && WINDOW$4.document.prerendering || getActivationStart() > 0) { - navigationType = "prerender"; - } else if (WINDOW$4.document && WINDOW$4.document.wasDiscarded) { - navigationType = "restore"; - } else if (navEntry.type) { - navigationType = navEntry.type.replace(/_/g, "-"); - } - } - const entries = []; - return { - name: name2, - value: typeof value4 === "undefined" ? -1 : value4, - rating: "good", - // If needed, will be updated when reported. `const` to keep the type from widening to `string`. - delta: 0, - entries, - id: generateUniqueID(), - navigationType - }; -}, "initMetric"); -const observe = /* @__PURE__ */ __name((type, callback, opts) => { - try { - if (PerformanceObserver.supportedEntryTypes.includes(type)) { - const po2 = new PerformanceObserver((list2) => { - Promise.resolve().then(() => { - callback(list2.getEntries()); - }); - }); - po2.observe( - Object.assign( - { - type, - buffered: true - }, - opts || {} - ) - ); - return po2; - } - } catch (e2) { - } - return; -}, "observe"); -const onHidden = /* @__PURE__ */ __name((cb) => { - const onHiddenOrPageHide = /* @__PURE__ */ __name((event) => { - if (event.type === "pagehide" || WINDOW$4.document && WINDOW$4.document.visibilityState === "hidden") { - cb(event); - } - }, "onHiddenOrPageHide"); - if (WINDOW$4.document) { - addEventListener("visibilitychange", onHiddenOrPageHide, true); - addEventListener("pagehide", onHiddenOrPageHide, true); - } -}, "onHidden"); -const runOnce = /* @__PURE__ */ __name((cb) => { - let called = false; - return () => { - if (!called) { - cb(); - called = true; - } - }; -}, "runOnce"); -let firstHiddenTime = -1; -const initHiddenTime = /* @__PURE__ */ __name(() => { - return WINDOW$4.document.visibilityState === "hidden" && !WINDOW$4.document.prerendering ? 0 : Infinity; -}, "initHiddenTime"); -const onVisibilityUpdate = /* @__PURE__ */ __name((event) => { - if (WINDOW$4.document.visibilityState === "hidden" && firstHiddenTime > -1) { - firstHiddenTime = event.type === "visibilitychange" ? event.timeStamp : 0; - removeChangeListeners(); - } -}, "onVisibilityUpdate"); -const addChangeListeners = /* @__PURE__ */ __name(() => { - addEventListener("visibilitychange", onVisibilityUpdate, true); - addEventListener("prerenderingchange", onVisibilityUpdate, true); -}, "addChangeListeners"); -const removeChangeListeners = /* @__PURE__ */ __name(() => { - removeEventListener("visibilitychange", onVisibilityUpdate, true); - removeEventListener("prerenderingchange", onVisibilityUpdate, true); -}, "removeChangeListeners"); -const getVisibilityWatcher = /* @__PURE__ */ __name(() => { - if (WINDOW$4.document && firstHiddenTime < 0) { - firstHiddenTime = initHiddenTime(); - addChangeListeners(); - } - return { - get firstHiddenTime() { - return firstHiddenTime; - } - }; -}, "getVisibilityWatcher"); -const whenActivated = /* @__PURE__ */ __name((callback) => { - if (WINDOW$4.document && WINDOW$4.document.prerendering) { - addEventListener("prerenderingchange", () => callback(), true); - } else { - callback(); - } -}, "whenActivated"); -const FCPThresholds = [1800, 3e3]; -const onFCP = /* @__PURE__ */ __name((onReport, opts = {}) => { - whenActivated(() => { - const visibilityWatcher = getVisibilityWatcher(); - const metric = initMetric("FCP"); - let report; - const handleEntries = /* @__PURE__ */ __name((entries) => { - entries.forEach((entry) => { - if (entry.name === "first-contentful-paint") { - po2.disconnect(); - if (entry.startTime < visibilityWatcher.firstHiddenTime) { - metric.value = Math.max(entry.startTime - getActivationStart(), 0); - metric.entries.push(entry); - report(true); - } - } - }); - }, "handleEntries"); - const po2 = observe("paint", handleEntries); - if (po2) { - report = bindReporter(onReport, metric, FCPThresholds, opts.reportAllChanges); - } - }); -}, "onFCP"); -const CLSThresholds = [0.1, 0.25]; -const onCLS = /* @__PURE__ */ __name((onReport, opts = {}) => { - onFCP( - runOnce(() => { - const metric = initMetric("CLS", 0); - let report; - let sessionValue = 0; - let sessionEntries = []; - const handleEntries = /* @__PURE__ */ __name((entries) => { - entries.forEach((entry) => { - if (!entry.hadRecentInput) { - const firstSessionEntry = sessionEntries[0]; - const lastSessionEntry = sessionEntries[sessionEntries.length - 1]; - if (sessionValue && firstSessionEntry && lastSessionEntry && entry.startTime - lastSessionEntry.startTime < 1e3 && entry.startTime - firstSessionEntry.startTime < 5e3) { - sessionValue += entry.value; - sessionEntries.push(entry); - } else { - sessionValue = entry.value; - sessionEntries = [entry]; - } - } - }); - if (sessionValue > metric.value) { - metric.value = sessionValue; - metric.entries = sessionEntries; - report(); - } - }, "handleEntries"); - const po2 = observe("layout-shift", handleEntries); - if (po2) { - report = bindReporter(onReport, metric, CLSThresholds, opts.reportAllChanges); - onHidden(() => { - handleEntries(po2.takeRecords()); - report(true); - }); - setTimeout(report, 0); - } - }) - ); -}, "onCLS"); -const FIDThresholds = [100, 300]; -const onFID = /* @__PURE__ */ __name((onReport, opts = {}) => { - whenActivated(() => { - const visibilityWatcher = getVisibilityWatcher(); - const metric = initMetric("FID"); - let report; - const handleEntry = /* @__PURE__ */ __name((entry) => { - if (entry.startTime < visibilityWatcher.firstHiddenTime) { - metric.value = entry.processingStart - entry.startTime; - metric.entries.push(entry); - report(true); - } - }, "handleEntry"); - const handleEntries = /* @__PURE__ */ __name((entries) => { - entries.forEach(handleEntry); - }, "handleEntries"); - const po2 = observe("first-input", handleEntries); - report = bindReporter(onReport, metric, FIDThresholds, opts.reportAllChanges); - if (po2) { - onHidden( - runOnce(() => { - handleEntries(po2.takeRecords()); - po2.disconnect(); - }) - ); - } - }); -}, "onFID"); -let interactionCountEstimate = 0; -let minKnownInteractionId = Infinity; -let maxKnownInteractionId = 0; -const updateEstimate = /* @__PURE__ */ __name((entries) => { - entries.forEach((e2) => { - if (e2.interactionId) { - minKnownInteractionId = Math.min(minKnownInteractionId, e2.interactionId); - maxKnownInteractionId = Math.max(maxKnownInteractionId, e2.interactionId); - interactionCountEstimate = maxKnownInteractionId ? (maxKnownInteractionId - minKnownInteractionId) / 7 + 1 : 0; - } - }); -}, "updateEstimate"); -let po; -const getInteractionCount = /* @__PURE__ */ __name(() => { - return po ? interactionCountEstimate : performance.interactionCount || 0; -}, "getInteractionCount"); -const initInteractionCountPolyfill = /* @__PURE__ */ __name(() => { - if ("interactionCount" in performance || po) return; - po = observe("event", updateEstimate, { - type: "event", - buffered: true, - durationThreshold: 0 - }); -}, "initInteractionCountPolyfill"); -const longestInteractionList = []; -const longestInteractionMap = /* @__PURE__ */ new Map(); -const DEFAULT_DURATION_THRESHOLD = 40; -let prevInteractionCount = 0; -const getInteractionCountForNavigation = /* @__PURE__ */ __name(() => { - return getInteractionCount() - prevInteractionCount; -}, "getInteractionCountForNavigation"); -const estimateP98LongestInteraction = /* @__PURE__ */ __name(() => { - const candidateInteractionIndex = Math.min( - longestInteractionList.length - 1, - Math.floor(getInteractionCountForNavigation() / 50) - ); - return longestInteractionList[candidateInteractionIndex]; -}, "estimateP98LongestInteraction"); -const MAX_INTERACTIONS_TO_CONSIDER = 10; -const entryPreProcessingCallbacks = []; -const processInteractionEntry = /* @__PURE__ */ __name((entry) => { - entryPreProcessingCallbacks.forEach((cb) => cb(entry)); - if (!(entry.interactionId || entry.entryType === "first-input")) return; - const minLongestInteraction = longestInteractionList[longestInteractionList.length - 1]; - const existingInteraction = longestInteractionMap.get(entry.interactionId); - if (existingInteraction || longestInteractionList.length < MAX_INTERACTIONS_TO_CONSIDER || minLongestInteraction && entry.duration > minLongestInteraction.latency) { - if (existingInteraction) { - if (entry.duration > existingInteraction.latency) { - existingInteraction.entries = [entry]; - existingInteraction.latency = entry.duration; - } else if (entry.duration === existingInteraction.latency && entry.startTime === (existingInteraction.entries[0] && existingInteraction.entries[0].startTime)) { - existingInteraction.entries.push(entry); - } - } else { - const interaction = { - id: entry.interactionId, - latency: entry.duration, - entries: [entry] - }; - longestInteractionMap.set(interaction.id, interaction); - longestInteractionList.push(interaction); - } - longestInteractionList.sort((a2, b2) => b2.latency - a2.latency); - if (longestInteractionList.length > MAX_INTERACTIONS_TO_CONSIDER) { - longestInteractionList.splice(MAX_INTERACTIONS_TO_CONSIDER).forEach((i2) => longestInteractionMap.delete(i2.id)); - } - } -}, "processInteractionEntry"); -const whenIdle = /* @__PURE__ */ __name((cb) => { - const rIC = WINDOW$4.requestIdleCallback || WINDOW$4.setTimeout; - let handle = -1; - cb = runOnce(cb); - if (WINDOW$4.document && WINDOW$4.document.visibilityState === "hidden") { - cb(); - } else { - handle = rIC(cb); - onHidden(cb); - } - return handle; -}, "whenIdle"); -const INPThresholds = [200, 500]; -const onINP = /* @__PURE__ */ __name((onReport, opts = {}) => { - if (!("PerformanceEventTiming" in WINDOW$4 && "interactionId" in PerformanceEventTiming.prototype)) { - return; - } - whenActivated(() => { - initInteractionCountPolyfill(); - const metric = initMetric("INP"); - let report; - const handleEntries = /* @__PURE__ */ __name((entries) => { - whenIdle(() => { - entries.forEach(processInteractionEntry); - const inp = estimateP98LongestInteraction(); - if (inp && inp.latency !== metric.value) { - metric.value = inp.latency; - metric.entries = inp.entries; - report(); - } - }); - }, "handleEntries"); - const po2 = observe("event", handleEntries, { - // Event Timing entries have their durations rounded to the nearest 8ms, - // so a duration of 40ms would be any event that spans 2.5 or more frames - // at 60Hz. This threshold is chosen to strike a balance between usefulness - // and performance. Running this callback for any interaction that spans - // just one or two frames is likely not worth the insight that could be - // gained. - durationThreshold: opts.durationThreshold != null ? opts.durationThreshold : DEFAULT_DURATION_THRESHOLD - }); - report = bindReporter(onReport, metric, INPThresholds, opts.reportAllChanges); - if (po2) { - po2.observe({ type: "first-input", buffered: true }); - onHidden(() => { - handleEntries(po2.takeRecords()); - report(true); - }); - } - }); -}, "onINP"); -const LCPThresholds = [2500, 4e3]; -const reportedMetricIDs = {}; -const onLCP = /* @__PURE__ */ __name((onReport, opts = {}) => { - whenActivated(() => { - const visibilityWatcher = getVisibilityWatcher(); - const metric = initMetric("LCP"); - let report; - const handleEntries = /* @__PURE__ */ __name((entries) => { - if (!opts.reportAllChanges) { - entries = entries.slice(-1); - } - entries.forEach((entry) => { - if (entry.startTime < visibilityWatcher.firstHiddenTime) { - metric.value = Math.max(entry.startTime - getActivationStart(), 0); - metric.entries = [entry]; - report(); - } - }); - }, "handleEntries"); - const po2 = observe("largest-contentful-paint", handleEntries); - if (po2) { - report = bindReporter(onReport, metric, LCPThresholds, opts.reportAllChanges); - const stopListening = runOnce(() => { - if (!reportedMetricIDs[metric.id]) { - handleEntries(po2.takeRecords()); - po2.disconnect(); - reportedMetricIDs[metric.id] = true; - report(true); - } - }); - ["keydown", "click"].forEach((type) => { - if (WINDOW$4.document) { - addEventListener(type, () => whenIdle(stopListening), { - once: true, - capture: true - }); - } - }); - onHidden(stopListening); - } - }); -}, "onLCP"); -const TTFBThresholds = [800, 1800]; -const whenReady = /* @__PURE__ */ __name((callback) => { - if (WINDOW$4.document && WINDOW$4.document.prerendering) { - whenActivated(() => whenReady(callback)); - } else if (WINDOW$4.document && WINDOW$4.document.readyState !== "complete") { - addEventListener("load", () => whenReady(callback), true); - } else { - setTimeout(callback, 0); - } -}, "whenReady"); -const onTTFB = /* @__PURE__ */ __name((onReport, opts = {}) => { - const metric = initMetric("TTFB"); - const report = bindReporter(onReport, metric, TTFBThresholds, opts.reportAllChanges); - whenReady(() => { - const navigationEntry = getNavigationEntry(); - if (navigationEntry) { - metric.value = Math.max(navigationEntry.responseStart - getActivationStart(), 0); - metric.entries = [navigationEntry]; - report(true); - } - }); -}, "onTTFB"); -const handlers$3 = {}; -const instrumented = {}; -let _previousCls; -let _previousFid; -let _previousLcp; -let _previousTtfb; -let _previousInp; -function addClsInstrumentationHandler(callback, stopOnCallback = false) { - return addMetricObserver("cls", callback, instrumentCls, _previousCls, stopOnCallback); -} -__name(addClsInstrumentationHandler, "addClsInstrumentationHandler"); -function addLcpInstrumentationHandler(callback, stopOnCallback = false) { - return addMetricObserver("lcp", callback, instrumentLcp, _previousLcp, stopOnCallback); -} -__name(addLcpInstrumentationHandler, "addLcpInstrumentationHandler"); -function addFidInstrumentationHandler(callback) { - return addMetricObserver("fid", callback, instrumentFid, _previousFid); -} -__name(addFidInstrumentationHandler, "addFidInstrumentationHandler"); -function addTtfbInstrumentationHandler(callback) { - return addMetricObserver("ttfb", callback, instrumentTtfb, _previousTtfb); -} -__name(addTtfbInstrumentationHandler, "addTtfbInstrumentationHandler"); -function addInpInstrumentationHandler(callback) { - return addMetricObserver("inp", callback, instrumentInp, _previousInp); -} -__name(addInpInstrumentationHandler, "addInpInstrumentationHandler"); -function addPerformanceInstrumentationHandler(type, callback) { - addHandler(type, callback); - if (!instrumented[type]) { - instrumentPerformanceObserver(type); - instrumented[type] = true; - } - return getCleanupCallback(type, callback); -} -__name(addPerformanceInstrumentationHandler, "addPerformanceInstrumentationHandler"); -function triggerHandlers(type, data26) { - const typeHandlers = handlers$3[type]; - if (!typeHandlers || !typeHandlers.length) { - return; - } - for (const handler12 of typeHandlers) { - try { - handler12(data26); - } catch (e2) { - DEBUG_BUILD$3 && logger$2.error( - `Error while triggering instrumentation handler. -Type: ${type} -Name: ${getFunctionName(handler12)} -Error:`, - e2 - ); - } - } -} -__name(triggerHandlers, "triggerHandlers"); -function instrumentCls() { - return onCLS( - (metric) => { - triggerHandlers("cls", { - metric - }); - _previousCls = metric; - }, - // We want the callback to be called whenever the CLS value updates. - // By default, the callback is only called when the tab goes to the background. - { reportAllChanges: true } - ); -} -__name(instrumentCls, "instrumentCls"); -function instrumentFid() { - return onFID((metric) => { - triggerHandlers("fid", { - metric - }); - _previousFid = metric; - }); -} -__name(instrumentFid, "instrumentFid"); -function instrumentLcp() { - return onLCP( - (metric) => { - triggerHandlers("lcp", { - metric - }); - _previousLcp = metric; - }, - // We want the callback to be called whenever the LCP value updates. - // By default, the callback is only called when the tab goes to the background. - { reportAllChanges: true } - ); -} -__name(instrumentLcp, "instrumentLcp"); -function instrumentTtfb() { - return onTTFB((metric) => { - triggerHandlers("ttfb", { - metric - }); - _previousTtfb = metric; - }); -} -__name(instrumentTtfb, "instrumentTtfb"); -function instrumentInp() { - return onINP((metric) => { - triggerHandlers("inp", { - metric - }); - _previousInp = metric; - }); -} -__name(instrumentInp, "instrumentInp"); -function addMetricObserver(type, callback, instrumentFn, previousValue, stopOnCallback = false) { - addHandler(type, callback); - let stopListening; - if (!instrumented[type]) { - stopListening = instrumentFn(); - instrumented[type] = true; - } - if (previousValue) { - callback({ metric: previousValue }); - } - return getCleanupCallback(type, callback, stopOnCallback ? stopListening : void 0); -} -__name(addMetricObserver, "addMetricObserver"); -function instrumentPerformanceObserver(type) { - const options4 = {}; - if (type === "event") { - options4.durationThreshold = 0; - } - observe( - type, - (entries) => { - triggerHandlers(type, { entries }); - }, - options4 - ); -} -__name(instrumentPerformanceObserver, "instrumentPerformanceObserver"); -function addHandler(type, handler12) { - handlers$3[type] = handlers$3[type] || []; - handlers$3[type].push(handler12); -} -__name(addHandler, "addHandler"); -function getCleanupCallback(type, callback, stopListening) { - return () => { - if (stopListening) { - stopListening(); - } - const typeHandlers = handlers$3[type]; - if (!typeHandlers) { - return; - } - const index2 = typeHandlers.indexOf(callback); - if (index2 !== -1) { - typeHandlers.splice(index2, 1); - } - }; -} -__name(getCleanupCallback, "getCleanupCallback"); -function isPerformanceEventTiming(entry) { - return "duration" in entry; -} -__name(isPerformanceEventTiming, "isPerformanceEventTiming"); -function isMeasurementValue(value4) { - return typeof value4 === "number" && isFinite(value4); -} -__name(isMeasurementValue, "isMeasurementValue"); -function startAndEndSpan(parentSpan, startTimeInSeconds, endTime, { ...ctx }) { - const parentStartTime = spanToJSON(parentSpan).start_timestamp; - if (parentStartTime && parentStartTime > startTimeInSeconds) { - if (typeof parentSpan.updateStartTime === "function") { - parentSpan.updateStartTime(startTimeInSeconds); - } - } - return withActiveSpan(parentSpan, () => { - const span = startInactiveSpan({ - startTime: startTimeInSeconds, - ...ctx - }); - if (span) { - span.end(endTime); - } - return span; - }); -} -__name(startAndEndSpan, "startAndEndSpan"); -function startStandaloneWebVitalSpan(options4) { - const client = getClient(); - if (!client) { - return; - } - const { name: name2, transaction, attributes: passedAttributes, startTime } = options4; - const { release, environment } = client.getOptions(); - const replay = client.getIntegrationByName("Replay"); - const replayId = replay && replay.getReplayId(); - const scope = getCurrentScope$1(); - const user = scope.getUser(); - const userDisplay = user !== void 0 ? user.email || user.id || user.ip_address : void 0; - let profileId; - try { - profileId = scope.getScopeData().contexts.profile.profile_id; - } catch (e2) { - } - const attributes = { - release, - environment, - user: userDisplay || void 0, - profile_id: profileId || void 0, - replay_id: replayId || void 0, - transaction, - // Web vital score calculation relies on the user agent to account for different - // browsers setting different thresholds for what is considered a good/meh/bad value. - // For example: Chrome vs. Chrome Mobile - "user_agent.original": WINDOW$4.navigator && WINDOW$4.navigator.userAgent, - ...passedAttributes - }; - return startInactiveSpan({ - name: name2, - attributes, - startTime, - experimental: { - standalone: true - } - }); -} -__name(startStandaloneWebVitalSpan, "startStandaloneWebVitalSpan"); -function getBrowserPerformanceAPI() { - return WINDOW$4 && WINDOW$4.addEventListener && WINDOW$4.performance; -} -__name(getBrowserPerformanceAPI, "getBrowserPerformanceAPI"); -function msToSec(time) { - return time / 1e3; -} -__name(msToSec, "msToSec"); -function trackClsAsStandaloneSpan() { - let standaloneCLsValue = 0; - let standaloneClsEntry; - let pageloadSpanId; - if (!supportsLayoutShift()) { - return; - } - let sentSpan = false; - function _collectClsOnce() { - if (sentSpan) { - return; - } - sentSpan = true; - if (pageloadSpanId) { - sendStandaloneClsSpan(standaloneCLsValue, standaloneClsEntry, pageloadSpanId); - } - cleanupClsHandler(); - } - __name(_collectClsOnce, "_collectClsOnce"); - const cleanupClsHandler = addClsInstrumentationHandler(({ metric }) => { - const entry = metric.entries[metric.entries.length - 1]; - if (!entry) { - return; - } - standaloneCLsValue = metric.value; - standaloneClsEntry = entry; - }, true); - onHidden(() => { - _collectClsOnce(); - }); - setTimeout(() => { - const client = getClient(); - if (!client) { - return; - } - const unsubscribeStartNavigation = client.on("startNavigationSpan", () => { - _collectClsOnce(); - unsubscribeStartNavigation && unsubscribeStartNavigation(); - }); - const activeSpan = getActiveSpan(); - const rootSpan = activeSpan && getRootSpan(activeSpan); - const spanJSON = rootSpan && spanToJSON(rootSpan); - if (spanJSON && spanJSON.op === "pageload") { - pageloadSpanId = rootSpan.spanContext().spanId; - } - }, 0); -} -__name(trackClsAsStandaloneSpan, "trackClsAsStandaloneSpan"); -function sendStandaloneClsSpan(clsValue, entry, pageloadSpanId) { - DEBUG_BUILD$3 && logger$2.log(`Sending CLS span (${clsValue})`); - const startTime = msToSec((browserPerformanceTimeOrigin || 0) + (entry && entry.startTime || 0)); - const routeName = getCurrentScope$1().getScopeData().transactionName; - const name2 = entry ? htmlTreeAsString(entry.sources[0] && entry.sources[0].node) : "Layout shift"; - const attributes = dropUndefinedKeys({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.browser.cls", - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: "ui.webvital.cls", - [SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: entry && entry.duration || 0, - // attach the pageload span id to the CLS span so that we can link them in the UI - "sentry.pageload.span_id": pageloadSpanId - }); - const span = startStandaloneWebVitalSpan({ - name: name2, - transaction: routeName, - attributes, - startTime - }); - if (span) { - span.addEvent("cls", { - [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: "", - [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: clsValue - }); - span.end(startTime); - } -} -__name(sendStandaloneClsSpan, "sendStandaloneClsSpan"); -function supportsLayoutShift() { - try { - return PerformanceObserver.supportedEntryTypes.includes("layout-shift"); - } catch (e2) { - return false; - } -} -__name(supportsLayoutShift, "supportsLayoutShift"); -const MAX_INT_AS_BYTES = 2147483647; -let _performanceCursor = 0; -let _measurements = {}; -let _lcpEntry; -let _clsEntry; -function startTrackingWebVitals({ recordClsStandaloneSpans }) { - const performance2 = getBrowserPerformanceAPI(); - if (performance2 && browserPerformanceTimeOrigin) { - if (performance2.mark) { - WINDOW$4.performance.mark("sentry-tracing-init"); - } - const fidCleanupCallback = _trackFID(); - const lcpCleanupCallback = _trackLCP(); - const ttfbCleanupCallback = _trackTtfb(); - const clsCleanupCallback = recordClsStandaloneSpans ? trackClsAsStandaloneSpan() : _trackCLS(); - return () => { - fidCleanupCallback(); - lcpCleanupCallback(); - ttfbCleanupCallback(); - clsCleanupCallback && clsCleanupCallback(); - }; - } - return () => void 0; -} -__name(startTrackingWebVitals, "startTrackingWebVitals"); -function startTrackingLongTasks() { - addPerformanceInstrumentationHandler("longtask", ({ entries }) => { - const parent = getActiveSpan(); - if (!parent) { - return; - } - const { op: parentOp, start_timestamp: parentStartTimestamp } = spanToJSON(parent); - for (const entry of entries) { - const startTime = msToSec(browserPerformanceTimeOrigin + entry.startTime); - const duration = msToSec(entry.duration); - if (parentOp === "navigation" && parentStartTimestamp && startTime < parentStartTimestamp) { - continue; - } - startAndEndSpan(parent, startTime, startTime + duration, { - name: "Main UI thread blocked", - op: "ui.long-task", - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" - } - }); - } - }); -} -__name(startTrackingLongTasks, "startTrackingLongTasks"); -function startTrackingLongAnimationFrames() { - const observer = new PerformanceObserver((list2) => { - const parent = getActiveSpan(); - if (!parent) { - return; - } - for (const entry of list2.getEntries()) { - if (!entry.scripts[0]) { - continue; - } - const startTime = msToSec(browserPerformanceTimeOrigin + entry.startTime); - const { start_timestamp: parentStartTimestamp, op: parentOp } = spanToJSON(parent); - if (parentOp === "navigation" && parentStartTimestamp && startTime < parentStartTimestamp) { - continue; - } - const duration = msToSec(entry.duration); - const attributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" - }; - const initialScript = entry.scripts[0]; - const { invoker, invokerType, sourceURL, sourceFunctionName, sourceCharPosition } = initialScript; - attributes["browser.script.invoker"] = invoker; - attributes["browser.script.invoker_type"] = invokerType; - if (sourceURL) { - attributes["code.filepath"] = sourceURL; - } - if (sourceFunctionName) { - attributes["code.function"] = sourceFunctionName; - } - if (sourceCharPosition !== -1) { - attributes["browser.script.source_char_position"] = sourceCharPosition; - } - startAndEndSpan(parent, startTime, startTime + duration, { - name: "Main UI thread blocked", - op: "ui.long-animation-frame", - attributes - }); - } - }); - observer.observe({ type: "long-animation-frame", buffered: true }); -} -__name(startTrackingLongAnimationFrames, "startTrackingLongAnimationFrames"); -function startTrackingInteractions() { - addPerformanceInstrumentationHandler("event", ({ entries }) => { - const parent = getActiveSpan(); - if (!parent) { - return; - } - for (const entry of entries) { - if (entry.name === "click") { - const startTime = msToSec(browserPerformanceTimeOrigin + entry.startTime); - const duration = msToSec(entry.duration); - const spanOptions = { - name: htmlTreeAsString(entry.target), - op: `ui.interaction.${entry.name}`, - startTime, - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" - } - }; - const componentName = getComponentName$1(entry.target); - if (componentName) { - spanOptions.attributes["ui.component_name"] = componentName; - } - startAndEndSpan(parent, startTime, startTime + duration, spanOptions); - } - } - }); -} -__name(startTrackingInteractions, "startTrackingInteractions"); -function _trackCLS() { - return addClsInstrumentationHandler(({ metric }) => { - const entry = metric.entries[metric.entries.length - 1]; - if (!entry) { - return; - } - _measurements["cls"] = { value: metric.value, unit: "" }; - _clsEntry = entry; - }, true); -} -__name(_trackCLS, "_trackCLS"); -function _trackLCP() { - return addLcpInstrumentationHandler(({ metric }) => { - const entry = metric.entries[metric.entries.length - 1]; - if (!entry) { - return; - } - _measurements["lcp"] = { value: metric.value, unit: "millisecond" }; - _lcpEntry = entry; - }, true); -} -__name(_trackLCP, "_trackLCP"); -function _trackFID() { - return addFidInstrumentationHandler(({ metric }) => { - const entry = metric.entries[metric.entries.length - 1]; - if (!entry) { - return; - } - const timeOrigin = msToSec(browserPerformanceTimeOrigin); - const startTime = msToSec(entry.startTime); - _measurements["fid"] = { value: metric.value, unit: "millisecond" }; - _measurements["mark.fid"] = { value: timeOrigin + startTime, unit: "second" }; - }); -} -__name(_trackFID, "_trackFID"); -function _trackTtfb() { - return addTtfbInstrumentationHandler(({ metric }) => { - const entry = metric.entries[metric.entries.length - 1]; - if (!entry) { - return; - } - _measurements["ttfb"] = { value: metric.value, unit: "millisecond" }; - }); -} -__name(_trackTtfb, "_trackTtfb"); -function addPerformanceEntries(span, options4) { - const performance2 = getBrowserPerformanceAPI(); - if (!performance2 || !performance2.getEntries || !browserPerformanceTimeOrigin) { - return; - } - const timeOrigin = msToSec(browserPerformanceTimeOrigin); - const performanceEntries = performance2.getEntries(); - const { op, start_timestamp: transactionStartTime } = spanToJSON(span); - performanceEntries.slice(_performanceCursor).forEach((entry) => { - const startTime = msToSec(entry.startTime); - const duration = msToSec( - // Inexplicably, Chrome sometimes emits a negative duration. We need to work around this. - // There is a SO post attempting to explain this, but it leaves one with open questions: https://stackoverflow.com/questions/23191918/peformance-getentries-and-negative-duration-display - // The way we clamp the value is probably not accurate, since we have observed this happen for things that may take a while to load, like for example the replay worker. - // TODO: Investigate why this happens and how to properly mitigate. For now, this is a workaround to prevent transactions being dropped due to negative duration spans. - Math.max(0, entry.duration) - ); - if (op === "navigation" && transactionStartTime && timeOrigin + startTime < transactionStartTime) { - return; - } - switch (entry.entryType) { - case "navigation": { - _addNavigationSpans(span, entry, timeOrigin); - break; - } - case "mark": - case "paint": - case "measure": { - _addMeasureSpans(span, entry, startTime, duration, timeOrigin); - const firstHidden = getVisibilityWatcher(); - const shouldRecord = entry.startTime < firstHidden.firstHiddenTime; - if (entry.name === "first-paint" && shouldRecord) { - _measurements["fp"] = { value: entry.startTime, unit: "millisecond" }; - } - if (entry.name === "first-contentful-paint" && shouldRecord) { - _measurements["fcp"] = { value: entry.startTime, unit: "millisecond" }; - } - break; - } - case "resource": { - _addResourceSpans(span, entry, entry.name, startTime, duration, timeOrigin); - break; - } - } - }); - _performanceCursor = Math.max(performanceEntries.length - 1, 0); - _trackNavigator(span); - if (op === "pageload") { - _addTtfbRequestTimeToMeasurements(_measurements); - const fidMark = _measurements["mark.fid"]; - if (fidMark && _measurements["fid"]) { - startAndEndSpan(span, fidMark.value, fidMark.value + msToSec(_measurements["fid"].value), { - name: "first input delay", - op: "ui.action", - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" - } - }); - delete _measurements["mark.fid"]; - } - if (!("fcp" in _measurements) || !options4.recordClsOnPageloadSpan) { - delete _measurements.cls; - } - Object.entries(_measurements).forEach(([measurementName, measurement]) => { - setMeasurement(measurementName, measurement.value, measurement.unit); - }); - span.setAttribute("performance.timeOrigin", timeOrigin); - span.setAttribute("performance.activationStart", getActivationStart()); - _setWebVitalAttributes(span); - } - _lcpEntry = void 0; - _clsEntry = void 0; - _measurements = {}; -} -__name(addPerformanceEntries, "addPerformanceEntries"); -function _addMeasureSpans(span, entry, startTime, duration, timeOrigin) { - const navEntry = getNavigationEntry(false); - const requestTime = msToSec(navEntry ? navEntry.requestStart : 0); - const measureStartTimestamp = timeOrigin + Math.max(startTime, requestTime); - const startTimeStamp = timeOrigin + startTime; - const measureEndTimestamp = startTimeStamp + duration; - const attributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.resource.browser.metrics" - }; - if (measureStartTimestamp !== startTimeStamp) { - attributes["sentry.browser.measure_happened_before_request"] = true; - attributes["sentry.browser.measure_start_time"] = measureStartTimestamp; - } - startAndEndSpan(span, measureStartTimestamp, measureEndTimestamp, { - name: entry.name, - op: entry.entryType, - attributes - }); - return measureStartTimestamp; -} -__name(_addMeasureSpans, "_addMeasureSpans"); -function _addNavigationSpans(span, entry, timeOrigin) { - ["unloadEvent", "redirect", "domContentLoadedEvent", "loadEvent", "connect"].forEach((event) => { - _addPerformanceNavigationTiming(span, entry, event, timeOrigin); - }); - _addPerformanceNavigationTiming(span, entry, "secureConnection", timeOrigin, "TLS/SSL"); - _addPerformanceNavigationTiming(span, entry, "fetch", timeOrigin, "cache"); - _addPerformanceNavigationTiming(span, entry, "domainLookup", timeOrigin, "DNS"); - _addRequest(span, entry, timeOrigin); -} -__name(_addNavigationSpans, "_addNavigationSpans"); -function _addPerformanceNavigationTiming(span, entry, event, timeOrigin, name2 = event) { - const eventEnd = _getEndPropertyNameForNavigationTiming(event); - const end = entry[eventEnd]; - const start2 = entry[`${event}Start`]; - if (!start2 || !end) { - return; - } - startAndEndSpan(span, timeOrigin + msToSec(start2), timeOrigin + msToSec(end), { - op: `browser.${name2}`, - name: entry.name, - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" - } - }); -} -__name(_addPerformanceNavigationTiming, "_addPerformanceNavigationTiming"); -function _getEndPropertyNameForNavigationTiming(event) { - if (event === "secureConnection") { - return "connectEnd"; - } - if (event === "fetch") { - return "domainLookupStart"; - } - return `${event}End`; -} -__name(_getEndPropertyNameForNavigationTiming, "_getEndPropertyNameForNavigationTiming"); -function _addRequest(span, entry, timeOrigin) { - const requestStartTimestamp = timeOrigin + msToSec(entry.requestStart); - const responseEndTimestamp = timeOrigin + msToSec(entry.responseEnd); - const responseStartTimestamp = timeOrigin + msToSec(entry.responseStart); - if (entry.responseEnd) { - startAndEndSpan(span, requestStartTimestamp, responseEndTimestamp, { - op: "browser.request", - name: entry.name, - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" - } - }); - startAndEndSpan(span, responseStartTimestamp, responseEndTimestamp, { - op: "browser.response", - name: entry.name, - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.browser.metrics" - } - }); - } -} -__name(_addRequest, "_addRequest"); -function _addResourceSpans(span, entry, resourceUrl, startTime, duration, timeOrigin) { - if (entry.initiatorType === "xmlhttprequest" || entry.initiatorType === "fetch") { - return; - } - const parsedUrl = parseUrl$1(resourceUrl); - const attributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.resource.browser.metrics" - }; - setResourceEntrySizeData(attributes, entry, "transferSize", "http.response_transfer_size"); - setResourceEntrySizeData(attributes, entry, "encodedBodySize", "http.response_content_length"); - setResourceEntrySizeData(attributes, entry, "decodedBodySize", "http.decoded_response_content_length"); - const deliveryType = entry.deliveryType; - if (deliveryType != null) { - attributes["http.response_delivery_type"] = deliveryType; - } - const renderBlockingStatus = entry.renderBlockingStatus; - if (renderBlockingStatus) { - attributes["resource.render_blocking_status"] = renderBlockingStatus; - } - if (parsedUrl.protocol) { - attributes["url.scheme"] = parsedUrl.protocol.split(":").pop(); - } - if (parsedUrl.host) { - attributes["server.address"] = parsedUrl.host; - } - attributes["url.same_origin"] = resourceUrl.includes(WINDOW$4.location.origin); - const startTimestamp = timeOrigin + startTime; - const endTimestamp = startTimestamp + duration; - startAndEndSpan(span, startTimestamp, endTimestamp, { - name: resourceUrl.replace(WINDOW$4.location.origin, ""), - op: entry.initiatorType ? `resource.${entry.initiatorType}` : "resource.other", - attributes - }); -} -__name(_addResourceSpans, "_addResourceSpans"); -function _trackNavigator(span) { - const navigator2 = WINDOW$4.navigator; - if (!navigator2) { - return; - } - const connection = navigator2.connection; - if (connection) { - if (connection.effectiveType) { - span.setAttribute("effectiveConnectionType", connection.effectiveType); - } - if (connection.type) { - span.setAttribute("connectionType", connection.type); - } - if (isMeasurementValue(connection.rtt)) { - _measurements["connection.rtt"] = { value: connection.rtt, unit: "millisecond" }; - } - } - if (isMeasurementValue(navigator2.deviceMemory)) { - span.setAttribute("deviceMemory", `${navigator2.deviceMemory} GB`); - } - if (isMeasurementValue(navigator2.hardwareConcurrency)) { - span.setAttribute("hardwareConcurrency", String(navigator2.hardwareConcurrency)); - } -} -__name(_trackNavigator, "_trackNavigator"); -function _setWebVitalAttributes(span) { - if (_lcpEntry) { - if (_lcpEntry.element) { - span.setAttribute("lcp.element", htmlTreeAsString(_lcpEntry.element)); - } - if (_lcpEntry.id) { - span.setAttribute("lcp.id", _lcpEntry.id); - } - if (_lcpEntry.url) { - span.setAttribute("lcp.url", _lcpEntry.url.trim().slice(0, 200)); - } - if (_lcpEntry.loadTime != null) { - span.setAttribute("lcp.loadTime", _lcpEntry.loadTime); - } - if (_lcpEntry.renderTime != null) { - span.setAttribute("lcp.renderTime", _lcpEntry.renderTime); - } - span.setAttribute("lcp.size", _lcpEntry.size); - } - if (_clsEntry && _clsEntry.sources) { - _clsEntry.sources.forEach( - (source, index2) => span.setAttribute(`cls.source.${index2 + 1}`, htmlTreeAsString(source.node)) - ); - } -} -__name(_setWebVitalAttributes, "_setWebVitalAttributes"); -function setResourceEntrySizeData(attributes, entry, key, dataKey) { - const entryVal = entry[key]; - if (entryVal != null && entryVal < MAX_INT_AS_BYTES) { - attributes[dataKey] = entryVal; - } -} -__name(setResourceEntrySizeData, "setResourceEntrySizeData"); -function _addTtfbRequestTimeToMeasurements(_measurements2) { - const navEntry = getNavigationEntry(false); - if (!navEntry) { - return; - } - const { responseStart, requestStart } = navEntry; - if (requestStart <= responseStart) { - _measurements2["ttfb.requestTime"] = { - value: responseStart - requestStart, - unit: "millisecond" - }; - } -} -__name(_addTtfbRequestTimeToMeasurements, "_addTtfbRequestTimeToMeasurements"); -const DEBOUNCE_DURATION = 1e3; -let debounceTimerID; -let lastCapturedEventType; -let lastCapturedEventTargetId; -function addClickKeypressInstrumentationHandler(handler12) { - const type = "dom"; - addHandler$1(type, handler12); - maybeInstrument(type, instrumentDOM); -} -__name(addClickKeypressInstrumentationHandler, "addClickKeypressInstrumentationHandler"); -function instrumentDOM() { - if (!WINDOW$4.document) { - return; - } - const triggerDOMHandler = triggerHandlers$1.bind(null, "dom"); - const globalDOMEventHandler = makeDOMEventHandler(triggerDOMHandler, true); - WINDOW$4.document.addEventListener("click", globalDOMEventHandler, false); - WINDOW$4.document.addEventListener("keypress", globalDOMEventHandler, false); - ["EventTarget", "Node"].forEach((target2) => { - const globalObject = WINDOW$4; - const targetObj = globalObject[target2]; - const proto = targetObj && targetObj.prototype; - if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty("addEventListener")) { - return; - } - fill(proto, "addEventListener", function(originalAddEventListener) { - return function(type, listener, options4) { - if (type === "click" || type == "keypress") { - try { - const handlers2 = this.__sentry_instrumentation_handlers__ = this.__sentry_instrumentation_handlers__ || {}; - const handlerForType = handlers2[type] = handlers2[type] || { refCount: 0 }; - if (!handlerForType.handler) { - const handler12 = makeDOMEventHandler(triggerDOMHandler); - handlerForType.handler = handler12; - originalAddEventListener.call(this, type, handler12, options4); - } - handlerForType.refCount++; - } catch (e2) { - } - } - return originalAddEventListener.call(this, type, listener, options4); - }; - }); - fill( - proto, - "removeEventListener", - function(originalRemoveEventListener) { - return function(type, listener, options4) { - if (type === "click" || type == "keypress") { - try { - const handlers2 = this.__sentry_instrumentation_handlers__ || {}; - const handlerForType = handlers2[type]; - if (handlerForType) { - handlerForType.refCount--; - if (handlerForType.refCount <= 0) { - originalRemoveEventListener.call(this, type, handlerForType.handler, options4); - handlerForType.handler = void 0; - delete handlers2[type]; - } - if (Object.keys(handlers2).length === 0) { - delete this.__sentry_instrumentation_handlers__; - } - } - } catch (e2) { - } - } - return originalRemoveEventListener.call(this, type, listener, options4); - }; - } - ); - }); -} -__name(instrumentDOM, "instrumentDOM"); -function isSimilarToLastCapturedEvent(event) { - if (event.type !== lastCapturedEventType) { - return false; - } - try { - if (!event.target || event.target._sentryId !== lastCapturedEventTargetId) { - return false; - } - } catch (e2) { - } - return true; -} -__name(isSimilarToLastCapturedEvent, "isSimilarToLastCapturedEvent"); -function shouldSkipDOMEvent(eventType, target2) { - if (eventType !== "keypress") { - return false; - } - if (!target2 || !target2.tagName) { - return true; - } - if (target2.tagName === "INPUT" || target2.tagName === "TEXTAREA" || target2.isContentEditable) { - return false; - } - return true; -} -__name(shouldSkipDOMEvent, "shouldSkipDOMEvent"); -function makeDOMEventHandler(handler12, globalListener = false) { - return (event) => { - if (!event || event["_sentryCaptured"]) { - return; - } - const target2 = getEventTarget$1(event); - if (shouldSkipDOMEvent(event.type, target2)) { - return; - } - addNonEnumerableProperty(event, "_sentryCaptured", true); - if (target2 && !target2._sentryId) { - addNonEnumerableProperty(target2, "_sentryId", uuid4()); - } - const name2 = event.type === "keypress" ? "input" : event.type; - if (!isSimilarToLastCapturedEvent(event)) { - const handlerData = { event, name: name2, global: globalListener }; - handler12(handlerData); - lastCapturedEventType = event.type; - lastCapturedEventTargetId = target2 ? target2._sentryId : void 0; - } - clearTimeout(debounceTimerID); - debounceTimerID = WINDOW$4.setTimeout(() => { - lastCapturedEventTargetId = void 0; - lastCapturedEventType = void 0; - }, DEBOUNCE_DURATION); - }; -} -__name(makeDOMEventHandler, "makeDOMEventHandler"); -function getEventTarget$1(event) { - try { - return event.target; - } catch (e2) { - return null; - } -} -__name(getEventTarget$1, "getEventTarget$1"); -let lastHref; -function addHistoryInstrumentationHandler(handler12) { - const type = "history"; - addHandler$1(type, handler12); - maybeInstrument(type, instrumentHistory); -} -__name(addHistoryInstrumentationHandler, "addHistoryInstrumentationHandler"); -function instrumentHistory() { - if (!supportsHistory()) { - return; - } - const oldOnPopState = WINDOW$4.onpopstate; - WINDOW$4.onpopstate = function(...args) { - const to = WINDOW$4.location.href; - const from2 = lastHref; - lastHref = to; - const handlerData = { from: from2, to }; - triggerHandlers$1("history", handlerData); - if (oldOnPopState) { - try { - return oldOnPopState.apply(this, args); - } catch (_oO) { - } - } - }; - function historyReplacementFunction(originalHistoryFunction) { - return function(...args) { - const url = args.length > 2 ? args[2] : void 0; - if (url) { - const from2 = lastHref; - const to = String(url); - lastHref = to; - const handlerData = { from: from2, to }; - triggerHandlers$1("history", handlerData); - } - return originalHistoryFunction.apply(this, args); - }; - } - __name(historyReplacementFunction, "historyReplacementFunction"); - fill(WINDOW$4.history, "pushState", historyReplacementFunction); - fill(WINDOW$4.history, "replaceState", historyReplacementFunction); -} -__name(instrumentHistory, "instrumentHistory"); -const cachedImplementations$3 = {}; -function getNativeImplementation(name2) { - const cached = cachedImplementations$3[name2]; - if (cached) { - return cached; - } - let impl = WINDOW$4[name2]; - if (isNativeFunction(impl)) { - return cachedImplementations$3[name2] = impl.bind(WINDOW$4); - } - const document2 = WINDOW$4.document; - if (document2 && typeof document2.createElement === "function") { - try { - const sandbox = document2.createElement("iframe"); - sandbox.hidden = true; - document2.head.appendChild(sandbox); - const contentWindow = sandbox.contentWindow; - if (contentWindow && contentWindow[name2]) { - impl = contentWindow[name2]; - } - document2.head.removeChild(sandbox); - } catch (e2) { - DEBUG_BUILD$3 && logger$2.warn(`Could not create sandbox iframe for ${name2} check, bailing to window.${name2}: `, e2); - } - } - if (!impl) { - return impl; - } - return cachedImplementations$3[name2] = impl.bind(WINDOW$4); -} -__name(getNativeImplementation, "getNativeImplementation"); -function clearCachedImplementation(name2) { - cachedImplementations$3[name2] = void 0; -} -__name(clearCachedImplementation, "clearCachedImplementation"); -function fetch$1(...rest) { - return getNativeImplementation("fetch")(...rest); -} -__name(fetch$1, "fetch$1"); -function setTimeout$3(...rest) { - return getNativeImplementation("setTimeout")(...rest); -} -__name(setTimeout$3, "setTimeout$3"); -const SENTRY_XHR_DATA_KEY = "__sentry_xhr_v3__"; -function addXhrInstrumentationHandler(handler12) { - const type = "xhr"; - addHandler$1(type, handler12); - maybeInstrument(type, instrumentXHR); -} -__name(addXhrInstrumentationHandler, "addXhrInstrumentationHandler"); -function instrumentXHR() { - if (!WINDOW$4.XMLHttpRequest) { - return; - } - const xhrproto = XMLHttpRequest.prototype; - xhrproto.open = new Proxy(xhrproto.open, { - apply(originalOpen, xhrOpenThisArg, xhrOpenArgArray) { - const virtualError = new Error(); - const startTimestamp = timestampInSeconds() * 1e3; - const method = isString$a(xhrOpenArgArray[0]) ? xhrOpenArgArray[0].toUpperCase() : void 0; - const url = parseUrl(xhrOpenArgArray[1]); - if (!method || !url) { - return originalOpen.apply(xhrOpenThisArg, xhrOpenArgArray); - } - xhrOpenThisArg[SENTRY_XHR_DATA_KEY] = { - method, - url, - request_headers: {} - }; - if (method === "POST" && url.match(/sentry_key/)) { - xhrOpenThisArg.__sentry_own_request__ = true; - } - const onreadystatechangeHandler = /* @__PURE__ */ __name(() => { - const xhrInfo = xhrOpenThisArg[SENTRY_XHR_DATA_KEY]; - if (!xhrInfo) { - return; - } - if (xhrOpenThisArg.readyState === 4) { - try { - xhrInfo.status_code = xhrOpenThisArg.status; - } catch (e2) { - } - const handlerData = { - endTimestamp: timestampInSeconds() * 1e3, - startTimestamp, - xhr: xhrOpenThisArg, - virtualError - }; - triggerHandlers$1("xhr", handlerData); - } - }, "onreadystatechangeHandler"); - if ("onreadystatechange" in xhrOpenThisArg && typeof xhrOpenThisArg.onreadystatechange === "function") { - xhrOpenThisArg.onreadystatechange = new Proxy(xhrOpenThisArg.onreadystatechange, { - apply(originalOnreadystatechange, onreadystatechangeThisArg, onreadystatechangeArgArray) { - onreadystatechangeHandler(); - return originalOnreadystatechange.apply(onreadystatechangeThisArg, onreadystatechangeArgArray); - } - }); - } else { - xhrOpenThisArg.addEventListener("readystatechange", onreadystatechangeHandler); - } - xhrOpenThisArg.setRequestHeader = new Proxy(xhrOpenThisArg.setRequestHeader, { - apply(originalSetRequestHeader, setRequestHeaderThisArg, setRequestHeaderArgArray) { - const [header3, value4] = setRequestHeaderArgArray; - const xhrInfo = setRequestHeaderThisArg[SENTRY_XHR_DATA_KEY]; - if (xhrInfo && isString$a(header3) && isString$a(value4)) { - xhrInfo.request_headers[header3.toLowerCase()] = value4; - } - return originalSetRequestHeader.apply(setRequestHeaderThisArg, setRequestHeaderArgArray); - } - }); - return originalOpen.apply(xhrOpenThisArg, xhrOpenArgArray); - } - }); - xhrproto.send = new Proxy(xhrproto.send, { - apply(originalSend, sendThisArg, sendArgArray) { - const sentryXhrData = sendThisArg[SENTRY_XHR_DATA_KEY]; - if (!sentryXhrData) { - return originalSend.apply(sendThisArg, sendArgArray); - } - if (sendArgArray[0] !== void 0) { - sentryXhrData.body = sendArgArray[0]; - } - const handlerData = { - startTimestamp: timestampInSeconds() * 1e3, - xhr: sendThisArg - }; - triggerHandlers$1("xhr", handlerData); - return originalSend.apply(sendThisArg, sendArgArray); - } - }); -} -__name(instrumentXHR, "instrumentXHR"); -function parseUrl(url) { - if (isString$a(url)) { - return url; - } - try { - return url.toString(); - } catch (e2) { - } - return void 0; -} -__name(parseUrl, "parseUrl"); -const LAST_INTERACTIONS = []; -const INTERACTIONS_SPAN_MAP = /* @__PURE__ */ new Map(); -function startTrackingINP() { - const performance2 = getBrowserPerformanceAPI(); - if (performance2 && browserPerformanceTimeOrigin) { - const inpCallback = _trackINP(); - return () => { - inpCallback(); - }; - } - return () => void 0; -} -__name(startTrackingINP, "startTrackingINP"); -const INP_ENTRY_MAP = { - click: "click", - pointerdown: "click", - pointerup: "click", - mousedown: "click", - mouseup: "click", - touchstart: "click", - touchend: "click", - mouseover: "hover", - mouseout: "hover", - mouseenter: "hover", - mouseleave: "hover", - pointerover: "hover", - pointerout: "hover", - pointerenter: "hover", - pointerleave: "hover", - dragstart: "drag", - dragend: "drag", - drag: "drag", - dragenter: "drag", - dragleave: "drag", - dragover: "drag", - drop: "drag", - keydown: "press", - keyup: "press", - keypress: "press", - input: "press" -}; -function _trackINP() { - return addInpInstrumentationHandler(({ metric }) => { - if (metric.value == void 0) { - return; - } - const entry = metric.entries.find((entry2) => entry2.duration === metric.value && INP_ENTRY_MAP[entry2.name]); - if (!entry) { - return; - } - const { interactionId } = entry; - const interactionType = INP_ENTRY_MAP[entry.name]; - const startTime = msToSec(browserPerformanceTimeOrigin + entry.startTime); - const duration = msToSec(metric.value); - const activeSpan = getActiveSpan(); - const rootSpan = activeSpan ? getRootSpan(activeSpan) : void 0; - const cachedSpan = interactionId != null ? INTERACTIONS_SPAN_MAP.get(interactionId) : void 0; - const spanToUse = cachedSpan || rootSpan; - const routeName = spanToUse ? spanToJSON(spanToUse).description : getCurrentScope$1().getScopeData().transactionName; - const name2 = htmlTreeAsString(entry.target); - const attributes = dropUndefinedKeys({ - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.browser.inp", - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: `ui.interaction.${interactionType}`, - [SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME]: entry.duration - }); - const span = startStandaloneWebVitalSpan({ - name: name2, - transaction: routeName, - attributes, - startTime - }); - if (span) { - span.addEvent("inp", { - [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT]: "millisecond", - [SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE]: metric.value - }); - span.end(startTime + duration); - } - }); -} -__name(_trackINP, "_trackINP"); -function registerInpInteractionListener(_latestRoute) { - const handleEntries = /* @__PURE__ */ __name(({ entries }) => { - const activeSpan = getActiveSpan(); - const activeRootSpan = activeSpan && getRootSpan(activeSpan); - entries.forEach((entry) => { - if (!isPerformanceEventTiming(entry) || !activeRootSpan) { - return; - } - const interactionId = entry.interactionId; - if (interactionId == null) { - return; - } - if (INTERACTIONS_SPAN_MAP.has(interactionId)) { - return; - } - if (LAST_INTERACTIONS.length > 10) { - const last = LAST_INTERACTIONS.shift(); - INTERACTIONS_SPAN_MAP.delete(last); - } - LAST_INTERACTIONS.push(interactionId); - INTERACTIONS_SPAN_MAP.set(interactionId, activeRootSpan); - }); - }, "handleEntries"); - addPerformanceInstrumentationHandler("event", handleEntries); - addPerformanceInstrumentationHandler("first-input", handleEntries); -} -__name(registerInpInteractionListener, "registerInpInteractionListener"); -function makeFetchTransport(options4, nativeFetch = getNativeImplementation("fetch")) { - let pendingBodySize = 0; - let pendingCount = 0; - function makeRequest(request) { - const requestSize = request.body.length; - pendingBodySize += requestSize; - pendingCount++; - const requestOptions = { - body: request.body, - method: "POST", - referrerPolicy: "origin", - headers: options4.headers, - // Outgoing requests are usually cancelled when navigating to a different page, causing a "TypeError: Failed to - // fetch" error and sending a "network_error" client-outcome - in Chrome, the request status shows "(cancelled)". - // The `keepalive` flag keeps outgoing requests alive, even when switching pages. We want this since we're - // frequently sending events right before the user is switching pages (eg. when finishing navigation transactions). - // Gotchas: - // - `keepalive` isn't supported by Firefox - // - As per spec (https://fetch.spec.whatwg.org/#http-network-or-cache-fetch): - // If the sum of contentLength and inflightKeepaliveBytes is greater than 64 kibibytes, then return a network error. - // We will therefore only activate the flag when we're below that limit. - // There is also a limit of requests that can be open at the same time, so we also limit this to 15 - // See https://github.com/getsentry/sentry-javascript/pull/7553 for details - keepalive: pendingBodySize <= 6e4 && pendingCount < 15, - ...options4.fetchOptions - }; - if (!nativeFetch) { - clearCachedImplementation("fetch"); - return rejectedSyncPromise("No fetch implementation available"); - } - try { - return nativeFetch(options4.url, requestOptions).then((response) => { - pendingBodySize -= requestSize; - pendingCount--; - return { - statusCode: response.status, - headers: { - "x-sentry-rate-limits": response.headers.get("X-Sentry-Rate-Limits"), - "retry-after": response.headers.get("Retry-After") - } - }; - }); - } catch (e2) { - clearCachedImplementation("fetch"); - pendingBodySize -= requestSize; - pendingCount--; - return rejectedSyncPromise(e2); - } - } - __name(makeRequest, "makeRequest"); - return createTransport(options4, makeRequest); -} -__name(makeFetchTransport, "makeFetchTransport"); -const OPERA10_PRIORITY = 10; -const OPERA11_PRIORITY = 20; -const CHROME_PRIORITY = 30; -const WINJS_PRIORITY = 40; -const GECKO_PRIORITY = 50; -function createFrame(filename, func, lineno, colno) { - const frame = { - filename, - function: func === "" ? UNKNOWN_FUNCTION : func, - in_app: true - // All browser frames are considered in_app - }; - if (lineno !== void 0) { - frame.lineno = lineno; - } - if (colno !== void 0) { - frame.colno = colno; - } - return frame; -} -__name(createFrame, "createFrame"); -const chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i; -const chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i; -const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/; -const chromeStackParserFn = /* @__PURE__ */ __name((line) => { - const noFnParts = chromeRegexNoFnName.exec(line); - if (noFnParts) { - const [, filename, line2, col] = noFnParts; - return createFrame(filename, UNKNOWN_FUNCTION, +line2, +col); - } - const parts2 = chromeRegex.exec(line); - if (parts2) { - const isEval = parts2[2] && parts2[2].indexOf("eval") === 0; - if (isEval) { - const subMatch = chromeEvalRegex.exec(parts2[2]); - if (subMatch) { - parts2[2] = subMatch[1]; - parts2[3] = subMatch[2]; - parts2[4] = subMatch[3]; - } - } - const [func, filename] = extractSafariExtensionDetails(parts2[1] || UNKNOWN_FUNCTION, parts2[2]); - return createFrame(filename, func, parts2[3] ? +parts2[3] : void 0, parts2[4] ? +parts2[4] : void 0); - } - return; -}, "chromeStackParserFn"); -const chromeStackLineParser = [CHROME_PRIORITY, chromeStackParserFn]; -const geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i; -const geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i; -const gecko$1 = /* @__PURE__ */ __name((line) => { - const parts2 = geckoREgex.exec(line); - if (parts2) { - const isEval = parts2[3] && parts2[3].indexOf(" > eval") > -1; - if (isEval) { - const subMatch = geckoEvalRegex.exec(parts2[3]); - if (subMatch) { - parts2[1] = parts2[1] || "eval"; - parts2[3] = subMatch[1]; - parts2[4] = subMatch[2]; - parts2[5] = ""; - } - } - let filename = parts2[3]; - let func = parts2[1] || UNKNOWN_FUNCTION; - [func, filename] = extractSafariExtensionDetails(func, filename); - return createFrame(filename, func, parts2[4] ? +parts2[4] : void 0, parts2[5] ? +parts2[5] : void 0); - } - return; -}, "gecko$1"); -const geckoStackLineParser = [GECKO_PRIORITY, gecko$1]; -const winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i; -const winjs = /* @__PURE__ */ __name((line) => { - const parts2 = winjsRegex.exec(line); - return parts2 ? createFrame(parts2[2], parts2[1] || UNKNOWN_FUNCTION, +parts2[3], parts2[4] ? +parts2[4] : void 0) : void 0; -}, "winjs"); -const winjsStackLineParser = [WINJS_PRIORITY, winjs]; -const opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i; -const opera10 = /* @__PURE__ */ __name((line) => { - const parts2 = opera10Regex.exec(line); - return parts2 ? createFrame(parts2[2], parts2[3] || UNKNOWN_FUNCTION, +parts2[1]) : void 0; -}, "opera10"); -const opera10StackLineParser = [OPERA10_PRIORITY, opera10]; -const opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:]+)>|([^)]+))\(.*\))? in (.*):\s*$/i; -const opera11 = /* @__PURE__ */ __name((line) => { - const parts2 = opera11Regex.exec(line); - return parts2 ? createFrame(parts2[5], parts2[3] || parts2[4] || UNKNOWN_FUNCTION, +parts2[1], +parts2[2]) : void 0; -}, "opera11"); -const opera11StackLineParser = [OPERA11_PRIORITY, opera11]; -const defaultStackLineParsers = [chromeStackLineParser, geckoStackLineParser]; -const defaultStackParser = createStackParser(...defaultStackLineParsers); -const extractSafariExtensionDetails = /* @__PURE__ */ __name((func, filename) => { - const isSafariExtension = func.indexOf("safari-extension") !== -1; - const isSafariWebExtension = func.indexOf("safari-web-extension") !== -1; - return isSafariExtension || isSafariWebExtension ? [ - func.indexOf("@") !== -1 ? func.split("@")[0] : UNKNOWN_FUNCTION, - isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}` - ] : [func, filename]; -}, "extractSafariExtensionDetails"); -const MAX_ALLOWED_STRING_LENGTH = 1024; -const INTEGRATION_NAME$a = "Breadcrumbs"; -const _breadcrumbsIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const _options = { - console: true, - dom: true, - fetch: true, - history: true, - sentry: true, - xhr: true, - ...options4 - }; - return { - name: INTEGRATION_NAME$a, - setup(client) { - if (_options.console) { - addConsoleInstrumentationHandler(_getConsoleBreadcrumbHandler(client)); - } - if (_options.dom) { - addClickKeypressInstrumentationHandler(_getDomBreadcrumbHandler(client, _options.dom)); - } - if (_options.xhr) { - addXhrInstrumentationHandler(_getXhrBreadcrumbHandler(client)); - } - if (_options.fetch) { - addFetchInstrumentationHandler(_getFetchBreadcrumbHandler(client)); - } - if (_options.history) { - addHistoryInstrumentationHandler(_getHistoryBreadcrumbHandler(client)); - } - if (_options.sentry) { - client.on("beforeSendEvent", _getSentryBreadcrumbHandler(client)); - } - } - }; -}, "_breadcrumbsIntegration"); -const breadcrumbsIntegration = defineIntegration(_breadcrumbsIntegration); -function _getSentryBreadcrumbHandler(client) { - return /* @__PURE__ */ __name(function addSentryBreadcrumb(event) { - if (getClient() !== client) { - return; - } - addBreadcrumb( - { - category: `sentry.${event.type === "transaction" ? "transaction" : "event"}`, - event_id: event.event_id, - level: event.level, - message: getEventDescription(event) - }, - { - event - } - ); - }, "addSentryBreadcrumb"); -} -__name(_getSentryBreadcrumbHandler, "_getSentryBreadcrumbHandler"); -function _getDomBreadcrumbHandler(client, dom) { - return /* @__PURE__ */ __name(function _innerDomBreadcrumb(handlerData) { - if (getClient() !== client) { - return; - } - let target2; - let componentName; - let keyAttrs = typeof dom === "object" ? dom.serializeAttribute : void 0; - let maxStringLength = typeof dom === "object" && typeof dom.maxStringLength === "number" ? dom.maxStringLength : void 0; - if (maxStringLength && maxStringLength > MAX_ALLOWED_STRING_LENGTH) { - DEBUG_BUILD$4 && logger$2.warn( - `\`dom.maxStringLength\` cannot exceed ${MAX_ALLOWED_STRING_LENGTH}, but a value of ${maxStringLength} was configured. Sentry will use ${MAX_ALLOWED_STRING_LENGTH} instead.` - ); - maxStringLength = MAX_ALLOWED_STRING_LENGTH; - } - if (typeof keyAttrs === "string") { - keyAttrs = [keyAttrs]; - } - try { - const event = handlerData.event; - const element = _isEvent(event) ? event.target : event; - target2 = htmlTreeAsString(element, { keyAttrs, maxStringLength }); - componentName = getComponentName$1(element); - } catch (e2) { - target2 = ""; - } - if (target2.length === 0) { - return; - } - const breadcrumb = { - category: `ui.${handlerData.name}`, - message: target2 - }; - if (componentName) { - breadcrumb.data = { "ui.component_name": componentName }; - } - addBreadcrumb(breadcrumb, { - event: handlerData.event, - name: handlerData.name, - global: handlerData.global - }); - }, "_innerDomBreadcrumb"); -} -__name(_getDomBreadcrumbHandler, "_getDomBreadcrumbHandler"); -function _getConsoleBreadcrumbHandler(client) { - return /* @__PURE__ */ __name(function _consoleBreadcrumb(handlerData) { - if (getClient() !== client) { - return; - } - const breadcrumb = { - category: "console", - data: { - arguments: handlerData.args, - logger: "console" - }, - level: severityLevelFromString(handlerData.level), - message: safeJoin(handlerData.args, " ") - }; - if (handlerData.level === "assert") { - if (handlerData.args[0] === false) { - breadcrumb.message = `Assertion failed: ${safeJoin(handlerData.args.slice(1), " ") || "console.assert"}`; - breadcrumb.data.arguments = handlerData.args.slice(1); - } else { - return; - } - } - addBreadcrumb(breadcrumb, { - input: handlerData.args, - level: handlerData.level - }); - }, "_consoleBreadcrumb"); -} -__name(_getConsoleBreadcrumbHandler, "_getConsoleBreadcrumbHandler"); -function _getXhrBreadcrumbHandler(client) { - return /* @__PURE__ */ __name(function _xhrBreadcrumb(handlerData) { - if (getClient() !== client) { - return; - } - const { startTimestamp, endTimestamp } = handlerData; - const sentryXhrData = handlerData.xhr[SENTRY_XHR_DATA_KEY]; - if (!startTimestamp || !endTimestamp || !sentryXhrData) { - return; - } - const { method, url, status_code, body } = sentryXhrData; - const data26 = { - method, - url, - status_code - }; - const hint = { - xhr: handlerData.xhr, - input: body, - startTimestamp, - endTimestamp - }; - const level = getBreadcrumbLogLevelFromHttpStatusCode(status_code); - addBreadcrumb( - { - category: "xhr", - data: data26, - type: "http", - level - }, - hint - ); - }, "_xhrBreadcrumb"); -} -__name(_getXhrBreadcrumbHandler, "_getXhrBreadcrumbHandler"); -function _getFetchBreadcrumbHandler(client) { - return /* @__PURE__ */ __name(function _fetchBreadcrumb(handlerData) { - if (getClient() !== client) { - return; - } - const { startTimestamp, endTimestamp } = handlerData; - if (!endTimestamp) { - return; - } - if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === "POST") { - return; - } - if (handlerData.error) { - const data26 = handlerData.fetchData; - const hint = { - data: handlerData.error, - input: handlerData.args, - startTimestamp, - endTimestamp - }; - addBreadcrumb( - { - category: "fetch", - data: data26, - level: "error", - type: "http" - }, - hint - ); - } else { - const response = handlerData.response; - const data26 = { - ...handlerData.fetchData, - status_code: response && response.status - }; - const hint = { - input: handlerData.args, - response, - startTimestamp, - endTimestamp - }; - const level = getBreadcrumbLogLevelFromHttpStatusCode(data26.status_code); - addBreadcrumb( - { - category: "fetch", - data: data26, - type: "http", - level - }, - hint - ); - } - }, "_fetchBreadcrumb"); -} -__name(_getFetchBreadcrumbHandler, "_getFetchBreadcrumbHandler"); -function _getHistoryBreadcrumbHandler(client) { - return /* @__PURE__ */ __name(function _historyBreadcrumb(handlerData) { - if (getClient() !== client) { - return; - } - let from2 = handlerData.from; - let to = handlerData.to; - const parsedLoc = parseUrl$1(WINDOW$5.location.href); - let parsedFrom = from2 ? parseUrl$1(from2) : void 0; - const parsedTo = parseUrl$1(to); - if (!parsedFrom || !parsedFrom.path) { - parsedFrom = parsedLoc; - } - if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) { - to = parsedTo.relative; - } - if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) { - from2 = parsedFrom.relative; - } - addBreadcrumb({ - category: "navigation", - data: { - from: from2, - to - } - }); - }, "_historyBreadcrumb"); -} -__name(_getHistoryBreadcrumbHandler, "_getHistoryBreadcrumbHandler"); -function _isEvent(event) { - return !!event && !!event.target; -} -__name(_isEvent, "_isEvent"); -const DEFAULT_EVENT_TARGET = [ - "EventTarget", - "Window", - "Node", - "ApplicationCache", - "AudioTrackList", - "BroadcastChannel", - "ChannelMergerNode", - "CryptoOperation", - "EventSource", - "FileReader", - "HTMLUnknownElement", - "IDBDatabase", - "IDBRequest", - "IDBTransaction", - "KeyOperation", - "MediaController", - "MessagePort", - "ModalWindow", - "Notification", - "SVGElementInstance", - "Screen", - "SharedWorker", - "TextTrack", - "TextTrackCue", - "TextTrackList", - "WebSocket", - "WebSocketWorker", - "Worker", - "XMLHttpRequest", - "XMLHttpRequestEventTarget", - "XMLHttpRequestUpload" -]; -const INTEGRATION_NAME$9 = "BrowserApiErrors"; -const _browserApiErrorsIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const _options = { - XMLHttpRequest: true, - eventTarget: true, - requestAnimationFrame: true, - setInterval: true, - setTimeout: true, - ...options4 - }; - return { - name: INTEGRATION_NAME$9, - // TODO: This currently only works for the first client this is setup - // We may want to adjust this to check for client etc. - setupOnce() { - if (_options.setTimeout) { - fill(WINDOW$5, "setTimeout", _wrapTimeFunction); - } - if (_options.setInterval) { - fill(WINDOW$5, "setInterval", _wrapTimeFunction); - } - if (_options.requestAnimationFrame) { - fill(WINDOW$5, "requestAnimationFrame", _wrapRAF); - } - if (_options.XMLHttpRequest && "XMLHttpRequest" in WINDOW$5) { - fill(XMLHttpRequest.prototype, "send", _wrapXHR$1); - } - const eventTargetOption = _options.eventTarget; - if (eventTargetOption) { - const eventTarget = Array.isArray(eventTargetOption) ? eventTargetOption : DEFAULT_EVENT_TARGET; - eventTarget.forEach(_wrapEventTarget); - } - } - }; -}, "_browserApiErrorsIntegration"); -const browserApiErrorsIntegration = defineIntegration(_browserApiErrorsIntegration); -function _wrapTimeFunction(original) { - return function(...args) { - const originalCallback = args[0]; - args[0] = wrap$1(originalCallback, { - mechanism: { - data: { function: getFunctionName(original) }, - handled: false, - type: "instrument" - } - }); - return original.apply(this, args); - }; -} -__name(_wrapTimeFunction, "_wrapTimeFunction"); -function _wrapRAF(original) { - return function(callback) { - return original.apply(this, [ - wrap$1(callback, { - mechanism: { - data: { - function: "requestAnimationFrame", - handler: getFunctionName(original) - }, - handled: false, - type: "instrument" - } - }) - ]); - }; -} -__name(_wrapRAF, "_wrapRAF"); -function _wrapXHR$1(originalSend) { - return function(...args) { - const xhr = this; - const xmlHttpRequestProps = ["onload", "onerror", "onprogress", "onreadystatechange"]; - xmlHttpRequestProps.forEach((prop2) => { - if (prop2 in xhr && typeof xhr[prop2] === "function") { - fill(xhr, prop2, function(original) { - const wrapOptions = { - mechanism: { - data: { - function: prop2, - handler: getFunctionName(original) - }, - handled: false, - type: "instrument" - } - }; - const originalFunction = getOriginalFunction(original); - if (originalFunction) { - wrapOptions.mechanism.data.handler = getFunctionName(originalFunction); - } - return wrap$1(original, wrapOptions); - }); - } - }); - return originalSend.apply(this, args); - }; -} -__name(_wrapXHR$1, "_wrapXHR$1"); -function _wrapEventTarget(target2) { - const globalObject = WINDOW$5; - const targetObj = globalObject[target2]; - const proto = targetObj && targetObj.prototype; - if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty("addEventListener")) { - return; - } - fill(proto, "addEventListener", function(original) { - return function(eventName, fn, options4) { - try { - if (isEventListenerObject(fn)) { - fn.handleEvent = wrap$1(fn.handleEvent, { - mechanism: { - data: { - function: "handleEvent", - handler: getFunctionName(fn), - target: target2 - }, - handled: false, - type: "instrument" - } - }); - } - } catch (e2) { - } - return original.apply(this, [ - eventName, - wrap$1(fn, { - mechanism: { - data: { - function: "addEventListener", - handler: getFunctionName(fn), - target: target2 - }, - handled: false, - type: "instrument" - } - }), - options4 - ]); - }; - }); - fill(proto, "removeEventListener", function(originalRemoveEventListener) { - return function(eventName, fn, options4) { - try { - const originalEventHandler = fn.__sentry_wrapped__; - if (originalEventHandler) { - originalRemoveEventListener.call(this, eventName, originalEventHandler, options4); - } - } catch (e2) { - } - return originalRemoveEventListener.call(this, eventName, fn, options4); - }; - }); -} -__name(_wrapEventTarget, "_wrapEventTarget"); -function isEventListenerObject(obj) { - return typeof obj.handleEvent === "function"; -} -__name(isEventListenerObject, "isEventListenerObject"); -const browserSessionIntegration = defineIntegration(() => { - return { - name: "BrowserSession", - setupOnce() { - if (typeof WINDOW$5.document === "undefined") { - DEBUG_BUILD$4 && logger$2.warn("Using the `browserSessionIntegration` in non-browser environments is not supported."); - return; - } - startSession({ ignoreDuration: true }); - captureSession(); - addHistoryInstrumentationHandler(({ from: from2, to }) => { - if (from2 !== void 0 && from2 !== to) { - startSession({ ignoreDuration: true }); - captureSession(); - } - }); - } - }; -}); -const INTEGRATION_NAME$8 = "GlobalHandlers"; -const _globalHandlersIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const _options = { - onerror: true, - onunhandledrejection: true, - ...options4 - }; - return { - name: INTEGRATION_NAME$8, - setupOnce() { - Error.stackTraceLimit = 50; - }, - setup(client) { - if (_options.onerror) { - _installGlobalOnErrorHandler(client); - globalHandlerLog("onerror"); - } - if (_options.onunhandledrejection) { - _installGlobalOnUnhandledRejectionHandler(client); - globalHandlerLog("onunhandledrejection"); - } - } - }; -}, "_globalHandlersIntegration"); -const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration); -function _installGlobalOnErrorHandler(client) { - addGlobalErrorInstrumentationHandler((data26) => { - const { stackParser, attachStacktrace } = getOptions(); - if (getClient() !== client || shouldIgnoreOnError()) { - return; - } - const { msg, url, line, column, error: error2 } = data26; - const event = _enhanceEventWithInitialFrame( - eventFromUnknownInput(stackParser, error2 || msg, void 0, attachStacktrace, false), - url, - line, - column - ); - event.level = "error"; - captureEvent(event, { - originalException: error2, - mechanism: { - handled: false, - type: "onerror" - } - }); - }); -} -__name(_installGlobalOnErrorHandler, "_installGlobalOnErrorHandler"); -function _installGlobalOnUnhandledRejectionHandler(client) { - addGlobalUnhandledRejectionInstrumentationHandler((e2) => { - const { stackParser, attachStacktrace } = getOptions(); - if (getClient() !== client || shouldIgnoreOnError()) { - return; - } - const error2 = _getUnhandledRejectionError(e2); - const event = isPrimitive(error2) ? _eventFromRejectionWithPrimitive(error2) : eventFromUnknownInput(stackParser, error2, void 0, attachStacktrace, true); - event.level = "error"; - captureEvent(event, { - originalException: error2, - mechanism: { - handled: false, - type: "onunhandledrejection" - } - }); - }); -} -__name(_installGlobalOnUnhandledRejectionHandler, "_installGlobalOnUnhandledRejectionHandler"); -function _getUnhandledRejectionError(error2) { - if (isPrimitive(error2)) { - return error2; - } - try { - if ("reason" in error2) { - return error2.reason; - } - if ("detail" in error2 && "reason" in error2.detail) { - return error2.detail.reason; - } - } catch (e2) { - } - return error2; -} -__name(_getUnhandledRejectionError, "_getUnhandledRejectionError"); -function _eventFromRejectionWithPrimitive(reason) { - return { - exception: { - values: [ - { - type: "UnhandledRejection", - // String() is needed because the Primitive type includes symbols (which can't be automatically stringified) - value: `Non-Error promise rejection captured with value: ${String(reason)}` - } - ] - } - }; -} -__name(_eventFromRejectionWithPrimitive, "_eventFromRejectionWithPrimitive"); -function _enhanceEventWithInitialFrame(event, url, line, column) { - const e2 = event.exception = event.exception || {}; - const ev = e2.values = e2.values || []; - const ev0 = ev[0] = ev[0] || {}; - const ev0s = ev0.stacktrace = ev0.stacktrace || {}; - const ev0sf = ev0s.frames = ev0s.frames || []; - const colno = column; - const lineno = line; - const filename = isString$a(url) && url.length > 0 ? url : getLocationHref(); - if (ev0sf.length === 0) { - ev0sf.push({ - colno, - filename, - function: UNKNOWN_FUNCTION, - in_app: true, - lineno - }); - } - return event; -} -__name(_enhanceEventWithInitialFrame, "_enhanceEventWithInitialFrame"); -function globalHandlerLog(type) { - DEBUG_BUILD$4 && logger$2.log(`Global Handler attached: ${type}`); -} -__name(globalHandlerLog, "globalHandlerLog"); -function getOptions() { - const client = getClient(); - const options4 = client && client.getOptions() || { - stackParser: /* @__PURE__ */ __name(() => [], "stackParser"), - attachStacktrace: false - }; - return options4; -} -__name(getOptions, "getOptions"); -const httpContextIntegration = defineIntegration(() => { - return { - name: "HttpContext", - preprocessEvent(event) { - if (!WINDOW$5.navigator && !WINDOW$5.location && !WINDOW$5.document) { - return; - } - const url = event.request && event.request.url || WINDOW$5.location && WINDOW$5.location.href; - const { referrer } = WINDOW$5.document || {}; - const { userAgent } = WINDOW$5.navigator || {}; - const headers = { - ...event.request && event.request.headers, - ...referrer && { Referer: referrer }, - ...userAgent && { "User-Agent": userAgent } - }; - const request = { ...event.request, ...url && { url }, headers }; - event.request = request; - } - }; -}); -const DEFAULT_KEY = "cause"; -const DEFAULT_LIMIT = 5; -const INTEGRATION_NAME$7 = "LinkedErrors"; -const _linkedErrorsIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const limit = options4.limit || DEFAULT_LIMIT; - const key = options4.key || DEFAULT_KEY; - return { - name: INTEGRATION_NAME$7, - preprocessEvent(event, hint, client) { - const options5 = client.getOptions(); - applyAggregateErrorsToEvent( - // This differs from the LinkedErrors integration in core by using a different exceptionFromError function - exceptionFromError, - options5.stackParser, - options5.maxValueLength, - key, - limit, - event, - hint - ); - } - }; -}, "_linkedErrorsIntegration"); -const linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration); -function getDefaultIntegrations(options4) { - const integrations = [ - inboundFiltersIntegration(), - functionToStringIntegration(), - browserApiErrorsIntegration(), - breadcrumbsIntegration(), - globalHandlersIntegration(), - linkedErrorsIntegration(), - dedupeIntegration(), - httpContextIntegration() - ]; - if (options4.autoSessionTracking !== false) { - integrations.push(browserSessionIntegration()); - } - return integrations; -} -__name(getDefaultIntegrations, "getDefaultIntegrations"); -function applyDefaultOptions(optionsArg = {}) { - const defaultOptions2 = { - defaultIntegrations: getDefaultIntegrations(optionsArg), - release: typeof __SENTRY_RELEASE__ === "string" ? __SENTRY_RELEASE__ : WINDOW$5.SENTRY_RELEASE && WINDOW$5.SENTRY_RELEASE.id ? WINDOW$5.SENTRY_RELEASE.id : void 0, - autoSessionTracking: true, - sendClientReports: true - }; - if (optionsArg.defaultIntegrations == null) { - delete optionsArg.defaultIntegrations; - } - return { ...defaultOptions2, ...optionsArg }; -} -__name(applyDefaultOptions, "applyDefaultOptions"); -function shouldShowBrowserExtensionError() { - const windowWithMaybeExtension = typeof WINDOW$5.window !== "undefined" && WINDOW$5; - if (!windowWithMaybeExtension) { - return false; - } - const extensionKey = windowWithMaybeExtension.chrome ? "chrome" : "browser"; - const extensionObject = windowWithMaybeExtension[extensionKey]; - const runtimeId = extensionObject && extensionObject.runtime && extensionObject.runtime.id; - const href = WINDOW$5.location && WINDOW$5.location.href || ""; - const extensionProtocols = ["chrome-extension:", "moz-extension:", "ms-browser-extension:", "safari-web-extension:"]; - const isDedicatedExtensionPage = !!runtimeId && WINDOW$5 === WINDOW$5.top && extensionProtocols.some((protocol) => href.startsWith(`${protocol}//`)); - const isNWjs = typeof windowWithMaybeExtension.nw !== "undefined"; - return !!runtimeId && !isDedicatedExtensionPage && !isNWjs; -} -__name(shouldShowBrowserExtensionError, "shouldShowBrowserExtensionError"); -function init$4(browserOptions = {}) { - const options4 = applyDefaultOptions(browserOptions); - if (!options4.skipBrowserExtensionCheck && shouldShowBrowserExtensionError()) { - consoleSandbox(() => { - console.error( - "[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/" - ); - }); - return; - } - if (DEBUG_BUILD$4) { - if (!supportsFetch()) { - logger$2.warn( - "No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill." - ); - } - } - const clientOptions = { - ...options4, - stackParser: stackParserFromStackParserOptions(options4.stackParser || defaultStackParser), - integrations: getIntegrationsToSetup(options4), - transport: options4.transport || makeFetchTransport - }; - return initAndBind(BrowserClient, clientOptions); -} -__name(init$4, "init$4"); -function showReportDialog(options4 = {}) { - if (!WINDOW$5.document) { - DEBUG_BUILD$4 && logger$2.error("Global document not defined in showReportDialog call"); - return; - } - const scope = getCurrentScope$1(); - const client = scope.getClient(); - const dsn = client && client.getDsn(); - if (!dsn) { - DEBUG_BUILD$4 && logger$2.error("DSN not configured for showReportDialog call"); - return; - } - if (scope) { - options4.user = { - ...scope.getUser(), - ...options4.user - }; - } - if (!options4.eventId) { - const eventId = lastEventId(); - if (eventId) { - options4.eventId = eventId; - } - } - const script2 = WINDOW$5.document.createElement("script"); - script2.async = true; - script2.crossOrigin = "anonymous"; - script2.src = getReportDialogEndpoint(dsn, options4); - if (options4.onLoad) { - script2.onload = options4.onLoad; - } - const { onClose } = options4; - if (onClose) { - const reportDialogClosedMessageHandler = /* @__PURE__ */ __name((event) => { - if (event.data === "__sentry_reportdialog_closed__") { - try { - onClose(); - } finally { - WINDOW$5.removeEventListener("message", reportDialogClosedMessageHandler); - } - } - }, "reportDialogClosedMessageHandler"); - WINDOW$5.addEventListener("message", reportDialogClosedMessageHandler); - } - const injectionPoint = WINDOW$5.document.head || WINDOW$5.document.body; - if (injectionPoint) { - injectionPoint.appendChild(script2); - } else { - DEBUG_BUILD$4 && logger$2.error("Not injecting report dialog. No injection point found in HTML"); - } -} -__name(showReportDialog, "showReportDialog"); -function forceLoad() { -} -__name(forceLoad, "forceLoad"); -function onLoad(callback) { - callback(); -} -__name(onLoad, "onLoad"); -function captureUserFeedback(feedback) { - const client = getClient(); - if (client) { - client.captureUserFeedback(feedback); - } -} -__name(captureUserFeedback, "captureUserFeedback"); -const LazyLoadableIntegrations = { - replayIntegration: "replay", - replayCanvasIntegration: "replay-canvas", - feedbackIntegration: "feedback", - feedbackModalIntegration: "feedback-modal", - feedbackScreenshotIntegration: "feedback-screenshot", - captureConsoleIntegration: "captureconsole", - contextLinesIntegration: "contextlines", - linkedErrorsIntegration: "linkederrors", - debugIntegration: "debug", - dedupeIntegration: "dedupe", - extraErrorDataIntegration: "extraerrordata", - httpClientIntegration: "httpclient", - reportingObserverIntegration: "reportingobserver", - rewriteFramesIntegration: "rewriteframes", - sessionTimingIntegration: "sessiontiming", - browserProfilingIntegration: "browserprofiling", - moduleMetadataIntegration: "modulemetadata" -}; -const WindowWithMaybeIntegration = WINDOW$5; -async function lazyLoadIntegration(name2, scriptNonce) { - const bundle = LazyLoadableIntegrations[name2]; - const sentryOnWindow = WindowWithMaybeIntegration.Sentry = WindowWithMaybeIntegration.Sentry || {}; - if (!bundle) { - throw new Error(`Cannot lazy load integration: ${name2}`); - } - const existing = sentryOnWindow[name2]; - if (typeof existing === "function" && !("_isShim" in existing)) { - return existing; - } - const url = getScriptURL(bundle); - const script2 = WINDOW$5.document.createElement("script"); - script2.src = url; - script2.crossOrigin = "anonymous"; - script2.referrerPolicy = "origin"; - if (scriptNonce) { - script2.setAttribute("nonce", scriptNonce); - } - const waitForLoad = new Promise((resolve2, reject3) => { - script2.addEventListener("load", () => resolve2()); - script2.addEventListener("error", reject3); - }); - const currentScript = WINDOW$5.document.currentScript; - const parent = WINDOW$5.document.body || WINDOW$5.document.head || currentScript && currentScript.parentElement; - if (parent) { - parent.appendChild(script2); - } else { - throw new Error(`Could not find parent element to insert lazy-loaded ${name2} script`); - } - try { - await waitForLoad; - } catch (e2) { - throw new Error(`Error when loading integration: ${name2}`); - } - const integrationFn = sentryOnWindow[name2]; - if (typeof integrationFn !== "function") { - throw new Error(`Could not load integration: ${name2}`); - } - return integrationFn; -} -__name(lazyLoadIntegration, "lazyLoadIntegration"); -function getScriptURL(bundle) { - const client = getClient(); - const options4 = client && client.getOptions(); - const baseURL = options4 && options4.cdnBaseUrl || "https://browser.sentry-cdn.com"; - return new URL(`/${SDK_VERSION}/${bundle}.min.js`, baseURL).toString(); -} -__name(getScriptURL, "getScriptURL"); -const WINDOW$3 = GLOBAL_OBJ; -const INTEGRATION_NAME$6 = "ReportingObserver"; -const SETUP_CLIENTS = /* @__PURE__ */ new WeakMap(); -const _reportingObserverIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const types = options4.types || ["crash", "deprecation", "intervention"]; - function handler12(reports) { - if (!SETUP_CLIENTS.has(getClient())) { - return; - } - for (const report of reports) { - withScope((scope) => { - scope.setExtra("url", report.url); - const label5 = `ReportingObserver [${report.type}]`; - let details = "No details available"; - if (report.body) { - const plainBody = {}; - for (const prop2 in report.body) { - plainBody[prop2] = report.body[prop2]; - } - scope.setExtra("body", plainBody); - if (report.type === "crash") { - const body = report.body; - details = [body.crashId || "", body.reason || ""].join(" ").trim() || details; - } else { - const body = report.body; - details = body.message || details; - } - } - captureMessage(`${label5}: ${details}`); - }); - } - } - __name(handler12, "handler"); - return { - name: INTEGRATION_NAME$6, - setupOnce() { - if (!supportsReportingObserver()) { - return; - } - const observer = new WINDOW$3.ReportingObserver( - handler12, - { - buffered: true, - types - } - ); - observer.observe(); - }, - setup(client) { - SETUP_CLIENTS.set(client, true); - } - }; -}, "_reportingObserverIntegration"); -const reportingObserverIntegration = defineIntegration(_reportingObserverIntegration); -const INTEGRATION_NAME$5 = "HttpClient"; -const _httpClientIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const _options = { - failedRequestStatusCodes: [[500, 599]], - failedRequestTargets: [/.*/], - ...options4 - }; - return { - name: INTEGRATION_NAME$5, - setup(client) { - _wrapFetch(client, _options); - _wrapXHR(client, _options); - } - }; -}, "_httpClientIntegration"); -const httpClientIntegration = defineIntegration(_httpClientIntegration); -function _fetchResponseHandler(options4, requestInfo, response, requestInit, error2) { - if (_shouldCaptureResponse(options4, response.status, response.url)) { - const request = _getRequest(requestInfo, requestInit); - let requestHeaders, responseHeaders, requestCookies, responseCookies; - if (_shouldSendDefaultPii()) { - [requestHeaders, requestCookies] = _parseCookieHeaders("Cookie", request); - [responseHeaders, responseCookies] = _parseCookieHeaders("Set-Cookie", response); - } - const event = _createEvent({ - url: request.url, - method: request.method, - status: response.status, - requestHeaders, - responseHeaders, - requestCookies, - responseCookies, - error: error2 - }); - captureEvent(event); - } -} -__name(_fetchResponseHandler, "_fetchResponseHandler"); -function _parseCookieHeaders(cookieHeader, obj) { - const headers = _extractFetchHeaders(obj.headers); - let cookies2; - try { - const cookieString = headers[cookieHeader] || headers[cookieHeader.toLowerCase()] || void 0; - if (cookieString) { - cookies2 = _parseCookieString(cookieString); - } - } catch (e2) { - } - return [headers, cookies2]; -} -__name(_parseCookieHeaders, "_parseCookieHeaders"); -function _xhrResponseHandler(options4, xhr, method, headers, error2) { - if (_shouldCaptureResponse(options4, xhr.status, xhr.responseURL)) { - let requestHeaders, responseCookies, responseHeaders; - if (_shouldSendDefaultPii()) { - try { - const cookieString = xhr.getResponseHeader("Set-Cookie") || xhr.getResponseHeader("set-cookie") || void 0; - if (cookieString) { - responseCookies = _parseCookieString(cookieString); - } - } catch (e3) { - } - try { - responseHeaders = _getXHRResponseHeaders(xhr); - } catch (e4) { - } - requestHeaders = headers; - } - const event = _createEvent({ - url: xhr.responseURL, - method, - status: xhr.status, - requestHeaders, - // Can't access request cookies from XHR - responseHeaders, - responseCookies, - error: error2 - }); - captureEvent(event); - } -} -__name(_xhrResponseHandler, "_xhrResponseHandler"); -function _getResponseSizeFromHeaders(headers) { - if (headers) { - const contentLength = headers["Content-Length"] || headers["content-length"]; - if (contentLength) { - return parseInt(contentLength, 10); - } - } - return void 0; -} -__name(_getResponseSizeFromHeaders, "_getResponseSizeFromHeaders"); -function _parseCookieString(cookieString) { - return cookieString.split("; ").reduce((acc, cookie) => { - const [key, value4] = cookie.split("="); - if (key && value4) { - acc[key] = value4; - } - return acc; - }, {}); -} -__name(_parseCookieString, "_parseCookieString"); -function _extractFetchHeaders(headers) { - const result = {}; - headers.forEach((value4, key) => { - result[key] = value4; - }); - return result; -} -__name(_extractFetchHeaders, "_extractFetchHeaders"); -function _getXHRResponseHeaders(xhr) { - const headers = xhr.getAllResponseHeaders(); - if (!headers) { - return {}; - } - return headers.split("\r\n").reduce((acc, line) => { - const [key, value4] = line.split(": "); - if (key && value4) { - acc[key] = value4; - } - return acc; - }, {}); -} -__name(_getXHRResponseHeaders, "_getXHRResponseHeaders"); -function _isInGivenRequestTargets(failedRequestTargets, target2) { - return failedRequestTargets.some((givenRequestTarget) => { - if (typeof givenRequestTarget === "string") { - return target2.includes(givenRequestTarget); - } - return givenRequestTarget.test(target2); - }); -} -__name(_isInGivenRequestTargets, "_isInGivenRequestTargets"); -function _isInGivenStatusRanges(failedRequestStatusCodes, status) { - return failedRequestStatusCodes.some((range2) => { - if (typeof range2 === "number") { - return range2 === status; - } - return status >= range2[0] && status <= range2[1]; - }); -} -__name(_isInGivenStatusRanges, "_isInGivenStatusRanges"); -function _wrapFetch(client, options4) { - if (!supportsNativeFetch()) { - return; - } - addFetchInstrumentationHandler((handlerData) => { - if (getClient() !== client) { - return; - } - const { response, args, error: error2, virtualError } = handlerData; - const [requestInfo, requestInit] = args; - if (!response) { - return; - } - _fetchResponseHandler(options4, requestInfo, response, requestInit, error2 || virtualError); - }, false); -} -__name(_wrapFetch, "_wrapFetch"); -function _wrapXHR(client, options4) { - if (!("XMLHttpRequest" in GLOBAL_OBJ)) { - return; - } - addXhrInstrumentationHandler((handlerData) => { - if (getClient() !== client) { - return; - } - const { error: error2, virtualError } = handlerData; - const xhr = handlerData.xhr; - const sentryXhrData = xhr[SENTRY_XHR_DATA_KEY]; - if (!sentryXhrData) { - return; - } - const { method, request_headers: headers } = sentryXhrData; - try { - _xhrResponseHandler(options4, xhr, method, headers, error2 || virtualError); - } catch (e2) { - DEBUG_BUILD$4 && logger$2.warn("Error while extracting response event form XHR response", e2); - } - }); -} -__name(_wrapXHR, "_wrapXHR"); -function _shouldCaptureResponse(options4, status, url) { - return _isInGivenStatusRanges(options4.failedRequestStatusCodes, status) && _isInGivenRequestTargets(options4.failedRequestTargets, url) && !isSentryRequestUrl(url, getClient()); -} -__name(_shouldCaptureResponse, "_shouldCaptureResponse"); -function _createEvent(data26) { - const client = getClient(); - const virtualStackTrace = client && data26.error && data26.error instanceof Error ? data26.error.stack : void 0; - const stack2 = virtualStackTrace && client ? client.getOptions().stackParser(virtualStackTrace, 0, 1) : void 0; - const message3 = `HTTP Client Error with status code: ${data26.status}`; - const event = { - message: message3, - exception: { - values: [ - { - type: "Error", - value: message3, - stacktrace: stack2 ? { frames: stack2 } : void 0 - } - ] - }, - request: { - url: data26.url, - method: data26.method, - headers: data26.requestHeaders, - cookies: data26.requestCookies - }, - contexts: { - response: { - status_code: data26.status, - headers: data26.responseHeaders, - cookies: data26.responseCookies, - body_size: _getResponseSizeFromHeaders(data26.responseHeaders) - } - } - }; - addExceptionMechanism(event, { - type: "http.client", - handled: false - }); - return event; -} -__name(_createEvent, "_createEvent"); -function _getRequest(requestInfo, requestInit) { - if (!requestInit && requestInfo instanceof Request) { - return requestInfo; - } - if (requestInfo instanceof Request && requestInfo.bodyUsed) { - return requestInfo; - } - return new Request(requestInfo, requestInit); -} -__name(_getRequest, "_getRequest"); -function _shouldSendDefaultPii() { - const client = getClient(); - return client ? Boolean(client.getOptions().sendDefaultPii) : false; -} -__name(_shouldSendDefaultPii, "_shouldSendDefaultPii"); -const WINDOW$2 = GLOBAL_OBJ; -const DEFAULT_LINES_OF_CONTEXT = 7; -const INTEGRATION_NAME$4 = "ContextLines"; -const _contextLinesIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const contextLines = options4.frameContextLines != null ? options4.frameContextLines : DEFAULT_LINES_OF_CONTEXT; - return { - name: INTEGRATION_NAME$4, - processEvent(event) { - return addSourceContext(event, contextLines); - } - }; -}, "_contextLinesIntegration"); -const contextLinesIntegration = defineIntegration(_contextLinesIntegration); -function addSourceContext(event, contextLines) { - const doc2 = WINDOW$2.document; - const htmlFilename = WINDOW$2.location && stripUrlQueryAndFragment(WINDOW$2.location.href); - if (!doc2 || !htmlFilename) { - return event; - } - const exceptions = event.exception && event.exception.values; - if (!exceptions || !exceptions.length) { - return event; - } - const html = doc2.documentElement.innerHTML; - if (!html) { - return event; - } - const htmlLines = ["", "", ...html.split("\n"), ""]; - exceptions.forEach((exception) => { - const stacktrace = exception.stacktrace; - if (stacktrace && stacktrace.frames) { - stacktrace.frames = stacktrace.frames.map( - (frame) => applySourceContextToFrame(frame, htmlLines, htmlFilename, contextLines) - ); - } - }); - return event; -} -__name(addSourceContext, "addSourceContext"); -function applySourceContextToFrame(frame, htmlLines, htmlFilename, linesOfContext) { - if (frame.filename !== htmlFilename || !frame.lineno || !htmlLines.length) { - return frame; - } - addContextToFrame(htmlLines, frame, linesOfContext); - return frame; -} -__name(applySourceContextToFrame, "applySourceContextToFrame"); -const WINDOW$1 = GLOBAL_OBJ; -const REPLAY_SESSION_KEY = "sentryReplaySession"; -const REPLAY_EVENT_NAME = "replay_event"; -const UNABLE_TO_SEND_REPLAY = "Unable to send Replay"; -const SESSION_IDLE_PAUSE_DURATION = 3e5; -const SESSION_IDLE_EXPIRE_DURATION = 9e5; -const DEFAULT_FLUSH_MIN_DELAY = 5e3; -const DEFAULT_FLUSH_MAX_DELAY = 5500; -const BUFFER_CHECKOUT_TIME = 6e4; -const RETRY_BASE_INTERVAL = 5e3; -const RETRY_MAX_COUNT = 3; -const NETWORK_BODY_MAX_SIZE = 15e4; -const CONSOLE_ARG_MAX_SIZE = 5e3; -const SLOW_CLICK_THRESHOLD = 3e3; -const SLOW_CLICK_SCROLL_TIMEOUT = 300; -const REPLAY_MAX_EVENT_BUFFER_SIZE = 2e7; -const MIN_REPLAY_DURATION = 4999; -const MIN_REPLAY_DURATION_LIMIT = 15e3; -const MAX_REPLAY_DURATION = 36e5; -function _nullishCoalesce$1(lhs, rhsFn) { - if (lhs != null) { - return lhs; - } else { - return rhsFn(); - } -} -__name(_nullishCoalesce$1, "_nullishCoalesce$1"); -function _optionalChain$5(ops) { - let lastAccessLHS = void 0; - let value4 = ops[0]; - let i2 = 1; - while (i2 < ops.length) { - const op = ops[i2]; - const fn = ops[i2 + 1]; - i2 += 2; - if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { - return void 0; - } - if (op === "access" || op === "optionalAccess") { - lastAccessLHS = value4; - value4 = fn(value4); - } else if (op === "call" || op === "optionalCall") { - value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); - lastAccessLHS = void 0; - } - } - return value4; -} -__name(_optionalChain$5, "_optionalChain$5"); -var NodeType$3; -(function(NodeType3) { - NodeType3[NodeType3["Document"] = 0] = "Document"; - NodeType3[NodeType3["DocumentType"] = 1] = "DocumentType"; - NodeType3[NodeType3["Element"] = 2] = "Element"; - NodeType3[NodeType3["Text"] = 3] = "Text"; - NodeType3[NodeType3["CDATA"] = 4] = "CDATA"; - NodeType3[NodeType3["Comment"] = 5] = "Comment"; -})(NodeType$3 || (NodeType$3 = {})); -function isElement$1$1(n2) { - return n2.nodeType === n2.ELEMENT_NODE; -} -__name(isElement$1$1, "isElement$1$1"); -function isShadowRoot(n2) { - const host = _optionalChain$5([n2, "optionalAccess", (_2) => _2.host]); - return Boolean(_optionalChain$5([host, "optionalAccess", (_2) => _2.shadowRoot]) === n2); -} -__name(isShadowRoot, "isShadowRoot"); -function isNativeShadowDom(shadowRoot) { - return Object.prototype.toString.call(shadowRoot) === "[object ShadowRoot]"; -} -__name(isNativeShadowDom, "isNativeShadowDom"); -function fixBrowserCompatibilityIssuesInCSS(cssText) { - if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) { - cssText = cssText.replace(/\sbackground-clip:\s*text;/g, " -webkit-background-clip: text; background-clip: text;"); - } - return cssText; -} -__name(fixBrowserCompatibilityIssuesInCSS, "fixBrowserCompatibilityIssuesInCSS"); -function escapeImportStatement(rule) { - const { cssText } = rule; - if (cssText.split('"').length < 3) - return cssText; - const statement = ["@import", `url(${JSON.stringify(rule.href)})`]; - if (rule.layerName === "") { - statement.push(`layer`); - } else if (rule.layerName) { - statement.push(`layer(${rule.layerName})`); - } - if (rule.supportsText) { - statement.push(`supports(${rule.supportsText})`); - } - if (rule.media.length) { - statement.push(rule.media.mediaText); - } - return statement.join(" ") + ";"; -} -__name(escapeImportStatement, "escapeImportStatement"); -function stringifyStylesheet(s2) { - try { - const rules = s2.rules || s2.cssRules; - return rules ? fixBrowserCompatibilityIssuesInCSS(Array.from(rules, stringifyRule).join("")) : null; - } catch (error2) { - return null; - } -} -__name(stringifyStylesheet, "stringifyStylesheet"); -function fixAllCssProperty(rule) { - let styles = ""; - for (let i2 = 0; i2 < rule.style.length; i2++) { - const styleDeclaration = rule.style; - const attribute2 = styleDeclaration[i2]; - const isImportant = styleDeclaration.getPropertyPriority(attribute2); - styles += `${attribute2}:${styleDeclaration.getPropertyValue(attribute2)}${isImportant ? ` !important` : ""};`; - } - return `${rule.selectorText} { ${styles} }`; -} -__name(fixAllCssProperty, "fixAllCssProperty"); -function stringifyRule(rule) { - let importStringified; - if (isCSSImportRule(rule)) { - try { - importStringified = stringifyStylesheet(rule.styleSheet) || escapeImportStatement(rule); - } catch (error2) { - } - } else if (isCSSStyleRule(rule)) { - let cssText = rule.cssText; - const needsSafariColonFix = rule.selectorText.includes(":"); - const needsAllFix = typeof rule.style["all"] === "string" && rule.style["all"]; - if (needsAllFix) { - cssText = fixAllCssProperty(rule); - } - if (needsSafariColonFix) { - cssText = fixSafariColons(cssText); - } - if (needsSafariColonFix || needsAllFix) { - return cssText; - } - } - return importStringified || rule.cssText; -} -__name(stringifyRule, "stringifyRule"); -function fixSafariColons(cssStringified) { - const regex2 = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm; - return cssStringified.replace(regex2, "$1\\$2"); -} -__name(fixSafariColons, "fixSafariColons"); -function isCSSImportRule(rule) { - return "styleSheet" in rule; -} -__name(isCSSImportRule, "isCSSImportRule"); -function isCSSStyleRule(rule) { - return "selectorText" in rule; -} -__name(isCSSStyleRule, "isCSSStyleRule"); -class Mirror { - static { - __name(this, "Mirror"); - } - constructor() { - this.idNodeMap = /* @__PURE__ */ new Map(); - this.nodeMetaMap = /* @__PURE__ */ new WeakMap(); - } - getId(n2) { - if (!n2) - return -1; - const id3 = _optionalChain$5([this, "access", (_3) => _3.getMeta, "call", (_4) => _4(n2), "optionalAccess", (_5) => _5.id]); - return _nullishCoalesce$1(id3, () => -1); - } - getNode(id3) { - return this.idNodeMap.get(id3) || null; - } - getIds() { - return Array.from(this.idNodeMap.keys()); - } - getMeta(n2) { - return this.nodeMetaMap.get(n2) || null; - } - removeNodeFromMap(n2) { - const id3 = this.getId(n2); - this.idNodeMap.delete(id3); - if (n2.childNodes) { - n2.childNodes.forEach((childNode) => this.removeNodeFromMap(childNode)); - } - } - has(id3) { - return this.idNodeMap.has(id3); - } - hasNode(node3) { - return this.nodeMetaMap.has(node3); - } - add(n2, meta) { - const id3 = meta.id; - this.idNodeMap.set(id3, n2); - this.nodeMetaMap.set(n2, meta); - } - replace(id3, n2) { - const oldNode = this.getNode(id3); - if (oldNode) { - const meta = this.nodeMetaMap.get(oldNode); - if (meta) - this.nodeMetaMap.set(n2, meta); - } - this.idNodeMap.set(id3, n2); - } - reset() { - this.idNodeMap = /* @__PURE__ */ new Map(); - this.nodeMetaMap = /* @__PURE__ */ new WeakMap(); - } -} -function createMirror() { - return new Mirror(); -} -__name(createMirror, "createMirror"); -function shouldMaskInput({ maskInputOptions, tagName, type }) { - if (tagName === "OPTION") { - tagName = "SELECT"; - } - return Boolean(maskInputOptions[tagName.toLowerCase()] || type && maskInputOptions[type] || type === "password" || tagName === "INPUT" && !type && maskInputOptions["text"]); -} -__name(shouldMaskInput, "shouldMaskInput"); -function maskInputValue({ isMasked: isMasked2, element, value: value4, maskInputFn }) { - let text2 = value4 || ""; - if (!isMasked2) { - return text2; - } - if (maskInputFn) { - text2 = maskInputFn(text2, element); - } - return "*".repeat(text2.length); -} -__name(maskInputValue, "maskInputValue"); -function toLowerCase(str) { - return str.toLowerCase(); -} -__name(toLowerCase, "toLowerCase"); -function toUpperCase(str) { - return str.toUpperCase(); -} -__name(toUpperCase, "toUpperCase"); -const ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__"; -function is2DCanvasBlank(canvas2) { - const ctx = canvas2.getContext("2d"); - if (!ctx) - return true; - const chunkSize = 50; - for (let x2 = 0; x2 < canvas2.width; x2 += chunkSize) { - for (let y2 = 0; y2 < canvas2.height; y2 += chunkSize) { - const getImageData = ctx.getImageData; - const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData; - const pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x2, y2, Math.min(chunkSize, canvas2.width - x2), Math.min(chunkSize, canvas2.height - y2)).data.buffer); - if (pixelBuffer.some((pixel) => pixel !== 0)) - return false; - } - } - return true; -} -__name(is2DCanvasBlank, "is2DCanvasBlank"); -function getInputType(element) { - const type = element.type; - return element.hasAttribute("data-rr-is-password") ? "password" : type ? toLowerCase(type) : null; -} -__name(getInputType, "getInputType"); -function getInputValue(el, tagName, type) { - if (tagName === "INPUT" && (type === "radio" || type === "checkbox")) { - return el.getAttribute("value") || ""; - } - return el.value; -} -__name(getInputValue, "getInputValue"); -function extractFileExtension(path, baseURL) { - let url; - try { - url = new URL(path, _nullishCoalesce$1(baseURL, () => window.location.href)); - } catch (err) { - return null; - } - const regex2 = /\.([0-9a-z]+)(?:$)/i; - const match2 = url.pathname.match(regex2); - return _nullishCoalesce$1(_optionalChain$5([match2, "optionalAccess", (_6) => _6[1]]), () => null); -} -__name(extractFileExtension, "extractFileExtension"); -const cachedImplementations$1 = {}; -function getImplementation$1(name2) { - const cached = cachedImplementations$1[name2]; - if (cached) { - return cached; - } - const document2 = window.document; - let impl = window[name2]; - if (document2 && typeof document2.createElement === "function") { - try { - const sandbox = document2.createElement("iframe"); - sandbox.hidden = true; - document2.head.appendChild(sandbox); - const contentWindow = sandbox.contentWindow; - if (contentWindow && contentWindow[name2]) { - impl = contentWindow[name2]; - } - document2.head.removeChild(sandbox); - } catch (e2) { - } - } - return cachedImplementations$1[name2] = impl.bind(window); -} -__name(getImplementation$1, "getImplementation$1"); -function setTimeout$2(...rest) { - return getImplementation$1("setTimeout")(...rest); -} -__name(setTimeout$2, "setTimeout$2"); -function clearTimeout$2(...rest) { - return getImplementation$1("clearTimeout")(...rest); -} -__name(clearTimeout$2, "clearTimeout$2"); -function getIframeContentDocument(iframe) { - try { - return iframe.contentDocument; - } catch (e2) { - } -} -__name(getIframeContentDocument, "getIframeContentDocument"); -let _id$3 = 1; -const tagNameRegex = new RegExp("[^a-z0-9-_:]"); -const IGNORED_NODE = -2; -function genId() { - return _id$3++; -} -__name(genId, "genId"); -function getValidTagName(element) { - if (element instanceof HTMLFormElement) { - return "form"; - } - const processedTagName = toLowerCase(element.tagName); - if (tagNameRegex.test(processedTagName)) { - return "div"; - } - return processedTagName; -} -__name(getValidTagName, "getValidTagName"); -function extractOrigin(url) { - let origin2 = ""; - if (url.indexOf("//") > -1) { - origin2 = url.split("/").slice(0, 3).join("/"); - } else { - origin2 = url.split("/")[0]; - } - origin2 = origin2.split("?")[0]; - return origin2; -} -__name(extractOrigin, "extractOrigin"); -let canvasService; -let canvasCtx; -const URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm; -const URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\/\//i; -const URL_WWW_MATCH = /^www\..*/i; -const DATA_URI = /^(data:)([^,]*),(.*)/i; -function absoluteToStylesheet(cssText, href) { - return (cssText || "").replace(URL_IN_CSS_REF, (origin2, quote1, path1, quote2, path2, path3) => { - const filePath = path1 || path2 || path3; - const maybeQuote = quote1 || quote2 || ""; - if (!filePath) { - return origin2; - } - if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) { - return `url(${maybeQuote}${filePath}${maybeQuote})`; - } - if (DATA_URI.test(filePath)) { - return `url(${maybeQuote}${filePath}${maybeQuote})`; - } - if (filePath[0] === "/") { - return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`; - } - const stack2 = href.split("/"); - const parts2 = filePath.split("/"); - stack2.pop(); - for (const part of parts2) { - if (part === ".") { - continue; - } else if (part === "..") { - stack2.pop(); - } else { - stack2.push(part); - } - } - return `url(${maybeQuote}${stack2.join("/")}${maybeQuote})`; - }); -} -__name(absoluteToStylesheet, "absoluteToStylesheet"); -const SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/; -const SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/; -function getAbsoluteSrcsetString(doc2, attributeValue) { - if (attributeValue.trim() === "") { - return attributeValue; - } - let pos = 0; - function collectCharacters(regEx) { - let chars2; - const match2 = regEx.exec(attributeValue.substring(pos)); - if (match2) { - chars2 = match2[0]; - pos += chars2.length; - return chars2; - } - return ""; - } - __name(collectCharacters, "collectCharacters"); - const output = []; - while (true) { - collectCharacters(SRCSET_COMMAS_OR_SPACES); - if (pos >= attributeValue.length) { - break; - } - let url = collectCharacters(SRCSET_NOT_SPACES); - if (url.slice(-1) === ",") { - url = absoluteToDoc(doc2, url.substring(0, url.length - 1)); - output.push(url); - } else { - let descriptorsStr = ""; - url = absoluteToDoc(doc2, url); - let inParens = false; - while (true) { - const c2 = attributeValue.charAt(pos); - if (c2 === "") { - output.push((url + descriptorsStr).trim()); - break; - } else if (!inParens) { - if (c2 === ",") { - pos += 1; - output.push((url + descriptorsStr).trim()); - break; - } else if (c2 === "(") { - inParens = true; - } - } else { - if (c2 === ")") { - inParens = false; - } - } - descriptorsStr += c2; - pos += 1; - } - } - } - return output.join(", "); -} -__name(getAbsoluteSrcsetString, "getAbsoluteSrcsetString"); -const cachedDocument = /* @__PURE__ */ new WeakMap(); -function absoluteToDoc(doc2, attributeValue) { - if (!attributeValue || attributeValue.trim() === "") { - return attributeValue; - } - return getHref(doc2, attributeValue); -} -__name(absoluteToDoc, "absoluteToDoc"); -function isSVGElement(el) { - return Boolean(el.tagName === "svg" || el.ownerSVGElement); -} -__name(isSVGElement, "isSVGElement"); -function getHref(doc2, customHref) { - let a2 = cachedDocument.get(doc2); - if (!a2) { - a2 = doc2.createElement("a"); - cachedDocument.set(doc2, a2); - } - if (!customHref) { - customHref = ""; - } else if (customHref.startsWith("blob:") || customHref.startsWith("data:")) { - return customHref; - } - a2.setAttribute("href", customHref); - return a2.href; -} -__name(getHref, "getHref"); -function transformAttribute(doc2, tagName, name2, value4, element, maskAttributeFn) { - if (!value4) { - return value4; - } - if (name2 === "src" || name2 === "href" && !(tagName === "use" && value4[0] === "#")) { - return absoluteToDoc(doc2, value4); - } else if (name2 === "xlink:href" && value4[0] !== "#") { - return absoluteToDoc(doc2, value4); - } else if (name2 === "background" && (tagName === "table" || tagName === "td" || tagName === "th")) { - return absoluteToDoc(doc2, value4); - } else if (name2 === "srcset") { - return getAbsoluteSrcsetString(doc2, value4); - } else if (name2 === "style") { - return absoluteToStylesheet(value4, getHref(doc2)); - } else if (tagName === "object" && name2 === "data") { - return absoluteToDoc(doc2, value4); - } - if (typeof maskAttributeFn === "function") { - return maskAttributeFn(name2, value4, element); - } - return value4; -} -__name(transformAttribute, "transformAttribute"); -function ignoreAttribute(tagName, name2, _value) { - return (tagName === "video" || tagName === "audio") && name2 === "autoplay"; -} -__name(ignoreAttribute, "ignoreAttribute"); -function _isBlockedElement(element, blockClass, blockSelector, unblockSelector) { - try { - if (unblockSelector && element.matches(unblockSelector)) { - return false; - } - if (typeof blockClass === "string") { - if (element.classList.contains(blockClass)) { - return true; - } - } else { - for (let eIndex = element.classList.length; eIndex--; ) { - const className = element.classList[eIndex]; - if (blockClass.test(className)) { - return true; - } - } - } - if (blockSelector) { - return element.matches(blockSelector); - } - } catch (e2) { - } - return false; -} -__name(_isBlockedElement, "_isBlockedElement"); -function elementClassMatchesRegex$1(el, regex2) { - for (let eIndex = el.classList.length; eIndex--; ) { - const className = el.classList[eIndex]; - if (regex2.test(className)) { - return true; - } - } - return false; -} -__name(elementClassMatchesRegex$1, "elementClassMatchesRegex$1"); -function distanceToMatch$1(node3, matchPredicate, limit = Infinity, distance2 = 0) { - if (!node3) - return -1; - if (node3.nodeType !== node3.ELEMENT_NODE) - return -1; - if (distance2 > limit) - return -1; - if (matchPredicate(node3)) - return distance2; - return distanceToMatch$1(node3.parentNode, matchPredicate, limit, distance2 + 1); -} -__name(distanceToMatch$1, "distanceToMatch$1"); -function createMatchPredicate$1(className, selector) { - return (node3) => { - const el = node3; - if (el === null) - return false; - try { - if (className) { - if (typeof className === "string") { - if (el.matches(`.${className}`)) - return true; - } else if (elementClassMatchesRegex$1(el, className)) { - return true; - } - } - if (selector && el.matches(selector)) - return true; - return false; - } catch (e2) { - return false; - } - }; -} -__name(createMatchPredicate$1, "createMatchPredicate$1"); -function needMaskingText(node3, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, maskAllText) { - try { - const el = node3.nodeType === node3.ELEMENT_NODE ? node3 : node3.parentElement; - if (el === null) - return false; - if (el.tagName === "INPUT") { - const autocomplete = el.getAttribute("autocomplete"); - const disallowedAutocompleteValues = [ - "current-password", - "new-password", - "cc-number", - "cc-exp", - "cc-exp-month", - "cc-exp-year", - "cc-csc" - ]; - if (disallowedAutocompleteValues.includes(autocomplete)) { - return true; - } - } - let maskDistance = -1; - let unmaskDistance = -1; - if (maskAllText) { - unmaskDistance = distanceToMatch$1(el, createMatchPredicate$1(unmaskTextClass, unmaskTextSelector)); - if (unmaskDistance < 0) { - return true; - } - maskDistance = distanceToMatch$1(el, createMatchPredicate$1(maskTextClass, maskTextSelector), unmaskDistance >= 0 ? unmaskDistance : Infinity); - } else { - maskDistance = distanceToMatch$1(el, createMatchPredicate$1(maskTextClass, maskTextSelector)); - if (maskDistance < 0) { - return false; - } - unmaskDistance = distanceToMatch$1(el, createMatchPredicate$1(unmaskTextClass, unmaskTextSelector), maskDistance >= 0 ? maskDistance : Infinity); - } - return maskDistance >= 0 ? unmaskDistance >= 0 ? maskDistance <= unmaskDistance : true : unmaskDistance >= 0 ? false : !!maskAllText; - } catch (e2) { - } - return !!maskAllText; -} -__name(needMaskingText, "needMaskingText"); -function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) { - const win = iframeEl.contentWindow; - if (!win) { - return; - } - let fired = false; - let readyState; - try { - readyState = win.document.readyState; - } catch (error2) { - return; - } - if (readyState !== "complete") { - const timer = setTimeout$2(() => { - if (!fired) { - listener(); - fired = true; - } - }, iframeLoadTimeout); - iframeEl.addEventListener("load", () => { - clearTimeout$2(timer); - fired = true; - listener(); - }); - return; - } - const blankUrl = "about:blank"; - if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") { - setTimeout$2(listener, 0); - return iframeEl.addEventListener("load", listener); - } - iframeEl.addEventListener("load", listener); -} -__name(onceIframeLoaded, "onceIframeLoaded"); -function onceStylesheetLoaded(link2, listener, styleSheetLoadTimeout) { - let fired = false; - let styleSheetLoaded; - try { - styleSheetLoaded = link2.sheet; - } catch (error2) { - return; - } - if (styleSheetLoaded) - return; - const timer = setTimeout$2(() => { - if (!fired) { - listener(); - fired = true; - } - }, styleSheetLoadTimeout); - link2.addEventListener("load", () => { - clearTimeout$2(timer); - fired = true; - listener(); - }); -} -__name(onceStylesheetLoaded, "onceStylesheetLoaded"); -function serializeNode(n2, options4) { - const { doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, maskAllText, maskAttributeFn, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, inlineStylesheet, maskInputOptions = {}, maskTextFn, maskInputFn, dataURLOptions = {}, inlineImages, recordCanvas, keepIframeSrcFn, newlyAddedElement = false } = options4; - const rootId = getRootId(doc2, mirror2); - switch (n2.nodeType) { - case n2.DOCUMENT_NODE: - if (n2.compatMode !== "CSS1Compat") { - return { - type: NodeType$3.Document, - childNodes: [], - compatMode: n2.compatMode - }; - } else { - return { - type: NodeType$3.Document, - childNodes: [] - }; - } - case n2.DOCUMENT_TYPE_NODE: - return { - type: NodeType$3.DocumentType, - name: n2.name, - publicId: n2.publicId, - systemId: n2.systemId, - rootId - }; - case n2.ELEMENT_NODE: - return serializeElementNode(n2, { - doc: doc2, - blockClass, - blockSelector, - unblockSelector, - inlineStylesheet, - maskAttributeFn, - maskInputOptions, - maskInputFn, - dataURLOptions, - inlineImages, - recordCanvas, - keepIframeSrcFn, - newlyAddedElement, - rootId, - maskAllText, - maskTextClass, - unmaskTextClass, - maskTextSelector, - unmaskTextSelector - }); - case n2.TEXT_NODE: - return serializeTextNode(n2, { - doc: doc2, - maskAllText, - maskTextClass, - unmaskTextClass, - maskTextSelector, - unmaskTextSelector, - maskTextFn, - maskInputOptions, - maskInputFn, - rootId - }); - case n2.CDATA_SECTION_NODE: - return { - type: NodeType$3.CDATA, - textContent: "", - rootId - }; - case n2.COMMENT_NODE: - return { - type: NodeType$3.Comment, - textContent: n2.textContent || "", - rootId - }; - default: - return false; - } -} -__name(serializeNode, "serializeNode"); -function getRootId(doc2, mirror2) { - if (!mirror2.hasNode(doc2)) - return void 0; - const docId = mirror2.getId(doc2); - return docId === 1 ? void 0 : docId; -} -__name(getRootId, "getRootId"); -function serializeTextNode(n2, options4) { - const { maskAllText, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, maskTextFn, maskInputOptions, maskInputFn, rootId } = options4; - const parentTagName = n2.parentNode && n2.parentNode.tagName; - let textContent = n2.textContent; - const isStyle = parentTagName === "STYLE" ? true : void 0; - const isScript = parentTagName === "SCRIPT" ? true : void 0; - const isTextarea = parentTagName === "TEXTAREA" ? true : void 0; - if (isStyle && textContent) { - try { - if (n2.nextSibling || n2.previousSibling) { - } else if (_optionalChain$5([n2, "access", (_7) => _7.parentNode, "access", (_8) => _8.sheet, "optionalAccess", (_9) => _9.cssRules])) { - textContent = stringifyStylesheet(n2.parentNode.sheet); - } - } catch (err) { - console.warn(`Cannot get CSS styles from text's parentNode. Error: ${err}`, n2); - } - textContent = absoluteToStylesheet(textContent, getHref(options4.doc)); - } - if (isScript) { - textContent = "SCRIPT_PLACEHOLDER"; - } - const forceMask = needMaskingText(n2, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, maskAllText); - if (!isStyle && !isScript && !isTextarea && textContent && forceMask) { - textContent = maskTextFn ? maskTextFn(textContent, n2.parentElement) : textContent.replace(/[\S]/g, "*"); - } - if (isTextarea && textContent && (maskInputOptions.textarea || forceMask)) { - textContent = maskInputFn ? maskInputFn(textContent, n2.parentNode) : textContent.replace(/[\S]/g, "*"); - } - if (parentTagName === "OPTION" && textContent) { - const isInputMasked = shouldMaskInput({ - type: null, - tagName: parentTagName, - maskInputOptions - }); - textContent = maskInputValue({ - isMasked: needMaskingText(n2, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, isInputMasked), - element: n2, - value: textContent, - maskInputFn - }); - } - return { - type: NodeType$3.Text, - textContent: textContent || "", - isStyle, - rootId - }; -} -__name(serializeTextNode, "serializeTextNode"); -function serializeElementNode(n2, options4) { - const { doc: doc2, blockClass, blockSelector, unblockSelector, inlineStylesheet, maskInputOptions = {}, maskAttributeFn, maskInputFn, dataURLOptions = {}, inlineImages, recordCanvas, keepIframeSrcFn, newlyAddedElement = false, rootId, maskAllText, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector } = options4; - const needBlock = _isBlockedElement(n2, blockClass, blockSelector, unblockSelector); - const tagName = getValidTagName(n2); - let attributes = {}; - const len = n2.attributes.length; - for (let i2 = 0; i2 < len; i2++) { - const attr = n2.attributes[i2]; - if (attr.name && !ignoreAttribute(tagName, attr.name, attr.value)) { - attributes[attr.name] = transformAttribute(doc2, tagName, toLowerCase(attr.name), attr.value, n2, maskAttributeFn); - } - } - if (tagName === "link" && inlineStylesheet) { - const stylesheet = Array.from(doc2.styleSheets).find((s2) => { - return s2.href === n2.href; - }); - let cssText = null; - if (stylesheet) { - cssText = stringifyStylesheet(stylesheet); - } - if (cssText) { - attributes.rel = null; - attributes.href = null; - attributes.crossorigin = null; - attributes._cssText = absoluteToStylesheet(cssText, stylesheet.href); - } - } - if (tagName === "style" && n2.sheet && !(n2.innerText || n2.textContent || "").trim().length) { - const cssText = stringifyStylesheet(n2.sheet); - if (cssText) { - attributes._cssText = absoluteToStylesheet(cssText, getHref(doc2)); - } - } - if (tagName === "input" || tagName === "textarea" || tagName === "select" || tagName === "option") { - const el = n2; - const type = getInputType(el); - const value4 = getInputValue(el, toUpperCase(tagName), type); - const checked4 = el.checked; - if (type !== "submit" && type !== "button" && value4) { - const forceMask = needMaskingText(el, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, shouldMaskInput({ - type, - tagName: toUpperCase(tagName), - maskInputOptions - })); - attributes.value = maskInputValue({ - isMasked: forceMask, - element: el, - value: value4, - maskInputFn - }); - } - if (checked4) { - attributes.checked = checked4; - } - } - if (tagName === "option") { - if (n2.selected && !maskInputOptions["select"]) { - attributes.selected = true; - } else { - delete attributes.selected; - } - } - if (tagName === "canvas" && recordCanvas) { - if (n2.__context === "2d") { - if (!is2DCanvasBlank(n2)) { - attributes.rr_dataURL = n2.toDataURL(dataURLOptions.type, dataURLOptions.quality); - } - } else if (!("__context" in n2)) { - const canvasDataURL = n2.toDataURL(dataURLOptions.type, dataURLOptions.quality); - const blankCanvas = doc2.createElement("canvas"); - blankCanvas.width = n2.width; - blankCanvas.height = n2.height; - const blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality); - if (canvasDataURL !== blankCanvasDataURL) { - attributes.rr_dataURL = canvasDataURL; - } - } - } - if (tagName === "img" && inlineImages) { - if (!canvasService) { - canvasService = doc2.createElement("canvas"); - canvasCtx = canvasService.getContext("2d"); - } - const image2 = n2; - const imageSrc = image2.currentSrc || image2.getAttribute("src") || ""; - const priorCrossOrigin = image2.crossOrigin; - const recordInlineImage = /* @__PURE__ */ __name(() => { - image2.removeEventListener("load", recordInlineImage); - try { - canvasService.width = image2.naturalWidth; - canvasService.height = image2.naturalHeight; - canvasCtx.drawImage(image2, 0, 0); - attributes.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality); - } catch (err) { - if (image2.crossOrigin !== "anonymous") { - image2.crossOrigin = "anonymous"; - if (image2.complete && image2.naturalWidth !== 0) - recordInlineImage(); - else - image2.addEventListener("load", recordInlineImage); - return; - } else { - console.warn(`Cannot inline img src=${imageSrc}! Error: ${err}`); - } - } - if (image2.crossOrigin === "anonymous") { - priorCrossOrigin ? attributes.crossOrigin = priorCrossOrigin : image2.removeAttribute("crossorigin"); - } - }, "recordInlineImage"); - if (image2.complete && image2.naturalWidth !== 0) - recordInlineImage(); - else - image2.addEventListener("load", recordInlineImage); - } - if (tagName === "audio" || tagName === "video") { - attributes.rr_mediaState = n2.paused ? "paused" : "played"; - attributes.rr_mediaCurrentTime = n2.currentTime; - } - if (!newlyAddedElement) { - if (n2.scrollLeft) { - attributes.rr_scrollLeft = n2.scrollLeft; - } - if (n2.scrollTop) { - attributes.rr_scrollTop = n2.scrollTop; - } - } - if (needBlock) { - const { width: width2, height } = n2.getBoundingClientRect(); - attributes = { - class: attributes.class, - rr_width: `${width2}px`, - rr_height: `${height}px` - }; - } - if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) { - if (!needBlock && !getIframeContentDocument(n2)) { - attributes.rr_src = attributes.src; - } - delete attributes.src; - } - let isCustomElement; - try { - if (customElements.get(tagName)) - isCustomElement = true; - } catch (e2) { - } - return { - type: NodeType$3.Element, - tagName, - attributes, - childNodes: [], - isSVG: isSVGElement(n2) || void 0, - needBlock, - rootId, - isCustom: isCustomElement - }; -} -__name(serializeElementNode, "serializeElementNode"); -function lowerIfExists(maybeAttr) { - if (maybeAttr === void 0 || maybeAttr === null) { - return ""; - } else { - return maybeAttr.toLowerCase(); - } -} -__name(lowerIfExists, "lowerIfExists"); -function slimDOMExcluded(sn, slimDOMOptions) { - if (slimDOMOptions.comment && sn.type === NodeType$3.Comment) { - return true; - } else if (sn.type === NodeType$3.Element) { - if (slimDOMOptions.script && (sn.tagName === "script" || sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") || sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) { - return true; - } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) || lowerIfExists(sn.attributes.name) === "application-name" || lowerIfExists(sn.attributes.rel) === "icon" || lowerIfExists(sn.attributes.rel) === "apple-touch-icon" || lowerIfExists(sn.attributes.rel) === "shortcut icon"))) { - return true; - } else if (sn.tagName === "meta") { - if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) { - return true; - } else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) { - return true; - } else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) { - return true; - } else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) { - return true; - } else if (slimDOMOptions.headMetaAuthorship && (lowerIfExists(sn.attributes.name) === "author" || lowerIfExists(sn.attributes.name) === "generator" || lowerIfExists(sn.attributes.name) === "framework" || lowerIfExists(sn.attributes.name) === "publisher" || lowerIfExists(sn.attributes.name) === "progid" || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) { - return true; - } else if (slimDOMOptions.headMetaVerification && (lowerIfExists(sn.attributes.name) === "google-site-verification" || lowerIfExists(sn.attributes.name) === "yandex-verification" || lowerIfExists(sn.attributes.name) === "csrf-token" || lowerIfExists(sn.attributes.name) === "p:domain_verify" || lowerIfExists(sn.attributes.name) === "verify-v1" || lowerIfExists(sn.attributes.name) === "verification" || lowerIfExists(sn.attributes.name) === "shopify-checkout-api-token")) { - return true; - } - } - } - return false; -} -__name(slimDOMExcluded, "slimDOMExcluded"); -function serializeNodeWithId(n2, options4) { - const { doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, maskAllText, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, skipChild = false, inlineStylesheet = true, maskInputOptions = {}, maskAttributeFn, maskTextFn, maskInputFn, slimDOMOptions, dataURLOptions = {}, inlineImages = false, recordCanvas = false, onSerialize, onIframeLoad, iframeLoadTimeout = 5e3, onStylesheetLoad, stylesheetLoadTimeout = 5e3, keepIframeSrcFn = /* @__PURE__ */ __name(() => false, "keepIframeSrcFn"), newlyAddedElement = false } = options4; - let { preserveWhiteSpace = true } = options4; - const _serializedNode = serializeNode(n2, { - doc: doc2, - mirror: mirror2, - blockClass, - blockSelector, - maskAllText, - unblockSelector, - maskTextClass, - unmaskTextClass, - maskTextSelector, - unmaskTextSelector, - inlineStylesheet, - maskInputOptions, - maskAttributeFn, - maskTextFn, - maskInputFn, - dataURLOptions, - inlineImages, - recordCanvas, - keepIframeSrcFn, - newlyAddedElement - }); - if (!_serializedNode) { - console.warn(n2, "not serialized"); - return null; - } - let id3; - if (mirror2.hasNode(n2)) { - id3 = mirror2.getId(n2); - } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$3.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) { - id3 = IGNORED_NODE; - } else { - id3 = genId(); - } - const serializedNode = Object.assign(_serializedNode, { id: id3 }); - mirror2.add(n2, serializedNode); - if (id3 === IGNORED_NODE) { - return null; - } - if (onSerialize) { - onSerialize(n2); - } - let recordChild = !skipChild; - if (serializedNode.type === NodeType$3.Element) { - recordChild = recordChild && !serializedNode.needBlock; - delete serializedNode.needBlock; - const shadowRoot = n2.shadowRoot; - if (shadowRoot && isNativeShadowDom(shadowRoot)) - serializedNode.isShadowHost = true; - } - if ((serializedNode.type === NodeType$3.Document || serializedNode.type === NodeType$3.Element) && recordChild) { - if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$3.Element && serializedNode.tagName === "head") { - preserveWhiteSpace = false; - } - const bypassOptions = { - doc: doc2, - mirror: mirror2, - blockClass, - blockSelector, - maskAllText, - unblockSelector, - maskTextClass, - unmaskTextClass, - maskTextSelector, - unmaskTextSelector, - skipChild, - inlineStylesheet, - maskInputOptions, - maskAttributeFn, - maskTextFn, - maskInputFn, - slimDOMOptions, - dataURLOptions, - inlineImages, - recordCanvas, - preserveWhiteSpace, - onSerialize, - onIframeLoad, - iframeLoadTimeout, - onStylesheetLoad, - stylesheetLoadTimeout, - keepIframeSrcFn - }; - for (const childN of Array.from(n2.childNodes)) { - const serializedChildNode = serializeNodeWithId(childN, bypassOptions); - if (serializedChildNode) { - serializedNode.childNodes.push(serializedChildNode); - } - } - if (isElement$1$1(n2) && n2.shadowRoot) { - for (const childN of Array.from(n2.shadowRoot.childNodes)) { - const serializedChildNode = serializeNodeWithId(childN, bypassOptions); - if (serializedChildNode) { - isNativeShadowDom(n2.shadowRoot) && (serializedChildNode.isShadow = true); - serializedNode.childNodes.push(serializedChildNode); - } - } - } - } - if (n2.parentNode && isShadowRoot(n2.parentNode) && isNativeShadowDom(n2.parentNode)) { - serializedNode.isShadow = true; - } - if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe") { - onceIframeLoaded(n2, () => { - const iframeDoc = getIframeContentDocument(n2); - if (iframeDoc && onIframeLoad) { - const serializedIframeNode = serializeNodeWithId(iframeDoc, { - doc: iframeDoc, - mirror: mirror2, - blockClass, - blockSelector, - unblockSelector, - maskAllText, - maskTextClass, - unmaskTextClass, - maskTextSelector, - unmaskTextSelector, - skipChild: false, - inlineStylesheet, - maskInputOptions, - maskAttributeFn, - maskTextFn, - maskInputFn, - slimDOMOptions, - dataURLOptions, - inlineImages, - recordCanvas, - preserveWhiteSpace, - onSerialize, - onIframeLoad, - iframeLoadTimeout, - onStylesheetLoad, - stylesheetLoadTimeout, - keepIframeSrcFn - }); - if (serializedIframeNode) { - onIframeLoad(n2, serializedIframeNode); - } - } - }, iframeLoadTimeout); - } - if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && extractFileExtension(serializedNode.attributes.href) === "css")) { - onceStylesheetLoaded(n2, () => { - if (onStylesheetLoad) { - const serializedLinkNode = serializeNodeWithId(n2, { - doc: doc2, - mirror: mirror2, - blockClass, - blockSelector, - unblockSelector, - maskAllText, - maskTextClass, - unmaskTextClass, - maskTextSelector, - unmaskTextSelector, - skipChild: false, - inlineStylesheet, - maskInputOptions, - maskAttributeFn, - maskTextFn, - maskInputFn, - slimDOMOptions, - dataURLOptions, - inlineImages, - recordCanvas, - preserveWhiteSpace, - onSerialize, - onIframeLoad, - iframeLoadTimeout, - onStylesheetLoad, - stylesheetLoadTimeout, - keepIframeSrcFn - }); - if (serializedLinkNode) { - onStylesheetLoad(n2, serializedLinkNode); - } - } - }, stylesheetLoadTimeout); - } - return serializedNode; -} -__name(serializeNodeWithId, "serializeNodeWithId"); -function snapshot(n2, options4) { - const { mirror: mirror2 = new Mirror(), blockClass = "rr-block", blockSelector = null, unblockSelector = null, maskAllText = false, maskTextClass = "rr-mask", unmaskTextClass = null, maskTextSelector = null, unmaskTextSelector = null, inlineStylesheet = true, inlineImages = false, recordCanvas = false, maskAllInputs = false, maskAttributeFn, maskTextFn, maskInputFn, slimDOM = false, dataURLOptions, preserveWhiteSpace, onSerialize, onIframeLoad, iframeLoadTimeout, onStylesheetLoad, stylesheetLoadTimeout, keepIframeSrcFn = /* @__PURE__ */ __name(() => false, "keepIframeSrcFn") } = options4 || {}; - const maskInputOptions = maskAllInputs === true ? { - color: true, - date: true, - "datetime-local": true, - email: true, - month: true, - number: true, - range: true, - search: true, - tel: true, - text: true, - time: true, - url: true, - week: true, - textarea: true, - select: true - } : maskAllInputs === false ? {} : maskAllInputs; - const slimDOMOptions = slimDOM === true || slimDOM === "all" ? { - script: true, - comment: true, - headFavicon: true, - headWhitespace: true, - headMetaDescKeywords: slimDOM === "all", - headMetaSocial: true, - headMetaRobots: true, - headMetaHttpEquiv: true, - headMetaAuthorship: true, - headMetaVerification: true - } : slimDOM === false ? {} : slimDOM; - return serializeNodeWithId(n2, { - doc: n2, - mirror: mirror2, - blockClass, - blockSelector, - unblockSelector, - maskAllText, - maskTextClass, - unmaskTextClass, - maskTextSelector, - unmaskTextSelector, - skipChild: false, - inlineStylesheet, - maskInputOptions, - maskAttributeFn, - maskTextFn, - maskInputFn, - slimDOMOptions, - dataURLOptions, - inlineImages, - recordCanvas, - preserveWhiteSpace, - onSerialize, - onIframeLoad, - iframeLoadTimeout, - onStylesheetLoad, - stylesheetLoadTimeout, - keepIframeSrcFn, - newlyAddedElement: false - }); -} -__name(snapshot, "snapshot"); -function _optionalChain$4(ops) { - let lastAccessLHS = void 0; - let value4 = ops[0]; - let i2 = 1; - while (i2 < ops.length) { - const op = ops[i2]; - const fn = ops[i2 + 1]; - i2 += 2; - if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { - return void 0; - } - if (op === "access" || op === "optionalAccess") { - lastAccessLHS = value4; - value4 = fn(value4); - } else if (op === "call" || op === "optionalCall") { - value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); - lastAccessLHS = void 0; - } - } - return value4; -} -__name(_optionalChain$4, "_optionalChain$4"); -function on(type, fn, target2 = document) { - const options4 = { capture: true, passive: true }; - target2.addEventListener(type, fn, options4); - return () => target2.removeEventListener(type, fn, options4); -} -__name(on, "on"); -const DEPARTED_MIRROR_ACCESS_WARNING$1 = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording."; -let _mirror$1 = { - map: {}, - getId() { - console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); - return -1; - }, - getNode() { - console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); - return null; - }, - removeNodeFromMap() { - console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); - }, - has() { - console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); - return false; - }, - reset() { - console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); - } -}; -if (typeof window !== "undefined" && window.Proxy && window.Reflect) { - _mirror$1 = new Proxy(_mirror$1, { - get(target2, prop2, receiver) { - if (prop2 === "map") { - console.error(DEPARTED_MIRROR_ACCESS_WARNING$1); - } - return Reflect.get(target2, prop2, receiver); - } - }); -} -function throttle$1(func, wait, options4 = {}) { - let timeout = null; - let previous = 0; - return function(...args) { - const now2 = Date.now(); - if (!previous && options4.leading === false) { - previous = now2; - } - const remaining = wait - (now2 - previous); - const context = this; - if (remaining <= 0 || remaining > wait) { - if (timeout) { - clearTimeout$1(timeout); - timeout = null; - } - previous = now2; - func.apply(context, args); - } else if (!timeout && options4.trailing !== false) { - timeout = setTimeout$1$1(() => { - previous = options4.leading === false ? 0 : Date.now(); - timeout = null; - func.apply(context, args); - }, remaining); - } - }; -} -__name(throttle$1, "throttle$1"); -function hookSetter$1(target2, key, d2, isRevoked, win = window) { - const original = win.Object.getOwnPropertyDescriptor(target2, key); - win.Object.defineProperty(target2, key, isRevoked ? d2 : { - set(value4) { - setTimeout$1$1(() => { - d2.set.call(this, value4); - }, 0); - if (original && original.set) { - original.set.call(this, value4); - } - } - }); - return () => hookSetter$1(target2, key, original || {}, true); -} -__name(hookSetter$1, "hookSetter$1"); -function patch$2(source, name2, replacement) { - try { - if (!(name2 in source)) { - return () => { - }; - } - const original = source[name2]; - const wrapped = replacement(original); - if (typeof wrapped === "function") { - wrapped.prototype = wrapped.prototype || {}; - Object.defineProperties(wrapped, { - __rrweb_original__: { - enumerable: false, - value: original - } - }); - } - source[name2] = wrapped; - return () => { - source[name2] = original; - }; - } catch (e2) { - return () => { - }; - } -} -__name(patch$2, "patch$2"); -let nowTimestamp = Date.now; -if (!/[1-9][0-9]{12}/.test(Date.now().toString())) { - nowTimestamp = /* @__PURE__ */ __name(() => (/* @__PURE__ */ new Date()).getTime(), "nowTimestamp"); -} -function getWindowScroll(win) { - const doc2 = win.document; - return { - left: doc2.scrollingElement ? doc2.scrollingElement.scrollLeft : win.pageXOffset !== void 0 ? win.pageXOffset : _optionalChain$4([doc2, "optionalAccess", (_2) => _2.documentElement, "access", (_2) => _2.scrollLeft]) || _optionalChain$4([doc2, "optionalAccess", (_3) => _3.body, "optionalAccess", (_4) => _4.parentElement, "optionalAccess", (_5) => _5.scrollLeft]) || _optionalChain$4([doc2, "optionalAccess", (_6) => _6.body, "optionalAccess", (_7) => _7.scrollLeft]) || 0, - top: doc2.scrollingElement ? doc2.scrollingElement.scrollTop : win.pageYOffset !== void 0 ? win.pageYOffset : _optionalChain$4([doc2, "optionalAccess", (_8) => _8.documentElement, "access", (_9) => _9.scrollTop]) || _optionalChain$4([doc2, "optionalAccess", (_10) => _10.body, "optionalAccess", (_11) => _11.parentElement, "optionalAccess", (_12) => _12.scrollTop]) || _optionalChain$4([doc2, "optionalAccess", (_13) => _13.body, "optionalAccess", (_14) => _14.scrollTop]) || 0 - }; -} -__name(getWindowScroll, "getWindowScroll"); -function getWindowHeight() { - return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight; -} -__name(getWindowHeight, "getWindowHeight"); -function getWindowWidth() { - return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth; -} -__name(getWindowWidth, "getWindowWidth"); -function closestElementOfNode$1(node3) { - if (!node3) { - return null; - } - const el = node3.nodeType === node3.ELEMENT_NODE ? node3 : node3.parentElement; - return el; -} -__name(closestElementOfNode$1, "closestElementOfNode$1"); -function isBlocked$1(node3, blockClass, blockSelector, unblockSelector, checkAncestors) { - if (!node3) { - return false; - } - const el = closestElementOfNode$1(node3); - if (!el) { - return false; - } - const blockedPredicate = createMatchPredicate$1(blockClass, blockSelector); - if (!checkAncestors) { - const isUnblocked = unblockSelector && el.matches(unblockSelector); - return blockedPredicate(el) && !isUnblocked; - } - const blockDistance = distanceToMatch$1(el, blockedPredicate); - let unblockDistance = -1; - if (blockDistance < 0) { - return false; - } - if (unblockSelector) { - unblockDistance = distanceToMatch$1(el, createMatchPredicate$1(null, unblockSelector)); - } - if (blockDistance > -1 && unblockDistance < 0) { - return true; - } - return blockDistance < unblockDistance; -} -__name(isBlocked$1, "isBlocked$1"); -function isSerialized(n2, mirror2) { - return mirror2.getId(n2) !== -1; -} -__name(isSerialized, "isSerialized"); -function isIgnored(n2, mirror2) { - return mirror2.getId(n2) === IGNORED_NODE; -} -__name(isIgnored, "isIgnored"); -function isAncestorRemoved(target2, mirror2) { - if (isShadowRoot(target2)) { - return false; - } - const id3 = mirror2.getId(target2); - if (!mirror2.has(id3)) { - return true; - } - if (target2.parentNode && target2.parentNode.nodeType === target2.DOCUMENT_NODE) { - return false; - } - if (!target2.parentNode) { - return true; - } - return isAncestorRemoved(target2.parentNode, mirror2); -} -__name(isAncestorRemoved, "isAncestorRemoved"); -function legacy_isTouchEvent(event) { - return Boolean(event.changedTouches); -} -__name(legacy_isTouchEvent, "legacy_isTouchEvent"); -function polyfill(win = window) { - if ("NodeList" in win && !win.NodeList.prototype.forEach) { - win.NodeList.prototype.forEach = Array.prototype.forEach; - } - if ("DOMTokenList" in win && !win.DOMTokenList.prototype.forEach) { - win.DOMTokenList.prototype.forEach = Array.prototype.forEach; - } - if (!Node.prototype.contains) { - Node.prototype.contains = (...args) => { - let node3 = args[0]; - if (!(0 in args)) { - throw new TypeError("1 argument is required"); - } - do { - if (this === node3) { - return true; - } - } while (node3 = node3 && node3.parentNode); - return false; - }; - } -} -__name(polyfill, "polyfill"); -function isSerializedIframe(n2, mirror2) { - return Boolean(n2.nodeName === "IFRAME" && mirror2.getMeta(n2)); -} -__name(isSerializedIframe, "isSerializedIframe"); -function isSerializedStylesheet(n2, mirror2) { - return Boolean(n2.nodeName === "LINK" && n2.nodeType === n2.ELEMENT_NODE && n2.getAttribute && n2.getAttribute("rel") === "stylesheet" && mirror2.getMeta(n2)); -} -__name(isSerializedStylesheet, "isSerializedStylesheet"); -function hasShadowRoot(n2) { - return Boolean(_optionalChain$4([n2, "optionalAccess", (_18) => _18.shadowRoot])); -} -__name(hasShadowRoot, "hasShadowRoot"); -class StyleSheetMirror { - static { - __name(this, "StyleSheetMirror"); - } - constructor() { - this.id = 1; - this.styleIDMap = /* @__PURE__ */ new WeakMap(); - this.idStyleMap = /* @__PURE__ */ new Map(); - } - getId(stylesheet) { - return _nullishCoalesce(this.styleIDMap.get(stylesheet), () => -1); - } - has(stylesheet) { - return this.styleIDMap.has(stylesheet); - } - add(stylesheet, id3) { - if (this.has(stylesheet)) - return this.getId(stylesheet); - let newId; - if (id3 === void 0) { - newId = this.id++; - } else - newId = id3; - this.styleIDMap.set(stylesheet, newId); - this.idStyleMap.set(newId, stylesheet); - return newId; - } - getStyle(id3) { - return this.idStyleMap.get(id3) || null; - } - reset() { - this.styleIDMap = /* @__PURE__ */ new WeakMap(); - this.idStyleMap = /* @__PURE__ */ new Map(); - this.id = 1; - } - generateId() { - return this.id++; - } -} -function getShadowHost(n2) { - let shadowHost = null; - if (_optionalChain$4([n2, "access", (_19) => _19.getRootNode, "optionalCall", (_20) => _20(), "optionalAccess", (_21) => _21.nodeType]) === Node.DOCUMENT_FRAGMENT_NODE && n2.getRootNode().host) - shadowHost = n2.getRootNode().host; - return shadowHost; -} -__name(getShadowHost, "getShadowHost"); -function getRootShadowHost(n2) { - let rootShadowHost = n2; - let shadowHost; - while (shadowHost = getShadowHost(rootShadowHost)) - rootShadowHost = shadowHost; - return rootShadowHost; -} -__name(getRootShadowHost, "getRootShadowHost"); -function shadowHostInDom(n2) { - const doc2 = n2.ownerDocument; - if (!doc2) - return false; - const shadowHost = getRootShadowHost(n2); - return doc2.contains(shadowHost); -} -__name(shadowHostInDom, "shadowHostInDom"); -function inDom(n2) { - const doc2 = n2.ownerDocument; - if (!doc2) - return false; - return doc2.contains(n2) || shadowHostInDom(n2); -} -__name(inDom, "inDom"); -const cachedImplementations$2 = {}; -function getImplementation$2(name2) { - const cached = cachedImplementations$2[name2]; - if (cached) { - return cached; - } - const document2 = window.document; - let impl = window[name2]; - if (document2 && typeof document2.createElement === "function") { - try { - const sandbox = document2.createElement("iframe"); - sandbox.hidden = true; - document2.head.appendChild(sandbox); - const contentWindow = sandbox.contentWindow; - if (contentWindow && contentWindow[name2]) { - impl = contentWindow[name2]; - } - document2.head.removeChild(sandbox); - } catch (e2) { - } - } - return cachedImplementations$2[name2] = impl.bind(window); -} -__name(getImplementation$2, "getImplementation$2"); -function onRequestAnimationFrame$1(...rest) { - return getImplementation$2("requestAnimationFrame")(...rest); -} -__name(onRequestAnimationFrame$1, "onRequestAnimationFrame$1"); -function setTimeout$1$1(...rest) { - return getImplementation$2("setTimeout")(...rest); -} -__name(setTimeout$1$1, "setTimeout$1$1"); -function clearTimeout$1(...rest) { - return getImplementation$2("clearTimeout")(...rest); -} -__name(clearTimeout$1, "clearTimeout$1"); -var EventType = /* @__PURE__ */ ((EventType2) => { - EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded"; - EventType2[EventType2["Load"] = 1] = "Load"; - EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot"; - EventType2[EventType2["IncrementalSnapshot"] = 3] = "IncrementalSnapshot"; - EventType2[EventType2["Meta"] = 4] = "Meta"; - EventType2[EventType2["Custom"] = 5] = "Custom"; - EventType2[EventType2["Plugin"] = 6] = "Plugin"; - return EventType2; -})(EventType || {}); -var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => { - IncrementalSource2[IncrementalSource2["Mutation"] = 0] = "Mutation"; - IncrementalSource2[IncrementalSource2["MouseMove"] = 1] = "MouseMove"; - IncrementalSource2[IncrementalSource2["MouseInteraction"] = 2] = "MouseInteraction"; - IncrementalSource2[IncrementalSource2["Scroll"] = 3] = "Scroll"; - IncrementalSource2[IncrementalSource2["ViewportResize"] = 4] = "ViewportResize"; - IncrementalSource2[IncrementalSource2["Input"] = 5] = "Input"; - IncrementalSource2[IncrementalSource2["TouchMove"] = 6] = "TouchMove"; - IncrementalSource2[IncrementalSource2["MediaInteraction"] = 7] = "MediaInteraction"; - IncrementalSource2[IncrementalSource2["StyleSheetRule"] = 8] = "StyleSheetRule"; - IncrementalSource2[IncrementalSource2["CanvasMutation"] = 9] = "CanvasMutation"; - IncrementalSource2[IncrementalSource2["Font"] = 10] = "Font"; - IncrementalSource2[IncrementalSource2["Log"] = 11] = "Log"; - IncrementalSource2[IncrementalSource2["Drag"] = 12] = "Drag"; - IncrementalSource2[IncrementalSource2["StyleDeclaration"] = 13] = "StyleDeclaration"; - IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection"; - IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet"; - IncrementalSource2[IncrementalSource2["CustomElement"] = 16] = "CustomElement"; - return IncrementalSource2; -})(IncrementalSource || {}); -var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => { - MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp"; - MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown"; - MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click"; - MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu"; - MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick"; - MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus"; - MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur"; - MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart"; - MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed"; - MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd"; - MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel"; - return MouseInteractions2; -})(MouseInteractions || {}); -var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => { - PointerTypes2[PointerTypes2["Mouse"] = 0] = "Mouse"; - PointerTypes2[PointerTypes2["Pen"] = 1] = "Pen"; - PointerTypes2[PointerTypes2["Touch"] = 2] = "Touch"; - return PointerTypes2; -})(PointerTypes || {}); -var NodeType$1$1; -(function(NodeType3) { - NodeType3[NodeType3["Document"] = 0] = "Document"; - NodeType3[NodeType3["DocumentType"] = 1] = "DocumentType"; - NodeType3[NodeType3["Element"] = 2] = "Element"; - NodeType3[NodeType3["Text"] = 3] = "Text"; - NodeType3[NodeType3["CDATA"] = 4] = "CDATA"; - NodeType3[NodeType3["Comment"] = 5] = "Comment"; -})(NodeType$1$1 || (NodeType$1$1 = {})); -var NodeType$2$1; -(function(NodeType3) { - NodeType3[NodeType3["PLACEHOLDER"] = 0] = "PLACEHOLDER"; - NodeType3[NodeType3["ELEMENT_NODE"] = 1] = "ELEMENT_NODE"; - NodeType3[NodeType3["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE"; - NodeType3[NodeType3["TEXT_NODE"] = 3] = "TEXT_NODE"; - NodeType3[NodeType3["CDATA_SECTION_NODE"] = 4] = "CDATA_SECTION_NODE"; - NodeType3[NodeType3["ENTITY_REFERENCE_NODE"] = 5] = "ENTITY_REFERENCE_NODE"; - NodeType3[NodeType3["ENTITY_NODE"] = 6] = "ENTITY_NODE"; - NodeType3[NodeType3["PROCESSING_INSTRUCTION_NODE"] = 7] = "PROCESSING_INSTRUCTION_NODE"; - NodeType3[NodeType3["COMMENT_NODE"] = 8] = "COMMENT_NODE"; - NodeType3[NodeType3["DOCUMENT_NODE"] = 9] = "DOCUMENT_NODE"; - NodeType3[NodeType3["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE"; - NodeType3[NodeType3["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE"; -})(NodeType$2$1 || (NodeType$2$1 = {})); -function getIFrameContentDocument(iframe) { - try { - return iframe.contentDocument; - } catch (e2) { - } -} -__name(getIFrameContentDocument, "getIFrameContentDocument"); -function getIFrameContentWindow(iframe) { - try { - return iframe.contentWindow; - } catch (e2) { - } -} -__name(getIFrameContentWindow, "getIFrameContentWindow"); -function _optionalChain$3(ops) { - let lastAccessLHS = void 0; - let value4 = ops[0]; - let i2 = 1; - while (i2 < ops.length) { - const op = ops[i2]; - const fn = ops[i2 + 1]; - i2 += 2; - if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { - return void 0; - } - if (op === "access" || op === "optionalAccess") { - lastAccessLHS = value4; - value4 = fn(value4); - } else if (op === "call" || op === "optionalCall") { - value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); - lastAccessLHS = void 0; - } - } - return value4; -} -__name(_optionalChain$3, "_optionalChain$3"); -function isNodeInLinkedList(n2) { - return "__ln" in n2; -} -__name(isNodeInLinkedList, "isNodeInLinkedList"); -class DoubleLinkedList { - static { - __name(this, "DoubleLinkedList"); - } - constructor() { - this.length = 0; - this.head = null; - this.tail = null; - } - get(position3) { - if (position3 >= this.length) { - throw new Error("Position outside of list range"); - } - let current = this.head; - for (let index2 = 0; index2 < position3; index2++) { - current = _optionalChain$3([current, "optionalAccess", (_2) => _2.next]) || null; - } - return current; - } - addNode(n2) { - const node3 = { - value: n2, - previous: null, - next: null - }; - n2.__ln = node3; - if (n2.previousSibling && isNodeInLinkedList(n2.previousSibling)) { - const current = n2.previousSibling.__ln.next; - node3.next = current; - node3.previous = n2.previousSibling.__ln; - n2.previousSibling.__ln.next = node3; - if (current) { - current.previous = node3; - } - } else if (n2.nextSibling && isNodeInLinkedList(n2.nextSibling) && n2.nextSibling.__ln.previous) { - const current = n2.nextSibling.__ln.previous; - node3.previous = current; - node3.next = n2.nextSibling.__ln; - n2.nextSibling.__ln.previous = node3; - if (current) { - current.next = node3; - } - } else { - if (this.head) { - this.head.previous = node3; - } - node3.next = this.head; - this.head = node3; - } - if (node3.next === null) { - this.tail = node3; - } - this.length++; - } - removeNode(n2) { - const current = n2.__ln; - if (!this.head) { - return; - } - if (!current.previous) { - this.head = current.next; - if (this.head) { - this.head.previous = null; - } else { - this.tail = null; - } - } else { - current.previous.next = current.next; - if (current.next) { - current.next.previous = current.previous; - } else { - this.tail = current.previous; - } - } - if (n2.__ln) { - delete n2.__ln; - } - this.length--; - } -} -const moveKey = /* @__PURE__ */ __name((id3, parentId) => `${id3}@${parentId}`, "moveKey"); -class MutationBuffer { - static { - __name(this, "MutationBuffer"); - } - constructor() { - this.frozen = false; - this.locked = false; - this.texts = []; - this.attributes = []; - this.attributeMap = /* @__PURE__ */ new WeakMap(); - this.removes = []; - this.mapRemoves = []; - this.movedMap = {}; - this.addedSet = /* @__PURE__ */ new Set(); - this.movedSet = /* @__PURE__ */ new Set(); - this.droppedSet = /* @__PURE__ */ new Set(); - this.processMutations = (mutations) => { - mutations.forEach(this.processMutation); - this.emit(); - }; - this.emit = () => { - if (this.frozen || this.locked) { - return; - } - const adds = []; - const addedIds = /* @__PURE__ */ new Set(); - const addList = new DoubleLinkedList(); - const getNextId = /* @__PURE__ */ __name((n2) => { - let ns = n2; - let nextId = IGNORED_NODE; - while (nextId === IGNORED_NODE) { - ns = ns && ns.nextSibling; - nextId = ns && this.mirror.getId(ns); - } - return nextId; - }, "getNextId"); - const pushAdd = /* @__PURE__ */ __name((n2) => { - if (!n2.parentNode || !inDom(n2)) { - return; - } - const parentId = isShadowRoot(n2.parentNode) ? this.mirror.getId(getShadowHost(n2)) : this.mirror.getId(n2.parentNode); - const nextId = getNextId(n2); - if (parentId === -1 || nextId === -1) { - return addList.addNode(n2); - } - const sn = serializeNodeWithId(n2, { - doc: this.doc, - mirror: this.mirror, - blockClass: this.blockClass, - blockSelector: this.blockSelector, - maskAllText: this.maskAllText, - unblockSelector: this.unblockSelector, - maskTextClass: this.maskTextClass, - unmaskTextClass: this.unmaskTextClass, - maskTextSelector: this.maskTextSelector, - unmaskTextSelector: this.unmaskTextSelector, - skipChild: true, - newlyAddedElement: true, - inlineStylesheet: this.inlineStylesheet, - maskInputOptions: this.maskInputOptions, - maskAttributeFn: this.maskAttributeFn, - maskTextFn: this.maskTextFn, - maskInputFn: this.maskInputFn, - slimDOMOptions: this.slimDOMOptions, - dataURLOptions: this.dataURLOptions, - recordCanvas: this.recordCanvas, - inlineImages: this.inlineImages, - onSerialize: /* @__PURE__ */ __name((currentN) => { - if (isSerializedIframe(currentN, this.mirror) && !isBlocked$1(currentN, this.blockClass, this.blockSelector, this.unblockSelector, false)) { - this.iframeManager.addIframe(currentN); - } - if (isSerializedStylesheet(currentN, this.mirror)) { - this.stylesheetManager.trackLinkElement(currentN); - } - if (hasShadowRoot(n2)) { - this.shadowDomManager.addShadowRoot(n2.shadowRoot, this.doc); - } - }, "onSerialize"), - onIframeLoad: /* @__PURE__ */ __name((iframe, childSn) => { - if (isBlocked$1(iframe, this.blockClass, this.blockSelector, this.unblockSelector, false)) { - return; - } - this.iframeManager.attachIframe(iframe, childSn); - if (iframe.contentWindow) { - this.canvasManager.addWindow(iframe.contentWindow); - } - this.shadowDomManager.observeAttachShadow(iframe); - }, "onIframeLoad"), - onStylesheetLoad: /* @__PURE__ */ __name((link2, childSn) => { - this.stylesheetManager.attachLinkElement(link2, childSn); - }, "onStylesheetLoad") - }); - if (sn) { - adds.push({ - parentId, - nextId, - node: sn - }); - addedIds.add(sn.id); - } - }, "pushAdd"); - while (this.mapRemoves.length) { - this.mirror.removeNodeFromMap(this.mapRemoves.shift()); - } - for (const n2 of this.movedSet) { - if (isParentRemoved(this.removes, n2, this.mirror) && !this.movedSet.has(n2.parentNode)) { - continue; - } - pushAdd(n2); - } - for (const n2 of this.addedSet) { - if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removes, n2, this.mirror)) { - pushAdd(n2); - } else if (isAncestorInSet(this.movedSet, n2)) { - pushAdd(n2); - } else { - this.droppedSet.add(n2); - } - } - let candidate = null; - while (addList.length) { - let node3 = null; - if (candidate) { - const parentId = this.mirror.getId(candidate.value.parentNode); - const nextId = getNextId(candidate.value); - if (parentId !== -1 && nextId !== -1) { - node3 = candidate; - } - } - if (!node3) { - let tailNode = addList.tail; - while (tailNode) { - const _node = tailNode; - tailNode = tailNode.previous; - if (_node) { - const parentId = this.mirror.getId(_node.value.parentNode); - const nextId = getNextId(_node.value); - if (nextId === -1) - continue; - else if (parentId !== -1) { - node3 = _node; - break; - } else { - const unhandledNode = _node.value; - if (unhandledNode.parentNode && unhandledNode.parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { - const shadowHost = unhandledNode.parentNode.host; - const parentId2 = this.mirror.getId(shadowHost); - if (parentId2 !== -1) { - node3 = _node; - break; - } - } - } - } - } - } - if (!node3) { - while (addList.head) { - addList.removeNode(addList.head.value); - } - break; - } - candidate = node3.previous; - addList.removeNode(node3.value); - pushAdd(node3.value); - } - const payload = { - texts: this.texts.map((text2) => ({ - id: this.mirror.getId(text2.node), - value: text2.value - })).filter((text2) => !addedIds.has(text2.id)).filter((text2) => this.mirror.has(text2.id)), - attributes: this.attributes.map((attribute2) => { - const { attributes } = attribute2; - if (typeof attributes.style === "string") { - const diffAsStr = JSON.stringify(attribute2.styleDiff); - const unchangedAsStr = JSON.stringify(attribute2._unchangedStyles); - if (diffAsStr.length < attributes.style.length) { - if ((diffAsStr + unchangedAsStr).split("var(").length === attributes.style.split("var(").length) { - attributes.style = attribute2.styleDiff; - } - } - } - return { - id: this.mirror.getId(attribute2.node), - attributes - }; - }).filter((attribute2) => !addedIds.has(attribute2.id)).filter((attribute2) => this.mirror.has(attribute2.id)), - removes: this.removes, - adds - }; - if (!payload.texts.length && !payload.attributes.length && !payload.removes.length && !payload.adds.length) { - return; - } - this.texts = []; - this.attributes = []; - this.attributeMap = /* @__PURE__ */ new WeakMap(); - this.removes = []; - this.addedSet = /* @__PURE__ */ new Set(); - this.movedSet = /* @__PURE__ */ new Set(); - this.droppedSet = /* @__PURE__ */ new Set(); - this.movedMap = {}; - this.mutationCb(payload); - }; - this.processMutation = (m2) => { - if (isIgnored(m2.target, this.mirror)) { - return; - } - switch (m2.type) { - case "characterData": { - const value4 = m2.target.textContent; - if (!isBlocked$1(m2.target, this.blockClass, this.blockSelector, this.unblockSelector, false) && value4 !== m2.oldValue) { - this.texts.push({ - value: needMaskingText(m2.target, this.maskTextClass, this.maskTextSelector, this.unmaskTextClass, this.unmaskTextSelector, this.maskAllText) && value4 ? this.maskTextFn ? this.maskTextFn(value4, closestElementOfNode$1(m2.target)) : value4.replace(/[\S]/g, "*") : value4, - node: m2.target - }); - } - break; - } - case "attributes": { - const target2 = m2.target; - let attributeName = m2.attributeName; - let value4 = m2.target.getAttribute(attributeName); - if (attributeName === "value") { - const type = getInputType(target2); - const tagName = target2.tagName; - value4 = getInputValue(target2, tagName, type); - const isInputMasked = shouldMaskInput({ - maskInputOptions: this.maskInputOptions, - tagName, - type - }); - const forceMask = needMaskingText(m2.target, this.maskTextClass, this.maskTextSelector, this.unmaskTextClass, this.unmaskTextSelector, isInputMasked); - value4 = maskInputValue({ - isMasked: forceMask, - element: target2, - value: value4, - maskInputFn: this.maskInputFn - }); - } - if (isBlocked$1(m2.target, this.blockClass, this.blockSelector, this.unblockSelector, false) || value4 === m2.oldValue) { - return; - } - let item3 = this.attributeMap.get(m2.target); - if (target2.tagName === "IFRAME" && attributeName === "src" && !this.keepIframeSrcFn(value4)) { - const iframeDoc = getIFrameContentDocument(target2); - if (!iframeDoc) { - attributeName = "rr_src"; - } else { - return; - } - } - if (!item3) { - item3 = { - node: m2.target, - attributes: {}, - styleDiff: {}, - _unchangedStyles: {} - }; - this.attributes.push(item3); - this.attributeMap.set(m2.target, item3); - } - if (attributeName === "type" && target2.tagName === "INPUT" && (m2.oldValue || "").toLowerCase() === "password") { - target2.setAttribute("data-rr-is-password", "true"); - } - if (!ignoreAttribute(target2.tagName, attributeName)) { - item3.attributes[attributeName] = transformAttribute(this.doc, toLowerCase(target2.tagName), toLowerCase(attributeName), value4, target2, this.maskAttributeFn); - if (attributeName === "style") { - if (!this.unattachedDoc) { - try { - this.unattachedDoc = document.implementation.createHTMLDocument(); - } catch (e2) { - this.unattachedDoc = this.doc; - } - } - const old = this.unattachedDoc.createElement("span"); - if (m2.oldValue) { - old.setAttribute("style", m2.oldValue); - } - for (const pname of Array.from(target2.style)) { - const newValue2 = target2.style.getPropertyValue(pname); - const newPriority = target2.style.getPropertyPriority(pname); - if (newValue2 !== old.style.getPropertyValue(pname) || newPriority !== old.style.getPropertyPriority(pname)) { - if (newPriority === "") { - item3.styleDiff[pname] = newValue2; - } else { - item3.styleDiff[pname] = [newValue2, newPriority]; - } - } else { - item3._unchangedStyles[pname] = [newValue2, newPriority]; - } - } - for (const pname of Array.from(old.style)) { - if (target2.style.getPropertyValue(pname) === "") { - item3.styleDiff[pname] = false; - } - } - } - } - break; - } - case "childList": { - if (isBlocked$1(m2.target, this.blockClass, this.blockSelector, this.unblockSelector, true)) { - return; - } - m2.addedNodes.forEach((n2) => this.genAdds(n2, m2.target)); - m2.removedNodes.forEach((n2) => { - const nodeId = this.mirror.getId(n2); - const parentId = isShadowRoot(m2.target) ? this.mirror.getId(m2.target.host) : this.mirror.getId(m2.target); - if (isBlocked$1(m2.target, this.blockClass, this.blockSelector, this.unblockSelector, false) || isIgnored(n2, this.mirror) || !isSerialized(n2, this.mirror)) { - return; - } - if (this.addedSet.has(n2)) { - deepDelete(this.addedSet, n2); - this.droppedSet.add(n2); - } else if (this.addedSet.has(m2.target) && nodeId === -1) ; - else if (isAncestorRemoved(m2.target, this.mirror)) ; - else if (this.movedSet.has(n2) && this.movedMap[moveKey(nodeId, parentId)]) { - deepDelete(this.movedSet, n2); - } else { - this.removes.push({ - parentId, - id: nodeId, - isShadow: isShadowRoot(m2.target) && isNativeShadowDom(m2.target) ? true : void 0 - }); - } - this.mapRemoves.push(n2); - }); - break; - } - } - }; - this.genAdds = (n2, target2) => { - if (this.processedNodeManager.inOtherBuffer(n2, this)) - return; - if (this.addedSet.has(n2) || this.movedSet.has(n2)) - return; - if (this.mirror.hasNode(n2)) { - if (isIgnored(n2, this.mirror)) { - return; - } - this.movedSet.add(n2); - let targetId = null; - if (target2 && this.mirror.hasNode(target2)) { - targetId = this.mirror.getId(target2); - } - if (targetId && targetId !== -1) { - this.movedMap[moveKey(this.mirror.getId(n2), targetId)] = true; - } - } else { - this.addedSet.add(n2); - this.droppedSet.delete(n2); - } - if (!isBlocked$1(n2, this.blockClass, this.blockSelector, this.unblockSelector, false)) { - n2.childNodes.forEach((childN) => this.genAdds(childN)); - if (hasShadowRoot(n2)) { - n2.shadowRoot.childNodes.forEach((childN) => { - this.processedNodeManager.add(childN, this); - this.genAdds(childN, n2); - }); - } - } - }; - } - init(options4) { - [ - "mutationCb", - "blockClass", - "blockSelector", - "unblockSelector", - "maskAllText", - "maskTextClass", - "unmaskTextClass", - "maskTextSelector", - "unmaskTextSelector", - "inlineStylesheet", - "maskInputOptions", - "maskAttributeFn", - "maskTextFn", - "maskInputFn", - "keepIframeSrcFn", - "recordCanvas", - "inlineImages", - "slimDOMOptions", - "dataURLOptions", - "doc", - "mirror", - "iframeManager", - "stylesheetManager", - "shadowDomManager", - "canvasManager", - "processedNodeManager" - ].forEach((key) => { - this[key] = options4[key]; - }); - } - freeze() { - this.frozen = true; - this.canvasManager.freeze(); - } - unfreeze() { - this.frozen = false; - this.canvasManager.unfreeze(); - this.emit(); - } - isFrozen() { - return this.frozen; - } - lock() { - this.locked = true; - this.canvasManager.lock(); - } - unlock() { - this.locked = false; - this.canvasManager.unlock(); - this.emit(); - } - reset() { - this.shadowDomManager.reset(); - this.canvasManager.reset(); - } -} -function deepDelete(addsSet, n2) { - addsSet.delete(n2); - n2.childNodes.forEach((childN) => deepDelete(addsSet, childN)); -} -__name(deepDelete, "deepDelete"); -function isParentRemoved(removes, n2, mirror2) { - if (removes.length === 0) - return false; - return _isParentRemoved(removes, n2, mirror2); -} -__name(isParentRemoved, "isParentRemoved"); -function _isParentRemoved(removes, n2, mirror2) { - let node3 = n2.parentNode; - while (node3) { - const parentId = mirror2.getId(node3); - if (removes.some((r2) => r2.id === parentId)) { - return true; - } - node3 = node3.parentNode; - } - return false; -} -__name(_isParentRemoved, "_isParentRemoved"); -function isAncestorInSet(set3, n2) { - if (set3.size === 0) - return false; - return _isAncestorInSet(set3, n2); -} -__name(isAncestorInSet, "isAncestorInSet"); -function _isAncestorInSet(set3, n2) { - const { parentNode: parentNode2 } = n2; - if (!parentNode2) { - return false; - } - if (set3.has(parentNode2)) { - return true; - } - return _isAncestorInSet(set3, parentNode2); -} -__name(_isAncestorInSet, "_isAncestorInSet"); -let errorHandler$1; -function registerErrorHandler$1(handler12) { - errorHandler$1 = handler12; -} -__name(registerErrorHandler$1, "registerErrorHandler$1"); -function unregisterErrorHandler() { - errorHandler$1 = void 0; -} -__name(unregisterErrorHandler, "unregisterErrorHandler"); -const callbackWrapper$1 = /* @__PURE__ */ __name((cb) => { - if (!errorHandler$1) { - return cb; - } - const rrwebWrapped = /* @__PURE__ */ __name((...rest) => { - try { - return cb(...rest); - } catch (error2) { - if (errorHandler$1 && errorHandler$1(error2) === true) { - return () => { - }; - } - throw error2; - } - }, "rrwebWrapped"); - return rrwebWrapped; -}, "callbackWrapper$1"); -function _optionalChain$2(ops) { - let lastAccessLHS = void 0; - let value4 = ops[0]; - let i2 = 1; - while (i2 < ops.length) { - const op = ops[i2]; - const fn = ops[i2 + 1]; - i2 += 2; - if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { - return void 0; - } - if (op === "access" || op === "optionalAccess") { - lastAccessLHS = value4; - value4 = fn(value4); - } else if (op === "call" || op === "optionalCall") { - value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); - lastAccessLHS = void 0; - } - } - return value4; -} -__name(_optionalChain$2, "_optionalChain$2"); -const mutationBuffers = []; -function getEventTarget(event) { - try { - if ("composedPath" in event) { - const path = event.composedPath(); - if (path.length) { - return path[0]; - } - } else if ("path" in event && event.path.length) { - return event.path[0]; - } - } catch (e2) { - } - return event && event.target; -} -__name(getEventTarget, "getEventTarget"); -function initMutationObserver(options4, rootEl) { - const mutationBuffer = new MutationBuffer(); - mutationBuffers.push(mutationBuffer); - mutationBuffer.init(options4); - let mutationObserverCtor = window.MutationObserver || window.__rrMutationObserver; - const angularZoneSymbol = _optionalChain$2([window, "optionalAccess", (_2) => _2.Zone, "optionalAccess", (_2) => _2.__symbol__, "optionalCall", (_3) => _3("MutationObserver")]); - if (angularZoneSymbol && window[angularZoneSymbol]) { - mutationObserverCtor = window[angularZoneSymbol]; - } - const observer = new mutationObserverCtor(callbackWrapper$1((mutations) => { - if (options4.onMutation && options4.onMutation(mutations) === false) { - return; - } - mutationBuffer.processMutations.bind(mutationBuffer)(mutations); - })); - observer.observe(rootEl, { - attributes: true, - attributeOldValue: true, - characterData: true, - characterDataOldValue: true, - childList: true, - subtree: true - }); - return observer; -} -__name(initMutationObserver, "initMutationObserver"); -function initMoveObserver({ mousemoveCb, sampling, doc: doc2, mirror: mirror2 }) { - if (sampling.mousemove === false) { - return () => { - }; - } - const threshold = typeof sampling.mousemove === "number" ? sampling.mousemove : 50; - const callbackThreshold = typeof sampling.mousemoveCallback === "number" ? sampling.mousemoveCallback : 500; - let positions = []; - let timeBaseline; - const wrappedCb = throttle$1(callbackWrapper$1((source) => { - const totalOffset = Date.now() - timeBaseline; - mousemoveCb(positions.map((p2) => { - p2.timeOffset -= totalOffset; - return p2; - }), source); - positions = []; - timeBaseline = null; - }), callbackThreshold); - const updatePosition = callbackWrapper$1(throttle$1(callbackWrapper$1((evt) => { - const target2 = getEventTarget(evt); - const { clientX, clientY } = legacy_isTouchEvent(evt) ? evt.changedTouches[0] : evt; - if (!timeBaseline) { - timeBaseline = nowTimestamp(); - } - positions.push({ - x: clientX, - y: clientY, - id: mirror2.getId(target2), - timeOffset: nowTimestamp() - timeBaseline - }); - wrappedCb(typeof DragEvent !== "undefined" && evt instanceof DragEvent ? IncrementalSource.Drag : evt instanceof MouseEvent ? IncrementalSource.MouseMove : IncrementalSource.TouchMove); - }), threshold, { - trailing: false - })); - const handlers2 = [ - on("mousemove", updatePosition, doc2), - on("touchmove", updatePosition, doc2), - on("drag", updatePosition, doc2) - ]; - return callbackWrapper$1(() => { - handlers2.forEach((h2) => h2()); - }); -} -__name(initMoveObserver, "initMoveObserver"); -function initMouseInteractionObserver({ mouseInteractionCb, doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, sampling }) { - if (sampling.mouseInteraction === false) { - return () => { - }; - } - const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction; - const handlers2 = []; - let currentPointerType = null; - const getHandler = /* @__PURE__ */ __name((eventKey) => { - return (event) => { - const target2 = getEventTarget(event); - if (isBlocked$1(target2, blockClass, blockSelector, unblockSelector, true)) { - return; - } - let pointerType = null; - let thisEventKey = eventKey; - if ("pointerType" in event) { - switch (event.pointerType) { - case "mouse": - pointerType = PointerTypes.Mouse; - break; - case "touch": - pointerType = PointerTypes.Touch; - break; - case "pen": - pointerType = PointerTypes.Pen; - break; - } - if (pointerType === PointerTypes.Touch) { - if (MouseInteractions[eventKey] === MouseInteractions.MouseDown) { - thisEventKey = "TouchStart"; - } else if (MouseInteractions[eventKey] === MouseInteractions.MouseUp) { - thisEventKey = "TouchEnd"; - } - } else if (pointerType === PointerTypes.Pen) ; - } else if (legacy_isTouchEvent(event)) { - pointerType = PointerTypes.Touch; - } - if (pointerType !== null) { - currentPointerType = pointerType; - if (thisEventKey.startsWith("Touch") && pointerType === PointerTypes.Touch || thisEventKey.startsWith("Mouse") && pointerType === PointerTypes.Mouse) { - pointerType = null; - } - } else if (MouseInteractions[eventKey] === MouseInteractions.Click) { - pointerType = currentPointerType; - currentPointerType = null; - } - const e2 = legacy_isTouchEvent(event) ? event.changedTouches[0] : event; - if (!e2) { - return; - } - const id3 = mirror2.getId(target2); - const { clientX, clientY } = e2; - callbackWrapper$1(mouseInteractionCb)({ - type: MouseInteractions[thisEventKey], - id: id3, - x: clientX, - y: clientY, - ...pointerType !== null && { pointerType } - }); - }; - }, "getHandler"); - Object.keys(MouseInteractions).filter((key) => Number.isNaN(Number(key)) && !key.endsWith("_Departed") && disableMap[key] !== false).forEach((eventKey) => { - let eventName = toLowerCase(eventKey); - const handler12 = getHandler(eventKey); - if (window.PointerEvent) { - switch (MouseInteractions[eventKey]) { - case MouseInteractions.MouseDown: - case MouseInteractions.MouseUp: - eventName = eventName.replace("mouse", "pointer"); - break; - case MouseInteractions.TouchStart: - case MouseInteractions.TouchEnd: - return; - } - } - handlers2.push(on(eventName, handler12, doc2)); - }); - return callbackWrapper$1(() => { - handlers2.forEach((h2) => h2()); - }); -} -__name(initMouseInteractionObserver, "initMouseInteractionObserver"); -function initScrollObserver({ scrollCb, doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, sampling }) { - const updatePosition = callbackWrapper$1(throttle$1(callbackWrapper$1((evt) => { - const target2 = getEventTarget(evt); - if (!target2 || isBlocked$1(target2, blockClass, blockSelector, unblockSelector, true)) { - return; - } - const id3 = mirror2.getId(target2); - if (target2 === doc2 && doc2.defaultView) { - const scrollLeftTop = getWindowScroll(doc2.defaultView); - scrollCb({ - id: id3, - x: scrollLeftTop.left, - y: scrollLeftTop.top - }); - } else { - scrollCb({ - id: id3, - x: target2.scrollLeft, - y: target2.scrollTop - }); - } - }), sampling.scroll || 100)); - return on("scroll", updatePosition, doc2); -} -__name(initScrollObserver, "initScrollObserver"); -function initViewportResizeObserver({ viewportResizeCb }, { win }) { - let lastH = -1; - let lastW = -1; - const updateDimension = callbackWrapper$1(throttle$1(callbackWrapper$1(() => { - const height = getWindowHeight(); - const width2 = getWindowWidth(); - if (lastH !== height || lastW !== width2) { - viewportResizeCb({ - width: Number(width2), - height: Number(height) - }); - lastH = height; - lastW = width2; - } - }), 200)); - return on("resize", updateDimension, win); -} -__name(initViewportResizeObserver, "initViewportResizeObserver"); -const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"]; -const lastInputValueMap = /* @__PURE__ */ new WeakMap(); -function initInputObserver({ inputCb, doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, ignoreClass, ignoreSelector, maskInputOptions, maskInputFn, sampling, userTriggeredOnInput, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector }) { - function eventHandler(event) { - let target2 = getEventTarget(event); - const userTriggered = event.isTrusted; - const tagName = target2 && toUpperCase(target2.tagName); - if (tagName === "OPTION") - target2 = target2.parentElement; - if (!target2 || !tagName || INPUT_TAGS.indexOf(tagName) < 0 || isBlocked$1(target2, blockClass, blockSelector, unblockSelector, true)) { - return; - } - const el = target2; - if (el.classList.contains(ignoreClass) || ignoreSelector && el.matches(ignoreSelector)) { - return; - } - const type = getInputType(target2); - let text2 = getInputValue(el, tagName, type); - let isChecked2 = false; - const isInputMasked = shouldMaskInput({ - maskInputOptions, - tagName, - type - }); - const forceMask = needMaskingText(target2, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, isInputMasked); - if (type === "radio" || type === "checkbox") { - isChecked2 = target2.checked; - } - text2 = maskInputValue({ - isMasked: forceMask, - element: target2, - value: text2, - maskInputFn - }); - cbWithDedup(target2, userTriggeredOnInput ? { text: text2, isChecked: isChecked2, userTriggered } : { text: text2, isChecked: isChecked2 }); - const name2 = target2.name; - if (type === "radio" && name2 && isChecked2) { - doc2.querySelectorAll(`input[type="radio"][name="${name2}"]`).forEach((el2) => { - if (el2 !== target2) { - const text3 = maskInputValue({ - isMasked: forceMask, - element: el2, - value: getInputValue(el2, tagName, type), - maskInputFn - }); - cbWithDedup(el2, userTriggeredOnInput ? { text: text3, isChecked: !isChecked2, userTriggered: false } : { text: text3, isChecked: !isChecked2 }); - } - }); - } - } - __name(eventHandler, "eventHandler"); - function cbWithDedup(target2, v2) { - const lastInputValue = lastInputValueMap.get(target2); - if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) { - lastInputValueMap.set(target2, v2); - const id3 = mirror2.getId(target2); - callbackWrapper$1(inputCb)({ - ...v2, - id: id3 - }); - } - } - __name(cbWithDedup, "cbWithDedup"); - const events2 = sampling.input === "last" ? ["change"] : ["input", "change"]; - const handlers2 = events2.map((eventName) => on(eventName, callbackWrapper$1(eventHandler), doc2)); - const currentWindow = doc2.defaultView; - if (!currentWindow) { - return () => { - handlers2.forEach((h2) => h2()); - }; - } - const propertyDescriptor = currentWindow.Object.getOwnPropertyDescriptor(currentWindow.HTMLInputElement.prototype, "value"); - const hookProperties = [ - [currentWindow.HTMLInputElement.prototype, "value"], - [currentWindow.HTMLInputElement.prototype, "checked"], - [currentWindow.HTMLSelectElement.prototype, "value"], - [currentWindow.HTMLTextAreaElement.prototype, "value"], - [currentWindow.HTMLSelectElement.prototype, "selectedIndex"], - [currentWindow.HTMLOptionElement.prototype, "selected"] - ]; - if (propertyDescriptor && propertyDescriptor.set) { - handlers2.push(...hookProperties.map((p2) => hookSetter$1(p2[0], p2[1], { - set() { - callbackWrapper$1(eventHandler)({ - target: this, - isTrusted: false - }); - } - }, false, currentWindow))); - } - return callbackWrapper$1(() => { - handlers2.forEach((h2) => h2()); - }); -} -__name(initInputObserver, "initInputObserver"); -function getNestedCSSRulePositions(rule) { - const positions = []; - function recurse(childRule, pos) { - if (hasNestedCSSRule("CSSGroupingRule") && childRule.parentRule instanceof CSSGroupingRule || hasNestedCSSRule("CSSMediaRule") && childRule.parentRule instanceof CSSMediaRule || hasNestedCSSRule("CSSSupportsRule") && childRule.parentRule instanceof CSSSupportsRule || hasNestedCSSRule("CSSConditionRule") && childRule.parentRule instanceof CSSConditionRule) { - const rules = Array.from(childRule.parentRule.cssRules); - const index2 = rules.indexOf(childRule); - pos.unshift(index2); - } else if (childRule.parentStyleSheet) { - const rules = Array.from(childRule.parentStyleSheet.cssRules); - const index2 = rules.indexOf(childRule); - pos.unshift(index2); - } - return pos; - } - __name(recurse, "recurse"); - return recurse(rule, positions); -} -__name(getNestedCSSRulePositions, "getNestedCSSRulePositions"); -function getIdAndStyleId(sheet, mirror2, styleMirror) { - let id3, styleId; - if (!sheet) - return {}; - if (sheet.ownerNode) - id3 = mirror2.getId(sheet.ownerNode); - else - styleId = styleMirror.getId(sheet); - return { - styleId, - id: id3 - }; -} -__name(getIdAndStyleId, "getIdAndStyleId"); -function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetManager }, { win }) { - if (!win.CSSStyleSheet || !win.CSSStyleSheet.prototype) { - return () => { - }; - } - const insertRule = win.CSSStyleSheet.prototype.insertRule; - win.CSSStyleSheet.prototype.insertRule = new Proxy(insertRule, { - apply: callbackWrapper$1((target2, thisArg, argumentsList) => { - const [rule, index2] = argumentsList; - const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); - if (id3 && id3 !== -1 || styleId && styleId !== -1) { - styleSheetRuleCb({ - id: id3, - styleId, - adds: [{ rule, index: index2 }] - }); - } - return target2.apply(thisArg, argumentsList); - }) - }); - const deleteRule = win.CSSStyleSheet.prototype.deleteRule; - win.CSSStyleSheet.prototype.deleteRule = new Proxy(deleteRule, { - apply: callbackWrapper$1((target2, thisArg, argumentsList) => { - const [index2] = argumentsList; - const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); - if (id3 && id3 !== -1 || styleId && styleId !== -1) { - styleSheetRuleCb({ - id: id3, - styleId, - removes: [{ index: index2 }] - }); - } - return target2.apply(thisArg, argumentsList); - }) - }); - let replace2; - if (win.CSSStyleSheet.prototype.replace) { - replace2 = win.CSSStyleSheet.prototype.replace; - win.CSSStyleSheet.prototype.replace = new Proxy(replace2, { - apply: callbackWrapper$1((target2, thisArg, argumentsList) => { - const [text2] = argumentsList; - const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); - if (id3 && id3 !== -1 || styleId && styleId !== -1) { - styleSheetRuleCb({ - id: id3, - styleId, - replace: text2 - }); - } - return target2.apply(thisArg, argumentsList); - }) - }); - } - let replaceSync; - if (win.CSSStyleSheet.prototype.replaceSync) { - replaceSync = win.CSSStyleSheet.prototype.replaceSync; - win.CSSStyleSheet.prototype.replaceSync = new Proxy(replaceSync, { - apply: callbackWrapper$1((target2, thisArg, argumentsList) => { - const [text2] = argumentsList; - const { id: id3, styleId } = getIdAndStyleId(thisArg, mirror2, stylesheetManager.styleMirror); - if (id3 && id3 !== -1 || styleId && styleId !== -1) { - styleSheetRuleCb({ - id: id3, - styleId, - replaceSync: text2 - }); - } - return target2.apply(thisArg, argumentsList); - }) - }); - } - const supportedNestedCSSRuleTypes = {}; - if (canMonkeyPatchNestedCSSRule("CSSGroupingRule")) { - supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule; - } else { - if (canMonkeyPatchNestedCSSRule("CSSMediaRule")) { - supportedNestedCSSRuleTypes.CSSMediaRule = win.CSSMediaRule; - } - if (canMonkeyPatchNestedCSSRule("CSSConditionRule")) { - supportedNestedCSSRuleTypes.CSSConditionRule = win.CSSConditionRule; - } - if (canMonkeyPatchNestedCSSRule("CSSSupportsRule")) { - supportedNestedCSSRuleTypes.CSSSupportsRule = win.CSSSupportsRule; - } - } - const unmodifiedFunctions = {}; - Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => { - unmodifiedFunctions[typeKey] = { - insertRule: type.prototype.insertRule, - deleteRule: type.prototype.deleteRule - }; - type.prototype.insertRule = new Proxy(unmodifiedFunctions[typeKey].insertRule, { - apply: callbackWrapper$1((target2, thisArg, argumentsList) => { - const [rule, index2] = argumentsList; - const { id: id3, styleId } = getIdAndStyleId(thisArg.parentStyleSheet, mirror2, stylesheetManager.styleMirror); - if (id3 && id3 !== -1 || styleId && styleId !== -1) { - styleSheetRuleCb({ - id: id3, - styleId, - adds: [ - { - rule, - index: [ - ...getNestedCSSRulePositions(thisArg), - index2 || 0 - ] - } - ] - }); - } - return target2.apply(thisArg, argumentsList); - }) - }); - type.prototype.deleteRule = new Proxy(unmodifiedFunctions[typeKey].deleteRule, { - apply: callbackWrapper$1((target2, thisArg, argumentsList) => { - const [index2] = argumentsList; - const { id: id3, styleId } = getIdAndStyleId(thisArg.parentStyleSheet, mirror2, stylesheetManager.styleMirror); - if (id3 && id3 !== -1 || styleId && styleId !== -1) { - styleSheetRuleCb({ - id: id3, - styleId, - removes: [ - { index: [...getNestedCSSRulePositions(thisArg), index2] } - ] - }); - } - return target2.apply(thisArg, argumentsList); - }) - }); - }); - return callbackWrapper$1(() => { - win.CSSStyleSheet.prototype.insertRule = insertRule; - win.CSSStyleSheet.prototype.deleteRule = deleteRule; - replace2 && (win.CSSStyleSheet.prototype.replace = replace2); - replaceSync && (win.CSSStyleSheet.prototype.replaceSync = replaceSync); - Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => { - type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule; - type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule; - }); - }); -} -__name(initStyleSheetObserver, "initStyleSheetObserver"); -function initAdoptedStyleSheetObserver({ mirror: mirror2, stylesheetManager }, host) { - let hostId = null; - if (host.nodeName === "#document") - hostId = mirror2.getId(host); - else - hostId = mirror2.getId(host.host); - const patchTarget = host.nodeName === "#document" ? _optionalChain$2([host, "access", (_4) => _4.defaultView, "optionalAccess", (_5) => _5.Document]) : _optionalChain$2([host, "access", (_6) => _6.ownerDocument, "optionalAccess", (_7) => _7.defaultView, "optionalAccess", (_8) => _8.ShadowRoot]); - const originalPropertyDescriptor = _optionalChain$2([patchTarget, "optionalAccess", (_9) => _9.prototype]) ? Object.getOwnPropertyDescriptor(_optionalChain$2([patchTarget, "optionalAccess", (_10) => _10.prototype]), "adoptedStyleSheets") : void 0; - if (hostId === null || hostId === -1 || !patchTarget || !originalPropertyDescriptor) - return () => { - }; - Object.defineProperty(host, "adoptedStyleSheets", { - configurable: originalPropertyDescriptor.configurable, - enumerable: originalPropertyDescriptor.enumerable, - get() { - return _optionalChain$2([originalPropertyDescriptor, "access", (_11) => _11.get, "optionalAccess", (_12) => _12.call, "call", (_13) => _13(this)]); - }, - set(sheets) { - const result = _optionalChain$2([originalPropertyDescriptor, "access", (_14) => _14.set, "optionalAccess", (_15) => _15.call, "call", (_16) => _16(this, sheets)]); - if (hostId !== null && hostId !== -1) { - try { - stylesheetManager.adoptStyleSheets(sheets, hostId); - } catch (e2) { - } - } - return result; - } - }); - return callbackWrapper$1(() => { - Object.defineProperty(host, "adoptedStyleSheets", { - configurable: originalPropertyDescriptor.configurable, - enumerable: originalPropertyDescriptor.enumerable, - get: originalPropertyDescriptor.get, - set: originalPropertyDescriptor.set - }); - }); -} -__name(initAdoptedStyleSheetObserver, "initAdoptedStyleSheetObserver"); -function initStyleDeclarationObserver({ styleDeclarationCb, mirror: mirror2, ignoreCSSAttributes, stylesheetManager }, { win }) { - const setProperty2 = win.CSSStyleDeclaration.prototype.setProperty; - win.CSSStyleDeclaration.prototype.setProperty = new Proxy(setProperty2, { - apply: callbackWrapper$1((target2, thisArg, argumentsList) => { - const [property, value4, priority] = argumentsList; - if (ignoreCSSAttributes.has(property)) { - return setProperty2.apply(thisArg, [property, value4, priority]); - } - const { id: id3, styleId } = getIdAndStyleId(_optionalChain$2([thisArg, "access", (_17) => _17.parentRule, "optionalAccess", (_18) => _18.parentStyleSheet]), mirror2, stylesheetManager.styleMirror); - if (id3 && id3 !== -1 || styleId && styleId !== -1) { - styleDeclarationCb({ - id: id3, - styleId, - set: { - property, - value: value4, - priority - }, - index: getNestedCSSRulePositions(thisArg.parentRule) - }); - } - return target2.apply(thisArg, argumentsList); - }) - }); - const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty; - win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, { - apply: callbackWrapper$1((target2, thisArg, argumentsList) => { - const [property] = argumentsList; - if (ignoreCSSAttributes.has(property)) { - return removeProperty.apply(thisArg, [property]); - } - const { id: id3, styleId } = getIdAndStyleId(_optionalChain$2([thisArg, "access", (_19) => _19.parentRule, "optionalAccess", (_20) => _20.parentStyleSheet]), mirror2, stylesheetManager.styleMirror); - if (id3 && id3 !== -1 || styleId && styleId !== -1) { - styleDeclarationCb({ - id: id3, - styleId, - remove: { - property - }, - index: getNestedCSSRulePositions(thisArg.parentRule) - }); - } - return target2.apply(thisArg, argumentsList); - }) - }); - return callbackWrapper$1(() => { - win.CSSStyleDeclaration.prototype.setProperty = setProperty2; - win.CSSStyleDeclaration.prototype.removeProperty = removeProperty; - }); -} -__name(initStyleDeclarationObserver, "initStyleDeclarationObserver"); -function initMediaInteractionObserver({ mediaInteractionCb, blockClass, blockSelector, unblockSelector, mirror: mirror2, sampling, doc: doc2 }) { - const handler12 = callbackWrapper$1((type) => throttle$1(callbackWrapper$1((event) => { - const target2 = getEventTarget(event); - if (!target2 || isBlocked$1(target2, blockClass, blockSelector, unblockSelector, true)) { - return; - } - const { currentTime, volume, muted, playbackRate } = target2; - mediaInteractionCb({ - type, - id: mirror2.getId(target2), - currentTime, - volume, - muted, - playbackRate - }); - }), sampling.media || 500)); - const handlers2 = [ - on("play", handler12(0), doc2), - on("pause", handler12(1), doc2), - on("seeked", handler12(2), doc2), - on("volumechange", handler12(3), doc2), - on("ratechange", handler12(4), doc2) - ]; - return callbackWrapper$1(() => { - handlers2.forEach((h2) => h2()); - }); -} -__name(initMediaInteractionObserver, "initMediaInteractionObserver"); -function initFontObserver({ fontCb, doc: doc2 }) { - const win = doc2.defaultView; - if (!win) { - return () => { - }; - } - const handlers2 = []; - const fontMap = /* @__PURE__ */ new WeakMap(); - const originalFontFace = win.FontFace; - win.FontFace = /* @__PURE__ */ __name(function FontFace(family, source, descriptors2) { - const fontFace = new originalFontFace(family, source, descriptors2); - fontMap.set(fontFace, { - family, - buffer: typeof source !== "string", - descriptors: descriptors2, - fontSource: typeof source === "string" ? source : JSON.stringify(Array.from(new Uint8Array(source))) - }); - return fontFace; - }, "FontFace"); - const restoreHandler = patch$2(doc2.fonts, "add", function(original) { - return function(fontFace) { - setTimeout$1$1(callbackWrapper$1(() => { - const p2 = fontMap.get(fontFace); - if (p2) { - fontCb(p2); - fontMap.delete(fontFace); - } - }), 0); - return original.apply(this, [fontFace]); - }; - }); - handlers2.push(() => { - win.FontFace = originalFontFace; - }); - handlers2.push(restoreHandler); - return callbackWrapper$1(() => { - handlers2.forEach((h2) => h2()); - }); -} -__name(initFontObserver, "initFontObserver"); -function initSelectionObserver(param) { - const { doc: doc2, mirror: mirror2, blockClass, blockSelector, unblockSelector, selectionCb } = param; - let collapsed2 = true; - const updateSelection2 = callbackWrapper$1(() => { - const selection = doc2.getSelection(); - if (!selection || collapsed2 && _optionalChain$2([selection, "optionalAccess", (_21) => _21.isCollapsed])) - return; - collapsed2 = selection.isCollapsed || false; - const ranges = []; - const count = selection.rangeCount || 0; - for (let i2 = 0; i2 < count; i2++) { - const range2 = selection.getRangeAt(i2); - const { startContainer, startOffset, endContainer, endOffset } = range2; - const blocked2 = isBlocked$1(startContainer, blockClass, blockSelector, unblockSelector, true) || isBlocked$1(endContainer, blockClass, blockSelector, unblockSelector, true); - if (blocked2) - continue; - ranges.push({ - start: mirror2.getId(startContainer), - startOffset, - end: mirror2.getId(endContainer), - endOffset - }); - } - selectionCb({ ranges }); - }); - updateSelection2(); - return on("selectionchange", updateSelection2); -} -__name(initSelectionObserver, "initSelectionObserver"); -function initCustomElementObserver({ doc: doc2, customElementCb }) { - const win = doc2.defaultView; - if (!win || !win.customElements) - return () => { - }; - const restoreHandler = patch$2(win.customElements, "define", function(original) { - return function(name2, constructor, options4) { - try { - customElementCb({ - define: { - name: name2 - } - }); - } catch (e2) { - } - return original.apply(this, [name2, constructor, options4]); - }; - }); - return restoreHandler; -} -__name(initCustomElementObserver, "initCustomElementObserver"); -function initObservers(o2, _hooks = {}) { - const currentWindow = o2.doc.defaultView; - if (!currentWindow) { - return () => { - }; - } - let mutationObserver; - if (o2.recordDOM) { - mutationObserver = initMutationObserver(o2, o2.doc); - } - const mousemoveHandler = initMoveObserver(o2); - const mouseInteractionHandler = initMouseInteractionObserver(o2); - const scrollHandler = initScrollObserver(o2); - const viewportResizeHandler = initViewportResizeObserver(o2, { - win: currentWindow - }); - const inputHandler = initInputObserver(o2); - const mediaInteractionHandler = initMediaInteractionObserver(o2); - let styleSheetObserver = /* @__PURE__ */ __name(() => { - }, "styleSheetObserver"); - let adoptedStyleSheetObserver = /* @__PURE__ */ __name(() => { - }, "adoptedStyleSheetObserver"); - let styleDeclarationObserver = /* @__PURE__ */ __name(() => { - }, "styleDeclarationObserver"); - let fontObserver = /* @__PURE__ */ __name(() => { - }, "fontObserver"); - if (o2.recordDOM) { - styleSheetObserver = initStyleSheetObserver(o2, { win: currentWindow }); - adoptedStyleSheetObserver = initAdoptedStyleSheetObserver(o2, o2.doc); - styleDeclarationObserver = initStyleDeclarationObserver(o2, { - win: currentWindow - }); - if (o2.collectFonts) { - fontObserver = initFontObserver(o2); - } - } - const selectionObserver = initSelectionObserver(o2); - const customElementObserver = initCustomElementObserver(o2); - const pluginHandlers = []; - for (const plugin of o2.plugins) { - pluginHandlers.push(plugin.observer(plugin.callback, currentWindow, plugin.options)); - } - return callbackWrapper$1(() => { - mutationBuffers.forEach((b2) => b2.reset()); - _optionalChain$2([mutationObserver, "optionalAccess", (_22) => _22.disconnect, "call", (_23) => _23()]); - mousemoveHandler(); - mouseInteractionHandler(); - scrollHandler(); - viewportResizeHandler(); - inputHandler(); - mediaInteractionHandler(); - styleSheetObserver(); - adoptedStyleSheetObserver(); - styleDeclarationObserver(); - fontObserver(); - selectionObserver(); - customElementObserver(); - pluginHandlers.forEach((h2) => h2()); - }); -} -__name(initObservers, "initObservers"); -function hasNestedCSSRule(prop2) { - return typeof window[prop2] !== "undefined"; -} -__name(hasNestedCSSRule, "hasNestedCSSRule"); -function canMonkeyPatchNestedCSSRule(prop2) { - return Boolean(typeof window[prop2] !== "undefined" && window[prop2].prototype && "insertRule" in window[prop2].prototype && "deleteRule" in window[prop2].prototype); -} -__name(canMonkeyPatchNestedCSSRule, "canMonkeyPatchNestedCSSRule"); -class CrossOriginIframeMirror { - static { - __name(this, "CrossOriginIframeMirror"); - } - constructor(generateIdFn) { - this.generateIdFn = generateIdFn; - this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap(); - this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap(); - } - getId(iframe, remoteId, idToRemoteMap, remoteToIdMap) { - const idToRemoteIdMap = idToRemoteMap || this.getIdToRemoteIdMap(iframe); - const remoteIdToIdMap = remoteToIdMap || this.getRemoteIdToIdMap(iframe); - let id3 = idToRemoteIdMap.get(remoteId); - if (!id3) { - id3 = this.generateIdFn(); - idToRemoteIdMap.set(remoteId, id3); - remoteIdToIdMap.set(id3, remoteId); - } - return id3; - } - getIds(iframe, remoteId) { - const idToRemoteIdMap = this.getIdToRemoteIdMap(iframe); - const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe); - return remoteId.map((id3) => this.getId(iframe, id3, idToRemoteIdMap, remoteIdToIdMap)); - } - getRemoteId(iframe, id3, map3) { - const remoteIdToIdMap = map3 || this.getRemoteIdToIdMap(iframe); - if (typeof id3 !== "number") - return id3; - const remoteId = remoteIdToIdMap.get(id3); - if (!remoteId) - return -1; - return remoteId; - } - getRemoteIds(iframe, ids) { - const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe); - return ids.map((id3) => this.getRemoteId(iframe, id3, remoteIdToIdMap)); - } - reset(iframe) { - if (!iframe) { - this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap(); - this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap(); - return; - } - this.iframeIdToRemoteIdMap.delete(iframe); - this.iframeRemoteIdToIdMap.delete(iframe); - } - getIdToRemoteIdMap(iframe) { - let idToRemoteIdMap = this.iframeIdToRemoteIdMap.get(iframe); - if (!idToRemoteIdMap) { - idToRemoteIdMap = /* @__PURE__ */ new Map(); - this.iframeIdToRemoteIdMap.set(iframe, idToRemoteIdMap); - } - return idToRemoteIdMap; - } - getRemoteIdToIdMap(iframe) { - let remoteIdToIdMap = this.iframeRemoteIdToIdMap.get(iframe); - if (!remoteIdToIdMap) { - remoteIdToIdMap = /* @__PURE__ */ new Map(); - this.iframeRemoteIdToIdMap.set(iframe, remoteIdToIdMap); - } - return remoteIdToIdMap; - } -} -function _optionalChain$1(ops) { - let lastAccessLHS = void 0; - let value4 = ops[0]; - let i2 = 1; - while (i2 < ops.length) { - const op = ops[i2]; - const fn = ops[i2 + 1]; - i2 += 2; - if ((op === "optionalAccess" || op === "optionalCall") && value4 == null) { - return void 0; - } - if (op === "access" || op === "optionalAccess") { - lastAccessLHS = value4; - value4 = fn(value4); - } else if (op === "call" || op === "optionalCall") { - value4 = fn((...args) => value4.call(lastAccessLHS, ...args)); - lastAccessLHS = void 0; - } - } - return value4; -} -__name(_optionalChain$1, "_optionalChain$1"); -class IframeManagerNoop { - static { - __name(this, "IframeManagerNoop"); - } - constructor() { - this.crossOriginIframeMirror = new CrossOriginIframeMirror(genId); - this.crossOriginIframeRootIdMap = /* @__PURE__ */ new WeakMap(); - } - addIframe() { - } - addLoadListener() { - } - attachIframe() { - } -} -class IframeManager { - static { - __name(this, "IframeManager"); - } - constructor(options4) { - this.iframes = /* @__PURE__ */ new WeakMap(); - this.crossOriginIframeMap = /* @__PURE__ */ new WeakMap(); - this.crossOriginIframeMirror = new CrossOriginIframeMirror(genId); - this.crossOriginIframeRootIdMap = /* @__PURE__ */ new WeakMap(); - this.mutationCb = options4.mutationCb; - this.wrappedEmit = options4.wrappedEmit; - this.stylesheetManager = options4.stylesheetManager; - this.recordCrossOriginIframes = options4.recordCrossOriginIframes; - this.crossOriginIframeStyleMirror = new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)); - this.mirror = options4.mirror; - if (this.recordCrossOriginIframes) { - window.addEventListener("message", this.handleMessage.bind(this)); - } - } - addIframe(iframeEl) { - this.iframes.set(iframeEl, true); - if (iframeEl.contentWindow) - this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl); - } - addLoadListener(cb) { - this.loadListener = cb; - } - attachIframe(iframeEl, childSn) { - this.mutationCb({ - adds: [ - { - parentId: this.mirror.getId(iframeEl), - nextId: null, - node: childSn - } - ], - removes: [], - texts: [], - attributes: [], - isAttachIframe: true - }); - _optionalChain$1([this, "access", (_2) => _2.loadListener, "optionalCall", (_2) => _2(iframeEl)]); - const iframeDoc = getIFrameContentDocument(iframeEl); - if (iframeDoc && iframeDoc.adoptedStyleSheets && iframeDoc.adoptedStyleSheets.length > 0) - this.stylesheetManager.adoptStyleSheets(iframeDoc.adoptedStyleSheets, this.mirror.getId(iframeDoc)); - } - handleMessage(message3) { - const crossOriginMessageEvent = message3; - if (crossOriginMessageEvent.data.type !== "rrweb" || crossOriginMessageEvent.origin !== crossOriginMessageEvent.data.origin) - return; - const iframeSourceWindow = message3.source; - if (!iframeSourceWindow) - return; - const iframeEl = this.crossOriginIframeMap.get(message3.source); - if (!iframeEl) - return; - const transformedEvent = this.transformCrossOriginEvent(iframeEl, crossOriginMessageEvent.data.event); - if (transformedEvent) - this.wrappedEmit(transformedEvent, crossOriginMessageEvent.data.isCheckout); - } - transformCrossOriginEvent(iframeEl, e2) { - switch (e2.type) { - case EventType.FullSnapshot: { - this.crossOriginIframeMirror.reset(iframeEl); - this.crossOriginIframeStyleMirror.reset(iframeEl); - this.replaceIdOnNode(e2.data.node, iframeEl); - const rootId = e2.data.node.id; - this.crossOriginIframeRootIdMap.set(iframeEl, rootId); - this.patchRootIdOnNode(e2.data.node, rootId); - return { - timestamp: e2.timestamp, - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.Mutation, - adds: [ - { - parentId: this.mirror.getId(iframeEl), - nextId: null, - node: e2.data.node - } - ], - removes: [], - texts: [], - attributes: [], - isAttachIframe: true - } - }; - } - case EventType.Meta: - case EventType.Load: - case EventType.DomContentLoaded: { - return false; - } - case EventType.Plugin: { - return e2; - } - case EventType.Custom: { - this.replaceIds(e2.data.payload, iframeEl, ["id", "parentId", "previousId", "nextId"]); - return e2; - } - case EventType.IncrementalSnapshot: { - switch (e2.data.source) { - case IncrementalSource.Mutation: { - e2.data.adds.forEach((n2) => { - this.replaceIds(n2, iframeEl, [ - "parentId", - "nextId", - "previousId" - ]); - this.replaceIdOnNode(n2.node, iframeEl); - const rootId = this.crossOriginIframeRootIdMap.get(iframeEl); - rootId && this.patchRootIdOnNode(n2.node, rootId); - }); - e2.data.removes.forEach((n2) => { - this.replaceIds(n2, iframeEl, ["parentId", "id"]); - }); - e2.data.attributes.forEach((n2) => { - this.replaceIds(n2, iframeEl, ["id"]); - }); - e2.data.texts.forEach((n2) => { - this.replaceIds(n2, iframeEl, ["id"]); - }); - return e2; - } - case IncrementalSource.Drag: - case IncrementalSource.TouchMove: - case IncrementalSource.MouseMove: { - e2.data.positions.forEach((p2) => { - this.replaceIds(p2, iframeEl, ["id"]); - }); - return e2; - } - case IncrementalSource.ViewportResize: { - return false; - } - case IncrementalSource.MediaInteraction: - case IncrementalSource.MouseInteraction: - case IncrementalSource.Scroll: - case IncrementalSource.CanvasMutation: - case IncrementalSource.Input: { - this.replaceIds(e2.data, iframeEl, ["id"]); - return e2; - } - case IncrementalSource.StyleSheetRule: - case IncrementalSource.StyleDeclaration: { - this.replaceIds(e2.data, iframeEl, ["id"]); - this.replaceStyleIds(e2.data, iframeEl, ["styleId"]); - return e2; - } - case IncrementalSource.Font: { - return e2; - } - case IncrementalSource.Selection: { - e2.data.ranges.forEach((range2) => { - this.replaceIds(range2, iframeEl, ["start", "end"]); - }); - return e2; - } - case IncrementalSource.AdoptedStyleSheet: { - this.replaceIds(e2.data, iframeEl, ["id"]); - this.replaceStyleIds(e2.data, iframeEl, ["styleIds"]); - _optionalChain$1([e2, "access", (_3) => _3.data, "access", (_4) => _4.styles, "optionalAccess", (_5) => _5.forEach, "call", (_6) => _6((style2) => { - this.replaceStyleIds(style2, iframeEl, ["styleId"]); - })]); - return e2; - } - } - } - } - return false; - } - replace(iframeMirror, obj, iframeEl, keys2) { - for (const key of keys2) { - if (!Array.isArray(obj[key]) && typeof obj[key] !== "number") - continue; - if (Array.isArray(obj[key])) { - obj[key] = iframeMirror.getIds(iframeEl, obj[key]); - } else { - obj[key] = iframeMirror.getId(iframeEl, obj[key]); - } - } - return obj; - } - replaceIds(obj, iframeEl, keys2) { - return this.replace(this.crossOriginIframeMirror, obj, iframeEl, keys2); - } - replaceStyleIds(obj, iframeEl, keys2) { - return this.replace(this.crossOriginIframeStyleMirror, obj, iframeEl, keys2); - } - replaceIdOnNode(node3, iframeEl) { - this.replaceIds(node3, iframeEl, ["id", "rootId"]); - if ("childNodes" in node3) { - node3.childNodes.forEach((child) => { - this.replaceIdOnNode(child, iframeEl); - }); - } - } - patchRootIdOnNode(node3, rootId) { - if (node3.type !== NodeType$3.Document && !node3.rootId) - node3.rootId = rootId; - if ("childNodes" in node3) { - node3.childNodes.forEach((child) => { - this.patchRootIdOnNode(child, rootId); - }); - } - } -} -class ShadowDomManagerNoop { - static { - __name(this, "ShadowDomManagerNoop"); - } - init() { - } - addShadowRoot() { - } - observeAttachShadow() { - } - reset() { - } -} -class ShadowDomManager { - static { - __name(this, "ShadowDomManager"); - } - constructor(options4) { - this.shadowDoms = /* @__PURE__ */ new WeakSet(); - this.restoreHandlers = []; - this.mutationCb = options4.mutationCb; - this.scrollCb = options4.scrollCb; - this.bypassOptions = options4.bypassOptions; - this.mirror = options4.mirror; - this.init(); - } - init() { - this.reset(); - this.patchAttachShadow(Element, document); - } - addShadowRoot(shadowRoot, doc2) { - if (!isNativeShadowDom(shadowRoot)) - return; - if (this.shadowDoms.has(shadowRoot)) - return; - this.shadowDoms.add(shadowRoot); - this.bypassOptions.canvasManager.addShadowRoot(shadowRoot); - const observer = initMutationObserver({ - ...this.bypassOptions, - doc: doc2, - mutationCb: this.mutationCb, - mirror: this.mirror, - shadowDomManager: this - }, shadowRoot); - this.restoreHandlers.push(() => observer.disconnect()); - this.restoreHandlers.push(initScrollObserver({ - ...this.bypassOptions, - scrollCb: this.scrollCb, - doc: shadowRoot, - mirror: this.mirror - })); - setTimeout$1$1(() => { - if (shadowRoot.adoptedStyleSheets && shadowRoot.adoptedStyleSheets.length > 0) - this.bypassOptions.stylesheetManager.adoptStyleSheets(shadowRoot.adoptedStyleSheets, this.mirror.getId(shadowRoot.host)); - this.restoreHandlers.push(initAdoptedStyleSheetObserver({ - mirror: this.mirror, - stylesheetManager: this.bypassOptions.stylesheetManager - }, shadowRoot)); - }, 0); - } - observeAttachShadow(iframeElement) { - const iframeDoc = getIFrameContentDocument(iframeElement); - const iframeWindow = getIFrameContentWindow(iframeElement); - if (!iframeDoc || !iframeWindow) - return; - this.patchAttachShadow(iframeWindow.Element, iframeDoc); - } - patchAttachShadow(element, doc2) { - const manager = this; - this.restoreHandlers.push(patch$2(element.prototype, "attachShadow", function(original) { - return function(option3) { - const shadowRoot = original.call(this, option3); - if (this.shadowRoot && inDom(this)) - manager.addShadowRoot(this.shadowRoot, doc2); - return shadowRoot; - }; - })); - } - reset() { - this.restoreHandlers.forEach((handler12) => { - try { - handler12(); - } catch (e2) { - } - }); - this.restoreHandlers = []; - this.shadowDoms = /* @__PURE__ */ new WeakSet(); - this.bypassOptions.canvasManager.resetShadowRoots(); - } -} -class CanvasManagerNoop { - static { - __name(this, "CanvasManagerNoop"); - } - reset() { - } - freeze() { - } - unfreeze() { - } - lock() { - } - unlock() { - } - snapshot() { - } - addWindow() { - } - addShadowRoot() { - } - resetShadowRoots() { - } -} -class StylesheetManager { - static { - __name(this, "StylesheetManager"); - } - constructor(options4) { - this.trackedLinkElements = /* @__PURE__ */ new WeakSet(); - this.styleMirror = new StyleSheetMirror(); - this.mutationCb = options4.mutationCb; - this.adoptedStyleSheetCb = options4.adoptedStyleSheetCb; - } - attachLinkElement(linkEl, childSn) { - if ("_cssText" in childSn.attributes) - this.mutationCb({ - adds: [], - removes: [], - texts: [], - attributes: [ - { - id: childSn.id, - attributes: childSn.attributes - } - ] - }); - this.trackLinkElement(linkEl); - } - trackLinkElement(linkEl) { - if (this.trackedLinkElements.has(linkEl)) - return; - this.trackedLinkElements.add(linkEl); - this.trackStylesheetInLinkElement(linkEl); - } - adoptStyleSheets(sheets, hostId) { - if (sheets.length === 0) - return; - const adoptedStyleSheetData = { - id: hostId, - styleIds: [] - }; - const styles = []; - for (const sheet of sheets) { - let styleId; - if (!this.styleMirror.has(sheet)) { - styleId = this.styleMirror.add(sheet); - styles.push({ - styleId, - rules: Array.from(sheet.rules || CSSRule, (r2, index2) => ({ - rule: stringifyRule(r2), - index: index2 - })) - }); - } else - styleId = this.styleMirror.getId(sheet); - adoptedStyleSheetData.styleIds.push(styleId); - } - if (styles.length > 0) - adoptedStyleSheetData.styles = styles; - this.adoptedStyleSheetCb(adoptedStyleSheetData); - } - reset() { - this.styleMirror.reset(); - this.trackedLinkElements = /* @__PURE__ */ new WeakSet(); - } - trackStylesheetInLinkElement(linkEl) { - } -} -class ProcessedNodeManager { - static { - __name(this, "ProcessedNodeManager"); - } - constructor() { - this.nodeMap = /* @__PURE__ */ new WeakMap(); - this.active = false; - } - inOtherBuffer(node3, thisBuffer) { - const buffers = this.nodeMap.get(node3); - return buffers && Array.from(buffers).some((buffer2) => buffer2 !== thisBuffer); - } - add(node3, buffer2) { - if (!this.active) { - this.active = true; - onRequestAnimationFrame$1(() => { - this.nodeMap = /* @__PURE__ */ new WeakMap(); - this.active = false; - }); - } - this.nodeMap.set(node3, (this.nodeMap.get(node3) || /* @__PURE__ */ new Set()).add(buffer2)); - } - destroy() { - } -} -let wrappedEmit; -let _takeFullSnapshot; -try { - if (Array.from([1], (x2) => x2 * 2)[0] !== 2) { - const cleanFrame = document.createElement("iframe"); - document.body.appendChild(cleanFrame); - Array.from = _optionalChain([cleanFrame, "access", (_2) => _2.contentWindow, "optionalAccess", (_2) => _2.Array, "access", (_3) => _3.from]) || Array.from; - document.body.removeChild(cleanFrame); - } -} catch (err) { - console.debug("Unable to override Array.from", err); -} -const mirror = createMirror(); -function record(options4 = {}) { - const { emit: emit2, checkoutEveryNms, checkoutEveryNth, blockClass = "rr-block", blockSelector = null, unblockSelector = null, ignoreClass = "rr-ignore", ignoreSelector = null, maskAllText = false, maskTextClass = "rr-mask", unmaskTextClass = null, maskTextSelector = null, unmaskTextSelector = null, inlineStylesheet = true, maskAllInputs, maskInputOptions: _maskInputOptions, slimDOMOptions: _slimDOMOptions, maskAttributeFn, maskInputFn, maskTextFn, maxCanvasSize = null, packFn, sampling = {}, dataURLOptions = {}, mousemoveWait, recordDOM = true, recordCanvas = false, recordCrossOriginIframes = false, recordAfter = options4.recordAfter === "DOMContentLoaded" ? options4.recordAfter : "load", userTriggeredOnInput = false, collectFonts = false, inlineImages = false, plugins, keepIframeSrcFn = /* @__PURE__ */ __name(() => false, "keepIframeSrcFn"), ignoreCSSAttributes = /* @__PURE__ */ new Set([]), errorHandler: errorHandler2, onMutation, getCanvasManager } = options4; - registerErrorHandler$1(errorHandler2); - const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true; - let passEmitsToParent = false; - if (!inEmittingFrame) { - try { - if (window.parent.document) { - passEmitsToParent = false; - } - } catch (e2) { - passEmitsToParent = true; - } - } - if (inEmittingFrame && !emit2) { - throw new Error("emit function is required"); - } - if (!inEmittingFrame && !passEmitsToParent) { - return () => { - }; - } - if (mousemoveWait !== void 0 && sampling.mousemove === void 0) { - sampling.mousemove = mousemoveWait; - } - mirror.reset(); - const maskInputOptions = maskAllInputs === true ? { - color: true, - date: true, - "datetime-local": true, - email: true, - month: true, - number: true, - range: true, - search: true, - tel: true, - text: true, - time: true, - url: true, - week: true, - textarea: true, - select: true, - radio: true, - checkbox: true - } : _maskInputOptions !== void 0 ? _maskInputOptions : {}; - const slimDOMOptions = _slimDOMOptions === true || _slimDOMOptions === "all" ? { - script: true, - comment: true, - headFavicon: true, - headWhitespace: true, - headMetaSocial: true, - headMetaRobots: true, - headMetaHttpEquiv: true, - headMetaVerification: true, - headMetaAuthorship: _slimDOMOptions === "all", - headMetaDescKeywords: _slimDOMOptions === "all" - } : _slimDOMOptions ? _slimDOMOptions : {}; - polyfill(); - let lastFullSnapshotEvent; - let incrementalSnapshotCount = 0; - const eventProcessor = /* @__PURE__ */ __name((e2) => { - for (const plugin of plugins || []) { - if (plugin.eventProcessor) { - e2 = plugin.eventProcessor(e2); - } - } - if (packFn && !passEmitsToParent) { - e2 = packFn(e2); - } - return e2; - }, "eventProcessor"); - wrappedEmit = /* @__PURE__ */ __name((r2, isCheckout) => { - const e2 = r2; - e2.timestamp = nowTimestamp(); - if (_optionalChain([mutationBuffers, "access", (_4) => _4[0], "optionalAccess", (_5) => _5.isFrozen, "call", (_6) => _6()]) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) { - mutationBuffers.forEach((buf) => buf.unfreeze()); - } - if (inEmittingFrame) { - _optionalChain([emit2, "optionalCall", (_7) => _7(eventProcessor(e2), isCheckout)]); - } else if (passEmitsToParent) { - const message3 = { - type: "rrweb", - event: eventProcessor(e2), - origin: window.location.origin, - isCheckout - }; - window.parent.postMessage(message3, "*"); - } - if (e2.type === EventType.FullSnapshot) { - lastFullSnapshotEvent = e2; - incrementalSnapshotCount = 0; - } else if (e2.type === EventType.IncrementalSnapshot) { - if (e2.data.source === IncrementalSource.Mutation && e2.data.isAttachIframe) { - return; - } - incrementalSnapshotCount++; - const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth; - const exceedTime = checkoutEveryNms && lastFullSnapshotEvent && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms; - if (exceedCount || exceedTime) { - takeFullSnapshot2(true); - } - } - }, "wrappedEmit"); - const wrappedMutationEmit = /* @__PURE__ */ __name((m2) => { - wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.Mutation, - ...m2 - } - }); - }, "wrappedMutationEmit"); - const wrappedScrollEmit = /* @__PURE__ */ __name((p2) => wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.Scroll, - ...p2 - } - }), "wrappedScrollEmit"); - const wrappedCanvasMutationEmit = /* @__PURE__ */ __name((p2) => wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.CanvasMutation, - ...p2 - } - }), "wrappedCanvasMutationEmit"); - const wrappedAdoptedStyleSheetEmit = /* @__PURE__ */ __name((a2) => wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.AdoptedStyleSheet, - ...a2 - } - }), "wrappedAdoptedStyleSheetEmit"); - const stylesheetManager = new StylesheetManager({ - mutationCb: wrappedMutationEmit, - adoptedStyleSheetCb: wrappedAdoptedStyleSheetEmit - }); - const iframeManager = typeof __RRWEB_EXCLUDE_IFRAME__ === "boolean" && __RRWEB_EXCLUDE_IFRAME__ ? new IframeManagerNoop() : new IframeManager({ - mirror, - mutationCb: wrappedMutationEmit, - stylesheetManager, - recordCrossOriginIframes, - wrappedEmit - }); - for (const plugin of plugins || []) { - if (plugin.getMirror) - plugin.getMirror({ - nodeMirror: mirror, - crossOriginIframeMirror: iframeManager.crossOriginIframeMirror, - crossOriginIframeStyleMirror: iframeManager.crossOriginIframeStyleMirror - }); - } - const processedNodeManager = new ProcessedNodeManager(); - const canvasManager = _getCanvasManager(getCanvasManager, { - mirror, - win: window, - mutationCb: /* @__PURE__ */ __name((p2) => wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.CanvasMutation, - ...p2 - } - }), "mutationCb"), - recordCanvas, - blockClass, - blockSelector, - unblockSelector, - maxCanvasSize, - sampling: sampling["canvas"], - dataURLOptions, - errorHandler: errorHandler2 - }); - const shadowDomManager = typeof __RRWEB_EXCLUDE_SHADOW_DOM__ === "boolean" && __RRWEB_EXCLUDE_SHADOW_DOM__ ? new ShadowDomManagerNoop() : new ShadowDomManager({ - mutationCb: wrappedMutationEmit, - scrollCb: wrappedScrollEmit, - bypassOptions: { - onMutation, - blockClass, - blockSelector, - unblockSelector, - maskAllText, - maskTextClass, - unmaskTextClass, - maskTextSelector, - unmaskTextSelector, - inlineStylesheet, - maskInputOptions, - dataURLOptions, - maskAttributeFn, - maskTextFn, - maskInputFn, - recordCanvas, - inlineImages, - sampling, - slimDOMOptions, - iframeManager, - stylesheetManager, - canvasManager, - keepIframeSrcFn, - processedNodeManager - }, - mirror - }); - const takeFullSnapshot2 = /* @__PURE__ */ __name((isCheckout = false) => { - if (!recordDOM) { - return; - } - wrappedEmit({ - type: EventType.Meta, - data: { - href: window.location.href, - width: getWindowWidth(), - height: getWindowHeight() - } - }, isCheckout); - stylesheetManager.reset(); - shadowDomManager.init(); - mutationBuffers.forEach((buf) => buf.lock()); - const node3 = snapshot(document, { - mirror, - blockClass, - blockSelector, - unblockSelector, - maskAllText, - maskTextClass, - unmaskTextClass, - maskTextSelector, - unmaskTextSelector, - inlineStylesheet, - maskAllInputs: maskInputOptions, - maskAttributeFn, - maskInputFn, - maskTextFn, - slimDOM: slimDOMOptions, - dataURLOptions, - recordCanvas, - inlineImages, - onSerialize: /* @__PURE__ */ __name((n2) => { - if (isSerializedIframe(n2, mirror)) { - iframeManager.addIframe(n2); - } - if (isSerializedStylesheet(n2, mirror)) { - stylesheetManager.trackLinkElement(n2); - } - if (hasShadowRoot(n2)) { - shadowDomManager.addShadowRoot(n2.shadowRoot, document); - } - }, "onSerialize"), - onIframeLoad: /* @__PURE__ */ __name((iframe, childSn) => { - iframeManager.attachIframe(iframe, childSn); - if (iframe.contentWindow) { - canvasManager.addWindow(iframe.contentWindow); - } - shadowDomManager.observeAttachShadow(iframe); - }, "onIframeLoad"), - onStylesheetLoad: /* @__PURE__ */ __name((linkEl, childSn) => { - stylesheetManager.attachLinkElement(linkEl, childSn); - }, "onStylesheetLoad"), - keepIframeSrcFn - }); - if (!node3) { - return console.warn("Failed to snapshot the document"); - } - wrappedEmit({ - type: EventType.FullSnapshot, - data: { - node: node3, - initialOffset: getWindowScroll(window) - } - }); - mutationBuffers.forEach((buf) => buf.unlock()); - if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0) - stylesheetManager.adoptStyleSheets(document.adoptedStyleSheets, mirror.getId(document)); - }, "takeFullSnapshot"); - _takeFullSnapshot = takeFullSnapshot2; - try { - const handlers2 = []; - const observe2 = /* @__PURE__ */ __name((doc2) => { - return callbackWrapper$1(initObservers)({ - onMutation, - mutationCb: wrappedMutationEmit, - mousemoveCb: /* @__PURE__ */ __name((positions, source) => wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source, - positions - } - }), "mousemoveCb"), - mouseInteractionCb: /* @__PURE__ */ __name((d2) => wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.MouseInteraction, - ...d2 - } - }), "mouseInteractionCb"), - scrollCb: wrappedScrollEmit, - viewportResizeCb: /* @__PURE__ */ __name((d2) => wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.ViewportResize, - ...d2 - } - }), "viewportResizeCb"), - inputCb: /* @__PURE__ */ __name((v2) => wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.Input, - ...v2 - } - }), "inputCb"), - mediaInteractionCb: /* @__PURE__ */ __name((p2) => wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.MediaInteraction, - ...p2 - } - }), "mediaInteractionCb"), - styleSheetRuleCb: /* @__PURE__ */ __name((r2) => wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.StyleSheetRule, - ...r2 - } - }), "styleSheetRuleCb"), - styleDeclarationCb: /* @__PURE__ */ __name((r2) => wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.StyleDeclaration, - ...r2 - } - }), "styleDeclarationCb"), - canvasMutationCb: wrappedCanvasMutationEmit, - fontCb: /* @__PURE__ */ __name((p2) => wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.Font, - ...p2 - } - }), "fontCb"), - selectionCb: /* @__PURE__ */ __name((p2) => { - wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.Selection, - ...p2 - } - }); - }, "selectionCb"), - customElementCb: /* @__PURE__ */ __name((c2) => { - wrappedEmit({ - type: EventType.IncrementalSnapshot, - data: { - source: IncrementalSource.CustomElement, - ...c2 - } - }); - }, "customElementCb"), - blockClass, - ignoreClass, - ignoreSelector, - maskAllText, - maskTextClass, - unmaskTextClass, - maskTextSelector, - unmaskTextSelector, - maskInputOptions, - inlineStylesheet, - sampling, - recordDOM, - recordCanvas, - inlineImages, - userTriggeredOnInput, - collectFonts, - doc: doc2, - maskAttributeFn, - maskInputFn, - maskTextFn, - keepIframeSrcFn, - blockSelector, - unblockSelector, - slimDOMOptions, - dataURLOptions, - mirror, - iframeManager, - stylesheetManager, - shadowDomManager, - processedNodeManager, - canvasManager, - ignoreCSSAttributes, - plugins: _optionalChain([ - plugins, - "optionalAccess", - (_8) => _8.filter, - "call", - (_9) => _9((p2) => p2.observer), - "optionalAccess", - (_10) => _10.map, - "call", - (_11) => _11((p2) => ({ - observer: p2.observer, - options: p2.options, - callback: /* @__PURE__ */ __name((payload) => wrappedEmit({ - type: EventType.Plugin, - data: { - plugin: p2.name, - payload - } - }), "callback") - })) - ]) || [] - }, {}); - }, "observe"); - iframeManager.addLoadListener((iframeEl) => { - try { - handlers2.push(observe2(iframeEl.contentDocument)); - } catch (error2) { - console.warn(error2); - } - }); - const init3 = /* @__PURE__ */ __name(() => { - takeFullSnapshot2(); - handlers2.push(observe2(document)); - }, "init"); - if (document.readyState === "interactive" || document.readyState === "complete") { - init3(); - } else { - handlers2.push(on("DOMContentLoaded", () => { - wrappedEmit({ - type: EventType.DomContentLoaded, - data: {} - }); - if (recordAfter === "DOMContentLoaded") - init3(); - })); - handlers2.push(on("load", () => { - wrappedEmit({ - type: EventType.Load, - data: {} - }); - if (recordAfter === "load") - init3(); - }, window)); - } - return () => { - handlers2.forEach((h2) => h2()); - processedNodeManager.destroy(); - _takeFullSnapshot = void 0; - unregisterErrorHandler(); - }; - } catch (error2) { - console.warn(error2); - } -} -__name(record, "record"); -function takeFullSnapshot(isCheckout) { - if (!_takeFullSnapshot) { - throw new Error("please take full snapshot after start recording"); - } - _takeFullSnapshot(isCheckout); -} -__name(takeFullSnapshot, "takeFullSnapshot"); -record.mirror = mirror; -record.takeFullSnapshot = takeFullSnapshot; -function _getCanvasManager(getCanvasManagerFn, options4) { - try { - return getCanvasManagerFn ? getCanvasManagerFn(options4) : new CanvasManagerNoop(); - } catch (e2) { - console.warn("Unable to initialize CanvasManager"); - return new CanvasManagerNoop(); - } -} -__name(_getCanvasManager, "_getCanvasManager"); -const ReplayEventTypeIncrementalSnapshot = 3; -const ReplayEventTypeCustom = 5; -function timestampToMs(timestamp2) { - const isMs = timestamp2 > 9999999999; - return isMs ? timestamp2 : timestamp2 * 1e3; -} -__name(timestampToMs, "timestampToMs"); -function timestampToS(timestamp2) { - const isMs = timestamp2 > 9999999999; - return isMs ? timestamp2 / 1e3 : timestamp2; -} -__name(timestampToS, "timestampToS"); -function addBreadcrumbEvent(replay, breadcrumb) { - if (breadcrumb.category === "sentry.transaction") { - return; - } - if (["ui.click", "ui.input"].includes(breadcrumb.category)) { - replay.triggerUserActivity(); - } else { - replay.checkAndHandleExpiredSession(); - } - replay.addUpdate(() => { - replay.throttledAddEvent({ - type: EventType.Custom, - // TODO: We were converting from ms to seconds for breadcrumbs, spans, - // but maybe we should just keep them as milliseconds - timestamp: (breadcrumb.timestamp || 0) * 1e3, - data: { - tag: "breadcrumb", - // normalize to max. 10 depth and 1_000 properties per object - payload: normalize$2(breadcrumb, 10, 1e3) - } - }); - return breadcrumb.category === "console"; - }); -} -__name(addBreadcrumbEvent, "addBreadcrumbEvent"); -const INTERACTIVE_SELECTOR = "button,a"; -function getClosestInteractive(element) { - const closestInteractive = element.closest(INTERACTIVE_SELECTOR); - return closestInteractive || element; -} -__name(getClosestInteractive, "getClosestInteractive"); -function getClickTargetNode(event) { - const target2 = getTargetNode(event); - if (!target2 || !(target2 instanceof Element)) { - return target2; - } - return getClosestInteractive(target2); -} -__name(getClickTargetNode, "getClickTargetNode"); -function getTargetNode(event) { - if (isEventWithTarget(event)) { - return event.target; - } - return event; -} -__name(getTargetNode, "getTargetNode"); -function isEventWithTarget(event) { - return typeof event === "object" && !!event && "target" in event; -} -__name(isEventWithTarget, "isEventWithTarget"); -let handlers$2; -function onWindowOpen(cb) { - if (!handlers$2) { - handlers$2 = []; - monkeyPatchWindowOpen(); - } - handlers$2.push(cb); - return () => { - const pos = handlers$2 ? handlers$2.indexOf(cb) : -1; - if (pos > -1) { - handlers$2.splice(pos, 1); - } - }; -} -__name(onWindowOpen, "onWindowOpen"); -function monkeyPatchWindowOpen() { - fill(WINDOW$1, "open", function(originalWindowOpen) { - return function(...args) { - if (handlers$2) { - try { - handlers$2.forEach((handler12) => handler12()); - } catch (e2) { - } - } - return originalWindowOpen.apply(WINDOW$1, args); - }; - }); -} -__name(monkeyPatchWindowOpen, "monkeyPatchWindowOpen"); -const IncrementalMutationSources = /* @__PURE__ */ new Set([ - IncrementalSource.Mutation, - IncrementalSource.StyleSheetRule, - IncrementalSource.StyleDeclaration, - IncrementalSource.AdoptedStyleSheet, - IncrementalSource.CanvasMutation, - IncrementalSource.Selection, - IncrementalSource.MediaInteraction -]); -function handleClick$1(clickDetector, clickBreadcrumb, node3) { - clickDetector.handleClick(clickBreadcrumb, node3); -} -__name(handleClick$1, "handleClick$1"); -class ClickDetector { - static { - __name(this, "ClickDetector"); - } - // protected for testing - constructor(replay, slowClickConfig, _addBreadcrumbEvent = addBreadcrumbEvent) { - this._lastMutation = 0; - this._lastScroll = 0; - this._clicks = []; - this._timeout = slowClickConfig.timeout / 1e3; - this._threshold = slowClickConfig.threshold / 1e3; - this._scrollTimeout = slowClickConfig.scrollTimeout / 1e3; - this._replay = replay; - this._ignoreSelector = slowClickConfig.ignoreSelector; - this._addBreadcrumbEvent = _addBreadcrumbEvent; - } - /** Register click detection handlers on mutation or scroll. */ - addListeners() { - const cleanupWindowOpen = onWindowOpen(() => { - this._lastMutation = nowInSeconds(); - }); - this._teardown = () => { - cleanupWindowOpen(); - this._clicks = []; - this._lastMutation = 0; - this._lastScroll = 0; - }; - } - /** Clean up listeners. */ - removeListeners() { - if (this._teardown) { - this._teardown(); - } - if (this._checkClickTimeout) { - clearTimeout(this._checkClickTimeout); - } - } - /** @inheritDoc */ - handleClick(breadcrumb, node3) { - if (ignoreElement(node3, this._ignoreSelector) || !isClickBreadcrumb(breadcrumb)) { - return; - } - const newClick = { - timestamp: timestampToS(breadcrumb.timestamp), - clickBreadcrumb: breadcrumb, - // Set this to 0 so we know it originates from the click breadcrumb - clickCount: 0, - node: node3 - }; - if (this._clicks.some((click2) => click2.node === newClick.node && Math.abs(click2.timestamp - newClick.timestamp) < 1)) { - return; - } - this._clicks.push(newClick); - if (this._clicks.length === 1) { - this._scheduleCheckClicks(); - } - } - /** @inheritDoc */ - registerMutation(timestamp2 = Date.now()) { - this._lastMutation = timestampToS(timestamp2); - } - /** @inheritDoc */ - registerScroll(timestamp2 = Date.now()) { - this._lastScroll = timestampToS(timestamp2); - } - /** @inheritDoc */ - registerClick(element) { - const node3 = getClosestInteractive(element); - this._handleMultiClick(node3); - } - /** Count multiple clicks on elements. */ - _handleMultiClick(node3) { - this._getClicks(node3).forEach((click2) => { - click2.clickCount++; - }); - } - /** Get all pending clicks for a given node. */ - _getClicks(node3) { - return this._clicks.filter((click2) => click2.node === node3); - } - /** Check the clicks that happened. */ - _checkClicks() { - const timedOutClicks = []; - const now2 = nowInSeconds(); - this._clicks.forEach((click2) => { - if (!click2.mutationAfter && this._lastMutation) { - click2.mutationAfter = click2.timestamp <= this._lastMutation ? this._lastMutation - click2.timestamp : void 0; - } - if (!click2.scrollAfter && this._lastScroll) { - click2.scrollAfter = click2.timestamp <= this._lastScroll ? this._lastScroll - click2.timestamp : void 0; - } - if (click2.timestamp + this._timeout <= now2) { - timedOutClicks.push(click2); - } - }); - for (const click2 of timedOutClicks) { - const pos = this._clicks.indexOf(click2); - if (pos > -1) { - this._generateBreadcrumbs(click2); - this._clicks.splice(pos, 1); - } - } - if (this._clicks.length) { - this._scheduleCheckClicks(); - } - } - /** Generate matching breadcrumb(s) for the click. */ - _generateBreadcrumbs(click2) { - const replay = this._replay; - const hadScroll = click2.scrollAfter && click2.scrollAfter <= this._scrollTimeout; - const hadMutation = click2.mutationAfter && click2.mutationAfter <= this._threshold; - const isSlowClick = !hadScroll && !hadMutation; - const { clickCount, clickBreadcrumb } = click2; - if (isSlowClick) { - const timeAfterClickMs = Math.min(click2.mutationAfter || this._timeout, this._timeout) * 1e3; - const endReason = timeAfterClickMs < this._timeout * 1e3 ? "mutation" : "timeout"; - const breadcrumb = { - type: "default", - message: clickBreadcrumb.message, - timestamp: clickBreadcrumb.timestamp, - category: "ui.slowClickDetected", - data: { - ...clickBreadcrumb.data, - url: WINDOW$1.location.href, - route: replay.getCurrentRoute(), - timeAfterClickMs, - endReason, - // If clickCount === 0, it means multiClick was not correctly captured here - // - we still want to send 1 in this case - clickCount: clickCount || 1 - } - }; - this._addBreadcrumbEvent(replay, breadcrumb); - return; - } - if (clickCount > 1) { - const breadcrumb = { - type: "default", - message: clickBreadcrumb.message, - timestamp: clickBreadcrumb.timestamp, - category: "ui.multiClick", - data: { - ...clickBreadcrumb.data, - url: WINDOW$1.location.href, - route: replay.getCurrentRoute(), - clickCount, - metric: true - } - }; - this._addBreadcrumbEvent(replay, breadcrumb); - } - } - /** Schedule to check current clicks. */ - _scheduleCheckClicks() { - if (this._checkClickTimeout) { - clearTimeout(this._checkClickTimeout); - } - this._checkClickTimeout = setTimeout$3(() => this._checkClicks(), 1e3); - } -} -const SLOW_CLICK_TAGS = ["A", "BUTTON", "INPUT"]; -function ignoreElement(node3, ignoreSelector) { - if (!SLOW_CLICK_TAGS.includes(node3.tagName)) { - return true; - } - if (node3.tagName === "INPUT" && !["submit", "button"].includes(node3.getAttribute("type") || "")) { - return true; - } - if (node3.tagName === "A" && (node3.hasAttribute("download") || node3.hasAttribute("target") && node3.getAttribute("target") !== "_self")) { - return true; - } - if (ignoreSelector && node3.matches(ignoreSelector)) { - return true; - } - return false; -} -__name(ignoreElement, "ignoreElement"); -function isClickBreadcrumb(breadcrumb) { - return !!(breadcrumb.data && typeof breadcrumb.data.nodeId === "number" && breadcrumb.timestamp); -} -__name(isClickBreadcrumb, "isClickBreadcrumb"); -function nowInSeconds() { - return Date.now() / 1e3; -} -__name(nowInSeconds, "nowInSeconds"); -function updateClickDetectorForRecordingEvent(clickDetector, event) { - try { - if (!isIncrementalEvent(event)) { - return; - } - const { source } = event.data; - if (IncrementalMutationSources.has(source)) { - clickDetector.registerMutation(event.timestamp); - } - if (source === IncrementalSource.Scroll) { - clickDetector.registerScroll(event.timestamp); - } - if (isIncrementalMouseInteraction(event)) { - const { type, id: id3 } = event.data; - const node3 = record.mirror.getNode(id3); - if (node3 instanceof HTMLElement && type === MouseInteractions.Click) { - clickDetector.registerClick(node3); - } - } - } catch (e2) { - } -} -__name(updateClickDetectorForRecordingEvent, "updateClickDetectorForRecordingEvent"); -function isIncrementalEvent(event) { - return event.type === ReplayEventTypeIncrementalSnapshot; -} -__name(isIncrementalEvent, "isIncrementalEvent"); -function isIncrementalMouseInteraction(event) { - return event.data.source === IncrementalSource.MouseInteraction; -} -__name(isIncrementalMouseInteraction, "isIncrementalMouseInteraction"); -function createBreadcrumb(breadcrumb) { - return { - timestamp: Date.now() / 1e3, - type: "default", - ...breadcrumb - }; -} -__name(createBreadcrumb, "createBreadcrumb"); -var NodeType$4; -(function(NodeType3) { - NodeType3[NodeType3["Document"] = 0] = "Document"; - NodeType3[NodeType3["DocumentType"] = 1] = "DocumentType"; - NodeType3[NodeType3["Element"] = 2] = "Element"; - NodeType3[NodeType3["Text"] = 3] = "Text"; - NodeType3[NodeType3["CDATA"] = 4] = "CDATA"; - NodeType3[NodeType3["Comment"] = 5] = "Comment"; -})(NodeType$4 || (NodeType$4 = {})); -const ATTRIBUTES_TO_RECORD = /* @__PURE__ */ new Set([ - "id", - "class", - "aria-label", - "role", - "name", - "alt", - "title", - "data-test-id", - "data-testid", - "disabled", - "aria-disabled", - "data-sentry-component" -]); -function getAttributesToRecord(attributes) { - const obj = {}; - if (!attributes["data-sentry-component"] && attributes["data-sentry-element"]) { - attributes["data-sentry-component"] = attributes["data-sentry-element"]; - } - for (const key in attributes) { - if (ATTRIBUTES_TO_RECORD.has(key)) { - let normalizedKey = key; - if (key === "data-testid" || key === "data-test-id") { - normalizedKey = "testId"; - } - obj[normalizedKey] = attributes[key]; - } - } - return obj; -} -__name(getAttributesToRecord, "getAttributesToRecord"); -const handleDomListener = /* @__PURE__ */ __name((replay) => { - return (handlerData) => { - if (!replay.isEnabled()) { - return; - } - const result = handleDom(handlerData); - if (!result) { - return; - } - const isClick = handlerData.name === "click"; - const event = isClick ? handlerData.event : void 0; - if (isClick && replay.clickDetector && event && event.target && !event.altKey && !event.metaKey && !event.ctrlKey && !event.shiftKey) { - handleClick$1( - replay.clickDetector, - result, - getClickTargetNode(handlerData.event) - ); - } - addBreadcrumbEvent(replay, result); - }; -}, "handleDomListener"); -function getBaseDomBreadcrumb(target2, message3) { - const nodeId = record.mirror.getId(target2); - const node3 = nodeId && record.mirror.getNode(nodeId); - const meta = node3 && record.mirror.getMeta(node3); - const element = meta && isElement$2(meta) ? meta : null; - return { - message: message3, - data: element ? { - nodeId, - node: { - id: nodeId, - tagName: element.tagName, - textContent: Array.from(element.childNodes).map((node4) => node4.type === NodeType$4.Text && node4.textContent).filter(Boolean).map((text2) => text2.trim()).join(""), - attributes: getAttributesToRecord(element.attributes) - } - } : {} - }; -} -__name(getBaseDomBreadcrumb, "getBaseDomBreadcrumb"); -function handleDom(handlerData) { - const { target: target2, message: message3 } = getDomTarget(handlerData); - return createBreadcrumb({ - category: `ui.${handlerData.name}`, - ...getBaseDomBreadcrumb(target2, message3) - }); -} -__name(handleDom, "handleDom"); -function getDomTarget(handlerData) { - const isClick = handlerData.name === "click"; - let message3; - let target2 = null; - try { - target2 = isClick ? getClickTargetNode(handlerData.event) : getTargetNode(handlerData.event); - message3 = htmlTreeAsString(target2, { maxStringLength: 200 }) || ""; - } catch (e2) { - message3 = ""; - } - return { target: target2, message: message3 }; -} -__name(getDomTarget, "getDomTarget"); -function isElement$2(node3) { - return node3.type === NodeType$4.Element; -} -__name(isElement$2, "isElement$2"); -function handleKeyboardEvent(replay, event) { - if (!replay.isEnabled()) { - return; - } - replay.updateUserActivity(); - const breadcrumb = getKeyboardBreadcrumb(event); - if (!breadcrumb) { - return; - } - addBreadcrumbEvent(replay, breadcrumb); -} -__name(handleKeyboardEvent, "handleKeyboardEvent"); -function getKeyboardBreadcrumb(event) { - const { metaKey, shiftKey, ctrlKey, altKey, key, target: target2 } = event; - if (!target2 || isInputElement(target2) || !key) { - return null; - } - const hasModifierKey = metaKey || ctrlKey || altKey; - const isCharacterKey = key.length === 1; - if (!hasModifierKey && isCharacterKey) { - return null; - } - const message3 = htmlTreeAsString(target2, { maxStringLength: 200 }) || ""; - const baseBreadcrumb = getBaseDomBreadcrumb(target2, message3); - return createBreadcrumb({ - category: "ui.keyDown", - message: message3, - data: { - ...baseBreadcrumb.data, - metaKey, - shiftKey, - ctrlKey, - altKey, - key - } - }); -} -__name(getKeyboardBreadcrumb, "getKeyboardBreadcrumb"); -function isInputElement(target2) { - return target2.tagName === "INPUT" || target2.tagName === "TEXTAREA" || target2.isContentEditable; -} -__name(isInputElement, "isInputElement"); -const ENTRY_TYPES = { - // @ts-expect-error TODO: entry type does not fit the create* functions entry type - resource: createResourceEntry, - paint: createPaintEntry, - // @ts-expect-error TODO: entry type does not fit the create* functions entry type - navigation: createNavigationEntry -}; -function webVitalHandler(getter, replay) { - return ({ metric }) => void replay.replayPerformanceEntries.push(getter(metric)); -} -__name(webVitalHandler, "webVitalHandler"); -function createPerformanceEntries(entries) { - return entries.map(createPerformanceEntry).filter(Boolean); -} -__name(createPerformanceEntries, "createPerformanceEntries"); -function createPerformanceEntry(entry) { - const entryType = ENTRY_TYPES[entry.entryType]; - if (!entryType) { - return null; - } - return entryType(entry); -} -__name(createPerformanceEntry, "createPerformanceEntry"); -function getAbsoluteTime$1(time) { - return ((browserPerformanceTimeOrigin || WINDOW$1.performance.timeOrigin) + time) / 1e3; -} -__name(getAbsoluteTime$1, "getAbsoluteTime$1"); -function createPaintEntry(entry) { - const { duration, entryType, name: name2, startTime } = entry; - const start2 = getAbsoluteTime$1(startTime); - return { - type: entryType, - name: name2, - start: start2, - end: start2 + duration, - data: void 0 - }; -} -__name(createPaintEntry, "createPaintEntry"); -function createNavigationEntry(entry) { - const { - entryType, - name: name2, - decodedBodySize, - duration, - domComplete, - encodedBodySize, - domContentLoadedEventStart, - domContentLoadedEventEnd, - domInteractive, - loadEventStart, - loadEventEnd, - redirectCount, - startTime, - transferSize, - type - } = entry; - if (duration === 0) { - return null; - } - return { - type: `${entryType}.${type}`, - start: getAbsoluteTime$1(startTime), - end: getAbsoluteTime$1(domComplete), - name: name2, - data: { - size: transferSize, - decodedBodySize, - encodedBodySize, - duration, - domInteractive, - domContentLoadedEventStart, - domContentLoadedEventEnd, - loadEventStart, - loadEventEnd, - domComplete, - redirectCount - } - }; -} -__name(createNavigationEntry, "createNavigationEntry"); -function createResourceEntry(entry) { - const { - entryType, - initiatorType, - name: name2, - responseEnd, - startTime, - decodedBodySize, - encodedBodySize, - responseStatus, - transferSize - } = entry; - if (["fetch", "xmlhttprequest"].includes(initiatorType)) { - return null; - } - return { - type: `${entryType}.${initiatorType}`, - start: getAbsoluteTime$1(startTime), - end: getAbsoluteTime$1(responseEnd), - name: name2, - data: { - size: transferSize, - statusCode: responseStatus, - decodedBodySize, - encodedBodySize - } - }; -} -__name(createResourceEntry, "createResourceEntry"); -function getLargestContentfulPaint(metric) { - const lastEntry = metric.entries[metric.entries.length - 1]; - const node3 = lastEntry && lastEntry.element ? [lastEntry.element] : void 0; - return getWebVital(metric, "largest-contentful-paint", node3); -} -__name(getLargestContentfulPaint, "getLargestContentfulPaint"); -function isLayoutShift(entry) { - return entry.sources !== void 0; -} -__name(isLayoutShift, "isLayoutShift"); -function getCumulativeLayoutShift(metric) { - const layoutShifts = []; - const nodes = []; - for (const entry of metric.entries) { - if (isLayoutShift(entry)) { - const nodeIds = []; - for (const source of entry.sources) { - if (source.node) { - nodes.push(source.node); - const nodeId = record.mirror.getId(source.node); - if (nodeId) { - nodeIds.push(nodeId); - } - } - } - layoutShifts.push({ value: entry.value, nodeIds: nodeIds.length ? nodeIds : void 0 }); - } - } - return getWebVital(metric, "cumulative-layout-shift", nodes, layoutShifts); -} -__name(getCumulativeLayoutShift, "getCumulativeLayoutShift"); -function getFirstInputDelay(metric) { - const lastEntry = metric.entries[metric.entries.length - 1]; - const node3 = lastEntry && lastEntry.target ? [lastEntry.target] : void 0; - return getWebVital(metric, "first-input-delay", node3); -} -__name(getFirstInputDelay, "getFirstInputDelay"); -function getInteractionToNextPaint(metric) { - const lastEntry = metric.entries[metric.entries.length - 1]; - const node3 = lastEntry && lastEntry.target ? [lastEntry.target] : void 0; - return getWebVital(metric, "interaction-to-next-paint", node3); -} -__name(getInteractionToNextPaint, "getInteractionToNextPaint"); -function getWebVital(metric, name2, nodes, attributions) { - const value4 = metric.value; - const rating = metric.rating; - const end = getAbsoluteTime$1(value4); - return { - type: "web-vital", - name: name2, - start: end, - end, - data: { - value: value4, - size: value4, - rating, - nodeIds: nodes ? nodes.map((node3) => record.mirror.getId(node3)) : void 0, - attributions - } - }; -} -__name(getWebVital, "getWebVital"); -function setupPerformanceObserver(replay) { - function addPerformanceEntry(entry) { - if (!replay.performanceEntries.includes(entry)) { - replay.performanceEntries.push(entry); - } - } - __name(addPerformanceEntry, "addPerformanceEntry"); - function onEntries({ entries }) { - entries.forEach(addPerformanceEntry); - } - __name(onEntries, "onEntries"); - const clearCallbacks = []; - ["navigation", "paint", "resource"].forEach((type) => { - clearCallbacks.push(addPerformanceInstrumentationHandler(type, onEntries)); - }); - clearCallbacks.push( - addLcpInstrumentationHandler(webVitalHandler(getLargestContentfulPaint, replay)), - addClsInstrumentationHandler(webVitalHandler(getCumulativeLayoutShift, replay)), - addFidInstrumentationHandler(webVitalHandler(getFirstInputDelay, replay)), - addInpInstrumentationHandler(webVitalHandler(getInteractionToNextPaint, replay)) - ); - return () => { - clearCallbacks.forEach((clearCallback) => clearCallback()); - }; -} -__name(setupPerformanceObserver, "setupPerformanceObserver"); -const DEBUG_BUILD$2 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; -const r$3 = `var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(t,e){for(var i=new n(31),a=0;a<31;++a)i[a]=e+=1<>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,a=0,s=new n(r);a>h]=l}else for(o=new n(i),a=0;a>15-t[a]);return o},g=new t(288);for(c=0;c<144;++c)g[c]=8;for(c=144;c<256;++c)g[c]=9;for(c=256;c<280;++c)g[c]=7;for(c=280;c<288;++c)g[c]=8;var w=new t(32);for(c=0;c<32;++c)w[c]=5;var p=d(g,9,0),y=d(w,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],a=0;ad&&(d=o[a].s);var g=new n(d+1),w=A(i[c-1],g,0);if(w>e){a=0;var p=0,y=w-e,m=1<e))break;p+=m-(1<>=y;p>0;){var M=o[a].s;g[M]=0&&p;--a){var E=o[a].s;g[E]==e&&(--g[E],++p)}w=e}return{t:new t(g),l:w}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,a=t[0],s=1,o=function(t){e[i++]=t},f=1;f<=r;++f)if(t[f]==a&&f!=r)++s;else{if(!a&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(a),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(a);s=1,a=t[f]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var a=0;a4&&!H[a[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(f,g)+T(h,w)+l,X=T(f,M)+T(h,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=p,P=g,Q=y,R=w;for(B=0;B255){_(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;_(r,m,Q[et]),m+=R[et],et>3&&(_(r,m,rt>>5&8191),m+=i[et])}else _(r,m,N[rt]),m+=P[rt]}return _(r,m,N[256]),m+P[256]},C=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e>>8;t=r},d:function(){return~t}}},L=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,a=0|r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},O=function(a,s,o,f,u){if(!u&&(u={l:1},s.dictionary)){var c=s.dictionary.subarray(-32768),v=new t(c.length+a.length);v.set(c),v.set(a,c.length),a=v,u.w=c.length}return function(a,s,o,f,u,c){var v=c.z||a.length,d=new t(f+v+5*(1+Math.ceil(v/7e3))+u),g=d.subarray(f,d.length-u),w=c.l,p=7&(c.r||0);if(s){p&&(g[0]=c.r>>3);for(var y=C[s-1],M=y>>13,E=8191&y,z=(1<7e3||q>24576)&&(N>423||!w)){p=U(a,g,0,F,I,S,O,q,G,j-G,p),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(a[j+Q]==a[j+Q-W]){for(var $=0;$Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;Pnt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|h[Q]<<18|l[R];var it=31&h[Q],at=31&l[R];O+=e[it]+i[at],++I[257+it],++S[at],B=j+Q,++L}else F[q++]=a[j],++I[a[j]]}}for(j=Math.max(j,B);j=v&&(g[p/8|0]=w,st=v),p=k(g,p+1,a.subarray(j,st))}c.i=v}return b(d,0,f+m(p)+u)}(a,null==s.level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+s.mem,o,f,u)},j=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},q=function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&j(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}},B=function(t){return 10+(t.filename?t.filename.length+1:0)},G=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(O(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var a=this.b.length-this.s.z;a&&(this.b.set(n.subarray(0,a),this.s.z),this.s.z=this.b.length,this.p(this.b,!1)),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(a),32768),this.s.z=n.length-a+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n}();var H=function(){function t(t,n){this.c=L(),this.v=1,G.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),G.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=O(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=L();i.p(n.dictionary),j(t,2,i.d())}}(r,this.o),this.v=0),n&&j(r,r.length-4,this.c.d()),this.ondata(r,n)},t}(),J="undefined"!=typeof TextEncoder&&new TextEncoder,K="undefined"!=typeof TextDecoder&&new TextDecoder;try{K.decode(F,{stream:!0})}catch(t){}var N=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(P(t),this.d=n||!1)},t}();function P(n,r){if(J)return J.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),a=0,s=function(t){i[a++]=t},o=0;oi.length){var f=new t(a+8+(e-o<<1));f.set(i),i=f}var h=n.charCodeAt(o);h<128||r?s(h):h<2048?(s(192|h>>6),s(128|63&h)):h>55295&&h<57344?(s(240|(h=65536+(1047552&h)|1023&n.charCodeAt(++o))>>18),s(128|h>>12&63),s(128|h>>6&63),s(128|63&h)):(s(224|h>>12),s(128|h>>6&63),s(128|63&h))}return b(i,0,a)}function Q(t){return function(t,n){n||(n={});var r=S(),e=t.length;r.p(t);var i=O(t,n,B(n),8),a=i.length;return q(i,n),j(i,a-8,r.d()),j(i,a-4,e),i}(P(t))}const R=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(const r of t)n+=r.length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n{this._deflatedData.push(t)},this.stream=new N(((t,n)=>{this.deflate.push(t,n)})),this.stream.push("[")}},V={clear:()=>{R.clear()},addEvent:t=>R.addEvent(t),finish:()=>R.finish(),compress:t=>Q(t)};addEventListener("message",(function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in V&&"function"==typeof V[n])try{const t=V[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});`; -function e$1() { - const e2 = new Blob([r$3]); - return URL.createObjectURL(e2); -} -__name(e$1, "e$1"); -const CONSOLE_LEVELS = ["info", "warn", "error", "log"]; -const PREFIX$1 = "[Replay] "; -function _addBreadcrumb(message3, level = "info") { - addBreadcrumb( - { - category: "console", - data: { - logger: "replay" - }, - level, - message: `${PREFIX$1}${message3}` - }, - { level } - ); -} -__name(_addBreadcrumb, "_addBreadcrumb"); -function makeReplayLogger() { - let _capture = false; - let _trace = false; - const _logger = { - exception: /* @__PURE__ */ __name(() => void 0, "exception"), - infoTick: /* @__PURE__ */ __name(() => void 0, "infoTick"), - setConfig: /* @__PURE__ */ __name((opts) => { - _capture = opts.captureExceptions; - _trace = opts.traceInternals; - }, "setConfig") - }; - if (DEBUG_BUILD$2) { - CONSOLE_LEVELS.forEach((name2) => { - _logger[name2] = (...args) => { - logger$2[name2](PREFIX$1, ...args); - if (_trace) { - _addBreadcrumb(args.join(""), severityLevelFromString(name2)); - } - }; - }); - _logger.exception = (error2, ...message3) => { - if (message3.length && _logger.error) { - _logger.error(...message3); - } - logger$2.error(PREFIX$1, error2); - if (_capture) { - captureException(error2); - } else if (_trace) { - _addBreadcrumb(error2, "error"); - } - }; - _logger.infoTick = (...args) => { - logger$2.info(PREFIX$1, ...args); - if (_trace) { - setTimeout(() => _addBreadcrumb(args[0]), 0); - } - }; - } else { - CONSOLE_LEVELS.forEach((name2) => { - _logger[name2] = () => void 0; - }); - } - return _logger; -} -__name(makeReplayLogger, "makeReplayLogger"); -const logger$1 = makeReplayLogger(); -class EventBufferSizeExceededError extends Error { - static { - __name(this, "EventBufferSizeExceededError"); - } - constructor() { - super(`Event buffer exceeded maximum size of ${REPLAY_MAX_EVENT_BUFFER_SIZE}.`); - } -} -class EventBufferArray { - static { - __name(this, "EventBufferArray"); - } - /** All the events that are buffered to be sent. */ - /** @inheritdoc */ - /** @inheritdoc */ - constructor() { - this.events = []; - this._totalSize = 0; - this.hasCheckout = false; - this.waitForCheckout = false; - } - /** @inheritdoc */ - get hasEvents() { - return this.events.length > 0; - } - /** @inheritdoc */ - get type() { - return "sync"; - } - /** @inheritdoc */ - destroy() { - this.events = []; - } - /** @inheritdoc */ - async addEvent(event) { - const eventSize = JSON.stringify(event).length; - this._totalSize += eventSize; - if (this._totalSize > REPLAY_MAX_EVENT_BUFFER_SIZE) { - throw new EventBufferSizeExceededError(); - } - this.events.push(event); - } - /** @inheritdoc */ - finish() { - return new Promise((resolve2) => { - const eventsRet = this.events; - this.clear(); - resolve2(JSON.stringify(eventsRet)); - }); - } - /** @inheritdoc */ - clear() { - this.events = []; - this._totalSize = 0; - this.hasCheckout = false; - } - /** @inheritdoc */ - getEarliestTimestamp() { - const timestamp2 = this.events.map((event) => event.timestamp).sort()[0]; - if (!timestamp2) { - return null; - } - return timestampToMs(timestamp2); - } -} -class WorkerHandler { - static { - __name(this, "WorkerHandler"); - } - constructor(worker) { - this._worker = worker; - this._id = 0; - } - /** - * Ensure the worker is ready (or not). - * This will either resolve when the worker is ready, or reject if an error occurred. - */ - ensureReady() { - if (this._ensureReadyPromise) { - return this._ensureReadyPromise; - } - this._ensureReadyPromise = new Promise((resolve2, reject3) => { - this._worker.addEventListener( - "message", - ({ data: data26 }) => { - if (data26.success) { - resolve2(); - } else { - reject3(); - } - }, - { once: true } - ); - this._worker.addEventListener( - "error", - (error2) => { - reject3(error2); - }, - { once: true } - ); - }); - return this._ensureReadyPromise; - } - /** - * Destroy the worker. - */ - destroy() { - DEBUG_BUILD$2 && logger$1.info("Destroying compression worker"); - this._worker.terminate(); - } - /** - * Post message to worker and wait for response before resolving promise. - */ - postMessage(method, arg) { - const id3 = this._getAndIncrementId(); - return new Promise((resolve2, reject3) => { - const listener = /* @__PURE__ */ __name(({ data: data26 }) => { - const response = data26; - if (response.method !== method) { - return; - } - if (response.id !== id3) { - return; - } - this._worker.removeEventListener("message", listener); - if (!response.success) { - DEBUG_BUILD$2 && logger$1.error("Error in compression worker: ", response.response); - reject3(new Error("Error in compression worker")); - return; - } - resolve2(response.response); - }, "listener"); - this._worker.addEventListener("message", listener); - this._worker.postMessage({ id: id3, method, arg }); - }); - } - /** Get the current ID and increment it for the next call. */ - _getAndIncrementId() { - return this._id++; - } -} -class EventBufferCompressionWorker { - static { - __name(this, "EventBufferCompressionWorker"); - } - /** @inheritdoc */ - /** @inheritdoc */ - constructor(worker) { - this._worker = new WorkerHandler(worker); - this._earliestTimestamp = null; - this._totalSize = 0; - this.hasCheckout = false; - this.waitForCheckout = false; - } - /** @inheritdoc */ - get hasEvents() { - return !!this._earliestTimestamp; - } - /** @inheritdoc */ - get type() { - return "worker"; - } - /** - * Ensure the worker is ready (or not). - * This will either resolve when the worker is ready, or reject if an error occurred. - */ - ensureReady() { - return this._worker.ensureReady(); - } - /** - * Destroy the event buffer. - */ - destroy() { - this._worker.destroy(); - } - /** - * Add an event to the event buffer. - * - * Returns true if event was successfully received and processed by worker. - */ - addEvent(event) { - const timestamp2 = timestampToMs(event.timestamp); - if (!this._earliestTimestamp || timestamp2 < this._earliestTimestamp) { - this._earliestTimestamp = timestamp2; - } - const data26 = JSON.stringify(event); - this._totalSize += data26.length; - if (this._totalSize > REPLAY_MAX_EVENT_BUFFER_SIZE) { - return Promise.reject(new EventBufferSizeExceededError()); - } - return this._sendEventToWorker(data26); - } - /** - * Finish the event buffer and return the compressed data. - */ - finish() { - return this._finishRequest(); - } - /** @inheritdoc */ - clear() { - this._earliestTimestamp = null; - this._totalSize = 0; - this.hasCheckout = false; - this._worker.postMessage("clear").then(null, (e2) => { - DEBUG_BUILD$2 && logger$1.exception(e2, 'Sending "clear" message to worker failed', e2); - }); - } - /** @inheritdoc */ - getEarliestTimestamp() { - return this._earliestTimestamp; - } - /** - * Send the event to the worker. - */ - _sendEventToWorker(data26) { - return this._worker.postMessage("addEvent", data26); - } - /** - * Finish the request and return the compressed data from the worker. - */ - async _finishRequest() { - const response = await this._worker.postMessage("finish"); - this._earliestTimestamp = null; - this._totalSize = 0; - return response; - } -} -class EventBufferProxy { - static { - __name(this, "EventBufferProxy"); - } - constructor(worker) { - this._fallback = new EventBufferArray(); - this._compression = new EventBufferCompressionWorker(worker); - this._used = this._fallback; - this._ensureWorkerIsLoadedPromise = this._ensureWorkerIsLoaded(); - } - /** @inheritdoc */ - get waitForCheckout() { - return this._used.waitForCheckout; - } - /** @inheritdoc */ - get type() { - return this._used.type; - } - /** @inheritDoc */ - get hasEvents() { - return this._used.hasEvents; - } - /** @inheritdoc */ - get hasCheckout() { - return this._used.hasCheckout; - } - /** @inheritdoc */ - set hasCheckout(value4) { - this._used.hasCheckout = value4; - } - /** @inheritdoc */ - // eslint-disable-next-line @typescript-eslint/adjacent-overload-signatures - set waitForCheckout(value4) { - this._used.waitForCheckout = value4; - } - /** @inheritDoc */ - destroy() { - this._fallback.destroy(); - this._compression.destroy(); - } - /** @inheritdoc */ - clear() { - return this._used.clear(); - } - /** @inheritdoc */ - getEarliestTimestamp() { - return this._used.getEarliestTimestamp(); - } - /** - * Add an event to the event buffer. - * - * Returns true if event was successfully added. - */ - addEvent(event) { - return this._used.addEvent(event); - } - /** @inheritDoc */ - async finish() { - await this.ensureWorkerIsLoaded(); - return this._used.finish(); - } - /** Ensure the worker has loaded. */ - ensureWorkerIsLoaded() { - return this._ensureWorkerIsLoadedPromise; - } - /** Actually check if the worker has been loaded. */ - async _ensureWorkerIsLoaded() { - try { - await this._compression.ensureReady(); - } catch (error2) { - DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to load the compression worker, falling back to simple buffer"); - return; - } - await this._switchToCompressionWorker(); - } - /** Switch the used buffer to the compression worker. */ - async _switchToCompressionWorker() { - const { events: events2, hasCheckout, waitForCheckout } = this._fallback; - const addEventPromises = []; - for (const event of events2) { - addEventPromises.push(this._compression.addEvent(event)); - } - this._compression.hasCheckout = hasCheckout; - this._compression.waitForCheckout = waitForCheckout; - this._used = this._compression; - try { - await Promise.all(addEventPromises); - this._fallback.clear(); - } catch (error2) { - DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to add events when switching buffers."); - } - } -} -function createEventBuffer({ - useCompression, - workerUrl: customWorkerUrl -}) { - if (useCompression && // eslint-disable-next-line no-restricted-globals - window.Worker) { - const worker = _loadWorker(customWorkerUrl); - if (worker) { - return worker; - } - } - DEBUG_BUILD$2 && logger$1.info("Using simple buffer"); - return new EventBufferArray(); -} -__name(createEventBuffer, "createEventBuffer"); -function _loadWorker(customWorkerUrl) { - try { - const workerUrl = customWorkerUrl || _getWorkerUrl(); - if (!workerUrl) { - return; - } - DEBUG_BUILD$2 && logger$1.info(`Using compression worker${customWorkerUrl ? ` from ${customWorkerUrl}` : ""}`); - const worker = new Worker(workerUrl); - return new EventBufferProxy(worker); - } catch (error2) { - DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to create compression worker"); - } -} -__name(_loadWorker, "_loadWorker"); -function _getWorkerUrl() { - if (typeof __SENTRY_EXCLUDE_REPLAY_WORKER__ === "undefined" || !__SENTRY_EXCLUDE_REPLAY_WORKER__) { - return e$1(); - } - return ""; -} -__name(_getWorkerUrl, "_getWorkerUrl"); -function hasSessionStorage() { - try { - return "sessionStorage" in WINDOW$1 && !!WINDOW$1.sessionStorage; - } catch (e2) { - return false; - } -} -__name(hasSessionStorage, "hasSessionStorage"); -function clearSession(replay) { - deleteSession(); - replay.session = void 0; -} -__name(clearSession, "clearSession"); -function deleteSession() { - if (!hasSessionStorage()) { - return; - } - try { - WINDOW$1.sessionStorage.removeItem(REPLAY_SESSION_KEY); - } catch (e2) { - } -} -__name(deleteSession, "deleteSession"); -function isSampled(sampleRate) { - if (sampleRate === void 0) { - return false; - } - return Math.random() < sampleRate; -} -__name(isSampled, "isSampled"); -function makeSession(session) { - const now2 = Date.now(); - const id3 = session.id || uuid4(); - const started = session.started || now2; - const lastActivity = session.lastActivity || now2; - const segmentId = session.segmentId || 0; - const sampled = session.sampled; - const previousSessionId = session.previousSessionId; - return { - id: id3, - started, - lastActivity, - segmentId, - sampled, - previousSessionId - }; -} -__name(makeSession, "makeSession"); -function saveSession(session) { - if (!hasSessionStorage()) { - return; - } - try { - WINDOW$1.sessionStorage.setItem(REPLAY_SESSION_KEY, JSON.stringify(session)); - } catch (e2) { - } -} -__name(saveSession, "saveSession"); -function getSessionSampleType(sessionSampleRate, allowBuffering) { - return isSampled(sessionSampleRate) ? "session" : allowBuffering ? "buffer" : false; -} -__name(getSessionSampleType, "getSessionSampleType"); -function createSession({ sessionSampleRate, allowBuffering, stickySession = false }, { previousSessionId } = {}) { - const sampled = getSessionSampleType(sessionSampleRate, allowBuffering); - const session = makeSession({ - sampled, - previousSessionId - }); - if (stickySession) { - saveSession(session); - } - return session; -} -__name(createSession, "createSession"); -function fetchSession() { - if (!hasSessionStorage()) { - return null; - } - try { - const sessionStringFromStorage = WINDOW$1.sessionStorage.getItem(REPLAY_SESSION_KEY); - if (!sessionStringFromStorage) { - return null; - } - const sessionObj = JSON.parse(sessionStringFromStorage); - DEBUG_BUILD$2 && logger$1.infoTick("Loading existing session"); - return makeSession(sessionObj); - } catch (e2) { - return null; - } -} -__name(fetchSession, "fetchSession"); -function isExpired(initialTime, expiry, targetTime = +/* @__PURE__ */ new Date()) { - if (initialTime === null || expiry === void 0 || expiry < 0) { - return true; - } - if (expiry === 0) { - return false; - } - return initialTime + expiry <= targetTime; -} -__name(isExpired, "isExpired"); -function isSessionExpired(session, { - maxReplayDuration, - sessionIdleExpire, - targetTime = Date.now() -}) { - return ( - // First, check that maximum session length has not been exceeded - isExpired(session.started, maxReplayDuration, targetTime) || // check that the idle timeout has not been exceeded (i.e. user has - // performed an action within the last `sessionIdleExpire` ms) - isExpired(session.lastActivity, sessionIdleExpire, targetTime) - ); -} -__name(isSessionExpired, "isSessionExpired"); -function shouldRefreshSession(session, { sessionIdleExpire, maxReplayDuration }) { - if (!isSessionExpired(session, { sessionIdleExpire, maxReplayDuration })) { - return false; - } - if (session.sampled === "buffer" && session.segmentId === 0) { - return false; - } - return true; -} -__name(shouldRefreshSession, "shouldRefreshSession"); -function loadOrCreateSession({ - sessionIdleExpire, - maxReplayDuration, - previousSessionId -}, sessionOptions) { - const existingSession = sessionOptions.stickySession && fetchSession(); - if (!existingSession) { - DEBUG_BUILD$2 && logger$1.infoTick("Creating new session"); - return createSession(sessionOptions, { previousSessionId }); - } - if (!shouldRefreshSession(existingSession, { sessionIdleExpire, maxReplayDuration })) { - return existingSession; - } - DEBUG_BUILD$2 && logger$1.infoTick("Session in sessionStorage is expired, creating new one..."); - return createSession(sessionOptions, { previousSessionId: existingSession.id }); -} -__name(loadOrCreateSession, "loadOrCreateSession"); -function isCustomEvent(event) { - return event.type === EventType.Custom; -} -__name(isCustomEvent, "isCustomEvent"); -function addEventSync(replay, event, isCheckout) { - if (!shouldAddEvent(replay, event)) { - return false; - } - _addEvent(replay, event, isCheckout); - return true; -} -__name(addEventSync, "addEventSync"); -function addEvent(replay, event, isCheckout) { - if (!shouldAddEvent(replay, event)) { - return Promise.resolve(null); - } - return _addEvent(replay, event, isCheckout); -} -__name(addEvent, "addEvent"); -async function _addEvent(replay, event, isCheckout) { - const { eventBuffer } = replay; - if (!eventBuffer || eventBuffer.waitForCheckout && !isCheckout) { - return null; - } - const isBufferMode = replay.recordingMode === "buffer"; - try { - if (isCheckout && isBufferMode) { - eventBuffer.clear(); - } - if (isCheckout) { - eventBuffer.hasCheckout = true; - eventBuffer.waitForCheckout = false; - } - const replayOptions = replay.getOptions(); - const eventAfterPossibleCallback = maybeApplyCallback(event, replayOptions.beforeAddRecordingEvent); - if (!eventAfterPossibleCallback) { - return; - } - return await eventBuffer.addEvent(eventAfterPossibleCallback); - } catch (error2) { - const isExceeded = error2 && error2 instanceof EventBufferSizeExceededError; - const reason = isExceeded ? "addEventSizeExceeded" : "addEvent"; - if (isExceeded && isBufferMode) { - eventBuffer.clear(); - eventBuffer.waitForCheckout = true; - return null; - } - replay.handleException(error2); - await replay.stop({ reason }); - const client = getClient(); - if (client) { - client.recordDroppedEvent("internal_sdk_error", "replay"); - } - } -} -__name(_addEvent, "_addEvent"); -function shouldAddEvent(replay, event) { - if (!replay.eventBuffer || replay.isPaused() || !replay.isEnabled()) { - return false; - } - const timestampInMs = timestampToMs(event.timestamp); - if (timestampInMs + replay.timeouts.sessionIdlePause < Date.now()) { - return false; - } - if (timestampInMs > replay.getContext().initialTimestamp + replay.getOptions().maxReplayDuration) { - DEBUG_BUILD$2 && logger$1.infoTick(`Skipping event with timestamp ${timestampInMs} because it is after maxReplayDuration`); - return false; - } - return true; -} -__name(shouldAddEvent, "shouldAddEvent"); -function maybeApplyCallback(event, callback) { - try { - if (typeof callback === "function" && isCustomEvent(event)) { - return callback(event); - } - } catch (error2) { - DEBUG_BUILD$2 && logger$1.exception(error2, "An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."); - return null; - } - return event; -} -__name(maybeApplyCallback, "maybeApplyCallback"); -function isErrorEvent(event) { - return !event.type; -} -__name(isErrorEvent, "isErrorEvent"); -function isTransactionEvent(event) { - return event.type === "transaction"; -} -__name(isTransactionEvent, "isTransactionEvent"); -function isReplayEvent(event) { - return event.type === "replay_event"; -} -__name(isReplayEvent, "isReplayEvent"); -function isFeedbackEvent(event) { - return event.type === "feedback"; -} -__name(isFeedbackEvent, "isFeedbackEvent"); -function handleAfterSendEvent(replay) { - return (event, sendResponse) => { - if (!replay.isEnabled() || !isErrorEvent(event) && !isTransactionEvent(event)) { - return; - } - const statusCode = sendResponse && sendResponse.statusCode; - if (!statusCode || statusCode < 200 || statusCode >= 300) { - return; - } - if (isTransactionEvent(event)) { - handleTransactionEvent(replay, event); - return; - } - handleErrorEvent(replay, event); - }; -} -__name(handleAfterSendEvent, "handleAfterSendEvent"); -function handleTransactionEvent(replay, event) { - const replayContext = replay.getContext(); - if (event.contexts && event.contexts.trace && event.contexts.trace.trace_id && replayContext.traceIds.size < 100) { - replayContext.traceIds.add(event.contexts.trace.trace_id); - } -} -__name(handleTransactionEvent, "handleTransactionEvent"); -function handleErrorEvent(replay, event) { - const replayContext = replay.getContext(); - if (event.event_id && replayContext.errorIds.size < 100) { - replayContext.errorIds.add(event.event_id); - } - if (replay.recordingMode !== "buffer" || !event.tags || !event.tags.replayId) { - return; - } - const { beforeErrorSampling } = replay.getOptions(); - if (typeof beforeErrorSampling === "function" && !beforeErrorSampling(event)) { - return; - } - setTimeout$3(async () => { - try { - await replay.sendBufferedReplayOrFlush(); - } catch (err) { - replay.handleException(err); - } - }); -} -__name(handleErrorEvent, "handleErrorEvent"); -function handleBeforeSendEvent(replay) { - return (event) => { - if (!replay.isEnabled() || !isErrorEvent(event)) { - return; - } - handleHydrationError(replay, event); - }; -} -__name(handleBeforeSendEvent, "handleBeforeSendEvent"); -function handleHydrationError(replay, event) { - const exceptionValue = event.exception && event.exception.values && event.exception.values[0] && event.exception.values[0].value; - if (typeof exceptionValue !== "string") { - return; - } - if ( - // Only matches errors in production builds of react-dom - // Example https://reactjs.org/docs/error-decoder.html?invariant=423 - // With newer React versions, the messages changed to a different website https://react.dev/errors/418 - exceptionValue.match( - /(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/ - ) || // Development builds of react-dom - // Error 1: Hydration failed because the initial UI does not match what was rendered on the server. - // Error 2: Text content does not match server-rendered HTML. Warning: Text content did not match. - exceptionValue.match(/(does not match server-rendered HTML|Hydration failed because)/i) - ) { - const breadcrumb = createBreadcrumb({ - category: "replay.hydrate-error", - data: { - url: getLocationHref() - } - }); - addBreadcrumbEvent(replay, breadcrumb); - } -} -__name(handleHydrationError, "handleHydrationError"); -function handleBreadcrumbs(replay) { - const client = getClient(); - if (!client) { - return; - } - client.on("beforeAddBreadcrumb", (breadcrumb) => beforeAddBreadcrumb(replay, breadcrumb)); -} -__name(handleBreadcrumbs, "handleBreadcrumbs"); -function beforeAddBreadcrumb(replay, breadcrumb) { - if (!replay.isEnabled() || !isBreadcrumbWithCategory(breadcrumb)) { - return; - } - const result = normalizeBreadcrumb(breadcrumb); - if (result) { - addBreadcrumbEvent(replay, result); - } -} -__name(beforeAddBreadcrumb, "beforeAddBreadcrumb"); -function normalizeBreadcrumb(breadcrumb) { - if (!isBreadcrumbWithCategory(breadcrumb) || [ - // fetch & xhr are handled separately,in handleNetworkBreadcrumbs - "fetch", - "xhr", - // These two are breadcrumbs for emitted sentry events, we don't care about them - "sentry.event", - "sentry.transaction" - ].includes(breadcrumb.category) || // We capture UI breadcrumbs separately - breadcrumb.category.startsWith("ui.")) { - return null; - } - if (breadcrumb.category === "console") { - return normalizeConsoleBreadcrumb(breadcrumb); - } - return createBreadcrumb(breadcrumb); -} -__name(normalizeBreadcrumb, "normalizeBreadcrumb"); -function normalizeConsoleBreadcrumb(breadcrumb) { - const args = breadcrumb.data && breadcrumb.data.arguments; - if (!Array.isArray(args) || args.length === 0) { - return createBreadcrumb(breadcrumb); - } - let isTruncated = false; - const normalizedArgs = args.map((arg) => { - if (!arg) { - return arg; - } - if (typeof arg === "string") { - if (arg.length > CONSOLE_ARG_MAX_SIZE) { - isTruncated = true; - return `${arg.slice(0, CONSOLE_ARG_MAX_SIZE)}…`; - } - return arg; - } - if (typeof arg === "object") { - try { - const normalizedArg = normalize$2(arg, 7); - const stringified = JSON.stringify(normalizedArg); - if (stringified.length > CONSOLE_ARG_MAX_SIZE) { - isTruncated = true; - return `${JSON.stringify(normalizedArg, null, 2).slice(0, CONSOLE_ARG_MAX_SIZE)}…`; - } - return normalizedArg; - } catch (e2) { - } - } - return arg; - }); - return createBreadcrumb({ - ...breadcrumb, - data: { - ...breadcrumb.data, - arguments: normalizedArgs, - ...isTruncated ? { _meta: { warnings: ["CONSOLE_ARG_TRUNCATED"] } } : {} - } - }); -} -__name(normalizeConsoleBreadcrumb, "normalizeConsoleBreadcrumb"); -function isBreadcrumbWithCategory(breadcrumb) { - return !!breadcrumb.category; -} -__name(isBreadcrumbWithCategory, "isBreadcrumbWithCategory"); -function isRrwebError(event, hint) { - if (event.type || !event.exception || !event.exception.values || !event.exception.values.length) { - return false; - } - if (hint.originalException && hint.originalException.__rrweb__) { - return true; - } - return false; -} -__name(isRrwebError, "isRrwebError"); -function resetReplayIdOnDynamicSamplingContext() { - const dsc = getCurrentScope$1().getPropagationContext().dsc; - if (dsc) { - delete dsc.replay_id; - } - const activeSpan = getActiveSpan(); - if (activeSpan) { - const dsc2 = getDynamicSamplingContextFromSpan(activeSpan); - delete dsc2.replay_id; - } -} -__name(resetReplayIdOnDynamicSamplingContext, "resetReplayIdOnDynamicSamplingContext"); -function addFeedbackBreadcrumb(replay, event) { - replay.triggerUserActivity(); - replay.addUpdate(() => { - if (!event.timestamp) { - return true; - } - replay.throttledAddEvent({ - type: EventType.Custom, - timestamp: event.timestamp * 1e3, - data: { - tag: "breadcrumb", - payload: { - timestamp: event.timestamp, - type: "default", - category: "sentry.feedback", - data: { - feedbackId: event.event_id - } - } - } - }); - return false; - }); -} -__name(addFeedbackBreadcrumb, "addFeedbackBreadcrumb"); -function shouldSampleForBufferEvent(replay, event) { - if (replay.recordingMode !== "buffer") { - return false; - } - if (event.message === UNABLE_TO_SEND_REPLAY) { - return false; - } - if (!event.exception || event.type) { - return false; - } - return isSampled(replay.getOptions().errorSampleRate); -} -__name(shouldSampleForBufferEvent, "shouldSampleForBufferEvent"); -function handleGlobalEventListener(replay) { - return Object.assign( - (event, hint) => { - if (!replay.isEnabled() || replay.isPaused()) { - return event; - } - if (isReplayEvent(event)) { - delete event.breadcrumbs; - return event; - } - if (!isErrorEvent(event) && !isTransactionEvent(event) && !isFeedbackEvent(event)) { - return event; - } - const isSessionActive = replay.checkAndHandleExpiredSession(); - if (!isSessionActive) { - resetReplayIdOnDynamicSamplingContext(); - return event; - } - if (isFeedbackEvent(event)) { - replay.flush(); - event.contexts.feedback.replay_id = replay.getSessionId(); - addFeedbackBreadcrumb(replay, event); - return event; - } - if (isRrwebError(event, hint) && !replay.getOptions()._experiments.captureExceptions) { - DEBUG_BUILD$2 && logger$1.log("Ignoring error from rrweb internals", event); - return null; - } - const isErrorEventSampled = shouldSampleForBufferEvent(replay, event); - const shouldTagReplayId = isErrorEventSampled || replay.recordingMode === "session"; - if (shouldTagReplayId) { - event.tags = { ...event.tags, replayId: replay.getSessionId() }; - } - return event; - }, - { id: "Replay" } - ); -} -__name(handleGlobalEventListener, "handleGlobalEventListener"); -function createPerformanceSpans(replay, entries) { - return entries.map(({ type, start: start2, end, name: name2, data: data26 }) => { - const response = replay.throttledAddEvent({ - type: EventType.Custom, - timestamp: start2, - data: { - tag: "performanceSpan", - payload: { - op: type, - description: name2, - startTimestamp: start2, - endTimestamp: end, - data: data26 - } - } - }); - return typeof response === "string" ? Promise.resolve(null) : response; - }); -} -__name(createPerformanceSpans, "createPerformanceSpans"); -function handleHistory(handlerData) { - const { from: from2, to } = handlerData; - const now2 = Date.now() / 1e3; - return { - type: "navigation.push", - start: now2, - end: now2, - name: to, - data: { - previous: from2 - } - }; -} -__name(handleHistory, "handleHistory"); -function handleHistorySpanListener(replay) { - return (handlerData) => { - if (!replay.isEnabled()) { - return; - } - const result = handleHistory(handlerData); - if (result === null) { - return; - } - replay.getContext().urls.push(result.name); - replay.triggerUserActivity(); - replay.addUpdate(() => { - createPerformanceSpans(replay, [result]); - return false; - }); - }; -} -__name(handleHistorySpanListener, "handleHistorySpanListener"); -function shouldFilterRequest(replay, url) { - if (DEBUG_BUILD$2 && replay.getOptions()._experiments.traceInternals) { - return false; - } - return isSentryRequestUrl(url, getClient()); -} -__name(shouldFilterRequest, "shouldFilterRequest"); -function addNetworkBreadcrumb(replay, result) { - if (!replay.isEnabled()) { - return; - } - if (result === null) { - return; - } - if (shouldFilterRequest(replay, result.name)) { - return; - } - replay.addUpdate(() => { - createPerformanceSpans(replay, [result]); - return true; - }); -} -__name(addNetworkBreadcrumb, "addNetworkBreadcrumb"); -function getBodySize(body) { - if (!body) { - return void 0; - } - const textEncoder = new TextEncoder(); - try { - if (typeof body === "string") { - return textEncoder.encode(body).length; - } - if (body instanceof URLSearchParams) { - return textEncoder.encode(body.toString()).length; - } - if (body instanceof FormData) { - const formDataStr = _serializeFormData(body); - return textEncoder.encode(formDataStr).length; - } - if (body instanceof Blob) { - return body.size; - } - if (body instanceof ArrayBuffer) { - return body.byteLength; - } - } catch (e2) { - } - return void 0; -} -__name(getBodySize, "getBodySize"); -function parseContentLengthHeader(header3) { - if (!header3) { - return void 0; - } - const size = parseInt(header3, 10); - return isNaN(size) ? void 0 : size; -} -__name(parseContentLengthHeader, "parseContentLengthHeader"); -function getBodyString(body) { - try { - if (typeof body === "string") { - return [body]; - } - if (body instanceof URLSearchParams) { - return [body.toString()]; - } - if (body instanceof FormData) { - return [_serializeFormData(body)]; - } - if (!body) { - return [void 0]; - } - } catch (error2) { - DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to serialize body", body); - return [void 0, "BODY_PARSE_ERROR"]; - } - DEBUG_BUILD$2 && logger$1.info("Skipping network body because of body type", body); - return [void 0, "UNPARSEABLE_BODY_TYPE"]; -} -__name(getBodyString, "getBodyString"); -function mergeWarning(info, warning) { - if (!info) { - return { - headers: {}, - size: void 0, - _meta: { - warnings: [warning] - } - }; - } - const newMeta = { ...info._meta }; - const existingWarnings = newMeta.warnings || []; - newMeta.warnings = [...existingWarnings, warning]; - info._meta = newMeta; - return info; -} -__name(mergeWarning, "mergeWarning"); -function makeNetworkReplayBreadcrumb(type, data26) { - if (!data26) { - return null; - } - const { startTimestamp, endTimestamp, url, method, statusCode, request, response } = data26; - const result = { - type, - start: startTimestamp / 1e3, - end: endTimestamp / 1e3, - name: url, - data: dropUndefinedKeys({ - method, - statusCode, - request, - response - }) - }; - return result; -} -__name(makeNetworkReplayBreadcrumb, "makeNetworkReplayBreadcrumb"); -function buildSkippedNetworkRequestOrResponse(bodySize) { - return { - headers: {}, - size: bodySize, - _meta: { - warnings: ["URL_SKIPPED"] - } - }; -} -__name(buildSkippedNetworkRequestOrResponse, "buildSkippedNetworkRequestOrResponse"); -function buildNetworkRequestOrResponse(headers, bodySize, body) { - if (!bodySize && Object.keys(headers).length === 0) { - return void 0; - } - if (!bodySize) { - return { - headers - }; - } - if (!body) { - return { - headers, - size: bodySize - }; - } - const info = { - headers, - size: bodySize - }; - const { body: normalizedBody, warnings } = normalizeNetworkBody(body); - info.body = normalizedBody; - if (warnings && warnings.length > 0) { - info._meta = { - warnings - }; - } - return info; -} -__name(buildNetworkRequestOrResponse, "buildNetworkRequestOrResponse"); -function getAllowedHeaders(headers, allowedHeaders) { - return Object.entries(headers).reduce((filteredHeaders, [key, value4]) => { - const normalizedKey = key.toLowerCase(); - if (allowedHeaders.includes(normalizedKey) && headers[key]) { - filteredHeaders[normalizedKey] = value4; - } - return filteredHeaders; - }, {}); -} -__name(getAllowedHeaders, "getAllowedHeaders"); -function _serializeFormData(formData) { - return new URLSearchParams(formData).toString(); -} -__name(_serializeFormData, "_serializeFormData"); -function normalizeNetworkBody(body) { - if (!body || typeof body !== "string") { - return { - body - }; - } - const exceedsSizeLimit = body.length > NETWORK_BODY_MAX_SIZE; - const isProbablyJson = _strIsProbablyJson(body); - if (exceedsSizeLimit) { - const truncatedBody = body.slice(0, NETWORK_BODY_MAX_SIZE); - if (isProbablyJson) { - return { - body: truncatedBody, - warnings: ["MAYBE_JSON_TRUNCATED"] - }; - } - return { - body: `${truncatedBody}…`, - warnings: ["TEXT_TRUNCATED"] - }; - } - if (isProbablyJson) { - try { - const jsonBody = JSON.parse(body); - return { - body: jsonBody - }; - } catch (e2) { - } - } - return { - body - }; -} -__name(normalizeNetworkBody, "normalizeNetworkBody"); -function _strIsProbablyJson(str) { - const first2 = str[0]; - const last = str[str.length - 1]; - return first2 === "[" && last === "]" || first2 === "{" && last === "}"; -} -__name(_strIsProbablyJson, "_strIsProbablyJson"); -function urlMatches(url, urls) { - const fullUrl = getFullUrl(url); - return stringMatchesSomePattern(fullUrl, urls); -} -__name(urlMatches, "urlMatches"); -function getFullUrl(url, baseURI = WINDOW$1.document.baseURI) { - if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith(WINDOW$1.location.origin)) { - return url; - } - const fixedUrl = new URL(url, baseURI); - if (fixedUrl.origin !== new URL(baseURI).origin) { - return url; - } - const fullUrl = fixedUrl.href; - if (!url.endsWith("/") && fullUrl.endsWith("/")) { - return fullUrl.slice(0, -1); - } - return fullUrl; -} -__name(getFullUrl, "getFullUrl"); -async function captureFetchBreadcrumbToReplay(breadcrumb, hint, options4) { - try { - const data26 = await _prepareFetchData(breadcrumb, hint, options4); - const result = makeNetworkReplayBreadcrumb("resource.fetch", data26); - addNetworkBreadcrumb(options4.replay, result); - } catch (error2) { - DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to capture fetch breadcrumb"); - } -} -__name(captureFetchBreadcrumbToReplay, "captureFetchBreadcrumbToReplay"); -function enrichFetchBreadcrumb(breadcrumb, hint) { - const { input, response } = hint; - const body = input ? _getFetchRequestArgBody(input) : void 0; - const reqSize = getBodySize(body); - const resSize = response ? parseContentLengthHeader(response.headers.get("content-length")) : void 0; - if (reqSize !== void 0) { - breadcrumb.data.request_body_size = reqSize; - } - if (resSize !== void 0) { - breadcrumb.data.response_body_size = resSize; - } -} -__name(enrichFetchBreadcrumb, "enrichFetchBreadcrumb"); -async function _prepareFetchData(breadcrumb, hint, options4) { - const now2 = Date.now(); - const { startTimestamp = now2, endTimestamp = now2 } = hint; - const { - url, - method, - status_code: statusCode = 0, - request_body_size: requestBodySize, - response_body_size: responseBodySize - } = breadcrumb.data; - const captureDetails = urlMatches(url, options4.networkDetailAllowUrls) && !urlMatches(url, options4.networkDetailDenyUrls); - const request = captureDetails ? _getRequestInfo(options4, hint.input, requestBodySize) : buildSkippedNetworkRequestOrResponse(requestBodySize); - const response = await _getResponseInfo(captureDetails, options4, hint.response, responseBodySize); - return { - startTimestamp, - endTimestamp, - url, - method, - statusCode, - request, - response - }; -} -__name(_prepareFetchData, "_prepareFetchData"); -function _getRequestInfo({ networkCaptureBodies, networkRequestHeaders }, input, requestBodySize) { - const headers = input ? getRequestHeaders(input, networkRequestHeaders) : {}; - if (!networkCaptureBodies) { - return buildNetworkRequestOrResponse(headers, requestBodySize, void 0); - } - const requestBody = _getFetchRequestArgBody(input); - const [bodyStr, warning] = getBodyString(requestBody); - const data26 = buildNetworkRequestOrResponse(headers, requestBodySize, bodyStr); - if (warning) { - return mergeWarning(data26, warning); - } - return data26; -} -__name(_getRequestInfo, "_getRequestInfo"); -async function _getResponseInfo(captureDetails, { - networkCaptureBodies, - networkResponseHeaders -}, response, responseBodySize) { - if (!captureDetails && responseBodySize !== void 0) { - return buildSkippedNetworkRequestOrResponse(responseBodySize); - } - const headers = response ? getAllHeaders(response.headers, networkResponseHeaders) : {}; - if (!response || !networkCaptureBodies && responseBodySize !== void 0) { - return buildNetworkRequestOrResponse(headers, responseBodySize, void 0); - } - const [bodyText, warning] = await _parseFetchResponseBody(response); - const result = getResponseData(bodyText, { - networkCaptureBodies, - responseBodySize, - captureDetails, - headers - }); - if (warning) { - return mergeWarning(result, warning); - } - return result; -} -__name(_getResponseInfo, "_getResponseInfo"); -function getResponseData(bodyText, { - networkCaptureBodies, - responseBodySize, - captureDetails, - headers -}) { - try { - const size = bodyText && bodyText.length && responseBodySize === void 0 ? getBodySize(bodyText) : responseBodySize; - if (!captureDetails) { - return buildSkippedNetworkRequestOrResponse(size); - } - if (networkCaptureBodies) { - return buildNetworkRequestOrResponse(headers, size, bodyText); - } - return buildNetworkRequestOrResponse(headers, size, void 0); - } catch (error2) { - DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to serialize response body"); - return buildNetworkRequestOrResponse(headers, responseBodySize, void 0); - } -} -__name(getResponseData, "getResponseData"); -async function _parseFetchResponseBody(response) { - const res = _tryCloneResponse(response); - if (!res) { - return [void 0, "BODY_PARSE_ERROR"]; - } - try { - const text2 = await _tryGetResponseText(res); - return [text2]; - } catch (error2) { - if (error2 instanceof Error && error2.message.indexOf("Timeout") > -1) { - DEBUG_BUILD$2 && logger$1.warn("Parsing text body from response timed out"); - return [void 0, "BODY_PARSE_TIMEOUT"]; - } - DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to get text body from response"); - return [void 0, "BODY_PARSE_ERROR"]; - } -} -__name(_parseFetchResponseBody, "_parseFetchResponseBody"); -function _getFetchRequestArgBody(fetchArgs = []) { - if (fetchArgs.length !== 2 || typeof fetchArgs[1] !== "object") { - return void 0; - } - return fetchArgs[1].body; -} -__name(_getFetchRequestArgBody, "_getFetchRequestArgBody"); -function getAllHeaders(headers, allowedHeaders) { - const allHeaders = {}; - allowedHeaders.forEach((header3) => { - if (headers.get(header3)) { - allHeaders[header3] = headers.get(header3); - } - }); - return allHeaders; -} -__name(getAllHeaders, "getAllHeaders"); -function getRequestHeaders(fetchArgs, allowedHeaders) { - if (fetchArgs.length === 1 && typeof fetchArgs[0] !== "string") { - return getHeadersFromOptions(fetchArgs[0], allowedHeaders); - } - if (fetchArgs.length === 2) { - return getHeadersFromOptions(fetchArgs[1], allowedHeaders); - } - return {}; -} -__name(getRequestHeaders, "getRequestHeaders"); -function getHeadersFromOptions(input, allowedHeaders) { - if (!input) { - return {}; - } - const headers = input.headers; - if (!headers) { - return {}; - } - if (headers instanceof Headers) { - return getAllHeaders(headers, allowedHeaders); - } - if (Array.isArray(headers)) { - return {}; - } - return getAllowedHeaders(headers, allowedHeaders); -} -__name(getHeadersFromOptions, "getHeadersFromOptions"); -function _tryCloneResponse(response) { - try { - return response.clone(); - } catch (error2) { - DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to clone response body"); - } -} -__name(_tryCloneResponse, "_tryCloneResponse"); -function _tryGetResponseText(response) { - return new Promise((resolve2, reject3) => { - const timeout = setTimeout$3(() => reject3(new Error("Timeout while trying to read response body")), 500); - _getResponseText(response).then( - (txt) => resolve2(txt), - (reason) => reject3(reason) - ).finally(() => clearTimeout(timeout)); - }); -} -__name(_tryGetResponseText, "_tryGetResponseText"); -async function _getResponseText(response) { - return await response.text(); -} -__name(_getResponseText, "_getResponseText"); -async function captureXhrBreadcrumbToReplay(breadcrumb, hint, options4) { - try { - const data26 = _prepareXhrData(breadcrumb, hint, options4); - const result = makeNetworkReplayBreadcrumb("resource.xhr", data26); - addNetworkBreadcrumb(options4.replay, result); - } catch (error2) { - DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to capture xhr breadcrumb"); - } -} -__name(captureXhrBreadcrumbToReplay, "captureXhrBreadcrumbToReplay"); -function enrichXhrBreadcrumb(breadcrumb, hint) { - const { xhr, input } = hint; - if (!xhr) { - return; - } - const reqSize = getBodySize(input); - const resSize = xhr.getResponseHeader("content-length") ? parseContentLengthHeader(xhr.getResponseHeader("content-length")) : _getBodySize(xhr.response, xhr.responseType); - if (reqSize !== void 0) { - breadcrumb.data.request_body_size = reqSize; - } - if (resSize !== void 0) { - breadcrumb.data.response_body_size = resSize; - } -} -__name(enrichXhrBreadcrumb, "enrichXhrBreadcrumb"); -function _prepareXhrData(breadcrumb, hint, options4) { - const now2 = Date.now(); - const { startTimestamp = now2, endTimestamp = now2, input, xhr } = hint; - const { - url, - method, - status_code: statusCode = 0, - request_body_size: requestBodySize, - response_body_size: responseBodySize - } = breadcrumb.data; - if (!url) { - return null; - } - if (!xhr || !urlMatches(url, options4.networkDetailAllowUrls) || urlMatches(url, options4.networkDetailDenyUrls)) { - const request2 = buildSkippedNetworkRequestOrResponse(requestBodySize); - const response2 = buildSkippedNetworkRequestOrResponse(responseBodySize); - return { - startTimestamp, - endTimestamp, - url, - method, - statusCode, - request: request2, - response: response2 - }; - } - const xhrInfo = xhr[SENTRY_XHR_DATA_KEY]; - const networkRequestHeaders = xhrInfo ? getAllowedHeaders(xhrInfo.request_headers, options4.networkRequestHeaders) : {}; - const networkResponseHeaders = getAllowedHeaders(getResponseHeaders(xhr), options4.networkResponseHeaders); - const [requestBody, requestWarning] = options4.networkCaptureBodies ? getBodyString(input) : [void 0]; - const [responseBody, responseWarning] = options4.networkCaptureBodies ? _getXhrResponseBody(xhr) : [void 0]; - const request = buildNetworkRequestOrResponse(networkRequestHeaders, requestBodySize, requestBody); - const response = buildNetworkRequestOrResponse(networkResponseHeaders, responseBodySize, responseBody); - return { - startTimestamp, - endTimestamp, - url, - method, - statusCode, - request: requestWarning ? mergeWarning(request, requestWarning) : request, - response: responseWarning ? mergeWarning(response, responseWarning) : response - }; -} -__name(_prepareXhrData, "_prepareXhrData"); -function getResponseHeaders(xhr) { - const headers = xhr.getAllResponseHeaders(); - if (!headers) { - return {}; - } - return headers.split("\r\n").reduce((acc, line) => { - const [key, value4] = line.split(": "); - if (value4) { - acc[key.toLowerCase()] = value4; - } - return acc; - }, {}); -} -__name(getResponseHeaders, "getResponseHeaders"); -function _getXhrResponseBody(xhr) { - const errors2 = []; - try { - return [xhr.responseText]; - } catch (e2) { - errors2.push(e2); - } - try { - return _parseXhrResponse(xhr.response, xhr.responseType); - } catch (e2) { - errors2.push(e2); - } - DEBUG_BUILD$2 && logger$1.warn("Failed to get xhr response body", ...errors2); - return [void 0]; -} -__name(_getXhrResponseBody, "_getXhrResponseBody"); -function _parseXhrResponse(body, responseType) { - try { - if (typeof body === "string") { - return [body]; - } - if (body instanceof Document) { - return [body.body.outerHTML]; - } - if (responseType === "json" && body && typeof body === "object") { - return [JSON.stringify(body)]; - } - if (!body) { - return [void 0]; - } - } catch (error2) { - DEBUG_BUILD$2 && logger$1.exception(error2, "Failed to serialize body", body); - return [void 0, "BODY_PARSE_ERROR"]; - } - DEBUG_BUILD$2 && logger$1.info("Skipping network body because of body type", body); - return [void 0, "UNPARSEABLE_BODY_TYPE"]; -} -__name(_parseXhrResponse, "_parseXhrResponse"); -function _getBodySize(body, responseType) { - try { - const bodyStr = responseType === "json" && body && typeof body === "object" ? JSON.stringify(body) : body; - return getBodySize(bodyStr); - } catch (e2) { - return void 0; - } -} -__name(_getBodySize, "_getBodySize"); -function handleNetworkBreadcrumbs(replay) { - const client = getClient(); - try { - const { - networkDetailAllowUrls, - networkDetailDenyUrls, - networkCaptureBodies, - networkRequestHeaders, - networkResponseHeaders - } = replay.getOptions(); - const options4 = { - replay, - networkDetailAllowUrls, - networkDetailDenyUrls, - networkCaptureBodies, - networkRequestHeaders, - networkResponseHeaders - }; - if (client) { - client.on("beforeAddBreadcrumb", (breadcrumb, hint) => beforeAddNetworkBreadcrumb(options4, breadcrumb, hint)); - } - } catch (e2) { - } -} -__name(handleNetworkBreadcrumbs, "handleNetworkBreadcrumbs"); -function beforeAddNetworkBreadcrumb(options4, breadcrumb, hint) { - if (!breadcrumb.data) { - return; - } - try { - if (_isXhrBreadcrumb(breadcrumb) && _isXhrHint(hint)) { - enrichXhrBreadcrumb(breadcrumb, hint); - captureXhrBreadcrumbToReplay(breadcrumb, hint, options4); - } - if (_isFetchBreadcrumb(breadcrumb) && _isFetchHint(hint)) { - enrichFetchBreadcrumb(breadcrumb, hint); - captureFetchBreadcrumbToReplay(breadcrumb, hint, options4); - } - } catch (e2) { - DEBUG_BUILD$2 && logger$1.exception(e2, "Error when enriching network breadcrumb"); - } -} -__name(beforeAddNetworkBreadcrumb, "beforeAddNetworkBreadcrumb"); -function _isXhrBreadcrumb(breadcrumb) { - return breadcrumb.category === "xhr"; -} -__name(_isXhrBreadcrumb, "_isXhrBreadcrumb"); -function _isFetchBreadcrumb(breadcrumb) { - return breadcrumb.category === "fetch"; -} -__name(_isFetchBreadcrumb, "_isFetchBreadcrumb"); -function _isXhrHint(hint) { - return hint && hint.xhr; -} -__name(_isXhrHint, "_isXhrHint"); -function _isFetchHint(hint) { - return hint && hint.response; -} -__name(_isFetchHint, "_isFetchHint"); -function addGlobalListeners(replay) { - const client = getClient(); - addClickKeypressInstrumentationHandler(handleDomListener(replay)); - addHistoryInstrumentationHandler(handleHistorySpanListener(replay)); - handleBreadcrumbs(replay); - handleNetworkBreadcrumbs(replay); - const eventProcessor = handleGlobalEventListener(replay); - addEventProcessor(eventProcessor); - if (client) { - client.on("beforeSendEvent", handleBeforeSendEvent(replay)); - client.on("afterSendEvent", handleAfterSendEvent(replay)); - client.on("createDsc", (dsc) => { - const replayId = replay.getSessionId(); - if (replayId && replay.isEnabled() && replay.recordingMode === "session") { - const isSessionActive = replay.checkAndHandleExpiredSession(); - if (isSessionActive) { - dsc.replay_id = replayId; - } - } - }); - client.on("spanStart", (span) => { - replay.lastActiveSpan = span; - }); - client.on("spanEnd", (span) => { - replay.lastActiveSpan = span; - }); - client.on("beforeSendFeedback", (feedbackEvent, options4) => { - const replayId = replay.getSessionId(); - if (options4 && options4.includeReplay && replay.isEnabled() && replayId) { - if (feedbackEvent.contexts && feedbackEvent.contexts.feedback) { - feedbackEvent.contexts.feedback.replay_id = replayId; - } - } - }); - } -} -__name(addGlobalListeners, "addGlobalListeners"); -async function addMemoryEntry(replay) { - try { - return Promise.all( - createPerformanceSpans(replay, [ - // @ts-expect-error memory doesn't exist on type Performance as the API is non-standard (we check that it exists above) - createMemoryEntry(WINDOW$1.performance.memory) - ]) - ); - } catch (error2) { - return []; - } -} -__name(addMemoryEntry, "addMemoryEntry"); -function createMemoryEntry(memoryEntry) { - const { jsHeapSizeLimit, totalJSHeapSize, usedJSHeapSize } = memoryEntry; - const time = Date.now() / 1e3; - return { - type: "memory", - name: "memory", - start: time, - end: time, - data: { - memory: { - jsHeapSizeLimit, - totalJSHeapSize, - usedJSHeapSize - } - } - }; -} -__name(createMemoryEntry, "createMemoryEntry"); -function debounce(func, wait, options4) { - let callbackReturnValue; - let timerId; - let maxTimerId; - const maxWait = options4 && options4.maxWait ? Math.max(options4.maxWait, wait) : 0; - function invokeFunc() { - cancelTimers(); - callbackReturnValue = func(); - return callbackReturnValue; - } - __name(invokeFunc, "invokeFunc"); - function cancelTimers() { - timerId !== void 0 && clearTimeout(timerId); - maxTimerId !== void 0 && clearTimeout(maxTimerId); - timerId = maxTimerId = void 0; - } - __name(cancelTimers, "cancelTimers"); - function flush2() { - if (timerId !== void 0 || maxTimerId !== void 0) { - return invokeFunc(); - } - return callbackReturnValue; - } - __name(flush2, "flush"); - function debounced() { - if (timerId) { - clearTimeout(timerId); - } - timerId = setTimeout$3(invokeFunc, wait); - if (maxWait && maxTimerId === void 0) { - maxTimerId = setTimeout$3(invokeFunc, maxWait); - } - return callbackReturnValue; - } - __name(debounced, "debounced"); - debounced.cancel = cancelTimers; - debounced.flush = flush2; - return debounced; -} -__name(debounce, "debounce"); -function getHandleRecordingEmit(replay) { - let hadFirstEvent = false; - return (event, _isCheckout) => { - if (!replay.checkAndHandleExpiredSession()) { - DEBUG_BUILD$2 && logger$1.warn("Received replay event after session expired."); - return; - } - const isCheckout = _isCheckout || !hadFirstEvent; - hadFirstEvent = true; - if (replay.clickDetector) { - updateClickDetectorForRecordingEvent(replay.clickDetector, event); - } - replay.addUpdate(() => { - if (replay.recordingMode === "buffer" && isCheckout) { - replay.setInitialState(); - } - if (!addEventSync(replay, event, isCheckout)) { - return true; - } - if (!isCheckout) { - return false; - } - const session = replay.session; - addSettingsEvent(replay, isCheckout); - if (replay.recordingMode === "buffer" && session && replay.eventBuffer) { - const earliestEvent = replay.eventBuffer.getEarliestTimestamp(); - if (earliestEvent) { - DEBUG_BUILD$2 && logger$1.info(`Updating session start time to earliest event in buffer to ${new Date(earliestEvent)}`); - session.started = earliestEvent; - if (replay.getOptions().stickySession) { - saveSession(session); - } - } - } - if (session && session.previousSessionId) { - return true; - } - if (replay.recordingMode === "session") { - void replay.flush(); - } - return true; - }); - }; -} -__name(getHandleRecordingEmit, "getHandleRecordingEmit"); -function createOptionsEvent(replay) { - const options4 = replay.getOptions(); - return { - type: EventType.Custom, - timestamp: Date.now(), - data: { - tag: "options", - payload: { - shouldRecordCanvas: replay.isRecordingCanvas(), - sessionSampleRate: options4.sessionSampleRate, - errorSampleRate: options4.errorSampleRate, - useCompressionOption: options4.useCompression, - blockAllMedia: options4.blockAllMedia, - maskAllText: options4.maskAllText, - maskAllInputs: options4.maskAllInputs, - useCompression: replay.eventBuffer ? replay.eventBuffer.type === "worker" : false, - networkDetailHasUrls: options4.networkDetailAllowUrls.length > 0, - networkCaptureBodies: options4.networkCaptureBodies, - networkRequestHasHeaders: options4.networkRequestHeaders.length > 0, - networkResponseHasHeaders: options4.networkResponseHeaders.length > 0 - } - } - }; -} -__name(createOptionsEvent, "createOptionsEvent"); -function addSettingsEvent(replay, isCheckout) { - if (!isCheckout || !replay.session || replay.session.segmentId !== 0) { - return; - } - addEventSync(replay, createOptionsEvent(replay), false); -} -__name(addSettingsEvent, "addSettingsEvent"); -function createReplayEnvelope(replayEvent, recordingData, dsn, tunnel) { - return createEnvelope( - createEventEnvelopeHeaders(replayEvent, getSdkMetadataForEnvelopeHeader(replayEvent), tunnel, dsn), - [ - [{ type: "replay_event" }, replayEvent], - [ - { - type: "replay_recording", - // If string then we need to encode to UTF8, otherwise will have - // wrong size. TextEncoder has similar browser support to - // MutationObserver, although it does not accept IE11. - length: typeof recordingData === "string" ? new TextEncoder().encode(recordingData).length : recordingData.length - }, - recordingData - ] - ] - ); -} -__name(createReplayEnvelope, "createReplayEnvelope"); -function prepareRecordingData({ - recordingData, - headers -}) { - let payloadWithSequence; - const replayHeaders = `${JSON.stringify(headers)} -`; - if (typeof recordingData === "string") { - payloadWithSequence = `${replayHeaders}${recordingData}`; - } else { - const enc = new TextEncoder(); - const sequence = enc.encode(replayHeaders); - payloadWithSequence = new Uint8Array(sequence.length + recordingData.length); - payloadWithSequence.set(sequence); - payloadWithSequence.set(recordingData, sequence.length); - } - return payloadWithSequence; -} -__name(prepareRecordingData, "prepareRecordingData"); -async function prepareReplayEvent({ - client, - scope, - replayId: event_id, - event -}) { - const integrations = typeof client._integrations === "object" && client._integrations !== null && !Array.isArray(client._integrations) ? Object.keys(client._integrations) : void 0; - const eventHint = { event_id, integrations }; - client.emit("preprocessEvent", event, eventHint); - const preparedEvent = await prepareEvent( - client.getOptions(), - event, - eventHint, - scope, - client, - getIsolationScope() - ); - if (!preparedEvent) { - return null; - } - preparedEvent.platform = preparedEvent.platform || "javascript"; - const metadata = client.getSdkMetadata(); - const { name: name2, version: version2 } = metadata && metadata.sdk || {}; - preparedEvent.sdk = { - ...preparedEvent.sdk, - name: name2 || "sentry.javascript.unknown", - version: version2 || "0.0.0" - }; - return preparedEvent; -} -__name(prepareReplayEvent, "prepareReplayEvent"); -async function sendReplayRequest({ - recordingData, - replayId, - segmentId: segment_id, - eventContext, - timestamp: timestamp2, - session -}) { - const preparedRecordingData = prepareRecordingData({ - recordingData, - headers: { - segment_id - } - }); - const { urls, errorIds, traceIds, initialTimestamp } = eventContext; - const client = getClient(); - const scope = getCurrentScope$1(); - const transport = client && client.getTransport(); - const dsn = client && client.getDsn(); - if (!client || !transport || !dsn || !session.sampled) { - return resolvedSyncPromise({}); - } - const baseEvent = { - type: REPLAY_EVENT_NAME, - replay_start_timestamp: initialTimestamp / 1e3, - timestamp: timestamp2 / 1e3, - error_ids: errorIds, - trace_ids: traceIds, - urls, - replay_id: replayId, - segment_id, - replay_type: session.sampled - }; - const replayEvent = await prepareReplayEvent({ scope, client, replayId, event: baseEvent }); - if (!replayEvent) { - client.recordDroppedEvent("event_processor", "replay", baseEvent); - DEBUG_BUILD$2 && logger$1.info("An event processor returned `null`, will not send event."); - return resolvedSyncPromise({}); - } - delete replayEvent.sdkProcessingMetadata; - const envelope = createReplayEnvelope(replayEvent, preparedRecordingData, dsn, client.getOptions().tunnel); - let response; - try { - response = await transport.send(envelope); - } catch (err) { - const error2 = new Error(UNABLE_TO_SEND_REPLAY); - try { - error2.cause = err; - } catch (e2) { - } - throw error2; - } - if (typeof response.statusCode === "number" && (response.statusCode < 200 || response.statusCode >= 300)) { - throw new TransportStatusCodeError(response.statusCode); - } - const rateLimits = updateRateLimits({}, response); - if (isRateLimited(rateLimits, "replay")) { - throw new RateLimitError(rateLimits); - } - return response; -} -__name(sendReplayRequest, "sendReplayRequest"); -class TransportStatusCodeError extends Error { - static { - __name(this, "TransportStatusCodeError"); - } - constructor(statusCode) { - super(`Transport returned status code ${statusCode}`); - } -} -class RateLimitError extends Error { - static { - __name(this, "RateLimitError"); - } - constructor(rateLimits) { - super("Rate limit hit"); - this.rateLimits = rateLimits; - } -} -async function sendReplay(replayData, retryConfig = { - count: 0, - interval: RETRY_BASE_INTERVAL -}) { - const { recordingData, onError } = replayData; - if (!recordingData.length) { - return; - } - try { - await sendReplayRequest(replayData); - return true; - } catch (err) { - if (err instanceof TransportStatusCodeError || err instanceof RateLimitError) { - throw err; - } - setContext("Replays", { - _retryCount: retryConfig.count - }); - if (onError) { - onError(err); - } - if (retryConfig.count >= RETRY_MAX_COUNT) { - const error2 = new Error(`${UNABLE_TO_SEND_REPLAY} - max retries exceeded`); - try { - error2.cause = err; - } catch (e2) { - } - throw error2; - } - retryConfig.interval *= ++retryConfig.count; - return new Promise((resolve2, reject3) => { - setTimeout$3(async () => { - try { - await sendReplay(replayData, retryConfig); - resolve2(true); - } catch (err2) { - reject3(err2); - } - }, retryConfig.interval); - }); - } -} -__name(sendReplay, "sendReplay"); -const THROTTLED = "__THROTTLED"; -const SKIPPED = "__SKIPPED"; -function throttle$2(fn, maxCount, durationSeconds) { - const counter = /* @__PURE__ */ new Map(); - const _cleanup = /* @__PURE__ */ __name((now2) => { - const threshold = now2 - durationSeconds; - counter.forEach((_value, key) => { - if (key < threshold) { - counter.delete(key); - } - }); - }, "_cleanup"); - const _getTotalCount = /* @__PURE__ */ __name(() => { - return [...counter.values()].reduce((a2, b2) => a2 + b2, 0); - }, "_getTotalCount"); - let isThrottled = false; - return (...rest) => { - const now2 = Math.floor(Date.now() / 1e3); - _cleanup(now2); - if (_getTotalCount() >= maxCount) { - const wasThrottled = isThrottled; - isThrottled = true; - return wasThrottled ? SKIPPED : THROTTLED; - } - isThrottled = false; - const count = counter.get(now2) || 0; - counter.set(now2, count + 1); - return fn(...rest); - }; -} -__name(throttle$2, "throttle$2"); -class ReplayContainer { - static { - __name(this, "ReplayContainer"); - } - /** - * Recording can happen in one of two modes: - * - session: Record the whole session, sending it continuously - * - buffer: Always keep the last 60s of recording, requires: - * - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs - * - or calling `flush()` to send the replay - */ - /** - * The current or last active span. - * This is only available when performance is enabled. - */ - /** - * These are here so we can overwrite them in tests etc. - * @hidden - */ - /** The replay has to be manually started, because no sample rate (neither session or error) was provided. */ - /** - * Options to pass to `rrweb.record()` - */ - /** - * Timestamp of the last user activity. This lives across sessions. - */ - /** - * Is the integration currently active? - */ - /** - * Paused is a state where: - * - DOM Recording is not listening at all - * - Nothing will be added to event buffer (e.g. core SDK events) - */ - /** - * Have we attached listeners to the core SDK? - * Note we have to track this as there is no way to remove instrumentation handlers. - */ - /** - * Function to stop recording - */ - /** - * Internal use for canvas recording options - */ - constructor({ - options: options4, - recordingOptions - }) { - ReplayContainer.prototype.__init.call(this); - ReplayContainer.prototype.__init2.call(this); - ReplayContainer.prototype.__init3.call(this); - ReplayContainer.prototype.__init4.call(this); - ReplayContainer.prototype.__init5.call(this); - ReplayContainer.prototype.__init6.call(this); - this.eventBuffer = null; - this.performanceEntries = []; - this.replayPerformanceEntries = []; - this.recordingMode = "session"; - this.timeouts = { - sessionIdlePause: SESSION_IDLE_PAUSE_DURATION, - sessionIdleExpire: SESSION_IDLE_EXPIRE_DURATION - }; - this._lastActivity = Date.now(); - this._isEnabled = false; - this._isPaused = false; - this._requiresManualStart = false; - this._hasInitializedCoreListeners = false; - this._context = { - errorIds: /* @__PURE__ */ new Set(), - traceIds: /* @__PURE__ */ new Set(), - urls: [], - initialTimestamp: Date.now(), - initialUrl: "" - }; - this._recordingOptions = recordingOptions; - this._options = options4; - this._debouncedFlush = debounce(() => this._flush(), this._options.flushMinDelay, { - maxWait: this._options.flushMaxDelay - }); - this._throttledAddEvent = throttle$2( - (event, isCheckout) => addEvent(this, event, isCheckout), - // Max 300 events... - 300, - // ... per 5s - 5 - ); - const { slowClickTimeout, slowClickIgnoreSelectors } = this.getOptions(); - const slowClickConfig = slowClickTimeout ? { - threshold: Math.min(SLOW_CLICK_THRESHOLD, slowClickTimeout), - timeout: slowClickTimeout, - scrollTimeout: SLOW_CLICK_SCROLL_TIMEOUT, - ignoreSelector: slowClickIgnoreSelectors ? slowClickIgnoreSelectors.join(",") : "" - } : void 0; - if (slowClickConfig) { - this.clickDetector = new ClickDetector(this, slowClickConfig); - } - if (DEBUG_BUILD$2) { - const experiments = options4._experiments; - logger$1.setConfig({ - captureExceptions: !!experiments.captureExceptions, - traceInternals: !!experiments.traceInternals - }); - } - } - /** Get the event context. */ - getContext() { - return this._context; - } - /** If recording is currently enabled. */ - isEnabled() { - return this._isEnabled; - } - /** If recording is currently paused. */ - isPaused() { - return this._isPaused; - } - /** - * Determine if canvas recording is enabled - */ - isRecordingCanvas() { - return Boolean(this._canvas); - } - /** Get the replay integration options. */ - getOptions() { - return this._options; - } - /** A wrapper to conditionally capture exceptions. */ - handleException(error2) { - DEBUG_BUILD$2 && logger$1.exception(error2); - if (this._options.onError) { - this._options.onError(error2); - } - } - /** - * Initializes the plugin based on sampling configuration. Should not be - * called outside of constructor. - */ - initializeSampling(previousSessionId) { - const { errorSampleRate, sessionSampleRate } = this._options; - const requiresManualStart = errorSampleRate <= 0 && sessionSampleRate <= 0; - this._requiresManualStart = requiresManualStart; - if (requiresManualStart) { - return; - } - this._initializeSessionForSampling(previousSessionId); - if (!this.session) { - DEBUG_BUILD$2 && logger$1.exception(new Error("Unable to initialize and create session")); - return; - } - if (this.session.sampled === false) { - return; - } - this.recordingMode = this.session.sampled === "buffer" && this.session.segmentId === 0 ? "buffer" : "session"; - DEBUG_BUILD$2 && logger$1.infoTick(`Starting replay in ${this.recordingMode} mode`); - this._initializeRecording(); - } - /** - * Start a replay regardless of sampling rate. Calling this will always - * create a new session. Will log a message if replay is already in progress. - * - * Creates or loads a session, attaches listeners to varying events (DOM, - * _performanceObserver, Recording, Sentry SDK, etc) - */ - start() { - if (this._isEnabled && this.recordingMode === "session") { - DEBUG_BUILD$2 && logger$1.info("Recording is already in progress"); - return; - } - if (this._isEnabled && this.recordingMode === "buffer") { - DEBUG_BUILD$2 && logger$1.info("Buffering is in progress, call `flush()` to save the replay"); - return; - } - DEBUG_BUILD$2 && logger$1.infoTick("Starting replay in session mode"); - this._updateUserActivity(); - const session = loadOrCreateSession( - { - maxReplayDuration: this._options.maxReplayDuration, - sessionIdleExpire: this.timeouts.sessionIdleExpire - }, - { - stickySession: this._options.stickySession, - // This is intentional: create a new session-based replay when calling `start()` - sessionSampleRate: 1, - allowBuffering: false - } - ); - this.session = session; - this._initializeRecording(); - } - /** - * Start replay buffering. Buffers until `flush()` is called or, if - * `replaysOnErrorSampleRate` > 0, an error occurs. - */ - startBuffering() { - if (this._isEnabled) { - DEBUG_BUILD$2 && logger$1.info("Buffering is in progress, call `flush()` to save the replay"); - return; - } - DEBUG_BUILD$2 && logger$1.infoTick("Starting replay in buffer mode"); - const session = loadOrCreateSession( - { - sessionIdleExpire: this.timeouts.sessionIdleExpire, - maxReplayDuration: this._options.maxReplayDuration - }, - { - stickySession: this._options.stickySession, - sessionSampleRate: 0, - allowBuffering: true - } - ); - this.session = session; - this.recordingMode = "buffer"; - this._initializeRecording(); - } - /** - * Start recording. - * - * Note that this will cause a new DOM checkout - */ - startRecording() { - try { - const canvasOptions = this._canvas; - this._stopRecording = record({ - ...this._recordingOptions, - // When running in error sampling mode, we need to overwrite `checkoutEveryNms` - // Without this, it would record forever, until an error happens, which we don't want - // instead, we'll always keep the last 60 seconds of replay before an error happened - ...this.recordingMode === "buffer" ? { checkoutEveryNms: BUFFER_CHECKOUT_TIME } : ( - // Otherwise, use experimental option w/ min checkout time of 6 minutes - // This is to improve playback seeking as there could potentially be - // less mutations to process in the worse cases. - // - // checkout by "N" events is probably ideal, but means we have less - // control about the number of checkouts we make (which generally - // increases replay size) - this._options._experiments.continuousCheckout && { - // Minimum checkout time is 6 minutes - checkoutEveryNms: Math.max(36e4, this._options._experiments.continuousCheckout) - } - ), - emit: getHandleRecordingEmit(this), - onMutation: this._onMutationHandler, - ...canvasOptions ? { - recordCanvas: canvasOptions.recordCanvas, - getCanvasManager: canvasOptions.getCanvasManager, - sampling: canvasOptions.sampling, - dataURLOptions: canvasOptions.dataURLOptions - } : {} - }); - } catch (err) { - this.handleException(err); - } - } - /** - * Stops the recording, if it was running. - * - * Returns true if it was previously stopped, or is now stopped, - * otherwise false. - */ - stopRecording() { - try { - if (this._stopRecording) { - this._stopRecording(); - this._stopRecording = void 0; - } - return true; - } catch (err) { - this.handleException(err); - return false; - } - } - /** - * Currently, this needs to be manually called (e.g. for tests). Sentry SDK - * does not support a teardown - */ - async stop({ forceFlush = false, reason } = {}) { - if (!this._isEnabled) { - return; - } - this._isEnabled = false; - try { - DEBUG_BUILD$2 && logger$1.info(`Stopping Replay${reason ? ` triggered by ${reason}` : ""}`); - resetReplayIdOnDynamicSamplingContext(); - this._removeListeners(); - this.stopRecording(); - this._debouncedFlush.cancel(); - if (forceFlush) { - await this._flush({ force: true }); - } - this.eventBuffer && this.eventBuffer.destroy(); - this.eventBuffer = null; - clearSession(this); - } catch (err) { - this.handleException(err); - } - } - /** - * Pause some replay functionality. See comments for `_isPaused`. - * This differs from stop as this only stops DOM recording, it is - * not as thorough of a shutdown as `stop()`. - */ - pause() { - if (this._isPaused) { - return; - } - this._isPaused = true; - this.stopRecording(); - DEBUG_BUILD$2 && logger$1.info("Pausing replay"); - } - /** - * Resumes recording, see notes for `pause(). - * - * Note that calling `startRecording()` here will cause a - * new DOM checkout.` - */ - resume() { - if (!this._isPaused || !this._checkSession()) { - return; - } - this._isPaused = false; - this.startRecording(); - DEBUG_BUILD$2 && logger$1.info("Resuming replay"); - } - /** - * If not in "session" recording mode, flush event buffer which will create a new replay. - * Unless `continueRecording` is false, the replay will continue to record and - * behave as a "session"-based replay. - * - * Otherwise, queue up a flush. - */ - async sendBufferedReplayOrFlush({ continueRecording = true } = {}) { - if (this.recordingMode === "session") { - return this.flushImmediate(); - } - const activityTime = Date.now(); - DEBUG_BUILD$2 && logger$1.info("Converting buffer to session"); - await this.flushImmediate(); - const hasStoppedRecording = this.stopRecording(); - if (!continueRecording || !hasStoppedRecording) { - return; - } - if (this.recordingMode === "session") { - return; - } - this.recordingMode = "session"; - if (this.session) { - this._updateUserActivity(activityTime); - this._updateSessionActivity(activityTime); - this._maybeSaveSession(); - } - this.startRecording(); - } - /** - * We want to batch uploads of replay events. Save events only if - * `` milliseconds have elapsed since the last event - * *OR* if `` milliseconds have elapsed. - * - * Accepts a callback to perform side-effects and returns true to stop batch - * processing and hand back control to caller. - */ - addUpdate(cb) { - const cbResult = cb(); - if (this.recordingMode === "buffer") { - return; - } - if (cbResult === true) { - return; - } - this._debouncedFlush(); - } - /** - * Updates the user activity timestamp and resumes recording. This should be - * called in an event handler for a user action that we consider as the user - * being "active" (e.g. a mouse click). - */ - triggerUserActivity() { - this._updateUserActivity(); - if (!this._stopRecording) { - if (!this._checkSession()) { - return; - } - this.resume(); - return; - } - this.checkAndHandleExpiredSession(); - this._updateSessionActivity(); - } - /** - * Updates the user activity timestamp *without* resuming - * recording. Some user events (e.g. keydown) can be create - * low-value replays that only contain the keypress as a - * breadcrumb. Instead this would require other events to - * create a new replay after a session has expired. - */ - updateUserActivity() { - this._updateUserActivity(); - this._updateSessionActivity(); - } - /** - * Only flush if `this.recordingMode === 'session'` - */ - conditionalFlush() { - if (this.recordingMode === "buffer") { - return Promise.resolve(); - } - return this.flushImmediate(); - } - /** - * Flush using debounce flush - */ - flush() { - return this._debouncedFlush(); - } - /** - * Always flush via `_debouncedFlush` so that we do not have flushes triggered - * from calling both `flush` and `_debouncedFlush`. Otherwise, there could be - * cases of multiple flushes happening closely together. - */ - flushImmediate() { - this._debouncedFlush(); - return this._debouncedFlush.flush(); - } - /** - * Cancels queued up flushes. - */ - cancelFlush() { - this._debouncedFlush.cancel(); - } - /** Get the current session (=replay) ID */ - getSessionId() { - return this.session && this.session.id; - } - /** - * Checks if recording should be stopped due to user inactivity. Otherwise - * check if session is expired and create a new session if so. Triggers a new - * full snapshot on new session. - * - * Returns true if session is not expired, false otherwise. - * @hidden - */ - checkAndHandleExpiredSession() { - if (this._lastActivity && isExpired(this._lastActivity, this.timeouts.sessionIdlePause) && this.session && this.session.sampled === "session") { - this.pause(); - return; - } - if (!this._checkSession()) { - return false; - } - return true; - } - /** - * Capture some initial state that can change throughout the lifespan of the - * replay. This is required because otherwise they would be captured at the - * first flush. - */ - setInitialState() { - const urlPath = `${WINDOW$1.location.pathname}${WINDOW$1.location.hash}${WINDOW$1.location.search}`; - const url = `${WINDOW$1.location.origin}${urlPath}`; - this.performanceEntries = []; - this.replayPerformanceEntries = []; - this._clearContext(); - this._context.initialUrl = url; - this._context.initialTimestamp = Date.now(); - this._context.urls.push(url); - } - /** - * Add a breadcrumb event, that may be throttled. - * If it was throttled, we add a custom breadcrumb to indicate that. - */ - throttledAddEvent(event, isCheckout) { - const res = this._throttledAddEvent(event, isCheckout); - if (res === THROTTLED) { - const breadcrumb = createBreadcrumb({ - category: "replay.throttled" - }); - this.addUpdate(() => { - return !addEventSync(this, { - type: ReplayEventTypeCustom, - timestamp: breadcrumb.timestamp || 0, - data: { - tag: "breadcrumb", - payload: breadcrumb, - metric: true - } - }); - }); - } - return res; - } - /** - * This will get the parametrized route name of the current page. - * This is only available if performance is enabled, and if an instrumented router is used. - */ - getCurrentRoute() { - const lastActiveSpan = this.lastActiveSpan || getActiveSpan(); - const lastRootSpan = lastActiveSpan && getRootSpan(lastActiveSpan); - const attributes = lastRootSpan && spanToJSON(lastRootSpan).data || {}; - const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; - if (!lastRootSpan || !source || !["route", "custom"].includes(source)) { - return void 0; - } - return spanToJSON(lastRootSpan).description; - } - /** - * Initialize and start all listeners to varying events (DOM, - * Performance Observer, Recording, Sentry SDK, etc) - */ - _initializeRecording() { - this.setInitialState(); - this._updateSessionActivity(); - this.eventBuffer = createEventBuffer({ - useCompression: this._options.useCompression, - workerUrl: this._options.workerUrl - }); - this._removeListeners(); - this._addListeners(); - this._isEnabled = true; - this._isPaused = false; - this.startRecording(); - } - /** - * Loads (or refreshes) the current session. - */ - _initializeSessionForSampling(previousSessionId) { - const allowBuffering = this._options.errorSampleRate > 0; - const session = loadOrCreateSession( - { - sessionIdleExpire: this.timeouts.sessionIdleExpire, - maxReplayDuration: this._options.maxReplayDuration, - previousSessionId - }, - { - stickySession: this._options.stickySession, - sessionSampleRate: this._options.sessionSampleRate, - allowBuffering - } - ); - this.session = session; - } - /** - * Checks and potentially refreshes the current session. - * Returns false if session is not recorded. - */ - _checkSession() { - if (!this.session) { - return false; - } - const currentSession = this.session; - if (shouldRefreshSession(currentSession, { - sessionIdleExpire: this.timeouts.sessionIdleExpire, - maxReplayDuration: this._options.maxReplayDuration - })) { - this._refreshSession(currentSession); - return false; - } - return true; - } - /** - * Refresh a session with a new one. - * This stops the current session (without forcing a flush, as that would never work since we are expired), - * and then does a new sampling based on the refreshed session. - */ - async _refreshSession(session) { - if (!this._isEnabled) { - return; - } - await this.stop({ reason: "refresh session" }); - this.initializeSampling(session.id); - } - /** - * Adds listeners to record events for the replay - */ - _addListeners() { - try { - WINDOW$1.document.addEventListener("visibilitychange", this._handleVisibilityChange); - WINDOW$1.addEventListener("blur", this._handleWindowBlur); - WINDOW$1.addEventListener("focus", this._handleWindowFocus); - WINDOW$1.addEventListener("keydown", this._handleKeyboardEvent); - if (this.clickDetector) { - this.clickDetector.addListeners(); - } - if (!this._hasInitializedCoreListeners) { - addGlobalListeners(this); - this._hasInitializedCoreListeners = true; - } - } catch (err) { - this.handleException(err); - } - this._performanceCleanupCallback = setupPerformanceObserver(this); - } - /** - * Cleans up listeners that were created in `_addListeners` - */ - _removeListeners() { - try { - WINDOW$1.document.removeEventListener("visibilitychange", this._handleVisibilityChange); - WINDOW$1.removeEventListener("blur", this._handleWindowBlur); - WINDOW$1.removeEventListener("focus", this._handleWindowFocus); - WINDOW$1.removeEventListener("keydown", this._handleKeyboardEvent); - if (this.clickDetector) { - this.clickDetector.removeListeners(); - } - if (this._performanceCleanupCallback) { - this._performanceCleanupCallback(); - } - } catch (err) { - this.handleException(err); - } - } - /** - * Handle when visibility of the page content changes. Opening a new tab will - * cause the state to change to hidden because of content of current page will - * be hidden. Likewise, moving a different window to cover the contents of the - * page will also trigger a change to a hidden state. - */ - __init() { - this._handleVisibilityChange = () => { - if (WINDOW$1.document.visibilityState === "visible") { - this._doChangeToForegroundTasks(); - } else { - this._doChangeToBackgroundTasks(); - } - }; - } - /** - * Handle when page is blurred - */ - __init2() { - this._handleWindowBlur = () => { - const breadcrumb = createBreadcrumb({ - category: "ui.blur" - }); - this._doChangeToBackgroundTasks(breadcrumb); - }; - } - /** - * Handle when page is focused - */ - __init3() { - this._handleWindowFocus = () => { - const breadcrumb = createBreadcrumb({ - category: "ui.focus" - }); - this._doChangeToForegroundTasks(breadcrumb); - }; - } - /** Ensure page remains active when a key is pressed. */ - __init4() { - this._handleKeyboardEvent = (event) => { - handleKeyboardEvent(this, event); - }; - } - /** - * Tasks to run when we consider a page to be hidden (via blurring and/or visibility) - */ - _doChangeToBackgroundTasks(breadcrumb) { - if (!this.session) { - return; - } - const expired = isSessionExpired(this.session, { - maxReplayDuration: this._options.maxReplayDuration, - sessionIdleExpire: this.timeouts.sessionIdleExpire - }); - if (expired) { - return; - } - if (breadcrumb) { - this._createCustomBreadcrumb(breadcrumb); - } - void this.conditionalFlush(); - } - /** - * Tasks to run when we consider a page to be visible (via focus and/or visibility) - */ - _doChangeToForegroundTasks(breadcrumb) { - if (!this.session) { - return; - } - const isSessionActive = this.checkAndHandleExpiredSession(); - if (!isSessionActive) { - DEBUG_BUILD$2 && logger$1.info("Document has become active, but session has expired"); - return; - } - if (breadcrumb) { - this._createCustomBreadcrumb(breadcrumb); - } - } - /** - * Update user activity (across session lifespans) - */ - _updateUserActivity(_lastActivity = Date.now()) { - this._lastActivity = _lastActivity; - } - /** - * Updates the session's last activity timestamp - */ - _updateSessionActivity(_lastActivity = Date.now()) { - if (this.session) { - this.session.lastActivity = _lastActivity; - this._maybeSaveSession(); - } - } - /** - * Helper to create (and buffer) a replay breadcrumb from a core SDK breadcrumb - */ - _createCustomBreadcrumb(breadcrumb) { - this.addUpdate(() => { - this.throttledAddEvent({ - type: EventType.Custom, - timestamp: breadcrumb.timestamp || 0, - data: { - tag: "breadcrumb", - payload: breadcrumb - } - }); - }); - } - /** - * Observed performance events are added to `this.performanceEntries`. These - * are included in the replay event before it is finished and sent to Sentry. - */ - _addPerformanceEntries() { - let performanceEntries = createPerformanceEntries(this.performanceEntries).concat(this.replayPerformanceEntries); - this.performanceEntries = []; - this.replayPerformanceEntries = []; - if (this._requiresManualStart) { - const initialTimestampInSeconds = this._context.initialTimestamp / 1e3; - performanceEntries = performanceEntries.filter((entry) => entry.start >= initialTimestampInSeconds); - } - return Promise.all(createPerformanceSpans(this, performanceEntries)); - } - /** - * Clear _context - */ - _clearContext() { - this._context.errorIds.clear(); - this._context.traceIds.clear(); - this._context.urls = []; - } - /** Update the initial timestamp based on the buffer content. */ - _updateInitialTimestampFromEventBuffer() { - const { session, eventBuffer } = this; - if (!session || !eventBuffer || this._requiresManualStart) { - return; - } - if (session.segmentId) { - return; - } - const earliestEvent = eventBuffer.getEarliestTimestamp(); - if (earliestEvent && earliestEvent < this._context.initialTimestamp) { - this._context.initialTimestamp = earliestEvent; - } - } - /** - * Return and clear _context - */ - _popEventContext() { - const _context = { - initialTimestamp: this._context.initialTimestamp, - initialUrl: this._context.initialUrl, - errorIds: Array.from(this._context.errorIds), - traceIds: Array.from(this._context.traceIds), - urls: this._context.urls - }; - this._clearContext(); - return _context; - } - /** - * Flushes replay event buffer to Sentry. - * - * Performance events are only added right before flushing - this is - * due to the buffered performance observer events. - * - * Should never be called directly, only by `flush` - */ - async _runFlush() { - const replayId = this.getSessionId(); - if (!this.session || !this.eventBuffer || !replayId) { - DEBUG_BUILD$2 && logger$1.error("No session or eventBuffer found to flush."); - return; - } - await this._addPerformanceEntries(); - if (!this.eventBuffer || !this.eventBuffer.hasEvents) { - return; - } - await addMemoryEntry(this); - if (!this.eventBuffer) { - return; - } - if (replayId !== this.getSessionId()) { - return; - } - try { - this._updateInitialTimestampFromEventBuffer(); - const timestamp2 = Date.now(); - if (timestamp2 - this._context.initialTimestamp > this._options.maxReplayDuration + 3e4) { - throw new Error("Session is too long, not sending replay"); - } - const eventContext = this._popEventContext(); - const segmentId = this.session.segmentId++; - this._maybeSaveSession(); - const recordingData = await this.eventBuffer.finish(); - await sendReplay({ - replayId, - recordingData, - segmentId, - eventContext, - session: this.session, - timestamp: timestamp2, - onError: /* @__PURE__ */ __name((err) => this.handleException(err), "onError") - }); - } catch (err) { - this.handleException(err); - this.stop({ reason: "sendReplay" }); - const client = getClient(); - if (client) { - const dropReason = err instanceof RateLimitError ? "ratelimit_backoff" : "send_error"; - client.recordDroppedEvent(dropReason, "replay"); - } - } - } - /** - * Flush recording data to Sentry. Creates a lock so that only a single flush - * can be active at a time. Do not call this directly. - */ - __init5() { - this._flush = async ({ - force = false - } = {}) => { - if (!this._isEnabled && !force) { - return; - } - if (!this.checkAndHandleExpiredSession()) { - DEBUG_BUILD$2 && logger$1.error("Attempting to finish replay event after session expired."); - return; - } - if (!this.session) { - return; - } - const start2 = this.session.started; - const now2 = Date.now(); - const duration = now2 - start2; - this._debouncedFlush.cancel(); - const tooShort = duration < this._options.minReplayDuration; - const tooLong = duration > this._options.maxReplayDuration + 5e3; - if (tooShort || tooLong) { - DEBUG_BUILD$2 && logger$1.info( - `Session duration (${Math.floor(duration / 1e3)}s) is too ${tooShort ? "short" : "long"}, not sending replay.` - ); - if (tooShort) { - this._debouncedFlush(); - } - return; - } - const eventBuffer = this.eventBuffer; - if (eventBuffer && this.session.segmentId === 0 && !eventBuffer.hasCheckout) { - DEBUG_BUILD$2 && logger$1.info("Flushing initial segment without checkout."); - } - const _flushInProgress = !!this._flushLock; - if (!this._flushLock) { - this._flushLock = this._runFlush(); - } - try { - await this._flushLock; - } catch (err) { - this.handleException(err); - } finally { - this._flushLock = void 0; - if (_flushInProgress) { - this._debouncedFlush(); - } - } - }; - } - /** Save the session, if it is sticky */ - _maybeSaveSession() { - if (this.session && this._options.stickySession) { - saveSession(this.session); - } - } - /** Handler for rrweb.record.onMutation */ - __init6() { - this._onMutationHandler = (mutations) => { - const count = mutations.length; - const mutationLimit = this._options.mutationLimit; - const mutationBreadcrumbLimit = this._options.mutationBreadcrumbLimit; - const overMutationLimit = mutationLimit && count > mutationLimit; - if (count > mutationBreadcrumbLimit || overMutationLimit) { - const breadcrumb = createBreadcrumb({ - category: "replay.mutations", - data: { - count, - limit: overMutationLimit - } - }); - this._createCustomBreadcrumb(breadcrumb); - } - if (overMutationLimit) { - this.stop({ reason: "mutationLimit", forceFlush: this.recordingMode === "session" }); - return false; - } - return true; - }; - } -} -function getOption(selectors, defaultSelectors) { - return [ - ...selectors, - // sentry defaults - ...defaultSelectors - ].join(","); -} -__name(getOption, "getOption"); -function getPrivacyOptions({ mask: mask3, unmask, block: block3, unblock: unblock2, ignore }) { - const defaultBlockedElements = ["base", "iframe[srcdoc]:not([src])"]; - const maskSelector = getOption(mask3, [".sentry-mask", "[data-sentry-mask]"]); - const unmaskSelector = getOption(unmask, []); - const options4 = { - // We are making the decision to make text and input selectors the same - maskTextSelector: maskSelector, - unmaskTextSelector: unmaskSelector, - blockSelector: getOption(block3, [".sentry-block", "[data-sentry-block]", ...defaultBlockedElements]), - unblockSelector: getOption(unblock2, []), - ignoreSelector: getOption(ignore, [".sentry-ignore", "[data-sentry-ignore]", 'input[type="file"]']) - }; - return options4; -} -__name(getPrivacyOptions, "getPrivacyOptions"); -function maskAttribute({ - el, - key, - maskAttributes, - maskAllText, - privacyOptions, - value: value4 -}) { - if (!maskAllText) { - return value4; - } - if (privacyOptions.unmaskTextSelector && el.matches(privacyOptions.unmaskTextSelector)) { - return value4; - } - if (maskAttributes.includes(key) || // Need to mask `value` attribute for `` if it's a button-like - // type - key === "value" && el.tagName === "INPUT" && ["submit", "button"].includes(el.getAttribute("type") || "")) { - return value4.replace(/[\S]/g, "*"); - } - return value4; -} -__name(maskAttribute, "maskAttribute"); -const MEDIA_SELECTORS = 'img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]'; -const DEFAULT_NETWORK_HEADERS = ["content-length", "content-type", "accept"]; -let _initialized = false; -const replayIntegration = /* @__PURE__ */ __name((options4) => { - return new Replay(options4); -}, "replayIntegration"); -class Replay { - static { - __name(this, "Replay"); - } - /** - * @inheritDoc - */ - static __initStatic() { - this.id = "Replay"; - } - /** - * @inheritDoc - */ - /** - * Options to pass to `rrweb.record()` - */ - /** - * Initial options passed to the replay integration, merged with default values. - * Note: `sessionSampleRate` and `errorSampleRate` are not required here, as they - * can only be finally set when setupOnce() is called. - * - * @private - */ - constructor({ - flushMinDelay = DEFAULT_FLUSH_MIN_DELAY, - flushMaxDelay = DEFAULT_FLUSH_MAX_DELAY, - minReplayDuration = MIN_REPLAY_DURATION, - maxReplayDuration = MAX_REPLAY_DURATION, - stickySession = true, - useCompression = true, - workerUrl, - _experiments = {}, - maskAllText = true, - maskAllInputs = true, - blockAllMedia = true, - mutationBreadcrumbLimit = 750, - mutationLimit = 1e4, - slowClickTimeout = 7e3, - slowClickIgnoreSelectors = [], - networkDetailAllowUrls = [], - networkDetailDenyUrls = [], - networkCaptureBodies = true, - networkRequestHeaders = [], - networkResponseHeaders = [], - mask: mask3 = [], - maskAttributes = ["title", "placeholder"], - unmask = [], - block: block3 = [], - unblock: unblock2 = [], - ignore = [], - maskFn, - beforeAddRecordingEvent, - beforeErrorSampling, - onError - } = {}) { - this.name = Replay.id; - const privacyOptions = getPrivacyOptions({ - mask: mask3, - unmask, - block: block3, - unblock: unblock2, - ignore - }); - this._recordingOptions = { - maskAllInputs, - maskAllText, - maskInputOptions: { password: true }, - maskTextFn: maskFn, - maskInputFn: maskFn, - maskAttributeFn: /* @__PURE__ */ __name((key, value4, el) => maskAttribute({ - maskAttributes, - maskAllText, - privacyOptions, - key, - value: value4, - el - }), "maskAttributeFn"), - ...privacyOptions, - // Our defaults - slimDOMOptions: "all", - inlineStylesheet: true, - // Disable inline images as it will increase segment/replay size - inlineImages: false, - // collect fonts, but be aware that `sentry.io` needs to be an allowed - // origin for playback - collectFonts: true, - errorHandler: /* @__PURE__ */ __name((err) => { - try { - err.__rrweb__ = true; - } catch (error2) { - } - }, "errorHandler") - }; - this._initialOptions = { - flushMinDelay, - flushMaxDelay, - minReplayDuration: Math.min(minReplayDuration, MIN_REPLAY_DURATION_LIMIT), - maxReplayDuration: Math.min(maxReplayDuration, MAX_REPLAY_DURATION), - stickySession, - useCompression, - workerUrl, - blockAllMedia, - maskAllInputs, - maskAllText, - mutationBreadcrumbLimit, - mutationLimit, - slowClickTimeout, - slowClickIgnoreSelectors, - networkDetailAllowUrls, - networkDetailDenyUrls, - networkCaptureBodies, - networkRequestHeaders: _getMergedNetworkHeaders(networkRequestHeaders), - networkResponseHeaders: _getMergedNetworkHeaders(networkResponseHeaders), - beforeAddRecordingEvent, - beforeErrorSampling, - onError, - _experiments - }; - if (this._initialOptions.blockAllMedia) { - this._recordingOptions.blockSelector = !this._recordingOptions.blockSelector ? MEDIA_SELECTORS : `${this._recordingOptions.blockSelector},${MEDIA_SELECTORS}`; - } - if (this._isInitialized && isBrowser$1()) { - throw new Error("Multiple Sentry Session Replay instances are not supported"); - } - this._isInitialized = true; - } - /** If replay has already been initialized */ - get _isInitialized() { - return _initialized; - } - /** Update _isInitialized */ - set _isInitialized(value4) { - _initialized = value4; - } - /** - * Setup and initialize replay container - */ - afterAllSetup(client) { - if (!isBrowser$1() || this._replay) { - return; - } - this._setup(client); - this._initialize(client); - } - /** - * Start a replay regardless of sampling rate. Calling this will always - * create a new session. Will log a message if replay is already in progress. - * - * Creates or loads a session, attaches listeners to varying events (DOM, - * PerformanceObserver, Recording, Sentry SDK, etc) - */ - start() { - if (!this._replay) { - return; - } - this._replay.start(); - } - /** - * Start replay buffering. Buffers until `flush()` is called or, if - * `replaysOnErrorSampleRate` > 0, until an error occurs. - */ - startBuffering() { - if (!this._replay) { - return; - } - this._replay.startBuffering(); - } - /** - * Currently, this needs to be manually called (e.g. for tests). Sentry SDK - * does not support a teardown - */ - stop() { - if (!this._replay) { - return Promise.resolve(); - } - return this._replay.stop({ forceFlush: this._replay.recordingMode === "session" }); - } - /** - * If not in "session" recording mode, flush event buffer which will create a new replay. - * If replay is not enabled, a new session replay is started. - * Unless `continueRecording` is false, the replay will continue to record and - * behave as a "session"-based replay. - * - * Otherwise, queue up a flush. - */ - flush(options4) { - if (!this._replay) { - return Promise.resolve(); - } - if (!this._replay.isEnabled()) { - this._replay.start(); - return Promise.resolve(); - } - return this._replay.sendBufferedReplayOrFlush(options4); - } - /** - * Get the current session ID. - */ - getReplayId() { - if (!this._replay || !this._replay.isEnabled()) { - return; - } - return this._replay.getSessionId(); - } - /** - * Get the current recording mode. This can be either `session` or `buffer`. - * - * `session`: Recording the whole session, sending it continuously - * `buffer`: Always keeping the last 60s of recording, requires: - * - having replaysOnErrorSampleRate > 0 to capture replay when an error occurs - * - or calling `flush()` to send the replay - */ - getRecordingMode() { - if (!this._replay || !this._replay.isEnabled()) { - return; - } - return this._replay.recordingMode; - } - /** - * Initializes replay. - */ - _initialize(client) { - if (!this._replay) { - return; - } - this._maybeLoadFromReplayCanvasIntegration(client); - this._replay.initializeSampling(); - } - /** Setup the integration. */ - _setup(client) { - const finalOptions = loadReplayOptionsFromClient(this._initialOptions, client); - this._replay = new ReplayContainer({ - options: finalOptions, - recordingOptions: this._recordingOptions - }); - } - /** Get canvas options from ReplayCanvas integration, if it is also added. */ - _maybeLoadFromReplayCanvasIntegration(client) { - try { - const canvasIntegration = client.getIntegrationByName("ReplayCanvas"); - if (!canvasIntegration) { - return; - } - this._replay["_canvas"] = canvasIntegration.getOptions(); - } catch (e2) { - } - } -} -Replay.__initStatic(); -function loadReplayOptionsFromClient(initialOptions, client) { - const opt = client.getOptions(); - const finalOptions = { - sessionSampleRate: 0, - errorSampleRate: 0, - ...dropUndefinedKeys(initialOptions) - }; - const replaysSessionSampleRate = parseSampleRate(opt.replaysSessionSampleRate); - const replaysOnErrorSampleRate = parseSampleRate(opt.replaysOnErrorSampleRate); - if (replaysSessionSampleRate == null && replaysOnErrorSampleRate == null) { - consoleSandbox(() => { - console.warn( - "Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set." - ); - }); - } - if (replaysSessionSampleRate != null) { - finalOptions.sessionSampleRate = replaysSessionSampleRate; - } - if (replaysOnErrorSampleRate != null) { - finalOptions.errorSampleRate = replaysOnErrorSampleRate; - } - return finalOptions; -} -__name(loadReplayOptionsFromClient, "loadReplayOptionsFromClient"); -function _getMergedNetworkHeaders(headers) { - return [...DEFAULT_NETWORK_HEADERS, ...headers.map((header3) => header3.toLowerCase())]; -} -__name(_getMergedNetworkHeaders, "_getMergedNetworkHeaders"); -function getReplay() { - const client = getClient(); - return client && client.getIntegrationByName("Replay"); -} -__name(getReplay, "getReplay"); -var NodeType$2; -(function(NodeType3) { - NodeType3[NodeType3["Document"] = 0] = "Document"; - NodeType3[NodeType3["DocumentType"] = 1] = "DocumentType"; - NodeType3[NodeType3["Element"] = 2] = "Element"; - NodeType3[NodeType3["Text"] = 3] = "Text"; - NodeType3[NodeType3["CDATA"] = 4] = "CDATA"; - NodeType3[NodeType3["Comment"] = 5] = "Comment"; -})(NodeType$2 || (NodeType$2 = {})); -function elementClassMatchesRegex(el, regex2) { - for (let eIndex = el.classList.length; eIndex--; ) { - const className = el.classList[eIndex]; - if (regex2.test(className)) { - return true; - } - } - return false; -} -__name(elementClassMatchesRegex, "elementClassMatchesRegex"); -function distanceToMatch(node3, matchPredicate, limit = Infinity, distance2 = 0) { - if (!node3) - return -1; - if (node3.nodeType !== node3.ELEMENT_NODE) - return -1; - if (distance2 > limit) - return -1; - if (matchPredicate(node3)) - return distance2; - return distanceToMatch(node3.parentNode, matchPredicate, limit, distance2 + 1); -} -__name(distanceToMatch, "distanceToMatch"); -function createMatchPredicate(className, selector) { - return (node3) => { - const el = node3; - if (el === null) - return false; - try { - if (className) { - if (typeof className === "string") { - if (el.matches(`.${className}`)) - return true; - } else if (elementClassMatchesRegex(el, className)) { - return true; - } - } - if (selector && el.matches(selector)) - return true; - return false; - } catch (e2) { - return false; - } - }; -} -__name(createMatchPredicate, "createMatchPredicate"); -const DEPARTED_MIRROR_ACCESS_WARNING = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording."; -let _mirror = { - map: {}, - getId() { - console.error(DEPARTED_MIRROR_ACCESS_WARNING); - return -1; - }, - getNode() { - console.error(DEPARTED_MIRROR_ACCESS_WARNING); - return null; - }, - removeNodeFromMap() { - console.error(DEPARTED_MIRROR_ACCESS_WARNING); - }, - has() { - console.error(DEPARTED_MIRROR_ACCESS_WARNING); - return false; - }, - reset() { - console.error(DEPARTED_MIRROR_ACCESS_WARNING); - } -}; -if (typeof window !== "undefined" && window.Proxy && window.Reflect) { - _mirror = new Proxy(_mirror, { - get(target2, prop2, receiver) { - if (prop2 === "map") { - console.error(DEPARTED_MIRROR_ACCESS_WARNING); - } - return Reflect.get(target2, prop2, receiver); - } - }); -} -function hookSetter(target2, key, d2, isRevoked, win = window) { - const original = win.Object.getOwnPropertyDescriptor(target2, key); - win.Object.defineProperty(target2, key, isRevoked ? d2 : { - set(value4) { - setTimeout$1(() => { - d2.set.call(this, value4); - }, 0); - if (original && original.set) { - original.set.call(this, value4); - } - } - }); - return () => hookSetter(target2, key, original || {}, true); -} -__name(hookSetter, "hookSetter"); -function patch$1(source, name2, replacement) { - try { - if (!(name2 in source)) { - return () => { - }; - } - const original = source[name2]; - const wrapped = replacement(original); - if (typeof wrapped === "function") { - wrapped.prototype = wrapped.prototype || {}; - Object.defineProperties(wrapped, { - __rrweb_original__: { - enumerable: false, - value: original - } - }); - } - source[name2] = wrapped; - return () => { - source[name2] = original; - }; - } catch (e2) { - return () => { - }; - } -} -__name(patch$1, "patch$1"); -if (!/[1-9][0-9]{12}/.test(Date.now().toString())) ; -function closestElementOfNode(node3) { - if (!node3) { - return null; - } - const el = node3.nodeType === node3.ELEMENT_NODE ? node3 : node3.parentElement; - return el; -} -__name(closestElementOfNode, "closestElementOfNode"); -function isBlocked(node3, blockClass, blockSelector, unblockSelector, checkAncestors) { - if (!node3) { - return false; - } - const el = closestElementOfNode(node3); - if (!el) { - return false; - } - const blockedPredicate = createMatchPredicate(blockClass, blockSelector); - const blockDistance = distanceToMatch(el, blockedPredicate); - let unblockDistance = -1; - if (blockDistance < 0) { - return false; - } - if (unblockSelector) { - unblockDistance = distanceToMatch(el, createMatchPredicate(null, unblockSelector)); - } - if (blockDistance > -1 && unblockDistance < 0) { - return true; - } - return blockDistance < unblockDistance; -} -__name(isBlocked, "isBlocked"); -const cachedImplementations = {}; -function getImplementation(name2) { - const cached = cachedImplementations[name2]; - if (cached) { - return cached; - } - const document2 = window.document; - let impl = window[name2]; - if (document2 && typeof document2.createElement === "function") { - try { - const sandbox = document2.createElement("iframe"); - sandbox.hidden = true; - document2.head.appendChild(sandbox); - const contentWindow = sandbox.contentWindow; - if (contentWindow && contentWindow[name2]) { - impl = contentWindow[name2]; - } - document2.head.removeChild(sandbox); - } catch (e2) { - } - } - return cachedImplementations[name2] = impl.bind(window); -} -__name(getImplementation, "getImplementation"); -function onRequestAnimationFrame(...rest) { - return getImplementation("requestAnimationFrame")(...rest); -} -__name(onRequestAnimationFrame, "onRequestAnimationFrame"); -function setTimeout$1(...rest) { - return getImplementation("setTimeout")(...rest); -} -__name(setTimeout$1, "setTimeout$1"); -var CanvasContext = /* @__PURE__ */ ((CanvasContext2) => { - CanvasContext2[CanvasContext2["2D"] = 0] = "2D"; - CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL"; - CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2"; - return CanvasContext2; -})(CanvasContext || {}); -let errorHandler; -function registerErrorHandler(handler12) { - errorHandler = handler12; -} -__name(registerErrorHandler, "registerErrorHandler"); -const callbackWrapper = /* @__PURE__ */ __name((cb) => { - if (!errorHandler) { - return cb; - } - const rrwebWrapped = /* @__PURE__ */ __name((...rest) => { - try { - return cb(...rest); - } catch (error2) { - if (errorHandler && errorHandler(error2) === true) { - return () => { - }; - } - throw error2; - } - }, "rrwebWrapped"); - return rrwebWrapped; -}, "callbackWrapper"); -var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256); -for (var i$3 = 0; i$3 < chars.length; i$3++) { - lookup[chars.charCodeAt(i$3)] = i$3; -} -var encode$5 = /* @__PURE__ */ __name(function(arraybuffer) { - var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = ""; - for (i2 = 0; i2 < len; i2 += 3) { - base64 += chars[bytes[i2] >> 2]; - base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4]; - base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6]; - base64 += chars[bytes[i2 + 2] & 63]; - } - if (len % 3 === 2) { - base64 = base64.substring(0, base64.length - 1) + "="; - } else if (len % 3 === 1) { - base64 = base64.substring(0, base64.length - 2) + "=="; - } - return base64; -}, "encode$5"); -const canvasVarMap = /* @__PURE__ */ new Map(); -function variableListFor(ctx, ctor) { - let contextMap = canvasVarMap.get(ctx); - if (!contextMap) { - contextMap = /* @__PURE__ */ new Map(); - canvasVarMap.set(ctx, contextMap); - } - if (!contextMap.has(ctor)) { - contextMap.set(ctor, []); - } - return contextMap.get(ctor); -} -__name(variableListFor, "variableListFor"); -const saveWebGLVar = /* @__PURE__ */ __name((value4, win, ctx) => { - if (!value4 || !(isInstanceOfWebGLObject(value4, win) || typeof value4 === "object")) - return; - const name2 = value4.constructor.name; - const list2 = variableListFor(ctx, name2); - let index2 = list2.indexOf(value4); - if (index2 === -1) { - index2 = list2.length; - list2.push(value4); - } - return index2; -}, "saveWebGLVar"); -function serializeArg(value4, win, ctx) { - if (value4 instanceof Array) { - return value4.map((arg) => serializeArg(arg, win, ctx)); - } else if (value4 === null) { - return value4; - } else if (value4 instanceof Float32Array || value4 instanceof Float64Array || value4 instanceof Int32Array || value4 instanceof Uint32Array || value4 instanceof Uint8Array || value4 instanceof Uint16Array || value4 instanceof Int16Array || value4 instanceof Int8Array || value4 instanceof Uint8ClampedArray) { - const name2 = value4.constructor.name; - return { - rr_type: name2, - args: [Object.values(value4)] - }; - } else if (value4 instanceof ArrayBuffer) { - const name2 = value4.constructor.name; - const base64 = encode$5(value4); - return { - rr_type: name2, - base64 - }; - } else if (value4 instanceof DataView) { - const name2 = value4.constructor.name; - return { - rr_type: name2, - args: [ - serializeArg(value4.buffer, win, ctx), - value4.byteOffset, - value4.byteLength - ] - }; - } else if (value4 instanceof HTMLImageElement) { - const name2 = value4.constructor.name; - const { src } = value4; - return { - rr_type: name2, - src - }; - } else if (value4 instanceof HTMLCanvasElement) { - const name2 = "HTMLImageElement"; - const src = value4.toDataURL(); - return { - rr_type: name2, - src - }; - } else if (value4 instanceof ImageData) { - const name2 = value4.constructor.name; - return { - rr_type: name2, - args: [serializeArg(value4.data, win, ctx), value4.width, value4.height] - }; - } else if (isInstanceOfWebGLObject(value4, win) || typeof value4 === "object") { - const name2 = value4.constructor.name; - const index2 = saveWebGLVar(value4, win, ctx); - return { - rr_type: name2, - index: index2 - }; - } - return value4; -} -__name(serializeArg, "serializeArg"); -const serializeArgs = /* @__PURE__ */ __name((args, win, ctx) => { - return args.map((arg) => serializeArg(arg, win, ctx)); -}, "serializeArgs"); -const isInstanceOfWebGLObject = /* @__PURE__ */ __name((value4, win) => { - const webGLConstructorNames = [ - "WebGLActiveInfo", - "WebGLBuffer", - "WebGLFramebuffer", - "WebGLProgram", - "WebGLRenderbuffer", - "WebGLShader", - "WebGLShaderPrecisionFormat", - "WebGLTexture", - "WebGLUniformLocation", - "WebGLVertexArrayObject", - "WebGLVertexArrayObjectOES" - ]; - const supportedWebGLConstructorNames = webGLConstructorNames.filter((name2) => typeof win[name2] === "function"); - return Boolean(supportedWebGLConstructorNames.find((name2) => value4 instanceof win[name2])); -}, "isInstanceOfWebGLObject"); -function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector, unblockSelector) { - const handlers2 = []; - const props2D = Object.getOwnPropertyNames(win.CanvasRenderingContext2D.prototype); - for (const prop2 of props2D) { - try { - if (typeof win.CanvasRenderingContext2D.prototype[prop2] !== "function") { - continue; - } - const restoreHandler = patch$1(win.CanvasRenderingContext2D.prototype, prop2, function(original) { - return function(...args) { - if (!isBlocked(this.canvas, blockClass, blockSelector, unblockSelector, true)) { - setTimeout$1(() => { - const recordArgs = serializeArgs(args, win, this); - cb(this.canvas, { - type: CanvasContext["2D"], - property: prop2, - args: recordArgs - }); - }, 0); - } - return original.apply(this, args); - }; - }); - handlers2.push(restoreHandler); - } catch (e2) { - const hookHandler = hookSetter(win.CanvasRenderingContext2D.prototype, prop2, { - set(v2) { - cb(this.canvas, { - type: CanvasContext["2D"], - property: prop2, - args: [v2], - setter: true - }); - } - }); - handlers2.push(hookHandler); - } - } - return () => { - handlers2.forEach((h2) => h2()); - }; -} -__name(initCanvas2DMutationObserver, "initCanvas2DMutationObserver"); -function getNormalizedContextName(contextType) { - return contextType === "experimental-webgl" ? "webgl" : contextType; -} -__name(getNormalizedContextName, "getNormalizedContextName"); -function initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, setPreserveDrawingBufferToTrue) { - const handlers2 = []; - try { - const restoreHandler = patch$1(win.HTMLCanvasElement.prototype, "getContext", function(original) { - return function(contextType, ...args) { - if (!isBlocked(this, blockClass, blockSelector, unblockSelector, true)) { - const ctxName = getNormalizedContextName(contextType); - if (!("__context" in this)) - this.__context = ctxName; - if (setPreserveDrawingBufferToTrue && ["webgl", "webgl2"].includes(ctxName)) { - if (args[0] && typeof args[0] === "object") { - const contextAttributes = args[0]; - if (!contextAttributes.preserveDrawingBuffer) { - contextAttributes.preserveDrawingBuffer = true; - } - } else { - args.splice(0, 1, { - preserveDrawingBuffer: true - }); - } - } - } - return original.apply(this, [contextType, ...args]); - }; - }); - handlers2.push(restoreHandler); - } catch (e2) { - console.error("failed to patch HTMLCanvasElement.prototype.getContext"); - } - return () => { - handlers2.forEach((h2) => h2()); - }; -} -__name(initCanvasContextObserver, "initCanvasContextObserver"); -function patchGLPrototype(prototype2, type, cb, blockClass, blockSelector, unblockSelector, mirror2, win) { - const handlers2 = []; - const props = Object.getOwnPropertyNames(prototype2); - for (const prop2 of props) { - if ([ - "isContextLost", - "canvas", - "drawingBufferWidth", - "drawingBufferHeight" - ].includes(prop2)) { - continue; - } - try { - if (typeof prototype2[prop2] !== "function") { - continue; - } - const restoreHandler = patch$1(prototype2, prop2, function(original) { - return function(...args) { - const result = original.apply(this, args); - saveWebGLVar(result, win, this); - if ("tagName" in this.canvas && !isBlocked(this.canvas, blockClass, blockSelector, unblockSelector, true)) { - const recordArgs = serializeArgs(args, win, this); - const mutation = { - type, - property: prop2, - args: recordArgs - }; - cb(this.canvas, mutation); - } - return result; - }; - }); - handlers2.push(restoreHandler); - } catch (e2) { - const hookHandler = hookSetter(prototype2, prop2, { - set(v2) { - cb(this.canvas, { - type, - property: prop2, - args: [v2], - setter: true - }); - } - }); - handlers2.push(hookHandler); - } - } - return handlers2; -} -__name(patchGLPrototype, "patchGLPrototype"); -function initCanvasWebGLMutationObserver(cb, win, blockClass, blockSelector, unblockSelector, mirror2) { - const handlers2 = []; - handlers2.push(...patchGLPrototype(win.WebGLRenderingContext.prototype, CanvasContext.WebGL, cb, blockClass, blockSelector, unblockSelector, mirror2, win)); - if (typeof win.WebGL2RenderingContext !== "undefined") { - handlers2.push(...patchGLPrototype(win.WebGL2RenderingContext.prototype, CanvasContext.WebGL2, cb, blockClass, blockSelector, unblockSelector, mirror2, win)); - } - return () => { - handlers2.forEach((h2) => h2()); - }; -} -__name(initCanvasWebGLMutationObserver, "initCanvasWebGLMutationObserver"); -var r$2 = `for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<64;a++)t[e.charCodeAt(a)]=a;var n=function(t){var a,n=new Uint8Array(t),r=n.length,s="";for(a=0;a>2],s+=e[(3&n[a])<<4|n[a+1]>>4],s+=e[(15&n[a+1])<<2|n[a+2]>>6],s+=e[63&n[a+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const r=new Map,s=new Map;const i=self;i.onmessage=async function(e){if(!("OffscreenCanvas"in globalThis))return i.postMessage({id:e.data.id});{const{id:t,bitmap:a,width:o,height:f,maxCanvasSize:c,dataURLOptions:g}=e.data,u=async function(e,t,a){const r=e+"-"+t;if("OffscreenCanvas"in globalThis){if(s.has(r))return s.get(r);const i=new OffscreenCanvas(e,t);i.getContext("2d");const o=await i.convertToBlob(a),f=await o.arrayBuffer(),c=n(f);return s.set(r,c),c}return""}(o,f,g),[h,d]=function(e,t,a){if(!a)return[e,t];const[n,r]=a;if(e<=n&&t<=r)return[e,t];let s=e,i=t;return s>n&&(i=Math.floor(n*t/e),s=n),i>r&&(s=Math.floor(r*e/t),i=r),[s,i]}(o,f,c),l=new OffscreenCanvas(h,d),w=l.getContext("bitmaprenderer"),p=h===o&&d===f?a:await createImageBitmap(a,{resizeWidth:h,resizeHeight:d,resizeQuality:"low"});w.transferFromImageBitmap(p),a.close();const y=await l.convertToBlob(g),v=y.type,b=await y.arrayBuffer(),m=n(b);if(p.close(),!r.has(t)&&await u===m)return r.set(t,m),i.postMessage({id:t});if(r.get(t)===m)return i.postMessage({id:t});i.postMessage({id:t,type:v,base64:m,width:o,height:f}),r.set(t,m)}};`; -function t$2() { - const t2 = new Blob([r$2]); - return URL.createObjectURL(t2); -} -__name(t$2, "t$2"); -class CanvasManager { - static { - __name(this, "CanvasManager"); - } - reset() { - this.pendingCanvasMutations.clear(); - this.restoreHandlers.forEach((handler12) => { - try { - handler12(); - } catch (e2) { - } - }); - this.restoreHandlers = []; - this.windowsSet = /* @__PURE__ */ new WeakSet(); - this.windows = []; - this.shadowDoms = /* @__PURE__ */ new Set(); - _optionalChain([this, "access", (_2) => _2.worker, "optionalAccess", (_2) => _2.terminate, "call", (_3) => _3()]); - this.worker = null; - this.snapshotInProgressMap = /* @__PURE__ */ new Map(); - } - freeze() { - this.frozen = true; - } - unfreeze() { - this.frozen = false; - } - lock() { - this.locked = true; - } - unlock() { - this.locked = false; - } - constructor(options4) { - this.pendingCanvasMutations = /* @__PURE__ */ new Map(); - this.rafStamps = { latestId: 0, invokeId: null }; - this.shadowDoms = /* @__PURE__ */ new Set(); - this.windowsSet = /* @__PURE__ */ new WeakSet(); - this.windows = []; - this.restoreHandlers = []; - this.frozen = false; - this.locked = false; - this.snapshotInProgressMap = /* @__PURE__ */ new Map(); - this.worker = null; - this.processMutation = (target2, mutation) => { - const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId; - if (newFrame || !this.rafStamps.invokeId) - this.rafStamps.invokeId = this.rafStamps.latestId; - if (!this.pendingCanvasMutations.has(target2)) { - this.pendingCanvasMutations.set(target2, []); - } - this.pendingCanvasMutations.get(target2).push(mutation); - }; - const { sampling = "all", win, blockClass, blockSelector, unblockSelector, maxCanvasSize, recordCanvas, dataURLOptions, errorHandler: errorHandler2 } = options4; - this.mutationCb = options4.mutationCb; - this.mirror = options4.mirror; - this.options = options4; - if (errorHandler2) { - registerErrorHandler(errorHandler2); - } - if (recordCanvas && typeof sampling === "number" || options4.enableManualSnapshot) { - this.worker = this.initFPSWorker(); - } - this.addWindow(win); - if (options4.enableManualSnapshot) { - return; - } - callbackWrapper(() => { - if (recordCanvas && sampling === "all") { - this.startRAFTimestamping(); - this.startPendingCanvasMutationFlusher(); - } - if (recordCanvas && typeof sampling === "number") { - this.initCanvasFPSObserver(sampling, blockClass, blockSelector, unblockSelector, maxCanvasSize, { - dataURLOptions - }); - } - })(); - } - addWindow(win) { - const { sampling = "all", blockClass, blockSelector, unblockSelector, recordCanvas, enableManualSnapshot } = this.options; - if (this.windowsSet.has(win)) - return; - if (enableManualSnapshot) { - this.windowsSet.add(win); - this.windows.push(new WeakRef(win)); - return; - } - callbackWrapper(() => { - if (recordCanvas && sampling === "all") { - this.initCanvasMutationObserver(win, blockClass, blockSelector, unblockSelector); - } - if (recordCanvas && typeof sampling === "number") { - const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, true); - this.restoreHandlers.push(() => { - canvasContextReset(); - }); - } - })(); - this.windowsSet.add(win); - this.windows.push(new WeakRef(win)); - } - addShadowRoot(shadowRoot) { - this.shadowDoms.add(new WeakRef(shadowRoot)); - } - resetShadowRoots() { - this.shadowDoms = /* @__PURE__ */ new Set(); - } - initFPSWorker() { - const worker = new Worker(t$2()); - worker.onmessage = (e2) => { - const data26 = e2.data; - const { id: id3 } = data26; - this.snapshotInProgressMap.set(id3, false); - if (!("base64" in data26)) - return; - const { base64, type, width: width2, height } = data26; - this.mutationCb({ - id: id3, - type: CanvasContext["2D"], - commands: [ - { - property: "clearRect", - args: [0, 0, width2, height] - }, - { - property: "drawImage", - args: [ - { - rr_type: "ImageBitmap", - args: [ - { - rr_type: "Blob", - data: [{ rr_type: "ArrayBuffer", base64 }], - type - } - ] - }, - 0, - 0, - width2, - height - ] - } - ] - }); - }; - return worker; - } - initCanvasFPSObserver(fps, blockClass, blockSelector, unblockSelector, maxCanvasSize, options4) { - const rafId = this.takeSnapshot(false, fps, blockClass, blockSelector, unblockSelector, maxCanvasSize, options4.dataURLOptions); - this.restoreHandlers.push(() => { - cancelAnimationFrame(rafId); - }); - } - initCanvasMutationObserver(win, blockClass, blockSelector, unblockSelector) { - const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, false); - const canvas2DReset = initCanvas2DMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector, unblockSelector); - const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(this.processMutation.bind(this), win, blockClass, blockSelector, unblockSelector, this.mirror); - this.restoreHandlers.push(() => { - canvasContextReset(); - canvas2DReset(); - canvasWebGL1and2Reset(); - }); - } - snapshot(canvasElement) { - const { options: options4 } = this; - const rafId = this.takeSnapshot(true, options4.sampling === "all" ? 2 : options4.sampling || 2, options4.blockClass, options4.blockSelector, options4.unblockSelector, options4.maxCanvasSize, options4.dataURLOptions, canvasElement); - this.restoreHandlers.push(() => { - cancelAnimationFrame(rafId); - }); - } - takeSnapshot(isManualSnapshot, fps, blockClass, blockSelector, unblockSelector, maxCanvasSize, dataURLOptions, canvasElement) { - const timeBetweenSnapshots = 1e3 / fps; - let lastSnapshotTime = 0; - let rafId; - const getCanvas = /* @__PURE__ */ __name((canvasElement2) => { - if (canvasElement2) { - return [canvasElement2]; - } - const matchedCanvas = []; - const searchCanvas = /* @__PURE__ */ __name((root29) => { - root29.querySelectorAll("canvas").forEach((canvas2) => { - if (!isBlocked(canvas2, blockClass, blockSelector, unblockSelector)) { - matchedCanvas.push(canvas2); - } - }); - }, "searchCanvas"); - for (const item3 of this.windows) { - const window2 = item3.deref(); - if (window2) { - searchCanvas(window2.document); - } - } - for (const item3 of this.shadowDoms) { - const shadowRoot = item3.deref(); - if (shadowRoot) { - searchCanvas(shadowRoot); - } - } - return matchedCanvas; - }, "getCanvas"); - const takeCanvasSnapshots = /* @__PURE__ */ __name((timestamp2) => { - if (!this.windows.length) { - return; - } - if (lastSnapshotTime && timestamp2 - lastSnapshotTime < timeBetweenSnapshots) { - rafId = onRequestAnimationFrame(takeCanvasSnapshots); - return; - } - lastSnapshotTime = timestamp2; - getCanvas(canvasElement).forEach((canvas2) => { - if (!this.mirror.hasNode(canvas2)) { - return; - } - const id3 = this.mirror.getId(canvas2); - if (this.snapshotInProgressMap.get(id3)) - return; - if (!canvas2.width || !canvas2.height) - return; - this.snapshotInProgressMap.set(id3, true); - if (!isManualSnapshot && ["webgl", "webgl2"].includes(canvas2.__context)) { - const context = canvas2.getContext(canvas2.__context); - if (_optionalChain([context, "optionalAccess", (_4) => _4.getContextAttributes, "call", (_5) => _5(), "optionalAccess", (_6) => _6.preserveDrawingBuffer]) === false) { - context.clear(context.COLOR_BUFFER_BIT); - } - } - createImageBitmap(canvas2).then((bitmap) => { - _optionalChain([this, "access", (_7) => _7.worker, "optionalAccess", (_8) => _8.postMessage, "call", (_9) => _9({ - id: id3, - bitmap, - width: canvas2.width, - height: canvas2.height, - dataURLOptions, - maxCanvasSize - }, [bitmap])]); - }).catch((error2) => { - callbackWrapper(() => { - throw error2; - })(); - }); - }); - if (!isManualSnapshot) { - rafId = onRequestAnimationFrame(takeCanvasSnapshots); - } - }, "takeCanvasSnapshots"); - rafId = onRequestAnimationFrame(takeCanvasSnapshots); - return rafId; - } - startPendingCanvasMutationFlusher() { - onRequestAnimationFrame(() => this.flushPendingCanvasMutations()); - } - startRAFTimestamping() { - const setLatestRAFTimestamp = /* @__PURE__ */ __name((timestamp2) => { - this.rafStamps.latestId = timestamp2; - onRequestAnimationFrame(setLatestRAFTimestamp); - }, "setLatestRAFTimestamp"); - onRequestAnimationFrame(setLatestRAFTimestamp); - } - flushPendingCanvasMutations() { - this.pendingCanvasMutations.forEach((values, canvas2) => { - const id3 = this.mirror.getId(canvas2); - this.flushPendingCanvasMutationFor(canvas2, id3); - }); - onRequestAnimationFrame(() => this.flushPendingCanvasMutations()); - } - flushPendingCanvasMutationFor(canvas2, id3) { - if (this.frozen || this.locked) { - return; - } - const valuesWithType = this.pendingCanvasMutations.get(canvas2); - if (!valuesWithType || id3 === -1) - return; - const values = valuesWithType.map((value4) => { - const { type: type2, ...rest } = value4; - return rest; - }); - const { type } = valuesWithType[0]; - this.mutationCb({ id: id3, type, commands: values }); - this.pendingCanvasMutations.delete(canvas2); - } -} -const CANVAS_QUALITY = { - low: { - sampling: { - canvas: 1 - }, - dataURLOptions: { - type: "image/webp", - quality: 0.25 - } - }, - medium: { - sampling: { - canvas: 2 - }, - dataURLOptions: { - type: "image/webp", - quality: 0.4 - } - }, - high: { - sampling: { - canvas: 4 - }, - dataURLOptions: { - type: "image/webp", - quality: 0.5 - } - } -}; -const INTEGRATION_NAME$3 = "ReplayCanvas"; -const DEFAULT_MAX_CANVAS_SIZE = 1280; -const _replayCanvasIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const [maxCanvasWidth, maxCanvasHeight] = options4.maxCanvasSize || []; - const _canvasOptions = { - quality: options4.quality || "medium", - enableManualSnapshot: options4.enableManualSnapshot, - maxCanvasSize: [ - maxCanvasWidth ? Math.min(maxCanvasWidth, DEFAULT_MAX_CANVAS_SIZE) : DEFAULT_MAX_CANVAS_SIZE, - maxCanvasHeight ? Math.min(maxCanvasHeight, DEFAULT_MAX_CANVAS_SIZE) : DEFAULT_MAX_CANVAS_SIZE - ] - }; - let canvasManagerResolve; - const _canvasManager = new Promise((resolve2) => canvasManagerResolve = resolve2); - return { - name: INTEGRATION_NAME$3, - getOptions() { - const { quality, enableManualSnapshot, maxCanvasSize } = _canvasOptions; - return { - enableManualSnapshot, - recordCanvas: true, - getCanvasManager: /* @__PURE__ */ __name((getCanvasManagerOptions) => { - const manager = new CanvasManager({ - ...getCanvasManagerOptions, - enableManualSnapshot, - maxCanvasSize, - errorHandler: /* @__PURE__ */ __name((err) => { - try { - if (typeof err === "object") { - err.__rrweb__ = true; - } - } catch (error2) { - } - }, "errorHandler") - }); - canvasManagerResolve(manager); - return manager; - }, "getCanvasManager"), - ...CANVAS_QUALITY[quality || "medium"] || CANVAS_QUALITY.medium - }; - }, - async snapshot(canvasElement) { - const canvasManager = await _canvasManager; - canvasManager.snapshot(canvasElement); - } - }; -}, "_replayCanvasIntegration"); -const replayCanvasIntegration = defineIntegration( - _replayCanvasIntegration -); -const WINDOW = GLOBAL_OBJ; -const DOCUMENT = WINDOW.document; -const NAVIGATOR = WINDOW.navigator; -const TRIGGER_LABEL = "Report a Bug"; -const CANCEL_BUTTON_LABEL = "Cancel"; -const SUBMIT_BUTTON_LABEL = "Send Bug Report"; -const CONFIRM_BUTTON_LABEL = "Confirm"; -const FORM_TITLE = "Report a Bug"; -const EMAIL_PLACEHOLDER = "your.email@example.org"; -const EMAIL_LABEL = "Email"; -const MESSAGE_PLACEHOLDER = "What's the bug? What did you expect?"; -const MESSAGE_LABEL = "Description"; -const NAME_PLACEHOLDER = "Your Name"; -const NAME_LABEL = "Name"; -const SUCCESS_MESSAGE_TEXT = "Thank you for your report!"; -const IS_REQUIRED_LABEL = "(required)"; -const ADD_SCREENSHOT_LABEL = "Add a screenshot"; -const REMOVE_SCREENSHOT_LABEL = "Remove screenshot"; -const FEEDBACK_WIDGET_SOURCE = "widget"; -const FEEDBACK_API_SOURCE = "api"; -const SUCCESS_MESSAGE_TIMEOUT = 5e3; -const sendFeedback = /* @__PURE__ */ __name((params, hint = { includeReplay: true }) => { - if (!params.message) { - throw new Error("Unable to submit feedback with empty message"); - } - const client = getClient(); - if (!client) { - throw new Error("No client setup, cannot send feedback."); - } - if (params.tags && Object.keys(params.tags).length) { - getCurrentScope$1().setTags(params.tags); - } - const eventId = captureFeedback( - { - source: FEEDBACK_API_SOURCE, - url: getLocationHref(), - ...params - }, - hint - ); - return new Promise((resolve2, reject3) => { - const timeout = setTimeout(() => reject3("Unable to determine if Feedback was correctly sent."), 5e3); - const cleanup = client.on("afterSendEvent", (event, response) => { - if (event.event_id !== eventId) { - return; - } - clearTimeout(timeout); - cleanup(); - if (response && typeof response.statusCode === "number" && response.statusCode >= 200 && response.statusCode < 300) { - return resolve2(eventId); - } - if (response && typeof response.statusCode === "number" && response.statusCode === 0) { - return reject3( - "Unable to send Feedback. This is because of network issues, or because you are using an ad-blocker." - ); - } - if (response && typeof response.statusCode === "number" && response.statusCode === 403) { - return reject3( - "Unable to send Feedback. This could be because this domain is not in your list of allowed domains." - ); - } - return reject3( - "Unable to send Feedback. This could be because of network issues, or because you are using an ad-blocker" - ); - }); - }); -}, "sendFeedback"); -const DEBUG_BUILD$1 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; -function isScreenshotSupported() { - if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(NAVIGATOR.userAgent)) { - return false; - } - if (/Macintosh/i.test(NAVIGATOR.userAgent) && NAVIGATOR.maxTouchPoints && NAVIGATOR.maxTouchPoints > 1) { - return false; - } - if (!isSecureContext) { - return false; - } - return true; -} -__name(isScreenshotSupported, "isScreenshotSupported"); -function mergeOptions$2(defaultOptions2, optionOverrides) { - return { - ...defaultOptions2, - ...optionOverrides, - tags: { - ...defaultOptions2.tags, - ...optionOverrides.tags - }, - onFormOpen: /* @__PURE__ */ __name(() => { - optionOverrides.onFormOpen && optionOverrides.onFormOpen(); - defaultOptions2.onFormOpen && defaultOptions2.onFormOpen(); - }, "onFormOpen"), - onFormClose: /* @__PURE__ */ __name(() => { - optionOverrides.onFormClose && optionOverrides.onFormClose(); - defaultOptions2.onFormClose && defaultOptions2.onFormClose(); - }, "onFormClose"), - onSubmitSuccess: /* @__PURE__ */ __name((data26) => { - optionOverrides.onSubmitSuccess && optionOverrides.onSubmitSuccess(data26); - defaultOptions2.onSubmitSuccess && defaultOptions2.onSubmitSuccess(data26); - }, "onSubmitSuccess"), - onSubmitError: /* @__PURE__ */ __name((error2) => { - optionOverrides.onSubmitError && optionOverrides.onSubmitError(error2); - defaultOptions2.onSubmitError && defaultOptions2.onSubmitError(error2); - }, "onSubmitError"), - onFormSubmitted: /* @__PURE__ */ __name(() => { - optionOverrides.onFormSubmitted && optionOverrides.onFormSubmitted(); - defaultOptions2.onFormSubmitted && defaultOptions2.onFormSubmitted(); - }, "onFormSubmitted"), - themeDark: { - ...defaultOptions2.themeDark, - ...optionOverrides.themeDark - }, - themeLight: { - ...defaultOptions2.themeLight, - ...optionOverrides.themeLight - } - }; -} -__name(mergeOptions$2, "mergeOptions$2"); -function createActorStyles(styleNonce) { - const style2 = DOCUMENT.createElement("style"); - style2.textContent = ` -.widget__actor { - position: fixed; - z-index: var(--z-index); - margin: var(--page-margin); - inset: var(--actor-inset); - - display: flex; - align-items: center; - gap: 8px; - padding: 16px; - - font-family: inherit; - font-size: var(--font-size); - font-weight: 600; - line-height: 1.14em; - text-decoration: none; - - background: var(--actor-background, var(--background)); - border-radius: var(--actor-border-radius, 1.7em/50%); - border: var(--actor-border, var(--border)); - box-shadow: var(--actor-box-shadow, var(--box-shadow)); - color: var(--actor-color, var(--foreground)); - fill: var(--actor-color, var(--foreground)); - cursor: pointer; - opacity: 1; - transition: transform 0.2s ease-in-out; - transform: translate(0, 0) scale(1); -} -.widget__actor[aria-hidden="true"] { - opacity: 0; - pointer-events: none; - visibility: hidden; - transform: translate(0, 16px) scale(0.98); -} - -.widget__actor:hover { - background: var(--actor-hover-background, var(--background)); - filter: var(--interactive-filter); -} - -.widget__actor svg { - width: 1.14em; - height: 1.14em; -} - -@media (max-width: 600px) { - .widget__actor span { - display: none; - } -} -`; - if (styleNonce) { - style2.setAttribute("nonce", styleNonce); - } - return style2; -} -__name(createActorStyles, "createActorStyles"); -function setAttributesNS(el, attributes) { - Object.entries(attributes).forEach(([key, val]) => { - el.setAttributeNS(null, key, val); - }); - return el; -} -__name(setAttributesNS, "setAttributesNS"); -const SIZE$1 = 20; -const XMLNS$2 = "http://www.w3.org/2000/svg"; -function FeedbackIcon() { - const createElementNS = /* @__PURE__ */ __name((tagName) => WINDOW.document.createElementNS(XMLNS$2, tagName), "createElementNS"); - const svg = setAttributesNS(createElementNS("svg"), { - width: `${SIZE$1}`, - height: `${SIZE$1}`, - viewBox: `0 0 ${SIZE$1} ${SIZE$1}`, - fill: "var(--actor-color, var(--foreground))" - }); - const g2 = setAttributesNS(createElementNS("g"), { - clipPath: "url(#clip0_57_80)" - }); - const path = setAttributesNS(createElementNS("path"), { - ["fill-rule"]: "evenodd", - ["clip-rule"]: "evenodd", - d: "M15.6622 15H12.3997C12.2129 14.9959 12.031 14.9396 11.8747 14.8375L8.04965 12.2H7.49956V19.1C7.4875 19.3348 7.3888 19.5568 7.22256 19.723C7.05632 19.8892 6.83435 19.9879 6.59956 20H2.04956C1.80193 19.9968 1.56535 19.8969 1.39023 19.7218C1.21511 19.5467 1.1153 19.3101 1.11206 19.0625V12.2H0.949652C0.824431 12.2017 0.700142 12.1783 0.584123 12.1311C0.468104 12.084 0.362708 12.014 0.274155 11.9255C0.185602 11.8369 0.115689 11.7315 0.0685419 11.6155C0.0213952 11.4995 -0.00202913 11.3752 -0.00034808 11.25V3.75C-0.00900498 3.62067 0.0092504 3.49095 0.0532651 3.36904C0.0972798 3.24712 0.166097 3.13566 0.255372 3.04168C0.344646 2.94771 0.452437 2.87327 0.571937 2.82307C0.691437 2.77286 0.82005 2.74798 0.949652 2.75H8.04965L11.8747 0.1625C12.031 0.0603649 12.2129 0.00407221 12.3997 0H15.6622C15.9098 0.00323746 16.1464 0.103049 16.3215 0.278167C16.4966 0.453286 16.5964 0.689866 16.5997 0.9375V3.25269C17.3969 3.42959 18.1345 3.83026 18.7211 4.41679C19.5322 5.22788 19.9878 6.32796 19.9878 7.47502C19.9878 8.62209 19.5322 9.72217 18.7211 10.5333C18.1345 11.1198 17.3969 11.5205 16.5997 11.6974V14.0125C16.6047 14.1393 16.5842 14.2659 16.5395 14.3847C16.4948 14.5035 16.4268 14.6121 16.3394 14.7042C16.252 14.7962 16.147 14.8698 16.0307 14.9206C15.9144 14.9714 15.7891 14.9984 15.6622 15ZM1.89695 10.325H1.88715V4.625H8.33715C8.52423 4.62301 8.70666 4.56654 8.86215 4.4625L12.6872 1.875H14.7247V13.125H12.6872L8.86215 10.4875C8.70666 10.3835 8.52423 10.327 8.33715 10.325H2.20217C2.15205 10.3167 2.10102 10.3125 2.04956 10.3125C1.9981 10.3125 1.94708 10.3167 1.89695 10.325ZM2.98706 12.2V18.1625H5.66206V12.2H2.98706ZM16.5997 9.93612V5.01393C16.6536 5.02355 16.7072 5.03495 16.7605 5.04814C17.1202 5.13709 17.4556 5.30487 17.7425 5.53934C18.0293 5.77381 18.2605 6.06912 18.4192 6.40389C18.578 6.73866 18.6603 7.10452 18.6603 7.47502C18.6603 7.84552 18.578 8.21139 18.4192 8.54616C18.2605 8.88093 18.0293 9.17624 17.7425 9.41071C17.4556 9.64518 17.1202 9.81296 16.7605 9.90191C16.7072 9.91509 16.6536 9.9265 16.5997 9.93612Z" - }); - svg.appendChild(g2).appendChild(path); - const speakerDefs = createElementNS("defs"); - const speakerClipPathDef = setAttributesNS(createElementNS("clipPath"), { - id: "clip0_57_80" - }); - const speakerRect = setAttributesNS(createElementNS("rect"), { - width: `${SIZE$1}`, - height: `${SIZE$1}`, - fill: "white" - }); - speakerClipPathDef.appendChild(speakerRect); - speakerDefs.appendChild(speakerClipPathDef); - svg.appendChild(speakerDefs).appendChild(speakerClipPathDef).appendChild(speakerRect); - return svg; -} -__name(FeedbackIcon, "FeedbackIcon"); -function Actor({ triggerLabel, triggerAriaLabel, shadow, styleNonce }) { - const el = DOCUMENT.createElement("button"); - el.type = "button"; - el.className = "widget__actor"; - el.ariaHidden = "false"; - el.ariaLabel = triggerAriaLabel || triggerLabel || TRIGGER_LABEL; - el.appendChild(FeedbackIcon()); - if (triggerLabel) { - const label5 = DOCUMENT.createElement("span"); - label5.appendChild(DOCUMENT.createTextNode(triggerLabel)); - el.appendChild(label5); - } - const style2 = createActorStyles(styleNonce); - return { - el, - appendToDom() { - shadow.appendChild(style2); - shadow.appendChild(el); - }, - removeFromDom() { - shadow.removeChild(el); - shadow.removeChild(style2); - }, - show() { - el.ariaHidden = "false"; - }, - hide() { - el.ariaHidden = "true"; - } - }; -} -__name(Actor, "Actor"); -const PURPLE = "rgba(88, 74, 192, 1)"; -const DEFAULT_LIGHT = { - foreground: "#2b2233", - background: "#ffffff", - accentForeground: "white", - accentBackground: PURPLE, - successColor: "#268d75", - errorColor: "#df3338", - border: "1.5px solid rgba(41, 35, 47, 0.13)", - boxShadow: "0px 4px 24px 0px rgba(43, 34, 51, 0.12)", - outline: "1px auto var(--accent-background)", - interactiveFilter: "brightness(95%)" -}; -const DEFAULT_DARK = { - foreground: "#ebe6ef", - background: "#29232f", - accentForeground: "white", - accentBackground: PURPLE, - successColor: "#2da98c", - errorColor: "#f55459", - border: "1.5px solid rgba(235, 230, 239, 0.15)", - boxShadow: "0px 4px 24px 0px rgba(43, 34, 51, 0.12)", - outline: "1px auto var(--accent-background)", - interactiveFilter: "brightness(150%)" -}; -function getThemedCssVariables(theme43) { - return ` - --foreground: ${theme43.foreground}; - --background: ${theme43.background}; - --accent-foreground: ${theme43.accentForeground}; - --accent-background: ${theme43.accentBackground}; - --success-color: ${theme43.successColor}; - --error-color: ${theme43.errorColor}; - --border: ${theme43.border}; - --box-shadow: ${theme43.boxShadow}; - --outline: ${theme43.outline}; - --interactive-filter: ${theme43.interactiveFilter}; - `; -} -__name(getThemedCssVariables, "getThemedCssVariables"); -function createMainStyles({ - colorScheme, - themeDark, - themeLight, - styleNonce -}) { - const style2 = DOCUMENT.createElement("style"); - style2.textContent = ` -:host { - --font-family: system-ui, 'Helvetica Neue', Arial, sans-serif; - --font-size: 14px; - --z-index: 100000; - - --page-margin: 16px; - --inset: auto 0 0 auto; - --actor-inset: var(--inset); - - font-family: var(--font-family); - font-size: var(--font-size); - - ${colorScheme !== "system" ? "color-scheme: only light;" : ""} - - ${getThemedCssVariables( - colorScheme === "dark" ? { ...DEFAULT_DARK, ...themeDark } : { ...DEFAULT_LIGHT, ...themeLight } - )} -} - -${colorScheme === "system" ? ` -@media (prefers-color-scheme: dark) { - :host { - ${getThemedCssVariables({ ...DEFAULT_DARK, ...themeDark })} - } -}` : ""} -} -`; - if (styleNonce) { - style2.setAttribute("nonce", styleNonce); - } - return style2; -} -__name(createMainStyles, "createMainStyles"); -const buildFeedbackIntegration = /* @__PURE__ */ __name(({ - lazyLoadIntegration: lazyLoadIntegration2, - getModalIntegration, - getScreenshotIntegration -}) => { - const feedbackIntegration = /* @__PURE__ */ __name(({ - // FeedbackGeneralConfiguration - id: id3 = "sentry-feedback", - autoInject = true, - showBranding = true, - isEmailRequired = false, - isNameRequired = false, - showEmail = true, - showName = true, - enableScreenshot = true, - useSentryUser = { - email: "email", - name: "username" - }, - tags, - styleNonce, - scriptNonce, - // FeedbackThemeConfiguration - colorScheme = "system", - themeLight = {}, - themeDark = {}, - // FeedbackTextConfiguration - addScreenshotButtonLabel = ADD_SCREENSHOT_LABEL, - cancelButtonLabel = CANCEL_BUTTON_LABEL, - confirmButtonLabel = CONFIRM_BUTTON_LABEL, - emailLabel = EMAIL_LABEL, - emailPlaceholder = EMAIL_PLACEHOLDER, - formTitle = FORM_TITLE, - isRequiredLabel = IS_REQUIRED_LABEL, - messageLabel = MESSAGE_LABEL, - messagePlaceholder = MESSAGE_PLACEHOLDER, - nameLabel = NAME_LABEL, - namePlaceholder = NAME_PLACEHOLDER, - removeScreenshotButtonLabel = REMOVE_SCREENSHOT_LABEL, - submitButtonLabel = SUBMIT_BUTTON_LABEL, - successMessageText = SUCCESS_MESSAGE_TEXT, - triggerLabel = TRIGGER_LABEL, - triggerAriaLabel = "", - // FeedbackCallbacks - onFormOpen, - onFormClose, - onSubmitSuccess, - onSubmitError, - onFormSubmitted - } = {}) => { - const _options = { - id: id3, - autoInject, - showBranding, - isEmailRequired, - isNameRequired, - showEmail, - showName, - enableScreenshot, - useSentryUser, - tags, - styleNonce, - scriptNonce, - colorScheme, - themeDark, - themeLight, - triggerLabel, - triggerAriaLabel, - cancelButtonLabel, - submitButtonLabel, - confirmButtonLabel, - formTitle, - emailLabel, - emailPlaceholder, - messageLabel, - messagePlaceholder, - nameLabel, - namePlaceholder, - successMessageText, - isRequiredLabel, - addScreenshotButtonLabel, - removeScreenshotButtonLabel, - onFormClose, - onFormOpen, - onSubmitError, - onSubmitSuccess, - onFormSubmitted - }; - let _shadow = null; - let _subscriptions = []; - const _createShadow = /* @__PURE__ */ __name((options4) => { - if (!_shadow) { - const host = DOCUMENT.createElement("div"); - host.id = String(options4.id); - DOCUMENT.body.appendChild(host); - _shadow = host.attachShadow({ mode: "open" }); - _shadow.appendChild(createMainStyles(options4)); - } - return _shadow; - }, "_createShadow"); - const _loadAndRenderDialog = /* @__PURE__ */ __name(async (options4) => { - const screenshotRequired = options4.enableScreenshot && isScreenshotSupported(); - let modalIntegration; - let screenshotIntegration; - try { - const modalIntegrationFn = getModalIntegration ? getModalIntegration() : await lazyLoadIntegration2("feedbackModalIntegration", scriptNonce); - modalIntegration = modalIntegrationFn(); - addIntegration(modalIntegration); - } catch (e2) { - DEBUG_BUILD$1 && logger$2.error( - "[Feedback] Error when trying to load feedback integrations. Try using `feedbackSyncIntegration` in your `Sentry.init`." - ); - throw new Error("[Feedback] Missing feedback modal integration!"); - } - try { - const screenshotIntegrationFn = screenshotRequired ? getScreenshotIntegration ? getScreenshotIntegration() : await lazyLoadIntegration2("feedbackScreenshotIntegration", scriptNonce) : void 0; - if (screenshotIntegrationFn) { - screenshotIntegration = screenshotIntegrationFn(); - addIntegration(screenshotIntegration); - } - } catch (e2) { - DEBUG_BUILD$1 && logger$2.error("[Feedback] Missing feedback screenshot integration. Proceeding without screenshots."); - } - const dialog = modalIntegration.createDialog({ - options: { - ...options4, - onFormClose: /* @__PURE__ */ __name(() => { - dialog && dialog.close(); - options4.onFormClose && options4.onFormClose(); - }, "onFormClose"), - onFormSubmitted: /* @__PURE__ */ __name(() => { - dialog && dialog.close(); - options4.onFormSubmitted && options4.onFormSubmitted(); - }, "onFormSubmitted") - }, - screenshotIntegration, - sendFeedback, - shadow: _createShadow(options4) - }); - return dialog; - }, "_loadAndRenderDialog"); - const _attachTo = /* @__PURE__ */ __name((el, optionOverrides = {}) => { - const mergedOptions = mergeOptions$2(_options, optionOverrides); - const targetEl = typeof el === "string" ? DOCUMENT.querySelector(el) : typeof el.addEventListener === "function" ? el : null; - if (!targetEl) { - DEBUG_BUILD$1 && logger$2.error("[Feedback] Unable to attach to target element"); - throw new Error("Unable to attach to target element"); - } - let dialog = null; - const handleClick2 = /* @__PURE__ */ __name(async () => { - if (!dialog) { - dialog = await _loadAndRenderDialog({ - ...mergedOptions, - onFormSubmitted: /* @__PURE__ */ __name(() => { - dialog && dialog.removeFromDom(); - mergedOptions.onFormSubmitted && mergedOptions.onFormSubmitted(); - }, "onFormSubmitted") - }); - } - dialog.appendToDom(); - dialog.open(); - }, "handleClick"); - targetEl.addEventListener("click", handleClick2); - const unsubscribe = /* @__PURE__ */ __name(() => { - _subscriptions = _subscriptions.filter((sub) => sub !== unsubscribe); - dialog && dialog.removeFromDom(); - dialog = null; - targetEl.removeEventListener("click", handleClick2); - }, "unsubscribe"); - _subscriptions.push(unsubscribe); - return unsubscribe; - }, "_attachTo"); - const _createActor = /* @__PURE__ */ __name((optionOverrides = {}) => { - const mergedOptions = mergeOptions$2(_options, optionOverrides); - const shadow = _createShadow(mergedOptions); - const actor = Actor({ - triggerLabel: mergedOptions.triggerLabel, - triggerAriaLabel: mergedOptions.triggerAriaLabel, - shadow, - styleNonce - }); - _attachTo(actor.el, { - ...mergedOptions, - onFormOpen() { - actor.hide(); - }, - onFormClose() { - actor.show(); - }, - onFormSubmitted() { - actor.show(); - } - }); - return actor; - }, "_createActor"); - return { - name: "Feedback", - setupOnce() { - if (!isBrowser$1() || !_options.autoInject) { - return; - } - if (DOCUMENT.readyState === "loading") { - DOCUMENT.addEventListener("DOMContentLoaded", () => _createActor().appendToDom()); - } else { - _createActor().appendToDom(); - } - }, - /** - * Adds click listener to the element to open a feedback dialog - * - * The returned function can be used to remove the click listener - */ - attachTo: _attachTo, - /** - * Creates a new widget which is composed of a Button which triggers a Dialog. - * Accepts partial options to override any options passed to constructor. - */ - createWidget(optionOverrides = {}) { - const actor = _createActor(mergeOptions$2(_options, optionOverrides)); - actor.appendToDom(); - return actor; - }, - /** - * Creates a new Form which you can - * Accepts partial options to override any options passed to constructor. - */ - async createForm(optionOverrides = {}) { - return _loadAndRenderDialog(mergeOptions$2(_options, optionOverrides)); - }, - /** - * Removes the Feedback integration (including host, shadow DOM, and all widgets) - */ - remove() { - if (_shadow) { - _shadow.parentElement && _shadow.parentElement.remove(); - _shadow = null; - } - _subscriptions.forEach((sub) => sub()); - _subscriptions = []; - } - }; - }, "feedbackIntegration"); - return feedbackIntegration; -}, "buildFeedbackIntegration"); -function getFeedback() { - const client = getClient(); - return client && client.getIntegrationByName("Feedback"); -} -__name(getFeedback, "getFeedback"); -var n, l$1, u$1, i$1, o$1, r$1, f$1, c$1 = {}, s$1 = [], a$1 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, h$1 = Array.isArray; -function v$1(n2, l2) { - for (var u2 in l2) n2[u2] = l2[u2]; - return n2; -} -__name(v$1, "v$1"); -function p$1(n2) { - var l2 = n2.parentNode; - l2 && l2.removeChild(n2); -} -__name(p$1, "p$1"); -function y$1(l2, u2, t2) { - var i2, o2, r2, f2 = {}; - for (r2 in u2) "key" == r2 ? i2 = u2[r2] : "ref" == r2 ? o2 = u2[r2] : f2[r2] = u2[r2]; - if (arguments.length > 2 && (f2.children = arguments.length > 3 ? n.call(arguments, 2) : t2), "function" == typeof l2 && null != l2.defaultProps) for (r2 in l2.defaultProps) void 0 === f2[r2] && (f2[r2] = l2.defaultProps[r2]); - return d$1(l2, f2, i2, o2, null); -} -__name(y$1, "y$1"); -function d$1(n2, t2, i2, o2, r2) { - var f2 = { type: n2, props: t2, key: i2, ref: o2, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: null == r2 ? ++u$1 : r2, __i: -1, __u: 0 }; - return null == r2 && null != l$1.vnode && l$1.vnode(f2), f2; -} -__name(d$1, "d$1"); -function g$1$1(n2) { - return n2.children; -} -__name(g$1$1, "g$1$1"); -function b$1(n2, l2) { - this.props = n2, this.context = l2; -} -__name(b$1, "b$1"); -function m$1(n2, l2) { - if (null == l2) return n2.__ ? m$1(n2.__, n2.__i + 1) : null; - for (var u2; l2 < n2.__k.length; l2++) if (null != (u2 = n2.__k[l2]) && null != u2.__e) return u2.__e; - return "function" == typeof n2.type ? m$1(n2) : null; -} -__name(m$1, "m$1"); -function w$1(n2, u2, t2) { - var i2, o2 = n2.__v, r2 = o2.__e, f2 = n2.__P; - if (f2) return (i2 = v$1({}, o2)).__v = o2.__v + 1, l$1.vnode && l$1.vnode(i2), M(f2, i2, o2, n2.__n, void 0 !== f2.ownerSVGElement, 32 & o2.__u ? [r2] : null, u2, null == r2 ? m$1(o2) : r2, !!(32 & o2.__u), t2), i2.__.__k[i2.__i] = i2, i2.__d = void 0, i2.__e != r2 && k$1(i2), i2; -} -__name(w$1, "w$1"); -function k$1(n2) { - var l2, u2; - if (null != (n2 = n2.__) && null != n2.__c) { - for (n2.__e = n2.__c.base = null, l2 = 0; l2 < n2.__k.length; l2++) if (null != (u2 = n2.__k[l2]) && null != u2.__e) { - n2.__e = n2.__c.base = u2.__e; - break; - } - return k$1(n2); - } -} -__name(k$1, "k$1"); -function x$1(n2) { - (!n2.__d && (n2.__d = true) && i$1.push(n2) && !C$1.__r++ || o$1 !== l$1.debounceRendering) && ((o$1 = l$1.debounceRendering) || r$1)(C$1); -} -__name(x$1, "x$1"); -function C$1() { - var n2, u2, t2, o2 = [], r2 = []; - for (i$1.sort(f$1); n2 = i$1.shift(); ) n2.__d && (t2 = i$1.length, u2 = w$1(n2, o2, r2) || u2, 0 === t2 || i$1.length > t2 ? (j$1(o2, u2, r2), r2.length = o2.length = 0, u2 = void 0, i$1.sort(f$1)) : u2 && l$1.__c && l$1.__c(u2, s$1)); - u2 && j$1(o2, u2, r2), C$1.__r = 0; -} -__name(C$1, "C$1"); -function P$1(n2, l2, u2, t2, i2, o2, r2, f2, e2, a2, h2) { - var v2, p2, y2, d2, _2, g2 = t2 && t2.__k || s$1, b2 = l2.length; - for (u2.__d = e2, S(u2, l2, g2), e2 = u2.__d, v2 = 0; v2 < b2; v2++) null != (y2 = u2.__k[v2]) && "boolean" != typeof y2 && "function" != typeof y2 && (p2 = -1 === y2.__i ? c$1 : g2[y2.__i] || c$1, y2.__i = v2, M(n2, y2, p2, i2, o2, r2, f2, e2, a2, h2), d2 = y2.__e, y2.ref && p2.ref != y2.ref && (p2.ref && N(p2.ref, null, y2), h2.push(y2.ref, y2.__c || d2, y2)), null == _2 && null != d2 && (_2 = d2), 65536 & y2.__u || p2.__k === y2.__k ? e2 = $(y2, e2, n2) : "function" == typeof y2.type && void 0 !== y2.__d ? e2 = y2.__d : d2 && (e2 = d2.nextSibling), y2.__d = void 0, y2.__u &= -196609); - u2.__d = e2, u2.__e = _2; -} -__name(P$1, "P$1"); -function S(n2, l2, u2) { - var t2, i2, o2, r2, f2, e2 = l2.length, c2 = u2.length, s2 = c2, a2 = 0; - for (n2.__k = [], t2 = 0; t2 < e2; t2++) null != (i2 = n2.__k[t2] = null == (i2 = l2[t2]) || "boolean" == typeof i2 || "function" == typeof i2 ? null : "string" == typeof i2 || "number" == typeof i2 || "bigint" == typeof i2 || i2.constructor == String ? d$1(null, i2, null, null, i2) : h$1(i2) ? d$1(g$1$1, { children: i2 }, null, null, null) : void 0 === i2.constructor && i2.__b > 0 ? d$1(i2.type, i2.props, i2.key, i2.ref ? i2.ref : null, i2.__v) : i2) ? (i2.__ = n2, i2.__b = n2.__b + 1, f2 = I(i2, u2, r2 = t2 + a2, s2), i2.__i = f2, o2 = null, -1 !== f2 && (s2--, (o2 = u2[f2]) && (o2.__u |= 131072)), null == o2 || null === o2.__v ? (-1 == f2 && a2--, "function" != typeof i2.type && (i2.__u |= 65536)) : f2 !== r2 && (f2 === r2 + 1 ? a2++ : f2 > r2 ? s2 > e2 - r2 ? a2 += f2 - r2 : a2-- : a2 = f2 < r2 && f2 == r2 - 1 ? f2 - r2 : 0, f2 !== t2 + a2 && (i2.__u |= 65536))) : (o2 = u2[t2]) && null == o2.key && o2.__e && (o2.__e == n2.__d && (n2.__d = m$1(o2)), O(o2, o2, false), u2[t2] = null, s2--); - if (s2) for (t2 = 0; t2 < c2; t2++) null != (o2 = u2[t2]) && 0 == (131072 & o2.__u) && (o2.__e == n2.__d && (n2.__d = m$1(o2)), O(o2, o2)); -} -__name(S, "S"); -function $(n2, l2, u2) { - var t2, i2; - if ("function" == typeof n2.type) { - for (t2 = n2.__k, i2 = 0; t2 && i2 < t2.length; i2++) t2[i2] && (t2[i2].__ = n2, l2 = $(t2[i2], l2, u2)); - return l2; - } - n2.__e != l2 && (u2.insertBefore(n2.__e, l2 || null), l2 = n2.__e); - do { - l2 = l2 && l2.nextSibling; - } while (null != l2 && 8 === l2.nodeType); - return l2; -} -__name($, "$"); -function I(n2, l2, u2, t2) { - var i2 = n2.key, o2 = n2.type, r2 = u2 - 1, f2 = u2 + 1, e2 = l2[u2]; - if (null === e2 || e2 && i2 == e2.key && o2 === e2.type) return u2; - if (t2 > (null != e2 && 0 == (131072 & e2.__u) ? 1 : 0)) for (; r2 >= 0 || f2 < l2.length; ) { - if (r2 >= 0) { - if ((e2 = l2[r2]) && 0 == (131072 & e2.__u) && i2 == e2.key && o2 === e2.type) return r2; - r2--; - } - if (f2 < l2.length) { - if ((e2 = l2[f2]) && 0 == (131072 & e2.__u) && i2 == e2.key && o2 === e2.type) return f2; - f2++; - } - } - return -1; -} -__name(I, "I"); -function T$1(n2, l2, u2) { - "-" === l2[0] ? n2.setProperty(l2, null == u2 ? "" : u2) : n2[l2] = null == u2 ? "" : "number" != typeof u2 || a$1.test(l2) ? u2 : u2 + "px"; -} -__name(T$1, "T$1"); -function A$1(n2, l2, u2, t2, i2) { - var o2; - n: if ("style" === l2) if ("string" == typeof u2) n2.style.cssText = u2; - else { - if ("string" == typeof t2 && (n2.style.cssText = t2 = ""), t2) for (l2 in t2) u2 && l2 in u2 || T$1(n2.style, l2, ""); - if (u2) for (l2 in u2) t2 && u2[l2] === t2[l2] || T$1(n2.style, l2, u2[l2]); - } - else if ("o" === l2[0] && "n" === l2[1]) o2 = l2 !== (l2 = l2.replace(/(PointerCapture)$|Capture$/i, "$1")), l2 = l2.toLowerCase() in n2 ? l2.toLowerCase().slice(2) : l2.slice(2), n2.l || (n2.l = {}), n2.l[l2 + o2] = u2, u2 ? t2 ? u2.u = t2.u : (u2.u = Date.now(), n2.addEventListener(l2, o2 ? L : D$1, o2)) : n2.removeEventListener(l2, o2 ? L : D$1, o2); - else { - if (i2) l2 = l2.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); - else if ("width" !== l2 && "height" !== l2 && "href" !== l2 && "list" !== l2 && "form" !== l2 && "tabIndex" !== l2 && "download" !== l2 && "rowSpan" !== l2 && "colSpan" !== l2 && "role" !== l2 && l2 in n2) try { - n2[l2] = null == u2 ? "" : u2; - break n; - } catch (n3) { - } - "function" == typeof u2 || (null == u2 || false === u2 && "-" !== l2[4] ? n2.removeAttribute(l2) : n2.setAttribute(l2, u2)); - } -} -__name(A$1, "A$1"); -function D$1(n2) { - if (this.l) { - var u2 = this.l[n2.type + false]; - if (n2.t) { - if (n2.t <= u2.u) return; - } else n2.t = Date.now(); - return u2(l$1.event ? l$1.event(n2) : n2); - } -} -__name(D$1, "D$1"); -function L(n2) { - if (this.l) return this.l[n2.type + true](l$1.event ? l$1.event(n2) : n2); -} -__name(L, "L"); -function M(n2, u2, t2, i2, o2, r2, f2, e2, c2, s2) { - var a2, p2, y2, d2, _2, m2, w2, k2, x2, C2, S2, $2, H, I2, T2, A2 = u2.type; - if (void 0 !== u2.constructor) return null; - 128 & t2.__u && (c2 = !!(32 & t2.__u), r2 = [e2 = u2.__e = t2.__e]), (a2 = l$1.__b) && a2(u2); - n: if ("function" == typeof A2) try { - if (k2 = u2.props, x2 = (a2 = A2.contextType) && i2[a2.__c], C2 = a2 ? x2 ? x2.props.value : a2.__ : i2, t2.__c ? w2 = (p2 = u2.__c = t2.__c).__ = p2.__E : ("prototype" in A2 && A2.prototype.render ? u2.__c = p2 = new A2(k2, C2) : (u2.__c = p2 = new b$1(k2, C2), p2.constructor = A2, p2.render = q$1), x2 && x2.sub(p2), p2.props = k2, p2.state || (p2.state = {}), p2.context = C2, p2.__n = i2, y2 = p2.__d = true, p2.__h = [], p2._sb = []), null == p2.__s && (p2.__s = p2.state), null != A2.getDerivedStateFromProps && (p2.__s == p2.state && (p2.__s = v$1({}, p2.__s)), v$1(p2.__s, A2.getDerivedStateFromProps(k2, p2.__s))), d2 = p2.props, _2 = p2.state, p2.__v = u2, y2) null == A2.getDerivedStateFromProps && null != p2.componentWillMount && p2.componentWillMount(), null != p2.componentDidMount && p2.__h.push(p2.componentDidMount); - else { - if (null == A2.getDerivedStateFromProps && k2 !== d2 && null != p2.componentWillReceiveProps && p2.componentWillReceiveProps(k2, C2), !p2.__e && (null != p2.shouldComponentUpdate && false === p2.shouldComponentUpdate(k2, p2.__s, C2) || u2.__v === t2.__v)) { - for (u2.__v !== t2.__v && (p2.props = k2, p2.state = p2.__s, p2.__d = false), u2.__e = t2.__e, u2.__k = t2.__k, u2.__k.forEach(function(n3) { - n3 && (n3.__ = u2); - }), S2 = 0; S2 < p2._sb.length; S2++) p2.__h.push(p2._sb[S2]); - p2._sb = [], p2.__h.length && f2.push(p2); - break n; - } - null != p2.componentWillUpdate && p2.componentWillUpdate(k2, p2.__s, C2), null != p2.componentDidUpdate && p2.__h.push(function() { - p2.componentDidUpdate(d2, _2, m2); - }); - } - if (p2.context = C2, p2.props = k2, p2.__P = n2, p2.__e = false, $2 = l$1.__r, H = 0, "prototype" in A2 && A2.prototype.render) { - for (p2.state = p2.__s, p2.__d = false, $2 && $2(u2), a2 = p2.render(p2.props, p2.state, p2.context), I2 = 0; I2 < p2._sb.length; I2++) p2.__h.push(p2._sb[I2]); - p2._sb = []; - } else do { - p2.__d = false, $2 && $2(u2), a2 = p2.render(p2.props, p2.state, p2.context), p2.state = p2.__s; - } while (p2.__d && ++H < 25); - p2.state = p2.__s, null != p2.getChildContext && (i2 = v$1(v$1({}, i2), p2.getChildContext())), y2 || null == p2.getSnapshotBeforeUpdate || (m2 = p2.getSnapshotBeforeUpdate(d2, _2)), P$1(n2, h$1(T2 = null != a2 && a2.type === g$1$1 && null == a2.key ? a2.props.children : a2) ? T2 : [T2], u2, t2, i2, o2, r2, f2, e2, c2, s2), p2.base = u2.__e, u2.__u &= -161, p2.__h.length && f2.push(p2), w2 && (p2.__E = p2.__ = null); - } catch (n3) { - u2.__v = null, c2 || null != r2 ? (u2.__e = e2, u2.__u |= c2 ? 160 : 32, r2[r2.indexOf(e2)] = null) : (u2.__e = t2.__e, u2.__k = t2.__k), l$1.__e(n3, u2, t2); - } - else null == r2 && u2.__v === t2.__v ? (u2.__k = t2.__k, u2.__e = t2.__e) : u2.__e = z$1(t2.__e, u2, t2, i2, o2, r2, f2, c2, s2); - (a2 = l$1.diffed) && a2(u2); -} -__name(M, "M"); -function j$1(n2, u2, t2) { - for (var i2 = 0; i2 < t2.length; i2++) N(t2[i2], t2[++i2], t2[++i2]); - l$1.__c && l$1.__c(u2, n2), n2.some(function(u3) { - try { - n2 = u3.__h, u3.__h = [], n2.some(function(n3) { - n3.call(u3); - }); - } catch (n3) { - l$1.__e(n3, u3.__v); - } - }); -} -__name(j$1, "j$1"); -function z$1(l2, u2, t2, i2, o2, r2, f2, e2, s2) { - var a2, v2, y2, d2, _2, g2, b2, w2 = t2.props, k2 = u2.props, x2 = u2.type; - if ("svg" === x2 && (o2 = true), null != r2) { - for (a2 = 0; a2 < r2.length; a2++) if ((_2 = r2[a2]) && "setAttribute" in _2 == !!x2 && (x2 ? _2.localName === x2 : 3 === _2.nodeType)) { - l2 = _2, r2[a2] = null; - break; - } - } - if (null == l2) { - if (null === x2) return document.createTextNode(k2); - l2 = o2 ? document.createElementNS("http://www.w3.org/2000/svg", x2) : document.createElement(x2, k2.is && k2), r2 = null, e2 = false; - } - if (null === x2) w2 === k2 || e2 && l2.data === k2 || (l2.data = k2); - else { - if (r2 = r2 && n.call(l2.childNodes), w2 = t2.props || c$1, !e2 && null != r2) for (w2 = {}, a2 = 0; a2 < l2.attributes.length; a2++) w2[(_2 = l2.attributes[a2]).name] = _2.value; - for (a2 in w2) _2 = w2[a2], "children" == a2 || ("dangerouslySetInnerHTML" == a2 ? y2 = _2 : "key" === a2 || a2 in k2 || A$1(l2, a2, null, _2, o2)); - for (a2 in k2) _2 = k2[a2], "children" == a2 ? d2 = _2 : "dangerouslySetInnerHTML" == a2 ? v2 = _2 : "value" == a2 ? g2 = _2 : "checked" == a2 ? b2 = _2 : "key" === a2 || e2 && "function" != typeof _2 || w2[a2] === _2 || A$1(l2, a2, _2, w2[a2], o2); - if (v2) e2 || y2 && (v2.__html === y2.__html || v2.__html === l2.innerHTML) || (l2.innerHTML = v2.__html), u2.__k = []; - else if (y2 && (l2.innerHTML = ""), P$1(l2, h$1(d2) ? d2 : [d2], u2, t2, i2, o2 && "foreignObject" !== x2, r2, f2, r2 ? r2[0] : t2.__k && m$1(t2, 0), e2, s2), null != r2) for (a2 = r2.length; a2--; ) null != r2[a2] && p$1(r2[a2]); - e2 || (a2 = "value", void 0 !== g2 && (g2 !== l2[a2] || "progress" === x2 && !g2 || "option" === x2 && g2 !== w2[a2]) && A$1(l2, a2, g2, w2[a2], false), a2 = "checked", void 0 !== b2 && b2 !== l2[a2] && A$1(l2, a2, b2, w2[a2], false)); - } - return l2; -} -__name(z$1, "z$1"); -function N(n2, u2, t2) { - try { - "function" == typeof n2 ? n2(u2) : n2.current = u2; - } catch (n3) { - l$1.__e(n3, t2); - } -} -__name(N, "N"); -function O(n2, u2, t2) { - var i2, o2; - if (l$1.unmount && l$1.unmount(n2), (i2 = n2.ref) && (i2.current && i2.current !== n2.__e || N(i2, null, u2)), null != (i2 = n2.__c)) { - if (i2.componentWillUnmount) try { - i2.componentWillUnmount(); - } catch (n3) { - l$1.__e(n3, u2); - } - i2.base = i2.__P = null, n2.__c = void 0; - } - if (i2 = n2.__k) for (o2 = 0; o2 < i2.length; o2++) i2[o2] && O(i2[o2], u2, t2 || "function" != typeof n2.type); - t2 || null == n2.__e || p$1(n2.__e), n2.__ = n2.__e = n2.__d = void 0; -} -__name(O, "O"); -function q$1(n2, l2, u2) { - return this.constructor(n2, u2); -} -__name(q$1, "q$1"); -function B$1(u2, t2, i2) { - var o2, r2, f2, e2; - l$1.__ && l$1.__(u2, t2), r2 = (o2 = "function" == typeof i2) ? null : t2.__k, f2 = [], e2 = [], M(t2, u2 = (!o2 && i2 || t2).__k = y$1(g$1$1, null, [u2]), r2 || c$1, c$1, void 0 !== t2.ownerSVGElement, !o2 && i2 ? [i2] : r2 ? null : t2.firstChild ? n.call(t2.childNodes) : null, f2, !o2 && i2 ? i2 : r2 ? r2.__e : t2.firstChild, o2, e2), u2.__d = void 0, j$1(f2, u2, e2); -} -__name(B$1, "B$1"); -n = s$1.slice, l$1 = { __e: /* @__PURE__ */ __name(function(n2, l2, u2, t2) { - for (var i2, o2, r2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try { - if ((o2 = i2.constructor) && null != o2.getDerivedStateFromError && (i2.setState(o2.getDerivedStateFromError(n2)), r2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, t2 || {}), r2 = i2.__d), r2) return i2.__E = i2; - } catch (l3) { - n2 = l3; - } - throw n2; -}, "__e") }, u$1 = 0, b$1.prototype.setState = function(n2, l2) { - var u2; - u2 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = v$1({}, this.state), "function" == typeof n2 && (n2 = n2(v$1({}, u2), this.props)), n2 && v$1(u2, n2), null != n2 && this.__v && (l2 && this._sb.push(l2), x$1(this)); -}, b$1.prototype.forceUpdate = function(n2) { - this.__v && (this.__e = true, n2 && this.__h.push(n2), x$1(this)); -}, b$1.prototype.render = g$1$1, i$1 = [], r$1 = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, f$1 = /* @__PURE__ */ __name(function(n2, l2) { - return n2.__v.__b - l2.__v.__b; -}, "f$1"), C$1.__r = 0; -var t$1, r, u, i$2, o = 0, f = [], c = [], e = l$1, a = e.__b, v = e.__r, l = e.diffed, m = e.__c, s = e.unmount, d = e.__; -function h$2(n2, t2) { - e.__h && e.__h(r, n2, o || t2), o = 0; - var u2 = r.__H || (r.__H = { __: [], __h: [] }); - return n2 >= u2.__.length && u2.__.push({ __V: c }), u2.__[n2]; -} -__name(h$2, "h$2"); -function p$2(n2) { - return o = 1, y(D, n2); -} -__name(p$2, "p$2"); -function y(n2, u2, i2) { - var o2 = h$2(t$1++, 2); - if (o2.t = n2, !o2.__c && (o2.__ = [i2 ? i2(u2) : D(void 0, u2), function(n3) { - var t2 = o2.__N ? o2.__N[0] : o2.__[0], r2 = o2.t(t2, n3); - t2 !== r2 && (o2.__N = [r2, o2.__[1]], o2.__c.setState({})); - }], o2.__c = r, !r.u)) { - var f2 = /* @__PURE__ */ __name(function(n3, t2, r2) { - if (!o2.__c.__H) return true; - var u3 = o2.__c.__H.__.filter(function(n4) { - return !!n4.__c; - }); - if (u3.every(function(n4) { - return !n4.__N; - })) return !c2 || c2.call(this, n3, t2, r2); - var i3 = false; - return u3.forEach(function(n4) { - if (n4.__N) { - var t3 = n4.__[0]; - n4.__ = n4.__N, n4.__N = void 0, t3 !== n4.__[0] && (i3 = true); - } - }), !(!i3 && o2.__c.props === n3) && (!c2 || c2.call(this, n3, t2, r2)); - }, "f"); - r.u = true; - var c2 = r.shouldComponentUpdate, e2 = r.componentWillUpdate; - r.componentWillUpdate = function(n3, t2, r2) { - if (this.__e) { - var u3 = c2; - c2 = void 0, f2(n3, t2, r2), c2 = u3; - } - e2 && e2.call(this, n3, t2, r2); - }, r.shouldComponentUpdate = f2; - } - return o2.__N || o2.__; -} -__name(y, "y"); -function _$1(n2, u2) { - var i2 = h$2(t$1++, 3); - !e.__s && C(i2.__H, u2) && (i2.__ = n2, i2.i = u2, r.__H.__h.push(i2)); -} -__name(_$1, "_$1"); -function A(n2, u2) { - var i2 = h$2(t$1++, 4); - !e.__s && C(i2.__H, u2) && (i2.__ = n2, i2.i = u2, r.__h.push(i2)); -} -__name(A, "A"); -function F(n2) { - return o = 5, q(function() { - return { current: n2 }; - }, []); -} -__name(F, "F"); -function T(n2, t2, r2) { - o = 6, A(function() { - return "function" == typeof n2 ? (n2(t2()), function() { - return n2(null); - }) : n2 ? (n2.current = t2(), function() { - return n2.current = null; - }) : void 0; - }, null == r2 ? r2 : r2.concat(n2)); -} -__name(T, "T"); -function q(n2, r2) { - var u2 = h$2(t$1++, 7); - return C(u2.__H, r2) ? (u2.__V = n2(), u2.i = r2, u2.__h = n2, u2.__V) : u2.__; -} -__name(q, "q"); -function x(n2, t2) { - return o = 8, q(function() { - return n2; - }, t2); -} -__name(x, "x"); -function P$2(n2) { - var u2 = r.context[n2.__c], i2 = h$2(t$1++, 9); - return i2.c = n2, u2 ? (null == i2.__ && (i2.__ = true, u2.sub(r)), u2.props.value) : n2.__; -} -__name(P$2, "P$2"); -function V(n2, t2) { - e.useDebugValue && e.useDebugValue(t2 ? t2(n2) : n2); -} -__name(V, "V"); -function b(n2) { - var u2 = h$2(t$1++, 10), i2 = p$2(); - return u2.__ = n2, r.componentDidCatch || (r.componentDidCatch = function(n3, t2) { - u2.__ && u2.__(n3, t2), i2[1](n3); - }), [i2[0], function() { - i2[1](void 0); - }]; -} -__name(b, "b"); -function g$6() { - var n2 = h$2(t$1++, 11); - if (!n2.__) { - for (var u2 = r.__v; null !== u2 && !u2.__m && null !== u2.__; ) u2 = u2.__; - var i2 = u2.__m || (u2.__m = [0, 0]); - n2.__ = "P" + i2[0] + "-" + i2[1]++; - } - return n2.__; -} -__name(g$6, "g$6"); -function j() { - for (var n2; n2 = f.shift(); ) if (n2.__P && n2.__H) try { - n2.__H.__h.forEach(z$2), n2.__H.__h.forEach(B), n2.__H.__h = []; - } catch (t2) { - n2.__H.__h = [], e.__e(t2, n2.__v); - } -} -__name(j, "j"); -e.__b = function(n2) { - r = null, a && a(n2); -}, e.__ = function(n2, t2) { - t2.__k && t2.__k.__m && (n2.__m = t2.__k.__m), d && d(n2, t2); -}, e.__r = function(n2) { - v && v(n2), t$1 = 0; - var i2 = (r = n2.__c).__H; - i2 && (u === r ? (i2.__h = [], r.__h = [], i2.__.forEach(function(n3) { - n3.__N && (n3.__ = n3.__N), n3.__V = c, n3.__N = n3.i = void 0; - })) : (i2.__h.forEach(z$2), i2.__h.forEach(B), i2.__h = [], t$1 = 0)), u = r; -}, e.diffed = function(n2) { - l && l(n2); - var t2 = n2.__c; - t2 && t2.__H && (t2.__H.__h.length && (1 !== f.push(t2) && i$2 === e.requestAnimationFrame || ((i$2 = e.requestAnimationFrame) || w)(j)), t2.__H.__.forEach(function(n3) { - n3.i && (n3.__H = n3.i), n3.__V !== c && (n3.__ = n3.__V), n3.i = void 0, n3.__V = c; - })), u = r = null; -}, e.__c = function(n2, t2) { - t2.some(function(n3) { - try { - n3.__h.forEach(z$2), n3.__h = n3.__h.filter(function(n4) { - return !n4.__ || B(n4); - }); - } catch (r2) { - t2.some(function(n4) { - n4.__h && (n4.__h = []); - }), t2 = [], e.__e(r2, n3.__v); - } - }), m && m(n2, t2); -}, e.unmount = function(n2) { - s && s(n2); - var t2, r2 = n2.__c; - r2 && r2.__H && (r2.__H.__.forEach(function(n3) { - try { - z$2(n3); - } catch (n4) { - t2 = n4; - } - }), r2.__H = void 0, t2 && e.__e(t2, r2.__v)); -}; -var k = "function" == typeof requestAnimationFrame; -function w(n2) { - var t2, r2 = /* @__PURE__ */ __name(function() { - clearTimeout(u2), k && cancelAnimationFrame(t2), setTimeout(n2); - }, "r"), u2 = setTimeout(r2, 100); - k && (t2 = requestAnimationFrame(r2)); -} -__name(w, "w"); -function z$2(n2) { - var t2 = r, u2 = n2.__c; - "function" == typeof u2 && (n2.__c = void 0, u2()), r = t2; -} -__name(z$2, "z$2"); -function B(n2) { - var t2 = r; - n2.__c = n2.__(), r = t2; -} -__name(B, "B"); -function C(n2, t2) { - return !n2 || n2.length !== t2.length || t2.some(function(t3, r2) { - return t3 !== n2[r2]; - }); -} -__name(C, "C"); -function D(n2, t2) { - return "function" == typeof t2 ? t2(n2) : t2; -} -__name(D, "D"); -const hooks = { - __proto__: null, - useCallback: x, - useContext: P$2, - useDebugValue: V, - useEffect: _$1, - useErrorBoundary: b, - useId: g$6, - useImperativeHandle: T, - useLayoutEffect: A, - useMemo: q, - useReducer: y, - useRef: F, - useState: p$2 -}; -const XMLNS$1 = "http://www.w3.org/2000/svg"; -function SentryLogo() { - const createElementNS = /* @__PURE__ */ __name((tagName) => DOCUMENT.createElementNS(XMLNS$1, tagName), "createElementNS"); - const svg = setAttributesNS(createElementNS("svg"), { - width: "32", - height: "30", - viewBox: "0 0 72 66", - fill: "inherit" - }); - const path = setAttributesNS(createElementNS("path"), { - transform: "translate(11, 11)", - d: "M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z" - }); - svg.appendChild(path); - return svg; -} -__name(SentryLogo, "SentryLogo"); -function DialogHeader({ options: options4 }) { - const logoHtml = q(() => ({ __html: SentryLogo().outerHTML }), []); - return y$1( - "h2", - { class: "dialog__header" }, - y$1("span", { class: "dialog__title" }, options4.formTitle), - options4.showBranding ? y$1( - "a", - { - class: "brand-link", - target: "_blank", - href: "https://sentry.io/welcome/", - title: "Powered by Sentry", - rel: "noopener noreferrer", - dangerouslySetInnerHTML: logoHtml - } - ) : null - ); -} -__name(DialogHeader, "DialogHeader"); -function getMissingFields(feedback, props) { - const emptyFields = []; - if (props.isNameRequired && !feedback.name) { - emptyFields.push(props.nameLabel); - } - if (props.isEmailRequired && !feedback.email) { - emptyFields.push(props.emailLabel); - } - if (!feedback.message) { - emptyFields.push(props.messageLabel); - } - return emptyFields; -} -__name(getMissingFields, "getMissingFields"); -function retrieveStringValue(formData, key) { - const value4 = formData.get(key); - if (typeof value4 === "string") { - return value4.trim(); - } - return ""; -} -__name(retrieveStringValue, "retrieveStringValue"); -function Form({ - options: options4, - defaultEmail, - defaultName, - onFormClose, - onSubmit, - onSubmitSuccess, - onSubmitError, - showEmail, - showName, - screenshotInput -}) { - const { - tags, - addScreenshotButtonLabel, - removeScreenshotButtonLabel, - cancelButtonLabel, - emailLabel, - emailPlaceholder, - isEmailRequired, - isNameRequired, - messageLabel, - messagePlaceholder, - nameLabel, - namePlaceholder, - submitButtonLabel, - isRequiredLabel - } = options4; - const [error2, setError] = p$2(null); - const [showScreenshotInput, setShowScreenshotInput] = p$2(false); - const ScreenshotInputComponent = screenshotInput && screenshotInput.input; - const [screenshotError, setScreenshotError] = p$2(null); - const onScreenshotError = x((error3) => { - setScreenshotError(error3); - setShowScreenshotInput(false); - }, []); - const hasAllRequiredFields = x( - (data26) => { - const missingFields = getMissingFields(data26, { - emailLabel, - isEmailRequired, - isNameRequired, - messageLabel, - nameLabel - }); - if (missingFields.length > 0) { - setError(`Please enter in the following required fields: ${missingFields.join(", ")}`); - } else { - setError(null); - } - return missingFields.length === 0; - }, - [emailLabel, isEmailRequired, isNameRequired, messageLabel, nameLabel] - ); - const handleSubmit = x( - async (e2) => { - try { - e2.preventDefault(); - if (!(e2.target instanceof HTMLFormElement)) { - return; - } - const formData = new FormData(e2.target); - const attachment = await (screenshotInput && showScreenshotInput ? screenshotInput.value() : void 0); - const data26 = { - name: retrieveStringValue(formData, "name"), - email: retrieveStringValue(formData, "email"), - message: retrieveStringValue(formData, "message"), - attachments: attachment ? [attachment] : void 0 - }; - if (!hasAllRequiredFields(data26)) { - return; - } - try { - await onSubmit( - { - name: data26.name, - email: data26.email, - message: data26.message, - source: FEEDBACK_WIDGET_SOURCE, - tags - }, - { attachments: data26.attachments } - ); - onSubmitSuccess(data26); - } catch (error3) { - DEBUG_BUILD$1 && logger$2.error(error3); - setError(error3); - onSubmitError(error3); - } - } catch (e22) { - } - }, - [screenshotInput && showScreenshotInput, onSubmitSuccess, onSubmitError] - ); - return y$1( - "form", - { class: "form", onSubmit: handleSubmit }, - ScreenshotInputComponent && showScreenshotInput ? y$1(ScreenshotInputComponent, { onError: onScreenshotError }) : null, - y$1( - "div", - { class: "form__right", "data-sentry-feedback": true }, - y$1( - "div", - { class: "form__top" }, - error2 ? y$1("div", { class: "form__error-container" }, error2) : null, - showName ? y$1( - "label", - { for: "name", class: "form__label" }, - y$1(LabelText, { label: nameLabel, isRequiredLabel, isRequired: isNameRequired }), - y$1( - "input", - { - class: "form__input", - defaultValue: defaultName, - id: "name", - name: "name", - placeholder: namePlaceholder, - required: isNameRequired, - type: "text" - } - ) - ) : y$1("input", { "aria-hidden": true, value: defaultName, name: "name", type: "hidden" }), - showEmail ? y$1( - "label", - { for: "email", class: "form__label" }, - y$1(LabelText, { label: emailLabel, isRequiredLabel, isRequired: isEmailRequired }), - y$1( - "input", - { - class: "form__input", - defaultValue: defaultEmail, - id: "email", - name: "email", - placeholder: emailPlaceholder, - required: isEmailRequired, - type: "email" - } - ) - ) : y$1("input", { "aria-hidden": true, value: defaultEmail, name: "email", type: "hidden" }), - y$1( - "label", - { for: "message", class: "form__label" }, - y$1(LabelText, { label: messageLabel, isRequiredLabel, isRequired: true }), - y$1( - "textarea", - { - autoFocus: true, - class: "form__input form__input--textarea", - id: "message", - name: "message", - placeholder: messagePlaceholder, - required: true, - rows: 5 - } - ) - ), - ScreenshotInputComponent ? y$1( - "label", - { for: "screenshot", class: "form__label" }, - y$1( - "button", - { - class: "btn btn--default", - type: "button", - onClick: /* @__PURE__ */ __name(() => { - setScreenshotError(null); - setShowScreenshotInput((prev2) => !prev2); - }, "onClick") - }, - showScreenshotInput ? removeScreenshotButtonLabel : addScreenshotButtonLabel - ), - screenshotError ? y$1("div", { class: "form__error-container" }, screenshotError.message) : null - ) : null - ), - y$1( - "div", - { class: "btn-group" }, - y$1( - "button", - { class: "btn btn--primary", type: "submit" }, - submitButtonLabel - ), - y$1( - "button", - { class: "btn btn--default", type: "button", onClick: onFormClose }, - cancelButtonLabel - ) - ) - ) - ); -} -__name(Form, "Form"); -function LabelText({ - label: label5, - isRequired, - isRequiredLabel -}) { - return y$1( - "span", - { class: "form__label__text" }, - label5, - isRequired && y$1("span", { class: "form__label__text--required" }, isRequiredLabel) - ); -} -__name(LabelText, "LabelText"); -const WIDTH = 16; -const HEIGHT = 17; -const XMLNS = "http://www.w3.org/2000/svg"; -function SuccessIcon() { - const createElementNS = /* @__PURE__ */ __name((tagName) => WINDOW.document.createElementNS(XMLNS, tagName), "createElementNS"); - const svg = setAttributesNS(createElementNS("svg"), { - width: `${WIDTH}`, - height: `${HEIGHT}`, - viewBox: `0 0 ${WIDTH} ${HEIGHT}`, - fill: "inherit" - }); - const g2 = setAttributesNS(createElementNS("g"), { - clipPath: "url(#clip0_57_156)" - }); - const path2 = setAttributesNS(createElementNS("path"), { - ["fill-rule"]: "evenodd", - ["clip-rule"]: "evenodd", - d: "M3.55544 15.1518C4.87103 16.0308 6.41775 16.5 8 16.5C10.1217 16.5 12.1566 15.6571 13.6569 14.1569C15.1571 12.6566 16 10.6217 16 8.5C16 6.91775 15.5308 5.37103 14.6518 4.05544C13.7727 2.73985 12.5233 1.71447 11.0615 1.10897C9.59966 0.503466 7.99113 0.34504 6.43928 0.653721C4.88743 0.962403 3.46197 1.72433 2.34315 2.84315C1.22433 3.96197 0.462403 5.38743 0.153721 6.93928C-0.15496 8.49113 0.00346625 10.0997 0.608967 11.5615C1.21447 13.0233 2.23985 14.2727 3.55544 15.1518ZM4.40546 3.1204C5.46945 2.40946 6.72036 2.03 8 2.03C9.71595 2.03 11.3616 2.71166 12.575 3.92502C13.7883 5.13838 14.47 6.78405 14.47 8.5C14.47 9.77965 14.0905 11.0306 13.3796 12.0945C12.6687 13.1585 11.6582 13.9878 10.476 14.4775C9.29373 14.9672 7.99283 15.0953 6.73777 14.8457C5.48271 14.596 4.32987 13.9798 3.42502 13.075C2.52018 12.1701 1.90397 11.0173 1.65432 9.76224C1.40468 8.50718 1.5328 7.20628 2.0225 6.02404C2.5122 4.8418 3.34148 3.83133 4.40546 3.1204Z" - }); - const path = setAttributesNS(createElementNS("path"), { - d: "M6.68775 12.4297C6.78586 12.4745 6.89218 12.4984 7 12.5C7.11275 12.4955 7.22315 12.4664 7.32337 12.4145C7.4236 12.3627 7.51121 12.2894 7.58 12.2L12 5.63999C12.0848 5.47724 12.1071 5.28902 12.0625 5.11098C12.0178 4.93294 11.9095 4.77744 11.7579 4.67392C11.6064 4.57041 11.4221 4.52608 11.24 4.54931C11.0579 4.57254 10.8907 4.66173 10.77 4.79999L6.88 10.57L5.13 8.56999C5.06508 8.49566 4.98613 8.43488 4.89768 8.39111C4.80922 8.34735 4.713 8.32148 4.61453 8.31498C4.51605 8.30847 4.41727 8.32147 4.32382 8.35322C4.23038 8.38497 4.14413 8.43484 4.07 8.49999C3.92511 8.63217 3.83692 8.81523 3.82387 9.01092C3.81083 9.2066 3.87393 9.39976 4 9.54999L6.43 12.24C6.50187 12.3204 6.58964 12.385 6.68775 12.4297Z" - }); - svg.appendChild(g2).append(path, path2); - const speakerDefs = createElementNS("defs"); - const speakerClipPathDef = setAttributesNS(createElementNS("clipPath"), { - id: "clip0_57_156" - }); - const speakerRect = setAttributesNS(createElementNS("rect"), { - width: `${WIDTH}`, - height: `${WIDTH}`, - fill: "white", - transform: "translate(0 0.5)" - }); - speakerClipPathDef.appendChild(speakerRect); - speakerDefs.appendChild(speakerClipPathDef); - svg.appendChild(speakerDefs).appendChild(speakerClipPathDef).appendChild(speakerRect); - return svg; -} -__name(SuccessIcon, "SuccessIcon"); -function Dialog({ open: open2, onFormSubmitted, ...props }) { - const options4 = props.options; - const successIconHtml = q(() => ({ __html: SuccessIcon().outerHTML }), []); - const [timeoutId, setTimeoutId] = p$2(null); - const handleOnSuccessClick = x(() => { - if (timeoutId) { - clearTimeout(timeoutId); - setTimeoutId(null); - } - onFormSubmitted(); - }, [timeoutId]); - const onSubmitSuccess = x( - (data26) => { - props.onSubmitSuccess(data26); - setTimeoutId( - setTimeout(() => { - onFormSubmitted(); - setTimeoutId(null); - }, SUCCESS_MESSAGE_TIMEOUT) - ); - }, - [onFormSubmitted] - ); - return y$1( - g$1$1, - null, - timeoutId ? y$1( - "div", - { class: "success__position", onClick: handleOnSuccessClick }, - y$1( - "div", - { class: "success__content" }, - options4.successMessageText, - y$1("span", { class: "success__icon", dangerouslySetInnerHTML: successIconHtml }) - ) - ) : y$1( - "dialog", - { class: "dialog", onClick: options4.onFormClose, open: open2 }, - y$1( - "div", - { class: "dialog__position" }, - y$1( - "div", - { - class: "dialog__content", - onClick: /* @__PURE__ */ __name((e2) => { - e2.stopPropagation(); - }, "onClick") - }, - y$1(DialogHeader, { options: options4 }), - y$1(Form, { ...props, onSubmitSuccess }) - ) - ) - ) - ); -} -__name(Dialog, "Dialog"); -const DIALOG = ` -.dialog { - position: fixed; - z-index: var(--z-index); - margin: 0; - inset: 0; - - display: flex; - align-items: center; - justify-content: center; - padding: 0; - height: 100vh; - width: 100vw; - - color: var(--dialog-color, var(--foreground)); - fill: var(--dialog-color, var(--foreground)); - line-height: 1.75em; - - background-color: rgba(0, 0, 0, 0.05); - border: none; - inset: 0; - opacity: 1; - transition: opacity 0.2s ease-in-out; -} - -.dialog__position { - position: fixed; - z-index: var(--z-index); - inset: var(--dialog-inset); - padding: var(--page-margin); - display: flex; - max-height: calc(100vh - (2 * var(--page-margin))); -} -@media (max-width: 600px) { - .dialog__position { - inset: var(--page-margin); - padding: 0; - } -} - -.dialog__position:has(.editor) { - inset: var(--page-margin); - padding: 0; -} - -.dialog:not([open]) { - opacity: 0; - pointer-events: none; - visibility: hidden; -} -.dialog:not([open]) .dialog__content { - transform: translate(0, -16px) scale(0.98); -} - -.dialog__content { - display: flex; - flex-direction: column; - gap: 16px; - padding: var(--dialog-padding, 24px); - max-width: 100%; - width: 100%; - max-height: 100%; - overflow: auto; - - background: var(--dialog-background, var(--background)); - border-radius: var(--dialog-border-radius, 20px); - border: var(--dialog-border, var(--border)); - box-shadow: var(--dialog-box-shadow, var(--box-shadow)); - transform: translate(0, 0) scale(1); - transition: transform 0.2s ease-in-out; -} - -`; -const DIALOG_HEADER = ` -.dialog__header { - display: flex; - gap: 4px; - justify-content: space-between; - font-weight: var(--dialog-header-weight, 600); - margin: 0; -} -.dialog__title { - align-self: center; - width: var(--form-width, 272px); -} - -@media (max-width: 600px) { - .dialog__title { - width: auto; - } -} - -.dialog__position:has(.editor) .dialog__title { - width: auto; -} - - -.brand-link { - display: inline-flex; -} -.brand-link:focus-visible { - outline: var(--outline); -} -`; -const FORM = ` -.form { - display: flex; - overflow: auto; - flex-direction: row; - gap: 16px; - flex: 1 0; -} - -.form__right { - flex: 0 0 auto; - display: flex; - overflow: auto; - flex-direction: column; - justify-content: space-between; - gap: 20px; - width: var(--form-width, 100%); -} - -.dialog__position:has(.editor) .form__right { - width: var(--form-width, 272px); -} - -.form__top { - display: flex; - flex-direction: column; - gap: 8px; -} - -.form__error-container { - color: var(--error-color); - fill: var(--error-color); -} - -.form__label { - display: flex; - flex-direction: column; - gap: 4px; - margin: 0px; -} - -.form__label__text { - display: flex; - gap: 4px; - align-items: center; -} - -.form__label__text--required { - font-size: 0.85em; -} - -.form__input { - font-family: inherit; - line-height: inherit; - background: transparent; - box-sizing: border-box; - border: var(--input-border, var(--border)); - border-radius: var(--input-border-radius, 6px); - color: var(--input-color, inherit); - fill: var(--input-color, inherit); - font-size: var(--input-font-size, inherit); - font-weight: var(--input-font-weight, 500); - padding: 6px 12px; -} - -.form__input::placeholder { - opacity: 0.65; - color: var(--input-placeholder-color, inherit); - filter: var(--interactive-filter); -} - -.form__input:focus-visible { - outline: var(--input-focus-outline, var(--outline)); -} - -.form__input--textarea { - font-family: inherit; - resize: vertical; -} - -.error { - color: var(--error-color); - fill: var(--error-color); -} -`; -const BUTTON = ` -.btn-group { - display: grid; - gap: 8px; -} - -.btn { - line-height: inherit; - border: var(--button-border, var(--border)); - border-radius: var(--button-border-radius, 6px); - cursor: pointer; - font-family: inherit; - font-size: var(--button-font-size, inherit); - font-weight: var(--button-font-weight, 600); - padding: var(--button-padding, 6px 16px); -} -.btn[disabled] { - opacity: 0.6; - pointer-events: none; -} - -.btn--primary { - color: var(--button-primary-color, var(--accent-foreground)); - fill: var(--button-primary-color, var(--accent-foreground)); - background: var(--button-primary-background, var(--accent-background)); - border: var(--button-primary-border, var(--border)); - border-radius: var(--button-primary-border-radius, 6px); - font-weight: var(--button-primary-font-weight, 500); -} -.btn--primary:hover { - color: var(--button-primary-hover-color, var(--accent-foreground)); - fill: var(--button-primary-hover-color, var(--accent-foreground)); - background: var(--button-primary-hover-background, var(--accent-background)); - filter: var(--interactive-filter); -} -.btn--primary:focus-visible { - background: var(--button-primary-hover-background, var(--accent-background)); - filter: var(--interactive-filter); - outline: var(--button-primary-focus-outline, var(--outline)); -} - -.btn--default { - color: var(--button-color, var(--foreground)); - fill: var(--button-color, var(--foreground)); - background: var(--button-background, var(--background)); - border: var(--button-border, var(--border)); - border-radius: var(--button-border-radius, 6px); - font-weight: var(--button-font-weight, 500); -} -.btn--default:hover { - color: var(--button-color, var(--foreground)); - fill: var(--button-color, var(--foreground)); - background: var(--button-hover-background, var(--background)); - filter: var(--interactive-filter); -} -.btn--default:focus-visible { - background: var(--button-hover-background, var(--background)); - filter: var(--interactive-filter); - outline: var(--button-focus-outline, var(--outline)); -} -`; -const SUCCESS = ` -.success__position { - position: fixed; - inset: var(--dialog-inset); - padding: var(--page-margin); - z-index: var(--z-index); -} -.success__content { - background: var(--success-background, var(--background)); - border: var(--success-border, var(--border)); - border-radius: var(--success-border-radius, 1.7em/50%); - box-shadow: var(--success-box-shadow, var(--box-shadow)); - font-weight: var(--success-font-weight, 600); - color: var(--success-color); - fill: var(--success-color); - padding: 12px 24px; - line-height: 1.75em; - - display: grid; - align-items: center; - grid-auto-flow: column; - gap: 6px; - cursor: default; -} - -.success__icon { - display: flex; -} -`; -function createDialogStyles(styleNonce) { - const style2 = DOCUMENT.createElement("style"); - style2.textContent = ` -:host { - --dialog-inset: var(--inset); -} - -${DIALOG} -${DIALOG_HEADER} -${FORM} -${BUTTON} -${SUCCESS} -`; - if (styleNonce) { - style2.setAttribute("nonce", styleNonce); - } - return style2; -} -__name(createDialogStyles, "createDialogStyles"); -function getUser() { - const currentUser = getCurrentScope$1().getUser(); - const isolationUser = getIsolationScope().getUser(); - const globalUser = getGlobalScope().getUser(); - if (currentUser && Object.keys(currentUser).length) { - return currentUser; - } - if (isolationUser && Object.keys(isolationUser).length) { - return isolationUser; - } - return globalUser; -} -__name(getUser, "getUser"); -const feedbackModalIntegration = /* @__PURE__ */ __name(() => { - return { - name: "FeedbackModal", - // eslint-disable-next-line @typescript-eslint/no-empty-function - setupOnce() { - }, - createDialog: /* @__PURE__ */ __name(({ options: options4, screenshotIntegration, sendFeedback: sendFeedback2, shadow }) => { - const shadowRoot = shadow; - const userKey = options4.useSentryUser; - const user = getUser(); - const el = DOCUMENT.createElement("div"); - const style2 = createDialogStyles(options4.styleNonce); - let originalOverflow = ""; - const dialog = { - get el() { - return el; - }, - appendToDom() { - if (!shadowRoot.contains(style2) && !shadowRoot.contains(el)) { - shadowRoot.appendChild(style2); - shadowRoot.appendChild(el); - } - }, - removeFromDom() { - shadowRoot.removeChild(el); - shadowRoot.removeChild(style2); - DOCUMENT.body.style.overflow = originalOverflow; - }, - open() { - renderContent(true); - options4.onFormOpen && options4.onFormOpen(); - originalOverflow = DOCUMENT.body.style.overflow; - DOCUMENT.body.style.overflow = "hidden"; - }, - close() { - renderContent(false); - DOCUMENT.body.style.overflow = originalOverflow; - } - }; - const screenshotInput = screenshotIntegration && screenshotIntegration.createInput({ h: y$1, hooks, dialog, options: options4 }); - const renderContent = /* @__PURE__ */ __name((open2) => { - B$1( - y$1( - Dialog, - { - options: options4, - screenshotInput, - showName: options4.showName || options4.isNameRequired, - showEmail: options4.showEmail || options4.isEmailRequired, - defaultName: userKey && user && user[userKey.name] || "", - defaultEmail: userKey && user && user[userKey.email] || "", - onFormClose: /* @__PURE__ */ __name(() => { - renderContent(false); - options4.onFormClose && options4.onFormClose(); - }, "onFormClose"), - onSubmit: sendFeedback2, - onSubmitSuccess: /* @__PURE__ */ __name((data26) => { - renderContent(false); - options4.onSubmitSuccess && options4.onSubmitSuccess(data26); - }, "onSubmitSuccess"), - onSubmitError: /* @__PURE__ */ __name((error2) => { - options4.onSubmitError && options4.onSubmitError(error2); - }, "onSubmitError"), - onFormSubmitted: /* @__PURE__ */ __name(() => { - options4.onFormSubmitted && options4.onFormSubmitted(); - }, "onFormSubmitted"), - open: open2 - } - ), - el - ); - }, "renderContent"); - return dialog; - }, "createDialog") - }; -}, "feedbackModalIntegration"); -function CropCornerFactory({ - h: h2 - // eslint-disable-line @typescript-eslint/no-unused-vars -}) { - return /* @__PURE__ */ __name(function CropCorner({ - top, - left, - corner, - onGrabButton - }) { - return h2( - "button", - { - class: `editor__crop-corner editor__crop-corner--${corner} `, - style: { - top, - left - }, - onMouseDown: /* @__PURE__ */ __name((e2) => { - e2.preventDefault(); - onGrabButton(e2, corner); - }, "onMouseDown"), - onClick: /* @__PURE__ */ __name((e2) => { - e2.preventDefault(); - }, "onClick") - } - ); - }, "CropCorner"); -} -__name(CropCornerFactory, "CropCornerFactory"); -function createScreenshotInputStyles(styleNonce) { - const style2 = DOCUMENT.createElement("style"); - const surface200 = "#1A141F"; - const gray100 = "#302735"; - style2.textContent = ` -.editor { - padding: 10px; - padding-top: 65px; - padding-bottom: 65px; - flex-grow: 1; - - background-color: ${surface200}; - background-image: repeating-linear-gradient( - -145deg, - transparent, - transparent 8px, - ${surface200} 8px, - ${surface200} 11px - ), - repeating-linear-gradient( - -45deg, - transparent, - transparent 15px, - ${gray100} 15px, - ${gray100} 16px - ); -} - -.editor__canvas-container { - width: 100%; - height: 100%; - position: relative; - display: flex; - align-items: center; - justify-content: center; -} - -.editor__canvas-container canvas { - object-fit: contain; - position: relative; -} - -.editor__crop-btn-group { - padding: 8px; - gap: 8px; - border-radius: var(--menu-border-radius, 6px); - background: var(--button-primary-background, var(--background)); - width: 175px; - position: absolute; -} - -.editor__crop-corner { - width: 30px; - height: 30px; - position: absolute; - background: none; - border: 3px solid #ffffff; -} - -.editor__crop-corner--top-left { - cursor: nwse-resize; - border-right: none; - border-bottom: none; -} -.editor__crop-corner--top-right { - cursor: nesw-resize; - border-left: none; - border-bottom: none; -} -.editor__crop-corner--bottom-left { - cursor: nesw-resize; - border-right: none; - border-top: none; -} -.editor__crop-corner--bottom-right { - cursor: nwse-resize; - border-left: none; - border-top: none; -} -`; - if (styleNonce) { - style2.setAttribute("nonce", styleNonce); - } - return style2; -} -__name(createScreenshotInputStyles, "createScreenshotInputStyles"); -function useTakeScreenshotFactory({ hooks: hooks2 }) { - return /* @__PURE__ */ __name(function useTakeScreenshot({ onBeforeScreenshot, onScreenshot, onAfterScreenshot, onError }) { - hooks2.useEffect(() => { - const takeScreenshot = /* @__PURE__ */ __name(async () => { - onBeforeScreenshot(); - const stream = await NAVIGATOR.mediaDevices.getDisplayMedia({ - video: { - width: WINDOW.innerWidth * WINDOW.devicePixelRatio, - height: WINDOW.innerHeight * WINDOW.devicePixelRatio - }, - audio: false, - // @ts-expect-error experimental flags: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia#prefercurrenttab - monitorTypeSurfaces: "exclude", - preferCurrentTab: true, - selfBrowserSurface: "include", - surfaceSwitching: "exclude" - }); - const video = DOCUMENT.createElement("video"); - await new Promise((resolve2, reject3) => { - video.srcObject = stream; - video.onloadedmetadata = () => { - onScreenshot(video); - stream.getTracks().forEach((track2) => track2.stop()); - resolve2(); - }; - video.play().catch(reject3); - }); - onAfterScreenshot(); - }, "takeScreenshot"); - takeScreenshot().catch(onError); - }, []); - }, "useTakeScreenshot"); -} -__name(useTakeScreenshotFactory, "useTakeScreenshotFactory"); -const CROP_BUTTON_SIZE = 30; -const CROP_BUTTON_BORDER = 3; -const CROP_BUTTON_OFFSET = CROP_BUTTON_SIZE + CROP_BUTTON_BORDER; -const DPI = WINDOW.devicePixelRatio; -const constructRect = /* @__PURE__ */ __name((box) => { - return { - x: Math.min(box.startX, box.endX), - y: Math.min(box.startY, box.endY), - width: Math.abs(box.startX - box.endX), - height: Math.abs(box.startY - box.endY) - }; -}, "constructRect"); -const getContainedSize = /* @__PURE__ */ __name((img) => { - const imgClientHeight = img.clientHeight; - const imgClientWidth = img.clientWidth; - const ratio = img.width / img.height; - let width2 = imgClientHeight * ratio; - let height = imgClientHeight; - if (width2 > imgClientWidth) { - width2 = imgClientWidth; - height = imgClientWidth / ratio; - } - const x2 = (imgClientWidth - width2) / 2; - const y2 = (imgClientHeight - height) / 2; - return { startX: x2, startY: y2, endX: width2 + x2, endY: height + y2 }; -}, "getContainedSize"); -function ScreenshotEditorFactory({ - h: h2, - hooks: hooks2, - imageBuffer, - dialog, - options: options4 -}) { - const useTakeScreenshot = useTakeScreenshotFactory({ hooks: hooks2 }); - return /* @__PURE__ */ __name(function ScreenshotEditor({ onError }) { - const styles = hooks2.useMemo(() => ({ __html: createScreenshotInputStyles(options4.styleNonce).innerText }), []); - const CropCorner = CropCornerFactory({ h: h2 }); - const canvasContainerRef = hooks2.useRef(null); - const cropContainerRef = hooks2.useRef(null); - const croppingRef = hooks2.useRef(null); - const [croppingRect, setCroppingRect] = hooks2.useState({ startX: 0, startY: 0, endX: 0, endY: 0 }); - const [confirmCrop, setConfirmCrop] = hooks2.useState(false); - const [isResizing, setIsResizing] = hooks2.useState(false); - hooks2.useEffect(() => { - WINDOW.addEventListener("resize", resizeCropper, false); - }, []); - function resizeCropper() { - const cropper = croppingRef.current; - const imageDimensions = constructRect(getContainedSize(imageBuffer)); - if (cropper) { - cropper.width = imageDimensions.width * DPI; - cropper.height = imageDimensions.height * DPI; - cropper.style.width = `${imageDimensions.width}px`; - cropper.style.height = `${imageDimensions.height}px`; - const ctx = cropper.getContext("2d"); - if (ctx) { - ctx.scale(DPI, DPI); - } - } - const cropButton = cropContainerRef.current; - if (cropButton) { - cropButton.style.width = `${imageDimensions.width}px`; - cropButton.style.height = `${imageDimensions.height}px`; - } - setCroppingRect({ startX: 0, startY: 0, endX: imageDimensions.width, endY: imageDimensions.height }); - } - __name(resizeCropper, "resizeCropper"); - hooks2.useEffect(() => { - const cropper = croppingRef.current; - if (!cropper) { - return; - } - const ctx = cropper.getContext("2d"); - if (!ctx) { - return; - } - const imageDimensions = constructRect(getContainedSize(imageBuffer)); - const croppingBox = constructRect(croppingRect); - ctx.clearRect(0, 0, imageDimensions.width, imageDimensions.height); - ctx.fillStyle = "rgba(0, 0, 0, 0.5)"; - ctx.fillRect(0, 0, imageDimensions.width, imageDimensions.height); - ctx.clearRect(croppingBox.x, croppingBox.y, croppingBox.width, croppingBox.height); - ctx.strokeStyle = "#ffffff"; - ctx.lineWidth = 3; - ctx.strokeRect(croppingBox.x + 1, croppingBox.y + 1, croppingBox.width - 2, croppingBox.height - 2); - ctx.strokeStyle = "#000000"; - ctx.lineWidth = 1; - ctx.strokeRect(croppingBox.x + 3, croppingBox.y + 3, croppingBox.width - 6, croppingBox.height - 6); - }, [croppingRect]); - function onGrabButton(e2, corner) { - setConfirmCrop(false); - setIsResizing(true); - const handleMouseMove2 = makeHandleMouseMove(corner); - const handleMouseUp = /* @__PURE__ */ __name(() => { - DOCUMENT.removeEventListener("mousemove", handleMouseMove2); - DOCUMENT.removeEventListener("mouseup", handleMouseUp); - setConfirmCrop(true); - setIsResizing(false); - }, "handleMouseUp"); - DOCUMENT.addEventListener("mouseup", handleMouseUp); - DOCUMENT.addEventListener("mousemove", handleMouseMove2); - } - __name(onGrabButton, "onGrabButton"); - const makeHandleMouseMove = hooks2.useCallback((corner) => { - return function(e2) { - if (!croppingRef.current) { - return; - } - const cropCanvas = croppingRef.current; - const cropBoundingRect = cropCanvas.getBoundingClientRect(); - const mouseX = e2.clientX - cropBoundingRect.x; - const mouseY = e2.clientY - cropBoundingRect.y; - switch (corner) { - case "top-left": - setCroppingRect((prev2) => ({ - ...prev2, - startX: Math.min(Math.max(0, mouseX), prev2.endX - CROP_BUTTON_OFFSET), - startY: Math.min(Math.max(0, mouseY), prev2.endY - CROP_BUTTON_OFFSET) - })); - break; - case "top-right": - setCroppingRect((prev2) => ({ - ...prev2, - endX: Math.max(Math.min(mouseX, cropCanvas.width / DPI), prev2.startX + CROP_BUTTON_OFFSET), - startY: Math.min(Math.max(0, mouseY), prev2.endY - CROP_BUTTON_OFFSET) - })); - break; - case "bottom-left": - setCroppingRect((prev2) => ({ - ...prev2, - startX: Math.min(Math.max(0, mouseX), prev2.endX - CROP_BUTTON_OFFSET), - endY: Math.max(Math.min(mouseY, cropCanvas.height / DPI), prev2.startY + CROP_BUTTON_OFFSET) - })); - break; - case "bottom-right": - setCroppingRect((prev2) => ({ - ...prev2, - endX: Math.max(Math.min(mouseX, cropCanvas.width / DPI), prev2.startX + CROP_BUTTON_OFFSET), - endY: Math.max(Math.min(mouseY, cropCanvas.height / DPI), prev2.startY + CROP_BUTTON_OFFSET) - })); - break; - } - }; - }, []); - const initialPositionRef = hooks2.useRef({ initialX: 0, initialY: 0 }); - function onDragStart2(e2) { - if (isResizing) return; - initialPositionRef.current = { initialX: e2.clientX, initialY: e2.clientY }; - const handleMouseMove2 = /* @__PURE__ */ __name((moveEvent) => { - const cropCanvas = croppingRef.current; - if (!cropCanvas) return; - const deltaX = moveEvent.clientX - initialPositionRef.current.initialX; - const deltaY = moveEvent.clientY - initialPositionRef.current.initialY; - setCroppingRect((prev2) => { - const newStartX = Math.max( - 0, - Math.min(prev2.startX + deltaX, cropCanvas.width / DPI - (prev2.endX - prev2.startX)) - ); - const newStartY = Math.max( - 0, - Math.min(prev2.startY + deltaY, cropCanvas.height / DPI - (prev2.endY - prev2.startY)) - ); - const newEndX = newStartX + (prev2.endX - prev2.startX); - const newEndY = newStartY + (prev2.endY - prev2.startY); - initialPositionRef.current.initialX = moveEvent.clientX; - initialPositionRef.current.initialY = moveEvent.clientY; - return { - startX: newStartX, - startY: newStartY, - endX: newEndX, - endY: newEndY - }; - }); - }, "handleMouseMove"); - const handleMouseUp = /* @__PURE__ */ __name(() => { - DOCUMENT.removeEventListener("mousemove", handleMouseMove2); - DOCUMENT.removeEventListener("mouseup", handleMouseUp); - }, "handleMouseUp"); - DOCUMENT.addEventListener("mousemove", handleMouseMove2); - DOCUMENT.addEventListener("mouseup", handleMouseUp); - } - __name(onDragStart2, "onDragStart"); - function submit() { - const cutoutCanvas = DOCUMENT.createElement("canvas"); - const imageBox = constructRect(getContainedSize(imageBuffer)); - const croppingBox = constructRect(croppingRect); - cutoutCanvas.width = croppingBox.width * DPI; - cutoutCanvas.height = croppingBox.height * DPI; - const cutoutCtx = cutoutCanvas.getContext("2d"); - if (cutoutCtx && imageBuffer) { - cutoutCtx.drawImage( - imageBuffer, - croppingBox.x / imageBox.width * imageBuffer.width, - croppingBox.y / imageBox.height * imageBuffer.height, - croppingBox.width / imageBox.width * imageBuffer.width, - croppingBox.height / imageBox.height * imageBuffer.height, - 0, - 0, - cutoutCanvas.width, - cutoutCanvas.height - ); - } - const ctx = imageBuffer.getContext("2d"); - if (ctx) { - ctx.clearRect(0, 0, imageBuffer.width, imageBuffer.height); - imageBuffer.width = cutoutCanvas.width; - imageBuffer.height = cutoutCanvas.height; - imageBuffer.style.width = `${croppingBox.width}px`; - imageBuffer.style.height = `${croppingBox.height}px`; - ctx.drawImage(cutoutCanvas, 0, 0); - resizeCropper(); - } - } - __name(submit, "submit"); - useTakeScreenshot({ - onBeforeScreenshot: hooks2.useCallback(() => { - dialog.el.style.display = "none"; - }, []), - onScreenshot: hooks2.useCallback( - (imageSource) => { - const context = imageBuffer.getContext("2d"); - if (!context) { - throw new Error("Could not get canvas context"); - } - imageBuffer.width = imageSource.videoWidth; - imageBuffer.height = imageSource.videoHeight; - imageBuffer.style.width = "100%"; - imageBuffer.style.height = "100%"; - context.drawImage(imageSource, 0, 0); - }, - [imageBuffer] - ), - onAfterScreenshot: hooks2.useCallback(() => { - dialog.el.style.display = "block"; - const container = canvasContainerRef.current; - container && container.appendChild(imageBuffer); - resizeCropper(); - }, []), - onError: hooks2.useCallback((error2) => { - dialog.el.style.display = "block"; - onError(error2); - }, []) - }); - return h2( - "div", - { class: "editor" }, - h2("style", { nonce: options4.styleNonce, dangerouslySetInnerHTML: styles }), - h2( - "div", - { class: "editor__canvas-container", ref: canvasContainerRef }, - h2( - "div", - { class: "editor__crop-container", style: { position: "absolute", zIndex: 1 }, ref: cropContainerRef }, - h2( - "canvas", - { - onMouseDown: onDragStart2, - style: { position: "absolute", cursor: confirmCrop ? "move" : "auto" }, - ref: croppingRef - } - ), - h2( - CropCorner, - { - left: croppingRect.startX - CROP_BUTTON_BORDER, - top: croppingRect.startY - CROP_BUTTON_BORDER, - onGrabButton, - corner: "top-left" - } - ), - h2( - CropCorner, - { - left: croppingRect.endX - CROP_BUTTON_SIZE + CROP_BUTTON_BORDER, - top: croppingRect.startY - CROP_BUTTON_BORDER, - onGrabButton, - corner: "top-right" - } - ), - h2( - CropCorner, - { - left: croppingRect.startX - CROP_BUTTON_BORDER, - top: croppingRect.endY - CROP_BUTTON_SIZE + CROP_BUTTON_BORDER, - onGrabButton, - corner: "bottom-left" - } - ), - h2( - CropCorner, - { - left: croppingRect.endX - CROP_BUTTON_SIZE + CROP_BUTTON_BORDER, - top: croppingRect.endY - CROP_BUTTON_SIZE + CROP_BUTTON_BORDER, - onGrabButton, - corner: "bottom-right" - } - ), - h2( - "div", - { - style: { - left: Math.max(0, croppingRect.endX - 191), - top: Math.max(0, croppingRect.endY + 8), - display: confirmCrop ? "flex" : "none" - }, - class: "editor__crop-btn-group" - }, - h2( - "button", - { - onClick: /* @__PURE__ */ __name((e2) => { - e2.preventDefault(); - if (croppingRef.current) { - setCroppingRect({ - startX: 0, - startY: 0, - endX: croppingRef.current.width / DPI, - endY: croppingRef.current.height / DPI - }); - } - setConfirmCrop(false); - }, "onClick"), - class: "btn btn--default" - }, - options4.cancelButtonLabel - ), - h2( - "button", - { - onClick: /* @__PURE__ */ __name((e2) => { - e2.preventDefault(); - submit(); - setConfirmCrop(false); - }, "onClick"), - class: "btn btn--primary" - }, - options4.confirmButtonLabel - ) - ) - ) - ) - ); - }, "ScreenshotEditor"); -} -__name(ScreenshotEditorFactory, "ScreenshotEditorFactory"); -const feedbackScreenshotIntegration = /* @__PURE__ */ __name(() => { - return { - name: "FeedbackScreenshot", - // eslint-disable-next-line @typescript-eslint/no-empty-function - setupOnce() { - }, - createInput: /* @__PURE__ */ __name(({ h: h2, hooks: hooks2, dialog, options: options4 }) => { - const imageBuffer = DOCUMENT.createElement("canvas"); - return { - input: ScreenshotEditorFactory({ - h: h2, - hooks: hooks2, - imageBuffer, - dialog, - options: options4 - }), - // eslint-disable-line @typescript-eslint/no-explicit-any - value: /* @__PURE__ */ __name(async () => { - const blob = await new Promise((resolve2) => { - imageBuffer.toBlob(resolve2, "image/png"); - }); - if (blob) { - const data26 = new Uint8Array(await blob.arrayBuffer()); - const attachment = { - data: data26, - filename: "screenshot.png", - contentType: "application/png" - // attachmentType?: string; - }; - return attachment; - } - return void 0; - }, "value") - }; - }, "createInput") - }; -}, "feedbackScreenshotIntegration"); -const feedbackAsyncIntegration = buildFeedbackIntegration({ - lazyLoadIntegration -}); -const feedbackSyncIntegration = buildFeedbackIntegration({ - getModalIntegration: /* @__PURE__ */ __name(() => feedbackModalIntegration, "getModalIntegration"), - getScreenshotIntegration: /* @__PURE__ */ __name(() => feedbackScreenshotIntegration, "getScreenshotIntegration") -}); -function increment(name2, value4 = 1, data26) { - metrics$1.increment(BrowserMetricsAggregator, name2, value4, data26); -} -__name(increment, "increment"); -function distribution(name2, value4, data26) { - metrics$1.distribution(BrowserMetricsAggregator, name2, value4, data26); -} -__name(distribution, "distribution"); -function set$4(name2, value4, data26) { - metrics$1.set(BrowserMetricsAggregator, name2, value4, data26); -} -__name(set$4, "set$4"); -function gauge(name2, value4, data26) { - metrics$1.gauge(BrowserMetricsAggregator, name2, value4, data26); -} -__name(gauge, "gauge"); -function timing(name2, value4, unit = "second", data26) { - return metrics$1.timing(BrowserMetricsAggregator, name2, value4, unit, data26); -} -__name(timing, "timing"); -const metrics = { - increment, - distribution, - set: set$4, - gauge, - timing -}; -const responseToSpanId = /* @__PURE__ */ new WeakMap(); -const spanIdToEndTimestamp = /* @__PURE__ */ new Map(); -const defaultRequestInstrumentationOptions = { - traceFetch: true, - traceXHR: true, - enableHTTPTimings: true, - trackFetchStreamPerformance: false -}; -function instrumentOutgoingRequests(client, _options) { - const { - traceFetch, - traceXHR, - trackFetchStreamPerformance, - shouldCreateSpanForRequest, - enableHTTPTimings, - tracePropagationTargets - } = { - traceFetch: defaultRequestInstrumentationOptions.traceFetch, - traceXHR: defaultRequestInstrumentationOptions.traceXHR, - trackFetchStreamPerformance: defaultRequestInstrumentationOptions.trackFetchStreamPerformance, - ..._options - }; - const shouldCreateSpan = typeof shouldCreateSpanForRequest === "function" ? shouldCreateSpanForRequest : (_2) => true; - const shouldAttachHeadersWithTargets = /* @__PURE__ */ __name((url) => shouldAttachHeaders(url, tracePropagationTargets), "shouldAttachHeadersWithTargets"); - const spans = {}; - if (traceFetch) { - client.addEventProcessor((event) => { - if (event.type === "transaction" && event.spans) { - event.spans.forEach((span) => { - if (span.op === "http.client") { - const updatedTimestamp = spanIdToEndTimestamp.get(span.span_id); - if (updatedTimestamp) { - span.timestamp = updatedTimestamp / 1e3; - spanIdToEndTimestamp.delete(span.span_id); - } - } - }); - } - return event; - }); - if (trackFetchStreamPerformance) { - addFetchEndInstrumentationHandler((handlerData) => { - if (handlerData.response) { - const span = responseToSpanId.get(handlerData.response); - if (span && handlerData.endTimestamp) { - spanIdToEndTimestamp.set(span, handlerData.endTimestamp); - } - } - }); - } - addFetchInstrumentationHandler((handlerData) => { - const createdSpan = instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans); - if (handlerData.response && handlerData.fetchData.__span) { - responseToSpanId.set(handlerData.response, handlerData.fetchData.__span); - } - if (createdSpan) { - const fullUrl = getFullURL(handlerData.fetchData.url); - const host = fullUrl ? parseUrl$1(fullUrl).host : void 0; - createdSpan.setAttributes({ - "http.url": fullUrl, - "server.address": host - }); - } - if (enableHTTPTimings && createdSpan) { - addHTTPTimings(createdSpan); - } - }); - } - if (traceXHR) { - addXhrInstrumentationHandler((handlerData) => { - const createdSpan = xhrCallback(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans); - if (enableHTTPTimings && createdSpan) { - addHTTPTimings(createdSpan); - } - }); - } -} -__name(instrumentOutgoingRequests, "instrumentOutgoingRequests"); -function isPerformanceResourceTiming(entry) { - return entry.entryType === "resource" && "initiatorType" in entry && typeof entry.nextHopProtocol === "string" && (entry.initiatorType === "fetch" || entry.initiatorType === "xmlhttprequest"); -} -__name(isPerformanceResourceTiming, "isPerformanceResourceTiming"); -function addHTTPTimings(span) { - const { url } = spanToJSON(span).data || {}; - if (!url || typeof url !== "string") { - return; - } - const cleanup = addPerformanceInstrumentationHandler("resource", ({ entries }) => { - entries.forEach((entry) => { - if (isPerformanceResourceTiming(entry) && entry.name.endsWith(url)) { - const spanData = resourceTimingEntryToSpanData(entry); - spanData.forEach((data26) => span.setAttribute(...data26)); - setTimeout(cleanup); - } - }); - }); -} -__name(addHTTPTimings, "addHTTPTimings"); -function extractNetworkProtocol(nextHopProtocol) { - let name2 = "unknown"; - let version2 = "unknown"; - let _name = ""; - for (const char of nextHopProtocol) { - if (char === "/") { - [name2, version2] = nextHopProtocol.split("/"); - break; - } - if (!isNaN(Number(char))) { - name2 = _name === "h" ? "http" : _name; - version2 = nextHopProtocol.split(_name)[1]; - break; - } - _name += char; - } - if (_name === nextHopProtocol) { - name2 = _name; - } - return { name: name2, version: version2 }; -} -__name(extractNetworkProtocol, "extractNetworkProtocol"); -function getAbsoluteTime(time = 0) { - return ((browserPerformanceTimeOrigin || performance.timeOrigin) + time) / 1e3; -} -__name(getAbsoluteTime, "getAbsoluteTime"); -function resourceTimingEntryToSpanData(resourceTiming) { - const { name: name2, version: version2 } = extractNetworkProtocol(resourceTiming.nextHopProtocol); - const timingSpanData = []; - timingSpanData.push(["network.protocol.version", version2], ["network.protocol.name", name2]); - if (!browserPerformanceTimeOrigin) { - return timingSpanData; - } - return [ - ...timingSpanData, - ["http.request.redirect_start", getAbsoluteTime(resourceTiming.redirectStart)], - ["http.request.fetch_start", getAbsoluteTime(resourceTiming.fetchStart)], - ["http.request.domain_lookup_start", getAbsoluteTime(resourceTiming.domainLookupStart)], - ["http.request.domain_lookup_end", getAbsoluteTime(resourceTiming.domainLookupEnd)], - ["http.request.connect_start", getAbsoluteTime(resourceTiming.connectStart)], - ["http.request.secure_connection_start", getAbsoluteTime(resourceTiming.secureConnectionStart)], - ["http.request.connection_end", getAbsoluteTime(resourceTiming.connectEnd)], - ["http.request.request_start", getAbsoluteTime(resourceTiming.requestStart)], - ["http.request.response_start", getAbsoluteTime(resourceTiming.responseStart)], - ["http.request.response_end", getAbsoluteTime(resourceTiming.responseEnd)] - ]; -} -__name(resourceTimingEntryToSpanData, "resourceTimingEntryToSpanData"); -function shouldAttachHeaders(targetUrl, tracePropagationTargets) { - const href = WINDOW$5.location && WINDOW$5.location.href; - if (!href) { - const isRelativeSameOriginRequest = !!targetUrl.match(/^\/(?!\/)/); - if (!tracePropagationTargets) { - return isRelativeSameOriginRequest; - } else { - return stringMatchesSomePattern(targetUrl, tracePropagationTargets); - } - } else { - let resolvedUrl; - let currentOrigin; - try { - resolvedUrl = new URL(targetUrl, href); - currentOrigin = new URL(href).origin; - } catch (e2) { - return false; - } - const isSameOriginRequest = resolvedUrl.origin === currentOrigin; - if (!tracePropagationTargets) { - return isSameOriginRequest; - } else { - return stringMatchesSomePattern(resolvedUrl.toString(), tracePropagationTargets) || isSameOriginRequest && stringMatchesSomePattern(resolvedUrl.pathname, tracePropagationTargets); - } - } -} -__name(shouldAttachHeaders, "shouldAttachHeaders"); -function xhrCallback(handlerData, shouldCreateSpan, shouldAttachHeaders2, spans) { - const xhr = handlerData.xhr; - const sentryXhrData = xhr && xhr[SENTRY_XHR_DATA_KEY]; - if (!xhr || xhr.__sentry_own_request__ || !sentryXhrData) { - return void 0; - } - const shouldCreateSpanResult = hasTracingEnabled() && shouldCreateSpan(sentryXhrData.url); - if (handlerData.endTimestamp && shouldCreateSpanResult) { - const spanId = xhr.__sentry_xhr_span_id__; - if (!spanId) return; - const span2 = spans[spanId]; - if (span2 && sentryXhrData.status_code !== void 0) { - setHttpStatus(span2, sentryXhrData.status_code); - span2.end(); - delete spans[spanId]; - } - return void 0; - } - const fullUrl = getFullURL(sentryXhrData.url); - const host = fullUrl ? parseUrl$1(fullUrl).host : void 0; - const hasParent = !!getActiveSpan(); - const span = shouldCreateSpanResult && hasParent ? startInactiveSpan({ - name: `${sentryXhrData.method} ${sentryXhrData.url}`, - attributes: { - type: "xhr", - "http.method": sentryXhrData.method, - "http.url": fullUrl, - url: sentryXhrData.url, - "server.address": host, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.browser", - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: "http.client" - } - }) : new SentryNonRecordingSpan(); - xhr.__sentry_xhr_span_id__ = span.spanContext().spanId; - spans[xhr.__sentry_xhr_span_id__] = span; - if (shouldAttachHeaders2(sentryXhrData.url)) { - addTracingHeadersToXhrRequest( - xhr, - // If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction), - // we do not want to use the span as base for the trace headers, - // which means that the headers will be generated from the scope and the sampling decision is deferred - hasTracingEnabled() && hasParent ? span : void 0 - ); - } - return span; -} -__name(xhrCallback, "xhrCallback"); -function addTracingHeadersToXhrRequest(xhr, span) { - const { "sentry-trace": sentryTrace, baggage } = getTraceData({ span }); - if (sentryTrace) { - setHeaderOnXhr(xhr, sentryTrace, baggage); - } -} -__name(addTracingHeadersToXhrRequest, "addTracingHeadersToXhrRequest"); -function setHeaderOnXhr(xhr, sentryTraceHeader, sentryBaggageHeader) { - try { - xhr.setRequestHeader("sentry-trace", sentryTraceHeader); - if (sentryBaggageHeader) { - xhr.setRequestHeader("baggage", sentryBaggageHeader); - } - } catch (_2) { - } -} -__name(setHeaderOnXhr, "setHeaderOnXhr"); -function getFullURL(url) { - try { - const parsed = new URL(url, WINDOW$5.location.origin); - return parsed.href; - } catch (e2) { - return void 0; - } -} -__name(getFullURL, "getFullURL"); -function registerBackgroundTabDetection() { - if (WINDOW$5 && WINDOW$5.document) { - WINDOW$5.document.addEventListener("visibilitychange", () => { - const activeSpan = getActiveSpan(); - if (!activeSpan) { - return; - } - const rootSpan = getRootSpan(activeSpan); - if (WINDOW$5.document.hidden && rootSpan) { - const cancelledStatus = "cancelled"; - const { op, status } = spanToJSON(rootSpan); - if (DEBUG_BUILD$4) { - logger$2.log(`[Tracing] Transaction: ${cancelledStatus} -> since tab moved to the background, op: ${op}`); - } - if (!status) { - rootSpan.setStatus({ code: SPAN_STATUS_ERROR, message: cancelledStatus }); - } - rootSpan.setAttribute("sentry.cancellation_reason", "document.hidden"); - rootSpan.end(); - } - }); - } else { - DEBUG_BUILD$4 && logger$2.warn("[Tracing] Could not set up background tab detection due to lack of global document"); - } -} -__name(registerBackgroundTabDetection, "registerBackgroundTabDetection"); -const BROWSER_TRACING_INTEGRATION_ID = "BrowserTracing"; -const DEFAULT_BROWSER_TRACING_OPTIONS = { - ...TRACING_DEFAULTS, - instrumentNavigation: true, - instrumentPageLoad: true, - markBackgroundSpan: true, - enableLongTask: true, - enableLongAnimationFrame: true, - enableInp: true, - _experiments: {}, - ...defaultRequestInstrumentationOptions -}; -const browserTracingIntegration$1 = /* @__PURE__ */ __name((_options = {}) => { - registerSpanErrorInstrumentation(); - const { - enableInp, - enableLongTask, - enableLongAnimationFrame, - _experiments: { enableInteractions, enableStandaloneClsSpans }, - beforeStartSpan, - idleTimeout, - finalTimeout, - childSpanTimeout, - markBackgroundSpan, - traceFetch, - traceXHR, - trackFetchStreamPerformance, - shouldCreateSpanForRequest, - enableHTTPTimings, - instrumentPageLoad, - instrumentNavigation - } = { - ...DEFAULT_BROWSER_TRACING_OPTIONS, - ..._options - }; - const _collectWebVitals = startTrackingWebVitals({ recordClsStandaloneSpans: enableStandaloneClsSpans || false }); - if (enableInp) { - startTrackingINP(); - } - if (enableLongAnimationFrame && GLOBAL_OBJ.PerformanceObserver && PerformanceObserver.supportedEntryTypes && PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")) { - startTrackingLongAnimationFrames(); - } else if (enableLongTask) { - startTrackingLongTasks(); - } - if (enableInteractions) { - startTrackingInteractions(); - } - const latestRoute = { - name: void 0, - source: void 0 - }; - function _createRouteSpan(client, startSpanOptions) { - const isPageloadTransaction = startSpanOptions.op === "pageload"; - const finalStartSpanOptions = beforeStartSpan ? beforeStartSpan(startSpanOptions) : startSpanOptions; - const attributes = finalStartSpanOptions.attributes || {}; - if (startSpanOptions.name !== finalStartSpanOptions.name) { - attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = "custom"; - finalStartSpanOptions.attributes = attributes; - } - latestRoute.name = finalStartSpanOptions.name; - latestRoute.source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]; - const idleSpan = startIdleSpan(finalStartSpanOptions, { - idleTimeout, - finalTimeout, - childSpanTimeout, - // should wait for finish signal if it's a pageload transaction - disableAutoFinish: isPageloadTransaction, - beforeSpanEnd: /* @__PURE__ */ __name((span) => { - _collectWebVitals(); - addPerformanceEntries(span, { recordClsOnPageloadSpan: !enableStandaloneClsSpans }); - }, "beforeSpanEnd") - }); - function emitFinish() { - if (["interactive", "complete"].includes(WINDOW$5.document.readyState)) { - client.emit("idleSpanEnableAutoFinish", idleSpan); - } - } - __name(emitFinish, "emitFinish"); - if (isPageloadTransaction && WINDOW$5.document) { - WINDOW$5.document.addEventListener("readystatechange", () => { - emitFinish(); - }); - emitFinish(); - } - return idleSpan; - } - __name(_createRouteSpan, "_createRouteSpan"); - return { - name: BROWSER_TRACING_INTEGRATION_ID, - afterAllSetup(client) { - let activeSpan; - let startingUrl = WINDOW$5.location && WINDOW$5.location.href; - function maybeEndActiveSpan() { - if (activeSpan && !spanToJSON(activeSpan).timestamp) { - DEBUG_BUILD$4 && logger$2.log(`[Tracing] Finishing current active span with op: ${spanToJSON(activeSpan).op}`); - activeSpan.end(); - } - } - __name(maybeEndActiveSpan, "maybeEndActiveSpan"); - client.on("startNavigationSpan", (startSpanOptions) => { - if (getClient() !== client) { - return; - } - maybeEndActiveSpan(); - activeSpan = _createRouteSpan(client, { - op: "navigation", - ...startSpanOptions - }); - }); - client.on("startPageLoadSpan", (startSpanOptions, traceOptions = {}) => { - if (getClient() !== client) { - return; - } - maybeEndActiveSpan(); - const sentryTrace = traceOptions.sentryTrace || getMetaContent("sentry-trace"); - const baggage = traceOptions.baggage || getMetaContent("baggage"); - const propagationContext = propagationContextFromHeaders(sentryTrace, baggage); - getCurrentScope$1().setPropagationContext(propagationContext); - activeSpan = _createRouteSpan(client, { - op: "pageload", - ...startSpanOptions - }); - }); - client.on("spanEnd", (span) => { - const op = spanToJSON(span).op; - if (span !== getRootSpan(span) || op !== "navigation" && op !== "pageload") { - return; - } - const scope = getCurrentScope$1(); - const oldPropagationContext = scope.getPropagationContext(); - scope.setPropagationContext({ - ...oldPropagationContext, - sampled: oldPropagationContext.sampled !== void 0 ? oldPropagationContext.sampled : spanIsSampled(span), - dsc: oldPropagationContext.dsc || getDynamicSamplingContextFromSpan(span) - }); - }); - if (WINDOW$5.location) { - if (instrumentPageLoad) { - startBrowserTracingPageLoadSpan(client, { - name: WINDOW$5.location.pathname, - // pageload should always start at timeOrigin (and needs to be in s, not ms) - startTime: browserPerformanceTimeOrigin ? browserPerformanceTimeOrigin / 1e3 : void 0, - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "url", - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.pageload.browser" - } - }); - } - if (instrumentNavigation) { - addHistoryInstrumentationHandler(({ to, from: from2 }) => { - if (from2 === void 0 && startingUrl && startingUrl.indexOf(to) !== -1) { - startingUrl = void 0; - return; - } - if (from2 !== to) { - startingUrl = void 0; - startBrowserTracingNavigationSpan(client, { - name: WINDOW$5.location.pathname, - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: "url", - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.navigation.browser" - } - }); - } - }); - } - } - if (markBackgroundSpan) { - registerBackgroundTabDetection(); - } - if (enableInteractions) { - registerInteractionListener(idleTimeout, finalTimeout, childSpanTimeout, latestRoute); - } - if (enableInp) { - registerInpInteractionListener(); - } - instrumentOutgoingRequests(client, { - traceFetch, - traceXHR, - trackFetchStreamPerformance, - tracePropagationTargets: client.getOptions().tracePropagationTargets, - shouldCreateSpanForRequest, - enableHTTPTimings - }); - } - }; -}, "browserTracingIntegration$1"); -function startBrowserTracingPageLoadSpan(client, spanOptions, traceOptions) { - client.emit("startPageLoadSpan", spanOptions, traceOptions); - getCurrentScope$1().setTransactionName(spanOptions.name); - const span = getActiveSpan(); - const op = span && spanToJSON(span).op; - return op === "pageload" ? span : void 0; -} -__name(startBrowserTracingPageLoadSpan, "startBrowserTracingPageLoadSpan"); -function startBrowserTracingNavigationSpan(client, spanOptions) { - getIsolationScope().setPropagationContext({ traceId: generateTraceId() }); - getCurrentScope$1().setPropagationContext({ traceId: generateTraceId() }); - client.emit("startNavigationSpan", spanOptions); - getCurrentScope$1().setTransactionName(spanOptions.name); - const span = getActiveSpan(); - const op = span && spanToJSON(span).op; - return op === "navigation" ? span : void 0; -} -__name(startBrowserTracingNavigationSpan, "startBrowserTracingNavigationSpan"); -function getMetaContent(metaName) { - const metaTag = getDomElement(`meta[name=${metaName}]`); - return metaTag ? metaTag.getAttribute("content") : void 0; -} -__name(getMetaContent, "getMetaContent"); -function registerInteractionListener(idleTimeout, finalTimeout, childSpanTimeout, latestRoute) { - let inflightInteractionSpan; - const registerInteractionTransaction = /* @__PURE__ */ __name(() => { - const op = "ui.action.click"; - const activeSpan = getActiveSpan(); - const rootSpan = activeSpan && getRootSpan(activeSpan); - if (rootSpan) { - const currentRootSpanOp = spanToJSON(rootSpan).op; - if (["navigation", "pageload"].includes(currentRootSpanOp)) { - DEBUG_BUILD$4 && logger$2.warn(`[Tracing] Did not create ${op} span because a pageload or navigation span is in progress.`); - return void 0; - } - } - if (inflightInteractionSpan) { - inflightInteractionSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, "interactionInterrupted"); - inflightInteractionSpan.end(); - inflightInteractionSpan = void 0; - } - if (!latestRoute.name) { - DEBUG_BUILD$4 && logger$2.warn(`[Tracing] Did not create ${op} transaction because _latestRouteName is missing.`); - return void 0; - } - inflightInteractionSpan = startIdleSpan( - { - name: latestRoute.name, - op, - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: latestRoute.source || "url" - } - }, - { - idleTimeout, - finalTimeout, - childSpanTimeout - } - ); - }, "registerInteractionTransaction"); - if (WINDOW$5.document) { - addEventListener("click", registerInteractionTransaction, { once: false, capture: true }); - } -} -__name(registerInteractionListener, "registerInteractionListener"); -function promisifyRequest(request) { - return new Promise((resolve2, reject3) => { - request.oncomplete = request.onsuccess = () => resolve2(request.result); - request.onabort = request.onerror = () => reject3(request.error); - }); -} -__name(promisifyRequest, "promisifyRequest"); -function createStore(dbName, storeName) { - const request = indexedDB.open(dbName); - request.onupgradeneeded = () => request.result.createObjectStore(storeName); - const dbp = promisifyRequest(request); - return (callback) => dbp.then((db) => callback(db.transaction(storeName, "readwrite").objectStore(storeName))); -} -__name(createStore, "createStore"); -function keys$7(store) { - return promisifyRequest(store.getAllKeys()); -} -__name(keys$7, "keys$7"); -function push(store, value4, maxQueueSize) { - return store((store2) => { - return keys$7(store2).then((keys2) => { - if (keys2.length >= maxQueueSize) { - return; - } - store2.put(value4, Math.max(...keys2, 0) + 1); - return promisifyRequest(store2.transaction); - }); - }); -} -__name(push, "push"); -function unshift(store, value4, maxQueueSize) { - return store((store2) => { - return keys$7(store2).then((keys2) => { - if (keys2.length >= maxQueueSize) { - return; - } - store2.put(value4, Math.min(...keys2, 0) - 1); - return promisifyRequest(store2.transaction); - }); - }); -} -__name(unshift, "unshift"); -function shift$1(store) { - return store((store2) => { - return keys$7(store2).then((keys2) => { - const firstKey = keys2[0]; - if (firstKey == null) { - return void 0; - } - return promisifyRequest(store2.get(firstKey)).then((value4) => { - store2.delete(firstKey); - return promisifyRequest(store2.transaction).then(() => value4); - }); - }); - }); -} -__name(shift$1, "shift$1"); -function createIndexedDbStore(options4) { - let store; - function getStore() { - if (store == void 0) { - store = createStore(options4.dbName || "sentry-offline", options4.storeName || "queue"); - } - return store; - } - __name(getStore, "getStore"); - return { - push: /* @__PURE__ */ __name(async (env) => { - try { - const serialized = await serializeEnvelope(env); - await push(getStore(), serialized, options4.maxQueueSize || 30); - } catch (_2) { - } - }, "push"), - unshift: /* @__PURE__ */ __name(async (env) => { - try { - const serialized = await serializeEnvelope(env); - await unshift(getStore(), serialized, options4.maxQueueSize || 30); - } catch (_2) { - } - }, "unshift"), - shift: /* @__PURE__ */ __name(async () => { - try { - const deserialized = await shift$1(getStore()); - if (deserialized) { - return parseEnvelope(deserialized); - } - } catch (_2) { - } - return void 0; - }, "shift") - }; -} -__name(createIndexedDbStore, "createIndexedDbStore"); -function makeIndexedDbOfflineTransport(createTransport2) { - return (options4) => createTransport2({ ...options4, createStore: createIndexedDbStore }); -} -__name(makeIndexedDbOfflineTransport, "makeIndexedDbOfflineTransport"); -function makeBrowserOfflineTransport(createTransport2 = makeFetchTransport) { - return makeIndexedDbOfflineTransport(makeOfflineTransport(createTransport2)); -} -__name(makeBrowserOfflineTransport, "makeBrowserOfflineTransport"); -const MS_TO_NS = 1e6; -const THREAD_ID_STRING = String(0); -const THREAD_NAME = "main"; -let OS_PLATFORM = ""; -let OS_PLATFORM_VERSION = ""; -let OS_ARCH = ""; -let OS_BROWSER = WINDOW$5.navigator && WINDOW$5.navigator.userAgent || ""; -let OS_MODEL = ""; -const OS_LOCALE = WINDOW$5.navigator && WINDOW$5.navigator.language || WINDOW$5.navigator && WINDOW$5.navigator.languages && WINDOW$5.navigator.languages[0] || ""; -function isUserAgentData(data26) { - return typeof data26 === "object" && data26 !== null && "getHighEntropyValues" in data26; -} -__name(isUserAgentData, "isUserAgentData"); -const userAgentData = WINDOW$5.navigator && WINDOW$5.navigator.userAgentData; -if (isUserAgentData(userAgentData)) { - userAgentData.getHighEntropyValues(["architecture", "model", "platform", "platformVersion", "fullVersionList"]).then((ua) => { - OS_PLATFORM = ua.platform || ""; - OS_ARCH = ua.architecture || ""; - OS_MODEL = ua.model || ""; - OS_PLATFORM_VERSION = ua.platformVersion || ""; - if (ua.fullVersionList && ua.fullVersionList.length > 0) { - const firstUa = ua.fullVersionList[ua.fullVersionList.length - 1]; - OS_BROWSER = `${firstUa.brand} ${firstUa.version}`; - } - }).catch((e2) => void 0); -} -function isProcessedJSSelfProfile(profile) { - return !("thread_metadata" in profile); -} -__name(isProcessedJSSelfProfile, "isProcessedJSSelfProfile"); -function enrichWithThreadInformation(profile) { - if (!isProcessedJSSelfProfile(profile)) { - return profile; - } - return convertJSSelfProfileToSampledFormat(profile); -} -__name(enrichWithThreadInformation, "enrichWithThreadInformation"); -function getTraceId(event) { - const traceId = event && event.contexts && event.contexts["trace"] && event.contexts["trace"]["trace_id"]; - if (typeof traceId === "string" && traceId.length !== 32) { - if (DEBUG_BUILD$4) { - logger$2.log(`[Profiling] Invalid traceId: ${traceId} on profiled event`); - } - } - if (typeof traceId !== "string") { - return ""; - } - return traceId; -} -__name(getTraceId, "getTraceId"); -function createProfilePayload(profile_id, start_timestamp, processed_profile, event) { - if (event.type !== "transaction") { - throw new TypeError("Profiling events may only be attached to transactions, this should never occur."); - } - if (processed_profile === void 0 || processed_profile === null) { - throw new TypeError( - `Cannot construct profiling event envelope without a valid profile. Got ${processed_profile} instead.` - ); - } - const traceId = getTraceId(event); - const enrichedThreadProfile = enrichWithThreadInformation(processed_profile); - const transactionStartMs = start_timestamp ? start_timestamp : typeof event.start_timestamp === "number" ? event.start_timestamp * 1e3 : timestampInSeconds() * 1e3; - const transactionEndMs = typeof event.timestamp === "number" ? event.timestamp * 1e3 : timestampInSeconds() * 1e3; - const profile = { - event_id: profile_id, - timestamp: new Date(transactionStartMs).toISOString(), - platform: "javascript", - version: "1", - release: event.release || "", - environment: event.environment || DEFAULT_ENVIRONMENT, - runtime: { - name: "javascript", - version: WINDOW$5.navigator.userAgent - }, - os: { - name: OS_PLATFORM, - version: OS_PLATFORM_VERSION, - build_number: OS_BROWSER - }, - device: { - locale: OS_LOCALE, - model: OS_MODEL, - manufacturer: OS_BROWSER, - architecture: OS_ARCH, - is_emulator: false - }, - debug_meta: { - images: applyDebugMetadata(processed_profile.resources) - }, - profile: enrichedThreadProfile, - transactions: [ - { - name: event.transaction || "", - id: event.event_id || uuid4(), - trace_id: traceId, - active_thread_id: THREAD_ID_STRING, - relative_start_ns: "0", - relative_end_ns: ((transactionEndMs - transactionStartMs) * 1e6).toFixed(0) - } - ] - }; - return profile; -} -__name(createProfilePayload, "createProfilePayload"); -function isAutomatedPageLoadSpan(span) { - return spanToJSON(span).op === "pageload"; -} -__name(isAutomatedPageLoadSpan, "isAutomatedPageLoadSpan"); -function convertJSSelfProfileToSampledFormat(input) { - let EMPTY_STACK_ID = void 0; - let STACK_ID = 0; - const profile = { - samples: [], - stacks: [], - frames: [], - thread_metadata: { - [THREAD_ID_STRING]: { name: THREAD_NAME } - } - }; - const firstSample = input.samples[0]; - if (!firstSample) { - return profile; - } - const start2 = firstSample.timestamp; - const origin2 = typeof performance.timeOrigin === "number" ? performance.timeOrigin : browserPerformanceTimeOrigin || 0; - const adjustForOriginChange = origin2 - (browserPerformanceTimeOrigin || origin2); - input.samples.forEach((jsSample, i2) => { - if (jsSample.stackId === void 0) { - if (EMPTY_STACK_ID === void 0) { - EMPTY_STACK_ID = STACK_ID; - profile.stacks[EMPTY_STACK_ID] = []; - STACK_ID++; - } - profile["samples"][i2] = { - // convert ms timestamp to ns - elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start2) * MS_TO_NS).toFixed(0), - stack_id: EMPTY_STACK_ID, - thread_id: THREAD_ID_STRING - }; - return; - } - let stackTop = input.stacks[jsSample.stackId]; - const stack2 = []; - while (stackTop) { - stack2.push(stackTop.frameId); - const frame = input.frames[stackTop.frameId]; - if (frame && profile.frames[stackTop.frameId] === void 0) { - profile.frames[stackTop.frameId] = { - function: frame.name, - abs_path: typeof frame.resourceId === "number" ? input.resources[frame.resourceId] : void 0, - lineno: frame.line, - colno: frame.column - }; - } - stackTop = stackTop.parentId === void 0 ? void 0 : input.stacks[stackTop.parentId]; - } - const sample = { - // convert ms timestamp to ns - elapsed_since_start_ns: ((jsSample.timestamp + adjustForOriginChange - start2) * MS_TO_NS).toFixed(0), - stack_id: STACK_ID, - thread_id: THREAD_ID_STRING - }; - profile["stacks"][STACK_ID] = stack2; - profile["samples"][i2] = sample; - STACK_ID++; - }); - return profile; -} -__name(convertJSSelfProfileToSampledFormat, "convertJSSelfProfileToSampledFormat"); -function addProfilesToEnvelope(envelope, profiles) { - if (!profiles.length) { - return envelope; - } - for (const profile of profiles) { - envelope[1].push([{ type: "profile" }, profile]); - } - return envelope; -} -__name(addProfilesToEnvelope, "addProfilesToEnvelope"); -function findProfiledTransactionsFromEnvelope(envelope) { - const events2 = []; - forEachEnvelopeItem(envelope, (item3, type) => { - if (type !== "transaction") { - return; - } - for (let j2 = 1; j2 < item3.length; j2++) { - const event = item3[j2]; - if (event && event.contexts && event.contexts["profile"] && event.contexts["profile"]["profile_id"]) { - events2.push(item3[j2]); - } - } - }); - return events2; -} -__name(findProfiledTransactionsFromEnvelope, "findProfiledTransactionsFromEnvelope"); -function applyDebugMetadata(resource_paths) { - const client = getClient(); - const options4 = client && client.getOptions(); - const stackParser = options4 && options4.stackParser; - if (!stackParser) { - return []; - } - return getDebugImagesForResources(stackParser, resource_paths); -} -__name(applyDebugMetadata, "applyDebugMetadata"); -function isValidSampleRate(rate) { - if (typeof rate !== "number" && typeof rate !== "boolean" || typeof rate === "number" && isNaN(rate)) { - DEBUG_BUILD$4 && logger$2.warn( - `[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify( - rate - )} of type ${JSON.stringify(typeof rate)}.` - ); - return false; - } - if (rate === true || rate === false) { - return true; - } - if (rate < 0 || rate > 1) { - DEBUG_BUILD$4 && logger$2.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`); - return false; - } - return true; -} -__name(isValidSampleRate, "isValidSampleRate"); -function isValidProfile(profile) { - if (profile.samples.length < 2) { - if (DEBUG_BUILD$4) { - logger$2.log("[Profiling] Discarding profile because it contains less than 2 samples"); - } - return false; - } - if (!profile.frames.length) { - if (DEBUG_BUILD$4) { - logger$2.log("[Profiling] Discarding profile because it contains no frames"); - } - return false; - } - return true; -} -__name(isValidProfile, "isValidProfile"); -let PROFILING_CONSTRUCTOR_FAILED = false; -const MAX_PROFILE_DURATION_MS = 3e4; -function isJSProfilerSupported(maybeProfiler) { - return typeof maybeProfiler === "function"; -} -__name(isJSProfilerSupported, "isJSProfilerSupported"); -function startJSSelfProfile() { - const JSProfilerConstructor = WINDOW$5.Profiler; - if (!isJSProfilerSupported(JSProfilerConstructor)) { - if (DEBUG_BUILD$4) { - logger$2.log( - "[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object." - ); - } - return; - } - const samplingIntervalMS = 10; - const maxSamples = Math.floor(MAX_PROFILE_DURATION_MS / samplingIntervalMS); - try { - return new JSProfilerConstructor({ sampleInterval: samplingIntervalMS, maxBufferSize: maxSamples }); - } catch (e2) { - if (DEBUG_BUILD$4) { - logger$2.log( - "[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header." - ); - logger$2.log("[Profiling] Disabling profiling for current user session."); - } - PROFILING_CONSTRUCTOR_FAILED = true; - } - return; -} -__name(startJSSelfProfile, "startJSSelfProfile"); -function shouldProfileSpan(span) { - if (PROFILING_CONSTRUCTOR_FAILED) { - if (DEBUG_BUILD$4) { - logger$2.log("[Profiling] Profiling has been disabled for the duration of the current user session."); - } - return false; - } - if (!span.isRecording()) { - if (DEBUG_BUILD$4) { - logger$2.log("[Profiling] Discarding profile because transaction was not sampled."); - } - return false; - } - const client = getClient(); - const options4 = client && client.getOptions(); - if (!options4) { - DEBUG_BUILD$4 && logger$2.log("[Profiling] Profiling disabled, no options found."); - return false; - } - const profilesSampleRate = options4.profilesSampleRate; - if (!isValidSampleRate(profilesSampleRate)) { - DEBUG_BUILD$4 && logger$2.warn("[Profiling] Discarding profile because of invalid sample rate."); - return false; - } - if (!profilesSampleRate) { - DEBUG_BUILD$4 && logger$2.log( - "[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0" - ); - return false; - } - const sampled = profilesSampleRate === true ? true : Math.random() < profilesSampleRate; - if (!sampled) { - DEBUG_BUILD$4 && logger$2.log( - `[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number( - profilesSampleRate - )})` - ); - return false; - } - return true; -} -__name(shouldProfileSpan, "shouldProfileSpan"); -function createProfilingEvent(profile_id, start_timestamp, profile, event) { - if (!isValidProfile(profile)) { - return null; - } - return createProfilePayload(profile_id, start_timestamp, profile, event); -} -__name(createProfilingEvent, "createProfilingEvent"); -const PROFILE_MAP = /* @__PURE__ */ new Map(); -function getActiveProfilesCount() { - return PROFILE_MAP.size; -} -__name(getActiveProfilesCount, "getActiveProfilesCount"); -function takeProfileFromGlobalCache(profile_id) { - const profile = PROFILE_MAP.get(profile_id); - if (profile) { - PROFILE_MAP.delete(profile_id); - } - return profile; -} -__name(takeProfileFromGlobalCache, "takeProfileFromGlobalCache"); -function addProfileToGlobalCache(profile_id, profile) { - PROFILE_MAP.set(profile_id, profile); - if (PROFILE_MAP.size > 30) { - const last = PROFILE_MAP.keys().next().value; - PROFILE_MAP.delete(last); - } -} -__name(addProfileToGlobalCache, "addProfileToGlobalCache"); -function startProfileForSpan(span) { - let startTimestamp; - if (isAutomatedPageLoadSpan(span)) { - startTimestamp = timestampInSeconds() * 1e3; - } - const profiler2 = startJSSelfProfile(); - if (!profiler2) { - return; - } - if (DEBUG_BUILD$4) { - logger$2.log(`[Profiling] started profiling span: ${spanToJSON(span).description}`); - } - const profileId = uuid4(); - getCurrentScope$1().setContext("profile", { - profile_id: profileId, - start_timestamp: startTimestamp - }); - async function onProfileHandler() { - if (!span) { - return; - } - if (!profiler2) { - return; - } - return profiler2.stop().then((profile) => { - if (maxDurationTimeoutID) { - WINDOW$5.clearTimeout(maxDurationTimeoutID); - maxDurationTimeoutID = void 0; - } - if (DEBUG_BUILD$4) { - logger$2.log(`[Profiling] stopped profiling of span: ${spanToJSON(span).description}`); - } - if (!profile) { - if (DEBUG_BUILD$4) { - logger$2.log( - `[Profiling] profiler returned null profile for: ${spanToJSON(span).description}`, - "this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started" - ); - } - return; - } - addProfileToGlobalCache(profileId, profile); - }).catch((error2) => { - if (DEBUG_BUILD$4) { - logger$2.log("[Profiling] error while stopping profiler:", error2); - } - }); - } - __name(onProfileHandler, "onProfileHandler"); - let maxDurationTimeoutID = WINDOW$5.setTimeout(() => { - if (DEBUG_BUILD$4) { - logger$2.log("[Profiling] max profile duration elapsed, stopping profiling for:", spanToJSON(span).description); - } - onProfileHandler(); - }, MAX_PROFILE_DURATION_MS); - const originalEnd = span.end.bind(span); - function profilingWrappedSpanEnd() { - if (!span) { - return originalEnd(); - } - void onProfileHandler().then( - () => { - originalEnd(); - }, - () => { - originalEnd(); - } - ); - return span; - } - __name(profilingWrappedSpanEnd, "profilingWrappedSpanEnd"); - span.end = profilingWrappedSpanEnd; -} -__name(startProfileForSpan, "startProfileForSpan"); -const INTEGRATION_NAME$2 = "BrowserProfiling"; -const _browserProfilingIntegration = /* @__PURE__ */ __name(() => { - return { - name: INTEGRATION_NAME$2, - setup(client) { - const activeSpan = getActiveSpan(); - const rootSpan = activeSpan && getRootSpan(activeSpan); - if (rootSpan && isAutomatedPageLoadSpan(rootSpan)) { - if (shouldProfileSpan(rootSpan)) { - startProfileForSpan(rootSpan); - } - } - client.on("spanStart", (span) => { - if (span === getRootSpan(span) && shouldProfileSpan(span)) { - startProfileForSpan(span); - } - }); - client.on("beforeEnvelope", (envelope) => { - if (!getActiveProfilesCount()) { - return; - } - const profiledTransactionEvents = findProfiledTransactionsFromEnvelope(envelope); - if (!profiledTransactionEvents.length) { - return; - } - const profilesToAddToEnvelope = []; - for (const profiledTransaction of profiledTransactionEvents) { - const context = profiledTransaction && profiledTransaction.contexts; - const profile_id = context && context["profile"] && context["profile"]["profile_id"]; - const start_timestamp = context && context["profile"] && context["profile"]["start_timestamp"]; - if (typeof profile_id !== "string") { - DEBUG_BUILD$4 && logger$2.log("[Profiling] cannot find profile for a span without a profile context"); - continue; - } - if (!profile_id) { - DEBUG_BUILD$4 && logger$2.log("[Profiling] cannot find profile for a span without a profile context"); - continue; - } - if (context && context["profile"]) { - delete context.profile; - } - const profile = takeProfileFromGlobalCache(profile_id); - if (!profile) { - DEBUG_BUILD$4 && logger$2.log(`[Profiling] Could not retrieve profile for span: ${profile_id}`); - continue; - } - const profileEvent = createProfilingEvent( - profile_id, - start_timestamp, - profile, - profiledTransaction - ); - if (profileEvent) { - profilesToAddToEnvelope.push(profileEvent); - } - } - addProfilesToEnvelope(envelope, profilesToAddToEnvelope); - }); - } - }; -}, "_browserProfilingIntegration"); -const browserProfilingIntegration = defineIntegration(_browserProfilingIntegration); -const INTEGRATION_NAME$1 = "SpotlightBrowser"; -const _spotlightIntegration = /* @__PURE__ */ __name((options4 = {}) => { - const sidecarUrl = options4.sidecarUrl || "http://localhost:8969/stream"; - return { - name: INTEGRATION_NAME$1, - setup: /* @__PURE__ */ __name(() => { - DEBUG_BUILD$4 && logger$2.log("Using Sidecar URL", sidecarUrl); - }, "setup"), - // We don't want to send interaction transactions/root spans created from - // clicks within Spotlight to Sentry. Neither do we want them to be sent to - // spotlight. - processEvent: /* @__PURE__ */ __name((event) => isSpotlightInteraction(event) ? null : event, "processEvent"), - afterAllSetup: /* @__PURE__ */ __name((client) => { - setupSidecarForwarding(client, sidecarUrl); - }, "afterAllSetup") - }; -}, "_spotlightIntegration"); -function setupSidecarForwarding(client, sidecarUrl) { - const makeFetch = getNativeImplementation("fetch"); - let failCount = 0; - client.on("beforeEnvelope", (envelope) => { - if (failCount > 3) { - logger$2.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:", failCount); - return; - } - makeFetch(sidecarUrl, { - method: "POST", - body: serializeEnvelope(envelope), - headers: { - "Content-Type": "application/x-sentry-envelope" - }, - mode: "cors" - }).then( - (res) => { - if (res.status >= 200 && res.status < 400) { - failCount = 0; - } - }, - (err) => { - failCount++; - logger$2.error( - "Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/", - err - ); - } - ); - }); -} -__name(setupSidecarForwarding, "setupSidecarForwarding"); -const spotlightBrowserIntegration = defineIntegration(_spotlightIntegration); -function isSpotlightInteraction(event) { - return Boolean( - event.type === "transaction" && event.spans && event.contexts && event.contexts.trace && event.contexts.trace.op === "ui.action.click" && event.spans.some(({ description }) => description && description.includes("#sentry-spotlight")) - ); -} -__name(isSpotlightInteraction, "isSpotlightInteraction"); -const FLAG_BUFFER_SIZE = 100; -function copyFlagsFromScopeToEvent(event) { - const scope = getCurrentScope$1(); - const flagContext = scope.getScopeData().contexts.flags; - const flagBuffer = flagContext ? flagContext.values : []; - if (!flagBuffer.length) { - return event; - } - if (event.contexts === void 0) { - event.contexts = {}; - } - event.contexts.flags = { values: [...flagBuffer] }; - return event; -} -__name(copyFlagsFromScopeToEvent, "copyFlagsFromScopeToEvent"); -function insertFlagToScope(name2, value4, maxSize = FLAG_BUFFER_SIZE) { - const scopeContexts = getCurrentScope$1().getScopeData().contexts; - if (!scopeContexts.flags) { - scopeContexts.flags = { values: [] }; - } - const flags = scopeContexts.flags.values; - insertToFlagBuffer(flags, name2, value4, maxSize); -} -__name(insertFlagToScope, "insertFlagToScope"); -function insertToFlagBuffer(flags, name2, value4, maxSize) { - if (typeof value4 !== "boolean") { - return; - } - if (flags.length > maxSize) { - DEBUG_BUILD$4 && logger$2.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${maxSize}`); - return; - } - const index2 = flags.findIndex((f2) => f2.flag === name2); - if (index2 !== -1) { - flags.splice(index2, 1); - } - if (flags.length === maxSize) { - flags.shift(); - } - flags.push({ - flag: name2, - result: value4 - }); -} -__name(insertToFlagBuffer, "insertToFlagBuffer"); -const featureFlagsIntegration = defineIntegration(() => { - return { - name: "FeatureFlags", - processEvent(event, _hint, _client) { - return copyFlagsFromScopeToEvent(event); - }, - addFeatureFlag(name2, value4) { - insertFlagToScope(name2, value4); - } - }; -}); -const launchDarklyIntegration = defineIntegration(() => { - return { - name: "LaunchDarkly", - processEvent(event, _hint, _client) { - return copyFlagsFromScopeToEvent(event); - } - }; -}); -function buildLaunchDarklyFlagUsedHandler() { - return { - name: "sentry-flag-auditor", - type: "flag-used", - synchronous: true, - /** - * Handle a flag evaluation by storing its name and value on the current scope. - */ - method: /* @__PURE__ */ __name((flagKey, flagDetail, _context) => { - insertFlagToScope(flagKey, flagDetail.value); - }, "method") - }; -} -__name(buildLaunchDarklyFlagUsedHandler, "buildLaunchDarklyFlagUsedHandler"); -const openFeatureIntegration = defineIntegration(() => { - return { - name: "OpenFeature", - processEvent(event, _hint, _client) { - return copyFlagsFromScopeToEvent(event); - } - }; -}); -class OpenFeatureIntegrationHook { - static { - __name(this, "OpenFeatureIntegrationHook"); - } - /** - * Successful evaluation result. - */ - after(_hookContext, evaluationDetails) { - insertFlagToScope(evaluationDetails.flagKey, evaluationDetails.value); - } - /** - * On error evaluation result. - */ - error(hookContext, _error, _hookHints) { - insertFlagToScope(hookContext.flagKey, hookContext.defaultValue); - } -} -const DEFAULT_HOOKS = ["activate", "mount", "update"]; -const DEBUG_BUILD = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__; -const classifyRE$1 = /(?:^|[-_])(\w)/g; -const classify$1 = /* @__PURE__ */ __name((str) => str.replace(classifyRE$1, (c2) => c2.toUpperCase()).replace(/[-_]/g, ""), "classify$1"); -const ROOT_COMPONENT_NAME = ""; -const ANONYMOUS_COMPONENT_NAME = ""; -const repeat = /* @__PURE__ */ __name((str, n2) => { - return str.repeat(n2); -}, "repeat"); -const formatComponentName$1 = /* @__PURE__ */ __name((vm, includeFile) => { - if (!vm) { - return ANONYMOUS_COMPONENT_NAME; - } - if (vm.$root === vm) { - return ROOT_COMPONENT_NAME; - } - if (!vm.$options) { - return ANONYMOUS_COMPONENT_NAME; - } - const options4 = vm.$options; - let name2 = options4.name || options4._componentTag || options4.__name; - const file = options4.__file; - if (!name2 && file) { - const match2 = file.match(/([^/\\]+)\.vue$/); - if (match2) { - name2 = match2[1]; - } - } - return (name2 ? `<${classify$1(name2)}>` : ANONYMOUS_COMPONENT_NAME) + (file && includeFile !== false ? ` at ${file}` : ""); -}, "formatComponentName$1"); -const generateComponentTrace = /* @__PURE__ */ __name((vm) => { - if (vm && (vm._isVue || vm.__isVue) && vm.$parent) { - const tree = []; - let currentRecursiveSequence = 0; - while (vm) { - if (tree.length > 0) { - const last = tree[tree.length - 1]; - if (last.constructor === vm.constructor) { - currentRecursiveSequence++; - vm = vm.$parent; - continue; - } else if (currentRecursiveSequence > 0) { - tree[tree.length - 1] = [last, currentRecursiveSequence]; - currentRecursiveSequence = 0; - } - } - tree.push(vm); - vm = vm.$parent; - } - const formattedTree = tree.map( - (vm2, i2) => `${(i2 === 0 ? "---> " : repeat(" ", 5 + i2 * 2)) + (Array.isArray(vm2) ? `${formatComponentName$1(vm2[0])}... (${vm2[1]} recursive calls)` : formatComponentName$1(vm2))}` - ).join("\n"); - return ` - -found in - -${formattedTree}`; - } - return ` - -(found in ${formatComponentName$1(vm)})`; -}, "generateComponentTrace"); -const attachErrorHandler = /* @__PURE__ */ __name((app2, options4) => { - const { errorHandler: originalErrorHandler, warnHandler, silent } = app2.config; - app2.config.errorHandler = (error2, vm, lifecycleHook) => { - const componentName = formatComponentName$1(vm, false); - const trace = vm ? generateComponentTrace(vm) : ""; - const metadata = { - componentName, - lifecycleHook, - trace - }; - if (options4.attachProps && vm) { - if (vm.$options && vm.$options.propsData) { - metadata.propsData = vm.$options.propsData; - } else if (vm.$props) { - metadata.propsData = vm.$props; - } - } - setTimeout(() => { - captureException(error2, { - captureContext: { contexts: { vue: metadata } }, - mechanism: { handled: false } - }); - }); - if (typeof originalErrorHandler === "function" && app2.config.errorHandler) { - originalErrorHandler.call(app2, error2, vm, lifecycleHook); - } - if (options4.logErrors) { - const hasConsole = typeof console !== "undefined"; - const message3 = `Error in ${lifecycleHook}: "${error2 && error2.toString()}"`; - if (warnHandler) { - warnHandler.call(null, message3, vm, trace); - } else if (hasConsole && !silent) { - consoleSandbox(() => { - console.error(`[Vue warn]: ${message3}${trace}`); - }); - } - } - }; -}, "attachErrorHandler"); -const VUE_OP = "ui.vue"; -const HOOKS = { - activate: ["activated", "deactivated"], - create: ["beforeCreate", "created"], - // Vue 3 - unmount: ["beforeUnmount", "unmounted"], - // Vue 2 - destroy: ["beforeDestroy", "destroyed"], - mount: ["beforeMount", "mounted"], - update: ["beforeUpdate", "updated"] -}; -function finishRootSpan(vm, timestamp2, timeout) { - if (vm.$_sentryRootSpanTimer) { - clearTimeout(vm.$_sentryRootSpanTimer); - } - vm.$_sentryRootSpanTimer = setTimeout(() => { - if (vm.$root && vm.$root.$_sentryRootSpan) { - vm.$root.$_sentryRootSpan.end(timestamp2); - vm.$root.$_sentryRootSpan = void 0; - } - }, timeout); -} -__name(finishRootSpan, "finishRootSpan"); -function findTrackComponent(trackComponents, formattedName) { - function extractComponentName(name2) { - return name2.replace(/^<([^\s]*)>(?: at [^\s]*)?$/, "$1"); - } - __name(extractComponentName, "extractComponentName"); - const isMatched = trackComponents.some((compo) => { - return extractComponentName(formattedName) === extractComponentName(compo); - }); - return isMatched; -} -__name(findTrackComponent, "findTrackComponent"); -const createTracingMixins = /* @__PURE__ */ __name((options4) => { - const hooks2 = (options4.hooks || []).concat(DEFAULT_HOOKS).filter((value4, index2, self2) => self2.indexOf(value4) === index2); - const mixins = {}; - for (const operation of hooks2) { - const internalHooks = HOOKS[operation]; - if (!internalHooks) { - DEBUG_BUILD && logger$2.warn(`Unknown hook: ${operation}`); - continue; - } - for (const internalHook of internalHooks) { - mixins[internalHook] = function() { - const isRoot = this.$root === this; - if (isRoot) { - this.$_sentryRootSpan = this.$_sentryRootSpan || startInactiveSpan({ - name: "Application Render", - op: `${VUE_OP}.render`, - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.vue" - }, - onlyIfParent: true - }); - } - const name2 = formatComponentName$1(this, false); - const shouldTrack2 = Array.isArray(options4.trackComponents) ? findTrackComponent(options4.trackComponents, name2) : options4.trackComponents; - if (!isRoot && !shouldTrack2) { - return; - } - this.$_sentrySpans = this.$_sentrySpans || {}; - if (internalHook == internalHooks[0]) { - const activeSpan = this.$root && this.$root.$_sentryRootSpan || getActiveSpan(); - if (activeSpan) { - const oldSpan = this.$_sentrySpans[operation]; - if (oldSpan) { - oldSpan.end(); - } - this.$_sentrySpans[operation] = startInactiveSpan({ - name: `Vue ${name2}`, - op: `${VUE_OP}.${operation}`, - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ui.vue" - }, - // UI spans should only be created if there is an active root span (transaction) - onlyIfParent: true - }); - } - } else { - const span = this.$_sentrySpans[operation]; - if (!span) return; - span.end(); - finishRootSpan(this, timestampInSeconds(), options4.timeout); - } - }; - } - } - return mixins; -}, "createTracingMixins"); -const globalWithVue = GLOBAL_OBJ; -const DEFAULT_CONFIG = { - Vue: globalWithVue.Vue, - attachProps: true, - logErrors: true, - attachErrorHandler: true, - hooks: DEFAULT_HOOKS, - timeout: 2e3, - trackComponents: false -}; -const INTEGRATION_NAME = "Vue"; -const vueIntegration = defineIntegration((integrationOptions = {}) => { - return { - name: INTEGRATION_NAME, - setup(client) { - const options4 = { ...DEFAULT_CONFIG, ...client.getOptions(), ...integrationOptions }; - if (!options4.Vue && !options4.app) { - consoleSandbox(() => { - console.warn( - "[@sentry/vue]: Misconfigured SDK. Vue specific errors will not be captured. Update your `Sentry.init` call with an appropriate config option: `app` (Application Instance - Vue 3) or `Vue` (Vue Constructor - Vue 2)." - ); - }); - return; - } - if (options4.app) { - const apps = Array.isArray(options4.app) ? options4.app : [options4.app]; - apps.forEach((app2) => vueInit(app2, options4)); - } else if (options4.Vue) { - vueInit(options4.Vue, options4); - } - } - }; -}); -const vueInit = /* @__PURE__ */ __name((app2, options4) => { - if (DEBUG_BUILD) { - const appWithInstance = app2; - const isMounted = appWithInstance._instance && appWithInstance._instance.isMounted; - if (isMounted === true) { - consoleSandbox(() => { - console.warn( - "[@sentry/vue]: Misconfigured SDK. Vue app is already mounted. Make sure to call `app.mount()` after `Sentry.init()`." - ); - }); - } - } - if (options4.attachErrorHandler) { - attachErrorHandler(app2, options4); - } - if (hasTracingEnabled(options4)) { - app2.mixin( - createTracingMixins({ - ...options4, - // eslint-disable-next-line deprecation/deprecation - ...options4.tracingOptions - }) - ); - } -}, "vueInit"); -function init$3(config2 = {}) { - const options4 = { - _metadata: { - sdk: { - name: "sentry.javascript.vue", - packages: [ - { - name: "npm:@sentry/vue", - version: SDK_VERSION - } - ], - version: SDK_VERSION - } - }, - defaultIntegrations: [...getDefaultIntegrations(config2), vueIntegration()], - ...config2 - }; - return init$4(options4); -} -__name(init$3, "init$3"); -function instrumentVueRouter(router2, options4, startNavigationSpanFn) { - let isFirstPageLoad = true; - router2.onError((error2) => captureException(error2, { mechanism: { handled: false } })); - router2.beforeEach((to, from2, next2) => { - const isPageLoadNavigation = from2.name == null && from2.matched.length === 0 || from2.name === void 0 && isFirstPageLoad; - if (isFirstPageLoad) { - isFirstPageLoad = false; - } - const attributes = { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.navigation.vue" - }; - for (const key of Object.keys(to.params)) { - attributes[`params.${key}`] = to.params[key]; - } - for (const key of Object.keys(to.query)) { - const value4 = to.query[key]; - if (value4) { - attributes[`query.${key}`] = value4; - } - } - let spanName = to.path; - let transactionSource = "url"; - if (to.name && options4.routeLabel !== "path") { - spanName = to.name.toString(); - transactionSource = "custom"; - } else if (to.matched.length > 0) { - const lastIndex2 = to.matched.length - 1; - spanName = to.matched[lastIndex2].path; - transactionSource = "route"; - } - getCurrentScope$1().setTransactionName(spanName); - if (options4.instrumentPageLoad && isPageLoadNavigation) { - const activeRootSpan = getActiveRootSpan(); - if (activeRootSpan) { - const existingAttributes = spanToJSON(activeRootSpan).data || {}; - if (existingAttributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] !== "custom") { - activeRootSpan.updateName(spanName); - activeRootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, transactionSource); - } - activeRootSpan.setAttributes({ - ...attributes, - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.pageload.vue" - }); - } - } - if (options4.instrumentNavigation && !isPageLoadNavigation) { - attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = transactionSource; - attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = "auto.navigation.vue"; - startNavigationSpanFn({ - name: spanName, - op: "navigation", - attributes - }); - } - if (next2) { - next2(); - } - }); -} -__name(instrumentVueRouter, "instrumentVueRouter"); -function getActiveRootSpan() { - const span = getActiveSpan(); - const rootSpan = span && getRootSpan(span); - if (!rootSpan) { - return void 0; - } - const op = spanToJSON(rootSpan).op; - return op === "navigation" || op === "pageload" ? rootSpan : void 0; -} -__name(getActiveRootSpan, "getActiveRootSpan"); -function browserTracingIntegration(options4 = {}) { - if (!options4.router) { - return browserTracingIntegration$1(options4); - } - const integration = browserTracingIntegration$1({ - ...options4, - instrumentNavigation: false - }); - const { router: router2, instrumentNavigation = true, instrumentPageLoad = true, routeLabel = "name" } = options4; - return { - ...integration, - afterAllSetup(client) { - integration.afterAllSetup(client); - const startNavigationSpan = /* @__PURE__ */ __name((options5) => { - startBrowserTracingNavigationSpan(client, options5); - }, "startNavigationSpan"); - instrumentVueRouter(router2, { routeLabel, instrumentNavigation, instrumentPageLoad }, startNavigationSpan); - } - }; -} -__name(browserTracingIntegration, "browserTracingIntegration"); -const createSentryPiniaPlugin = /* @__PURE__ */ __name((options4 = { - attachPiniaState: true, - addBreadcrumbs: true, - actionTransformer: /* @__PURE__ */ __name((action) => action, "actionTransformer"), - stateTransformer: /* @__PURE__ */ __name((state) => state, "stateTransformer") -}) => { - const plugin = /* @__PURE__ */ __name(({ store }) => { - options4.attachPiniaState !== false && getGlobalScope().addEventProcessor((event, hint) => { - try { - const timestamp2 = (/* @__PURE__ */ new Date()).toTimeString().split(" ")[0]; - const filename = `pinia_state_${store.$id}_${timestamp2}.json`; - hint.attachments = [ - ...hint.attachments || [], - { - filename, - data: JSON.stringify(store.$state) - } - ]; - } catch (_2) { - } - return event; - }); - store.$onAction((context) => { - context.after(() => { - const transformedActionName = options4.actionTransformer ? options4.actionTransformer(context.name) : context.name; - if (typeof transformedActionName !== "undefined" && transformedActionName !== null && options4.addBreadcrumbs !== false) { - addBreadcrumb({ - category: "action", - message: transformedActionName, - level: "info" - }); - } - const transformedState = options4.stateTransformer ? options4.stateTransformer(store.$state) : store.$state; - const scope = getCurrentScope$1(); - const currentState = scope.getScopeData().contexts.state; - if (typeof transformedState !== "undefined" && transformedState !== null) { - const client = getClient(); - const options5 = client && client.getOptions(); - const normalizationDepth = options5 && options5.normalizeDepth || 3; - const piniaStateContext = { type: "pinia", value: transformedState }; - const newState = { - ...currentState || {}, - state: piniaStateContext - }; - addNonEnumerableProperty( - newState, - "__sentry_override_normalization_depth__", - 3 + // 3 layers for `state.value.transformedState - normalizationDepth - // rest for the actual state - ); - scope.setContext("state", newState); - } else { - scope.setContext("state", { - ...currentState || {}, - state: { type: "pinia", value: "undefined" } - }); - } - }); - }); - }, "plugin"); - return plugin; -}, "createSentryPiniaPlugin"); -/** -* @vue/shared v3.5.13 -* (c) 2018-present Yuxi (Evan) You and Vue contributors -* @license MIT -**/ -/*! #__NO_SIDE_EFFECTS__ */ -// @__NO_SIDE_EFFECTS__ -function makeMap(str) { - const map3 = /* @__PURE__ */ Object.create(null); - for (const key of str.split(",")) map3[key] = 1; - return (val) => val in map3; -} -__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$2 = /* @__PURE__ */ __name((arr, el) => { - const i2 = arr.indexOf(el); - if (i2 > -1) { - arr.splice(i2, 1); - } -}, "remove$2"); -const hasOwnProperty$d = Object.prototype.hasOwnProperty; -const hasOwn$3 = /* @__PURE__ */ __name((val, key) => hasOwnProperty$d.call(val, key), "hasOwn$3"); -const isArray$b = Array.isArray; -const isMap$3 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Map]", "isMap$3"); -const isSet$3 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Set]", "isSet$3"); -const isDate$4 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Date]", "isDate$4"); -const isRegExp$4 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object RegExp]", "isRegExp$4"); -const isFunction$c = /* @__PURE__ */ __name((val) => typeof val === "function", "isFunction$c"); -const isString$9 = /* @__PURE__ */ __name((val) => typeof val === "string", "isString$9"); -const isSymbol$1 = /* @__PURE__ */ __name((val) => typeof val === "symbol", "isSymbol$1"); -const isObject$f = /* @__PURE__ */ __name((val) => val !== null && typeof val === "object", "isObject$f"); -const isPromise$1 = /* @__PURE__ */ __name((val) => { - return (isObject$f(val) || isFunction$c(val)) && isFunction$c(val.then) && isFunction$c(val.catch); -}, "isPromise$1"); -const objectToString$3 = Object.prototype.toString; -const toTypeString$1 = /* @__PURE__ */ __name((value4) => objectToString$3.call(value4), "toTypeString$1"); -const toRawType = /* @__PURE__ */ __name((value4) => { - return toTypeString$1(value4).slice(8, -1); -}, "toRawType"); -const isPlainObject$4 = /* @__PURE__ */ __name((val) => toTypeString$1(val) === "[object Object]", "isPlainObject$4"); -const isIntegerKey = /* @__PURE__ */ __name((key) => isString$9(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, c2) => c2 ? c2.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 s2 = str ? `on${capitalize$1(str)}` : ``; - return s2; - } -); -const hasChanged = /* @__PURE__ */ __name((value4, oldValue) => !Object.is(value4, oldValue), "hasChanged"); -const invokeArrayFns = /* @__PURE__ */ __name((fns, ...arg) => { - for (let i2 = 0; i2 < fns.length; i2++) { - fns[i2](...arg); - } -}, "invokeArrayFns"); -const def = /* @__PURE__ */ __name((obj, key, value4, writable = false) => { - Object.defineProperty(obj, key, { - configurable: true, - enumerable: false, - writable, - value: value4 - }); -}, "def"); -const looseToNumber = /* @__PURE__ */ __name((val) => { - const n2 = parseFloat(val); - return isNaN(n2) ? val : n2; -}, "looseToNumber"); -const toNumber = /* @__PURE__ */ __name((val) => { - const n2 = isString$9(val) ? Number(val) : NaN; - return isNaN(n2) ? val : n2; -}, "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(name2) { - return identRE.test(name2) ? `__props.${name2}` : `__props[${JSON.stringify(name2)}]`; -} -__name(genPropsAccessExp, "genPropsAccessExp"); -function genCacheKey(source, options4) { - return source + JSON.stringify( - options4, - (_2, val) => typeof val === "function" ? val.toString() : val - ); -} -__name(genCacheKey, "genCacheKey"); -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", - "CACHED": -1, - "-1": "CACHED", - "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,Symbol"; -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 i2 = 0; i2 < lines.length; i2++) { - count += lines[i2].length + (newlineSequences[i2] && newlineSequences[i2].length || 0); - if (count >= start2) { - for (let j2 = i2 - range; j2 <= i2 + range || end > count; j2++) { - if (j2 < 0 || j2 >= lines.length) continue; - const line = j2 + 1; - res.push( - `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j2]}` - ); - const lineLength = lines[j2].length; - const newLineSeqLength = newlineSequences[j2] && newlineSequences[j2].length || 0; - if (j2 === i2) { - 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 (j2 > i2) { - 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(value4) { - if (isArray$b(value4)) { - const res = {}; - for (let i2 = 0; i2 < value4.length; i2++) { - const item3 = value4[i2]; - const normalized = isString$9(item3) ? parseStringStyle(item3) : normalizeStyle(item3); - if (normalized) { - for (const key in normalized) { - res[key] = normalized[key]; - } - } - } - return res; - } else if (isString$9(value4) || isObject$f(value4)) { - return value4; - } -} -__name(normalizeStyle, "normalizeStyle"); -const listDelimiterRE = /;(?![^(]*\))/g; -const propertyDelimiterRE = /:([^]+)/; -const styleCommentRE = /\/\*[^]*?\*\//g; -function parseStringStyle(cssText) { - const ret = {}; - cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item3) => { - if (item3) { - const tmp = item3.split(propertyDelimiterRE); - tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); - } - }); - return ret; -} -__name(parseStringStyle, "parseStringStyle"); -function stringifyStyle(styles) { - if (!styles) return ""; - if (isString$9(styles)) return styles; - let ret = ""; - for (const key in styles) { - const value4 = styles[key]; - if (isString$9(value4) || typeof value4 === "number") { - const normalizedKey = key.startsWith(`--`) ? key : hyphenate$1(key); - ret += `${normalizedKey}:${value4};`; - } - } - return ret; -} -__name(stringifyStyle, "stringifyStyle"); -function normalizeClass(value4) { - let res = ""; - if (isString$9(value4)) { - res = value4; - } else if (isArray$b(value4)) { - for (let i2 = 0; i2 < value4.length; i2++) { - const normalized = normalizeClass(value4[i2]); - if (normalized) { - res += normalized + " "; - } - } - } else if (isObject$f(value4)) { - for (const name2 in value4) { - if (value4[name2]) { - res += name2 + " "; - } - } - } - return res.trim(); -} -__name(normalizeClass, "normalizeClass"); -function normalizeProps(props) { - if (!props) return null; - let { class: klass, style: style2 } = props; - if (klass && !isString$9(klass)) { - props.class = normalizeClass(klass); - } - if (style2) { - props.style = normalizeStyle(style2); - } - 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(value4) { - return !!value4 || value4 === ""; -} -__name(includeBooleanAttr, "includeBooleanAttr"); -const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/; -const attrValidationCache = {}; -function isSSRSafeAttrName(name2) { - if (attrValidationCache.hasOwnProperty(name2)) { - return attrValidationCache[name2]; - } - const isUnsafe = unsafeAttrCharRE.test(name2); - if (isUnsafe) { - console.error(`unsafe attribute name: ${name2}`); - } - return attrValidationCache[name2] = !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` -); -const isKnownMathMLAttr = /* @__PURE__ */ makeMap( - `accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns` -); -function isRenderableAttrValue(value4) { - if (value4 == null) { - return false; - } - const type = typeof value4; - return type === "string" || type === "number" || type === "boolean"; -} -__name(isRenderableAttrValue, "isRenderableAttrValue"); -const escapeRE$2 = /["'&<>]/; -function escapeHtml$2(string) { - const str = "" + string; - const match2 = escapeRE$2.exec(str); - if (!match2) { - return str; - } - let html = ""; - let escaped; - let index2; - let lastIndex2 = 0; - for (index2 = match2.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 (lastIndex2 !== index2) { - html += str.slice(lastIndex2, index2); - } - lastIndex2 = index2 + 1; - html += escaped; - } - return lastIndex2 !== index2 ? html + str.slice(lastIndex2, index2) : html; -} -__name(escapeHtml$2, "escapeHtml$2"); -const commentStripRE = /^-?>||--!>|?@[\\\]^`{|}~]/g; -function getEscapedCssVarName(key, doubleEscape) { - return key.replace( - cssVarNameEscapeSymbolsRE, - (s2) => doubleEscape ? s2 === '"' ? '\\\\\\"' : `\\\\${s2}` : `\\${s2}` - ); -} -__name(getEscapedCssVarName, "getEscapedCssVarName"); -function looseCompareArrays(a2, b2) { - if (a2.length !== b2.length) return false; - let equal = true; - for (let i2 = 0; equal && i2 < a2.length; i2++) { - equal = looseEqual(a2[i2], b2[i2]); - } - return equal; -} -__name(looseCompareArrays, "looseCompareArrays"); -function looseEqual(a2, b2) { - if (a2 === b2) return true; - let aValidType = isDate$4(a2); - let bValidType = isDate$4(b2); - if (aValidType || bValidType) { - return aValidType && bValidType ? a2.getTime() === b2.getTime() : false; - } - aValidType = isSymbol$1(a2); - bValidType = isSymbol$1(b2); - if (aValidType || bValidType) { - return a2 === b2; - } - aValidType = isArray$b(a2); - bValidType = isArray$b(b2); - if (aValidType || bValidType) { - return aValidType && bValidType ? looseCompareArrays(a2, b2) : false; - } - aValidType = isObject$f(a2); - bValidType = isObject$f(b2); - if (aValidType || bValidType) { - if (!aValidType || !bValidType) { - return false; - } - const aKeysCount = Object.keys(a2).length; - const bKeysCount = Object.keys(b2).length; - if (aKeysCount !== bKeysCount) { - return false; - } - for (const key in a2) { - const aHasKey = a2.hasOwnProperty(key); - const bHasKey = b2.hasOwnProperty(key); - if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a2[key], b2[key])) { - return false; - } - } - } - return String(a2) === String(b2); -} -__name(looseEqual, "looseEqual"); -function looseIndexOf(arr, val) { - return arr.findIndex((item3) => looseEqual(item3, 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$9(val) ? val : val == null ? "" : isArray$b(val) || isObject$f(val) && (val.toString === objectToString$3 || !isFunction$c(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$3(val)) { - return { - [`Map(${val.size})`]: [...val.entries()].reduce( - (entries, [key, val2], i2) => { - entries[stringifySymbol(key, i2) + " =>"] = val2; - return entries; - }, - {} - ) - }; - } else if (isSet$3(val)) { - return { - [`Set(${val.size})`]: [...val.values()].map((v2) => stringifySymbol(v2)) - }; - } else if (isSymbol$1(val)) { - return stringifySymbol(val); - } else if (isObject$f(val) && !isArray$b(val) && !isPlainObject$4(val)) { - return String(val); - } - return val; -}, "replacer"); -const stringifySymbol = /* @__PURE__ */ __name((v2, i2 = "") => { - var _a2; - return ( - // Symbol.description in es2019+ so we need to cast here to pass - // the lib: es2016 check - isSymbol$1(v2) ? `Symbol(${(_a2 = v2.description) != null ? _a2 : i2})` : v2 - ); -}, "stringifySymbol"); -/** -* @vue/reactivity v3.5.13 -* (c) 2018-present Yuxi (Evan) You and Vue contributors -* @license MIT -**/ -function warn$4(msg, ...args) { - console.warn(`[Vue warn] ${msg}`, ...args); -} -__name(warn$4, "warn$4"); -let activeEffectScope; -class EffectScope { - static { - __name(this, "EffectScope"); - } - constructor(detached = false) { - this.detached = detached; - this._active = true; - this.effects = []; - this.cleanups = []; - this._isPaused = false; - this.parent = activeEffectScope; - if (!detached && activeEffectScope) { - this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( - this - ) - 1; - } - } - get active() { - return this._active; - } - pause() { - if (this._active) { - this._isPaused = true; - let i2, l2; - if (this.scopes) { - for (i2 = 0, l2 = this.scopes.length; i2 < l2; i2++) { - this.scopes[i2].pause(); - } - } - for (i2 = 0, l2 = this.effects.length; i2 < l2; i2++) { - this.effects[i2].pause(); - } - } - } - /** - * Resumes the effect scope, including all child scopes and effects. - */ - resume() { - if (this._active) { - if (this._isPaused) { - this._isPaused = false; - let i2, l2; - if (this.scopes) { - for (i2 = 0, l2 = this.scopes.length; i2 < l2; i2++) { - this.scopes[i2].resume(); - } - } - for (i2 = 0, l2 = this.effects.length; i2 < l2; i2++) { - this.effects[i2].resume(); - } - } - } - } - run(fn) { - if (this._active) { - const currentEffectScope = activeEffectScope; - try { - activeEffectScope = this; - return fn(); - } finally { - activeEffectScope = currentEffectScope; - } - } else if (false) { - warn$4(`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) { - this._active = false; - let i2, l2; - for (i2 = 0, l2 = this.effects.length; i2 < l2; i2++) { - this.effects[i2].stop(); - } - this.effects.length = 0; - for (i2 = 0, l2 = this.cleanups.length; i2 < l2; i2++) { - this.cleanups[i2](); - } - this.cleanups.length = 0; - if (this.scopes) { - for (i2 = 0, l2 = this.scopes.length; i2 < l2; i2++) { - this.scopes[i2].stop(true); - } - this.scopes.length = 0; - } - 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; - } - } -} -function effectScope(detached) { - return new EffectScope(detached); -} -__name(effectScope, "effectScope"); -function getCurrentScope() { - return activeEffectScope; -} -__name(getCurrentScope, "getCurrentScope"); -function onScopeDispose(fn, failSilently = false) { - if (activeEffectScope) { - activeEffectScope.cleanups.push(fn); - } else if (false) { - warn$4( - `onScopeDispose() is called when there is no active effect scope to be associated with.` - ); - } -} -__name(onScopeDispose, "onScopeDispose"); -let activeSub; -const EffectFlags = { - "ACTIVE": 1, - "1": "ACTIVE", - "RUNNING": 2, - "2": "RUNNING", - "TRACKING": 4, - "4": "TRACKING", - "NOTIFIED": 8, - "8": "NOTIFIED", - "DIRTY": 16, - "16": "DIRTY", - "ALLOW_RECURSE": 32, - "32": "ALLOW_RECURSE", - "PAUSED": 64, - "64": "PAUSED" -}; -const pausedQueueEffects = /* @__PURE__ */ new WeakSet(); -class ReactiveEffect { - static { - __name(this, "ReactiveEffect"); - } - constructor(fn) { - this.fn = fn; - this.deps = void 0; - this.depsTail = void 0; - this.flags = 1 | 4; - this.next = void 0; - this.cleanup = void 0; - this.scheduler = void 0; - if (activeEffectScope && activeEffectScope.active) { - activeEffectScope.effects.push(this); - } - } - pause() { - this.flags |= 64; - } - resume() { - if (this.flags & 64) { - this.flags &= ~64; - if (pausedQueueEffects.has(this)) { - pausedQueueEffects.delete(this); - this.trigger(); - } - } - } - /** - * @internal - */ - notify() { - if (this.flags & 2 && !(this.flags & 32)) { - return; - } - if (!(this.flags & 8)) { - batch(this); - } - } - run() { - if (!(this.flags & 1)) { - return this.fn(); - } - this.flags |= 2; - cleanupEffect(this); - prepareDeps(this); - const prevEffect = activeSub; - const prevShouldTrack = shouldTrack; - activeSub = this; - shouldTrack = true; - try { - return this.fn(); - } finally { - if (false) { - warn$4( - "Active effect was not restored correctly - this is likely a Vue internal bug." - ); - } - cleanupDeps(this); - activeSub = prevEffect; - shouldTrack = prevShouldTrack; - this.flags &= ~2; - } - } - stop() { - if (this.flags & 1) { - for (let link2 = this.deps; link2; link2 = link2.nextDep) { - removeSub(link2); - } - this.deps = this.depsTail = void 0; - cleanupEffect(this); - this.onStop && this.onStop(); - this.flags &= ~1; - } - } - trigger() { - if (this.flags & 64) { - pausedQueueEffects.add(this); - } else if (this.scheduler) { - this.scheduler(); - } else { - this.runIfDirty(); - } - } - /** - * @internal - */ - runIfDirty() { - if (isDirty$1(this)) { - this.run(); - } - } - get dirty() { - return isDirty$1(this); - } -} -let batchDepth = 0; -let batchedSub; -let batchedComputed; -function batch(sub, isComputed2 = false) { - sub.flags |= 8; - if (isComputed2) { - sub.next = batchedComputed; - batchedComputed = sub; - return; - } - sub.next = batchedSub; - batchedSub = sub; -} -__name(batch, "batch"); -function startBatch() { - batchDepth++; -} -__name(startBatch, "startBatch"); -function endBatch() { - if (--batchDepth > 0) { - return; - } - if (batchedComputed) { - let e2 = batchedComputed; - batchedComputed = void 0; - while (e2) { - const next2 = e2.next; - e2.next = void 0; - e2.flags &= ~8; - e2 = next2; - } - } - let error2; - while (batchedSub) { - let e2 = batchedSub; - batchedSub = void 0; - while (e2) { - const next2 = e2.next; - e2.next = void 0; - e2.flags &= ~8; - if (e2.flags & 1) { - try { - ; - e2.trigger(); - } catch (err) { - if (!error2) error2 = err; - } - } - e2 = next2; - } - } - if (error2) throw error2; -} -__name(endBatch, "endBatch"); -function prepareDeps(sub) { - for (let link2 = sub.deps; link2; link2 = link2.nextDep) { - link2.version = -1; - link2.prevActiveLink = link2.dep.activeLink; - link2.dep.activeLink = link2; - } -} -__name(prepareDeps, "prepareDeps"); -function cleanupDeps(sub) { - let head; - let tail = sub.depsTail; - let link2 = tail; - while (link2) { - const prev2 = link2.prevDep; - if (link2.version === -1) { - if (link2 === tail) tail = prev2; - removeSub(link2); - removeDep(link2); - } else { - head = link2; - } - link2.dep.activeLink = link2.prevActiveLink; - link2.prevActiveLink = void 0; - link2 = prev2; - } - sub.deps = head; - sub.depsTail = tail; -} -__name(cleanupDeps, "cleanupDeps"); -function isDirty$1(sub) { - for (let link2 = sub.deps; link2; link2 = link2.nextDep) { - if (link2.dep.version !== link2.version || link2.dep.computed && (refreshComputed(link2.dep.computed) || link2.dep.version !== link2.version)) { - return true; - } - } - if (sub._dirty) { - return true; - } - return false; -} -__name(isDirty$1, "isDirty$1"); -function refreshComputed(computed2) { - if (computed2.flags & 4 && !(computed2.flags & 16)) { - return; - } - computed2.flags &= ~16; - if (computed2.globalVersion === globalVersion) { - return; - } - computed2.globalVersion = globalVersion; - const dep = computed2.dep; - computed2.flags |= 2; - if (dep.version > 0 && !computed2.isSSR && computed2.deps && !isDirty$1(computed2)) { - computed2.flags &= ~2; - return; - } - const prevSub = activeSub; - const prevShouldTrack = shouldTrack; - activeSub = computed2; - shouldTrack = true; - try { - prepareDeps(computed2); - const value4 = computed2.fn(computed2._value); - if (dep.version === 0 || hasChanged(value4, computed2._value)) { - computed2._value = value4; - dep.version++; - } - } catch (err) { - dep.version++; - throw err; - } finally { - activeSub = prevSub; - shouldTrack = prevShouldTrack; - cleanupDeps(computed2); - computed2.flags &= ~2; - } -} -__name(refreshComputed, "refreshComputed"); -function removeSub(link2, soft = false) { - const { dep, prevSub, nextSub } = link2; - if (prevSub) { - prevSub.nextSub = nextSub; - link2.prevSub = void 0; - } - if (nextSub) { - nextSub.prevSub = prevSub; - link2.nextSub = void 0; - } - if (false) { - dep.subsHead = nextSub; - } - if (dep.subs === link2) { - dep.subs = prevSub; - if (!prevSub && dep.computed) { - dep.computed.flags &= ~4; - for (let l2 = dep.computed.deps; l2; l2 = l2.nextDep) { - removeSub(l2, true); - } - } - } - if (!soft && !--dep.sc && dep.map) { - dep.map.delete(dep.key); - } -} -__name(removeSub, "removeSub"); -function removeDep(link2) { - const { prevDep, nextDep } = link2; - if (prevDep) { - prevDep.nextDep = nextDep; - link2.prevDep = void 0; - } - if (nextDep) { - nextDep.prevDep = prevDep; - link2.nextDep = void 0; - } -} -__name(removeDep, "removeDep"); -function effect(fn, options4) { - if (fn.effect instanceof ReactiveEffect) { - fn = fn.effect.fn; - } - const e2 = new ReactiveEffect(fn); - if (options4) { - extend$1(e2, options4); - } - try { - e2.run(); - } catch (err) { - e2.stop(); - throw err; - } - const runner = e2.run.bind(e2); - runner.effect = e2; - return runner; -} -__name(effect, "effect"); -function stop(runner) { - runner.effect.stop(); -} -__name(stop, "stop"); -let shouldTrack = true; -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 onEffectCleanup(fn, failSilently = false) { - if (activeSub instanceof ReactiveEffect) { - activeSub.cleanup = fn; - } else if (false) { - warn$4( - `onEffectCleanup() was called when there was no active effect to associate with.` - ); - } -} -__name(onEffectCleanup, "onEffectCleanup"); -function cleanupEffect(e2) { - const { cleanup } = e2; - e2.cleanup = void 0; - if (cleanup) { - const prevSub = activeSub; - activeSub = void 0; - try { - cleanup(); - } finally { - activeSub = prevSub; - } - } -} -__name(cleanupEffect, "cleanupEffect"); -let globalVersion = 0; -let Link$3 = class Link2 { - static { - __name(this, "Link"); - } - constructor(sub, dep) { - this.sub = sub; - this.dep = dep; - this.version = dep.version; - this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0; - } -}; -class Dep { - static { - __name(this, "Dep"); - } - constructor(computed2) { - this.computed = computed2; - this.version = 0; - this.activeLink = void 0; - this.subs = void 0; - this.map = void 0; - this.key = void 0; - this.sc = 0; - if (false) { - this.subsHead = void 0; - } - } - track(debugInfo) { - if (!activeSub || !shouldTrack || activeSub === this.computed) { - return; - } - let link2 = this.activeLink; - if (link2 === void 0 || link2.sub !== activeSub) { - link2 = this.activeLink = new Link$3(activeSub, this); - if (!activeSub.deps) { - activeSub.deps = activeSub.depsTail = link2; - } else { - link2.prevDep = activeSub.depsTail; - activeSub.depsTail.nextDep = link2; - activeSub.depsTail = link2; - } - addSub(link2); - } else if (link2.version === -1) { - link2.version = this.version; - if (link2.nextDep) { - const next2 = link2.nextDep; - next2.prevDep = link2.prevDep; - if (link2.prevDep) { - link2.prevDep.nextDep = next2; - } - link2.prevDep = activeSub.depsTail; - link2.nextDep = void 0; - activeSub.depsTail.nextDep = link2; - activeSub.depsTail = link2; - if (activeSub.deps === link2) { - activeSub.deps = next2; - } - } - } - if (false) { - activeSub.onTrack( - extend$1( - { - effect: activeSub - }, - debugInfo - ) - ); - } - return link2; - } - trigger(debugInfo) { - this.version++; - globalVersion++; - this.notify(debugInfo); - } - notify(debugInfo) { - startBatch(); - try { - if (false) { - for (let head = this.subsHead; head; head = head.nextSub) { - if (head.sub.onTrigger && !(head.sub.flags & 8)) { - head.sub.onTrigger( - extend$1( - { - effect: head.sub - }, - debugInfo - ) - ); - } - } - } - for (let link2 = this.subs; link2; link2 = link2.prevSub) { - if (link2.sub.notify()) { - ; - link2.sub.dep.notify(); - } - } - } finally { - endBatch(); - } - } -} -function addSub(link2) { - link2.dep.sc++; - if (link2.sub.flags & 4) { - const computed2 = link2.dep.computed; - if (computed2 && !link2.dep.subs) { - computed2.flags |= 4 | 16; - for (let l2 = computed2.deps; l2; l2 = l2.nextDep) { - addSub(l2); - } - } - const currentTail = link2.dep.subs; - if (currentTail !== link2) { - link2.prevSub = currentTail; - if (currentTail) currentTail.nextSub = link2; - } - if (false) { - link2.dep.subsHead = link2; - } - link2.dep.subs = link2; - } -} -__name(addSub, "addSub"); -const targetMap = /* @__PURE__ */ new WeakMap(); -const ITERATE_KEY = Symbol( - false ? "Object iterate" : "" -); -const MAP_KEY_ITERATE_KEY = Symbol( - false ? "Map keys iterate" : "" -); -const ARRAY_ITERATE_KEY = Symbol( - false ? "Array iterate" : "" -); -function track(target2, type, key) { - if (shouldTrack && activeSub) { - let depsMap = targetMap.get(target2); - if (!depsMap) { - targetMap.set(target2, depsMap = /* @__PURE__ */ new Map()); - } - let dep = depsMap.get(key); - if (!dep) { - depsMap.set(key, dep = new Dep()); - dep.map = depsMap; - dep.key = key; - } - if (false) { - dep.track({ - target: target2, - type, - key - }); - } else { - dep.track(); - } - } -} -__name(track, "track"); -function trigger(target2, type, key, newValue2, oldValue, oldTarget) { - const depsMap = targetMap.get(target2); - if (!depsMap) { - globalVersion++; - return; - } - const run2 = /* @__PURE__ */ __name((dep) => { - if (dep) { - if (false) { - dep.trigger({ - target: target2, - type, - key, - newValue: newValue2, - oldValue, - oldTarget - }); - } else { - dep.trigger(); - } - } - }, "run"); - startBatch(); - if (type === "clear") { - depsMap.forEach(run2); - } else { - const targetIsArray = isArray$b(target2); - const isArrayIndex = targetIsArray && isIntegerKey(key); - if (targetIsArray && key === "length") { - const newLength = Number(newValue2); - depsMap.forEach((dep, key2) => { - if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol$1(key2) && key2 >= newLength) { - run2(dep); - } - }); - } else { - if (key !== void 0 || depsMap.has(void 0)) { - run2(depsMap.get(key)); - } - if (isArrayIndex) { - run2(depsMap.get(ARRAY_ITERATE_KEY)); - } - switch (type) { - case "add": - if (!targetIsArray) { - run2(depsMap.get(ITERATE_KEY)); - if (isMap$3(target2)) { - run2(depsMap.get(MAP_KEY_ITERATE_KEY)); - } - } else if (isArrayIndex) { - run2(depsMap.get("length")); - } - break; - case "delete": - if (!targetIsArray) { - run2(depsMap.get(ITERATE_KEY)); - if (isMap$3(target2)) { - run2(depsMap.get(MAP_KEY_ITERATE_KEY)); - } - } - break; - case "set": - if (isMap$3(target2)) { - run2(depsMap.get(ITERATE_KEY)); - } - break; - } - } - } - endBatch(); -} -__name(trigger, "trigger"); -function getDepFromReactive(object, key) { - const depMap = targetMap.get(object); - return depMap && depMap.get(key); -} -__name(getDepFromReactive, "getDepFromReactive"); -function reactiveReadArray(array) { - const raw = toRaw(array); - if (raw === array) return raw; - track(raw, "iterate", ARRAY_ITERATE_KEY); - return isShallow(array) ? raw : raw.map(toReactive$1); -} -__name(reactiveReadArray, "reactiveReadArray"); -function shallowReadArray(arr) { - track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY); - return arr; -} -__name(shallowReadArray, "shallowReadArray"); -const arrayInstrumentations = { - __proto__: null, - [Symbol.iterator]() { - return iterator(this, Symbol.iterator, toReactive$1); - }, - concat(...args) { - return reactiveReadArray(this).concat( - ...args.map((x2) => isArray$b(x2) ? reactiveReadArray(x2) : x2) - ); - }, - entries() { - return iterator(this, "entries", (value4) => { - value4[1] = toReactive$1(value4[1]); - return value4; - }); - }, - every(fn, thisArg) { - return apply$2(this, "every", fn, thisArg, void 0, arguments); - }, - filter(fn, thisArg) { - return apply$2(this, "filter", fn, thisArg, (v2) => v2.map(toReactive$1), arguments); - }, - find(fn, thisArg) { - return apply$2(this, "find", fn, thisArg, toReactive$1, arguments); - }, - findIndex(fn, thisArg) { - return apply$2(this, "findIndex", fn, thisArg, void 0, arguments); - }, - findLast(fn, thisArg) { - return apply$2(this, "findLast", fn, thisArg, toReactive$1, arguments); - }, - findLastIndex(fn, thisArg) { - return apply$2(this, "findLastIndex", fn, thisArg, void 0, arguments); - }, - // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement - forEach(fn, thisArg) { - return apply$2(this, "forEach", fn, thisArg, void 0, arguments); - }, - includes(...args) { - return searchProxy(this, "includes", args); - }, - indexOf(...args) { - return searchProxy(this, "indexOf", args); - }, - join(separator) { - return reactiveReadArray(this).join(separator); - }, - // keys() iterator only reads `length`, no optimisation required - lastIndexOf(...args) { - return searchProxy(this, "lastIndexOf", args); - }, - map(fn, thisArg) { - return apply$2(this, "map", fn, thisArg, void 0, arguments); - }, - pop() { - return noTracking(this, "pop"); - }, - push(...args) { - return noTracking(this, "push", args); - }, - reduce(fn, ...args) { - return reduce(this, "reduce", fn, args); - }, - reduceRight(fn, ...args) { - return reduce(this, "reduceRight", fn, args); - }, - shift() { - return noTracking(this, "shift"); - }, - // slice could use ARRAY_ITERATE but also seems to beg for range tracking - some(fn, thisArg) { - return apply$2(this, "some", fn, thisArg, void 0, arguments); - }, - splice(...args) { - return noTracking(this, "splice", args); - }, - toReversed() { - return reactiveReadArray(this).toReversed(); - }, - toSorted(comparer) { - return reactiveReadArray(this).toSorted(comparer); - }, - toSpliced(...args) { - return reactiveReadArray(this).toSpliced(...args); - }, - unshift(...args) { - return noTracking(this, "unshift", args); - }, - values() { - return iterator(this, "values", toReactive$1); - } -}; -function iterator(self2, method, wrapValue) { - const arr = shallowReadArray(self2); - const iter = arr[method](); - if (arr !== self2 && !isShallow(self2)) { - iter._next = iter.next; - iter.next = () => { - const result = iter._next(); - if (result.value) { - result.value = wrapValue(result.value); - } - return result; - }; - } - return iter; -} -__name(iterator, "iterator"); -const arrayProto$1 = Array.prototype; -function apply$2(self2, method, fn, thisArg, wrappedRetFn, args) { - const arr = shallowReadArray(self2); - const needsWrap = arr !== self2 && !isShallow(self2); - const methodFn = arr[method]; - if (methodFn !== arrayProto$1[method]) { - const result2 = methodFn.apply(self2, args); - return needsWrap ? toReactive$1(result2) : result2; - } - let wrappedFn = fn; - if (arr !== self2) { - if (needsWrap) { - wrappedFn = /* @__PURE__ */ __name(function(item3, index2) { - return fn.call(this, toReactive$1(item3), index2, self2); - }, "wrappedFn"); - } else if (fn.length > 2) { - wrappedFn = /* @__PURE__ */ __name(function(item3, index2) { - return fn.call(this, item3, index2, self2); - }, "wrappedFn"); - } - } - const result = methodFn.call(arr, wrappedFn, thisArg); - return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result; -} -__name(apply$2, "apply$2"); -function reduce(self2, method, fn, args) { - const arr = shallowReadArray(self2); - let wrappedFn = fn; - if (arr !== self2) { - if (!isShallow(self2)) { - wrappedFn = /* @__PURE__ */ __name(function(acc, item3, index2) { - return fn.call(this, acc, toReactive$1(item3), index2, self2); - }, "wrappedFn"); - } else if (fn.length > 3) { - wrappedFn = /* @__PURE__ */ __name(function(acc, item3, index2) { - return fn.call(this, acc, item3, index2, self2); - }, "wrappedFn"); - } - } - return arr[method](wrappedFn, ...args); -} -__name(reduce, "reduce"); -function searchProxy(self2, method, args) { - const arr = toRaw(self2); - track(arr, "iterate", ARRAY_ITERATE_KEY); - const res = arr[method](...args); - if ((res === -1 || res === false) && isProxy(args[0])) { - args[0] = toRaw(args[0]); - return arr[method](...args); - } - return res; -} -__name(searchProxy, "searchProxy"); -function noTracking(self2, method, args = []) { - pauseTracking(); - startBatch(); - const res = toRaw(self2)[method].apply(self2, args); - endBatch(); - resetTracking(); - return res; -} -__name(noTracking, "noTracking"); -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) -); -function hasOwnProperty$c(key) { - if (!isSymbol$1(key)) key = String(key); - const obj = toRaw(this); - track(obj, "has", key); - return obj.hasOwnProperty(key); -} -__name(hasOwnProperty$c, "hasOwnProperty$c"); -class BaseReactiveHandler { - static { - __name(this, "BaseReactiveHandler"); - } - constructor(_isReadonly = false, _isShallow = false) { - this._isReadonly = _isReadonly; - this._isShallow = _isShallow; - } - get(target2, key, receiver) { - if (key === "__v_skip") return target2["__v_skip"]; - 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(target2) || // receiver is not the reactive proxy, but has the same prototype - // this means the receiver is a user proxy of the reactive proxy - Object.getPrototypeOf(target2) === Object.getPrototypeOf(receiver)) { - return target2; - } - return; - } - const targetIsArray = isArray$b(target2); - if (!isReadonly2) { - let fn; - if (targetIsArray && (fn = arrayInstrumentations[key])) { - return fn; - } - if (key === "hasOwnProperty") { - return hasOwnProperty$c; - } - } - const res = Reflect.get( - target2, - key, - // if this is a proxy wrapping a ref, return methods using the raw ref - // as receiver so that we don't have to call `toRaw` on the ref in all - // its class methods - isRef(target2) ? target2 : receiver - ); - if (isSymbol$1(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { - return res; - } - if (!isReadonly2) { - track(target2, "get", key); - } - if (isShallow2) { - return res; - } - if (isRef(res)) { - return targetIsArray && isIntegerKey(key) ? res : res.value; - } - if (isObject$f(res)) { - return isReadonly2 ? readonly(res) : reactive(res); - } - return res; - } -} -class MutableReactiveHandler extends BaseReactiveHandler { - static { - __name(this, "MutableReactiveHandler"); - } - constructor(isShallow2 = false) { - super(false, isShallow2); - } - set(target2, key, value4, receiver) { - let oldValue = target2[key]; - if (!this._isShallow) { - const isOldValueReadonly = isReadonly(oldValue); - if (!isShallow(value4) && !isReadonly(value4)) { - oldValue = toRaw(oldValue); - value4 = toRaw(value4); - } - if (!isArray$b(target2) && isRef(oldValue) && !isRef(value4)) { - if (isOldValueReadonly) { - return false; - } else { - oldValue.value = value4; - return true; - } - } - } - const hadKey = isArray$b(target2) && isIntegerKey(key) ? Number(key) < target2.length : hasOwn$3(target2, key); - const result = Reflect.set( - target2, - key, - value4, - isRef(target2) ? target2 : receiver - ); - if (target2 === toRaw(receiver)) { - if (!hadKey) { - trigger(target2, "add", key, value4); - } else if (hasChanged(value4, oldValue)) { - trigger(target2, "set", key, value4, oldValue); - } - } - return result; - } - deleteProperty(target2, key) { - const hadKey = hasOwn$3(target2, key); - const oldValue = target2[key]; - const result = Reflect.deleteProperty(target2, key); - if (result && hadKey) { - trigger(target2, "delete", key, void 0, oldValue); - } - return result; - } - has(target2, key) { - const result = Reflect.has(target2, key); - if (!isSymbol$1(key) || !builtInSymbols.has(key)) { - track(target2, "has", key); - } - return result; - } - ownKeys(target2) { - track( - target2, - "iterate", - isArray$b(target2) ? "length" : ITERATE_KEY - ); - return Reflect.ownKeys(target2); - } -} -class ReadonlyReactiveHandler extends BaseReactiveHandler { - static { - __name(this, "ReadonlyReactiveHandler"); - } - constructor(isShallow2 = false) { - super(true, isShallow2); - } - set(target2, key) { - if (false) { - warn$4( - `Set operation on key "${String(key)}" failed: target is readonly.`, - target2 - ); - } - return true; - } - deleteProperty(target2, key) { - if (false) { - warn$4( - `Delete operation on key "${String(key)}" failed: target is readonly.`, - target2 - ); - } - 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((value4) => value4, "toShallow"); -const getProto = /* @__PURE__ */ __name((v2) => Reflect.getPrototypeOf(v2), "getProto"); -function createIterableMethod(method, isReadonly2, isShallow2) { - return function(...args) { - const target2 = this["__v_raw"]; - const rawTarget = toRaw(target2); - const targetIsMap = isMap$3(rawTarget); - const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; - const isKeyOnly = method === "keys" && targetIsMap; - const innerIterator = target2[method](...args); - const wrap2 = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive$1; - !isReadonly2 && track( - rawTarget, - "iterate", - isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY - ); - return { - // iterator protocol - next() { - const { value: value4, done } = innerIterator.next(); - return done ? { value: value4, done } : { - value: isPair ? [wrap2(value4[0]), wrap2(value4[1])] : wrap2(value4), - 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$4( - `${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(readonly2, shallow) { - const instrumentations = { - get(key) { - const target2 = this["__v_raw"]; - const rawTarget = toRaw(target2); - const rawKey = toRaw(key); - if (!readonly2) { - if (hasChanged(key, rawKey)) { - track(rawTarget, "get", key); - } - track(rawTarget, "get", rawKey); - } - const { has: has2 } = getProto(rawTarget); - const wrap2 = shallow ? toShallow : readonly2 ? toReadonly : toReactive$1; - if (has2.call(rawTarget, key)) { - return wrap2(target2.get(key)); - } else if (has2.call(rawTarget, rawKey)) { - return wrap2(target2.get(rawKey)); - } else if (target2 !== rawTarget) { - target2.get(key); - } - }, - get size() { - const target2 = this["__v_raw"]; - !readonly2 && track(toRaw(target2), "iterate", ITERATE_KEY); - return Reflect.get(target2, "size", target2); - }, - has(key) { - const target2 = this["__v_raw"]; - const rawTarget = toRaw(target2); - const rawKey = toRaw(key); - if (!readonly2) { - if (hasChanged(key, rawKey)) { - track(rawTarget, "has", key); - } - track(rawTarget, "has", rawKey); - } - return key === rawKey ? target2.has(key) : target2.has(key) || target2.has(rawKey); - }, - forEach(callback, thisArg) { - const observed = this; - const target2 = observed["__v_raw"]; - const rawTarget = toRaw(target2); - const wrap2 = shallow ? toShallow : readonly2 ? toReadonly : toReactive$1; - !readonly2 && track(rawTarget, "iterate", ITERATE_KEY); - return target2.forEach((value4, key) => { - return callback.call(thisArg, wrap2(value4), wrap2(key), observed); - }); - } - }; - extend$1( - instrumentations, - readonly2 ? { - add: createReadonlyMethod("add"), - set: createReadonlyMethod("set"), - delete: createReadonlyMethod("delete"), - clear: createReadonlyMethod("clear") - } : { - add(value4) { - if (!shallow && !isShallow(value4) && !isReadonly(value4)) { - value4 = toRaw(value4); - } - const target2 = toRaw(this); - const proto = getProto(target2); - const hadKey = proto.has.call(target2, value4); - if (!hadKey) { - target2.add(value4); - trigger(target2, "add", value4, value4); - } - return this; - }, - set(key, value4) { - if (!shallow && !isShallow(value4) && !isReadonly(value4)) { - value4 = toRaw(value4); - } - const target2 = toRaw(this); - const { has: has2, get: get3 } = getProto(target2); - let hadKey = has2.call(target2, key); - if (!hadKey) { - key = toRaw(key); - hadKey = has2.call(target2, key); - } else if (false) { - checkIdentityKeys(target2, has2, key); - } - const oldValue = get3.call(target2, key); - target2.set(key, value4); - if (!hadKey) { - trigger(target2, "add", key, value4); - } else if (hasChanged(value4, oldValue)) { - trigger(target2, "set", key, value4, oldValue); - } - return this; - }, - delete(key) { - const target2 = toRaw(this); - const { has: has2, get: get3 } = getProto(target2); - let hadKey = has2.call(target2, key); - if (!hadKey) { - key = toRaw(key); - hadKey = has2.call(target2, key); - } else if (false) { - checkIdentityKeys(target2, has2, key); - } - const oldValue = get3 ? get3.call(target2, key) : void 0; - const result = target2.delete(key); - if (hadKey) { - trigger(target2, "delete", key, void 0, oldValue); - } - return result; - }, - clear() { - const target2 = toRaw(this); - const hadItems = target2.size !== 0; - const oldTarget = false ? isMap$3(target2) ? new Map(target2) : new Set(target2) : void 0; - const result = target2.clear(); - if (hadItems) { - trigger( - target2, - "clear", - void 0, - void 0, - oldTarget - ); - } - return result; - } - } - ); - const iteratorMethods = [ - "keys", - "values", - "entries", - Symbol.iterator - ]; - iteratorMethods.forEach((method) => { - instrumentations[method] = createIterableMethod(method, readonly2, shallow); - }); - return instrumentations; -} -__name(createInstrumentations, "createInstrumentations"); -function createInstrumentationGetter(isReadonly2, shallow) { - const instrumentations = createInstrumentations(isReadonly2, shallow); - return (target2, key, receiver) => { - if (key === "__v_isReactive") { - return !isReadonly2; - } else if (key === "__v_isReadonly") { - return isReadonly2; - } else if (key === "__v_raw") { - return target2; - } - return Reflect.get( - hasOwn$3(instrumentations, key) && key in target2 ? instrumentations : target2, - 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(target2, has2, key) { - const rawKey = toRaw(key); - if (rawKey !== key && has2.call(target2, rawKey)) { - const type = toRawType(target2); - warn$4( - `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(value4) { - return value4["__v_skip"] || !Object.isExtensible(value4) ? 0 : targetTypeMap(toRawType(value4)); -} -__name(getTargetType, "getTargetType"); -function reactive(target2) { - if (isReadonly(target2)) { - return target2; - } - return createReactiveObject( - target2, - false, - mutableHandlers, - mutableCollectionHandlers, - reactiveMap - ); -} -__name(reactive, "reactive"); -function shallowReactive(target2) { - return createReactiveObject( - target2, - false, - shallowReactiveHandlers, - shallowCollectionHandlers, - shallowReactiveMap - ); -} -__name(shallowReactive, "shallowReactive"); -function readonly(target2) { - return createReactiveObject( - target2, - true, - readonlyHandlers, - readonlyCollectionHandlers, - readonlyMap - ); -} -__name(readonly, "readonly"); -function shallowReadonly(target2) { - return createReactiveObject( - target2, - true, - shallowReadonlyHandlers, - shallowReadonlyCollectionHandlers, - shallowReadonlyMap - ); -} -__name(shallowReadonly, "shallowReadonly"); -function createReactiveObject(target2, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { - if (!isObject$f(target2)) { - if (false) { - warn$4( - `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String( - target2 - )}` - ); - } - return target2; - } - if (target2["__v_raw"] && !(isReadonly2 && target2["__v_isReactive"])) { - return target2; - } - const existingProxy = proxyMap.get(target2); - if (existingProxy) { - return existingProxy; - } - const targetType = getTargetType(target2); - if (targetType === 0) { - return target2; - } - const proxy = new Proxy( - target2, - targetType === 2 ? collectionHandlers : baseHandlers - ); - proxyMap.set(target2, proxy); - return proxy; -} -__name(createReactiveObject, "createReactiveObject"); -function isReactive(value4) { - if (isReadonly(value4)) { - return isReactive(value4["__v_raw"]); - } - return !!(value4 && value4["__v_isReactive"]); -} -__name(isReactive, "isReactive"); -function isReadonly(value4) { - return !!(value4 && value4["__v_isReadonly"]); -} -__name(isReadonly, "isReadonly"); -function isShallow(value4) { - return !!(value4 && value4["__v_isShallow"]); -} -__name(isShallow, "isShallow"); -function isProxy(value4) { - return value4 ? !!value4["__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(value4) { - if (!hasOwn$3(value4, "__v_skip") && Object.isExtensible(value4)) { - def(value4, "__v_skip", true); - } - return value4; -} -__name(markRaw, "markRaw"); -const toReactive$1 = /* @__PURE__ */ __name((value4) => isObject$f(value4) ? reactive(value4) : value4, "toReactive$1"); -const toReadonly = /* @__PURE__ */ __name((value4) => isObject$f(value4) ? readonly(value4) : value4, "toReadonly"); -function isRef(r2) { - return r2 ? r2["__v_isRef"] === true : false; -} -__name(isRef, "isRef"); -function ref(value4) { - return createRef(value4, false); -} -__name(ref, "ref"); -function shallowRef(value4) { - return createRef(value4, 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(value4, isShallow2) { - this.dep = new Dep(); - this["__v_isRef"] = true; - this["__v_isShallow"] = false; - this._rawValue = isShallow2 ? value4 : toRaw(value4); - this._value = isShallow2 ? value4 : toReactive$1(value4); - this["__v_isShallow"] = isShallow2; - } - get value() { - if (false) { - this.dep.track({ - target: this, - type: "get", - key: "value" - }); - } else { - this.dep.track(); - } - return this._value; - } - set value(newValue2) { - const oldValue = this._rawValue; - const useDirectValue = this["__v_isShallow"] || isShallow(newValue2) || isReadonly(newValue2); - newValue2 = useDirectValue ? newValue2 : toRaw(newValue2); - if (hasChanged(newValue2, oldValue)) { - this._rawValue = newValue2; - this._value = useDirectValue ? newValue2 : toReactive$1(newValue2); - if (false) { - this.dep.trigger({ - target: this, - type: "set", - key: "value", - newValue: newValue2, - oldValue - }); - } else { - this.dep.trigger(); - } - } - } -} -function triggerRef(ref2) { - if (ref2.dep) { - if (false) { - ref2.dep.trigger({ - target: ref2, - type: "set", - key: "value", - newValue: ref2._value - }); - } else { - ref2.dep.trigger(); - } - } -} -__name(triggerRef, "triggerRef"); -function unref(ref2) { - return isRef(ref2) ? ref2.value : ref2; -} -__name(unref, "unref"); -function toValue$4(source) { - return isFunction$c(source) ? source() : unref(source); -} -__name(toValue$4, "toValue$4"); -const shallowUnwrapHandlers = { - get: /* @__PURE__ */ __name((target2, key, receiver) => key === "__v_raw" ? target2 : unref(Reflect.get(target2, key, receiver)), "get"), - set: /* @__PURE__ */ __name((target2, key, value4, receiver) => { - const oldValue = target2[key]; - if (isRef(oldValue) && !isRef(value4)) { - oldValue.value = value4; - return true; - } else { - return Reflect.set(target2, key, value4, 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["__v_isRef"] = true; - this._value = void 0; - const dep = this.dep = new Dep(); - const { get: get3, set: set3 } = factory(dep.track.bind(dep), dep.trigger.bind(dep)); - this._get = get3; - this._set = set3; - } - get value() { - return this._value = 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$4(`toRefs() expects a reactive object but received a plain one.`); - } - const ret = isArray$b(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; - this._value = void 0; - } - get value() { - const val = this._object[this._key]; - return this._value = 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; - this._value = void 0; - } - get value() { - return this._value = this._getter(); - } -} -function toRef$1(source, key, defaultValue2) { - if (isRef(source)) { - return source; - } else if (isFunction$c(source)) { - return new GetterRefImpl(source); - } else if (isObject$f(source) && arguments.length > 1) { - return propertyToRef(source, key, defaultValue2); - } else { - return ref(source); - } -} -__name(toRef$1, "toRef$1"); -function propertyToRef(source, key, defaultValue2) { - const val = source[key]; - return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue2); -} -__name(propertyToRef, "propertyToRef"); -class ComputedRefImpl { - static { - __name(this, "ComputedRefImpl"); - } - constructor(fn, setter, isSSR) { - this.fn = fn; - this.setter = setter; - this._value = void 0; - this.dep = new Dep(this); - this.__v_isRef = true; - this.deps = void 0; - this.depsTail = void 0; - this.flags = 16; - this.globalVersion = globalVersion - 1; - this.next = void 0; - this.effect = this; - this["__v_isReadonly"] = !setter; - this.isSSR = isSSR; - } - /** - * @internal - */ - notify() { - this.flags |= 16; - if (!(this.flags & 8) && // avoid infinite self recursion - activeSub !== this) { - batch(this, true); - return true; - } else if (false) ; - } - get value() { - const link2 = false ? this.dep.track({ - target: this, - type: "get", - key: "value" - }) : this.dep.track(); - refreshComputed(this); - if (link2) { - link2.version = this.dep.version; - } - return this._value; - } - set value(newValue2) { - if (this.setter) { - this.setter(newValue2); - } else if (false) { - warn$4("Write operation failed: computed value is readonly"); - } - } -} -function computed$1(getterOrOptions, debugOptions, isSSR = false) { - let getter; - let setter; - if (isFunction$c(getterOrOptions)) { - getter = getterOrOptions; - } else { - getter = getterOrOptions.get; - setter = getterOrOptions.set; - } - const cRef = new ComputedRefImpl(getter, setter, isSSR); - if (false) { - cRef.onTrack = debugOptions.onTrack; - cRef.onTrigger = debugOptions.onTrigger; - } - return cRef; -} -__name(computed$1, "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", - "IS_REF": "__v_isRef" -}; -const WatchErrorCodes = { - "WATCH_GETTER": 2, - "2": "WATCH_GETTER", - "WATCH_CALLBACK": 3, - "3": "WATCH_CALLBACK", - "WATCH_CLEANUP": 4, - "4": "WATCH_CLEANUP" -}; -const INITIAL_WATCHER_VALUE = {}; -const cleanupMap = /* @__PURE__ */ new WeakMap(); -let activeWatcher = void 0; -function getCurrentWatcher() { - return activeWatcher; -} -__name(getCurrentWatcher, "getCurrentWatcher"); -function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) { - if (owner) { - let cleanups = cleanupMap.get(owner); - if (!cleanups) cleanupMap.set(owner, cleanups = []); - cleanups.push(cleanupFn); - } else if (false) { - warn$4( - `onWatcherCleanup() was called when there was no active watcher to associate with.` - ); - } -} -__name(onWatcherCleanup, "onWatcherCleanup"); -function watch$1(source, cb, options4 = EMPTY_OBJ) { - const { immediate, deep, once: once2, scheduler, augmentJob, call } = options4; - const warnInvalidSource = /* @__PURE__ */ __name((s2) => { - (options4.onWarn || warn$4)( - `Invalid watch source: `, - s2, - `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.` - ); - }, "warnInvalidSource"); - const reactiveGetter = /* @__PURE__ */ __name((source2) => { - if (deep) return source2; - if (isShallow(source2) || deep === false || deep === 0) - return traverse(source2, 1); - return traverse(source2); - }, "reactiveGetter"); - let effect2; - let getter; - let cleanup; - let boundCleanup; - let forceTrigger = false; - let isMultiSource = false; - if (isRef(source)) { - getter = /* @__PURE__ */ __name(() => source.value, "getter"); - forceTrigger = isShallow(source); - } else if (isReactive(source)) { - getter = /* @__PURE__ */ __name(() => reactiveGetter(source), "getter"); - forceTrigger = true; - } else if (isArray$b(source)) { - isMultiSource = true; - forceTrigger = source.some((s2) => isReactive(s2) || isShallow(s2)); - getter = /* @__PURE__ */ __name(() => source.map((s2) => { - if (isRef(s2)) { - return s2.value; - } else if (isReactive(s2)) { - return reactiveGetter(s2); - } else if (isFunction$c(s2)) { - return call ? call(s2, 2) : s2(); - } else { - } - }), "getter"); - } else if (isFunction$c(source)) { - if (cb) { - getter = call ? () => call(source, 2) : source; - } else { - getter = /* @__PURE__ */ __name(() => { - if (cleanup) { - pauseTracking(); - try { - cleanup(); - } finally { - resetTracking(); - } - } - const currentEffect = activeWatcher; - activeWatcher = effect2; - try { - return call ? call(source, 3, [boundCleanup]) : source(boundCleanup); - } finally { - activeWatcher = currentEffect; - } - }, "getter"); - } - } else { - getter = NOOP; - } - if (cb && deep) { - const baseGetter = getter; - const depth = deep === true ? Infinity : deep; - getter = /* @__PURE__ */ __name(() => traverse(baseGetter(), depth), "getter"); - } - const scope = getCurrentScope(); - const watchHandle = /* @__PURE__ */ __name(() => { - effect2.stop(); - if (scope && scope.active) { - remove$2(scope.effects, effect2); - } - }, "watchHandle"); - if (once2 && cb) { - const _cb = cb; - cb = /* @__PURE__ */ __name((...args) => { - _cb(...args); - watchHandle(); - }, "cb"); - } - let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE; - const job = /* @__PURE__ */ __name((immediateFirstRun) => { - if (!(effect2.flags & 1) || !effect2.dirty && !immediateFirstRun) { - return; - } - if (cb) { - const newValue2 = effect2.run(); - if (deep || forceTrigger || (isMultiSource ? newValue2.some((v2, i2) => hasChanged(v2, oldValue[i2])) : hasChanged(newValue2, oldValue))) { - if (cleanup) { - cleanup(); - } - const currentWatcher = activeWatcher; - activeWatcher = effect2; - try { - const args = [ - newValue2, - // pass undefined as the old value when it's changed for the first time - oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, - boundCleanup - ]; - call ? call(cb, 3, args) : ( - // @ts-expect-error - cb(...args) - ); - oldValue = newValue2; - } finally { - activeWatcher = currentWatcher; - } - } - } else { - effect2.run(); - } - }, "job"); - if (augmentJob) { - augmentJob(job); - } - effect2 = new ReactiveEffect(getter); - effect2.scheduler = scheduler ? () => scheduler(job, false) : job; - boundCleanup = /* @__PURE__ */ __name((fn) => onWatcherCleanup(fn, false, effect2), "boundCleanup"); - cleanup = effect2.onStop = () => { - const cleanups = cleanupMap.get(effect2); - if (cleanups) { - if (call) { - call(cleanups, 4); - } else { - for (const cleanup2 of cleanups) cleanup2(); - } - cleanupMap.delete(effect2); - } - }; - if (false) { - effect2.onTrack = options4.onTrack; - effect2.onTrigger = options4.onTrigger; - } - if (cb) { - if (immediate) { - job(true); - } else { - oldValue = effect2.run(); - } - } else if (scheduler) { - scheduler(job.bind(null, true), true); - } else { - effect2.run(); - } - watchHandle.pause = effect2.pause.bind(effect2); - watchHandle.resume = effect2.resume.bind(effect2); - watchHandle.stop = watchHandle; - return watchHandle; -} -__name(watch$1, "watch$1"); -function traverse(value4, depth = Infinity, seen2) { - if (depth <= 0 || !isObject$f(value4) || value4["__v_skip"]) { - return value4; - } - seen2 = seen2 || /* @__PURE__ */ new Set(); - if (seen2.has(value4)) { - return value4; - } - seen2.add(value4); - depth--; - if (isRef(value4)) { - traverse(value4.value, depth, seen2); - } else if (isArray$b(value4)) { - for (let i2 = 0; i2 < value4.length; i2++) { - traverse(value4[i2], depth, seen2); - } - } else if (isSet$3(value4) || isMap$3(value4)) { - value4.forEach((v2) => { - traverse(v2, depth, seen2); - }); - } else if (isPlainObject$4(value4)) { - for (const key in value4) { - traverse(value4[key], depth, seen2); - } - for (const key of Object.getOwnPropertySymbols(value4)) { - if (Object.prototype.propertyIsEnumerable.call(value4, key)) { - traverse(value4[key], depth, seen2); - } - } - } - return value4; -} -__name(traverse, "traverse"); -/** -* @vue/runtime-core v3.5.13 -* (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"); -let isWarning = false; -function warn$1$1(msg, ...args) { - if (isWarning) return; - isWarning = true; - 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((a2) => { - var _a2, _b; - return (_b = (_a2 = a2.toString) == null ? void 0 : _a2.call(a2)) != null ? _b : JSON.stringify(a2); - }).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(); - isWarning = false; -} -__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, i2) => { - logs.push(...i2 === 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 close5 = `>` + postfix; - return vnode.props ? [open2, ...formatProps(vnode.props), close5] : [open2 + close5]; -} -__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, value4, raw) { - if (isString$9(value4)) { - value4 = JSON.stringify(value4); - return raw ? value4 : [`${key}=${value4}`]; - } else if (typeof value4 === "number" || typeof value4 === "boolean" || value4 == null) { - return raw ? value4 : [`${key}=${value4}`]; - } else if (isRef(value4)) { - value4 = formatProp(key, toRaw(value4.value), true); - return raw ? value4 : [`${key}=Ref<`, value4, `>`]; - } else if (isFunction$c(value4)) { - return [`${key}=fn${value4.name ? `<${value4.name}>` : ``}`]; - } else { - value4 = toRaw(value4); - return raw ? value4 : [`${key}=`, value4]; - } -} -__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", - "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", - "COMPONENT_UPDATE": 15, - "15": "COMPONENT_UPDATE", - "APP_UNMOUNT_CLEANUP": 16, - "16": "APP_UNMOUNT_CLEANUP" -}; -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", - [15]: "component update", - [16]: "app unmount cleanup function" -}; -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$c(fn)) { - const res = callWithErrorHandling(fn, instance, type, args); - if (res && isPromise$1(res)) { - res.catch((err) => { - handleError(err, instance, type); - }); - } - return res; - } - if (isArray$b(fn)) { - const values = []; - for (let i2 = 0; i2 < fn.length; i2++) { - values.push(callWithAsyncErrorHandling(fn[i2], 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; - const { errorHandler: errorHandler2, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ; - 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 i2 = 0; i2 < errorCapturedHooks.length; i2++) { - if (errorCapturedHooks[i2](err, exposedInstance, errorInfo) === false) { - return; - } - } - } - cur = cur.parent; - } - if (errorHandler2) { - pauseTracking(); - callWithErrorHandling(errorHandler2, null, 10, [ - err, - exposedInstance, - errorInfo - ]); - resetTracking(); - return; - } - } - logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction); -} -__name(handleError, "handleError"); -function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) { - 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 if (throwInProd) { - throw err; - } else { - console.error(err); - } -} -__name(logError, "logError"); -const queue = []; -let flushIndex = -1; -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.flags & 2) { - start2 = middle + 1; - } else { - end = middle; - } - } - return start2; -} -__name(findInsertionIndex$1, "findInsertionIndex$1"); -function queueJob(job) { - if (!(job.flags & 1)) { - const jobId = getId(job); - const lastJob = queue[queue.length - 1]; - if (!lastJob || // fast path when the job id is larger than the tail - !(job.flags & 2) && jobId >= getId(lastJob)) { - queue.push(job); - } else { - queue.splice(findInsertionIndex$1(jobId), 0, job); - } - job.flags |= 1; - queueFlush(); - } -} -__name(queueJob, "queueJob"); -function queueFlush() { - if (!currentFlushPromise) { - currentFlushPromise = resolvedPromise.then(flushJobs); - } -} -__name(queueFlush, "queueFlush"); -function queuePostFlushCb(cb) { - if (!isArray$b(cb)) { - if (activePostFlushCbs && cb.id === -1) { - activePostFlushCbs.splice(postFlushIndex + 1, 0, cb); - } else if (!(cb.flags & 1)) { - pendingPostFlushCbs.push(cb); - cb.flags |= 1; - } - } else { - pendingPostFlushCbs.push(...cb); - } - queueFlush(); -} -__name(queuePostFlushCb, "queuePostFlushCb"); -function flushPreFlushCbs(instance, seen2, i2 = flushIndex + 1) { - if (false) { - seen2 = seen2 || /* @__PURE__ */ new Map(); - } - for (; i2 < queue.length; i2++) { - const cb = queue[i2]; - if (cb && cb.flags & 2) { - if (instance && cb.id !== instance.uid) { - continue; - } - if (false) { - continue; - } - queue.splice(i2, 1); - i2--; - if (cb.flags & 4) { - cb.flags &= ~1; - } - cb(); - if (!(cb.flags & 4)) { - cb.flags &= ~1; - } - } - } -} -__name(flushPreFlushCbs, "flushPreFlushCbs"); -function flushPostFlushCbs(seen2) { - if (pendingPostFlushCbs.length) { - const deduped = [...new Set(pendingPostFlushCbs)].sort( - (a2, b2) => getId(a2) - getId(b2) - ); - 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.flags & 4) { - cb.flags &= ~1; - } - if (!(cb.flags & 8)) cb(); - cb.flags &= ~1; - } - activePostFlushCbs = null; - postFlushIndex = 0; - } -} -__name(flushPostFlushCbs, "flushPostFlushCbs"); -const getId = /* @__PURE__ */ __name((job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id, "getId"); -function flushJobs(seen2) { - if (false) { - seen2 = seen2 || /* @__PURE__ */ new Map(); - } - const check = false ? (job) => checkRecursiveUpdates(seen2, job) : NOOP; - try { - for (flushIndex = 0; flushIndex < queue.length; flushIndex++) { - const job = queue[flushIndex]; - if (job && !(job.flags & 8)) { - if (false) { - continue; - } - if (job.flags & 4) { - job.flags &= ~1; - } - callWithErrorHandling( - job, - job.i, - job.i ? 15 : 14 - ); - if (!(job.flags & 4)) { - job.flags &= ~1; - } - } - } - } finally { - for (; flushIndex < queue.length; flushIndex++) { - const job = queue[flushIndex]; - if (job) { - job.flags &= ~1; - } - } - flushIndex = -1; - queue.length = 0; - flushPostFlushCbs(seen2); - currentFlushPromise = null; - if (queue.length || pendingPostFlushCbs.length) { - flushJobs(seen2); - } - } -} -__name(flushJobs, "flushJobs"); -function checkRecursiveUpdates(seen2, fn) { - const count = seen2.get(fn) || 0; - if (count > RECURSION_LIMIT) { - const instance = fn.i; - 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; - } - seen2.set(fn, count + 1); - return false; -} -__name(checkRecursiveUpdates, "checkRecursiveUpdates"); -let isHmrUpdating = false; -const hmrDirtyComponents = /* @__PURE__ */ new Map(); -if (false) { - getGlobalThis$1().__VUE_HMR_RUNTIME__ = { - createRecord: tryWrap(createRecord), - rerender: tryWrap(rerender), - reload: tryWrap(reload) - }; -} -const map$1 = /* @__PURE__ */ new Map(); -function registerHMR(instance) { - const id3 = instance.type.__hmrId; - let record2 = map$1.get(id3); - if (!record2) { - createRecord(id3, instance.type); - record2 = map$1.get(id3); - } - record2.instances.add(instance); -} -__name(registerHMR, "registerHMR"); -function unregisterHMR(instance) { - map$1.get(instance.type.__hmrId).instances.delete(instance); -} -__name(unregisterHMR, "unregisterHMR"); -function createRecord(id3, initialDef) { - if (map$1.has(id3)) { - return false; - } - map$1.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 record2 = map$1.get(id3); - if (!record2) { - return; - } - record2.initialDef.render = newRender; - [...record2.instances].forEach((instance) => { - if (newRender) { - instance.render = newRender; - normalizeClassComponent(instance.type).render = newRender; - } - instance.renderCache = []; - isHmrUpdating = true; - instance.update(); - isHmrUpdating = false; - }); -} -__name(rerender, "rerender"); -function reload(id3, newComp) { - const record2 = map$1.get(id3); - if (!record2) return; - newComp = normalizeClassComponent(newComp); - updateComponentDef(record2.initialDef, newComp); - const instances = [...record2.instances]; - for (let i2 = 0; i2 < instances.length; i2++) { - const instance = instances[i2]; - const oldComp = normalizeClassComponent(instance.type); - let dirtyInstances = hmrDirtyComponents.get(oldComp); - if (!dirtyInstances) { - if (oldComp !== record2.initialDef) { - updateComponentDef(oldComp, newComp); - } - hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set()); - } - dirtyInstances.add(instance); - instance.appContext.propsCache.delete(instance.type); - instance.appContext.emitsCache.delete(instance.type); - instance.appContext.optionsCache.delete(instance.type); - if (instance.ceReload) { - dirtyInstances.add(instance); - instance.ceReload(newComp.styles); - dirtyInstances.delete(instance); - } else if (instance.parent) { - queueJob(() => { - isHmrUpdating = true; - instance.parent.update(); - isHmrUpdating = false; - dirtyInstances.delete(instance); - }); - } 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." - ); - } - if (instance.root.ce && instance !== instance.root) { - instance.root.ce._removeChildStyle(oldComp); - } - } - queuePostFlushCb(() => { - hmrDirtyComponents.clear(); - }); -} -__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, target2) { - var _a2, _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 = (_a2 = window.navigator) == null ? void 0 : _a2.userAgent) == null ? void 0 : _b.includes("jsdom")) - ) { - const replay = target2.__VUE_DEVTOOLS_HOOK_REPLAY__ = target2.__VUE_DEVTOOLS_HOOK_REPLAY__ || []; - replay.push((newHook) => { - setDevtoolsHook$1(newHook, target2); - }); - setTimeout(() => { - if (!devtools$1) { - target2.__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: Fragment$1, - Text: Text$4, - 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"); -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"); -function validateDirectiveName(name2) { - if (isBuiltInDirective(name2)) { - warn$1$1("Do not use built-in directive ids as custom directive id: " + name2); - } -} -__name(validateDirectiveName, "validateDirectiveName"); -function withDirectives(vnode, directives) { - if (currentRenderingInstance === null) { - return vnode; - } - const instance = getComponentPublicInstance(currentRenderingInstance); - const bindings = vnode.dirs || (vnode.dirs = []); - for (let i2 = 0; i2 < directives.length; i2++) { - let [dir, value4, arg, modifiers2 = EMPTY_OBJ] = directives[i2]; - if (dir) { - if (isFunction$c(dir)) { - dir = { - mounted: dir, - updated: dir - }; - } - if (dir.deep) { - traverse(value4); - } - bindings.push({ - dir, - instance, - value: value4, - oldValue: void 0, - arg, - modifiers: modifiers2 - }); - } - } - return vnode; -} -__name(withDirectives, "withDirectives"); -function invokeDirectiveHook(vnode, prevVNode, instance, name2) { - const bindings = vnode.dirs; - const oldBindings = prevVNode && prevVNode.dirs; - for (let i2 = 0; i2 < bindings.length; i2++) { - const binding = bindings[i2]; - if (oldBindings) { - binding.oldValue = oldBindings[i2].value; - } - let hook = binding.dir[name2]; - if (hook) { - pauseTracking(); - callWithAsyncErrorHandling(hook, instance, 8, [ - vnode.el, - binding, - vnode, - prevVNode - ]); - resetTracking(); - } - } -} -__name(invokeDirectiveHook, "invokeDirectiveHook"); -const TeleportEndKey = Symbol("_vte"); -const isTeleport = /* @__PURE__ */ __name((type) => type.__isTeleport, "isTeleport"); -const isTeleportDisabled = /* @__PURE__ */ __name((props) => props && (props.disabled || props.disabled === ""), "isTeleportDisabled"); -const isTeleportDeferred = /* @__PURE__ */ __name((props) => props && (props.defer || props.defer === ""), "isTeleportDeferred"); -const isTargetSVG = /* @__PURE__ */ __name((target2) => typeof SVGElement !== "undefined" && target2 instanceof SVGElement, "isTargetSVG"); -const isTargetMathML = /* @__PURE__ */ __name((target2) => typeof MathMLElement === "function" && target2 instanceof MathMLElement, "isTargetMathML"); -const resolveTarget = /* @__PURE__ */ __name((props, select) => { - const targetSelector = props && props.to; - if (isString$9(targetSelector)) { - if (!select) { - return null; - } else { - const target2 = select(targetSelector); - if (false) { - warn$1$1( - `Failed to locate Teleport target with selector "${targetSelector}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.` - ); - } - return target2; - } - } else { - if (false) { - warn$1$1(`Invalid Teleport target: ${targetSelector}`); - } - return targetSelector; - } -}, "resolveTarget"); -const TeleportImpl = { - name: "Teleport", - __isTeleport: true, - process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) { - const { - mc: mountChildren, - pc: patchChildren, - pbc: patchBlockChildren, - o: { insert: insert2, querySelector, createText, createComment } - } = internals; - const disabled2 = isTeleportDisabled(n2.props); - let { shapeFlag, children, dynamicChildren } = n2; - if (false) { - optimized = false; - dynamicChildren = null; - } - if (n1 == null) { - const placeholder = n2.el = false ? createComment("teleport start") : createText(""); - const mainAnchor = n2.anchor = false ? createComment("teleport end") : createText(""); - insert2(placeholder, container, anchor); - insert2(mainAnchor, container, anchor); - const mount2 = /* @__PURE__ */ __name((container2, anchor2) => { - if (shapeFlag & 16) { - if (parentComponent && parentComponent.isCE) { - parentComponent.ce._teleportTarget = container2; - } - mountChildren( - children, - container2, - anchor2, - parentComponent, - parentSuspense, - namespace, - slotScopeIds, - optimized - ); - } - }, "mount"); - const mountToTarget = /* @__PURE__ */ __name(() => { - const target2 = n2.target = resolveTarget(n2.props, querySelector); - const targetAnchor = prepareAnchor(target2, n2, createText, insert2); - if (target2) { - if (namespace !== "svg" && isTargetSVG(target2)) { - namespace = "svg"; - } else if (namespace !== "mathml" && isTargetMathML(target2)) { - namespace = "mathml"; - } - if (!disabled2) { - mount2(target2, targetAnchor); - updateCssVars(n2, false); - } - } else if (false) { - warn$1$1( - "Invalid Teleport target on mount:", - target2, - `(${typeof target2})` - ); - } - }, "mountToTarget"); - if (disabled2) { - mount2(container, mainAnchor); - updateCssVars(n2, true); - } - if (isTeleportDeferred(n2.props)) { - queuePostRenderEffect(() => { - mountToTarget(); - n2.el.__isMounted = true; - }, parentSuspense); - } else { - mountToTarget(); - } - } else { - if (isTeleportDeferred(n2.props) && !n1.el.__isMounted) { - queuePostRenderEffect(() => { - TeleportImpl.process( - n1, - n2, - container, - anchor, - parentComponent, - parentSuspense, - namespace, - slotScopeIds, - optimized, - internals - ); - delete n1.el.__isMounted; - }, parentSuspense); - return; - } - n2.el = n1.el; - n2.targetStart = n1.targetStart; - const mainAnchor = n2.anchor = n1.anchor; - const target2 = n2.target = n1.target; - const targetAnchor = n2.targetAnchor = n1.targetAnchor; - const wasDisabled = isTeleportDisabled(n1.props); - const currentContainer = wasDisabled ? container : target2; - const currentAnchor = wasDisabled ? mainAnchor : targetAnchor; - if (namespace === "svg" || isTargetSVG(target2)) { - namespace = "svg"; - } else if (namespace === "mathml" || isTargetMathML(target2)) { - namespace = "mathml"; - } - if (dynamicChildren) { - patchBlockChildren( - n1.dynamicChildren, - dynamicChildren, - currentContainer, - parentComponent, - parentSuspense, - namespace, - slotScopeIds - ); - traverseStaticChildren(n1, n2, true); - } else if (!optimized) { - patchChildren( - n1, - n2, - currentContainer, - currentAnchor, - parentComponent, - parentSuspense, - namespace, - slotScopeIds, - false - ); - } - if (disabled2) { - if (!wasDisabled) { - moveTeleport( - n2, - container, - mainAnchor, - internals, - 1 - ); - } else { - if (n2.props && n1.props && n2.props.to !== n1.props.to) { - n2.props.to = n1.props.to; - } - } - } else { - if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) { - const nextTarget = n2.target = resolveTarget( - n2.props, - querySelector - ); - if (nextTarget) { - moveTeleport( - n2, - nextTarget, - null, - internals, - 0 - ); - } else if (false) { - warn$1$1( - "Invalid Teleport target on update:", - target2, - `(${typeof target2})` - ); - } - } else if (wasDisabled) { - moveTeleport( - n2, - target2, - targetAnchor, - internals, - 1 - ); - } - } - updateCssVars(n2, disabled2); - } - }, - remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) { - const { - shapeFlag, - children, - anchor, - targetStart, - targetAnchor, - target: target2, - props - } = vnode; - if (target2) { - hostRemove(targetStart); - hostRemove(targetAnchor); - } - doRemove && hostRemove(anchor); - if (shapeFlag & 16) { - const shouldRemove = doRemove || !isTeleportDisabled(props); - for (let i2 = 0; i2 < children.length; i2++) { - const child = children[i2]; - unmount( - child, - parentComponent, - parentSuspense, - shouldRemove, - !!child.dynamicChildren - ); - } - } - }, - move: moveTeleport, - hydrate: hydrateTeleport -}; -function moveTeleport(vnode, container, parentAnchor, { o: { insert: insert2 }, m: move }, moveType = 2) { - if (moveType === 0) { - insert2(vnode.targetAnchor, container, parentAnchor); - } - const { el, anchor, shapeFlag, children, props } = vnode; - const isReorder = moveType === 2; - if (isReorder) { - insert2(el, container, parentAnchor); - } - if (!isReorder || isTeleportDisabled(props)) { - if (shapeFlag & 16) { - for (let i2 = 0; i2 < children.length; i2++) { - move( - children[i2], - container, - parentAnchor, - 2 - ); - } - } - } - if (isReorder) { - insert2(anchor, container, parentAnchor); - } -} -__name(moveTeleport, "moveTeleport"); -function hydrateTeleport(node3, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, { - o: { nextSibling, parentNode: parentNode2, querySelector, insert: insert2, createText } -}, hydrateChildren) { - const target2 = vnode.target = resolveTarget( - vnode.props, - querySelector - ); - if (target2) { - const disabled2 = isTeleportDisabled(vnode.props); - const targetNode = target2._lpa || target2.firstChild; - if (vnode.shapeFlag & 16) { - if (disabled2) { - vnode.anchor = hydrateChildren( - nextSibling(node3), - vnode, - parentNode2(node3), - parentComponent, - parentSuspense, - slotScopeIds, - optimized - ); - vnode.targetStart = targetNode; - vnode.targetAnchor = targetNode && nextSibling(targetNode); - } else { - vnode.anchor = nextSibling(node3); - let targetAnchor = targetNode; - while (targetAnchor) { - if (targetAnchor && targetAnchor.nodeType === 8) { - if (targetAnchor.data === "teleport start anchor") { - vnode.targetStart = targetAnchor; - } else if (targetAnchor.data === "teleport anchor") { - vnode.targetAnchor = targetAnchor; - target2._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor); - break; - } - } - targetAnchor = nextSibling(targetAnchor); - } - if (!vnode.targetAnchor) { - prepareAnchor(target2, vnode, createText, insert2); - } - hydrateChildren( - targetNode && nextSibling(targetNode), - vnode, - target2, - parentComponent, - parentSuspense, - slotScopeIds, - optimized - ); - } - } - updateCssVars(vnode, disabled2); - } - return vnode.anchor && nextSibling(vnode.anchor); -} -__name(hydrateTeleport, "hydrateTeleport"); -const Teleport = TeleportImpl; -function updateCssVars(vnode, isDisabled) { - const ctx = vnode.ctx; - if (ctx && ctx.ut) { - let node3, anchor; - if (isDisabled) { - node3 = vnode.el; - anchor = vnode.anchor; - } else { - node3 = vnode.targetStart; - anchor = vnode.targetAnchor; - } - while (node3 && node3 !== anchor) { - if (node3.nodeType === 1) node3.setAttribute("data-v-owner", ctx.uid); - node3 = node3.nextSibling; - } - ctx.ut(); - } -} -__name(updateCssVars, "updateCssVars"); -function prepareAnchor(target2, vnode, createText, insert2) { - const targetStart = vnode.targetStart = createText(""); - const targetAnchor = vnode.targetAnchor = createText(""); - targetStart[TeleportEndKey] = targetAnchor; - if (target2) { - insert2(targetStart, target2); - insert2(targetAnchor, target2); - } - return targetAnchor; -} -__name(prepareAnchor, "prepareAnchor"); -const leaveCbKey = Symbol("_leaveCb"); -const enterCbKey$1 = Symbol("_enterCb"); -function useTransitionState() { - const state = { - isMounted: false, - isLeaving: false, - isUnmounting: false, - leavingVNodes: /* @__PURE__ */ new Map() - }; - onMounted(() => { - state.isMounted = true; - }); - onBeforeUnmount(() => { - state.isUnmounting = true; - }); - return state; -} -__name(useTransitionState, "useTransitionState"); -const TransitionHookValidator = [Function, Array]; -const BaseTransitionPropsValidators = { - mode: String, - appear: Boolean, - persisted: Boolean, - // enter - onBeforeEnter: TransitionHookValidator, - onEnter: TransitionHookValidator, - onAfterEnter: TransitionHookValidator, - onEnterCancelled: TransitionHookValidator, - // leave - onBeforeLeave: TransitionHookValidator, - onLeave: TransitionHookValidator, - onAfterLeave: TransitionHookValidator, - onLeaveCancelled: TransitionHookValidator, - // appear - onBeforeAppear: TransitionHookValidator, - onAppear: TransitionHookValidator, - onAfterAppear: TransitionHookValidator, - onAppearCancelled: TransitionHookValidator -}; -const recursiveGetSubtree = /* @__PURE__ */ __name((instance) => { - const subTree = instance.subTree; - return subTree.component ? recursiveGetSubtree(subTree.component) : subTree; -}, "recursiveGetSubtree"); -const BaseTransitionImpl = { - name: `BaseTransition`, - props: BaseTransitionPropsValidators, - setup(props, { slots }) { - const instance = getCurrentInstance(); - const state = useTransitionState(); - return () => { - const children = slots.default && getTransitionRawChildren(slots.default(), true); - if (!children || !children.length) { - return; - } - const child = findNonCommentChild(children); - const rawProps = toRaw(props); - const { mode: mode2 } = rawProps; - if (false) { - warn$1$1(`invalid mode: ${mode2}`); - } - if (state.isLeaving) { - return emptyPlaceholder(child); - } - const innerChild = getInnerChild$1(child); - if (!innerChild) { - return emptyPlaceholder(child); - } - let enterHooks = resolveTransitionHooks( - innerChild, - rawProps, - state, - instance, - // #11061, ensure enterHooks is fresh after clone - (hooks2) => enterHooks = hooks2 - ); - if (innerChild.type !== Comment) { - setTransitionHooks(innerChild, enterHooks); - } - let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree); - if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) { - let leavingHooks = resolveTransitionHooks( - oldInnerChild, - rawProps, - state, - instance - ); - setTransitionHooks(oldInnerChild, leavingHooks); - if (mode2 === "out-in" && innerChild.type !== Comment) { - state.isLeaving = true; - leavingHooks.afterLeave = () => { - state.isLeaving = false; - if (!(instance.job.flags & 8)) { - instance.update(); - } - delete leavingHooks.afterLeave; - oldInnerChild = void 0; - }; - return emptyPlaceholder(child); - } else if (mode2 === "in-out" && innerChild.type !== Comment) { - leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => { - const leavingVNodesCache = getLeavingNodesForType( - state, - oldInnerChild - ); - leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild; - el[leaveCbKey] = () => { - earlyRemove(); - el[leaveCbKey] = void 0; - delete enterHooks.delayedLeave; - oldInnerChild = void 0; - }; - enterHooks.delayedLeave = () => { - delayedLeave(); - delete enterHooks.delayedLeave; - oldInnerChild = void 0; - }; - }; - } else { - oldInnerChild = void 0; - } - } else if (oldInnerChild) { - oldInnerChild = void 0; - } - return child; - }; - } -}; -function findNonCommentChild(children) { - let child = children[0]; - if (children.length > 1) { - let hasFound = false; - for (const c2 of children) { - if (c2.type !== Comment) { - if (false) { - warn$1$1( - " can only be used on a single element or component. Use for lists." - ); - break; - } - child = c2; - hasFound = true; - if (true) break; - } - } - } - return child; -} -__name(findNonCommentChild, "findNonCommentChild"); -const BaseTransition = BaseTransitionImpl; -function getLeavingNodesForType(state, vnode) { - const { leavingVNodes } = state; - let leavingVNodesCache = leavingVNodes.get(vnode.type); - if (!leavingVNodesCache) { - leavingVNodesCache = /* @__PURE__ */ Object.create(null); - leavingVNodes.set(vnode.type, leavingVNodesCache); - } - return leavingVNodesCache; -} -__name(getLeavingNodesForType, "getLeavingNodesForType"); -function resolveTransitionHooks(vnode, props, state, instance, postClone) { - const { - appear, - mode: mode2, - persisted = false, - onBeforeEnter: onBeforeEnter2, - onEnter: onEnter7, - onAfterEnter: onAfterEnter4, - onEnterCancelled, - onBeforeLeave: onBeforeLeave3, - onLeave: onLeave5, - onAfterLeave: onAfterLeave6, - onLeaveCancelled, - onBeforeAppear, - onAppear, - onAfterAppear, - onAppearCancelled - } = props; - const key = String(vnode.key); - const leavingVNodesCache = getLeavingNodesForType(state, vnode); - const callHook2 = /* @__PURE__ */ __name((hook, args) => { - hook && callWithAsyncErrorHandling( - hook, - instance, - 9, - args - ); - }, "callHook2"); - const callAsyncHook = /* @__PURE__ */ __name((hook, args) => { - const done = args[1]; - callHook2(hook, args); - if (isArray$b(hook)) { - if (hook.every((hook2) => hook2.length <= 1)) done(); - } else if (hook.length <= 1) { - done(); - } - }, "callAsyncHook"); - const hooks2 = { - mode: mode2, - persisted, - beforeEnter(el) { - let hook = onBeforeEnter2; - if (!state.isMounted) { - if (appear) { - hook = onBeforeAppear || onBeforeEnter2; - } else { - return; - } - } - if (el[leaveCbKey]) { - el[leaveCbKey]( - true - /* cancelled */ - ); - } - const leavingVNode = leavingVNodesCache[key]; - if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) { - leavingVNode.el[leaveCbKey](); - } - callHook2(hook, [el]); - }, - enter(el) { - let hook = onEnter7; - let afterHook = onAfterEnter4; - let cancelHook = onEnterCancelled; - if (!state.isMounted) { - if (appear) { - hook = onAppear || onEnter7; - afterHook = onAfterAppear || onAfterEnter4; - cancelHook = onAppearCancelled || onEnterCancelled; - } else { - return; - } - } - let called = false; - const done = el[enterCbKey$1] = (cancelled) => { - if (called) return; - called = true; - if (cancelled) { - callHook2(cancelHook, [el]); - } else { - callHook2(afterHook, [el]); - } - if (hooks2.delayedLeave) { - hooks2.delayedLeave(); - } - el[enterCbKey$1] = void 0; - }; - if (hook) { - callAsyncHook(hook, [el, done]); - } else { - done(); - } - }, - leave(el, remove22) { - const key2 = String(vnode.key); - if (el[enterCbKey$1]) { - el[enterCbKey$1]( - true - /* cancelled */ - ); - } - if (state.isUnmounting) { - return remove22(); - } - callHook2(onBeforeLeave3, [el]); - let called = false; - const done = el[leaveCbKey] = (cancelled) => { - if (called) return; - called = true; - remove22(); - if (cancelled) { - callHook2(onLeaveCancelled, [el]); - } else { - callHook2(onAfterLeave6, [el]); - } - el[leaveCbKey] = void 0; - if (leavingVNodesCache[key2] === vnode) { - delete leavingVNodesCache[key2]; - } - }; - leavingVNodesCache[key2] = vnode; - if (onLeave5) { - callAsyncHook(onLeave5, [el, done]); - } else { - done(); - } - }, - clone(vnode2) { - const hooks22 = resolveTransitionHooks( - vnode2, - props, - state, - instance, - postClone - ); - if (postClone) postClone(hooks22); - return hooks22; - } - }; - return hooks2; -} -__name(resolveTransitionHooks, "resolveTransitionHooks"); -function emptyPlaceholder(vnode) { - if (isKeepAlive(vnode)) { - vnode = cloneVNode(vnode); - vnode.children = null; - return vnode; - } -} -__name(emptyPlaceholder, "emptyPlaceholder"); -function getInnerChild$1(vnode) { - if (!isKeepAlive(vnode)) { - if (isTeleport(vnode.type) && vnode.children) { - return findNonCommentChild(vnode.children); - } - return vnode; - } - if (false) { - return vnode.component.subTree; - } - const { shapeFlag, children } = vnode; - if (children) { - if (shapeFlag & 16) { - return children[0]; - } - if (shapeFlag & 32 && isFunction$c(children.default)) { - return children.default(); - } - } -} -__name(getInnerChild$1, "getInnerChild$1"); -function setTransitionHooks(vnode, hooks2) { - if (vnode.shapeFlag & 6 && vnode.component) { - vnode.transition = hooks2; - setTransitionHooks(vnode.component.subTree, hooks2); - } else if (vnode.shapeFlag & 128) { - vnode.ssContent.transition = hooks2.clone(vnode.ssContent); - vnode.ssFallback.transition = hooks2.clone(vnode.ssFallback); - } else { - vnode.transition = hooks2; - } -} -__name(setTransitionHooks, "setTransitionHooks"); -function getTransitionRawChildren(children, keepComment = false, parentKey) { - let ret = []; - let keyedFragmentCount = 0; - for (let i2 = 0; i2 < children.length; i2++) { - let child = children[i2]; - const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i2); - if (child.type === Fragment$1) { - if (child.patchFlag & 128) keyedFragmentCount++; - ret = ret.concat( - getTransitionRawChildren(child.children, keepComment, key) - ); - } else if (keepComment || child.type !== Comment) { - ret.push(key != null ? cloneVNode(child, { key }) : child); - } - } - if (keyedFragmentCount > 1) { - for (let i2 = 0; i2 < ret.length; i2++) { - ret[i2].patchFlag = -2; - } - } - return ret; -} -__name(getTransitionRawChildren, "getTransitionRawChildren"); -/*! #__NO_SIDE_EFFECTS__ */ -// @__NO_SIDE_EFFECTS__ -function defineComponent(options4, extraOptions) { - return isFunction$c(options4) ? ( - // #8236: 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: options4.name }, extraOptions, { setup: options4 }))() - ) : options4; -} -__name(defineComponent, "defineComponent"); -function useId() { - const i2 = getCurrentInstance(); - if (i2) { - return (i2.appContext.config.idPrefix || "v") + "-" + i2.ids[0] + i2.ids[1]++; - } else if (false) { - warn$1$1( - `useId() is called when there is no active component instance to be associated with.` - ); - } - return ""; -} -__name(useId, "useId"); -function markAsyncBoundary(instance) { - instance.ids = [instance.ids[0] + instance.ids[2]++ + "-", 0, 0]; -} -__name(markAsyncBoundary, "markAsyncBoundary"); -const knownTemplateRefs = /* @__PURE__ */ new WeakSet(); -function useTemplateRef(key) { - const i2 = getCurrentInstance(); - const r2 = shallowRef(null); - if (i2) { - const refs = i2.refs === EMPTY_OBJ ? i2.refs = {} : i2.refs; - let desc; - if (false) { - warn$1$1(`useTemplateRef('${key}') already exists.`); - } else { - Object.defineProperty(refs, key, { - enumerable: true, - get: /* @__PURE__ */ __name(() => r2.value, "get"), - set: /* @__PURE__ */ __name((val) => r2.value = val, "set") - }); - } - } else if (false) { - warn$1$1( - `useTemplateRef() is called when there is no active component instance to be associated with.` - ); - } - const ret = false ? readonly(r2) : r2; - if (false) { - knownTemplateRefs.add(ret); - } - return ret; -} -__name(useTemplateRef, "useTemplateRef"); -function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { - if (isArray$b(rawRef)) { - rawRef.forEach( - (r2, i2) => setRef( - r2, - oldRawRef && (isArray$b(oldRawRef) ? oldRawRef[i2] : oldRawRef), - parentSuspense, - vnode, - isUnmount - ) - ); - return; - } - if (isAsyncWrapper(vnode) && !isUnmount) { - if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) { - setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree); - } - return; - } - const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el; - const value4 = isUnmount ? null : refValue; - const { i: owner, r: ref3 } = rawRef; - if (false) { - warn$1$1( - `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.` - ); - return; - } - const oldRef = oldRawRef && oldRawRef.r; - const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs; - const setupState = owner.setupState; - const rawSetupState = toRaw(setupState); - const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => { - if (false) { - if (hasOwn$3(rawSetupState, key) && !isRef(rawSetupState[key])) { - warn$1$1( - `Template ref "${key}" used on a non-ref value. It will not work in the production build.` - ); - } - if (knownTemplateRefs.has(rawSetupState[key])) { - return false; - } - } - return hasOwn$3(rawSetupState, key); - }; - if (oldRef != null && oldRef !== ref3) { - if (isString$9(oldRef)) { - refs[oldRef] = null; - if (canSetSetupRef(oldRef)) { - setupState[oldRef] = null; - } - } else if (isRef(oldRef)) { - oldRef.value = null; - } - } - if (isFunction$c(ref3)) { - callWithErrorHandling(ref3, owner, 12, [value4, refs]); - } else { - const _isString = isString$9(ref3); - const _isRef = isRef(ref3); - if (_isString || _isRef) { - const doSet = /* @__PURE__ */ __name(() => { - if (rawRef.f) { - const existing = _isString ? canSetSetupRef(ref3) ? setupState[ref3] : refs[ref3] : ref3.value; - if (isUnmount) { - isArray$b(existing) && remove$2(existing, refValue); - } else { - if (!isArray$b(existing)) { - if (_isString) { - refs[ref3] = [refValue]; - if (canSetSetupRef(ref3)) { - setupState[ref3] = refs[ref3]; - } - } else { - ref3.value = [refValue]; - if (rawRef.k) refs[rawRef.k] = ref3.value; - } - } else if (!existing.includes(refValue)) { - existing.push(refValue); - } - } - } else if (_isString) { - refs[ref3] = value4; - if (canSetSetupRef(ref3)) { - setupState[ref3] = value4; - } - } else if (_isRef) { - ref3.value = value4; - if (rawRef.k) refs[rawRef.k] = value4; - } else if (false) { - warn$1$1("Invalid template ref type:", ref3, `(${typeof ref3})`); - } - }, "doSet"); - if (value4) { - doSet.id = -1; - queuePostRenderEffect(doSet, parentSuspense); - } else { - doSet(); - } - } else if (false) { - warn$1$1("Invalid template ref type:", ref3, `(${typeof ref3})`); - } - } -} -__name(setRef, "setRef"); -let hasLoggedMismatchError = false; -const logMismatchError = /* @__PURE__ */ __name(() => { - if (hasLoggedMismatchError) { - return; - } - console.error("Hydration completed but contains mismatches."); - hasLoggedMismatchError = true; -}, "logMismatchError"); -const isSVGContainer = /* @__PURE__ */ __name((container) => container.namespaceURI.includes("svg") && container.tagName !== "foreignObject", "isSVGContainer"); -const isMathMLContainer = /* @__PURE__ */ __name((container) => container.namespaceURI.includes("MathML"), "isMathMLContainer"); -const getContainerType = /* @__PURE__ */ __name((container) => { - if (container.nodeType !== 1) return void 0; - if (isSVGContainer(container)) return "svg"; - if (isMathMLContainer(container)) return "mathml"; - return void 0; -}, "getContainerType"); -const isComment = /* @__PURE__ */ __name((node3) => node3.nodeType === 8, "isComment"); -function createHydrationFunctions(rendererInternals) { - const { - mt: mountComponent, - p: patch2, - o: { - patchProp: patchProp2, - createText, - nextSibling, - parentNode: parentNode2, - remove: remove22, - insert: insert2, - createComment - } - } = rendererInternals; - const hydrate2 = /* @__PURE__ */ __name((vnode, container) => { - if (!container.hasChildNodes()) { - patch2(null, vnode, container); - flushPostFlushCbs(); - container._vnode = vnode; - return; - } - hydrateNode(container.firstChild, vnode, null, null, null); - flushPostFlushCbs(); - container._vnode = vnode; - }, "hydrate"); - const hydrateNode = /* @__PURE__ */ __name((node3, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => { - optimized = optimized || !!vnode.dynamicChildren; - const isFragmentStart = isComment(node3) && node3.data === "["; - const onMismatch = /* @__PURE__ */ __name(() => handleMismatch( - node3, - vnode, - parentComponent, - parentSuspense, - slotScopeIds, - isFragmentStart - ), "onMismatch"); - const { type, ref: ref3, shapeFlag, patchFlag } = vnode; - let domType = node3.nodeType; - vnode.el = node3; - if (false) { - def(node3, "__vnode", vnode, true); - def(node3, "__vueParentComponent", parentComponent, true); - } - if (patchFlag === -2) { - optimized = false; - vnode.dynamicChildren = null; - } - let nextNode = null; - switch (type) { - case Text$4: - if (domType !== 3) { - if (vnode.children === "") { - insert2(vnode.el = createText(""), parentNode2(node3), node3); - nextNode = node3; - } else { - nextNode = onMismatch(); - } - } else { - if (node3.data !== vnode.children) { - logMismatchError(); - node3.data = vnode.children; - } - nextNode = nextSibling(node3); - } - break; - case Comment: - if (isTemplateNode(node3)) { - nextNode = nextSibling(node3); - replaceNode( - vnode.el = node3.content.firstChild, - node3, - parentComponent - ); - } else if (domType !== 8 || isFragmentStart) { - nextNode = onMismatch(); - } else { - nextNode = nextSibling(node3); - } - break; - case Static: - if (isFragmentStart) { - node3 = nextSibling(node3); - domType = node3.nodeType; - } - if (domType === 1 || domType === 3) { - nextNode = node3; - const needToAdoptContent = !vnode.children.length; - for (let i2 = 0; i2 < vnode.staticCount; i2++) { - if (needToAdoptContent) - vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data; - if (i2 === vnode.staticCount - 1) { - vnode.anchor = nextNode; - } - nextNode = nextSibling(nextNode); - } - return isFragmentStart ? nextSibling(nextNode) : nextNode; - } else { - onMismatch(); - } - break; - case Fragment$1: - if (!isFragmentStart) { - nextNode = onMismatch(); - } else { - nextNode = hydrateFragment( - node3, - vnode, - parentComponent, - parentSuspense, - slotScopeIds, - optimized - ); - } - break; - default: - if (shapeFlag & 1) { - if ((domType !== 1 || vnode.type.toLowerCase() !== node3.tagName.toLowerCase()) && !isTemplateNode(node3)) { - nextNode = onMismatch(); - } else { - nextNode = hydrateElement( - node3, - vnode, - parentComponent, - parentSuspense, - slotScopeIds, - optimized - ); - } - } else if (shapeFlag & 6) { - vnode.slotScopeIds = slotScopeIds; - const container = parentNode2(node3); - if (isFragmentStart) { - nextNode = locateClosingAnchor(node3); - } else if (isComment(node3) && node3.data === "teleport start") { - nextNode = locateClosingAnchor(node3, node3.data, "teleport end"); - } else { - nextNode = nextSibling(node3); - } - mountComponent( - vnode, - container, - null, - parentComponent, - parentSuspense, - getContainerType(container), - optimized - ); - if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) { - let subTree; - if (isFragmentStart) { - subTree = createVNode(Fragment$1); - subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild; - } else { - subTree = node3.nodeType === 3 ? createTextVNode("") : createVNode("div"); - } - subTree.el = node3; - vnode.component.subTree = subTree; - } - } else if (shapeFlag & 64) { - if (domType !== 8) { - nextNode = onMismatch(); - } else { - nextNode = vnode.type.hydrate( - node3, - vnode, - parentComponent, - parentSuspense, - slotScopeIds, - optimized, - rendererInternals, - hydrateChildren - ); - } - } else if (shapeFlag & 128) { - nextNode = vnode.type.hydrate( - node3, - vnode, - parentComponent, - parentSuspense, - getContainerType(parentNode2(node3)), - slotScopeIds, - optimized, - rendererInternals, - hydrateNode - ); - } else if (false) { - warn$1$1("Invalid HostVNode type:", type, `(${typeof type})`); - } - } - if (ref3 != null) { - setRef(ref3, null, parentSuspense, vnode); - } - return nextNode; - }, "hydrateNode"); - const hydrateElement = /* @__PURE__ */ __name((el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { - optimized = optimized || !!vnode.dynamicChildren; - const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode; - const forcePatch = type === "input" || type === "option"; - if (forcePatch || patchFlag !== -1) { - if (dirs) { - invokeDirectiveHook(vnode, null, parentComponent, "created"); - } - let needCallTransitionHooks = false; - if (isTemplateNode(el)) { - needCallTransitionHooks = needTransition( - null, - // no need check parentSuspense in hydration - transition - ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear; - const content2 = el.content.firstChild; - if (needCallTransitionHooks) { - transition.beforeEnter(content2); - } - replaceNode(content2, el, parentComponent); - vnode.el = el = content2; - } - if (shapeFlag & 16 && // skip if element has innerHTML / textContent - !(props && (props.innerHTML || props.textContent))) { - let next2 = hydrateChildren( - el.firstChild, - vnode, - el, - parentComponent, - parentSuspense, - slotScopeIds, - optimized - ); - let hasWarned2 = false; - while (next2) { - if (!isMismatchAllowed( - el, - 1 - /* CHILDREN */ - )) { - if (false) { - warn$1$1( - `Hydration children mismatch on`, - el, - ` -Server rendered element contains more child nodes than client vdom.` - ); - hasWarned2 = true; - } - logMismatchError(); - } - const cur = next2; - next2 = next2.nextSibling; - remove22(cur); - } - } else if (shapeFlag & 8) { - let clientText = vnode.children; - if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) { - clientText = clientText.slice(1); - } - if (el.textContent !== clientText) { - if (!isMismatchAllowed( - el, - 0 - /* TEXT */ - )) { - logMismatchError(); - } - el.textContent = vnode.children; - } - } - if (props) { - if (forcePatch || !optimized || patchFlag & (16 | 32)) { - const isCustomElement = el.tagName.includes("-"); - for (const key in props) { - if (false) { - logMismatchError(); - } - if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers - key[0] === "." || isCustomElement) { - patchProp2(el, key, null, props[key], void 0, parentComponent); - } - } - } else if (props.onClick) { - patchProp2( - el, - "onClick", - null, - props.onClick, - void 0, - parentComponent - ); - } else if (patchFlag & 4 && isReactive(props.style)) { - for (const key in props.style) props.style[key]; - } - } - let vnodeHooks; - if (vnodeHooks = props && props.onVnodeBeforeMount) { - invokeVNodeHook(vnodeHooks, parentComponent, vnode); - } - if (dirs) { - invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); - } - if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) { - queueEffectWithSuspense(() => { - vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode); - needCallTransitionHooks && transition.enter(el); - dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); - }, parentSuspense); - } - } - return el.nextSibling; - }, "hydrateElement"); - const hydrateChildren = /* @__PURE__ */ __name((node3, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => { - optimized = optimized || !!parentVNode.dynamicChildren; - const children = parentVNode.children; - const l2 = children.length; - let hasWarned2 = false; - for (let i2 = 0; i2 < l2; i2++) { - const vnode = optimized ? children[i2] : children[i2] = normalizeVNode(children[i2]); - const isText = vnode.type === Text$4; - if (node3) { - if (isText && !optimized) { - if (i2 + 1 < l2 && normalizeVNode(children[i2 + 1]).type === Text$4) { - insert2( - createText( - node3.data.slice(vnode.children.length) - ), - container, - nextSibling(node3) - ); - node3.data = vnode.children; - } - } - node3 = hydrateNode( - node3, - vnode, - parentComponent, - parentSuspense, - slotScopeIds, - optimized - ); - } else if (isText && !vnode.children) { - insert2(vnode.el = createText(""), container); - } else { - if (!isMismatchAllowed( - container, - 1 - /* CHILDREN */ - )) { - if (false) { - warn$1$1( - `Hydration children mismatch on`, - container, - ` -Server rendered element contains fewer child nodes than client vdom.` - ); - hasWarned2 = true; - } - logMismatchError(); - } - patch2( - null, - vnode, - container, - null, - parentComponent, - parentSuspense, - getContainerType(container), - slotScopeIds - ); - } - } - return node3; - }, "hydrateChildren"); - const hydrateFragment = /* @__PURE__ */ __name((node3, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { - const { slotScopeIds: fragmentSlotScopeIds } = vnode; - if (fragmentSlotScopeIds) { - slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; - } - const container = parentNode2(node3); - const next2 = hydrateChildren( - nextSibling(node3), - vnode, - container, - parentComponent, - parentSuspense, - slotScopeIds, - optimized - ); - if (next2 && isComment(next2) && next2.data === "]") { - return nextSibling(vnode.anchor = next2); - } else { - logMismatchError(); - insert2(vnode.anchor = createComment(`]`), container, next2); - return next2; - } - }, "hydrateFragment"); - const handleMismatch = /* @__PURE__ */ __name((node3, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment2) => { - if (!isMismatchAllowed( - node3.parentElement, - 1 - /* CHILDREN */ - )) { - logMismatchError(); - } - vnode.el = null; - if (isFragment2) { - const end = locateClosingAnchor(node3); - while (true) { - const next22 = nextSibling(node3); - if (next22 && next22 !== end) { - remove22(next22); - } else { - break; - } - } - } - const next2 = nextSibling(node3); - const container = parentNode2(node3); - remove22(node3); - patch2( - null, - vnode, - container, - next2, - parentComponent, - parentSuspense, - getContainerType(container), - slotScopeIds - ); - if (parentComponent) { - parentComponent.vnode.el = vnode.el; - updateHOCHostEl(parentComponent, vnode.el); - } - return next2; - }, "handleMismatch"); - const locateClosingAnchor = /* @__PURE__ */ __name((node3, open2 = "[", close5 = "]") => { - let match2 = 0; - while (node3) { - node3 = nextSibling(node3); - if (node3 && isComment(node3)) { - if (node3.data === open2) match2++; - if (node3.data === close5) { - if (match2 === 0) { - return nextSibling(node3); - } else { - match2--; - } - } - } - } - return node3; - }, "locateClosingAnchor"); - const replaceNode = /* @__PURE__ */ __name((newNode, oldNode, parentComponent) => { - const parentNode22 = oldNode.parentNode; - if (parentNode22) { - parentNode22.replaceChild(newNode, oldNode); - } - let parent = parentComponent; - while (parent) { - if (parent.vnode.el === oldNode) { - parent.vnode.el = parent.subTree.el = newNode; - } - parent = parent.parent; - } - }, "replaceNode"); - const isTemplateNode = /* @__PURE__ */ __name((node3) => { - return node3.nodeType === 1 && node3.tagName === "TEMPLATE"; - }, "isTemplateNode"); - return [hydrate2, hydrateNode]; -} -__name(createHydrationFunctions, "createHydrationFunctions"); -function propHasMismatch(el, key, clientValue, vnode, instance) { - let mismatchType; - let mismatchKey; - let actual; - let expected; - if (key === "class") { - actual = el.getAttribute("class"); - expected = normalizeClass(clientValue); - if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) { - mismatchType = 2; - mismatchKey = `class`; - } - } else if (key === "style") { - actual = el.getAttribute("style") || ""; - expected = isString$9(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue)); - const actualMap = toStyleMap(actual); - const expectedMap = toStyleMap(expected); - if (vnode.dirs) { - for (const { dir, value: value4 } of vnode.dirs) { - if (dir.name === "show" && !value4) { - expectedMap.set("display", "none"); - } - } - } - if (instance) { - resolveCssVars(instance, vnode, expectedMap); - } - if (!isMapEqual(actualMap, expectedMap)) { - mismatchType = 3; - mismatchKey = "style"; - } - } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) { - if (isBooleanAttr(key)) { - actual = el.hasAttribute(key); - expected = includeBooleanAttr(clientValue); - } else if (clientValue == null) { - actual = el.hasAttribute(key); - expected = false; - } else { - if (el.hasAttribute(key)) { - actual = el.getAttribute(key); - } else if (key === "value" && el.tagName === "TEXTAREA") { - actual = el.value; - } else { - actual = false; - } - expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false; - } - if (actual !== expected) { - mismatchType = 4; - mismatchKey = key; - } - } - if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) { - const format2 = /* @__PURE__ */ __name((v2) => v2 === false ? `(not rendered)` : `${mismatchKey}="${v2}"`, "format"); - const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`; - const postSegment = ` - - rendered on server: ${format2(actual)} - - expected on client: ${format2(expected)} - Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead. - You should fix the source of the mismatch.`; - { - warn$1$1(preSegment, el, postSegment); - } - return true; - } - return false; -} -__name(propHasMismatch, "propHasMismatch"); -function toClassSet(str) { - return new Set(str.trim().split(/\s+/)); -} -__name(toClassSet, "toClassSet"); -function isSetEqual(a2, b2) { - if (a2.size !== b2.size) { - return false; - } - for (const s2 of a2) { - if (!b2.has(s2)) { - return false; - } - } - return true; -} -__name(isSetEqual, "isSetEqual"); -function toStyleMap(str) { - const styleMap = /* @__PURE__ */ new Map(); - for (const item3 of str.split(";")) { - let [key, value4] = item3.split(":"); - key = key.trim(); - value4 = value4 && value4.trim(); - if (key && value4) { - styleMap.set(key, value4); - } - } - return styleMap; -} -__name(toStyleMap, "toStyleMap"); -function isMapEqual(a2, b2) { - if (a2.size !== b2.size) { - return false; - } - for (const [key, value4] of a2) { - if (value4 !== b2.get(key)) { - return false; - } - } - return true; -} -__name(isMapEqual, "isMapEqual"); -function resolveCssVars(instance, vnode, expectedMap) { - const root29 = instance.subTree; - if (instance.getCssVars && (vnode === root29 || root29 && root29.type === Fragment$1 && root29.children.includes(vnode))) { - const cssVars = instance.getCssVars(); - for (const key in cssVars) { - expectedMap.set( - `--${getEscapedCssVarName(key, false)}`, - String(cssVars[key]) - ); - } - } - if (vnode === root29 && instance.parent) { - resolveCssVars(instance.parent, instance.vnode, expectedMap); - } -} -__name(resolveCssVars, "resolveCssVars"); -const allowMismatchAttr = "data-allow-mismatch"; -const MismatchTypeString = { - [ - 0 - /* TEXT */ - ]: "text", - [ - 1 - /* CHILDREN */ - ]: "children", - [ - 2 - /* CLASS */ - ]: "class", - [ - 3 - /* STYLE */ - ]: "style", - [ - 4 - /* ATTRIBUTE */ - ]: "attribute" -}; -function isMismatchAllowed(el, allowedType) { - if (allowedType === 0 || allowedType === 1) { - while (el && !el.hasAttribute(allowMismatchAttr)) { - el = el.parentElement; - } - } - const allowedAttr = el && el.getAttribute(allowMismatchAttr); - if (allowedAttr == null) { - return false; - } else if (allowedAttr === "") { - return true; - } else { - const list2 = allowedAttr.split(","); - if (allowedType === 0 && list2.includes("children")) { - return true; - } - return allowedAttr.split(",").includes(MismatchTypeString[allowedType]); - } -} -__name(isMismatchAllowed, "isMismatchAllowed"); -const requestIdleCallback$1 = getGlobalThis$1().requestIdleCallback || ((cb) => setTimeout(cb, 1)); -const cancelIdleCallback$1 = getGlobalThis$1().cancelIdleCallback || ((id3) => clearTimeout(id3)); -const hydrateOnIdle = /* @__PURE__ */ __name((timeout = 1e4) => (hydrate2) => { - const id3 = requestIdleCallback$1(hydrate2, { timeout }); - return () => cancelIdleCallback$1(id3); -}, "hydrateOnIdle"); -function elementIsVisibleInViewport(el) { - const { top, left, bottom, right } = el.getBoundingClientRect(); - const { innerHeight: innerHeight2, innerWidth } = window; - return (top > 0 && top < innerHeight2 || bottom > 0 && bottom < innerHeight2) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth); -} -__name(elementIsVisibleInViewport, "elementIsVisibleInViewport"); -const hydrateOnVisible = /* @__PURE__ */ __name((opts) => (hydrate2, forEach3) => { - const ob = new IntersectionObserver((entries) => { - for (const e2 of entries) { - if (!e2.isIntersecting) continue; - ob.disconnect(); - hydrate2(); - break; - } - }, opts); - forEach3((el) => { - if (!(el instanceof Element)) return; - if (elementIsVisibleInViewport(el)) { - hydrate2(); - ob.disconnect(); - return false; - } - ob.observe(el); - }); - return () => ob.disconnect(); -}, "hydrateOnVisible"); -const hydrateOnMediaQuery = /* @__PURE__ */ __name((query) => (hydrate2) => { - if (query) { - const mql = matchMedia(query); - if (mql.matches) { - hydrate2(); - } else { - mql.addEventListener("change", hydrate2, { once: true }); - return () => mql.removeEventListener("change", hydrate2); - } - } -}, "hydrateOnMediaQuery"); -const hydrateOnInteraction = /* @__PURE__ */ __name((interactions = []) => (hydrate2, forEach3) => { - if (isString$9(interactions)) interactions = [interactions]; - let hasHydrated = false; - const doHydrate = /* @__PURE__ */ __name((e2) => { - if (!hasHydrated) { - hasHydrated = true; - teardown(); - hydrate2(); - e2.target.dispatchEvent(new e2.constructor(e2.type, e2)); - } - }, "doHydrate"); - const teardown = /* @__PURE__ */ __name(() => { - forEach3((el) => { - for (const i2 of interactions) { - el.removeEventListener(i2, doHydrate); - } - }); - }, "teardown"); - forEach3((el) => { - for (const i2 of interactions) { - el.addEventListener(i2, doHydrate, { once: true }); - } - }); - return teardown; -}, "hydrateOnInteraction"); -function forEachElement(node3, cb) { - if (isComment(node3) && node3.data === "[") { - let depth = 1; - let next2 = node3.nextSibling; - while (next2) { - if (next2.nodeType === 1) { - const result = cb(next2); - if (result === false) { - break; - } - } else if (isComment(next2)) { - if (next2.data === "]") { - if (--depth === 0) break; - } else if (next2.data === "[") { - depth++; - } - } - next2 = next2.nextSibling; - } - } else { - cb(node3); - } -} -__name(forEachElement, "forEachElement"); -const isAsyncWrapper = /* @__PURE__ */ __name((i2) => !!i2.type.__asyncLoader, "isAsyncWrapper"); -/*! #__NO_SIDE_EFFECTS__ */ -// @__NO_SIDE_EFFECTS__ -function defineAsyncComponent(source) { - if (isFunction$c(source)) { - source = { loader: source }; - } - const { - loader, - loadingComponent, - errorComponent, - delay = 200, - hydrate: hydrateStrategy, - 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 load3(); - }, "retry"); - const load3 = /* @__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: load3, - __asyncHydrate(el, instance, hydrate2) { - const doHydrate = hydrateStrategy ? () => { - const teardown = hydrateStrategy( - hydrate2, - (cb) => forEachElement(el, cb) - ); - if (teardown) { - (instance.bum || (instance.bum = [])).push(teardown); - } - } : hydrate2; - if (resolvedComp) { - doHydrate(); - } else { - load3().then(() => !instance.isUnmounted && doHydrate()); - } - }, - get __asyncResolved() { - return resolvedComp; - }, - setup() { - const instance = currentInstance; - markAsyncBoundary(instance); - 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 load3().then((comp) => { - return () => createInnerComp(comp, instance); - }).catch((err) => { - onError(err); - return () => errorComponent ? createVNode(errorComponent, { - error: err - }) : null; - }); - } - const loaded = ref(false); - const error2 = ref(); - const delayed = ref(!!delay); - if (delay) { - setTimeout(() => { - delayed.value = false; - }, delay); - } - if (timeout != null) { - setTimeout(() => { - if (!loaded.value && !error2.value) { - const err = new Error( - `Async component timed out after ${timeout}ms.` - ); - onError(err); - error2.value = err; - } - }, timeout); - } - load3().then(() => { - loaded.value = true; - if (instance.parent && isKeepAlive(instance.parent.vnode)) { - instance.parent.update(); - } - }).catch((err) => { - onError(err); - error2.value = err; - }); - return () => { - if (loaded.value && resolvedComp) { - return createInnerComp(resolvedComp, instance); - } else if (error2.value && errorComponent) { - return createVNode(errorComponent, { - error: error2.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"); -const isKeepAlive = /* @__PURE__ */ __name((vnode) => vnode.type.__isKeepAlive, "isKeepAlive"); -const KeepAliveImpl = { - name: `KeepAlive`, - // Marker for special handling inside the renderer. We are not using a === - // check directly on KeepAlive in the renderer, because importing it directly - // would prevent it from being tree-shaken. - __isKeepAlive: true, - props: { - include: [String, RegExp, Array], - exclude: [String, RegExp, Array], - max: [String, Number] - }, - setup(props, { slots }) { - const instance = getCurrentInstance(); - const sharedContext = instance.ctx; - if (!sharedContext.renderer) { - return () => { - const children = slots.default && slots.default(); - return children && children.length === 1 ? children[0] : children; - }; - } - const cache2 = /* @__PURE__ */ new Map(); - const keys2 = /* @__PURE__ */ new Set(); - let current = null; - if (false) { - instance.__v_cache = cache2; - } - const parentSuspense = instance.suspense; - const { - renderer: { - p: patch2, - m: move, - um: _unmount, - o: { createElement: createElement2 } - } - } = sharedContext; - const storageContainer = createElement2("div"); - sharedContext.activate = (vnode, container, anchor, namespace, optimized) => { - const instance2 = vnode.component; - move(vnode, container, anchor, 0, parentSuspense); - patch2( - instance2.vnode, - vnode, - container, - anchor, - instance2, - parentSuspense, - namespace, - vnode.slotScopeIds, - optimized - ); - queuePostRenderEffect(() => { - instance2.isDeactivated = false; - if (instance2.a) { - invokeArrayFns(instance2.a); - } - const vnodeHook = vnode.props && vnode.props.onVnodeMounted; - if (vnodeHook) { - invokeVNodeHook(vnodeHook, instance2.parent, vnode); - } - }, parentSuspense); - if (false) { - devtoolsComponentAdded(instance2); - } - }; - sharedContext.deactivate = (vnode) => { - const instance2 = vnode.component; - invalidateMount(instance2.m); - invalidateMount(instance2.a); - move(vnode, storageContainer, null, 1, parentSuspense); - queuePostRenderEffect(() => { - if (instance2.da) { - invokeArrayFns(instance2.da); - } - const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted; - if (vnodeHook) { - invokeVNodeHook(vnodeHook, instance2.parent, vnode); - } - instance2.isDeactivated = true; - }, parentSuspense); - if (false) { - devtoolsComponentAdded(instance2); - } - }; - function unmount(vnode) { - resetShapeFlag(vnode); - _unmount(vnode, instance, parentSuspense, true); - } - __name(unmount, "unmount"); - function pruneCache(filter4) { - cache2.forEach((vnode, key) => { - const name2 = getComponentName(vnode.type); - if (name2 && !filter4(name2)) { - pruneCacheEntry(key); - } - }); - } - __name(pruneCache, "pruneCache"); - function pruneCacheEntry(key) { - const cached = cache2.get(key); - if (cached && (!current || !isSameVNodeType(cached, current))) { - unmount(cached); - } else if (current) { - resetShapeFlag(current); - } - cache2.delete(key); - keys2.delete(key); - } - __name(pruneCacheEntry, "pruneCacheEntry"); - watch( - () => [props.include, props.exclude], - ([include, exclude]) => { - include && pruneCache((name2) => matches$1(include, name2)); - exclude && pruneCache((name2) => !matches$1(exclude, name2)); - }, - // prune post-render after `current` has been updated - { flush: "post", deep: true } - ); - let pendingCacheKey = null; - const cacheSubtree = /* @__PURE__ */ __name(() => { - if (pendingCacheKey != null) { - if (isSuspense(instance.subTree.type)) { - queuePostRenderEffect(() => { - cache2.set(pendingCacheKey, getInnerChild(instance.subTree)); - }, instance.subTree.suspense); - } else { - cache2.set(pendingCacheKey, getInnerChild(instance.subTree)); - } - } - }, "cacheSubtree"); - onMounted(cacheSubtree); - onUpdated(cacheSubtree); - onBeforeUnmount(() => { - cache2.forEach((cached) => { - const { subTree, suspense } = instance; - const vnode = getInnerChild(subTree); - if (cached.type === vnode.type && cached.key === vnode.key) { - resetShapeFlag(vnode); - const da = vnode.component.da; - da && queuePostRenderEffect(da, suspense); - return; - } - unmount(cached); - }); - }); - return () => { - pendingCacheKey = null; - if (!slots.default) { - return current = null; - } - const children = slots.default(); - const rawVNode = children[0]; - if (children.length > 1) { - if (false) { - warn$1$1(`KeepAlive should contain exactly one component child.`); - } - current = null; - return children; - } else if (!isVNode$1(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) { - current = null; - return rawVNode; - } - let vnode = getInnerChild(rawVNode); - if (vnode.type === Comment) { - current = null; - return vnode; - } - const comp = vnode.type; - const name2 = getComponentName( - isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp - ); - const { include, exclude, max } = props; - if (include && (!name2 || !matches$1(include, name2)) || exclude && name2 && matches$1(exclude, name2)) { - vnode.shapeFlag &= ~256; - current = vnode; - return rawVNode; - } - const key = vnode.key == null ? comp : vnode.key; - const cachedVNode = cache2.get(key); - if (vnode.el) { - vnode = cloneVNode(vnode); - if (rawVNode.shapeFlag & 128) { - rawVNode.ssContent = vnode; - } - } - pendingCacheKey = key; - if (cachedVNode) { - vnode.el = cachedVNode.el; - vnode.component = cachedVNode.component; - if (vnode.transition) { - setTransitionHooks(vnode, vnode.transition); - } - vnode.shapeFlag |= 512; - keys2.delete(key); - keys2.add(key); - } else { - keys2.add(key); - if (max && keys2.size > parseInt(max, 10)) { - pruneCacheEntry(keys2.values().next().value); - } - } - vnode.shapeFlag |= 256; - current = vnode; - return isSuspense(rawVNode.type) ? rawVNode : vnode; - }; - } -}; -const KeepAlive = KeepAliveImpl; -function matches$1(pattern, name2) { - if (isArray$b(pattern)) { - return pattern.some((p2) => matches$1(p2, name2)); - } else if (isString$9(pattern)) { - return pattern.split(",").includes(name2); - } else if (isRegExp$4(pattern)) { - pattern.lastIndex = 0; - return pattern.test(name2); - } - return false; -} -__name(matches$1, "matches$1"); -function onActivated(hook, target2) { - registerKeepAliveHook(hook, "a", target2); -} -__name(onActivated, "onActivated"); -function onDeactivated(hook, target2) { - registerKeepAliveHook(hook, "da", target2); -} -__name(onDeactivated, "onDeactivated"); -function registerKeepAliveHook(hook, type, target2 = currentInstance) { - const wrappedHook = hook.__wdc || (hook.__wdc = () => { - let current = target2; - while (current) { - if (current.isDeactivated) { - return; - } - current = current.parent; - } - return hook(); - }); - injectHook(type, wrappedHook, target2); - if (target2) { - let current = target2.parent; - while (current && current.parent) { - if (isKeepAlive(current.parent.vnode)) { - injectToKeepAliveRoot(wrappedHook, type, target2, current); - } - current = current.parent; - } - } -} -__name(registerKeepAliveHook, "registerKeepAliveHook"); -function injectToKeepAliveRoot(hook, type, target2, keepAliveRoot) { - const injected = injectHook( - type, - hook, - keepAliveRoot, - true - /* prepend */ - ); - onUnmounted(() => { - remove$2(keepAliveRoot[type], injected); - }, target2); -} -__name(injectToKeepAliveRoot, "injectToKeepAliveRoot"); -function resetShapeFlag(vnode) { - vnode.shapeFlag &= ~256; - vnode.shapeFlag &= ~512; -} -__name(resetShapeFlag, "resetShapeFlag"); -function getInnerChild(vnode) { - return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; -} -__name(getInnerChild, "getInnerChild"); -function injectHook(type, hook, target2 = currentInstance, prepend2 = false) { - if (target2) { - const hooks2 = target2[type] || (target2[type] = []); - const wrappedHook = hook.__weh || (hook.__weh = (...args) => { - pauseTracking(); - const reset2 = setCurrentInstance(target2); - const res = callWithAsyncErrorHandling(hook, target2, type, args); - reset2(); - resetTracking(); - return res; - }); - if (prepend2) { - hooks2.unshift(wrappedHook); - } else { - hooks2.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, target2 = currentInstance) => { - if (!isInSSRComponentSetup || lifecycle2 === "sp") { - injectHook(lifecycle2, (...args) => hook(...args), target2); - } -}, "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, target2 = currentInstance) { - injectHook("ec", hook, target2); -} -__name(onErrorCaptured, "onErrorCaptured"); -const COMPONENTS = "components"; -const DIRECTIVES = "directives"; -function resolveComponent(name2, maybeSelfReference) { - return resolveAsset(COMPONENTS, name2, true, maybeSelfReference) || name2; -} -__name(resolveComponent, "resolveComponent"); -const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc"); -function resolveDynamicComponent(component) { - if (isString$9(component)) { - return resolveAsset(COMPONENTS, component, false) || component; - } else { - return component || NULL_DYNAMIC_COMPONENT; - } -} -__name(resolveDynamicComponent, "resolveDynamicComponent"); -function resolveDirective(name2) { - return resolveAsset(DIRECTIVES, name2); -} -__name(resolveDirective, "resolveDirective"); -function resolveAsset(type, name2, 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 === name2 || selfName === camelize$1(name2) || selfName === capitalize$1(camelize$1(name2)))) { - return Component; - } - } - const res = ( - // local registration - // check instance[type] first which is resolved for options API - resolve$2(instance[type] || Component[type], name2) || // global registration - resolve$2(instance.appContext[type], name2) - ); - 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)}: ${name2}${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$2(registry, name2) { - return registry && (registry[name2] || registry[camelize$1(name2)] || registry[capitalize$1(camelize$1(name2))]); -} -__name(resolve$2, "resolve$2"); -function renderList(source, renderItem, cache2, index2) { - let ret; - const cached = cache2 && cache2[index2]; - const sourceIsArray = isArray$b(source); - if (sourceIsArray || isString$9(source)) { - const sourceIsReactiveArray = sourceIsArray && isReactive(source); - let needsWrap = false; - if (sourceIsReactiveArray) { - needsWrap = !isShallow(source); - source = shallowReadArray(source); - } - ret = new Array(source.length); - for (let i2 = 0, l2 = source.length; i2 < l2; i2++) { - ret[i2] = renderItem( - needsWrap ? toReactive$1(source[i2]) : source[i2], - i2, - void 0, - cached && cached[i2] - ); - } - } 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 i2 = 0; i2 < source; i2++) { - ret[i2] = renderItem(i2 + 1, i2, void 0, cached && cached[i2]); - } - } else if (isObject$f(source)) { - if (source[Symbol.iterator]) { - ret = Array.from( - source, - (item3, i2) => renderItem(item3, i2, void 0, cached && cached[i2]) - ); - } else { - const keys2 = Object.keys(source); - ret = new Array(keys2.length); - for (let i2 = 0, l2 = keys2.length; i2 < l2; i2++) { - const key = keys2[i2]; - ret[i2] = renderItem(source[key], key, i2, cached && cached[i2]); - } - } - } else { - ret = []; - } - if (cache2) { - cache2[index2] = ret; - } - return ret; -} -__name(renderList, "renderList"); -function createSlots(slots, dynamicSlots) { - for (let i2 = 0; i2 < dynamicSlots.length; i2++) { - const slot = dynamicSlots[i2]; - if (isArray$b(slot)) { - for (let j2 = 0; j2 < slot.length; j2++) { - slots[slot[j2].name] = slot[j2].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"); -function renderSlot(slots, name2, props = {}, fallback, noSlotted) { - if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) { - if (name2 !== "default") props.name = name2; - return openBlock(), createBlock( - Fragment$1, - null, - [createVNode("slot", props, fallback && fallback())], - 64 - ); - } - let slot = slots[name2]; - 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 slotKey = 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; - const rendered = createBlock( - Fragment$1, - { - key: (slotKey && !isSymbol$1(slotKey) ? slotKey : `_${name2}`) + // #7256 force differentiate fallback content from actual content - (!validSlotContent && fallback ? "_fb" : "") - }, - 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$1 && !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((i2) => { - if (!i2) return null; - if (isStatefulComponent(i2)) return getComponentPublicInstance(i2); - return getPublicInstance(i2.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((i2) => i2, "$"), - $el: /* @__PURE__ */ __name((i2) => i2.vnode.el, "$el"), - $data: /* @__PURE__ */ __name((i2) => i2.data, "$data"), - $props: /* @__PURE__ */ __name((i2) => false ? shallowReadonly(i2.props) : i2.props, "$props"), - $attrs: /* @__PURE__ */ __name((i2) => false ? shallowReadonly(i2.attrs) : i2.attrs, "$attrs"), - $slots: /* @__PURE__ */ __name((i2) => false ? shallowReadonly(i2.slots) : i2.slots, "$slots"), - $refs: /* @__PURE__ */ __name((i2) => false ? shallowReadonly(i2.refs) : i2.refs, "$refs"), - $parent: /* @__PURE__ */ __name((i2) => getPublicInstance(i2.parent), "$parent"), - $root: /* @__PURE__ */ __name((i2) => getPublicInstance(i2.root), "$root"), - $host: /* @__PURE__ */ __name((i2) => i2.ce, "$host"), - $emit: /* @__PURE__ */ __name((i2) => i2.emit, "$emit"), - $options: /* @__PURE__ */ __name((i2) => true ? resolveMergedOptions(i2) : i2.type, "$options"), - $forceUpdate: /* @__PURE__ */ __name((i2) => i2.f || (i2.f = () => { - queueJob(i2.update); - }), "$forceUpdate"), - $nextTick: /* @__PURE__ */ __name((i2) => i2.n || (i2.n = nextTick.bind(i2.proxy)), "$nextTick"), - $watch: /* @__PURE__ */ __name((i2) => true ? instanceWatch.bind(i2) : 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: data26, props, accessCache, type, appContext } = instance; - if (false) { - return true; - } - let normalizedProps; - if (key[0] !== "$") { - const n2 = accessCache[key]; - if (n2 !== void 0) { - switch (n2) { - case 1: - return setupState[key]; - case 2: - return data26[key]; - case 4: - return ctx[key]; - case 3: - return props[key]; - } - } else if (hasSetupBinding(setupState, key)) { - accessCache[key] = 1; - return setupState[key]; - } else if (data26 !== EMPTY_OBJ && hasOwn$3(data26, key)) { - accessCache[key] = 2; - return data26[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 (data26 !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn$3(data26, 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, value4) { - const { data: data26, setupState, ctx } = instance; - if (hasSetupBinding(setupState, key)) { - setupState[key] = value4; - return true; - } else if (false) { - warn$1$1(`Cannot mutate - - - -

- - diff --git a/web/materialdesignicons.min.css b/web/materialdesignicons.min.css deleted file mode 100644 index e2ea8930c..000000000 --- a/web/materialdesignicons.min.css +++ /dev/null @@ -1,3 +0,0 @@ -@font-face{font-family:"Material Design Icons";src:url("fonts/materialdesignicons-webfont.eot?v=7.4.47");src:url("fonts/materialdesignicons-webfont.eot?#iefix&v=7.4.47") format("embedded-opentype"),url("fonts/materialdesignicons-webfont.woff2?v=7.4.47") format("woff2"),url("fonts/materialdesignicons-webfont.woff?v=7.4.47") format("woff"),url("fonts/materialdesignicons-webfont.ttf?v=7.4.47") format("truetype");font-weight:normal;font-style:normal}.mdi:before,.mdi-set{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.mdi-ab-testing::before{content:"\F01C9"}.mdi-abacus::before{content:"\F16E0"}.mdi-abjad-arabic::before{content:"\F1328"}.mdi-abjad-hebrew::before{content:"\F1329"}.mdi-abugida-devanagari::before{content:"\F132A"}.mdi-abugida-thai::before{content:"\F132B"}.mdi-access-point::before{content:"\F0003"}.mdi-access-point-check::before{content:"\F1538"}.mdi-access-point-minus::before{content:"\F1539"}.mdi-access-point-network::before{content:"\F0002"}.mdi-access-point-network-off::before{content:"\F0BE1"}.mdi-access-point-off::before{content:"\F1511"}.mdi-access-point-plus::before{content:"\F153A"}.mdi-access-point-remove::before{content:"\F153B"}.mdi-account::before{content:"\F0004"}.mdi-account-alert::before{content:"\F0005"}.mdi-account-alert-outline::before{content:"\F0B50"}.mdi-account-arrow-down::before{content:"\F1868"}.mdi-account-arrow-down-outline::before{content:"\F1869"}.mdi-account-arrow-left::before{content:"\F0B51"}.mdi-account-arrow-left-outline::before{content:"\F0B52"}.mdi-account-arrow-right::before{content:"\F0B53"}.mdi-account-arrow-right-outline::before{content:"\F0B54"}.mdi-account-arrow-up::before{content:"\F1867"}.mdi-account-arrow-up-outline::before{content:"\F186A"}.mdi-account-badge::before{content:"\F1B0A"}.mdi-account-badge-outline::before{content:"\F1B0B"}.mdi-account-box::before{content:"\F0006"}.mdi-account-box-edit-outline::before{content:"\F1CC8"}.mdi-account-box-minus-outline::before{content:"\F1CC9"}.mdi-account-box-multiple::before{content:"\F0934"}.mdi-account-box-multiple-outline::before{content:"\F100A"}.mdi-account-box-outline::before{content:"\F0007"}.mdi-account-box-plus-outline::before{content:"\F1CCA"}.mdi-account-cancel::before{content:"\F12DF"}.mdi-account-cancel-outline::before{content:"\F12E0"}.mdi-account-card::before{content:"\F1BA4"}.mdi-account-card-outline::before{content:"\F1BA5"}.mdi-account-cash::before{content:"\F1097"}.mdi-account-cash-outline::before{content:"\F1098"}.mdi-account-check::before{content:"\F0008"}.mdi-account-check-outline::before{content:"\F0BE2"}.mdi-account-child::before{content:"\F0A89"}.mdi-account-child-circle::before{content:"\F0A8A"}.mdi-account-child-outline::before{content:"\F10C8"}.mdi-account-circle::before{content:"\F0009"}.mdi-account-circle-outline::before{content:"\F0B55"}.mdi-account-clock::before{content:"\F0B56"}.mdi-account-clock-outline::before{content:"\F0B57"}.mdi-account-cog::before{content:"\F1370"}.mdi-account-cog-outline::before{content:"\F1371"}.mdi-account-convert::before{content:"\F000A"}.mdi-account-convert-outline::before{content:"\F1301"}.mdi-account-cowboy-hat::before{content:"\F0E9B"}.mdi-account-cowboy-hat-outline::before{content:"\F17F3"}.mdi-account-credit-card::before{content:"\F1BA6"}.mdi-account-credit-card-outline::before{content:"\F1BA7"}.mdi-account-details::before{content:"\F0631"}.mdi-account-details-outline::before{content:"\F1372"}.mdi-account-edit::before{content:"\F06BC"}.mdi-account-edit-outline::before{content:"\F0FFB"}.mdi-account-eye::before{content:"\F0420"}.mdi-account-eye-outline::before{content:"\F127B"}.mdi-account-file::before{content:"\F1CA7"}.mdi-account-file-outline::before{content:"\F1CA8"}.mdi-account-file-text::before{content:"\F1CA9"}.mdi-account-file-text-outline::before{content:"\F1CAA"}.mdi-account-filter::before{content:"\F0936"}.mdi-account-filter-outline::before{content:"\F0F9D"}.mdi-account-group::before{content:"\F0849"}.mdi-account-group-outline::before{content:"\F0B58"}.mdi-account-hard-hat::before{content:"\F05B5"}.mdi-account-hard-hat-outline::before{content:"\F1A1F"}.mdi-account-heart::before{content:"\F0899"}.mdi-account-heart-outline::before{content:"\F0BE3"}.mdi-account-injury::before{content:"\F1815"}.mdi-account-injury-outline::before{content:"\F1816"}.mdi-account-key::before{content:"\F000B"}.mdi-account-key-outline::before{content:"\F0BE4"}.mdi-account-lock::before{content:"\F115E"}.mdi-account-lock-open::before{content:"\F1960"}.mdi-account-lock-open-outline::before{content:"\F1961"}.mdi-account-lock-outline::before{content:"\F115F"}.mdi-account-minus::before{content:"\F000D"}.mdi-account-minus-outline::before{content:"\F0AEC"}.mdi-account-multiple::before{content:"\F000E"}.mdi-account-multiple-check::before{content:"\F08C5"}.mdi-account-multiple-check-outline::before{content:"\F11FE"}.mdi-account-multiple-minus::before{content:"\F05D3"}.mdi-account-multiple-minus-outline::before{content:"\F0BE5"}.mdi-account-multiple-outline::before{content:"\F000F"}.mdi-account-multiple-plus::before{content:"\F0010"}.mdi-account-multiple-plus-outline::before{content:"\F0800"}.mdi-account-multiple-remove::before{content:"\F120A"}.mdi-account-multiple-remove-outline::before{content:"\F120B"}.mdi-account-music::before{content:"\F0803"}.mdi-account-music-outline::before{content:"\F0CE9"}.mdi-account-network::before{content:"\F0011"}.mdi-account-network-off::before{content:"\F1AF1"}.mdi-account-network-off-outline::before{content:"\F1AF2"}.mdi-account-network-outline::before{content:"\F0BE6"}.mdi-account-off::before{content:"\F0012"}.mdi-account-off-outline::before{content:"\F0BE7"}.mdi-account-outline::before{content:"\F0013"}.mdi-account-plus::before{content:"\F0014"}.mdi-account-plus-outline::before{content:"\F0801"}.mdi-account-question::before{content:"\F0B59"}.mdi-account-question-outline::before{content:"\F0B5A"}.mdi-account-reactivate::before{content:"\F152B"}.mdi-account-reactivate-outline::before{content:"\F152C"}.mdi-account-remove::before{content:"\F0015"}.mdi-account-remove-outline::before{content:"\F0AED"}.mdi-account-school::before{content:"\F1A20"}.mdi-account-school-outline::before{content:"\F1A21"}.mdi-account-search::before{content:"\F0016"}.mdi-account-search-outline::before{content:"\F0935"}.mdi-account-settings::before{content:"\F0630"}.mdi-account-settings-outline::before{content:"\F10C9"}.mdi-account-star::before{content:"\F0017"}.mdi-account-star-outline::before{content:"\F0BE8"}.mdi-account-supervisor::before{content:"\F0A8B"}.mdi-account-supervisor-circle::before{content:"\F0A8C"}.mdi-account-supervisor-circle-outline::before{content:"\F14EC"}.mdi-account-supervisor-outline::before{content:"\F112D"}.mdi-account-switch::before{content:"\F0019"}.mdi-account-switch-outline::before{content:"\F04CB"}.mdi-account-sync::before{content:"\F191B"}.mdi-account-sync-outline::before{content:"\F191C"}.mdi-account-tag::before{content:"\F1C1B"}.mdi-account-tag-outline::before{content:"\F1C1C"}.mdi-account-tie::before{content:"\F0CE3"}.mdi-account-tie-hat::before{content:"\F1898"}.mdi-account-tie-hat-outline::before{content:"\F1899"}.mdi-account-tie-outline::before{content:"\F10CA"}.mdi-account-tie-voice::before{content:"\F1308"}.mdi-account-tie-voice-off::before{content:"\F130A"}.mdi-account-tie-voice-off-outline::before{content:"\F130B"}.mdi-account-tie-voice-outline::before{content:"\F1309"}.mdi-account-tie-woman::before{content:"\F1A8C"}.mdi-account-voice::before{content:"\F05CB"}.mdi-account-voice-off::before{content:"\F0ED4"}.mdi-account-wrench::before{content:"\F189A"}.mdi-account-wrench-outline::before{content:"\F189B"}.mdi-adjust::before{content:"\F001A"}.mdi-advertisements::before{content:"\F192A"}.mdi-advertisements-off::before{content:"\F192B"}.mdi-air-conditioner::before{content:"\F001B"}.mdi-air-filter::before{content:"\F0D43"}.mdi-air-horn::before{content:"\F0DAC"}.mdi-air-humidifier::before{content:"\F1099"}.mdi-air-humidifier-off::before{content:"\F1466"}.mdi-air-purifier::before{content:"\F0D44"}.mdi-air-purifier-off::before{content:"\F1B57"}.mdi-airbag::before{content:"\F0BE9"}.mdi-airballoon::before{content:"\F001C"}.mdi-airballoon-outline::before{content:"\F100B"}.mdi-airplane::before{content:"\F001D"}.mdi-airplane-alert::before{content:"\F187A"}.mdi-airplane-check::before{content:"\F187B"}.mdi-airplane-clock::before{content:"\F187C"}.mdi-airplane-cog::before{content:"\F187D"}.mdi-airplane-edit::before{content:"\F187E"}.mdi-airplane-landing::before{content:"\F05D4"}.mdi-airplane-marker::before{content:"\F187F"}.mdi-airplane-minus::before{content:"\F1880"}.mdi-airplane-off::before{content:"\F001E"}.mdi-airplane-plus::before{content:"\F1881"}.mdi-airplane-remove::before{content:"\F1882"}.mdi-airplane-search::before{content:"\F1883"}.mdi-airplane-settings::before{content:"\F1884"}.mdi-airplane-takeoff::before{content:"\F05D5"}.mdi-airport::before{content:"\F084B"}.mdi-alarm::before{content:"\F0020"}.mdi-alarm-bell::before{content:"\F078E"}.mdi-alarm-check::before{content:"\F0021"}.mdi-alarm-light::before{content:"\F078F"}.mdi-alarm-light-off::before{content:"\F171E"}.mdi-alarm-light-off-outline::before{content:"\F171F"}.mdi-alarm-light-outline::before{content:"\F0BEA"}.mdi-alarm-multiple::before{content:"\F0022"}.mdi-alarm-note::before{content:"\F0E71"}.mdi-alarm-note-off::before{content:"\F0E72"}.mdi-alarm-off::before{content:"\F0023"}.mdi-alarm-panel::before{content:"\F15C4"}.mdi-alarm-panel-outline::before{content:"\F15C5"}.mdi-alarm-plus::before{content:"\F0024"}.mdi-alarm-snooze::before{content:"\F068E"}.mdi-album::before{content:"\F0025"}.mdi-alert::before{content:"\F0026"}.mdi-alert-box::before{content:"\F0027"}.mdi-alert-box-outline::before{content:"\F0CE4"}.mdi-alert-circle::before{content:"\F0028"}.mdi-alert-circle-check::before{content:"\F11ED"}.mdi-alert-circle-check-outline::before{content:"\F11EE"}.mdi-alert-circle-outline::before{content:"\F05D6"}.mdi-alert-decagram::before{content:"\F06BD"}.mdi-alert-decagram-outline::before{content:"\F0CE5"}.mdi-alert-minus::before{content:"\F14BB"}.mdi-alert-minus-outline::before{content:"\F14BE"}.mdi-alert-octagon::before{content:"\F0029"}.mdi-alert-octagon-outline::before{content:"\F0CE6"}.mdi-alert-octagram::before{content:"\F0767"}.mdi-alert-octagram-outline::before{content:"\F0CE7"}.mdi-alert-outline::before{content:"\F002A"}.mdi-alert-plus::before{content:"\F14BA"}.mdi-alert-plus-outline::before{content:"\F14BD"}.mdi-alert-remove::before{content:"\F14BC"}.mdi-alert-remove-outline::before{content:"\F14BF"}.mdi-alert-rhombus::before{content:"\F11CE"}.mdi-alert-rhombus-outline::before{content:"\F11CF"}.mdi-alien::before{content:"\F089A"}.mdi-alien-outline::before{content:"\F10CB"}.mdi-align-horizontal-center::before{content:"\F11C3"}.mdi-align-horizontal-distribute::before{content:"\F1962"}.mdi-align-horizontal-left::before{content:"\F11C2"}.mdi-align-horizontal-right::before{content:"\F11C4"}.mdi-align-vertical-bottom::before{content:"\F11C5"}.mdi-align-vertical-center::before{content:"\F11C6"}.mdi-align-vertical-distribute::before{content:"\F1963"}.mdi-align-vertical-top::before{content:"\F11C7"}.mdi-all-inclusive::before{content:"\F06BE"}.mdi-all-inclusive-box::before{content:"\F188D"}.mdi-all-inclusive-box-outline::before{content:"\F188E"}.mdi-allergy::before{content:"\F1258"}.mdi-alpha::before{content:"\F002B"}.mdi-alpha-a::before{content:"\F0AEE"}.mdi-alpha-a-box::before{content:"\F0B08"}.mdi-alpha-a-box-outline::before{content:"\F0BEB"}.mdi-alpha-a-circle::before{content:"\F0BEC"}.mdi-alpha-a-circle-outline::before{content:"\F0BED"}.mdi-alpha-b::before{content:"\F0AEF"}.mdi-alpha-b-box::before{content:"\F0B09"}.mdi-alpha-b-box-outline::before{content:"\F0BEE"}.mdi-alpha-b-circle::before{content:"\F0BEF"}.mdi-alpha-b-circle-outline::before{content:"\F0BF0"}.mdi-alpha-c::before{content:"\F0AF0"}.mdi-alpha-c-box::before{content:"\F0B0A"}.mdi-alpha-c-box-outline::before{content:"\F0BF1"}.mdi-alpha-c-circle::before{content:"\F0BF2"}.mdi-alpha-c-circle-outline::before{content:"\F0BF3"}.mdi-alpha-d::before{content:"\F0AF1"}.mdi-alpha-d-box::before{content:"\F0B0B"}.mdi-alpha-d-box-outline::before{content:"\F0BF4"}.mdi-alpha-d-circle::before{content:"\F0BF5"}.mdi-alpha-d-circle-outline::before{content:"\F0BF6"}.mdi-alpha-e::before{content:"\F0AF2"}.mdi-alpha-e-box::before{content:"\F0B0C"}.mdi-alpha-e-box-outline::before{content:"\F0BF7"}.mdi-alpha-e-circle::before{content:"\F0BF8"}.mdi-alpha-e-circle-outline::before{content:"\F0BF9"}.mdi-alpha-f::before{content:"\F0AF3"}.mdi-alpha-f-box::before{content:"\F0B0D"}.mdi-alpha-f-box-outline::before{content:"\F0BFA"}.mdi-alpha-f-circle::before{content:"\F0BFB"}.mdi-alpha-f-circle-outline::before{content:"\F0BFC"}.mdi-alpha-g::before{content:"\F0AF4"}.mdi-alpha-g-box::before{content:"\F0B0E"}.mdi-alpha-g-box-outline::before{content:"\F0BFD"}.mdi-alpha-g-circle::before{content:"\F0BFE"}.mdi-alpha-g-circle-outline::before{content:"\F0BFF"}.mdi-alpha-h::before{content:"\F0AF5"}.mdi-alpha-h-box::before{content:"\F0B0F"}.mdi-alpha-h-box-outline::before{content:"\F0C00"}.mdi-alpha-h-circle::before{content:"\F0C01"}.mdi-alpha-h-circle-outline::before{content:"\F0C02"}.mdi-alpha-i::before{content:"\F0AF6"}.mdi-alpha-i-box::before{content:"\F0B10"}.mdi-alpha-i-box-outline::before{content:"\F0C03"}.mdi-alpha-i-circle::before{content:"\F0C04"}.mdi-alpha-i-circle-outline::before{content:"\F0C05"}.mdi-alpha-j::before{content:"\F0AF7"}.mdi-alpha-j-box::before{content:"\F0B11"}.mdi-alpha-j-box-outline::before{content:"\F0C06"}.mdi-alpha-j-circle::before{content:"\F0C07"}.mdi-alpha-j-circle-outline::before{content:"\F0C08"}.mdi-alpha-k::before{content:"\F0AF8"}.mdi-alpha-k-box::before{content:"\F0B12"}.mdi-alpha-k-box-outline::before{content:"\F0C09"}.mdi-alpha-k-circle::before{content:"\F0C0A"}.mdi-alpha-k-circle-outline::before{content:"\F0C0B"}.mdi-alpha-l::before{content:"\F0AF9"}.mdi-alpha-l-box::before{content:"\F0B13"}.mdi-alpha-l-box-outline::before{content:"\F0C0C"}.mdi-alpha-l-circle::before{content:"\F0C0D"}.mdi-alpha-l-circle-outline::before{content:"\F0C0E"}.mdi-alpha-m::before{content:"\F0AFA"}.mdi-alpha-m-box::before{content:"\F0B14"}.mdi-alpha-m-box-outline::before{content:"\F0C0F"}.mdi-alpha-m-circle::before{content:"\F0C10"}.mdi-alpha-m-circle-outline::before{content:"\F0C11"}.mdi-alpha-n::before{content:"\F0AFB"}.mdi-alpha-n-box::before{content:"\F0B15"}.mdi-alpha-n-box-outline::before{content:"\F0C12"}.mdi-alpha-n-circle::before{content:"\F0C13"}.mdi-alpha-n-circle-outline::before{content:"\F0C14"}.mdi-alpha-o::before{content:"\F0AFC"}.mdi-alpha-o-box::before{content:"\F0B16"}.mdi-alpha-o-box-outline::before{content:"\F0C15"}.mdi-alpha-o-circle::before{content:"\F0C16"}.mdi-alpha-o-circle-outline::before{content:"\F0C17"}.mdi-alpha-p::before{content:"\F0AFD"}.mdi-alpha-p-box::before{content:"\F0B17"}.mdi-alpha-p-box-outline::before{content:"\F0C18"}.mdi-alpha-p-circle::before{content:"\F0C19"}.mdi-alpha-p-circle-outline::before{content:"\F0C1A"}.mdi-alpha-q::before{content:"\F0AFE"}.mdi-alpha-q-box::before{content:"\F0B18"}.mdi-alpha-q-box-outline::before{content:"\F0C1B"}.mdi-alpha-q-circle::before{content:"\F0C1C"}.mdi-alpha-q-circle-outline::before{content:"\F0C1D"}.mdi-alpha-r::before{content:"\F0AFF"}.mdi-alpha-r-box::before{content:"\F0B19"}.mdi-alpha-r-box-outline::before{content:"\F0C1E"}.mdi-alpha-r-circle::before{content:"\F0C1F"}.mdi-alpha-r-circle-outline::before{content:"\F0C20"}.mdi-alpha-s::before{content:"\F0B00"}.mdi-alpha-s-box::before{content:"\F0B1A"}.mdi-alpha-s-box-outline::before{content:"\F0C21"}.mdi-alpha-s-circle::before{content:"\F0C22"}.mdi-alpha-s-circle-outline::before{content:"\F0C23"}.mdi-alpha-t::before{content:"\F0B01"}.mdi-alpha-t-box::before{content:"\F0B1B"}.mdi-alpha-t-box-outline::before{content:"\F0C24"}.mdi-alpha-t-circle::before{content:"\F0C25"}.mdi-alpha-t-circle-outline::before{content:"\F0C26"}.mdi-alpha-u::before{content:"\F0B02"}.mdi-alpha-u-box::before{content:"\F0B1C"}.mdi-alpha-u-box-outline::before{content:"\F0C27"}.mdi-alpha-u-circle::before{content:"\F0C28"}.mdi-alpha-u-circle-outline::before{content:"\F0C29"}.mdi-alpha-v::before{content:"\F0B03"}.mdi-alpha-v-box::before{content:"\F0B1D"}.mdi-alpha-v-box-outline::before{content:"\F0C2A"}.mdi-alpha-v-circle::before{content:"\F0C2B"}.mdi-alpha-v-circle-outline::before{content:"\F0C2C"}.mdi-alpha-w::before{content:"\F0B04"}.mdi-alpha-w-box::before{content:"\F0B1E"}.mdi-alpha-w-box-outline::before{content:"\F0C2D"}.mdi-alpha-w-circle::before{content:"\F0C2E"}.mdi-alpha-w-circle-outline::before{content:"\F0C2F"}.mdi-alpha-x::before{content:"\F0B05"}.mdi-alpha-x-box::before{content:"\F0B1F"}.mdi-alpha-x-box-outline::before{content:"\F0C30"}.mdi-alpha-x-circle::before{content:"\F0C31"}.mdi-alpha-x-circle-outline::before{content:"\F0C32"}.mdi-alpha-y::before{content:"\F0B06"}.mdi-alpha-y-box::before{content:"\F0B20"}.mdi-alpha-y-box-outline::before{content:"\F0C33"}.mdi-alpha-y-circle::before{content:"\F0C34"}.mdi-alpha-y-circle-outline::before{content:"\F0C35"}.mdi-alpha-z::before{content:"\F0B07"}.mdi-alpha-z-box::before{content:"\F0B21"}.mdi-alpha-z-box-outline::before{content:"\F0C36"}.mdi-alpha-z-circle::before{content:"\F0C37"}.mdi-alpha-z-circle-outline::before{content:"\F0C38"}.mdi-alphabet-aurebesh::before{content:"\F132C"}.mdi-alphabet-cyrillic::before{content:"\F132D"}.mdi-alphabet-greek::before{content:"\F132E"}.mdi-alphabet-latin::before{content:"\F132F"}.mdi-alphabet-piqad::before{content:"\F1330"}.mdi-alphabet-tengwar::before{content:"\F1337"}.mdi-alphabetical::before{content:"\F002C"}.mdi-alphabetical-off::before{content:"\F100C"}.mdi-alphabetical-variant::before{content:"\F100D"}.mdi-alphabetical-variant-off::before{content:"\F100E"}.mdi-altimeter::before{content:"\F05D7"}.mdi-ambulance::before{content:"\F002F"}.mdi-ammunition::before{content:"\F0CE8"}.mdi-ampersand::before{content:"\F0A8D"}.mdi-amplifier::before{content:"\F0030"}.mdi-amplifier-off::before{content:"\F11B5"}.mdi-anchor::before{content:"\F0031"}.mdi-android::before{content:"\F0032"}.mdi-android-studio::before{content:"\F0034"}.mdi-angle-acute::before{content:"\F0937"}.mdi-angle-obtuse::before{content:"\F0938"}.mdi-angle-right::before{content:"\F0939"}.mdi-angular::before{content:"\F06B2"}.mdi-angularjs::before{content:"\F06BF"}.mdi-animation::before{content:"\F05D8"}.mdi-animation-outline::before{content:"\F0A8F"}.mdi-animation-play::before{content:"\F093A"}.mdi-animation-play-outline::before{content:"\F0A90"}.mdi-ansible::before{content:"\F109A"}.mdi-antenna::before{content:"\F1119"}.mdi-anvil::before{content:"\F089B"}.mdi-apache-kafka::before{content:"\F100F"}.mdi-api::before{content:"\F109B"}.mdi-api-off::before{content:"\F1257"}.mdi-apple::before{content:"\F0035"}.mdi-apple-finder::before{content:"\F0036"}.mdi-apple-icloud::before{content:"\F0038"}.mdi-apple-ios::before{content:"\F0037"}.mdi-apple-keyboard-caps::before{content:"\F0632"}.mdi-apple-keyboard-command::before{content:"\F0633"}.mdi-apple-keyboard-control::before{content:"\F0634"}.mdi-apple-keyboard-option::before{content:"\F0635"}.mdi-apple-keyboard-shift::before{content:"\F0636"}.mdi-apple-safari::before{content:"\F0039"}.mdi-application::before{content:"\F08C6"}.mdi-application-array::before{content:"\F10F5"}.mdi-application-array-outline::before{content:"\F10F6"}.mdi-application-braces::before{content:"\F10F7"}.mdi-application-braces-outline::before{content:"\F10F8"}.mdi-application-brackets::before{content:"\F0C8B"}.mdi-application-brackets-outline::before{content:"\F0C8C"}.mdi-application-cog::before{content:"\F0675"}.mdi-application-cog-outline::before{content:"\F1577"}.mdi-application-edit::before{content:"\F00AE"}.mdi-application-edit-outline::before{content:"\F0619"}.mdi-application-export::before{content:"\F0DAD"}.mdi-application-import::before{content:"\F0DAE"}.mdi-application-outline::before{content:"\F0614"}.mdi-application-parentheses::before{content:"\F10F9"}.mdi-application-parentheses-outline::before{content:"\F10FA"}.mdi-application-settings::before{content:"\F0B60"}.mdi-application-settings-outline::before{content:"\F1555"}.mdi-application-variable::before{content:"\F10FB"}.mdi-application-variable-outline::before{content:"\F10FC"}.mdi-approximately-equal::before{content:"\F0F9E"}.mdi-approximately-equal-box::before{content:"\F0F9F"}.mdi-apps::before{content:"\F003B"}.mdi-apps-box::before{content:"\F0D46"}.mdi-arch::before{content:"\F08C7"}.mdi-archive::before{content:"\F003C"}.mdi-archive-alert::before{content:"\F14FD"}.mdi-archive-alert-outline::before{content:"\F14FE"}.mdi-archive-arrow-down::before{content:"\F1259"}.mdi-archive-arrow-down-outline::before{content:"\F125A"}.mdi-archive-arrow-up::before{content:"\F125B"}.mdi-archive-arrow-up-outline::before{content:"\F125C"}.mdi-archive-cancel::before{content:"\F174B"}.mdi-archive-cancel-outline::before{content:"\F174C"}.mdi-archive-check::before{content:"\F174D"}.mdi-archive-check-outline::before{content:"\F174E"}.mdi-archive-clock::before{content:"\F174F"}.mdi-archive-clock-outline::before{content:"\F1750"}.mdi-archive-cog::before{content:"\F1751"}.mdi-archive-cog-outline::before{content:"\F1752"}.mdi-archive-edit::before{content:"\F1753"}.mdi-archive-edit-outline::before{content:"\F1754"}.mdi-archive-eye::before{content:"\F1755"}.mdi-archive-eye-outline::before{content:"\F1756"}.mdi-archive-lock::before{content:"\F1757"}.mdi-archive-lock-open::before{content:"\F1758"}.mdi-archive-lock-open-outline::before{content:"\F1759"}.mdi-archive-lock-outline::before{content:"\F175A"}.mdi-archive-marker::before{content:"\F175B"}.mdi-archive-marker-outline::before{content:"\F175C"}.mdi-archive-minus::before{content:"\F175D"}.mdi-archive-minus-outline::before{content:"\F175E"}.mdi-archive-music::before{content:"\F175F"}.mdi-archive-music-outline::before{content:"\F1760"}.mdi-archive-off::before{content:"\F1761"}.mdi-archive-off-outline::before{content:"\F1762"}.mdi-archive-outline::before{content:"\F120E"}.mdi-archive-plus::before{content:"\F1763"}.mdi-archive-plus-outline::before{content:"\F1764"}.mdi-archive-refresh::before{content:"\F1765"}.mdi-archive-refresh-outline::before{content:"\F1766"}.mdi-archive-remove::before{content:"\F1767"}.mdi-archive-remove-outline::before{content:"\F1768"}.mdi-archive-search::before{content:"\F1769"}.mdi-archive-search-outline::before{content:"\F176A"}.mdi-archive-settings::before{content:"\F176B"}.mdi-archive-settings-outline::before{content:"\F176C"}.mdi-archive-star::before{content:"\F176D"}.mdi-archive-star-outline::before{content:"\F176E"}.mdi-archive-sync::before{content:"\F176F"}.mdi-archive-sync-outline::before{content:"\F1770"}.mdi-arm-flex::before{content:"\F0FD7"}.mdi-arm-flex-outline::before{content:"\F0FD6"}.mdi-arrange-bring-forward::before{content:"\F003D"}.mdi-arrange-bring-to-front::before{content:"\F003E"}.mdi-arrange-send-backward::before{content:"\F003F"}.mdi-arrange-send-to-back::before{content:"\F0040"}.mdi-arrow-all::before{content:"\F0041"}.mdi-arrow-bottom-left::before{content:"\F0042"}.mdi-arrow-bottom-left-bold-box::before{content:"\F1964"}.mdi-arrow-bottom-left-bold-box-outline::before{content:"\F1965"}.mdi-arrow-bottom-left-bold-outline::before{content:"\F09B7"}.mdi-arrow-bottom-left-thick::before{content:"\F09B8"}.mdi-arrow-bottom-left-thin::before{content:"\F19B6"}.mdi-arrow-bottom-left-thin-circle-outline::before{content:"\F1596"}.mdi-arrow-bottom-right::before{content:"\F0043"}.mdi-arrow-bottom-right-bold-box::before{content:"\F1966"}.mdi-arrow-bottom-right-bold-box-outline::before{content:"\F1967"}.mdi-arrow-bottom-right-bold-outline::before{content:"\F09B9"}.mdi-arrow-bottom-right-thick::before{content:"\F09BA"}.mdi-arrow-bottom-right-thin::before{content:"\F19B7"}.mdi-arrow-bottom-right-thin-circle-outline::before{content:"\F1595"}.mdi-arrow-collapse::before{content:"\F0615"}.mdi-arrow-collapse-all::before{content:"\F0044"}.mdi-arrow-collapse-down::before{content:"\F0792"}.mdi-arrow-collapse-horizontal::before{content:"\F084C"}.mdi-arrow-collapse-left::before{content:"\F0793"}.mdi-arrow-collapse-right::before{content:"\F0794"}.mdi-arrow-collapse-up::before{content:"\F0795"}.mdi-arrow-collapse-vertical::before{content:"\F084D"}.mdi-arrow-decision::before{content:"\F09BB"}.mdi-arrow-decision-auto::before{content:"\F09BC"}.mdi-arrow-decision-auto-outline::before{content:"\F09BD"}.mdi-arrow-decision-outline::before{content:"\F09BE"}.mdi-arrow-down::before{content:"\F0045"}.mdi-arrow-down-bold::before{content:"\F072E"}.mdi-arrow-down-bold-box::before{content:"\F072F"}.mdi-arrow-down-bold-box-outline::before{content:"\F0730"}.mdi-arrow-down-bold-circle::before{content:"\F0047"}.mdi-arrow-down-bold-circle-outline::before{content:"\F0048"}.mdi-arrow-down-bold-hexagon-outline::before{content:"\F0049"}.mdi-arrow-down-bold-outline::before{content:"\F09BF"}.mdi-arrow-down-box::before{content:"\F06C0"}.mdi-arrow-down-circle::before{content:"\F0CDB"}.mdi-arrow-down-circle-outline::before{content:"\F0CDC"}.mdi-arrow-down-drop-circle::before{content:"\F004A"}.mdi-arrow-down-drop-circle-outline::before{content:"\F004B"}.mdi-arrow-down-left::before{content:"\F17A1"}.mdi-arrow-down-left-bold::before{content:"\F17A2"}.mdi-arrow-down-right::before{content:"\F17A3"}.mdi-arrow-down-right-bold::before{content:"\F17A4"}.mdi-arrow-down-thick::before{content:"\F0046"}.mdi-arrow-down-thin::before{content:"\F19B3"}.mdi-arrow-down-thin-circle-outline::before{content:"\F1599"}.mdi-arrow-expand::before{content:"\F0616"}.mdi-arrow-expand-all::before{content:"\F004C"}.mdi-arrow-expand-down::before{content:"\F0796"}.mdi-arrow-expand-horizontal::before{content:"\F084E"}.mdi-arrow-expand-left::before{content:"\F0797"}.mdi-arrow-expand-right::before{content:"\F0798"}.mdi-arrow-expand-up::before{content:"\F0799"}.mdi-arrow-expand-vertical::before{content:"\F084F"}.mdi-arrow-horizontal-lock::before{content:"\F115B"}.mdi-arrow-left::before{content:"\F004D"}.mdi-arrow-left-bold::before{content:"\F0731"}.mdi-arrow-left-bold-box::before{content:"\F0732"}.mdi-arrow-left-bold-box-outline::before{content:"\F0733"}.mdi-arrow-left-bold-circle::before{content:"\F004F"}.mdi-arrow-left-bold-circle-outline::before{content:"\F0050"}.mdi-arrow-left-bold-hexagon-outline::before{content:"\F0051"}.mdi-arrow-left-bold-outline::before{content:"\F09C0"}.mdi-arrow-left-bottom::before{content:"\F17A5"}.mdi-arrow-left-bottom-bold::before{content:"\F17A6"}.mdi-arrow-left-box::before{content:"\F06C1"}.mdi-arrow-left-circle::before{content:"\F0CDD"}.mdi-arrow-left-circle-outline::before{content:"\F0CDE"}.mdi-arrow-left-drop-circle::before{content:"\F0052"}.mdi-arrow-left-drop-circle-outline::before{content:"\F0053"}.mdi-arrow-left-right::before{content:"\F0E73"}.mdi-arrow-left-right-bold::before{content:"\F0E74"}.mdi-arrow-left-right-bold-outline::before{content:"\F09C1"}.mdi-arrow-left-thick::before{content:"\F004E"}.mdi-arrow-left-thin::before{content:"\F19B1"}.mdi-arrow-left-thin-circle-outline::before{content:"\F159A"}.mdi-arrow-left-top::before{content:"\F17A7"}.mdi-arrow-left-top-bold::before{content:"\F17A8"}.mdi-arrow-oscillating::before{content:"\F1C91"}.mdi-arrow-oscillating-off::before{content:"\F1C92"}.mdi-arrow-projectile::before{content:"\F1840"}.mdi-arrow-projectile-multiple::before{content:"\F183F"}.mdi-arrow-right::before{content:"\F0054"}.mdi-arrow-right-bold::before{content:"\F0734"}.mdi-arrow-right-bold-box::before{content:"\F0735"}.mdi-arrow-right-bold-box-outline::before{content:"\F0736"}.mdi-arrow-right-bold-circle::before{content:"\F0056"}.mdi-arrow-right-bold-circle-outline::before{content:"\F0057"}.mdi-arrow-right-bold-hexagon-outline::before{content:"\F0058"}.mdi-arrow-right-bold-outline::before{content:"\F09C2"}.mdi-arrow-right-bottom::before{content:"\F17A9"}.mdi-arrow-right-bottom-bold::before{content:"\F17AA"}.mdi-arrow-right-box::before{content:"\F06C2"}.mdi-arrow-right-circle::before{content:"\F0CDF"}.mdi-arrow-right-circle-outline::before{content:"\F0CE0"}.mdi-arrow-right-drop-circle::before{content:"\F0059"}.mdi-arrow-right-drop-circle-outline::before{content:"\F005A"}.mdi-arrow-right-thick::before{content:"\F0055"}.mdi-arrow-right-thin::before{content:"\F19B0"}.mdi-arrow-right-thin-circle-outline::before{content:"\F1598"}.mdi-arrow-right-top::before{content:"\F17AB"}.mdi-arrow-right-top-bold::before{content:"\F17AC"}.mdi-arrow-split-horizontal::before{content:"\F093B"}.mdi-arrow-split-vertical::before{content:"\F093C"}.mdi-arrow-top-left::before{content:"\F005B"}.mdi-arrow-top-left-bold-box::before{content:"\F1968"}.mdi-arrow-top-left-bold-box-outline::before{content:"\F1969"}.mdi-arrow-top-left-bold-outline::before{content:"\F09C3"}.mdi-arrow-top-left-bottom-right::before{content:"\F0E75"}.mdi-arrow-top-left-bottom-right-bold::before{content:"\F0E76"}.mdi-arrow-top-left-thick::before{content:"\F09C4"}.mdi-arrow-top-left-thin::before{content:"\F19B5"}.mdi-arrow-top-left-thin-circle-outline::before{content:"\F1593"}.mdi-arrow-top-right::before{content:"\F005C"}.mdi-arrow-top-right-bold-box::before{content:"\F196A"}.mdi-arrow-top-right-bold-box-outline::before{content:"\F196B"}.mdi-arrow-top-right-bold-outline::before{content:"\F09C5"}.mdi-arrow-top-right-bottom-left::before{content:"\F0E77"}.mdi-arrow-top-right-bottom-left-bold::before{content:"\F0E78"}.mdi-arrow-top-right-thick::before{content:"\F09C6"}.mdi-arrow-top-right-thin::before{content:"\F19B4"}.mdi-arrow-top-right-thin-circle-outline::before{content:"\F1594"}.mdi-arrow-u-down-left::before{content:"\F17AD"}.mdi-arrow-u-down-left-bold::before{content:"\F17AE"}.mdi-arrow-u-down-right::before{content:"\F17AF"}.mdi-arrow-u-down-right-bold::before{content:"\F17B0"}.mdi-arrow-u-left-bottom::before{content:"\F17B1"}.mdi-arrow-u-left-bottom-bold::before{content:"\F17B2"}.mdi-arrow-u-left-top::before{content:"\F17B3"}.mdi-arrow-u-left-top-bold::before{content:"\F17B4"}.mdi-arrow-u-right-bottom::before{content:"\F17B5"}.mdi-arrow-u-right-bottom-bold::before{content:"\F17B6"}.mdi-arrow-u-right-top::before{content:"\F17B7"}.mdi-arrow-u-right-top-bold::before{content:"\F17B8"}.mdi-arrow-u-up-left::before{content:"\F17B9"}.mdi-arrow-u-up-left-bold::before{content:"\F17BA"}.mdi-arrow-u-up-right::before{content:"\F17BB"}.mdi-arrow-u-up-right-bold::before{content:"\F17BC"}.mdi-arrow-up::before{content:"\F005D"}.mdi-arrow-up-bold::before{content:"\F0737"}.mdi-arrow-up-bold-box::before{content:"\F0738"}.mdi-arrow-up-bold-box-outline::before{content:"\F0739"}.mdi-arrow-up-bold-circle::before{content:"\F005F"}.mdi-arrow-up-bold-circle-outline::before{content:"\F0060"}.mdi-arrow-up-bold-hexagon-outline::before{content:"\F0061"}.mdi-arrow-up-bold-outline::before{content:"\F09C7"}.mdi-arrow-up-box::before{content:"\F06C3"}.mdi-arrow-up-circle::before{content:"\F0CE1"}.mdi-arrow-up-circle-outline::before{content:"\F0CE2"}.mdi-arrow-up-down::before{content:"\F0E79"}.mdi-arrow-up-down-bold::before{content:"\F0E7A"}.mdi-arrow-up-down-bold-outline::before{content:"\F09C8"}.mdi-arrow-up-drop-circle::before{content:"\F0062"}.mdi-arrow-up-drop-circle-outline::before{content:"\F0063"}.mdi-arrow-up-left::before{content:"\F17BD"}.mdi-arrow-up-left-bold::before{content:"\F17BE"}.mdi-arrow-up-right::before{content:"\F17BF"}.mdi-arrow-up-right-bold::before{content:"\F17C0"}.mdi-arrow-up-thick::before{content:"\F005E"}.mdi-arrow-up-thin::before{content:"\F19B2"}.mdi-arrow-up-thin-circle-outline::before{content:"\F1597"}.mdi-arrow-vertical-lock::before{content:"\F115C"}.mdi-artboard::before{content:"\F1B9A"}.mdi-artstation::before{content:"\F0B5B"}.mdi-aspect-ratio::before{content:"\F0A24"}.mdi-assistant::before{content:"\F0064"}.mdi-asterisk::before{content:"\F06C4"}.mdi-asterisk-circle-outline::before{content:"\F1A27"}.mdi-at::before{content:"\F0065"}.mdi-atlassian::before{content:"\F0804"}.mdi-atm::before{content:"\F0D47"}.mdi-atom::before{content:"\F0768"}.mdi-atom-variant::before{content:"\F0E7B"}.mdi-attachment::before{content:"\F0066"}.mdi-attachment-check::before{content:"\F1AC1"}.mdi-attachment-lock::before{content:"\F19C4"}.mdi-attachment-minus::before{content:"\F1AC2"}.mdi-attachment-off::before{content:"\F1AC3"}.mdi-attachment-plus::before{content:"\F1AC4"}.mdi-attachment-remove::before{content:"\F1AC5"}.mdi-atv::before{content:"\F1B70"}.mdi-audio-input-rca::before{content:"\F186B"}.mdi-audio-input-stereo-minijack::before{content:"\F186C"}.mdi-audio-input-xlr::before{content:"\F186D"}.mdi-audio-video::before{content:"\F093D"}.mdi-audio-video-off::before{content:"\F11B6"}.mdi-augmented-reality::before{content:"\F0850"}.mdi-aurora::before{content:"\F1BB9"}.mdi-auto-download::before{content:"\F137E"}.mdi-auto-fix::before{content:"\F0068"}.mdi-auto-mode::before{content:"\F1C20"}.mdi-auto-upload::before{content:"\F0069"}.mdi-autorenew::before{content:"\F006A"}.mdi-autorenew-off::before{content:"\F19E7"}.mdi-av-timer::before{content:"\F006B"}.mdi-awning::before{content:"\F1B87"}.mdi-awning-outline::before{content:"\F1B88"}.mdi-aws::before{content:"\F0E0F"}.mdi-axe::before{content:"\F08C8"}.mdi-axe-battle::before{content:"\F1842"}.mdi-axis::before{content:"\F0D48"}.mdi-axis-arrow::before{content:"\F0D49"}.mdi-axis-arrow-info::before{content:"\F140E"}.mdi-axis-arrow-lock::before{content:"\F0D4A"}.mdi-axis-lock::before{content:"\F0D4B"}.mdi-axis-x-arrow::before{content:"\F0D4C"}.mdi-axis-x-arrow-lock::before{content:"\F0D4D"}.mdi-axis-x-rotate-clockwise::before{content:"\F0D4E"}.mdi-axis-x-rotate-counterclockwise::before{content:"\F0D4F"}.mdi-axis-x-y-arrow-lock::before{content:"\F0D50"}.mdi-axis-y-arrow::before{content:"\F0D51"}.mdi-axis-y-arrow-lock::before{content:"\F0D52"}.mdi-axis-y-rotate-clockwise::before{content:"\F0D53"}.mdi-axis-y-rotate-counterclockwise::before{content:"\F0D54"}.mdi-axis-z-arrow::before{content:"\F0D55"}.mdi-axis-z-arrow-lock::before{content:"\F0D56"}.mdi-axis-z-rotate-clockwise::before{content:"\F0D57"}.mdi-axis-z-rotate-counterclockwise::before{content:"\F0D58"}.mdi-babel::before{content:"\F0A25"}.mdi-baby::before{content:"\F006C"}.mdi-baby-bottle::before{content:"\F0F39"}.mdi-baby-bottle-outline::before{content:"\F0F3A"}.mdi-baby-buggy::before{content:"\F13E0"}.mdi-baby-buggy-off::before{content:"\F1AF3"}.mdi-baby-carriage::before{content:"\F068F"}.mdi-baby-carriage-off::before{content:"\F0FA0"}.mdi-baby-face::before{content:"\F0E7C"}.mdi-baby-face-outline::before{content:"\F0E7D"}.mdi-backburger::before{content:"\F006D"}.mdi-backspace::before{content:"\F006E"}.mdi-backspace-outline::before{content:"\F0B5C"}.mdi-backspace-reverse::before{content:"\F0E7E"}.mdi-backspace-reverse-outline::before{content:"\F0E7F"}.mdi-backup-restore::before{content:"\F006F"}.mdi-bacteria::before{content:"\F0ED5"}.mdi-bacteria-outline::before{content:"\F0ED6"}.mdi-badge-account::before{content:"\F0DA7"}.mdi-badge-account-alert::before{content:"\F0DA8"}.mdi-badge-account-alert-outline::before{content:"\F0DA9"}.mdi-badge-account-horizontal::before{content:"\F0E0D"}.mdi-badge-account-horizontal-outline::before{content:"\F0E0E"}.mdi-badge-account-outline::before{content:"\F0DAA"}.mdi-badminton::before{content:"\F0851"}.mdi-bag-carry-on::before{content:"\F0F3B"}.mdi-bag-carry-on-check::before{content:"\F0D65"}.mdi-bag-carry-on-off::before{content:"\F0F3C"}.mdi-bag-checked::before{content:"\F0F3D"}.mdi-bag-personal::before{content:"\F0E10"}.mdi-bag-personal-off::before{content:"\F0E11"}.mdi-bag-personal-off-outline::before{content:"\F0E12"}.mdi-bag-personal-outline::before{content:"\F0E13"}.mdi-bag-personal-plus::before{content:"\F1CA4"}.mdi-bag-personal-plus-outline::before{content:"\F1CA5"}.mdi-bag-personal-tag::before{content:"\F1B0C"}.mdi-bag-personal-tag-outline::before{content:"\F1B0D"}.mdi-bag-suitcase::before{content:"\F158B"}.mdi-bag-suitcase-off::before{content:"\F158D"}.mdi-bag-suitcase-off-outline::before{content:"\F158E"}.mdi-bag-suitcase-outline::before{content:"\F158C"}.mdi-baguette::before{content:"\F0F3E"}.mdi-balcony::before{content:"\F1817"}.mdi-balloon::before{content:"\F0A26"}.mdi-ballot::before{content:"\F09C9"}.mdi-ballot-outline::before{content:"\F09CA"}.mdi-ballot-recount::before{content:"\F0C39"}.mdi-ballot-recount-outline::before{content:"\F0C3A"}.mdi-bandage::before{content:"\F0DAF"}.mdi-bank::before{content:"\F0070"}.mdi-bank-check::before{content:"\F1655"}.mdi-bank-circle::before{content:"\F1C03"}.mdi-bank-circle-outline::before{content:"\F1C04"}.mdi-bank-minus::before{content:"\F0DB0"}.mdi-bank-off::before{content:"\F1656"}.mdi-bank-off-outline::before{content:"\F1657"}.mdi-bank-outline::before{content:"\F0E80"}.mdi-bank-plus::before{content:"\F0DB1"}.mdi-bank-remove::before{content:"\F0DB2"}.mdi-bank-transfer::before{content:"\F0A27"}.mdi-bank-transfer-in::before{content:"\F0A28"}.mdi-bank-transfer-out::before{content:"\F0A29"}.mdi-barcode::before{content:"\F0071"}.mdi-barcode-off::before{content:"\F1236"}.mdi-barcode-scan::before{content:"\F0072"}.mdi-barley::before{content:"\F0073"}.mdi-barley-off::before{content:"\F0B5D"}.mdi-barn::before{content:"\F0B5E"}.mdi-barrel::before{content:"\F0074"}.mdi-barrel-outline::before{content:"\F1A28"}.mdi-baseball::before{content:"\F0852"}.mdi-baseball-bat::before{content:"\F0853"}.mdi-baseball-diamond::before{content:"\F15EC"}.mdi-baseball-diamond-outline::before{content:"\F15ED"}.mdi-baseball-outline::before{content:"\F1C5A"}.mdi-bash::before{content:"\F1183"}.mdi-basket::before{content:"\F0076"}.mdi-basket-check::before{content:"\F18E5"}.mdi-basket-check-outline::before{content:"\F18E6"}.mdi-basket-fill::before{content:"\F0077"}.mdi-basket-minus::before{content:"\F1523"}.mdi-basket-minus-outline::before{content:"\F1524"}.mdi-basket-off::before{content:"\F1525"}.mdi-basket-off-outline::before{content:"\F1526"}.mdi-basket-outline::before{content:"\F1181"}.mdi-basket-plus::before{content:"\F1527"}.mdi-basket-plus-outline::before{content:"\F1528"}.mdi-basket-remove::before{content:"\F1529"}.mdi-basket-remove-outline::before{content:"\F152A"}.mdi-basket-unfill::before{content:"\F0078"}.mdi-basketball::before{content:"\F0806"}.mdi-basketball-hoop::before{content:"\F0C3B"}.mdi-basketball-hoop-outline::before{content:"\F0C3C"}.mdi-bat::before{content:"\F0B5F"}.mdi-bathtub::before{content:"\F1818"}.mdi-bathtub-outline::before{content:"\F1819"}.mdi-battery::before{content:"\F0079"}.mdi-battery-10::before{content:"\F007A"}.mdi-battery-10-bluetooth::before{content:"\F093E"}.mdi-battery-20::before{content:"\F007B"}.mdi-battery-20-bluetooth::before{content:"\F093F"}.mdi-battery-30::before{content:"\F007C"}.mdi-battery-30-bluetooth::before{content:"\F0940"}.mdi-battery-40::before{content:"\F007D"}.mdi-battery-40-bluetooth::before{content:"\F0941"}.mdi-battery-50::before{content:"\F007E"}.mdi-battery-50-bluetooth::before{content:"\F0942"}.mdi-battery-60::before{content:"\F007F"}.mdi-battery-60-bluetooth::before{content:"\F0943"}.mdi-battery-70::before{content:"\F0080"}.mdi-battery-70-bluetooth::before{content:"\F0944"}.mdi-battery-80::before{content:"\F0081"}.mdi-battery-80-bluetooth::before{content:"\F0945"}.mdi-battery-90::before{content:"\F0082"}.mdi-battery-90-bluetooth::before{content:"\F0946"}.mdi-battery-alert::before{content:"\F0083"}.mdi-battery-alert-bluetooth::before{content:"\F0947"}.mdi-battery-alert-variant::before{content:"\F10CC"}.mdi-battery-alert-variant-outline::before{content:"\F10CD"}.mdi-battery-arrow-down::before{content:"\F17DE"}.mdi-battery-arrow-down-outline::before{content:"\F17DF"}.mdi-battery-arrow-up::before{content:"\F17E0"}.mdi-battery-arrow-up-outline::before{content:"\F17E1"}.mdi-battery-bluetooth::before{content:"\F0948"}.mdi-battery-bluetooth-variant::before{content:"\F0949"}.mdi-battery-charging::before{content:"\F0084"}.mdi-battery-charging-10::before{content:"\F089C"}.mdi-battery-charging-100::before{content:"\F0085"}.mdi-battery-charging-20::before{content:"\F0086"}.mdi-battery-charging-30::before{content:"\F0087"}.mdi-battery-charging-40::before{content:"\F0088"}.mdi-battery-charging-50::before{content:"\F089D"}.mdi-battery-charging-60::before{content:"\F0089"}.mdi-battery-charging-70::before{content:"\F089E"}.mdi-battery-charging-80::before{content:"\F008A"}.mdi-battery-charging-90::before{content:"\F008B"}.mdi-battery-charging-high::before{content:"\F12A6"}.mdi-battery-charging-low::before{content:"\F12A4"}.mdi-battery-charging-medium::before{content:"\F12A5"}.mdi-battery-charging-outline::before{content:"\F089F"}.mdi-battery-charging-wireless::before{content:"\F0807"}.mdi-battery-charging-wireless-10::before{content:"\F0808"}.mdi-battery-charging-wireless-20::before{content:"\F0809"}.mdi-battery-charging-wireless-30::before{content:"\F080A"}.mdi-battery-charging-wireless-40::before{content:"\F080B"}.mdi-battery-charging-wireless-50::before{content:"\F080C"}.mdi-battery-charging-wireless-60::before{content:"\F080D"}.mdi-battery-charging-wireless-70::before{content:"\F080E"}.mdi-battery-charging-wireless-80::before{content:"\F080F"}.mdi-battery-charging-wireless-90::before{content:"\F0810"}.mdi-battery-charging-wireless-alert::before{content:"\F0811"}.mdi-battery-charging-wireless-outline::before{content:"\F0812"}.mdi-battery-check::before{content:"\F17E2"}.mdi-battery-check-outline::before{content:"\F17E3"}.mdi-battery-clock::before{content:"\F19E5"}.mdi-battery-clock-outline::before{content:"\F19E6"}.mdi-battery-heart::before{content:"\F120F"}.mdi-battery-heart-outline::before{content:"\F1210"}.mdi-battery-heart-variant::before{content:"\F1211"}.mdi-battery-high::before{content:"\F12A3"}.mdi-battery-lock::before{content:"\F179C"}.mdi-battery-lock-open::before{content:"\F179D"}.mdi-battery-low::before{content:"\F12A1"}.mdi-battery-medium::before{content:"\F12A2"}.mdi-battery-minus::before{content:"\F17E4"}.mdi-battery-minus-outline::before{content:"\F17E5"}.mdi-battery-minus-variant::before{content:"\F008C"}.mdi-battery-negative::before{content:"\F008D"}.mdi-battery-off::before{content:"\F125D"}.mdi-battery-off-outline::before{content:"\F125E"}.mdi-battery-outline::before{content:"\F008E"}.mdi-battery-plus::before{content:"\F17E6"}.mdi-battery-plus-outline::before{content:"\F17E7"}.mdi-battery-plus-variant::before{content:"\F008F"}.mdi-battery-positive::before{content:"\F0090"}.mdi-battery-remove::before{content:"\F17E8"}.mdi-battery-remove-outline::before{content:"\F17E9"}.mdi-battery-sync::before{content:"\F1834"}.mdi-battery-sync-outline::before{content:"\F1835"}.mdi-battery-unknown::before{content:"\F0091"}.mdi-battery-unknown-bluetooth::before{content:"\F094A"}.mdi-beach::before{content:"\F0092"}.mdi-beaker::before{content:"\F0CEA"}.mdi-beaker-alert::before{content:"\F1229"}.mdi-beaker-alert-outline::before{content:"\F122A"}.mdi-beaker-check::before{content:"\F122B"}.mdi-beaker-check-outline::before{content:"\F122C"}.mdi-beaker-minus::before{content:"\F122D"}.mdi-beaker-minus-outline::before{content:"\F122E"}.mdi-beaker-outline::before{content:"\F0690"}.mdi-beaker-plus::before{content:"\F122F"}.mdi-beaker-plus-outline::before{content:"\F1230"}.mdi-beaker-question::before{content:"\F1231"}.mdi-beaker-question-outline::before{content:"\F1232"}.mdi-beaker-remove::before{content:"\F1233"}.mdi-beaker-remove-outline::before{content:"\F1234"}.mdi-bed::before{content:"\F02E3"}.mdi-bed-clock::before{content:"\F1B94"}.mdi-bed-double::before{content:"\F0FD4"}.mdi-bed-double-outline::before{content:"\F0FD3"}.mdi-bed-empty::before{content:"\F08A0"}.mdi-bed-king::before{content:"\F0FD2"}.mdi-bed-king-outline::before{content:"\F0FD1"}.mdi-bed-outline::before{content:"\F0099"}.mdi-bed-queen::before{content:"\F0FD0"}.mdi-bed-queen-outline::before{content:"\F0FDB"}.mdi-bed-single::before{content:"\F106D"}.mdi-bed-single-outline::before{content:"\F106E"}.mdi-bee::before{content:"\F0FA1"}.mdi-bee-flower::before{content:"\F0FA2"}.mdi-beehive-off-outline::before{content:"\F13ED"}.mdi-beehive-outline::before{content:"\F10CE"}.mdi-beekeeper::before{content:"\F14E2"}.mdi-beer::before{content:"\F0098"}.mdi-beer-outline::before{content:"\F130C"}.mdi-bell::before{content:"\F009A"}.mdi-bell-alert::before{content:"\F0D59"}.mdi-bell-alert-outline::before{content:"\F0E81"}.mdi-bell-badge::before{content:"\F116B"}.mdi-bell-badge-outline::before{content:"\F0178"}.mdi-bell-cancel::before{content:"\F13E7"}.mdi-bell-cancel-outline::before{content:"\F13E8"}.mdi-bell-check::before{content:"\F11E5"}.mdi-bell-check-outline::before{content:"\F11E6"}.mdi-bell-circle::before{content:"\F0D5A"}.mdi-bell-circle-outline::before{content:"\F0D5B"}.mdi-bell-cog::before{content:"\F1A29"}.mdi-bell-cog-outline::before{content:"\F1A2A"}.mdi-bell-minus::before{content:"\F13E9"}.mdi-bell-minus-outline::before{content:"\F13EA"}.mdi-bell-off::before{content:"\F009B"}.mdi-bell-off-outline::before{content:"\F0A91"}.mdi-bell-outline::before{content:"\F009C"}.mdi-bell-plus::before{content:"\F009D"}.mdi-bell-plus-outline::before{content:"\F0A92"}.mdi-bell-remove::before{content:"\F13EB"}.mdi-bell-remove-outline::before{content:"\F13EC"}.mdi-bell-ring::before{content:"\F009E"}.mdi-bell-ring-outline::before{content:"\F009F"}.mdi-bell-sleep::before{content:"\F00A0"}.mdi-bell-sleep-outline::before{content:"\F0A93"}.mdi-bench::before{content:"\F1C21"}.mdi-bench-back::before{content:"\F1C22"}.mdi-beta::before{content:"\F00A1"}.mdi-betamax::before{content:"\F09CB"}.mdi-biathlon::before{content:"\F0E14"}.mdi-bicycle::before{content:"\F109C"}.mdi-bicycle-basket::before{content:"\F1235"}.mdi-bicycle-cargo::before{content:"\F189C"}.mdi-bicycle-electric::before{content:"\F15B4"}.mdi-bicycle-penny-farthing::before{content:"\F15E9"}.mdi-bike::before{content:"\F00A3"}.mdi-bike-fast::before{content:"\F111F"}.mdi-bike-pedal::before{content:"\F1C23"}.mdi-bike-pedal-clipless::before{content:"\F1C24"}.mdi-bike-pedal-mountain::before{content:"\F1C25"}.mdi-billboard::before{content:"\F1010"}.mdi-billiards::before{content:"\F0B61"}.mdi-billiards-rack::before{content:"\F0B62"}.mdi-binoculars::before{content:"\F00A5"}.mdi-bio::before{content:"\F00A6"}.mdi-biohazard::before{content:"\F00A7"}.mdi-bird::before{content:"\F15C6"}.mdi-bitbucket::before{content:"\F00A8"}.mdi-bitcoin::before{content:"\F0813"}.mdi-black-mesa::before{content:"\F00A9"}.mdi-blender::before{content:"\F0CEB"}.mdi-blender-outline::before{content:"\F181A"}.mdi-blender-software::before{content:"\F00AB"}.mdi-blinds::before{content:"\F00AC"}.mdi-blinds-horizontal::before{content:"\F1A2B"}.mdi-blinds-horizontal-closed::before{content:"\F1A2C"}.mdi-blinds-open::before{content:"\F1011"}.mdi-blinds-vertical::before{content:"\F1A2D"}.mdi-blinds-vertical-closed::before{content:"\F1A2E"}.mdi-block-helper::before{content:"\F00AD"}.mdi-blood-bag::before{content:"\F0CEC"}.mdi-bluetooth::before{content:"\F00AF"}.mdi-bluetooth-audio::before{content:"\F00B0"}.mdi-bluetooth-connect::before{content:"\F00B1"}.mdi-bluetooth-off::before{content:"\F00B2"}.mdi-bluetooth-settings::before{content:"\F00B3"}.mdi-bluetooth-transfer::before{content:"\F00B4"}.mdi-blur::before{content:"\F00B5"}.mdi-blur-linear::before{content:"\F00B6"}.mdi-blur-off::before{content:"\F00B7"}.mdi-blur-radial::before{content:"\F00B8"}.mdi-bolt::before{content:"\F0DB3"}.mdi-bomb::before{content:"\F0691"}.mdi-bomb-off::before{content:"\F06C5"}.mdi-bone::before{content:"\F00B9"}.mdi-bone-off::before{content:"\F19E0"}.mdi-book::before{content:"\F00BA"}.mdi-book-account::before{content:"\F13AD"}.mdi-book-account-outline::before{content:"\F13AE"}.mdi-book-alert::before{content:"\F167C"}.mdi-book-alert-outline::before{content:"\F167D"}.mdi-book-alphabet::before{content:"\F061D"}.mdi-book-arrow-down::before{content:"\F167E"}.mdi-book-arrow-down-outline::before{content:"\F167F"}.mdi-book-arrow-left::before{content:"\F1680"}.mdi-book-arrow-left-outline::before{content:"\F1681"}.mdi-book-arrow-right::before{content:"\F1682"}.mdi-book-arrow-right-outline::before{content:"\F1683"}.mdi-book-arrow-up::before{content:"\F1684"}.mdi-book-arrow-up-outline::before{content:"\F1685"}.mdi-book-cancel::before{content:"\F1686"}.mdi-book-cancel-outline::before{content:"\F1687"}.mdi-book-check::before{content:"\F14F3"}.mdi-book-check-outline::before{content:"\F14F4"}.mdi-book-clock::before{content:"\F1688"}.mdi-book-clock-outline::before{content:"\F1689"}.mdi-book-cog::before{content:"\F168A"}.mdi-book-cog-outline::before{content:"\F168B"}.mdi-book-cross::before{content:"\F00A2"}.mdi-book-edit::before{content:"\F168C"}.mdi-book-edit-outline::before{content:"\F168D"}.mdi-book-education::before{content:"\F16C9"}.mdi-book-education-outline::before{content:"\F16CA"}.mdi-book-heart::before{content:"\F1A1D"}.mdi-book-heart-outline::before{content:"\F1A1E"}.mdi-book-information-variant::before{content:"\F106F"}.mdi-book-lock::before{content:"\F079A"}.mdi-book-lock-open::before{content:"\F079B"}.mdi-book-lock-open-outline::before{content:"\F168E"}.mdi-book-lock-outline::before{content:"\F168F"}.mdi-book-marker::before{content:"\F1690"}.mdi-book-marker-outline::before{content:"\F1691"}.mdi-book-minus::before{content:"\F05D9"}.mdi-book-minus-multiple::before{content:"\F0A94"}.mdi-book-minus-multiple-outline::before{content:"\F090B"}.mdi-book-minus-outline::before{content:"\F1692"}.mdi-book-multiple::before{content:"\F00BB"}.mdi-book-multiple-outline::before{content:"\F0436"}.mdi-book-music::before{content:"\F0067"}.mdi-book-music-outline::before{content:"\F1693"}.mdi-book-off::before{content:"\F1694"}.mdi-book-off-outline::before{content:"\F1695"}.mdi-book-open::before{content:"\F00BD"}.mdi-book-open-blank-variant::before{content:"\F00BE"}.mdi-book-open-blank-variant-outline::before{content:"\F1CCB"}.mdi-book-open-outline::before{content:"\F0B63"}.mdi-book-open-page-variant::before{content:"\F05DA"}.mdi-book-open-page-variant-outline::before{content:"\F15D6"}.mdi-book-open-variant::before{content:"\F14F7"}.mdi-book-open-variant-outline::before{content:"\F1CCC"}.mdi-book-outline::before{content:"\F0B64"}.mdi-book-play::before{content:"\F0E82"}.mdi-book-play-outline::before{content:"\F0E83"}.mdi-book-plus::before{content:"\F05DB"}.mdi-book-plus-multiple::before{content:"\F0A95"}.mdi-book-plus-multiple-outline::before{content:"\F0ADE"}.mdi-book-plus-outline::before{content:"\F1696"}.mdi-book-refresh::before{content:"\F1697"}.mdi-book-refresh-outline::before{content:"\F1698"}.mdi-book-remove::before{content:"\F0A97"}.mdi-book-remove-multiple::before{content:"\F0A96"}.mdi-book-remove-multiple-outline::before{content:"\F04CA"}.mdi-book-remove-outline::before{content:"\F1699"}.mdi-book-search::before{content:"\F0E84"}.mdi-book-search-outline::before{content:"\F0E85"}.mdi-book-settings::before{content:"\F169A"}.mdi-book-settings-outline::before{content:"\F169B"}.mdi-book-sync::before{content:"\F169C"}.mdi-book-sync-outline::before{content:"\F16C8"}.mdi-book-variant::before{content:"\F00BF"}.mdi-bookmark::before{content:"\F00C0"}.mdi-bookmark-box::before{content:"\F1B75"}.mdi-bookmark-box-multiple::before{content:"\F196C"}.mdi-bookmark-box-multiple-outline::before{content:"\F196D"}.mdi-bookmark-box-outline::before{content:"\F1B76"}.mdi-bookmark-check::before{content:"\F00C1"}.mdi-bookmark-check-outline::before{content:"\F137B"}.mdi-bookmark-minus::before{content:"\F09CC"}.mdi-bookmark-minus-outline::before{content:"\F09CD"}.mdi-bookmark-multiple::before{content:"\F0E15"}.mdi-bookmark-multiple-outline::before{content:"\F0E16"}.mdi-bookmark-music::before{content:"\F00C2"}.mdi-bookmark-music-outline::before{content:"\F1379"}.mdi-bookmark-off::before{content:"\F09CE"}.mdi-bookmark-off-outline::before{content:"\F09CF"}.mdi-bookmark-outline::before{content:"\F00C3"}.mdi-bookmark-plus::before{content:"\F00C5"}.mdi-bookmark-plus-outline::before{content:"\F00C4"}.mdi-bookmark-remove::before{content:"\F00C6"}.mdi-bookmark-remove-outline::before{content:"\F137A"}.mdi-bookshelf::before{content:"\F125F"}.mdi-boom-gate::before{content:"\F0E86"}.mdi-boom-gate-alert::before{content:"\F0E87"}.mdi-boom-gate-alert-outline::before{content:"\F0E88"}.mdi-boom-gate-arrow-down::before{content:"\F0E89"}.mdi-boom-gate-arrow-down-outline::before{content:"\F0E8A"}.mdi-boom-gate-arrow-up::before{content:"\F0E8C"}.mdi-boom-gate-arrow-up-outline::before{content:"\F0E8D"}.mdi-boom-gate-outline::before{content:"\F0E8B"}.mdi-boom-gate-up::before{content:"\F17F9"}.mdi-boom-gate-up-outline::before{content:"\F17FA"}.mdi-boombox::before{content:"\F05DC"}.mdi-boomerang::before{content:"\F10CF"}.mdi-bootstrap::before{content:"\F06C6"}.mdi-border-all::before{content:"\F00C7"}.mdi-border-all-variant::before{content:"\F08A1"}.mdi-border-bottom::before{content:"\F00C8"}.mdi-border-bottom-variant::before{content:"\F08A2"}.mdi-border-color::before{content:"\F00C9"}.mdi-border-horizontal::before{content:"\F00CA"}.mdi-border-inside::before{content:"\F00CB"}.mdi-border-left::before{content:"\F00CC"}.mdi-border-left-variant::before{content:"\F08A3"}.mdi-border-none::before{content:"\F00CD"}.mdi-border-none-variant::before{content:"\F08A4"}.mdi-border-outside::before{content:"\F00CE"}.mdi-border-radius::before{content:"\F1AF4"}.mdi-border-right::before{content:"\F00CF"}.mdi-border-right-variant::before{content:"\F08A5"}.mdi-border-style::before{content:"\F00D0"}.mdi-border-top::before{content:"\F00D1"}.mdi-border-top-variant::before{content:"\F08A6"}.mdi-border-vertical::before{content:"\F00D2"}.mdi-bottle-soda::before{content:"\F1070"}.mdi-bottle-soda-classic::before{content:"\F1071"}.mdi-bottle-soda-classic-outline::before{content:"\F1363"}.mdi-bottle-soda-outline::before{content:"\F1072"}.mdi-bottle-tonic::before{content:"\F112E"}.mdi-bottle-tonic-outline::before{content:"\F112F"}.mdi-bottle-tonic-plus::before{content:"\F1130"}.mdi-bottle-tonic-plus-outline::before{content:"\F1131"}.mdi-bottle-tonic-skull::before{content:"\F1132"}.mdi-bottle-tonic-skull-outline::before{content:"\F1133"}.mdi-bottle-wine::before{content:"\F0854"}.mdi-bottle-wine-outline::before{content:"\F1310"}.mdi-bow-arrow::before{content:"\F1841"}.mdi-bow-tie::before{content:"\F0678"}.mdi-bowl::before{content:"\F028E"}.mdi-bowl-mix::before{content:"\F0617"}.mdi-bowl-mix-outline::before{content:"\F02E4"}.mdi-bowl-outline::before{content:"\F02A9"}.mdi-bowling::before{content:"\F00D3"}.mdi-box::before{content:"\F00D4"}.mdi-box-cutter::before{content:"\F00D5"}.mdi-box-cutter-off::before{content:"\F0B4A"}.mdi-box-shadow::before{content:"\F0637"}.mdi-boxing-glove::before{content:"\F0B65"}.mdi-braille::before{content:"\F09D0"}.mdi-brain::before{content:"\F09D1"}.mdi-bread-slice::before{content:"\F0CEE"}.mdi-bread-slice-outline::before{content:"\F0CEF"}.mdi-bridge::before{content:"\F0618"}.mdi-briefcase::before{content:"\F00D6"}.mdi-briefcase-account::before{content:"\F0CF0"}.mdi-briefcase-account-outline::before{content:"\F0CF1"}.mdi-briefcase-arrow-left-right::before{content:"\F1A8D"}.mdi-briefcase-arrow-left-right-outline::before{content:"\F1A8E"}.mdi-briefcase-arrow-up-down::before{content:"\F1A8F"}.mdi-briefcase-arrow-up-down-outline::before{content:"\F1A90"}.mdi-briefcase-check::before{content:"\F00D7"}.mdi-briefcase-check-outline::before{content:"\F131E"}.mdi-briefcase-clock::before{content:"\F10D0"}.mdi-briefcase-clock-outline::before{content:"\F10D1"}.mdi-briefcase-download::before{content:"\F00D8"}.mdi-briefcase-download-outline::before{content:"\F0C3D"}.mdi-briefcase-edit::before{content:"\F0A98"}.mdi-briefcase-edit-outline::before{content:"\F0C3E"}.mdi-briefcase-eye::before{content:"\F17D9"}.mdi-briefcase-eye-outline::before{content:"\F17DA"}.mdi-briefcase-minus::before{content:"\F0A2A"}.mdi-briefcase-minus-outline::before{content:"\F0C3F"}.mdi-briefcase-off::before{content:"\F1658"}.mdi-briefcase-off-outline::before{content:"\F1659"}.mdi-briefcase-outline::before{content:"\F0814"}.mdi-briefcase-plus::before{content:"\F0A2B"}.mdi-briefcase-plus-outline::before{content:"\F0C40"}.mdi-briefcase-remove::before{content:"\F0A2C"}.mdi-briefcase-remove-outline::before{content:"\F0C41"}.mdi-briefcase-search::before{content:"\F0A2D"}.mdi-briefcase-search-outline::before{content:"\F0C42"}.mdi-briefcase-upload::before{content:"\F00D9"}.mdi-briefcase-upload-outline::before{content:"\F0C43"}.mdi-briefcase-variant::before{content:"\F1494"}.mdi-briefcase-variant-off::before{content:"\F165A"}.mdi-briefcase-variant-off-outline::before{content:"\F165B"}.mdi-briefcase-variant-outline::before{content:"\F1495"}.mdi-brightness-1::before{content:"\F00DA"}.mdi-brightness-2::before{content:"\F00DB"}.mdi-brightness-3::before{content:"\F00DC"}.mdi-brightness-4::before{content:"\F00DD"}.mdi-brightness-5::before{content:"\F00DE"}.mdi-brightness-6::before{content:"\F00DF"}.mdi-brightness-7::before{content:"\F00E0"}.mdi-brightness-auto::before{content:"\F00E1"}.mdi-brightness-percent::before{content:"\F0CF2"}.mdi-broadcast::before{content:"\F1720"}.mdi-broadcast-off::before{content:"\F1721"}.mdi-broom::before{content:"\F00E2"}.mdi-brush::before{content:"\F00E3"}.mdi-brush-off::before{content:"\F1771"}.mdi-brush-outline::before{content:"\F1A0D"}.mdi-brush-variant::before{content:"\F1813"}.mdi-bucket::before{content:"\F1415"}.mdi-bucket-outline::before{content:"\F1416"}.mdi-buffet::before{content:"\F0578"}.mdi-bug::before{content:"\F00E4"}.mdi-bug-check::before{content:"\F0A2E"}.mdi-bug-check-outline::before{content:"\F0A2F"}.mdi-bug-outline::before{content:"\F0A30"}.mdi-bug-pause::before{content:"\F1AF5"}.mdi-bug-pause-outline::before{content:"\F1AF6"}.mdi-bug-play::before{content:"\F1AF7"}.mdi-bug-play-outline::before{content:"\F1AF8"}.mdi-bug-stop::before{content:"\F1AF9"}.mdi-bug-stop-outline::before{content:"\F1AFA"}.mdi-bugle::before{content:"\F0DB4"}.mdi-bulkhead-light::before{content:"\F1A2F"}.mdi-bulldozer::before{content:"\F0B22"}.mdi-bullet::before{content:"\F0CF3"}.mdi-bulletin-board::before{content:"\F00E5"}.mdi-bullhorn::before{content:"\F00E6"}.mdi-bullhorn-outline::before{content:"\F0B23"}.mdi-bullhorn-variant::before{content:"\F196E"}.mdi-bullhorn-variant-outline::before{content:"\F196F"}.mdi-bullseye::before{content:"\F05DD"}.mdi-bullseye-arrow::before{content:"\F08C9"}.mdi-bulma::before{content:"\F12E7"}.mdi-bunk-bed::before{content:"\F1302"}.mdi-bunk-bed-outline::before{content:"\F0097"}.mdi-bus::before{content:"\F00E7"}.mdi-bus-alert::before{content:"\F0A99"}.mdi-bus-articulated-end::before{content:"\F079C"}.mdi-bus-articulated-front::before{content:"\F079D"}.mdi-bus-clock::before{content:"\F08CA"}.mdi-bus-double-decker::before{content:"\F079E"}.mdi-bus-electric::before{content:"\F191D"}.mdi-bus-marker::before{content:"\F1212"}.mdi-bus-multiple::before{content:"\F0F3F"}.mdi-bus-school::before{content:"\F079F"}.mdi-bus-side::before{content:"\F07A0"}.mdi-bus-sign::before{content:"\F1CC1"}.mdi-bus-stop::before{content:"\F1012"}.mdi-bus-stop-covered::before{content:"\F1013"}.mdi-bus-stop-uncovered::before{content:"\F1014"}.mdi-bus-wrench::before{content:"\F1CC2"}.mdi-butterfly::before{content:"\F1589"}.mdi-butterfly-outline::before{content:"\F158A"}.mdi-button-cursor::before{content:"\F1B4F"}.mdi-button-pointer::before{content:"\F1B50"}.mdi-cabin-a-frame::before{content:"\F188C"}.mdi-cable-data::before{content:"\F1394"}.mdi-cached::before{content:"\F00E8"}.mdi-cactus::before{content:"\F0DB5"}.mdi-cake::before{content:"\F00E9"}.mdi-cake-layered::before{content:"\F00EA"}.mdi-cake-variant::before{content:"\F00EB"}.mdi-cake-variant-outline::before{content:"\F17F0"}.mdi-calculator::before{content:"\F00EC"}.mdi-calculator-variant::before{content:"\F0A9A"}.mdi-calculator-variant-outline::before{content:"\F15A6"}.mdi-calendar::before{content:"\F00ED"}.mdi-calendar-account::before{content:"\F0ED7"}.mdi-calendar-account-outline::before{content:"\F0ED8"}.mdi-calendar-alert::before{content:"\F0A31"}.mdi-calendar-alert-outline::before{content:"\F1B62"}.mdi-calendar-arrow-left::before{content:"\F1134"}.mdi-calendar-arrow-right::before{content:"\F1135"}.mdi-calendar-badge::before{content:"\F1B9D"}.mdi-calendar-badge-outline::before{content:"\F1B9E"}.mdi-calendar-blank::before{content:"\F00EE"}.mdi-calendar-blank-multiple::before{content:"\F1073"}.mdi-calendar-blank-outline::before{content:"\F0B66"}.mdi-calendar-check::before{content:"\F00EF"}.mdi-calendar-check-outline::before{content:"\F0C44"}.mdi-calendar-clock::before{content:"\F00F0"}.mdi-calendar-clock-outline::before{content:"\F16E1"}.mdi-calendar-collapse-horizontal::before{content:"\F189D"}.mdi-calendar-collapse-horizontal-outline::before{content:"\F1B63"}.mdi-calendar-cursor::before{content:"\F157B"}.mdi-calendar-cursor-outline::before{content:"\F1B64"}.mdi-calendar-edit::before{content:"\F08A7"}.mdi-calendar-edit-outline::before{content:"\F1B65"}.mdi-calendar-end::before{content:"\F166C"}.mdi-calendar-end-outline::before{content:"\F1B66"}.mdi-calendar-expand-horizontal::before{content:"\F189E"}.mdi-calendar-expand-horizontal-outline::before{content:"\F1B67"}.mdi-calendar-export::before{content:"\F0B24"}.mdi-calendar-export-outline::before{content:"\F1B68"}.mdi-calendar-filter::before{content:"\F1A32"}.mdi-calendar-filter-outline::before{content:"\F1A33"}.mdi-calendar-heart::before{content:"\F09D2"}.mdi-calendar-heart-outline::before{content:"\F1B69"}.mdi-calendar-import::before{content:"\F0B25"}.mdi-calendar-import-outline::before{content:"\F1B6A"}.mdi-calendar-lock::before{content:"\F1641"}.mdi-calendar-lock-open::before{content:"\F1B5B"}.mdi-calendar-lock-open-outline::before{content:"\F1B5C"}.mdi-calendar-lock-outline::before{content:"\F1642"}.mdi-calendar-minus::before{content:"\F0D5C"}.mdi-calendar-minus-outline::before{content:"\F1B6B"}.mdi-calendar-month::before{content:"\F0E17"}.mdi-calendar-month-outline::before{content:"\F0E18"}.mdi-calendar-multiple::before{content:"\F00F1"}.mdi-calendar-multiple-check::before{content:"\F00F2"}.mdi-calendar-multiselect::before{content:"\F0A32"}.mdi-calendar-multiselect-outline::before{content:"\F1B55"}.mdi-calendar-outline::before{content:"\F0B67"}.mdi-calendar-plus::before{content:"\F00F3"}.mdi-calendar-plus-outline::before{content:"\F1B6C"}.mdi-calendar-question::before{content:"\F0692"}.mdi-calendar-question-outline::before{content:"\F1B6D"}.mdi-calendar-range::before{content:"\F0679"}.mdi-calendar-range-outline::before{content:"\F0B68"}.mdi-calendar-refresh::before{content:"\F01E1"}.mdi-calendar-refresh-outline::before{content:"\F0203"}.mdi-calendar-remove::before{content:"\F00F4"}.mdi-calendar-remove-outline::before{content:"\F0C45"}.mdi-calendar-search::before{content:"\F094C"}.mdi-calendar-search-outline::before{content:"\F1B6E"}.mdi-calendar-star::before{content:"\F09D3"}.mdi-calendar-star-four-points::before{content:"\F1C1F"}.mdi-calendar-star-outline::before{content:"\F1B53"}.mdi-calendar-start::before{content:"\F166D"}.mdi-calendar-start-outline::before{content:"\F1B6F"}.mdi-calendar-sync::before{content:"\F0E8E"}.mdi-calendar-sync-outline::before{content:"\F0E8F"}.mdi-calendar-text::before{content:"\F00F5"}.mdi-calendar-text-outline::before{content:"\F0C46"}.mdi-calendar-today::before{content:"\F00F6"}.mdi-calendar-today-outline::before{content:"\F1A30"}.mdi-calendar-week::before{content:"\F0A33"}.mdi-calendar-week-begin::before{content:"\F0A34"}.mdi-calendar-week-begin-outline::before{content:"\F1A31"}.mdi-calendar-week-outline::before{content:"\F1A34"}.mdi-calendar-weekend::before{content:"\F0ED9"}.mdi-calendar-weekend-outline::before{content:"\F0EDA"}.mdi-call-made::before{content:"\F00F7"}.mdi-call-merge::before{content:"\F00F8"}.mdi-call-missed::before{content:"\F00F9"}.mdi-call-received::before{content:"\F00FA"}.mdi-call-split::before{content:"\F00FB"}.mdi-camcorder::before{content:"\F00FC"}.mdi-camcorder-off::before{content:"\F00FF"}.mdi-camera::before{content:"\F0100"}.mdi-camera-account::before{content:"\F08CB"}.mdi-camera-burst::before{content:"\F0693"}.mdi-camera-control::before{content:"\F0B69"}.mdi-camera-document::before{content:"\F1871"}.mdi-camera-document-off::before{content:"\F1872"}.mdi-camera-enhance::before{content:"\F0101"}.mdi-camera-enhance-outline::before{content:"\F0B6A"}.mdi-camera-flip::before{content:"\F15D9"}.mdi-camera-flip-outline::before{content:"\F15DA"}.mdi-camera-front::before{content:"\F0102"}.mdi-camera-front-variant::before{content:"\F0103"}.mdi-camera-gopro::before{content:"\F07A1"}.mdi-camera-image::before{content:"\F08CC"}.mdi-camera-iris::before{content:"\F0104"}.mdi-camera-lock::before{content:"\F1A14"}.mdi-camera-lock-open::before{content:"\F1C0D"}.mdi-camera-lock-open-outline::before{content:"\F1C0E"}.mdi-camera-lock-outline::before{content:"\F1A15"}.mdi-camera-marker::before{content:"\F19A7"}.mdi-camera-marker-outline::before{content:"\F19A8"}.mdi-camera-metering-center::before{content:"\F07A2"}.mdi-camera-metering-matrix::before{content:"\F07A3"}.mdi-camera-metering-partial::before{content:"\F07A4"}.mdi-camera-metering-spot::before{content:"\F07A5"}.mdi-camera-off::before{content:"\F05DF"}.mdi-camera-off-outline::before{content:"\F19BF"}.mdi-camera-outline::before{content:"\F0D5D"}.mdi-camera-party-mode::before{content:"\F0105"}.mdi-camera-plus::before{content:"\F0EDB"}.mdi-camera-plus-outline::before{content:"\F0EDC"}.mdi-camera-rear::before{content:"\F0106"}.mdi-camera-rear-variant::before{content:"\F0107"}.mdi-camera-retake::before{content:"\F0E19"}.mdi-camera-retake-outline::before{content:"\F0E1A"}.mdi-camera-switch::before{content:"\F0108"}.mdi-camera-switch-outline::before{content:"\F084A"}.mdi-camera-timer::before{content:"\F0109"}.mdi-camera-wireless::before{content:"\F0DB6"}.mdi-camera-wireless-outline::before{content:"\F0DB7"}.mdi-campfire::before{content:"\F0EDD"}.mdi-cancel::before{content:"\F073A"}.mdi-candelabra::before{content:"\F17D2"}.mdi-candelabra-fire::before{content:"\F17D3"}.mdi-candle::before{content:"\F05E2"}.mdi-candy::before{content:"\F1970"}.mdi-candy-off::before{content:"\F1971"}.mdi-candy-off-outline::before{content:"\F1972"}.mdi-candy-outline::before{content:"\F1973"}.mdi-candycane::before{content:"\F010A"}.mdi-cannabis::before{content:"\F07A6"}.mdi-cannabis-off::before{content:"\F166E"}.mdi-caps-lock::before{content:"\F0A9B"}.mdi-car::before{content:"\F010B"}.mdi-car-2-plus::before{content:"\F1015"}.mdi-car-3-plus::before{content:"\F1016"}.mdi-car-arrow-left::before{content:"\F13B2"}.mdi-car-arrow-right::before{content:"\F13B3"}.mdi-car-back::before{content:"\F0E1B"}.mdi-car-battery::before{content:"\F010C"}.mdi-car-brake-abs::before{content:"\F0C47"}.mdi-car-brake-alert::before{content:"\F0C48"}.mdi-car-brake-fluid-level::before{content:"\F1909"}.mdi-car-brake-hold::before{content:"\F0D5E"}.mdi-car-brake-low-pressure::before{content:"\F190A"}.mdi-car-brake-parking::before{content:"\F0D5F"}.mdi-car-brake-retarder::before{content:"\F1017"}.mdi-car-brake-temperature::before{content:"\F190B"}.mdi-car-brake-worn-linings::before{content:"\F190C"}.mdi-car-child-seat::before{content:"\F0FA3"}.mdi-car-clock::before{content:"\F1974"}.mdi-car-clutch::before{content:"\F1018"}.mdi-car-cog::before{content:"\F13CC"}.mdi-car-connected::before{content:"\F010D"}.mdi-car-convertible::before{content:"\F07A7"}.mdi-car-coolant-level::before{content:"\F1019"}.mdi-car-cruise-control::before{content:"\F0D60"}.mdi-car-defrost-front::before{content:"\F0D61"}.mdi-car-defrost-rear::before{content:"\F0D62"}.mdi-car-door::before{content:"\F0B6B"}.mdi-car-door-lock::before{content:"\F109D"}.mdi-car-door-lock-open::before{content:"\F1C81"}.mdi-car-electric::before{content:"\F0B6C"}.mdi-car-electric-outline::before{content:"\F15B5"}.mdi-car-emergency::before{content:"\F160F"}.mdi-car-esp::before{content:"\F0C49"}.mdi-car-estate::before{content:"\F07A8"}.mdi-car-hatchback::before{content:"\F07A9"}.mdi-car-info::before{content:"\F11BE"}.mdi-car-key::before{content:"\F0B6D"}.mdi-car-lifted-pickup::before{content:"\F152D"}.mdi-car-light-alert::before{content:"\F190D"}.mdi-car-light-dimmed::before{content:"\F0C4A"}.mdi-car-light-fog::before{content:"\F0C4B"}.mdi-car-light-high::before{content:"\F0C4C"}.mdi-car-limousine::before{content:"\F08CD"}.mdi-car-multiple::before{content:"\F0B6E"}.mdi-car-off::before{content:"\F0E1C"}.mdi-car-outline::before{content:"\F14ED"}.mdi-car-parking-lights::before{content:"\F0D63"}.mdi-car-pickup::before{content:"\F07AA"}.mdi-car-search::before{content:"\F1B8D"}.mdi-car-search-outline::before{content:"\F1B8E"}.mdi-car-seat::before{content:"\F0FA4"}.mdi-car-seat-cooler::before{content:"\F0FA5"}.mdi-car-seat-heater::before{content:"\F0FA6"}.mdi-car-select::before{content:"\F1879"}.mdi-car-settings::before{content:"\F13CD"}.mdi-car-shift-pattern::before{content:"\F0F40"}.mdi-car-side::before{content:"\F07AB"}.mdi-car-speed-limiter::before{content:"\F190E"}.mdi-car-sports::before{content:"\F07AC"}.mdi-car-tire-alert::before{content:"\F0C4D"}.mdi-car-traction-control::before{content:"\F0D64"}.mdi-car-turbocharger::before{content:"\F101A"}.mdi-car-wash::before{content:"\F010E"}.mdi-car-windshield::before{content:"\F101B"}.mdi-car-windshield-outline::before{content:"\F101C"}.mdi-car-wireless::before{content:"\F1878"}.mdi-car-wrench::before{content:"\F1814"}.mdi-carabiner::before{content:"\F14C0"}.mdi-caravan::before{content:"\F07AD"}.mdi-card::before{content:"\F0B6F"}.mdi-card-account-details::before{content:"\F05D2"}.mdi-card-account-details-outline::before{content:"\F0DAB"}.mdi-card-account-details-star::before{content:"\F02A3"}.mdi-card-account-details-star-outline::before{content:"\F06DB"}.mdi-card-account-mail::before{content:"\F018E"}.mdi-card-account-mail-outline::before{content:"\F0E98"}.mdi-card-account-phone::before{content:"\F0E99"}.mdi-card-account-phone-outline::before{content:"\F0E9A"}.mdi-card-bulleted::before{content:"\F0B70"}.mdi-card-bulleted-off::before{content:"\F0B71"}.mdi-card-bulleted-off-outline::before{content:"\F0B72"}.mdi-card-bulleted-outline::before{content:"\F0B73"}.mdi-card-bulleted-settings::before{content:"\F0B74"}.mdi-card-bulleted-settings-outline::before{content:"\F0B75"}.mdi-card-minus::before{content:"\F1600"}.mdi-card-minus-outline::before{content:"\F1601"}.mdi-card-multiple::before{content:"\F17F1"}.mdi-card-multiple-outline::before{content:"\F17F2"}.mdi-card-off::before{content:"\F1602"}.mdi-card-off-outline::before{content:"\F1603"}.mdi-card-outline::before{content:"\F0B76"}.mdi-card-plus::before{content:"\F11FF"}.mdi-card-plus-outline::before{content:"\F1200"}.mdi-card-remove::before{content:"\F1604"}.mdi-card-remove-outline::before{content:"\F1605"}.mdi-card-search::before{content:"\F1074"}.mdi-card-search-outline::before{content:"\F1075"}.mdi-card-text::before{content:"\F0B77"}.mdi-card-text-outline::before{content:"\F0B78"}.mdi-cards::before{content:"\F0638"}.mdi-cards-club::before{content:"\F08CE"}.mdi-cards-club-outline::before{content:"\F189F"}.mdi-cards-diamond::before{content:"\F08CF"}.mdi-cards-diamond-outline::before{content:"\F101D"}.mdi-cards-heart::before{content:"\F08D0"}.mdi-cards-heart-outline::before{content:"\F18A0"}.mdi-cards-outline::before{content:"\F0639"}.mdi-cards-playing::before{content:"\F18A1"}.mdi-cards-playing-club::before{content:"\F18A2"}.mdi-cards-playing-club-multiple::before{content:"\F18A3"}.mdi-cards-playing-club-multiple-outline::before{content:"\F18A4"}.mdi-cards-playing-club-outline::before{content:"\F18A5"}.mdi-cards-playing-diamond::before{content:"\F18A6"}.mdi-cards-playing-diamond-multiple::before{content:"\F18A7"}.mdi-cards-playing-diamond-multiple-outline::before{content:"\F18A8"}.mdi-cards-playing-diamond-outline::before{content:"\F18A9"}.mdi-cards-playing-heart::before{content:"\F18AA"}.mdi-cards-playing-heart-multiple::before{content:"\F18AB"}.mdi-cards-playing-heart-multiple-outline::before{content:"\F18AC"}.mdi-cards-playing-heart-outline::before{content:"\F18AD"}.mdi-cards-playing-outline::before{content:"\F063A"}.mdi-cards-playing-spade::before{content:"\F18AE"}.mdi-cards-playing-spade-multiple::before{content:"\F18AF"}.mdi-cards-playing-spade-multiple-outline::before{content:"\F18B0"}.mdi-cards-playing-spade-outline::before{content:"\F18B1"}.mdi-cards-spade::before{content:"\F08D1"}.mdi-cards-spade-outline::before{content:"\F18B2"}.mdi-cards-variant::before{content:"\F06C7"}.mdi-carrot::before{content:"\F010F"}.mdi-cart::before{content:"\F0110"}.mdi-cart-arrow-down::before{content:"\F0D66"}.mdi-cart-arrow-right::before{content:"\F0C4E"}.mdi-cart-arrow-up::before{content:"\F0D67"}.mdi-cart-check::before{content:"\F15EA"}.mdi-cart-heart::before{content:"\F18E0"}.mdi-cart-minus::before{content:"\F0D68"}.mdi-cart-off::before{content:"\F066B"}.mdi-cart-outline::before{content:"\F0111"}.mdi-cart-percent::before{content:"\F1BAE"}.mdi-cart-plus::before{content:"\F0112"}.mdi-cart-remove::before{content:"\F0D69"}.mdi-cart-variant::before{content:"\F15EB"}.mdi-case-sensitive-alt::before{content:"\F0113"}.mdi-cash::before{content:"\F0114"}.mdi-cash-100::before{content:"\F0115"}.mdi-cash-check::before{content:"\F14EE"}.mdi-cash-clock::before{content:"\F1A91"}.mdi-cash-edit::before{content:"\F1CAB"}.mdi-cash-fast::before{content:"\F185C"}.mdi-cash-lock::before{content:"\F14EA"}.mdi-cash-lock-open::before{content:"\F14EB"}.mdi-cash-marker::before{content:"\F0DB8"}.mdi-cash-minus::before{content:"\F1260"}.mdi-cash-multiple::before{content:"\F0116"}.mdi-cash-off::before{content:"\F1C79"}.mdi-cash-plus::before{content:"\F1261"}.mdi-cash-refund::before{content:"\F0A9C"}.mdi-cash-register::before{content:"\F0CF4"}.mdi-cash-remove::before{content:"\F1262"}.mdi-cash-sync::before{content:"\F1A92"}.mdi-cassette::before{content:"\F09D4"}.mdi-cast::before{content:"\F0118"}.mdi-cast-audio::before{content:"\F101E"}.mdi-cast-audio-variant::before{content:"\F1749"}.mdi-cast-connected::before{content:"\F0119"}.mdi-cast-education::before{content:"\F0E1D"}.mdi-cast-off::before{content:"\F078A"}.mdi-cast-variant::before{content:"\F001F"}.mdi-castle::before{content:"\F011A"}.mdi-cat::before{content:"\F011B"}.mdi-cctv::before{content:"\F07AE"}.mdi-cctv-off::before{content:"\F185F"}.mdi-ceiling-fan::before{content:"\F1797"}.mdi-ceiling-fan-light::before{content:"\F1798"}.mdi-ceiling-light::before{content:"\F0769"}.mdi-ceiling-light-multiple::before{content:"\F18DD"}.mdi-ceiling-light-multiple-outline::before{content:"\F18DE"}.mdi-ceiling-light-outline::before{content:"\F17C7"}.mdi-cellphone::before{content:"\F011C"}.mdi-cellphone-arrow-down::before{content:"\F09D5"}.mdi-cellphone-arrow-down-variant::before{content:"\F19C5"}.mdi-cellphone-basic::before{content:"\F011E"}.mdi-cellphone-charging::before{content:"\F1397"}.mdi-cellphone-check::before{content:"\F17FD"}.mdi-cellphone-cog::before{content:"\F0951"}.mdi-cellphone-dock::before{content:"\F011F"}.mdi-cellphone-information::before{content:"\F0F41"}.mdi-cellphone-key::before{content:"\F094E"}.mdi-cellphone-link::before{content:"\F0121"}.mdi-cellphone-link-off::before{content:"\F0122"}.mdi-cellphone-lock::before{content:"\F094F"}.mdi-cellphone-marker::before{content:"\F183A"}.mdi-cellphone-message::before{content:"\F08D3"}.mdi-cellphone-message-off::before{content:"\F10D2"}.mdi-cellphone-nfc::before{content:"\F0E90"}.mdi-cellphone-nfc-off::before{content:"\F12D8"}.mdi-cellphone-off::before{content:"\F0950"}.mdi-cellphone-play::before{content:"\F101F"}.mdi-cellphone-remove::before{content:"\F094D"}.mdi-cellphone-screenshot::before{content:"\F0A35"}.mdi-cellphone-settings::before{content:"\F0123"}.mdi-cellphone-sound::before{content:"\F0952"}.mdi-cellphone-text::before{content:"\F08D2"}.mdi-cellphone-wireless::before{content:"\F0815"}.mdi-centos::before{content:"\F111A"}.mdi-certificate::before{content:"\F0124"}.mdi-certificate-outline::before{content:"\F1188"}.mdi-chair-rolling::before{content:"\F0F48"}.mdi-chair-school::before{content:"\F0125"}.mdi-chandelier::before{content:"\F1793"}.mdi-charity::before{content:"\F0C4F"}.mdi-charity-search::before{content:"\F1C82"}.mdi-chart-arc::before{content:"\F0126"}.mdi-chart-areaspline::before{content:"\F0127"}.mdi-chart-areaspline-variant::before{content:"\F0E91"}.mdi-chart-bar::before{content:"\F0128"}.mdi-chart-bar-stacked::before{content:"\F076A"}.mdi-chart-bell-curve::before{content:"\F0C50"}.mdi-chart-bell-curve-cumulative::before{content:"\F0FA7"}.mdi-chart-box::before{content:"\F154D"}.mdi-chart-box-multiple::before{content:"\F1CCD"}.mdi-chart-box-multiple-outline::before{content:"\F1CCE"}.mdi-chart-box-outline::before{content:"\F154E"}.mdi-chart-box-plus-outline::before{content:"\F154F"}.mdi-chart-bubble::before{content:"\F05E3"}.mdi-chart-donut::before{content:"\F07AF"}.mdi-chart-donut-variant::before{content:"\F07B0"}.mdi-chart-gantt::before{content:"\F066C"}.mdi-chart-histogram::before{content:"\F0129"}.mdi-chart-line::before{content:"\F012A"}.mdi-chart-line-stacked::before{content:"\F076B"}.mdi-chart-line-variant::before{content:"\F07B1"}.mdi-chart-multiline::before{content:"\F08D4"}.mdi-chart-multiple::before{content:"\F1213"}.mdi-chart-pie::before{content:"\F012B"}.mdi-chart-pie-outline::before{content:"\F1BDF"}.mdi-chart-ppf::before{content:"\F1380"}.mdi-chart-sankey::before{content:"\F11DF"}.mdi-chart-sankey-variant::before{content:"\F11E0"}.mdi-chart-scatter-plot::before{content:"\F0E92"}.mdi-chart-scatter-plot-hexbin::before{content:"\F066D"}.mdi-chart-timeline::before{content:"\F066E"}.mdi-chart-timeline-variant::before{content:"\F0E93"}.mdi-chart-timeline-variant-shimmer::before{content:"\F15B6"}.mdi-chart-tree::before{content:"\F0E94"}.mdi-chart-waterfall::before{content:"\F1918"}.mdi-chat::before{content:"\F0B79"}.mdi-chat-alert::before{content:"\F0B7A"}.mdi-chat-alert-outline::before{content:"\F12C9"}.mdi-chat-minus::before{content:"\F1410"}.mdi-chat-minus-outline::before{content:"\F1413"}.mdi-chat-outline::before{content:"\F0EDE"}.mdi-chat-plus::before{content:"\F140F"}.mdi-chat-plus-outline::before{content:"\F1412"}.mdi-chat-processing::before{content:"\F0B7B"}.mdi-chat-processing-outline::before{content:"\F12CA"}.mdi-chat-question::before{content:"\F1738"}.mdi-chat-question-outline::before{content:"\F1739"}.mdi-chat-remove::before{content:"\F1411"}.mdi-chat-remove-outline::before{content:"\F1414"}.mdi-chat-sleep::before{content:"\F12D1"}.mdi-chat-sleep-outline::before{content:"\F12D2"}.mdi-check::before{content:"\F012C"}.mdi-check-all::before{content:"\F012D"}.mdi-check-bold::before{content:"\F0E1E"}.mdi-check-circle::before{content:"\F05E0"}.mdi-check-circle-outline::before{content:"\F05E1"}.mdi-check-decagram::before{content:"\F0791"}.mdi-check-decagram-outline::before{content:"\F1740"}.mdi-check-network::before{content:"\F0C53"}.mdi-check-network-outline::before{content:"\F0C54"}.mdi-check-outline::before{content:"\F0855"}.mdi-check-underline::before{content:"\F0E1F"}.mdi-check-underline-circle::before{content:"\F0E20"}.mdi-check-underline-circle-outline::before{content:"\F0E21"}.mdi-checkbook::before{content:"\F0A9D"}.mdi-checkbook-arrow-left::before{content:"\F1C1D"}.mdi-checkbook-arrow-right::before{content:"\F1C1E"}.mdi-checkbox-blank::before{content:"\F012E"}.mdi-checkbox-blank-badge::before{content:"\F1176"}.mdi-checkbox-blank-badge-outline::before{content:"\F0117"}.mdi-checkbox-blank-circle::before{content:"\F012F"}.mdi-checkbox-blank-circle-outline::before{content:"\F0130"}.mdi-checkbox-blank-off::before{content:"\F12EC"}.mdi-checkbox-blank-off-outline::before{content:"\F12ED"}.mdi-checkbox-blank-outline::before{content:"\F0131"}.mdi-checkbox-intermediate::before{content:"\F0856"}.mdi-checkbox-intermediate-variant::before{content:"\F1B54"}.mdi-checkbox-marked::before{content:"\F0132"}.mdi-checkbox-marked-circle::before{content:"\F0133"}.mdi-checkbox-marked-circle-auto-outline::before{content:"\F1C26"}.mdi-checkbox-marked-circle-minus-outline::before{content:"\F1C27"}.mdi-checkbox-marked-circle-outline::before{content:"\F0134"}.mdi-checkbox-marked-circle-plus-outline::before{content:"\F1927"}.mdi-checkbox-marked-outline::before{content:"\F0135"}.mdi-checkbox-multiple-blank::before{content:"\F0136"}.mdi-checkbox-multiple-blank-circle::before{content:"\F063B"}.mdi-checkbox-multiple-blank-circle-outline::before{content:"\F063C"}.mdi-checkbox-multiple-blank-outline::before{content:"\F0137"}.mdi-checkbox-multiple-marked::before{content:"\F0138"}.mdi-checkbox-multiple-marked-circle::before{content:"\F063D"}.mdi-checkbox-multiple-marked-circle-outline::before{content:"\F063E"}.mdi-checkbox-multiple-marked-outline::before{content:"\F0139"}.mdi-checkbox-multiple-outline::before{content:"\F0C51"}.mdi-checkbox-outline::before{content:"\F0C52"}.mdi-checkerboard::before{content:"\F013A"}.mdi-checkerboard-minus::before{content:"\F1202"}.mdi-checkerboard-plus::before{content:"\F1201"}.mdi-checkerboard-remove::before{content:"\F1203"}.mdi-cheese::before{content:"\F12B9"}.mdi-cheese-off::before{content:"\F13EE"}.mdi-chef-hat::before{content:"\F0B7C"}.mdi-chemical-weapon::before{content:"\F013B"}.mdi-chess-bishop::before{content:"\F085C"}.mdi-chess-king::before{content:"\F0857"}.mdi-chess-knight::before{content:"\F0858"}.mdi-chess-pawn::before{content:"\F0859"}.mdi-chess-queen::before{content:"\F085A"}.mdi-chess-rook::before{content:"\F085B"}.mdi-chevron-double-down::before{content:"\F013C"}.mdi-chevron-double-left::before{content:"\F013D"}.mdi-chevron-double-right::before{content:"\F013E"}.mdi-chevron-double-up::before{content:"\F013F"}.mdi-chevron-down::before{content:"\F0140"}.mdi-chevron-down-box::before{content:"\F09D6"}.mdi-chevron-down-box-outline::before{content:"\F09D7"}.mdi-chevron-down-circle::before{content:"\F0B26"}.mdi-chevron-down-circle-outline::before{content:"\F0B27"}.mdi-chevron-left::before{content:"\F0141"}.mdi-chevron-left-box::before{content:"\F09D8"}.mdi-chevron-left-box-outline::before{content:"\F09D9"}.mdi-chevron-left-circle::before{content:"\F0B28"}.mdi-chevron-left-circle-outline::before{content:"\F0B29"}.mdi-chevron-right::before{content:"\F0142"}.mdi-chevron-right-box::before{content:"\F09DA"}.mdi-chevron-right-box-outline::before{content:"\F09DB"}.mdi-chevron-right-circle::before{content:"\F0B2A"}.mdi-chevron-right-circle-outline::before{content:"\F0B2B"}.mdi-chevron-triple-down::before{content:"\F0DB9"}.mdi-chevron-triple-left::before{content:"\F0DBA"}.mdi-chevron-triple-right::before{content:"\F0DBB"}.mdi-chevron-triple-up::before{content:"\F0DBC"}.mdi-chevron-up::before{content:"\F0143"}.mdi-chevron-up-box::before{content:"\F09DC"}.mdi-chevron-up-box-outline::before{content:"\F09DD"}.mdi-chevron-up-circle::before{content:"\F0B2C"}.mdi-chevron-up-circle-outline::before{content:"\F0B2D"}.mdi-chili-alert::before{content:"\F17EA"}.mdi-chili-alert-outline::before{content:"\F17EB"}.mdi-chili-hot::before{content:"\F07B2"}.mdi-chili-hot-outline::before{content:"\F17EC"}.mdi-chili-medium::before{content:"\F07B3"}.mdi-chili-medium-outline::before{content:"\F17ED"}.mdi-chili-mild::before{content:"\F07B4"}.mdi-chili-mild-outline::before{content:"\F17EE"}.mdi-chili-off::before{content:"\F1467"}.mdi-chili-off-outline::before{content:"\F17EF"}.mdi-chip::before{content:"\F061A"}.mdi-church::before{content:"\F0144"}.mdi-church-outline::before{content:"\F1B02"}.mdi-cigar::before{content:"\F1189"}.mdi-cigar-off::before{content:"\F141B"}.mdi-circle::before{content:"\F0765"}.mdi-circle-box::before{content:"\F15DC"}.mdi-circle-box-outline::before{content:"\F15DD"}.mdi-circle-double::before{content:"\F0E95"}.mdi-circle-edit-outline::before{content:"\F08D5"}.mdi-circle-expand::before{content:"\F0E96"}.mdi-circle-half::before{content:"\F1395"}.mdi-circle-half-full::before{content:"\F1396"}.mdi-circle-medium::before{content:"\F09DE"}.mdi-circle-multiple::before{content:"\F0B38"}.mdi-circle-multiple-outline::before{content:"\F0695"}.mdi-circle-off-outline::before{content:"\F10D3"}.mdi-circle-opacity::before{content:"\F1853"}.mdi-circle-outline::before{content:"\F0766"}.mdi-circle-slice-1::before{content:"\F0A9E"}.mdi-circle-slice-2::before{content:"\F0A9F"}.mdi-circle-slice-3::before{content:"\F0AA0"}.mdi-circle-slice-4::before{content:"\F0AA1"}.mdi-circle-slice-5::before{content:"\F0AA2"}.mdi-circle-slice-6::before{content:"\F0AA3"}.mdi-circle-slice-7::before{content:"\F0AA4"}.mdi-circle-slice-8::before{content:"\F0AA5"}.mdi-circle-small::before{content:"\F09DF"}.mdi-circular-saw::before{content:"\F0E22"}.mdi-city::before{content:"\F0146"}.mdi-city-switch::before{content:"\F1C28"}.mdi-city-variant::before{content:"\F0A36"}.mdi-city-variant-outline::before{content:"\F0A37"}.mdi-clipboard::before{content:"\F0147"}.mdi-clipboard-account::before{content:"\F0148"}.mdi-clipboard-account-outline::before{content:"\F0C55"}.mdi-clipboard-alert::before{content:"\F0149"}.mdi-clipboard-alert-outline::before{content:"\F0CF7"}.mdi-clipboard-arrow-down::before{content:"\F014A"}.mdi-clipboard-arrow-down-outline::before{content:"\F0C56"}.mdi-clipboard-arrow-left::before{content:"\F014B"}.mdi-clipboard-arrow-left-outline::before{content:"\F0CF8"}.mdi-clipboard-arrow-right::before{content:"\F0CF9"}.mdi-clipboard-arrow-right-outline::before{content:"\F0CFA"}.mdi-clipboard-arrow-up::before{content:"\F0C57"}.mdi-clipboard-arrow-up-outline::before{content:"\F0C58"}.mdi-clipboard-check::before{content:"\F014E"}.mdi-clipboard-check-multiple::before{content:"\F1263"}.mdi-clipboard-check-multiple-outline::before{content:"\F1264"}.mdi-clipboard-check-outline::before{content:"\F08A8"}.mdi-clipboard-clock::before{content:"\F16E2"}.mdi-clipboard-clock-outline::before{content:"\F16E3"}.mdi-clipboard-edit::before{content:"\F14E5"}.mdi-clipboard-edit-outline::before{content:"\F14E6"}.mdi-clipboard-file::before{content:"\F1265"}.mdi-clipboard-file-outline::before{content:"\F1266"}.mdi-clipboard-flow::before{content:"\F06C8"}.mdi-clipboard-flow-outline::before{content:"\F1117"}.mdi-clipboard-list::before{content:"\F10D4"}.mdi-clipboard-list-outline::before{content:"\F10D5"}.mdi-clipboard-minus::before{content:"\F1618"}.mdi-clipboard-minus-outline::before{content:"\F1619"}.mdi-clipboard-multiple::before{content:"\F1267"}.mdi-clipboard-multiple-outline::before{content:"\F1268"}.mdi-clipboard-off::before{content:"\F161A"}.mdi-clipboard-off-outline::before{content:"\F161B"}.mdi-clipboard-outline::before{content:"\F014C"}.mdi-clipboard-play::before{content:"\F0C59"}.mdi-clipboard-play-multiple::before{content:"\F1269"}.mdi-clipboard-play-multiple-outline::before{content:"\F126A"}.mdi-clipboard-play-outline::before{content:"\F0C5A"}.mdi-clipboard-plus::before{content:"\F0751"}.mdi-clipboard-plus-outline::before{content:"\F131F"}.mdi-clipboard-pulse::before{content:"\F085D"}.mdi-clipboard-pulse-outline::before{content:"\F085E"}.mdi-clipboard-remove::before{content:"\F161C"}.mdi-clipboard-remove-outline::before{content:"\F161D"}.mdi-clipboard-search::before{content:"\F161E"}.mdi-clipboard-search-outline::before{content:"\F161F"}.mdi-clipboard-text::before{content:"\F014D"}.mdi-clipboard-text-clock::before{content:"\F18F9"}.mdi-clipboard-text-clock-outline::before{content:"\F18FA"}.mdi-clipboard-text-multiple::before{content:"\F126B"}.mdi-clipboard-text-multiple-outline::before{content:"\F126C"}.mdi-clipboard-text-off::before{content:"\F1620"}.mdi-clipboard-text-off-outline::before{content:"\F1621"}.mdi-clipboard-text-outline::before{content:"\F0A38"}.mdi-clipboard-text-play::before{content:"\F0C5B"}.mdi-clipboard-text-play-outline::before{content:"\F0C5C"}.mdi-clipboard-text-search::before{content:"\F1622"}.mdi-clipboard-text-search-outline::before{content:"\F1623"}.mdi-clippy::before{content:"\F014F"}.mdi-clock::before{content:"\F0954"}.mdi-clock-alert::before{content:"\F0955"}.mdi-clock-alert-outline::before{content:"\F05CE"}.mdi-clock-check::before{content:"\F0FA8"}.mdi-clock-check-outline::before{content:"\F0FA9"}.mdi-clock-digital::before{content:"\F0E97"}.mdi-clock-edit::before{content:"\F19BA"}.mdi-clock-edit-outline::before{content:"\F19BB"}.mdi-clock-end::before{content:"\F0151"}.mdi-clock-fast::before{content:"\F0152"}.mdi-clock-in::before{content:"\F0153"}.mdi-clock-minus::before{content:"\F1863"}.mdi-clock-minus-outline::before{content:"\F1864"}.mdi-clock-out::before{content:"\F0154"}.mdi-clock-outline::before{content:"\F0150"}.mdi-clock-plus::before{content:"\F1861"}.mdi-clock-plus-outline::before{content:"\F1862"}.mdi-clock-remove::before{content:"\F1865"}.mdi-clock-remove-outline::before{content:"\F1866"}.mdi-clock-star-four-points::before{content:"\F1C29"}.mdi-clock-star-four-points-outline::before{content:"\F1C2A"}.mdi-clock-start::before{content:"\F0155"}.mdi-clock-time-eight::before{content:"\F1446"}.mdi-clock-time-eight-outline::before{content:"\F1452"}.mdi-clock-time-eleven::before{content:"\F1449"}.mdi-clock-time-eleven-outline::before{content:"\F1455"}.mdi-clock-time-five::before{content:"\F1443"}.mdi-clock-time-five-outline::before{content:"\F144F"}.mdi-clock-time-four::before{content:"\F1442"}.mdi-clock-time-four-outline::before{content:"\F144E"}.mdi-clock-time-nine::before{content:"\F1447"}.mdi-clock-time-nine-outline::before{content:"\F1453"}.mdi-clock-time-one::before{content:"\F143F"}.mdi-clock-time-one-outline::before{content:"\F144B"}.mdi-clock-time-seven::before{content:"\F1445"}.mdi-clock-time-seven-outline::before{content:"\F1451"}.mdi-clock-time-six::before{content:"\F1444"}.mdi-clock-time-six-outline::before{content:"\F1450"}.mdi-clock-time-ten::before{content:"\F1448"}.mdi-clock-time-ten-outline::before{content:"\F1454"}.mdi-clock-time-three::before{content:"\F1441"}.mdi-clock-time-three-outline::before{content:"\F144D"}.mdi-clock-time-twelve::before{content:"\F144A"}.mdi-clock-time-twelve-outline::before{content:"\F1456"}.mdi-clock-time-two::before{content:"\F1440"}.mdi-clock-time-two-outline::before{content:"\F144C"}.mdi-close::before{content:"\F0156"}.mdi-close-box::before{content:"\F0157"}.mdi-close-box-multiple::before{content:"\F0C5D"}.mdi-close-box-multiple-outline::before{content:"\F0C5E"}.mdi-close-box-outline::before{content:"\F0158"}.mdi-close-circle::before{content:"\F0159"}.mdi-close-circle-multiple::before{content:"\F062A"}.mdi-close-circle-multiple-outline::before{content:"\F0883"}.mdi-close-circle-outline::before{content:"\F015A"}.mdi-close-network::before{content:"\F015B"}.mdi-close-network-outline::before{content:"\F0C5F"}.mdi-close-octagon::before{content:"\F015C"}.mdi-close-octagon-outline::before{content:"\F015D"}.mdi-close-outline::before{content:"\F06C9"}.mdi-close-thick::before{content:"\F1398"}.mdi-closed-caption::before{content:"\F015E"}.mdi-closed-caption-outline::before{content:"\F0DBD"}.mdi-cloud::before{content:"\F015F"}.mdi-cloud-alert::before{content:"\F09E0"}.mdi-cloud-alert-outline::before{content:"\F1BE0"}.mdi-cloud-arrow-down::before{content:"\F1BE1"}.mdi-cloud-arrow-down-outline::before{content:"\F1BE2"}.mdi-cloud-arrow-left::before{content:"\F1BE3"}.mdi-cloud-arrow-left-outline::before{content:"\F1BE4"}.mdi-cloud-arrow-right::before{content:"\F1BE5"}.mdi-cloud-arrow-right-outline::before{content:"\F1BE6"}.mdi-cloud-arrow-up::before{content:"\F1BE7"}.mdi-cloud-arrow-up-outline::before{content:"\F1BE8"}.mdi-cloud-braces::before{content:"\F07B5"}.mdi-cloud-cancel::before{content:"\F1BE9"}.mdi-cloud-cancel-outline::before{content:"\F1BEA"}.mdi-cloud-check::before{content:"\F1BEB"}.mdi-cloud-check-outline::before{content:"\F1BEC"}.mdi-cloud-check-variant::before{content:"\F0160"}.mdi-cloud-check-variant-outline::before{content:"\F12CC"}.mdi-cloud-circle::before{content:"\F0161"}.mdi-cloud-circle-outline::before{content:"\F1BED"}.mdi-cloud-clock::before{content:"\F1BEE"}.mdi-cloud-clock-outline::before{content:"\F1BEF"}.mdi-cloud-cog::before{content:"\F1BF0"}.mdi-cloud-cog-outline::before{content:"\F1BF1"}.mdi-cloud-download::before{content:"\F0162"}.mdi-cloud-download-outline::before{content:"\F0B7D"}.mdi-cloud-key::before{content:"\F1CA1"}.mdi-cloud-key-outline::before{content:"\F1CA2"}.mdi-cloud-lock::before{content:"\F11F1"}.mdi-cloud-lock-open::before{content:"\F1BF2"}.mdi-cloud-lock-open-outline::before{content:"\F1BF3"}.mdi-cloud-lock-outline::before{content:"\F11F2"}.mdi-cloud-minus::before{content:"\F1BF4"}.mdi-cloud-minus-outline::before{content:"\F1BF5"}.mdi-cloud-off::before{content:"\F1BF6"}.mdi-cloud-off-outline::before{content:"\F0164"}.mdi-cloud-outline::before{content:"\F0163"}.mdi-cloud-percent::before{content:"\F1A35"}.mdi-cloud-percent-outline::before{content:"\F1A36"}.mdi-cloud-plus::before{content:"\F1BF7"}.mdi-cloud-plus-outline::before{content:"\F1BF8"}.mdi-cloud-print::before{content:"\F0165"}.mdi-cloud-print-outline::before{content:"\F0166"}.mdi-cloud-question::before{content:"\F0A39"}.mdi-cloud-question-outline::before{content:"\F1BF9"}.mdi-cloud-refresh::before{content:"\F1BFA"}.mdi-cloud-refresh-outline::before{content:"\F1BFB"}.mdi-cloud-refresh-variant::before{content:"\F052A"}.mdi-cloud-refresh-variant-outline::before{content:"\F1BFC"}.mdi-cloud-remove::before{content:"\F1BFD"}.mdi-cloud-remove-outline::before{content:"\F1BFE"}.mdi-cloud-search::before{content:"\F0956"}.mdi-cloud-search-outline::before{content:"\F0957"}.mdi-cloud-sync::before{content:"\F063F"}.mdi-cloud-sync-outline::before{content:"\F12D6"}.mdi-cloud-tags::before{content:"\F07B6"}.mdi-cloud-upload::before{content:"\F0167"}.mdi-cloud-upload-outline::before{content:"\F0B7E"}.mdi-clouds::before{content:"\F1B95"}.mdi-clover::before{content:"\F0816"}.mdi-clover-outline::before{content:"\F1C62"}.mdi-coach-lamp::before{content:"\F1020"}.mdi-coach-lamp-variant::before{content:"\F1A37"}.mdi-coat-rack::before{content:"\F109E"}.mdi-code-array::before{content:"\F0168"}.mdi-code-block-braces::before{content:"\F1C83"}.mdi-code-block-brackets::before{content:"\F1C84"}.mdi-code-block-parentheses::before{content:"\F1C85"}.mdi-code-block-tags::before{content:"\F1C86"}.mdi-code-braces::before{content:"\F0169"}.mdi-code-braces-box::before{content:"\F10D6"}.mdi-code-brackets::before{content:"\F016A"}.mdi-code-equal::before{content:"\F016B"}.mdi-code-greater-than::before{content:"\F016C"}.mdi-code-greater-than-or-equal::before{content:"\F016D"}.mdi-code-json::before{content:"\F0626"}.mdi-code-less-than::before{content:"\F016E"}.mdi-code-less-than-or-equal::before{content:"\F016F"}.mdi-code-not-equal::before{content:"\F0170"}.mdi-code-not-equal-variant::before{content:"\F0171"}.mdi-code-parentheses::before{content:"\F0172"}.mdi-code-parentheses-box::before{content:"\F10D7"}.mdi-code-string::before{content:"\F0173"}.mdi-code-tags::before{content:"\F0174"}.mdi-code-tags-check::before{content:"\F0694"}.mdi-codepen::before{content:"\F0175"}.mdi-coffee::before{content:"\F0176"}.mdi-coffee-maker::before{content:"\F109F"}.mdi-coffee-maker-check::before{content:"\F1931"}.mdi-coffee-maker-check-outline::before{content:"\F1932"}.mdi-coffee-maker-outline::before{content:"\F181B"}.mdi-coffee-off::before{content:"\F0FAA"}.mdi-coffee-off-outline::before{content:"\F0FAB"}.mdi-coffee-outline::before{content:"\F06CA"}.mdi-coffee-to-go::before{content:"\F0177"}.mdi-coffee-to-go-outline::before{content:"\F130E"}.mdi-coffin::before{content:"\F0B7F"}.mdi-cog::before{content:"\F0493"}.mdi-cog-box::before{content:"\F0494"}.mdi-cog-clockwise::before{content:"\F11DD"}.mdi-cog-counterclockwise::before{content:"\F11DE"}.mdi-cog-off::before{content:"\F13CE"}.mdi-cog-off-outline::before{content:"\F13CF"}.mdi-cog-outline::before{content:"\F08BB"}.mdi-cog-pause::before{content:"\F1933"}.mdi-cog-pause-outline::before{content:"\F1934"}.mdi-cog-play::before{content:"\F1935"}.mdi-cog-play-outline::before{content:"\F1936"}.mdi-cog-refresh::before{content:"\F145E"}.mdi-cog-refresh-outline::before{content:"\F145F"}.mdi-cog-stop::before{content:"\F1937"}.mdi-cog-stop-outline::before{content:"\F1938"}.mdi-cog-sync::before{content:"\F1460"}.mdi-cog-sync-outline::before{content:"\F1461"}.mdi-cog-transfer::before{content:"\F105B"}.mdi-cog-transfer-outline::before{content:"\F105C"}.mdi-cogs::before{content:"\F08D6"}.mdi-collage::before{content:"\F0640"}.mdi-collapse-all::before{content:"\F0AA6"}.mdi-collapse-all-outline::before{content:"\F0AA7"}.mdi-color-helper::before{content:"\F0179"}.mdi-comma::before{content:"\F0E23"}.mdi-comma-box::before{content:"\F0E2B"}.mdi-comma-box-outline::before{content:"\F0E24"}.mdi-comma-circle::before{content:"\F0E25"}.mdi-comma-circle-outline::before{content:"\F0E26"}.mdi-comment::before{content:"\F017A"}.mdi-comment-account::before{content:"\F017B"}.mdi-comment-account-outline::before{content:"\F017C"}.mdi-comment-alert::before{content:"\F017D"}.mdi-comment-alert-outline::before{content:"\F017E"}.mdi-comment-arrow-left::before{content:"\F09E1"}.mdi-comment-arrow-left-outline::before{content:"\F09E2"}.mdi-comment-arrow-right::before{content:"\F09E3"}.mdi-comment-arrow-right-outline::before{content:"\F09E4"}.mdi-comment-bookmark::before{content:"\F15AE"}.mdi-comment-bookmark-outline::before{content:"\F15AF"}.mdi-comment-check::before{content:"\F017F"}.mdi-comment-check-outline::before{content:"\F0180"}.mdi-comment-edit::before{content:"\F11BF"}.mdi-comment-edit-outline::before{content:"\F12C4"}.mdi-comment-eye::before{content:"\F0A3A"}.mdi-comment-eye-outline::before{content:"\F0A3B"}.mdi-comment-flash::before{content:"\F15B0"}.mdi-comment-flash-outline::before{content:"\F15B1"}.mdi-comment-minus::before{content:"\F15DF"}.mdi-comment-minus-outline::before{content:"\F15E0"}.mdi-comment-multiple::before{content:"\F085F"}.mdi-comment-multiple-outline::before{content:"\F0181"}.mdi-comment-off::before{content:"\F15E1"}.mdi-comment-off-outline::before{content:"\F15E2"}.mdi-comment-outline::before{content:"\F0182"}.mdi-comment-plus::before{content:"\F09E5"}.mdi-comment-plus-outline::before{content:"\F0183"}.mdi-comment-processing::before{content:"\F0184"}.mdi-comment-processing-outline::before{content:"\F0185"}.mdi-comment-question::before{content:"\F0817"}.mdi-comment-question-outline::before{content:"\F0186"}.mdi-comment-quote::before{content:"\F1021"}.mdi-comment-quote-outline::before{content:"\F1022"}.mdi-comment-remove::before{content:"\F05DE"}.mdi-comment-remove-outline::before{content:"\F0187"}.mdi-comment-search::before{content:"\F0A3C"}.mdi-comment-search-outline::before{content:"\F0A3D"}.mdi-comment-text::before{content:"\F0188"}.mdi-comment-text-multiple::before{content:"\F0860"}.mdi-comment-text-multiple-outline::before{content:"\F0861"}.mdi-comment-text-outline::before{content:"\F0189"}.mdi-compare::before{content:"\F018A"}.mdi-compare-horizontal::before{content:"\F1492"}.mdi-compare-remove::before{content:"\F18B3"}.mdi-compare-vertical::before{content:"\F1493"}.mdi-compass::before{content:"\F018B"}.mdi-compass-off::before{content:"\F0B80"}.mdi-compass-off-outline::before{content:"\F0B81"}.mdi-compass-outline::before{content:"\F018C"}.mdi-compass-rose::before{content:"\F1382"}.mdi-compost::before{content:"\F1A38"}.mdi-cone::before{content:"\F194C"}.mdi-cone-off::before{content:"\F194D"}.mdi-connection::before{content:"\F1616"}.mdi-console::before{content:"\F018D"}.mdi-console-line::before{content:"\F07B7"}.mdi-console-network::before{content:"\F08A9"}.mdi-console-network-outline::before{content:"\F0C60"}.mdi-consolidate::before{content:"\F10D8"}.mdi-contactless-payment::before{content:"\F0D6A"}.mdi-contactless-payment-circle::before{content:"\F0321"}.mdi-contactless-payment-circle-outline::before{content:"\F0408"}.mdi-contacts::before{content:"\F06CB"}.mdi-contacts-outline::before{content:"\F05B8"}.mdi-contain::before{content:"\F0A3E"}.mdi-contain-end::before{content:"\F0A3F"}.mdi-contain-start::before{content:"\F0A40"}.mdi-content-copy::before{content:"\F018F"}.mdi-content-cut::before{content:"\F0190"}.mdi-content-duplicate::before{content:"\F0191"}.mdi-content-paste::before{content:"\F0192"}.mdi-content-save::before{content:"\F0193"}.mdi-content-save-alert::before{content:"\F0F42"}.mdi-content-save-alert-outline::before{content:"\F0F43"}.mdi-content-save-all::before{content:"\F0194"}.mdi-content-save-all-outline::before{content:"\F0F44"}.mdi-content-save-check::before{content:"\F18EA"}.mdi-content-save-check-outline::before{content:"\F18EB"}.mdi-content-save-cog::before{content:"\F145B"}.mdi-content-save-cog-outline::before{content:"\F145C"}.mdi-content-save-edit::before{content:"\F0CFB"}.mdi-content-save-edit-outline::before{content:"\F0CFC"}.mdi-content-save-minus::before{content:"\F1B43"}.mdi-content-save-minus-outline::before{content:"\F1B44"}.mdi-content-save-move::before{content:"\F0E27"}.mdi-content-save-move-outline::before{content:"\F0E28"}.mdi-content-save-off::before{content:"\F1643"}.mdi-content-save-off-outline::before{content:"\F1644"}.mdi-content-save-outline::before{content:"\F0818"}.mdi-content-save-plus::before{content:"\F1B41"}.mdi-content-save-plus-outline::before{content:"\F1B42"}.mdi-content-save-settings::before{content:"\F061B"}.mdi-content-save-settings-outline::before{content:"\F0B2E"}.mdi-contrast::before{content:"\F0195"}.mdi-contrast-box::before{content:"\F0196"}.mdi-contrast-circle::before{content:"\F0197"}.mdi-controller::before{content:"\F02B4"}.mdi-controller-classic::before{content:"\F0B82"}.mdi-controller-classic-outline::before{content:"\F0B83"}.mdi-controller-off::before{content:"\F02B5"}.mdi-cookie::before{content:"\F0198"}.mdi-cookie-alert::before{content:"\F16D0"}.mdi-cookie-alert-outline::before{content:"\F16D1"}.mdi-cookie-check::before{content:"\F16D2"}.mdi-cookie-check-outline::before{content:"\F16D3"}.mdi-cookie-clock::before{content:"\F16E4"}.mdi-cookie-clock-outline::before{content:"\F16E5"}.mdi-cookie-cog::before{content:"\F16D4"}.mdi-cookie-cog-outline::before{content:"\F16D5"}.mdi-cookie-edit::before{content:"\F16E6"}.mdi-cookie-edit-outline::before{content:"\F16E7"}.mdi-cookie-lock::before{content:"\F16E8"}.mdi-cookie-lock-outline::before{content:"\F16E9"}.mdi-cookie-minus::before{content:"\F16DA"}.mdi-cookie-minus-outline::before{content:"\F16DB"}.mdi-cookie-off::before{content:"\F16EA"}.mdi-cookie-off-outline::before{content:"\F16EB"}.mdi-cookie-outline::before{content:"\F16DE"}.mdi-cookie-plus::before{content:"\F16D6"}.mdi-cookie-plus-outline::before{content:"\F16D7"}.mdi-cookie-refresh::before{content:"\F16EC"}.mdi-cookie-refresh-outline::before{content:"\F16ED"}.mdi-cookie-remove::before{content:"\F16D8"}.mdi-cookie-remove-outline::before{content:"\F16D9"}.mdi-cookie-settings::before{content:"\F16DC"}.mdi-cookie-settings-outline::before{content:"\F16DD"}.mdi-coolant-temperature::before{content:"\F03C8"}.mdi-copyleft::before{content:"\F1939"}.mdi-copyright::before{content:"\F05E6"}.mdi-cordova::before{content:"\F0958"}.mdi-corn::before{content:"\F07B8"}.mdi-corn-off::before{content:"\F13EF"}.mdi-cosine-wave::before{content:"\F1479"}.mdi-counter::before{content:"\F0199"}.mdi-countertop::before{content:"\F181C"}.mdi-countertop-outline::before{content:"\F181D"}.mdi-cow::before{content:"\F019A"}.mdi-cow-off::before{content:"\F18FC"}.mdi-cpu-32-bit::before{content:"\F0EDF"}.mdi-cpu-64-bit::before{content:"\F0EE0"}.mdi-cradle::before{content:"\F198B"}.mdi-cradle-outline::before{content:"\F1991"}.mdi-crane::before{content:"\F0862"}.mdi-creation::before{content:"\F0674"}.mdi-creation-outline::before{content:"\F1C2B"}.mdi-creative-commons::before{content:"\F0D6B"}.mdi-credit-card::before{content:"\F0FEF"}.mdi-credit-card-check::before{content:"\F13D0"}.mdi-credit-card-check-outline::before{content:"\F13D1"}.mdi-credit-card-chip::before{content:"\F190F"}.mdi-credit-card-chip-outline::before{content:"\F1910"}.mdi-credit-card-clock::before{content:"\F0EE1"}.mdi-credit-card-clock-outline::before{content:"\F0EE2"}.mdi-credit-card-edit::before{content:"\F17D7"}.mdi-credit-card-edit-outline::before{content:"\F17D8"}.mdi-credit-card-fast::before{content:"\F1911"}.mdi-credit-card-fast-outline::before{content:"\F1912"}.mdi-credit-card-lock::before{content:"\F18E7"}.mdi-credit-card-lock-outline::before{content:"\F18E8"}.mdi-credit-card-marker::before{content:"\F06A8"}.mdi-credit-card-marker-outline::before{content:"\F0DBE"}.mdi-credit-card-minus::before{content:"\F0FAC"}.mdi-credit-card-minus-outline::before{content:"\F0FAD"}.mdi-credit-card-multiple::before{content:"\F0FF0"}.mdi-credit-card-multiple-outline::before{content:"\F019C"}.mdi-credit-card-off::before{content:"\F0FF1"}.mdi-credit-card-off-outline::before{content:"\F05E4"}.mdi-credit-card-outline::before{content:"\F019B"}.mdi-credit-card-plus::before{content:"\F0FF2"}.mdi-credit-card-plus-outline::before{content:"\F0676"}.mdi-credit-card-refresh::before{content:"\F1645"}.mdi-credit-card-refresh-outline::before{content:"\F1646"}.mdi-credit-card-refund::before{content:"\F0FF3"}.mdi-credit-card-refund-outline::before{content:"\F0AA8"}.mdi-credit-card-remove::before{content:"\F0FAE"}.mdi-credit-card-remove-outline::before{content:"\F0FAF"}.mdi-credit-card-scan::before{content:"\F0FF4"}.mdi-credit-card-scan-outline::before{content:"\F019D"}.mdi-credit-card-search::before{content:"\F1647"}.mdi-credit-card-search-outline::before{content:"\F1648"}.mdi-credit-card-settings::before{content:"\F0FF5"}.mdi-credit-card-settings-outline::before{content:"\F08D7"}.mdi-credit-card-sync::before{content:"\F1649"}.mdi-credit-card-sync-outline::before{content:"\F164A"}.mdi-credit-card-wireless::before{content:"\F0802"}.mdi-credit-card-wireless-off::before{content:"\F057A"}.mdi-credit-card-wireless-off-outline::before{content:"\F057B"}.mdi-credit-card-wireless-outline::before{content:"\F0D6C"}.mdi-cricket::before{content:"\F0D6D"}.mdi-crop::before{content:"\F019E"}.mdi-crop-free::before{content:"\F019F"}.mdi-crop-landscape::before{content:"\F01A0"}.mdi-crop-portrait::before{content:"\F01A1"}.mdi-crop-rotate::before{content:"\F0696"}.mdi-crop-square::before{content:"\F01A2"}.mdi-cross::before{content:"\F0953"}.mdi-cross-bolnisi::before{content:"\F0CED"}.mdi-cross-celtic::before{content:"\F0CF5"}.mdi-cross-outline::before{content:"\F0CF6"}.mdi-crosshairs::before{content:"\F01A3"}.mdi-crosshairs-gps::before{content:"\F01A4"}.mdi-crosshairs-off::before{content:"\F0F45"}.mdi-crosshairs-question::before{content:"\F1136"}.mdi-crowd::before{content:"\F1975"}.mdi-crown::before{content:"\F01A5"}.mdi-crown-circle::before{content:"\F17DC"}.mdi-crown-circle-outline::before{content:"\F17DD"}.mdi-crown-outline::before{content:"\F11D0"}.mdi-cryengine::before{content:"\F0959"}.mdi-crystal-ball::before{content:"\F0B2F"}.mdi-cube::before{content:"\F01A6"}.mdi-cube-off::before{content:"\F141C"}.mdi-cube-off-outline::before{content:"\F141D"}.mdi-cube-outline::before{content:"\F01A7"}.mdi-cube-scan::before{content:"\F0B84"}.mdi-cube-send::before{content:"\F01A8"}.mdi-cube-unfolded::before{content:"\F01A9"}.mdi-cup::before{content:"\F01AA"}.mdi-cup-off::before{content:"\F05E5"}.mdi-cup-off-outline::before{content:"\F137D"}.mdi-cup-outline::before{content:"\F130F"}.mdi-cup-water::before{content:"\F01AB"}.mdi-cupboard::before{content:"\F0F46"}.mdi-cupboard-outline::before{content:"\F0F47"}.mdi-cupcake::before{content:"\F095A"}.mdi-curling::before{content:"\F0863"}.mdi-currency-bdt::before{content:"\F0864"}.mdi-currency-brl::before{content:"\F0B85"}.mdi-currency-btc::before{content:"\F01AC"}.mdi-currency-cny::before{content:"\F07BA"}.mdi-currency-eth::before{content:"\F07BB"}.mdi-currency-eur::before{content:"\F01AD"}.mdi-currency-eur-off::before{content:"\F1315"}.mdi-currency-fra::before{content:"\F1A39"}.mdi-currency-gbp::before{content:"\F01AE"}.mdi-currency-ils::before{content:"\F0C61"}.mdi-currency-inr::before{content:"\F01AF"}.mdi-currency-jpy::before{content:"\F07BC"}.mdi-currency-krw::before{content:"\F07BD"}.mdi-currency-kzt::before{content:"\F0865"}.mdi-currency-mnt::before{content:"\F1512"}.mdi-currency-ngn::before{content:"\F01B0"}.mdi-currency-php::before{content:"\F09E6"}.mdi-currency-rial::before{content:"\F0E9C"}.mdi-currency-rub::before{content:"\F01B1"}.mdi-currency-rupee::before{content:"\F1976"}.mdi-currency-sign::before{content:"\F07BE"}.mdi-currency-thb::before{content:"\F1C05"}.mdi-currency-try::before{content:"\F01B2"}.mdi-currency-twd::before{content:"\F07BF"}.mdi-currency-uah::before{content:"\F1B9B"}.mdi-currency-usd::before{content:"\F01C1"}.mdi-currency-usd-off::before{content:"\F067A"}.mdi-current-ac::before{content:"\F1480"}.mdi-current-dc::before{content:"\F095C"}.mdi-cursor-default::before{content:"\F01C0"}.mdi-cursor-default-click::before{content:"\F0CFD"}.mdi-cursor-default-click-outline::before{content:"\F0CFE"}.mdi-cursor-default-gesture::before{content:"\F1127"}.mdi-cursor-default-gesture-outline::before{content:"\F1128"}.mdi-cursor-default-outline::before{content:"\F01BF"}.mdi-cursor-move::before{content:"\F01BE"}.mdi-cursor-pointer::before{content:"\F01BD"}.mdi-cursor-text::before{content:"\F05E7"}.mdi-curtains::before{content:"\F1846"}.mdi-curtains-closed::before{content:"\F1847"}.mdi-cylinder::before{content:"\F194E"}.mdi-cylinder-off::before{content:"\F194F"}.mdi-dance-ballroom::before{content:"\F15FB"}.mdi-dance-pole::before{content:"\F1578"}.mdi-data-matrix::before{content:"\F153C"}.mdi-data-matrix-edit::before{content:"\F153D"}.mdi-data-matrix-minus::before{content:"\F153E"}.mdi-data-matrix-plus::before{content:"\F153F"}.mdi-data-matrix-remove::before{content:"\F1540"}.mdi-data-matrix-scan::before{content:"\F1541"}.mdi-database::before{content:"\F01BC"}.mdi-database-alert::before{content:"\F163A"}.mdi-database-alert-outline::before{content:"\F1624"}.mdi-database-arrow-down::before{content:"\F163B"}.mdi-database-arrow-down-outline::before{content:"\F1625"}.mdi-database-arrow-left::before{content:"\F163C"}.mdi-database-arrow-left-outline::before{content:"\F1626"}.mdi-database-arrow-right::before{content:"\F163D"}.mdi-database-arrow-right-outline::before{content:"\F1627"}.mdi-database-arrow-up::before{content:"\F163E"}.mdi-database-arrow-up-outline::before{content:"\F1628"}.mdi-database-check::before{content:"\F0AA9"}.mdi-database-check-outline::before{content:"\F1629"}.mdi-database-clock::before{content:"\F163F"}.mdi-database-clock-outline::before{content:"\F162A"}.mdi-database-cog::before{content:"\F164B"}.mdi-database-cog-outline::before{content:"\F164C"}.mdi-database-edit::before{content:"\F0B86"}.mdi-database-edit-outline::before{content:"\F162B"}.mdi-database-export::before{content:"\F095E"}.mdi-database-export-outline::before{content:"\F162C"}.mdi-database-eye::before{content:"\F191F"}.mdi-database-eye-off::before{content:"\F1920"}.mdi-database-eye-off-outline::before{content:"\F1921"}.mdi-database-eye-outline::before{content:"\F1922"}.mdi-database-import::before{content:"\F095D"}.mdi-database-import-outline::before{content:"\F162D"}.mdi-database-lock::before{content:"\F0AAA"}.mdi-database-lock-outline::before{content:"\F162E"}.mdi-database-marker::before{content:"\F12F6"}.mdi-database-marker-outline::before{content:"\F162F"}.mdi-database-minus::before{content:"\F01BB"}.mdi-database-minus-outline::before{content:"\F1630"}.mdi-database-off::before{content:"\F1640"}.mdi-database-off-outline::before{content:"\F1631"}.mdi-database-outline::before{content:"\F1632"}.mdi-database-plus::before{content:"\F01BA"}.mdi-database-plus-outline::before{content:"\F1633"}.mdi-database-refresh::before{content:"\F05C2"}.mdi-database-refresh-outline::before{content:"\F1634"}.mdi-database-remove::before{content:"\F0D00"}.mdi-database-remove-outline::before{content:"\F1635"}.mdi-database-search::before{content:"\F0866"}.mdi-database-search-outline::before{content:"\F1636"}.mdi-database-settings::before{content:"\F0D01"}.mdi-database-settings-outline::before{content:"\F1637"}.mdi-database-sync::before{content:"\F0CFF"}.mdi-database-sync-outline::before{content:"\F1638"}.mdi-death-star::before{content:"\F08D8"}.mdi-death-star-variant::before{content:"\F08D9"}.mdi-deathly-hallows::before{content:"\F0B87"}.mdi-debian::before{content:"\F08DA"}.mdi-debug-step-into::before{content:"\F01B9"}.mdi-debug-step-out::before{content:"\F01B8"}.mdi-debug-step-over::before{content:"\F01B7"}.mdi-decagram::before{content:"\F076C"}.mdi-decagram-outline::before{content:"\F076D"}.mdi-decimal::before{content:"\F10A1"}.mdi-decimal-comma::before{content:"\F10A2"}.mdi-decimal-comma-decrease::before{content:"\F10A3"}.mdi-decimal-comma-increase::before{content:"\F10A4"}.mdi-decimal-decrease::before{content:"\F01B6"}.mdi-decimal-increase::before{content:"\F01B5"}.mdi-delete::before{content:"\F01B4"}.mdi-delete-alert::before{content:"\F10A5"}.mdi-delete-alert-outline::before{content:"\F10A6"}.mdi-delete-circle::before{content:"\F0683"}.mdi-delete-circle-outline::before{content:"\F0B88"}.mdi-delete-clock::before{content:"\F1556"}.mdi-delete-clock-outline::before{content:"\F1557"}.mdi-delete-empty::before{content:"\F06CC"}.mdi-delete-empty-outline::before{content:"\F0E9D"}.mdi-delete-forever::before{content:"\F05E8"}.mdi-delete-forever-outline::before{content:"\F0B89"}.mdi-delete-off::before{content:"\F10A7"}.mdi-delete-off-outline::before{content:"\F10A8"}.mdi-delete-outline::before{content:"\F09E7"}.mdi-delete-restore::before{content:"\F0819"}.mdi-delete-sweep::before{content:"\F05E9"}.mdi-delete-sweep-outline::before{content:"\F0C62"}.mdi-delete-variant::before{content:"\F01B3"}.mdi-delta::before{content:"\F01C2"}.mdi-desk::before{content:"\F1239"}.mdi-desk-lamp::before{content:"\F095F"}.mdi-desk-lamp-off::before{content:"\F1B1F"}.mdi-desk-lamp-on::before{content:"\F1B20"}.mdi-deskphone::before{content:"\F01C3"}.mdi-desktop-classic::before{content:"\F07C0"}.mdi-desktop-tower::before{content:"\F01C5"}.mdi-desktop-tower-monitor::before{content:"\F0AAB"}.mdi-details::before{content:"\F01C6"}.mdi-dev-to::before{content:"\F0D6E"}.mdi-developer-board::before{content:"\F0697"}.mdi-deviantart::before{content:"\F01C7"}.mdi-devices::before{content:"\F0FB0"}.mdi-dharmachakra::before{content:"\F094B"}.mdi-diabetes::before{content:"\F1126"}.mdi-dialpad::before{content:"\F061C"}.mdi-diameter::before{content:"\F0C63"}.mdi-diameter-outline::before{content:"\F0C64"}.mdi-diameter-variant::before{content:"\F0C65"}.mdi-diamond::before{content:"\F0B8A"}.mdi-diamond-outline::before{content:"\F0B8B"}.mdi-diamond-stone::before{content:"\F01C8"}.mdi-diaper-outline::before{content:"\F1CCF"}.mdi-dice-1::before{content:"\F01CA"}.mdi-dice-1-outline::before{content:"\F114A"}.mdi-dice-2::before{content:"\F01CB"}.mdi-dice-2-outline::before{content:"\F114B"}.mdi-dice-3::before{content:"\F01CC"}.mdi-dice-3-outline::before{content:"\F114C"}.mdi-dice-4::before{content:"\F01CD"}.mdi-dice-4-outline::before{content:"\F114D"}.mdi-dice-5::before{content:"\F01CE"}.mdi-dice-5-outline::before{content:"\F114E"}.mdi-dice-6::before{content:"\F01CF"}.mdi-dice-6-outline::before{content:"\F114F"}.mdi-dice-d10::before{content:"\F1153"}.mdi-dice-d10-outline::before{content:"\F076F"}.mdi-dice-d12::before{content:"\F1154"}.mdi-dice-d12-outline::before{content:"\F0867"}.mdi-dice-d20::before{content:"\F1155"}.mdi-dice-d20-outline::before{content:"\F05EA"}.mdi-dice-d4::before{content:"\F1150"}.mdi-dice-d4-outline::before{content:"\F05EB"}.mdi-dice-d6::before{content:"\F1151"}.mdi-dice-d6-outline::before{content:"\F05ED"}.mdi-dice-d8::before{content:"\F1152"}.mdi-dice-d8-outline::before{content:"\F05EC"}.mdi-dice-multiple::before{content:"\F076E"}.mdi-dice-multiple-outline::before{content:"\F1156"}.mdi-digital-ocean::before{content:"\F1237"}.mdi-dip-switch::before{content:"\F07C1"}.mdi-directions::before{content:"\F01D0"}.mdi-directions-fork::before{content:"\F0641"}.mdi-disc::before{content:"\F05EE"}.mdi-disc-alert::before{content:"\F01D1"}.mdi-disc-player::before{content:"\F0960"}.mdi-dishwasher::before{content:"\F0AAC"}.mdi-dishwasher-alert::before{content:"\F11B8"}.mdi-dishwasher-off::before{content:"\F11B9"}.mdi-disqus::before{content:"\F01D2"}.mdi-distribute-horizontal-center::before{content:"\F11C9"}.mdi-distribute-horizontal-left::before{content:"\F11C8"}.mdi-distribute-horizontal-right::before{content:"\F11CA"}.mdi-distribute-vertical-bottom::before{content:"\F11CB"}.mdi-distribute-vertical-center::before{content:"\F11CC"}.mdi-distribute-vertical-top::before{content:"\F11CD"}.mdi-diversify::before{content:"\F1877"}.mdi-diving::before{content:"\F1977"}.mdi-diving-flippers::before{content:"\F0DBF"}.mdi-diving-helmet::before{content:"\F0DC0"}.mdi-diving-scuba::before{content:"\F1B77"}.mdi-diving-scuba-flag::before{content:"\F0DC2"}.mdi-diving-scuba-mask::before{content:"\F0DC1"}.mdi-diving-scuba-tank::before{content:"\F0DC3"}.mdi-diving-scuba-tank-multiple::before{content:"\F0DC4"}.mdi-diving-snorkel::before{content:"\F0DC5"}.mdi-division::before{content:"\F01D4"}.mdi-division-box::before{content:"\F01D5"}.mdi-dlna::before{content:"\F0A41"}.mdi-dna::before{content:"\F0684"}.mdi-dns::before{content:"\F01D6"}.mdi-dns-outline::before{content:"\F0B8C"}.mdi-dock-bottom::before{content:"\F10A9"}.mdi-dock-left::before{content:"\F10AA"}.mdi-dock-right::before{content:"\F10AB"}.mdi-dock-top::before{content:"\F1513"}.mdi-dock-window::before{content:"\F10AC"}.mdi-docker::before{content:"\F0868"}.mdi-doctor::before{content:"\F0A42"}.mdi-dog::before{content:"\F0A43"}.mdi-dog-service::before{content:"\F0AAD"}.mdi-dog-side::before{content:"\F0A44"}.mdi-dog-side-off::before{content:"\F16EE"}.mdi-dolby::before{content:"\F06B3"}.mdi-dolly::before{content:"\F0E9E"}.mdi-dolphin::before{content:"\F18B4"}.mdi-domain::before{content:"\F01D7"}.mdi-domain-off::before{content:"\F0D6F"}.mdi-domain-plus::before{content:"\F10AD"}.mdi-domain-remove::before{content:"\F10AE"}.mdi-domain-switch::before{content:"\F1C2C"}.mdi-dome-light::before{content:"\F141E"}.mdi-domino-mask::before{content:"\F1023"}.mdi-donkey::before{content:"\F07C2"}.mdi-door::before{content:"\F081A"}.mdi-door-closed::before{content:"\F081B"}.mdi-door-closed-cancel::before{content:"\F1C93"}.mdi-door-closed-lock::before{content:"\F10AF"}.mdi-door-open::before{content:"\F081C"}.mdi-door-sliding::before{content:"\F181E"}.mdi-door-sliding-lock::before{content:"\F181F"}.mdi-door-sliding-open::before{content:"\F1820"}.mdi-doorbell::before{content:"\F12E6"}.mdi-doorbell-video::before{content:"\F0869"}.mdi-dot-net::before{content:"\F0AAE"}.mdi-dots-circle::before{content:"\F1978"}.mdi-dots-grid::before{content:"\F15FC"}.mdi-dots-hexagon::before{content:"\F15FF"}.mdi-dots-horizontal::before{content:"\F01D8"}.mdi-dots-horizontal-circle::before{content:"\F07C3"}.mdi-dots-horizontal-circle-outline::before{content:"\F0B8D"}.mdi-dots-square::before{content:"\F15FD"}.mdi-dots-triangle::before{content:"\F15FE"}.mdi-dots-vertical::before{content:"\F01D9"}.mdi-dots-vertical-circle::before{content:"\F07C4"}.mdi-dots-vertical-circle-outline::before{content:"\F0B8E"}.mdi-download::before{content:"\F01DA"}.mdi-download-box::before{content:"\F1462"}.mdi-download-box-outline::before{content:"\F1463"}.mdi-download-circle::before{content:"\F1464"}.mdi-download-circle-outline::before{content:"\F1465"}.mdi-download-lock::before{content:"\F1320"}.mdi-download-lock-outline::before{content:"\F1321"}.mdi-download-multiple::before{content:"\F09E9"}.mdi-download-multiple-outline::before{content:"\F1CD0"}.mdi-download-network::before{content:"\F06F4"}.mdi-download-network-outline::before{content:"\F0C66"}.mdi-download-off::before{content:"\F10B0"}.mdi-download-off-outline::before{content:"\F10B1"}.mdi-download-outline::before{content:"\F0B8F"}.mdi-drag::before{content:"\F01DB"}.mdi-drag-horizontal::before{content:"\F01DC"}.mdi-drag-horizontal-variant::before{content:"\F12F0"}.mdi-drag-variant::before{content:"\F0B90"}.mdi-drag-vertical::before{content:"\F01DD"}.mdi-drag-vertical-variant::before{content:"\F12F1"}.mdi-drama-masks::before{content:"\F0D02"}.mdi-draw::before{content:"\F0F49"}.mdi-draw-pen::before{content:"\F19B9"}.mdi-drawing::before{content:"\F01DE"}.mdi-drawing-box::before{content:"\F01DF"}.mdi-dresser::before{content:"\F0F4A"}.mdi-dresser-outline::before{content:"\F0F4B"}.mdi-drone::before{content:"\F01E2"}.mdi-dropbox::before{content:"\F01E3"}.mdi-drupal::before{content:"\F01E4"}.mdi-duck::before{content:"\F01E5"}.mdi-dumbbell::before{content:"\F01E6"}.mdi-dump-truck::before{content:"\F0C67"}.mdi-ear-hearing::before{content:"\F07C5"}.mdi-ear-hearing-loop::before{content:"\F1AEE"}.mdi-ear-hearing-off::before{content:"\F0A45"}.mdi-earbuds::before{content:"\F184F"}.mdi-earbuds-off::before{content:"\F1850"}.mdi-earbuds-off-outline::before{content:"\F1851"}.mdi-earbuds-outline::before{content:"\F1852"}.mdi-earth::before{content:"\F01E7"}.mdi-earth-arrow-down::before{content:"\F1C87"}.mdi-earth-arrow-left::before{content:"\F1C88"}.mdi-earth-arrow-right::before{content:"\F1311"}.mdi-earth-arrow-up::before{content:"\F1C89"}.mdi-earth-box::before{content:"\F06CD"}.mdi-earth-box-minus::before{content:"\F1407"}.mdi-earth-box-off::before{content:"\F06CE"}.mdi-earth-box-plus::before{content:"\F1406"}.mdi-earth-box-remove::before{content:"\F1408"}.mdi-earth-minus::before{content:"\F1404"}.mdi-earth-off::before{content:"\F01E8"}.mdi-earth-plus::before{content:"\F1403"}.mdi-earth-remove::before{content:"\F1405"}.mdi-egg::before{content:"\F0AAF"}.mdi-egg-easter::before{content:"\F0AB0"}.mdi-egg-fried::before{content:"\F184A"}.mdi-egg-off::before{content:"\F13F0"}.mdi-egg-off-outline::before{content:"\F13F1"}.mdi-egg-outline::before{content:"\F13F2"}.mdi-eiffel-tower::before{content:"\F156B"}.mdi-eight-track::before{content:"\F09EA"}.mdi-eject::before{content:"\F01EA"}.mdi-eject-circle::before{content:"\F1B23"}.mdi-eject-circle-outline::before{content:"\F1B24"}.mdi-eject-outline::before{content:"\F0B91"}.mdi-electric-switch::before{content:"\F0E9F"}.mdi-electric-switch-closed::before{content:"\F10D9"}.mdi-electron-framework::before{content:"\F1024"}.mdi-elephant::before{content:"\F07C6"}.mdi-elevation-decline::before{content:"\F01EB"}.mdi-elevation-rise::before{content:"\F01EC"}.mdi-elevator::before{content:"\F01ED"}.mdi-elevator-down::before{content:"\F12C2"}.mdi-elevator-passenger::before{content:"\F1381"}.mdi-elevator-passenger-off::before{content:"\F1979"}.mdi-elevator-passenger-off-outline::before{content:"\F197A"}.mdi-elevator-passenger-outline::before{content:"\F197B"}.mdi-elevator-up::before{content:"\F12C1"}.mdi-ellipse::before{content:"\F0EA0"}.mdi-ellipse-outline::before{content:"\F0EA1"}.mdi-email::before{content:"\F01EE"}.mdi-email-alert::before{content:"\F06CF"}.mdi-email-alert-outline::before{content:"\F0D42"}.mdi-email-arrow-left::before{content:"\F10DA"}.mdi-email-arrow-left-outline::before{content:"\F10DB"}.mdi-email-arrow-right::before{content:"\F10DC"}.mdi-email-arrow-right-outline::before{content:"\F10DD"}.mdi-email-box::before{content:"\F0D03"}.mdi-email-check::before{content:"\F0AB1"}.mdi-email-check-outline::before{content:"\F0AB2"}.mdi-email-edit::before{content:"\F0EE3"}.mdi-email-edit-outline::before{content:"\F0EE4"}.mdi-email-fast::before{content:"\F186F"}.mdi-email-fast-outline::before{content:"\F1870"}.mdi-email-heart-outline::before{content:"\F1C5B"}.mdi-email-lock::before{content:"\F01F1"}.mdi-email-lock-outline::before{content:"\F1B61"}.mdi-email-mark-as-unread::before{content:"\F0B92"}.mdi-email-minus::before{content:"\F0EE5"}.mdi-email-minus-outline::before{content:"\F0EE6"}.mdi-email-multiple::before{content:"\F0EE7"}.mdi-email-multiple-outline::before{content:"\F0EE8"}.mdi-email-newsletter::before{content:"\F0FB1"}.mdi-email-off::before{content:"\F13E3"}.mdi-email-off-outline::before{content:"\F13E4"}.mdi-email-open::before{content:"\F01EF"}.mdi-email-open-heart-outline::before{content:"\F1C5C"}.mdi-email-open-multiple::before{content:"\F0EE9"}.mdi-email-open-multiple-outline::before{content:"\F0EEA"}.mdi-email-open-outline::before{content:"\F05EF"}.mdi-email-outline::before{content:"\F01F0"}.mdi-email-plus::before{content:"\F09EB"}.mdi-email-plus-outline::before{content:"\F09EC"}.mdi-email-remove::before{content:"\F1661"}.mdi-email-remove-outline::before{content:"\F1662"}.mdi-email-seal::before{content:"\F195B"}.mdi-email-seal-outline::before{content:"\F195C"}.mdi-email-search::before{content:"\F0961"}.mdi-email-search-outline::before{content:"\F0962"}.mdi-email-sync::before{content:"\F12C7"}.mdi-email-sync-outline::before{content:"\F12C8"}.mdi-email-variant::before{content:"\F05F0"}.mdi-ember::before{content:"\F0B30"}.mdi-emby::before{content:"\F06B4"}.mdi-emoticon::before{content:"\F0C68"}.mdi-emoticon-angry::before{content:"\F0C69"}.mdi-emoticon-angry-outline::before{content:"\F0C6A"}.mdi-emoticon-confused::before{content:"\F10DE"}.mdi-emoticon-confused-outline::before{content:"\F10DF"}.mdi-emoticon-cool::before{content:"\F0C6B"}.mdi-emoticon-cool-outline::before{content:"\F01F3"}.mdi-emoticon-cry::before{content:"\F0C6C"}.mdi-emoticon-cry-outline::before{content:"\F0C6D"}.mdi-emoticon-dead::before{content:"\F0C6E"}.mdi-emoticon-dead-outline::before{content:"\F069B"}.mdi-emoticon-devil::before{content:"\F0C6F"}.mdi-emoticon-devil-outline::before{content:"\F01F4"}.mdi-emoticon-excited::before{content:"\F0C70"}.mdi-emoticon-excited-outline::before{content:"\F069C"}.mdi-emoticon-frown::before{content:"\F0F4C"}.mdi-emoticon-frown-outline::before{content:"\F0F4D"}.mdi-emoticon-happy::before{content:"\F0C71"}.mdi-emoticon-happy-outline::before{content:"\F01F5"}.mdi-emoticon-kiss::before{content:"\F0C72"}.mdi-emoticon-kiss-outline::before{content:"\F0C73"}.mdi-emoticon-lol::before{content:"\F1214"}.mdi-emoticon-lol-outline::before{content:"\F1215"}.mdi-emoticon-minus::before{content:"\F1CB2"}.mdi-emoticon-minus-outline::before{content:"\F1CB3"}.mdi-emoticon-neutral::before{content:"\F0C74"}.mdi-emoticon-neutral-outline::before{content:"\F01F6"}.mdi-emoticon-outline::before{content:"\F01F2"}.mdi-emoticon-plus::before{content:"\F1CB4"}.mdi-emoticon-plus-outline::before{content:"\F1CB5"}.mdi-emoticon-poop::before{content:"\F01F7"}.mdi-emoticon-poop-outline::before{content:"\F0C75"}.mdi-emoticon-remove::before{content:"\F1CB6"}.mdi-emoticon-remove-outline::before{content:"\F1CB7"}.mdi-emoticon-sad::before{content:"\F0C76"}.mdi-emoticon-sad-outline::before{content:"\F01F8"}.mdi-emoticon-sick::before{content:"\F157C"}.mdi-emoticon-sick-outline::before{content:"\F157D"}.mdi-emoticon-tongue::before{content:"\F01F9"}.mdi-emoticon-tongue-outline::before{content:"\F0C77"}.mdi-emoticon-wink::before{content:"\F0C78"}.mdi-emoticon-wink-outline::before{content:"\F0C79"}.mdi-engine::before{content:"\F01FA"}.mdi-engine-off::before{content:"\F0A46"}.mdi-engine-off-outline::before{content:"\F0A47"}.mdi-engine-outline::before{content:"\F01FB"}.mdi-epsilon::before{content:"\F10E0"}.mdi-equal::before{content:"\F01FC"}.mdi-equal-box::before{content:"\F01FD"}.mdi-equalizer::before{content:"\F0EA2"}.mdi-equalizer-outline::before{content:"\F0EA3"}.mdi-eraser::before{content:"\F01FE"}.mdi-eraser-variant::before{content:"\F0642"}.mdi-escalator::before{content:"\F01FF"}.mdi-escalator-box::before{content:"\F1399"}.mdi-escalator-down::before{content:"\F12C0"}.mdi-escalator-up::before{content:"\F12BF"}.mdi-eslint::before{content:"\F0C7A"}.mdi-et::before{content:"\F0AB3"}.mdi-ethereum::before{content:"\F086A"}.mdi-ethernet::before{content:"\F0200"}.mdi-ethernet-cable::before{content:"\F0201"}.mdi-ethernet-cable-off::before{content:"\F0202"}.mdi-ethernet-off::before{content:"\F1CD1"}.mdi-ev-plug-ccs1::before{content:"\F1519"}.mdi-ev-plug-ccs2::before{content:"\F151A"}.mdi-ev-plug-chademo::before{content:"\F151B"}.mdi-ev-plug-tesla::before{content:"\F151C"}.mdi-ev-plug-type1::before{content:"\F151D"}.mdi-ev-plug-type2::before{content:"\F151E"}.mdi-ev-station::before{content:"\F05F1"}.mdi-evernote::before{content:"\F0204"}.mdi-excavator::before{content:"\F1025"}.mdi-exclamation::before{content:"\F0205"}.mdi-exclamation-thick::before{content:"\F1238"}.mdi-exit-run::before{content:"\F0A48"}.mdi-exit-to-app::before{content:"\F0206"}.mdi-expand-all::before{content:"\F0AB4"}.mdi-expand-all-outline::before{content:"\F0AB5"}.mdi-expansion-card::before{content:"\F08AE"}.mdi-expansion-card-variant::before{content:"\F0FB2"}.mdi-exponent::before{content:"\F0963"}.mdi-exponent-box::before{content:"\F0964"}.mdi-export::before{content:"\F0207"}.mdi-export-variant::before{content:"\F0B93"}.mdi-eye::before{content:"\F0208"}.mdi-eye-arrow-left::before{content:"\F18FD"}.mdi-eye-arrow-left-outline::before{content:"\F18FE"}.mdi-eye-arrow-right::before{content:"\F18FF"}.mdi-eye-arrow-right-outline::before{content:"\F1900"}.mdi-eye-check::before{content:"\F0D04"}.mdi-eye-check-outline::before{content:"\F0D05"}.mdi-eye-circle::before{content:"\F0B94"}.mdi-eye-circle-outline::before{content:"\F0B95"}.mdi-eye-closed::before{content:"\F1CA3"}.mdi-eye-lock::before{content:"\F1C06"}.mdi-eye-lock-open::before{content:"\F1C07"}.mdi-eye-lock-open-outline::before{content:"\F1C08"}.mdi-eye-lock-outline::before{content:"\F1C09"}.mdi-eye-minus::before{content:"\F1026"}.mdi-eye-minus-outline::before{content:"\F1027"}.mdi-eye-off::before{content:"\F0209"}.mdi-eye-off-outline::before{content:"\F06D1"}.mdi-eye-outline::before{content:"\F06D0"}.mdi-eye-plus::before{content:"\F086B"}.mdi-eye-plus-outline::before{content:"\F086C"}.mdi-eye-refresh::before{content:"\F197C"}.mdi-eye-refresh-outline::before{content:"\F197D"}.mdi-eye-remove::before{content:"\F15E3"}.mdi-eye-remove-outline::before{content:"\F15E4"}.mdi-eye-settings::before{content:"\F086D"}.mdi-eye-settings-outline::before{content:"\F086E"}.mdi-eyedropper::before{content:"\F020A"}.mdi-eyedropper-minus::before{content:"\F13DD"}.mdi-eyedropper-off::before{content:"\F13DF"}.mdi-eyedropper-plus::before{content:"\F13DC"}.mdi-eyedropper-remove::before{content:"\F13DE"}.mdi-eyedropper-variant::before{content:"\F020B"}.mdi-face-agent::before{content:"\F0D70"}.mdi-face-man::before{content:"\F0643"}.mdi-face-man-outline::before{content:"\F0B96"}.mdi-face-man-profile::before{content:"\F0644"}.mdi-face-man-shimmer::before{content:"\F15CC"}.mdi-face-man-shimmer-outline::before{content:"\F15CD"}.mdi-face-mask::before{content:"\F1586"}.mdi-face-mask-outline::before{content:"\F1587"}.mdi-face-recognition::before{content:"\F0C7B"}.mdi-face-woman::before{content:"\F1077"}.mdi-face-woman-outline::before{content:"\F1078"}.mdi-face-woman-profile::before{content:"\F1076"}.mdi-face-woman-shimmer::before{content:"\F15CE"}.mdi-face-woman-shimmer-outline::before{content:"\F15CF"}.mdi-facebook::before{content:"\F020C"}.mdi-facebook-gaming::before{content:"\F07DD"}.mdi-facebook-messenger::before{content:"\F020E"}.mdi-facebook-workplace::before{content:"\F0B31"}.mdi-factory::before{content:"\F020F"}.mdi-family-tree::before{content:"\F160E"}.mdi-fan::before{content:"\F0210"}.mdi-fan-alert::before{content:"\F146C"}.mdi-fan-auto::before{content:"\F171D"}.mdi-fan-chevron-down::before{content:"\F146D"}.mdi-fan-chevron-up::before{content:"\F146E"}.mdi-fan-clock::before{content:"\F1A3A"}.mdi-fan-minus::before{content:"\F1470"}.mdi-fan-off::before{content:"\F081D"}.mdi-fan-plus::before{content:"\F146F"}.mdi-fan-remove::before{content:"\F1471"}.mdi-fan-speed-1::before{content:"\F1472"}.mdi-fan-speed-2::before{content:"\F1473"}.mdi-fan-speed-3::before{content:"\F1474"}.mdi-fast-forward::before{content:"\F0211"}.mdi-fast-forward-10::before{content:"\F0D71"}.mdi-fast-forward-15::before{content:"\F193A"}.mdi-fast-forward-30::before{content:"\F0D06"}.mdi-fast-forward-45::before{content:"\F1B12"}.mdi-fast-forward-5::before{content:"\F11F8"}.mdi-fast-forward-60::before{content:"\F160B"}.mdi-fast-forward-outline::before{content:"\F06D2"}.mdi-faucet::before{content:"\F1B29"}.mdi-faucet-variant::before{content:"\F1B2A"}.mdi-fax::before{content:"\F0212"}.mdi-feather::before{content:"\F06D3"}.mdi-feature-search::before{content:"\F0A49"}.mdi-feature-search-outline::before{content:"\F0A4A"}.mdi-fedora::before{content:"\F08DB"}.mdi-fence::before{content:"\F179A"}.mdi-fence-electric::before{content:"\F17F6"}.mdi-fencing::before{content:"\F14C1"}.mdi-ferris-wheel::before{content:"\F0EA4"}.mdi-ferry::before{content:"\F0213"}.mdi-file::before{content:"\F0214"}.mdi-file-account::before{content:"\F073B"}.mdi-file-account-outline::before{content:"\F1028"}.mdi-file-alert::before{content:"\F0A4B"}.mdi-file-alert-outline::before{content:"\F0A4C"}.mdi-file-arrow-left-right::before{content:"\F1A93"}.mdi-file-arrow-left-right-outline::before{content:"\F1A94"}.mdi-file-arrow-up-down::before{content:"\F1A95"}.mdi-file-arrow-up-down-outline::before{content:"\F1A96"}.mdi-file-cabinet::before{content:"\F0AB6"}.mdi-file-cad::before{content:"\F0EEB"}.mdi-file-cad-box::before{content:"\F0EEC"}.mdi-file-cancel::before{content:"\F0DC6"}.mdi-file-cancel-outline::before{content:"\F0DC7"}.mdi-file-certificate::before{content:"\F1186"}.mdi-file-certificate-outline::before{content:"\F1187"}.mdi-file-chart::before{content:"\F0215"}.mdi-file-chart-check::before{content:"\F19C6"}.mdi-file-chart-check-outline::before{content:"\F19C7"}.mdi-file-chart-outline::before{content:"\F1029"}.mdi-file-check::before{content:"\F0216"}.mdi-file-check-outline::before{content:"\F0E29"}.mdi-file-clock::before{content:"\F12E1"}.mdi-file-clock-outline::before{content:"\F12E2"}.mdi-file-cloud::before{content:"\F0217"}.mdi-file-cloud-outline::before{content:"\F102A"}.mdi-file-code::before{content:"\F022E"}.mdi-file-code-outline::before{content:"\F102B"}.mdi-file-cog::before{content:"\F107B"}.mdi-file-cog-outline::before{content:"\F107C"}.mdi-file-compare::before{content:"\F08AA"}.mdi-file-delimited::before{content:"\F0218"}.mdi-file-delimited-outline::before{content:"\F0EA5"}.mdi-file-document::before{content:"\F0219"}.mdi-file-document-alert::before{content:"\F1A97"}.mdi-file-document-alert-outline::before{content:"\F1A98"}.mdi-file-document-arrow-right::before{content:"\F1C0F"}.mdi-file-document-arrow-right-outline::before{content:"\F1C10"}.mdi-file-document-check::before{content:"\F1A99"}.mdi-file-document-check-outline::before{content:"\F1A9A"}.mdi-file-document-edit::before{content:"\F0DC8"}.mdi-file-document-edit-outline::before{content:"\F0DC9"}.mdi-file-document-minus::before{content:"\F1A9B"}.mdi-file-document-minus-outline::before{content:"\F1A9C"}.mdi-file-document-multiple::before{content:"\F1517"}.mdi-file-document-multiple-outline::before{content:"\F1518"}.mdi-file-document-outline::before{content:"\F09EE"}.mdi-file-document-plus::before{content:"\F1A9D"}.mdi-file-document-plus-outline::before{content:"\F1A9E"}.mdi-file-document-refresh::before{content:"\F1C7A"}.mdi-file-document-refresh-outline::before{content:"\F1C7B"}.mdi-file-document-remove::before{content:"\F1A9F"}.mdi-file-document-remove-outline::before{content:"\F1AA0"}.mdi-file-download::before{content:"\F0965"}.mdi-file-download-outline::before{content:"\F0966"}.mdi-file-edit::before{content:"\F11E7"}.mdi-file-edit-outline::before{content:"\F11E8"}.mdi-file-excel::before{content:"\F021B"}.mdi-file-excel-box::before{content:"\F021C"}.mdi-file-excel-box-outline::before{content:"\F102C"}.mdi-file-excel-outline::before{content:"\F102D"}.mdi-file-export::before{content:"\F021D"}.mdi-file-export-outline::before{content:"\F102E"}.mdi-file-eye::before{content:"\F0DCA"}.mdi-file-eye-outline::before{content:"\F0DCB"}.mdi-file-find::before{content:"\F021E"}.mdi-file-find-outline::before{content:"\F0B97"}.mdi-file-gif-box::before{content:"\F0D78"}.mdi-file-hidden::before{content:"\F0613"}.mdi-file-image::before{content:"\F021F"}.mdi-file-image-marker::before{content:"\F1772"}.mdi-file-image-marker-outline::before{content:"\F1773"}.mdi-file-image-minus::before{content:"\F193B"}.mdi-file-image-minus-outline::before{content:"\F193C"}.mdi-file-image-outline::before{content:"\F0EB0"}.mdi-file-image-plus::before{content:"\F193D"}.mdi-file-image-plus-outline::before{content:"\F193E"}.mdi-file-image-remove::before{content:"\F193F"}.mdi-file-image-remove-outline::before{content:"\F1940"}.mdi-file-import::before{content:"\F0220"}.mdi-file-import-outline::before{content:"\F102F"}.mdi-file-jpg-box::before{content:"\F0225"}.mdi-file-key::before{content:"\F1184"}.mdi-file-key-outline::before{content:"\F1185"}.mdi-file-link::before{content:"\F1177"}.mdi-file-link-outline::before{content:"\F1178"}.mdi-file-lock::before{content:"\F0221"}.mdi-file-lock-open::before{content:"\F19C8"}.mdi-file-lock-open-outline::before{content:"\F19C9"}.mdi-file-lock-outline::before{content:"\F1030"}.mdi-file-marker::before{content:"\F1774"}.mdi-file-marker-outline::before{content:"\F1775"}.mdi-file-minus::before{content:"\F1AA1"}.mdi-file-minus-outline::before{content:"\F1AA2"}.mdi-file-move::before{content:"\F0AB9"}.mdi-file-move-outline::before{content:"\F1031"}.mdi-file-multiple::before{content:"\F0222"}.mdi-file-multiple-outline::before{content:"\F1032"}.mdi-file-music::before{content:"\F0223"}.mdi-file-music-outline::before{content:"\F0E2A"}.mdi-file-outline::before{content:"\F0224"}.mdi-file-pdf-box::before{content:"\F0226"}.mdi-file-percent::before{content:"\F081E"}.mdi-file-percent-outline::before{content:"\F1033"}.mdi-file-phone::before{content:"\F1179"}.mdi-file-phone-outline::before{content:"\F117A"}.mdi-file-plus::before{content:"\F0752"}.mdi-file-plus-outline::before{content:"\F0EED"}.mdi-file-png-box::before{content:"\F0E2D"}.mdi-file-powerpoint::before{content:"\F0227"}.mdi-file-powerpoint-box::before{content:"\F0228"}.mdi-file-powerpoint-box-outline::before{content:"\F1034"}.mdi-file-powerpoint-outline::before{content:"\F1035"}.mdi-file-presentation-box::before{content:"\F0229"}.mdi-file-question::before{content:"\F086F"}.mdi-file-question-outline::before{content:"\F1036"}.mdi-file-refresh::before{content:"\F0918"}.mdi-file-refresh-outline::before{content:"\F0541"}.mdi-file-remove::before{content:"\F0B98"}.mdi-file-remove-outline::before{content:"\F1037"}.mdi-file-replace::before{content:"\F0B32"}.mdi-file-replace-outline::before{content:"\F0B33"}.mdi-file-restore::before{content:"\F0670"}.mdi-file-restore-outline::before{content:"\F1038"}.mdi-file-rotate-left::before{content:"\F1A3B"}.mdi-file-rotate-left-outline::before{content:"\F1A3C"}.mdi-file-rotate-right::before{content:"\F1A3D"}.mdi-file-rotate-right-outline::before{content:"\F1A3E"}.mdi-file-search::before{content:"\F0C7C"}.mdi-file-search-outline::before{content:"\F0C7D"}.mdi-file-send::before{content:"\F022A"}.mdi-file-send-outline::before{content:"\F1039"}.mdi-file-settings::before{content:"\F1079"}.mdi-file-settings-outline::before{content:"\F107A"}.mdi-file-sign::before{content:"\F19C3"}.mdi-file-star::before{content:"\F103A"}.mdi-file-star-four-points::before{content:"\F1C2D"}.mdi-file-star-four-points-outline::before{content:"\F1C2E"}.mdi-file-star-outline::before{content:"\F103B"}.mdi-file-swap::before{content:"\F0FB4"}.mdi-file-swap-outline::before{content:"\F0FB5"}.mdi-file-sync::before{content:"\F1216"}.mdi-file-sync-outline::before{content:"\F1217"}.mdi-file-table::before{content:"\F0C7E"}.mdi-file-table-box::before{content:"\F10E1"}.mdi-file-table-box-multiple::before{content:"\F10E2"}.mdi-file-table-box-multiple-outline::before{content:"\F10E3"}.mdi-file-table-box-outline::before{content:"\F10E4"}.mdi-file-table-outline::before{content:"\F0C7F"}.mdi-file-tree::before{content:"\F0645"}.mdi-file-tree-outline::before{content:"\F13D2"}.mdi-file-undo::before{content:"\F08DC"}.mdi-file-undo-outline::before{content:"\F103C"}.mdi-file-upload::before{content:"\F0A4D"}.mdi-file-upload-outline::before{content:"\F0A4E"}.mdi-file-video::before{content:"\F022B"}.mdi-file-video-outline::before{content:"\F0E2C"}.mdi-file-word::before{content:"\F022C"}.mdi-file-word-box::before{content:"\F022D"}.mdi-file-word-box-outline::before{content:"\F103D"}.mdi-file-word-outline::before{content:"\F103E"}.mdi-file-xml-box::before{content:"\F1B4B"}.mdi-film::before{content:"\F022F"}.mdi-filmstrip::before{content:"\F0230"}.mdi-filmstrip-box::before{content:"\F0332"}.mdi-filmstrip-box-multiple::before{content:"\F0D18"}.mdi-filmstrip-off::before{content:"\F0231"}.mdi-filter::before{content:"\F0232"}.mdi-filter-check::before{content:"\F18EC"}.mdi-filter-check-outline::before{content:"\F18ED"}.mdi-filter-cog::before{content:"\F1AA3"}.mdi-filter-cog-outline::before{content:"\F1AA4"}.mdi-filter-menu::before{content:"\F10E5"}.mdi-filter-menu-outline::before{content:"\F10E6"}.mdi-filter-minus::before{content:"\F0EEE"}.mdi-filter-minus-outline::before{content:"\F0EEF"}.mdi-filter-multiple::before{content:"\F1A3F"}.mdi-filter-multiple-outline::before{content:"\F1A40"}.mdi-filter-off::before{content:"\F14EF"}.mdi-filter-off-outline::before{content:"\F14F0"}.mdi-filter-outline::before{content:"\F0233"}.mdi-filter-plus::before{content:"\F0EF0"}.mdi-filter-plus-outline::before{content:"\F0EF1"}.mdi-filter-remove::before{content:"\F0234"}.mdi-filter-remove-outline::before{content:"\F0235"}.mdi-filter-settings::before{content:"\F1AA5"}.mdi-filter-settings-outline::before{content:"\F1AA6"}.mdi-filter-variant::before{content:"\F0236"}.mdi-filter-variant-minus::before{content:"\F1112"}.mdi-filter-variant-plus::before{content:"\F1113"}.mdi-filter-variant-remove::before{content:"\F103F"}.mdi-finance::before{content:"\F081F"}.mdi-find-replace::before{content:"\F06D4"}.mdi-fingerprint::before{content:"\F0237"}.mdi-fingerprint-off::before{content:"\F0EB1"}.mdi-fire::before{content:"\F0238"}.mdi-fire-alert::before{content:"\F15D7"}.mdi-fire-circle::before{content:"\F1807"}.mdi-fire-extinguisher::before{content:"\F0EF2"}.mdi-fire-hydrant::before{content:"\F1137"}.mdi-fire-hydrant-alert::before{content:"\F1138"}.mdi-fire-hydrant-off::before{content:"\F1139"}.mdi-fire-off::before{content:"\F1722"}.mdi-fire-station::before{content:"\F1CC3"}.mdi-fire-truck::before{content:"\F08AB"}.mdi-firebase::before{content:"\F0967"}.mdi-firefox::before{content:"\F0239"}.mdi-fireplace::before{content:"\F0E2E"}.mdi-fireplace-off::before{content:"\F0E2F"}.mdi-firewire::before{content:"\F05BE"}.mdi-firework::before{content:"\F0E30"}.mdi-firework-off::before{content:"\F1723"}.mdi-fish::before{content:"\F023A"}.mdi-fish-off::before{content:"\F13F3"}.mdi-fishbowl::before{content:"\F0EF3"}.mdi-fishbowl-outline::before{content:"\F0EF4"}.mdi-fit-to-page::before{content:"\F0EF5"}.mdi-fit-to-page-outline::before{content:"\F0EF6"}.mdi-fit-to-screen::before{content:"\F18F4"}.mdi-fit-to-screen-outline::before{content:"\F18F5"}.mdi-flag::before{content:"\F023B"}.mdi-flag-checkered::before{content:"\F023C"}.mdi-flag-minus::before{content:"\F0B99"}.mdi-flag-minus-outline::before{content:"\F10B2"}.mdi-flag-off::before{content:"\F18EE"}.mdi-flag-off-outline::before{content:"\F18EF"}.mdi-flag-outline::before{content:"\F023D"}.mdi-flag-plus::before{content:"\F0B9A"}.mdi-flag-plus-outline::before{content:"\F10B3"}.mdi-flag-remove::before{content:"\F0B9B"}.mdi-flag-remove-outline::before{content:"\F10B4"}.mdi-flag-triangle::before{content:"\F023F"}.mdi-flag-variant::before{content:"\F0240"}.mdi-flag-variant-minus::before{content:"\F1BB4"}.mdi-flag-variant-minus-outline::before{content:"\F1BB5"}.mdi-flag-variant-off::before{content:"\F1BB0"}.mdi-flag-variant-off-outline::before{content:"\F1BB1"}.mdi-flag-variant-outline::before{content:"\F023E"}.mdi-flag-variant-plus::before{content:"\F1BB2"}.mdi-flag-variant-plus-outline::before{content:"\F1BB3"}.mdi-flag-variant-remove::before{content:"\F1BB6"}.mdi-flag-variant-remove-outline::before{content:"\F1BB7"}.mdi-flare::before{content:"\F0D72"}.mdi-flash::before{content:"\F0241"}.mdi-flash-alert::before{content:"\F0EF7"}.mdi-flash-alert-outline::before{content:"\F0EF8"}.mdi-flash-auto::before{content:"\F0242"}.mdi-flash-off::before{content:"\F0243"}.mdi-flash-off-outline::before{content:"\F1B45"}.mdi-flash-outline::before{content:"\F06D5"}.mdi-flash-red-eye::before{content:"\F067B"}.mdi-flash-triangle::before{content:"\F1B1D"}.mdi-flash-triangle-outline::before{content:"\F1B1E"}.mdi-flashlight::before{content:"\F0244"}.mdi-flashlight-off::before{content:"\F0245"}.mdi-flask::before{content:"\F0093"}.mdi-flask-empty::before{content:"\F0094"}.mdi-flask-empty-minus::before{content:"\F123A"}.mdi-flask-empty-minus-outline::before{content:"\F123B"}.mdi-flask-empty-off::before{content:"\F13F4"}.mdi-flask-empty-off-outline::before{content:"\F13F5"}.mdi-flask-empty-outline::before{content:"\F0095"}.mdi-flask-empty-plus::before{content:"\F123C"}.mdi-flask-empty-plus-outline::before{content:"\F123D"}.mdi-flask-empty-remove::before{content:"\F123E"}.mdi-flask-empty-remove-outline::before{content:"\F123F"}.mdi-flask-minus::before{content:"\F1240"}.mdi-flask-minus-outline::before{content:"\F1241"}.mdi-flask-off::before{content:"\F13F6"}.mdi-flask-off-outline::before{content:"\F13F7"}.mdi-flask-outline::before{content:"\F0096"}.mdi-flask-plus::before{content:"\F1242"}.mdi-flask-plus-outline::before{content:"\F1243"}.mdi-flask-remove::before{content:"\F1244"}.mdi-flask-remove-outline::before{content:"\F1245"}.mdi-flask-round-bottom::before{content:"\F124B"}.mdi-flask-round-bottom-empty::before{content:"\F124C"}.mdi-flask-round-bottom-empty-outline::before{content:"\F124D"}.mdi-flask-round-bottom-outline::before{content:"\F124E"}.mdi-fleur-de-lis::before{content:"\F1303"}.mdi-flip-horizontal::before{content:"\F10E7"}.mdi-flip-to-back::before{content:"\F0247"}.mdi-flip-to-front::before{content:"\F0248"}.mdi-flip-vertical::before{content:"\F10E8"}.mdi-floor-lamp::before{content:"\F08DD"}.mdi-floor-lamp-dual::before{content:"\F1040"}.mdi-floor-lamp-dual-outline::before{content:"\F17CE"}.mdi-floor-lamp-outline::before{content:"\F17C8"}.mdi-floor-lamp-torchiere::before{content:"\F1747"}.mdi-floor-lamp-torchiere-outline::before{content:"\F17D6"}.mdi-floor-lamp-torchiere-variant::before{content:"\F1041"}.mdi-floor-lamp-torchiere-variant-outline::before{content:"\F17CF"}.mdi-floor-plan::before{content:"\F0821"}.mdi-floppy::before{content:"\F0249"}.mdi-floppy-variant::before{content:"\F09EF"}.mdi-flower::before{content:"\F024A"}.mdi-flower-outline::before{content:"\F09F0"}.mdi-flower-pollen::before{content:"\F1885"}.mdi-flower-pollen-outline::before{content:"\F1886"}.mdi-flower-poppy::before{content:"\F0D08"}.mdi-flower-tulip::before{content:"\F09F1"}.mdi-flower-tulip-outline::before{content:"\F09F2"}.mdi-focus-auto::before{content:"\F0F4E"}.mdi-focus-field::before{content:"\F0F4F"}.mdi-focus-field-horizontal::before{content:"\F0F50"}.mdi-focus-field-vertical::before{content:"\F0F51"}.mdi-folder::before{content:"\F024B"}.mdi-folder-account::before{content:"\F024C"}.mdi-folder-account-outline::before{content:"\F0B9C"}.mdi-folder-alert::before{content:"\F0DCC"}.mdi-folder-alert-outline::before{content:"\F0DCD"}.mdi-folder-arrow-down::before{content:"\F19E8"}.mdi-folder-arrow-down-outline::before{content:"\F19E9"}.mdi-folder-arrow-left::before{content:"\F19EA"}.mdi-folder-arrow-left-outline::before{content:"\F19EB"}.mdi-folder-arrow-left-right::before{content:"\F19EC"}.mdi-folder-arrow-left-right-outline::before{content:"\F19ED"}.mdi-folder-arrow-right::before{content:"\F19EE"}.mdi-folder-arrow-right-outline::before{content:"\F19EF"}.mdi-folder-arrow-up::before{content:"\F19F0"}.mdi-folder-arrow-up-down::before{content:"\F19F1"}.mdi-folder-arrow-up-down-outline::before{content:"\F19F2"}.mdi-folder-arrow-up-outline::before{content:"\F19F3"}.mdi-folder-cancel::before{content:"\F19F4"}.mdi-folder-cancel-outline::before{content:"\F19F5"}.mdi-folder-check::before{content:"\F197E"}.mdi-folder-check-outline::before{content:"\F197F"}.mdi-folder-clock::before{content:"\F0ABA"}.mdi-folder-clock-outline::before{content:"\F0ABB"}.mdi-folder-cog::before{content:"\F107F"}.mdi-folder-cog-outline::before{content:"\F1080"}.mdi-folder-download::before{content:"\F024D"}.mdi-folder-download-outline::before{content:"\F10E9"}.mdi-folder-edit::before{content:"\F08DE"}.mdi-folder-edit-outline::before{content:"\F0DCE"}.mdi-folder-eye::before{content:"\F178A"}.mdi-folder-eye-outline::before{content:"\F178B"}.mdi-folder-file::before{content:"\F19F6"}.mdi-folder-file-outline::before{content:"\F19F7"}.mdi-folder-google-drive::before{content:"\F024E"}.mdi-folder-heart::before{content:"\F10EA"}.mdi-folder-heart-outline::before{content:"\F10EB"}.mdi-folder-hidden::before{content:"\F179E"}.mdi-folder-home::before{content:"\F10B5"}.mdi-folder-home-outline::before{content:"\F10B6"}.mdi-folder-image::before{content:"\F024F"}.mdi-folder-information::before{content:"\F10B7"}.mdi-folder-information-outline::before{content:"\F10B8"}.mdi-folder-key::before{content:"\F08AC"}.mdi-folder-key-network::before{content:"\F08AD"}.mdi-folder-key-network-outline::before{content:"\F0C80"}.mdi-folder-key-outline::before{content:"\F10EC"}.mdi-folder-lock::before{content:"\F0250"}.mdi-folder-lock-open::before{content:"\F0251"}.mdi-folder-lock-open-outline::before{content:"\F1AA7"}.mdi-folder-lock-outline::before{content:"\F1AA8"}.mdi-folder-marker::before{content:"\F126D"}.mdi-folder-marker-outline::before{content:"\F126E"}.mdi-folder-minus::before{content:"\F1B49"}.mdi-folder-minus-outline::before{content:"\F1B4A"}.mdi-folder-move::before{content:"\F0252"}.mdi-folder-move-outline::before{content:"\F1246"}.mdi-folder-multiple::before{content:"\F0253"}.mdi-folder-multiple-image::before{content:"\F0254"}.mdi-folder-multiple-outline::before{content:"\F0255"}.mdi-folder-multiple-plus::before{content:"\F147E"}.mdi-folder-multiple-plus-outline::before{content:"\F147F"}.mdi-folder-music::before{content:"\F1359"}.mdi-folder-music-outline::before{content:"\F135A"}.mdi-folder-network::before{content:"\F0870"}.mdi-folder-network-outline::before{content:"\F0C81"}.mdi-folder-off::before{content:"\F19F8"}.mdi-folder-off-outline::before{content:"\F19F9"}.mdi-folder-open::before{content:"\F0770"}.mdi-folder-open-outline::before{content:"\F0DCF"}.mdi-folder-outline::before{content:"\F0256"}.mdi-folder-play::before{content:"\F19FA"}.mdi-folder-play-outline::before{content:"\F19FB"}.mdi-folder-plus::before{content:"\F0257"}.mdi-folder-plus-outline::before{content:"\F0B9D"}.mdi-folder-pound::before{content:"\F0D09"}.mdi-folder-pound-outline::before{content:"\F0D0A"}.mdi-folder-question::before{content:"\F19CA"}.mdi-folder-question-outline::before{content:"\F19CB"}.mdi-folder-refresh::before{content:"\F0749"}.mdi-folder-refresh-outline::before{content:"\F0542"}.mdi-folder-remove::before{content:"\F0258"}.mdi-folder-remove-outline::before{content:"\F0B9E"}.mdi-folder-search::before{content:"\F0968"}.mdi-folder-search-outline::before{content:"\F0969"}.mdi-folder-settings::before{content:"\F107D"}.mdi-folder-settings-outline::before{content:"\F107E"}.mdi-folder-star::before{content:"\F069D"}.mdi-folder-star-multiple::before{content:"\F13D3"}.mdi-folder-star-multiple-outline::before{content:"\F13D4"}.mdi-folder-star-outline::before{content:"\F0B9F"}.mdi-folder-swap::before{content:"\F0FB6"}.mdi-folder-swap-outline::before{content:"\F0FB7"}.mdi-folder-sync::before{content:"\F0D0B"}.mdi-folder-sync-outline::before{content:"\F0D0C"}.mdi-folder-table::before{content:"\F12E3"}.mdi-folder-table-outline::before{content:"\F12E4"}.mdi-folder-text::before{content:"\F0C82"}.mdi-folder-text-outline::before{content:"\F0C83"}.mdi-folder-upload::before{content:"\F0259"}.mdi-folder-upload-outline::before{content:"\F10ED"}.mdi-folder-wrench::before{content:"\F19FC"}.mdi-folder-wrench-outline::before{content:"\F19FD"}.mdi-folder-zip::before{content:"\F06EB"}.mdi-folder-zip-outline::before{content:"\F07B9"}.mdi-font-awesome::before{content:"\F003A"}.mdi-food::before{content:"\F025A"}.mdi-food-apple::before{content:"\F025B"}.mdi-food-apple-outline::before{content:"\F0C84"}.mdi-food-croissant::before{content:"\F07C8"}.mdi-food-drumstick::before{content:"\F141F"}.mdi-food-drumstick-off::before{content:"\F1468"}.mdi-food-drumstick-off-outline::before{content:"\F1469"}.mdi-food-drumstick-outline::before{content:"\F1420"}.mdi-food-fork-drink::before{content:"\F05F2"}.mdi-food-halal::before{content:"\F1572"}.mdi-food-hot-dog::before{content:"\F184B"}.mdi-food-kosher::before{content:"\F1573"}.mdi-food-off::before{content:"\F05F3"}.mdi-food-off-outline::before{content:"\F1915"}.mdi-food-outline::before{content:"\F1916"}.mdi-food-steak::before{content:"\F146A"}.mdi-food-steak-off::before{content:"\F146B"}.mdi-food-takeout-box::before{content:"\F1836"}.mdi-food-takeout-box-outline::before{content:"\F1837"}.mdi-food-turkey::before{content:"\F171C"}.mdi-food-variant::before{content:"\F025C"}.mdi-food-variant-off::before{content:"\F13E5"}.mdi-foot-print::before{content:"\F0F52"}.mdi-football::before{content:"\F025D"}.mdi-football-australian::before{content:"\F025E"}.mdi-football-helmet::before{content:"\F025F"}.mdi-forest::before{content:"\F1897"}.mdi-forest-outline::before{content:"\F1C63"}.mdi-forklift::before{content:"\F07C9"}.mdi-form-dropdown::before{content:"\F1400"}.mdi-form-select::before{content:"\F1401"}.mdi-form-textarea::before{content:"\F1095"}.mdi-form-textbox::before{content:"\F060E"}.mdi-form-textbox-lock::before{content:"\F135D"}.mdi-form-textbox-password::before{content:"\F07F5"}.mdi-format-align-bottom::before{content:"\F0753"}.mdi-format-align-center::before{content:"\F0260"}.mdi-format-align-justify::before{content:"\F0261"}.mdi-format-align-left::before{content:"\F0262"}.mdi-format-align-middle::before{content:"\F0754"}.mdi-format-align-right::before{content:"\F0263"}.mdi-format-align-top::before{content:"\F0755"}.mdi-format-annotation-minus::before{content:"\F0ABC"}.mdi-format-annotation-plus::before{content:"\F0646"}.mdi-format-bold::before{content:"\F0264"}.mdi-format-clear::before{content:"\F0265"}.mdi-format-color-fill::before{content:"\F0266"}.mdi-format-color-highlight::before{content:"\F0E31"}.mdi-format-color-marker-cancel::before{content:"\F1313"}.mdi-format-color-text::before{content:"\F069E"}.mdi-format-columns::before{content:"\F08DF"}.mdi-format-float-center::before{content:"\F0267"}.mdi-format-float-left::before{content:"\F0268"}.mdi-format-float-none::before{content:"\F0269"}.mdi-format-float-right::before{content:"\F026A"}.mdi-format-font::before{content:"\F06D6"}.mdi-format-font-size-decrease::before{content:"\F09F3"}.mdi-format-font-size-increase::before{content:"\F09F4"}.mdi-format-header-1::before{content:"\F026B"}.mdi-format-header-2::before{content:"\F026C"}.mdi-format-header-3::before{content:"\F026D"}.mdi-format-header-4::before{content:"\F026E"}.mdi-format-header-5::before{content:"\F026F"}.mdi-format-header-6::before{content:"\F0270"}.mdi-format-header-decrease::before{content:"\F0271"}.mdi-format-header-equal::before{content:"\F0272"}.mdi-format-header-increase::before{content:"\F0273"}.mdi-format-header-pound::before{content:"\F0274"}.mdi-format-horizontal-align-center::before{content:"\F061E"}.mdi-format-horizontal-align-left::before{content:"\F061F"}.mdi-format-horizontal-align-right::before{content:"\F0620"}.mdi-format-indent-decrease::before{content:"\F0275"}.mdi-format-indent-increase::before{content:"\F0276"}.mdi-format-italic::before{content:"\F0277"}.mdi-format-letter-case::before{content:"\F0B34"}.mdi-format-letter-case-lower::before{content:"\F0B35"}.mdi-format-letter-case-upper::before{content:"\F0B36"}.mdi-format-letter-ends-with::before{content:"\F0FB8"}.mdi-format-letter-matches::before{content:"\F0FB9"}.mdi-format-letter-spacing::before{content:"\F1956"}.mdi-format-letter-spacing-variant::before{content:"\F1AFB"}.mdi-format-letter-starts-with::before{content:"\F0FBA"}.mdi-format-line-height::before{content:"\F1AFC"}.mdi-format-line-spacing::before{content:"\F0278"}.mdi-format-line-style::before{content:"\F05C8"}.mdi-format-line-weight::before{content:"\F05C9"}.mdi-format-list-bulleted::before{content:"\F0279"}.mdi-format-list-bulleted-square::before{content:"\F0DD0"}.mdi-format-list-bulleted-triangle::before{content:"\F0EB2"}.mdi-format-list-bulleted-type::before{content:"\F027A"}.mdi-format-list-checkbox::before{content:"\F096A"}.mdi-format-list-checks::before{content:"\F0756"}.mdi-format-list-group::before{content:"\F1860"}.mdi-format-list-group-plus::before{content:"\F1B56"}.mdi-format-list-numbered::before{content:"\F027B"}.mdi-format-list-numbered-rtl::before{content:"\F0D0D"}.mdi-format-list-text::before{content:"\F126F"}.mdi-format-overline::before{content:"\F0EB3"}.mdi-format-page-break::before{content:"\F06D7"}.mdi-format-page-split::before{content:"\F1917"}.mdi-format-paint::before{content:"\F027C"}.mdi-format-paragraph::before{content:"\F027D"}.mdi-format-paragraph-spacing::before{content:"\F1AFD"}.mdi-format-pilcrow::before{content:"\F06D8"}.mdi-format-pilcrow-arrow-left::before{content:"\F0286"}.mdi-format-pilcrow-arrow-right::before{content:"\F0285"}.mdi-format-quote-close::before{content:"\F027E"}.mdi-format-quote-close-outline::before{content:"\F11A8"}.mdi-format-quote-open::before{content:"\F0757"}.mdi-format-quote-open-outline::before{content:"\F11A7"}.mdi-format-rotate-90::before{content:"\F06AA"}.mdi-format-section::before{content:"\F069F"}.mdi-format-size::before{content:"\F027F"}.mdi-format-strikethrough::before{content:"\F0280"}.mdi-format-strikethrough-variant::before{content:"\F0281"}.mdi-format-subscript::before{content:"\F0282"}.mdi-format-superscript::before{content:"\F0283"}.mdi-format-text::before{content:"\F0284"}.mdi-format-text-rotation-angle-down::before{content:"\F0FBB"}.mdi-format-text-rotation-angle-up::before{content:"\F0FBC"}.mdi-format-text-rotation-down::before{content:"\F0D73"}.mdi-format-text-rotation-down-vertical::before{content:"\F0FBD"}.mdi-format-text-rotation-none::before{content:"\F0D74"}.mdi-format-text-rotation-up::before{content:"\F0FBE"}.mdi-format-text-rotation-vertical::before{content:"\F0FBF"}.mdi-format-text-variant::before{content:"\F0E32"}.mdi-format-text-variant-outline::before{content:"\F150F"}.mdi-format-text-wrapping-clip::before{content:"\F0D0E"}.mdi-format-text-wrapping-overflow::before{content:"\F0D0F"}.mdi-format-text-wrapping-wrap::before{content:"\F0D10"}.mdi-format-textbox::before{content:"\F0D11"}.mdi-format-title::before{content:"\F05F4"}.mdi-format-underline::before{content:"\F0287"}.mdi-format-underline-wavy::before{content:"\F18E9"}.mdi-format-vertical-align-bottom::before{content:"\F0621"}.mdi-format-vertical-align-center::before{content:"\F0622"}.mdi-format-vertical-align-top::before{content:"\F0623"}.mdi-format-wrap-inline::before{content:"\F0288"}.mdi-format-wrap-square::before{content:"\F0289"}.mdi-format-wrap-tight::before{content:"\F028A"}.mdi-format-wrap-top-bottom::before{content:"\F028B"}.mdi-forum::before{content:"\F028C"}.mdi-forum-minus::before{content:"\F1AA9"}.mdi-forum-minus-outline::before{content:"\F1AAA"}.mdi-forum-outline::before{content:"\F0822"}.mdi-forum-plus::before{content:"\F1AAB"}.mdi-forum-plus-outline::before{content:"\F1AAC"}.mdi-forum-remove::before{content:"\F1AAD"}.mdi-forum-remove-outline::before{content:"\F1AAE"}.mdi-forward::before{content:"\F028D"}.mdi-forwardburger::before{content:"\F0D75"}.mdi-fountain::before{content:"\F096B"}.mdi-fountain-pen::before{content:"\F0D12"}.mdi-fountain-pen-tip::before{content:"\F0D13"}.mdi-fraction-one-half::before{content:"\F1992"}.mdi-freebsd::before{content:"\F08E0"}.mdi-french-fries::before{content:"\F1957"}.mdi-frequently-asked-questions::before{content:"\F0EB4"}.mdi-fridge::before{content:"\F0290"}.mdi-fridge-alert::before{content:"\F11B1"}.mdi-fridge-alert-outline::before{content:"\F11B2"}.mdi-fridge-bottom::before{content:"\F0292"}.mdi-fridge-industrial::before{content:"\F15EE"}.mdi-fridge-industrial-alert::before{content:"\F15EF"}.mdi-fridge-industrial-alert-outline::before{content:"\F15F0"}.mdi-fridge-industrial-off::before{content:"\F15F1"}.mdi-fridge-industrial-off-outline::before{content:"\F15F2"}.mdi-fridge-industrial-outline::before{content:"\F15F3"}.mdi-fridge-off::before{content:"\F11AF"}.mdi-fridge-off-outline::before{content:"\F11B0"}.mdi-fridge-outline::before{content:"\F028F"}.mdi-fridge-top::before{content:"\F0291"}.mdi-fridge-variant::before{content:"\F15F4"}.mdi-fridge-variant-alert::before{content:"\F15F5"}.mdi-fridge-variant-alert-outline::before{content:"\F15F6"}.mdi-fridge-variant-off::before{content:"\F15F7"}.mdi-fridge-variant-off-outline::before{content:"\F15F8"}.mdi-fridge-variant-outline::before{content:"\F15F9"}.mdi-fruit-cherries::before{content:"\F1042"}.mdi-fruit-cherries-off::before{content:"\F13F8"}.mdi-fruit-citrus::before{content:"\F1043"}.mdi-fruit-citrus-off::before{content:"\F13F9"}.mdi-fruit-grapes::before{content:"\F1044"}.mdi-fruit-grapes-outline::before{content:"\F1045"}.mdi-fruit-pear::before{content:"\F1A0E"}.mdi-fruit-pineapple::before{content:"\F1046"}.mdi-fruit-watermelon::before{content:"\F1047"}.mdi-fuel::before{content:"\F07CA"}.mdi-fuel-cell::before{content:"\F18B5"}.mdi-fullscreen::before{content:"\F0293"}.mdi-fullscreen-exit::before{content:"\F0294"}.mdi-function::before{content:"\F0295"}.mdi-function-variant::before{content:"\F0871"}.mdi-furigana-horizontal::before{content:"\F1081"}.mdi-furigana-vertical::before{content:"\F1082"}.mdi-fuse::before{content:"\F0C85"}.mdi-fuse-alert::before{content:"\F142D"}.mdi-fuse-blade::before{content:"\F0C86"}.mdi-fuse-off::before{content:"\F142C"}.mdi-gamepad::before{content:"\F0296"}.mdi-gamepad-circle::before{content:"\F0E33"}.mdi-gamepad-circle-down::before{content:"\F0E34"}.mdi-gamepad-circle-left::before{content:"\F0E35"}.mdi-gamepad-circle-outline::before{content:"\F0E36"}.mdi-gamepad-circle-right::before{content:"\F0E37"}.mdi-gamepad-circle-up::before{content:"\F0E38"}.mdi-gamepad-down::before{content:"\F0E39"}.mdi-gamepad-left::before{content:"\F0E3A"}.mdi-gamepad-outline::before{content:"\F1919"}.mdi-gamepad-right::before{content:"\F0E3B"}.mdi-gamepad-round::before{content:"\F0E3C"}.mdi-gamepad-round-down::before{content:"\F0E3D"}.mdi-gamepad-round-left::before{content:"\F0E3E"}.mdi-gamepad-round-outline::before{content:"\F0E3F"}.mdi-gamepad-round-right::before{content:"\F0E40"}.mdi-gamepad-round-up::before{content:"\F0E41"}.mdi-gamepad-square::before{content:"\F0EB5"}.mdi-gamepad-square-outline::before{content:"\F0EB6"}.mdi-gamepad-up::before{content:"\F0E42"}.mdi-gamepad-variant::before{content:"\F0297"}.mdi-gamepad-variant-outline::before{content:"\F0EB7"}.mdi-gamma::before{content:"\F10EE"}.mdi-gantry-crane::before{content:"\F0DD1"}.mdi-garage::before{content:"\F06D9"}.mdi-garage-alert::before{content:"\F0872"}.mdi-garage-alert-variant::before{content:"\F12D5"}.mdi-garage-lock::before{content:"\F17FB"}.mdi-garage-open::before{content:"\F06DA"}.mdi-garage-open-variant::before{content:"\F12D4"}.mdi-garage-variant::before{content:"\F12D3"}.mdi-garage-variant-lock::before{content:"\F17FC"}.mdi-gas-burner::before{content:"\F1A1B"}.mdi-gas-cylinder::before{content:"\F0647"}.mdi-gas-station::before{content:"\F0298"}.mdi-gas-station-in-use::before{content:"\F1CC4"}.mdi-gas-station-in-use-outline::before{content:"\F1CC5"}.mdi-gas-station-off::before{content:"\F1409"}.mdi-gas-station-off-outline::before{content:"\F140A"}.mdi-gas-station-outline::before{content:"\F0EB8"}.mdi-gate::before{content:"\F0299"}.mdi-gate-alert::before{content:"\F17F8"}.mdi-gate-and::before{content:"\F08E1"}.mdi-gate-arrow-left::before{content:"\F17F7"}.mdi-gate-arrow-right::before{content:"\F1169"}.mdi-gate-buffer::before{content:"\F1AFE"}.mdi-gate-nand::before{content:"\F08E2"}.mdi-gate-nor::before{content:"\F08E3"}.mdi-gate-not::before{content:"\F08E4"}.mdi-gate-open::before{content:"\F116A"}.mdi-gate-or::before{content:"\F08E5"}.mdi-gate-xnor::before{content:"\F08E6"}.mdi-gate-xor::before{content:"\F08E7"}.mdi-gatsby::before{content:"\F0E43"}.mdi-gauge::before{content:"\F029A"}.mdi-gauge-empty::before{content:"\F0873"}.mdi-gauge-full::before{content:"\F0874"}.mdi-gauge-low::before{content:"\F0875"}.mdi-gavel::before{content:"\F029B"}.mdi-gender-female::before{content:"\F029C"}.mdi-gender-male::before{content:"\F029D"}.mdi-gender-male-female::before{content:"\F029E"}.mdi-gender-male-female-variant::before{content:"\F113F"}.mdi-gender-non-binary::before{content:"\F1140"}.mdi-gender-transgender::before{content:"\F029F"}.mdi-generator-mobile::before{content:"\F1C8A"}.mdi-generator-portable::before{content:"\F1C8B"}.mdi-generator-stationary::before{content:"\F1C8C"}.mdi-gentoo::before{content:"\F08E8"}.mdi-gesture::before{content:"\F07CB"}.mdi-gesture-double-tap::before{content:"\F073C"}.mdi-gesture-pinch::before{content:"\F0ABD"}.mdi-gesture-spread::before{content:"\F0ABE"}.mdi-gesture-swipe::before{content:"\F0D76"}.mdi-gesture-swipe-down::before{content:"\F073D"}.mdi-gesture-swipe-horizontal::before{content:"\F0ABF"}.mdi-gesture-swipe-left::before{content:"\F073E"}.mdi-gesture-swipe-right::before{content:"\F073F"}.mdi-gesture-swipe-up::before{content:"\F0740"}.mdi-gesture-swipe-vertical::before{content:"\F0AC0"}.mdi-gesture-tap::before{content:"\F0741"}.mdi-gesture-tap-box::before{content:"\F12A9"}.mdi-gesture-tap-button::before{content:"\F12A8"}.mdi-gesture-tap-hold::before{content:"\F0D77"}.mdi-gesture-two-double-tap::before{content:"\F0742"}.mdi-gesture-two-tap::before{content:"\F0743"}.mdi-ghost::before{content:"\F02A0"}.mdi-ghost-off::before{content:"\F09F5"}.mdi-ghost-off-outline::before{content:"\F165C"}.mdi-ghost-outline::before{content:"\F165D"}.mdi-gift::before{content:"\F0E44"}.mdi-gift-off::before{content:"\F16EF"}.mdi-gift-off-outline::before{content:"\F16F0"}.mdi-gift-open::before{content:"\F16F1"}.mdi-gift-open-outline::before{content:"\F16F2"}.mdi-gift-outline::before{content:"\F02A1"}.mdi-git::before{content:"\F02A2"}.mdi-github::before{content:"\F02A4"}.mdi-gitlab::before{content:"\F0BA0"}.mdi-glass-cocktail::before{content:"\F0356"}.mdi-glass-cocktail-off::before{content:"\F15E6"}.mdi-glass-flute::before{content:"\F02A5"}.mdi-glass-fragile::before{content:"\F1873"}.mdi-glass-mug::before{content:"\F02A6"}.mdi-glass-mug-off::before{content:"\F15E7"}.mdi-glass-mug-variant::before{content:"\F1116"}.mdi-glass-mug-variant-off::before{content:"\F15E8"}.mdi-glass-pint-outline::before{content:"\F130D"}.mdi-glass-stange::before{content:"\F02A7"}.mdi-glass-tulip::before{content:"\F02A8"}.mdi-glass-wine::before{content:"\F0876"}.mdi-glasses::before{content:"\F02AA"}.mdi-globe-light::before{content:"\F066F"}.mdi-globe-light-outline::before{content:"\F12D7"}.mdi-globe-model::before{content:"\F08E9"}.mdi-gmail::before{content:"\F02AB"}.mdi-gnome::before{content:"\F02AC"}.mdi-go-kart::before{content:"\F0D79"}.mdi-go-kart-track::before{content:"\F0D7A"}.mdi-gog::before{content:"\F0BA1"}.mdi-gold::before{content:"\F124F"}.mdi-golf::before{content:"\F0823"}.mdi-golf-cart::before{content:"\F11A4"}.mdi-golf-tee::before{content:"\F1083"}.mdi-gondola::before{content:"\F0686"}.mdi-goodreads::before{content:"\F0D7B"}.mdi-google::before{content:"\F02AD"}.mdi-google-ads::before{content:"\F0C87"}.mdi-google-analytics::before{content:"\F07CC"}.mdi-google-assistant::before{content:"\F07CD"}.mdi-google-cardboard::before{content:"\F02AE"}.mdi-google-chrome::before{content:"\F02AF"}.mdi-google-circles::before{content:"\F02B0"}.mdi-google-circles-communities::before{content:"\F02B1"}.mdi-google-circles-extended::before{content:"\F02B2"}.mdi-google-circles-group::before{content:"\F02B3"}.mdi-google-classroom::before{content:"\F02C0"}.mdi-google-cloud::before{content:"\F11F6"}.mdi-google-downasaur::before{content:"\F1362"}.mdi-google-drive::before{content:"\F02B6"}.mdi-google-earth::before{content:"\F02B7"}.mdi-google-fit::before{content:"\F096C"}.mdi-google-glass::before{content:"\F02B8"}.mdi-google-hangouts::before{content:"\F02C9"}.mdi-google-keep::before{content:"\F06DC"}.mdi-google-lens::before{content:"\F09F6"}.mdi-google-maps::before{content:"\F05F5"}.mdi-google-my-business::before{content:"\F1048"}.mdi-google-nearby::before{content:"\F02B9"}.mdi-google-play::before{content:"\F02BC"}.mdi-google-plus::before{content:"\F02BD"}.mdi-google-podcast::before{content:"\F0EB9"}.mdi-google-spreadsheet::before{content:"\F09F7"}.mdi-google-street-view::before{content:"\F0C88"}.mdi-google-translate::before{content:"\F02BF"}.mdi-gradient-horizontal::before{content:"\F174A"}.mdi-gradient-vertical::before{content:"\F06A0"}.mdi-grain::before{content:"\F0D7C"}.mdi-graph::before{content:"\F1049"}.mdi-graph-outline::before{content:"\F104A"}.mdi-graphql::before{content:"\F0877"}.mdi-grass::before{content:"\F1510"}.mdi-grave-stone::before{content:"\F0BA2"}.mdi-grease-pencil::before{content:"\F0648"}.mdi-greater-than::before{content:"\F096D"}.mdi-greater-than-or-equal::before{content:"\F096E"}.mdi-greenhouse::before{content:"\F002D"}.mdi-grid::before{content:"\F02C1"}.mdi-grid-large::before{content:"\F0758"}.mdi-grid-off::before{content:"\F02C2"}.mdi-grill::before{content:"\F0E45"}.mdi-grill-outline::before{content:"\F118A"}.mdi-group::before{content:"\F02C3"}.mdi-guitar-acoustic::before{content:"\F0771"}.mdi-guitar-electric::before{content:"\F02C4"}.mdi-guitar-pick::before{content:"\F02C5"}.mdi-guitar-pick-outline::before{content:"\F02C6"}.mdi-guy-fawkes-mask::before{content:"\F0825"}.mdi-gymnastics::before{content:"\F1A41"}.mdi-hail::before{content:"\F0AC1"}.mdi-hair-dryer::before{content:"\F10EF"}.mdi-hair-dryer-outline::before{content:"\F10F0"}.mdi-halloween::before{content:"\F0BA3"}.mdi-hamburger::before{content:"\F0685"}.mdi-hamburger-check::before{content:"\F1776"}.mdi-hamburger-minus::before{content:"\F1777"}.mdi-hamburger-off::before{content:"\F1778"}.mdi-hamburger-plus::before{content:"\F1779"}.mdi-hamburger-remove::before{content:"\F177A"}.mdi-hammer::before{content:"\F08EA"}.mdi-hammer-screwdriver::before{content:"\F1322"}.mdi-hammer-sickle::before{content:"\F1887"}.mdi-hammer-wrench::before{content:"\F1323"}.mdi-hand-back-left::before{content:"\F0E46"}.mdi-hand-back-left-off::before{content:"\F1830"}.mdi-hand-back-left-off-outline::before{content:"\F1832"}.mdi-hand-back-left-outline::before{content:"\F182C"}.mdi-hand-back-right::before{content:"\F0E47"}.mdi-hand-back-right-off::before{content:"\F1831"}.mdi-hand-back-right-off-outline::before{content:"\F1833"}.mdi-hand-back-right-outline::before{content:"\F182D"}.mdi-hand-clap::before{content:"\F194B"}.mdi-hand-clap-off::before{content:"\F1A42"}.mdi-hand-coin::before{content:"\F188F"}.mdi-hand-coin-outline::before{content:"\F1890"}.mdi-hand-cycle::before{content:"\F1B9C"}.mdi-hand-extended::before{content:"\F18B6"}.mdi-hand-extended-outline::before{content:"\F18B7"}.mdi-hand-front-left::before{content:"\F182B"}.mdi-hand-front-left-outline::before{content:"\F182E"}.mdi-hand-front-right::before{content:"\F0A4F"}.mdi-hand-front-right-outline::before{content:"\F182F"}.mdi-hand-heart::before{content:"\F10F1"}.mdi-hand-heart-outline::before{content:"\F157E"}.mdi-hand-okay::before{content:"\F0A50"}.mdi-hand-peace::before{content:"\F0A51"}.mdi-hand-peace-variant::before{content:"\F0A52"}.mdi-hand-pointing-down::before{content:"\F0A53"}.mdi-hand-pointing-left::before{content:"\F0A54"}.mdi-hand-pointing-right::before{content:"\F02C7"}.mdi-hand-pointing-up::before{content:"\F0A55"}.mdi-hand-saw::before{content:"\F0E48"}.mdi-hand-wash::before{content:"\F157F"}.mdi-hand-wash-outline::before{content:"\F1580"}.mdi-hand-water::before{content:"\F139F"}.mdi-hand-wave::before{content:"\F1821"}.mdi-hand-wave-outline::before{content:"\F1822"}.mdi-handball::before{content:"\F0F53"}.mdi-handcuffs::before{content:"\F113E"}.mdi-hands-pray::before{content:"\F0579"}.mdi-handshake::before{content:"\F1218"}.mdi-handshake-outline::before{content:"\F15A1"}.mdi-hanger::before{content:"\F02C8"}.mdi-hard-hat::before{content:"\F096F"}.mdi-harddisk::before{content:"\F02CA"}.mdi-harddisk-plus::before{content:"\F104B"}.mdi-harddisk-remove::before{content:"\F104C"}.mdi-hat-fedora::before{content:"\F0BA4"}.mdi-hazard-lights::before{content:"\F0C89"}.mdi-hdmi-port::before{content:"\F1BB8"}.mdi-hdr::before{content:"\F0D7D"}.mdi-hdr-off::before{content:"\F0D7E"}.mdi-head::before{content:"\F135E"}.mdi-head-alert::before{content:"\F1338"}.mdi-head-alert-outline::before{content:"\F1339"}.mdi-head-check::before{content:"\F133A"}.mdi-head-check-outline::before{content:"\F133B"}.mdi-head-cog::before{content:"\F133C"}.mdi-head-cog-outline::before{content:"\F133D"}.mdi-head-dots-horizontal::before{content:"\F133E"}.mdi-head-dots-horizontal-outline::before{content:"\F133F"}.mdi-head-flash::before{content:"\F1340"}.mdi-head-flash-outline::before{content:"\F1341"}.mdi-head-heart::before{content:"\F1342"}.mdi-head-heart-outline::before{content:"\F1343"}.mdi-head-lightbulb::before{content:"\F1344"}.mdi-head-lightbulb-outline::before{content:"\F1345"}.mdi-head-minus::before{content:"\F1346"}.mdi-head-minus-outline::before{content:"\F1347"}.mdi-head-outline::before{content:"\F135F"}.mdi-head-plus::before{content:"\F1348"}.mdi-head-plus-outline::before{content:"\F1349"}.mdi-head-question::before{content:"\F134A"}.mdi-head-question-outline::before{content:"\F134B"}.mdi-head-remove::before{content:"\F134C"}.mdi-head-remove-outline::before{content:"\F134D"}.mdi-head-snowflake::before{content:"\F134E"}.mdi-head-snowflake-outline::before{content:"\F134F"}.mdi-head-sync::before{content:"\F1350"}.mdi-head-sync-outline::before{content:"\F1351"}.mdi-headphones::before{content:"\F02CB"}.mdi-headphones-bluetooth::before{content:"\F0970"}.mdi-headphones-box::before{content:"\F02CC"}.mdi-headphones-off::before{content:"\F07CE"}.mdi-headphones-settings::before{content:"\F02CD"}.mdi-headset::before{content:"\F02CE"}.mdi-headset-dock::before{content:"\F02CF"}.mdi-headset-off::before{content:"\F02D0"}.mdi-heart::before{content:"\F02D1"}.mdi-heart-box::before{content:"\F02D2"}.mdi-heart-box-outline::before{content:"\F02D3"}.mdi-heart-broken::before{content:"\F02D4"}.mdi-heart-broken-outline::before{content:"\F0D14"}.mdi-heart-circle::before{content:"\F0971"}.mdi-heart-circle-outline::before{content:"\F0972"}.mdi-heart-cog::before{content:"\F1663"}.mdi-heart-cog-outline::before{content:"\F1664"}.mdi-heart-flash::before{content:"\F0EF9"}.mdi-heart-half::before{content:"\F06DF"}.mdi-heart-half-full::before{content:"\F06DE"}.mdi-heart-half-outline::before{content:"\F06E0"}.mdi-heart-minus::before{content:"\F142F"}.mdi-heart-minus-outline::before{content:"\F1432"}.mdi-heart-multiple::before{content:"\F0A56"}.mdi-heart-multiple-outline::before{content:"\F0A57"}.mdi-heart-off::before{content:"\F0759"}.mdi-heart-off-outline::before{content:"\F1434"}.mdi-heart-outline::before{content:"\F02D5"}.mdi-heart-plus::before{content:"\F142E"}.mdi-heart-plus-outline::before{content:"\F1431"}.mdi-heart-pulse::before{content:"\F05F6"}.mdi-heart-remove::before{content:"\F1430"}.mdi-heart-remove-outline::before{content:"\F1433"}.mdi-heart-search::before{content:"\F1C8D"}.mdi-heart-settings::before{content:"\F1665"}.mdi-heart-settings-outline::before{content:"\F1666"}.mdi-heat-pump::before{content:"\F1A43"}.mdi-heat-pump-outline::before{content:"\F1A44"}.mdi-heat-wave::before{content:"\F1A45"}.mdi-heating-coil::before{content:"\F1AAF"}.mdi-helicopter::before{content:"\F0AC2"}.mdi-help::before{content:"\F02D6"}.mdi-help-box::before{content:"\F078B"}.mdi-help-box-multiple::before{content:"\F1C0A"}.mdi-help-box-multiple-outline::before{content:"\F1C0B"}.mdi-help-box-outline::before{content:"\F1C0C"}.mdi-help-circle::before{content:"\F02D7"}.mdi-help-circle-outline::before{content:"\F0625"}.mdi-help-network::before{content:"\F06F5"}.mdi-help-network-outline::before{content:"\F0C8A"}.mdi-help-rhombus::before{content:"\F0BA5"}.mdi-help-rhombus-outline::before{content:"\F0BA6"}.mdi-hexadecimal::before{content:"\F12A7"}.mdi-hexagon::before{content:"\F02D8"}.mdi-hexagon-multiple::before{content:"\F06E1"}.mdi-hexagon-multiple-outline::before{content:"\F10F2"}.mdi-hexagon-outline::before{content:"\F02D9"}.mdi-hexagon-slice-1::before{content:"\F0AC3"}.mdi-hexagon-slice-2::before{content:"\F0AC4"}.mdi-hexagon-slice-3::before{content:"\F0AC5"}.mdi-hexagon-slice-4::before{content:"\F0AC6"}.mdi-hexagon-slice-5::before{content:"\F0AC7"}.mdi-hexagon-slice-6::before{content:"\F0AC8"}.mdi-hexagram::before{content:"\F0AC9"}.mdi-hexagram-outline::before{content:"\F0ACA"}.mdi-high-definition::before{content:"\F07CF"}.mdi-high-definition-box::before{content:"\F0878"}.mdi-highway::before{content:"\F05F7"}.mdi-hiking::before{content:"\F0D7F"}.mdi-history::before{content:"\F02DA"}.mdi-hockey-puck::before{content:"\F0879"}.mdi-hockey-sticks::before{content:"\F087A"}.mdi-hololens::before{content:"\F02DB"}.mdi-home::before{content:"\F02DC"}.mdi-home-account::before{content:"\F0826"}.mdi-home-alert::before{content:"\F087B"}.mdi-home-alert-outline::before{content:"\F15D0"}.mdi-home-analytics::before{content:"\F0EBA"}.mdi-home-assistant::before{content:"\F07D0"}.mdi-home-automation::before{content:"\F07D1"}.mdi-home-battery::before{content:"\F1901"}.mdi-home-battery-outline::before{content:"\F1902"}.mdi-home-circle::before{content:"\F07D2"}.mdi-home-circle-outline::before{content:"\F104D"}.mdi-home-city::before{content:"\F0D15"}.mdi-home-city-outline::before{content:"\F0D16"}.mdi-home-clock::before{content:"\F1A12"}.mdi-home-clock-outline::before{content:"\F1A13"}.mdi-home-edit::before{content:"\F1159"}.mdi-home-edit-outline::before{content:"\F115A"}.mdi-home-export-outline::before{content:"\F0F9B"}.mdi-home-flood::before{content:"\F0EFA"}.mdi-home-floor-0::before{content:"\F0DD2"}.mdi-home-floor-1::before{content:"\F0D80"}.mdi-home-floor-2::before{content:"\F0D81"}.mdi-home-floor-3::before{content:"\F0D82"}.mdi-home-floor-a::before{content:"\F0D83"}.mdi-home-floor-b::before{content:"\F0D84"}.mdi-home-floor-g::before{content:"\F0D85"}.mdi-home-floor-l::before{content:"\F0D86"}.mdi-home-floor-negative-1::before{content:"\F0DD3"}.mdi-home-group::before{content:"\F0DD4"}.mdi-home-group-minus::before{content:"\F19C1"}.mdi-home-group-plus::before{content:"\F19C0"}.mdi-home-group-remove::before{content:"\F19C2"}.mdi-home-heart::before{content:"\F0827"}.mdi-home-import-outline::before{content:"\F0F9C"}.mdi-home-lightbulb::before{content:"\F1251"}.mdi-home-lightbulb-outline::before{content:"\F1252"}.mdi-home-lightning-bolt::before{content:"\F1903"}.mdi-home-lightning-bolt-outline::before{content:"\F1904"}.mdi-home-lock::before{content:"\F08EB"}.mdi-home-lock-open::before{content:"\F08EC"}.mdi-home-map-marker::before{content:"\F05F8"}.mdi-home-minus::before{content:"\F0974"}.mdi-home-minus-outline::before{content:"\F13D5"}.mdi-home-modern::before{content:"\F02DD"}.mdi-home-off::before{content:"\F1A46"}.mdi-home-off-outline::before{content:"\F1A47"}.mdi-home-outline::before{content:"\F06A1"}.mdi-home-percent::before{content:"\F1C7C"}.mdi-home-percent-outline::before{content:"\F1C7D"}.mdi-home-plus::before{content:"\F0975"}.mdi-home-plus-outline::before{content:"\F13D6"}.mdi-home-remove::before{content:"\F1247"}.mdi-home-remove-outline::before{content:"\F13D7"}.mdi-home-roof::before{content:"\F112B"}.mdi-home-search::before{content:"\F13B0"}.mdi-home-search-outline::before{content:"\F13B1"}.mdi-home-silo::before{content:"\F1BA0"}.mdi-home-silo-outline::before{content:"\F1BA1"}.mdi-home-sound-in::before{content:"\F1C2F"}.mdi-home-sound-in-outline::before{content:"\F1C30"}.mdi-home-sound-out::before{content:"\F1C31"}.mdi-home-sound-out-outline::before{content:"\F1C32"}.mdi-home-switch::before{content:"\F1794"}.mdi-home-switch-outline::before{content:"\F1795"}.mdi-home-thermometer::before{content:"\F0F54"}.mdi-home-thermometer-outline::before{content:"\F0F55"}.mdi-home-variant::before{content:"\F02DE"}.mdi-home-variant-outline::before{content:"\F0BA7"}.mdi-hook::before{content:"\F06E2"}.mdi-hook-off::before{content:"\F06E3"}.mdi-hoop-house::before{content:"\F0E56"}.mdi-hops::before{content:"\F02DF"}.mdi-horizontal-rotate-clockwise::before{content:"\F10F3"}.mdi-horizontal-rotate-counterclockwise::before{content:"\F10F4"}.mdi-horse::before{content:"\F15BF"}.mdi-horse-human::before{content:"\F15C0"}.mdi-horse-variant::before{content:"\F15C1"}.mdi-horse-variant-fast::before{content:"\F186E"}.mdi-horseshoe::before{content:"\F0A58"}.mdi-hospital::before{content:"\F0FF6"}.mdi-hospital-box::before{content:"\F02E0"}.mdi-hospital-box-outline::before{content:"\F0FF7"}.mdi-hospital-building::before{content:"\F02E1"}.mdi-hospital-marker::before{content:"\F02E2"}.mdi-hot-tub::before{content:"\F0828"}.mdi-hours-12::before{content:"\F1C94"}.mdi-hours-24::before{content:"\F1478"}.mdi-hub::before{content:"\F1C95"}.mdi-hub-outline::before{content:"\F1C96"}.mdi-hubspot::before{content:"\F0D17"}.mdi-hulu::before{content:"\F0829"}.mdi-human::before{content:"\F02E6"}.mdi-human-baby-changing-table::before{content:"\F138B"}.mdi-human-cane::before{content:"\F1581"}.mdi-human-capacity-decrease::before{content:"\F159B"}.mdi-human-capacity-increase::before{content:"\F159C"}.mdi-human-child::before{content:"\F02E7"}.mdi-human-dolly::before{content:"\F1980"}.mdi-human-edit::before{content:"\F14E8"}.mdi-human-female::before{content:"\F0649"}.mdi-human-female-boy::before{content:"\F0A59"}.mdi-human-female-dance::before{content:"\F15C9"}.mdi-human-female-female::before{content:"\F0A5A"}.mdi-human-female-female-child::before{content:"\F1C8E"}.mdi-human-female-girl::before{content:"\F0A5B"}.mdi-human-greeting::before{content:"\F17C4"}.mdi-human-greeting-proximity::before{content:"\F159D"}.mdi-human-greeting-variant::before{content:"\F064A"}.mdi-human-handsdown::before{content:"\F064B"}.mdi-human-handsup::before{content:"\F064C"}.mdi-human-male::before{content:"\F064D"}.mdi-human-male-board::before{content:"\F0890"}.mdi-human-male-board-poll::before{content:"\F0846"}.mdi-human-male-boy::before{content:"\F0A5C"}.mdi-human-male-child::before{content:"\F138C"}.mdi-human-male-female::before{content:"\F02E8"}.mdi-human-male-female-child::before{content:"\F1823"}.mdi-human-male-girl::before{content:"\F0A5D"}.mdi-human-male-height::before{content:"\F0EFB"}.mdi-human-male-height-variant::before{content:"\F0EFC"}.mdi-human-male-male::before{content:"\F0A5E"}.mdi-human-male-male-child::before{content:"\F1C8F"}.mdi-human-non-binary::before{content:"\F1848"}.mdi-human-pregnant::before{content:"\F05CF"}.mdi-human-queue::before{content:"\F1571"}.mdi-human-scooter::before{content:"\F11E9"}.mdi-human-walker::before{content:"\F1B71"}.mdi-human-wheelchair::before{content:"\F138D"}.mdi-human-white-cane::before{content:"\F1981"}.mdi-humble-bundle::before{content:"\F0744"}.mdi-hvac::before{content:"\F1352"}.mdi-hvac-off::before{content:"\F159E"}.mdi-hydraulic-oil-level::before{content:"\F1324"}.mdi-hydraulic-oil-temperature::before{content:"\F1325"}.mdi-hydro-power::before{content:"\F12E5"}.mdi-hydrogen-station::before{content:"\F1894"}.mdi-ice-cream::before{content:"\F082A"}.mdi-ice-cream-off::before{content:"\F0E52"}.mdi-ice-pop::before{content:"\F0EFD"}.mdi-id-card::before{content:"\F0FC0"}.mdi-identifier::before{content:"\F0EFE"}.mdi-ideogram-cjk::before{content:"\F1331"}.mdi-ideogram-cjk-variant::before{content:"\F1332"}.mdi-image::before{content:"\F02E9"}.mdi-image-album::before{content:"\F02EA"}.mdi-image-area::before{content:"\F02EB"}.mdi-image-area-close::before{content:"\F02EC"}.mdi-image-auto-adjust::before{content:"\F0FC1"}.mdi-image-broken::before{content:"\F02ED"}.mdi-image-broken-variant::before{content:"\F02EE"}.mdi-image-check::before{content:"\F1B25"}.mdi-image-check-outline::before{content:"\F1B26"}.mdi-image-edit::before{content:"\F11E3"}.mdi-image-edit-outline::before{content:"\F11E4"}.mdi-image-filter-black-white::before{content:"\F02F0"}.mdi-image-filter-center-focus::before{content:"\F02F1"}.mdi-image-filter-center-focus-strong::before{content:"\F0EFF"}.mdi-image-filter-center-focus-strong-outline::before{content:"\F0F00"}.mdi-image-filter-center-focus-weak::before{content:"\F02F2"}.mdi-image-filter-drama::before{content:"\F02F3"}.mdi-image-filter-drama-outline::before{content:"\F1BFF"}.mdi-image-filter-frames::before{content:"\F02F4"}.mdi-image-filter-hdr::before{content:"\F02F5"}.mdi-image-filter-hdr-outline::before{content:"\F1C64"}.mdi-image-filter-none::before{content:"\F02F6"}.mdi-image-filter-tilt-shift::before{content:"\F02F7"}.mdi-image-filter-vintage::before{content:"\F02F8"}.mdi-image-frame::before{content:"\F0E49"}.mdi-image-lock::before{content:"\F1AB0"}.mdi-image-lock-outline::before{content:"\F1AB1"}.mdi-image-marker::before{content:"\F177B"}.mdi-image-marker-outline::before{content:"\F177C"}.mdi-image-minus::before{content:"\F1419"}.mdi-image-minus-outline::before{content:"\F1B47"}.mdi-image-move::before{content:"\F09F8"}.mdi-image-multiple::before{content:"\F02F9"}.mdi-image-multiple-outline::before{content:"\F02EF"}.mdi-image-off::before{content:"\F082B"}.mdi-image-off-outline::before{content:"\F11D1"}.mdi-image-outline::before{content:"\F0976"}.mdi-image-plus::before{content:"\F087C"}.mdi-image-plus-outline::before{content:"\F1B46"}.mdi-image-refresh::before{content:"\F19FE"}.mdi-image-refresh-outline::before{content:"\F19FF"}.mdi-image-remove::before{content:"\F1418"}.mdi-image-remove-outline::before{content:"\F1B48"}.mdi-image-search::before{content:"\F0977"}.mdi-image-search-outline::before{content:"\F0978"}.mdi-image-size-select-actual::before{content:"\F0C8D"}.mdi-image-size-select-large::before{content:"\F0C8E"}.mdi-image-size-select-small::before{content:"\F0C8F"}.mdi-image-sync::before{content:"\F1A00"}.mdi-image-sync-outline::before{content:"\F1A01"}.mdi-image-text::before{content:"\F160D"}.mdi-import::before{content:"\F02FA"}.mdi-inbox::before{content:"\F0687"}.mdi-inbox-arrow-down::before{content:"\F02FB"}.mdi-inbox-arrow-down-outline::before{content:"\F1270"}.mdi-inbox-arrow-up::before{content:"\F03D1"}.mdi-inbox-arrow-up-outline::before{content:"\F1271"}.mdi-inbox-full::before{content:"\F1272"}.mdi-inbox-full-outline::before{content:"\F1273"}.mdi-inbox-multiple::before{content:"\F08B0"}.mdi-inbox-multiple-outline::before{content:"\F0BA8"}.mdi-inbox-outline::before{content:"\F1274"}.mdi-inbox-remove::before{content:"\F159F"}.mdi-inbox-remove-outline::before{content:"\F15A0"}.mdi-incognito::before{content:"\F05F9"}.mdi-incognito-circle::before{content:"\F1421"}.mdi-incognito-circle-off::before{content:"\F1422"}.mdi-incognito-off::before{content:"\F0075"}.mdi-induction::before{content:"\F184C"}.mdi-infinity::before{content:"\F06E4"}.mdi-information::before{content:"\F02FC"}.mdi-information-box::before{content:"\F1C65"}.mdi-information-box-outline::before{content:"\F1C66"}.mdi-information-off::before{content:"\F178C"}.mdi-information-off-outline::before{content:"\F178D"}.mdi-information-outline::before{content:"\F02FD"}.mdi-information-slab-box::before{content:"\F1C67"}.mdi-information-slab-box-outline::before{content:"\F1C68"}.mdi-information-slab-circle::before{content:"\F1C69"}.mdi-information-slab-circle-outline::before{content:"\F1C6A"}.mdi-information-slab-symbol::before{content:"\F1C6B"}.mdi-information-symbol::before{content:"\F1C6C"}.mdi-information-variant::before{content:"\F064E"}.mdi-information-variant-box::before{content:"\F1C6D"}.mdi-information-variant-box-outline::before{content:"\F1C6E"}.mdi-information-variant-circle::before{content:"\F1C6F"}.mdi-information-variant-circle-outline::before{content:"\F1C70"}.mdi-instagram::before{content:"\F02FE"}.mdi-instrument-triangle::before{content:"\F104E"}.mdi-integrated-circuit-chip::before{content:"\F1913"}.mdi-invert-colors::before{content:"\F0301"}.mdi-invert-colors-off::before{content:"\F0E4A"}.mdi-invoice::before{content:"\F1CD2"}.mdi-invoice-arrow-left::before{content:"\F1CD3"}.mdi-invoice-arrow-left-outline::before{content:"\F1CD4"}.mdi-invoice-arrow-right::before{content:"\F1CD5"}.mdi-invoice-arrow-right-outline::before{content:"\F1CD6"}.mdi-invoice-check::before{content:"\F1CD7"}.mdi-invoice-check-outline::before{content:"\F1CD8"}.mdi-invoice-clock::before{content:"\F1CD9"}.mdi-invoice-clock-outline::before{content:"\F1CDA"}.mdi-invoice-edit::before{content:"\F1CDB"}.mdi-invoice-edit-outline::before{content:"\F1CDC"}.mdi-invoice-export-outline::before{content:"\F1CDD"}.mdi-invoice-fast::before{content:"\F1CDE"}.mdi-invoice-fast-outline::before{content:"\F1CDF"}.mdi-invoice-import::before{content:"\F1CE0"}.mdi-invoice-import-outline::before{content:"\F1CE1"}.mdi-invoice-list::before{content:"\F1CE2"}.mdi-invoice-list-outline::before{content:"\F1CE3"}.mdi-invoice-minus::before{content:"\F1CE4"}.mdi-invoice-minus-outline::before{content:"\F1CE5"}.mdi-invoice-multiple::before{content:"\F1CE6"}.mdi-invoice-multiple-outline::before{content:"\F1CE7"}.mdi-invoice-outline::before{content:"\F1CE8"}.mdi-invoice-plus::before{content:"\F1CE9"}.mdi-invoice-plus-outline::before{content:"\F1CEA"}.mdi-invoice-remove::before{content:"\F1CEB"}.mdi-invoice-remove-outline::before{content:"\F1CEC"}.mdi-invoice-send::before{content:"\F1CED"}.mdi-invoice-send-outline::before{content:"\F1CEE"}.mdi-invoice-text::before{content:"\F1CEF"}.mdi-invoice-text-arrow-left::before{content:"\F1CF0"}.mdi-invoice-text-arrow-left-outline::before{content:"\F1CF1"}.mdi-invoice-text-arrow-right::before{content:"\F1CF2"}.mdi-invoice-text-arrow-right-outline::before{content:"\F1CF3"}.mdi-invoice-text-check::before{content:"\F1CF4"}.mdi-invoice-text-check-outline::before{content:"\F1CF5"}.mdi-invoice-text-clock::before{content:"\F1CF6"}.mdi-invoice-text-clock-outline::before{content:"\F1CF7"}.mdi-invoice-text-edit::before{content:"\F1CF8"}.mdi-invoice-text-edit-outline::before{content:"\F1CF9"}.mdi-invoice-text-fast::before{content:"\F1CFA"}.mdi-invoice-text-fast-outline::before{content:"\F1CFB"}.mdi-invoice-text-minus::before{content:"\F1CFC"}.mdi-invoice-text-minus-outline::before{content:"\F1CFD"}.mdi-invoice-text-multiple::before{content:"\F1CFE"}.mdi-invoice-text-multiple-outline::before{content:"\F1CFF"}.mdi-invoice-text-outline::before{content:"\F1D00"}.mdi-invoice-text-plus::before{content:"\F1D01"}.mdi-invoice-text-plus-outline::before{content:"\F1D02"}.mdi-invoice-text-remove::before{content:"\F1D03"}.mdi-invoice-text-remove-outline::before{content:"\F1D04"}.mdi-invoice-text-send::before{content:"\F1D05"}.mdi-invoice-text-send-outline::before{content:"\F1D06"}.mdi-iobroker::before{content:"\F12E8"}.mdi-ip::before{content:"\F0A5F"}.mdi-ip-network::before{content:"\F0A60"}.mdi-ip-network-outline::before{content:"\F0C90"}.mdi-ip-outline::before{content:"\F1982"}.mdi-ipod::before{content:"\F0C91"}.mdi-iron::before{content:"\F1824"}.mdi-iron-board::before{content:"\F1838"}.mdi-iron-outline::before{content:"\F1825"}.mdi-island::before{content:"\F104F"}.mdi-island-variant::before{content:"\F1CC6"}.mdi-iv-bag::before{content:"\F10B9"}.mdi-jabber::before{content:"\F0DD5"}.mdi-jeepney::before{content:"\F0302"}.mdi-jellyfish::before{content:"\F0F01"}.mdi-jellyfish-outline::before{content:"\F0F02"}.mdi-jira::before{content:"\F0303"}.mdi-jquery::before{content:"\F087D"}.mdi-jsfiddle::before{content:"\F0304"}.mdi-jump-rope::before{content:"\F12FF"}.mdi-kabaddi::before{content:"\F0D87"}.mdi-kangaroo::before{content:"\F1558"}.mdi-karate::before{content:"\F082C"}.mdi-kayaking::before{content:"\F08AF"}.mdi-keg::before{content:"\F0305"}.mdi-kettle::before{content:"\F05FA"}.mdi-kettle-alert::before{content:"\F1317"}.mdi-kettle-alert-outline::before{content:"\F1318"}.mdi-kettle-off::before{content:"\F131B"}.mdi-kettle-off-outline::before{content:"\F131C"}.mdi-kettle-outline::before{content:"\F0F56"}.mdi-kettle-pour-over::before{content:"\F173C"}.mdi-kettle-steam::before{content:"\F1319"}.mdi-kettle-steam-outline::before{content:"\F131A"}.mdi-kettlebell::before{content:"\F1300"}.mdi-key::before{content:"\F0306"}.mdi-key-alert::before{content:"\F1983"}.mdi-key-alert-outline::before{content:"\F1984"}.mdi-key-arrow-right::before{content:"\F1312"}.mdi-key-chain::before{content:"\F1574"}.mdi-key-chain-variant::before{content:"\F1575"}.mdi-key-change::before{content:"\F0307"}.mdi-key-link::before{content:"\F119F"}.mdi-key-minus::before{content:"\F0308"}.mdi-key-outline::before{content:"\F0DD6"}.mdi-key-plus::before{content:"\F0309"}.mdi-key-remove::before{content:"\F030A"}.mdi-key-star::before{content:"\F119E"}.mdi-key-variant::before{content:"\F030B"}.mdi-key-wireless::before{content:"\F0FC2"}.mdi-keyboard::before{content:"\F030C"}.mdi-keyboard-backspace::before{content:"\F030D"}.mdi-keyboard-caps::before{content:"\F030E"}.mdi-keyboard-close::before{content:"\F030F"}.mdi-keyboard-close-outline::before{content:"\F1C00"}.mdi-keyboard-esc::before{content:"\F12B7"}.mdi-keyboard-f1::before{content:"\F12AB"}.mdi-keyboard-f10::before{content:"\F12B4"}.mdi-keyboard-f11::before{content:"\F12B5"}.mdi-keyboard-f12::before{content:"\F12B6"}.mdi-keyboard-f2::before{content:"\F12AC"}.mdi-keyboard-f3::before{content:"\F12AD"}.mdi-keyboard-f4::before{content:"\F12AE"}.mdi-keyboard-f5::before{content:"\F12AF"}.mdi-keyboard-f6::before{content:"\F12B0"}.mdi-keyboard-f7::before{content:"\F12B1"}.mdi-keyboard-f8::before{content:"\F12B2"}.mdi-keyboard-f9::before{content:"\F12B3"}.mdi-keyboard-off::before{content:"\F0310"}.mdi-keyboard-off-outline::before{content:"\F0E4B"}.mdi-keyboard-outline::before{content:"\F097B"}.mdi-keyboard-return::before{content:"\F0311"}.mdi-keyboard-settings::before{content:"\F09F9"}.mdi-keyboard-settings-outline::before{content:"\F09FA"}.mdi-keyboard-space::before{content:"\F1050"}.mdi-keyboard-tab::before{content:"\F0312"}.mdi-keyboard-tab-reverse::before{content:"\F0325"}.mdi-keyboard-variant::before{content:"\F0313"}.mdi-khanda::before{content:"\F10FD"}.mdi-kickstarter::before{content:"\F0745"}.mdi-kite::before{content:"\F1985"}.mdi-kite-outline::before{content:"\F1986"}.mdi-kitesurfing::before{content:"\F1744"}.mdi-klingon::before{content:"\F135B"}.mdi-knife::before{content:"\F09FB"}.mdi-knife-military::before{content:"\F09FC"}.mdi-knob::before{content:"\F1B96"}.mdi-koala::before{content:"\F173F"}.mdi-kodi::before{content:"\F0314"}.mdi-kubernetes::before{content:"\F10FE"}.mdi-label::before{content:"\F0315"}.mdi-label-multiple::before{content:"\F1375"}.mdi-label-multiple-outline::before{content:"\F1376"}.mdi-label-off::before{content:"\F0ACB"}.mdi-label-off-outline::before{content:"\F0ACC"}.mdi-label-outline::before{content:"\F0316"}.mdi-label-percent::before{content:"\F12EA"}.mdi-label-percent-outline::before{content:"\F12EB"}.mdi-label-variant::before{content:"\F0ACD"}.mdi-label-variant-outline::before{content:"\F0ACE"}.mdi-ladder::before{content:"\F15A2"}.mdi-ladybug::before{content:"\F082D"}.mdi-lambda::before{content:"\F0627"}.mdi-lamp::before{content:"\F06B5"}.mdi-lamp-outline::before{content:"\F17D0"}.mdi-lamps::before{content:"\F1576"}.mdi-lamps-outline::before{content:"\F17D1"}.mdi-lan::before{content:"\F0317"}.mdi-lan-check::before{content:"\F12AA"}.mdi-lan-connect::before{content:"\F0318"}.mdi-lan-disconnect::before{content:"\F0319"}.mdi-lan-pending::before{content:"\F031A"}.mdi-land-fields::before{content:"\F1AB2"}.mdi-land-plots::before{content:"\F1AB3"}.mdi-land-plots-circle::before{content:"\F1AB4"}.mdi-land-plots-circle-variant::before{content:"\F1AB5"}.mdi-land-plots-marker::before{content:"\F1C5D"}.mdi-land-rows-horizontal::before{content:"\F1AB6"}.mdi-land-rows-vertical::before{content:"\F1AB7"}.mdi-landslide::before{content:"\F1A48"}.mdi-landslide-outline::before{content:"\F1A49"}.mdi-language-c::before{content:"\F0671"}.mdi-language-cpp::before{content:"\F0672"}.mdi-language-csharp::before{content:"\F031B"}.mdi-language-css3::before{content:"\F031C"}.mdi-language-fortran::before{content:"\F121A"}.mdi-language-go::before{content:"\F07D3"}.mdi-language-haskell::before{content:"\F0C92"}.mdi-language-html5::before{content:"\F031D"}.mdi-language-java::before{content:"\F0B37"}.mdi-language-javascript::before{content:"\F031E"}.mdi-language-kotlin::before{content:"\F1219"}.mdi-language-lua::before{content:"\F08B1"}.mdi-language-markdown::before{content:"\F0354"}.mdi-language-markdown-outline::before{content:"\F0F5B"}.mdi-language-php::before{content:"\F031F"}.mdi-language-python::before{content:"\F0320"}.mdi-language-r::before{content:"\F07D4"}.mdi-language-ruby::before{content:"\F0D2D"}.mdi-language-ruby-on-rails::before{content:"\F0ACF"}.mdi-language-rust::before{content:"\F1617"}.mdi-language-swift::before{content:"\F06E5"}.mdi-language-typescript::before{content:"\F06E6"}.mdi-language-xaml::before{content:"\F0673"}.mdi-laptop::before{content:"\F0322"}.mdi-laptop-account::before{content:"\F1A4A"}.mdi-laptop-off::before{content:"\F06E7"}.mdi-laravel::before{content:"\F0AD0"}.mdi-laser-pointer::before{content:"\F1484"}.mdi-lasso::before{content:"\F0F03"}.mdi-lastpass::before{content:"\F0446"}.mdi-latitude::before{content:"\F0F57"}.mdi-launch::before{content:"\F0327"}.mdi-lava-lamp::before{content:"\F07D5"}.mdi-layers::before{content:"\F0328"}.mdi-layers-edit::before{content:"\F1892"}.mdi-layers-minus::before{content:"\F0E4C"}.mdi-layers-off::before{content:"\F0329"}.mdi-layers-off-outline::before{content:"\F09FD"}.mdi-layers-outline::before{content:"\F09FE"}.mdi-layers-plus::before{content:"\F0E4D"}.mdi-layers-remove::before{content:"\F0E4E"}.mdi-layers-search::before{content:"\F1206"}.mdi-layers-search-outline::before{content:"\F1207"}.mdi-layers-triple::before{content:"\F0F58"}.mdi-layers-triple-outline::before{content:"\F0F59"}.mdi-lead-pencil::before{content:"\F064F"}.mdi-leaf::before{content:"\F032A"}.mdi-leaf-circle::before{content:"\F1905"}.mdi-leaf-circle-outline::before{content:"\F1906"}.mdi-leaf-maple::before{content:"\F0C93"}.mdi-leaf-maple-off::before{content:"\F12DA"}.mdi-leaf-off::before{content:"\F12D9"}.mdi-leak::before{content:"\F0DD7"}.mdi-leak-off::before{content:"\F0DD8"}.mdi-lectern::before{content:"\F1AF0"}.mdi-led-off::before{content:"\F032B"}.mdi-led-on::before{content:"\F032C"}.mdi-led-outline::before{content:"\F032D"}.mdi-led-strip::before{content:"\F07D6"}.mdi-led-strip-variant::before{content:"\F1051"}.mdi-led-strip-variant-off::before{content:"\F1A4B"}.mdi-led-variant-off::before{content:"\F032E"}.mdi-led-variant-on::before{content:"\F032F"}.mdi-led-variant-outline::before{content:"\F0330"}.mdi-leek::before{content:"\F117D"}.mdi-less-than::before{content:"\F097C"}.mdi-less-than-or-equal::before{content:"\F097D"}.mdi-library::before{content:"\F0331"}.mdi-library-outline::before{content:"\F1A22"}.mdi-library-shelves::before{content:"\F0BA9"}.mdi-license::before{content:"\F0FC3"}.mdi-lifebuoy::before{content:"\F087E"}.mdi-light-flood-down::before{content:"\F1987"}.mdi-light-flood-up::before{content:"\F1988"}.mdi-light-recessed::before{content:"\F179B"}.mdi-light-switch::before{content:"\F097E"}.mdi-light-switch-off::before{content:"\F1A24"}.mdi-lightbulb::before{content:"\F0335"}.mdi-lightbulb-alert::before{content:"\F19E1"}.mdi-lightbulb-alert-outline::before{content:"\F19E2"}.mdi-lightbulb-auto::before{content:"\F1800"}.mdi-lightbulb-auto-outline::before{content:"\F1801"}.mdi-lightbulb-cfl::before{content:"\F1208"}.mdi-lightbulb-cfl-off::before{content:"\F1209"}.mdi-lightbulb-cfl-spiral::before{content:"\F1275"}.mdi-lightbulb-cfl-spiral-off::before{content:"\F12C3"}.mdi-lightbulb-fluorescent-tube::before{content:"\F1804"}.mdi-lightbulb-fluorescent-tube-outline::before{content:"\F1805"}.mdi-lightbulb-group::before{content:"\F1253"}.mdi-lightbulb-group-off::before{content:"\F12CD"}.mdi-lightbulb-group-off-outline::before{content:"\F12CE"}.mdi-lightbulb-group-outline::before{content:"\F1254"}.mdi-lightbulb-multiple::before{content:"\F1255"}.mdi-lightbulb-multiple-off::before{content:"\F12CF"}.mdi-lightbulb-multiple-off-outline::before{content:"\F12D0"}.mdi-lightbulb-multiple-outline::before{content:"\F1256"}.mdi-lightbulb-night::before{content:"\F1A4C"}.mdi-lightbulb-night-outline::before{content:"\F1A4D"}.mdi-lightbulb-off::before{content:"\F0E4F"}.mdi-lightbulb-off-outline::before{content:"\F0E50"}.mdi-lightbulb-on::before{content:"\F06E8"}.mdi-lightbulb-on-10::before{content:"\F1A4E"}.mdi-lightbulb-on-20::before{content:"\F1A4F"}.mdi-lightbulb-on-30::before{content:"\F1A50"}.mdi-lightbulb-on-40::before{content:"\F1A51"}.mdi-lightbulb-on-50::before{content:"\F1A52"}.mdi-lightbulb-on-60::before{content:"\F1A53"}.mdi-lightbulb-on-70::before{content:"\F1A54"}.mdi-lightbulb-on-80::before{content:"\F1A55"}.mdi-lightbulb-on-90::before{content:"\F1A56"}.mdi-lightbulb-on-outline::before{content:"\F06E9"}.mdi-lightbulb-outline::before{content:"\F0336"}.mdi-lightbulb-question::before{content:"\F19E3"}.mdi-lightbulb-question-outline::before{content:"\F19E4"}.mdi-lightbulb-spot::before{content:"\F17F4"}.mdi-lightbulb-spot-off::before{content:"\F17F5"}.mdi-lightbulb-variant::before{content:"\F1802"}.mdi-lightbulb-variant-outline::before{content:"\F1803"}.mdi-lighthouse::before{content:"\F09FF"}.mdi-lighthouse-on::before{content:"\F0A00"}.mdi-lightning-bolt::before{content:"\F140B"}.mdi-lightning-bolt-circle::before{content:"\F0820"}.mdi-lightning-bolt-outline::before{content:"\F140C"}.mdi-line-scan::before{content:"\F0624"}.mdi-lingerie::before{content:"\F1476"}.mdi-link::before{content:"\F0337"}.mdi-link-box::before{content:"\F0D1A"}.mdi-link-box-outline::before{content:"\F0D1B"}.mdi-link-box-variant::before{content:"\F0D1C"}.mdi-link-box-variant-outline::before{content:"\F0D1D"}.mdi-link-circle::before{content:"\F1CAC"}.mdi-link-circle-outline::before{content:"\F1CAD"}.mdi-link-edit::before{content:"\F1CAE"}.mdi-link-lock::before{content:"\F10BA"}.mdi-link-off::before{content:"\F0338"}.mdi-link-plus::before{content:"\F0C94"}.mdi-link-variant::before{content:"\F0339"}.mdi-link-variant-minus::before{content:"\F10FF"}.mdi-link-variant-off::before{content:"\F033A"}.mdi-link-variant-plus::before{content:"\F1100"}.mdi-link-variant-remove::before{content:"\F1101"}.mdi-linkedin::before{content:"\F033B"}.mdi-linux::before{content:"\F033D"}.mdi-linux-mint::before{content:"\F08ED"}.mdi-lipstick::before{content:"\F13B5"}.mdi-liquid-spot::before{content:"\F1826"}.mdi-liquor::before{content:"\F191E"}.mdi-list-box::before{content:"\F1B7B"}.mdi-list-box-outline::before{content:"\F1B7C"}.mdi-list-status::before{content:"\F15AB"}.mdi-litecoin::before{content:"\F0A61"}.mdi-loading::before{content:"\F0772"}.mdi-location-enter::before{content:"\F0FC4"}.mdi-location-exit::before{content:"\F0FC5"}.mdi-lock::before{content:"\F033E"}.mdi-lock-alert::before{content:"\F08EE"}.mdi-lock-alert-outline::before{content:"\F15D1"}.mdi-lock-check::before{content:"\F139A"}.mdi-lock-check-outline::before{content:"\F16A8"}.mdi-lock-clock::before{content:"\F097F"}.mdi-lock-minus::before{content:"\F16A9"}.mdi-lock-minus-outline::before{content:"\F16AA"}.mdi-lock-off::before{content:"\F1671"}.mdi-lock-off-outline::before{content:"\F1672"}.mdi-lock-open::before{content:"\F033F"}.mdi-lock-open-alert::before{content:"\F139B"}.mdi-lock-open-alert-outline::before{content:"\F15D2"}.mdi-lock-open-check::before{content:"\F139C"}.mdi-lock-open-check-outline::before{content:"\F16AB"}.mdi-lock-open-minus::before{content:"\F16AC"}.mdi-lock-open-minus-outline::before{content:"\F16AD"}.mdi-lock-open-outline::before{content:"\F0340"}.mdi-lock-open-plus::before{content:"\F16AE"}.mdi-lock-open-plus-outline::before{content:"\F16AF"}.mdi-lock-open-remove::before{content:"\F16B0"}.mdi-lock-open-remove-outline::before{content:"\F16B1"}.mdi-lock-open-variant::before{content:"\F0FC6"}.mdi-lock-open-variant-outline::before{content:"\F0FC7"}.mdi-lock-outline::before{content:"\F0341"}.mdi-lock-pattern::before{content:"\F06EA"}.mdi-lock-percent::before{content:"\F1C12"}.mdi-lock-percent-open::before{content:"\F1C13"}.mdi-lock-percent-open-outline::before{content:"\F1C14"}.mdi-lock-percent-open-variant::before{content:"\F1C15"}.mdi-lock-percent-open-variant-outline::before{content:"\F1C16"}.mdi-lock-percent-outline::before{content:"\F1C17"}.mdi-lock-plus::before{content:"\F05FB"}.mdi-lock-plus-outline::before{content:"\F16B2"}.mdi-lock-question::before{content:"\F08EF"}.mdi-lock-remove::before{content:"\F16B3"}.mdi-lock-remove-outline::before{content:"\F16B4"}.mdi-lock-reset::before{content:"\F0773"}.mdi-lock-smart::before{content:"\F08B2"}.mdi-locker::before{content:"\F07D7"}.mdi-locker-multiple::before{content:"\F07D8"}.mdi-login::before{content:"\F0342"}.mdi-login-variant::before{content:"\F05FC"}.mdi-logout::before{content:"\F0343"}.mdi-logout-variant::before{content:"\F05FD"}.mdi-longitude::before{content:"\F0F5A"}.mdi-looks::before{content:"\F0344"}.mdi-lotion::before{content:"\F1582"}.mdi-lotion-outline::before{content:"\F1583"}.mdi-lotion-plus::before{content:"\F1584"}.mdi-lotion-plus-outline::before{content:"\F1585"}.mdi-loupe::before{content:"\F0345"}.mdi-lumx::before{content:"\F0346"}.mdi-lungs::before{content:"\F1084"}.mdi-mace::before{content:"\F1843"}.mdi-magazine-pistol::before{content:"\F0324"}.mdi-magazine-rifle::before{content:"\F0323"}.mdi-magic-staff::before{content:"\F1844"}.mdi-magnet::before{content:"\F0347"}.mdi-magnet-on::before{content:"\F0348"}.mdi-magnify::before{content:"\F0349"}.mdi-magnify-close::before{content:"\F0980"}.mdi-magnify-expand::before{content:"\F1874"}.mdi-magnify-minus::before{content:"\F034A"}.mdi-magnify-minus-cursor::before{content:"\F0A62"}.mdi-magnify-minus-outline::before{content:"\F06EC"}.mdi-magnify-plus::before{content:"\F034B"}.mdi-magnify-plus-cursor::before{content:"\F0A63"}.mdi-magnify-plus-outline::before{content:"\F06ED"}.mdi-magnify-remove-cursor::before{content:"\F120C"}.mdi-magnify-remove-outline::before{content:"\F120D"}.mdi-magnify-scan::before{content:"\F1276"}.mdi-mail::before{content:"\F0EBB"}.mdi-mailbox::before{content:"\F06EE"}.mdi-mailbox-open::before{content:"\F0D88"}.mdi-mailbox-open-outline::before{content:"\F0D89"}.mdi-mailbox-open-up::before{content:"\F0D8A"}.mdi-mailbox-open-up-outline::before{content:"\F0D8B"}.mdi-mailbox-outline::before{content:"\F0D8C"}.mdi-mailbox-up::before{content:"\F0D8D"}.mdi-mailbox-up-outline::before{content:"\F0D8E"}.mdi-manjaro::before{content:"\F160A"}.mdi-map::before{content:"\F034D"}.mdi-map-check::before{content:"\F0EBC"}.mdi-map-check-outline::before{content:"\F0EBD"}.mdi-map-clock::before{content:"\F0D1E"}.mdi-map-clock-outline::before{content:"\F0D1F"}.mdi-map-legend::before{content:"\F0A01"}.mdi-map-marker::before{content:"\F034E"}.mdi-map-marker-account::before{content:"\F18E3"}.mdi-map-marker-account-outline::before{content:"\F18E4"}.mdi-map-marker-alert::before{content:"\F0F05"}.mdi-map-marker-alert-outline::before{content:"\F0F06"}.mdi-map-marker-check::before{content:"\F0C95"}.mdi-map-marker-check-outline::before{content:"\F12FB"}.mdi-map-marker-circle::before{content:"\F034F"}.mdi-map-marker-distance::before{content:"\F08F0"}.mdi-map-marker-down::before{content:"\F1102"}.mdi-map-marker-left::before{content:"\F12DB"}.mdi-map-marker-left-outline::before{content:"\F12DD"}.mdi-map-marker-minus::before{content:"\F0650"}.mdi-map-marker-minus-outline::before{content:"\F12F9"}.mdi-map-marker-multiple::before{content:"\F0350"}.mdi-map-marker-multiple-outline::before{content:"\F1277"}.mdi-map-marker-off::before{content:"\F0351"}.mdi-map-marker-off-outline::before{content:"\F12FD"}.mdi-map-marker-outline::before{content:"\F07D9"}.mdi-map-marker-path::before{content:"\F0D20"}.mdi-map-marker-plus::before{content:"\F0651"}.mdi-map-marker-plus-outline::before{content:"\F12F8"}.mdi-map-marker-question::before{content:"\F0F07"}.mdi-map-marker-question-outline::before{content:"\F0F08"}.mdi-map-marker-radius::before{content:"\F0352"}.mdi-map-marker-radius-outline::before{content:"\F12FC"}.mdi-map-marker-remove::before{content:"\F0F09"}.mdi-map-marker-remove-outline::before{content:"\F12FA"}.mdi-map-marker-remove-variant::before{content:"\F0F0A"}.mdi-map-marker-right::before{content:"\F12DC"}.mdi-map-marker-right-outline::before{content:"\F12DE"}.mdi-map-marker-star::before{content:"\F1608"}.mdi-map-marker-star-outline::before{content:"\F1609"}.mdi-map-marker-up::before{content:"\F1103"}.mdi-map-minus::before{content:"\F0981"}.mdi-map-outline::before{content:"\F0982"}.mdi-map-plus::before{content:"\F0983"}.mdi-map-search::before{content:"\F0984"}.mdi-map-search-outline::before{content:"\F0985"}.mdi-mapbox::before{content:"\F0BAA"}.mdi-margin::before{content:"\F0353"}.mdi-marker::before{content:"\F0652"}.mdi-marker-cancel::before{content:"\F0DD9"}.mdi-marker-check::before{content:"\F0355"}.mdi-mastodon::before{content:"\F0AD1"}.mdi-material-design::before{content:"\F0986"}.mdi-material-ui::before{content:"\F0357"}.mdi-math-compass::before{content:"\F0358"}.mdi-math-cos::before{content:"\F0C96"}.mdi-math-integral::before{content:"\F0FC8"}.mdi-math-integral-box::before{content:"\F0FC9"}.mdi-math-log::before{content:"\F1085"}.mdi-math-norm::before{content:"\F0FCA"}.mdi-math-norm-box::before{content:"\F0FCB"}.mdi-math-sin::before{content:"\F0C97"}.mdi-math-tan::before{content:"\F0C98"}.mdi-matrix::before{content:"\F0628"}.mdi-medal::before{content:"\F0987"}.mdi-medal-outline::before{content:"\F1326"}.mdi-medical-bag::before{content:"\F06EF"}.mdi-medical-cotton-swab::before{content:"\F1AB8"}.mdi-medication::before{content:"\F1B14"}.mdi-medication-outline::before{content:"\F1B15"}.mdi-meditation::before{content:"\F117B"}.mdi-memory::before{content:"\F035B"}.mdi-memory-arrow-down::before{content:"\F1CA6"}.mdi-menorah::before{content:"\F17D4"}.mdi-menorah-fire::before{content:"\F17D5"}.mdi-menu::before{content:"\F035C"}.mdi-menu-close::before{content:"\F1C90"}.mdi-menu-down::before{content:"\F035D"}.mdi-menu-down-outline::before{content:"\F06B6"}.mdi-menu-left::before{content:"\F035E"}.mdi-menu-left-outline::before{content:"\F0A02"}.mdi-menu-open::before{content:"\F0BAB"}.mdi-menu-right::before{content:"\F035F"}.mdi-menu-right-outline::before{content:"\F0A03"}.mdi-menu-swap::before{content:"\F0A64"}.mdi-menu-swap-outline::before{content:"\F0A65"}.mdi-menu-up::before{content:"\F0360"}.mdi-menu-up-outline::before{content:"\F06B7"}.mdi-merge::before{content:"\F0F5C"}.mdi-message::before{content:"\F0361"}.mdi-message-alert::before{content:"\F0362"}.mdi-message-alert-outline::before{content:"\F0A04"}.mdi-message-arrow-left::before{content:"\F12F2"}.mdi-message-arrow-left-outline::before{content:"\F12F3"}.mdi-message-arrow-right::before{content:"\F12F4"}.mdi-message-arrow-right-outline::before{content:"\F12F5"}.mdi-message-badge::before{content:"\F1941"}.mdi-message-badge-outline::before{content:"\F1942"}.mdi-message-bookmark::before{content:"\F15AC"}.mdi-message-bookmark-outline::before{content:"\F15AD"}.mdi-message-bulleted::before{content:"\F06A2"}.mdi-message-bulleted-off::before{content:"\F06A3"}.mdi-message-check::before{content:"\F1B8A"}.mdi-message-check-outline::before{content:"\F1B8B"}.mdi-message-cog::before{content:"\F06F1"}.mdi-message-cog-outline::before{content:"\F1172"}.mdi-message-draw::before{content:"\F0363"}.mdi-message-fast::before{content:"\F19CC"}.mdi-message-fast-outline::before{content:"\F19CD"}.mdi-message-flash::before{content:"\F15A9"}.mdi-message-flash-outline::before{content:"\F15AA"}.mdi-message-image::before{content:"\F0364"}.mdi-message-image-outline::before{content:"\F116C"}.mdi-message-lock::before{content:"\F0FCC"}.mdi-message-lock-outline::before{content:"\F116D"}.mdi-message-minus::before{content:"\F116E"}.mdi-message-minus-outline::before{content:"\F116F"}.mdi-message-off::before{content:"\F164D"}.mdi-message-off-outline::before{content:"\F164E"}.mdi-message-outline::before{content:"\F0365"}.mdi-message-plus::before{content:"\F0653"}.mdi-message-plus-outline::before{content:"\F10BB"}.mdi-message-processing::before{content:"\F0366"}.mdi-message-processing-outline::before{content:"\F1170"}.mdi-message-question::before{content:"\F173A"}.mdi-message-question-outline::before{content:"\F173B"}.mdi-message-reply::before{content:"\F0367"}.mdi-message-reply-outline::before{content:"\F173D"}.mdi-message-reply-text::before{content:"\F0368"}.mdi-message-reply-text-outline::before{content:"\F173E"}.mdi-message-settings::before{content:"\F06F0"}.mdi-message-settings-outline::before{content:"\F1171"}.mdi-message-star::before{content:"\F069A"}.mdi-message-star-outline::before{content:"\F1250"}.mdi-message-text::before{content:"\F0369"}.mdi-message-text-clock::before{content:"\F1173"}.mdi-message-text-clock-outline::before{content:"\F1174"}.mdi-message-text-fast::before{content:"\F19CE"}.mdi-message-text-fast-outline::before{content:"\F19CF"}.mdi-message-text-lock::before{content:"\F0FCD"}.mdi-message-text-lock-outline::before{content:"\F1175"}.mdi-message-text-outline::before{content:"\F036A"}.mdi-message-video::before{content:"\F036B"}.mdi-meteor::before{content:"\F0629"}.mdi-meter-electric::before{content:"\F1A57"}.mdi-meter-electric-outline::before{content:"\F1A58"}.mdi-meter-gas::before{content:"\F1A59"}.mdi-meter-gas-outline::before{content:"\F1A5A"}.mdi-metronome::before{content:"\F07DA"}.mdi-metronome-tick::before{content:"\F07DB"}.mdi-micro-sd::before{content:"\F07DC"}.mdi-microphone::before{content:"\F036C"}.mdi-microphone-message::before{content:"\F050A"}.mdi-microphone-message-off::before{content:"\F050B"}.mdi-microphone-minus::before{content:"\F08B3"}.mdi-microphone-off::before{content:"\F036D"}.mdi-microphone-outline::before{content:"\F036E"}.mdi-microphone-plus::before{content:"\F08B4"}.mdi-microphone-question::before{content:"\F1989"}.mdi-microphone-question-outline::before{content:"\F198A"}.mdi-microphone-settings::before{content:"\F036F"}.mdi-microphone-variant::before{content:"\F0370"}.mdi-microphone-variant-off::before{content:"\F0371"}.mdi-microscope::before{content:"\F0654"}.mdi-microsoft::before{content:"\F0372"}.mdi-microsoft-access::before{content:"\F138E"}.mdi-microsoft-azure::before{content:"\F0805"}.mdi-microsoft-azure-devops::before{content:"\F0FD5"}.mdi-microsoft-bing::before{content:"\F00A4"}.mdi-microsoft-dynamics-365::before{content:"\F0988"}.mdi-microsoft-edge::before{content:"\F01E9"}.mdi-microsoft-excel::before{content:"\F138F"}.mdi-microsoft-internet-explorer::before{content:"\F0300"}.mdi-microsoft-office::before{content:"\F03C6"}.mdi-microsoft-onedrive::before{content:"\F03CA"}.mdi-microsoft-onenote::before{content:"\F0747"}.mdi-microsoft-outlook::before{content:"\F0D22"}.mdi-microsoft-powerpoint::before{content:"\F1390"}.mdi-microsoft-sharepoint::before{content:"\F1391"}.mdi-microsoft-teams::before{content:"\F02BB"}.mdi-microsoft-visual-studio::before{content:"\F0610"}.mdi-microsoft-visual-studio-code::before{content:"\F0A1E"}.mdi-microsoft-windows::before{content:"\F05B3"}.mdi-microsoft-windows-classic::before{content:"\F0A21"}.mdi-microsoft-word::before{content:"\F1392"}.mdi-microsoft-xbox::before{content:"\F05B9"}.mdi-microsoft-xbox-controller::before{content:"\F05BA"}.mdi-microsoft-xbox-controller-battery-alert::before{content:"\F074B"}.mdi-microsoft-xbox-controller-battery-charging::before{content:"\F0A22"}.mdi-microsoft-xbox-controller-battery-empty::before{content:"\F074C"}.mdi-microsoft-xbox-controller-battery-full::before{content:"\F074D"}.mdi-microsoft-xbox-controller-battery-low::before{content:"\F074E"}.mdi-microsoft-xbox-controller-battery-medium::before{content:"\F074F"}.mdi-microsoft-xbox-controller-battery-unknown::before{content:"\F0750"}.mdi-microsoft-xbox-controller-menu::before{content:"\F0E6F"}.mdi-microsoft-xbox-controller-off::before{content:"\F05BB"}.mdi-microsoft-xbox-controller-view::before{content:"\F0E70"}.mdi-microwave::before{content:"\F0C99"}.mdi-microwave-off::before{content:"\F1423"}.mdi-middleware::before{content:"\F0F5D"}.mdi-middleware-outline::before{content:"\F0F5E"}.mdi-midi::before{content:"\F08F1"}.mdi-midi-port::before{content:"\F08F2"}.mdi-mine::before{content:"\F0DDA"}.mdi-minecraft::before{content:"\F0373"}.mdi-mini-sd::before{content:"\F0A05"}.mdi-minidisc::before{content:"\F0A06"}.mdi-minus::before{content:"\F0374"}.mdi-minus-box::before{content:"\F0375"}.mdi-minus-box-multiple::before{content:"\F1141"}.mdi-minus-box-multiple-outline::before{content:"\F1142"}.mdi-minus-box-outline::before{content:"\F06F2"}.mdi-minus-circle::before{content:"\F0376"}.mdi-minus-circle-multiple::before{content:"\F035A"}.mdi-minus-circle-multiple-outline::before{content:"\F0AD3"}.mdi-minus-circle-off::before{content:"\F1459"}.mdi-minus-circle-off-outline::before{content:"\F145A"}.mdi-minus-circle-outline::before{content:"\F0377"}.mdi-minus-network::before{content:"\F0378"}.mdi-minus-network-outline::before{content:"\F0C9A"}.mdi-minus-thick::before{content:"\F1639"}.mdi-mirror::before{content:"\F11FD"}.mdi-mirror-rectangle::before{content:"\F179F"}.mdi-mirror-variant::before{content:"\F17A0"}.mdi-mixed-martial-arts::before{content:"\F0D8F"}.mdi-mixed-reality::before{content:"\F087F"}.mdi-molecule::before{content:"\F0BAC"}.mdi-molecule-co::before{content:"\F12FE"}.mdi-molecule-co2::before{content:"\F07E4"}.mdi-monitor::before{content:"\F0379"}.mdi-monitor-account::before{content:"\F1A5B"}.mdi-monitor-arrow-down::before{content:"\F19D0"}.mdi-monitor-arrow-down-variant::before{content:"\F19D1"}.mdi-monitor-cellphone::before{content:"\F0989"}.mdi-monitor-cellphone-star::before{content:"\F098A"}.mdi-monitor-dashboard::before{content:"\F0A07"}.mdi-monitor-edit::before{content:"\F12C6"}.mdi-monitor-eye::before{content:"\F13B4"}.mdi-monitor-lock::before{content:"\F0DDB"}.mdi-monitor-multiple::before{content:"\F037A"}.mdi-monitor-off::before{content:"\F0D90"}.mdi-monitor-screenshot::before{content:"\F0E51"}.mdi-monitor-share::before{content:"\F1483"}.mdi-monitor-shimmer::before{content:"\F1104"}.mdi-monitor-small::before{content:"\F1876"}.mdi-monitor-speaker::before{content:"\F0F5F"}.mdi-monitor-speaker-off::before{content:"\F0F60"}.mdi-monitor-star::before{content:"\F0DDC"}.mdi-monitor-vertical::before{content:"\F1C33"}.mdi-moon-first-quarter::before{content:"\F0F61"}.mdi-moon-full::before{content:"\F0F62"}.mdi-moon-last-quarter::before{content:"\F0F63"}.mdi-moon-new::before{content:"\F0F64"}.mdi-moon-waning-crescent::before{content:"\F0F65"}.mdi-moon-waning-gibbous::before{content:"\F0F66"}.mdi-moon-waxing-crescent::before{content:"\F0F67"}.mdi-moon-waxing-gibbous::before{content:"\F0F68"}.mdi-moped::before{content:"\F1086"}.mdi-moped-electric::before{content:"\F15B7"}.mdi-moped-electric-outline::before{content:"\F15B8"}.mdi-moped-outline::before{content:"\F15B9"}.mdi-more::before{content:"\F037B"}.mdi-mortar-pestle::before{content:"\F1748"}.mdi-mortar-pestle-plus::before{content:"\F03F1"}.mdi-mosque::before{content:"\F0D45"}.mdi-mosque-outline::before{content:"\F1827"}.mdi-mother-heart::before{content:"\F1314"}.mdi-mother-nurse::before{content:"\F0D21"}.mdi-motion::before{content:"\F15B2"}.mdi-motion-outline::before{content:"\F15B3"}.mdi-motion-pause::before{content:"\F1590"}.mdi-motion-pause-outline::before{content:"\F1592"}.mdi-motion-play::before{content:"\F158F"}.mdi-motion-play-outline::before{content:"\F1591"}.mdi-motion-sensor::before{content:"\F0D91"}.mdi-motion-sensor-off::before{content:"\F1435"}.mdi-motorbike::before{content:"\F037C"}.mdi-motorbike-electric::before{content:"\F15BA"}.mdi-motorbike-off::before{content:"\F1B16"}.mdi-mouse::before{content:"\F037D"}.mdi-mouse-bluetooth::before{content:"\F098B"}.mdi-mouse-left-click::before{content:"\F1D07"}.mdi-mouse-left-click-outline::before{content:"\F1D08"}.mdi-mouse-move-down::before{content:"\F1550"}.mdi-mouse-move-up::before{content:"\F1551"}.mdi-mouse-move-vertical::before{content:"\F1552"}.mdi-mouse-off::before{content:"\F037E"}.mdi-mouse-outline::before{content:"\F1D09"}.mdi-mouse-right-click::before{content:"\F1D0A"}.mdi-mouse-right-click-outline::before{content:"\F1D0B"}.mdi-mouse-scroll-wheel::before{content:"\F1D0C"}.mdi-mouse-variant::before{content:"\F037F"}.mdi-mouse-variant-off::before{content:"\F0380"}.mdi-move-resize::before{content:"\F0655"}.mdi-move-resize-variant::before{content:"\F0656"}.mdi-movie::before{content:"\F0381"}.mdi-movie-check::before{content:"\F16F3"}.mdi-movie-check-outline::before{content:"\F16F4"}.mdi-movie-cog::before{content:"\F16F5"}.mdi-movie-cog-outline::before{content:"\F16F6"}.mdi-movie-edit::before{content:"\F1122"}.mdi-movie-edit-outline::before{content:"\F1123"}.mdi-movie-filter::before{content:"\F1124"}.mdi-movie-filter-outline::before{content:"\F1125"}.mdi-movie-minus::before{content:"\F16F7"}.mdi-movie-minus-outline::before{content:"\F16F8"}.mdi-movie-off::before{content:"\F16F9"}.mdi-movie-off-outline::before{content:"\F16FA"}.mdi-movie-open::before{content:"\F0FCE"}.mdi-movie-open-check::before{content:"\F16FB"}.mdi-movie-open-check-outline::before{content:"\F16FC"}.mdi-movie-open-cog::before{content:"\F16FD"}.mdi-movie-open-cog-outline::before{content:"\F16FE"}.mdi-movie-open-edit::before{content:"\F16FF"}.mdi-movie-open-edit-outline::before{content:"\F1700"}.mdi-movie-open-minus::before{content:"\F1701"}.mdi-movie-open-minus-outline::before{content:"\F1702"}.mdi-movie-open-off::before{content:"\F1703"}.mdi-movie-open-off-outline::before{content:"\F1704"}.mdi-movie-open-outline::before{content:"\F0FCF"}.mdi-movie-open-play::before{content:"\F1705"}.mdi-movie-open-play-outline::before{content:"\F1706"}.mdi-movie-open-plus::before{content:"\F1707"}.mdi-movie-open-plus-outline::before{content:"\F1708"}.mdi-movie-open-remove::before{content:"\F1709"}.mdi-movie-open-remove-outline::before{content:"\F170A"}.mdi-movie-open-settings::before{content:"\F170B"}.mdi-movie-open-settings-outline::before{content:"\F170C"}.mdi-movie-open-star::before{content:"\F170D"}.mdi-movie-open-star-outline::before{content:"\F170E"}.mdi-movie-outline::before{content:"\F0DDD"}.mdi-movie-play::before{content:"\F170F"}.mdi-movie-play-outline::before{content:"\F1710"}.mdi-movie-plus::before{content:"\F1711"}.mdi-movie-plus-outline::before{content:"\F1712"}.mdi-movie-remove::before{content:"\F1713"}.mdi-movie-remove-outline::before{content:"\F1714"}.mdi-movie-roll::before{content:"\F07DE"}.mdi-movie-search::before{content:"\F11D2"}.mdi-movie-search-outline::before{content:"\F11D3"}.mdi-movie-settings::before{content:"\F1715"}.mdi-movie-settings-outline::before{content:"\F1716"}.mdi-movie-star::before{content:"\F1717"}.mdi-movie-star-outline::before{content:"\F1718"}.mdi-mower::before{content:"\F166F"}.mdi-mower-bag::before{content:"\F1670"}.mdi-mower-bag-on::before{content:"\F1B60"}.mdi-mower-on::before{content:"\F1B5F"}.mdi-muffin::before{content:"\F098C"}.mdi-multicast::before{content:"\F1893"}.mdi-multimedia::before{content:"\F1B97"}.mdi-multiplication::before{content:"\F0382"}.mdi-multiplication-box::before{content:"\F0383"}.mdi-mushroom::before{content:"\F07DF"}.mdi-mushroom-off::before{content:"\F13FA"}.mdi-mushroom-off-outline::before{content:"\F13FB"}.mdi-mushroom-outline::before{content:"\F07E0"}.mdi-music::before{content:"\F075A"}.mdi-music-accidental-double-flat::before{content:"\F0F69"}.mdi-music-accidental-double-sharp::before{content:"\F0F6A"}.mdi-music-accidental-flat::before{content:"\F0F6B"}.mdi-music-accidental-natural::before{content:"\F0F6C"}.mdi-music-accidental-sharp::before{content:"\F0F6D"}.mdi-music-box::before{content:"\F0384"}.mdi-music-box-multiple::before{content:"\F0333"}.mdi-music-box-multiple-outline::before{content:"\F0F04"}.mdi-music-box-outline::before{content:"\F0385"}.mdi-music-circle::before{content:"\F0386"}.mdi-music-circle-outline::before{content:"\F0AD4"}.mdi-music-clef-alto::before{content:"\F0F6E"}.mdi-music-clef-bass::before{content:"\F0F6F"}.mdi-music-clef-treble::before{content:"\F0F70"}.mdi-music-note::before{content:"\F0387"}.mdi-music-note-bluetooth::before{content:"\F05FE"}.mdi-music-note-bluetooth-off::before{content:"\F05FF"}.mdi-music-note-eighth::before{content:"\F0388"}.mdi-music-note-eighth-dotted::before{content:"\F0F71"}.mdi-music-note-half::before{content:"\F0389"}.mdi-music-note-half-dotted::before{content:"\F0F72"}.mdi-music-note-minus::before{content:"\F1B89"}.mdi-music-note-off::before{content:"\F038A"}.mdi-music-note-off-outline::before{content:"\F0F73"}.mdi-music-note-outline::before{content:"\F0F74"}.mdi-music-note-plus::before{content:"\F0DDE"}.mdi-music-note-quarter::before{content:"\F038B"}.mdi-music-note-quarter-dotted::before{content:"\F0F75"}.mdi-music-note-sixteenth::before{content:"\F038C"}.mdi-music-note-sixteenth-dotted::before{content:"\F0F76"}.mdi-music-note-whole::before{content:"\F038D"}.mdi-music-note-whole-dotted::before{content:"\F0F77"}.mdi-music-off::before{content:"\F075B"}.mdi-music-rest-eighth::before{content:"\F0F78"}.mdi-music-rest-half::before{content:"\F0F79"}.mdi-music-rest-quarter::before{content:"\F0F7A"}.mdi-music-rest-sixteenth::before{content:"\F0F7B"}.mdi-music-rest-whole::before{content:"\F0F7C"}.mdi-mustache::before{content:"\F15DE"}.mdi-nail::before{content:"\F0DDF"}.mdi-nas::before{content:"\F08F3"}.mdi-nativescript::before{content:"\F0880"}.mdi-nature::before{content:"\F038E"}.mdi-nature-outline::before{content:"\F1C71"}.mdi-nature-people::before{content:"\F038F"}.mdi-nature-people-outline::before{content:"\F1C72"}.mdi-navigation::before{content:"\F0390"}.mdi-navigation-outline::before{content:"\F1607"}.mdi-navigation-variant::before{content:"\F18F0"}.mdi-navigation-variant-outline::before{content:"\F18F1"}.mdi-near-me::before{content:"\F05CD"}.mdi-necklace::before{content:"\F0F0B"}.mdi-needle::before{content:"\F0391"}.mdi-needle-off::before{content:"\F19D2"}.mdi-netflix::before{content:"\F0746"}.mdi-network::before{content:"\F06F3"}.mdi-network-off::before{content:"\F0C9B"}.mdi-network-off-outline::before{content:"\F0C9C"}.mdi-network-outline::before{content:"\F0C9D"}.mdi-network-pos::before{content:"\F1ACB"}.mdi-network-strength-1::before{content:"\F08F4"}.mdi-network-strength-1-alert::before{content:"\F08F5"}.mdi-network-strength-2::before{content:"\F08F6"}.mdi-network-strength-2-alert::before{content:"\F08F7"}.mdi-network-strength-3::before{content:"\F08F8"}.mdi-network-strength-3-alert::before{content:"\F08F9"}.mdi-network-strength-4::before{content:"\F08FA"}.mdi-network-strength-4-alert::before{content:"\F08FB"}.mdi-network-strength-4-cog::before{content:"\F191A"}.mdi-network-strength-off::before{content:"\F08FC"}.mdi-network-strength-off-outline::before{content:"\F08FD"}.mdi-network-strength-outline::before{content:"\F08FE"}.mdi-new-box::before{content:"\F0394"}.mdi-newspaper::before{content:"\F0395"}.mdi-newspaper-check::before{content:"\F1943"}.mdi-newspaper-minus::before{content:"\F0F0C"}.mdi-newspaper-plus::before{content:"\F0F0D"}.mdi-newspaper-remove::before{content:"\F1944"}.mdi-newspaper-variant::before{content:"\F1001"}.mdi-newspaper-variant-multiple::before{content:"\F1002"}.mdi-newspaper-variant-multiple-outline::before{content:"\F1003"}.mdi-newspaper-variant-outline::before{content:"\F1004"}.mdi-nfc::before{content:"\F0396"}.mdi-nfc-search-variant::before{content:"\F0E53"}.mdi-nfc-tap::before{content:"\F0397"}.mdi-nfc-variant::before{content:"\F0398"}.mdi-nfc-variant-off::before{content:"\F0E54"}.mdi-ninja::before{content:"\F0774"}.mdi-nintendo-game-boy::before{content:"\F1393"}.mdi-nintendo-switch::before{content:"\F07E1"}.mdi-nintendo-wii::before{content:"\F05AB"}.mdi-nintendo-wiiu::before{content:"\F072D"}.mdi-nix::before{content:"\F1105"}.mdi-nodejs::before{content:"\F0399"}.mdi-noodles::before{content:"\F117E"}.mdi-not-equal::before{content:"\F098D"}.mdi-not-equal-variant::before{content:"\F098E"}.mdi-note::before{content:"\F039A"}.mdi-note-alert::before{content:"\F177D"}.mdi-note-alert-outline::before{content:"\F177E"}.mdi-note-check::before{content:"\F177F"}.mdi-note-check-outline::before{content:"\F1780"}.mdi-note-edit::before{content:"\F1781"}.mdi-note-edit-outline::before{content:"\F1782"}.mdi-note-minus::before{content:"\F164F"}.mdi-note-minus-outline::before{content:"\F1650"}.mdi-note-multiple::before{content:"\F06B8"}.mdi-note-multiple-outline::before{content:"\F06B9"}.mdi-note-off::before{content:"\F1783"}.mdi-note-off-outline::before{content:"\F1784"}.mdi-note-outline::before{content:"\F039B"}.mdi-note-plus::before{content:"\F039C"}.mdi-note-plus-outline::before{content:"\F039D"}.mdi-note-remove::before{content:"\F1651"}.mdi-note-remove-outline::before{content:"\F1652"}.mdi-note-search::before{content:"\F1653"}.mdi-note-search-outline::before{content:"\F1654"}.mdi-note-text::before{content:"\F039E"}.mdi-note-text-outline::before{content:"\F11D7"}.mdi-notebook::before{content:"\F082E"}.mdi-notebook-check::before{content:"\F14F5"}.mdi-notebook-check-outline::before{content:"\F14F6"}.mdi-notebook-edit::before{content:"\F14E7"}.mdi-notebook-edit-outline::before{content:"\F14E9"}.mdi-notebook-heart::before{content:"\F1A0B"}.mdi-notebook-heart-outline::before{content:"\F1A0C"}.mdi-notebook-minus::before{content:"\F1610"}.mdi-notebook-minus-outline::before{content:"\F1611"}.mdi-notebook-multiple::before{content:"\F0E55"}.mdi-notebook-outline::before{content:"\F0EBF"}.mdi-notebook-plus::before{content:"\F1612"}.mdi-notebook-plus-outline::before{content:"\F1613"}.mdi-notebook-remove::before{content:"\F1614"}.mdi-notebook-remove-outline::before{content:"\F1615"}.mdi-notification-clear-all::before{content:"\F039F"}.mdi-npm::before{content:"\F06F7"}.mdi-nuke::before{content:"\F06A4"}.mdi-null::before{content:"\F07E2"}.mdi-numeric::before{content:"\F03A0"}.mdi-numeric-0::before{content:"\F0B39"}.mdi-numeric-0-box::before{content:"\F03A1"}.mdi-numeric-0-box-multiple::before{content:"\F0F0E"}.mdi-numeric-0-box-multiple-outline::before{content:"\F03A2"}.mdi-numeric-0-box-outline::before{content:"\F03A3"}.mdi-numeric-0-circle::before{content:"\F0C9E"}.mdi-numeric-0-circle-outline::before{content:"\F0C9F"}.mdi-numeric-1::before{content:"\F0B3A"}.mdi-numeric-1-box::before{content:"\F03A4"}.mdi-numeric-1-box-multiple::before{content:"\F0F0F"}.mdi-numeric-1-box-multiple-outline::before{content:"\F03A5"}.mdi-numeric-1-box-outline::before{content:"\F03A6"}.mdi-numeric-1-circle::before{content:"\F0CA0"}.mdi-numeric-1-circle-outline::before{content:"\F0CA1"}.mdi-numeric-10::before{content:"\F0FE9"}.mdi-numeric-10-box::before{content:"\F0F7D"}.mdi-numeric-10-box-multiple::before{content:"\F0FEA"}.mdi-numeric-10-box-multiple-outline::before{content:"\F0FEB"}.mdi-numeric-10-box-outline::before{content:"\F0F7E"}.mdi-numeric-10-circle::before{content:"\F0FEC"}.mdi-numeric-10-circle-outline::before{content:"\F0FED"}.mdi-numeric-2::before{content:"\F0B3B"}.mdi-numeric-2-box::before{content:"\F03A7"}.mdi-numeric-2-box-multiple::before{content:"\F0F10"}.mdi-numeric-2-box-multiple-outline::before{content:"\F03A8"}.mdi-numeric-2-box-outline::before{content:"\F03A9"}.mdi-numeric-2-circle::before{content:"\F0CA2"}.mdi-numeric-2-circle-outline::before{content:"\F0CA3"}.mdi-numeric-3::before{content:"\F0B3C"}.mdi-numeric-3-box::before{content:"\F03AA"}.mdi-numeric-3-box-multiple::before{content:"\F0F11"}.mdi-numeric-3-box-multiple-outline::before{content:"\F03AB"}.mdi-numeric-3-box-outline::before{content:"\F03AC"}.mdi-numeric-3-circle::before{content:"\F0CA4"}.mdi-numeric-3-circle-outline::before{content:"\F0CA5"}.mdi-numeric-4::before{content:"\F0B3D"}.mdi-numeric-4-box::before{content:"\F03AD"}.mdi-numeric-4-box-multiple::before{content:"\F0F12"}.mdi-numeric-4-box-multiple-outline::before{content:"\F03B2"}.mdi-numeric-4-box-outline::before{content:"\F03AE"}.mdi-numeric-4-circle::before{content:"\F0CA6"}.mdi-numeric-4-circle-outline::before{content:"\F0CA7"}.mdi-numeric-5::before{content:"\F0B3E"}.mdi-numeric-5-box::before{content:"\F03B1"}.mdi-numeric-5-box-multiple::before{content:"\F0F13"}.mdi-numeric-5-box-multiple-outline::before{content:"\F03AF"}.mdi-numeric-5-box-outline::before{content:"\F03B0"}.mdi-numeric-5-circle::before{content:"\F0CA8"}.mdi-numeric-5-circle-outline::before{content:"\F0CA9"}.mdi-numeric-6::before{content:"\F0B3F"}.mdi-numeric-6-box::before{content:"\F03B3"}.mdi-numeric-6-box-multiple::before{content:"\F0F14"}.mdi-numeric-6-box-multiple-outline::before{content:"\F03B4"}.mdi-numeric-6-box-outline::before{content:"\F03B5"}.mdi-numeric-6-circle::before{content:"\F0CAA"}.mdi-numeric-6-circle-outline::before{content:"\F0CAB"}.mdi-numeric-7::before{content:"\F0B40"}.mdi-numeric-7-box::before{content:"\F03B6"}.mdi-numeric-7-box-multiple::before{content:"\F0F15"}.mdi-numeric-7-box-multiple-outline::before{content:"\F03B7"}.mdi-numeric-7-box-outline::before{content:"\F03B8"}.mdi-numeric-7-circle::before{content:"\F0CAC"}.mdi-numeric-7-circle-outline::before{content:"\F0CAD"}.mdi-numeric-8::before{content:"\F0B41"}.mdi-numeric-8-box::before{content:"\F03B9"}.mdi-numeric-8-box-multiple::before{content:"\F0F16"}.mdi-numeric-8-box-multiple-outline::before{content:"\F03BA"}.mdi-numeric-8-box-outline::before{content:"\F03BB"}.mdi-numeric-8-circle::before{content:"\F0CAE"}.mdi-numeric-8-circle-outline::before{content:"\F0CAF"}.mdi-numeric-9::before{content:"\F0B42"}.mdi-numeric-9-box::before{content:"\F03BC"}.mdi-numeric-9-box-multiple::before{content:"\F0F17"}.mdi-numeric-9-box-multiple-outline::before{content:"\F03BD"}.mdi-numeric-9-box-outline::before{content:"\F03BE"}.mdi-numeric-9-circle::before{content:"\F0CB0"}.mdi-numeric-9-circle-outline::before{content:"\F0CB1"}.mdi-numeric-9-plus::before{content:"\F0FEE"}.mdi-numeric-9-plus-box::before{content:"\F03BF"}.mdi-numeric-9-plus-box-multiple::before{content:"\F0F18"}.mdi-numeric-9-plus-box-multiple-outline::before{content:"\F03C0"}.mdi-numeric-9-plus-box-outline::before{content:"\F03C1"}.mdi-numeric-9-plus-circle::before{content:"\F0CB2"}.mdi-numeric-9-plus-circle-outline::before{content:"\F0CB3"}.mdi-numeric-negative-1::before{content:"\F1052"}.mdi-numeric-off::before{content:"\F19D3"}.mdi-numeric-positive-1::before{content:"\F15CB"}.mdi-nut::before{content:"\F06F8"}.mdi-nutrition::before{content:"\F03C2"}.mdi-nuxt::before{content:"\F1106"}.mdi-oar::before{content:"\F067C"}.mdi-ocarina::before{content:"\F0DE0"}.mdi-oci::before{content:"\F12E9"}.mdi-ocr::before{content:"\F113A"}.mdi-octagon::before{content:"\F03C3"}.mdi-octagon-outline::before{content:"\F03C4"}.mdi-octagram::before{content:"\F06F9"}.mdi-octagram-edit::before{content:"\F1C34"}.mdi-octagram-edit-outline::before{content:"\F1C35"}.mdi-octagram-minus::before{content:"\F1C36"}.mdi-octagram-minus-outline::before{content:"\F1C37"}.mdi-octagram-outline::before{content:"\F0775"}.mdi-octagram-plus::before{content:"\F1C38"}.mdi-octagram-plus-outline::before{content:"\F1C39"}.mdi-octahedron::before{content:"\F1950"}.mdi-octahedron-off::before{content:"\F1951"}.mdi-odnoklassniki::before{content:"\F03C5"}.mdi-offer::before{content:"\F121B"}.mdi-office-building::before{content:"\F0991"}.mdi-office-building-cog::before{content:"\F1949"}.mdi-office-building-cog-outline::before{content:"\F194A"}.mdi-office-building-marker::before{content:"\F1520"}.mdi-office-building-marker-outline::before{content:"\F1521"}.mdi-office-building-minus::before{content:"\F1BAA"}.mdi-office-building-minus-outline::before{content:"\F1BAB"}.mdi-office-building-outline::before{content:"\F151F"}.mdi-office-building-plus::before{content:"\F1BA8"}.mdi-office-building-plus-outline::before{content:"\F1BA9"}.mdi-office-building-remove::before{content:"\F1BAC"}.mdi-office-building-remove-outline::before{content:"\F1BAD"}.mdi-oil::before{content:"\F03C7"}.mdi-oil-lamp::before{content:"\F0F19"}.mdi-oil-level::before{content:"\F1053"}.mdi-oil-temperature::before{content:"\F0FF8"}.mdi-om::before{content:"\F0973"}.mdi-omega::before{content:"\F03C9"}.mdi-one-up::before{content:"\F0BAD"}.mdi-onepassword::before{content:"\F0881"}.mdi-opacity::before{content:"\F05CC"}.mdi-open-in-app::before{content:"\F03CB"}.mdi-open-in-new::before{content:"\F03CC"}.mdi-open-source-initiative::before{content:"\F0BAE"}.mdi-openid::before{content:"\F03CD"}.mdi-opera::before{content:"\F03CE"}.mdi-orbit::before{content:"\F0018"}.mdi-orbit-variant::before{content:"\F15DB"}.mdi-order-alphabetical-ascending::before{content:"\F020D"}.mdi-order-alphabetical-descending::before{content:"\F0D07"}.mdi-order-bool-ascending::before{content:"\F02BE"}.mdi-order-bool-ascending-variant::before{content:"\F098F"}.mdi-order-bool-descending::before{content:"\F1384"}.mdi-order-bool-descending-variant::before{content:"\F0990"}.mdi-order-numeric-ascending::before{content:"\F0545"}.mdi-order-numeric-descending::before{content:"\F0546"}.mdi-origin::before{content:"\F0B43"}.mdi-ornament::before{content:"\F03CF"}.mdi-ornament-variant::before{content:"\F03D0"}.mdi-outdoor-lamp::before{content:"\F1054"}.mdi-overscan::before{content:"\F1005"}.mdi-owl::before{content:"\F03D2"}.mdi-pac-man::before{content:"\F0BAF"}.mdi-package::before{content:"\F03D3"}.mdi-package-check::before{content:"\F1B51"}.mdi-package-down::before{content:"\F03D4"}.mdi-package-up::before{content:"\F03D5"}.mdi-package-variant::before{content:"\F03D6"}.mdi-package-variant-closed::before{content:"\F03D7"}.mdi-package-variant-closed-check::before{content:"\F1B52"}.mdi-package-variant-closed-minus::before{content:"\F19D4"}.mdi-package-variant-closed-plus::before{content:"\F19D5"}.mdi-package-variant-closed-remove::before{content:"\F19D6"}.mdi-package-variant-minus::before{content:"\F19D7"}.mdi-package-variant-plus::before{content:"\F19D8"}.mdi-package-variant-remove::before{content:"\F19D9"}.mdi-page-first::before{content:"\F0600"}.mdi-page-last::before{content:"\F0601"}.mdi-page-layout-body::before{content:"\F06FA"}.mdi-page-layout-footer::before{content:"\F06FB"}.mdi-page-layout-header::before{content:"\F06FC"}.mdi-page-layout-header-footer::before{content:"\F0F7F"}.mdi-page-layout-sidebar-left::before{content:"\F06FD"}.mdi-page-layout-sidebar-right::before{content:"\F06FE"}.mdi-page-next::before{content:"\F0BB0"}.mdi-page-next-outline::before{content:"\F0BB1"}.mdi-page-previous::before{content:"\F0BB2"}.mdi-page-previous-outline::before{content:"\F0BB3"}.mdi-pail::before{content:"\F1417"}.mdi-pail-minus::before{content:"\F1437"}.mdi-pail-minus-outline::before{content:"\F143C"}.mdi-pail-off::before{content:"\F1439"}.mdi-pail-off-outline::before{content:"\F143E"}.mdi-pail-outline::before{content:"\F143A"}.mdi-pail-plus::before{content:"\F1436"}.mdi-pail-plus-outline::before{content:"\F143B"}.mdi-pail-remove::before{content:"\F1438"}.mdi-pail-remove-outline::before{content:"\F143D"}.mdi-palette::before{content:"\F03D8"}.mdi-palette-advanced::before{content:"\F03D9"}.mdi-palette-outline::before{content:"\F0E0C"}.mdi-palette-swatch::before{content:"\F08B5"}.mdi-palette-swatch-outline::before{content:"\F135C"}.mdi-palette-swatch-variant::before{content:"\F195A"}.mdi-palm-tree::before{content:"\F1055"}.mdi-pan::before{content:"\F0BB4"}.mdi-pan-bottom-left::before{content:"\F0BB5"}.mdi-pan-bottom-right::before{content:"\F0BB6"}.mdi-pan-down::before{content:"\F0BB7"}.mdi-pan-horizontal::before{content:"\F0BB8"}.mdi-pan-left::before{content:"\F0BB9"}.mdi-pan-right::before{content:"\F0BBA"}.mdi-pan-top-left::before{content:"\F0BBB"}.mdi-pan-top-right::before{content:"\F0BBC"}.mdi-pan-up::before{content:"\F0BBD"}.mdi-pan-vertical::before{content:"\F0BBE"}.mdi-panda::before{content:"\F03DA"}.mdi-pandora::before{content:"\F03DB"}.mdi-panorama::before{content:"\F03DC"}.mdi-panorama-fisheye::before{content:"\F03DD"}.mdi-panorama-horizontal::before{content:"\F1928"}.mdi-panorama-horizontal-outline::before{content:"\F03DE"}.mdi-panorama-outline::before{content:"\F198C"}.mdi-panorama-sphere::before{content:"\F198D"}.mdi-panorama-sphere-outline::before{content:"\F198E"}.mdi-panorama-variant::before{content:"\F198F"}.mdi-panorama-variant-outline::before{content:"\F1990"}.mdi-panorama-vertical::before{content:"\F1929"}.mdi-panorama-vertical-outline::before{content:"\F03DF"}.mdi-panorama-wide-angle::before{content:"\F195F"}.mdi-panorama-wide-angle-outline::before{content:"\F03E0"}.mdi-paper-cut-vertical::before{content:"\F03E1"}.mdi-paper-roll::before{content:"\F1157"}.mdi-paper-roll-outline::before{content:"\F1158"}.mdi-paperclip::before{content:"\F03E2"}.mdi-paperclip-check::before{content:"\F1AC6"}.mdi-paperclip-lock::before{content:"\F19DA"}.mdi-paperclip-minus::before{content:"\F1AC7"}.mdi-paperclip-off::before{content:"\F1AC8"}.mdi-paperclip-plus::before{content:"\F1AC9"}.mdi-paperclip-remove::before{content:"\F1ACA"}.mdi-parachute::before{content:"\F0CB4"}.mdi-parachute-outline::before{content:"\F0CB5"}.mdi-paragliding::before{content:"\F1745"}.mdi-parking::before{content:"\F03E3"}.mdi-party-popper::before{content:"\F1056"}.mdi-passport::before{content:"\F07E3"}.mdi-passport-alert::before{content:"\F1CB8"}.mdi-passport-biometric::before{content:"\F0DE1"}.mdi-passport-cancel::before{content:"\F1CB9"}.mdi-passport-check::before{content:"\F1CBA"}.mdi-passport-minus::before{content:"\F1CBB"}.mdi-passport-plus::before{content:"\F1CBC"}.mdi-passport-remove::before{content:"\F1CBD"}.mdi-pasta::before{content:"\F1160"}.mdi-patio-heater::before{content:"\F0F80"}.mdi-patreon::before{content:"\F0882"}.mdi-pause::before{content:"\F03E4"}.mdi-pause-box::before{content:"\F00BC"}.mdi-pause-box-outline::before{content:"\F1B7A"}.mdi-pause-circle::before{content:"\F03E5"}.mdi-pause-circle-outline::before{content:"\F03E6"}.mdi-pause-octagon::before{content:"\F03E7"}.mdi-pause-octagon-outline::before{content:"\F03E8"}.mdi-paw::before{content:"\F03E9"}.mdi-paw-off::before{content:"\F0657"}.mdi-paw-off-outline::before{content:"\F1676"}.mdi-paw-outline::before{content:"\F1675"}.mdi-peace::before{content:"\F0884"}.mdi-peanut::before{content:"\F0FFC"}.mdi-peanut-off::before{content:"\F0FFD"}.mdi-peanut-off-outline::before{content:"\F0FFF"}.mdi-peanut-outline::before{content:"\F0FFE"}.mdi-pen::before{content:"\F03EA"}.mdi-pen-lock::before{content:"\F0DE2"}.mdi-pen-minus::before{content:"\F0DE3"}.mdi-pen-off::before{content:"\F0DE4"}.mdi-pen-plus::before{content:"\F0DE5"}.mdi-pen-remove::before{content:"\F0DE6"}.mdi-pencil::before{content:"\F03EB"}.mdi-pencil-box::before{content:"\F03EC"}.mdi-pencil-box-multiple::before{content:"\F1144"}.mdi-pencil-box-multiple-outline::before{content:"\F1145"}.mdi-pencil-box-outline::before{content:"\F03ED"}.mdi-pencil-circle::before{content:"\F06FF"}.mdi-pencil-circle-outline::before{content:"\F0776"}.mdi-pencil-lock::before{content:"\F03EE"}.mdi-pencil-lock-outline::before{content:"\F0DE7"}.mdi-pencil-minus::before{content:"\F0DE8"}.mdi-pencil-minus-outline::before{content:"\F0DE9"}.mdi-pencil-off::before{content:"\F03EF"}.mdi-pencil-off-outline::before{content:"\F0DEA"}.mdi-pencil-outline::before{content:"\F0CB6"}.mdi-pencil-plus::before{content:"\F0DEB"}.mdi-pencil-plus-outline::before{content:"\F0DEC"}.mdi-pencil-remove::before{content:"\F0DED"}.mdi-pencil-remove-outline::before{content:"\F0DEE"}.mdi-pencil-ruler::before{content:"\F1353"}.mdi-pencil-ruler-outline::before{content:"\F1C11"}.mdi-penguin::before{content:"\F0EC0"}.mdi-pentagon::before{content:"\F0701"}.mdi-pentagon-outline::before{content:"\F0700"}.mdi-pentagram::before{content:"\F1667"}.mdi-percent::before{content:"\F03F0"}.mdi-percent-box::before{content:"\F1A02"}.mdi-percent-box-outline::before{content:"\F1A03"}.mdi-percent-circle::before{content:"\F1A04"}.mdi-percent-circle-outline::before{content:"\F1A05"}.mdi-percent-outline::before{content:"\F1278"}.mdi-periodic-table::before{content:"\F08B6"}.mdi-perspective-less::before{content:"\F0D23"}.mdi-perspective-more::before{content:"\F0D24"}.mdi-ph::before{content:"\F17C5"}.mdi-phone::before{content:"\F03F2"}.mdi-phone-alert::before{content:"\F0F1A"}.mdi-phone-alert-outline::before{content:"\F118E"}.mdi-phone-bluetooth::before{content:"\F03F3"}.mdi-phone-bluetooth-outline::before{content:"\F118F"}.mdi-phone-cancel::before{content:"\F10BC"}.mdi-phone-cancel-outline::before{content:"\F1190"}.mdi-phone-check::before{content:"\F11A9"}.mdi-phone-check-outline::before{content:"\F11AA"}.mdi-phone-classic::before{content:"\F0602"}.mdi-phone-classic-off::before{content:"\F1279"}.mdi-phone-clock::before{content:"\F19DB"}.mdi-phone-dial::before{content:"\F1559"}.mdi-phone-dial-outline::before{content:"\F155A"}.mdi-phone-forward::before{content:"\F03F4"}.mdi-phone-forward-outline::before{content:"\F1191"}.mdi-phone-hangup::before{content:"\F03F5"}.mdi-phone-hangup-outline::before{content:"\F1192"}.mdi-phone-in-talk::before{content:"\F03F6"}.mdi-phone-in-talk-outline::before{content:"\F1182"}.mdi-phone-incoming::before{content:"\F03F7"}.mdi-phone-incoming-outgoing::before{content:"\F1B3F"}.mdi-phone-incoming-outgoing-outline::before{content:"\F1B40"}.mdi-phone-incoming-outline::before{content:"\F1193"}.mdi-phone-lock::before{content:"\F03F8"}.mdi-phone-lock-outline::before{content:"\F1194"}.mdi-phone-log::before{content:"\F03F9"}.mdi-phone-log-outline::before{content:"\F1195"}.mdi-phone-message::before{content:"\F1196"}.mdi-phone-message-outline::before{content:"\F1197"}.mdi-phone-minus::before{content:"\F0658"}.mdi-phone-minus-outline::before{content:"\F1198"}.mdi-phone-missed::before{content:"\F03FA"}.mdi-phone-missed-outline::before{content:"\F11A5"}.mdi-phone-off::before{content:"\F0DEF"}.mdi-phone-off-outline::before{content:"\F11A6"}.mdi-phone-outgoing::before{content:"\F03FB"}.mdi-phone-outgoing-outline::before{content:"\F1199"}.mdi-phone-outline::before{content:"\F0DF0"}.mdi-phone-paused::before{content:"\F03FC"}.mdi-phone-paused-outline::before{content:"\F119A"}.mdi-phone-plus::before{content:"\F0659"}.mdi-phone-plus-outline::before{content:"\F119B"}.mdi-phone-refresh::before{content:"\F1993"}.mdi-phone-refresh-outline::before{content:"\F1994"}.mdi-phone-remove::before{content:"\F152F"}.mdi-phone-remove-outline::before{content:"\F1530"}.mdi-phone-return::before{content:"\F082F"}.mdi-phone-return-outline::before{content:"\F119C"}.mdi-phone-ring::before{content:"\F11AB"}.mdi-phone-ring-outline::before{content:"\F11AC"}.mdi-phone-rotate-landscape::before{content:"\F0885"}.mdi-phone-rotate-portrait::before{content:"\F0886"}.mdi-phone-settings::before{content:"\F03FD"}.mdi-phone-settings-outline::before{content:"\F119D"}.mdi-phone-sync::before{content:"\F1995"}.mdi-phone-sync-outline::before{content:"\F1996"}.mdi-phone-voip::before{content:"\F03FE"}.mdi-pi::before{content:"\F03FF"}.mdi-pi-box::before{content:"\F0400"}.mdi-pi-hole::before{content:"\F0DF1"}.mdi-piano::before{content:"\F067D"}.mdi-piano-off::before{content:"\F0698"}.mdi-pickaxe::before{content:"\F08B7"}.mdi-picture-in-picture-bottom-right::before{content:"\F0E57"}.mdi-picture-in-picture-bottom-right-outline::before{content:"\F0E58"}.mdi-picture-in-picture-top-right::before{content:"\F0E59"}.mdi-picture-in-picture-top-right-outline::before{content:"\F0E5A"}.mdi-pier::before{content:"\F0887"}.mdi-pier-crane::before{content:"\F0888"}.mdi-pig::before{content:"\F0401"}.mdi-pig-variant::before{content:"\F1006"}.mdi-pig-variant-outline::before{content:"\F1678"}.mdi-piggy-bank::before{content:"\F1007"}.mdi-piggy-bank-outline::before{content:"\F1679"}.mdi-pill::before{content:"\F0402"}.mdi-pill-multiple::before{content:"\F1B4C"}.mdi-pill-off::before{content:"\F1A5C"}.mdi-pillar::before{content:"\F0702"}.mdi-pin::before{content:"\F0403"}.mdi-pin-off::before{content:"\F0404"}.mdi-pin-off-outline::before{content:"\F0930"}.mdi-pin-outline::before{content:"\F0931"}.mdi-pine-tree::before{content:"\F0405"}.mdi-pine-tree-box::before{content:"\F0406"}.mdi-pine-tree-fire::before{content:"\F141A"}.mdi-pine-tree-variant::before{content:"\F1C73"}.mdi-pine-tree-variant-outline::before{content:"\F1C74"}.mdi-pinterest::before{content:"\F0407"}.mdi-pinwheel::before{content:"\F0AD5"}.mdi-pinwheel-outline::before{content:"\F0AD6"}.mdi-pipe::before{content:"\F07E5"}.mdi-pipe-disconnected::before{content:"\F07E6"}.mdi-pipe-leak::before{content:"\F0889"}.mdi-pipe-valve::before{content:"\F184D"}.mdi-pipe-wrench::before{content:"\F1354"}.mdi-pirate::before{content:"\F0A08"}.mdi-pistol::before{content:"\F0703"}.mdi-piston::before{content:"\F088A"}.mdi-pitchfork::before{content:"\F1553"}.mdi-pizza::before{content:"\F0409"}.mdi-plane-car::before{content:"\F1AFF"}.mdi-plane-train::before{content:"\F1B00"}.mdi-play::before{content:"\F040A"}.mdi-play-box::before{content:"\F127A"}.mdi-play-box-edit-outline::before{content:"\F1C3A"}.mdi-play-box-lock::before{content:"\F1A16"}.mdi-play-box-lock-open::before{content:"\F1A17"}.mdi-play-box-lock-open-outline::before{content:"\F1A18"}.mdi-play-box-lock-outline::before{content:"\F1A19"}.mdi-play-box-multiple::before{content:"\F0D19"}.mdi-play-box-multiple-outline::before{content:"\F13E6"}.mdi-play-box-outline::before{content:"\F040B"}.mdi-play-circle::before{content:"\F040C"}.mdi-play-circle-outline::before{content:"\F040D"}.mdi-play-network::before{content:"\F088B"}.mdi-play-network-outline::before{content:"\F0CB7"}.mdi-play-outline::before{content:"\F0F1B"}.mdi-play-pause::before{content:"\F040E"}.mdi-play-protected-content::before{content:"\F040F"}.mdi-play-speed::before{content:"\F08FF"}.mdi-playlist-check::before{content:"\F05C7"}.mdi-playlist-edit::before{content:"\F0900"}.mdi-playlist-minus::before{content:"\F0410"}.mdi-playlist-music::before{content:"\F0CB8"}.mdi-playlist-music-outline::before{content:"\F0CB9"}.mdi-playlist-play::before{content:"\F0411"}.mdi-playlist-plus::before{content:"\F0412"}.mdi-playlist-remove::before{content:"\F0413"}.mdi-playlist-star::before{content:"\F0DF2"}.mdi-plex::before{content:"\F06BA"}.mdi-pliers::before{content:"\F19A4"}.mdi-plus::before{content:"\F0415"}.mdi-plus-box::before{content:"\F0416"}.mdi-plus-box-multiple::before{content:"\F0334"}.mdi-plus-box-multiple-outline::before{content:"\F1143"}.mdi-plus-box-outline::before{content:"\F0704"}.mdi-plus-circle::before{content:"\F0417"}.mdi-plus-circle-multiple::before{content:"\F034C"}.mdi-plus-circle-multiple-outline::before{content:"\F0418"}.mdi-plus-circle-outline::before{content:"\F0419"}.mdi-plus-lock::before{content:"\F1A5D"}.mdi-plus-lock-open::before{content:"\F1A5E"}.mdi-plus-minus::before{content:"\F0992"}.mdi-plus-minus-box::before{content:"\F0993"}.mdi-plus-minus-variant::before{content:"\F14C9"}.mdi-plus-network::before{content:"\F041A"}.mdi-plus-network-outline::before{content:"\F0CBA"}.mdi-plus-outline::before{content:"\F0705"}.mdi-plus-thick::before{content:"\F11EC"}.mdi-pocket::before{content:"\F1CBE"}.mdi-podcast::before{content:"\F0994"}.mdi-podium::before{content:"\F0D25"}.mdi-podium-bronze::before{content:"\F0D26"}.mdi-podium-gold::before{content:"\F0D27"}.mdi-podium-silver::before{content:"\F0D28"}.mdi-point-of-sale::before{content:"\F0D92"}.mdi-pokeball::before{content:"\F041D"}.mdi-pokemon-go::before{content:"\F0A09"}.mdi-poker-chip::before{content:"\F0830"}.mdi-polaroid::before{content:"\F041E"}.mdi-police-badge::before{content:"\F1167"}.mdi-police-badge-outline::before{content:"\F1168"}.mdi-police-station::before{content:"\F1839"}.mdi-poll::before{content:"\F041F"}.mdi-polo::before{content:"\F14C3"}.mdi-polymer::before{content:"\F0421"}.mdi-pool::before{content:"\F0606"}.mdi-pool-thermometer::before{content:"\F1A5F"}.mdi-popcorn::before{content:"\F0422"}.mdi-post::before{content:"\F1008"}.mdi-post-lamp::before{content:"\F1A60"}.mdi-post-outline::before{content:"\F1009"}.mdi-postage-stamp::before{content:"\F0CBB"}.mdi-pot::before{content:"\F02E5"}.mdi-pot-mix::before{content:"\F065B"}.mdi-pot-mix-outline::before{content:"\F0677"}.mdi-pot-outline::before{content:"\F02FF"}.mdi-pot-steam::before{content:"\F065A"}.mdi-pot-steam-outline::before{content:"\F0326"}.mdi-pound::before{content:"\F0423"}.mdi-pound-box::before{content:"\F0424"}.mdi-pound-box-outline::before{content:"\F117F"}.mdi-power::before{content:"\F0425"}.mdi-power-cycle::before{content:"\F0901"}.mdi-power-off::before{content:"\F0902"}.mdi-power-on::before{content:"\F0903"}.mdi-power-plug::before{content:"\F06A5"}.mdi-power-plug-battery::before{content:"\F1C3B"}.mdi-power-plug-battery-outline::before{content:"\F1C3C"}.mdi-power-plug-off::before{content:"\F06A6"}.mdi-power-plug-off-outline::before{content:"\F1424"}.mdi-power-plug-outline::before{content:"\F1425"}.mdi-power-settings::before{content:"\F0426"}.mdi-power-sleep::before{content:"\F0904"}.mdi-power-socket::before{content:"\F0427"}.mdi-power-socket-au::before{content:"\F0905"}.mdi-power-socket-ch::before{content:"\F0FB3"}.mdi-power-socket-de::before{content:"\F1107"}.mdi-power-socket-eu::before{content:"\F07E7"}.mdi-power-socket-fr::before{content:"\F1108"}.mdi-power-socket-it::before{content:"\F14FF"}.mdi-power-socket-jp::before{content:"\F1109"}.mdi-power-socket-uk::before{content:"\F07E8"}.mdi-power-socket-us::before{content:"\F07E9"}.mdi-power-standby::before{content:"\F0906"}.mdi-powershell::before{content:"\F0A0A"}.mdi-prescription::before{content:"\F0706"}.mdi-presentation::before{content:"\F0428"}.mdi-presentation-play::before{content:"\F0429"}.mdi-pretzel::before{content:"\F1562"}.mdi-printer::before{content:"\F042A"}.mdi-printer-3d::before{content:"\F042B"}.mdi-printer-3d-nozzle::before{content:"\F0E5B"}.mdi-printer-3d-nozzle-alert::before{content:"\F11C0"}.mdi-printer-3d-nozzle-alert-outline::before{content:"\F11C1"}.mdi-printer-3d-nozzle-heat::before{content:"\F18B8"}.mdi-printer-3d-nozzle-heat-outline::before{content:"\F18B9"}.mdi-printer-3d-nozzle-off::before{content:"\F1B19"}.mdi-printer-3d-nozzle-off-outline::before{content:"\F1B1A"}.mdi-printer-3d-nozzle-outline::before{content:"\F0E5C"}.mdi-printer-3d-off::before{content:"\F1B0E"}.mdi-printer-alert::before{content:"\F042C"}.mdi-printer-check::before{content:"\F1146"}.mdi-printer-eye::before{content:"\F1458"}.mdi-printer-off::before{content:"\F0E5D"}.mdi-printer-off-outline::before{content:"\F1785"}.mdi-printer-outline::before{content:"\F1786"}.mdi-printer-pos::before{content:"\F1057"}.mdi-printer-pos-alert::before{content:"\F1BBC"}.mdi-printer-pos-alert-outline::before{content:"\F1BBD"}.mdi-printer-pos-cancel::before{content:"\F1BBE"}.mdi-printer-pos-cancel-outline::before{content:"\F1BBF"}.mdi-printer-pos-check::before{content:"\F1BC0"}.mdi-printer-pos-check-outline::before{content:"\F1BC1"}.mdi-printer-pos-cog::before{content:"\F1BC2"}.mdi-printer-pos-cog-outline::before{content:"\F1BC3"}.mdi-printer-pos-edit::before{content:"\F1BC4"}.mdi-printer-pos-edit-outline::before{content:"\F1BC5"}.mdi-printer-pos-minus::before{content:"\F1BC6"}.mdi-printer-pos-minus-outline::before{content:"\F1BC7"}.mdi-printer-pos-network::before{content:"\F1BC8"}.mdi-printer-pos-network-outline::before{content:"\F1BC9"}.mdi-printer-pos-off::before{content:"\F1BCA"}.mdi-printer-pos-off-outline::before{content:"\F1BCB"}.mdi-printer-pos-outline::before{content:"\F1BCC"}.mdi-printer-pos-pause::before{content:"\F1BCD"}.mdi-printer-pos-pause-outline::before{content:"\F1BCE"}.mdi-printer-pos-play::before{content:"\F1BCF"}.mdi-printer-pos-play-outline::before{content:"\F1BD0"}.mdi-printer-pos-plus::before{content:"\F1BD1"}.mdi-printer-pos-plus-outline::before{content:"\F1BD2"}.mdi-printer-pos-refresh::before{content:"\F1BD3"}.mdi-printer-pos-refresh-outline::before{content:"\F1BD4"}.mdi-printer-pos-remove::before{content:"\F1BD5"}.mdi-printer-pos-remove-outline::before{content:"\F1BD6"}.mdi-printer-pos-star::before{content:"\F1BD7"}.mdi-printer-pos-star-outline::before{content:"\F1BD8"}.mdi-printer-pos-stop::before{content:"\F1BD9"}.mdi-printer-pos-stop-outline::before{content:"\F1BDA"}.mdi-printer-pos-sync::before{content:"\F1BDB"}.mdi-printer-pos-sync-outline::before{content:"\F1BDC"}.mdi-printer-pos-wrench::before{content:"\F1BDD"}.mdi-printer-pos-wrench-outline::before{content:"\F1BDE"}.mdi-printer-search::before{content:"\F1457"}.mdi-printer-settings::before{content:"\F0707"}.mdi-printer-wireless::before{content:"\F0A0B"}.mdi-priority-high::before{content:"\F0603"}.mdi-priority-low::before{content:"\F0604"}.mdi-professional-hexagon::before{content:"\F042D"}.mdi-progress-alert::before{content:"\F0CBC"}.mdi-progress-check::before{content:"\F0995"}.mdi-progress-clock::before{content:"\F0996"}.mdi-progress-close::before{content:"\F110A"}.mdi-progress-download::before{content:"\F0997"}.mdi-progress-helper::before{content:"\F1BA2"}.mdi-progress-pencil::before{content:"\F1787"}.mdi-progress-question::before{content:"\F1522"}.mdi-progress-star::before{content:"\F1788"}.mdi-progress-star-four-points::before{content:"\F1C3D"}.mdi-progress-tag::before{content:"\F1D0D"}.mdi-progress-upload::before{content:"\F0998"}.mdi-progress-wrench::before{content:"\F0CBD"}.mdi-projector::before{content:"\F042E"}.mdi-projector-off::before{content:"\F1A23"}.mdi-projector-screen::before{content:"\F042F"}.mdi-projector-screen-off::before{content:"\F180D"}.mdi-projector-screen-off-outline::before{content:"\F180E"}.mdi-projector-screen-outline::before{content:"\F1724"}.mdi-projector-screen-variant::before{content:"\F180F"}.mdi-projector-screen-variant-off::before{content:"\F1810"}.mdi-projector-screen-variant-off-outline::before{content:"\F1811"}.mdi-projector-screen-variant-outline::before{content:"\F1812"}.mdi-propane-tank::before{content:"\F1357"}.mdi-propane-tank-outline::before{content:"\F1358"}.mdi-protocol::before{content:"\F0FD8"}.mdi-publish::before{content:"\F06A7"}.mdi-publish-off::before{content:"\F1945"}.mdi-pulse::before{content:"\F0430"}.mdi-pump::before{content:"\F1402"}.mdi-pump-off::before{content:"\F1B22"}.mdi-pumpkin::before{content:"\F0BBF"}.mdi-purse::before{content:"\F0F1C"}.mdi-purse-outline::before{content:"\F0F1D"}.mdi-puzzle::before{content:"\F0431"}.mdi-puzzle-check::before{content:"\F1426"}.mdi-puzzle-check-outline::before{content:"\F1427"}.mdi-puzzle-edit::before{content:"\F14D3"}.mdi-puzzle-edit-outline::before{content:"\F14D9"}.mdi-puzzle-heart::before{content:"\F14D4"}.mdi-puzzle-heart-outline::before{content:"\F14DA"}.mdi-puzzle-minus::before{content:"\F14D1"}.mdi-puzzle-minus-outline::before{content:"\F14D7"}.mdi-puzzle-outline::before{content:"\F0A66"}.mdi-puzzle-plus::before{content:"\F14D0"}.mdi-puzzle-plus-outline::before{content:"\F14D6"}.mdi-puzzle-remove::before{content:"\F14D2"}.mdi-puzzle-remove-outline::before{content:"\F14D8"}.mdi-puzzle-star::before{content:"\F14D5"}.mdi-puzzle-star-outline::before{content:"\F14DB"}.mdi-pyramid::before{content:"\F1952"}.mdi-pyramid-off::before{content:"\F1953"}.mdi-qi::before{content:"\F0999"}.mdi-qqchat::before{content:"\F0605"}.mdi-qrcode::before{content:"\F0432"}.mdi-qrcode-edit::before{content:"\F08B8"}.mdi-qrcode-minus::before{content:"\F118C"}.mdi-qrcode-plus::before{content:"\F118B"}.mdi-qrcode-remove::before{content:"\F118D"}.mdi-qrcode-scan::before{content:"\F0433"}.mdi-quadcopter::before{content:"\F0434"}.mdi-quality-high::before{content:"\F0435"}.mdi-quality-low::before{content:"\F0A0C"}.mdi-quality-medium::before{content:"\F0A0D"}.mdi-queue-first-in-last-out::before{content:"\F1CAF"}.mdi-quora::before{content:"\F0D29"}.mdi-rabbit::before{content:"\F0907"}.mdi-rabbit-variant::before{content:"\F1A61"}.mdi-rabbit-variant-outline::before{content:"\F1A62"}.mdi-racing-helmet::before{content:"\F0D93"}.mdi-racquetball::before{content:"\F0D94"}.mdi-radar::before{content:"\F0437"}.mdi-radiator::before{content:"\F0438"}.mdi-radiator-disabled::before{content:"\F0AD7"}.mdi-radiator-off::before{content:"\F0AD8"}.mdi-radio::before{content:"\F0439"}.mdi-radio-am::before{content:"\F0CBE"}.mdi-radio-fm::before{content:"\F0CBF"}.mdi-radio-handheld::before{content:"\F043A"}.mdi-radio-off::before{content:"\F121C"}.mdi-radio-tower::before{content:"\F043B"}.mdi-radioactive::before{content:"\F043C"}.mdi-radioactive-circle::before{content:"\F185D"}.mdi-radioactive-circle-outline::before{content:"\F185E"}.mdi-radioactive-off::before{content:"\F0EC1"}.mdi-radiobox-blank::before{content:"\F043D"}.mdi-radiobox-indeterminate-variant::before{content:"\F1C5E"}.mdi-radiobox-marked::before{content:"\F043E"}.mdi-radiology-box::before{content:"\F14C5"}.mdi-radiology-box-outline::before{content:"\F14C6"}.mdi-radius::before{content:"\F0CC0"}.mdi-radius-outline::before{content:"\F0CC1"}.mdi-railroad-light::before{content:"\F0F1E"}.mdi-rake::before{content:"\F1544"}.mdi-raspberry-pi::before{content:"\F043F"}.mdi-raw::before{content:"\F1A0F"}.mdi-raw-off::before{content:"\F1A10"}.mdi-ray-end::before{content:"\F0440"}.mdi-ray-end-arrow::before{content:"\F0441"}.mdi-ray-start::before{content:"\F0442"}.mdi-ray-start-arrow::before{content:"\F0443"}.mdi-ray-start-end::before{content:"\F0444"}.mdi-ray-start-vertex-end::before{content:"\F15D8"}.mdi-ray-vertex::before{content:"\F0445"}.mdi-razor-double-edge::before{content:"\F1997"}.mdi-razor-single-edge::before{content:"\F1998"}.mdi-react::before{content:"\F0708"}.mdi-read::before{content:"\F0447"}.mdi-receipt::before{content:"\F0824"}.mdi-receipt-clock::before{content:"\F1C3E"}.mdi-receipt-clock-outline::before{content:"\F1C3F"}.mdi-receipt-outline::before{content:"\F04F7"}.mdi-receipt-send::before{content:"\F1C40"}.mdi-receipt-send-outline::before{content:"\F1C41"}.mdi-receipt-text::before{content:"\F0449"}.mdi-receipt-text-arrow-left::before{content:"\F1C42"}.mdi-receipt-text-arrow-left-outline::before{content:"\F1C43"}.mdi-receipt-text-arrow-right::before{content:"\F1C44"}.mdi-receipt-text-arrow-right-outline::before{content:"\F1C45"}.mdi-receipt-text-check::before{content:"\F1A63"}.mdi-receipt-text-check-outline::before{content:"\F1A64"}.mdi-receipt-text-clock::before{content:"\F1C46"}.mdi-receipt-text-clock-outline::before{content:"\F1C47"}.mdi-receipt-text-edit::before{content:"\F1C48"}.mdi-receipt-text-edit-outline::before{content:"\F1C49"}.mdi-receipt-text-minus::before{content:"\F1A65"}.mdi-receipt-text-minus-outline::before{content:"\F1A66"}.mdi-receipt-text-outline::before{content:"\F19DC"}.mdi-receipt-text-plus::before{content:"\F1A67"}.mdi-receipt-text-plus-outline::before{content:"\F1A68"}.mdi-receipt-text-remove::before{content:"\F1A69"}.mdi-receipt-text-remove-outline::before{content:"\F1A6A"}.mdi-receipt-text-send::before{content:"\F1C4A"}.mdi-receipt-text-send-outline::before{content:"\F1C4B"}.mdi-record::before{content:"\F044A"}.mdi-record-circle::before{content:"\F0EC2"}.mdi-record-circle-outline::before{content:"\F0EC3"}.mdi-record-player::before{content:"\F099A"}.mdi-record-rec::before{content:"\F044B"}.mdi-rectangle::before{content:"\F0E5E"}.mdi-rectangle-outline::before{content:"\F0E5F"}.mdi-recycle::before{content:"\F044C"}.mdi-recycle-variant::before{content:"\F139D"}.mdi-reddit::before{content:"\F044D"}.mdi-redhat::before{content:"\F111B"}.mdi-redo::before{content:"\F044E"}.mdi-redo-variant::before{content:"\F044F"}.mdi-reflect-horizontal::before{content:"\F0A0E"}.mdi-reflect-vertical::before{content:"\F0A0F"}.mdi-refresh::before{content:"\F0450"}.mdi-refresh-auto::before{content:"\F18F2"}.mdi-refresh-circle::before{content:"\F1377"}.mdi-regex::before{content:"\F0451"}.mdi-registered-trademark::before{content:"\F0A67"}.mdi-reiterate::before{content:"\F1588"}.mdi-relation-many-to-many::before{content:"\F1496"}.mdi-relation-many-to-one::before{content:"\F1497"}.mdi-relation-many-to-one-or-many::before{content:"\F1498"}.mdi-relation-many-to-only-one::before{content:"\F1499"}.mdi-relation-many-to-zero-or-many::before{content:"\F149A"}.mdi-relation-many-to-zero-or-one::before{content:"\F149B"}.mdi-relation-one-or-many-to-many::before{content:"\F149C"}.mdi-relation-one-or-many-to-one::before{content:"\F149D"}.mdi-relation-one-or-many-to-one-or-many::before{content:"\F149E"}.mdi-relation-one-or-many-to-only-one::before{content:"\F149F"}.mdi-relation-one-or-many-to-zero-or-many::before{content:"\F14A0"}.mdi-relation-one-or-many-to-zero-or-one::before{content:"\F14A1"}.mdi-relation-one-to-many::before{content:"\F14A2"}.mdi-relation-one-to-one::before{content:"\F14A3"}.mdi-relation-one-to-one-or-many::before{content:"\F14A4"}.mdi-relation-one-to-only-one::before{content:"\F14A5"}.mdi-relation-one-to-zero-or-many::before{content:"\F14A6"}.mdi-relation-one-to-zero-or-one::before{content:"\F14A7"}.mdi-relation-only-one-to-many::before{content:"\F14A8"}.mdi-relation-only-one-to-one::before{content:"\F14A9"}.mdi-relation-only-one-to-one-or-many::before{content:"\F14AA"}.mdi-relation-only-one-to-only-one::before{content:"\F14AB"}.mdi-relation-only-one-to-zero-or-many::before{content:"\F14AC"}.mdi-relation-only-one-to-zero-or-one::before{content:"\F14AD"}.mdi-relation-zero-or-many-to-many::before{content:"\F14AE"}.mdi-relation-zero-or-many-to-one::before{content:"\F14AF"}.mdi-relation-zero-or-many-to-one-or-many::before{content:"\F14B0"}.mdi-relation-zero-or-many-to-only-one::before{content:"\F14B1"}.mdi-relation-zero-or-many-to-zero-or-many::before{content:"\F14B2"}.mdi-relation-zero-or-many-to-zero-or-one::before{content:"\F14B3"}.mdi-relation-zero-or-one-to-many::before{content:"\F14B4"}.mdi-relation-zero-or-one-to-one::before{content:"\F14B5"}.mdi-relation-zero-or-one-to-one-or-many::before{content:"\F14B6"}.mdi-relation-zero-or-one-to-only-one::before{content:"\F14B7"}.mdi-relation-zero-or-one-to-zero-or-many::before{content:"\F14B8"}.mdi-relation-zero-or-one-to-zero-or-one::before{content:"\F14B9"}.mdi-relative-scale::before{content:"\F0452"}.mdi-reload::before{content:"\F0453"}.mdi-reload-alert::before{content:"\F110B"}.mdi-reminder::before{content:"\F088C"}.mdi-remote::before{content:"\F0454"}.mdi-remote-desktop::before{content:"\F08B9"}.mdi-remote-off::before{content:"\F0EC4"}.mdi-remote-tv::before{content:"\F0EC5"}.mdi-remote-tv-off::before{content:"\F0EC6"}.mdi-rename::before{content:"\F1C18"}.mdi-rename-box::before{content:"\F0455"}.mdi-rename-box-outline::before{content:"\F1C19"}.mdi-rename-outline::before{content:"\F1C1A"}.mdi-reorder-horizontal::before{content:"\F0688"}.mdi-reorder-vertical::before{content:"\F0689"}.mdi-repeat::before{content:"\F0456"}.mdi-repeat-off::before{content:"\F0457"}.mdi-repeat-once::before{content:"\F0458"}.mdi-repeat-variant::before{content:"\F0547"}.mdi-replay::before{content:"\F0459"}.mdi-reply::before{content:"\F045A"}.mdi-reply-all::before{content:"\F045B"}.mdi-reply-all-outline::before{content:"\F0F1F"}.mdi-reply-circle::before{content:"\F11AE"}.mdi-reply-outline::before{content:"\F0F20"}.mdi-reproduction::before{content:"\F045C"}.mdi-resistor::before{content:"\F0B44"}.mdi-resistor-nodes::before{content:"\F0B45"}.mdi-resize::before{content:"\F0A68"}.mdi-resize-bottom-right::before{content:"\F045D"}.mdi-responsive::before{content:"\F045E"}.mdi-restart::before{content:"\F0709"}.mdi-restart-alert::before{content:"\F110C"}.mdi-restart-off::before{content:"\F0D95"}.mdi-restore::before{content:"\F099B"}.mdi-restore-alert::before{content:"\F110D"}.mdi-rewind::before{content:"\F045F"}.mdi-rewind-10::before{content:"\F0D2A"}.mdi-rewind-15::before{content:"\F1946"}.mdi-rewind-30::before{content:"\F0D96"}.mdi-rewind-45::before{content:"\F1B13"}.mdi-rewind-5::before{content:"\F11F9"}.mdi-rewind-60::before{content:"\F160C"}.mdi-rewind-outline::before{content:"\F070A"}.mdi-rhombus::before{content:"\F070B"}.mdi-rhombus-medium::before{content:"\F0A10"}.mdi-rhombus-medium-outline::before{content:"\F14DC"}.mdi-rhombus-outline::before{content:"\F070C"}.mdi-rhombus-split::before{content:"\F0A11"}.mdi-rhombus-split-outline::before{content:"\F14DD"}.mdi-ribbon::before{content:"\F0460"}.mdi-rice::before{content:"\F07EA"}.mdi-rickshaw::before{content:"\F15BB"}.mdi-rickshaw-electric::before{content:"\F15BC"}.mdi-ring::before{content:"\F07EB"}.mdi-rivet::before{content:"\F0E60"}.mdi-road::before{content:"\F0461"}.mdi-road-variant::before{content:"\F0462"}.mdi-robber::before{content:"\F1058"}.mdi-robot::before{content:"\F06A9"}.mdi-robot-angry::before{content:"\F169D"}.mdi-robot-angry-outline::before{content:"\F169E"}.mdi-robot-confused::before{content:"\F169F"}.mdi-robot-confused-outline::before{content:"\F16A0"}.mdi-robot-dead::before{content:"\F16A1"}.mdi-robot-dead-outline::before{content:"\F16A2"}.mdi-robot-excited::before{content:"\F16A3"}.mdi-robot-excited-outline::before{content:"\F16A4"}.mdi-robot-happy::before{content:"\F1719"}.mdi-robot-happy-outline::before{content:"\F171A"}.mdi-robot-industrial::before{content:"\F0B46"}.mdi-robot-industrial-outline::before{content:"\F1A1A"}.mdi-robot-love::before{content:"\F16A5"}.mdi-robot-love-outline::before{content:"\F16A6"}.mdi-robot-mower::before{content:"\F11F7"}.mdi-robot-mower-outline::before{content:"\F11F3"}.mdi-robot-off::before{content:"\F16A7"}.mdi-robot-off-outline::before{content:"\F167B"}.mdi-robot-outline::before{content:"\F167A"}.mdi-robot-vacuum::before{content:"\F070D"}.mdi-robot-vacuum-alert::before{content:"\F1B5D"}.mdi-robot-vacuum-off::before{content:"\F1C01"}.mdi-robot-vacuum-variant::before{content:"\F0908"}.mdi-robot-vacuum-variant-alert::before{content:"\F1B5E"}.mdi-robot-vacuum-variant-off::before{content:"\F1C02"}.mdi-rocket::before{content:"\F0463"}.mdi-rocket-launch::before{content:"\F14DE"}.mdi-rocket-launch-outline::before{content:"\F14DF"}.mdi-rocket-outline::before{content:"\F13AF"}.mdi-rodent::before{content:"\F1327"}.mdi-roller-shade::before{content:"\F1A6B"}.mdi-roller-shade-closed::before{content:"\F1A6C"}.mdi-roller-skate::before{content:"\F0D2B"}.mdi-roller-skate-off::before{content:"\F0145"}.mdi-rollerblade::before{content:"\F0D2C"}.mdi-rollerblade-off::before{content:"\F002E"}.mdi-rollupjs::before{content:"\F0BC0"}.mdi-rolodex::before{content:"\F1AB9"}.mdi-rolodex-outline::before{content:"\F1ABA"}.mdi-roman-numeral-1::before{content:"\F1088"}.mdi-roman-numeral-10::before{content:"\F1091"}.mdi-roman-numeral-2::before{content:"\F1089"}.mdi-roman-numeral-3::before{content:"\F108A"}.mdi-roman-numeral-4::before{content:"\F108B"}.mdi-roman-numeral-5::before{content:"\F108C"}.mdi-roman-numeral-6::before{content:"\F108D"}.mdi-roman-numeral-7::before{content:"\F108E"}.mdi-roman-numeral-8::before{content:"\F108F"}.mdi-roman-numeral-9::before{content:"\F1090"}.mdi-room-service::before{content:"\F088D"}.mdi-room-service-outline::before{content:"\F0D97"}.mdi-rotate-360::before{content:"\F1999"}.mdi-rotate-3d::before{content:"\F0EC7"}.mdi-rotate-3d-variant::before{content:"\F0464"}.mdi-rotate-left::before{content:"\F0465"}.mdi-rotate-left-variant::before{content:"\F0466"}.mdi-rotate-orbit::before{content:"\F0D98"}.mdi-rotate-right::before{content:"\F0467"}.mdi-rotate-right-variant::before{content:"\F0468"}.mdi-rounded-corner::before{content:"\F0607"}.mdi-router::before{content:"\F11E2"}.mdi-router-network::before{content:"\F1087"}.mdi-router-network-wireless::before{content:"\F1C97"}.mdi-router-wireless::before{content:"\F0469"}.mdi-router-wireless-off::before{content:"\F15A3"}.mdi-router-wireless-settings::before{content:"\F0A69"}.mdi-routes::before{content:"\F046A"}.mdi-routes-clock::before{content:"\F1059"}.mdi-rowing::before{content:"\F0608"}.mdi-rss::before{content:"\F046B"}.mdi-rss-box::before{content:"\F046C"}.mdi-rss-off::before{content:"\F0F21"}.mdi-rug::before{content:"\F1475"}.mdi-rugby::before{content:"\F0D99"}.mdi-ruler::before{content:"\F046D"}.mdi-ruler-square::before{content:"\F0CC2"}.mdi-ruler-square-compass::before{content:"\F0EBE"}.mdi-run::before{content:"\F070E"}.mdi-run-fast::before{content:"\F046E"}.mdi-rv-truck::before{content:"\F11D4"}.mdi-sack::before{content:"\F0D2E"}.mdi-sack-outline::before{content:"\F1C4C"}.mdi-sack-percent::before{content:"\F0D2F"}.mdi-safe::before{content:"\F0A6A"}.mdi-safe-square::before{content:"\F127C"}.mdi-safe-square-outline::before{content:"\F127D"}.mdi-safety-goggles::before{content:"\F0D30"}.mdi-sail-boat::before{content:"\F0EC8"}.mdi-sail-boat-sink::before{content:"\F1AEF"}.mdi-sale::before{content:"\F046F"}.mdi-sale-outline::before{content:"\F1A06"}.mdi-salesforce::before{content:"\F088E"}.mdi-sass::before{content:"\F07EC"}.mdi-satellite::before{content:"\F0470"}.mdi-satellite-uplink::before{content:"\F0909"}.mdi-satellite-variant::before{content:"\F0471"}.mdi-sausage::before{content:"\F08BA"}.mdi-sausage-off::before{content:"\F1789"}.mdi-saw-blade::before{content:"\F0E61"}.mdi-sawtooth-wave::before{content:"\F147A"}.mdi-saxophone::before{content:"\F0609"}.mdi-scale::before{content:"\F0472"}.mdi-scale-balance::before{content:"\F05D1"}.mdi-scale-bathroom::before{content:"\F0473"}.mdi-scale-off::before{content:"\F105A"}.mdi-scale-unbalanced::before{content:"\F19B8"}.mdi-scan-helper::before{content:"\F13D8"}.mdi-scanner::before{content:"\F06AB"}.mdi-scanner-off::before{content:"\F090A"}.mdi-scatter-plot::before{content:"\F0EC9"}.mdi-scatter-plot-outline::before{content:"\F0ECA"}.mdi-scent::before{content:"\F1958"}.mdi-scent-off::before{content:"\F1959"}.mdi-school::before{content:"\F0474"}.mdi-school-outline::before{content:"\F1180"}.mdi-scissors-cutting::before{content:"\F0A6B"}.mdi-scooter::before{content:"\F15BD"}.mdi-scooter-electric::before{content:"\F15BE"}.mdi-scoreboard::before{content:"\F127E"}.mdi-scoreboard-outline::before{content:"\F127F"}.mdi-screen-rotation::before{content:"\F0475"}.mdi-screen-rotation-lock::before{content:"\F0478"}.mdi-screw-flat-top::before{content:"\F0DF3"}.mdi-screw-lag::before{content:"\F0DF4"}.mdi-screw-machine-flat-top::before{content:"\F0DF5"}.mdi-screw-machine-round-top::before{content:"\F0DF6"}.mdi-screw-round-top::before{content:"\F0DF7"}.mdi-screwdriver::before{content:"\F0476"}.mdi-script::before{content:"\F0BC1"}.mdi-script-outline::before{content:"\F0477"}.mdi-script-text::before{content:"\F0BC2"}.mdi-script-text-key::before{content:"\F1725"}.mdi-script-text-key-outline::before{content:"\F1726"}.mdi-script-text-outline::before{content:"\F0BC3"}.mdi-script-text-play::before{content:"\F1727"}.mdi-script-text-play-outline::before{content:"\F1728"}.mdi-sd::before{content:"\F0479"}.mdi-seal::before{content:"\F047A"}.mdi-seal-variant::before{content:"\F0FD9"}.mdi-search-web::before{content:"\F070F"}.mdi-seat::before{content:"\F0CC3"}.mdi-seat-flat::before{content:"\F047B"}.mdi-seat-flat-angled::before{content:"\F047C"}.mdi-seat-individual-suite::before{content:"\F047D"}.mdi-seat-legroom-extra::before{content:"\F047E"}.mdi-seat-legroom-normal::before{content:"\F047F"}.mdi-seat-legroom-reduced::before{content:"\F0480"}.mdi-seat-outline::before{content:"\F0CC4"}.mdi-seat-passenger::before{content:"\F1249"}.mdi-seat-recline-extra::before{content:"\F0481"}.mdi-seat-recline-normal::before{content:"\F0482"}.mdi-seatbelt::before{content:"\F0CC5"}.mdi-security::before{content:"\F0483"}.mdi-security-network::before{content:"\F0484"}.mdi-seed::before{content:"\F0E62"}.mdi-seed-off::before{content:"\F13FD"}.mdi-seed-off-outline::before{content:"\F13FE"}.mdi-seed-outline::before{content:"\F0E63"}.mdi-seed-plus::before{content:"\F1A6D"}.mdi-seed-plus-outline::before{content:"\F1A6E"}.mdi-seesaw::before{content:"\F15A4"}.mdi-segment::before{content:"\F0ECB"}.mdi-select::before{content:"\F0485"}.mdi-select-all::before{content:"\F0486"}.mdi-select-arrow-down::before{content:"\F1B59"}.mdi-select-arrow-up::before{content:"\F1B58"}.mdi-select-color::before{content:"\F0D31"}.mdi-select-compare::before{content:"\F0AD9"}.mdi-select-drag::before{content:"\F0A6C"}.mdi-select-group::before{content:"\F0F82"}.mdi-select-inverse::before{content:"\F0487"}.mdi-select-marker::before{content:"\F1280"}.mdi-select-multiple::before{content:"\F1281"}.mdi-select-multiple-marker::before{content:"\F1282"}.mdi-select-off::before{content:"\F0488"}.mdi-select-place::before{content:"\F0FDA"}.mdi-select-remove::before{content:"\F17C1"}.mdi-select-search::before{content:"\F1204"}.mdi-selection::before{content:"\F0489"}.mdi-selection-drag::before{content:"\F0A6D"}.mdi-selection-ellipse::before{content:"\F0D32"}.mdi-selection-ellipse-arrow-inside::before{content:"\F0F22"}.mdi-selection-ellipse-remove::before{content:"\F17C2"}.mdi-selection-marker::before{content:"\F1283"}.mdi-selection-multiple::before{content:"\F1285"}.mdi-selection-multiple-marker::before{content:"\F1284"}.mdi-selection-off::before{content:"\F0777"}.mdi-selection-remove::before{content:"\F17C3"}.mdi-selection-search::before{content:"\F1205"}.mdi-semantic-web::before{content:"\F1316"}.mdi-send::before{content:"\F048A"}.mdi-send-check::before{content:"\F1161"}.mdi-send-check-outline::before{content:"\F1162"}.mdi-send-circle::before{content:"\F0DF8"}.mdi-send-circle-outline::before{content:"\F0DF9"}.mdi-send-clock::before{content:"\F1163"}.mdi-send-clock-outline::before{content:"\F1164"}.mdi-send-lock::before{content:"\F07ED"}.mdi-send-lock-outline::before{content:"\F1166"}.mdi-send-outline::before{content:"\F1165"}.mdi-send-variant::before{content:"\F1C4D"}.mdi-send-variant-clock::before{content:"\F1C7E"}.mdi-send-variant-clock-outline::before{content:"\F1C7F"}.mdi-send-variant-outline::before{content:"\F1C4E"}.mdi-serial-port::before{content:"\F065C"}.mdi-server::before{content:"\F048B"}.mdi-server-minus::before{content:"\F048C"}.mdi-server-minus-outline::before{content:"\F1C98"}.mdi-server-network::before{content:"\F048D"}.mdi-server-network-off::before{content:"\F048E"}.mdi-server-network-outline::before{content:"\F1C99"}.mdi-server-off::before{content:"\F048F"}.mdi-server-outline::before{content:"\F1C9A"}.mdi-server-plus::before{content:"\F0490"}.mdi-server-plus-outline::before{content:"\F1C9B"}.mdi-server-remove::before{content:"\F0491"}.mdi-server-security::before{content:"\F0492"}.mdi-set-all::before{content:"\F0778"}.mdi-set-center::before{content:"\F0779"}.mdi-set-center-right::before{content:"\F077A"}.mdi-set-left::before{content:"\F077B"}.mdi-set-left-center::before{content:"\F077C"}.mdi-set-left-right::before{content:"\F077D"}.mdi-set-merge::before{content:"\F14E0"}.mdi-set-none::before{content:"\F077E"}.mdi-set-right::before{content:"\F077F"}.mdi-set-split::before{content:"\F14E1"}.mdi-set-square::before{content:"\F145D"}.mdi-set-top-box::before{content:"\F099F"}.mdi-settings-helper::before{content:"\F0A6E"}.mdi-shaker::before{content:"\F110E"}.mdi-shaker-outline::before{content:"\F110F"}.mdi-shape::before{content:"\F0831"}.mdi-shape-circle-plus::before{content:"\F065D"}.mdi-shape-outline::before{content:"\F0832"}.mdi-shape-oval-plus::before{content:"\F11FA"}.mdi-shape-plus::before{content:"\F0495"}.mdi-shape-plus-outline::before{content:"\F1C4F"}.mdi-shape-polygon-plus::before{content:"\F065E"}.mdi-shape-rectangle-plus::before{content:"\F065F"}.mdi-shape-square-plus::before{content:"\F0660"}.mdi-shape-square-rounded-plus::before{content:"\F14FA"}.mdi-share::before{content:"\F0496"}.mdi-share-all::before{content:"\F11F4"}.mdi-share-all-outline::before{content:"\F11F5"}.mdi-share-circle::before{content:"\F11AD"}.mdi-share-off::before{content:"\F0F23"}.mdi-share-off-outline::before{content:"\F0F24"}.mdi-share-outline::before{content:"\F0932"}.mdi-share-variant::before{content:"\F0497"}.mdi-share-variant-outline::before{content:"\F1514"}.mdi-shark::before{content:"\F18BA"}.mdi-shark-fin::before{content:"\F1673"}.mdi-shark-fin-outline::before{content:"\F1674"}.mdi-shark-off::before{content:"\F18BB"}.mdi-sheep::before{content:"\F0CC6"}.mdi-shield::before{content:"\F0498"}.mdi-shield-account::before{content:"\F088F"}.mdi-shield-account-outline::before{content:"\F0A12"}.mdi-shield-account-variant::before{content:"\F15A7"}.mdi-shield-account-variant-outline::before{content:"\F15A8"}.mdi-shield-airplane::before{content:"\F06BB"}.mdi-shield-airplane-outline::before{content:"\F0CC7"}.mdi-shield-alert::before{content:"\F0ECC"}.mdi-shield-alert-outline::before{content:"\F0ECD"}.mdi-shield-bug::before{content:"\F13DA"}.mdi-shield-bug-outline::before{content:"\F13DB"}.mdi-shield-car::before{content:"\F0F83"}.mdi-shield-check::before{content:"\F0565"}.mdi-shield-check-outline::before{content:"\F0CC8"}.mdi-shield-cross::before{content:"\F0CC9"}.mdi-shield-cross-outline::before{content:"\F0CCA"}.mdi-shield-crown::before{content:"\F18BC"}.mdi-shield-crown-outline::before{content:"\F18BD"}.mdi-shield-edit::before{content:"\F11A0"}.mdi-shield-edit-outline::before{content:"\F11A1"}.mdi-shield-half::before{content:"\F1360"}.mdi-shield-half-full::before{content:"\F0780"}.mdi-shield-home::before{content:"\F068A"}.mdi-shield-home-outline::before{content:"\F0CCB"}.mdi-shield-key::before{content:"\F0BC4"}.mdi-shield-key-outline::before{content:"\F0BC5"}.mdi-shield-link-variant::before{content:"\F0D33"}.mdi-shield-link-variant-outline::before{content:"\F0D34"}.mdi-shield-lock::before{content:"\F099D"}.mdi-shield-lock-open::before{content:"\F199A"}.mdi-shield-lock-open-outline::before{content:"\F199B"}.mdi-shield-lock-outline::before{content:"\F0CCC"}.mdi-shield-moon::before{content:"\F1828"}.mdi-shield-moon-outline::before{content:"\F1829"}.mdi-shield-off::before{content:"\F099E"}.mdi-shield-off-outline::before{content:"\F099C"}.mdi-shield-outline::before{content:"\F0499"}.mdi-shield-plus::before{content:"\F0ADA"}.mdi-shield-plus-outline::before{content:"\F0ADB"}.mdi-shield-refresh::before{content:"\F00AA"}.mdi-shield-refresh-outline::before{content:"\F01E0"}.mdi-shield-remove::before{content:"\F0ADC"}.mdi-shield-remove-outline::before{content:"\F0ADD"}.mdi-shield-search::before{content:"\F0D9A"}.mdi-shield-star::before{content:"\F113B"}.mdi-shield-star-outline::before{content:"\F113C"}.mdi-shield-sun::before{content:"\F105D"}.mdi-shield-sun-outline::before{content:"\F105E"}.mdi-shield-sword::before{content:"\F18BE"}.mdi-shield-sword-outline::before{content:"\F18BF"}.mdi-shield-sync::before{content:"\F11A2"}.mdi-shield-sync-outline::before{content:"\F11A3"}.mdi-shimmer::before{content:"\F1545"}.mdi-ship-wheel::before{content:"\F0833"}.mdi-shipping-pallet::before{content:"\F184E"}.mdi-shoe-ballet::before{content:"\F15CA"}.mdi-shoe-cleat::before{content:"\F15C7"}.mdi-shoe-formal::before{content:"\F0B47"}.mdi-shoe-heel::before{content:"\F0B48"}.mdi-shoe-print::before{content:"\F0DFA"}.mdi-shoe-sneaker::before{content:"\F15C8"}.mdi-shopping::before{content:"\F049A"}.mdi-shopping-music::before{content:"\F049B"}.mdi-shopping-outline::before{content:"\F11D5"}.mdi-shopping-search::before{content:"\F0F84"}.mdi-shopping-search-outline::before{content:"\F1A6F"}.mdi-shore::before{content:"\F14F9"}.mdi-shovel::before{content:"\F0710"}.mdi-shovel-off::before{content:"\F0711"}.mdi-shower::before{content:"\F09A0"}.mdi-shower-head::before{content:"\F09A1"}.mdi-shredder::before{content:"\F049C"}.mdi-shuffle::before{content:"\F049D"}.mdi-shuffle-disabled::before{content:"\F049E"}.mdi-shuffle-variant::before{content:"\F049F"}.mdi-shuriken::before{content:"\F137F"}.mdi-sickle::before{content:"\F18C0"}.mdi-sigma::before{content:"\F04A0"}.mdi-sigma-lower::before{content:"\F062B"}.mdi-sign-caution::before{content:"\F04A1"}.mdi-sign-direction::before{content:"\F0781"}.mdi-sign-direction-minus::before{content:"\F1000"}.mdi-sign-direction-plus::before{content:"\F0FDC"}.mdi-sign-direction-remove::before{content:"\F0FDD"}.mdi-sign-language::before{content:"\F1B4D"}.mdi-sign-language-outline::before{content:"\F1B4E"}.mdi-sign-pole::before{content:"\F14F8"}.mdi-sign-real-estate::before{content:"\F1118"}.mdi-sign-text::before{content:"\F0782"}.mdi-sign-yield::before{content:"\F1BAF"}.mdi-signal::before{content:"\F04A2"}.mdi-signal-2g::before{content:"\F0712"}.mdi-signal-3g::before{content:"\F0713"}.mdi-signal-4g::before{content:"\F0714"}.mdi-signal-5g::before{content:"\F0A6F"}.mdi-signal-cellular-1::before{content:"\F08BC"}.mdi-signal-cellular-2::before{content:"\F08BD"}.mdi-signal-cellular-3::before{content:"\F08BE"}.mdi-signal-cellular-outline::before{content:"\F08BF"}.mdi-signal-distance-variant::before{content:"\F0E64"}.mdi-signal-hspa::before{content:"\F0715"}.mdi-signal-hspa-plus::before{content:"\F0716"}.mdi-signal-off::before{content:"\F0783"}.mdi-signal-variant::before{content:"\F060A"}.mdi-signature::before{content:"\F0DFB"}.mdi-signature-freehand::before{content:"\F0DFC"}.mdi-signature-image::before{content:"\F0DFD"}.mdi-signature-text::before{content:"\F0DFE"}.mdi-silo::before{content:"\F1B9F"}.mdi-silo-outline::before{content:"\F0B49"}.mdi-silverware::before{content:"\F04A3"}.mdi-silverware-clean::before{content:"\F0FDE"}.mdi-silverware-fork::before{content:"\F04A4"}.mdi-silverware-fork-knife::before{content:"\F0A70"}.mdi-silverware-spoon::before{content:"\F04A5"}.mdi-silverware-variant::before{content:"\F04A6"}.mdi-sim::before{content:"\F04A7"}.mdi-sim-alert::before{content:"\F04A8"}.mdi-sim-alert-outline::before{content:"\F15D3"}.mdi-sim-off::before{content:"\F04A9"}.mdi-sim-off-outline::before{content:"\F15D4"}.mdi-sim-outline::before{content:"\F15D5"}.mdi-simple-icons::before{content:"\F131D"}.mdi-sina-weibo::before{content:"\F0ADF"}.mdi-sine-wave::before{content:"\F095B"}.mdi-sitemap::before{content:"\F04AA"}.mdi-sitemap-outline::before{content:"\F199C"}.mdi-size-l::before{content:"\F13A6"}.mdi-size-m::before{content:"\F13A5"}.mdi-size-s::before{content:"\F13A4"}.mdi-size-xl::before{content:"\F13A7"}.mdi-size-xs::before{content:"\F13A3"}.mdi-size-xxl::before{content:"\F13A8"}.mdi-size-xxs::before{content:"\F13A2"}.mdi-size-xxxl::before{content:"\F13A9"}.mdi-skate::before{content:"\F0D35"}.mdi-skate-off::before{content:"\F0699"}.mdi-skateboard::before{content:"\F14C2"}.mdi-skateboarding::before{content:"\F0501"}.mdi-skew-less::before{content:"\F0D36"}.mdi-skew-more::before{content:"\F0D37"}.mdi-ski::before{content:"\F1304"}.mdi-ski-cross-country::before{content:"\F1305"}.mdi-ski-water::before{content:"\F1306"}.mdi-skip-backward::before{content:"\F04AB"}.mdi-skip-backward-outline::before{content:"\F0F25"}.mdi-skip-forward::before{content:"\F04AC"}.mdi-skip-forward-outline::before{content:"\F0F26"}.mdi-skip-next::before{content:"\F04AD"}.mdi-skip-next-circle::before{content:"\F0661"}.mdi-skip-next-circle-outline::before{content:"\F0662"}.mdi-skip-next-outline::before{content:"\F0F27"}.mdi-skip-previous::before{content:"\F04AE"}.mdi-skip-previous-circle::before{content:"\F0663"}.mdi-skip-previous-circle-outline::before{content:"\F0664"}.mdi-skip-previous-outline::before{content:"\F0F28"}.mdi-skull::before{content:"\F068C"}.mdi-skull-crossbones::before{content:"\F0BC6"}.mdi-skull-crossbones-outline::before{content:"\F0BC7"}.mdi-skull-outline::before{content:"\F0BC8"}.mdi-skull-scan::before{content:"\F14C7"}.mdi-skull-scan-outline::before{content:"\F14C8"}.mdi-skype::before{content:"\F04AF"}.mdi-skype-business::before{content:"\F04B0"}.mdi-slack::before{content:"\F04B1"}.mdi-slash-forward::before{content:"\F0FDF"}.mdi-slash-forward-box::before{content:"\F0FE0"}.mdi-sledding::before{content:"\F041B"}.mdi-sleep::before{content:"\F04B2"}.mdi-sleep-off::before{content:"\F04B3"}.mdi-slide::before{content:"\F15A5"}.mdi-slope-downhill::before{content:"\F0DFF"}.mdi-slope-uphill::before{content:"\F0E00"}.mdi-slot-machine::before{content:"\F1114"}.mdi-slot-machine-outline::before{content:"\F1115"}.mdi-smart-card::before{content:"\F10BD"}.mdi-smart-card-off::before{content:"\F18F7"}.mdi-smart-card-off-outline::before{content:"\F18F8"}.mdi-smart-card-outline::before{content:"\F10BE"}.mdi-smart-card-reader::before{content:"\F10BF"}.mdi-smart-card-reader-outline::before{content:"\F10C0"}.mdi-smog::before{content:"\F0A71"}.mdi-smoke::before{content:"\F1799"}.mdi-smoke-detector::before{content:"\F0392"}.mdi-smoke-detector-alert::before{content:"\F192E"}.mdi-smoke-detector-alert-outline::before{content:"\F192F"}.mdi-smoke-detector-off::before{content:"\F1809"}.mdi-smoke-detector-off-outline::before{content:"\F180A"}.mdi-smoke-detector-outline::before{content:"\F1808"}.mdi-smoke-detector-variant::before{content:"\F180B"}.mdi-smoke-detector-variant-alert::before{content:"\F1930"}.mdi-smoke-detector-variant-off::before{content:"\F180C"}.mdi-smoking::before{content:"\F04B4"}.mdi-smoking-off::before{content:"\F04B5"}.mdi-smoking-pipe::before{content:"\F140D"}.mdi-smoking-pipe-off::before{content:"\F1428"}.mdi-snail::before{content:"\F1677"}.mdi-snake::before{content:"\F150E"}.mdi-snapchat::before{content:"\F04B6"}.mdi-snowboard::before{content:"\F1307"}.mdi-snowflake::before{content:"\F0717"}.mdi-snowflake-alert::before{content:"\F0F29"}.mdi-snowflake-check::before{content:"\F1A70"}.mdi-snowflake-melt::before{content:"\F12CB"}.mdi-snowflake-off::before{content:"\F14E3"}.mdi-snowflake-thermometer::before{content:"\F1A71"}.mdi-snowflake-variant::before{content:"\F0F2A"}.mdi-snowman::before{content:"\F04B7"}.mdi-snowmobile::before{content:"\F06DD"}.mdi-snowshoeing::before{content:"\F1A72"}.mdi-soccer::before{content:"\F04B8"}.mdi-soccer-field::before{content:"\F0834"}.mdi-social-distance-2-meters::before{content:"\F1579"}.mdi-social-distance-6-feet::before{content:"\F157A"}.mdi-sofa::before{content:"\F04B9"}.mdi-sofa-outline::before{content:"\F156D"}.mdi-sofa-single::before{content:"\F156E"}.mdi-sofa-single-outline::before{content:"\F156F"}.mdi-solar-panel::before{content:"\F0D9B"}.mdi-solar-panel-large::before{content:"\F0D9C"}.mdi-solar-power::before{content:"\F0A72"}.mdi-solar-power-variant::before{content:"\F1A73"}.mdi-solar-power-variant-outline::before{content:"\F1A74"}.mdi-soldering-iron::before{content:"\F1092"}.mdi-solid::before{content:"\F068D"}.mdi-sony-playstation::before{content:"\F0414"}.mdi-sort::before{content:"\F04BA"}.mdi-sort-alphabetical-ascending::before{content:"\F05BD"}.mdi-sort-alphabetical-ascending-variant::before{content:"\F1148"}.mdi-sort-alphabetical-descending::before{content:"\F05BF"}.mdi-sort-alphabetical-descending-variant::before{content:"\F1149"}.mdi-sort-alphabetical-variant::before{content:"\F04BB"}.mdi-sort-ascending::before{content:"\F04BC"}.mdi-sort-bool-ascending::before{content:"\F1385"}.mdi-sort-bool-ascending-variant::before{content:"\F1386"}.mdi-sort-bool-descending::before{content:"\F1387"}.mdi-sort-bool-descending-variant::before{content:"\F1388"}.mdi-sort-calendar-ascending::before{content:"\F1547"}.mdi-sort-calendar-descending::before{content:"\F1548"}.mdi-sort-clock-ascending::before{content:"\F1549"}.mdi-sort-clock-ascending-outline::before{content:"\F154A"}.mdi-sort-clock-descending::before{content:"\F154B"}.mdi-sort-clock-descending-outline::before{content:"\F154C"}.mdi-sort-descending::before{content:"\F04BD"}.mdi-sort-numeric-ascending::before{content:"\F1389"}.mdi-sort-numeric-ascending-variant::before{content:"\F090D"}.mdi-sort-numeric-descending::before{content:"\F138A"}.mdi-sort-numeric-descending-variant::before{content:"\F0AD2"}.mdi-sort-numeric-variant::before{content:"\F04BE"}.mdi-sort-reverse-variant::before{content:"\F033C"}.mdi-sort-variant::before{content:"\F04BF"}.mdi-sort-variant-lock::before{content:"\F0CCD"}.mdi-sort-variant-lock-open::before{content:"\F0CCE"}.mdi-sort-variant-off::before{content:"\F1ABB"}.mdi-sort-variant-remove::before{content:"\F1147"}.mdi-soundbar::before{content:"\F17DB"}.mdi-soundcloud::before{content:"\F04C0"}.mdi-source-branch::before{content:"\F062C"}.mdi-source-branch-check::before{content:"\F14CF"}.mdi-source-branch-minus::before{content:"\F14CB"}.mdi-source-branch-plus::before{content:"\F14CA"}.mdi-source-branch-refresh::before{content:"\F14CD"}.mdi-source-branch-remove::before{content:"\F14CC"}.mdi-source-branch-sync::before{content:"\F14CE"}.mdi-source-commit::before{content:"\F0718"}.mdi-source-commit-end::before{content:"\F0719"}.mdi-source-commit-end-local::before{content:"\F071A"}.mdi-source-commit-local::before{content:"\F071B"}.mdi-source-commit-next-local::before{content:"\F071C"}.mdi-source-commit-start::before{content:"\F071D"}.mdi-source-commit-start-next-local::before{content:"\F071E"}.mdi-source-fork::before{content:"\F04C1"}.mdi-source-merge::before{content:"\F062D"}.mdi-source-pull::before{content:"\F04C2"}.mdi-source-repository::before{content:"\F0CCF"}.mdi-source-repository-multiple::before{content:"\F0CD0"}.mdi-soy-sauce::before{content:"\F07EE"}.mdi-soy-sauce-off::before{content:"\F13FC"}.mdi-spa::before{content:"\F0CD1"}.mdi-spa-outline::before{content:"\F0CD2"}.mdi-space-invaders::before{content:"\F0BC9"}.mdi-space-station::before{content:"\F1383"}.mdi-spade::before{content:"\F0E65"}.mdi-speaker::before{content:"\F04C3"}.mdi-speaker-bluetooth::before{content:"\F09A2"}.mdi-speaker-message::before{content:"\F1B11"}.mdi-speaker-multiple::before{content:"\F0D38"}.mdi-speaker-off::before{content:"\F04C4"}.mdi-speaker-pause::before{content:"\F1B73"}.mdi-speaker-play::before{content:"\F1B72"}.mdi-speaker-stop::before{content:"\F1B74"}.mdi-speaker-wireless::before{content:"\F071F"}.mdi-spear::before{content:"\F1845"}.mdi-speedometer::before{content:"\F04C5"}.mdi-speedometer-medium::before{content:"\F0F85"}.mdi-speedometer-slow::before{content:"\F0F86"}.mdi-spellcheck::before{content:"\F04C6"}.mdi-sphere::before{content:"\F1954"}.mdi-sphere-off::before{content:"\F1955"}.mdi-spider::before{content:"\F11EA"}.mdi-spider-outline::before{content:"\F1C75"}.mdi-spider-thread::before{content:"\F11EB"}.mdi-spider-web::before{content:"\F0BCA"}.mdi-spirit-level::before{content:"\F14F1"}.mdi-spoon-sugar::before{content:"\F1429"}.mdi-spotify::before{content:"\F04C7"}.mdi-spotlight::before{content:"\F04C8"}.mdi-spotlight-beam::before{content:"\F04C9"}.mdi-spray::before{content:"\F0665"}.mdi-spray-bottle::before{content:"\F0AE0"}.mdi-sprinkler::before{content:"\F105F"}.mdi-sprinkler-fire::before{content:"\F199D"}.mdi-sprinkler-variant::before{content:"\F1060"}.mdi-sprout::before{content:"\F0E66"}.mdi-sprout-outline::before{content:"\F0E67"}.mdi-square::before{content:"\F0764"}.mdi-square-circle::before{content:"\F1500"}.mdi-square-circle-outline::before{content:"\F1C50"}.mdi-square-edit-outline::before{content:"\F090C"}.mdi-square-medium::before{content:"\F0A13"}.mdi-square-medium-outline::before{content:"\F0A14"}.mdi-square-off::before{content:"\F12EE"}.mdi-square-off-outline::before{content:"\F12EF"}.mdi-square-opacity::before{content:"\F1854"}.mdi-square-outline::before{content:"\F0763"}.mdi-square-root::before{content:"\F0784"}.mdi-square-root-box::before{content:"\F09A3"}.mdi-square-rounded::before{content:"\F14FB"}.mdi-square-rounded-badge::before{content:"\F1A07"}.mdi-square-rounded-badge-outline::before{content:"\F1A08"}.mdi-square-rounded-outline::before{content:"\F14FC"}.mdi-square-small::before{content:"\F0A15"}.mdi-square-wave::before{content:"\F147B"}.mdi-squeegee::before{content:"\F0AE1"}.mdi-ssh::before{content:"\F08C0"}.mdi-stack-exchange::before{content:"\F060B"}.mdi-stack-overflow::before{content:"\F04CC"}.mdi-stackpath::before{content:"\F0359"}.mdi-stadium::before{content:"\F0FF9"}.mdi-stadium-outline::before{content:"\F1B03"}.mdi-stadium-variant::before{content:"\F0720"}.mdi-stairs::before{content:"\F04CD"}.mdi-stairs-box::before{content:"\F139E"}.mdi-stairs-down::before{content:"\F12BE"}.mdi-stairs-up::before{content:"\F12BD"}.mdi-stamper::before{content:"\F0D39"}.mdi-standard-definition::before{content:"\F07EF"}.mdi-star::before{content:"\F04CE"}.mdi-star-box::before{content:"\F0A73"}.mdi-star-box-multiple::before{content:"\F1286"}.mdi-star-box-multiple-outline::before{content:"\F1287"}.mdi-star-box-outline::before{content:"\F0A74"}.mdi-star-check::before{content:"\F1566"}.mdi-star-check-outline::before{content:"\F156A"}.mdi-star-circle::before{content:"\F04CF"}.mdi-star-circle-outline::before{content:"\F09A4"}.mdi-star-cog::before{content:"\F1668"}.mdi-star-cog-outline::before{content:"\F1669"}.mdi-star-crescent::before{content:"\F0979"}.mdi-star-david::before{content:"\F097A"}.mdi-star-face::before{content:"\F09A5"}.mdi-star-four-points::before{content:"\F0AE2"}.mdi-star-four-points-box::before{content:"\F1C51"}.mdi-star-four-points-box-outline::before{content:"\F1C52"}.mdi-star-four-points-circle::before{content:"\F1C53"}.mdi-star-four-points-circle-outline::before{content:"\F1C54"}.mdi-star-four-points-outline::before{content:"\F0AE3"}.mdi-star-four-points-small::before{content:"\F1C55"}.mdi-star-half::before{content:"\F0246"}.mdi-star-half-full::before{content:"\F04D0"}.mdi-star-minus::before{content:"\F1564"}.mdi-star-minus-outline::before{content:"\F1568"}.mdi-star-off::before{content:"\F04D1"}.mdi-star-off-outline::before{content:"\F155B"}.mdi-star-outline::before{content:"\F04D2"}.mdi-star-plus::before{content:"\F1563"}.mdi-star-plus-outline::before{content:"\F1567"}.mdi-star-remove::before{content:"\F1565"}.mdi-star-remove-outline::before{content:"\F1569"}.mdi-star-settings::before{content:"\F166A"}.mdi-star-settings-outline::before{content:"\F166B"}.mdi-star-shooting::before{content:"\F1741"}.mdi-star-shooting-outline::before{content:"\F1742"}.mdi-star-three-points::before{content:"\F0AE4"}.mdi-star-three-points-outline::before{content:"\F0AE5"}.mdi-state-machine::before{content:"\F11EF"}.mdi-steam::before{content:"\F04D3"}.mdi-steering::before{content:"\F04D4"}.mdi-steering-off::before{content:"\F090E"}.mdi-step-backward::before{content:"\F04D5"}.mdi-step-backward-2::before{content:"\F04D6"}.mdi-step-forward::before{content:"\F04D7"}.mdi-step-forward-2::before{content:"\F04D8"}.mdi-stethoscope::before{content:"\F04D9"}.mdi-sticker::before{content:"\F1364"}.mdi-sticker-alert::before{content:"\F1365"}.mdi-sticker-alert-outline::before{content:"\F1366"}.mdi-sticker-check::before{content:"\F1367"}.mdi-sticker-check-outline::before{content:"\F1368"}.mdi-sticker-circle-outline::before{content:"\F05D0"}.mdi-sticker-emoji::before{content:"\F0785"}.mdi-sticker-minus::before{content:"\F1369"}.mdi-sticker-minus-outline::before{content:"\F136A"}.mdi-sticker-outline::before{content:"\F136B"}.mdi-sticker-plus::before{content:"\F136C"}.mdi-sticker-plus-outline::before{content:"\F136D"}.mdi-sticker-remove::before{content:"\F136E"}.mdi-sticker-remove-outline::before{content:"\F136F"}.mdi-sticker-text::before{content:"\F178E"}.mdi-sticker-text-outline::before{content:"\F178F"}.mdi-stocking::before{content:"\F04DA"}.mdi-stomach::before{content:"\F1093"}.mdi-stool::before{content:"\F195D"}.mdi-stool-outline::before{content:"\F195E"}.mdi-stop::before{content:"\F04DB"}.mdi-stop-circle::before{content:"\F0666"}.mdi-stop-circle-outline::before{content:"\F0667"}.mdi-storage-tank::before{content:"\F1A75"}.mdi-storage-tank-outline::before{content:"\F1A76"}.mdi-store::before{content:"\F04DC"}.mdi-store-24-hour::before{content:"\F04DD"}.mdi-store-alert::before{content:"\F18C1"}.mdi-store-alert-outline::before{content:"\F18C2"}.mdi-store-check::before{content:"\F18C3"}.mdi-store-check-outline::before{content:"\F18C4"}.mdi-store-clock::before{content:"\F18C5"}.mdi-store-clock-outline::before{content:"\F18C6"}.mdi-store-cog::before{content:"\F18C7"}.mdi-store-cog-outline::before{content:"\F18C8"}.mdi-store-edit::before{content:"\F18C9"}.mdi-store-edit-outline::before{content:"\F18CA"}.mdi-store-marker::before{content:"\F18CB"}.mdi-store-marker-outline::before{content:"\F18CC"}.mdi-store-minus::before{content:"\F165E"}.mdi-store-minus-outline::before{content:"\F18CD"}.mdi-store-off::before{content:"\F18CE"}.mdi-store-off-outline::before{content:"\F18CF"}.mdi-store-outline::before{content:"\F1361"}.mdi-store-plus::before{content:"\F165F"}.mdi-store-plus-outline::before{content:"\F18D0"}.mdi-store-remove::before{content:"\F1660"}.mdi-store-remove-outline::before{content:"\F18D1"}.mdi-store-search::before{content:"\F18D2"}.mdi-store-search-outline::before{content:"\F18D3"}.mdi-store-settings::before{content:"\F18D4"}.mdi-store-settings-outline::before{content:"\F18D5"}.mdi-storefront::before{content:"\F07C7"}.mdi-storefront-check::before{content:"\F1B7D"}.mdi-storefront-check-outline::before{content:"\F1B7E"}.mdi-storefront-edit::before{content:"\F1B7F"}.mdi-storefront-edit-outline::before{content:"\F1B80"}.mdi-storefront-minus::before{content:"\F1B83"}.mdi-storefront-minus-outline::before{content:"\F1B84"}.mdi-storefront-outline::before{content:"\F10C1"}.mdi-storefront-plus::before{content:"\F1B81"}.mdi-storefront-plus-outline::before{content:"\F1B82"}.mdi-storefront-remove::before{content:"\F1B85"}.mdi-storefront-remove-outline::before{content:"\F1B86"}.mdi-stove::before{content:"\F04DE"}.mdi-strategy::before{content:"\F11D6"}.mdi-stretch-to-page::before{content:"\F0F2B"}.mdi-stretch-to-page-outline::before{content:"\F0F2C"}.mdi-string-lights::before{content:"\F12BA"}.mdi-string-lights-off::before{content:"\F12BB"}.mdi-subdirectory-arrow-left::before{content:"\F060C"}.mdi-subdirectory-arrow-right::before{content:"\F060D"}.mdi-submarine::before{content:"\F156C"}.mdi-subtitles::before{content:"\F0A16"}.mdi-subtitles-outline::before{content:"\F0A17"}.mdi-subway::before{content:"\F06AC"}.mdi-subway-alert-variant::before{content:"\F0D9D"}.mdi-subway-variant::before{content:"\F04DF"}.mdi-summit::before{content:"\F0786"}.mdi-sun-angle::before{content:"\F1B27"}.mdi-sun-angle-outline::before{content:"\F1B28"}.mdi-sun-clock::before{content:"\F1A77"}.mdi-sun-clock-outline::before{content:"\F1A78"}.mdi-sun-compass::before{content:"\F19A5"}.mdi-sun-snowflake::before{content:"\F1796"}.mdi-sun-snowflake-variant::before{content:"\F1A79"}.mdi-sun-thermometer::before{content:"\F18D6"}.mdi-sun-thermometer-outline::before{content:"\F18D7"}.mdi-sun-wireless::before{content:"\F17FE"}.mdi-sun-wireless-outline::before{content:"\F17FF"}.mdi-sunglasses::before{content:"\F04E0"}.mdi-surfing::before{content:"\F1746"}.mdi-surround-sound::before{content:"\F05C5"}.mdi-surround-sound-2-0::before{content:"\F07F0"}.mdi-surround-sound-2-1::before{content:"\F1729"}.mdi-surround-sound-3-1::before{content:"\F07F1"}.mdi-surround-sound-5-1::before{content:"\F07F2"}.mdi-surround-sound-5-1-2::before{content:"\F172A"}.mdi-surround-sound-7-1::before{content:"\F07F3"}.mdi-svg::before{content:"\F0721"}.mdi-swap-horizontal::before{content:"\F04E1"}.mdi-swap-horizontal-bold::before{content:"\F0BCD"}.mdi-swap-horizontal-circle::before{content:"\F0FE1"}.mdi-swap-horizontal-circle-outline::before{content:"\F0FE2"}.mdi-swap-horizontal-hidden::before{content:"\F1D0E"}.mdi-swap-horizontal-variant::before{content:"\F08C1"}.mdi-swap-vertical::before{content:"\F04E2"}.mdi-swap-vertical-bold::before{content:"\F0BCE"}.mdi-swap-vertical-circle::before{content:"\F0FE3"}.mdi-swap-vertical-circle-outline::before{content:"\F0FE4"}.mdi-swap-vertical-variant::before{content:"\F08C2"}.mdi-swim::before{content:"\F04E3"}.mdi-switch::before{content:"\F04E4"}.mdi-sword::before{content:"\F04E5"}.mdi-sword-cross::before{content:"\F0787"}.mdi-syllabary-hangul::before{content:"\F1333"}.mdi-syllabary-hiragana::before{content:"\F1334"}.mdi-syllabary-katakana::before{content:"\F1335"}.mdi-syllabary-katakana-halfwidth::before{content:"\F1336"}.mdi-symbol::before{content:"\F1501"}.mdi-symfony::before{content:"\F0AE6"}.mdi-synagogue::before{content:"\F1B04"}.mdi-synagogue-outline::before{content:"\F1B05"}.mdi-sync::before{content:"\F04E6"}.mdi-sync-alert::before{content:"\F04E7"}.mdi-sync-circle::before{content:"\F1378"}.mdi-sync-off::before{content:"\F04E8"}.mdi-tab::before{content:"\F04E9"}.mdi-tab-minus::before{content:"\F0B4B"}.mdi-tab-plus::before{content:"\F075C"}.mdi-tab-remove::before{content:"\F0B4C"}.mdi-tab-search::before{content:"\F199E"}.mdi-tab-unselected::before{content:"\F04EA"}.mdi-table::before{content:"\F04EB"}.mdi-table-account::before{content:"\F13B9"}.mdi-table-alert::before{content:"\F13BA"}.mdi-table-arrow-down::before{content:"\F13BB"}.mdi-table-arrow-left::before{content:"\F13BC"}.mdi-table-arrow-right::before{content:"\F13BD"}.mdi-table-arrow-up::before{content:"\F13BE"}.mdi-table-border::before{content:"\F0A18"}.mdi-table-cancel::before{content:"\F13BF"}.mdi-table-chair::before{content:"\F1061"}.mdi-table-check::before{content:"\F13C0"}.mdi-table-clock::before{content:"\F13C1"}.mdi-table-cog::before{content:"\F13C2"}.mdi-table-column::before{content:"\F0835"}.mdi-table-column-plus-after::before{content:"\F04EC"}.mdi-table-column-plus-before::before{content:"\F04ED"}.mdi-table-column-remove::before{content:"\F04EE"}.mdi-table-column-width::before{content:"\F04EF"}.mdi-table-edit::before{content:"\F04F0"}.mdi-table-eye::before{content:"\F1094"}.mdi-table-eye-off::before{content:"\F13C3"}.mdi-table-filter::before{content:"\F1B8C"}.mdi-table-furniture::before{content:"\F05BC"}.mdi-table-headers-eye::before{content:"\F121D"}.mdi-table-headers-eye-off::before{content:"\F121E"}.mdi-table-heart::before{content:"\F13C4"}.mdi-table-key::before{content:"\F13C5"}.mdi-table-large::before{content:"\F04F1"}.mdi-table-large-plus::before{content:"\F0F87"}.mdi-table-large-remove::before{content:"\F0F88"}.mdi-table-lock::before{content:"\F13C6"}.mdi-table-merge-cells::before{content:"\F09A6"}.mdi-table-minus::before{content:"\F13C7"}.mdi-table-multiple::before{content:"\F13C8"}.mdi-table-network::before{content:"\F13C9"}.mdi-table-of-contents::before{content:"\F0836"}.mdi-table-off::before{content:"\F13CA"}.mdi-table-picnic::before{content:"\F1743"}.mdi-table-pivot::before{content:"\F183C"}.mdi-table-plus::before{content:"\F0A75"}.mdi-table-question::before{content:"\F1B21"}.mdi-table-refresh::before{content:"\F13A0"}.mdi-table-remove::before{content:"\F0A76"}.mdi-table-row::before{content:"\F0837"}.mdi-table-row-height::before{content:"\F04F2"}.mdi-table-row-plus-after::before{content:"\F04F3"}.mdi-table-row-plus-before::before{content:"\F04F4"}.mdi-table-row-remove::before{content:"\F04F5"}.mdi-table-search::before{content:"\F090F"}.mdi-table-settings::before{content:"\F0838"}.mdi-table-split-cell::before{content:"\F142A"}.mdi-table-star::before{content:"\F13CB"}.mdi-table-sync::before{content:"\F13A1"}.mdi-table-tennis::before{content:"\F0E68"}.mdi-tablet::before{content:"\F04F6"}.mdi-tablet-cellphone::before{content:"\F09A7"}.mdi-tablet-dashboard::before{content:"\F0ECE"}.mdi-taco::before{content:"\F0762"}.mdi-tag::before{content:"\F04F9"}.mdi-tag-arrow-down::before{content:"\F172B"}.mdi-tag-arrow-down-outline::before{content:"\F172C"}.mdi-tag-arrow-left::before{content:"\F172D"}.mdi-tag-arrow-left-outline::before{content:"\F172E"}.mdi-tag-arrow-right::before{content:"\F172F"}.mdi-tag-arrow-right-outline::before{content:"\F1730"}.mdi-tag-arrow-up::before{content:"\F1731"}.mdi-tag-arrow-up-outline::before{content:"\F1732"}.mdi-tag-check::before{content:"\F1A7A"}.mdi-tag-check-outline::before{content:"\F1A7B"}.mdi-tag-edit::before{content:"\F1C9C"}.mdi-tag-edit-outline::before{content:"\F1C9D"}.mdi-tag-faces::before{content:"\F04FA"}.mdi-tag-heart::before{content:"\F068B"}.mdi-tag-heart-outline::before{content:"\F0BCF"}.mdi-tag-hidden::before{content:"\F1C76"}.mdi-tag-minus::before{content:"\F0910"}.mdi-tag-minus-outline::before{content:"\F121F"}.mdi-tag-multiple::before{content:"\F04FB"}.mdi-tag-multiple-outline::before{content:"\F12F7"}.mdi-tag-off::before{content:"\F1220"}.mdi-tag-off-outline::before{content:"\F1221"}.mdi-tag-outline::before{content:"\F04FC"}.mdi-tag-plus::before{content:"\F0722"}.mdi-tag-plus-outline::before{content:"\F1222"}.mdi-tag-remove::before{content:"\F0723"}.mdi-tag-remove-outline::before{content:"\F1223"}.mdi-tag-search::before{content:"\F1907"}.mdi-tag-search-outline::before{content:"\F1908"}.mdi-tag-text::before{content:"\F1224"}.mdi-tag-text-outline::before{content:"\F04FD"}.mdi-tailwind::before{content:"\F13FF"}.mdi-tally-mark-1::before{content:"\F1ABC"}.mdi-tally-mark-2::before{content:"\F1ABD"}.mdi-tally-mark-3::before{content:"\F1ABE"}.mdi-tally-mark-4::before{content:"\F1ABF"}.mdi-tally-mark-5::before{content:"\F1AC0"}.mdi-tangram::before{content:"\F04F8"}.mdi-tank::before{content:"\F0D3A"}.mdi-tanker-truck::before{content:"\F0FE5"}.mdi-tape-drive::before{content:"\F16DF"}.mdi-tape-measure::before{content:"\F0B4D"}.mdi-target::before{content:"\F04FE"}.mdi-target-account::before{content:"\F0BD0"}.mdi-target-variant::before{content:"\F0A77"}.mdi-taxi::before{content:"\F04FF"}.mdi-tea::before{content:"\F0D9E"}.mdi-tea-outline::before{content:"\F0D9F"}.mdi-teamviewer::before{content:"\F0500"}.mdi-teddy-bear::before{content:"\F18FB"}.mdi-telescope::before{content:"\F0B4E"}.mdi-television::before{content:"\F0502"}.mdi-television-ambient-light::before{content:"\F1356"}.mdi-television-box::before{content:"\F0839"}.mdi-television-classic::before{content:"\F07F4"}.mdi-television-classic-off::before{content:"\F083A"}.mdi-television-guide::before{content:"\F0503"}.mdi-television-off::before{content:"\F083B"}.mdi-television-pause::before{content:"\F0F89"}.mdi-television-play::before{content:"\F0ECF"}.mdi-television-shimmer::before{content:"\F1110"}.mdi-television-speaker::before{content:"\F1B1B"}.mdi-television-speaker-off::before{content:"\F1B1C"}.mdi-television-stop::before{content:"\F0F8A"}.mdi-temperature-celsius::before{content:"\F0504"}.mdi-temperature-fahrenheit::before{content:"\F0505"}.mdi-temperature-kelvin::before{content:"\F0506"}.mdi-temple-buddhist::before{content:"\F1B06"}.mdi-temple-buddhist-outline::before{content:"\F1B07"}.mdi-temple-hindu::before{content:"\F1B08"}.mdi-temple-hindu-outline::before{content:"\F1B09"}.mdi-tennis::before{content:"\F0DA0"}.mdi-tennis-ball::before{content:"\F0507"}.mdi-tennis-ball-outline::before{content:"\F1C5F"}.mdi-tent::before{content:"\F0508"}.mdi-terraform::before{content:"\F1062"}.mdi-terrain::before{content:"\F0509"}.mdi-test-tube::before{content:"\F0668"}.mdi-test-tube-empty::before{content:"\F0911"}.mdi-test-tube-off::before{content:"\F0912"}.mdi-text::before{content:"\F09A8"}.mdi-text-account::before{content:"\F1570"}.mdi-text-box::before{content:"\F021A"}.mdi-text-box-check::before{content:"\F0EA6"}.mdi-text-box-check-outline::before{content:"\F0EA7"}.mdi-text-box-edit::before{content:"\F1A7C"}.mdi-text-box-edit-outline::before{content:"\F1A7D"}.mdi-text-box-minus::before{content:"\F0EA8"}.mdi-text-box-minus-outline::before{content:"\F0EA9"}.mdi-text-box-multiple::before{content:"\F0AB7"}.mdi-text-box-multiple-outline::before{content:"\F0AB8"}.mdi-text-box-outline::before{content:"\F09ED"}.mdi-text-box-plus::before{content:"\F0EAA"}.mdi-text-box-plus-outline::before{content:"\F0EAB"}.mdi-text-box-remove::before{content:"\F0EAC"}.mdi-text-box-remove-outline::before{content:"\F0EAD"}.mdi-text-box-search::before{content:"\F0EAE"}.mdi-text-box-search-outline::before{content:"\F0EAF"}.mdi-text-long::before{content:"\F09AA"}.mdi-text-recognition::before{content:"\F113D"}.mdi-text-search::before{content:"\F13B8"}.mdi-text-search-variant::before{content:"\F1A7E"}.mdi-text-shadow::before{content:"\F0669"}.mdi-text-short::before{content:"\F09A9"}.mdi-texture::before{content:"\F050C"}.mdi-texture-box::before{content:"\F0FE6"}.mdi-theater::before{content:"\F050D"}.mdi-theme-light-dark::before{content:"\F050E"}.mdi-thermometer::before{content:"\F050F"}.mdi-thermometer-alert::before{content:"\F0E01"}.mdi-thermometer-auto::before{content:"\F1B0F"}.mdi-thermometer-bluetooth::before{content:"\F1895"}.mdi-thermometer-check::before{content:"\F1A7F"}.mdi-thermometer-chevron-down::before{content:"\F0E02"}.mdi-thermometer-chevron-up::before{content:"\F0E03"}.mdi-thermometer-high::before{content:"\F10C2"}.mdi-thermometer-lines::before{content:"\F0510"}.mdi-thermometer-low::before{content:"\F10C3"}.mdi-thermometer-minus::before{content:"\F0E04"}.mdi-thermometer-off::before{content:"\F1531"}.mdi-thermometer-plus::before{content:"\F0E05"}.mdi-thermometer-probe::before{content:"\F1B2B"}.mdi-thermometer-probe-off::before{content:"\F1B2C"}.mdi-thermometer-water::before{content:"\F1A80"}.mdi-thermostat::before{content:"\F0393"}.mdi-thermostat-auto::before{content:"\F1B17"}.mdi-thermostat-box::before{content:"\F0891"}.mdi-thermostat-box-auto::before{content:"\F1B18"}.mdi-thermostat-cog::before{content:"\F1C80"}.mdi-thought-bubble::before{content:"\F07F6"}.mdi-thought-bubble-outline::before{content:"\F07F7"}.mdi-thumb-down::before{content:"\F0511"}.mdi-thumb-down-outline::before{content:"\F0512"}.mdi-thumb-up::before{content:"\F0513"}.mdi-thumb-up-outline::before{content:"\F0514"}.mdi-thumbs-up-down::before{content:"\F0515"}.mdi-thumbs-up-down-outline::before{content:"\F1914"}.mdi-ticket::before{content:"\F0516"}.mdi-ticket-account::before{content:"\F0517"}.mdi-ticket-confirmation::before{content:"\F0518"}.mdi-ticket-confirmation-outline::before{content:"\F13AA"}.mdi-ticket-outline::before{content:"\F0913"}.mdi-ticket-percent::before{content:"\F0724"}.mdi-ticket-percent-outline::before{content:"\F142B"}.mdi-tie::before{content:"\F0519"}.mdi-tilde::before{content:"\F0725"}.mdi-tilde-off::before{content:"\F18F3"}.mdi-timelapse::before{content:"\F051A"}.mdi-timeline::before{content:"\F0BD1"}.mdi-timeline-alert::before{content:"\F0F95"}.mdi-timeline-alert-outline::before{content:"\F0F98"}.mdi-timeline-check::before{content:"\F1532"}.mdi-timeline-check-outline::before{content:"\F1533"}.mdi-timeline-clock::before{content:"\F11FB"}.mdi-timeline-clock-outline::before{content:"\F11FC"}.mdi-timeline-minus::before{content:"\F1534"}.mdi-timeline-minus-outline::before{content:"\F1535"}.mdi-timeline-outline::before{content:"\F0BD2"}.mdi-timeline-plus::before{content:"\F0F96"}.mdi-timeline-plus-outline::before{content:"\F0F97"}.mdi-timeline-question::before{content:"\F0F99"}.mdi-timeline-question-outline::before{content:"\F0F9A"}.mdi-timeline-remove::before{content:"\F1536"}.mdi-timeline-remove-outline::before{content:"\F1537"}.mdi-timeline-text::before{content:"\F0BD3"}.mdi-timeline-text-outline::before{content:"\F0BD4"}.mdi-timer::before{content:"\F13AB"}.mdi-timer-10::before{content:"\F051C"}.mdi-timer-3::before{content:"\F051D"}.mdi-timer-alert::before{content:"\F1ACC"}.mdi-timer-alert-outline::before{content:"\F1ACD"}.mdi-timer-cancel::before{content:"\F1ACE"}.mdi-timer-cancel-outline::before{content:"\F1ACF"}.mdi-timer-check::before{content:"\F1AD0"}.mdi-timer-check-outline::before{content:"\F1AD1"}.mdi-timer-cog::before{content:"\F1925"}.mdi-timer-cog-outline::before{content:"\F1926"}.mdi-timer-edit::before{content:"\F1AD2"}.mdi-timer-edit-outline::before{content:"\F1AD3"}.mdi-timer-lock::before{content:"\F1AD4"}.mdi-timer-lock-open::before{content:"\F1AD5"}.mdi-timer-lock-open-outline::before{content:"\F1AD6"}.mdi-timer-lock-outline::before{content:"\F1AD7"}.mdi-timer-marker::before{content:"\F1AD8"}.mdi-timer-marker-outline::before{content:"\F1AD9"}.mdi-timer-minus::before{content:"\F1ADA"}.mdi-timer-minus-outline::before{content:"\F1ADB"}.mdi-timer-music::before{content:"\F1ADC"}.mdi-timer-music-outline::before{content:"\F1ADD"}.mdi-timer-off::before{content:"\F13AC"}.mdi-timer-off-outline::before{content:"\F051E"}.mdi-timer-outline::before{content:"\F051B"}.mdi-timer-pause::before{content:"\F1ADE"}.mdi-timer-pause-outline::before{content:"\F1ADF"}.mdi-timer-play::before{content:"\F1AE0"}.mdi-timer-play-outline::before{content:"\F1AE1"}.mdi-timer-plus::before{content:"\F1AE2"}.mdi-timer-plus-outline::before{content:"\F1AE3"}.mdi-timer-refresh::before{content:"\F1AE4"}.mdi-timer-refresh-outline::before{content:"\F1AE5"}.mdi-timer-remove::before{content:"\F1AE6"}.mdi-timer-remove-outline::before{content:"\F1AE7"}.mdi-timer-sand::before{content:"\F051F"}.mdi-timer-sand-complete::before{content:"\F199F"}.mdi-timer-sand-empty::before{content:"\F06AD"}.mdi-timer-sand-full::before{content:"\F078C"}.mdi-timer-sand-paused::before{content:"\F19A0"}.mdi-timer-settings::before{content:"\F1923"}.mdi-timer-settings-outline::before{content:"\F1924"}.mdi-timer-star::before{content:"\F1AE8"}.mdi-timer-star-outline::before{content:"\F1AE9"}.mdi-timer-stop::before{content:"\F1AEA"}.mdi-timer-stop-outline::before{content:"\F1AEB"}.mdi-timer-sync::before{content:"\F1AEC"}.mdi-timer-sync-outline::before{content:"\F1AED"}.mdi-timetable::before{content:"\F0520"}.mdi-tire::before{content:"\F1896"}.mdi-toaster::before{content:"\F1063"}.mdi-toaster-off::before{content:"\F11B7"}.mdi-toaster-oven::before{content:"\F0CD3"}.mdi-toggle-switch::before{content:"\F0521"}.mdi-toggle-switch-off::before{content:"\F0522"}.mdi-toggle-switch-off-outline::before{content:"\F0A19"}.mdi-toggle-switch-outline::before{content:"\F0A1A"}.mdi-toggle-switch-variant::before{content:"\F1A25"}.mdi-toggle-switch-variant-off::before{content:"\F1A26"}.mdi-toilet::before{content:"\F09AB"}.mdi-toolbox::before{content:"\F09AC"}.mdi-toolbox-outline::before{content:"\F09AD"}.mdi-tools::before{content:"\F1064"}.mdi-tooltip::before{content:"\F0523"}.mdi-tooltip-account::before{content:"\F000C"}.mdi-tooltip-cellphone::before{content:"\F183B"}.mdi-tooltip-check::before{content:"\F155C"}.mdi-tooltip-check-outline::before{content:"\F155D"}.mdi-tooltip-edit::before{content:"\F0524"}.mdi-tooltip-edit-outline::before{content:"\F12C5"}.mdi-tooltip-image::before{content:"\F0525"}.mdi-tooltip-image-outline::before{content:"\F0BD5"}.mdi-tooltip-minus::before{content:"\F155E"}.mdi-tooltip-minus-outline::before{content:"\F155F"}.mdi-tooltip-outline::before{content:"\F0526"}.mdi-tooltip-plus::before{content:"\F0BD6"}.mdi-tooltip-plus-outline::before{content:"\F0527"}.mdi-tooltip-question::before{content:"\F1BBA"}.mdi-tooltip-question-outline::before{content:"\F1BBB"}.mdi-tooltip-remove::before{content:"\F1560"}.mdi-tooltip-remove-outline::before{content:"\F1561"}.mdi-tooltip-text::before{content:"\F0528"}.mdi-tooltip-text-outline::before{content:"\F0BD7"}.mdi-tooth::before{content:"\F08C3"}.mdi-tooth-outline::before{content:"\F0529"}.mdi-toothbrush::before{content:"\F1129"}.mdi-toothbrush-electric::before{content:"\F112C"}.mdi-toothbrush-paste::before{content:"\F112A"}.mdi-torch::before{content:"\F1606"}.mdi-tortoise::before{content:"\F0D3B"}.mdi-toslink::before{content:"\F12B8"}.mdi-touch-text-outline::before{content:"\F1C60"}.mdi-tournament::before{content:"\F09AE"}.mdi-tow-truck::before{content:"\F083C"}.mdi-tower-beach::before{content:"\F0681"}.mdi-tower-fire::before{content:"\F0682"}.mdi-town-hall::before{content:"\F1875"}.mdi-toy-brick::before{content:"\F1288"}.mdi-toy-brick-marker::before{content:"\F1289"}.mdi-toy-brick-marker-outline::before{content:"\F128A"}.mdi-toy-brick-minus::before{content:"\F128B"}.mdi-toy-brick-minus-outline::before{content:"\F128C"}.mdi-toy-brick-outline::before{content:"\F128D"}.mdi-toy-brick-plus::before{content:"\F128E"}.mdi-toy-brick-plus-outline::before{content:"\F128F"}.mdi-toy-brick-remove::before{content:"\F1290"}.mdi-toy-brick-remove-outline::before{content:"\F1291"}.mdi-toy-brick-search::before{content:"\F1292"}.mdi-toy-brick-search-outline::before{content:"\F1293"}.mdi-track-light::before{content:"\F0914"}.mdi-track-light-off::before{content:"\F1B01"}.mdi-trackpad::before{content:"\F07F8"}.mdi-trackpad-lock::before{content:"\F0933"}.mdi-tractor::before{content:"\F0892"}.mdi-tractor-variant::before{content:"\F14C4"}.mdi-trademark::before{content:"\F0A78"}.mdi-traffic-cone::before{content:"\F137C"}.mdi-traffic-light::before{content:"\F052B"}.mdi-traffic-light-outline::before{content:"\F182A"}.mdi-train::before{content:"\F052C"}.mdi-train-bus::before{content:"\F1CC7"}.mdi-train-car::before{content:"\F0BD8"}.mdi-train-car-autorack::before{content:"\F1B2D"}.mdi-train-car-box::before{content:"\F1B2E"}.mdi-train-car-box-full::before{content:"\F1B2F"}.mdi-train-car-box-open::before{content:"\F1B30"}.mdi-train-car-caboose::before{content:"\F1B31"}.mdi-train-car-centerbeam::before{content:"\F1B32"}.mdi-train-car-centerbeam-full::before{content:"\F1B33"}.mdi-train-car-container::before{content:"\F1B34"}.mdi-train-car-flatbed::before{content:"\F1B35"}.mdi-train-car-flatbed-car::before{content:"\F1B36"}.mdi-train-car-flatbed-tank::before{content:"\F1B37"}.mdi-train-car-gondola::before{content:"\F1B38"}.mdi-train-car-gondola-full::before{content:"\F1B39"}.mdi-train-car-hopper::before{content:"\F1B3A"}.mdi-train-car-hopper-covered::before{content:"\F1B3B"}.mdi-train-car-hopper-full::before{content:"\F1B3C"}.mdi-train-car-intermodal::before{content:"\F1B3D"}.mdi-train-car-passenger::before{content:"\F1733"}.mdi-train-car-passenger-door::before{content:"\F1734"}.mdi-train-car-passenger-door-open::before{content:"\F1735"}.mdi-train-car-passenger-variant::before{content:"\F1736"}.mdi-train-car-tank::before{content:"\F1B3E"}.mdi-train-variant::before{content:"\F08C4"}.mdi-tram::before{content:"\F052D"}.mdi-tram-side::before{content:"\F0FE7"}.mdi-transcribe::before{content:"\F052E"}.mdi-transcribe-close::before{content:"\F052F"}.mdi-transfer::before{content:"\F1065"}.mdi-transfer-down::before{content:"\F0DA1"}.mdi-transfer-left::before{content:"\F0DA2"}.mdi-transfer-right::before{content:"\F0530"}.mdi-transfer-up::before{content:"\F0DA3"}.mdi-transit-connection::before{content:"\F0D3C"}.mdi-transit-connection-horizontal::before{content:"\F1546"}.mdi-transit-connection-variant::before{content:"\F0D3D"}.mdi-transit-detour::before{content:"\F0F8B"}.mdi-transit-skip::before{content:"\F1515"}.mdi-transit-transfer::before{content:"\F06AE"}.mdi-transition::before{content:"\F0915"}.mdi-transition-masked::before{content:"\F0916"}.mdi-translate::before{content:"\F05CA"}.mdi-translate-off::before{content:"\F0E06"}.mdi-translate-variant::before{content:"\F1B99"}.mdi-transmission-tower::before{content:"\F0D3E"}.mdi-transmission-tower-export::before{content:"\F192C"}.mdi-transmission-tower-import::before{content:"\F192D"}.mdi-transmission-tower-off::before{content:"\F19DD"}.mdi-trash-can::before{content:"\F0A79"}.mdi-trash-can-outline::before{content:"\F0A7A"}.mdi-tray::before{content:"\F1294"}.mdi-tray-alert::before{content:"\F1295"}.mdi-tray-arrow-down::before{content:"\F0120"}.mdi-tray-arrow-up::before{content:"\F011D"}.mdi-tray-full::before{content:"\F1296"}.mdi-tray-minus::before{content:"\F1297"}.mdi-tray-plus::before{content:"\F1298"}.mdi-tray-remove::before{content:"\F1299"}.mdi-treasure-chest::before{content:"\F0726"}.mdi-treasure-chest-outline::before{content:"\F1C77"}.mdi-tree::before{content:"\F0531"}.mdi-tree-outline::before{content:"\F0E69"}.mdi-trello::before{content:"\F0532"}.mdi-trending-down::before{content:"\F0533"}.mdi-trending-neutral::before{content:"\F0534"}.mdi-trending-up::before{content:"\F0535"}.mdi-triangle::before{content:"\F0536"}.mdi-triangle-down::before{content:"\F1C56"}.mdi-triangle-down-outline::before{content:"\F1C57"}.mdi-triangle-outline::before{content:"\F0537"}.mdi-triangle-small-down::before{content:"\F1A09"}.mdi-triangle-small-up::before{content:"\F1A0A"}.mdi-triangle-wave::before{content:"\F147C"}.mdi-triforce::before{content:"\F0BD9"}.mdi-trophy::before{content:"\F0538"}.mdi-trophy-award::before{content:"\F0539"}.mdi-trophy-broken::before{content:"\F0DA4"}.mdi-trophy-outline::before{content:"\F053A"}.mdi-trophy-variant::before{content:"\F053B"}.mdi-trophy-variant-outline::before{content:"\F053C"}.mdi-truck::before{content:"\F053D"}.mdi-truck-alert::before{content:"\F19DE"}.mdi-truck-alert-outline::before{content:"\F19DF"}.mdi-truck-cargo-container::before{content:"\F18D8"}.mdi-truck-check::before{content:"\F0CD4"}.mdi-truck-check-outline::before{content:"\F129A"}.mdi-truck-delivery::before{content:"\F053E"}.mdi-truck-delivery-outline::before{content:"\F129B"}.mdi-truck-fast::before{content:"\F0788"}.mdi-truck-fast-outline::before{content:"\F129C"}.mdi-truck-flatbed::before{content:"\F1891"}.mdi-truck-minus::before{content:"\F19AE"}.mdi-truck-minus-outline::before{content:"\F19BD"}.mdi-truck-off-road::before{content:"\F1C9E"}.mdi-truck-off-road-off::before{content:"\F1C9F"}.mdi-truck-outline::before{content:"\F129D"}.mdi-truck-plus::before{content:"\F19AD"}.mdi-truck-plus-outline::before{content:"\F19BC"}.mdi-truck-remove::before{content:"\F19AF"}.mdi-truck-remove-outline::before{content:"\F19BE"}.mdi-truck-snowflake::before{content:"\F19A6"}.mdi-truck-trailer::before{content:"\F0727"}.mdi-trumpet::before{content:"\F1096"}.mdi-tshirt-crew::before{content:"\F0A7B"}.mdi-tshirt-crew-outline::before{content:"\F053F"}.mdi-tshirt-v::before{content:"\F0A7C"}.mdi-tshirt-v-outline::before{content:"\F0540"}.mdi-tsunami::before{content:"\F1A81"}.mdi-tumble-dryer::before{content:"\F0917"}.mdi-tumble-dryer-alert::before{content:"\F11BA"}.mdi-tumble-dryer-off::before{content:"\F11BB"}.mdi-tune::before{content:"\F062E"}.mdi-tune-variant::before{content:"\F1542"}.mdi-tune-vertical::before{content:"\F066A"}.mdi-tune-vertical-variant::before{content:"\F1543"}.mdi-tunnel::before{content:"\F183D"}.mdi-tunnel-outline::before{content:"\F183E"}.mdi-turbine::before{content:"\F1A82"}.mdi-turkey::before{content:"\F171B"}.mdi-turnstile::before{content:"\F0CD5"}.mdi-turnstile-outline::before{content:"\F0CD6"}.mdi-turtle::before{content:"\F0CD7"}.mdi-twitch::before{content:"\F0543"}.mdi-twitter::before{content:"\F0544"}.mdi-two-factor-authentication::before{content:"\F09AF"}.mdi-typewriter::before{content:"\F0F2D"}.mdi-ubisoft::before{content:"\F0BDA"}.mdi-ubuntu::before{content:"\F0548"}.mdi-ufo::before{content:"\F10C4"}.mdi-ufo-outline::before{content:"\F10C5"}.mdi-ultra-high-definition::before{content:"\F07F9"}.mdi-umbraco::before{content:"\F0549"}.mdi-umbrella::before{content:"\F054A"}.mdi-umbrella-beach::before{content:"\F188A"}.mdi-umbrella-beach-outline::before{content:"\F188B"}.mdi-umbrella-closed::before{content:"\F09B0"}.mdi-umbrella-closed-outline::before{content:"\F13E2"}.mdi-umbrella-closed-variant::before{content:"\F13E1"}.mdi-umbrella-outline::before{content:"\F054B"}.mdi-underwear-outline::before{content:"\F1D0F"}.mdi-undo::before{content:"\F054C"}.mdi-undo-variant::before{content:"\F054D"}.mdi-unfold-less-horizontal::before{content:"\F054E"}.mdi-unfold-less-vertical::before{content:"\F0760"}.mdi-unfold-more-horizontal::before{content:"\F054F"}.mdi-unfold-more-vertical::before{content:"\F0761"}.mdi-ungroup::before{content:"\F0550"}.mdi-unicode::before{content:"\F0ED0"}.mdi-unicorn::before{content:"\F15C2"}.mdi-unicorn-variant::before{content:"\F15C3"}.mdi-unicycle::before{content:"\F15E5"}.mdi-unity::before{content:"\F06AF"}.mdi-unreal::before{content:"\F09B1"}.mdi-update::before{content:"\F06B0"}.mdi-upload::before{content:"\F0552"}.mdi-upload-box::before{content:"\F1D10"}.mdi-upload-box-outline::before{content:"\F1D11"}.mdi-upload-circle::before{content:"\F1D12"}.mdi-upload-circle-outline::before{content:"\F1D13"}.mdi-upload-lock::before{content:"\F1373"}.mdi-upload-lock-outline::before{content:"\F1374"}.mdi-upload-multiple::before{content:"\F083D"}.mdi-upload-multiple-outline::before{content:"\F1D14"}.mdi-upload-network::before{content:"\F06F6"}.mdi-upload-network-outline::before{content:"\F0CD8"}.mdi-upload-off::before{content:"\F10C6"}.mdi-upload-off-outline::before{content:"\F10C7"}.mdi-upload-outline::before{content:"\F0E07"}.mdi-usb::before{content:"\F0553"}.mdi-usb-c-port::before{content:"\F1CBF"}.mdi-usb-flash-drive::before{content:"\F129E"}.mdi-usb-flash-drive-outline::before{content:"\F129F"}.mdi-usb-port::before{content:"\F11F0"}.mdi-vacuum::before{content:"\F19A1"}.mdi-vacuum-outline::before{content:"\F19A2"}.mdi-valve::before{content:"\F1066"}.mdi-valve-closed::before{content:"\F1067"}.mdi-valve-open::before{content:"\F1068"}.mdi-van-passenger::before{content:"\F07FA"}.mdi-van-utility::before{content:"\F07FB"}.mdi-vanish::before{content:"\F07FC"}.mdi-vanish-quarter::before{content:"\F1554"}.mdi-vanity-light::before{content:"\F11E1"}.mdi-variable::before{content:"\F0AE7"}.mdi-variable-box::before{content:"\F1111"}.mdi-vector-arrange-above::before{content:"\F0554"}.mdi-vector-arrange-below::before{content:"\F0555"}.mdi-vector-bezier::before{content:"\F0AE8"}.mdi-vector-circle::before{content:"\F0556"}.mdi-vector-circle-variant::before{content:"\F0557"}.mdi-vector-combine::before{content:"\F0558"}.mdi-vector-curve::before{content:"\F0559"}.mdi-vector-difference::before{content:"\F055A"}.mdi-vector-difference-ab::before{content:"\F055B"}.mdi-vector-difference-ba::before{content:"\F055C"}.mdi-vector-ellipse::before{content:"\F0893"}.mdi-vector-intersection::before{content:"\F055D"}.mdi-vector-line::before{content:"\F055E"}.mdi-vector-link::before{content:"\F0FE8"}.mdi-vector-point::before{content:"\F01C4"}.mdi-vector-point-edit::before{content:"\F09E8"}.mdi-vector-point-minus::before{content:"\F1B78"}.mdi-vector-point-plus::before{content:"\F1B79"}.mdi-vector-point-select::before{content:"\F055F"}.mdi-vector-polygon::before{content:"\F0560"}.mdi-vector-polygon-variant::before{content:"\F1856"}.mdi-vector-polyline::before{content:"\F0561"}.mdi-vector-polyline-edit::before{content:"\F1225"}.mdi-vector-polyline-minus::before{content:"\F1226"}.mdi-vector-polyline-plus::before{content:"\F1227"}.mdi-vector-polyline-remove::before{content:"\F1228"}.mdi-vector-radius::before{content:"\F074A"}.mdi-vector-rectangle::before{content:"\F05C6"}.mdi-vector-selection::before{content:"\F0562"}.mdi-vector-square::before{content:"\F0001"}.mdi-vector-square-close::before{content:"\F1857"}.mdi-vector-square-edit::before{content:"\F18D9"}.mdi-vector-square-minus::before{content:"\F18DA"}.mdi-vector-square-open::before{content:"\F1858"}.mdi-vector-square-plus::before{content:"\F18DB"}.mdi-vector-square-remove::before{content:"\F18DC"}.mdi-vector-triangle::before{content:"\F0563"}.mdi-vector-union::before{content:"\F0564"}.mdi-vhs::before{content:"\F0A1B"}.mdi-vibrate::before{content:"\F0566"}.mdi-vibrate-off::before{content:"\F0CD9"}.mdi-video::before{content:"\F0567"}.mdi-video-2d::before{content:"\F1A1C"}.mdi-video-3d::before{content:"\F07FD"}.mdi-video-3d-off::before{content:"\F13D9"}.mdi-video-3d-variant::before{content:"\F0ED1"}.mdi-video-4k-box::before{content:"\F083E"}.mdi-video-account::before{content:"\F0919"}.mdi-video-box::before{content:"\F00FD"}.mdi-video-box-off::before{content:"\F00FE"}.mdi-video-check::before{content:"\F1069"}.mdi-video-check-outline::before{content:"\F106A"}.mdi-video-high-definition::before{content:"\F152E"}.mdi-video-image::before{content:"\F091A"}.mdi-video-input-antenna::before{content:"\F083F"}.mdi-video-input-component::before{content:"\F0840"}.mdi-video-input-hdmi::before{content:"\F0841"}.mdi-video-input-scart::before{content:"\F0F8C"}.mdi-video-input-svideo::before{content:"\F0842"}.mdi-video-marker::before{content:"\F19A9"}.mdi-video-marker-outline::before{content:"\F19AA"}.mdi-video-minus::before{content:"\F09B2"}.mdi-video-minus-outline::before{content:"\F02BA"}.mdi-video-off::before{content:"\F0568"}.mdi-video-off-outline::before{content:"\F0BDB"}.mdi-video-outline::before{content:"\F0BDC"}.mdi-video-plus::before{content:"\F09B3"}.mdi-video-plus-outline::before{content:"\F01D3"}.mdi-video-stabilization::before{content:"\F091B"}.mdi-video-standard-definition::before{content:"\F1CA0"}.mdi-video-switch::before{content:"\F0569"}.mdi-video-switch-outline::before{content:"\F0790"}.mdi-video-vintage::before{content:"\F0A1C"}.mdi-video-wireless::before{content:"\F0ED2"}.mdi-video-wireless-outline::before{content:"\F0ED3"}.mdi-view-agenda::before{content:"\F056A"}.mdi-view-agenda-outline::before{content:"\F11D8"}.mdi-view-array::before{content:"\F056B"}.mdi-view-array-outline::before{content:"\F1485"}.mdi-view-carousel::before{content:"\F056C"}.mdi-view-carousel-outline::before{content:"\F1486"}.mdi-view-column::before{content:"\F056D"}.mdi-view-column-outline::before{content:"\F1487"}.mdi-view-comfy::before{content:"\F0E6A"}.mdi-view-comfy-outline::before{content:"\F1488"}.mdi-view-compact::before{content:"\F0E6B"}.mdi-view-compact-outline::before{content:"\F0E6C"}.mdi-view-dashboard::before{content:"\F056E"}.mdi-view-dashboard-edit::before{content:"\F1947"}.mdi-view-dashboard-edit-outline::before{content:"\F1948"}.mdi-view-dashboard-outline::before{content:"\F0A1D"}.mdi-view-dashboard-variant::before{content:"\F0843"}.mdi-view-dashboard-variant-outline::before{content:"\F1489"}.mdi-view-day::before{content:"\F056F"}.mdi-view-day-outline::before{content:"\F148A"}.mdi-view-gallery::before{content:"\F1888"}.mdi-view-gallery-outline::before{content:"\F1889"}.mdi-view-grid::before{content:"\F0570"}.mdi-view-grid-compact::before{content:"\F1C61"}.mdi-view-grid-outline::before{content:"\F11D9"}.mdi-view-grid-plus::before{content:"\F0F8D"}.mdi-view-grid-plus-outline::before{content:"\F11DA"}.mdi-view-headline::before{content:"\F0571"}.mdi-view-list::before{content:"\F0572"}.mdi-view-list-outline::before{content:"\F148B"}.mdi-view-module::before{content:"\F0573"}.mdi-view-module-outline::before{content:"\F148C"}.mdi-view-parallel::before{content:"\F0728"}.mdi-view-parallel-outline::before{content:"\F148D"}.mdi-view-quilt::before{content:"\F0574"}.mdi-view-quilt-outline::before{content:"\F148E"}.mdi-view-sequential::before{content:"\F0729"}.mdi-view-sequential-outline::before{content:"\F148F"}.mdi-view-split-horizontal::before{content:"\F0BCB"}.mdi-view-split-vertical::before{content:"\F0BCC"}.mdi-view-stream::before{content:"\F0575"}.mdi-view-stream-outline::before{content:"\F1490"}.mdi-view-week::before{content:"\F0576"}.mdi-view-week-outline::before{content:"\F1491"}.mdi-vimeo::before{content:"\F0577"}.mdi-violin::before{content:"\F060F"}.mdi-virtual-reality::before{content:"\F0894"}.mdi-virus::before{content:"\F13B6"}.mdi-virus-off::before{content:"\F18E1"}.mdi-virus-off-outline::before{content:"\F18E2"}.mdi-virus-outline::before{content:"\F13B7"}.mdi-vlc::before{content:"\F057C"}.mdi-voicemail::before{content:"\F057D"}.mdi-volcano::before{content:"\F1A83"}.mdi-volcano-outline::before{content:"\F1A84"}.mdi-volleyball::before{content:"\F09B4"}.mdi-volume-equal::before{content:"\F1B10"}.mdi-volume-high::before{content:"\F057E"}.mdi-volume-low::before{content:"\F057F"}.mdi-volume-medium::before{content:"\F0580"}.mdi-volume-minus::before{content:"\F075E"}.mdi-volume-mute::before{content:"\F075F"}.mdi-volume-off::before{content:"\F0581"}.mdi-volume-plus::before{content:"\F075D"}.mdi-volume-source::before{content:"\F1120"}.mdi-volume-variant-off::before{content:"\F0E08"}.mdi-volume-vibrate::before{content:"\F1121"}.mdi-vote::before{content:"\F0A1F"}.mdi-vote-outline::before{content:"\F0A20"}.mdi-vpn::before{content:"\F0582"}.mdi-vuejs::before{content:"\F0844"}.mdi-vuetify::before{content:"\F0E6D"}.mdi-walk::before{content:"\F0583"}.mdi-wall::before{content:"\F07FE"}.mdi-wall-fire::before{content:"\F1A11"}.mdi-wall-sconce::before{content:"\F091C"}.mdi-wall-sconce-flat::before{content:"\F091D"}.mdi-wall-sconce-flat-outline::before{content:"\F17C9"}.mdi-wall-sconce-flat-variant::before{content:"\F041C"}.mdi-wall-sconce-flat-variant-outline::before{content:"\F17CA"}.mdi-wall-sconce-outline::before{content:"\F17CB"}.mdi-wall-sconce-round::before{content:"\F0748"}.mdi-wall-sconce-round-outline::before{content:"\F17CC"}.mdi-wall-sconce-round-variant::before{content:"\F091E"}.mdi-wall-sconce-round-variant-outline::before{content:"\F17CD"}.mdi-wallet::before{content:"\F0584"}.mdi-wallet-bifold::before{content:"\F1C58"}.mdi-wallet-bifold-outline::before{content:"\F1C59"}.mdi-wallet-giftcard::before{content:"\F0585"}.mdi-wallet-membership::before{content:"\F0586"}.mdi-wallet-outline::before{content:"\F0BDD"}.mdi-wallet-plus::before{content:"\F0F8E"}.mdi-wallet-plus-outline::before{content:"\F0F8F"}.mdi-wallet-travel::before{content:"\F0587"}.mdi-wallpaper::before{content:"\F0E09"}.mdi-wan::before{content:"\F0588"}.mdi-wardrobe::before{content:"\F0F90"}.mdi-wardrobe-outline::before{content:"\F0F91"}.mdi-warehouse::before{content:"\F0F81"}.mdi-washing-machine::before{content:"\F072A"}.mdi-washing-machine-alert::before{content:"\F11BC"}.mdi-washing-machine-off::before{content:"\F11BD"}.mdi-watch::before{content:"\F0589"}.mdi-watch-export::before{content:"\F058A"}.mdi-watch-export-variant::before{content:"\F0895"}.mdi-watch-import::before{content:"\F058B"}.mdi-watch-import-variant::before{content:"\F0896"}.mdi-watch-variant::before{content:"\F0897"}.mdi-watch-vibrate::before{content:"\F06B1"}.mdi-watch-vibrate-off::before{content:"\F0CDA"}.mdi-water::before{content:"\F058C"}.mdi-water-alert::before{content:"\F1502"}.mdi-water-alert-outline::before{content:"\F1503"}.mdi-water-boiler::before{content:"\F0F92"}.mdi-water-boiler-alert::before{content:"\F11B3"}.mdi-water-boiler-auto::before{content:"\F1B98"}.mdi-water-boiler-off::before{content:"\F11B4"}.mdi-water-check::before{content:"\F1504"}.mdi-water-check-outline::before{content:"\F1505"}.mdi-water-circle::before{content:"\F1806"}.mdi-water-minus::before{content:"\F1506"}.mdi-water-minus-outline::before{content:"\F1507"}.mdi-water-off::before{content:"\F058D"}.mdi-water-off-outline::before{content:"\F1508"}.mdi-water-opacity::before{content:"\F1855"}.mdi-water-outline::before{content:"\F0E0A"}.mdi-water-percent::before{content:"\F058E"}.mdi-water-percent-alert::before{content:"\F1509"}.mdi-water-plus::before{content:"\F150A"}.mdi-water-plus-outline::before{content:"\F150B"}.mdi-water-polo::before{content:"\F12A0"}.mdi-water-pump::before{content:"\F058F"}.mdi-water-pump-off::before{content:"\F0F93"}.mdi-water-remove::before{content:"\F150C"}.mdi-water-remove-outline::before{content:"\F150D"}.mdi-water-sync::before{content:"\F17C6"}.mdi-water-thermometer::before{content:"\F1A85"}.mdi-water-thermometer-outline::before{content:"\F1A86"}.mdi-water-well::before{content:"\F106B"}.mdi-water-well-outline::before{content:"\F106C"}.mdi-waterfall::before{content:"\F1849"}.mdi-watering-can::before{content:"\F1481"}.mdi-watering-can-outline::before{content:"\F1482"}.mdi-watermark::before{content:"\F0612"}.mdi-wave::before{content:"\F0F2E"}.mdi-wave-arrow-down::before{content:"\F1CB0"}.mdi-wave-arrow-up::before{content:"\F1CB1"}.mdi-wave-undercurrent::before{content:"\F1CC0"}.mdi-waveform::before{content:"\F147D"}.mdi-waves::before{content:"\F078D"}.mdi-waves-arrow-left::before{content:"\F1859"}.mdi-waves-arrow-right::before{content:"\F185A"}.mdi-waves-arrow-up::before{content:"\F185B"}.mdi-waze::before{content:"\F0BDE"}.mdi-weather-cloudy::before{content:"\F0590"}.mdi-weather-cloudy-alert::before{content:"\F0F2F"}.mdi-weather-cloudy-arrow-right::before{content:"\F0E6E"}.mdi-weather-cloudy-clock::before{content:"\F18F6"}.mdi-weather-dust::before{content:"\F1B5A"}.mdi-weather-fog::before{content:"\F0591"}.mdi-weather-hail::before{content:"\F0592"}.mdi-weather-hazy::before{content:"\F0F30"}.mdi-weather-hurricane::before{content:"\F0898"}.mdi-weather-hurricane-outline::before{content:"\F1C78"}.mdi-weather-lightning::before{content:"\F0593"}.mdi-weather-lightning-rainy::before{content:"\F067E"}.mdi-weather-moonset::before{content:"\F1D15"}.mdi-weather-moonset-down::before{content:"\F1D16"}.mdi-weather-moonset-up::before{content:"\F1D17"}.mdi-weather-night::before{content:"\F0594"}.mdi-weather-night-partly-cloudy::before{content:"\F0F31"}.mdi-weather-partly-cloudy::before{content:"\F0595"}.mdi-weather-partly-lightning::before{content:"\F0F32"}.mdi-weather-partly-rainy::before{content:"\F0F33"}.mdi-weather-partly-snowy::before{content:"\F0F34"}.mdi-weather-partly-snowy-rainy::before{content:"\F0F35"}.mdi-weather-pouring::before{content:"\F0596"}.mdi-weather-rainy::before{content:"\F0597"}.mdi-weather-snowy::before{content:"\F0598"}.mdi-weather-snowy-heavy::before{content:"\F0F36"}.mdi-weather-snowy-rainy::before{content:"\F067F"}.mdi-weather-sunny::before{content:"\F0599"}.mdi-weather-sunny-alert::before{content:"\F0F37"}.mdi-weather-sunny-off::before{content:"\F14E4"}.mdi-weather-sunset::before{content:"\F059A"}.mdi-weather-sunset-down::before{content:"\F059B"}.mdi-weather-sunset-up::before{content:"\F059C"}.mdi-weather-tornado::before{content:"\F0F38"}.mdi-weather-windy::before{content:"\F059D"}.mdi-weather-windy-variant::before{content:"\F059E"}.mdi-web::before{content:"\F059F"}.mdi-web-box::before{content:"\F0F94"}.mdi-web-cancel::before{content:"\F1790"}.mdi-web-check::before{content:"\F0789"}.mdi-web-clock::before{content:"\F124A"}.mdi-web-minus::before{content:"\F10A0"}.mdi-web-off::before{content:"\F0A8E"}.mdi-web-plus::before{content:"\F0033"}.mdi-web-refresh::before{content:"\F1791"}.mdi-web-remove::before{content:"\F0551"}.mdi-web-sync::before{content:"\F1792"}.mdi-webcam::before{content:"\F05A0"}.mdi-webcam-off::before{content:"\F1737"}.mdi-webhook::before{content:"\F062F"}.mdi-webpack::before{content:"\F072B"}.mdi-webrtc::before{content:"\F1248"}.mdi-wechat::before{content:"\F0611"}.mdi-weight::before{content:"\F05A1"}.mdi-weight-gram::before{content:"\F0D3F"}.mdi-weight-kilogram::before{content:"\F05A2"}.mdi-weight-lifter::before{content:"\F115D"}.mdi-weight-pound::before{content:"\F09B5"}.mdi-whatsapp::before{content:"\F05A3"}.mdi-wheel-barrow::before{content:"\F14F2"}.mdi-wheelchair::before{content:"\F1A87"}.mdi-wheelchair-accessibility::before{content:"\F05A4"}.mdi-whistle::before{content:"\F09B6"}.mdi-whistle-outline::before{content:"\F12BC"}.mdi-white-balance-auto::before{content:"\F05A5"}.mdi-white-balance-incandescent::before{content:"\F05A6"}.mdi-white-balance-iridescent::before{content:"\F05A7"}.mdi-white-balance-sunny::before{content:"\F05A8"}.mdi-widgets::before{content:"\F072C"}.mdi-widgets-outline::before{content:"\F1355"}.mdi-wifi::before{content:"\F05A9"}.mdi-wifi-alert::before{content:"\F16B5"}.mdi-wifi-arrow-down::before{content:"\F16B6"}.mdi-wifi-arrow-left::before{content:"\F16B7"}.mdi-wifi-arrow-left-right::before{content:"\F16B8"}.mdi-wifi-arrow-right::before{content:"\F16B9"}.mdi-wifi-arrow-up::before{content:"\F16BA"}.mdi-wifi-arrow-up-down::before{content:"\F16BB"}.mdi-wifi-cancel::before{content:"\F16BC"}.mdi-wifi-check::before{content:"\F16BD"}.mdi-wifi-cog::before{content:"\F16BE"}.mdi-wifi-lock::before{content:"\F16BF"}.mdi-wifi-lock-open::before{content:"\F16C0"}.mdi-wifi-marker::before{content:"\F16C1"}.mdi-wifi-minus::before{content:"\F16C2"}.mdi-wifi-off::before{content:"\F05AA"}.mdi-wifi-plus::before{content:"\F16C3"}.mdi-wifi-refresh::before{content:"\F16C4"}.mdi-wifi-remove::before{content:"\F16C5"}.mdi-wifi-settings::before{content:"\F16C6"}.mdi-wifi-star::before{content:"\F0E0B"}.mdi-wifi-strength-1::before{content:"\F091F"}.mdi-wifi-strength-1-alert::before{content:"\F0920"}.mdi-wifi-strength-1-lock::before{content:"\F0921"}.mdi-wifi-strength-1-lock-open::before{content:"\F16CB"}.mdi-wifi-strength-2::before{content:"\F0922"}.mdi-wifi-strength-2-alert::before{content:"\F0923"}.mdi-wifi-strength-2-lock::before{content:"\F0924"}.mdi-wifi-strength-2-lock-open::before{content:"\F16CC"}.mdi-wifi-strength-3::before{content:"\F0925"}.mdi-wifi-strength-3-alert::before{content:"\F0926"}.mdi-wifi-strength-3-lock::before{content:"\F0927"}.mdi-wifi-strength-3-lock-open::before{content:"\F16CD"}.mdi-wifi-strength-4::before{content:"\F0928"}.mdi-wifi-strength-4-alert::before{content:"\F0929"}.mdi-wifi-strength-4-lock::before{content:"\F092A"}.mdi-wifi-strength-4-lock-open::before{content:"\F16CE"}.mdi-wifi-strength-alert-outline::before{content:"\F092B"}.mdi-wifi-strength-lock-open-outline::before{content:"\F16CF"}.mdi-wifi-strength-lock-outline::before{content:"\F092C"}.mdi-wifi-strength-off::before{content:"\F092D"}.mdi-wifi-strength-off-outline::before{content:"\F092E"}.mdi-wifi-strength-outline::before{content:"\F092F"}.mdi-wifi-sync::before{content:"\F16C7"}.mdi-wikipedia::before{content:"\F05AC"}.mdi-wind-power::before{content:"\F1A88"}.mdi-wind-power-outline::before{content:"\F1A89"}.mdi-wind-turbine::before{content:"\F0DA5"}.mdi-wind-turbine-alert::before{content:"\F19AB"}.mdi-wind-turbine-check::before{content:"\F19AC"}.mdi-window-close::before{content:"\F05AD"}.mdi-window-closed::before{content:"\F05AE"}.mdi-window-closed-variant::before{content:"\F11DB"}.mdi-window-maximize::before{content:"\F05AF"}.mdi-window-minimize::before{content:"\F05B0"}.mdi-window-open::before{content:"\F05B1"}.mdi-window-open-variant::before{content:"\F11DC"}.mdi-window-restore::before{content:"\F05B2"}.mdi-window-shutter::before{content:"\F111C"}.mdi-window-shutter-alert::before{content:"\F111D"}.mdi-window-shutter-auto::before{content:"\F1BA3"}.mdi-window-shutter-cog::before{content:"\F1A8A"}.mdi-window-shutter-open::before{content:"\F111E"}.mdi-window-shutter-settings::before{content:"\F1A8B"}.mdi-windsock::before{content:"\F15FA"}.mdi-wiper::before{content:"\F0AE9"}.mdi-wiper-wash::before{content:"\F0DA6"}.mdi-wiper-wash-alert::before{content:"\F18DF"}.mdi-wizard-hat::before{content:"\F1477"}.mdi-wordpress::before{content:"\F05B4"}.mdi-wrap::before{content:"\F05B6"}.mdi-wrap-disabled::before{content:"\F0BDF"}.mdi-wrench::before{content:"\F05B7"}.mdi-wrench-check::before{content:"\F1B8F"}.mdi-wrench-check-outline::before{content:"\F1B90"}.mdi-wrench-clock::before{content:"\F19A3"}.mdi-wrench-clock-outline::before{content:"\F1B93"}.mdi-wrench-cog::before{content:"\F1B91"}.mdi-wrench-cog-outline::before{content:"\F1B92"}.mdi-wrench-outline::before{content:"\F0BE0"}.mdi-xamarin::before{content:"\F0845"}.mdi-xml::before{content:"\F05C0"}.mdi-xmpp::before{content:"\F07FF"}.mdi-yahoo::before{content:"\F0B4F"}.mdi-yeast::before{content:"\F05C1"}.mdi-yin-yang::before{content:"\F0680"}.mdi-yoga::before{content:"\F117C"}.mdi-youtube::before{content:"\F05C3"}.mdi-youtube-gaming::before{content:"\F0848"}.mdi-youtube-studio::before{content:"\F0847"}.mdi-youtube-subscription::before{content:"\F0D40"}.mdi-youtube-tv::before{content:"\F0448"}.mdi-yurt::before{content:"\F1516"}.mdi-z-wave::before{content:"\F0AEA"}.mdi-zend::before{content:"\F0AEB"}.mdi-zigbee::before{content:"\F0D41"}.mdi-zip-box::before{content:"\F05C4"}.mdi-zip-box-outline::before{content:"\F0FFA"}.mdi-zip-disk::before{content:"\F0A23"}.mdi-zodiac-aquarius::before{content:"\F0A7D"}.mdi-zodiac-aries::before{content:"\F0A7E"}.mdi-zodiac-cancer::before{content:"\F0A7F"}.mdi-zodiac-capricorn::before{content:"\F0A80"}.mdi-zodiac-gemini::before{content:"\F0A81"}.mdi-zodiac-leo::before{content:"\F0A82"}.mdi-zodiac-libra::before{content:"\F0A83"}.mdi-zodiac-pisces::before{content:"\F0A84"}.mdi-zodiac-sagittarius::before{content:"\F0A85"}.mdi-zodiac-scorpio::before{content:"\F0A86"}.mdi-zodiac-taurus::before{content:"\F0A87"}.mdi-zodiac-virgo::before{content:"\F0A88"}.mdi-blank::before{content:"\F68C";visibility:hidden}.mdi-18px.mdi-set,.mdi-18px.mdi:before{font-size:18px}.mdi-24px.mdi-set,.mdi-24px.mdi:before{font-size:24px}.mdi-36px.mdi-set,.mdi-36px.mdi:before{font-size:36px}.mdi-48px.mdi-set,.mdi-48px.mdi:before{font-size:48px}.mdi-dark:before{color:rgba(0,0,0,0.54)}.mdi-dark.mdi-inactive:before{color:rgba(0,0,0,0.26)}.mdi-light:before{color:#fff}.mdi-light.mdi-inactive:before{color:rgba(255,255,255,0.3)}.mdi-rotate-45:before{-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.mdi-rotate-90:before{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.mdi-rotate-135:before{-webkit-transform:rotate(135deg);-ms-transform:rotate(135deg);transform:rotate(135deg)}.mdi-rotate-180:before{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.mdi-rotate-225:before{-webkit-transform:rotate(225deg);-ms-transform:rotate(225deg);transform:rotate(225deg)}.mdi-rotate-270:before{-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.mdi-rotate-315:before{-webkit-transform:rotate(315deg);-ms-transform:rotate(315deg);transform:rotate(315deg)}.mdi-flip-h:before{-webkit-transform:scaleX(-1);transform:scaleX(-1);filter:FlipH;-ms-filter:"FlipH"}.mdi-flip-v:before{-webkit-transform:scaleY(-1);transform:scaleY(-1);filter:FlipV;-ms-filter:"FlipV"}.mdi-spin:before{-webkit-animation:mdi-spin 2s infinite linear;animation:mdi-spin 2s infinite linear}@-webkit-keyframes mdi-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes mdi-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}} - -/*# sourceMappingURL=materialdesignicons.css.map */ diff --git a/web/scripts/api.js b/web/scripts/api.js deleted file mode 100644 index e022d4e16..000000000 --- a/web/scripts/api.js +++ /dev/null @@ -1,3 +0,0 @@ -// Shim for scripts/api.ts -export const ComfyApi = window.comfyAPI.api.ComfyApi; -export const api = window.comfyAPI.api.api; diff --git a/web/scripts/app.js b/web/scripts/app.js deleted file mode 100644 index 3ae1a239d..000000000 --- a/web/scripts/app.js +++ /dev/null @@ -1,4 +0,0 @@ -// Shim for scripts/app.ts -export const ANIM_PREVIEW_WIDGET = window.comfyAPI.app.ANIM_PREVIEW_WIDGET; -export const ComfyApp = window.comfyAPI.app.ComfyApp; -export const app = window.comfyAPI.app.app; diff --git a/web/scripts/changeTracker.js b/web/scripts/changeTracker.js deleted file mode 100644 index c4c391cf2..000000000 --- a/web/scripts/changeTracker.js +++ /dev/null @@ -1,2 +0,0 @@ -// Shim for scripts/changeTracker.ts -export const ChangeTracker = window.comfyAPI.changeTracker.ChangeTracker; diff --git a/web/scripts/defaultGraph.js b/web/scripts/defaultGraph.js deleted file mode 100644 index eaefc5b0c..000000000 --- a/web/scripts/defaultGraph.js +++ /dev/null @@ -1,4 +0,0 @@ -// Shim for scripts/defaultGraph.ts -export const defaultGraph = window.comfyAPI.defaultGraph.defaultGraph; -export const defaultGraphJSON = window.comfyAPI.defaultGraph.defaultGraphJSON; -export const blankGraph = window.comfyAPI.defaultGraph.blankGraph; diff --git a/web/scripts/domWidget.js b/web/scripts/domWidget.js deleted file mode 100644 index a5fd049eb..000000000 --- a/web/scripts/domWidget.js +++ /dev/null @@ -1,2 +0,0 @@ -// Shim for scripts/domWidget.ts -export const DOMWidgetImpl = window.comfyAPI.domWidget.DOMWidgetImpl; diff --git a/web/scripts/metadata/flac.js b/web/scripts/metadata/flac.js deleted file mode 100644 index 3b247b43c..000000000 --- a/web/scripts/metadata/flac.js +++ /dev/null @@ -1,3 +0,0 @@ -// Shim for scripts/metadata/flac.ts -export const getFromFlacBuffer = window.comfyAPI.flac.getFromFlacBuffer; -export const getFromFlacFile = window.comfyAPI.flac.getFromFlacFile; diff --git a/web/scripts/metadata/png.js b/web/scripts/metadata/png.js deleted file mode 100644 index 789ef4f0f..000000000 --- a/web/scripts/metadata/png.js +++ /dev/null @@ -1,3 +0,0 @@ -// Shim for scripts/metadata/png.ts -export const getFromPngBuffer = window.comfyAPI.png.getFromPngBuffer; -export const getFromPngFile = window.comfyAPI.png.getFromPngFile; diff --git a/web/scripts/pnginfo.js b/web/scripts/pnginfo.js deleted file mode 100644 index 991d2929c..000000000 --- a/web/scripts/pnginfo.js +++ /dev/null @@ -1,6 +0,0 @@ -// Shim for scripts/pnginfo.ts -export const getPngMetadata = window.comfyAPI.pnginfo.getPngMetadata; -export const getFlacMetadata = window.comfyAPI.pnginfo.getFlacMetadata; -export const getWebpMetadata = window.comfyAPI.pnginfo.getWebpMetadata; -export const getLatentMetadata = window.comfyAPI.pnginfo.getLatentMetadata; -export const importA1111 = window.comfyAPI.pnginfo.importA1111; diff --git a/web/scripts/ui.js b/web/scripts/ui.js deleted file mode 100644 index 948a039b8..000000000 --- a/web/scripts/ui.js +++ /dev/null @@ -1,4 +0,0 @@ -// Shim for scripts/ui.ts -export const ComfyDialog = window.comfyAPI.ui.ComfyDialog; -export const $el = window.comfyAPI.ui.$el; -export const ComfyUI = window.comfyAPI.ui.ComfyUI; diff --git a/web/scripts/ui/components/asyncDialog.js b/web/scripts/ui/components/asyncDialog.js deleted file mode 100644 index 43a8e19e6..000000000 --- a/web/scripts/ui/components/asyncDialog.js +++ /dev/null @@ -1,2 +0,0 @@ -// Shim for scripts/ui/components/asyncDialog.ts -export const ComfyAsyncDialog = window.comfyAPI.asyncDialog.ComfyAsyncDialog; diff --git a/web/scripts/ui/components/button.js b/web/scripts/ui/components/button.js deleted file mode 100644 index 7fe39ee29..000000000 --- a/web/scripts/ui/components/button.js +++ /dev/null @@ -1,2 +0,0 @@ -// Shim for scripts/ui/components/button.ts -export const ComfyButton = window.comfyAPI.button.ComfyButton; diff --git a/web/scripts/ui/components/buttonGroup.js b/web/scripts/ui/components/buttonGroup.js deleted file mode 100644 index 5fa0021ab..000000000 --- a/web/scripts/ui/components/buttonGroup.js +++ /dev/null @@ -1,2 +0,0 @@ -// Shim for scripts/ui/components/buttonGroup.ts -export const ComfyButtonGroup = window.comfyAPI.buttonGroup.ComfyButtonGroup; diff --git a/web/scripts/ui/components/popup.js b/web/scripts/ui/components/popup.js deleted file mode 100644 index 93f9f093d..000000000 --- a/web/scripts/ui/components/popup.js +++ /dev/null @@ -1,2 +0,0 @@ -// Shim for scripts/ui/components/popup.ts -export const ComfyPopup = window.comfyAPI.popup.ComfyPopup; diff --git a/web/scripts/ui/components/splitButton.js b/web/scripts/ui/components/splitButton.js deleted file mode 100644 index 53a21b69b..000000000 --- a/web/scripts/ui/components/splitButton.js +++ /dev/null @@ -1,2 +0,0 @@ -// Shim for scripts/ui/components/splitButton.ts -export const ComfySplitButton = window.comfyAPI.splitButton.ComfySplitButton; diff --git a/web/scripts/ui/dialog.js b/web/scripts/ui/dialog.js deleted file mode 100644 index 7475d42fa..000000000 --- a/web/scripts/ui/dialog.js +++ /dev/null @@ -1,2 +0,0 @@ -// Shim for scripts/ui/dialog.ts -export const ComfyDialog = window.comfyAPI.dialog.ComfyDialog; diff --git a/web/scripts/ui/draggableList.js b/web/scripts/ui/draggableList.js deleted file mode 100644 index 2c9596550..000000000 --- a/web/scripts/ui/draggableList.js +++ /dev/null @@ -1,2 +0,0 @@ -// Shim for scripts/ui/draggableList.ts -export const DraggableList = window.comfyAPI.draggableList.DraggableList; diff --git a/web/scripts/ui/imagePreview.js b/web/scripts/ui/imagePreview.js deleted file mode 100644 index 4153bbf5f..000000000 --- a/web/scripts/ui/imagePreview.js +++ /dev/null @@ -1,3 +0,0 @@ -// Shim for scripts/ui/imagePreview.ts -export const calculateImageGrid = window.comfyAPI.imagePreview.calculateImageGrid; -export const createImageHost = window.comfyAPI.imagePreview.createImageHost; diff --git a/web/scripts/ui/menu/index.js b/web/scripts/ui/menu/index.js deleted file mode 100644 index 777b5b993..000000000 --- a/web/scripts/ui/menu/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// Shim for scripts/ui/menu/index.ts -export const ComfyAppMenu = window.comfyAPI.index.ComfyAppMenu; diff --git a/web/scripts/ui/settings.js b/web/scripts/ui/settings.js deleted file mode 100644 index 3fd01c755..000000000 --- a/web/scripts/ui/settings.js +++ /dev/null @@ -1,2 +0,0 @@ -// Shim for scripts/ui/settings.ts -export const ComfySettingsDialog = window.comfyAPI.settings.ComfySettingsDialog; diff --git a/web/scripts/ui/toggleSwitch.js b/web/scripts/ui/toggleSwitch.js deleted file mode 100644 index 21be93d17..000000000 --- a/web/scripts/ui/toggleSwitch.js +++ /dev/null @@ -1,2 +0,0 @@ -// Shim for scripts/ui/toggleSwitch.ts -export const toggleSwitch = window.comfyAPI.toggleSwitch.toggleSwitch; diff --git a/web/scripts/ui/utils.js b/web/scripts/ui/utils.js deleted file mode 100644 index cd4b49137..000000000 --- a/web/scripts/ui/utils.js +++ /dev/null @@ -1,3 +0,0 @@ -// Shim for scripts/ui/utils.ts -export const applyClasses = window.comfyAPI.utils.applyClasses; -export const toggleElement = window.comfyAPI.utils.toggleElement; diff --git a/web/scripts/utils.js b/web/scripts/utils.js deleted file mode 100644 index 8bff241fa..000000000 --- a/web/scripts/utils.js +++ /dev/null @@ -1,9 +0,0 @@ -// Shim for scripts/utils.ts -export const clone = window.comfyAPI.utils.clone; -export const applyTextReplacements = window.comfyAPI.utils.applyTextReplacements; -export const addStylesheet = window.comfyAPI.utils.addStylesheet; -export const downloadBlob = window.comfyAPI.utils.downloadBlob; -export const uploadFile = window.comfyAPI.utils.uploadFile; -export const prop = window.comfyAPI.utils.prop; -export const getStorageValue = window.comfyAPI.utils.getStorageValue; -export const setStorageValue = window.comfyAPI.utils.setStorageValue; diff --git a/web/scripts/widgets.js b/web/scripts/widgets.js deleted file mode 100644 index dd4dcb4e3..000000000 --- a/web/scripts/widgets.js +++ /dev/null @@ -1,6 +0,0 @@ -// Shim for scripts/widgets.ts -export const updateControlWidgetLabel = window.comfyAPI.widgets.updateControlWidgetLabel; -export const IS_CONTROL_WIDGET = window.comfyAPI.widgets.IS_CONTROL_WIDGET; -export const addValueControlWidget = window.comfyAPI.widgets.addValueControlWidget; -export const addValueControlWidgets = window.comfyAPI.widgets.addValueControlWidgets; -export const ComfyWidgets = window.comfyAPI.widgets.ComfyWidgets; diff --git a/web/templates/default.jpg b/web/templates/default.jpg deleted file mode 100644 index a2b870cef72112082e940fbf9fa00ee05ce62d37..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20506 zcmb5W1yox>_b-}K1zK9%X>kZvB)GJAf(Q5FR-m{;3#AlqfZ$S`;O#h6lT6a&*oZsx(nK^ULp4nsPJWM_O1-yYsgQWqF9z6ocq8;F2`Oy?uLc&lP zsw54TmqJGX0FQbAXnOJ<0I;=lc7)1^zthszdH4J;;1SyWhm1^|zWf*cZ+*1X`NV%^ z$Jze368~o=rm2~e30mY3eb70gGe=(&0U8rn{1-F*!^Z!`!vC2voIC1=~FZhErbr@ zKEb1Y%K1^n=o!8P>^T9=xAa3UaS3Qy>nI_u|I!h+q_Ja^s#-?*7!e(P!1rhdDRq;W zwqK}v|Qp(xg{K6 z4>N$5j~}5+@E8{$1}KbQqoHVxzugzL_HIK=l_aaPXLojPy9mZHYj_VNx`5bJ^E_|$ zP1vkm>Jv#kCv^vaF4#yG?E}%c&>lW&Wti+xwjshC#L;o#GpqMpZ`x6QU@l_keK_d~w_#SBd{IDrBtr4uvGj0_FsF;y?YVPwBjYD=o^b_BD$ zvPj9YeQ5~`GmB~e%%Ji&#E3vfOD#xiFyHJ)x!jA9k({2 zHBQVBfwBQ5;5638<=G>SS=wsdKvUG2hFai$KP2AG$U(QB5XzcwoNqc#<-1P$v*PJ6 z+$3MGZG*bj{9P(Ht7^Uq^eyIeVjO8%fnqKc1)ShA(wUPZ*x6}3Jz8xiS1UMUZO64^ z5CPuF;TELttqhqMlY|znq?iCfiIj^KsNp238F)Q>1GnfF(9*Qcr zA*J4fRd|xpNoeo|3(+KwCKOJ1pPI@imLmf*2PfAo{!Y-A?z|W!<7)fe*9nFziu;FB zWSE!Rez%NfGGq8zND6ku2>O`8f@urBDf24J3t%#1M3+zhX-2c6|0-*~{!_KE8>~Kz z3$tul&&&}oET5?}+3LJVHBZteENd8@Wh@GJJ5t;WD?jq%QTj+F0#6zy0@va3!~=?8 zb7qggpqs|0#u?eg%d%tW)Sl;?p6h9b)5wl(Dk7qQ<}MBxIifuE_<168Apem1X1Qu4l$f0Wykk_acV7>?ny(ptV2=7g>WoI&;-y5hy;kpHqRR zmr=}fgSpCOSSd<|k@alrZ!xVkRO!A)T2RvKDt)M(YDia70!48aI^lIya>54j`NNW* zRcNDPvjpVeMhLPTkDC@%_2XyaV_CrLk&WGY#C!J(GkhL#M1(Sf3ZY~ltun=LS#+&n4x!15Vu~n5NuvXv;#qPMYEq>;PlFLZrgU*i ziRF3QrgX7Qcu~B6eq}_Ox^HHZKN)5K1#uSYhMR@H08nT1tATK&f{l*MLZEXRvaw`b z+dRzW9i)mep~@C^K-SLaKmJb+MTAcWwQ_6WG(giWst7M}vzM9ZI%zZSK=rZwn~@~N z^9CaBZPkW35R`o=?js>>q&{~@{;xIJa)dJlB6-hR%1rkEtzhGXaQ1+PjJ_OT?g*ru z1*rcVC>8jq?@3jmhFa(THIXCsFKZSz{ipw+^UD;>0`zTA!#u{0NvsWM*aQZNduOb@ z=>R^C5yZ<2`K`Lln)2L~zKbaiAY z9UjjesH7hNImH?VGClGou)NI{#4G0l8NDp$_ikTw5G|6 zEUhO0mLQ|0`!v{7TuT>_<4hy*oxt*Gsei%<0*k(rj1Y^4z*0q0JX$T!@gqs~DeGAJ zK$JnTuWRQhMwPOIqf4hf`&4I`zpP6j!Rfk?qC#mb#iK7>Ke#>?mXidh z7or>dv*5@_wfU0Z2>DBRFZ-w34gpde@hM3GQY3u<(_e-}JgV>F=@O%K+IS}8T)`_W zL{@6ZY$63k4fAYy>oJ7m0E2}}f*qa+#cAIzg90fbHI1e0LUEC_WSN;|xn+e;pR)iB zf4O9TzDuC2qyVv6EX6OZu2+s_&x5;beiLZM4q7p z-Df72^YTiFOBsxo!ULES)9Wziq6c*uCTWOLOolI@n?2 zYFi4FllXet_m_i6Za1L|OmC@OrV*O=B-ku+gqyyOr^v=P!s z_T^QrUgBE^JFX>%d{5)B+M0J?YDnYRc_8sMG*Cj`X&y)dJ-+~FC4#T92?CFpb1#uu zRmsr(j)#X^PA4;RbeYRJo{9r$M?W9RlvN^&ONV%Ug&-gCGb&hzw#TDI-z~9MD8FEpT~_>?GnHVejP}>?Gq?yD;&o63{C2 zB9^Yq6iX5YOJpBQ33Xn#P>s#bcLEKAb>6^)Ng*lX9SklhTy;bWL~7rA)44s_TB8^= z!g|&EGhC?qB(Wr7f_JUWsO==P1UNI~ei+4JCye%cO0{0xV5PFN%(fvl{gz@QS7MIq z!0QbSb$d5XuXY+g;*r<*#HE^Cj0D|XF+Z(!DUu+B6FGzW5 zFV699oeG)E?v^cVS9&_)oRxSOC{9qMRn!^@YP%#&+yts~OK)GWFdlceR^@B>K69wk z*aF)-y2?o|)QCuwl8`K&(;X@DrqX0qJOHppz3n_~>1IM8S80!DU3qao@$%xo>PjJ5 zRAke?)fI5NbbkP(EVyrot$8jv)L^IT8ot{J?9$`L*M#bE}Gb$p!9MA5GzzAkl*$P5qeoNWN^kF<1I}h2Q44&>B zdrImaM-z6^A3Q#-eI1I~KXdij>65puJ=Dr53S59_d+e_TADGOy-YsyUh1+Fg8pm<* zh3E}_8gZ%rxqZf+%IrkGV-w%Hv@H?ylc1Y94W}FQy*o!!l`6-)qhl*l{+qmGLJ~ec zg9sNPwOV~bE0=MOWHwTr#+U(0C>tp2_^VYA#%ihor3(wwVw08%ablL1kL6|{8Oc?y zz-p48QiyK*J;7=vUIMj5a;GboVV;2mH#HqHk`@g_H|m* zJ5+9^kalSIr$dyLa^X0{`IvV%+Vw~#GwpTmyq7nHr%jBB3>a*$fIFQ+J8Cs4p8I>y z1KX{~2=Q)gVLn)`ct2!IF8Y{0JC#d`ZLh7Ptl884+{6MobL00kAg4J+Hm9D=u$AiK z0bsFHIakms=CPC#IWs;bWG*C4kf#=d4*}(5z%LqFdd|qGVh`U09+kBfuxU^gZi`*9 z9WjauAg_-f0JM?2+xA;!q0?H)tU}$fSwvS7y6!O)VIiq;)dnLo1f?<63LetgQaHzU zRD+kZs+#z*B*9&5W=$)0N~*oLkpwHd-VXr2$m{-iJ7eKC0V)|v*>%uBc#jP%TP|6C zl6uflmMmID1mw6zr=I(#N>TRgve8zyPJsqV3Q6vN4?9>lso^wdjbioZq6>>C7wqVb z7?4PofzHYKTL`^O(RE-MY6^inh)9!Fsp8tvLuymA1*aMuxOZ0Ew$-}A_4I4uKoh}) zDo)#@cd@kkD>|@TR$XstVI@`2n9Q~CX5ezC zsOA7@I~aFkVv)}orEaCB&b;obuy1vlb0+fGR6SSMd^AzVOitZArApz8#rVCL!Gf69 zh2L95B^Pa zVE5UsbNM_u10_Y$%$V`nP|8b`XZgq$<*jN))osk&6=pgE+3^w~OGULUy-zvQu6j}x z6>7GTl4KL)W9FbMF&c~Y1J%C##d(ezv$M)qacw>`mR!7&<^Y~ookkF49y_`xUR?fZ z3-kb(%PX>fdL7TMP(5qgr0cCjeC(Y(z0<#ObsJp*V=yWq#%9&_cEur&@?{w>#w$)~_0-lbCLXE*zPDM-g7xpTABm zUP9tedott*%+rtPBxqy{jng+hC5*x36no-%kt(>arP;91UHdny1KUr6sGmwo{5tJo zAf{oJmK@DfMYn)IuuJpg$O4%LV!0S-cCGQc(ji>*p+NRF)58Smm#KJ0#76HrCOTv= zHBm=|O#LiY<4KW!B`|RiEMsv2g6?}M^7Q3l7R746|CYsvHcb{Vc6Xd8BALf$9K*)! zCR;?5p!s{0O8k4-JY{`yUOHE4kj0YprR^INxFgc`8Yc>Afp4#uU5f~>UCUFA+51x_ zo>^ZN(rc~LE`4mk;MqbJsd?%W5N-*{Ld`)dd>L)3nY+ljnwoe0)@ArMx1)dH70hSc z;-uMaRd7;a-f7R{NwCbY3YzyVkve)O_)B1>`O%YbBj4R?O@ zdqkMLBTu}i$*&H9CnB7aBgV#aV~zX!E77>rP*D?DZ{*L8pe*xX8rcL255$RVZp(nWqAsuF_|=$Jwr6R3`&?WMl=I-obVpmD8NPn8-%m0^fHRE!1s1ZqgAcP7KWAi7w$6jt$a4wbuOgkR_$-gmnfw8 zk%6)|Dlw``b3Te|cOt?UI}?q*R(j^DD9+SKR}BU`wT3?8B}Gre)*K6^(QroJ150Ei zD{}nq<aeso+hIWK@v)&P9%kSL8cO4OwvBi;FnZBR%0D#_r?&cb=$jC*L z5C*srMXBEcPfaS)d5%cx&urUxL;OMoU%oXvm+sF_dmWII(_A@WHBimam(VKb^LVcgwodPA@LCr>a3arv|s7c$jLY+({PNt9F#SZ?0nU)$D&>&H1|tDee^JKonrrtUq{N;`FI|Bjkg*WGn1~ zl~=iFN7YtEUP-`;Bt|l*#UG6>yep898159;aun5tDW86q7>$CzmQY?bFZZO1@8JIf zLmL$42>JM6WZ-~!7BHGKB0wzQLU)?REc7Nd!`jOEzH z^axNJ74v~msshTK4l8$ueop1VNxnQYj�y1t;zq+ke&rk3G2OER&n93ywJ7t5YgCnK>=}Au(##cg{ zuLP0r%|*=x=+T`B(r)ILQr}0`XzG8}B}8gya8s-GUB%Z0Zx@h`tnsK1kfM?P-=-x^ z?w13e@zwd*3xsO%bqONc+QUe0!jty{-T90I0${=u&OUk1%G4DY*00O5Fk|-yd@1;{ z++(J)XG+gBzGYUp`qEk%6O!RR0C*Nh{nw|H_*PACg)KC)tj53R3J6JaYTBmQb??S( zgH$br5k6rCC7t)Oqr3NQxdDzp$U@-?C{9&5gI6+9^@6*+WIxE5H`fMJTZoTxH(DM5 z5smIOduo4nJEg-+6vLQRb$>^Jy@DMY*tJ4%lF77F)?CllE;(o@b7xXu<)0Qf$RV%3 z3?e%B?B!=!Ub%nT>TA$*qn+okI67LKFc-Aek7&KvucoofY(m;+@G*_FEq%&VkY;u) zTe^Gz$lvHxO_0CFk_+%mKIa${v*J`(B>P(@rR8~YleMnY;lp&Kkgop#z=i6nQi_;`}r}M=%Vxbj`FiTHHSmbh(vo z#ve1ZdSB$XNGVyXpjX#(O-o*WSi6mvO&1kaHOBeAf!6YKB4Md=n9UN9A!FQ5#XfN@ zeZ4_!Ty!*RtaHgo#VNEx@Gg4G%VdSC9WPg0>3}7D>z;)#e)sT{r7H}mYWF^BU<kIRfn9%(efJ3aklT-bt}TR zceez({apA;>W(gwn;=fve2RtinBCr{g_E^s(_=NG^F2K?4fvQEMxPC5bQ$q0Y)lI%M(n2%l*3nWTI^Jz&N!CAow%*CztUei-J@#*mGAdwNrLea-apc-;vu|m3bn^MlA+4 zQbHVsSG1%x zv@8vLk2EbcdS9F4PPmYbv7Gq4{xB8)Qk2ZUW_qNi?JpA%t08nmU)M$mwQP z<>BHz-M@D~zkCF9|4fhq6iU)l@(XI`Pa4k^7Sa6dDK*uAm*#>6LqLIj1ea7!Gp`{x zCf4TJ-{bN}{oMQ#{vZp0QI5$;_FkXuPFh+nU6Tuq9j3zcWdzT1p-N#XeHWiyfFKqH z@e~0?y^P|)FkKgXfa<)Z=Xpn~OitZU&wpwPc%gi7S z*UC{x5(?LDVWu(BuH$X@h9WO=Au-EyOPFHVpp)Xv`=r7t&$415yoR{olNHl?E^kVW zy_8P8btP(!JaR!NGtxk`?zUq@^fE^ySL0u#O&GYTlK^)5;@vtPpq4u>hq2k>?euv7GMm zm9G9SMh$!fdg~8>tnNY+q@J0Cr8Il;Y53=Q(WpC>KHFE(!i4fiifRUkgYu*0`lNWO z@z3)u0p~#REYqsczbc(36TSKqT#7kE_BS#GneF}Q!!1PjdJW4O^6#{BF(6aw5ETRj z;tZr`QWQ$`O8a{4AaK&9nKscMH2zK4m=~8mM6d_>y^mL!p>&#c~W^zl3t#)}?X0LuB2|t#JrMux(FmT7iO1AuWTWq{3vKA&lq>LLEvU$^^p#Va0#j zbm?MX>w~Y?1-$PMcIx~Y_uit6u(j+5{lU|N7axp*Z(7yGpYX>ASA@m~<48Na9$@PV z`ALyPkwg~syH~xN`pv2-P+|nxon!Vom{m5Tmu3K|q`*6-J8hT48!?=o2t8b%P7{`Y zUzsf+Vq4qVxdJrK7f@83!`(h|zw@0`bXTgZF7ioNuj|eG62kOCyY18Va_(-<@0z~Z zh^yl1pGKI9koTd{UQwE$L)}+{xj+3{iCY%0iA$%*v}D&p6qUSdsvBEiuE}O(b}Hd3 znF{-!=y?NCssrL9+nbTN*IzTG{guDdq+U*Yd)lEAc`^{$ELjtYB|n-U07=g%nLB&M zHU7>_%+*=twmX=+ld4y4Z3H-2D|GJHusGEmTa0cbbo4%UAXh?_mL}uHWbNj&&F&UY zMy82U3<-X>5QJNGaoQ<>=`#(7hI=zLs_{s4tU*lujd2z9*tK%LHA?MD4u*szZFu|0 zlDD}n_v}jQu9q3wMJK~u+_@zD2xf*#<&cIJ!>)y8nIFRf^>6Y@ycnv=uMY9Dh2h3a zq%xkqsL8q#x476qs*_r4oNSO+SL%f=RpW(YO>nAv+=^<7as(w4Gl(t@TUU`TI-7Nf zO99MKV&P)n4|S~o*Y*k(bj#^`mwfG-fjH*+5S?XTOf|>X+S0+Lm_aOTTSB=fB^+P+ z;vziw^QPxnJp2qKua5cGJj|To@I=4JwLc+HM@KuHiFw<(TQOK6>xZq2DCM4sG+m#` zxA04%_mwFEy1K_I4Y5g87hyRl!4QaJh30nUS|{#MWnK+QU3XM-ioi}oe}77pPm#m% z_WtNpJXXBHo$q#mW~0Dac;!MfBPe+KEYCpWfO&DN)9PT=*`P&mB!y2E!~*J@(TxZV z`uia(9lNX0S)t*c?25|wmcs2KEuzW&^5E!b5Gy78vm#!&TOxKtoRHYo>{5maEpMiz_WYdr4grG_d; z#gK=^u7?ek1r`0RM!K>Cg@g#=cKgPvu!`z{j>}2jRP~fRCh(aHB`0A&%qpYGFOisG z6^RD@-q+lvyM~qwi@OTxe5r4z6z*L5=bFi|8Mh)XC+(j=er`1s=fU2sz55*ENC)o$ z>V^0hh7e9W7WKJ&TEy5 ze?MgKQLX3`TO*;{IrJF++?W0?rtwGn8>y(yC>aammTB2oAwJ^!-tf?$suT&vLfpjn zgOR!{g!cmtFV*FByOMFoM_Xoh3$R|!E7tAYsNzB(^BBH@AvHg={x`@867WA3h z+Bjc4V|(gy<8Hw~5;mnPZun_nE9_K&jHO~$>MoQn()>L1=A8*Aj&z|HXQkmZo=o{H z_$~o|qHN^!vrM@c_)gr@Ct?QrH?Hp2Ss|UkplYb?Ojpk2?m4aTCk+-tx=dy!X)%un zfaH)aafp+)>XD%PU)?@CE zzyeP+>Vyv=PLPrLq$w^#&hY|QoN~aii#O_8m~6g99LZ5wwO*2WWteb!OGP?7du4+^ z9-siCJF(N;$Q=%L^zU0@T zliN|a>T@7iO~YxPB-@wl*sJAfV>j=lufXN14K$U?DQhX3J%RNue#eI|`wDyeBr6Lw z6R}gY6LPtz&~-l2Hk0N>1{;WSJYXX_$UdvC(H-Mvp2#Md_AxViN|cTwIeKD%n1&FU2Wv5Xz^p0TC3rW*5~w{tHq-)FB|u)=4@r1c;ECx9HTTB(>4w zi5XLG;pD^&oAcG$RjgaF^K}&gVXC?hu~OVg`fK-cv%D3a)V(bauU=qp^}(r5X;0x0 zWRS%sXKmG_cXCb}moZj}O`Gl%a&v1to^zO@R~qf_VB=L4cXs#O7@8Xk)c8B*9kPGT z-)mjdIlFQk*SKVx_Nrt4RL90&W7PW)>o8EOR;}uwJ>b51xxQ*YbuD-6WF(5aYSzF40_T9+nm z-avXm_L!JvRcZn_&2xY7$8cKtCTB>!hbtqoTbKQD zetRhi=x*MFDrviHH2`JO)19Taw((|{9Y<_Fb5$$IxU|5PN>t`|A*%2R-oE2UQHs8zV{@BHy8l+WgD$Xm^eN+@>c=BrU5s<5*BH^jF=Rvw&n>jJP=i ziHX+i3u4&FnqB~KRpe8vE?(kwXpiSqW%Dxcak2QcBUR~yu&anzeXvRSmXsloXV=^{ z+D5|I)r+)}o(TcXW>nmtOlg9zbCDg{L%e)R1{-epUM?SA609V0Y$;?X^}E%j`Y^i6 z8C345!NI+Ks?pK*Ni;YXD%n63fo9XO^cmI{^uUzYn=SJM`1eaO9K_68v^~p%VyZfw zud))^qIv+VTvptxkH@=^c)gn0+VR?HxQ^~(-`?nx5$7>tR-$uk@KR}x99B$jp=el|Io;S^GV zV1^7qb&H4(Z{PIQg8ThMcv^wDmW zzfhfpah~@2z8<(>IneUOR%~bAxH^7$<#^L%7I??dN|4@CIb60q zQpI>9Q6m~E=Xx-H9pTuhu{v8dc6;w;Bw;ahRZm6a{j z+pUpkRWv826vLa5Z2I>&mu8h0n@#;H z*RT6J`MOY5FR8K^b?^6f_z!*k@!y(~jgtXGvm8{ChQ?xlh!-E7i`uOkP#ShyU% zM2C_Ybd0KoXCx-O>;6^d*M`T$Y`{)Exo5l{%`k>dUwV#3yObWQ?TC6>-tC+SD{iPx zDU`9LRc8jpw77&+@up$=pv`5Y+?mDNX?au>RB@}|H`C|ON`;><^%s=S4Ob1Z(7O*= z0RURUpa0pZ_yO=jo#_R($KwxAn3Nwu5&?j(|9)82-#)xZ#Q4L^^Dg6&T5gP|n-cPIR&3MDe36Ei++6%N^fDW3+jQH7DZCyl7>Ht{Xmi~Iv(;wqzdI=b7X?l$a_Uo|pfvuWJ%+<}polLa|{ghZ@rd^9P2{b=r~hj?_q z(+cPuRYlo%bs69^-c)9TSo`NfRXe5MIM3R+miURKQq)mV)zuGd>|g1{_2dXl{UhI!Xh&y%C&*hF#^OWyJpqKZ&c#&&YK*4=req%xDg zt}ofh$5w#FtVM(>*=^HWv!Z)=@>N6|s;%!ZX6+--3e)`jA}PjuvD#J@-uIz#69n^fhdPoU1{4- zB8={~atbfKPid0PGp%(OZuG787c}fyXL`pIRlLru_77Q5m3Nhu`h3Kk1hWdYEf!v@ zsxfAis^#7hBEs`+(i#=sqJA9T9xL=|cstjuDju-8fwI$RNENN-=~4?yhBwU{?`ZRK zvQG5Pb{P4V!vafCX^Jen%~$bFh>`ISm-4X&veTQhmEbJQn zxC@0NN6yC&zNoZAbe4Ab9{?|_49QcgwdMg#KYjrorM$rS`ETp@f9a|8W4m_f^WS7a zWFMHmzWEIxzn)h1Dqt4}nXtrAZ^f|Id4kHN>8CD zwB;+azOKsC3<-^@xAHL%l_Y6YLsdWrv2!XwaQCD845L|pmE?@mRjuL`jp)$IMQpbF z7bh;E-EXz0WYuziy38f3>HW@VF4=B&C)27EHlRAq_ks|6vtRnYrFy2f(-tnvdJZ|V zdjLr5za5IhgKOsvg{68x6t(fr9k(y6niq6S5dHg2s%f(vxP)RBbYnVZQCH)h_hw`< z$<|C=9?69zjngG^7kydmaHXWf$+b7A_QHJ~`qo*)lvhIL<=d*Z2In>bno60+SJl5z zxo4(Lsc*%Gd&W~<_G)LXG#I7^l1)b3ZB3O$)R_+v8MOC9g!sl=61Pe=D^8N5WYsvyGD6a=T36wA)LIN z8OdxNM@3s{zvZK=&EYmYm;+}c53x1$`^(J&uiP4at(n-)#=>m)BOJ4}dVjv=fI-7{ zb9dx6*nmS(5OniqT+*{+kHJP`QSy#xXKIpMp?~_9-oT=Tux`J^YXUh&6Tf#k5?J1TXXPHQ`cfqP&3?$nS-Qd-RD`#n8kp| z_m1ltn?t=DO=U9 zO{gCLtdSUAy?)HshSQwQ9KNg0F|_Ve8|O65Y!85#tvsFClF>BP%jo;r(Un{Jp4u<# zqRH%&RNwjYN7|RRHKNNyT0;MFS4_3&wD+mg8gO6T}E9eW^SM{bV2=UI@4%&hASGBSV;S+myp~x-%zO4f9O^x<$u72{G zrrhpZ z?dyj}nltXI<8En*%*vXX8y`JkK?SUMIr5x14=1Zu%|a&i1>Y!g_S@C#wFr967sg>! zK{UMP(;jV~co6Eb&O)D6=vP)EE9P~8Dpoc9j`x0fApy49hlf|Uasuwxn)?T*?oAz~ z8EbUOZZ0ErFIgSeLY3z2(=hhQpUiHGnBZAc@V*v3Yl(a8^!)2q?y}O?>Av1RUIojA zHQR$Z%Vk7cjGA#8o7>Ix{bQ$9Ju`K%W#QObM{%CHVpd#vt@rJ%0%4GguDxVUxv)I( z2xL@uwAlkae>sUe)5q7EAL*Gg^kKh2E#}gDW-sH^35 zKn=f={;uL=27IvqV$&r$x$4~xvH~GHZ_~2pBUL0QiuasH$3H?cJUDi@_sFMK@{rE? z(l!BgO^UfiVN*sB*~ro4!JNZfpiMkcv9CdXE&f17M%DU=v^quYs_>@4D++d^9O)w zlV{W11s|#cEL6Z7{z7T|20eh?XVfv>C+UU+Rz$*pLLO-WzpZMow(p?-#kyYX+#ekF?=j=6G zvyu`=_cd5h?aUG^kWrK~YjN@gXUL|#t-(AGbwQw_j(%ru&WR0bw(? z4wXno~_|VOE)Vu5tG&jCa5>#)PDLQDOa@*g|>w^yU^4mispIX;Dj>YEbkb zZAxJXzts2kMnz^O`Yh&IgQVMgj&C2^-0SMY%>pm?Ylf3RWy-N59fGJz^xtr>H=-t8 z_G%Hq1q9_%+U$m6y<~^|<0TY22<@&nmCkZUcYcrGl4|tk9r1ADk5=!7CDtU**3@37 za!|nbR=Q!s=Ww$rRGR-~GU>c)%Y_$dZnFzbvv&l+Wy@{k1HjHNH|Xl^Rn-l*0&@0} zzvyn)cHKwKdvNmsfVtySG<{h00PuSyOlC3uT6JBiKW_WkAL;m53rYTG(}4-ff62{> zOy6hB+4}!!n`5W<|HIa{ti^`>MT{Nj-xbqJP8Q=oMw460$qg3l@ z?Nk3h03yH#j48COp~p40lpzc(3Q8L-QdIUmvmdyUc>5#uHM#C&FK$SyEn*Q6&TmKLrr6ju2F+h1TXe`(@q_J1tgFbsQ&|>MF(1i*r;^oW z{5!-mLo%guvKH1a7JF8JLr!_~;5t#aI>hv@-l6-#F(*O=6sw%GJ9B%B(=1xiTiocD zvV*j0%}H%0Vjl_UHQ#f3`>5)$wi?k^9=4D&S3>H+t%97*xvP5r9^oh_`=C~whcx$d1?KMrHB<)9EDUUf6et~)oa87)DFYtK`Owby1+ zpci*Y!`+r#s`?2Z;iqI+Tg>R~NOJy%4C#RftA$bE1FtxP!c^o+c7=ODa_(tL99?gU zhKQ{K7V-Oa*fto4Nbl z52^8xc}4L{ZnMaxVr8ZKN5}!ClA_yrT$)meO8Z_2x#}Z1{O_rrAX@kSIG*cYsKku} z3(P6Da)c4^(-9$o72q~d}hcwo-d;^9VHE0e*;{FW8vUBu2)ElQ~9(@2jdG{ND`~)CKmU*?z zpZ?*aEC2u`ctVg?1pvIkcqIPqDF(x@<4A=YQe^ul-cJ4&qec;>u*?U*u4ilb%w9NU z%e1%aaKC4C&YIlq(S#VGz5Ctk*wjP1qUVZP8K^{88yMMwEP*<+jFU0XNE{Dg<4n_9 z7^Q^-A*L64)ho^?qEkeW6QHo^7+}BTdb>HLg{V1`gEH*Ho&o)#wx%56H~y8hV9cZwRz= zzq>YUTn6IQs;^BfJ}KZ65G_g#-|YXa@`J4UDY9U(vyKT;@Fm8hOPFlMWFQGSJ%#Vo z;pTHL)9T>++GF`>Zf||1aK~W#{Qfy6_Hr4|-}}A&yIyPU>G{m*2Ju{%piV}W{qM_v z*Oq)XVpVf8f;GZL2C0(F?nK^Bol8MCxwTI2B4>6LiP z!?N;K3dmqya|Q>5e?0pyT{bwDG83>9IXoqSRs}yd2%Dx-Lyaw%*!p`u=ZlijR2G!v z57?H?=?7M;6R0D>qIc1|7ZQqzdNKm*Tfe za3cz|=Pi<~uPr@!7rKlb6xAJSyXU0$Q;E15b9<|btCuevg=Z=o`o@#0));ncDTJr} zUh~E6UDlNzp?H1Ab2ac16=tltRq8J`Z>fUv#yf$PD@+KcUPGCmfjQRm>+_dtx2=g1+%`V~a4mX_9PIYpT5vy{wk8(Z}~ z_Chamg_5wOXI)6YvLw!89Ddx0vK{un9nRc1Q6i2w-CH}h5M0|HQn&7NoPfH0j(ZM9 zbx1Q?&y-=vXiiZEid4<8ic&3fnXd2EIb7=9wrHMTIUQdpcI+NZ>qobaI#|2VF7(~5 zH7uEUsgy-%<#h=dM}Zy1Z}dVL+kIo?+jR84_p?j=Im8=a?ITdBHZq3z7=4g?Ux9UXF;-%3(7p$fS0`yv>#osAst(aS&)oOC^1H*dz{d;m0#DHc;64aFWjuf0lbVultlDYA2gT6IANL9Nl}-<3YN;)-G<-90HS zwc}Ep^>6(IDxC^a#HkVjA2}@Ef1xIF@4zFD1D~Qf4-%6`y zL%DMqNjv93O)n{5nZoyc*^)=+K5-s(EG-G;>=mV)u>*sXs~(nsZ1(7i06-W*F_xKJh1S%(#;;`EKLQLS%3U6-_y`R`U8(k9EjJVYd~L@|Y5 zB_|_aZNiq#wp}%@%!V{1l>--8MLFxMk9EOls4S&5Hk~A`g%#c@H>2TUW^?;;&0%!J z$)3-+KO!P$wrCDKnv+-HrE1U9BI$_Ahg4}RD%3D~m3vDwIA$RD(hWFm6YgaaFOJd} z4Z5K@YjlNPEg6c#oyCtj7GqG$qlm0D*>&@bv(%e!o!$yiq|9I(`EH(4T-0j~|hsha}vzgw=7ALw_XCtvh4%p@C_ ze7eNZ-Eltl(iQu4lT>VVvh?lsISlCDD)q?SoE-p0P zPNfWPHkChTN|XDsN!!KnD%IN9SjOGspGd2jc%7l%#ln>}PA`48v9cP9z9M*vj&ip| zmf|~++*H>SpRuW;@4bmRD55;+A&yQ=op+HhLANKVYY9SCYDO_lw(YozjTcf$Bzo7Q zF2eWqA+~mnC)`2aj3mFbeEbhRtUB*UU6YSz_BzDZr)*{_Daz|uM|xkII{|DKEcr1A z0)>hY0>A(up`Zu=1poj50E{#k0MGyfK?B|aP1lfng5XRCxKRbT3IYHM04KNw0X@Q$ zCYqPQ>vG>N?atqbw|zprtH?x?8eop zfXC9bmbB_6?A4D6Mf}+MpvLVtW%hS!c3iMKLYAvqRikY5rOiLfh_m+x%D{Aet?XXa z?3Ovw##3{{&A#Uo1oBj0ljw7{GJ@g&00qDR2STKv?-?}tp`cwBeSZ~echX)17Am@T z@27wB5P`31ZC!@c#KU`1@kGmQRJXNBKL%z2f3vCkUux5PZl$dnQC=*sQ)%L=eWQxy z9SVRildJnZsq(E-e@b$fiyN7U26Z&$F>{Op`&HV0U~*#sdsAt|l;J7KB%5qyI7+0{ zVw-K*B)6Wm==;&V8lB$J+k3Q>Ft^|SWY+G4`}#$HM}ChgZCS%;?J9Dof{VOj^mTeJ zolk3}MiePVl_)4eD#|g9l0s5cXwr>3YA}RSN-;?!xew0~Ijf}sxzJ|nTtkEtH&D75 z6^U@V3-l_BhN3srOv{=9*9(b$kH}wh@+bgrwa7K*yvP^lc$Y!%kC=PWR9%2*9%KME zxVr{qguTKL1osBKf|lakZ;-0t3x1(=7q<6dGsS&n=0z>QPVygl2YDWE+?Wb2x(T0> zmyl+Eb^F=@z&A7dzwry1@?K*Qpe5f=h+Xlpz@m-2`9h{K3IlU4VmZf{!0;k?CG|aA7||x9ZV+BrAEC9 ziqeHdnrDV~^RO5#k16AJHa?wN4c+0YPxp}j04uk&x^M9|_Q!1TvrQ_okA%Oc;&7W| zY+^AodFnYQ*Yq>jJkS3CXWHkT&=NNpNx5BkB3e+uzwN5x6aN4OIKRe6B~}9dU6KCR z8vg)-3-cHM00&$#vhi?4)%9nEjU_#bx6sDF{Mi13`^|;^?T!Bc-jDqwPgYPGnf4$1 zzB~T_b|3VDp2PnDcgKJ3$NrJ+{*P8z8r|-~U)?c}{{TKe^oi>m4Q{|S!1Rd4?Q zC;1O=^m_jQwm=%M6|r9JnOT48FZmJ65wkw725ZKv8hZZ#ws01zSHnN-@TxvCY_8gF z=_FlDT-lYqUlSUONhhP^dbejgM=3%Pm1`?+zw|tYi?or_Y?dABUPHl#sA%1`wiSHKuM9a_ww^kPF{KD^$Y7}K% ze8VE+7W{4+g}MY8Qr!f-!uygF+#cYizfij79^eQrxdp@*-T{7}5WD06PgmT)oCdGZ$<9C-dT4#LhbD`Ixxc zo9!3mb)OR%dqWuA{{TPga@$6_ZM!@4)9^;_I#aVsEqR>YI-KO%vR*{%rJT9!ZD*~O zjB3|yo7kKbo4!(wOa#w0>C@J-ao>mwuNDx}{7U2OOF zNh7nR_fa){88D*nqGqNEIJLXp%QW_MzUnVw_IpieCrx@Zc69!Va$XiXy`NDewUh8i zJA%VFHKD(QO<3*EOx_(f60&J~E%>uqja@Bdj0_vmU0m72%E?(BH(cz-j3pMHV&CoM+0N0Ri;Db=q173lsTfja4000kox^lQ%s|$F51^S6)$XhN& z34WocCMW=x>G2JDd_@oh)JJ}Twl%ODB>A$nRnVSIkW{}iiZ%B$D-_nIwP>S0ycZ%` z+>8uWIL`jhz|5!im!Q)fZ_LbUc|KIzfUisVBo3z5#pNatS8 zOX{JoXRo-9f#KI7j}OpduzzQ-x`h3o{seD#3z81wqVgsq2ljvXP=3!}bsOEloxt@N zexcC`>I?3pch$u8VTi-^5Agg0)PKY9H$7jVs)R->3)FwZ@E6oC^-a#=B039#C5XlS zp1$aMhxkpd;5&|k3}bqN)SiWivuq_oh=(L*pbv0ZTL7Nm_X+_(f{Ahj_kgzxfR+mjbQdT`k;9Nariv*W(J7rc>n z!)3v1iKqUfOxH@7Y=7lPCE-Yt!zziJ5aeqNk=T8u~DA+{(2* zGD6b+Kh_D4mv~bIPSow{6R|>w`K4T24z-PU) zgj?%J%#K@s1isonV+^f8F{Ro}41U@^WHaq%0zYpLF^8>hfy~dgn?65p5A_x2+s&IF z?=;uEVe4IJmpIA#LfLWt_YX3)Pf0s2Ki;F}HZQGrZHU?DbM&LLWA^te)by)>kI|cB zVe4LzC)BS~#Pdp?mN48SCRC~EUX$HUUSneV*QHf!nNFiz(dN~?D5-9xB9&iBH6?pd zmzdsLdUV`*uQC}*AAUY(me0}^d2Xcq$S2#(Tir|IP2|_A%B3~+bDJf3~G z$4hh)_mIoB8$w(o=Em}SJ!V*(I^R(Yc)T+EM0p&$Q?w<Ic+Q)chpCaOKs!jzPtA#C$#ah--w@>_MhPPdjs0|CH2>s$!*LM`qA?|edDoD zej=y(hCEGqZ>=}{MECyyN3++Z+8i4C(DNggX)tT+!_4wGR-@lJd5z5{#rcn8+3NG{ zP7Xh54>B3{y9mD89%q+a3GGj3qtxxD7B~IsA)jrq>vcoVfO}Kf+|RcZ_)YmT33l1N z(w~vW0X?dFI@xy8qui!LF4#;5%1k!+j5C8xG00aO46bc{# z=u`Bkj(edZy!|Ha8E%XJ08zt$_O8Cp#(t6Zq_-vhq6zl@0BcW-SG}CAz->LNq?c|s zyuQ^U8TP|$Py5BZ3=kVnYS))(_O$onv;kCyvES z>0&BB;wyknO6%2o>P`Ou5Z5_9@^9WS0jFFpGy$hvE;KF>pu_-z;s6BD00lGv05kvr z0000000001KmY?uAPNEi00004000yK06+o(KmY&$01yBG000000000000000000UH F|JfW+z+C_U diff --git a/web/templates/default.json b/web/templates/default.json deleted file mode 100644 index 5a97075d8..000000000 --- a/web/templates/default.json +++ /dev/null @@ -1,356 +0,0 @@ -{ - "last_node_id": 9, - "last_link_id": 9, - "nodes": [ - { - "id": 7, - "type": "CLIPTextEncode", - "pos": [ - 413, - 389 - ], - "size": [ - 425.27801513671875, - 180.6060791015625 - ], - "flags": {}, - "order": 3, - "mode": 0, - "inputs": [ - { - "name": "clip", - "type": "CLIP", - "link": 5 - } - ], - "outputs": [ - { - "name": "CONDITIONING", - "type": "CONDITIONING", - "links": [ - 6 - ], - "slot_index": 0 - } - ], - "properties": {}, - "widgets_values": [ - "text, watermark" - ] - }, - { - "id": 6, - "type": "CLIPTextEncode", - "pos": [ - 415, - 186 - ], - "size": [ - 422.84503173828125, - 164.31304931640625 - ], - "flags": {}, - "order": 2, - "mode": 0, - "inputs": [ - { - "name": "clip", - "type": "CLIP", - "link": 3 - } - ], - "outputs": [ - { - "name": "CONDITIONING", - "type": "CONDITIONING", - "links": [ - 4 - ], - "slot_index": 0 - } - ], - "properties": {}, - "widgets_values": [ - "beautiful scenery nature glass bottle landscape, , purple galaxy bottle," - ] - }, - { - "id": 5, - "type": "EmptyLatentImage", - "pos": [ - 473, - 609 - ], - "size": [ - 315, - 106 - ], - "flags": {}, - "order": 1, - "mode": 0, - "outputs": [ - { - "name": "LATENT", - "type": "LATENT", - "links": [ - 2 - ], - "slot_index": 0 - } - ], - "properties": {}, - "widgets_values": [ - 512, - 512, - 1 - ] - }, - { - "id": 3, - "type": "KSampler", - "pos": [ - 863, - 186 - ], - "size": [ - 315, - 262 - ], - "flags": {}, - "order": 4, - "mode": 0, - "inputs": [ - { - "name": "model", - "type": "MODEL", - "link": 1 - }, - { - "name": "positive", - "type": "CONDITIONING", - "link": 4 - }, - { - "name": "negative", - "type": "CONDITIONING", - "link": 6 - }, - { - "name": "latent_image", - "type": "LATENT", - "link": 2 - } - ], - "outputs": [ - { - "name": "LATENT", - "type": "LATENT", - "links": [ - 7 - ], - "slot_index": 0 - } - ], - "properties": {}, - "widgets_values": [ - 156680208700286, - true, - 20, - 8, - "euler", - "normal", - 1 - ] - }, - { - "id": 8, - "type": "VAEDecode", - "pos": [ - 1209, - 188 - ], - "size": [ - 210, - 46 - ], - "flags": {}, - "order": 5, - "mode": 0, - "inputs": [ - { - "name": "samples", - "type": "LATENT", - "link": 7 - }, - { - "name": "vae", - "type": "VAE", - "link": 8 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 9 - ], - "slot_index": 0 - } - ], - "properties": {} - }, - { - "id": 9, - "type": "SaveImage", - "pos": [ - 1451, - 189 - ], - "size": [ - 210, - 26 - ], - "flags": {}, - "order": 6, - "mode": 0, - "inputs": [ - { - "name": "images", - "type": "IMAGE", - "link": 9 - } - ], - "properties": {} - }, - { - "id": 4, - "type": "CheckpointLoaderSimple", - "pos": [ - 26, - 474 - ], - "size": [ - 315, - 98 - ], - "flags": {}, - "order": 0, - "mode": 0, - "outputs": [ - { - "name": "MODEL", - "type": "MODEL", - "links": [ - 1 - ], - "slot_index": 0 - }, - { - "name": "CLIP", - "type": "CLIP", - "links": [ - 3, - 5 - ], - "slot_index": 1 - }, - { - "name": "VAE", - "type": "VAE", - "links": [ - 8 - ], - "slot_index": 2 - } - ], - "properties": {}, - "widgets_values": [ - "v1-5-pruned-emaonly-fp16.safetensors" - ] - } - ], - "links": [ - [ - 1, - 4, - 0, - 3, - 0, - "MODEL" - ], - [ - 2, - 5, - 0, - 3, - 3, - "LATENT" - ], - [ - 3, - 4, - 1, - 6, - 0, - "CLIP" - ], - [ - 4, - 6, - 0, - 3, - 1, - "CONDITIONING" - ], - [ - 5, - 4, - 1, - 7, - 0, - "CLIP" - ], - [ - 6, - 7, - 0, - 3, - 2, - "CONDITIONING" - ], - [ - 7, - 3, - 0, - 8, - 0, - "LATENT" - ], - [ - 8, - 4, - 2, - 8, - 1, - "VAE" - ], - [ - 9, - 8, - 0, - 9, - 0, - "IMAGE" - ] - ], - "groups": [], - "config": {}, - "extra": {}, - "version": 0.4, - "models": [{ - "name": "v1-5-pruned-emaonly-fp16.safetensors", - "url": "https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive/resolve/main/v1-5-pruned-emaonly-fp16.safetensors?download=true", - "directory": "checkpoints" - }] -} diff --git a/web/templates/flux_schnell.jpg b/web/templates/flux_schnell.jpg deleted file mode 100644 index a0663c04120b6efc2f1d1e910da423eecf622f70..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 23789 zcmb5Vby!@n(hOL2EA#riG%z4yNF zANRY@bF;f=lgyk5?1iX3k1|SXn0RC>hS(N$o$>6h!lBA5h z1QY-Oycq&O6Wm7tz}C*iNkvMGTnnU4j<5lE1O5CKlu-@d87a21zz*+E)FhGoX@X$CpDE%(7XvW z|H1r!j=?)J|O$`i}_x5d)k7DgY^f*en0gGBnxe z0RTL=003>AL{DVO+|37^rhk}Tq{j!IC%mFq4Qvf+Y24Dv;1~5Z&Y=DmdRsh%E z6~HF|G6Di3!dqlSL_`#1WE3<43^Y_!G!k4qOadx08fr>1N(x#aHw!I22R#MlM^RP| zUVb4VAsS|JnNI@J+=4>JpMJH3H{g@b>KfCz;uVgTO2!ob46K|z8?fO`W63mqIN6chd} z7B&T|sInmf4keq4V?Y8pcM2B|pGr(st+rd-C^2u7`jfF!AmoCEokRVSmQ%tcD1Qsu z9wAiYU(^4l1s&~IYETdjCbSv`nqc2Rd-xCG4GbnM76mJ|C>*6S86&V;M*b<2%6i9hk*kW+OQzl4A z#U|pPvl2{Tupx{A)P*J$0hGgeBf)CYst^rP9FXh~1aXOmpT-0e!dPemg0l$$(wK1B0MoQ&s6DN}L1}3<#nMgfWmF7f3l04h2wumY^&U(-0RgDJ?X?pa&@q zLz_rWI!TU~paD`2v7clmRYWn{4K3lRK-@%8C`U9T68=L82Ev$?2!Vrny&^90)0v!< zXh6SB*)v>{15&(zC-CT(I39D36);> zfARc}9V(NPf6|3A>!v0-^ajcnJXE^FOK^-)^hzAngnl_5A8D(ZhMQ^480 zs>rJl6c8y)vDKBt7Sz?6xp*@4y3&bpqmUFQy3jB4oVJ10jo zxzc^XQv^oO83p^wo14Nvp!r{yjSe2`DTJL+{t{Gel!uLp!-fuC#TZ{qJqN35y+_Qt zSGK9~x$Q&LNfbRs6jRN=8SpwmD!_>G;H>`)&`AO!#eXIfYmg>M^dy&lMR9NC(z*&Nbm zD&e1J)8KM`oEb3SsEFy%wWahBY+7&p#Pz$=Gze`rdZ+#39z#re) zP5U!^impAS{`*refnqoV*&e{JT=IdyDzElU6_s<~ zuJxubr+EDEHpk^r)BV$;(}T|Qy>W3tNd$$yOLPerH_ zaj%-a_26f__Kik4XAMzxL16Dz!WdPq_FD9jfs%Nuq2)(i2aRQ)u=~oMdZ59tSB8OxAm*s~}aOj+d&R_Ci-2a%y z5U4SwgwAYA9H_Cin}Lqf{S1@P=_hFwJY)^^7W>^5c7g;7mHqQik%j$MCQax_spJ^y z)JX`q%T7G{w7Oq_J$*5EnqgI-UF#wq839Hbb*htex7|3ZDh<|#4oifg@@0Ev&-F59 z{R-ny>$^z9-&(o-+C6PjiHsl$*^$N;K{-V)=n_D_OT7#=1k~h_P<;&-sQ|l)#=JS15a`Kq;9lI{;(x+gBw)p|Q@^~PE&3Zy$Z?QR`$ zbIi({(B>oe6_y(lm0l?RLJa5&nzO9qN>qj$e{}Tj+64VEoQV54eJF%PE#TA;hg&pY zMZ{6tkUE3oCGoTq=ZG>s(HrMEOk3WBAmn7)o4k5yEJwdyyILK8uErlp$W$DpHSdeU zoDym^vUpHRxvWI@W;nl8AW&_$GA8>=8N9Ila}@R zOp~#)=wtg^@L1I#3FD8Yv7)GMvLgoE7PAyDPxBt&iWVilj|phQnR4Zuz^K?ASJz-Ea-#-0<%8>M&KY z^n)uFbT!wy1E$5XIrwEJ8t+Wbtwna2HO`q0b}Xvr=5LdCM@d_(1POM3Atl=4$8OI! z4Pmo>lkK+-BG@M_bWRV#0dqxqtbQuE4Bx@i;5)EBG)*-b2_GF?Lc<5eaBVb~dE|E2 z%&W=%u%agCXiIpBBF!Z2<2>csX?&92Ua|{s^*Y4~)t2O4^i<~O(pDIq zK;?zord5e0D+9u)NKT3mO%QVvqrj=iim#f&!cvtTIf1UEvO^TgFj$a(CKNht#3?Do zG@xr-kP}W|36D;s*Ft~u!rF9?y4`w$zZG*`ITCI&!#CVrwOvz}NNE`@F>Os5l`TVg z>^X7DWBCGIuM%GV0`&+rK@|Y(x=h_)CX^JK5zirOAbV(*W8W4?2_)D(H)C&}yAnaX?8ZMkdcY@oxA zLj2y2!g34gDh};Oi&t1GPhxwblg5bFx*aTf=@&T#UfRj_zkq@&UMKgeW=EH7pXCLa z{?EJVG)yAf@3M!r&O${8xY5OEBp^g@rd+k;Z3dlkdkFR-m+AEw-|;s_3y7R{9keJg zlbJjuZI$@2ah^D*?PZ2>EQYM0DR_H&@>J%OGswO#p=Om+0FrWBGIHyY;)nDHq+OO> z?1e9qz+s{AftY575i;fmztuKxzr(%4;IRVa=%qAzjXY`Oo%_^{JTFj#HLWLNznSCH z>a&EaH(+hy7My$Uc+##80~>OSaFUcognC8jO7|MHnBnM&85nF1D>s@F{ma(c`rOm1 z@K)UQMK^Sr{ZO)mr+_B{Rd?`**R@tU#3U(P1``LwPXPlF zrw7rvk%v%M)W2?vL6m{=<)<3%6IQcfIvF(rxBAwDq<_YZEruJMH5(RCG;tdDAemfe zz*rx9DKh3~i0&=OD|hCDttNfHo;{<9m6FOJmY%er^|n%iqmy>ho7Q-IoiyIvA$N(H z>FngHXrGcoQ+~=37tl~i39h46fR(()E>1E`6@|t|tI@uC-jTNIWUJKs*u0`8WDas} zubC{9f#ZtM3X8xYt7x_OtoZO$G{8ua}}{_SwvbWSJy~<#wsreyVW}Q zuD!8N6!yu&*gfle1yap2A$o`mdhS<7)l7%t%Y>8bn#w5CSP$b2y0Af@D{F56+0}7@ z!-&@WQ&eb}K?mV6kdndT3tlMgN55m6YNyCUs^oe!`nLX?U_d&)vs57#tJT2fo~~NK z%pSJyg8!ay*|~X`B_V9Mu7+`;52x~MfSpuLNOT9^=4o6sc=@~im;3JP#qtfeX*}T) z32S&;9Cg;O+oV_gycJfwZo+EUZX_q}G~etpN9_3IOW)+MO>v;(KE!>;>TntjKl2X~ z%(w)lX_KyDtU3~poM}{E?IR(}d?*M$2}T~K4Mw8G0lz9;MX)#{bcYItOF&A3I#XaU zV?=?PO;K|4Qc=E&SF)z!F^fhj5@Q8+b~)bRngVG$zlvuOHH~p#(R2nkNZzTX(5SvV zW0x7oX40TLS*t^?IY_R+?qpCXv69q)!k~MqSR<)2i|IOIoc=Qt)id%NlI~jn&RLhy zq%VyIjIHb-+Kg#d6WvP(!x5Uk^G&+WJK zdWX~@8O~$4?;#UooUHLl6&4G#;FP05OVF$zgRpdS!(YIu=#en4+n~&|SFeF9e>L@k zME_H`pww3CG%f2+?~yRhvP;fFqcR6#wI7Y?s;fTcO+<|LLbw-tzxeM@0~5<}vwpys z?IxyH1)1VjH8$Q{9~FD!W$jHr@+xZgkE6;wZ4#fx&o||s@pGQZxBYbe@-LNn{{o1G z?SxI9)V_HtsaI~@AeiX3ks$;B?6~(EjV3v8o!P?r7W-(TIiGR)x5q6Cd|sPG%@($b7KUWwFq4||Z?)uSv(`PI`1MHfZ-+hJd80V~JZik& zsSwyB3yzVL-mbe5=Ap?$7(f9blmuX^t(2u{l@ zTZUb~(n6aiG-Vkm&oABzTHnfw<>+Ur*CW^oguD~!X{YYc>5JVob-4^){fHG>1-_Szb|t{ z1{Z5Qp!EKa?{NJw>B=t$-wo+`(cb|c5o0`q+q<{Hv0wTpPG`Jk%(d=bo`Xi^x=NqA zoGxKww+8PHI|{L5wu)c>xm^3t-gcsYcwNyV?J+m*SkR-$`g1*;tqa$NGDDV4D|#Hi zen|>1H-4Y7cZQBU`pk^=;DwBbhp!Jbq*y61+lS9FEvEjQ^KZ1} zgWg6UE#c|zdRI{QVBoIsNz(^@$A;IdGn(9`pe#Go({SmsP_G>~jYQ@IVJn1}to2*h z!8?~+XbQ&G?Yn*TLbF(IE1Ng_!?BUHAf%IGKUFD}p(cOSnktaBu*wHd!bF@zxmVP( zd`Mn%fN3~|DAMF25hhOhL5(!Hf{zwVE`||6fha;j%@7L4_>3=mAojggQ-NAU*###7 z6_`tniYS(=hbZ=jdRl}65%LBRf`KR|4M%|pXlyY&i(^y9!(#bB8rUFe3n_Qq^TK># zIZ%1f_3dCs_KYJ+Vckl_onCS#&QpM2JhG^4Y&!bT?h@ij}aRcz@1g*%0yVDPrQo1Ca7nj#`rmcVK5QiU7S5Z^` zdB9-k!&b92=4~T(dxFqfMHW8Gm5Eu*!QxqGvQV0O%3o1(maFrXAKeDKUM>P}9TxL_ z8ej9xiRg|5^$266v_t|lg1Cg7OP)6bfeVbH9Qh8y;ZWy^F>y(XZ?!DsvVPB<9Q*e6 zSa0Z~Mdl~9hrscJ{b7XWw z7(b@1k2(ftcLCmk+qI!#=S#zk`T7A*D0*}oa!;ep$A%&h>6&3S*xekp}1jfs{Ri4m>W}=6VI*LA<53Pz+V8nrutgQ-KbjhRaw9-=Pz9D z9gh*2!g1wkQ-M^?On8~X(ojr=VvXs?b3Z(iNZ#rXbEdqdTcstD#{6=jKOZY>$C!_s zN0~$;gexjYbDuTp+NjQBK1)rf<>$+FW{>Fr8l+6xH;JCYkhw3=acGNcv3lEtEiKc&Tdo2Q_8o=G`;YycwjtE8bF=7+Wj-acKEhE*O} zr~k4>y1kQhr&WOQMNBFW^(uzZ$C6EeD zU?RcNxL^ixXareB1tJ^6Yo)CrY7`r?m3&*FT!^P>At$zAa#S^Zs5+gMXjv#xMh(1K zW5u0my8Ng>Xuy951HrK}*x<)X8 z{p@>RQi;b@n?UDQngqG_Oe+yL$zxcRrD*4+pPs&4`wPy|r~^xR&pg|{>3Zm9mK04n z0mSXuI@K%3p#3wf3(4F~@9qBbtYmas!P0W3)00bNr7;S-KzA1T-eL3RvgwvCX(daXtPbQrE z#=QWHph4M{&30m$Q>C#F6(>&LNm0{PThq0gsn3*7s-tvaq@YG@HxaL zd+9ZwB@o*g9f_n?FS(lmAm^;XbRSg=f9dyvb}v!JYxYDXg@JL%#R*f8?|d@#nO3k4 zq;^6DB+?_i+C^!-r1+A1+I<7uakr>1w*%}g?22aIB>V$dMD=K-yxf<<)e^a9mIlg7 z-%7v7oMEbQo+NxdbIp+c9dhXTNSFybl8lS}!uy%}TvyTm%v(lOl$JH9rf;Ze0{#rvr|2cu^A?XnT_RjU2X4aVvRy#vakz`~ zhM9|qOQ(971FsV-7xW?)G}4y(Mazs+HT$Of2I%TL9n28=x zBZA~$Y;T<{pgCTvHvWd6Fo(2?k67YaZtXFf_k8Hyd&fI_9|?(>o9>vnk}$bNm1T?5 zNnOKma#SGL+B>49rb$1*GuAD?yXM`c$dCmkj(kX5Hl`CP$~W|)U*M^|3fa1SeFj2J zcJ1XB5g0MRn|_PJ3{XxPi1@cdTg-@boKwFOolv&lyI$kZp_gQy1l$(Hu7jl;4DzO>ig-T(!jCN0JqOzr)TPzZllh-u5)%#j;~Yo%*r?J1HH3+0Z%2m z(HYn17tV=eb^Beb{l{9NKN-oL3gmwQ&Z)|)0U1seXH79`+fS9cVXlKm<74&-^4;fj zw<_LJNWRDZV4`YXL)*Uq(wFbDlg@f9&hyq21YepEn*Rc*l1Y2Bv+`+-!k&Qs9}NVs zIs?ukp9zUDPpuKIL#{7X=qV7@VGf)=bXo+}#tH3CFej2n?P+Akx0m{I#x?n;!e0`` z{psSI1vwL%_}e7ik&U|?yZ)e714~HYDGrH5YCtcqE^&Ag)FpmP7(>|))=Dt?v*KIH zDu*Mdp&TPJP;D&l`(e6jDc`KxWV#V@bSD{Ft3O}mX|fu5Cn|c$nE63~abzx<6+cwq z_~-RWMlE63{opEovE<6gFTN|EecE=>{fa8!La%#M*p=X*&@UXy!`L^>*7*s69mnL` znA?OJnLX|GjcN_Sl6H!<4!C zLv+A_EPu@urqT)+y<&^I=}FsqOCC-EhxReq8lq zXTvkW!FrOvJ$jbWSI%Ld^^9+fj07z67#8s{wDG+U~hlie$M52 zvDmogn-Ets-*wAMoaA4C+9Rndtm~}gdKK(?XXKdOlBur3x&m?632?uisZCxZA?#GK z`>ES|-mx^IMHqL6N`_+sX0QaJeEo~_2JKUvIrwAaZE)NCmcRP-?eFSbC-1E|x=n>; zuC3(Y^CRXY4@E=28P+ZPtFm3;pBfFOM)u2F$xiwY#h$m#73#{fzXb>V#K%7pk`-l_ zADJGo{CGg^IG*9p-yL>-i-dAWwVfe|)SSA^RfTP zQIbb=LMJ^5afLJKjL`xLhK3?x$h^_q)YO#7p=tagfX6L6z!zI5;LBouV{)1+)2H^P z0VJX953%paSf*Pp2jxT&NwL3LBNSXKL_*e4@pMOT?mayC@e---VYb_oH(N#t?RYbQ zKq~I=E^+g6on|uE1)c1+Lbgt%j}@qA7(%BRMe{7Aa!`HFFz~A3CygpUvnF)&$mP0p z&DjCAo!N$MvYXt~lo#fwXiEPDAZsn_*-E9O)C8s?6eh_jDM`Ew3d%Qr?`z2Pp7gM4 zCgEr>X%Br5rMtq5rI^kYUQLoANQuMT(-qwnziiph@>6hhyvS>$_d!iuts@)Idr5-B-Q#o1N5EI2c|%De8bjWSX)y2AcAnk;iaL(HMD7Ia!$xTp-I10#0tKlnw8md%eFlOc@kCVV6xTXRur6sY5 znWb0Ftofz1-5L;wi)QlgZ6v(;29%JZjx#J(-F!;|)%Wk@42@LCoN& z%{F|&< z%bF#d>7UR?Z$xGVXVj#BRnY8kj{)>8gN+bS`Yn%xI8XF^1vOn9BP)jGA2Os(!Cd?@ z00*es>%8z%QvJi>AtGzNZd~!Q>xb`PN%_@|x|SpzVrin)5?O&X57F5T6N!TOtaF%> z{K5EX)jWmW#gh#9q%oMk7rtmEqN};8PTOJB+l$XCk}p7AhWHc@-S(tfOGV6*oH0QK z8lj$17NO2y3}QFRGXj~G(L{B7{E{@+%A+Qj*9eZn^I~yh4z8~VdLLn$!pvu7GRXAV zK@<8U2FE2?=Cf0MgGhblK&A0d7Zo-B0>!7)*o7YttBy&RI=Ueh_?u3eHAebxaW&2_ zhV(VVnk>H^4$5SnL2fVoGcKP?uqsf{SPICf<;%eiVGgpM+4?hKh=a**2|5pW^ zFX=X!ryLaJrhdjO+x*5m+S8@0Pxyb-_a$Ftcot8cvHni#T)L+^xF&cUF|c{UFU&<1 zm^rw{e_V!^upR^kgzi#bDU{NV3rrlG6F}>2f5G{ZZ2blJ%AK}tbg&|y%#6LnUixDTn5;ysI;43`y@_%Yt&gMsBM5u;!Ja;N+o9ZX1d%6nZ>TGjvXXl`61pPyOk&!OBU zFIx$$K<{{xcr6=1QMTy+(V&1fwQz8Z`yYT%tfN7n$}0^S8NI?d?gzepf6UjWQ>T8? z-)BIn!5@B5D9X0IagOw(O2=Skro@g%57ptPYy z?#h3?^^YjJg-V2in&a9(ze4F!t+UAo^TstIZn@Og?w&wkc(#U0%`7I>>RTqRRCD8d@=fe@5IbuLEUoR`)D*-k z;Lw6Gp#ixvX$2aQ*B(%ZTZrKzA&PyKh=&I9kTH;GlapaEg2iMwl4UJlV|y~+rNyAN z;9Q(YOB``xTt(z9927MxjW`YuUbmW;ji;X3-#o@-5(f1aj4T%9*QIXo zlcoqljI|LmgmryEGB@y<0*sw*>suY$NZc_29RTekFKuG6_@#s}o)uLQgqkX^YWxb9 zR+`njto^c)ULcu3zGmzMQq_JN_%POAk$3wyX<|}e5Zsr-O@=_ zy~7+Z^?(aSU2enUvMdRGr^q$(OlO9UHr<#t!2qvl65hy0iR$`ovtwX2(V%fD+i_+- zch=C**@a)a&5M3X+Cd^|dDSHb42_s7K+pFioqU~LDs)qlt!JfVtaGw+oTH}T#?>$M zrs-*t78Tn$!csuQ!Uz!w45lRCbc=64#_KWnHTmhB4$rUalF+4@#_}nR-{_f?GbR-? zV!CNF%L;F8f?3gL?%ybh4qeQ%Qai!KZ$iqPMva)#4gtJ5# zMTb2r1D?jT92`3yetkf>hxRuFw3I+z!_xN#)!`dbpF0ffN%yh@;dSD^D#5n}>Vy>J z2gGo{-L>7odt*!|&$Y<9lKj2G4A)zB=M*n61VdFa28jYzOuF?Aaz-ha8e|AHia_BR zC2BZ547cAgtQ(|e8c~aHIXTt2{ryx^rpYC^Dg*^{*BK=U7&LRGj=B+GVG4hxiLEq2F=#i^#cdQ=3O=Veb zL53{MftYLnWrj5L7a=;fKd8f^Q!)M&**$Xl7jSUpHAgmV>Mr71Lof&$+)*dA(4ie% zQQ7s|GEko|%OJFJEFw50qREHVjjfaFa9M&yvmuE0&ZbV4SlwWpkBuSWu9W0Bf5;_y zFHAGLBV8>p?a2tc0QG@e3~aV<&ZOX|Lq_-w$dgHAaEa{IvzXojqVBo^s+l zNX+QkREyVsS}t_}Dca7ybJtF012=|?iI;7Gr2-?Iv{Sq}^O@yTf?{UvRBc@iT(HXL zzaKJ<>lLe6mwC@eg1)vG+reCo^+!t&|C0Zcy|I90GYO#a^4YBGxzFm}>UZRs`M9qd zDulScfb~gwb97pxW~~#OmsUs@=(wyUv#j>UPAYP=pqe09Eca_D_>=t@qd;%!K|vn4 zEQR%50;&cvqUP>m#>X-TFYI&R9QWO&p0#6JUi#*PeTzN)x-^QO44haW>ajJ-+ud*F zTC$_jXPWh8#>ku9&h8N*G#F{h1yFM*Czp1O;`A)Q*7|L{!7UTPvhkd4jq#l(eC_~< z2x!cL3Dz;k?3ygoB-30&P3CYG`MA$9)HCVU)X?9`^cFOj{#8@v^Mf;2^9_KcXr=pb zv31Oy{!2Xplb$@snN7lg98$u-U@B++um?OIht;?>@g`pU8Z%YQgJ-hw&y{7;15Awt zQQ42b>&L0INa{PPY^U5PEa;ugP-WC{R2 z=C(bu&YFrQy}tN-7JvQ_g3TwseJng>(CC+Crup7!4)7O%h})oj(#f&=@HVcu?m5>+ z&H8Y6>|y=DJm+rv%<-N@vd@B|?|`P@n;w{J;lPtj>^hou#$5!?{%x6*e{;2RYeU-g zJFG^Z@^ms8O-Jmky41oJ{ud{P)v2iQw9D|C5tLyRvce3-{kF{ZZWH%U84t+*moB6B`qVAbibi?(x0w4g>D$}P8wOq<9XgfRy5`4O@7%VREZKEP&M+ttl~?Gi zYx3Z_ig$#sMh-N%a&}GvcuI9nplBez(uoT4{Wa%sU-V?8B(>8)MAM%Si`Eo-1Xh!aR#T$tj4M456Gm-4DrHa^~ zIVg%T8SAsctZYilkfKv){pw1|A*d=*suW)`39q!Shq^3VJr=o%BRT7jJuaIy)Cl)i zQ8^y8M`2c^rxn!q3HF2W?xj4r4?4cqSCY~s9XJxpGK!>1aM+=_#WOy->N!lvUu`Z6 zHNyyVjFrsmJ?0Ms@AelvTebYIC56V1wQr=ETnAgiDks|0V4Gn0ey*fczVVmi8 zT)pVeoA+9>Gkn`Ek#uSgfM|`<+l@I+4*&xzbG7hDjARNjVh9wdDc@rRzhCtW^ig_S zl3&b-B@2Mx>kZdF$xS_~A+X9+JNR~}JH3`p=g_6R+{yv0U&snhl#xKrXtF3sUzbDr z4U~;eXw+IG>R-MPB@tEgOcAxK7@FDX+kWsXpP8>iA6?YPSF!qV*yx0J*x5v~4sNuX zO%%1bj=I^kTA!SH>W1!yT;YXiq#v}4tf7&@l>~31E3xLYz0(WeujTHSUFL&DAMhu+ zaLH*M+->k`z=l8PtYI@J8paZl1lpLisC%%&={^YDH=O69Qd@1@|7`&!5HrhTCT!Gm zIyMtEG75t^W|D)m8nxNk(_s(7`fke+zX|P!u}?DgJ-;T`vXt`W4&;dKEhZv5%5Yq7%v2%7jUOc2Q!k8@f zCxZ0Z+iSQ(wt2!&;lFP%dF%8Bc6VZ)+-V|qqxtd6aB%}Qn^DP;5CLv*3cSSmfy2>T z%>A_hlZd!kPJfTTfUjChsc5N8+b5Oz@CnkV1>z1+=i|??mjn|dhg$87Y7N_mmBQ}~ ztnv)01O?|-jreSvKZ1N;Ax_Dqo5eZ(LeU8jCu9 z;~zDe%H|?Um%+uq?&+XAHOexc&V#C#QAuInU-2Lhkw&#%1eNV`Ey1a*TNkEN&!?0@ z)b~z5arhb!1^YV7CBn}K3d!2>OHI@6JWxL#tvrle+g+!$u@X?is(}yTssKWwS8i1~yM2@7)Z$zCZDD5Xfi@x7R`pb34L}A;_(TPoOrk+1xJXOfiSlZTVd=bs z)=U%1Aq6fJ@`jHExaL;%a5i&o38s9#4WEsWTb2o7*QN?8@?iS=bP2!GTXl$>EKJL{kg8Ihm%At3<16efEO(MzSD13)7t9#8ZBn}x->|yPp&6%z0JjP2}PGPwUu>_A!r07&D3V20T zCC|N8Yg{Wy#Z#DajcO!O3;uB}K7GT`dsbMA3O(wlfI(w2Eg{bCP(7#z$RYp>hphU*?M0n5=I0(O`~@+D!CO(4gU2RdT(_ zMbDF>=lTQL9Z)d;QhM`Gn!mHQAPtA@vAg2&(Bmk3EUTv12>%LuT&=;e6Oq^2RH-NJ zAP1UOSmn@62Et39mwpD)FsE6<1lEg7V@vT!Uso1Krq^CUReNHmv&f@I>UDmX zv&hRe=B=RKf102hA^h&|8}9WjE}5O@<)v$OXBtXT@_T#SuFp^5uBuyJ;gsu-&v|uA z!f;bfl}ED2!+!c>`FD|BCQq2xQEYL`&?j35P|D?nt~F@)utso({&o`0pwl zM*HASHC0d^55KtXu|BHh^pe57xb0C4l>P-kv(vUm3rJY)<@t-Hr;8GVBo&fZ!PblwHOiln4S{f2p|OWpeaVmxl1aP;gX5mz3ufRR#B}Vw+eV z4_lHYe*7(vqBbunkn+>^Tn~w!$u7gWm{$3Pui5|U*OcfITjF1Up}~{=L94n>pj$a> ztmP74=3jtuxIfVYGdfRqjOo$VhacCKx-8g?G+A29ZRDu2=hZYqy$9JTbvMHTgVr?e!^a{PP< zU)|mnj=b5PZ%?<=V?S^d(ATdGXGS)w-~0}4^IQml^AH9=i+;Y}SjA1)VU-?qptb$7q8 zd)toz&GNN&S(;?RRJV9yd|WE}%q{p=H;0_{sGPD?zY$&SekR*RGC4xUiK}wBDB{!d zckwqEb{XfBp>qw;*Oxy@RT3W%IL9rn?k(ez?=SQq9u=Ea3g3#q=p*%gV_U~~>PNrP z&f{F$I;9RvQ*W=mIqET*%=>Zf`LmmFWc^AP$q_OcFRSvSPKT(W+Q7lvQuvSv?fj^z z=S|^5z1x_ZtM%ztmT!wqTN5R8*EzUNFPc{&<36>Lek&bGKGjmYIVx5}Rhj!j!26tC zr0AK*ixNa;! z*o-4@(n@VaVouae7Y?aMAYKt>)Uc7>@2HEH(UWB6KmBn_g+hVFu3X7pl76}=D$orl zf`utr&@67^m7VZ!7rOaILLa?4&z{vK$I@&q0s0e|D~LWvj3Zm6-&xw*neFHw!NjNgCLFIP)%#bU?A{Gy%Ax%HPo zFkF0u-|8vpZNb=GI>uK)L%u84%ob)a6VP|OioWc{5O{yQGKQ}g^u@)4hHE6f$?B$d&b+p6*! zNIo*pSHgRz)#i#X=Vx_DGd(zLRO(VFdajP`Y6e`I&O4;=)P^p_&=}NbXp}FC0vX;U zQ9&6eT;+o(%p6v~5vJQVyC3vu3Uft~X`w~iS7L9?)N$;Mq}r`M+#4i76f**!>Bqa) z&X}xfi=C!eZTZVn;oJQfw+kr@$hPmmZm71gqjgBQs`03vLkC;?vdxy)ut_7_n)S8^ z^ra!5kT0RAnR=VU%|04;DICeF{ubWVzT#~Ye*w(pfug9Y(w9oi{dzL(u}quY9Ubb6 zt~iUaR7x_6J%6Yjj71a*;&L6_dRE`Zbu1N8!J=7x4A++4#Ju6EbL%SNWx zCw*4sSp7t#g`Nh|Z|7cF5#$jtpjT6wQQ*L3<*l?NAKh5VyDF=T`NW>iB%a$l#7(+; zV{?jD9FOT(Xptj7dY?aA=h?bu+0Ntre7JS5t{}fWLf?kzo^g{iy&XU*7p7Uo4J*$B~-l45aksQ0R15-HF=^h6Qe{l+X z+|DCrC`Ag&8qxltnk|-W}*A_;I`cFQlGZQ^y&RMQf|*ifEa*$TYST0{ zlvt29j)Sv|m}wf1#?ykTsFJn!@zd_IN8FMH9LZCzM0p36)Ow#(m_xy>%=s>Q_%eF< z%B`;@S#F8RX<2k@{pkgOC?0vSOI6U%YYo{FSJBd5LpIKpQKCL(N=UXYpKY@7JM@N| zE=S1kwu*O3@V%_zy{yPQ#jpX+?s2SojuZNeqo{v81k&mqVJO>U1$mg(^@o}}jg60w z$kwBq<_HOVSUw&ucksp0>@Fh(*BCm41v%()>dZHNeH#S;ptz^rk8QoQe|7&bkfm&{ zHXZ8e^-ZCD{#nyG*@^Ql=;2~pS!2_fJ*57Q!%2^ixn=dLa*P_O&?Q34rtmMImM-&F zy9v^7uKs)UaCO9dU@+T>quD!L_xbbK)Gu>*;@;mf2x;9v=1=>vX6AZ68KGPozv$|>aEu=%i;-fQMSPipx6#NWQ zc{|+aqNQMa&)8b54c^dAsotMt*vo2V$7|3new1b0F#`8Mib$a0|eEf&9Zn` zu%^if-vuVpn~lcAmLu8UCG4Z*>T+SHeJbPN!Yny&;ZK#ozcLokuqV|V zvt2L^ZhA>odXeasid2you}PszK$&#NwPF6I^H|g3yvxk4_!kfpldf0IB$;d*$k^WI z?NTnr0d=q3EH#2HG$^?K{S~NM7HVVWYJ+X2E0LM4nhQiUEsJ=Kw2_CVv8JnLWL>DW zs%xYJOinCgwekxpqTno%7LNueQ$oPnIMPU~N8blqq{N0+Q{t;ljuuZb3|yfO$-eth zlQw7BSyb+vS-rLT8ot_5ownDUrolgS~ywaDEh`NHpndATd5E*(OH`6B#ze;Ps>>QH!|3%<#?EOdAiC7LFgYEIDVZvo5QztXiBc0;d*R<^Qu zT@J8apqty6UE4rwLs~2VunKZ=OC*hPaolaS=DpUiSi91j6l{%%Ms^}F&lsDV-_X3$ z2kE!=!p^|O>0Q?`8H7~$Xlr&v3CoDzs^zxxFE)Zw+aCIjpXj>R6!6C{`g#{~{0<6= z`LS;LGi+P4EOd4RpHE`-5l;u)$LxjW9n0})G#2b!B%8Jke0 zwF^}0s~##n{o1i>q>ZbkRK9C-SZ%5f=A$IzsbTbC1|PTYQyBX^zj|t$b^@Wj zQ`@(yxzUTa%2N4VzEDpiq1rVYK)LaYH_B5O zqkN?DcyF~1sJL2I;%)Mj#w6bodSnn`KlWy|Aq7>!i5CY-nl01WW0 zZOg3Hd_JFljLlxPgDF=VwtdHy)#V&*?=IbPZ*u+XL0y({I3&EWwa5Iz>)7fJ;<*f1 z>ZxANKQ9+A>*=G&O`8wRaJr@;6CB61zCmC&9tYj&UcM!10D=fS2wqz;EF#9%T_ypE zN@yG=l)Fpxw&#GbT)DCT0JExI<1 z2?J_GPB9KARkwTA1F=9p(zd9!s{xK~B)sqRkdrSmC6`vbw-l$xak+$*+NN_whN3qG zulcoI&IS)k^e4pIsvQ#gILW8X%H6qaGYrJA*;_q15X#;TW9&loY^jOWx{6lfbr+CH z;1{?Xw!`|aaqT0D&7wb5WvsB7Mlj^KWw&l>TWf*}UGzGxU}9nx2+O=tWf6=E_{-+o zCDZF;Et0yiQV8Or>YzEUZMe9%jH;6t9#WSmvl{99>~%+dj;oaUWA~F7$L}onjdZT0 z)sCsQs2*#SIL7|~8Cf1L`^!@}#lpIt_-|EAl|XY^AC-l?WsN>9`^j^QFs=LRfaa=w zc+q_5q@W4{ux z;ol`j;KoS-h=uj-D(?AGD|PfIQbI+LyP1Rx+*D;;+l$CKGOgTJF_~>_W$i z)jFh}YM01QHP7U(onxVk5*<|Ei4Lon+r7NhO;fMMYVvqvtlOfK5Cyzd55z1utvhEV zaZS?PS!3k8Z&OWHp47&n%&FSQwb!e&=jjk%$;B|~0rARUCt#;#NwP`hl`X8kSx~qE zEn@0zcDPS3mQr;@-dR=a1qH!2Z81|fmQ{kLZ!D~ELYqieWMAJ?TgE`GoPDK9a8NJa zq_tUMx_>E1ViWaPZFSXvt8FD^e4{w#RE8%w=2ipUWSZ-y>9*0h#KW0ZHyN9$TCu%M zDcY{vKbEB(RE9S%YSk34WbIA2100jJA1+DMtton2P!-)a-h8^S7ZZzaz6>aEy@DIyH? zh4IxlST=I&;fy)JS##NlgHqA^?pwn7(>%EE9kf**GK_VyK;4@Sh3=fk!Yd8?-d8`# z{{RheU1zp%#N{7p4#Z_YX=~JgUpemX$~Cf|wz|AFeR)nDM(1ep?_5b;J{IEay%4_P zB!lu@cyZowj!gdmTGvgAyKeSJPF@;qd+|^>g+bv>?@pDV%y%t_j9Y^Gy3^)MwgeBJ zr&hRh28-V7Hj8se=(6I7Y$o0I3d5u}dxE&uIVQDQ+)hHu*MLti$zko>KG9h?#_HqR z&{n*!k;{+#mGyYJKjVy!`*{0BBU0n`ip3>EQs>ic{H)En>W#Cym5SFXlBL0ZTEA|3 zl_5Ka2P{JF)CXUhomb>$_si|$6LSQ{`lBZ_P0;YQ@x34k^+fEoE!J zG_@)NijZ>8NWUu5`vn5^2e_&oAq!IkysVvRhpZtr%Ct$jFB(o(MzWESQ0Y}>Zq+9m z{H%iesPkCcef(6}E!Ms?`F6<;uuo{J)ww{t-A;@0E0Sw9D5?P))~CM9w-sX^NZePZ zaqHW~-^*hyTUt1(#aMSWj3P1(={A+&+;=P26Shp?_dF;$#j0!pjNY-Nkh%Is^@(@k ztKmNQAxV=L1&mtj?+R@Ma9g;>cUcQ} z_OiYq=CRC$sykT^BD3VBZxta=7;hz>(XCb-E^#~8RhMvD^NG<_Nlxa#*;?}FSZ)UV z6}e+AikAxNsQ#oI#>4i{Q`oy(S$eqmW>a;?EbR2>^F<{^U3^<8oc4f8BebmSIu^l9 z#y@j_-Ym8*-^Y5wudI%WEABEo#cK5R@zyzZ)$GY-O*B%pK325$?p&@q@M`1Vd)%sO zYNVOv&T%C1D^kg1H7||sC9FOT`2?71?8}q1){>O(SWbV0R!q;**EsM3>mGY|v@ReA z=>f!Z+_`>6JHgYA>m?FS8lWo2Rf|wbxdmhCdEmTr31g+?yKP%g3hS^SWy{U%sCXXB zR}Y88W~yXwBs87mFHOtz@UskKSil;>_gl8szql>ok6SBS?JRTjP(N&SF~Z$K+K6m7 zt%)oh6ddu%eIIWGvMGs;5lRW;8?EYEsG847q6Md+xm^6y3-Mn+@-VpPzw6nO!ry3uBebJ<&4K2)-iR~WYbwvV=h)eiosCV*sHd~O4VZ;u0dnDQ2VJq zVRc)k0cv8GAl8zuj1Z>=g3wPj31)0^SSGDsQ)|K;TCq(<#^S0ol2&FFZgEU>gLT4h zh(YVeFEun`>afN;x(qB(eU7{ZD`U3mQ>U+h?>v0%~U93 zbd3X@g0kacS(K>9QMJ0hik#0g$SoQGxpB8UD@_C~CuMROaO2tvx|UZq&Jc|oH!;Kx zCy`vQCNg+#V{P)PniDfbnl9Hm!CGlr%97hy6JV#`0*aBXBx-59LbNs~RK+Zkj}3*x ze+A1fX}3v(Ss>9a;swozolYj1n&KLFD?Xxnw-Vu{uCQ|0Q#v-c>X~K}bFBWWrMisC zEohk&-#Z%SkQ`L$>5T4s+}{PD^XJKIq|+`ht}7M+yz&Q{oRd;vkOv#Q-r=NgaXoq| zbH7u{bf0V-K8^C!GA<9B!DnUpsJA;z-}Soxep0u?JGuikSD7?{A$>OhwXZ zA+3l%jp{9m6f_M||S(Ow~)jYYNjvTpgR`N+waoshd zrp*fXIn9lQ*VN&v-3KL+CLa-mm-re88;3GhGo@jxYn%yXnge=^S!d+mqT^?={;41F_Vd&c+i1Crh3mKt2kM=OPz;PHM#!5}Sb9d0a{cGY^D z<-=)C!PS)TmH;$5Mz+Jupla~)JR16A=9Rw{uDIIT=gq33P2~H6)!{Y$?}y73^tw%%AoSeR z?f|L=A|wO@;=0;;i!Jf;&rV#pea6Mof*Zfa7Xe~Q;~b_y(%?mnxhy%cCinDFaA+pv z`IKd@W18SyyIJAT72CXWn6H*is~sMf0^x1rf};?5(-RsAE_Hwjwxkw#b_VSz?yw;ksNo6g0uwdcZ zyKJjk&yy>fUGJI$MKx{rUSgH&0Kv~oMs$Kv6z*aQzKef4TG#X zt!ry*?Snu3n-Cf=%}>hN7{pdzwz`o&6TBR<+dccA=@GRl66H z^0M!pxD-4<}MRWcp3&XI7PT}*I832TGok-CkJ;pbIS)v>alh=mbSLzy)v6f z9DEgvROdts0J_S3d~iks1>_>fv18N7Cz|dT-@~f1Wqi`yeML~P%^5ZztcOuG?PNra z_Pw~Qxng9^v{z$?9!p1AB}E-hw_e~_ElG0m68^r~!wg`R&(oqiohtdT_K1w7-UwRP zVy>DRc*BX&a(w(&L9VELJ?!}WGj2ST)_&>RA57RFg^d7>=Xp{sr;leSHrK!{eD9Ib z210Koz$b_N;I+if9Z85t=ja=c=A^?cud}?9)1j(+Hh1E+Gfo-~<&yBTL2w~Vr21SZ zpDlB#9$kA7FS%pB9WSvv*7CM-9GZhI&=rFEXrDQI-Q%|H^Q(?mTc%je>MEvVj_dAF zG|rMo9p=SkvNtez4)AYcRO#m&NduYRIJx*V>yoge+;Q zn@AlP@UOU8RUJgEYr9r4A@T=2Zwnt3xo(#|O++iIOu`~>yKz+2)sqY@jmF>*R(s)& zPzV<6R#RcnKIGc#q?qHTJl(MH?W4x#Io9TQEtL_HqM(_{(#`{twix541-p`b%!nN% z3#p!a^%}z+d8#oNy^%5~4wp#cTzV{ex;bA>7%nb-_?06ll5k1jwho>)wYRZSTP)Ny zEUg^TPS$Azi|!+;bggt{;53^J#cm`K%H3P8v57H8OF&&a-&KuGv8mW#V4h|YcLuRu z*6N+o2=yCoY2>Ljj&K)k?a5`*JV@g4W|c1InzL8ZZ>owqeR=_T79frb7HnKhBLTZT zCwXdhQL<262@(^9 zyAjnJm;h#qzT$Wf?4{ltO%FE#zhz1n+1FRkSjNY>XDgMfB-fS<*g-NhwDI117RGuScv{IDxR3!M zVSJ%@$On3ybq=V9LygvL%k5`hrDVkEH*sk;Tb#dE%6Mx_jhyK84>t9qbXzxWQ;GTm ztazo*Q^HN}%E{;kAm`1iK^_PkZUz1;4qQF#r!m5APZF}k?qnv$!D6&s=oG3VY;X#lb}kmu6e+2VUBT#^p!(*-TeuXvx63k36&#Nh41vzPPZl8Z zRBUI6%F(EX+%)xDCea2-vEs%m1;GoSX)C8&tu(SR@$6#B#!X){Ye3bCSbr3ZkB~D2;Lr7S)Glw?ht@gFgQbq*Ujpf6cy0lWo zQD*>KyMJoMd&A_l*2^o5D6LQ~1Vneod8RL|N3UqIq;IXgmtQe0H$~Wzz5gT(vyLar5G`<)>p~+7YSl zD=vc#*2cVxIYub;TKm?@Iok_3+RKIHx5Roe!f$R;ufZFZJ1R?e0#qP0cC4VwjbWz=l9Og=rzDqcmOI7wq@_%ol{n-e+Uplt3PI~O zZDvf;E){2Sx+0TMvLC!DC5`SXl1(I7tDE6A>VY1oU1h@^nPoG+3FQWx1&31dcPyF3 zxGV`@;U*hQuZ<@ZMZ)VMHkjRTRWQs0Y_4R1&Rs05OBdL`impbMg^q0nxusff9%aa)45)-B$y?$=XHSVN*4jh19l zHTHQs*1l;APUM?h<}%k$+N82JZ<(xio2-cEV2{Bop6{nU_a$XRF77JcHJpsPhKI}# zYS=+L85WYX@=ax5eIBbhV`}4^mDAHyGy`qR2DV1(;O)wNbM{y31_4mmXc#@VaI(#Jh5wg~y3hQ$FOY-s`MS4%5=3K8?z^)(|X|)&XHk zO6`o>mRCv3SQZqO0J`d$hqx?uJh{uP!^4frvc!eOX45*vU137bYTbGkGRJF;({|Z_ eXg5?;RuVLVup3rwYpNxv?OgHU^68f+hyU3+tAw2Z diff --git a/web/templates/flux_schnell.json b/web/templates/flux_schnell.json deleted file mode 100644 index 9a6858faf..000000000 --- a/web/templates/flux_schnell.json +++ /dev/null @@ -1,420 +0,0 @@ -{ - "last_node_id": 36, - "last_link_id": 58, - "nodes": [ - { - "id": 33, - "type": "CLIPTextEncode", - "pos": [ - 390, - 400 - ], - "size": { - "0": 422.84503173828125, - "1": 164.31304931640625 - }, - "flags": { - "collapsed": true - }, - "order": 4, - "mode": 0, - "inputs": [ - { - "name": "clip", - "type": "CLIP", - "link": 54, - "slot_index": 0 - } - ], - "outputs": [ - { - "name": "CONDITIONING", - "type": "CONDITIONING", - "links": [ - 55 - ], - "slot_index": 0 - } - ], - "title": "CLIP Text Encode (Negative Prompt)", - "properties": { - "Node name for S&R": "CLIPTextEncode" - }, - "widgets_values": [ - "" - ], - "color": "#322", - "bgcolor": "#533" - }, - { - "id": 27, - "type": "EmptySD3LatentImage", - "pos": [ - 471, - 455 - ], - "size": { - "0": 315, - "1": 106 - }, - "flags": {}, - "order": 0, - "mode": 0, - "outputs": [ - { - "name": "LATENT", - "type": "LATENT", - "links": [ - 51 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "EmptySD3LatentImage" - }, - "widgets_values": [ - 1024, - 1024, - 1 - ], - "color": "#323", - "bgcolor": "#535" - }, - { - "id": 8, - "type": "VAEDecode", - "pos": [ - 1151, - 195 - ], - "size": { - "0": 210, - "1": 46 - }, - "flags": {}, - "order": 6, - "mode": 0, - "inputs": [ - { - "name": "samples", - "type": "LATENT", - "link": 52 - }, - { - "name": "vae", - "type": "VAE", - "link": 46 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 9 - ], - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "VAEDecode" - } - }, - { - "id": 9, - "type": "SaveImage", - "pos": [ - 1375, - 194 - ], - "size": { - "0": 985.3012084960938, - "1": 1060.3828125 - }, - "flags": {}, - "order": 7, - "mode": 0, - "inputs": [ - { - "name": "images", - "type": "IMAGE", - "link": 9 - } - ], - "properties": {}, - "widgets_values": [ - "ComfyUI" - ] - }, - { - "id": 31, - "type": "KSampler", - "pos": [ - 816, - 192 - ], - "size": { - "0": 315, - "1": 262 - }, - "flags": {}, - "order": 5, - "mode": 0, - "inputs": [ - { - "name": "model", - "type": "MODEL", - "link": 47 - }, - { - "name": "positive", - "type": "CONDITIONING", - "link": 58 - }, - { - "name": "negative", - "type": "CONDITIONING", - "link": 55 - }, - { - "name": "latent_image", - "type": "LATENT", - "link": 51 - } - ], - "outputs": [ - { - "name": "LATENT", - "type": "LATENT", - "links": [ - 52 - ], - "shape": 3, - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "KSampler" - }, - "widgets_values": [ - 173805153958730, - "randomize", - 4, - 1, - "euler", - "simple", - 1 - ] - }, - { - "id": 30, - "type": "CheckpointLoaderSimple", - "pos": [ - 48, - 192 - ], - "size": { - "0": 315, - "1": 98 - }, - "flags": {}, - "order": 1, - "mode": 0, - "outputs": [ - { - "name": "MODEL", - "type": "MODEL", - "links": [ - 47 - ], - "shape": 3, - "slot_index": 0 - }, - { - "name": "CLIP", - "type": "CLIP", - "links": [ - 45, - 54 - ], - "shape": 3, - "slot_index": 1 - }, - { - "name": "VAE", - "type": "VAE", - "links": [ - 46 - ], - "shape": 3, - "slot_index": 2 - } - ], - "properties": { - "Node name for S&R": "CheckpointLoaderSimple" - }, - "widgets_values": [ - "flux1-schnell-fp8.safetensors" - ] - }, - { - "id": 6, - "type": "CLIPTextEncode", - "pos": [ - 384, - 192 - ], - "size": { - "0": 422.84503173828125, - "1": 164.31304931640625 - }, - "flags": {}, - "order": 3, - "mode": 0, - "inputs": [ - { - "name": "clip", - "type": "CLIP", - "link": 45 - } - ], - "outputs": [ - { - "name": "CONDITIONING", - "type": "CONDITIONING", - "links": [ - 58 - ], - "slot_index": 0 - } - ], - "title": "CLIP Text Encode (Positive Prompt)", - "properties": { - "Node name for S&R": "CLIPTextEncode" - }, - "widgets_values": [ - "a bottle with a beautiful rainbow galaxy inside it on top of a wooden table in the middle of a modern kitchen beside a plate of vegetables and mushrooms and a wine glasse that contains a planet earth with a plate with a half eaten apple pie on it" - ], - "color": "#232", - "bgcolor": "#353" - }, - { - "id": 34, - "type": "Note", - "pos": [ - 831, - 501 - ], - "size": { - "0": 282.8617858886719, - "1": 164.08004760742188 - }, - "flags": {}, - "order": 2, - "mode": 0, - "properties": { - "text": "" - }, - "widgets_values": [ - "Note that Flux dev and schnell do not have any negative prompt so CFG should be set to 1.0. Setting CFG to 1.0 means the negative prompt is ignored.\n\nThe schnell model is a distilled model that can generate a good image with only 4 steps." - ], - "color": "#432", - "bgcolor": "#653" - } - ], - "links": [ - [ - 9, - 8, - 0, - 9, - 0, - "IMAGE" - ], - [ - 45, - 30, - 1, - 6, - 0, - "CLIP" - ], - [ - 46, - 30, - 2, - 8, - 1, - "VAE" - ], - [ - 47, - 30, - 0, - 31, - 0, - "MODEL" - ], - [ - 51, - 27, - 0, - 31, - 3, - "LATENT" - ], - [ - 52, - 31, - 0, - 8, - 0, - "LATENT" - ], - [ - 54, - 30, - 1, - 33, - 0, - "CLIP" - ], - [ - 55, - 33, - 0, - 31, - 2, - "CONDITIONING" - ], - [ - 58, - 6, - 0, - 31, - 1, - "CONDITIONING" - ] - ], - "groups": [], - "config": {}, - "extra": { - "ds": { - "scale": 1.1, - "offset": [ - 0.6836674124529055, - 1.8290357611967831 - ] - } - }, - "models": [ - { - "name": "flux1-schnell-fp8.safetensors", - "url": "https://huggingface.co/Comfy-Org/flux1-schnell/resolve/main/flux1-schnell-fp8.safetensors?download=true", - "directory": "checkpoints" - } - ], - "version": 0.4 - } diff --git a/web/templates/image2image.jpg b/web/templates/image2image.jpg deleted file mode 100644 index fc8e3ab61cfbd4316bd08730222b636c4c4eee92..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25787 zcmb5VbyOWs@Gp3AcXzwEySux)%f-1kgg_G9_2L@b-6bKoySsakKnPB<_xpb5ytjYs z?m1g?y5}?1b-HGHs%5Hr{;mDn17NEtC@TP9U|;}B&;#)A0A@{DR@PEWM^iyrO&(eR z0Kkj^pajna0JwpDymS<0sEv$GsFC&nFwoT|Jz@#7`#381mq6gAa(b6!m3UV?q^D)!Va!GUZ35!Zd zNYHc0Da(o}35rXI{#OYMDjFIl1|~T+Hn}JhEtBZ~Z~E5_2K93TT@_z}KEC*4h##IJp z0cRdHi+wnt8BEpR^&01z7wNMmr@!mHHO>t$mZ2Zgy&>;KQn8jnMW}=*f5+;1N&Xi3 z>At6!fjQr0Ja`9yG`JXFQ2v(rUcPdlb)hr9l&$ez4t&$jUc^6-ZKq~V!5>d1FZRlw zV1y4w#f=Y#XOLz^8-lrv7mr*qEoFN%z~rZkXhW_LssEUZpC8|L16H{-+C*s$9kvpl ziPV7=TtDO@WC1y4a4-A=;8n19dPS^d`F9hE@bYb$n}Fma#xy~Pr0%tW?RuxlCsU8+ zau>mhnK>cPUyB4)9e`n#RhVD{CKG8;DxoprF#S|(7sbY8-7a#EfWWSN6kb?ylj&zH z!ja9hJoUf?s{5;Z1LS$blE3-Au>V|a(Gng z5Ns)8xnMffA{5~GB3*?{KH!`|BiLsg80-U4hF1nctj>WD7$8Im9-_=3m%Vd-uaP}E z@d+DF^I`grsjub28zGR&byvSl_nony_=RA4@*x71`SV;6Dk)v%D{beL1%gm3cOv^m}i#>r&{5uM_Mphkh_;t4MHjkZ6u~%B< z1T0ThxRMG0HC7>tFKk*x&wZ^>XiFozw$4u<&c7uhB6vX+R&#TXm8ZyP(I zUG5Y_-{2OlC1NVlw?*Hgo>FuuPZo?RAZ0JE&ELnD5qf|J_#p5-4MF9Z{Cx=opM!VY zeD;l0@>F)-n>%&frvMFjDD#fZx^*tmUl0qzV7$M)*JaQ8HZ0;SgvZE#d3{oT%Ym(?DY(4r#^6{*&@ggwR|pUivl3Z zz_HX)2y7Wh5#ZE?*l$=-RbW5zD7QCiaWd(EJ`hP49W}v;E^Be@i);N$B16S*WMw;C zP(2}St8ISlkoiB82A4ohdMKhku_p4?fq#Xrc&qYn>Rt_%%&WKVry?1g>4ykptyX<1 z8$+VFe*i5*7u^SXPos`MC7w@6V?H__#M9qgrKa{*JUqqGOOHpi@gSC!ZpwB!@p5?-k)zuuD>$wQO3!J<3)#xDXjmUU6*WmFcHIl!+%p) z{{}bDfds1PL-7!0JP?@P^HUA}$S#3o*9liFrs}$nauzMqDntR!FMvhfEid2(W=r*2NL}DXPttliEsX4yC5pQljEcuE zc-%593vT6p`NMqrH*>FH65Urzghaq^G)r7&JpDRRn7PdNC`oq9i`iC_X(0Cs6+70l zl?fO5;`2~FClPdLO_%)7_};rcm;~*VWT=CCBERSnfw0yQMy$UsBdp6lsO!gik=n$d znDD?T(={uX4x`9vrNM(>6tov*N3!@~EH*9+hVED^EBX$7tTJjm_fiC}!|%zL#s1Es z_^F2;bAMA`P9^SZL|fVo8#Lxo_VbA;A!iDAMRuKcvIt+ zKc491#Cx(gK9~jk#xyq|ifGK~ylu}MIXT{yzi0-1Xo*GPa?TbXs^o6 z$Pd0(*e~{bEn;+SwLk1vKn;t=L6JGQOT38!?iHiLFe%WZmTL>f0sFDFVq|ET43E(c z$GH>$S}{m^GFo{}f~Xn&Y(;=%U-==_4!lG8G{y<+QwrTvlzWqk3ET9&NIc>mW^np^VO(S;x{pq2K_~~2-4@4$9b`^= zP&Kk#O}nuE1i>3AI#BhP?sD_FdckCy;Eg}qM5;S&C1VjZ;L`2WuQ!7lQHVneg6(}VYt;#BXQOn zwpVYgqrLno#>|5K;b%+rf76ZWRVqCo+BKMtjCz%8_F~|&=#{#2i}$6yeuAn6wMju4 zJ5337J{?6Zh2;+ema(A&@{{M+-gl(IYWC#Pj)f2wBS%(e(;QOouJC0T>+j=lX$^-q=bt)#HCUtc zrvk0tl%Ywb*Cg(#vpdB?5|<_#vnK6f^fT~#+dn{z@KoGWR`+}~)=;z!T=mhXE+~)F zJ@u9~Z|p}DMeq=ko-8(1jOULb;6>&wGZMcgujrHZ2DA+{yOot92fdCe*V8|Itl77;td3=56BXzhDyQw?-LcgtWUn1 zsO^8`SV#lvg|qrE>K1Lfb`VxlGhKP!TqsN}P+4m)Oyc*P8^S!=Gr?+2bM@(S+v3aA z=jQwiQsRsFt4f!_k-9}Djg7;h!(+YI#$czwFomOacN=sZol)ZTIvCrrMJ(5HRsSR3 zg!hFnzJA$zW279bd!r|E^rGcD$ zUz}T=_ot1RQ7{q_cVrelgx@}XtZHrw51t#CX7hKqyC?6nZ6VA^R@l4Ktb|j4Fy|@` z54LkrB83E`mtjS2>do+_APU9TbuQ5t9&_cpkoGXOMqA3KtM8jcMd|f(B?`2j1TY-k zJafb$|4I-JR*lBfc^?btQJls-tKEoC*OC+a&E?0jY*sk%vk4pM%8`5J8xa9{v zJ-_HUOpFbNLDy<2w3X_plBIY0(3Po~taA4cK#+v_p7RxLu#)X3Y0MY$;)D0xj+u+e z3v+5=^_UZVIDKTK8TYdyU#sIUI?Y`s=cDMJW)m<=TaTJKlVW;Aw0OdsxFzZWO`^f^ zJ;g^Rr(f_JAP?UPjr?GIb;t&kMNEF?q`_F4$hTE~-cI---+_KL{Y+H$#KI6Lg{ez8 z^Z8cWI$`D~!M6!&6Fzed0Zvrio>+@nn%7})EMWz{`dLPl8WqTMD=mV?bZ2BH`g?i^ zsQ_~6<=1sl_Fa1ix$pVkaf;fhnlYol$NQLyAtoxv%NBoRZ+egSF)`t zp{>Jn3!A`U0QZYHeUNrZPCf?pQB!l~FW%_S*a>>&wbHPoFynZtXO*za$RLL0RUF_) ztJ{qv<^55OzOI5uJH9FUs^|St%PQx`v=i65MYYKapVSJHi5IHGPhctLN#OvA^9m*E z*S9u~!0unP4|X3OcPEfKqwhJ^_ea@%pk}@2=4)k#K_jvkQcM`1_Ak^PF@l|Unm4q< zSXZL#$QNqvsR9>Vu$}*AQGl4U7EPtk$td$L+Rp>@YBO9Fm=4+t9Pq~2RbCS5Is?-w z;AKz^HC@Iz!sf}=nD>3De8IzBkxAH@*e&-f_`Y@pjbMtiqxktjgi5xvv(#E zl#yyKlpaLXiYJp}LXl2qtD;9``Vwf7v8mc|%Z-PLwY-eh{pF_}iR`&|lT)%z4~2dmx4x=3f5;Q1VLvcSWa%wARWyzZ3_@ z%ePVB&p&`LVTJ*{CMJQ#=rZ4{+9;prmxs-ze*n)HwBNeA2hEXFcb829c;qyrhC=U$ zTe(=jYAk36%$}z~K{L@?&tItt#YyKdW;S+JO{UF$W)r(pEO?Sm+lGg3rZfUA26nSI zUJ$R&>1;jDm|=(>kLgTds$PA-D^ru_a=T-^o z@3qhn!OAu{z6{JK=W9k4QjeSbJU^IfI=gh%;=)jw%9j+XMB~(mP>OfkUc*Xu2&qj7 z6hGzN+xwzV`N=JdCUCPyHma%{U~*`KyQrU`R1tsT(X`rKQu}e|u)76jnwovBs)F$7 zgDa>R8;N(_>;6u}5q|cujQ;e%{iUwfz9J%O%Cux>hfHC|A>fN?ZDgw=nUR1afc?qA z)a$eSwL%8&PgT&e9JsIZjeDgMtv+~%tJ^k(Nh2HBkIy`T-zwk}tDMSY3Y@RqQ1Hk%3W=Z2$0)iPG;FGhtq3T(gitUPK+Bwx zQ9hA`a|FMtn9l9|nfW&ild^(INIxb039e4J4Q}&C)^rh%ECf24s#un7$UU>R_5+r`s-+w${3s&f&iY*1{CO- zVXPFFWy94JOFrkK#-bEU(`mthEJ08{rvNcb^pB(ui}zAAvH5JWuJt|5%|mscnR%l~ zaOV%kO!lXPi~Yl#yYabwNOM`}6uYfL#K0ukFmZS~zxu#gLcW#V2gx}5u-z}2`fd7j zRN)g7I$P_=0D{w{KRP|QRc^Mx*r0*+;TGdUv!IMO;&Jh=XSeIIs<^H!171Qb1TpVP z*WaBK!~$>kCLhG{Y)8&cBFZw;yMoDD&%XEqm!sBV%{=Qh)3re?-#7a*HeR}&-{T?}6_O(a`y@DXmRn|N< ziF%JGjz4`_lN!Y<77qUa)oV?W8M)}Tbp>}5h)2$(lKiF?oV<0_JZoDSt;QuC&(HM@ z{{U*-N>wf{@Zq->B!iykm6BOzF-gyIKV%fgeJHU8x6v(!8NID564p2Ax;AC-cZ$C+ ze)iPWlUhd86repEf6z((cQ~$Jz~FUm)~|Qlvi zT@fRFQCDcaFSna+_aA`yMyAi&_YS2vpyw`$74%u596VAi|G z$z%SOViiT{<)cZiM9}vzsUQCUj0lTb!%=!N6xs>h$St3uQxXujBL?&obqPG|II64I z6L~8gSNFeco;105jv9`gWo@M-K6L7iYpV-pkgT&xwZO^dNia<2jX0MMmccxDczh41 z57Bhj%Nxl;<8EC zA**TQ)AP*yL? z-J-5He`OzZ_~*S{{sEq`*7XsHKed~<4ci>bIrs~g%uy}TVmNL1eIyHeHod5d!s}8X zFIX&_M_;)cv5;(;c86H~F%r$mZ__!?Uhg})&Dj-C-EdV~t%AGXmIKD@+=G6c`F*AP zGQ~_fB4i8+)#x7>eR!$f;Dba)swrXfWxO0=81j9B9Au`zF^v>ioDysY& z(b2%o)<;e}b(vo`RI1v#2jk*p5#jtL%xg~n0O^-n%L4w#ZZ~JmVzT?_l0!Vh>`Fmi zyfP19Mfuu#ai>Gd346yT0A)>aWmzgwMi^YN2YzFuplr#uOD5It>XngisFwmEZQ5!U zP%n&2u-owcJHcAjFEPqQ(g_FQKNwc*v{Dqg1$!a0&Bl*)oEXZ|anhV&Z(J-~TPf4z z^Qr9LW&~GG^ZyW@>3_knH5w7wh^^k}0@Aqay{ZILO?}SNln>st}NNt4F7h<+sA8>%*))?d%GoMu2P|+H_YM}?2gxhCXO8)+$P4KAYAtf=6-G6$g5&$Ay`?*3 zFxrf`Ju97ghv6H?rpb+vJ)Q~X6%XQNa=I3p8-!9;X&!`o9FfktNxp#r%fq2t z>1ja*E5m>Up_w4>lw^udm}Cjx1mjg;F8u!(3c$ z2RDJ2Dy3miDgH-)Vu$L6g`sa<1gB9h^uxZCUIdJ##OpgP6Kcu?PmU{!j5a=ec|M?s zDHb+IO$%QhMV;C!VVEp7VO*P9#SWrW8JZq?#1xuCLFLkuDn>BPW?~A_hKhIwt&8}wu4@<)F9 z3+iWfJva8m)$d^qFSQRc4>!c_FVjh9?H-l2qu(2x#B+RJ=veKT1r2XaYGkNm9oG)n z>;3_x>aFz1QBB9+2Cm$pz4@zV#I5s(8O-EenSTJLcY`;00j`k(M*F}Y{7Hy}r^l%l zu1%v@s}l&akaIz*ra+5y|1-NNoNn@ z1Z}%cc|MwNHZ}havcxGYt>V(NnvcTBqyN-vNR<<~mJ)4`q`D5rBImx`K{3&Isfd*$ z8^i-xd<;AKv3yawJQE+HMrTDD$2%pC(nSRu<|rFLOrIVqG&X-jQ~2WT-%la$Vv2+= z+zjAjv;UeUDId=mv_Jw(?t;#SUb-TN-B)c3+9x%%2YX4^fWJ;!hj?>p6zDS!R)_A8 z3Lvl8mclD#h+Y~YnRpUX@7H3dk0Utob2hCBi60|L60bbye$(69KJhk=i`PdKHTCSc zkeeuax=F-^hL#Rp!T)&pVL9%;_yp-?SF6vDQcGIhcf)rvEOYy6Fwbhq2A((&yX{01 z{h_%GvV0CsVDmfcM!l#Od77FVp~<`%*^arI_inL_vqJ7(pl!e9#GA~FP(5n=Ep|<@ zS=_bnEW?~{PU9I=8o70M(M3nrMpl0c7vF*&#}}YsY6elJqWF$CqLg>nu_;%`6pLGz ztdK}qQ`x`$q0g*?f5EEZEmMKh zrcpp6yXrw&%%hMgM#^yZhZI~gz6KL2E^cr!Jq&X&Bsfj3a$LrhR!gV?dVNKRFsz^= zNI)XRTAB@HNT?nb>Ph#gTNF5Uipx!1)X8!rIJvCWMT03@UP*aUoc6W36Lz=5kGK7L z-CA(YB|bROhopnh3sUlWe@2Tw+TGSgQ&K?ceMlVCePuS9yP`|DOPTu|q5yP!w56>7 z{iS1G!#caq^9V;UIr(de|BEp~OYlh?CAw`V=KGk!O12MXj+QVM6V=zVV2J`rFJA7S z3}HuD7j?)N1#lH&3fzi_QwV$Zo?yT5x4``J;PZ#CZ9wtNeH_xy1Hu#RdOCOQ&TGB zmlJAByb*u)Dw`D;e6&?nr4W}ehyxG?X=CEqu{UvkUzwqKkVBC1qq4VE2v1<|=DDx+ z5;arg7sKmd9h?a^E7+u(w)=u(CtVR?>v?WH~nMQ<6|@ranKbL zQ2m}Dvi8&c_uH~(FLfkR*HZda!maSoAcKp0EaW8yqN>&<^oNl@R~!#D?#k80uz!qb~c$u`>M3VGfsS@3I<~x zz$YklS4XUO_?6_G=dCWwlAUjjPLq72IpoB4&o~%v*cooeTr#yP0#ilW`ne*lxm?xq zV3X1OU0{=d-90C(!#ST(`WcM5uRtHDnLctc?2Es|uUTGgTbv#_Tu-Ps-C{(cgEoj$ z1Hprj;v(PK+&sbO0LkW@4U%heVT_K|p$igM1b1xG%$PprAeMA5g1JMw`nO=GDkjrh zi;o=^j=rwa0CnV)0?8Ld!aY~iDYIKJYCm%P*boypx0kRb>k@j_oR&7+dz+b6riKWj zMd3;gq|JQFOnC7=ajXD)@pOVs%X+Cg#--_6z~BIUUwqy96=KQ-N(w8#?)u-!$)+}~ zF-9dJ>HMw<2QsS^C4kPiRd;yw@`xq{wv~vX{jAhVR`_YFFSI))9rByHON#n%_KDAC z0-}i%x1i(+*!UurWY~^IMb}1^wSMyxlmTCibzDR$CItdmHQiDzSY7;M9&~!Rlr&5= zKussqgG(Sk@j%fHXWqkjl;xU_@?kSHK7w1jE9mteUPDSRQA!2{M@BCKE)}Su-KBDj z2LaH-FipUQ!a%1>dOdkmABZ}>n_-p0L@EprK-k94wgNw5BGNM<0dfiV{0*w?0W=aB zY`nV8NmL6J+nS!HedMxyPa9C+-HOIr{_9>oSuGZHeU>%O0Bj{P_41>vfF$z}eyWWa z{WaRK>Yl#DnSN&~8UtrN_7PJ#hkstcMW(dll9c9pH}Le;7@zMZjf8w}tpB&t@3MaY z-8EWQZJoHK_=UU3hmM!-kM3t_4M8C-`naa<$0K4L6v1nszi1Jtlc$VeweYnH1{{;V zA#p~``jTCsAf)WfJm%d5?EL6BDGHiNi(dht@t4>qj)w}EC@m-qJL(8GP7FL!(rmtd z*?qe&qsZC1-n|Zct}1Nzc=vzIpT;f-ky#m6n07DDuVoWq%fszzNTLz=vsKpB?b98NTR|y~*Gfs^QVR!c$F9$G{89dRA2fUan$IyUaT9)mBGe^4@`~dF!|g8WJG8 z6AM@pHKa;tq$e#CVB|}MiThc0VGgf+6McWO-27FH`gH_D(W;X~|4(^^4yWa-FP6(* zf9dOn8qu}enzom&@03X0Jib``16+5nB2LS#bQK=?ON4*$o^WPiY*|L5IQ}~B3|GxuTAN3>o2yJ z9Dui~5%lce!WqF@1zoebsLhFGGan%tNET6TA#|Gw7MI{RO>1nBj#|f&_5^xu zc_V#czMr&Q6ve|E*ie(7sR}8cSK)`yyq8`}w!R@7FY}op!J5&BYPRHvCk>`tVAklA z3@$|OgZWI25?NGgdVp1-c{efo zcYa9rE_4*`vHN40vc9RD_ng8h|3)`a`{{B;)=T1RUGz6~Z4&pk{e`BA8$L6piPPS6 z21&3@3F43wuZW62VvF~<iMRoHL6ZeK+z z2453h=F7?$NS0m-bA~Uda^5oTmd=X@W(_{W$cW(n9wTVXO`-o()@XYB?PlykfLJ~y z3L$5s;NpXwPo{8~(Qd$~RX3&j_lA*Gm0u(1Gopanm~17U0on3XCK17R$sd!|Q@-A^ z=pLaf-i$k68m^v89?BPjPXYF{S5B`bRX6K=tpHcTph6Kvw6-WyfB&oBiyl7pfpG-~ zrxfGHk&T@YGi4Eo#`&3rf}Z%23xhhJmMcwrgney+&w}1^cjeMN|5A)xdo`W9Cd<}QWs5SiGGfeZn zgx+zK4yskmPKf(4W_Y$9b-jh-NM)2ekHUB$ABMo}E-jcPIkg9-m1gzr5t3QIp1XOU z|4wu!w#$%$JxGw+?Z&Y?cGqhD3(C z-`W+0G9!OB@PfL)=ZBr1)<7gzcNa=|;!T8HE3F0nIqhafOx`TFPxZnOCNt0Q|(-*iM&W027jcB~MgBJ`Q8Hr`LlDWL(_3yE(7)iOx z_X3&&!AWi2nva5-MRH|ES)UNp`3{U()H2-)khkjG{-PQzwti)shXj}))b!X3qR(=XJvw!Y~KCzKsIUv{5CBk}}Vf*bpFQ5?!*_3Rft%#>tsdA=~;GSMv1 zj=4upf4OJZdDp{SwjN$o@B{h=T-iS>r9~o@KLm)dW5<{4qWV`nI8alYT9AJ>X%wxE z8ZquP5kk8%TQ+*tuqddKbH~0nNM{q-!LS8ABB0RfxU21aZybqQ*phQz+PSp!L4Q05^6GL z;a$SkQYZNLUpQ#IlZlGinAAXe@i!dQoKhC?BU)Lr^4@9$+@R z#Y56YZgc%4jq~P-Jlj%4H{(w6i!;ZwV;EMpvL`^eN-GJ6&;5)u&&cqIZM{Dgrgc0} zfVmKVdQ}P`+Yd=@{{UzoAH~z3g*m8QI&osiIq4$S7RNr*yH%Pu1Qk;0~_GT zZ=#oI8UzoV zgCbKIsO}=f-Tt_<^{z5r8S`6gq>pC^b28(w!fetR|3&S~+&=)cduZ~8__)7mCzXFK z))p8r{7d-R4r>{H$I)6~jqu(5rR?5&-M*=lY2$K(z-S9CG!;aBQKri82G6726On%* z*;i;gsoqchAfG=Q&*yA*=x)yboQ}|csfCxxzqww~zIz$53Jyo0SZrG%p{T*)$R9w? z+qW&$w{J)k09B^)3XrHr-z$o$iuHswT@djb)1R_)JgV2Z7z-hp8k(t=#~hSr#R)eM zc?VM3E|Gm!A>LNzGp4|)@La;?ZT#{c{M3a83<6`>#wnfP7d6dZxAJHX2>4gXZbDzZ zCh)1m7jJFr0n_2osq^{no=J{|jQq(mJCV(AgFuKq&k>IPjZW%DBdXbyli)M*SxPiB z=ep1`C*7@9O~uqMlWh3F)6X1D{lY!uWeQd}d&G&Rsd{nITK30~-Z&+;Aokq}G~;?g zi}3q{mZoxMGoXqcZg?>hiWIjLbomFMw;cSUFI9)mjn6-zi~*4rb69_+;X5r}*~g4l zlP&(${_=fAxk4N}$9vx8SCkwB&O8}eZK~!vO8I45JY6vu`79wb-Hz0D9;Hm2us_;I z&6)yl9o#g{X~&S-yuOzh1C28Ws<$Ov=0hGNCN0B77`QQ`*ZsyGB*r2rd)O_A&!9Vi z6d|s3vlk?5W2JN{JG9cxfzOzVl)8e6F0!eTWUp54i^2oZV57` zT?o+h-An>b_#I3p9)2{9wIMgU2`xB~O-sPcMB`A#`X9R9k9srGqP z?_mU8E9ry+K;Bc$kgRKGCFosmW-v%yo>2CDd3}*@1`Zgf$UB^JCD@Xy2iyND@8)`?HNFXiaxPu4|50ll!k8Cw(!u6DCiT~V75K>A^T+?2@E`RQ;%+5U(LB2*|6Ykl zOFe2vO}of2J5MqtR2N#?pfPd5N|$(7(mKL}e3ibC$ca8{bD_IqI#p3In7F(4ZP4-q`u@J6) z-Vb7*p%z;yAhGEZSnhqTPl8SR=G;K3oT)UKG~zagk$R^lpwVXYo2@ENuSsdl9>gNd+{8w9;2KLm42c4cMjO>Yz$hErTLl4u-kNa{XHKEO$YA~zXkAOj82k6u-U`rXmAd_yV@fi}i6*IID{1TY2AE~BgOV|p(meF;-{gLs)+ zzQ;$luBXP?uFIzY-hr+)vlB^RLU__O!^KVGFr931%Je11KxDH7UR=&(!9~c(QJAt6 zfJ2Qp>rZYC8_(=FBKpMQOsx;`C&J-+=>{p?&tS}N>AZ0ywo|LT<}G3f79y#vlY@Lj zOVGfIIWb7EbC3<(UPk5 zbH>n^TRN99e<*EuTKpAhedgdRhaH8X>i$97J~UX|^<}aQ1wUk-wkMBMq}hd0?Hkd; z2EIwXQj6D~%*m z*9p=u_f`@VWztx>pacjk)uOIjJoE6c0P9F!ibrzEFnArbBQaW>oVtS=O&DAnyrakygKQ2mO2Jo|%NS64`X1SciEyJjwI2*zj;<;{RLo93Qwf)MGIIuCH*{=vx_vk|L^03V#_69`+ zOoK5Wl*}v{OE6-ds_*ago2!uv%vMAc+G@K5yH4v?KN;dfSD=Kju8qvUR#$Dfm%F-X zL$wrglfj)g1c%LveqxIdOM1w_$Ae*}fgb~zh=;W(Yk3DK$es#P~ zk*T_#Gp1pqTNi*Ebs2Q-K(y zPHt1lX~Ct%IqI2IVUWvmH4^;Xyh18lHau4#de?V z5MI2G4P+wo3-l#)+Tzb+VezwdCMuJY!$T|BWz%60_2|nqpw^@i&b94otuF>k=;+*~ zwsgByH39ZJrx}v%U|Dp|`RkHT1RmSedZ1WUJNnzzKy({px1x|UIT2`zkZKIIYB(zz z{**F1jLip`1^lh}(BY zm(klZ0M@1Z>`QXC8rE``tWTV2d>6v(jzvDUvc;i^sjO_|b?cXN={N;?SOM)d9KH5j zL>8mV=C!G;C}?TJHO*0$`jQUu82kw2zc2uvW9z#L_fmwH>wXafVt$(EqG zp?<{Daq@6o9ub7j;jCRLU9dcQ)| zHCKp}U+$N)G}~#x=UrYBO7?NlGL7s&|8(bTC=v zCiMjP+TjQ<8?(d)Gd9h}1O>B^CBd8ds58wdzW|@$53js>Y0dZ< zNwmg#5fK79!AVS-WII}*s6^f_?0wnIi>8TvubBLns&9}XYkO?1XAjDuJ`fb zKxWrmmOucEc^PUY>J^hlAnUmUN3_{8f2)kls_U9ltj}=3jj94OK14d3TSJ!`*X}`O zj5;lK9SA6AidGo|EVFB`vr@Z~mV1xQD=A5lTD&91Rw&izd4`>c)>V5fY|D&Vjk`Fu zo|j>|XT{Zubtvd+SD<-q3{{maXCi6U42mL8`0EH?HZ8k}3%j=~&6^$~=uC6vbIO28JkMsQeE#$169d*&DXn*ZToi`3ji@#F&Ta$W2^{pYOWdX> z{lwGgL0&#;Cd9e2S)(D7GA*R4$`t+vBwA`%k+PmW%13%Y=ko0bFPAc>JlP!1CY=%4 z9E9r>uV3m?Bvd>$~ei{~!XeJ{Q8iurI+>RPnSw)x=KBSc9cqiH>xL!GDs>wFH z5Zqi5+=F1bb$sw|1QMna2|H;MZ7h~ld3=q#lBsr3NgBO?&+yn9ZFt2L_BNaxL@KU$ zo(vIcXL^08$Aa|Qf(ti5_=?_Wv$pswKc#R3mC4zUxd@PET0CexiJ_U5-fmKCYNd5c?ngk`>ws7RL^G)T4te_erV|3Dc zKbakEPG7WBxn^RT9{Q87PuqI$ZT!Yp-ZGj$XQ5t zFH#nn-si$Z{?YJg>t9P>izZ_;@Rr$YeA7Tx8ATfPx2*nIc^h5o*xB|HQPy%5F>+IG z!5tcU2vl$BMwqp)u7J!~0Vx1W>1W^|-R1{)f4$Peh@)J9C<2f1xwmlrRw;3rDZ&vv z)%6_KvXgv#b3a64=FHy&cVA27!R@=C@uF2Rj~X@4+jCm&%tuK!&bA7}#$e)I?w{Qi z`V1b@e(%E7;K5xK4vxT>>xlUY`JKx`S0uT*AGW$@?AgCa$VYQS{NnCulr@voE`$p+ zh6r&2{fzHILEkR{b3UlK1yX^zV`K%QQ1^9Y zkwwHKU|X9b)r%Y#7mhv+RxNZC5*4k)fjInvIhZX)mLD`)6U+71lu5CrXJs*%tn&Od z>rwz24MW&91cKE48cnR|5wXdRP|1sHwdbK#4{z zcrFPUuARd`Bu+fu{zneD-kuVJ7qW#z8dr9Xz#fS1DdwZAG#YIWK~=KchKW(>jE`&I z&fho<$ z(TYgQ*lM02RZuF9XVG;Ux@R+JJg!v=1zE*Q3z9Jvc_G~#`%;x%so`4HXK+4H3)=x$ zc8ZrbI*J&pjp%orPO+;kI5+qB4meh20iLmku^4NYhOY6HrIRX=A?h`kD04T0WQ@v` z;hb;WBCEgoM3$=pYG>U-n`DWTrVc?~7j!Ibs?uWUFd-^a?p*^oM zq^Ozic-7ZAyQ6|?YRa_&>kzE*2hwQ`sl@ZF|5;uZQvQ{hbluyHBeB-YT%7J7AdP>E zowM8&8mTOTke0B?o)EB*e^#*}5#6nzDKx(_AfFh)K1tG_S$VSIQJ%chk2H6VtJd4$ z=n0M$Buv;+S*y5pLvcKuBL0ZQZ5E#8<1@-s&hw?g&O;dn>g3`|#_XgKHkNr&dzV5fOL`gCh zv1rp%$%X2VeOC#oU zkGs0luRX1%+&(P=8*-@yHioukRfSV#;D5SQpV&O}B#^lP(&U=8_E&~s#2VNuoq7{k z{6^L}_M7zWe~WEq8=OboMPHXL@DOI0Y!FyfAeGd*l_wrH8CZYW@;j7gEm%oVqO6S2 z(zZ@B3UpJ~7<&z=&d}ujPRKxa5M6o1t%&2@-?rr{`K5THl>WZy`$NwL#cu_#@%4TC z7XjUQ@z|Vx@zCk=)FJ#!cwsdu<@Rp$yXtl)xily2NI8klBvpbDgQnjMJ~KX zmIU~qG8u8^3h54{w_7k&IXC7{Mm@hyhcv?g(^J>s@n?KPMQQd=g%$bsO(KF-=`-@U zMo4)H?8DIPwGOuRyO>DHij807Cfh!cAPdfYtYg|H0T)uqhv{lOZTqE@^WP2q6qzIs z;16`lq)OZJ(X?~eo;S$Ua3*$;4(dMhW6$}WTT zd$_1;t(ih?)Up++i+xj_{1Y?ojy?#()h#f&N(c+p zax`sBmW&up1b)O|57I$v>MIyldF0V<|2fUXdKw%`>HaB(#_xj$1EUo*BxJ7g6%BQp zQxrM&{|dw+JKdn%v?`T23^`AilIS9q?DDqWsl`@n+COBZ@G`9(TDutE8)<4rzPF`z~I$4;*(Ng3BDT!n!|P=V~zHQq458PWye< z1q_(0ol@2VpelwVNcIzy+Q#8gibL%o&(hni@yl@+89h3Rsq?rr9S*8`KX@MNA_+{d z%z6N|sdn^7+CG|2Iva0f5$i6z(8T=rKLU-QW^1}6XMA9|Uy`jeuGd@9S(ZQ;b=6UG z+FoKOT^yQO6u6{v*U1S5ye!Ri{d8J%lD2rufw(qs_^fKm3YzN2x{>Vj5Z8mdd0lAG zx%uWTZdi+~%k&@Y73C(nDQ?<%K`M5*MZY!6w-}myarCS|%WjwMKhL6*8n2QWLtb6N zkPTbA9n^lxd@l5_DBP%<+TxLvPidW=^Lg91?zoEj+((G!Pg5)M5(scNAEK1vZ;ocn z=LsG?*;wMzeR-{1KDM70s}6NDq?iqOo_6}&>ON~(JXzc1$H4H(u`2k?jB$@O-s0|D z*Q96w09XxztpsdihE{-1ngwVym4_x?Rkt2Ggb7cXEUCjTvuJGBPjHAv5;24lGEkK% zVs07@2~HHeG~zIUu!5W$qY;GRfF_i8OiGt4QY~r%xhaaAwWuB{vYsL=ps-WIwuruySqVpE1S)3AvQ|Z8thn8qHdL&N$slYtO318|WE&-9Nm&5a zO30HS8p=pq);i?{kh?&fD%+;576R5*UpOOmmqAWtZemrrU@RM5EZO7j6+>GnI)#x_ z0gRUm6?$yrW~$Ef1DF-Zo39I{NNdb*ur}We%gJGWA=&^8LX zcSk54MrDZuxMNm=;Q$v{ze) zNhGndS6$XFb+%CAZi$YJ2MaOzRO-{*okur{LN0V%)Qrn9T~;XexyIct7cWwOop83s z6|EWrD~ z9e;n#Yg)>($Hx+vb+-#fR_HVqPc1%nyC4@0(KR>Oi>nRYV$se~_-aUNIF5gmUB%bc z&OhKOb9hTRJ{^6O*WQ6 z)d>L@2@n!3q9Flol=(tgLJw-zDroKkJfRS1=$so0o*hDrGU|BSWv(?fA{QgF7cCjG zuAb;Dhy}>$5=pF`0F&7=bOK2$B!EdIk^xx*nofgtA~--VxlR>o;c;Y$7jCpTLPE3S zmn=Xu*p+$*hBD;pRqJdmGw5Tsp-`x#V7-FTsHtR8-OdfaRYXl3@3Suc>n!kvOK*=9LOR_9YxkPg;z#l+}vdUu&5&>zFiQpc#xG@`B$;>T;D*+Wf=QA-Gp zt&O#}aaC~pf?az~%Dfghz>X$%7Fv`z^i5|5mN3TJ<>!!ChMNR+-q-29hd#+Ns+WL7 zKsP(A0o~{JQ>*+JU)HThir*QP(6E;|*;(16pT%K1uBuScJf36b_}=MP*3!|^J0+bh zz}Ky=xy)9sc=0YHWF#=;w=EO!%AB~zO8E?pB%9w*v8uolD5-H=;IlTHfP!iGlGrN8 z8$Fe>`e@NQ%~z^l{{SwZU;0k`iq58Wm=(&C{{SzXfB2pGC-#>&EmV?B=`#_SSp2M^ zzUWh~mLYkt9Z6n+gn#t9dx8!@q1}1p$I3e0br?U1Ac_W4)PmB>0O8SP%PpNRj>&si zpBt*fE9w~gxvV}`o`u8oT}2gSHMGp07XsG{`gUBWip4yQrQeSmO=KHDPJl2sFcQ8Qb3m^wX#OSm}l&qDJSt~AAM$Kfbohu_lWn_}FbZ8kQ z=^z@(Svp7tNWUXXhUw5qF46*Ulh9N;c>{WGwWO1T+{arD0>Q%M5zbgW;#TEEd85?m zuCn`7h8N-$97&yKH(*xXJtR>!?F%ZF(1Pr`a$0n)nns7nY!1x|_~fklElDE-v>K{) z6rh8m)!~MVb5P2`Wm)kv$CFM=5TMKsiwX3io#ny0h1}FY9MVd~siJJRuv~d@+-~E$ z4sFd>F6x;dC5D8RY%NefJd&L;L*T(9-4aFzHplybIMK`p+aLrzJZ&3LhIKC8K? zr)+@S1J!fbg#e0fBSnuj)yK)Xs>3{Wc7hjb0=+rDA3y&9r0>Y8F%3eqJfHBB5B~rg zhtX;Fisx*a_bJ?LP!E2~b|G^Nvd0^Dd#n*n43W;}7~Io)SdEjxbBIG?0S*S_*lxW- zIyzYo9ndhnDR-i1m$HCW~n){<|hA#2%p42n3I z85a|>_6SX*lA+gBkuY0blOolh-xT_t`U6+^g=khI#sWw`n)xNQ`4RIOxV zeMz;hQ_Gk2EO`F_WwKIFYp2(1E_Xp_65oSm1-I3otZ1Dv!%mSnRaPPumI(8H7FQKwI3q2^061g?#ZB)V5o z-96EQ=NP?;UcSDEr4j|{>Z!2bY}-!mBlZgeY|ggQw>t*Bd! zb>e8*U5IN_WSQZk-Dc}v9HeI6+b&*~awIJ;%HBhnTN73`j)}K*iG~TjrppKh&X}OSd?E!CL{n!ASx+_x)m+0c=hnzxNAkv-?o~NY zl#sf72A$ARw?Dl905!TTa=MIho2cXPv_P^)OmmA|0dP&%XH4HCS~&%n!gDk?d+4@l zz-s|qx#e%SMlw%9aI>_!Af4nAg=V2&REbbjOdyE8$6?KLc#nwXV-E%4r<+^>9-yno z8<(VIWOQt!W9Ms(vl0#M#5VaYES(oO;fd?3^VL<|jA^p~8am;0W!6hRu9t_cizx}k zhUi1}*)08(s9sW)f!LtVIi;9#2m>uC1|FyjjgxU)mV!dWBq1_Cs%|0XQ_vPrn<^6^ zw{#$qm>yo~z_C&6p6192Zo$n9pJW+=S+%v03C|YMMqW{u4u}aI5;6`}BR*AKr&T*% zEUOgJ-&H(n0O8SCg~4eNQ)_L|JJlX$pnHc!XlLC$(y~^tT#k~uS4!g7x{38sFdMjB za!iw5BH%Y!GviUSMyhYdgPp#K=r^RPYX;X;<-}YCn!>YU#uTABr0*& z$qTZ*#HrO*rFK-c4dPfWN6BVh`z|{VuFUZJ=(-V8nx8Q`otE-+=gX?QNfX~U6qDI$ z)LNoeG3Q2&R$VPkqG;HXin63a_c_kgjRLH0qH>$9hgOLgSrM~arPYcS=DU|WPbm;K z`erMlq?L_?G#z=au07@5b7wWwO)iSNpOg?eqLyJ|>*y6OFf4S0>B$*;EMiHX3}LH2 zplGFhz_q&Ws@BfdWz}VSX*yG=0D=nF@be4dk~3>88oGw%xGO`$l`J(RaV%Umx{HS5 z=2~jcBvj6GT^J*KkhyBCYc*4aD-7}vayE}G`jysVRE?;NvO#cn?z#B*G&4PrMBCd< zKBTN?O>b(j(pSEf{8Rk-51HK*bhraxkjp2T*108X`(s25H!ip?0B-L805w{AnSGAL zS?)J?Zp$3n;cBg6Yh2bhlFY;!O*4;0ZgN^9FLm5S%8q7dfR3S09o9`VojCbj=PJC8 zyB+9MwI?L5Z$hfQ{zrN)=;f+qw*(cphvLEsWNgHkgX|AK^F@&Fos?n31FiMC+Rd?- zPeY_|npotG!OY&^t;U}(Wx{w)3W+3i%`OqJfOXRAxd7VBkCJNX(}mpFNCcZDs$zAp zO83yHSSl%_s({5Qb&oc?DGQZvhaDe?B4e}7O6OeW8;2X_qkeP+h zLoPP38XzQ*vR=@@H7FfZ7bA250&JJXMeQu)->MTh=o8RRPMngyinp``-q1RuL1gzS z?cG#02u(_Q8(sh2~`toP!7t(7P6ws*xkO0)G{=Sg0zUMdRav!fJ7WJ-9-0XszS0CI01W) ziel>x7CtXs!Ddi$lhCeN9VW!FK?yC1#5Q-Qow>lVPtUzxNZ~+>W)nm2(tZR`B}yBl0@njn>O5_>9!pE^<6V zoyPhFb{fd!7irKU;!9PeIi+)zT0ZM?Ndud{iyE*Sl%ze5nsU~IdjPkv+V@RnyI{Fd zFk@|Nm2(foI3T>8c`dPwb9SP8SdK*%M2vk%e2%_RvgV(R5lUPgs25Q|h#A^tbcW}u zxyH}Q(MgLsEY2fA?uEU9)xLOml3ZV4S1Ul~)mw-(8xpnXs$9y}GWLzT1*RL{XwFON zw~bbcI%bU4bIpRqsKvN=e2%}mY_j}ei9T#r8hDMvH?oG7mTIVrU4Jv~vgG8F*1UXH z<1J}Ni#|$YFa+dogQ-DFO^ITSj^MOzR_+slvxLSuw*ykTdU`fNm91b6Sx!rp)I716 z&DRR+!wr*jm++rJKjQRc2 z;-h_3l@joyB)Qw3gQBxng|ePYur;o3fB~RUQdHAY#!GzCJ4U$bPk%)h8D~qGX+my2 zMR;RD$lhy0Nb*7&dMi{hwpU3eUoG;qo_0~yd-mwD)~jDF#|4az9b}%XEWa~cJ1svE z-I#;NRgS{D@tsF4y_KD!7dwR8+WP9Gza+$st#z{}ZQ$z+G1dfTef1lzpCjJewQ=4M zuM$G)J)Fyyp1qfA8MI-inALG|&)L<7`9dQ$ONQX44YtYbvr;P%+bVT6COI+z%T;~B zW#R)Yt#BUjRSRG>FFg}`L%OH|PndO2Lutg$JjyR=f8uhk*LP2G_><9YrZc?rcg;5x z^-){_x>pBOXl|t9IW8lD4K1lnr*y{B@efpk+ovn82ch%UZUs^u$NC1q=v0I)jTu9@#SNC4i;m#cArNN;Bn zc3iS_>7LM6Viee1MUV#ZIk|Hcc&zm=)<-2@E2MGFVoBVpP_VjCGhbdyqYNaQtn;^e zXj4S_Z225rVPSHWRQx>wRtXTnYihD8W-f74kMEN1v4N7L+Q6V>&vutkyHj($)U5LD zs_F5PIc9e%u^S}!p8ExQEJVUGw2}u^ot)+5fXF%WQ>}}Zn_r3^Sibo*xn=B_y zbE8F&T=iAq5%O0<6J8j<0zyNIwH*8UJ1Kb6|uXP@fZ3FQ@8 z$8;G8u{~AVD2Q+lIu5I0m~%+?RPDms_*70~yd-frDCzRYtF5V2>2bLvs%y!xy_Lsd z40qj8925rv(Q7LCWlzOnn^PTDB6jg}^PKqYWz44xUYupJ8Nuv}Eq&k&dp zGz$#4_jelkYHGa}j-Ma`%H3;n!KR6*C5om7%EAaC1~Dm)g~g<18!h;_d?l`2xjd|e z#Qy+-WQ6Nw&tjEMk~e@>h@SXEE_}gr^>W;ucSj}F=vV55p4=*q34^lVE~mQb zU4}`2Jw=CLh4@%4^3>%$a;)`}Pb^pudz!{a8w*1Q*6g!qE^L>1)UEog7Ob?Gt8;cO zwbwl@C0i;BXXK{KJ+#8(eK@Zb9F?~_5U|-OBn8v>!ja7p$VZguS0x-}lD7K-F1-#r zE-}fRzDq2VQVG`Rw<<71v^TToQp1 z(2;hLxLmDGB$SgnCy+?y64sS2z%)we0p+T2QZf8f=0Tg$K5cm*4KfoT>Jl;nfGs&D zHcgy#PnaMGTFG2nRN2B=f!qWG+!T{v(JaUZ&D|`?19Yx{0!h@MwbYL~AW2Z%)rgIP zhd`uZ(J@m8YOhltD$i=YP44Qi6jiI+l6=P6Tjqp0K4qe44%V{4#%N2LWMI(l0^cC2 z^ETjuxn*=b&b}8kyH0A2JBuU&!%oY%#W1+$VRKt&mCDaT=p_V#04t*l)|ut+X(fJm zt__OGlnlpP8}nLxi%%nC*s4`AyHjCrMDU(BMV<1BO&s^Sm95tL3#jZ`byj0&cne&s z9AUBnsdc>q7Z}5R%bwv`Y&YLuiZ@c|OHI2tf%&HslPTA|$OE!qdDv*LI*dKq8y`>F z>ItD_BG)b@Q!qoB(zFdp&@Q6@hxyGexYcseII-cwaJrlZM;Tg9y4YP|&FR&^?Ba-6 zD-DEOWejr*3s@^HoLO+Xsc^K}IEWFbQVB(owZMeQUx31OA4MZ*BanNc7Hw6SB=ZEN zqQ$&2u52xiU?tI!py;tYLE?&*2LRbzItH$YHL^!*EXulI3A;h{3!?I6tuUN;`EAN! z-a47Bd{uG1tQ%Y{&kR>T#8|^v$b(^TnZ?`KB>Xm>R^8Ar{1*QJgJ|KUtdzBlX>)8W zHdlsIJ0_FKjmH~X^;u(OhJY(HtZQk5y6ULoLF|RayYgBEg_Mk7J2zDL@cpve9P<5R zGZL6KC!1^uRcKynu*Oegt8`LVvC^CtZV-QFxG2O`ECx5g?9S9J zl3WTB=k;AbC3E;kSKzWn81_3t*VvDO>IQ*uULD2b!>V4&f<#gc`W4(!)k9lO+2DA4 z9kEzvH+It=rkk*kVsE0aEn{i1I(SIZcDr8U#@{Ral~|>8XL3TTiOeLf!^l2n%umB9 zy1ACqV|n!^)&Ww(>K@j~O)JZt1FRh5scF<7)8K&A8)z=6!Y2~TG|y>tmI19AGz;6; zbi9vC7|g%Rf@V7IhE}-S@a%qtXLy1JJ_gi-XE5bI+zGeP*!0Cot&N$ikFWC@I& z0vxHp^+?3m-AD?I1tVJHWC35Ya8E?SHzN?a14g=6D7Y?5gnA=qpx*q`>D40<=!CS6 zNCGzMo64HSD-w`Cg&TB1l%oKGm>WpCy-r1y7PnoM=tq=UR85N)Pjny@;jUJlCp#*V zolc6wuWi1Hv%%@~T#ksY_BGlN6)KD}ns9SQHRcM@a6G>x1Rj578&9gP{5F&;s{qn2*Y-B@LFonZFpK8w4P0-=8JH~jc2 z@9@P7wq=!k(H{+Q6G6w;H;?;;kIg8sd1T&3kE-ll;aD%_bAl-RI%7Ur55+6X{5i!w z+{8Eot_hqEK(}z}DCowQC#}}2FgM#rDVu}L(V)7^EbaE&9Axx?wFD~>)sUQFl8xGa zN><^{8-wy$^u3Nc&dS_%AhlO*4ploTgGc+S)K1Us12VA`;E}4XU~TsLsTmj>EbLy| z^z-*eQd;(I6&Q&MS4c>;im7@=yE|GkD|lSOnz64ZOAx7tX|ee$6s^wflg8@q7G2F& z)pcwYbcZX(ak###N=KGaw7Yz|u0o=bnS+Z6H@G0#Pc9>gGL*5hGEFoxZ}SVU4q3am zHheczL#eF2Qy%kR$Ahn^RD4BJ=&I@80r&jQw?)q4bNGT%@XB}#T+%MrpMt9uUN9hk zwNbiB1%n7T&;_1$S=C-R*?WzNr4BiqMb znLf@*)iI@8#|MA^0CxWX_NM+2FRb7G)m~Abg=02}j&7jcSfu_TKJ*}Y1FmD~WO<*)ftda@$n5$^r97ReQNfK@vZb{Zl)^_frL7In3+}Io3wDjp z^>9)$Gk-e(34EXMd}z;#PG2nx@7>C~d{ta8p9=?F2$TJmhXI!Nb@WUr+IIj1e3STp zAN^p~osIb6&@P6;CSM(EU2_C0n- z?5zW3WM2A|#1eN;WUgt2w+X$Rb^0p=4rMimU#d10%nT!cqGL|YzeQup6M1fcs%c}j z?tV%>0|wcOyQRvB`9rrKG;Awy+BXFdV|pn_X&Z!wTWUgN2DB5hy$czTXsfie5wg7- zo0mWpN>qbeZ*>)c8!Cddrf7KB zCoBb)Py$HR$cYx+J*P_ZKsDJw=tEhpwN{=l%|$D2H`zs8RCG+}6lNBaasrvmCz=d| zbN>K7Y8HvnG&f+OF#*VY)Y5CE%7BtIu|Nr6HyUZpMq@2EASpE;cn?JO*H`^QqamQt z3yV(Y=$zXA_vDAkd+L5DGiTSzK56qFpH#n>_;pA*qmlt;Hqp2Erwt_AOM0RXZL|XZ zmqZ)~-nXhmj0;}mBDMBEB;~+;=B8`GI=p-n1(*D~cC-U~>Y2s8Z}3jsr?0_11LYUK zgr+)P%^x)PHyi2QGp*0_Kn0i`nZ>sq)W%x@Ygt8hbScA|$o#?xTyI4u5L)B%QG(N< zPEClgKSao4L-)T#CHLi`dy}vzNg=v|K4>Di-fS z<2z@qldL3H?%WfZT-n)?{deu}E&y9WMqUO00|Nt)d$WMQ`!H+rl9Hxs8mcn#O44r$ z007J+;LX6Z0|3r0ULG2<5>$Hn22@D90GK!XA7gIm>GogrfA!zA9#;RWyTtl`)%gDw zqF7mbTE3}Vzd4}CTj6hY!h6Gbw*SS9|FFe>vCu#4>*eP4rla-`duVA$zG163%xL?+ zu*LtvmTn&Z^b_B7gq)qc|CRO6{A(S$wTrgqTZsJT$N-)I4S*~_;$QpU;%~+k3;^)| z1OVVt|3_w#2LNw|ahW|->^ZsAzM)j6N_Es;~H){)U0$2m60P+AAfF*$K4RHe40UQ9{zZ(Ea z04fp^G7=&xGBPq6Dk>T#5jG|U1|~T^0S*x@B^{84l7^Zd#P^<_iJOU1m zM1+n_N?uY(j!#%b@Lwh{sAy=I7?@<(*kpo?G>n4(zs=u401h%N02TlTLj!=tfq}z; z`8)d7001o98xLXrpT+{<;9(IEVUPgGZ>jRw02nwpSa^6?WHn0FPb;AjmR1JjYLV3R7+N6Uwg}(5CZwak;jy&xOmDRY55Hwa`tO(j zyBq+_TUFo@5Ru*z*>C``urTnj|1mHK|LOt*ivtIbOU?04oJJi1kJH>ej8+1lOCzmp z@9#GNI^0`sIB+-sQ9$+ZDOxELppNJfVV+P-14e=jMh;;fFH|jNkO?pVql${1Oekgy zqxdge(}eLw#g4|4lOB#k#>PPf(xieVB4KxN|n->OYE{eszO3D$VYbc!=vZS9w;N-+_?Pv{bo6DZ8hT)hLXRqGiA!PRu-iD?Va7T0Dtq&e;20NJKEL(B zWUQB2q!@1ME~*$4pcgh$pwbJ03a_~gc`rDMop4PI$PSjECuA>!!S0q|%bH;Zpg4p% zn01JCh$Up#WLKeSq2W>W}LzFJl_1N=dK{UsZkf)) ze%^+cp1gkCwy?%zD?rjmJy58Ulejf9@isH668-W;BBqi{Fl4^WTxS|P&}~NID^H2d zj&)XN*JD((rO3aIlHOeA99_yS)eA!~T7g}j&W|=Im7dm8RDW}7$gnHJ%N8p$%uOqm0YVLU4Y!omCAE|; znlw}j&WGiZGD(?4FKGL`#^c}j@nAf?AspjgSy}m2@)ZICx?O~R<){Owyge^<+tL(Y zHc0WK8kyFryaf;pG`{7&I_2k&FHuNPwqTk0RZz^ibA>Kye^-&1H9W&$iNDDJETk8B z1eH2Fwls*Bdk+cuk89xb2oTw;RYuEG7M8Br^`u}OCQ>n^nyN37q1QnI#KTgf!ZMS? zE>EL91fpua;S>d!L0JM(qoGORqm&?8Vs{03&#(dq)YhMRr)y&T`Y3f(o^ypY9R1Jx zl%seBK9ME4?}eSUDqfE`FqHD1mW{#|g%LWM`-6sX+J>)G&`9wWBe)vSzUy1&0`~JD z_}nwIFq@17m8|$|HL-*sBpycT1hwLKDh}_yl}f$wCchw1&14ytj#iCqc{54OQ;SGL z{fHT2e!_fg^Q2Hy_{O6|o5ju5wynUA7~`w+Epuz;ehq0oO(|Oe%N?raEk_09%%f*` z%7*3gbmJR1)OXxC=Q-Zz>xC!<&rRsPCZMXuki0^~z|tW@Jrk6o9Z2QTN9k#mPi^;j zp6V)G_*(D(0?>vu*|`%FaZdYvzT$t3{VJ^tbB8OkAxGi!Ip?(^#L?KXe_GYOqPnI! zo3K|#wjn)6=Hjv&$>}Q1fz(?nJMX>C=o0313C3xCqMtg8L1L!n*QNcm7cUcgwJ+Lo zqWhp#7o5Lu&v1bC(F)5SHq#rtdOx&ir!rchO72ysa$2D%YWu<(*Ke8ROpxr~EfR}$ z){{IfpGR2>h##CE^g)JPTAdBH>s{+0s=D0hWBSceJ`Mn?00bc}heNCd5T9K`P^E~6 zhKJnaaGdEeHarT;a$M;^dZdHtpiwrU4U0(sL`b%5S8xbQb_l~~m2^|$r|zc0v6oHT zo)*@8y=_lVY4dHJ{YT#_ak1+vJgrbQ2Hokax|-0|?1E9X~*07^jQInI0mG*_1?jcfpiLxY2){EI0-tS z_?$!2J6aBy3x$i8Mg%cdmikRM%jyF5Ooh)Y$Ic)ha+NaPfB+POIvX; zHc$LLU#)6qg@w5^^uT9sS+w|{bW>8Bcw zuZ}+N7<`U|tST3bN)Og5lEeZvT^-=`d^HRmcS$xSJ0OXSc;kC3W)j zH@_2!Y(Grlt|M*;jG@t`b}^k%s1~7KhZRsXYEzhLsd9A6^m(eZ6e4rrA7Z1NZ@{T4 zYj-dDl!Z5wn#1kKsS*@f0vdNOq)6Zzae)L|u}*J1B#~aOnA~L9xspzx*E^QmC#b0G zUT7Tjb)vU-%Qj(`SK>9AJF>Sk7=2k3UH5lZ6iv)|wGQ}X>8bFK!arI5aJt@P64S2r z8N6{fW}TgAAn+|e)ht@iIUFB z;>vc0THHN;1m$^ltT`mjhcJx$433!TaVwGt8Y%mzu1 z<#IsWfb>KM3GWl0$qH=bCU)Vw_sA;9=pe3;neAyl4Ux?Tp^=NtHf_mEs1+U>s+m)H z6ni|%m-q2Mv~Q%;gx8t?eMr5OGzk?(URGU)h;H!=&9UFy`idaWh3>Yg>bpb_Lh$11Py^kqxJJDoPVs~bd_yc z{}k{No-zS)ewoqhZ~tlhyj~4~#*uF+DO{Ze$$4kxTe?~H)_mxQfs{Hm3Tt{bD+-Qt z#>9$fT*VuEpo0cOzA!^kDG|!XL`=h?s>yuH3G{#1&Wfc*CuXffNJ-`CG<1!*vfJxW zC3JOpLPOP9RuCN{xTcxG_Quq}%%4g7A6EH)DP`f@2WofbGc2%YW6DRkR{Qc#oI)D9 z;(gSc36o;H?p(Dh{sP!TYA%?a62WB44h=~6+3=1yF?d_=s-JAZa$}_aGp4AZ&Q=izt4SEIPq)0Nw-Xz0A{yibG=kHbm)+v2INjwI7^k)N2N|$ z0Z$%uzV=y3o|z{xxP#4n#`ZrfVXuJwKpq*94 zX1pG~iJjB=jli!e#~l^81Rs1Stv%uHb;{Tb4y=h7sb)e^3$^* zPLj1P_Ejs?{1RMzt%ZqVfw)3)EmoGR-)hQhrjrROy8@J{9Lf5cMBRoqtQh2}4u4_I zy!G%cMLLM7(q#^XB%g#iBK`QtVy~&z(v2dX&0DhRDr0oy6A6;OecO@SZ!L1`*jsA# z-_9C>O#{6(WVhv!5j_M~EnQXEz!o1An2(vB&OPmcb?W6bbJCz#4<3S|VLflmx^(!6 zGQLPc_~~J^@Cei|B5wnROXqFCNR3=Ic^vIBe=C?!=*&GLk&~BZfTV5AMtGy;!#HEBi&y^+;>$weB`*WNX)6jP;0uAV?I! zb5M;}J70ZWYB3qQHdtz=maR?lFNO(S9ytY@-;42TlZgK}J`6V3h_F_#xL1Evm3A_} zH@X(a1G_LQ(>$v8wRYn@oyJ1V*D-1Y^E5Hw5~3v*HtdPtiBlt_MiJw@f8=^KDN3@;p2=pr5+$?t+v7$+~L5A3}KBX6=tubE9)oig?kwd z+#d{JQ~Dw0YP-}TLEfD>xB|oW!|cA-p~iKO?j>b`PKehS9Xxxe4^x9U*vNH>&m*lZ z(=nn(tuj%2wp3=aQVY_IcEQHd;oIieFk9ARt7=v6IWeR3bY(I-P%gD3?*H@{Kc8*a zV0U_IaYN=B?zZHNW4sWhV^Pf^9bG!Vq^%cXS~E#0Sk)av76#5f)|cOF#CP(2Sxt1& zg6Zl^*&PNAlQ#vhr%>t9t=D?dQEed%aZ!o6De$)+yivCGr|BF>lmCSwkfp=)4r)C= ziJE&@wjxKKDQ-KF|9ES3-m8h~$jx>tvpBHWS@?ob=EWhGif2q~uvsGs=GnnoVEUOL zd4I$|_3hY}8U7@?XAeBS$3Q2{tj1zGqR#P5@6||9Cf=e+5|_lei#?r>hYUvuJ_(Ow z`C=&#RqrC`d6v*wys#=bwH$h*Z7>e_V=QMpaVB2IDI2bF0`e!kQTs4LaB31ZTC_{z zP-tJ7DiMm_q=~H=kbZ~h$uP4%tu$O~S-R#{F^GST&KU^2S97LzKP)~qaH@YJegZjK zu|Fu6b!^nB(XRf9778i0#$B^;n$uXPWTMaxmK<&j;asUHZRaV)T`8?7vlP2+^fA^d zk?Gz~#BZY|L`j{A#`lJfJ}X0i5}g$!D+-U{T{_8Hmr&^U)WNq(Lxg;O9cCgh+sju? zfL~$_<4a~Jc94Vl4nLvWlq1;a(O=S(khrL2JPv=m>31nfy1d~#&fmbMEYFsJa9|9x z2MDnq-GrM~B$LeUD-eBto4Rd268r^}3+c}0<)<&00_c+YFX|wqdRrB2Ceu8{49!ol zv&Q_vF+dKFmUGRZ@@f{LApK)DT-!Vew>10j_2Ue6Wq3ox4zL?~MefD>;z{hVCNu;u3rF%J5<`!V50c2X@BWCagJ3(BUKUVA9b~I|R zU>~7cFEeS6^mQw*q$~FZX|q8hcpJym&x%13ub({(^*2)Mad-(wGV}wI6)bH<)N0WZ zCp#cplrt1{ZHEDxTb^{$kSN%DiPnA(wNA#YPk|#XKaBw!Y!kb}m&XZ-7czGrvv1@E zm~+W$&_$Y?J4VmQN2a>ucvwgwA?RBW*8I`@l&#bBd$&Pb?1hk}@{ORNvUz-VUiI?| z0h;j1pT?l8x=Qxw#;ST5Udbv57hVBM4L|ewSEpsM37*#3V0BYn(Z~#Mb+>Vy?C<6a zm>sD#t`Qur)^HS(LsCyi@Ss%#8)uPv@^Fl(vLE);u9lUSmlM+q+Mm-3{n)jB;0Se` z5J`JGu?luGZ&T;&F;kGZ_d=E3^A??M8&wvJNf&hA_3*Rh<;sZbJsadH`7f)7w0k*I z_3&UXDC&}W@BnS<$cFUeTs%aK3k#!lrwHUFos+!y)D4WYk38b}M3f+3<)jMg0-Zv! zb&NJiu9vtoxf?kmB1hKN{y3*n^>QM+X9u0w^?@3%1FDj!Kb}zLA8`W)b{QT z4~T*F>|GGI%;d&Joxg2==3-HQ0gX!C8*%J{Y&D3Yk;T%nq+aS9YwCjZ#n}Tunn>W3 zk!Pwk4dyX6Rp2PMfKXPVSKqCwxSSw!HRsx>LHaiDx{3M%;(_%~A(-xU{o#4ok#yyJ za1A$hbXaQuJFJ0l+P9;;GWrb?bNy|Qs8w**cklcM1-&>LPD|--kBT6?NT8TYx+ToNJT)B*oYJ1IshJt zah)lJ(?fY!D}@tCQUQbu%lyJNV`T~N5+!B;vz%*_qbpn8D-w6{?QOsxDL<%pkT=K6 z{?Xd80-5qe-Ong4SX_tiCSQjisXGwV{!#ptt@3XuIP2aTwR)S*F+LLmG{|!BdjC5R zigXps6{kOD9f00uqIk|lIemg|zBCzY&5fzakRggRQJe8g_hbc&d0D#9hUs$@@|6h4 z_D%R9?rQg8?F&_M(tFEnhZYr?%GQ)v3um~3v_cjlJF+yyeoLJxp@UDXFCf2outIN6 zc4D}Wp9a+QHmmJXZ>KL5)KC^9%Ba$zeX3jj2TCGGK|SQq*br}a7oFAaEaXfCpdQ#k zkMW883+S#Z6P4ewAz}7cyfx6?VtJ2!wGzPU7I7Qtvmmp&3$N1vbGoyhT$8jf8Cufi zNHnRN(lLHlh`@h&k&>!yHCthv0vBhfb@H}D;6%5SByKn@^R9#Sl7S6`AMjL-e^BjXiq11NGnT7;jE~z z^e>>DpKM+qdz+Z>7<&Nw$CRd~sgS*7U<0~{-$-9=?@*hom1QJsL0qo7qg(PIB+W{4 ze3QPM$p+6xz&4#l$+=P5F+C}ODxd+(W2qGK{rx!SS(07u4|aVDz5+!tXb{H}xIP~2 zKlaVE6J^7Fd3;aDNbigSSw|=Ibi^BB+i$r=w~c~Ta!lj{+-MAk1ZC>uFRGv9tKqdf z&l6#rAG>XT%5AODSGpz<+1l@V9$#$ukyoTg;~|!@ghSAtGrmfc+^EV zIZ|u7F0IX8$TnZLC*dJnR_0g&%m?Q-4;lnw0Ziu1d+ucMF0tp0HfJTZv4^O1IPNMh?+lUhvaC%;D|Ej-W2tt)E~x#qf~K& zBWk0=_iziogOVe-{uM;JSsZS{i`%e2LaU>x@8q0}RK2M^gcnUvO#SGv(B)53AA6o_ z(W)U0*9s?*YS&UC{siE&^Io=MNco7zi)7lhRIxuH>_16FZ`J(KLk#t9oX{=XKpXkj z9eubJjnjaunA(3L))`M#Z9;ACpW5L9sI*L#zFtAdl+6=CYFE-qvcM8X=yUuQ?KUUD zz`AWBJ0Uy;UToXCxFfh=pJab2v0(+|H8>y0C@qU_l>ZJ8)-36adeWV%X)l2whu46> z5#58+sMrBDhgRb(kzi>$E|#5}L%VR6NR$4UHJ8ZYCpk5kfy~tf&B}u!cSHNr{{q~C zza3lJ&!T=-M)>S`uUTx0DxHPVlcmPEXl8WR2s0GdO%CxGh8(GxXRt)3 zShey^`21F9_%y@Fx`Uw8^TRXls@K4-Uw(aVxg))%#VYA4*Qx$hp-|uea@8Z)5F%xD zLx?Ezhbr<{SGV>6OG5P9^CWKH(uKA+<~Zwpz)9>8U+INq!!K$3pV}c@!!P?3g0($J zmaOtWO{M#1C?M7QCFgzkj(Lpkvy)d^Y~!v4@(1(n<{qe~F)r+FH}2xeR5M1Ilw$=~ z*RA}M^GU!km?7Iay!PMM<$o5tZX)}LRudp)519JQDJMO8%A>65oLiFKT4(*bIlkgm z2~-zPa*PfdnCj?L=HgI)HKx@1kAwHd*a7q^S@Q-R#Hn&&8>jINrQ@P7H4xzO z*)_O1&BHV?#ovgYgqdrmPU7Bk7`l`ZnRI*%MP)cz^Wl~69N*NuiFz3{uZ~)0+pv}# z>5S3RLXAW8CWAZ%8Gf4VdGhpZ-P$G)knsf)c#e_->PujF$$OPIyo3$@6 zAtK^Tb zwyv;!x9K>U?GDmazF~2{;yT9@=$f@?2@;k?2^^o+cdlF0MMpK5Ql$-gPjclt^3yOmL+FT|(!3DRB};hg9SR z79xuROK7eGh^Q2+JOz2E?l_7aH&MO}2LfP%FQ+Q4g^fl{RhXZOd}AcLR+!xUDjq(S zT9~H&l)}6ws_EXil`vtUd(!TT*4w6xnXh5sC%dZBRNJ8URCPs5o5lMcoF!y|mJ@kE zCw}upGsmJCCo9(!%xG^tL13dxc2rkc$%q+)_X&@m_3>taG)Xu(e_)W)#J~R1nql~} z^{F>?2M#XkxCs$46Q)VRjeoIrt8w9_4cPA>BtFJ3CA3v$Z|11z(_g@k1vU#udl1vYjXUiZGEp2*r$h z%j|||V2Ydcjj2zJmq^c>kbGGdN3LCSO>0m39rv28&+MZ~HwUOE^x0u)UQI+nUINK( z`JMdvobNw9`zM)=KL14BDX>4IOB3c*`7c2IHzBykypR`~gp*bJUhM76hN_#ctR5~u zS}&JXeO?}bp3$rkXQ8nagDH<<-(IZn&{(vrieB^uQy2!?lx@e8O^g_v^2`uHAlJZN zLllgk8jXS|trfBcB}*M22@_O(tu)ZI_D@(4UjSjD#JrgP1=PwoL;Oi=8~k0}iPd;D zi9X?>D{MRZhI4U8b8IaXQoRZbPz71?{RM>9if_hOOGKOB8|t{RDz)(H7}=wd@xUD) zJu~XK;SXo;u$t9YWu>wAN9S0DZCLZRGF4d^V}aj+?^T7G1w#4BgJRV@Vbw1hgA|H8 za?|W~NXonUaBH5?O=*-Is9e4$At#YSreQhyXt|xhL#)BqZyRW6iW+G;e$c3a8W@JOYC3#7L5uoX@D^j3_B)p^QMU9j4(jACqU& zb`3|WJ%_Sbj!-&QJOf%{)Lrq@F7qUiz|%>u7M#KhN(ubK+gp!`E&gIpCAT@K80Df2 zp}ncSN(i@S4q2jh}+JS=fYdZE@ptq*?)}HUZU&K`B_dCXl}_m z@&!d#LKOD`%}2`NVj-~$WUew#t@r(Hz1)8PlNHC)XtSG+Pb(nq;~50=JmOs}gSEVW zB~P&(G{DxcB2=A;$;ij&$vBB3W4vj7aK)v-ZdOBWRR-NdNOPyW`sDo z|CjEfnz(|&tDR4Xk!wnb0;CG%OEFN1#g@j%Llttx_(a`t@2`}ngMK+y@ugB5#|CT| zj^yIFI1mqs(nVYOcJd*QY%T@q`qSs1AWEIpFUJ!r2UNe5^w?JVIav0Kk!^5OPmm5R z$(vixxi^Cp-Ojsi*uKnkT(#d=i%KHMMt@|m7j1oDz<}Nu^k!%Wrq_v?XM578`oI@9 zIoYj{8u@33cRzh)JUa-2ag*@Wq=O*D$FsCpEU$FJ(dmV7(%fO)c>M*KPKmXUZ8dZ< zBdO|ZlLCE=XfY9HFW9r?SEw^gMqQ<=T8?fzS_a`f0*XKP8f<@;O2n*LzPRG~4F5;m z`iJg;aoLOy%H5;$&~z`B>-j*d?2RvTv@%zjl@m_$>nQ)_^iQ2`7Izt6KHh*Layke& zt-GQMrw=;+5Gw!cxc9p-&%0OMe4A0y)Di57ypse%_1iXbzIWc`2LO(YB7$tXXY>dvIH{EC;U{blY&k#`MQf~n5^K@ zYO79ijzWeMDaS+2Ee~q>nhf2O5la4wdEEMK8qUX$&U| z#&}g%!pKJ*n!<>K6LYq4W$7FXNr(bIp6>Gv=;)%D=6R*z?6OKeT7_Ja>Z)?KkUFp1 zS-5M@L;g*xdmVQpy>B_1%h(givSs3T!|)E6>xV|-=GiMAHPz#mj#IJ8n-fpWov9B< z9?+j6T;81olA5|8BKj`@vBxq8-Y2>S1_1^WsQPgGe#`70d=~*xlDkU;c}BZ6F0_~0 z8{6W;RZU1HYQY2(E!eT!4oLY0_)0zKeCbq&rP~UU=?&Rn+I(8A54C*xFeq=!w@Q?A zDt0cXO4;NP)<_;QRIfrV}_Ol&h8zws7qzOY7o)Q!8hu4-)qYbAT2VIgF>6 z46FKZBvR@72w5v7HghqY#lEPO2OI$3BvD?4r?vJR$iKw%5>&9Qh{22vCi;hM%U9#7$L0a7j-plYaFVcuydmens5hXj#{TItvfC4=}ukf;J3yYiewbl zF$;#m!{QqYVR(jlW`#uyVZd8^`N*)P4X@Z2U7L)q)vc2;xP|Cu^njAPK4qDp59oB| z3En9f1_k)b$ib6EOd>#nk|3q@I!JwK{zQwo)3oDfUO~TZKc+x$duU06yS|kLeMDgb zrf~J7OxY5vJWO*{0K*qyF50^~C73GH8E+>$ZTz!}sT1{t2oeb$HW;e# z8=UL4S7oVKFe3TUyW9dBP3l;(bt)IS5c!4d8%G^C=}L2zkNrMGtEe1&K7{P zq^pciV~BK19U_I0JjZ^T9vXL=y-U5o(!MUFjpXP?WI6A>QD$H!Sh3TqkMY9C5qm4}%$?}!C!CO{+zf?HmNv)}~ zn>$u;Q`!<;OG9XvZjI+qjk=~(9s+o}&Ioou_NV1Z3w@fF#6)L*AX7i-{inBsBf3Ci z`&kRiygC*YX(p6(L86(SY8P2U@3Qk?@ptUb< zv_pL!Q{jsG2#supF}og5W-@|$G5kEb8CPMa`XgLPjVaBfkU%$`jq7r<00cOi%#sMFH}`PuEC2qBqwseW4Ige=ni3MSO*-uDs4%hrTo+8z4n?w-SE{DELk zkTK9Hwxa=QR`p9Wp`YGH#0X}of$Bx)S*waK{i8`l)ercXP<+Q`bfSAWGpN~u>dz1_GV8cpVO0CYr-MxR8Tca1~YCmqRO9TQ**|L26D$gYA5itO=CyR4Y|@jra;!Cf)p6m%PQ(E?ddAR zb$ND?c-Ds)ayJ7)MS1!=S3CP+3N%+P?@o#vKNoBBcYWIuS7Kmw1Y>Yaijm%p2RyUs zf8VXNHtuQd!V2k5=)vf*?LGP37aF(j5w*0PE756fh>BUCsuTBeUzfz!rlOy*AH zLN+L5!YR_)wDv9>gAbFp$Lunb4#+MBACMCHL>{%XxED3M&s}2%zJ!c^g!CyVkkOPI zf%!g^$yIjzw6vcysr6&PowKXn4yGuMW#|ABq+CnpzzQ-CfZKjG^d@ zJ&Wd*j1!Ycz)N^U`)?-o%5S$#=iryR&pdO$G6qDj!|U|P$poRky2`zMW#Vx*Dbrit zz1|qBf!}3oTMut{vm=Sw8^haMoBpV^;W95z@JZaCYa|vI1ydFx=<*XIv{@822QD|yenQ(s*wH%bk10m! zZv7Z5umgKqW1(KgV;6?uP6sa~*cm~xB3Yn_tmLCm>{)p69?6Ciep7TifnS6e(X{cY zPQ6Rnkk;49=j=T?=jy?X30RV%6;SA@%-QYi z^tyK?B=SBiwCZpIL}5 zMYv*(tPia3eEe$V{b3V3T{CIm8J=V2g_9tb>ARf+{ACrc4BXoOYD~!HM6b-A3=^H@ zv}_>~0bEzJa89ZA#>Fy+O>)sS;cj%R(nsyWeSU~zt!4fPb1F*iG(q*bnzJYRp(k_! zTg8;S!Hn^PbzMV!X=B$IB?^2g=S7wJBahn0k@ z-|TA)A3POxu3QdRL-e=2NGd1jl-CH2gX{|MmT$hSzV;AN{erH#HJqon8F%_w+Pgf< zjBS^r@rTqjI5l~aE7A)!dft5w0%WpQRC%H~RMsx_T$f*W{RQCc+zpqjM+@9^vk$A_ zZss-RL-Mn3The)kW@kw}D||%i1brKlE`8D~<>hR^xY3Ww{y=tIH{m(%B5RbPDd=90 zEa|sT4`|>IS9NTfc~1?vS?y?g-q#*RMbHh%+){x@Suay zN-sz3gAw~PlU*`PbR`m=Ccy_rq7;bLd;?i9Xn`tThP<_&yiA3Qh>0#Og-k9BROQ0Q zJl3XKohKfx7h|>IKs~_@@vw$4Hr7SkKOF&`=g9F7&Z)1kON0!3s7=w6<8708Z6S;) zR?Vd${-7R;2?6&i_N?PHCyp_Er_ztsmaf$tLWJ;3R0Vp@ zaX58Ft1HM^BTJ%-CgLTfcct>eTrqbE9A?rH!Zm+cLA`B_I-lN4Z8s{?Y=yg6aDQ>^ zX9L+S-|zf$T79|aj1r0_0lCFq3;vFKuM23rHznk%i5hCEecdeR3;QCM6m|B zd!kftmZo(t62zVZ`#9$mkrohFej&H4BuQFj93{<8Y9#Bx^6C76J~RI2d(d{5Dh3Vn zL`JvN3cidKv*)&So0kD^H+{)V#t+uM@ho%`UB6p}hQa5$X>D@kjUraDrZRC3$@0X178NyCAmY@GxwL&$$v@>8zQmz-9Rj4hkR zff=k{lRe3U+tW&@jpTU;5LK&}Mb&l$D(q#HWHPUXKIZD}u@^;|B==*5=eb!*4r(cAYgza3x@e!#<}3r6Mae>bmgz(?O^5~JR_n{rvO z^>lTQ(GRn1_(a@^%PBc2)Op_I_c4x*AfUU5Y&N@?-N4-cHZ;&@OFjC>d2Uz|ZgBa1 z*fNG<(}+>wtS0x>fDtofN9UVdzX0V!8b2Ry@ho{D=2UOM3uy(XQG;{b6?KoNSJJ26 zXUI20>*7v!QsX@ZpBEYP&y7B+ie`O=mbeRZ7*?iRDucVhTz>(rjR#+)svJ*2^M zekeScQNNb4SM+?WLo zl334uP}hInx8o(}R}M9InWy#5IZ-&u6x<4M@Wg{WSfbN4qR)DTE>nn)p37xM)Irp) zd=y2vcguc1J!Z=4vHaZ}{jsdAT`9;x=d_7ApC=dnpHn{}I&DxL+Kfd^rAhTa#_oru zaieo|%d64?PjRJJkX|?=_tZl6OjIY*`fMBZ-7Dp|z=431W@-}YVv+7pKl~JR<$THPi<1id8eVOeO=@0wcDl;a;E8=Z91$yK-0vD zi?2$q8^WnNT0$WI5k-@LNfbqMRP_VspJ)JIg90+I2Nd;Ia(gX_QY8{Pg}mecX?#<( zWtdEn`FpX7-^X-V>*n2TyeaAV2Gq zD{xoT&f`13p<_<4d|=j=hp)lV@a!vNM3nKP)(zPIOLDDXW5j#N8YY2g6t>&vS4O`D zp=0h3rrNx{(k*1{qNucfW+C`Ob|uZ022X-aG1Kc#8zUI6j17CyZ(_NU<}Y&TCS!6R zEPp9%c12shQd5W!Cx|j?j^T!krU<9oTOK2;SzB&RIsSNH+>K4$WI4hhRf@#U=eHOO z$OE!4+x*mYR@#Pas&R=j3;CQ*jc3_@A5`7Q%W3dD+!`X-(B2b5uS44c*{?Tiai8E; z6myr$+TP^(3fesEh{g`etCAL&uVv+TEeq7cG1a!wdS)eH0#9Vi^vct2?T8+}^4Zec z)#yzLUFnk;MrJmRYghRC;*vL^1!)=uFway@b|>sEZ93T7*&E6#p=~413OIUR_5V4+ z^AHR|BEMc*F*JT3-Ux&DAvrDl*4G0J0XCECZ{(luk07Nq$}FB)r;vJFW@*ShAfb16 z^u3GZ)3T)NMyi@V&zR{Uy=PK0;F<&4B5*#oWz>Gz-z1)P?2XZT;m6J~9 zo(_3*;CPR_@Zfmc!De>Ra-^VfxNBXQ*=;S5Tz!L2iCKPw?{EyyIas$&32p-Zfi96f zPK7{^H;=cSZVl+&c-Uc|JwomTvR_ipF6vz1CzKTZ>puxYTTvgB(NmK3c50K!QT@hz zqB09EK67gYyb7RLMOa|&^x`Xb8c5K^eLFZ02yJwATp1`4%0^b$CkaH$6o-*fmD?VA<`_Iz@dtl zQ)hsnU*<1>ODcktW>k^RDlPRZ_Z53nmOLIv>Hb?Tz|)awgj8eUFoOt_GHSb|5m)`2 zQ_fl?&HJb(yANxK=}TXyCzD6%PF-7Gxrk0&NWbPPt)JHp@H+gOs$#bBFG-3HV6&+v z+30yl@}oFowdGjX{jiO+`T zxyFJ{>>jY6Bk8G7_1-AY(x17HH9ncC<8-OF)b4tGY^V4y;Jn6fJis^kD>HqL(Gjlr7kP|^uAzK|f$xB8djC3wb_W}R zCAhe?li9$>AzRnp&ZN(E?}LM)7dt=Frv{Ru&7b-rSBtjS8C(#GXDBiBP~({#^d<`0%nykh;KlgWu<$H zfZoz5PpX1s+;M!TjN?plS~li%%#FfK>RB| zNeF8Aow-^xPg)G4I7f9)i;NF}ixpt$8I{<&bsRUdjJnEudBXuvcbAizi|jbBBqT#cIULa0=%Q)QNo6qA1_}1@!e;GRoL^tl#k6l3%nu{1)MA)y^Ff zNg(Lpz`jEO=x>qm$spf>;)!KPM=n+kO6>UzW@%Z2LNv3|R?5!v>I6koypk~9h1uz- zhd*GqwRaeBye+2d9k)q7)H~vJxdjvo_#to`PA{7 zBdb8H1qOZ{*;}RDm0PWmd{7{4qU-!4vK#O5bO98YEf-KZ)Q@D4J44yX z{{Y`Gr#&PWM*WjSa`Q0fuXZ2uS=Vt3eGtw606eq#C6pWI*zuikYb|!mbkxF{;P%Mq z-Q}nrgf0PTyr z`mH@&buWlB>l!Cx``8@Ue#KT)+oqNg6!nxYji(?vuKkr6rsk4tzXUehU6qvYbwh-b zcr>wR`)7HN<3@ zD`(3e;s_6(KgJQVQCw}2j)6eiqa6Zu^)ZjU5MNav;!?>%j-ZTm3+BSe`2jC>shv8ZQ6Bm3oA!OvC7P0tL#i)K2d!>p%F-svvEdc%0c&zLP zcB^sWg&^h*s#z#n3JBxJl|K_h2FQLRJFfVw?xm83H7|pZd}eoD@uU1f0E`DI2PK5@ z{ve9ihjJOmjHUNPvTAKUF^JS^R-jG)wsJP zx-G{MypNef{iK&z8kTx9vXcg83i7Ho;;Ge;YH`Y?sq)HIr2zgD@>KP%#OK{sm9wd( zmdFxh#0{0To_7j{=ent+j7Z^?dr3?qb6nAsQddVy6x-!9W(b;|L&M(p&8=hT~ zQyc=^H0Q5n6FD*io=0RzE1g4HCa1x3Mh3Qr4aN?~Zlz$z)J_(wRTmb=?GI_Z+S(57 zkIjyUQ@`l6qv(*kb5Q;FSz9hXzof?d1N)WiZ@oFK179FIt{ndWn>_w@>Meg}AO8Rd z*gv&#KB`0Lo-BEue?_l-`QMNCL4ElD0C+!Cwq^Mlq4ZTs-e)Rp`Y@ts-=C;gPrv^F z^GE7{`}2CtKUFL>BD{SY+t@b&cm093H=A0H{veP0@7*r`AdCCuER`UGf~`#Ztww^> zEX|s0O<|;{doiuJAp3){RgdBrKfO!K#4up}rhhanDM;CUTU_d49q);0-1mUs8BV}J z_bRTVgz2ShkEXn`XEYZUybfQI&eQQlbPs|`SsCGIAT+V3QER%KXOh=(#qJw@jt6Ls zj;akDuzQt{Bx5-w&A9SU9BmabQrn`5q49|vI+BU1iG#}n7B$>a5c|XRLw6O%KJZ$j z9jcNuO62ZL*v~CHpnF73#+WfgzE+}UOAWCA|gWW;VPJ64DW3m&` zAx>%MJqi=4X7yJNC=V(Ss&yo&W|B^&S-haUpc1*%j_!u)Q{6oBfbyk;IP^o3pvBD| z0hs_Owe%tJjiGzAj$HJSf@OOj0wlfGhqgQ{8>>6CUcwQped$Q%BiA zm3}nGy6Al8y0&dReUyX|_CSSBXFb<(K02#`41JeOOw-9i8ObVUj!+3I`rRX+5G1O5 zlNu)&3f9~FpnyvtQCN3C2+Zb)3a%ml0Cjh=@!QKYRPS}{ck%oyy_b;P$MH`0R$}ZD z=&WmS7g#YMD1dCDLcBv!Y;cm4k40NkOX5!KChTCk5)lg;+JlqTOmVi&aGgM}j+#hZ zFcyN+?>j^HU4ouDo6$W@MWNYfSFBee%zB2R&1D@-a8iKHwpG=xZ0>O?5Je`85~DLq zIj){8N-oizYrHew*-2VNPAqu`Nh2&d+qhZDrFnCX35>XblfUM*Rqv&b!F?_agC;=c z?a5~916o}h+5>^eAo5S2B)c|d{HoRCjAO$>a)21n#}{N|kHfzt77sW1BRBwYvXl|E z^0BTu1D%aWqQfTSa~$O-MUM{;{XtAfD*IXc^};c+(}&TzN*9|sR$6HQatPRasJf>*NWG3n4tIz z?*Jk~M(0+4wsM23s$KoFzf}_u1rd<~6d)r}G3O({RTC_So1OZmd?v0K+Mx|c2g2IR zRLztZcoInF@5t$C{{SMbzLqP5(OT&lkYW$k2g#faJa*d^s+apsc^K z?M&n7lb(0{Sp&Lq%l_)`WUC_&u6BE;!_13g(RFI^9$GuCl?A*Q!=24%?Tn5#H1!Jh znz_a8Zy*;=FllfMnv6*gJ`WG3%C@+)H=4GpsAHfQJFK13ufuWkEf}A+aP@JPU*XYN zc9+0EW^i+rM+~vd>3n>b2KhAdC)GD|sPP|wdaC$ZGUpyZWmBk?$kCvSieA|e;2q^W zxh5kU4E5xN985AdQE&(5^hG{Q59`rjZ4@WRqRMxt%He_G(FM|3105bS1MLND;E+_+K!6VM!b?QwXLF~N4fm&Sl`>#|CItJYqY5xEs z)zB9O3?>X`vVmbrL3acf1k2ij=BPnu1P7*`)CYtDEc6Ga9uOWBAiK~Wn0P>XfggZ< zs8(|iu}DDQwF=5s<`m^+Q-_&!1vfD2T?{G&hzejS1{EFQe0;mupxY9W%HuGBXPZCwWMf#A*2Sk2TtctQDs zlWL)F-U!%fmDlF~00#d6W#hM!J}v(1*zYqkYF9OnS&m6|2MIK1 zff!sa9o6GFZfAYcj?NRA=aE)Cu=^LqKcW^_v{O5NiD3OTP9wT*rr!HJL>{WHC+d{A z^;&eTN?Z@M#d2t9Dxa(j?6!8gc5ZW0sOqb0E)eN%mWMliO?M^F&m|W~^qK~j%0Q)&q5e=mH6Z;%eracj z-=WcxNpF}qaz2RBfH>L4_o&qZrYe~OPB^$agb z`lf_(rH}Mn{Mo#7F2#q*1DNiV#f8|mXwGQP2{{Z|~tU7|3oT=IRD11CWb~c0T zsQtg_xAhmcd24O;j^$4O0MSfZtKG_({{W)&vevNRw0q%2<+$4jJygDiT1fq#a4eSx ze_%o*Y!?njFg@1o?!nt-#>~UB!dI!E(CbMLvl8AMuROpAjp3TZ^AHx-OAhTJcM;>v z;1K<(hxH&=@RhOl_Rk#pUdoALX=xnB=$vb17aQbqc$xsGV8`m6r+Zr?0CsabS9p$7 z^@K;f4gUZ%izJ-vFBDX2jELbFiQZy}-VvtjDJsyZcf1k;nd$~z>NtBMaG%TA4F)=@X8UHaNF)GV=k z&)#2Za66O~**pmvpROYdhWNm122@4Nz ztqrIeoz;3Rl+spHhP(nuQgd-uBF7slzP{3M;evrB;qyu~g)Sww#YFQX2*S<9b8K>e zM#xI=$$l80OLC)jz--u ztZE!H9xl>6>{QKU?ip@XHAIGrtH1TpG<7J2HjDN;vTKaYdQy|JNNP!E`p zp*7N2+w-b=?jwdr5gr1on(SocR^LfcO(c>swvjUw?Z;&ku;Iz%w@1Plf%!se7~{y%v(jt?b~h7#~FyFZSLYl4YmbCn^wNwl~tIVv+Aa;svdaNTxyx-o_7 zV~MC)Mx#f%9Il5OaC3Ilm!7Hb$<&vPhC!4W$!6JE^FnGnj(gB3{HTPI=^JF8+1VoE zaqf)gZ-aunBO~yer=P0hWVUF8IAI{egF@39Ccen;{uCC`lD@=}9g zBy5px0SHE*pP8jI6;T)j2ad%M%T9T>9)uxv+6`Z^dTDou8y_G1f_C{M4P8F2unqqJ zGOKE4YbvSyF^20*T_o{7735?Xun*=_Rl5@Sp?5>8b`Ve;?I#3b8X>6pU4n@C9)4zm z6y05ow$PxMDG56-rGRv41qTmrs7Hn`C~dMa+c++|AVyeHjg^_f%TKB>f9L8D2?zNO z;R(_=kxl|0-2B7$LVOH&%B8PlrYLlivKyJ5z)c!qj(Sh35ol?_AsZzMk%O>MaXH*4 zPM)ipSb1|o$v~;=YAJ{?&gS}MTT}5o%<|MRvJT^#s(g6dvp&gpcx2;}WhR7{IKItn zS86K1mHG+js~Sl1!|~xD9s2Y?o!m( zDtJR$z%mw^)pT>QzR7ZAlO{NAU6}i~3DjGOk&Pq-J4NbRDKtIA5WOn0qLz9$He6(d z!y=`Esc3j==Qrs{Di3L?YiNgf7eQT)?YfIIf)sU8BWVg41#IKOn zSl=AYA=qAzM_xVyL!Hrig(Yx_`2|@?#6~y^TJ6z_wpEl*jAV(GE_*S}W9F`OjnWEs z@o;@poL*HE4j;{F!;N;zrJikVz6PL-$ovz{Tfu61k63P1JTitn9IbVt>j#1u{1s+d zNCRS`ehJMljNy%!rpuok5{#MH*8aR>woZ>Ll0N~PD(T5{vR1D3ZEYm3 zX*`y0rH#(Y%(Xmxba|}V7g6Z1o$Pbm=Efrgk{S;s0gwhr0Q&y`-*q{n8QIy-?1l%F zjk3Jl<4nNixrUmh&w-3{iPAKI*eTnAbx7-|5rmNDI;$EG*yLod$OWebWu2thS1l%K zXdtyw)E3m!8k(#JdG}*_>^iSNqPNjk&>D!F5tADXlF#b1);jBZseUr9jF~8--arN% z-}6^Ct|zwE)*5)8%6GdZjC^_z>&TyV=VvL-R@vEcj3ZG%*=4G)rl{bS%2*xkFx~%&o=bvP@h!ijV=pqSHq&Ey62^)bdKjFV6oq^!l1fv%=E1BY2%U2 zA2VIPJwXZMmKRTgILY)$EZq6t``f? zV%&y%tJGAA-1aU&UMT7*W`d?ClE<(T!?9z%zs(H|mNpt2)0#O)Lz~c%*#-16MYLc9 z6r%biKV@<8S~A}=eHX%{4V=;nWYS32Wycxpgz9qRx#j4cG%HM#Dgo*o6v=_#Gg9uP zb4H=DTx*`whYYDn^b2dS{uMbnAG-O>X!%?{it9W#j2|kWff45H6r*-JW-JRWeyT5% zVzpH<{{Rf**9!@9E)@<3eb+(|jCwh9$tiY1Dc;fuSN6NHjEuQaK+t2|Ks?6tf{RLA zGAoZL^ho%i!%u+!0Nqkl-Y2-uKye_Insr0oH0tKAtn6$|*8XcWu_*Ftj!WRs+ieY( z50Us=OFgO=v^B2;uQ!t8J6u~6h+0k+x>YuIi5zj2o>$ppTpKF>9(kv8n)T&8QA0I7 zOT0jE4>j$rbE+U~wQYry;+rg229~k8ayaEorrjP-4O7|!V;L#>SZZnyoun;Avx6N> z<1De{4@C3n7#*TGut%bKN+prpWn`hKjhSOfRkKt}6Nr=%?!9uyWsae^nm&EP&hftp zwm0~&w*%2ET5QXxPWWe^xt|u&afMwqE2Ae)>ej8|mNOf6Atym2=bOWGbE#^KoK>SL zky;#cf>Ttr60z83N^0q4mY9dNrw&fpXqdtsDE(7UQ5eH=$sLHwFBa5T-|p>_LdLgsoqP28oz*{ABr;|~ zMpZRUK#}?yw&IG~lu_mNc&3|_i&`m}DZL(>4;0aoz1mbz^QmddkTcCrSl7j6G)-(gCV1L4xc+=Ds7qNr@U9cJ7 zqULHbuSYg5r(oh_Oc`+*>5iy|rGq*n$>>i+&AQE7b*N-CG_IM)e^1qKEdKyR5=!wk z+PFjFO1jV|V?wj;hHPp{-$|}g-Ts%gDfy;jU zm#o@23x_RbrVDc=kbU`%v-_z1Awf+~!4+k(vNFfUW709^)IaLE`7p(|Bx%K{mk}_x zT9;pLFx#o$fCt*Va%fu%ZGw{D6B`Uozyou+KC3IhG||sRS6L)_r13GUt^ixQQ?4d~ zwg;4~336)7D&Yo-D8?|{5RKtBLQXfv>QNoRb8tq)j;Q_<8gk#1?xQHNe+oCVNon`& zhu{VR9N#JAdM5PmsfTgRz1MKb0n$Jxp-R$YDKutoJUdBKBWfdsy4&}0vHt*1bnT|g zZK;LO!&Oxbj08yma0F+cO~|;8|`Xe)kj7|=U=~&zxf#oAVqO+o_ioS{}xKEN+hYa%` ziWeH_ZIlw#&6hSYvqv``fP1c<H>Z%#VuTBHtLF5 z00tm*xu?3Lx>NBT0W}P|In=}N_@rajoC4ZDcqRV=u{(Yvcqq|wG ze#E3Da|e=U7~R@Nmj3`%qOtKkL^0`>^c;Ge7jOBk6~gMvm8tB4ww1DDJ}cPMfQO$A z(@io<7NQQgYyF;V;o-OzKk_KCT;Cbe;#P*yXqvKOd`bx$)al&*O2VUsE%nn$6i~wx z*??aW>+R83=7W5q$)}CgnU>r&w_pnR%^Sx4L;EEz6tG+GF1Eu`=StIz$lL;ZWPhS< zwyLMf*o4&O&g-mh7l9Ywlt0F$An82U-X5*ucjQwrCR)oWEG%%wR!Z+iTRx_Y%wU69r)sVU`aiPBMnv@NrdIGNk-w-%ZP)KY_-Y_QSCBV-3j z*=ntK86$)@I92CXxG%u@WPuW=DDL7S+Q|(lX9MI&5euZS$4K*a!A=f ziCareqhBDaDfpeT)aAz`D+P1AInFqK$aFUm%)50SCqRtjbbAzhK}$4Yn{JH=q>`Ye$EGlHvwOQErg9jNxVIxQAhvBzS|0T-Xa3 z?Bpg;c4w7QgS%5^wn5V>+lFnCJ>l;IWmX?8bxC%UxmJvxTWmRCIa4I0metvXBT-dt zrK*ohh}l%nWrik~GC%-Xnw}!K7m&c^2yV9t#+T|DOZxdMlUAQ5TrS|tM@!(%p{~l+ zS#JLT4Gsxdc*Ej;x18l%P}IcW1D*n^T4_Jxj;?>mN?6oaEbkT8d{HhNth6vxNC|66 z!q`+&(#|qu2lGg}wu;zshLx)Z2}U%^XRdCx@Mgp{vPt2&jsaLhW$@eLxbB~S5zxvo z$iOLYtUO2LA1c?fmj*nUo=5T+rG(6UFx(#NMQO8`9weCR9;%v>wib{;8CUd`;y?za zRMSXkG*)qiJ7_y3aYb2gb)fLn=*H=jT6FVO zI=tCM9%0RPasEZcRSz9ZlA)O@bslJc5Id+goV@c!HrHv+QoqU3ROaRZ)90C5D;Ez* zT4@~iYMQfCpkszw$lLQu;n#hD>Q-s?`sU|VB!PORg0>1;%PrCPWgL_(p_rafJ0P^4 zz>$Jhe44kDgvuOgS!YW2SYQxSz*^DsIQ-8&$xl;pWMRNL+E1#yth4xyI-?E*b8hP& zc;UA+x$txBu{R_XqRo{T64Sk)ID$Kax~lp`nU^jJsdX#Ej1n?ex2~Mv{{U6y)6`Z_ zOk1hVBcivYx`}A!rKxd06A_KXo>?FJBAuYt)|wysIRolRU#oL7hBN3E&L1a1j_b^L z7Vq_C&GZ!j7;0UhZLVPXsBeC zSluR*fYywc9?51G!0k;ZxgFDT%E_Z^jx>@9%C3AaJ1AZA(Vn^2Pc%T&nIXu@Zzm5z zxnQcgNeLB^>S!bad94)maJ$X`0~_I0)(69-(O@~JnAi}hoLY9x5R_Wlkz?XD@sbYX zm?=t$;|wAAEFo9b*E9^q>^Kd^R(9idIB?bbtCO|JiX56dO~RU*I`|wM@c{8+V_my} z`=j&zt2M-PaaGaTrF2nI1LddA9uKMNkf*&mj)~Jm)-ld`Y?TlFniXW%$!2q2E>C#s zMg|YEN0%*ais2h^W5*f!A7!Nls`-s@hU*;KW)g4xLetRESIJI(I-kQh+{XQ1vh(;W zq>8PTRMmsWjE4>Z0LHdIVzOq0pDsWA8mE!Zh_(L5>R_@x;1|xy zhU5pagbK^HGta7J~TN5njHS*wx8(ZZRe-%df<*I{e99lJo{!1@uyHgPp zYjHIB+iYQNt7(3-qh!#wpguwK05%?~vWJ7j6-|}`JYltTWR(r8jN{n zf}+tE5^&yu7-X#)qI0=|yvm}AcqDvoYnv=zI|#vVxb5r7di4!NRP?NC9@CSg^uhHB zJ|W@Jbfyx=rW=GHx(Tt&{uAA&mKOaa6yno4xpPY#t#o-Qc?U~@AJDEkFz=M((3Ndn zLks9Bu8_y!!BFEIk^ca5D}HACc2%#WZ~@S}AvEIQEv(rItdZP>+{X@?P#|Y*iZOfI zbiKI3S3lz`zZX&X%9~g>BK@?jAKHHC(c&}w#hUoKkHlBs6;OWh zLtx%SYuj=W51;o-PjY0Z&g`tujWOm*n|w!eDkxAlqfG_oo}6q3SJLqeFZqBWXFLLW zuKX@~spD5*+>6nAqR#P!8E+5~_Hlrzg%ex8RKufY*iEpT#~*cb_QDJ5<~y;(AsJ%> zk^|-6WN9F7Y&)x~7(beSRIIg9%6#r6aF;oJ*hx~-Cf3fz>?WhAaO#BGXLJde=-lp# zw=|1micDq-r*~IY+V?f%B~mh&u{ioj68x4IL1SZ3~+||wmz3$6#vj@jCXT)I39Noj) z+$)Pe9=l6fPjYsj?rMjKKVD&V5&_@V69;g$rq_SY@e*VCg<*H@NTYs4rX*XSle}Wx2AJW4WiRX<#SNo=ZI2 zUlCX;Su5z~`!kkJ0oLEtEP9MGZ*)$sn?5|4{8>NKJ+_j1dbobdK_DA;bA7`3?Q}%6 z9JKQVW9%GbLtI36CbpWWbCCHpA5~*_;~PyD8Ys)ezv0l z#GlnYG#BcSL{>VGdTT8TG(0zblB7Q2Z;kPTv~PI8{W++h%hQZkEMMW``jVBhG)&p^ zF>pUFb^t2oP(uYol2bwANEw#3{JlchUt$o^K*zQ?oY8>BYyeqr7sG#+L6C9~+fIn5 zYREwwB!#kwvct54lbS*xb29BvG0>5aN6dZEjZ{t~NX;SMZEPFmF6mnX^pmNFcDMv+ zR@f@LaC1boj{$^aXPZ|cr=Lb7m(3u+a}Gw`!Z(a#E-V4faKTDF&4@M#WhPx(#(99I z(5W$C`j$`drKQ?kkl=7ax*SVWMA)Nr@1C46mo%J~dla+SB%DdGb~bh}fl~upN+Wwb z&Nwb^@LMN44mq`Ptw?X^)XmRBXqJuFv28FUoyYfNp_)|0cF)fu-+ zCP@sDRJpBlbD-`QnZbByEQ+7St9u5J>}hJVrIMm~nr1k6Na6*=enA*$r6*=t=Ymvi z=;3W;!^CM3Kp(By=Ht@}&h2uev{62)Qs>BaiZF8N9nb)&ZC2aN%?1ijhiCV-M;P{K z{{S?_T~&*Q<@n0_p>nzbh75zJ&<;%tql*-AM8i2tEVwh*i)-xPN3l~@hPJx4sMHpI z5^_lW)-95{H(+ED(5rj(;!Me%flszdaJtTMuQ^j%c%$Ej-a! zzD_!U?dYIs9y%xA5~qr5(6Z`3!oRZNrg-R%u>~*G}(Np3`c3*f>JA5ms?Sq~X z#UlX56>m_z7RN~alnthN=#L!}ozY#knS+=`Y)xs{D&C>Ki({lqvZ^~?u87UI26R^p zh!CSBYM(TjrC@|aBBx;3gkcj~(G{^Aql#xgkVBR_+Js#mc?88J3#EA3Skl`I$jDce zw&p_6aEcaE`Y38B{1~?io$SNP)m?xLAS}$AxUSZP{7bPbK)}N3*?rY_PD1EUqUXW{ z_a)v_FN~$$%r0g~rpy^6>{?UgI7pL{tYnW+Ay>%K*AP-cq|7;!e1dUN&g-Q`7b`PR zRvZz!Ww&~|ObBOi^d~7DSV3_lp-GEv8mcZhxW(mrgMjFN>aOWH`W?J#HUr(BQ~NJD z%8-zbXlzTOZobc6rQ?fKgcrH(J)foj0RF*V(eZ_$*xH5PZA?>?8b_fWyT1IR0A4eyRAl+VH`TiqE-9)stm( z&qLyyYp!mO;OZE{z(Fo)Iax}s7`cY*>RC@mZZMLI=>qc4?OIbz`bfLCnPK-y;)UH7 zESVCd#Z9L54$h=(zO8Xw_zSsi*4Z+w8}ylV9NQUF{{Y1MsO20Dl3y0O^-TflT5?m3`aR*wL#pS*hC(^v%?lA#cc=|N5pt4e{suge`ISde zSo)XaQ6t?wMm-@`>Gsc9Y~M##PmsE`?d6hP{{Tce{*%GSyEQ>5^j$$z z*8#6&(_a(D&Ii#_)0Z8SLBw=fWsMsnkTb&<=7G+C-mqp(ffN zb7BsNc0zO@r=1=`UP#I+ESrTN3o*$H;n+_k%cFKz1ZOF!pl(2gGdn1{nlaHj7(nEN z_L5SkD;>2$egg}!ghx{`plpg6za(8b<`HsaNdt+I4U0lKYz-L=2y#S7%TTi5a8grY z+?Sx?vAO#-9q`8H><}Wx5m@{?1uIX`RFDV6(Ch$<;bFT3cf<}H6vH(RN>e4FFxND$ zJ+5}?r$@S%gOSNKFm6KeXBaE&V5V6K?4|JMvYQFKMeTNW2=PQ*H%vAha|xIr)OjY_ zBbXTJ+;&D3CCbVu8V2a>V*-g$H#Swa-K6dlkWjP%l*^h5_+%!r0>uksEp}5aJ^ug_gtVbKq!nu=z2lbnOTLxkn@YAh6EjZ>5ML%80qme+Az5jZI5Z7+ zByv*FrJ+kAgCHK|F)19{7j&<*Yf~Mkl%X52_3_~0-dbPPfx>kFIME?NHmGAc{FcH|mLRTg-f;pEw^Grm*-O7k) zZ$;b^mdDx=(sty!$L^pbcSJ_SN!cr7MF(NX+nOs0Cj=Et8~( zJv8VGcW&shQ|V?v!i$_iR7txu#VP>i?~pKicV7(b0n_MF4i6+Z~F=e4^}C5k|}HA;n51(Z(|; z2&RBaG6EzqWj7W>fJ)VL8@|K^z0Byo_y>H->n+oQH&Flt6qsnPhMmMrmuE)!HQ^!xkZOZU zD@xgtR5aNpvnp7^;5c0;A!45;5=o+Zf#>?KgY-Mlpprq^bHpvic`WipBTkGxx`6jW zG3j?KwS3BrKFFRZCp`+HQS>+V23kfxcI;4o4X0w&WfNNCkI@{_f_jH6l8ZwonL#B4 zWbYVDOKA_?fDc8eGvh$+c*2M9jQl$Mt_rVx#`QOIR%+i%;<616m? zj`EIO3bALAOVhy08+@bg6%$7G{nE6p1;+)yvSF~X&BK}zdWkN<`q6zeBq?2=l&O3( zf#kJ62@bA75tJ}*siOz>LF!5RzuA-cW7%`z9ocK$YlZzc?zqczVCi`L(EXBrsgn3t zc3k*V*=*ftiM zIvF#tD)7>^y%gCP8(~M0g<(ZgE$`|P*=^4?Xx6C)?vu#J@kFl{@ZM@-nT`9q_f{e@ z{eay~lumi%hW5j;Ar?ix!97h#=a6uornTdD?3kJHQ#VUFrl2`jLUjN{%{^6n+zImx zdW3oEd`E7VBVQtsjDbDcPTTsf2?1SmTn^z67(9~D)^Ow%(4yDsUDdj{sOi`!gSzY7 zq6#Sj`50re7Y+&-b^_+KC_9Pe7B=Li!QC|h$qGIIosPp011Rkc1uEy31=iGTs%f&z zp{KYLvWuO`173Ggd(KcuHWo>Aj3@_fl)SGbh0!MZ+E>v9nj%j}v0YJ^3NW})oRJ)q5dC5)6?DI*< zv0XhgqgED2I7Dee&QV#q)0LKF2oB4dmvOR**<@^>@1gvP?wxG)P%bE#ILK7VhO7?l zI7DGQx*7Ij`l=cTS4W`Zn@{Y4H9KS&Jo*(sA3GHv7aJ&mBKkttWCb4to{7gvl^tW4 zO;!aagkJ$0;dU_Zl#P>)aCb$)q;x}Q+sH)M1Eli)h^}LS!-A7s(mhey_C7owVIzRb zU}AA$!?$nrMSN{=%Qr)L8BuJSPc(dB@*g>Y-d6&Zc}W~(2?CEo7F^2MzLdJ1a8A%y&2{640@%Cp)QY j*(v%G66azvzCIhd4b&YL=Y7JQZfkZUD7e=|QnUZrG&^(K diff --git a/web/templates/upscale.json b/web/templates/upscale.json deleted file mode 100644 index 5d568b1c5..000000000 --- a/web/templates/upscale.json +++ /dev/null @@ -1,652 +0,0 @@ -{ - "last_node_id": 16, - "last_link_id": 23, - "nodes": [ - { - "id": 8, - "type": "VAEDecode", - "pos": [ - 1235.7215957031258, - 577.1878720703122 - ], - "size": { - "0": 210, - "1": 46 - }, - "flags": {}, - "order": 5, - "mode": 0, - "inputs": [ - { - "name": "samples", - "type": "LATENT", - "link": 7 - }, - { - "name": "vae", - "type": "VAE", - "link": 21 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 9 - ], - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "VAEDecode" - } - }, - { - "id": 10, - "type": "LatentUpscale", - "pos": [ - 1238, - 170 - ], - "size": { - "0": 315, - "1": 130 - }, - "flags": {}, - "order": 6, - "mode": 0, - "inputs": [ - { - "name": "samples", - "type": "LATENT", - "link": 10 - } - ], - "outputs": [ - { - "name": "LATENT", - "type": "LATENT", - "links": [ - 14 - ] - } - ], - "properties": { - "Node name for S&R": "LatentUpscale" - }, - "widgets_values": [ - "nearest-exact", - 1152, - 1152, - "disabled" - ] - }, - { - "id": 13, - "type": "VAEDecode", - "pos": [ - 1961, - 125 - ], - "size": { - "0": 210, - "1": 46 - }, - "flags": {}, - "order": 9, - "mode": 0, - "inputs": [ - { - "name": "samples", - "type": "LATENT", - "link": 15 - }, - { - "name": "vae", - "type": "VAE", - "link": 22 - } - ], - "outputs": [ - { - "name": "IMAGE", - "type": "IMAGE", - "links": [ - 17 - ], - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "VAEDecode" - } - }, - { - "id": 6, - "type": "CLIPTextEncode", - "pos": [ - 374, - 171 - ], - "size": { - "0": 422.84503173828125, - "1": 164.31304931640625 - }, - "flags": {}, - "order": 2, - "mode": 0, - "inputs": [ - { - "name": "clip", - "type": "CLIP", - "link": 19 - } - ], - "outputs": [ - { - "name": "CONDITIONING", - "type": "CONDITIONING", - "links": [ - 4, - 12 - ], - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "CLIPTextEncode" - }, - "widgets_values": [ - "masterpiece HDR victorian portrait painting of woman, blonde hair, mountain nature, blue sky\n" - ] - }, - { - "id": 7, - "type": "CLIPTextEncode", - "pos": [ - 377, - 381 - ], - "size": { - "0": 425.27801513671875, - "1": 180.6060791015625 - }, - "flags": {}, - "order": 3, - "mode": 0, - "inputs": [ - { - "name": "clip", - "type": "CLIP", - "link": 20 - } - ], - "outputs": [ - { - "name": "CONDITIONING", - "type": "CONDITIONING", - "links": [ - 6, - 13 - ], - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "CLIPTextEncode" - }, - "widgets_values": [ - "bad hands, text, watermark\n" - ] - }, - { - "id": 5, - "type": "EmptyLatentImage", - "pos": [ - 435, - 600 - ], - "size": { - "0": 315, - "1": 106 - }, - "flags": {}, - "order": 0, - "mode": 0, - "outputs": [ - { - "name": "LATENT", - "type": "LATENT", - "links": [ - 2 - ], - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "EmptyLatentImage" - }, - "widgets_values": [ - 768, - 768, - 1 - ] - }, - { - "id": 11, - "type": "KSampler", - "pos": [ - 1585, - 114 - ], - "size": { - "0": 315, - "1": 262 - }, - "flags": {}, - "order": 8, - "mode": 0, - "inputs": [ - { - "name": "model", - "type": "MODEL", - "link": 23, - "slot_index": 0 - }, - { - "name": "positive", - "type": "CONDITIONING", - "link": 12, - "slot_index": 1 - }, - { - "name": "negative", - "type": "CONDITIONING", - "link": 13, - "slot_index": 2 - }, - { - "name": "latent_image", - "type": "LATENT", - "link": 14, - "slot_index": 3 - } - ], - "outputs": [ - { - "name": "LATENT", - "type": "LATENT", - "links": [ - 15 - ], - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "KSampler" - }, - "widgets_values": [ - 469771404043268, - "randomize", - 14, - 8, - "dpmpp_2m", - "simple", - 0.5 - ] - }, - { - "id": 12, - "type": "SaveImage", - "pos": [ - 2203, - 123 - ], - "size": { - "0": 407.53717041015625, - "1": 468.13226318359375 - }, - "flags": {}, - "order": 10, - "mode": 0, - "inputs": [ - { - "name": "images", - "type": "IMAGE", - "link": 17 - } - ], - "properties": {}, - "widgets_values": [ - "ComfyUI" - ] - }, - { - "id": 3, - "type": "KSampler", - "pos": [ - 845, - 172 - ], - "size": { - "0": 315, - "1": 262 - }, - "flags": {}, - "order": 4, - "mode": 0, - "inputs": [ - { - "name": "model", - "type": "MODEL", - "link": 18 - }, - { - "name": "positive", - "type": "CONDITIONING", - "link": 4 - }, - { - "name": "negative", - "type": "CONDITIONING", - "link": 6 - }, - { - "name": "latent_image", - "type": "LATENT", - "link": 2 - } - ], - "outputs": [ - { - "name": "LATENT", - "type": "LATENT", - "links": [ - 7, - 10 - ], - "slot_index": 0 - } - ], - "properties": { - "Node name for S&R": "KSampler" - }, - "widgets_values": [ - 89848141647836, - "randomize", - 12, - 8, - "dpmpp_sde", - "normal", - 1 - ] - }, - { - "id": 16, - "type": "CheckpointLoaderSimple", - "pos": [ - 24, - 315 - ], - "size": { - "0": 315, - "1": 98 - }, - "flags": {}, - "order": 1, - "mode": 0, - "outputs": [ - { - "name": "MODEL", - "type": "MODEL", - "links": [ - 18, - 23 - ], - "slot_index": 0 - }, - { - "name": "CLIP", - "type": "CLIP", - "links": [ - 19, - 20 - ], - "slot_index": 1 - }, - { - "name": "VAE", - "type": "VAE", - "links": [ - 21, - 22 - ], - "slot_index": 2 - } - ], - "properties": { - "Node name for S&R": "CheckpointLoaderSimple" - }, - "widgets_values": [ - "v2-1_768-ema-pruned.safetensors" - ] - }, - { - "id": 9, - "type": "SaveImage", - "pos": [ - 1495.7215957031258, - 576.1878720703122 - ], - "size": [ - 232.9403301043692, - 282.4336258387117 - ], - "flags": {}, - "order": 7, - "mode": 0, - "inputs": [ - { - "name": "images", - "type": "IMAGE", - "link": 9 - } - ], - "properties": {}, - "widgets_values": [ - "ComfyUI" - ] - } - ], - "links": [ - [ - 2, - 5, - 0, - 3, - 3, - "LATENT" - ], - [ - 4, - 6, - 0, - 3, - 1, - "CONDITIONING" - ], - [ - 6, - 7, - 0, - 3, - 2, - "CONDITIONING" - ], - [ - 7, - 3, - 0, - 8, - 0, - "LATENT" - ], - [ - 9, - 8, - 0, - 9, - 0, - "IMAGE" - ], - [ - 10, - 3, - 0, - 10, - 0, - "LATENT" - ], - [ - 12, - 6, - 0, - 11, - 1, - "CONDITIONING" - ], - [ - 13, - 7, - 0, - 11, - 2, - "CONDITIONING" - ], - [ - 14, - 10, - 0, - 11, - 3, - "LATENT" - ], - [ - 15, - 11, - 0, - 13, - 0, - "LATENT" - ], - [ - 17, - 13, - 0, - 12, - 0, - "IMAGE" - ], - [ - 18, - 16, - 0, - 3, - 0, - "MODEL" - ], - [ - 19, - 16, - 1, - 6, - 0, - "CLIP" - ], - [ - 20, - 16, - 1, - 7, - 0, - "CLIP" - ], - [ - 21, - 16, - 2, - 8, - 1, - "VAE" - ], - [ - 22, - 16, - 2, - 13, - 1, - "VAE" - ], - [ - 23, - 16, - 0, - 11, - 0, - "MODEL" - ] - ], - "groups": [ - { - "title": "Txt2Img", - "bounding": [ - -1, - 30, - 1211, - 708 - ], - "color": "#a1309b" - }, - { - "title": "Save Intermediate Image", - "bounding": [ - 1225, - 500, - 516, - 196 - ], - "color": "#3f789e" - }, - { - "title": "Hires Fix", - "bounding": [ - 1224, - 29, - 710, - 464 - ], - "color": "#b58b2a" - }, - { - "title": "Save Final Image", - "bounding": [ - 1949, - 31, - 483, - 199 - ], - "color": "#3f789e" - } - ], - "config": {}, - "extra": {}, - "version": 0.4, - "models": [ - { - "name": "v2-1_768-ema-pruned.safetensors", - "url": "https://huggingface.co/stabilityai/stable-diffusion-2-1/resolve/main/v2-1_768-ema-pruned.safetensors?download=true", - "directory": "checkpoints" - } - ] - } diff --git a/web/user.css b/web/user.css deleted file mode 100644 index 8b1af3868..000000000 --- a/web/user.css +++ /dev/null @@ -1 +0,0 @@ -/* Put custom styles here */ \ No newline at end of file From 6752a826f66c4dcb0e0a06f6773f4604dd880355 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 2 Mar 2025 15:43:56 -0500 Subject: [PATCH 162/478] Make the missing frontend package error more obvious. --- app/frontend_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/frontend_management.py b/app/frontend_management.py index 003c97527..3ebcc4c4d 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -21,7 +21,7 @@ try: import comfyui_frontend_package except ImportError as e: # TODO: Remove the check after roll out of 0.3.16 - logging.error("comfyui-frontend-package is not installed. Please install the updated requirements.txt file by running: pip install -r requirements.txt") + logging.error("\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. Please install the updated requirements.txt file by running:\npip install -r requirements.txt\n\nThis error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead.\n********** ERROR **********\n") raise e From d6e5d487ad66f85ca32fbe1928fc5e288c0e95e6 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" <128333288+ltdrdata@users.noreply.github.com> Date: Mon, 3 Mar 2025 18:40:23 +0900 Subject: [PATCH 163/478] improved: better frontend package installation guide (#7047) * improved: better installation guide - change `pip` to `{sys.executable} -m pip` modified: To prevent the guide message from being obscured by a complex error message, apply `exit` instead of `raise`. * ruff fix --- app/frontend_management.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/frontend_management.py b/app/frontend_management.py index 3ebcc4c4d..20345faf1 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -3,6 +3,7 @@ import argparse import logging import os import re +import sys import tempfile import zipfile import importlib @@ -19,10 +20,10 @@ from comfy.cli_args import DEFAULT_VERSION_STRING try: import comfyui_frontend_package -except ImportError as e: +except ImportError: # TODO: Remove the check after roll out of 0.3.16 - logging.error("\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. Please install the updated requirements.txt file by running:\npip install -r requirements.txt\n\nThis error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead.\n********** ERROR **********\n") - raise e + logging.error(f"\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. Please install the updated requirements.txt file by running:\n{sys.executable} -m pip install -r requirements.txt\n\nThis error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead.\n********** ERROR **********\n") + exit(-1) REQUEST_TIMEOUT = 10 # seconds From f86c724ef29e7d13e9bcc7c894288f5ac03679da Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 3 Mar 2025 06:50:31 -0500 Subject: [PATCH 164/478] Temporal area composition. New ConditioningSetAreaPercentageVideo node. --- comfy/samplers.py | 54 +++++++++++++++++++++---------- comfy_extras/nodes_video_model.py | 27 ++++++++++++++++ 2 files changed, 64 insertions(+), 17 deletions(-) diff --git a/comfy/samplers.py b/comfy/samplers.py index 076c98791..7578ac1ef 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -19,6 +19,12 @@ import comfy.hooks import scipy.stats import numpy + +def add_area_dims(area, num_dims): + while (len(area) // 2) < num_dims: + area = [2147483648] + area[:len(area) // 2] + [0] + area[len(area) // 2:] + return area + def get_area_and_mult(conds, x_in, timestep_in): dims = tuple(x_in.shape[2:]) area = None @@ -34,8 +40,9 @@ def get_area_and_mult(conds, x_in, timestep_in): return None if 'area' in conds: area = list(conds['area']) - while (len(area) // 2) < len(dims): - area = [2147483648] + area[:len(area) // 2] + [0] + area[len(area) // 2:] + area = add_area_dims(area, len(dims)) + if (len(area) // 2) > len(dims): + area = area[:len(dims)] + area[len(area) // 2:(len(area) // 2) + len(dims)] if 'strength' in conds: strength = conds['strength'] @@ -53,7 +60,7 @@ def get_area_and_mult(conds, x_in, timestep_in): if "mask_strength" in conds: mask_strength = conds["mask_strength"] mask = conds['mask'] - assert(mask.shape[1:] == x_in.shape[2:]) + assert (mask.shape[1:] == x_in.shape[2:]) mask = mask[:input_x.shape[0]] if area is not None: @@ -67,16 +74,17 @@ def get_area_and_mult(conds, x_in, timestep_in): mult = mask * strength if 'mask' not in conds and area is not None: - rr = 8 + fuzz = 8 for i in range(len(dims)): + rr = min(fuzz, mult.shape[2 + i] // 4) if area[len(dims) + i] != 0: for t in range(rr): m = mult.narrow(i + 2, t, 1) - m *= ((1.0/rr) * (t + 1)) + m *= ((1.0 / rr) * (t + 1)) if (area[i] + area[len(dims) + i]) < x_in.shape[i + 2]: for t in range(rr): m = mult.narrow(i + 2, area[i] - 1 - t, 1) - m *= ((1.0/rr) * (t + 1)) + m *= ((1.0 / rr) * (t + 1)) conditioning = {} model_conds = conds["model_conds"] @@ -551,25 +559,37 @@ def resolve_areas_and_cond_masks(conditions, h, w, device): logging.warning("WARNING: The comfy.samplers.resolve_areas_and_cond_masks function is deprecated please use the resolve_areas_and_cond_masks_multidim one instead.") return resolve_areas_and_cond_masks_multidim(conditions, [h, w], device) -def create_cond_with_same_area_if_none(conds, c): #TODO: handle dim != 2 +def create_cond_with_same_area_if_none(conds, c): if 'area' not in c: return + def area_inside(a, area_cmp): + a = add_area_dims(a, len(area_cmp) // 2) + area_cmp = add_area_dims(area_cmp, len(a) // 2) + + a_l = len(a) // 2 + area_cmp_l = len(area_cmp) // 2 + for i in range(min(a_l, area_cmp_l)): + if a[a_l + i] < area_cmp[area_cmp_l + i]: + return False + for i in range(min(a_l, area_cmp_l)): + if (a[i] + a[a_l + i]) > (area_cmp[i] + area_cmp[area_cmp_l + i]): + return False + return True + c_area = c['area'] smallest = None for x in conds: if 'area' in x: a = x['area'] - if c_area[2] >= a[2] and c_area[3] >= a[3]: - if a[0] + a[2] >= c_area[0] + c_area[2]: - if a[1] + a[3] >= c_area[1] + c_area[3]: - if smallest is None: - smallest = x - elif 'area' not in smallest: - smallest = x - else: - if smallest['area'][0] * smallest['area'][1] > a[0] * a[1]: - smallest = x + if area_inside(c_area, a): + if smallest is None: + smallest = x + elif 'area' not in smallest: + smallest = x + else: + if math.prod(smallest['area'][:len(smallest['area']) // 2]) > math.prod(a[:len(a) // 2]): + smallest = x else: if smallest is None: smallest = x diff --git a/comfy_extras/nodes_video_model.py b/comfy_extras/nodes_video_model.py index e7a7ec181..0f760aa26 100644 --- a/comfy_extras/nodes_video_model.py +++ b/comfy_extras/nodes_video_model.py @@ -4,6 +4,7 @@ import comfy.utils import comfy.sd import folder_paths import comfy_extras.nodes_model_merging +import node_helpers class ImageOnlyCheckpointLoader: @@ -121,12 +122,38 @@ class ImageOnlyCheckpointSave(comfy_extras.nodes_model_merging.CheckpointSave): comfy_extras.nodes_model_merging.save_checkpoint(model, clip_vision=clip_vision, vae=vae, filename_prefix=filename_prefix, output_dir=self.output_dir, prompt=prompt, extra_pnginfo=extra_pnginfo) return {} + +class ConditioningSetAreaPercentageVideo: + @classmethod + def INPUT_TYPES(s): + return {"required": {"conditioning": ("CONDITIONING", ), + "width": ("FLOAT", {"default": 1.0, "min": 0, "max": 1.0, "step": 0.01}), + "height": ("FLOAT", {"default": 1.0, "min": 0, "max": 1.0, "step": 0.01}), + "temporal": ("FLOAT", {"default": 1.0, "min": 0, "max": 1.0, "step": 0.01}), + "x": ("FLOAT", {"default": 0, "min": 0, "max": 1.0, "step": 0.01}), + "y": ("FLOAT", {"default": 0, "min": 0, "max": 1.0, "step": 0.01}), + "z": ("FLOAT", {"default": 0, "min": 0, "max": 1.0, "step": 0.01}), + "strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}), + }} + RETURN_TYPES = ("CONDITIONING",) + FUNCTION = "append" + + CATEGORY = "conditioning" + + def append(self, conditioning, width, height, temporal, x, y, z, strength): + c = node_helpers.conditioning_set_values(conditioning, {"area": ("percentage", temporal, height, width, z, y, x), + "strength": strength, + "set_area_to_bounds": False}) + return (c, ) + + NODE_CLASS_MAPPINGS = { "ImageOnlyCheckpointLoader": ImageOnlyCheckpointLoader, "SVD_img2vid_Conditioning": SVD_img2vid_Conditioning, "VideoLinearCFGGuidance": VideoLinearCFGGuidance, "VideoTriangleCFGGuidance": VideoTriangleCFGGuidance, "ImageOnlyCheckpointSave": ImageOnlyCheckpointSave, + "ConditioningSetAreaPercentageVideo": ConditioningSetAreaPercentageVideo, } NODE_DISPLAY_NAME_MAPPINGS = { From 8362199ee7d384bd1af113b53a19a3cbdd5ba97b Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 3 Mar 2025 19:18:37 -0500 Subject: [PATCH 165/478] Bump ComfyUI version to v0.3.19 --- .github/workflows/stable-release.yml | 2 +- .github/workflows/windows_release_dependencies.yml | 2 +- .github/workflows/windows_release_package.yml | 2 +- comfyui_version.py | 2 +- pyproject.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.yml index 9de458b1e..f7d30a9a4 100644 --- a/.github/workflows/stable-release.yml +++ b/.github/workflows/stable-release.yml @@ -22,7 +22,7 @@ on: description: 'Python patch version' required: true type: string - default: "8" + default: "9" jobs: diff --git a/.github/workflows/windows_release_dependencies.yml b/.github/workflows/windows_release_dependencies.yml index afbbb7afe..7a8ec5782 100644 --- a/.github/workflows/windows_release_dependencies.yml +++ b/.github/workflows/windows_release_dependencies.yml @@ -29,7 +29,7 @@ on: description: 'python patch version' required: true type: string - default: "8" + default: "9" # push: # branches: # - master diff --git a/.github/workflows/windows_release_package.yml b/.github/workflows/windows_release_package.yml index b68400177..416544f71 100644 --- a/.github/workflows/windows_release_package.yml +++ b/.github/workflows/windows_release_package.yml @@ -19,7 +19,7 @@ on: description: 'python patch version' required: true type: string - default: "8" + default: "9" # push: # branches: # - master diff --git a/comfyui_version.py b/comfyui_version.py index 9d69edfc1..5ded466ad 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.18" +__version__ = "0.3.19" diff --git a/pyproject.toml b/pyproject.toml index be52c6028..444a1efc1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.18" +version = "0.3.19" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 7c7c70c4004bca5633c4c8adc8bfc21d76b062de Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 4 Mar 2025 00:15:45 -0500 Subject: [PATCH 166/478] Refactor skyreels i2v code. --- comfy/model_base.py | 25 ++++++++++++++++--------- comfy/supported_models.py | 12 +++++++++++- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index 66cd0ded1..cddc4663e 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -185,6 +185,11 @@ class BaseModel(torch.nn.Module): if concat_latent_image.shape[1:] != noise.shape[1:]: concat_latent_image = utils.common_upscale(concat_latent_image, noise.shape[-1], noise.shape[-2], "bilinear", "center") + if noise.ndim == 5: + if concat_latent_image.shape[-3] < noise.shape[-3]: + concat_latent_image = torch.nn.functional.pad(concat_latent_image, (0, 0, 0, 0, 0, noise.shape[-3] - concat_latent_image.shape[-3]), "constant", 0) + else: + concat_latent_image = concat_latent_image[:, :, :noise.shape[-3]] concat_latent_image = utils.resize_to_batch_size(concat_latent_image, noise.shape[0]) @@ -213,6 +218,11 @@ class BaseModel(torch.nn.Module): cond_concat.append(self.blank_inpaint_image_like(noise)) elif ck == "mask_inverted": cond_concat.append(torch.zeros_like(noise)[:, :1]) + if ck == "concat_image": + if concat_latent_image is not None: + cond_concat.append(concat_latent_image.to(device)) + else: + cond_concat.append(torch.zeros_like(noise)) data = torch.cat(cond_concat, dim=1) return data return None @@ -872,20 +882,17 @@ class HunyuanVideo(BaseModel): if cross_attn is not None: out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) - image = kwargs.get("concat_latent_image", None) - noise = kwargs.get("noise", None) - - if image is not None: - padding_shape = (noise.shape[0], 16, noise.shape[2] - 1, noise.shape[3], noise.shape[4]) - latent_padding = torch.zeros(padding_shape, device=noise.device, dtype=noise.dtype) - image_latents = torch.cat([image.to(noise), latent_padding], dim=2) - out['c_concat'] = comfy.conds.CONDNoiseShape(self.process_latent_in(image_latents)) - guidance = kwargs.get("guidance", 6.0) if guidance is not None: out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor([guidance])) return out +class HunyuanVideoSkyreelsI2V(HunyuanVideo): + def __init__(self, model_config, model_type=ModelType.FLOW, device=None): + super().__init__(model_config, model_type, device=device) + self.concat_keys = ("concat_image",) + + class CosmosVideo(BaseModel): def __init__(self, model_config, model_type=ModelType.EDM, image_to_video=False, device=None): super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.cosmos.model.GeneralDIT) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index a8212c1fa..26340900b 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -826,6 +826,16 @@ class HunyuanVideo(supported_models_base.BASE): hunyuan_detect = comfy.text_encoders.hunyuan_video.llama_detect(state_dict, "{}llama.transformer.".format(pref)) return supported_models_base.ClipTarget(comfy.text_encoders.hunyuan_video.HunyuanVideoTokenizer, comfy.text_encoders.hunyuan_video.hunyuan_video_clip(**hunyuan_detect)) +class HunyuanVideoSkyreelsI2V(HunyuanVideo): + unet_config = { + "image_model": "hunyuan_video", + "in_channels": 32, + } + + def get_model(self, state_dict, prefix="", device=None): + out = model_base.HunyuanVideoSkyreelsI2V(self, device=device) + return out + class CosmosT2V(supported_models_base.BASE): unet_config = { "image_model": "cosmos", @@ -939,6 +949,6 @@ class WAN21_I2V(WAN21_T2V): out = model_base.WAN21(self, image_to_video=True, device=device) return out -models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V] +models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V] models += [SVD_img2vid] From 65042f7d395e92d9cc10dc66b94f63f5e40a697d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 4 Mar 2025 09:26:05 -0500 Subject: [PATCH 167/478] Make it easier to set a custom template for hunyuan video. --- comfy/sd.py | 4 ++-- comfy/sd1_clip.py | 4 ++-- comfy/sdxl_clip.py | 2 +- comfy/text_encoders/flux.py | 2 +- comfy/text_encoders/hunyuan_video.py | 7 +++++-- comfy/text_encoders/hydit.py | 2 +- comfy/text_encoders/sd3_clip.py | 2 +- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/comfy/sd.py b/comfy/sd.py index 21913cf3e..b866c66c4 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -134,8 +134,8 @@ class CLIP: def clip_layer(self, layer_idx): self.layer_idx = layer_idx - def tokenize(self, text, return_word_ids=False): - return self.tokenizer.tokenize_with_weights(text, return_word_ids) + def tokenize(self, text, return_word_ids=False, **kwargs): + return self.tokenizer.tokenize_with_weights(text, return_word_ids, **kwargs) def add_hooks_to_dict(self, pooled_dict: dict[str]): if self.apply_hooks_to_conds: diff --git a/comfy/sd1_clip.py b/comfy/sd1_clip.py index d2457731d..692ae0518 100644 --- a/comfy/sd1_clip.py +++ b/comfy/sd1_clip.py @@ -482,7 +482,7 @@ class SDTokenizer: return (embed, leftover) - def tokenize_with_weights(self, text:str, return_word_ids=False): + def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): ''' Takes a prompt and converts it to a list of (token, weight, word id) elements. Tokens can both be integer tokens and pre computed CLIP tensors. @@ -596,7 +596,7 @@ class SD1Tokenizer: tokenizer = tokenizer_data.get("{}_tokenizer_class".format(self.clip), tokenizer) setattr(self, self.clip, tokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data)) - def tokenize_with_weights(self, text:str, return_word_ids=False): + def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} out[self.clip_name] = getattr(self, self.clip).tokenize_with_weights(text, return_word_ids) return out diff --git a/comfy/sdxl_clip.py b/comfy/sdxl_clip.py index 4d0a4e8e7..5b7c8a412 100644 --- a/comfy/sdxl_clip.py +++ b/comfy/sdxl_clip.py @@ -26,7 +26,7 @@ class SDXLTokenizer: self.clip_l = clip_l_tokenizer_class(embedding_directory=embedding_directory) self.clip_g = SDXLClipGTokenizer(embedding_directory=embedding_directory) - def tokenize_with_weights(self, text:str, return_word_ids=False): + def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} out["g"] = self.clip_g.tokenize_with_weights(text, return_word_ids) out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids) diff --git a/comfy/text_encoders/flux.py b/comfy/text_encoders/flux.py index b945b1aaa..a12995ec0 100644 --- a/comfy/text_encoders/flux.py +++ b/comfy/text_encoders/flux.py @@ -18,7 +18,7 @@ class FluxTokenizer: self.clip_l = clip_l_tokenizer_class(embedding_directory=embedding_directory) self.t5xxl = T5XXLTokenizer(embedding_directory=embedding_directory) - def tokenize_with_weights(self, text:str, return_word_ids=False): + def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids) out["t5xxl"] = self.t5xxl.tokenize_with_weights(text, return_word_ids) diff --git a/comfy/text_encoders/hunyuan_video.py b/comfy/text_encoders/hunyuan_video.py index 7149d6878..bdee0b3df 100644 --- a/comfy/text_encoders/hunyuan_video.py +++ b/comfy/text_encoders/hunyuan_video.py @@ -41,11 +41,14 @@ class HunyuanVideoTokenizer: self.llama_template = """<|start_header_id|>system<|end_header_id|>\n\nDescribe the video by detailing the following aspects: 1. The main content and theme of the video.2. The color, shape, size, texture, quantity, text, and spatial relationships of the objects.3. Actions, events, behaviors temporal relationships, physical movement changes of the objects.4. background environment, light, style and atmosphere.5. camera angles, movements, and transitions used in the video:<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n""" # 95 tokens self.llama = LLAMA3Tokenizer(embedding_directory=embedding_directory, min_length=1) - def tokenize_with_weights(self, text:str, return_word_ids=False): + def tokenize_with_weights(self, text:str, return_word_ids=False, llama_template=None, **kwargs): out = {} out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids) - llama_text = "{}{}".format(self.llama_template, text) + if llama_template is None: + llama_text = "{}{}".format(self.llama_template, text) + else: + llama_text = "{}{}".format(llama_template, text) out["llama"] = self.llama.tokenize_with_weights(llama_text, return_word_ids) return out diff --git a/comfy/text_encoders/hydit.py b/comfy/text_encoders/hydit.py index 7cb790f45..7da3e9fc5 100644 --- a/comfy/text_encoders/hydit.py +++ b/comfy/text_encoders/hydit.py @@ -37,7 +37,7 @@ class HyditTokenizer: self.hydit_clip = HyditBertTokenizer(embedding_directory=embedding_directory) self.mt5xl = MT5XLTokenizer(tokenizer_data={"spiece_model": mt5_tokenizer_data}, embedding_directory=embedding_directory) - def tokenize_with_weights(self, text:str, return_word_ids=False): + def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} out["hydit_clip"] = self.hydit_clip.tokenize_with_weights(text, return_word_ids) out["mt5xl"] = self.mt5xl.tokenize_with_weights(text, return_word_ids) diff --git a/comfy/text_encoders/sd3_clip.py b/comfy/text_encoders/sd3_clip.py index 00d7e31ad..3ad2ed93a 100644 --- a/comfy/text_encoders/sd3_clip.py +++ b/comfy/text_encoders/sd3_clip.py @@ -43,7 +43,7 @@ class SD3Tokenizer: self.clip_g = sdxl_clip.SDXLClipGTokenizer(embedding_directory=embedding_directory) self.t5xxl = T5XXLTokenizer(embedding_directory=embedding_directory) - def tokenize_with_weights(self, text:str, return_word_ids=False): + def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} out["g"] = self.clip_g.tokenize_with_weights(text, return_word_ids) out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids) From 2b140654c7ee9cd5e70800e75b0481dd08ef3b49 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" <128333288+ltdrdata@users.noreply.github.com> Date: Wed, 5 Mar 2025 13:29:34 +0900 Subject: [PATCH 168/478] suggest absolute full path to the `requirements.txt` instead of just `requirements.txt` (#7079) For users of the portable version, there are occasional instances where commands are misinterpreted. --- app/frontend_management.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/frontend_management.py b/app/frontend_management.py index 20345faf1..9ab1334db 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -22,7 +22,8 @@ try: import comfyui_frontend_package except ImportError: # TODO: Remove the check after roll out of 0.3.16 - logging.error(f"\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. Please install the updated requirements.txt file by running:\n{sys.executable} -m pip install -r requirements.txt\n\nThis error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead.\n********** ERROR **********\n") + req_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'requirements.txt')) + logging.error(f"\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. Please install the updated requirements.txt file by running:\n{sys.executable} -m pip install -r {req_path}\n\nThis error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead.\n********** ERROR **********\n") exit(-1) From 745b13649bd041271e495f42f9e28b6c1e71d676 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 4 Mar 2025 23:34:36 -0500 Subject: [PATCH 169/478] Add update instructions for the portable. --- app/frontend_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/frontend_management.py b/app/frontend_management.py index 9ab1334db..e4d589209 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -23,7 +23,7 @@ try: except ImportError: # TODO: Remove the check after roll out of 0.3.16 req_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'requirements.txt')) - logging.error(f"\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. Please install the updated requirements.txt file by running:\n{sys.executable} -m pip install -r {req_path}\n\nThis error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead.\n********** ERROR **********\n") + logging.error(f"\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. Please install the updated requirements.txt file by running:\n{sys.executable} -m pip install -r {req_path}\n\nThis error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead.\n\nIf you are on the portable package you can run: update\\update_comfyui.bat to solve this problem\n********** ERROR **********\n") exit(-1) From 93fedd92fe0eb67a09e29069b05adebb40678639 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 00:13:49 -0500 Subject: [PATCH 170/478] Support LTXV 0.9.5. Credits: Lightricks team. --- comfy/ldm/lightricks/model.py | 57 ++-- comfy/ldm/lightricks/symmetric_patchifier.py | 78 +++-- comfy/ldm/lightricks/vae/causal_conv3d.py | 3 +- .../vae/causal_video_autoencoder.py | 267 +++++++++++++--- comfy/ldm/lightricks/vae/conv_nd_factory.py | 8 + comfy/ldm/lightricks/vae/dual_conv3d.py | 26 +- comfy/model_base.py | 29 +- comfy/model_detection.py | 9 +- comfy/sd.py | 20 +- comfy/utils.py | 12 +- comfy_extras/nodes_lt.py | 293 +++++++++++++++++- 11 files changed, 661 insertions(+), 141 deletions(-) diff --git a/comfy/ldm/lightricks/model.py b/comfy/ldm/lightricks/model.py index 2a02acd65..6e8e06181 100644 --- a/comfy/ldm/lightricks/model.py +++ b/comfy/ldm/lightricks/model.py @@ -7,7 +7,7 @@ from einops import rearrange import math from typing import Dict, Optional, Tuple -from .symmetric_patchifier import SymmetricPatchifier +from .symmetric_patchifier import SymmetricPatchifier, latent_to_pixel_coords def get_timestep_embedding( @@ -377,12 +377,16 @@ class LTXVModel(torch.nn.Module): positional_embedding_theta=10000.0, positional_embedding_max_pos=[20, 2048, 2048], + causal_temporal_positioning=False, + vae_scale_factors=(8, 32, 32), dtype=None, device=None, operations=None, **kwargs): super().__init__() self.generator = None + self.vae_scale_factors = vae_scale_factors self.dtype = dtype self.out_channels = in_channels self.inner_dim = num_attention_heads * attention_head_dim + self.causal_temporal_positioning = causal_temporal_positioning self.patchify_proj = operations.Linear(in_channels, self.inner_dim, bias=True, dtype=dtype, device=device) @@ -416,42 +420,23 @@ class LTXVModel(torch.nn.Module): self.patchifier = SymmetricPatchifier(1) - def forward(self, x, timestep, context, attention_mask, frame_rate=25, guiding_latent=None, guiding_latent_noise_scale=0, transformer_options={}, **kwargs): + def forward(self, x, timestep, context, attention_mask, frame_rate=25, transformer_options={}, keyframe_idxs=None, **kwargs): patches_replace = transformer_options.get("patches_replace", {}) - indices_grid = self.patchifier.get_grid( - orig_num_frames=x.shape[2], - orig_height=x.shape[3], - orig_width=x.shape[4], - batch_size=x.shape[0], - scale_grid=((1 / frame_rate) * 8, 32, 32), - device=x.device, - ) - - if guiding_latent is not None: - ts = torch.ones([x.shape[0], 1, x.shape[2], x.shape[3], x.shape[4]], device=x.device, dtype=x.dtype) - input_ts = timestep.view([timestep.shape[0]] + [1] * (x.ndim - 1)) - ts *= input_ts - ts[:, :, 0] = guiding_latent_noise_scale * (input_ts[:, :, 0] ** 2) - timestep = self.patchifier.patchify(ts) - input_x = x.clone() - x[:, :, 0] = guiding_latent[:, :, 0] - if guiding_latent_noise_scale > 0: - if self.generator is None: - self.generator = torch.Generator(device=x.device).manual_seed(42) - elif self.generator.device != x.device: - self.generator = torch.Generator(device=x.device).set_state(self.generator.get_state()) - - noise_shape = [guiding_latent.shape[0], guiding_latent.shape[1], 1, guiding_latent.shape[3], guiding_latent.shape[4]] - scale = guiding_latent_noise_scale * (input_ts ** 2) - guiding_noise = scale * torch.randn(size=noise_shape, device=x.device, generator=self.generator) - - x[:, :, 0] = guiding_noise[:, :, 0] + x[:, :, 0] * (1.0 - scale[:, :, 0]) - - orig_shape = list(x.shape) - x = self.patchifier.patchify(x) + x, latent_coords = self.patchifier.patchify(x) + pixel_coords = latent_to_pixel_coords( + latent_coords=latent_coords, + scale_factors=self.vae_scale_factors, + causal_fix=self.causal_temporal_positioning, + ) + + if keyframe_idxs is not None: + pixel_coords[:, :, -keyframe_idxs.shape[2]:] = keyframe_idxs + + fractional_coords = pixel_coords.to(torch.float32) + fractional_coords[:, 0] = fractional_coords[:, 0] * (1.0 / frame_rate) x = self.patchify_proj(x) timestep = timestep * 1000.0 @@ -459,7 +444,7 @@ class LTXVModel(torch.nn.Module): if attention_mask is not None and not torch.is_floating_point(attention_mask): attention_mask = (attention_mask - 1).to(x.dtype).reshape((attention_mask.shape[0], 1, -1, attention_mask.shape[-1])) * torch.finfo(x.dtype).max - pe = precompute_freqs_cis(indices_grid, dim=self.inner_dim, out_dtype=x.dtype) + pe = precompute_freqs_cis(fractional_coords, dim=self.inner_dim, out_dtype=x.dtype) batch_size = x.shape[0] timestep, embedded_timestep = self.adaln_single( @@ -519,8 +504,4 @@ class LTXVModel(torch.nn.Module): out_channels=orig_shape[1] // math.prod(self.patchifier.patch_size), ) - if guiding_latent is not None: - x[:, :, 0] = (input_x[:, :, 0] - guiding_latent[:, :, 0]) / input_ts[:, :, 0] - - # print("res", x) return x diff --git a/comfy/ldm/lightricks/symmetric_patchifier.py b/comfy/ldm/lightricks/symmetric_patchifier.py index c58dfb20b..4b9972b9f 100644 --- a/comfy/ldm/lightricks/symmetric_patchifier.py +++ b/comfy/ldm/lightricks/symmetric_patchifier.py @@ -6,16 +6,29 @@ from einops import rearrange from torch import Tensor -def append_dims(x: torch.Tensor, target_dims: int) -> torch.Tensor: - """Appends dimensions to the end of a tensor until it has target_dims dimensions.""" - dims_to_append = target_dims - x.ndim - if dims_to_append < 0: - raise ValueError( - f"input has {x.ndim} dims but target_dims is {target_dims}, which is less" - ) - elif dims_to_append == 0: - return x - return x[(...,) + (None,) * dims_to_append] +def latent_to_pixel_coords( + latent_coords: Tensor, scale_factors: Tuple[int, int, int], causal_fix: bool = False +) -> Tensor: + """ + Converts latent coordinates to pixel coordinates by scaling them according to the VAE's + configuration. + Args: + latent_coords (Tensor): A tensor of shape [batch_size, 3, num_latents] + containing the latent corner coordinates of each token. + scale_factors (Tuple[int, int, int]): The scale factors of the VAE's latent space. + causal_fix (bool): Whether to take into account the different temporal scale + of the first frame. Default = False for backwards compatibility. + Returns: + Tensor: A tensor of pixel coordinates corresponding to the input latent coordinates. + """ + pixel_coords = ( + latent_coords + * torch.tensor(scale_factors, device=latent_coords.device)[None, :, None] + ) + if causal_fix: + # Fix temporal scale for first frame to 1 due to causality + pixel_coords[:, 0] = (pixel_coords[:, 0] + 1 - scale_factors[0]).clamp(min=0) + return pixel_coords class Patchifier(ABC): @@ -44,29 +57,26 @@ class Patchifier(ABC): def patch_size(self): return self._patch_size - def get_grid( - self, orig_num_frames, orig_height, orig_width, batch_size, scale_grid, device + def get_latent_coords( + self, latent_num_frames, latent_height, latent_width, batch_size, device ): - f = orig_num_frames // self._patch_size[0] - h = orig_height // self._patch_size[1] - w = orig_width // self._patch_size[2] - grid_h = torch.arange(h, dtype=torch.float32, device=device) - grid_w = torch.arange(w, dtype=torch.float32, device=device) - grid_f = torch.arange(f, dtype=torch.float32, device=device) - grid = torch.meshgrid(grid_f, grid_h, grid_w, indexing='ij') - grid = torch.stack(grid, dim=0) - grid = grid.unsqueeze(0).repeat(batch_size, 1, 1, 1, 1) - - if scale_grid is not None: - for i in range(3): - if isinstance(scale_grid[i], Tensor): - scale = append_dims(scale_grid[i], grid.ndim - 1) - else: - scale = scale_grid[i] - grid[:, i, ...] = grid[:, i, ...] * scale * self._patch_size[i] - - grid = rearrange(grid, "b c f h w -> b c (f h w)", b=batch_size) - return grid + """ + Return a tensor of shape [batch_size, 3, num_patches] containing the + top-left corner latent coordinates of each latent patch. + The tensor is repeated for each batch element. + """ + latent_sample_coords = torch.meshgrid( + torch.arange(0, latent_num_frames, self._patch_size[0], device=device), + torch.arange(0, latent_height, self._patch_size[1], device=device), + torch.arange(0, latent_width, self._patch_size[2], device=device), + indexing="ij", + ) + latent_sample_coords = torch.stack(latent_sample_coords, dim=0) + latent_coords = latent_sample_coords.unsqueeze(0).repeat(batch_size, 1, 1, 1, 1) + latent_coords = rearrange( + latent_coords, "b c f h w -> b c (f h w)", b=batch_size + ) + return latent_coords class SymmetricPatchifier(Patchifier): @@ -74,6 +84,8 @@ class SymmetricPatchifier(Patchifier): self, latents: Tensor, ) -> Tuple[Tensor, Tensor]: + b, _, f, h, w = latents.shape + latent_coords = self.get_latent_coords(f, h, w, b, latents.device) latents = rearrange( latents, "b c (f p1) (h p2) (w p3) -> b (f h w) (c p1 p2 p3)", @@ -81,7 +93,7 @@ class SymmetricPatchifier(Patchifier): p2=self._patch_size[1], p3=self._patch_size[2], ) - return latents + return latents, latent_coords def unpatchify( self, diff --git a/comfy/ldm/lightricks/vae/causal_conv3d.py b/comfy/ldm/lightricks/vae/causal_conv3d.py index c572e7e86..70d612e86 100644 --- a/comfy/ldm/lightricks/vae/causal_conv3d.py +++ b/comfy/ldm/lightricks/vae/causal_conv3d.py @@ -15,6 +15,7 @@ class CausalConv3d(nn.Module): stride: Union[int, Tuple[int]] = 1, dilation: int = 1, groups: int = 1, + spatial_padding_mode: str = "zeros", **kwargs, ): super().__init__() @@ -38,7 +39,7 @@ class CausalConv3d(nn.Module): stride=stride, dilation=dilation, padding=padding, - padding_mode="zeros", + padding_mode=spatial_padding_mode, groups=groups, ) diff --git a/comfy/ldm/lightricks/vae/causal_video_autoencoder.py b/comfy/ldm/lightricks/vae/causal_video_autoencoder.py index e0344deec..043ca0496 100644 --- a/comfy/ldm/lightricks/vae/causal_video_autoencoder.py +++ b/comfy/ldm/lightricks/vae/causal_video_autoencoder.py @@ -1,13 +1,15 @@ +from __future__ import annotations import torch from torch import nn from functools import partial import math from einops import rearrange -from typing import Optional, Tuple, Union +from typing import List, Optional, Tuple, Union from .conv_nd_factory import make_conv_nd, make_linear_nd from .pixel_norm import PixelNorm from ..model import PixArtAlphaCombinedTimestepSizeEmbeddings import comfy.ops + ops = comfy.ops.disable_weight_init class Encoder(nn.Module): @@ -32,7 +34,7 @@ class Encoder(nn.Module): norm_layer (`str`, *optional*, defaults to `group_norm`): The normalization layer to use. Can be either `group_norm` or `pixel_norm`. latent_log_var (`str`, *optional*, defaults to `per_channel`): - The number of channels for the log variance. Can be either `per_channel`, `uniform`, or `none`. + The number of channels for the log variance. Can be either `per_channel`, `uniform`, `constant` or `none`. """ def __init__( @@ -40,12 +42,13 @@ class Encoder(nn.Module): dims: Union[int, Tuple[int, int]] = 3, in_channels: int = 3, out_channels: int = 3, - blocks=[("res_x", 1)], + blocks: List[Tuple[str, int | dict]] = [("res_x", 1)], base_channels: int = 128, norm_num_groups: int = 32, patch_size: Union[int, Tuple[int]] = 1, norm_layer: str = "group_norm", # group_norm, pixel_norm latent_log_var: str = "per_channel", + spatial_padding_mode: str = "zeros", ): super().__init__() self.patch_size = patch_size @@ -65,6 +68,7 @@ class Encoder(nn.Module): stride=1, padding=1, causal=True, + spatial_padding_mode=spatial_padding_mode, ) self.down_blocks = nn.ModuleList([]) @@ -82,6 +86,7 @@ class Encoder(nn.Module): resnet_eps=1e-6, resnet_groups=norm_num_groups, norm_layer=norm_layer, + spatial_padding_mode=spatial_padding_mode, ) elif block_name == "res_x_y": output_channel = block_params.get("multiplier", 2) * output_channel @@ -92,6 +97,7 @@ class Encoder(nn.Module): eps=1e-6, groups=norm_num_groups, norm_layer=norm_layer, + spatial_padding_mode=spatial_padding_mode, ) elif block_name == "compress_time": block = make_conv_nd( @@ -101,6 +107,7 @@ class Encoder(nn.Module): kernel_size=3, stride=(2, 1, 1), causal=True, + spatial_padding_mode=spatial_padding_mode, ) elif block_name == "compress_space": block = make_conv_nd( @@ -110,6 +117,7 @@ class Encoder(nn.Module): kernel_size=3, stride=(1, 2, 2), causal=True, + spatial_padding_mode=spatial_padding_mode, ) elif block_name == "compress_all": block = make_conv_nd( @@ -119,6 +127,7 @@ class Encoder(nn.Module): kernel_size=3, stride=(2, 2, 2), causal=True, + spatial_padding_mode=spatial_padding_mode, ) elif block_name == "compress_all_x_y": output_channel = block_params.get("multiplier", 2) * output_channel @@ -129,6 +138,34 @@ class Encoder(nn.Module): kernel_size=3, stride=(2, 2, 2), causal=True, + spatial_padding_mode=spatial_padding_mode, + ) + elif block_name == "compress_all_res": + output_channel = block_params.get("multiplier", 2) * output_channel + block = SpaceToDepthDownsample( + dims=dims, + in_channels=input_channel, + out_channels=output_channel, + stride=(2, 2, 2), + spatial_padding_mode=spatial_padding_mode, + ) + elif block_name == "compress_space_res": + output_channel = block_params.get("multiplier", 2) * output_channel + block = SpaceToDepthDownsample( + dims=dims, + in_channels=input_channel, + out_channels=output_channel, + stride=(1, 2, 2), + spatial_padding_mode=spatial_padding_mode, + ) + elif block_name == "compress_time_res": + output_channel = block_params.get("multiplier", 2) * output_channel + block = SpaceToDepthDownsample( + dims=dims, + in_channels=input_channel, + out_channels=output_channel, + stride=(2, 1, 1), + spatial_padding_mode=spatial_padding_mode, ) else: raise ValueError(f"unknown block: {block_name}") @@ -152,10 +189,18 @@ class Encoder(nn.Module): conv_out_channels *= 2 elif latent_log_var == "uniform": conv_out_channels += 1 + elif latent_log_var == "constant": + conv_out_channels += 1 elif latent_log_var != "none": raise ValueError(f"Invalid latent_log_var: {latent_log_var}") self.conv_out = make_conv_nd( - dims, output_channel, conv_out_channels, 3, padding=1, causal=True + dims, + output_channel, + conv_out_channels, + 3, + padding=1, + causal=True, + spatial_padding_mode=spatial_padding_mode, ) self.gradient_checkpointing = False @@ -197,6 +242,15 @@ class Encoder(nn.Module): sample = torch.cat([sample, repeated_last_channel], dim=1) else: raise ValueError(f"Invalid input shape: {sample.shape}") + elif self.latent_log_var == "constant": + sample = sample[:, :-1, ...] + approx_ln_0 = ( + -30 + ) # this is the minimal clamp value in DiagonalGaussianDistribution objects + sample = torch.cat( + [sample, torch.ones_like(sample, device=sample.device) * approx_ln_0], + dim=1, + ) return sample @@ -231,7 +285,7 @@ class Decoder(nn.Module): dims, in_channels: int = 3, out_channels: int = 3, - blocks=[("res_x", 1)], + blocks: List[Tuple[str, int | dict]] = [("res_x", 1)], base_channels: int = 128, layers_per_block: int = 2, norm_num_groups: int = 32, @@ -239,6 +293,7 @@ class Decoder(nn.Module): norm_layer: str = "group_norm", causal: bool = True, timestep_conditioning: bool = False, + spatial_padding_mode: str = "zeros", ): super().__init__() self.patch_size = patch_size @@ -264,6 +319,7 @@ class Decoder(nn.Module): stride=1, padding=1, causal=True, + spatial_padding_mode=spatial_padding_mode, ) self.up_blocks = nn.ModuleList([]) @@ -283,6 +339,7 @@ class Decoder(nn.Module): norm_layer=norm_layer, inject_noise=block_params.get("inject_noise", False), timestep_conditioning=timestep_conditioning, + spatial_padding_mode=spatial_padding_mode, ) elif block_name == "attn_res_x": block = UNetMidBlock3D( @@ -294,6 +351,7 @@ class Decoder(nn.Module): inject_noise=block_params.get("inject_noise", False), timestep_conditioning=timestep_conditioning, attention_head_dim=block_params["attention_head_dim"], + spatial_padding_mode=spatial_padding_mode, ) elif block_name == "res_x_y": output_channel = output_channel // block_params.get("multiplier", 2) @@ -306,14 +364,21 @@ class Decoder(nn.Module): norm_layer=norm_layer, inject_noise=block_params.get("inject_noise", False), timestep_conditioning=False, + spatial_padding_mode=spatial_padding_mode, ) elif block_name == "compress_time": block = DepthToSpaceUpsample( - dims=dims, in_channels=input_channel, stride=(2, 1, 1) + dims=dims, + in_channels=input_channel, + stride=(2, 1, 1), + spatial_padding_mode=spatial_padding_mode, ) elif block_name == "compress_space": block = DepthToSpaceUpsample( - dims=dims, in_channels=input_channel, stride=(1, 2, 2) + dims=dims, + in_channels=input_channel, + stride=(1, 2, 2), + spatial_padding_mode=spatial_padding_mode, ) elif block_name == "compress_all": output_channel = output_channel // block_params.get("multiplier", 1) @@ -323,6 +388,7 @@ class Decoder(nn.Module): stride=(2, 2, 2), residual=block_params.get("residual", False), out_channels_reduction_factor=block_params.get("multiplier", 1), + spatial_padding_mode=spatial_padding_mode, ) else: raise ValueError(f"unknown layer: {block_name}") @@ -340,7 +406,13 @@ class Decoder(nn.Module): self.conv_act = nn.SiLU() self.conv_out = make_conv_nd( - dims, output_channel, out_channels, 3, padding=1, causal=True + dims, + output_channel, + out_channels, + 3, + padding=1, + causal=True, + spatial_padding_mode=spatial_padding_mode, ) self.gradient_checkpointing = False @@ -433,6 +505,12 @@ class UNetMidBlock3D(nn.Module): resnet_eps (`float`, *optional*, 1e-6 ): The epsilon value for the resnet blocks. resnet_groups (`int`, *optional*, defaults to 32): The number of groups to use in the group normalization layers of the resnet blocks. + norm_layer (`str`, *optional*, defaults to `group_norm`): + The normalization layer to use. Can be either `group_norm` or `pixel_norm`. + inject_noise (`bool`, *optional*, defaults to `False`): + Whether to inject noise into the hidden states. + timestep_conditioning (`bool`, *optional*, defaults to `False`): + Whether to condition the hidden states on the timestep. Returns: `torch.FloatTensor`: The output of the last residual block, which is a tensor of shape `(batch_size, @@ -451,6 +529,7 @@ class UNetMidBlock3D(nn.Module): norm_layer: str = "group_norm", inject_noise: bool = False, timestep_conditioning: bool = False, + spatial_padding_mode: str = "zeros", ): super().__init__() resnet_groups = ( @@ -476,13 +555,17 @@ class UNetMidBlock3D(nn.Module): norm_layer=norm_layer, inject_noise=inject_noise, timestep_conditioning=timestep_conditioning, + spatial_padding_mode=spatial_padding_mode, ) for _ in range(num_layers) ] ) def forward( - self, hidden_states: torch.FloatTensor, causal: bool = True, timestep: Optional[torch.Tensor] = None + self, + hidden_states: torch.FloatTensor, + causal: bool = True, + timestep: Optional[torch.Tensor] = None, ) -> torch.FloatTensor: timestep_embed = None if self.timestep_conditioning: @@ -507,9 +590,62 @@ class UNetMidBlock3D(nn.Module): return hidden_states +class SpaceToDepthDownsample(nn.Module): + def __init__(self, dims, in_channels, out_channels, stride, spatial_padding_mode): + super().__init__() + self.stride = stride + self.group_size = in_channels * math.prod(stride) // out_channels + self.conv = make_conv_nd( + dims=dims, + in_channels=in_channels, + out_channels=out_channels // math.prod(stride), + kernel_size=3, + stride=1, + causal=True, + spatial_padding_mode=spatial_padding_mode, + ) + + def forward(self, x, causal: bool = True): + if self.stride[0] == 2: + x = torch.cat( + [x[:, :, :1, :, :], x], dim=2 + ) # duplicate first frames for padding + + # skip connection + x_in = rearrange( + x, + "b c (d p1) (h p2) (w p3) -> b (c p1 p2 p3) d h w", + p1=self.stride[0], + p2=self.stride[1], + p3=self.stride[2], + ) + x_in = rearrange(x_in, "b (c g) d h w -> b c g d h w", g=self.group_size) + x_in = x_in.mean(dim=2) + + # conv + x = self.conv(x, causal=causal) + x = rearrange( + x, + "b c (d p1) (h p2) (w p3) -> b (c p1 p2 p3) d h w", + p1=self.stride[0], + p2=self.stride[1], + p3=self.stride[2], + ) + + x = x + x_in + + return x + + class DepthToSpaceUpsample(nn.Module): def __init__( - self, dims, in_channels, stride, residual=False, out_channels_reduction_factor=1 + self, + dims, + in_channels, + stride, + residual=False, + out_channels_reduction_factor=1, + spatial_padding_mode="zeros", ): super().__init__() self.stride = stride @@ -523,6 +659,7 @@ class DepthToSpaceUpsample(nn.Module): kernel_size=3, stride=1, causal=True, + spatial_padding_mode=spatial_padding_mode, ) self.residual = residual self.out_channels_reduction_factor = out_channels_reduction_factor @@ -591,6 +728,7 @@ class ResnetBlock3D(nn.Module): norm_layer: str = "group_norm", inject_noise: bool = False, timestep_conditioning: bool = False, + spatial_padding_mode: str = "zeros", ): super().__init__() self.in_channels = in_channels @@ -617,6 +755,7 @@ class ResnetBlock3D(nn.Module): stride=1, padding=1, causal=True, + spatial_padding_mode=spatial_padding_mode, ) if inject_noise: @@ -641,6 +780,7 @@ class ResnetBlock3D(nn.Module): stride=1, padding=1, causal=True, + spatial_padding_mode=spatial_padding_mode, ) if inject_noise: @@ -801,9 +941,44 @@ class processor(nn.Module): return (x - self.get_buffer("mean-of-means").view(1, -1, 1, 1, 1).to(x)) / self.get_buffer("std-of-means").view(1, -1, 1, 1, 1).to(x) class VideoVAE(nn.Module): - def __init__(self, version=0): + def __init__(self, version=0, config=None): super().__init__() + if config is None: + config = self.guess_config(version) + + self.timestep_conditioning = config.get("timestep_conditioning", False) + double_z = config.get("double_z", True) + latent_log_var = config.get( + "latent_log_var", "per_channel" if double_z else "none" + ) + + self.encoder = Encoder( + dims=config["dims"], + in_channels=config.get("in_channels", 3), + out_channels=config["latent_channels"], + blocks=config.get("encoder_blocks", config.get("encoder_blocks", config.get("blocks"))), + patch_size=config.get("patch_size", 1), + latent_log_var=latent_log_var, + norm_layer=config.get("norm_layer", "group_norm"), + spatial_padding_mode=config.get("spatial_padding_mode", "zeros"), + ) + + self.decoder = Decoder( + dims=config["dims"], + in_channels=config["latent_channels"], + out_channels=config.get("out_channels", 3), + blocks=config.get("decoder_blocks", config.get("decoder_blocks", config.get("blocks"))), + patch_size=config.get("patch_size", 1), + norm_layer=config.get("norm_layer", "group_norm"), + causal=config.get("causal_decoder", False), + timestep_conditioning=self.timestep_conditioning, + spatial_padding_mode=config.get("spatial_padding_mode", "zeros"), + ) + + self.per_channel_statistics = processor() + + def guess_config(self, version): if version == 0: config = { "_class_name": "CausalVideoAutoencoder", @@ -830,7 +1005,7 @@ class VideoVAE(nn.Module): "use_quant_conv": False, "causal_decoder": False, } - else: + elif version == 1: config = { "_class_name": "CausalVideoAutoencoder", "dims": 3, @@ -866,37 +1041,47 @@ class VideoVAE(nn.Module): "causal_decoder": False, "timestep_conditioning": True, } - - double_z = config.get("double_z", True) - latent_log_var = config.get( - "latent_log_var", "per_channel" if double_z else "none" - ) - - self.encoder = Encoder( - dims=config["dims"], - in_channels=config.get("in_channels", 3), - out_channels=config["latent_channels"], - blocks=config.get("encoder_blocks", config.get("encoder_blocks", config.get("blocks"))), - patch_size=config.get("patch_size", 1), - latent_log_var=latent_log_var, - norm_layer=config.get("norm_layer", "group_norm"), - ) - - self.decoder = Decoder( - dims=config["dims"], - in_channels=config["latent_channels"], - out_channels=config.get("out_channels", 3), - blocks=config.get("decoder_blocks", config.get("decoder_blocks", config.get("blocks"))), - patch_size=config.get("patch_size", 1), - norm_layer=config.get("norm_layer", "group_norm"), - causal=config.get("causal_decoder", False), - timestep_conditioning=config.get("timestep_conditioning", False), - ) - - self.timestep_conditioning = config.get("timestep_conditioning", False) - self.per_channel_statistics = processor() + else: + config = { + "_class_name": "CausalVideoAutoencoder", + "dims": 3, + "in_channels": 3, + "out_channels": 3, + "latent_channels": 128, + "encoder_blocks": [ + ["res_x", {"num_layers": 4}], + ["compress_space_res", {"multiplier": 2}], + ["res_x", {"num_layers": 6}], + ["compress_time_res", {"multiplier": 2}], + ["res_x", {"num_layers": 6}], + ["compress_all_res", {"multiplier": 2}], + ["res_x", {"num_layers": 2}], + ["compress_all_res", {"multiplier": 2}], + ["res_x", {"num_layers": 2}] + ], + "decoder_blocks": [ + ["res_x", {"num_layers": 5, "inject_noise": False}], + ["compress_all", {"residual": True, "multiplier": 2}], + ["res_x", {"num_layers": 5, "inject_noise": False}], + ["compress_all", {"residual": True, "multiplier": 2}], + ["res_x", {"num_layers": 5, "inject_noise": False}], + ["compress_all", {"residual": True, "multiplier": 2}], + ["res_x", {"num_layers": 5, "inject_noise": False}] + ], + "scaling_factor": 1.0, + "norm_layer": "pixel_norm", + "patch_size": 4, + "latent_log_var": "uniform", + "use_quant_conv": False, + "causal_decoder": False, + "timestep_conditioning": True + } + return config def encode(self, x): + frames_count = x.shape[2] + if ((frames_count - 1) % 8) != 0: + raise ValueError("Invalid number of frames: Encode input must have 1 + 8 * x frames (e.g., 1, 9, 17, ...). Please check your input.") means, logvar = torch.chunk(self.encoder(x), 2, dim=1) return self.per_channel_statistics.normalize(means) diff --git a/comfy/ldm/lightricks/vae/conv_nd_factory.py b/comfy/ldm/lightricks/vae/conv_nd_factory.py index 52df4ee22..b4026b14f 100644 --- a/comfy/ldm/lightricks/vae/conv_nd_factory.py +++ b/comfy/ldm/lightricks/vae/conv_nd_factory.py @@ -17,7 +17,11 @@ def make_conv_nd( groups=1, bias=True, causal=False, + spatial_padding_mode="zeros", + temporal_padding_mode="zeros", ): + if not (spatial_padding_mode == temporal_padding_mode or causal): + raise NotImplementedError("spatial and temporal padding modes must be equal") if dims == 2: return ops.Conv2d( in_channels=in_channels, @@ -28,6 +32,7 @@ def make_conv_nd( dilation=dilation, groups=groups, bias=bias, + padding_mode=spatial_padding_mode, ) elif dims == 3: if causal: @@ -40,6 +45,7 @@ def make_conv_nd( dilation=dilation, groups=groups, bias=bias, + spatial_padding_mode=spatial_padding_mode, ) return ops.Conv3d( in_channels=in_channels, @@ -50,6 +56,7 @@ def make_conv_nd( dilation=dilation, groups=groups, bias=bias, + padding_mode=spatial_padding_mode, ) elif dims == (2, 1): return DualConv3d( @@ -59,6 +66,7 @@ def make_conv_nd( stride=stride, padding=padding, bias=bias, + padding_mode=spatial_padding_mode, ) else: raise ValueError(f"unsupported dimensions: {dims}") diff --git a/comfy/ldm/lightricks/vae/dual_conv3d.py b/comfy/ldm/lightricks/vae/dual_conv3d.py index 6bd54c0a6..dcf889296 100644 --- a/comfy/ldm/lightricks/vae/dual_conv3d.py +++ b/comfy/ldm/lightricks/vae/dual_conv3d.py @@ -18,11 +18,13 @@ class DualConv3d(nn.Module): dilation: Union[int, Tuple[int, int, int]] = 1, groups=1, bias=True, + padding_mode="zeros", ): super(DualConv3d, self).__init__() self.in_channels = in_channels self.out_channels = out_channels + self.padding_mode = padding_mode # Ensure kernel_size, stride, padding, and dilation are tuples of length 3 if isinstance(kernel_size, int): kernel_size = (kernel_size, kernel_size, kernel_size) @@ -108,6 +110,7 @@ class DualConv3d(nn.Module): self.padding1, self.dilation1, self.groups, + padding_mode=self.padding_mode, ) if skip_time_conv: @@ -122,6 +125,7 @@ class DualConv3d(nn.Module): self.padding2, self.dilation2, self.groups, + padding_mode=self.padding_mode, ) return x @@ -137,7 +141,16 @@ class DualConv3d(nn.Module): stride1 = (self.stride1[1], self.stride1[2]) padding1 = (self.padding1[1], self.padding1[2]) dilation1 = (self.dilation1[1], self.dilation1[2]) - x = F.conv2d(x, weight1, self.bias1, stride1, padding1, dilation1, self.groups) + x = F.conv2d( + x, + weight1, + self.bias1, + stride1, + padding1, + dilation1, + self.groups, + padding_mode=self.padding_mode, + ) _, _, h, w = x.shape @@ -154,7 +167,16 @@ class DualConv3d(nn.Module): stride2 = self.stride2[0] padding2 = self.padding2[0] dilation2 = self.dilation2[0] - x = F.conv1d(x, weight2, self.bias2, stride2, padding2, dilation2, self.groups) + x = F.conv1d( + x, + weight2, + self.bias2, + stride2, + padding2, + dilation2, + self.groups, + padding_mode=self.padding_mode, + ) x = rearrange(x, "(b h w) c d -> b c d h w", b=b, h=h, w=w) return x diff --git a/comfy/model_base.py b/comfy/model_base.py index cddc4663e..07fd2db43 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -161,9 +161,13 @@ class BaseModel(torch.nn.Module): extra = extra.to(dtype) extra_conds[o] = extra + t = self.process_timestep(t, x=x, **extra_conds) model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, **extra_conds).float() return self.model_sampling.calculate_denoised(sigma, model_output, x) + def process_timestep(self, timestep, **kwargs): + return timestep + def get_dtype(self): return self.diffusion_model.dtype @@ -855,17 +859,26 @@ class LTXV(BaseModel): if cross_attn is not None: out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) - guiding_latent = kwargs.get("guiding_latent", None) - if guiding_latent is not None: - out['guiding_latent'] = comfy.conds.CONDRegular(guiding_latent) - - guiding_latent_noise_scale = kwargs.get("guiding_latent_noise_scale", None) - if guiding_latent_noise_scale is not None: - out["guiding_latent_noise_scale"] = comfy.conds.CONDConstant(guiding_latent_noise_scale) - out['frame_rate'] = comfy.conds.CONDConstant(kwargs.get("frame_rate", 25)) + + denoise_mask = kwargs.get("concat_mask", kwargs.get("denoise_mask", None)) + if denoise_mask is not None: + out["denoise_mask"] = comfy.conds.CONDRegular(denoise_mask) + + keyframe_idxs = kwargs.get("keyframe_idxs", None) + if keyframe_idxs is not None: + out['keyframe_idxs'] = comfy.conds.CONDRegular(keyframe_idxs) + return out + def process_timestep(self, timestep, x, denoise_mask=None, **kwargs): + if denoise_mask is None: + return timestep + return self.diffusion_model.patchifier.patchify(((denoise_mask) * timestep.view([timestep.shape[0]] + [1] * (denoise_mask.ndim - 1)))[:, :1])[0] + + def scale_latent_inpaint(self, sigma, noise, latent_image, **kwargs): + return latent_image + class HunyuanVideo(BaseModel): def __init__(self, model_config, model_type=ModelType.FLOW, device=None): super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.hunyuan_video.model.HunyuanVideo) diff --git a/comfy/model_detection.py b/comfy/model_detection.py index f149a4bf7..1aef549f4 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -1,3 +1,4 @@ +import json import comfy.supported_models import comfy.supported_models_base import comfy.utils @@ -33,7 +34,7 @@ def calculate_transformer_depth(prefix, state_dict_keys, state_dict): return last_transformer_depth, context_dim, use_linear_in_transformer, time_stack, time_stack_cross return None -def detect_unet_config(state_dict, key_prefix): +def detect_unet_config(state_dict, key_prefix, metadata=None): state_dict_keys = list(state_dict.keys()) if '{}joint_blocks.0.context_block.attn.qkv.weight'.format(key_prefix) in state_dict_keys: #mmdit model @@ -210,6 +211,8 @@ def detect_unet_config(state_dict, key_prefix): if '{}adaln_single.emb.timestep_embedder.linear_1.bias'.format(key_prefix) in state_dict_keys: #Lightricks ltxv dit_config = {} dit_config["image_model"] = "ltxv" + if metadata is not None and "config" in metadata: + dit_config.update(json.loads(metadata["config"]).get("transformer", {})) return dit_config if '{}t_block.1.weight'.format(key_prefix) in state_dict_keys: # PixArt @@ -454,8 +457,8 @@ def model_config_from_unet_config(unet_config, state_dict=None): logging.error("no match {}".format(unet_config)) return None -def model_config_from_unet(state_dict, unet_key_prefix, use_base_if_no_match=False): - unet_config = detect_unet_config(state_dict, unet_key_prefix) +def model_config_from_unet(state_dict, unet_key_prefix, use_base_if_no_match=False, metadata=None): + unet_config = detect_unet_config(state_dict, unet_key_prefix, metadata=metadata) if unet_config is None: return None model_config = model_config_from_unet_config(unet_config, state_dict) diff --git a/comfy/sd.py b/comfy/sd.py index b866c66c4..fd98585a1 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -1,4 +1,5 @@ from __future__ import annotations +import json import torch from enum import Enum import logging @@ -249,7 +250,7 @@ class CLIP: return self.patcher.get_key_patches() class VAE: - def __init__(self, sd=None, device=None, config=None, dtype=None): + def __init__(self, sd=None, device=None, config=None, dtype=None, metadata=None): if 'decoder.up_blocks.0.resnets.0.norm1.weight' in sd.keys(): #diffusers format sd = diffusers_convert.convert_vae_state_dict(sd) @@ -357,7 +358,12 @@ class VAE: version = 0 elif tensor_conv1.shape[0] == 1024: version = 1 - self.first_stage_model = comfy.ldm.lightricks.vae.causal_video_autoencoder.VideoVAE(version=version) + if "encoder.down_blocks.1.conv.conv.bias" in sd: + version = 2 + vae_config = None + if metadata is not None and "config" in metadata: + vae_config = json.loads(metadata["config"]).get("vae", None) + self.first_stage_model = comfy.ldm.lightricks.vae.causal_video_autoencoder.VideoVAE(version=version, config=vae_config) self.latent_channels = 128 self.latent_dim = 3 self.memory_used_decode = lambda shape, dtype: (900 * shape[2] * shape[3] * shape[4] * (8 * 8 * 8)) * model_management.dtype_size(dtype) @@ -873,13 +879,13 @@ def load_checkpoint(config_path=None, ckpt_path=None, output_vae=True, output_cl return (model, clip, vae) def load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, output_clipvision=False, embedding_directory=None, output_model=True, model_options={}, te_model_options={}): - sd = comfy.utils.load_torch_file(ckpt_path) - out = load_state_dict_guess_config(sd, output_vae, output_clip, output_clipvision, embedding_directory, output_model, model_options, te_model_options=te_model_options) + sd, metadata = comfy.utils.load_torch_file(ckpt_path, return_metadata=True) + out = load_state_dict_guess_config(sd, output_vae, output_clip, output_clipvision, embedding_directory, output_model, model_options, te_model_options=te_model_options, metadata=metadata) if out is None: raise RuntimeError("ERROR: Could not detect model type of: {}".format(ckpt_path)) return out -def load_state_dict_guess_config(sd, output_vae=True, output_clip=True, output_clipvision=False, embedding_directory=None, output_model=True, model_options={}, te_model_options={}): +def load_state_dict_guess_config(sd, output_vae=True, output_clip=True, output_clipvision=False, embedding_directory=None, output_model=True, model_options={}, te_model_options={}, metadata=None): clip = None clipvision = None vae = None @@ -891,7 +897,7 @@ def load_state_dict_guess_config(sd, output_vae=True, output_clip=True, output_c weight_dtype = comfy.utils.weight_dtype(sd, diffusion_model_prefix) load_device = model_management.get_torch_device() - model_config = model_detection.model_config_from_unet(sd, diffusion_model_prefix) + model_config = model_detection.model_config_from_unet(sd, diffusion_model_prefix, metadata=metadata) if model_config is None: return None @@ -920,7 +926,7 @@ def load_state_dict_guess_config(sd, output_vae=True, output_clip=True, output_c if output_vae: vae_sd = comfy.utils.state_dict_prefix_replace(sd, {k: "" for k in model_config.vae_key_prefix}, filter_keys=True) vae_sd = model_config.process_vae_state_dict(vae_sd) - vae = VAE(sd=vae_sd) + vae = VAE(sd=vae_sd, metadata=metadata) if output_clip: clip_target = model_config.clip_target(state_dict=sd) diff --git a/comfy/utils.py b/comfy/utils.py index df7057c6a..a826e41bf 100644 --- a/comfy/utils.py +++ b/comfy/utils.py @@ -46,12 +46,18 @@ if hasattr(torch.serialization, "add_safe_globals"): # TODO: this was added in else: logging.info("Warning, you are using an old pytorch version and some ckpt/pt files might be loaded unsafely. Upgrading to 2.4 or above is recommended.") -def load_torch_file(ckpt, safe_load=False, device=None): +def load_torch_file(ckpt, safe_load=False, device=None, return_metadata=False): if device is None: device = torch.device("cpu") + metadata = None if ckpt.lower().endswith(".safetensors") or ckpt.lower().endswith(".sft"): try: - sd = safetensors.torch.load_file(ckpt, device=device.type) + with safetensors.safe_open(ckpt, framework="pt", device=device.type) as f: + sd = {} + for k in f.keys(): + sd[k] = f.get_tensor(k) + if return_metadata: + metadata = f.metadata() except Exception as e: if len(e.args) > 0: message = e.args[0] @@ -77,7 +83,7 @@ def load_torch_file(ckpt, safe_load=False, device=None): sd = pl_sd else: sd = pl_sd - return sd + return (sd, metadata) if return_metadata else sd def save_torch_file(sd, ckpt, metadata=None): if metadata is not None: diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index dec912416..8bd548bcd 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -1,9 +1,14 @@ +import io import nodes import node_helpers import torch import comfy.model_management import comfy.model_sampling +import comfy.utils import math +import numpy as np +import av +from comfy.ldm.lightricks.symmetric_patchifier import SymmetricPatchifier, latent_to_pixel_coords class EmptyLTXVLatentVideo: @classmethod @@ -33,7 +38,6 @@ class LTXVImgToVideo: "height": ("INT", {"default": 512, "min": 64, "max": nodes.MAX_RESOLUTION, "step": 32}), "length": ("INT", {"default": 97, "min": 9, "max": nodes.MAX_RESOLUTION, "step": 8}), "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), - "image_noise_scale": ("FLOAT", {"default": 0.15, "min": 0, "max": 1.0, "step": 0.01, "tooltip": "Amount of noise to apply on conditioning image latent."}) }} RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT") @@ -42,16 +46,220 @@ class LTXVImgToVideo: CATEGORY = "conditioning/video_models" FUNCTION = "generate" - def generate(self, positive, negative, image, vae, width, height, length, batch_size, image_noise_scale): + def generate(self, positive, negative, image, vae, width, height, length, batch_size): pixels = comfy.utils.common_upscale(image.movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) encode_pixels = pixels[:, :, :, :3] t = vae.encode(encode_pixels) - positive = node_helpers.conditioning_set_values(positive, {"guiding_latent": t, "guiding_latent_noise_scale": image_noise_scale}) - negative = node_helpers.conditioning_set_values(negative, {"guiding_latent": t, "guiding_latent_noise_scale": image_noise_scale}) latent = torch.zeros([batch_size, 128, ((length - 1) // 8) + 1, height // 32, width // 32], device=comfy.model_management.intermediate_device()) latent[:, :, :t.shape[2]] = t - return (positive, negative, {"samples": latent}, ) + + conditioning_latent_frames_mask = torch.ones( + (batch_size, 1, latent.shape[2], 1, 1), + dtype=torch.float32, + device=latent.device, + ) + conditioning_latent_frames_mask[:, :, :t.shape[2]] = 0 + + return (positive, negative, {"samples": latent, "noise_mask": conditioning_latent_frames_mask}, ) + + +def conditioning_get_any_value(conditioning, key, default=None): + for t in conditioning: + if key in t[1]: + return t[1][key] + return default + + +def get_noise_mask(latent): + noise_mask = latent.get("noise_mask", None) + latent_image = latent["samples"] + if noise_mask is None: + batch_size, _, latent_length, _, _ = latent_image.shape + noise_mask = torch.ones( + (batch_size, 1, latent_length, 1, 1), + dtype=torch.float32, + device=latent_image.device, + ) + else: + noise_mask = noise_mask.clone() + return noise_mask + +def get_keyframe_idxs(cond): + keyframe_idxs = conditioning_get_any_value(cond, "keyframe_idxs", None) + if keyframe_idxs is None: + return None, 0 + num_keyframes = torch.unique(keyframe_idxs[:, 0]).shape[0] + return keyframe_idxs, num_keyframes + +class LTXVAddGuide: + @classmethod + def INPUT_TYPES(s): + return {"required": {"positive": ("CONDITIONING", ), + "negative": ("CONDITIONING", ), + "vae": ("VAE",), + "latent": ("LATENT",), + "image": ("IMAGE", {"tooltip": "Image or video to condition the latent video on. Must be 8*n + 1 frames." \ + "If the video is not 8*n + 1 frames, it will be cropped to the nearest 8*n + 1 frames."}), + "frame_idx": ("INT", {"default": 0, "min": -9999, "max": 9999, + "tooltip": "Frame index to start the conditioning at. Must be divisible by 8. " \ + "If a frame is not divisible by 8, it will be rounded down to the nearest multiple of 8. " \ + "Negative values are counted from the end of the video."}), + "strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}), + } + } + + RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT") + RETURN_NAMES = ("positive", "negative", "latent") + + CATEGORY = "conditioning/video_models" + FUNCTION = "generate" + + def __init__(self): + self._num_prefix_frames = 2 + self._patchifier = SymmetricPatchifier(1) + + def encode(self, vae, latent_width, latent_height, images, scale_factors): + time_scale_factor, width_scale_factor, height_scale_factor = scale_factors + images = images[:(images.shape[0] - 1) // time_scale_factor * time_scale_factor + 1] + pixels = comfy.utils.common_upscale(images.movedim(-1, 1), latent_width * width_scale_factor, latent_height * height_scale_factor, "bilinear", crop="disabled").movedim(1, -1) + encode_pixels = pixels[:, :, :, :3] + t = vae.encode(encode_pixels) + return encode_pixels, t + + def get_latent_index(self, cond, latent_length, frame_idx, scale_factors): + time_scale_factor, _, _ = scale_factors + _, num_keyframes = get_keyframe_idxs(cond) + latent_count = latent_length - num_keyframes + frame_idx = frame_idx if frame_idx >= 0 else max((latent_count - 1) * 8 + 1 + frame_idx, 0) + frame_idx = frame_idx // time_scale_factor * time_scale_factor # frame index must be divisible by 8 + + latent_idx = (frame_idx + time_scale_factor - 1) // time_scale_factor + + return frame_idx, latent_idx + + def add_keyframe_index(self, cond, frame_idx, guiding_latent, scale_factors): + keyframe_idxs, _ = get_keyframe_idxs(cond) + _, latent_coords = self._patchifier.patchify(guiding_latent) + pixel_coords = latent_to_pixel_coords(latent_coords, scale_factors, True) + pixel_coords[:, 0] += frame_idx + if keyframe_idxs is None: + keyframe_idxs = pixel_coords + else: + keyframe_idxs = torch.cat([keyframe_idxs, pixel_coords], dim=2) + return node_helpers.conditioning_set_values(cond, {"keyframe_idxs": keyframe_idxs}) + + def append_keyframe(self, positive, negative, frame_idx, latent_image, noise_mask, guiding_latent, strength, scale_factors): + positive = self.add_keyframe_index(positive, frame_idx, guiding_latent, scale_factors) + negative = self.add_keyframe_index(negative, frame_idx, guiding_latent, scale_factors) + + mask = torch.full( + (noise_mask.shape[0], 1, guiding_latent.shape[2], 1, 1), + 1.0 - strength, + dtype=noise_mask.dtype, + device=noise_mask.device, + ) + + latent_image = torch.cat([latent_image, guiding_latent], dim=2) + noise_mask = torch.cat([noise_mask, mask], dim=2) + return positive, negative, latent_image, noise_mask + + def replace_latent_frames(self, latent_image, noise_mask, guiding_latent, latent_idx, strength): + cond_length = guiding_latent.shape[2] + assert latent_image.shape[2] >= latent_idx + cond_length, "Conditioning frames exceed the length of the latent sequence." + + mask = torch.full( + (noise_mask.shape[0], 1, cond_length, 1, 1), + 1.0 - strength, + dtype=noise_mask.dtype, + device=noise_mask.device, + ) + + latent_image = latent_image.clone() + noise_mask = noise_mask.clone() + + latent_image[:, :, latent_idx : latent_idx + cond_length] = guiding_latent + noise_mask[:, :, latent_idx : latent_idx + cond_length] = mask + + return latent_image, noise_mask + + def generate(self, positive, negative, vae, latent, image, frame_idx, strength): + scale_factors = vae.downscale_index_formula + latent_image = latent["samples"] + noise_mask = get_noise_mask(latent) + + _, _, latent_length, latent_height, latent_width = latent_image.shape + image, t = self.encode(vae, latent_width, latent_height, image, scale_factors) + + frame_idx, latent_idx = self.get_latent_index(positive, latent_length, frame_idx, scale_factors) + assert latent_idx + t.shape[2] <= latent_length, "Conditioning frames exceed the length of the latent sequence." + + if frame_idx == 0: + latent_image, noise_mask = self.replace_latent_frames(latent_image, noise_mask, t, latent_idx, strength) + return (positive, negative, {"samples": latent_image, "noise_mask": noise_mask},) + + + num_prefix_frames = min(self._num_prefix_frames, t.shape[2]) + + positive, negative, latent_image, noise_mask = self.append_keyframe( + positive, + negative, + frame_idx, + latent_image, + noise_mask, + t[:, :, :num_prefix_frames], + strength, + scale_factors, + ) + + latent_idx += num_prefix_frames + + t = t[:, :, num_prefix_frames:] + if t.shape[2] == 0: + return (positive, negative, {"samples": latent_image, "noise_mask": noise_mask},) + + latent_image, noise_mask = self.replace_latent_frames( + latent_image, + noise_mask, + t, + latent_idx, + strength, + ) + + return (positive, negative, {"samples": latent_image, "noise_mask": noise_mask},) + + +class LTXVCropGuides: + @classmethod + def INPUT_TYPES(s): + return {"required": {"positive": ("CONDITIONING", ), + "negative": ("CONDITIONING", ), + "latent": ("LATENT",), + } + } + + RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT") + RETURN_NAMES = ("positive", "negative", "latent") + + CATEGORY = "conditioning/video_models" + FUNCTION = "crop" + + def __init__(self): + self._patchifier = SymmetricPatchifier(1) + + def crop(self, positive, negative, latent): + latent_image = latent["samples"].clone() + noise_mask = get_noise_mask(latent) + + _, num_keyframes = get_keyframe_idxs(positive) + + latent_image = latent_image[:, :, :-num_keyframes] + noise_mask = noise_mask[:, :, :-num_keyframes] + + positive = node_helpers.conditioning_set_values(positive, {"keyframe_idxs": None}) + negative = node_helpers.conditioning_set_values(negative, {"keyframe_idxs": None}) + + return (positive, negative, {"samples": latent_image, "noise_mask": noise_mask},) class LTXVConditioning: @@ -174,6 +382,78 @@ class LTXVScheduler: return (sigmas,) +def encode_single_frame(output_file, image_array: np.ndarray, crf): + container = av.open(output_file, "w", format="mp4") + try: + stream = container.add_stream( + "h264", rate=1, options={"crf": str(crf), "preset": "veryfast"} + ) + stream.height = image_array.shape[0] + stream.width = image_array.shape[1] + av_frame = av.VideoFrame.from_ndarray(image_array, format="rgb24").reformat( + format="yuv420p" + ) + container.mux(stream.encode(av_frame)) + container.mux(stream.encode()) + finally: + container.close() + + +def decode_single_frame(video_file): + container = av.open(video_file) + try: + stream = next(s for s in container.streams if s.type == "video") + frame = next(container.decode(stream)) + finally: + container.close() + return frame.to_ndarray(format="rgb24") + + +def preprocess(image: torch.Tensor, crf=29): + if crf == 0: + return image + + image_array = (image * 255.0).byte().cpu().numpy() + with io.BytesIO() as output_file: + encode_single_frame(output_file, image_array, crf) + video_bytes = output_file.getvalue() + with io.BytesIO(video_bytes) as video_file: + image_array = decode_single_frame(video_file) + tensor = torch.tensor(image_array, dtype=image.dtype, device=image.device) / 255.0 + return tensor + + +class LTXVPreprocess: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": ("IMAGE",), + "img_compression": ( + "INT", + { + "default": 35, + "min": 0, + "max": 100, + "tooltip": "Amount of compression to apply on image.", + }, + ), + } + } + + FUNCTION = "preprocess" + RETURN_TYPES = ("IMAGE",) + RETURN_NAMES = ("output_image",) + CATEGORY = "image" + + def preprocess(self, image, img_compression): + output_image = image + if img_compression > 0: + output_image = torch.zeros_like(image) + for i in range(image.shape[0]): + output_image[i] = preprocess(image[i], img_compression) + return (output_image,) + NODE_CLASS_MAPPINGS = { "EmptyLTXVLatentVideo": EmptyLTXVLatentVideo, @@ -181,4 +461,7 @@ NODE_CLASS_MAPPINGS = { "ModelSamplingLTXV": ModelSamplingLTXV, "LTXVConditioning": LTXVConditioning, "LTXVScheduler": LTXVScheduler, + "LTXVAddGuide": LTXVAddGuide, + "LTXVPreprocess": LTXVPreprocess, + "LTXVCropGuides": LTXVCropGuides, } From 9c9a7f012a5396a55d9d23dadcf87bcf3713b605 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 05:16:05 -0500 Subject: [PATCH 171/478] Adjust ltxv memory factor. --- comfy/supported_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 26340900b..7e37a17b1 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -762,7 +762,7 @@ class LTXV(supported_models_base.BASE): unet_extra_config = {} latent_format = latent_formats.LTXV - memory_usage_factor = 2.7 + memory_usage_factor = 5.5 # TODO: img2vid is about 2x vs txt2vid supported_inference_dtypes = [torch.bfloat16, torch.float32] From 369b079ff62d1677d61904bcc133aa88c43154b0 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 05:26:08 -0500 Subject: [PATCH 172/478] Fix lowvram issue with ltxv vae. --- comfy/ldm/lightricks/vae/causal_video_autoencoder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/ldm/lightricks/vae/causal_video_autoencoder.py b/comfy/ldm/lightricks/vae/causal_video_autoencoder.py index 043ca0496..f91870d71 100644 --- a/comfy/ldm/lightricks/vae/causal_video_autoencoder.py +++ b/comfy/ldm/lightricks/vae/causal_video_autoencoder.py @@ -695,7 +695,7 @@ class DepthToSpaceUpsample(nn.Module): class LayerNorm(nn.Module): def __init__(self, dim, eps, elementwise_affine=True) -> None: super().__init__() - self.norm = nn.LayerNorm(dim, eps=eps, elementwise_affine=elementwise_affine) + self.norm = ops.LayerNorm(dim, eps=eps, elementwise_affine=elementwise_affine) def forward(self, x): x = rearrange(x, "b c d h w -> b d h w c") From dc134b2fdbbd9fc40d04b760d24551b291f06776 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 06:28:14 -0500 Subject: [PATCH 173/478] Bump ComfyUI version to v0.3.20 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 5ded466ad..488c134bf 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.19" +__version__ = "0.3.20" diff --git a/pyproject.toml b/pyproject.toml index 444a1efc1..171de091c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.19" +version = "0.3.20" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 30e6cfb1a0eaa9651ca9bcb403d7b98c0f313bf5 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 07:18:13 -0500 Subject: [PATCH 174/478] Fix LTXVPreprocess on resolutions that are not multiples of 2. --- comfy_extras/nodes_lt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index 8bd548bcd..d3f3ac3a1 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -413,7 +413,7 @@ def preprocess(image: torch.Tensor, crf=29): if crf == 0: return image - image_array = (image * 255.0).byte().cpu().numpy() + image_array = (image[:(image.shape[0] // 2) * 2, :(image.shape[1] // 2) * 2] * 255.0).byte().cpu().numpy() with io.BytesIO() as output_file: encode_single_frame(output_file, image_array, crf) video_bytes = output_file.getvalue() @@ -449,10 +449,10 @@ class LTXVPreprocess: def preprocess(self, image, img_compression): output_image = image if img_compression > 0: - output_image = torch.zeros_like(image) + output_images = [] for i in range(image.shape[0]): - output_image[i] = preprocess(image[i], img_compression) - return (output_image,) + output_images.append(preprocess(image[i], img_compression)) + return (torch.stack(output_images),) NODE_CLASS_MAPPINGS = { From 77633ba77d11b95b43cb1696210809477d939469 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 07:31:47 -0500 Subject: [PATCH 175/478] Remove unused variable. --- comfy_extras/nodes_lt.py | 1 - 1 file changed, 1 deletion(-) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index d3f3ac3a1..f43cb54a2 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -447,7 +447,6 @@ class LTXVPreprocess: CATEGORY = "image" def preprocess(self, image, img_compression): - output_image = image if img_compression > 0: output_images = [] for i in range(image.shape[0]): From 6d45ffbe231040fc0d5b98e9a08986f604552161 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 08:05:22 -0500 Subject: [PATCH 176/478] Bump ComfyUI version to v0.3.21 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 488c134bf..c0be6ed55 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.20" +__version__ = "0.3.21" diff --git a/pyproject.toml b/pyproject.toml index 171de091c..396f20c61 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.20" +version = "0.3.21" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 872780d236ca5485f9f1393fbd2ae459d6055a84 Mon Sep 17 00:00:00 2001 From: Andrew Kvochko Date: Wed, 5 Mar 2025 15:47:32 +0200 Subject: [PATCH 177/478] fix: ltxv crop guides works with 0 keyframes (#7085) This patch fixes a bug in LTXVCropGuides when the latent has no keyframes. Additionally, the first frame is always added as a keyframe. Co-authored-by: Andrew Kvochko --- comfy_extras/nodes_lt.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index f43cb54a2..b608b9407 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -194,11 +194,6 @@ class LTXVAddGuide: frame_idx, latent_idx = self.get_latent_index(positive, latent_length, frame_idx, scale_factors) assert latent_idx + t.shape[2] <= latent_length, "Conditioning frames exceed the length of the latent sequence." - if frame_idx == 0: - latent_image, noise_mask = self.replace_latent_frames(latent_image, noise_mask, t, latent_idx, strength) - return (positive, negative, {"samples": latent_image, "noise_mask": noise_mask},) - - num_prefix_frames = min(self._num_prefix_frames, t.shape[2]) positive, negative, latent_image, noise_mask = self.append_keyframe( @@ -252,6 +247,8 @@ class LTXVCropGuides: noise_mask = get_noise_mask(latent) _, num_keyframes = get_keyframe_idxs(positive) + if num_keyframes == 0: + return (positive, negative, {"samples": latent_image, "noise_mask": noise_mask},) latent_image = latent_image[:, :, :-num_keyframes] noise_mask = noise_mask[:, :, :-num_keyframes] From a80bc822a206e5d728e735f647c4c25b6c035b2d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 08:58:44 -0500 Subject: [PATCH 178/478] Partially revert last commit. --- comfy_extras/nodes_lt.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index b608b9407..4550b246a 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -194,6 +194,11 @@ class LTXVAddGuide: frame_idx, latent_idx = self.get_latent_index(positive, latent_length, frame_idx, scale_factors) assert latent_idx + t.shape[2] <= latent_length, "Conditioning frames exceed the length of the latent sequence." + if frame_idx == 0: + latent_image, noise_mask = self.replace_latent_frames(latent_image, noise_mask, t, latent_idx, strength) + return (positive, negative, {"samples": latent_image, "noise_mask": noise_mask},) + + num_prefix_frames = min(self._num_prefix_frames, t.shape[2]) positive, negative, latent_image, noise_mask = self.append_keyframe( From 76739c23c3c7e3617fb76bb25f7efc1ebba949de Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 09:57:40 -0500 Subject: [PATCH 179/478] Revert "Partially revert last commit." This reverts commit a80bc822a206e5d728e735f647c4c25b6c035b2d. --- comfy_extras/nodes_lt.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index 4550b246a..b608b9407 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -194,11 +194,6 @@ class LTXVAddGuide: frame_idx, latent_idx = self.get_latent_index(positive, latent_length, frame_idx, scale_factors) assert latent_idx + t.shape[2] <= latent_length, "Conditioning frames exceed the length of the latent sequence." - if frame_idx == 0: - latent_image, noise_mask = self.replace_latent_frames(latent_image, noise_mask, t, latent_idx, strength) - return (positive, negative, {"samples": latent_image, "noise_mask": noise_mask},) - - num_prefix_frames = min(self._num_prefix_frames, t.shape[2]) positive, negative, latent_image, noise_mask = self.append_keyframe( From 889519971fe530abbdc689af20aa439c5e99875f Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 10:06:37 -0500 Subject: [PATCH 180/478] Bump ComfyUI version to v0.3.22 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index c0be6ed55..0e50db99b 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.21" +__version__ = "0.3.22" diff --git a/pyproject.toml b/pyproject.toml index 396f20c61..9dbbe7cc4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.21" +version = "0.3.22" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 52b34696062121709ba082554c893bec0f3160b7 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 5 Mar 2025 15:33:23 -0500 Subject: [PATCH 181/478] [NodeDef] Explicitly add control_after_generate to seed/noise_seed (#7059) * [NodeDef] Explicitly add control_after_generate to seed/noise_seed * Update comfy/comfy_types/node_typing.py Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com> --------- Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com> --- comfy/comfy_types/node_typing.py | 2 ++ comfy_extras/nodes_custom_sampler.py | 16 +++++++++++----- nodes.py | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/comfy/comfy_types/node_typing.py b/comfy/comfy_types/node_typing.py index 0696dbe5e..6146b70f8 100644 --- a/comfy/comfy_types/node_typing.py +++ b/comfy/comfy_types/node_typing.py @@ -134,6 +134,8 @@ class InputTypeOptions(TypedDict): """ remote: RemoteInputOptions """Specifies the configuration for a remote input.""" + control_after_generate: bool + """Specifies whether a control widget should be added to the input, adding options to automatically change the value after each prompt is queued. Currently only used for INT and COMBO types.""" class HiddenInputTypeDict(TypedDict): diff --git a/comfy_extras/nodes_custom_sampler.py b/comfy_extras/nodes_custom_sampler.py index 576fc3b2c..c9689b745 100644 --- a/comfy_extras/nodes_custom_sampler.py +++ b/comfy_extras/nodes_custom_sampler.py @@ -454,7 +454,7 @@ class SamplerCustom: return {"required": {"model": ("MODEL",), "add_noise": ("BOOLEAN", {"default": True}), - "noise_seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}), + "noise_seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "control_after_generate": True}), "cfg": ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0, "step":0.1, "round": 0.01}), "positive": ("CONDITIONING", ), "negative": ("CONDITIONING", ), @@ -605,10 +605,16 @@ class DisableNoise: class RandomNoise(DisableNoise): @classmethod def INPUT_TYPES(s): - return {"required":{ - "noise_seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}), - } - } + return { + "required": { + "noise_seed": ("INT", { + "default": 0, + "min": 0, + "max": 0xffffffffffffffff, + "control_after_generate": True, + }), + } + } def get_noise(self, noise_seed): return (Noise_RandomNoise(noise_seed),) diff --git a/nodes.py b/nodes.py index f7f6cb156..dec6cdc86 100644 --- a/nodes.py +++ b/nodes.py @@ -1519,7 +1519,7 @@ class KSampler: return { "required": { "model": ("MODEL", {"tooltip": "The model used for denoising the input latent."}), - "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "tooltip": "The random seed used for creating the noise."}), + "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "control_after_generate": True, "tooltip": "The random seed used for creating the noise."}), "steps": ("INT", {"default": 20, "min": 1, "max": 10000, "tooltip": "The number of steps used in the denoising process."}), "cfg": ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0, "step":0.1, "round": 0.01, "tooltip": "The Classifier-Free Guidance scale balances creativity and adherence to the prompt. Higher values result in images more closely matching the prompt however too high values will negatively impact quality."}), "sampler_name": (comfy.samplers.KSampler.SAMPLERS, {"tooltip": "The algorithm used when sampling, this can affect the quality, speed, and style of the generated output."}), @@ -1547,7 +1547,7 @@ class KSamplerAdvanced: return {"required": {"model": ("MODEL",), "add_noise": (["enable", "disable"], ), - "noise_seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff}), + "noise_seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "control_after_generate": True}), "steps": ("INT", {"default": 20, "min": 1, "max": 10000}), "cfg": ("FLOAT", {"default": 8.0, "min": 0.0, "max": 100.0, "step":0.1, "round": 0.01}), "sampler_name": (comfy.samplers.KSampler.SAMPLERS, ), From c1909f350fb2eef4d4fd87b54f87f042a6bceba5 Mon Sep 17 00:00:00 2001 From: Silver <65376327+silveroxides@users.noreply.github.com> Date: Wed, 5 Mar 2025 21:34:22 +0100 Subject: [PATCH 182/478] Better argument handling of front-end-root (#7043) * Better argument handling of front-end-root Improves handling of front-end-root launch argument. Several instances where users have set it and ComfyUI launches as normal and completely disregards the launch arg which doesn't make sense. Better to indicate to user that something is incorrect. * Removed unused import There was no real reason to use "Optional" typing in ther front-end-root argument. --- comfy/cli_args.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index c99c9e65e..a864205be 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -1,7 +1,6 @@ import argparse import enum import os -from typing import Optional import comfy.options @@ -166,13 +165,14 @@ parser.add_argument( """, ) -def is_valid_directory(path: Optional[str]) -> Optional[str]: - """Validate if the given path is a directory.""" - if path is None: - return None - +def is_valid_directory(path: str) -> str: + """Validate if the given path is a directory, and check permissions.""" + if not os.path.exists(path): + raise argparse.ArgumentTypeError(f"The path '{path}' does not exist.") if not os.path.isdir(path): - raise argparse.ArgumentTypeError(f"{path} is not a valid directory.") + raise argparse.ArgumentTypeError(f"'{path}' is not a directory.") + if not os.access(path, os.R_OK): + raise argparse.ArgumentTypeError(f"You do not have read permissions for '{path}'.") return path parser.add_argument( From 5d84607bf3a761d796fb0cf3b6fdba8480ead5f7 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 5 Mar 2025 15:35:26 -0500 Subject: [PATCH 183/478] Add type hint for FileLocator (#6968) * Add type hint for FileLocator * nit --- comfy/comfy_types/__init__.py | 3 ++- comfy/comfy_types/node_typing.py | 11 +++++++++++ comfy_extras/nodes_audio.py | 5 ++++- comfy_extras/nodes_images.py | 6 +++++- comfy_extras/nodes_video.py | 5 ++++- nodes.py | 4 ++-- 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/comfy/comfy_types/__init__.py b/comfy/comfy_types/__init__.py index 19ec33f98..7640fbe3f 100644 --- a/comfy/comfy_types/__init__.py +++ b/comfy/comfy_types/__init__.py @@ -1,6 +1,6 @@ import torch from typing import Callable, Protocol, TypedDict, Optional, List -from .node_typing import IO, InputTypeDict, ComfyNodeABC, CheckLazyMixin +from .node_typing import IO, InputTypeDict, ComfyNodeABC, CheckLazyMixin, FileLocator class UnetApplyFunction(Protocol): @@ -42,4 +42,5 @@ __all__ = [ InputTypeDict.__name__, ComfyNodeABC.__name__, CheckLazyMixin.__name__, + FileLocator.__name__, ] diff --git a/comfy/comfy_types/node_typing.py b/comfy/comfy_types/node_typing.py index 6146b70f8..fe130567d 100644 --- a/comfy/comfy_types/node_typing.py +++ b/comfy/comfy_types/node_typing.py @@ -295,3 +295,14 @@ class CheckLazyMixin: need = [name for name in kwargs if kwargs[name] is None] return need + + +class FileLocator(TypedDict): + """Provides type hinting for the file location""" + + filename: str + """The filename of the file.""" + subfolder: str + """The subfolder of the file.""" + type: Literal["input", "output", "temp"] + """The root folder of the file.""" diff --git a/comfy_extras/nodes_audio.py b/comfy_extras/nodes_audio.py index 3cb918e09..136ad6159 100644 --- a/comfy_extras/nodes_audio.py +++ b/comfy_extras/nodes_audio.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import torchaudio import torch import comfy.model_management @@ -10,6 +12,7 @@ import random import hashlib import node_helpers from comfy.cli_args import args +from comfy.comfy_types import FileLocator class EmptyLatentAudio: def __init__(self): @@ -164,7 +167,7 @@ class SaveAudio: def save_audio(self, audio, filename_prefix="ComfyUI", prompt=None, extra_pnginfo=None): filename_prefix += self.prefix_append full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir) - results = list() + results: list[FileLocator] = [] metadata = {} if not args.disable_metadata: diff --git a/comfy_extras/nodes_images.py b/comfy_extras/nodes_images.py index af37666b2..e11a4583a 100644 --- a/comfy_extras/nodes_images.py +++ b/comfy_extras/nodes_images.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import nodes import folder_paths from comfy.cli_args import args @@ -9,6 +11,8 @@ import numpy as np import json import os +from comfy.comfy_types import FileLocator + MAX_RESOLUTION = nodes.MAX_RESOLUTION class ImageCrop: @@ -99,7 +103,7 @@ class SaveAnimatedWEBP: method = self.methods.get(method) filename_prefix += self.prefix_append full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir, images[0].shape[1], images[0].shape[0]) - results = list() + results: list[FileLocator] = [] pil_images = [] for image in images: i = 255. * image.cpu().numpy() diff --git a/comfy_extras/nodes_video.py b/comfy_extras/nodes_video.py index 53920ba18..97ca513d8 100644 --- a/comfy_extras/nodes_video.py +++ b/comfy_extras/nodes_video.py @@ -1,9 +1,12 @@ +from __future__ import annotations + import os import av import torch import folder_paths import json from fractions import Fraction +from comfy.comfy_types import FileLocator class SaveWEBM: @@ -62,7 +65,7 @@ class SaveWEBM: container.mux(stream.encode()) container.close() - results = [{ + results: list[FileLocator] = [{ "filename": file, "subfolder": subfolder, "type": self.type diff --git a/nodes.py b/nodes.py index dec6cdc86..bbf49915c 100644 --- a/nodes.py +++ b/nodes.py @@ -25,7 +25,7 @@ import comfy.sample import comfy.sd import comfy.utils import comfy.controlnet -from comfy.comfy_types import IO, ComfyNodeABC, InputTypeDict +from comfy.comfy_types import IO, ComfyNodeABC, InputTypeDict, FileLocator import comfy.clip_vision @@ -479,7 +479,7 @@ class SaveLatent: file = f"{filename}_{counter:05}_.latent" - results = list() + results: list[FileLocator] = [] results.append({ "filename": file, "subfolder": subfolder, From 85ef295069c6b4521aea4dd152b26b5c75f95680 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 5 Mar 2025 17:34:38 -0500 Subject: [PATCH 184/478] Make applying embeddings more efficient. Adding new tokens no longer makes a whole copy of the embeddings weight which can be massive on certain models. --- comfy/clip_model.py | 13 +++-- comfy/sd1_clip.py | 102 ++++++++++++++++++----------------- comfy/text_encoders/bert.py | 11 ++-- comfy/text_encoders/llama.py | 7 ++- comfy/text_encoders/t5.py | 9 ++-- 5 files changed, 81 insertions(+), 61 deletions(-) diff --git a/comfy/clip_model.py b/comfy/clip_model.py index cf5b58b62..300b09ec7 100644 --- a/comfy/clip_model.py +++ b/comfy/clip_model.py @@ -97,8 +97,12 @@ class CLIPTextModel_(torch.nn.Module): self.encoder = CLIPEncoder(num_layers, embed_dim, heads, intermediate_size, intermediate_activation, dtype, device, operations) self.final_layer_norm = operations.LayerNorm(embed_dim, dtype=dtype, device=device) - def forward(self, input_tokens, attention_mask=None, intermediate_output=None, final_layer_norm_intermediate=True, dtype=torch.float32): - x = self.embeddings(input_tokens, dtype=dtype) + def forward(self, input_tokens=None, attention_mask=None, embeds=None, num_tokens=None, intermediate_output=None, final_layer_norm_intermediate=True, dtype=torch.float32): + if embeds is not None: + x = embeds + comfy.ops.cast_to(self.embeddings.position_embedding.weight, dtype=dtype, device=embeds.device) + else: + x = self.embeddings(input_tokens, dtype=dtype) + mask = None if attention_mask is not None: mask = 1.0 - attention_mask.to(x.dtype).reshape((attention_mask.shape[0], 1, -1, attention_mask.shape[-1])).expand(attention_mask.shape[0], 1, attention_mask.shape[-1], attention_mask.shape[-1]) @@ -116,7 +120,10 @@ class CLIPTextModel_(torch.nn.Module): if i is not None and final_layer_norm_intermediate: i = self.final_layer_norm(i) - pooled_output = x[torch.arange(x.shape[0], device=x.device), (torch.round(input_tokens).to(dtype=torch.int, device=x.device) == self.eos_token_id).int().argmax(dim=-1),] + if num_tokens is not None: + pooled_output = x[list(range(x.shape[0])), list(map(lambda a: a - 1, num_tokens))] + else: + pooled_output = x[torch.arange(x.shape[0], device=x.device), (torch.round(input_tokens).to(dtype=torch.int, device=x.device) == self.eos_token_id).int().argmax(dim=-1),] return x, i, pooled_output class CLIPTextModel(torch.nn.Module): diff --git a/comfy/sd1_clip.py b/comfy/sd1_clip.py index 692ae0518..775147535 100644 --- a/comfy/sd1_clip.py +++ b/comfy/sd1_clip.py @@ -158,71 +158,75 @@ class SDClipModel(torch.nn.Module, ClipTokenWeightEncoder): self.layer_idx = self.options_default[1] self.return_projected_pooled = self.options_default[2] - def set_up_textual_embeddings(self, tokens, current_embeds): - out_tokens = [] - next_new_token = token_dict_size = current_embeds.weight.shape[0] - embedding_weights = [] + def process_tokens(self, tokens, device): + end_token = self.special_tokens.get("end", None) + if end_token is None: + cmp_token = self.special_tokens.get("pad", -1) + else: + cmp_token = end_token + + embeds_out = [] + attention_masks = [] + num_tokens = [] for x in tokens: + attention_mask = [] tokens_temp = [] + other_embeds = [] + eos = False + index = 0 for y in x: if isinstance(y, numbers.Integral): - tokens_temp += [int(y)] - else: - if y.shape[0] == current_embeds.weight.shape[1]: - embedding_weights += [y] - tokens_temp += [next_new_token] - next_new_token += 1 + if eos: + attention_mask.append(0) else: - logging.warning("WARNING: shape mismatch when trying to apply embedding, embedding will be ignored {} != {}".format(y.shape[0], current_embeds.weight.shape[1])) - while len(tokens_temp) < len(x): - tokens_temp += [self.special_tokens["pad"]] - out_tokens += [tokens_temp] + attention_mask.append(1) + token = int(y) + tokens_temp += [token] + if not eos and token == cmp_token: + if end_token is None: + attention_mask[-1] = 0 + eos = True + else: + other_embeds.append((index, y)) + index += 1 - n = token_dict_size - if len(embedding_weights) > 0: - new_embedding = self.operations.Embedding(next_new_token + 1, current_embeds.weight.shape[1], device=current_embeds.weight.device, dtype=current_embeds.weight.dtype) - new_embedding.weight[:token_dict_size] = current_embeds.weight - for x in embedding_weights: - new_embedding.weight[n] = x - n += 1 - self.transformer.set_input_embeddings(new_embedding) + tokens_embed = torch.tensor([tokens_temp], device=device, dtype=torch.long) + tokens_embed = self.transformer.get_input_embeddings()(tokens_embed, out_dtype=torch.float32) + index = 0 + pad_extra = 0 + for o in other_embeds: + ind = index + o[0] + emb = o[1].view(1, -1, o[1].shape[-1]).to(device=device, dtype=torch.float32) + emb_shape = emb.shape[1] + if emb.shape[-1] == tokens_embed.shape[-1]: + tokens_embed = torch.cat([tokens_embed[:, :ind], emb, tokens_embed[:, ind:]], dim=1) + attention_mask = attention_mask[:ind] + [1] * emb_shape + attention_mask[ind:] + index += emb_shape - 1 + else: + index += -1 + pad_extra += emb_shape + logging.warning("WARNING: shape mismatch when trying to apply embedding, embedding will be ignored {} != {}".format(emb.shape[-1], tokens_embed.shape[-1])) - processed_tokens = [] - for x in out_tokens: - processed_tokens += [list(map(lambda a: n if a == -1 else a, x))] #The EOS token should always be the largest one + if pad_extra > 0: + padd_embed = self.transformer.get_input_embeddings()(torch.tensor([[self.special_tokens["pad"]] * pad_extra], device=device, dtype=torch.long), out_dtype=torch.float32) + tokens_embed = torch.cat([tokens_embed, padd_embed], dim=1) - return processed_tokens + embeds_out.append(tokens_embed) + attention_masks.append(attention_mask) + num_tokens.append(sum(attention_mask)) + + return torch.cat(embeds_out), torch.tensor(attention_masks, device=device, dtype=torch.long), num_tokens def forward(self, tokens): - backup_embeds = self.transformer.get_input_embeddings() - device = backup_embeds.weight.device - tokens = self.set_up_textual_embeddings(tokens, backup_embeds) - tokens = torch.LongTensor(tokens).to(device) - - attention_mask = None - if self.enable_attention_masks or self.zero_out_masked or self.return_attention_masks: - attention_mask = torch.zeros_like(tokens) - end_token = self.special_tokens.get("end", None) - if end_token is None: - cmp_token = self.special_tokens.get("pad", -1) - else: - cmp_token = end_token - - for x in range(attention_mask.shape[0]): - for y in range(attention_mask.shape[1]): - attention_mask[x, y] = 1 - if tokens[x, y] == cmp_token: - if end_token is None: - attention_mask[x, y] = 0 - break + device = self.transformer.get_input_embeddings().weight.device + embeds, attention_mask, num_tokens = self.process_tokens(tokens, device) attention_mask_model = None if self.enable_attention_masks: attention_mask_model = attention_mask - outputs = self.transformer(tokens, attention_mask_model, intermediate_output=self.layer_idx, final_layer_norm_intermediate=self.layer_norm_hidden_state, dtype=torch.float32) - self.transformer.set_input_embeddings(backup_embeds) + outputs = self.transformer(None, attention_mask_model, embeds=embeds, num_tokens=num_tokens, intermediate_output=self.layer_idx, final_layer_norm_intermediate=self.layer_norm_hidden_state, dtype=torch.float32) if self.layer == "last": z = outputs[0].float() diff --git a/comfy/text_encoders/bert.py b/comfy/text_encoders/bert.py index d4edd5aa5..551b03162 100644 --- a/comfy/text_encoders/bert.py +++ b/comfy/text_encoders/bert.py @@ -93,8 +93,11 @@ class BertEmbeddings(torch.nn.Module): self.LayerNorm = operations.LayerNorm(embed_dim, eps=layer_norm_eps, dtype=dtype, device=device) - def forward(self, input_tokens, token_type_ids=None, dtype=None): - x = self.word_embeddings(input_tokens, out_dtype=dtype) + def forward(self, input_tokens, embeds=None, token_type_ids=None, dtype=None): + if embeds is not None: + x = embeds + else: + x = self.word_embeddings(input_tokens, out_dtype=dtype) x += comfy.ops.cast_to_input(self.position_embeddings.weight[:x.shape[1]], x) if token_type_ids is not None: x += self.token_type_embeddings(token_type_ids, out_dtype=x.dtype) @@ -113,8 +116,8 @@ class BertModel_(torch.nn.Module): self.embeddings = BertEmbeddings(config_dict["vocab_size"], config_dict["max_position_embeddings"], config_dict["type_vocab_size"], config_dict["pad_token_id"], embed_dim, layer_norm_eps, dtype, device, operations) self.encoder = BertEncoder(config_dict["num_hidden_layers"], embed_dim, config_dict["intermediate_size"], config_dict["num_attention_heads"], layer_norm_eps, dtype, device, operations) - def forward(self, input_tokens, attention_mask=None, intermediate_output=None, final_layer_norm_intermediate=True, dtype=None): - x = self.embeddings(input_tokens, dtype=dtype) + def forward(self, input_tokens, attention_mask=None, embeds=None, num_tokens=None, intermediate_output=None, final_layer_norm_intermediate=True, dtype=None): + x = self.embeddings(input_tokens, embeds=embeds, dtype=dtype) mask = None if attention_mask is not None: mask = 1.0 - attention_mask.to(x.dtype).reshape((attention_mask.shape[0], 1, -1, attention_mask.shape[-1])).expand(attention_mask.shape[0], 1, attention_mask.shape[-1], attention_mask.shape[-1]) diff --git a/comfy/text_encoders/llama.py b/comfy/text_encoders/llama.py index 3f234015a..58710b2bf 100644 --- a/comfy/text_encoders/llama.py +++ b/comfy/text_encoders/llama.py @@ -241,8 +241,11 @@ class Llama2_(nn.Module): self.norm = RMSNorm(config.hidden_size, eps=config.rms_norm_eps, add=config.rms_norm_add, device=device, dtype=dtype) # self.lm_head = ops.Linear(config.hidden_size, config.vocab_size, bias=False, device=device, dtype=dtype) - def forward(self, x, attention_mask=None, intermediate_output=None, final_layer_norm_intermediate=True, dtype=None): - x = self.embed_tokens(x, out_dtype=dtype) + def forward(self, x, attention_mask=None, embeds=None, num_tokens=None, intermediate_output=None, final_layer_norm_intermediate=True, dtype=None): + if embeds is not None: + x = embeds + else: + x = self.embed_tokens(x, out_dtype=dtype) if self.normalize_in: x *= self.config.hidden_size ** 0.5 diff --git a/comfy/text_encoders/t5.py b/comfy/text_encoders/t5.py index df2b5b5cd..49f0ba4fe 100644 --- a/comfy/text_encoders/t5.py +++ b/comfy/text_encoders/t5.py @@ -239,8 +239,11 @@ class T5(torch.nn.Module): def set_input_embeddings(self, embeddings): self.shared = embeddings - def forward(self, input_ids, *args, **kwargs): - x = self.shared(input_ids, out_dtype=kwargs.get("dtype", torch.float32)) + def forward(self, input_ids, attention_mask, embeds=None, num_tokens=None, **kwargs): + if input_ids is None: + x = embeds + else: + x = self.shared(input_ids, out_dtype=kwargs.get("dtype", torch.float32)) if self.dtype not in [torch.float32, torch.float16, torch.bfloat16]: x = torch.nan_to_num(x) #Fix for fp8 T5 base - return self.encoder(x, *args, **kwargs) + return self.encoder(x, attention_mask=attention_mask, **kwargs) From 0bef826a98dc93d59bb5f260175e449d587cf923 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 6 Mar 2025 00:24:43 -0500 Subject: [PATCH 185/478] Support llava clip vision model. --- comfy/clip_model.py | 20 +++++++++++++++++++- comfy/clip_vision.py | 6 +++++- comfy/clip_vision_config_vitl_336_llava.json | 19 +++++++++++++++++++ comfy/sd1_clip.py | 19 ++++++++++++++++++- 4 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 comfy/clip_vision_config_vitl_336_llava.json diff --git a/comfy/clip_model.py b/comfy/clip_model.py index 300b09ec7..c8294d483 100644 --- a/comfy/clip_model.py +++ b/comfy/clip_model.py @@ -211,6 +211,15 @@ class CLIPVision(torch.nn.Module): pooled_output = self.post_layernorm(x[:, 0, :]) return x, i, pooled_output +class LlavaProjector(torch.nn.Module): + def __init__(self, in_dim, out_dim, dtype, device, operations): + super().__init__() + self.linear_1 = operations.Linear(in_dim, out_dim, bias=True, device=device, dtype=dtype) + self.linear_2 = operations.Linear(out_dim, out_dim, bias=True, device=device, dtype=dtype) + + def forward(self, x): + return self.linear_2(torch.nn.functional.gelu(self.linear_1(x[:, 1:]))) + class CLIPVisionModelProjection(torch.nn.Module): def __init__(self, config_dict, dtype, device, operations): super().__init__() @@ -220,7 +229,16 @@ class CLIPVisionModelProjection(torch.nn.Module): else: self.visual_projection = lambda a: a + if "llava3" == config_dict.get("projector_type", None): + self.multi_modal_projector = LlavaProjector(config_dict["hidden_size"], 4096, dtype, device, operations) + else: + self.multi_modal_projector = None + def forward(self, *args, **kwargs): x = self.vision_model(*args, **kwargs) out = self.visual_projection(x[2]) - return (x[0], x[1], out) + projected = None + if self.multi_modal_projector is not None: + projected = self.multi_modal_projector(x[1]) + + return (x[0], x[1], out, projected) diff --git a/comfy/clip_vision.py b/comfy/clip_vision.py index c9c82e9ad..297b3bca3 100644 --- a/comfy/clip_vision.py +++ b/comfy/clip_vision.py @@ -65,6 +65,7 @@ class ClipVisionModel(): outputs["last_hidden_state"] = out[0].to(comfy.model_management.intermediate_device()) outputs["image_embeds"] = out[2].to(comfy.model_management.intermediate_device()) outputs["penultimate_hidden_states"] = out[1].to(comfy.model_management.intermediate_device()) + outputs["mm_projected"] = out[3] return outputs def convert_to_transformers(sd, prefix): @@ -104,7 +105,10 @@ def load_clipvision_from_sd(sd, prefix="", convert_keys=False): if sd["vision_model.encoder.layers.0.layer_norm1.weight"].shape[0] == 1152: json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_vision_siglip_384.json") elif sd["vision_model.embeddings.position_embedding.weight"].shape[0] == 577: - json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_vision_config_vitl_336.json") + if "multi_modal_projector.linear_1.bias" in sd: + json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_vision_config_vitl_336_llava.json") + else: + json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_vision_config_vitl_336.json") else: json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_vision_config_vitl.json") else: diff --git a/comfy/clip_vision_config_vitl_336_llava.json b/comfy/clip_vision_config_vitl_336_llava.json new file mode 100644 index 000000000..f23a50d8b --- /dev/null +++ b/comfy/clip_vision_config_vitl_336_llava.json @@ -0,0 +1,19 @@ +{ + "attention_dropout": 0.0, + "dropout": 0.0, + "hidden_act": "quick_gelu", + "hidden_size": 1024, + "image_size": 336, + "initializer_factor": 1.0, + "initializer_range": 0.02, + "intermediate_size": 4096, + "layer_norm_eps": 1e-5, + "model_type": "clip_vision_model", + "num_attention_heads": 16, + "num_channels": 3, + "num_hidden_layers": 24, + "patch_size": 14, + "projection_dim": 768, + "projector_type": "llava3", + "torch_dtype": "float32" +} diff --git a/comfy/sd1_clip.py b/comfy/sd1_clip.py index 775147535..22adcbac9 100644 --- a/comfy/sd1_clip.py +++ b/comfy/sd1_clip.py @@ -196,8 +196,25 @@ class SDClipModel(torch.nn.Module, ClipTokenWeightEncoder): index = 0 pad_extra = 0 for o in other_embeds: + emb = o[1] + if torch.is_tensor(emb): + emb = {"type": "embedding", "data": emb} + + emb_type = emb.get("type", None) + if emb_type == "embedding": + emb = emb.get("data", None) + else: + if hasattr(self.transformer, "preprocess_embed"): + emb = self.transformer.preprocess_embed(emb, device=device) + else: + emb = None + + if emb is None: + index += -1 + continue + ind = index + o[0] - emb = o[1].view(1, -1, o[1].shape[-1]).to(device=device, dtype=torch.float32) + emb = emb.view(1, -1, emb.shape[-1]).to(device=device, dtype=torch.float32) emb_shape = emb.shape[1] if emb.shape[-1] == tokens_embed.shape[-1]: tokens_embed = torch.cat([tokens_embed[:, :ind], emb, tokens_embed[:, ind:]], dim=1) From 29a70ca1010c1482a96467a729f172e39382d631 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 6 Mar 2025 03:07:15 -0500 Subject: [PATCH 186/478] Support HunyuanVideo image to video model. --- comfy/model_base.py | 7 +++ comfy/supported_models.py | 12 ++++- comfy/text_encoders/hunyuan_video.py | 60 +++++++++++++++++++------ comfy_extras/nodes_hunyuan.py | 67 ++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+), 14 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index 07fd2db43..a304c58bd 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -900,6 +900,13 @@ class HunyuanVideo(BaseModel): out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor([guidance])) return out + +class HunyuanVideoI2V(HunyuanVideo): + def __init__(self, model_config, model_type=ModelType.FLOW, device=None): + super().__init__(model_config, model_type, device=device) + self.concat_keys = ("concat_image", "mask_inverted") + + class HunyuanVideoSkyreelsI2V(HunyuanVideo): def __init__(self, model_config, model_type=ModelType.FLOW, device=None): super().__init__(model_config, model_type, device=device) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 7e37a17b1..7157a15f2 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -826,6 +826,16 @@ class HunyuanVideo(supported_models_base.BASE): hunyuan_detect = comfy.text_encoders.hunyuan_video.llama_detect(state_dict, "{}llama.transformer.".format(pref)) return supported_models_base.ClipTarget(comfy.text_encoders.hunyuan_video.HunyuanVideoTokenizer, comfy.text_encoders.hunyuan_video.hunyuan_video_clip(**hunyuan_detect)) +class HunyuanVideoI2V(HunyuanVideo): + unet_config = { + "image_model": "hunyuan_video", + "in_channels": 33, + } + + def get_model(self, state_dict, prefix="", device=None): + out = model_base.HunyuanVideoI2V(self, device=device) + return out + class HunyuanVideoSkyreelsI2V(HunyuanVideo): unet_config = { "image_model": "hunyuan_video", @@ -949,6 +959,6 @@ class WAN21_I2V(WAN21_T2V): out = model_base.WAN21(self, image_to_video=True, device=device) return out -models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V] +models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V] models += [SVD_img2vid] diff --git a/comfy/text_encoders/hunyuan_video.py b/comfy/text_encoders/hunyuan_video.py index bdee0b3df..1d814aadd 100644 --- a/comfy/text_encoders/hunyuan_video.py +++ b/comfy/text_encoders/hunyuan_video.py @@ -4,6 +4,7 @@ import comfy.text_encoders.llama from transformers import LlamaTokenizerFast import torch import os +import numbers def llama_detect(state_dict, prefix=""): @@ -22,7 +23,7 @@ def llama_detect(state_dict, prefix=""): class LLAMA3Tokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}, min_length=256): tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "llama_tokenizer") - super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='llama', tokenizer_class=LlamaTokenizerFast, has_start_token=True, has_end_token=False, pad_to_max_length=False, max_length=99999999, pad_token=128258, end_token=128009, min_length=min_length) + super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='llama', tokenizer_class=LlamaTokenizerFast, has_start_token=True, has_end_token=False, pad_to_max_length=False, max_length=99999999, pad_token=128258, min_length=min_length) class LLAMAModel(sd1_clip.SDClipModel): def __init__(self, device="cpu", layer="hidden", layer_idx=-3, dtype=None, attention_mask=True, model_options={}): @@ -38,18 +39,26 @@ class HunyuanVideoTokenizer: def __init__(self, embedding_directory=None, tokenizer_data={}): clip_l_tokenizer_class = tokenizer_data.get("clip_l_tokenizer_class", sd1_clip.SDTokenizer) self.clip_l = clip_l_tokenizer_class(embedding_directory=embedding_directory) - self.llama_template = """<|start_header_id|>system<|end_header_id|>\n\nDescribe the video by detailing the following aspects: 1. The main content and theme of the video.2. The color, shape, size, texture, quantity, text, and spatial relationships of the objects.3. Actions, events, behaviors temporal relationships, physical movement changes of the objects.4. background environment, light, style and atmosphere.5. camera angles, movements, and transitions used in the video:<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n""" # 95 tokens + self.llama_template = """<|start_header_id|>system<|end_header_id|>\n\nDescribe the video by detailing the following aspects: 1. The main content and theme of the video.2. The color, shape, size, texture, quantity, text, and spatial relationships of the objects.3. Actions, events, behaviors temporal relationships, physical movement changes of the objects.4. background environment, light, style and atmosphere.5. camera angles, movements, and transitions used in the video:<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n{}<|eot_id|>""" # 95 tokens self.llama = LLAMA3Tokenizer(embedding_directory=embedding_directory, min_length=1) - def tokenize_with_weights(self, text:str, return_word_ids=False, llama_template=None, **kwargs): + def tokenize_with_weights(self, text, return_word_ids=False, llama_template=None, image_embeds=None, **kwargs): out = {} out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids) if llama_template is None: - llama_text = "{}{}".format(self.llama_template, text) + llama_text = self.llama_template.format(text) else: - llama_text = "{}{}".format(llama_template, text) - out["llama"] = self.llama.tokenize_with_weights(llama_text, return_word_ids) + llama_text = llama_template.format(text) + llama_text_tokens = self.llama.tokenize_with_weights(llama_text, return_word_ids) + embed_count = 0 + for r in llama_text_tokens: + for i in range(len(r)): + if r[i][0] == 128257: + if image_embeds is not None and embed_count < image_embeds.shape[0]: + r[i] = ({"type": "embedding", "data": image_embeds[embed_count], "original_type": "image"},) + r[i][1:] + embed_count += 1 + out["llama"] = llama_text_tokens return out def untokenize(self, token_weight_pair): @@ -83,20 +92,45 @@ class HunyuanVideoClipModel(torch.nn.Module): llama_out, llama_pooled, llama_extra_out = self.llama.encode_token_weights(token_weight_pairs_llama) template_end = 0 - for i, v in enumerate(token_weight_pairs_llama[0]): - if v[0] == 128007: # <|end_header_id|> - template_end = i + image_start = None + image_end = None + extra_sizes = 0 + user_end = 9999999999999 + + tok_pairs = token_weight_pairs_llama[0] + for i, v in enumerate(tok_pairs): + elem = v[0] + if not torch.is_tensor(elem): + if isinstance(elem, numbers.Integral): + if elem == 128006: + if tok_pairs[i + 1][0] == 882: + if tok_pairs[i + 2][0] == 128007: + template_end = i + 2 + user_end = -1 + if elem == 128009 and user_end == -1: + user_end = i + 1 + else: + if elem.get("original_type") == "image": + elem_size = elem.get("data").shape[0] + if image_start is None: + image_start = i + extra_sizes + image_end = i + elem_size + extra_sizes + extra_sizes += elem_size - 1 if llama_out.shape[1] > (template_end + 2): - if token_weight_pairs_llama[0][template_end + 1][0] == 271: + if tok_pairs[template_end + 1][0] == 271: template_end += 2 - llama_out = llama_out[:, template_end:] - llama_extra_out["attention_mask"] = llama_extra_out["attention_mask"][:, template_end:] + llama_output = llama_out[:, template_end + extra_sizes:user_end + extra_sizes] + llama_extra_out["attention_mask"] = llama_extra_out["attention_mask"][:, template_end + extra_sizes:user_end + extra_sizes] if llama_extra_out["attention_mask"].sum() == torch.numel(llama_extra_out["attention_mask"]): llama_extra_out.pop("attention_mask") # attention mask is useless if no masked elements + if image_start is not None: + image_output = llama_out[:, image_start: image_end] + llama_output = torch.cat([image_output[:, ::2], llama_output], dim=1) + l_out, l_pooled = self.clip_l.encode_token_weights(token_weight_pairs_l) - return llama_out, l_pooled, llama_extra_out + return llama_output, l_pooled, llama_extra_out def load_sd(self, sd): if "text_model.encoder.layers.1.mlp.fc1.weight" in sd: diff --git a/comfy_extras/nodes_hunyuan.py b/comfy_extras/nodes_hunyuan.py index d6408269f..4f700bbe6 100644 --- a/comfy_extras/nodes_hunyuan.py +++ b/comfy_extras/nodes_hunyuan.py @@ -1,4 +1,5 @@ import nodes +import node_helpers import torch import comfy.model_management @@ -38,7 +39,73 @@ class EmptyHunyuanLatentVideo: latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) return ({"samples":latent}, ) +PROMPT_TEMPLATE_ENCODE_VIDEO_I2V = ( + "<|start_header_id|>system<|end_header_id|>\n\n\nDescribe the video by detailing the following aspects according to the reference image: " + "1. The main content and theme of the video." + "2. The color, shape, size, texture, quantity, text, and spatial relationships of the objects." + "3. Actions, events, behaviors temporal relationships, physical movement changes of the objects." + "4. background environment, light, style and atmosphere." + "5. camera angles, movements, and transitions used in the video:<|eot_id|>\n\n" + "<|start_header_id|>user<|end_header_id|>\n\n{}<|eot_id|>" + "<|start_header_id|>assistant<|end_header_id|>\n\n" +) + +class TextEncodeHunyuanVideo_ImageToVideo: + @classmethod + def INPUT_TYPES(s): + return {"required": { + "clip": ("CLIP", ), + "clip_vision_output": ("CLIP_VISION_OUTPUT", ), + "prompt": ("STRING", {"multiline": True, "dynamicPrompts": True}), + }} + RETURN_TYPES = ("CONDITIONING",) + FUNCTION = "encode" + + CATEGORY = "advanced/conditioning" + + def encode(self, clip, clip_vision_output, prompt): + tokens = clip.tokenize(prompt, llama_template=PROMPT_TEMPLATE_ENCODE_VIDEO_I2V, image_embeds=clip_vision_output.mm_projected) + return (clip.encode_from_tokens_scheduled(tokens), ) + + +class HunyuanImageToVideo: + @classmethod + def INPUT_TYPES(s): + return {"required": {"positive": ("CONDITIONING", ), + "vae": ("VAE", ), + "width": ("INT", {"default": 848, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "height": ("INT", {"default": 480, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "length": ("INT", {"default": 53, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}), + "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), + }, + "optional": {"start_image": ("IMAGE", ), + }} + + RETURN_TYPES = ("CONDITIONING", "LATENT") + RETURN_NAMES = ("positive", "latent") + FUNCTION = "encode" + + CATEGORY = "conditioning/video_models" + + def encode(self, positive, vae, width, height, length, batch_size, start_image=None): + latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) + if start_image is not None: + start_image = comfy.utils.common_upscale(start_image[:length, :, :, :3].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + + concat_latent_image = vae.encode(start_image) + mask = torch.ones((1, 1, latent.shape[2], concat_latent_image.shape[-2], concat_latent_image.shape[-1]), device=start_image.device, dtype=start_image.dtype) + mask[:, :, :((start_image.shape[0] - 1) // 4) + 1] = 0.0 + + positive = node_helpers.conditioning_set_values(positive, {"concat_latent_image": concat_latent_image, "concat_mask": mask}) + + out_latent = {} + out_latent["samples"] = latent + return (positive, out_latent) + + NODE_CLASS_MAPPINGS = { "CLIPTextEncodeHunyuanDiT": CLIPTextEncodeHunyuanDiT, + "TextEncodeHunyuanVideo_ImageToVideo": TextEncodeHunyuanVideo_ImageToVideo, "EmptyHunyuanLatentVideo": EmptyHunyuanLatentVideo, + "HunyuanImageToVideo": HunyuanImageToVideo, } From 0124be4d93102a85ccfc9d1b223e0f39e1cfc571 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 6 Mar 2025 04:10:12 -0500 Subject: [PATCH 187/478] ComfyUI version v0.3.23 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 0e50db99b..ac257abf8 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.22" +__version__ = "0.3.23" diff --git a/pyproject.toml b/pyproject.toml index 9dbbe7cc4..824887a94 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.22" +version = "0.3.23" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From dfa36e68552c2d115bbcbec5f8a45eb36fbd5814 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 6 Mar 2025 13:31:40 -0500 Subject: [PATCH 188/478] Fix some things breaking when embeddings fail to apply. --- comfy/sd1_clip.py | 1 + 1 file changed, 1 insertion(+) diff --git a/comfy/sd1_clip.py b/comfy/sd1_clip.py index 22adcbac9..be21ec18d 100644 --- a/comfy/sd1_clip.py +++ b/comfy/sd1_clip.py @@ -228,6 +228,7 @@ class SDClipModel(torch.nn.Module, ClipTokenWeightEncoder): if pad_extra > 0: padd_embed = self.transformer.get_input_embeddings()(torch.tensor([[self.special_tokens["pad"]] * pad_extra], device=device, dtype=torch.long), out_dtype=torch.float32) tokens_embed = torch.cat([tokens_embed, padd_embed], dim=1) + attention_mask = attention_mask + [0] * pad_extra embeds_out.append(tokens_embed) attention_masks.append(attention_mask) From a13125840c47c2342fa80aec8fdaee8626dff135 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 6 Mar 2025 13:53:48 -0500 Subject: [PATCH 189/478] ComfyUI version v0.3.24 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index ac257abf8..a68a65323 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.23" +__version__ = "0.3.24" diff --git a/pyproject.toml b/pyproject.toml index 824887a94..4c11c71bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.23" +version = "0.3.24" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 1650cda030daa32c9d12a5d92c02663bd076b071 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" <128333288+ltdrdata@users.noreply.github.com> Date: Fri, 7 Mar 2025 05:23:23 +0900 Subject: [PATCH 190/478] Fixed: Incorrect guide message for missing frontend. (#7105) `{sys.executable} -m pip` -> `{sys.executable} -s -m pip` https://github.com/comfyanonymous/ComfyUI/pull/7047#issuecomment-2697876793 --- app/frontend_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/frontend_management.py b/app/frontend_management.py index e4d589209..9feb1e965 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -23,7 +23,7 @@ try: except ImportError: # TODO: Remove the check after roll out of 0.3.16 req_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'requirements.txt')) - logging.error(f"\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. Please install the updated requirements.txt file by running:\n{sys.executable} -m pip install -r {req_path}\n\nThis error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead.\n\nIf you are on the portable package you can run: update\\update_comfyui.bat to solve this problem\n********** ERROR **********\n") + logging.error(f"\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. Please install the updated requirements.txt file by running:\n{sys.executable} -s -m pip install -r {req_path}\n\nThis error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead.\n\nIf you are on the portable package you can run: update\\update_comfyui.bat to solve this problem\n********** ERROR **********\n") exit(-1) From e62d72e8caaac32474a30096f426bc16b2fce679 Mon Sep 17 00:00:00 2001 From: JettHu <35261585+JettHu@users.noreply.github.com> Date: Fri, 7 Mar 2025 04:24:04 +0800 Subject: [PATCH 191/478] Typo in node_typing.py (#7092) --- comfy/comfy_types/node_typing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/comfy_types/node_typing.py b/comfy/comfy_types/node_typing.py index fe130567d..4967de716 100644 --- a/comfy/comfy_types/node_typing.py +++ b/comfy/comfy_types/node_typing.py @@ -114,7 +114,7 @@ class InputTypeOptions(TypedDict): # default: bool label_on: str """The label to use in the UI when the bool is True (``BOOLEAN``)""" - label_on: str + label_off: str """The label to use in the UI when the bool is False (``BOOLEAN``)""" # class InputTypeString(InputTypeOptions): # default: str From e1474150de36b5b6477ce42c2a2801577ad42fff Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 7 Mar 2025 04:37:58 -0500 Subject: [PATCH 192/478] Support fp8_scaled diffusion models that don't use fp8 matrix mult. --- comfy/model_base.py | 2 +- comfy/model_detection.py | 4 ++++ comfy/ops.py | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index a304c58bd..2fa1ee911 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -108,7 +108,7 @@ class BaseModel(torch.nn.Module): if not unet_config.get("disable_unet_model_creation", False): if model_config.custom_operations is None: - fp8 = model_config.optimizations.get("fp8", model_config.scaled_fp8 is not None) + fp8 = model_config.optimizations.get("fp8", False) operations = comfy.ops.pick_operations(unet_config.get("dtype", None), self.manual_cast_dtype, fp8_optimizations=fp8, scaled_fp8=model_config.scaled_fp8) else: operations = model_config.custom_operations diff --git a/comfy/model_detection.py b/comfy/model_detection.py index 1aef549f4..403da5855 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -471,6 +471,10 @@ def model_config_from_unet(state_dict, unet_key_prefix, use_base_if_no_match=Fal model_config.scaled_fp8 = scaled_fp8_weight.dtype if model_config.scaled_fp8 == torch.float32: model_config.scaled_fp8 = torch.float8_e4m3fn + if scaled_fp8_weight.nelement() == 2: + model_config.optimizations["fp8"] = False + else: + model_config.optimizations["fp8"] = True return model_config diff --git a/comfy/ops.py b/comfy/ops.py index 358c6ec60..3303c6fcd 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -17,6 +17,7 @@ """ import torch +import logging import comfy.model_management from comfy.cli_args import args, PerformanceFeature import comfy.float @@ -308,6 +309,7 @@ class fp8_ops(manual_cast): return torch.nn.functional.linear(input, weight, bias) def scaled_fp8_ops(fp8_matrix_mult=False, scale_input=False, override_dtype=None): + logging.info("Using scaled fp8: fp8 matrix mult: {}, scale input: {}".format(fp8_matrix_mult, scale_input)) class scaled_fp8_op(manual_cast): class Linear(manual_cast.Linear): def __init__(self, *args, **kwargs): @@ -358,7 +360,7 @@ def scaled_fp8_ops(fp8_matrix_mult=False, scale_input=False, override_dtype=None def pick_operations(weight_dtype, compute_dtype, load_device=None, disable_fast_fp8=False, fp8_optimizations=False, scaled_fp8=None): fp8_compute = comfy.model_management.supports_fp8_compute(load_device) if scaled_fp8 is not None: - return scaled_fp8_ops(fp8_matrix_mult=fp8_compute, scale_input=True, override_dtype=scaled_fp8) + return scaled_fp8_ops(fp8_matrix_mult=fp8_compute and fp8_optimizations, scale_input=True, override_dtype=scaled_fp8) if ( fp8_compute and From 70e15fd743e85554f907cef164703fce1715cd7d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 7 Mar 2025 04:49:20 -0500 Subject: [PATCH 193/478] No need for scale_input when fp8 matrix mult is disabled. --- comfy/ops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/ops.py b/comfy/ops.py index 3303c6fcd..ced461011 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -360,7 +360,7 @@ def scaled_fp8_ops(fp8_matrix_mult=False, scale_input=False, override_dtype=None def pick_operations(weight_dtype, compute_dtype, load_device=None, disable_fast_fp8=False, fp8_optimizations=False, scaled_fp8=None): fp8_compute = comfy.model_management.supports_fp8_compute(load_device) if scaled_fp8 is not None: - return scaled_fp8_ops(fp8_matrix_mult=fp8_compute and fp8_optimizations, scale_input=True, override_dtype=scaled_fp8) + return scaled_fp8_ops(fp8_matrix_mult=fp8_compute and fp8_optimizations, scale_input=fp8_optimizations, override_dtype=scaled_fp8) if ( fp8_compute and From 11b1f27cb17938bbb2f723f8d71ac78bb9f2e40f Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 7 Mar 2025 04:52:36 -0500 Subject: [PATCH 194/478] Set WAN default compute dtype to fp16. --- comfy/supported_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 7157a15f2..b4d7bfe20 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -931,7 +931,7 @@ class WAN21_T2V(supported_models_base.BASE): memory_usage_factor = 1.0 - supported_inference_dtypes = [torch.bfloat16, torch.float16, torch.float32] + supported_inference_dtypes = [torch.float16, torch.bfloat16, torch.float32] vae_key_prefix = ["vae."] text_encoder_key_prefix = ["text_encoders."] From 4ab1875283ce985e77be7ffb4b499db11d937f73 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 7 Mar 2025 07:45:40 -0500 Subject: [PATCH 195/478] Add .bat file to nightly package to run with fp16 accumulation. --- .../run_nvidia_gpu_fast_fp16_accumulation.bat | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .ci/windows_nightly_base_files/run_nvidia_gpu_fast_fp16_accumulation.bat diff --git a/.ci/windows_nightly_base_files/run_nvidia_gpu_fast_fp16_accumulation.bat b/.ci/windows_nightly_base_files/run_nvidia_gpu_fast_fp16_accumulation.bat new file mode 100644 index 000000000..38f06ecb2 --- /dev/null +++ b/.ci/windows_nightly_base_files/run_nvidia_gpu_fast_fp16_accumulation.bat @@ -0,0 +1,2 @@ +.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build --fast fp16_accumulation +pause From 5dbd25096513838785143c493b94e6c518e71c0b Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 7 Mar 2025 07:57:59 -0500 Subject: [PATCH 196/478] Update nightly instructions in readme. --- .github/workflows/windows_release_nightly_pytorch.yml | 4 ++-- README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows_release_nightly_pytorch.yml b/.github/workflows/windows_release_nightly_pytorch.yml index f90488705..cea9aae17 100644 --- a/.github/workflows/windows_release_nightly_pytorch.yml +++ b/.github/workflows/windows_release_nightly_pytorch.yml @@ -7,7 +7,7 @@ on: description: 'cuda version' required: true type: string - default: "126" + default: "128" python_minor: description: 'python minor version' @@ -19,7 +19,7 @@ on: description: 'python patch version' required: true type: string - default: "1" + default: "2" # push: # branches: # - master diff --git a/README.md b/README.md index 9190dd493..a807ea9d6 100644 --- a/README.md +++ b/README.md @@ -215,9 +215,9 @@ Nvidia users should install stable pytorch using this command: ```pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu126``` -This is the command to install pytorch nightly instead which might have performance improvements: +This is the command to install pytorch nightly instead which supports the new blackwell 50xx series GPUs and might have performance improvements. -```pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu126``` +```pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128``` #### Troubleshooting From d60fe0af4ae3056edb8d05c585e06c5cb36bbbed Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 7 Mar 2025 08:30:01 -0500 Subject: [PATCH 197/478] Reduce size of nightly package. --- .github/workflows/windows_release_nightly_pytorch.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows_release_nightly_pytorch.yml b/.github/workflows/windows_release_nightly_pytorch.yml index cea9aae17..49a9fd8bc 100644 --- a/.github/workflows/windows_release_nightly_pytorch.yml +++ b/.github/workflows/windows_release_nightly_pytorch.yml @@ -34,7 +34,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 30 persist-credentials: false - uses: actions/setup-python@v5 with: @@ -56,7 +56,7 @@ jobs: cd .. git clone --depth 1 https://github.com/comfyanonymous/taesd - cp taesd/*.pth ./ComfyUI_copy/models/vae_approx/ + #cp taesd/*.pth ./ComfyUI_copy/models/vae_approx/ mkdir ComfyUI_windows_portable_nightly_pytorch mv python_embeded ComfyUI_windows_portable_nightly_pytorch @@ -74,7 +74,7 @@ jobs: pause" > ./update/update_comfyui_and_python_dependencies.bat cd .. - "C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=8 -mfb=64 -md=32m -ms=on -mf=BCJ2 ComfyUI_windows_portable_nightly_pytorch.7z ComfyUI_windows_portable_nightly_pytorch + "C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=9 -mfb=128 -md=512m -ms=on -mf=BCJ2 ComfyUI_windows_portable_nightly_pytorch.7z ComfyUI_windows_portable_nightly_pytorch mv ComfyUI_windows_portable_nightly_pytorch.7z ComfyUI/ComfyUI_windows_portable_nvidia_or_cpu_nightly_pytorch.7z cd ComfyUI_windows_portable_nightly_pytorch From ebbb9201637a3bfdf96399396f636d8513dc7aa4 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 7 Mar 2025 14:56:09 -0500 Subject: [PATCH 198/478] Add back taesd to nightly package. --- .github/workflows/windows_release_nightly_pytorch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows_release_nightly_pytorch.yml b/.github/workflows/windows_release_nightly_pytorch.yml index 49a9fd8bc..24599249a 100644 --- a/.github/workflows/windows_release_nightly_pytorch.yml +++ b/.github/workflows/windows_release_nightly_pytorch.yml @@ -56,7 +56,7 @@ jobs: cd .. git clone --depth 1 https://github.com/comfyanonymous/taesd - #cp taesd/*.pth ./ComfyUI_copy/models/vae_approx/ + cp taesd/*.pth ./ComfyUI_copy/models/vae_approx/ mkdir ComfyUI_windows_portable_nightly_pytorch mv python_embeded ComfyUI_windows_portable_nightly_pytorch From 84cc9cb5287a6b0345b681174a8e85bd3ca41515 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 7 Mar 2025 19:02:13 -0500 Subject: [PATCH 199/478] Update frontend to 1.11.8 (#7119) * Update frontend to 1.11.7 * Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4ad5f3b8a..e1316ccff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.10.17 +comfyui-frontend-package==1.11.8 torch torchsde torchvision From c3d9cc4592310d22f414c93a7840b541f3a7b497 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 7 Mar 2025 19:53:07 -0500 Subject: [PATCH 200/478] Print the frontend version in the log. --- app/frontend_management.py | 6 ++++++ main.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/app/frontend_management.py b/app/frontend_management.py index 9feb1e965..94293af1e 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -27,6 +27,12 @@ except ImportError: exit(-1) +try: + frontend_version = tuple(map(int, comfyui_frontend_package.__version__.split("."))) +except: + frontend_version = (0,) + pass + REQUEST_TIMEOUT = 10 # seconds diff --git a/main.py b/main.py index f6510c90a..57fa397e6 100644 --- a/main.py +++ b/main.py @@ -139,6 +139,7 @@ from server import BinaryEventTypes import nodes import comfy.model_management import comfyui_version +import app.frontend_management def cuda_malloc_warning(): @@ -295,6 +296,8 @@ def start_comfyui(asyncio_loop=None): if __name__ == "__main__": # Running directly, just start ComfyUI. logging.info("ComfyUI version: {}".format(comfyui_version.__version__)) + logging.info("ComfyUI frontend version: {}".format('.'.join(map(str, app.frontend_management.frontend_version)))) + event_loop, _, start_all_func = start_comfyui() try: event_loop.run_until_complete(start_all_func()) From be4e760648e0234f9202b9cbe7dcfb3bd307acb9 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 7 Mar 2025 19:56:11 -0500 Subject: [PATCH 201/478] Add an image_interleave option to the Hunyuan image to video encode node. See the tooltip for what it does. --- comfy/text_encoders/hunyuan_video.py | 28 +++++++++++++++++----------- comfy_extras/nodes_hunyuan.py | 5 +++-- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/comfy/text_encoders/hunyuan_video.py b/comfy/text_encoders/hunyuan_video.py index 1d814aadd..dbb259e54 100644 --- a/comfy/text_encoders/hunyuan_video.py +++ b/comfy/text_encoders/hunyuan_video.py @@ -42,7 +42,7 @@ class HunyuanVideoTokenizer: self.llama_template = """<|start_header_id|>system<|end_header_id|>\n\nDescribe the video by detailing the following aspects: 1. The main content and theme of the video.2. The color, shape, size, texture, quantity, text, and spatial relationships of the objects.3. Actions, events, behaviors temporal relationships, physical movement changes of the objects.4. background environment, light, style and atmosphere.5. camera angles, movements, and transitions used in the video:<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n{}<|eot_id|>""" # 95 tokens self.llama = LLAMA3Tokenizer(embedding_directory=embedding_directory, min_length=1) - def tokenize_with_weights(self, text, return_word_ids=False, llama_template=None, image_embeds=None, **kwargs): + def tokenize_with_weights(self, text, return_word_ids=False, llama_template=None, image_embeds=None, image_interleave=1, **kwargs): out = {} out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids) @@ -56,7 +56,7 @@ class HunyuanVideoTokenizer: for i in range(len(r)): if r[i][0] == 128257: if image_embeds is not None and embed_count < image_embeds.shape[0]: - r[i] = ({"type": "embedding", "data": image_embeds[embed_count], "original_type": "image"},) + r[i][1:] + r[i] = ({"type": "embedding", "data": image_embeds[embed_count], "original_type": "image", "image_interleave": image_interleave},) + r[i][1:] embed_count += 1 out["llama"] = llama_text_tokens return out @@ -92,10 +92,10 @@ class HunyuanVideoClipModel(torch.nn.Module): llama_out, llama_pooled, llama_extra_out = self.llama.encode_token_weights(token_weight_pairs_llama) template_end = 0 - image_start = None - image_end = None + extra_template_end = 0 extra_sizes = 0 user_end = 9999999999999 + images = [] tok_pairs = token_weight_pairs_llama[0] for i, v in enumerate(tok_pairs): @@ -112,22 +112,28 @@ class HunyuanVideoClipModel(torch.nn.Module): else: if elem.get("original_type") == "image": elem_size = elem.get("data").shape[0] - if image_start is None: + if template_end > 0: + if user_end == -1: + extra_template_end += elem_size - 1 + else: image_start = i + extra_sizes image_end = i + elem_size + extra_sizes - extra_sizes += elem_size - 1 + images.append((image_start, image_end, elem.get("image_interleave", 1))) + extra_sizes += elem_size - 1 if llama_out.shape[1] > (template_end + 2): if tok_pairs[template_end + 1][0] == 271: template_end += 2 - llama_output = llama_out[:, template_end + extra_sizes:user_end + extra_sizes] - llama_extra_out["attention_mask"] = llama_extra_out["attention_mask"][:, template_end + extra_sizes:user_end + extra_sizes] + llama_output = llama_out[:, template_end + extra_sizes:user_end + extra_sizes + extra_template_end] + llama_extra_out["attention_mask"] = llama_extra_out["attention_mask"][:, template_end + extra_sizes:user_end + extra_sizes + extra_template_end] if llama_extra_out["attention_mask"].sum() == torch.numel(llama_extra_out["attention_mask"]): llama_extra_out.pop("attention_mask") # attention mask is useless if no masked elements - if image_start is not None: - image_output = llama_out[:, image_start: image_end] - llama_output = torch.cat([image_output[:, ::2], llama_output], dim=1) + if len(images) > 0: + out = [] + for i in images: + out.append(llama_out[:, i[0]: i[1]: i[2]]) + llama_output = torch.cat(out + [llama_output], dim=1) l_out, l_pooled = self.clip_l.encode_token_weights(token_weight_pairs_l) return llama_output, l_pooled, llama_extra_out diff --git a/comfy_extras/nodes_hunyuan.py b/comfy_extras/nodes_hunyuan.py index 4f700bbe6..56aef9b01 100644 --- a/comfy_extras/nodes_hunyuan.py +++ b/comfy_extras/nodes_hunyuan.py @@ -57,14 +57,15 @@ class TextEncodeHunyuanVideo_ImageToVideo: "clip": ("CLIP", ), "clip_vision_output": ("CLIP_VISION_OUTPUT", ), "prompt": ("STRING", {"multiline": True, "dynamicPrompts": True}), + "image_interleave": ("INT", {"default": 2, "min": 1, "max": 512, "tooltip": "How much the image influences things vs the text prompt. Higher number means more influence from the text prompt."}), }} RETURN_TYPES = ("CONDITIONING",) FUNCTION = "encode" CATEGORY = "advanced/conditioning" - def encode(self, clip, clip_vision_output, prompt): - tokens = clip.tokenize(prompt, llama_template=PROMPT_TEMPLATE_ENCODE_VIDEO_I2V, image_embeds=clip_vision_output.mm_projected) + def encode(self, clip, clip_vision_output, prompt, image_interleave): + tokens = clip.tokenize(prompt, llama_template=PROMPT_TEMPLATE_ENCODE_VIDEO_I2V, image_embeds=clip_vision_output.mm_projected, image_interleave=image_interleave) return (clip.encode_from_tokens_scheduled(tokens), ) From 29832b3b61591633d8f312f7df727c1bb8b4d9e4 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 8 Mar 2025 03:51:36 -0500 Subject: [PATCH 202/478] Warn if frontend package is older than the one in requirements.txt --- app/frontend_management.py | 10 ++++++++-- main.py | 19 +++++++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/frontend_management.py b/app/frontend_management.py index 94293af1e..308f71da6 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -18,12 +18,18 @@ from typing_extensions import NotRequired from comfy.cli_args import DEFAULT_VERSION_STRING +def frontend_install_warning_message(): + req_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'requirements.txt')) + extra = "" + if sys.flags.no_user_site: + extra = "-s " + return f"Please install the updated requirements.txt file by running:\n{sys.executable} {extra}-m pip install -r {req_path}\n\nThis error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead.\n\nIf you are on the portable package you can run: update\\update_comfyui.bat to solve this problem" + try: import comfyui_frontend_package except ImportError: # TODO: Remove the check after roll out of 0.3.16 - req_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'requirements.txt')) - logging.error(f"\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. Please install the updated requirements.txt file by running:\n{sys.executable} -s -m pip install -r {req_path}\n\nThis error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead.\n\nIf you are on the portable package you can run: update\\update_comfyui.bat to solve this problem\n********** ERROR **********\n") + logging.error(f"\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. {frontend_install_warning_message()}\n********** ERROR **********\n") exit(-1) diff --git a/main.py b/main.py index 57fa397e6..6fa1cfb0f 100644 --- a/main.py +++ b/main.py @@ -293,14 +293,29 @@ def start_comfyui(asyncio_loop=None): return asyncio_loop, prompt_server, start_all +def warn_frontend_version(frontend_version): + try: + required_frontend = (0,) + req_path = os.path.join(os.path.dirname(__file__), 'requirements.txt') + with open(req_path, 'r') as f: + required_frontend = tuple(map(int, f.readline().split('=')[-1].split('.'))) + if frontend_version < required_frontend: + logging.warning("________________________________________________________________________\nWARNING WARNING WARNING WARNING WARNING\n\nInstalled frontend version {} is lower than the recommended version {}.\n\n{}\n________________________________________________________________________".format('.'.join(map(str, frontend_version)), '.'.join(map(str, required_frontend)), app.frontend_management.frontend_install_warning_message())) + except: + pass + + if __name__ == "__main__": # Running directly, just start ComfyUI. logging.info("ComfyUI version: {}".format(comfyui_version.__version__)) - logging.info("ComfyUI frontend version: {}".format('.'.join(map(str, app.frontend_management.frontend_version)))) + frontend_version = app.frontend_management.frontend_version + logging.info("ComfyUI frontend version: {}".format('.'.join(map(str, frontend_version)))) event_loop, _, start_all_func = start_comfyui() try: - event_loop.run_until_complete(start_all_func()) + x = start_all_func() + warn_frontend_version(frontend_version) + event_loop.run_until_complete(x) except KeyboardInterrupt: logging.info("\nStopped server") From 0952569493f0f57a59a4a8aaad439949d9d4ef2e Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 8 Mar 2025 20:24:04 -0500 Subject: [PATCH 203/478] Fix stable cascade VAE on some lowvram machines. --- comfy/ldm/cascade/stage_a.py | 28 ++++++++++++++++------------ comfy/ldm/cascade/stage_c_coder.py | 25 ++++++++++++++----------- comfy/model_management.py | 2 +- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/comfy/ldm/cascade/stage_a.py b/comfy/ldm/cascade/stage_a.py index ca8867eaf..145e6e69a 100644 --- a/comfy/ldm/cascade/stage_a.py +++ b/comfy/ldm/cascade/stage_a.py @@ -19,6 +19,10 @@ import torch from torch import nn from torch.autograd import Function +import comfy.ops + +ops = comfy.ops.disable_weight_init + class vector_quantize(Function): @staticmethod @@ -121,15 +125,15 @@ class ResBlock(nn.Module): self.norm1 = nn.LayerNorm(c, elementwise_affine=False, eps=1e-6) self.depthwise = nn.Sequential( nn.ReplicationPad2d(1), - nn.Conv2d(c, c, kernel_size=3, groups=c) + ops.Conv2d(c, c, kernel_size=3, groups=c) ) # channelwise self.norm2 = nn.LayerNorm(c, elementwise_affine=False, eps=1e-6) self.channelwise = nn.Sequential( - nn.Linear(c, c_hidden), + ops.Linear(c, c_hidden), nn.GELU(), - nn.Linear(c_hidden, c), + ops.Linear(c_hidden, c), ) self.gammas = nn.Parameter(torch.zeros(6), requires_grad=True) @@ -171,16 +175,16 @@ class StageA(nn.Module): # Encoder blocks self.in_block = nn.Sequential( nn.PixelUnshuffle(2), - nn.Conv2d(3 * 4, c_levels[0], kernel_size=1) + ops.Conv2d(3 * 4, c_levels[0], kernel_size=1) ) down_blocks = [] for i in range(levels): if i > 0: - down_blocks.append(nn.Conv2d(c_levels[i - 1], c_levels[i], kernel_size=4, stride=2, padding=1)) + down_blocks.append(ops.Conv2d(c_levels[i - 1], c_levels[i], kernel_size=4, stride=2, padding=1)) block = ResBlock(c_levels[i], c_levels[i] * 4) down_blocks.append(block) down_blocks.append(nn.Sequential( - nn.Conv2d(c_levels[-1], c_latent, kernel_size=1, bias=False), + ops.Conv2d(c_levels[-1], c_latent, kernel_size=1, bias=False), nn.BatchNorm2d(c_latent), # then normalize them to have mean 0 and std 1 )) self.down_blocks = nn.Sequential(*down_blocks) @@ -191,7 +195,7 @@ class StageA(nn.Module): # Decoder blocks up_blocks = [nn.Sequential( - nn.Conv2d(c_latent, c_levels[-1], kernel_size=1) + ops.Conv2d(c_latent, c_levels[-1], kernel_size=1) )] for i in range(levels): for j in range(bottleneck_blocks if i == 0 else 1): @@ -199,11 +203,11 @@ class StageA(nn.Module): up_blocks.append(block) if i < levels - 1: up_blocks.append( - nn.ConvTranspose2d(c_levels[levels - 1 - i], c_levels[levels - 2 - i], kernel_size=4, stride=2, + ops.ConvTranspose2d(c_levels[levels - 1 - i], c_levels[levels - 2 - i], kernel_size=4, stride=2, padding=1)) self.up_blocks = nn.Sequential(*up_blocks) self.out_block = nn.Sequential( - nn.Conv2d(c_levels[0], 3 * 4, kernel_size=1), + ops.Conv2d(c_levels[0], 3 * 4, kernel_size=1), nn.PixelShuffle(2), ) @@ -232,17 +236,17 @@ class Discriminator(nn.Module): super().__init__() d = max(depth - 3, 3) layers = [ - nn.utils.spectral_norm(nn.Conv2d(c_in, c_hidden // (2 ** d), kernel_size=3, stride=2, padding=1)), + nn.utils.spectral_norm(ops.Conv2d(c_in, c_hidden // (2 ** d), kernel_size=3, stride=2, padding=1)), nn.LeakyReLU(0.2), ] for i in range(depth - 1): c_in = c_hidden // (2 ** max((d - i), 0)) c_out = c_hidden // (2 ** max((d - 1 - i), 0)) - layers.append(nn.utils.spectral_norm(nn.Conv2d(c_in, c_out, kernel_size=3, stride=2, padding=1))) + layers.append(nn.utils.spectral_norm(ops.Conv2d(c_in, c_out, kernel_size=3, stride=2, padding=1))) layers.append(nn.InstanceNorm2d(c_out)) layers.append(nn.LeakyReLU(0.2)) self.encoder = nn.Sequential(*layers) - self.shuffle = nn.Conv2d((c_hidden + c_cond) if c_cond > 0 else c_hidden, 1, kernel_size=1) + self.shuffle = ops.Conv2d((c_hidden + c_cond) if c_cond > 0 else c_hidden, 1, kernel_size=1) self.logits = nn.Sigmoid() def forward(self, x, cond=None): diff --git a/comfy/ldm/cascade/stage_c_coder.py b/comfy/ldm/cascade/stage_c_coder.py index 0cb7c49fc..b467a70a8 100644 --- a/comfy/ldm/cascade/stage_c_coder.py +++ b/comfy/ldm/cascade/stage_c_coder.py @@ -19,6 +19,9 @@ import torch import torchvision from torch import nn +import comfy.ops + +ops = comfy.ops.disable_weight_init # EfficientNet class EfficientNetEncoder(nn.Module): @@ -26,7 +29,7 @@ class EfficientNetEncoder(nn.Module): super().__init__() self.backbone = torchvision.models.efficientnet_v2_s().features.eval() self.mapper = nn.Sequential( - nn.Conv2d(1280, c_latent, kernel_size=1, bias=False), + ops.Conv2d(1280, c_latent, kernel_size=1, bias=False), nn.BatchNorm2d(c_latent, affine=False), # then normalize them to have mean 0 and std 1 ) self.mean = nn.Parameter(torch.tensor([0.485, 0.456, 0.406])) @@ -34,7 +37,7 @@ class EfficientNetEncoder(nn.Module): def forward(self, x): x = x * 0.5 + 0.5 - x = (x - self.mean.view([3,1,1])) / self.std.view([3,1,1]) + x = (x - self.mean.view([3,1,1]).to(device=x.device, dtype=x.dtype)) / self.std.view([3,1,1]).to(device=x.device, dtype=x.dtype) o = self.mapper(self.backbone(x)) return o @@ -44,39 +47,39 @@ class Previewer(nn.Module): def __init__(self, c_in=16, c_hidden=512, c_out=3): super().__init__() self.blocks = nn.Sequential( - nn.Conv2d(c_in, c_hidden, kernel_size=1), # 16 channels to 512 channels + ops.Conv2d(c_in, c_hidden, kernel_size=1), # 16 channels to 512 channels nn.GELU(), nn.BatchNorm2d(c_hidden), - nn.Conv2d(c_hidden, c_hidden, kernel_size=3, padding=1), + ops.Conv2d(c_hidden, c_hidden, kernel_size=3, padding=1), nn.GELU(), nn.BatchNorm2d(c_hidden), - nn.ConvTranspose2d(c_hidden, c_hidden // 2, kernel_size=2, stride=2), # 16 -> 32 + ops.ConvTranspose2d(c_hidden, c_hidden // 2, kernel_size=2, stride=2), # 16 -> 32 nn.GELU(), nn.BatchNorm2d(c_hidden // 2), - nn.Conv2d(c_hidden // 2, c_hidden // 2, kernel_size=3, padding=1), + ops.Conv2d(c_hidden // 2, c_hidden // 2, kernel_size=3, padding=1), nn.GELU(), nn.BatchNorm2d(c_hidden // 2), - nn.ConvTranspose2d(c_hidden // 2, c_hidden // 4, kernel_size=2, stride=2), # 32 -> 64 + ops.ConvTranspose2d(c_hidden // 2, c_hidden // 4, kernel_size=2, stride=2), # 32 -> 64 nn.GELU(), nn.BatchNorm2d(c_hidden // 4), - nn.Conv2d(c_hidden // 4, c_hidden // 4, kernel_size=3, padding=1), + ops.Conv2d(c_hidden // 4, c_hidden // 4, kernel_size=3, padding=1), nn.GELU(), nn.BatchNorm2d(c_hidden // 4), - nn.ConvTranspose2d(c_hidden // 4, c_hidden // 4, kernel_size=2, stride=2), # 64 -> 128 + ops.ConvTranspose2d(c_hidden // 4, c_hidden // 4, kernel_size=2, stride=2), # 64 -> 128 nn.GELU(), nn.BatchNorm2d(c_hidden // 4), - nn.Conv2d(c_hidden // 4, c_hidden // 4, kernel_size=3, padding=1), + ops.Conv2d(c_hidden // 4, c_hidden // 4, kernel_size=3, padding=1), nn.GELU(), nn.BatchNorm2d(c_hidden // 4), - nn.Conv2d(c_hidden // 4, c_out, kernel_size=1), + ops.Conv2d(c_hidden // 4, c_out, kernel_size=1), ) def forward(self, x): diff --git a/comfy/model_management.py b/comfy/model_management.py index bc90e3dff..3a4c93e30 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -581,7 +581,7 @@ def load_models_gpu(models, memory_required=0, force_patch_weights=False, minimu loaded_memory = loaded_model.model_loaded_memory() current_free_mem = get_free_memory(torch_dev) + loaded_memory - lowvram_model_memory = max(64 * 1024 * 1024, (current_free_mem - minimum_memory_required), min(current_free_mem * MIN_WEIGHT_MEMORY_RATIO, current_free_mem - minimum_inference_memory())) + lowvram_model_memory = max(128 * 1024 * 1024, (current_free_mem - minimum_memory_required), min(current_free_mem * MIN_WEIGHT_MEMORY_RATIO, current_free_mem - minimum_inference_memory())) lowvram_model_memory = max(0.1, lowvram_model_memory - loaded_memory) if vram_set_state == VRAMState.NO_VRAM: From 7395b0c0d1ae8ed8867b78135ddc5436deaeaaa4 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 8 Mar 2025 20:25:14 -0500 Subject: [PATCH 204/478] Support new hunyuan video i2v model. Use the new "v2 (replace)" guidance type in HunyuanImageToVideo and set image_interleave to 4 on the "Text Encode Hunyuan Video" node. --- comfy/ldm/flux/layers.py | 47 ++++++++++++++++++++++---------- comfy/ldm/hunyuan_video/model.py | 21 ++++++++++---- comfy/model_base.py | 11 ++++++++ comfy_extras/nodes_hunyuan.py | 17 +++++++++--- 4 files changed, 72 insertions(+), 24 deletions(-) diff --git a/comfy/ldm/flux/layers.py b/comfy/ldm/flux/layers.py index 59a62e0df..1b3e9f313 100644 --- a/comfy/ldm/flux/layers.py +++ b/comfy/ldm/flux/layers.py @@ -105,7 +105,9 @@ class Modulation(nn.Module): self.lin = operations.Linear(dim, self.multiplier * dim, bias=True, dtype=dtype, device=device) def forward(self, vec: Tensor) -> tuple: - out = self.lin(nn.functional.silu(vec))[:, None, :].chunk(self.multiplier, dim=-1) + if vec.ndim == 2: + vec = vec[:, None, :] + out = self.lin(nn.functional.silu(vec)).chunk(self.multiplier, dim=-1) return ( ModulationOut(*out[:3]), @@ -113,6 +115,20 @@ class Modulation(nn.Module): ) +def apply_mod(tensor, m_mult, m_add=None, modulation_dims=None): + if modulation_dims is None: + if m_add is not None: + return tensor * m_mult + m_add + else: + return tensor * m_mult + else: + for d in modulation_dims: + tensor[:, d[0]:d[1]] *= m_mult[:, d[2]] + if m_add is not None: + tensor[:, d[0]:d[1]] += m_add[:, d[2]] + return tensor + + class DoubleStreamBlock(nn.Module): def __init__(self, hidden_size: int, num_heads: int, mlp_ratio: float, qkv_bias: bool = False, flipped_img_txt=False, dtype=None, device=None, operations=None): super().__init__() @@ -143,20 +159,20 @@ class DoubleStreamBlock(nn.Module): ) self.flipped_img_txt = flipped_img_txt - def forward(self, img: Tensor, txt: Tensor, vec: Tensor, pe: Tensor, attn_mask=None): + def forward(self, img: Tensor, txt: Tensor, vec: Tensor, pe: Tensor, attn_mask=None, modulation_dims=None): img_mod1, img_mod2 = self.img_mod(vec) txt_mod1, txt_mod2 = self.txt_mod(vec) # prepare image for attention img_modulated = self.img_norm1(img) - img_modulated = (1 + img_mod1.scale) * img_modulated + img_mod1.shift + img_modulated = apply_mod(img_modulated, (1 + img_mod1.scale), img_mod1.shift, modulation_dims) img_qkv = self.img_attn.qkv(img_modulated) img_q, img_k, img_v = img_qkv.view(img_qkv.shape[0], img_qkv.shape[1], 3, self.num_heads, -1).permute(2, 0, 3, 1, 4) img_q, img_k = self.img_attn.norm(img_q, img_k, img_v) # prepare txt for attention txt_modulated = self.txt_norm1(txt) - txt_modulated = (1 + txt_mod1.scale) * txt_modulated + txt_mod1.shift + txt_modulated = apply_mod(txt_modulated, (1 + txt_mod1.scale), txt_mod1.shift, modulation_dims) txt_qkv = self.txt_attn.qkv(txt_modulated) txt_q, txt_k, txt_v = txt_qkv.view(txt_qkv.shape[0], txt_qkv.shape[1], 3, self.num_heads, -1).permute(2, 0, 3, 1, 4) txt_q, txt_k = self.txt_attn.norm(txt_q, txt_k, txt_v) @@ -179,12 +195,12 @@ class DoubleStreamBlock(nn.Module): txt_attn, img_attn = attn[:, : txt.shape[1]], attn[:, txt.shape[1]:] # calculate the img bloks - img = img + img_mod1.gate * self.img_attn.proj(img_attn) - img = img + img_mod2.gate * self.img_mlp((1 + img_mod2.scale) * self.img_norm2(img) + img_mod2.shift) + img = img + apply_mod(self.img_attn.proj(img_attn), img_mod1.gate, None, modulation_dims) + img = img + apply_mod(self.img_mlp(apply_mod(self.img_norm2(img), (1 + img_mod2.scale), img_mod2.shift, modulation_dims)), img_mod2.gate, None, modulation_dims) # calculate the txt bloks - txt += txt_mod1.gate * self.txt_attn.proj(txt_attn) - txt += txt_mod2.gate * self.txt_mlp((1 + txt_mod2.scale) * self.txt_norm2(txt) + txt_mod2.shift) + txt += apply_mod(self.txt_attn.proj(txt_attn), txt_mod1.gate, None, modulation_dims) + txt += apply_mod(self.txt_mlp(apply_mod(self.txt_norm2(txt), (1 + txt_mod2.scale), txt_mod2.shift, modulation_dims)), txt_mod2.gate, None, modulation_dims) if txt.dtype == torch.float16: txt = torch.nan_to_num(txt, nan=0.0, posinf=65504, neginf=-65504) @@ -228,9 +244,9 @@ class SingleStreamBlock(nn.Module): self.mlp_act = nn.GELU(approximate="tanh") self.modulation = Modulation(hidden_size, double=False, dtype=dtype, device=device, operations=operations) - def forward(self, x: Tensor, vec: Tensor, pe: Tensor, attn_mask=None) -> Tensor: + def forward(self, x: Tensor, vec: Tensor, pe: Tensor, attn_mask=None, modulation_dims=None) -> Tensor: mod, _ = self.modulation(vec) - qkv, mlp = torch.split(self.linear1((1 + mod.scale) * self.pre_norm(x) + mod.shift), [3 * self.hidden_size, self.mlp_hidden_dim], dim=-1) + qkv, mlp = torch.split(self.linear1(apply_mod(self.pre_norm(x), (1 + mod.scale), mod.shift, modulation_dims)), [3 * self.hidden_size, self.mlp_hidden_dim], dim=-1) q, k, v = qkv.view(qkv.shape[0], qkv.shape[1], 3, self.num_heads, -1).permute(2, 0, 3, 1, 4) q, k = self.norm(q, k, v) @@ -239,7 +255,7 @@ class SingleStreamBlock(nn.Module): attn = attention(q, k, v, pe=pe, mask=attn_mask) # compute activation in mlp stream, cat again and run second linear layer output = self.linear2(torch.cat((attn, self.mlp_act(mlp)), 2)) - x += mod.gate * output + x += apply_mod(output, mod.gate, None, modulation_dims) if x.dtype == torch.float16: x = torch.nan_to_num(x, nan=0.0, posinf=65504, neginf=-65504) return x @@ -252,8 +268,11 @@ class LastLayer(nn.Module): self.linear = operations.Linear(hidden_size, patch_size * patch_size * out_channels, bias=True, dtype=dtype, device=device) self.adaLN_modulation = nn.Sequential(nn.SiLU(), operations.Linear(hidden_size, 2 * hidden_size, bias=True, dtype=dtype, device=device)) - def forward(self, x: Tensor, vec: Tensor) -> Tensor: - shift, scale = self.adaLN_modulation(vec).chunk(2, dim=1) - x = (1 + scale[:, None, :]) * self.norm_final(x) + shift[:, None, :] + def forward(self, x: Tensor, vec: Tensor, modulation_dims=None) -> Tensor: + if vec.ndim == 2: + vec = vec[:, None, :] + + shift, scale = self.adaLN_modulation(vec).chunk(2, dim=-1) + x = apply_mod(self.norm_final(x), (1 + scale), shift, modulation_dims) x = self.linear(x) return x diff --git a/comfy/ldm/hunyuan_video/model.py b/comfy/ldm/hunyuan_video/model.py index f3f445843..001e302b5 100644 --- a/comfy/ldm/hunyuan_video/model.py +++ b/comfy/ldm/hunyuan_video/model.py @@ -227,6 +227,7 @@ class HunyuanVideo(nn.Module): timesteps: Tensor, y: Tensor, guidance: Tensor = None, + guiding_frame_index=None, control=None, transformer_options={}, ) -> Tensor: @@ -237,7 +238,15 @@ class HunyuanVideo(nn.Module): img = self.img_in(img) vec = self.time_in(timestep_embedding(timesteps, 256, time_factor=1.0).to(img.dtype)) - vec = vec + self.vector_in(y[:, :self.params.vec_in_dim]) + if guiding_frame_index is not None: + token_replace_vec = self.time_in(timestep_embedding(guiding_frame_index, 256, time_factor=1.0)) + vec_ = self.vector_in(y[:, :self.params.vec_in_dim]) + vec = torch.cat([(vec_ + token_replace_vec).unsqueeze(1), (vec_ + vec).unsqueeze(1)], dim=1) + frame_tokens = (initial_shape[-1] // self.patch_size[-1]) * (initial_shape[-2] // self.patch_size[-2]) + modulation_dims = [(0, frame_tokens, 0), (frame_tokens, None, 1)] + else: + vec = vec + self.vector_in(y[:, :self.params.vec_in_dim]) + modulation_dims = None if self.params.guidance_embed: if guidance is not None: @@ -271,7 +280,7 @@ class HunyuanVideo(nn.Module): txt = out["txt"] img = out["img"] else: - img, txt = block(img=img, txt=txt, vec=vec, pe=pe, attn_mask=attn_mask) + img, txt = block(img=img, txt=txt, vec=vec, pe=pe, attn_mask=attn_mask, modulation_dims=modulation_dims) if control is not None: # Controlnet control_i = control.get("input") @@ -292,7 +301,7 @@ class HunyuanVideo(nn.Module): out = blocks_replace[("single_block", i)]({"img": img, "vec": vec, "pe": pe, "attention_mask": attn_mask}, {"original_block": block_wrap}) img = out["img"] else: - img = block(img, vec=vec, pe=pe, attn_mask=attn_mask) + img = block(img, vec=vec, pe=pe, attn_mask=attn_mask, modulation_dims=modulation_dims) if control is not None: # Controlnet control_o = control.get("output") @@ -303,7 +312,7 @@ class HunyuanVideo(nn.Module): img = img[:, : img_len] - img = self.final_layer(img, vec) # (N, T, patch_size ** 2 * out_channels) + img = self.final_layer(img, vec, modulation_dims=modulation_dims) # (N, T, patch_size ** 2 * out_channels) shape = initial_shape[-3:] for i in range(len(shape)): @@ -313,7 +322,7 @@ class HunyuanVideo(nn.Module): img = img.reshape(initial_shape[0], self.out_channels, initial_shape[2], initial_shape[3], initial_shape[4]) return img - def forward(self, x, timestep, context, y, guidance=None, attention_mask=None, control=None, transformer_options={}, **kwargs): + def forward(self, x, timestep, context, y, guidance=None, attention_mask=None, guiding_frame_index=None, control=None, transformer_options={}, **kwargs): bs, c, t, h, w = x.shape patch_size = self.patch_size t_len = ((t + (patch_size[0] // 2)) // patch_size[0]) @@ -325,5 +334,5 @@ class HunyuanVideo(nn.Module): img_ids[:, :, :, 2] = img_ids[:, :, :, 2] + torch.linspace(0, w_len - 1, steps=w_len, device=x.device, dtype=x.dtype).reshape(1, 1, -1) img_ids = repeat(img_ids, "t h w c -> b (t h w) c", b=bs) txt_ids = torch.zeros((bs, context.shape[1], 3), device=x.device, dtype=x.dtype) - out = self.forward_orig(x, img_ids, context, txt_ids, attention_mask, timestep, y, guidance, control, transformer_options) + out = self.forward_orig(x, img_ids, context, txt_ids, attention_mask, timestep, y, guidance, guiding_frame_index, control, transformer_options) return out diff --git a/comfy/model_base.py b/comfy/model_base.py index 2fa1ee911..bf4ebefa1 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -898,20 +898,31 @@ class HunyuanVideo(BaseModel): guidance = kwargs.get("guidance", 6.0) if guidance is not None: out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor([guidance])) + + guiding_frame_index = kwargs.get("guiding_frame_index", None) + if guiding_frame_index is not None: + out['guiding_frame_index'] = comfy.conds.CONDRegular(torch.FloatTensor([guiding_frame_index])) + return out + def scale_latent_inpaint(self, latent_image, **kwargs): + return latent_image class HunyuanVideoI2V(HunyuanVideo): def __init__(self, model_config, model_type=ModelType.FLOW, device=None): super().__init__(model_config, model_type, device=device) self.concat_keys = ("concat_image", "mask_inverted") + def scale_latent_inpaint(self, latent_image, **kwargs): + return super().scale_latent_inpaint(latent_image=latent_image, **kwargs) class HunyuanVideoSkyreelsI2V(HunyuanVideo): def __init__(self, model_config, model_type=ModelType.FLOW, device=None): super().__init__(model_config, model_type, device=device) self.concat_keys = ("concat_image",) + def scale_latent_inpaint(self, latent_image, **kwargs): + return super().scale_latent_inpaint(latent_image=latent_image, **kwargs) class CosmosVideo(BaseModel): def __init__(self, model_config, model_type=ModelType.EDM, image_to_video=False, device=None): diff --git a/comfy_extras/nodes_hunyuan.py b/comfy_extras/nodes_hunyuan.py index 56aef9b01..504010ad0 100644 --- a/comfy_extras/nodes_hunyuan.py +++ b/comfy_extras/nodes_hunyuan.py @@ -68,7 +68,6 @@ class TextEncodeHunyuanVideo_ImageToVideo: tokens = clip.tokenize(prompt, llama_template=PROMPT_TEMPLATE_ENCODE_VIDEO_I2V, image_embeds=clip_vision_output.mm_projected, image_interleave=image_interleave) return (clip.encode_from_tokens_scheduled(tokens), ) - class HunyuanImageToVideo: @classmethod def INPUT_TYPES(s): @@ -78,6 +77,7 @@ class HunyuanImageToVideo: "height": ("INT", {"default": 480, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), "length": ("INT", {"default": 53, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}), "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), + "guidance_type": (["v1 (concat)", "v2 (replace)"], ) }, "optional": {"start_image": ("IMAGE", ), }} @@ -88,8 +88,10 @@ class HunyuanImageToVideo: CATEGORY = "conditioning/video_models" - def encode(self, positive, vae, width, height, length, batch_size, start_image=None): + def encode(self, positive, vae, width, height, length, batch_size, guidance_type, start_image=None): latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) + out_latent = {} + if start_image is not None: start_image = comfy.utils.common_upscale(start_image[:length, :, :, :3].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) @@ -97,13 +99,20 @@ class HunyuanImageToVideo: mask = torch.ones((1, 1, latent.shape[2], concat_latent_image.shape[-2], concat_latent_image.shape[-1]), device=start_image.device, dtype=start_image.dtype) mask[:, :, :((start_image.shape[0] - 1) // 4) + 1] = 0.0 - positive = node_helpers.conditioning_set_values(positive, {"concat_latent_image": concat_latent_image, "concat_mask": mask}) + if guidance_type == "v1 (concat)": + cond = {"concat_latent_image": concat_latent_image, "concat_mask": mask} + else: + cond = {'guiding_frame_index': 0} + latent[:, :, :concat_latent_image.shape[2]] = concat_latent_image + out_latent["noise_mask"] = mask + + positive = node_helpers.conditioning_set_values(positive, cond) - out_latent = {} out_latent["samples"] = latent return (positive, out_latent) + NODE_CLASS_MAPPINGS = { "CLIPTextEncodeHunyuanDiT": CLIPTextEncodeHunyuanDiT, "TextEncodeHunyuanVideo_ImageToVideo": TextEncodeHunyuanVideo_ImageToVideo, From 2bc4b5968f7fbf0b6e65f2465b064c6af48f965a Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 9 Mar 2025 03:30:20 -0400 Subject: [PATCH 205/478] ComfyUI version v0.3.25 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index a68a65323..9cf4c13fa 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.24" +__version__ = "0.3.25" diff --git a/pyproject.toml b/pyproject.toml index 4c11c71bb..3b53d1492 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.24" +version = "0.3.25" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 528d1b35638ad4a5d08b8584f7bacb19afe785cc Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Sun, 9 Mar 2025 03:26:31 -0500 Subject: [PATCH 206/478] When cached_hook_patches contain weights for hooks, only use hook_backup for unused keys (#7067) --- comfy/model_patcher.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py index 8a1f8fb63..e291158ce 100644 --- a/comfy/model_patcher.py +++ b/comfy/model_patcher.py @@ -1089,7 +1089,6 @@ class ModelPatcher: def patch_hooks(self, hooks: comfy.hooks.HookGroup): with self.use_ejected(): - self.unpatch_hooks() if hooks is not None: model_sd_keys = list(self.model_state_dict().keys()) memory_counter = None @@ -1100,12 +1099,16 @@ class ModelPatcher: # if have cached weights for hooks, use it cached_weights = self.cached_hook_patches.get(hooks, None) if cached_weights is not None: + model_sd_keys_set = set(model_sd_keys) for key in cached_weights: if key not in model_sd_keys: logging.warning(f"Cached hook could not patch. Key does not exist in model: {key}") continue self.patch_cached_hook_weights(cached_weights=cached_weights, key=key, memory_counter=memory_counter) + model_sd_keys_set.remove(key) + self.unpatch_hooks(model_sd_keys_set) else: + self.unpatch_hooks() relevant_patches = self.get_combined_hook_patches(hooks=hooks) original_weights = None if len(relevant_patches) > 0: @@ -1116,6 +1119,8 @@ class ModelPatcher: continue self.patch_hook_weight_to_device(hooks=hooks, combined_patches=relevant_patches, key=key, original_weights=original_weights, memory_counter=memory_counter) + else: + self.unpatch_hooks() self.current_hooks = hooks def patch_cached_hook_weights(self, cached_weights: dict, key: str, memory_counter: MemoryCounter): @@ -1172,17 +1177,23 @@ class ModelPatcher: del out_weight del weight - def unpatch_hooks(self) -> None: + def unpatch_hooks(self, whitelist_keys_set: set[str]=None) -> None: with self.use_ejected(): if len(self.hook_backup) == 0: self.current_hooks = None return keys = list(self.hook_backup.keys()) - for k in keys: - comfy.utils.copy_to_param(self.model, k, self.hook_backup[k][0].to(device=self.hook_backup[k][1])) + if whitelist_keys_set: + for k in keys: + if k in whitelist_keys_set: + comfy.utils.copy_to_param(self.model, k, self.hook_backup[k][0].to(device=self.hook_backup[k][1])) + self.hook_backup.pop(k) + else: + for k in keys: + comfy.utils.copy_to_param(self.model, k, self.hook_backup[k][0].to(device=self.hook_backup[k][1])) - self.hook_backup.clear() - self.current_hooks = None + self.hook_backup.clear() + self.current_hooks = None def clean_hooks(self): self.unpatch_hooks() From 9aac21f894a122ddb8d825c57ad61c0db5e630db Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 9 Mar 2025 04:59:15 -0400 Subject: [PATCH 207/478] Fix issues with new hunyuan img2vid model and bumb version to v0.3.26 --- comfy/ldm/flux/layers.py | 14 +++++++------- comfy/ldm/hunyuan_video/model.py | 12 +++++++----- comfyui_version.py | 2 +- pyproject.toml | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/comfy/ldm/flux/layers.py b/comfy/ldm/flux/layers.py index 1b3e9f313..76af967e6 100644 --- a/comfy/ldm/flux/layers.py +++ b/comfy/ldm/flux/layers.py @@ -159,20 +159,20 @@ class DoubleStreamBlock(nn.Module): ) self.flipped_img_txt = flipped_img_txt - def forward(self, img: Tensor, txt: Tensor, vec: Tensor, pe: Tensor, attn_mask=None, modulation_dims=None): + def forward(self, img: Tensor, txt: Tensor, vec: Tensor, pe: Tensor, attn_mask=None, modulation_dims_img=None, modulation_dims_txt=None): img_mod1, img_mod2 = self.img_mod(vec) txt_mod1, txt_mod2 = self.txt_mod(vec) # prepare image for attention img_modulated = self.img_norm1(img) - img_modulated = apply_mod(img_modulated, (1 + img_mod1.scale), img_mod1.shift, modulation_dims) + img_modulated = apply_mod(img_modulated, (1 + img_mod1.scale), img_mod1.shift, modulation_dims_img) img_qkv = self.img_attn.qkv(img_modulated) img_q, img_k, img_v = img_qkv.view(img_qkv.shape[0], img_qkv.shape[1], 3, self.num_heads, -1).permute(2, 0, 3, 1, 4) img_q, img_k = self.img_attn.norm(img_q, img_k, img_v) # prepare txt for attention txt_modulated = self.txt_norm1(txt) - txt_modulated = apply_mod(txt_modulated, (1 + txt_mod1.scale), txt_mod1.shift, modulation_dims) + txt_modulated = apply_mod(txt_modulated, (1 + txt_mod1.scale), txt_mod1.shift, modulation_dims_txt) txt_qkv = self.txt_attn.qkv(txt_modulated) txt_q, txt_k, txt_v = txt_qkv.view(txt_qkv.shape[0], txt_qkv.shape[1], 3, self.num_heads, -1).permute(2, 0, 3, 1, 4) txt_q, txt_k = self.txt_attn.norm(txt_q, txt_k, txt_v) @@ -195,12 +195,12 @@ class DoubleStreamBlock(nn.Module): txt_attn, img_attn = attn[:, : txt.shape[1]], attn[:, txt.shape[1]:] # calculate the img bloks - img = img + apply_mod(self.img_attn.proj(img_attn), img_mod1.gate, None, modulation_dims) - img = img + apply_mod(self.img_mlp(apply_mod(self.img_norm2(img), (1 + img_mod2.scale), img_mod2.shift, modulation_dims)), img_mod2.gate, None, modulation_dims) + img = img + apply_mod(self.img_attn.proj(img_attn), img_mod1.gate, None, modulation_dims_img) + img = img + apply_mod(self.img_mlp(apply_mod(self.img_norm2(img), (1 + img_mod2.scale), img_mod2.shift, modulation_dims_img)), img_mod2.gate, None, modulation_dims_img) # calculate the txt bloks - txt += apply_mod(self.txt_attn.proj(txt_attn), txt_mod1.gate, None, modulation_dims) - txt += apply_mod(self.txt_mlp(apply_mod(self.txt_norm2(txt), (1 + txt_mod2.scale), txt_mod2.shift, modulation_dims)), txt_mod2.gate, None, modulation_dims) + txt += apply_mod(self.txt_attn.proj(txt_attn), txt_mod1.gate, None, modulation_dims_txt) + txt += apply_mod(self.txt_mlp(apply_mod(self.txt_norm2(txt), (1 + txt_mod2.scale), txt_mod2.shift, modulation_dims_txt)), txt_mod2.gate, None, modulation_dims_txt) if txt.dtype == torch.float16: txt = torch.nan_to_num(txt, nan=0.0, posinf=65504, neginf=-65504) diff --git a/comfy/ldm/hunyuan_video/model.py b/comfy/ldm/hunyuan_video/model.py index 001e302b5..72af3d5bb 100644 --- a/comfy/ldm/hunyuan_video/model.py +++ b/comfy/ldm/hunyuan_video/model.py @@ -244,9 +244,11 @@ class HunyuanVideo(nn.Module): vec = torch.cat([(vec_ + token_replace_vec).unsqueeze(1), (vec_ + vec).unsqueeze(1)], dim=1) frame_tokens = (initial_shape[-1] // self.patch_size[-1]) * (initial_shape[-2] // self.patch_size[-2]) modulation_dims = [(0, frame_tokens, 0), (frame_tokens, None, 1)] + modulation_dims_txt = [(0, None, 1)] else: vec = vec + self.vector_in(y[:, :self.params.vec_in_dim]) modulation_dims = None + modulation_dims_txt = None if self.params.guidance_embed: if guidance is not None: @@ -273,14 +275,14 @@ class HunyuanVideo(nn.Module): if ("double_block", i) in blocks_replace: def block_wrap(args): out = {} - out["img"], out["txt"] = block(img=args["img"], txt=args["txt"], vec=args["vec"], pe=args["pe"], attn_mask=args["attention_mask"]) + out["img"], out["txt"] = block(img=args["img"], txt=args["txt"], vec=args["vec"], pe=args["pe"], attn_mask=args["attention_mask"], modulation_dims_img=args["modulation_dims_img"], modulation_dims_txt=args["modulation_dims_txt"]) return out - out = blocks_replace[("double_block", i)]({"img": img, "txt": txt, "vec": vec, "pe": pe, "attention_mask": attn_mask}, {"original_block": block_wrap}) + out = blocks_replace[("double_block", i)]({"img": img, "txt": txt, "vec": vec, "pe": pe, "attention_mask": attn_mask, 'modulation_dims_img': modulation_dims, 'modulation_dims_txt': modulation_dims_txt}, {"original_block": block_wrap}) txt = out["txt"] img = out["img"] else: - img, txt = block(img=img, txt=txt, vec=vec, pe=pe, attn_mask=attn_mask, modulation_dims=modulation_dims) + img, txt = block(img=img, txt=txt, vec=vec, pe=pe, attn_mask=attn_mask, modulation_dims_img=modulation_dims, modulation_dims_txt=modulation_dims_txt) if control is not None: # Controlnet control_i = control.get("input") @@ -295,10 +297,10 @@ class HunyuanVideo(nn.Module): if ("single_block", i) in blocks_replace: def block_wrap(args): out = {} - out["img"] = block(args["img"], vec=args["vec"], pe=args["pe"], attn_mask=args["attention_mask"]) + out["img"] = block(args["img"], vec=args["vec"], pe=args["pe"], attn_mask=args["attention_mask"], modulation_dims=args["modulation_dims"]) return out - out = blocks_replace[("single_block", i)]({"img": img, "vec": vec, "pe": pe, "attention_mask": attn_mask}, {"original_block": block_wrap}) + out = blocks_replace[("single_block", i)]({"img": img, "vec": vec, "pe": pe, "attention_mask": attn_mask, 'modulation_dims': modulation_dims}, {"original_block": block_wrap}) img = out["img"] else: img = block(img, vec=vec, pe=pe, attn_mask=attn_mask, modulation_dims=modulation_dims) diff --git a/comfyui_version.py b/comfyui_version.py index 9cf4c13fa..b5e6fbead 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.25" +__version__ = "0.3.26" diff --git a/pyproject.toml b/pyproject.toml index 3b53d1492..f13fed8dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.25" +version = "0.3.26" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From a73410aafa573940ebaba9a9a908476a538a8981 Mon Sep 17 00:00:00 2001 From: bymyself Date: Sun, 9 Mar 2025 03:46:08 -0700 Subject: [PATCH 208/478] remove overrides --- nodes.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/nodes.py b/nodes.py index bbf49915c..e43c29295 100644 --- a/nodes.py +++ b/nodes.py @@ -1785,14 +1785,7 @@ class LoadImageOutput(LoadImage): DESCRIPTION = "Load an image from the output folder. When the refresh button is clicked, the node will update the image list and automatically select the first image, allowing for easy iteration." EXPERIMENTAL = True - FUNCTION = "load_image_output" - - def load_image_output(self, image): - return self.load_image(f"{image} [output]") - - @classmethod - def VALIDATE_INPUTS(s, image): - return True + FUNCTION = "load_image" class ImageScale: From e1da98a14a21f5d4af31935832437b55e81d2399 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Sun, 9 Mar 2025 14:07:09 -0400 Subject: [PATCH 209/478] remove unused params (#6931) --- comfy_extras/nodes_load_3d.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/comfy_extras/nodes_load_3d.py b/comfy_extras/nodes_load_3d.py index 53a66b95a..8b43cf218 100644 --- a/comfy_extras/nodes_load_3d.py +++ b/comfy_extras/nodes_load_3d.py @@ -19,8 +19,6 @@ class Load3D(): "image": ("LOAD_3D", {}), "width": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), - "material": (["original", "normal", "wireframe", "depth"],), - "up_direction": (["original", "-x", "+x", "-y", "+y", "-z", "+z"],), }} RETURN_TYPES = ("IMAGE", "MASK", "STRING") @@ -55,8 +53,6 @@ class Load3DAnimation(): "image": ("LOAD_3D_ANIMATION", {}), "width": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), - "material": (["original", "normal", "wireframe", "depth"],), - "up_direction": (["original", "-x", "+x", "-y", "+y", "-z", "+z"],), }} RETURN_TYPES = ("IMAGE", "MASK", "STRING") @@ -82,8 +78,6 @@ class Preview3D(): def INPUT_TYPES(s): return {"required": { "model_file": ("STRING", {"default": "", "multiline": False}), - "material": (["original", "normal", "wireframe", "depth"],), - "up_direction": (["original", "-x", "+x", "-y", "+y", "-z", "+z"],), }} OUTPUT_NODE = True @@ -102,8 +96,6 @@ class Preview3DAnimation(): def INPUT_TYPES(s): return {"required": { "model_file": ("STRING", {"default": "", "multiline": False}), - "material": (["original", "normal", "wireframe", "depth"],), - "up_direction": (["original", "-x", "+x", "-y", "+y", "-z", "+z"],), }} OUTPUT_NODE = True From 6f8e766509c0c44ae2e04a79ab05a06e4467b51b Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 10 Mar 2025 03:33:17 -0400 Subject: [PATCH 210/478] Prevent custom nodes from accidentally overwriting global modules. --- nodes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index bbf49915c..43697a24d 100644 --- a/nodes.py +++ b/nodes.py @@ -2129,10 +2129,12 @@ def get_module_name(module_path: str) -> str: def load_custom_node(module_path: str, ignore=set(), module_parent="custom_nodes") -> bool: - module_name = os.path.basename(module_path) if os.path.isfile(module_path): sp = os.path.splitext(module_path) module_name = sp[0] + elif os.path.isdir(module_path): + module_name = module_path + try: logging.debug("Trying to load custom node {}".format(module_path)) if os.path.isfile(module_path): From 67c7184b7432105d2db52cc19fc82ccd4aa06fb3 Mon Sep 17 00:00:00 2001 From: Andrew Kvochko Date: Mon, 10 Mar 2025 10:11:48 +0200 Subject: [PATCH 211/478] ltxv: relax frame_idx divisibility for single frames. (#7146) This commit relaxes divisibility constraint for single-frame conditionings. For single frames, the index can be arbitrary, while multi-frame conditionings (>= 9 frames) must still be aligned to 8 frames. Co-authored-by: Andrew Kvochko --- comfy_extras/nodes_lt.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index b608b9407..fdc6c7c13 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -99,12 +99,13 @@ class LTXVAddGuide: "negative": ("CONDITIONING", ), "vae": ("VAE",), "latent": ("LATENT",), - "image": ("IMAGE", {"tooltip": "Image or video to condition the latent video on. Must be 8*n + 1 frames." \ + "image": ("IMAGE", {"tooltip": "Image or video to condition the latent video on. Must be 8*n + 1 frames." "If the video is not 8*n + 1 frames, it will be cropped to the nearest 8*n + 1 frames."}), "frame_idx": ("INT", {"default": 0, "min": -9999, "max": 9999, - "tooltip": "Frame index to start the conditioning at. Must be divisible by 8. " \ - "If a frame is not divisible by 8, it will be rounded down to the nearest multiple of 8. " \ - "Negative values are counted from the end of the video."}), + "tooltip": "Frame index to start the conditioning at. For single-frame images or " + "videos with 1-8 frames, any frame_idx value is acceptable. For videos with 9+ " + "frames, frame_idx must be divisible by 8, otherwise it will be rounded down to " + "the nearest multiple of 8. Negative values are counted from the end of the video."}), "strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}), } } @@ -127,12 +128,13 @@ class LTXVAddGuide: t = vae.encode(encode_pixels) return encode_pixels, t - def get_latent_index(self, cond, latent_length, frame_idx, scale_factors): + def get_latent_index(self, cond, latent_length, guide_length, frame_idx, scale_factors): time_scale_factor, _, _ = scale_factors _, num_keyframes = get_keyframe_idxs(cond) latent_count = latent_length - num_keyframes - frame_idx = frame_idx if frame_idx >= 0 else max((latent_count - 1) * 8 + 1 + frame_idx, 0) - frame_idx = frame_idx // time_scale_factor * time_scale_factor # frame index must be divisible by 8 + frame_idx = frame_idx if frame_idx >= 0 else max((latent_count - 1) * time_scale_factor + 1 + frame_idx, 0) + if guide_length > 1: + frame_idx = frame_idx // time_scale_factor * time_scale_factor # frame index must be divisible by 8 latent_idx = (frame_idx + time_scale_factor - 1) // time_scale_factor @@ -191,7 +193,7 @@ class LTXVAddGuide: _, _, latent_length, latent_height, latent_width = latent_image.shape image, t = self.encode(vae, latent_width, latent_height, image, scale_factors) - frame_idx, latent_idx = self.get_latent_index(positive, latent_length, frame_idx, scale_factors) + frame_idx, latent_idx = self.get_latent_index(positive, latent_length, len(image), frame_idx, scale_factors) assert latent_idx + t.shape[2] <= latent_length, "Conditioning frames exceed the length of the latent sequence." num_prefix_frames = min(self._num_prefix_frames, t.shape[2]) From 35e2dcf5d710f258f40f107f70f24a4cd58ba223 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 10 Mar 2025 06:14:43 -0400 Subject: [PATCH 212/478] Hack to fix broken manager. --- nodes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nodes.py b/nodes.py index 43697a24d..4608a0d36 100644 --- a/nodes.py +++ b/nodes.py @@ -2134,6 +2134,8 @@ def load_custom_node(module_path: str, ignore=set(), module_parent="custom_nodes module_name = sp[0] elif os.path.isdir(module_path): module_name = module_path + if module_path.endswith("comfyui-manager"): #TODO: remove this eventually + module_name = get_module_name(module_path) try: logging.debug("Trying to load custom node {}".format(module_path)) From b779349b55e79aff81a98b752f5cb486c71812db Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 10 Mar 2025 06:30:17 -0400 Subject: [PATCH 213/478] Temporarily revert fix to give time for people to update their nodes. --- nodes.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/nodes.py b/nodes.py index 4608a0d36..bbf49915c 100644 --- a/nodes.py +++ b/nodes.py @@ -2129,14 +2129,10 @@ def get_module_name(module_path: str) -> str: def load_custom_node(module_path: str, ignore=set(), module_parent="custom_nodes") -> bool: + module_name = os.path.basename(module_path) if os.path.isfile(module_path): sp = os.path.splitext(module_path) module_name = sp[0] - elif os.path.isdir(module_path): - module_name = module_path - if module_path.endswith("comfyui-manager"): #TODO: remove this eventually - module_name = get_module_name(module_path) - try: logging.debug("Trying to load custom node {}".format(module_path)) if os.path.isfile(module_path): From 1f138dd382bd4fe40c46a1fd1954dfbf0ddae924 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Mon, 10 Mar 2025 15:07:44 -0400 Subject: [PATCH 214/478] Only check frontend package if using default frontend --- app/frontend_management.py | 51 +++++++++++++++++++++++++++----------- main.py | 15 ----------- 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/app/frontend_management.py b/app/frontend_management.py index 308f71da6..f5a0358e6 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -17,27 +17,38 @@ from typing_extensions import NotRequired from comfy.cli_args import DEFAULT_VERSION_STRING +# The path to the requirements.txt file +req_path = Path(__file__).parents[1] / "requirements.txt" def frontend_install_warning_message(): - req_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'requirements.txt')) + """The warning message to display when the frontend version is not up to date.""" + extra = "" if sys.flags.no_user_site: extra = "-s " return f"Please install the updated requirements.txt file by running:\n{sys.executable} {extra}-m pip install -r {req_path}\n\nThis error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead.\n\nIf you are on the portable package you can run: update\\update_comfyui.bat to solve this problem" -try: - import comfyui_frontend_package -except ImportError: - # TODO: Remove the check after roll out of 0.3.16 - logging.error(f"\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. {frontend_install_warning_message()}\n********** ERROR **********\n") - exit(-1) +def check_frontend_version(): + """Check if the frontend version is up to date.""" + + def parse_version(version: str) -> tuple[int, int, int]: + return tuple(map(int, version.split("."))) + + try: + import comfyui_frontend_package + + frontend_version = parse_version(comfyui_frontend_package.__version__) + required_frontend = parse_version((0,)) + with open(req_path, 'r', encoding='utf-8') as f: + required_frontend = parse_version(f.readline().split('=')[-1]) + if frontend_version < required_frontend: + logging.warning("________________________________________________________________________\nWARNING WARNING WARNING WARNING WARNING\n\nInstalled frontend version {} is lower than the recommended version {}.\n\n{}\n________________________________________________________________________".format('.'.join(map(str, frontend_version)), '.'.join(map(str, required_frontend)), frontend_install_warning_message())) + else: + logging.info("ComfyUI frontend version: {}".format(comfyui_frontend_package.__version__)) + except Exception as e: + logging.error(f"Failed to check frontend version: {e}") -try: - frontend_version = tuple(map(int, comfyui_frontend_package.__version__.split("."))) -except: - frontend_version = (0,) - pass REQUEST_TIMEOUT = 10 # seconds @@ -133,9 +144,17 @@ def download_release_asset_zip(release: Release, destination_path: str) -> None: class FrontendManager: - DEFAULT_FRONTEND_PATH = str(importlib.resources.files(comfyui_frontend_package) / "static") CUSTOM_FRONTENDS_ROOT = str(Path(__file__).parents[1] / "web_custom_versions") + @classmethod + def default_frontend_path(cls) -> str: + try: + import comfyui_frontend_package + return str(importlib.resources.files(comfyui_frontend_package) / "static") + except ImportError: + logging.error(f"\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. {frontend_install_warning_message()}\n********** ERROR **********\n") + sys.exit(-1) + @classmethod def parse_version_string(cls, value: str) -> tuple[str, str, str]: """ @@ -172,7 +191,8 @@ class FrontendManager: main error source might be request timeout or invalid URL. """ if version_string == DEFAULT_VERSION_STRING: - return cls.DEFAULT_FRONTEND_PATH + check_frontend_version() + return cls.default_frontend_path() repo_owner, repo_name, version = cls.parse_version_string(version_string) @@ -225,4 +245,5 @@ class FrontendManager: except Exception as e: logging.error("Failed to initialize frontend: %s", e) logging.info("Falling back to the default frontend.") - return cls.DEFAULT_FRONTEND_PATH + check_frontend_version() + return cls.default_frontend_path() diff --git a/main.py b/main.py index 6fa1cfb0f..dbc15b8ba 100644 --- a/main.py +++ b/main.py @@ -293,28 +293,13 @@ def start_comfyui(asyncio_loop=None): return asyncio_loop, prompt_server, start_all -def warn_frontend_version(frontend_version): - try: - required_frontend = (0,) - req_path = os.path.join(os.path.dirname(__file__), 'requirements.txt') - with open(req_path, 'r') as f: - required_frontend = tuple(map(int, f.readline().split('=')[-1].split('.'))) - if frontend_version < required_frontend: - logging.warning("________________________________________________________________________\nWARNING WARNING WARNING WARNING WARNING\n\nInstalled frontend version {} is lower than the recommended version {}.\n\n{}\n________________________________________________________________________".format('.'.join(map(str, frontend_version)), '.'.join(map(str, required_frontend)), app.frontend_management.frontend_install_warning_message())) - except: - pass - - if __name__ == "__main__": # Running directly, just start ComfyUI. logging.info("ComfyUI version: {}".format(comfyui_version.__version__)) - frontend_version = app.frontend_management.frontend_version - logging.info("ComfyUI frontend version: {}".format('.'.join(map(str, frontend_version)))) event_loop, _, start_all_func = start_comfyui() try: x = start_all_func() - warn_frontend_version(frontend_version) event_loop.run_until_complete(x) except KeyboardInterrupt: logging.info("\nStopped server") From 6f6349b6a76fde39ab65d4952aa0aee7d2eade15 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Mon, 10 Mar 2025 15:10:40 -0400 Subject: [PATCH 215/478] nit --- main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/main.py b/main.py index dbc15b8ba..c6f5c3c1e 100644 --- a/main.py +++ b/main.py @@ -139,7 +139,6 @@ from server import BinaryEventTypes import nodes import comfy.model_management import comfyui_version -import app.frontend_management def cuda_malloc_warning(): From 79460497941d090bc197898dc6e9c5e4feaf0c1d Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Mon, 10 Mar 2025 15:14:40 -0400 Subject: [PATCH 216/478] nit --- app/frontend_management.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/frontend_management.py b/app/frontend_management.py index f5a0358e6..95df5dee4 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -39,9 +39,8 @@ def check_frontend_version(): import comfyui_frontend_package frontend_version = parse_version(comfyui_frontend_package.__version__) - required_frontend = parse_version((0,)) - with open(req_path, 'r', encoding='utf-8') as f: - required_frontend = parse_version(f.readline().split('=')[-1]) + with open(req_path, "r", encoding="utf-8") as f: + required_frontend = parse_version(f.readline().split("=")[-1]) if frontend_version < required_frontend: logging.warning("________________________________________________________________________\nWARNING WARNING WARNING WARNING WARNING\n\nInstalled frontend version {} is lower than the recommended version {}.\n\n{}\n________________________________________________________________________".format('.'.join(map(str, frontend_version)), '.'.join(map(str, required_frontend)), frontend_install_warning_message())) else: From db9f2a34fc87d49abea4e5aa29a8573f5073e0ce Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Mon, 10 Mar 2025 15:19:52 -0400 Subject: [PATCH 217/478] Fix unit test --- tests-unit/app_test/frontend_manager_test.py | 57 +++++++++++++++++--- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/tests-unit/app_test/frontend_manager_test.py b/tests-unit/app_test/frontend_manager_test.py index a8df52484..7a91ad410 100644 --- a/tests-unit/app_test/frontend_manager_test.py +++ b/tests-unit/app_test/frontend_manager_test.py @@ -70,7 +70,7 @@ def test_get_release_invalid_version(mock_provider): def test_init_frontend_default(): version_string = DEFAULT_VERSION_STRING frontend_path = FrontendManager.init_frontend(version_string) - assert frontend_path == FrontendManager.DEFAULT_FRONTEND_PATH + assert frontend_path == FrontendManager.default_frontend_path() def test_init_frontend_invalid_version(): @@ -84,24 +84,29 @@ def test_init_frontend_invalid_provider(): with pytest.raises(HTTPError): FrontendManager.init_frontend_unsafe(version_string) + @pytest.fixture def mock_os_functions(): - with patch('app.frontend_management.os.makedirs') as mock_makedirs, \ - patch('app.frontend_management.os.listdir') as mock_listdir, \ - patch('app.frontend_management.os.rmdir') as mock_rmdir: + with ( + patch("app.frontend_management.os.makedirs") as mock_makedirs, + patch("app.frontend_management.os.listdir") as mock_listdir, + patch("app.frontend_management.os.rmdir") as mock_rmdir, + ): mock_listdir.return_value = [] # Simulate empty directory yield mock_makedirs, mock_listdir, mock_rmdir + @pytest.fixture def mock_download(): - with patch('app.frontend_management.download_release_asset_zip') as mock: + with patch("app.frontend_management.download_release_asset_zip") as mock: mock.side_effect = Exception("Download failed") # Simulate download failure yield mock + def test_finally_block(mock_os_functions, mock_download, mock_provider): # Arrange mock_makedirs, mock_listdir, mock_rmdir = mock_os_functions - version_string = 'test-owner/test-repo@1.0.0' + version_string = "test-owner/test-repo@1.0.0" # Act & Assert with pytest.raises(Exception): @@ -128,3 +133,43 @@ def test_parse_version_string_invalid(): version_string = "invalid" with pytest.raises(argparse.ArgumentTypeError): FrontendManager.parse_version_string(version_string) + + +def test_init_frontend_default_with_mocks(): + # Arrange + version_string = DEFAULT_VERSION_STRING + + # Act + with ( + patch("app.frontend_management.check_frontend_version") as mock_check, + patch.object( + FrontendManager, "default_frontend_path", return_value="/mocked/path" + ), + ): + frontend_path = FrontendManager.init_frontend(version_string) + + # Assert + assert frontend_path == "/mocked/path" + mock_check.assert_called_once() + + +def test_init_frontend_fallback_on_error(): + # Arrange + version_string = "test-owner/test-repo@1.0.0" + + # Act + with ( + patch.object( + FrontendManager, "init_frontend_unsafe", side_effect=Exception("Test error") + ), + patch("app.frontend_management.check_frontend_version") as mock_check, + patch.object( + FrontendManager, "default_frontend_path", return_value="/default/path" + ), + ): + frontend_path = FrontendManager.init_frontend(version_string) + + # Assert + assert frontend_path == "/default/path" + mock_check.assert_called_once() + From 65ea778a5e5f69ec83e59a1f08678272fb2725d3 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Mon, 10 Mar 2025 15:19:59 -0400 Subject: [PATCH 218/478] nit --- tests-unit/app_test/frontend_manager_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests-unit/app_test/frontend_manager_test.py b/tests-unit/app_test/frontend_manager_test.py index 7a91ad410..ce67df6c6 100644 --- a/tests-unit/app_test/frontend_manager_test.py +++ b/tests-unit/app_test/frontend_manager_test.py @@ -172,4 +172,3 @@ def test_init_frontend_fallback_on_error(): # Assert assert frontend_path == "/default/path" mock_check.assert_called_once() - From ca8efab79fa19bc9745b4f7346d38a49ba1b1b7c Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 10 Mar 2025 17:23:13 -0400 Subject: [PATCH 219/478] Support control loras on Wan. --- comfy/model_base.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index bf4ebefa1..976702b60 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -973,11 +973,11 @@ class WAN21(BaseModel): self.image_to_video = image_to_video def concat_cond(self, **kwargs): - if not self.image_to_video: + noise = kwargs.get("noise", None) + if self.diffusion_model.patch_embedding.weight.shape[1] == noise.shape[1]: return None image = kwargs.get("concat_latent_image", None) - noise = kwargs.get("noise", None) device = kwargs["device"] if image is None: @@ -987,6 +987,9 @@ class WAN21(BaseModel): image = self.process_latent_in(image) image = utils.resize_to_batch_size(image, noise.shape[0]) + if not self.image_to_video: + return image + mask = kwargs.get("concat_mask", kwargs.get("denoise_mask", None)) if mask is None: mask = torch.zeros_like(noise)[:, :4] From cfbe4b49ca63eae79fe4f3206d03a41b43ef275e Mon Sep 17 00:00:00 2001 From: huchenlei Date: Mon, 10 Mar 2025 20:43:59 -0400 Subject: [PATCH 220/478] Access package version --- app/frontend_management.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/frontend_management.py b/app/frontend_management.py index 95df5dee4..4b7dfbb98 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -11,6 +11,7 @@ from dataclasses import dataclass from functools import cached_property from pathlib import Path from typing import TypedDict, Optional +from importlib.metadata import version import requests from typing_extensions import NotRequired @@ -36,15 +37,14 @@ def check_frontend_version(): return tuple(map(int, version.split("."))) try: - import comfyui_frontend_package - - frontend_version = parse_version(comfyui_frontend_package.__version__) + frontend_version_str = version("comfyui-frontend-package") + frontend_version = parse_version(frontend_version_str) with open(req_path, "r", encoding="utf-8") as f: required_frontend = parse_version(f.readline().split("=")[-1]) if frontend_version < required_frontend: logging.warning("________________________________________________________________________\nWARNING WARNING WARNING WARNING WARNING\n\nInstalled frontend version {} is lower than the recommended version {}.\n\n{}\n________________________________________________________________________".format('.'.join(map(str, frontend_version)), '.'.join(map(str, required_frontend)), frontend_install_warning_message())) else: - logging.info("ComfyUI frontend version: {}".format(comfyui_frontend_package.__version__)) + logging.info("ComfyUI frontend version: {}".format(frontend_version_str)) except Exception as e: logging.error(f"Failed to check frontend version: {e}") From 2330754b0ed3e4864c8ba8165e57ea18aafa30b8 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 11 Mar 2025 15:07:00 -0400 Subject: [PATCH 221/478] Fix error saving some latents. --- nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index e43c29295..63791e208 100644 --- a/nodes.py +++ b/nodes.py @@ -489,7 +489,7 @@ class SaveLatent: file = os.path.join(full_output_folder, file) output = {} - output["latent_tensor"] = samples["samples"] + output["latent_tensor"] = samples["samples"].contiguous() output["latent_format_version_0"] = torch.tensor([]) comfy.utils.save_torch_file(output, file, metadata=metadata) From 01015bff166988c926e5ed1d03842fddc9a0f925 Mon Sep 17 00:00:00 2001 From: chaObserv <154517000+chaObserv@users.noreply.github.com> Date: Wed, 12 Mar 2025 14:42:37 +0800 Subject: [PATCH 222/478] Add er_sde sampler (#7187) --- comfy/k_diffusion/sampling.py | 56 +++++++++++++++++++++++++++++++++++ comfy/samplers.py | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index 456679989..78678abd7 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -1366,3 +1366,59 @@ def sample_gradient_estimation(model, x, sigmas, extra_args=None, callback=None, x = x + d_bar * dt old_d = d return x + +@torch.no_grad() +def sample_er_sde(model, x, sigmas, extra_args=None, callback=None, disable=None, s_noise=1., noise_sampler=None, noise_scaler=None, max_stage=3): + """ + Extended Reverse-Time SDE solver (VE ER-SDE-Solver-3). Arxiv: https://arxiv.org/abs/2309.06169. + Code reference: https://github.com/QinpengCui/ER-SDE-Solver/blob/main/er_sde_solver.py. + """ + extra_args = {} if extra_args is None else extra_args + seed = extra_args.get("seed", None) + noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler + s_in = x.new_ones([x.shape[0]]) + + def default_noise_scaler(sigma): + return sigma * ((sigma ** 0.3).exp() + 10.0) + noise_scaler = default_noise_scaler if noise_scaler is None else noise_scaler + num_integration_points = 200.0 + point_indice = torch.arange(0, num_integration_points, dtype=torch.float32, device=x.device) + + old_denoised = None + old_denoised_d = None + + for i in trange(len(sigmas) - 1, disable=disable): + denoised = model(x, sigmas[i] * s_in, **extra_args) + if callback is not None: + callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigmas[i], 'denoised': denoised}) + stage_used = min(max_stage, i + 1) + if sigmas[i + 1] == 0: + x = denoised + elif stage_used == 1: + r = noise_scaler(sigmas[i + 1]) / noise_scaler(sigmas[i]) + x = r * x + (1 - r) * denoised + else: + r = noise_scaler(sigmas[i + 1]) / noise_scaler(sigmas[i]) + x = r * x + (1 - r) * denoised + + dt = sigmas[i + 1] - sigmas[i] + sigma_step_size = -dt / num_integration_points + sigma_pos = sigmas[i + 1] + point_indice * sigma_step_size + scaled_pos = noise_scaler(sigma_pos) + + # Stage 2 + s = torch.sum(1 / scaled_pos) * sigma_step_size + denoised_d = (denoised - old_denoised) / (sigmas[i] - sigmas[i - 1]) + x = x + (dt + s * noise_scaler(sigmas[i + 1])) * denoised_d + + if stage_used >= 3: + # Stage 3 + s_u = torch.sum((sigma_pos - sigmas[i]) / scaled_pos) * sigma_step_size + denoised_u = (denoised_d - old_denoised_d) / ((sigmas[i] - sigmas[i - 2]) / 2) + x = x + ((dt ** 2) / 2 + s_u * noise_scaler(sigmas[i + 1])) * denoised_u + old_denoised_d = denoised_d + + if s_noise != 0 and sigmas[i + 1] > 0: + x = x + noise_sampler(sigmas[i], sigmas[i + 1]) * s_noise * (sigmas[i + 1] ** 2 - sigmas[i] ** 2 * r ** 2).sqrt() + old_denoised = denoised + return x diff --git a/comfy/samplers.py b/comfy/samplers.py index 7578ac1ef..10728bd1f 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -710,7 +710,7 @@ KSAMPLER_NAMES = ["euler", "euler_cfg_pp", "euler_ancestral", "euler_ancestral_c "lms", "dpm_fast", "dpm_adaptive", "dpmpp_2s_ancestral", "dpmpp_2s_ancestral_cfg_pp", "dpmpp_sde", "dpmpp_sde_gpu", "dpmpp_2m", "dpmpp_2m_cfg_pp", "dpmpp_2m_sde", "dpmpp_2m_sde_gpu", "dpmpp_3m_sde", "dpmpp_3m_sde_gpu", "ddpm", "lcm", "ipndm", "ipndm_v", "deis", "res_multistep", "res_multistep_cfg_pp", "res_multistep_ancestral", "res_multistep_ancestral_cfg_pp", - "gradient_estimation"] + "gradient_estimation", "er_sde"] class KSAMPLER(Sampler): def __init__(self, sampler_function, extra_options={}, inpaint_options={}): From d2a0fb6bb0da1bf481a3b2417bca2cebac4a4e03 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 12 Mar 2025 06:39:14 -0400 Subject: [PATCH 223/478] Add unwrap widget value support (#7197) * Add unwrap widget value support * nit --- execution.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/execution.py b/execution.py index 2c979205b..fcb4f6f40 100644 --- a/execution.py +++ b/execution.py @@ -634,6 +634,13 @@ def validate_inputs(prompt, item, validated): continue else: try: + # Unwraps values wrapped in __value__ key. This is used to pass + # list widget value to execution, as by default list value is + # reserved to represent the connection between nodes. + if isinstance(val, dict) and "__value__" in val: + val = val["__value__"] + inputs[x] = val + if type_input == "INT": val = int(val) inputs[x] = val From f4411250f311f1ba93b8ba57b4252e7c23f7d925 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 12 Mar 2025 07:13:40 -0400 Subject: [PATCH 224/478] Repeat frontend version warning at the end. This way someone running ComfyUI with the command line is more likely to actually see it. --- app/frontend_management.py | 3 ++- app/logger.py | 14 ++++++++++++++ main.py | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/frontend_management.py b/app/frontend_management.py index 4b7dfbb98..b4ba994d1 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -17,6 +17,7 @@ import requests from typing_extensions import NotRequired from comfy.cli_args import DEFAULT_VERSION_STRING +import app.logger # The path to the requirements.txt file req_path = Path(__file__).parents[1] / "requirements.txt" @@ -42,7 +43,7 @@ def check_frontend_version(): with open(req_path, "r", encoding="utf-8") as f: required_frontend = parse_version(f.readline().split("=")[-1]) if frontend_version < required_frontend: - logging.warning("________________________________________________________________________\nWARNING WARNING WARNING WARNING WARNING\n\nInstalled frontend version {} is lower than the recommended version {}.\n\n{}\n________________________________________________________________________".format('.'.join(map(str, frontend_version)), '.'.join(map(str, required_frontend)), frontend_install_warning_message())) + app.logger.log_startup_warning("________________________________________________________________________\nWARNING WARNING WARNING WARNING WARNING\n\nInstalled frontend version {} is lower than the recommended version {}.\n\n{}\n________________________________________________________________________".format('.'.join(map(str, frontend_version)), '.'.join(map(str, required_frontend)), frontend_install_warning_message())) else: logging.info("ComfyUI frontend version: {}".format(frontend_version_str)) except Exception as e: diff --git a/app/logger.py b/app/logger.py index 9e9f84ccf..3d26d98fe 100644 --- a/app/logger.py +++ b/app/logger.py @@ -82,3 +82,17 @@ def setup_logger(log_level: str = 'INFO', capacity: int = 300, use_stdout: bool logger.addHandler(stdout_handler) logger.addHandler(stream_handler) + + +STARTUP_WARNINGS = [] + + +def log_startup_warning(msg): + logging.warning(msg) + STARTUP_WARNINGS.append(msg) + + +def print_startup_warnings(): + for s in STARTUP_WARNINGS: + logging.warning(s) + STARTUP_WARNINGS.clear() diff --git a/main.py b/main.py index c6f5c3c1e..1b100fa8a 100644 --- a/main.py +++ b/main.py @@ -139,6 +139,7 @@ from server import BinaryEventTypes import nodes import comfy.model_management import comfyui_version +import app.logger def cuda_malloc_warning(): @@ -299,6 +300,7 @@ if __name__ == "__main__": event_loop, _, start_all_func = start_comfyui() try: x = start_all_func() + app.logger.print_startup_warnings() event_loop.run_until_complete(x) except KeyboardInterrupt: logging.info("\nStopped server") From 3fc688aebd9f54f8351da3a4282bd12c74e4a02e Mon Sep 17 00:00:00 2001 From: chaObserv <154517000+chaObserv@users.noreply.github.com> Date: Thu, 13 Mar 2025 05:28:59 +0800 Subject: [PATCH 225/478] Ensure the extra_args in dpmpp sde series (#7204) --- comfy/k_diffusion/sampling.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index 78678abd7..a28a30ac2 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -688,10 +688,10 @@ def sample_dpmpp_sde(model, x, sigmas, extra_args=None, callback=None, disable=N if len(sigmas) <= 1: return x + extra_args = {} if extra_args is None else extra_args sigma_min, sigma_max = sigmas[sigmas > 0].min(), sigmas.max() seed = extra_args.get("seed", None) noise_sampler = BrownianTreeNoiseSampler(x, sigma_min, sigma_max, seed=seed, cpu=True) if noise_sampler is None else noise_sampler - extra_args = {} if extra_args is None else extra_args s_in = x.new_ones([x.shape[0]]) sigma_fn = lambda t: t.neg().exp() t_fn = lambda sigma: sigma.log().neg() @@ -762,10 +762,10 @@ def sample_dpmpp_2m_sde(model, x, sigmas, extra_args=None, callback=None, disabl if solver_type not in {'heun', 'midpoint'}: raise ValueError('solver_type must be \'heun\' or \'midpoint\'') + extra_args = {} if extra_args is None else extra_args seed = extra_args.get("seed", None) sigma_min, sigma_max = sigmas[sigmas > 0].min(), sigmas.max() noise_sampler = BrownianTreeNoiseSampler(x, sigma_min, sigma_max, seed=seed, cpu=True) if noise_sampler is None else noise_sampler - extra_args = {} if extra_args is None else extra_args s_in = x.new_ones([x.shape[0]]) old_denoised = None @@ -808,10 +808,10 @@ def sample_dpmpp_3m_sde(model, x, sigmas, extra_args=None, callback=None, disabl if len(sigmas) <= 1: return x + extra_args = {} if extra_args is None else extra_args seed = extra_args.get("seed", None) sigma_min, sigma_max = sigmas[sigmas > 0].min(), sigmas.max() noise_sampler = BrownianTreeNoiseSampler(x, sigma_min, sigma_max, seed=seed, cpu=True) if noise_sampler is None else noise_sampler - extra_args = {} if extra_args is None else extra_args s_in = x.new_ones([x.shape[0]]) denoised_1, denoised_2 = None, None @@ -858,7 +858,7 @@ def sample_dpmpp_3m_sde(model, x, sigmas, extra_args=None, callback=None, disabl def sample_dpmpp_3m_sde_gpu(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None): if len(sigmas) <= 1: return x - + extra_args = {} if extra_args is None else extra_args sigma_min, sigma_max = sigmas[sigmas > 0].min(), sigmas.max() noise_sampler = BrownianTreeNoiseSampler(x, sigma_min, sigma_max, seed=extra_args.get("seed", None), cpu=False) if noise_sampler is None else noise_sampler return sample_dpmpp_3m_sde(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, eta=eta, s_noise=s_noise, noise_sampler=noise_sampler) @@ -867,7 +867,7 @@ def sample_dpmpp_3m_sde_gpu(model, x, sigmas, extra_args=None, callback=None, di def sample_dpmpp_2m_sde_gpu(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None, solver_type='midpoint'): if len(sigmas) <= 1: return x - + extra_args = {} if extra_args is None else extra_args sigma_min, sigma_max = sigmas[sigmas > 0].min(), sigmas.max() noise_sampler = BrownianTreeNoiseSampler(x, sigma_min, sigma_max, seed=extra_args.get("seed", None), cpu=False) if noise_sampler is None else noise_sampler return sample_dpmpp_2m_sde(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, eta=eta, s_noise=s_noise, noise_sampler=noise_sampler, solver_type=solver_type) @@ -876,7 +876,7 @@ def sample_dpmpp_2m_sde_gpu(model, x, sigmas, extra_args=None, callback=None, di def sample_dpmpp_sde_gpu(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None, r=1 / 2): if len(sigmas) <= 1: return x - + extra_args = {} if extra_args is None else extra_args sigma_min, sigma_max = sigmas[sigmas > 0].min(), sigmas.max() noise_sampler = BrownianTreeNoiseSampler(x, sigma_min, sigma_max, seed=extra_args.get("seed", None), cpu=False) if noise_sampler is None else noise_sampler return sample_dpmpp_sde(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, eta=eta, s_noise=s_noise, noise_sampler=noise_sampler, r=r) From 9b6cd9b874b7f4ff2e9770f80e84b712fa8f1661 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 12 Mar 2025 17:29:39 -0400 Subject: [PATCH 226/478] [NodeDef] Add documentation on multi_select input option (#7212) --- comfy/comfy_types/node_typing.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/comfy/comfy_types/node_typing.py b/comfy/comfy_types/node_typing.py index 4967de716..1b71208d4 100644 --- a/comfy/comfy_types/node_typing.py +++ b/comfy/comfy_types/node_typing.py @@ -2,6 +2,7 @@ from __future__ import annotations from typing import Literal, TypedDict +from typing_extensions import NotRequired from abc import ABC, abstractmethod from enum import Enum @@ -26,6 +27,7 @@ class IO(StrEnum): BOOLEAN = "BOOLEAN" INT = "INT" FLOAT = "FLOAT" + COMBO = "COMBO" CONDITIONING = "CONDITIONING" SAMPLER = "SAMPLER" SIGMAS = "SIGMAS" @@ -66,6 +68,7 @@ class IO(StrEnum): b = frozenset(value.split(",")) return not (b.issubset(a) or a.issubset(b)) + class RemoteInputOptions(TypedDict): route: str """The route to the remote source.""" @@ -80,6 +83,14 @@ class RemoteInputOptions(TypedDict): refresh: int """The TTL of the remote input's value in milliseconds. Specifies the interval at which the remote input's value is refreshed.""" + +class MultiSelectOptions(TypedDict): + placeholder: NotRequired[str] + """The placeholder text to display in the multi-select widget when no items are selected.""" + chip: NotRequired[bool] + """Specifies whether to use chips instead of comma separated values for the multi-select widget.""" + + class InputTypeOptions(TypedDict): """Provides type hinting for the return type of the INPUT_TYPES node function. @@ -133,9 +144,22 @@ class InputTypeOptions(TypedDict): """Specifies which folder to get preview images from if the input has the ``image_upload`` flag. """ remote: RemoteInputOptions - """Specifies the configuration for a remote input.""" + """Specifies the configuration for a remote input. + Available after ComfyUI frontend v1.9.7 + https://github.com/Comfy-Org/ComfyUI_frontend/pull/2422""" control_after_generate: bool """Specifies whether a control widget should be added to the input, adding options to automatically change the value after each prompt is queued. Currently only used for INT and COMBO types.""" + options: NotRequired[list[str | int | float]] + """COMBO type only. Specifies the selectable options for the combo widget. + Prefer: + ["COMBO", {"options": ["Option 1", "Option 2", "Option 3"]}] + Over: + [["Option 1", "Option 2", "Option 3"]] + """ + multi_select: NotRequired[MultiSelectOptions] + """COMBO type only. Specifies the configuration for a multi-select widget. + Available after ComfyUI frontend v1.13.4 + https://github.com/Comfy-Org/ComfyUI_frontend/pull/2987""" class HiddenInputTypeDict(TypedDict): From 52e566d2bcf3321cce84d3f08a3a39d55bf556cf Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 12 Mar 2025 17:30:00 -0400 Subject: [PATCH 227/478] Add codeowner for comfy/comfy_types (#7213) --- CODEOWNERS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index eeec358de..72a59effe 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -19,5 +19,6 @@ /app/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata /utils/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata -# Extra nodes -/comfy_extras/ @yoland68 @robinjhuang @huchenlei @pythongosssss @ltdrdata @Kosinkadink +# Node developers +/comfy_extras/ @yoland68 @robinjhuang @huchenlei @pythongosssss @ltdrdata @Kosinkadink @webfiltered +/comfy/comfy_types/ @yoland68 @robinjhuang @huchenlei @pythongosssss @ltdrdata @Kosinkadink @webfiltered From 299436cfed82cb6490779fcecba8a72eee5ce39f Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 13 Mar 2025 10:05:15 -0400 Subject: [PATCH 228/478] Print mac version. --- comfy/model_management.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 3a4c93e30..1bb6156d3 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -186,12 +186,21 @@ def get_total_memory(dev=None, torch_total_too=False): else: return mem_total +def mac_version(): + try: + return tuple(int(n) for n in platform.mac_ver()[0].split(".")) + except: + return None + total_vram = get_total_memory(get_torch_device()) / (1024 * 1024) total_ram = psutil.virtual_memory().total / (1024 * 1024) logging.info("Total VRAM {:0.0f} MB, total RAM {:0.0f} MB".format(total_vram, total_ram)) try: logging.info("pytorch version: {}".format(torch_version)) + mac_ver = mac_version() + if mac_ver is not None: + print("Mac Version", mac_ver) except: pass @@ -969,12 +978,6 @@ def pytorch_attention_flash_attention(): return True #if you have pytorch attention enabled on AMD it probably supports at least mem efficient attention return False -def mac_version(): - try: - return tuple(int(n) for n in platform.mac_ver()[0].split(".")) - except: - return None - def force_upcast_attention_dtype(): upcast = args.force_upcast_attention From 35504e2f931c59190d0dd1b4ab2288f1c7f0e9f8 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 13 Mar 2025 15:03:18 -0400 Subject: [PATCH 229/478] Fix. --- comfy/model_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 1bb6156d3..b6f4e2d19 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -200,7 +200,7 @@ try: logging.info("pytorch version: {}".format(torch_version)) mac_ver = mac_version() if mac_ver is not None: - print("Mac Version", mac_ver) + logging.info("Mac Version {}".format(mac_ver)) except: pass From 7aceb9f91c1c2b860c1a65ac93a64b3bad575794 Mon Sep 17 00:00:00 2001 From: FeepingCreature <540727+FeepingCreature@users.noreply.github.com> Date: Fri, 14 Mar 2025 08:22:41 +0100 Subject: [PATCH 230/478] Add --use-flash-attention flag. (#7223) * Add --use-flash-attention flag. This is useful on AMD systems, as FA builds are still 10% faster than Pytorch cross-attention. --- comfy/cli_args.py | 1 + comfy/ldm/modules/attention.py | 60 ++++++++++++++++++++++++++++++++++ comfy/model_management.py | 3 ++ 3 files changed, 64 insertions(+) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index a864205be..91c1fe705 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -106,6 +106,7 @@ attn_group.add_argument("--use-split-cross-attention", action="store_true", help attn_group.add_argument("--use-quad-cross-attention", action="store_true", help="Use the sub-quadratic cross attention optimization . Ignored when xformers is used.") attn_group.add_argument("--use-pytorch-cross-attention", action="store_true", help="Use the new pytorch 2.0 cross attention function.") attn_group.add_argument("--use-sage-attention", action="store_true", help="Use sage attention.") +attn_group.add_argument("--use-flash-attention", action="store_true", help="Use FlashAttention.") parser.add_argument("--disable-xformers", action="store_true", help="Disable xformers.") diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.py index 2758f9508..3e5089a6f 100644 --- a/comfy/ldm/modules/attention.py +++ b/comfy/ldm/modules/attention.py @@ -24,6 +24,13 @@ if model_management.sage_attention_enabled(): logging.error(f"\n\nTo use the `--use-sage-attention` feature, the `sageattention` package must be installed first.\ncommand:\n\t{sys.executable} -m pip install sageattention") exit(-1) +if model_management.flash_attention_enabled(): + try: + from flash_attn import flash_attn_func + except ModuleNotFoundError: + logging.error(f"\n\nTo use the `--use-flash-attention` feature, the `flash-attn` package must be installed first.\ncommand:\n\t{sys.executable} -m pip install flash-attn") + exit(-1) + from comfy.cli_args import args import comfy.ops ops = comfy.ops.disable_weight_init @@ -496,6 +503,56 @@ def attention_sage(q, k, v, heads, mask=None, attn_precision=None, skip_reshape= return out +@torch.library.custom_op("flash_attention::flash_attn", mutates_args=()) +def flash_attn_wrapper(q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, + dropout_p: float = 0.0, causal: bool = False) -> torch.Tensor: + return flash_attn_func(q, k, v, dropout_p=dropout_p, causal=causal) + + +@flash_attn_wrapper.register_fake +def flash_attn_fake(q, k, v, dropout_p=0.0, causal=False): + # Output shape is the same as q + return q.new_empty(q.shape) + + +def attention_flash(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False, skip_output_reshape=False): + if skip_reshape: + b, _, _, dim_head = q.shape + else: + b, _, dim_head = q.shape + dim_head //= heads + q, k, v = map( + lambda t: t.view(b, -1, heads, dim_head).transpose(1, 2), + (q, k, v), + ) + + if mask is not None: + # add a batch dimension if there isn't already one + if mask.ndim == 2: + mask = mask.unsqueeze(0) + # add a heads dimension if there isn't already one + if mask.ndim == 3: + mask = mask.unsqueeze(1) + + try: + assert mask is None + out = flash_attn_wrapper( + q.transpose(1, 2), + k.transpose(1, 2), + v.transpose(1, 2), + dropout_p=0.0, + causal=False, + ).transpose(1, 2) + except Exception as e: + logging.warning(f"Flash Attention failed, using default SDPA: {e}") + out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=mask, dropout_p=0.0, is_causal=False) + if not skip_output_reshape: + out = ( + out.transpose(1, 2).reshape(b, -1, heads * dim_head) + ) + return out + + optimized_attention = attention_basic if model_management.sage_attention_enabled(): @@ -504,6 +561,9 @@ if model_management.sage_attention_enabled(): elif model_management.xformers_enabled(): logging.info("Using xformers attention") optimized_attention = attention_xformers +elif model_management.flash_attention_enabled(): + logging.info("Using Flash Attention") + optimized_attention = attention_flash elif model_management.pytorch_attention_enabled(): logging.info("Using pytorch attention") optimized_attention = attention_pytorch diff --git a/comfy/model_management.py b/comfy/model_management.py index b6f4e2d19..2a9b022be 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -930,6 +930,9 @@ def cast_to_device(tensor, device, dtype, copy=False): def sage_attention_enabled(): return args.use_sage_attention +def flash_attention_enabled(): + return args.use_flash_attention + def xformers_enabled(): global directml_enabled global cpu_state From 9c98c6358be2c7896de1547490bc87c9ad7a1ecb Mon Sep 17 00:00:00 2001 From: FeepingCreature <540727+FeepingCreature@users.noreply.github.com> Date: Fri, 14 Mar 2025 14:51:26 +0100 Subject: [PATCH 231/478] Tolerate missing `@torch.library.custom_op` (#7234) This can happen on Pytorch versions older than 2.4. --- comfy/ldm/modules/attention.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.py index 3e5089a6f..7908d1313 100644 --- a/comfy/ldm/modules/attention.py +++ b/comfy/ldm/modules/attention.py @@ -503,16 +503,23 @@ def attention_sage(q, k, v, heads, mask=None, attn_precision=None, skip_reshape= return out -@torch.library.custom_op("flash_attention::flash_attn", mutates_args=()) -def flash_attn_wrapper(q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, - dropout_p: float = 0.0, causal: bool = False) -> torch.Tensor: - return flash_attn_func(q, k, v, dropout_p=dropout_p, causal=causal) +try: + @torch.library.custom_op("flash_attention::flash_attn", mutates_args=()) + def flash_attn_wrapper(q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, + dropout_p: float = 0.0, causal: bool = False) -> torch.Tensor: + return flash_attn_func(q, k, v, dropout_p=dropout_p, causal=causal) -@flash_attn_wrapper.register_fake -def flash_attn_fake(q, k, v, dropout_p=0.0, causal=False): - # Output shape is the same as q - return q.new_empty(q.shape) + @flash_attn_wrapper.register_fake + def flash_attn_fake(q, k, v, dropout_p=0.0, causal=False): + # Output shape is the same as q + return q.new_empty(q.shape) +except AttributeError as error: + FLASH_ATTN_ERROR = error + + def flash_attn_wrapper(q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, + dropout_p: float = 0.0, causal: bool = False) -> torch.Tensor: + assert False, f"Could not define flash_attn_wrapper: {FLASH_ATTN_ERROR}" def attention_flash(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False, skip_output_reshape=False): From 6a0daa79b6a8ed99b6859fb1c143081eef9e7aa0 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 14 Mar 2025 10:55:19 -0400 Subject: [PATCH 232/478] Make the SkipLayerGuidanceDIT node work on WAN. --- comfy/ldm/wan/model.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index e78d846b2..9966b20a1 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -384,6 +384,7 @@ class WanModel(torch.nn.Module): context, clip_fea=None, freqs=None, + transformer_options={}, ): r""" Forward pass through the diffusion model @@ -429,8 +430,18 @@ class WanModel(torch.nn.Module): freqs=freqs, context=context) - for block in self.blocks: - x = block(x, **kwargs) + patches_replace = transformer_options.get("patches_replace", {}) + blocks_replace = patches_replace.get("dit", {}) + for i, block in enumerate(self.blocks): + if ("double_block", i) in blocks_replace: + def block_wrap(args): + out = {} + out["img"] = block(args["img"], context=args["txt"], e=args["vec"], freqs=args["pe"]) + return out + out = blocks_replace[("double_block", i)]({"img": x, "txt": context, "vec": e0, "pe": freqs}, {"original_block": block_wrap}) + x = out["img"] + else: + x = block(x, e=e0, freqs=freqs, context=context) # head x = self.head(x, e) @@ -439,7 +450,7 @@ class WanModel(torch.nn.Module): x = self.unpatchify(x, grid_sizes) return x - def forward(self, x, timestep, context, clip_fea=None, **kwargs): + def forward(self, x, timestep, context, clip_fea=None, transformer_options={},**kwargs): bs, c, t, h, w = x.shape x = comfy.ldm.common_dit.pad_to_patch_size(x, self.patch_size) patch_size = self.patch_size @@ -453,7 +464,7 @@ class WanModel(torch.nn.Module): img_ids = repeat(img_ids, "t h w c -> b (t h w) c", b=bs) freqs = self.rope_embedder(img_ids).movedim(1, 2) - return self.forward_orig(x, timestep, context, clip_fea=clip_fea, freqs=freqs)[:, :, :t, :h, :w] + return self.forward_orig(x, timestep, context, clip_fea=clip_fea, freqs=freqs, transformer_options=transformer_options)[:, :, :t, :h, :w] def unpatchify(self, x, grid_sizes): r""" From a2448fc52701651d183e35fbb37924b4441f7a98 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 14 Mar 2025 18:10:37 -0400 Subject: [PATCH 233/478] Remove useless code. --- comfy/ldm/wan/model.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index 9966b20a1..9b5e5332c 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -424,12 +424,6 @@ class WanModel(torch.nn.Module): context_clip = self.img_emb(clip_fea) # bs x 257 x dim context = torch.concat([context_clip, context], dim=1) - # arguments - kwargs = dict( - e=e0, - freqs=freqs, - context=context) - patches_replace = transformer_options.get("patches_replace", {}) blocks_replace = patches_replace.get("dit", {}) for i, block in enumerate(self.blocks): From c624c29d6685377faa298d4151af09e433cea875 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 14 Mar 2025 18:17:26 -0400 Subject: [PATCH 234/478] Update frontend to 1.12.9 (#7236) * Update frontend to 1.12.9 * Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e1316ccff..771e53c20 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.11.8 +comfyui-frontend-package==1.12.11 torch torchsde torchvision From 7ebd8087ffb9c713d308ff74f1bd14f07d569bed Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 14 Mar 2025 22:38:10 -0700 Subject: [PATCH 235/478] hotfix fe (#7244) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 771e53c20..70689bc99 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.12.11 +comfyui-frontend-package==1.12.14 torch torchsde torchvision From 3c3988df45826808210b9964dbaf85055f80e695 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 15 Mar 2025 08:26:36 -0400 Subject: [PATCH 236/478] Show a better error message if the VAE is invalid. --- comfy/sd.py | 8 ++++++++ nodes.py | 1 + 2 files changed, 9 insertions(+) diff --git a/comfy/sd.py b/comfy/sd.py index fd98585a1..51fe425aa 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -440,6 +440,10 @@ class VAE: self.patcher = comfy.model_patcher.ModelPatcher(self.first_stage_model, load_device=self.device, offload_device=offload_device) logging.info("VAE load device: {}, offload device: {}, dtype: {}".format(self.device, offload_device, self.vae_dtype)) + def throw_exception_if_invalid(self): + if self.first_stage_model is None: + raise RuntimeError("ERROR: VAE is invalid: None\n\nIf the VAE is from a checkpoint loader node your checkpoint does not contain a valid VAE.") + def vae_encode_crop_pixels(self, pixels): downscale_ratio = self.spacial_compression_encode() @@ -495,6 +499,7 @@ class VAE: return comfy.utils.tiled_scale_multidim(samples, encode_fn, tile=(tile_t, tile_x, tile_y), overlap=overlap, upscale_amount=self.downscale_ratio, out_channels=self.latent_channels, downscale=True, index_formulas=self.downscale_index_formula, output_device=self.output_device) def decode(self, samples_in): + self.throw_exception_if_invalid() pixel_samples = None try: memory_used = self.memory_used_decode(samples_in.shape, self.vae_dtype) @@ -525,6 +530,7 @@ class VAE: return pixel_samples def decode_tiled(self, samples, tile_x=None, tile_y=None, overlap=None, tile_t=None, overlap_t=None): + self.throw_exception_if_invalid() memory_used = self.memory_used_decode(samples.shape, self.vae_dtype) #TODO: calculate mem required for tile model_management.load_models_gpu([self.patcher], memory_required=memory_used) dims = samples.ndim - 2 @@ -553,6 +559,7 @@ class VAE: return output.movedim(1, -1) def encode(self, pixel_samples): + self.throw_exception_if_invalid() pixel_samples = self.vae_encode_crop_pixels(pixel_samples) pixel_samples = pixel_samples.movedim(-1, 1) if self.latent_dim == 3 and pixel_samples.ndim < 5: @@ -585,6 +592,7 @@ class VAE: return samples def encode_tiled(self, pixel_samples, tile_x=None, tile_y=None, overlap=None, tile_t=None, overlap_t=None): + self.throw_exception_if_invalid() pixel_samples = self.vae_encode_crop_pixels(pixel_samples) dims = self.latent_dim pixel_samples = pixel_samples.movedim(-1, 1) diff --git a/nodes.py b/nodes.py index 63791e208..71d1b8dd7 100644 --- a/nodes.py +++ b/nodes.py @@ -770,6 +770,7 @@ class VAELoader: vae_path = folder_paths.get_full_path_or_raise("vae", vae_name) sd = comfy.utils.load_torch_file(vae_path) vae = comfy.sd.VAE(sd=sd) + vae.throw_exception_if_invalid() return (vae,) class ControlNetLoader: From 55a1b09ddc9f81b6406710e69df3ec2eaa4880ac Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 15 Mar 2025 08:27:49 -0400 Subject: [PATCH 237/478] Allow loading diffusion model files with the "Load Checkpoint" node. --- comfy/sd.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/comfy/sd.py b/comfy/sd.py index 51fe425aa..3d72a04d6 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -907,7 +907,12 @@ def load_state_dict_guess_config(sd, output_vae=True, output_clip=True, output_c model_config = model_detection.model_config_from_unet(sd, diffusion_model_prefix, metadata=metadata) if model_config is None: - return None + logging.warning("Warning, This is not a checkpoint file, trying to load it as a diffusion model only.") + diffusion_model = load_diffusion_model_state_dict(sd, model_options={}) + if diffusion_model is None: + return None + return (diffusion_model, None, VAE(sd={}), None) # The VAE object is there to throw an exception if it's actually used' + unet_weight_dtype = list(model_config.supported_inference_dtypes) if model_config.scaled_fp8 is not None: From fd5297131f81d03966adf3f2250d4502f34a8828 Mon Sep 17 00:00:00 2001 From: chaObserv <154517000+chaObserv@users.noreply.github.com> Date: Sun, 16 Mar 2025 18:02:25 +0800 Subject: [PATCH 238/478] Guard the edge cases of noise term in er_sde (#7265) --- comfy/k_diffusion/sampling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index a28a30ac2..5b8d8000d 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -1419,6 +1419,6 @@ def sample_er_sde(model, x, sigmas, extra_args=None, callback=None, disable=None old_denoised_d = denoised_d if s_noise != 0 and sigmas[i + 1] > 0: - x = x + noise_sampler(sigmas[i], sigmas[i + 1]) * s_noise * (sigmas[i + 1] ** 2 - sigmas[i] ** 2 * r ** 2).sqrt() + x = x + noise_sampler(sigmas[i], sigmas[i + 1]) * s_noise * (sigmas[i + 1] ** 2 - sigmas[i] ** 2 * r ** 2).sqrt().nan_to_num(nan=0.0) old_denoised = denoised return x From 2e24a15905122b4f310ac590265cea83aac96b15 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Sun, 16 Mar 2025 05:02:45 -0500 Subject: [PATCH 239/478] Call unpatch_hooks at the start of ModelPatcher.partially_unload (#7253) * Call unpatch_hooks at the start of ModelPatcher.partially_unload * Only call unpatch_hooks in partially_unload if lowvram is possible --- comfy/model_patcher.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py index e291158ce..b7cb12dfc 100644 --- a/comfy/model_patcher.py +++ b/comfy/model_patcher.py @@ -747,6 +747,7 @@ class ModelPatcher: def partially_unload(self, device_to, memory_to_free=0): with self.use_ejected(): + hooks_unpatched = False memory_freed = 0 patch_counter = 0 unload_list = self._load_list() @@ -770,6 +771,10 @@ class ModelPatcher: move_weight = False break + if not hooks_unpatched: + self.unpatch_hooks() + hooks_unpatched = True + if bk.inplace_update: comfy.utils.copy_to_param(self.model, key, bk.weight) else: From e8e990d6b8b5c813c87d1aeaed3e5110c7aba166 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 16 Mar 2025 06:29:12 -0400 Subject: [PATCH 240/478] Cleanup code. --- comfy/ldm/flux/math.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/comfy/ldm/flux/math.py b/comfy/ldm/flux/math.py index 36b67931c..c0cbd2914 100644 --- a/comfy/ldm/flux/math.py +++ b/comfy/ldm/flux/math.py @@ -10,8 +10,8 @@ def attention(q: Tensor, k: Tensor, v: Tensor, pe: Tensor, mask=None) -> Tensor: q_shape = q.shape k_shape = k.shape - q = q.float().reshape(*q.shape[:-1], -1, 1, 2) - k = k.float().reshape(*k.shape[:-1], -1, 1, 2) + q = q.to(dtype=pe.dtype).reshape(*q.shape[:-1], -1, 1, 2) + k = k.to(dtype=pe.dtype).reshape(*k.shape[:-1], -1, 1, 2) q = (pe[..., 0] * q[..., 0] + pe[..., 1] * q[..., 1]).reshape(*q_shape).type_as(v) k = (pe[..., 0] * k[..., 0] + pe[..., 1] * k[..., 1]).reshape(*k_shape).type_as(v) @@ -36,8 +36,8 @@ def rope(pos: Tensor, dim: int, theta: int) -> Tensor: def apply_rope(xq: Tensor, xk: Tensor, freqs_cis: Tensor): - xq_ = xq.float().reshape(*xq.shape[:-1], -1, 1, 2) - xk_ = xk.float().reshape(*xk.shape[:-1], -1, 1, 2) + xq_ = xq.to(dtype=freqs_cis.dtype).reshape(*xq.shape[:-1], -1, 1, 2) + xk_ = xk.to(dtype=freqs_cis.dtype).reshape(*xk.shape[:-1], -1, 1, 2) xq_out = freqs_cis[..., 0] * xq_[..., 0] + freqs_cis[..., 1] * xq_[..., 1] xk_out = freqs_cis[..., 0] * xk_[..., 0] + freqs_cis[..., 1] * xk_[..., 1] return xq_out.reshape(*xq.shape).type_as(xq), xk_out.reshape(*xk.shape).type_as(xk) From 6dc7b0bfe3cd44302444f0f34db0e62b86764482 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 17 Mar 2025 05:53:54 -0400 Subject: [PATCH 241/478] Add support for giant dinov2 image encoder. --- comfy/clip_vision.py | 11 +- comfy/image_encoders/dino2.py | 141 ++++++++++++++++++++++++++ comfy/image_encoders/dino2_giant.json | 21 ++++ 3 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 comfy/image_encoders/dino2.py create mode 100644 comfy/image_encoders/dino2_giant.json diff --git a/comfy/clip_vision.py b/comfy/clip_vision.py index 297b3bca3..25baf5ca8 100644 --- a/comfy/clip_vision.py +++ b/comfy/clip_vision.py @@ -9,6 +9,7 @@ import comfy.model_patcher import comfy.model_management import comfy.utils import comfy.clip_model +import comfy.image_encoders.dino2 class Output: def __getitem__(self, key): @@ -34,6 +35,11 @@ def clip_preprocess(image, size=224, mean=[0.48145466, 0.4578275, 0.40821073], s image = torch.clip((255. * image), 0, 255).round() / 255.0 return (image - mean.view([3,1,1])) / std.view([3,1,1]) +IMAGE_ENCODERS = { + "clip_vision": comfy.clip_model.CLIPVisionModelProjection, + "dinov2": comfy.image_encoders.dino2.Dinov2Model, +} + class ClipVisionModel(): def __init__(self, json_config): with open(json_config) as f: @@ -42,10 +48,11 @@ class ClipVisionModel(): self.image_size = config.get("image_size", 224) self.image_mean = config.get("image_mean", [0.48145466, 0.4578275, 0.40821073]) self.image_std = config.get("image_std", [0.26862954, 0.26130258, 0.27577711]) + model_class = IMAGE_ENCODERS.get(config.get("model_type", "clip_vision")) self.load_device = comfy.model_management.text_encoder_device() offload_device = comfy.model_management.text_encoder_offload_device() self.dtype = comfy.model_management.text_encoder_dtype(self.load_device) - self.model = comfy.clip_model.CLIPVisionModelProjection(config, self.dtype, offload_device, comfy.ops.manual_cast) + self.model = model_class(config, self.dtype, offload_device, comfy.ops.manual_cast) self.model.eval() self.patcher = comfy.model_patcher.ModelPatcher(self.model, load_device=self.load_device, offload_device=offload_device) @@ -111,6 +118,8 @@ def load_clipvision_from_sd(sd, prefix="", convert_keys=False): json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_vision_config_vitl_336.json") else: json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_vision_config_vitl.json") + elif "embeddings.patch_embeddings.projection.weight" in sd: + json_config = os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "image_encoders"), "dino2_giant.json") else: return None diff --git a/comfy/image_encoders/dino2.py b/comfy/image_encoders/dino2.py new file mode 100644 index 000000000..130ed6fd7 --- /dev/null +++ b/comfy/image_encoders/dino2.py @@ -0,0 +1,141 @@ +import torch +from comfy.text_encoders.bert import BertAttention +import comfy.model_management +from comfy.ldm.modules.attention import optimized_attention_for_device + + +class Dino2AttentionOutput(torch.nn.Module): + def __init__(self, input_dim, output_dim, layer_norm_eps, dtype, device, operations): + super().__init__() + self.dense = operations.Linear(input_dim, output_dim, dtype=dtype, device=device) + + def forward(self, x): + return self.dense(x) + + +class Dino2AttentionBlock(torch.nn.Module): + def __init__(self, embed_dim, heads, layer_norm_eps, dtype, device, operations): + super().__init__() + self.attention = BertAttention(embed_dim, heads, dtype, device, operations) + self.output = Dino2AttentionOutput(embed_dim, embed_dim, layer_norm_eps, dtype, device, operations) + + def forward(self, x, mask, optimized_attention): + return self.output(self.attention(x, mask, optimized_attention)) + + +class LayerScale(torch.nn.Module): + def __init__(self, dim, dtype, device, operations): + super().__init__() + self.lambda1 = torch.nn.Parameter(torch.empty(dim, device=device, dtype=dtype)) + + def forward(self, x): + return x * comfy.model_management.cast_to_device(self.lambda1, x.device, x.dtype) + + +class SwiGLUFFN(torch.nn.Module): + def __init__(self, dim, dtype, device, operations): + super().__init__() + in_features = out_features = dim + hidden_features = int(dim * 4) + hidden_features = (int(hidden_features * 2 / 3) + 7) // 8 * 8 + + self.weights_in = operations.Linear(in_features, 2 * hidden_features, bias=True, device=device, dtype=dtype) + self.weights_out = operations.Linear(hidden_features, out_features, bias=True, device=device, dtype=dtype) + + def forward(self, x): + x = self.weights_in(x) + x1, x2 = x.chunk(2, dim=-1) + x = torch.nn.functional.silu(x1) * x2 + return self.weights_out(x) + + +class Dino2Block(torch.nn.Module): + def __init__(self, dim, num_heads, layer_norm_eps, dtype, device, operations): + super().__init__() + self.attention = Dino2AttentionBlock(dim, num_heads, layer_norm_eps, dtype, device, operations) + self.layer_scale1 = LayerScale(dim, dtype, device, operations) + self.layer_scale2 = LayerScale(dim, dtype, device, operations) + self.mlp = SwiGLUFFN(dim, dtype, device, operations) + self.norm1 = operations.LayerNorm(dim, eps=layer_norm_eps, dtype=dtype, device=device) + self.norm2 = operations.LayerNorm(dim, eps=layer_norm_eps, dtype=dtype, device=device) + + def forward(self, x, optimized_attention): + x = x + self.layer_scale1(self.attention(self.norm1(x), None, optimized_attention)) + x = x + self.layer_scale2(self.mlp(self.norm2(x))) + return x + + +class Dino2Encoder(torch.nn.Module): + def __init__(self, dim, num_heads, layer_norm_eps, num_layers, dtype, device, operations): + super().__init__() + self.layer = torch.nn.ModuleList([Dino2Block(dim, num_heads, layer_norm_eps, dtype, device, operations) for _ in range(num_layers)]) + + def forward(self, x, intermediate_output=None): + optimized_attention = optimized_attention_for_device(x.device, False, small_input=True) + + if intermediate_output is not None: + if intermediate_output < 0: + intermediate_output = len(self.layer) + intermediate_output + + intermediate = None + for i, l in enumerate(self.layer): + x = l(x, optimized_attention) + if i == intermediate_output: + intermediate = x.clone() + return x, intermediate + + +class Dino2PatchEmbeddings(torch.nn.Module): + def __init__(self, dim, num_channels=3, patch_size=14, image_size=518, dtype=None, device=None, operations=None): + super().__init__() + self.projection = operations.Conv2d( + in_channels=num_channels, + out_channels=dim, + kernel_size=patch_size, + stride=patch_size, + bias=True, + dtype=dtype, + device=device + ) + + def forward(self, pixel_values): + return self.projection(pixel_values).flatten(2).transpose(1, 2) + + +class Dino2Embeddings(torch.nn.Module): + def __init__(self, dim, dtype, device, operations): + super().__init__() + patch_size = 14 + image_size = 518 + + self.patch_embeddings = Dino2PatchEmbeddings(dim, patch_size=patch_size, image_size=image_size, dtype=dtype, device=device, operations=operations) + self.position_embeddings = torch.nn.Parameter(torch.empty(1, (image_size // patch_size) ** 2 + 1, dim, dtype=dtype, device=device)) + self.cls_token = torch.nn.Parameter(torch.empty(1, 1, dim, dtype=dtype, device=device)) + self.mask_token = torch.nn.Parameter(torch.empty(1, dim, dtype=dtype, device=device)) + + def forward(self, pixel_values): + x = self.patch_embeddings(pixel_values) + # TODO: mask_token? + x = torch.cat((self.cls_token.expand(x.shape[0], -1, -1), x), dim=1) + x = x + comfy.model_management.cast_to_device(self.position_embeddings, x.device, x.dtype) + return x + + +class Dinov2Model(torch.nn.Module): + def __init__(self, config_dict, dtype, device, operations): + super().__init__() + num_layers = config_dict["num_hidden_layers"] + dim = config_dict["hidden_size"] + heads = config_dict["num_attention_heads"] + layer_norm_eps = config_dict["layer_norm_eps"] + + self.embeddings = Dino2Embeddings(dim, dtype, device, operations) + self.encoder = Dino2Encoder(dim, heads, layer_norm_eps, num_layers, dtype, device, operations) + self.layernorm = operations.LayerNorm(dim, eps=layer_norm_eps, dtype=dtype, device=device) + + def forward(self, pixel_values, attention_mask=None, intermediate_output=None): + x = self.embeddings(pixel_values) + x, i = self.encoder(x, intermediate_output=intermediate_output) + x = self.layernorm(x) + pooled_output = x[:, 0, :] + return x, i, pooled_output, None diff --git a/comfy/image_encoders/dino2_giant.json b/comfy/image_encoders/dino2_giant.json new file mode 100644 index 000000000..f6076a4dc --- /dev/null +++ b/comfy/image_encoders/dino2_giant.json @@ -0,0 +1,21 @@ +{ + "attention_probs_dropout_prob": 0.0, + "drop_path_rate": 0.0, + "hidden_act": "gelu", + "hidden_dropout_prob": 0.0, + "hidden_size": 1536, + "image_size": 518, + "initializer_range": 0.02, + "layer_norm_eps": 1e-06, + "layerscale_value": 1.0, + "mlp_ratio": 4, + "model_type": "dinov2", + "num_attention_heads": 24, + "num_channels": 3, + "num_hidden_layers": 40, + "patch_size": 14, + "qkv_bias": true, + "use_swiglu_ffn": true, + "image_mean": [0.485, 0.456, 0.406], + "image_std": [0.229, 0.224, 0.225] +} From 50614f1b7933244c01d85880c41b50bbd0c4de8b Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 17 Mar 2025 13:56:11 -0400 Subject: [PATCH 242/478] Fix regression with clip vision. --- comfy/clip_vision.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/comfy/clip_vision.py b/comfy/clip_vision.py index 25baf5ca8..87d32a66e 100644 --- a/comfy/clip_vision.py +++ b/comfy/clip_vision.py @@ -36,7 +36,8 @@ def clip_preprocess(image, size=224, mean=[0.48145466, 0.4578275, 0.40821073], s return (image - mean.view([3,1,1])) / std.view([3,1,1]) IMAGE_ENCODERS = { - "clip_vision": comfy.clip_model.CLIPVisionModelProjection, + "clip_vision_model": comfy.clip_model.CLIPVisionModelProjection, + "siglip_vision_model": comfy.clip_model.CLIPVisionModelProjection, "dinov2": comfy.image_encoders.dino2.Dinov2Model, } @@ -48,7 +49,7 @@ class ClipVisionModel(): self.image_size = config.get("image_size", 224) self.image_mean = config.get("image_mean", [0.48145466, 0.4578275, 0.40821073]) self.image_std = config.get("image_std", [0.26862954, 0.26130258, 0.27577711]) - model_class = IMAGE_ENCODERS.get(config.get("model_type", "clip_vision")) + model_class = IMAGE_ENCODERS.get(config.get("model_type", "clip_vision_model")) self.load_device = comfy.model_management.text_encoder_device() offload_device = comfy.model_management.text_encoder_offload_device() self.dtype = comfy.model_management.text_encoder_dtype(self.load_device) From 3b19fc76e34692d779ceffe233e0a952cbcd20ab Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 18 Mar 2025 05:09:25 -0400 Subject: [PATCH 243/478] Allow disabling pe in flux code for some other models. --- comfy/ldm/flux/math.py | 9 +++++---- comfy/ldm/flux/model.py | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/comfy/ldm/flux/math.py b/comfy/ldm/flux/math.py index c0cbd2914..3e0978176 100644 --- a/comfy/ldm/flux/math.py +++ b/comfy/ldm/flux/math.py @@ -10,10 +10,11 @@ def attention(q: Tensor, k: Tensor, v: Tensor, pe: Tensor, mask=None) -> Tensor: q_shape = q.shape k_shape = k.shape - q = q.to(dtype=pe.dtype).reshape(*q.shape[:-1], -1, 1, 2) - k = k.to(dtype=pe.dtype).reshape(*k.shape[:-1], -1, 1, 2) - q = (pe[..., 0] * q[..., 0] + pe[..., 1] * q[..., 1]).reshape(*q_shape).type_as(v) - k = (pe[..., 0] * k[..., 0] + pe[..., 1] * k[..., 1]).reshape(*k_shape).type_as(v) + if pe is not None: + q = q.to(dtype=pe.dtype).reshape(*q.shape[:-1], -1, 1, 2) + k = k.to(dtype=pe.dtype).reshape(*k.shape[:-1], -1, 1, 2) + q = (pe[..., 0] * q[..., 0] + pe[..., 1] * q[..., 1]).reshape(*q_shape).type_as(v) + k = (pe[..., 0] * k[..., 0] + pe[..., 1] * k[..., 1]).reshape(*k_shape).type_as(v) heads = q.shape[1] x = optimized_attention(q, k, v, heads, skip_reshape=True, mask=mask) diff --git a/comfy/ldm/flux/model.py b/comfy/ldm/flux/model.py index cc34f7585..ef4ba4106 100644 --- a/comfy/ldm/flux/model.py +++ b/comfy/ldm/flux/model.py @@ -115,8 +115,11 @@ class Flux(nn.Module): vec = vec + self.vector_in(y[:,:self.params.vec_in_dim]) txt = self.txt_in(txt) - ids = torch.cat((txt_ids, img_ids), dim=1) - pe = self.pe_embedder(ids) + if img_ids is not None: + ids = torch.cat((txt_ids, img_ids), dim=1) + pe = self.pe_embedder(ids) + else: + pe = None blocks_replace = patches_replace.get("dit", {}) for i, block in enumerate(self.double_blocks): From 11f1b41bab62ece770aa1d3aacc59a450e277b41 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 19 Mar 2025 16:19:50 -0400 Subject: [PATCH 244/478] Initial Hunyuan3Dv2 implementation. Supports the multiview, mini, turbo models and VAEs. --- comfy/latent_formats.py | 10 + comfy/ldm/hunyuan3d/model.py | 135 ++++++++ comfy/ldm/hunyuan3d/vae.py | 587 ++++++++++++++++++++++++++++++++ comfy/model_base.py | 16 + comfy/model_detection.py | 17 +- comfy/sd.py | 15 +- comfy/supported_models.py | 38 ++- comfy_extras/nodes_hunyuan3d.py | 410 ++++++++++++++++++++++ nodes.py | 1 + 9 files changed, 1225 insertions(+), 4 deletions(-) create mode 100644 comfy/ldm/hunyuan3d/model.py create mode 100644 comfy/ldm/hunyuan3d/vae.py create mode 100644 comfy_extras/nodes_hunyuan3d.py diff --git a/comfy/latent_formats.py b/comfy/latent_formats.py index 622c1df54..556c39512 100644 --- a/comfy/latent_formats.py +++ b/comfy/latent_formats.py @@ -456,3 +456,13 @@ class Wan21(LatentFormat): latents_mean = self.latents_mean.to(latent.device, latent.dtype) latents_std = self.latents_std.to(latent.device, latent.dtype) return latent * latents_std / self.scale_factor + latents_mean + +class Hunyuan3Dv2(LatentFormat): + latent_channels = 64 + latent_dimensions = 1 + scale_factor = 0.9990943042622529 + +class Hunyuan3Dv2mini(LatentFormat): + latent_channels = 64 + latent_dimensions = 1 + scale_factor = 1.0188137142395404 diff --git a/comfy/ldm/hunyuan3d/model.py b/comfy/ldm/hunyuan3d/model.py new file mode 100644 index 000000000..4e18358f0 --- /dev/null +++ b/comfy/ldm/hunyuan3d/model.py @@ -0,0 +1,135 @@ +import torch +from torch import nn +from comfy.ldm.flux.layers import ( + DoubleStreamBlock, + LastLayer, + MLPEmbedder, + SingleStreamBlock, + timestep_embedding, +) + + +class Hunyuan3Dv2(nn.Module): + def __init__( + self, + in_channels=64, + context_in_dim=1536, + hidden_size=1024, + mlp_ratio=4.0, + num_heads=16, + depth=16, + depth_single_blocks=32, + qkv_bias=True, + guidance_embed=False, + image_model=None, + dtype=None, + device=None, + operations=None + ): + super().__init__() + self.dtype = dtype + + if hidden_size % num_heads != 0: + raise ValueError( + f"Hidden size {hidden_size} must be divisible by num_heads {num_heads}" + ) + + self.max_period = 1000 # While reimplementing the model I noticed that they messed up. This 1000 value was meant to be the time_factor but they set the max_period instead + self.latent_in = operations.Linear(in_channels, hidden_size, bias=True, dtype=dtype, device=device) + self.time_in = MLPEmbedder(in_dim=256, hidden_dim=hidden_size, dtype=dtype, device=device, operations=operations) + self.guidance_in = ( + MLPEmbedder(in_dim=256, hidden_dim=hidden_size, dtype=dtype, device=device, operations=operations) if guidance_embed else None + ) + self.cond_in = operations.Linear(context_in_dim, hidden_size, dtype=dtype, device=device) + self.double_blocks = nn.ModuleList( + [ + DoubleStreamBlock( + hidden_size, + num_heads, + mlp_ratio=mlp_ratio, + qkv_bias=qkv_bias, + dtype=dtype, device=device, operations=operations + ) + for _ in range(depth) + ] + ) + self.single_blocks = nn.ModuleList( + [ + SingleStreamBlock( + hidden_size, + num_heads, + mlp_ratio=mlp_ratio, + dtype=dtype, device=device, operations=operations + ) + for _ in range(depth_single_blocks) + ] + ) + self.final_layer = LastLayer(hidden_size, 1, in_channels, dtype=dtype, device=device, operations=operations) + + def forward(self, x, timestep, context, guidance=None, transformer_options={}, **kwargs): + x = x.movedim(-1, -2) + timestep = 1.0 - timestep + txt = context + img = self.latent_in(x) + + vec = self.time_in(timestep_embedding(timestep, 256, self.max_period).to(dtype=img.dtype)) + if self.guidance_in is not None: + if guidance is not None: + vec = vec + self.guidance_in(timestep_embedding(guidance, 256, self.max_period).to(img.dtype)) + + txt = self.cond_in(txt) + pe = None + attn_mask = None + + patches_replace = transformer_options.get("patches_replace", {}) + blocks_replace = patches_replace.get("dit", {}) + for i, block in enumerate(self.double_blocks): + if ("double_block", i) in blocks_replace: + def block_wrap(args): + out = {} + out["img"], out["txt"] = block(img=args["img"], + txt=args["txt"], + vec=args["vec"], + pe=args["pe"], + attn_mask=args.get("attn_mask")) + return out + + out = blocks_replace[("double_block", i)]({"img": img, + "txt": txt, + "vec": vec, + "pe": pe, + "attn_mask": attn_mask}, + {"original_block": block_wrap}) + txt = out["txt"] + img = out["img"] + else: + img, txt = block(img=img, + txt=txt, + vec=vec, + pe=pe, + attn_mask=attn_mask) + + img = torch.cat((txt, img), 1) + + for i, block in enumerate(self.single_blocks): + if ("single_block", i) in blocks_replace: + def block_wrap(args): + out = {} + out["img"] = block(args["img"], + vec=args["vec"], + pe=args["pe"], + attn_mask=args.get("attn_mask")) + return out + + out = blocks_replace[("single_block", i)]({"img": img, + "vec": vec, + "pe": pe, + "attn_mask": attn_mask}, + {"original_block": block_wrap}) + img = out["img"] + else: + img = block(img, vec=vec, pe=pe, attn_mask=attn_mask) + + img = img[:, txt.shape[1]:, ...] + img = self.final_layer(img, vec) + return img.movedim(-2, -1) * (-1.0) diff --git a/comfy/ldm/hunyuan3d/vae.py b/comfy/ldm/hunyuan3d/vae.py new file mode 100644 index 000000000..311c9b416 --- /dev/null +++ b/comfy/ldm/hunyuan3d/vae.py @@ -0,0 +1,587 @@ +# Original: https://github.com/Tencent/Hunyuan3D-2/blob/main/hy3dgen/shapegen/models/autoencoders/model.py +# Since the header on their VAE source file was a bit confusing we asked for permission to use this code from tencent under the GPL license used in ComfyUI. + +import torch +import torch.nn as nn +import torch.nn.functional as F + + +from typing import Union, Tuple, List, Callable, Optional + +import numpy as np +from einops import repeat, rearrange +from tqdm import tqdm +import logging + +import comfy.ops +ops = comfy.ops.disable_weight_init + +def generate_dense_grid_points( + bbox_min: np.ndarray, + bbox_max: np.ndarray, + octree_resolution: int, + indexing: str = "ij", +): + length = bbox_max - bbox_min + num_cells = octree_resolution + + x = np.linspace(bbox_min[0], bbox_max[0], int(num_cells) + 1, dtype=np.float32) + y = np.linspace(bbox_min[1], bbox_max[1], int(num_cells) + 1, dtype=np.float32) + z = np.linspace(bbox_min[2], bbox_max[2], int(num_cells) + 1, dtype=np.float32) + [xs, ys, zs] = np.meshgrid(x, y, z, indexing=indexing) + xyz = np.stack((xs, ys, zs), axis=-1) + grid_size = [int(num_cells) + 1, int(num_cells) + 1, int(num_cells) + 1] + + return xyz, grid_size, length + + +class VanillaVolumeDecoder: + @torch.no_grad() + def __call__( + self, + latents: torch.FloatTensor, + geo_decoder: Callable, + bounds: Union[Tuple[float], List[float], float] = 1.01, + num_chunks: int = 10000, + octree_resolution: int = None, + enable_pbar: bool = True, + **kwargs, + ): + device = latents.device + dtype = latents.dtype + batch_size = latents.shape[0] + + # 1. generate query points + if isinstance(bounds, float): + bounds = [-bounds, -bounds, -bounds, bounds, bounds, bounds] + + bbox_min, bbox_max = np.array(bounds[0:3]), np.array(bounds[3:6]) + xyz_samples, grid_size, length = generate_dense_grid_points( + bbox_min=bbox_min, + bbox_max=bbox_max, + octree_resolution=octree_resolution, + indexing="ij" + ) + xyz_samples = torch.from_numpy(xyz_samples).to(device, dtype=dtype).contiguous().reshape(-1, 3) + + # 2. latents to 3d volume + batch_logits = [] + for start in tqdm(range(0, xyz_samples.shape[0], num_chunks), desc="Volume Decoding", + disable=not enable_pbar): + chunk_queries = xyz_samples[start: start + num_chunks, :] + chunk_queries = repeat(chunk_queries, "p c -> b p c", b=batch_size) + logits = geo_decoder(queries=chunk_queries, latents=latents) + batch_logits.append(logits) + + grid_logits = torch.cat(batch_logits, dim=1) + grid_logits = grid_logits.view((batch_size, *grid_size)).float() + + return grid_logits + + +class FourierEmbedder(nn.Module): + """The sin/cosine positional embedding. Given an input tensor `x` of shape [n_batch, ..., c_dim], it converts + each feature dimension of `x[..., i]` into: + [ + sin(x[..., i]), + sin(f_1*x[..., i]), + sin(f_2*x[..., i]), + ... + sin(f_N * x[..., i]), + cos(x[..., i]), + cos(f_1*x[..., i]), + cos(f_2*x[..., i]), + ... + cos(f_N * x[..., i]), + x[..., i] # only present if include_input is True. + ], here f_i is the frequency. + + Denote the space is [0 / num_freqs, 1 / num_freqs, 2 / num_freqs, 3 / num_freqs, ..., (num_freqs - 1) / num_freqs]. + If logspace is True, then the frequency f_i is [2^(0 / num_freqs), ..., 2^(i / num_freqs), ...]; + Otherwise, the frequencies are linearly spaced between [1.0, 2^(num_freqs - 1)]. + + Args: + num_freqs (int): the number of frequencies, default is 6; + logspace (bool): If logspace is True, then the frequency f_i is [..., 2^(i / num_freqs), ...], + otherwise, the frequencies are linearly spaced between [1.0, 2^(num_freqs - 1)]; + input_dim (int): the input dimension, default is 3; + include_input (bool): include the input tensor or not, default is True. + + Attributes: + frequencies (torch.Tensor): If logspace is True, then the frequency f_i is [..., 2^(i / num_freqs), ...], + otherwise, the frequencies are linearly spaced between [1.0, 2^(num_freqs - 1); + + out_dim (int): the embedding size, if include_input is True, it is input_dim * (num_freqs * 2 + 1), + otherwise, it is input_dim * num_freqs * 2. + + """ + + def __init__(self, + num_freqs: int = 6, + logspace: bool = True, + input_dim: int = 3, + include_input: bool = True, + include_pi: bool = True) -> None: + + """The initialization""" + + super().__init__() + + if logspace: + frequencies = 2.0 ** torch.arange( + num_freqs, + dtype=torch.float32 + ) + else: + frequencies = torch.linspace( + 1.0, + 2.0 ** (num_freqs - 1), + num_freqs, + dtype=torch.float32 + ) + + if include_pi: + frequencies *= torch.pi + + self.register_buffer("frequencies", frequencies, persistent=False) + self.include_input = include_input + self.num_freqs = num_freqs + + self.out_dim = self.get_dims(input_dim) + + def get_dims(self, input_dim): + temp = 1 if self.include_input or self.num_freqs == 0 else 0 + out_dim = input_dim * (self.num_freqs * 2 + temp) + + return out_dim + + def forward(self, x: torch.Tensor) -> torch.Tensor: + """ Forward process. + + Args: + x: tensor of shape [..., dim] + + Returns: + embedding: an embedding of `x` of shape [..., dim * (num_freqs * 2 + temp)] + where temp is 1 if include_input is True and 0 otherwise. + """ + + if self.num_freqs > 0: + embed = (x[..., None].contiguous() * self.frequencies.to(device=x.device, dtype=x.dtype)).view(*x.shape[:-1], -1) + if self.include_input: + return torch.cat((x, embed.sin(), embed.cos()), dim=-1) + else: + return torch.cat((embed.sin(), embed.cos()), dim=-1) + else: + return x + + +class CrossAttentionProcessor: + def __call__(self, attn, q, k, v): + out = F.scaled_dot_product_attention(q, k, v) + return out + + +class DropPath(nn.Module): + """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). + """ + + def __init__(self, drop_prob: float = 0., scale_by_keep: bool = True): + super(DropPath, self).__init__() + self.drop_prob = drop_prob + self.scale_by_keep = scale_by_keep + + def forward(self, x): + """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). + + This is the same as the DropConnect impl I created for EfficientNet, etc networks, however, + the original name is misleading as 'Drop Connect' is a different form of dropout in a separate paper... + See discussion: https://github.com/tensorflow/tpu/issues/494#issuecomment-532968956 ... I've opted for + changing the layer and argument names to 'drop path' rather than mix DropConnect as a layer name and use + 'survival rate' as the argument. + + """ + if self.drop_prob == 0. or not self.training: + return x + keep_prob = 1 - self.drop_prob + shape = (x.shape[0],) + (1,) * (x.ndim - 1) # work with diff dim tensors, not just 2D ConvNets + random_tensor = x.new_empty(shape).bernoulli_(keep_prob) + if keep_prob > 0.0 and self.scale_by_keep: + random_tensor.div_(keep_prob) + return x * random_tensor + + def extra_repr(self): + return f'drop_prob={round(self.drop_prob, 3):0.3f}' + + +class MLP(nn.Module): + def __init__( + self, *, + width: int, + expand_ratio: int = 4, + output_width: int = None, + drop_path_rate: float = 0.0 + ): + super().__init__() + self.width = width + self.c_fc = ops.Linear(width, width * expand_ratio) + self.c_proj = ops.Linear(width * expand_ratio, output_width if output_width is not None else width) + self.gelu = nn.GELU() + self.drop_path = DropPath(drop_path_rate) if drop_path_rate > 0. else nn.Identity() + + def forward(self, x): + return self.drop_path(self.c_proj(self.gelu(self.c_fc(x)))) + + +class QKVMultiheadCrossAttention(nn.Module): + def __init__( + self, + *, + heads: int, + width=None, + qk_norm=False, + norm_layer=ops.LayerNorm + ): + super().__init__() + self.heads = heads + self.q_norm = norm_layer(width // heads, elementwise_affine=True, eps=1e-6) if qk_norm else nn.Identity() + self.k_norm = norm_layer(width // heads, elementwise_affine=True, eps=1e-6) if qk_norm else nn.Identity() + + self.attn_processor = CrossAttentionProcessor() + + def forward(self, q, kv): + _, n_ctx, _ = q.shape + bs, n_data, width = kv.shape + attn_ch = width // self.heads // 2 + q = q.view(bs, n_ctx, self.heads, -1) + kv = kv.view(bs, n_data, self.heads, -1) + k, v = torch.split(kv, attn_ch, dim=-1) + + q = self.q_norm(q) + k = self.k_norm(k) + q, k, v = map(lambda t: rearrange(t, 'b n h d -> b h n d', h=self.heads), (q, k, v)) + out = self.attn_processor(self, q, k, v) + out = out.transpose(1, 2).reshape(bs, n_ctx, -1) + return out + + +class MultiheadCrossAttention(nn.Module): + def __init__( + self, + *, + width: int, + heads: int, + qkv_bias: bool = True, + data_width: Optional[int] = None, + norm_layer=ops.LayerNorm, + qk_norm: bool = False, + kv_cache: bool = False, + ): + super().__init__() + self.width = width + self.heads = heads + self.data_width = width if data_width is None else data_width + self.c_q = ops.Linear(width, width, bias=qkv_bias) + self.c_kv = ops.Linear(self.data_width, width * 2, bias=qkv_bias) + self.c_proj = ops.Linear(width, width) + self.attention = QKVMultiheadCrossAttention( + heads=heads, + width=width, + norm_layer=norm_layer, + qk_norm=qk_norm + ) + self.kv_cache = kv_cache + self.data = None + + def forward(self, x, data): + x = self.c_q(x) + if self.kv_cache: + if self.data is None: + self.data = self.c_kv(data) + logging.info('Save kv cache,this should be called only once for one mesh') + data = self.data + else: + data = self.c_kv(data) + x = self.attention(x, data) + x = self.c_proj(x) + return x + + +class ResidualCrossAttentionBlock(nn.Module): + def __init__( + self, + *, + width: int, + heads: int, + mlp_expand_ratio: int = 4, + data_width: Optional[int] = None, + qkv_bias: bool = True, + norm_layer=ops.LayerNorm, + qk_norm: bool = False + ): + super().__init__() + + if data_width is None: + data_width = width + + self.attn = MultiheadCrossAttention( + width=width, + heads=heads, + data_width=data_width, + qkv_bias=qkv_bias, + norm_layer=norm_layer, + qk_norm=qk_norm + ) + self.ln_1 = norm_layer(width, elementwise_affine=True, eps=1e-6) + self.ln_2 = norm_layer(data_width, elementwise_affine=True, eps=1e-6) + self.ln_3 = norm_layer(width, elementwise_affine=True, eps=1e-6) + self.mlp = MLP(width=width, expand_ratio=mlp_expand_ratio) + + def forward(self, x: torch.Tensor, data: torch.Tensor): + x = x + self.attn(self.ln_1(x), self.ln_2(data)) + x = x + self.mlp(self.ln_3(x)) + return x + + +class QKVMultiheadAttention(nn.Module): + def __init__( + self, + *, + heads: int, + width=None, + qk_norm=False, + norm_layer=ops.LayerNorm + ): + super().__init__() + self.heads = heads + self.q_norm = norm_layer(width // heads, elementwise_affine=True, eps=1e-6) if qk_norm else nn.Identity() + self.k_norm = norm_layer(width // heads, elementwise_affine=True, eps=1e-6) if qk_norm else nn.Identity() + + def forward(self, qkv): + bs, n_ctx, width = qkv.shape + attn_ch = width // self.heads // 3 + qkv = qkv.view(bs, n_ctx, self.heads, -1) + q, k, v = torch.split(qkv, attn_ch, dim=-1) + + q = self.q_norm(q) + k = self.k_norm(k) + + q, k, v = map(lambda t: rearrange(t, 'b n h d -> b h n d', h=self.heads), (q, k, v)) + out = F.scaled_dot_product_attention(q, k, v).transpose(1, 2).reshape(bs, n_ctx, -1) + return out + + +class MultiheadAttention(nn.Module): + def __init__( + self, + *, + width: int, + heads: int, + qkv_bias: bool, + norm_layer=ops.LayerNorm, + qk_norm: bool = False, + drop_path_rate: float = 0.0 + ): + super().__init__() + self.width = width + self.heads = heads + self.c_qkv = ops.Linear(width, width * 3, bias=qkv_bias) + self.c_proj = ops.Linear(width, width) + self.attention = QKVMultiheadAttention( + heads=heads, + width=width, + norm_layer=norm_layer, + qk_norm=qk_norm + ) + self.drop_path = DropPath(drop_path_rate) if drop_path_rate > 0. else nn.Identity() + + def forward(self, x): + x = self.c_qkv(x) + x = self.attention(x) + x = self.drop_path(self.c_proj(x)) + return x + + +class ResidualAttentionBlock(nn.Module): + def __init__( + self, + *, + width: int, + heads: int, + qkv_bias: bool = True, + norm_layer=ops.LayerNorm, + qk_norm: bool = False, + drop_path_rate: float = 0.0, + ): + super().__init__() + self.attn = MultiheadAttention( + width=width, + heads=heads, + qkv_bias=qkv_bias, + norm_layer=norm_layer, + qk_norm=qk_norm, + drop_path_rate=drop_path_rate + ) + self.ln_1 = norm_layer(width, elementwise_affine=True, eps=1e-6) + self.mlp = MLP(width=width, drop_path_rate=drop_path_rate) + self.ln_2 = norm_layer(width, elementwise_affine=True, eps=1e-6) + + def forward(self, x: torch.Tensor): + x = x + self.attn(self.ln_1(x)) + x = x + self.mlp(self.ln_2(x)) + return x + + +class Transformer(nn.Module): + def __init__( + self, + *, + width: int, + layers: int, + heads: int, + qkv_bias: bool = True, + norm_layer=ops.LayerNorm, + qk_norm: bool = False, + drop_path_rate: float = 0.0 + ): + super().__init__() + self.width = width + self.layers = layers + self.resblocks = nn.ModuleList( + [ + ResidualAttentionBlock( + width=width, + heads=heads, + qkv_bias=qkv_bias, + norm_layer=norm_layer, + qk_norm=qk_norm, + drop_path_rate=drop_path_rate + ) + for _ in range(layers) + ] + ) + + def forward(self, x: torch.Tensor): + for block in self.resblocks: + x = block(x) + return x + + +class CrossAttentionDecoder(nn.Module): + + def __init__( + self, + *, + out_channels: int, + fourier_embedder: FourierEmbedder, + width: int, + heads: int, + mlp_expand_ratio: int = 4, + downsample_ratio: int = 1, + enable_ln_post: bool = True, + qkv_bias: bool = True, + qk_norm: bool = False, + label_type: str = "binary" + ): + super().__init__() + + self.enable_ln_post = enable_ln_post + self.fourier_embedder = fourier_embedder + self.downsample_ratio = downsample_ratio + self.query_proj = ops.Linear(self.fourier_embedder.out_dim, width) + if self.downsample_ratio != 1: + self.latents_proj = ops.Linear(width * downsample_ratio, width) + if self.enable_ln_post == False: + qk_norm = False + self.cross_attn_decoder = ResidualCrossAttentionBlock( + width=width, + mlp_expand_ratio=mlp_expand_ratio, + heads=heads, + qkv_bias=qkv_bias, + qk_norm=qk_norm + ) + + if self.enable_ln_post: + self.ln_post = ops.LayerNorm(width) + self.output_proj = ops.Linear(width, out_channels) + self.label_type = label_type + self.count = 0 + + def forward(self, queries=None, query_embeddings=None, latents=None): + if query_embeddings is None: + query_embeddings = self.query_proj(self.fourier_embedder(queries).to(latents.dtype)) + self.count += query_embeddings.shape[1] + if self.downsample_ratio != 1: + latents = self.latents_proj(latents) + x = self.cross_attn_decoder(query_embeddings, latents) + if self.enable_ln_post: + x = self.ln_post(x) + occ = self.output_proj(x) + return occ + + +class ShapeVAE(nn.Module): + def __init__( + self, + *, + embed_dim: int, + width: int, + heads: int, + num_decoder_layers: int, + geo_decoder_downsample_ratio: int = 1, + geo_decoder_mlp_expand_ratio: int = 4, + geo_decoder_ln_post: bool = True, + num_freqs: int = 8, + include_pi: bool = True, + qkv_bias: bool = True, + qk_norm: bool = False, + label_type: str = "binary", + drop_path_rate: float = 0.0, + scale_factor: float = 1.0, + ): + super().__init__() + self.geo_decoder_ln_post = geo_decoder_ln_post + + self.fourier_embedder = FourierEmbedder(num_freqs=num_freqs, include_pi=include_pi) + + self.post_kl = ops.Linear(embed_dim, width) + + self.transformer = Transformer( + width=width, + layers=num_decoder_layers, + heads=heads, + qkv_bias=qkv_bias, + qk_norm=qk_norm, + drop_path_rate=drop_path_rate + ) + + self.geo_decoder = CrossAttentionDecoder( + fourier_embedder=self.fourier_embedder, + out_channels=1, + mlp_expand_ratio=geo_decoder_mlp_expand_ratio, + downsample_ratio=geo_decoder_downsample_ratio, + enable_ln_post=self.geo_decoder_ln_post, + width=width // geo_decoder_downsample_ratio, + heads=heads // geo_decoder_downsample_ratio, + qkv_bias=qkv_bias, + qk_norm=qk_norm, + label_type=label_type, + ) + + self.volume_decoder = VanillaVolumeDecoder() + self.scale_factor = scale_factor + + def decode(self, latents, **kwargs): + latents = self.post_kl(latents.movedim(-2, -1)) + latents = self.transformer(latents) + + bounds = kwargs.get("bounds", 1.01) + num_chunks = kwargs.get("num_chunks", 8000) + octree_resolution = kwargs.get("octree_resolution", 256) + enable_pbar = kwargs.get("enable_pbar", True) + + grid_logits = self.volume_decoder(latents, self.geo_decoder, bounds=bounds, num_chunks=num_chunks, octree_resolution=octree_resolution, enable_pbar=enable_pbar) + return grid_logits + + def encode(self, x): + return None diff --git a/comfy/model_base.py b/comfy/model_base.py index 976702b60..f02406ace 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -36,6 +36,7 @@ import comfy.ldm.hunyuan_video.model import comfy.ldm.cosmos.model import comfy.ldm.lumina.model import comfy.ldm.wan.model +import comfy.ldm.hunyuan3d.model import comfy.model_management import comfy.patcher_extension @@ -1013,3 +1014,18 @@ class WAN21(BaseModel): if clip_vision_output is not None: out['clip_fea'] = comfy.conds.CONDRegular(clip_vision_output.penultimate_hidden_states) return out + +class Hunyuan3Dv2(BaseModel): + def __init__(self, model_config, model_type=ModelType.FLOW, device=None): + super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.hunyuan3d.model.Hunyuan3Dv2) + + def extra_conds(self, **kwargs): + out = super().extra_conds(**kwargs) + cross_attn = kwargs.get("cross_attn", None) + if cross_attn is not None: + out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) + + guidance = kwargs.get("guidance", 5.0) + if guidance is not None: + out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor([guidance])) + return out diff --git a/comfy/model_detection.py b/comfy/model_detection.py index 403da5855..f9e96ab7e 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -154,7 +154,7 @@ def detect_unet_config(state_dict, key_prefix, metadata=None): dit_config["guidance_embed"] = len(guidance_keys) > 0 return dit_config - if '{}double_blocks.0.img_attn.norm.key_norm.scale'.format(key_prefix) in state_dict_keys: #Flux + if '{}double_blocks.0.img_attn.norm.key_norm.scale'.format(key_prefix) in state_dict_keys and '{}img_in.weight'.format(key_prefix) in state_dict_keys: #Flux dit_config = {} dit_config["image_model"] = "flux" dit_config["in_channels"] = 16 @@ -323,6 +323,21 @@ def detect_unet_config(state_dict, key_prefix, metadata=None): dit_config["model_type"] = "t2v" return dit_config + if '{}latent_in.weight'.format(key_prefix) in state_dict_keys: # Hunyuan 3D + in_shape = state_dict['{}latent_in.weight'.format(key_prefix)].shape + dit_config = {} + dit_config["image_model"] = "hunyuan3d2" + dit_config["in_channels"] = in_shape[1] + dit_config["context_in_dim"] = state_dict['{}cond_in.weight'.format(key_prefix)].shape[1] + dit_config["hidden_size"] = in_shape[0] + dit_config["mlp_ratio"] = 4.0 + dit_config["num_heads"] = 16 + dit_config["depth"] = count_blocks(state_dict_keys, '{}double_blocks.'.format(key_prefix) + '{}.') + dit_config["depth_single_blocks"] = count_blocks(state_dict_keys, '{}single_blocks.'.format(key_prefix) + '{}.') + dit_config["qkv_bias"] = True + dit_config["guidance_embed"] = "{}guidance_in.in_layer.weight".format(key_prefix) in state_dict_keys + return dit_config + if '{}input_blocks.0.0.weight'.format(key_prefix) not in state_dict_keys: return None diff --git a/comfy/sd.py b/comfy/sd.py index 3d72a04d6..4160fa893 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -14,6 +14,7 @@ import comfy.ldm.genmo.vae.model import comfy.ldm.lightricks.vae.causal_video_autoencoder import comfy.ldm.cosmos.vae import comfy.ldm.wan.vae +import comfy.ldm.hunyuan3d.vae import yaml import math @@ -412,6 +413,16 @@ class VAE: self.working_dtypes = [torch.bfloat16, torch.float16, torch.float32] self.memory_used_encode = lambda shape, dtype: 6000 * shape[3] * shape[4] * model_management.dtype_size(dtype) self.memory_used_decode = lambda shape, dtype: 7000 * shape[3] * shape[4] * (8 * 8) * model_management.dtype_size(dtype) + elif "geo_decoder.cross_attn_decoder.ln_1.bias" in sd: + self.latent_dim = 1 + ln_post = "geo_decoder.ln_post.weight" in sd + inner_size = sd["geo_decoder.output_proj.weight"].shape[1] + downsample_ratio = sd["post_kl.weight"].shape[0] // inner_size + mlp_expand = sd["geo_decoder.cross_attn_decoder.mlp.c_fc.weight"].shape[0] // inner_size + self.memory_used_encode = lambda shape, dtype: (1000 * shape[2]) * model_management.dtype_size(dtype) + self.memory_used_decode = lambda shape, dtype: (1000 * shape[2] * 2048) * model_management.dtype_size(dtype) + ddconfig = {"embed_dim": 64, "num_freqs": 8, "include_pi": False, "heads": 16, "width": 1024, "num_decoder_layers": 16, "qkv_bias": False, "qk_norm": True, "geo_decoder_mlp_expand_ratio": mlp_expand, "geo_decoder_downsample_ratio": downsample_ratio, "geo_decoder_ln_post": ln_post} + self.first_stage_model = comfy.ldm.hunyuan3d.vae.ShapeVAE(**ddconfig) else: logging.warning("WARNING: No VAE weights detected, VAE not initalized.") self.first_stage_model = None @@ -498,7 +509,7 @@ class VAE: encode_fn = lambda a: self.first_stage_model.encode((self.process_input(a)).to(self.vae_dtype).to(self.device)).float() return comfy.utils.tiled_scale_multidim(samples, encode_fn, tile=(tile_t, tile_x, tile_y), overlap=overlap, upscale_amount=self.downscale_ratio, out_channels=self.latent_channels, downscale=True, index_formulas=self.downscale_index_formula, output_device=self.output_device) - def decode(self, samples_in): + def decode(self, samples_in, vae_options={}): self.throw_exception_if_invalid() pixel_samples = None try: @@ -510,7 +521,7 @@ class VAE: for x in range(0, samples_in.shape[0], batch_number): samples = samples_in[x:x+batch_number].to(self.vae_dtype).to(self.device) - out = self.process_output(self.first_stage_model.decode(samples).to(self.output_device).float()) + out = self.process_output(self.first_stage_model.decode(samples, **vae_options).to(self.output_device).float()) if pixel_samples is None: pixel_samples = torch.empty((samples_in.shape[0],) + tuple(out.shape[1:]), device=self.output_device) pixel_samples[x:x+batch_number] = out diff --git a/comfy/supported_models.py b/comfy/supported_models.py index b4d7bfe20..b5c3194cf 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -959,6 +959,42 @@ class WAN21_I2V(WAN21_T2V): out = model_base.WAN21(self, image_to_video=True, device=device) return out -models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V] +class Hunyuan3Dv2(supported_models_base.BASE): + unet_config = { + "image_model": "hunyuan3d2", + } + + unet_extra_config = {} + + sampling_settings = { + "multiplier": 1.0, + "shift": 1.0, + } + + clip_vision_prefix = "conditioner.main_image_encoder.model." + vae_key_prefix = ["vae."] + + latent_format = latent_formats.Hunyuan3Dv2 + + def process_unet_state_dict_for_saving(self, state_dict): + replace_prefix = {"": "model."} + return utils.state_dict_prefix_replace(state_dict, replace_prefix) + + def get_model(self, state_dict, prefix="", device=None): + out = model_base.Hunyuan3Dv2(self, device=device) + return out + + def clip_target(self, state_dict={}): + return None + +class Hunyuan3Dv2mini(Hunyuan3Dv2): + unet_config = { + "image_model": "hunyuan3d2", + "depth": 8, + } + + latent_format = latent_formats.Hunyuan3Dv2mini + +models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, Hunyuan3Dv2mini, Hunyuan3Dv2] models += [SVD_img2vid] diff --git a/comfy_extras/nodes_hunyuan3d.py b/comfy_extras/nodes_hunyuan3d.py new file mode 100644 index 000000000..6abcde1f6 --- /dev/null +++ b/comfy_extras/nodes_hunyuan3d.py @@ -0,0 +1,410 @@ +import torch +import os +import json +import struct +import numpy as np +from comfy.ldm.modules.diffusionmodules.mmdit import get_1d_sincos_pos_embed_from_grid_torch +import folder_paths +import comfy.model_management +from comfy.cli_args import args + + +class EmptyLatentHunyuan3Dv2: + @classmethod + def INPUT_TYPES(s): + return {"required": {"resolution": ("INT", {"default": 3072, "min": 1, "max": 8192}), + "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096, "tooltip": "The number of latent images in the batch."}), + }} + RETURN_TYPES = ("LATENT",) + FUNCTION = "generate" + + CATEGORY = "latent/3d" + + def generate(self, resolution, batch_size): + latent = torch.zeros([batch_size, 64, resolution], device=comfy.model_management.intermediate_device()) + return ({"samples": latent, "type": "hunyuan3dv2"}, ) + + +class Hunyuan3Dv2Conditioning: + @classmethod + def INPUT_TYPES(s): + return {"required": {"clip_vision_output": ("CLIP_VISION_OUTPUT",), + }} + + RETURN_TYPES = ("CONDITIONING", "CONDITIONING") + RETURN_NAMES = ("positive", "negative") + + FUNCTION = "encode" + + CATEGORY = "conditioning/video_models" + + def encode(self, clip_vision_output): + embeds = clip_vision_output.last_hidden_state + positive = [[embeds, {}]] + negative = [[torch.zeros_like(embeds), {}]] + return (positive, negative) + + +class Hunyuan3Dv2ConditioningMultiView: + @classmethod + def INPUT_TYPES(s): + return {"required": {}, + "optional": {"front": ("CLIP_VISION_OUTPUT",), + "left": ("CLIP_VISION_OUTPUT",), + "back": ("CLIP_VISION_OUTPUT",), + "right": ("CLIP_VISION_OUTPUT",), }} + + RETURN_TYPES = ("CONDITIONING", "CONDITIONING") + RETURN_NAMES = ("positive", "negative") + + FUNCTION = "encode" + + CATEGORY = "conditioning/video_models" + + def encode(self, front=None, left=None, back=None, right=None): + all_embeds = [front, left, back, right] + out = [] + pos_embeds = None + for i, e in enumerate(all_embeds): + if e is not None: + if pos_embeds is None: + pos_embeds = get_1d_sincos_pos_embed_from_grid_torch(e.last_hidden_state.shape[-1], torch.arange(4)) + out.append(e.last_hidden_state + pos_embeds[i].reshape(1, 1, -1)) + + embeds = torch.cat(out, dim=1) + positive = [[embeds, {}]] + negative = [[torch.zeros_like(embeds), {}]] + return (positive, negative) + + +class VOXEL: + def __init__(self, data): + self.data = data + + +class VAEDecodeHunyuan3D: + @classmethod + def INPUT_TYPES(s): + return {"required": {"samples": ("LATENT", ), + "vae": ("VAE", ), + "num_chunks": ("INT", {"default": 8000, "min": 1000, "max": 500000}), + "octree_resolution": ("INT", {"default": 256, "min": 16, "max": 512}), + }} + RETURN_TYPES = ("VOXEL",) + FUNCTION = "decode" + + CATEGORY = "latent/3d" + + def decode(self, vae, samples, num_chunks, octree_resolution): + voxels = VOXEL(vae.decode(samples["samples"], vae_options={"num_chunks": num_chunks, "octree_resolution": octree_resolution})) + return (voxels, ) + + +def voxel_to_mesh(voxels, threshold=0.5, device=None): + if device is None: + device = torch.device("cpu") + voxels = voxels.to(device) + + binary = (voxels > threshold).float() + padded = torch.nn.functional.pad(binary, (1, 1, 1, 1, 1, 1), 'constant', 0) + + D, H, W = binary.shape + + neighbors = torch.tensor([ + [0, 0, 1], + [0, 0, -1], + [0, 1, 0], + [0, -1, 0], + [1, 0, 0], + [-1, 0, 0] + ], device=device) + + z, y, x = torch.meshgrid( + torch.arange(D, device=device), + torch.arange(H, device=device), + torch.arange(W, device=device), + indexing='ij' + ) + voxel_indices = torch.stack([z.flatten(), y.flatten(), x.flatten()], dim=1) + + solid_mask = binary.flatten() > 0 + solid_indices = voxel_indices[solid_mask] + + corner_offsets = [ + torch.tensor([ + [0, 0, 1], [0, 1, 1], [1, 1, 1], [1, 0, 1] + ], device=device), + torch.tensor([ + [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0] + ], device=device), + torch.tensor([ + [0, 1, 0], [1, 1, 0], [1, 1, 1], [0, 1, 1] + ], device=device), + torch.tensor([ + [0, 0, 0], [0, 0, 1], [1, 0, 1], [1, 0, 0] + ], device=device), + torch.tensor([ + [1, 0, 1], [1, 1, 1], [1, 1, 0], [1, 0, 0] + ], device=device), + torch.tensor([ + [0, 1, 0], [0, 1, 1], [0, 0, 1], [0, 0, 0] + ], device=device) + ] + + all_vertices = [] + all_indices = [] + + vertex_count = 0 + + for face_idx, offset in enumerate(neighbors): + neighbor_indices = solid_indices + offset + + padded_indices = neighbor_indices + 1 + + is_exposed = padded[ + padded_indices[:, 0], + padded_indices[:, 1], + padded_indices[:, 2] + ] == 0 + + if not is_exposed.any(): + continue + + exposed_indices = solid_indices[is_exposed] + + corners = corner_offsets[face_idx].unsqueeze(0) + + face_vertices = exposed_indices.unsqueeze(1) + corners + + all_vertices.append(face_vertices.reshape(-1, 3)) + + num_faces = exposed_indices.shape[0] + face_indices = torch.arange( + vertex_count, + vertex_count + 4 * num_faces, + device=device + ).reshape(-1, 4) + + all_indices.append(torch.stack([face_indices[:, 0], face_indices[:, 2], face_indices[:, 1]], dim=1)) + all_indices.append(torch.stack([face_indices[:, 0], face_indices[:, 3], face_indices[:, 2]], dim=1)) + + vertex_count += 4 * num_faces + + vertices = torch.cat(all_vertices, dim=0) + faces = torch.cat(all_indices, dim=0) + + v_min = 0 + v_max = max(voxels.shape) + + vertices = vertices - (v_min + v_max) / 2 + + scale = (v_max - v_min) / 2 + if scale > 0: + vertices = vertices / scale + + return vertices, faces + + +class MESH: + def __init__(self, vertices, faces): + self.vertices = vertices + self.faces = faces + + +class VoxelToMeshBasic: + @classmethod + def INPUT_TYPES(s): + return {"required": {"voxel": ("VOXEL", ), + "threshold": ("FLOAT", {"default": 0.6, "min": -1.0, "max": 1.0, "step": 0.01}), + }} + RETURN_TYPES = ("MESH",) + FUNCTION = "decode" + + CATEGORY = "3d" + + def decode(self, voxel, threshold): + vertices = [] + faces = [] + for x in voxel.data: + v, f = voxel_to_mesh(x, threshold=threshold, device=None) + vertices.append(v) + faces.append(f) + + return (MESH(torch.stack(vertices), torch.stack(faces)), ) + + +def save_glb(vertices, faces, filepath, metadata=None): + """ + Save PyTorch tensor vertices and faces as a GLB file without external dependencies. + + Parameters: + vertices: torch.Tensor of shape (N, 3) - The vertex coordinates + faces: torch.Tensor of shape (M, 4) or (M, 3) - The face indices (quad or triangle faces) + filepath: str - Output filepath (should end with .glb) + """ + + # Convert tensors to numpy arrays + vertices_np = vertices.cpu().numpy().astype(np.float32) + faces_np = faces.cpu().numpy().astype(np.uint32) + + vertices_buffer = vertices_np.tobytes() + indices_buffer = faces_np.tobytes() + + def pad_to_4_bytes(buffer): + padding_length = (4 - (len(buffer) % 4)) % 4 + return buffer + b'\x00' * padding_length + + vertices_buffer_padded = pad_to_4_bytes(vertices_buffer) + indices_buffer_padded = pad_to_4_bytes(indices_buffer) + + buffer_data = vertices_buffer_padded + indices_buffer_padded + + vertices_byte_length = len(vertices_buffer) + vertices_byte_offset = 0 + indices_byte_length = len(indices_buffer) + indices_byte_offset = len(vertices_buffer_padded) + + gltf = { + "asset": {"version": "2.0", "generator": "ComfyUI"}, + "buffers": [ + { + "byteLength": len(buffer_data) + } + ], + "bufferViews": [ + { + "buffer": 0, + "byteOffset": vertices_byte_offset, + "byteLength": vertices_byte_length, + "target": 34962 # ARRAY_BUFFER + }, + { + "buffer": 0, + "byteOffset": indices_byte_offset, + "byteLength": indices_byte_length, + "target": 34963 # ELEMENT_ARRAY_BUFFER + } + ], + "accessors": [ + { + "bufferView": 0, + "byteOffset": 0, + "componentType": 5126, # FLOAT + "count": len(vertices_np), + "type": "VEC3", + "max": vertices_np.max(axis=0).tolist(), + "min": vertices_np.min(axis=0).tolist() + }, + { + "bufferView": 1, + "byteOffset": 0, + "componentType": 5125, # UNSIGNED_INT + "count": faces_np.size, + "type": "SCALAR" + } + ], + "meshes": [ + { + "primitives": [ + { + "attributes": { + "POSITION": 0 + }, + "indices": 1, + "mode": 4 # TRIANGLES + } + ] + } + ], + "nodes": [ + { + "mesh": 0 + } + ], + "scenes": [ + { + "nodes": [0] + } + ], + "scene": 0 + } + + if metadata is not None: + gltf["asset"]["extras"] = metadata + + # Convert the JSON to bytes + gltf_json = json.dumps(gltf).encode('utf8') + + def pad_json_to_4_bytes(buffer): + padding_length = (4 - (len(buffer) % 4)) % 4 + return buffer + b' ' * padding_length + + gltf_json_padded = pad_json_to_4_bytes(gltf_json) + + # Create the GLB header + # Magic glTF + glb_header = struct.pack('<4sII', b'glTF', 2, 12 + 8 + len(gltf_json_padded) + 8 + len(buffer_data)) + + # Create JSON chunk header (chunk type 0) + json_chunk_header = struct.pack(' Date: Wed, 19 Mar 2025 19:55:24 -0400 Subject: [PATCH 245/478] Fix orientation of hunyuan 3d model. --- comfy/ldm/hunyuan3d/vae.py | 2 +- comfy_extras/nodes_hunyuan3d.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/comfy/ldm/hunyuan3d/vae.py b/comfy/ldm/hunyuan3d/vae.py index 311c9b416..5eb2c6548 100644 --- a/comfy/ldm/hunyuan3d/vae.py +++ b/comfy/ldm/hunyuan3d/vae.py @@ -581,7 +581,7 @@ class ShapeVAE(nn.Module): enable_pbar = kwargs.get("enable_pbar", True) grid_logits = self.volume_decoder(latents, self.geo_decoder, bounds=bounds, num_chunks=num_chunks, octree_resolution=octree_resolution, enable_pbar=enable_pbar) - return grid_logits + return grid_logits.movedim(-2, -1) def encode(self, x): return None diff --git a/comfy_extras/nodes_hunyuan3d.py b/comfy_extras/nodes_hunyuan3d.py index 6abcde1f6..ac2cff3a9 100644 --- a/comfy_extras/nodes_hunyuan3d.py +++ b/comfy_extras/nodes_hunyuan3d.py @@ -185,8 +185,8 @@ def voxel_to_mesh(voxels, threshold=0.5, device=None): device=device ).reshape(-1, 4) - all_indices.append(torch.stack([face_indices[:, 0], face_indices[:, 2], face_indices[:, 1]], dim=1)) - all_indices.append(torch.stack([face_indices[:, 0], face_indices[:, 3], face_indices[:, 2]], dim=1)) + all_indices.append(torch.stack([face_indices[:, 0], face_indices[:, 1], face_indices[:, 2]], dim=1)) + all_indices.append(torch.stack([face_indices[:, 0], face_indices[:, 2], face_indices[:, 3]], dim=1)) vertex_count += 4 * num_faces @@ -202,6 +202,7 @@ def voxel_to_mesh(voxels, threshold=0.5, device=None): if scale > 0: vertices = vertices / scale + vertices = torch.fliplr(vertices) return vertices, faces From 3872b43d4ba44ca93eae305298a6474efafa3eb7 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 20 Mar 2025 04:52:31 -0400 Subject: [PATCH 246/478] A few fixes for the hunyuan3d models. --- comfy/sd.py | 5 +++-- comfy/supported_models.py | 2 ++ comfy_extras/nodes_hunyuan3d.py | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/comfy/sd.py b/comfy/sd.py index 4160fa893..d096f496c 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -419,10 +419,11 @@ class VAE: inner_size = sd["geo_decoder.output_proj.weight"].shape[1] downsample_ratio = sd["post_kl.weight"].shape[0] // inner_size mlp_expand = sd["geo_decoder.cross_attn_decoder.mlp.c_fc.weight"].shape[0] // inner_size - self.memory_used_encode = lambda shape, dtype: (1000 * shape[2]) * model_management.dtype_size(dtype) - self.memory_used_decode = lambda shape, dtype: (1000 * shape[2] * 2048) * model_management.dtype_size(dtype) + self.memory_used_encode = lambda shape, dtype: (1000 * shape[2]) * model_management.dtype_size(dtype) # TODO + self.memory_used_decode = lambda shape, dtype: (1024 * 1024 * 1024 * 2.0) * model_management.dtype_size(dtype) # TODO ddconfig = {"embed_dim": 64, "num_freqs": 8, "include_pi": False, "heads": 16, "width": 1024, "num_decoder_layers": 16, "qkv_bias": False, "qk_norm": True, "geo_decoder_mlp_expand_ratio": mlp_expand, "geo_decoder_downsample_ratio": downsample_ratio, "geo_decoder_ln_post": ln_post} self.first_stage_model = comfy.ldm.hunyuan3d.vae.ShapeVAE(**ddconfig) + self.working_dtypes = [torch.float16, torch.bfloat16, torch.float32] else: logging.warning("WARNING: No VAE weights detected, VAE not initalized.") self.first_stage_model = None diff --git a/comfy/supported_models.py b/comfy/supported_models.py index b5c3194cf..be3aede60 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -971,6 +971,8 @@ class Hunyuan3Dv2(supported_models_base.BASE): "shift": 1.0, } + memory_usage_factor = 3.5 + clip_vision_prefix = "conditioner.main_image_encoder.model." vae_key_prefix = ["vae."] diff --git a/comfy_extras/nodes_hunyuan3d.py b/comfy_extras/nodes_hunyuan3d.py index ac2cff3a9..1ca7c2fe6 100644 --- a/comfy_extras/nodes_hunyuan3d.py +++ b/comfy_extras/nodes_hunyuan3d.py @@ -190,8 +190,12 @@ def voxel_to_mesh(voxels, threshold=0.5, device=None): vertex_count += 4 * num_faces - vertices = torch.cat(all_vertices, dim=0) - faces = torch.cat(all_indices, dim=0) + if len(all_vertices) > 0: + vertices = torch.cat(all_vertices, dim=0) + faces = torch.cat(all_indices, dim=0) + else: + vertices = torch.zeros((1, 3)) + faces = torch.zeros((1, 3)) v_min = 0 v_max = max(voxels.shape) From 8b9ce4ed18c24db2b7195b8d33932e516fcb3d85 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 21 Mar 2025 00:17:36 -0400 Subject: [PATCH 247/478] Update frontend to 1.13 (#7331) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 70689bc99..ceec006d2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.12.14 +comfyui-frontend-package==1.13.9 torch torchsde torchvision From a4a956dbbdcd9b3072d748f826394dd3223a094b Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 21 Mar 2025 01:47:18 -0400 Subject: [PATCH 248/478] Add backend primitive nodes (#7328) * Add backend primitive nodes * Add control after generate to int primitive --- comfy_extras/nodes_primitive.py | 79 +++++++++++++++++++++++++++++++++ nodes.py | 1 + 2 files changed, 80 insertions(+) create mode 100644 comfy_extras/nodes_primitive.py diff --git a/comfy_extras/nodes_primitive.py b/comfy_extras/nodes_primitive.py new file mode 100644 index 000000000..b770104fb --- /dev/null +++ b/comfy_extras/nodes_primitive.py @@ -0,0 +1,79 @@ +# Primitive nodes that are evaluated at backend. +from __future__ import annotations + +from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, IO + + +class String(ComfyNodeABC): + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": {"value": (IO.STRING, {})}, + } + + RETURN_TYPES = (IO.STRING,) + FUNCTION = "execute" + CATEGORY = "utils/primitive" + + def execute(self, value: str) -> tuple[str]: + return (value,) + + +class Int(ComfyNodeABC): + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": {"value": (IO.INT, {"control_after_generate": True})}, + } + + RETURN_TYPES = (IO.INT,) + FUNCTION = "execute" + CATEGORY = "utils/primitive" + + def execute(self, value: int) -> tuple[int]: + return (value,) + + +class Float(ComfyNodeABC): + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": {"value": (IO.FLOAT, {})}, + } + + RETURN_TYPES = (IO.FLOAT,) + FUNCTION = "execute" + CATEGORY = "utils/primitive" + + def execute(self, value: float) -> tuple[float]: + return (value,) + + +class Boolean(ComfyNodeABC): + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": {"value": (IO.BOOLEAN, {})}, + } + + RETURN_TYPES = (IO.BOOLEAN,) + FUNCTION = "execute" + CATEGORY = "utils/primitive" + + def execute(self, value: bool) -> tuple[bool]: + return (value,) + + +NODE_CLASS_MAPPINGS = { + "PrimitiveString": String, + "PrimitiveInt": Int, + "PrimitiveFloat": Float, + "PrimitiveBoolean": Boolean, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "PrimitiveString": "String", + "PrimitiveInt": "Int", + "PrimitiveFloat": "Float", + "PrimitiveBoolean": "Boolean", +} diff --git a/nodes.py b/nodes.py index f89c328e9..a9c931dfa 100644 --- a/nodes.py +++ b/nodes.py @@ -2265,6 +2265,7 @@ def init_builtin_extra_nodes(): "nodes_lumina2.py", "nodes_wan.py", "nodes_hunyuan3d.py", + "nodes_primitive.py", ] import_failed = [] From 095610717000bffd477a7e72988d1fb2299afacb Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 21 Mar 2025 06:32:20 -0400 Subject: [PATCH 249/478] Nodes to convert images to YUV and back. Can be used to convert an image to black and white. --- comfy_extras/nodes_morphology.py | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/comfy_extras/nodes_morphology.py b/comfy_extras/nodes_morphology.py index b1372b8ce..075b26c40 100644 --- a/comfy_extras/nodes_morphology.py +++ b/comfy_extras/nodes_morphology.py @@ -2,6 +2,7 @@ import torch import comfy.model_management from kornia.morphology import dilation, erosion, opening, closing, gradient, top_hat, bottom_hat +import kornia.color class Morphology: @@ -40,8 +41,45 @@ class Morphology: img_out = output.to(comfy.model_management.intermediate_device()).movedim(1, -1) return (img_out,) + +class ImageRGBToYUV: + @classmethod + def INPUT_TYPES(s): + return {"required": { "image": ("IMAGE",), + }} + + RETURN_TYPES = ("IMAGE", "IMAGE", "IMAGE") + RETURN_NAMES = ("Y", "U", "V") + FUNCTION = "execute" + + CATEGORY = "image/batch" + + def execute(self, image): + out = kornia.color.rgb_to_ycbcr(image.movedim(-1, 1)).movedim(1, -1) + return (out[..., 0:1].expand_as(image), out[..., 1:2].expand_as(image), out[..., 2:3].expand_as(image)) + +class ImageYUVToRGB: + @classmethod + def INPUT_TYPES(s): + return {"required": {"Y": ("IMAGE",), + "U": ("IMAGE",), + "V": ("IMAGE",), + }} + + RETURN_TYPES = ("IMAGE",) + FUNCTION = "execute" + + CATEGORY = "image/batch" + + def execute(self, Y, U, V): + image = torch.cat([torch.mean(Y, dim=-1, keepdim=True), torch.mean(U, dim=-1, keepdim=True), torch.mean(V, dim=-1, keepdim=True)], dim=-1) + out = kornia.color.ycbcr_to_rgb(image.movedim(-1, 1)).movedim(1, -1) + return (out,) + NODE_CLASS_MAPPINGS = { "Morphology": Morphology, + "ImageRGBToYUV": ImageRGBToYUV, + "ImageYUVToRGB": ImageYUVToRGB, } NODE_DISPLAY_NAME_MAPPINGS = { From 0cf227469929f74ae5ae887f3f7fa7e490e5e9d0 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 21 Mar 2025 13:50:09 -0400 Subject: [PATCH 250/478] Update frontend to 1.14 (#7343) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ceec006d2..c78d3c228 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.13.9 +comfyui-frontend-package==1.14.5 torch torchsde torchvision From 83e839a89be1dc6db0923bea45ff9eae43a8ea01 Mon Sep 17 00:00:00 2001 From: thot experiment <94414189+thot-experiment@users.noreply.github.com> Date: Fri, 21 Mar 2025 11:04:15 -0700 Subject: [PATCH 251/478] Native LotusD Implementation (#7125) * draft pass at a native comfy implementation of Lotus-D depth and normal est * fix model_sampling kludges * fix ruff --------- Co-authored-by: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> --- comfy/model_base.py | 14 ++++++++++++++ comfy/model_detection.py | 7 ++++++- comfy/supported_models.py | 18 ++++++++++++++++- comfy_extras/nodes_lotus.py | 29 ++++++++++++++++++++++++++++ comfy_extras/nodes_model_advanced.py | 8 +++++++- nodes.py | 1 + 6 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 comfy_extras/nodes_lotus.py diff --git a/comfy/model_base.py b/comfy/model_base.py index f02406ace..2fb4b1453 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -140,6 +140,7 @@ class BaseModel(torch.nn.Module): def _apply_model(self, x, t, c_concat=None, c_crossattn=None, control=None, transformer_options={}, **kwargs): sigma = t xc = self.model_sampling.calculate_input(sigma, x) + if c_concat is not None: xc = torch.cat([xc] + [c_concat], dim=1) @@ -601,6 +602,19 @@ class SDXL_instructpix2pix(IP2P, SDXL): else: self.process_ip2p_image_in = lambda image: image #diffusers ip2p +class Lotus(BaseModel): + def extra_conds(self, **kwargs): + out = {} + cross_attn = kwargs.get("cross_attn", None) + out['c_crossattn'] = comfy.conds.CONDCrossAttn(cross_attn) + device = kwargs["device"] + task_emb = torch.tensor([1, 0]).float().to(device) + task_emb = torch.cat([torch.sin(task_emb), torch.cos(task_emb)]).unsqueeze(0) + out['y'] = comfy.conds.CONDRegular(task_emb) + return out + + def __init__(self, model_config, model_type=ModelType.EPS, device=None): + super().__init__(model_config, model_type, device=device) class StableCascade_C(BaseModel): def __init__(self, model_config, model_type=ModelType.STABLE_CASCADE, device=None): diff --git a/comfy/model_detection.py b/comfy/model_detection.py index f9e96ab7e..4217f5831 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -682,8 +682,13 @@ def unet_config_from_diffusers_unet(state_dict, dtype=None): 'transformer_depth_output': [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0], 'use_temporal_attention': False, 'use_temporal_resblock': False} + LotusD = {'use_checkpoint': False, 'image_size': 32, 'out_channels': 4, 'use_spatial_transformer': True, 'legacy': False, 'adm_in_channels': 4, + 'dtype': dtype, 'in_channels': 4, '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': True, 'context_dim': 1024, '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} - 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] + supported_models = [LotusD, 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] for unet_config in supported_models: matches = True diff --git a/comfy/supported_models.py b/comfy/supported_models.py index be3aede60..fad00d35b 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -506,6 +506,22 @@ class SDXL_instructpix2pix(SDXL): def get_model(self, state_dict, prefix="", device=None): return model_base.SDXL_instructpix2pix(self, model_type=self.model_type(state_dict, prefix), device=device) +class LotusD(SD20): + unet_config = { + "model_channels": 320, + "use_linear_in_transformer": True, + "use_temporal_attention": False, + "adm_in_channels": 4, + "in_channels": 4, + } + + unet_extra_config = { + "num_classes": 'sequential' + } + + def get_model(self, state_dict, prefix="", device=None): + return model_base.Lotus(self, device=device) + class SD3(supported_models_base.BASE): unet_config = { "in_channels": 16, @@ -997,6 +1013,6 @@ class Hunyuan3Dv2mini(Hunyuan3Dv2): latent_format = latent_formats.Hunyuan3Dv2mini -models = [Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, Hunyuan3Dv2mini, Hunyuan3Dv2] +models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, Hunyuan3Dv2mini, Hunyuan3Dv2] models += [SVD_img2vid] diff --git a/comfy_extras/nodes_lotus.py b/comfy_extras/nodes_lotus.py new file mode 100644 index 000000000..739dbdd3d --- /dev/null +++ b/comfy_extras/nodes_lotus.py @@ -0,0 +1,29 @@ +import torch +import comfy.model_management as mm + +class LotusConditioning: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + }, + } + + RETURN_TYPES = ("CONDITIONING",) + RETURN_NAMES = ("conditioning",) + FUNCTION = "conditioning" + CATEGORY = "conditioning/lotus" + + def conditioning(self): + device = mm.get_torch_device() + #lotus uses a frozen encoder and null conditioning, i'm just inlining the results of that operation since it doesn't change + #and getting parity with the reference implementation would otherwise require inference and 800mb of tensors + prompt_embeds = torch.tensor([[[-0.3134765625, -0.447509765625, -0.00823974609375, -0.22802734375, 0.1785888671875, -0.2342529296875, -0.2188720703125, -0.0089111328125, -0.31396484375, 0.196533203125, -0.055877685546875, -0.3828125, -0.0965576171875, 0.0073394775390625, -0.284423828125, 0.07470703125, -0.086181640625, -0.211181640625, 0.0599365234375, 0.10693359375, 0.0007929801940917969, -0.78076171875, -0.382568359375, -0.1851806640625, -0.140625, -0.0936279296875, -0.1229248046875, -0.152099609375, -0.203857421875, -0.2349853515625, -0.2437744140625, -0.10858154296875, -0.08990478515625, 0.08892822265625, -0.2391357421875, -0.1611328125, -0.427978515625, -0.1336669921875, -0.27685546875, -0.1781005859375, -0.3857421875, 0.251953125, -0.055999755859375, -0.0712890625, -0.00130462646484375, 0.033477783203125, -0.26416015625, 0.07171630859375, -0.0090789794921875, -0.2025146484375, -0.2763671875, -0.09869384765625, -0.45751953125, -0.23095703125, 0.004528045654296875, -0.369140625, -0.366943359375, -0.205322265625, -0.1505126953125, -0.45166015625, -0.2059326171875, 0.0168609619140625, -0.305419921875, -0.150634765625, 0.02685546875, -0.609375, -0.019012451171875, 0.050445556640625, -0.0084381103515625, -0.31005859375, -0.184326171875, -0.15185546875, 0.06732177734375, 0.150390625, -0.10919189453125, -0.08837890625, -0.50537109375, -0.389892578125, -0.0294342041015625, -0.10491943359375, -0.187255859375, -0.43212890625, -0.328125, -1.060546875, 0.011871337890625, 0.04730224609375, -0.09521484375, -0.07452392578125, -0.29296875, -0.109130859375, -0.250244140625, -0.3828125, -0.171875, -0.03399658203125, -0.15478515625, -0.1861572265625, -0.2398681640625, 0.1053466796875, -0.22314453125, -0.1932373046875, -0.18798828125, -0.430419921875, -0.05364990234375, -0.474609375, -0.261474609375, -0.1077880859375, -0.439208984375, 0.08966064453125, -0.185302734375, -0.338134765625, -0.297119140625, -0.298583984375, -0.175537109375, -0.373291015625, -0.1397705078125, -0.260498046875, -0.383544921875, -0.09979248046875, -0.319580078125, -0.06884765625, -0.4365234375, -0.183837890625, -0.393310546875, -0.002277374267578125, 0.11236572265625, -0.260498046875, -0.2242431640625, -0.19384765625, -0.51123046875, 0.03216552734375, -0.048004150390625, -0.279052734375, -0.2978515625, -0.255615234375, 0.115478515625, -4.08984375, -0.1668701171875, -0.278076171875, -0.5712890625, -0.1385498046875, -0.244384765625, -0.41455078125, -0.244140625, -0.0677490234375, -0.141357421875, -0.11590576171875, -0.1439208984375, -0.0185394287109375, -2.490234375, -0.1549072265625, -0.2305908203125, -0.3828125, -0.1173095703125, -0.08258056640625, -0.1719970703125, -0.325439453125, -0.292724609375, -0.08154296875, -0.412353515625, -0.3115234375, -0.00832366943359375, 0.00489044189453125, -0.2236328125, -0.151123046875, -0.457275390625, -0.135009765625, -0.163330078125, -0.0819091796875, 0.06689453125, 0.0209197998046875, -0.11907958984375, -0.10369873046875, -0.2998046875, -0.478759765625, -0.07940673828125, -0.01517486572265625, -0.3017578125, -0.343994140625, -0.258544921875, -0.44775390625, -0.392822265625, -0.0255584716796875, -0.2998046875, 0.10833740234375, -0.271728515625, -0.36181640625, -0.255859375, -0.2056884765625, -0.055450439453125, 0.060516357421875, -0.45751953125, -0.2322998046875, -0.1737060546875, -0.40576171875, -0.2286376953125, -0.053070068359375, -0.0283660888671875, -0.1898193359375, -4.291534423828125e-05, -0.6591796875, -0.1717529296875, -0.479736328125, -0.1400146484375, -0.40771484375, 0.154296875, 0.003101348876953125, 0.00661468505859375, -0.2073974609375, -0.493408203125, 2.171875, -0.45361328125, -0.283935546875, -0.302001953125, -0.25146484375, -0.207275390625, -0.1524658203125, -0.72998046875, -0.08203125, 0.053192138671875, -0.2685546875, 0.1834716796875, -0.270263671875, -0.091552734375, -0.08319091796875, -0.1297607421875, -0.453857421875, 0.0687255859375, 0.0268096923828125, -0.16552734375, -0.4208984375, -0.1552734375, -0.057373046875, -0.300537109375, -0.04541015625, -0.486083984375, -0.2205810546875, -0.39013671875, 0.007488250732421875, -0.005329132080078125, -0.09759521484375, -0.1448974609375, -0.21923828125, -0.429443359375, -0.40087890625, -0.19384765625, -0.064453125, -0.0306243896484375, -0.045806884765625, -0.056793212890625, 0.119384765625, -0.2073974609375, -0.356201171875, -0.168212890625, -0.291748046875, -0.289794921875, -0.205322265625, -0.419677734375, -0.478271484375, -0.2037353515625, -0.368408203125, -0.186279296875, -0.427734375, -0.1756591796875, 0.07501220703125, -0.2457275390625, -0.03692626953125, 0.003997802734375, -5.7578125, -0.01052093505859375, -0.2305908203125, -0.2252197265625, -0.197509765625, -0.1566162109375, -0.1668701171875, -0.383056640625, -0.05413818359375, 0.12188720703125, -0.369873046875, -0.0184478759765625, -0.150146484375, -0.51123046875, -0.45947265625, -0.1561279296875, 0.060455322265625, 0.043487548828125, -0.1370849609375, -0.069091796875, -0.285888671875, -0.44482421875, -0.2374267578125, -0.2191162109375, -0.434814453125, -0.0360107421875, 0.1298828125, 0.0217742919921875, -0.51220703125, -0.13525390625, -0.09381103515625, -0.276611328125, -0.171875, -0.17138671875, -0.4443359375, -0.2178955078125, -0.269775390625, -0.38623046875, -0.31591796875, -0.42333984375, -0.280029296875, -0.255615234375, -0.17041015625, 0.06268310546875, -0.1878662109375, -0.00677490234375, -0.23583984375, -0.08795166015625, -0.2232666015625, -0.1719970703125, -0.484130859375, -0.328857421875, 0.04669189453125, -0.0419921875, -0.11114501953125, 0.02313232421875, -0.0033130645751953125, -0.6005859375, 0.09051513671875, -0.1884765625, -0.262939453125, -0.375732421875, -0.525390625, -0.1170654296875, -0.3779296875, -0.242919921875, -0.419921875, 0.0665283203125, -0.343017578125, 0.06658935546875, -0.346435546875, -0.1363525390625, -0.2000732421875, -0.3837890625, 0.028167724609375, 0.043853759765625, -0.0171051025390625, -0.477294921875, -0.107421875, -0.129150390625, -0.319580078125, -0.32177734375, -0.4951171875, -0.010589599609375, -0.1778564453125, -0.40234375, -0.0810546875, 0.03314208984375, -0.13720703125, -0.31591796875, -0.048248291015625, -0.274658203125, -0.0689697265625, -0.027130126953125, -0.0953369140625, 0.146728515625, -0.38671875, -0.025390625, -0.42333984375, -0.41748046875, -0.379638671875, -0.1978759765625, -0.533203125, -0.33544921875, 0.0694580078125, -0.322998046875, -0.1876220703125, 0.0094451904296875, 0.1839599609375, -0.254150390625, -0.30078125, -0.09228515625, -0.0885009765625, 0.12371826171875, 0.1500244140625, -0.12152099609375, -0.29833984375, 0.03924560546875, -0.1470947265625, -0.1610107421875, -0.2049560546875, -0.01708984375, -0.2470703125, -0.1522216796875, -0.25830078125, 0.10870361328125, -0.302490234375, -0.2376708984375, -0.360107421875, -0.443359375, -0.0784912109375, -0.63623046875, -0.0980224609375, -0.332275390625, -0.1749267578125, -0.30859375, -0.1968994140625, -0.250244140625, -0.447021484375, -0.18408203125, -0.006908416748046875, -0.2044677734375, -0.2548828125, -0.369140625, -0.11328125, -0.1103515625, -0.27783203125, -0.325439453125, 0.01381683349609375, 0.036773681640625, -0.1458740234375, -0.34619140625, -0.232177734375, -0.0562744140625, -0.4482421875, -0.21875, -0.0855712890625, -0.276123046875, -0.1544189453125, -0.223388671875, -0.259521484375, 0.0865478515625, -0.0038013458251953125, -0.340087890625, -0.076171875, -0.25341796875, -0.0007548332214355469, -0.060455322265625, -0.352294921875, 0.035736083984375, -0.2181396484375, -0.2318115234375, -0.1707763671875, 0.018646240234375, 0.093505859375, -0.197021484375, 0.033477783203125, -0.035247802734375, 0.0440673828125, -0.2056884765625, -0.040924072265625, -0.05865478515625, 0.056884765625, -0.08807373046875, -0.10845947265625, 0.09564208984375, -0.10888671875, -0.332275390625, -0.1119384765625, -0.115478515625, 13.0234375, 0.0030040740966796875, -0.53662109375, -0.1856689453125, -0.068115234375, -0.143798828125, -0.177978515625, -0.32666015625, -0.353515625, -0.1563720703125, -0.3203125, 0.0085906982421875, -0.1043701171875, -0.365478515625, -0.303466796875, -0.34326171875, -0.410888671875, -0.03790283203125, -0.11419677734375, -0.2939453125, 0.074462890625, -0.21826171875, 0.0242767333984375, -0.226318359375, -0.353515625, -0.177734375, -0.169189453125, -0.2423095703125, -0.12115478515625, -0.07843017578125, -0.341064453125, -0.2117919921875, -0.505859375, -0.544921875, -0.3935546875, -0.10772705078125, -0.2054443359375, -0.136474609375, -0.1796875, -0.396240234375, -0.1971435546875, -0.68408203125, -0.032684326171875, -0.03863525390625, -0.0709228515625, -0.1005859375, -0.156005859375, -0.3837890625, -0.319580078125, 0.11102294921875, -0.394287109375, 0.0799560546875, -0.50341796875, -0.1572265625, 0.004131317138671875, -0.12286376953125, -0.2347412109375, -0.29150390625, -0.10321044921875, -0.286376953125, 0.018798828125, -0.152099609375, -0.321044921875, 0.0191650390625, -0.11376953125, -0.54736328125, 0.15869140625, -0.257568359375, -0.2490234375, -0.3115234375, -0.09765625, -0.350830078125, -0.36376953125, -0.0771484375, -0.2298583984375, -0.30615234375, -0.052154541015625, -0.12091064453125, -0.40283203125, -0.1649169921875, 0.0206451416015625, -0.312744140625, -0.10308837890625, -0.50341796875, -0.1754150390625, -0.2003173828125, -0.173583984375, -0.204833984375, -0.1876220703125, -0.12176513671875, -0.06201171875, -0.03485107421875, -0.20068359375, -0.21484375, -0.246337890625, -0.006587982177734375, -0.09674072265625, -0.4658203125, -0.3994140625, -0.2210693359375, -0.09588623046875, -0.126220703125, -0.09222412109375, -0.145751953125, -0.217529296875, -0.289306640625, -0.28271484375, -0.1787109375, -0.169189453125, -0.359375, -0.21826171875, -0.043792724609375, -0.205322265625, -0.2900390625, -0.055419921875, -0.1490478515625, -0.340576171875, -0.045928955078125, -0.30517578125, -0.51123046875, -0.1046142578125, -0.349853515625, -0.10882568359375, -0.16748046875, -0.267333984375, -0.122314453125, -0.0985107421875, -0.3076171875, -0.1766357421875, -0.251708984375, 0.1964111328125, -0.2220458984375, -0.2349853515625, -0.035980224609375, -0.1749267578125, -0.237060546875, -0.480224609375, -0.240234375, -0.09539794921875, -0.2481689453125, -0.389404296875, -0.1748046875, -0.370849609375, -0.010650634765625, -0.147705078125, -0.0035457611083984375, -0.32568359375, -0.29931640625, -0.1395263671875, -0.28173828125, -0.09820556640625, -0.0176239013671875, -0.05926513671875, -0.0755615234375, -0.1746826171875, -0.283203125, -0.1617431640625, -0.4404296875, 0.046234130859375, -0.183837890625, -0.052032470703125, -0.24658203125, -0.11224365234375, -0.100830078125, -0.162841796875, -0.29736328125, -0.396484375, 0.11798095703125, -0.006496429443359375, -0.32568359375, -0.347900390625, -0.04595947265625, -0.09637451171875, -0.344970703125, -0.01166534423828125, -0.346435546875, -0.2861328125, -0.1845703125, -0.276611328125, -0.01312255859375, -0.395263671875, -0.50927734375, -0.1114501953125, -0.1861572265625, -0.2158203125, -0.1812744140625, 0.055419921875, -0.294189453125, 0.06500244140625, -0.1444091796875, -0.06365966796875, -0.18408203125, -0.0091705322265625, -0.1640625, -0.1856689453125, 0.090087890625, 0.024566650390625, -0.0195159912109375, -0.5546875, -0.301025390625, -0.438232421875, -0.072021484375, 0.030517578125, -0.1490478515625, 0.04888916015625, -0.23681640625, -0.1553955078125, -0.018096923828125, -0.229736328125, -0.2919921875, -0.355712890625, -0.285400390625, -0.1756591796875, -0.08355712890625, -0.416259765625, 0.022674560546875, -0.417236328125, 0.410400390625, -0.249755859375, 0.015625, -0.033599853515625, -0.040313720703125, -0.51708984375, -0.0518798828125, -0.08843994140625, -0.2022705078125, -0.3740234375, -0.285888671875, -0.176025390625, -0.292724609375, -0.369140625, -0.08367919921875, -0.356689453125, -0.38623046875, 0.06549072265625, 0.1669921875, -0.2099609375, -0.007434844970703125, 0.12890625, -0.0040740966796875, -0.2174072265625, -0.025115966796875, -0.2364501953125, -0.1695556640625, -0.0469970703125, -0.03924560546875, -0.36181640625, -0.047515869140625, -0.3154296875, -0.275634765625, -0.25634765625, -0.061920166015625, -0.12164306640625, -0.47314453125, -0.10784912109375, -0.74755859375, -0.13232421875, -0.32421875, -0.04998779296875, -0.286376953125, 0.10345458984375, -0.1710205078125, -0.388916015625, 0.12744140625, -0.3359375, -0.302490234375, -0.238525390625, -0.1455078125, -0.15869140625, -0.2427978515625, -0.0355224609375, -0.11944580078125, -0.31298828125, 0.11456298828125, -0.287841796875, -0.5439453125, -0.3076171875, -0.08642578125, -0.2408447265625, -0.283447265625, -0.428466796875, -0.085693359375, -0.1683349609375, 0.255126953125, 0.07635498046875, -0.38623046875, -0.2025146484375, -0.1331787109375, -0.10821533203125, -0.49951171875, 0.09130859375, -0.19677734375, -0.01904296875, -0.151123046875, -0.344482421875, -0.316650390625, -0.03900146484375, 0.1397705078125, 0.1334228515625, -0.037200927734375, -0.01861572265625, -0.1351318359375, -0.07037353515625, -0.380615234375, -0.34033203125, -0.06903076171875, 0.219970703125, 0.0132598876953125, -0.15869140625, -0.6376953125, 0.158935546875, -0.5283203125, -0.2320556640625, -0.185791015625, -0.2132568359375, -0.436767578125, -0.430908203125, -0.1763916015625, -0.0007672309875488281, -0.424072265625, -0.06719970703125, -0.347900390625, -0.14453125, -0.3056640625, -0.36474609375, -0.35986328125, -0.46240234375, -0.446044921875, -0.1905517578125, -0.1114501953125, -0.42919921875, -0.0643310546875, -0.3662109375, -0.4296875, -0.10968017578125, -0.2998046875, -0.1756591796875, -0.4052734375, -0.0841064453125, -0.252197265625, -0.047393798828125, 0.00434112548828125, -0.10040283203125, -0.271484375, -0.185302734375, -0.1910400390625, 0.10260009765625, 0.01393890380859375, -0.03350830078125, -0.33935546875, -0.329345703125, 0.0574951171875, -0.18896484375, -0.17724609375, -0.42919921875, -0.26708984375, -0.4189453125, -0.149169921875, -0.265625, -0.198974609375, -0.1722412109375, 0.1563720703125, -0.20947265625, -0.267822265625, -0.06353759765625, -0.365478515625, -0.340087890625, -0.3095703125, -0.320068359375, -0.0880126953125, -0.353759765625, -0.0005812644958496094, -0.1617431640625, -0.1866455078125, -0.201416015625, -0.181396484375, -0.2349853515625, -0.384765625, -0.5244140625, 0.01227569580078125, -0.21337890625, -0.30810546875, -0.17578125, -0.3037109375, -0.52978515625, -0.1561279296875, -0.296142578125, 0.057342529296875, -0.369384765625, -0.107666015625, -0.338623046875, -0.2060546875, -0.0213775634765625, -0.394775390625, -0.219482421875, -0.125732421875, -0.03997802734375, -0.42431640625, -0.134521484375, -0.2418212890625, -0.10504150390625, 0.1552734375, 0.1126708984375, -0.1427001953125, -0.133544921875, -0.111083984375, -0.375732421875, -0.2783203125, -0.036834716796875, -0.11053466796875, 0.2471923828125, -0.2529296875, -0.56494140625, -0.374755859375, -0.326416015625, 0.2137451171875, -0.09454345703125, -0.337158203125, -0.3359375, -0.34375, -0.0999755859375, -0.388671875, 0.0103302001953125, 0.14990234375, -0.2041015625, -0.39501953125, -0.39013671875, -0.1258544921875, 0.1453857421875, -0.250732421875, -0.06732177734375, -0.10638427734375, -0.032379150390625, -0.35888671875, -0.098876953125, -0.172607421875, 0.05126953125, -0.1956787109375, -0.183837890625, -0.37060546875, 0.1556396484375, -0.34375, -0.28662109375, -0.06982421875, -0.302490234375, -0.281005859375, -0.1640625, -0.5302734375, -0.1368408203125, -0.1268310546875, -0.35302734375, -0.1473388671875, -0.45556640625, -0.35986328125, -0.273681640625, -0.2249755859375, -0.1893310546875, 0.09356689453125, -0.248291015625, -0.197998046875, -0.3525390625, -0.30126953125, -0.228271484375, -0.2421875, -0.0906982421875, 0.227783203125, -0.296875, -0.009796142578125, -0.2939453125, -0.1021728515625, -0.215576171875, -0.267822265625, -0.052642822265625, 0.203369140625, -0.1417236328125, 0.18505859375, 0.12347412109375, -0.0972900390625, -0.54052734375, -0.430419921875, -0.0906982421875, -0.5419921875, -0.22900390625, -0.0625, -0.12152099609375, -0.495849609375, -0.206787109375, -0.025848388671875, 0.039031982421875, -0.453857421875, -0.318359375, -0.426025390625, -0.3701171875, -0.2169189453125, 0.0845947265625, -0.045654296875, 0.11090087890625, 0.0012454986572265625, 0.2066650390625, -0.046356201171875, -0.2337646484375, -0.295654296875, 0.057891845703125, -0.1639404296875, -0.0535888671875, -0.2607421875, -0.1488037109375, -0.16015625, -0.54345703125, -0.2305908203125, -0.55029296875, -0.178955078125, -0.222412109375, -0.0711669921875, -0.12298583984375, -0.119140625, -0.253662109375, -0.33984375, -0.11322021484375, -0.10723876953125, -0.205078125, -0.360595703125, 0.085205078125, -0.252197265625, -0.365966796875, -0.26953125, 0.2000732421875, -0.50634765625, 0.05706787109375, -0.3115234375, 0.0242919921875, -0.1689453125, -0.2401123046875, -0.3759765625, -0.2125244140625, 0.076416015625, -0.489013671875, -0.11749267578125, -0.55908203125, -0.313232421875, -0.572265625, -0.1387939453125, -0.037078857421875, -0.385498046875, 0.0323486328125, -0.39404296875, -0.05072021484375, -0.10430908203125, -0.10919189453125, -0.28759765625, -0.37451171875, -0.016937255859375, -0.2200927734375, -0.296875, -0.0286712646484375, -0.213134765625, 0.052001953125, -0.052337646484375, -0.253662109375, 0.07269287109375, -0.2498779296875, -0.150146484375, -0.09930419921875, -0.343505859375, 0.254150390625, -0.032440185546875, -0.296142578125], [1.4111328125, 0.00757598876953125, -0.428955078125, 0.089599609375, 0.0227813720703125, -0.0350341796875, -1.0986328125, 0.194091796875, 2.115234375, -0.75439453125, 0.269287109375, -0.73486328125, -1.1025390625, -0.050262451171875, -0.5830078125, 0.0268707275390625, -0.603515625, -0.6025390625, -1.1689453125, 0.25048828125, -0.4189453125, -0.5517578125, -0.30322265625, 0.7724609375, 0.931640625, -0.1422119140625, 2.27734375, -0.56591796875, 1.013671875, -0.9638671875, -0.66796875, -0.8125, 1.3740234375, -1.060546875, -1.029296875, -1.6796875, 0.62890625, 0.49365234375, 0.671875, 0.99755859375, -1.0185546875, -0.047027587890625, -0.374267578125, 0.2354736328125, 1.4970703125, -1.5673828125, 0.448974609375, 0.2078857421875, -1.060546875, -0.171875, -0.6201171875, -0.1607666015625, 0.7548828125, -0.58935546875, -0.2052001953125, 0.060791015625, 0.200439453125, 3.154296875, -3.87890625, 2.03515625, 1.126953125, 0.1640625, -1.8447265625, 0.002620697021484375, 0.7998046875, -0.337158203125, 0.47216796875, -0.5849609375, 0.9970703125, 0.3935546875, 1.22265625, -1.5048828125, -0.65673828125, 1.1474609375, -1.73046875, -1.8701171875, 1.529296875, -0.6787109375, -1.4453125, 1.556640625, -0.327392578125, 2.986328125, -0.146240234375, -2.83984375, 0.303466796875, -0.71728515625, -0.09698486328125, -0.2423095703125, 0.6767578125, -2.197265625, -0.86279296875, -0.53857421875, -1.2236328125, 1.669921875, -1.1689453125, -0.291259765625, -0.54736328125, -0.036346435546875, 1.041015625, -1.7265625, -0.6064453125, -0.1634521484375, 0.2381591796875, 0.65087890625, -1.169921875, 1.9208984375, 0.5634765625, 0.37841796875, 0.798828125, -1.021484375, -0.4091796875, 2.275390625, -0.302734375, -1.7783203125, 1.0458984375, 1.478515625, 0.708984375, -1.541015625, -0.0006041526794433594, 1.1884765625, 2.041015625, 0.560546875, -0.1131591796875, 1.0341796875, 0.06121826171875, 2.6796875, -0.53369140625, -1.2490234375, -0.7333984375, -1.017578125, -1.0078125, 1.3212890625, -0.47607421875, -1.4189453125, 0.54052734375, -0.796875, -0.73095703125, -1.412109375, -0.94873046875, -2.2734375, -1.1220703125, -1.3837890625, -0.5087890625, -1.0380859375, -0.93603515625, -0.58349609375, -1.0703125, -1.10546875, -2.60546875, 0.062225341796875, 0.38232421875, -0.411376953125, -0.369140625, -0.9833984375, -0.7294921875, -0.181396484375, -0.47216796875, -0.56884765625, -0.11041259765625, -2.673828125, 0.27783203125, -0.857421875, 0.9296875, 1.9580078125, 0.1385498046875, -1.91796875, -1.529296875, 0.53857421875, 0.509765625, -0.90380859375, -0.0947265625, -2.083984375, 0.9228515625, -0.28564453125, -0.80859375, -0.093505859375, -0.6015625, -1.255859375, 0.6533203125, 0.327880859375, -0.07598876953125, -0.22705078125, -0.30078125, -0.5185546875, -1.6044921875, 1.5927734375, 1.416015625, -0.91796875, -0.276611328125, -0.75830078125, -1.1689453125, -1.7421875, 1.0546875, -0.26513671875, -0.03314208984375, 0.278076171875, -1.337890625, 0.055023193359375, 0.10546875, -1.064453125, 1.048828125, -1.4052734375, -1.1240234375, -0.51416015625, -1.05859375, -1.7265625, -1.1328125, 0.43310546875, -2.576171875, -2.140625, -0.79345703125, 0.50146484375, 1.96484375, 0.98583984375, 0.337646484375, -0.77978515625, 0.85498046875, -0.65185546875, -0.484375, 2.708984375, 0.55810546875, -0.147216796875, -0.5537109375, -0.75439453125, -1.736328125, 1.1259765625, -1.095703125, -0.2587890625, 2.978515625, 0.335205078125, 0.357666015625, -0.09356689453125, 0.295654296875, -0.23779296875, 1.5751953125, 0.10400390625, 1.7001953125, -0.72900390625, -1.466796875, -0.2012939453125, 0.634765625, -0.1556396484375, -2.01171875, 0.32666015625, 0.047454833984375, -0.1671142578125, -0.78369140625, -0.994140625, 0.7802734375, -0.1429443359375, -0.115234375, 0.53271484375, -0.96142578125, -0.064208984375, 1.396484375, 1.654296875, -1.6015625, -0.77392578125, 0.276123046875, -0.42236328125, 0.8642578125, 0.533203125, 0.397216796875, -1.21484375, 0.392578125, -0.501953125, -0.231689453125, 1.474609375, 1.6669921875, 1.8662109375, -1.2998046875, 0.223876953125, -0.51318359375, -0.437744140625, -1.16796875, -0.7724609375, 1.6826171875, 0.62255859375, 2.189453125, -0.599609375, -0.65576171875, -1.1005859375, -0.45263671875, -0.292236328125, 2.58203125, -1.3779296875, 0.23486328125, -1.708984375, -1.4111328125, -0.5078125, -0.8525390625, -0.90771484375, 0.861328125, -2.22265625, -1.380859375, 0.7275390625, 0.85595703125, -0.77978515625, 2.044921875, -0.430908203125, 0.78857421875, -1.21484375, -0.09130859375, 0.5146484375, -1.92578125, -0.1396484375, 0.289306640625, 0.60498046875, 0.93896484375, -0.09295654296875, -0.45751953125, -0.986328125, -0.66259765625, 1.48046875, 0.274169921875, -0.267333984375, -1.3017578125, -1.3623046875, -1.982421875, -0.86083984375, -0.41259765625, -0.2939453125, -1.91015625, 1.6826171875, 0.437255859375, 1.0029296875, 0.376220703125, -0.010467529296875, -0.82861328125, -0.513671875, -3.134765625, 1.0205078125, -1.26171875, -1.009765625, 1.0869140625, -0.95703125, 0.0103759765625, 1.642578125, 0.78564453125, 1.029296875, 0.496826171875, 1.2880859375, 0.5234375, 0.05322265625, -0.206787109375, -0.79443359375, -1.1669921875, 0.049530029296875, -0.27978515625, 0.0237884521484375, -0.74169921875, -1.068359375, 0.86083984375, 1.1787109375, 0.91064453125, -0.453857421875, -1.822265625, -0.9228515625, -0.50048828125, 0.359130859375, 0.802734375, -1.3564453125, -0.322509765625, -1.1123046875, -1.0390625, -0.52685546875, -1.291015625, -0.343017578125, -1.2109375, -0.19091796875, 2.146484375, -0.04315185546875, -0.3701171875, -2.044921875, -0.429931640625, -0.56103515625, -0.166015625, -0.4658203125, -2.29296875, -1.078125, -1.0927734375, -0.1033935546875, -0.56103515625, -0.05743408203125, -1.986328125, -0.513671875, 0.70361328125, -2.484375, -1.3037109375, -1.6650390625, 0.4814453125, -0.84912109375, -2.697265625, -0.197998046875, 0.0869140625, -0.172607421875, -1.326171875, -1.197265625, 1.23828125, -0.38720703125, -0.075927734375, 0.02569580078125, -1.2119140625, 0.09027099609375, -2.12890625, -1.640625, -0.1524658203125, 0.2373046875, 1.37109375, 2.248046875, 1.4619140625, 0.3134765625, 0.50244140625, -0.1383056640625, -1.2705078125, 0.7353515625, 0.65771484375, -0.431396484375, -1.341796875, 0.10089111328125, 0.208984375, -0.0099945068359375, 0.83203125, 1.314453125, -0.422607421875, -1.58984375, -0.6044921875, 0.23681640625, -1.60546875, -0.61083984375, -1.5615234375, 1.62890625, -0.6728515625, -0.68212890625, -0.5224609375, -0.9150390625, -0.468994140625, 0.268310546875, 0.287353515625, -0.025543212890625, 0.443603515625, 1.62109375, -1.08984375, -0.5556640625, 1.03515625, -0.31298828125, -0.041778564453125, 0.260986328125, 0.34716796875, -2.326171875, 0.228271484375, -0.85107421875, -2.255859375, 0.3486328125, -0.25830078125, -0.3671875, -0.796875, -1.115234375, 1.8369140625, -0.19775390625, -1.236328125, -0.0447998046875, 0.69921875, 1.37890625, 1.11328125, 0.0928955078125, 0.6318359375, -0.62353515625, 0.55859375, -0.286865234375, 1.5361328125, -0.391357421875, -0.052215576171875, -1.12890625, 0.55517578125, -0.28515625, -0.3603515625, 0.68896484375, 0.67626953125, 0.003070831298828125, 1.2236328125, 0.1597900390625, -1.3076171875, 0.99951171875, -2.5078125, -1.2119140625, 0.1749267578125, -1.1865234375, -1.234375, -0.1180419921875, -1.751953125, 0.033050537109375, 0.234130859375, -3.107421875, -1.0380859375, 0.61181640625, -0.87548828125, 0.3154296875, -1.103515625, 0.261474609375, -1.130859375, -0.7470703125, -0.43408203125, 1.3828125, -0.41259765625, -1.7587890625, 0.765625, 0.004852294921875, 0.135498046875, -0.76953125, -0.1314697265625, 0.400390625, 1.43359375, 0.07135009765625, 0.0645751953125, -0.5869140625, -0.5810546875, -0.2900390625, -1.3037109375, 0.1287841796875, -0.27490234375, 0.59228515625, 2.333984375, -0.54541015625, -0.556640625, 0.447265625, -0.806640625, 0.09149169921875, -0.70654296875, -0.357177734375, -1.099609375, -0.5576171875, -0.44189453125, 0.400390625, -0.666015625, -1.4619140625, 0.728515625, -1.5986328125, 0.153076171875, -0.126708984375, -2.83984375, -1.84375, -0.2469482421875, 0.677734375, 0.43701171875, 3.298828125, 1.1591796875, -0.7158203125, -0.8251953125, 0.451171875, -2.376953125, -0.58642578125, -0.86767578125, 0.0789794921875, 0.1351318359375, -0.325439453125, 0.484375, 1.166015625, -0.1610107421875, -0.15234375, -0.54638671875, -0.806640625, 0.285400390625, 0.1661376953125, -0.50146484375, -1.0478515625, 1.5751953125, 0.0313720703125, 0.2396240234375, -0.6572265625, -0.1258544921875, -1.060546875, 1.3076171875, -0.301513671875, -1.2412109375, 0.6376953125, -1.5693359375, 0.354248046875, 0.2427978515625, -0.392333984375, 0.61962890625, -0.58837890625, -1.71484375, -0.2098388671875, -0.828125, 0.330810546875, 0.16357421875, -0.2259521484375, 0.0972900390625, -0.451416015625, 1.79296875, -1.673828125, -1.58203125, -2.099609375, -0.487548828125, -0.87060546875, 0.62646484375, -1.470703125, -0.1558837890625, 0.4609375, 1.3369140625, 0.2322998046875, 0.1632080078125, 0.65966796875, 1.0810546875, 0.1041259765625, 0.63232421875, -0.32421875, -1.04296875, -1.046875, -1.3720703125, -0.8486328125, 0.1290283203125, 0.137939453125, 0.1549072265625, -1.0908203125, 0.0167694091796875, -0.31689453125, 1.390625, 0.07269287109375, 1.0390625, 1.1162109375, -0.455810546875, -0.06689453125, -0.053741455078125, 0.5048828125, -0.8408203125, -1.19921875, 0.87841796875, 0.7421875, 0.2030029296875, 0.109619140625, -0.59912109375, -1.337890625, -0.74169921875, -0.64453125, -1.326171875, 0.21044921875, -1.3583984375, -1.685546875, -0.472900390625, -0.270263671875, 0.99365234375, -0.96240234375, 1.1279296875, -0.45947265625, -0.45654296875, -0.99169921875, -3.515625, -1.9853515625, 0.73681640625, 0.92333984375, -0.56201171875, -1.4453125, -2.078125, 0.94189453125, -1.333984375, 0.0982666015625, 0.60693359375, 0.367431640625, 3.015625, -1.1357421875, -1.5634765625, 0.90234375, -0.1783447265625, 0.1802978515625, -0.317138671875, -0.513671875, 1.2353515625, -0.033203125, 1.4482421875, 1.0087890625, 0.9248046875, 0.10418701171875, 0.7626953125, -1.3798828125, 0.276123046875, 0.55224609375, 1.1005859375, -0.62158203125, -0.806640625, 0.65087890625, 0.270263671875, -0.339111328125, -0.9384765625, -0.09381103515625, -0.7216796875, 1.37890625, -0.398193359375, -0.3095703125, -1.4912109375, 0.96630859375, 0.43798828125, 0.62255859375, 0.0213470458984375, 0.235595703125, -1.2958984375, 0.0157318115234375, -0.810546875, 1.9736328125, -0.2462158203125, 0.720703125, 0.822265625, -0.755859375, -0.658203125, 0.344482421875, -2.892578125, -0.282470703125, 1.2529296875, -0.294189453125, 0.6748046875, -0.80859375, 0.9287109375, 1.27734375, -1.71875, -0.166015625, 0.47412109375, -0.41259765625, -1.3681640625, -0.978515625, -0.77978515625, -1.044921875, -0.90380859375, -0.08184814453125, -0.86181640625, -0.10772705078125, -0.299560546875, -0.4306640625, -0.47119140625, 0.95703125, 1.107421875, 0.91796875, 0.76025390625, 0.7392578125, -0.09161376953125, -0.7392578125, 0.9716796875, -0.395751953125, -0.75390625, -0.164306640625, -0.087646484375, 0.028564453125, -0.91943359375, -0.66796875, 2.486328125, 0.427734375, 0.626953125, 0.474853515625, 0.0926513671875, 0.830078125, -0.6923828125, 0.7841796875, -0.89208984375, -2.482421875, 0.034912109375, -1.3447265625, -0.475341796875, -0.286376953125, -0.732421875, 0.190673828125, -0.491455078125, -3.091796875, -1.2783203125, -0.66015625, -0.1507568359375, 0.042236328125, -1.025390625, 0.12744140625, -1.984375, -0.393798828125, -1.25, -1.140625, 1.77734375, 0.2457275390625, -0.8017578125, 0.7763671875, -0.387939453125, -0.3662109375, 1.1572265625, 0.123291015625, -0.07135009765625, 1.412109375, -0.685546875, -3.078125, 0.031524658203125, -0.70458984375, 0.78759765625, 0.433837890625, -1.861328125, -1.33203125, 2.119140625, -1.3544921875, -0.6591796875, -1.4970703125, 0.40625, -2.078125, -1.30859375, 0.050262451171875, -0.60107421875, 1.0078125, 0.05657958984375, -0.96826171875, 0.0264892578125, 0.159912109375, 0.84033203125, -1.1494140625, -0.0433349609375, -0.2034912109375, 1.09765625, -1.142578125, -0.283203125, -0.427978515625, 1.0927734375, -0.67529296875, -0.61572265625, 2.517578125, 0.84130859375, 1.8662109375, 0.1748046875, -0.407958984375, -0.029449462890625, -0.27587890625, -0.958984375, -0.10028076171875, 1.248046875, -0.0792236328125, -0.45556640625, 0.7685546875, 1.5556640625, -1.8759765625, -0.131591796875, -1.3583984375, 0.7890625, 0.80810546875, -1.0322265625, -0.53076171875, -0.1484375, -1.7841796875, -1.2470703125, 0.17138671875, -0.04864501953125, -0.80322265625, -0.0933837890625, 0.984375, 0.7001953125, 0.5380859375, 0.2022705078125, -1.1865234375, 0.5439453125, 1.1318359375, 0.79931640625, 0.32666015625, -1.26171875, 0.457763671875, 1.1591796875, -0.34423828125, 0.65771484375, 0.216552734375, 1.19140625, -0.2744140625, -0.020416259765625, -0.86376953125, 0.93017578125, 1.0556640625, 0.69873046875, -0.15087890625, -0.33056640625, 0.8505859375, 0.06890869140625, 0.359375, -0.262939453125, 0.12493896484375, 0.017059326171875, -0.98974609375, 0.5107421875, 0.2408447265625, 0.615234375, -0.62890625, 0.86962890625, -0.07427978515625, 0.85595703125, 0.300537109375, -1.072265625, -1.6064453125, -0.353515625, -0.484130859375, -0.6044921875, -0.455810546875, 0.95849609375, 1.3671875, 0.544921875, 0.560546875, 0.34521484375, -0.6513671875, -0.410400390625, -0.2021484375, -0.1656494140625, 0.073486328125, 0.84716796875, -1.7998046875, -1.0126953125, -0.1324462890625, 0.95849609375, -0.669921875, -0.79052734375, -2.193359375, -0.42529296875, -1.7275390625, -1.04296875, 0.716796875, -0.4423828125, -1.193359375, 0.61572265625, -1.5224609375, 0.62890625, -0.705078125, 0.677734375, -0.213134765625, -1.6748046875, -1.087890625, -0.65185546875, -1.1337890625, 2.314453125, -0.352783203125, -0.27001953125, -2.01953125, -1.2685546875, 0.308837890625, -0.280517578125, -1.3798828125, -1.595703125, 0.642578125, 1.693359375, -0.82470703125, -1.255859375, 0.57373046875, 1.5859375, 1.068359375, -0.876953125, 0.370849609375, 1.220703125, 0.59765625, 0.007602691650390625, 0.09326171875, -0.9521484375, -0.024932861328125, -0.94775390625, -0.299560546875, -0.002536773681640625, 1.41796875, -0.06903076171875, -1.5927734375, 0.353515625, 3.63671875, -0.765625, -1.1142578125, 0.4287109375, -0.86865234375, -0.9267578125, -0.21826171875, -1.10546875, 0.29296875, -0.225830078125, 0.5400390625, -0.45556640625, -0.68701171875, -0.79150390625, -1.0810546875, 0.25439453125, -1.2998046875, -0.494140625, -0.1510009765625, 1.5615234375, -0.4248046875, -0.486572265625, 0.45458984375, 0.047637939453125, -0.11639404296875, 0.057403564453125, 0.130126953125, -0.10125732421875, -0.56201171875, 1.4765625, -1.7451171875, 1.34765625, -0.45703125, 0.873046875, -0.056121826171875, -0.8876953125, -0.986328125, 1.5654296875, 0.49853515625, 0.55859375, -0.2198486328125, 0.62548828125, 0.2734375, -0.63671875, -0.41259765625, -1.2705078125, 0.0665283203125, 1.3369140625, 0.90283203125, -0.77685546875, -1.5, -1.8525390625, -1.314453125, -0.86767578125, -0.331787109375, 0.1590576171875, 0.94775390625, -0.1771240234375, 1.638671875, -2.17578125, 0.58740234375, 0.424560546875, -0.3466796875, 0.642578125, 0.473388671875, 0.96435546875, 1.38671875, -0.91357421875, 1.0361328125, -0.67333984375, 1.5009765625]]]).to(device) + + cond = [[prompt_embeds, {}]] + + return (cond,) + +NODE_CLASS_MAPPINGS = { + "LotusConditioning" : LotusConditioning, +} diff --git a/comfy_extras/nodes_model_advanced.py b/comfy_extras/nodes_model_advanced.py index ceac5654b..2b805c1ee 100644 --- a/comfy_extras/nodes_model_advanced.py +++ b/comfy_extras/nodes_model_advanced.py @@ -24,6 +24,10 @@ class X0(comfy.model_sampling.EPS): def calculate_denoised(self, sigma, model_output, model_input): return model_output +class Lotus(X0): + def calculate_input(self, sigma, noise): + return noise + class ModelSamplingDiscreteDistilled(comfy.model_sampling.ModelSamplingDiscrete): original_timesteps = 50 @@ -56,7 +60,7 @@ class ModelSamplingDiscrete: @classmethod def INPUT_TYPES(s): return {"required": { "model": ("MODEL",), - "sampling": (["eps", "v_prediction", "lcm", "x0"],), + "sampling": (["eps", "v_prediction", "lcm", "x0", "lotus"],), "zsnr": ("BOOLEAN", {"default": False}), }} @@ -78,6 +82,8 @@ class ModelSamplingDiscrete: sampling_base = ModelSamplingDiscreteDistilled elif sampling == "x0": sampling_type = X0 + elif sampling == "lotus": + sampling_type = Lotus class ModelSamplingAdvanced(sampling_base, sampling_type): pass diff --git a/nodes.py b/nodes.py index a9c931dfa..27ef743b3 100644 --- a/nodes.py +++ b/nodes.py @@ -2264,6 +2264,7 @@ def init_builtin_extra_nodes(): "nodes_video.py", "nodes_lumina2.py", "nodes_wan.py", + "nodes_lotus.py", "nodes_hunyuan3d.py", "nodes_primitive.py", ] From d9fa9d307ff49d3bad50b623306118d483a387fd Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 21 Mar 2025 14:19:37 -0400 Subject: [PATCH 252/478] Automatically set the right sampling type for lotus. --- comfy/model_base.py | 5 ++++- comfy/model_sampling.py | 9 +++++++++ comfy_extras/nodes_model_advanced.py | 16 ++++------------ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index 2fb4b1453..eec70d5de 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -59,6 +59,7 @@ class ModelType(Enum): FLOW = 6 V_PREDICTION_CONTINUOUS = 7 FLUX = 8 + IMG_TO_IMG = 9 from comfy.model_sampling import EPS, V_PREDICTION, EDM, ModelSamplingDiscrete, ModelSamplingContinuousEDM, StableCascadeSampling, ModelSamplingContinuousV @@ -89,6 +90,8 @@ def model_sampling(model_config, model_type): elif model_type == ModelType.FLUX: c = comfy.model_sampling.CONST s = comfy.model_sampling.ModelSamplingFlux + elif model_type == ModelType.IMG_TO_IMG: + c = comfy.model_sampling.IMG_TO_IMG class ModelSampling(s, c): pass @@ -613,7 +616,7 @@ class Lotus(BaseModel): out['y'] = comfy.conds.CONDRegular(task_emb) return out - def __init__(self, model_config, model_type=ModelType.EPS, device=None): + def __init__(self, model_config, model_type=ModelType.IMG_TO_IMG, device=None): super().__init__(model_config, model_type, device=device) class StableCascade_C(BaseModel): diff --git a/comfy/model_sampling.py b/comfy/model_sampling.py index ff27b09a8..b79af1e92 100644 --- a/comfy/model_sampling.py +++ b/comfy/model_sampling.py @@ -69,6 +69,15 @@ class CONST: sigma = sigma.view(sigma.shape[:1] + (1,) * (latent.ndim - 1)) return latent / (1.0 - sigma) +class X0(EPS): + def calculate_denoised(self, sigma, model_output, model_input): + return model_output + +class IMG_TO_IMG(X0): + def calculate_input(self, sigma, noise): + return noise + + class ModelSamplingDiscrete(torch.nn.Module): def __init__(self, model_config=None, zsnr=None): super().__init__() diff --git a/comfy_extras/nodes_model_advanced.py b/comfy_extras/nodes_model_advanced.py index 2b805c1ee..71a652ffa 100644 --- a/comfy_extras/nodes_model_advanced.py +++ b/comfy_extras/nodes_model_advanced.py @@ -20,14 +20,6 @@ class LCM(comfy.model_sampling.EPS): return c_out * x0 + c_skip * model_input -class X0(comfy.model_sampling.EPS): - def calculate_denoised(self, sigma, model_output, model_input): - return model_output - -class Lotus(X0): - def calculate_input(self, sigma, noise): - return noise - class ModelSamplingDiscreteDistilled(comfy.model_sampling.ModelSamplingDiscrete): original_timesteps = 50 @@ -60,7 +52,7 @@ class ModelSamplingDiscrete: @classmethod def INPUT_TYPES(s): return {"required": { "model": ("MODEL",), - "sampling": (["eps", "v_prediction", "lcm", "x0", "lotus"],), + "sampling": (["eps", "v_prediction", "lcm", "x0", "img_to_img"],), "zsnr": ("BOOLEAN", {"default": False}), }} @@ -81,9 +73,9 @@ class ModelSamplingDiscrete: sampling_type = LCM sampling_base = ModelSamplingDiscreteDistilled elif sampling == "x0": - sampling_type = X0 - elif sampling == "lotus": - sampling_type = Lotus + sampling_type = comfy.model_sampling.X0 + elif sampling == "img_to_img": + sampling_type = comfy.model_sampling.IMG_TO_IMG class ModelSamplingAdvanced(sampling_base, sampling_type): pass From 2206246055af7996ee8c6cb79346767d90da8372 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Fri, 21 Mar 2025 16:24:13 -0400 Subject: [PATCH 253/478] support output normal and lineart once (#7290) --- comfy_extras/nodes_load_3d.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/comfy_extras/nodes_load_3d.py b/comfy_extras/nodes_load_3d.py index 8b43cf218..db30030fb 100644 --- a/comfy_extras/nodes_load_3d.py +++ b/comfy_extras/nodes_load_3d.py @@ -21,8 +21,8 @@ class Load3D(): "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), }} - RETURN_TYPES = ("IMAGE", "MASK", "STRING") - RETURN_NAMES = ("image", "mask", "mesh_path") + RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "IMAGE") + RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "lineart") FUNCTION = "process" EXPERIMENTAL = True @@ -32,12 +32,16 @@ class Load3D(): def process(self, model_file, image, **kwargs): image_path = folder_paths.get_annotated_filepath(image['image']) mask_path = folder_paths.get_annotated_filepath(image['mask']) + normal_path = folder_paths.get_annotated_filepath(image['normal']) + lineart_path = folder_paths.get_annotated_filepath(image['lineart']) 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) + normal_image, ignore_mask2 = load_image_node.load_image(image=normal_path) + lineart_image, ignore_mask3 = load_image_node.load_image(image=lineart_path) - return output_image, output_mask, model_file, + return output_image, output_mask, model_file, normal_image, lineart_image class Load3DAnimation(): @classmethod @@ -55,8 +59,8 @@ class Load3DAnimation(): "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), }} - RETURN_TYPES = ("IMAGE", "MASK", "STRING") - RETURN_NAMES = ("image", "mask", "mesh_path") + RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE") + RETURN_NAMES = ("image", "mask", "mesh_path", "normal") FUNCTION = "process" EXPERIMENTAL = True @@ -66,12 +70,14 @@ class Load3DAnimation(): def process(self, model_file, image, **kwargs): image_path = folder_paths.get_annotated_filepath(image['image']) mask_path = folder_paths.get_annotated_filepath(image['mask']) + normal_path = folder_paths.get_annotated_filepath(image['normal']) 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) + normal_image, ignore_mask2 = load_image_node.load_image(image=normal_path) - return output_image, output_mask, model_file, + return output_image, output_mask, model_file, normal_image class Preview3D(): @classmethod From ce9b084279110f78ca2faf53fb0ef05ac4aaba48 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 21 Mar 2025 19:08:25 -0400 Subject: [PATCH 254/478] [nit] Format error strings (#7345) --- app/frontend_management.py | 53 +++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/app/frontend_management.py b/app/frontend_management.py index b4ba994d1..c56ea86e0 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -22,13 +22,21 @@ import app.logger # The path to the requirements.txt file req_path = Path(__file__).parents[1] / "requirements.txt" + def frontend_install_warning_message(): """The warning message to display when the frontend version is not up to date.""" extra = "" if sys.flags.no_user_site: extra = "-s " - return f"Please install the updated requirements.txt file by running:\n{sys.executable} {extra}-m pip install -r {req_path}\n\nThis error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead.\n\nIf you are on the portable package you can run: update\\update_comfyui.bat to solve this problem" + return f""" +Please install the updated requirements.txt file by running: +{sys.executable} {extra}-m pip install -r {req_path} + +This error is happening because the ComfyUI frontend is no longer shipped as part of the main repo but as a pip package instead. + +If you are on the portable package you can run: update\\update_comfyui.bat to solve this problem +""".strip() def check_frontend_version(): @@ -43,7 +51,17 @@ def check_frontend_version(): with open(req_path, "r", encoding="utf-8") as f: required_frontend = parse_version(f.readline().split("=")[-1]) if frontend_version < required_frontend: - app.logger.log_startup_warning("________________________________________________________________________\nWARNING WARNING WARNING WARNING WARNING\n\nInstalled frontend version {} is lower than the recommended version {}.\n\n{}\n________________________________________________________________________".format('.'.join(map(str, frontend_version)), '.'.join(map(str, required_frontend)), frontend_install_warning_message())) + app.logger.log_startup_warning( + f""" +________________________________________________________________________ +WARNING WARNING WARNING WARNING WARNING + +Installed frontend version {".".join(map(str, frontend_version))} is lower than the recommended version {".".join(map(str, required_frontend))}. + +{frontend_install_warning_message()} +________________________________________________________________________ +""".strip() + ) else: logging.info("ComfyUI frontend version: {}".format(frontend_version_str)) except Exception as e: @@ -150,9 +168,20 @@ class FrontendManager: def default_frontend_path(cls) -> str: try: import comfyui_frontend_package + return str(importlib.resources.files(comfyui_frontend_package) / "static") except ImportError: - logging.error(f"\n\n********** ERROR ***********\n\ncomfyui-frontend-package is not installed. {frontend_install_warning_message()}\n********** ERROR **********\n") + logging.error( + f""" +********** ERROR *********** + +comfyui-frontend-package is not installed. + +{frontend_install_warning_message()} + +********** ERROR *********** +""".strip() + ) sys.exit(-1) @classmethod @@ -175,7 +204,9 @@ class FrontendManager: return match_result.group(1), match_result.group(2), match_result.group(3) @classmethod - def init_frontend_unsafe(cls, version_string: str, provider: Optional[FrontEndProvider] = None) -> str: + def init_frontend_unsafe( + cls, version_string: str, provider: Optional[FrontEndProvider] = None + ) -> str: """ Initializes the frontend for the specified version. @@ -197,12 +228,20 @@ class FrontendManager: repo_owner, repo_name, version = cls.parse_version_string(version_string) if version.startswith("v"): - expected_path = str(Path(cls.CUSTOM_FRONTENDS_ROOT) / f"{repo_owner}_{repo_name}" / version.lstrip("v")) + expected_path = str( + Path(cls.CUSTOM_FRONTENDS_ROOT) + / f"{repo_owner}_{repo_name}" + / version.lstrip("v") + ) if os.path.exists(expected_path): - logging.info(f"Using existing copy of specific frontend version tag: {repo_owner}/{repo_name}@{version}") + logging.info( + f"Using existing copy of specific frontend version tag: {repo_owner}/{repo_name}@{version}" + ) return expected_path - logging.info(f"Initializing frontend: {repo_owner}/{repo_name}@{version}, requesting version details from GitHub...") + logging.info( + f"Initializing frontend: {repo_owner}/{repo_name}@{version}, requesting version details from GitHub..." + ) provider = provider or FrontEndProvider(repo_owner, repo_name) release = provider.get_release(version) From 75c1c757d90ca891eff823893248ef8b51d31d01 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 21 Mar 2025 20:09:54 -0400 Subject: [PATCH 255/478] ComfyUI version v0.3.27 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index b5e6fbead..705622529 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.26" +__version__ = "0.3.27" diff --git a/pyproject.toml b/pyproject.toml index f13fed8dc..db9e776cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.26" +version = "0.3.27" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From e471c726e57b3854e0dd47efe0e7c53a28703dbb Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 22 Mar 2025 15:45:56 -0400 Subject: [PATCH 256/478] Fallback to pytorch attention if sage attention fails. --- comfy/ldm/modules/attention.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.py index 7908d1313..ede506463 100644 --- a/comfy/ldm/modules/attention.py +++ b/comfy/ldm/modules/attention.py @@ -471,7 +471,7 @@ def attention_pytorch(q, k, v, heads, mask=None, attn_precision=None, skip_resha def attention_sage(q, k, v, heads, mask=None, attn_precision=None, skip_reshape=False, skip_output_reshape=False): if skip_reshape: b, _, _, dim_head = q.shape - tensor_layout="HND" + tensor_layout = "HND" else: b, _, dim_head = q.shape dim_head //= heads @@ -479,7 +479,7 @@ def attention_sage(q, k, v, heads, mask=None, attn_precision=None, skip_reshape= lambda t: t.view(b, -1, heads, dim_head), (q, k, v), ) - tensor_layout="NHD" + tensor_layout = "NHD" if mask is not None: # add a batch dimension if there isn't already one @@ -489,7 +489,17 @@ def attention_sage(q, k, v, heads, mask=None, attn_precision=None, skip_reshape= if mask.ndim == 3: mask = mask.unsqueeze(1) - out = sageattn(q, k, v, attn_mask=mask, is_causal=False, tensor_layout=tensor_layout) + try: + out = sageattn(q, k, v, attn_mask=mask, is_causal=False, tensor_layout=tensor_layout) + except Exception as e: + logging.error("Error running sage attention: {}, using pytorch attention instead.".format(e)) + if tensor_layout == "NHD": + q, k, v = map( + lambda t: t.transpose(1, 2), + (q, k, v), + ) + return attention_pytorch(q, k, v, heads, mask=mask, skip_reshape=True, skip_output_reshape=skip_output_reshape) + if tensor_layout == "HND": if not skip_output_reshape: out = ( From 581a9991ff641ef330a2977d5b92e682c9c3df95 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 23 Mar 2025 08:06:36 -0400 Subject: [PATCH 257/478] Add model merging node for WAN 2.1 --- .../nodes_model_merging_model_specific.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/comfy_extras/nodes_model_merging_model_specific.py b/comfy_extras/nodes_model_merging_model_specific.py index 3e37f70d4..dc3411947 100644 --- a/comfy_extras/nodes_model_merging_model_specific.py +++ b/comfy_extras/nodes_model_merging_model_specific.py @@ -244,6 +244,30 @@ class ModelMergeCosmos14B(comfy_extras.nodes_model_merging.ModelMergeBlocks): return {"required": arg_dict} +class ModelMergeWAN2_1(comfy_extras.nodes_model_merging.ModelMergeBlocks): + CATEGORY = "advanced/model_merging/model_specific" + DESCRIPTION = "1.3B model has 30 blocks, 14B model has 40 blocks. Image to video model has the extra img_emb." + + @classmethod + def INPUT_TYPES(s): + arg_dict = { "model1": ("MODEL",), + "model2": ("MODEL",)} + + argument = ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}) + + arg_dict["patch_embedding."] = argument + arg_dict["time_embedding."] = argument + arg_dict["time_projection."] = argument + arg_dict["text_embedding."] = argument + arg_dict["img_emb."] = argument + + for i in range(40): + arg_dict["blocks.{}.".format(i)] = argument + + arg_dict["head."] = argument + + return {"required": arg_dict} + NODE_CLASS_MAPPINGS = { "ModelMergeSD1": ModelMergeSD1, "ModelMergeSD2": ModelMergeSD1, #SD1 and SD2 have the same blocks @@ -256,4 +280,5 @@ NODE_CLASS_MAPPINGS = { "ModelMergeLTXV": ModelMergeLTXV, "ModelMergeCosmos7B": ModelMergeCosmos7B, "ModelMergeCosmos14B": ModelMergeCosmos14B, + "ModelMergeWAN2_1": ModelMergeWAN2_1, } From eade1551bbd8678a7883d7061de73264cc279abf Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 24 Mar 2025 07:14:32 -0400 Subject: [PATCH 258/478] Add Hunyuan3D to readme. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a807ea9d6..a99aca0e7 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ See what ComfyUI can do with the [example workflows](https://comfyanonymous.gith - [Hunyuan Video](https://comfyanonymous.github.io/ComfyUI_examples/hunyuan_video/) - [Nvidia Cosmos](https://comfyanonymous.github.io/ComfyUI_examples/cosmos/) - [Wan 2.1](https://comfyanonymous.github.io/ComfyUI_examples/wan/) +- 3D Models + - [Hunyuan3D 2.0](https://docs.comfy.org/tutorials/3d/hunyuan3D-2) - [Stable Audio](https://comfyanonymous.github.io/ComfyUI_examples/audio/) - Asynchronous Queue system - Many optimizations: Only re-executes the parts of the workflow that changes between executions. From 8edc1f44c1312d58afb6b0d817181079d39681e7 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 25 Mar 2025 05:23:49 -0400 Subject: [PATCH 259/478] Support more float8 types. --- comfy/model_management.py | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 2a9b022be..f1ecfc20e 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -46,6 +46,32 @@ cpu_state = CPUState.GPU total_vram = 0 +def get_supported_float8_types(): + float8_types = [] + try: + float8_types.append(torch.float8_e4m3fn) + except: + pass + try: + float8_types.append(torch.float8_e4m3fnuz) + except: + pass + try: + float8_types.append(torch.float8_e5m2) + except: + pass + try: + float8_types.append(torch.float8_e5m2fnuz) + except: + pass + try: + float8_types.append(torch.float8_e8m0fnu) + except: + pass + return float8_types + +FLOAT8_TYPES = get_supported_float8_types() + xpu_available = False torch_version = "" try: @@ -701,11 +727,8 @@ def unet_dtype(device=None, model_params=0, supported_dtypes=[torch.float16, tor return torch.float8_e5m2 fp8_dtype = None - try: - if weight_dtype in [torch.float8_e4m3fn, torch.float8_e5m2]: - fp8_dtype = weight_dtype - except: - pass + if weight_dtype in FLOAT8_TYPES: + fp8_dtype = weight_dtype if fp8_dtype is not None: if supports_fp8_compute(device): #if fp8 compute is supported the casting is most likely not expensive From 84fdaf7b0ef4d030723bc3b350282dc6c92743f6 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Mar 2025 05:08:49 -0400 Subject: [PATCH 260/478] Add CFGZeroStar node. Works on all models that use a negative prompt but is meant for rectified flow models. --- comfy_extras/nodes_cfg.py | 45 +++++++++++++++++++++++++++++++++++++++ nodes.py | 1 + 2 files changed, 46 insertions(+) create mode 100644 comfy_extras/nodes_cfg.py diff --git a/comfy_extras/nodes_cfg.py b/comfy_extras/nodes_cfg.py new file mode 100644 index 000000000..1fb686644 --- /dev/null +++ b/comfy_extras/nodes_cfg.py @@ -0,0 +1,45 @@ +import torch + +# https://github.com/WeichenFan/CFG-Zero-star +def optimized_scale(positive, negative): + positive_flat = positive.reshape(positive.shape[0], -1) + negative_flat = negative.reshape(negative.shape[0], -1) + + # Calculate dot production + dot_product = torch.sum(positive_flat * negative_flat, dim=1, keepdim=True) + + # Squared norm of uncondition + squared_norm = torch.sum(negative_flat ** 2, dim=1, keepdim=True) + 1e-8 + + # st_star = v_cond^T * v_uncond / ||v_uncond||^2 + st_star = dot_product / squared_norm + + return st_star.reshape([positive.shape[0]] + [1] * (positive.ndim - 1)) + +class CFGZeroStar: + @classmethod + def INPUT_TYPES(s): + return {"required": {"model": ("MODEL",), + }} + RETURN_TYPES = ("MODEL",) + RETURN_NAMES = ("patched_model",) + FUNCTION = "patch" + CATEGORY = "advanced/guidance" + + def patch(self, model): + m = model.clone() + def cfg_zero_star(args): + guidance_scale = args['cond_scale'] + x = args['input'] + cond_p = args['cond_denoised'] + uncond_p = args['uncond_denoised'] + out = args["denoised"] + alpha = optimized_scale(x - cond_p, x - uncond_p) + + return out + uncond_p * (alpha - 1.0) + guidance_scale * uncond_p * (1.0 - alpha) + m.set_model_sampler_post_cfg_function(cfg_zero_star) + return (m, ) + +NODE_CLASS_MAPPINGS = { + "CFGZeroStar": CFGZeroStar +} diff --git a/nodes.py b/nodes.py index 27ef743b3..272c2a25e 100644 --- a/nodes.py +++ b/nodes.py @@ -2267,6 +2267,7 @@ def init_builtin_extra_nodes(): "nodes_lotus.py", "nodes_hunyuan3d.py", "nodes_primitive.py", + "nodes_cfg.py", ] import_failed = [] From 3661c833bcc41b788a7c9f0e7bc48524f8ee5f82 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 26 Mar 2025 19:54:54 -0400 Subject: [PATCH 261/478] Support the WAN 2.1 fun control models. Use the new WanFunControlToVideo node. --- comfy/model_base.py | 17 ++++++++----- comfy/supported_models.py | 14 ++++++++++- comfy_extras/nodes_wan.py | 51 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 7 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index eec70d5de..315b5d1e3 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -992,7 +992,8 @@ class WAN21(BaseModel): def concat_cond(self, **kwargs): noise = kwargs.get("noise", None) - if self.diffusion_model.patch_embedding.weight.shape[1] == noise.shape[1]: + extra_channels = self.diffusion_model.patch_embedding.weight.shape[1] - noise.shape[1] + if extra_channels == 0: return None image = kwargs.get("concat_latent_image", None) @@ -1000,12 +1001,16 @@ class WAN21(BaseModel): if image is None: image = torch.zeros_like(noise) + shape_image = list(noise.shape) + shape_image[1] = extra_channels + image = torch.zeros(shape_image, dtype=noise.dtype, layout=noise.layout, device=noise.device) + else: + image = utils.common_upscale(image.to(device), noise.shape[-1], noise.shape[-2], "bilinear", "center") + for i in range(0, image.shape[1], 16): + image[:, i: i + 16] = self.process_latent_in(image[:, i: i + 16]) + image = utils.resize_to_batch_size(image, noise.shape[0]) - image = utils.common_upscale(image.to(device), noise.shape[-1], noise.shape[-2], "bilinear", "center") - image = self.process_latent_in(image) - image = utils.resize_to_batch_size(image, noise.shape[0]) - - if not self.image_to_video: + if not self.image_to_video or extra_channels == image.shape[1]: return image mask = kwargs.get("concat_mask", kwargs.get("denoise_mask", None)) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index fad00d35b..2a6a61560 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -969,12 +969,24 @@ class WAN21_I2V(WAN21_T2V): unet_config = { "image_model": "wan2.1", "model_type": "i2v", + "in_dim": 36, } def get_model(self, state_dict, prefix="", device=None): out = model_base.WAN21(self, image_to_video=True, device=device) return out +class WAN21_FunControl2V(WAN21_T2V): + unet_config = { + "image_model": "wan2.1", + "model_type": "i2v", + "in_dim": 48, + } + + def get_model(self, state_dict, prefix="", device=None): + out = model_base.WAN21(self, image_to_video=False, device=device) + return out + class Hunyuan3Dv2(supported_models_base.BASE): unet_config = { "image_model": "hunyuan3d2", @@ -1013,6 +1025,6 @@ class Hunyuan3Dv2mini(Hunyuan3Dv2): latent_format = latent_formats.Hunyuan3Dv2mini -models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, Hunyuan3Dv2mini, Hunyuan3Dv2] +models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, WAN21_FunControl2V, Hunyuan3Dv2mini, Hunyuan3Dv2] models += [SVD_img2vid] diff --git a/comfy_extras/nodes_wan.py b/comfy_extras/nodes_wan.py index dc30eb546..428874bcc 100644 --- a/comfy_extras/nodes_wan.py +++ b/comfy_extras/nodes_wan.py @@ -3,6 +3,7 @@ import node_helpers import torch import comfy.model_management import comfy.utils +import comfy.latent_formats class WanImageToVideo: @@ -49,6 +50,56 @@ class WanImageToVideo: return (positive, negative, out_latent) +class WanFunControlToVideo: + @classmethod + def INPUT_TYPES(s): + return {"required": {"positive": ("CONDITIONING", ), + "negative": ("CONDITIONING", ), + "vae": ("VAE", ), + "width": ("INT", {"default": 832, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "height": ("INT", {"default": 480, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "length": ("INT", {"default": 81, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}), + "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), + }, + "optional": {"clip_vision_output": ("CLIP_VISION_OUTPUT", ), + "start_image": ("IMAGE", ), + "control_video": ("IMAGE", ), + }} + + RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT") + RETURN_NAMES = ("positive", "negative", "latent") + FUNCTION = "encode" + + CATEGORY = "conditioning/video_models" + + def encode(self, positive, negative, vae, width, height, length, batch_size, start_image=None, clip_vision_output=None, control_video=None): + latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) + concat_latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) + concat_latent = comfy.latent_formats.Wan21().process_out(concat_latent) + concat_latent = concat_latent.repeat(1, 2, 1, 1, 1) + + if start_image is not None: + start_image = comfy.utils.common_upscale(start_image[:length].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + concat_latent_image = vae.encode(start_image[:, :, :, :3]) + concat_latent[:,16:,:concat_latent_image.shape[2]] = concat_latent_image[:,:,:concat_latent.shape[2]] + + if control_video is not None: + control_video = comfy.utils.common_upscale(control_video[:length].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + concat_latent_image = vae.encode(control_video[:, :, :, :3]) + concat_latent[:,:16,:concat_latent_image.shape[2]] = concat_latent_image[:,:,:concat_latent.shape[2]] + + positive = node_helpers.conditioning_set_values(positive, {"concat_latent_image": concat_latent}) + negative = node_helpers.conditioning_set_values(negative, {"concat_latent_image": concat_latent}) + + if clip_vision_output is not None: + positive = node_helpers.conditioning_set_values(positive, {"clip_vision_output": clip_vision_output}) + negative = node_helpers.conditioning_set_values(negative, {"clip_vision_output": clip_vision_output}) + + out_latent = {} + out_latent["samples"] = latent + return (positive, negative, out_latent) + NODE_CLASS_MAPPINGS = { "WanImageToVideo": WanImageToVideo, + "WanFunControlToVideo": WanFunControlToVideo, } From 0a1f8869c9998bbfcfeb2e97aa96a6d3e0a2b5df Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 27 Mar 2025 11:13:27 -0400 Subject: [PATCH 262/478] Add WanFunInpaintToVideo node for the Wan fun inpaint models. --- comfy/model_base.py | 7 +++-- comfy_extras/nodes_wan.py | 54 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index 315b5d1e3..8f588e2bf 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -1017,11 +1017,14 @@ class WAN21(BaseModel): if mask is None: mask = torch.zeros_like(noise)[:, :4] else: - mask = 1.0 - torch.mean(mask, dim=1, keepdim=True) + if mask.shape[1] != 4: + mask = torch.mean(mask, dim=1, keepdim=True) + mask = 1.0 - mask mask = utils.common_upscale(mask.to(device), noise.shape[-1], noise.shape[-2], "bilinear", "center") if mask.shape[-3] < noise.shape[-3]: mask = torch.nn.functional.pad(mask, (0, 0, 0, 0, 0, noise.shape[-3] - mask.shape[-3]), mode='constant', value=0) - mask = mask.repeat(1, 4, 1, 1, 1) + if mask.shape[1] == 1: + mask = mask.repeat(1, 4, 1, 1, 1) mask = utils.resize_to_batch_size(mask, noise.shape[0]) return torch.cat((mask, image), dim=1) diff --git a/comfy_extras/nodes_wan.py b/comfy_extras/nodes_wan.py index 428874bcc..2d0f31ac8 100644 --- a/comfy_extras/nodes_wan.py +++ b/comfy_extras/nodes_wan.py @@ -99,7 +99,61 @@ class WanFunControlToVideo: out_latent["samples"] = latent return (positive, negative, out_latent) +class WanFunInpaintToVideo: + @classmethod + def INPUT_TYPES(s): + return {"required": {"positive": ("CONDITIONING", ), + "negative": ("CONDITIONING", ), + "vae": ("VAE", ), + "width": ("INT", {"default": 832, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "height": ("INT", {"default": 480, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "length": ("INT", {"default": 81, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}), + "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), + }, + "optional": {"clip_vision_output": ("CLIP_VISION_OUTPUT", ), + "start_image": ("IMAGE", ), + "end_image": ("IMAGE", ), + }} + + RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT") + RETURN_NAMES = ("positive", "negative", "latent") + FUNCTION = "encode" + + CATEGORY = "conditioning/video_models" + + def encode(self, positive, negative, vae, width, height, length, batch_size, start_image=None, end_image=None, clip_vision_output=None): + latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) + if start_image is not None: + start_image = comfy.utils.common_upscale(start_image[:length].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + if end_image is not None: + end_image = comfy.utils.common_upscale(end_image[-length:].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + + image = torch.ones((length, height, width, 3)) * 0.5 + mask = torch.ones((1, 1, latent.shape[2] * 4, latent.shape[-2], latent.shape[-1])) + + if start_image is not None: + image[:start_image.shape[0]] = start_image + mask[:, :, :start_image.shape[0] + 3] = 0.0 + + if end_image is not None: + image[-end_image.shape[0]:] = end_image + mask[:, :, -end_image.shape[0]:] = 0.0 + + concat_latent_image = vae.encode(image[:, :, :, :3]) + mask = mask.view(1, mask.shape[2] // 4, 4, mask.shape[3], mask.shape[4]).transpose(1, 2) + positive = node_helpers.conditioning_set_values(positive, {"concat_latent_image": concat_latent_image, "concat_mask": mask}) + negative = node_helpers.conditioning_set_values(negative, {"concat_latent_image": concat_latent_image, "concat_mask": mask}) + + if clip_vision_output is not None: + positive = node_helpers.conditioning_set_values(positive, {"clip_vision_output": clip_vision_output}) + negative = node_helpers.conditioning_set_values(negative, {"clip_vision_output": clip_vision_output}) + + out_latent = {} + out_latent["samples"] = latent + return (positive, negative, out_latent) + NODE_CLASS_MAPPINGS = { "WanImageToVideo": WanImageToVideo, "WanFunControlToVideo": WanFunControlToVideo, + "WanFunInpaintToVideo": WanFunInpaintToVideo, } From a40fcfc2d5392a5014cd87588035ebce194cb015 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 28 Mar 2025 02:27:01 -0400 Subject: [PATCH 263/478] Update frontend to 1.14.6 (#7416) Cherry-pick the fix: https://github.com/Comfy-Org/ComfyUI_frontend/pull/3252 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c78d3c228..806fbc751 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.14.5 +comfyui-frontend-package==1.14.6 torch torchsde torchvision From 2d17d8910c7d34383feaf1aaac8d08571fe42077 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 28 Mar 2025 08:40:25 -0400 Subject: [PATCH 264/478] Don't error if wan concat image has extra channels. --- comfy/model_base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/comfy/model_base.py b/comfy/model_base.py index 8f588e2bf..f55cbe183 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -1013,6 +1013,9 @@ class WAN21(BaseModel): if not self.image_to_video or extra_channels == image.shape[1]: return image + if image.shape[1] > (extra_channels - 4): + image = image[:, :(extra_channels - 4)] + mask = kwargs.get("concat_mask", kwargs.get("denoise_mask", None)) if mask is None: mask = torch.zeros_like(noise)[:, :4] From 832fc02330c1843b9817b8ee90b061d2298a5911 Mon Sep 17 00:00:00 2001 From: Michael Kupchick Date: Sun, 30 Mar 2025 03:03:02 +0300 Subject: [PATCH 265/478] ltxv: fix preprocessing exception when compression is 0. (#7431) --- comfy_extras/nodes_lt.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index fdc6c7c13..525889200 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -446,10 +446,9 @@ class LTXVPreprocess: CATEGORY = "image" def preprocess(self, image, img_compression): - if img_compression > 0: - output_images = [] - for i in range(image.shape[0]): - output_images.append(preprocess(image[i], img_compression)) + output_images = [] + for i in range(image.shape[0]): + output_images.append(preprocess(image[i], img_compression)) return (torch.stack(output_images),) From a3100c8452862e914996648e0fbc56098ab26b60 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 29 Mar 2025 20:11:43 -0400 Subject: [PATCH 266/478] Remove useless code. --- comfy/model_base.py | 1 - 1 file changed, 1 deletion(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index f55cbe183..6bc627ae3 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -1000,7 +1000,6 @@ class WAN21(BaseModel): device = kwargs["device"] if image is None: - image = torch.zeros_like(noise) shape_image = list(noise.shape) shape_image[1] = extra_channels image = torch.zeros(shape_image, dtype=noise.dtype, layout=noise.layout, device=noise.device) From 0b4584c7413f1c3f6a34875a790c0381b3510447 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 30 Mar 2025 21:47:05 -0400 Subject: [PATCH 267/478] Fix latent composite node not working when source has alpha. --- comfy_extras/nodes_mask.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/comfy_extras/nodes_mask.py b/comfy_extras/nodes_mask.py index 63fd13b9a..2dd826b2e 100644 --- a/comfy_extras/nodes_mask.py +++ b/comfy_extras/nodes_mask.py @@ -87,6 +87,8 @@ class ImageCompositeMasked: CATEGORY = "image" def composite(self, destination, source, x, y, resize_source, mask = None): + if destination.shape[-1] < source.shape[-1]: + source = source[...,:destination.shape[-1]] destination = destination.clone().movedim(-1, 1) output = composite(destination, source.movedim(-1, 1), x, y, mask, 1, resize_source).movedim(1, -1) return (output,) From 548457bac47bb6c0ce233a9f5abb3467582d710d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 31 Mar 2025 20:59:12 -0400 Subject: [PATCH 268/478] Fix alpha channel mismatch on destination in ImageCompositeMasked --- comfy_extras/nodes_mask.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/comfy_extras/nodes_mask.py b/comfy_extras/nodes_mask.py index 2dd826b2e..e1f0c8225 100644 --- a/comfy_extras/nodes_mask.py +++ b/comfy_extras/nodes_mask.py @@ -89,6 +89,9 @@ class ImageCompositeMasked: def composite(self, destination, source, x, y, resize_source, mask = None): if destination.shape[-1] < source.shape[-1]: source = source[...,:destination.shape[-1]] + elif destination.shape[-1] > source.shape[-1]: + destination = torch.nn.functional.pad(destination, (0, 1)) + destination[..., -1] = source[..., -1] destination = destination.clone().movedim(-1, 1) output = composite(destination, source.movedim(-1, 1), x, y, mask, 1, resize_source).movedim(1, -1) return (output,) From 301e26b131e99577aa64a366ca93c2bf85f34b96 Mon Sep 17 00:00:00 2001 From: BVH <82035780+bvhari@users.noreply.github.com> Date: Tue, 1 Apr 2025 23:18:53 +0530 Subject: [PATCH 269/478] Add option to store TE in bf16 (#7461) --- comfy/cli_args.py | 1 + comfy/model_management.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 91c1fe705..62079e6a7 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -79,6 +79,7 @@ fpte_group.add_argument("--fp8_e4m3fn-text-enc", action="store_true", help="Stor fpte_group.add_argument("--fp8_e5m2-text-enc", action="store_true", help="Store text encoder weights in fp8 (e5m2 variant).") fpte_group.add_argument("--fp16-text-enc", action="store_true", help="Store text encoder weights in fp16.") fpte_group.add_argument("--fp32-text-enc", action="store_true", help="Store text encoder weights in fp32.") +fpte_group.add_argument("--bf16-text-enc", action="store_true", help="Store text encoder weights in bf16.") parser.add_argument("--force-channels-last", action="store_true", help="Force channels last format when inferencing the models.") diff --git a/comfy/model_management.py b/comfy/model_management.py index f1ecfc20e..84a260fc4 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -823,6 +823,8 @@ def text_encoder_dtype(device=None): return torch.float8_e5m2 elif args.fp16_text_enc: return torch.float16 + elif args.bf16_text_enc: + return torch.bfloat16 elif args.fp32_text_enc: return torch.float32 From 2b71aab29903c3d26d71f9ca2a034442a419ab0a Mon Sep 17 00:00:00 2001 From: Laurent Erignoux Date: Wed, 2 Apr 2025 01:53:52 +0800 Subject: [PATCH 270/478] User missing (#7439) * Ensuring a 401 error is returned when user data is not found in multi-user context. * Returning a 401 error when provided comfy-user does not exists on server side. --- app/app_settings.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/app_settings.py b/app/app_settings.py index a545df92e..c7ac73bf6 100644 --- a/app/app_settings.py +++ b/app/app_settings.py @@ -9,8 +9,14 @@ class AppSettings(): self.user_manager = user_manager def get_settings(self, request): - file = self.user_manager.get_request_user_filepath( - request, "comfy.settings.json") + try: + file = self.user_manager.get_request_user_filepath( + request, + "comfy.settings.json" + ) + except KeyError as e: + logging.error("User settings not found.") + raise web.HTTPUnauthorized() from e if os.path.isfile(file): try: with open(file) as f: From ab5413351eee61f3d7f10c74e75286df0058bb18 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 1 Apr 2025 14:09:31 -0400 Subject: [PATCH 271/478] Fix comment. This function does not support quads. --- comfy_extras/nodes_hunyuan3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy_extras/nodes_hunyuan3d.py b/comfy_extras/nodes_hunyuan3d.py index 1ca7c2fe6..5adc6b654 100644 --- a/comfy_extras/nodes_hunyuan3d.py +++ b/comfy_extras/nodes_hunyuan3d.py @@ -244,7 +244,7 @@ def save_glb(vertices, faces, filepath, metadata=None): Parameters: vertices: torch.Tensor of shape (N, 3) - The vertex coordinates - faces: torch.Tensor of shape (M, 4) or (M, 3) - The face indices (quad or triangle faces) + faces: torch.Tensor of shape (M, 3) - The face indices (triangle faces) filepath: str - Output filepath (should end with .glb) """ From 2222cf67fdb2a3b805c622f7e309a6db2bb04d19 Mon Sep 17 00:00:00 2001 From: BiologicalExplosion <49753622+BiologicalExplosion@users.noreply.github.com> Date: Thu, 3 Apr 2025 07:24:04 +0800 Subject: [PATCH 272/478] MLU memory optimization (#7470) Co-authored-by: huzhan --- comfy/model_management.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/comfy/model_management.py b/comfy/model_management.py index 84a260fc4..19e6c8dff 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -1237,6 +1237,8 @@ def soft_empty_cache(force=False): torch.xpu.empty_cache() elif is_ascend_npu(): torch.npu.empty_cache() + elif is_mlu(): + torch.mlu.empty_cache() elif torch.cuda.is_available(): torch.cuda.empty_cache() torch.cuda.ipc_collect() From 3d2e3a6f29670809aa97b41505fa4e93ce11b98d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 2 Apr 2025 19:32:34 -0400 Subject: [PATCH 273/478] Fix alpha image issue in more nodes. --- comfy_extras/nodes_mask.py | 7 ++----- comfy_extras/nodes_post_processing.py | 3 ++- node_helpers.py | 8 ++++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/comfy_extras/nodes_mask.py b/comfy_extras/nodes_mask.py index e1f0c8225..13d2b4bab 100644 --- a/comfy_extras/nodes_mask.py +++ b/comfy_extras/nodes_mask.py @@ -2,6 +2,7 @@ import numpy as np import scipy.ndimage import torch import comfy.utils +import node_helpers from nodes import MAX_RESOLUTION @@ -87,11 +88,7 @@ class ImageCompositeMasked: CATEGORY = "image" def composite(self, destination, source, x, y, resize_source, mask = None): - if destination.shape[-1] < source.shape[-1]: - source = source[...,:destination.shape[-1]] - elif destination.shape[-1] > source.shape[-1]: - destination = torch.nn.functional.pad(destination, (0, 1)) - destination[..., -1] = source[..., -1] + destination, source = node_helpers.image_alpha_fix(destination, source) destination = destination.clone().movedim(-1, 1) output = composite(destination, source.movedim(-1, 1), x, y, mask, 1, resize_source).movedim(1, -1) return (output,) diff --git a/comfy_extras/nodes_post_processing.py b/comfy_extras/nodes_post_processing.py index 68f6ef51e..5b9542015 100644 --- a/comfy_extras/nodes_post_processing.py +++ b/comfy_extras/nodes_post_processing.py @@ -6,7 +6,7 @@ import math import comfy.utils import comfy.model_management - +import node_helpers class Blend: def __init__(self): @@ -34,6 +34,7 @@ class Blend: CATEGORY = "image/postprocessing" def blend_images(self, image1: torch.Tensor, image2: torch.Tensor, blend_factor: float, blend_mode: str): + image1, image2 = node_helpers.image_alpha_fix(image1, image2) image2 = image2.to(image1.device) if image1.shape != image2.shape: image2 = image2.permute(0, 3, 1, 2) diff --git a/node_helpers.py b/node_helpers.py index 48da3b099..4f805387f 100644 --- a/node_helpers.py +++ b/node_helpers.py @@ -44,3 +44,11 @@ def string_to_torch_dtype(string): return torch.float16 if string == "bf16": return torch.bfloat16 + +def image_alpha_fix(destination, source): + if destination.shape[-1] < source.shape[-1]: + source = source[...,:destination.shape[-1]] + elif destination.shape[-1] > source.shape[-1]: + destination = torch.nn.functional.pad(destination, (0, 1)) + destination[..., -1] = source[..., -1] + return destination, source From 721253cb0527e0476f12bd20835b4fff5961508e Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 3 Apr 2025 20:57:59 -0400 Subject: [PATCH 274/478] Fix problem. --- node_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node_helpers.py b/node_helpers.py index 4f805387f..c3e1a14ca 100644 --- a/node_helpers.py +++ b/node_helpers.py @@ -50,5 +50,5 @@ def image_alpha_fix(destination, source): source = source[...,:destination.shape[-1]] elif destination.shape[-1] > source.shape[-1]: destination = torch.nn.functional.pad(destination, (0, 1)) - destination[..., -1] = source[..., -1] + destination[..., -1] = 1.0 return destination, source From 3a100b9a550b9700d08eecb006b5accd65863925 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 4 Apr 2025 21:24:56 -0400 Subject: [PATCH 275/478] Disable partial offloading of audio VAE. --- comfy/sd.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/comfy/sd.py b/comfy/sd.py index d096f496c..4d3aef3e1 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -265,6 +265,7 @@ class VAE: self.process_input = lambda image: image * 2.0 - 1.0 self.process_output = lambda image: torch.clamp((image + 1.0) / 2.0, min=0.0, max=1.0) self.working_dtypes = [torch.bfloat16, torch.float32] + self.disable_offload = False self.downscale_index_formula = None self.upscale_index_formula = None @@ -337,6 +338,7 @@ class VAE: self.process_output = lambda audio: audio self.process_input = lambda audio: audio self.working_dtypes = [torch.float16, torch.bfloat16, torch.float32] + self.disable_offload = True elif "blocks.2.blocks.3.stack.5.weight" in sd or "decoder.blocks.2.blocks.3.stack.5.weight" in sd or "layers.4.layers.1.attn_block.attn.qkv.weight" in sd or "encoder.layers.4.layers.1.attn_block.attn.qkv.weight" in sd: #genmo mochi vae if "blocks.2.blocks.3.stack.5.weight" in sd: sd = comfy.utils.state_dict_prefix_replace(sd, {"": "decoder."}) @@ -515,7 +517,7 @@ class VAE: pixel_samples = None try: memory_used = self.memory_used_decode(samples_in.shape, self.vae_dtype) - model_management.load_models_gpu([self.patcher], memory_required=memory_used) + model_management.load_models_gpu([self.patcher], memory_required=memory_used, force_full_load=self.disable_offload) free_memory = model_management.get_free_memory(self.device) batch_number = int(free_memory / memory_used) batch_number = max(1, batch_number) @@ -544,7 +546,7 @@ class VAE: def decode_tiled(self, samples, tile_x=None, tile_y=None, overlap=None, tile_t=None, overlap_t=None): self.throw_exception_if_invalid() memory_used = self.memory_used_decode(samples.shape, self.vae_dtype) #TODO: calculate mem required for tile - model_management.load_models_gpu([self.patcher], memory_required=memory_used) + model_management.load_models_gpu([self.patcher], memory_required=memory_used, force_full_load=self.disable_offload) dims = samples.ndim - 2 args = {} if tile_x is not None: @@ -578,7 +580,7 @@ class VAE: pixel_samples = pixel_samples.movedim(1, 0).unsqueeze(0) try: memory_used = self.memory_used_encode(pixel_samples.shape, self.vae_dtype) - model_management.load_models_gpu([self.patcher], memory_required=memory_used) + model_management.load_models_gpu([self.patcher], memory_required=memory_used, force_full_load=self.disable_offload) free_memory = model_management.get_free_memory(self.device) batch_number = int(free_memory / max(1, memory_used)) batch_number = max(1, batch_number) @@ -612,7 +614,7 @@ class VAE: pixel_samples = pixel_samples.movedim(1, 0).unsqueeze(0) memory_used = self.memory_used_encode(pixel_samples.shape, self.vae_dtype) # TODO: calculate mem required for tile - model_management.load_models_gpu([self.patcher], memory_required=memory_used) + model_management.load_models_gpu([self.patcher], memory_required=memory_used, force_full_load=self.disable_offload) args = {} if tile_x is not None: From 89e4ea01754fc043913ac164f5b7880ec58ebab9 Mon Sep 17 00:00:00 2001 From: Raphael Walker Date: Sat, 5 Apr 2025 03:27:54 +0200 Subject: [PATCH 276/478] Add activations_shape info in UNet models (#7482) * Add activations_shape info in UNet models * activations_shape should be a list --- comfy/ldm/modules/attention.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.py index ede506463..45f9e311e 100644 --- a/comfy/ldm/modules/attention.py +++ b/comfy/ldm/modules/attention.py @@ -847,6 +847,7 @@ class SpatialTransformer(nn.Module): if not isinstance(context, list): context = [context] * len(self.transformer_blocks) b, c, h, w = x.shape + transformer_options["activations_shape"] = list(x.shape) x_in = x x = self.norm(x) if not self.use_linear: @@ -962,6 +963,7 @@ class SpatialVideoTransformer(SpatialTransformer): transformer_options={} ) -> torch.Tensor: _, _, h, w = x.shape + transformer_options["activations_shape"] = list(x.shape) x_in = x spatial_context = None if exists(context): From 3bfe4e527665d71a3cc88fe06e2733209602ae3a Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 5 Apr 2025 06:14:10 -0400 Subject: [PATCH 277/478] Support 512 siglip model. --- comfy/clip_vision.py | 8 ++++++-- comfy/clip_vision_siglip_512.json | 13 +++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 comfy/clip_vision_siglip_512.json diff --git a/comfy/clip_vision.py b/comfy/clip_vision.py index 87d32a66e..11bc57789 100644 --- a/comfy/clip_vision.py +++ b/comfy/clip_vision.py @@ -110,9 +110,13 @@ def load_clipvision_from_sd(sd, prefix="", convert_keys=False): elif "vision_model.encoder.layers.30.layer_norm1.weight" in sd: json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_vision_config_h.json") elif "vision_model.encoder.layers.22.layer_norm1.weight" in sd: + embed_shape = sd["vision_model.embeddings.position_embedding.weight"].shape[0] if sd["vision_model.encoder.layers.0.layer_norm1.weight"].shape[0] == 1152: - json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_vision_siglip_384.json") - elif sd["vision_model.embeddings.position_embedding.weight"].shape[0] == 577: + if embed_shape == 729: + json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_vision_siglip_384.json") + elif embed_shape == 1024: + json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_vision_siglip_512.json") + elif embed_shape == 577: if "multi_modal_projector.linear_1.bias" in sd: json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_vision_config_vitl_336_llava.json") else: diff --git a/comfy/clip_vision_siglip_512.json b/comfy/clip_vision_siglip_512.json new file mode 100644 index 000000000..7fb93ce15 --- /dev/null +++ b/comfy/clip_vision_siglip_512.json @@ -0,0 +1,13 @@ +{ + "num_channels": 3, + "hidden_act": "gelu_pytorch_tanh", + "hidden_size": 1152, + "image_size": 512, + "intermediate_size": 4304, + "model_type": "siglip_vision_model", + "num_attention_heads": 16, + "num_hidden_layers": 27, + "patch_size": 16, + "image_mean": [0.5, 0.5, 0.5], + "image_std": [0.5, 0.5, 0.5] +} From 49b732afd54e1871d59fd0bca9e7a3a97e3532ea Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 6 Apr 2025 22:43:56 -0400 Subject: [PATCH 278/478] Show a proper error to the user when a vision model file is invalid. --- nodes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nodes.py b/nodes.py index 272c2a25e..218f93256 100644 --- a/nodes.py +++ b/nodes.py @@ -1006,6 +1006,8 @@ class CLIPVisionLoader: def load_clip(self, clip_name): clip_path = folder_paths.get_full_path_or_raise("clip_vision", clip_name) clip_vision = comfy.clip_vision.load(clip_path) + if clip_vision is None: + raise RuntimeError("ERROR: clip vision file is invalid and does not contain a valid vision model.") return (clip_vision,) class CLIPVisionEncode: From 70d7242e57e853c489b608e88d7874e546474604 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 7 Apr 2025 05:01:47 -0400 Subject: [PATCH 279/478] Support the wan fun reward loras. --- comfy/lora_convert.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/comfy/lora_convert.py b/comfy/lora_convert.py index 05032c690..3e00b63db 100644 --- a/comfy/lora_convert.py +++ b/comfy/lora_convert.py @@ -1,4 +1,5 @@ import torch +import comfy.utils def convert_lora_bfl_control(sd): #BFL loras for Flux @@ -11,7 +12,13 @@ def convert_lora_bfl_control(sd): #BFL loras for Flux return sd_out +def convert_lora_wan_fun(sd): #Wan Fun loras + return comfy.utils.state_dict_prefix_replace(sd, {"lora_unet__": "lora_unet_"}) + + def convert_lora(sd): if "img_in.lora_A.weight" in sd and "single_blocks.0.norm.key_norm.scale" in sd: return convert_lora_bfl_control(sd) + if "lora_unet__blocks_0_cross_attn_k.lora_down.weight" in sd: + return convert_lora_wan_fun(sd) return sd From 2f7d8159c32de22c15fbeea7ff9063f2231586bb Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 8 Apr 2025 08:11:59 -0400 Subject: [PATCH 280/478] Show the user an error when the controlnet file is invalid. --- nodes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nodes.py b/nodes.py index 218f93256..55d832df9 100644 --- a/nodes.py +++ b/nodes.py @@ -786,6 +786,8 @@ class ControlNetLoader: def load_controlnet(self, control_net_name): controlnet_path = folder_paths.get_full_path_or_raise("controlnet", control_net_name) controlnet = comfy.controlnet.load_controlnet(controlnet_path) + if controlnet is None: + raise RuntimeError("ERROR: controlnet file is invalid and does not contain a valid controlnet model.") return (controlnet,) class DiffControlNetLoader: From cc7e023a4ad64c8bae864d76b42e1be0606833af Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Wed, 9 Apr 2025 21:07:07 +0800 Subject: [PATCH 281/478] handle palette mode in loadimage node (#7539) --- nodes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nodes.py b/nodes.py index 55d832df9..25fed4258 100644 --- a/nodes.py +++ b/nodes.py @@ -1692,6 +1692,9 @@ class LoadImage: if 'A' in i.getbands(): mask = np.array(i.getchannel('A')).astype(np.float32) / 255.0 mask = 1. - torch.from_numpy(mask) + elif i.mode == 'P' and 'transparency' in i.info: + mask = np.array(i.convert('RGBA').getchannel('A')).astype(np.float32) / 255.0 + mask = 1. - torch.from_numpy(mask) else: mask = torch.zeros((64,64), dtype=torch.float32, device="cpu") output_images.append(image) From 8c6b9f44815b682b50e626dc274de74659e7f6b2 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 9 Apr 2025 09:08:57 -0400 Subject: [PATCH 282/478] Prevent custom nodes from accidentally overwriting global modules. (#7167) * Prevent custom nodes from accidentally overwriting global modules. * Improve. --- nodes.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nodes.py b/nodes.py index 25fed4258..f63e8cb5e 100644 --- a/nodes.py +++ b/nodes.py @@ -2130,21 +2130,25 @@ def get_module_name(module_path: str) -> str: def load_custom_node(module_path: str, ignore=set(), module_parent="custom_nodes") -> bool: - module_name = os.path.basename(module_path) + module_name = get_module_name(module_path) if os.path.isfile(module_path): sp = os.path.splitext(module_path) module_name = sp[0] + sys_module_name = module_name + elif os.path.isdir(module_path): + sys_module_name = module_path + try: logging.debug("Trying to load custom node {}".format(module_path)) if os.path.isfile(module_path): - module_spec = importlib.util.spec_from_file_location(module_name, module_path) + module_spec = importlib.util.spec_from_file_location(sys_module_name, module_path) module_dir = os.path.split(module_path)[0] else: - module_spec = importlib.util.spec_from_file_location(module_name, os.path.join(module_path, "__init__.py")) + module_spec = importlib.util.spec_from_file_location(sys_module_name, os.path.join(module_path, "__init__.py")) module_dir = module_path module = importlib.util.module_from_spec(module_spec) - sys.modules[module_name] = module + sys.modules[sys_module_name] = module module_spec.loader.exec_module(module) LOADED_MODULE_DIRS[module_name] = os.path.abspath(module_dir) From e8345a9b7be82cb58b18fe57526812045c65d941 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 9 Apr 2025 09:10:36 -0400 Subject: [PATCH 283/478] Align /prompt response schema (#7423) --- execution.py | 6 +++--- server.py | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/execution.py b/execution.py index fcb4f6f40..41686888f 100644 --- a/execution.py +++ b/execution.py @@ -775,7 +775,7 @@ def validate_prompt(prompt): "details": f"Node ID '#{x}'", "extra_info": {} } - return (False, error, [], []) + return (False, error, [], {}) class_type = prompt[x]['class_type'] class_ = nodes.NODE_CLASS_MAPPINGS.get(class_type, None) @@ -786,7 +786,7 @@ def validate_prompt(prompt): "details": f"Node ID '#{x}'", "extra_info": {} } - return (False, error, [], []) + return (False, error, [], {}) if hasattr(class_, 'OUTPUT_NODE') and class_.OUTPUT_NODE is True: outputs.add(x) @@ -798,7 +798,7 @@ def validate_prompt(prompt): "details": "", "extra_info": {} } - return (False, error, [], []) + return (False, error, [], {}) good_outputs = set() errors = [] diff --git a/server.py b/server.py index 76a99167d..95092d595 100644 --- a/server.py +++ b/server.py @@ -657,7 +657,13 @@ class PromptServer(): logging.warning("invalid prompt: {}".format(valid[1])) return web.json_response({"error": valid[1], "node_errors": valid[3]}, status=400) else: - return web.json_response({"error": "no prompt", "node_errors": []}, status=400) + error = { + "type": "no_prompt", + "message": "No prompt provided", + "details": "No prompt provided", + "extra_info": {} + } + return web.json_response({"error": error, "node_errors": {}}, status=400) @routes.post("/queue") async def post_queue(request): From fe29739c6858e2c71d2bd23d5533dd51937ae04e Mon Sep 17 00:00:00 2001 From: thot experiment <94414189+thot-experiment@users.noreply.github.com> Date: Wed, 9 Apr 2025 06:41:03 -0700 Subject: [PATCH 284/478] add VoxelToMesh node w/ surfacenet meshing (#7446) * add VoxelToMesh node w/ surfacenet meshing could delete the VoxelToMeshBasic node now probably? * fix ruff --- comfy_extras/nodes_hunyuan3d.py | 219 ++++++++++++++++++++++++++++++++ 1 file changed, 219 insertions(+) diff --git a/comfy_extras/nodes_hunyuan3d.py b/comfy_extras/nodes_hunyuan3d.py index 5adc6b654..30cbd06da 100644 --- a/comfy_extras/nodes_hunyuan3d.py +++ b/comfy_extras/nodes_hunyuan3d.py @@ -209,6 +209,196 @@ def voxel_to_mesh(voxels, threshold=0.5, device=None): vertices = torch.fliplr(vertices) return vertices, faces +def voxel_to_mesh_surfnet(voxels, threshold=0.5, device=None): + if device is None: + device = torch.device("cpu") + voxels = voxels.to(device) + + D, H, W = voxels.shape + + padded = torch.nn.functional.pad(voxels, (1, 1, 1, 1, 1, 1), 'constant', 0) + z, y, x = torch.meshgrid( + torch.arange(D, device=device), + torch.arange(H, device=device), + torch.arange(W, device=device), + indexing='ij' + ) + cell_positions = torch.stack([z.flatten(), y.flatten(), x.flatten()], dim=1) + + corner_offsets = torch.tensor([ + [0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0], + [0, 0, 1], [1, 0, 1], [0, 1, 1], [1, 1, 1] + ], device=device) + + corner_values = torch.zeros((cell_positions.shape[0], 8), device=device) + for c, (dz, dy, dx) in enumerate(corner_offsets): + corner_values[:, c] = padded[ + cell_positions[:, 0] + dz, + cell_positions[:, 1] + dy, + cell_positions[:, 2] + dx + ] + + corner_signs = corner_values > threshold + has_inside = torch.any(corner_signs, dim=1) + has_outside = torch.any(~corner_signs, dim=1) + contains_surface = has_inside & has_outside + + active_cells = cell_positions[contains_surface] + active_signs = corner_signs[contains_surface] + active_values = corner_values[contains_surface] + + if active_cells.shape[0] == 0: + return torch.zeros((0, 3), device=device), torch.zeros((0, 3), dtype=torch.long, device=device) + + edges = torch.tensor([ + [0, 1], [0, 2], [0, 4], [1, 3], + [1, 5], [2, 3], [2, 6], [3, 7], + [4, 5], [4, 6], [5, 7], [6, 7] + ], device=device) + + cell_vertices = {} + progress = comfy.utils.ProgressBar(100) + + for edge_idx, (e1, e2) in enumerate(edges): + progress.update(1) + crossing = active_signs[:, e1] != active_signs[:, e2] + if not crossing.any(): + continue + + cell_indices = torch.nonzero(crossing, as_tuple=True)[0] + + v1 = active_values[cell_indices, e1] + v2 = active_values[cell_indices, e2] + + t = torch.zeros_like(v1, device=device) + denom = v2 - v1 + valid = denom != 0 + t[valid] = (threshold - v1[valid]) / denom[valid] + t[~valid] = 0.5 + + p1 = corner_offsets[e1].float() + p2 = corner_offsets[e2].float() + + intersection = p1.unsqueeze(0) + t.unsqueeze(1) * (p2.unsqueeze(0) - p1.unsqueeze(0)) + + for i, point in zip(cell_indices.tolist(), intersection): + if i not in cell_vertices: + cell_vertices[i] = [] + cell_vertices[i].append(point) + + # Calculate the final vertices as the average of intersection points for each cell + vertices = [] + vertex_lookup = {} + + vert_progress_mod = round(len(cell_vertices)/50) + + for i, points in cell_vertices.items(): + if not i % vert_progress_mod: + progress.update(1) + + if points: + vertex = torch.stack(points).mean(dim=0) + vertex = vertex + active_cells[i].float() + vertex_lookup[tuple(active_cells[i].tolist())] = len(vertices) + vertices.append(vertex) + + if not vertices: + return torch.zeros((0, 3), device=device), torch.zeros((0, 3), dtype=torch.long, device=device) + + final_vertices = torch.stack(vertices) + + inside_corners_mask = active_signs + outside_corners_mask = ~active_signs + + inside_counts = inside_corners_mask.sum(dim=1, keepdim=True).float() + outside_counts = outside_corners_mask.sum(dim=1, keepdim=True).float() + + inside_pos = torch.zeros((active_cells.shape[0], 3), device=device) + outside_pos = torch.zeros((active_cells.shape[0], 3), device=device) + + for i in range(8): + mask_inside = inside_corners_mask[:, i].unsqueeze(1) + mask_outside = outside_corners_mask[:, i].unsqueeze(1) + inside_pos += corner_offsets[i].float().unsqueeze(0) * mask_inside + outside_pos += corner_offsets[i].float().unsqueeze(0) * mask_outside + + inside_pos /= inside_counts + outside_pos /= outside_counts + gradients = inside_pos - outside_pos + + pos_dirs = torch.tensor([ + [1, 0, 0], + [0, 1, 0], + [0, 0, 1] + ], device=device) + + cross_products = [ + torch.linalg.cross(pos_dirs[i].float(), pos_dirs[j].float()) + for i in range(3) for j in range(i+1, 3) + ] + + faces = [] + all_keys = set(vertex_lookup.keys()) + + face_progress_mod = round(len(active_cells)/38*3) + + for pair_idx, (i, j) in enumerate([(0,1), (0,2), (1,2)]): + dir_i = pos_dirs[i] + dir_j = pos_dirs[j] + cross_product = cross_products[pair_idx] + + ni_positions = active_cells + dir_i + nj_positions = active_cells + dir_j + diag_positions = active_cells + dir_i + dir_j + + alignments = torch.matmul(gradients, cross_product) + + valid_quads = [] + quad_indices = [] + + for idx, active_cell in enumerate(active_cells): + if not idx % face_progress_mod: + progress.update(1) + cell_key = tuple(active_cell.tolist()) + ni_key = tuple(ni_positions[idx].tolist()) + nj_key = tuple(nj_positions[idx].tolist()) + diag_key = tuple(diag_positions[idx].tolist()) + + if cell_key in all_keys and ni_key in all_keys and nj_key in all_keys and diag_key in all_keys: + v0 = vertex_lookup[cell_key] + v1 = vertex_lookup[ni_key] + v2 = vertex_lookup[nj_key] + v3 = vertex_lookup[diag_key] + + valid_quads.append((v0, v1, v2, v3)) + quad_indices.append(idx) + + for q_idx, (v0, v1, v2, v3) in enumerate(valid_quads): + cell_idx = quad_indices[q_idx] + if alignments[cell_idx] > 0: + faces.append(torch.tensor([v0, v1, v3], device=device, dtype=torch.long)) + faces.append(torch.tensor([v0, v3, v2], device=device, dtype=torch.long)) + else: + faces.append(torch.tensor([v0, v3, v1], device=device, dtype=torch.long)) + faces.append(torch.tensor([v0, v2, v3], device=device, dtype=torch.long)) + + if faces: + faces = torch.stack(faces) + else: + faces = torch.zeros((0, 3), dtype=torch.long, device=device) + + v_min = 0 + v_max = max(D, H, W) + + final_vertices = final_vertices - (v_min + v_max) / 2 + + scale = (v_max - v_min) / 2 + if scale > 0: + final_vertices = final_vertices / scale + + final_vertices = torch.fliplr(final_vertices) + + return final_vertices, faces class MESH: def __init__(self, vertices, faces): @@ -237,6 +427,34 @@ class VoxelToMeshBasic: return (MESH(torch.stack(vertices), torch.stack(faces)), ) +class VoxelToMesh: + @classmethod + def INPUT_TYPES(s): + return {"required": {"voxel": ("VOXEL", ), + "algorithm": (["basic", "surface net"], ), + "threshold": ("FLOAT", {"default": 0.6, "min": -1.0, "max": 1.0, "step": 0.01}), + }} + RETURN_TYPES = ("MESH",) + FUNCTION = "decode" + + CATEGORY = "3d" + + def decode(self, voxel, algorithm, threshold): + vertices = [] + faces = [] + + if algorithm == "basic": + mesh_function = voxel_to_mesh + elif algorithm == "surface net": + mesh_function = voxel_to_mesh_surfnet + + for x in voxel.data: + v, f = mesh_function(x, threshold=threshold, device=None) + vertices.append(v) + faces.append(f) + + return (MESH(torch.stack(vertices), torch.stack(faces)), ) + def save_glb(vertices, faces, filepath, metadata=None): """ @@ -411,5 +629,6 @@ NODE_CLASS_MAPPINGS = { "Hunyuan3Dv2ConditioningMultiView": Hunyuan3Dv2ConditioningMultiView, "VAEDecodeHunyuan3D": VAEDecodeHunyuan3D, "VoxelToMeshBasic": VoxelToMeshBasic, + "VoxelToMesh": VoxelToMesh, "SaveGLB": SaveGLB, } From ab31b64412c46334267fade77b688e9e561e10d6 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 9 Apr 2025 09:42:08 -0400 Subject: [PATCH 285/478] Make "surface net" the default in the VoxelToMesh node. --- comfy_extras/nodes_hunyuan3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy_extras/nodes_hunyuan3d.py b/comfy_extras/nodes_hunyuan3d.py index 30cbd06da..51e45336a 100644 --- a/comfy_extras/nodes_hunyuan3d.py +++ b/comfy_extras/nodes_hunyuan3d.py @@ -431,7 +431,7 @@ class VoxelToMesh: @classmethod def INPUT_TYPES(s): return {"required": {"voxel": ("VOXEL", ), - "algorithm": (["basic", "surface net"], ), + "algorithm": (["surface net", "basic"], ), "threshold": ("FLOAT", {"default": 0.6, "min": -1.0, "max": 1.0, "step": 0.01}), }} RETURN_TYPES = ("MESH",) From e346d8584e30996455afcc3773f16442f24c3679 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Wed, 9 Apr 2025 21:43:35 +0800 Subject: [PATCH 286/478] Add prepare_sampling wrapper allowing custom nodes to more accurately report noise_shape (#7500) --- comfy/patcher_extension.py | 1 + comfy/sampler_helpers.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/comfy/patcher_extension.py b/comfy/patcher_extension.py index 859758244..965958f4c 100644 --- a/comfy/patcher_extension.py +++ b/comfy/patcher_extension.py @@ -48,6 +48,7 @@ def get_all_callbacks(call_type: str, transformer_options: dict, is_model_option class WrappersMP: OUTER_SAMPLE = "outer_sample" + PREPARE_SAMPLING = "prepare_sampling" SAMPLER_SAMPLE = "sampler_sample" CALC_COND_BATCH = "calc_cond_batch" APPLY_MODEL = "apply_model" diff --git a/comfy/sampler_helpers.py b/comfy/sampler_helpers.py index 92ec7ca7a..96a3040a1 100644 --- a/comfy/sampler_helpers.py +++ b/comfy/sampler_helpers.py @@ -106,6 +106,13 @@ def cleanup_additional_models(models): def prepare_sampling(model: ModelPatcher, noise_shape, conds, model_options=None): + executor = comfy.patcher_extension.WrapperExecutor.new_executor( + _prepare_sampling, + comfy.patcher_extension.get_all_wrappers(comfy.patcher_extension.WrappersMP.PREPARE_SAMPLING, model_options, is_model_options=True) + ) + return executor.execute(model, noise_shape, conds, model_options=model_options) + +def _prepare_sampling(model: ModelPatcher, noise_shape, conds, model_options=None): real_model: BaseModel = None models, inference_memory = get_additional_models(conds, model.model_dtype()) models += get_additional_models_from_model_options(model_options) From a26da20a76120d80ee085aa982cb7feef07e25f5 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 10 Apr 2025 03:37:27 -0400 Subject: [PATCH 287/478] Fix custom nodes not importing when path contains a dot. --- nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index f63e8cb5e..8c1720c1a 100644 --- a/nodes.py +++ b/nodes.py @@ -2136,7 +2136,7 @@ def load_custom_node(module_path: str, ignore=set(), module_parent="custom_nodes module_name = sp[0] sys_module_name = module_name elif os.path.isdir(module_path): - sys_module_name = module_path + sys_module_name = module_path.replace(".", "_x_") try: logging.debug("Trying to load custom node {}".format(module_path)) From 98bdca4cb2907ad10bd24776c0b7587becdd5734 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Thu, 10 Apr 2025 06:57:06 -0400 Subject: [PATCH 288/478] Deprecate InputTypeOptions.defaultInput (#7551) * Deprecate InputTypeOptions.defaultInput * nit * nit --- comfy/comfy_types/node_typing.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/comfy/comfy_types/node_typing.py b/comfy/comfy_types/node_typing.py index 1b71208d4..3535966fb 100644 --- a/comfy/comfy_types/node_typing.py +++ b/comfy/comfy_types/node_typing.py @@ -102,9 +102,13 @@ class InputTypeOptions(TypedDict): default: bool | str | float | int | list | tuple """The default value of the widget""" defaultInput: bool - """Defaults to an input slot rather than a widget""" + """@deprecated in v1.16 frontend. v1.16 frontend allows input socket and widget to co-exist. + - defaultInput on required inputs should be dropped. + - defaultInput on optional inputs should be replaced with forceInput. + Ref: https://github.com/Comfy-Org/ComfyUI_frontend/pull/3364 + """ forceInput: bool - """`defaultInput` and also don't allow converting to a widget""" + """Forces the input to be an input slot rather than a widget even a widget is available for the input type.""" lazy: bool """Declares that this input uses lazy evaluation""" rawLink: bool From 8ad7477647eae31da5b959ffe77c12db0d3cde26 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Apr 2025 18:06:53 +0800 Subject: [PATCH 289/478] dont cache templates index (#7569) --- server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.py b/server.py index 95092d595..62667ce18 100644 --- a/server.py +++ b/server.py @@ -48,7 +48,7 @@ async def send_socket_catch_exception(function, message): @web.middleware async def cache_control(request: web.Request, handler): response: web.Response = await handler(request) - if request.path.endswith('.js') or request.path.endswith('.css'): + if request.path.endswith('.js') or request.path.endswith('.css') or request.path.endswith('index.json'): response.headers.setdefault('Cache-Control', 'no-cache') return response From f9207c69369b200c89953cb422500e5f36f7d342 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 11 Apr 2025 06:46:20 -0400 Subject: [PATCH 290/478] Update frontend to 1.15 (#7564) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 806fbc751..851db23bd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.14.6 +comfyui-frontend-package==1.15.13 torch torchsde torchvision From ed945a17902802fc5eb1f55397e0e3f63d2c63b0 Mon Sep 17 00:00:00 2001 From: Chargeuk Date: Fri, 11 Apr 2025 11:55:51 +0100 Subject: [PATCH 291/478] Dependency Aware Node Caching for low RAM/VRAM machines (#7509) * add dependency aware cache that removed a cached node as soon as all of its decendents have executed. This allows users with lower RAM to run workflows they would otherwise not be able to run. The downside is that every workflow will fully run each time even if no nodes have changed. * remove test code * tidy code --- comfy/cli_args.py | 1 + comfy_execution/caching.py | 153 +++++++++++++++++++++++++++++++++++++ execution.py | 31 +++++--- main.py | 2 +- 4 files changed, 174 insertions(+), 13 deletions(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 62079e6a7..79ecbd682 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -101,6 +101,7 @@ parser.add_argument("--preview-size", type=int, default=512, help="Sets the maxi cache_group = parser.add_mutually_exclusive_group() cache_group.add_argument("--cache-classic", action="store_true", help="Use the old style (aggressive) caching.") cache_group.add_argument("--cache-lru", type=int, default=0, help="Use LRU caching with a maximum of N node results cached. May use more RAM/VRAM.") +cache_group.add_argument("--cache-none", action="store_true", help="Reduced RAM/VRAM usage at the expense of executing every node for each run.") attn_group = parser.add_mutually_exclusive_group() attn_group.add_argument("--use-split-cross-attention", action="store_true", help="Use the split cross attention optimization. Ignored when xformers is used.") diff --git a/comfy_execution/caching.py b/comfy_execution/caching.py index 630f280fc..dbb37b89f 100644 --- a/comfy_execution/caching.py +++ b/comfy_execution/caching.py @@ -316,3 +316,156 @@ class LRUCache(BasicCache): self.children[cache_key].append(self.cache_key_set.get_data_key(child_id)) return self + +class DependencyAwareCache(BasicCache): + """ + A cache implementation that tracks dependencies between nodes and manages + their execution and caching accordingly. It extends the BasicCache class. + Nodes are removed from this cache once all of their descendants have been + executed. + """ + + def __init__(self, key_class): + """ + Initialize the DependencyAwareCache. + + Args: + key_class: The class used for generating cache keys. + """ + super().__init__(key_class) + self.descendants = {} # Maps node_id -> set of descendant node_ids + self.ancestors = {} # Maps node_id -> set of ancestor node_ids + self.executed_nodes = set() # Tracks nodes that have been executed + + def set_prompt(self, dynprompt, node_ids, is_changed_cache): + """ + Clear the entire cache and rebuild the dependency graph. + + Args: + dynprompt: The dynamic prompt object containing node information. + node_ids: List of node IDs to initialize the cache for. + is_changed_cache: Flag indicating if the cache has changed. + """ + # Clear all existing cache data + self.cache.clear() + self.subcaches.clear() + self.descendants.clear() + self.ancestors.clear() + self.executed_nodes.clear() + + # Call the parent method to initialize the cache with the new prompt + super().set_prompt(dynprompt, node_ids, is_changed_cache) + + # Rebuild the dependency graph + self._build_dependency_graph(dynprompt, node_ids) + + def _build_dependency_graph(self, dynprompt, node_ids): + """ + Build the dependency graph for all nodes. + + Args: + dynprompt: The dynamic prompt object containing node information. + node_ids: List of node IDs to build the graph for. + """ + self.descendants.clear() + self.ancestors.clear() + for node_id in node_ids: + self.descendants[node_id] = set() + self.ancestors[node_id] = set() + + for node_id in node_ids: + inputs = dynprompt.get_node(node_id)["inputs"] + for input_data in inputs.values(): + if is_link(input_data): # Check if the input is a link to another node + ancestor_id = input_data[0] + self.descendants[ancestor_id].add(node_id) + self.ancestors[node_id].add(ancestor_id) + + def set(self, node_id, value): + """ + Mark a node as executed and store its value in the cache. + + Args: + node_id: The ID of the node to store. + value: The value to store for the node. + """ + self._set_immediate(node_id, value) + self.executed_nodes.add(node_id) + self._cleanup_ancestors(node_id) + + def get(self, node_id): + """ + Retrieve the cached value for a node. + + Args: + node_id: The ID of the node to retrieve. + + Returns: + The cached value for the node. + """ + return self._get_immediate(node_id) + + def ensure_subcache_for(self, node_id, children_ids): + """ + Ensure a subcache exists for a node and update dependencies. + + Args: + node_id: The ID of the parent node. + children_ids: List of child node IDs to associate with the parent node. + + Returns: + The subcache object for the node. + """ + subcache = super()._ensure_subcache(node_id, children_ids) + for child_id in children_ids: + self.descendants[node_id].add(child_id) + self.ancestors[child_id].add(node_id) + return subcache + + def _cleanup_ancestors(self, node_id): + """ + Check if ancestors of a node can be removed from the cache. + + Args: + node_id: The ID of the node whose ancestors are to be checked. + """ + for ancestor_id in self.ancestors.get(node_id, []): + if ancestor_id in self.executed_nodes: + # Remove ancestor if all its descendants have been executed + if all(descendant in self.executed_nodes for descendant in self.descendants[ancestor_id]): + self._remove_node(ancestor_id) + + def _remove_node(self, node_id): + """ + Remove a node from the cache. + + Args: + node_id: The ID of the node to remove. + """ + cache_key = self.cache_key_set.get_data_key(node_id) + if cache_key in self.cache: + del self.cache[cache_key] + subcache_key = self.cache_key_set.get_subcache_key(node_id) + if subcache_key in self.subcaches: + del self.subcaches[subcache_key] + + def clean_unused(self): + """ + Clean up unused nodes. This is a no-op for this cache implementation. + """ + pass + + def recursive_debug_dump(self): + """ + Dump the cache and dependency graph for debugging. + + Returns: + A list containing the cache state and dependency graph. + """ + result = super().recursive_debug_dump() + result.append({ + "descendants": self.descendants, + "ancestors": self.ancestors, + "executed_nodes": list(self.executed_nodes), + }) + return result diff --git a/execution.py b/execution.py index 41686888f..7431c100d 100644 --- a/execution.py +++ b/execution.py @@ -15,7 +15,7 @@ import nodes import comfy.model_management from comfy_execution.graph import get_input_info, ExecutionList, DynamicPrompt, ExecutionBlocker from comfy_execution.graph_utils import is_link, GraphBuilder -from comfy_execution.caching import HierarchicalCache, LRUCache, CacheKeySetInputSignature, CacheKeySetID +from comfy_execution.caching import HierarchicalCache, LRUCache, DependencyAwareCache, CacheKeySetInputSignature, CacheKeySetID from comfy_execution.validation import validate_node_input class ExecutionResult(Enum): @@ -60,26 +60,32 @@ class IsChangedCache: return self.is_changed[node_id] class CacheSet: - def __init__(self, lru_size=None): - if lru_size is None or lru_size == 0: + def __init__(self, lru_size=None, cache_none=False): + if cache_none: + self.init_dependency_aware_cache() + elif lru_size is None or lru_size == 0: self.init_classic_cache() else: self.init_lru_cache(lru_size) self.all = [self.outputs, self.ui, self.objects] - # Useful for those with ample RAM/VRAM -- allows experimenting without - # blowing away the cache every time - def init_lru_cache(self, cache_size): - self.outputs = LRUCache(CacheKeySetInputSignature, max_size=cache_size) - self.ui = LRUCache(CacheKeySetInputSignature, max_size=cache_size) - self.objects = HierarchicalCache(CacheKeySetID) - # Performs like the old cache -- dump data ASAP def init_classic_cache(self): self.outputs = HierarchicalCache(CacheKeySetInputSignature) self.ui = HierarchicalCache(CacheKeySetInputSignature) self.objects = HierarchicalCache(CacheKeySetID) + def init_lru_cache(self, cache_size): + self.outputs = LRUCache(CacheKeySetInputSignature, max_size=cache_size) + self.ui = LRUCache(CacheKeySetInputSignature, max_size=cache_size) + self.objects = HierarchicalCache(CacheKeySetID) + + # only hold cached items while the decendents have not executed + def init_dependency_aware_cache(self): + self.outputs = DependencyAwareCache(CacheKeySetInputSignature) + self.ui = DependencyAwareCache(CacheKeySetInputSignature) + self.objects = DependencyAwareCache(CacheKeySetID) + def recursive_debug_dump(self): result = { "outputs": self.outputs.recursive_debug_dump(), @@ -414,13 +420,14 @@ def execute(server, dynprompt, caches, current_item, extra_data, executed, promp return (ExecutionResult.SUCCESS, None, None) class PromptExecutor: - def __init__(self, server, lru_size=None): + def __init__(self, server, lru_size=None, cache_none=False): self.lru_size = lru_size + self.cache_none = cache_none self.server = server self.reset() def reset(self): - self.caches = CacheSet(self.lru_size) + self.caches = CacheSet(self.lru_size, self.cache_none) self.status_messages = [] self.success = True diff --git a/main.py b/main.py index 1b100fa8a..e72e7c567 100644 --- a/main.py +++ b/main.py @@ -156,7 +156,7 @@ def cuda_malloc_warning(): def prompt_worker(q, server_instance): current_time: float = 0.0 - e = execution.PromptExecutor(server_instance, lru_size=args.cache_lru) + e = execution.PromptExecutor(server_instance, lru_size=args.cache_lru, cache_none=args.cache_none) last_gc_collect = 0 need_gc = False gc_collect_interval = 10.0 From 22ad513c72b891322f7baf6b459aa41858087b3b Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 11 Apr 2025 07:16:52 -0400 Subject: [PATCH 292/478] Refactor node cache code to more easily add other types of cache. --- execution.py | 30 +++++++++++++++++++++--------- main.py | 8 +++++++- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/execution.py b/execution.py index 7431c100d..9a5e27771 100644 --- a/execution.py +++ b/execution.py @@ -59,14 +59,26 @@ class IsChangedCache: self.is_changed[node_id] = node["is_changed"] return self.is_changed[node_id] + +class CacheType(Enum): + CLASSIC = 0 + LRU = 1 + DEPENDENCY_AWARE = 2 + + class CacheSet: - def __init__(self, lru_size=None, cache_none=False): - if cache_none: + def __init__(self, cache_type=None, cache_size=None): + if cache_type == CacheType.DEPENDENCY_AWARE: self.init_dependency_aware_cache() - elif lru_size is None or lru_size == 0: - self.init_classic_cache() + logging.info("Disabling intermediate node cache.") + elif cache_type == CacheType.LRU: + if cache_size is None: + cache_size = 0 + self.init_lru_cache(cache_size) + logging.info("Using LRU cache") else: - self.init_lru_cache(lru_size) + self.init_classic_cache() + self.all = [self.outputs, self.ui, self.objects] # Performs like the old cache -- dump data ASAP @@ -420,14 +432,14 @@ def execute(server, dynprompt, caches, current_item, extra_data, executed, promp return (ExecutionResult.SUCCESS, None, None) class PromptExecutor: - def __init__(self, server, lru_size=None, cache_none=False): - self.lru_size = lru_size - self.cache_none = cache_none + def __init__(self, server, cache_type=False, cache_size=None): + self.cache_size = cache_size + self.cache_type = cache_type self.server = server self.reset() def reset(self): - self.caches = CacheSet(self.lru_size, self.cache_none) + self.caches = CacheSet(cache_type=self.cache_type, cache_size=self.cache_size) self.status_messages = [] self.success = True diff --git a/main.py b/main.py index e72e7c567..4780a9c69 100644 --- a/main.py +++ b/main.py @@ -156,7 +156,13 @@ def cuda_malloc_warning(): def prompt_worker(q, server_instance): current_time: float = 0.0 - e = execution.PromptExecutor(server_instance, lru_size=args.cache_lru, cache_none=args.cache_none) + cache_type = execution.CacheType.CLASSIC + if args.cache_lru > 0: + cache_type = execution.CacheType.LRU + elif args.cache_none: + cache_type = execution.CacheType.DEPENDENCY_AWARE + + e = execution.PromptExecutor(server_instance, cache_type=cache_type, cache_size=args.cache_lru) last_gc_collect = 0 need_gc = False gc_collect_interval = 10.0 From 73ecb75a3d375da2642f285866b2ce8b6e34b922 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sun, 13 Apr 2025 06:27:59 +0800 Subject: [PATCH 293/478] filter image files in load image dropdown (#7573) --- nodes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nodes.py b/nodes.py index 8c1720c1a..e2893e83a 100644 --- a/nodes.py +++ b/nodes.py @@ -1654,6 +1654,7 @@ class LoadImage: def INPUT_TYPES(s): input_dir = folder_paths.get_input_directory() files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))] + files = folder_paths.filter_files_content_types(files, ["image"]) return {"required": {"image": (sorted(files), {"image_upload": True})}, } From 1714a4c158c1fdf1c00b691ac00a9779d3c68790 Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Sat, 12 Apr 2025 18:29:15 -0400 Subject: [PATCH 294/478] Add CublasOps support (#7574) * CublasOps support * Guard CublasOps behind --fast arg --- comfy/cli_args.py | 3 ++- comfy/ops.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 79ecbd682..81f29f098 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -136,8 +136,9 @@ parser.add_argument("--deterministic", action="store_true", help="Make pytorch u class PerformanceFeature(enum.Enum): Fp16Accumulation = "fp16_accumulation" Fp8MatrixMultiplication = "fp8_matrix_mult" + CublasOps = "cublas_ops" -parser.add_argument("--fast", nargs="*", type=PerformanceFeature, help="Enable some untested and potentially quality deteriorating optimizations. --fast with no arguments enables everything. You can pass a list specific optimizations if you only want to enable specific ones. Current valid optimizations: fp16_accumulation fp8_matrix_mult") +parser.add_argument("--fast", nargs="*", type=PerformanceFeature, help="Enable some untested and potentially quality deteriorating optimizations. --fast with no arguments enables everything. You can pass a list specific optimizations if you only want to enable specific ones. Current valid optimizations: fp16_accumulation fp8_matrix_mult cublas_ops") parser.add_argument("--dont-print-server", action="store_true", help="Don't print server output.") parser.add_argument("--quick-test-for-ci", action="store_true", help="Quick test for CI.") diff --git a/comfy/ops.py b/comfy/ops.py index ced461011..9a5c1ee99 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -357,6 +357,25 @@ def scaled_fp8_ops(fp8_matrix_mult=False, scale_input=False, override_dtype=None return scaled_fp8_op +CUBLAS_IS_AVAILABLE = False +try: + from cublas_ops import CublasLinear + CUBLAS_IS_AVAILABLE = True +except ImportError: + pass + +if CUBLAS_IS_AVAILABLE: + class cublas_ops(disable_weight_init): + class Linear(CublasLinear, disable_weight_init.Linear): + def reset_parameters(self): + return None + + def forward_comfy_cast_weights(self, input): + return super().forward(input) + + def forward(self, *args, **kwargs): + return super().forward(*args, **kwargs) + def pick_operations(weight_dtype, compute_dtype, load_device=None, disable_fast_fp8=False, fp8_optimizations=False, scaled_fp8=None): fp8_compute = comfy.model_management.supports_fp8_compute(load_device) if scaled_fp8 is not None: @@ -369,6 +388,15 @@ def pick_operations(weight_dtype, compute_dtype, load_device=None, disable_fast_ ): return fp8_ops + if ( + PerformanceFeature.CublasOps in args.fast and + CUBLAS_IS_AVAILABLE and + weight_dtype == torch.float16 and + (compute_dtype == torch.float16 or compute_dtype is None) + ): + logging.info("Using cublas ops") + return cublas_ops + if compute_dtype is None or weight_dtype == compute_dtype: return disable_weight_init From c87a06f93484f252ec2a6da4e1611645df6e1267 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sun, 13 Apr 2025 06:30:39 +0800 Subject: [PATCH 295/478] Update `filter_files_content_types` to support filtering 3d models (#7572) * support 3d model filtering * fix lint error: blank line contains whitespace * add model extensions to test runner mimetype cache manually * use unittest.mock.patch * remove mtl file from testcase (actually plaintext support file) --- folder_paths.py | 8 +++++-- .../filter_by_content_types_test.py | 22 +++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/folder_paths.py b/folder_paths.py index 72c70f594..9a525e5a1 100644 --- a/folder_paths.py +++ b/folder_paths.py @@ -85,6 +85,7 @@ cache_helper = CacheHelper() extension_mimetypes_cache = { "webp" : "image", + "fbx" : "model", } def map_legacy(folder_name: str) -> str: @@ -140,11 +141,14 @@ def get_directory_by_type(type_name: str) -> str | None: return get_input_directory() return None -def filter_files_content_types(files: list[str], content_types: Literal["image", "video", "audio"]) -> list[str]: +def filter_files_content_types(files: list[str], content_types: Literal["image", "video", "audio", "model"]) -> list[str]: """ Example: files = os.listdir(folder_paths.get_input_directory()) - filter_files_content_types(files, ["image", "audio", "video"]) + videos = filter_files_content_types(files, ["video"]) + + Note: + - 'model' in MIME context refers to 3D models, not files containing trained weights and parameters """ global extension_mimetypes_cache result = [] 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 423677a60..683f9fc11 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 @@ -1,14 +1,17 @@ import pytest import os import tempfile -from folder_paths import filter_files_content_types +from folder_paths import filter_files_content_types, extension_mimetypes_cache +from unittest.mock import patch + @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'], - 'video': ['avi', 'm2v', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'ogv', 'qt', 'webm', 'wmv'] + 'video': ['avi', 'm2v', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'ogv', 'qt', 'webm', 'wmv'], + 'model': ['gltf', 'glb', 'obj', 'fbx', 'stl'] } @@ -22,7 +25,18 @@ def mock_dir(file_extensions): yield directory -def test_categorizes_all_correctly(mock_dir, file_extensions): +@pytest.fixture +def patched_mimetype_cache(file_extensions): + # Mock model file extensions since they may not be in the test-runner system's mimetype cache + new_cache = extension_mimetypes_cache.copy() + for extension in file_extensions["model"]: + new_cache[extension] = "model" + + with patch("folder_paths.extension_mimetypes_cache", new_cache): + yield + + +def test_categorizes_all_correctly(mock_dir, file_extensions, patched_mimetype_cache): files = os.listdir(mock_dir) for content_type, extensions in file_extensions.items(): filtered_files = filter_files_content_types(files, [content_type]) @@ -30,7 +44,7 @@ def test_categorizes_all_correctly(mock_dir, file_extensions): assert f"sample_{content_type}.{extension}" in filtered_files -def test_categorizes_all_uniquely(mock_dir, file_extensions): +def test_categorizes_all_uniquely(mock_dir, file_extensions, patched_mimetype_cache): files = os.listdir(mock_dir) for content_type, extensions in file_extensions.items(): filtered_files = filter_files_content_types(files, [content_type]) From e51d9ba5fc6b48e8f55dbdc3790946abe1ba20fe Mon Sep 17 00:00:00 2001 From: chaObserv <154517000+chaObserv@users.noreply.github.com> Date: Sun, 13 Apr 2025 06:36:08 +0800 Subject: [PATCH 296/478] Add SEEDS (stage 2 & 3 DP) sampler (#7580) * Add seeds stage 2 & 3 (DP) sampler * Change the name to SEEDS in comment --- comfy/k_diffusion/sampling.py | 98 +++++++++++++++++++++++++++++++++++ comfy/samplers.py | 2 +- 2 files changed, 99 insertions(+), 1 deletion(-) diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index 5b8d8000d..6388d3faf 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -1422,3 +1422,101 @@ def sample_er_sde(model, x, sigmas, extra_args=None, callback=None, disable=None x = x + noise_sampler(sigmas[i], sigmas[i + 1]) * s_noise * (sigmas[i + 1] ** 2 - sigmas[i] ** 2 * r ** 2).sqrt().nan_to_num(nan=0.0) old_denoised = denoised return x + +@torch.no_grad() +def sample_seeds_2(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None, r=0.5): + ''' + SEEDS-2 - Stochastic Explicit Exponential Derivative-free Solvers (VE Data Prediction) stage 2 + Arxiv: https://arxiv.org/abs/2305.14267 + ''' + extra_args = {} if extra_args is None else extra_args + seed = extra_args.get("seed", None) + noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler + s_in = x.new_ones([x.shape[0]]) + + inject_noise = eta > 0 and s_noise > 0 + + for i in trange(len(sigmas) - 1, disable=disable): + denoised = model(x, sigmas[i] * s_in, **extra_args) + if callback is not None: + callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigmas[i], 'denoised': denoised}) + if sigmas[i + 1] == 0: + x = denoised + else: + t, t_next = -sigmas[i].log(), -sigmas[i + 1].log() + h = t_next - t + h_eta = h * (eta + 1) + s = t + r * h + fac = 1 / (2 * r) + sigma_s = s.neg().exp() + + coeff_1, coeff_2 = (-r * h_eta).expm1(), (-h_eta).expm1() + if inject_noise: + noise_coeff_1 = (-2 * r * h * eta).expm1().neg().sqrt() + noise_coeff_2 = ((-2 * r * h * eta).expm1() - (-2 * h * eta).expm1()).sqrt() + noise_1, noise_2 = noise_sampler(sigmas[i], sigma_s), noise_sampler(sigma_s, sigmas[i + 1]) + + # Step 1 + x_2 = (coeff_1 + 1) * x - coeff_1 * denoised + if inject_noise: + x_2 = x_2 + sigma_s * (noise_coeff_1 * noise_1) * s_noise + denoised_2 = model(x_2, sigma_s * s_in, **extra_args) + + # Step 2 + denoised_d = (1 - fac) * denoised + fac * denoised_2 + x = (coeff_2 + 1) * x - coeff_2 * denoised_d + if inject_noise: + x = x + sigmas[i + 1] * (noise_coeff_2 * noise_1 + noise_coeff_1 * noise_2) * s_noise + return x + +@torch.no_grad() +def sample_seeds_3(model, x, sigmas, extra_args=None, callback=None, disable=None, eta=1., s_noise=1., noise_sampler=None, r_1=1./3, r_2=2./3): + ''' + SEEDS-3 - Stochastic Explicit Exponential Derivative-free Solvers (VE Data Prediction) stage 3 + Arxiv: https://arxiv.org/abs/2305.14267 + ''' + extra_args = {} if extra_args is None else extra_args + seed = extra_args.get("seed", None) + noise_sampler = default_noise_sampler(x, seed=seed) if noise_sampler is None else noise_sampler + s_in = x.new_ones([x.shape[0]]) + + inject_noise = eta > 0 and s_noise > 0 + + for i in trange(len(sigmas) - 1, disable=disable): + denoised = model(x, sigmas[i] * s_in, **extra_args) + if callback is not None: + callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigmas[i], 'denoised': denoised}) + if sigmas[i + 1] == 0: + x = denoised + else: + t, t_next = -sigmas[i].log(), -sigmas[i + 1].log() + h = t_next - t + h_eta = h * (eta + 1) + s_1 = t + r_1 * h + s_2 = t + r_2 * h + sigma_s_1, sigma_s_2 = s_1.neg().exp(), s_2.neg().exp() + + coeff_1, coeff_2, coeff_3 = (-r_1 * h_eta).expm1(), (-r_2 * h_eta).expm1(), (-h_eta).expm1() + if inject_noise: + noise_coeff_1 = (-2 * r_1 * h * eta).expm1().neg().sqrt() + noise_coeff_2 = ((-2 * r_1 * h * eta).expm1() - (-2 * r_2 * h * eta).expm1()).sqrt() + noise_coeff_3 = ((-2 * r_2 * h * eta).expm1() - (-2 * h * eta).expm1()).sqrt() + noise_1, noise_2, noise_3 = noise_sampler(sigmas[i], sigma_s_1), noise_sampler(sigma_s_1, sigma_s_2), noise_sampler(sigma_s_2, sigmas[i + 1]) + + # Step 1 + x_2 = (coeff_1 + 1) * x - coeff_1 * denoised + if inject_noise: + x_2 = x_2 + sigma_s_1 * (noise_coeff_1 * noise_1) * s_noise + denoised_2 = model(x_2, sigma_s_1 * s_in, **extra_args) + + # Step 2 + x_3 = (coeff_2 + 1) * x - coeff_2 * denoised + (r_2 / r_1) * (coeff_2 / (r_2 * h_eta) + 1) * (denoised_2 - denoised) + if inject_noise: + x_3 = x_3 + sigma_s_2 * (noise_coeff_2 * noise_1 + noise_coeff_1 * noise_2) * s_noise + denoised_3 = model(x_3, sigma_s_2 * s_in, **extra_args) + + # Step 3 + x = (coeff_3 + 1) * x - coeff_3 * denoised + (1. / r_2) * (coeff_3 / h_eta + 1) * (denoised_3 - denoised) + if inject_noise: + x = x + sigmas[i + 1] * (noise_coeff_3 * noise_1 + noise_coeff_2 * noise_2 + noise_coeff_1 * noise_3) * s_noise + return x diff --git a/comfy/samplers.py b/comfy/samplers.py index 10728bd1f..27dfce45a 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -710,7 +710,7 @@ KSAMPLER_NAMES = ["euler", "euler_cfg_pp", "euler_ancestral", "euler_ancestral_c "lms", "dpm_fast", "dpm_adaptive", "dpmpp_2s_ancestral", "dpmpp_2s_ancestral_cfg_pp", "dpmpp_sde", "dpmpp_sde_gpu", "dpmpp_2m", "dpmpp_2m_cfg_pp", "dpmpp_2m_sde", "dpmpp_2m_sde_gpu", "dpmpp_3m_sde", "dpmpp_3m_sde_gpu", "ddpm", "lcm", "ipndm", "ipndm_v", "deis", "res_multistep", "res_multistep_cfg_pp", "res_multistep_ancestral", "res_multistep_ancestral_cfg_pp", - "gradient_estimation", "er_sde"] + "gradient_estimation", "er_sde", "seeds_2", "seeds_3"] class KSAMPLER(Sampler): def __init__(self, sampler_function, extra_options={}, inpaint_options={}): From bb495cc9b85b8c6793b61e890df64fe3cb3f07fd Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 12 Apr 2025 18:58:20 -0400 Subject: [PATCH 297/478] Print python version in log. --- main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.py b/main.py index 4780a9c69..ac9d24b7b 100644 --- a/main.py +++ b/main.py @@ -10,6 +10,7 @@ from app.logger import setup_logger import itertools import utils.extra_config import logging +import sys if __name__ == "__main__": #NOTE: These do not do anything on core ComfyUI which should already have no communication with the internet, they are for custom nodes. @@ -301,6 +302,7 @@ def start_comfyui(asyncio_loop=None): if __name__ == "__main__": # Running directly, just start ComfyUI. + logging.info("Python version: {}".format(sys.version)) logging.info("ComfyUI version: {}".format(comfyui_version.__version__)) event_loop, _, start_all_func = start_comfyui() From 9ee6ca99d88d77678e7306dab2f1f0f092d8ed43 Mon Sep 17 00:00:00 2001 From: JNP <50867151+bebebe666@users.noreply.github.com> Date: Sun, 13 Apr 2025 08:33:36 +0800 Subject: [PATCH 298/478] add_optimalsteps (#7584) Co-authored-by: bebebe666 --- comfy_extras/nodes_optimalsteps.py | 56 ++++++++++++++++++++++++++++++ nodes.py | 1 + 2 files changed, 57 insertions(+) create mode 100644 comfy_extras/nodes_optimalsteps.py diff --git a/comfy_extras/nodes_optimalsteps.py b/comfy_extras/nodes_optimalsteps.py new file mode 100644 index 000000000..f6928199b --- /dev/null +++ b/comfy_extras/nodes_optimalsteps.py @@ -0,0 +1,56 @@ +# from https://github.com/bebebe666/OptimalSteps + + +import numpy as np +import torch + +def loglinear_interp(t_steps, num_steps): + """ + Performs log-linear interpolation of a given array of decreasing numbers. + """ + xs = np.linspace(0, 1, len(t_steps)) + ys = np.log(t_steps[::-1]) + + new_xs = np.linspace(0, 1, num_steps) + new_ys = np.interp(new_xs, xs, ys) + + interped_ys = np.exp(new_ys)[::-1].copy() + return interped_ys + + +NOISE_LEVELS = {"FLUX": [0.9968, 0.9886, 0.9819, 0.975, 0.966, 0.9471, 0.9158, 0.8287, 0.5512, 0.2808, 0.001], +"Wan":[1.0, 0.997, 0.995, 0.993, 0.991, 0.989, 0.987, 0.985, 0.98, 0.975, 0.973, 0.968, 0.96, 0.946, 0.927, 0.902, 0.864, 0.776, 0.539, 0.208, 0.001], +} + +class OptimalStepsScheduler: + @classmethod + def INPUT_TYPES(s): + return {"required": + {"model_type": (["FLUX", "Wan"], ), + "steps": ("INT", {"default": 20, "min": 3, "max": 1000}), + "denoise": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}), + } + } + RETURN_TYPES = ("SIGMAS",) + CATEGORY = "sampling/custom_sampling/schedulers" + + FUNCTION = "get_sigmas" + + def get_sigmas(self, model_type, steps, denoise): + total_steps = steps + if denoise < 1.0: + if denoise <= 0.0: + return (torch.FloatTensor([]),) + total_steps = round(steps * denoise) + + sigmas = NOISE_LEVELS[model_type][:] + if (steps + 1) != len(sigmas): + sigmas = loglinear_interp(sigmas, steps + 1) + + sigmas = sigmas[-(total_steps + 1):] + sigmas[-1] = 0 + return (torch.FloatTensor(sigmas), ) + +NODE_CLASS_MAPPINGS = { + "OptimalStepsScheduler": OptimalStepsScheduler, +} diff --git a/nodes.py b/nodes.py index e2893e83a..e66b5c714 100644 --- a/nodes.py +++ b/nodes.py @@ -2280,6 +2280,7 @@ def init_builtin_extra_nodes(): "nodes_hunyuan3d.py", "nodes_primitive.py", "nodes_cfg.py", + "nodes_optimalsteps.py" ] import_failed = [] From a14c2fc3565277dfe8ab0ecb22a86c1d0a1f72cf Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 13 Apr 2025 12:21:12 -0700 Subject: [PATCH 299/478] ComfyUI version v0.3.28 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 705622529..a44538d1a 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.27" +__version__ = "0.3.28" diff --git a/pyproject.toml b/pyproject.toml index db9e776cd..6eb1704db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.27" +version = "0.3.28" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 8a438115fb9e3ed8327de25b23d341dccde229d9 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 14 Apr 2025 18:00:33 -0400 Subject: [PATCH 300/478] add RMSNorm to comfy.ops --- comfy/ldm/common_dit.py | 20 ++----------- comfy/ops.py | 20 +++++++++++++ comfy/rmsnorm.py | 65 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 17 deletions(-) create mode 100644 comfy/rmsnorm.py diff --git a/comfy/ldm/common_dit.py b/comfy/ldm/common_dit.py index e0f3057f7..f7f56b72c 100644 --- a/comfy/ldm/common_dit.py +++ b/comfy/ldm/common_dit.py @@ -1,5 +1,6 @@ import torch -import comfy.ops +import comfy.rmsnorm + def pad_to_patch_size(img, patch_size=(2, 2), padding_mode="circular"): if padding_mode == "circular" and (torch.jit.is_tracing() or torch.jit.is_scripting()): @@ -11,20 +12,5 @@ def pad_to_patch_size(img, patch_size=(2, 2), padding_mode="circular"): return torch.nn.functional.pad(img, pad, mode=padding_mode) -try: - rms_norm_torch = torch.nn.functional.rms_norm -except: - rms_norm_torch = None -def rms_norm(x, weight=None, eps=1e-6): - if rms_norm_torch is not None and not (torch.jit.is_tracing() or torch.jit.is_scripting()): - if weight is None: - return rms_norm_torch(x, (x.shape[-1],), eps=eps) - else: - return rms_norm_torch(x, weight.shape, weight=comfy.ops.cast_to(weight, dtype=x.dtype, device=x.device), eps=eps) - else: - r = x * torch.rsqrt(torch.mean(x**2, dim=-1, keepdim=True) + eps) - if weight is None: - return r - else: - return r * comfy.ops.cast_to(weight, dtype=x.dtype, device=x.device) +rms_norm = comfy.rmsnorm.rms_norm diff --git a/comfy/ops.py b/comfy/ops.py index 9a5c1ee99..6b0e29307 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -21,6 +21,7 @@ import logging import comfy.model_management from comfy.cli_args import args, PerformanceFeature import comfy.float +import comfy.rmsnorm cast_to = comfy.model_management.cast_to #TODO: remove once no more references @@ -146,6 +147,25 @@ class disable_weight_init: else: return super().forward(*args, **kwargs) + class RMSNorm(comfy.rmsnorm.RMSNorm, CastWeightBiasOp): + def reset_parameters(self): + self.bias = None + return None + + def forward_comfy_cast_weights(self, input): + if self.weight is not None: + weight, bias = cast_bias_weight(self, input) + else: + weight = None + return comfy.rmsnorm.rms_norm(input, weight, self.eps) # TODO: switch to commented out line when old torch is deprecated + # return torch.nn.functional.rms_norm(input, self.normalized_shape, weight, self.eps) + + def forward(self, *args, **kwargs): + if self.comfy_cast_weights or len(self.weight_function) > 0 or len(self.bias_function) > 0: + return self.forward_comfy_cast_weights(*args, **kwargs) + else: + return super().forward(*args, **kwargs) + class ConvTranspose2d(torch.nn.ConvTranspose2d, CastWeightBiasOp): def reset_parameters(self): return None diff --git a/comfy/rmsnorm.py b/comfy/rmsnorm.py new file mode 100644 index 000000000..81b3e9062 --- /dev/null +++ b/comfy/rmsnorm.py @@ -0,0 +1,65 @@ +import torch +import comfy.model_management +import numbers + +RMSNorm = None + +try: + rms_norm_torch = torch.nn.functional.rms_norm + RMSNorm = torch.nn.RMSNorm +except: + rms_norm_torch = None + + +def rms_norm(x, weight=None, eps=1e-6): + if rms_norm_torch is not None and not (torch.jit.is_tracing() or torch.jit.is_scripting()): + if weight is None: + return rms_norm_torch(x, (x.shape[-1],), eps=eps) + else: + return rms_norm_torch(x, weight.shape, weight=comfy.model_management.cast_to(weight, dtype=x.dtype, device=x.device), eps=eps) + else: + r = x * torch.rsqrt(torch.mean(x**2, dim=-1, keepdim=True) + eps) + if weight is None: + return r + else: + return r * comfy.model_management.cast_to(weight, dtype=x.dtype, device=x.device) + + +if RMSNorm is None: + class RMSNorm(torch.nn.Module): + def __init__( + self, dim: int, elementwise_affine: bool = False, eps: float = 1e-6, device=None, dtype=None, **kwargs + ): + super().__init__() + self.eps = eps + self.learnable_scale = elementwise_affine + if self.learnable_scale: + self.weight = torch.nn.Parameter(torch.empty(dim, device=device, dtype=dtype)) + else: + self.register_parameter("weight", None) + + def __init__( + self, + normalized_shape, + eps=None, + elementwise_affine=True, + device=None, + dtype=None, + ): + factory_kwargs = {"device": device, "dtype": dtype} + super().__init__() + if isinstance(normalized_shape, numbers.Integral): + # mypy error: incompatible types in assignment + normalized_shape = (normalized_shape,) # type: ignore[assignment] + self.normalized_shape = tuple(normalized_shape) # type: ignore[arg-type] + self.eps = eps + self.elementwise_affine = elementwise_affine + if self.elementwise_affine: + self.weight = torch.nn.Parameter( + torch.empty(self.normalized_shape, **factory_kwargs) + ) + else: + self.register_parameter("weight", None) + + def forward(self, x): + return rms_norm(x, self.weight, self.eps) From 3e8155f7a3d7601838bbc82a8ccf550343bbb132 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 15 Apr 2025 10:32:21 -0400 Subject: [PATCH 301/478] More flexible long clip support. Add clip g long clip support. Text encoder refactor. Support llama models with different vocab sizes. --- comfy/sd1_clip.py | 23 ++++++++++++++--- comfy/sdxl_clip.py | 14 +++++------ comfy/text_encoders/aura_t5.py | 2 +- comfy/text_encoders/cosmos.py | 2 +- comfy/text_encoders/flux.py | 10 +++----- comfy/text_encoders/genmo.py | 2 +- comfy/text_encoders/hunyuan_video.py | 22 ++++++++++------- comfy/text_encoders/hydit.py | 8 +++--- comfy/text_encoders/llama.py | 14 ++++++++++- comfy/text_encoders/long_clipl.py | 37 ++++++++++++++-------------- comfy/text_encoders/lt.py | 2 +- comfy/text_encoders/lumina2.py | 2 +- comfy/text_encoders/pixart_t5.py | 2 +- comfy/text_encoders/sa_t5.py | 2 +- comfy/text_encoders/sd2_clip.py | 2 +- comfy/text_encoders/sd3_clip.py | 15 ++++++----- comfy/text_encoders/wan.py | 2 +- 17 files changed, 95 insertions(+), 66 deletions(-) diff --git a/comfy/sd1_clip.py b/comfy/sd1_clip.py index be21ec18d..2ca5ed9ba 100644 --- a/comfy/sd1_clip.py +++ b/comfy/sd1_clip.py @@ -82,7 +82,8 @@ class SDClipModel(torch.nn.Module, ClipTokenWeightEncoder): LAYERS = [ "last", "pooled", - "hidden" + "hidden", + "all" ] def __init__(self, device="cpu", max_length=77, freeze=True, layer="last", layer_idx=None, textmodel_json_config=None, dtype=None, model_class=comfy.clip_model.CLIPTextModel, @@ -93,6 +94,8 @@ class SDClipModel(torch.nn.Module, ClipTokenWeightEncoder): if textmodel_json_config is None: textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "sd1_clip_config.json") + if "model_name" not in model_options: + model_options = {**model_options, "model_name": "clip_l"} if isinstance(textmodel_json_config, dict): config = textmodel_json_config @@ -100,6 +103,10 @@ class SDClipModel(torch.nn.Module, ClipTokenWeightEncoder): with open(textmodel_json_config) as f: config = json.load(f) + te_model_options = model_options.get("{}_model_config".format(model_options.get("model_name", "")), {}) + for k, v in te_model_options.items(): + config[k] = v + operations = model_options.get("custom_operations", None) scaled_fp8 = None @@ -147,7 +154,9 @@ class SDClipModel(torch.nn.Module, ClipTokenWeightEncoder): def set_clip_options(self, options): layer_idx = options.get("layer", self.layer_idx) self.return_projected_pooled = options.get("projected_pooled", self.return_projected_pooled) - if layer_idx is None or abs(layer_idx) > self.num_layers: + if self.layer == "all": + pass + elif layer_idx is None or abs(layer_idx) > self.num_layers: self.layer = "last" else: self.layer = "hidden" @@ -244,7 +253,12 @@ class SDClipModel(torch.nn.Module, ClipTokenWeightEncoder): if self.enable_attention_masks: attention_mask_model = attention_mask - outputs = self.transformer(None, attention_mask_model, embeds=embeds, num_tokens=num_tokens, intermediate_output=self.layer_idx, final_layer_norm_intermediate=self.layer_norm_hidden_state, dtype=torch.float32) + if self.layer == "all": + intermediate_output = "all" + else: + intermediate_output = self.layer_idx + + outputs = self.transformer(None, attention_mask_model, embeds=embeds, num_tokens=num_tokens, intermediate_output=intermediate_output, final_layer_norm_intermediate=self.layer_norm_hidden_state, dtype=torch.float32) if self.layer == "last": z = outputs[0].float() @@ -447,7 +461,7 @@ class SDTokenizer: if tokenizer_path is None: tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "sd1_tokenizer") self.tokenizer = tokenizer_class.from_pretrained(tokenizer_path, **tokenizer_args) - self.max_length = max_length + self.max_length = tokenizer_data.get("{}_max_length".format(embedding_key), max_length) self.min_length = min_length self.end_token = None @@ -645,6 +659,7 @@ class SD1ClipModel(torch.nn.Module): self.clip = "clip_{}".format(self.clip_name) clip_model = model_options.get("{}_class".format(self.clip), clip_model) + model_options = {**model_options, "model_name": self.clip} setattr(self, self.clip, clip_model(device=device, dtype=dtype, model_options=model_options, **kwargs)) self.dtypes = set() diff --git a/comfy/sdxl_clip.py b/comfy/sdxl_clip.py index 5b7c8a412..ea7f5d10f 100644 --- a/comfy/sdxl_clip.py +++ b/comfy/sdxl_clip.py @@ -9,6 +9,7 @@ class SDXLClipG(sd1_clip.SDClipModel): layer_idx=-2 textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_config_bigg.json") + model_options = {**model_options, "model_name": "clip_g"} super().__init__(device=device, freeze=freeze, layer=layer, layer_idx=layer_idx, textmodel_json_config=textmodel_json_config, dtype=dtype, special_tokens={"start": 49406, "end": 49407, "pad": 0}, layer_norm_hidden_state=False, return_projected_pooled=True, model_options=model_options) @@ -17,14 +18,13 @@ class SDXLClipG(sd1_clip.SDClipModel): class SDXLClipGTokenizer(sd1_clip.SDTokenizer): def __init__(self, tokenizer_path=None, embedding_directory=None, tokenizer_data={}): - super().__init__(tokenizer_path, pad_with_end=False, embedding_directory=embedding_directory, embedding_size=1280, embedding_key='clip_g') + super().__init__(tokenizer_path, pad_with_end=False, embedding_directory=embedding_directory, embedding_size=1280, embedding_key='clip_g', tokenizer_data=tokenizer_data) class SDXLTokenizer: def __init__(self, embedding_directory=None, tokenizer_data={}): - clip_l_tokenizer_class = tokenizer_data.get("clip_l_tokenizer_class", sd1_clip.SDTokenizer) - self.clip_l = clip_l_tokenizer_class(embedding_directory=embedding_directory) - self.clip_g = SDXLClipGTokenizer(embedding_directory=embedding_directory) + self.clip_l = sd1_clip.SDTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) + self.clip_g = SDXLClipGTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} @@ -41,8 +41,7 @@ class SDXLTokenizer: class SDXLClipModel(torch.nn.Module): def __init__(self, device="cpu", dtype=None, model_options={}): super().__init__() - clip_l_class = model_options.get("clip_l_class", sd1_clip.SDClipModel) - self.clip_l = clip_l_class(layer="hidden", layer_idx=-2, device=device, dtype=dtype, layer_norm_hidden_state=False, model_options=model_options) + self.clip_l = sd1_clip.SDClipModel(layer="hidden", layer_idx=-2, device=device, dtype=dtype, layer_norm_hidden_state=False, model_options=model_options) self.clip_g = SDXLClipG(device=device, dtype=dtype, model_options=model_options) self.dtypes = set([dtype]) @@ -75,7 +74,7 @@ class SDXLRefinerClipModel(sd1_clip.SD1ClipModel): class StableCascadeClipGTokenizer(sd1_clip.SDTokenizer): def __init__(self, tokenizer_path=None, embedding_directory=None, tokenizer_data={}): - super().__init__(tokenizer_path, pad_with_end=True, embedding_directory=embedding_directory, embedding_size=1280, embedding_key='clip_g') + super().__init__(tokenizer_path, pad_with_end=True, embedding_directory=embedding_directory, embedding_size=1280, embedding_key='clip_g', tokenizer_data=tokenizer_data) class StableCascadeTokenizer(sd1_clip.SD1Tokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): @@ -84,6 +83,7 @@ class StableCascadeTokenizer(sd1_clip.SD1Tokenizer): class StableCascadeClipG(sd1_clip.SDClipModel): def __init__(self, device="cpu", max_length=77, freeze=True, layer="hidden", layer_idx=-1, dtype=None, model_options={}): textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "clip_config_bigg.json") + model_options = {**model_options, "model_name": "clip_g"} super().__init__(device=device, freeze=freeze, layer=layer, layer_idx=layer_idx, textmodel_json_config=textmodel_json_config, dtype=dtype, special_tokens={"start": 49406, "end": 49407, "pad": 49407}, layer_norm_hidden_state=False, enable_attention_masks=True, return_projected_pooled=True, model_options=model_options) diff --git a/comfy/text_encoders/aura_t5.py b/comfy/text_encoders/aura_t5.py index e9ad45a7f..cf4252eea 100644 --- a/comfy/text_encoders/aura_t5.py +++ b/comfy/text_encoders/aura_t5.py @@ -11,7 +11,7 @@ class PT5XlModel(sd1_clip.SDClipModel): class PT5XlTokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): tokenizer_path = os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_pile_tokenizer"), "tokenizer.model") - super().__init__(tokenizer_path, pad_with_end=False, embedding_size=2048, embedding_key='pile_t5xl', tokenizer_class=SPieceTokenizer, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=256, pad_token=1) + super().__init__(tokenizer_path, pad_with_end=False, embedding_size=2048, embedding_key='pile_t5xl', tokenizer_class=SPieceTokenizer, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=256, pad_token=1, tokenizer_data=tokenizer_data) class AuraT5Tokenizer(sd1_clip.SD1Tokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): diff --git a/comfy/text_encoders/cosmos.py b/comfy/text_encoders/cosmos.py index 5441c8952..a1adb5242 100644 --- a/comfy/text_encoders/cosmos.py +++ b/comfy/text_encoders/cosmos.py @@ -22,7 +22,7 @@ class CosmosT5XXL(sd1_clip.SD1ClipModel): class T5XXLTokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_tokenizer") - super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=1024, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=512) + super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=1024, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=512, tokenizer_data=tokenizer_data) class CosmosT5Tokenizer(sd1_clip.SD1Tokenizer): diff --git a/comfy/text_encoders/flux.py b/comfy/text_encoders/flux.py index a12995ec0..0666dde7f 100644 --- a/comfy/text_encoders/flux.py +++ b/comfy/text_encoders/flux.py @@ -9,14 +9,13 @@ import os class T5XXLTokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_tokenizer") - super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=256) + super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=256, tokenizer_data=tokenizer_data) class FluxTokenizer: def __init__(self, embedding_directory=None, tokenizer_data={}): - clip_l_tokenizer_class = tokenizer_data.get("clip_l_tokenizer_class", sd1_clip.SDTokenizer) - self.clip_l = clip_l_tokenizer_class(embedding_directory=embedding_directory) - self.t5xxl = T5XXLTokenizer(embedding_directory=embedding_directory) + self.clip_l = sd1_clip.SDTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) + self.t5xxl = T5XXLTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} @@ -35,8 +34,7 @@ class FluxClipModel(torch.nn.Module): def __init__(self, dtype_t5=None, device="cpu", dtype=None, model_options={}): super().__init__() dtype_t5 = comfy.model_management.pick_weight_dtype(dtype_t5, dtype, device) - clip_l_class = model_options.get("clip_l_class", sd1_clip.SDClipModel) - self.clip_l = clip_l_class(device=device, dtype=dtype, return_projected_pooled=False, model_options=model_options) + self.clip_l = sd1_clip.SDClipModel(device=device, dtype=dtype, return_projected_pooled=False, model_options=model_options) self.t5xxl = comfy.text_encoders.sd3_clip.T5XXLModel(device=device, dtype=dtype_t5, model_options=model_options) self.dtypes = set([dtype, dtype_t5]) diff --git a/comfy/text_encoders/genmo.py b/comfy/text_encoders/genmo.py index 45987a480..9dcf190a2 100644 --- a/comfy/text_encoders/genmo.py +++ b/comfy/text_encoders/genmo.py @@ -18,7 +18,7 @@ class MochiT5XXL(sd1_clip.SD1ClipModel): class T5XXLTokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_tokenizer") - super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=256) + super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=256, tokenizer_data=tokenizer_data) class MochiT5Tokenizer(sd1_clip.SD1Tokenizer): diff --git a/comfy/text_encoders/hunyuan_video.py b/comfy/text_encoders/hunyuan_video.py index dbb259e54..33ac22497 100644 --- a/comfy/text_encoders/hunyuan_video.py +++ b/comfy/text_encoders/hunyuan_video.py @@ -21,26 +21,31 @@ def llama_detect(state_dict, prefix=""): class LLAMA3Tokenizer(sd1_clip.SDTokenizer): - def __init__(self, embedding_directory=None, tokenizer_data={}, min_length=256): + def __init__(self, embedding_directory=None, tokenizer_data={}, min_length=256, pad_token=128258): tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "llama_tokenizer") - super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='llama', tokenizer_class=LlamaTokenizerFast, has_start_token=True, has_end_token=False, pad_to_max_length=False, max_length=99999999, pad_token=128258, min_length=min_length) + super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='llama', tokenizer_class=LlamaTokenizerFast, has_start_token=True, has_end_token=False, pad_to_max_length=False, max_length=99999999, pad_token=pad_token, min_length=min_length, tokenizer_data=tokenizer_data) class LLAMAModel(sd1_clip.SDClipModel): - def __init__(self, device="cpu", layer="hidden", layer_idx=-3, dtype=None, attention_mask=True, model_options={}): + def __init__(self, device="cpu", layer="hidden", layer_idx=-3, dtype=None, attention_mask=True, model_options={}, special_tokens={"start": 128000, "pad": 128258}): llama_scaled_fp8 = model_options.get("llama_scaled_fp8", None) if llama_scaled_fp8 is not None: model_options = model_options.copy() model_options["scaled_fp8"] = llama_scaled_fp8 - super().__init__(device=device, layer=layer, layer_idx=layer_idx, textmodel_json_config={}, dtype=dtype, special_tokens={"start": 128000, "pad": 128258}, layer_norm_hidden_state=False, model_class=comfy.text_encoders.llama.Llama2, enable_attention_masks=attention_mask, return_attention_masks=attention_mask, model_options=model_options) + textmodel_json_config = {} + vocab_size = model_options.get("vocab_size", None) + if vocab_size is not None: + textmodel_json_config["vocab_size"] = vocab_size + + model_options = {**model_options, "model_name": "llama"} + super().__init__(device=device, layer=layer, layer_idx=layer_idx, textmodel_json_config=textmodel_json_config, dtype=dtype, special_tokens=special_tokens, layer_norm_hidden_state=False, model_class=comfy.text_encoders.llama.Llama2, enable_attention_masks=attention_mask, return_attention_masks=attention_mask, model_options=model_options) class HunyuanVideoTokenizer: def __init__(self, embedding_directory=None, tokenizer_data={}): - clip_l_tokenizer_class = tokenizer_data.get("clip_l_tokenizer_class", sd1_clip.SDTokenizer) - self.clip_l = clip_l_tokenizer_class(embedding_directory=embedding_directory) + self.clip_l = sd1_clip.SDTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) self.llama_template = """<|start_header_id|>system<|end_header_id|>\n\nDescribe the video by detailing the following aspects: 1. The main content and theme of the video.2. The color, shape, size, texture, quantity, text, and spatial relationships of the objects.3. Actions, events, behaviors temporal relationships, physical movement changes of the objects.4. background environment, light, style and atmosphere.5. camera angles, movements, and transitions used in the video:<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n{}<|eot_id|>""" # 95 tokens - self.llama = LLAMA3Tokenizer(embedding_directory=embedding_directory, min_length=1) + self.llama = LLAMA3Tokenizer(embedding_directory=embedding_directory, min_length=1, tokenizer_data=tokenizer_data) def tokenize_with_weights(self, text, return_word_ids=False, llama_template=None, image_embeds=None, image_interleave=1, **kwargs): out = {} @@ -72,8 +77,7 @@ class HunyuanVideoClipModel(torch.nn.Module): def __init__(self, dtype_llama=None, device="cpu", dtype=None, model_options={}): super().__init__() dtype_llama = comfy.model_management.pick_weight_dtype(dtype_llama, dtype, device) - clip_l_class = model_options.get("clip_l_class", sd1_clip.SDClipModel) - self.clip_l = clip_l_class(device=device, dtype=dtype, return_projected_pooled=False, model_options=model_options) + self.clip_l = sd1_clip.SDClipModel(device=device, dtype=dtype, return_projected_pooled=False, model_options=model_options) self.llama = LLAMAModel(device=device, dtype=dtype_llama, model_options=model_options) self.dtypes = set([dtype, dtype_llama]) diff --git a/comfy/text_encoders/hydit.py b/comfy/text_encoders/hydit.py index 7da3e9fc5..e7273f425 100644 --- a/comfy/text_encoders/hydit.py +++ b/comfy/text_encoders/hydit.py @@ -9,24 +9,26 @@ import torch class HyditBertModel(sd1_clip.SDClipModel): def __init__(self, device="cpu", layer="last", layer_idx=None, dtype=None, model_options={}): textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "hydit_clip.json") + model_options = {**model_options, "model_name": "hydit_clip"} super().__init__(device=device, layer=layer, layer_idx=layer_idx, textmodel_json_config=textmodel_json_config, dtype=dtype, special_tokens={"start": 101, "end": 102, "pad": 0}, model_class=BertModel, enable_attention_masks=True, return_attention_masks=True, model_options=model_options) class HyditBertTokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "hydit_clip_tokenizer") - super().__init__(tokenizer_path, pad_with_end=False, embedding_size=1024, embedding_key='chinese_roberta', tokenizer_class=BertTokenizer, pad_to_max_length=False, max_length=512, min_length=77) + super().__init__(tokenizer_path, pad_with_end=False, embedding_size=1024, embedding_key='chinese_roberta', tokenizer_class=BertTokenizer, pad_to_max_length=False, max_length=512, min_length=77, tokenizer_data=tokenizer_data) class MT5XLModel(sd1_clip.SDClipModel): def __init__(self, device="cpu", layer="last", layer_idx=None, dtype=None, model_options={}): textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "mt5_config_xl.json") + model_options = {**model_options, "model_name": "mt5xl"} super().__init__(device=device, layer=layer, layer_idx=layer_idx, textmodel_json_config=textmodel_json_config, dtype=dtype, special_tokens={"end": 1, "pad": 0}, model_class=comfy.text_encoders.t5.T5, enable_attention_masks=True, return_attention_masks=True, model_options=model_options) class MT5XLTokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): #tokenizer_path = os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "mt5_tokenizer"), "spiece.model") tokenizer = tokenizer_data.get("spiece_model", None) - super().__init__(tokenizer, pad_with_end=False, embedding_size=2048, embedding_key='mt5xl', tokenizer_class=SPieceTokenizer, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=256) + super().__init__(tokenizer, pad_with_end=False, embedding_size=2048, embedding_key='mt5xl', tokenizer_class=SPieceTokenizer, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=256, tokenizer_data=tokenizer_data) def state_dict(self): return {"spiece_model": self.tokenizer.serialize_model()} @@ -35,7 +37,7 @@ class HyditTokenizer: def __init__(self, embedding_directory=None, tokenizer_data={}): mt5_tokenizer_data = tokenizer_data.get("mt5xl.spiece_model", None) self.hydit_clip = HyditBertTokenizer(embedding_directory=embedding_directory) - self.mt5xl = MT5XLTokenizer(tokenizer_data={"spiece_model": mt5_tokenizer_data}, embedding_directory=embedding_directory) + self.mt5xl = MT5XLTokenizer(tokenizer_data={**tokenizer_data, "spiece_model": mt5_tokenizer_data}, embedding_directory=embedding_directory) def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} diff --git a/comfy/text_encoders/llama.py b/comfy/text_encoders/llama.py index 58710b2bf..34eb870e3 100644 --- a/comfy/text_encoders/llama.py +++ b/comfy/text_encoders/llama.py @@ -268,11 +268,17 @@ class Llama2_(nn.Module): optimized_attention = optimized_attention_for_device(x.device, mask=mask is not None, small_input=True) intermediate = None + all_intermediate = None if intermediate_output is not None: - if intermediate_output < 0: + if intermediate_output == "all": + all_intermediate = [] + intermediate_output = None + elif intermediate_output < 0: intermediate_output = len(self.layers) + intermediate_output for i, layer in enumerate(self.layers): + if all_intermediate is not None: + all_intermediate.append(x.unsqueeze(1).clone()) x = layer( x=x, attention_mask=mask, @@ -283,6 +289,12 @@ class Llama2_(nn.Module): intermediate = x.clone() x = self.norm(x) + if all_intermediate is not None: + all_intermediate.append(x.unsqueeze(1).clone()) + + if all_intermediate is not None: + intermediate = torch.cat(all_intermediate, dim=1) + if intermediate is not None and final_layer_norm_intermediate: intermediate = self.norm(intermediate) diff --git a/comfy/text_encoders/long_clipl.py b/comfy/text_encoders/long_clipl.py index b81912cb3..f9483b427 100644 --- a/comfy/text_encoders/long_clipl.py +++ b/comfy/text_encoders/long_clipl.py @@ -1,30 +1,29 @@ from comfy import sd1_clip import os -class LongClipTokenizer_(sd1_clip.SDTokenizer): - def __init__(self, embedding_directory=None, tokenizer_data={}): - super().__init__(max_length=248, embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) - -class LongClipModel_(sd1_clip.SDClipModel): - def __init__(self, *args, **kwargs): - textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "long_clipl.json") - super().__init__(*args, textmodel_json_config=textmodel_json_config, **kwargs) - -class LongClipTokenizer(sd1_clip.SD1Tokenizer): - def __init__(self, embedding_directory=None, tokenizer_data={}): - super().__init__(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data, tokenizer=LongClipTokenizer_) - -class LongClipModel(sd1_clip.SD1ClipModel): - def __init__(self, device="cpu", dtype=None, model_options={}, **kwargs): - super().__init__(device=device, dtype=dtype, model_options=model_options, clip_model=LongClipModel_, **kwargs) def model_options_long_clip(sd, tokenizer_data, model_options): w = sd.get("clip_l.text_model.embeddings.position_embedding.weight", None) + if w is None: + w = sd.get("clip_g.text_model.embeddings.position_embedding.weight", None) + else: + model_name = "clip_g" + if w is None: w = sd.get("text_model.embeddings.position_embedding.weight", None) - if w is not None and w.shape[0] == 248: + if w is not None: + if "text_model.encoder.layers.30.mlp.fc1.weight" in sd: + model_name = "clip_g" + elif "text_model.encoder.layers.1.mlp.fc1.weight" in sd: + model_name = "clip_l" + else: + model_name = "clip_l" + + if w is not None: tokenizer_data = tokenizer_data.copy() model_options = model_options.copy() - tokenizer_data["clip_l_tokenizer_class"] = LongClipTokenizer_ - model_options["clip_l_class"] = LongClipModel_ + model_config = model_options.get("model_config", {}) + model_config["max_position_embeddings"] = w.shape[0] + model_options["{}_model_config".format(model_name)] = model_config + tokenizer_data["{}_max_length".format(model_name)] = w.shape[0] return tokenizer_data, model_options diff --git a/comfy/text_encoders/lt.py b/comfy/text_encoders/lt.py index 5c2ce583f..48ea67e67 100644 --- a/comfy/text_encoders/lt.py +++ b/comfy/text_encoders/lt.py @@ -6,7 +6,7 @@ import comfy.text_encoders.genmo class T5XXLTokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_tokenizer") - super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=128) #pad to 128? + super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=128, tokenizer_data=tokenizer_data) #pad to 128? class LTXVT5Tokenizer(sd1_clip.SD1Tokenizer): diff --git a/comfy/text_encoders/lumina2.py b/comfy/text_encoders/lumina2.py index a7b1d702b..674461b75 100644 --- a/comfy/text_encoders/lumina2.py +++ b/comfy/text_encoders/lumina2.py @@ -6,7 +6,7 @@ import comfy.text_encoders.llama class Gemma2BTokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): tokenizer = tokenizer_data.get("spiece_model", None) - super().__init__(tokenizer, pad_with_end=False, embedding_size=2304, embedding_key='gemma2_2b', tokenizer_class=SPieceTokenizer, has_end_token=False, pad_to_max_length=False, max_length=99999999, min_length=1, tokenizer_args={"add_bos": True, "add_eos": False}) + super().__init__(tokenizer, pad_with_end=False, embedding_size=2304, embedding_key='gemma2_2b', tokenizer_class=SPieceTokenizer, has_end_token=False, pad_to_max_length=False, max_length=99999999, min_length=1, tokenizer_args={"add_bos": True, "add_eos": False}, tokenizer_data=tokenizer_data) def state_dict(self): return {"spiece_model": self.tokenizer.serialize_model()} diff --git a/comfy/text_encoders/pixart_t5.py b/comfy/text_encoders/pixart_t5.py index d56d57f1b..b8de6bc4e 100644 --- a/comfy/text_encoders/pixart_t5.py +++ b/comfy/text_encoders/pixart_t5.py @@ -24,7 +24,7 @@ class PixArtT5XXL(sd1_clip.SD1ClipModel): class T5XXLTokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_tokenizer") - super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=1) # no padding + super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=1, tokenizer_data=tokenizer_data) # no padding class PixArtTokenizer(sd1_clip.SD1Tokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): diff --git a/comfy/text_encoders/sa_t5.py b/comfy/text_encoders/sa_t5.py index 7778ce47a..2803926ac 100644 --- a/comfy/text_encoders/sa_t5.py +++ b/comfy/text_encoders/sa_t5.py @@ -11,7 +11,7 @@ class T5BaseModel(sd1_clip.SDClipModel): class T5BaseTokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_tokenizer") - super().__init__(tokenizer_path, pad_with_end=False, embedding_size=768, embedding_key='t5base', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=128) + super().__init__(tokenizer_path, pad_with_end=False, embedding_size=768, embedding_key='t5base', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=128, tokenizer_data=tokenizer_data) class SAT5Tokenizer(sd1_clip.SD1Tokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): diff --git a/comfy/text_encoders/sd2_clip.py b/comfy/text_encoders/sd2_clip.py index 31fc89869..700a23bf0 100644 --- a/comfy/text_encoders/sd2_clip.py +++ b/comfy/text_encoders/sd2_clip.py @@ -12,7 +12,7 @@ class SD2ClipHModel(sd1_clip.SDClipModel): class SD2ClipHTokenizer(sd1_clip.SDTokenizer): def __init__(self, tokenizer_path=None, embedding_directory=None, tokenizer_data={}): - super().__init__(tokenizer_path, pad_with_end=False, embedding_directory=embedding_directory, embedding_size=1024) + super().__init__(tokenizer_path, pad_with_end=False, embedding_directory=embedding_directory, embedding_size=1024, embedding_key='clip_h', tokenizer_data=tokenizer_data) class SD2Tokenizer(sd1_clip.SD1Tokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): diff --git a/comfy/text_encoders/sd3_clip.py b/comfy/text_encoders/sd3_clip.py index 3ad2ed93a..1727998a8 100644 --- a/comfy/text_encoders/sd3_clip.py +++ b/comfy/text_encoders/sd3_clip.py @@ -15,6 +15,7 @@ class T5XXLModel(sd1_clip.SDClipModel): model_options = model_options.copy() model_options["scaled_fp8"] = t5xxl_scaled_fp8 + model_options = {**model_options, "model_name": "t5xxl"} super().__init__(device=device, layer=layer, layer_idx=layer_idx, textmodel_json_config=textmodel_json_config, dtype=dtype, special_tokens={"end": 1, "pad": 0}, model_class=comfy.text_encoders.t5.T5, enable_attention_masks=attention_mask, return_attention_masks=attention_mask, model_options=model_options) @@ -31,17 +32,16 @@ def t5_xxl_detect(state_dict, prefix=""): return out class T5XXLTokenizer(sd1_clip.SDTokenizer): - def __init__(self, embedding_directory=None, tokenizer_data={}): + def __init__(self, embedding_directory=None, tokenizer_data={}, min_length=77): tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_tokenizer") - super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=77) + super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=min_length, tokenizer_data=tokenizer_data) class SD3Tokenizer: def __init__(self, embedding_directory=None, tokenizer_data={}): - clip_l_tokenizer_class = tokenizer_data.get("clip_l_tokenizer_class", sd1_clip.SDTokenizer) - self.clip_l = clip_l_tokenizer_class(embedding_directory=embedding_directory) - self.clip_g = sdxl_clip.SDXLClipGTokenizer(embedding_directory=embedding_directory) - self.t5xxl = T5XXLTokenizer(embedding_directory=embedding_directory) + self.clip_l = sd1_clip.SDTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) + self.clip_g = sdxl_clip.SDXLClipGTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) + self.t5xxl = T5XXLTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} @@ -61,8 +61,7 @@ class SD3ClipModel(torch.nn.Module): super().__init__() self.dtypes = set() if clip_l: - clip_l_class = model_options.get("clip_l_class", sd1_clip.SDClipModel) - self.clip_l = clip_l_class(layer="hidden", layer_idx=-2, device=device, dtype=dtype, layer_norm_hidden_state=False, return_projected_pooled=False, model_options=model_options) + self.clip_l = sd1_clip.SDClipModel(layer="hidden", layer_idx=-2, device=device, dtype=dtype, layer_norm_hidden_state=False, return_projected_pooled=False, model_options=model_options) self.dtypes.add(dtype) else: self.clip_l = None diff --git a/comfy/text_encoders/wan.py b/comfy/text_encoders/wan.py index 971ac8fa8..d50fa4b28 100644 --- a/comfy/text_encoders/wan.py +++ b/comfy/text_encoders/wan.py @@ -11,7 +11,7 @@ class UMT5XXlModel(sd1_clip.SDClipModel): class UMT5XXlTokenizer(sd1_clip.SDTokenizer): def __init__(self, embedding_directory=None, tokenizer_data={}): tokenizer = tokenizer_data.get("spiece_model", None) - super().__init__(tokenizer, pad_with_end=False, embedding_size=4096, embedding_key='umt5xxl', tokenizer_class=SPieceTokenizer, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=512, pad_token=0) + super().__init__(tokenizer, pad_with_end=False, embedding_size=4096, embedding_key='umt5xxl', tokenizer_class=SPieceTokenizer, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=512, pad_token=0, tokenizer_data=tokenizer_data) def state_dict(self): return {"spiece_model": self.tokenizer.serialize_model()} From 6fc5dbd52ab70952020e6bc486c4d851a7ba6625 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 15 Apr 2025 12:13:28 -0400 Subject: [PATCH 302/478] Cleanup. --- comfy/rmsnorm.py | 11 ----------- comfy/text_encoders/long_clipl.py | 2 -- 2 files changed, 13 deletions(-) diff --git a/comfy/rmsnorm.py b/comfy/rmsnorm.py index 81b3e9062..77df44464 100644 --- a/comfy/rmsnorm.py +++ b/comfy/rmsnorm.py @@ -27,17 +27,6 @@ def rms_norm(x, weight=None, eps=1e-6): if RMSNorm is None: class RMSNorm(torch.nn.Module): - def __init__( - self, dim: int, elementwise_affine: bool = False, eps: float = 1e-6, device=None, dtype=None, **kwargs - ): - super().__init__() - self.eps = eps - self.learnable_scale = elementwise_affine - if self.learnable_scale: - self.weight = torch.nn.Parameter(torch.empty(dim, device=device, dtype=dtype)) - else: - self.register_parameter("weight", None) - def __init__( self, normalized_shape, diff --git a/comfy/text_encoders/long_clipl.py b/comfy/text_encoders/long_clipl.py index f9483b427..8d4c7619d 100644 --- a/comfy/text_encoders/long_clipl.py +++ b/comfy/text_encoders/long_clipl.py @@ -1,5 +1,3 @@ -from comfy import sd1_clip -import os def model_options_long_clip(sd, tokenizer_data, model_options): From 9ad792f92706e2179c58b2e5348164acafa69288 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 15 Apr 2025 17:35:05 -0400 Subject: [PATCH 303/478] Basic support for hidream i1 model. --- comfy/ldm/hidream/model.py | 828 +++++++++++++++++++++++++++++++++ comfy/model_base.py | 18 + comfy/model_detection.py | 19 + comfy/ops.py | 3 + comfy/sd.py | 4 + comfy/supported_models.py | 32 +- comfy/text_encoders/hidream.py | 150 ++++++ comfy_extras/nodes_hidream.py | 32 ++ nodes.py | 3 +- 9 files changed, 1087 insertions(+), 2 deletions(-) create mode 100644 comfy/ldm/hidream/model.py create mode 100644 comfy/text_encoders/hidream.py create mode 100644 comfy_extras/nodes_hidream.py diff --git a/comfy/ldm/hidream/model.py b/comfy/ldm/hidream/model.py new file mode 100644 index 000000000..de749a373 --- /dev/null +++ b/comfy/ldm/hidream/model.py @@ -0,0 +1,828 @@ +from typing import Optional, Tuple, List + +import torch +import torch.nn as nn +import einops +from einops import repeat + +from comfy.ldm.lightricks.model import TimestepEmbedding, Timesteps +import torch.nn.functional as F + +from comfy.ldm.flux.math import apply_rope +from comfy.ldm.modules.attention import optimized_attention +import comfy.model_management + +# Copied from https://github.com/black-forest-labs/flux/blob/main/src/flux/math.py +def rope(pos: torch.Tensor, dim: int, theta: int) -> torch.Tensor: + assert dim % 2 == 0, "The dimension must be even." + + scale = torch.arange(0, dim, 2, dtype=torch.float64, device=pos.device) / dim + omega = 1.0 / (theta**scale) + + batch_size, seq_length = pos.shape + out = torch.einsum("...n,d->...nd", pos, omega) + cos_out = torch.cos(out) + sin_out = torch.sin(out) + + stacked_out = torch.stack([cos_out, -sin_out, sin_out, cos_out], dim=-1) + out = stacked_out.view(batch_size, -1, dim // 2, 2, 2) + return out.float() + + +# Copied from https://github.com/black-forest-labs/flux/blob/main/src/flux/modules/layers.py +class EmbedND(nn.Module): + def __init__(self, theta: int, axes_dim: List[int]): + super().__init__() + self.theta = theta + self.axes_dim = axes_dim + + def forward(self, ids: torch.Tensor) -> torch.Tensor: + n_axes = ids.shape[-1] + emb = torch.cat( + [rope(ids[..., i], self.axes_dim[i], self.theta) for i in range(n_axes)], + dim=-3, + ) + return emb.unsqueeze(2) + + +class PatchEmbed(nn.Module): + def __init__( + self, + patch_size=2, + in_channels=4, + out_channels=1024, + dtype=None, device=None, operations=None + ): + super().__init__() + self.patch_size = patch_size + self.out_channels = out_channels + self.proj = operations.Linear(in_channels * patch_size * patch_size, out_channels, bias=True, dtype=dtype, device=device) + + def forward(self, latent): + latent = self.proj(latent) + return latent + + +class PooledEmbed(nn.Module): + def __init__(self, text_emb_dim, hidden_size, dtype=None, device=None, operations=None): + super().__init__() + self.pooled_embedder = TimestepEmbedding(in_channels=text_emb_dim, time_embed_dim=hidden_size, dtype=dtype, device=device, operations=operations) + + def forward(self, pooled_embed): + return self.pooled_embedder(pooled_embed) + + +class TimestepEmbed(nn.Module): + def __init__(self, hidden_size, frequency_embedding_size=256, dtype=None, device=None, operations=None): + super().__init__() + self.time_proj = Timesteps(num_channels=frequency_embedding_size, flip_sin_to_cos=True, downscale_freq_shift=0) + self.timestep_embedder = TimestepEmbedding(in_channels=frequency_embedding_size, time_embed_dim=hidden_size, dtype=dtype, device=device, operations=operations) + + def forward(self, timesteps, wdtype): + t_emb = self.time_proj(timesteps).to(dtype=wdtype) + t_emb = self.timestep_embedder(t_emb) + return t_emb + + +class OutEmbed(nn.Module): + def __init__(self, hidden_size, patch_size, out_channels, dtype=None, device=None, operations=None): + super().__init__() + self.norm_final = operations.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6, dtype=dtype, device=device) + self.linear = operations.Linear(hidden_size, patch_size * patch_size * out_channels, bias=True, dtype=dtype, device=device) + self.adaLN_modulation = nn.Sequential( + nn.SiLU(), + operations.Linear(hidden_size, 2 * hidden_size, bias=True, dtype=dtype, device=device) + ) + + def forward(self, x, adaln_input): + shift, scale = self.adaLN_modulation(adaln_input).chunk(2, dim=1) + x = self.norm_final(x) * (1 + scale.unsqueeze(1)) + shift.unsqueeze(1) + x = self.linear(x) + return x + + +def attention(query: torch.Tensor, key: torch.Tensor, value: torch.Tensor): + return optimized_attention(query.view(query.shape[0], -1, query.shape[-1] * query.shape[-2]), key.view(key.shape[0], -1, key.shape[-1] * key.shape[-2]), value.view(value.shape[0], -1, value.shape[-1] * value.shape[-2]), query.shape[2]) + + +class HiDreamAttnProcessor_flashattn: + """Attention processor used typically in processing the SD3-like self-attention projections.""" + + def __call__( + self, + attn, + image_tokens: torch.FloatTensor, + image_tokens_masks: Optional[torch.FloatTensor] = None, + text_tokens: Optional[torch.FloatTensor] = None, + rope: torch.FloatTensor = None, + *args, + **kwargs, + ) -> torch.FloatTensor: + dtype = image_tokens.dtype + batch_size = image_tokens.shape[0] + + query_i = attn.q_rms_norm(attn.to_q(image_tokens)).to(dtype=dtype) + key_i = attn.k_rms_norm(attn.to_k(image_tokens)).to(dtype=dtype) + value_i = attn.to_v(image_tokens) + + inner_dim = key_i.shape[-1] + head_dim = inner_dim // attn.heads + + query_i = query_i.view(batch_size, -1, attn.heads, head_dim) + key_i = key_i.view(batch_size, -1, attn.heads, head_dim) + value_i = value_i.view(batch_size, -1, attn.heads, head_dim) + if image_tokens_masks is not None: + key_i = key_i * image_tokens_masks.view(batch_size, -1, 1, 1) + + if not attn.single: + query_t = attn.q_rms_norm_t(attn.to_q_t(text_tokens)).to(dtype=dtype) + key_t = attn.k_rms_norm_t(attn.to_k_t(text_tokens)).to(dtype=dtype) + value_t = attn.to_v_t(text_tokens) + + query_t = query_t.view(batch_size, -1, attn.heads, head_dim) + key_t = key_t.view(batch_size, -1, attn.heads, head_dim) + value_t = value_t.view(batch_size, -1, attn.heads, head_dim) + + num_image_tokens = query_i.shape[1] + num_text_tokens = query_t.shape[1] + query = torch.cat([query_i, query_t], dim=1) + key = torch.cat([key_i, key_t], dim=1) + value = torch.cat([value_i, value_t], dim=1) + else: + query = query_i + key = key_i + value = value_i + + if query.shape[-1] == rope.shape[-3] * 2: + query, key = apply_rope(query, key, rope) + else: + query_1, query_2 = query.chunk(2, dim=-1) + key_1, key_2 = key.chunk(2, dim=-1) + query_1, key_1 = apply_rope(query_1, key_1, rope) + query = torch.cat([query_1, query_2], dim=-1) + key = torch.cat([key_1, key_2], dim=-1) + + hidden_states = attention(query, key, value) + + if not attn.single: + hidden_states_i, hidden_states_t = torch.split(hidden_states, [num_image_tokens, num_text_tokens], dim=1) + hidden_states_i = attn.to_out(hidden_states_i) + hidden_states_t = attn.to_out_t(hidden_states_t) + return hidden_states_i, hidden_states_t + else: + hidden_states = attn.to_out(hidden_states) + return hidden_states + +class HiDreamAttention(nn.Module): + def __init__( + self, + query_dim: int, + heads: int = 8, + dim_head: int = 64, + upcast_attention: bool = False, + upcast_softmax: bool = False, + scale_qk: bool = True, + eps: float = 1e-5, + processor = None, + out_dim: int = None, + single: bool = False, + dtype=None, device=None, operations=None + ): + # super(Attention, self).__init__() + super().__init__() + self.inner_dim = out_dim if out_dim is not None else dim_head * heads + self.query_dim = query_dim + self.upcast_attention = upcast_attention + self.upcast_softmax = upcast_softmax + self.out_dim = out_dim if out_dim is not None else query_dim + + self.scale_qk = scale_qk + self.scale = dim_head**-0.5 if self.scale_qk else 1.0 + + self.heads = out_dim // dim_head if out_dim is not None else heads + self.sliceable_head_dim = heads + self.single = single + + linear_cls = operations.Linear + self.linear_cls = linear_cls + self.to_q = linear_cls(query_dim, self.inner_dim, dtype=dtype, device=device) + self.to_k = linear_cls(self.inner_dim, self.inner_dim, dtype=dtype, device=device) + self.to_v = linear_cls(self.inner_dim, self.inner_dim, dtype=dtype, device=device) + self.to_out = linear_cls(self.inner_dim, self.out_dim, dtype=dtype, device=device) + self.q_rms_norm = operations.RMSNorm(self.inner_dim, eps, dtype=dtype, device=device) + self.k_rms_norm = operations.RMSNorm(self.inner_dim, eps, dtype=dtype, device=device) + + if not single: + self.to_q_t = linear_cls(query_dim, self.inner_dim, dtype=dtype, device=device) + self.to_k_t = linear_cls(self.inner_dim, self.inner_dim, dtype=dtype, device=device) + self.to_v_t = linear_cls(self.inner_dim, self.inner_dim, dtype=dtype, device=device) + self.to_out_t = linear_cls(self.inner_dim, self.out_dim, dtype=dtype, device=device) + self.q_rms_norm_t = operations.RMSNorm(self.inner_dim, eps, dtype=dtype, device=device) + self.k_rms_norm_t = operations.RMSNorm(self.inner_dim, eps, dtype=dtype, device=device) + + self.processor = processor + + def forward( + self, + norm_image_tokens: torch.FloatTensor, + image_tokens_masks: torch.FloatTensor = None, + norm_text_tokens: torch.FloatTensor = None, + rope: torch.FloatTensor = None, + ) -> torch.Tensor: + return self.processor( + self, + image_tokens = norm_image_tokens, + image_tokens_masks = image_tokens_masks, + text_tokens = norm_text_tokens, + rope = rope, + ) + + +class FeedForwardSwiGLU(nn.Module): + def __init__( + self, + dim: int, + hidden_dim: int, + multiple_of: int = 256, + ffn_dim_multiplier: Optional[float] = None, + dtype=None, device=None, operations=None + ): + super().__init__() + hidden_dim = int(2 * hidden_dim / 3) + # custom dim factor multiplier + if ffn_dim_multiplier is not None: + hidden_dim = int(ffn_dim_multiplier * hidden_dim) + hidden_dim = multiple_of * ( + (hidden_dim + multiple_of - 1) // multiple_of + ) + + self.w1 = operations.Linear(dim, hidden_dim, bias=False, dtype=dtype, device=device) + self.w2 = operations.Linear(hidden_dim, dim, bias=False, dtype=dtype, device=device) + self.w3 = operations.Linear(dim, hidden_dim, bias=False, dtype=dtype, device=device) + + def forward(self, x): + return self.w2(torch.nn.functional.silu(self.w1(x)) * self.w3(x)) + + +# Modified from https://github.com/deepseek-ai/DeepSeek-V3/blob/main/inference/model.py +class MoEGate(nn.Module): + def __init__(self, embed_dim, num_routed_experts=4, num_activated_experts=2, aux_loss_alpha=0.01, dtype=None, device=None, operations=None): + super().__init__() + self.top_k = num_activated_experts + self.n_routed_experts = num_routed_experts + + self.scoring_func = 'softmax' + self.alpha = aux_loss_alpha + self.seq_aux = False + + # topk selection algorithm + self.norm_topk_prob = False + self.gating_dim = embed_dim + self.weight = nn.Parameter(torch.empty((self.n_routed_experts, self.gating_dim), dtype=dtype, device=device)) + self.reset_parameters() + + def reset_parameters(self) -> None: + pass + # import torch.nn.init as init + # init.kaiming_uniform_(self.weight, a=math.sqrt(5)) + + def forward(self, hidden_states): + bsz, seq_len, h = hidden_states.shape + + ### compute gating score + hidden_states = hidden_states.view(-1, h) + logits = F.linear(hidden_states, comfy.model_management.cast_to(self.weight, dtype=hidden_states.dtype, device=hidden_states.device), None) + if self.scoring_func == 'softmax': + scores = logits.softmax(dim=-1) + else: + raise NotImplementedError(f'insupportable scoring function for MoE gating: {self.scoring_func}') + + ### select top-k experts + topk_weight, topk_idx = torch.topk(scores, k=self.top_k, dim=-1, sorted=False) + + ### norm gate to sum 1 + if self.top_k > 1 and self.norm_topk_prob: + denominator = topk_weight.sum(dim=-1, keepdim=True) + 1e-20 + topk_weight = topk_weight / denominator + + aux_loss = None + return topk_idx, topk_weight, aux_loss + + +# Modified from https://github.com/deepseek-ai/DeepSeek-V3/blob/main/inference/model.py +class MOEFeedForwardSwiGLU(nn.Module): + def __init__( + self, + dim: int, + hidden_dim: int, + num_routed_experts: int, + num_activated_experts: int, + dtype=None, device=None, operations=None + ): + super().__init__() + self.shared_experts = FeedForwardSwiGLU(dim, hidden_dim // 2, dtype=dtype, device=device, operations=operations) + self.experts = nn.ModuleList([FeedForwardSwiGLU(dim, hidden_dim, dtype=dtype, device=device, operations=operations) for i in range(num_routed_experts)]) + self.gate = MoEGate( + embed_dim = dim, + num_routed_experts = num_routed_experts, + num_activated_experts = num_activated_experts, + dtype=dtype, device=device, operations=operations + ) + self.num_activated_experts = num_activated_experts + + def forward(self, x): + wtype = x.dtype + identity = x + orig_shape = x.shape + topk_idx, topk_weight, aux_loss = self.gate(x) + x = x.view(-1, x.shape[-1]) + flat_topk_idx = topk_idx.view(-1) + if True: # self.training: # TODO: check which branch performs faster + x = x.repeat_interleave(self.num_activated_experts, dim=0) + y = torch.empty_like(x, dtype=wtype) + for i, expert in enumerate(self.experts): + y[flat_topk_idx == i] = expert(x[flat_topk_idx == i]).to(dtype=wtype) + y = (y.view(*topk_weight.shape, -1) * topk_weight.unsqueeze(-1)).sum(dim=1) + y = y.view(*orig_shape).to(dtype=wtype) + #y = AddAuxiliaryLoss.apply(y, aux_loss) + else: + y = self.moe_infer(x, flat_topk_idx, topk_weight.view(-1, 1)).view(*orig_shape) + y = y + self.shared_experts(identity) + return y + + @torch.no_grad() + def moe_infer(self, x, flat_expert_indices, flat_expert_weights): + expert_cache = torch.zeros_like(x) + idxs = flat_expert_indices.argsort() + tokens_per_expert = flat_expert_indices.bincount().cpu().numpy().cumsum(0) + token_idxs = idxs // self.num_activated_experts + for i, end_idx in enumerate(tokens_per_expert): + start_idx = 0 if i == 0 else tokens_per_expert[i-1] + if start_idx == end_idx: + continue + expert = self.experts[i] + exp_token_idx = token_idxs[start_idx:end_idx] + expert_tokens = x[exp_token_idx] + expert_out = expert(expert_tokens) + expert_out.mul_(flat_expert_weights[idxs[start_idx:end_idx]]) + + # for fp16 and other dtype + expert_cache = expert_cache.to(expert_out.dtype) + expert_cache.scatter_reduce_(0, exp_token_idx.view(-1, 1).repeat(1, x.shape[-1]), expert_out, reduce='sum') + return expert_cache + + +class TextProjection(nn.Module): + def __init__(self, in_features, hidden_size, dtype=None, device=None, operations=None): + super().__init__() + self.linear = operations.Linear(in_features=in_features, out_features=hidden_size, bias=False, dtype=dtype, device=device) + + def forward(self, caption): + hidden_states = self.linear(caption) + return hidden_states + + +class BlockType: + TransformerBlock = 1 + SingleTransformerBlock = 2 + + +class HiDreamImageSingleTransformerBlock(nn.Module): + def __init__( + self, + dim: int, + num_attention_heads: int, + attention_head_dim: int, + num_routed_experts: int = 4, + num_activated_experts: int = 2, + dtype=None, device=None, operations=None + ): + super().__init__() + self.num_attention_heads = num_attention_heads + self.adaLN_modulation = nn.Sequential( + nn.SiLU(), + operations.Linear(dim, 6 * dim, bias=True, dtype=dtype, device=device) + ) + + # 1. Attention + self.norm1_i = operations.LayerNorm(dim, eps = 1e-06, elementwise_affine = False, dtype=dtype, device=device) + self.attn1 = HiDreamAttention( + query_dim=dim, + heads=num_attention_heads, + dim_head=attention_head_dim, + processor = HiDreamAttnProcessor_flashattn(), + single = True, + dtype=dtype, device=device, operations=operations + ) + + # 3. Feed-forward + self.norm3_i = operations.LayerNorm(dim, eps = 1e-06, elementwise_affine = False, dtype=dtype, device=device) + if num_routed_experts > 0: + self.ff_i = MOEFeedForwardSwiGLU( + dim = dim, + hidden_dim = 4 * dim, + num_routed_experts = num_routed_experts, + num_activated_experts = num_activated_experts, + dtype=dtype, device=device, operations=operations + ) + else: + self.ff_i = FeedForwardSwiGLU(dim = dim, hidden_dim = 4 * dim, dtype=dtype, device=device, operations=operations) + + def forward( + self, + image_tokens: torch.FloatTensor, + image_tokens_masks: Optional[torch.FloatTensor] = None, + text_tokens: Optional[torch.FloatTensor] = None, + adaln_input: Optional[torch.FloatTensor] = None, + rope: torch.FloatTensor = None, + + ) -> torch.FloatTensor: + wtype = image_tokens.dtype + shift_msa_i, scale_msa_i, gate_msa_i, shift_mlp_i, scale_mlp_i, gate_mlp_i = \ + self.adaLN_modulation(adaln_input)[:,None].chunk(6, dim=-1) + + # 1. MM-Attention + norm_image_tokens = self.norm1_i(image_tokens).to(dtype=wtype) + norm_image_tokens = norm_image_tokens * (1 + scale_msa_i) + shift_msa_i + attn_output_i = self.attn1( + norm_image_tokens, + image_tokens_masks, + rope = rope, + ) + image_tokens = gate_msa_i * attn_output_i + image_tokens + + # 2. Feed-forward + norm_image_tokens = self.norm3_i(image_tokens).to(dtype=wtype) + norm_image_tokens = norm_image_tokens * (1 + scale_mlp_i) + shift_mlp_i + ff_output_i = gate_mlp_i * self.ff_i(norm_image_tokens.to(dtype=wtype)) + image_tokens = ff_output_i + image_tokens + return image_tokens + + +class HiDreamImageTransformerBlock(nn.Module): + def __init__( + self, + dim: int, + num_attention_heads: int, + attention_head_dim: int, + num_routed_experts: int = 4, + num_activated_experts: int = 2, + dtype=None, device=None, operations=None + ): + super().__init__() + self.num_attention_heads = num_attention_heads + self.adaLN_modulation = nn.Sequential( + nn.SiLU(), + operations.Linear(dim, 12 * dim, bias=True, dtype=dtype, device=device) + ) + # nn.init.zeros_(self.adaLN_modulation[1].weight) + # nn.init.zeros_(self.adaLN_modulation[1].bias) + + # 1. Attention + self.norm1_i = operations.LayerNorm(dim, eps = 1e-06, elementwise_affine = False, dtype=dtype, device=device) + self.norm1_t = operations.LayerNorm(dim, eps = 1e-06, elementwise_affine = False, dtype=dtype, device=device) + self.attn1 = HiDreamAttention( + query_dim=dim, + heads=num_attention_heads, + dim_head=attention_head_dim, + processor = HiDreamAttnProcessor_flashattn(), + single = False, + dtype=dtype, device=device, operations=operations + ) + + # 3. Feed-forward + self.norm3_i = operations.LayerNorm(dim, eps = 1e-06, elementwise_affine = False, dtype=dtype, device=device) + if num_routed_experts > 0: + self.ff_i = MOEFeedForwardSwiGLU( + dim = dim, + hidden_dim = 4 * dim, + num_routed_experts = num_routed_experts, + num_activated_experts = num_activated_experts, + dtype=dtype, device=device, operations=operations + ) + else: + self.ff_i = FeedForwardSwiGLU(dim = dim, hidden_dim = 4 * dim, dtype=dtype, device=device, operations=operations) + self.norm3_t = operations.LayerNorm(dim, eps = 1e-06, elementwise_affine = False) + self.ff_t = FeedForwardSwiGLU(dim = dim, hidden_dim = 4 * dim, dtype=dtype, device=device, operations=operations) + + def forward( + self, + image_tokens: torch.FloatTensor, + image_tokens_masks: Optional[torch.FloatTensor] = None, + text_tokens: Optional[torch.FloatTensor] = None, + adaln_input: Optional[torch.FloatTensor] = None, + rope: torch.FloatTensor = None, + ) -> torch.FloatTensor: + wtype = image_tokens.dtype + shift_msa_i, scale_msa_i, gate_msa_i, shift_mlp_i, scale_mlp_i, gate_mlp_i, \ + shift_msa_t, scale_msa_t, gate_msa_t, shift_mlp_t, scale_mlp_t, gate_mlp_t = \ + self.adaLN_modulation(adaln_input)[:,None].chunk(12, dim=-1) + + # 1. MM-Attention + norm_image_tokens = self.norm1_i(image_tokens).to(dtype=wtype) + norm_image_tokens = norm_image_tokens * (1 + scale_msa_i) + shift_msa_i + norm_text_tokens = self.norm1_t(text_tokens).to(dtype=wtype) + norm_text_tokens = norm_text_tokens * (1 + scale_msa_t) + shift_msa_t + + attn_output_i, attn_output_t = self.attn1( + norm_image_tokens, + image_tokens_masks, + norm_text_tokens, + rope = rope, + ) + + image_tokens = gate_msa_i * attn_output_i + image_tokens + text_tokens = gate_msa_t * attn_output_t + text_tokens + + # 2. Feed-forward + norm_image_tokens = self.norm3_i(image_tokens).to(dtype=wtype) + norm_image_tokens = norm_image_tokens * (1 + scale_mlp_i) + shift_mlp_i + norm_text_tokens = self.norm3_t(text_tokens).to(dtype=wtype) + norm_text_tokens = norm_text_tokens * (1 + scale_mlp_t) + shift_mlp_t + + ff_output_i = gate_mlp_i * self.ff_i(norm_image_tokens) + ff_output_t = gate_mlp_t * self.ff_t(norm_text_tokens) + image_tokens = ff_output_i + image_tokens + text_tokens = ff_output_t + text_tokens + return image_tokens, text_tokens + + +class HiDreamImageBlock(nn.Module): + def __init__( + self, + dim: int, + num_attention_heads: int, + attention_head_dim: int, + num_routed_experts: int = 4, + num_activated_experts: int = 2, + block_type: BlockType = BlockType.TransformerBlock, + dtype=None, device=None, operations=None + ): + super().__init__() + block_classes = { + BlockType.TransformerBlock: HiDreamImageTransformerBlock, + BlockType.SingleTransformerBlock: HiDreamImageSingleTransformerBlock, + } + self.block = block_classes[block_type]( + dim, + num_attention_heads, + attention_head_dim, + num_routed_experts, + num_activated_experts, + dtype=dtype, device=device, operations=operations + ) + + def forward( + self, + image_tokens: torch.FloatTensor, + image_tokens_masks: Optional[torch.FloatTensor] = None, + text_tokens: Optional[torch.FloatTensor] = None, + adaln_input: torch.FloatTensor = None, + rope: torch.FloatTensor = None, + ) -> torch.FloatTensor: + return self.block( + image_tokens, + image_tokens_masks, + text_tokens, + adaln_input, + rope, + ) + + +class HiDreamImageTransformer2DModel(nn.Module): + def __init__( + self, + patch_size: Optional[int] = None, + in_channels: int = 64, + out_channels: Optional[int] = None, + num_layers: int = 16, + num_single_layers: int = 32, + attention_head_dim: int = 128, + num_attention_heads: int = 20, + caption_channels: List[int] = None, + text_emb_dim: int = 2048, + num_routed_experts: int = 4, + num_activated_experts: int = 2, + axes_dims_rope: Tuple[int, int] = (32, 32), + max_resolution: Tuple[int, int] = (128, 128), + llama_layers: List[int] = None, + image_model=None, + dtype=None, device=None, operations=None + ): + self.patch_size = patch_size + self.num_attention_heads = num_attention_heads + self.attention_head_dim = attention_head_dim + self.num_layers = num_layers + self.num_single_layers = num_single_layers + + self.gradient_checkpointing = False + + super().__init__() + self.dtype = dtype + self.out_channels = out_channels or in_channels + self.inner_dim = self.num_attention_heads * self.attention_head_dim + self.llama_layers = llama_layers + + self.t_embedder = TimestepEmbed(self.inner_dim, dtype=dtype, device=device, operations=operations) + self.p_embedder = PooledEmbed(text_emb_dim, self.inner_dim, dtype=dtype, device=device, operations=operations) + self.x_embedder = PatchEmbed( + patch_size = patch_size, + in_channels = in_channels, + out_channels = self.inner_dim, + dtype=dtype, device=device, operations=operations + ) + self.pe_embedder = EmbedND(theta=10000, axes_dim=axes_dims_rope) + + self.double_stream_blocks = nn.ModuleList( + [ + HiDreamImageBlock( + dim = self.inner_dim, + num_attention_heads = self.num_attention_heads, + attention_head_dim = self.attention_head_dim, + num_routed_experts = num_routed_experts, + num_activated_experts = num_activated_experts, + block_type = BlockType.TransformerBlock, + dtype=dtype, device=device, operations=operations + ) + for i in range(self.num_layers) + ] + ) + + self.single_stream_blocks = nn.ModuleList( + [ + HiDreamImageBlock( + dim = self.inner_dim, + num_attention_heads = self.num_attention_heads, + attention_head_dim = self.attention_head_dim, + num_routed_experts = num_routed_experts, + num_activated_experts = num_activated_experts, + block_type = BlockType.SingleTransformerBlock, + dtype=dtype, device=device, operations=operations + ) + for i in range(self.num_single_layers) + ] + ) + + self.final_layer = OutEmbed(self.inner_dim, patch_size, self.out_channels, dtype=dtype, device=device, operations=operations) + + caption_channels = [caption_channels[1], ] * (num_layers + num_single_layers) + [caption_channels[0], ] + caption_projection = [] + for caption_channel in caption_channels: + caption_projection.append(TextProjection(in_features=caption_channel, hidden_size=self.inner_dim, dtype=dtype, device=device, operations=operations)) + self.caption_projection = nn.ModuleList(caption_projection) + self.max_seq = max_resolution[0] * max_resolution[1] // (patch_size * patch_size) + + def expand_timesteps(self, timesteps, batch_size, device): + if not torch.is_tensor(timesteps): + is_mps = device.type == "mps" + if isinstance(timesteps, float): + dtype = torch.float32 if is_mps else torch.float64 + else: + dtype = torch.int32 if is_mps else torch.int64 + timesteps = torch.tensor([timesteps], dtype=dtype, device=device) + elif len(timesteps.shape) == 0: + timesteps = timesteps[None].to(device) + # broadcast to batch dimension in a way that's compatible with ONNX/Core ML + timesteps = timesteps.expand(batch_size) + return timesteps + + def unpatchify(self, x: torch.Tensor, img_sizes: List[Tuple[int, int]]) -> List[torch.Tensor]: + x_arr = [] + for i, img_size in enumerate(img_sizes): + pH, pW = img_size + x_arr.append( + einops.rearrange(x[i, :pH*pW].reshape(1, pH, pW, -1), 'B H W (p1 p2 C) -> B C (H p1) (W p2)', + p1=self.patch_size, p2=self.patch_size) + ) + x = torch.cat(x_arr, dim=0) + return x + + def patchify(self, x, max_seq, img_sizes=None): + pz2 = self.patch_size * self.patch_size + if isinstance(x, torch.Tensor): + B = x.shape[0] + device = x.device + dtype = x.dtype + else: + B = len(x) + device = x[0].device + dtype = x[0].dtype + x_masks = torch.zeros((B, max_seq), dtype=dtype, device=device) + + if img_sizes is not None: + for i, img_size in enumerate(img_sizes): + x_masks[i, 0:img_size[0] * img_size[1]] = 1 + x = einops.rearrange(x, 'B C S p -> B S (p C)', p=pz2) + elif isinstance(x, torch.Tensor): + pH, pW = x.shape[-2] // self.patch_size, x.shape[-1] // self.patch_size + x = einops.rearrange(x, 'B C (H p1) (W p2) -> B (H W) (p1 p2 C)', p1=self.patch_size, p2=self.patch_size) + img_sizes = [[pH, pW]] * B + x_masks = None + else: + raise NotImplementedError + return x, x_masks, img_sizes + + def forward( + self, + x: torch.Tensor, + t: torch.Tensor, + y: Optional[torch.Tensor] = None, + context: Optional[torch.Tensor] = None, + encoder_hidden_states_llama3=None, + control = None, + transformer_options = {}, + ) -> torch.Tensor: + hidden_states = x + timesteps = t + pooled_embeds = y + T5_encoder_hidden_states = context + + img_sizes = None + + # spatial forward + batch_size = hidden_states.shape[0] + hidden_states_type = hidden_states.dtype + + # 0. time + timesteps = self.expand_timesteps(timesteps, batch_size, hidden_states.device) + timesteps = self.t_embedder(timesteps, hidden_states_type) + p_embedder = self.p_embedder(pooled_embeds) + adaln_input = timesteps + p_embedder + + hidden_states, image_tokens_masks, img_sizes = self.patchify(hidden_states, self.max_seq, img_sizes) + if image_tokens_masks is None: + pH, pW = img_sizes[0] + img_ids = torch.zeros(pH, pW, 3, device=hidden_states.device) + img_ids[..., 1] = img_ids[..., 1] + torch.arange(pH, device=hidden_states.device)[:, None] + img_ids[..., 2] = img_ids[..., 2] + torch.arange(pW, device=hidden_states.device)[None, :] + img_ids = repeat(img_ids, "h w c -> b (h w) c", b=batch_size) + hidden_states = self.x_embedder(hidden_states) + + # T5_encoder_hidden_states = encoder_hidden_states[0] + encoder_hidden_states = encoder_hidden_states_llama3.movedim(1, 0) + encoder_hidden_states = [encoder_hidden_states[k] for k in self.llama_layers] + + if self.caption_projection is not None: + new_encoder_hidden_states = [] + for i, enc_hidden_state in enumerate(encoder_hidden_states): + enc_hidden_state = self.caption_projection[i](enc_hidden_state) + enc_hidden_state = enc_hidden_state.view(batch_size, -1, hidden_states.shape[-1]) + new_encoder_hidden_states.append(enc_hidden_state) + encoder_hidden_states = new_encoder_hidden_states + T5_encoder_hidden_states = self.caption_projection[-1](T5_encoder_hidden_states) + T5_encoder_hidden_states = T5_encoder_hidden_states.view(batch_size, -1, hidden_states.shape[-1]) + encoder_hidden_states.append(T5_encoder_hidden_states) + + txt_ids = torch.zeros( + batch_size, + encoder_hidden_states[-1].shape[1] + encoder_hidden_states[-2].shape[1] + encoder_hidden_states[0].shape[1], + 3, + device=img_ids.device, dtype=img_ids.dtype + ) + ids = torch.cat((img_ids, txt_ids), dim=1) + rope = self.pe_embedder(ids) + + # 2. Blocks + block_id = 0 + initial_encoder_hidden_states = torch.cat([encoder_hidden_states[-1], encoder_hidden_states[-2]], dim=1) + initial_encoder_hidden_states_seq_len = initial_encoder_hidden_states.shape[1] + for bid, block in enumerate(self.double_stream_blocks): + cur_llama31_encoder_hidden_states = encoder_hidden_states[block_id] + cur_encoder_hidden_states = torch.cat([initial_encoder_hidden_states, cur_llama31_encoder_hidden_states], dim=1) + hidden_states, initial_encoder_hidden_states = block( + image_tokens = hidden_states, + image_tokens_masks = image_tokens_masks, + text_tokens = cur_encoder_hidden_states, + adaln_input = adaln_input, + rope = rope, + ) + initial_encoder_hidden_states = initial_encoder_hidden_states[:, :initial_encoder_hidden_states_seq_len] + block_id += 1 + + image_tokens_seq_len = hidden_states.shape[1] + hidden_states = torch.cat([hidden_states, initial_encoder_hidden_states], dim=1) + hidden_states_seq_len = hidden_states.shape[1] + if image_tokens_masks is not None: + encoder_attention_mask_ones = torch.ones( + (batch_size, initial_encoder_hidden_states.shape[1] + cur_llama31_encoder_hidden_states.shape[1]), + device=image_tokens_masks.device, dtype=image_tokens_masks.dtype + ) + image_tokens_masks = torch.cat([image_tokens_masks, encoder_attention_mask_ones], dim=1) + + for bid, block in enumerate(self.single_stream_blocks): + cur_llama31_encoder_hidden_states = encoder_hidden_states[block_id] + hidden_states = torch.cat([hidden_states, cur_llama31_encoder_hidden_states], dim=1) + hidden_states = block( + image_tokens=hidden_states, + image_tokens_masks=image_tokens_masks, + text_tokens=None, + adaln_input=adaln_input, + rope=rope, + ) + hidden_states = hidden_states[:, :hidden_states_seq_len] + block_id += 1 + + hidden_states = hidden_states[:, :image_tokens_seq_len, ...] + output = self.final_layer(hidden_states, adaln_input) + output = self.unpatchify(output, img_sizes) + return -output diff --git a/comfy/model_base.py b/comfy/model_base.py index 6bc627ae3..8dab1740b 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -37,6 +37,7 @@ import comfy.ldm.cosmos.model import comfy.ldm.lumina.model import comfy.ldm.wan.model import comfy.ldm.hunyuan3d.model +import comfy.ldm.hidream.model import comfy.model_management import comfy.patcher_extension @@ -1056,3 +1057,20 @@ class Hunyuan3Dv2(BaseModel): if guidance is not None: out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor([guidance])) return out + +class HiDream(BaseModel): + def __init__(self, model_config, model_type=ModelType.FLOW, device=None): + super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.hidream.model.HiDreamImageTransformer2DModel) + + def encode_adm(self, **kwargs): + return kwargs["pooled_output"] + + def extra_conds(self, **kwargs): + out = super().extra_conds(**kwargs) + cross_attn = kwargs.get("cross_attn", None) + if cross_attn is not None: + out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) + conditioning_llama3 = kwargs.get("conditioning_llama3", None) + if conditioning_llama3 is not None: + out['encoder_hidden_states_llama3'] = comfy.conds.CONDRegular(conditioning_llama3) + return out diff --git a/comfy/model_detection.py b/comfy/model_detection.py index 4217f5831..a4da1afcd 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -338,6 +338,25 @@ def detect_unet_config(state_dict, key_prefix, metadata=None): dit_config["guidance_embed"] = "{}guidance_in.in_layer.weight".format(key_prefix) in state_dict_keys return dit_config + if '{}caption_projection.0.linear.weight'.format(key_prefix) in state_dict_keys: # HiDream + dit_config = {} + dit_config["image_model"] = "hidream" + dit_config["attention_head_dim"] = 128 + dit_config["axes_dims_rope"] = [64, 32, 32] + dit_config["caption_channels"] = [4096, 4096] + dit_config["max_resolution"] = [128, 128] + dit_config["in_channels"] = 16 + dit_config["llama_layers"] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31] + dit_config["num_attention_heads"] = 20 + dit_config["num_routed_experts"] = 4 + dit_config["num_activated_experts"] = 2 + dit_config["num_layers"] = 16 + dit_config["num_single_layers"] = 32 + dit_config["out_channels"] = 16 + dit_config["patch_size"] = 2 + dit_config["text_emb_dim"] = 2048 + return dit_config + if '{}input_blocks.0.0.weight'.format(key_prefix) not in state_dict_keys: return None diff --git a/comfy/ops.py b/comfy/ops.py index 6b0e29307..aae6cafac 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -263,6 +263,9 @@ class manual_cast(disable_weight_init): class ConvTranspose1d(disable_weight_init.ConvTranspose1d): comfy_cast_weights = True + class RMSNorm(disable_weight_init.RMSNorm): + comfy_cast_weights = True + class Embedding(disable_weight_init.Embedding): comfy_cast_weights = True diff --git a/comfy/sd.py b/comfy/sd.py index 4d3aef3e1..d97873ba2 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -41,6 +41,7 @@ import comfy.text_encoders.hunyuan_video import comfy.text_encoders.cosmos import comfy.text_encoders.lumina2 import comfy.text_encoders.wan +import comfy.text_encoders.hidream import comfy.model_patcher import comfy.lora @@ -853,6 +854,9 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip elif len(clip_data) == 3: clip_target.clip = comfy.text_encoders.sd3_clip.sd3_clip(**t5xxl_detect(clip_data)) clip_target.tokenizer = comfy.text_encoders.sd3_clip.SD3Tokenizer + elif len(clip_data) == 4: + clip_target.clip = comfy.text_encoders.hidream.hidream_clip(**t5xxl_detect(clip_data), **llama_detect(clip_data)) + clip_target.tokenizer = comfy.text_encoders.hidream.HiDreamTokenizer parameters = 0 for c in clip_data: diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 2a6a61560..81c47ac68 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -1025,6 +1025,36 @@ class Hunyuan3Dv2mini(Hunyuan3Dv2): latent_format = latent_formats.Hunyuan3Dv2mini -models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, WAN21_FunControl2V, Hunyuan3Dv2mini, Hunyuan3Dv2] +class HiDream(supported_models_base.BASE): + unet_config = { + "image_model": "hidream", + } + + sampling_settings = { + "shift": 3.0, + } + + sampling_settings = { + } + + # memory_usage_factor = 1.2 # TODO + + unet_extra_config = {} + latent_format = latent_formats.Flux + + supported_inference_dtypes = [torch.bfloat16, torch.float32] + + vae_key_prefix = ["vae."] + text_encoder_key_prefix = ["text_encoders."] + + def get_model(self, state_dict, prefix="", device=None): + out = model_base.HiDream(self, device=device) + return out + + def clip_target(self, state_dict={}): + return None # TODO + + +models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, WAN21_FunControl2V, Hunyuan3Dv2mini, Hunyuan3Dv2, HiDream] models += [SVD_img2vid] diff --git a/comfy/text_encoders/hidream.py b/comfy/text_encoders/hidream.py new file mode 100644 index 000000000..af105f9bb --- /dev/null +++ b/comfy/text_encoders/hidream.py @@ -0,0 +1,150 @@ +from . import hunyuan_video +from . import sd3_clip +from comfy import sd1_clip +from comfy import sdxl_clip +import comfy.model_management +import torch +import logging + + +class HiDreamTokenizer: + def __init__(self, embedding_directory=None, tokenizer_data={}): + self.clip_l = sd1_clip.SDTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) + self.clip_g = sdxl_clip.SDXLClipGTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) + self.t5xxl = sd3_clip.T5XXLTokenizer(embedding_directory=embedding_directory, min_length=128, tokenizer_data=tokenizer_data) + self.llama = hunyuan_video.LLAMA3Tokenizer(embedding_directory=embedding_directory, min_length=128, pad_token=128009, tokenizer_data=tokenizer_data) + + def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): + out = {} + out["g"] = self.clip_g.tokenize_with_weights(text, return_word_ids) + out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids) + out["t5xxl"] = self.t5xxl.tokenize_with_weights(text, return_word_ids) + out["llama"] = self.llama.tokenize_with_weights(text, return_word_ids) + return out + + def untokenize(self, token_weight_pair): + return self.clip_g.untokenize(token_weight_pair) + + def state_dict(self): + return {} + + +class HiDreamTEModel(torch.nn.Module): + def __init__(self, clip_l=True, clip_g=True, t5=True, llama=True, dtype_t5=None, dtype_llama=None, device="cpu", dtype=None, model_options={}): + super().__init__() + self.dtypes = set() + if clip_l: + self.clip_l = sd1_clip.SDClipModel(device=device, dtype=dtype, return_projected_pooled=True, model_options=model_options) + self.dtypes.add(dtype) + else: + self.clip_l = None + + if clip_g: + self.clip_g = sdxl_clip.SDXLClipG(device=device, dtype=dtype, model_options=model_options) + self.dtypes.add(dtype) + else: + self.clip_g = None + + if t5: + dtype_t5 = comfy.model_management.pick_weight_dtype(dtype_t5, dtype, device) + self.t5xxl = sd3_clip.T5XXLModel(device=device, dtype=dtype_t5, model_options=model_options, attention_mask=True) + self.dtypes.add(dtype_t5) + else: + self.t5xxl = None + + if llama: + dtype_llama = comfy.model_management.pick_weight_dtype(dtype_llama, dtype, device) + if "vocab_size" not in model_options: + model_options["vocab_size"] = 128256 + self.llama = hunyuan_video.LLAMAModel(device=device, dtype=dtype_llama, model_options=model_options, layer="all", layer_idx=None, special_tokens={"start": 128000, "pad": 128009}) + self.dtypes.add(dtype_llama) + else: + self.llama = None + + logging.debug("Created HiDream text encoder with: clip_l {}, clip_g {}, t5xxl {}:{}, llama {}:{}".format(clip_l, clip_g, t5, dtype_t5, llama, dtype_llama)) + + def set_clip_options(self, options): + if self.clip_l is not None: + self.clip_l.set_clip_options(options) + if self.clip_g is not None: + self.clip_g.set_clip_options(options) + if self.t5xxl is not None: + self.t5xxl.set_clip_options(options) + if self.llama is not None: + self.llama.set_clip_options(options) + + def reset_clip_options(self): + if self.clip_l is not None: + self.clip_l.reset_clip_options() + if self.clip_g is not None: + self.clip_g.reset_clip_options() + if self.t5xxl is not None: + self.t5xxl.reset_clip_options() + if self.llama is not None: + self.llama.reset_clip_options() + + def encode_token_weights(self, token_weight_pairs): + token_weight_pairs_l = token_weight_pairs["l"] + token_weight_pairs_g = token_weight_pairs["g"] + token_weight_pairs_t5 = token_weight_pairs["t5xxl"] + token_weight_pairs_llama = token_weight_pairs["llama"] + lg_out = None + pooled = None + extra = {} + + if len(token_weight_pairs_g) > 0 or len(token_weight_pairs_l) > 0: + if self.clip_l is not None: + lg_out, l_pooled = self.clip_l.encode_token_weights(token_weight_pairs_l) + else: + l_pooled = torch.zeros((1, 768), device=comfy.model_management.intermediate_device()) + + if self.clip_g is not None: + g_out, g_pooled = self.clip_g.encode_token_weights(token_weight_pairs_g) + else: + g_pooled = torch.zeros((1, 1280), device=comfy.model_management.intermediate_device()) + + pooled = torch.cat((l_pooled, g_pooled), dim=-1) + + if self.t5xxl is not None: + t5_output = self.t5xxl.encode_token_weights(token_weight_pairs_t5) + t5_out, t5_pooled = t5_output[:2] + + if self.llama is not None: + ll_output = self.llama.encode_token_weights(token_weight_pairs_llama) + ll_out, ll_pooled = ll_output[:2] + ll_out = ll_out[:, 1:] + + if t5_out is None: + t5_out = torch.zeros((1, 1, 4096), device=comfy.model_management.intermediate_device()) + + if ll_out is None: + ll_out = torch.zeros((1, 32, 1, 4096), device=comfy.model_management.intermediate_device()) + + if pooled is None: + pooled = torch.zeros((1, 768 + 1280), device=comfy.model_management.intermediate_device()) + + extra["conditioning_llama3"] = ll_out + return t5_out, pooled, extra + + def load_sd(self, sd): + if "text_model.encoder.layers.30.mlp.fc1.weight" in sd: + return self.clip_g.load_sd(sd) + elif "text_model.encoder.layers.1.mlp.fc1.weight" in sd: + return self.clip_l.load_sd(sd) + elif "encoder.block.23.layer.1.DenseReluDense.wi_1.weight" in sd: + return self.t5xxl.load_sd(sd) + else: + return self.llama.load_sd(sd) + + +def hidream_clip(clip_l=True, clip_g=True, t5=True, llama=True, dtype_t5=None, dtype_llama=None, t5xxl_scaled_fp8=None, llama_scaled_fp8=None): + class HiDreamTEModel_(HiDreamTEModel): + def __init__(self, device="cpu", dtype=None, model_options={}): + if t5xxl_scaled_fp8 is not None and "t5xxl_scaled_fp8" not in model_options: + model_options = model_options.copy() + model_options["t5xxl_scaled_fp8"] = t5xxl_scaled_fp8 + if llama_scaled_fp8 is not None and "llama_scaled_fp8" not in model_options: + model_options = model_options.copy() + model_options["llama_scaled_fp8"] = llama_scaled_fp8 + super().__init__(clip_l=clip_l, clip_g=clip_g, t5=t5, llama=llama, dtype_t5=dtype_t5, dtype_llama=dtype_llama, device=device, dtype=dtype, model_options=model_options) + return HiDreamTEModel_ diff --git a/comfy_extras/nodes_hidream.py b/comfy_extras/nodes_hidream.py new file mode 100644 index 000000000..5a160c2ba --- /dev/null +++ b/comfy_extras/nodes_hidream.py @@ -0,0 +1,32 @@ +import folder_paths +import comfy.sd +import comfy.model_management + + +class QuadrupleCLIPLoader: + @classmethod + def INPUT_TYPES(s): + return {"required": { "clip_name1": (folder_paths.get_filename_list("text_encoders"), ), + "clip_name2": (folder_paths.get_filename_list("text_encoders"), ), + "clip_name3": (folder_paths.get_filename_list("text_encoders"), ), + "clip_name4": (folder_paths.get_filename_list("text_encoders"), ) + }} + RETURN_TYPES = ("CLIP",) + FUNCTION = "load_clip" + + CATEGORY = "advanced/loaders" + + DESCRIPTION = "[Recipes]\n\nhidream: long clip-l, long clip-g, t5xxl, llama_8b_3.1_instruct" + + def load_clip(self, clip_name1, clip_name2, clip_name3, clip_name4): + clip_path1 = folder_paths.get_full_path_or_raise("text_encoders", clip_name1) + clip_path2 = folder_paths.get_full_path_or_raise("text_encoders", clip_name2) + clip_path3 = folder_paths.get_full_path_or_raise("text_encoders", clip_name3) + clip_path4 = folder_paths.get_full_path_or_raise("text_encoders", clip_name4) + clip = comfy.sd.load_clip(ckpt_paths=[clip_path1, clip_path2, clip_path3, clip_path4], embedding_directory=folder_paths.get_folder_paths("embeddings")) + return (clip,) + + +NODE_CLASS_MAPPINGS = { + "QuadrupleCLIPLoader": QuadrupleCLIPLoader, +} diff --git a/nodes.py b/nodes.py index e66b5c714..ae0a2e183 100644 --- a/nodes.py +++ b/nodes.py @@ -2280,7 +2280,8 @@ def init_builtin_extra_nodes(): "nodes_hunyuan3d.py", "nodes_primitive.py", "nodes_cfg.py", - "nodes_optimalsteps.py" + "nodes_optimalsteps.py", + "nodes_hidream.py" ] import_failed = [] From b4dc03ad7669b155d3c7714e9e5a474365d50c8c Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 16 Apr 2025 04:53:56 -0400 Subject: [PATCH 304/478] Fix issue on old torch. --- comfy/rmsnorm.py | 1 + 1 file changed, 1 insertion(+) diff --git a/comfy/rmsnorm.py b/comfy/rmsnorm.py index 77df44464..9d82bee1a 100644 --- a/comfy/rmsnorm.py +++ b/comfy/rmsnorm.py @@ -49,6 +49,7 @@ if RMSNorm is None: ) else: self.register_parameter("weight", None) + self.bias = None def forward(self, x): return rms_norm(x, self.weight, self.eps) From cce1d9145e06c0f86336a2a7f5558610fdc76718 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 16 Apr 2025 15:41:00 -0400 Subject: [PATCH 305/478] [Type] Mark input options NotRequired (#7614) --- comfy/comfy_types/node_typing.py | 54 ++++++++++++++++---------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/comfy/comfy_types/node_typing.py b/comfy/comfy_types/node_typing.py index 3535966fb..42ed5174e 100644 --- a/comfy/comfy_types/node_typing.py +++ b/comfy/comfy_types/node_typing.py @@ -99,59 +99,59 @@ class InputTypeOptions(TypedDict): Comfy Docs: https://docs.comfy.org/custom-nodes/backend/datatypes """ - default: bool | str | float | int | list | tuple + default: NotRequired[bool | str | float | int | list | tuple] """The default value of the widget""" - defaultInput: bool + defaultInput: NotRequired[bool] """@deprecated in v1.16 frontend. v1.16 frontend allows input socket and widget to co-exist. - defaultInput on required inputs should be dropped. - defaultInput on optional inputs should be replaced with forceInput. Ref: https://github.com/Comfy-Org/ComfyUI_frontend/pull/3364 """ - forceInput: bool + forceInput: NotRequired[bool] """Forces the input to be an input slot rather than a widget even a widget is available for the input type.""" - lazy: bool + lazy: NotRequired[bool] """Declares that this input uses lazy evaluation""" - rawLink: bool + rawLink: NotRequired[bool] """When a link exists, rather than receiving the evaluated value, you will receive the link (i.e. `["nodeId", ]`). Designed for node expansion.""" - tooltip: str + tooltip: NotRequired[str] """Tooltip for the input (or widget), shown on pointer hover""" # class InputTypeNumber(InputTypeOptions): # default: float | int - min: float + min: NotRequired[float] """The minimum value of a number (``FLOAT`` | ``INT``)""" - max: float + max: NotRequired[float] """The maximum value of a number (``FLOAT`` | ``INT``)""" - step: float + step: NotRequired[float] """The amount to increment or decrement a widget by when stepping up/down (``FLOAT`` | ``INT``)""" - round: float + round: NotRequired[float] """Floats are rounded by this value (``FLOAT``)""" # class InputTypeBoolean(InputTypeOptions): # default: bool - label_on: str + label_on: NotRequired[str] """The label to use in the UI when the bool is True (``BOOLEAN``)""" - label_off: str + label_off: NotRequired[str] """The label to use in the UI when the bool is False (``BOOLEAN``)""" # class InputTypeString(InputTypeOptions): # default: str - multiline: bool + multiline: NotRequired[bool] """Use a multiline text box (``STRING``)""" - placeholder: str + placeholder: NotRequired[str] """Placeholder text to display in the UI when empty (``STRING``)""" # Deprecated: # defaultVal: str - dynamicPrompts: bool + dynamicPrompts: NotRequired[bool] """Causes the front-end to evaluate dynamic prompts (``STRING``)""" # class InputTypeCombo(InputTypeOptions): - image_upload: bool + image_upload: NotRequired[bool] """Specifies whether the input should have an image upload button and image preview attached to it. Requires that the input's name is `image`.""" - image_folder: Literal["input", "output", "temp"] + image_folder: NotRequired[Literal["input", "output", "temp"]] """Specifies which folder to get preview images from if the input has the ``image_upload`` flag. """ - remote: RemoteInputOptions + remote: NotRequired[RemoteInputOptions] """Specifies the configuration for a remote input. Available after ComfyUI frontend v1.9.7 https://github.com/Comfy-Org/ComfyUI_frontend/pull/2422""" - control_after_generate: bool + control_after_generate: NotRequired[bool] """Specifies whether a control widget should be added to the input, adding options to automatically change the value after each prompt is queued. Currently only used for INT and COMBO types.""" options: NotRequired[list[str | int | float]] """COMBO type only. Specifies the selectable options for the combo widget. @@ -169,15 +169,15 @@ class InputTypeOptions(TypedDict): class HiddenInputTypeDict(TypedDict): """Provides type hinting for the hidden entry of node INPUT_TYPES.""" - node_id: Literal["UNIQUE_ID"] + node_id: NotRequired[Literal["UNIQUE_ID"]] """UNIQUE_ID is the unique identifier of the node, and matches the id property of the node on the client side. It is commonly used in client-server communications (see messages).""" - unique_id: Literal["UNIQUE_ID"] + unique_id: NotRequired[Literal["UNIQUE_ID"]] """UNIQUE_ID is the unique identifier of the node, and matches the id property of the node on the client side. It is commonly used in client-server communications (see messages).""" - prompt: Literal["PROMPT"] + prompt: NotRequired[Literal["PROMPT"]] """PROMPT is the complete prompt sent by the client to the server. See the prompt object for a full description.""" - extra_pnginfo: Literal["EXTRA_PNGINFO"] + extra_pnginfo: NotRequired[Literal["EXTRA_PNGINFO"]] """EXTRA_PNGINFO is a dictionary that will be copied into the metadata of any .png files saved. Custom nodes can store additional information in this dictionary for saving (or as a way to communicate with a downstream node).""" - dynprompt: Literal["DYNPROMPT"] + dynprompt: NotRequired[Literal["DYNPROMPT"]] """DYNPROMPT is an instance of comfy_execution.graph.DynamicPrompt. It differs from PROMPT in that it may mutate during the course of execution in response to Node Expansion.""" @@ -187,11 +187,11 @@ class InputTypeDict(TypedDict): Comfy Docs: https://docs.comfy.org/custom-nodes/backend/more_on_inputs """ - required: dict[str, tuple[IO, InputTypeOptions]] + required: NotRequired[dict[str, tuple[IO, InputTypeOptions]]] """Describes all inputs that must be connected for the node to execute.""" - optional: dict[str, tuple[IO, InputTypeOptions]] + optional: NotRequired[dict[str, tuple[IO, InputTypeOptions]]] """Describes inputs which do not need to be connected.""" - hidden: HiddenInputTypeDict + hidden: NotRequired[HiddenInputTypeDict] """Offers advanced functionality and server-client communication. Comfy Docs: https://docs.comfy.org/custom-nodes/backend/more_on_inputs#hidden-inputs From f00f340a56013001a6148eee6d3d00d02078e43e Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 16 Apr 2025 17:43:55 -0400 Subject: [PATCH 306/478] Reuse code from flux model. --- comfy/ldm/hidream/model.py | 39 ++++---------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/comfy/ldm/hidream/model.py b/comfy/ldm/hidream/model.py index de749a373..39c67a193 100644 --- a/comfy/ldm/hidream/model.py +++ b/comfy/ldm/hidream/model.py @@ -8,26 +8,12 @@ from einops import repeat from comfy.ldm.lightricks.model import TimestepEmbedding, Timesteps import torch.nn.functional as F -from comfy.ldm.flux.math import apply_rope +from comfy.ldm.flux.math import apply_rope, rope +from comfy.ldm.flux.layers import LastLayer + from comfy.ldm.modules.attention import optimized_attention import comfy.model_management -# Copied from https://github.com/black-forest-labs/flux/blob/main/src/flux/math.py -def rope(pos: torch.Tensor, dim: int, theta: int) -> torch.Tensor: - assert dim % 2 == 0, "The dimension must be even." - - scale = torch.arange(0, dim, 2, dtype=torch.float64, device=pos.device) / dim - omega = 1.0 / (theta**scale) - - batch_size, seq_length = pos.shape - out = torch.einsum("...n,d->...nd", pos, omega) - cos_out = torch.cos(out) - sin_out = torch.sin(out) - - stacked_out = torch.stack([cos_out, -sin_out, sin_out, cos_out], dim=-1) - out = stacked_out.view(batch_size, -1, dim // 2, 2, 2) - return out.float() - # Copied from https://github.com/black-forest-labs/flux/blob/main/src/flux/modules/layers.py class EmbedND(nn.Module): @@ -84,23 +70,6 @@ class TimestepEmbed(nn.Module): return t_emb -class OutEmbed(nn.Module): - def __init__(self, hidden_size, patch_size, out_channels, dtype=None, device=None, operations=None): - super().__init__() - self.norm_final = operations.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6, dtype=dtype, device=device) - self.linear = operations.Linear(hidden_size, patch_size * patch_size * out_channels, bias=True, dtype=dtype, device=device) - self.adaLN_modulation = nn.Sequential( - nn.SiLU(), - operations.Linear(hidden_size, 2 * hidden_size, bias=True, dtype=dtype, device=device) - ) - - def forward(self, x, adaln_input): - shift, scale = self.adaLN_modulation(adaln_input).chunk(2, dim=1) - x = self.norm_final(x) * (1 + scale.unsqueeze(1)) + shift.unsqueeze(1) - x = self.linear(x) - return x - - def attention(query: torch.Tensor, key: torch.Tensor, value: torch.Tensor): return optimized_attention(query.view(query.shape[0], -1, query.shape[-1] * query.shape[-2]), key.view(key.shape[0], -1, key.shape[-1] * key.shape[-2]), value.view(value.shape[0], -1, value.shape[-1] * value.shape[-2]), query.shape[2]) @@ -663,7 +632,7 @@ class HiDreamImageTransformer2DModel(nn.Module): ] ) - self.final_layer = OutEmbed(self.inner_dim, patch_size, self.out_channels, dtype=dtype, device=device, operations=operations) + self.final_layer = LastLayer(self.inner_dim, patch_size, self.out_channels, dtype=dtype, device=device, operations=operations) caption_channels = [caption_channels[1], ] * (num_layers + num_single_layers) + [caption_channels[0], ] caption_projection = [] From 9899d187b16a9a823a98fc1df9bf1fbb58674087 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 16 Apr 2025 18:07:55 -0400 Subject: [PATCH 307/478] Limit T5 to 128 tokens for HiDream: #7620 --- comfy/text_encoders/hidream.py | 5 +++-- comfy/text_encoders/sd3_clip.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/comfy/text_encoders/hidream.py b/comfy/text_encoders/hidream.py index af105f9bb..6c34c5572 100644 --- a/comfy/text_encoders/hidream.py +++ b/comfy/text_encoders/hidream.py @@ -11,14 +11,15 @@ class HiDreamTokenizer: def __init__(self, embedding_directory=None, tokenizer_data={}): self.clip_l = sd1_clip.SDTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) self.clip_g = sdxl_clip.SDXLClipGTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) - self.t5xxl = sd3_clip.T5XXLTokenizer(embedding_directory=embedding_directory, min_length=128, tokenizer_data=tokenizer_data) + self.t5xxl = sd3_clip.T5XXLTokenizer(embedding_directory=embedding_directory, min_length=128, max_length=128, tokenizer_data=tokenizer_data) self.llama = hunyuan_video.LLAMA3Tokenizer(embedding_directory=embedding_directory, min_length=128, pad_token=128009, tokenizer_data=tokenizer_data) def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} out["g"] = self.clip_g.tokenize_with_weights(text, return_word_ids) out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids) - out["t5xxl"] = self.t5xxl.tokenize_with_weights(text, return_word_ids) + t5xxl = self.t5xxl.tokenize_with_weights(text, return_word_ids) + out["t5xxl"] = [t5xxl[0]] # Use only first 128 tokens out["llama"] = self.llama.tokenize_with_weights(text, return_word_ids) return out diff --git a/comfy/text_encoders/sd3_clip.py b/comfy/text_encoders/sd3_clip.py index 1727998a8..6c2fbeca4 100644 --- a/comfy/text_encoders/sd3_clip.py +++ b/comfy/text_encoders/sd3_clip.py @@ -32,9 +32,9 @@ def t5_xxl_detect(state_dict, prefix=""): return out class T5XXLTokenizer(sd1_clip.SDTokenizer): - def __init__(self, embedding_directory=None, tokenizer_data={}, min_length=77): + def __init__(self, embedding_directory=None, tokenizer_data={}, min_length=77, max_length=99999999): tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_tokenizer") - super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=min_length, tokenizer_data=tokenizer_data) + super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=max_length, min_length=min_length, tokenizer_data=tokenizer_data) class SD3Tokenizer: From 1fc00ba4b6576ed5910a88caa47866774ee6d0ca Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 16 Apr 2025 18:34:14 -0400 Subject: [PATCH 308/478] Make hidream work with any latent resolution. --- comfy/ldm/hidream/model.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/comfy/ldm/hidream/model.py b/comfy/ldm/hidream/model.py index 39c67a193..fcb5a9c51 100644 --- a/comfy/ldm/hidream/model.py +++ b/comfy/ldm/hidream/model.py @@ -13,6 +13,7 @@ from comfy.ldm.flux.layers import LastLayer from comfy.ldm.modules.attention import optimized_attention import comfy.model_management +import comfy.ldm.common_dit # Copied from https://github.com/black-forest-labs/flux/blob/main/src/flux/modules/layers.py @@ -701,7 +702,8 @@ class HiDreamImageTransformer2DModel(nn.Module): control = None, transformer_options = {}, ) -> torch.Tensor: - hidden_states = x + bs, c, h, w = x.shape + hidden_states = comfy.ldm.common_dit.pad_to_patch_size(x, (self.patch_size, self.patch_size)) timesteps = t pooled_embeds = y T5_encoder_hidden_states = context @@ -794,4 +796,4 @@ class HiDreamImageTransformer2DModel(nn.Module): hidden_states = hidden_states[:, :image_tokens_seq_len, ...] output = self.final_layer(hidden_states, adaln_input) output = self.unpatchify(output, img_sizes) - return -output + return -output[:, :, :h, :w] From 0d720e4367c1c149dbfa0a98ebd81c7776914545 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 17 Apr 2025 06:25:39 -0400 Subject: [PATCH 309/478] Don't hardcode length of context_img in wan code. --- comfy/ldm/wan/model.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index 9b5e5332c..d64e73a8e 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -83,7 +83,7 @@ class WanSelfAttention(nn.Module): class WanT2VCrossAttention(WanSelfAttention): - def forward(self, x, context): + def forward(self, x, context, **kwargs): r""" Args: x(Tensor): Shape [B, L1, C] @@ -116,14 +116,14 @@ class WanI2VCrossAttention(WanSelfAttention): # self.alpha = nn.Parameter(torch.zeros((1, ))) self.norm_k_img = RMSNorm(dim, eps=eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() - def forward(self, x, context): + def forward(self, x, context, context_img_len): r""" Args: x(Tensor): Shape [B, L1, C] context(Tensor): Shape [B, L2, C] """ - context_img = context[:, :257] - context = context[:, 257:] + context_img = context[:, :context_img_len] + context = context[:, context_img_len:] # compute query, key, value q = self.norm_q(self.q(x)) @@ -193,6 +193,7 @@ class WanAttentionBlock(nn.Module): e, freqs, context, + context_img_len=None, ): r""" Args: @@ -213,7 +214,7 @@ class WanAttentionBlock(nn.Module): x = x + y * e[2] # cross-attention & ffn - x = x + self.cross_attn(self.norm3(x), context) + x = x + self.cross_attn(self.norm3(x), context, context_img_len=context_img_len) y = self.ffn(self.norm2(x) * (1 + e[4]) + e[3]) x = x + y * e[5] return x @@ -420,9 +421,12 @@ class WanModel(torch.nn.Module): # context context = self.text_embedding(context) - if clip_fea is not None and self.img_emb is not None: - context_clip = self.img_emb(clip_fea) # bs x 257 x dim - context = torch.concat([context_clip, context], dim=1) + context_img_len = None + if clip_fea is not None: + if self.img_emb is not None: + context_clip = self.img_emb(clip_fea) # bs x 257 x dim + context = torch.concat([context_clip, context], dim=1) + context_img_len = clip_fea.shape[-2] patches_replace = transformer_options.get("patches_replace", {}) blocks_replace = patches_replace.get("dit", {}) @@ -430,12 +434,12 @@ class WanModel(torch.nn.Module): if ("double_block", i) in blocks_replace: def block_wrap(args): out = {} - out["img"] = block(args["img"], context=args["txt"], e=args["vec"], freqs=args["pe"]) + out["img"] = block(args["img"], context=args["txt"], e=args["vec"], freqs=args["pe"], context_img_len=context_img_len) return out out = blocks_replace[("double_block", i)]({"img": x, "txt": context, "vec": e0, "pe": freqs}, {"original_block": block_wrap}) x = out["img"] else: - x = block(x, e=e0, freqs=freqs, context=context) + x = block(x, e=e0, freqs=freqs, context=context, context_img_len=context_img_len) # head x = self.head(x, e) From c14429940f6f9491c77250eb15cad3746e350753 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 17 Apr 2025 12:04:48 -0400 Subject: [PATCH 310/478] Support loading WAN FLF model. --- comfy/ldm/wan/model.py | 13 +++++++++++-- comfy/model_detection.py | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index d64e73a8e..8907f70ad 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -251,7 +251,7 @@ class Head(nn.Module): class MLPProj(torch.nn.Module): - def __init__(self, in_dim, out_dim, operation_settings={}): + def __init__(self, in_dim, out_dim, flf_pos_embed_token_number=None, operation_settings={}): super().__init__() self.proj = torch.nn.Sequential( @@ -259,7 +259,15 @@ class MLPProj(torch.nn.Module): torch.nn.GELU(), operation_settings.get("operations").Linear(in_dim, out_dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")), operation_settings.get("operations").LayerNorm(out_dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype"))) + if flf_pos_embed_token_number is not None: + self.emb_pos = nn.Parameter(torch.empty((1, flf_pos_embed_token_number, in_dim), device=operation_settings.get("device"), dtype=operation_settings.get("dtype"))) + else: + self.emb_pos = None + def forward(self, image_embeds): + if self.emb_pos is not None: + image_embeds = image_embeds[:, :self.emb_pos.shape[1]] + comfy.model_management.cast_to(self.emb_pos[:, :image_embeds.shape[1]], dtype=image_embeds.dtype, device=image_embeds.device) + clip_extra_context_tokens = self.proj(image_embeds) return clip_extra_context_tokens @@ -285,6 +293,7 @@ class WanModel(torch.nn.Module): qk_norm=True, cross_attn_norm=True, eps=1e-6, + flf_pos_embed_token_number=None, image_model=None, device=None, dtype=None, @@ -374,7 +383,7 @@ class WanModel(torch.nn.Module): self.rope_embedder = EmbedND(dim=d, theta=10000.0, axes_dim=[d - 4 * (d // 6), 2 * (d // 6), 2 * (d // 6)]) if model_type == 'i2v': - self.img_emb = MLPProj(1280, dim, operation_settings=operation_settings) + self.img_emb = MLPProj(1280, dim, flf_pos_embed_token_number=flf_pos_embed_token_number, operation_settings=operation_settings) else: self.img_emb = None diff --git a/comfy/model_detection.py b/comfy/model_detection.py index a4da1afcd..6499bf238 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -321,6 +321,9 @@ def detect_unet_config(state_dict, key_prefix, metadata=None): dit_config["model_type"] = "i2v" else: dit_config["model_type"] = "t2v" + flf_weight = state_dict.get('{}img_emb.emb_pos'.format(key_prefix)) + if flf_weight is not None: + dit_config["flf_pos_embed_token_number"] = flf_weight.shape[1] return dit_config if '{}latent_in.weight'.format(key_prefix) in state_dict_keys: # Hunyuan 3D From dbcfd092a29c272696bae856d943005fc0cc3036 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 17 Apr 2025 12:42:34 -0400 Subject: [PATCH 311/478] Set default context_img_len to 257 --- comfy/ldm/wan/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index 8907f70ad..2a30497c5 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -193,7 +193,7 @@ class WanAttentionBlock(nn.Module): e, freqs, context, - context_img_len=None, + context_img_len=257, ): r""" Args: From eba7a25e7abf9ec47ab2a42a5c1e6a5cf52351e1 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 17 Apr 2025 13:18:43 -0400 Subject: [PATCH 312/478] Add WanFirstLastFrameToVideo node to use the new model. --- comfy_extras/nodes_wan.py | 98 ++++++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 28 deletions(-) diff --git a/comfy_extras/nodes_wan.py b/comfy_extras/nodes_wan.py index 2d0f31ac8..8ad358ce8 100644 --- a/comfy_extras/nodes_wan.py +++ b/comfy_extras/nodes_wan.py @@ -4,6 +4,7 @@ import torch import comfy.model_management import comfy.utils import comfy.latent_formats +import comfy.clip_vision class WanImageToVideo: @@ -99,6 +100,72 @@ class WanFunControlToVideo: out_latent["samples"] = latent return (positive, negative, out_latent) +class WanFirstLastFrameToVideo: + @classmethod + def INPUT_TYPES(s): + return {"required": {"positive": ("CONDITIONING", ), + "negative": ("CONDITIONING", ), + "vae": ("VAE", ), + "width": ("INT", {"default": 832, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "height": ("INT", {"default": 480, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "length": ("INT", {"default": 81, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}), + "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), + }, + "optional": {"clip_vision_start_image": ("CLIP_VISION_OUTPUT", ), + "clip_vision_end_image": ("CLIP_VISION_OUTPUT", ), + "start_image": ("IMAGE", ), + "end_image": ("IMAGE", ), + }} + + RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT") + RETURN_NAMES = ("positive", "negative", "latent") + FUNCTION = "encode" + + CATEGORY = "conditioning/video_models" + + def encode(self, positive, negative, vae, width, height, length, batch_size, start_image=None, end_image=None, clip_vision_start_image=None, clip_vision_end_image=None): + latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) + if start_image is not None: + start_image = comfy.utils.common_upscale(start_image[:length].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + if end_image is not None: + end_image = comfy.utils.common_upscale(end_image[-length:].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + + image = torch.ones((length, height, width, 3)) * 0.5 + mask = torch.ones((1, 1, latent.shape[2] * 4, latent.shape[-2], latent.shape[-1])) + + if start_image is not None: + image[:start_image.shape[0]] = start_image + mask[:, :, :start_image.shape[0] + 3] = 0.0 + + if end_image is not None: + image[-end_image.shape[0]:] = end_image + mask[:, :, -end_image.shape[0]:] = 0.0 + + concat_latent_image = vae.encode(image[:, :, :, :3]) + mask = mask.view(1, mask.shape[2] // 4, 4, mask.shape[3], mask.shape[4]).transpose(1, 2) + positive = node_helpers.conditioning_set_values(positive, {"concat_latent_image": concat_latent_image, "concat_mask": mask}) + negative = node_helpers.conditioning_set_values(negative, {"concat_latent_image": concat_latent_image, "concat_mask": mask}) + + if clip_vision_start_image is not None: + clip_vision_output = clip_vision_start_image + + if clip_vision_end_image is not None: + if clip_vision_output is not None: + states = torch.cat([clip_vision_output.penultimate_hidden_states, clip_vision_end_image.penultimate_hidden_states], dim=-2) + clip_vision_output = comfy.clip_vision.Output() + clip_vision_output.penultimate_hidden_states = states + else: + clip_vision_output = clip_vision_end_image + + if clip_vision_output is not None: + positive = node_helpers.conditioning_set_values(positive, {"clip_vision_output": clip_vision_output}) + negative = node_helpers.conditioning_set_values(negative, {"clip_vision_output": clip_vision_output}) + + out_latent = {} + out_latent["samples"] = latent + return (positive, negative, out_latent) + + class WanFunInpaintToVideo: @classmethod def INPUT_TYPES(s): @@ -122,38 +189,13 @@ class WanFunInpaintToVideo: CATEGORY = "conditioning/video_models" def encode(self, positive, negative, vae, width, height, length, batch_size, start_image=None, end_image=None, clip_vision_output=None): - latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) - if start_image is not None: - start_image = comfy.utils.common_upscale(start_image[:length].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) - if end_image is not None: - end_image = comfy.utils.common_upscale(end_image[-length:].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + flfv = WanFirstLastFrameToVideo() + return flfv.encode(positive, negative, vae, width, height, length, batch_size, start_image=start_image, end_image=end_image, clip_vision_start_image=clip_vision_output) - image = torch.ones((length, height, width, 3)) * 0.5 - mask = torch.ones((1, 1, latent.shape[2] * 4, latent.shape[-2], latent.shape[-1])) - - if start_image is not None: - image[:start_image.shape[0]] = start_image - mask[:, :, :start_image.shape[0] + 3] = 0.0 - - if end_image is not None: - image[-end_image.shape[0]:] = end_image - mask[:, :, -end_image.shape[0]:] = 0.0 - - concat_latent_image = vae.encode(image[:, :, :, :3]) - mask = mask.view(1, mask.shape[2] // 4, 4, mask.shape[3], mask.shape[4]).transpose(1, 2) - positive = node_helpers.conditioning_set_values(positive, {"concat_latent_image": concat_latent_image, "concat_mask": mask}) - negative = node_helpers.conditioning_set_values(negative, {"concat_latent_image": concat_latent_image, "concat_mask": mask}) - - if clip_vision_output is not None: - positive = node_helpers.conditioning_set_values(positive, {"clip_vision_output": clip_vision_output}) - negative = node_helpers.conditioning_set_values(negative, {"clip_vision_output": clip_vision_output}) - - out_latent = {} - out_latent["samples"] = latent - return (positive, negative, out_latent) NODE_CLASS_MAPPINGS = { "WanImageToVideo": WanImageToVideo, "WanFunControlToVideo": WanFunControlToVideo, "WanFunInpaintToVideo": WanFunInpaintToVideo, + "WanFirstLastFrameToVideo": WanFirstLastFrameToVideo, } From 05d5a75cdcb749286c9ce9e034bb37a2f6195c37 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 18 Apr 2025 02:25:33 +0800 Subject: [PATCH 313/478] Update frontend to 1.16 (Install templates as pip package) (#7623) * install templates as pip package * Update requirements.txt * bump templates version to include hidream --------- Co-authored-by: Chenlei Hu --- app/frontend_management.py | 21 +++++++++++++++++++++ requirements.txt | 3 ++- server.py | 6 ++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/frontend_management.py b/app/frontend_management.py index c56ea86e0..7b7923b79 100644 --- a/app/frontend_management.py +++ b/app/frontend_management.py @@ -184,6 +184,27 @@ comfyui-frontend-package is not installed. ) sys.exit(-1) + @classmethod + def templates_path(cls) -> str: + try: + import comfyui_workflow_templates + + return str( + importlib.resources.files(comfyui_workflow_templates) / "templates" + ) + except ImportError: + logging.error( + f""" +********** ERROR *********** + +comfyui-workflow-templates is not installed. + +{frontend_install_warning_message()} + +********** ERROR *********** +""".strip() + ) + @classmethod def parse_version_string(cls, value: str) -> tuple[str, str, str]: """ diff --git a/requirements.txt b/requirements.txt index 851db23bd..278e3eaa8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ -comfyui-frontend-package==1.15.13 +comfyui-frontend-package==1.16.8 +comfyui-workflow-templates==0.1.1 torch torchsde torchvision diff --git a/server.py b/server.py index 62667ce18..0cc97b248 100644 --- a/server.py +++ b/server.py @@ -736,6 +736,12 @@ class PromptServer(): for name, dir in nodes.EXTENSION_WEB_DIRS.items(): self.app.add_routes([web.static('/extensions/' + name, dir)]) + workflow_templates_path = FrontendManager.templates_path() + if workflow_templates_path: + self.app.add_routes([ + web.static('/templates', workflow_templates_path) + ]) + self.app.add_routes([ web.static('/', self.web_root), ]) From 93292bc450dd291925c45adea00ebedb8a3209ef Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 17 Apr 2025 14:45:01 -0400 Subject: [PATCH 314/478] ComfyUI version 0.3.29 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index a44538d1a..f9161b37e 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.28" +__version__ = "0.3.29" diff --git a/pyproject.toml b/pyproject.toml index 6eb1704db..e8fc9555d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.28" +version = "0.3.29" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 19373aee759be2f0868a69603c5d967e5e63e1c5 Mon Sep 17 00:00:00 2001 From: BVH <82035780+bvhari@users.noreply.github.com> Date: Fri, 18 Apr 2025 00:54:33 +0530 Subject: [PATCH 315/478] Add FreSca node (#7631) --- comfy_extras/nodes_fresca.py | 102 +++++++++++++++++++++++++++++++++++ nodes.py | 3 +- 2 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 comfy_extras/nodes_fresca.py diff --git a/comfy_extras/nodes_fresca.py b/comfy_extras/nodes_fresca.py new file mode 100644 index 000000000..b0b86f235 --- /dev/null +++ b/comfy_extras/nodes_fresca.py @@ -0,0 +1,102 @@ +# Code based on https://github.com/WikiChao/FreSca (MIT License) +import torch +import torch.fft as fft + + +def Fourier_filter(x, scale_low=1.0, scale_high=1.5, freq_cutoff=20): + """ + Apply frequency-dependent scaling to an image tensor using Fourier transforms. + + Parameters: + x: Input tensor of shape (B, C, H, W) + scale_low: Scaling factor for low-frequency components (default: 1.0) + scale_high: Scaling factor for high-frequency components (default: 1.5) + freq_cutoff: Number of frequency indices around center to consider as low-frequency (default: 20) + + Returns: + x_filtered: Filtered version of x in spatial domain with frequency-specific scaling applied. + """ + # Preserve input dtype and device + dtype, device = x.dtype, x.device + + # Convert to float32 for FFT computations + x = x.to(torch.float32) + + # 1) Apply FFT and shift low frequencies to center + x_freq = fft.fftn(x, dim=(-2, -1)) + x_freq = fft.fftshift(x_freq, dim=(-2, -1)) + + # 2) Create a mask to scale frequencies differently + B, C, H, W = x_freq.shape + crow, ccol = H // 2, W // 2 + + # Initialize mask with high-frequency scaling factor + mask = torch.ones((B, C, H, W), device=device) * scale_high + + # Apply low-frequency scaling factor to center region + mask[ + ..., + crow - freq_cutoff : crow + freq_cutoff, + ccol - freq_cutoff : ccol + freq_cutoff, + ] = scale_low + + # 3) Apply frequency-specific scaling + x_freq = x_freq * mask + + # 4) Convert back to spatial domain + x_freq = fft.ifftshift(x_freq, dim=(-2, -1)) + x_filtered = fft.ifftn(x_freq, dim=(-2, -1)).real + + # 5) Restore original dtype + x_filtered = x_filtered.to(dtype) + + return x_filtered + + +class FreSca: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "model": ("MODEL",), + "scale_low": ("FLOAT", {"default": 1.0, "min": 0, "max": 10, "step": 0.01, + "tooltip": "Scaling factor for low-frequency components"}), + "scale_high": ("FLOAT", {"default": 1.25, "min": 0, "max": 10, "step": 0.01, + "tooltip": "Scaling factor for high-frequency components"}), + "freq_cutoff": ("INT", {"default": 20, "min": 1, "max": 100, "step": 1, + "tooltip": "Number of frequency indices around center to consider as low-frequency"}), + } + } + RETURN_TYPES = ("MODEL",) + FUNCTION = "patch" + CATEGORY = "_for_testing" + DESCRIPTION = "Applies frequency-dependent scaling to the guidance" + def patch(self, model, scale_low, scale_high, freq_cutoff): + def custom_cfg_function(args): + cond = args["conds_out"][0] + uncond = args["conds_out"][1] + + guidance = cond - uncond + filtered_guidance = Fourier_filter( + guidance, + scale_low=scale_low, + scale_high=scale_high, + freq_cutoff=freq_cutoff, + ) + filtered_cond = filtered_guidance + uncond + + return [filtered_cond, uncond] + + m = model.clone() + m.set_model_sampler_pre_cfg_function(custom_cfg_function) + + return (m,) + + +NODE_CLASS_MAPPINGS = { + "FreSca": FreSca, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "FreSca": "FreSca", +} diff --git a/nodes.py b/nodes.py index ae0a2e183..fce3dcb3b 100644 --- a/nodes.py +++ b/nodes.py @@ -2281,7 +2281,8 @@ def init_builtin_extra_nodes(): "nodes_primitive.py", "nodes_cfg.py", "nodes_optimalsteps.py", - "nodes_hidream.py" + "nodes_hidream.py", + "nodes_fresca.py", ] import_failed = [] From 3dc240d08939bef67ed6e7308d6c68d6410bbfa5 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 17 Apr 2025 15:46:41 -0400 Subject: [PATCH 316/478] Make fresca work on multi dim. --- comfy_extras/nodes_fresca.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/comfy_extras/nodes_fresca.py b/comfy_extras/nodes_fresca.py index b0b86f235..fa573299a 100644 --- a/comfy_extras/nodes_fresca.py +++ b/comfy_extras/nodes_fresca.py @@ -26,19 +26,17 @@ def Fourier_filter(x, scale_low=1.0, scale_high=1.5, freq_cutoff=20): x_freq = fft.fftn(x, dim=(-2, -1)) x_freq = fft.fftshift(x_freq, dim=(-2, -1)) - # 2) Create a mask to scale frequencies differently - B, C, H, W = x_freq.shape - crow, ccol = H // 2, W // 2 - # Initialize mask with high-frequency scaling factor - mask = torch.ones((B, C, H, W), device=device) * scale_high + mask = torch.ones(x_freq.shape, device=device) * scale_high + m = mask + for d in range(len(x_freq.shape) - 2): + dim = d + 2 + cc = x_freq.shape[dim] // 2 + f_c = min(freq_cutoff, cc) + m = m.narrow(dim, cc - f_c, f_c * 2) # Apply low-frequency scaling factor to center region - mask[ - ..., - crow - freq_cutoff : crow + freq_cutoff, - ccol - freq_cutoff : ccol + freq_cutoff, - ] = scale_low + m[:] = scale_low # 3) Apply frequency-specific scaling x_freq = x_freq * mask From 880c205df1fca4491c78523eb52d1a388f89ef92 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 17 Apr 2025 16:58:27 -0400 Subject: [PATCH 317/478] Add hidream to readme. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a99aca0e7..cf6df7e55 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ See what ComfyUI can do with the [example workflows](https://comfyanonymous.gith - [HunyuanDiT](https://comfyanonymous.github.io/ComfyUI_examples/hunyuan_dit/) - [Flux](https://comfyanonymous.github.io/ComfyUI_examples/flux/) - [Lumina Image 2.0](https://comfyanonymous.github.io/ComfyUI_examples/lumina2/) + - [HiDream](https://comfyanonymous.github.io/ComfyUI_examples/hidream/) - Video Models - [Stable Video Diffusion](https://comfyanonymous.github.io/ComfyUI_examples/video/) - [Mochi](https://comfyanonymous.github.io/ComfyUI_examples/mochi/) From 55822faa05293dce6039d504695a12124a3eb35f Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Thu, 17 Apr 2025 21:02:24 -0400 Subject: [PATCH 318/478] [Type] Annotate graph.get_input_info (#7386) * [Type] Annotate graph.get_input_info * nit * nit --- comfy_execution/graph.py | 24 +++++++++++++++++++++--- execution.py | 31 ++++++++++++++++--------------- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/comfy_execution/graph.py b/comfy_execution/graph.py index 59b42b746..a2799b52e 100644 --- a/comfy_execution/graph.py +++ b/comfy_execution/graph.py @@ -1,6 +1,9 @@ -import nodes +from __future__ import annotations +from typing import Type, Literal +import nodes from comfy_execution.graph_utils import is_link +from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, InputTypeOptions class DependencyCycleError(Exception): pass @@ -54,7 +57,22 @@ class DynamicPrompt: def get_original_prompt(self): return self.original_prompt -def get_input_info(class_def, input_name, valid_inputs=None): +def get_input_info( + class_def: Type[ComfyNodeABC], + input_name: str, + valid_inputs: InputTypeDict | None = None +) -> tuple[str, Literal["required", "optional", "hidden"], InputTypeOptions] | tuple[None, None, None]: + """Get the input type, category, and extra info for a given input name. + + Arguments: + class_def: The class definition of the node. + input_name: The name of the input to get info for. + valid_inputs: The valid inputs for the node, or None to use the class_def.INPUT_TYPES(). + + Returns: + tuple[str, str, dict] | tuple[None, None, None]: The input type, category, and extra info for the input name. + """ + valid_inputs = valid_inputs or class_def.INPUT_TYPES() input_info = None input_category = None @@ -126,7 +144,7 @@ class TopologicalSort: from_node_id, from_socket = value if subgraph_nodes is not None and from_node_id not in subgraph_nodes: continue - input_type, input_category, input_info = self.get_input_info(unique_id, input_name) + _, _, input_info = self.get_input_info(unique_id, input_name) is_lazy = input_info is not None and "lazy" in input_info and input_info["lazy"] if (include_lazy or not is_lazy) and not self.is_cached(from_node_id): node_ids.append(from_node_id) diff --git a/execution.py b/execution.py index 9a5e27771..d09102f55 100644 --- a/execution.py +++ b/execution.py @@ -111,7 +111,7 @@ def get_input_data(inputs, class_def, unique_id, outputs=None, dynprompt=None, e missing_keys = {} for x in inputs: input_data = inputs[x] - input_type, input_category, input_info = get_input_info(class_def, x, valid_inputs) + _, input_category, input_info = get_input_info(class_def, x, valid_inputs) def mark_missing(): missing_keys[x] = True input_data_all[x] = (None,) @@ -574,7 +574,7 @@ def validate_inputs(prompt, item, validated): received_types = {} for x in valid_inputs: - type_input, input_category, extra_info = get_input_info(obj_class, x, class_inputs) + input_type, input_category, extra_info = get_input_info(obj_class, x, class_inputs) assert extra_info is not None if x not in inputs: if input_category == "required": @@ -590,7 +590,7 @@ def validate_inputs(prompt, item, validated): continue val = inputs[x] - info = (type_input, extra_info) + info = (input_type, extra_info) if isinstance(val, list): if len(val) != 2: error = { @@ -611,8 +611,8 @@ def validate_inputs(prompt, item, validated): r = nodes.NODE_CLASS_MAPPINGS[o_class_type].RETURN_TYPES received_type = r[val[1]] received_types[x] = received_type - if 'input_types' not in validate_function_inputs and not validate_node_input(received_type, type_input): - details = f"{x}, received_type({received_type}) mismatch input_type({type_input})" + if 'input_types' not in validate_function_inputs and not validate_node_input(received_type, input_type): + details = f"{x}, received_type({received_type}) mismatch input_type({input_type})" error = { "type": "return_type_mismatch", "message": "Return type mismatch between linked nodes", @@ -660,22 +660,22 @@ def validate_inputs(prompt, item, validated): val = val["__value__"] inputs[x] = val - if type_input == "INT": + if input_type == "INT": val = int(val) inputs[x] = val - if type_input == "FLOAT": + if input_type == "FLOAT": val = float(val) inputs[x] = val - if type_input == "STRING": + if input_type == "STRING": val = str(val) inputs[x] = val - if type_input == "BOOLEAN": + if input_type == "BOOLEAN": val = bool(val) inputs[x] = val except Exception as ex: error = { "type": "invalid_input_type", - "message": f"Failed to convert an input value to a {type_input} value", + "message": f"Failed to convert an input value to a {input_type} value", "details": f"{x}, {val}, {ex}", "extra_info": { "input_name": x, @@ -715,18 +715,19 @@ def validate_inputs(prompt, item, validated): errors.append(error) continue - if isinstance(type_input, list): - if val not in type_input: + if isinstance(input_type, list): + combo_options = input_type + if val not in combo_options: input_config = info list_info = "" # Don't send back gigantic lists like if they're lots of # scanned model filepaths - if len(type_input) > 20: - list_info = f"(list of length {len(type_input)})" + if len(combo_options) > 20: + list_info = f"(list of length {len(combo_options)})" input_config = None else: - list_info = str(type_input) + list_info = str(combo_options) error = { "type": "value_not_in_list", From 34e06bf7ecb6bca4631b746da5af433098db92c7 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Fri, 18 Apr 2025 02:52:18 -0400 Subject: [PATCH 319/478] add support to output camera state (#7582) --- comfy_extras/nodes_load_3d.py | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/comfy_extras/nodes_load_3d.py b/comfy_extras/nodes_load_3d.py index db30030fb..53d892bc4 100644 --- a/comfy_extras/nodes_load_3d.py +++ b/comfy_extras/nodes_load_3d.py @@ -21,8 +21,8 @@ class Load3D(): "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), }} - RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "IMAGE") - RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "lineart") + RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "IMAGE", "LOAD3D_CAMERA") + RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "lineart", "camera_info") FUNCTION = "process" EXPERIMENTAL = True @@ -41,7 +41,7 @@ class Load3D(): normal_image, ignore_mask2 = load_image_node.load_image(image=normal_path) lineart_image, ignore_mask3 = load_image_node.load_image(image=lineart_path) - return output_image, output_mask, model_file, normal_image, lineart_image + return output_image, output_mask, model_file, normal_image, lineart_image, image['camera_info'] class Load3DAnimation(): @classmethod @@ -59,8 +59,8 @@ class Load3DAnimation(): "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), }} - RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE") - RETURN_NAMES = ("image", "mask", "mesh_path", "normal") + RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "LOAD3D_CAMERA") + RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "camera_info") FUNCTION = "process" EXPERIMENTAL = True @@ -77,13 +77,16 @@ class Load3DAnimation(): ignore_image, output_mask = load_image_node.load_image(image=mask_path) normal_image, ignore_mask2 = load_image_node.load_image(image=normal_path) - return output_image, output_mask, model_file, normal_image + return output_image, output_mask, model_file, normal_image, image['camera_info'] class Preview3D(): @classmethod def INPUT_TYPES(s): return {"required": { "model_file": ("STRING", {"default": "", "multiline": False}), + }, + "optional": { + "camera_info": ("LOAD3D_CAMERA", {}) }} OUTPUT_NODE = True @@ -95,13 +98,22 @@ class Preview3D(): EXPERIMENTAL = True def process(self, model_file, **kwargs): - return {"ui": {"model_file": [model_file]}, "result": ()} + camera_info = kwargs.get("camera_info", None) + + return { + "ui": { + "result": [model_file, camera_info] + } + } class Preview3DAnimation(): @classmethod def INPUT_TYPES(s): return {"required": { "model_file": ("STRING", {"default": "", "multiline": False}), + }, + "optional": { + "camera_info": ("LOAD3D_CAMERA", {}) }} OUTPUT_NODE = True @@ -113,7 +125,13 @@ class Preview3DAnimation(): EXPERIMENTAL = True def process(self, model_file, **kwargs): - return {"ui": {"model_file": [model_file]}, "result": ()} + camera_info = kwargs.get("camera_info", None) + + return { + "ui": { + "result": [model_file, camera_info] + } + } NODE_CLASS_MAPPINGS = { "Load3D": Load3D, From 2383a39e3baa11344b0a23b51e3c2f5deff0fc27 Mon Sep 17 00:00:00 2001 From: City <125218114+city96@users.noreply.github.com> Date: Fri, 18 Apr 2025 08:53:36 +0200 Subject: [PATCH 320/478] Replace CLIPType if with getattr (#7589) * Replace CLIPType if with getattr * Forgot to remove breakpoint from testing --- nodes.py | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/nodes.py b/nodes.py index fce3dcb3b..d4082d19d 100644 --- a/nodes.py +++ b/nodes.py @@ -930,26 +930,7 @@ class CLIPLoader: DESCRIPTION = "[Recipes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 xxl/ clip-g / clip-l\nstable_audio: t5 base\nmochi: t5 xxl\ncosmos: old t5 xxl\nlumina2: gemma 2 2B\nwan: umt5 xxl" def load_clip(self, clip_name, type="stable_diffusion", device="default"): - if type == "stable_cascade": - clip_type = comfy.sd.CLIPType.STABLE_CASCADE - elif type == "sd3": - clip_type = comfy.sd.CLIPType.SD3 - elif type == "stable_audio": - clip_type = comfy.sd.CLIPType.STABLE_AUDIO - elif type == "mochi": - clip_type = comfy.sd.CLIPType.MOCHI - elif type == "ltxv": - clip_type = comfy.sd.CLIPType.LTXV - elif type == "pixart": - clip_type = comfy.sd.CLIPType.PIXART - elif type == "cosmos": - clip_type = comfy.sd.CLIPType.COSMOS - elif type == "lumina2": - clip_type = comfy.sd.CLIPType.LUMINA2 - elif type == "wan": - clip_type = comfy.sd.CLIPType.WAN - else: - clip_type = comfy.sd.CLIPType.STABLE_DIFFUSION + clip_type = getattr(comfy.sd.CLIPType, type.upper(), comfy.sd.CLIPType.STABLE_DIFFUSION) model_options = {} if device == "cpu": @@ -977,16 +958,10 @@ class DualCLIPLoader: DESCRIPTION = "[Recipes]\n\nsdxl: clip-l, clip-g\nsd3: clip-l, clip-g / clip-l, t5 / clip-g, t5\nflux: clip-l, t5" def load_clip(self, clip_name1, clip_name2, type, device="default"): + clip_type = getattr(comfy.sd.CLIPType, type.upper(), comfy.sd.CLIPType.STABLE_DIFFUSION) + clip_path1 = folder_paths.get_full_path_or_raise("text_encoders", clip_name1) clip_path2 = folder_paths.get_full_path_or_raise("text_encoders", clip_name2) - if type == "sdxl": - clip_type = comfy.sd.CLIPType.STABLE_DIFFUSION - elif type == "sd3": - clip_type = comfy.sd.CLIPType.SD3 - elif type == "flux": - clip_type = comfy.sd.CLIPType.FLUX - elif type == "hunyuan_video": - clip_type = comfy.sd.CLIPType.HUNYUAN_VIDEO model_options = {} if device == "cpu": From 7ecd5e961465d9bb20fb12b7068e1930da875b0e Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 18 Apr 2025 03:16:16 -0400 Subject: [PATCH 321/478] Increase freq_cutoff in FreSca node. --- comfy_extras/nodes_fresca.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy_extras/nodes_fresca.py b/comfy_extras/nodes_fresca.py index fa573299a..ee310c874 100644 --- a/comfy_extras/nodes_fresca.py +++ b/comfy_extras/nodes_fresca.py @@ -61,7 +61,7 @@ class FreSca: "tooltip": "Scaling factor for low-frequency components"}), "scale_high": ("FLOAT", {"default": 1.25, "min": 0, "max": 10, "step": 0.01, "tooltip": "Scaling factor for high-frequency components"}), - "freq_cutoff": ("INT", {"default": 20, "min": 1, "max": 100, "step": 1, + "freq_cutoff": ("INT", {"default": 20, "min": 1, "max": 10000, "step": 1, "tooltip": "Number of frequency indices around center to consider as low-frequency"}), } } From f3b09b9f2d374518449d4e0211dbb21b95858eb5 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 18 Apr 2025 15:12:42 -0400 Subject: [PATCH 322/478] [BugFix] Update frontend to 1.16.9 (#7655) Backport https://github.com/Comfy-Org/ComfyUI_frontend/pull/3505 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 278e3eaa8..ff9f66a77 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.16.8 +comfyui-frontend-package==1.16.9 comfyui-workflow-templates==0.1.1 torch torchsde From dc300a45698e5cb85f155b8fcb899b1df3c0f855 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Sat, 19 Apr 2025 12:21:46 -0700 Subject: [PATCH 323/478] Add wanfun template workflows. (#7678) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ff9f66a77..5c3a854ce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ comfyui-frontend-package==1.16.9 -comfyui-workflow-templates==0.1.1 +comfyui-workflow-templates==0.1.3 torch torchsde torchvision From 636d4bfb8994c7f123f15971af5d38a9754377ab Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 19 Apr 2025 15:55:43 -0400 Subject: [PATCH 324/478] Fix hard crash when the spiece tokenizer path is bad. --- comfy/text_encoders/spiece_tokenizer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/comfy/text_encoders/spiece_tokenizer.py b/comfy/text_encoders/spiece_tokenizer.py index 21df4f863..caccb3ca2 100644 --- a/comfy/text_encoders/spiece_tokenizer.py +++ b/comfy/text_encoders/spiece_tokenizer.py @@ -1,4 +1,5 @@ import torch +import os class SPieceTokenizer: @staticmethod @@ -15,6 +16,8 @@ class SPieceTokenizer: if isinstance(tokenizer_path, bytes): self.tokenizer = sentencepiece.SentencePieceProcessor(model_proto=tokenizer_path, add_bos=self.add_bos, add_eos=self.add_eos) else: + if not os.path.isfile(tokenizer_path): + raise ValueError("invalid tokenizer") self.tokenizer = sentencepiece.SentencePieceProcessor(model_file=tokenizer_path, add_bos=self.add_bos, add_eos=self.add_eos) def get_vocab(self): From 4486b0d0ff536b32100863f68e870ba18bf3d051 Mon Sep 17 00:00:00 2001 From: Yoland Yan <4950057+yoland68@users.noreply.github.com> Date: Sat, 19 Apr 2025 14:23:31 -0700 Subject: [PATCH 325/478] Update CODEOWNERS and add christian-byrne (#7663) --- CODEOWNERS | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 72a59effe..013ea8622 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -5,20 +5,20 @@ # Inlined the team members for now. # Maintainers -*.md @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink -/tests/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink -/tests-unit/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink -/notebooks/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink -/script_examples/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink -/.github/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink -/requirements.txt @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink -/pyproject.toml @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink +*.md @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink @christian-byrne +/tests/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink @christian-byrne +/tests-unit/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink @christian-byrne +/notebooks/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink @christian-byrne +/script_examples/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink @christian-byrne +/.github/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink @christian-byrne +/requirements.txt @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink @christian-byrne +/pyproject.toml @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @Kosinkadink @christian-byrne # Python web server -/api_server/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata -/app/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata -/utils/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata +/api_server/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @christian-byrne +/app/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @christian-byrne +/utils/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata @christian-byrne # Node developers -/comfy_extras/ @yoland68 @robinjhuang @huchenlei @pythongosssss @ltdrdata @Kosinkadink @webfiltered -/comfy/comfy_types/ @yoland68 @robinjhuang @huchenlei @pythongosssss @ltdrdata @Kosinkadink @webfiltered +/comfy_extras/ @yoland68 @robinjhuang @huchenlei @pythongosssss @ltdrdata @Kosinkadink @webfiltered @christian-byrne +/comfy/comfy_types/ @yoland68 @robinjhuang @huchenlei @pythongosssss @ltdrdata @Kosinkadink @webfiltered @christian-byrne From f43e1d7f415374cea5bf7561d8e1278e1e52c95a Mon Sep 17 00:00:00 2001 From: power88 <741815398@qq.com> Date: Sun, 20 Apr 2025 07:47:30 +0800 Subject: [PATCH 326/478] Hidream: Allow loading hidream text encoders in CLIPLoader and DualCLIPLoader (#7676) * Hidream: Allow partial loading text encoders * reformat code for ruff check. --- comfy/sd.py | 34 ++++++++++++++++++++++++++++++++++ comfy/text_encoders/hidream.py | 4 ++++ nodes.py | 8 ++++---- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/comfy/sd.py b/comfy/sd.py index d97873ba2..8aba5d655 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -703,6 +703,7 @@ class CLIPType(Enum): COSMOS = 11 LUMINA2 = 12 WAN = 13 + HIDREAM = 14 def load_clip(ckpt_paths, embedding_directory=None, clip_type=CLIPType.STABLE_DIFFUSION, model_options={}): @@ -791,6 +792,9 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip elif clip_type == CLIPType.SD3: clip_target.clip = comfy.text_encoders.sd3_clip.sd3_clip(clip_l=False, clip_g=True, t5=False) clip_target.tokenizer = comfy.text_encoders.sd3_clip.SD3Tokenizer + elif clip_type == CLIPType.HIDREAM: + clip_target.clip = comfy.text_encoders.hidream.hidream_clip(clip_l=False, clip_g=True, t5=False, llama=False, dtype_t5=None, dtype_llama=None, t5xxl_scaled_fp8=None, llama_scaled_fp8=None) + clip_target.tokenizer = comfy.text_encoders.hidream.HiDreamTokenizer else: clip_target.clip = sdxl_clip.SDXLRefinerClipModel clip_target.tokenizer = sdxl_clip.SDXLTokenizer @@ -811,6 +815,10 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip clip_target.clip = comfy.text_encoders.wan.te(**t5xxl_detect(clip_data)) clip_target.tokenizer = comfy.text_encoders.wan.WanT5Tokenizer tokenizer_data["spiece_model"] = clip_data[0].get("spiece_model", None) + elif clip_type == CLIPType.HIDREAM: + clip_target.clip = comfy.text_encoders.hidream.hidream_clip(**t5xxl_detect(clip_data), + clip_l=False, clip_g=False, t5=True, llama=False, dtype_llama=None, llama_scaled_fp8=None) + clip_target.tokenizer = comfy.text_encoders.hidream.HiDreamTokenizer else: #CLIPType.MOCHI clip_target.clip = comfy.text_encoders.genmo.mochi_te(**t5xxl_detect(clip_data)) clip_target.tokenizer = comfy.text_encoders.genmo.MochiT5Tokenizer @@ -827,10 +835,18 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip clip_target.clip = comfy.text_encoders.lumina2.te(**llama_detect(clip_data)) clip_target.tokenizer = comfy.text_encoders.lumina2.LuminaTokenizer tokenizer_data["spiece_model"] = clip_data[0].get("spiece_model", None) + elif te_model == TEModel.LLAMA3_8: + clip_target.clip = comfy.text_encoders.hidream.hidream_clip(**llama_detect(clip_data), + clip_l=False, clip_g=False, t5=False, llama=True, dtype_t5=None, t5xxl_scaled_fp8=None) + clip_target.tokenizer = comfy.text_encoders.hidream.HiDreamTokenizer else: + # clip_l if clip_type == CLIPType.SD3: clip_target.clip = comfy.text_encoders.sd3_clip.sd3_clip(clip_l=True, clip_g=False, t5=False) clip_target.tokenizer = comfy.text_encoders.sd3_clip.SD3Tokenizer + elif clip_type == CLIPType.HIDREAM: + clip_target.clip = comfy.text_encoders.hidream.hidream_clip(clip_l=True, clip_g=False, t5=False, llama=False, dtype_t5=None, dtype_llama=None, t5xxl_scaled_fp8=None, llama_scaled_fp8=None) + clip_target.tokenizer = comfy.text_encoders.hidream.HiDreamTokenizer else: clip_target.clip = sd1_clip.SD1ClipModel clip_target.tokenizer = sd1_clip.SD1Tokenizer @@ -848,6 +864,24 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip elif clip_type == CLIPType.HUNYUAN_VIDEO: clip_target.clip = comfy.text_encoders.hunyuan_video.hunyuan_video_clip(**llama_detect(clip_data)) clip_target.tokenizer = comfy.text_encoders.hunyuan_video.HunyuanVideoTokenizer + elif clip_type == CLIPType.HIDREAM: + # Detect + hidream_dualclip_classes = [] + for hidream_te in clip_data: + te_model = detect_te_model(hidream_te) + hidream_dualclip_classes.append(te_model) + + clip_l = TEModel.CLIP_L in hidream_dualclip_classes + clip_g = TEModel.CLIP_G in hidream_dualclip_classes + t5 = TEModel.T5_XXL in hidream_dualclip_classes + llama = TEModel.LLAMA3_8 in hidream_dualclip_classes + + # Initialize t5xxl_detect and llama_detect kwargs if needed + t5_kwargs = t5xxl_detect(clip_data) if t5 else {} + llama_kwargs = llama_detect(clip_data) if llama else {} + + clip_target.clip = comfy.text_encoders.hidream.hidream_clip(clip_l=clip_l, clip_g=clip_g, t5=t5, llama=llama, **t5_kwargs, **llama_kwargs) + clip_target.tokenizer = comfy.text_encoders.hidream.HiDreamTokenizer else: clip_target.clip = sdxl_clip.SDXLClipModel clip_target.tokenizer = sdxl_clip.SDXLTokenizer diff --git a/comfy/text_encoders/hidream.py b/comfy/text_encoders/hidream.py index 6c34c5572..ca54eaa78 100644 --- a/comfy/text_encoders/hidream.py +++ b/comfy/text_encoders/hidream.py @@ -109,11 +109,15 @@ class HiDreamTEModel(torch.nn.Module): if self.t5xxl is not None: t5_output = self.t5xxl.encode_token_weights(token_weight_pairs_t5) t5_out, t5_pooled = t5_output[:2] + else: + t5_out = None if self.llama is not None: ll_output = self.llama.encode_token_weights(token_weight_pairs_llama) ll_out, ll_pooled = ll_output[:2] ll_out = ll_out[:, 1:] + else: + ll_out = None if t5_out is None: t5_out = torch.zeros((1, 1, 4096), device=comfy.model_management.intermediate_device()) diff --git a/nodes.py b/nodes.py index d4082d19d..b1ab62aad 100644 --- a/nodes.py +++ b/nodes.py @@ -917,7 +917,7 @@ class CLIPLoader: @classmethod def INPUT_TYPES(s): return {"required": { "clip_name": (folder_paths.get_filename_list("text_encoders"), ), - "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart", "cosmos", "lumina2", "wan"], ), + "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart", "cosmos", "lumina2", "wan", "hidream"], ), }, "optional": { "device": (["default", "cpu"], {"advanced": True}), @@ -927,7 +927,7 @@ class CLIPLoader: CATEGORY = "advanced/loaders" - DESCRIPTION = "[Recipes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 xxl/ clip-g / clip-l\nstable_audio: t5 base\nmochi: t5 xxl\ncosmos: old t5 xxl\nlumina2: gemma 2 2B\nwan: umt5 xxl" + DESCRIPTION = "[Recipes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 xxl/ clip-g / clip-l\nstable_audio: t5 base\nmochi: t5 xxl\ncosmos: old t5 xxl\nlumina2: gemma 2 2B\nwan: umt5 xxl\n hidream: llama-3.1 (Recommend) or t5" def load_clip(self, clip_name, type="stable_diffusion", device="default"): clip_type = getattr(comfy.sd.CLIPType, type.upper(), comfy.sd.CLIPType.STABLE_DIFFUSION) @@ -945,7 +945,7 @@ class DualCLIPLoader: def INPUT_TYPES(s): return {"required": { "clip_name1": (folder_paths.get_filename_list("text_encoders"), ), "clip_name2": (folder_paths.get_filename_list("text_encoders"), ), - "type": (["sdxl", "sd3", "flux", "hunyuan_video"], ), + "type": (["sdxl", "sd3", "flux", "hunyuan_video", "hidream"], ), }, "optional": { "device": (["default", "cpu"], {"advanced": True}), @@ -955,7 +955,7 @@ class DualCLIPLoader: CATEGORY = "advanced/loaders" - DESCRIPTION = "[Recipes]\n\nsdxl: clip-l, clip-g\nsd3: clip-l, clip-g / clip-l, t5 / clip-g, t5\nflux: clip-l, t5" + DESCRIPTION = "[Recipes]\n\nsdxl: clip-l, clip-g\nsd3: clip-l, clip-g / clip-l, t5 / clip-g, t5\nflux: clip-l, t5\nhidream: at least one of t5 or llama, recommended t5 and llama" def load_clip(self, clip_name1, clip_name2, type, device="default"): clip_type = getattr(comfy.sd.CLIPType, type.upper(), comfy.sd.CLIPType.STABLE_DIFFUSION) From fd274944418f1148b762a6e2d37efa820a569071 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 19 Apr 2025 19:49:40 -0400 Subject: [PATCH 327/478] Use empty t5 of size 128 for hidream, seems to give closer results. --- comfy/text_encoders/hidream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/text_encoders/hidream.py b/comfy/text_encoders/hidream.py index ca54eaa78..8e1abcfc1 100644 --- a/comfy/text_encoders/hidream.py +++ b/comfy/text_encoders/hidream.py @@ -120,7 +120,7 @@ class HiDreamTEModel(torch.nn.Module): ll_out = None if t5_out is None: - t5_out = torch.zeros((1, 1, 4096), device=comfy.model_management.intermediate_device()) + t5_out = torch.zeros((1, 128, 4096), device=comfy.model_management.intermediate_device()) if ll_out is None: ll_out = torch.zeros((1, 32, 1, 4096), device=comfy.model_management.intermediate_device()) From 2c735c13b4fbdb9ffa654b0afadb4e05d729dd65 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sun, 20 Apr 2025 08:33:27 -0700 Subject: [PATCH 328/478] Slightly better fix for #7687 --- comfy/controlnet.py | 1 + 1 file changed, 1 insertion(+) diff --git a/comfy/controlnet.py b/comfy/controlnet.py index ceb24c852..11483e21d 100644 --- a/comfy/controlnet.py +++ b/comfy/controlnet.py @@ -736,6 +736,7 @@ def load_controlnet_state_dict(state_dict, model=None, model_options={}): return control def load_controlnet(ckpt_path, model=None, model_options={}): + model_options = model_options.copy() if "global_average_pooling" not in model_options: filename = os.path.splitext(ckpt_path)[0] if filename.endswith("_shuffle") or filename.endswith("_shuffle_fp16"): #TODO: smarter way of enabling global_average_pooling From 11b72c9c55d469c6f256eb0a8598e251ce504120 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sun, 20 Apr 2025 23:41:51 -0700 Subject: [PATCH 329/478] CLIPTextEncodeHiDream. (#7703) --- comfy_extras/nodes_hidream.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/comfy_extras/nodes_hidream.py b/comfy_extras/nodes_hidream.py index 5a160c2ba..dfb98597b 100644 --- a/comfy_extras/nodes_hidream.py +++ b/comfy_extras/nodes_hidream.py @@ -26,7 +26,30 @@ class QuadrupleCLIPLoader: clip = comfy.sd.load_clip(ckpt_paths=[clip_path1, clip_path2, clip_path3, clip_path4], embedding_directory=folder_paths.get_folder_paths("embeddings")) return (clip,) +class CLIPTextEncodeHiDream: + @classmethod + def INPUT_TYPES(s): + return {"required": { + "clip": ("CLIP", ), + "clip_l": ("STRING", {"multiline": True, "dynamicPrompts": True}), + "clip_g": ("STRING", {"multiline": True, "dynamicPrompts": True}), + "t5xxl": ("STRING", {"multiline": True, "dynamicPrompts": True}), + "llama": ("STRING", {"multiline": True, "dynamicPrompts": True}) + }} + RETURN_TYPES = ("CONDITIONING",) + FUNCTION = "encode" + + CATEGORY = "advanced/conditioning" + + def encode(self, clip, clip_l, clip_g, t5xxl, llama): + + tokens = clip.tokenize(clip_g) + tokens["l"] = clip.tokenize(clip_l)["l"] + tokens["t5xxl"] = clip.tokenize(t5xxl)["t5xxl"] + tokens["llama"] = clip.tokenize(llama)["llama"] + return (clip.encode_from_tokens_scheduled(tokens), ) NODE_CLASS_MAPPINGS = { "QuadrupleCLIPLoader": QuadrupleCLIPLoader, + "CLIPTextEncodeHiDream": CLIPTextEncodeHiDream, } From b6fd3ffd10cd367f80c44a1920151d65219b0f9d Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Mon, 21 Apr 2025 14:39:45 -0400 Subject: [PATCH 330/478] Populate AUTH_TOKEN_COMFY_ORG hidden input (#7709) --- execution.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/execution.py b/execution.py index d09102f55..feb61ae82 100644 --- a/execution.py +++ b/execution.py @@ -144,6 +144,8 @@ def get_input_data(inputs, class_def, unique_id, outputs=None, dynprompt=None, e input_data_all[x] = [extra_data.get('extra_pnginfo', None)] if h[x] == "UNIQUE_ID": input_data_all[x] = [unique_id] + if h[x] == "AUTH_TOKEN_COMFY_ORG": + input_data_all[x] = [extra_data.get("auth_token_comfy_org", None)] return input_data_all, missing_keys map_node_over_list = None #Don't hook this please From ce22f687cc35b4414d792dd75812446ef56aa627 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Mon, 21 Apr 2025 11:40:29 -0700 Subject: [PATCH 331/478] Support for WAN VACE preview model. (#7711) * Support for WAN VACE preview model. * Remove print. --- comfy/ldm/wan/model.py | 144 +++++++++++++++++++++++++++++++++++++- comfy/model_base.py | 28 ++++++++ comfy/model_detection.py | 11 ++- comfy/supported_models.py | 12 +++- comfy_extras/nodes_wan.py | 106 ++++++++++++++++++++++++++++ 5 files changed, 295 insertions(+), 6 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index 2a30497c5..5e7848bd5 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -220,6 +220,34 @@ class WanAttentionBlock(nn.Module): return x +class VaceWanAttentionBlock(WanAttentionBlock): + def __init__( + self, + cross_attn_type, + dim, + ffn_dim, + num_heads, + window_size=(-1, -1), + qk_norm=True, + cross_attn_norm=False, + eps=1e-6, + block_id=0, + operation_settings={} + ): + super().__init__(cross_attn_type, dim, ffn_dim, num_heads, window_size, qk_norm, cross_attn_norm, eps, operation_settings=operation_settings) + self.block_id = block_id + if block_id == 0: + self.before_proj = operation_settings.get("operations").Linear(self.dim, self.dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.after_proj = operation_settings.get("operations").Linear(self.dim, self.dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + + def forward(self, c, x, **kwargs): + if self.block_id == 0: + c = self.before_proj(c) + x + c = super().forward(c, **kwargs) + c_skip = self.after_proj(c) + return c_skip, c + + class Head(nn.Module): def __init__(self, dim, out_dim, patch_size, eps=1e-6, operation_settings={}): @@ -395,6 +423,7 @@ class WanModel(torch.nn.Module): clip_fea=None, freqs=None, transformer_options={}, + **kwargs, ): r""" Forward pass through the diffusion model @@ -457,7 +486,7 @@ class WanModel(torch.nn.Module): x = self.unpatchify(x, grid_sizes) return x - def forward(self, x, timestep, context, clip_fea=None, transformer_options={},**kwargs): + def forward(self, x, timestep, context, clip_fea=None, transformer_options={}, **kwargs): bs, c, t, h, w = x.shape x = comfy.ldm.common_dit.pad_to_patch_size(x, self.patch_size) patch_size = self.patch_size @@ -471,7 +500,7 @@ class WanModel(torch.nn.Module): img_ids = repeat(img_ids, "t h w c -> b (t h w) c", b=bs) freqs = self.rope_embedder(img_ids).movedim(1, 2) - return self.forward_orig(x, timestep, context, clip_fea=clip_fea, freqs=freqs, transformer_options=transformer_options)[:, :, :t, :h, :w] + return self.forward_orig(x, timestep, context, clip_fea=clip_fea, freqs=freqs, transformer_options=transformer_options, **kwargs)[:, :, :t, :h, :w] def unpatchify(self, x, grid_sizes): r""" @@ -496,3 +525,114 @@ class WanModel(torch.nn.Module): u = torch.einsum('bfhwpqrc->bcfphqwr', u) u = u.reshape(b, c, *[i * j for i, j in zip(grid_sizes, self.patch_size)]) return u + + +class VaceWanModel(WanModel): + r""" + Wan diffusion backbone supporting both text-to-video and image-to-video. + """ + + def __init__(self, + model_type='vace', + patch_size=(1, 2, 2), + text_len=512, + in_dim=16, + dim=2048, + ffn_dim=8192, + freq_dim=256, + text_dim=4096, + out_dim=16, + num_heads=16, + num_layers=32, + window_size=(-1, -1), + qk_norm=True, + cross_attn_norm=True, + eps=1e-6, + flf_pos_embed_token_number=None, + image_model=None, + vace_layers=None, + vace_in_dim=None, + device=None, + dtype=None, + operations=None, + ): + + super().__init__(model_type='t2v', patch_size=patch_size, text_len=text_len, in_dim=in_dim, dim=dim, ffn_dim=ffn_dim, freq_dim=freq_dim, text_dim=text_dim, out_dim=out_dim, num_heads=num_heads, num_layers=num_layers, window_size=window_size, qk_norm=qk_norm, cross_attn_norm=cross_attn_norm, eps=eps, flf_pos_embed_token_number=flf_pos_embed_token_number, image_model=image_model, device=device, dtype=dtype, operations=operations) + operation_settings = {"operations": operations, "device": device, "dtype": dtype} + + # Vace + if vace_layers is not None: + self.vace_layers = vace_layers + self.vace_in_dim = vace_in_dim + # vace blocks + self.vace_blocks = nn.ModuleList([ + VaceWanAttentionBlock('t2v_cross_attn', self.dim, self.ffn_dim, self.num_heads, self.window_size, self.qk_norm, self.cross_attn_norm, self.eps, block_id=i, operation_settings=operation_settings) + for i in range(self.vace_layers) + ]) + + self.vace_layers_mapping = {i: n for n, i in enumerate(range(0, self.num_layers, self.num_layers // self.vace_layers))} + # vace patch embeddings + self.vace_patch_embedding = operations.Conv3d( + self.vace_in_dim, self.dim, kernel_size=self.patch_size, stride=self.patch_size, device=device, dtype=torch.float32 + ) + + def forward_orig( + self, + x, + t, + context, + vace_context, + clip_fea=None, + freqs=None, + transformer_options={}, + **kwargs, + ): + # embeddings + x = self.patch_embedding(x.float()).to(x.dtype) + grid_sizes = x.shape[2:] + x = x.flatten(2).transpose(1, 2) + + # time embeddings + e = self.time_embedding( + sinusoidal_embedding_1d(self.freq_dim, t).to(dtype=x[0].dtype)) + e0 = self.time_projection(e).unflatten(1, (6, self.dim)) + + # context + context = self.text_embedding(context) + + context_img_len = None + if clip_fea is not None: + if self.img_emb is not None: + context_clip = self.img_emb(clip_fea) # bs x 257 x dim + context = torch.concat([context_clip, context], dim=1) + context_img_len = clip_fea.shape[-2] + + c = self.vace_patch_embedding(vace_context.float()).to(vace_context.dtype) + c = c.flatten(2).transpose(1, 2) + + # arguments + x_orig = x + + patches_replace = transformer_options.get("patches_replace", {}) + blocks_replace = patches_replace.get("dit", {}) + for i, block in enumerate(self.blocks): + if ("double_block", i) in blocks_replace: + def block_wrap(args): + out = {} + out["img"] = block(args["img"], context=args["txt"], e=args["vec"], freqs=args["pe"], context_img_len=context_img_len) + return out + out = blocks_replace[("double_block", i)]({"img": x, "txt": context, "vec": e0, "pe": freqs}, {"original_block": block_wrap}) + x = out["img"] + else: + x = block(x, e=e0, freqs=freqs, context=context, context_img_len=context_img_len) + + ii = self.vace_layers_mapping.get(i, None) + if ii is not None: + c_skip, c = self.vace_blocks[ii](c, x=x_orig, e=e0, freqs=freqs, context=context, context_img_len=context_img_len) + x += c_skip + # head + x = self.head(x, e) + + # unpatchify + x = self.unpatchify(x, grid_sizes) + return x diff --git a/comfy/model_base.py b/comfy/model_base.py index 8dab1740b..04a101526 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -1043,6 +1043,34 @@ class WAN21(BaseModel): out['clip_fea'] = comfy.conds.CONDRegular(clip_vision_output.penultimate_hidden_states) return out + +class WAN21_Vace(WAN21): + def __init__(self, model_config, model_type=ModelType.FLOW, image_to_video=False, device=None): + super(WAN21, self).__init__(model_config, model_type, device=device, unet_model=comfy.ldm.wan.model.VaceWanModel) + self.image_to_video = image_to_video + + def extra_conds(self, **kwargs): + out = super().extra_conds(**kwargs) + noise = kwargs.get("noise", None) + noise_shape = list(noise.shape) + vace_frames = kwargs.get("vace_frames", None) + if vace_frames is None: + noise_shape[1] = 32 + vace_frames = torch.zeros(noise_shape, device=noise.device, dtype=noise.dtype) + + for i in range(0, vace_frames.shape[1], 16): + vace_frames = vace_frames.clone() + vace_frames[:, i:i + 16] = self.process_latent_in(vace_frames[:, i:i + 16]) + + mask = kwargs.get("vace_mask", None) + if mask is None: + noise_shape[1] = 64 + mask = torch.ones(noise_shape, device=noise.device, dtype=noise.dtype) + + out['vace_context'] = comfy.conds.CONDRegular(torch.cat([vace_frames.to(noise), mask.to(noise)], dim=1)) + return out + + class Hunyuan3Dv2(BaseModel): def __init__(self, model_config, model_type=ModelType.FLOW, device=None): super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.hunyuan3d.model.Hunyuan3Dv2) diff --git a/comfy/model_detection.py b/comfy/model_detection.py index 6499bf238..76de78a8a 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -317,10 +317,15 @@ def detect_unet_config(state_dict, key_prefix, metadata=None): dit_config["cross_attn_norm"] = True dit_config["eps"] = 1e-6 dit_config["in_dim"] = state_dict['{}patch_embedding.weight'.format(key_prefix)].shape[1] - if '{}img_emb.proj.0.bias'.format(key_prefix) in state_dict_keys: - dit_config["model_type"] = "i2v" + if '{}vace_patch_embedding.weight'.format(key_prefix) in state_dict_keys: + dit_config["model_type"] = "vace" + dit_config["vace_in_dim"] = state_dict['{}vace_patch_embedding.weight'.format(key_prefix)].shape[1] + dit_config["vace_layers"] = count_blocks(state_dict_keys, '{}vace_blocks.'.format(key_prefix) + '{}.') else: - dit_config["model_type"] = "t2v" + if '{}img_emb.proj.0.bias'.format(key_prefix) in state_dict_keys: + dit_config["model_type"] = "i2v" + else: + dit_config["model_type"] = "t2v" flf_weight = state_dict.get('{}img_emb.emb_pos'.format(key_prefix)) if flf_weight is not None: dit_config["flf_pos_embed_token_number"] = flf_weight.shape[1] diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 81c47ac68..5e55035cf 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -987,6 +987,16 @@ class WAN21_FunControl2V(WAN21_T2V): out = model_base.WAN21(self, image_to_video=False, device=device) return out +class WAN21_Vace(WAN21_T2V): + unet_config = { + "image_model": "wan2.1", + "model_type": "vace", + } + + def get_model(self, state_dict, prefix="", device=None): + out = model_base.WAN21_Vace(self, image_to_video=False, device=device) + return out + class Hunyuan3Dv2(supported_models_base.BASE): unet_config = { "image_model": "hunyuan3d2", @@ -1055,6 +1065,6 @@ class HiDream(supported_models_base.BASE): return None # TODO -models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, WAN21_FunControl2V, Hunyuan3Dv2mini, Hunyuan3Dv2, HiDream] +models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, WAN21_FunControl2V, WAN21_Vace, Hunyuan3Dv2mini, Hunyuan3Dv2, HiDream] models += [SVD_img2vid] diff --git a/comfy_extras/nodes_wan.py b/comfy_extras/nodes_wan.py index 8ad358ce8..19a6cdfa4 100644 --- a/comfy_extras/nodes_wan.py +++ b/comfy_extras/nodes_wan.py @@ -193,9 +193,115 @@ class WanFunInpaintToVideo: return flfv.encode(positive, negative, vae, width, height, length, batch_size, start_image=start_image, end_image=end_image, clip_vision_start_image=clip_vision_output) +class WanVaceToVideo: + @classmethod + def INPUT_TYPES(s): + return {"required": {"positive": ("CONDITIONING", ), + "negative": ("CONDITIONING", ), + "vae": ("VAE", ), + "width": ("INT", {"default": 832, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "height": ("INT", {"default": 480, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "length": ("INT", {"default": 81, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}), + "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), + }, + "optional": {"control_video": ("IMAGE", ), + "control_masks": ("MASK", ), + "reference_image": ("IMAGE", ), + }} + + RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT", "INT") + RETURN_NAMES = ("positive", "negative", "latent", "trim_latent") + FUNCTION = "encode" + + CATEGORY = "conditioning/video_models" + + EXPERIMENTAL = True + + def encode(self, positive, negative, vae, width, height, length, batch_size, control_video=None, control_masks=None, reference_image=None): + latent_length = ((length - 1) // 4) + 1 + if control_video is not None: + control_video = comfy.utils.common_upscale(control_video[:length].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + if control_video.shape[0] < length: + control_video = torch.nn.functional.pad(control_video, (0, 0, 0, 0, 0, 0, 0, length - control_video.shape[0]), value=0.5) + else: + control_video = torch.ones((length, height, width, 3)) * 0.5 + + if reference_image is not None: + reference_image = comfy.utils.common_upscale(reference_image[:1].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + reference_image = vae.encode(reference_image[:, :, :, :3]) + reference_image = torch.cat([reference_image, comfy.latent_formats.Wan21().process_out(torch.zeros_like(reference_image))], dim=1) + + if control_masks is None: + mask = torch.ones((length, height, width, 1)) + else: + mask = control_masks + if mask.ndim == 3: + mask = mask.unsqueeze(1) + mask = comfy.utils.common_upscale(mask[:length], width, height, "bilinear", "center").movedim(1, -1) + if mask.shape[0] < length: + mask = torch.nn.functional.pad(mask, (0, 0, 0, 0, 0, 0, 0, length - mask.shape[0]), value=1.0) + + control_video = control_video - 0.5 + inactive = (control_video * (1 - mask)) + 0.5 + reactive = (control_video * mask) + 0.5 + + inactive = vae.encode(inactive[:, :, :, :3]) + reactive = vae.encode(reactive[:, :, :, :3]) + control_video_latent = torch.cat((inactive, reactive), dim=1) + if reference_image is not None: + control_video_latent = torch.cat((reference_image, control_video_latent), dim=2) + + vae_stride = 8 + height_mask = height // vae_stride + width_mask = width // vae_stride + mask = mask.view(length, height_mask, vae_stride, width_mask, vae_stride) + mask = mask.permute(2, 4, 0, 1, 3) + mask = mask.reshape(vae_stride * vae_stride, length, height_mask, width_mask) + mask = torch.nn.functional.interpolate(mask.unsqueeze(0), size=(latent_length, height_mask, width_mask), mode='nearest-exact').squeeze(0) + + trim_latent = 0 + if reference_image is not None: + mask_pad = torch.zeros_like(mask[:, :reference_image.shape[2], :, :]) + mask = torch.cat((mask_pad, mask), dim=1) + latent_length += reference_image.shape[2] + trim_latent = reference_image.shape[2] + + mask = mask.unsqueeze(0) + positive = node_helpers.conditioning_set_values(positive, {"vace_frames": control_video_latent, "vace_mask": mask}) + negative = node_helpers.conditioning_set_values(negative, {"vace_frames": control_video_latent, "vace_mask": mask}) + + latent = torch.zeros([batch_size, 16, latent_length, height // 8, width // 8], device=comfy.model_management.intermediate_device()) + out_latent = {} + out_latent["samples"] = latent + return (positive, negative, out_latent, trim_latent) + +class TrimVideoLatent: + @classmethod + def INPUT_TYPES(s): + return {"required": { "samples": ("LATENT",), + "trim_amount": ("INT", {"default": 0, "min": 0, "max": 99999}), + }} + + RETURN_TYPES = ("LATENT",) + FUNCTION = "op" + + CATEGORY = "latent/video" + + EXPERIMENTAL = True + + def op(self, samples, trim_amount): + samples_out = samples.copy() + + s1 = samples["samples"] + samples_out["samples"] = s1[:, :, trim_amount:] + return (samples_out,) + + NODE_CLASS_MAPPINGS = { "WanImageToVideo": WanImageToVideo, "WanFunControlToVideo": WanFunControlToVideo, "WanFunInpaintToVideo": WanFunInpaintToVideo, "WanFirstLastFrameToVideo": WanFirstLastFrameToVideo, + "WanVaceToVideo": WanVaceToVideo, + "TrimVideoLatent": TrimVideoLatent, } From 5d51794607d71e1bbffd7d9d5a1eed417de771ae Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Tue, 22 Apr 2025 06:13:00 +1000 Subject: [PATCH 332/478] Add node type hint for socketless option (#7714) * Add node type hint for socketless option * nit - Doc --- comfy/comfy_types/node_typing.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/comfy/comfy_types/node_typing.py b/comfy/comfy_types/node_typing.py index 42ed5174e..a348791a9 100644 --- a/comfy/comfy_types/node_typing.py +++ b/comfy/comfy_types/node_typing.py @@ -115,6 +115,11 @@ class InputTypeOptions(TypedDict): """When a link exists, rather than receiving the evaluated value, you will receive the link (i.e. `["nodeId", ]`). Designed for node expansion.""" tooltip: NotRequired[str] """Tooltip for the input (or widget), shown on pointer hover""" + socketless: NotRequired[bool] + """All inputs (including widgets) have an input socket to connect links. When ``true``, if there is a widget for this input, no socket will be created. + Available from frontend v1.17.5 + Ref: https://github.com/Comfy-Org/ComfyUI_frontend/pull/3548 + """ # class InputTypeNumber(InputTypeOptions): # default: float | int min: NotRequired[float] From 9d57b8afd8c9f14776b1464919472ae17de2b03e Mon Sep 17 00:00:00 2001 From: "Alexander G. Morano" Date: Mon, 21 Apr 2025 18:51:31 -0400 Subject: [PATCH 333/478] Update nodes_primitive.py (#7716) Allow FLOAT and INT types to support negative numbers. Caps the numbers at the user's own system min and max. --- comfy_extras/nodes_primitive.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/comfy_extras/nodes_primitive.py b/comfy_extras/nodes_primitive.py index b770104fb..184b990c3 100644 --- a/comfy_extras/nodes_primitive.py +++ b/comfy_extras/nodes_primitive.py @@ -1,6 +1,8 @@ # Primitive nodes that are evaluated at backend. from __future__ import annotations +import sys + from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, IO @@ -23,7 +25,7 @@ class Int(ComfyNodeABC): @classmethod def INPUT_TYPES(cls) -> InputTypeDict: return { - "required": {"value": (IO.INT, {"control_after_generate": True})}, + "required": {"value": (IO.INT, {"min": -sys.maxsize, "max": sys.maxsize, "control_after_generate": True})}, } RETURN_TYPES = (IO.INT,) @@ -38,7 +40,7 @@ class Float(ComfyNodeABC): @classmethod def INPUT_TYPES(cls) -> InputTypeDict: return { - "required": {"value": (IO.FLOAT, {})}, + "required": {"value": (IO.FLOAT, {"min": -sys.maxsize, "max": sys.maxsize})}, } RETURN_TYPES = (IO.FLOAT,) From 5d0d4ee98a24b6c72c94635fc5a6e93af2b005bc Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Mon, 21 Apr 2025 16:36:20 -0700 Subject: [PATCH 334/478] Add strength control for vace. (#7717) --- comfy/ldm/wan/model.py | 3 ++- comfy/model_base.py | 3 +++ comfy_extras/nodes_wan.py | 7 ++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index 5e7848bd5..4ef86d5f2 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -582,6 +582,7 @@ class VaceWanModel(WanModel): t, context, vace_context, + vace_strength=1.0, clip_fea=None, freqs=None, transformer_options={}, @@ -629,7 +630,7 @@ class VaceWanModel(WanModel): ii = self.vace_layers_mapping.get(i, None) if ii is not None: c_skip, c = self.vace_blocks[ii](c, x=x_orig, e=e0, freqs=freqs, context=context, context_img_len=context_img_len) - x += c_skip + x += c_skip * vace_strength # head x = self.head(x, e) diff --git a/comfy/model_base.py b/comfy/model_base.py index 04a101526..b0c6a465b 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -1068,6 +1068,9 @@ class WAN21_Vace(WAN21): mask = torch.ones(noise_shape, device=noise.device, dtype=noise.dtype) out['vace_context'] = comfy.conds.CONDRegular(torch.cat([vace_frames.to(noise), mask.to(noise)], dim=1)) + + vace_strength = kwargs.get("vace_strength", 1.0) + out['vace_strength'] = comfy.conds.CONDConstant(vace_strength) return out diff --git a/comfy_extras/nodes_wan.py b/comfy_extras/nodes_wan.py index 19a6cdfa4..9dda64597 100644 --- a/comfy_extras/nodes_wan.py +++ b/comfy_extras/nodes_wan.py @@ -203,6 +203,7 @@ class WanVaceToVideo: "height": ("INT", {"default": 480, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), "length": ("INT", {"default": 81, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}), "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), + "strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1000.0, "step": 0.01}), }, "optional": {"control_video": ("IMAGE", ), "control_masks": ("MASK", ), @@ -217,7 +218,7 @@ class WanVaceToVideo: EXPERIMENTAL = True - def encode(self, positive, negative, vae, width, height, length, batch_size, control_video=None, control_masks=None, reference_image=None): + def encode(self, positive, negative, vae, width, height, length, batch_size, strength, control_video=None, control_masks=None, reference_image=None): latent_length = ((length - 1) // 4) + 1 if control_video is not None: control_video = comfy.utils.common_upscale(control_video[:length].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) @@ -267,8 +268,8 @@ class WanVaceToVideo: trim_latent = reference_image.shape[2] mask = mask.unsqueeze(0) - positive = node_helpers.conditioning_set_values(positive, {"vace_frames": control_video_latent, "vace_mask": mask}) - negative = node_helpers.conditioning_set_values(negative, {"vace_frames": control_video_latent, "vace_mask": mask}) + positive = node_helpers.conditioning_set_values(positive, {"vace_frames": control_video_latent, "vace_mask": mask, "vace_strength": strength}) + negative = node_helpers.conditioning_set_values(negative, {"vace_frames": control_video_latent, "vace_mask": mask, "vace_strength": strength}) latent = torch.zeros([batch_size, 16, latent_length, height // 8, width // 8], device=comfy.model_management.intermediate_device()) out_latent = {} From 1f3fba2af518073551a73582c8dce7bae4ad7716 Mon Sep 17 00:00:00 2001 From: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> Date: Tue, 22 Apr 2025 08:15:32 +0800 Subject: [PATCH 335/478] Unified Weight Adapter system for better maintainability and future feature of Lora system (#7540) --- comfy/lora.py | 321 ++----------------------------- comfy/weight_adapter/__init__.py | 13 ++ comfy/weight_adapter/base.py | 94 +++++++++ comfy/weight_adapter/glora.py | 93 +++++++++ comfy/weight_adapter/loha.py | 100 ++++++++++ comfy/weight_adapter/lokr.py | 133 +++++++++++++ comfy/weight_adapter/lora.py | 142 ++++++++++++++ 7 files changed, 592 insertions(+), 304 deletions(-) create mode 100644 comfy/weight_adapter/__init__.py create mode 100644 comfy/weight_adapter/base.py create mode 100644 comfy/weight_adapter/glora.py create mode 100644 comfy/weight_adapter/loha.py create mode 100644 comfy/weight_adapter/lokr.py create mode 100644 comfy/weight_adapter/lora.py diff --git a/comfy/lora.py b/comfy/lora.py index bc9f3022a..8760a21fb 100644 --- a/comfy/lora.py +++ b/comfy/lora.py @@ -20,6 +20,7 @@ from __future__ import annotations import comfy.utils import comfy.model_management import comfy.model_base +import comfy.weight_adapter as weight_adapter import logging import torch @@ -49,139 +50,12 @@ def load_lora(lora, to_load, log_missing=True): dora_scale = lora[dora_scale_name] loaded_keys.add(dora_scale_name) - reshape_name = "{}.reshape_weight".format(x) - reshape = None - if reshape_name in lora.keys(): - try: - reshape = lora[reshape_name].tolist() - loaded_keys.add(reshape_name) - except: - pass - - regular_lora = "{}.lora_up.weight".format(x) - diffusers_lora = "{}_lora.up.weight".format(x) - diffusers2_lora = "{}.lora_B.weight".format(x) - diffusers3_lora = "{}.lora.up.weight".format(x) - mochi_lora = "{}.lora_B".format(x) - transformers_lora = "{}.lora_linear_layer.up.weight".format(x) - A_name = None - - if regular_lora in lora.keys(): - A_name = regular_lora - B_name = "{}.lora_down.weight".format(x) - mid_name = "{}.lora_mid.weight".format(x) - elif diffusers_lora in lora.keys(): - A_name = diffusers_lora - B_name = "{}_lora.down.weight".format(x) - mid_name = None - elif diffusers2_lora in lora.keys(): - A_name = diffusers2_lora - B_name = "{}.lora_A.weight".format(x) - mid_name = None - elif diffusers3_lora in lora.keys(): - A_name = diffusers3_lora - B_name = "{}.lora.down.weight".format(x) - mid_name = None - elif mochi_lora in lora.keys(): - A_name = mochi_lora - B_name = "{}.lora_A".format(x) - mid_name = None - elif transformers_lora in lora.keys(): - A_name = transformers_lora - B_name ="{}.lora_linear_layer.down.weight".format(x) - mid_name = None - - if A_name is not None: - mid = None - if mid_name is not None and mid_name in lora.keys(): - mid = lora[mid_name] - loaded_keys.add(mid_name) - patch_dict[to_load[x]] = ("lora", (lora[A_name], lora[B_name], alpha, mid, dora_scale, reshape)) - loaded_keys.add(A_name) - loaded_keys.add(B_name) - - - ######## loha - hada_w1_a_name = "{}.hada_w1_a".format(x) - hada_w1_b_name = "{}.hada_w1_b".format(x) - hada_w2_a_name = "{}.hada_w2_a".format(x) - hada_w2_b_name = "{}.hada_w2_b".format(x) - hada_t1_name = "{}.hada_t1".format(x) - hada_t2_name = "{}.hada_t2".format(x) - if hada_w1_a_name in lora.keys(): - hada_t1 = None - hada_t2 = None - if hada_t1_name in lora.keys(): - hada_t1 = lora[hada_t1_name] - hada_t2 = lora[hada_t2_name] - loaded_keys.add(hada_t1_name) - loaded_keys.add(hada_t2_name) - - patch_dict[to_load[x]] = ("loha", (lora[hada_w1_a_name], lora[hada_w1_b_name], alpha, lora[hada_w2_a_name], lora[hada_w2_b_name], hada_t1, hada_t2, dora_scale)) - loaded_keys.add(hada_w1_a_name) - loaded_keys.add(hada_w1_b_name) - loaded_keys.add(hada_w2_a_name) - loaded_keys.add(hada_w2_b_name) - - - ######## lokr - lokr_w1_name = "{}.lokr_w1".format(x) - lokr_w2_name = "{}.lokr_w2".format(x) - lokr_w1_a_name = "{}.lokr_w1_a".format(x) - lokr_w1_b_name = "{}.lokr_w1_b".format(x) - lokr_t2_name = "{}.lokr_t2".format(x) - lokr_w2_a_name = "{}.lokr_w2_a".format(x) - lokr_w2_b_name = "{}.lokr_w2_b".format(x) - - lokr_w1 = None - if lokr_w1_name in lora.keys(): - lokr_w1 = lora[lokr_w1_name] - loaded_keys.add(lokr_w1_name) - - lokr_w2 = None - if lokr_w2_name in lora.keys(): - lokr_w2 = lora[lokr_w2_name] - loaded_keys.add(lokr_w2_name) - - lokr_w1_a = None - if lokr_w1_a_name in lora.keys(): - lokr_w1_a = lora[lokr_w1_a_name] - loaded_keys.add(lokr_w1_a_name) - - lokr_w1_b = None - if lokr_w1_b_name in lora.keys(): - lokr_w1_b = lora[lokr_w1_b_name] - loaded_keys.add(lokr_w1_b_name) - - lokr_w2_a = None - if lokr_w2_a_name in lora.keys(): - lokr_w2_a = lora[lokr_w2_a_name] - loaded_keys.add(lokr_w2_a_name) - - lokr_w2_b = None - if lokr_w2_b_name in lora.keys(): - lokr_w2_b = lora[lokr_w2_b_name] - loaded_keys.add(lokr_w2_b_name) - - lokr_t2 = None - if lokr_t2_name in lora.keys(): - lokr_t2 = lora[lokr_t2_name] - loaded_keys.add(lokr_t2_name) - - if (lokr_w1 is not None) or (lokr_w2 is not None) or (lokr_w1_a is not None) or (lokr_w2_a is not None): - patch_dict[to_load[x]] = ("lokr", (lokr_w1, lokr_w2, alpha, lokr_w1_a, lokr_w1_b, lokr_w2_a, lokr_w2_b, lokr_t2, dora_scale)) - - #glora - a1_name = "{}.a1.weight".format(x) - a2_name = "{}.a2.weight".format(x) - b1_name = "{}.b1.weight".format(x) - b2_name = "{}.b2.weight".format(x) - if a1_name in lora: - patch_dict[to_load[x]] = ("glora", (lora[a1_name], lora[a2_name], lora[b1_name], lora[b2_name], alpha, dora_scale)) - loaded_keys.add(a1_name) - loaded_keys.add(a2_name) - loaded_keys.add(b1_name) - loaded_keys.add(b2_name) + for adapter_cls in weight_adapter.adapters: + adapter = adapter_cls.load(x, lora, alpha, dora_scale, loaded_keys) + if adapter is not None: + patch_dict[to_load[x]] = adapter + loaded_keys.update(adapter.loaded_keys) + continue w_norm_name = "{}.w_norm".format(x) b_norm_name = "{}.b_norm".format(x) @@ -408,26 +282,6 @@ def model_lora_keys_unet(model, key_map={}): return key_map -def weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediate_dtype, function): - dora_scale = comfy.model_management.cast_to_device(dora_scale, weight.device, intermediate_dtype) - lora_diff *= alpha - weight_calc = weight + function(lora_diff).type(weight.dtype) - weight_norm = ( - weight_calc.transpose(0, 1) - .reshape(weight_calc.shape[1], -1) - .norm(dim=1, keepdim=True) - .reshape(weight_calc.shape[1], *[1] * (weight_calc.dim() - 1)) - .transpose(0, 1) - ) - - weight_calc *= (dora_scale / weight_norm).type(weight.dtype) - if strength != 1.0: - weight_calc -= weight - weight += strength * (weight_calc) - else: - weight[:] = weight_calc - return weight - def pad_tensor_to_shape(tensor: torch.Tensor, new_shape: list[int]) -> torch.Tensor: """ Pad a tensor to a new shape with zeros. @@ -482,6 +336,16 @@ def calculate_weight(patches, weight, key, intermediate_dtype=torch.float32, ori if isinstance(v, list): v = (calculate_weight(v[1:], v[0][1](comfy.model_management.cast_to_device(v[0][0], weight.device, intermediate_dtype, copy=True), inplace=True), key, intermediate_dtype=intermediate_dtype), ) + if isinstance(v, weight_adapter.WeightAdapterBase): + output = v.calculate_weight(weight, key, strength, strength_model, offset, function, intermediate_dtype, original_weights) + if output is None: + logging.warning("Calculate Weight Failed: {} {}".format(v.name, key)) + else: + weight = output + if old_weight is not None: + weight = old_weight + continue + if len(v) == 1: patch_type = "diff" elif len(v) == 2: @@ -508,157 +372,6 @@ def calculate_weight(patches, weight, key, intermediate_dtype=torch.float32, ori diff_weight = comfy.model_management.cast_to_device(target_weight, weight.device, intermediate_dtype) - \ comfy.model_management.cast_to_device(original_weights[key][0][0], weight.device, intermediate_dtype) weight += function(strength * comfy.model_management.cast_to_device(diff_weight, weight.device, weight.dtype)) - elif patch_type == "lora": #lora/locon - mat1 = comfy.model_management.cast_to_device(v[0], weight.device, intermediate_dtype) - mat2 = comfy.model_management.cast_to_device(v[1], weight.device, intermediate_dtype) - dora_scale = v[4] - reshape = v[5] - - if reshape is not None: - weight = pad_tensor_to_shape(weight, reshape) - - if v[2] is not None: - alpha = v[2] / mat2.shape[0] - else: - alpha = 1.0 - - if v[3] is not None: - #locon mid weights, hopefully the math is fine because I didn't properly test it - mat3 = comfy.model_management.cast_to_device(v[3], weight.device, intermediate_dtype) - final_shape = [mat2.shape[1], mat2.shape[0], mat3.shape[2], mat3.shape[3]] - mat2 = torch.mm(mat2.transpose(0, 1).flatten(start_dim=1), mat3.transpose(0, 1).flatten(start_dim=1)).reshape(final_shape).transpose(0, 1) - try: - lora_diff = torch.mm(mat1.flatten(start_dim=1), mat2.flatten(start_dim=1)).reshape(weight.shape) - if dora_scale is not None: - weight = weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediate_dtype, function) - else: - weight += function(((strength * alpha) * lora_diff).type(weight.dtype)) - except Exception as e: - logging.error("ERROR {} {} {}".format(patch_type, key, e)) - elif patch_type == "lokr": - w1 = v[0] - w2 = v[1] - w1_a = v[3] - w1_b = v[4] - w2_a = v[5] - w2_b = v[6] - t2 = v[7] - dora_scale = v[8] - dim = None - - if w1 is None: - dim = w1_b.shape[0] - w1 = torch.mm(comfy.model_management.cast_to_device(w1_a, weight.device, intermediate_dtype), - comfy.model_management.cast_to_device(w1_b, weight.device, intermediate_dtype)) - else: - w1 = comfy.model_management.cast_to_device(w1, weight.device, intermediate_dtype) - - if w2 is None: - dim = w2_b.shape[0] - if t2 is None: - w2 = torch.mm(comfy.model_management.cast_to_device(w2_a, weight.device, intermediate_dtype), - comfy.model_management.cast_to_device(w2_b, weight.device, intermediate_dtype)) - else: - w2 = torch.einsum('i j k l, j r, i p -> p r k l', - comfy.model_management.cast_to_device(t2, weight.device, intermediate_dtype), - comfy.model_management.cast_to_device(w2_b, weight.device, intermediate_dtype), - comfy.model_management.cast_to_device(w2_a, weight.device, intermediate_dtype)) - else: - w2 = comfy.model_management.cast_to_device(w2, weight.device, intermediate_dtype) - - if len(w2.shape) == 4: - w1 = w1.unsqueeze(2).unsqueeze(2) - if v[2] is not None and dim is not None: - alpha = v[2] / dim - else: - alpha = 1.0 - - try: - lora_diff = torch.kron(w1, w2).reshape(weight.shape) - if dora_scale is not None: - weight = weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediate_dtype, function) - else: - weight += function(((strength * alpha) * lora_diff).type(weight.dtype)) - except Exception as e: - logging.error("ERROR {} {} {}".format(patch_type, key, e)) - elif patch_type == "loha": - w1a = v[0] - w1b = v[1] - if v[2] is not None: - alpha = v[2] / w1b.shape[0] - else: - alpha = 1.0 - - w2a = v[3] - w2b = v[4] - dora_scale = v[7] - if v[5] is not None: #cp decomposition - t1 = v[5] - t2 = v[6] - m1 = torch.einsum('i j k l, j r, i p -> p r k l', - comfy.model_management.cast_to_device(t1, weight.device, intermediate_dtype), - comfy.model_management.cast_to_device(w1b, weight.device, intermediate_dtype), - comfy.model_management.cast_to_device(w1a, weight.device, intermediate_dtype)) - - m2 = torch.einsum('i j k l, j r, i p -> p r k l', - comfy.model_management.cast_to_device(t2, weight.device, intermediate_dtype), - comfy.model_management.cast_to_device(w2b, weight.device, intermediate_dtype), - comfy.model_management.cast_to_device(w2a, weight.device, intermediate_dtype)) - else: - m1 = torch.mm(comfy.model_management.cast_to_device(w1a, weight.device, intermediate_dtype), - comfy.model_management.cast_to_device(w1b, weight.device, intermediate_dtype)) - m2 = torch.mm(comfy.model_management.cast_to_device(w2a, weight.device, intermediate_dtype), - comfy.model_management.cast_to_device(w2b, weight.device, intermediate_dtype)) - - try: - lora_diff = (m1 * m2).reshape(weight.shape) - if dora_scale is not None: - weight = weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediate_dtype, function) - else: - weight += function(((strength * alpha) * lora_diff).type(weight.dtype)) - except Exception as e: - logging.error("ERROR {} {} {}".format(patch_type, key, e)) - elif patch_type == "glora": - dora_scale = v[5] - - old_glora = False - if v[3].shape[1] == v[2].shape[0] == v[0].shape[0] == v[1].shape[1]: - rank = v[0].shape[0] - old_glora = True - - if v[3].shape[0] == v[2].shape[1] == v[0].shape[1] == v[1].shape[0]: - if old_glora and v[1].shape[0] == weight.shape[0] and weight.shape[0] == weight.shape[1]: - pass - else: - old_glora = False - rank = v[1].shape[0] - - a1 = comfy.model_management.cast_to_device(v[0].flatten(start_dim=1), weight.device, intermediate_dtype) - a2 = comfy.model_management.cast_to_device(v[1].flatten(start_dim=1), weight.device, intermediate_dtype) - b1 = comfy.model_management.cast_to_device(v[2].flatten(start_dim=1), weight.device, intermediate_dtype) - b2 = comfy.model_management.cast_to_device(v[3].flatten(start_dim=1), weight.device, intermediate_dtype) - - if v[4] is not None: - alpha = v[4] / rank - else: - alpha = 1.0 - - try: - if old_glora: - lora_diff = (torch.mm(b2, b1) + torch.mm(torch.mm(weight.flatten(start_dim=1).to(dtype=intermediate_dtype), a2), a1)).reshape(weight.shape) #old lycoris glora - else: - if weight.dim() > 2: - lora_diff = torch.einsum("o i ..., i j -> o j ...", torch.einsum("o i ..., i j -> o j ...", weight.to(dtype=intermediate_dtype), a1), a2).reshape(weight.shape) - else: - lora_diff = torch.mm(torch.mm(weight.to(dtype=intermediate_dtype), a1), a2).reshape(weight.shape) - lora_diff += torch.mm(b1, b2).reshape(weight.shape) - - if dora_scale is not None: - weight = weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediate_dtype, function) - else: - weight += function(((strength * alpha) * lora_diff).type(weight.dtype)) - except Exception as e: - logging.error("ERROR {} {} {}".format(patch_type, key, e)) else: logging.warning("patch type not recognized {} {}".format(patch_type, key)) diff --git a/comfy/weight_adapter/__init__.py b/comfy/weight_adapter/__init__.py new file mode 100644 index 000000000..e6cd805b6 --- /dev/null +++ b/comfy/weight_adapter/__init__.py @@ -0,0 +1,13 @@ +from .base import WeightAdapterBase +from .lora import LoRAAdapter +from .loha import LoHaAdapter +from .lokr import LoKrAdapter +from .glora import GLoRAAdapter + + +adapters: list[type[WeightAdapterBase]] = [ + LoRAAdapter, + LoHaAdapter, + LoKrAdapter, + GLoRAAdapter, +] diff --git a/comfy/weight_adapter/base.py b/comfy/weight_adapter/base.py new file mode 100644 index 000000000..54af3babe --- /dev/null +++ b/comfy/weight_adapter/base.py @@ -0,0 +1,94 @@ +from typing import Optional + +import torch +import torch.nn as nn + +import comfy.model_management + + +class WeightAdapterBase: + name: str + loaded_keys: set[str] + weights: list[torch.Tensor] + + @classmethod + def load(cls, x: str, lora: dict[str, torch.Tensor]) -> Optional["WeightAdapterBase"]: + raise NotImplementedError + + def to_train(self) -> "WeightAdapterTrainBase": + raise NotImplementedError + + def calculate_weight( + self, + weight, + key, + strength, + strength_model, + offset, + function, + intermediate_dtype=torch.float32, + original_weight=None, + ): + raise NotImplementedError + + +class WeightAdapterTrainBase(nn.Module): + def __init__(self): + super().__init__() + + # [TODO] Collaborate with LoRA training PR #7032 + + +def weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediate_dtype, function): + dora_scale = comfy.model_management.cast_to_device(dora_scale, weight.device, intermediate_dtype) + lora_diff *= alpha + weight_calc = weight + function(lora_diff).type(weight.dtype) + weight_norm = ( + weight_calc.transpose(0, 1) + .reshape(weight_calc.shape[1], -1) + .norm(dim=1, keepdim=True) + .reshape(weight_calc.shape[1], *[1] * (weight_calc.dim() - 1)) + .transpose(0, 1) + ) + + weight_calc *= (dora_scale / weight_norm).type(weight.dtype) + if strength != 1.0: + weight_calc -= weight + weight += strength * (weight_calc) + else: + weight[:] = weight_calc + return weight + + +def pad_tensor_to_shape(tensor: torch.Tensor, new_shape: list[int]) -> torch.Tensor: + """ + Pad a tensor to a new shape with zeros. + + Args: + tensor (torch.Tensor): The original tensor to be padded. + new_shape (List[int]): The desired shape of the padded tensor. + + Returns: + torch.Tensor: A new tensor padded with zeros to the specified shape. + + Note: + If the new shape is smaller than the original tensor in any dimension, + the original tensor will be truncated in that dimension. + """ + if any([new_shape[i] < tensor.shape[i] for i in range(len(new_shape))]): + raise ValueError("The new shape must be larger than the original tensor in all dimensions") + + if len(new_shape) != len(tensor.shape): + raise ValueError("The new shape must have the same number of dimensions as the original tensor") + + # Create a new tensor filled with zeros + padded_tensor = torch.zeros(new_shape, dtype=tensor.dtype, device=tensor.device) + + # Create slicing tuples for both tensors + orig_slices = tuple(slice(0, dim) for dim in tensor.shape) + new_slices = tuple(slice(0, dim) for dim in tensor.shape) + + # Copy the original tensor into the new tensor + padded_tensor[new_slices] = tensor[orig_slices] + + return padded_tensor diff --git a/comfy/weight_adapter/glora.py b/comfy/weight_adapter/glora.py new file mode 100644 index 000000000..939abbba5 --- /dev/null +++ b/comfy/weight_adapter/glora.py @@ -0,0 +1,93 @@ +import logging +from typing import Optional + +import torch +import comfy.model_management +from .base import WeightAdapterBase, weight_decompose + + +class GLoRAAdapter(WeightAdapterBase): + name = "glora" + + def __init__(self, loaded_keys, weights): + self.loaded_keys = loaded_keys + self.weights = weights + + @classmethod + def load( + cls, + x: str, + lora: dict[str, torch.Tensor], + alpha: float, + dora_scale: torch.Tensor, + loaded_keys: set[str] = None, + ) -> Optional["GLoRAAdapter"]: + if loaded_keys is None: + loaded_keys = set() + a1_name = "{}.a1.weight".format(x) + a2_name = "{}.a2.weight".format(x) + b1_name = "{}.b1.weight".format(x) + b2_name = "{}.b2.weight".format(x) + if a1_name in lora: + weights = (lora[a1_name], lora[a2_name], lora[b1_name], lora[b2_name], alpha, dora_scale) + loaded_keys.add(a1_name) + loaded_keys.add(a2_name) + loaded_keys.add(b1_name) + loaded_keys.add(b2_name) + return cls(loaded_keys, weights) + else: + return None + + def calculate_weight( + self, + weight, + key, + strength, + strength_model, + offset, + function, + intermediate_dtype=torch.float32, + original_weight=None, + ): + v = self.weights + dora_scale = v[5] + + old_glora = False + if v[3].shape[1] == v[2].shape[0] == v[0].shape[0] == v[1].shape[1]: + rank = v[0].shape[0] + old_glora = True + + if v[3].shape[0] == v[2].shape[1] == v[0].shape[1] == v[1].shape[0]: + if old_glora and v[1].shape[0] == weight.shape[0] and weight.shape[0] == weight.shape[1]: + pass + else: + old_glora = False + rank = v[1].shape[0] + + a1 = comfy.model_management.cast_to_device(v[0].flatten(start_dim=1), weight.device, intermediate_dtype) + a2 = comfy.model_management.cast_to_device(v[1].flatten(start_dim=1), weight.device, intermediate_dtype) + b1 = comfy.model_management.cast_to_device(v[2].flatten(start_dim=1), weight.device, intermediate_dtype) + b2 = comfy.model_management.cast_to_device(v[3].flatten(start_dim=1), weight.device, intermediate_dtype) + + if v[4] is not None: + alpha = v[4] / rank + else: + alpha = 1.0 + + try: + if old_glora: + lora_diff = (torch.mm(b2, b1) + torch.mm(torch.mm(weight.flatten(start_dim=1).to(dtype=intermediate_dtype), a2), a1)).reshape(weight.shape) #old lycoris glora + else: + if weight.dim() > 2: + lora_diff = torch.einsum("o i ..., i j -> o j ...", torch.einsum("o i ..., i j -> o j ...", weight.to(dtype=intermediate_dtype), a1), a2).reshape(weight.shape) + else: + lora_diff = torch.mm(torch.mm(weight.to(dtype=intermediate_dtype), a1), a2).reshape(weight.shape) + lora_diff += torch.mm(b1, b2).reshape(weight.shape) + + if dora_scale is not None: + weight = weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediate_dtype, function) + else: + weight += function(((strength * alpha) * lora_diff).type(weight.dtype)) + except Exception as e: + logging.error("ERROR {} {} {}".format(self.name, key, e)) + return weight diff --git a/comfy/weight_adapter/loha.py b/comfy/weight_adapter/loha.py new file mode 100644 index 000000000..ce79abad5 --- /dev/null +++ b/comfy/weight_adapter/loha.py @@ -0,0 +1,100 @@ +import logging +from typing import Optional + +import torch +import comfy.model_management +from .base import WeightAdapterBase, weight_decompose + + +class LoHaAdapter(WeightAdapterBase): + name = "loha" + + def __init__(self, loaded_keys, weights): + self.loaded_keys = loaded_keys + self.weights = weights + + @classmethod + def load( + cls, + x: str, + lora: dict[str, torch.Tensor], + alpha: float, + dora_scale: torch.Tensor, + loaded_keys: set[str] = None, + ) -> Optional["LoHaAdapter"]: + if loaded_keys is None: + loaded_keys = set() + + hada_w1_a_name = "{}.hada_w1_a".format(x) + hada_w1_b_name = "{}.hada_w1_b".format(x) + hada_w2_a_name = "{}.hada_w2_a".format(x) + hada_w2_b_name = "{}.hada_w2_b".format(x) + hada_t1_name = "{}.hada_t1".format(x) + hada_t2_name = "{}.hada_t2".format(x) + if hada_w1_a_name in lora.keys(): + hada_t1 = None + hada_t2 = None + if hada_t1_name in lora.keys(): + hada_t1 = lora[hada_t1_name] + hada_t2 = lora[hada_t2_name] + loaded_keys.add(hada_t1_name) + loaded_keys.add(hada_t2_name) + + weights = (lora[hada_w1_a_name], lora[hada_w1_b_name], alpha, lora[hada_w2_a_name], lora[hada_w2_b_name], hada_t1, hada_t2, dora_scale) + loaded_keys.add(hada_w1_a_name) + loaded_keys.add(hada_w1_b_name) + loaded_keys.add(hada_w2_a_name) + loaded_keys.add(hada_w2_b_name) + return cls(loaded_keys, weights) + else: + return None + + def calculate_weight( + self, + weight, + key, + strength, + strength_model, + offset, + function, + intermediate_dtype=torch.float32, + original_weight=None, + ): + v = self.weights + w1a = v[0] + w1b = v[1] + if v[2] is not None: + alpha = v[2] / w1b.shape[0] + else: + alpha = 1.0 + + w2a = v[3] + w2b = v[4] + dora_scale = v[7] + if v[5] is not None: #cp decomposition + t1 = v[5] + t2 = v[6] + m1 = torch.einsum('i j k l, j r, i p -> p r k l', + comfy.model_management.cast_to_device(t1, weight.device, intermediate_dtype), + comfy.model_management.cast_to_device(w1b, weight.device, intermediate_dtype), + comfy.model_management.cast_to_device(w1a, weight.device, intermediate_dtype)) + + m2 = torch.einsum('i j k l, j r, i p -> p r k l', + comfy.model_management.cast_to_device(t2, weight.device, intermediate_dtype), + comfy.model_management.cast_to_device(w2b, weight.device, intermediate_dtype), + comfy.model_management.cast_to_device(w2a, weight.device, intermediate_dtype)) + else: + m1 = torch.mm(comfy.model_management.cast_to_device(w1a, weight.device, intermediate_dtype), + comfy.model_management.cast_to_device(w1b, weight.device, intermediate_dtype)) + m2 = torch.mm(comfy.model_management.cast_to_device(w2a, weight.device, intermediate_dtype), + comfy.model_management.cast_to_device(w2b, weight.device, intermediate_dtype)) + + try: + lora_diff = (m1 * m2).reshape(weight.shape) + if dora_scale is not None: + weight = weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediate_dtype, function) + else: + weight += function(((strength * alpha) * lora_diff).type(weight.dtype)) + except Exception as e: + logging.error("ERROR {} {} {}".format(self.name, key, e)) + return weight diff --git a/comfy/weight_adapter/lokr.py b/comfy/weight_adapter/lokr.py new file mode 100644 index 000000000..51233db2d --- /dev/null +++ b/comfy/weight_adapter/lokr.py @@ -0,0 +1,133 @@ +import logging +from typing import Optional + +import torch +import comfy.model_management +from .base import WeightAdapterBase, weight_decompose + + +class LoKrAdapter(WeightAdapterBase): + name = "lokr" + + def __init__(self, loaded_keys, weights): + self.loaded_keys = loaded_keys + self.weights = weights + + @classmethod + def load( + cls, + x: str, + lora: dict[str, torch.Tensor], + alpha: float, + dora_scale: torch.Tensor, + loaded_keys: set[str] = None, + ) -> Optional["LoKrAdapter"]: + if loaded_keys is None: + loaded_keys = set() + lokr_w1_name = "{}.lokr_w1".format(x) + lokr_w2_name = "{}.lokr_w2".format(x) + lokr_w1_a_name = "{}.lokr_w1_a".format(x) + lokr_w1_b_name = "{}.lokr_w1_b".format(x) + lokr_t2_name = "{}.lokr_t2".format(x) + lokr_w2_a_name = "{}.lokr_w2_a".format(x) + lokr_w2_b_name = "{}.lokr_w2_b".format(x) + + lokr_w1 = None + if lokr_w1_name in lora.keys(): + lokr_w1 = lora[lokr_w1_name] + loaded_keys.add(lokr_w1_name) + + lokr_w2 = None + if lokr_w2_name in lora.keys(): + lokr_w2 = lora[lokr_w2_name] + loaded_keys.add(lokr_w2_name) + + lokr_w1_a = None + if lokr_w1_a_name in lora.keys(): + lokr_w1_a = lora[lokr_w1_a_name] + loaded_keys.add(lokr_w1_a_name) + + lokr_w1_b = None + if lokr_w1_b_name in lora.keys(): + lokr_w1_b = lora[lokr_w1_b_name] + loaded_keys.add(lokr_w1_b_name) + + lokr_w2_a = None + if lokr_w2_a_name in lora.keys(): + lokr_w2_a = lora[lokr_w2_a_name] + loaded_keys.add(lokr_w2_a_name) + + lokr_w2_b = None + if lokr_w2_b_name in lora.keys(): + lokr_w2_b = lora[lokr_w2_b_name] + loaded_keys.add(lokr_w2_b_name) + + lokr_t2 = None + if lokr_t2_name in lora.keys(): + lokr_t2 = lora[lokr_t2_name] + loaded_keys.add(lokr_t2_name) + + if (lokr_w1 is not None) or (lokr_w2 is not None) or (lokr_w1_a is not None) or (lokr_w2_a is not None): + weights = (lokr_w1, lokr_w2, alpha, lokr_w1_a, lokr_w1_b, lokr_w2_a, lokr_w2_b, lokr_t2, dora_scale) + return cls(loaded_keys, weights) + else: + return None + + def calculate_weight( + self, + weight, + key, + strength, + strength_model, + offset, + function, + intermediate_dtype=torch.float32, + original_weight=None, + ): + v = self.weights + w1 = v[0] + w2 = v[1] + w1_a = v[3] + w1_b = v[4] + w2_a = v[5] + w2_b = v[6] + t2 = v[7] + dora_scale = v[8] + dim = None + + if w1 is None: + dim = w1_b.shape[0] + w1 = torch.mm(comfy.model_management.cast_to_device(w1_a, weight.device, intermediate_dtype), + comfy.model_management.cast_to_device(w1_b, weight.device, intermediate_dtype)) + else: + w1 = comfy.model_management.cast_to_device(w1, weight.device, intermediate_dtype) + + if w2 is None: + dim = w2_b.shape[0] + if t2 is None: + w2 = torch.mm(comfy.model_management.cast_to_device(w2_a, weight.device, intermediate_dtype), + comfy.model_management.cast_to_device(w2_b, weight.device, intermediate_dtype)) + else: + w2 = torch.einsum('i j k l, j r, i p -> p r k l', + comfy.model_management.cast_to_device(t2, weight.device, intermediate_dtype), + comfy.model_management.cast_to_device(w2_b, weight.device, intermediate_dtype), + comfy.model_management.cast_to_device(w2_a, weight.device, intermediate_dtype)) + else: + w2 = comfy.model_management.cast_to_device(w2, weight.device, intermediate_dtype) + + if len(w2.shape) == 4: + w1 = w1.unsqueeze(2).unsqueeze(2) + if v[2] is not None and dim is not None: + alpha = v[2] / dim + else: + alpha = 1.0 + + try: + lora_diff = torch.kron(w1, w2).reshape(weight.shape) + if dora_scale is not None: + weight = weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediate_dtype, function) + else: + weight += function(((strength * alpha) * lora_diff).type(weight.dtype)) + except Exception as e: + logging.error("ERROR {} {} {}".format(self.name, key, e)) + return weight diff --git a/comfy/weight_adapter/lora.py b/comfy/weight_adapter/lora.py new file mode 100644 index 000000000..b2e623924 --- /dev/null +++ b/comfy/weight_adapter/lora.py @@ -0,0 +1,142 @@ +import logging +from typing import Optional + +import torch +import comfy.model_management +from .base import WeightAdapterBase, weight_decompose, pad_tensor_to_shape + + +class LoRAAdapter(WeightAdapterBase): + name = "lora" + + def __init__(self, loaded_keys, weights): + self.loaded_keys = loaded_keys + self.weights = weights + + @classmethod + def load( + cls, + x: str, + lora: dict[str, torch.Tensor], + alpha: float, + dora_scale: torch.Tensor, + loaded_keys: set[str] = None, + ) -> Optional["LoRAAdapter"]: + if loaded_keys is None: + loaded_keys = set() + + reshape_name = "{}.reshape_weight".format(x) + regular_lora = "{}.lora_up.weight".format(x) + diffusers_lora = "{}_lora.up.weight".format(x) + diffusers2_lora = "{}.lora_B.weight".format(x) + diffusers3_lora = "{}.lora.up.weight".format(x) + mochi_lora = "{}.lora_B".format(x) + transformers_lora = "{}.lora_linear_layer.up.weight".format(x) + A_name = None + + if regular_lora in lora.keys(): + A_name = regular_lora + B_name = "{}.lora_down.weight".format(x) + mid_name = "{}.lora_mid.weight".format(x) + elif diffusers_lora in lora.keys(): + A_name = diffusers_lora + B_name = "{}_lora.down.weight".format(x) + mid_name = None + elif diffusers2_lora in lora.keys(): + A_name = diffusers2_lora + B_name = "{}.lora_A.weight".format(x) + mid_name = None + elif diffusers3_lora in lora.keys(): + A_name = diffusers3_lora + B_name = "{}.lora.down.weight".format(x) + mid_name = None + elif mochi_lora in lora.keys(): + A_name = mochi_lora + B_name = "{}.lora_A".format(x) + mid_name = None + elif transformers_lora in lora.keys(): + A_name = transformers_lora + B_name = "{}.lora_linear_layer.down.weight".format(x) + mid_name = None + + if A_name is not None: + mid = None + if mid_name is not None and mid_name in lora.keys(): + mid = lora[mid_name] + loaded_keys.add(mid_name) + reshape = None + if reshape_name in lora.keys(): + try: + reshape = lora[reshape_name].tolist() + loaded_keys.add(reshape_name) + except: + pass + weights = (lora[A_name], lora[B_name], alpha, mid, dora_scale, reshape) + loaded_keys.add(A_name) + loaded_keys.add(B_name) + return cls(loaded_keys, weights) + else: + return None + + def calculate_weight( + self, + weight, + key, + strength, + strength_model, + offset, + function, + intermediate_dtype=torch.float32, + original_weight=None, + ): + v = self.weights + mat1 = comfy.model_management.cast_to_device( + v[0], weight.device, intermediate_dtype + ) + mat2 = comfy.model_management.cast_to_device( + v[1], weight.device, intermediate_dtype + ) + dora_scale = v[4] + reshape = v[5] + + if reshape is not None: + weight = pad_tensor_to_shape(weight, reshape) + + if v[2] is not None: + alpha = v[2] / mat2.shape[0] + else: + alpha = 1.0 + + if v[3] is not None: + # locon mid weights, hopefully the math is fine because I didn't properly test it + mat3 = comfy.model_management.cast_to_device( + v[3], weight.device, intermediate_dtype + ) + final_shape = [mat2.shape[1], mat2.shape[0], mat3.shape[2], mat3.shape[3]] + mat2 = ( + torch.mm( + mat2.transpose(0, 1).flatten(start_dim=1), + mat3.transpose(0, 1).flatten(start_dim=1), + ) + .reshape(final_shape) + .transpose(0, 1) + ) + try: + lora_diff = torch.mm( + mat1.flatten(start_dim=1), mat2.flatten(start_dim=1) + ).reshape(weight.shape) + if dora_scale is not None: + weight = weight_decompose( + dora_scale, + weight, + lora_diff, + alpha, + strength, + intermediate_dtype, + function, + ) + else: + weight += function(((strength * alpha) * lora_diff).type(weight.dtype)) + except Exception as e: + logging.error("ERROR {} {} {}".format(self.name, key, e)) + return weight From 3ab231f01f26f9cec03bd94382ae5b6289789d9e Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Mon, 21 Apr 2025 20:36:12 -0700 Subject: [PATCH 336/478] Fix issue with WAN VACE implementation. (#7724) --- comfy/ldm/wan/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index 4ef86d5f2..b8eec3afb 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -630,7 +630,7 @@ class VaceWanModel(WanModel): ii = self.vace_layers_mapping.get(i, None) if ii is not None: c_skip, c = self.vace_blocks[ii](c, x=x_orig, e=e0, freqs=freqs, context=context, context_img_len=context_img_len) - x += c_skip * vace_strength + x += c_skip * vace_strength # head x = self.head(x, e) From 966c43ce268341de6e60762ef18e7628f7d311bf Mon Sep 17 00:00:00 2001 From: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> Date: Tue, 22 Apr 2025 16:59:47 +0800 Subject: [PATCH 337/478] Add OFT/BOFT algorithm in weight adapter (#7725) --- comfy/weight_adapter/__init__.py | 4 ++ comfy/weight_adapter/boft.py | 115 +++++++++++++++++++++++++++++++ comfy/weight_adapter/oft.py | 94 +++++++++++++++++++++++++ 3 files changed, 213 insertions(+) create mode 100644 comfy/weight_adapter/boft.py create mode 100644 comfy/weight_adapter/oft.py diff --git a/comfy/weight_adapter/__init__.py b/comfy/weight_adapter/__init__.py index e6cd805b6..d2a1d0151 100644 --- a/comfy/weight_adapter/__init__.py +++ b/comfy/weight_adapter/__init__.py @@ -3,6 +3,8 @@ from .lora import LoRAAdapter from .loha import LoHaAdapter from .lokr import LoKrAdapter from .glora import GLoRAAdapter +from .oft import OFTAdapter +from .boft import BOFTAdapter adapters: list[type[WeightAdapterBase]] = [ @@ -10,4 +12,6 @@ adapters: list[type[WeightAdapterBase]] = [ LoHaAdapter, LoKrAdapter, GLoRAAdapter, + OFTAdapter, + BOFTAdapter, ] diff --git a/comfy/weight_adapter/boft.py b/comfy/weight_adapter/boft.py new file mode 100644 index 000000000..c85adc7ab --- /dev/null +++ b/comfy/weight_adapter/boft.py @@ -0,0 +1,115 @@ +import logging +from typing import Optional + +import torch +import comfy.model_management +from .base import WeightAdapterBase, weight_decompose + + +class BOFTAdapter(WeightAdapterBase): + name = "boft" + + def __init__(self, loaded_keys, weights): + self.loaded_keys = loaded_keys + self.weights = weights + + @classmethod + def load( + cls, + x: str, + lora: dict[str, torch.Tensor], + alpha: float, + dora_scale: torch.Tensor, + loaded_keys: set[str] = None, + ) -> Optional["BOFTAdapter"]: + if loaded_keys is None: + loaded_keys = set() + blocks_name = "{}.boft_blocks".format(x) + rescale_name = "{}.rescale".format(x) + + blocks = None + if blocks_name in lora.keys(): + blocks = lora[blocks_name] + if blocks.ndim == 4: + loaded_keys.add(blocks_name) + + rescale = None + if rescale_name in lora.keys(): + rescale = lora[rescale_name] + loaded_keys.add(rescale_name) + + if blocks is not None: + weights = (blocks, rescale, alpha, dora_scale) + return cls(loaded_keys, weights) + else: + return None + + def calculate_weight( + self, + weight, + key, + strength, + strength_model, + offset, + function, + intermediate_dtype=torch.float32, + original_weight=None, + ): + v = self.weights + blocks = v[0] + rescale = v[1] + alpha = v[2] + dora_scale = v[3] + + blocks = comfy.model_management.cast_to_device(blocks, weight.device, intermediate_dtype) + if rescale is not None: + rescale = comfy.model_management.cast_to_device(rescale, weight.device, intermediate_dtype) + + boft_m, block_num, boft_b, *_ = blocks.shape + + try: + # Get r + I = torch.eye(boft_b, device=blocks.device, dtype=blocks.dtype) + # for Q = -Q^T + q = blocks - blocks.transpose(1, 2) + normed_q = q + if alpha > 0: # alpha in boft/bboft is for constraint + q_norm = torch.norm(q) + 1e-8 + if q_norm > alpha: + normed_q = q * alpha / q_norm + # use float() to prevent unsupported type in .inverse() + r = (I + normed_q) @ (I - normed_q).float().inverse() + r = r.to(original_weight) + + inp = org = original_weight + + r_b = boft_b//2 + for i in range(boft_m): + bi = r[i] + g = 2 + k = 2**i * r_b + if strength != 1: + bi = bi * strength + (1-strength) * I + inp = ( + inp.unflatten(-1, (-1, g, k)) + .transpose(-2, -1) + .flatten(-3) + .unflatten(-1, (-1, boft_b)) + ) + inp = torch.einsum("b n m, b n ... -> b m ...", inp, bi) + inp = ( + inp.flatten(-2).unflatten(-1, (-1, k, g)).transpose(-2, -1).flatten(-3) + ) + + if rescale is not None: + inp = inp * rescale + + lora_diff = inp - org + lora_diff = comfy.model_management.cast_to_device(lora_diff, weight.device, intermediate_dtype) + if dora_scale is not None: + weight = weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediate_dtype, function) + else: + weight += function(((strength * alpha) * lora_diff).type(weight.dtype)) + except Exception as e: + logging.error("ERROR {} {} {}".format(self.name, key, e)) + return weight diff --git a/comfy/weight_adapter/oft.py b/comfy/weight_adapter/oft.py new file mode 100644 index 000000000..0ea229b79 --- /dev/null +++ b/comfy/weight_adapter/oft.py @@ -0,0 +1,94 @@ +import logging +from typing import Optional + +import torch +import comfy.model_management +from .base import WeightAdapterBase, weight_decompose + + +class OFTAdapter(WeightAdapterBase): + name = "oft" + + def __init__(self, loaded_keys, weights): + self.loaded_keys = loaded_keys + self.weights = weights + + @classmethod + def load( + cls, + x: str, + lora: dict[str, torch.Tensor], + alpha: float, + dora_scale: torch.Tensor, + loaded_keys: set[str] = None, + ) -> Optional["OFTAdapter"]: + if loaded_keys is None: + loaded_keys = set() + blocks_name = "{}.oft_blocks".format(x) + rescale_name = "{}.rescale".format(x) + + blocks = None + if blocks_name in lora.keys(): + blocks = lora[blocks_name] + if blocks.ndim == 3: + loaded_keys.add(blocks_name) + + rescale = None + if rescale_name in lora.keys(): + rescale = lora[rescale_name] + loaded_keys.add(rescale_name) + + if blocks is not None: + weights = (blocks, rescale, alpha, dora_scale) + return cls(loaded_keys, weights) + else: + return None + + def calculate_weight( + self, + weight, + key, + strength, + strength_model, + offset, + function, + intermediate_dtype=torch.float32, + original_weight=None, + ): + v = self.weights + blocks = v[0] + rescale = v[1] + alpha = v[2] + dora_scale = v[3] + + blocks = comfy.model_management.cast_to_device(blocks, weight.device, intermediate_dtype) + if rescale is not None: + rescale = comfy.model_management.cast_to_device(rescale, weight.device, intermediate_dtype) + + block_num, block_size, *_ = blocks.shape + + try: + # Get r + I = torch.eye(block_size, device=blocks.device, dtype=blocks.dtype) + # for Q = -Q^T + q = blocks - blocks.transpose(1, 2) + normed_q = q + if alpha > 0: # alpha in oft/boft is for constraint + q_norm = torch.norm(q) + 1e-8 + if q_norm > alpha: + normed_q = q * alpha / q_norm + # use float() to prevent unsupported type in .inverse() + r = (I + normed_q) @ (I - normed_q).float().inverse() + r = r.to(original_weight) + lora_diff = torch.einsum( + "k n m, k n ... -> k m ...", + (r * strength) - strength * I, + original_weight, + ) + if dora_scale is not None: + weight = weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediate_dtype, function) + else: + weight += function(((strength * alpha) * lora_diff).type(weight.dtype)) + except Exception as e: + logging.error("ERROR {} {} {}".format(self.name, key, e)) + return weight From 454a635c1b8aae9f635e7fb4f696bf7ac2e1fd1f Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Tue, 22 Apr 2025 05:00:28 -0400 Subject: [PATCH 338/478] upstream MaskPreview from ComfyUI_essentials (#7719) --- comfy_extras/nodes_mask.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/comfy_extras/nodes_mask.py b/comfy_extras/nodes_mask.py index 13d2b4bab..99b264a32 100644 --- a/comfy_extras/nodes_mask.py +++ b/comfy_extras/nodes_mask.py @@ -3,7 +3,10 @@ import scipy.ndimage import torch import comfy.utils import node_helpers +import folder_paths +import random +import nodes from nodes import MAX_RESOLUTION def composite(destination, source, x, y, mask = None, multiplier = 8, resize_source = False): @@ -362,6 +365,30 @@ class ThresholdMask: mask = (mask > value).float() return (mask,) +# Mask Preview - original implement from +# https://github.com/cubiq/ComfyUI_essentials/blob/9d9f4bedfc9f0321c19faf71855e228c93bd0dc9/mask.py#L81 +# upstream requested in https://github.com/Kosinkadink/rfcs/blob/main/rfcs/0000-corenodes.md#preview-nodes +class MaskPreview(nodes.SaveImage): + def __init__(self): + self.output_dir = folder_paths.get_temp_directory() + self.type = "temp" + self.prefix_append = "_temp_" + ''.join(random.choice("abcdefghijklmnopqrstupvxyz") for x in range(5)) + self.compress_level = 4 + + @classmethod + def INPUT_TYPES(s): + return { + "required": {"mask": ("MASK",), }, + "hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"}, + } + + FUNCTION = "execute" + CATEGORY = "mask" + + def execute(self, mask, filename_prefix="ComfyUI", prompt=None, extra_pnginfo=None): + preview = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3) + return self.save_images(preview, filename_prefix, prompt, extra_pnginfo) + NODE_CLASS_MAPPINGS = { "LatentCompositeMasked": LatentCompositeMasked, @@ -376,6 +403,7 @@ NODE_CLASS_MAPPINGS = { "FeatherMask": FeatherMask, "GrowMask": GrowMask, "ThresholdMask": ThresholdMask, + "MaskPreview": MaskPreview } NODE_DISPLAY_NAME_MAPPINGS = { From a8f63c0d5b40b4ed12faa1376e973b0e790b1c0d Mon Sep 17 00:00:00 2001 From: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> Date: Tue, 22 Apr 2025 17:01:27 +0800 Subject: [PATCH 339/478] Support dora_scale on both axis (#7727) --- comfy/weight_adapter/base.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/comfy/weight_adapter/base.py b/comfy/weight_adapter/base.py index 54af3babe..29873519d 100644 --- a/comfy/weight_adapter/base.py +++ b/comfy/weight_adapter/base.py @@ -43,13 +43,23 @@ def weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediat dora_scale = comfy.model_management.cast_to_device(dora_scale, weight.device, intermediate_dtype) lora_diff *= alpha weight_calc = weight + function(lora_diff).type(weight.dtype) - weight_norm = ( - weight_calc.transpose(0, 1) - .reshape(weight_calc.shape[1], -1) - .norm(dim=1, keepdim=True) - .reshape(weight_calc.shape[1], *[1] * (weight_calc.dim() - 1)) - .transpose(0, 1) - ) + + wd_on_output_axis = dora_scale.shape[0] == weight_calc.shape[0] + if wd_on_output_axis: + weight_norm = ( + weight.reshape(weight.shape[0], -1) + .norm(dim=1, keepdim=True) + .reshape(weight.shape[0], *[1] * (weight.dim() - 1)) + ) + else: + weight_norm = ( + weight_calc.transpose(0, 1) + .reshape(weight_calc.shape[1], -1) + .norm(dim=1, keepdim=True) + .reshape(weight_calc.shape[1], *[1] * (weight_calc.dim() - 1)) + .transpose(0, 1) + ) + weight_norm = weight_norm + torch.finfo(weight.dtype).eps weight_calc *= (dora_scale / weight_norm).type(weight.dtype) if strength != 1.0: From 2d6805ce57cede78acb6515112439c5092c7b257 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Tue, 22 Apr 2025 03:17:38 -0700 Subject: [PATCH 340/478] Add option for using fp8_e8m0fnu for model weights. (#7733) Seems to break every model I have tried but worth testing? --- comfy/cli_args.py | 1 + comfy/model_management.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 81f29f098..1b971be3c 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -66,6 +66,7 @@ fpunet_group.add_argument("--bf16-unet", action="store_true", help="Run the diff fpunet_group.add_argument("--fp16-unet", action="store_true", help="Run the diffusion model in fp16") fpunet_group.add_argument("--fp8_e4m3fn-unet", action="store_true", help="Store unet weights in fp8_e4m3fn.") fpunet_group.add_argument("--fp8_e5m2-unet", action="store_true", help="Store unet weights in fp8_e5m2.") +fpunet_group.add_argument("--fp8_e8m0fnu-unet", action="store_true", help="Store unet weights in fp8_e8m0fnu.") fpvae_group = parser.add_mutually_exclusive_group() fpvae_group.add_argument("--fp16-vae", action="store_true", help="Run the VAE in fp16, might cause black images.") diff --git a/comfy/model_management.py b/comfy/model_management.py index 19e6c8dff..43e402243 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -725,6 +725,8 @@ def unet_dtype(device=None, model_params=0, supported_dtypes=[torch.float16, tor return torch.float8_e4m3fn if args.fp8_e5m2_unet: return torch.float8_e5m2 + if args.fp8_e8m0fnu_unet: + return torch.float8_e8m0fnu fp8_dtype = None if weight_dtype in FLOAT8_TYPES: From 92cdc692f47188e6e4c48c5666ac802281240a37 Mon Sep 17 00:00:00 2001 From: Alex Butler Date: Tue, 22 Apr 2025 22:57:17 +0100 Subject: [PATCH 341/478] Replace aom-av1 with svt-av1 for saving webm videos, use preset 6 + yuv420p10le pixel format (#7736) * Add support for saving svt-av1 webm videos & yuv420p10le pixel format * Replace aom-av1 with svt-av1 Use yuv420p10le for av1 --- comfy_extras/nodes_video.py | 6 ++++-- requirements.txt | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/comfy_extras/nodes_video.py b/comfy_extras/nodes_video.py index 97ca513d8..a9e244ebe 100644 --- a/comfy_extras/nodes_video.py +++ b/comfy_extras/nodes_video.py @@ -50,13 +50,15 @@ class SaveWEBM: for x in extra_pnginfo: container.metadata[x] = json.dumps(extra_pnginfo[x]) - codec_map = {"vp9": "libvpx-vp9", "av1": "libaom-av1"} + codec_map = {"vp9": "libvpx-vp9", "av1": "libsvtav1"} stream = container.add_stream(codec_map[codec], rate=Fraction(round(fps * 1000), 1000)) stream.width = images.shape[-2] stream.height = images.shape[-3] - stream.pix_fmt = "yuv420p" + stream.pix_fmt = "yuv420p10le" if codec == "av1" else "yuv420p" stream.bit_rate = 0 stream.options = {'crf': str(crf)} + if codec == "av1": + stream.options["preset"] = "6" for frame in images: frame = av.VideoFrame.from_ndarray(torch.clamp(frame[..., :3] * 255, min=0, max=255).to(device=torch.device("cpu"), dtype=torch.uint8).numpy(), format="rgb24") diff --git a/requirements.txt b/requirements.txt index 5c3a854ce..90eb04612 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,4 +22,4 @@ psutil kornia>=0.7.1 spandrel soundfile -av +av>=14.1.0 From 0738e4ea5dd5ecac34d8cf61bb381ea6d159394b Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Tue, 22 Apr 2025 23:18:08 -0700 Subject: [PATCH 342/478] [API nodes] Add backbone for supporting api nodes in ComfyUI (#7745) * Add Ideogram generate node. * Add staging api. * COMFY_API_NODE_NAME node property * switch to boolean flag and use original node name for id * add optional to type * Add API_NODE and common error for missing auth token (#5) * Add Minimax Video Generation + Async Task queue polling example (#6) * [Minimax] Show video preview and embed workflow in ouput (#7) * [API Nodes] Send empty request body instead of empty dictionary. (#8) * Fixed: removed function from rebase. * Add pydantic. * Remove uv.lock * Remove polling operations. * Update stubs workflow. * Remove polling comments. * Update stubs. * Use pydantic v2. * Use pydantic v2. * Add basic OpenAITextToImage node * Add. * convert image to tensor. * Improve types. * Ruff. * Push tests. * Handle multi-form data. - Don't set content-type for multi-part/form - Use data field instead of JSON * Change to api.comfy.org * Handle error code 409. * Remove nodes. --------- Co-authored-by: bymyself Co-authored-by: Yoland Y <4950057+yoland68@users.noreply.github.com> --- comfy/comfy_types/node_typing.py | 4 +- comfy_api_nodes/__init__.py | 0 comfy_api_nodes/apis/client.py | 337 +++++++++++++++++++++++++++++++ requirements.txt | 1 + server.py | 3 + 5 files changed, 344 insertions(+), 1 deletion(-) create mode 100644 comfy_api_nodes/__init__.py create mode 100644 comfy_api_nodes/apis/client.py diff --git a/comfy/comfy_types/node_typing.py b/comfy/comfy_types/node_typing.py index a348791a9..0bdda032e 100644 --- a/comfy/comfy_types/node_typing.py +++ b/comfy/comfy_types/node_typing.py @@ -1,7 +1,7 @@ """Comfy-specific type hinting""" from __future__ import annotations -from typing import Literal, TypedDict +from typing import Literal, TypedDict, Optional from typing_extensions import NotRequired from abc import ABC, abstractmethod from enum import Enum @@ -229,6 +229,8 @@ class ComfyNodeABC(ABC): """Flags a node as experimental, informing users that it may change or not work as expected.""" DEPRECATED: bool """Flags a node as deprecated, indicating to users that they should find alternatives to this node.""" + API_NODE: Optional[bool] + """Flags a node as an API node.""" @classmethod @abstractmethod diff --git a/comfy_api_nodes/__init__.py b/comfy_api_nodes/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/comfy_api_nodes/apis/client.py b/comfy_api_nodes/apis/client.py new file mode 100644 index 000000000..cd81d5a1d --- /dev/null +++ b/comfy_api_nodes/apis/client.py @@ -0,0 +1,337 @@ +import logging + +""" +API Client Framework for api.comfy.org. + +This module provides a flexible framework for making API requests from ComfyUI nodes. +It supports both synchronous and asynchronous API operations with proper type validation. + +Key Components: +-------------- +1. ApiClient - Handles HTTP requests with authentication and error handling +2. ApiEndpoint - Defines a single HTTP endpoint with its request/response models +3. ApiOperation - Executes a single synchronous API operation + +Usage Examples: +-------------- + +# Example 1: Synchronous API Operation +# ------------------------------------ +# For a simple API call that returns the result immediately: + +# 1. Create the API client +api_client = ApiClient( + base_url="https://api.example.com", + api_key="your_api_key_here", + timeout=30.0, + verify_ssl=True +) + +# 2. Define the endpoint +user_info_endpoint = ApiEndpoint( + path="/v1/users/me", + method=HttpMethod.GET, + request_model=EmptyRequest, # No request body needed + response_model=UserProfile, # Pydantic model for the response + query_params=None +) + +# 3. Create the request object +request = EmptyRequest() + +# 4. Create and execute the operation +operation = ApiOperation( + endpoint=user_info_endpoint, + request=request +) +user_profile = operation.execute(client=api_client) # Returns immediately with the result + +""" + +from typing import ( + Dict, + Type, + Optional, + Any, + TypeVar, + Generic, +) +from pydantic import BaseModel +from enum import Enum +import json +import requests +from urllib.parse import urljoin + +T = TypeVar("T", bound=BaseModel) +R = TypeVar("R", bound=BaseModel) + +class EmptyRequest(BaseModel): + """Base class for empty request bodies. + For GET requests, fields will be sent as query parameters.""" + + pass + + +class HttpMethod(str, Enum): + GET = "GET" + POST = "POST" + PUT = "PUT" + DELETE = "DELETE" + PATCH = "PATCH" + + +class ApiClient: + """ + Client for making HTTP requests to an API with authentication and error handling. + """ + + def __init__( + self, + base_url: str, + api_key: Optional[str] = None, + timeout: float = 30.0, + verify_ssl: bool = True, + ): + self.base_url = base_url + self.api_key = api_key + self.timeout = timeout + self.verify_ssl = verify_ssl + + def get_headers(self) -> Dict[str, str]: + """Get headers for API requests, including authentication if available""" + headers = {"Content-Type": "application/json", "Accept": "application/json"} + + if self.api_key: + headers["Authorization"] = f"Bearer {self.api_key}" + + return headers + + def request( + self, + method: str, + path: str, + params: Optional[Dict[str, Any]] = None, + json: Optional[Dict[str, Any]] = None, + files: Optional[Dict[str, Any]] = None, + headers: Optional[Dict[str, str]] = None, + ) -> Dict[str, Any]: + """ + Make an HTTP request to the API + + Args: + method: HTTP method (GET, POST, etc.) + path: API endpoint path (will be joined with base_url) + params: Query parameters + json: JSON body data + files: Files to upload + headers: Additional headers + + Returns: + Parsed JSON response + + Raises: + requests.RequestException: If the request fails + """ + url = urljoin(self.base_url, path) + self.check_auth_token(self.api_key) + # Combine default headers with any provided headers + request_headers = self.get_headers() + if headers: + request_headers.update(headers) + + # Let requests handle the content type when files are present. + if files: + del request_headers["Content-Type"] + + logging.debug(f"[DEBUG] Request Headers: {request_headers}") + logging.debug(f"[DEBUG] Files: {files}") + logging.debug(f"[DEBUG] Params: {params}") + logging.debug(f"[DEBUG] Json: {json}") + + try: + # If files are present, use data parameter instead of json + if files: + form_data = {} + if json: + form_data.update(json) + response = requests.request( + method=method, + url=url, + params=params, + data=form_data, # Use data instead of json + files=files, + headers=request_headers, + timeout=self.timeout, + verify=self.verify_ssl, + ) + else: + response = requests.request( + method=method, + url=url, + params=params, + json=json, + headers=request_headers, + timeout=self.timeout, + verify=self.verify_ssl, + ) + + # Raise exception for error status codes + response.raise_for_status() + except requests.ConnectionError: + raise Exception( + f"Unable to connect to the API server at {self.base_url}. Please check your internet connection or verify the service is available." + ) + + except requests.Timeout: + raise Exception( + f"Request timed out after {self.timeout} seconds. The server might be experiencing high load or the operation is taking longer than expected." + ) + + except requests.HTTPError as e: + status_code = e.response.status_code if hasattr(e, "response") else None + error_message = f"HTTP Error: {str(e)}" + + # Try to extract detailed error message from JSON response + try: + if hasattr(e, "response") and e.response.content: + error_json = e.response.json() + if "error" in error_json and "message" in error_json["error"]: + error_message = f"API Error: {error_json['error']['message']}" + if "type" in error_json["error"]: + error_message += f" (Type: {error_json['error']['type']})" + else: + error_message = f"API Error: {error_json}" + except Exception as json_error: + # If we can't parse the JSON, fall back to the original error message + logging.debug(f"[DEBUG] Failed to parse error response: {str(json_error)}") + + logging.debug(f"[DEBUG] API Error: {error_message} (Status: {status_code})") + if hasattr(e, "response") and e.response.content: + logging.debug(f"[DEBUG] Response content: {e.response.content}") + if status_code == 401: + error_message = "Unauthorized: Please login first to use this node." + if status_code == 402: + error_message = "Payment Required: Please add credits to your account to use this node." + if status_code == 409: + error_message = "There is a problem with your account. Please contact support@comfy.org. " + if status_code == 429: + error_message = "Rate Limit Exceeded: Please try again later." + raise Exception(error_message) + + # Parse and return JSON response + if response.content: + return response.json() + return {} + + def check_auth_token(self, auth_token): + """Verify that an auth token is present.""" + if auth_token is None: + raise Exception("Please login first to use this node.") + return auth_token + + +class ApiEndpoint(Generic[T, R]): + """Defines an API endpoint with its request and response types""" + + def __init__( + self, + path: str, + method: HttpMethod, + request_model: Type[T], + response_model: Type[R], + query_params: Optional[Dict[str, Any]] = None, + ): + """Initialize an API endpoint definition. + + Args: + path: The URL path for this endpoint, can include placeholders like {id} + method: The HTTP method to use (GET, POST, etc.) + request_model: Pydantic model class that defines the structure and validation rules for API requests to this endpoint + response_model: Pydantic model class that defines the structure and validation rules for API responses from this endpoint + query_params: Optional dictionary of query parameters to include in the request + """ + self.path = path + self.method = method + self.request_model = request_model + self.response_model = response_model + self.query_params = query_params or {} + + +class SynchronousOperation(Generic[T, R]): + """ + Represents a single synchronous API operation. + """ + + def __init__( + self, + endpoint: ApiEndpoint[T, R], + request: T, + files: Optional[Dict[str, Any]] = None, + api_base: str = "https://api.comfy.org", + auth_token: Optional[str] = None, + timeout: float = 60.0, + verify_ssl: bool = True, + ): + self.endpoint = endpoint + self.request = request + self.response = None + self.error = None + self.api_base = api_base + self.auth_token = auth_token + self.timeout = timeout + self.verify_ssl = verify_ssl + self.files = files + def execute(self, client: Optional[ApiClient] = None) -> R: + """Execute the API operation using the provided client or create one""" + try: + # Create client if not provided + if client is None: + if self.api_base is None: + raise ValueError("Either client or api_base must be provided") + client = ApiClient( + base_url=self.api_base, + api_key=self.auth_token, + timeout=self.timeout, + verify_ssl=self.verify_ssl, + ) + + # Convert request model to dict, but use None for EmptyRequest + request_dict = None if isinstance(self.request, EmptyRequest) else self.request.model_dump(exclude_none=True) + + # Debug log for request + logging.debug(f"[DEBUG] API Request: {self.endpoint.method.value} {self.endpoint.path}") + logging.debug(f"[DEBUG] Request Data: {json.dumps(request_dict, indent=2)}") + logging.debug(f"[DEBUG] Query Params: {self.endpoint.query_params}") + + # Make the request + resp = client.request( + method=self.endpoint.method.value, + path=self.endpoint.path, + json=request_dict, + params=self.endpoint.query_params, + files=self.files, + ) + + # Debug log for response + logging.debug("=" * 50) + logging.debug("[DEBUG] RESPONSE DETAILS:") + logging.debug("[DEBUG] Status Code: 200 (Success)") + logging.debug(f"[DEBUG] Response Body: {json.dumps(resp, indent=2)}") + logging.debug("=" * 50) + + # Parse and return the response + return self._parse_response(resp) + + except Exception as e: + logging.debug(f"[DEBUG] API Exception: {str(e)}") + raise Exception(str(e)) + + def _parse_response(self, resp): + """Parse response data - can be overridden by subclasses""" + # The response is already the complete object, don't extract just the "data" field + # as that would lose the outer structure (created timestamp, etc.) + + # Parse response using the provided model + self.response = self.endpoint.response_model.model_validate(resp) + logging.debug(f"[DEBUG] Parsed Response: {self.response}") + return self.response diff --git a/requirements.txt b/requirements.txt index 90eb04612..f8ad908ca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,3 +23,4 @@ kornia>=0.7.1 spandrel soundfile av>=14.1.0 +pydantic~=2.0 diff --git a/server.py b/server.py index 0cc97b248..f64ec27d4 100644 --- a/server.py +++ b/server.py @@ -580,6 +580,9 @@ class PromptServer(): info['deprecated'] = True if getattr(obj_class, "EXPERIMENTAL", False): info['experimental'] = True + + if hasattr(obj_class, 'API_NODE'): + info['api_node'] = obj_class.API_NODE return info @routes.get("/object_info") From 552615235dc043f0b07d11e1ff2e6571e6f90d4d Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 23 Apr 2025 01:12:52 -0700 Subject: [PATCH 343/478] Fix for dino lowvram. (#7748) --- comfy/image_encoders/dino2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/image_encoders/dino2.py b/comfy/image_encoders/dino2.py index 130ed6fd7..976f98c65 100644 --- a/comfy/image_encoders/dino2.py +++ b/comfy/image_encoders/dino2.py @@ -116,7 +116,7 @@ class Dino2Embeddings(torch.nn.Module): def forward(self, pixel_values): x = self.patch_embeddings(pixel_values) # TODO: mask_token? - x = torch.cat((self.cls_token.expand(x.shape[0], -1, -1), x), dim=1) + x = torch.cat((self.cls_token.to(device=x.device, dtype=x.dtype).expand(x.shape[0], -1, -1), x), dim=1) x = x + comfy.model_management.cast_to_device(self.position_embeddings, x.device, x.dtype) return x From 21a11ef817e3749047c6b548231210ff84fe331d Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 23 Apr 2025 02:12:59 -0700 Subject: [PATCH 344/478] Pytorch stable 2.7 is out and support cu128 (#7749) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cf6df7e55..62800bb4f 100644 --- a/README.md +++ b/README.md @@ -216,9 +216,9 @@ Additional discussion and help can be found [here](https://github.com/comfyanony Nvidia users should install stable pytorch using this command: -```pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu126``` +```pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu128``` -This is the command to install pytorch nightly instead which supports the new blackwell 50xx series GPUs and might have performance improvements. +This is the command to install pytorch nightly instead which might have performance improvements. ```pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128``` From 7eaff81be106fa5e1479cfa69f5fd06265611f2e Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 23 Apr 2025 02:28:24 -0700 Subject: [PATCH 345/478] fp16 accumulation can now be enabled on the stable package. (#7750) --- .../run_nvidia_gpu_fast_fp16_accumulation.bat | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .ci/{windows_nightly_base_files => windows_base_files}/run_nvidia_gpu_fast_fp16_accumulation.bat (100%) diff --git a/.ci/windows_nightly_base_files/run_nvidia_gpu_fast_fp16_accumulation.bat b/.ci/windows_base_files/run_nvidia_gpu_fast_fp16_accumulation.bat similarity index 100% rename from .ci/windows_nightly_base_files/run_nvidia_gpu_fast_fp16_accumulation.bat rename to .ci/windows_base_files/run_nvidia_gpu_fast_fp16_accumulation.bat From 3eaad0590e51bc186b1d533fef906e3f296cdd42 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 23 Apr 2025 02:47:09 -0700 Subject: [PATCH 346/478] Lower size of release package. (#7751) --- .github/workflows/windows_release_package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows_release_package.yml b/.github/workflows/windows_release_package.yml index 416544f71..8300c2faf 100644 --- a/.github/workflows/windows_release_package.yml +++ b/.github/workflows/windows_release_package.yml @@ -50,7 +50,7 @@ jobs: - uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 150 persist-credentials: false - shell: bash run: | @@ -82,7 +82,7 @@ jobs: cd .. - "C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=8 -mfb=64 -md=32m -ms=on -mf=BCJ2 ComfyUI_windows_portable.7z ComfyUI_windows_portable + "C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=9 -mfb=128 -md=256m -ms=on -mf=BCJ2 ComfyUI_windows_portable.7z ComfyUI_windows_portable mv ComfyUI_windows_portable.7z ComfyUI/new_ComfyUI_windows_portable_nvidia_cu${{ inputs.cu }}_or_cpu.7z cd ComfyUI_windows_portable From 154f2911aaf0333db576a237c6098ed0a8160a7d Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 23 Apr 2025 03:33:09 -0700 Subject: [PATCH 347/478] Lower size of release package more. (#7754) --- .github/workflows/stable-release.yml | 6 +++--- .github/workflows/windows_release_nightly_pytorch.yml | 2 +- .github/workflows/windows_release_package.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.yml index f7d30a9a4..40df7ab88 100644 --- a/.github/workflows/stable-release.yml +++ b/.github/workflows/stable-release.yml @@ -36,7 +36,7 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ inputs.git_tag }} - fetch-depth: 0 + fetch-depth: 150 persist-credentials: false - uses: actions/cache/restore@v4 id: cache @@ -70,7 +70,7 @@ jobs: cd .. git clone --depth 1 https://github.com/comfyanonymous/taesd - cp taesd/*.pth ./ComfyUI_copy/models/vae_approx/ + cp taesd/*.safetensors ./ComfyUI_copy/models/vae_approx/ mkdir ComfyUI_windows_portable mv python_embeded ComfyUI_windows_portable @@ -85,7 +85,7 @@ jobs: cd .. - "C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=8 -mfb=64 -md=32m -ms=on -mf=BCJ2 ComfyUI_windows_portable.7z ComfyUI_windows_portable + "C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=9 -mfb=128 -md=512m -ms=on -mf=BCJ2 ComfyUI_windows_portable.7z ComfyUI_windows_portable mv ComfyUI_windows_portable.7z ComfyUI/ComfyUI_windows_portable_nvidia.7z cd ComfyUI_windows_portable diff --git a/.github/workflows/windows_release_nightly_pytorch.yml b/.github/workflows/windows_release_nightly_pytorch.yml index 24599249a..eb5ed9c91 100644 --- a/.github/workflows/windows_release_nightly_pytorch.yml +++ b/.github/workflows/windows_release_nightly_pytorch.yml @@ -56,7 +56,7 @@ jobs: cd .. git clone --depth 1 https://github.com/comfyanonymous/taesd - cp taesd/*.pth ./ComfyUI_copy/models/vae_approx/ + cp taesd/*.safetensors ./ComfyUI_copy/models/vae_approx/ mkdir ComfyUI_windows_portable_nightly_pytorch mv python_embeded ComfyUI_windows_portable_nightly_pytorch diff --git a/.github/workflows/windows_release_package.yml b/.github/workflows/windows_release_package.yml index 8300c2faf..dc79b1f4a 100644 --- a/.github/workflows/windows_release_package.yml +++ b/.github/workflows/windows_release_package.yml @@ -67,7 +67,7 @@ jobs: cd .. git clone --depth 1 https://github.com/comfyanonymous/taesd - cp taesd/*.pth ./ComfyUI_copy/models/vae_approx/ + cp taesd/*.safetensors ./ComfyUI_copy/models/vae_approx/ mkdir ComfyUI_windows_portable mv python_embeded ComfyUI_windows_portable @@ -82,7 +82,7 @@ jobs: cd .. - "C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=9 -mfb=128 -md=256m -ms=on -mf=BCJ2 ComfyUI_windows_portable.7z ComfyUI_windows_portable + "C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=9 -mfb=128 -md=512m -ms=on -mf=BCJ2 ComfyUI_windows_portable.7z ComfyUI_windows_portable mv ComfyUI_windows_portable.7z ComfyUI/new_ComfyUI_windows_portable_nvidia_cu${{ inputs.cu }}_or_cpu.7z cd ComfyUI_windows_portable From dea1c7474a8e663732a755204970e09006df68c7 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Wed, 23 Apr 2025 12:38:34 -0700 Subject: [PATCH 348/478] Add support for API Nodes in ComfyUI. (#7726) * Add Ideogram generate node. * Add staging api. * COMFY_API_NODE_NAME node property * switch to boolean flag and use original node name for id * add optional to type * Add API_NODE and common error for missing auth token (#5) * Add Minimax Video Generation + Async Task queue polling example (#6) * [Minimax] Show video preview and embed workflow in ouput (#7) * [API Nodes] Send empty request body instead of empty dictionary. (#8) * Fixed: removed function from rebase. * Add pydantic. * Remove uv.lock * Remove polling operations. * Update stubs workflow. * Remove polling comments. * Update stubs. * Use pydantic v2. * Use pydantic v2. * Add basic OpenAITextToImage node * Add. * convert image to tensor. * Improve types. * Ruff. * Push tests. * Handle multi-form data. - Don't set content-type for multi-part/form - Use data field instead of JSON * Change to api.comfy.org * Handle error code 409. * separate out nodes per openai model * Update error message. * fix wrong output type * re-categorize nodes, remove ideogram (for now) * oops, fix mappings * fix ruff * Update frontend to 1.17.9 * embargo lift rename nodes * remove unused autogenerated model code * fix API type error and add b64 support for 4o * fix ruff * oops forgot mask scaling code * Remove unused types. --------- Co-authored-by: bymyself Co-authored-by: Yoland Y <4950057+yoland68@users.noreply.github.com> Co-authored-by: thot-experiment --- .github/workflows/update-api-stubs.yml | 47 +++ comfy_api_nodes/apis/PixverseController.py | 17 + comfy_api_nodes/apis/PixverseDto.py | 57 +++ comfy_api_nodes/apis/__init__.py | 422 ++++++++++++++++++++ comfy_api_nodes/apis/client.py | 2 +- comfy_api_nodes/nodes_api.py | 425 +++++++++++++++++++++ nodes.py | 9 + requirements.txt | 2 +- 8 files changed, 979 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/update-api-stubs.yml create mode 100644 comfy_api_nodes/apis/PixverseController.py create mode 100644 comfy_api_nodes/apis/PixverseDto.py create mode 100644 comfy_api_nodes/apis/__init__.py create mode 100644 comfy_api_nodes/nodes_api.py diff --git a/.github/workflows/update-api-stubs.yml b/.github/workflows/update-api-stubs.yml new file mode 100644 index 000000000..2ae99b673 --- /dev/null +++ b/.github/workflows/update-api-stubs.yml @@ -0,0 +1,47 @@ +name: Generate Pydantic Stubs from api.comfy.org + +on: + schedule: + - cron: '0 0 * * 1' + workflow_dispatch: + +jobs: + generate-models: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install 'datamodel-code-generator[http]' + + - name: Generate API models + run: | + datamodel-codegen --use-subclass-enum --url https://api.comfy.org/openapi --output comfy_api_nodes/apis --output-model-type pydantic_v2.BaseModel + + - name: Check for changes + id: git-check + run: | + git diff --exit-code comfy_api_nodes/apis || echo "changes=true" >> $GITHUB_OUTPUT + + - name: Create Pull Request + if: steps.git-check.outputs.changes == 'true' + uses: peter-evans/create-pull-request@v5 + with: + commit-message: 'chore: update API models from OpenAPI spec' + title: 'Update API models from api.comfy.org' + body: | + This PR updates the API models based on the latest api.comfy.org OpenAPI specification. + + Generated automatically by the a Github workflow. + branch: update-api-stubs + delete-branch: true + base: main diff --git a/comfy_api_nodes/apis/PixverseController.py b/comfy_api_nodes/apis/PixverseController.py new file mode 100644 index 000000000..29a3ab33b --- /dev/null +++ b/comfy_api_nodes/apis/PixverseController.py @@ -0,0 +1,17 @@ +# generated by datamodel-codegen: +# filename: https://api.comfy.org/openapi +# timestamp: 2025-04-23T15:56:33+00:00 + +from __future__ import annotations + +from typing import Optional + +from pydantic import BaseModel + +from . import PixverseDto + + +class ResponseData(BaseModel): + ErrCode: Optional[int] = None + ErrMsg: Optional[str] = None + Resp: Optional[PixverseDto.V2OpenAPII2VResp] = None diff --git a/comfy_api_nodes/apis/PixverseDto.py b/comfy_api_nodes/apis/PixverseDto.py new file mode 100644 index 000000000..399512214 --- /dev/null +++ b/comfy_api_nodes/apis/PixverseDto.py @@ -0,0 +1,57 @@ +# generated by datamodel-codegen: +# filename: https://api.comfy.org/openapi +# timestamp: 2025-04-23T15:56:33+00:00 + +from __future__ import annotations + +from typing import Optional + +from pydantic import BaseModel, Field, constr + + +class V2OpenAPII2VResp(BaseModel): + video_id: Optional[int] = Field(None, description='Video_id') + + +class V2OpenAPIT2VReq(BaseModel): + aspect_ratio: str = Field( + ..., description='Aspect ratio (16:9, 4:3, 1:1, 3:4, 9:16)', examples=['16:9'] + ) + duration: int = Field( + ..., + description='Video duration (5, 8 seconds, --model=v3.5 only allows 5,8; --quality=1080p does not support 8s)', + examples=[5], + ) + model: str = Field( + ..., description='Model version (only supports v3.5)', examples=['v3.5'] + ) + motion_mode: Optional[str] = Field( + 'normal', + description='Motion mode (normal, fast, --fast only available when duration=5; --quality=1080p does not support fast)', + examples=['normal'], + ) + negative_prompt: Optional[constr(max_length=2048)] = Field( + None, description='Negative prompt\n' + ) + prompt: constr(max_length=2048) = Field(..., description='Prompt') + quality: str = Field( + ..., + description='Video quality ("360p"(Turbo model), "540p", "720p", "1080p")', + examples=['540p'], + ) + seed: Optional[int] = Field(None, description='Random seed, range: 0 - 2147483647') + style: Optional[str] = Field( + None, + description='Style (effective when model=v3.5, "anime", "3d_animation", "clay", "comic", "cyberpunk") Do not include style parameter unless needed', + examples=['anime'], + ) + template_id: Optional[int] = Field( + None, + description='Template ID (template_id must be activated before use)', + examples=[302325299692608], + ) + water_mark: Optional[bool] = Field( + False, + description='Watermark (true: add watermark, false: no watermark)', + examples=[False], + ) diff --git a/comfy_api_nodes/apis/__init__.py b/comfy_api_nodes/apis/__init__.py new file mode 100644 index 000000000..e7ea9b332 --- /dev/null +++ b/comfy_api_nodes/apis/__init__.py @@ -0,0 +1,422 @@ +# generated by datamodel-codegen: +# filename: https://api.comfy.org/openapi +# timestamp: 2025-04-23T15:56:33+00:00 + +from __future__ import annotations + +from datetime import datetime +from enum import Enum +from typing import Any, Dict, List, Optional + +from pydantic import AnyUrl, BaseModel, Field, confloat, conint + +class Customer(BaseModel): + createdAt: Optional[datetime] = Field( + None, description='The date and time the user was created' + ) + email: Optional[str] = Field(None, description='The email address for this user') + id: str = Field(..., description='The firebase UID of the user') + name: Optional[str] = Field(None, description='The name for this user') + updatedAt: Optional[datetime] = Field( + None, description='The date and time the user was last updated' + ) + + +class Error(BaseModel): + details: Optional[List[str]] = Field( + None, + description='Optional detailed information about the error or hints for resolving it.', + ) + message: Optional[str] = Field( + None, description='A clear and concise description of the error.' + ) + + +class ErrorResponse(BaseModel): + error: str + message: str + +class ImageRequest(BaseModel): + aspect_ratio: Optional[str] = Field( + None, + description="Optional. The aspect ratio (e.g., 'ASPECT_16_9', 'ASPECT_1_1'). Cannot be used with resolution. Defaults to 'ASPECT_1_1' if unspecified.", + ) + color_palette: Optional[Dict[str, Any]] = Field( + None, description='Optional. Color palette object. Only for V_2, V_2_TURBO.' + ) + magic_prompt_option: Optional[str] = Field( + None, description="Optional. MagicPrompt usage ('AUTO', 'ON', 'OFF')." + ) + model: str = Field(..., description="The model used (e.g., 'V_2', 'V_2A_TURBO')") + negative_prompt: Optional[str] = Field( + None, + description='Optional. Description of what to exclude. Only for V_1, V_1_TURBO, V_2, V_2_TURBO.', + ) + num_images: Optional[conint(ge=1, le=8)] = Field( + 1, description='Optional. Number of images to generate (1-8). Defaults to 1.' + ) + prompt: str = Field( + ..., description='Required. The prompt to use to generate the image.' + ) + resolution: Optional[str] = Field( + None, + description="Optional. Resolution (e.g., 'RESOLUTION_1024_1024'). Only for model V_2. Cannot be used with aspect_ratio.", + ) + seed: Optional[conint(ge=0, le=2147483647)] = Field( + None, description='Optional. A number between 0 and 2147483647.' + ) + style_type: Optional[str] = Field( + None, + description="Optional. Style type ('AUTO', 'GENERAL', 'REALISTIC', 'DESIGN', 'RENDER_3D', 'ANIME'). Only for models V_2 and above.", + ) + + +class Datum(BaseModel): + is_image_safe: Optional[bool] = Field( + None, description='Indicates whether the image is considered safe.' + ) + prompt: Optional[str] = Field( + None, description='The prompt used to generate this image.' + ) + resolution: Optional[str] = Field( + None, description="The resolution of the generated image (e.g., '1024x1024')." + ) + seed: Optional[int] = Field( + None, description='The seed value used for this generation.' + ) + style_type: Optional[str] = Field( + None, + description="The style type used for generation (e.g., 'REALISTIC', 'ANIME').", + ) + url: Optional[str] = Field(None, description='URL to the generated image.') + + +class Code(Enum): + int_1100 = 1100 + int_1101 = 1101 + int_1102 = 1102 + int_1103 = 1103 + + +class Code1(Enum): + int_1000 = 1000 + int_1001 = 1001 + int_1002 = 1002 + int_1003 = 1003 + int_1004 = 1004 + + +class AspectRatio(str, Enum): + field_16_9 = '16:9' + field_9_16 = '9:16' + field_1_1 = '1:1' + + +class Config(BaseModel): + horizontal: Optional[confloat(ge=-10.0, le=10.0)] = None + pan: Optional[confloat(ge=-10.0, le=10.0)] = None + roll: Optional[confloat(ge=-10.0, le=10.0)] = None + tilt: Optional[confloat(ge=-10.0, le=10.0)] = None + vertical: Optional[confloat(ge=-10.0, le=10.0)] = None + zoom: Optional[confloat(ge=-10.0, le=10.0)] = None + + +class Type(str, Enum): + simple = 'simple' + down_back = 'down_back' + forward_up = 'forward_up' + right_turn_forward = 'right_turn_forward' + left_turn_forward = 'left_turn_forward' + + +class CameraControl(BaseModel): + config: Optional[Config] = None + type: Optional[Type] = Field(None, description='Predefined camera movements type') + + +class Duration(str, Enum): + field_5 = 5 + field_10 = 10 + + +class Mode(str, Enum): + std = 'std' + pro = 'pro' + + +class TaskInfo(BaseModel): + external_task_id: Optional[str] = None + + +class Video(BaseModel): + duration: Optional[str] = Field(None, description='Total video duration') + id: Optional[str] = Field(None, description='Generated video ID') + url: Optional[AnyUrl] = Field(None, description='URL for generated video') + + +class TaskResult(BaseModel): + videos: Optional[List[Video]] = None + + +class TaskStatus(str, Enum): + submitted = 'submitted' + processing = 'processing' + succeed = 'succeed' + failed = 'failed' + + +class Data(BaseModel): + created_at: Optional[int] = Field(None, description='Task creation time') + task_id: Optional[str] = Field(None, description='Task ID') + task_info: Optional[TaskInfo] = None + task_result: Optional[TaskResult] = None + task_status: Optional[TaskStatus] = None + updated_at: Optional[int] = Field(None, description='Task update time') + + +class AspectRatio1(str, Enum): + field_16_9 = '16:9' + field_9_16 = '9:16' + field_1_1 = '1:1' + field_4_3 = '4:3' + field_3_4 = '3:4' + field_3_2 = '3:2' + field_2_3 = '2:3' + field_21_9 = '21:9' + + +class ImageReference(str, Enum): + subject = 'subject' + face = 'face' + + +class Image(BaseModel): + index: Optional[int] = Field(None, description='Image Number (0-9)') + url: Optional[AnyUrl] = Field(None, description='URL for generated image') + + +class TaskResult1(BaseModel): + images: Optional[List[Image]] = None + + +class Data1(BaseModel): + created_at: Optional[int] = Field(None, description='Task creation time') + task_id: Optional[str] = Field(None, description='Task ID') + task_result: Optional[TaskResult1] = None + task_status: Optional[TaskStatus] = None + task_status_msg: Optional[str] = Field(None, description='Task status information') + updated_at: Optional[int] = Field(None, description='Task update time') + + +class AspectRatio2(str, Enum): + field_16_9 = '16:9' + field_9_16 = '9:16' + field_1_1 = '1:1' + + +class CameraControl1(BaseModel): + config: Optional[Config] = None + type: Optional[Type] = Field(None, description='Predefined camera movements type') + + +class ModelName2(str, Enum): + kling_v1 = 'kling-v1' + kling_v1_6 = 'kling-v1-6' + + +class TaskResult2(BaseModel): + videos: Optional[List[Video]] = None + + +class Data2(BaseModel): + created_at: Optional[int] = Field(None, description='Task creation time') + task_id: Optional[str] = Field(None, description='Task ID') + task_info: Optional[TaskInfo] = None + task_result: Optional[TaskResult2] = None + task_status: Optional[TaskStatus] = None + updated_at: Optional[int] = Field(None, description='Task update time') + + +class Code2(Enum): + int_1200 = 1200 + int_1201 = 1201 + int_1202 = 1202 + int_1203 = 1203 + + +class ResourcePackType(str, Enum): + decreasing_total = 'decreasing_total' + constant_period = 'constant_period' + + +class Status(str, Enum): + toBeOnline = 'toBeOnline' + online = 'online' + expired = 'expired' + runOut = 'runOut' + + +class ResourcePackSubscribeInfo(BaseModel): + effective_time: Optional[int] = Field( + None, description='Effective time, Unix timestamp in ms' + ) + invalid_time: Optional[int] = Field( + None, description='Expiration time, Unix timestamp in ms' + ) + purchase_time: Optional[int] = Field( + None, description='Purchase time, Unix timestamp in ms' + ) + remaining_quantity: Optional[float] = Field( + None, description='Remaining quantity (updated with a 12-hour delay)' + ) + resource_pack_id: Optional[str] = Field(None, description='Resource package ID') + resource_pack_name: Optional[str] = Field(None, description='Resource package name') + resource_pack_type: Optional[ResourcePackType] = Field( + None, + description='Resource package type (decreasing_total=decreasing total, constant_period=constant periodicity)', + ) + status: Optional[Status] = Field(None, description='Resource Package Status') + total_quantity: Optional[float] = Field(None, description='Total quantity') + +class Background(str, Enum): + transparent = 'transparent' + opaque = 'opaque' + + +class Moderation(str, Enum): + low = 'low' + auto = 'auto' + + +class OutputFormat(str, Enum): + png = 'png' + webp = 'webp' + jpeg = 'jpeg' + + +class Quality(str, Enum): + low = 'low' + medium = 'medium' + high = 'high' + + +class OpenAIImageEditRequest(BaseModel): + background: Optional[str] = Field( + None, description='Background transparency', examples=['opaque'] + ) + model: str = Field( + ..., description='The model to use for image editing', examples=['gpt-image-1'] + ) + moderation: Optional[Moderation] = Field( + None, description='Content moderation setting', examples=['auto'] + ) + n: Optional[int] = Field( + None, description='The number of images to generate', examples=[1] + ) + output_compression: Optional[int] = Field( + None, description='Compression level for JPEG or WebP (0-100)', examples=[100] + ) + output_format: Optional[OutputFormat] = Field( + None, description='Format of the output image', examples=['png'] + ) + prompt: str = Field( + ..., + description='A text description of the desired edit', + examples=['Give the rocketship rainbow coloring'], + ) + quality: Optional[str] = Field( + None, description='The quality of the edited image', examples=['low'] + ) + size: Optional[str] = Field( + None, description='Size of the output image', examples=['1024x1024'] + ) + user: Optional[str] = Field( + None, + description='A unique identifier for end-user monitoring', + examples=['user-1234'], + ) + + +class Quality1(str, Enum): + low = 'low' + medium = 'medium' + high = 'high' + standard = 'standard' + hd = 'hd' + + +class ResponseFormat(str, Enum): + url = 'url' + b64_json = 'b64_json' + + +class Style(str, Enum): + vivid = 'vivid' + natural = 'natural' + + +class OpenAIImageGenerationRequest(BaseModel): + background: Optional[Background] = Field( + None, description='Background transparency', examples=['opaque'] + ) + model: Optional[str] = Field( + None, description='The model to use for image generation', examples=['dall-e-3'] + ) + moderation: Optional[Moderation] = Field( + None, description='Content moderation setting', examples=['auto'] + ) + n: Optional[int] = Field( + None, + description='The number of images to generate (1-10). Only 1 supported for dall-e-3.', + examples=[1], + ) + output_compression: Optional[int] = Field( + None, description='Compression level for JPEG or WebP (0-100)', examples=[100] + ) + output_format: Optional[OutputFormat] = Field( + None, description='Format of the output image', examples=['png'] + ) + prompt: str = Field( + ..., + description='A text description of the desired image', + examples=['Draw a rocket in front of a blackhole in deep space'], + ) + quality: Optional[Quality1] = Field( + None, description='The quality of the generated image', examples=['high'] + ) + response_format: Optional[ResponseFormat] = Field( + None, description='Response format of image data', examples=['b64_json'] + ) + size: Optional[str] = Field( + None, + description='Size of the image (e.g., 1024x1024, 1536x1024, auto)', + examples=['1024x1536'], + ) + style: Optional[Style] = Field( + None, description='Style of the image (only for dall-e-3)', examples=['vivid'] + ) + user: Optional[str] = Field( + None, + description='A unique identifier for end-user monitoring', + examples=['user-1234'], + ) + + +class Datum1(BaseModel): + b64_json: Optional[str] = Field(None, description='Base64 encoded image data') + revised_prompt: Optional[str] = Field(None, description='Revised prompt') + url: Optional[str] = Field(None, description='URL of the image') + + +class OpenAIImageGenerationResponse(BaseModel): + data: Optional[List[Datum1]] = None +class User(BaseModel): + email: Optional[str] = Field(None, description='The email address for this user.') + id: Optional[str] = Field(None, description='The unique id for this user.') + isAdmin: Optional[bool] = Field( + None, description='Indicates if the user has admin privileges.' + ) + isApproved: Optional[bool] = Field( + None, description='Indicates if the user is approved.' + ) + name: Optional[str] = Field(None, description='The name for this user.') diff --git a/comfy_api_nodes/apis/client.py b/comfy_api_nodes/apis/client.py index cd81d5a1d..9bc3d76d5 100644 --- a/comfy_api_nodes/apis/client.py +++ b/comfy_api_nodes/apis/client.py @@ -226,7 +226,7 @@ class ApiClient: def check_auth_token(self, auth_token): """Verify that an auth token is present.""" if auth_token is None: - raise Exception("Please login first to use this node.") + raise Exception("Unauthorized: Please login first to use this node.") return auth_token diff --git a/comfy_api_nodes/nodes_api.py b/comfy_api_nodes/nodes_api.py new file mode 100644 index 000000000..92f4a0c87 --- /dev/null +++ b/comfy_api_nodes/nodes_api.py @@ -0,0 +1,425 @@ +import io +from inspect import cleandoc + +from comfy.utils import common_upscale +from comfy.comfy_types.node_typing import IO, ComfyNodeABC, InputTypeDict +from comfy_api_nodes.apis import ( + OpenAIImageGenerationRequest, + OpenAIImageEditRequest, + OpenAIImageGenerationResponse +) +from comfy_api_nodes.apis.client import ApiEndpoint, HttpMethod, SynchronousOperation + +import numpy as np +from PIL import Image +import requests +import torch +import math +import base64 + +def downscale_input(image): + samples = image.movedim(-1,1) + #downscaling input images to roughly the same size as the outputs + total = int(1536 * 1024) + scale_by = math.sqrt(total / (samples.shape[3] * samples.shape[2])) + if scale_by >= 1: + return image + width = round(samples.shape[3] * scale_by) + height = round(samples.shape[2] * scale_by) + + s = common_upscale(samples, width, height, "lanczos", "disabled") + s = s.movedim(1,-1) + return s + +def validate_and_cast_response (response): + # validate raw JSON response + data = response.data + if not data or len(data) == 0: + raise Exception("No images returned from API endpoint") + + # Get base64 image data + image_url = data[0].url + b64_data = data[0].b64_json + if not image_url and not b64_data: + raise Exception("No image was generated in the response") + + if b64_data: + img_data = base64.b64decode(b64_data) + img = Image.open(io.BytesIO(img_data)) + + elif image_url: + img_response = requests.get(image_url) + if img_response.status_code != 200: + raise Exception("Failed to download the image") + img = Image.open(io.BytesIO(img_response.content)) + + img = img.convert("RGB") # Ensure RGB format + + # Convert to numpy array, normalize to float32 between 0 and 1 + img_array = np.array(img).astype(np.float32) / 255.0 + + # Convert to torch tensor and add batch dimension + return torch.from_numpy(img_array)[None,] + +class OpenAIDalle2(ComfyNodeABC): + """ + Generates images synchronously via OpenAI's DALL·E 2 endpoint. + + Uses the proxy at /proxy/openai/images/generations. Returned URLs are short‑lived, + so download or cache results if you need to keep them. + """ + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": { + "prompt": (IO.STRING, { + "multiline": True, + "default": "", + "tooltip": "Text prompt for DALL·E", + }), + }, + "optional": { + "seed": (IO.INT, { + "default": 0, + "min": 0, + "max": 2**31-1, + "step": 1, + "display": "number", + "tooltip": "not implemented yet in backend", + }), + "size": (IO.COMBO, { + "options": ["256x256", "512x512", "1024x1024"], + "default": "1024x1024", + "tooltip": "Image size", + }), + "n": (IO.INT, { + "default": 1, + "min": 1, + "max": 8, + "step": 1, + "display": "number", + "tooltip": "How many images to generate", + }), + "image": (IO.IMAGE, { + "default": None, + "tooltip": "Optional reference image for image editing.", + }), + "mask": (IO.MASK, { + "default": None, + "tooltip": "Optional mask for inpainting (white areas will be replaced)", + }), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG" + } + } + + RETURN_TYPES = (IO.IMAGE,) + FUNCTION = "api_call" + CATEGORY = "api node" + DESCRIPTION = cleandoc(__doc__ or "") + API_NODE = True + + def api_call(self, prompt, seed=0, image=None, mask=None, n=1, size="1024x1024", auth_token=None): + model = "dall-e-2" + path = "/proxy/openai/images/generations" + request_class = OpenAIImageGenerationRequest + img_binary = None + + if image is not None and mask is not None: + path = "/proxy/openai/images/edits" + request_class = OpenAIImageEditRequest + + input_tensor = image.squeeze().cpu() + height, width, channels = input_tensor.shape + rgba_tensor = torch.ones(height, width, 4, device="cpu") + rgba_tensor[:, :, :channels] = input_tensor + + if mask.shape[1:] != image.shape[1:-1]: + raise Exception("Mask and Image must be the same size") + rgba_tensor[:,:,3] = (1-mask.squeeze().cpu()) + + rgba_tensor = downscale_input(rgba_tensor.unsqueeze(0)).squeeze() + + image_np = (rgba_tensor.numpy() * 255).astype(np.uint8) + img = Image.fromarray(image_np) + img_byte_arr = io.BytesIO() + img.save(img_byte_arr, format='PNG') + img_byte_arr.seek(0) + img_binary = img_byte_arr#.getvalue() + img_binary.name = "image.png" + elif image is not None or mask is not None: + raise Exception("Dall-E 2 image editing requires an image AND a mask") + + # Build the operation + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=path, + method=HttpMethod.POST, + request_model=request_class, + response_model=OpenAIImageGenerationResponse + ), + request=request_class( + model=model, + prompt=prompt, + n=n, + size=size, + seed=seed, + ), + files={ + "image": img_binary, + } if img_binary else None, + auth_token=auth_token + ) + + response = operation.execute() + + img_tensor = validate_and_cast_response(response) + return (img_tensor,) + +class OpenAIDalle3(ComfyNodeABC): + """ + Generates images synchronously via OpenAI's DALL·E 3 endpoint. + + Uses the proxy at /proxy/openai/images/generations. Returned URLs are short‑lived, + so download or cache results if you need to keep them. + """ + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": { + "prompt": (IO.STRING, { + "multiline": True, + "default": "", + "tooltip": "Text prompt for DALL·E", + }), + }, + "optional": { + "seed": (IO.INT, { + "default": 0, + "min": 0, + "max": 2**31-1, + "step": 1, + "display": "number", + "tooltip": "not implemented yet in backend", + }), + "quality" : (IO.COMBO, { + "options": ["standard","hd"], + "default": "standard", + "tooltip": "Image quality", + }), + "style": (IO.COMBO, { + "options": ["natural","vivid"], + "default": "natural", + "tooltip": "Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images.", + }), + "size": (IO.COMBO, { + "options": ["1024x1024", "1024x1792", "1792x1024"], + "default": "1024x1024", + "tooltip": "Image size", + }), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG" + } + } + + RETURN_TYPES = (IO.IMAGE,) + FUNCTION = "api_call" + CATEGORY = "api node" + DESCRIPTION = cleandoc(__doc__ or "") + API_NODE = True + + def api_call(self, prompt, seed=0, style="natural", quality="standard", size="1024x1024", auth_token=None): + model = "dall-e-3" + + # build the operation + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/openai/images/generations", + method=HttpMethod.POST, + request_model=OpenAIImageGenerationRequest, + response_model=OpenAIImageGenerationResponse + ), + request=OpenAIImageGenerationRequest( + model=model, + prompt=prompt, + quality=quality, + size=size, + style=style, + seed=seed, + ), + auth_token=auth_token + ) + + response = operation.execute() + + img_tensor = validate_and_cast_response(response) + return (img_tensor,) + +class OpenAIGPTImage1(ComfyNodeABC): + """ + Generates images synchronously via OpenAI's GPT Image 1 endpoint. + + Uses the proxy at /proxy/openai/images/generations. Returned URLs are short‑lived, + so download or cache results if you need to keep them. + """ + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": { + "prompt": (IO.STRING, { + "multiline": True, + "default": "", + "tooltip": "Text prompt for GPT Image 1", + }), + }, + "optional": { + "seed": (IO.INT, { + "default": 0, + "min": 0, + "max": 2**31-1, + "step": 1, + "display": "number", + "tooltip": "not implemented yet in backend", + }), + "quality": (IO.COMBO, { + "options": ["low","medium","high"], + "default": "low", + "tooltip": "Image quality, affects cost and generation time.", + }), + "background": (IO.COMBO, { + "options": ["opaque","transparent"], + "default": "opaque", + "tooltip": "Return image with or without background", + }), + "size": (IO.COMBO, { + "options": ["auto", "1024x1024", "1024x1536", "1536x1024"], + "default": "auto", + "tooltip": "Image size", + }), + "n": (IO.INT, { + "default": 1, + "min": 1, + "max": 8, + "step": 1, + "display": "number", + "tooltip": "How many images to generate", + }), + "image": (IO.IMAGE, { + "default": None, + "tooltip": "Optional reference image for image editing.", + }), + "mask": (IO.MASK, { + "default": None, + "tooltip": "Optional mask for inpainting (white areas will be replaced)", + }), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG" + } + } + + RETURN_TYPES = (IO.IMAGE,) + FUNCTION = "api_call" + CATEGORY = "api node" + DESCRIPTION = cleandoc(__doc__ or "") + API_NODE = True + + def api_call(self, prompt, seed=0, quality="low", background="opaque", image=None, mask=None, n=1, size="1024x1024", auth_token=None): + model = "gpt-image-1" + path = "/proxy/openai/images/generations" + request_class = OpenAIImageGenerationRequest + img_binary = None + mask_binary = None + + + if image is not None: + path = "/proxy/openai/images/edits" + request_class = OpenAIImageEditRequest + + scaled_image = downscale_input(image).squeeze() + + image_np = (scaled_image.numpy() * 255).astype(np.uint8) + img = Image.fromarray(image_np) + img_byte_arr = io.BytesIO() + img.save(img_byte_arr, format='PNG') + img_byte_arr.seek(0) + img_binary = img_byte_arr#.getvalue() + img_binary.name = "image.png" + + if mask is not None: + if image is None: + raise Exception("Cannot use a mask without an input image") + if mask.shape[1:] != image.shape[1:-1]: + raise Exception("Mask and Image must be the same size") + batch, height, width = mask.shape + rgba_mask = torch.zeros(height, width, 4, device="cpu") + rgba_mask[:,:,3] = (1-mask.squeeze().cpu()) + + scaled_mask = downscale_input(rgba_mask.unsqueeze(0)).squeeze() + + mask_np = (scaled_mask.numpy() * 255).astype(np.uint8) + mask_img = Image.fromarray(mask_np) + mask_img_byte_arr = io.BytesIO() + mask_img.save(mask_img_byte_arr, format='PNG') + mask_img_byte_arr.seek(0) + mask_binary = mask_img_byte_arr#.getvalue() + mask_binary.name = "mask.png" + + files = {} + if img_binary: + files["image"] = img_binary + if mask_binary: + files["mask"] = mask_binary + + # Build the operation + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=path, + method=HttpMethod.POST, + request_model=request_class, + response_model=OpenAIImageGenerationResponse + ), + request=request_class( + model=model, + prompt=prompt, + quality=quality, + background=background, + n=n, + seed=seed, + size=size, + ), + files=files if files else None, + auth_token=auth_token + ) + + response = operation.execute() + + img_tensor = validate_and_cast_response(response) + return (img_tensor,) + + +# A dictionary that contains all nodes you want to export with their names +# NOTE: names should be globally unique +NODE_CLASS_MAPPINGS = { + "OpenAIDalle2": OpenAIDalle2, + "OpenAIDalle3": OpenAIDalle3, + "OpenAIGPTImage1": OpenAIGPTImage1, +} + +# A dictionary that contains the friendly/humanly readable titles for the nodes +NODE_DISPLAY_NAME_MAPPINGS = { + "OpenAIDalle2": "OpenAI DALL·E 2", + "OpenAIDalle3": "OpenAI DALL·E 3", + "OpenAIGPTImage1": "OpenAI GPT Image 1", +} diff --git a/nodes.py b/nodes.py index b1ab62aad..73a62d930 100644 --- a/nodes.py +++ b/nodes.py @@ -2260,11 +2260,20 @@ def init_builtin_extra_nodes(): "nodes_fresca.py", ] + api_nodes_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_api_nodes") + api_nodes_files = [ + "nodes_api.py", + ] + import_failed = [] for node_file in extras_files: if not load_custom_node(os.path.join(extras_dir, node_file), module_parent="comfy_extras"): import_failed.append(node_file) + for node_file in api_nodes_files: + if not load_custom_node(os.path.join(api_nodes_dir, node_file), module_parent="comfy_api_nodes"): + import_failed.append(node_file) + return import_failed diff --git a/requirements.txt b/requirements.txt index f8ad908ca..2ac241261 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.16.9 +comfyui-frontend-package==1.17.9 comfyui-workflow-templates==0.1.3 torch torchsde From e8ddc2be95e3c70363414dfca94f57d6dad25c8f Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Thu, 24 Apr 2025 06:02:41 +1000 Subject: [PATCH 349/478] [BugFix] Update frontend to 1.17.10 (#7762) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2ac241261..291f81838 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.17.9 +comfyui-frontend-package==1.17.10 comfyui-workflow-templates==0.1.3 torch torchsde From 2c1d686ec61f26f3a64bb4c1afdcdb78bb943a4f Mon Sep 17 00:00:00 2001 From: thot experiment <94414189+thot-experiment@users.noreply.github.com> Date: Wed, 23 Apr 2025 13:10:10 -0700 Subject: [PATCH 350/478] implement multi image prompting for gpt-image-1 and fix transparency in outputs (#7763) * implement multi image prompting for GPTI Image 1 * fix transparency not working * fix ruff --- comfy_api_nodes/nodes_api.py | 43 ++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/comfy_api_nodes/nodes_api.py b/comfy_api_nodes/nodes_api.py index 92f4a0c87..7bca0b503 100644 --- a/comfy_api_nodes/nodes_api.py +++ b/comfy_api_nodes/nodes_api.py @@ -53,7 +53,7 @@ def validate_and_cast_response (response): raise Exception("Failed to download the image") img = Image.open(io.BytesIO(img_response.content)) - img = img.convert("RGB") # Ensure RGB format + img = img.convert("RGBA") # Convert to numpy array, normalize to float32 between 0 and 1 img_array = np.array(img).astype(np.float32) / 255.0 @@ -339,25 +339,38 @@ class OpenAIGPTImage1(ComfyNodeABC): model = "gpt-image-1" path = "/proxy/openai/images/generations" request_class = OpenAIImageGenerationRequest - img_binary = None + img_binaries = [] mask_binary = None - + files = [] if image is not None: path = "/proxy/openai/images/edits" request_class = OpenAIImageEditRequest - scaled_image = downscale_input(image).squeeze() + batch_size = image.shape[0] - image_np = (scaled_image.numpy() * 255).astype(np.uint8) - img = Image.fromarray(image_np) - img_byte_arr = io.BytesIO() - img.save(img_byte_arr, format='PNG') - img_byte_arr.seek(0) - img_binary = img_byte_arr#.getvalue() - img_binary.name = "image.png" + + for i in range(batch_size): + single_image = image[i:i+1] + scaled_image = downscale_input(single_image).squeeze() + + image_np = (scaled_image.numpy() * 255).astype(np.uint8) + img = Image.fromarray(image_np) + img_byte_arr = io.BytesIO() + img.save(img_byte_arr, format='PNG') + img_byte_arr.seek(0) + img_binary = img_byte_arr + img_binary.name = f"image_{i}.png" + + img_binaries.append(img_binary) + if batch_size == 1: + files.append(("image", img_binary)) + else: + files.append(("image[]", img_binary)) if mask is not None: + if image.shape[0] != 1: + raise Exception("Cannot use a mask with multiple image") if image is None: raise Exception("Cannot use a mask without an input image") if mask.shape[1:] != image.shape[1:-1]: @@ -373,14 +386,10 @@ class OpenAIGPTImage1(ComfyNodeABC): mask_img_byte_arr = io.BytesIO() mask_img.save(mask_img_byte_arr, format='PNG') mask_img_byte_arr.seek(0) - mask_binary = mask_img_byte_arr#.getvalue() + mask_binary = mask_img_byte_arr mask_binary.name = "mask.png" + files.append(("mask", mask_binary)) - files = {} - if img_binary: - files["image"] = img_binary - if mask_binary: - files["mask"] = mask_binary # Build the operation operation = SynchronousOperation( From 188b383c35f0a790e407cb337dd554fccb188f6f Mon Sep 17 00:00:00 2001 From: thot experiment <94414189+thot-experiment@users.noreply.github.com> Date: Wed, 23 Apr 2025 14:53:34 -0700 Subject: [PATCH 351/478] change timeout to 7 days (#7765) --- comfy_api_nodes/apis/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy_api_nodes/apis/client.py b/comfy_api_nodes/apis/client.py index 9bc3d76d5..384e559dc 100644 --- a/comfy_api_nodes/apis/client.py +++ b/comfy_api_nodes/apis/client.py @@ -269,7 +269,7 @@ class SynchronousOperation(Generic[T, R]): files: Optional[Dict[str, Any]] = None, api_base: str = "https://api.comfy.org", auth_token: Optional[str] = None, - timeout: float = 60.0, + timeout: float = 604800.0, verify_ssl: bool = True, ): self.endpoint = endpoint From 11b68ebd22c2137661ec6a70f39943a337edf897 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Thu, 24 Apr 2025 08:16:12 +1000 Subject: [PATCH 352/478] [BugFix] Update frontend to 1.17.11 (#7766) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 291f81838..10cc177af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.17.10 +comfyui-frontend-package==1.17.11 comfyui-workflow-templates==0.1.3 torch torchsde From e2eed9eb9b70f1b2290d5384fd8cfb739c092b44 Mon Sep 17 00:00:00 2001 From: thot experiment <94414189+thot-experiment@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:28:36 -0700 Subject: [PATCH 353/478] throw away alpha channel in clip vision preprocessor (#7769) saves users having to explicitly discard the channel --- comfy/clip_vision.py | 1 + 1 file changed, 1 insertion(+) diff --git a/comfy/clip_vision.py b/comfy/clip_vision.py index 11bc57789..00aab9164 100644 --- a/comfy/clip_vision.py +++ b/comfy/clip_vision.py @@ -18,6 +18,7 @@ class Output: setattr(self, key, item) def clip_preprocess(image, size=224, mean=[0.48145466, 0.4578275, 0.40821073], std=[0.26862954, 0.26130258, 0.27577711], crop=True): + image = image[:, :, :, :3] if image.shape[3] > 3 else image mean = torch.tensor(mean, device=image.device, dtype=image.dtype) std = torch.tensor(std, device=image.device, dtype=image.dtype) image = image.movedim(-1, 1) From 5c80da31dbfe6382da5b489098b57a411e7f58ed Mon Sep 17 00:00:00 2001 From: thot experiment <94414189+thot-experiment@users.noreply.github.com> Date: Thu, 24 Apr 2025 00:29:05 -0700 Subject: [PATCH 354/478] fix multiple image return from api nodes (#7772) --- comfy_api_nodes/nodes_api.py | 46 +++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/comfy_api_nodes/nodes_api.py b/comfy_api_nodes/nodes_api.py index 7bca0b503..4105ba7e1 100644 --- a/comfy_api_nodes/nodes_api.py +++ b/comfy_api_nodes/nodes_api.py @@ -31,35 +31,43 @@ def downscale_input(image): s = s.movedim(1,-1) return s -def validate_and_cast_response (response): +def validate_and_cast_response(response): # validate raw JSON response data = response.data if not data or len(data) == 0: raise Exception("No images returned from API endpoint") - # Get base64 image data - image_url = data[0].url - b64_data = data[0].b64_json - if not image_url and not b64_data: - raise Exception("No image was generated in the response") + # Initialize list to store image tensors + image_tensors = [] - if b64_data: - img_data = base64.b64decode(b64_data) - img = Image.open(io.BytesIO(img_data)) + # Process each image in the data array + for image_data in data: + image_url = image_data.url + b64_data = image_data.b64_json - elif image_url: - img_response = requests.get(image_url) - if img_response.status_code != 200: - raise Exception("Failed to download the image") - img = Image.open(io.BytesIO(img_response.content)) + if not image_url and not b64_data: + raise Exception("No image was generated in the response") - img = img.convert("RGBA") + if b64_data: + img_data = base64.b64decode(b64_data) + img = Image.open(io.BytesIO(img_data)) - # Convert to numpy array, normalize to float32 between 0 and 1 - img_array = np.array(img).astype(np.float32) / 255.0 + elif image_url: + img_response = requests.get(image_url) + if img_response.status_code != 200: + raise Exception("Failed to download the image") + img = Image.open(io.BytesIO(img_response.content)) - # Convert to torch tensor and add batch dimension - return torch.from_numpy(img_array)[None,] + img = img.convert("RGBA") + + # Convert to numpy array, normalize to float32 between 0 and 1 + img_array = np.array(img).astype(np.float32) / 255.0 + img_tensor = torch.from_numpy(img_array) + + # Add to list of tensors + image_tensors.append(img_tensor) + + return torch.stack(image_tensors, dim=0) class OpenAIDalle2(ComfyNodeABC): """ From 5acb7058577ca81d26107ace01dd5c5c7a4a5f27 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Thu, 24 Apr 2025 10:58:31 -0700 Subject: [PATCH 355/478] Switch LTXVPreprocess to libx264 (#7776) --- comfy_extras/nodes_lt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index 525889200..ff3fe5cdc 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -385,7 +385,7 @@ def encode_single_frame(output_file, image_array: np.ndarray, crf): container = av.open(output_file, "w", format="mp4") try: stream = container.add_stream( - "h264", rate=1, options={"crf": str(crf), "preset": "veryfast"} + "libx264", rate=1, options={"crf": str(crf), "preset": "veryfast"} ) stream.height = image_array.shape[0] stream.width = image_array.shape[1] From a97f2f850abd7dd330e6363c8d8074bb243eb413 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 24 Apr 2025 16:03:01 -0400 Subject: [PATCH 356/478] ComfyUI version 0.3.30 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index f9161b37e..67d27f942 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.29" +__version__ = "0.3.30" diff --git a/pyproject.toml b/pyproject.toml index e8fc9555d..eadca662e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.29" +version = "0.3.30" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From f935d42d8ee399e57028d33e0142730d0c163a91 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Fri, 25 Apr 2025 03:11:14 -0400 Subject: [PATCH 357/478] Support SimpleTuner lycoris lora format for HiDream. --- comfy/lora.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/comfy/lora.py b/comfy/lora.py index 8760a21fb..fff524be2 100644 --- a/comfy/lora.py +++ b/comfy/lora.py @@ -279,6 +279,13 @@ def model_lora_keys_unet(model, key_map={}): key_map["transformer.{}".format(key_lora)] = k key_map["diffusion_model.{}".format(key_lora)] = k # Old loras + if isinstance(model, comfy.model_base.HiDream): + for k in sdk: + if k.startswith("diffusion_model."): + if k.endswith(".weight"): + key_lora = k[len("diffusion_model."):-len(".weight")].replace(".", "_") + key_map["lycoris_{}".format(key_lora)] = k #SimpleTuner lycoris format + return key_map From 78992c4b25ce7ef1305113872aa1f1e6aa6a070b Mon Sep 17 00:00:00 2001 From: AustinMroz Date: Fri, 25 Apr 2025 12:35:07 -0500 Subject: [PATCH 358/478] [NodeDef] Add documentation on widgetType (#7768) * [NodeDef] Add documentation on widgetType * Document required version for widgetType --- comfy/comfy_types/node_typing.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/comfy/comfy_types/node_typing.py b/comfy/comfy_types/node_typing.py index 0bdda032e..4ceeb3468 100644 --- a/comfy/comfy_types/node_typing.py +++ b/comfy/comfy_types/node_typing.py @@ -120,6 +120,10 @@ class InputTypeOptions(TypedDict): Available from frontend v1.17.5 Ref: https://github.com/Comfy-Org/ComfyUI_frontend/pull/3548 """ + widgetType: NotRequired[str] + """Specifies a type to be used for widget initialization if different from the input type. + Available from frontend v1.18.0 + https://github.com/Comfy-Org/ComfyUI_frontend/pull/3550""" # class InputTypeNumber(InputTypeOptions): # default: float | int min: NotRequired[float] From 23e39f2ba7c38d5fc21206da31ce7d357b232e15 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Fri, 25 Apr 2025 16:36:00 -0700 Subject: [PATCH 359/478] Add a T5TokenizerOptions node to set options for the T5 tokenizer. (#7803) --- comfy/sd.py | 10 ++++++++++ comfy/sd1_clip.py | 17 +++++++++++------ comfy/sdxl_clip.py | 4 ++-- comfy/text_encoders/flux.py | 4 ++-- comfy/text_encoders/hidream.py | 8 ++++---- comfy/text_encoders/hunyuan_video.py | 4 ++-- comfy/text_encoders/hydit.py | 4 ++-- comfy/text_encoders/sd3_clip.py | 6 +++--- comfy_extras/nodes_cond.py | 25 ++++++++++++++++++++++++- 9 files changed, 60 insertions(+), 22 deletions(-) diff --git a/comfy/sd.py b/comfy/sd.py index 8aba5d655..748f6c1ec 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -120,6 +120,7 @@ class CLIP: self.layer_idx = None self.use_clip_schedule = False logging.info("CLIP/text encoder model load device: {}, offload device: {}, current: {}, dtype: {}".format(load_device, offload_device, params['device'], dtype)) + self.tokenizer_options = {} def clone(self): n = CLIP(no_init=True) @@ -127,6 +128,7 @@ class CLIP: n.cond_stage_model = self.cond_stage_model n.tokenizer = self.tokenizer n.layer_idx = self.layer_idx + n.tokenizer_options = self.tokenizer_options.copy() n.use_clip_schedule = self.use_clip_schedule n.apply_hooks_to_conds = self.apply_hooks_to_conds return n @@ -134,10 +136,18 @@ class CLIP: def add_patches(self, patches, strength_patch=1.0, strength_model=1.0): return self.patcher.add_patches(patches, strength_patch, strength_model) + def set_tokenizer_option(self, option_name, value): + self.tokenizer_options[option_name] = value + def clip_layer(self, layer_idx): self.layer_idx = layer_idx def tokenize(self, text, return_word_ids=False, **kwargs): + tokenizer_options = kwargs.get("tokenizer_options", {}) + if len(self.tokenizer_options) > 0: + tokenizer_options = {**self.tokenizer_options, **tokenizer_options} + if len(tokenizer_options) > 0: + kwargs["tokenizer_options"] = tokenizer_options return self.tokenizer.tokenize_with_weights(text, return_word_ids, **kwargs) def add_hooks_to_dict(self, pooled_dict: dict[str]): diff --git a/comfy/sd1_clip.py b/comfy/sd1_clip.py index 2ca5ed9ba..ac61babe9 100644 --- a/comfy/sd1_clip.py +++ b/comfy/sd1_clip.py @@ -457,13 +457,14 @@ def load_embed(embedding_name, embedding_directory, embedding_size, embed_key=No return embed_out class SDTokenizer: - def __init__(self, tokenizer_path=None, max_length=77, pad_with_end=True, embedding_directory=None, embedding_size=768, embedding_key='clip_l', tokenizer_class=CLIPTokenizer, has_start_token=True, has_end_token=True, pad_to_max_length=True, min_length=None, pad_token=None, end_token=None, tokenizer_data={}, tokenizer_args={}): + def __init__(self, tokenizer_path=None, max_length=77, pad_with_end=True, embedding_directory=None, embedding_size=768, embedding_key='clip_l', tokenizer_class=CLIPTokenizer, has_start_token=True, has_end_token=True, pad_to_max_length=True, min_length=None, pad_token=None, end_token=None, min_padding=None, tokenizer_data={}, tokenizer_args={}): if tokenizer_path is None: tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "sd1_tokenizer") self.tokenizer = tokenizer_class.from_pretrained(tokenizer_path, **tokenizer_args) self.max_length = tokenizer_data.get("{}_max_length".format(embedding_key), max_length) self.min_length = min_length self.end_token = None + self.min_padding = min_padding empty = self.tokenizer('')["input_ids"] self.tokenizer_adds_end_token = has_end_token @@ -518,13 +519,15 @@ class SDTokenizer: return (embed, leftover) - def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): + def tokenize_with_weights(self, text:str, return_word_ids=False, tokenizer_options={}, **kwargs): ''' Takes a prompt and converts it to a list of (token, weight, word id) elements. Tokens can both be integer tokens and pre computed CLIP tensors. Word id values are unique per word and embedding, where the id 0 is reserved for non word tokens. Returned list has the dimensions NxM where M is the input size of CLIP ''' + min_length = tokenizer_options.get("{}_min_length".format(self.embedding_key), self.min_length) + min_padding = tokenizer_options.get("{}_min_padding".format(self.embedding_key), self.min_padding) text = escape_important(text) parsed_weights = token_weights(text, 1.0) @@ -603,10 +606,12 @@ class SDTokenizer: #fill last batch if self.end_token is not None: batch.append((self.end_token, 1.0, 0)) - if self.pad_to_max_length: + if min_padding is not None: + batch.extend([(self.pad_token, 1.0, 0)] * min_padding) + if self.pad_to_max_length and len(batch) < self.max_length: batch.extend([(self.pad_token, 1.0, 0)] * (self.max_length - len(batch))) - if self.min_length is not None and len(batch) < self.min_length: - batch.extend([(self.pad_token, 1.0, 0)] * (self.min_length - len(batch))) + if min_length is not None and len(batch) < min_length: + batch.extend([(self.pad_token, 1.0, 0)] * (min_length - len(batch))) if not return_word_ids: batched_tokens = [[(t, w) for t, w,_ in x] for x in batched_tokens] @@ -634,7 +639,7 @@ class SD1Tokenizer: def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} - out[self.clip_name] = getattr(self, self.clip).tokenize_with_weights(text, return_word_ids) + out[self.clip_name] = getattr(self, self.clip).tokenize_with_weights(text, return_word_ids, **kwargs) return out def untokenize(self, token_weight_pair): diff --git a/comfy/sdxl_clip.py b/comfy/sdxl_clip.py index ea7f5d10f..c8cef14e4 100644 --- a/comfy/sdxl_clip.py +++ b/comfy/sdxl_clip.py @@ -28,8 +28,8 @@ class SDXLTokenizer: def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} - out["g"] = self.clip_g.tokenize_with_weights(text, return_word_ids) - out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids) + out["g"] = self.clip_g.tokenize_with_weights(text, return_word_ids, **kwargs) + out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids, **kwargs) return out def untokenize(self, token_weight_pair): diff --git a/comfy/text_encoders/flux.py b/comfy/text_encoders/flux.py index 0666dde7f..d61ef6668 100644 --- a/comfy/text_encoders/flux.py +++ b/comfy/text_encoders/flux.py @@ -19,8 +19,8 @@ class FluxTokenizer: def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} - out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids) - out["t5xxl"] = self.t5xxl.tokenize_with_weights(text, return_word_ids) + out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids, **kwargs) + out["t5xxl"] = self.t5xxl.tokenize_with_weights(text, return_word_ids, **kwargs) return out def untokenize(self, token_weight_pair): diff --git a/comfy/text_encoders/hidream.py b/comfy/text_encoders/hidream.py index 8e1abcfc1..dbcf52784 100644 --- a/comfy/text_encoders/hidream.py +++ b/comfy/text_encoders/hidream.py @@ -16,11 +16,11 @@ class HiDreamTokenizer: def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} - out["g"] = self.clip_g.tokenize_with_weights(text, return_word_ids) - out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids) - t5xxl = self.t5xxl.tokenize_with_weights(text, return_word_ids) + out["g"] = self.clip_g.tokenize_with_weights(text, return_word_ids, **kwargs) + out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids, **kwargs) + t5xxl = self.t5xxl.tokenize_with_weights(text, return_word_ids, **kwargs) out["t5xxl"] = [t5xxl[0]] # Use only first 128 tokens - out["llama"] = self.llama.tokenize_with_weights(text, return_word_ids) + out["llama"] = self.llama.tokenize_with_weights(text, return_word_ids, **kwargs) return out def untokenize(self, token_weight_pair): diff --git a/comfy/text_encoders/hunyuan_video.py b/comfy/text_encoders/hunyuan_video.py index 33ac22497..b02148b33 100644 --- a/comfy/text_encoders/hunyuan_video.py +++ b/comfy/text_encoders/hunyuan_video.py @@ -49,13 +49,13 @@ class HunyuanVideoTokenizer: def tokenize_with_weights(self, text, return_word_ids=False, llama_template=None, image_embeds=None, image_interleave=1, **kwargs): out = {} - out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids) + out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids, **kwargs) if llama_template is None: llama_text = self.llama_template.format(text) else: llama_text = llama_template.format(text) - llama_text_tokens = self.llama.tokenize_with_weights(llama_text, return_word_ids) + llama_text_tokens = self.llama.tokenize_with_weights(llama_text, return_word_ids, **kwargs) embed_count = 0 for r in llama_text_tokens: for i in range(len(r)): diff --git a/comfy/text_encoders/hydit.py b/comfy/text_encoders/hydit.py index e7273f425..ac6994529 100644 --- a/comfy/text_encoders/hydit.py +++ b/comfy/text_encoders/hydit.py @@ -41,8 +41,8 @@ class HyditTokenizer: def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} - out["hydit_clip"] = self.hydit_clip.tokenize_with_weights(text, return_word_ids) - out["mt5xl"] = self.mt5xl.tokenize_with_weights(text, return_word_ids) + out["hydit_clip"] = self.hydit_clip.tokenize_with_weights(text, return_word_ids, **kwargs) + out["mt5xl"] = self.mt5xl.tokenize_with_weights(text, return_word_ids, **kwargs) return out def untokenize(self, token_weight_pair): diff --git a/comfy/text_encoders/sd3_clip.py b/comfy/text_encoders/sd3_clip.py index 6c2fbeca4..ff5d412db 100644 --- a/comfy/text_encoders/sd3_clip.py +++ b/comfy/text_encoders/sd3_clip.py @@ -45,9 +45,9 @@ class SD3Tokenizer: def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): out = {} - out["g"] = self.clip_g.tokenize_with_weights(text, return_word_ids) - out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids) - out["t5xxl"] = self.t5xxl.tokenize_with_weights(text, return_word_ids) + out["g"] = self.clip_g.tokenize_with_weights(text, return_word_ids, **kwargs) + out["l"] = self.clip_l.tokenize_with_weights(text, return_word_ids, **kwargs) + out["t5xxl"] = self.t5xxl.tokenize_with_weights(text, return_word_ids, **kwargs) return out def untokenize(self, token_weight_pair): diff --git a/comfy_extras/nodes_cond.py b/comfy_extras/nodes_cond.py index 4c3a1d5bf..574262178 100644 --- a/comfy_extras/nodes_cond.py +++ b/comfy_extras/nodes_cond.py @@ -20,6 +20,29 @@ class CLIPTextEncodeControlnet: c.append(n) return (c, ) +class T5TokenizerOptions: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "clip": ("CLIP", ), + "min_padding": ("INT", {"default": 0, "min": 0, "max": 10000, "step": 1}), + "min_length": ("INT", {"default": 0, "min": 0, "max": 10000, "step": 1}), + } + } + + RETURN_TYPES = ("CLIP",) + FUNCTION = "set_options" + + def set_options(self, clip, min_padding, min_length): + clip = clip.clone() + for t5_type in ["t5xxl", "pile_t5xl", "t5base", "mt5xl", "umt5xxl"]: + clip.set_tokenizer_option("{}_min_padding".format(t5_type), min_padding) + clip.set_tokenizer_option("{}_min_length".format(t5_type), min_length) + + return (clip, ) + NODE_CLASS_MAPPINGS = { - "CLIPTextEncodeControlnet": CLIPTextEncodeControlnet + "CLIPTextEncodeControlnet": CLIPTextEncodeControlnet, + "T5TokenizerOptions": T5TokenizerOptions, } From b685b8a4e098237919adae580eb29e8d861b738f Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sat, 26 Apr 2025 01:43:12 -0700 Subject: [PATCH 360/478] Update portable package workflow to cu128 (#7812) --- .github/workflows/stable-release.yml | 4 ++-- .github/workflows/windows_release_dependencies.yml | 4 ++-- .github/workflows/windows_release_package.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.yml index 40df7ab88..c4302cdd6 100644 --- a/.github/workflows/stable-release.yml +++ b/.github/workflows/stable-release.yml @@ -12,7 +12,7 @@ on: description: 'CUDA version' required: true type: string - default: "126" + default: "128" python_minor: description: 'Python minor version' required: true @@ -22,7 +22,7 @@ on: description: 'Python patch version' required: true type: string - default: "9" + default: "10" jobs: diff --git a/.github/workflows/windows_release_dependencies.yml b/.github/workflows/windows_release_dependencies.yml index 7a8ec5782..dfdb96d50 100644 --- a/.github/workflows/windows_release_dependencies.yml +++ b/.github/workflows/windows_release_dependencies.yml @@ -17,7 +17,7 @@ on: description: 'cuda version' required: true type: string - default: "126" + default: "128" python_minor: description: 'python minor version' @@ -29,7 +29,7 @@ on: description: 'python patch version' required: true type: string - default: "9" + default: "10" # push: # branches: # - master diff --git a/.github/workflows/windows_release_package.yml b/.github/workflows/windows_release_package.yml index dc79b1f4a..80a45b321 100644 --- a/.github/workflows/windows_release_package.yml +++ b/.github/workflows/windows_release_package.yml @@ -7,7 +7,7 @@ on: description: 'cuda version' required: true type: string - default: "126" + default: "128" python_minor: description: 'python minor version' @@ -19,7 +19,7 @@ on: description: 'python patch version' required: true type: string - default: "9" + default: "10" # push: # branches: # - master From 0dcc75ca547b533a129699208aefa95c6742f1b6 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sat, 26 Apr 2025 13:11:21 -0700 Subject: [PATCH 361/478] Add experimental --async-offload lowvram weight offloading. (#7820) This should speed up the lowvram mode a bit. It currently is only enabled when --async-offload is used but it will be enabled by default in the future if there are no problems. --- comfy/cli_args.py | 1 + comfy/model_management.py | 47 ++++++++++++++++++++++++++++++++++++--- comfy/ops.py | 7 ++++-- 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 1b971be3c..f89a7aab4 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -128,6 +128,7 @@ vram_group.add_argument("--cpu", action="store_true", help="To use the CPU for e parser.add_argument("--reserve-vram", type=float, default=None, help="Set the amount of vram in GB you want to reserve for use by your OS/other software. By default some amount is reserved depending on your OS.") +parser.add_argument("--async-offload", action="store_true", help="Use async weight offloading.") parser.add_argument("--default-hashing-function", type=str, choices=['md5', 'sha1', 'sha256', 'sha512'], default='sha256', help="Allows you to choose the hash function to use for duplicate filename / contents comparison. Default is sha256.") diff --git a/comfy/model_management.py b/comfy/model_management.py index 43e402243..d118f6b91 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -939,15 +939,56 @@ def force_channels_last(): #TODO return False -def cast_to(weight, dtype=None, device=None, non_blocking=False, copy=False): + +STREAMS = {} +NUM_STREAMS = 1 +if args.async_offload: + NUM_STREAMS = 2 + logging.info("Using async weight offloading with {} streams".format(NUM_STREAMS)) + +stream_counter = 0 +def get_offload_stream(device): + global stream_counter + if NUM_STREAMS <= 1: + return None + + if device in STREAMS: + ss = STREAMS[device] + s = ss[stream_counter] + stream_counter = (stream_counter + 1) % len(ss) + if is_device_cuda(device): + ss[stream_counter].wait_stream(torch.cuda.current_stream()) + return s + elif is_device_cuda(device): + ss = [] + for k in range(NUM_STREAMS): + ss.append(torch.cuda.Stream(device=device, priority=10)) + STREAMS[device] = ss + s = ss[stream_counter] + stream_counter = (stream_counter + 1) % len(ss) + return s + return None + +def sync_stream(device, stream): + if stream is None: + return + if is_device_cuda(device): + torch.cuda.current_stream().wait_stream(stream) + +def cast_to(weight, dtype=None, device=None, non_blocking=False, copy=False, stream=None): if device is None or weight.device == device: if not copy: if dtype is None or weight.dtype == dtype: return weight return weight.to(dtype=dtype, copy=copy) - r = torch.empty_like(weight, dtype=dtype, device=device) - r.copy_(weight, non_blocking=non_blocking) + if stream is not None: + with stream: + r = torch.empty_like(weight, dtype=dtype, device=device) + r.copy_(weight, non_blocking=non_blocking) + else: + r = torch.empty_like(weight, dtype=dtype, device=device) + r.copy_(weight, non_blocking=non_blocking) return r def cast_to_device(tensor, device, dtype, copy=False): diff --git a/comfy/ops.py b/comfy/ops.py index aae6cafac..62daf447b 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -37,20 +37,23 @@ def cast_bias_weight(s, input=None, dtype=None, device=None, bias_dtype=None): if device is None: device = input.device + offload_stream = comfy.model_management.get_offload_stream(device) bias = None non_blocking = comfy.model_management.device_supports_non_blocking(device) if s.bias is not None: has_function = len(s.bias_function) > 0 - bias = comfy.model_management.cast_to(s.bias, bias_dtype, device, non_blocking=non_blocking, copy=has_function) + bias = comfy.model_management.cast_to(s.bias, bias_dtype, device, non_blocking=non_blocking, copy=has_function, stream=offload_stream) if has_function: for f in s.bias_function: bias = f(bias) has_function = len(s.weight_function) > 0 - weight = comfy.model_management.cast_to(s.weight, dtype, device, non_blocking=non_blocking, copy=has_function) + weight = comfy.model_management.cast_to(s.weight, dtype, device, non_blocking=non_blocking, copy=has_function, stream=offload_stream) if has_function: for f in s.weight_function: weight = f(weight) + + comfy.model_management.sync_stream(device, offload_stream) return weight, bias class CastWeightBiasOp: From ac10a0d69e9905662296c5280bcea61945c39762 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sat, 26 Apr 2025 16:56:22 -0700 Subject: [PATCH 362/478] Make loras work with --async-offload (#7824) --- comfy/ops.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/comfy/ops.py b/comfy/ops.py index 62daf447b..032787915 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -22,6 +22,7 @@ import comfy.model_management from comfy.cli_args import args, PerformanceFeature import comfy.float import comfy.rmsnorm +import contextlib cast_to = comfy.model_management.cast_to #TODO: remove once no more references @@ -38,20 +39,28 @@ def cast_bias_weight(s, input=None, dtype=None, device=None, bias_dtype=None): device = input.device offload_stream = comfy.model_management.get_offload_stream(device) + if offload_stream is not None: + wf_context = offload_stream + else: + wf_context = contextlib.nullcontext() + bias = None non_blocking = comfy.model_management.device_supports_non_blocking(device) if s.bias is not None: has_function = len(s.bias_function) > 0 bias = comfy.model_management.cast_to(s.bias, bias_dtype, device, non_blocking=non_blocking, copy=has_function, stream=offload_stream) + if has_function: - for f in s.bias_function: - bias = f(bias) + with wf_context: + for f in s.bias_function: + bias = f(bias) has_function = len(s.weight_function) > 0 weight = comfy.model_management.cast_to(s.weight, dtype, device, non_blocking=non_blocking, copy=has_function, stream=offload_stream) if has_function: - for f in s.weight_function: - weight = f(weight) + with wf_context: + for f in s.weight_function: + weight = f(weight) comfy.model_management.sync_stream(device, offload_stream) return weight, bias From 542b4b36b694148504656ad54433b8ddf0c38c4d Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sat, 26 Apr 2025 17:52:56 -0700 Subject: [PATCH 363/478] Prevent custom nodes from hooking certain functions. (#7825) --- hook_breaker_ac10a0.py | 17 +++++++++++++++++ main.py | 5 ++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 hook_breaker_ac10a0.py diff --git a/hook_breaker_ac10a0.py b/hook_breaker_ac10a0.py new file mode 100644 index 000000000..c3e1c0633 --- /dev/null +++ b/hook_breaker_ac10a0.py @@ -0,0 +1,17 @@ +# Prevent custom nodes from hooking anything important +import comfy.model_management + +HOOK_BREAK = [(comfy.model_management, "cast_to")] + + +SAVED_FUNCTIONS = [] + + +def save_functions(): + for f in HOOK_BREAK: + SAVED_FUNCTIONS.append((f[0], f[1], getattr(f[0], f[1]))) + + +def restore_functions(): + for f in SAVED_FUNCTIONS: + setattr(f[0], f[1], f[2]) diff --git a/main.py b/main.py index ac9d24b7b..f3f56597a 100644 --- a/main.py +++ b/main.py @@ -141,7 +141,7 @@ import nodes import comfy.model_management import comfyui_version import app.logger - +import hook_breaker_ac10a0 def cuda_malloc_warning(): device = comfy.model_management.get_torch_device() @@ -215,6 +215,7 @@ def prompt_worker(q, server_instance): comfy.model_management.soft_empty_cache() last_gc_collect = current_time need_gc = False + hook_breaker_ac10a0.restore_functions() async def run(server_instance, address='', port=8188, verbose=True, call_on_start=None): @@ -268,7 +269,9 @@ def start_comfyui(asyncio_loop=None): prompt_server = server.PromptServer(asyncio_loop) q = execution.PromptQueue(prompt_server) + hook_breaker_ac10a0.save_functions() nodes.init_extra_nodes(init_custom_nodes=not args.disable_all_custom_nodes) + hook_breaker_ac10a0.restore_functions() cuda_malloc_warning() From c8cd7ad795ec4ecc5256bdfe2c12c352eef26e3b Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sun, 27 Apr 2025 02:38:11 -0700 Subject: [PATCH 364/478] Use stream for casting if enabled. (#7833) --- comfy/model_management.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/comfy/model_management.py b/comfy/model_management.py index d118f6b91..516b6e2f1 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -980,6 +980,9 @@ def cast_to(weight, dtype=None, device=None, non_blocking=False, copy=False, str if not copy: if dtype is None or weight.dtype == dtype: return weight + if stream is not None: + with stream: + return weight.to(dtype=dtype, copy=copy) return weight.to(dtype=dtype, copy=copy) if stream is not None: From 8115a7895bf07a75ccf0c4b65122cbf4cd8b0e2b Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Sun, 27 Apr 2025 20:06:55 -0400 Subject: [PATCH 365/478] Add `/api/v2/userdata` endpoint (#7817) * Add list_userdata_v2 * nit * nit * nit * nit * please set me free * \\\\ * \\\\ --- app/user_manager.py | 106 ++++++++++++++++++ .../prompt_server_test/user_manager_test.py | 58 ++++++++++ 2 files changed, 164 insertions(+) diff --git a/app/user_manager.py b/app/user_manager.py index e7381e621..d31da5b9b 100644 --- a/app/user_manager.py +++ b/app/user_manager.py @@ -197,6 +197,112 @@ class UserManager(): return web.json_response(results) + @routes.get("/v2/userdata") + async def list_userdata_v2(request): + """ + List files and directories in a user's data directory. + + This endpoint provides a structured listing of contents within a specified + subdirectory of the user's data storage. + + Query Parameters: + - path (optional): The relative path within the user's data directory + to list. Defaults to the root (''). + + Returns: + - 400: If the requested path is invalid, outside the user's data directory, or is not a directory. + - 404: If the requested path does not exist. + - 403: If the user is invalid. + - 500: If there is an error reading the directory contents. + - 200: JSON response containing a list of file and directory objects. + Each object includes: + - name: The name of the file or directory. + - type: 'file' or 'directory'. + - path: The relative path from the user's data root. + - size (for files): The size in bytes. + - modified (for files): The last modified timestamp (Unix epoch). + """ + requested_rel_path = request.rel_url.query.get('path', '') + + # URL-decode the path parameter + try: + requested_rel_path = parse.unquote(requested_rel_path) + except Exception as e: + logging.warning(f"Failed to decode path parameter: {requested_rel_path}, Error: {e}") + return web.Response(status=400, text="Invalid characters in path parameter") + + + # Check user validity and get the absolute path for the requested directory + try: + base_user_path = self.get_request_user_filepath(request, None, create_dir=False) + + if requested_rel_path: + target_abs_path = self.get_request_user_filepath(request, requested_rel_path, create_dir=False) + else: + target_abs_path = base_user_path + + except KeyError as e: + # Invalid user detected by get_request_user_id inside get_request_user_filepath + logging.warning(f"Access denied for user: {e}") + return web.Response(status=403, text="Invalid user specified in request") + + + if not target_abs_path: + # Path traversal or other issue detected by get_request_user_filepath + return web.Response(status=400, text="Invalid path requested") + + # Handle cases where the user directory or target path doesn't exist + if not os.path.exists(target_abs_path): + # Check if it's the base user directory that's missing (new user case) + if target_abs_path == base_user_path: + # It's okay if the base user directory doesn't exist yet, return empty list + return web.json_response([]) + else: + # A specific subdirectory was requested but doesn't exist + return web.Response(status=404, text="Requested path not found") + + if not os.path.isdir(target_abs_path): + return web.Response(status=400, text="Requested path is not a directory") + + results = [] + try: + for root, dirs, files in os.walk(target_abs_path, topdown=True): + # Process directories + for dir_name in dirs: + dir_path = os.path.join(root, dir_name) + rel_path = os.path.relpath(dir_path, base_user_path).replace(os.sep, '/') + results.append({ + "name": dir_name, + "path": rel_path, + "type": "directory" + }) + + # Process files + for file_name in files: + file_path = os.path.join(root, file_name) + rel_path = os.path.relpath(file_path, base_user_path).replace(os.sep, '/') + entry_info = { + "name": file_name, + "path": rel_path, + "type": "file" + } + try: + stats = os.stat(file_path) # Use os.stat for potentially better performance with os.walk + entry_info["size"] = stats.st_size + entry_info["modified"] = stats.st_mtime + except OSError as stat_error: + logging.warning(f"Could not stat file {file_path}: {stat_error}") + pass # Include file with available info + results.append(entry_info) + except OSError as e: + logging.error(f"Error listing directory {target_abs_path}: {e}") + return web.Response(status=500, text="Error reading directory contents") + + # Sort results alphabetically, directories first then files + results.sort(key=lambda x: (x['type'] != 'directory', x['name'].lower())) + + return web.json_response(results) + def get_user_data_path(request, check_exists = False, param = "file"): file = request.match_info.get(param, None) if not file: diff --git a/tests-unit/prompt_server_test/user_manager_test.py b/tests-unit/prompt_server_test/user_manager_test.py index 7e523cbf4..b939d8e68 100644 --- a/tests-unit/prompt_server_test/user_manager_test.py +++ b/tests-unit/prompt_server_test/user_manager_test.py @@ -229,3 +229,61 @@ async def test_move_userdata_full_info(aiohttp_client, app, tmp_path): assert not os.path.exists(tmp_path / "source.txt") with open(tmp_path / "dest.txt", "r") as f: assert f.read() == "test content" + + +async def test_listuserdata_v2_empty_root(aiohttp_client, app): + client = await aiohttp_client(app) + resp = await client.get("/v2/userdata") + assert resp.status == 200 + assert await resp.json() == [] + + +async def test_listuserdata_v2_nonexistent_subdirectory(aiohttp_client, app): + client = await aiohttp_client(app) + resp = await client.get("/v2/userdata?path=does_not_exist") + assert resp.status == 404 + + +async def test_listuserdata_v2_default(aiohttp_client, app, tmp_path): + os.makedirs(tmp_path / "test_dir" / "subdir") + (tmp_path / "test_dir" / "file1.txt").write_text("content") + (tmp_path / "test_dir" / "subdir" / "file2.txt").write_text("content") + + client = await aiohttp_client(app) + resp = await client.get("/v2/userdata?path=test_dir") + assert resp.status == 200 + data = await resp.json() + file_paths = {item["path"] for item in data if item["type"] == "file"} + assert file_paths == {"test_dir/file1.txt", "test_dir/subdir/file2.txt"} + + +async def test_listuserdata_v2_normalized_separators(aiohttp_client, app, tmp_path, monkeypatch): + # Force backslash as os separator + monkeypatch.setattr(os, 'sep', '\\') + monkeypatch.setattr(os.path, 'sep', '\\') + os.makedirs(tmp_path / "test_dir" / "subdir") + (tmp_path / "test_dir" / "subdir" / "file1.txt").write_text("x") + + client = await aiohttp_client(app) + resp = await client.get("/v2/userdata?path=test_dir") + assert resp.status == 200 + data = await resp.json() + for item in data: + assert "/" in item["path"] + assert "\\" not in item["path"]\ + +async def test_listuserdata_v2_url_encoded_path(aiohttp_client, app, tmp_path): + # Create a directory with a space in its name and a file inside + os.makedirs(tmp_path / "my dir") + (tmp_path / "my dir" / "file.txt").write_text("content") + + client = await aiohttp_client(app) + # Use URL-encoded space in path parameter + resp = await client.get("/v2/userdata?path=my%20dir&recurse=false") + assert resp.status == 200 + data = await resp.json() + assert len(data) == 1 + entry = data[0] + assert entry["name"] == "file.txt" + # Ensure the path is correctly decoded and uses forward slash + assert entry["path"] == "my dir/file.txt" From cb9ac3db586b675a96ebd2604bf099bc189c1b28 Mon Sep 17 00:00:00 2001 From: Andrew Kvochko Date: Mon, 28 Apr 2025 19:59:17 +0300 Subject: [PATCH 366/478] ltxv: add strength parameter to conditioning. (#7849) This commit adds strength parameter to the LTXVImgToVideo node. --- comfy_extras/nodes_lt.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index ff3fe5cdc..1a667e01a 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -38,6 +38,7 @@ class LTXVImgToVideo: "height": ("INT", {"default": 512, "min": 64, "max": nodes.MAX_RESOLUTION, "step": 32}), "length": ("INT", {"default": 97, "min": 9, "max": nodes.MAX_RESOLUTION, "step": 8}), "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), + "strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0}), }} RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT") @@ -46,7 +47,7 @@ class LTXVImgToVideo: CATEGORY = "conditioning/video_models" FUNCTION = "generate" - def generate(self, positive, negative, image, vae, width, height, length, batch_size): + def generate(self, positive, negative, image, vae, width, height, length, batch_size, strength): pixels = comfy.utils.common_upscale(image.movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) encode_pixels = pixels[:, :, :, :3] t = vae.encode(encode_pixels) @@ -59,7 +60,7 @@ class LTXVImgToVideo: dtype=torch.float32, device=latent.device, ) - conditioning_latent_frames_mask[:, :, :t.shape[2]] = 0 + conditioning_latent_frames_mask[:, :, :t.shape[2]] = 1.0 - strength return (positive, negative, {"samples": latent, "noise_mask": conditioning_latent_frames_mask}, ) From 30159a7fe6bfa54fc1b9ba4c80b9041837038819 Mon Sep 17 00:00:00 2001 From: Pam <42671363+pamparamm@users.noreply.github.com> Date: Mon, 28 Apr 2025 22:03:21 +0500 Subject: [PATCH 367/478] Save v pred zsnr metadata (#7840) --- comfy/model_sampling.py | 3 ++- comfy_extras/nodes_model_merging.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/comfy/model_sampling.py b/comfy/model_sampling.py index b79af1e92..7e7291476 100644 --- a/comfy/model_sampling.py +++ b/comfy/model_sampling.py @@ -111,13 +111,14 @@ class ModelSamplingDiscrete(torch.nn.Module): self.num_timesteps = int(timesteps) self.linear_start = linear_start self.linear_end = linear_end + self.zsnr = zsnr # self.register_buffer('betas', torch.tensor(betas, dtype=torch.float32)) # self.register_buffer('alphas_cumprod', torch.tensor(alphas_cumprod, dtype=torch.float32)) # self.register_buffer('alphas_cumprod_prev', torch.tensor(alphas_cumprod_prev, dtype=torch.float32)) sigmas = ((1 - alphas_cumprod) / alphas_cumprod) ** 0.5 - if zsnr: + if self.zsnr: sigmas = rescale_zero_terminal_snr_sigmas(sigmas) self.set_sigmas(sigmas) diff --git a/comfy_extras/nodes_model_merging.py b/comfy_extras/nodes_model_merging.py index ccf601158..78d284889 100644 --- a/comfy_extras/nodes_model_merging.py +++ b/comfy_extras/nodes_model_merging.py @@ -209,6 +209,9 @@ def save_checkpoint(model, clip=None, vae=None, clip_vision=None, filename_prefi metadata["modelspec.predict_key"] = "epsilon" elif model.model.model_type == comfy.model_base.ModelType.V_PREDICTION: metadata["modelspec.predict_key"] = "v" + extra_keys["v_pred"] = torch.tensor([]) + if getattr(model_sampling, "zsnr", False): + extra_keys["ztsnr"] = torch.tensor([]) if not args.disable_metadata: metadata["prompt"] = prompt_info From 5a50c3c7e59a867ddf0b3b7cc207c877a7b422fb Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Mon, 28 Apr 2025 10:07:21 -0700 Subject: [PATCH 368/478] Fix stream priority to support older pytorch. (#7856) --- comfy/model_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 516b6e2f1..78317af3c 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -962,7 +962,7 @@ def get_offload_stream(device): elif is_device_cuda(device): ss = [] for k in range(NUM_STREAMS): - ss.append(torch.cuda.Stream(device=device, priority=10)) + ss.append(torch.cuda.Stream(device=device, priority=0)) STREAMS[device] = ss s = ss[stream_counter] stream_counter = (stream_counter + 1) % len(ss) From 772b4c594549fb42f70833053be8613d79932965 Mon Sep 17 00:00:00 2001 From: Andrew Kvochko Date: Mon, 28 Apr 2025 20:42:04 +0300 Subject: [PATCH 369/478] ltxv: overwrite existing mask on conditioned frame. (#7845) This commit overwrites the noise mask on the latent frame that is being conditioned with keyframe conditioning, setting it to one. --- comfy_extras/nodes_lt.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/comfy_extras/nodes_lt.py b/comfy_extras/nodes_lt.py index 1a667e01a..e6dc122ca 100644 --- a/comfy_extras/nodes_lt.py +++ b/comfy_extras/nodes_lt.py @@ -153,6 +153,15 @@ class LTXVAddGuide: return node_helpers.conditioning_set_values(cond, {"keyframe_idxs": keyframe_idxs}) def append_keyframe(self, positive, negative, frame_idx, latent_image, noise_mask, guiding_latent, strength, scale_factors): + _, latent_idx = self.get_latent_index( + cond=positive, + latent_length=latent_image.shape[2], + guide_length=guiding_latent.shape[2], + frame_idx=frame_idx, + scale_factors=scale_factors, + ) + noise_mask[:, :, latent_idx:latent_idx + guiding_latent.shape[2]] = 1.0 + positive = self.add_keyframe_index(positive, frame_idx, guiding_latent, scale_factors) negative = self.add_keyframe_index(negative, frame_idx, guiding_latent, scale_factors) From c15909bb621b31b0ede693f30cc927021e473c72 Mon Sep 17 00:00:00 2001 From: chaObserv <154517000+chaObserv@users.noreply.github.com> Date: Tue, 29 Apr 2025 01:51:35 +0800 Subject: [PATCH 370/478] CFG++ for gradient estimation sampler (#7809) --- comfy/k_diffusion/sampling.py | 34 +++++++++++++++++++++++++++++----- comfy/samplers.py | 2 +- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index 6388d3faf..77ef748e8 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -1345,28 +1345,52 @@ def sample_res_multistep_ancestral_cfg_pp(model, x, sigmas, extra_args=None, cal return res_multistep(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, s_noise=s_noise, noise_sampler=noise_sampler, eta=eta, cfg_pp=True) @torch.no_grad() -def sample_gradient_estimation(model, x, sigmas, extra_args=None, callback=None, disable=None, ge_gamma=2.): +def sample_gradient_estimation(model, x, sigmas, extra_args=None, callback=None, disable=None, ge_gamma=2., cfg_pp=False): """Gradient-estimation sampler. Paper: https://openreview.net/pdf?id=o2ND9v0CeK""" extra_args = {} if extra_args is None else extra_args s_in = x.new_ones([x.shape[0]]) old_d = None + uncond_denoised = None + def post_cfg_function(args): + nonlocal uncond_denoised + uncond_denoised = args["uncond_denoised"] + return args["denoised"] + + if cfg_pp: + model_options = extra_args.get("model_options", {}).copy() + extra_args["model_options"] = comfy.model_patcher.set_model_options_post_cfg_function(model_options, post_cfg_function, disable_cfg1_optimization=True) + for i in trange(len(sigmas) - 1, disable=disable): denoised = model(x, sigmas[i] * s_in, **extra_args) - d = to_d(x, sigmas[i], denoised) + if cfg_pp: + d = to_d(x, sigmas[i], uncond_denoised) + else: + d = to_d(x, sigmas[i], denoised) if callback is not None: callback({'x': x, 'i': i, 'sigma': sigmas[i], 'sigma_hat': sigmas[i], 'denoised': denoised}) dt = sigmas[i + 1] - sigmas[i] if i == 0: # Euler method - x = x + d * dt + if cfg_pp: + x = denoised + d * sigmas[i + 1] + else: + x = x + d * dt else: # Gradient estimation - d_bar = ge_gamma * d + (1 - ge_gamma) * old_d - x = x + d_bar * dt + if cfg_pp: + d_bar = (ge_gamma - 1) * (d - old_d) + x = denoised + d * sigmas[i + 1] + d_bar * dt + else: + d_bar = ge_gamma * d + (1 - ge_gamma) * old_d + x = x + d_bar * dt old_d = d return x +@torch.no_grad() +def sample_gradient_estimation_cfg_pp(model, x, sigmas, extra_args=None, callback=None, disable=None, ge_gamma=2.): + return sample_gradient_estimation(model, x, sigmas, extra_args=extra_args, callback=callback, disable=disable, ge_gamma=ge_gamma, cfg_pp=True) + @torch.no_grad() def sample_er_sde(model, x, sigmas, extra_args=None, callback=None, disable=None, s_noise=1., noise_sampler=None, noise_scaler=None, max_stage=3): """ diff --git a/comfy/samplers.py b/comfy/samplers.py index 27dfce45a..67ae09a25 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -710,7 +710,7 @@ KSAMPLER_NAMES = ["euler", "euler_cfg_pp", "euler_ancestral", "euler_ancestral_c "lms", "dpm_fast", "dpm_adaptive", "dpmpp_2s_ancestral", "dpmpp_2s_ancestral_cfg_pp", "dpmpp_sde", "dpmpp_sde_gpu", "dpmpp_2m", "dpmpp_2m_cfg_pp", "dpmpp_2m_sde", "dpmpp_2m_sde_gpu", "dpmpp_3m_sde", "dpmpp_3m_sde_gpu", "ddpm", "lcm", "ipndm", "ipndm_v", "deis", "res_multistep", "res_multistep_cfg_pp", "res_multistep_ancestral", "res_multistep_ancestral_cfg_pp", - "gradient_estimation", "er_sde", "seeds_2", "seeds_3"] + "gradient_estimation", "gradient_estimation_cfg_pp", "er_sde", "seeds_2", "seeds_3"] class KSAMPLER(Sampler): def __init__(self, sampler_function, extra_options={}, inpaint_options={}): From 7d329771f9f966fec20aa72079fc39202d877cbd Mon Sep 17 00:00:00 2001 From: Yoland Yan <4950057+yoland68@users.noreply.github.com> Date: Mon, 28 Apr 2025 10:59:22 -0700 Subject: [PATCH 371/478] Add moderation level option to OpenAIGPTImage1 node and update api_call method signature (#7804) --- comfy_api_nodes/nodes_api.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/comfy_api_nodes/nodes_api.py b/comfy_api_nodes/nodes_api.py index 4105ba7e1..a977bb9b7 100644 --- a/comfy_api_nodes/nodes_api.py +++ b/comfy_api_nodes/nodes_api.py @@ -1,21 +1,22 @@ +import base64 import io +import math from inspect import cleandoc -from comfy.utils import common_upscale +import numpy as np +import requests +import torch +from PIL import Image + from comfy.comfy_types.node_typing import IO, ComfyNodeABC, InputTypeDict +from comfy.utils import common_upscale from comfy_api_nodes.apis import ( - OpenAIImageGenerationRequest, OpenAIImageEditRequest, - OpenAIImageGenerationResponse + OpenAIImageGenerationRequest, + OpenAIImageGenerationResponse, ) from comfy_api_nodes.apis.client import ApiEndpoint, HttpMethod, SynchronousOperation -import numpy as np -from PIL import Image -import requests -import torch -import math -import base64 def downscale_input(image): samples = image.movedim(-1,1) @@ -331,6 +332,11 @@ class OpenAIGPTImage1(ComfyNodeABC): "default": None, "tooltip": "Optional mask for inpainting (white areas will be replaced)", }), + "moderation": (IO.COMBO, { + "options": ["low","auto"], + "default": "low", + "tooltip": "Moderation level", + }), }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG" @@ -343,7 +349,7 @@ class OpenAIGPTImage1(ComfyNodeABC): DESCRIPTION = cleandoc(__doc__ or "") API_NODE = True - def api_call(self, prompt, seed=0, quality="low", background="opaque", image=None, mask=None, n=1, size="1024x1024", auth_token=None): + def api_call(self, prompt, seed=0, quality="low", background="opaque", image=None, mask=None, n=1, size="1024x1024", auth_token=None, moderation="low"): model = "gpt-image-1" path = "/proxy/openai/images/generations" request_class = OpenAIImageGenerationRequest @@ -415,6 +421,7 @@ class OpenAIGPTImage1(ComfyNodeABC): n=n, seed=seed, size=size, + moderation=moderation, ), files=files if files else None, auth_token=auth_token From 83d04717b6cd84fca7af31ee655f7e5a3585a371 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Mon, 28 Apr 2025 12:01:15 -0700 Subject: [PATCH 372/478] Support HiDream E1 model. (#7857) --- comfy/ldm/hidream/model.py | 3 +++ comfy/model_base.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/comfy/ldm/hidream/model.py b/comfy/ldm/hidream/model.py index fcb5a9c51..0305747bf 100644 --- a/comfy/ldm/hidream/model.py +++ b/comfy/ldm/hidream/model.py @@ -699,10 +699,13 @@ class HiDreamImageTransformer2DModel(nn.Module): y: Optional[torch.Tensor] = None, context: Optional[torch.Tensor] = None, encoder_hidden_states_llama3=None, + image_cond=None, control = None, transformer_options = {}, ) -> torch.Tensor: bs, c, h, w = x.shape + if image_cond is not None: + x = torch.cat([x, image_cond], dim=-1) hidden_states = comfy.ldm.common_dit.pad_to_patch_size(x, (self.patch_size, self.patch_size)) timesteps = t pooled_embeds = y diff --git a/comfy/model_base.py b/comfy/model_base.py index b0c6a465b..d2aa4ce7a 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -1104,4 +1104,7 @@ class HiDream(BaseModel): conditioning_llama3 = kwargs.get("conditioning_llama3", None) if conditioning_llama3 is not None: out['encoder_hidden_states_llama3'] = comfy.conds.CONDRegular(conditioning_llama3) + image_cond = kwargs.get("concat_latent_image", None) + if image_cond is not None: + out['image_cond'] = comfy.conds.CONDNoiseShape(self.process_latent_in(image_cond)) return out From 68f0d3529667a2b34b27cc0ac5051bc0e8c45b49 Mon Sep 17 00:00:00 2001 From: guill Date: Tue, 29 Apr 2025 02:58:00 -0700 Subject: [PATCH 373/478] Add support for VIDEO as a built-in type (#7844) * Add basic support for videos as types This PR adds support for VIDEO as first-class types. In order to avoid unnecessary costs, VIDEO outputs must implement the `VideoInput` ABC, but their implementation details can vary. Included are two implementations of this type which can be returned by other nodes: * `VideoFromFile` - Created with either a path on disk (as a string) or a `io.BytesIO` containing the contents of a file in a supported format (like .mp4). This implementation won't actually load the video unless necessary. It will also avoid re-encoding when saving if possible. * `VideoFromComponents` - Created from an image tensor and an optional audio tensor. Currently, only h264 encoded videos in .mp4 containers are supported for saving, but the plan is to add additional encodings/containers in the near future (particularly .webm). * Add optimization to avoid parsing entire video * Improve type declarations to reduce warnings * Make sure bytesIO objects can be read many times * Fix a potential issue when saving long videos * Fix incorrect type annotation * Add a `LoadVideo` node to make testing easier * Refactor new types out of the base comfy folder I've created a new `comfy_api` top-level module. The intention is that anything within this folder would be covered by semver-style versioning that would allow custom nodes to rely on them not introducing breaking changes. * Fix linting issue --- comfy/comfy_types/node_typing.py | 9 +- comfy_api/input/__init__.py | 8 + comfy_api/input/basic_types.py | 20 +++ comfy_api/input/video_types.py | 45 ++++++ comfy_api/input_impl/__init__.py | 7 + comfy_api/input_impl/video_types.py | 224 ++++++++++++++++++++++++++++ comfy_api/util/__init__.py | 8 + comfy_api/util/video_types.py | 51 +++++++ comfy_extras/nodes_video.py | 164 +++++++++++++++++++- folder_paths.py | 4 +- 10 files changed, 532 insertions(+), 8 deletions(-) create mode 100644 comfy_api/input/__init__.py create mode 100644 comfy_api/input/basic_types.py create mode 100644 comfy_api/input/video_types.py create mode 100644 comfy_api/input_impl/__init__.py create mode 100644 comfy_api/input_impl/video_types.py create mode 100644 comfy_api/util/__init__.py create mode 100644 comfy_api/util/video_types.py diff --git a/comfy/comfy_types/node_typing.py b/comfy/comfy_types/node_typing.py index 4ceeb3468..2ffc9c021 100644 --- a/comfy/comfy_types/node_typing.py +++ b/comfy/comfy_types/node_typing.py @@ -48,6 +48,7 @@ class IO(StrEnum): FACE_ANALYSIS = "FACE_ANALYSIS" BBOX = "BBOX" SEGS = "SEGS" + VIDEO = "VIDEO" ANY = "*" """Always matches any type, but at a price. @@ -273,7 +274,7 @@ class ComfyNodeABC(ABC): Comfy Docs: https://docs.comfy.org/custom-nodes/backend/lists#list-processing """ - OUTPUT_IS_LIST: tuple[bool] + OUTPUT_IS_LIST: tuple[bool, ...] """A tuple indicating which node outputs are lists, but will be connected to nodes that expect individual items. Connected nodes that do not implement `INPUT_IS_LIST` will be executed once for every item in the list. @@ -292,7 +293,7 @@ class ComfyNodeABC(ABC): Comfy Docs: https://docs.comfy.org/custom-nodes/backend/lists#list-processing """ - RETURN_TYPES: tuple[IO] + RETURN_TYPES: tuple[IO, ...] """A tuple representing the outputs of this node. Usage:: @@ -301,12 +302,12 @@ class ComfyNodeABC(ABC): Comfy Docs: https://docs.comfy.org/custom-nodes/backend/server_overview#return-types """ - RETURN_NAMES: tuple[str] + RETURN_NAMES: tuple[str, ...] """The output slot names for each item in `RETURN_TYPES`, e.g. ``RETURN_NAMES = ("count", "filter_string")`` Comfy Docs: https://docs.comfy.org/custom-nodes/backend/server_overview#return-names """ - OUTPUT_TOOLTIPS: tuple[str] + OUTPUT_TOOLTIPS: tuple[str, ...] """A tuple of strings to use as tooltips for node outputs, one for each item in `RETURN_TYPES`.""" FUNCTION: str """The name of the function to execute as a literal string, e.g. `FUNCTION = "execute"` diff --git a/comfy_api/input/__init__.py b/comfy_api/input/__init__.py new file mode 100644 index 000000000..66667946f --- /dev/null +++ b/comfy_api/input/__init__.py @@ -0,0 +1,8 @@ +from .basic_types import ImageInput, AudioInput +from .video_types import VideoInput + +__all__ = [ + "ImageInput", + "AudioInput", + "VideoInput", +] diff --git a/comfy_api/input/basic_types.py b/comfy_api/input/basic_types.py new file mode 100644 index 000000000..033fb7e27 --- /dev/null +++ b/comfy_api/input/basic_types.py @@ -0,0 +1,20 @@ +import torch +from typing import TypedDict + +ImageInput = torch.Tensor +""" +An image in format [B, H, W, C] where B is the batch size, C is the number of channels, +""" + +class AudioInput(TypedDict): + """ + TypedDict representing audio input. + """ + + waveform: torch.Tensor + """ + Tensor in the format [B, C, T] where B is the batch size, C is the number of channels, + """ + + sample_rate: int + diff --git a/comfy_api/input/video_types.py b/comfy_api/input/video_types.py new file mode 100644 index 000000000..0676e0e66 --- /dev/null +++ b/comfy_api/input/video_types.py @@ -0,0 +1,45 @@ +from __future__ import annotations +from abc import ABC, abstractmethod +from typing import Optional +from comfy_api.util import VideoContainer, VideoCodec, VideoComponents + +class VideoInput(ABC): + """ + Abstract base class for video input types. + """ + + @abstractmethod + def get_components(self) -> VideoComponents: + """ + Abstract method to get the video components (images, audio, and frame rate). + + Returns: + VideoComponents containing images, audio, and frame rate + """ + pass + + @abstractmethod + def save_to( + self, + path: str, + format: VideoContainer = VideoContainer.AUTO, + codec: VideoCodec = VideoCodec.AUTO, + metadata: Optional[dict] = None + ): + """ + Abstract method to save the video input to a file. + """ + pass + + # Provide a default implementation, but subclasses can provide optimized versions + # if possible. + def get_dimensions(self) -> tuple[int, int]: + """ + Returns the dimensions of the video input. + + Returns: + Tuple of (width, height) + """ + components = self.get_components() + return components.images.shape[2], components.images.shape[1] + diff --git a/comfy_api/input_impl/__init__.py b/comfy_api/input_impl/__init__.py new file mode 100644 index 000000000..02901b8b9 --- /dev/null +++ b/comfy_api/input_impl/__init__.py @@ -0,0 +1,7 @@ +from .video_types import VideoFromFile, VideoFromComponents + +__all__ = [ + # Implementations + "VideoFromFile", + "VideoFromComponents", +] diff --git a/comfy_api/input_impl/video_types.py b/comfy_api/input_impl/video_types.py new file mode 100644 index 000000000..12e5783db --- /dev/null +++ b/comfy_api/input_impl/video_types.py @@ -0,0 +1,224 @@ +from __future__ import annotations +from av.container import InputContainer +from av.subtitles.stream import SubtitleStream +from fractions import Fraction +from typing import Optional +from comfy_api.input import AudioInput +import av +import io +import json +import numpy as np +import torch +from comfy_api.input import VideoInput +from comfy_api.util import VideoContainer, VideoCodec, VideoComponents + +class VideoFromFile(VideoInput): + """ + Class representing video input from a file. + """ + + def __init__(self, file: str | io.BytesIO): + """ + Initialize the VideoFromFile object based off of either a path on disk or a BytesIO object + containing the file contents. + """ + self.__file = file + + def get_dimensions(self) -> tuple[int, int]: + """ + Returns the dimensions of the video input. + + Returns: + Tuple of (width, height) + """ + if isinstance(self.__file, io.BytesIO): + self.__file.seek(0) # Reset the BytesIO object to the beginning + with av.open(self.__file, mode='r') as container: + for stream in container.streams: + if stream.type == 'video': + assert isinstance(stream, av.VideoStream) + return stream.width, stream.height + raise ValueError(f"No video stream found in file '{self.__file}'") + + def get_components_internal(self, container: InputContainer) -> VideoComponents: + # Get video frames + frames = [] + for frame in container.decode(video=0): + img = frame.to_ndarray(format='rgb24') # shape: (H, W, 3) + img = torch.from_numpy(img) / 255.0 # shape: (H, W, 3) + frames.append(img) + + images = torch.stack(frames) if len(frames) > 0 else torch.zeros(0, 3, 0, 0) + + # Get frame rate + video_stream = next(s for s in container.streams if s.type == 'video') + frame_rate = Fraction(video_stream.average_rate) if video_stream and video_stream.average_rate else Fraction(1) + + # Get audio if available + audio = None + try: + container.seek(0) # Reset the container to the beginning + for stream in container.streams: + if stream.type != 'audio': + continue + assert isinstance(stream, av.AudioStream) + audio_frames = [] + for packet in container.demux(stream): + for frame in packet.decode(): + assert isinstance(frame, av.AudioFrame) + audio_frames.append(frame.to_ndarray()) # shape: (channels, samples) + if len(audio_frames) > 0: + audio_data = np.concatenate(audio_frames, axis=1) # shape: (channels, total_samples) + audio_tensor = torch.from_numpy(audio_data).unsqueeze(0) # shape: (1, channels, total_samples) + audio = AudioInput({ + "waveform": audio_tensor, + "sample_rate": int(stream.sample_rate) if stream.sample_rate else 1, + }) + except StopIteration: + pass # No audio stream + + metadata = container.metadata + return VideoComponents(images=images, audio=audio, frame_rate=frame_rate, metadata=metadata) + + def get_components(self) -> VideoComponents: + if isinstance(self.__file, io.BytesIO): + self.__file.seek(0) # Reset the BytesIO object to the beginning + with av.open(self.__file, mode='r') as container: + return self.get_components_internal(container) + raise ValueError(f"No video stream found in file '{self.__file}'") + + def save_to( + self, + path: str, + format: VideoContainer = VideoContainer.AUTO, + codec: VideoCodec = VideoCodec.AUTO, + metadata: Optional[dict] = None + ): + if isinstance(self.__file, io.BytesIO): + self.__file.seek(0) # Reset the BytesIO object to the beginning + with av.open(self.__file, mode='r') as container: + container_format = container.format.name + video_encoding = container.streams.video[0].codec.name if len(container.streams.video) > 0 else None + reuse_streams = True + if format != VideoContainer.AUTO and format not in container_format.split(","): + reuse_streams = False + if codec != VideoCodec.AUTO and codec != video_encoding and video_encoding is not None: + reuse_streams = False + + if not reuse_streams: + components = self.get_components_internal(container) + video = VideoFromComponents(components) + return video.save_to( + path, + format=format, + codec=codec, + metadata=metadata + ) + + streams = container.streams + with av.open(path, mode='w', options={"movflags": "use_metadata_tags"}) as output_container: + # Copy over the original metadata + for key, value in container.metadata.items(): + if metadata is None or key not in metadata: + output_container.metadata[key] = value + + # Add our new metadata + if metadata is not None: + for key, value in metadata.items(): + if isinstance(value, str): + output_container.metadata[key] = value + else: + output_container.metadata[key] = json.dumps(value) + + # Add streams to the new container + stream_map = {} + for stream in streams: + if isinstance(stream, (av.VideoStream, av.AudioStream, SubtitleStream)): + out_stream = output_container.add_stream_from_template(template=stream, opaque=True) + stream_map[stream] = out_stream + + # Write packets to the new container + for packet in container.demux(): + if packet.stream in stream_map and packet.dts is not None: + packet.stream = stream_map[packet.stream] + output_container.mux(packet) + +class VideoFromComponents(VideoInput): + """ + Class representing video input from tensors. + """ + + def __init__(self, components: VideoComponents): + self.__components = components + + def get_components(self) -> VideoComponents: + return VideoComponents( + images=self.__components.images, + audio=self.__components.audio, + frame_rate=self.__components.frame_rate + ) + + def save_to( + self, + path: str, + format: VideoContainer = VideoContainer.AUTO, + codec: VideoCodec = VideoCodec.AUTO, + metadata: Optional[dict] = None + ): + if format != VideoContainer.AUTO and format != VideoContainer.MP4: + raise ValueError("Only MP4 format is supported for now") + if codec != VideoCodec.AUTO and codec != VideoCodec.H264: + raise ValueError("Only H264 codec is supported for now") + with av.open(path, mode='w', options={'movflags': 'use_metadata_tags'}) as output: + # Add metadata before writing any streams + if metadata is not None: + for key, value in metadata.items(): + output.metadata[key] = json.dumps(value) + + frame_rate = Fraction(round(self.__components.frame_rate * 1000), 1000) + # Create a video stream + video_stream = output.add_stream('h264', rate=frame_rate) + video_stream.width = self.__components.images.shape[2] + video_stream.height = self.__components.images.shape[1] + video_stream.pix_fmt = 'yuv420p' + + # Create an audio stream + audio_sample_rate = 1 + audio_stream: Optional[av.AudioStream] = None + if self.__components.audio: + audio_sample_rate = int(self.__components.audio['sample_rate']) + audio_stream = output.add_stream('aac', rate=audio_sample_rate) + audio_stream.sample_rate = audio_sample_rate + audio_stream.format = 'fltp' + + # Encode video + for i, frame in enumerate(self.__components.images): + img = (frame * 255).clamp(0, 255).byte().cpu().numpy() # shape: (H, W, 3) + frame = av.VideoFrame.from_ndarray(img, format='rgb24') + frame = frame.reformat(format='yuv420p') # Convert to YUV420P as required by h264 + packet = video_stream.encode(frame) + output.mux(packet) + + # Flush video + packet = video_stream.encode(None) + output.mux(packet) + + if audio_stream and self.__components.audio: + # Encode audio + samples_per_frame = int(audio_sample_rate / frame_rate) + num_frames = self.__components.audio['waveform'].shape[2] // samples_per_frame + for i in range(num_frames): + start = i * samples_per_frame + end = start + samples_per_frame + # TODO(Feature) - Add support for stereo audio + chunk = self.__components.audio['waveform'][0, 0, start:end].unsqueeze(0).numpy() + audio_frame = av.AudioFrame.from_ndarray(chunk, format='fltp', layout='mono') + audio_frame.sample_rate = audio_sample_rate + audio_frame.pts = i * samples_per_frame + for packet in audio_stream.encode(audio_frame): + output.mux(packet) + + # Flush audio + for packet in audio_stream.encode(None): + output.mux(packet) + diff --git a/comfy_api/util/__init__.py b/comfy_api/util/__init__.py new file mode 100644 index 000000000..9019c46db --- /dev/null +++ b/comfy_api/util/__init__.py @@ -0,0 +1,8 @@ +from .video_types import VideoContainer, VideoCodec, VideoComponents + +__all__ = [ + # Utility Types + "VideoContainer", + "VideoCodec", + "VideoComponents", +] diff --git a/comfy_api/util/video_types.py b/comfy_api/util/video_types.py new file mode 100644 index 000000000..d09663db9 --- /dev/null +++ b/comfy_api/util/video_types.py @@ -0,0 +1,51 @@ +from __future__ import annotations +from dataclasses import dataclass +from enum import Enum +from fractions import Fraction +from typing import Optional +from comfy_api.input import ImageInput, AudioInput + +class VideoCodec(str, Enum): + AUTO = "auto" + H264 = "h264" + + @classmethod + def as_input(cls) -> list[str]: + """ + Returns a list of codec names that can be used as node input. + """ + return [member.value for member in cls] + +class VideoContainer(str, Enum): + AUTO = "auto" + MP4 = "mp4" + + @classmethod + def as_input(cls) -> list[str]: + """ + Returns a list of container names that can be used as node input. + """ + return [member.value for member in cls] + + @classmethod + def get_extension(cls, value) -> str: + """ + Returns the file extension for the container. + """ + if isinstance(value, str): + value = cls(value) + if value == VideoContainer.MP4 or value == VideoContainer.AUTO: + return "mp4" + return "" + +@dataclass +class VideoComponents: + """ + Dataclass representing the components of a video. + """ + + images: ImageInput + frame_rate: Fraction + audio: Optional[AudioInput] = None + metadata: Optional[dict] = None + diff --git a/comfy_extras/nodes_video.py b/comfy_extras/nodes_video.py index a9e244ebe..61f7171b2 100644 --- a/comfy_extras/nodes_video.py +++ b/comfy_extras/nodes_video.py @@ -5,9 +5,13 @@ import av import torch import folder_paths import json +from typing import Optional, Literal from fractions import Fraction -from comfy.comfy_types import FileLocator - +from comfy.comfy_types import IO, FileLocator, ComfyNodeABC +from comfy_api.input import ImageInput, AudioInput, VideoInput +from comfy_api.util import VideoContainer, VideoCodec, VideoComponents +from comfy_api.input_impl import VideoFromFile, VideoFromComponents +from comfy.cli_args import args class SaveWEBM: def __init__(self): @@ -75,7 +79,163 @@ class SaveWEBM: return {"ui": {"images": results, "animated": (True,)}} # TODO: frontend side +class SaveVideo(ComfyNodeABC): + def __init__(self): + self.output_dir = folder_paths.get_output_directory() + self.type: Literal["output"] = "output" + self.prefix_append = "" + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "video": (IO.VIDEO, {"tooltip": "The video to save."}), + "filename_prefix": ("STRING", {"default": "video/ComfyUI", "tooltip": "The prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Image.width% to include values from nodes."}), + "format": (VideoContainer.as_input(), {"default": "auto", "tooltip": "The format to save the video as."}), + "codec": (VideoCodec.as_input(), {"default": "auto", "tooltip": "The codec to use for the video."}), + }, + "hidden": { + "prompt": "PROMPT", + "extra_pnginfo": "EXTRA_PNGINFO" + }, + } + + RETURN_TYPES = () + FUNCTION = "save_video" + + OUTPUT_NODE = True + + CATEGORY = "image/video" + DESCRIPTION = "Saves the input images to your ComfyUI output directory." + + def save_video(self, video: VideoInput, filename_prefix, format, codec, prompt=None, extra_pnginfo=None): + filename_prefix += self.prefix_append + width, height = video.get_dimensions() + full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path( + filename_prefix, + self.output_dir, + width, + height + ) + results: list[FileLocator] = list() + saved_metadata = None + if not args.disable_metadata: + metadata = {} + if extra_pnginfo is not None: + metadata.update(extra_pnginfo) + if prompt is not None: + metadata["prompt"] = prompt + if len(metadata) > 0: + saved_metadata = metadata + file = f"{filename}_{counter:05}_.{VideoContainer.get_extension(format)}" + video.save_to( + os.path.join(full_output_folder, file), + format=format, + codec=codec, + metadata=saved_metadata + ) + + results.append({ + "filename": file, + "subfolder": subfolder, + "type": self.type + }) + counter += 1 + + return { "ui": { "images": results, "animated": (True,) } } + +class CreateVideo(ComfyNodeABC): + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "images": (IO.IMAGE, {"tooltip": "The images to create a video from."}), + "fps": ("FLOAT", {"default": 30.0, "min": 1.0, "max": 120.0, "step": 1.0}), + }, + "optional": { + "audio": (IO.AUDIO, {"tooltip": "The audio to add to the video."}), + } + } + + RETURN_TYPES = (IO.VIDEO,) + FUNCTION = "create_video" + + CATEGORY = "image/video" + DESCRIPTION = "Create a video from images." + + def create_video(self, images: ImageInput, fps: float, audio: Optional[AudioInput] = None): + return (VideoFromComponents( + VideoComponents( + images=images, + audio=audio, + frame_rate=Fraction(fps), + ) + ),) + +class GetVideoComponents(ComfyNodeABC): + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "video": (IO.VIDEO, {"tooltip": "The video to extract components from."}), + } + } + RETURN_TYPES = (IO.IMAGE, IO.AUDIO, IO.FLOAT) + RETURN_NAMES = ("images", "audio", "fps") + FUNCTION = "get_components" + + CATEGORY = "image/video" + DESCRIPTION = "Extracts all components from a video: frames, audio, and framerate." + + def get_components(self, video: VideoInput): + components = video.get_components() + + return (components.images, components.audio, float(components.frame_rate)) + +class LoadVideo(ComfyNodeABC): + @classmethod + def INPUT_TYPES(cls): + input_dir = folder_paths.get_input_directory() + files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))] + files = folder_paths.filter_files_content_types(files, ["video"]) + return {"required": + {"file": (sorted(files), {"video_upload": True})}, + } + + CATEGORY = "image/video" + + RETURN_TYPES = (IO.VIDEO,) + FUNCTION = "load_video" + def load_video(self, file): + video_path = folder_paths.get_annotated_filepath(file) + return (VideoFromFile(video_path),) + + @classmethod + def IS_CHANGED(cls, file): + video_path = folder_paths.get_annotated_filepath(file) + mod_time = os.path.getmtime(video_path) + # Instead of hashing the file, we can just use the modification time to avoid + # rehashing large files. + return mod_time + + @classmethod + def VALIDATE_INPUTS(cls, file): + if not folder_paths.exists_annotated_filepath(file): + return "Invalid video file: {}".format(file) + + return True NODE_CLASS_MAPPINGS = { "SaveWEBM": SaveWEBM, + "SaveVideo": SaveVideo, + "CreateVideo": CreateVideo, + "GetVideoComponents": GetVideoComponents, + "LoadVideo": LoadVideo, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "SaveVideo": "Save Video", + "CreateVideo": "Create Video", + "GetVideoComponents": "Get Video Components", + "LoadVideo": "Load Video", } diff --git a/folder_paths.py b/folder_paths.py index 9a525e5a1..f0b3fd103 100644 --- a/folder_paths.py +++ b/folder_paths.py @@ -4,7 +4,7 @@ import os import time import mimetypes import logging -from typing import Literal +from typing import Literal, List from collections.abc import Collection from comfy.cli_args import args @@ -141,7 +141,7 @@ def get_directory_by_type(type_name: str) -> str | None: return get_input_directory() return None -def filter_files_content_types(files: list[str], content_types: Literal["image", "video", "audio", "model"]) -> list[str]: +def filter_files_content_types(files: list[str], content_types: List[Literal["image", "video", "audio", "model"]]) -> list[str]: """ Example: files = os.listdir(folder_paths.get_input_directory()) From 005a91ce2b6455d7e76f7a5cf2e77dbd020afa1f Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Tue, 29 Apr 2025 03:29:38 -0700 Subject: [PATCH 374/478] Latest desktop and portable should work on blackwell. (#7861) Removed the mention about the cards from the readme. --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 62800bb4f..24a65b942 100644 --- a/README.md +++ b/README.md @@ -149,8 +149,6 @@ Simply download, extract with [7-Zip](https://7-zip.org) and run. Make sure you If you have trouble extracting it, right click the file -> properties -> unblock -If you have a 50 series Blackwell card like a 5090 or 5080 see [this discussion thread](https://github.com/comfyanonymous/ComfyUI/discussions/6643) - #### How do I share models between another UI and ComfyUI? See the [Config file](extra_model_paths.yaml.example) to set the search paths for models. In the standalone windows build you can find this file in the ComfyUI directory. Rename this file to extra_model_paths.yaml and edit it with your favorite text editor. From 45503f649925fdf8e6ddce85fabee551ee3c446b Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Tue, 29 Apr 2025 06:32:34 -0400 Subject: [PATCH 375/478] Add release process section to README (#7855) * Add release process section to README * move * Update README.md --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 24a65b942..0f39cfce2 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,6 @@ Supports all operating systems and GPU types (NVIDIA, AMD, Intel, Apple Silicon, ## [Examples](https://comfyanonymous.github.io/ComfyUI_examples/) See what ComfyUI can do with the [example workflows](https://comfyanonymous.github.io/ComfyUI_examples/). - ## Features - Nodes/graph/flowchart interface to experiment and create complex Stable Diffusion workflows without needing to code anything. - Image Models @@ -99,6 +98,23 @@ See what ComfyUI can do with the [example workflows](https://comfyanonymous.gith Workflow examples can be found on the [Examples page](https://comfyanonymous.github.io/ComfyUI_examples/) +## Release Process + +ComfyUI follows a weekly release cycle every Friday, with three interconnected repositories: + +1. **[ComfyUI Core](https://github.com/comfyanonymous/ComfyUI)** + - Releases a new stable version (e.g., v0.7.0) + - Serves as the foundation for the desktop release + +2. **[ComfyUI Desktop](https://github.com/Comfy-Org/desktop)** + - Builds a new release using the latest stable core version + - Version numbers match the core release (e.g., Desktop v1.7.0 uses Core v1.7.0) + +3. **[ComfyUI Frontend](https://github.com/Comfy-Org/ComfyUI_frontend)** + - Weekly frontend updates are merged into the core repository + - Features are frozen for the upcoming core release + - Development continues for the next release cycle + ## Shortcuts | Keybind | Explanation | From 5c5457a4ef151f9f855020ff544b4362cdcf1201 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Tue, 29 Apr 2025 11:28:04 -0400 Subject: [PATCH 376/478] support more example folders (#7836) * support more example folders * add warning message --- app/custom_node_manager.py | 43 ++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/app/custom_node_manager.py b/app/custom_node_manager.py index 42b0d75ba..27d85d9ce 100644 --- a/app/custom_node_manager.py +++ b/app/custom_node_manager.py @@ -93,16 +93,20 @@ class CustomNodeManager: def add_routes(self, routes, webapp, loadedModules): + example_workflow_folder_names = ["example_workflows", "example", "examples", "workflow", "workflows"] + @routes.get("/workflow_templates") async def get_workflow_templates(request): """Returns a web response that contains the map of custom_nodes names and their associated workflow templates. The ones without templates are omitted.""" - files = [ - file - for folder in folder_paths.get_folder_paths("custom_nodes") - for file in glob.glob( - os.path.join(folder, "*/example_workflows/*.json") - ) - ] + + files = [] + + for folder in folder_paths.get_folder_paths("custom_nodes"): + for folder_name in example_workflow_folder_names: + pattern = os.path.join(folder, f"*/{folder_name}/*.json") + matched_files = glob.glob(pattern) + files.extend(matched_files) + workflow_templates_dict = ( {} ) # custom_nodes folder name -> example workflow names @@ -118,15 +122,22 @@ class CustomNodeManager: # Serve workflow templates from custom nodes. for module_name, module_dir in loadedModules: - workflows_dir = os.path.join(module_dir, "example_workflows") - if os.path.exists(workflows_dir): - webapp.add_routes( - [ - web.static( - "/api/workflow_templates/" + module_name, workflows_dir - ) - ] - ) + for folder_name in example_workflow_folder_names: + workflows_dir = os.path.join(module_dir, folder_name) + + if os.path.exists(workflows_dir): + if folder_name != "example_workflows": + logging.warning( + "WARNING: Found example workflow folder '%s' for custom node '%s', consider renaming it to 'example_workflows'", + folder_name, module_name) + + webapp.add_routes( + [ + web.static( + "/api/workflow_templates/" + module_name, workflows_dir + ) + ] + ) @routes.get("/i18n") async def get_i18n(request): From 0a66d4b0afe4a78a200809b7d1d3beec6c6a2a8f Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Tue, 29 Apr 2025 17:28:52 -0700 Subject: [PATCH 377/478] Per device stream counters for async offload. (#7873) --- comfy/model_management.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 78317af3c..44aff3762 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -946,9 +946,9 @@ if args.async_offload: NUM_STREAMS = 2 logging.info("Using async weight offloading with {} streams".format(NUM_STREAMS)) -stream_counter = 0 +stream_counters = {} def get_offload_stream(device): - global stream_counter + stream_counter = stream_counters.get(device, 0) if NUM_STREAMS <= 1: return None @@ -958,6 +958,7 @@ def get_offload_stream(device): stream_counter = (stream_counter + 1) % len(ss) if is_device_cuda(device): ss[stream_counter].wait_stream(torch.cuda.current_stream()) + stream_counters[device] = stream_counter return s elif is_device_cuda(device): ss = [] @@ -966,6 +967,7 @@ def get_offload_stream(device): STREAMS[device] = ss s = ss[stream_counter] stream_counter = (stream_counter + 1) % len(ss) + stream_counters[device] = stream_counter return s return None From 7ee96455e2ed29293aa6076db9b4866862d41142 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Tue, 29 Apr 2025 17:38:45 -0700 Subject: [PATCH 378/478] Bump minimum pyav version to 14.2.0 (#7874) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 10cc177af..f64a05947 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,5 +22,5 @@ psutil kornia>=0.7.1 spandrel soundfile -av>=14.1.0 +av>=14.2.0 pydantic~=2.0 From dbc726f80c9ac0512d2611fad63d984b8c03886f Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Tue, 29 Apr 2025 17:42:00 -0700 Subject: [PATCH 379/478] Better vace memory estimation. (#7875) --- comfy/ldm/wan/model.py | 1 + comfy/supported_models.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index b8eec3afb..66bee7480 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -631,6 +631,7 @@ class VaceWanModel(WanModel): if ii is not None: c_skip, c = self.vace_blocks[ii](c, x=x_orig, e=e0, freqs=freqs, context=context, context_img_len=context_img_len) x += c_skip * vace_strength + del c_skip # head x = self.head(x, e) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 5e55035cf..69bcee1f7 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -993,6 +993,10 @@ class WAN21_Vace(WAN21_T2V): "model_type": "vace", } + def __init__(self, unet_config): + super().__init__(unet_config) + self.memory_usage_factor = 1.2 * self.memory_usage_factor + def get_model(self, state_dict, prefix="", device=None): out = model_base.WAN21_Vace(self, image_to_video=False, device=device) return out From b1c7291569daaeec34ccf6df25d57886eb73d98e Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 30 Apr 2025 11:18:20 -0700 Subject: [PATCH 380/478] Test updater in the windows release workflow. (#7886) --- .github/workflows/windows_release_package.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/windows_release_package.yml b/.github/workflows/windows_release_package.yml index 80a45b321..3926a65f3 100644 --- a/.github/workflows/windows_release_package.yml +++ b/.github/workflows/windows_release_package.yml @@ -88,6 +88,8 @@ jobs: cd ComfyUI_windows_portable python_embeded/python.exe -s ComfyUI/main.py --quick-test-for-ci --cpu + python_embeded/python.exe -s ./update/update.py ComfyUI/ + ls - name: Upload binaries to release From 39c27a37052b5e18850a6c63cd0a4b92131db3ba Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 30 Apr 2025 11:42:18 -0700 Subject: [PATCH 381/478] Add updater test to stable release workflow. (#7887) --- .github/workflows/stable-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.yml index c4302cdd6..a046ff9ea 100644 --- a/.github/workflows/stable-release.yml +++ b/.github/workflows/stable-release.yml @@ -91,6 +91,8 @@ jobs: cd ComfyUI_windows_portable python_embeded/python.exe -s ComfyUI/main.py --quick-test-for-ci --cpu + python_embeded/python.exe -s ./update/update.py ComfyUI/ + ls - name: Upload binaries to release From 4ca3d842774421968cc19c319ee96daa58a98fbb Mon Sep 17 00:00:00 2001 From: Silver <65376327+silveroxides@users.noreply.github.com> Date: Thu, 1 May 2025 02:57:00 +0200 Subject: [PATCH 382/478] Support for Chroma - Flux1 Schnell distilled with CFG (#7355) * Upload files for Chroma Implementation * Remove trailing whitespace * trim more trailing whitespace..oops * remove unused imports * Add supported_inference_dtypes * Set min_length to 0 and remove attention_mask=True * Set min_length to 1 * get_mdulations added from blepping and minor changes * Add lora conversion if statement in lora.py * Update supported_models.py * update model_base.py * add uptream commits * set modelType.FLOW, will cause beta scheduler to work properly * Adjust memory usage factor and remove unnecessary code * fix mistake * reduce code duplication * remove unused imports * refactor for upstream sync * sync chroma-support with upstream via syncbranch patch * Update sd.py * Add Chroma as option for the OptimalStepsScheduler node --- comfy/ldm/chroma/layers.py | 183 +++++++++++++++++++ comfy/ldm/chroma/math.py | 44 +++++ comfy/ldm/chroma/model.py | 271 +++++++++++++++++++++++++++++ comfy/lora.py | 2 +- comfy/model_base.py | 62 +++++++ comfy/model_detection.py | 26 +++ comfy/sd.py | 5 + comfy/supported_models.py | 30 +++- comfy/text_encoders/chroma.py | 43 +++++ comfy_extras/nodes_optimalsteps.py | 3 +- nodes.py | 2 +- 11 files changed, 667 insertions(+), 4 deletions(-) create mode 100644 comfy/ldm/chroma/layers.py create mode 100644 comfy/ldm/chroma/math.py create mode 100644 comfy/ldm/chroma/model.py create mode 100644 comfy/text_encoders/chroma.py diff --git a/comfy/ldm/chroma/layers.py b/comfy/ldm/chroma/layers.py new file mode 100644 index 000000000..dd0b72f70 --- /dev/null +++ b/comfy/ldm/chroma/layers.py @@ -0,0 +1,183 @@ +import torch +from torch import Tensor, nn + +from .math import attention +from comfy.ldm.flux.layers import ( + MLPEmbedder, + RMSNorm, + QKNorm, + SelfAttention, + ModulationOut, +) + + + +class ChromaModulationOut(ModulationOut): + @classmethod + def from_offset(cls, tensor: torch.Tensor, offset: int = 0) -> ModulationOut: + return cls( + shift=tensor[:, offset : offset + 1, :], + scale=tensor[:, offset + 1 : offset + 2, :], + gate=tensor[:, offset + 2 : offset + 3, :], + ) + + + + +class Approximator(nn.Module): + def __init__(self, in_dim: int, out_dim: int, hidden_dim: int, n_layers = 5, dtype=None, device=None, operations=None): + super().__init__() + self.in_proj = operations.Linear(in_dim, hidden_dim, bias=True, dtype=dtype, device=device) + self.layers = nn.ModuleList([MLPEmbedder(hidden_dim, hidden_dim, dtype=dtype, device=device, operations=operations) for x in range( n_layers)]) + self.norms = nn.ModuleList([RMSNorm(hidden_dim, dtype=dtype, device=device, operations=operations) for x in range( n_layers)]) + self.out_proj = operations.Linear(hidden_dim, out_dim, dtype=dtype, device=device) + + @property + def device(self): + # Get the device of the module (assumes all parameters are on the same device) + return next(self.parameters()).device + + def forward(self, x: Tensor) -> Tensor: + x = self.in_proj(x) + + for layer, norms in zip(self.layers, self.norms): + x = x + layer(norms(x)) + + x = self.out_proj(x) + + return x + + +class DoubleStreamBlock(nn.Module): + def __init__(self, hidden_size: int, num_heads: int, mlp_ratio: float, qkv_bias: bool = False, flipped_img_txt=False, dtype=None, device=None, operations=None): + super().__init__() + + mlp_hidden_dim = int(hidden_size * mlp_ratio) + self.num_heads = num_heads + self.hidden_size = hidden_size + self.img_norm1 = operations.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6, dtype=dtype, device=device) + self.img_attn = SelfAttention(dim=hidden_size, num_heads=num_heads, qkv_bias=qkv_bias, dtype=dtype, device=device, operations=operations) + + self.img_norm2 = operations.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6, dtype=dtype, device=device) + self.img_mlp = nn.Sequential( + operations.Linear(hidden_size, mlp_hidden_dim, bias=True, dtype=dtype, device=device), + nn.GELU(approximate="tanh"), + operations.Linear(mlp_hidden_dim, hidden_size, bias=True, dtype=dtype, device=device), + ) + + self.txt_norm1 = operations.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6, dtype=dtype, device=device) + self.txt_attn = SelfAttention(dim=hidden_size, num_heads=num_heads, qkv_bias=qkv_bias, dtype=dtype, device=device, operations=operations) + + self.txt_norm2 = operations.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6, dtype=dtype, device=device) + self.txt_mlp = nn.Sequential( + operations.Linear(hidden_size, mlp_hidden_dim, bias=True, dtype=dtype, device=device), + nn.GELU(approximate="tanh"), + operations.Linear(mlp_hidden_dim, hidden_size, bias=True, dtype=dtype, device=device), + ) + self.flipped_img_txt = flipped_img_txt + + def forward(self, img: Tensor, txt: Tensor, pe: Tensor, vec: Tensor, attn_mask=None): + (img_mod1, img_mod2), (txt_mod1, txt_mod2) = vec + + # prepare image for attention + img_modulated = self.img_norm1(img) + img_modulated = (1 + img_mod1.scale) * img_modulated + img_mod1.shift + img_qkv = self.img_attn.qkv(img_modulated) + img_q, img_k, img_v = img_qkv.view(img_qkv.shape[0], img_qkv.shape[1], 3, self.num_heads, -1).permute(2, 0, 3, 1, 4) + img_q, img_k = self.img_attn.norm(img_q, img_k, img_v) + + # prepare txt for attention + txt_modulated = self.txt_norm1(txt) + txt_modulated = (1 + txt_mod1.scale) * txt_modulated + txt_mod1.shift + txt_qkv = self.txt_attn.qkv(txt_modulated) + txt_q, txt_k, txt_v = txt_qkv.view(txt_qkv.shape[0], txt_qkv.shape[1], 3, self.num_heads, -1).permute(2, 0, 3, 1, 4) + txt_q, txt_k = self.txt_attn.norm(txt_q, txt_k, txt_v) + + # run actual attention + attn = attention(torch.cat((txt_q, img_q), dim=2), + torch.cat((txt_k, img_k), dim=2), + torch.cat((txt_v, img_v), dim=2), + pe=pe, mask=attn_mask) + + txt_attn, img_attn = attn[:, : txt.shape[1]], attn[:, txt.shape[1] :] + + # calculate the img bloks + img = img + img_mod1.gate * self.img_attn.proj(img_attn) + img = img + img_mod2.gate * self.img_mlp((1 + img_mod2.scale) * self.img_norm2(img) + img_mod2.shift) + + # calculate the txt bloks + txt += txt_mod1.gate * self.txt_attn.proj(txt_attn) + txt += txt_mod2.gate * self.txt_mlp((1 + txt_mod2.scale) * self.txt_norm2(txt) + txt_mod2.shift) + + if txt.dtype == torch.float16: + txt = torch.nan_to_num(txt, nan=0.0, posinf=65504, neginf=-65504) + + return img, txt + + +class SingleStreamBlock(nn.Module): + """ + A DiT block with parallel linear layers as described in + https://arxiv.org/abs/2302.05442 and adapted modulation interface. + """ + + def __init__( + self, + hidden_size: int, + num_heads: int, + mlp_ratio: float = 4.0, + qk_scale: float = None, + dtype=None, + device=None, + operations=None + ): + super().__init__() + self.hidden_dim = hidden_size + self.num_heads = num_heads + head_dim = hidden_size // num_heads + self.scale = qk_scale or head_dim**-0.5 + + self.mlp_hidden_dim = int(hidden_size * mlp_ratio) + # qkv and mlp_in + self.linear1 = operations.Linear(hidden_size, hidden_size * 3 + self.mlp_hidden_dim, dtype=dtype, device=device) + # proj and mlp_out + self.linear2 = operations.Linear(hidden_size + self.mlp_hidden_dim, hidden_size, dtype=dtype, device=device) + + self.norm = QKNorm(head_dim, dtype=dtype, device=device, operations=operations) + + self.hidden_size = hidden_size + self.pre_norm = operations.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6, dtype=dtype, device=device) + + self.mlp_act = nn.GELU(approximate="tanh") + + def forward(self, x: Tensor, pe: Tensor, vec: Tensor, attn_mask=None) -> Tensor: + mod = vec + x_mod = (1 + mod.scale) * self.pre_norm(x) + mod.shift + qkv, mlp = torch.split(self.linear1(x_mod), [3 * self.hidden_size, self.mlp_hidden_dim], dim=-1) + + q, k, v = qkv.view(qkv.shape[0], qkv.shape[1], 3, self.num_heads, -1).permute(2, 0, 3, 1, 4) + q, k = self.norm(q, k, v) + + # compute attention + attn = attention(q, k, v, pe=pe, mask=attn_mask) + # compute activation in mlp stream, cat again and run second linear layer + output = self.linear2(torch.cat((attn, self.mlp_act(mlp)), 2)) + x += mod.gate * output + if x.dtype == torch.float16: + x = torch.nan_to_num(x, nan=0.0, posinf=65504, neginf=-65504) + return x + + +class LastLayer(nn.Module): + def __init__(self, hidden_size: int, patch_size: int, out_channels: int, dtype=None, device=None, operations=None): + super().__init__() + self.norm_final = operations.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6, dtype=dtype, device=device) + self.linear = operations.Linear(hidden_size, out_channels, bias=True, dtype=dtype, device=device) + + def forward(self, x: Tensor, vec: Tensor) -> Tensor: + shift, scale = vec + shift = shift.squeeze(1) + scale = scale.squeeze(1) + x = (1 + scale[:, None, :]) * self.norm_final(x) + shift[:, None, :] + x = self.linear(x) + return x diff --git a/comfy/ldm/chroma/math.py b/comfy/ldm/chroma/math.py new file mode 100644 index 000000000..36b67931c --- /dev/null +++ b/comfy/ldm/chroma/math.py @@ -0,0 +1,44 @@ +import torch +from einops import rearrange +from torch import Tensor + +from comfy.ldm.modules.attention import optimized_attention +import comfy.model_management + + +def attention(q: Tensor, k: Tensor, v: Tensor, pe: Tensor, mask=None) -> Tensor: + q_shape = q.shape + k_shape = k.shape + + q = q.float().reshape(*q.shape[:-1], -1, 1, 2) + k = k.float().reshape(*k.shape[:-1], -1, 1, 2) + q = (pe[..., 0] * q[..., 0] + pe[..., 1] * q[..., 1]).reshape(*q_shape).type_as(v) + k = (pe[..., 0] * k[..., 0] + pe[..., 1] * k[..., 1]).reshape(*k_shape).type_as(v) + + heads = q.shape[1] + x = optimized_attention(q, k, v, heads, skip_reshape=True, mask=mask) + return x + + +def rope(pos: Tensor, dim: int, theta: int) -> Tensor: + assert dim % 2 == 0 + if comfy.model_management.is_device_mps(pos.device) or comfy.model_management.is_intel_xpu() or comfy.model_management.is_directml_enabled(): + device = torch.device("cpu") + else: + device = pos.device + + scale = torch.linspace(0, (dim - 2) / dim, steps=dim//2, dtype=torch.float64, device=device) + omega = 1.0 / (theta**scale) + out = torch.einsum("...n,d->...nd", pos.to(dtype=torch.float32, device=device), omega) + out = torch.stack([torch.cos(out), -torch.sin(out), torch.sin(out), torch.cos(out)], dim=-1) + out = rearrange(out, "b n d (i j) -> b n d i j", i=2, j=2) + return out.to(dtype=torch.float32, device=pos.device) + + +def apply_rope(xq: Tensor, xk: Tensor, freqs_cis: Tensor): + xq_ = xq.float().reshape(*xq.shape[:-1], -1, 1, 2) + xk_ = xk.float().reshape(*xk.shape[:-1], -1, 1, 2) + xq_out = freqs_cis[..., 0] * xq_[..., 0] + freqs_cis[..., 1] * xq_[..., 1] + xk_out = freqs_cis[..., 0] * xk_[..., 0] + freqs_cis[..., 1] * xk_[..., 1] + return xq_out.reshape(*xq.shape).type_as(xq), xk_out.reshape(*xk.shape).type_as(xk) + diff --git a/comfy/ldm/chroma/model.py b/comfy/ldm/chroma/model.py new file mode 100644 index 000000000..636748fc5 --- /dev/null +++ b/comfy/ldm/chroma/model.py @@ -0,0 +1,271 @@ +#Original code can be found on: https://github.com/black-forest-labs/flux + +from dataclasses import dataclass + +import torch +from torch import Tensor, nn +from einops import rearrange, repeat +import comfy.ldm.common_dit + +from comfy.ldm.flux.layers import ( + EmbedND, + timestep_embedding, +) + +from .layers import ( + DoubleStreamBlock, + LastLayer, + SingleStreamBlock, + Approximator, + ChromaModulationOut, +) + + +@dataclass +class ChromaParams: + in_channels: int + out_channels: int + context_in_dim: int + hidden_size: int + mlp_ratio: float + num_heads: int + depth: int + depth_single_blocks: int + axes_dim: list + theta: int + patch_size: int + qkv_bias: bool + in_dim: int + out_dim: int + hidden_dim: int + n_layers: int + + + + +class Chroma(nn.Module): + """ + Transformer model for flow matching on sequences. + """ + + def __init__(self, image_model=None, final_layer=True, dtype=None, device=None, operations=None, **kwargs): + super().__init__() + self.dtype = dtype + params = ChromaParams(**kwargs) + self.params = params + self.patch_size = params.patch_size + self.in_channels = params.in_channels + self.out_channels = params.out_channels + if params.hidden_size % params.num_heads != 0: + raise ValueError( + f"Hidden size {params.hidden_size} must be divisible by num_heads {params.num_heads}" + ) + pe_dim = params.hidden_size // params.num_heads + if sum(params.axes_dim) != pe_dim: + raise ValueError(f"Got {params.axes_dim} but expected positional dim {pe_dim}") + self.hidden_size = params.hidden_size + self.num_heads = params.num_heads + self.in_dim = params.in_dim + self.out_dim = params.out_dim + self.hidden_dim = params.hidden_dim + self.n_layers = params.n_layers + self.pe_embedder = EmbedND(dim=pe_dim, theta=params.theta, axes_dim=params.axes_dim) + self.img_in = operations.Linear(self.in_channels, self.hidden_size, bias=True, dtype=dtype, device=device) + self.txt_in = operations.Linear(params.context_in_dim, self.hidden_size, dtype=dtype, device=device) + # set as nn identity for now, will overwrite it later. + self.distilled_guidance_layer = Approximator( + in_dim=self.in_dim, + hidden_dim=self.hidden_dim, + out_dim=self.out_dim, + n_layers=self.n_layers, + dtype=dtype, device=device, operations=operations + ) + + + self.double_blocks = nn.ModuleList( + [ + DoubleStreamBlock( + self.hidden_size, + self.num_heads, + mlp_ratio=params.mlp_ratio, + qkv_bias=params.qkv_bias, + dtype=dtype, device=device, operations=operations + ) + for _ in range(params.depth) + ] + ) + + self.single_blocks = nn.ModuleList( + [ + SingleStreamBlock(self.hidden_size, self.num_heads, mlp_ratio=params.mlp_ratio, dtype=dtype, device=device, operations=operations) + for _ in range(params.depth_single_blocks) + ] + ) + + if final_layer: + self.final_layer = LastLayer(self.hidden_size, 1, self.out_channels, dtype=dtype, device=device, operations=operations) + + self.skip_mmdit = [] + self.skip_dit = [] + self.lite = False + + def get_modulations(self, tensor: torch.Tensor, block_type: str, *, idx: int = 0): + # This function slices up the modulations tensor which has the following layout: + # single : num_single_blocks * 3 elements + # double_img : num_double_blocks * 6 elements + # double_txt : num_double_blocks * 6 elements + # final : 2 elements + if block_type == "final": + return (tensor[:, -2:-1, :], tensor[:, -1:, :]) + single_block_count = self.params.depth_single_blocks + double_block_count = self.params.depth + offset = 3 * idx + if block_type == "single": + return ChromaModulationOut.from_offset(tensor, offset) + # Double block modulations are 6 elements so we double 3 * idx. + offset *= 2 + if block_type in {"double_img", "double_txt"}: + # Advance past the single block modulations. + offset += 3 * single_block_count + if block_type == "double_txt": + # Advance past the double block img modulations. + offset += 6 * double_block_count + return ( + ChromaModulationOut.from_offset(tensor, offset), + ChromaModulationOut.from_offset(tensor, offset + 3), + ) + raise ValueError("Bad block_type") + + + def forward_orig( + self, + img: Tensor, + img_ids: Tensor, + txt: Tensor, + txt_ids: Tensor, + timesteps: Tensor, + guidance: Tensor = None, + control = None, + transformer_options={}, + attn_mask: Tensor = None, + ) -> Tensor: + patches_replace = transformer_options.get("patches_replace", {}) + if img.ndim != 3 or txt.ndim != 3: + raise ValueError("Input img and txt tensors must have 3 dimensions.") + + # running on sequences img + img = self.img_in(img) + + # distilled vector guidance + mod_index_length = 344 + distill_timestep = timestep_embedding(timesteps.detach().clone(), 16).to(img.device, img.dtype) + # guidance = guidance * + distil_guidance = timestep_embedding(guidance.detach().clone(), 16).to(img.device, img.dtype) + + # get all modulation index + modulation_index = timestep_embedding(torch.arange(mod_index_length), 32).to(img.device, img.dtype) + # we need to broadcast the modulation index here so each batch has all of the index + modulation_index = modulation_index.unsqueeze(0).repeat(img.shape[0], 1, 1).to(img.device, img.dtype) + # and we need to broadcast timestep and guidance along too + timestep_guidance = torch.cat([distill_timestep, distil_guidance], dim=1).unsqueeze(1).repeat(1, mod_index_length, 1).to(img.dtype).to(img.device, img.dtype) + # then and only then we could concatenate it together + input_vec = torch.cat([timestep_guidance, modulation_index], dim=-1).to(img.device, img.dtype) + + mod_vectors = self.distilled_guidance_layer(input_vec) + + txt = self.txt_in(txt) + + ids = torch.cat((txt_ids, img_ids), dim=1) + pe = self.pe_embedder(ids) + + blocks_replace = patches_replace.get("dit", {}) + for i, block in enumerate(self.double_blocks): + if i not in self.skip_mmdit: + double_mod = ( + self.get_modulations(mod_vectors, "double_img", idx=i), + self.get_modulations(mod_vectors, "double_txt", idx=i), + ) + if ("double_block", i) in blocks_replace: + def block_wrap(args): + out = {} + out["img"], out["txt"] = block(img=args["img"], + txt=args["txt"], + vec=args["vec"], + pe=args["pe"], + attn_mask=args.get("attn_mask")) + return out + + out = blocks_replace[("double_block", i)]({"img": img, + "txt": txt, + "vec": double_mod, + "pe": pe, + "attn_mask": attn_mask}, + {"original_block": block_wrap}) + txt = out["txt"] + img = out["img"] + else: + img, txt = block(img=img, + txt=txt, + vec=double_mod, + pe=pe, + attn_mask=attn_mask) + + if control is not None: # Controlnet + control_i = control.get("input") + if i < len(control_i): + add = control_i[i] + if add is not None: + img += add + + img = torch.cat((txt, img), 1) + + for i, block in enumerate(self.single_blocks): + if i not in self.skip_dit: + single_mod = self.get_modulations(mod_vectors, "single", idx=i) + if ("single_block", i) in blocks_replace: + def block_wrap(args): + out = {} + out["img"] = block(args["img"], + vec=args["vec"], + pe=args["pe"], + attn_mask=args.get("attn_mask")) + return out + + out = blocks_replace[("single_block", i)]({"img": img, + "vec": single_mod, + "pe": pe, + "attn_mask": attn_mask}, + {"original_block": block_wrap}) + img = out["img"] + else: + img = block(img, vec=single_mod, pe=pe, attn_mask=attn_mask) + + if control is not None: # Controlnet + control_o = control.get("output") + if i < len(control_o): + add = control_o[i] + if add is not None: + img[:, txt.shape[1] :, ...] += add + + img = img[:, txt.shape[1] :, ...] + final_mod = self.get_modulations(mod_vectors, "final") + img = self.final_layer(img, vec=final_mod) # (N, T, patch_size ** 2 * out_channels) + return img + + def forward(self, x, timestep, context, guidance, control=None, transformer_options={}, **kwargs): + bs, c, h, w = x.shape + patch_size = 2 + x = comfy.ldm.common_dit.pad_to_patch_size(x, (patch_size, patch_size)) + + img = rearrange(x, "b c (h ph) (w pw) -> b (h w) (c ph pw)", ph=patch_size, pw=patch_size) + + h_len = ((h + (patch_size // 2)) // patch_size) + w_len = ((w + (patch_size // 2)) // patch_size) + img_ids = torch.zeros((h_len, w_len, 3), device=x.device, dtype=x.dtype) + img_ids[:, :, 1] = img_ids[:, :, 1] + torch.linspace(0, h_len - 1, steps=h_len, device=x.device, dtype=x.dtype).unsqueeze(1) + img_ids[:, :, 2] = img_ids[:, :, 2] + torch.linspace(0, w_len - 1, steps=w_len, device=x.device, dtype=x.dtype).unsqueeze(0) + img_ids = repeat(img_ids, "h w c -> b (h w) c", b=bs) + + txt_ids = torch.zeros((bs, context.shape[1], 3), device=x.device, dtype=x.dtype) + out = self.forward_orig(img, img_ids, context, txt_ids, timestep, guidance, control, transformer_options, attn_mask=kwargs.get("attention_mask", None)) + return rearrange(out, "b (h w) (c ph pw) -> b c (h ph) (w pw)", h=h_len, w=w_len, ph=2, pw=2)[:,:,:h,:w] diff --git a/comfy/lora.py b/comfy/lora.py index fff524be2..dbabd3335 100644 --- a/comfy/lora.py +++ b/comfy/lora.py @@ -252,7 +252,7 @@ def model_lora_keys_unet(model, key_map={}): key_lora = k[len("diffusion_model."):-len(".weight")] key_map["base_model.model.{}".format(key_lora)] = k #official hunyuan lora format - if isinstance(model, comfy.model_base.Flux): #Diffusers lora Flux + if isinstance(model, comfy.model_base.Flux) or isinstance(model, comfy.model_base.Chroma): #Diffusers lora Flux or a diffusers lora Chroma diffusers_keys = comfy.utils.flux_to_diffusers(model.model_config.unet_config, output_prefix="diffusion_model.") for k in diffusers_keys: if k.endswith(".weight"): diff --git a/comfy/model_base.py b/comfy/model_base.py index d2aa4ce7a..1a06bb503 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -38,6 +38,7 @@ import comfy.ldm.lumina.model import comfy.ldm.wan.model import comfy.ldm.hunyuan3d.model import comfy.ldm.hidream.model +import comfy.ldm.chroma.model import comfy.model_management import comfy.patcher_extension @@ -1108,3 +1109,64 @@ class HiDream(BaseModel): if image_cond is not None: out['image_cond'] = comfy.conds.CONDNoiseShape(self.process_latent_in(image_cond)) return out + +class Chroma(BaseModel): + def __init__(self, model_config, model_type=ModelType.FLOW, device=None): + super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.chroma.model.Chroma) + + def concat_cond(self, **kwargs): + try: + #Handle Flux control loras dynamically changing the img_in weight. + num_channels = self.diffusion_model.img_in.weight.shape[1] + except: + #Some cases like tensorrt might not have the weights accessible + num_channels = self.model_config.unet_config["in_channels"] + + out_channels = self.model_config.unet_config["out_channels"] + + if num_channels <= out_channels: + return None + + image = kwargs.get("concat_latent_image", None) + noise = kwargs.get("noise", None) + device = kwargs["device"] + + if image is None: + image = torch.zeros_like(noise) + + image = utils.common_upscale(image.to(device), noise.shape[-1], noise.shape[-2], "bilinear", "center") + image = utils.resize_to_batch_size(image, noise.shape[0]) + image = self.process_latent_in(image) + if num_channels <= out_channels * 2: + return image + + #inpaint model + mask = kwargs.get("concat_mask", kwargs.get("denoise_mask", None)) + if mask is None: + mask = torch.ones_like(noise)[:, :1] + + mask = torch.mean(mask, dim=1, keepdim=True) + mask = utils.common_upscale(mask.to(device), noise.shape[-1] * 8, noise.shape[-2] * 8, "bilinear", "center") + mask = mask.view(mask.shape[0], mask.shape[2] // 8, 8, mask.shape[3] // 8, 8).permute(0, 2, 4, 1, 3).reshape(mask.shape[0], -1, mask.shape[2] // 8, mask.shape[3] // 8) + mask = utils.resize_to_batch_size(mask, noise.shape[0]) + return torch.cat((image, mask), dim=1) + + + def extra_conds(self, **kwargs): + out = super().extra_conds(**kwargs) + 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 + attention_mask = kwargs.get("attention_mask", None) + if attention_mask is not None: + shape = kwargs["noise"].shape + mask_ref_size = kwargs["attention_mask_img_shape"] + # the model will pad to the patch size, and then divide + # essentially dividing and rounding up + (h_tok, w_tok) = (math.ceil(shape[2] / self.diffusion_model.patch_size), math.ceil(shape[3] / self.diffusion_model.patch_size)) + attention_mask = utils.upscale_dit_mask(attention_mask, mask_ref_size, (h_tok, w_tok)) + out['attention_mask'] = comfy.conds.CONDRegular(attention_mask) + guidance = 0.0 + out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor((guidance,))) + return out diff --git a/comfy/model_detection.py b/comfy/model_detection.py index 76de78a8a..daf6d04e7 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -154,6 +154,32 @@ def detect_unet_config(state_dict, key_prefix, metadata=None): dit_config["guidance_embed"] = len(guidance_keys) > 0 return dit_config + if '{}distilled_guidance_layer.0.norms.0.scale'.format(key_prefix) in state_dict_keys or '{}distilled_guidance_layer.norms.0.scale'.format(key_prefix) in state_dict_keys: #Chroma + dit_config = {} + dit_config["image_model"] = "chroma" + dit_config["depth"] = 48 + dit_config["in_channels"] = 64 + patch_size = 2 + dit_config["patch_size"] = patch_size + in_key = "{}img_in.weight".format(key_prefix) + if in_key in state_dict_keys: + dit_config["in_channels"] = state_dict[in_key].shape[1] + dit_config["out_channels"] = 64 + dit_config["context_in_dim"] = 4096 + dit_config["hidden_size"] = 3072 + dit_config["mlp_ratio"] = 4.0 + dit_config["num_heads"] = 24 + dit_config["depth"] = count_blocks(state_dict_keys, '{}double_blocks.'.format(key_prefix) + '{}.') + dit_config["depth_single_blocks"] = count_blocks(state_dict_keys, '{}single_blocks.'.format(key_prefix) + '{}.') + dit_config["axes_dim"] = [16, 56, 56] + dit_config["theta"] = 10000 + dit_config["qkv_bias"] = True + dit_config["in_dim"] = 64 + dit_config["out_dim"] = 3072 + dit_config["hidden_dim"] = 5120 + dit_config["n_layers"] = 5 + return dit_config + if '{}double_blocks.0.img_attn.norm.key_norm.scale'.format(key_prefix) in state_dict_keys and '{}img_in.weight'.format(key_prefix) in state_dict_keys: #Flux dit_config = {} dit_config["image_model"] = "flux" diff --git a/comfy/sd.py b/comfy/sd.py index 748f6c1ec..454b5929a 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -42,6 +42,7 @@ import comfy.text_encoders.cosmos import comfy.text_encoders.lumina2 import comfy.text_encoders.wan import comfy.text_encoders.hidream +import comfy.text_encoders.chroma import comfy.model_patcher import comfy.lora @@ -714,6 +715,7 @@ class CLIPType(Enum): LUMINA2 = 12 WAN = 13 HIDREAM = 14 + CHROMA = 15 def load_clip(ckpt_paths, embedding_directory=None, clip_type=CLIPType.STABLE_DIFFUSION, model_options={}): @@ -829,6 +831,9 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip clip_target.clip = comfy.text_encoders.hidream.hidream_clip(**t5xxl_detect(clip_data), clip_l=False, clip_g=False, t5=True, llama=False, dtype_llama=None, llama_scaled_fp8=None) clip_target.tokenizer = comfy.text_encoders.hidream.HiDreamTokenizer + elif clip_type == CLIPType.CHROMA: + clip_target.clip = comfy.text_encoders.chroma.chroma_te(**t5xxl_detect(clip_data)) + clip_target.tokenizer = comfy.text_encoders.chroma.ChromaT5Tokenizer else: #CLIPType.MOCHI clip_target.clip = comfy.text_encoders.genmo.mochi_te(**t5xxl_detect(clip_data)) clip_target.tokenizer = comfy.text_encoders.genmo.MochiT5Tokenizer diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 69bcee1f7..f03f2790e 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -17,6 +17,7 @@ import comfy.text_encoders.hunyuan_video import comfy.text_encoders.cosmos import comfy.text_encoders.lumina2 import comfy.text_encoders.wan +import comfy.text_encoders.chroma from . import supported_models_base from . import latent_formats @@ -1068,7 +1069,34 @@ class HiDream(supported_models_base.BASE): def clip_target(self, state_dict={}): return None # TODO +class Chroma(supported_models_base.BASE): + unet_config = { + "image_model": "chroma", + } -models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, WAN21_FunControl2V, WAN21_Vace, Hunyuan3Dv2mini, Hunyuan3Dv2, HiDream] + unet_extra_config = { + } + + sampling_settings = { + "multiplier": 1.0, + } + + latent_format = comfy.latent_formats.Flux + + memory_usage_factor = 3.2 + + supported_inference_dtypes = [torch.bfloat16, torch.float16, torch.float32] + + + def get_model(self, state_dict, prefix="", device=None): + out = model_base.Chroma(self, device=device) + return out + + def clip_target(self, state_dict={}): + pref = self.text_encoder_key_prefix[0] + t5_detect = comfy.text_encoders.sd3_clip.t5_xxl_detect(state_dict, "{}t5xxl.transformer.".format(pref)) + return supported_models_base.ClipTarget(comfy.text_encoders.chroma.ChromaTokenizer, comfy.text_encoders.chroma.chroma_te(**t5_detect)) + +models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, WAN21_FunControl2V, WAN21_Vace, Hunyuan3Dv2mini, Hunyuan3Dv2, HiDream, Chroma] models += [SVD_img2vid] diff --git a/comfy/text_encoders/chroma.py b/comfy/text_encoders/chroma.py new file mode 100644 index 000000000..aa8dffb25 --- /dev/null +++ b/comfy/text_encoders/chroma.py @@ -0,0 +1,43 @@ +from comfy import sd1_clip +import comfy.text_encoders.t5 +import os +from transformers import T5TokenizerFast + + +class T5XXLModel(sd1_clip.SDClipModel): + def __init__(self, device="cpu", layer="last", layer_idx=None, dtype=None, attention_mask=False, model_options={}): + textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_config_xxl.json") + t5xxl_scaled_fp8 = model_options.get("t5xxl_scaled_fp8", None) + if t5xxl_scaled_fp8 is not None: + model_options = model_options.copy() + model_options["scaled_fp8"] = t5xxl_scaled_fp8 + + super().__init__(device=device, layer=layer, layer_idx=layer_idx, textmodel_json_config=textmodel_json_config, dtype=dtype, special_tokens={"end": 1, "pad": 0}, model_class=comfy.text_encoders.t5.T5, enable_attention_masks=attention_mask, return_attention_masks=attention_mask, model_options=model_options) + + +class ChromaT5XXL(sd1_clip.SD1ClipModel): + def __init__(self, device="cpu", dtype=None, model_options={}): + super().__init__(device=device, dtype=dtype, name="t5xxl", clip_model=T5XXLModel, model_options=model_options) + + +class T5XXLTokenizer(sd1_clip.SDTokenizer): + def __init__(self, embedding_directory=None, tokenizer_data={}): + tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_tokenizer") + super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=1, tokenizer_data=tokenizer_data) + + +class ChromaT5Tokenizer(sd1_clip.SD1Tokenizer): + def __init__(self, embedding_directory=None, tokenizer_data={}): + super().__init__(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data, clip_name="t5xxl", tokenizer=T5XXLTokenizer) + + +def chroma_te(dtype_t5=None, t5xxl_scaled_fp8=None): + class ChromaTEModel_(ChromaT5XXL): + def __init__(self, device="cpu", dtype=None, model_options={}): + if t5xxl_scaled_fp8 is not None and "t5xxl_scaled_fp8" not in model_options: + model_options = model_options.copy() + model_options["t5xxl_scaled_fp8"] = t5xxl_scaled_fp8 + if dtype is None: + dtype = dtype_t5 + super().__init__(device=device, dtype=dtype, model_options=model_options) + return ChromaTEModel_ diff --git a/comfy_extras/nodes_optimalsteps.py b/comfy_extras/nodes_optimalsteps.py index f6928199b..102958734 100644 --- a/comfy_extras/nodes_optimalsteps.py +++ b/comfy_extras/nodes_optimalsteps.py @@ -20,13 +20,14 @@ def loglinear_interp(t_steps, num_steps): NOISE_LEVELS = {"FLUX": [0.9968, 0.9886, 0.9819, 0.975, 0.966, 0.9471, 0.9158, 0.8287, 0.5512, 0.2808, 0.001], "Wan":[1.0, 0.997, 0.995, 0.993, 0.991, 0.989, 0.987, 0.985, 0.98, 0.975, 0.973, 0.968, 0.96, 0.946, 0.927, 0.902, 0.864, 0.776, 0.539, 0.208, 0.001], +"Chroma": [0.9919999837875366, 0.9900000095367432, 0.9879999756813049, 0.9850000143051147, 0.9819999933242798, 0.9779999852180481, 0.9729999899864197, 0.9679999947547913, 0.9610000252723694, 0.953000009059906, 0.9430000185966492, 0.9309999942779541, 0.9169999957084656, 0.8999999761581421, 0.8809999823570251, 0.8579999804496765, 0.8320000171661377, 0.8019999861717224, 0.7689999938011169, 0.7310000061988831, 0.6899999976158142, 0.6460000276565552, 0.5989999771118164, 0.550000011920929, 0.5009999871253967, 0.45100000500679016, 0.4020000100135803, 0.35499998927116394, 0.3109999895095825, 0.27000001072883606, 0.23199999332427979, 0.19900000095367432, 0.16899999976158142, 0.14300000667572021, 0.11999999731779099, 0.10100000351667404, 0.08399999886751175, 0.07000000029802322, 0.057999998331069946, 0.04800000041723251, 0.0], } class OptimalStepsScheduler: @classmethod def INPUT_TYPES(s): return {"required": - {"model_type": (["FLUX", "Wan"], ), + {"model_type": (["FLUX", "Wan", "Chroma"], ), "steps": ("INT", {"default": 20, "min": 3, "max": 1000}), "denoise": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}), } diff --git a/nodes.py b/nodes.py index 73a62d930..f2ced2c35 100644 --- a/nodes.py +++ b/nodes.py @@ -917,7 +917,7 @@ class CLIPLoader: @classmethod def INPUT_TYPES(s): return {"required": { "clip_name": (folder_paths.get_filename_list("text_encoders"), ), - "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart", "cosmos", "lumina2", "wan", "hidream"], ), + "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart", "cosmos", "lumina2", "wan", "hidream", "chroma"], ), }, "optional": { "device": (["default", "cpu"], {"advanced": True}), From 08ff5fa08a92e0b3f23b9abec979a830a6cffb03 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 30 Apr 2025 20:57:30 -0400 Subject: [PATCH 383/478] Cleanup chroma PR. --- comfy/ldm/chroma/layers.py | 2 +- comfy/ldm/chroma/math.py | 44 --------------------- comfy/lora.py | 2 +- comfy/model_base.py | 63 ++++-------------------------- comfy/model_detection.py | 41 ++++++------------- comfy/sd.py | 6 +-- comfy/supported_models.py | 3 +- comfy/text_encoders/chroma.py | 43 -------------------- comfy_extras/nodes_optimalsteps.py | 2 +- 9 files changed, 25 insertions(+), 181 deletions(-) delete mode 100644 comfy/ldm/chroma/math.py delete mode 100644 comfy/text_encoders/chroma.py diff --git a/comfy/ldm/chroma/layers.py b/comfy/ldm/chroma/layers.py index dd0b72f70..35da91ee2 100644 --- a/comfy/ldm/chroma/layers.py +++ b/comfy/ldm/chroma/layers.py @@ -1,7 +1,7 @@ import torch from torch import Tensor, nn -from .math import attention +from comfy.ldm.flux.math import attention from comfy.ldm.flux.layers import ( MLPEmbedder, RMSNorm, diff --git a/comfy/ldm/chroma/math.py b/comfy/ldm/chroma/math.py deleted file mode 100644 index 36b67931c..000000000 --- a/comfy/ldm/chroma/math.py +++ /dev/null @@ -1,44 +0,0 @@ -import torch -from einops import rearrange -from torch import Tensor - -from comfy.ldm.modules.attention import optimized_attention -import comfy.model_management - - -def attention(q: Tensor, k: Tensor, v: Tensor, pe: Tensor, mask=None) -> Tensor: - q_shape = q.shape - k_shape = k.shape - - q = q.float().reshape(*q.shape[:-1], -1, 1, 2) - k = k.float().reshape(*k.shape[:-1], -1, 1, 2) - q = (pe[..., 0] * q[..., 0] + pe[..., 1] * q[..., 1]).reshape(*q_shape).type_as(v) - k = (pe[..., 0] * k[..., 0] + pe[..., 1] * k[..., 1]).reshape(*k_shape).type_as(v) - - heads = q.shape[1] - x = optimized_attention(q, k, v, heads, skip_reshape=True, mask=mask) - return x - - -def rope(pos: Tensor, dim: int, theta: int) -> Tensor: - assert dim % 2 == 0 - if comfy.model_management.is_device_mps(pos.device) or comfy.model_management.is_intel_xpu() or comfy.model_management.is_directml_enabled(): - device = torch.device("cpu") - else: - device = pos.device - - scale = torch.linspace(0, (dim - 2) / dim, steps=dim//2, dtype=torch.float64, device=device) - omega = 1.0 / (theta**scale) - out = torch.einsum("...n,d->...nd", pos.to(dtype=torch.float32, device=device), omega) - out = torch.stack([torch.cos(out), -torch.sin(out), torch.sin(out), torch.cos(out)], dim=-1) - out = rearrange(out, "b n d (i j) -> b n d i j", i=2, j=2) - return out.to(dtype=torch.float32, device=pos.device) - - -def apply_rope(xq: Tensor, xk: Tensor, freqs_cis: Tensor): - xq_ = xq.float().reshape(*xq.shape[:-1], -1, 1, 2) - xk_ = xk.float().reshape(*xk.shape[:-1], -1, 1, 2) - xq_out = freqs_cis[..., 0] * xq_[..., 0] + freqs_cis[..., 1] * xq_[..., 1] - xk_out = freqs_cis[..., 0] * xk_[..., 0] + freqs_cis[..., 1] * xk_[..., 1] - return xq_out.reshape(*xq.shape).type_as(xq), xk_out.reshape(*xk.shape).type_as(xk) - diff --git a/comfy/lora.py b/comfy/lora.py index dbabd3335..fff524be2 100644 --- a/comfy/lora.py +++ b/comfy/lora.py @@ -252,7 +252,7 @@ def model_lora_keys_unet(model, key_map={}): key_lora = k[len("diffusion_model."):-len(".weight")] key_map["base_model.model.{}".format(key_lora)] = k #official hunyuan lora format - if isinstance(model, comfy.model_base.Flux) or isinstance(model, comfy.model_base.Chroma): #Diffusers lora Flux or a diffusers lora Chroma + if isinstance(model, comfy.model_base.Flux): #Diffusers lora Flux diffusers_keys = comfy.utils.flux_to_diffusers(model.model_config.unet_config, output_prefix="diffusion_model.") for k in diffusers_keys: if k.endswith(".weight"): diff --git a/comfy/model_base.py b/comfy/model_base.py index 1a06bb503..3d33086d8 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -787,8 +787,8 @@ class PixArt(BaseModel): return out class Flux(BaseModel): - def __init__(self, model_config, model_type=ModelType.FLUX, device=None): - super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.flux.model.Flux) + def __init__(self, model_config, model_type=ModelType.FLUX, device=None, unet_model=comfy.ldm.flux.model.Flux): + super().__init__(model_config, model_type, device=device, unet_model=unet_model) def concat_cond(self, **kwargs): try: @@ -1110,63 +1110,14 @@ class HiDream(BaseModel): out['image_cond'] = comfy.conds.CONDNoiseShape(self.process_latent_in(image_cond)) return out -class Chroma(BaseModel): +class Chroma(Flux): def __init__(self, model_config, model_type=ModelType.FLOW, device=None): super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.chroma.model.Chroma) - def concat_cond(self, **kwargs): - try: - #Handle Flux control loras dynamically changing the img_in weight. - num_channels = self.diffusion_model.img_in.weight.shape[1] - except: - #Some cases like tensorrt might not have the weights accessible - num_channels = self.model_config.unet_config["in_channels"] - - out_channels = self.model_config.unet_config["out_channels"] - - if num_channels <= out_channels: - return None - - image = kwargs.get("concat_latent_image", None) - noise = kwargs.get("noise", None) - device = kwargs["device"] - - if image is None: - image = torch.zeros_like(noise) - - image = utils.common_upscale(image.to(device), noise.shape[-1], noise.shape[-2], "bilinear", "center") - image = utils.resize_to_batch_size(image, noise.shape[0]) - image = self.process_latent_in(image) - if num_channels <= out_channels * 2: - return image - - #inpaint model - mask = kwargs.get("concat_mask", kwargs.get("denoise_mask", None)) - if mask is None: - mask = torch.ones_like(noise)[:, :1] - - mask = torch.mean(mask, dim=1, keepdim=True) - mask = utils.common_upscale(mask.to(device), noise.shape[-1] * 8, noise.shape[-2] * 8, "bilinear", "center") - mask = mask.view(mask.shape[0], mask.shape[2] // 8, 8, mask.shape[3] // 8, 8).permute(0, 2, 4, 1, 3).reshape(mask.shape[0], -1, mask.shape[2] // 8, mask.shape[3] // 8) - mask = utils.resize_to_batch_size(mask, noise.shape[0]) - return torch.cat((image, mask), dim=1) - - def extra_conds(self, **kwargs): out = super().extra_conds(**kwargs) - 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 - attention_mask = kwargs.get("attention_mask", None) - if attention_mask is not None: - shape = kwargs["noise"].shape - mask_ref_size = kwargs["attention_mask_img_shape"] - # the model will pad to the patch size, and then divide - # essentially dividing and rounding up - (h_tok, w_tok) = (math.ceil(shape[2] / self.diffusion_model.patch_size), math.ceil(shape[3] / self.diffusion_model.patch_size)) - attention_mask = utils.upscale_dit_mask(attention_mask, mask_ref_size, (h_tok, w_tok)) - out['attention_mask'] = comfy.conds.CONDRegular(attention_mask) - guidance = 0.0 - out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor((guidance,))) + + guidance = kwargs.get("guidance", 0) + if guidance is not None: + out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor([guidance])) return out diff --git a/comfy/model_detection.py b/comfy/model_detection.py index daf6d04e7..9254843ea 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -154,32 +154,6 @@ def detect_unet_config(state_dict, key_prefix, metadata=None): dit_config["guidance_embed"] = len(guidance_keys) > 0 return dit_config - if '{}distilled_guidance_layer.0.norms.0.scale'.format(key_prefix) in state_dict_keys or '{}distilled_guidance_layer.norms.0.scale'.format(key_prefix) in state_dict_keys: #Chroma - dit_config = {} - dit_config["image_model"] = "chroma" - dit_config["depth"] = 48 - dit_config["in_channels"] = 64 - patch_size = 2 - dit_config["patch_size"] = patch_size - in_key = "{}img_in.weight".format(key_prefix) - if in_key in state_dict_keys: - dit_config["in_channels"] = state_dict[in_key].shape[1] - dit_config["out_channels"] = 64 - dit_config["context_in_dim"] = 4096 - dit_config["hidden_size"] = 3072 - dit_config["mlp_ratio"] = 4.0 - dit_config["num_heads"] = 24 - dit_config["depth"] = count_blocks(state_dict_keys, '{}double_blocks.'.format(key_prefix) + '{}.') - dit_config["depth_single_blocks"] = count_blocks(state_dict_keys, '{}single_blocks.'.format(key_prefix) + '{}.') - dit_config["axes_dim"] = [16, 56, 56] - dit_config["theta"] = 10000 - dit_config["qkv_bias"] = True - dit_config["in_dim"] = 64 - dit_config["out_dim"] = 3072 - dit_config["hidden_dim"] = 5120 - dit_config["n_layers"] = 5 - return dit_config - if '{}double_blocks.0.img_attn.norm.key_norm.scale'.format(key_prefix) in state_dict_keys and '{}img_in.weight'.format(key_prefix) in state_dict_keys: #Flux dit_config = {} dit_config["image_model"] = "flux" @@ -190,7 +164,9 @@ def detect_unet_config(state_dict, key_prefix, metadata=None): if in_key in state_dict_keys: dit_config["in_channels"] = state_dict[in_key].shape[1] // (patch_size * patch_size) dit_config["out_channels"] = 16 - dit_config["vec_in_dim"] = 768 + vec_in_key = '{}vector_in.in_layer.weight'.format(key_prefix) + if vec_in_key in state_dict_keys: + dit_config["vec_in_dim"] = state_dict[vec_in_key].shape[1] dit_config["context_in_dim"] = 4096 dit_config["hidden_size"] = 3072 dit_config["mlp_ratio"] = 4.0 @@ -200,7 +176,16 @@ def detect_unet_config(state_dict, key_prefix, metadata=None): dit_config["axes_dim"] = [16, 56, 56] dit_config["theta"] = 10000 dit_config["qkv_bias"] = True - dit_config["guidance_embed"] = "{}guidance_in.in_layer.weight".format(key_prefix) in state_dict_keys + if '{}distilled_guidance_layer.0.norms.0.scale'.format(key_prefix) in state_dict_keys or '{}distilled_guidance_layer.norms.0.scale'.format(key_prefix) in state_dict_keys: #Chroma + dit_config["image_model"] = "chroma" + dit_config["in_channels"] = 64 + dit_config["out_channels"] = 64 + dit_config["in_dim"] = 64 + dit_config["out_dim"] = 3072 + dit_config["hidden_dim"] = 5120 + dit_config["n_layers"] = 5 + else: + dit_config["guidance_embed"] = "{}guidance_in.in_layer.weight".format(key_prefix) in state_dict_keys return dit_config if '{}t5_yproj.weight'.format(key_prefix) in state_dict_keys: #Genmo mochi preview diff --git a/comfy/sd.py b/comfy/sd.py index 454b5929a..da9b36d0e 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -42,7 +42,6 @@ import comfy.text_encoders.cosmos import comfy.text_encoders.lumina2 import comfy.text_encoders.wan import comfy.text_encoders.hidream -import comfy.text_encoders.chroma import comfy.model_patcher import comfy.lora @@ -820,7 +819,7 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip elif clip_type == CLIPType.LTXV: clip_target.clip = comfy.text_encoders.lt.ltxv_te(**t5xxl_detect(clip_data)) clip_target.tokenizer = comfy.text_encoders.lt.LTXVT5Tokenizer - elif clip_type == CLIPType.PIXART: + elif clip_type == CLIPType.PIXART or clip_type == CLIPType.CHROMA: clip_target.clip = comfy.text_encoders.pixart_t5.pixart_te(**t5xxl_detect(clip_data)) clip_target.tokenizer = comfy.text_encoders.pixart_t5.PixArtTokenizer elif clip_type == CLIPType.WAN: @@ -831,9 +830,6 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip clip_target.clip = comfy.text_encoders.hidream.hidream_clip(**t5xxl_detect(clip_data), clip_l=False, clip_g=False, t5=True, llama=False, dtype_llama=None, llama_scaled_fp8=None) clip_target.tokenizer = comfy.text_encoders.hidream.HiDreamTokenizer - elif clip_type == CLIPType.CHROMA: - clip_target.clip = comfy.text_encoders.chroma.chroma_te(**t5xxl_detect(clip_data)) - clip_target.tokenizer = comfy.text_encoders.chroma.ChromaT5Tokenizer else: #CLIPType.MOCHI clip_target.clip = comfy.text_encoders.genmo.mochi_te(**t5xxl_detect(clip_data)) clip_target.tokenizer = comfy.text_encoders.genmo.MochiT5Tokenizer diff --git a/comfy/supported_models.py b/comfy/supported_models.py index f03f2790e..d5210cfac 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -17,7 +17,6 @@ import comfy.text_encoders.hunyuan_video import comfy.text_encoders.cosmos import comfy.text_encoders.lumina2 import comfy.text_encoders.wan -import comfy.text_encoders.chroma from . import supported_models_base from . import latent_formats @@ -1095,7 +1094,7 @@ class Chroma(supported_models_base.BASE): def clip_target(self, state_dict={}): pref = self.text_encoder_key_prefix[0] t5_detect = comfy.text_encoders.sd3_clip.t5_xxl_detect(state_dict, "{}t5xxl.transformer.".format(pref)) - return supported_models_base.ClipTarget(comfy.text_encoders.chroma.ChromaTokenizer, comfy.text_encoders.chroma.chroma_te(**t5_detect)) + return supported_models_base.ClipTarget(comfy.text_encoders.pixart_t5.PixArtTokenizer, comfy.text_encoders.pixart_t5.pixart_te(**t5_detect)) models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, WAN21_FunControl2V, WAN21_Vace, Hunyuan3Dv2mini, Hunyuan3Dv2, HiDream, Chroma] diff --git a/comfy/text_encoders/chroma.py b/comfy/text_encoders/chroma.py deleted file mode 100644 index aa8dffb25..000000000 --- a/comfy/text_encoders/chroma.py +++ /dev/null @@ -1,43 +0,0 @@ -from comfy import sd1_clip -import comfy.text_encoders.t5 -import os -from transformers import T5TokenizerFast - - -class T5XXLModel(sd1_clip.SDClipModel): - def __init__(self, device="cpu", layer="last", layer_idx=None, dtype=None, attention_mask=False, model_options={}): - textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_config_xxl.json") - t5xxl_scaled_fp8 = model_options.get("t5xxl_scaled_fp8", None) - if t5xxl_scaled_fp8 is not None: - model_options = model_options.copy() - model_options["scaled_fp8"] = t5xxl_scaled_fp8 - - super().__init__(device=device, layer=layer, layer_idx=layer_idx, textmodel_json_config=textmodel_json_config, dtype=dtype, special_tokens={"end": 1, "pad": 0}, model_class=comfy.text_encoders.t5.T5, enable_attention_masks=attention_mask, return_attention_masks=attention_mask, model_options=model_options) - - -class ChromaT5XXL(sd1_clip.SD1ClipModel): - def __init__(self, device="cpu", dtype=None, model_options={}): - super().__init__(device=device, dtype=dtype, name="t5xxl", clip_model=T5XXLModel, model_options=model_options) - - -class T5XXLTokenizer(sd1_clip.SDTokenizer): - def __init__(self, embedding_directory=None, tokenizer_data={}): - tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "t5_tokenizer") - super().__init__(tokenizer_path, embedding_directory=embedding_directory, pad_with_end=False, embedding_size=4096, embedding_key='t5xxl', tokenizer_class=T5TokenizerFast, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=1, tokenizer_data=tokenizer_data) - - -class ChromaT5Tokenizer(sd1_clip.SD1Tokenizer): - def __init__(self, embedding_directory=None, tokenizer_data={}): - super().__init__(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data, clip_name="t5xxl", tokenizer=T5XXLTokenizer) - - -def chroma_te(dtype_t5=None, t5xxl_scaled_fp8=None): - class ChromaTEModel_(ChromaT5XXL): - def __init__(self, device="cpu", dtype=None, model_options={}): - if t5xxl_scaled_fp8 is not None and "t5xxl_scaled_fp8" not in model_options: - model_options = model_options.copy() - model_options["t5xxl_scaled_fp8"] = t5xxl_scaled_fp8 - if dtype is None: - dtype = dtype_t5 - super().__init__(device=device, dtype=dtype, model_options=model_options) - return ChromaTEModel_ diff --git a/comfy_extras/nodes_optimalsteps.py b/comfy_extras/nodes_optimalsteps.py index 102958734..e7c851ca2 100644 --- a/comfy_extras/nodes_optimalsteps.py +++ b/comfy_extras/nodes_optimalsteps.py @@ -20,7 +20,7 @@ def loglinear_interp(t_steps, num_steps): NOISE_LEVELS = {"FLUX": [0.9968, 0.9886, 0.9819, 0.975, 0.966, 0.9471, 0.9158, 0.8287, 0.5512, 0.2808, 0.001], "Wan":[1.0, 0.997, 0.995, 0.993, 0.991, 0.989, 0.987, 0.985, 0.98, 0.975, 0.973, 0.968, 0.96, 0.946, 0.927, 0.902, 0.864, 0.776, 0.539, 0.208, 0.001], -"Chroma": [0.9919999837875366, 0.9900000095367432, 0.9879999756813049, 0.9850000143051147, 0.9819999933242798, 0.9779999852180481, 0.9729999899864197, 0.9679999947547913, 0.9610000252723694, 0.953000009059906, 0.9430000185966492, 0.9309999942779541, 0.9169999957084656, 0.8999999761581421, 0.8809999823570251, 0.8579999804496765, 0.8320000171661377, 0.8019999861717224, 0.7689999938011169, 0.7310000061988831, 0.6899999976158142, 0.6460000276565552, 0.5989999771118164, 0.550000011920929, 0.5009999871253967, 0.45100000500679016, 0.4020000100135803, 0.35499998927116394, 0.3109999895095825, 0.27000001072883606, 0.23199999332427979, 0.19900000095367432, 0.16899999976158142, 0.14300000667572021, 0.11999999731779099, 0.10100000351667404, 0.08399999886751175, 0.07000000029802322, 0.057999998331069946, 0.04800000041723251, 0.0], +"Chroma": [0.992, 0.99, 0.988, 0.985, 0.982, 0.978, 0.973, 0.968, 0.961, 0.953, 0.943, 0.931, 0.917, 0.9, 0.881, 0.858, 0.832, 0.802, 0.769, 0.731, 0.69, 0.646, 0.599, 0.55, 0.501, 0.451, 0.402, 0.355, 0.311, 0.27, 0.232, 0.199, 0.169, 0.143, 0.12, 0.101, 0.084, 0.07, 0.058, 0.048, 0.001], } class OptimalStepsScheduler: From c6c19e99803a2538cee17e2f94314f77b7d48e98 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Thu, 1 May 2025 00:24:32 -0700 Subject: [PATCH 384/478] fix bug (#7894) --- comfy_api_nodes/apis/client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/comfy_api_nodes/apis/client.py b/comfy_api_nodes/apis/client.py index 384e559dc..d3cd9ad2f 100644 --- a/comfy_api_nodes/apis/client.py +++ b/comfy_api_nodes/apis/client.py @@ -297,6 +297,10 @@ class SynchronousOperation(Generic[T, R]): # Convert request model to dict, but use None for EmptyRequest request_dict = None if isinstance(self.request, EmptyRequest) else self.request.model_dump(exclude_none=True) + if request_dict: + for key, value in request_dict.items(): + if isinstance(value, Enum): + request_dict[key] = value.value # Debug log for request logging.debug(f"[DEBUG] API Request: {self.endpoint.method.value} {self.endpoint.path}") From aa9d759df36faa2e34cc5722463749a09a7f529b Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Thu, 1 May 2025 03:33:42 -0700 Subject: [PATCH 385/478] Switch ltxv to use the pytorch RMSNorm. (#7897) --- comfy/ldm/lightricks/model.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/comfy/ldm/lightricks/model.py b/comfy/ldm/lightricks/model.py index 6e8e06181..056e101a4 100644 --- a/comfy/ldm/lightricks/model.py +++ b/comfy/ldm/lightricks/model.py @@ -1,7 +1,6 @@ import torch from torch import nn import comfy.ldm.modules.attention -from comfy.ldm.genmo.joint_model.layers import RMSNorm import comfy.ldm.common_dit from einops import rearrange import math @@ -262,8 +261,8 @@ class CrossAttention(nn.Module): self.heads = heads self.dim_head = dim_head - self.q_norm = RMSNorm(inner_dim, dtype=dtype, device=device) - self.k_norm = RMSNorm(inner_dim, dtype=dtype, device=device) + self.q_norm = operations.RMSNorm(inner_dim, dtype=dtype, device=device) + self.k_norm = operations.RMSNorm(inner_dim, dtype=dtype, device=device) self.to_q = operations.Linear(query_dim, inner_dim, bias=True, dtype=dtype, device=device) self.to_k = operations.Linear(context_dim, inner_dim, bias=True, dtype=dtype, device=device) From 6d32dc049e676a1373dddc4fd912f2ba1311d4cb Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Thu, 1 May 2025 10:57:54 -0400 Subject: [PATCH 386/478] Update frontend to v1.18 (#7898) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f64a05947..74a4ceb02 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.17.11 +comfyui-frontend-package==1.18.5 comfyui-workflow-templates==0.1.3 torch torchsde From 8d0661d0ba35fd54a72e4b49f68d4625febafc10 Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Thu, 1 May 2025 19:32:04 -0400 Subject: [PATCH 387/478] Lint instance methods (#7903) --- comfy_extras/nodes_post_processing.py | 1 + comfy_extras/nodes_webcam.py | 2 +- pyproject.toml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/comfy_extras/nodes_post_processing.py b/comfy_extras/nodes_post_processing.py index 5b9542015..cb1a0d883 100644 --- a/comfy_extras/nodes_post_processing.py +++ b/comfy_extras/nodes_post_processing.py @@ -141,6 +141,7 @@ class Quantize: CATEGORY = "image/postprocessing" + @staticmethod def bayer(im, pal_im, order): def normalized_bayer_matrix(n): if n == 0: diff --git a/comfy_extras/nodes_webcam.py b/comfy_extras/nodes_webcam.py index 31eddb2d6..062b15cf8 100644 --- a/comfy_extras/nodes_webcam.py +++ b/comfy_extras/nodes_webcam.py @@ -20,7 +20,7 @@ class WebcamCapture(nodes.LoadImage): CATEGORY = "image" - def load_capture(s, image, **kwargs): + def load_capture(self, image, **kwargs): return super().load_image(folder_paths.get_annotated_filepath(image)) diff --git a/pyproject.toml b/pyproject.toml index eadca662e..a9c028c7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,7 @@ documentation = "https://docs.comfy.org/" [tool.ruff] lint.select = [ + "N805", # invalid-first-argument-name-for-method "S307", # suspicious-eval-usage "S102", # exec "T", # print-usage From ff99861650a195234f2858b864663920ca811c55 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Fri, 2 May 2025 02:15:32 -0700 Subject: [PATCH 388/478] Make clipsave work with more TE models. (#7908) --- comfy_extras/nodes_model_merging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy_extras/nodes_model_merging.py b/comfy_extras/nodes_model_merging.py index 78d284889..f20beab7d 100644 --- a/comfy_extras/nodes_model_merging.py +++ b/comfy_extras/nodes_model_merging.py @@ -276,7 +276,7 @@ class CLIPSave: comfy.model_management.load_models_gpu([clip.load_model()], force_patch_weights=True) clip_sd = clip.get_sd() - for prefix in ["clip_l.", "clip_g.", ""]: + for prefix in ["clip_l.", "clip_g.", "clip_h.", "t5xxl.", "pile_t5xl.", "mt5xl.", "umt5xxl.", "t5base.", "gemma2_2b.", "llama.", "hydit_clip.", ""]: k = list(filter(lambda a: a.startswith(prefix), clip_sd.keys())) current_clip_sd = {} for x in k: From 551fe8dceebb07abed486580d8326a6202d0cf7a Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Fri, 2 May 2025 05:28:05 -0400 Subject: [PATCH 389/478] Add node to extend sigmas (#7901) * Add ExpandSigmas node * Rename, add interpolation functions Co-authored-by: liesen * Move computed interpolation outside loop * Add type hints --------- Co-authored-by: liesen --- comfy_extras/nodes_custom_sampler.py | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/comfy_extras/nodes_custom_sampler.py b/comfy_extras/nodes_custom_sampler.py index c9689b745..3e5be3d3c 100644 --- a/comfy_extras/nodes_custom_sampler.py +++ b/comfy_extras/nodes_custom_sampler.py @@ -1,3 +1,4 @@ +import math import comfy.samplers import comfy.sample from comfy.k_diffusion import sampling as k_diffusion_sampling @@ -249,6 +250,55 @@ class SetFirstSigma: sigmas[0] = sigma return (sigmas, ) +class ExtendIntermediateSigmas: + @classmethod + def INPUT_TYPES(s): + return {"required": + {"sigmas": ("SIGMAS", ), + "steps": ("INT", {"default": 2, "min": 1, "max": 100}), + "start_at_sigma": ("FLOAT", {"default": -1.0, "min": -1.0, "max": 20000.0, "step": 0.01, "round": False}), + "end_at_sigma": ("FLOAT", {"default": 12.0, "min": 0.0, "max": 20000.0, "step": 0.01, "round": False}), + "spacing": (['linear', 'cosine', 'sine'],), + } + } + RETURN_TYPES = ("SIGMAS",) + CATEGORY = "sampling/custom_sampling/sigmas" + + FUNCTION = "extend" + + def extend(self, sigmas: torch.Tensor, steps: int, start_at_sigma: float, end_at_sigma: float, spacing: str): + if start_at_sigma < 0: + start_at_sigma = float("inf") + + interpolator = { + 'linear': lambda x: x, + 'cosine': lambda x: torch.sin(x*math.pi/2), + 'sine': lambda x: 1 - torch.cos(x*math.pi/2) + }[spacing] + + # linear space for our interpolation function + x = torch.linspace(0, 1, steps + 1, device=sigmas.device)[1:-1] + computed_spacing = interpolator(x) + + extended_sigmas = [] + for i in range(len(sigmas) - 1): + sigma_current = sigmas[i] + sigma_next = sigmas[i+1] + + extended_sigmas.append(sigma_current) + + if end_at_sigma <= sigma_current <= start_at_sigma: + interpolated_steps = computed_spacing * (sigma_next - sigma_current) + sigma_current + extended_sigmas.extend(interpolated_steps.tolist()) + + # Add the last sigma value + if len(sigmas) > 0: + extended_sigmas.append(sigmas[-1]) + + extended_sigmas = torch.FloatTensor(extended_sigmas) + + return (extended_sigmas,) + class KSamplerSelect: @classmethod def INPUT_TYPES(s): @@ -735,6 +785,7 @@ NODE_CLASS_MAPPINGS = { "SplitSigmasDenoise": SplitSigmasDenoise, "FlipSigmas": FlipSigmas, "SetFirstSigma": SetFirstSigma, + "ExtendIntermediateSigmas": ExtendIntermediateSigmas, "CFGGuider": CFGGuider, "DualCFGGuider": DualCFGGuider, From d9a87c1e6a390eb0e915b544e35baf4d807919db Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Fri, 2 May 2025 05:28:27 -0400 Subject: [PATCH 390/478] Fix outdated comment about Internet connectivity (#7827) --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index f3f56597a..5c21542b3 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,7 @@ import logging import sys if __name__ == "__main__": - #NOTE: These do not do anything on core ComfyUI which should already have no communication with the internet, they are for custom nodes. + #NOTE: These do not do anything on core ComfyUI, they are for custom nodes. os.environ['HF_HUB_DISABLE_TELEMETRY'] = '1' os.environ['DO_NOT_TRACK'] = '1' From 2ab9618732b738b52c96ae128597371b9b9fff96 Mon Sep 17 00:00:00 2001 From: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> Date: Sat, 3 May 2025 01:12:37 +0800 Subject: [PATCH 391/478] Fix the bugs in OFT/BOFT moule (#7909) * Correct calculate_weight and load for OFT * Correct calculate_weight and loading for BOFT --- comfy/weight_adapter/boft.py | 34 +++++++++++++++++----------------- comfy/weight_adapter/oft.py | 20 +++++++++++--------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/comfy/weight_adapter/boft.py b/comfy/weight_adapter/boft.py index c85adc7ab..b2a2f1bd4 100644 --- a/comfy/weight_adapter/boft.py +++ b/comfy/weight_adapter/boft.py @@ -24,7 +24,7 @@ class BOFTAdapter(WeightAdapterBase): ) -> Optional["BOFTAdapter"]: if loaded_keys is None: loaded_keys = set() - blocks_name = "{}.boft_blocks".format(x) + blocks_name = "{}.oft_blocks".format(x) rescale_name = "{}.rescale".format(x) blocks = None @@ -32,17 +32,18 @@ class BOFTAdapter(WeightAdapterBase): blocks = lora[blocks_name] if blocks.ndim == 4: loaded_keys.add(blocks_name) + else: + blocks = None + if blocks is None: + return None rescale = None if rescale_name in lora.keys(): rescale = lora[rescale_name] loaded_keys.add(rescale_name) - if blocks is not None: - weights = (blocks, rescale, alpha, dora_scale) - return cls(loaded_keys, weights) - else: - return None + weights = (blocks, rescale, alpha, dora_scale) + return cls(loaded_keys, weights) def calculate_weight( self, @@ -71,7 +72,7 @@ class BOFTAdapter(WeightAdapterBase): # Get r I = torch.eye(boft_b, device=blocks.device, dtype=blocks.dtype) # for Q = -Q^T - q = blocks - blocks.transpose(1, 2) + q = blocks - blocks.transpose(-1, -2) normed_q = q if alpha > 0: # alpha in boft/bboft is for constraint q_norm = torch.norm(q) + 1e-8 @@ -79,9 +80,8 @@ class BOFTAdapter(WeightAdapterBase): normed_q = q * alpha / q_norm # use float() to prevent unsupported type in .inverse() r = (I + normed_q) @ (I - normed_q).float().inverse() - r = r.to(original_weight) - - inp = org = original_weight + r = r.to(weight) + inp = org = weight r_b = boft_b//2 for i in range(boft_m): @@ -91,14 +91,14 @@ class BOFTAdapter(WeightAdapterBase): if strength != 1: bi = bi * strength + (1-strength) * I inp = ( - inp.unflatten(-1, (-1, g, k)) - .transpose(-2, -1) - .flatten(-3) - .unflatten(-1, (-1, boft_b)) + inp.unflatten(0, (-1, g, k)) + .transpose(1, 2) + .flatten(0, 2) + .unflatten(0, (-1, boft_b)) ) - inp = torch.einsum("b n m, b n ... -> b m ...", inp, bi) + inp = torch.einsum("b i j, b j ...-> b i ...", bi, inp) inp = ( - inp.flatten(-2).unflatten(-1, (-1, k, g)).transpose(-2, -1).flatten(-3) + inp.flatten(0, 1).unflatten(0, (-1, k, g)).transpose(1, 2).flatten(0, 2) ) if rescale is not None: @@ -109,7 +109,7 @@ class BOFTAdapter(WeightAdapterBase): if dora_scale is not None: weight = weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediate_dtype, function) else: - weight += function(((strength * alpha) * lora_diff).type(weight.dtype)) + weight += function((strength * lora_diff).type(weight.dtype)) except Exception as e: logging.error("ERROR {} {} {}".format(self.name, key, e)) return weight diff --git a/comfy/weight_adapter/oft.py b/comfy/weight_adapter/oft.py index 0ea229b79..25009eca3 100644 --- a/comfy/weight_adapter/oft.py +++ b/comfy/weight_adapter/oft.py @@ -32,17 +32,18 @@ class OFTAdapter(WeightAdapterBase): blocks = lora[blocks_name] if blocks.ndim == 3: loaded_keys.add(blocks_name) + else: + blocks = None + if blocks is None: + return None rescale = None if rescale_name in lora.keys(): rescale = lora[rescale_name] loaded_keys.add(rescale_name) - if blocks is not None: - weights = (blocks, rescale, alpha, dora_scale) - return cls(loaded_keys, weights) - else: - return None + weights = (blocks, rescale, alpha, dora_scale) + return cls(loaded_keys, weights) def calculate_weight( self, @@ -79,16 +80,17 @@ class OFTAdapter(WeightAdapterBase): normed_q = q * alpha / q_norm # use float() to prevent unsupported type in .inverse() r = (I + normed_q) @ (I - normed_q).float().inverse() - r = r.to(original_weight) + r = r.to(weight) + _, *shape = weight.shape lora_diff = torch.einsum( "k n m, k n ... -> k m ...", (r * strength) - strength * I, - original_weight, - ) + weight.view(block_num, block_size, *shape), + ).view(-1, *shape) if dora_scale is not None: weight = weight_decompose(dora_scale, weight, lora_diff, alpha, strength, intermediate_dtype, function) else: - weight += function(((strength * alpha) * lora_diff).type(weight.dtype)) + weight += function((strength * lora_diff).type(weight.dtype)) except Exception as e: logging.error("ERROR {} {} {}".format(self.name, key, e)) return weight From 530494588d9e58a8bcaf55b471f4c3ce2b97ce65 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 2 May 2025 13:14:52 -0400 Subject: [PATCH 392/478] [BugFix] Update frontend 1.18.6 (#7910) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 74a4ceb02..05ceba00a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.18.5 +comfyui-frontend-package==1.18.6 comfyui-workflow-templates==0.1.3 torch torchsde From 065d855f14968406051a1340e3f2f26461a00e5d Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Fri, 2 May 2025 13:15:54 -0400 Subject: [PATCH 393/478] upstream Preview Any from rgthree-comfy (#7815) * upstream Preview Any from rgthree-comfy * use IO.ANY --- comfy_extras/nodes_preview_any.py | 43 +++++++++++++++++++++++++++++++ nodes.py | 1 + 2 files changed, 44 insertions(+) create mode 100644 comfy_extras/nodes_preview_any.py diff --git a/comfy_extras/nodes_preview_any.py b/comfy_extras/nodes_preview_any.py new file mode 100644 index 000000000..e6805696f --- /dev/null +++ b/comfy_extras/nodes_preview_any.py @@ -0,0 +1,43 @@ +import json +from comfy.comfy_types.node_typing import IO + +# Preview Any - original implement from +# https://github.com/rgthree/rgthree-comfy/blob/main/py/display_any.py +# upstream requested in https://github.com/Kosinkadink/rfcs/blob/main/rfcs/0000-corenodes.md#preview-nodes +class PreviewAny(): + @classmethod + def INPUT_TYPES(cls): + return { + "required": {"source": (IO.ANY, {})}, + } + + RETURN_TYPES = () + FUNCTION = "main" + OUTPUT_NODE = True + + CATEGORY = "utils" + + def main(self, source=None): + value = 'None' + if isinstance(source, str): + value = source + elif isinstance(source, (int, float, bool)): + value = str(source) + elif source is not None: + try: + value = json.dumps(source) + except Exception: + try: + value = str(source) + except Exception: + value = 'source exists, but could not be serialized.' + + return {"ui": {"text": (value,)}} + +NODE_CLASS_MAPPINGS = { + "PreviewAny": PreviewAny, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "PreviewAny": "Preview Any", +} diff --git a/nodes.py b/nodes.py index f2ced2c35..92b8ca6ae 100644 --- a/nodes.py +++ b/nodes.py @@ -2258,6 +2258,7 @@ def init_builtin_extra_nodes(): "nodes_optimalsteps.py", "nodes_hidream.py", "nodes_fresca.py", + "nodes_preview_any.py", ] api_nodes_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_api_nodes") From 486ad8fdc55495a705a211c22cc50bec9ec95643 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Fri, 2 May 2025 21:28:10 -0700 Subject: [PATCH 394/478] Fix updater issue with newer portable. (#7917) --- .ci/update_windows/update.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.ci/update_windows/update.py b/.ci/update_windows/update.py index 731b6bc53..51a263203 100755 --- a/.ci/update_windows/update.py +++ b/.ci/update_windows/update.py @@ -63,7 +63,12 @@ except: print("checking out master branch") # noqa: T201 branch = repo.lookup_branch('master') if branch is None: - ref = repo.lookup_reference('refs/remotes/origin/master') + try: + ref = repo.lookup_reference('refs/remotes/origin/master') + except: + print("pulling.") # noqa: T201 + pull(repo) + ref = repo.lookup_reference('refs/remotes/origin/master') repo.checkout(ref) branch = repo.lookup_branch('master') if branch is None: From 7689917113fe521adfaba2a4fff952ef1805ad2b Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 3 May 2025 00:34:01 -0400 Subject: [PATCH 395/478] ComfyUI version 0.3.31 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 67d27f942..8d2068de7 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.30" +__version__ = "0.3.31" diff --git a/pyproject.toml b/pyproject.toml index a9c028c7e..8b549a0b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.30" +version = "0.3.31" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 3041e5c354511ad8e4a6fe73ed397e41845caae2 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sat, 3 May 2025 16:07:55 -0700 Subject: [PATCH 396/478] Switch mochi and wan modes to use pytorch RMSNorm. (#7925) * Switch genmo model to native RMSNorm. * Switch WAN to native RMSNorm. --- comfy/ldm/genmo/joint_model/asymm_models_joint.py | 9 ++++----- comfy/ldm/genmo/joint_model/layers.py | 11 ----------- comfy/ldm/wan/model.py | 7 +++---- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/comfy/ldm/genmo/joint_model/asymm_models_joint.py b/comfy/ldm/genmo/joint_model/asymm_models_joint.py index 2c46c24bf..366a8b713 100644 --- a/comfy/ldm/genmo/joint_model/asymm_models_joint.py +++ b/comfy/ldm/genmo/joint_model/asymm_models_joint.py @@ -13,7 +13,6 @@ from comfy.ldm.modules.attention import optimized_attention from .layers import ( FeedForward, PatchEmbed, - RMSNorm, TimestepEmbedder, ) @@ -90,10 +89,10 @@ class AsymmetricAttention(nn.Module): # Query and key normalization for stability. assert qk_norm - self.q_norm_x = RMSNorm(self.head_dim, device=device, dtype=dtype) - self.k_norm_x = RMSNorm(self.head_dim, device=device, dtype=dtype) - self.q_norm_y = RMSNorm(self.head_dim, device=device, dtype=dtype) - self.k_norm_y = RMSNorm(self.head_dim, device=device, dtype=dtype) + self.q_norm_x = operations.RMSNorm(self.head_dim, eps=1e-5, device=device, dtype=dtype) + self.k_norm_x = operations.RMSNorm(self.head_dim, eps=1e-5, device=device, dtype=dtype) + self.q_norm_y = operations.RMSNorm(self.head_dim, eps=1e-5, device=device, dtype=dtype) + self.k_norm_y = operations.RMSNorm(self.head_dim, eps=1e-5, device=device, dtype=dtype) # Output layers. y features go back down from dim_x -> dim_y. self.proj_x = operations.Linear(dim_x, dim_x, bias=out_bias, device=device, dtype=dtype) diff --git a/comfy/ldm/genmo/joint_model/layers.py b/comfy/ldm/genmo/joint_model/layers.py index 51d979559..e310bd717 100644 --- a/comfy/ldm/genmo/joint_model/layers.py +++ b/comfy/ldm/genmo/joint_model/layers.py @@ -151,14 +151,3 @@ class PatchEmbed(nn.Module): x = self.norm(x) return x - - -class RMSNorm(torch.nn.Module): - def __init__(self, hidden_size, eps=1e-5, device=None, dtype=None): - super().__init__() - self.eps = eps - self.weight = torch.nn.Parameter(torch.empty(hidden_size, device=device, dtype=dtype)) - self.register_parameter("bias", None) - - def forward(self, x): - return comfy.ldm.common_dit.rms_norm(x, self.weight, self.eps) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index 66bee7480..fc5ff40c5 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -9,7 +9,6 @@ from einops import repeat from comfy.ldm.modules.attention import optimized_attention from comfy.ldm.flux.layers import EmbedND from comfy.ldm.flux.math import apply_rope -from comfy.ldm.modules.diffusionmodules.mmdit import RMSNorm import comfy.ldm.common_dit import comfy.model_management @@ -49,8 +48,8 @@ class WanSelfAttention(nn.Module): self.k = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) self.v = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) self.o = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) - self.norm_q = RMSNorm(dim, eps=eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() - self.norm_k = RMSNorm(dim, eps=eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() + self.norm_q = operation_settings.get("operations").RMSNorm(dim, eps=eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() + self.norm_k = operation_settings.get("operations").RMSNorm(dim, eps=eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() def forward(self, x, freqs): r""" @@ -114,7 +113,7 @@ class WanI2VCrossAttention(WanSelfAttention): self.k_img = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) self.v_img = operation_settings.get("operations").Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) # self.alpha = nn.Parameter(torch.zeros((1, ))) - self.norm_k_img = RMSNorm(dim, eps=eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() + self.norm_k_img = operation_settings.get("operations").RMSNorm(dim, eps=eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) if qk_norm else nn.Identity() def forward(self, x, context, context_img_len): r""" From 9187a09483514c9d363bf064481c4614563951b0 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sun, 4 May 2025 03:26:20 -0700 Subject: [PATCH 397/478] Change cosmos and hydit models to use the native RMSNorm. (#7934) --- comfy/ldm/cosmos/blocks.py | 11 +++++------ comfy/ldm/cosmos/model.py | 4 +--- comfy/ldm/hydit/models.py | 4 ++-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/comfy/ldm/cosmos/blocks.py b/comfy/ldm/cosmos/blocks.py index 84fd6d839..a12f892d2 100644 --- a/comfy/ldm/cosmos/blocks.py +++ b/comfy/ldm/cosmos/blocks.py @@ -23,7 +23,6 @@ from einops import rearrange, repeat from einops.layers.torch import Rearrange from torch import nn -from comfy.ldm.modules.diffusionmodules.mmdit import RMSNorm from comfy.ldm.modules.attention import optimized_attention @@ -37,11 +36,11 @@ def apply_rotary_pos_emb( return t_out -def get_normalization(name: str, channels: int, weight_args={}): +def get_normalization(name: str, channels: int, weight_args={}, operations=None): if name == "I": return nn.Identity() elif name == "R": - return RMSNorm(channels, elementwise_affine=True, eps=1e-6, **weight_args) + return operations.RMSNorm(channels, elementwise_affine=True, eps=1e-6, **weight_args) else: raise ValueError(f"Normalization {name} not found") @@ -120,15 +119,15 @@ class Attention(nn.Module): self.to_q = nn.Sequential( operations.Linear(query_dim, inner_dim, bias=qkv_bias, **weight_args), - get_normalization(qkv_norm[0], norm_dim), + get_normalization(qkv_norm[0], norm_dim, weight_args=weight_args, operations=operations), ) self.to_k = nn.Sequential( operations.Linear(context_dim, inner_dim, bias=qkv_bias, **weight_args), - get_normalization(qkv_norm[1], norm_dim), + get_normalization(qkv_norm[1], norm_dim, weight_args=weight_args, operations=operations), ) self.to_v = nn.Sequential( operations.Linear(context_dim, inner_dim, bias=qkv_bias, **weight_args), - get_normalization(qkv_norm[2], norm_dim), + get_normalization(qkv_norm[2], norm_dim, weight_args=weight_args, operations=operations), ) self.to_out = nn.Sequential( diff --git a/comfy/ldm/cosmos/model.py b/comfy/ldm/cosmos/model.py index 06d0baef3..4836e0b69 100644 --- a/comfy/ldm/cosmos/model.py +++ b/comfy/ldm/cosmos/model.py @@ -27,8 +27,6 @@ from torchvision import transforms from enum import Enum import logging -from comfy.ldm.modules.diffusionmodules.mmdit import RMSNorm - from .blocks import ( FinalLayer, GeneralDITTransformerBlock, @@ -195,7 +193,7 @@ class GeneralDIT(nn.Module): if self.affline_emb_norm: logging.debug("Building affine embedding normalization layer") - self.affline_norm = RMSNorm(model_channels, elementwise_affine=True, eps=1e-6) + self.affline_norm = operations.RMSNorm(model_channels, elementwise_affine=True, eps=1e-6, device=device, dtype=dtype) else: self.affline_norm = nn.Identity() diff --git a/comfy/ldm/hydit/models.py b/comfy/ldm/hydit/models.py index 359f6a965..5ba2b76e0 100644 --- a/comfy/ldm/hydit/models.py +++ b/comfy/ldm/hydit/models.py @@ -3,7 +3,7 @@ import torch import torch.nn as nn import comfy.ops -from comfy.ldm.modules.diffusionmodules.mmdit import Mlp, TimestepEmbedder, PatchEmbed, RMSNorm +from comfy.ldm.modules.diffusionmodules.mmdit import Mlp, TimestepEmbedder, PatchEmbed from comfy.ldm.modules.diffusionmodules.util import timestep_embedding from torch.utils import checkpoint @@ -51,7 +51,7 @@ class HunYuanDiTBlock(nn.Module): if norm_type == "layer": norm_layer = operations.LayerNorm elif norm_type == "rms": - norm_layer = RMSNorm + norm_layer = operations.RMSNorm else: raise ValueError(f"Unknown norm_type: {norm_type}") From 80a44b97f5cbcb890896e2b9e65d177f1ac6a588 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sun, 4 May 2025 03:39:23 -0700 Subject: [PATCH 398/478] Change lumina to native RMSNorm. (#7935) --- comfy/ldm/lumina/model.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/comfy/ldm/lumina/model.py b/comfy/ldm/lumina/model.py index ccd5d2c0e..f8dc4d7db 100644 --- a/comfy/ldm/lumina/model.py +++ b/comfy/ldm/lumina/model.py @@ -8,7 +8,7 @@ import torch.nn as nn import torch.nn.functional as F import comfy.ldm.common_dit -from comfy.ldm.modules.diffusionmodules.mmdit import TimestepEmbedder, RMSNorm +from comfy.ldm.modules.diffusionmodules.mmdit import TimestepEmbedder from comfy.ldm.modules.attention import optimized_attention_masked from comfy.ldm.flux.layers import EmbedND @@ -64,8 +64,8 @@ class JointAttention(nn.Module): ) if qk_norm: - self.q_norm = RMSNorm(self.head_dim, elementwise_affine=True, **operation_settings) - self.k_norm = RMSNorm(self.head_dim, elementwise_affine=True, **operation_settings) + self.q_norm = operation_settings.get("operations").RMSNorm(self.head_dim, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.k_norm = operation_settings.get("operations").RMSNorm(self.head_dim, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) else: self.q_norm = self.k_norm = nn.Identity() @@ -242,11 +242,11 @@ class JointTransformerBlock(nn.Module): operation_settings=operation_settings, ) self.layer_id = layer_id - self.attention_norm1 = RMSNorm(dim, eps=norm_eps, elementwise_affine=True, **operation_settings) - self.ffn_norm1 = RMSNorm(dim, eps=norm_eps, elementwise_affine=True, **operation_settings) + self.attention_norm1 = operation_settings.get("operations").RMSNorm(dim, eps=norm_eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.ffn_norm1 = operation_settings.get("operations").RMSNorm(dim, eps=norm_eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) - self.attention_norm2 = RMSNorm(dim, eps=norm_eps, elementwise_affine=True, **operation_settings) - self.ffn_norm2 = RMSNorm(dim, eps=norm_eps, elementwise_affine=True, **operation_settings) + self.attention_norm2 = operation_settings.get("operations").RMSNorm(dim, eps=norm_eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.ffn_norm2 = operation_settings.get("operations").RMSNorm(dim, eps=norm_eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) self.modulation = modulation if modulation: @@ -431,7 +431,7 @@ class NextDiT(nn.Module): self.t_embedder = TimestepEmbedder(min(dim, 1024), **operation_settings) self.cap_embedder = nn.Sequential( - RMSNorm(cap_feat_dim, eps=norm_eps, elementwise_affine=True, **operation_settings), + operation_settings.get("operations").RMSNorm(cap_feat_dim, eps=norm_eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")), operation_settings.get("operations").Linear( cap_feat_dim, dim, @@ -457,7 +457,7 @@ class NextDiT(nn.Module): for layer_id in range(n_layers) ] ) - self.norm_final = RMSNorm(dim, eps=norm_eps, elementwise_affine=True, **operation_settings) + self.norm_final = operation_settings.get("operations").RMSNorm(dim, eps=norm_eps, elementwise_affine=True, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) self.final_layer = FinalLayer(dim, patch_size, self.out_channels, operation_settings=operation_settings) assert (dim // n_heads) == sum(axes_dims) From cd18582578d38081af5614d018781bcdfbe95e0b Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sun, 4 May 2025 20:26:57 -0700 Subject: [PATCH 399/478] Support saving Comfy `VIDEO` type to buffer (#7939) * get output format when saving to buffer * add unit tests for writing to file or stream with correct fmt * handle `to_format=None` * fix formatting --- comfy_api/input_impl/video_types.py | 46 +++++++++- tests-unit/comfy_api_test/input_impl_test.py | 91 ++++++++++++++++++++ 2 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 tests-unit/comfy_api_test/input_impl_test.py diff --git a/comfy_api/input_impl/video_types.py b/comfy_api/input_impl/video_types.py index 12e5783db..d0b0b36d2 100644 --- a/comfy_api/input_impl/video_types.py +++ b/comfy_api/input_impl/video_types.py @@ -12,6 +12,46 @@ import torch from comfy_api.input import VideoInput from comfy_api.util import VideoContainer, VideoCodec, VideoComponents + +def container_to_output_format(container_format: str | None) -> str | None: + """ + A container's `format` may be a comma-separated list of formats. + E.g., iso container's `format` may be `mov,mp4,m4a,3gp,3g2,mj2`. + However, writing to a file/stream with `av.open` requires a single format, + or `None` to auto-detect. + """ + if not container_format: + return None # Auto-detect + + if "," not in container_format: + return container_format + + formats = container_format.split(",") + return formats[0] + + +def get_open_write_kwargs( + dest: str | io.BytesIO, container_format: str, to_format: str | None +) -> dict: + """Get kwargs for writing a `VideoFromFile` to a file/stream with `av.open`""" + open_kwargs = { + "mode": "w", + # If isobmff, preserve custom metadata tags (workflow, prompt, extra_pnginfo) + "options": {"movflags": "use_metadata_tags"}, + } + + is_write_to_buffer = isinstance(dest, io.BytesIO) + if is_write_to_buffer: + # Set output format explicitly, since it cannot be inferred from file extension + if to_format == VideoContainer.AUTO: + to_format = container_format.lower() + elif isinstance(to_format, str): + to_format = to_format.lower() + open_kwargs["format"] = container_to_output_format(to_format) + + return open_kwargs + + class VideoFromFile(VideoInput): """ Class representing video input from a file. @@ -89,7 +129,7 @@ class VideoFromFile(VideoInput): def save_to( self, - path: str, + path: str | io.BytesIO, format: VideoContainer = VideoContainer.AUTO, codec: VideoCodec = VideoCodec.AUTO, metadata: Optional[dict] = None @@ -116,7 +156,9 @@ class VideoFromFile(VideoInput): ) streams = container.streams - with av.open(path, mode='w', options={"movflags": "use_metadata_tags"}) as output_container: + + open_kwargs = get_open_write_kwargs(path, container_format, format) + with av.open(path, **open_kwargs) as output_container: # Copy over the original metadata for key, value in container.metadata.items(): if metadata is None or key not in metadata: diff --git a/tests-unit/comfy_api_test/input_impl_test.py b/tests-unit/comfy_api_test/input_impl_test.py new file mode 100644 index 000000000..5fc21a9a7 --- /dev/null +++ b/tests-unit/comfy_api_test/input_impl_test.py @@ -0,0 +1,91 @@ +import io +from comfy_api.input_impl.video_types import ( + container_to_output_format, + get_open_write_kwargs, +) +from comfy_api.util import VideoContainer + + +def test_container_to_output_format_empty_string(): + """Test that an empty string input returns None. `None` arg allows default auto-detection.""" + assert container_to_output_format("") is None + + +def test_container_to_output_format_none(): + """Test that None input returns None.""" + assert container_to_output_format(None) is None + + +def test_container_to_output_format_comma_separated(): + """Test that a comma-separated list returns a valid singular format from the list.""" + comma_separated_format = "mp4,mov,m4a" + output_format = container_to_output_format(comma_separated_format) + assert output_format in comma_separated_format + + +def test_container_to_output_format_single(): + """Test that a single format string (not comma-separated list) is returned as is.""" + assert container_to_output_format("mp4") == "mp4" + + +def test_get_open_write_kwargs_filepath_no_format(): + """Test that 'format' kwarg is NOT set when dest is a file path.""" + kwargs_auto = get_open_write_kwargs("output.mp4", "mp4", VideoContainer.AUTO) + assert "format" not in kwargs_auto, "Format should not be set for file paths (AUTO)" + + kwargs_specific = get_open_write_kwargs("output.avi", "mp4", "avi") + fail_msg = "Format should not be set for file paths (Specific)" + assert "format" not in kwargs_specific, fail_msg + + +def test_get_open_write_kwargs_base_options_mode(): + """Test basic kwargs for file path: mode and movflags.""" + kwargs = get_open_write_kwargs("output.mp4", "mp4", VideoContainer.AUTO) + assert kwargs["mode"] == "w", "mode should be set to write" + + fail_msg = "movflags should be set to preserve custom metadata tags" + assert "movflags" in kwargs["options"], fail_msg + assert kwargs["options"]["movflags"] == "use_metadata_tags", fail_msg + + +def test_get_open_write_kwargs_bytesio_auto_format(): + """Test kwargs for BytesIO dest with AUTO format.""" + dest = io.BytesIO() + container_fmt = "mov,mp4,m4a" + kwargs = get_open_write_kwargs(dest, container_fmt, VideoContainer.AUTO) + + assert kwargs["mode"] == "w" + assert kwargs["options"]["movflags"] == "use_metadata_tags" + + fail_msg = ( + "Format should be a valid format from the container's format list when AUTO" + ) + assert kwargs["format"] in container_fmt, fail_msg + + +def test_get_open_write_kwargs_bytesio_specific_format(): + """Test kwargs for BytesIO dest with a specific single format.""" + dest = io.BytesIO() + container_fmt = "avi" + to_fmt = VideoContainer.MP4 + kwargs = get_open_write_kwargs(dest, container_fmt, to_fmt) + + assert kwargs["mode"] == "w" + assert kwargs["options"]["movflags"] == "use_metadata_tags" + + fail_msg = "Format should be the specified format (lowercased) when output format is not AUTO" + assert kwargs["format"] == "mp4", fail_msg + + +def test_get_open_write_kwargs_bytesio_specific_format_list(): + """Test kwargs for BytesIO dest with a specific comma-separated format.""" + dest = io.BytesIO() + container_fmt = "avi" + to_fmt = "mov,mp4,m4a" # A format string that is a list + kwargs = get_open_write_kwargs(dest, container_fmt, to_fmt) + + assert kwargs["mode"] == "w" + assert kwargs["options"]["movflags"] == "use_metadata_tags" + + fail_msg = "Format should be a valid format from the specified format list when output format is not AUTO" + assert kwargs["format"] in to_fmt, fail_msg From 3e62c5513a5ab5311a1fb4c87ad787fdaad06ea2 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sun, 4 May 2025 20:27:23 -0700 Subject: [PATCH 400/478] make audio chunks contiguous before encoding (#7942) --- comfy_api/input_impl/video_types.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/comfy_api/input_impl/video_types.py b/comfy_api/input_impl/video_types.py index d0b0b36d2..ae48dbaa4 100644 --- a/comfy_api/input_impl/video_types.py +++ b/comfy_api/input_impl/video_types.py @@ -253,7 +253,12 @@ class VideoFromComponents(VideoInput): start = i * samples_per_frame end = start + samples_per_frame # TODO(Feature) - Add support for stereo audio - chunk = self.__components.audio['waveform'][0, 0, start:end].unsqueeze(0).numpy() + chunk = ( + self.__components.audio["waveform"][0, 0, start:end] + .unsqueeze(0) + .contiguous() + .numpy() + ) audio_frame = av.AudioFrame.from_ndarray(chunk, format='fltp', layout='mono') audio_frame.sample_rate = audio_sample_rate audio_frame.pts = i * samples_per_frame From d9c80a85e54ebdd5aaba3374d76a6e32e1988c97 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Mon, 5 May 2025 04:49:07 -0700 Subject: [PATCH 401/478] This should not be a warning. (#7946) --- app/custom_node_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/custom_node_manager.py b/app/custom_node_manager.py index 27d85d9ce..281febca9 100644 --- a/app/custom_node_manager.py +++ b/app/custom_node_manager.py @@ -127,8 +127,8 @@ class CustomNodeManager: if os.path.exists(workflows_dir): if folder_name != "example_workflows": - logging.warning( - "WARNING: Found example workflow folder '%s' for custom node '%s', consider renaming it to 'example_workflows'", + logging.debug( + "Found example workflow folder '%s' for custom node '%s', consider renaming it to 'example_workflows'", folder_name, module_name) webapp.add_routes( From 1271c4ef9df2b4eb037688da514f63e1bd8bd727 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Tue, 6 May 2025 03:23:00 -0500 Subject: [PATCH 402/478] More API Nodes (#7956) * Add Ideogram generate node. * Add staging api. * Add API_NODE and common error for missing auth token (#5) * Add Minimax Video Generation + Async Task queue polling example (#6) * [Minimax] Show video preview and embed workflow in ouput (#7) * Remove uv.lock * Remove polling operations. * Revert "Remove polling operations." * Update stubs. * Added Ideogram and Minimax back in. * Added initial BFL Flux 1.1 [pro] Ultra node (#11) * Add --comfy-api-base launch arg (#13) * Add instructions for staging development. (#14) * remove validation to make it easier to run against LAN copies of the API * Manually add BFL polling status response schema (#15) * Add function for uploading files. (#18) * Add Luma nodes (#16) * Refactor util functions (#20) * Add VIDEO type (#21) * Add rest of Luma node functionality (#19) * Fix image_luma_ref not working (#28) * [Bug] Remove duplicated option T2V-01 in MinimaxTextToVideoNode (#31) * Add utils to map from pydantic model fields to comfy node inputs (#30) * add veo2, bump av req (#32) * Add Recraft nodes (#29) * Add Kling Nodes (#12) * Add Camera Concepts (luma_concepts) to Luma Video nodes (#33) * Add Runway nodes (#17) * Convert Minimax node to use VIDEO output type (#34) * Standard `CATEGORY` system for api nodes (#35) * Set `Content-Type` header when uploading files (#36) * add better error propagation to veo2 (#37) * Add Realistic Image and Logo Raster styles for Recraft v3 (#38) * Fix runway image upload and progress polling (#39) * Fix image upload for Luma: only include `Content-Type` header field if it's set explicitly (#40) * Moved Luma nodes to nodes_luma.py (#47) * Moved Recraft nodes to nodes_recraft.py (#48) * Add Pixverse nodes (#46) * Move and fix BFL nodes to node_bfl.py (#49) * Move and edit Minimax node to nodes_minimax.py (#50) * Add Minimax Image to Video node + Cleanup (#51) * Add Recraft Text to Vector node, add Save SVG node to handle its output (#53) * Added pixverse_template support to Pixverse Text to Video node (#54) * Added Recraft Controls + Recraft Color RGB nodes (#57) * split remaining nodes out of nodes_api, make utility lib, refactor ideogram (#61) * Add types and doctstrings to utils file (#64) * Fix: `PollingOperation` progress bar update progress by absolute value (#65) * Use common download function in kling nodes module (#67) * Fix: Luma video nodes in `api nodes/image` category (#68) * Set request type explicitly (#66) * Add `control_after_generate` to all seed inputs (#69) * Fix bug: deleting `Content-Type` when property does not exist (#73) * Add preview to Save SVG node (#74) * change default poll interval (#76), rework veo2 * Add Pixverse and updated Kling types (#75) * Added Pixverse Image to VIdeo node (#77) * Add Pixverse Transition Video node (#79) * Proper ray-1-6 support as fix has been applied in backend (#80) * Added Recraft Style - Infinite Style Library node (#82) * add ideogram v3 (#83) * [Kling] Split Camera Control config to its own node (#81) * Add Pika i2v and t2v nodes (#52) * Temporary Fix for Runway (#87) * Added Stability Stable Image Ultra node (#86) * Remove Runway nodes (#88) * Fix: Prompt text can't be validated in Kling nodes when using primitive nodes (#90) * Fix: typo in node name "Stabiliy" => "Stability" (#91) * Add String (Multiline) node (#93) * Update Pika Duration and Resolution options (#94) * Change base branch to master. Not main. (#95) * Fix UploadRequest file_name param (#98) * Removed Infinite Style Library until later (#99) * fix ideogram style types (#100) * fix multi image return (#101) * add metadata saving to SVG (#102) * Bump templates version to include API node template workflows (#104) * Fix: `download_url_to_video_output` return type (#103) * fix 4o generation bug (#106) * Serve SVG files directly (#107) * Add a bunch of nodes, 3 ready to use, the rest waiting for endpoint support (#108) * Revert "Serve SVG files directly" (#111) * Expose 4 remaining Recraft nodes (#112) * [Kling] Add `Duration` and `Video ID` outputs (#105) * Fix: datamodel-codegen sets string#binary type to non-existent `bytes_aliased` variable (#114) * Fix: Dall-e 2 not setting request content-type dynamically (#113) * Default request timeout: one hour. (#116) * Add Kling nodes: camera control, start-end frame, lip-sync, video extend (#115) * Add 8 nodes - 4 BFL, 4 Stability (#117) * Fix error for Recraft ImageToImage error for nonexistent random_seed param (#118) * Add remaining Pika nodes (#119) * Make controls input work for Recraft Image to Image node (#120) * Use upstream PR: Support saving Comfy VIDEO type to buffer (#123) * Use Upstream PR: "Fix: Error creating video when sliced audio tensor chunks are non-c-contiguous" (#127) * Improve audio upload utils (#128) * Fix: Nested `AnyUrl` in request model cannot be serialized (Kling, Runway) (#129) * Show errors and API output URLs to the user (change log levels) (#131) * Fix: Luma I2I fails when weight is <=0.01 (#132) * Change category of `LumaConcepts` node from image to video (#133) * Fix: `image.shape` accessed before `image` is null-checked (#134) * Apply small fixes and most prompt validation (if needed to avoid API error) (#135) * Node name/category modifications (#140) * Add back Recraft Style - Infinite Style Library node (#141) * Fixed Kling: Check attributes of pydantic types. (#144) * Bump `comfyui-workflow-templates` version (#142) * [Kling] Print response data when error validating response (#146) * Fix: error validating Kling image response, trying to use `"key" in` on Pydantic class instance (#147) * [Kling] Fix: Correct/verify supported subset of input combos in Kling nodes (#149) * [Kling] Fix typo in node description (#150) * [Kling] Fix: CFG min/max not being enforced (#151) * Rebase launch-rebase (private) on prep-branch (public copy of master) (#153) * Bump templates version (#154) * Fix: Kling image gen nodes don't return entire batch when `n` > 1 (#152) * Remove pixverse_template from PixVerse Transition Video node (#155) * Invert image_weight value on Luma Image to Image node (#156) * Invert and resize mask for Ideogram V3 node to match masking conventions (#158) * [Kling] Fix: image generation nodes not returning Tuple (#159) * [Bug] [Kling] Fix Kling camera control (#161) * Kling Image Gen v2 + improve node descriptions for Flux/OpenAI (#160) * [Kling] Don't return video_id from dual effect video (#162) * Bump frontend to 1.18.8 (#163) * Use 3.9 compat syntax (#164) * Use Python 3.10 * add example env var * Update templates to 0.1.11 * Bump frontend to 1.18.9 --------- Co-authored-by: Robin Huang Co-authored-by: Christian Byrne Co-authored-by: thot experiment <94414189+thot-experiment@users.noreply.github.com> --- .github/workflows/test-launch.yml | 2 +- .github/workflows/update-api-stubs.yml | 13 +- .gitignore | 3 + comfy/cli_args.py | 7 + comfy_api_nodes/README.md | 41 + comfy_api_nodes/apinode_utils.py | 575 +++ comfy_api_nodes/apis/PixverseController.py | 4 +- comfy_api_nodes/apis/PixverseDto.py | 12 +- comfy_api_nodes/apis/__init__.py | 3857 ++++++++++++++++- comfy_api_nodes/apis/bfl_api.py | 156 + comfy_api_nodes/apis/client.py | 373 +- comfy_api_nodes/apis/luma_api.py | 253 ++ comfy_api_nodes/apis/pixverse_api.py | 146 + comfy_api_nodes/apis/recraft_api.py | 263 ++ comfy_api_nodes/apis/stability_api.py | 127 + comfy_api_nodes/mapper_utils.py | 116 + comfy_api_nodes/nodes_api.py | 449 -- comfy_api_nodes/nodes_bfl.py | 906 ++++ comfy_api_nodes/nodes_ideogram.py | 777 ++++ comfy_api_nodes/nodes_kling.py | 1563 +++++++ comfy_api_nodes/nodes_luma.py | 702 +++ comfy_api_nodes/nodes_minimax.py | 306 ++ comfy_api_nodes/nodes_openai.py | 487 +++ comfy_api_nodes/nodes_pika.py | 749 ++++ comfy_api_nodes/nodes_pixverse.py | 492 +++ comfy_api_nodes/nodes_recraft.py | 1217 ++++++ comfy_api_nodes/nodes_stability.py | 609 +++ comfy_api_nodes/nodes_veo2.py | 283 ++ comfy_api_nodes/redocly-dev.yaml | 10 + comfy_api_nodes/redocly.yaml | 10 + comfy_extras/nodes_primitive.py | 17 + nodes.py | 12 +- requirements.txt | 4 +- .../comfy_api_nodes_test/mapper_utils_test.py | 297 ++ 34 files changed, 14101 insertions(+), 737 deletions(-) create mode 100644 comfy_api_nodes/README.md create mode 100644 comfy_api_nodes/apinode_utils.py create mode 100644 comfy_api_nodes/apis/bfl_api.py create mode 100644 comfy_api_nodes/apis/luma_api.py create mode 100644 comfy_api_nodes/apis/pixverse_api.py create mode 100644 comfy_api_nodes/apis/recraft_api.py create mode 100644 comfy_api_nodes/apis/stability_api.py create mode 100644 comfy_api_nodes/mapper_utils.py delete mode 100644 comfy_api_nodes/nodes_api.py create mode 100644 comfy_api_nodes/nodes_bfl.py create mode 100644 comfy_api_nodes/nodes_ideogram.py create mode 100644 comfy_api_nodes/nodes_kling.py create mode 100644 comfy_api_nodes/nodes_luma.py create mode 100644 comfy_api_nodes/nodes_minimax.py create mode 100644 comfy_api_nodes/nodes_openai.py create mode 100644 comfy_api_nodes/nodes_pika.py create mode 100644 comfy_api_nodes/nodes_pixverse.py create mode 100644 comfy_api_nodes/nodes_recraft.py create mode 100644 comfy_api_nodes/nodes_stability.py create mode 100644 comfy_api_nodes/nodes_veo2.py create mode 100644 comfy_api_nodes/redocly-dev.yaml create mode 100644 comfy_api_nodes/redocly.yaml create mode 100644 tests-unit/comfy_api_nodes_test/mapper_utils_test.py diff --git a/.github/workflows/test-launch.yml b/.github/workflows/test-launch.yml index c56283c2d..1735fd83b 100644 --- a/.github/workflows/test-launch.yml +++ b/.github/workflows/test-launch.yml @@ -17,7 +17,7 @@ jobs: path: "ComfyUI" - uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: '3.10' - name: Install requirements run: | python -m pip install --upgrade pip diff --git a/.github/workflows/update-api-stubs.yml b/.github/workflows/update-api-stubs.yml index 2ae99b673..c99ec9fc1 100644 --- a/.github/workflows/update-api-stubs.yml +++ b/.github/workflows/update-api-stubs.yml @@ -22,10 +22,19 @@ jobs: run: | python -m pip install --upgrade pip pip install 'datamodel-code-generator[http]' + npm install @redocly/cli + + - name: Download OpenAPI spec + run: | + curl -o openapi.yaml https://api.comfy.org/openapi + + - name: Filter OpenAPI spec with Redocly + run: | + npx @redocly/cli bundle openapi.yaml --output filtered-openapi.yaml --config comfy_api_nodes/redocly.yaml --remove-unused-components - name: Generate API models run: | - datamodel-codegen --use-subclass-enum --url https://api.comfy.org/openapi --output comfy_api_nodes/apis --output-model-type pydantic_v2.BaseModel + datamodel-codegen --use-subclass-enum --input filtered-openapi.yaml --output comfy_api_nodes/apis --output-model-type pydantic_v2.BaseModel - name: Check for changes id: git-check @@ -44,4 +53,4 @@ jobs: Generated automatically by the a Github workflow. branch: update-api-stubs delete-branch: true - base: main + base: master diff --git a/.gitignore b/.gitignore index 61881b8a4..4e8cea71e 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ venv/ *.log web_custom_versions/ .DS_Store +openapi.yaml +filtered-openapi.yaml +uv.lock diff --git a/comfy/cli_args.py b/comfy/cli_args.py index f89a7aab4..ef5ab6277 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -192,6 +192,13 @@ parser.add_argument("--user-directory", type=is_valid_directory, default=None, h parser.add_argument("--enable-compress-response-body", action="store_true", help="Enable compressing response body.") +parser.add_argument( + "--comfy-api-base", + type=str, + default="https://api.comfy.org", + help="Set the base URL for the ComfyUI API. (default: https://api.comfy.org)", +) + if comfy.options.args_parsing: args = parser.parse_args() else: diff --git a/comfy_api_nodes/README.md b/comfy_api_nodes/README.md new file mode 100644 index 000000000..e2633a769 --- /dev/null +++ b/comfy_api_nodes/README.md @@ -0,0 +1,41 @@ +# ComfyUI API Nodes + +## Introduction + +Below are a collection of nodes that work by calling external APIs. More information available in our [docs](https://docs.comfy.org/tutorials/api-nodes/overview#api-nodes). + +## Development + +While developing, you should be testing against the Staging environment. To test against staging: + +**Install ComfyUI_frontend** + +Follow the instructions [here](https://github.com/Comfy-Org/ComfyUI_frontend) to start the frontend server. By default, it will connect to Staging authentication. + +> **Hint:** If you use --front-end-version argument for ComfyUI, it will use production authentication. + +```bash +python run main.py --comfy-api-base https://stagingapi.comfy.org +``` + +API stubs are generated through automatic codegen tools from OpenAPI definitions. Since the Comfy Org OpenAPI definition contains many things from the Comfy Registry as well, we use redocly/cli to filter out only the paths relevant for API nodes. + +### Redocly Instructions + +**Tip** +When developing locally, use the `redocly-dev.yaml` file to generate pydantic models. This lets you use stubs for APIs that are not marked `Released` yet. + +Before your API node PR merges, make sure to add the `Released` tag to the `openapi.yaml` file and test in staging. + +```bash +# Download the OpenAPI file from prod server. +curl -o openapi.yaml https://stagingapi.comfy.org/openapi + +# Filter out unneeded API definitions. +npm install -g @redocly/cli +redocly bundle openapi.yaml --output filtered-openapi.yaml --config comfy_api_nodes/redocly-dev.yaml --remove-unused-components + +# Generate the pydantic datamodels for validation. +datamodel-codegen --use-subclass-enum --field-constraints --strict-types bytes --input filtered-openapi.yaml --output comfy_api_nodes/apis/__init__.py --output-model-type pydantic_v2.BaseModel + +``` diff --git a/comfy_api_nodes/apinode_utils.py b/comfy_api_nodes/apinode_utils.py new file mode 100644 index 000000000..bd3b8908b --- /dev/null +++ b/comfy_api_nodes/apinode_utils.py @@ -0,0 +1,575 @@ +import io +import logging +from typing import Optional +from comfy.utils import common_upscale +from comfy_api.input_impl import VideoFromFile +from comfy_api.util import VideoContainer, VideoCodec +from comfy_api.input.video_types import VideoInput +from comfy_api.input.basic_types import AudioInput +from comfy_api_nodes.apis.client import ( + ApiClient, + ApiEndpoint, + HttpMethod, + SynchronousOperation, + UploadRequest, + UploadResponse, +) + + +import numpy as np +from PIL import Image +import requests +import torch +import math +import base64 +import uuid +from io import BytesIO +import av + + +def download_url_to_video_output(video_url: str, timeout: int = None) -> VideoFromFile: + """Downloads a video from a URL and returns a `VIDEO` output. + + Args: + video_url: The URL of the video to download. + + Returns: + A Comfy node `VIDEO` output. + """ + video_io = download_url_to_bytesio(video_url, timeout) + if video_io is None: + error_msg = f"Failed to download video from {video_url}" + logging.error(error_msg) + raise ValueError(error_msg) + return VideoFromFile(video_io) + + +def downscale_image_tensor(image, total_pixels=1536 * 1024) -> torch.Tensor: + """Downscale input image tensor to roughly the specified total pixels.""" + samples = image.movedim(-1, 1) + total = int(total_pixels) + scale_by = math.sqrt(total / (samples.shape[3] * samples.shape[2])) + if scale_by >= 1: + return image + width = round(samples.shape[3] * scale_by) + height = round(samples.shape[2] * scale_by) + + s = common_upscale(samples, width, height, "lanczos", "disabled") + s = s.movedim(1, -1) + return s + + +def validate_and_cast_response(response, timeout: int = None) -> torch.Tensor: + """Validates and casts a response to a torch.Tensor. + + Args: + response: The response to validate and cast. + timeout: Request timeout in seconds. Defaults to None (no timeout). + + Returns: + A torch.Tensor representing the image (1, H, W, C). + + Raises: + ValueError: If the response is not valid. + """ + # validate raw JSON response + data = response.data + if not data or len(data) == 0: + raise ValueError("No images returned from API endpoint") + + # Initialize list to store image tensors + image_tensors: list[torch.Tensor] = [] + + # Process each image in the data array + for image_data in data: + image_url = image_data.url + b64_data = image_data.b64_json + + if not image_url and not b64_data: + raise ValueError("No image was generated in the response") + + if b64_data: + img_data = base64.b64decode(b64_data) + img = Image.open(io.BytesIO(img_data)) + + elif image_url: + img_response = requests.get(image_url, timeout=timeout) + if img_response.status_code != 200: + raise ValueError("Failed to download the image") + img = Image.open(io.BytesIO(img_response.content)) + + img = img.convert("RGBA") + + # Convert to numpy array, normalize to float32 between 0 and 1 + img_array = np.array(img).astype(np.float32) / 255.0 + img_tensor = torch.from_numpy(img_array) + + # Add to list of tensors + image_tensors.append(img_tensor) + + return torch.stack(image_tensors, dim=0) + + +def validate_aspect_ratio( + aspect_ratio: str, + minimum_ratio: float, + maximum_ratio: float, + minimum_ratio_str: str, + maximum_ratio_str: str, +) -> float: + """Validates and casts an aspect ratio string to a float. + + Args: + aspect_ratio: The aspect ratio string to validate. + minimum_ratio: The minimum aspect ratio. + maximum_ratio: The maximum aspect ratio. + minimum_ratio_str: The minimum aspect ratio string. + maximum_ratio_str: The maximum aspect ratio string. + + Returns: + The validated and cast aspect ratio. + + Raises: + Exception: If the aspect ratio is not valid. + """ + # get ratio values + numbers = aspect_ratio.split(":") + if len(numbers) != 2: + raise TypeError( + f"Aspect ratio must be in the format X:Y, such as 16:9, but was {aspect_ratio}." + ) + try: + numerator = int(numbers[0]) + denominator = int(numbers[1]) + except ValueError as exc: + raise TypeError( + f"Aspect ratio must contain numbers separated by ':', such as 16:9, but was {aspect_ratio}." + ) from exc + calculated_ratio = numerator / denominator + # if not close to minimum and maximum, check bounds + if not math.isclose(calculated_ratio, minimum_ratio) or not math.isclose( + calculated_ratio, maximum_ratio + ): + if calculated_ratio < minimum_ratio: + raise TypeError( + f"Aspect ratio cannot reduce to any less than {minimum_ratio_str} ({minimum_ratio}), but was {aspect_ratio} ({calculated_ratio})." + ) + elif calculated_ratio > maximum_ratio: + raise TypeError( + f"Aspect ratio cannot reduce to any greater than {maximum_ratio_str} ({maximum_ratio}), but was {aspect_ratio} ({calculated_ratio})." + ) + return aspect_ratio + + +def mimetype_to_extension(mime_type: str) -> str: + """Converts a MIME type to a file extension.""" + return mime_type.split("/")[-1].lower() + + +def download_url_to_bytesio(url: str, timeout: int = None) -> BytesIO: + """Downloads content from a URL using requests and returns it as BytesIO. + + Args: + url: The URL to download. + timeout: Request timeout in seconds. Defaults to None (no timeout). + + Returns: + BytesIO object containing the downloaded content. + """ + response = requests.get(url, stream=True, timeout=timeout) + response.raise_for_status() # Raises HTTPError for bad responses (4XX or 5XX) + return BytesIO(response.content) + + +def bytesio_to_image_tensor(image_bytesio: BytesIO, mode: str = "RGBA") -> torch.Tensor: + """Converts image data from BytesIO to a torch.Tensor. + + Args: + image_bytesio: BytesIO object containing the image data. + mode: The PIL mode to convert the image to (e.g., "RGB", "RGBA"). + + Returns: + A torch.Tensor representing the image (1, H, W, C). + + Raises: + PIL.UnidentifiedImageError: If the image data cannot be identified. + ValueError: If the specified mode is invalid. + """ + image = Image.open(image_bytesio) + image = image.convert(mode) + image_array = np.array(image).astype(np.float32) / 255.0 + return torch.from_numpy(image_array).unsqueeze(0) + + +def download_url_to_image_tensor(url: str, timeout: int = None) -> torch.Tensor: + """Downloads an image from a URL and returns a [B, H, W, C] tensor.""" + image_bytesio = download_url_to_bytesio(url, timeout) + return bytesio_to_image_tensor(image_bytesio) + +def process_image_response(response: requests.Response) -> torch.Tensor: + """Uses content from a Response object and converts it to a torch.Tensor""" + return bytesio_to_image_tensor(BytesIO(response.content)) + + +def _tensor_to_pil(image: torch.Tensor, total_pixels: int = 2048 * 2048) -> Image.Image: + """Converts a single torch.Tensor image [H, W, C] to a PIL Image, optionally downscaling.""" + if len(image.shape) > 3: + image = image[0] + # TODO: remove alpha if not allowed and present + input_tensor = image.cpu() + input_tensor = downscale_image_tensor( + input_tensor.unsqueeze(0), total_pixels=total_pixels + ).squeeze() + image_np = (input_tensor.numpy() * 255).astype(np.uint8) + img = Image.fromarray(image_np) + return img + + +def _pil_to_bytesio(img: Image.Image, mime_type: str = "image/png") -> BytesIO: + """Converts a PIL Image to a BytesIO object.""" + if not mime_type: + mime_type = "image/png" + + img_byte_arr = io.BytesIO() + # Derive PIL format from MIME type (e.g., 'image/png' -> 'PNG') + pil_format = mime_type.split("/")[-1].upper() + if pil_format == "JPG": + pil_format = "JPEG" + img.save(img_byte_arr, format=pil_format) + img_byte_arr.seek(0) + return img_byte_arr + + +def tensor_to_bytesio( + image: torch.Tensor, + name: Optional[str] = None, + total_pixels: int = 2048 * 2048, + mime_type: str = "image/png", +) -> BytesIO: + """Converts a torch.Tensor image to a named BytesIO object. + + Args: + image: Input torch.Tensor image. + name: Optional filename for the BytesIO object. + total_pixels: Maximum total pixels for potential downscaling. + mime_type: Target image MIME type (e.g., 'image/png', 'image/jpeg', 'image/webp', 'video/mp4'). + + Returns: + Named BytesIO object containing the image data. + """ + if not mime_type: + mime_type = "image/png" + + pil_image = _tensor_to_pil(image, total_pixels=total_pixels) + img_binary = _pil_to_bytesio(pil_image, mime_type=mime_type) + img_binary.name = ( + f"{name if name else uuid.uuid4()}.{mimetype_to_extension(mime_type)}" + ) + return img_binary + + +def tensor_to_base64_string( + image_tensor: torch.Tensor, + total_pixels: int = 2048 * 2048, + mime_type: str = "image/png", +) -> str: + """Convert [B, H, W, C] or [H, W, C] tensor to a base64 string. + + Args: + image_tensor: Input torch.Tensor image. + total_pixels: Maximum total pixels for potential downscaling. + mime_type: Target image MIME type (e.g., 'image/png', 'image/jpeg', 'image/webp', 'video/mp4'). + + Returns: + Base64 encoded string of the image. + """ + pil_image = _tensor_to_pil(image_tensor, total_pixels=total_pixels) + img_byte_arr = _pil_to_bytesio(pil_image, mime_type=mime_type) + img_bytes = img_byte_arr.getvalue() + # Encode bytes to base64 string + base64_encoded_string = base64.b64encode(img_bytes).decode("utf-8") + return base64_encoded_string + + +def tensor_to_data_uri( + image_tensor: torch.Tensor, + total_pixels: int = 2048 * 2048, + mime_type: str = "image/png", +) -> str: + """Converts a tensor image to a Data URI string. + + Args: + image_tensor: Input torch.Tensor image. + total_pixels: Maximum total pixels for potential downscaling. + mime_type: Target image MIME type (e.g., 'image/png', 'image/jpeg', 'image/webp'). + + Returns: + Data URI string (e.g., 'data:image/png;base64,...'). + """ + base64_string = tensor_to_base64_string(image_tensor, total_pixels, mime_type) + return f"data:{mime_type};base64,{base64_string}" + + +def upload_file_to_comfyapi( + file_bytes_io: BytesIO, + filename: str, + upload_mime_type: str, + auth_token: Optional[str] = None, +) -> str: + """ + Uploads a single file to ComfyUI API and returns its download URL. + + Args: + file_bytes_io: BytesIO object containing the file data. + filename: The filename of the file. + upload_mime_type: MIME type of the file. + auth_token: Optional authentication token. + + Returns: + The download URL for the uploaded file. + """ + request_object = UploadRequest(file_name=filename, content_type=upload_mime_type) + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/customers/storage", + method=HttpMethod.POST, + request_model=UploadRequest, + response_model=UploadResponse, + ), + request=request_object, + auth_token=auth_token, + ) + + response: UploadResponse = operation.execute() + upload_response = ApiClient.upload_file( + response.upload_url, file_bytes_io, content_type=upload_mime_type + ) + upload_response.raise_for_status() + + return response.download_url + + +def upload_video_to_comfyapi( + video: VideoInput, + auth_token: Optional[str] = None, + container: VideoContainer = VideoContainer.MP4, + codec: VideoCodec = VideoCodec.H264, + max_duration: Optional[int] = None, +) -> str: + """ + Uploads a single video to ComfyUI API and returns its download URL. + Uses the specified container and codec for saving the video before upload. + + Args: + video: VideoInput object (Comfy VIDEO type). + auth_token: Optional authentication token. + container: The video container format to use (default: MP4). + codec: The video codec to use (default: H264). + max_duration: Optional maximum duration of the video in seconds. If the video is longer than this, an error will be raised. + + Returns: + The download URL for the uploaded video file. + """ + if max_duration is not None: + try: + actual_duration = video.duration_seconds + if actual_duration is not None and actual_duration > max_duration: + raise ValueError( + f"Video duration ({actual_duration:.2f}s) exceeds the maximum allowed ({max_duration}s)." + ) + except Exception as e: + logging.error(f"Error getting video duration: {e}") + raise ValueError(f"Could not verify video duration from source: {e}") from e + + upload_mime_type = f"video/{container.value.lower()}" + filename = f"uploaded_video.{container.value.lower()}" + + # Convert VideoInput to BytesIO using specified container/codec + video_bytes_io = io.BytesIO() + video.save_to(video_bytes_io, format=container, codec=codec) + video_bytes_io.seek(0) + + return upload_file_to_comfyapi( + video_bytes_io, filename, upload_mime_type, auth_token + ) + + +def audio_tensor_to_contiguous_ndarray(waveform: torch.Tensor) -> np.ndarray: + """ + Prepares audio waveform for av library by converting to a contiguous numpy array. + + Args: + waveform: a tensor of shape (1, channels, samples) derived from a Comfy `AUDIO` type. + + Returns: + Contiguous numpy array of the audio waveform. If the audio was batched, + the first item is taken. + """ + if waveform.ndim != 3 or waveform.shape[0] != 1: + raise ValueError("Expected waveform tensor shape (1, channels, samples)") + + # If batch is > 1, take first item + if waveform.shape[0] > 1: + waveform = waveform[0] + + # Prepare for av: remove batch dim, move to CPU, make contiguous, convert to numpy array + audio_data_np = waveform.squeeze(0).cpu().contiguous().numpy() + if audio_data_np.dtype != np.float32: + audio_data_np = audio_data_np.astype(np.float32) + + return audio_data_np + + +def audio_ndarray_to_bytesio( + audio_data_np: np.ndarray, + sample_rate: int, + container_format: str = "mp4", + codec_name: str = "aac", +) -> BytesIO: + """ + Encodes a numpy array of audio data into a BytesIO object. + """ + audio_bytes_io = io.BytesIO() + with av.open(audio_bytes_io, mode="w", format=container_format) as output_container: + audio_stream = output_container.add_stream(codec_name, rate=sample_rate) + frame = av.AudioFrame.from_ndarray( + audio_data_np, + format="fltp", + layout="stereo" if audio_data_np.shape[0] > 1 else "mono", + ) + frame.sample_rate = sample_rate + frame.pts = 0 + + for packet in audio_stream.encode(frame): + output_container.mux(packet) + + # Flush stream + for packet in audio_stream.encode(None): + output_container.mux(packet) + + audio_bytes_io.seek(0) + return audio_bytes_io + + +def upload_audio_to_comfyapi( + audio: AudioInput, + auth_token: Optional[str] = None, + container_format: str = "mp4", + codec_name: str = "aac", + mime_type: str = "audio/mp4", + filename: str = "uploaded_audio.mp4", +) -> str: + """ + Uploads a single audio input to ComfyUI API and returns its download URL. + Encodes the raw waveform into the specified format before uploading. + + Args: + audio: a Comfy `AUDIO` type (contains waveform tensor and sample_rate) + auth_token: Optional authentication token. + + Returns: + The download URL for the uploaded audio file. + """ + sample_rate: int = audio["sample_rate"] + waveform: torch.Tensor = audio["waveform"] + audio_data_np = audio_tensor_to_contiguous_ndarray(waveform) + audio_bytes_io = audio_ndarray_to_bytesio( + audio_data_np, sample_rate, container_format, codec_name + ) + + return upload_file_to_comfyapi(audio_bytes_io, filename, mime_type, auth_token) + + +def upload_images_to_comfyapi( + image: torch.Tensor, max_images=8, auth_token=None, mime_type: Optional[str] = None +) -> list[str]: + """ + Uploads images to ComfyUI API and returns download URLs. + To upload multiple images, stack them in the batch dimension first. + + Args: + image: Input torch.Tensor image. + max_images: Maximum number of images to upload. + auth_token: Optional authentication token. + mime_type: Optional MIME type for the image. + """ + # if batch, try to upload each file if max_images is greater than 0 + idx_image = 0 + download_urls: list[str] = [] + is_batch = len(image.shape) > 3 + batch_length = 1 + if is_batch: + batch_length = image.shape[0] + while True: + curr_image = image + if len(image.shape) > 3: + curr_image = image[idx_image] + # get BytesIO version of image + img_binary = tensor_to_bytesio(curr_image, mime_type=mime_type) + # first, request upload/download urls from comfy API + if not mime_type: + request_object = UploadRequest(file_name=img_binary.name) + else: + request_object = UploadRequest( + file_name=img_binary.name, content_type=mime_type + ) + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/customers/storage", + method=HttpMethod.POST, + request_model=UploadRequest, + response_model=UploadResponse, + ), + request=request_object, + auth_token=auth_token, + ) + response = operation.execute() + + upload_response = ApiClient.upload_file( + response.upload_url, img_binary, content_type=mime_type + ) + # verify success + try: + upload_response.raise_for_status() + except requests.exceptions.HTTPError as e: + raise ValueError(f"Could not upload one or more images: {e}") from e + # add download_url to list + download_urls.append(response.download_url) + + idx_image += 1 + # stop uploading additional files if done + if is_batch and max_images > 0: + if idx_image >= max_images: + break + if idx_image >= batch_length: + break + return download_urls + + +def resize_mask_to_image(mask: torch.Tensor, image: torch.Tensor, + upscale_method="nearest-exact", crop="disabled", + allow_gradient=True, add_channel_dim=False): + """ + Resize mask to be the same dimensions as an image, while maintaining proper format for API calls. + """ + _, H, W, _ = image.shape + mask = mask.unsqueeze(-1) + mask = mask.movedim(-1,1) + mask = common_upscale(mask, width=W, height=H, upscale_method=upscale_method, crop=crop) + mask = mask.movedim(1,-1) + if not add_channel_dim: + mask = mask.squeeze(-1) + if not allow_gradient: + mask = (mask > 0.5).float() + return mask + + +def validate_string(string: str, strip_whitespace=True, field_name="prompt", min_length=None, max_length=None): + if strip_whitespace: + string = string.strip() + if min_length and len(string) < min_length: + raise Exception(f"Field '{field_name}' cannot be shorter than {min_length} characters; was {len(string)} characters long.") + if max_length and len(string) > max_length: + raise Exception(f" Field '{field_name} cannot be longer than {max_length} characters; was {len(string)} characters long.") + if not string: + raise Exception(f"Field '{field_name}' cannot be empty.") diff --git a/comfy_api_nodes/apis/PixverseController.py b/comfy_api_nodes/apis/PixverseController.py index 29a3ab33b..310c0f546 100644 --- a/comfy_api_nodes/apis/PixverseController.py +++ b/comfy_api_nodes/apis/PixverseController.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: -# filename: https://api.comfy.org/openapi -# timestamp: 2025-04-23T15:56:33+00:00 +# filename: filtered-openapi.yaml +# timestamp: 2025-04-29T23:44:54+00:00 from __future__ import annotations diff --git a/comfy_api_nodes/apis/PixverseDto.py b/comfy_api_nodes/apis/PixverseDto.py index 399512214..323c38e96 100644 --- a/comfy_api_nodes/apis/PixverseDto.py +++ b/comfy_api_nodes/apis/PixverseDto.py @@ -1,12 +1,12 @@ # generated by datamodel-codegen: -# filename: https://api.comfy.org/openapi -# timestamp: 2025-04-23T15:56:33+00:00 +# filename: filtered-openapi.yaml +# timestamp: 2025-04-29T23:44:54+00:00 from __future__ import annotations from typing import Optional -from pydantic import BaseModel, Field, constr +from pydantic import BaseModel, Field class V2OpenAPII2VResp(BaseModel): @@ -30,10 +30,10 @@ class V2OpenAPIT2VReq(BaseModel): description='Motion mode (normal, fast, --fast only available when duration=5; --quality=1080p does not support fast)', examples=['normal'], ) - negative_prompt: Optional[constr(max_length=2048)] = Field( - None, description='Negative prompt\n' + negative_prompt: Optional[str] = Field( + None, description='Negative prompt\n', max_length=2048 ) - prompt: constr(max_length=2048) = Field(..., description='Prompt') + prompt: str = Field(..., description='Prompt', max_length=2048) quality: str = Field( ..., description='Video quality ("360p"(Turbo model), "540p", "720p", "1080p")', diff --git a/comfy_api_nodes/apis/__init__.py b/comfy_api_nodes/apis/__init__.py index e7ea9b332..aa1c4ce0b 100644 --- a/comfy_api_nodes/apis/__init__.py +++ b/comfy_api_nodes/apis/__init__.py @@ -1,127 +1,455 @@ # generated by datamodel-codegen: -# filename: https://api.comfy.org/openapi -# timestamp: 2025-04-23T15:56:33+00:00 +# filename: filtered-openapi.yaml +# timestamp: 2025-05-04T04:12:39+00:00 from __future__ import annotations from datetime import datetime from enum import Enum -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List, Literal, Optional, Union +from uuid import UUID -from pydantic import AnyUrl, BaseModel, Field, confloat, conint - -class Customer(BaseModel): - createdAt: Optional[datetime] = Field( - None, description='The date and time the user was created' - ) - email: Optional[str] = Field(None, description='The email address for this user') - id: str = Field(..., description='The firebase UID of the user') - name: Optional[str] = Field(None, description='The name for this user') - updatedAt: Optional[datetime] = Field( - None, description='The date and time the user was last updated' - ) +from pydantic import AnyUrl, BaseModel, Field, RootModel, StrictBytes -class Error(BaseModel): - details: Optional[List[str]] = Field( +class PersonalAccessToken(BaseModel): + id: Optional[UUID] = Field(None, description='Unique identifier for the GitCommit') + name: Optional[str] = Field( None, - description='Optional detailed information about the error or hints for resolving it.', + description='Required. The name of the token. Can be a simple description.', ) - message: Optional[str] = Field( - None, description='A clear and concise description of the error.' + description: Optional[str] = Field( + None, + description="Optional. A more detailed description of the token's intended use.", ) + createdAt: Optional[datetime] = Field( + None, description='[Output Only]The date and time the token was created.' + ) + token: Optional[str] = Field( + None, + description='[Output Only]. The personal access token. Only returned during creation.', + ) + + +class GitCommitSummary(BaseModel): + commit_hash: Optional[str] = Field(None, description='The hash of the commit') + commit_name: Optional[str] = Field(None, description='The name of the commit') + branch_name: Optional[str] = Field( + None, description='The branch where the commit was made' + ) + author: Optional[str] = Field(None, description='The author of the commit') + timestamp: Optional[datetime] = Field( + None, description='The timestamp when the commit was made' + ) + status_summary: Optional[Dict[str, str]] = Field( + None, description='A map of operating system to status pairs' + ) + + +class User(BaseModel): + id: Optional[str] = Field(None, description='The unique id for this user.') + email: Optional[str] = Field(None, description='The email address for this user.') + name: Optional[str] = Field(None, description='The name for this user.') + isApproved: Optional[bool] = Field( + None, description='Indicates if the user is approved.' + ) + isAdmin: Optional[bool] = Field( + None, description='Indicates if the user has admin privileges.' + ) + + +class PublisherUser(BaseModel): + id: Optional[str] = Field(None, description='The unique id for this user.') + email: Optional[str] = Field(None, description='The email address for this user.') + name: Optional[str] = Field(None, description='The name for this user.') class ErrorResponse(BaseModel): error: str message: str + +class StorageFile(BaseModel): + id: Optional[UUID] = Field( + None, description='Unique identifier for the storage file' + ) + file_path: Optional[str] = Field(None, description='Path to the file in storage') + public_url: Optional[str] = Field(None, description='Public URL') + + +class PublisherMember(BaseModel): + id: Optional[str] = Field( + None, description='The unique identifier for the publisher member.' + ) + user: Optional[PublisherUser] = Field( + None, description='The user associated with this publisher member.' + ) + role: Optional[str] = Field( + None, description='The role of the user in the publisher.' + ) + + +class ComfyNode(BaseModel): + comfy_node_name: Optional[str] = Field( + None, description='Unique identifier for the node' + ) + category: Optional[str] = Field( + None, + description='UI category where the node is listed, used for grouping nodes.', + ) + description: Optional[str] = Field( + None, description="Brief description of the node's functionality or purpose." + ) + input_types: Optional[str] = Field(None, description='Defines input parameters') + deprecated: Optional[bool] = Field( + None, + description='Indicates if the node is deprecated. Deprecated nodes are hidden in the UI.', + ) + experimental: Optional[bool] = Field( + None, + description='Indicates if the node is experimental, subject to changes or removal.', + ) + output_is_list: Optional[List[bool]] = Field( + None, description='Boolean values indicating if each output is a list.' + ) + return_names: Optional[str] = Field( + None, description='Names of the outputs for clarity in workflows.' + ) + return_types: Optional[str] = Field( + None, description='Specifies the types of outputs produced by the node.' + ) + function: Optional[str] = Field( + None, description='Name of the entry-point function to execute the node.' + ) + + +class ComfyNodeCloudBuildInfo(BaseModel): + project_id: Optional[str] = None + project_number: Optional[str] = None + location: Optional[str] = None + build_id: Optional[str] = None + + +class Error(BaseModel): + message: Optional[str] = Field( + None, description='A clear and concise description of the error.' + ) + details: Optional[List[str]] = Field( + None, + description='Optional detailed information about the error or hints for resolving it.', + ) + + +class NodeVersionUpdateRequest(BaseModel): + changelog: Optional[str] = Field( + None, description='The changelog describing the version changes.' + ) + deprecated: Optional[bool] = Field( + None, description='Whether the version is deprecated.' + ) + + +class NodeStatus(str, Enum): + NodeStatusActive = 'NodeStatusActive' + NodeStatusDeleted = 'NodeStatusDeleted' + NodeStatusBanned = 'NodeStatusBanned' + + +class NodeVersionStatus(str, Enum): + NodeVersionStatusActive = 'NodeVersionStatusActive' + NodeVersionStatusDeleted = 'NodeVersionStatusDeleted' + NodeVersionStatusBanned = 'NodeVersionStatusBanned' + NodeVersionStatusPending = 'NodeVersionStatusPending' + NodeVersionStatusFlagged = 'NodeVersionStatusFlagged' + + +class PublisherStatus(str, Enum): + PublisherStatusActive = 'PublisherStatusActive' + PublisherStatusBanned = 'PublisherStatusBanned' + + +class WorkflowRunStatus(str, Enum): + WorkflowRunStatusStarted = 'WorkflowRunStatusStarted' + WorkflowRunStatusFailed = 'WorkflowRunStatusFailed' + WorkflowRunStatusCompleted = 'WorkflowRunStatusCompleted' + + +class MachineStats(BaseModel): + machine_name: Optional[str] = Field(None, description='Name of the machine.') + os_version: Optional[str] = Field( + None, description='The operating system version. eg. Ubuntu Linux 20.04' + ) + gpu_type: Optional[str] = Field( + None, description='The GPU type. eg. NVIDIA Tesla K80' + ) + cpu_capacity: Optional[str] = Field(None, description='Total CPU on the machine.') + initial_cpu: Optional[str] = Field( + None, description='Initial CPU available before the job starts.' + ) + memory_capacity: Optional[str] = Field( + None, description='Total memory on the machine.' + ) + initial_ram: Optional[str] = Field( + None, description='Initial RAM available before the job starts.' + ) + vram_time_series: Optional[Dict[str, Any]] = Field( + None, description='Time series of VRAM usage.' + ) + disk_capacity: Optional[str] = Field( + None, description='Total disk capacity on the machine.' + ) + initial_disk: Optional[str] = Field( + None, description='Initial disk available before the job starts.' + ) + pip_freeze: Optional[str] = Field(None, description='The pip freeze output') + + +class Customer(BaseModel): + id: str = Field(..., description='The firebase UID of the user') + email: Optional[str] = Field(None, description='The email address for this user') + name: Optional[str] = Field(None, description='The name for this user') + createdAt: Optional[datetime] = Field( + None, description='The date and time the user was created' + ) + updatedAt: Optional[datetime] = Field( + None, description='The date and time the user was last updated' + ) + + +class MagicPrompt(str, Enum): + ON = 'ON' + OFF = 'OFF' + + +class ColorPalette(BaseModel): + name: str = Field(..., description='Name of the color palette', examples=['PASTEL']) + + +class StyleCode(RootModel[str]): + root: str = Field(..., pattern='^[0-9A-Fa-f]{8}$') + + +class StyleType(str, Enum): + GENERAL = 'GENERAL' + + +class IdeogramColorPalette1(BaseModel): + name: str = Field(..., description='Name of the preset color palette') + + +class Member(BaseModel): + color: Optional[str] = Field( + None, description='Hexadecimal color code', pattern='^#[0-9A-Fa-f]{6}$' + ) + weight: Optional[float] = Field( + None, description='Optional weight for the color (0-1)', ge=0.0, le=1.0 + ) + + +class IdeogramColorPalette2(BaseModel): + members: List[Member] = Field( + ..., description='Array of color definitions with optional weights' + ) + + +class IdeogramColorPalette( + RootModel[Union[IdeogramColorPalette1, IdeogramColorPalette2]] +): + root: Union[IdeogramColorPalette1, IdeogramColorPalette2] = Field( + ..., + description='A color palette specification that can either use a preset name or explicit color definitions with weights', + ) + + class ImageRequest(BaseModel): + prompt: str = Field( + ..., description='Required. The prompt to use to generate the image.' + ) aspect_ratio: Optional[str] = Field( None, description="Optional. The aspect ratio (e.g., 'ASPECT_16_9', 'ASPECT_1_1'). Cannot be used with resolution. Defaults to 'ASPECT_1_1' if unspecified.", ) - color_palette: Optional[Dict[str, Any]] = Field( - None, description='Optional. Color palette object. Only for V_2, V_2_TURBO.' - ) + model: str = Field(..., description="The model used (e.g., 'V_2', 'V_2A_TURBO')") magic_prompt_option: Optional[str] = Field( None, description="Optional. MagicPrompt usage ('AUTO', 'ON', 'OFF')." ) - model: str = Field(..., description="The model used (e.g., 'V_2', 'V_2A_TURBO')") - negative_prompt: Optional[str] = Field( + seed: Optional[int] = Field( None, - description='Optional. Description of what to exclude. Only for V_1, V_1_TURBO, V_2, V_2_TURBO.', - ) - num_images: Optional[conint(ge=1, le=8)] = Field( - 1, description='Optional. Number of images to generate (1-8). Defaults to 1.' - ) - prompt: str = Field( - ..., description='Required. The prompt to use to generate the image.' - ) - resolution: Optional[str] = Field( - None, - description="Optional. Resolution (e.g., 'RESOLUTION_1024_1024'). Only for model V_2. Cannot be used with aspect_ratio.", - ) - seed: Optional[conint(ge=0, le=2147483647)] = Field( - None, description='Optional. A number between 0 and 2147483647.' + description='Optional. A number between 0 and 2147483647.', + ge=0, + le=2147483647, ) style_type: Optional[str] = Field( None, description="Optional. Style type ('AUTO', 'GENERAL', 'REALISTIC', 'DESIGN', 'RENDER_3D', 'ANIME'). Only for models V_2 and above.", ) + negative_prompt: Optional[str] = Field( + None, + description='Optional. Description of what to exclude. Only for V_1, V_1_TURBO, V_2, V_2_TURBO.', + ) + num_images: Optional[int] = Field( + 1, + description='Optional. Number of images to generate (1-8). Defaults to 1.', + ge=1, + le=8, + ) + resolution: Optional[str] = Field( + None, + description="Optional. Resolution (e.g., 'RESOLUTION_1024_1024'). Only for model V_2. Cannot be used with aspect_ratio.", + ) + color_palette: Optional[Dict[str, Any]] = Field( + None, description='Optional. Color palette object. Only for V_2, V_2_TURBO.' + ) + + +class IdeogramGenerateRequest(BaseModel): + image_request: ImageRequest = Field( + ..., description='The image generation request parameters.' + ) class Datum(BaseModel): - is_image_safe: Optional[bool] = Field( - None, description='Indicates whether the image is considered safe.' - ) prompt: Optional[str] = Field( None, description='The prompt used to generate this image.' ) resolution: Optional[str] = Field( None, description="The resolution of the generated image (e.g., '1024x1024')." ) + is_image_safe: Optional[bool] = Field( + None, description='Indicates whether the image is considered safe.' + ) seed: Optional[int] = Field( None, description='The seed value used for this generation.' ) + url: Optional[str] = Field(None, description='URL to the generated image.') style_type: Optional[str] = Field( None, description="The style type used for generation (e.g., 'REALISTIC', 'ANIME').", ) - url: Optional[str] = Field(None, description='URL to the generated image.') -class Code(Enum): - int_1100 = 1100 - int_1101 = 1101 - int_1102 = 1102 - int_1103 = 1103 +class IdeogramGenerateResponse(BaseModel): + created: Optional[datetime] = Field( + None, description='Timestamp when the generation was created.' + ) + data: Optional[List[Datum]] = Field( + None, description='Array of generated image information.' + ) -class Code1(Enum): - int_1000 = 1000 - int_1001 = 1001 - int_1002 = 1002 - int_1003 = 1003 - int_1004 = 1004 +class RenderingSpeed1(str, Enum): + TURBO = 'TURBO' + DEFAULT = 'DEFAULT' + QUALITY = 'QUALITY' -class AspectRatio(str, Enum): +class MagicPrompt1(str, Enum): + AUTO = 'AUTO' + ON = 'ON' + OFF = 'OFF' + + +class StyleType1(str, Enum): + AUTO = 'AUTO' + GENERAL = 'GENERAL' + REALISTIC = 'REALISTIC' + DESIGN = 'DESIGN' + + +class IdeogramV3RemixRequest(BaseModel): + image: Optional[StrictBytes] = None + prompt: str + image_weight: Optional[int] = Field(50, ge=1, le=100) + seed: Optional[int] = Field(None, ge=0, le=2147483647) + resolution: Optional[str] = None + aspect_ratio: Optional[str] = None + rendering_speed: Optional[RenderingSpeed1] = None + magic_prompt: Optional[MagicPrompt1] = None + negative_prompt: Optional[str] = None + num_images: Optional[int] = Field(None, ge=1, le=8) + color_palette: Optional[Dict[str, Any]] = None + style_codes: Optional[List[str]] = None + style_type: Optional[StyleType1] = None + style_reference_images: Optional[List[StrictBytes]] = None + + +class Datum1(BaseModel): + prompt: Optional[str] = None + resolution: Optional[str] = None + is_image_safe: Optional[bool] = None + seed: Optional[int] = None + url: Optional[str] = None + style_type: Optional[str] = None + + +class IdeogramV3IdeogramResponse(BaseModel): + created: Optional[datetime] = None + data: Optional[List[Datum1]] = None + + +class IdeogramV3ReframeRequest(BaseModel): + image: Optional[StrictBytes] = None + resolution: str + num_images: Optional[int] = Field(None, ge=1, le=8) + seed: Optional[int] = Field(None, ge=0, le=2147483647) + rendering_speed: Optional[RenderingSpeed1] = None + color_palette: Optional[Dict[str, Any]] = None + style_codes: Optional[List[str]] = None + style_reference_images: Optional[List[StrictBytes]] = None + + +class IdeogramV3ReplaceBackgroundRequest(BaseModel): + image: Optional[StrictBytes] = None + prompt: str + magic_prompt: Optional[MagicPrompt1] = None + num_images: Optional[int] = Field(None, ge=1, le=8) + seed: Optional[int] = Field(None, ge=0, le=2147483647) + rendering_speed: Optional[RenderingSpeed1] = None + color_palette: Optional[Dict[str, Any]] = None + style_codes: Optional[List[str]] = None + style_reference_images: Optional[List[StrictBytes]] = None + + +class KlingTaskStatus(str, Enum): + submitted = 'submitted' + processing = 'processing' + succeed = 'succeed' + failed = 'failed' + + +class KlingVideoGenModelName(str, Enum): + kling_v1 = 'kling-v1' + kling_v1_5 = 'kling-v1-5' + kling_v1_6 = 'kling-v1-6' + kling_v2_master = 'kling-v2-master' + + +class KlingVideoGenMode(str, Enum): + std = 'std' + pro = 'pro' + + +class KlingVideoGenAspectRatio(str, Enum): field_16_9 = '16:9' field_9_16 = '9:16' field_1_1 = '1:1' -class Config(BaseModel): - horizontal: Optional[confloat(ge=-10.0, le=10.0)] = None - pan: Optional[confloat(ge=-10.0, le=10.0)] = None - roll: Optional[confloat(ge=-10.0, le=10.0)] = None - tilt: Optional[confloat(ge=-10.0, le=10.0)] = None - vertical: Optional[confloat(ge=-10.0, le=10.0)] = None - zoom: Optional[confloat(ge=-10.0, le=10.0)] = None +class KlingVideoGenDuration(str, Enum): + field_5 = '5' + field_10 = '10' -class Type(str, Enum): +class KlingVideoGenCfgScale(RootModel[float]): + root: float = Field( + ..., + description="Flexibility in video generation. The higher the value, the lower the model's degree of flexibility, and the stronger the relevance to the user's prompt.", + ge=0.0, + le=1.0, + ) + + +class KlingCameraControlType(str, Enum): simple = 'simple' down_back = 'down_back' forward_up = 'forward_up' @@ -129,52 +457,99 @@ class Type(str, Enum): left_turn_forward = 'left_turn_forward' -class CameraControl(BaseModel): - config: Optional[Config] = None - type: Optional[Type] = Field(None, description='Predefined camera movements type') +class KlingCameraConfig(BaseModel): + horizontal: Optional[float] = Field( + None, + description="Controls camera's movement along horizontal axis (x-axis). Negative indicates left, positive indicates right.", + ge=-10.0, + le=10.0, + ) + vertical: Optional[float] = Field( + None, + description="Controls camera's movement along vertical axis (y-axis). Negative indicates downward, positive indicates upward.", + ge=-10.0, + le=10.0, + ) + pan: Optional[float] = Field( + None, + description="Controls camera's rotation in vertical plane (x-axis). Negative indicates downward rotation, positive indicates upward rotation.", + ge=-10.0, + le=10.0, + ) + tilt: Optional[float] = Field( + None, + description="Controls camera's rotation in horizontal plane (y-axis). Negative indicates left rotation, positive indicates right rotation.", + ge=-10.0, + le=10.0, + ) + roll: Optional[float] = Field( + None, + description="Controls camera's rolling amount (z-axis). Negative indicates counterclockwise, positive indicates clockwise.", + ge=-10.0, + le=10.0, + ) + zoom: Optional[float] = Field( + None, + description="Controls change in camera's focal length. Negative indicates narrower field of view, positive indicates wider field of view.", + ge=-10.0, + le=10.0, + ) -class Duration(str, Enum): - field_5 = 5 - field_10 = 10 - - -class Mode(str, Enum): - std = 'std' - pro = 'pro' - - -class TaskInfo(BaseModel): - external_task_id: Optional[str] = None - - -class Video(BaseModel): - duration: Optional[str] = Field(None, description='Total video duration') +class KlingVideoResult(BaseModel): id: Optional[str] = Field(None, description='Generated video ID') url: Optional[AnyUrl] = Field(None, description='URL for generated video') + duration: Optional[str] = Field(None, description='Total video duration') -class TaskResult(BaseModel): - videos: Optional[List[Video]] = None +class KlingAudioUploadType(str, Enum): + file = 'file' + url = 'url' -class TaskStatus(str, Enum): - submitted = 'submitted' - processing = 'processing' - succeed = 'succeed' - failed = 'failed' +class KlingLipSyncMode(str, Enum): + text2video = 'text2video' + audio2video = 'audio2video' -class Data(BaseModel): - created_at: Optional[int] = Field(None, description='Task creation time') - task_id: Optional[str] = Field(None, description='Task ID') - task_info: Optional[TaskInfo] = None - task_result: Optional[TaskResult] = None - task_status: Optional[TaskStatus] = None - updated_at: Optional[int] = Field(None, description='Task update time') +class KlingLipSyncVoiceLanguage(str, Enum): + zh = 'zh' + en = 'en' -class AspectRatio1(str, Enum): +class KlingDualCharacterEffectsScene(str, Enum): + hug = 'hug' + kiss = 'kiss' + heart_gesture = 'heart_gesture' + + +class KlingSingleImageEffectsScene(str, Enum): + bloombloom = 'bloombloom' + dizzydizzy = 'dizzydizzy' + fuzzyfuzzy = 'fuzzyfuzzy' + squish = 'squish' + expansion = 'expansion' + + +class KlingCharacterEffectModelName(str, Enum): + kling_v1 = 'kling-v1' + kling_v1_5 = 'kling-v1-5' + kling_v1_6 = 'kling-v1-6' + + +class KlingSingleImageEffectModelName(str, Enum): + kling_v1_6 = 'kling-v1-6' + + +class KlingSingleImageEffectDuration(str, Enum): + field_5 = '5' + + +class KlingDualCharacterImages(RootModel[List[str]]): + root: List[str] = Field(..., max_length=2, min_length=2) + + +class KlingImageGenAspectRatio(str, Enum): field_16_9 = '16:9' field_9_16 = '9:16' field_1_1 = '1:1' @@ -185,63 +560,289 @@ class AspectRatio1(str, Enum): field_21_9 = '21:9' -class ImageReference(str, Enum): +class KlingImageGenImageReferenceType(str, Enum): subject = 'subject' face = 'face' -class Image(BaseModel): +class KlingImageGenModelName(str, Enum): + kling_v1 = 'kling-v1' + kling_v1_5 = 'kling-v1-5' + kling_v2 = 'kling-v2' + + +class KlingImageResult(BaseModel): index: Optional[int] = Field(None, description='Image Number (0-9)') url: Optional[AnyUrl] = Field(None, description='URL for generated image') -class TaskResult1(BaseModel): - images: Optional[List[Image]] = None +class KlingVirtualTryOnModelName(str, Enum): + kolors_virtual_try_on_v1 = 'kolors-virtual-try-on-v1' + kolors_virtual_try_on_v1_5 = 'kolors-virtual-try-on-v1-5' + + +class TaskInfo(BaseModel): + external_task_id: Optional[str] = None + + +class TaskResult(BaseModel): + videos: Optional[List[KlingVideoResult]] = None + + +class Data(BaseModel): + task_id: Optional[str] = Field(None, description='Task ID') + task_status: Optional[KlingTaskStatus] = None + task_info: Optional[TaskInfo] = None + created_at: Optional[int] = Field(None, description='Task creation time') + updated_at: Optional[int] = Field(None, description='Task update time') + task_result: Optional[TaskResult] = None + + +class KlingText2VideoResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') + data: Optional[Data] = None + + +class Trajectory(BaseModel): + x: Optional[int] = Field( + None, + description='The horizontal coordinate of trajectory point. Based on bottom-left corner of image as origin (0,0).', + ) + y: Optional[int] = Field( + None, + description='The vertical coordinate of trajectory point. Based on bottom-left corner of image as origin (0,0).', + ) + + +class DynamicMask(BaseModel): + mask: Optional[AnyUrl] = Field( + None, + description='Dynamic Brush Application Area (Mask image created by users using the motion brush). The aspect ratio must match the input image.', + ) + trajectories: Optional[List[Trajectory]] = None class Data1(BaseModel): - created_at: Optional[int] = Field(None, description='Task creation time') task_id: Optional[str] = Field(None, description='Task ID') - task_result: Optional[TaskResult1] = None - task_status: Optional[TaskStatus] = None - task_status_msg: Optional[str] = Field(None, description='Task status information') + task_status: Optional[KlingTaskStatus] = None + task_info: Optional[TaskInfo] = None + created_at: Optional[int] = Field(None, description='Task creation time') updated_at: Optional[int] = Field(None, description='Task update time') + task_result: Optional[TaskResult] = None -class AspectRatio2(str, Enum): - field_16_9 = '16:9' - field_9_16 = '9:16' - field_1_1 = '1:1' +class KlingImage2VideoResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') + data: Optional[Data1] = None -class CameraControl1(BaseModel): - config: Optional[Config] = None - type: Optional[Type] = Field(None, description='Predefined camera movements type') - - -class ModelName2(str, Enum): - kling_v1 = 'kling-v1' - kling_v1_6 = 'kling-v1-6' - - -class TaskResult2(BaseModel): - videos: Optional[List[Video]] = None +class KlingVideoExtendRequest(BaseModel): + video_id: Optional[str] = Field( + None, + description='The ID of the video to be extended. Supports videos generated by text-to-video, image-to-video, and previous video extension operations. Cannot exceed 3 minutes total duration after extension.', + ) + prompt: Optional[str] = Field( + None, + description='Positive text prompt for guiding the video extension', + max_length=2500, + ) + negative_prompt: Optional[str] = Field( + None, + description='Negative text prompt for elements to avoid in the extended video', + max_length=2500, + ) + cfg_scale: Optional[KlingVideoGenCfgScale] = Field( + default_factory=lambda: KlingVideoGenCfgScale.model_validate(0.5) + ) + callback_url: Optional[AnyUrl] = Field( + None, + description='The callback notification address. Server will notify when the task status changes.', + ) class Data2(BaseModel): - created_at: Optional[int] = Field(None, description='Task creation time') task_id: Optional[str] = Field(None, description='Task ID') + task_status: Optional[KlingTaskStatus] = None task_info: Optional[TaskInfo] = None - task_result: Optional[TaskResult2] = None - task_status: Optional[TaskStatus] = None + created_at: Optional[int] = Field(None, description='Task creation time') updated_at: Optional[int] = Field(None, description='Task update time') + task_result: Optional[TaskResult] = None -class Code2(Enum): - int_1200 = 1200 - int_1201 = 1201 - int_1202 = 1202 - int_1203 = 1203 +class KlingVideoExtendResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') + data: Optional[Data2] = None + + +class KlingLipSyncInputObject(BaseModel): + video_id: Optional[str] = Field( + None, + description='The ID of the video generated by Kling AI. Only supports 5-second and 10-second videos generated within the last 30 days.', + ) + video_url: Optional[str] = Field( + None, + description='Get link for uploaded video. Video files support .mp4/.mov, file size does not exceed 100MB, video length between 2-10s.', + ) + mode: KlingLipSyncMode + text: Optional[str] = Field( + None, + description='Text Content for Lip-Sync Video Generation. Required when mode is text2video. Maximum length is 120 characters.', + ) + voice_id: Optional[str] = Field( + None, + description='Voice ID. Required when mode is text2video. The system offers a variety of voice options to choose from.', + ) + voice_language: Optional[KlingLipSyncVoiceLanguage] = 'en' + voice_speed: Optional[float] = Field( + 1, + description='Speech Rate. Valid range: 0.8~2.0, accurate to one decimal place.', + ge=0.8, + le=2.0, + ) + audio_type: Optional[KlingAudioUploadType] = None + audio_file: Optional[str] = Field( + None, + description='Local Path of Audio File. Supported formats: .mp3/.wav/.m4a/.aac, maximum file size of 5MB. Base64 code.', + ) + audio_url: Optional[str] = Field( + None, + description='Audio File Download URL. Supported formats: .mp3/.wav/.m4a/.aac, maximum file size of 5MB.', + ) + + +class KlingLipSyncRequest(BaseModel): + input: KlingLipSyncInputObject + callback_url: Optional[AnyUrl] = Field( + None, + description='The callback notification address. Server will notify when the task status changes.', + ) + + +class Data3(BaseModel): + task_id: Optional[str] = Field(None, description='Task ID') + task_status: Optional[KlingTaskStatus] = None + task_info: Optional[TaskInfo] = None + created_at: Optional[int] = Field(None, description='Task creation time') + updated_at: Optional[int] = Field(None, description='Task update time') + task_result: Optional[TaskResult] = None + + +class KlingLipSyncResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') + data: Optional[Data3] = None + + +class KlingSingleImageEffectInput(BaseModel): + model_name: KlingSingleImageEffectModelName + image: str = Field( + ..., + description='Reference Image. URL or Base64 encoded string (without data:image prefix). File size cannot exceed 10MB, resolution not less than 300*300px, aspect ratio between 1:2.5 ~ 2.5:1.', + ) + duration: KlingSingleImageEffectDuration + + +class KlingDualCharacterEffectInput(BaseModel): + model_name: Optional[KlingCharacterEffectModelName] = 'kling-v1' + mode: Optional[KlingVideoGenMode] = 'std' + images: KlingDualCharacterImages + duration: KlingVideoGenDuration + + +class Data4(BaseModel): + task_id: Optional[str] = Field(None, description='Task ID') + task_status: Optional[KlingTaskStatus] = None + task_info: Optional[TaskInfo] = None + created_at: Optional[int] = Field(None, description='Task creation time') + updated_at: Optional[int] = Field(None, description='Task update time') + task_result: Optional[TaskResult] = None + + +class KlingVideoEffectsResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') + data: Optional[Data4] = None + + +class KlingImageGenerationsRequest(BaseModel): + model_name: Optional[KlingImageGenModelName] = 'kling-v1' + prompt: str = Field(..., description='Positive text prompt', max_length=500) + negative_prompt: Optional[str] = Field( + None, description='Negative text prompt', max_length=200 + ) + image: Optional[str] = Field( + None, description='Reference Image - Base64 encoded string or image URL' + ) + image_reference: Optional[KlingImageGenImageReferenceType] = None + image_fidelity: Optional[float] = Field( + 0.5, description='Reference intensity for user-uploaded images', ge=0.0, le=1.0 + ) + human_fidelity: Optional[float] = Field( + 0.45, description='Subject reference similarity', ge=0.0, le=1.0 + ) + n: Optional[int] = Field(1, description='Number of generated images', ge=1, le=9) + aspect_ratio: Optional[KlingImageGenAspectRatio] = '16:9' + callback_url: Optional[AnyUrl] = Field( + None, description='The callback notification address' + ) + + +class TaskResult5(BaseModel): + images: Optional[List[KlingImageResult]] = None + + +class Data5(BaseModel): + task_id: Optional[str] = Field(None, description='Task ID') + task_status: Optional[KlingTaskStatus] = None + task_status_msg: Optional[str] = Field(None, description='Task status information') + created_at: Optional[int] = Field(None, description='Task creation time') + updated_at: Optional[int] = Field(None, description='Task update time') + task_result: Optional[TaskResult5] = None + + +class KlingImageGenerationsResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') + data: Optional[Data5] = None + + +class KlingVirtualTryOnRequest(BaseModel): + model_name: Optional[KlingVirtualTryOnModelName] = 'kolors-virtual-try-on-v1' + human_image: str = Field( + ..., description='Reference human image - Base64 encoded string or image URL' + ) + cloth_image: Optional[str] = Field( + None, + description='Reference clothing image - Base64 encoded string or image URL', + ) + callback_url: Optional[AnyUrl] = Field( + None, description='The callback notification address' + ) + + +class Data6(BaseModel): + task_id: Optional[str] = Field(None, description='Task ID') + task_status: Optional[KlingTaskStatus] = None + task_status_msg: Optional[str] = Field(None, description='Task status information') + created_at: Optional[int] = Field(None, description='Task creation time') + updated_at: Optional[int] = Field(None, description='Task update time') + task_result: Optional[TaskResult5] = None + + +class KlingVirtualTryOnResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') + data: Optional[Data6] = None class ResourcePackType(str, Enum): @@ -257,87 +858,1140 @@ class Status(str, Enum): class ResourcePackSubscribeInfo(BaseModel): + resource_pack_name: Optional[str] = Field(None, description='Resource package name') + resource_pack_id: Optional[str] = Field(None, description='Resource package ID') + resource_pack_type: Optional[ResourcePackType] = Field( + None, + description='Resource package type (decreasing_total=decreasing total, constant_period=constant periodicity)', + ) + total_quantity: Optional[float] = Field(None, description='Total quantity') + remaining_quantity: Optional[float] = Field( + None, description='Remaining quantity (updated with a 12-hour delay)' + ) + purchase_time: Optional[int] = Field( + None, description='Purchase time, Unix timestamp in ms' + ) effective_time: Optional[int] = Field( None, description='Effective time, Unix timestamp in ms' ) invalid_time: Optional[int] = Field( None, description='Expiration time, Unix timestamp in ms' ) - purchase_time: Optional[int] = Field( - None, description='Purchase time, Unix timestamp in ms' - ) - remaining_quantity: Optional[float] = Field( - None, description='Remaining quantity (updated with a 12-hour delay)' - ) - resource_pack_id: Optional[str] = Field(None, description='Resource package ID') - resource_pack_name: Optional[str] = Field(None, description='Resource package name') - resource_pack_type: Optional[ResourcePackType] = Field( - None, - description='Resource package type (decreasing_total=decreasing total, constant_period=constant periodicity)', - ) status: Optional[Status] = Field(None, description='Resource Package Status') - total_quantity: Optional[float] = Field(None, description='Total quantity') - -class Background(str, Enum): - transparent = 'transparent' - opaque = 'opaque' -class Moderation(str, Enum): - low = 'low' - auto = 'auto' +class Data7(BaseModel): + code: Optional[int] = Field(None, description='Error code; 0 indicates success') + msg: Optional[str] = Field(None, description='Error information') + resource_pack_subscribe_infos: Optional[List[ResourcePackSubscribeInfo]] = Field( + None, description='Resource package list' + ) + + +class KlingResourcePackageResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code; 0 indicates success') + message: Optional[str] = Field(None, description='Error information') + request_id: Optional[str] = Field( + None, + description='Request ID, generated by the system, used to track requests and troubleshoot problems', + ) + data: Optional[Data7] = None + + +class Object(str, Enum): + event = 'event' + + +class Type(str, Enum): + payment_intent_succeeded = 'payment_intent.succeeded' + + +class StripeRequestInfo(BaseModel): + id: Optional[str] = None + idempotency_key: Optional[str] = None + + +class Object1(str, Enum): + payment_intent = 'payment_intent' + + +class StripeAmountDetails(BaseModel): + tip: Optional[Dict[str, Any]] = None + + +class Object2(str, Enum): + charge = 'charge' + + +class StripeAddress(BaseModel): + city: Optional[str] = None + country: Optional[str] = None + line1: Optional[str] = None + line2: Optional[str] = None + postal_code: Optional[str] = None + state: Optional[str] = None + + +class StripeOutcome(BaseModel): + advice_code: Optional[Any] = None + network_advice_code: Optional[Any] = None + network_decline_code: Optional[Any] = None + network_status: Optional[str] = None + reason: Optional[Any] = None + risk_level: Optional[str] = None + risk_score: Optional[int] = None + seller_message: Optional[str] = None + type: Optional[str] = None + + +class Checks(BaseModel): + address_line1_check: Optional[Any] = None + address_postal_code_check: Optional[Any] = None + cvc_check: Optional[str] = None + + +class ExtendedAuthorization(BaseModel): + status: Optional[str] = None + + +class IncrementalAuthorization(BaseModel): + status: Optional[str] = None + + +class Multicapture(BaseModel): + status: Optional[str] = None + + +class NetworkToken(BaseModel): + used: Optional[bool] = None + + +class Overcapture(BaseModel): + maximum_amount_capturable: Optional[int] = None + status: Optional[str] = None + + +class StripeCardDetails(BaseModel): + amount_authorized: Optional[int] = None + authorization_code: Optional[Any] = None + brand: Optional[str] = None + checks: Optional[Checks] = None + country: Optional[str] = None + exp_month: Optional[int] = None + exp_year: Optional[int] = None + extended_authorization: Optional[ExtendedAuthorization] = None + fingerprint: Optional[str] = None + funding: Optional[str] = None + incremental_authorization: Optional[IncrementalAuthorization] = None + installments: Optional[Any] = None + last4: Optional[str] = None + mandate: Optional[Any] = None + multicapture: Optional[Multicapture] = None + network: Optional[str] = None + network_token: Optional[NetworkToken] = None + network_transaction_id: Optional[str] = None + overcapture: Optional[Overcapture] = None + regulated_status: Optional[str] = None + three_d_secure: Optional[Any] = None + wallet: Optional[Any] = None + + +class StripeRefundList(BaseModel): + object: Optional[str] = None + data: Optional[List[Dict[str, Any]]] = None + has_more: Optional[bool] = None + total_count: Optional[int] = None + url: Optional[str] = None + + +class Card(BaseModel): + installments: Optional[Any] = None + mandate_options: Optional[Any] = None + network: Optional[Any] = None + request_three_d_secure: Optional[str] = None + + +class StripePaymentMethodOptions(BaseModel): + card: Optional[Card] = None + + +class StripeShipping(BaseModel): + address: Optional[StripeAddress] = None + carrier: Optional[str] = None + name: Optional[str] = None + phone: Optional[str] = None + tracking_number: Optional[str] = None + + +class Model(str, Enum): + T2V_01_Director = 'T2V-01-Director' + I2V_01_Director = 'I2V-01-Director' + S2V_01 = 'S2V-01' + I2V_01 = 'I2V-01' + I2V_01_live = 'I2V-01-live' + T2V_01 = 'T2V-01' + + +class SubjectReferenceItem(BaseModel): + image: Optional[str] = Field( + None, description='URL or base64 encoding of the subject reference image.' + ) + mask: Optional[str] = Field( + None, + description='URL or base64 encoding of the mask for the subject reference image.', + ) + + +class MinimaxVideoGenerationRequest(BaseModel): + model: Model = Field( + ..., + description='Required. ID of model. Options: T2V-01-Director, I2V-01-Director, S2V-01, I2V-01, I2V-01-live, T2V-01', + ) + prompt: Optional[str] = Field( + None, + description='Description of the video. Should be less than 2000 characters. Supports camera movement instructions in [brackets].', + max_length=2000, + ) + prompt_optimizer: Optional[bool] = Field( + True, + description='If true (default), the model will automatically optimize the prompt. Set to false for more precise control.', + ) + first_frame_image: Optional[str] = Field( + None, + description='URL or base64 encoding of the first frame image. Required when model is I2V-01, I2V-01-Director, or I2V-01-live.', + ) + subject_reference: Optional[List[SubjectReferenceItem]] = Field( + None, + description='Only available when model is S2V-01. The model will generate a video based on the subject uploaded through this parameter.', + ) + callback_url: Optional[str] = Field( + None, + description='Optional. URL to receive real-time status updates about the video generation task.', + ) + + +class MinimaxBaseResponse(BaseModel): + status_code: int = Field( + ..., + description='Status code. 0 indicates success, other values indicate errors.', + ) + status_msg: str = Field( + ..., description='Specific error details or success message.' + ) + + +class MinimaxVideoGenerationResponse(BaseModel): + task_id: str = Field( + ..., description='The task ID for the asynchronous video generation task.' + ) + base_resp: MinimaxBaseResponse + + +class File(BaseModel): + file_id: Optional[int] = Field(None, description='Unique identifier for the file') + bytes: Optional[int] = Field(None, description='File size in bytes') + created_at: Optional[int] = Field( + None, description='Unix timestamp when the file was created, in seconds' + ) + filename: Optional[str] = Field(None, description='The name of the file') + purpose: Optional[str] = Field(None, description='The purpose of using the file') + download_url: Optional[str] = Field( + None, description='The URL to download the video' + ) + + +class MinimaxFileRetrieveResponse(BaseModel): + file: File + base_resp: MinimaxBaseResponse + + +class Status1(str, Enum): + Queueing = 'Queueing' + Preparing = 'Preparing' + Processing = 'Processing' + Success = 'Success' + Fail = 'Fail' + + +class MinimaxTaskResultResponse(BaseModel): + task_id: str = Field(..., description='The task ID being queried.') + status: Status1 = Field( + ..., + description="Task status: 'Queueing' (in queue), 'Preparing' (task is preparing), 'Processing' (generating), 'Success' (task completed successfully), or 'Fail' (task failed).", + ) + file_id: Optional[str] = Field( + None, + description='After the task status changes to Success, this field returns the file ID corresponding to the generated video.', + ) + base_resp: MinimaxBaseResponse class OutputFormat(str, Enum): - png = 'png' - webp = 'webp' jpeg = 'jpeg' + png = 'png' + + +class BFLFluxPro11GenerateRequest(BaseModel): + prompt: str = Field(..., description='The main text prompt for image generation') + image_prompt: Optional[str] = Field(None, description='Optional image prompt') + width: int = Field(..., description='Width of the generated image') + height: int = Field(..., description='Height of the generated image') + prompt_upsampling: Optional[bool] = Field( + None, description='Whether to use prompt upsampling' + ) + seed: Optional[int] = Field(None, description='Random seed for reproducibility') + safety_tolerance: Optional[int] = Field(None, description='Safety tolerance level') + output_format: Optional[OutputFormat] = Field( + None, description='Output image format' + ) + webhook_url: Optional[str] = Field( + None, description='Optional webhook URL for async processing' + ) + webhook_secret: Optional[str] = Field( + None, description='Optional webhook secret for async processing' + ) + + +class BFLFluxPro11GenerateResponse(BaseModel): + id: str = Field(..., description='Job ID for tracking') + polling_url: str = Field(..., description='URL to poll for results') + + +class BFLFluxProGenerateRequest(BaseModel): + prompt: str = Field(..., description='The text prompt for image generation.') + negative_prompt: Optional[str] = Field( + None, description='The negative prompt for image generation.' + ) + width: int = Field( + ..., description='The width of the image to generate.', ge=64, le=2048 + ) + height: int = Field( + ..., description='The height of the image to generate.', ge=64, le=2048 + ) + num_inference_steps: Optional[int] = Field( + None, description='The number of inference steps.', ge=1, le=100 + ) + guidance_scale: Optional[float] = Field( + None, description='The guidance scale for generation.', ge=1.0, le=20.0 + ) + seed: Optional[int] = Field(None, description='The seed value for reproducibility.') + num_images: Optional[int] = Field( + None, description='The number of images to generate.', ge=1, le=4 + ) + + +class BFLFluxProGenerateResponse(BaseModel): + id: str = Field(..., description='The unique identifier for the generation task.') + polling_url: str = Field(..., description='URL to poll for the generation result.') + + +class Steps(RootModel[int]): + root: int = Field( + ..., + description='Number of steps for the image generation process', + examples=[50], + ge=15, + le=50, + title='Steps', + ) + + +class Guidance(RootModel[float]): + root: float = Field( + ..., + description='Guidance strength for the image generation process', + ge=1.5, + le=100.0, + title='Guidance', + ) + + +class WebhookUrl(RootModel[AnyUrl]): + root: AnyUrl = Field( + ..., description='URL to receive webhook notifications', title='Webhook Url' + ) + + +class BFLAsyncResponse(BaseModel): + id: str = Field(..., title='Id') + polling_url: str = Field(..., title='Polling Url') + + +class BFLAsyncWebhookResponse(BaseModel): + id: str = Field(..., title='Id') + status: str = Field(..., title='Status') + webhook_url: str = Field(..., title='Webhook Url') + + +class Top(RootModel[int]): + root: int = Field( + ..., + description='Number of pixels to expand at the top of the image', + ge=0, + le=2048, + title='Top', + ) + + +class Bottom(RootModel[int]): + root: int = Field( + ..., + description='Number of pixels to expand at the bottom of the image', + ge=0, + le=2048, + title='Bottom', + ) + + +class Left(RootModel[int]): + root: int = Field( + ..., + description='Number of pixels to expand on the left side of the image', + ge=0, + le=2048, + title='Left', + ) + + +class Right(RootModel[int]): + root: int = Field( + ..., + description='Number of pixels to expand on the right side of the image', + ge=0, + le=2048, + title='Right', + ) + + +class CannyLowThreshold(RootModel[int]): + root: int = Field( + ..., + description='Low threshold for Canny edge detection', + ge=0, + le=500, + title='Canny Low Threshold', + ) + + +class CannyHighThreshold(RootModel[int]): + root: int = Field( + ..., + description='High threshold for Canny edge detection', + ge=0, + le=500, + title='Canny High Threshold', + ) + + +class Steps2(RootModel[int]): + root: int = Field( + ..., + description='Number of steps for the image generation process', + ge=15, + le=50, + title='Steps', + ) + + +class Guidance2(RootModel[float]): + root: float = Field( + ..., + description='Guidance strength for the image generation process', + ge=1.0, + le=100.0, + title='Guidance', + ) + + +class BFLOutputFormat(str, Enum): + jpeg = 'jpeg' + png = 'png' + + +class BFLValidationError(BaseModel): + loc: List[Union[str, int]] = Field(..., title='Location') + msg: str = Field(..., title='Message') + type: str = Field(..., title='Error Type') + + +class Datum2(BaseModel): + image_id: Optional[str] = Field( + None, description='Unique identifier for the generated image' + ) + url: Optional[str] = Field(None, description='URL to access the generated image') + + +class RecraftImageGenerationResponse(BaseModel): + created: int = Field( + ..., description='Unix timestamp when the generation was created' + ) + credits: int = Field(..., description='Number of credits used for the generation') + data: List[Datum2] = Field(..., description='Array of generated image information') + + +class RecraftImageFeatures(BaseModel): + nsfw_score: Optional[float] = None + + +class RecraftTextLayoutItem(BaseModel): + bbox: List[List[float]] + text: str + + +class RecraftImageColor(BaseModel): + rgb: Optional[List[int]] = None + std: Optional[List[float]] = None + weight: Optional[float] = None + + +class RecraftImageStyle(str, Enum): + digital_illustration = 'digital_illustration' + icon = 'icon' + realistic_image = 'realistic_image' + vector_illustration = 'vector_illustration' + + +class RecraftImageSubStyle(str, Enum): + field_2d_art_poster = '2d_art_poster' + field_3d = '3d' + field_80s = '80s' + glow = 'glow' + grain = 'grain' + hand_drawn = 'hand_drawn' + infantile_sketch = 'infantile_sketch' + kawaii = 'kawaii' + pixel_art = 'pixel_art' + psychedelic = 'psychedelic' + seamless = 'seamless' + voxel = 'voxel' + watercolor = 'watercolor' + broken_line = 'broken_line' + colored_outline = 'colored_outline' + colored_shapes = 'colored_shapes' + colored_shapes_gradient = 'colored_shapes_gradient' + doodle_fill = 'doodle_fill' + doodle_offset_fill = 'doodle_offset_fill' + offset_fill = 'offset_fill' + outline = 'outline' + outline_gradient = 'outline_gradient' + uneven_fill = 'uneven_fill' + field_70s = '70s' + cartoon = 'cartoon' + doodle_line_art = 'doodle_line_art' + engraving = 'engraving' + flat_2 = 'flat_2' + kawaii_1 = 'kawaii' + line_art = 'line_art' + linocut = 'linocut' + seamless_1 = 'seamless' + b_and_w = 'b_and_w' + enterprise = 'enterprise' + hard_flash = 'hard_flash' + hdr = 'hdr' + motion_blur = 'motion_blur' + natural_light = 'natural_light' + studio_portrait = 'studio_portrait' + line_circuit = 'line_circuit' + field_2d_art_poster_2 = '2d_art_poster_2' + engraving_color = 'engraving_color' + flat_air_art = 'flat_air_art' + hand_drawn_outline = 'hand_drawn_outline' + handmade_3d = 'handmade_3d' + stickers_drawings = 'stickers_drawings' + plastic = 'plastic' + pictogram = 'pictogram' + + +class RecraftTransformModel(str, Enum): + refm1 = 'refm1' + recraft20b = 'recraft20b' + recraftv2 = 'recraftv2' + recraftv3 = 'recraftv3' + flux1_1pro = 'flux1_1pro' + flux1dev = 'flux1dev' + imagen3 = 'imagen3' + hidream_i1_dev = 'hidream_i1_dev' + + +class RecraftImageFormat(str, Enum): + webp = 'webp' + png = 'png' + + +class RecraftResponseFormat(str, Enum): + url = 'url' + b64_json = 'b64_json' + + +class RecraftImage(BaseModel): + b64_json: Optional[str] = None + features: Optional[RecraftImageFeatures] = None + image_id: UUID + revised_prompt: Optional[str] = None + url: Optional[str] = None + + +class RecraftUserControls(BaseModel): + artistic_level: Optional[int] = None + background_color: Optional[RecraftImageColor] = None + colors: Optional[List[RecraftImageColor]] = None + no_text: Optional[bool] = None + + +class RecraftTextLayout(RootModel[List[RecraftTextLayoutItem]]): + root: List[RecraftTextLayoutItem] + + +class RecraftProcessImageRequest(BaseModel): + image: StrictBytes + image_format: Optional[RecraftImageFormat] = None + response_format: Optional[RecraftResponseFormat] = None + + +class RecraftProcessImageResponse(BaseModel): + created: int + credits: int + image: RecraftImage + + +class RecraftImageToImageRequest(BaseModel): + block_nsfw: Optional[bool] = None + calculate_features: Optional[bool] = None + controls: Optional[RecraftUserControls] = None + image: StrictBytes + image_format: Optional[RecraftImageFormat] = None + model: Optional[RecraftTransformModel] = None + n: Optional[int] = None + negative_prompt: Optional[str] = None + prompt: str + random_seed: Optional[int] = None + response_format: Optional[RecraftResponseFormat] = None + strength: float + style: Optional[RecraftImageStyle] = None + style_id: Optional[UUID] = None + substyle: Optional[RecraftImageSubStyle] = None + text_layout: Optional[RecraftTextLayout] = None + + +class RecraftGenerateImageResponse(BaseModel): + created: int + credits: int + data: List[RecraftImage] + + +class RecraftTransformImageWithMaskRequest(BaseModel): + block_nsfw: Optional[bool] = None + calculate_features: Optional[bool] = None + image: StrictBytes + image_format: Optional[RecraftImageFormat] = None + mask: StrictBytes + model: Optional[RecraftTransformModel] = None + n: Optional[int] = None + negative_prompt: Optional[str] = None + prompt: str + random_seed: Optional[int] = None + response_format: Optional[RecraftResponseFormat] = None + style: Optional[RecraftImageStyle] = None + style_id: Optional[UUID] = None + substyle: Optional[RecraftImageSubStyle] = None + text_layout: Optional[RecraftTextLayout] = None + + +class KlingErrorResponse(BaseModel): + code: int = Field( + ..., + description='- 1000: Authentication failed\n- 1001: Authorization is empty\n- 1002: Authorization is invalid\n- 1003: Authorization is not yet valid\n- 1004: Authorization has expired\n- 1100: Account exception\n- 1101: Account in arrears (postpaid scenario)\n- 1102: Resource pack depleted or expired (prepaid scenario)\n- 1103: Unauthorized access to requested resource\n- 1200: Invalid request parameters\n- 1201: Invalid parameters\n- 1202: Invalid request method\n- 1203: Requested resource does not exist\n- 1300: Trigger platform strategy\n- 1301: Trigger content security policy\n- 1302: API request too frequent\n- 1303: Concurrency/QPS exceeds limit\n- 1304: Trigger IP whitelist policy\n- 5000: Internal server error\n- 5001: Service temporarily unavailable\n- 5002: Server internal timeout\n', + ) + message: str = Field(..., description='Human-readable error message') + request_id: str = Field( + ..., description='Request ID for tracking and troubleshooting' + ) + + +class LumaAspectRatio(str, Enum): + field_1_1 = '1:1' + field_16_9 = '16:9' + field_9_16 = '9:16' + field_4_3 = '4:3' + field_3_4 = '3:4' + field_21_9 = '21:9' + field_9_21 = '9:21' + + +class LumaVideoModel(str, Enum): + ray_2 = 'ray-2' + ray_flash_2 = 'ray-flash-2' + ray_1_6 = 'ray-1-6' + + +class LumaVideoModelOutputResolution1(str, Enum): + field_540p = '540p' + field_720p = '720p' + field_1080p = '1080p' + field_4k = '4k' + + +class LumaVideoModelOutputResolution( + RootModel[Union[LumaVideoModelOutputResolution1, str]] +): + root: Union[LumaVideoModelOutputResolution1, str] + + +class LumaVideoModelOutputDuration1(str, Enum): + field_5s = '5s' + field_9s = '9s' + + +class LumaVideoModelOutputDuration( + RootModel[Union[LumaVideoModelOutputDuration1, str]] +): + root: Union[LumaVideoModelOutputDuration1, str] + + +class LumaImageModel(str, Enum): + photon_1 = 'photon-1' + photon_flash_1 = 'photon-flash-1' + + +class LumaImageRef(BaseModel): + url: Optional[AnyUrl] = Field(None, description='The URL of the image reference') + weight: Optional[float] = Field( + None, description='The weight of the image reference' + ) + + +class LumaImageIdentity(BaseModel): + images: Optional[List[AnyUrl]] = Field( + None, description='The URLs of the image identity' + ) + + +class LumaModifyImageRef(BaseModel): + url: Optional[AnyUrl] = Field(None, description='The URL of the image reference') + weight: Optional[float] = Field( + None, description='The weight of the modify image reference' + ) + + +class Type1(str, Enum): + generation = 'generation' + + +class LumaGenerationReference(BaseModel): + type: Literal['generation'] + id: UUID = Field(..., description='The ID of the generation') + + +class Type2(str, Enum): + image = 'image' + + +class LumaImageReference(BaseModel): + type: Literal['image'] + url: AnyUrl = Field(..., description='The URL of the image') + + +class LumaKeyframe(RootModel[Union[LumaGenerationReference, LumaImageReference]]): + root: Union[LumaGenerationReference, LumaImageReference] = Field( + ..., + description='A keyframe can be either a Generation reference, an Image, or a Video', + discriminator='type', + ) + + +class LumaGenerationType(str, Enum): + video = 'video' + image = 'image' + + +class LumaState(str, Enum): + queued = 'queued' + dreaming = 'dreaming' + completed = 'completed' + failed = 'failed' + + +class LumaAssets(BaseModel): + video: Optional[AnyUrl] = Field(None, description='The URL of the video') + image: Optional[AnyUrl] = Field(None, description='The URL of the image') + progress_video: Optional[AnyUrl] = Field( + None, description='The URL of the progress video' + ) + + +class GenerationType(str, Enum): + video = 'video' + + +class GenerationType1(str, Enum): + image = 'image' + + +class CharacterRef(BaseModel): + identity0: Optional[LumaImageIdentity] = None + + +class LumaImageGenerationRequest(BaseModel): + generation_type: Optional[GenerationType1] = 'image' + model: Optional[LumaImageModel] = 'photon-1' + prompt: Optional[str] = Field(None, description='The prompt of the generation') + aspect_ratio: Optional[LumaAspectRatio] = '16:9' + callback_url: Optional[AnyUrl] = Field( + None, description='The callback URL for the generation' + ) + image_ref: Optional[List[LumaImageRef]] = None + style_ref: Optional[List[LumaImageRef]] = None + character_ref: Optional[CharacterRef] = None + modify_image_ref: Optional[LumaModifyImageRef] = None + + +class GenerationType2(str, Enum): + upscale_video = 'upscale_video' + + +class LumaUpscaleVideoGenerationRequest(BaseModel): + generation_type: Optional[GenerationType2] = 'upscale_video' + resolution: Optional[LumaVideoModelOutputResolution] = None + callback_url: Optional[AnyUrl] = Field( + None, description='The callback URL for the upscale' + ) + + +class GenerationType3(str, Enum): + add_audio = 'add_audio' + + +class LumaAudioGenerationRequest(BaseModel): + generation_type: Optional[GenerationType3] = 'add_audio' + prompt: Optional[str] = Field(None, description='The prompt of the audio') + negative_prompt: Optional[str] = Field( + None, description='The negative prompt of the audio' + ) + callback_url: Optional[AnyUrl] = Field( + None, description='The callback URL for the audio' + ) + + +class LumaError(BaseModel): + detail: Optional[str] = Field(None, description='The error message') + + +class AspectRatio(str, Enum): + field_16_9 = '16:9' + field_4_3 = '4:3' + field_1_1 = '1:1' + field_3_4 = '3:4' + field_9_16 = '9:16' + + +class Duration(int, Enum): + integer_5 = 5 + integer_8 = 8 + + +class Model1(str, Enum): + v3_5 = 'v3.5' + + +class MotionMode(str, Enum): + normal = 'normal' + fast = 'fast' class Quality(str, Enum): - low = 'low' - medium = 'medium' - high = 'high' + field_360p = '360p' + field_540p = '540p' + field_720p = '720p' + field_1080p = '1080p' -class OpenAIImageEditRequest(BaseModel): - background: Optional[str] = Field( - None, description='Background transparency', examples=['opaque'] - ) - model: str = Field( - ..., description='The model to use for image editing', examples=['gpt-image-1'] - ) - moderation: Optional[Moderation] = Field( - None, description='Content moderation setting', examples=['auto'] - ) - n: Optional[int] = Field( - None, description='The number of images to generate', examples=[1] - ) - output_compression: Optional[int] = Field( - None, description='Compression level for JPEG or WebP (0-100)', examples=[100] - ) - output_format: Optional[OutputFormat] = Field( - None, description='Format of the output image', examples=['png'] - ) - prompt: str = Field( - ..., - description='A text description of the desired edit', - examples=['Give the rocketship rainbow coloring'], - ) - quality: Optional[str] = Field( - None, description='The quality of the edited image', examples=['low'] - ) - size: Optional[str] = Field( - None, description='Size of the output image', examples=['1024x1024'] - ) - user: Optional[str] = Field( +class Style(str, Enum): + anime = 'anime' + field_3d_animation = '3d_animation' + clay = 'clay' + comic = 'comic' + cyberpunk = 'cyberpunk' + + +class PixverseTextVideoRequest(BaseModel): + aspect_ratio: AspectRatio + duration: Duration + model: Model1 + motion_mode: Optional[MotionMode] = None + negative_prompt: Optional[str] = None + prompt: str + quality: Quality + seed: Optional[int] = None + style: Optional[Style] = None + template_id: Optional[int] = None + water_mark: Optional[bool] = None + + +class Resp(BaseModel): + video_id: Optional[int] = None + + +class PixverseVideoResponse(BaseModel): + ErrCode: Optional[int] = None + ErrMsg: Optional[str] = None + Resp_1: Optional[Resp] = Field(None, alias='Resp') + + +class Resp1(BaseModel): + img_id: Optional[int] = None + + +class PixverseImageUploadResponse(BaseModel): + ErrCode: Optional[int] = None + ErrMsg: Optional[str] = None + Resp: Optional[Resp1] = None + + +class PixverseImageVideoRequest(BaseModel): + img_id: int + model: Model1 + prompt: str + duration: Duration + quality: Quality + motion_mode: Optional[MotionMode] = None + seed: Optional[int] = None + style: Optional[Style] = None + template_id: Optional[int] = None + water_mark: Optional[bool] = None + + +class PixverseTransitionVideoRequest(BaseModel): + first_frame_img: int + last_frame_img: int + model: Model1 + duration: Duration + quality: Quality + motion_mode: MotionMode + seed: int + prompt: str + style: Optional[Style] = None + template_id: Optional[int] = None + water_mark: Optional[bool] = None + + +class Status2(int, Enum): + integer_1 = 1 + integer_5 = 5 + integer_6 = 6 + integer_7 = 7 + integer_8 = 8 + + +class Resp2(BaseModel): + create_time: Optional[str] = None + id: Optional[int] = None + modify_time: Optional[str] = None + negative_prompt: Optional[str] = None + outputHeight: Optional[int] = None + outputWidth: Optional[int] = None + prompt: Optional[str] = None + resolution_ratio: Optional[int] = None + seed: Optional[int] = None + size: Optional[int] = None + status: Optional[Status2] = Field( None, - description='A unique identifier for end-user monitoring', - examples=['user-1234'], + description='Video generation status codes:\n* 1 - Generation successful\n* 5 - Generating\n* 6 - Deleted\n* 7 - Contents moderation failed\n* 8 - Generation failed\n', + ) + style: Optional[str] = None + url: Optional[str] = None + + +class PixverseVideoResultResponse(BaseModel): + ErrCode: Optional[int] = None + ErrMsg: Optional[str] = None + Resp: Optional[Resp2] = None + + +class Image(BaseModel): + bytesBase64Encoded: str + gcsUri: Optional[str] = None + mimeType: Optional[str] = None + + +class Image1(BaseModel): + bytesBase64Encoded: Optional[str] = None + gcsUri: str + mimeType: Optional[str] = None + + +class Instance(BaseModel): + prompt: str = Field(..., description='Text description of the video') + image: Optional[Union[Image, Image1]] = Field( + None, description='Optional image to guide video generation' ) -class Quality1(str, Enum): +class PersonGeneration(str, Enum): + ALLOW = 'ALLOW' + BLOCK = 'BLOCK' + + +class Parameters(BaseModel): + aspectRatio: Optional[str] = Field(None, examples=['16:9']) + negativePrompt: Optional[str] = None + personGeneration: Optional[PersonGeneration] = None + sampleCount: Optional[int] = None + seed: Optional[int] = None + storageUri: Optional[str] = Field( + None, description='Optional Cloud Storage URI to upload the video' + ) + durationSeconds: Optional[int] = None + enhancePrompt: Optional[bool] = None + + +class Veo2GenVidRequest(BaseModel): + instances: Optional[List[Instance]] = None + parameters: Optional[Parameters] = None + + +class Veo2GenVidResponse(BaseModel): + name: str = Field( + ..., + description='Operation resource name', + examples=[ + 'projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID/operations/a1b07c8e-7b5a-4aba-bb34-3e1ccb8afcc8' + ], + ) + + +class Veo2GenVidPollRequest(BaseModel): + operationName: str = Field( + ..., + description='Full operation name (from predict response)', + examples=[ + 'projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID/operations/OPERATION_ID' + ], + ) + + +class Video(BaseModel): + gcsUri: Optional[str] = Field(None, description='Cloud Storage URI of the video') + bytesBase64Encoded: Optional[str] = Field( + None, description='Base64-encoded video content' + ) + mimeType: Optional[str] = Field(None, description='Video MIME type') + + +class Response(BaseModel): + field_type: Optional[str] = Field( + None, + alias='@type', + examples=[ + 'type.googleapis.com/cloud.ai.large_models.vision.GenerateVideoResponse' + ], + ) + raiMediaFilteredCount: Optional[int] = Field( + None, description='Count of media filtered by responsible AI policies' + ) + raiMediaFilteredReasons: Optional[List[str]] = Field( + None, description='Reasons why media was filtered by responsible AI policies' + ) + videos: Optional[List[Video]] = None + + +class Error1(BaseModel): + code: Optional[int] = Field(None, description='Error code') + message: Optional[str] = Field(None, description='Error message') + + +class Veo2GenVidPollResponse(BaseModel): + name: Optional[str] = None + done: Optional[bool] = None + response: Optional[Response] = Field( + None, description='The actual prediction response if done is true' + ) + error: Optional[Error1] = Field( + None, description='Error details if operation failed' + ) + + +class RunwayImageToVideoResponse(BaseModel): + id: Optional[str] = Field(None, description='Task ID') + + +class RunwayTaskStatusEnum(str, Enum): + SUCCEEDED = 'SUCCEEDED' + RUNNING = 'RUNNING' + FAILED = 'FAILED' + PENDING = 'PENDING' + CANCELLED = 'CANCELLED' + THROTTLED = 'THROTTLED' + + +class RunwayModelEnum(str, Enum): + gen4_turbo = 'gen4_turbo' + gen3a_turbo = 'gen3a_turbo' + + +class Position(str, Enum): + first = 'first' + last = 'last' + + +class RunwayPromptImageDetailedObject(BaseModel): + uri: str = Field( + ..., description='A HTTPS URL or data URI containing an encoded image.' + ) + position: Position = Field( + ..., + description="The position of the image in the output video. 'last' is currently supported for gen3a_turbo only.", + ) + + +class RunwayDurationEnum(int, Enum): + integer_5 = 5 + integer_10 = 10 + + +class RunwayAspectRatioEnum(str, Enum): + field_1280_720 = '1280:720' + field_720_1280 = '720:1280' + field_1104_832 = '1104:832' + field_832_1104 = '832:1104' + field_960_960 = '960:960' + field_1584_672 = '1584:672' + field_1280_768 = '1280:768' + field_768_1280 = '768:1280' + + +class RunwayPromptImageObject( + RootModel[Union[str, List[RunwayPromptImageDetailedObject]]] +): + root: Union[str, List[RunwayPromptImageDetailedObject]] = Field( + ..., + description='Image(s) to use for the video generation. Can be a single URI or an array of image objects with positions.', + ) + + +class Datum3(BaseModel): + b64_json: Optional[str] = Field(None, description='Base64 encoded image data') + url: Optional[str] = Field(None, description='URL of the image') + revised_prompt: Optional[str] = Field(None, description='Revised prompt') + + +class InputTokensDetails(BaseModel): + text_tokens: Optional[int] = None + image_tokens: Optional[int] = None + + +class Usage(BaseModel): + input_tokens: Optional[int] = None + input_tokens_details: Optional[InputTokensDetails] = None + output_tokens: Optional[int] = None + total_tokens: Optional[int] = None + + +class OpenAIImageGenerationResponse(BaseModel): + data: Optional[List[Datum3]] = None + usage: Optional[Usage] = None + + +class Quality3(str, Enum): low = 'low' medium = 'medium' high = 'high' @@ -345,54 +1999,70 @@ class Quality1(str, Enum): hd = 'hd' +class OutputFormat1(str, Enum): + png = 'png' + webp = 'webp' + jpeg = 'jpeg' + + +class Moderation(str, Enum): + low = 'low' + auto = 'auto' + + +class Background(str, Enum): + transparent = 'transparent' + opaque = 'opaque' + + class ResponseFormat(str, Enum): url = 'url' b64_json = 'b64_json' -class Style(str, Enum): +class Style3(str, Enum): vivid = 'vivid' natural = 'natural' class OpenAIImageGenerationRequest(BaseModel): - background: Optional[Background] = Field( - None, description='Background transparency', examples=['opaque'] - ) model: Optional[str] = Field( None, description='The model to use for image generation', examples=['dall-e-3'] ) - moderation: Optional[Moderation] = Field( - None, description='Content moderation setting', examples=['auto'] - ) - n: Optional[int] = Field( - None, - description='The number of images to generate (1-10). Only 1 supported for dall-e-3.', - examples=[1], - ) - output_compression: Optional[int] = Field( - None, description='Compression level for JPEG or WebP (0-100)', examples=[100] - ) - output_format: Optional[OutputFormat] = Field( - None, description='Format of the output image', examples=['png'] - ) prompt: str = Field( ..., description='A text description of the desired image', examples=['Draw a rocket in front of a blackhole in deep space'], ) - quality: Optional[Quality1] = Field( - None, description='The quality of the generated image', examples=['high'] + n: Optional[int] = Field( + None, + description='The number of images to generate (1-10). Only 1 supported for dall-e-3.', + examples=[1], ) - response_format: Optional[ResponseFormat] = Field( - None, description='Response format of image data', examples=['b64_json'] + quality: Optional[Quality3] = Field( + None, description='The quality of the generated image', examples=['high'] ) size: Optional[str] = Field( None, description='Size of the image (e.g., 1024x1024, 1536x1024, auto)', examples=['1024x1536'], ) - style: Optional[Style] = Field( + output_format: Optional[OutputFormat1] = Field( + None, description='Format of the output image', examples=['png'] + ) + output_compression: Optional[int] = Field( + None, description='Compression level for JPEG or WebP (0-100)', examples=[100] + ) + moderation: Optional[Moderation] = Field( + None, description='Content moderation setting', examples=['auto'] + ) + background: Optional[Background] = Field( + None, description='Background transparency', examples=['opaque'] + ) + response_format: Optional[ResponseFormat] = Field( + None, description='Response format of image data', examples=['b64_json'] + ) + style: Optional[Style3] = Field( None, description='Style of the image (only for dall-e-3)', examples=['vivid'] ) user: Optional[str] = Field( @@ -402,21 +2072,1758 @@ class OpenAIImageGenerationRequest(BaseModel): ) -class Datum1(BaseModel): - b64_json: Optional[str] = Field(None, description='Base64 encoded image data') - revised_prompt: Optional[str] = Field(None, description='Revised prompt') - url: Optional[str] = Field(None, description='URL of the image') +class OpenAIImageEditRequest(BaseModel): + model: str = Field( + ..., description='The model to use for image editing', examples=['gpt-image-1'] + ) + prompt: str = Field( + ..., + description='A text description of the desired edit', + examples=['Give the rocketship rainbow coloring'], + ) + n: Optional[int] = Field( + None, description='The number of images to generate', examples=[1] + ) + quality: Optional[str] = Field( + None, description='The quality of the edited image', examples=['low'] + ) + size: Optional[str] = Field( + None, description='Size of the output image', examples=['1024x1024'] + ) + output_format: Optional[OutputFormat1] = Field( + None, description='Format of the output image', examples=['png'] + ) + output_compression: Optional[int] = Field( + None, description='Compression level for JPEG or WebP (0-100)', examples=[100] + ) + moderation: Optional[Moderation] = Field( + None, description='Content moderation setting', examples=['auto'] + ) + background: Optional[str] = Field( + None, description='Background transparency', examples=['opaque'] + ) + user: Optional[str] = Field( + None, + description='A unique identifier for end-user monitoring', + examples=['user-1234'], + ) -class OpenAIImageGenerationResponse(BaseModel): - data: Optional[List[Datum1]] = None -class User(BaseModel): - email: Optional[str] = Field(None, description='The email address for this user.') - id: Optional[str] = Field(None, description='The unique id for this user.') - isAdmin: Optional[bool] = Field( - None, description='Indicates if the user has admin privileges.' +class CustomerStorageResourceResponse(BaseModel): + download_url: Optional[str] = Field( + None, + description='The signed URL to use for downloading the file from the specified path', ) - isApproved: Optional[bool] = Field( - None, description='Indicates if the user is approved.' + upload_url: Optional[str] = Field( + None, + description='The signed URL to use for uploading the file to the specified path', ) - name: Optional[str] = Field(None, description='The name for this user.') + expires_at: Optional[datetime] = Field( + None, description='When the signed URL will expire' + ) + existing_file: Optional[bool] = Field( + None, description='Whether an existing file with the same hash was found' + ) + + +class Pikaffect(str, Enum): + Cake_ify = 'Cake-ify' + Crumble = 'Crumble' + Crush = 'Crush' + Decapitate = 'Decapitate' + Deflate = 'Deflate' + Dissolve = 'Dissolve' + Explode = 'Explode' + Eye_pop = 'Eye-pop' + Inflate = 'Inflate' + Levitate = 'Levitate' + Melt = 'Melt' + Peel = 'Peel' + Poke = 'Poke' + Squish = 'Squish' + Ta_da = 'Ta-da' + Tear = 'Tear' + + +class PikaBodyGeneratePikaffectsGeneratePikaffectsPost(BaseModel): + image: Optional[StrictBytes] = Field(None, title='Image') + pikaffect: Optional[Pikaffect] = Field(None, title='Pikaffect') + promptText: Optional[str] = Field(None, title='Prompttext') + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + seed: Optional[int] = Field(None, title='Seed') + + +class PikaGenerateResponse(BaseModel): + video_id: str = Field(..., title='Video Id') + + +class PikaBodyGeneratePikadditionsGeneratePikadditionsPost(BaseModel): + video: Optional[StrictBytes] = Field(None, title='Video') + image: Optional[StrictBytes] = Field(None, title='Image') + promptText: Optional[str] = Field(None, title='Prompttext') + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + seed: Optional[int] = Field(None, title='Seed') + + +class PikaBodyGeneratePikaswapsGeneratePikaswapsPost(BaseModel): + video: Optional[StrictBytes] = Field(None, title='Video') + image: Optional[StrictBytes] = Field(None, title='Image') + promptText: Optional[str] = Field(None, title='Prompttext') + modifyRegionMask: Optional[StrictBytes] = Field( + None, + description='A mask image that specifies the region to modify, where the mask is white and the background is black', + title='Modifyregionmask', + ) + modifyRegionRoi: Optional[str] = Field( + None, + description='Plaintext description of the object / region to modify', + title='Modifyregionroi', + ) + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + seed: Optional[int] = Field(None, title='Seed') + + +class IngredientsMode(str, Enum): + creative = 'creative' + precise = 'precise' + + +class AspectRatio1(RootModel[float]): + root: float = Field( + ..., + description='Aspect ratio (width / height)', + ge=0.4, + le=2.5, + title='Aspectratio', + ) + + +class PikaBodyGenerate22C2vGenerate22PikascenesPost(BaseModel): + images: Optional[List[StrictBytes]] = Field(None, title='Images') + ingredientsMode: IngredientsMode = Field(..., title='Ingredientsmode') + promptText: Optional[str] = Field(None, title='Prompttext') + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + seed: Optional[int] = Field(None, title='Seed') + resolution: Optional[str] = Field('1080p', title='Resolution') + duration: Optional[int] = Field(5, title='Duration') + aspectRatio: Optional[AspectRatio1] = Field( + None, description='Aspect ratio (width / height)', title='Aspectratio' + ) + + +class PikaStatusEnum(str, Enum): + queued = 'queued' + started = 'started' + finished = 'finished' + + +class PikaValidationError(BaseModel): + loc: List[Union[str, int]] = Field(..., title='Location') + msg: str = Field(..., title='Message') + type: str = Field(..., title='Error Type') + + +class PikaResolutionEnum(str, Enum): + field_1080p = '1080p' + field_720p = '720p' + + +class PikaDurationEnum(int, Enum): + integer_5 = 5 + integer_10 = 10 + + +class RgbItem(RootModel[int]): + root: int = Field(..., ge=0, le=255) + + +class RGBColor(BaseModel): + rgb: List[RgbItem] = Field(..., max_length=3, min_length=3) + + +class StabilityStabilityClientID(RootModel[str]): + root: str = Field( + ..., + description='The name of your application, used to help us communicate app-specific debugging or moderation issues to you.', + examples=['my-awesome-app'], + max_length=256, + ) + + +class StabilityStabilityClientUserID(RootModel[str]): + root: str = Field( + ..., + description='A unique identifier for your end user. Used to help us communicate user-specific debugging or moderation issues to you. Feel free to obfuscate this value to protect user privacy.', + examples=['DiscordUser#9999'], + max_length=256, + ) + + +class StabilityStabilityClientVersion(RootModel[str]): + root: str = Field( + ..., + description='The version of your application, used to help us communicate version-specific debugging or moderation issues to you.', + examples=['1.2.1'], + max_length=256, + ) + + +class Name(str, Enum): + content_moderation = 'content_moderation' + + +class StabilityContentModerationResponse(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new) you file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: Name = Field( + ..., + description='Our content moderation system has flagged some part of your request and subsequently denied it. You were not charged for this request. While this may at times be frustrating, it is necessary to maintain the integrity of our platform and ensure a safe experience for all users. If you would like to provide feedback, please use the [Support Form](https://kb.stability.ai/knowledge-base/kb-tickets/new).', + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class RenderingSpeed(str, Enum): + BALANCED = 'BALANCED' + TURBO = 'TURBO' + QUALITY = 'QUALITY' + + +class StabilityCreativity(RootModel[float]): + root: float = Field( + ..., + description='Controls the likelihood of creating additional details not heavily conditioned by the init image.', + ge=0.2, + le=0.5, + ) + + +class StabilityGenerationID(RootModel[str]): + root: str = Field( + ..., + description='The `id` of a generation, typically used for async generations, that can be used to check the status of the generation or retrieve the result.', + examples=['a6dc6c6e20acda010fe14d71f180658f2896ed9b4ec25aa99a6ff06c796987c4'], + max_length=64, + min_length=64, + ) + + +class Mode(str, Enum): + text_to_image = 'text-to-image' + image_to_image = 'image-to-image' + + +class AspectRatio2(str, Enum): + field_21_9 = '21:9' + field_16_9 = '16:9' + field_3_2 = '3:2' + field_5_4 = '5:4' + field_1_1 = '1:1' + field_4_5 = '4:5' + field_2_3 = '2:3' + field_9_16 = '9:16' + field_9_21 = '9:21' + + +class Model4(str, Enum): + sd3_5_large = 'sd3.5-large' + sd3_5_large_turbo = 'sd3.5-large-turbo' + sd3_5_medium = 'sd3.5-medium' + + +class OutputFormat3(str, Enum): + png = 'png' + jpeg = 'jpeg' + + +class StylePreset(str, Enum): + enhance = 'enhance' + anime = 'anime' + photographic = 'photographic' + digital_art = 'digital-art' + comic_book = 'comic-book' + fantasy_art = 'fantasy-art' + line_art = 'line-art' + analog_film = 'analog-film' + neon_punk = 'neon-punk' + isometric = 'isometric' + low_poly = 'low-poly' + origami = 'origami' + modeling_compound = 'modeling-compound' + cinematic = 'cinematic' + field_3d_model = '3d-model' + pixel_art = 'pixel-art' + tile_texture = 'tile-texture' + + +class StabilityImageGenrationSD3Request(BaseModel): + prompt: str = Field( + ..., + description='What you wish to see in the output image. A strong, descriptive prompt that clearly defines\nelements, colors, and subjects will lead to better results.', + max_length=10000, + min_length=1, + ) + mode: Optional[Mode] = Field( + 'text-to-image', + description='Controls whether this is a text-to-image or image-to-image generation, which affects which parameters are required:\n- **text-to-image** requires only the `prompt` parameter\n- **image-to-image** requires the `prompt`, `image`, and `strength` parameters', + title='GenerationMode', + ) + image: Optional[StrictBytes] = Field( + None, + description='The image to use as the starting point for the generation.\n\nSupported formats:\n\n\n\n - jpeg\n - png\n - webp\n\nSupported dimensions:\n\n\n\n - Every side must be at least 64 pixels\n\n> **Important:** This parameter is only valid for **image-to-image** requests.', + ) + strength: Optional[float] = Field( + None, + description='Sometimes referred to as _denoising_, this parameter controls how much influence the\n`image` parameter has on the generated image. A value of 0 would yield an image that\nis identical to the input. A value of 1 would be as if you passed in no image at all.\n\n> **Important:** This parameter is only valid for **image-to-image** requests.', + ge=0.0, + le=1.0, + ) + aspect_ratio: Optional[AspectRatio2] = Field( + '1:1', + description='Controls the aspect ratio of the generated image. Defaults to 1:1.\n\n> **Important:** This parameter is only valid for **text-to-image** requests.', + ) + model: Optional[Model4] = Field( + 'sd3.5-large', + description='The model to use for generation.\n\n- `sd3.5-large` requires 6.5 credits per generation\n- `sd3.5-large-turbo` requires 4 credits per generation\n- `sd3.5-medium` requires 3.5 credits per generation\n- As of the April 17, 2025, `sd3-large`, `sd3-large-turbo` and `sd3-medium`\n\n\n\n are re-routed to their `sd3.5-[model version]` equivalent, at the same price.', + ) + seed: Optional[float] = Field( + 0, + description="A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.)", + ge=0.0, + le=4294967294.0, + ) + output_format: Optional[OutputFormat3] = Field( + 'png', description='Dictates the `content-type` of the generated image.' + ) + style_preset: Optional[StylePreset] = Field( + None, description='Guides the image model towards a particular style.' + ) + negative_prompt: Optional[str] = Field( + None, + description='Keywords of what you **do not** wish to see in the output image.\nThis is an advanced feature.', + max_length=10000, + ) + cfg_scale: Optional[float] = Field( + None, + description='How strictly the diffusion process adheres to the prompt text (higher values keep your image closer to your prompt). The _Large_ and _Medium_ models use a default of `4`. The _Turbo_ model uses a default of `1`.', + ge=1.0, + le=10.0, + ) + + +class FinishReason(str, Enum): + SUCCESS = 'SUCCESS' + CONTENT_FILTERED = 'CONTENT_FILTERED' + + +class StabilityImageGenrationSD3Response200(BaseModel): + image: str = Field( + ..., + description='The generated image, encoded to base64.', + examples=['AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1...'], + ) + seed: Optional[float] = Field( + 0, + description='The seed used as random noise for this generation.', + examples=[343940597], + ge=0.0, + le=4294967294.0, + ) + finish_reason: FinishReason = Field( + ..., + description='The reason the generation finished.\n\n- `SUCCESS` = successful generation.\n- `CONTENT_FILTERED` = successful generation, however the output violated our content moderation\npolicy and has been blurred as a result.', + examples=['SUCCESS'], + ) + + +class StabilityImageGenrationSD3Response400(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationSD3Response413(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationSD3Response422(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationSD3Response429(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationSD3Response500(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class OutputFormat4(str, Enum): + jpeg = 'jpeg' + png = 'png' + webp = 'webp' + + +class StabilityImageGenrationUpscaleConservativeRequest(BaseModel): + image: StrictBytes = Field( + ..., + description='The image you wish to upscale.\n\nSupported Formats:\n- jpeg\n- png\n- webp\n\nValidation Rules:\n- Every side must be at least 64 pixels\n- Total pixel count must be between 4,096 and 9,437,184 pixels\n- The aspect ratio must be between 1:2.5 and 2.5:1', + examples=['./some/image.png'], + ) + prompt: str = Field( + ..., + description="What you wish to see in the output image. A strong, descriptive prompt that clearly defines\nelements, colors, and subjects will lead to better results.\n\nTo control the weight of a given word use the format `(word:weight)`,\nwhere `word` is the word you'd like to control the weight of and `weight`\nis a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)`\nwould convey a sky that was blue and green, but more green than blue.", + max_length=10000, + min_length=1, + ) + negative_prompt: Optional[str] = Field( + None, + description='A blurb of text describing what you **do not** wish to see in the output image.\nThis is an advanced feature.', + max_length=10000, + ) + seed: Optional[float] = Field( + 0, + description="A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.)", + ge=0.0, + le=4294967294.0, + ) + output_format: Optional[OutputFormat4] = Field( + 'png', description='Dictates the `content-type` of the generated image.' + ) + creativity: Optional[StabilityCreativity] = Field( + default_factory=lambda: StabilityCreativity.model_validate(0.35) + ) + + +class StabilityImageGenrationUpscaleConservativeResponse200(BaseModel): + image: str = Field( + ..., + description='The generated image, encoded to base64.', + examples=['AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1...'], + ) + seed: Optional[float] = Field( + 0, + description='The seed used as random noise for this generation.', + examples=[343940597], + ge=0.0, + le=4294967294.0, + ) + finish_reason: FinishReason = Field( + ..., + description='The reason the generation finished.\n\n- `SUCCESS` = successful generation.\n- `CONTENT_FILTERED` = successful generation, however the output violated our content moderation\npolicy and has been blurred as a result.', + examples=['SUCCESS'], + ) + + +class StabilityImageGenrationUpscaleConservativeResponse400(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleConservativeResponse413(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleConservativeResponse422(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleConservativeResponse429(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleConservativeResponse500(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleCreativeRequest(BaseModel): + image: StrictBytes = Field( + ..., + description='The image you wish to upscale.\n\nSupported Formats:\n- jpeg\n- png\n- webp\n\nValidation Rules:\n- Every side must be at least 64 pixels\n- Total pixel count must be between 4,096 and 1,048,576 pixels', + examples=['./some/image.png'], + ) + prompt: str = Field( + ..., + description="What you wish to see in the output image. A strong, descriptive prompt that clearly defines\nelements, colors, and subjects will lead to better results.\n\nTo control the weight of a given word use the format `(word:weight)`,\nwhere `word` is the word you'd like to control the weight of and `weight`\nis a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)`\nwould convey a sky that was blue and green, but more green than blue.", + max_length=10000, + min_length=1, + ) + negative_prompt: Optional[str] = Field( + None, + description='A blurb of text describing what you **do not** wish to see in the output image.\nThis is an advanced feature.', + max_length=10000, + ) + output_format: Optional[OutputFormat4] = Field( + 'png', description='Dictates the `content-type` of the generated image.' + ) + seed: Optional[float] = Field( + 0, + description="A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.)", + ge=0.0, + le=4294967294.0, + ) + creativity: Optional[float] = Field( + 0.3, + description='Indicates how creative the model should be when upscaling an image.\nHigher values will result in more details being added to the image during upscaling.', + ge=0.1, + le=0.5, + ) + style_preset: Optional[StylePreset] = Field( + None, description='Guides the image model towards a particular style.' + ) + + +class StabilityImageGenrationUpscaleCreativeResponse200(BaseModel): + id: StabilityGenerationID + + +class StabilityImageGenrationUpscaleCreativeResponse400(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleCreativeResponse413(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleCreativeResponse422(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleCreativeResponse429(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleCreativeResponse500(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleFastRequest(BaseModel): + image: StrictBytes = Field( + ..., + description='The image you wish to upscale.\n\nSupported Formats:\n- jpeg\n- png\n- webp\n\nValidation Rules:\n- Width must be between 32 and 1,536 pixels\n- Height must be between 32 and 1,536 pixels\n- Total pixel count must be between 1,024 and 1,048,576 pixels', + examples=['./some/image.png'], + ) + output_format: Optional[OutputFormat4] = Field( + 'png', description='Dictates the `content-type` of the generated image.' + ) + + +class StabilityImageGenrationUpscaleFastResponse200(BaseModel): + image: str = Field( + ..., + description='The generated image, encoded to base64.', + examples=['AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1...'], + ) + seed: Optional[float] = Field( + 0, + description='The seed used as random noise for this generation.', + examples=[343940597], + ge=0.0, + le=4294967294.0, + ) + finish_reason: FinishReason = Field( + ..., + description='The reason the generation finished.\n\n- `SUCCESS` = successful generation.\n- `CONTENT_FILTERED` = successful generation, however the output violated our content moderation\npolicy and has been blurred as a result.', + examples=['SUCCESS'], + ) + + +class StabilityImageGenrationUpscaleFastResponse400(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleFastResponse413(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleFastResponse422(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleFastResponse429(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class StabilityImageGenrationUpscaleFastResponse500(BaseModel): + id: str = Field( + ..., + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], + min_length=1, + ) + name: str = Field( + ..., + description='Short-hand name for an error, useful for discriminating between errors with the same status code.', + examples=['bad_request'], + min_length=1, + ) + errors: List[str] = Field( + ..., + description='One or more error messages indicating what went wrong.', + examples=[['some-field: is required']], + min_length=1, + ) + + +class ActionJobResult(BaseModel): + id: Optional[UUID] = Field(None, description='Unique identifier for the job result') + workflow_name: Optional[str] = Field(None, description='Name of the workflow') + operating_system: Optional[str] = Field(None, description='Operating system used') + python_version: Optional[str] = Field(None, description='PyTorch version used') + pytorch_version: Optional[str] = Field(None, description='PyTorch version used') + action_run_id: Optional[str] = Field( + None, description='Identifier of the run this result belongs to' + ) + action_job_id: Optional[str] = Field( + None, description='Identifier of the job this result belongs to' + ) + cuda_version: Optional[str] = Field(None, description='CUDA version used') + branch_name: Optional[str] = Field( + None, description='Name of the relevant git branch' + ) + commit_hash: Optional[str] = Field(None, description='The hash of the commit') + commit_id: Optional[str] = Field(None, description='The ID of the commit') + commit_time: Optional[int] = Field( + None, description='The Unix timestamp when the commit was made' + ) + commit_message: Optional[str] = Field(None, description='The message of the commit') + comfy_run_flags: Optional[str] = Field( + None, description='The comfy run flags. E.g. `--low-vram`' + ) + git_repo: Optional[str] = Field(None, description='The repository name') + pr_number: Optional[str] = Field(None, description='The pull request number') + start_time: Optional[int] = Field( + None, description='The start time of the job as a Unix timestamp.' + ) + end_time: Optional[int] = Field( + None, description='The end time of the job as a Unix timestamp.' + ) + avg_vram: Optional[int] = Field( + None, description='The average VRAM used by the job' + ) + peak_vram: Optional[int] = Field(None, description='The peak VRAM used by the job') + job_trigger_user: Optional[str] = Field( + None, description='The user who triggered the job.' + ) + author: Optional[str] = Field(None, description='The author of the commit') + machine_stats: Optional[MachineStats] = None + status: Optional[WorkflowRunStatus] = None + storage_file: Optional[StorageFile] = None + + +class Publisher(BaseModel): + name: Optional[str] = None + id: Optional[str] = Field( + None, + description="The unique identifier for the publisher. It's akin to a username. Should be lowercase.", + ) + description: Optional[str] = None + website: Optional[str] = None + support: Optional[str] = None + source_code_repo: Optional[str] = None + logo: Optional[str] = Field(None, description="URL to the publisher's logo.") + createdAt: Optional[datetime] = Field( + None, description='The date and time the publisher was created.' + ) + members: Optional[List[PublisherMember]] = Field( + None, description='A list of members in the publisher.' + ) + status: Optional[PublisherStatus] = Field( + None, description='The status of the publisher.' + ) + + +class NodeVersion(BaseModel): + id: Optional[str] = None + version: Optional[str] = Field( + None, + description='The version identifier, following semantic versioning. Must be unique for the node.', + ) + createdAt: Optional[datetime] = Field( + None, description='The date and time the version was created.' + ) + changelog: Optional[str] = Field( + None, description='Summary of changes made in this version' + ) + dependencies: Optional[List[str]] = Field( + None, description='A list of pip dependencies required by the node.' + ) + downloadUrl: Optional[str] = Field( + None, description='[Output Only] URL to download this version of the node' + ) + deprecated: Optional[bool] = Field( + None, description='Indicates if this version is deprecated.' + ) + status: Optional[NodeVersionStatus] = Field( + None, description='The status of the node version.' + ) + status_reason: Optional[str] = Field( + None, description='The reason for the status change.' + ) + node_id: Optional[str] = Field( + None, description='The unique identifier of the node.' + ) + comfy_node_extract_status: Optional[str] = Field( + None, description='The status of comfy node extraction process.' + ) + + +class IdeogramV3Request(BaseModel): + prompt: str = Field(..., description='The text prompt for image generation') + seed: Optional[int] = Field( + None, description='Seed value for reproducible generation' + ) + resolution: Optional[str] = Field( + None, description='Image resolution in format WxH', examples=['1280x800'] + ) + aspect_ratio: Optional[str] = Field( + None, description='Aspect ratio in format WxH', examples=['1x3'] + ) + rendering_speed: RenderingSpeed + magic_prompt: Optional[MagicPrompt] = Field( + None, description='Whether to enable magic prompt enhancement' + ) + negative_prompt: Optional[str] = Field( + None, description='Text prompt specifying what to avoid in the generation' + ) + num_images: Optional[int] = Field( + None, description='Number of images to generate', ge=1 + ) + color_palette: Optional[ColorPalette] = None + style_codes: Optional[List[StyleCode]] = Field( + None, description='Array of style codes in hexadecimal format' + ) + style_type: Optional[StyleType] = Field( + None, description='The type of style to apply' + ) + style_reference_images: Optional[List[str]] = Field( + None, description='Array of reference image URLs or identifiers' + ) + + +class IdeogramV3EditRequest(BaseModel): + image: Optional[StrictBytes] = Field( + None, + description='The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.', + ) + mask: Optional[StrictBytes] = Field( + None, + description='A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time.', + ) + prompt: str = Field( + ..., description='The prompt used to describe the edited result.' + ) + magic_prompt: Optional[str] = Field( + None, + description='Determine if MagicPrompt should be used in generating the request or not.', + ) + num_images: Optional[int] = Field( + None, description='The number of images to generate.' + ) + seed: Optional[int] = Field( + None, description='Random seed. Set for reproducible generation.' + ) + rendering_speed: RenderingSpeed + color_palette: Optional[IdeogramColorPalette] = Field( + None, + description='A color palette for generation, must EITHER be specified via one of the presets (name) or explicitly via hexadecimal representations of the color with optional weights (members). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models.', + ) + style_codes: Optional[List[StyleCode]] = Field( + None, + description='A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.', + ) + style_reference_images: Optional[List[StrictBytes]] = Field( + None, + description='A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format.', + ) + + +class KlingCameraControl(BaseModel): + type: Optional[KlingCameraControlType] = None + config: Optional[KlingCameraConfig] = None + + +class KlingText2VideoRequest(BaseModel): + model_name: Optional[KlingVideoGenModelName] = 'kling-v2-master' + prompt: Optional[str] = Field( + None, description='Positive text prompt', max_length=2500 + ) + negative_prompt: Optional[str] = Field( + None, description='Negative text prompt', max_length=2500 + ) + cfg_scale: Optional[KlingVideoGenCfgScale] = Field( + default_factory=lambda: KlingVideoGenCfgScale.model_validate(0.5) + ) + mode: Optional[KlingVideoGenMode] = 'std' + camera_control: Optional[KlingCameraControl] = None + aspect_ratio: Optional[KlingVideoGenAspectRatio] = '16:9' + duration: Optional[KlingVideoGenDuration] = '5' + callback_url: Optional[AnyUrl] = Field( + None, description='The callback notification address' + ) + external_task_id: Optional[str] = Field(None, description='Customized Task ID') + + +class KlingImage2VideoRequest(BaseModel): + model_name: Optional[KlingVideoGenModelName] = 'kling-v2-master' + image: Optional[str] = Field( + None, + description='Reference Image - URL or Base64 encoded string, cannot exceed 10MB, resolution not less than 300*300px, aspect ratio between 1:2.5 ~ 2.5:1. Base64 should not include data:image prefix.', + ) + image_tail: Optional[str] = Field( + None, + description='Reference Image - End frame control. URL or Base64 encoded string, cannot exceed 10MB, resolution not less than 300*300px. Base64 should not include data:image prefix.', + ) + prompt: Optional[str] = Field( + None, description='Positive text prompt', max_length=2500 + ) + negative_prompt: Optional[str] = Field( + None, description='Negative text prompt', max_length=2500 + ) + cfg_scale: Optional[KlingVideoGenCfgScale] = Field( + default_factory=lambda: KlingVideoGenCfgScale.model_validate(0.5) + ) + mode: Optional[KlingVideoGenMode] = 'std' + static_mask: Optional[str] = Field( + None, + description='Static Brush Application Area (Mask image created by users using the motion brush). The aspect ratio must match the input image.', + ) + dynamic_masks: Optional[List[DynamicMask]] = Field( + None, + description='Dynamic Brush Configuration List (up to 6 groups). For 5-second videos, trajectory length must not exceed 77 coordinates.', + ) + camera_control: Optional[KlingCameraControl] = None + aspect_ratio: Optional[KlingVideoGenAspectRatio] = '16:9' + duration: Optional[KlingVideoGenDuration] = '5' + callback_url: Optional[AnyUrl] = Field( + None, + description='The callback notification address. Server will notify when the task status changes.', + ) + external_task_id: Optional[str] = Field( + None, + description='Customized Task ID. Must be unique within a single user account.', + ) + + +class KlingVideoEffectsInput( + RootModel[Union[KlingSingleImageEffectInput, KlingDualCharacterEffectInput]] +): + root: Union[KlingSingleImageEffectInput, KlingDualCharacterEffectInput] + + +class StripeBillingDetails(BaseModel): + address: Optional[StripeAddress] = None + email: Optional[str] = None + name: Optional[str] = None + phone: Optional[str] = None + tax_id: Optional[Any] = None + + +class StripePaymentMethodDetails(BaseModel): + card: Optional[StripeCardDetails] = None + type: Optional[str] = None + + +class BFLFluxProFillInputs(BaseModel): + image: str = Field( + ..., + description='A Base64-encoded string representing the image you wish to modify. Can contain alpha mask if desired.', + title='Image', + ) + mask: Optional[str] = Field( + None, + description='A Base64-encoded string representing a mask for the areas you want to modify in the image. The mask should be the same dimensions as the image and in black and white. Black areas (0%) indicate no modification, while white areas (100%) specify areas for inpainting. Optional if you provide an alpha mask in the original image. Validation: The endpoint verifies that the dimensions of the mask match the original image.', + title='Mask', + ) + prompt: Optional[str] = Field( + '', + description='The description of the changes you want to make. This text guides the inpainting process, allowing you to specify features, styles, or modifications for the masked area.', + examples=['ein fantastisches bild'], + title='Prompt', + ) + steps: Optional[Steps] = Field( + default_factory=lambda: Steps.model_validate(50), + description='Number of steps for the image generation process', + examples=[50], + title='Steps', + ) + prompt_upsampling: Optional[bool] = Field( + False, + description='Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation', + title='Prompt Upsampling', + ) + seed: Optional[int] = Field( + None, description='Optional seed for reproducibility', title='Seed' + ) + guidance: Optional[Guidance] = Field( + default_factory=lambda: Guidance.model_validate(60), + description='Guidance strength for the image generation process', + title='Guidance', + ) + output_format: Optional[BFLOutputFormat] = Field( + 'jpeg', + description="Output format for the generated image. Can be 'jpeg' or 'png'.", + ) + safety_tolerance: Optional[int] = Field( + 2, + description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict.', + examples=[2], + ge=0, + le=6, + title='Safety Tolerance', + ) + webhook_url: Optional[WebhookUrl] = Field( + None, description='URL to receive webhook notifications', title='Webhook Url' + ) + webhook_secret: Optional[str] = Field( + None, + description='Optional secret for webhook signature verification', + title='Webhook Secret', + ) + + +class BFLHTTPValidationError(BaseModel): + detail: Optional[List[BFLValidationError]] = Field(None, title='Detail') + + +class BFLFluxProExpandInputs(BaseModel): + image: str = Field( + ..., + description='A Base64-encoded string representing the image you wish to expand.', + title='Image', + ) + top: Optional[Top] = Field( + 0, description='Number of pixels to expand at the top of the image', title='Top' + ) + bottom: Optional[Bottom] = Field( + 0, + description='Number of pixels to expand at the bottom of the image', + title='Bottom', + ) + left: Optional[Left] = Field( + 0, + description='Number of pixels to expand on the left side of the image', + title='Left', + ) + right: Optional[Right] = Field( + 0, + description='Number of pixels to expand on the right side of the image', + title='Right', + ) + prompt: Optional[str] = Field( + '', + description='The description of the changes you want to make. This text guides the expansion process, allowing you to specify features, styles, or modifications for the expanded areas.', + examples=['ein fantastisches bild'], + title='Prompt', + ) + steps: Optional[Steps] = Field( + default_factory=lambda: Steps.model_validate(50), + description='Number of steps for the image generation process', + examples=[50], + title='Steps', + ) + prompt_upsampling: Optional[bool] = Field( + False, + description='Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation', + title='Prompt Upsampling', + ) + seed: Optional[int] = Field( + None, description='Optional seed for reproducibility', title='Seed' + ) + guidance: Optional[Guidance] = Field( + default_factory=lambda: Guidance.model_validate(60), + description='Guidance strength for the image generation process', + title='Guidance', + ) + output_format: Optional[BFLOutputFormat] = Field( + 'jpeg', + description="Output format for the generated image. Can be 'jpeg' or 'png'.", + ) + safety_tolerance: Optional[int] = Field( + 2, + description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict.', + examples=[2], + ge=0, + le=6, + title='Safety Tolerance', + ) + webhook_url: Optional[WebhookUrl] = Field( + None, description='URL to receive webhook notifications', title='Webhook Url' + ) + webhook_secret: Optional[str] = Field( + None, + description='Optional secret for webhook signature verification', + title='Webhook Secret', + ) + + +class BFLCannyInputs(BaseModel): + prompt: str = Field( + ..., + description='Text prompt for image generation', + examples=['ein fantastisches bild'], + title='Prompt', + ) + control_image: Optional[str] = Field( + None, + description='Base64 encoded image to use as control input if no preprocessed image is provided', + title='Control Image', + ) + preprocessed_image: Optional[str] = Field( + None, + description='Optional pre-processed image that will bypass the control preprocessing step', + title='Preprocessed Image', + ) + canny_low_threshold: Optional[CannyLowThreshold] = Field( + default_factory=lambda: CannyLowThreshold.model_validate(50), + description='Low threshold for Canny edge detection', + title='Canny Low Threshold', + ) + canny_high_threshold: Optional[CannyHighThreshold] = Field( + default_factory=lambda: CannyHighThreshold.model_validate(200), + description='High threshold for Canny edge detection', + title='Canny High Threshold', + ) + prompt_upsampling: Optional[bool] = Field( + False, + description='Whether to perform upsampling on the prompt', + title='Prompt Upsampling', + ) + seed: Optional[int] = Field( + None, + description='Optional seed for reproducibility', + examples=[42], + title='Seed', + ) + steps: Optional[Steps2] = Field( + default_factory=lambda: Steps2.model_validate(50), + description='Number of steps for the image generation process', + title='Steps', + ) + output_format: Optional[BFLOutputFormat] = Field( + 'jpeg', + description="Output format for the generated image. Can be 'jpeg' or 'png'.", + ) + guidance: Optional[Guidance2] = Field( + default_factory=lambda: Guidance2.model_validate(30), + description='Guidance strength for the image generation process', + title='Guidance', + ) + safety_tolerance: Optional[int] = Field( + 2, + description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict.', + ge=0, + le=6, + title='Safety Tolerance', + ) + webhook_url: Optional[WebhookUrl] = Field( + None, description='URL to receive webhook notifications', title='Webhook Url' + ) + webhook_secret: Optional[str] = Field( + None, + description='Optional secret for webhook signature verification', + title='Webhook Secret', + ) + + +class BFLDepthInputs(BaseModel): + prompt: str = Field( + ..., + description='Text prompt for image generation', + examples=['ein fantastisches bild'], + title='Prompt', + ) + control_image: Optional[str] = Field( + None, + description='Base64 encoded image to use as control input', + title='Control Image', + ) + preprocessed_image: Optional[str] = Field( + None, + description='Optional pre-processed image that will bypass the control preprocessing step', + title='Preprocessed Image', + ) + prompt_upsampling: Optional[bool] = Field( + False, + description='Whether to perform upsampling on the prompt', + title='Prompt Upsampling', + ) + seed: Optional[int] = Field( + None, + description='Optional seed for reproducibility', + examples=[42], + title='Seed', + ) + steps: Optional[Steps2] = Field( + default_factory=lambda: Steps2.model_validate(50), + description='Number of steps for the image generation process', + title='Steps', + ) + output_format: Optional[BFLOutputFormat] = Field( + 'jpeg', + description="Output format for the generated image. Can be 'jpeg' or 'png'.", + ) + guidance: Optional[Guidance2] = Field( + default_factory=lambda: Guidance2.model_validate(15), + description='Guidance strength for the image generation process', + title='Guidance', + ) + safety_tolerance: Optional[int] = Field( + 2, + description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict.', + ge=0, + le=6, + title='Safety Tolerance', + ) + webhook_url: Optional[WebhookUrl] = Field( + None, description='URL to receive webhook notifications', title='Webhook Url' + ) + webhook_secret: Optional[str] = Field( + None, + description='Optional secret for webhook signature verification', + title='Webhook Secret', + ) + + +class Controls(BaseModel): + artistic_level: Optional[int] = Field( + None, + description='Defines artistic tone of your image. At a simple level, the person looks straight at the camera in a static and clean style. Dynamic and eccentric levels introduce movement and creativity.', + ge=0, + le=5, + ) + colors: Optional[List[RGBColor]] = Field( + None, description='An array of preferable colors' + ) + background_color: Optional[RGBColor] = Field( + None, description='Use given color as a desired background color' + ) + no_text: Optional[bool] = Field(None, description='Do not embed text layouts') + + +class RecraftImageGenerationRequest(BaseModel): + prompt: str = Field( + ..., description='The text prompt describing the image to generate' + ) + model: str = Field( + ..., description='The model to use for generation (e.g., "recraftv3")' + ) + style: Optional[str] = Field( + None, + description='The style to apply to the generated image (e.g., "digital_illustration")', + ) + style_id: Optional[str] = Field( + None, + description='The style ID to apply to the generated image (e.g., "123e4567-e89b-12d3-a456-426614174000"). If style_id is provided, style should not be provided.', + ) + size: str = Field( + ..., description='The size of the generated image (e.g., "1024x1024")' + ) + controls: Optional[Controls] = Field( + None, description='The controls for the generated image' + ) + n: int = Field(..., description='The number of images to generate', ge=1, le=4) + + +class LumaKeyframes(BaseModel): + frame0: Optional[LumaKeyframe] = None + frame1: Optional[LumaKeyframe] = None + + +class LumaGenerationRequest(BaseModel): + generation_type: Optional[GenerationType] = 'video' + prompt: str = Field(..., description='The prompt of the generation') + aspect_ratio: LumaAspectRatio + loop: Optional[bool] = Field(None, description='Whether to loop the video') + keyframes: Optional[LumaKeyframes] = None + callback_url: Optional[AnyUrl] = Field( + None, + description='The callback URL of the generation, a POST request with Generation object will be sent to the callback URL when the generation is dreaming, completed, or failed', + ) + model: LumaVideoModel + resolution: LumaVideoModelOutputResolution + duration: LumaVideoModelOutputDuration + + +class LumaGeneration(BaseModel): + id: Optional[UUID] = Field(None, description='The ID of the generation') + generation_type: Optional[LumaGenerationType] = None + state: Optional[LumaState] = None + failure_reason: Optional[str] = Field( + None, description='The reason for the state of the generation' + ) + created_at: Optional[datetime] = Field( + None, description='The date and time when the generation was created' + ) + assets: Optional[LumaAssets] = None + model: Optional[str] = Field(None, description='The model used for the generation') + request: Optional[ + Union[ + LumaGenerationRequest, + LumaImageGenerationRequest, + LumaUpscaleVideoGenerationRequest, + LumaAudioGenerationRequest, + ] + ] = Field(None, description='The request of the generation') + + +class RunwayImageToVideoRequest(BaseModel): + promptImage: RunwayPromptImageObject + seed: int = Field( + ..., description='Random seed for generation', ge=0, le=4294967295 + ) + model: RunwayModelEnum = Field(..., description='Model to use for generation') + promptText: Optional[str] = Field( + None, description='Text prompt for the generation', max_length=1000 + ) + duration: RunwayDurationEnum = Field( + ..., description='The number of seconds of duration for the output video.' + ) + ratio: RunwayAspectRatioEnum = Field( + ..., + description='The resolution (aspect ratio) of the output video. Allowable values depend on the selected model. 1280:768 and 768:1280 are only supported for gen3a_turbo.', + ) + + +class RunwayTaskStatusResponse(BaseModel): + id: Optional[str] = Field(None, description='Task ID') + status: Optional[RunwayTaskStatusEnum] = Field(None, description='Task status') + createdAt: Optional[datetime] = Field(None, description='Task creation timestamp') + output: Optional[List[str]] = Field(None, description='Array of output video URLs') + + +class PikaHTTPValidationError(BaseModel): + detail: Optional[List[PikaValidationError]] = Field(None, title='Detail') + + +class PikaBodyGenerate22T2vGenerate22T2vPost(BaseModel): + promptText: str = Field(..., title='Prompttext') + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + seed: Optional[int] = Field(None, title='Seed') + resolution: Optional[PikaResolutionEnum] = Field('1080p', title='Resolution') + duration: Optional[PikaDurationEnum] = Field(5, title='Duration') + aspectRatio: Optional[float] = Field( + 1.7777777777777777, + description='Aspect ratio (width / height)', + ge=0.4, + le=2.5, + title='Aspectratio', + ) + + +class PikaBodyGenerate22I2vGenerate22I2vPost(BaseModel): + image: Optional[StrictBytes] = Field(None, title='Image') + promptText: Optional[str] = Field(None, title='Prompttext') + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + seed: Optional[int] = Field(None, title='Seed') + resolution: Optional[PikaResolutionEnum] = Field('1080p', title='Resolution') + duration: Optional[PikaDurationEnum] = Field(5, title='Duration') + + +class PikaBodyGenerate22KeyframeGenerate22PikaframesPost(BaseModel): + keyFrames: Optional[List[StrictBytes]] = Field( + None, description='Array of keyframe images', title='Keyframes' + ) + promptText: str = Field(..., title='Prompttext') + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + seed: Optional[int] = Field(None, title='Seed') + resolution: Optional[PikaResolutionEnum] = Field('1080p', title='Resolution') + duration: Optional[int] = Field(None, ge=5, le=10, title='Duration') + + +class PikaVideoResponse(BaseModel): + id: str = Field(..., title='Id') + status: PikaStatusEnum = Field( + ..., description='The status of the video', title='Status' + ) + url: Optional[str] = Field(None, title='Url') + progress: Optional[int] = Field(None, title='Progress') + + +class Node(BaseModel): + id: Optional[str] = Field(None, description='The unique identifier of the node.') + name: Optional[str] = Field(None, description='The display name of the node.') + category: Optional[str] = Field(None, description='The category of the node.') + description: Optional[str] = None + author: Optional[str] = None + license: Optional[str] = Field( + None, description="The path to the LICENSE file in the node's repository." + ) + icon: Optional[str] = Field(None, description="URL to the node's icon.") + repository: Optional[str] = Field(None, description="URL to the node's repository.") + tags: Optional[List[str]] = None + latest_version: Optional[NodeVersion] = Field( + None, description='The latest version of the node.' + ) + rating: Optional[float] = Field(None, description='The average rating of the node.') + downloads: Optional[int] = Field( + None, description='The number of downloads of the node.' + ) + publisher: Optional[Publisher] = Field( + None, description='The publisher of the node.' + ) + status: Optional[NodeStatus] = Field(None, description='The status of the node.') + status_detail: Optional[str] = Field( + None, description='The status detail of the node.' + ) + translations: Optional[Dict[str, Dict[str, Any]]] = None + + +class KlingVideoEffectsRequest(BaseModel): + effect_scene: Union[KlingDualCharacterEffectsScene, KlingSingleImageEffectsScene] + input: KlingVideoEffectsInput + callback_url: Optional[AnyUrl] = Field( + None, + description='The callback notification address for the result of this task.', + ) + external_task_id: Optional[str] = Field( + None, + description='Customized Task ID. Must be unique within a single user account.', + ) + + +class StripeCharge(BaseModel): + id: Optional[str] = None + object: Optional[Object2] = None + amount: Optional[int] = None + amount_captured: Optional[int] = None + amount_refunded: Optional[int] = None + application: Optional[str] = None + application_fee: Optional[str] = None + application_fee_amount: Optional[int] = None + balance_transaction: Optional[str] = None + billing_details: Optional[StripeBillingDetails] = None + calculated_statement_descriptor: Optional[str] = None + captured: Optional[bool] = None + created: Optional[int] = None + currency: Optional[str] = None + customer: Optional[str] = None + description: Optional[str] = None + destination: Optional[Any] = None + dispute: Optional[Any] = None + disputed: Optional[bool] = None + failure_balance_transaction: Optional[Any] = None + failure_code: Optional[Any] = None + failure_message: Optional[Any] = None + fraud_details: Optional[Dict[str, Any]] = None + invoice: Optional[Any] = None + livemode: Optional[bool] = None + metadata: Optional[Dict[str, Any]] = None + on_behalf_of: Optional[Any] = None + order: Optional[Any] = None + outcome: Optional[StripeOutcome] = None + paid: Optional[bool] = None + payment_intent: Optional[str] = None + payment_method: Optional[str] = None + payment_method_details: Optional[StripePaymentMethodDetails] = None + radar_options: Optional[Dict[str, Any]] = None + receipt_email: Optional[str] = None + receipt_number: Optional[str] = None + receipt_url: Optional[str] = None + refunded: Optional[bool] = None + refunds: Optional[StripeRefundList] = None + review: Optional[Any] = None + shipping: Optional[StripeShipping] = None + source: Optional[Any] = None + source_transfer: Optional[Any] = None + statement_descriptor: Optional[Any] = None + statement_descriptor_suffix: Optional[Any] = None + status: Optional[str] = None + transfer_data: Optional[Any] = None + transfer_group: Optional[Any] = None + + +class StripeChargeList(BaseModel): + object: Optional[str] = None + data: Optional[List[StripeCharge]] = None + has_more: Optional[bool] = None + total_count: Optional[int] = None + url: Optional[str] = None + + +class StripePaymentIntent(BaseModel): + id: Optional[str] = None + object: Optional[Object1] = None + amount: Optional[int] = None + amount_capturable: Optional[int] = None + amount_details: Optional[StripeAmountDetails] = None + amount_received: Optional[int] = None + application: Optional[str] = None + application_fee_amount: Optional[int] = None + automatic_payment_methods: Optional[Any] = None + canceled_at: Optional[int] = None + cancellation_reason: Optional[str] = None + capture_method: Optional[str] = None + charges: Optional[StripeChargeList] = None + client_secret: Optional[str] = None + confirmation_method: Optional[str] = None + created: Optional[int] = None + currency: Optional[str] = None + customer: Optional[str] = None + description: Optional[str] = None + invoice: Optional[str] = None + last_payment_error: Optional[Any] = None + latest_charge: Optional[str] = None + livemode: Optional[bool] = None + metadata: Optional[Dict[str, Any]] = None + next_action: Optional[Any] = None + on_behalf_of: Optional[Any] = None + payment_method: Optional[str] = None + payment_method_configuration_details: Optional[Any] = None + payment_method_options: Optional[StripePaymentMethodOptions] = None + payment_method_types: Optional[List[str]] = None + processing: Optional[Any] = None + receipt_email: Optional[str] = None + review: Optional[Any] = None + setup_future_usage: Optional[Any] = None + shipping: Optional[StripeShipping] = None + source: Optional[Any] = None + statement_descriptor: Optional[Any] = None + statement_descriptor_suffix: Optional[Any] = None + status: Optional[str] = None + transfer_data: Optional[Any] = None + transfer_group: Optional[Any] = None + + +class Data8(BaseModel): + object: Optional[StripePaymentIntent] = None + + +class StripeEvent(BaseModel): + id: str + object: Object + api_version: Optional[str] = None + created: Optional[int] = None + data: Data8 + livemode: Optional[bool] = None + pending_webhooks: Optional[int] = None + request: Optional[StripeRequestInfo] = None + type: Type diff --git a/comfy_api_nodes/apis/bfl_api.py b/comfy_api_nodes/apis/bfl_api.py new file mode 100644 index 000000000..c189038fb --- /dev/null +++ b/comfy_api_nodes/apis/bfl_api.py @@ -0,0 +1,156 @@ +from __future__ import annotations + +from enum import Enum +from typing import Any, Dict, Optional + +from pydantic import BaseModel, Field, confloat, conint + + +class BFLOutputFormat(str, Enum): + png = 'png' + jpeg = 'jpeg' + + +class BFLFluxExpandImageRequest(BaseModel): + prompt: str = Field(..., description='The description of the changes you want to make. This text guides the expansion process, allowing you to specify features, styles, or modifications for the expanded areas.') + prompt_upsampling: Optional[bool] = Field( + None, description='Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation.' + ) + seed: Optional[int] = Field(None, description='The seed value for reproducibility.') + top: conint(ge=0, le=2048) = Field(..., description='Number of pixels to expand at the top of the image') + bottom: conint(ge=0, le=2048) = Field(..., description='Number of pixels to expand at the bottom of the image') + left: conint(ge=0, le=2048) = Field(..., description='Number of pixels to expand at the left side of the image') + right: conint(ge=0, le=2048) = Field(..., description='Number of pixels to expand at the right side of the image') + steps: conint(ge=15, le=50) = Field(..., description='Number of steps for the image generation process') + guidance: confloat(ge=1.5, le=100) = Field(..., description='Guidance strength for the image generation process') + safety_tolerance: Optional[conint(ge=0, le=6)] = Field( + 6, description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict. Defaults to 2.' + ) + output_format: Optional[BFLOutputFormat] = Field( + BFLOutputFormat.png, description="Output format for the generated image. Can be 'jpeg' or 'png'.", examples=['png'] + ) + image: str = Field(None, description='A Base64-encoded string representing the image you wish to expand') + + +class BFLFluxFillImageRequest(BaseModel): + prompt: str = Field(..., description='The description of the changes you want to make. This text guides the expansion process, allowing you to specify features, styles, or modifications for the expanded areas.') + prompt_upsampling: Optional[bool] = Field( + None, description='Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation.' + ) + seed: Optional[int] = Field(None, description='The seed value for reproducibility.') + steps: conint(ge=15, le=50) = Field(..., description='Number of steps for the image generation process') + guidance: confloat(ge=1.5, le=100) = Field(..., description='Guidance strength for the image generation process') + safety_tolerance: Optional[conint(ge=0, le=6)] = Field( + 6, description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict. Defaults to 2.' + ) + output_format: Optional[BFLOutputFormat] = Field( + BFLOutputFormat.png, description="Output format for the generated image. Can be 'jpeg' or 'png'.", examples=['png'] + ) + image: str = Field(None, description='A Base64-encoded string representing the image you wish to modify. Can contain alpha mask if desired.') + mask: str = Field(None, description='A Base64-encoded string representing the mask of the areas you with to modify.') + + +class BFLFluxCannyImageRequest(BaseModel): + prompt: str = Field(..., description='Text prompt for image generation') + prompt_upsampling: Optional[bool] = Field( + None, description='Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation.' + ) + canny_low_threshold: Optional[int] = Field(None, description='Low threshold for Canny edge detection') + canny_high_threshold: Optional[int] = Field(None, description='High threshold for Canny edge detection') + seed: Optional[int] = Field(None, description='The seed value for reproducibility.') + steps: conint(ge=15, le=50) = Field(..., description='Number of steps for the image generation process') + guidance: confloat(ge=1, le=100) = Field(..., description='Guidance strength for the image generation process') + safety_tolerance: Optional[conint(ge=0, le=6)] = Field( + 6, description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict. Defaults to 2.' + ) + output_format: Optional[BFLOutputFormat] = Field( + BFLOutputFormat.png, description="Output format for the generated image. Can be 'jpeg' or 'png'.", examples=['png'] + ) + control_image: Optional[str] = Field(None, description='Base64 encoded image to use as control input if no preprocessed image is provided') + preprocessed_image: Optional[str] = Field(None, description='Optional pre-processed image that will bypass the control preprocessing step') + + +class BFLFluxDepthImageRequest(BaseModel): + prompt: str = Field(..., description='Text prompt for image generation') + prompt_upsampling: Optional[bool] = Field( + None, description='Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation.' + ) + seed: Optional[int] = Field(None, description='The seed value for reproducibility.') + steps: conint(ge=15, le=50) = Field(..., description='Number of steps for the image generation process') + guidance: confloat(ge=1, le=100) = Field(..., description='Guidance strength for the image generation process') + safety_tolerance: Optional[conint(ge=0, le=6)] = Field( + 6, description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict. Defaults to 2.' + ) + output_format: Optional[BFLOutputFormat] = Field( + BFLOutputFormat.png, description="Output format for the generated image. Can be 'jpeg' or 'png'.", examples=['png'] + ) + control_image: Optional[str] = Field(None, description='Base64 encoded image to use as control input if no preprocessed image is provided') + preprocessed_image: Optional[str] = Field(None, description='Optional pre-processed image that will bypass the control preprocessing step') + + +class BFLFluxProGenerateRequest(BaseModel): + prompt: str = Field(..., description='The text prompt for image generation.') + prompt_upsampling: Optional[bool] = Field( + None, description='Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation.' + ) + seed: Optional[int] = Field(None, description='The seed value for reproducibility.') + width: conint(ge=256, le=1440) = Field(1024, description='Width of the generated image in pixels. Must be a multiple of 32.') + height: conint(ge=256, le=1440) = Field(768, description='Height of the generated image in pixels. Must be a multiple of 32.') + safety_tolerance: Optional[conint(ge=0, le=6)] = Field( + 6, description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict. Defaults to 2.' + ) + output_format: Optional[BFLOutputFormat] = Field( + BFLOutputFormat.png, description="Output format for the generated image. Can be 'jpeg' or 'png'.", examples=['png'] + ) + image_prompt: Optional[str] = Field(None, description='Optional image to remix in base64 format') + # image_prompt_strength: Optional[confloat(ge=0.0, le=1.0)] = Field( + # None, description='Blend between the prompt and the image prompt.' + # ) + + +class BFLFluxProUltraGenerateRequest(BaseModel): + prompt: str = Field(..., description='The text prompt for image generation.') + prompt_upsampling: Optional[bool] = Field( + None, description='Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation.' + ) + seed: Optional[int] = Field(None, description='The seed value for reproducibility.') + aspect_ratio: Optional[str] = Field(None, description='Aspect ratio of the image between 21:9 and 9:21.') + safety_tolerance: Optional[conint(ge=0, le=6)] = Field( + 6, description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict. Defaults to 2.' + ) + output_format: Optional[BFLOutputFormat] = Field( + BFLOutputFormat.png, description="Output format for the generated image. Can be 'jpeg' or 'png'.", examples=['png'] + ) + raw: Optional[bool] = Field(None, description='Generate less processed, more natural-looking images.') + image_prompt: Optional[str] = Field(None, description='Optional image to remix in base64 format') + image_prompt_strength: Optional[confloat(ge=0.0, le=1.0)] = Field( + None, description='Blend between the prompt and the image prompt.' + ) + + +class BFLFluxProGenerateResponse(BaseModel): + id: str = Field(..., description='The unique identifier for the generation task.') + polling_url: str = Field(..., description='URL to poll for the generation result.') + + +class BFLStatus(str, Enum): + task_not_found = "Task not found" + pending = "Pending" + request_moderated = "Request Moderated" + content_moderated = "Content Moderated" + ready = "Ready" + error = "Error" + + +class BFLFluxProStatusResponse(BaseModel): + id: str = Field(..., description="The unique identifier for the generation task.") + status: BFLStatus = Field(..., description="The status of the task.") + result: Optional[Dict[str, Any]] = Field( + None, description="The result of the task (null if not completed)." + ) + progress: confloat(ge=0.0, le=1.0) = Field( + ..., description="The progress of the task (0.0 to 1.0)." + ) + details: Optional[Dict[str, Any]] = Field( + None, description="Additional details about the task (null if not available)." + ) diff --git a/comfy_api_nodes/apis/client.py b/comfy_api_nodes/apis/client.py index d3cd9ad2f..929e386d4 100644 --- a/comfy_api_nodes/apis/client.py +++ b/comfy_api_nodes/apis/client.py @@ -1,5 +1,3 @@ -import logging - """ API Client Framework for api.comfy.org. @@ -46,24 +44,71 @@ operation = ApiOperation( ) user_profile = operation.execute(client=api_client) # Returns immediately with the result + +# Example 2: Asynchronous API Operation with Polling +# ------------------------------------------------- +# For an API that starts a task and requires polling for completion: + +# 1. Define the endpoints (initial request and polling) +generate_image_endpoint = ApiEndpoint( + path="/v1/images/generate", + method=HttpMethod.POST, + request_model=ImageGenerationRequest, + response_model=TaskCreatedResponse, + query_params=None +) + +check_task_endpoint = ApiEndpoint( + path="/v1/tasks/{task_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=ImageGenerationResult, + query_params=None +) + +# 2. Create the request object +request = ImageGenerationRequest( + prompt="a beautiful sunset over mountains", + width=1024, + height=1024, + num_images=1 +) + +# 3. Create and execute the polling operation +operation = PollingOperation( + initial_endpoint=generate_image_endpoint, + initial_request=request, + poll_endpoint=check_task_endpoint, + task_id_field="task_id", + status_field="status", + completed_statuses=["completed"], + failed_statuses=["failed", "error"] +) + +# This will make the initial request and then poll until completion +result = operation.execute(client=api_client) # Returns the final ImageGenerationResult when done """ -from typing import ( - Dict, - Type, - Optional, - Any, - TypeVar, - Generic, -) -from pydantic import BaseModel +from __future__ import annotations +import logging +import time +import io +from typing import Dict, Type, Optional, Any, TypeVar, Generic, Callable from enum import Enum import json import requests from urllib.parse import urljoin +from pydantic import BaseModel, Field + +from comfy.cli_args import args +from comfy import utils T = TypeVar("T", bound=BaseModel) R = TypeVar("R", bound=BaseModel) +P = TypeVar("P", bound=BaseModel) # For poll response + +PROGRESS_BAR_MAX = 100 + class EmptyRequest(BaseModel): """Base class for empty request bodies. @@ -72,6 +117,19 @@ class EmptyRequest(BaseModel): pass +class UploadRequest(BaseModel): + file_name: str = Field(..., description="Filename to upload") + content_type: str | None = Field( + None, + description="Mime type of the file. For example: image/png, image/jpeg, video/mp4, etc.", + ) + + +class UploadResponse(BaseModel): + download_url: str = Field(..., description="URL to GET uploaded file") + upload_url: str = Field(..., description="URL to PUT file to upload") + + class HttpMethod(str, Enum): GET = "GET" POST = "POST" @@ -89,7 +147,7 @@ class ApiClient: self, base_url: str, api_key: Optional[str] = None, - timeout: float = 30.0, + timeout: float = 3600.0, verify_ssl: bool = True, ): self.base_url = base_url @@ -97,6 +155,48 @@ class ApiClient: self.timeout = timeout self.verify_ssl = verify_ssl + def _create_json_payload_args( + self, + data: Optional[Dict[str, Any]] = None, + headers: Optional[Dict[str, str]] = None, + ) -> Dict[str, Any]: + return { + "json": data, + "headers": headers, + } + + def _create_form_data_args( + self, + data: Dict[str, Any], + files: Dict[str, Any], + headers: Optional[Dict[str, str]] = None, + multipart_parser = None, + ) -> Dict[str, Any]: + if headers and "Content-Type" in headers: + del headers["Content-Type"] + + if multipart_parser: + data = multipart_parser(data) + + return { + "data": data, + "files": files, + "headers": headers, + } + + def _create_urlencoded_form_data_args( + self, + data: Dict[str, Any], + headers: Optional[Dict[str, str]] = None, + ) -> Dict[str, Any]: + headers = headers or {} + headers["Content-Type"] = "application/x-www-form-urlencoded" + + return { + "data": data, + "headers": headers, + } + def get_headers(self) -> Dict[str, str]: """Get headers for API requests, including authentication if available""" headers = {"Content-Type": "application/json", "Accept": "application/json"} @@ -111,9 +211,11 @@ class ApiClient: method: str, path: str, params: Optional[Dict[str, Any]] = None, - json: Optional[Dict[str, Any]] = None, + data: Optional[Dict[str, Any]] = None, files: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, + content_type: str = "application/json", + multipart_parser: Callable = None, ) -> Dict[str, Any]: """ Make an HTTP request to the API @@ -122,9 +224,10 @@ class ApiClient: method: HTTP method (GET, POST, etc.) path: API endpoint path (will be joined with base_url) params: Query parameters - json: JSON body data + data: body data files: Files to upload headers: Additional headers + content_type: Content type of the request. Defaults to application/json. Returns: Parsed JSON response @@ -146,34 +249,26 @@ class ApiClient: logging.debug(f"[DEBUG] Request Headers: {request_headers}") logging.debug(f"[DEBUG] Files: {files}") logging.debug(f"[DEBUG] Params: {params}") - logging.debug(f"[DEBUG] Json: {json}") + logging.debug(f"[DEBUG] Data: {data}") + + if content_type == "application/x-www-form-urlencoded": + payload_args = self._create_urlencoded_form_data_args(data, request_headers) + elif content_type == "multipart/form-data": + payload_args = self._create_form_data_args( + data, files, request_headers, multipart_parser + ) + else: + payload_args = self._create_json_payload_args(data, request_headers) try: - # If files are present, use data parameter instead of json - if files: - form_data = {} - if json: - form_data.update(json) - response = requests.request( - method=method, - url=url, - params=params, - data=form_data, # Use data instead of json - files=files, - headers=request_headers, - timeout=self.timeout, - verify=self.verify_ssl, - ) - else: - response = requests.request( - method=method, - url=url, - params=params, - json=json, - headers=request_headers, - timeout=self.timeout, - verify=self.verify_ssl, - ) + response = requests.request( + method=method, + url=url, + params=params, + timeout=self.timeout, + verify=self.verify_ssl, + **payload_args, + ) # Raise exception for error status codes response.raise_for_status() @@ -203,7 +298,9 @@ class ApiClient: error_message = f"API Error: {error_json}" except Exception as json_error: # If we can't parse the JSON, fall back to the original error message - logging.debug(f"[DEBUG] Failed to parse error response: {str(json_error)}") + logging.debug( + f"[DEBUG] Failed to parse error response: {str(json_error)}" + ) logging.debug(f"[DEBUG] API Error: {error_message} (Status: {status_code})") if hasattr(e, "response") and e.response.content: @@ -229,6 +326,32 @@ class ApiClient: raise Exception("Unauthorized: Please login first to use this node.") return auth_token + @staticmethod + def upload_file( + upload_url: str, + file: io.BytesIO | str, + content_type: str | None = None, + ): + """Upload a file to the API. Make sure the file has a filename equal to what the url expects. + + Args: + upload_url: The URL to upload to + file: Either a file path string, BytesIO object, or tuple of (file_path, filename) + mime_type: Optional mime type to set for the upload + """ + headers = {} + if content_type: + headers["Content-Type"] = content_type + + if isinstance(file, io.BytesIO): + file.seek(0) # Ensure we're at the start of the file + data = file.read() + return requests.put(upload_url, data=data, headers=headers) + elif isinstance(file, str): + with open(file, "rb") as f: + data = f.read() + return requests.put(upload_url, data=data, headers=headers) + class ApiEndpoint(Generic[T, R]): """Defines an API endpoint with its request and response types""" @@ -267,27 +390,29 @@ class SynchronousOperation(Generic[T, R]): endpoint: ApiEndpoint[T, R], request: T, files: Optional[Dict[str, Any]] = None, - api_base: str = "https://api.comfy.org", + api_base: str | None = None, auth_token: Optional[str] = None, timeout: float = 604800.0, verify_ssl: bool = True, + content_type: str = "application/json", + multipart_parser: Callable = None, ): self.endpoint = endpoint self.request = request self.response = None self.error = None - self.api_base = api_base + self.api_base: str = api_base or args.comfy_api_base self.auth_token = auth_token self.timeout = timeout self.verify_ssl = verify_ssl self.files = files + self.content_type = content_type + self.multipart_parser = multipart_parser def execute(self, client: Optional[ApiClient] = None) -> R: """Execute the API operation using the provided client or create one""" try: # Create client if not provided if client is None: - if self.api_base is None: - raise ValueError("Either client or api_base must be provided") client = ApiClient( base_url=self.api_base, api_key=self.auth_token, @@ -296,14 +421,25 @@ class SynchronousOperation(Generic[T, R]): ) # Convert request model to dict, but use None for EmptyRequest - request_dict = None if isinstance(self.request, EmptyRequest) else self.request.model_dump(exclude_none=True) + request_dict = ( + None + if isinstance(self.request, EmptyRequest) + else self.request.model_dump(exclude_none=True) + ) if request_dict: for key, value in request_dict.items(): if isinstance(value, Enum): request_dict[key] = value.value + if request_dict: + for key, value in request_dict.items(): + if isinstance(value, Enum): + request_dict[key] = value.value + # Debug log for request - logging.debug(f"[DEBUG] API Request: {self.endpoint.method.value} {self.endpoint.path}") + logging.debug( + f"[DEBUG] API Request: {self.endpoint.method.value} {self.endpoint.path}" + ) logging.debug(f"[DEBUG] Request Data: {json.dumps(request_dict, indent=2)}") logging.debug(f"[DEBUG] Query Params: {self.endpoint.query_params}") @@ -311,9 +447,11 @@ class SynchronousOperation(Generic[T, R]): resp = client.request( method=self.endpoint.method.value, path=self.endpoint.path, - json=request_dict, + data=request_dict, params=self.endpoint.query_params, files=self.files, + content_type=self.content_type, + multipart_parser=self.multipart_parser ) # Debug log for response @@ -327,7 +465,7 @@ class SynchronousOperation(Generic[T, R]): return self._parse_response(resp) except Exception as e: - logging.debug(f"[DEBUG] API Exception: {str(e)}") + logging.error(f"[DEBUG] API Exception: {str(e)}") raise Exception(str(e)) def _parse_response(self, resp): @@ -339,3 +477,140 @@ class SynchronousOperation(Generic[T, R]): self.response = self.endpoint.response_model.model_validate(resp) logging.debug(f"[DEBUG] Parsed Response: {self.response}") return self.response + + +class TaskStatus(str, Enum): + """Enum for task status values""" + + COMPLETED = "completed" + FAILED = "failed" + PENDING = "pending" + + +class PollingOperation(Generic[T, R]): + """ + Represents an asynchronous API operation that requires polling for completion. + """ + + def __init__( + self, + poll_endpoint: ApiEndpoint[EmptyRequest, R], + completed_statuses: list, + failed_statuses: list, + status_extractor: Callable[[R], str], + progress_extractor: Callable[[R], float] = None, + request: Optional[T] = None, + api_base: str | None = None, + auth_token: Optional[str] = None, + poll_interval: float = 5.0, + ): + self.poll_endpoint = poll_endpoint + self.request = request + self.api_base: str = api_base or args.comfy_api_base + self.auth_token = auth_token + self.poll_interval = poll_interval + + # Polling configuration + self.status_extractor = status_extractor or ( + lambda x: getattr(x, "status", None) + ) + self.progress_extractor = progress_extractor + self.completed_statuses = completed_statuses + self.failed_statuses = failed_statuses + + # For storing response data + self.final_response = None + self.error = None + + def execute(self, client: Optional[ApiClient] = None) -> R: + """Execute the polling operation using the provided client. If failed, raise an exception.""" + try: + if client is None: + client = ApiClient( + base_url=self.api_base, + api_key=self.auth_token, + ) + return self._poll_until_complete(client) + except Exception as e: + raise Exception(f"Error during polling: {str(e)}") + + def _check_task_status(self, response: R) -> TaskStatus: + """Check task status using the status extractor function""" + try: + status = self.status_extractor(response) + if status in self.completed_statuses: + return TaskStatus.COMPLETED + elif status in self.failed_statuses: + return TaskStatus.FAILED + return TaskStatus.PENDING + except Exception as e: + logging.error(f"Error extracting status: {e}") + return TaskStatus.PENDING + + def _poll_until_complete(self, client: ApiClient) -> R: + """Poll until the task is complete""" + poll_count = 0 + if self.progress_extractor: + progress = utils.ProgressBar(PROGRESS_BAR_MAX) + + while True: + try: + poll_count += 1 + logging.debug(f"[DEBUG] Polling attempt #{poll_count}") + + request_dict = ( + self.request.model_dump(exclude_none=True) + if self.request is not None + else None + ) + + if poll_count == 1: + logging.debug( + f"[DEBUG] Poll Request: {self.poll_endpoint.method.value} {self.poll_endpoint.path}" + ) + logging.debug( + f"[DEBUG] Poll Request Data: {json.dumps(request_dict, indent=2) if request_dict else 'None'}" + ) + + # Query task status + resp = client.request( + method=self.poll_endpoint.method.value, + path=self.poll_endpoint.path, + params=self.poll_endpoint.query_params, + data=request_dict, + ) + + # Parse response + response_obj = self.poll_endpoint.response_model.model_validate(resp) + # Check if task is complete + status = self._check_task_status(response_obj) + logging.debug(f"[DEBUG] Task Status: {status}") + + # If progress extractor is provided, extract progress + if self.progress_extractor: + new_progress = self.progress_extractor(response_obj) + if new_progress is not None: + progress.update_absolute(new_progress, total=PROGRESS_BAR_MAX) + + if status == TaskStatus.COMPLETED: + logging.debug("[DEBUG] Task completed successfully") + self.final_response = response_obj + if self.progress_extractor: + progress.update(100) + return self.final_response + elif status == TaskStatus.FAILED: + message = f"Task failed: {json.dumps(resp)}" + logging.error(f"[DEBUG] {message}") + raise Exception(message) + else: + logging.debug("[DEBUG] Task still pending, continuing to poll...") + + # Wait before polling again + logging.debug( + f"[DEBUG] Waiting {self.poll_interval} seconds before next poll" + ) + time.sleep(self.poll_interval) + + except Exception as e: + logging.error(f"[DEBUG] Polling error: {str(e)}") + raise Exception(f"Error while polling: {str(e)}") diff --git a/comfy_api_nodes/apis/luma_api.py b/comfy_api_nodes/apis/luma_api.py new file mode 100644 index 000000000..632c4ab96 --- /dev/null +++ b/comfy_api_nodes/apis/luma_api.py @@ -0,0 +1,253 @@ +from __future__ import annotations + + +import torch + +from enum import Enum +from typing import Optional, Union + +from pydantic import BaseModel, Field, confloat + + + +class LumaIO: + LUMA_REF = "LUMA_REF" + LUMA_CONCEPTS = "LUMA_CONCEPTS" + + +class LumaReference: + def __init__(self, image: torch.Tensor, weight: float): + self.image = image + self.weight = weight + + def create_api_model(self, download_url: str): + return LumaImageRef(url=download_url, weight=self.weight) + +class LumaReferenceChain: + def __init__(self, first_ref: LumaReference=None): + self.refs: list[LumaReference] = [] + if first_ref: + self.refs.append(first_ref) + + def add(self, luma_ref: LumaReference=None): + self.refs.append(luma_ref) + + def create_api_model(self, download_urls: list[str], max_refs=4): + if len(self.refs) == 0: + return None + api_refs: list[LumaImageRef] = [] + for ref, url in zip(self.refs, download_urls): + api_ref = LumaImageRef(url=url, weight=ref.weight) + api_refs.append(api_ref) + return api_refs + + def clone(self): + c = LumaReferenceChain() + for ref in self.refs: + c.add(ref) + return c + + +class LumaConcept: + def __init__(self, key: str): + self.key = key + + +class LumaConceptChain: + def __init__(self, str_list: list[str] = None): + self.concepts: list[LumaConcept] = [] + if str_list is not None: + for c in str_list: + if c != "None": + self.add(LumaConcept(key=c)) + + def add(self, concept: LumaConcept): + self.concepts.append(concept) + + def create_api_model(self): + if len(self.concepts) == 0: + return None + api_concepts: list[LumaConceptObject] = [] + for concept in self.concepts: + if concept.key == "None": + continue + api_concepts.append(LumaConceptObject(key=concept.key)) + if len(api_concepts) == 0: + return None + return api_concepts + + def clone(self): + c = LumaConceptChain() + for concept in self.concepts: + c.add(concept) + return c + + def clone_and_merge(self, other: LumaConceptChain): + c = self.clone() + for concept in other.concepts: + c.add(concept) + return c + + +def get_luma_concepts(include_none=False): + concepts = [] + if include_none: + concepts.append("None") + return concepts + [ + "truck_left", + "pan_right", + "pedestal_down", + "low_angle", + "pedestal_up", + "selfie", + "pan_left", + "roll_right", + "zoom_in", + "over_the_shoulder", + "orbit_right", + "orbit_left", + "static", + "tiny_planet", + "high_angle", + "bolt_cam", + "dolly_zoom", + "overhead", + "zoom_out", + "handheld", + "roll_left", + "pov", + "aerial_drone", + "push_in", + "crane_down", + "truck_right", + "tilt_down", + "elevator_doors", + "tilt_up", + "ground_level", + "pull_out", + "aerial", + "crane_up", + "eye_level" + ] + + +class LumaImageModel(str, Enum): + photon_1 = "photon-1" + photon_flash_1 = "photon-flash-1" + + +class LumaVideoModel(str, Enum): + ray_2 = "ray-2" + ray_flash_2 = "ray-flash-2" + ray_1_6 = "ray-1-6" + + +class LumaAspectRatio(str, Enum): + ratio_1_1 = "1:1" + ratio_16_9 = "16:9" + ratio_9_16 = "9:16" + ratio_4_3 = "4:3" + ratio_3_4 = "3:4" + ratio_21_9 = "21:9" + ratio_9_21 = "9:21" + + +class LumaVideoOutputResolution(str, Enum): + res_540p = "540p" + res_720p = "720p" + res_1080p = "1080p" + res_4k = "4k" + + +class LumaVideoModelOutputDuration(str, Enum): + dur_5s = "5s" + dur_9s = "9s" + + +class LumaGenerationType(str, Enum): + video = 'video' + image = 'image' + + +class LumaState(str, Enum): + queued = "queued" + dreaming = "dreaming" + completed = "completed" + failed = "failed" + + +class LumaAssets(BaseModel): + video: Optional[str] = Field(None, description='The URL of the video') + image: Optional[str] = Field(None, description='The URL of the image') + progress_video: Optional[str] = Field(None, description='The URL of the progress video') + + +class LumaImageRef(BaseModel): + '''Used for image gen''' + url: str = Field(..., description='The URL of the image reference') + weight: confloat(ge=0.0, le=1.0) = Field(..., description='The weight of the image reference') + + +class LumaImageReference(BaseModel): + '''Used for video gen''' + type: Optional[str] = Field('image', description='Input type, defaults to image') + url: str = Field(..., description='The URL of the image') + + +class LumaModifyImageRef(BaseModel): + url: str = Field(..., description='The URL of the image reference') + weight: confloat(ge=0.0, le=1.0) = Field(..., description='The weight of the image reference') + + +class LumaCharacterRef(BaseModel): + identity0: LumaImageIdentity = Field(..., description='The image identity object') + + +class LumaImageIdentity(BaseModel): + images: list[str] = Field(..., description='The URLs of the image identity') + + +class LumaGenerationReference(BaseModel): + type: str = Field('generation', description='Input type, defaults to generation') + id: str = Field(..., description='The ID of the generation') + + +class LumaKeyframes(BaseModel): + frame0: Optional[Union[LumaImageReference, LumaGenerationReference]] = Field(None, description='') + frame1: Optional[Union[LumaImageReference, LumaGenerationReference]] = Field(None, description='') + + +class LumaConceptObject(BaseModel): + key: str = Field(..., description='Camera Concept name') + + +class LumaImageGenerationRequest(BaseModel): + prompt: str = Field(..., description='The prompt of the generation') + model: LumaImageModel = Field(LumaImageModel.photon_1, description='The image model used for the generation') + aspect_ratio: Optional[LumaAspectRatio] = Field(LumaAspectRatio.ratio_16_9, description='The aspect ratio of the generation') + image_ref: Optional[list[LumaImageRef]] = Field(None, description='List of image reference objects') + style_ref: Optional[list[LumaImageRef]] = Field(None, description='List of style reference objects') + character_ref: Optional[LumaCharacterRef] = Field(None, description='The image identity object') + modify_image_ref: Optional[LumaModifyImageRef] = Field(None, description='The modify image reference object') + + +class LumaGenerationRequest(BaseModel): + prompt: str = Field(..., description='The prompt of the generation') + model: LumaVideoModel = Field(LumaVideoModel.ray_2, description='The video model used for the generation') + duration: Optional[LumaVideoModelOutputDuration] = Field(None, description='The duration of the generation') + aspect_ratio: Optional[LumaAspectRatio] = Field(None, description='The aspect ratio of the generation') + resolution: Optional[LumaVideoOutputResolution] = Field(None, description='The resolution of the generation') + loop: Optional[bool] = Field(None, description='Whether to loop the video') + keyframes: Optional[LumaKeyframes] = Field(None, description='The keyframes of the generation') + concepts: Optional[list[LumaConceptObject]] = Field(None, description='Camera Concepts to apply to generation') + + +class LumaGeneration(BaseModel): + id: str = Field(..., description='The ID of the generation') + generation_type: LumaGenerationType = Field(..., description='Generation type, image or video') + state: LumaState = Field(..., description='The state of the generation') + failure_reason: Optional[str] = Field(None, description='The reason for the state of the generation') + created_at: str = Field(..., description='The date and time when the generation was created') + assets: Optional[LumaAssets] = Field(None, description='The assets of the generation') + model: str = Field(..., description='The model used for the generation') + request: Union[LumaGenerationRequest, LumaImageGenerationRequest] = Field(..., description="The request used for the generation") diff --git a/comfy_api_nodes/apis/pixverse_api.py b/comfy_api_nodes/apis/pixverse_api.py new file mode 100644 index 000000000..9bb29c383 --- /dev/null +++ b/comfy_api_nodes/apis/pixverse_api.py @@ -0,0 +1,146 @@ +from __future__ import annotations + +from enum import Enum +from typing import Optional + +from pydantic import BaseModel, Field + + +pixverse_templates = { + "Microwave": 324641385496960, + "Suit Swagger": 328545151283968, + "Anything, Robot": 313358700761536, + "Subject 3 Fever": 327828816843648, + "kiss kiss": 315446315336768, +} + + +class PixverseIO: + TEMPLATE = "PIXVERSE_TEMPLATE" + + +class PixverseStatus(int, Enum): + successful = 1 + generating = 5 + deleted = 6 + contents_moderation = 7 + failed = 8 + + +class PixverseAspectRatio(str, Enum): + ratio_16_9 = "16:9" + ratio_4_3 = "4:3" + ratio_1_1 = "1:1" + ratio_3_4 = "3:4" + ratio_9_16 = "9:16" + + +class PixverseQuality(str, Enum): + res_360p = "360p" + res_540p = "540p" + res_720p = "720p" + res_1080p = "1080p" + + +class PixverseDuration(int, Enum): + dur_5 = 5 + dur_8 = 8 + + +class PixverseMotionMode(str, Enum): + normal = "normal" + fast = "fast" + + +class PixverseStyle(str, Enum): + anime = "anime" + animation_3d = "3d_animation" + clay = "clay" + comic = "comic" + cyberpunk = "cyberpunk" + + +# NOTE: forgoing descriptions for now in return for dev speed +class PixverseTextVideoRequest(BaseModel): + aspect_ratio: PixverseAspectRatio = Field(...) + quality: PixverseQuality = Field(...) + duration: PixverseDuration = Field(...) + model: Optional[str] = Field("v3.5") + motion_mode: Optional[PixverseMotionMode] = Field(PixverseMotionMode.normal) + prompt: str = Field(...) + negative_prompt: Optional[str] = Field(None) + seed: Optional[int] = Field(None) + style: Optional[str] = Field(None) + template_id: Optional[int] = Field(None) + water_mark: Optional[bool] = Field(None) + + +class PixverseImageVideoRequest(BaseModel): + quality: PixverseQuality = Field(...) + duration: PixverseDuration = Field(...) + img_id: int = Field(...) + model: Optional[str] = Field("v3.5") + motion_mode: Optional[PixverseMotionMode] = Field(PixverseMotionMode.normal) + prompt: str = Field(...) + negative_prompt: Optional[str] = Field(None) + seed: Optional[int] = Field(None) + style: Optional[str] = Field(None) + template_id: Optional[int] = Field(None) + water_mark: Optional[bool] = Field(None) + + +class PixverseTransitionVideoRequest(BaseModel): + quality: PixverseQuality = Field(...) + duration: PixverseDuration = Field(...) + first_frame_img: int = Field(...) + last_frame_img: int = Field(...) + model: Optional[str] = Field("v3.5") + motion_mode: Optional[PixverseMotionMode] = Field(PixverseMotionMode.normal) + prompt: str = Field(...) + # negative_prompt: Optional[str] = Field(None) + seed: Optional[int] = Field(None) + # style: Optional[str] = Field(None) + # template_id: Optional[int] = Field(None) + # water_mark: Optional[bool] = Field(None) + + +class PixverseImageUploadResponse(BaseModel): + ErrCode: Optional[int] = None + ErrMsg: Optional[str] = None + Resp: Optional[PixverseImgIdResponseObject] = Field(None, alias='Resp') + + +class PixverseImgIdResponseObject(BaseModel): + img_id: Optional[int] = None + + +class PixverseVideoResponse(BaseModel): + ErrCode: Optional[int] = Field(None) + ErrMsg: Optional[str] = Field(None) + Resp: Optional[PixverseVideoIdResponseObject] = Field(None) + + +class PixverseVideoIdResponseObject(BaseModel): + video_id: int = Field(..., description='Video_id') + + +class PixverseGenerationStatusResponse(BaseModel): + ErrCode: Optional[int] = Field(None) + ErrMsg: Optional[str] = Field(None) + Resp: Optional[PixverseGenerationStatusResponseObject] = Field(None) + + +class PixverseGenerationStatusResponseObject(BaseModel): + create_time: Optional[str] = Field(None) + id: Optional[int] = Field(None) + modify_time: Optional[str] = Field(None) + negative_prompt: Optional[str] = Field(None) + outputHeight: Optional[int] = Field(None) + outputWidth: Optional[int] = Field(None) + prompt: Optional[str] = Field(None) + resolution_ratio: Optional[int] = Field(None) + seed: Optional[int] = Field(None) + size: Optional[int] = Field(None) + status: Optional[int] = Field(None) + style: Optional[str] = Field(None) + url: Optional[str] = Field(None) diff --git a/comfy_api_nodes/apis/recraft_api.py b/comfy_api_nodes/apis/recraft_api.py new file mode 100644 index 000000000..c0ec9d0c8 --- /dev/null +++ b/comfy_api_nodes/apis/recraft_api.py @@ -0,0 +1,263 @@ +from __future__ import annotations + + + +from enum import Enum +from typing import Optional + +from pydantic import BaseModel, Field, conint, confloat + + +class RecraftColor: + def __init__(self, r: int, g: int, b: int): + self.color = [r, g, b] + + def create_api_model(self): + return RecraftColorObject(rgb=self.color) + + +class RecraftColorChain: + def __init__(self): + self.colors: list[RecraftColor] = [] + + def get_first(self): + if len(self.colors) > 0: + return self.colors[0] + return None + + def add(self, color: RecraftColor): + self.colors.append(color) + + def create_api_model(self): + if not self.colors: + return None + colors_api = [x.create_api_model() for x in self.colors] + return colors_api + + def clone(self): + c = RecraftColorChain() + for color in self.colors: + c.add(color) + return c + + def clone_and_merge(self, other: RecraftColorChain): + c = self.clone() + for color in other.colors: + c.add(color) + return c + + +class RecraftControls: + def __init__(self, colors: RecraftColorChain=None, background_color: RecraftColorChain=None, + artistic_level: int=None, no_text: bool=None): + self.colors = colors + self.background_color = background_color + self.artistic_level = artistic_level + self.no_text = no_text + + def create_api_model(self): + if self.colors is None and self.background_color is None and self.artistic_level is None and self.no_text is None: + return None + colors_api = None + background_color_api = None + if self.colors: + colors_api = self.colors.create_api_model() + if self.background_color: + first_background = self.background_color.get_first() + background_color_api = first_background.create_api_model() if first_background else None + + return RecraftControlsObject(colors=colors_api, background_color=background_color_api, + artistic_level=self.artistic_level, no_text=self.no_text) + + +class RecraftStyle: + def __init__(self, style: str=None, substyle: str=None, style_id: str=None): + self.style = style + if substyle == "None": + substyle = None + self.substyle = substyle + self.style_id = style_id + + +class RecraftIO: + STYLEV3 = "RECRAFT_V3_STYLE" + SVG = "SVG" # TODO: if acceptable, move into ComfyUI's typing class + COLOR = "RECRAFT_COLOR" + CONTROLS = "RECRAFT_CONTROLS" + + +class RecraftStyleV3(str, Enum): + #any = 'any' NOTE: this does not work for some reason... why? + realistic_image = 'realistic_image' + digital_illustration = 'digital_illustration' + vector_illustration = 'vector_illustration' + logo_raster = 'logo_raster' + + +def get_v3_substyles(style_v3: str, include_none=True) -> list[str]: + substyles: list[str] = [] + if include_none: + substyles.append("None") + return substyles + dict_recraft_substyles_v3.get(style_v3, []) + + +dict_recraft_substyles_v3 = { + RecraftStyleV3.realistic_image: [ + "b_and_w", + "enterprise", + "evening_light", + "faded_nostalgia", + "forest_life", + "hard_flash", + "hdr", + "motion_blur", + "mystic_naturalism", + "natural_light", + "natural_tones", + "organic_calm", + "real_life_glow", + "retro_realism", + "retro_snapshot", + "studio_portrait", + "urban_drama", + "village_realism", + "warm_folk" + ], + RecraftStyleV3.digital_illustration: [ + "2d_art_poster", + "2d_art_poster_2", + "antiquarian", + "bold_fantasy", + "child_book", + "child_books", + "cover", + "crosshatch", + "digital_engraving", + "engraving_color", + "expressionism", + "freehand_details", + "grain", + "grain_20", + "graphic_intensity", + "hand_drawn", + "hand_drawn_outline", + "handmade_3d", + "hard_comics", + "infantile_sketch", + "long_shadow", + "modern_folk", + "multicolor", + "neon_calm", + "noir", + "nostalgic_pastel", + "outline_details", + "pastel_gradient", + "pastel_sketch", + "pixel_art", + "plastic", + "pop_art", + "pop_renaissance", + "seamless", + "street_art", + "tablet_sketch", + "urban_glow", + "urban_sketching", + "vanilla_dreams", + "young_adult_book", + "young_adult_book_2" + ], + RecraftStyleV3.vector_illustration: [ + "bold_stroke", + "chemistry", + "colored_stencil", + "contour_pop_art", + "cosmics", + "cutout", + "depressive", + "editorial", + "emotional_flat", + "engraving", + "infographical", + "line_art", + "line_circuit", + "linocut", + "marker_outline", + "mosaic", + "naivector", + "roundish_flat", + "seamless", + "segmented_colors", + "sharp_contrast", + "thin", + "vector_photo", + "vivid_shapes" + ], + RecraftStyleV3.logo_raster: [ + "emblem_graffiti", + "emblem_pop_art", + "emblem_punk", + "emblem_stamp", + "emblem_vintage" + ], +} + + +class RecraftModel(str, Enum): + recraftv3 = 'recraftv3' + recraftv2 = 'recraftv2' + + +class RecraftImageSize(str, Enum): + res_1024x1024 = '1024x1024' + res_1365x1024 = '1365x1024' + res_1024x1365 = '1024x1365' + res_1536x1024 = '1536x1024' + res_1024x1536 = '1024x1536' + res_1820x1024 = '1820x1024' + res_1024x1820 = '1024x1820' + res_1024x2048 = '1024x2048' + res_2048x1024 = '2048x1024' + res_1434x1024 = '1434x1024' + res_1024x1434 = '1024x1434' + res_1024x1280 = '1024x1280' + res_1280x1024 = '1280x1024' + res_1024x1707 = '1024x1707' + res_1707x1024 = '1707x1024' + + +class RecraftColorObject(BaseModel): + rgb: list[int] = Field(..., description='An array of 3 integer values in range of 0...255 defining RGB Color Model') + + +class RecraftControlsObject(BaseModel): + colors: Optional[list[RecraftColorObject]] = Field(None, description='An array of preferable colors') + background_color: Optional[RecraftColorObject] = Field(None, description='Use given color as a desired background color') + no_text: Optional[bool] = Field(None, description='Do not embed text layouts') + artistic_level: Optional[conint(ge=0, le=5)] = Field(None, description='Defines artistic tone of your image. At a simple level, the person looks straight at the camera in a static and clean style. Dynamic and eccentric levels introduce movement and creativity. The value should be in range [0..5].') + + +class RecraftImageGenerationRequest(BaseModel): + prompt: str = Field(..., description='The text prompt describing the image to generate') + size: Optional[RecraftImageSize] = Field(None, description='The size of the generated image (e.g., "1024x1024")') + n: conint(ge=1, le=6) = Field(..., description='The number of images to generate') + negative_prompt: Optional[str] = Field(None, description='A text description of undesired elements on an image') + model: Optional[RecraftModel] = Field(RecraftModel.recraftv3, description='The model to use for generation (e.g., "recraftv3")') + style: Optional[str] = Field(None, description='The style to apply to the generated image (e.g., "digital_illustration")') + substyle: Optional[str] = Field(None, description='The substyle to apply to the generated image, depending on the style input') + controls: Optional[RecraftControlsObject] = Field(None, description='A set of custom parameters to tweak generation process') + style_id: Optional[str] = Field(None, description='Use a previously uploaded style as a reference; UUID') + strength: Optional[confloat(ge=0.0, le=1.0)] = Field(None, description='Defines the difference with the original image, should lie in [0, 1], where 0 means almost identical, and 1 means miserable similarity') + random_seed: Optional[int] = Field(None, description="Seed for video generation") + # text_layout + + +class RecraftReturnedObject(BaseModel): + image_id: str = Field(..., description='Unique identifier for the generated image') + url: str = Field(..., description='URL to access the generated image') + + +class RecraftImageGenerationResponse(BaseModel): + created: int = Field(..., description='Unix timestamp when the generation was created') + credits: int = Field(..., description='Number of credits used for the generation') + data: Optional[list[RecraftReturnedObject]] = Field(None, description='Array of generated image information') + image: Optional[RecraftReturnedObject] = Field(None, description='Single generated image') diff --git a/comfy_api_nodes/apis/stability_api.py b/comfy_api_nodes/apis/stability_api.py new file mode 100644 index 000000000..47c87daec --- /dev/null +++ b/comfy_api_nodes/apis/stability_api.py @@ -0,0 +1,127 @@ +from __future__ import annotations + +from enum import Enum +from typing import Optional + +from pydantic import BaseModel, Field, confloat + + +class StabilityFormat(str, Enum): + png = 'png' + jpeg = 'jpeg' + webp = 'webp' + + +class StabilityAspectRatio(str, Enum): + ratio_1_1 = "1:1" + ratio_16_9 = "16:9" + ratio_9_16 = "9:16" + ratio_3_2 = "3:2" + ratio_2_3 = "2:3" + ratio_5_4 = "5:4" + ratio_4_5 = "4:5" + ratio_21_9 = "21:9" + ratio_9_21 = "9:21" + + +def get_stability_style_presets(include_none=True): + presets = [] + if include_none: + presets.append("None") + return presets + [x.value for x in StabilityStylePreset] + + +class StabilityStylePreset(str, Enum): + _3d_model = "3d-model" + analog_film = "analog-film" + anime = "anime" + cinematic = "cinematic" + comic_book = "comic-book" + digital_art = "digital-art" + enhance = "enhance" + fantasy_art = "fantasy-art" + isometric = "isometric" + line_art = "line-art" + low_poly = "low-poly" + modeling_compound = "modeling-compound" + neon_punk = "neon-punk" + origami = "origami" + photographic = "photographic" + pixel_art = "pixel-art" + tile_texture = "tile-texture" + + +class Stability_SD3_5_Model(str, Enum): + sd3_5_large = "sd3.5-large" + # sd3_5_large_turbo = "sd3.5-large-turbo" + sd3_5_medium = "sd3.5-medium" + + +class Stability_SD3_5_GenerationMode(str, Enum): + text_to_image = "text-to-image" + image_to_image = "image-to-image" + + +class StabilityStable3_5Request(BaseModel): + model: str = Field(...) + mode: str = Field(...) + prompt: str = Field(...) + negative_prompt: Optional[str] = Field(None) + aspect_ratio: Optional[str] = Field(None) + seed: Optional[int] = Field(None) + output_format: Optional[str] = Field(StabilityFormat.png.value) + image: Optional[str] = Field(None) + style_preset: Optional[str] = Field(None) + cfg_scale: float = Field(...) + strength: Optional[confloat(ge=0.0, le=1.0)] = Field(None) + + +class StabilityUpscaleConservativeRequest(BaseModel): + prompt: str = Field(...) + negative_prompt: Optional[str] = Field(None) + seed: Optional[int] = Field(None) + output_format: Optional[str] = Field(StabilityFormat.png.value) + image: Optional[str] = Field(None) + creativity: Optional[confloat(ge=0.2, le=0.5)] = Field(None) + + +class StabilityUpscaleCreativeRequest(BaseModel): + prompt: str = Field(...) + negative_prompt: Optional[str] = Field(None) + seed: Optional[int] = Field(None) + output_format: Optional[str] = Field(StabilityFormat.png.value) + image: Optional[str] = Field(None) + creativity: Optional[confloat(ge=0.1, le=0.5)] = Field(None) + style_preset: Optional[str] = Field(None) + + +class StabilityStableUltraRequest(BaseModel): + prompt: str = Field(...) + negative_prompt: Optional[str] = Field(None) + aspect_ratio: Optional[str] = Field(None) + seed: Optional[int] = Field(None) + output_format: Optional[str] = Field(StabilityFormat.png.value) + image: Optional[str] = Field(None) + style_preset: Optional[str] = Field(None) + strength: Optional[confloat(ge=0.0, le=1.0)] = Field(None) + + +class StabilityStableUltraResponse(BaseModel): + image: Optional[str] = Field(None) + finish_reason: Optional[str] = Field(None) + seed: Optional[int] = Field(None) + + +class StabilityResultsGetResponse(BaseModel): + image: Optional[str] = Field(None) + finish_reason: Optional[str] = Field(None) + seed: Optional[int] = Field(None) + id: Optional[str] = Field(None) + name: Optional[str] = Field(None) + errors: Optional[list[str]] = Field(None) + status: Optional[str] = Field(None) + result: Optional[str] = Field(None) + + +class StabilityAsyncResponse(BaseModel): + id: Optional[str] = Field(None) diff --git a/comfy_api_nodes/mapper_utils.py b/comfy_api_nodes/mapper_utils.py new file mode 100644 index 000000000..6fab8f4bb --- /dev/null +++ b/comfy_api_nodes/mapper_utils.py @@ -0,0 +1,116 @@ +from enum import Enum + +from pydantic.fields import FieldInfo +from pydantic import BaseModel +from pydantic_core import PydanticUndefined + +from comfy.comfy_types.node_typing import IO, InputTypeOptions + +NodeInput = tuple[IO, InputTypeOptions] + + +def _create_base_config(field_info: FieldInfo) -> InputTypeOptions: + config = {} + if hasattr(field_info, "default") and field_info.default is not PydanticUndefined: + config["default"] = field_info.default + if hasattr(field_info, "description") and field_info.description is not None: + config["tooltip"] = field_info.description + return config + + +def _get_number_constraints_config(field_info: FieldInfo) -> dict: + config = {} + if hasattr(field_info, "metadata"): + metadata = field_info.metadata + for constraint in metadata: + if hasattr(constraint, "ge"): + config["min"] = constraint.ge + if hasattr(constraint, "le"): + config["max"] = constraint.le + if hasattr(constraint, "multiple_of"): + config["step"] = constraint.multiple_of + return config + + +def _model_field_to_image_input(field_info: FieldInfo, **kwargs) -> NodeInput: + return IO.IMAGE, { + **_create_base_config(field_info), + **kwargs, + } + + +def _model_field_to_string_input(field_info: FieldInfo, **kwargs) -> NodeInput: + return IO.STRING, { + **_create_base_config(field_info), + **kwargs, + } + + +def _model_field_to_float_input(field_info: FieldInfo, **kwargs) -> NodeInput: + return IO.FLOAT, { + **_create_base_config(field_info), + **_get_number_constraints_config(field_info), + **kwargs, + } + + +def _model_field_to_int_input(field_info: FieldInfo, **kwargs) -> NodeInput: + return IO.INT, { + **_create_base_config(field_info), + **_get_number_constraints_config(field_info), + **kwargs, + } + + +def _model_field_to_combo_input( + field_info: FieldInfo, enum_type: type[Enum] = None, **kwargs +) -> NodeInput: + combo_config = {} + if enum_type is not None: + combo_config["options"] = [option.value for option in enum_type] + combo_config = { + **combo_config, + **_create_base_config(field_info), + **kwargs, + } + return IO.COMBO, combo_config + + +def model_field_to_node_input( + input_type: IO, base_model: type[BaseModel], field_name: str, **kwargs +) -> NodeInput: + """ + Maps a field from a Pydantic model to a Comfy node input. + + Args: + input_type: The type of the input. + base_model: The Pydantic model to map the field from. + field_name: The name of the field to map. + **kwargs: Additional key/values to include in the input options. + + Note: + For combo inputs, pass an `Enum` to the `enum_type` keyword argument to populate the options automatically. + + Example: + >>> model_field_to_node_input(IO.STRING, MyModel, "my_field", multiline=True) + >>> model_field_to_node_input(IO.COMBO, MyModel, "my_field", enum_type=MyEnum) + >>> model_field_to_node_input(IO.FLOAT, MyModel, "my_field", slider=True) + """ + field_info: FieldInfo = base_model.model_fields[field_name] + result: NodeInput + + if input_type == IO.IMAGE: + result = _model_field_to_image_input(field_info, **kwargs) + elif input_type == IO.STRING: + result = _model_field_to_string_input(field_info, **kwargs) + elif input_type == IO.FLOAT: + result = _model_field_to_float_input(field_info, **kwargs) + elif input_type == IO.INT: + result = _model_field_to_int_input(field_info, **kwargs) + elif input_type == IO.COMBO: + result = _model_field_to_combo_input(field_info, **kwargs) + else: + message = f"Invalid input type: {input_type}" + raise ValueError(message) + + return result diff --git a/comfy_api_nodes/nodes_api.py b/comfy_api_nodes/nodes_api.py deleted file mode 100644 index a977bb9b7..000000000 --- a/comfy_api_nodes/nodes_api.py +++ /dev/null @@ -1,449 +0,0 @@ -import base64 -import io -import math -from inspect import cleandoc - -import numpy as np -import requests -import torch -from PIL import Image - -from comfy.comfy_types.node_typing import IO, ComfyNodeABC, InputTypeDict -from comfy.utils import common_upscale -from comfy_api_nodes.apis import ( - OpenAIImageEditRequest, - OpenAIImageGenerationRequest, - OpenAIImageGenerationResponse, -) -from comfy_api_nodes.apis.client import ApiEndpoint, HttpMethod, SynchronousOperation - - -def downscale_input(image): - samples = image.movedim(-1,1) - #downscaling input images to roughly the same size as the outputs - total = int(1536 * 1024) - scale_by = math.sqrt(total / (samples.shape[3] * samples.shape[2])) - if scale_by >= 1: - return image - width = round(samples.shape[3] * scale_by) - height = round(samples.shape[2] * scale_by) - - s = common_upscale(samples, width, height, "lanczos", "disabled") - s = s.movedim(1,-1) - return s - -def validate_and_cast_response(response): - # validate raw JSON response - data = response.data - if not data or len(data) == 0: - raise Exception("No images returned from API endpoint") - - # Initialize list to store image tensors - image_tensors = [] - - # Process each image in the data array - for image_data in data: - image_url = image_data.url - b64_data = image_data.b64_json - - if not image_url and not b64_data: - raise Exception("No image was generated in the response") - - if b64_data: - img_data = base64.b64decode(b64_data) - img = Image.open(io.BytesIO(img_data)) - - elif image_url: - img_response = requests.get(image_url) - if img_response.status_code != 200: - raise Exception("Failed to download the image") - img = Image.open(io.BytesIO(img_response.content)) - - img = img.convert("RGBA") - - # Convert to numpy array, normalize to float32 between 0 and 1 - img_array = np.array(img).astype(np.float32) / 255.0 - img_tensor = torch.from_numpy(img_array) - - # Add to list of tensors - image_tensors.append(img_tensor) - - return torch.stack(image_tensors, dim=0) - -class OpenAIDalle2(ComfyNodeABC): - """ - Generates images synchronously via OpenAI's DALL·E 2 endpoint. - - Uses the proxy at /proxy/openai/images/generations. Returned URLs are short‑lived, - so download or cache results if you need to keep them. - """ - def __init__(self): - pass - - @classmethod - def INPUT_TYPES(cls) -> InputTypeDict: - return { - "required": { - "prompt": (IO.STRING, { - "multiline": True, - "default": "", - "tooltip": "Text prompt for DALL·E", - }), - }, - "optional": { - "seed": (IO.INT, { - "default": 0, - "min": 0, - "max": 2**31-1, - "step": 1, - "display": "number", - "tooltip": "not implemented yet in backend", - }), - "size": (IO.COMBO, { - "options": ["256x256", "512x512", "1024x1024"], - "default": "1024x1024", - "tooltip": "Image size", - }), - "n": (IO.INT, { - "default": 1, - "min": 1, - "max": 8, - "step": 1, - "display": "number", - "tooltip": "How many images to generate", - }), - "image": (IO.IMAGE, { - "default": None, - "tooltip": "Optional reference image for image editing.", - }), - "mask": (IO.MASK, { - "default": None, - "tooltip": "Optional mask for inpainting (white areas will be replaced)", - }), - }, - "hidden": { - "auth_token": "AUTH_TOKEN_COMFY_ORG" - } - } - - RETURN_TYPES = (IO.IMAGE,) - FUNCTION = "api_call" - CATEGORY = "api node" - DESCRIPTION = cleandoc(__doc__ or "") - API_NODE = True - - def api_call(self, prompt, seed=0, image=None, mask=None, n=1, size="1024x1024", auth_token=None): - model = "dall-e-2" - path = "/proxy/openai/images/generations" - request_class = OpenAIImageGenerationRequest - img_binary = None - - if image is not None and mask is not None: - path = "/proxy/openai/images/edits" - request_class = OpenAIImageEditRequest - - input_tensor = image.squeeze().cpu() - height, width, channels = input_tensor.shape - rgba_tensor = torch.ones(height, width, 4, device="cpu") - rgba_tensor[:, :, :channels] = input_tensor - - if mask.shape[1:] != image.shape[1:-1]: - raise Exception("Mask and Image must be the same size") - rgba_tensor[:,:,3] = (1-mask.squeeze().cpu()) - - rgba_tensor = downscale_input(rgba_tensor.unsqueeze(0)).squeeze() - - image_np = (rgba_tensor.numpy() * 255).astype(np.uint8) - img = Image.fromarray(image_np) - img_byte_arr = io.BytesIO() - img.save(img_byte_arr, format='PNG') - img_byte_arr.seek(0) - img_binary = img_byte_arr#.getvalue() - img_binary.name = "image.png" - elif image is not None or mask is not None: - raise Exception("Dall-E 2 image editing requires an image AND a mask") - - # Build the operation - operation = SynchronousOperation( - endpoint=ApiEndpoint( - path=path, - method=HttpMethod.POST, - request_model=request_class, - response_model=OpenAIImageGenerationResponse - ), - request=request_class( - model=model, - prompt=prompt, - n=n, - size=size, - seed=seed, - ), - files={ - "image": img_binary, - } if img_binary else None, - auth_token=auth_token - ) - - response = operation.execute() - - img_tensor = validate_and_cast_response(response) - return (img_tensor,) - -class OpenAIDalle3(ComfyNodeABC): - """ - Generates images synchronously via OpenAI's DALL·E 3 endpoint. - - Uses the proxy at /proxy/openai/images/generations. Returned URLs are short‑lived, - so download or cache results if you need to keep them. - """ - def __init__(self): - pass - - @classmethod - def INPUT_TYPES(cls) -> InputTypeDict: - return { - "required": { - "prompt": (IO.STRING, { - "multiline": True, - "default": "", - "tooltip": "Text prompt for DALL·E", - }), - }, - "optional": { - "seed": (IO.INT, { - "default": 0, - "min": 0, - "max": 2**31-1, - "step": 1, - "display": "number", - "tooltip": "not implemented yet in backend", - }), - "quality" : (IO.COMBO, { - "options": ["standard","hd"], - "default": "standard", - "tooltip": "Image quality", - }), - "style": (IO.COMBO, { - "options": ["natural","vivid"], - "default": "natural", - "tooltip": "Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images.", - }), - "size": (IO.COMBO, { - "options": ["1024x1024", "1024x1792", "1792x1024"], - "default": "1024x1024", - "tooltip": "Image size", - }), - }, - "hidden": { - "auth_token": "AUTH_TOKEN_COMFY_ORG" - } - } - - RETURN_TYPES = (IO.IMAGE,) - FUNCTION = "api_call" - CATEGORY = "api node" - DESCRIPTION = cleandoc(__doc__ or "") - API_NODE = True - - def api_call(self, prompt, seed=0, style="natural", quality="standard", size="1024x1024", auth_token=None): - model = "dall-e-3" - - # build the operation - operation = SynchronousOperation( - endpoint=ApiEndpoint( - path="/proxy/openai/images/generations", - method=HttpMethod.POST, - request_model=OpenAIImageGenerationRequest, - response_model=OpenAIImageGenerationResponse - ), - request=OpenAIImageGenerationRequest( - model=model, - prompt=prompt, - quality=quality, - size=size, - style=style, - seed=seed, - ), - auth_token=auth_token - ) - - response = operation.execute() - - img_tensor = validate_and_cast_response(response) - return (img_tensor,) - -class OpenAIGPTImage1(ComfyNodeABC): - """ - Generates images synchronously via OpenAI's GPT Image 1 endpoint. - - Uses the proxy at /proxy/openai/images/generations. Returned URLs are short‑lived, - so download or cache results if you need to keep them. - """ - def __init__(self): - pass - - @classmethod - def INPUT_TYPES(cls) -> InputTypeDict: - return { - "required": { - "prompt": (IO.STRING, { - "multiline": True, - "default": "", - "tooltip": "Text prompt for GPT Image 1", - }), - }, - "optional": { - "seed": (IO.INT, { - "default": 0, - "min": 0, - "max": 2**31-1, - "step": 1, - "display": "number", - "tooltip": "not implemented yet in backend", - }), - "quality": (IO.COMBO, { - "options": ["low","medium","high"], - "default": "low", - "tooltip": "Image quality, affects cost and generation time.", - }), - "background": (IO.COMBO, { - "options": ["opaque","transparent"], - "default": "opaque", - "tooltip": "Return image with or without background", - }), - "size": (IO.COMBO, { - "options": ["auto", "1024x1024", "1024x1536", "1536x1024"], - "default": "auto", - "tooltip": "Image size", - }), - "n": (IO.INT, { - "default": 1, - "min": 1, - "max": 8, - "step": 1, - "display": "number", - "tooltip": "How many images to generate", - }), - "image": (IO.IMAGE, { - "default": None, - "tooltip": "Optional reference image for image editing.", - }), - "mask": (IO.MASK, { - "default": None, - "tooltip": "Optional mask for inpainting (white areas will be replaced)", - }), - "moderation": (IO.COMBO, { - "options": ["low","auto"], - "default": "low", - "tooltip": "Moderation level", - }), - }, - "hidden": { - "auth_token": "AUTH_TOKEN_COMFY_ORG" - } - } - - RETURN_TYPES = (IO.IMAGE,) - FUNCTION = "api_call" - CATEGORY = "api node" - DESCRIPTION = cleandoc(__doc__ or "") - API_NODE = True - - def api_call(self, prompt, seed=0, quality="low", background="opaque", image=None, mask=None, n=1, size="1024x1024", auth_token=None, moderation="low"): - model = "gpt-image-1" - path = "/proxy/openai/images/generations" - request_class = OpenAIImageGenerationRequest - img_binaries = [] - mask_binary = None - files = [] - - if image is not None: - path = "/proxy/openai/images/edits" - request_class = OpenAIImageEditRequest - - batch_size = image.shape[0] - - - for i in range(batch_size): - single_image = image[i:i+1] - scaled_image = downscale_input(single_image).squeeze() - - image_np = (scaled_image.numpy() * 255).astype(np.uint8) - img = Image.fromarray(image_np) - img_byte_arr = io.BytesIO() - img.save(img_byte_arr, format='PNG') - img_byte_arr.seek(0) - img_binary = img_byte_arr - img_binary.name = f"image_{i}.png" - - img_binaries.append(img_binary) - if batch_size == 1: - files.append(("image", img_binary)) - else: - files.append(("image[]", img_binary)) - - if mask is not None: - if image.shape[0] != 1: - raise Exception("Cannot use a mask with multiple image") - if image is None: - raise Exception("Cannot use a mask without an input image") - if mask.shape[1:] != image.shape[1:-1]: - raise Exception("Mask and Image must be the same size") - batch, height, width = mask.shape - rgba_mask = torch.zeros(height, width, 4, device="cpu") - rgba_mask[:,:,3] = (1-mask.squeeze().cpu()) - - scaled_mask = downscale_input(rgba_mask.unsqueeze(0)).squeeze() - - mask_np = (scaled_mask.numpy() * 255).astype(np.uint8) - mask_img = Image.fromarray(mask_np) - mask_img_byte_arr = io.BytesIO() - mask_img.save(mask_img_byte_arr, format='PNG') - mask_img_byte_arr.seek(0) - mask_binary = mask_img_byte_arr - mask_binary.name = "mask.png" - files.append(("mask", mask_binary)) - - - # Build the operation - operation = SynchronousOperation( - endpoint=ApiEndpoint( - path=path, - method=HttpMethod.POST, - request_model=request_class, - response_model=OpenAIImageGenerationResponse - ), - request=request_class( - model=model, - prompt=prompt, - quality=quality, - background=background, - n=n, - seed=seed, - size=size, - moderation=moderation, - ), - files=files if files else None, - auth_token=auth_token - ) - - response = operation.execute() - - img_tensor = validate_and_cast_response(response) - return (img_tensor,) - - -# A dictionary that contains all nodes you want to export with their names -# NOTE: names should be globally unique -NODE_CLASS_MAPPINGS = { - "OpenAIDalle2": OpenAIDalle2, - "OpenAIDalle3": OpenAIDalle3, - "OpenAIGPTImage1": OpenAIGPTImage1, -} - -# A dictionary that contains the friendly/humanly readable titles for the nodes -NODE_DISPLAY_NAME_MAPPINGS = { - "OpenAIDalle2": "OpenAI DALL·E 2", - "OpenAIDalle3": "OpenAI DALL·E 3", - "OpenAIGPTImage1": "OpenAI GPT Image 1", -} diff --git a/comfy_api_nodes/nodes_bfl.py b/comfy_api_nodes/nodes_bfl.py new file mode 100644 index 000000000..122a6ddf8 --- /dev/null +++ b/comfy_api_nodes/nodes_bfl.py @@ -0,0 +1,906 @@ +import io +from inspect import cleandoc +from comfy.comfy_types.node_typing import IO, ComfyNodeABC +from comfy_api_nodes.apis.bfl_api import ( + BFLStatus, + BFLFluxExpandImageRequest, + BFLFluxFillImageRequest, + BFLFluxCannyImageRequest, + BFLFluxDepthImageRequest, + BFLFluxProGenerateRequest, + BFLFluxProUltraGenerateRequest, + BFLFluxProGenerateResponse, +) +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, +) +from comfy_api_nodes.apinode_utils import ( + downscale_image_tensor, + validate_aspect_ratio, + process_image_response, + resize_mask_to_image, + validate_string, +) + +import numpy as np +from PIL import Image +import requests +import torch +import base64 +import time + + +def convert_mask_to_image(mask: torch.Tensor): + """ + Make mask have the expected amount of dims (4) and channels (3) to be recognized as an image. + """ + mask = mask.unsqueeze(-1) + mask = torch.cat([mask]*3, dim=-1) + return mask + + +def handle_bfl_synchronous_operation( + operation: SynchronousOperation, timeout_bfl_calls=360 +): + response_api: BFLFluxProGenerateResponse = operation.execute() + return _poll_until_generated( + response_api.polling_url, timeout=timeout_bfl_calls + ) + +def _poll_until_generated(polling_url: str, timeout=360): + # used bfl-comfy-nodes to verify code implementation: + # https://github.com/black-forest-labs/bfl-comfy-nodes/tree/main + start_time = time.time() + retries_404 = 0 + max_retries_404 = 5 + retry_404_seconds = 2 + retry_202_seconds = 2 + retry_pending_seconds = 1 + request = requests.Request(method=HttpMethod.GET, url=polling_url) + # NOTE: should True loop be replaced with checking if workflow has been interrupted? + while True: + response = requests.Session().send(request.prepare()) + if response.status_code == 200: + result = response.json() + if result["status"] == BFLStatus.ready: + img_url = result["result"]["sample"] + img_response = requests.get(img_url) + return process_image_response(img_response) + elif result["status"] in [ + BFLStatus.request_moderated, + BFLStatus.content_moderated, + ]: + status = result["status"] + raise Exception( + f"BFL API did not return an image due to: {status}." + ) + elif result["status"] == BFLStatus.error: + raise Exception(f"BFL API encountered an error: {result}.") + elif result["status"] == BFLStatus.pending: + time.sleep(retry_pending_seconds) + continue + elif response.status_code == 404: + if retries_404 < max_retries_404: + retries_404 += 1 + time.sleep(retry_404_seconds) + continue + raise Exception( + f"BFL API could not find task after {max_retries_404} tries." + ) + elif response.status_code == 202: + time.sleep(retry_202_seconds) + elif time.time() - start_time > timeout: + raise Exception( + f"BFL API experienced a timeout; could not return request under {timeout} seconds." + ) + else: + raise Exception(f"BFL API encountered an error: {response.json()}") + +def convert_image_to_base64(image: torch.Tensor): + scaled_image = downscale_image_tensor(image, total_pixels=2048 * 2048) + # remove batch dimension if present + if len(scaled_image.shape) > 3: + scaled_image = scaled_image[0] + image_np = (scaled_image.numpy() * 255).astype(np.uint8) + img = Image.fromarray(image_np) + img_byte_arr = io.BytesIO() + img.save(img_byte_arr, format="PNG") + return base64.b64encode(img_byte_arr.getvalue()).decode() + + +class FluxProUltraImageNode(ComfyNodeABC): + """ + Generates images using Flux Pro 1.1 Ultra via api based on prompt and resolution. + """ + + MINIMUM_RATIO = 1 / 4 + MAXIMUM_RATIO = 4 / 1 + MINIMUM_RATIO_STR = "1:4" + MAXIMUM_RATIO_STR = "4:1" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation", + }, + ), + "prompt_upsampling": ( + IO.BOOLEAN, + { + "default": False, + "tooltip": "Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation, but results are nondeterministic (same seed will not produce exactly the same result).", + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "The random seed used for creating the noise.", + }, + ), + "aspect_ratio": ( + IO.STRING, + { + "default": "16:9", + "tooltip": "Aspect ratio of image; must be between 1:4 and 4:1.", + }, + ), + "raw": ( + IO.BOOLEAN, + { + "default": False, + "tooltip": "When True, generate less processed, more natural-looking images.", + }, + ), + }, + "optional": { + "image_prompt": (IO.IMAGE,), + "image_prompt_strength": ( + IO.FLOAT, + { + "default": 0.1, + "min": 0.0, + "max": 1.0, + "step": 0.01, + "tooltip": "Blend between the prompt and the image prompt.", + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + @classmethod + def VALIDATE_INPUTS(cls, aspect_ratio: str): + try: + validate_aspect_ratio( + aspect_ratio, + minimum_ratio=cls.MINIMUM_RATIO, + maximum_ratio=cls.MAXIMUM_RATIO, + minimum_ratio_str=cls.MINIMUM_RATIO_STR, + maximum_ratio_str=cls.MAXIMUM_RATIO_STR, + ) + except Exception as e: + return str(e) + return True + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/BFL" + + def api_call( + self, + prompt: str, + aspect_ratio: str, + prompt_upsampling=False, + raw=False, + seed=0, + image_prompt=None, + image_prompt_strength=0.1, + auth_token=None, + **kwargs, + ): + if image_prompt is None: + validate_string(prompt, strip_whitespace=False) + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/bfl/flux-pro-1.1-ultra/generate", + method=HttpMethod.POST, + request_model=BFLFluxProUltraGenerateRequest, + response_model=BFLFluxProGenerateResponse, + ), + request=BFLFluxProUltraGenerateRequest( + prompt=prompt, + prompt_upsampling=prompt_upsampling, + seed=seed, + aspect_ratio=validate_aspect_ratio( + aspect_ratio, + minimum_ratio=self.MINIMUM_RATIO, + maximum_ratio=self.MAXIMUM_RATIO, + minimum_ratio_str=self.MINIMUM_RATIO_STR, + maximum_ratio_str=self.MAXIMUM_RATIO_STR, + ), + raw=raw, + image_prompt=( + image_prompt + if image_prompt is None + else convert_image_to_base64(image_prompt) + ), + image_prompt_strength=( + None if image_prompt is None else round(image_prompt_strength, 2) + ), + ), + auth_token=auth_token, + ) + output_image = handle_bfl_synchronous_operation(operation) + return (output_image,) + + + +class FluxProImageNode(ComfyNodeABC): + """ + Generates images synchronously based on prompt and resolution. + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation", + }, + ), + "prompt_upsampling": ( + IO.BOOLEAN, + { + "default": False, + "tooltip": "Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation, but results are nondeterministic (same seed will not produce exactly the same result).", + }, + ), + "width": ( + IO.INT, + { + "default": 1024, + "min": 256, + "max": 1440, + "step": 32, + }, + ), + "height": ( + IO.INT, + { + "default": 768, + "min": 256, + "max": 1440, + "step": 32, + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "The random seed used for creating the noise.", + }, + ), + }, + "optional": { + "image_prompt": (IO.IMAGE,), + # "image_prompt_strength": ( + # IO.FLOAT, + # { + # "default": 0.1, + # "min": 0.0, + # "max": 1.0, + # "step": 0.01, + # "tooltip": "Blend between the prompt and the image prompt.", + # }, + # ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/BFL" + + def api_call( + self, + prompt: str, + prompt_upsampling, + width: int, + height: int, + seed=0, + image_prompt=None, + # image_prompt_strength=0.1, + auth_token=None, + **kwargs, + ): + image_prompt = ( + image_prompt + if image_prompt is None + else convert_image_to_base64(image_prompt) + ) + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/bfl/flux-pro-1.1/generate", + method=HttpMethod.POST, + request_model=BFLFluxProGenerateRequest, + response_model=BFLFluxProGenerateResponse, + ), + request=BFLFluxProGenerateRequest( + prompt=prompt, + prompt_upsampling=prompt_upsampling, + width=width, + height=height, + seed=seed, + image_prompt=image_prompt, + ), + auth_token=auth_token, + ) + output_image = handle_bfl_synchronous_operation(operation) + return (output_image,) + + +class FluxProExpandNode(ComfyNodeABC): + """ + Outpaints image based on prompt. + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": (IO.IMAGE,), + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation", + }, + ), + "prompt_upsampling": ( + IO.BOOLEAN, + { + "default": False, + "tooltip": "Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation, but results are nondeterministic (same seed will not produce exactly the same result).", + }, + ), + "top": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 2048, + "tooltip": "Number of pixels to expand at the top of the image" + }, + ), + "bottom": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 2048, + "tooltip": "Number of pixels to expand at the bottom of the image" + }, + ), + "left": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 2048, + "tooltip": "Number of pixels to expand at the left side of the image" + }, + ), + "right": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 2048, + "tooltip": "Number of pixels to expand at the right side of the image" + }, + ), + "guidance": ( + IO.FLOAT, + { + "default": 60, + "min": 1.5, + "max": 100, + "tooltip": "Guidance strength for the image generation process" + }, + ), + "steps": ( + IO.INT, + { + "default": 50, + "min": 15, + "max": 50, + "tooltip": "Number of steps for the image generation process" + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "The random seed used for creating the noise.", + }, + ), + }, + "optional": { + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/BFL" + + def api_call( + self, + image: torch.Tensor, + prompt: str, + prompt_upsampling: bool, + top: int, + bottom: int, + left: int, + right: int, + steps: int, + guidance: float, + seed=0, + auth_token=None, + **kwargs, + ): + image = convert_image_to_base64(image) + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/bfl/flux-pro-1.0-expand/generate", + method=HttpMethod.POST, + request_model=BFLFluxExpandImageRequest, + response_model=BFLFluxProGenerateResponse, + ), + request=BFLFluxExpandImageRequest( + prompt=prompt, + prompt_upsampling=prompt_upsampling, + top=top, + bottom=bottom, + left=left, + right=right, + steps=steps, + guidance=guidance, + seed=seed, + image=image, + ), + auth_token=auth_token, + ) + output_image = handle_bfl_synchronous_operation(operation) + return (output_image,) + + + +class FluxProFillNode(ComfyNodeABC): + """ + Inpaints image based on mask and prompt. + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": (IO.IMAGE,), + "mask": (IO.MASK,), + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation", + }, + ), + "prompt_upsampling": ( + IO.BOOLEAN, + { + "default": False, + "tooltip": "Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation, but results are nondeterministic (same seed will not produce exactly the same result).", + }, + ), + "guidance": ( + IO.FLOAT, + { + "default": 60, + "min": 1.5, + "max": 100, + "tooltip": "Guidance strength for the image generation process" + }, + ), + "steps": ( + IO.INT, + { + "default": 50, + "min": 15, + "max": 50, + "tooltip": "Number of steps for the image generation process" + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "The random seed used for creating the noise.", + }, + ), + }, + "optional": { + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/BFL" + + def api_call( + self, + image: torch.Tensor, + mask: torch.Tensor, + prompt: str, + prompt_upsampling: bool, + steps: int, + guidance: float, + seed=0, + auth_token=None, + **kwargs, + ): + # prepare mask + mask = resize_mask_to_image(mask, image) + mask = convert_image_to_base64(convert_mask_to_image(mask)) + # make sure image will have alpha channel removed + image = convert_image_to_base64(image[:,:,:,:3]) + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/bfl/flux-pro-1.0-fill/generate", + method=HttpMethod.POST, + request_model=BFLFluxFillImageRequest, + response_model=BFLFluxProGenerateResponse, + ), + request=BFLFluxFillImageRequest( + prompt=prompt, + prompt_upsampling=prompt_upsampling, + steps=steps, + guidance=guidance, + seed=seed, + image=image, + mask=mask, + ), + auth_token=auth_token, + ) + output_image = handle_bfl_synchronous_operation(operation) + return (output_image,) + + +class FluxProCannyNode(ComfyNodeABC): + """ + Generate image using a control image (canny). + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "control_image": (IO.IMAGE,), + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation", + }, + ), + "prompt_upsampling": ( + IO.BOOLEAN, + { + "default": False, + "tooltip": "Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation, but results are nondeterministic (same seed will not produce exactly the same result).", + }, + ), + "canny_low_threshold": ( + IO.FLOAT, + { + "default": 0.1, + "min": 0.01, + "max": 0.99, + "step": 0.01, + "tooltip": "Low threshold for Canny edge detection; ignored if skip_processing is True" + }, + ), + "canny_high_threshold": ( + IO.FLOAT, + { + "default": 0.4, + "min": 0.01, + "max": 0.99, + "step": 0.01, + "tooltip": "High threshold for Canny edge detection; ignored if skip_processing is True" + }, + ), + "skip_preprocessing": ( + IO.BOOLEAN, + { + "default": False, + "tooltip": "Whether to skip preprocessing; set to True if control_image already is canny-fied, False if it is a raw image.", + }, + ), + "guidance": ( + IO.FLOAT, + { + "default": 30, + "min": 1, + "max": 100, + "tooltip": "Guidance strength for the image generation process" + }, + ), + "steps": ( + IO.INT, + { + "default": 50, + "min": 15, + "max": 50, + "tooltip": "Number of steps for the image generation process" + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "The random seed used for creating the noise.", + }, + ), + }, + "optional": { + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/BFL" + + def api_call( + self, + control_image: torch.Tensor, + prompt: str, + prompt_upsampling: bool, + canny_low_threshold: float, + canny_high_threshold: float, + skip_preprocessing: bool, + steps: int, + guidance: float, + seed=0, + auth_token=None, + **kwargs, + ): + control_image = convert_image_to_base64(control_image[:,:,:,:3]) + preprocessed_image = None + + # scale canny threshold between 0-500, to match BFL's API + def scale_value(value: float, min_val=0, max_val=500): + return min_val + value * (max_val - min_val) + canny_low_threshold = int(round(scale_value(canny_low_threshold))) + canny_high_threshold = int(round(scale_value(canny_high_threshold))) + + + if skip_preprocessing: + preprocessed_image = control_image + control_image = None + canny_low_threshold = None + canny_high_threshold = None + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/bfl/flux-pro-1.0-canny/generate", + method=HttpMethod.POST, + request_model=BFLFluxCannyImageRequest, + response_model=BFLFluxProGenerateResponse, + ), + request=BFLFluxCannyImageRequest( + prompt=prompt, + prompt_upsampling=prompt_upsampling, + steps=steps, + guidance=guidance, + seed=seed, + control_image=control_image, + canny_low_threshold=canny_low_threshold, + canny_high_threshold=canny_high_threshold, + preprocessed_image=preprocessed_image, + ), + auth_token=auth_token, + ) + output_image = handle_bfl_synchronous_operation(operation) + return (output_image,) + + +class FluxProDepthNode(ComfyNodeABC): + """ + Generate image using a control image (depth). + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "control_image": (IO.IMAGE,), + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation", + }, + ), + "prompt_upsampling": ( + IO.BOOLEAN, + { + "default": False, + "tooltip": "Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation, but results are nondeterministic (same seed will not produce exactly the same result).", + }, + ), + "skip_preprocessing": ( + IO.BOOLEAN, + { + "default": False, + "tooltip": "Whether to skip preprocessing; set to True if control_image already is depth-ified, False if it is a raw image.", + }, + ), + "guidance": ( + IO.FLOAT, + { + "default": 15, + "min": 1, + "max": 100, + "tooltip": "Guidance strength for the image generation process" + }, + ), + "steps": ( + IO.INT, + { + "default": 50, + "min": 15, + "max": 50, + "tooltip": "Number of steps for the image generation process" + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "The random seed used for creating the noise.", + }, + ), + }, + "optional": { + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/BFL" + + def api_call( + self, + control_image: torch.Tensor, + prompt: str, + prompt_upsampling: bool, + skip_preprocessing: bool, + steps: int, + guidance: float, + seed=0, + auth_token=None, + **kwargs, + ): + control_image = convert_image_to_base64(control_image[:,:,:,:3]) + preprocessed_image = None + + if skip_preprocessing: + preprocessed_image = control_image + control_image = None + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/bfl/flux-pro-1.0-depth/generate", + method=HttpMethod.POST, + request_model=BFLFluxDepthImageRequest, + response_model=BFLFluxProGenerateResponse, + ), + request=BFLFluxDepthImageRequest( + prompt=prompt, + prompt_upsampling=prompt_upsampling, + steps=steps, + guidance=guidance, + seed=seed, + control_image=control_image, + preprocessed_image=preprocessed_image, + ), + auth_token=auth_token, + ) + output_image = handle_bfl_synchronous_operation(operation) + return (output_image,) + + +# A dictionary that contains all nodes you want to export with their names +# NOTE: names should be globally unique +NODE_CLASS_MAPPINGS = { + "FluxProUltraImageNode": FluxProUltraImageNode, + # "FluxProImageNode": FluxProImageNode, + "FluxProExpandNode": FluxProExpandNode, + "FluxProFillNode": FluxProFillNode, + "FluxProCannyNode": FluxProCannyNode, + "FluxProDepthNode": FluxProDepthNode, +} + +# A dictionary that contains the friendly/humanly readable titles for the nodes +NODE_DISPLAY_NAME_MAPPINGS = { + "FluxProUltraImageNode": "Flux 1.1 [pro] Ultra Image", + # "FluxProImageNode": "Flux 1.1 [pro] Image", + "FluxProExpandNode": "Flux.1 Expand Image", + "FluxProFillNode": "Flux.1 Fill Image", + "FluxProCannyNode": "Flux.1 Canny Control Image", + "FluxProDepthNode": "Flux.1 Depth Control Image", +} diff --git a/comfy_api_nodes/nodes_ideogram.py b/comfy_api_nodes/nodes_ideogram.py new file mode 100644 index 000000000..45c021f4a --- /dev/null +++ b/comfy_api_nodes/nodes_ideogram.py @@ -0,0 +1,777 @@ +from comfy.comfy_types.node_typing import IO, ComfyNodeABC, InputTypeDict +from inspect import cleandoc +from PIL import Image +import numpy as np +import io +import torch +from comfy_api_nodes.apis import ( + IdeogramGenerateRequest, + IdeogramGenerateResponse, + ImageRequest, + IdeogramV3Request, + IdeogramV3EditRequest, +) + +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, +) + +from comfy_api_nodes.apinode_utils import ( + download_url_to_bytesio, + bytesio_to_image_tensor, + resize_mask_to_image, +) + +V1_V1_RES_MAP = { + "Auto":"AUTO", + "512 x 1536":"RESOLUTION_512_1536", + "576 x 1408":"RESOLUTION_576_1408", + "576 x 1472":"RESOLUTION_576_1472", + "576 x 1536":"RESOLUTION_576_1536", + "640 x 1024":"RESOLUTION_640_1024", + "640 x 1344":"RESOLUTION_640_1344", + "640 x 1408":"RESOLUTION_640_1408", + "640 x 1472":"RESOLUTION_640_1472", + "640 x 1536":"RESOLUTION_640_1536", + "704 x 1152":"RESOLUTION_704_1152", + "704 x 1216":"RESOLUTION_704_1216", + "704 x 1280":"RESOLUTION_704_1280", + "704 x 1344":"RESOLUTION_704_1344", + "704 x 1408":"RESOLUTION_704_1408", + "704 x 1472":"RESOLUTION_704_1472", + "720 x 1280":"RESOLUTION_720_1280", + "736 x 1312":"RESOLUTION_736_1312", + "768 x 1024":"RESOLUTION_768_1024", + "768 x 1088":"RESOLUTION_768_1088", + "768 x 1152":"RESOLUTION_768_1152", + "768 x 1216":"RESOLUTION_768_1216", + "768 x 1232":"RESOLUTION_768_1232", + "768 x 1280":"RESOLUTION_768_1280", + "768 x 1344":"RESOLUTION_768_1344", + "832 x 960":"RESOLUTION_832_960", + "832 x 1024":"RESOLUTION_832_1024", + "832 x 1088":"RESOLUTION_832_1088", + "832 x 1152":"RESOLUTION_832_1152", + "832 x 1216":"RESOLUTION_832_1216", + "832 x 1248":"RESOLUTION_832_1248", + "864 x 1152":"RESOLUTION_864_1152", + "896 x 960":"RESOLUTION_896_960", + "896 x 1024":"RESOLUTION_896_1024", + "896 x 1088":"RESOLUTION_896_1088", + "896 x 1120":"RESOLUTION_896_1120", + "896 x 1152":"RESOLUTION_896_1152", + "960 x 832":"RESOLUTION_960_832", + "960 x 896":"RESOLUTION_960_896", + "960 x 1024":"RESOLUTION_960_1024", + "960 x 1088":"RESOLUTION_960_1088", + "1024 x 640":"RESOLUTION_1024_640", + "1024 x 768":"RESOLUTION_1024_768", + "1024 x 832":"RESOLUTION_1024_832", + "1024 x 896":"RESOLUTION_1024_896", + "1024 x 960":"RESOLUTION_1024_960", + "1024 x 1024":"RESOLUTION_1024_1024", + "1088 x 768":"RESOLUTION_1088_768", + "1088 x 832":"RESOLUTION_1088_832", + "1088 x 896":"RESOLUTION_1088_896", + "1088 x 960":"RESOLUTION_1088_960", + "1120 x 896":"RESOLUTION_1120_896", + "1152 x 704":"RESOLUTION_1152_704", + "1152 x 768":"RESOLUTION_1152_768", + "1152 x 832":"RESOLUTION_1152_832", + "1152 x 864":"RESOLUTION_1152_864", + "1152 x 896":"RESOLUTION_1152_896", + "1216 x 704":"RESOLUTION_1216_704", + "1216 x 768":"RESOLUTION_1216_768", + "1216 x 832":"RESOLUTION_1216_832", + "1232 x 768":"RESOLUTION_1232_768", + "1248 x 832":"RESOLUTION_1248_832", + "1280 x 704":"RESOLUTION_1280_704", + "1280 x 720":"RESOLUTION_1280_720", + "1280 x 768":"RESOLUTION_1280_768", + "1280 x 800":"RESOLUTION_1280_800", + "1312 x 736":"RESOLUTION_1312_736", + "1344 x 640":"RESOLUTION_1344_640", + "1344 x 704":"RESOLUTION_1344_704", + "1344 x 768":"RESOLUTION_1344_768", + "1408 x 576":"RESOLUTION_1408_576", + "1408 x 640":"RESOLUTION_1408_640", + "1408 x 704":"RESOLUTION_1408_704", + "1472 x 576":"RESOLUTION_1472_576", + "1472 x 640":"RESOLUTION_1472_640", + "1472 x 704":"RESOLUTION_1472_704", + "1536 x 512":"RESOLUTION_1536_512", + "1536 x 576":"RESOLUTION_1536_576", + "1536 x 640":"RESOLUTION_1536_640", +} + +V1_V2_RATIO_MAP = { + "1:1":"ASPECT_1_1", + "4:3":"ASPECT_4_3", + "3:4":"ASPECT_3_4", + "16:9":"ASPECT_16_9", + "9:16":"ASPECT_9_16", + "2:1":"ASPECT_2_1", + "1:2":"ASPECT_1_2", + "3:2":"ASPECT_3_2", + "2:3":"ASPECT_2_3", + "4:5":"ASPECT_4_5", + "5:4":"ASPECT_5_4", +} + +V3_RATIO_MAP = { + "1:3":"1x3", + "3:1":"3x1", + "1:2":"1x2", + "2:1":"2x1", + "9:16":"9x16", + "16:9":"16x9", + "10:16":"10x16", + "16:10":"16x10", + "2:3":"2x3", + "3:2":"3x2", + "3:4":"3x4", + "4:3":"4x3", + "4:5":"4x5", + "5:4":"5x4", + "1:1":"1x1", +} + +V3_RESOLUTIONS= [ + "Auto", + "512x1536", + "576x1408", + "576x1472", + "576x1536", + "640x1344", + "640x1408", + "640x1472", + "640x1536", + "704x1152", + "704x1216", + "704x1280", + "704x1344", + "704x1408", + "704x1472", + "736x1312", + "768x1088", + "768x1216", + "768x1280", + "768x1344", + "800x1280", + "832x960", + "832x1024", + "832x1088", + "832x1152", + "832x1216", + "832x1248", + "864x1152", + "896x960", + "896x1024", + "896x1088", + "896x1120", + "896x1152", + "960x832", + "960x896", + "960x1024", + "960x1088", + "1024x832", + "1024x896", + "1024x960", + "1024x1024", + "1088x768", + "1088x832", + "1088x896", + "1088x960", + "1120x896", + "1152x704", + "1152x832", + "1152x864", + "1152x896", + "1216x704", + "1216x768", + "1216x832", + "1248x832", + "1280x704", + "1280x768", + "1280x800", + "1312x736", + "1344x640", + "1344x704", + "1344x768", + "1408x576", + "1408x640", + "1408x704", + "1472x576", + "1472x640", + "1472x704", + "1536x512", + "1536x576", + "1536x640" +] + +def download_and_process_images(image_urls): + """Helper function to download and process multiple images from URLs""" + + # Initialize list to store image tensors + image_tensors = [] + + for image_url in image_urls: + # Using functions from apinode_utils.py to handle downloading and processing + image_bytesio = download_url_to_bytesio(image_url) # Download image content to BytesIO + img_tensor = bytesio_to_image_tensor(image_bytesio, mode="RGB") # Convert to torch.Tensor with RGB mode + image_tensors.append(img_tensor) + + # Stack tensors to match (N, width, height, channels) + if image_tensors: + stacked_tensors = torch.cat(image_tensors, dim=0) + else: + raise Exception("No valid images were processed") + + return stacked_tensors + + +class IdeogramV1(ComfyNodeABC): + """ + Generates images synchronously using the Ideogram V1 model. + + Images links are available for a limited period of time; if you would like to keep the image, you must download it. + """ + + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation", + }, + ), + "turbo": ( + IO.BOOLEAN, + { + "default": False, + "tooltip": "Whether to use turbo mode (faster generation, potentially lower quality)", + } + ), + }, + "optional": { + "aspect_ratio": ( + IO.COMBO, + { + "options": list(V1_V2_RATIO_MAP.keys()), + "default": "1:1", + "tooltip": "The aspect ratio for image generation.", + }, + ), + "magic_prompt_option": ( + IO.COMBO, + { + "options": ["AUTO", "ON", "OFF"], + "default": "AUTO", + "tooltip": "Determine if MagicPrompt should be used in generation", + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 2147483647, + "step": 1, + "control_after_generate": True, + "display": "number", + }, + ), + "negative_prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Description of what to exclude from the image", + }, + ), + "num_images": ( + IO.INT, + {"default": 1, "min": 1, "max": 8, "step": 1, "display": "number"}, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + RETURN_TYPES = (IO.IMAGE,) + FUNCTION = "api_call" + CATEGORY = "api node/image/Ideogram/v1" + DESCRIPTION = cleandoc(__doc__ or "") + API_NODE = True + + def api_call( + self, + prompt, + turbo=False, + aspect_ratio="1:1", + magic_prompt_option="AUTO", + seed=0, + negative_prompt="", + num_images=1, + auth_token=None, + ): + # Determine the model based on turbo setting + aspect_ratio = V1_V2_RATIO_MAP.get(aspect_ratio, None) + model = "V_1_TURBO" if turbo else "V_1" + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/ideogram/generate", + method=HttpMethod.POST, + request_model=IdeogramGenerateRequest, + response_model=IdeogramGenerateResponse, + ), + request=IdeogramGenerateRequest( + image_request=ImageRequest( + prompt=prompt, + model=model, + num_images=num_images, + seed=seed, + aspect_ratio=aspect_ratio if aspect_ratio != "ASPECT_1_1" else None, + magic_prompt_option=( + magic_prompt_option if magic_prompt_option != "AUTO" else None + ), + negative_prompt=negative_prompt if negative_prompt else None, + ) + ), + auth_token=auth_token, + ) + + response = operation.execute() + + if not response.data or len(response.data) == 0: + raise Exception("No images were generated in the response") + + image_urls = [image_data.url for image_data in response.data if image_data.url] + + if not image_urls: + raise Exception("No image URLs were generated in the response") + + return (download_and_process_images(image_urls),) + + +class IdeogramV2(ComfyNodeABC): + """ + Generates images synchronously using the Ideogram V2 model. + + Images links are available for a limited period of time; if you would like to keep the image, you must download it. + """ + + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation", + }, + ), + "turbo": ( + IO.BOOLEAN, + { + "default": False, + "tooltip": "Whether to use turbo mode (faster generation, potentially lower quality)", + } + ), + }, + "optional": { + "aspect_ratio": ( + IO.COMBO, + { + "options": list(V1_V2_RATIO_MAP.keys()), + "default": "1:1", + "tooltip": "The aspect ratio for image generation. Ignored if resolution is not set to AUTO.", + }, + ), + "resolution": ( + IO.COMBO, + { + "options": list(V1_V1_RES_MAP.keys()), + "default": "Auto", + "tooltip": "The resolution for image generation. If not set to AUTO, this overrides the aspect_ratio setting.", + }, + ), + "magic_prompt_option": ( + IO.COMBO, + { + "options": ["AUTO", "ON", "OFF"], + "default": "AUTO", + "tooltip": "Determine if MagicPrompt should be used in generation", + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 2147483647, + "step": 1, + "control_after_generate": True, + "display": "number", + }, + ), + "style_type": ( + IO.COMBO, + { + "options": ["AUTO", "GENERAL", "REALISTIC", "DESIGN", "RENDER_3D", "ANIME"], + "default": "NONE", + "tooltip": "Style type for generation (V2 only)", + }, + ), + "negative_prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Description of what to exclude from the image", + }, + ), + "num_images": ( + IO.INT, + {"default": 1, "min": 1, "max": 8, "step": 1, "display": "number"}, + ), + #"color_palette": ( + # IO.STRING, + # { + # "multiline": False, + # "default": "", + # "tooltip": "Color palette preset name or hex colors with weights", + # }, + #), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + RETURN_TYPES = (IO.IMAGE,) + FUNCTION = "api_call" + CATEGORY = "api node/image/Ideogram/v2" + DESCRIPTION = cleandoc(__doc__ or "") + API_NODE = True + + def api_call( + self, + prompt, + turbo=False, + aspect_ratio="1:1", + resolution="Auto", + magic_prompt_option="AUTO", + seed=0, + style_type="NONE", + negative_prompt="", + num_images=1, + color_palette="", + auth_token=None, + ): + aspect_ratio = V1_V2_RATIO_MAP.get(aspect_ratio, None) + resolution = V1_V1_RES_MAP.get(resolution, None) + # Determine the model based on turbo setting + model = "V_2_TURBO" if turbo else "V_2" + + # Handle resolution vs aspect_ratio logic + # If resolution is not AUTO, it overrides aspect_ratio + final_resolution = None + final_aspect_ratio = None + + if resolution != "AUTO": + final_resolution = resolution + else: + final_aspect_ratio = aspect_ratio if aspect_ratio != "ASPECT_1_1" else None + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/ideogram/generate", + method=HttpMethod.POST, + request_model=IdeogramGenerateRequest, + response_model=IdeogramGenerateResponse, + ), + request=IdeogramGenerateRequest( + image_request=ImageRequest( + prompt=prompt, + model=model, + num_images=num_images, + seed=seed, + aspect_ratio=final_aspect_ratio, + resolution=final_resolution, + magic_prompt_option=( + magic_prompt_option if magic_prompt_option != "AUTO" else None + ), + style_type=style_type if style_type != "NONE" else None, + negative_prompt=negative_prompt if negative_prompt else None, + color_palette=color_palette if color_palette else None, + ) + ), + auth_token=auth_token, + ) + + response = operation.execute() + + if not response.data or len(response.data) == 0: + raise Exception("No images were generated in the response") + + image_urls = [image_data.url for image_data in response.data if image_data.url] + + if not image_urls: + raise Exception("No image URLs were generated in the response") + + return (download_and_process_images(image_urls),) + +class IdeogramV3(ComfyNodeABC): + """ + Generates images synchronously using the Ideogram V3 model. + + Supports both regular image generation from text prompts and image editing with mask. + Images links are available for a limited period of time; if you would like to keep the image, you must download it. + """ + + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation or editing", + }, + ), + }, + "optional": { + "image": ( + IO.IMAGE, + { + "default": None, + "tooltip": "Optional reference image for image editing.", + }, + ), + "mask": ( + IO.MASK, + { + "default": None, + "tooltip": "Optional mask for inpainting (white areas will be replaced)", + }, + ), + "aspect_ratio": ( + IO.COMBO, + { + "options": list(V3_RATIO_MAP.keys()), + "default": "1:1", + "tooltip": "The aspect ratio for image generation. Ignored if resolution is not set to Auto.", + }, + ), + "resolution": ( + IO.COMBO, + { + "options": V3_RESOLUTIONS, + "default": "Auto", + "tooltip": "The resolution for image generation. If not set to Auto, this overrides the aspect_ratio setting.", + }, + ), + "magic_prompt_option": ( + IO.COMBO, + { + "options": ["AUTO", "ON", "OFF"], + "default": "AUTO", + "tooltip": "Determine if MagicPrompt should be used in generation", + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 2147483647, + "step": 1, + "control_after_generate": True, + "display": "number", + }, + ), + "num_images": ( + IO.INT, + {"default": 1, "min": 1, "max": 8, "step": 1, "display": "number"}, + ), + "rendering_speed": ( + IO.COMBO, + { + "options": ["BALANCED", "TURBO", "QUALITY"], + "default": "BALANCED", + "tooltip": "Controls the trade-off between generation speed and quality", + }, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + RETURN_TYPES = (IO.IMAGE,) + FUNCTION = "api_call" + CATEGORY = "api node/image/Ideogram/v3" + DESCRIPTION = cleandoc(__doc__ or "") + API_NODE = True + + def api_call( + self, + prompt, + image=None, + mask=None, + resolution="Auto", + aspect_ratio="1:1", + magic_prompt_option="AUTO", + seed=0, + num_images=1, + rendering_speed="BALANCED", + auth_token=None, + ): + # Check if both image and mask are provided for editing mode + if image is not None and mask is not None: + # Edit mode + path = "/proxy/ideogram/ideogram-v3/edit" + + # Process image and mask + input_tensor = image.squeeze().cpu() + # Resize mask to match image dimension + mask = resize_mask_to_image(mask, image, allow_gradient=False) + # Invert mask, as Ideogram API will edit black areas instead of white areas (opposite of convention). + mask = 1.0 - mask + + # Validate mask dimensions match image + if mask.shape[1:] != image.shape[1:-1]: + raise Exception("Mask and Image must be the same size") + + # Process image + img_np = (input_tensor.numpy() * 255).astype(np.uint8) + img = Image.fromarray(img_np) + img_byte_arr = io.BytesIO() + img.save(img_byte_arr, format="PNG") + img_byte_arr.seek(0) + img_binary = img_byte_arr + img_binary.name = "image.png" + + # Process mask - white areas will be replaced + mask_np = (mask.squeeze().cpu().numpy() * 255).astype(np.uint8) + mask_img = Image.fromarray(mask_np) + mask_byte_arr = io.BytesIO() + mask_img.save(mask_byte_arr, format="PNG") + mask_byte_arr.seek(0) + mask_binary = mask_byte_arr + mask_binary.name = "mask.png" + + # Create edit request + edit_request = IdeogramV3EditRequest( + prompt=prompt, + rendering_speed=rendering_speed, + ) + + # Add optional parameters + if magic_prompt_option != "AUTO": + edit_request.magic_prompt = magic_prompt_option + if seed != 0: + edit_request.seed = seed + if num_images > 1: + edit_request.num_images = num_images + + # Execute the operation for edit mode + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=path, + method=HttpMethod.POST, + request_model=IdeogramV3EditRequest, + response_model=IdeogramGenerateResponse, + ), + request=edit_request, + files={ + "image": img_binary, + "mask": mask_binary, + }, + content_type="multipart/form-data", + auth_token=auth_token, + ) + + elif image is not None or mask is not None: + # If only one of image or mask is provided, raise an error + raise Exception("Ideogram V3 image editing requires both an image AND a mask") + else: + # Generation mode + path = "/proxy/ideogram/ideogram-v3/generate" + + # Create generation request + gen_request = IdeogramV3Request( + prompt=prompt, + rendering_speed=rendering_speed, + ) + + # Handle resolution vs aspect ratio + if resolution != "Auto": + gen_request.resolution = resolution + elif aspect_ratio != "1:1": + v3_aspect = V3_RATIO_MAP.get(aspect_ratio) + if v3_aspect: + gen_request.aspect_ratio = v3_aspect + + # Add optional parameters + if magic_prompt_option != "AUTO": + gen_request.magic_prompt = magic_prompt_option + if seed != 0: + gen_request.seed = seed + if num_images > 1: + gen_request.num_images = num_images + + # Execute the operation for generation mode + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=path, + method=HttpMethod.POST, + request_model=IdeogramV3Request, + response_model=IdeogramGenerateResponse, + ), + request=gen_request, + auth_token=auth_token, + ) + + # Execute the operation and process response + response = operation.execute() + + if not response.data or len(response.data) == 0: + raise Exception("No images were generated in the response") + + image_urls = [image_data.url for image_data in response.data if image_data.url] + + if not image_urls: + raise Exception("No image URLs were generated in the response") + + return (download_and_process_images(image_urls),) + + +NODE_CLASS_MAPPINGS = { + "IdeogramV1": IdeogramV1, + "IdeogramV2": IdeogramV2, + "IdeogramV3": IdeogramV3, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "IdeogramV1": "Ideogram V1", + "IdeogramV2": "Ideogram V2", + "IdeogramV3": "Ideogram V3", +} + diff --git a/comfy_api_nodes/nodes_kling.py b/comfy_api_nodes/nodes_kling.py new file mode 100644 index 000000000..9aa8df58b --- /dev/null +++ b/comfy_api_nodes/nodes_kling.py @@ -0,0 +1,1563 @@ +"""Kling API Nodes + +For source of truth on the allowed permutations of request fields, please reference: +- [Compatibility Table](https://app.klingai.com/global/dev/document-api/apiReference/model/skillsMap) +""" + +from __future__ import annotations +from typing import Optional, TypeVar, Any +import math +import logging + +import torch + +from comfy_api_nodes.apis import ( + KlingTaskStatus, + KlingCameraControl, + KlingCameraConfig, + KlingCameraControlType, + KlingVideoGenDuration, + KlingVideoGenMode, + KlingVideoGenAspectRatio, + KlingVideoGenModelName, + KlingText2VideoRequest, + KlingText2VideoResponse, + KlingImage2VideoRequest, + KlingImage2VideoResponse, + KlingVideoExtendRequest, + KlingVideoExtendResponse, + KlingLipSyncVoiceLanguage, + KlingLipSyncInputObject, + KlingLipSyncRequest, + KlingLipSyncResponse, + KlingVirtualTryOnModelName, + KlingVirtualTryOnRequest, + KlingVirtualTryOnResponse, + KlingVideoResult, + KlingImageResult, + KlingImageGenerationsRequest, + KlingImageGenerationsResponse, + KlingImageGenImageReferenceType, + KlingImageGenModelName, + KlingImageGenAspectRatio, + KlingVideoEffectsRequest, + KlingVideoEffectsResponse, + KlingDualCharacterEffectsScene, + KlingSingleImageEffectsScene, + KlingDualCharacterEffectInput, + KlingSingleImageEffectInput, + KlingCharacterEffectModelName, + KlingSingleImageEffectModelName, +) +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, + PollingOperation, + EmptyRequest, +) +from comfy_api_nodes.apinode_utils import ( + tensor_to_base64_string, + download_url_to_video_output, + upload_video_to_comfyapi, + upload_audio_to_comfyapi, + download_url_to_image_tensor, +) +from comfy_api_nodes.mapper_utils import model_field_to_node_input +from comfy_api.input.basic_types import AudioInput +from comfy_api.input.video_types import VideoInput +from comfy_api.input_impl import VideoFromFile +from comfy.comfy_types.node_typing import IO, InputTypeOptions, ComfyNodeABC + +KLING_API_VERSION = "v1" +PATH_TEXT_TO_VIDEO = f"/proxy/kling/{KLING_API_VERSION}/videos/text2video" +PATH_IMAGE_TO_VIDEO = f"/proxy/kling/{KLING_API_VERSION}/videos/image2video" +PATH_VIDEO_EXTEND = f"/proxy/kling/{KLING_API_VERSION}/videos/video-extend" +PATH_LIP_SYNC = f"/proxy/kling/{KLING_API_VERSION}/videos/lip-sync" +PATH_VIDEO_EFFECTS = f"/proxy/kling/{KLING_API_VERSION}/videos/effects" +PATH_CHARACTER_IMAGE = f"/proxy/kling/{KLING_API_VERSION}/images/generations" +PATH_VIRTUAL_TRY_ON = f"/proxy/kling/{KLING_API_VERSION}/images/kolors-virtual-try-on" +PATH_IMAGE_GENERATIONS = f"/proxy/kling/{KLING_API_VERSION}/images/generations" + + +MAX_PROMPT_LENGTH_T2V = 2500 +MAX_PROMPT_LENGTH_I2V = 500 +MAX_PROMPT_LENGTH_IMAGE_GEN = 500 +MAX_NEGATIVE_PROMPT_LENGTH_IMAGE_GEN = 200 +MAX_PROMPT_LENGTH_LIP_SYNC = 120 + +R = TypeVar("R") + + +class KlingApiError(Exception): + """Base exception for Kling API errors.""" + + pass + + +def poll_until_finished(auth_token: str, api_endpoint: ApiEndpoint[Any, R]) -> R: + """Polls the Kling API endpoint until the task reaches a terminal state, then returns the response.""" + return PollingOperation( + poll_endpoint=api_endpoint, + completed_statuses=[ + KlingTaskStatus.succeed.value, + ], + failed_statuses=[KlingTaskStatus.failed.value], + status_extractor=lambda response: ( + response.data.task_status.value + if response.data and response.data.task_status + else None + ), + auth_token=auth_token, + ).execute() + + +def is_valid_camera_control_configs(configs: list[float]) -> bool: + """Verifies that at least one camera control configuration is non-zero.""" + return any(not math.isclose(value, 0.0) for value in configs) + + +def is_valid_prompt(prompt: str) -> bool: + """Verifies that the prompt is not empty.""" + return bool(prompt) + + +def is_valid_task_creation_response(response: KlingText2VideoResponse) -> bool: + """Verifies that the initial response contains a task ID.""" + return bool(response.data.task_id) + + +def is_valid_video_response(response: KlingText2VideoResponse) -> bool: + """Verifies that the response contains a task result with at least one video.""" + return ( + response.data is not None + and response.data.task_result is not None + and response.data.task_result.videos is not None + and len(response.data.task_result.videos) > 0 + ) + + +def is_valid_image_response(response: KlingVirtualTryOnResponse) -> bool: + """Verifies that the response contains a task result with at least one image.""" + return ( + response.data is not None + and response.data.task_result is not None + and response.data.task_result.images is not None + and len(response.data.task_result.images) > 0 + ) + + +def validate_prompts(prompt: str, negative_prompt: str, max_length: int) -> bool: + """Verifies that the positive prompt is not empty and that neither promt is too long.""" + if not prompt: + raise ValueError("Positive prompt is empty") + if len(prompt) > max_length: + raise ValueError(f"Positive prompt is too long: {len(prompt)} characters") + if negative_prompt and len(negative_prompt) > max_length: + raise ValueError( + f"Negative prompt is too long: {len(negative_prompt)} characters" + ) + return True + + +def validate_task_creation_response(response) -> None: + """Validates that the Kling task creation request was successful.""" + if not is_valid_task_creation_response(response): + error_msg = f"Kling initial request failed. Code: {response.code}, Message: {response.message}, Data: {response.data}" + logging.error(error_msg) + raise KlingApiError(error_msg) + + +def validate_video_result_response(response) -> None: + """Validates that the Kling task result contains a video.""" + if not is_valid_video_response(response): + error_msg = f"Kling task {response.data.task_id} succeeded but no video data found in response." + logging.error(f"Error: {error_msg}.\nResponse: {response}") + raise KlingApiError(error_msg) + + +def validate_image_result_response(response) -> None: + """Validates that the Kling task result contains an image.""" + if not is_valid_image_response(response): + error_msg = f"Kling task {response.data.task_id} succeeded but no image data found in response." + logging.error(f"Error: {error_msg}.\nResponse: {response}") + raise KlingApiError(error_msg) + + +def get_camera_control_input_config( + tooltip: str, default: float = 0.0 +) -> tuple[IO, InputTypeOptions]: + """Returns common InputTypeOptions for Kling camera control configurations.""" + input_config = { + "default": default, + "min": -10.0, + "max": 10.0, + "step": 0.25, + "display": "slider", + "tooltip": tooltip, + } + return IO.FLOAT, input_config + + +def get_video_from_response(response) -> KlingVideoResult: + """Returns the first video object from the Kling video generation task result.""" + video = response.data.task_result.videos[0] + logging.info( + "Kling task %s succeeded. Video URL: %s", response.data.task_id, video.url + ) + return video + + +def get_images_from_response(response) -> list[KlingImageResult]: + images = response.data.task_result.images + logging.info("Kling task %s succeeded. Images: %s", response.data.task_id, images) + return images + + +def video_result_to_node_output( + video: KlingVideoResult, +) -> tuple[VideoFromFile, str, str]: + """Converts a KlingVideoResult to a tuple of (VideoFromFile, str, str) to be used as a ComfyUI node output.""" + return ( + download_url_to_video_output(video.url), + str(video.id), + str(video.duration), + ) + + +def image_result_to_node_output( + images: list[KlingImageResult], +) -> torch.Tensor: + """ + Converts a KlingImageResult to a tuple containing a [B, H, W, C] tensor. + If multiple images are returned, they will be stacked along the batch dimension. + """ + if len(images) == 1: + return download_url_to_image_tensor(images[0].url) + else: + return torch.cat([download_url_to_image_tensor(image.url) for image in images]) + + +class KlingNodeBase(ComfyNodeABC): + """Base class for Kling nodes.""" + + FUNCTION = "api_call" + CATEGORY = "api node/video/Kling" + API_NODE = True + + +class KlingCameraControls(KlingNodeBase): + """Kling Camera Controls Node""" + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "camera_control_type": model_field_to_node_input( + IO.COMBO, + KlingCameraControl, + "type", + enum_type=KlingCameraControlType, + ), + "horizontal_movement": get_camera_control_input_config( + "Controls camera's movement along horizontal axis (x-axis). Negative indicates left, positive indicates right" + ), + "vertical_movement": get_camera_control_input_config( + "Controls camera's movement along vertical axis (y-axis). Negative indicates downward, positive indicates upward." + ), + "pan": get_camera_control_input_config( + "Controls camera's rotation in vertical plane (x-axis). Negative indicates downward rotation, positive indicates upward rotation.", + default=0.5, + ), + "tilt": get_camera_control_input_config( + "Controls camera's rotation in horizontal plane (y-axis). Negative indicates left rotation, positive indicates right rotation.", + ), + "roll": get_camera_control_input_config( + "Controls camera's rolling amount (z-axis). Negative indicates counterclockwise, positive indicates clockwise.", + ), + "zoom": get_camera_control_input_config( + "Controls change in camera's focal length. Negative indicates narrower field of view, positive indicates wider field of view.", + ), + } + } + + DESCRIPTION = "Allows specifying configuration options for Kling Camera Controls and motion control effects." + RETURN_TYPES = ("CAMERA_CONTROL",) + RETURN_NAMES = ("camera_control",) + FUNCTION = "main" + + @classmethod + def VALIDATE_INPUTS( + cls, + horizontal_movement: float, + vertical_movement: float, + pan: float, + tilt: float, + roll: float, + zoom: float, + ) -> bool | str: + if not is_valid_camera_control_configs( + [ + horizontal_movement, + vertical_movement, + pan, + tilt, + roll, + zoom, + ] + ): + return "Invalid camera control configs: at least one of the values must be non-zero" + return True + + def main( + self, + camera_control_type: str, + horizontal_movement: float, + vertical_movement: float, + pan: float, + tilt: float, + roll: float, + zoom: float, + ) -> tuple[KlingCameraControl]: + return ( + KlingCameraControl( + type=KlingCameraControlType(camera_control_type), + config=KlingCameraConfig( + horizontal=horizontal_movement, + vertical=vertical_movement, + pan=pan, + roll=roll, + tilt=tilt, + zoom=zoom, + ), + ), + ) + + +class KlingTextToVideoNode(KlingNodeBase): + """Kling Text to Video Node""" + + @staticmethod + def get_mode_string_mapping() -> dict[str, tuple[str, str, str]]: + """ + Returns a mapping of mode strings to their corresponding (mode, duration, model_name) tuples. + Only includes config combos that support the `image_tail` request field. + + See: [Kling API Docs Capability Map](https://app.klingai.com/global/dev/document-api/apiReference/model/skillsMap) + """ + return { + "standard mode / 5s duration / kling-v1": ("std", "5", "kling-v1"), + "standard mode / 10s duration / kling-v1": ("std", "10", "kling-v1"), + "pro mode / 5s duration / kling-v1": ("pro", "5", "kling-v1"), + "pro mode / 10s duration / kling-v1": ("pro", "10", "kling-v1"), + "standard mode / 5s duration / kling-v1-6": ("std", "5", "kling-v1-6"), + "standard mode / 10s duration / kling-v1-6": ("std", "10", "kling-v1-6"), + "pro mode / 5s duration / kling-v2-master": ("pro", "5", "kling-v2-master"), + "pro mode / 10s duration / kling-v2-master": ("pro", "10", "kling-v2-master"), + "standard mode / 5s duration / kling-v2-master": ("std", "5", "kling-v2-master"), + "standard mode / 10s duration / kling-v2-master": ("std", "10", "kling-v2-master"), + } + + @classmethod + def INPUT_TYPES(s): + modes = list(KlingTextToVideoNode.get_mode_string_mapping().keys()) + return { + "required": { + "prompt": model_field_to_node_input( + IO.STRING, KlingText2VideoRequest, "prompt", multiline=True + ), + "negative_prompt": model_field_to_node_input( + IO.STRING, KlingText2VideoRequest, "negative_prompt", multiline=True + ), + "cfg_scale": model_field_to_node_input( + IO.FLOAT, + KlingText2VideoRequest, + "cfg_scale", + default=1.0, + min=0.0, + max=1.0, + ), + "aspect_ratio": model_field_to_node_input( + IO.COMBO, + KlingText2VideoRequest, + "aspect_ratio", + enum_type=KlingVideoGenAspectRatio, + ), + "mode": ( + modes, + { + "default": modes[4], + "tooltip": "The configuration to use for the video generation following the format: mode / duration / model_name.", + }, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + RETURN_TYPES = ("VIDEO", "STRING", "STRING") + RETURN_NAMES = ("VIDEO", "video_id", "duration") + DESCRIPTION = "Kling Text to Video Node" + + def get_response(self, task_id: str, auth_token: str) -> KlingText2VideoResponse: + return poll_until_finished( + auth_token, + ApiEndpoint( + path=f"{PATH_TEXT_TO_VIDEO}/{task_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=KlingText2VideoResponse, + ), + ) + + def api_call( + self, + prompt: str, + negative_prompt: str, + cfg_scale: float, + mode: str, + aspect_ratio: str, + camera_control: Optional[KlingCameraControl] = None, + model_name: Optional[str] = None, + duration: Optional[str] = None, + auth_token: Optional[str] = None, + ) -> tuple[VideoFromFile, str, str]: + validate_prompts(prompt, negative_prompt, MAX_PROMPT_LENGTH_T2V) + if model_name is None: + mode, duration, model_name = self.get_mode_string_mapping()[mode] + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_TEXT_TO_VIDEO, + method=HttpMethod.POST, + request_model=KlingText2VideoRequest, + response_model=KlingText2VideoResponse, + ), + request=KlingText2VideoRequest( + prompt=prompt if prompt else None, + negative_prompt=negative_prompt if negative_prompt else None, + duration=KlingVideoGenDuration(duration), + mode=KlingVideoGenMode(mode), + model_name=KlingVideoGenModelName(model_name), + cfg_scale=cfg_scale, + aspect_ratio=KlingVideoGenAspectRatio(aspect_ratio), + camera_control=camera_control, + ), + auth_token=auth_token, + ) + + task_creation_response = initial_operation.execute() + validate_task_creation_response(task_creation_response) + + task_id = task_creation_response.data.task_id + final_response = self.get_response(task_id, auth_token) + validate_video_result_response(final_response) + + video = get_video_from_response(final_response) + return video_result_to_node_output(video) + + +class KlingCameraControlT2VNode(KlingTextToVideoNode): + """ + Kling Text to Video Camera Control Node. This node is a text to video node, but it supports controlling the camera. + Duration, mode, and model_name request fields are hard-coded because camera control is only supported in pro mode with the kling-v1-5 model at 5s duration as of 2025-05-02. + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": model_field_to_node_input( + IO.STRING, KlingText2VideoRequest, "prompt", multiline=True + ), + "negative_prompt": model_field_to_node_input( + IO.STRING, + KlingText2VideoRequest, + "negative_prompt", + multiline=True, + ), + "cfg_scale": model_field_to_node_input( + IO.FLOAT, + KlingText2VideoRequest, + "cfg_scale", + default=0.75, + min=0.0, + max=1.0, + ), + "aspect_ratio": model_field_to_node_input( + IO.COMBO, + KlingText2VideoRequest, + "aspect_ratio", + enum_type=KlingVideoGenAspectRatio, + ), + "camera_control": ( + "CAMERA_CONTROL", + { + "tooltip": "Can be created using the Kling Camera Controls node. Controls the camera movement and motion during the video generation.", + }, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + DESCRIPTION = "Transform text into cinematic videos with professional camera movements that simulate real-world cinematography. Control virtual camera actions including zoom, rotation, pan, tilt, and first-person view, while maintaining focus on your original text." + + def api_call( + self, + prompt: str, + negative_prompt: str, + cfg_scale: float, + aspect_ratio: str, + camera_control: Optional[KlingCameraControl] = None, + auth_token: Optional[str] = None, + ): + return super().api_call( + model_name=KlingVideoGenModelName.kling_v1, + cfg_scale=cfg_scale, + mode=KlingVideoGenMode.std, + aspect_ratio=KlingVideoGenAspectRatio(aspect_ratio), + duration=KlingVideoGenDuration.field_5, + prompt=prompt, + negative_prompt=negative_prompt, + camera_control=camera_control, + auth_token=auth_token, + ) + + +class KlingImage2VideoNode(KlingNodeBase): + """Kling Image to Video Node""" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "start_frame": model_field_to_node_input( + IO.IMAGE, KlingImage2VideoRequest, "image" + ), + "prompt": model_field_to_node_input( + IO.STRING, KlingImage2VideoRequest, "prompt", multiline=True + ), + "negative_prompt": model_field_to_node_input( + IO.STRING, + KlingImage2VideoRequest, + "negative_prompt", + multiline=True, + ), + "model_name": model_field_to_node_input( + IO.COMBO, + KlingImage2VideoRequest, + "model_name", + enum_type=KlingVideoGenModelName, + ), + "cfg_scale": model_field_to_node_input( + IO.FLOAT, + KlingImage2VideoRequest, + "cfg_scale", + default=0.8, + min=0.0, + max=1.0, + ), + "mode": model_field_to_node_input( + IO.COMBO, + KlingImage2VideoRequest, + "mode", + enum_type=KlingVideoGenMode, + ), + "aspect_ratio": model_field_to_node_input( + IO.COMBO, + KlingImage2VideoRequest, + "aspect_ratio", + enum_type=KlingVideoGenAspectRatio, + ), + "duration": model_field_to_node_input( + IO.COMBO, + KlingImage2VideoRequest, + "duration", + enum_type=KlingVideoGenDuration, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + RETURN_TYPES = ("VIDEO", "STRING", "STRING") + RETURN_NAMES = ("VIDEO", "video_id", "duration") + DESCRIPTION = "Kling Image to Video Node" + + def get_response(self, task_id: str, auth_token: str) -> KlingImage2VideoResponse: + return poll_until_finished( + auth_token, + ApiEndpoint( + path=f"{PATH_IMAGE_TO_VIDEO}/{task_id}", + method=HttpMethod.GET, + request_model=KlingImage2VideoRequest, + response_model=KlingImage2VideoResponse, + ), + ) + + def api_call( + self, + start_frame: torch.Tensor, + prompt: str, + negative_prompt: str, + model_name: str, + cfg_scale: float, + mode: str, + aspect_ratio: str, + duration: str, + camera_control: Optional[KlingCameraControl] = None, + end_frame: Optional[torch.Tensor] = None, + auth_token: Optional[str] = None, + ) -> tuple[VideoFromFile]: + validate_prompts(prompt, negative_prompt, MAX_PROMPT_LENGTH_I2V) + + if camera_control is not None: + # Camera control type for image 2 video is always simple + camera_control.type = KlingCameraControlType.simple + + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_IMAGE_TO_VIDEO, + method=HttpMethod.POST, + request_model=KlingImage2VideoRequest, + response_model=KlingImage2VideoResponse, + ), + request=KlingImage2VideoRequest( + model_name=KlingVideoGenModelName(model_name), + image=tensor_to_base64_string(start_frame), + image_tail=( + tensor_to_base64_string(end_frame) + if end_frame is not None + else None + ), + prompt=prompt, + negative_prompt=negative_prompt if negative_prompt else None, + cfg_scale=cfg_scale, + mode=KlingVideoGenMode(mode), + aspect_ratio=KlingVideoGenAspectRatio(aspect_ratio), + duration=KlingVideoGenDuration(duration), + camera_control=camera_control, + ), + auth_token=auth_token, + ) + + task_creation_response = initial_operation.execute() + validate_task_creation_response(task_creation_response) + task_id = task_creation_response.data.task_id + + final_response = self.get_response(task_id, auth_token) + validate_video_result_response(final_response) + + video = get_video_from_response(final_response) + return video_result_to_node_output(video) + + +class KlingCameraControlI2VNode(KlingImage2VideoNode): + """ + Kling Image to Video Camera Control Node. This node is a image to video node, but it supports controlling the camera. + Duration, mode, and model_name request fields are hard-coded because camera control is only supported in pro mode with the kling-v1-5 model at 5s duration as of 2025-05-02. + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "start_frame": model_field_to_node_input( + IO.IMAGE, KlingImage2VideoRequest, "image" + ), + "prompt": model_field_to_node_input( + IO.STRING, KlingImage2VideoRequest, "prompt", multiline=True + ), + "negative_prompt": model_field_to_node_input( + IO.STRING, + KlingImage2VideoRequest, + "negative_prompt", + multiline=True, + ), + "cfg_scale": model_field_to_node_input( + IO.FLOAT, + KlingImage2VideoRequest, + "cfg_scale", + default=0.75, + min=0.0, + max=1.0, + ), + "aspect_ratio": model_field_to_node_input( + IO.COMBO, + KlingImage2VideoRequest, + "aspect_ratio", + enum_type=KlingVideoGenAspectRatio, + ), + "camera_control": ( + "CAMERA_CONTROL", + { + "tooltip": "Can be created using the Kling Camera Controls node. Controls the camera movement and motion during the video generation.", + }, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + DESCRIPTION = "Transform still images into cinematic videos with professional camera movements that simulate real-world cinematography. Control virtual camera actions including zoom, rotation, pan, tilt, and first-person view, while maintaining focus on your original image." + + def api_call( + self, + start_frame: torch.Tensor, + prompt: str, + negative_prompt: str, + cfg_scale: float, + aspect_ratio: str, + camera_control: KlingCameraControl, + auth_token: Optional[str] = None, + ): + return super().api_call( + model_name=KlingVideoGenModelName.kling_v1_5, + start_frame=start_frame, + cfg_scale=cfg_scale, + mode=KlingVideoGenMode.pro, + aspect_ratio=KlingVideoGenAspectRatio(aspect_ratio), + duration=KlingVideoGenDuration.field_5, + prompt=prompt, + negative_prompt=negative_prompt, + camera_control=camera_control, + auth_token=auth_token, + ) + + +class KlingStartEndFrameNode(KlingImage2VideoNode): + """ + Kling First Last Frame Node. This node allows creation of a video from a first and last frame. It calls the normal image to video endpoint, but only allows the subset of input options that support the `image_tail` request field. + """ + + @staticmethod + def get_mode_string_mapping() -> dict[str, tuple[str, str, str]]: + """ + Returns a mapping of mode strings to their corresponding (mode, duration, model_name) tuples. + Only includes config combos that support the `image_tail` request field. + + See: [Kling API Docs Capability Map](https://app.klingai.com/global/dev/document-api/apiReference/model/skillsMap) + """ + return { + "standard mode / 5s duration / kling-v1": ("std", "5", "kling-v1"), + "pro mode / 5s duration / kling-v1": ("pro", "5", "kling-v1"), + "pro mode / 5s duration / kling-v1-5": ("pro", "5", "kling-v1-5"), + "pro mode / 10s duration / kling-v1-5": ("pro", "10", "kling-v1-5"), + "pro mode / 5s duration / kling-v1-6": ("pro", "5", "kling-v1-6"), + "pro mode / 10s duration / kling-v1-6": ("pro", "10", "kling-v1-6"), + } + + @classmethod + def INPUT_TYPES(s): + modes = list(KlingStartEndFrameNode.get_mode_string_mapping().keys()) + return { + "required": { + "start_frame": model_field_to_node_input( + IO.IMAGE, KlingImage2VideoRequest, "image" + ), + "end_frame": model_field_to_node_input( + IO.IMAGE, KlingImage2VideoRequest, "image_tail" + ), + "prompt": model_field_to_node_input( + IO.STRING, KlingImage2VideoRequest, "prompt", multiline=True + ), + "negative_prompt": model_field_to_node_input( + IO.STRING, + KlingImage2VideoRequest, + "negative_prompt", + multiline=True, + ), + "cfg_scale": model_field_to_node_input( + IO.FLOAT, + KlingImage2VideoRequest, + "cfg_scale", + default=0.5, + min=0.0, + max=1.0, + ), + "aspect_ratio": model_field_to_node_input( + IO.COMBO, + KlingImage2VideoRequest, + "aspect_ratio", + enum_type=KlingVideoGenAspectRatio, + ), + "mode": ( + modes, + { + "default": modes[2], + "tooltip": "The configuration to use for the video generation following the format: mode / duration / model_name.", + }, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + DESCRIPTION = "Generate a video sequence that transitions between your provided start and end images. The node creates all frames in between, producing a smooth transformation from the first frame to the last." + + def api_call( + self, + start_frame: torch.Tensor, + end_frame: torch.Tensor, + prompt: str, + negative_prompt: str, + cfg_scale: float, + aspect_ratio: str, + mode: str, + auth_token: Optional[str] = None, + ): + mode, duration, model_name = KlingStartEndFrameNode.get_mode_string_mapping()[ + mode + ] + return super().api_call( + prompt=prompt, + negative_prompt=negative_prompt, + model_name=model_name, + start_frame=start_frame, + cfg_scale=cfg_scale, + mode=mode, + aspect_ratio=aspect_ratio, + duration=duration, + end_frame=end_frame, + auth_token=auth_token, + ) + + +class KlingVideoExtendNode(KlingNodeBase): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": model_field_to_node_input( + IO.STRING, KlingVideoExtendRequest, "prompt", multiline=True + ), + "negative_prompt": model_field_to_node_input( + IO.STRING, + KlingVideoExtendRequest, + "negative_prompt", + multiline=True, + ), + "cfg_scale": model_field_to_node_input( + IO.FLOAT, + KlingVideoExtendRequest, + "cfg_scale", + default=0.5, + min=0.0, + max=1.0, + ), + "video_id": model_field_to_node_input( + IO.STRING, KlingVideoExtendRequest, "video_id", forceInput=True + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + RETURN_TYPES = ("VIDEO", "STRING", "STRING") + RETURN_NAMES = ("VIDEO", "video_id", "duration") + DESCRIPTION = "Kling Video Extend Node. Extend videos made by other Kling nodes. The video_id is created by using other Kling Nodes." + + def get_response(self, task_id: str, auth_token: str) -> KlingVideoExtendResponse: + return poll_until_finished( + auth_token, + ApiEndpoint( + path=f"{PATH_VIDEO_EXTEND}/{task_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=KlingVideoExtendResponse, + ), + ) + + def api_call( + self, + prompt: str, + negative_prompt: str, + cfg_scale: float, + video_id: str, + auth_token: Optional[str] = None, + ) -> tuple[VideoFromFile, str, str]: + validate_prompts(prompt, negative_prompt, MAX_PROMPT_LENGTH_T2V) + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_VIDEO_EXTEND, + method=HttpMethod.POST, + request_model=KlingVideoExtendRequest, + response_model=KlingVideoExtendResponse, + ), + request=KlingVideoExtendRequest( + prompt=prompt if prompt else None, + negative_prompt=negative_prompt if negative_prompt else None, + cfg_scale=cfg_scale, + video_id=video_id, + ), + auth_token=auth_token, + ) + + task_creation_response = initial_operation.execute() + validate_task_creation_response(task_creation_response) + task_id = task_creation_response.data.task_id + + final_response = self.get_response(task_id, auth_token) + validate_video_result_response(final_response) + + video = get_video_from_response(final_response) + return video_result_to_node_output(video) + + +class KlingVideoEffectsBase(KlingNodeBase): + """Kling Video Effects Base""" + + RETURN_TYPES = ("VIDEO", "STRING", "STRING") + RETURN_NAMES = ("VIDEO", "video_id", "duration") + + def get_response(self, task_id: str, auth_token: str) -> KlingVideoEffectsResponse: + return poll_until_finished( + auth_token, + ApiEndpoint( + path=f"{PATH_VIDEO_EFFECTS}/{task_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=KlingVideoEffectsResponse, + ), + ) + + def api_call( + self, + dual_character: bool, + effect_scene: KlingDualCharacterEffectsScene | KlingSingleImageEffectsScene, + model_name: str, + duration: KlingVideoGenDuration, + image_1: torch.Tensor, + image_2: Optional[torch.Tensor] = None, + mode: Optional[KlingVideoGenMode] = None, + auth_token: Optional[str] = None, + ): + if dual_character: + request_input_field = KlingDualCharacterEffectInput( + model_name=model_name, + mode=mode, + images=[ + tensor_to_base64_string(image_1), + tensor_to_base64_string(image_2), + ], + duration=duration, + ) + else: + request_input_field = KlingSingleImageEffectInput( + model_name=model_name, + image=tensor_to_base64_string(image_1), + duration=duration, + ) + + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_VIDEO_EFFECTS, + method=HttpMethod.POST, + request_model=KlingVideoEffectsRequest, + response_model=KlingVideoEffectsResponse, + ), + request=KlingVideoEffectsRequest( + effect_scene=effect_scene, + input=request_input_field, + ), + auth_token=auth_token, + ) + + task_creation_response = initial_operation.execute() + validate_task_creation_response(task_creation_response) + task_id = task_creation_response.data.task_id + + final_response = self.get_response(task_id, auth_token) + validate_video_result_response(final_response) + + video = get_video_from_response(final_response) + return video_result_to_node_output(video) + + +class KlingDualCharacterVideoEffectNode(KlingVideoEffectsBase): + """Kling Dual Character Video Effect Node""" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image_left": (IO.IMAGE, {"tooltip": "Left side image"}), + "image_right": (IO.IMAGE, {"tooltip": "Right side image"}), + "effect_scene": model_field_to_node_input( + IO.COMBO, + KlingVideoEffectsRequest, + "effect_scene", + enum_type=KlingDualCharacterEffectsScene, + ), + "model_name": model_field_to_node_input( + IO.COMBO, + KlingDualCharacterEffectInput, + "model_name", + enum_type=KlingCharacterEffectModelName, + ), + "mode": model_field_to_node_input( + IO.COMBO, + KlingDualCharacterEffectInput, + "mode", + enum_type=KlingVideoGenMode, + ), + "duration": model_field_to_node_input( + IO.COMBO, + KlingDualCharacterEffectInput, + "duration", + enum_type=KlingVideoGenDuration, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + DESCRIPTION = "Achieve different special effects when generating a video based on the effect_scene. First image will be positioned on left side, second on right side of the composite." + RETURN_TYPES = ("VIDEO", "STRING") + RETURN_NAMES = ("VIDEO", "duration") + + def api_call( + self, + image_left: torch.Tensor, + image_right: torch.Tensor, + effect_scene: KlingDualCharacterEffectsScene, + model_name: KlingCharacterEffectModelName, + mode: KlingVideoGenMode, + duration: KlingVideoGenDuration, + auth_token: Optional[str] = None, + ): + video, _, duration = super().api_call( + dual_character=True, + effect_scene=effect_scene, + model_name=model_name, + mode=mode, + duration=duration, + image_1=image_left, + image_2=image_right, + auth_token=auth_token, + ) + return video, duration + +class KlingSingleImageVideoEffectNode(KlingVideoEffectsBase): + """Kling Single Image Video Effect Node""" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": ( + IO.IMAGE, + { + "tooltip": " Reference Image. URL or Base64 encoded string (without data:image prefix). File size cannot exceed 10MB, resolution not less than 300*300px, aspect ratio between 1:2.5 ~ 2.5:1" + }, + ), + "effect_scene": model_field_to_node_input( + IO.COMBO, + KlingVideoEffectsRequest, + "effect_scene", + enum_type=KlingSingleImageEffectsScene, + ), + "model_name": model_field_to_node_input( + IO.COMBO, + KlingSingleImageEffectInput, + "model_name", + enum_type=KlingSingleImageEffectModelName, + ), + "duration": model_field_to_node_input( + IO.COMBO, + KlingSingleImageEffectInput, + "duration", + enum_type=KlingVideoGenDuration, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + DESCRIPTION = "Achieve different special effects when generating a video based on the effect_scene." + + def api_call( + self, + image: torch.Tensor, + effect_scene: KlingSingleImageEffectsScene, + model_name: KlingSingleImageEffectModelName, + duration: KlingVideoGenDuration, + auth_token: Optional[str] = None, + ): + return super().api_call( + dual_character=False, + effect_scene=effect_scene, + model_name=model_name, + duration=duration, + image_1=image, + auth_token=auth_token, + ) + + +class KlingLipSyncBase(KlingNodeBase): + """Kling Lip Sync Base""" + + RETURN_TYPES = ("VIDEO", "STRING", "STRING") + RETURN_NAMES = ("VIDEO", "video_id", "duration") + + def validate_text(self, text: str): + if not text: + raise ValueError("Text is required") + if len(text) > MAX_PROMPT_LENGTH_LIP_SYNC: + raise ValueError( + f"Text is too long. Maximum length is {MAX_PROMPT_LENGTH_LIP_SYNC} characters." + ) + + def get_response(self, task_id: str, auth_token: str) -> KlingLipSyncResponse: + """Polls the Kling API endpoint until the task reaches a terminal state.""" + return poll_until_finished( + auth_token, + ApiEndpoint( + path=f"{PATH_LIP_SYNC}/{task_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=KlingLipSyncResponse, + ), + ) + + def api_call( + self, + video: VideoInput, + audio: Optional[AudioInput] = None, + voice_language: Optional[str] = None, + mode: Optional[str] = None, + text: Optional[str] = None, + voice_speed: Optional[float] = None, + voice_id: Optional[str] = None, + auth_token: Optional[str] = None, + ) -> tuple[VideoFromFile, str, str]: + if text: + self.validate_text(text) + + # Upload video to Comfy API and get download URL + video_url = upload_video_to_comfyapi(video, auth_token) + logging.info("Uploaded video to Comfy API. URL: %s", video_url) + + # Upload the audio file to Comfy API and get download URL + if audio: + audio_url = upload_audio_to_comfyapi(audio, auth_token) + logging.info("Uploaded audio to Comfy API. URL: %s", audio_url) + else: + audio_url = None + + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_LIP_SYNC, + method=HttpMethod.POST, + request_model=KlingLipSyncRequest, + response_model=KlingLipSyncResponse, + ), + request=KlingLipSyncRequest( + input=KlingLipSyncInputObject( + video_url=video_url, + mode=mode, + text=text, + voice_language=voice_language, + voice_speed=voice_speed, + audio_type="url", + audio_url=audio_url, + voice_id=voice_id, + ), + ), + auth_token=auth_token, + ) + + task_creation_response = initial_operation.execute() + validate_task_creation_response(task_creation_response) + task_id = task_creation_response.data.task_id + + final_response = self.get_response(task_id, auth_token) + validate_video_result_response(final_response) + + video = get_video_from_response(final_response) + return video_result_to_node_output(video) + + +class KlingLipSyncAudioToVideoNode(KlingLipSyncBase): + """Kling Lip Sync Audio to Video Node. Syncs mouth movements in a video file to the audio content of an audio file.""" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "video": (IO.VIDEO, {}), + "audio": (IO.AUDIO, {}), + "voice_language": model_field_to_node_input( + IO.COMBO, + KlingLipSyncInputObject, + "voice_language", + enum_type=KlingLipSyncVoiceLanguage, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + DESCRIPTION = "Kling Lip Sync Audio to Video Node. Syncs mouth movements in a video file to the audio content of an audio file." + + def api_call( + self, + video: VideoInput, + audio: AudioInput, + voice_language: str, + auth_token: Optional[str] = None, + ): + return super().api_call( + video=video, + audio=audio, + voice_language=voice_language, + mode="audio2video", + auth_token=auth_token, + ) + + +class KlingLipSyncTextToVideoNode(KlingLipSyncBase): + """Kling Lip Sync Text to Video Node. Syncs mouth movements in a video file to a text prompt.""" + + @staticmethod + def get_voice_config() -> dict[str, tuple[str, str]]: + return { + # English voices + "Melody": ("girlfriend_4_speech02", "en"), + "Sunny": ("genshin_vindi2", "en"), + "Sage": ("zhinen_xuesheng", "en"), + "Ace": ("AOT", "en"), + "Blossom": ("ai_shatang", "en"), + "Peppy": ("genshin_klee2", "en"), + "Dove": ("genshin_kirara", "en"), + "Shine": ("ai_kaiya", "en"), + "Anchor": ("oversea_male1", "en"), + "Lyric": ("ai_chenjiahao_712", "en"), + "Tender": ("chat1_female_new-3", "en"), + "Siren": ("chat_0407_5-1", "en"), + "Zippy": ("cartoon-boy-07", "en"), + "Bud": ("uk_boy1", "en"), + "Sprite": ("cartoon-girl-01", "en"), + "Candy": ("PeppaPig_platform", "en"), + "Beacon": ("ai_huangzhong_712", "en"), + "Rock": ("ai_huangyaoshi_712", "en"), + "Titan": ("ai_laoguowang_712", "en"), + "Grace": ("chengshu_jiejie", "en"), + "Helen": ("you_pingjing", "en"), + "Lore": ("calm_story1", "en"), + "Crag": ("uk_man2", "en"), + "Prattle": ("laopopo_speech02", "en"), + "Hearth": ("heainainai_speech02", "en"), + "The Reader": ("reader_en_m-v1", "en"), + "Commercial Lady": ("commercial_lady_en_f-v1", "en"), + # Chinese voices + "阳光少年": ("genshin_vindi2", "zh"), + "懂事小弟": ("zhinen_xuesheng", "zh"), + "运动少年": ("tiyuxi_xuedi", "zh"), + "青春少女": ("ai_shatang", "zh"), + "温柔小妹": ("genshin_klee2", "zh"), + "元气少女": ("genshin_kirara", "zh"), + "阳光男生": ("ai_kaiya", "zh"), + "幽默小哥": ("tiexin_nanyou", "zh"), + "文艺小哥": ("ai_chenjiahao_712", "zh"), + "甜美邻家": ("girlfriend_1_speech02", "zh"), + "温柔姐姐": ("chat1_female_new-3", "zh"), + "职场女青": ("girlfriend_2_speech02", "zh"), + "活泼男童": ("cartoon-boy-07", "zh"), + "俏皮女童": ("cartoon-girl-01", "zh"), + "稳重老爸": ("ai_huangyaoshi_712", "zh"), + "温柔妈妈": ("you_pingjing", "zh"), + "严肃上司": ("ai_laoguowang_712", "zh"), + "优雅贵妇": ("chengshu_jiejie", "zh"), + "慈祥爷爷": ("zhuxi_speech02", "zh"), + "唠叨爷爷": ("uk_oldman3", "zh"), + "唠叨奶奶": ("laopopo_speech02", "zh"), + "和蔼奶奶": ("heainainai_speech02", "zh"), + "东北老铁": ("dongbeilaotie_speech02", "zh"), + "重庆小伙": ("chongqingxiaohuo_speech02", "zh"), + "四川妹子": ("chuanmeizi_speech02", "zh"), + "潮汕大叔": ("chaoshandashu_speech02", "zh"), + "台湾男生": ("ai_taiwan_man2_speech02", "zh"), + "西安掌柜": ("xianzhanggui_speech02", "zh"), + "天津姐姐": ("tianjinjiejie_speech02", "zh"), + "新闻播报男": ("diyinnansang_DB_CN_M_04-v2", "zh"), + "译制片男": ("yizhipiannan-v1", "zh"), + "撒娇女友": ("tianmeixuemei-v1", "zh"), + "刀片烟嗓": ("daopianyansang-v1", "zh"), + "乖巧正太": ("mengwa-v1", "zh"), + } + + @classmethod + def INPUT_TYPES(s): + voice_options = list(s.get_voice_config().keys()) + return { + "required": { + "video": (IO.VIDEO, {}), + "text": model_field_to_node_input( + IO.STRING, KlingLipSyncInputObject, "text", multiline=True + ), + "voice": (voice_options, {"default": voice_options[0]}), + "voice_speed": model_field_to_node_input( + IO.FLOAT, KlingLipSyncInputObject, "voice_speed", slider=True + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + DESCRIPTION = "Kling Lip Sync Text to Video Node. Syncs mouth movements in a video file to a text prompt." + + def api_call( + self, + video: VideoInput, + text: str, + voice: str, + voice_speed: float, + auth_token: Optional[str] = None, + ): + voice_id, voice_language = KlingLipSyncTextToVideoNode.get_voice_config()[voice] + return super().api_call( + video=video, + text=text, + voice_language=voice_language, + voice_id=voice_id, + voice_speed=voice_speed, + mode="text2video", + auth_token=auth_token, + ) + + +class KlingImageGenerationBase(KlingNodeBase): + """Kling Image Generation Base Node.""" + + RETURN_TYPES = ("IMAGE",) + CATEGORY = "api node/image/Kling" + + def validate_prompt(self, prompt: str, negative_prompt: Optional[str] = None): + if not prompt or len(prompt) > MAX_PROMPT_LENGTH_IMAGE_GEN: + raise ValueError( + f"Prompt must be less than {MAX_PROMPT_LENGTH_IMAGE_GEN} characters" + ) + if negative_prompt and len(negative_prompt) > MAX_PROMPT_LENGTH_IMAGE_GEN: + raise ValueError( + f"Negative prompt must be less than {MAX_PROMPT_LENGTH_IMAGE_GEN} characters" + ) + + +class KlingVirtualTryOnNode(KlingImageGenerationBase): + """Kling Virtual Try On Node.""" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "human_image": (IO.IMAGE, {}), + "cloth_image": (IO.IMAGE, {}), + "model_name": model_field_to_node_input( + IO.COMBO, + KlingVirtualTryOnRequest, + "model_name", + enum_type=KlingVirtualTryOnModelName, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + DESCRIPTION = "Kling Virtual Try On Node. Input a human image and a cloth image to try on the cloth on the human." + + def get_response( + self, task_id: str, auth_token: Optional[str] = None + ) -> KlingVirtualTryOnResponse: + return poll_until_finished( + auth_token, + ApiEndpoint( + path=f"{PATH_VIRTUAL_TRY_ON}/{task_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=KlingVirtualTryOnResponse, + ), + ) + + def api_call( + self, + human_image: torch.Tensor, + cloth_image: torch.Tensor, + model_name: KlingVirtualTryOnModelName, + auth_token: Optional[str] = None, + ): + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_VIRTUAL_TRY_ON, + method=HttpMethod.POST, + request_model=KlingVirtualTryOnRequest, + response_model=KlingVirtualTryOnResponse, + ), + request=KlingVirtualTryOnRequest( + human_image=tensor_to_base64_string(human_image), + cloth_image=tensor_to_base64_string(cloth_image), + model_name=model_name, + ), + auth_token=auth_token, + ) + + task_creation_response = initial_operation.execute() + validate_task_creation_response(task_creation_response) + task_id = task_creation_response.data.task_id + + final_response = self.get_response(task_id, auth_token) + validate_image_result_response(final_response) + + images = get_images_from_response(final_response) + return (image_result_to_node_output(images),) + + +class KlingImageGenerationNode(KlingImageGenerationBase): + """Kling Image Generation Node. Generate an image from a text prompt with an optional reference image.""" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": model_field_to_node_input( + IO.STRING, + KlingImageGenerationsRequest, + "prompt", + multiline=True, + max_length=MAX_PROMPT_LENGTH_IMAGE_GEN, + ), + "negative_prompt": model_field_to_node_input( + IO.STRING, + KlingImageGenerationsRequest, + "negative_prompt", + multiline=True, + ), + "image_type": model_field_to_node_input( + IO.COMBO, + KlingImageGenerationsRequest, + "image_reference", + enum_type=KlingImageGenImageReferenceType, + ), + "image_fidelity": model_field_to_node_input( + IO.FLOAT, + KlingImageGenerationsRequest, + "image_fidelity", + slider=True, + step=0.01, + ), + "human_fidelity": model_field_to_node_input( + IO.FLOAT, + KlingImageGenerationsRequest, + "human_fidelity", + slider=True, + step=0.01, + ), + "model_name": model_field_to_node_input( + IO.COMBO, + KlingImageGenerationsRequest, + "model_name", + enum_type=KlingImageGenModelName, + ), + "aspect_ratio": model_field_to_node_input( + IO.COMBO, + KlingImageGenerationsRequest, + "aspect_ratio", + enum_type=KlingImageGenAspectRatio, + ), + "n": model_field_to_node_input( + IO.INT, + KlingImageGenerationsRequest, + "n", + ), + }, + "optional": { + "image": (IO.IMAGE, {}), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + DESCRIPTION = "Kling Image Generation Node. Generate an image from a text prompt with an optional reference image." + + def get_response( + self, task_id: str, auth_token: Optional[str] = None + ) -> KlingImageGenerationsResponse: + return poll_until_finished( + auth_token, + ApiEndpoint( + path=f"{PATH_IMAGE_GENERATIONS}/{task_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=KlingImageGenerationsResponse, + ), + ) + + def api_call( + self, + model_name: KlingImageGenModelName, + prompt: str, + negative_prompt: str, + image_type: KlingImageGenImageReferenceType, + image_fidelity: float, + human_fidelity: float, + n: int, + aspect_ratio: KlingImageGenAspectRatio, + image: Optional[torch.Tensor] = None, + auth_token: Optional[str] = None, + ): + self.validate_prompt(prompt, negative_prompt) + + if image is not None: + image = tensor_to_base64_string(image) + + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_IMAGE_GENERATIONS, + method=HttpMethod.POST, + request_model=KlingImageGenerationsRequest, + response_model=KlingImageGenerationsResponse, + ), + request=KlingImageGenerationsRequest( + model_name=model_name, + prompt=prompt, + negative_prompt=negative_prompt, + image=image, + image_reference=image_type, + image_fidelity=image_fidelity, + human_fidelity=human_fidelity, + n=n, + aspect_ratio=aspect_ratio, + ), + auth_token=auth_token, + ) + + task_creation_response = initial_operation.execute() + validate_task_creation_response(task_creation_response) + task_id = task_creation_response.data.task_id + + final_response = self.get_response(task_id, auth_token) + validate_image_result_response(final_response) + + images = get_images_from_response(final_response) + return (image_result_to_node_output(images),) + + +NODE_CLASS_MAPPINGS = { + "KlingCameraControls": KlingCameraControls, + "KlingTextToVideoNode": KlingTextToVideoNode, + "KlingImage2VideoNode": KlingImage2VideoNode, + "KlingCameraControlI2VNode": KlingCameraControlI2VNode, + "KlingCameraControlT2VNode": KlingCameraControlT2VNode, + "KlingStartEndFrameNode": KlingStartEndFrameNode, + "KlingVideoExtendNode": KlingVideoExtendNode, + "KlingLipSyncAudioToVideoNode": KlingLipSyncAudioToVideoNode, + "KlingLipSyncTextToVideoNode": KlingLipSyncTextToVideoNode, + "KlingVirtualTryOnNode": KlingVirtualTryOnNode, + "KlingImageGenerationNode": KlingImageGenerationNode, + "KlingSingleImageVideoEffectNode": KlingSingleImageVideoEffectNode, + "KlingDualCharacterVideoEffectNode": KlingDualCharacterVideoEffectNode, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "KlingCameraControls": "Kling Camera Controls", + "KlingTextToVideoNode": "Kling Text to Video", + "KlingImage2VideoNode": "Kling Image to Video", + "KlingCameraControlI2VNode": "Kling Image to Video (Camera Control)", + "KlingCameraControlT2VNode": "Kling Text to Video (Camera Control)", + "KlingStartEndFrameNode": "Kling Start-End Frame to Video", + "KlingVideoExtendNode": "Kling Video Extend", + "KlingLipSyncAudioToVideoNode": "Kling Lip Sync Video with Audio", + "KlingLipSyncTextToVideoNode": "Kling Lip Sync Video with Text", + "KlingVirtualTryOnNode": "Kling Virtual Try On", + "KlingImageGenerationNode": "Kling Image Generation", + "KlingSingleImageVideoEffectNode": "Kling Video Effects", + "KlingDualCharacterVideoEffectNode": "Kling Dual Character Video Effects", +} diff --git a/comfy_api_nodes/nodes_luma.py b/comfy_api_nodes/nodes_luma.py new file mode 100644 index 000000000..0f0d9aa80 --- /dev/null +++ b/comfy_api_nodes/nodes_luma.py @@ -0,0 +1,702 @@ +from inspect import cleandoc +from comfy.comfy_types.node_typing import IO, ComfyNodeABC +from comfy_api.input_impl.video_types import VideoFromFile +from comfy_api_nodes.apis.luma_api import ( + LumaImageModel, + LumaVideoModel, + LumaVideoOutputResolution, + LumaVideoModelOutputDuration, + LumaAspectRatio, + LumaState, + LumaImageGenerationRequest, + LumaGenerationRequest, + LumaGeneration, + LumaCharacterRef, + LumaModifyImageRef, + LumaImageIdentity, + LumaReference, + LumaReferenceChain, + LumaImageReference, + LumaKeyframes, + LumaConceptChain, + LumaIO, + get_luma_concepts, +) +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, + PollingOperation, + EmptyRequest, +) +from comfy_api_nodes.apinode_utils import ( + upload_images_to_comfyapi, + process_image_response, + validate_string, +) + +import requests +import torch +from io import BytesIO + + +class LumaReferenceNode(ComfyNodeABC): + """ + Holds an image and weight for use with Luma Generate Image node. + """ + + RETURN_TYPES = (LumaIO.LUMA_REF,) + RETURN_NAMES = ("luma_ref",) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "create_luma_reference" + CATEGORY = "api node/image/Luma" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": ( + IO.IMAGE, + { + "tooltip": "Image to use as reference.", + }, + ), + "weight": ( + IO.FLOAT, + { + "default": 1.0, + "min": 0.0, + "max": 1.0, + "step": 0.01, + "tooltip": "Weight of image reference.", + }, + ), + }, + "optional": {"luma_ref": (LumaIO.LUMA_REF,)}, + } + + def create_luma_reference( + self, image: torch.Tensor, weight: float, luma_ref: LumaReferenceChain = None + ): + if luma_ref is not None: + luma_ref = luma_ref.clone() + else: + luma_ref = LumaReferenceChain() + luma_ref.add(LumaReference(image=image, weight=round(weight, 2))) + return (luma_ref,) + + +class LumaConceptsNode(ComfyNodeABC): + """ + Holds one or more Camera Concepts for use with Luma Text to Video and Luma Image to Video nodes. + """ + + RETURN_TYPES = (LumaIO.LUMA_CONCEPTS,) + RETURN_NAMES = ("luma_concepts",) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "create_concepts" + CATEGORY = "api node/video/Luma" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "concept1": (get_luma_concepts(include_none=True),), + "concept2": (get_luma_concepts(include_none=True),), + "concept3": (get_luma_concepts(include_none=True),), + "concept4": (get_luma_concepts(include_none=True),), + }, + "optional": { + "luma_concepts": ( + LumaIO.LUMA_CONCEPTS, + { + "tooltip": "Optional Camera Concepts to add to the ones chosen here." + }, + ), + }, + } + + def create_concepts( + self, + concept1: str, + concept2: str, + concept3: str, + concept4: str, + luma_concepts: LumaConceptChain = None, + ): + chain = LumaConceptChain(str_list=[concept1, concept2, concept3, concept4]) + if luma_concepts is not None: + chain = luma_concepts.clone_and_merge(chain) + return (chain,) + + +class LumaImageGenerationNode(ComfyNodeABC): + """ + Generates images synchronously based on prompt and aspect ratio. + """ + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Luma" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation", + }, + ), + "model": ([model.value for model in LumaImageModel],), + "aspect_ratio": ( + [ratio.value for ratio in LumaAspectRatio], + { + "default": LumaAspectRatio.ratio_16_9, + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "Seed to determine if node should re-run; actual results are nondeterministic regardless of seed.", + }, + ), + "style_image_weight": ( + IO.FLOAT, + { + "default": 1.0, + "min": 0.0, + "max": 1.0, + "step": 0.01, + "tooltip": "Weight of style image. Ignored if no style_image provided.", + }, + ), + }, + "optional": { + "image_luma_ref": ( + LumaIO.LUMA_REF, + { + "tooltip": "Luma Reference node connection to influence generation with input images; up to 4 images can be considered." + }, + ), + "style_image": ( + IO.IMAGE, + {"tooltip": "Style reference image; only 1 image will be used."}, + ), + "character_image": ( + IO.IMAGE, + { + "tooltip": "Character reference images; can be a batch of multiple, up to 4 images can be considered." + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + prompt: str, + model: str, + aspect_ratio: str, + seed, + style_image_weight: float, + image_luma_ref: LumaReferenceChain = None, + style_image: torch.Tensor = None, + character_image: torch.Tensor = None, + auth_token=None, + **kwargs, + ): + validate_string(prompt, strip_whitespace=True, min_length=3) + # handle image_luma_ref + api_image_ref = None + if image_luma_ref is not None: + api_image_ref = self._convert_luma_refs( + image_luma_ref, max_refs=4, auth_token=auth_token + ) + # handle style_luma_ref + api_style_ref = None + if style_image is not None: + api_style_ref = self._convert_style_image( + style_image, weight=style_image_weight, auth_token=auth_token + ) + # handle character_ref images + character_ref = None + if character_image is not None: + download_urls = upload_images_to_comfyapi( + character_image, max_images=4, auth_token=auth_token + ) + character_ref = LumaCharacterRef( + identity0=LumaImageIdentity(images=download_urls) + ) + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/luma/generations/image", + method=HttpMethod.POST, + request_model=LumaImageGenerationRequest, + response_model=LumaGeneration, + ), + request=LumaImageGenerationRequest( + prompt=prompt, + model=model, + aspect_ratio=aspect_ratio, + image_ref=api_image_ref, + style_ref=api_style_ref, + character_ref=character_ref, + ), + auth_token=auth_token, + ) + response_api: LumaGeneration = operation.execute() + + operation = PollingOperation( + poll_endpoint=ApiEndpoint( + path=f"/proxy/luma/generations/{response_api.id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=LumaGeneration, + ), + completed_statuses=[LumaState.completed], + failed_statuses=[LumaState.failed], + status_extractor=lambda x: x.state, + auth_token=auth_token, + ) + response_poll = operation.execute() + + img_response = requests.get(response_poll.assets.image) + img = process_image_response(img_response) + return (img,) + + def _convert_luma_refs( + self, luma_ref: LumaReferenceChain, max_refs: int, auth_token=None + ): + luma_urls = [] + ref_count = 0 + for ref in luma_ref.refs: + download_urls = upload_images_to_comfyapi( + ref.image, max_images=1, auth_token=auth_token + ) + luma_urls.append(download_urls[0]) + ref_count += 1 + if ref_count >= max_refs: + break + return luma_ref.create_api_model(download_urls=luma_urls, max_refs=max_refs) + + def _convert_style_image( + self, style_image: torch.Tensor, weight: float, auth_token=None + ): + chain = LumaReferenceChain( + first_ref=LumaReference(image=style_image, weight=weight) + ) + return self._convert_luma_refs(chain, max_refs=1, auth_token=auth_token) + + +class LumaImageModifyNode(ComfyNodeABC): + """ + Modifies images synchronously based on prompt and aspect ratio. + """ + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Luma" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": (IO.IMAGE,), + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation", + }, + ), + "image_weight": ( + IO.FLOAT, + { + "default": 0.1, + "min": 0.0, + "max": 0.98, + "step": 0.01, + "tooltip": "Weight of the image; the closer to 1.0, the less the image will be modified.", + }, + ), + "model": ([model.value for model in LumaImageModel],), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "Seed to determine if node should re-run; actual results are nondeterministic regardless of seed.", + }, + ), + }, + "optional": {}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + prompt: str, + model: str, + image: torch.Tensor, + image_weight: float, + seed, + auth_token=None, + **kwargs, + ): + # first, upload image + download_urls = upload_images_to_comfyapi( + image, max_images=1, auth_token=auth_token + ) + image_url = download_urls[0] + # next, make Luma call with download url provided + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/luma/generations/image", + method=HttpMethod.POST, + request_model=LumaImageGenerationRequest, + response_model=LumaGeneration, + ), + request=LumaImageGenerationRequest( + prompt=prompt, + model=model, + modify_image_ref=LumaModifyImageRef( + url=image_url, weight=round(max(min(1.0-image_weight, 0.98), 0.0), 2) + ), + ), + auth_token=auth_token, + ) + response_api: LumaGeneration = operation.execute() + + operation = PollingOperation( + poll_endpoint=ApiEndpoint( + path=f"/proxy/luma/generations/{response_api.id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=LumaGeneration, + ), + completed_statuses=[LumaState.completed], + failed_statuses=[LumaState.failed], + status_extractor=lambda x: x.state, + auth_token=auth_token, + ) + response_poll = operation.execute() + + img_response = requests.get(response_poll.assets.image) + img = process_image_response(img_response) + return (img,) + + +class LumaTextToVideoGenerationNode(ComfyNodeABC): + """ + Generates videos synchronously based on prompt and output_size. + """ + + RETURN_TYPES = (IO.VIDEO,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/video/Luma" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the video generation", + }, + ), + "model": ([model.value for model in LumaVideoModel],), + "aspect_ratio": ( + [ratio.value for ratio in LumaAspectRatio], + { + "default": LumaAspectRatio.ratio_16_9, + }, + ), + "resolution": ( + [resolution.value for resolution in LumaVideoOutputResolution], + { + "default": LumaVideoOutputResolution.res_540p, + }, + ), + "duration": ([dur.value for dur in LumaVideoModelOutputDuration],), + "loop": ( + IO.BOOLEAN, + { + "default": False, + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "Seed to determine if node should re-run; actual results are nondeterministic regardless of seed.", + }, + ), + }, + "optional": { + "luma_concepts": ( + LumaIO.LUMA_CONCEPTS, + { + "tooltip": "Optional Camera Concepts to dictate camera motion via the Luma Concepts node." + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + prompt: str, + model: str, + aspect_ratio: str, + resolution: str, + duration: str, + loop: bool, + seed, + luma_concepts: LumaConceptChain = None, + auth_token=None, + **kwargs, + ): + validate_string(prompt, strip_whitespace=False, min_length=3) + duration = duration if model != LumaVideoModel.ray_1_6 else None + resolution = resolution if model != LumaVideoModel.ray_1_6 else None + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/luma/generations", + method=HttpMethod.POST, + request_model=LumaGenerationRequest, + response_model=LumaGeneration, + ), + request=LumaGenerationRequest( + prompt=prompt, + model=model, + resolution=resolution, + aspect_ratio=aspect_ratio, + duration=duration, + loop=loop, + concepts=luma_concepts.create_api_model() if luma_concepts else None, + ), + auth_token=auth_token, + ) + response_api: LumaGeneration = operation.execute() + + operation = PollingOperation( + poll_endpoint=ApiEndpoint( + path=f"/proxy/luma/generations/{response_api.id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=LumaGeneration, + ), + completed_statuses=[LumaState.completed], + failed_statuses=[LumaState.failed], + status_extractor=lambda x: x.state, + auth_token=auth_token, + ) + response_poll = operation.execute() + + vid_response = requests.get(response_poll.assets.video) + return (VideoFromFile(BytesIO(vid_response.content)),) + + +class LumaImageToVideoGenerationNode(ComfyNodeABC): + """ + Generates videos synchronously based on prompt, input images, and output_size. + """ + + RETURN_TYPES = (IO.VIDEO,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/video/Luma" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the video generation", + }, + ), + "model": ([model.value for model in LumaVideoModel],), + # "aspect_ratio": ([ratio.value for ratio in LumaAspectRatio], { + # "default": LumaAspectRatio.ratio_16_9, + # }), + "resolution": ( + [resolution.value for resolution in LumaVideoOutputResolution], + { + "default": LumaVideoOutputResolution.res_540p, + }, + ), + "duration": ([dur.value for dur in LumaVideoModelOutputDuration],), + "loop": ( + IO.BOOLEAN, + { + "default": False, + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "Seed to determine if node should re-run; actual results are nondeterministic regardless of seed.", + }, + ), + }, + "optional": { + "first_image": ( + IO.IMAGE, + {"tooltip": "First frame of generated video."}, + ), + "last_image": (IO.IMAGE, {"tooltip": "Last frame of generated video."}), + "luma_concepts": ( + LumaIO.LUMA_CONCEPTS, + { + "tooltip": "Optional Camera Concepts to dictate camera motion via the Luma Concepts node." + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + prompt: str, + model: str, + resolution: str, + duration: str, + loop: bool, + seed, + first_image: torch.Tensor = None, + last_image: torch.Tensor = None, + luma_concepts: LumaConceptChain = None, + auth_token=None, + **kwargs, + ): + if first_image is None and last_image is None: + raise Exception( + "At least one of first_image and last_image requires an input." + ) + keyframes = self._convert_to_keyframes(first_image, last_image, auth_token) + duration = duration if model != LumaVideoModel.ray_1_6 else None + resolution = resolution if model != LumaVideoModel.ray_1_6 else None + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/luma/generations", + method=HttpMethod.POST, + request_model=LumaGenerationRequest, + response_model=LumaGeneration, + ), + request=LumaGenerationRequest( + prompt=prompt, + model=model, + aspect_ratio=LumaAspectRatio.ratio_16_9, # ignored, but still needed by the API for some reason + resolution=resolution, + duration=duration, + loop=loop, + keyframes=keyframes, + concepts=luma_concepts.create_api_model() if luma_concepts else None, + ), + auth_token=auth_token, + ) + response_api: LumaGeneration = operation.execute() + + operation = PollingOperation( + poll_endpoint=ApiEndpoint( + path=f"/proxy/luma/generations/{response_api.id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=LumaGeneration, + ), + completed_statuses=[LumaState.completed], + failed_statuses=[LumaState.failed], + status_extractor=lambda x: x.state, + auth_token=auth_token, + ) + response_poll = operation.execute() + + vid_response = requests.get(response_poll.assets.video) + return (VideoFromFile(BytesIO(vid_response.content)),) + + def _convert_to_keyframes( + self, + first_image: torch.Tensor = None, + last_image: torch.Tensor = None, + auth_token=None, + ): + if first_image is None and last_image is None: + return None + frame0 = None + frame1 = None + if first_image is not None: + download_urls = upload_images_to_comfyapi( + first_image, max_images=1, auth_token=auth_token + ) + frame0 = LumaImageReference(type="image", url=download_urls[0]) + if last_image is not None: + download_urls = upload_images_to_comfyapi( + last_image, max_images=1, auth_token=auth_token + ) + frame1 = LumaImageReference(type="image", url=download_urls[0]) + return LumaKeyframes(frame0=frame0, frame1=frame1) + + +# A dictionary that contains all nodes you want to export with their names +# NOTE: names should be globally unique +NODE_CLASS_MAPPINGS = { + "LumaImageNode": LumaImageGenerationNode, + "LumaImageModifyNode": LumaImageModifyNode, + "LumaVideoNode": LumaTextToVideoGenerationNode, + "LumaImageToVideoNode": LumaImageToVideoGenerationNode, + "LumaReferenceNode": LumaReferenceNode, + "LumaConceptsNode": LumaConceptsNode, +} + +# A dictionary that contains the friendly/humanly readable titles for the nodes +NODE_DISPLAY_NAME_MAPPINGS = { + "LumaImageNode": "Luma Text to Image", + "LumaImageModifyNode": "Luma Image to Image", + "LumaVideoNode": "Luma Text to Video", + "LumaImageToVideoNode": "Luma Image to Video", + "LumaReferenceNode": "Luma Reference", + "LumaConceptsNode": "Luma Concepts", +} diff --git a/comfy_api_nodes/nodes_minimax.py b/comfy_api_nodes/nodes_minimax.py new file mode 100644 index 000000000..cacda22c6 --- /dev/null +++ b/comfy_api_nodes/nodes_minimax.py @@ -0,0 +1,306 @@ +from comfy.comfy_types.node_typing import IO +from comfy_api.input_impl.video_types import VideoFromFile +from comfy_api_nodes.apis import ( + MinimaxVideoGenerationRequest, + MinimaxVideoGenerationResponse, + MinimaxFileRetrieveResponse, + MinimaxTaskResultResponse, + SubjectReferenceItem, + Model +) +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, + PollingOperation, + EmptyRequest, +) +from comfy_api_nodes.apinode_utils import ( + download_url_to_bytesio, + upload_images_to_comfyapi, + validate_string, +) + +import torch +import logging + + +class MinimaxTextToVideoNode: + """ + Generates videos synchronously based on a prompt, and optional parameters using MiniMax's API. + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt_text": ( + "STRING", + { + "multiline": True, + "default": "", + "tooltip": "Text prompt to guide the video generation", + }, + ), + "model": ( + [ + "T2V-01", + "T2V-01-Director", + ], + { + "default": "T2V-01", + "tooltip": "Model to use for video generation", + }, + ), + }, + "optional": { + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "The random seed used for creating the noise.", + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + RETURN_TYPES = ("VIDEO",) + DESCRIPTION = "Generates videos from prompts using MiniMax's API" + FUNCTION = "generate_video" + CATEGORY = "api node/video/MiniMax" + API_NODE = True + OUTPUT_NODE = True + + def generate_video( + self, + prompt_text, + seed=0, + model="T2V-01", + image: torch.Tensor=None, # used for ImageToVideo + subject: torch.Tensor=None, # used for SubjectToVideo + auth_token=None, + ): + ''' + Function used between MiniMax nodes - supports T2V, I2V, and S2V, based on provided arguments. + ''' + if image is None: + validate_string(prompt_text, field_name="prompt_text") + # upload image, if passed in + image_url = None + if image is not None: + image_url = upload_images_to_comfyapi(image, max_images=1, auth_token=auth_token)[0] + + # TODO: figure out how to deal with subject properly, API returns invalid params when using S2V-01 model + subject_reference = None + if subject is not None: + subject_url = upload_images_to_comfyapi(subject, max_images=1, auth_token=auth_token)[0] + subject_reference = [SubjectReferenceItem(image=subject_url)] + + + video_generate_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/minimax/video_generation", + method=HttpMethod.POST, + request_model=MinimaxVideoGenerationRequest, + response_model=MinimaxVideoGenerationResponse, + ), + request=MinimaxVideoGenerationRequest( + model=Model(model), + prompt=prompt_text, + callback_url=None, + first_frame_image=image_url, + subject_reference=subject_reference, + prompt_optimizer=None, + ), + auth_token=auth_token, + ) + response = video_generate_operation.execute() + + task_id = response.task_id + if not task_id: + raise Exception(f"MiniMax generation failed: {response.base_resp}") + + video_generate_operation = PollingOperation( + poll_endpoint=ApiEndpoint( + path="/proxy/minimax/query/video_generation", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=MinimaxTaskResultResponse, + query_params={"task_id": task_id}, + ), + completed_statuses=["Success"], + failed_statuses=["Fail"], + status_extractor=lambda x: x.status.value, + auth_token=auth_token, + ) + task_result = video_generate_operation.execute() + + file_id = task_result.file_id + if file_id is None: + raise Exception("Request was not successful. Missing file ID.") + file_retrieve_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/minimax/files/retrieve", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=MinimaxFileRetrieveResponse, + query_params={"file_id": int(file_id)}, + ), + request=EmptyRequest(), + auth_token=auth_token, + ) + file_result = file_retrieve_operation.execute() + + file_url = file_result.file.download_url + if file_url is None: + raise Exception( + f"No video was found in the response. Full response: {file_result.model_dump()}" + ) + logging.info(f"Generated video URL: {file_url}") + + video_io = download_url_to_bytesio(file_url) + if video_io is None: + error_msg = f"Failed to download video from {file_url}" + logging.error(error_msg) + raise Exception(error_msg) + return (VideoFromFile(video_io),) + + +class MinimaxImageToVideoNode(MinimaxTextToVideoNode): + """ + Generates videos synchronously based on an image and prompt, and optional parameters using MiniMax's API. + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": ( + IO.IMAGE, + { + "tooltip": "Image to use as first frame of video generation" + }, + ), + "prompt_text": ( + "STRING", + { + "multiline": True, + "default": "", + "tooltip": "Text prompt to guide the video generation", + }, + ), + "model": ( + [ + "I2V-01-Director", + "I2V-01", + "I2V-01-live", + ], + { + "default": "I2V-01", + "tooltip": "Model to use for video generation", + }, + ), + }, + "optional": { + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "The random seed used for creating the noise.", + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + RETURN_TYPES = ("VIDEO",) + DESCRIPTION = "Generates videos from an image and prompts using MiniMax's API" + FUNCTION = "generate_video" + CATEGORY = "api node/video/MiniMax" + API_NODE = True + OUTPUT_NODE = True + + +class MinimaxSubjectToVideoNode(MinimaxTextToVideoNode): + """ + Generates videos synchronously based on an image and prompt, and optional parameters using MiniMax's API. + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "subject": ( + IO.IMAGE, + { + "tooltip": "Image of subject to reference video generation" + }, + ), + "prompt_text": ( + "STRING", + { + "multiline": True, + "default": "", + "tooltip": "Text prompt to guide the video generation", + }, + ), + "model": ( + [ + "S2V-01", + ], + { + "default": "S2V-01", + "tooltip": "Model to use for video generation", + }, + ), + }, + "optional": { + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "The random seed used for creating the noise.", + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + RETURN_TYPES = ("VIDEO",) + DESCRIPTION = "Generates videos from an image and prompts using MiniMax's API" + FUNCTION = "generate_video" + CATEGORY = "api node/video/MiniMax" + API_NODE = True + OUTPUT_NODE = True + + +# A dictionary that contains all nodes you want to export with their names +# NOTE: names should be globally unique +NODE_CLASS_MAPPINGS = { + "MinimaxTextToVideoNode": MinimaxTextToVideoNode, + "MinimaxImageToVideoNode": MinimaxImageToVideoNode, + # "MinimaxSubjectToVideoNode": MinimaxSubjectToVideoNode, +} + +# A dictionary that contains the friendly/humanly readable titles for the nodes +NODE_DISPLAY_NAME_MAPPINGS = { + "MinimaxTextToVideoNode": "MiniMax Text to Video", + "MinimaxImageToVideoNode": "MiniMax Image to Video", + "MinimaxSubjectToVideoNode": "MiniMax Subject to Video", +} diff --git a/comfy_api_nodes/nodes_openai.py b/comfy_api_nodes/nodes_openai.py new file mode 100644 index 000000000..c18c65d7a --- /dev/null +++ b/comfy_api_nodes/nodes_openai.py @@ -0,0 +1,487 @@ +import io +from inspect import cleandoc +import numpy as np +import torch +from PIL import Image + +from comfy.comfy_types.node_typing import IO, ComfyNodeABC, InputTypeDict + + +from comfy_api_nodes.apis import ( + OpenAIImageGenerationRequest, + OpenAIImageEditRequest, + OpenAIImageGenerationResponse, +) + +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, +) + +from comfy_api_nodes.apinode_utils import ( + downscale_image_tensor, + validate_and_cast_response, + validate_string, +) + +class OpenAIDalle2(ComfyNodeABC): + """ + Generates images synchronously via OpenAI's DALL·E 2 endpoint. + """ + + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Text prompt for DALL·E", + }, + ), + }, + "optional": { + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 2**31 - 1, + "step": 1, + "display": "number", + "control_after_generate": True, + "tooltip": "not implemented yet in backend", + }, + ), + "size": ( + IO.COMBO, + { + "options": ["256x256", "512x512", "1024x1024"], + "default": "1024x1024", + "tooltip": "Image size", + }, + ), + "n": ( + IO.INT, + { + "default": 1, + "min": 1, + "max": 8, + "step": 1, + "display": "number", + "tooltip": "How many images to generate", + }, + ), + "image": ( + IO.IMAGE, + { + "default": None, + "tooltip": "Optional reference image for image editing.", + }, + ), + "mask": ( + IO.MASK, + { + "default": None, + "tooltip": "Optional mask for inpainting (white areas will be replaced)", + }, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + RETURN_TYPES = (IO.IMAGE,) + FUNCTION = "api_call" + CATEGORY = "api node/image/OpenAI" + DESCRIPTION = cleandoc(__doc__ or "") + API_NODE = True + + def api_call( + self, + prompt, + seed=0, + image=None, + mask=None, + n=1, + size="1024x1024", + auth_token=None, + ): + validate_string(prompt, strip_whitespace=False) + model = "dall-e-2" + path = "/proxy/openai/images/generations" + content_type = "application/json" + request_class = OpenAIImageGenerationRequest + img_binary = None + + if image is not None and mask is not None: + path = "/proxy/openai/images/edits" + content_type = "multipart/form-data" + request_class = OpenAIImageEditRequest + + input_tensor = image.squeeze().cpu() + height, width, channels = input_tensor.shape + rgba_tensor = torch.ones(height, width, 4, device="cpu") + rgba_tensor[:, :, :channels] = input_tensor + + if mask.shape[1:] != image.shape[1:-1]: + raise Exception("Mask and Image must be the same size") + rgba_tensor[:, :, 3] = 1 - mask.squeeze().cpu() + + rgba_tensor = downscale_image_tensor(rgba_tensor.unsqueeze(0)).squeeze() + + image_np = (rgba_tensor.numpy() * 255).astype(np.uint8) + img = Image.fromarray(image_np) + img_byte_arr = io.BytesIO() + img.save(img_byte_arr, format="PNG") + img_byte_arr.seek(0) + img_binary = img_byte_arr # .getvalue() + img_binary.name = "image.png" + elif image is not None or mask is not None: + raise Exception("Dall-E 2 image editing requires an image AND a mask") + + # Build the operation + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=path, + method=HttpMethod.POST, + request_model=request_class, + response_model=OpenAIImageGenerationResponse, + ), + request=request_class( + model=model, + prompt=prompt, + n=n, + size=size, + seed=seed, + ), + files=( + { + "image": img_binary, + } + if img_binary + else None + ), + content_type=content_type, + auth_token=auth_token, + ) + + response = operation.execute() + + img_tensor = validate_and_cast_response(response) + return (img_tensor,) + + +class OpenAIDalle3(ComfyNodeABC): + """ + Generates images synchronously via OpenAI's DALL·E 3 endpoint. + """ + + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Text prompt for DALL·E", + }, + ), + }, + "optional": { + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 2**31 - 1, + "step": 1, + "display": "number", + "control_after_generate": True, + "tooltip": "not implemented yet in backend", + }, + ), + "quality": ( + IO.COMBO, + { + "options": ["standard", "hd"], + "default": "standard", + "tooltip": "Image quality", + }, + ), + "style": ( + IO.COMBO, + { + "options": ["natural", "vivid"], + "default": "natural", + "tooltip": "Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images.", + }, + ), + "size": ( + IO.COMBO, + { + "options": ["1024x1024", "1024x1792", "1792x1024"], + "default": "1024x1024", + "tooltip": "Image size", + }, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + RETURN_TYPES = (IO.IMAGE,) + FUNCTION = "api_call" + CATEGORY = "api node/image/OpenAI" + DESCRIPTION = cleandoc(__doc__ or "") + API_NODE = True + + def api_call( + self, + prompt, + seed=0, + style="natural", + quality="standard", + size="1024x1024", + auth_token=None, + ): + validate_string(prompt, strip_whitespace=False) + model = "dall-e-3" + + # build the operation + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/openai/images/generations", + method=HttpMethod.POST, + request_model=OpenAIImageGenerationRequest, + response_model=OpenAIImageGenerationResponse, + ), + request=OpenAIImageGenerationRequest( + model=model, + prompt=prompt, + quality=quality, + size=size, + style=style, + seed=seed, + ), + auth_token=auth_token, + ) + + response = operation.execute() + + img_tensor = validate_and_cast_response(response) + return (img_tensor,) + + +class OpenAIGPTImage1(ComfyNodeABC): + """ + Generates images synchronously via OpenAI's GPT Image 1 endpoint. + """ + + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Text prompt for GPT Image 1", + }, + ), + }, + "optional": { + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 2**31 - 1, + "step": 1, + "display": "number", + "control_after_generate": True, + "tooltip": "not implemented yet in backend", + }, + ), + "quality": ( + IO.COMBO, + { + "options": ["low", "medium", "high"], + "default": "low", + "tooltip": "Image quality, affects cost and generation time.", + }, + ), + "background": ( + IO.COMBO, + { + "options": ["opaque", "transparent"], + "default": "opaque", + "tooltip": "Return image with or without background", + }, + ), + "size": ( + IO.COMBO, + { + "options": ["auto", "1024x1024", "1024x1536", "1536x1024"], + "default": "auto", + "tooltip": "Image size", + }, + ), + "n": ( + IO.INT, + { + "default": 1, + "min": 1, + "max": 8, + "step": 1, + "display": "number", + "tooltip": "How many images to generate", + }, + ), + "image": ( + IO.IMAGE, + { + "default": None, + "tooltip": "Optional reference image for image editing.", + }, + ), + "mask": ( + IO.MASK, + { + "default": None, + "tooltip": "Optional mask for inpainting (white areas will be replaced)", + }, + ), + }, + "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + } + + RETURN_TYPES = (IO.IMAGE,) + FUNCTION = "api_call" + CATEGORY = "api node/image/OpenAI" + DESCRIPTION = cleandoc(__doc__ or "") + API_NODE = True + + def api_call( + self, + prompt, + seed=0, + quality="low", + background="opaque", + image=None, + mask=None, + n=1, + size="1024x1024", + auth_token=None, + ): + validate_string(prompt, strip_whitespace=False) + model = "gpt-image-1" + path = "/proxy/openai/images/generations" + content_type="application/json" + request_class = OpenAIImageGenerationRequest + img_binaries = [] + mask_binary = None + files = [] + + if image is not None: + path = "/proxy/openai/images/edits" + request_class = OpenAIImageEditRequest + content_type ="multipart/form-data" + + batch_size = image.shape[0] + + for i in range(batch_size): + single_image = image[i : i + 1] + scaled_image = downscale_image_tensor(single_image).squeeze() + + image_np = (scaled_image.numpy() * 255).astype(np.uint8) + img = Image.fromarray(image_np) + img_byte_arr = io.BytesIO() + img.save(img_byte_arr, format="PNG") + img_byte_arr.seek(0) + img_binary = img_byte_arr + img_binary.name = f"image_{i}.png" + + img_binaries.append(img_binary) + if batch_size == 1: + files.append(("image", img_binary)) + else: + files.append(("image[]", img_binary)) + + if mask is not None: + if image is None: + raise Exception("Cannot use a mask without an input image") + if image.shape[0] != 1: + raise Exception("Cannot use a mask with multiple image") + if mask.shape[1:] != image.shape[1:-1]: + raise Exception("Mask and Image must be the same size") + batch, height, width = mask.shape + rgba_mask = torch.zeros(height, width, 4, device="cpu") + rgba_mask[:, :, 3] = 1 - mask.squeeze().cpu() + + scaled_mask = downscale_image_tensor(rgba_mask.unsqueeze(0)).squeeze() + + mask_np = (scaled_mask.numpy() * 255).astype(np.uint8) + mask_img = Image.fromarray(mask_np) + mask_img_byte_arr = io.BytesIO() + mask_img.save(mask_img_byte_arr, format="PNG") + mask_img_byte_arr.seek(0) + mask_binary = mask_img_byte_arr + mask_binary.name = "mask.png" + files.append(("mask", mask_binary)) + + # Build the operation + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=path, + method=HttpMethod.POST, + request_model=request_class, + response_model=OpenAIImageGenerationResponse, + ), + request=request_class( + model=model, + prompt=prompt, + quality=quality, + background=background, + n=n, + seed=seed, + size=size, + ), + files=files if files else None, + content_type=content_type, + auth_token=auth_token, + ) + + response = operation.execute() + + img_tensor = validate_and_cast_response(response) + return (img_tensor,) + + +# A dictionary that contains all nodes you want to export with their names +# NOTE: names should be globally unique +NODE_CLASS_MAPPINGS = { + "OpenAIDalle2": OpenAIDalle2, + "OpenAIDalle3": OpenAIDalle3, + "OpenAIGPTImage1": OpenAIGPTImage1, +} + +# A dictionary that contains the friendly/humanly readable titles for the nodes +NODE_DISPLAY_NAME_MAPPINGS = { + "OpenAIDalle2": "OpenAI DALL·E 2", + "OpenAIDalle3": "OpenAI DALL·E 3", + "OpenAIGPTImage1": "OpenAI GPT Image 1", +} diff --git a/comfy_api_nodes/nodes_pika.py b/comfy_api_nodes/nodes_pika.py new file mode 100644 index 000000000..ba4e8457d --- /dev/null +++ b/comfy_api_nodes/nodes_pika.py @@ -0,0 +1,749 @@ +""" +Pika x ComfyUI API Nodes + +Pika API docs: https://pika-827374fb.mintlify.app/api-reference +""" + +import io +from typing import Optional, TypeVar +import logging +import torch +import numpy as np +from comfy_api_nodes.apis import ( + PikaBodyGenerate22T2vGenerate22T2vPost, + PikaGenerateResponse, + PikaBodyGenerate22I2vGenerate22I2vPost, + PikaVideoResponse, + PikaBodyGenerate22C2vGenerate22PikascenesPost, + IngredientsMode, + PikaDurationEnum, + PikaResolutionEnum, + PikaBodyGeneratePikaffectsGeneratePikaffectsPost, + PikaBodyGeneratePikadditionsGeneratePikadditionsPost, + PikaBodyGeneratePikaswapsGeneratePikaswapsPost, + PikaBodyGenerate22KeyframeGenerate22PikaframesPost, + Pikaffect, +) +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, + PollingOperation, + EmptyRequest, +) +from comfy_api_nodes.apinode_utils import ( + tensor_to_bytesio, + download_url_to_video_output, +) +from comfy_api_nodes.mapper_utils import model_field_to_node_input +from comfy_api.input_impl.video_types import VideoInput, VideoContainer, VideoCodec +from comfy_api.input_impl import VideoFromFile +from comfy.comfy_types.node_typing import IO, ComfyNodeABC, InputTypeOptions + +R = TypeVar("R") + +PATH_PIKADDITIONS = "/proxy/pika/generate/pikadditions" +PATH_PIKASWAPS = "/proxy/pika/generate/pikaswaps" +PATH_PIKAFFECTS = "/proxy/pika/generate/pikaffects" + +PIKA_API_VERSION = "2.2" +PATH_TEXT_TO_VIDEO = f"/proxy/pika/generate/{PIKA_API_VERSION}/t2v" +PATH_IMAGE_TO_VIDEO = f"/proxy/pika/generate/{PIKA_API_VERSION}/i2v" +PATH_PIKAFRAMES = f"/proxy/pika/generate/{PIKA_API_VERSION}/pikaframes" +PATH_PIKASCENES = f"/proxy/pika/generate/{PIKA_API_VERSION}/pikascenes" + +PATH_VIDEO_GET = "/proxy/pika/videos" + + +class PikaApiError(Exception): + """Exception for Pika API errors.""" + + pass + + +def is_valid_video_response(response: PikaVideoResponse) -> bool: + """Check if the video response is valid.""" + return hasattr(response, "url") and response.url is not None + + +def is_valid_initial_response(response: PikaGenerateResponse) -> bool: + """Check if the initial response is valid.""" + return hasattr(response, "video_id") and response.video_id is not None + + +class PikaNodeBase(ComfyNodeABC): + """Base class for Pika nodes.""" + + @classmethod + def get_base_inputs_types( + cls, request_model + ) -> dict[str, tuple[IO, InputTypeOptions]]: + """Get the base required inputs types common to all Pika nodes.""" + return { + "prompt_text": model_field_to_node_input( + IO.STRING, + request_model, + "promptText", + multiline=True, + ), + "negative_prompt": model_field_to_node_input( + IO.STRING, + request_model, + "negativePrompt", + multiline=True, + ), + "seed": model_field_to_node_input( + IO.INT, + request_model, + "seed", + min=0, + max=0xFFFFFFFF, + control_after_generate=True, + ), + "resolution": model_field_to_node_input( + IO.COMBO, + request_model, + "resolution", + enum_type=PikaResolutionEnum, + ), + "duration": model_field_to_node_input( + IO.COMBO, + request_model, + "duration", + enum_type=PikaDurationEnum, + ), + } + + CATEGORY = "api node/video/Pika" + API_NODE = True + FUNCTION = "api_call" + RETURN_TYPES = ("VIDEO",) + + def poll_for_task_status( + self, task_id: str, auth_token: str + ) -> PikaGenerateResponse: + polling_operation = PollingOperation( + poll_endpoint=ApiEndpoint( + path=f"{PATH_VIDEO_GET}/{task_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=PikaVideoResponse, + ), + completed_statuses=[ + "finished", + ], + failed_statuses=["failed", "cancelled"], + status_extractor=lambda response: ( + response.status.value if response.status else None + ), + progress_extractor=lambda response: ( + response.progress if hasattr(response, "progress") else None + ), + auth_token=auth_token, + ) + return polling_operation.execute() + + def execute_task( + self, + initial_operation: SynchronousOperation[R, PikaGenerateResponse], + auth_token: Optional[str] = None, + ) -> tuple[VideoFromFile]: + """Executes the initial operation then polls for the task status until it is completed. + + Args: + initial_operation: The initial operation to execute. + auth_token: The authentication token to use for the API call. + + Returns: + A tuple containing the video file as a VIDEO output. + """ + initial_response = initial_operation.execute() + if not is_valid_initial_response(initial_response): + error_msg = f"Pika initial request failed. Code: {initial_response.code}, Message: {initial_response.message}, Data: {initial_response.data}" + logging.error(error_msg) + raise PikaApiError(error_msg) + + task_id = initial_response.video_id + final_response = self.poll_for_task_status(task_id, auth_token) + if not is_valid_video_response(final_response): + error_msg = ( + f"Pika task {task_id} succeeded but no video data found in response." + ) + logging.error(error_msg) + raise PikaApiError(error_msg) + + video_url = str(final_response.url) + logging.info("Pika task %s succeeded. Video URL: %s", task_id, video_url) + + return (download_url_to_video_output(video_url),) + + +class PikaImageToVideoV2_2(PikaNodeBase): + """Pika 2.2 Image to Video Node.""" + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "image": ( + IO.IMAGE, + {"tooltip": "The image to convert to video"}, + ), + **cls.get_base_inputs_types(PikaBodyGenerate22I2vGenerate22I2vPost), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + DESCRIPTION = "Sends an image and prompt to the Pika API v2.2 to generate a video." + + def api_call( + self, + image: torch.Tensor, + prompt_text: str, + negative_prompt: str, + seed: int, + resolution: str, + duration: int, + auth_token: Optional[str] = None, + ) -> tuple[VideoFromFile]: + # Convert image to BytesIO + image_bytes_io = tensor_to_bytesio(image) + image_bytes_io.seek(0) + + pika_files = {"image": ("image.png", image_bytes_io, "image/png")} + + # Prepare non-file data + pika_request_data = PikaBodyGenerate22I2vGenerate22I2vPost( + promptText=prompt_text, + negativePrompt=negative_prompt, + seed=seed, + resolution=resolution, + duration=duration, + ) + + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_IMAGE_TO_VIDEO, + method=HttpMethod.POST, + request_model=PikaBodyGenerate22I2vGenerate22I2vPost, + response_model=PikaGenerateResponse, + ), + request=pika_request_data, + files=pika_files, + content_type="multipart/form-data", + auth_token=auth_token, + ) + + return self.execute_task(initial_operation, auth_token) + + +class PikaTextToVideoNodeV2_2(PikaNodeBase): + """Pika Text2Video v2.2 Node.""" + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + **cls.get_base_inputs_types(PikaBodyGenerate22T2vGenerate22T2vPost), + "aspect_ratio": model_field_to_node_input( + IO.FLOAT, + PikaBodyGenerate22T2vGenerate22T2vPost, + "aspectRatio", + step=0.001, + min=0.4, + max=2.5, + default=1.7777777777777777, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + DESCRIPTION = "Sends a text prompt to the Pika API v2.2 to generate a video." + + def api_call( + self, + prompt_text: str, + negative_prompt: str, + seed: int, + resolution: str, + duration: int, + aspect_ratio: float, + auth_token: Optional[str] = None, + ) -> tuple[VideoFromFile]: + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_TEXT_TO_VIDEO, + method=HttpMethod.POST, + request_model=PikaBodyGenerate22T2vGenerate22T2vPost, + response_model=PikaGenerateResponse, + ), + request=PikaBodyGenerate22T2vGenerate22T2vPost( + promptText=prompt_text, + negativePrompt=negative_prompt, + seed=seed, + resolution=resolution, + duration=duration, + aspectRatio=aspect_ratio, + ), + auth_token=auth_token, + content_type="application/x-www-form-urlencoded", + ) + + return self.execute_task(initial_operation, auth_token) + + +class PikaScenesV2_2(PikaNodeBase): + """PikaScenes v2.2 Node.""" + + @classmethod + def INPUT_TYPES(cls): + image_ingredient_input = ( + IO.IMAGE, + {"tooltip": "Image that will be used as ingredient to create a video."}, + ) + return { + "required": { + **cls.get_base_inputs_types( + PikaBodyGenerate22C2vGenerate22PikascenesPost, + ), + "ingredients_mode": model_field_to_node_input( + IO.COMBO, + PikaBodyGenerate22C2vGenerate22PikascenesPost, + "ingredientsMode", + enum_type=IngredientsMode, + default="creative", + ), + "aspect_ratio": model_field_to_node_input( + IO.FLOAT, + PikaBodyGenerate22C2vGenerate22PikascenesPost, + "aspectRatio", + step=0.001, + min=0.4, + max=2.5, + default=1.7777777777777777, + ), + }, + "optional": { + "image_ingredient_1": image_ingredient_input, + "image_ingredient_2": image_ingredient_input, + "image_ingredient_3": image_ingredient_input, + "image_ingredient_4": image_ingredient_input, + "image_ingredient_5": image_ingredient_input, + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + DESCRIPTION = "Combine your images to create a video with the objects in them. Upload multiple images as ingredients and generate a high-quality video that incorporates all of them." + + def api_call( + self, + prompt_text: str, + negative_prompt: str, + seed: int, + resolution: str, + duration: int, + ingredients_mode: str, + aspect_ratio: float, + image_ingredient_1: Optional[torch.Tensor] = None, + image_ingredient_2: Optional[torch.Tensor] = None, + image_ingredient_3: Optional[torch.Tensor] = None, + image_ingredient_4: Optional[torch.Tensor] = None, + image_ingredient_5: Optional[torch.Tensor] = None, + auth_token: Optional[str] = None, + ) -> tuple[VideoFromFile]: + # Convert all passed images to BytesIO + all_image_bytes_io = [] + for image in [ + image_ingredient_1, + image_ingredient_2, + image_ingredient_3, + image_ingredient_4, + image_ingredient_5, + ]: + if image is not None: + image_bytes_io = tensor_to_bytesio(image) + image_bytes_io.seek(0) + all_image_bytes_io.append(image_bytes_io) + + pika_files = [ + ("images", (f"image_{i}.png", image_bytes_io, "image/png")) + for i, image_bytes_io in enumerate(all_image_bytes_io) + ] + + pika_request_data = PikaBodyGenerate22C2vGenerate22PikascenesPost( + ingredientsMode=ingredients_mode, + promptText=prompt_text, + negativePrompt=negative_prompt, + seed=seed, + resolution=resolution, + duration=duration, + aspectRatio=aspect_ratio, + ) + + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_PIKASCENES, + method=HttpMethod.POST, + request_model=PikaBodyGenerate22C2vGenerate22PikascenesPost, + response_model=PikaGenerateResponse, + ), + request=pika_request_data, + files=pika_files, + content_type="multipart/form-data", + auth_token=auth_token, + ) + + return self.execute_task(initial_operation, auth_token) + + +class PikAdditionsNode(PikaNodeBase): + """Pika Pikadditions Node. Add an image into a video.""" + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "video": (IO.VIDEO, {"tooltip": "The video to add an image to."}), + "image": (IO.IMAGE, {"tooltip": "The image to add to the video."}), + "prompt_text": model_field_to_node_input( + IO.STRING, + PikaBodyGeneratePikadditionsGeneratePikadditionsPost, + "promptText", + multiline=True, + ), + "negative_prompt": model_field_to_node_input( + IO.STRING, + PikaBodyGeneratePikadditionsGeneratePikadditionsPost, + "negativePrompt", + multiline=True, + ), + "seed": model_field_to_node_input( + IO.INT, + PikaBodyGeneratePikadditionsGeneratePikadditionsPost, + "seed", + min=0, + max=0xFFFFFFFF, + control_after_generate=True, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + DESCRIPTION = "Add any object or image into your video. Upload a video and specify what you’d like to add to create a seamlessly integrated result." + + def api_call( + self, + video: VideoInput, + image: torch.Tensor, + prompt_text: str, + negative_prompt: str, + seed: int, + auth_token: Optional[str] = None, + ) -> tuple[VideoFromFile]: + # Convert video to BytesIO + video_bytes_io = io.BytesIO() + video.save_to(video_bytes_io, format=VideoContainer.MP4, codec=VideoCodec.H264) + video_bytes_io.seek(0) + + # Convert image to BytesIO + image_bytes_io = tensor_to_bytesio(image) + image_bytes_io.seek(0) + + pika_files = [ + ("video", ("video.mp4", video_bytes_io, "video/mp4")), + ("image", ("image.png", image_bytes_io, "image/png")), + ] + + # Prepare non-file data + pika_request_data = PikaBodyGeneratePikadditionsGeneratePikadditionsPost( + promptText=prompt_text, + negativePrompt=negative_prompt, + seed=seed, + ) + + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_PIKADDITIONS, + method=HttpMethod.POST, + request_model=PikaBodyGeneratePikadditionsGeneratePikadditionsPost, + response_model=PikaGenerateResponse, + ), + request=pika_request_data, + files=pika_files, + content_type="multipart/form-data", + auth_token=auth_token, + ) + + return self.execute_task(initial_operation, auth_token) + + +class PikaSwapsNode(PikaNodeBase): + """Pika Pikaswaps Node.""" + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "video": (IO.VIDEO, {"tooltip": "The video to swap an object in."}), + "image": ( + IO.IMAGE, + { + "tooltip": "The image used to replace the masked object in the video." + }, + ), + "mask": ( + IO.MASK, + {"tooltip": "Use the mask to define areas in the video to replace"}, + ), + "prompt_text": model_field_to_node_input( + IO.STRING, + PikaBodyGeneratePikaswapsGeneratePikaswapsPost, + "promptText", + multiline=True, + ), + "negative_prompt": model_field_to_node_input( + IO.STRING, + PikaBodyGeneratePikaswapsGeneratePikaswapsPost, + "negativePrompt", + multiline=True, + ), + "seed": model_field_to_node_input( + IO.INT, + PikaBodyGeneratePikaswapsGeneratePikaswapsPost, + "seed", + min=0, + max=0xFFFFFFFF, + control_after_generate=True, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + DESCRIPTION = "Swap out any object or region of your video with a new image or object. Define areas to replace either with a mask or coordinates." + RETURN_TYPES = ("VIDEO",) + + def api_call( + self, + video: VideoInput, + image: torch.Tensor, + mask: torch.Tensor, + prompt_text: str, + negative_prompt: str, + seed: int, + auth_token: Optional[str] = None, + ) -> tuple[VideoFromFile]: + # Convert video to BytesIO + video_bytes_io = io.BytesIO() + video.save_to(video_bytes_io, format=VideoContainer.MP4, codec=VideoCodec.H264) + video_bytes_io.seek(0) + + # Convert mask to binary mask with three channels + mask = torch.round(mask) + mask = mask.repeat(1, 3, 1, 1) + + # Convert 3-channel binary mask to BytesIO + mask_bytes_io = io.BytesIO() + mask_bytes_io.write(mask.numpy().astype(np.uint8)) + mask_bytes_io.seek(0) + + # Convert image to BytesIO + image_bytes_io = tensor_to_bytesio(image) + image_bytes_io.seek(0) + + pika_files = [ + ("video", ("video.mp4", video_bytes_io, "video/mp4")), + ("image", ("image.png", image_bytes_io, "image/png")), + ("modifyRegionMask", ("mask.png", mask_bytes_io, "image/png")), + ] + + # Prepare non-file data + pika_request_data = PikaBodyGeneratePikaswapsGeneratePikaswapsPost( + promptText=prompt_text, + negativePrompt=negative_prompt, + seed=seed, + ) + + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_PIKADDITIONS, + method=HttpMethod.POST, + request_model=PikaBodyGeneratePikadditionsGeneratePikadditionsPost, + response_model=PikaGenerateResponse, + ), + request=pika_request_data, + files=pika_files, + content_type="multipart/form-data", + auth_token=auth_token, + ) + + return self.execute_task(initial_operation, auth_token) + + +class PikaffectsNode(PikaNodeBase): + """Pika Pikaffects Node.""" + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "image": ( + IO.IMAGE, + {"tooltip": "The reference image to apply the Pikaffect to."}, + ), + "pikaffect": model_field_to_node_input( + IO.COMBO, + PikaBodyGeneratePikaffectsGeneratePikaffectsPost, + "pikaffect", + enum_type=Pikaffect, + default="Cake-ify", + ), + "prompt_text": model_field_to_node_input( + IO.STRING, + PikaBodyGeneratePikaffectsGeneratePikaffectsPost, + "promptText", + multiline=True, + ), + "negative_prompt": model_field_to_node_input( + IO.STRING, + PikaBodyGeneratePikaffectsGeneratePikaffectsPost, + "negativePrompt", + multiline=True, + ), + "seed": model_field_to_node_input( + IO.INT, + PikaBodyGeneratePikaffectsGeneratePikaffectsPost, + "seed", + min=0, + max=0xFFFFFFFF, + control_after_generate=True, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + DESCRIPTION = "Generate a video with a specific Pikaffect. Supported Pikaffects: Cake-ify, Crumble, Crush, Decapitate, Deflate, Dissolve, Explode, Eye-pop, Inflate, Levitate, Melt, Peel, Poke, Squish, Ta-da, Tear" + + def api_call( + self, + image: torch.Tensor, + pikaffect: str, + prompt_text: str, + negative_prompt: str, + seed: int, + auth_token: Optional[str] = None, + ) -> tuple[VideoFromFile]: + + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_PIKAFFECTS, + method=HttpMethod.POST, + request_model=PikaBodyGeneratePikaffectsGeneratePikaffectsPost, + response_model=PikaGenerateResponse, + ), + request=PikaBodyGeneratePikaffectsGeneratePikaffectsPost( + pikaffect=pikaffect, + promptText=prompt_text, + negativePrompt=negative_prompt, + seed=seed, + ), + files={"image": ("image.png", tensor_to_bytesio(image), "image/png")}, + content_type="multipart/form-data", + auth_token=auth_token, + ) + + return self.execute_task(initial_operation, auth_token) + + +class PikaStartEndFrameNode2_2(PikaNodeBase): + """PikaFrames v2.2 Node.""" + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "image_start": (IO.IMAGE, {"tooltip": "The first image to combine."}), + "image_end": (IO.IMAGE, {"tooltip": "The last image to combine."}), + **cls.get_base_inputs_types( + PikaBodyGenerate22KeyframeGenerate22PikaframesPost + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + DESCRIPTION = "Generate a video by combining your first and last frame. Upload two images to define the start and end points, and let the AI create a smooth transition between them." + + def api_call( + self, + image_start: torch.Tensor, + image_end: torch.Tensor, + prompt_text: str, + negative_prompt: str, + seed: int, + resolution: str, + duration: int, + auth_token: Optional[str] = None, + ) -> tuple[VideoFromFile]: + + pika_files = [ + ( + "keyFrames", + ("image_start.png", tensor_to_bytesio(image_start), "image/png"), + ), + ("keyFrames", ("image_end.png", tensor_to_bytesio(image_end), "image/png")), + ] + + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_PIKAFRAMES, + method=HttpMethod.POST, + request_model=PikaBodyGenerate22KeyframeGenerate22PikaframesPost, + response_model=PikaGenerateResponse, + ), + request=PikaBodyGenerate22KeyframeGenerate22PikaframesPost( + promptText=prompt_text, + negativePrompt=negative_prompt, + seed=seed, + resolution=resolution, + duration=duration, + ), + files=pika_files, + content_type="multipart/form-data", + auth_token=auth_token, + ) + + return self.execute_task(initial_operation, auth_token) + + +NODE_CLASS_MAPPINGS = { + "PikaImageToVideoNode2_2": PikaImageToVideoV2_2, + "PikaTextToVideoNode2_2": PikaTextToVideoNodeV2_2, + "PikaScenesV2_2": PikaScenesV2_2, + "Pikadditions": PikAdditionsNode, + "Pikaswaps": PikaSwapsNode, + "Pikaffects": PikaffectsNode, + "PikaStartEndFrameNode2_2": PikaStartEndFrameNode2_2, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "PikaImageToVideoNode2_2": "Pika Image to Video", + "PikaTextToVideoNode2_2": "Pika Text to Video", + "PikaScenesV2_2": "Pika Scenes (Video Image Composition)", + "Pikadditions": "Pikadditions (Video Object Insertion)", + "Pikaswaps": "Pika Swaps (Video Object Replacement)", + "Pikaffects": "Pikaffects (Video Effects)", + "PikaStartEndFrameNode2_2": "Pika Start and End Frame to Video", +} diff --git a/comfy_api_nodes/nodes_pixverse.py b/comfy_api_nodes/nodes_pixverse.py new file mode 100644 index 000000000..dbb90c1dd --- /dev/null +++ b/comfy_api_nodes/nodes_pixverse.py @@ -0,0 +1,492 @@ +from inspect import cleandoc + +from comfy_api_nodes.apis.pixverse_api import ( + PixverseTextVideoRequest, + PixverseImageVideoRequest, + PixverseTransitionVideoRequest, + PixverseImageUploadResponse, + PixverseVideoResponse, + PixverseGenerationStatusResponse, + PixverseAspectRatio, + PixverseQuality, + PixverseDuration, + PixverseMotionMode, + PixverseStatus, + PixverseIO, + pixverse_templates, +) +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, + PollingOperation, + EmptyRequest, +) +from comfy_api_nodes.apinode_utils import ( + tensor_to_bytesio, + validate_string, +) +from comfy.comfy_types.node_typing import IO, ComfyNodeABC +from comfy_api.input_impl import VideoFromFile + +import torch +import requests +from io import BytesIO + + +def upload_image_to_pixverse(image: torch.Tensor, auth_token=None): + # first, upload image to Pixverse and get image id to use in actual generation call + files = { + "image": tensor_to_bytesio(image) + } + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/pixverse/image/upload", + method=HttpMethod.POST, + request_model=EmptyRequest, + response_model=PixverseImageUploadResponse, + ), + request=EmptyRequest(), + files=files, + content_type="multipart/form-data", + auth_token=auth_token, + ) + response_upload: PixverseImageUploadResponse = operation.execute() + + if response_upload.Resp is None: + raise Exception(f"PixVerse image upload request failed: '{response_upload.ErrMsg}'") + + return response_upload.Resp.img_id + + +class PixverseTemplateNode: + """ + Select template for PixVerse Video generation. + """ + + RETURN_TYPES = (PixverseIO.TEMPLATE,) + RETURN_NAMES = ("pixverse_template",) + FUNCTION = "create_template" + CATEGORY = "api node/video/PixVerse" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "template": (list(pixverse_templates.keys()), ), + } + } + + def create_template(self, template: str): + template_id = pixverse_templates.get(template, None) + if template_id is None: + raise Exception(f"Template '{template}' is not recognized.") + # just return the integer + return (template_id,) + + +class PixverseTextToVideoNode(ComfyNodeABC): + """ + Generates videos synchronously based on prompt and output_size. + """ + + RETURN_TYPES = (IO.VIDEO,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/video/PixVerse" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the video generation", + }, + ), + "aspect_ratio": ( + [ratio.value for ratio in PixverseAspectRatio], + ), + "quality": ( + [resolution.value for resolution in PixverseQuality], + { + "default": PixverseQuality.res_540p, + }, + ), + "duration_seconds": ([dur.value for dur in PixverseDuration],), + "motion_mode": ([mode.value for mode in PixverseMotionMode],), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 2147483647, + "control_after_generate": True, + "tooltip": "Seed for video generation.", + }, + ), + }, + "optional": { + "negative_prompt": ( + IO.STRING, + { + "default": "", + "forceInput": True, + "tooltip": "An optional text description of undesired elements on an image.", + }, + ), + "pixverse_template": ( + PixverseIO.TEMPLATE, + { + "tooltip": "An optional template to influence style of generation, created by the PixVerse Template node." + } + ) + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + prompt: str, + aspect_ratio: str, + quality: str, + duration_seconds: int, + motion_mode: str, + seed, + negative_prompt: str=None, + pixverse_template: int=None, + auth_token=None, + **kwargs, + ): + validate_string(prompt, strip_whitespace=False) + # 1080p is limited to 5 seconds duration + # only normal motion_mode supported for 1080p or for non-5 second duration + if quality == PixverseQuality.res_1080p: + motion_mode = PixverseMotionMode.normal + duration_seconds = PixverseDuration.dur_5 + elif duration_seconds != PixverseDuration.dur_5: + motion_mode = PixverseMotionMode.normal + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/pixverse/video/text/generate", + method=HttpMethod.POST, + request_model=PixverseTextVideoRequest, + response_model=PixverseVideoResponse, + ), + request=PixverseTextVideoRequest( + prompt=prompt, + aspect_ratio=aspect_ratio, + quality=quality, + duration=duration_seconds, + motion_mode=motion_mode, + negative_prompt=negative_prompt if negative_prompt else None, + template_id=pixverse_template, + seed=seed, + ), + auth_token=auth_token, + ) + response_api = operation.execute() + + if response_api.Resp is None: + raise Exception(f"PixVerse request failed: '{response_api.ErrMsg}'") + + operation = PollingOperation( + poll_endpoint=ApiEndpoint( + path=f"/proxy/pixverse/video/result/{response_api.Resp.video_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=PixverseGenerationStatusResponse, + ), + completed_statuses=[PixverseStatus.successful], + failed_statuses=[PixverseStatus.contents_moderation, PixverseStatus.failed, PixverseStatus.deleted], + status_extractor=lambda x: x.Resp.status, + auth_token=auth_token, + ) + response_poll = operation.execute() + + vid_response = requests.get(response_poll.Resp.url) + return (VideoFromFile(BytesIO(vid_response.content)),) + + +class PixverseImageToVideoNode(ComfyNodeABC): + """ + Generates videos synchronously based on prompt and output_size. + """ + + RETURN_TYPES = (IO.VIDEO,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/video/PixVerse" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": ( + IO.IMAGE, + ), + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the video generation", + }, + ), + "quality": ( + [resolution.value for resolution in PixverseQuality], + { + "default": PixverseQuality.res_540p, + }, + ), + "duration_seconds": ([dur.value for dur in PixverseDuration],), + "motion_mode": ([mode.value for mode in PixverseMotionMode],), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 2147483647, + "control_after_generate": True, + "tooltip": "Seed for video generation.", + }, + ), + }, + "optional": { + "negative_prompt": ( + IO.STRING, + { + "default": "", + "forceInput": True, + "tooltip": "An optional text description of undesired elements on an image.", + }, + ), + "pixverse_template": ( + PixverseIO.TEMPLATE, + { + "tooltip": "An optional template to influence style of generation, created by the PixVerse Template node." + } + ) + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + image: torch.Tensor, + prompt: str, + quality: str, + duration_seconds: int, + motion_mode: str, + seed, + negative_prompt: str=None, + pixverse_template: int=None, + auth_token=None, + **kwargs, + ): + validate_string(prompt, strip_whitespace=False) + img_id = upload_image_to_pixverse(image, auth_token=auth_token) + + # 1080p is limited to 5 seconds duration + # only normal motion_mode supported for 1080p or for non-5 second duration + if quality == PixverseQuality.res_1080p: + motion_mode = PixverseMotionMode.normal + duration_seconds = PixverseDuration.dur_5 + elif duration_seconds != PixverseDuration.dur_5: + motion_mode = PixverseMotionMode.normal + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/pixverse/video/img/generate", + method=HttpMethod.POST, + request_model=PixverseImageVideoRequest, + response_model=PixverseVideoResponse, + ), + request=PixverseImageVideoRequest( + img_id=img_id, + prompt=prompt, + quality=quality, + duration=duration_seconds, + motion_mode=motion_mode, + negative_prompt=negative_prompt if negative_prompt else None, + template_id=pixverse_template, + seed=seed, + ), + auth_token=auth_token, + ) + response_api = operation.execute() + + if response_api.Resp is None: + raise Exception(f"PixVerse request failed: '{response_api.ErrMsg}'") + + operation = PollingOperation( + poll_endpoint=ApiEndpoint( + path=f"/proxy/pixverse/video/result/{response_api.Resp.video_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=PixverseGenerationStatusResponse, + ), + completed_statuses=[PixverseStatus.successful], + failed_statuses=[PixverseStatus.contents_moderation, PixverseStatus.failed, PixverseStatus.deleted], + status_extractor=lambda x: x.Resp.status, + auth_token=auth_token, + ) + response_poll = operation.execute() + + vid_response = requests.get(response_poll.Resp.url) + return (VideoFromFile(BytesIO(vid_response.content)),) + + +class PixverseTransitionVideoNode(ComfyNodeABC): + """ + Generates videos synchronously based on prompt and output_size. + """ + + RETURN_TYPES = (IO.VIDEO,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/video/PixVerse" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "first_frame": ( + IO.IMAGE, + ), + "last_frame": ( + IO.IMAGE, + ), + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the video generation", + }, + ), + "quality": ( + [resolution.value for resolution in PixverseQuality], + { + "default": PixverseQuality.res_540p, + }, + ), + "duration_seconds": ([dur.value for dur in PixverseDuration],), + "motion_mode": ([mode.value for mode in PixverseMotionMode],), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 2147483647, + "control_after_generate": True, + "tooltip": "Seed for video generation.", + }, + ), + }, + "optional": { + "negative_prompt": ( + IO.STRING, + { + "default": "", + "forceInput": True, + "tooltip": "An optional text description of undesired elements on an image.", + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + first_frame: torch.Tensor, + last_frame: torch.Tensor, + prompt: str, + quality: str, + duration_seconds: int, + motion_mode: str, + seed, + negative_prompt: str=None, + auth_token=None, + **kwargs, + ): + validate_string(prompt, strip_whitespace=False) + first_frame_id = upload_image_to_pixverse(first_frame, auth_token=auth_token) + last_frame_id = upload_image_to_pixverse(last_frame, auth_token=auth_token) + + # 1080p is limited to 5 seconds duration + # only normal motion_mode supported for 1080p or for non-5 second duration + if quality == PixverseQuality.res_1080p: + motion_mode = PixverseMotionMode.normal + duration_seconds = PixverseDuration.dur_5 + elif duration_seconds != PixverseDuration.dur_5: + motion_mode = PixverseMotionMode.normal + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/pixverse/video/transition/generate", + method=HttpMethod.POST, + request_model=PixverseTransitionVideoRequest, + response_model=PixverseVideoResponse, + ), + request=PixverseTransitionVideoRequest( + first_frame_img=first_frame_id, + last_frame_img=last_frame_id, + prompt=prompt, + quality=quality, + duration=duration_seconds, + motion_mode=motion_mode, + negative_prompt=negative_prompt if negative_prompt else None, + seed=seed, + ), + auth_token=auth_token, + ) + response_api = operation.execute() + + if response_api.Resp is None: + raise Exception(f"PixVerse request failed: '{response_api.ErrMsg}'") + + operation = PollingOperation( + poll_endpoint=ApiEndpoint( + path=f"/proxy/pixverse/video/result/{response_api.Resp.video_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=PixverseGenerationStatusResponse, + ), + completed_statuses=[PixverseStatus.successful], + failed_statuses=[PixverseStatus.contents_moderation, PixverseStatus.failed, PixverseStatus.deleted], + status_extractor=lambda x: x.Resp.status, + auth_token=auth_token, + ) + response_poll = operation.execute() + + vid_response = requests.get(response_poll.Resp.url) + return (VideoFromFile(BytesIO(vid_response.content)),) + + +NODE_CLASS_MAPPINGS = { + "PixverseTextToVideoNode": PixverseTextToVideoNode, + "PixverseImageToVideoNode": PixverseImageToVideoNode, + "PixverseTransitionVideoNode": PixverseTransitionVideoNode, + "PixverseTemplateNode": PixverseTemplateNode, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "PixverseTextToVideoNode": "PixVerse Text to Video", + "PixverseImageToVideoNode": "PixVerse Image to Video", + "PixverseTransitionVideoNode": "PixVerse Transition Video", + "PixverseTemplateNode": "PixVerse Template", +} diff --git a/comfy_api_nodes/nodes_recraft.py b/comfy_api_nodes/nodes_recraft.py new file mode 100644 index 000000000..994f377d1 --- /dev/null +++ b/comfy_api_nodes/nodes_recraft.py @@ -0,0 +1,1217 @@ +from __future__ import annotations +from inspect import cleandoc +from comfy.utils import ProgressBar +from comfy.comfy_types.node_typing import IO +from comfy_api_nodes.apis.recraft_api import ( + RecraftImageGenerationRequest, + RecraftImageGenerationResponse, + RecraftImageSize, + RecraftModel, + RecraftStyle, + RecraftStyleV3, + RecraftColor, + RecraftColorChain, + RecraftControls, + RecraftIO, + get_v3_substyles, +) +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, + EmptyRequest, +) +from comfy_api_nodes.apinode_utils import ( + bytesio_to_image_tensor, + download_url_to_bytesio, + tensor_to_bytesio, + resize_mask_to_image, + validate_string, +) +import folder_paths +import json +import os +import torch +from io import BytesIO +from PIL import UnidentifiedImageError + + +def handle_recraft_file_request( + image: torch.Tensor, + path: str, + mask: torch.Tensor=None, + total_pixels=4096*4096, + timeout=1024, + request=None, + auth_token=None + ) -> list[BytesIO]: + """ + Handle sending common Recraft file-only request to get back file bytes. + """ + if request is None: + request = EmptyRequest() + + files = { + 'image': tensor_to_bytesio(image, total_pixels=total_pixels).read() + } + if mask is not None: + files['mask'] = tensor_to_bytesio(mask, total_pixels=total_pixels).read() + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=path, + method=HttpMethod.POST, + request_model=type(request), + response_model=RecraftImageGenerationResponse, + ), + request=request, + files=files, + content_type="multipart/form-data", + auth_token=auth_token, + multipart_parser=recraft_multipart_parser, + ) + response: RecraftImageGenerationResponse = operation.execute() + all_bytesio = [] + if response.image is not None: + all_bytesio.append(download_url_to_bytesio(response.image.url, timeout=timeout)) + else: + for data in response.data: + all_bytesio.append(download_url_to_bytesio(data.url, timeout=timeout)) + + return all_bytesio + + +def recraft_multipart_parser(data, parent_key=None, formatter: callable=None, converted_to_check: list[list]=None, is_list=False) -> dict: + """ + Formats data such that multipart/form-data will work with requests library + when both files and data are present. + + The OpenAI client that Recraft uses has a bizarre way of serializing lists: + + It does NOT keep track of indeces of each list, so for background_color, that must be serialized as: + 'background_color[rgb][]' = [0, 0, 255] + where the array is assigned to a key that has '[]' at the end, to signal it's an array. + + This has the consequence of nested lists having the exact same key, forcing arrays to merge; all colors inputs fall under the same key: + if 1 color -> 'controls[colors][][rgb][]' = [0, 0, 255] + if 2 colors -> 'controls[colors][][rgb][]' = [0, 0, 255, 255, 0, 0] + if 3 colors -> 'controls[colors][][rgb][]' = [0, 0, 255, 255, 0, 0, 0, 255, 0] + etc. + Whoever made this serialization up at OpenAI added the constraint that lists must be of uniform length on objects of same 'type'. + """ + # Modification of a function that handled a different type of multipart parsing, big ups: + # https://gist.github.com/kazqvaizer/4cebebe5db654a414132809f9f88067b + + def handle_converted_lists(data, parent_key, lists_to_check=tuple[list]): + # if list already exists exists, just extend list with data + for check_list in lists_to_check: + for conv_tuple in check_list: + if conv_tuple[0] == parent_key and type(conv_tuple[1]) is list: + conv_tuple[1].append(formatter(data)) + return True + return False + + if converted_to_check is None: + converted_to_check = [] + + + if formatter is None: + formatter = lambda v: v # Multipart representation of value + + if type(data) is not dict: + # if list already exists exists, just extend list with data + added = handle_converted_lists(data, parent_key, converted_to_check) + if added: + return {} + # otherwise if is_list, create new list with data + if is_list: + return {parent_key: [formatter(data)]} + # return new key with data + return {parent_key: formatter(data)} + + converted = [] + next_check = [converted] + next_check.extend(converted_to_check) + + for key, value in data.items(): + current_key = key if parent_key is None else f"{parent_key}[{key}]" + if type(value) is dict: + converted.extend(recraft_multipart_parser(value, current_key, formatter, next_check).items()) + elif type(value) is list: + for ind, list_value in enumerate(value): + iter_key = f"{current_key}[]" + converted.extend(recraft_multipart_parser(list_value, iter_key, formatter, next_check, is_list=True).items()) + else: + converted.append((current_key, formatter(value))) + + return dict(converted) + + +class handle_recraft_image_output: + """ + Catch an exception related to receiving SVG data instead of image, when Infinite Style Library style_id is in use. + """ + def __init__(self): + pass + + def __enter__(self): + pass + + def __exit__(self, exc_type, exc_val, exc_tb): + if exc_type is not None and exc_type is UnidentifiedImageError: + raise Exception("Received output data was not an image; likely an SVG. If you used style_id, make sure it is not a Vector art style.") + + +class SVG: + """ + Stores SVG representations via a list of BytesIO objects. + """ + def __init__(self, data: list[BytesIO]): + self.data = data + + def combine(self, other: SVG): + return SVG(self.data + other.data) + + @staticmethod + def combine_all(svgs: list[SVG]): + all_svgs = [] + for svg in svgs: + all_svgs.extend(svg.data) + return SVG(all_svgs) + + +class SaveSVGNode: + """ + Save SVG files on disk. + """ + + def __init__(self): + self.output_dir = folder_paths.get_output_directory() + self.type = "output" + self.prefix_append = "" + + RETURN_TYPES = () + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "save_svg" + CATEGORY = "api node/image/Recraft" + OUTPUT_NODE = True + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "svg": (RecraftIO.SVG,), + "filename_prefix": ("STRING", {"default": "svg/ComfyUI", "tooltip": "The prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Image.width% to include values from nodes."}) + }, + "hidden": { + "prompt": "PROMPT", + "extra_pnginfo": "EXTRA_PNGINFO" + } + } + + def save_svg(self, svg: SVG, filename_prefix="svg/ComfyUI", prompt=None, extra_pnginfo=None): + filename_prefix += self.prefix_append + full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir) + results = list() + + # Prepare metadata JSON + metadata_dict = {} + if prompt is not None: + metadata_dict["prompt"] = prompt + if extra_pnginfo is not None: + metadata_dict.update(extra_pnginfo) + + # Convert metadata to JSON string + metadata_json = json.dumps(metadata_dict, indent=2) if metadata_dict else None + + for batch_number, svg_bytes in enumerate(svg.data): + filename_with_batch_num = filename.replace("%batch_num%", str(batch_number)) + file = f"{filename_with_batch_num}_{counter:05}_.svg" + + # Read SVG content + svg_bytes.seek(0) + svg_content = svg_bytes.read().decode('utf-8') + + # Inject metadata if available + if metadata_json: + # Create metadata element with CDATA section + metadata_element = f""" + + +""" + # Insert metadata after opening svg tag using regex + import re + svg_content = re.sub(r'(]*>)', r'\1\n' + metadata_element, svg_content) + + # Write the modified SVG to file + with open(os.path.join(full_output_folder, file), 'wb') as svg_file: + svg_file.write(svg_content.encode('utf-8')) + + results.append({ + "filename": file, + "subfolder": subfolder, + "type": self.type + }) + counter += 1 + return { "ui": { "images": results } } + + +class RecraftColorRGBNode: + """ + Create Recraft Color by choosing specific RGB values. + """ + + RETURN_TYPES = (RecraftIO.COLOR,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + RETURN_NAMES = ("recraft_color",) + FUNCTION = "create_color" + CATEGORY = "api node/image/Recraft" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "r": (IO.INT, { + "default": 0, + "min": 0, + "max": 255, + "tooltip": "Red value of color." + }), + "g": (IO.INT, { + "default": 0, + "min": 0, + "max": 255, + "tooltip": "Green value of color." + }), + "b": (IO.INT, { + "default": 0, + "min": 0, + "max": 255, + "tooltip": "Blue value of color." + }), + }, + "optional": { + "recraft_color": (RecraftIO.COLOR,), + } + } + + def create_color(self, r: int, g: int, b: int, recraft_color: RecraftColorChain=None): + recraft_color = recraft_color.clone() if recraft_color else RecraftColorChain() + recraft_color.add(RecraftColor(r, g, b)) + return (recraft_color, ) + + +class RecraftControlsNode: + """ + Create Recraft Controls for customizing Recraft generation. + """ + + RETURN_TYPES = (RecraftIO.CONTROLS,) + RETURN_NAMES = ("recraft_controls",) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "create_controls" + CATEGORY = "api node/image/Recraft" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + }, + "optional": { + "colors": (RecraftIO.COLOR,), + "background_color": (RecraftIO.COLOR,), + } + } + + def create_controls(self, colors: RecraftColorChain=None, background_color: RecraftColorChain=None): + return (RecraftControls(colors=colors, background_color=background_color), ) + + +class RecraftStyleV3RealisticImageNode: + """ + Select realistic_image style and optional substyle. + """ + + RETURN_TYPES = (RecraftIO.STYLEV3,) + RETURN_NAMES = ("recraft_style",) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "create_style" + CATEGORY = "api node/image/Recraft" + + RECRAFT_STYLE = RecraftStyleV3.realistic_image + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "substyle": (get_v3_substyles(s.RECRAFT_STYLE),), + } + } + + def create_style(self, substyle: str): + if substyle == "None": + substyle = None + return (RecraftStyle(self.RECRAFT_STYLE, substyle),) + + +class RecraftStyleV3DigitalIllustrationNode(RecraftStyleV3RealisticImageNode): + """ + Select digital_illustration style and optional substyle. + """ + + RECRAFT_STYLE = RecraftStyleV3.digital_illustration + + +class RecraftStyleV3VectorIllustrationNode(RecraftStyleV3RealisticImageNode): + """ + Select vector_illustration style and optional substyle. + """ + + RECRAFT_STYLE = RecraftStyleV3.vector_illustration + + +class RecraftStyleV3LogoRasterNode(RecraftStyleV3RealisticImageNode): + """ + Select vector_illustration style and optional substyle. + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "substyle": (get_v3_substyles(s.RECRAFT_STYLE, include_none=False),), + } + } + + RECRAFT_STYLE = RecraftStyleV3.logo_raster + + +class RecraftStyleInfiniteStyleLibrary: + """ + Select style based on preexisting UUID from Recraft's Infinite Style Library. + """ + + RETURN_TYPES = (RecraftIO.STYLEV3,) + RETURN_NAMES = ("recraft_style",) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "create_style" + CATEGORY = "api node/image/Recraft" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "style_id": (IO.STRING, { + "default": "", + "tooltip": "UUID of style from Infinite Style Library.", + }) + } + } + + def create_style(self, style_id: str): + if not style_id: + raise Exception("The style_id input cannot be empty.") + return (RecraftStyle(style_id=style_id),) + + +class RecraftTextToImageNode: + """ + Generates images synchronously based on prompt and resolution. + """ + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Recraft" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation.", + }, + ), + "size": ( + [res.value for res in RecraftImageSize], + { + "default": RecraftImageSize.res_1024x1024, + "tooltip": "The size of the generated image.", + }, + ), + "n": ( + IO.INT, + { + "default": 1, + "min": 1, + "max": 6, + "tooltip": "The number of images to generate.", + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "Seed to determine if node should re-run; actual results are nondeterministic regardless of seed.", + }, + ), + }, + "optional": { + "recraft_style": (RecraftIO.STYLEV3,), + "negative_prompt": ( + IO.STRING, + { + "default": "", + "forceInput": True, + "tooltip": "An optional text description of undesired elements on an image.", + }, + ), + "recraft_controls": ( + RecraftIO.CONTROLS, + { + "tooltip": "Optional additional controls over the generation via the Recraft Controls node." + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + prompt: str, + size: str, + n: int, + seed, + recraft_style: RecraftStyle = None, + negative_prompt: str = None, + recraft_controls: RecraftControls = None, + auth_token=None, + **kwargs, + ): + validate_string(prompt, strip_whitespace=False, max_length=1000) + default_style = RecraftStyle(RecraftStyleV3.realistic_image) + if recraft_style is None: + recraft_style = default_style + + controls_api = None + if recraft_controls: + controls_api = recraft_controls.create_api_model() + + if not negative_prompt: + negative_prompt = None + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/recraft/image_generation", + method=HttpMethod.POST, + request_model=RecraftImageGenerationRequest, + response_model=RecraftImageGenerationResponse, + ), + request=RecraftImageGenerationRequest( + prompt=prompt, + negative_prompt=negative_prompt, + model=RecraftModel.recraftv3, + size=size, + n=n, + style=recraft_style.style, + substyle=recraft_style.substyle, + style_id=recraft_style.style_id, + controls=controls_api, + ), + auth_token=auth_token, + ) + response: RecraftImageGenerationResponse = operation.execute() + images = [] + for data in response.data: + with handle_recraft_image_output(): + image = bytesio_to_image_tensor( + download_url_to_bytesio(data.url, timeout=1024) + ) + if len(image.shape) < 4: + image = image.unsqueeze(0) + images.append(image) + output_image = torch.cat(images, dim=0) + + return (output_image,) + + +class RecraftImageToImageNode: + """ + Modify image based on prompt and strength. + """ + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Recraft" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": (IO.IMAGE, ), + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation.", + }, + ), + "n": ( + IO.INT, + { + "default": 1, + "min": 1, + "max": 6, + "tooltip": "The number of images to generate.", + }, + ), + "strength": ( + IO.FLOAT, + { + "default": 0.5, + "min": 0.0, + "max": 1.0, + "step": 0.01, + "tooltip": "Defines the difference with the original image, should lie in [0, 1], where 0 means almost identical, and 1 means miserable similarity." + } + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "Seed to determine if node should re-run; actual results are nondeterministic regardless of seed.", + }, + ), + }, + "optional": { + "recraft_style": (RecraftIO.STYLEV3,), + "negative_prompt": ( + IO.STRING, + { + "default": "", + "forceInput": True, + "tooltip": "An optional text description of undesired elements on an image.", + }, + ), + "recraft_controls": ( + RecraftIO.CONTROLS, + { + "tooltip": "Optional additional controls over the generation via the Recraft Controls node." + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + image: torch.Tensor, + prompt: str, + n: int, + strength: float, + seed, + auth_token=None, + recraft_style: RecraftStyle = None, + negative_prompt: str = None, + recraft_controls: RecraftControls = None, + **kwargs, + ): + validate_string(prompt, strip_whitespace=False, max_length=1000) + default_style = RecraftStyle(RecraftStyleV3.realistic_image) + if recraft_style is None: + recraft_style = default_style + + controls_api = None + if recraft_controls: + controls_api = recraft_controls.create_api_model() + + if not negative_prompt: + negative_prompt = None + + request = RecraftImageGenerationRequest( + prompt=prompt, + negative_prompt=negative_prompt, + model=RecraftModel.recraftv3, + n=n, + strength=round(strength, 2), + style=recraft_style.style, + substyle=recraft_style.substyle, + style_id=recraft_style.style_id, + controls=controls_api, + ) + + images = [] + total = image.shape[0] + pbar = ProgressBar(total) + for i in range(total): + sub_bytes = handle_recraft_file_request( + image=image[i], + path="/proxy/recraft/images/imageToImage", + request=request, + auth_token=auth_token, + ) + with handle_recraft_image_output(): + images.append(torch.cat([bytesio_to_image_tensor(x) for x in sub_bytes], dim=0)) + pbar.update(1) + + images_tensor = torch.cat(images, dim=0) + return (images_tensor, ) + + +class RecraftImageInpaintingNode: + """ + Modify image based on prompt and mask. + """ + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Recraft" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": (IO.IMAGE, ), + "mask": (IO.MASK, ), + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation.", + }, + ), + "n": ( + IO.INT, + { + "default": 1, + "min": 1, + "max": 6, + "tooltip": "The number of images to generate.", + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "Seed to determine if node should re-run; actual results are nondeterministic regardless of seed.", + }, + ), + }, + "optional": { + "recraft_style": (RecraftIO.STYLEV3,), + "negative_prompt": ( + IO.STRING, + { + "default": "", + "forceInput": True, + "tooltip": "An optional text description of undesired elements on an image.", + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + image: torch.Tensor, + mask: torch.Tensor, + prompt: str, + n: int, + seed, + auth_token=None, + recraft_style: RecraftStyle = None, + negative_prompt: str = None, + **kwargs, + ): + validate_string(prompt, strip_whitespace=False, max_length=1000) + default_style = RecraftStyle(RecraftStyleV3.realistic_image) + if recraft_style is None: + recraft_style = default_style + + if not negative_prompt: + negative_prompt = None + + request = RecraftImageGenerationRequest( + prompt=prompt, + negative_prompt=negative_prompt, + model=RecraftModel.recraftv3, + n=n, + style=recraft_style.style, + substyle=recraft_style.substyle, + style_id=recraft_style.style_id, + ) + + # prepare mask tensor + mask = resize_mask_to_image(mask, image, allow_gradient=False, add_channel_dim=True) + + images = [] + total = image.shape[0] + pbar = ProgressBar(total) + for i in range(total): + sub_bytes = handle_recraft_file_request( + image=image[i], + mask=mask[i:i+1], + path="/proxy/recraft/images/inpaint", + request=request, + auth_token=auth_token, + ) + with handle_recraft_image_output(): + images.append(torch.cat([bytesio_to_image_tensor(x) for x in sub_bytes], dim=0)) + pbar.update(1) + + images_tensor = torch.cat(images, dim=0) + return (images_tensor, ) + + +class RecraftTextToVectorNode: + """ + Generates SVG synchronously based on prompt and resolution. + """ + + RETURN_TYPES = (RecraftIO.SVG,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Recraft" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation.", + }, + ), + "substyle": (get_v3_substyles(RecraftStyleV3.vector_illustration),), + "size": ( + [res.value for res in RecraftImageSize], + { + "default": RecraftImageSize.res_1024x1024, + "tooltip": "The size of the generated image.", + }, + ), + "n": ( + IO.INT, + { + "default": 1, + "min": 1, + "max": 6, + "tooltip": "The number of images to generate.", + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "Seed to determine if node should re-run; actual results are nondeterministic regardless of seed.", + }, + ), + }, + "optional": { + "negative_prompt": ( + IO.STRING, + { + "default": "", + "forceInput": True, + "tooltip": "An optional text description of undesired elements on an image.", + }, + ), + "recraft_controls": ( + RecraftIO.CONTROLS, + { + "tooltip": "Optional additional controls over the generation via the Recraft Controls node." + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + prompt: str, + substyle: str, + size: str, + n: int, + seed, + negative_prompt: str = None, + recraft_controls: RecraftControls = None, + auth_token=None, + **kwargs, + ): + validate_string(prompt, strip_whitespace=False, max_length=1000) + # create RecraftStyle so strings will be formatted properly (i.e. "None" will become None) + recraft_style = RecraftStyle(RecraftStyleV3.vector_illustration, substyle=substyle) + + controls_api = None + if recraft_controls: + controls_api = recraft_controls.create_api_model() + + if not negative_prompt: + negative_prompt = None + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/recraft/image_generation", + method=HttpMethod.POST, + request_model=RecraftImageGenerationRequest, + response_model=RecraftImageGenerationResponse, + ), + request=RecraftImageGenerationRequest( + prompt=prompt, + negative_prompt=negative_prompt, + model=RecraftModel.recraftv3, + size=size, + n=n, + style=recraft_style.style, + substyle=recraft_style.substyle, + controls=controls_api, + ), + auth_token=auth_token, + ) + response: RecraftImageGenerationResponse = operation.execute() + svg_data = [] + for data in response.data: + svg_data.append(download_url_to_bytesio(data.url, timeout=1024)) + + return (SVG(svg_data),) + + +class RecraftVectorizeImageNode: + """ + Generates SVG synchronously from an input image. + """ + + RETURN_TYPES = (RecraftIO.SVG,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Recraft" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": (IO.IMAGE, ), + }, + "optional": { + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + image: torch.Tensor, + auth_token=None, + **kwargs, + ): + svgs = [] + total = image.shape[0] + pbar = ProgressBar(total) + for i in range(total): + sub_bytes = handle_recraft_file_request( + image=image[i], + path="/proxy/recraft/images/vectorize", + auth_token=auth_token, + ) + svgs.append(SVG(sub_bytes)) + pbar.update(1) + + return (SVG.combine_all(svgs), ) + + +class RecraftReplaceBackgroundNode: + """ + Replace background on image, based on provided prompt. + """ + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Recraft" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": (IO.IMAGE, ), + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Prompt for the image generation.", + }, + ), + "n": ( + IO.INT, + { + "default": 1, + "min": 1, + "max": 6, + "tooltip": "The number of images to generate.", + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "Seed to determine if node should re-run; actual results are nondeterministic regardless of seed.", + }, + ), + }, + "optional": { + "recraft_style": (RecraftIO.STYLEV3,), + "negative_prompt": ( + IO.STRING, + { + "default": "", + "forceInput": True, + "tooltip": "An optional text description of undesired elements on an image.", + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + image: torch.Tensor, + prompt: str, + n: int, + seed, + auth_token=None, + recraft_style: RecraftStyle = None, + negative_prompt: str = None, + **kwargs, + ): + default_style = RecraftStyle(RecraftStyleV3.realistic_image) + if recraft_style is None: + recraft_style = default_style + + if not negative_prompt: + negative_prompt = None + + request = RecraftImageGenerationRequest( + prompt=prompt, + negative_prompt=negative_prompt, + model=RecraftModel.recraftv3, + n=n, + style=recraft_style.style, + substyle=recraft_style.substyle, + style_id=recraft_style.style_id, + ) + + images = [] + total = image.shape[0] + pbar = ProgressBar(total) + for i in range(total): + sub_bytes = handle_recraft_file_request( + image=image[i], + path="/proxy/recraft/images/replaceBackground", + request=request, + auth_token=auth_token, + ) + images.append(torch.cat([bytesio_to_image_tensor(x) for x in sub_bytes], dim=0)) + pbar.update(1) + + images_tensor = torch.cat(images, dim=0) + return (images_tensor, ) + + +class RecraftRemoveBackgroundNode: + """ + Remove background from image, and return processed image and mask. + """ + + RETURN_TYPES = (IO.IMAGE, IO.MASK) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Recraft" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": (IO.IMAGE, ), + }, + "optional": { + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + image: torch.Tensor, + auth_token=None, + **kwargs, + ): + images = [] + total = image.shape[0] + pbar = ProgressBar(total) + for i in range(total): + sub_bytes = handle_recraft_file_request( + image=image[i], + path="/proxy/recraft/images/removeBackground", + auth_token=auth_token, + ) + images.append(torch.cat([bytesio_to_image_tensor(x) for x in sub_bytes], dim=0)) + pbar.update(1) + + images_tensor = torch.cat(images, dim=0) + # use alpha channel as masks, in B,H,W format + masks_tensor = images_tensor[:,:,:,-1:].squeeze(-1) + return (images_tensor, masks_tensor) + + +class RecraftCrispUpscaleNode: + """ + Upscale image synchronously. + Enhances a given raster image using ‘crisp upscale’ tool, increasing image resolution, making the image sharper and cleaner. + """ + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Recraft" + + RECRAFT_PATH = "/proxy/recraft/images/crispUpscale" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": (IO.IMAGE, ), + }, + "optional": { + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call( + self, + image: torch.Tensor, + auth_token=None, + **kwargs, + ): + images = [] + total = image.shape[0] + pbar = ProgressBar(total) + for i in range(total): + sub_bytes = handle_recraft_file_request( + image=image[i], + path=self.RECRAFT_PATH, + auth_token=auth_token, + ) + images.append(torch.cat([bytesio_to_image_tensor(x) for x in sub_bytes], dim=0)) + pbar.update(1) + + images_tensor = torch.cat(images, dim=0) + return (images_tensor,) + + +class RecraftCreativeUpscaleNode(RecraftCrispUpscaleNode): + """ + Upscale image synchronously. + Enhances a given raster image using ‘creative upscale’ tool, boosting resolution with a focus on refining small details and faces. + """ + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Recraft" + + RECRAFT_PATH = "/proxy/recraft/images/creativeUpscale" + + +# A dictionary that contains all nodes you want to export with their names +# NOTE: names should be globally unique +NODE_CLASS_MAPPINGS = { + "RecraftTextToImageNode": RecraftTextToImageNode, + "RecraftImageToImageNode": RecraftImageToImageNode, + "RecraftImageInpaintingNode": RecraftImageInpaintingNode, + "RecraftTextToVectorNode": RecraftTextToVectorNode, + "RecraftVectorizeImageNode": RecraftVectorizeImageNode, + "RecraftRemoveBackgroundNode": RecraftRemoveBackgroundNode, + "RecraftReplaceBackgroundNode": RecraftReplaceBackgroundNode, + "RecraftCrispUpscaleNode": RecraftCrispUpscaleNode, + "RecraftCreativeUpscaleNode": RecraftCreativeUpscaleNode, + "RecraftStyleV3RealisticImage": RecraftStyleV3RealisticImageNode, + "RecraftStyleV3DigitalIllustration": RecraftStyleV3DigitalIllustrationNode, + "RecraftStyleV3LogoRaster": RecraftStyleV3LogoRasterNode, + "RecraftStyleV3InfiniteStyleLibrary": RecraftStyleInfiniteStyleLibrary, + "RecraftColorRGB": RecraftColorRGBNode, + "RecraftControls": RecraftControlsNode, + "SaveSVG": SaveSVGNode, +} + +# A dictionary that contains the friendly/humanly readable titles for the nodes +NODE_DISPLAY_NAME_MAPPINGS = { + "RecraftTextToImageNode": "Recraft Text to Image", + "RecraftImageToImageNode": "Recraft Image to Image", + "RecraftImageInpaintingNode": "Recraft Image Inpainting", + "RecraftTextToVectorNode": "Recraft Text to Vector", + "RecraftVectorizeImageNode": "Recraft Vectorize Image", + "RecraftRemoveBackgroundNode": "Recraft Remove Background", + "RecraftReplaceBackgroundNode": "Recraft Replace Background", + "RecraftCrispUpscaleNode": "Recraft Crisp Upscale Image", + "RecraftCreativeUpscaleNode": "Recraft Creative Upscale Image", + "RecraftStyleV3RealisticImage": "Recraft Style - Realistic Image", + "RecraftStyleV3DigitalIllustration": "Recraft Style - Digital Illustration", + "RecraftStyleV3LogoRaster": "Recraft Style - Logo Raster", + "RecraftStyleV3InfiniteStyleLibrary": "Recraft Style - Infinite Style Library", + "RecraftColorRGB": "Recraft Color RGB", + "RecraftControls": "Recraft Controls", + "SaveSVG": "Save SVG", +} diff --git a/comfy_api_nodes/nodes_stability.py b/comfy_api_nodes/nodes_stability.py new file mode 100644 index 000000000..52fe2417c --- /dev/null +++ b/comfy_api_nodes/nodes_stability.py @@ -0,0 +1,609 @@ +from inspect import cleandoc +from comfy.comfy_types.node_typing import IO +from comfy_api_nodes.apis.stability_api import ( + StabilityUpscaleConservativeRequest, + StabilityUpscaleCreativeRequest, + StabilityAsyncResponse, + StabilityResultsGetResponse, + StabilityStable3_5Request, + StabilityStableUltraRequest, + StabilityStableUltraResponse, + StabilityAspectRatio, + Stability_SD3_5_Model, + Stability_SD3_5_GenerationMode, + get_stability_style_presets, +) +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, + PollingOperation, + EmptyRequest, +) +from comfy_api_nodes.apinode_utils import ( + bytesio_to_image_tensor, + tensor_to_bytesio, + validate_string, +) + +import torch +import base64 +from io import BytesIO +from enum import Enum + + +class StabilityPollStatus(str, Enum): + finished = "finished" + in_progress = "in_progress" + failed = "failed" + + +def get_async_dummy_status(x: StabilityResultsGetResponse): + if x.name is not None or x.errors is not None: + return StabilityPollStatus.failed + elif x.finish_reason is not None: + return StabilityPollStatus.finished + return StabilityPollStatus.in_progress + + +class StabilityStableImageUltraNode: + """ + Generates images synchronously based on prompt and resolution. + """ + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Stability AI" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "What you wish to see in the output image. A strong, descriptive prompt that clearly defines" + + "What you wish to see in the output image. A strong, descriptive prompt that clearly defines" + + "elements, colors, and subjects will lead to better results. " + + "To control the weight of a given word use the format `(word:weight)`," + + "where `word` is the word you'd like to control the weight of and `weight`" + + "is a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)`" + + "would convey a sky that was blue and green, but more green than blue." + }, + ), + "aspect_ratio": ([x.value for x in StabilityAspectRatio], + { + "default": StabilityAspectRatio.ratio_1_1, + "tooltip": "Aspect ratio of generated image.", + }, + ), + "style_preset": (get_stability_style_presets(), + { + "tooltip": "Optional desired style of generated image.", + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 4294967294, + "control_after_generate": True, + "tooltip": "The random seed used for creating the noise.", + }, + ), + }, + "optional": { + "image": (IO.IMAGE,), + "negative_prompt": ( + IO.STRING, + { + "default": "", + "forceInput": True, + "tooltip": "A blurb of text describing what you do not wish to see in the output image. This is an advanced feature." + }, + ), + "image_denoise": ( + IO.FLOAT, + { + "default": 0.5, + "min": 0.0, + "max": 1.0, + "step": 0.01, + "tooltip": "Denoise of input image; 0.0 yields image identical to input, 1.0 is as if no image was provided at all.", + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call(self, prompt: str, aspect_ratio: str, style_preset: str, seed: int, + negative_prompt: str=None, image: torch.Tensor = None, image_denoise: float=None, + auth_token=None): + validate_string(prompt, strip_whitespace=False) + # prepare image binary if image present + image_binary = None + if image is not None: + image_binary = tensor_to_bytesio(image, total_pixels=1504*1504).read() + else: + image_denoise = None + + if not negative_prompt: + negative_prompt = None + if style_preset == "None": + style_preset = None + + files = { + "image": image_binary + } + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/stability/v2beta/stable-image/generate/ultra", + method=HttpMethod.POST, + request_model=StabilityStableUltraRequest, + response_model=StabilityStableUltraResponse, + ), + request=StabilityStableUltraRequest( + prompt=prompt, + negative_prompt=negative_prompt, + aspect_ratio=aspect_ratio, + seed=seed, + strength=image_denoise, + style_preset=style_preset, + ), + files=files, + content_type="multipart/form-data", + auth_token=auth_token, + ) + response_api = operation.execute() + + if response_api.finish_reason != "SUCCESS": + raise Exception(f"Stable Image Ultra generation failed: {response_api.finish_reason}.") + + image_data = base64.b64decode(response_api.image) + returned_image = bytesio_to_image_tensor(BytesIO(image_data)) + + return (returned_image,) + + +class StabilityStableImageSD_3_5Node: + """ + Generates images synchronously based on prompt and resolution. + """ + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Stability AI" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "What you wish to see in the output image. A strong, descriptive prompt that clearly defines elements, colors, and subjects will lead to better results." + }, + ), + "model": ([x.value for x in Stability_SD3_5_Model],), + "aspect_ratio": ([x.value for x in StabilityAspectRatio], + { + "default": StabilityAspectRatio.ratio_1_1, + "tooltip": "Aspect ratio of generated image.", + }, + ), + "style_preset": (get_stability_style_presets(), + { + "tooltip": "Optional desired style of generated image.", + }, + ), + "cfg_scale": ( + IO.FLOAT, + { + "default": 4.0, + "min": 1.0, + "max": 10.0, + "step": 0.1, + "tooltip": "How strictly the diffusion process adheres to the prompt text (higher values keep your image closer to your prompt)", + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 4294967294, + "control_after_generate": True, + "tooltip": "The random seed used for creating the noise.", + }, + ), + }, + "optional": { + "image": (IO.IMAGE,), + "negative_prompt": ( + IO.STRING, + { + "default": "", + "forceInput": True, + "tooltip": "Keywords of what you do not wish to see in the output image. This is an advanced feature." + }, + ), + "image_denoise": ( + IO.FLOAT, + { + "default": 0.5, + "min": 0.0, + "max": 1.0, + "step": 0.01, + "tooltip": "Denoise of input image; 0.0 yields image identical to input, 1.0 is as if no image was provided at all.", + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call(self, model: str, prompt: str, aspect_ratio: str, style_preset: str, seed: int, cfg_scale: float, + negative_prompt: str=None, image: torch.Tensor = None, image_denoise: float=None, + auth_token=None): + validate_string(prompt, strip_whitespace=False) + # prepare image binary if image present + image_binary = None + mode = Stability_SD3_5_GenerationMode.text_to_image + if image is not None: + image_binary = tensor_to_bytesio(image, total_pixels=1504*1504).read() + mode = Stability_SD3_5_GenerationMode.image_to_image + aspect_ratio = None + else: + image_denoise = None + + if not negative_prompt: + negative_prompt = None + if style_preset == "None": + style_preset = None + + files = { + "image": image_binary + } + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/stability/v2beta/stable-image/generate/sd3", + method=HttpMethod.POST, + request_model=StabilityStable3_5Request, + response_model=StabilityStableUltraResponse, + ), + request=StabilityStable3_5Request( + prompt=prompt, + negative_prompt=negative_prompt, + aspect_ratio=aspect_ratio, + seed=seed, + strength=image_denoise, + style_preset=style_preset, + cfg_scale=cfg_scale, + model=model, + mode=mode, + ), + files=files, + content_type="multipart/form-data", + auth_token=auth_token, + ) + response_api = operation.execute() + + if response_api.finish_reason != "SUCCESS": + raise Exception(f"Stable Diffusion 3.5 Image generation failed: {response_api.finish_reason}.") + + image_data = base64.b64decode(response_api.image) + returned_image = bytesio_to_image_tensor(BytesIO(image_data)) + + return (returned_image,) + + +class StabilityUpscaleConservativeNode: + """ + Upscale image with minimal alterations to 4K resolution. + """ + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Stability AI" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": (IO.IMAGE,), + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "What you wish to see in the output image. A strong, descriptive prompt that clearly defines elements, colors, and subjects will lead to better results." + }, + ), + "creativity": ( + IO.FLOAT, + { + "default": 0.35, + "min": 0.2, + "max": 0.5, + "step": 0.01, + "tooltip": "Controls the likelihood of creating additional details not heavily conditioned by the init image.", + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 4294967294, + "control_after_generate": True, + "tooltip": "The random seed used for creating the noise.", + }, + ), + }, + "optional": { + "negative_prompt": ( + IO.STRING, + { + "default": "", + "forceInput": True, + "tooltip": "Keywords of what you do not wish to see in the output image. This is an advanced feature." + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call(self, image: torch.Tensor, prompt: str, creativity: float, seed: int, negative_prompt: str=None, + auth_token=None): + validate_string(prompt, strip_whitespace=False) + image_binary = tensor_to_bytesio(image, total_pixels=1024*1024).read() + + if not negative_prompt: + negative_prompt = None + + files = { + "image": image_binary + } + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/stability/v2beta/stable-image/upscale/conservative", + method=HttpMethod.POST, + request_model=StabilityUpscaleConservativeRequest, + response_model=StabilityStableUltraResponse, + ), + request=StabilityUpscaleConservativeRequest( + prompt=prompt, + negative_prompt=negative_prompt, + creativity=round(creativity,2), + seed=seed, + ), + files=files, + content_type="multipart/form-data", + auth_token=auth_token, + ) + response_api = operation.execute() + + if response_api.finish_reason != "SUCCESS": + raise Exception(f"Stability Upscale Conservative generation failed: {response_api.finish_reason}.") + + image_data = base64.b64decode(response_api.image) + returned_image = bytesio_to_image_tensor(BytesIO(image_data)) + + return (returned_image,) + + +class StabilityUpscaleCreativeNode: + """ + Upscale image with minimal alterations to 4K resolution. + """ + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Stability AI" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": (IO.IMAGE,), + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "What you wish to see in the output image. A strong, descriptive prompt that clearly defines elements, colors, and subjects will lead to better results." + }, + ), + "creativity": ( + IO.FLOAT, + { + "default": 0.3, + "min": 0.1, + "max": 0.5, + "step": 0.01, + "tooltip": "Controls the likelihood of creating additional details not heavily conditioned by the init image.", + }, + ), + "style_preset": (get_stability_style_presets(), + { + "tooltip": "Optional desired style of generated image.", + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 4294967294, + "control_after_generate": True, + "tooltip": "The random seed used for creating the noise.", + }, + ), + }, + "optional": { + "negative_prompt": ( + IO.STRING, + { + "default": "", + "forceInput": True, + "tooltip": "Keywords of what you do not wish to see in the output image. This is an advanced feature." + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call(self, image: torch.Tensor, prompt: str, creativity: float, style_preset: str, seed: int, negative_prompt: str=None, + auth_token=None): + validate_string(prompt, strip_whitespace=False) + image_binary = tensor_to_bytesio(image, total_pixels=1024*1024).read() + + if not negative_prompt: + negative_prompt = None + if style_preset == "None": + style_preset = None + + files = { + "image": image_binary + } + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/stability/v2beta/stable-image/upscale/creative", + method=HttpMethod.POST, + request_model=StabilityUpscaleCreativeRequest, + response_model=StabilityAsyncResponse, + ), + request=StabilityUpscaleCreativeRequest( + prompt=prompt, + negative_prompt=negative_prompt, + creativity=round(creativity,2), + style_preset=style_preset, + seed=seed, + ), + files=files, + content_type="multipart/form-data", + auth_token=auth_token, + ) + response_api = operation.execute() + + operation = PollingOperation( + poll_endpoint=ApiEndpoint( + path=f"/proxy/stability/v2beta/results/{response_api.id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=StabilityResultsGetResponse, + ), + poll_interval=3, + completed_statuses=[StabilityPollStatus.finished], + failed_statuses=[StabilityPollStatus.failed], + status_extractor=lambda x: get_async_dummy_status(x), + auth_token=auth_token, + ) + response_poll: StabilityResultsGetResponse = operation.execute() + + if response_poll.finish_reason != "SUCCESS": + raise Exception(f"Stability Upscale Creative generation failed: {response_poll.finish_reason}.") + + image_data = base64.b64decode(response_poll.result) + returned_image = bytesio_to_image_tensor(BytesIO(image_data)) + + return (returned_image,) + + +class StabilityUpscaleFastNode: + """ + Quickly upscales an image via Stability API call to 4x its original size; intended for upscaling low-quality/compressed images. + """ + + RETURN_TYPES = (IO.IMAGE,) + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "api_call" + API_NODE = True + CATEGORY = "api node/image/Stability AI" + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": (IO.IMAGE,), + }, + "optional": { + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + def api_call(self, image: torch.Tensor, + auth_token=None): + image_binary = tensor_to_bytesio(image, total_pixels=4096*4096).read() + + files = { + "image": image_binary + } + + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/stability/v2beta/stable-image/upscale/fast", + method=HttpMethod.POST, + request_model=EmptyRequest, + response_model=StabilityStableUltraResponse, + ), + request=EmptyRequest(), + files=files, + content_type="multipart/form-data", + auth_token=auth_token, + ) + response_api = operation.execute() + + if response_api.finish_reason != "SUCCESS": + raise Exception(f"Stability Upscale Fast failed: {response_api.finish_reason}.") + + image_data = base64.b64decode(response_api.image) + returned_image = bytesio_to_image_tensor(BytesIO(image_data)) + + return (returned_image,) + + +# A dictionary that contains all nodes you want to export with their names +# NOTE: names should be globally unique +NODE_CLASS_MAPPINGS = { + "StabilityStableImageUltraNode": StabilityStableImageUltraNode, + "StabilityStableImageSD_3_5Node": StabilityStableImageSD_3_5Node, + "StabilityUpscaleConservativeNode": StabilityUpscaleConservativeNode, + "StabilityUpscaleCreativeNode": StabilityUpscaleCreativeNode, + "StabilityUpscaleFastNode": StabilityUpscaleFastNode, +} + +# A dictionary that contains the friendly/humanly readable titles for the nodes +NODE_DISPLAY_NAME_MAPPINGS = { + "StabilityStableImageUltraNode": "Stability AI Stable Image Ultra", + "StabilityStableImageSD_3_5Node": "Stability AI Stable Diffusion 3.5 Image", + "StabilityUpscaleConservativeNode": "Stability AI Upscale Conservative", + "StabilityUpscaleCreativeNode": "Stability AI Upscale Creative", + "StabilityUpscaleFastNode": "Stability AI Upscale Fast", +} diff --git a/comfy_api_nodes/nodes_veo2.py b/comfy_api_nodes/nodes_veo2.py new file mode 100644 index 000000000..9233944b5 --- /dev/null +++ b/comfy_api_nodes/nodes_veo2.py @@ -0,0 +1,283 @@ +import io +import logging +import base64 +import requests +import torch + +from comfy.comfy_types.node_typing import IO, ComfyNodeABC +from comfy_api.input_impl.video_types import VideoFromFile +from comfy_api_nodes.apis import ( + Veo2GenVidRequest, + Veo2GenVidResponse, + Veo2GenVidPollRequest, + Veo2GenVidPollResponse +) +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, + PollingOperation, +) + +from comfy_api_nodes.apinode_utils import ( + downscale_image_tensor, + tensor_to_base64_string +) + +def convert_image_to_base64(image: torch.Tensor): + if image is None: + return None + + scaled_image = downscale_image_tensor(image, total_pixels=2048*2048) + return tensor_to_base64_string(scaled_image) + +class VeoVideoGenerationNode(ComfyNodeABC): + """ + Generates videos from text prompts using Google's Veo API. + + This node can create videos from text descriptions and optional image inputs, + with control over parameters like aspect ratio, duration, and more. + """ + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Text description of the video", + }, + ), + "aspect_ratio": ( + IO.COMBO, + { + "options": ["16:9", "9:16"], + "default": "16:9", + "tooltip": "Aspect ratio of the output video", + }, + ), + }, + "optional": { + "negative_prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Negative text prompt to guide what to avoid in the video", + }, + ), + "duration_seconds": ( + IO.INT, + { + "default": 5, + "min": 5, + "max": 8, + "step": 1, + "display": "number", + "tooltip": "Duration of the output video in seconds", + }, + ), + "enhance_prompt": ( + IO.BOOLEAN, + { + "default": True, + "tooltip": "Whether to enhance the prompt with AI assistance", + } + ), + "person_generation": ( + IO.COMBO, + { + "options": ["ALLOW", "BLOCK"], + "default": "ALLOW", + "tooltip": "Whether to allow generating people in the video", + }, + ), + "seed": ( + IO.INT, + { + "default": 0, + "min": 0, + "max": 0xFFFFFFFF, + "step": 1, + "display": "number", + "control_after_generate": True, + "tooltip": "Seed for video generation (0 for random)", + }, + ), + "image": (IO.IMAGE, { + "default": None, + "tooltip": "Optional reference image to guide video generation", + }), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + }, + } + + RETURN_TYPES = (IO.VIDEO,) + FUNCTION = "generate_video" + CATEGORY = "api node/video/Veo" + DESCRIPTION = "Generates videos from text prompts using Google's Veo API" + API_NODE = True + + def generate_video( + self, + prompt, + aspect_ratio="16:9", + negative_prompt="", + duration_seconds=5, + enhance_prompt=True, + person_generation="ALLOW", + seed=0, + image=None, + auth_token=None, + ): + # Prepare the instances for the request + instances = [] + + instance = { + "prompt": prompt + } + + # Add image if provided + if image is not None: + image_base64 = convert_image_to_base64(image) + if image_base64: + instance["image"] = { + "bytesBase64Encoded": image_base64, + "mimeType": "image/png" + } + + instances.append(instance) + + # Create parameters dictionary + parameters = { + "aspectRatio": aspect_ratio, + "personGeneration": person_generation, + "durationSeconds": duration_seconds, + "enhancePrompt": enhance_prompt, + } + + # Add optional parameters if provided + if negative_prompt: + parameters["negativePrompt"] = negative_prompt + if seed > 0: + parameters["seed"] = seed + + # Initial request to start video generation + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/veo/generate", + method=HttpMethod.POST, + request_model=Veo2GenVidRequest, + response_model=Veo2GenVidResponse + ), + request=Veo2GenVidRequest( + instances=instances, + parameters=parameters + ), + auth_token=auth_token + ) + + initial_response = initial_operation.execute() + operation_name = initial_response.name + + logging.info(f"Veo generation started with operation name: {operation_name}") + + # Define status extractor function + def status_extractor(response): + # Only return "completed" if the operation is done, regardless of success or failure + # We'll check for errors after polling completes + return "completed" if response.done else "pending" + + # Define progress extractor function + def progress_extractor(response): + # Could be enhanced if the API provides progress information + return None + + # Define the polling operation + poll_operation = PollingOperation( + poll_endpoint=ApiEndpoint( + path="/proxy/veo/poll", + method=HttpMethod.POST, + request_model=Veo2GenVidPollRequest, + response_model=Veo2GenVidPollResponse + ), + completed_statuses=["completed"], + failed_statuses=[], # No failed statuses, we'll handle errors after polling + status_extractor=status_extractor, + progress_extractor=progress_extractor, + request=Veo2GenVidPollRequest( + operationName=operation_name + ), + auth_token=auth_token, + poll_interval=5.0 + ) + + # Execute the polling operation + poll_response = poll_operation.execute() + + # Now check for errors in the final response + # Check for error in poll response + if hasattr(poll_response, 'error') and poll_response.error: + error_message = f"Veo API error: {poll_response.error.message} (code: {poll_response.error.code})" + logging.error(error_message) + raise Exception(error_message) + + # Check for RAI filtered content + if (hasattr(poll_response.response, 'raiMediaFilteredCount') and + poll_response.response.raiMediaFilteredCount > 0): + + # Extract reason message if available + if (hasattr(poll_response.response, 'raiMediaFilteredReasons') and + poll_response.response.raiMediaFilteredReasons): + reason = poll_response.response.raiMediaFilteredReasons[0] + error_message = f"Content filtered by Google's Responsible AI practices: {reason} ({poll_response.response.raiMediaFilteredCount} videos filtered.)" + else: + error_message = f"Content filtered by Google's Responsible AI practices ({poll_response.response.raiMediaFilteredCount} videos filtered.)" + + logging.error(error_message) + raise Exception(error_message) + + # Extract video data + video_data = None + if poll_response.response and hasattr(poll_response.response, 'videos') and poll_response.response.videos and len(poll_response.response.videos) > 0: + video = poll_response.response.videos[0] + + # Check if video is provided as base64 or URL + if hasattr(video, 'bytesBase64Encoded') and video.bytesBase64Encoded: + # Decode base64 string to bytes + video_data = base64.b64decode(video.bytesBase64Encoded) + elif hasattr(video, 'gcsUri') and video.gcsUri: + # Download from URL + video_url = video.gcsUri + video_response = requests.get(video_url) + video_data = video_response.content + else: + raise Exception("Video returned but no data or URL was provided") + else: + raise Exception("Video generation completed but no video was returned") + + if not video_data: + raise Exception("No video data was returned") + + logging.info("Video generation completed successfully") + + # Convert video data to BytesIO object + video_io = io.BytesIO(video_data) + + # Return VideoFromFile object + return (VideoFromFile(video_io),) + + +# Register the node +NODE_CLASS_MAPPINGS = { + "VeoVideoGenerationNode": VeoVideoGenerationNode, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "VeoVideoGenerationNode": "Google Veo2 Video Generation", +} diff --git a/comfy_api_nodes/redocly-dev.yaml b/comfy_api_nodes/redocly-dev.yaml new file mode 100644 index 000000000..d9e3cab70 --- /dev/null +++ b/comfy_api_nodes/redocly-dev.yaml @@ -0,0 +1,10 @@ +# This file is used to filter the Comfy Org OpenAPI spec for schemas related to API Nodes. +# This is used for development purposes to generate stubs for unreleased API endpoints. +apis: + filter: + root: openapi.yaml + decorators: + filter-in: + property: tags + value: ['API Nodes'] + matchStrategy: all diff --git a/comfy_api_nodes/redocly.yaml b/comfy_api_nodes/redocly.yaml new file mode 100644 index 000000000..d102345b1 --- /dev/null +++ b/comfy_api_nodes/redocly.yaml @@ -0,0 +1,10 @@ +# This file is used to filter the Comfy Org OpenAPI spec for schemas related to API Nodes. + +apis: + filter: + root: openapi.yaml + decorators: + filter-in: + property: tags + value: ['API Nodes', 'Released'] + matchStrategy: all diff --git a/comfy_extras/nodes_primitive.py b/comfy_extras/nodes_primitive.py index 184b990c3..1f93f87a7 100644 --- a/comfy_extras/nodes_primitive.py +++ b/comfy_extras/nodes_primitive.py @@ -21,6 +21,21 @@ class String(ComfyNodeABC): return (value,) +class StringMultiline(ComfyNodeABC): + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": {"value": (IO.STRING, {"multiline": True,},)}, + } + + RETURN_TYPES = (IO.STRING,) + FUNCTION = "execute" + CATEGORY = "utils/primitive" + + def execute(self, value: str) -> tuple[str]: + return (value,) + + class Int(ComfyNodeABC): @classmethod def INPUT_TYPES(cls) -> InputTypeDict: @@ -68,6 +83,7 @@ class Boolean(ComfyNodeABC): NODE_CLASS_MAPPINGS = { "PrimitiveString": String, + "PrimitiveStringMultiline": StringMultiline, "PrimitiveInt": Int, "PrimitiveFloat": Float, "PrimitiveBoolean": Boolean, @@ -75,6 +91,7 @@ NODE_CLASS_MAPPINGS = { NODE_DISPLAY_NAME_MAPPINGS = { "PrimitiveString": "String", + "PrimitiveStringMultiline": "String (Multiline)", "PrimitiveInt": "Int", "PrimitiveFloat": "Float", "PrimitiveBoolean": "Boolean", diff --git a/nodes.py b/nodes.py index 92b8ca6ae..d31e0774d 100644 --- a/nodes.py +++ b/nodes.py @@ -2263,7 +2263,17 @@ def init_builtin_extra_nodes(): api_nodes_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_api_nodes") api_nodes_files = [ - "nodes_api.py", + "nodes_ideogram.py", + "nodes_openai.py", + "nodes_minimax.py", + "nodes_veo2.py", + "nodes_kling.py", + "nodes_bfl.py", + "nodes_luma.py", + "nodes_recraft.py", + "nodes_pixverse.py", + "nodes_stability.py", + "nodes_pika.py", ] import_failed = [] diff --git a/requirements.txt b/requirements.txt index 05ceba00a..29cf0e2ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -comfyui-frontend-package==1.18.6 -comfyui-workflow-templates==0.1.3 +comfyui-frontend-package==1.18.9 +comfyui-workflow-templates==0.1.11 torch torchsde torchvision diff --git a/tests-unit/comfy_api_nodes_test/mapper_utils_test.py b/tests-unit/comfy_api_nodes_test/mapper_utils_test.py new file mode 100644 index 000000000..69488f691 --- /dev/null +++ b/tests-unit/comfy_api_nodes_test/mapper_utils_test.py @@ -0,0 +1,297 @@ +from typing import Optional +from enum import Enum + +from pydantic import BaseModel, Field + +from comfy.comfy_types.node_typing import IO +from comfy_api_nodes.mapper_utils import model_field_to_node_input + + +def test_model_field_to_float_input(): + """Tests mapping a float field with constraints.""" + + class ModelWithFloatField(BaseModel): + cfg_scale: Optional[float] = Field( + default=0.5, + description="Flexibility in video generation", + ge=0.0, + le=1.0, + multiple_of=0.001, + ) + + expected_output = ( + IO.FLOAT, + { + "default": 0.5, + "tooltip": "Flexibility in video generation", + "min": 0.0, + "max": 1.0, + "step": 0.001, + }, + ) + + actual_output = model_field_to_node_input( + IO.FLOAT, ModelWithFloatField, "cfg_scale" + ) + + assert actual_output[0] == expected_output[0] + assert actual_output[1] == expected_output[1] + + +def test_model_field_to_float_input_no_constraints(): + """Tests mapping a float field with no constraints.""" + + class ModelWithFloatField(BaseModel): + cfg_scale: Optional[float] = Field(default=0.5) + + expected_output = ( + IO.FLOAT, + { + "default": 0.5, + }, + ) + + actual_output = model_field_to_node_input( + IO.FLOAT, ModelWithFloatField, "cfg_scale" + ) + + assert actual_output[0] == expected_output[0] + assert actual_output[1] == expected_output[1] + + +def test_model_field_to_int_input(): + """Tests mapping an int field with constraints.""" + + class ModelWithIntField(BaseModel): + num_frames: Optional[int] = Field( + default=10, + description="Number of frames to generate", + ge=1, + le=100, + multiple_of=1, + ) + + expected_output = ( + IO.INT, + { + "default": 10, + "tooltip": "Number of frames to generate", + "min": 1, + "max": 100, + "step": 1, + }, + ) + + actual_output = model_field_to_node_input(IO.INT, ModelWithIntField, "num_frames") + + assert actual_output[0] == expected_output[0] + assert actual_output[1] == expected_output[1] + + +def test_model_field_to_string_input(): + """Tests mapping a string field.""" + + class ModelWithStringField(BaseModel): + prompt: Optional[str] = Field( + default="A beautiful sunset over a calm ocean", + description="A prompt for the video generation", + ) + + expected_output = ( + IO.STRING, + { + "default": "A beautiful sunset over a calm ocean", + "tooltip": "A prompt for the video generation", + }, + ) + + actual_output = model_field_to_node_input(IO.STRING, ModelWithStringField, "prompt") + + assert actual_output[0] == expected_output[0] + assert actual_output[1] == expected_output[1] + + +def test_model_field_to_string_input_multiline(): + """Tests mapping a string field.""" + + class ModelWithStringField(BaseModel): + prompt: Optional[str] = Field( + default="A beautiful sunset over a calm ocean", + description="A prompt for the video generation", + ) + + expected_output = ( + IO.STRING, + { + "default": "A beautiful sunset over a calm ocean", + "tooltip": "A prompt for the video generation", + "multiline": True, + }, + ) + + actual_output = model_field_to_node_input( + IO.STRING, ModelWithStringField, "prompt", multiline=True + ) + + assert actual_output[0] == expected_output[0] + assert actual_output[1] == expected_output[1] + + +def test_model_field_to_combo_input(): + """Tests mapping a combo field.""" + + class MockEnum(str, Enum): + option_1 = "option 1" + option_2 = "option 2" + option_3 = "option 3" + + class ModelWithComboField(BaseModel): + model_name: Optional[MockEnum] = Field("option 1", description="Model Name") + + expected_output = ( + IO.COMBO, + { + "options": ["option 1", "option 2", "option 3"], + "default": "option 1", + "tooltip": "Model Name", + }, + ) + + actual_output = model_field_to_node_input( + IO.COMBO, ModelWithComboField, "model_name", enum_type=MockEnum + ) + + assert actual_output[0] == expected_output[0] + assert actual_output[1] == expected_output[1] + + +def test_model_field_to_combo_input_no_options(): + """Tests mapping a combo field with no options.""" + + class ModelWithComboField(BaseModel): + model_name: Optional[str] = Field(description="Model Name") + + expected_output = ( + IO.COMBO, + { + "tooltip": "Model Name", + }, + ) + + actual_output = model_field_to_node_input( + IO.COMBO, ModelWithComboField, "model_name" + ) + + assert actual_output[0] == expected_output[0] + assert actual_output[1] == expected_output[1] + + +def test_model_field_to_image_input(): + """Tests mapping an image field.""" + + class ModelWithImageField(BaseModel): + image: Optional[str] = Field( + default=None, + description="An image for the video generation", + ) + + expected_output = ( + IO.IMAGE, + { + "default": None, + "tooltip": "An image for the video generation", + }, + ) + + actual_output = model_field_to_node_input(IO.IMAGE, ModelWithImageField, "image") + + assert actual_output[0] == expected_output[0] + assert actual_output[1] == expected_output[1] + + +def test_model_field_to_node_input_no_description(): + """Tests mapping a field with no description.""" + + class ModelWithNoDescriptionField(BaseModel): + field: Optional[str] = Field(default="default value") + + expected_output = ( + IO.STRING, + { + "default": "default value", + }, + ) + + actual_output = model_field_to_node_input( + IO.STRING, ModelWithNoDescriptionField, "field" + ) + + assert actual_output[0] == expected_output[0] + assert actual_output[1] == expected_output[1] + + +def test_model_field_to_node_input_no_default(): + """Tests mapping a field with no default.""" + + class ModelWithNoDefaultField(BaseModel): + field: Optional[str] = Field(description="A field with no default") + + expected_output = ( + IO.STRING, + { + "tooltip": "A field with no default", + }, + ) + + actual_output = model_field_to_node_input( + IO.STRING, ModelWithNoDefaultField, "field" + ) + + assert actual_output[0] == expected_output[0] + assert actual_output[1] == expected_output[1] + + +def test_model_field_to_node_input_no_metadata(): + """Tests mapping a field with no metadata or properties defined on the schema.""" + + class ModelWithNoMetadataField(BaseModel): + field: Optional[str] = Field() + + expected_output = ( + IO.STRING, + {}, + ) + + actual_output = model_field_to_node_input( + IO.STRING, ModelWithNoMetadataField, "field" + ) + + assert actual_output[0] == expected_output[0] + assert actual_output[1] == expected_output[1] + + +def test_model_field_to_node_input_default_is_none(): + """ + Tests mapping a field with a default of `None`. + I.e., the default field should be included as the schema explicitly sets it to `None`. + """ + + class ModelWithNoneDefaultField(BaseModel): + field: Optional[str] = Field( + default=None, description="A field with a default of None" + ) + + expected_output = ( + IO.STRING, + { + "default": None, + "tooltip": "A field with a default of None", + }, + ) + + actual_output = model_field_to_node_input( + IO.STRING, ModelWithNoneDefaultField, "field" + ) + + assert actual_output[0] == expected_output[0] + assert actual_output[1] == expected_output[1] From 094e9ef126fb60a6f5eeb7e1e30669b9328e7349 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Tue, 6 May 2025 01:53:53 -0700 Subject: [PATCH 403/478] Add a way to disable api nodes: --disable-api-nodes (#7960) --- comfy/cli_args.py | 1 + main.py | 2 +- nodes.py | 30 +++++++++++++++++++++++++----- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index ef5ab6277..97b348f0d 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -148,6 +148,7 @@ parser.add_argument("--windows-standalone-build", action="store_true", help="Win parser.add_argument("--disable-metadata", action="store_true", help="Disable saving prompt metadata in files.") parser.add_argument("--disable-all-custom-nodes", action="store_true", help="Disable loading all custom nodes.") +parser.add_argument("--disable-api-nodes", action="store_true", help="Disable loading all api nodes.") parser.add_argument("--multi-user", action="store_true", help="Enables per-user storage.") diff --git a/main.py b/main.py index 5c21542b3..221e48e41 100644 --- a/main.py +++ b/main.py @@ -270,7 +270,7 @@ def start_comfyui(asyncio_loop=None): q = execution.PromptQueue(prompt_server) hook_breaker_ac10a0.save_functions() - nodes.init_extra_nodes(init_custom_nodes=not args.disable_all_custom_nodes) + nodes.init_extra_nodes(init_custom_nodes=not args.disable_all_custom_nodes, init_api_nodes=not args.disable_api_nodes) hook_breaker_ac10a0.restore_functions() cuda_malloc_warning() diff --git a/nodes.py b/nodes.py index d31e0774d..3c3617562 100644 --- a/nodes.py +++ b/nodes.py @@ -2261,6 +2261,15 @@ def init_builtin_extra_nodes(): "nodes_preview_any.py", ] + import_failed = [] + for node_file in extras_files: + if not load_custom_node(os.path.join(extras_dir, node_file), module_parent="comfy_extras"): + import_failed.append(node_file) + + return import_failed + + +def init_builtin_api_nodes(): api_nodes_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy_api_nodes") api_nodes_files = [ "nodes_ideogram.py", @@ -2277,10 +2286,6 @@ def init_builtin_extra_nodes(): ] import_failed = [] - for node_file in extras_files: - if not load_custom_node(os.path.join(extras_dir, node_file), module_parent="comfy_extras"): - import_failed.append(node_file) - for node_file in api_nodes_files: if not load_custom_node(os.path.join(api_nodes_dir, node_file), module_parent="comfy_api_nodes"): import_failed.append(node_file) @@ -2288,14 +2293,29 @@ def init_builtin_extra_nodes(): return import_failed -def init_extra_nodes(init_custom_nodes=True): +def init_extra_nodes(init_custom_nodes=True, init_api_nodes=True): import_failed = init_builtin_extra_nodes() + import_failed_api = [] + if init_api_nodes: + import_failed_api = init_builtin_api_nodes() + if init_custom_nodes: init_external_custom_nodes() else: logging.info("Skipping loading of custom nodes") + if len(import_failed_api) > 0: + logging.warning("WARNING: some comfy_api_nodes/ nodes did not import correctly. This may be because they are missing some dependencies.\n") + for node in import_failed_api: + logging.warning("IMPORT FAILED: {}".format(node)) + logging.warning("\nThis issue might be caused by new missing dependencies added the last time you updated ComfyUI.") + if args.windows_standalone_build: + logging.warning("Please run the update script: update/update_comfyui.bat") + else: + logging.warning("Please do a: pip install -r requirements.txt") + logging.warning("") + if len(import_failed) > 0: logging.warning("WARNING: some comfy_extras/ nodes did not import correctly. This may be because they are missing some dependencies.\n") for node in import_failed: From 0cf2e46b1725a5d0d6cb7b177a524026ca00f5a4 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 6 May 2025 07:39:54 -0400 Subject: [PATCH 404/478] ComfyUI version 0.3.32 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 8d2068de7..61573aead 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.31" +__version__ = "0.3.32" diff --git a/pyproject.toml b/pyproject.toml index 8b549a0b6..878e7c66a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.31" +version = "0.3.32" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From a4e679765ec6a7adc6dda326c7bab915e2914bd6 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Tue, 6 May 2025 06:00:01 -0700 Subject: [PATCH 405/478] Change chroma to use Flux shift. (#7961) --- comfy/model_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/model_base.py b/comfy/model_base.py index 3d33086d8..045df1317 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -1111,7 +1111,7 @@ class HiDream(BaseModel): return out class Chroma(Flux): - def __init__(self, model_config, model_type=ModelType.FLOW, device=None): + def __init__(self, model_config, model_type=ModelType.FLUX, device=None): super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.chroma.model.Chroma) def extra_conds(self, **kwargs): From 271c9c5b9eb027c682161ed7848bbf640253f973 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Tue, 6 May 2025 06:52:37 -0700 Subject: [PATCH 406/478] Better mem estimation for the LTXV 13B model. (#7963) --- comfy/supported_models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/comfy/supported_models.py b/comfy/supported_models.py index d5210cfac..a1dea2343 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -785,6 +785,10 @@ class LTXV(supported_models_base.BASE): vae_key_prefix = ["vae."] text_encoder_key_prefix = ["text_encoders."] + def __init__(self, unet_config): + super().__init__(unet_config) + self.memory_usage_factor = (unet_config.get("cross_attention_dim", 2048) / 2048) * 5.5 + def get_model(self, state_dict, prefix="", device=None): out = model_base.LTXV(self, device=device) return out From 16417b40d9411c6e3a63949aa0f3582be25b28db Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 7 May 2025 05:33:34 -0700 Subject: [PATCH 407/478] Initial ACE-Step model implementation. (#7972) --- comfy/latent_formats.py | 4 + comfy/ldm/ace/attention.py | 768 + comfy/ldm/ace/lyric_encoder.py | 1067 ++ comfy/ldm/ace/model.py | 381 + comfy/ldm/ace/vae/autoencoder_dc.py | 644 + comfy/ldm/ace/vae/music_dcae_pipeline.py | 104 + comfy/ldm/ace/vae/music_log_mel.py | 108 + comfy/ldm/ace/vae/music_vocoder.py | 542 + comfy/model_base.py | 19 + comfy/model_detection.py | 25 + comfy/sd.py | 25 +- comfy/supported_models.py | 31 +- comfy/text_encoders/ace.py | 145 + .../ace_lyrics_tokenizer/vocab.json | 15535 ++++++++++++++++ comfy/text_encoders/ace_text_cleaners.py | 270 + comfy/text_encoders/umt5_config_base.json | 22 + comfy_extras/nodes_ace.py | 46 + nodes.py | 6 +- 18 files changed, 19738 insertions(+), 4 deletions(-) create mode 100644 comfy/ldm/ace/attention.py create mode 100644 comfy/ldm/ace/lyric_encoder.py create mode 100644 comfy/ldm/ace/model.py create mode 100644 comfy/ldm/ace/vae/autoencoder_dc.py create mode 100644 comfy/ldm/ace/vae/music_dcae_pipeline.py create mode 100755 comfy/ldm/ace/vae/music_log_mel.py create mode 100755 comfy/ldm/ace/vae/music_vocoder.py create mode 100644 comfy/text_encoders/ace.py create mode 100644 comfy/text_encoders/ace_lyrics_tokenizer/vocab.json create mode 100644 comfy/text_encoders/ace_text_cleaners.py create mode 100644 comfy/text_encoders/umt5_config_base.json create mode 100644 comfy_extras/nodes_ace.py diff --git a/comfy/latent_formats.py b/comfy/latent_formats.py index 556c39512..82d9f9bb8 100644 --- a/comfy/latent_formats.py +++ b/comfy/latent_formats.py @@ -466,3 +466,7 @@ class Hunyuan3Dv2mini(LatentFormat): latent_channels = 64 latent_dimensions = 1 scale_factor = 1.0188137142395404 + +class ACEAudio(LatentFormat): + latent_channels = 8 + latent_dimensions = 2 diff --git a/comfy/ldm/ace/attention.py b/comfy/ldm/ace/attention.py new file mode 100644 index 000000000..631d13647 --- /dev/null +++ b/comfy/ldm/ace/attention.py @@ -0,0 +1,768 @@ +# Original from: https://github.com/ace-step/ACE-Step/blob/main/models/attention.py +# Copyright 2024 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from typing import Tuple, Union, Optional + +import torch +import torch.nn.functional as F +from torch import nn + +import comfy.model_management + +class Attention(nn.Module): + def __init__( + self, + query_dim: int, + cross_attention_dim: Optional[int] = None, + heads: int = 8, + kv_heads: Optional[int] = None, + dim_head: int = 64, + dropout: float = 0.0, + bias: bool = False, + qk_norm: Optional[str] = None, + added_kv_proj_dim: Optional[int] = None, + added_proj_bias: Optional[bool] = True, + out_bias: bool = True, + scale_qk: bool = True, + only_cross_attention: bool = False, + eps: float = 1e-5, + rescale_output_factor: float = 1.0, + residual_connection: bool = False, + processor=None, + out_dim: int = None, + out_context_dim: int = None, + context_pre_only=None, + pre_only=False, + elementwise_affine: bool = True, + is_causal: bool = False, + dtype=None, device=None, operations=None + ): + super().__init__() + + self.inner_dim = out_dim if out_dim is not None else dim_head * heads + self.inner_kv_dim = self.inner_dim if kv_heads is None else dim_head * kv_heads + self.query_dim = query_dim + self.use_bias = bias + self.is_cross_attention = cross_attention_dim is not None + self.cross_attention_dim = cross_attention_dim if cross_attention_dim is not None else query_dim + self.rescale_output_factor = rescale_output_factor + self.residual_connection = residual_connection + self.dropout = dropout + self.fused_projections = False + self.out_dim = out_dim if out_dim is not None else query_dim + self.out_context_dim = out_context_dim if out_context_dim is not None else query_dim + self.context_pre_only = context_pre_only + self.pre_only = pre_only + self.is_causal = is_causal + + self.scale_qk = scale_qk + self.scale = dim_head**-0.5 if self.scale_qk else 1.0 + + self.heads = out_dim // dim_head if out_dim is not None else heads + # for slice_size > 0 the attention score computation + # is split across the batch axis to save memory + # You can set slice_size with `set_attention_slice` + self.sliceable_head_dim = heads + + self.added_kv_proj_dim = added_kv_proj_dim + self.only_cross_attention = only_cross_attention + + if self.added_kv_proj_dim is None and self.only_cross_attention: + raise ValueError( + "`only_cross_attention` can only be set to True if `added_kv_proj_dim` is not None. Make sure to set either `only_cross_attention=False` or define `added_kv_proj_dim`." + ) + + self.group_norm = None + self.spatial_norm = None + + self.norm_q = None + self.norm_k = None + + self.norm_cross = None + self.to_q = operations.Linear(query_dim, self.inner_dim, bias=bias, dtype=dtype, device=device) + + if not self.only_cross_attention: + # only relevant for the `AddedKVProcessor` classes + self.to_k = operations.Linear(self.cross_attention_dim, self.inner_kv_dim, bias=bias, dtype=dtype, device=device) + self.to_v = operations.Linear(self.cross_attention_dim, self.inner_kv_dim, bias=bias, dtype=dtype, device=device) + else: + self.to_k = None + self.to_v = None + + self.added_proj_bias = added_proj_bias + if self.added_kv_proj_dim is not None: + self.add_k_proj = operations.Linear(added_kv_proj_dim, self.inner_kv_dim, bias=added_proj_bias, dtype=dtype, device=device) + self.add_v_proj = operations.Linear(added_kv_proj_dim, self.inner_kv_dim, bias=added_proj_bias, dtype=dtype, device=device) + if self.context_pre_only is not None: + self.add_q_proj = operations.Linear(added_kv_proj_dim, self.inner_dim, bias=added_proj_bias, dtype=dtype, device=device) + else: + self.add_q_proj = None + self.add_k_proj = None + self.add_v_proj = None + + if not self.pre_only: + self.to_out = nn.ModuleList([]) + self.to_out.append(operations.Linear(self.inner_dim, self.out_dim, bias=out_bias, dtype=dtype, device=device)) + self.to_out.append(nn.Dropout(dropout)) + else: + self.to_out = None + + if self.context_pre_only is not None and not self.context_pre_only: + self.to_add_out = operations.Linear(self.inner_dim, self.out_context_dim, bias=out_bias, dtype=dtype, device=device) + else: + self.to_add_out = None + + self.norm_added_q = None + self.norm_added_k = None + self.processor = processor + + def forward( + self, + hidden_states: torch.Tensor, + encoder_hidden_states: Optional[torch.Tensor] = None, + attention_mask: Optional[torch.Tensor] = None, + **cross_attention_kwargs, + ) -> torch.Tensor: + return self.processor( + self, + hidden_states, + encoder_hidden_states=encoder_hidden_states, + attention_mask=attention_mask, + **cross_attention_kwargs, + ) + + +class CustomLiteLAProcessor2_0: + """Attention processor used typically in processing the SD3-like self-attention projections. add rms norm for query and key and apply RoPE""" + + def __init__(self): + self.kernel_func = nn.ReLU(inplace=False) + self.eps = 1e-15 + self.pad_val = 1.0 + + def apply_rotary_emb( + self, + x: torch.Tensor, + freqs_cis: Union[torch.Tensor, Tuple[torch.Tensor]], + ) -> Tuple[torch.Tensor, torch.Tensor]: + """ + Apply rotary embeddings to input tensors using the given frequency tensor. This function applies rotary embeddings + to the given query or key 'x' tensors using the provided frequency tensor 'freqs_cis'. The input tensors are + reshaped as complex numbers, and the frequency tensor is reshaped for broadcasting compatibility. The resulting + tensors contain rotary embeddings and are returned as real tensors. + + Args: + x (`torch.Tensor`): + Query or key tensor to apply rotary embeddings. [B, H, S, D] xk (torch.Tensor): Key tensor to apply + freqs_cis (`Tuple[torch.Tensor]`): Precomputed frequency tensor for complex exponentials. ([S, D], [S, D],) + + Returns: + Tuple[torch.Tensor, torch.Tensor]: Tuple of modified query tensor and key tensor with rotary embeddings. + """ + cos, sin = freqs_cis # [S, D] + cos = cos[None, None] + sin = sin[None, None] + cos, sin = cos.to(x.device), sin.to(x.device) + + x_real, x_imag = x.reshape(*x.shape[:-1], -1, 2).unbind(-1) # [B, S, H, D//2] + x_rotated = torch.stack([-x_imag, x_real], dim=-1).flatten(3) + out = (x.float() * cos + x_rotated.float() * sin).to(x.dtype) + + return out + + def __call__( + self, + attn: Attention, + hidden_states: torch.FloatTensor, + encoder_hidden_states: torch.FloatTensor = None, + attention_mask: Optional[torch.FloatTensor] = None, + encoder_attention_mask: Optional[torch.FloatTensor] = None, + rotary_freqs_cis: Union[torch.Tensor, Tuple[torch.Tensor]] = None, + rotary_freqs_cis_cross: Union[torch.Tensor, Tuple[torch.Tensor]] = None, + *args, + **kwargs, + ) -> torch.FloatTensor: + hidden_states_len = hidden_states.shape[1] + + input_ndim = hidden_states.ndim + if input_ndim == 4: + batch_size, channel, height, width = hidden_states.shape + hidden_states = hidden_states.view(batch_size, channel, height * width).transpose(1, 2) + if encoder_hidden_states is not None: + context_input_ndim = encoder_hidden_states.ndim + if context_input_ndim == 4: + batch_size, channel, height, width = encoder_hidden_states.shape + encoder_hidden_states = encoder_hidden_states.view(batch_size, channel, height * width).transpose(1, 2) + + batch_size = hidden_states.shape[0] + + # `sample` projections. + dtype = hidden_states.dtype + query = attn.to_q(hidden_states) + key = attn.to_k(hidden_states) + value = attn.to_v(hidden_states) + + # `context` projections. + has_encoder_hidden_state_proj = hasattr(attn, "add_q_proj") and hasattr(attn, "add_k_proj") and hasattr(attn, "add_v_proj") + if encoder_hidden_states is not None and has_encoder_hidden_state_proj: + encoder_hidden_states_query_proj = attn.add_q_proj(encoder_hidden_states) + encoder_hidden_states_key_proj = attn.add_k_proj(encoder_hidden_states) + encoder_hidden_states_value_proj = attn.add_v_proj(encoder_hidden_states) + + # attention + if not attn.is_cross_attention: + query = torch.cat([query, encoder_hidden_states_query_proj], dim=1) + key = torch.cat([key, encoder_hidden_states_key_proj], dim=1) + value = torch.cat([value, encoder_hidden_states_value_proj], dim=1) + else: + query = hidden_states + key = encoder_hidden_states + value = encoder_hidden_states + + inner_dim = key.shape[-1] + head_dim = inner_dim // attn.heads + + query = query.transpose(-1, -2).reshape(batch_size, attn.heads, head_dim, -1) + key = key.transpose(-1, -2).reshape(batch_size, attn.heads, head_dim, -1).transpose(-1, -2) + value = value.transpose(-1, -2).reshape(batch_size, attn.heads, head_dim, -1) + + # RoPE需要 [B, H, S, D] 输入 + # 此时 query是 [B, H, D, S], 需要转成 [B, H, S, D] 才能应用RoPE + query = query.permute(0, 1, 3, 2) # [B, H, S, D] (从 [B, H, D, S]) + + # Apply query and key normalization if needed + if attn.norm_q is not None: + query = attn.norm_q(query) + if attn.norm_k is not None: + key = attn.norm_k(key) + + # Apply RoPE if needed + if rotary_freqs_cis is not None: + query = self.apply_rotary_emb(query, rotary_freqs_cis) + if not attn.is_cross_attention: + key = self.apply_rotary_emb(key, rotary_freqs_cis) + elif rotary_freqs_cis_cross is not None and has_encoder_hidden_state_proj: + key = self.apply_rotary_emb(key, rotary_freqs_cis_cross) + + # 此时 query是 [B, H, S, D],需要还原成 [B, H, D, S] + query = query.permute(0, 1, 3, 2) # [B, H, D, S] + + if attention_mask is not None: + # attention_mask: [B, S] -> [B, 1, S, 1] + attention_mask = attention_mask[:, None, :, None].to(key.dtype) # [B, 1, S, 1] + query = query * attention_mask.permute(0, 1, 3, 2) # [B, H, S, D] * [B, 1, S, 1] + if not attn.is_cross_attention: + key = key * attention_mask # key: [B, h, S, D] 与 mask [B, 1, S, 1] 相乘 + value = value * attention_mask.permute(0, 1, 3, 2) # 如果 value 是 [B, h, D, S],那么需调整mask以匹配S维度 + + if attn.is_cross_attention and encoder_attention_mask is not None and has_encoder_hidden_state_proj: + encoder_attention_mask = encoder_attention_mask[:, None, :, None].to(key.dtype) # [B, 1, S_enc, 1] + # 此时 key: [B, h, S_enc, D], value: [B, h, D, S_enc] + key = key * encoder_attention_mask # [B, h, S_enc, D] * [B, 1, S_enc, 1] + value = value * encoder_attention_mask.permute(0, 1, 3, 2) # [B, h, D, S_enc] * [B, 1, 1, S_enc] + + query = self.kernel_func(query) + key = self.kernel_func(key) + + query, key, value = query.float(), key.float(), value.float() + + value = F.pad(value, (0, 0, 0, 1), mode="constant", value=self.pad_val) + + vk = torch.matmul(value, key) + + hidden_states = torch.matmul(vk, query) + + if hidden_states.dtype in [torch.float16, torch.bfloat16]: + hidden_states = hidden_states.float() + + hidden_states = hidden_states[:, :, :-1] / (hidden_states[:, :, -1:] + self.eps) + + hidden_states = hidden_states.view(batch_size, attn.heads * head_dim, -1).permute(0, 2, 1) + + hidden_states = hidden_states.to(dtype) + if encoder_hidden_states is not None: + encoder_hidden_states = encoder_hidden_states.to(dtype) + + # Split the attention outputs. + if encoder_hidden_states is not None and not attn.is_cross_attention and has_encoder_hidden_state_proj: + hidden_states, encoder_hidden_states = ( + hidden_states[:, : hidden_states_len], + hidden_states[:, hidden_states_len:], + ) + + # linear proj + hidden_states = attn.to_out[0](hidden_states) + # dropout + hidden_states = attn.to_out[1](hidden_states) + if encoder_hidden_states is not None and not attn.context_pre_only and not attn.is_cross_attention and hasattr(attn, "to_add_out"): + encoder_hidden_states = attn.to_add_out(encoder_hidden_states) + + if input_ndim == 4: + hidden_states = hidden_states.transpose(-1, -2).reshape(batch_size, channel, height, width) + if encoder_hidden_states is not None and context_input_ndim == 4: + encoder_hidden_states = encoder_hidden_states.transpose(-1, -2).reshape(batch_size, channel, height, width) + + if torch.get_autocast_gpu_dtype() == torch.float16: + hidden_states = hidden_states.clip(-65504, 65504) + if encoder_hidden_states is not None: + encoder_hidden_states = encoder_hidden_states.clip(-65504, 65504) + + return hidden_states, encoder_hidden_states + + +class CustomerAttnProcessor2_0: + r""" + Processor for implementing scaled dot-product attention (enabled by default if you're using PyTorch 2.0). + """ + + def __init__(self): + if not hasattr(F, "scaled_dot_product_attention"): + raise ImportError("AttnProcessor2_0 requires PyTorch 2.0, to use it, please upgrade PyTorch to 2.0.") + + def apply_rotary_emb( + self, + x: torch.Tensor, + freqs_cis: Union[torch.Tensor, Tuple[torch.Tensor]], + ) -> Tuple[torch.Tensor, torch.Tensor]: + """ + Apply rotary embeddings to input tensors using the given frequency tensor. This function applies rotary embeddings + to the given query or key 'x' tensors using the provided frequency tensor 'freqs_cis'. The input tensors are + reshaped as complex numbers, and the frequency tensor is reshaped for broadcasting compatibility. The resulting + tensors contain rotary embeddings and are returned as real tensors. + + Args: + x (`torch.Tensor`): + Query or key tensor to apply rotary embeddings. [B, H, S, D] xk (torch.Tensor): Key tensor to apply + freqs_cis (`Tuple[torch.Tensor]`): Precomputed frequency tensor for complex exponentials. ([S, D], [S, D],) + + Returns: + Tuple[torch.Tensor, torch.Tensor]: Tuple of modified query tensor and key tensor with rotary embeddings. + """ + cos, sin = freqs_cis # [S, D] + cos = cos[None, None] + sin = sin[None, None] + cos, sin = cos.to(x.device), sin.to(x.device) + + x_real, x_imag = x.reshape(*x.shape[:-1], -1, 2).unbind(-1) # [B, S, H, D//2] + x_rotated = torch.stack([-x_imag, x_real], dim=-1).flatten(3) + out = (x.float() * cos + x_rotated.float() * sin).to(x.dtype) + + return out + + def __call__( + self, + attn: Attention, + hidden_states: torch.FloatTensor, + encoder_hidden_states: torch.FloatTensor = None, + attention_mask: Optional[torch.FloatTensor] = None, + encoder_attention_mask: Optional[torch.FloatTensor] = None, + rotary_freqs_cis: Union[torch.Tensor, Tuple[torch.Tensor]] = None, + rotary_freqs_cis_cross: Union[torch.Tensor, Tuple[torch.Tensor]] = None, + *args, + **kwargs, + ) -> torch.Tensor: + + residual = hidden_states + input_ndim = hidden_states.ndim + + if input_ndim == 4: + batch_size, channel, height, width = hidden_states.shape + hidden_states = hidden_states.view(batch_size, channel, height * width).transpose(1, 2) + + batch_size, sequence_length, _ = ( + hidden_states.shape if encoder_hidden_states is None else encoder_hidden_states.shape + ) + + has_encoder_hidden_state_proj = hasattr(attn, "add_q_proj") and hasattr(attn, "add_k_proj") and hasattr(attn, "add_v_proj") + + if attn.group_norm is not None: + hidden_states = attn.group_norm(hidden_states.transpose(1, 2)).transpose(1, 2) + + query = attn.to_q(hidden_states) + + if encoder_hidden_states is None: + encoder_hidden_states = hidden_states + elif attn.norm_cross: + encoder_hidden_states = attn.norm_encoder_hidden_states(encoder_hidden_states) + + key = attn.to_k(encoder_hidden_states) + value = attn.to_v(encoder_hidden_states) + + inner_dim = key.shape[-1] + head_dim = inner_dim // attn.heads + + query = query.view(batch_size, -1, attn.heads, head_dim).transpose(1, 2) + + key = key.view(batch_size, -1, attn.heads, head_dim).transpose(1, 2) + value = value.view(batch_size, -1, attn.heads, head_dim).transpose(1, 2) + + if attn.norm_q is not None: + query = attn.norm_q(query) + if attn.norm_k is not None: + key = attn.norm_k(key) + + # Apply RoPE if needed + if rotary_freqs_cis is not None: + query = self.apply_rotary_emb(query, rotary_freqs_cis) + if not attn.is_cross_attention: + key = self.apply_rotary_emb(key, rotary_freqs_cis) + elif rotary_freqs_cis_cross is not None and has_encoder_hidden_state_proj: + key = self.apply_rotary_emb(key, rotary_freqs_cis_cross) + + if attn.is_cross_attention and encoder_attention_mask is not None and has_encoder_hidden_state_proj: + # attention_mask: N x S1 + # encoder_attention_mask: N x S2 + # cross attention 整合attention_mask和encoder_attention_mask + combined_mask = attention_mask[:, :, None] * encoder_attention_mask[:, None, :] + attention_mask = torch.where(combined_mask == 1, 0.0, -torch.inf) + attention_mask = attention_mask[:, None, :, :].expand(-1, attn.heads, -1, -1).to(query.dtype) + + elif not attn.is_cross_attention and attention_mask is not None: + attention_mask = attn.prepare_attention_mask(attention_mask, sequence_length, batch_size) + # scaled_dot_product_attention expects attention_mask shape to be + # (batch, heads, source_length, target_length) + attention_mask = attention_mask.view(batch_size, attn.heads, -1, attention_mask.shape[-1]) + + # the output of sdp = (batch, num_heads, seq_len, head_dim) + # TODO: add support for attn.scale when we move to Torch 2.1 + hidden_states = F.scaled_dot_product_attention( + query, key, value, attn_mask=attention_mask, dropout_p=0.0, is_causal=False + ) + + hidden_states = hidden_states.transpose(1, 2).reshape(batch_size, -1, attn.heads * head_dim) + hidden_states = hidden_states.to(query.dtype) + + # linear proj + hidden_states = attn.to_out[0](hidden_states) + # dropout + hidden_states = attn.to_out[1](hidden_states) + + if input_ndim == 4: + hidden_states = hidden_states.transpose(-1, -2).reshape(batch_size, channel, height, width) + + if attn.residual_connection: + hidden_states = hidden_states + residual + + hidden_states = hidden_states / attn.rescale_output_factor + + return hidden_states + +def val2list(x: list or tuple or any, repeat_time=1) -> list: # type: ignore + """Repeat `val` for `repeat_time` times and return the list or val if list/tuple.""" + if isinstance(x, (list, tuple)): + return list(x) + return [x for _ in range(repeat_time)] + + +def val2tuple(x: list or tuple or any, min_len: int = 1, idx_repeat: int = -1) -> tuple: # type: ignore + """Return tuple with min_len by repeating element at idx_repeat.""" + # convert to list first + x = val2list(x) + + # repeat elements if necessary + if len(x) > 0: + x[idx_repeat:idx_repeat] = [x[idx_repeat] for _ in range(min_len - len(x))] + + return tuple(x) + + +def t2i_modulate(x, shift, scale): + return x * (1 + scale) + shift + + +def get_same_padding(kernel_size: Union[int, Tuple[int, ...]]) -> Union[int, Tuple[int, ...]]: + if isinstance(kernel_size, tuple): + return tuple([get_same_padding(ks) for ks in kernel_size]) + else: + assert kernel_size % 2 > 0, f"kernel size {kernel_size} should be odd number" + return kernel_size // 2 + +class ConvLayer(nn.Module): + def __init__( + self, + in_dim: int, + out_dim: int, + kernel_size=3, + stride=1, + dilation=1, + groups=1, + padding: Union[int, None] = None, + use_bias=False, + norm=None, + act=None, + dtype=None, device=None, operations=None + ): + super().__init__() + if padding is None: + padding = get_same_padding(kernel_size) + padding *= dilation + + self.in_dim = in_dim + self.out_dim = out_dim + self.kernel_size = kernel_size + self.stride = stride + self.dilation = dilation + self.groups = groups + self.padding = padding + self.use_bias = use_bias + + self.conv = operations.Conv1d( + in_dim, + out_dim, + kernel_size=kernel_size, + stride=stride, + padding=padding, + dilation=dilation, + groups=groups, + bias=use_bias, + device=device, + dtype=dtype + ) + if norm is not None: + self.norm = operations.RMSNorm(out_dim, elementwise_affine=False, dtype=dtype, device=device) + else: + self.norm = None + if act is not None: + self.act = nn.SiLU(inplace=True) + else: + self.act = None + + def forward(self, x: torch.Tensor) -> torch.Tensor: + x = self.conv(x) + if self.norm: + x = self.norm(x) + if self.act: + x = self.act(x) + return x + + +class GLUMBConv(nn.Module): + def __init__( + self, + in_features: int, + hidden_features: int, + out_feature=None, + kernel_size=3, + stride=1, + padding: Union[int, None] = None, + use_bias=False, + norm=(None, None, None), + act=("silu", "silu", None), + dilation=1, + dtype=None, device=None, operations=None + ): + out_feature = out_feature or in_features + super().__init__() + use_bias = val2tuple(use_bias, 3) + norm = val2tuple(norm, 3) + act = val2tuple(act, 3) + + self.glu_act = nn.SiLU(inplace=False) + self.inverted_conv = ConvLayer( + in_features, + hidden_features * 2, + 1, + use_bias=use_bias[0], + norm=norm[0], + act=act[0], + dtype=dtype, + device=device, + operations=operations, + ) + self.depth_conv = ConvLayer( + hidden_features * 2, + hidden_features * 2, + kernel_size, + stride=stride, + groups=hidden_features * 2, + padding=padding, + use_bias=use_bias[1], + norm=norm[1], + act=None, + dilation=dilation, + dtype=dtype, + device=device, + operations=operations, + ) + self.point_conv = ConvLayer( + hidden_features, + out_feature, + 1, + use_bias=use_bias[2], + norm=norm[2], + act=act[2], + dtype=dtype, + device=device, + operations=operations, + ) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + x = x.transpose(1, 2) + x = self.inverted_conv(x) + x = self.depth_conv(x) + + x, gate = torch.chunk(x, 2, dim=1) + gate = self.glu_act(gate) + x = x * gate + + x = self.point_conv(x) + x = x.transpose(1, 2) + + return x + + +class LinearTransformerBlock(nn.Module): + """ + A Sana block with global shared adaptive layer norm (adaLN-single) conditioning. + """ + def __init__( + self, + dim, + num_attention_heads, + attention_head_dim, + use_adaln_single=True, + cross_attention_dim=None, + added_kv_proj_dim=None, + context_pre_only=False, + mlp_ratio=4.0, + add_cross_attention=False, + add_cross_attention_dim=None, + qk_norm=None, + dtype=None, device=None, operations=None + ): + super().__init__() + + self.norm1 = operations.RMSNorm(dim, elementwise_affine=False, eps=1e-6) + self.attn = Attention( + query_dim=dim, + cross_attention_dim=cross_attention_dim, + added_kv_proj_dim=added_kv_proj_dim, + dim_head=attention_head_dim, + heads=num_attention_heads, + out_dim=dim, + bias=True, + qk_norm=qk_norm, + processor=CustomLiteLAProcessor2_0(), + dtype=dtype, + device=device, + operations=operations, + ) + + self.add_cross_attention = add_cross_attention + self.context_pre_only = context_pre_only + + if add_cross_attention and add_cross_attention_dim is not None: + self.cross_attn = Attention( + query_dim=dim, + cross_attention_dim=add_cross_attention_dim, + added_kv_proj_dim=add_cross_attention_dim, + dim_head=attention_head_dim, + heads=num_attention_heads, + out_dim=dim, + context_pre_only=context_pre_only, + bias=True, + qk_norm=qk_norm, + processor=CustomerAttnProcessor2_0(), + dtype=dtype, + device=device, + operations=operations, + ) + + self.norm2 = operations.RMSNorm(dim, 1e-06, elementwise_affine=False) + + self.ff = GLUMBConv( + in_features=dim, + hidden_features=int(dim * mlp_ratio), + use_bias=(True, True, False), + norm=(None, None, None), + act=("silu", "silu", None), + dtype=dtype, + device=device, + operations=operations, + ) + self.use_adaln_single = use_adaln_single + if use_adaln_single: + self.scale_shift_table = nn.Parameter(torch.empty(6, dim, dtype=dtype, device=device)) + + def forward( + self, + hidden_states: torch.FloatTensor, + encoder_hidden_states: torch.FloatTensor = None, + attention_mask: torch.FloatTensor = None, + encoder_attention_mask: torch.FloatTensor = None, + rotary_freqs_cis: Union[torch.Tensor, Tuple[torch.Tensor]] = None, + rotary_freqs_cis_cross: Union[torch.Tensor, Tuple[torch.Tensor]] = None, + temb: torch.FloatTensor = None, + ): + + N = hidden_states.shape[0] + + # step 1: AdaLN single + if self.use_adaln_single: + shift_msa, scale_msa, gate_msa, shift_mlp, scale_mlp, gate_mlp = ( + comfy.model_management.cast_to(self.scale_shift_table[None], dtype=temb.dtype, device=temb.device) + temb.reshape(N, 6, -1) + ).chunk(6, dim=1) + + norm_hidden_states = self.norm1(hidden_states) + if self.use_adaln_single: + norm_hidden_states = norm_hidden_states * (1 + scale_msa) + shift_msa + + # step 2: attention + if not self.add_cross_attention: + attn_output, encoder_hidden_states = self.attn( + hidden_states=norm_hidden_states, + attention_mask=attention_mask, + encoder_hidden_states=encoder_hidden_states, + encoder_attention_mask=encoder_attention_mask, + rotary_freqs_cis=rotary_freqs_cis, + rotary_freqs_cis_cross=rotary_freqs_cis_cross, + ) + else: + attn_output, _ = self.attn( + hidden_states=norm_hidden_states, + attention_mask=attention_mask, + encoder_hidden_states=None, + encoder_attention_mask=None, + rotary_freqs_cis=rotary_freqs_cis, + rotary_freqs_cis_cross=None, + ) + + if self.use_adaln_single: + attn_output = gate_msa * attn_output + hidden_states = attn_output + hidden_states + + if self.add_cross_attention: + attn_output = self.cross_attn( + hidden_states=hidden_states, + attention_mask=attention_mask, + encoder_hidden_states=encoder_hidden_states, + encoder_attention_mask=encoder_attention_mask, + rotary_freqs_cis=rotary_freqs_cis, + rotary_freqs_cis_cross=rotary_freqs_cis_cross, + ) + hidden_states = attn_output + hidden_states + + # step 3: add norm + norm_hidden_states = self.norm2(hidden_states) + if self.use_adaln_single: + norm_hidden_states = norm_hidden_states * (1 + scale_mlp) + shift_mlp + + # step 4: feed forward + ff_output = self.ff(norm_hidden_states) + if self.use_adaln_single: + ff_output = gate_mlp * ff_output + + hidden_states = hidden_states + ff_output + + return hidden_states diff --git a/comfy/ldm/ace/lyric_encoder.py b/comfy/ldm/ace/lyric_encoder.py new file mode 100644 index 000000000..ff4359b26 --- /dev/null +++ b/comfy/ldm/ace/lyric_encoder.py @@ -0,0 +1,1067 @@ +# Original from: https://github.com/ace-step/ACE-Step/blob/main/models/lyrics_utils/lyric_encoder.py +from typing import Optional, Tuple, Union +import math +import torch +from torch import nn + +import comfy.model_management + +class ConvolutionModule(nn.Module): + """ConvolutionModule in Conformer model.""" + + def __init__(self, + channels: int, + kernel_size: int = 15, + activation: nn.Module = nn.ReLU(), + norm: str = "batch_norm", + causal: bool = False, + bias: bool = True, + dtype=None, device=None, operations=None): + """Construct an ConvolutionModule object. + Args: + channels (int): The number of channels of conv layers. + kernel_size (int): Kernel size of conv layers. + causal (int): Whether use causal convolution or not + """ + super().__init__() + + self.pointwise_conv1 = operations.Conv1d( + channels, + 2 * channels, + kernel_size=1, + stride=1, + padding=0, + bias=bias, + dtype=dtype, device=device + ) + # self.lorder is used to distinguish if it's a causal convolution, + # if self.lorder > 0: it's a causal convolution, the input will be + # padded with self.lorder frames on the left in forward. + # else: it's a symmetrical convolution + if causal: + padding = 0 + self.lorder = kernel_size - 1 + else: + # kernel_size should be an odd number for none causal convolution + assert (kernel_size - 1) % 2 == 0 + padding = (kernel_size - 1) // 2 + self.lorder = 0 + self.depthwise_conv = operations.Conv1d( + channels, + channels, + kernel_size, + stride=1, + padding=padding, + groups=channels, + bias=bias, + dtype=dtype, device=device + ) + + assert norm in ['batch_norm', 'layer_norm'] + if norm == "batch_norm": + self.use_layer_norm = False + self.norm = nn.BatchNorm1d(channels) + else: + self.use_layer_norm = True + self.norm = operations.LayerNorm(channels, dtype=dtype, device=device) + + self.pointwise_conv2 = operations.Conv1d( + channels, + channels, + kernel_size=1, + stride=1, + padding=0, + bias=bias, + dtype=dtype, device=device + ) + self.activation = activation + + def forward( + self, + x: torch.Tensor, + mask_pad: torch.Tensor = torch.ones((0, 0, 0), dtype=torch.bool), + cache: torch.Tensor = torch.zeros((0, 0, 0)), + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute convolution module. + Args: + x (torch.Tensor): Input tensor (#batch, time, channels). + mask_pad (torch.Tensor): used for batch padding (#batch, 1, time), + (0, 0, 0) means fake mask. + cache (torch.Tensor): left context cache, it is only + used in causal convolution (#batch, channels, cache_t), + (0, 0, 0) meas fake cache. + Returns: + torch.Tensor: Output tensor (#batch, time, channels). + """ + # exchange the temporal dimension and the feature dimension + x = x.transpose(1, 2) # (#batch, channels, time) + + # mask batch padding + if mask_pad.size(2) > 0: # time > 0 + x.masked_fill_(~mask_pad, 0.0) + + if self.lorder > 0: + if cache.size(2) == 0: # cache_t == 0 + x = nn.functional.pad(x, (self.lorder, 0), 'constant', 0.0) + else: + assert cache.size(0) == x.size(0) # equal batch + assert cache.size(1) == x.size(1) # equal channel + x = torch.cat((cache, x), dim=2) + assert (x.size(2) > self.lorder) + new_cache = x[:, :, -self.lorder:] + else: + # It's better we just return None if no cache is required, + # However, for JIT export, here we just fake one tensor instead of + # None. + new_cache = torch.zeros((0, 0, 0), dtype=x.dtype, device=x.device) + + # GLU mechanism + x = self.pointwise_conv1(x) # (batch, 2*channel, dim) + x = nn.functional.glu(x, dim=1) # (batch, channel, dim) + + # 1D Depthwise Conv + x = self.depthwise_conv(x) + if self.use_layer_norm: + x = x.transpose(1, 2) + x = self.activation(self.norm(x)) + if self.use_layer_norm: + x = x.transpose(1, 2) + x = self.pointwise_conv2(x) + # mask batch padding + if mask_pad.size(2) > 0: # time > 0 + x.masked_fill_(~mask_pad, 0.0) + + return x.transpose(1, 2), new_cache + +class PositionwiseFeedForward(torch.nn.Module): + """Positionwise feed forward layer. + + FeedForward are appied on each position of the sequence. + The output dim is same with the input dim. + + Args: + idim (int): Input dimenstion. + hidden_units (int): The number of hidden units. + dropout_rate (float): Dropout rate. + activation (torch.nn.Module): Activation function + """ + + def __init__( + self, + idim: int, + hidden_units: int, + dropout_rate: float, + activation: torch.nn.Module = torch.nn.ReLU(), + dtype=None, device=None, operations=None + ): + """Construct a PositionwiseFeedForward object.""" + super(PositionwiseFeedForward, self).__init__() + self.w_1 = operations.Linear(idim, hidden_units, dtype=dtype, device=device) + self.activation = activation + self.dropout = torch.nn.Dropout(dropout_rate) + self.w_2 = operations.Linear(hidden_units, idim, dtype=dtype, device=device) + + def forward(self, xs: torch.Tensor) -> torch.Tensor: + """Forward function. + + Args: + xs: input tensor (B, L, D) + Returns: + output tensor, (B, L, D) + """ + return self.w_2(self.dropout(self.activation(self.w_1(xs)))) + +class Swish(torch.nn.Module): + """Construct an Swish object.""" + + def forward(self, x: torch.Tensor) -> torch.Tensor: + """Return Swish activation function.""" + return x * torch.sigmoid(x) + +class MultiHeadedAttention(nn.Module): + """Multi-Head Attention layer. + + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + + """ + + def __init__(self, + n_head: int, + n_feat: int, + dropout_rate: float, + key_bias: bool = True, + dtype=None, device=None, operations=None): + """Construct an MultiHeadedAttention object.""" + super().__init__() + assert n_feat % n_head == 0 + # We assume d_v always equals d_k + self.d_k = n_feat // n_head + self.h = n_head + self.linear_q = operations.Linear(n_feat, n_feat, dtype=dtype, device=device) + self.linear_k = operations.Linear(n_feat, n_feat, bias=key_bias, dtype=dtype, device=device) + self.linear_v = operations.Linear(n_feat, n_feat, dtype=dtype, device=device) + self.linear_out = operations.Linear(n_feat, n_feat, dtype=dtype, device=device) + self.dropout = nn.Dropout(p=dropout_rate) + + def forward_qkv( + self, query: torch.Tensor, key: torch.Tensor, value: torch.Tensor + ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]: + """Transform query, key and value. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + + Returns: + torch.Tensor: Transformed query tensor, size + (#batch, n_head, time1, d_k). + torch.Tensor: Transformed key tensor, size + (#batch, n_head, time2, d_k). + torch.Tensor: Transformed value tensor, size + (#batch, n_head, time2, d_k). + + """ + n_batch = query.size(0) + q = self.linear_q(query).view(n_batch, -1, self.h, self.d_k) + k = self.linear_k(key).view(n_batch, -1, self.h, self.d_k) + v = self.linear_v(value).view(n_batch, -1, self.h, self.d_k) + q = q.transpose(1, 2) # (batch, head, time1, d_k) + k = k.transpose(1, 2) # (batch, head, time2, d_k) + v = v.transpose(1, 2) # (batch, head, time2, d_k) + return q, k, v + + def forward_attention( + self, + value: torch.Tensor, + scores: torch.Tensor, + mask: torch.Tensor = torch.ones((0, 0, 0), dtype=torch.bool) + ) -> torch.Tensor: + """Compute attention context vector. + + Args: + value (torch.Tensor): Transformed value, size + (#batch, n_head, time2, d_k). + scores (torch.Tensor): Attention score, size + (#batch, n_head, time1, time2). + mask (torch.Tensor): Mask, size (#batch, 1, time2) or + (#batch, time1, time2), (0, 0, 0) means fake mask. + + Returns: + torch.Tensor: Transformed value (#batch, time1, d_model) + weighted by the attention score (#batch, time1, time2). + + """ + n_batch = value.size(0) + + if mask is not None and mask.size(2) > 0: # time2 > 0 + mask = mask.unsqueeze(1).eq(0) # (batch, 1, *, time2) + # For last chunk, time2 might be larger than scores.size(-1) + mask = mask[:, :, :, :scores.size(-1)] # (batch, 1, *, time2) + scores = scores.masked_fill(mask, -float('inf')) + attn = torch.softmax(scores, dim=-1).masked_fill( + mask, 0.0) # (batch, head, time1, time2) + + else: + attn = torch.softmax(scores, dim=-1) # (batch, head, time1, time2) + + p_attn = self.dropout(attn) + x = torch.matmul(p_attn, value) # (batch, head, time1, d_k) + x = (x.transpose(1, 2).contiguous().view(n_batch, -1, + self.h * self.d_k) + ) # (batch, time1, d_model) + + return self.linear_out(x) # (batch, time1, d_model) + + def forward( + self, + query: torch.Tensor, + key: torch.Tensor, + value: torch.Tensor, + mask: torch.Tensor = torch.ones((0, 0, 0), dtype=torch.bool), + pos_emb: torch.Tensor = torch.empty(0), + cache: torch.Tensor = torch.zeros((0, 0, 0, 0)) + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute scaled dot product attention. + + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2). + 1.When applying cross attention between decoder and encoder, + the batch padding mask for input is in (#batch, 1, T) shape. + 2.When applying self attention of encoder, + the mask is in (#batch, T, T) shape. + 3.When applying self attention of decoder, + the mask is in (#batch, L, L) shape. + 4.If the different position in decoder see different block + of the encoder, such as Mocha, the passed in mask could be + in (#batch, L, T) shape. But there is no such case in current + CosyVoice. + cache (torch.Tensor): Cache tensor (1, head, cache_t, d_k * 2), + where `cache_t == chunk_size * num_decoding_left_chunks` + and `head * d_k == size` + + + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + torch.Tensor: Cache tensor (1, head, cache_t + time1, d_k * 2) + where `cache_t == chunk_size * num_decoding_left_chunks` + and `head * d_k == size` + + """ + q, k, v = self.forward_qkv(query, key, value) + if cache.size(0) > 0: + key_cache, value_cache = torch.split(cache, + cache.size(-1) // 2, + dim=-1) + k = torch.cat([key_cache, k], dim=2) + v = torch.cat([value_cache, v], dim=2) + new_cache = torch.cat((k, v), dim=-1) + + scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(self.d_k) + return self.forward_attention(v, scores, mask), new_cache + + +class RelPositionMultiHeadedAttention(MultiHeadedAttention): + """Multi-Head Attention layer with relative position encoding. + Paper: https://arxiv.org/abs/1901.02860 + Args: + n_head (int): The number of heads. + n_feat (int): The number of features. + dropout_rate (float): Dropout rate. + """ + + def __init__(self, + n_head: int, + n_feat: int, + dropout_rate: float, + key_bias: bool = True, + dtype=None, device=None, operations=None): + """Construct an RelPositionMultiHeadedAttention object.""" + super().__init__(n_head, n_feat, dropout_rate, key_bias, dtype=dtype, device=device, operations=operations) + # linear transformation for positional encoding + self.linear_pos = operations.Linear(n_feat, n_feat, bias=False, dtype=dtype, device=device) + # these two learnable bias are used in matrix c and matrix d + # as described in https://arxiv.org/abs/1901.02860 Section 3.3 + self.pos_bias_u = nn.Parameter(torch.empty(self.h, self.d_k, dtype=dtype, device=device)) + self.pos_bias_v = nn.Parameter(torch.empty(self.h, self.d_k, dtype=dtype, device=device)) + # torch.nn.init.xavier_uniform_(self.pos_bias_u) + # torch.nn.init.xavier_uniform_(self.pos_bias_v) + + def rel_shift(self, x: torch.Tensor) -> torch.Tensor: + """Compute relative positional encoding. + + Args: + x (torch.Tensor): Input tensor (batch, head, time1, 2*time1-1). + time1 means the length of query vector. + + Returns: + torch.Tensor: Output tensor. + + """ + zero_pad = torch.zeros((x.size()[0], x.size()[1], x.size()[2], 1), + device=x.device, + dtype=x.dtype) + x_padded = torch.cat([zero_pad, x], dim=-1) + + x_padded = x_padded.view(x.size()[0], + x.size()[1], + x.size(3) + 1, x.size(2)) + x = x_padded[:, :, 1:].view_as(x)[ + :, :, :, : x.size(-1) // 2 + 1 + ] # only keep the positions from 0 to time2 + return x + + def forward( + self, + query: torch.Tensor, + key: torch.Tensor, + value: torch.Tensor, + mask: torch.Tensor = torch.ones((0, 0, 0), dtype=torch.bool), + pos_emb: torch.Tensor = torch.empty(0), + cache: torch.Tensor = torch.zeros((0, 0, 0, 0)) + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Compute 'Scaled Dot Product Attention' with rel. positional encoding. + Args: + query (torch.Tensor): Query tensor (#batch, time1, size). + key (torch.Tensor): Key tensor (#batch, time2, size). + value (torch.Tensor): Value tensor (#batch, time2, size). + mask (torch.Tensor): Mask tensor (#batch, 1, time2) or + (#batch, time1, time2), (0, 0, 0) means fake mask. + pos_emb (torch.Tensor): Positional embedding tensor + (#batch, time2, size). + cache (torch.Tensor): Cache tensor (1, head, cache_t, d_k * 2), + where `cache_t == chunk_size * num_decoding_left_chunks` + and `head * d_k == size` + Returns: + torch.Tensor: Output tensor (#batch, time1, d_model). + torch.Tensor: Cache tensor (1, head, cache_t + time1, d_k * 2) + where `cache_t == chunk_size * num_decoding_left_chunks` + and `head * d_k == size` + """ + q, k, v = self.forward_qkv(query, key, value) + q = q.transpose(1, 2) # (batch, time1, head, d_k) + + if cache.size(0) > 0: + key_cache, value_cache = torch.split(cache, + cache.size(-1) // 2, + dim=-1) + k = torch.cat([key_cache, k], dim=2) + v = torch.cat([value_cache, v], dim=2) + # NOTE(xcsong): We do cache slicing in encoder.forward_chunk, since it's + # non-trivial to calculate `next_cache_start` here. + new_cache = torch.cat((k, v), dim=-1) + + n_batch_pos = pos_emb.size(0) + p = self.linear_pos(pos_emb).view(n_batch_pos, -1, self.h, self.d_k) + p = p.transpose(1, 2) # (batch, head, time1, d_k) + + # (batch, head, time1, d_k) + q_with_bias_u = (q + comfy.model_management.cast_to(self.pos_bias_u, dtype=q.dtype, device=q.device)).transpose(1, 2) + # (batch, head, time1, d_k) + q_with_bias_v = (q + comfy.model_management.cast_to(self.pos_bias_v, dtype=q.dtype, device=q.device)).transpose(1, 2) + + # compute attention score + # first compute matrix a and matrix c + # as described in https://arxiv.org/abs/1901.02860 Section 3.3 + # (batch, head, time1, time2) + matrix_ac = torch.matmul(q_with_bias_u, k.transpose(-2, -1)) + + # compute matrix b and matrix d + # (batch, head, time1, time2) + matrix_bd = torch.matmul(q_with_bias_v, p.transpose(-2, -1)) + # NOTE(Xiang Lyu): Keep rel_shift since espnet rel_pos_emb is used + if matrix_ac.shape != matrix_bd.shape: + matrix_bd = self.rel_shift(matrix_bd) + + scores = (matrix_ac + matrix_bd) / math.sqrt( + self.d_k) # (batch, head, time1, time2) + + return self.forward_attention(v, scores, mask), new_cache + + + +def subsequent_mask( + size: int, + device: torch.device = torch.device("cpu"), +) -> torch.Tensor: + """Create mask for subsequent steps (size, size). + + This mask is used only in decoder which works in an auto-regressive mode. + This means the current step could only do attention with its left steps. + + In encoder, fully attention is used when streaming is not necessary and + the sequence is not long. In this case, no attention mask is needed. + + When streaming is need, chunk-based attention is used in encoder. See + subsequent_chunk_mask for the chunk-based attention mask. + + Args: + size (int): size of mask + str device (str): "cpu" or "cuda" or torch.Tensor.device + dtype (torch.device): result dtype + + Returns: + torch.Tensor: mask + + Examples: + >>> subsequent_mask(3) + [[1, 0, 0], + [1, 1, 0], + [1, 1, 1]] + """ + arange = torch.arange(size, device=device) + mask = arange.expand(size, size) + arange = arange.unsqueeze(-1) + mask = mask <= arange + return mask + + +def subsequent_chunk_mask( + size: int, + chunk_size: int, + num_left_chunks: int = -1, + device: torch.device = torch.device("cpu"), + ) -> torch.Tensor: + """Create mask for subsequent steps (size, size) with chunk size, + this is for streaming encoder + + Args: + size (int): size of mask + chunk_size (int): size of chunk + num_left_chunks (int): number of left chunks + <0: use full chunk + >=0: use num_left_chunks + device (torch.device): "cpu" or "cuda" or torch.Tensor.device + + Returns: + torch.Tensor: mask + + Examples: + >>> subsequent_chunk_mask(4, 2) + [[1, 1, 0, 0], + [1, 1, 0, 0], + [1, 1, 1, 1], + [1, 1, 1, 1]] + """ + ret = torch.zeros(size, size, device=device, dtype=torch.bool) + for i in range(size): + if num_left_chunks < 0: + start = 0 + else: + start = max((i // chunk_size - num_left_chunks) * chunk_size, 0) + ending = min((i // chunk_size + 1) * chunk_size, size) + ret[i, start:ending] = True + return ret + +def add_optional_chunk_mask(xs: torch.Tensor, + masks: torch.Tensor, + use_dynamic_chunk: bool, + use_dynamic_left_chunk: bool, + decoding_chunk_size: int, + static_chunk_size: int, + num_decoding_left_chunks: int, + enable_full_context: bool = True): + """ Apply optional mask for encoder. + + Args: + xs (torch.Tensor): padded input, (B, L, D), L for max length + mask (torch.Tensor): mask for xs, (B, 1, L) + use_dynamic_chunk (bool): whether to use dynamic chunk or not + use_dynamic_left_chunk (bool): whether to use dynamic left chunk for + training. + decoding_chunk_size (int): decoding chunk size for dynamic chunk, it's + 0: default for training, use random dynamic chunk. + <0: for decoding, use full chunk. + >0: for decoding, use fixed chunk size as set. + static_chunk_size (int): chunk size for static chunk training/decoding + if it's greater than 0, if use_dynamic_chunk is true, + this parameter will be ignored + num_decoding_left_chunks: number of left chunks, this is for decoding, + the chunk size is decoding_chunk_size. + >=0: use num_decoding_left_chunks + <0: use all left chunks + enable_full_context (bool): + True: chunk size is either [1, 25] or full context(max_len) + False: chunk size ~ U[1, 25] + + Returns: + torch.Tensor: chunk mask of the input xs. + """ + # Whether to use chunk mask or not + if use_dynamic_chunk: + max_len = xs.size(1) + if decoding_chunk_size < 0: + chunk_size = max_len + num_left_chunks = -1 + elif decoding_chunk_size > 0: + chunk_size = decoding_chunk_size + num_left_chunks = num_decoding_left_chunks + else: + # chunk size is either [1, 25] or full context(max_len). + # Since we use 4 times subsampling and allow up to 1s(100 frames) + # delay, the maximum frame is 100 / 4 = 25. + chunk_size = torch.randint(1, max_len, (1, )).item() + num_left_chunks = -1 + if chunk_size > max_len // 2 and enable_full_context: + chunk_size = max_len + else: + chunk_size = chunk_size % 25 + 1 + if use_dynamic_left_chunk: + max_left_chunks = (max_len - 1) // chunk_size + num_left_chunks = torch.randint(0, max_left_chunks, + (1, )).item() + chunk_masks = subsequent_chunk_mask(xs.size(1), chunk_size, + num_left_chunks, + xs.device) # (L, L) + chunk_masks = chunk_masks.unsqueeze(0) # (1, L, L) + chunk_masks = masks & chunk_masks # (B, L, L) + elif static_chunk_size > 0: + num_left_chunks = num_decoding_left_chunks + chunk_masks = subsequent_chunk_mask(xs.size(1), static_chunk_size, + num_left_chunks, + xs.device) # (L, L) + chunk_masks = chunk_masks.unsqueeze(0) # (1, L, L) + chunk_masks = masks & chunk_masks # (B, L, L) + else: + chunk_masks = masks + return chunk_masks + + +class ConformerEncoderLayer(nn.Module): + """Encoder layer module. + Args: + size (int): Input dimension. + self_attn (torch.nn.Module): Self-attention module instance. + `MultiHeadedAttention` or `RelPositionMultiHeadedAttention` + instance can be used as the argument. + feed_forward (torch.nn.Module): Feed-forward module instance. + `PositionwiseFeedForward` instance can be used as the argument. + feed_forward_macaron (torch.nn.Module): Additional feed-forward module + instance. + `PositionwiseFeedForward` instance can be used as the argument. + conv_module (torch.nn.Module): Convolution module instance. + `ConvlutionModule` instance can be used as the argument. + dropout_rate (float): Dropout rate. + normalize_before (bool): + True: use layer_norm before each sub-block. + False: use layer_norm after each sub-block. + """ + + def __init__( + self, + size: int, + self_attn: torch.nn.Module, + feed_forward: Optional[nn.Module] = None, + feed_forward_macaron: Optional[nn.Module] = None, + conv_module: Optional[nn.Module] = None, + dropout_rate: float = 0.1, + normalize_before: bool = True, + dtype=None, device=None, operations=None + ): + """Construct an EncoderLayer object.""" + super().__init__() + self.self_attn = self_attn + self.feed_forward = feed_forward + self.feed_forward_macaron = feed_forward_macaron + self.conv_module = conv_module + self.norm_ff = operations.LayerNorm(size, eps=1e-5, dtype=dtype, device=device) # for the FNN module + self.norm_mha = operations.LayerNorm(size, eps=1e-5, dtype=dtype, device=device) # for the MHA module + if feed_forward_macaron is not None: + self.norm_ff_macaron = operations.LayerNorm(size, eps=1e-5, dtype=dtype, device=device) + self.ff_scale = 0.5 + else: + self.ff_scale = 1.0 + if self.conv_module is not None: + self.norm_conv = operations.LayerNorm(size, eps=1e-5, dtype=dtype, device=device) # for the CNN module + self.norm_final = operations.LayerNorm( + size, eps=1e-5, dtype=dtype, device=device) # for the final output of the block + self.dropout = nn.Dropout(dropout_rate) + self.size = size + self.normalize_before = normalize_before + + def forward( + self, + x: torch.Tensor, + mask: torch.Tensor, + pos_emb: torch.Tensor, + mask_pad: torch.Tensor = torch.ones((0, 0, 0), dtype=torch.bool), + att_cache: torch.Tensor = torch.zeros((0, 0, 0, 0)), + cnn_cache: torch.Tensor = torch.zeros((0, 0, 0, 0)), + ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]: + """Compute encoded features. + + Args: + x (torch.Tensor): (#batch, time, size) + mask (torch.Tensor): Mask tensor for the input (#batch, time,time), + (0, 0, 0) means fake mask. + pos_emb (torch.Tensor): positional encoding, must not be None + for ConformerEncoderLayer. + mask_pad (torch.Tensor): batch padding mask used for conv module. + (#batch, 1,time), (0, 0, 0) means fake mask. + att_cache (torch.Tensor): Cache tensor of the KEY & VALUE + (#batch=1, head, cache_t1, d_k * 2), head * d_k == size. + cnn_cache (torch.Tensor): Convolution cache in conformer layer + (#batch=1, size, cache_t2) + Returns: + torch.Tensor: Output tensor (#batch, time, size). + torch.Tensor: Mask tensor (#batch, time, time). + torch.Tensor: att_cache tensor, + (#batch=1, head, cache_t1 + time, d_k * 2). + torch.Tensor: cnn_cahce tensor (#batch, size, cache_t2). + """ + + # whether to use macaron style + if self.feed_forward_macaron is not None: + residual = x + if self.normalize_before: + x = self.norm_ff_macaron(x) + x = residual + self.ff_scale * self.dropout( + self.feed_forward_macaron(x)) + if not self.normalize_before: + x = self.norm_ff_macaron(x) + + # multi-headed self-attention module + residual = x + if self.normalize_before: + x = self.norm_mha(x) + x_att, new_att_cache = self.self_attn(x, x, x, mask, pos_emb, + att_cache) + x = residual + self.dropout(x_att) + if not self.normalize_before: + x = self.norm_mha(x) + + # convolution module + # Fake new cnn cache here, and then change it in conv_module + new_cnn_cache = torch.zeros((0, 0, 0), dtype=x.dtype, device=x.device) + if self.conv_module is not None: + residual = x + if self.normalize_before: + x = self.norm_conv(x) + x, new_cnn_cache = self.conv_module(x, mask_pad, cnn_cache) + x = residual + self.dropout(x) + + if not self.normalize_before: + x = self.norm_conv(x) + + # feed forward module + residual = x + if self.normalize_before: + x = self.norm_ff(x) + + x = residual + self.ff_scale * self.dropout(self.feed_forward(x)) + if not self.normalize_before: + x = self.norm_ff(x) + + if self.conv_module is not None: + x = self.norm_final(x) + + return x, mask, new_att_cache, new_cnn_cache + + + +class EspnetRelPositionalEncoding(torch.nn.Module): + """Relative positional encoding module (new implementation). + + Details can be found in https://github.com/espnet/espnet/pull/2816. + + See : Appendix B in https://arxiv.org/abs/1901.02860 + + Args: + d_model (int): Embedding dimension. + dropout_rate (float): Dropout rate. + max_len (int): Maximum input length. + + """ + + def __init__(self, d_model: int, dropout_rate: float, max_len: int = 5000): + """Construct an PositionalEncoding object.""" + super(EspnetRelPositionalEncoding, self).__init__() + self.d_model = d_model + self.xscale = math.sqrt(self.d_model) + self.dropout = torch.nn.Dropout(p=dropout_rate) + self.pe = None + self.extend_pe(torch.tensor(0.0).expand(1, max_len)) + + def extend_pe(self, x: torch.Tensor): + """Reset the positional encodings.""" + if self.pe is not None: + # self.pe contains both positive and negative parts + # the length of self.pe is 2 * input_len - 1 + if self.pe.size(1) >= x.size(1) * 2 - 1: + if self.pe.dtype != x.dtype or self.pe.device != x.device: + self.pe = self.pe.to(dtype=x.dtype, device=x.device) + return + # Suppose `i` means to the position of query vecotr and `j` means the + # position of key vector. We use position relative positions when keys + # are to the left (i>j) and negative relative positions otherwise (i Tuple[torch.Tensor, torch.Tensor]: + """Add positional encoding. + + Args: + x (torch.Tensor): Input tensor (batch, time, `*`). + + Returns: + torch.Tensor: Encoded tensor (batch, time, `*`). + + """ + self.extend_pe(x) + x = x * self.xscale + pos_emb = self.position_encoding(size=x.size(1), offset=offset) + return self.dropout(x), self.dropout(pos_emb) + + def position_encoding(self, + offset: Union[int, torch.Tensor], + size: int) -> torch.Tensor: + """ For getting encoding in a streaming fashion + + Attention!!!!! + we apply dropout only once at the whole utterance level in a none + streaming way, but will call this function several times with + increasing input size in a streaming scenario, so the dropout will + be applied several times. + + Args: + offset (int or torch.tensor): start offset + size (int): required size of position encoding + + Returns: + torch.Tensor: Corresponding encoding + """ + pos_emb = self.pe[ + :, + self.pe.size(1) // 2 - size + 1: self.pe.size(1) // 2 + size, + ] + return pos_emb + + + +class LinearEmbed(torch.nn.Module): + """Linear transform the input without subsampling + + Args: + idim (int): Input dimension. + odim (int): Output dimension. + dropout_rate (float): Dropout rate. + + """ + + def __init__(self, idim: int, odim: int, dropout_rate: float, + pos_enc_class: torch.nn.Module, dtype=None, device=None, operations=None): + """Construct an linear object.""" + super().__init__() + self.out = torch.nn.Sequential( + operations.Linear(idim, odim, dtype=dtype, device=device), + operations.LayerNorm(odim, eps=1e-5, dtype=dtype, device=device), + torch.nn.Dropout(dropout_rate), + ) + self.pos_enc = pos_enc_class #rel_pos_espnet + + def position_encoding(self, offset: Union[int, torch.Tensor], + size: int) -> torch.Tensor: + return self.pos_enc.position_encoding(offset, size) + + def forward( + self, + x: torch.Tensor, + offset: Union[int, torch.Tensor] = 0 + ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]: + """Input x. + + Args: + x (torch.Tensor): Input tensor (#batch, time, idim). + x_mask (torch.Tensor): Input mask (#batch, 1, time). + + Returns: + torch.Tensor: linear input tensor (#batch, time', odim), + where time' = time . + torch.Tensor: linear input mask (#batch, 1, time'), + where time' = time . + + """ + x = self.out(x) + x, pos_emb = self.pos_enc(x, offset) + return x, pos_emb + + +ATTENTION_CLASSES = { + "selfattn": MultiHeadedAttention, + "rel_selfattn": RelPositionMultiHeadedAttention, +} + +ACTIVATION_CLASSES = { + "hardtanh": torch.nn.Hardtanh, + "tanh": torch.nn.Tanh, + "relu": torch.nn.ReLU, + "selu": torch.nn.SELU, + "swish": getattr(torch.nn, "SiLU", Swish), + "gelu": torch.nn.GELU, +} + + +def make_pad_mask(lengths: torch.Tensor, max_len: int = 0) -> torch.Tensor: + """Make mask tensor containing indices of padded part. + + See description of make_non_pad_mask. + + Args: + lengths (torch.Tensor): Batch of lengths (B,). + Returns: + torch.Tensor: Mask tensor containing indices of padded part. + + Examples: + >>> lengths = [5, 3, 2] + >>> make_pad_mask(lengths) + masks = [[0, 0, 0, 0 ,0], + [0, 0, 0, 1, 1], + [0, 0, 1, 1, 1]] + """ + batch_size = lengths.size(0) + max_len = max_len if max_len > 0 else lengths.max().item() + seq_range = torch.arange(0, + max_len, + dtype=torch.int64, + device=lengths.device) + seq_range_expand = seq_range.unsqueeze(0).expand(batch_size, max_len) + seq_length_expand = lengths.unsqueeze(-1) + mask = seq_range_expand >= seq_length_expand + return mask + +#https://github.com/FunAudioLLM/CosyVoice/blob/main/examples/magicdata-read/cosyvoice/conf/cosyvoice.yaml +class ConformerEncoder(torch.nn.Module): + """Conformer encoder module.""" + + def __init__( + self, + input_size: int, + output_size: int = 1024, + attention_heads: int = 16, + linear_units: int = 4096, + num_blocks: int = 6, + dropout_rate: float = 0.1, + positional_dropout_rate: float = 0.1, + attention_dropout_rate: float = 0.0, + input_layer: str = 'linear', + pos_enc_layer_type: str = 'rel_pos_espnet', + normalize_before: bool = True, + static_chunk_size: int = 1, # 1: causal_mask; 0: full_mask + use_dynamic_chunk: bool = False, + use_dynamic_left_chunk: bool = False, + positionwise_conv_kernel_size: int = 1, + macaron_style: bool =False, + selfattention_layer_type: str = "rel_selfattn", + activation_type: str = "swish", + use_cnn_module: bool = False, + cnn_module_kernel: int = 15, + causal: bool = False, + cnn_module_norm: str = "batch_norm", + key_bias: bool = True, + dtype=None, device=None, operations=None + ): + """Construct ConformerEncoder + + Args: + input_size to use_dynamic_chunk, see in BaseEncoder + positionwise_conv_kernel_size (int): Kernel size of positionwise + conv1d layer. + macaron_style (bool): Whether to use macaron style for + positionwise layer. + selfattention_layer_type (str): Encoder attention layer type, + the parameter has no effect now, it's just for configure + compatibility. #'rel_selfattn' + activation_type (str): Encoder activation function type. + use_cnn_module (bool): Whether to use convolution module. + cnn_module_kernel (int): Kernel size of convolution module. + causal (bool): whether to use causal convolution or not. + key_bias: whether use bias in attention.linear_k, False for whisper models. + """ + super().__init__() + self.output_size = output_size + self.embed = LinearEmbed(input_size, output_size, dropout_rate, + EspnetRelPositionalEncoding(output_size, positional_dropout_rate), dtype=dtype, device=device, operations=operations) + self.normalize_before = normalize_before + self.after_norm = operations.LayerNorm(output_size, eps=1e-5, dtype=dtype, device=device) + self.use_dynamic_chunk = use_dynamic_chunk + + self.static_chunk_size = static_chunk_size + self.use_dynamic_chunk = use_dynamic_chunk + self.use_dynamic_left_chunk = use_dynamic_left_chunk + activation = ACTIVATION_CLASSES[activation_type]() + + # self-attention module definition + encoder_selfattn_layer_args = ( + attention_heads, + output_size, + attention_dropout_rate, + key_bias, + ) + # feed-forward module definition + positionwise_layer_args = ( + output_size, + linear_units, + dropout_rate, + activation, + ) + # convolution module definition + convolution_layer_args = (output_size, cnn_module_kernel, activation, + cnn_module_norm, causal) + + self.encoders = torch.nn.ModuleList([ + ConformerEncoderLayer( + output_size, + RelPositionMultiHeadedAttention( + *encoder_selfattn_layer_args, dtype=dtype, device=device, operations=operations), + PositionwiseFeedForward(*positionwise_layer_args, dtype=dtype, device=device, operations=operations), + PositionwiseFeedForward( + *positionwise_layer_args, dtype=dtype, device=device, operations=operations) if macaron_style else None, + ConvolutionModule( + *convolution_layer_args, dtype=dtype, device=device, operations=operations) if use_cnn_module else None, + dropout_rate, + normalize_before, dtype=dtype, device=device, operations=operations + ) for _ in range(num_blocks) + ]) + + def forward_layers(self, xs: torch.Tensor, chunk_masks: torch.Tensor, + pos_emb: torch.Tensor, + mask_pad: torch.Tensor) -> torch.Tensor: + for layer in self.encoders: + xs, chunk_masks, _, _ = layer(xs, chunk_masks, pos_emb, mask_pad) + return xs + + def forward( + self, + xs: torch.Tensor, + pad_mask: torch.Tensor, + decoding_chunk_size: int = 0, + num_decoding_left_chunks: int = -1, + ) -> Tuple[torch.Tensor, torch.Tensor]: + """Embed positions in tensor. + + Args: + xs: padded input tensor (B, T, D) + xs_lens: input length (B) + decoding_chunk_size: decoding chunk size for dynamic chunk + 0: default for training, use random dynamic chunk. + <0: for decoding, use full chunk. + >0: for decoding, use fixed chunk size as set. + num_decoding_left_chunks: number of left chunks, this is for decoding, + the chunk size is decoding_chunk_size. + >=0: use num_decoding_left_chunks + <0: use all left chunks + Returns: + encoder output tensor xs, and subsampled masks + xs: padded output tensor (B, T' ~= T/subsample_rate, D) + masks: torch.Tensor batch padding mask after subsample + (B, 1, T' ~= T/subsample_rate) + NOTE(xcsong): + We pass the `__call__` method of the modules instead of `forward` to the + checkpointing API because `__call__` attaches all the hooks of the module. + https://discuss.pytorch.org/t/any-different-between-model-input-and-model-forward-input/3690/2 + """ + masks = None + if pad_mask is not None: + masks = pad_mask.to(torch.bool).unsqueeze(1) # (B, 1, T) + xs, pos_emb = self.embed(xs) + mask_pad = masks # (B, 1, T/subsample_rate) + chunk_masks = add_optional_chunk_mask(xs, masks, + self.use_dynamic_chunk, + self.use_dynamic_left_chunk, + decoding_chunk_size, + self.static_chunk_size, + num_decoding_left_chunks) + + xs = self.forward_layers(xs, chunk_masks, pos_emb, mask_pad) + if self.normalize_before: + xs = self.after_norm(xs) + # Here we assume the mask is not changed in encoder layers, so just + # return the masks before encoder layers, and the masks will be used + # for cross attention with decoder later + return xs, masks + diff --git a/comfy/ldm/ace/model.py b/comfy/ldm/ace/model.py new file mode 100644 index 000000000..e5883df90 --- /dev/null +++ b/comfy/ldm/ace/model.py @@ -0,0 +1,381 @@ +# Original from: https://github.com/ace-step/ACE-Step/blob/main/models/ace_step_transformer.py + +# Copyright 2024 The HuggingFace Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from typing import Optional, List, Union + +import torch +from torch import nn + +import comfy.model_management + +from comfy.ldm.lightricks.model import TimestepEmbedding, Timesteps +from .attention import LinearTransformerBlock, t2i_modulate +from .lyric_encoder import ConformerEncoder as LyricEncoder + + +def cross_norm(hidden_states, controlnet_input): + # input N x T x c + mean_hidden_states, std_hidden_states = hidden_states.mean(dim=(1,2), keepdim=True), hidden_states.std(dim=(1,2), keepdim=True) + mean_controlnet_input, std_controlnet_input = controlnet_input.mean(dim=(1,2), keepdim=True), controlnet_input.std(dim=(1,2), keepdim=True) + controlnet_input = (controlnet_input - mean_controlnet_input) * (std_hidden_states / (std_controlnet_input + 1e-12)) + mean_hidden_states + return controlnet_input + + +# Copied from transformers.models.mixtral.modeling_mixtral.MixtralRotaryEmbedding with Mixtral->Qwen2 +class Qwen2RotaryEmbedding(nn.Module): + def __init__(self, dim, max_position_embeddings=2048, base=10000, dtype=None, device=None): + super().__init__() + + self.dim = dim + self.max_position_embeddings = max_position_embeddings + self.base = base + inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2, dtype=torch.int64, device=device).float() / self.dim)) + self.register_buffer("inv_freq", inv_freq, persistent=False) + + # Build here to make `torch.jit.trace` work. + self._set_cos_sin_cache( + seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.float32 + ) + + def _set_cos_sin_cache(self, seq_len, device, dtype): + self.max_seq_len_cached = seq_len + t = torch.arange(self.max_seq_len_cached, device=device, dtype=torch.int64).type_as(self.inv_freq) + + freqs = torch.outer(t, self.inv_freq) + # Different from paper, but it uses a different permutation in order to obtain the same calculation + emb = torch.cat((freqs, freqs), dim=-1) + self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False) + self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False) + + def forward(self, x, seq_len=None): + # x: [bs, num_attention_heads, seq_len, head_size] + if seq_len > self.max_seq_len_cached: + self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype) + + return ( + self.cos_cached[:seq_len].to(dtype=x.dtype), + self.sin_cached[:seq_len].to(dtype=x.dtype), + ) + + +class T2IFinalLayer(nn.Module): + """ + The final layer of Sana. + """ + + def __init__(self, hidden_size, patch_size=[16, 1], out_channels=256, dtype=None, device=None, operations=None): + super().__init__() + self.norm_final = operations.RMSNorm(hidden_size, elementwise_affine=False, eps=1e-6, dtype=dtype, device=device) + self.linear = operations.Linear(hidden_size, patch_size[0] * patch_size[1] * out_channels, bias=True, dtype=dtype, device=device) + self.scale_shift_table = nn.Parameter(torch.empty(2, hidden_size, dtype=dtype, device=device)) + self.out_channels = out_channels + self.patch_size = patch_size + + def unpatchfy( + self, + hidden_states: torch.Tensor, + width: int, + ): + # 4 unpatchify + new_height, new_width = 1, hidden_states.size(1) + hidden_states = hidden_states.reshape( + shape=(hidden_states.shape[0], new_height, new_width, self.patch_size[0], self.patch_size[1], self.out_channels) + ).contiguous() + hidden_states = torch.einsum("nhwpqc->nchpwq", hidden_states) + output = hidden_states.reshape( + shape=(hidden_states.shape[0], self.out_channels, new_height * self.patch_size[0], new_width * self.patch_size[1]) + ).contiguous() + if width > new_width: + output = torch.nn.functional.pad(output, (0, width - new_width, 0, 0), 'constant', 0) + elif width < new_width: + output = output[:, :, :, :width] + return output + + def forward(self, x, t, output_length): + shift, scale = (comfy.model_management.cast_to(self.scale_shift_table[None], device=t.device, dtype=t.dtype) + t[:, None]).chunk(2, dim=1) + x = t2i_modulate(self.norm_final(x), shift, scale) + x = self.linear(x) + # unpatchify + output = self.unpatchfy(x, output_length) + return output + + +class PatchEmbed(nn.Module): + """2D Image to Patch Embedding""" + + def __init__( + self, + height=16, + width=4096, + patch_size=(16, 1), + in_channels=8, + embed_dim=1152, + bias=True, + dtype=None, device=None, operations=None + ): + super().__init__() + patch_size_h, patch_size_w = patch_size + self.early_conv_layers = nn.Sequential( + operations.Conv2d(in_channels, in_channels*256, kernel_size=patch_size, stride=patch_size, padding=0, bias=bias, dtype=dtype, device=device), + operations.GroupNorm(num_groups=32, num_channels=in_channels*256, eps=1e-6, affine=True, dtype=dtype, device=device), + operations.Conv2d(in_channels*256, embed_dim, kernel_size=1, stride=1, padding=0, bias=bias, dtype=dtype, device=device) + ) + self.patch_size = patch_size + self.height, self.width = height // patch_size_h, width // patch_size_w + self.base_size = self.width + + def forward(self, latent): + # early convolutions, N x C x H x W -> N x 256 * sqrt(patch_size) x H/patch_size x W/patch_size + latent = self.early_conv_layers(latent) + latent = latent.flatten(2).transpose(1, 2) # BCHW -> BNC + return latent + + +class ACEStepTransformer2DModel(nn.Module): + # _supports_gradient_checkpointing = True + + def __init__( + self, + in_channels: Optional[int] = 8, + num_layers: int = 28, + inner_dim: int = 1536, + attention_head_dim: int = 64, + num_attention_heads: int = 24, + mlp_ratio: float = 4.0, + out_channels: int = 8, + max_position: int = 32768, + rope_theta: float = 1000000.0, + speaker_embedding_dim: int = 512, + text_embedding_dim: int = 768, + ssl_encoder_depths: List[int] = [9, 9], + ssl_names: List[str] = ["mert", "m-hubert"], + ssl_latent_dims: List[int] = [1024, 768], + lyric_encoder_vocab_size: int = 6681, + lyric_hidden_size: int = 1024, + patch_size: List[int] = [16, 1], + max_height: int = 16, + max_width: int = 4096, + audio_model=None, + dtype=None, device=None, operations=None + + ): + super().__init__() + + self.dtype = dtype + self.num_attention_heads = num_attention_heads + self.attention_head_dim = attention_head_dim + inner_dim = num_attention_heads * attention_head_dim + self.inner_dim = inner_dim + self.out_channels = out_channels + self.max_position = max_position + self.patch_size = patch_size + + self.rope_theta = rope_theta + + self.rotary_emb = Qwen2RotaryEmbedding( + dim=self.attention_head_dim, + max_position_embeddings=self.max_position, + base=self.rope_theta, + dtype=dtype, + device=device, + ) + + # 2. Define input layers + self.in_channels = in_channels + + self.num_layers = num_layers + # 3. Define transformers blocks + self.transformer_blocks = nn.ModuleList( + [ + LinearTransformerBlock( + dim=self.inner_dim, + num_attention_heads=self.num_attention_heads, + attention_head_dim=attention_head_dim, + mlp_ratio=mlp_ratio, + add_cross_attention=True, + add_cross_attention_dim=self.inner_dim, + dtype=dtype, + device=device, + operations=operations, + ) + for i in range(self.num_layers) + ] + ) + + self.time_proj = Timesteps(num_channels=256, flip_sin_to_cos=True, downscale_freq_shift=0) + self.timestep_embedder = TimestepEmbedding(in_channels=256, time_embed_dim=self.inner_dim, dtype=dtype, device=device, operations=operations) + self.t_block = nn.Sequential(nn.SiLU(), operations.Linear(self.inner_dim, 6 * self.inner_dim, bias=True, dtype=dtype, device=device)) + + # speaker + self.speaker_embedder = operations.Linear(speaker_embedding_dim, self.inner_dim, dtype=dtype, device=device) + + # genre + self.genre_embedder = operations.Linear(text_embedding_dim, self.inner_dim, dtype=dtype, device=device) + + # lyric + self.lyric_embs = operations.Embedding(lyric_encoder_vocab_size, lyric_hidden_size, dtype=dtype, device=device) + self.lyric_encoder = LyricEncoder(input_size=lyric_hidden_size, static_chunk_size=0, dtype=dtype, device=device, operations=operations) + self.lyric_proj = operations.Linear(lyric_hidden_size, self.inner_dim, dtype=dtype, device=device) + + projector_dim = 2 * self.inner_dim + + self.projectors = nn.ModuleList([ + nn.Sequential( + operations.Linear(self.inner_dim, projector_dim, dtype=dtype, device=device), + nn.SiLU(), + operations.Linear(projector_dim, projector_dim, dtype=dtype, device=device), + nn.SiLU(), + operations.Linear(projector_dim, ssl_dim, dtype=dtype, device=device), + ) for ssl_dim in ssl_latent_dims + ]) + + self.proj_in = PatchEmbed( + height=max_height, + width=max_width, + patch_size=patch_size, + embed_dim=self.inner_dim, + bias=True, + dtype=dtype, + device=device, + operations=operations, + ) + + self.final_layer = T2IFinalLayer(self.inner_dim, patch_size=patch_size, out_channels=out_channels, dtype=dtype, device=device, operations=operations) + + def forward_lyric_encoder( + self, + lyric_token_idx: Optional[torch.LongTensor] = None, + lyric_mask: Optional[torch.LongTensor] = None, + out_dtype=None, + ): + # N x T x D + lyric_embs = self.lyric_embs(lyric_token_idx, out_dtype=out_dtype) + prompt_prenet_out, _mask = self.lyric_encoder(lyric_embs, lyric_mask, decoding_chunk_size=1, num_decoding_left_chunks=-1) + prompt_prenet_out = self.lyric_proj(prompt_prenet_out) + return prompt_prenet_out + + def encode( + self, + encoder_text_hidden_states: Optional[torch.Tensor] = None, + text_attention_mask: Optional[torch.LongTensor] = None, + speaker_embeds: Optional[torch.FloatTensor] = None, + lyric_token_idx: Optional[torch.LongTensor] = None, + lyric_mask: Optional[torch.LongTensor] = None, + ): + + bs = encoder_text_hidden_states.shape[0] + device = encoder_text_hidden_states.device + + # speaker embedding + encoder_spk_hidden_states = self.speaker_embedder(speaker_embeds).unsqueeze(1) + + # genre embedding + encoder_text_hidden_states = self.genre_embedder(encoder_text_hidden_states) + + # lyric + encoder_lyric_hidden_states = self.forward_lyric_encoder( + lyric_token_idx=lyric_token_idx, + lyric_mask=lyric_mask, + out_dtype=encoder_text_hidden_states.dtype, + ) + + encoder_hidden_states = torch.cat([encoder_spk_hidden_states, encoder_text_hidden_states, encoder_lyric_hidden_states], dim=1) + + encoder_hidden_mask = None + if text_attention_mask is not None: + speaker_mask = torch.ones(bs, 1, device=device) + encoder_hidden_mask = torch.cat([speaker_mask, text_attention_mask, lyric_mask], dim=1) + + return encoder_hidden_states, encoder_hidden_mask + + def decode( + self, + hidden_states: torch.Tensor, + attention_mask: torch.Tensor, + encoder_hidden_states: torch.Tensor, + encoder_hidden_mask: torch.Tensor, + timestep: Optional[torch.Tensor], + output_length: int = 0, + block_controlnet_hidden_states: Optional[Union[List[torch.Tensor], torch.Tensor]] = None, + controlnet_scale: Union[float, torch.Tensor] = 1.0, + return_dict: bool = True, + ): + embedded_timestep = self.timestep_embedder(self.time_proj(timestep).to(dtype=hidden_states.dtype)) + temb = self.t_block(embedded_timestep) + + hidden_states = self.proj_in(hidden_states) + + # controlnet logic + if block_controlnet_hidden_states is not None: + control_condi = cross_norm(hidden_states, block_controlnet_hidden_states) + hidden_states = hidden_states + control_condi * controlnet_scale + + # inner_hidden_states = [] + + rotary_freqs_cis = self.rotary_emb(hidden_states, seq_len=hidden_states.shape[1]) + encoder_rotary_freqs_cis = self.rotary_emb(encoder_hidden_states, seq_len=encoder_hidden_states.shape[1]) + + for index_block, block in enumerate(self.transformer_blocks): + hidden_states = block( + hidden_states=hidden_states, + attention_mask=attention_mask, + encoder_hidden_states=encoder_hidden_states, + encoder_attention_mask=encoder_hidden_mask, + rotary_freqs_cis=rotary_freqs_cis, + rotary_freqs_cis_cross=encoder_rotary_freqs_cis, + temb=temb, + ) + + output = self.final_layer(hidden_states, embedded_timestep, output_length) + return output + + def forward( + self, + x, + timestep, + attention_mask=None, + context: Optional[torch.Tensor] = None, + text_attention_mask: Optional[torch.LongTensor] = None, + speaker_embeds: Optional[torch.FloatTensor] = None, + lyric_token_idx: Optional[torch.LongTensor] = None, + lyric_mask: Optional[torch.LongTensor] = None, + block_controlnet_hidden_states: Optional[Union[List[torch.Tensor], torch.Tensor]] = None, + controlnet_scale: Union[float, torch.Tensor] = 1.0, + **kwargs + ): + hidden_states = x + encoder_text_hidden_states = context + encoder_hidden_states, encoder_hidden_mask = self.encode( + encoder_text_hidden_states=encoder_text_hidden_states, + text_attention_mask=text_attention_mask, + speaker_embeds=speaker_embeds, + lyric_token_idx=lyric_token_idx, + lyric_mask=lyric_mask, + ) + + output_length = hidden_states.shape[-1] + + output = self.decode( + hidden_states=hidden_states, + attention_mask=attention_mask, + encoder_hidden_states=encoder_hidden_states, + encoder_hidden_mask=encoder_hidden_mask, + timestep=timestep, + output_length=output_length, + block_controlnet_hidden_states=block_controlnet_hidden_states, + controlnet_scale=controlnet_scale, + ) + + return output diff --git a/comfy/ldm/ace/vae/autoencoder_dc.py b/comfy/ldm/ace/vae/autoencoder_dc.py new file mode 100644 index 000000000..e7b1d4801 --- /dev/null +++ b/comfy/ldm/ace/vae/autoencoder_dc.py @@ -0,0 +1,644 @@ +# Rewritten from diffusers +import torch +import torch.nn as nn +import torch.nn.functional as F +from typing import Tuple, Union + +import comfy.model_management +import comfy.ops +ops = comfy.ops.disable_weight_init + + +class RMSNorm(ops.RMSNorm): + def __init__(self, dim, eps=1e-5, elementwise_affine=True, bias=False): + super().__init__(dim, eps=eps, elementwise_affine=elementwise_affine) + if elementwise_affine: + self.bias = nn.Parameter(torch.empty(dim)) if bias else None + + def forward(self, x): + x = super().forward(x) + if self.elementwise_affine: + if self.bias is not None: + x = x + comfy.model_management.cast_to(self.bias, dtype=x.dtype, device=x.device) + return x + + +def get_normalization(norm_type, num_features, num_groups=32, eps=1e-5): + if norm_type == "batch_norm": + return nn.BatchNorm2d(num_features) + elif norm_type == "group_norm": + return ops.GroupNorm(num_groups, num_features) + elif norm_type == "layer_norm": + return ops.LayerNorm(num_features) + elif norm_type == "rms_norm": + return RMSNorm(num_features, eps=eps, elementwise_affine=True, bias=True) + else: + raise ValueError(f"Unknown normalization type: {norm_type}") + + +def get_activation(activation_type): + if activation_type == "relu": + return nn.ReLU() + elif activation_type == "relu6": + return nn.ReLU6() + elif activation_type == "silu": + return nn.SiLU() + elif activation_type == "leaky_relu": + return nn.LeakyReLU(0.2) + else: + raise ValueError(f"Unknown activation type: {activation_type}") + + +class ResBlock(nn.Module): + def __init__( + self, + in_channels: int, + out_channels: int, + norm_type: str = "batch_norm", + act_fn: str = "relu6", + ) -> None: + super().__init__() + + self.norm_type = norm_type + self.nonlinearity = get_activation(act_fn) if act_fn is not None else nn.Identity() + self.conv1 = ops.Conv2d(in_channels, in_channels, 3, 1, 1) + self.conv2 = ops.Conv2d(in_channels, out_channels, 3, 1, 1, bias=False) + self.norm = get_normalization(norm_type, out_channels) + + def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: + residual = hidden_states + hidden_states = self.conv1(hidden_states) + hidden_states = self.nonlinearity(hidden_states) + hidden_states = self.conv2(hidden_states) + + if self.norm_type == "rms_norm": + # move channel to the last dimension so we apply RMSnorm across channel dimension + hidden_states = self.norm(hidden_states.movedim(1, -1)).movedim(-1, 1) + else: + hidden_states = self.norm(hidden_states) + + return hidden_states + residual + +class SanaMultiscaleAttentionProjection(nn.Module): + def __init__( + self, + in_channels: int, + num_attention_heads: int, + kernel_size: int, + ) -> None: + super().__init__() + + channels = 3 * in_channels + self.proj_in = ops.Conv2d( + channels, + channels, + kernel_size, + padding=kernel_size // 2, + groups=channels, + bias=False, + ) + self.proj_out = ops.Conv2d(channels, channels, 1, 1, 0, groups=3 * num_attention_heads, bias=False) + + def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: + hidden_states = self.proj_in(hidden_states) + hidden_states = self.proj_out(hidden_states) + return hidden_states + +class SanaMultiscaleLinearAttention(nn.Module): + def __init__( + self, + in_channels: int, + out_channels: int, + num_attention_heads: int = None, + attention_head_dim: int = 8, + mult: float = 1.0, + norm_type: str = "batch_norm", + kernel_sizes: tuple = (5,), + eps: float = 1e-15, + residual_connection: bool = False, + ): + super().__init__() + + self.eps = eps + self.attention_head_dim = attention_head_dim + self.norm_type = norm_type + self.residual_connection = residual_connection + + num_attention_heads = ( + int(in_channels // attention_head_dim * mult) + if num_attention_heads is None + else num_attention_heads + ) + inner_dim = num_attention_heads * attention_head_dim + + self.to_q = ops.Linear(in_channels, inner_dim, bias=False) + self.to_k = ops.Linear(in_channels, inner_dim, bias=False) + self.to_v = ops.Linear(in_channels, inner_dim, bias=False) + + self.to_qkv_multiscale = nn.ModuleList() + for kernel_size in kernel_sizes: + self.to_qkv_multiscale.append( + SanaMultiscaleAttentionProjection(inner_dim, num_attention_heads, kernel_size) + ) + + self.nonlinearity = nn.ReLU() + self.to_out = ops.Linear(inner_dim * (1 + len(kernel_sizes)), out_channels, bias=False) + self.norm_out = get_normalization(norm_type, out_channels) + + def apply_linear_attention(self, query, key, value): + value = F.pad(value, (0, 0, 0, 1), mode="constant", value=1) + scores = torch.matmul(value, key.transpose(-1, -2)) + hidden_states = torch.matmul(scores, query) + + hidden_states = hidden_states.to(dtype=torch.float32) + hidden_states = hidden_states[:, :, :-1] / (hidden_states[:, :, -1:] + self.eps) + return hidden_states + + def apply_quadratic_attention(self, query, key, value): + scores = torch.matmul(key.transpose(-1, -2), query) + scores = scores.to(dtype=torch.float32) + scores = scores / (torch.sum(scores, dim=2, keepdim=True) + self.eps) + hidden_states = torch.matmul(value, scores.to(value.dtype)) + return hidden_states + + def forward(self, hidden_states): + height, width = hidden_states.shape[-2:] + if height * width > self.attention_head_dim: + use_linear_attention = True + else: + use_linear_attention = False + + residual = hidden_states + + batch_size, _, height, width = list(hidden_states.size()) + original_dtype = hidden_states.dtype + + hidden_states = hidden_states.movedim(1, -1) + query = self.to_q(hidden_states) + key = self.to_k(hidden_states) + value = self.to_v(hidden_states) + hidden_states = torch.cat([query, key, value], dim=3) + hidden_states = hidden_states.movedim(-1, 1) + + multi_scale_qkv = [hidden_states] + for block in self.to_qkv_multiscale: + multi_scale_qkv.append(block(hidden_states)) + + hidden_states = torch.cat(multi_scale_qkv, dim=1) + + if use_linear_attention: + # for linear attention upcast hidden_states to float32 + hidden_states = hidden_states.to(dtype=torch.float32) + + hidden_states = hidden_states.reshape(batch_size, -1, 3 * self.attention_head_dim, height * width) + + query, key, value = hidden_states.chunk(3, dim=2) + query = self.nonlinearity(query) + key = self.nonlinearity(key) + + if use_linear_attention: + hidden_states = self.apply_linear_attention(query, key, value) + hidden_states = hidden_states.to(dtype=original_dtype) + else: + hidden_states = self.apply_quadratic_attention(query, key, value) + + hidden_states = torch.reshape(hidden_states, (batch_size, -1, height, width)) + hidden_states = self.to_out(hidden_states.movedim(1, -1)).movedim(-1, 1) + + if self.norm_type == "rms_norm": + hidden_states = self.norm_out(hidden_states.movedim(1, -1)).movedim(-1, 1) + else: + hidden_states = self.norm_out(hidden_states) + + if self.residual_connection: + hidden_states = hidden_states + residual + + return hidden_states + + +class EfficientViTBlock(nn.Module): + def __init__( + self, + in_channels: int, + mult: float = 1.0, + attention_head_dim: int = 32, + qkv_multiscales: tuple = (5,), + norm_type: str = "batch_norm", + ) -> None: + super().__init__() + + self.attn = SanaMultiscaleLinearAttention( + in_channels=in_channels, + out_channels=in_channels, + mult=mult, + attention_head_dim=attention_head_dim, + norm_type=norm_type, + kernel_sizes=qkv_multiscales, + residual_connection=True, + ) + + self.conv_out = GLUMBConv( + in_channels=in_channels, + out_channels=in_channels, + norm_type="rms_norm", + ) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + x = self.attn(x) + x = self.conv_out(x) + return x + + +class GLUMBConv(nn.Module): + def __init__( + self, + in_channels: int, + out_channels: int, + expand_ratio: float = 4, + norm_type: str = None, + residual_connection: bool = True, + ) -> None: + super().__init__() + + hidden_channels = int(expand_ratio * in_channels) + self.norm_type = norm_type + self.residual_connection = residual_connection + + self.nonlinearity = nn.SiLU() + self.conv_inverted = ops.Conv2d(in_channels, hidden_channels * 2, 1, 1, 0) + self.conv_depth = ops.Conv2d(hidden_channels * 2, hidden_channels * 2, 3, 1, 1, groups=hidden_channels * 2) + self.conv_point = ops.Conv2d(hidden_channels, out_channels, 1, 1, 0, bias=False) + + self.norm = None + if norm_type == "rms_norm": + self.norm = RMSNorm(out_channels, eps=1e-5, elementwise_affine=True, bias=True) + + def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: + if self.residual_connection: + residual = hidden_states + + hidden_states = self.conv_inverted(hidden_states) + hidden_states = self.nonlinearity(hidden_states) + + hidden_states = self.conv_depth(hidden_states) + hidden_states, gate = torch.chunk(hidden_states, 2, dim=1) + hidden_states = hidden_states * self.nonlinearity(gate) + + hidden_states = self.conv_point(hidden_states) + + if self.norm_type == "rms_norm": + # move channel to the last dimension so we apply RMSnorm across channel dimension + hidden_states = self.norm(hidden_states.movedim(1, -1)).movedim(-1, 1) + + if self.residual_connection: + hidden_states = hidden_states + residual + + return hidden_states + + +def get_block( + block_type: str, + in_channels: int, + out_channels: int, + attention_head_dim: int, + norm_type: str, + act_fn: str, + qkv_mutliscales: tuple = (), +): + if block_type == "ResBlock": + block = ResBlock(in_channels, out_channels, norm_type, act_fn) + elif block_type == "EfficientViTBlock": + block = EfficientViTBlock( + in_channels, + attention_head_dim=attention_head_dim, + norm_type=norm_type, + qkv_multiscales=qkv_mutliscales + ) + else: + raise ValueError(f"Block with {block_type=} is not supported.") + + return block + + +class DCDownBlock2d(nn.Module): + def __init__(self, in_channels: int, out_channels: int, downsample: bool = False, shortcut: bool = True) -> None: + super().__init__() + + self.downsample = downsample + self.factor = 2 + self.stride = 1 if downsample else 2 + self.group_size = in_channels * self.factor**2 // out_channels + self.shortcut = shortcut + + out_ratio = self.factor**2 + if downsample: + assert out_channels % out_ratio == 0 + out_channels = out_channels // out_ratio + + self.conv = ops.Conv2d( + in_channels, + out_channels, + kernel_size=3, + stride=self.stride, + padding=1, + ) + + def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: + x = self.conv(hidden_states) + if self.downsample: + x = F.pixel_unshuffle(x, self.factor) + + if self.shortcut: + y = F.pixel_unshuffle(hidden_states, self.factor) + y = y.unflatten(1, (-1, self.group_size)) + y = y.mean(dim=2) + hidden_states = x + y + else: + hidden_states = x + + return hidden_states + + +class DCUpBlock2d(nn.Module): + def __init__( + self, + in_channels: int, + out_channels: int, + interpolate: bool = False, + shortcut: bool = True, + interpolation_mode: str = "nearest", + ) -> None: + super().__init__() + + self.interpolate = interpolate + self.interpolation_mode = interpolation_mode + self.shortcut = shortcut + self.factor = 2 + self.repeats = out_channels * self.factor**2 // in_channels + + out_ratio = self.factor**2 + if not interpolate: + out_channels = out_channels * out_ratio + + self.conv = ops.Conv2d(in_channels, out_channels, 3, 1, 1) + + def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: + if self.interpolate: + x = F.interpolate(hidden_states, scale_factor=self.factor, mode=self.interpolation_mode) + x = self.conv(x) + else: + x = self.conv(hidden_states) + x = F.pixel_shuffle(x, self.factor) + + if self.shortcut: + y = hidden_states.repeat_interleave(self.repeats, dim=1, output_size=hidden_states.shape[1] * self.repeats) + y = F.pixel_shuffle(y, self.factor) + hidden_states = x + y + else: + hidden_states = x + + return hidden_states + + +class Encoder(nn.Module): + def __init__( + self, + in_channels: int, + latent_channels: int, + attention_head_dim: int = 32, + block_type: str or tuple = "ResBlock", + block_out_channels: tuple = (128, 256, 512, 512, 1024, 1024), + layers_per_block: tuple = (2, 2, 2, 2, 2, 2), + qkv_multiscales: tuple = ((), (), (), (5,), (5,), (5,)), + downsample_block_type: str = "pixel_unshuffle", + out_shortcut: bool = True, + ): + super().__init__() + + num_blocks = len(block_out_channels) + + if isinstance(block_type, str): + block_type = (block_type,) * num_blocks + + if layers_per_block[0] > 0: + self.conv_in = ops.Conv2d( + in_channels, + block_out_channels[0] if layers_per_block[0] > 0 else block_out_channels[1], + kernel_size=3, + stride=1, + padding=1, + ) + else: + self.conv_in = DCDownBlock2d( + in_channels=in_channels, + out_channels=block_out_channels[0] if layers_per_block[0] > 0 else block_out_channels[1], + downsample=downsample_block_type == "pixel_unshuffle", + shortcut=False, + ) + + down_blocks = [] + for i, (out_channel, num_layers) in enumerate(zip(block_out_channels, layers_per_block)): + down_block_list = [] + + for _ in range(num_layers): + block = get_block( + block_type[i], + out_channel, + out_channel, + attention_head_dim=attention_head_dim, + norm_type="rms_norm", + act_fn="silu", + qkv_mutliscales=qkv_multiscales[i], + ) + down_block_list.append(block) + + if i < num_blocks - 1 and num_layers > 0: + downsample_block = DCDownBlock2d( + in_channels=out_channel, + out_channels=block_out_channels[i + 1], + downsample=downsample_block_type == "pixel_unshuffle", + shortcut=True, + ) + down_block_list.append(downsample_block) + + down_blocks.append(nn.Sequential(*down_block_list)) + + self.down_blocks = nn.ModuleList(down_blocks) + + self.conv_out = ops.Conv2d(block_out_channels[-1], latent_channels, 3, 1, 1) + + self.out_shortcut = out_shortcut + if out_shortcut: + self.out_shortcut_average_group_size = block_out_channels[-1] // latent_channels + + def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: + hidden_states = self.conv_in(hidden_states) + for down_block in self.down_blocks: + hidden_states = down_block(hidden_states) + + if self.out_shortcut: + x = hidden_states.unflatten(1, (-1, self.out_shortcut_average_group_size)) + x = x.mean(dim=2) + hidden_states = self.conv_out(hidden_states) + x + else: + hidden_states = self.conv_out(hidden_states) + + return hidden_states + + +class Decoder(nn.Module): + def __init__( + self, + in_channels: int, + latent_channels: int, + attention_head_dim: int = 32, + block_type: str or tuple = "ResBlock", + block_out_channels: tuple = (128, 256, 512, 512, 1024, 1024), + layers_per_block: tuple = (2, 2, 2, 2, 2, 2), + qkv_multiscales: tuple = ((), (), (), (5,), (5,), (5,)), + norm_type: str or tuple = "rms_norm", + act_fn: str or tuple = "silu", + upsample_block_type: str = "pixel_shuffle", + in_shortcut: bool = True, + ): + super().__init__() + + num_blocks = len(block_out_channels) + + if isinstance(block_type, str): + block_type = (block_type,) * num_blocks + if isinstance(norm_type, str): + norm_type = (norm_type,) * num_blocks + if isinstance(act_fn, str): + act_fn = (act_fn,) * num_blocks + + self.conv_in = ops.Conv2d(latent_channels, block_out_channels[-1], 3, 1, 1) + + self.in_shortcut = in_shortcut + if in_shortcut: + self.in_shortcut_repeats = block_out_channels[-1] // latent_channels + + up_blocks = [] + for i, (out_channel, num_layers) in reversed(list(enumerate(zip(block_out_channels, layers_per_block)))): + up_block_list = [] + + if i < num_blocks - 1 and num_layers > 0: + upsample_block = DCUpBlock2d( + block_out_channels[i + 1], + out_channel, + interpolate=upsample_block_type == "interpolate", + shortcut=True, + ) + up_block_list.append(upsample_block) + + for _ in range(num_layers): + block = get_block( + block_type[i], + out_channel, + out_channel, + attention_head_dim=attention_head_dim, + norm_type=norm_type[i], + act_fn=act_fn[i], + qkv_mutliscales=qkv_multiscales[i], + ) + up_block_list.append(block) + + up_blocks.insert(0, nn.Sequential(*up_block_list)) + + self.up_blocks = nn.ModuleList(up_blocks) + + channels = block_out_channels[0] if layers_per_block[0] > 0 else block_out_channels[1] + + self.norm_out = RMSNorm(channels, 1e-5, elementwise_affine=True, bias=True) + self.conv_act = nn.ReLU() + self.conv_out = None + + if layers_per_block[0] > 0: + self.conv_out = ops.Conv2d(channels, in_channels, 3, 1, 1) + else: + self.conv_out = DCUpBlock2d( + channels, in_channels, interpolate=upsample_block_type == "interpolate", shortcut=False + ) + + def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: + if self.in_shortcut: + x = hidden_states.repeat_interleave( + self.in_shortcut_repeats, dim=1, output_size=hidden_states.shape[1] * self.in_shortcut_repeats + ) + hidden_states = self.conv_in(hidden_states) + x + else: + hidden_states = self.conv_in(hidden_states) + + for up_block in reversed(self.up_blocks): + hidden_states = up_block(hidden_states) + + hidden_states = self.norm_out(hidden_states.movedim(1, -1)).movedim(-1, 1) + hidden_states = self.conv_act(hidden_states) + hidden_states = self.conv_out(hidden_states) + return hidden_states + + +class AutoencoderDC(nn.Module): + def __init__( + self, + in_channels: int = 2, + latent_channels: int = 8, + attention_head_dim: int = 32, + encoder_block_types: Union[str, Tuple[str]] = ["ResBlock", "ResBlock", "ResBlock", "EfficientViTBlock"], + decoder_block_types: Union[str, Tuple[str]] = ["ResBlock", "ResBlock", "ResBlock", "EfficientViTBlock"], + encoder_block_out_channels: Tuple[int, ...] = (128, 256, 512, 1024), + decoder_block_out_channels: Tuple[int, ...] = (128, 256, 512, 1024), + encoder_layers_per_block: Tuple[int] = (2, 2, 3, 3), + decoder_layers_per_block: Tuple[int] = (3, 3, 3, 3), + encoder_qkv_multiscales: Tuple[Tuple[int, ...], ...] = ((), (), (5,), (5,)), + decoder_qkv_multiscales: Tuple[Tuple[int, ...], ...] = ((), (), (5,), (5,)), + upsample_block_type: str = "interpolate", + downsample_block_type: str = "Conv", + decoder_norm_types: Union[str, Tuple[str]] = "rms_norm", + decoder_act_fns: Union[str, Tuple[str]] = "silu", + scaling_factor: float = 0.41407, + ) -> None: + super().__init__() + + self.encoder = Encoder( + in_channels=in_channels, + latent_channels=latent_channels, + attention_head_dim=attention_head_dim, + block_type=encoder_block_types, + block_out_channels=encoder_block_out_channels, + layers_per_block=encoder_layers_per_block, + qkv_multiscales=encoder_qkv_multiscales, + downsample_block_type=downsample_block_type, + ) + + self.decoder = Decoder( + in_channels=in_channels, + latent_channels=latent_channels, + attention_head_dim=attention_head_dim, + block_type=decoder_block_types, + block_out_channels=decoder_block_out_channels, + layers_per_block=decoder_layers_per_block, + qkv_multiscales=decoder_qkv_multiscales, + norm_type=decoder_norm_types, + act_fn=decoder_act_fns, + upsample_block_type=upsample_block_type, + ) + + self.scaling_factor = scaling_factor + self.spatial_compression_ratio = 2 ** (len(encoder_block_out_channels) - 1) + + def encode(self, x: torch.Tensor) -> torch.Tensor: + """Internal encoding function.""" + encoded = self.encoder(x) + return encoded * self.scaling_factor + + def decode(self, z: torch.Tensor) -> torch.Tensor: + # Scale the latents back + z = z / self.scaling_factor + decoded = self.decoder(z) + return decoded + + def forward(self, x: torch.Tensor) -> torch.Tensor: + z = self.encode(x) + return self.decode(z) + diff --git a/comfy/ldm/ace/vae/music_dcae_pipeline.py b/comfy/ldm/ace/vae/music_dcae_pipeline.py new file mode 100644 index 000000000..3188bc770 --- /dev/null +++ b/comfy/ldm/ace/vae/music_dcae_pipeline.py @@ -0,0 +1,104 @@ +# Original from: https://github.com/ace-step/ACE-Step/blob/main/music_dcae/music_dcae_pipeline.py +import torch +from .autoencoder_dc import AutoencoderDC +import torchaudio +import torchvision.transforms as transforms +from .music_vocoder import ADaMoSHiFiGANV1 + + +class MusicDCAE(torch.nn.Module): + def __init__(self, source_sample_rate=None, dcae_config={}, vocoder_config={}): + super(MusicDCAE, self).__init__() + + self.dcae = AutoencoderDC(**dcae_config) + self.vocoder = ADaMoSHiFiGANV1(**vocoder_config) + + if source_sample_rate is None: + self.source_sample_rate = 48000 + else: + self.source_sample_rate = source_sample_rate + + # self.resampler = torchaudio.transforms.Resample(source_sample_rate, 44100) + + self.transform = transforms.Compose([ + transforms.Normalize(0.5, 0.5), + ]) + self.min_mel_value = -11.0 + self.max_mel_value = 3.0 + self.audio_chunk_size = int(round((1024 * 512 / 44100 * 48000))) + self.mel_chunk_size = 1024 + self.time_dimention_multiple = 8 + self.latent_chunk_size = self.mel_chunk_size // self.time_dimention_multiple + self.scale_factor = 0.1786 + self.shift_factor = -1.9091 + + def load_audio(self, audio_path): + audio, sr = torchaudio.load(audio_path) + return audio, sr + + def forward_mel(self, audios): + mels = [] + for i in range(len(audios)): + image = self.vocoder.mel_transform(audios[i]) + mels.append(image) + mels = torch.stack(mels) + return mels + + @torch.no_grad() + def encode(self, audios, audio_lengths=None, sr=None): + if audio_lengths is None: + audio_lengths = torch.tensor([audios.shape[2]] * audios.shape[0]) + audio_lengths = audio_lengths.to(audios.device) + + if sr is None: + sr = self.source_sample_rate + + if sr != 44100: + audios = torchaudio.functional.resample(audios, sr, 44100) + + max_audio_len = audios.shape[-1] + if max_audio_len % (8 * 512) != 0: + audios = torch.nn.functional.pad(audios, (0, 8 * 512 - max_audio_len % (8 * 512))) + + mels = self.forward_mel(audios) + mels = (mels - self.min_mel_value) / (self.max_mel_value - self.min_mel_value) + mels = self.transform(mels) + latents = [] + for mel in mels: + latent = self.dcae.encoder(mel.unsqueeze(0)) + latents.append(latent) + latents = torch.cat(latents, dim=0) + # latent_lengths = (audio_lengths / sr * 44100 / 512 / self.time_dimention_multiple).long() + latents = (latents - self.shift_factor) * self.scale_factor + return latents + # return latents, latent_lengths + + @torch.no_grad() + def decode(self, latents, audio_lengths=None, sr=None): + latents = latents / self.scale_factor + self.shift_factor + + pred_wavs = [] + + for latent in latents: + mels = self.dcae.decoder(latent.unsqueeze(0)) + mels = mels * 0.5 + 0.5 + mels = mels * (self.max_mel_value - self.min_mel_value) + self.min_mel_value + wav = self.vocoder.decode(mels[0]).squeeze(1) + + if sr is not None: + # resampler = torchaudio.transforms.Resample(44100, sr).to(latents.device).to(latents.dtype) + wav = torchaudio.functional.resample(wav, 44100, sr) + # wav = resampler(wav) + else: + sr = 44100 + pred_wavs.append(wav) + + if audio_lengths is not None: + pred_wavs = [wav[:, :length].cpu() for wav, length in zip(pred_wavs, audio_lengths)] + return torch.stack(pred_wavs) + # return sr, pred_wavs + + def forward(self, audios, audio_lengths=None, sr=None): + latents, latent_lengths = self.encode(audios=audios, audio_lengths=audio_lengths, sr=sr) + sr, pred_wavs = self.decode(latents=latents, audio_lengths=audio_lengths, sr=sr) + return sr, pred_wavs, latents, latent_lengths diff --git a/comfy/ldm/ace/vae/music_log_mel.py b/comfy/ldm/ace/vae/music_log_mel.py new file mode 100755 index 000000000..d73d3f8e8 --- /dev/null +++ b/comfy/ldm/ace/vae/music_log_mel.py @@ -0,0 +1,108 @@ +# Original from: https://github.com/ace-step/ACE-Step/blob/main/music_dcae/music_log_mel.py +import torch +import torch.nn as nn +from torch import Tensor +from torchaudio.transforms import MelScale +import comfy.model_management + +class LinearSpectrogram(nn.Module): + def __init__( + self, + n_fft=2048, + win_length=2048, + hop_length=512, + center=False, + mode="pow2_sqrt", + ): + super().__init__() + + self.n_fft = n_fft + self.win_length = win_length + self.hop_length = hop_length + self.center = center + self.mode = mode + + self.register_buffer("window", torch.hann_window(win_length)) + + def forward(self, y: Tensor) -> Tensor: + if y.ndim == 3: + y = y.squeeze(1) + + y = torch.nn.functional.pad( + y.unsqueeze(1), + ( + (self.win_length - self.hop_length) // 2, + (self.win_length - self.hop_length + 1) // 2, + ), + mode="reflect", + ).squeeze(1) + dtype = y.dtype + spec = torch.stft( + y.float(), + self.n_fft, + hop_length=self.hop_length, + win_length=self.win_length, + window=comfy.model_management.cast_to(self.window, dtype=torch.float32, device=y.device), + center=self.center, + pad_mode="reflect", + normalized=False, + onesided=True, + return_complex=True, + ) + spec = torch.view_as_real(spec) + + if self.mode == "pow2_sqrt": + spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6) + spec = spec.to(dtype) + return spec + + +class LogMelSpectrogram(nn.Module): + def __init__( + self, + sample_rate=44100, + n_fft=2048, + win_length=2048, + hop_length=512, + n_mels=128, + center=False, + f_min=0.0, + f_max=None, + ): + super().__init__() + + self.sample_rate = sample_rate + self.n_fft = n_fft + self.win_length = win_length + self.hop_length = hop_length + self.center = center + self.n_mels = n_mels + self.f_min = f_min + self.f_max = f_max or sample_rate // 2 + + self.spectrogram = LinearSpectrogram(n_fft, win_length, hop_length, center) + self.mel_scale = MelScale( + self.n_mels, + self.sample_rate, + self.f_min, + self.f_max, + self.n_fft // 2 + 1, + "slaney", + "slaney", + ) + + def compress(self, x: Tensor) -> Tensor: + return torch.log(torch.clamp(x, min=1e-5)) + + def decompress(self, x: Tensor) -> Tensor: + return torch.exp(x) + + def forward(self, x: Tensor, return_linear: bool = False) -> Tensor: + linear = self.spectrogram(x) + x = self.mel_scale(linear) + x = self.compress(x) + # print(x.shape) + if return_linear: + return x, self.compress(linear) + + return x diff --git a/comfy/ldm/ace/vae/music_vocoder.py b/comfy/ldm/ace/vae/music_vocoder.py new file mode 100755 index 000000000..dc7c867da --- /dev/null +++ b/comfy/ldm/ace/vae/music_vocoder.py @@ -0,0 +1,542 @@ +# Original from: https://github.com/ace-step/ACE-Step/blob/main/music_dcae/music_vocoder.py +import torch +from torch import nn + +from functools import partial +from math import prod +from typing import Callable, Tuple, List + +import numpy as np +import torch.nn.functional as F +from torch.nn.utils import weight_norm +from torch.nn.utils.parametrize import remove_parametrizations as remove_weight_norm +# from diffusers.models.modeling_utils import ModelMixin +# from diffusers.loaders import FromOriginalModelMixin +# from diffusers.configuration_utils import ConfigMixin, register_to_config + +from .music_log_mel import LogMelSpectrogram + +import comfy.model_management +import comfy.ops +ops = comfy.ops.disable_weight_init + + +def drop_path( + x, drop_prob: float = 0.0, training: bool = False, scale_by_keep: bool = True +): + """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). + + This is the same as the DropConnect impl I created for EfficientNet, etc networks, however, + the original name is misleading as 'Drop Connect' is a different form of dropout in a separate paper... + See discussion: https://github.com/tensorflow/tpu/issues/494#issuecomment-532968956 ... I've opted for + changing the layer and argument names to 'drop path' rather than mix DropConnect as a layer name and use + 'survival rate' as the argument. + + """ # noqa: E501 + + if drop_prob == 0.0 or not training: + return x + keep_prob = 1 - drop_prob + shape = (x.shape[0],) + (1,) * ( + x.ndim - 1 + ) # work with diff dim tensors, not just 2D ConvNets + random_tensor = x.new_empty(shape).bernoulli_(keep_prob) + if keep_prob > 0.0 and scale_by_keep: + random_tensor.div_(keep_prob) + return x * random_tensor + + +class DropPath(nn.Module): + """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).""" # noqa: E501 + + def __init__(self, drop_prob: float = 0.0, scale_by_keep: bool = True): + super(DropPath, self).__init__() + self.drop_prob = drop_prob + self.scale_by_keep = scale_by_keep + + def forward(self, x): + return drop_path(x, self.drop_prob, self.training, self.scale_by_keep) + + def extra_repr(self): + return f"drop_prob={round(self.drop_prob,3):0.3f}" + + +class LayerNorm(nn.Module): + r"""LayerNorm that supports two data formats: channels_last (default) or channels_first. + The ordering of the dimensions in the inputs. channels_last corresponds to inputs with + shape (batch_size, height, width, channels) while channels_first corresponds to inputs + with shape (batch_size, channels, height, width). + """ # noqa: E501 + + def __init__(self, normalized_shape, eps=1e-6, data_format="channels_last"): + super().__init__() + self.weight = nn.Parameter(torch.ones(normalized_shape)) + self.bias = nn.Parameter(torch.zeros(normalized_shape)) + self.eps = eps + self.data_format = data_format + if self.data_format not in ["channels_last", "channels_first"]: + raise NotImplementedError + self.normalized_shape = (normalized_shape,) + + def forward(self, x): + if self.data_format == "channels_last": + return F.layer_norm( + x, self.normalized_shape, comfy.model_management.cast_to(self.weight, dtype=x.dtype, device=x.device), comfy.model_management.cast_to(self.bias, dtype=x.dtype, device=x.device), self.eps + ) + elif self.data_format == "channels_first": + u = x.mean(1, keepdim=True) + s = (x - u).pow(2).mean(1, keepdim=True) + x = (x - u) / torch.sqrt(s + self.eps) + x = comfy.model_management.cast_to(self.weight[:, None], dtype=x.dtype, device=x.device) * x + comfy.model_management.cast_to(self.bias[:, None], dtype=x.dtype, device=x.device) + return x + + +class ConvNeXtBlock(nn.Module): + r"""ConvNeXt Block. There are two equivalent implementations: + (1) DwConv -> LayerNorm (channels_first) -> 1x1 Conv -> GELU -> 1x1 Conv; all in (N, C, H, W) + (2) DwConv -> Permute to (N, H, W, C); LayerNorm (channels_last) -> Linear -> GELU -> Linear; Permute back + We use (2) as we find it slightly faster in PyTorch + + Args: + dim (int): Number of input channels. + drop_path (float): Stochastic depth rate. Default: 0.0 + layer_scale_init_value (float): Init value for Layer Scale. Default: 1e-6. + mlp_ratio (float): Ratio of mlp hidden dim to embedding dim. Default: 4.0. + kernel_size (int): Kernel size for depthwise conv. Default: 7. + dilation (int): Dilation for depthwise conv. Default: 1. + """ # noqa: E501 + + def __init__( + self, + dim: int, + drop_path: float = 0.0, + layer_scale_init_value: float = 1e-6, + mlp_ratio: float = 4.0, + kernel_size: int = 7, + dilation: int = 1, + ): + super().__init__() + + self.dwconv = ops.Conv1d( + dim, + dim, + kernel_size=kernel_size, + padding=int(dilation * (kernel_size - 1) / 2), + groups=dim, + ) # depthwise conv + self.norm = LayerNorm(dim, eps=1e-6) + self.pwconv1 = ops.Linear( + dim, int(mlp_ratio * dim) + ) # pointwise/1x1 convs, implemented with linear layers + self.act = nn.GELU() + self.pwconv2 = ops.Linear(int(mlp_ratio * dim), dim) + self.gamma = ( + nn.Parameter(torch.empty((dim)), requires_grad=False) + if layer_scale_init_value > 0 + else None + ) + self.drop_path = DropPath( + drop_path) if drop_path > 0.0 else nn.Identity() + + def forward(self, x, apply_residual: bool = True): + input = x + + x = self.dwconv(x) + x = x.permute(0, 2, 1) # (N, C, L) -> (N, L, C) + x = self.norm(x) + x = self.pwconv1(x) + x = self.act(x) + x = self.pwconv2(x) + + if self.gamma is not None: + x = comfy.model_management.cast_to(self.gamma, dtype=x.dtype, device=x.device) * x + + x = x.permute(0, 2, 1) # (N, L, C) -> (N, C, L) + x = self.drop_path(x) + + if apply_residual: + x = input + x + + return x + + +class ParallelConvNeXtBlock(nn.Module): + def __init__(self, kernel_sizes: List[int], *args, **kwargs): + super().__init__() + self.blocks = nn.ModuleList( + [ + ConvNeXtBlock(kernel_size=kernel_size, *args, **kwargs) + for kernel_size in kernel_sizes + ] + ) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + return torch.stack( + [block(x, apply_residual=False) for block in self.blocks] + [x], + dim=1, + ).sum(dim=1) + + +class ConvNeXtEncoder(nn.Module): + def __init__( + self, + input_channels=3, + depths=[3, 3, 9, 3], + dims=[96, 192, 384, 768], + drop_path_rate=0.0, + layer_scale_init_value=1e-6, + kernel_sizes: Tuple[int] = (7,), + ): + super().__init__() + assert len(depths) == len(dims) + + self.channel_layers = nn.ModuleList() + stem = nn.Sequential( + ops.Conv1d( + input_channels, + dims[0], + kernel_size=7, + padding=3, + padding_mode="replicate", + ), + LayerNorm(dims[0], eps=1e-6, data_format="channels_first"), + ) + self.channel_layers.append(stem) + + for i in range(len(depths) - 1): + mid_layer = nn.Sequential( + LayerNorm(dims[i], eps=1e-6, data_format="channels_first"), + ops.Conv1d(dims[i], dims[i + 1], kernel_size=1), + ) + self.channel_layers.append(mid_layer) + + block_fn = ( + partial(ConvNeXtBlock, kernel_size=kernel_sizes[0]) + if len(kernel_sizes) == 1 + else partial(ParallelConvNeXtBlock, kernel_sizes=kernel_sizes) + ) + + self.stages = nn.ModuleList() + drop_path_rates = [ + x.item() for x in torch.linspace(0, drop_path_rate, sum(depths)) + ] + + cur = 0 + for i in range(len(depths)): + stage = nn.Sequential( + *[ + block_fn( + dim=dims[i], + drop_path=drop_path_rates[cur + j], + layer_scale_init_value=layer_scale_init_value, + ) + for j in range(depths[i]) + ] + ) + self.stages.append(stage) + cur += depths[i] + + self.norm = LayerNorm(dims[-1], eps=1e-6, data_format="channels_first") + + def forward( + self, + x: torch.Tensor, + ) -> torch.Tensor: + for channel_layer, stage in zip(self.channel_layers, self.stages): + x = channel_layer(x) + x = stage(x) + + return self.norm(x) + + +def get_padding(kernel_size, dilation=1): + return (kernel_size * dilation - dilation) // 2 + + +class ResBlock1(torch.nn.Module): + def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5)): + super().__init__() + + self.convs1 = nn.ModuleList( + [ + weight_norm( + ops.Conv1d( + channels, + channels, + kernel_size, + 1, + dilation=dilation[0], + padding=get_padding(kernel_size, dilation[0]), + ) + ), + weight_norm( + ops.Conv1d( + channels, + channels, + kernel_size, + 1, + dilation=dilation[1], + padding=get_padding(kernel_size, dilation[1]), + ) + ), + weight_norm( + ops.Conv1d( + channels, + channels, + kernel_size, + 1, + dilation=dilation[2], + padding=get_padding(kernel_size, dilation[2]), + ) + ), + ] + ) + + self.convs2 = nn.ModuleList( + [ + weight_norm( + ops.Conv1d( + channels, + channels, + kernel_size, + 1, + dilation=1, + padding=get_padding(kernel_size, 1), + ) + ), + weight_norm( + ops.Conv1d( + channels, + channels, + kernel_size, + 1, + dilation=1, + padding=get_padding(kernel_size, 1), + ) + ), + weight_norm( + ops.Conv1d( + channels, + channels, + kernel_size, + 1, + dilation=1, + padding=get_padding(kernel_size, 1), + ) + ), + ] + ) + + def forward(self, x): + for c1, c2 in zip(self.convs1, self.convs2): + xt = F.silu(x) + xt = c1(xt) + xt = F.silu(xt) + xt = c2(xt) + x = xt + x + return x + + def remove_weight_norm(self): + for conv in self.convs1: + remove_weight_norm(conv) + for conv in self.convs2: + remove_weight_norm(conv) + + +class HiFiGANGenerator(nn.Module): + def __init__( + self, + *, + hop_length: int = 512, + upsample_rates: Tuple[int] = (8, 8, 2, 2, 2), + upsample_kernel_sizes: Tuple[int] = (16, 16, 8, 2, 2), + resblock_kernel_sizes: Tuple[int] = (3, 7, 11), + resblock_dilation_sizes: Tuple[Tuple[int]] = ( + (1, 3, 5), (1, 3, 5), (1, 3, 5)), + num_mels: int = 128, + upsample_initial_channel: int = 512, + use_template: bool = True, + pre_conv_kernel_size: int = 7, + post_conv_kernel_size: int = 7, + post_activation: Callable = partial(nn.SiLU, inplace=True), + ): + super().__init__() + + assert ( + prod(upsample_rates) == hop_length + ), f"hop_length must be {prod(upsample_rates)}" + + self.conv_pre = weight_norm( + ops.Conv1d( + num_mels, + upsample_initial_channel, + pre_conv_kernel_size, + 1, + padding=get_padding(pre_conv_kernel_size), + ) + ) + + self.num_upsamples = len(upsample_rates) + self.num_kernels = len(resblock_kernel_sizes) + + self.noise_convs = nn.ModuleList() + self.use_template = use_template + self.ups = nn.ModuleList() + + for i, (u, k) in enumerate(zip(upsample_rates, upsample_kernel_sizes)): + c_cur = upsample_initial_channel // (2 ** (i + 1)) + self.ups.append( + weight_norm( + ops.ConvTranspose1d( + upsample_initial_channel // (2**i), + upsample_initial_channel // (2 ** (i + 1)), + k, + u, + padding=(k - u) // 2, + ) + ) + ) + + if not use_template: + continue + + if i + 1 < len(upsample_rates): + stride_f0 = np.prod(upsample_rates[i + 1:]) + self.noise_convs.append( + ops.Conv1d( + 1, + c_cur, + kernel_size=stride_f0 * 2, + stride=stride_f0, + padding=stride_f0 // 2, + ) + ) + else: + self.noise_convs.append(ops.Conv1d(1, c_cur, kernel_size=1)) + + self.resblocks = nn.ModuleList() + for i in range(len(self.ups)): + ch = upsample_initial_channel // (2 ** (i + 1)) + for k, d in zip(resblock_kernel_sizes, resblock_dilation_sizes): + self.resblocks.append(ResBlock1(ch, k, d)) + + self.activation_post = post_activation() + self.conv_post = weight_norm( + ops.Conv1d( + ch, + 1, + post_conv_kernel_size, + 1, + padding=get_padding(post_conv_kernel_size), + ) + ) + + def forward(self, x, template=None): + x = self.conv_pre(x) + + for i in range(self.num_upsamples): + x = F.silu(x, inplace=True) + x = self.ups[i](x) + + if self.use_template: + x = x + self.noise_convs[i](template) + + xs = None + + for j in range(self.num_kernels): + if xs is None: + xs = self.resblocks[i * self.num_kernels + j](x) + else: + xs += self.resblocks[i * self.num_kernels + j](x) + + x = xs / self.num_kernels + + x = self.activation_post(x) + x = self.conv_post(x) + x = torch.tanh(x) + + return x + + def remove_weight_norm(self): + for up in self.ups: + remove_weight_norm(up) + for block in self.resblocks: + block.remove_weight_norm() + remove_weight_norm(self.conv_pre) + remove_weight_norm(self.conv_post) + + +class ADaMoSHiFiGANV1(nn.Module): + def __init__( + self, + input_channels: int = 128, + depths: List[int] = [3, 3, 9, 3], + dims: List[int] = [128, 256, 384, 512], + drop_path_rate: float = 0.0, + kernel_sizes: Tuple[int] = (7,), + upsample_rates: Tuple[int] = (4, 4, 2, 2, 2, 2, 2), + upsample_kernel_sizes: Tuple[int] = (8, 8, 4, 4, 4, 4, 4), + resblock_kernel_sizes: Tuple[int] = (3, 7, 11, 13), + resblock_dilation_sizes: Tuple[Tuple[int]] = ( + (1, 3, 5), (1, 3, 5), (1, 3, 5), (1, 3, 5)), + num_mels: int = 512, + upsample_initial_channel: int = 1024, + use_template: bool = False, + pre_conv_kernel_size: int = 13, + post_conv_kernel_size: int = 13, + sampling_rate: int = 44100, + n_fft: int = 2048, + win_length: int = 2048, + hop_length: int = 512, + f_min: int = 40, + f_max: int = 16000, + n_mels: int = 128, + ): + super().__init__() + + self.backbone = ConvNeXtEncoder( + input_channels=input_channels, + depths=depths, + dims=dims, + drop_path_rate=drop_path_rate, + kernel_sizes=kernel_sizes, + ) + + self.head = HiFiGANGenerator( + hop_length=hop_length, + upsample_rates=upsample_rates, + upsample_kernel_sizes=upsample_kernel_sizes, + resblock_kernel_sizes=resblock_kernel_sizes, + resblock_dilation_sizes=resblock_dilation_sizes, + num_mels=num_mels, + upsample_initial_channel=upsample_initial_channel, + use_template=use_template, + pre_conv_kernel_size=pre_conv_kernel_size, + post_conv_kernel_size=post_conv_kernel_size, + ) + self.sampling_rate = sampling_rate + self.mel_transform = LogMelSpectrogram( + sample_rate=sampling_rate, + n_fft=n_fft, + win_length=win_length, + hop_length=hop_length, + f_min=f_min, + f_max=f_max, + n_mels=n_mels, + ) + self.eval() + + @torch.no_grad() + def decode(self, mel): + y = self.backbone(mel) + y = self.head(y) + return y + + @torch.no_grad() + def encode(self, x): + return self.mel_transform(x) + + def forward(self, mel): + y = self.backbone(mel) + y = self.head(y) + return y diff --git a/comfy/model_base.py b/comfy/model_base.py index 045df1317..6408005b6 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -39,6 +39,7 @@ import comfy.ldm.wan.model import comfy.ldm.hunyuan3d.model import comfy.ldm.hidream.model import comfy.ldm.chroma.model +import comfy.ldm.ace.model import comfy.model_management import comfy.patcher_extension @@ -1121,3 +1122,21 @@ class Chroma(Flux): if guidance is not None: out['guidance'] = comfy.conds.CONDRegular(torch.FloatTensor([guidance])) return out + +class ACEStep(BaseModel): + def __init__(self, model_config, model_type=ModelType.FLOW, device=None): + super().__init__(model_config, model_type, device=device, unet_model=comfy.ldm.ace.model.ACEStepTransformer2DModel) + + def extra_conds(self, **kwargs): + out = super().extra_conds(**kwargs) + noise = kwargs.get("noise", None) + + cross_attn = kwargs.get("cross_attn", None) + if cross_attn is not None: + out['c_crossattn'] = comfy.conds.CONDRegular(cross_attn) + + conditioning_lyrics = kwargs.get("conditioning_lyrics", None) + if cross_attn is not None: + out['lyric_token_idx'] = comfy.conds.CONDRegular(conditioning_lyrics) + out['speaker_embeds'] = comfy.conds.CONDRegular(torch.zeros(noise.shape[0], 512, device=noise.device, dtype=noise.dtype)) + return out diff --git a/comfy/model_detection.py b/comfy/model_detection.py index 9254843ea..ff4c29d7e 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -226,6 +226,31 @@ def detect_unet_config(state_dict, key_prefix, metadata=None): dit_config.update(json.loads(metadata["config"]).get("transformer", {})) return dit_config + if '{}genre_embedder.weight'.format(key_prefix) in state_dict_keys: #ACE-Step model + dit_config = {} + dit_config["audio_model"] = "ace" + dit_config["attention_head_dim"] = 128 + dit_config["in_channels"] = 8 + dit_config["inner_dim"] = 2560 + dit_config["max_height"] = 16 + dit_config["max_position"] = 32768 + dit_config["max_width"] = 32768 + dit_config["mlp_ratio"] = 2.5 + dit_config["num_attention_heads"] = 20 + dit_config["num_layers"] = 24 + dit_config["out_channels"] = 8 + dit_config["patch_size"] = [16, 1] + dit_config["rope_theta"] = 1000000.0 + dit_config["speaker_embedding_dim"] = 512 + dit_config["text_embedding_dim"] = 768 + + dit_config["ssl_encoder_depths"] = [8, 8] + dit_config["ssl_latent_dims"] = [1024, 768] + dit_config["ssl_names"] = ["mert", "m-hubert"] + dit_config["lyric_encoder_vocab_size"] = 6693 + dit_config["lyric_hidden_size"] = 1024 + return dit_config + if '{}t_block.1.weight'.format(key_prefix) in state_dict_keys: # PixArt patch_size = 2 dit_config = {} diff --git a/comfy/sd.py b/comfy/sd.py index da9b36d0e..50af243ba 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -15,6 +15,7 @@ import comfy.ldm.lightricks.vae.causal_video_autoencoder import comfy.ldm.cosmos.vae import comfy.ldm.wan.vae import comfy.ldm.hunyuan3d.vae +import comfy.ldm.ace.vae.music_dcae_pipeline import yaml import math @@ -42,6 +43,7 @@ import comfy.text_encoders.cosmos import comfy.text_encoders.lumina2 import comfy.text_encoders.wan import comfy.text_encoders.hidream +import comfy.text_encoders.ace import comfy.model_patcher import comfy.lora @@ -437,6 +439,19 @@ class VAE: ddconfig = {"embed_dim": 64, "num_freqs": 8, "include_pi": False, "heads": 16, "width": 1024, "num_decoder_layers": 16, "qkv_bias": False, "qk_norm": True, "geo_decoder_mlp_expand_ratio": mlp_expand, "geo_decoder_downsample_ratio": downsample_ratio, "geo_decoder_ln_post": ln_post} self.first_stage_model = comfy.ldm.hunyuan3d.vae.ShapeVAE(**ddconfig) self.working_dtypes = [torch.float16, torch.bfloat16, torch.float32] + elif "vocoder.backbone.channel_layers.0.0.bias" in sd: #Ace Step Audio + self.first_stage_model = comfy.ldm.ace.vae.music_dcae_pipeline.MusicDCAE(source_sample_rate=44100) + self.memory_used_encode = lambda shape, dtype: (shape[2] * 300) * model_management.dtype_size(dtype) + self.memory_used_decode = lambda shape, dtype: (shape[2] * shape[3] * 72000) * model_management.dtype_size(dtype) + self.latent_channels = 8 + self.output_channels = 2 + # self.upscale_ratio = 2048 + # self.downscale_ratio = 2048 + self.latent_dim = 2 + self.process_output = lambda audio: audio + self.process_input = lambda audio: audio + self.working_dtypes = [torch.bfloat16, torch.float32] + self.disable_offload = True else: logging.warning("WARNING: No VAE weights detected, VAE not initalized.") self.first_stage_model = None @@ -715,6 +730,7 @@ class CLIPType(Enum): WAN = 13 HIDREAM = 14 CHROMA = 15 + ACE = 16 def load_clip(ckpt_paths, embedding_directory=None, clip_type=CLIPType.STABLE_DIFFUSION, model_options={}): @@ -840,8 +856,13 @@ def load_text_encoder_state_dicts(state_dicts=[], embedding_directory=None, clip clip_target.clip = comfy.text_encoders.aura_t5.AuraT5Model clip_target.tokenizer = comfy.text_encoders.aura_t5.AuraT5Tokenizer elif te_model == TEModel.T5_BASE: - clip_target.clip = comfy.text_encoders.sa_t5.SAT5Model - clip_target.tokenizer = comfy.text_encoders.sa_t5.SAT5Tokenizer + if clip_type == CLIPType.ACE or "spiece_model" in clip_data[0]: + clip_target.clip = comfy.text_encoders.ace.AceT5Model + clip_target.tokenizer = comfy.text_encoders.ace.AceT5Tokenizer + tokenizer_data["spiece_model"] = clip_data[0].get("spiece_model", None) + else: + clip_target.clip = comfy.text_encoders.sa_t5.SAT5Model + clip_target.tokenizer = comfy.text_encoders.sa_t5.SAT5Tokenizer elif te_model == TEModel.GEMMA_2_2B: clip_target.clip = comfy.text_encoders.lumina2.te(**llama_detect(clip_data)) clip_target.tokenizer = comfy.text_encoders.lumina2.LuminaTokenizer diff --git a/comfy/supported_models.py b/comfy/supported_models.py index a1dea2343..fef25eb24 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -17,6 +17,7 @@ import comfy.text_encoders.hunyuan_video import comfy.text_encoders.cosmos import comfy.text_encoders.lumina2 import comfy.text_encoders.wan +import comfy.text_encoders.ace from . import supported_models_base from . import latent_formats @@ -1100,6 +1101,34 @@ class Chroma(supported_models_base.BASE): t5_detect = comfy.text_encoders.sd3_clip.t5_xxl_detect(state_dict, "{}t5xxl.transformer.".format(pref)) return supported_models_base.ClipTarget(comfy.text_encoders.pixart_t5.PixArtTokenizer, comfy.text_encoders.pixart_t5.pixart_te(**t5_detect)) -models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, WAN21_FunControl2V, WAN21_Vace, Hunyuan3Dv2mini, Hunyuan3Dv2, HiDream, Chroma] +class ACEStep(supported_models_base.BASE): + unet_config = { + "audio_model": "ace", + } + + unet_extra_config = { + } + + sampling_settings = { + "shift": 3.0, + } + + latent_format = comfy.latent_formats.ACEAudio + + memory_usage_factor = 0.5 + + supported_inference_dtypes = [torch.bfloat16, torch.float32] + + vae_key_prefix = ["vae."] + text_encoder_key_prefix = ["text_encoders."] + + def get_model(self, state_dict, prefix="", device=None): + out = model_base.ACEStep(self, device=device) + return out + + def clip_target(self, state_dict={}): + return supported_models_base.ClipTarget(comfy.text_encoders.ace.AceT5Tokenizer, comfy.text_encoders.ace.AceT5Model) + +models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, WAN21_FunControl2V, WAN21_Vace, Hunyuan3Dv2mini, Hunyuan3Dv2, HiDream, Chroma, ACEStep] models += [SVD_img2vid] diff --git a/comfy/text_encoders/ace.py b/comfy/text_encoders/ace.py new file mode 100644 index 000000000..b6fe451bd --- /dev/null +++ b/comfy/text_encoders/ace.py @@ -0,0 +1,145 @@ +from comfy import sd1_clip +from .spiece_tokenizer import SPieceTokenizer +import comfy.text_encoders.t5 +import os +import re +import torch +import logging + +from tokenizers import Tokenizer +from .ace_text_cleaners import multilingual_cleaners + +SUPPORT_LANGUAGES = { + "en": 259, "de": 260, "fr": 262, "es": 284, "it": 285, + "pt": 286, "pl": 294, "tr": 295, "ru": 267, "cs": 293, + "nl": 297, "ar": 5022, "zh": 5023, "ja": 5412, "hu": 5753, + "ko": 6152, "hi": 6680 +} + +structure_pattern = re.compile(r"\[.*?\]") + +DEFAULT_VOCAB_FILE = os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "ace_lyrics_tokenizer"), "vocab.json") + + +class VoiceBpeTokenizer: + def __init__(self, vocab_file=DEFAULT_VOCAB_FILE): + self.tokenizer = None + if vocab_file is not None: + self.tokenizer = Tokenizer.from_file(vocab_file) + + def preprocess_text(self, txt, lang): + txt = multilingual_cleaners(txt, lang) + return txt + + def encode(self, txt, lang='en'): + # lang = lang.split("-")[0] # remove the region + # self.check_input_length(txt, lang) + txt = self.preprocess_text(txt, lang) + lang = "zh-cn" if lang == "zh" else lang + txt = f"[{lang}]{txt}" + txt = txt.replace(" ", "[SPACE]") + return self.tokenizer.encode(txt).ids + + def get_lang(self, line): + if line.startswith("[") and line[3:4] == ']': + lang = line[1:3].lower() + if lang in SUPPORT_LANGUAGES: + return lang, line[4:] + return "en", line + + def __call__(self, string): + lines = string.split("\n") + lyric_token_idx = [261] + for line in lines: + line = line.strip() + if not line: + lyric_token_idx += [2] + continue + + lang, line = self.get_lang(line) + + if lang not in SUPPORT_LANGUAGES: + lang = "en" + if "zh" in lang: + lang = "zh" + if "spa" in lang: + lang = "es" + + try: + if structure_pattern.match(line): + token_idx = self.encode(line, "en") + else: + token_idx = self.encode(line, lang) + lyric_token_idx = lyric_token_idx + token_idx + [2] + except Exception as e: + logging.warning("tokenize error {} for line {} major_language {}".format(e, line, lang)) + return {"input_ids": lyric_token_idx} + + @staticmethod + def from_pretrained(path, **kwargs): + return VoiceBpeTokenizer(path, **kwargs) + + def get_vocab(self): + return {} + + +class UMT5BaseModel(sd1_clip.SDClipModel): + def __init__(self, device="cpu", layer="last", layer_idx=None, dtype=None, model_options={}): + textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "umt5_config_base.json") + super().__init__(device=device, layer=layer, layer_idx=layer_idx, textmodel_json_config=textmodel_json_config, dtype=dtype, special_tokens={"end": 1, "pad": 0}, model_class=comfy.text_encoders.t5.T5, enable_attention_masks=True, zero_out_masked=False, model_options=model_options) + +class UMT5BaseTokenizer(sd1_clip.SDTokenizer): + def __init__(self, embedding_directory=None, tokenizer_data={}): + tokenizer = tokenizer_data.get("spiece_model", None) + super().__init__(tokenizer, pad_with_end=False, embedding_size=768, embedding_key='umt5base', tokenizer_class=SPieceTokenizer, has_start_token=False, pad_to_max_length=False, max_length=99999999, min_length=1, pad_token=0, tokenizer_data=tokenizer_data) + + def state_dict(self): + return {"spiece_model": self.tokenizer.serialize_model()} + +class LyricsTokenizer(sd1_clip.SDTokenizer): + def __init__(self, embedding_directory=None, tokenizer_data={}): + tokenizer = os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)), "ace_lyrics_tokenizer"), "vocab.json") + super().__init__(tokenizer, pad_with_end=False, embedding_size=1024, embedding_key='lyrics', tokenizer_class=VoiceBpeTokenizer, has_start_token=True, pad_to_max_length=False, max_length=99999999, min_length=1, pad_token=2, has_end_token=False, tokenizer_data=tokenizer_data) + +class AceT5Tokenizer: + def __init__(self, embedding_directory=None, tokenizer_data={}): + self.voicebpe = LyricsTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) + self.umt5base = UMT5BaseTokenizer(embedding_directory=embedding_directory, tokenizer_data=tokenizer_data) + + def tokenize_with_weights(self, text:str, return_word_ids=False, **kwargs): + out = {} + out["lyrics"] = self.voicebpe.tokenize_with_weights(kwargs.get("lyrics", ""), return_word_ids, **kwargs) + out["umt5base"] = self.umt5base.tokenize_with_weights(text, return_word_ids, **kwargs) + return out + + def untokenize(self, token_weight_pair): + return self.umt5base.untokenize(token_weight_pair) + + def state_dict(self): + return self.umt5base.state_dict() + +class AceT5Model(torch.nn.Module): + def __init__(self, device="cpu", dtype=None, model_options={}, **kwargs): + super().__init__() + self.umt5base = UMT5BaseModel(device=device, dtype=dtype, model_options=model_options) + self.dtypes = set() + if dtype is not None: + self.dtypes.add(dtype) + + def set_clip_options(self, options): + self.umt5base.set_clip_options(options) + + def reset_clip_options(self): + self.umt5base.reset_clip_options() + + def encode_token_weights(self, token_weight_pairs): + token_weight_pairs_umt5base = token_weight_pairs["umt5base"] + token_weight_pairs_lyrics = token_weight_pairs["lyrics"] + + t5_out, t5_pooled = self.umt5base.encode_token_weights(token_weight_pairs_umt5base) + + lyrics_embeds = torch.tensor(list(map(lambda a: a[0], token_weight_pairs_lyrics[0]))).unsqueeze(0) + return t5_out, None, {"conditioning_lyrics": lyrics_embeds} + + def load_sd(self, sd): + return self.umt5base.load_sd(sd) diff --git a/comfy/text_encoders/ace_lyrics_tokenizer/vocab.json b/comfy/text_encoders/ace_lyrics_tokenizer/vocab.json new file mode 100644 index 000000000..519ed340c --- /dev/null +++ b/comfy/text_encoders/ace_lyrics_tokenizer/vocab.json @@ -0,0 +1,15535 @@ +{ + "version": "1.0", + "truncation": null, + "padding": null, + "added_tokens": [ + { + "id": 0, + "special": true, + "content": "[STOP]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 1, + "special": true, + "content": "[UNK]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 2, + "special": true, + "content": "[SPACE]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 259, + "special": true, + "content": "[en]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 260, + "special": true, + "content": "[de]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 261, + "special": true, + "content": "[START]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 262, + "special": true, + "content": "[fr]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 284, + "special": true, + "content": "[es]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 285, + "special": true, + "content": "[it]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 286, + "special": true, + "content": "[pt]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 294, + "special": true, + "content": "[pl]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 295, + "special": true, + "content": "[tr]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 267, + "special": true, + "content": "[ru]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 293, + "special": true, + "content": "[cs]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 297, + "special": true, + "content": "[nl]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 5022, + "special": true, + "content": "[ar]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 5023, + "special": true, + "content": "[zh-cn]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 5412, + "special": true, + "content": "[ja]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 5753, + "special": true, + "content": "[hu]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6152, + "special": true, + "content": "[ko]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6680, + "special": true, + "content": "[hi]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6681, + "special": true, + "content": "[start]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6682, + "special": true, + "content": "[intro]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6683, + "special": true, + "content": "[verse]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6684, + "special": true, + "content": "[chorus]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6685, + "special": true, + "content": "[bridge]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6686, + "special": true, + "content": "[outro]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6687, + "special": true, + "content": "[end]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6688, + "special": true, + "content": "[inst]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6689, + "special": true, + "content": "[solo]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6690, + "special": true, + "content": "[hook]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6691, + "special": true, + "content": "[pre-chorus]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + }, + { + "id": 6692, + "special": true, + "content": "[break]", + "single_word": false, + "lstrip": false, + "rstrip": false, + "normalized": false + } + ], + "normalizer": null, + "pre_tokenizer": { + "type": "Whitespace" + }, + "post_processor": null, + "decoder": null, + "model": { + "type": "BPE", + "dropout": null, + "unk_token": "[UNK]", + "continuing_subword_prefix": null, + "end_of_word_suffix": null, + "fuse_unk": false, + "vocab": { + "[STOP]": 0, + "[UNK]": 1, + "[SPACE]": 2, + "!": 3, + "'": 4, + "(": 5, + ")": 6, + ",": 7, + "-": 8, + ".": 9, + "/": 10, + ":": 11, + ";": 12, + "?": 13, + "a": 14, + "b": 15, + "c": 16, + "d": 17, + "e": 18, + "f": 19, + "g": 20, + "h": 21, + "i": 22, + "j": 23, + "k": 24, + "l": 25, + "m": 26, + "n": 27, + "o": 28, + "p": 29, + "q": 30, + "r": 31, + "s": 32, + "t": 33, + "u": 34, + "v": 35, + "w": 36, + "x": 37, + "y": 38, + "z": 39, + "th": 40, + "in": 41, + "the": 42, + "an": 43, + "er": 44, + "ou": 45, + "re": 46, + "on": 47, + "at": 48, + "ed": 49, + "en": 50, + "to": 51, + "ing": 52, + "and": 53, + "is": 54, + "as": 55, + "al": 56, + "or": 57, + "of": 58, + "ar": 59, + "it": 60, + "es": 61, + "he": 62, + "st": 63, + "le": 64, + "om": 65, + "se": 66, + "be": 67, + "ad": 68, + "ow": 69, + "ly": 70, + "ch": 71, + "wh": 72, + "that": 73, + "you": 74, + "li": 75, + "ve": 76, + "ac": 77, + "ti": 78, + "ld": 79, + "me": 80, + "was": 81, + "gh": 82, + "id": 83, + "ll": 84, + "wi": 85, + "ent": 86, + "for": 87, + "ay": 88, + "ro": 89, + "ver": 90, + "ic": 91, + "her": 92, + "ke": 93, + "his": 94, + "no": 95, + "ut": 96, + "un": 97, + "ir": 98, + "lo": 99, + "we": 100, + "ri": 101, + "ha": 102, + "with": 103, + "ght": 104, + "out": 105, + "im": 106, + "ion": 107, + "all": 108, + "ab": 109, + "one": 110, + "ne": 111, + "ge": 112, + "ould": 113, + "ter": 114, + "mo": 115, + "had": 116, + "ce": 117, + "she": 118, + "go": 119, + "sh": 120, + "ur": 121, + "am": 122, + "so": 123, + "pe": 124, + "my": 125, + "de": 126, + "are": 127, + "but": 128, + "ome": 129, + "fr": 130, + "ther": 131, + "fe": 132, + "su": 133, + "do": 134, + "con": 135, + "te": 136, + "ain": 137, + "ere": 138, + "po": 139, + "if": 140, + "they": 141, + "us": 142, + "ag": 143, + "tr": 144, + "now": 145, + "oun": 146, + "this": 147, + "have": 148, + "not": 149, + "sa": 150, + "il": 151, + "up": 152, + "thing": 153, + "from": 154, + "ap": 155, + "him": 156, + "ack": 157, + "ation": 158, + "ant": 159, + "our": 160, + "op": 161, + "like": 162, + "ust": 163, + "ess": 164, + "bo": 165, + "ok": 166, + "ul": 167, + "ind": 168, + "ex": 169, + "com": 170, + "some": 171, + "there": 172, + "ers": 173, + "co": 174, + "res": 175, + "man": 176, + "ard": 177, + "pl": 178, + "wor": 179, + "way": 180, + "tion": 181, + "fo": 182, + "ca": 183, + "were": 184, + "by": 185, + "ate": 186, + "pro": 187, + "ted": 188, + "ound": 189, + "own": 190, + "would": 191, + "ts": 192, + "what": 193, + "qu": 194, + "ally": 195, + "ight": 196, + "ck": 197, + "gr": 198, + "when": 199, + "ven": 200, + "can": 201, + "ough": 202, + "ine": 203, + "end": 204, + "per": 205, + "ous": 206, + "od": 207, + "ide": 208, + "know": 209, + "ty": 210, + "very": 211, + "si": 212, + "ak": 213, + "who": 214, + "about": 215, + "ill": 216, + "them": 217, + "est": 218, + "red": 219, + "ye": 220, + "could": 221, + "ong": 222, + "your": 223, + "their": 224, + "em": 225, + "just": 226, + "other": 227, + "into": 228, + "any": 229, + "whi": 230, + "um": 231, + "tw": 232, + "ast": 233, + "der": 234, + "did": 235, + "ie": 236, + "been": 237, + "ace": 238, + "ink": 239, + "ity": 240, + "back": 241, + "ting": 242, + "br": 243, + "more": 244, + "ake": 245, + "pp": 246, + "then": 247, + "sp": 248, + "el": 249, + "use": 250, + "bl": 251, + "said": 252, + "over": 253, + "get": 254, + "ß": 255, + "ä": 256, + "ö": 257, + "ü": 258, + "[en]": 259, + "[de]": 260, + "[START]": 261, + "[fr]": 262, + "œ": 263, + "ï": 264, + "ê": 265, + "â": 266, + "[ru]": 267, + "ÿ": 268, + "è": 269, + "à": 270, + "ë": 271, + "ù": 272, + "î": 273, + "ç": 274, + "æ": 275, + "ô": 276, + "û": 277, + "á": 278, + "é": 279, + "í": 280, + "ó": 281, + "ú": 282, + "ñ": 283, + "[es]": 284, + "[it]": 285, + "[pt]": 286, + "ń": 287, + "ś": 288, + "ę": 289, + "ą": 290, + "ż": 291, + "ć": 292, + "[cs]": 293, + "[pl]": 294, + "[tr]": 295, + "ã": 296, + "[nl]": 297, + "ş": 298, + "ğ": 299, + "ı": 300, + "ò": 301, + "ì": 302, + "¿": 303, + "…": 304, + "i̇": 305, + "õ": 306, + "\"": 307, + "´": 308, + "ø": 309, + "č": 310, + "ō": 311, + "š": 312, + "ž": 313, + "̇": 314, + "ei": 315, + "ich": 316, + "ein": 317, + "au": 318, + "sch": 319, + "und": 320, + "die": 321, + "da": 322, + "den": 323, + "gen": 324, + "zu": 325, + "hr": 326, + "ten": 327, + "mi": 328, + "sie": 329, + "das": 330, + "eine": 331, + "icht": 332, + "ber": 333, + "ach": 334, + "auf": 335, + "lich": 336, + "nicht": 337, + "mm": 338, + "ben": 339, + "war": 340, + "mit": 341, + "sich": 342, + "ig": 343, + "aus": 344, + "ist": 345, + "wie": 346, + "och": 347, + "ung": 348, + "ann": 349, + "ür": 350, + "hn": 351, + "ihr": 352, + "sen": 353, + "tz": 354, + "dem": 355, + "eit": 356, + "hat": 357, + "wir": 358, + "von": 359, + "wei": 360, + "ier": 361, + "ra": 362, + "einen": 363, + "vor": 364, + "als": 365, + "wo": 366, + "rei": 367, + "ste": 368, + "lie": 369, + "auch": 370, + "du": 371, + "des": 372, + "ko": 373, + "über": 374, + "bei": 375, + "hen": 376, + "hm": 377, + "lei": 378, + "aber": 379, + "wen": 380, + "hl": 381, + "ger": 382, + "nach": 383, + "ft": 384, + "imm": 385, + "je": 386, + "schen": 387, + "wer": 388, + "ser": 389, + "än": 390, + "sein": 391, + "ol": 392, + "cht": 393, + "für": 394, + "kl": 395, + "ff": 396, + "einem": 397, + "nen": 398, + "ja": 399, + "noch": 400, + "hatte": 401, + "pf": 402, + "hin": 403, + "di": 404, + "chen": 405, + "rü": 406, + "iel": 407, + "sel": 408, + "dass": 409, + "ihn": 410, + "mir": 411, + "schl": 412, + "ön": 413, + "gan": 414, + "gt": 415, + "einer": 416, + "sten": 417, + "mich": 418, + "wenn": 419, + "ell": 420, + "gte": 421, + "mal": 422, + "gel": 423, + "ken": 424, + "nur": 425, + "mmen": 426, + "fü": 427, + "ern": 428, + "ör": 429, + "unter": 430, + "ander": 431, + "dur": 432, + "uch": 433, + "ta": 434, + "men": 435, + "mach": 436, + "doch": 437, + "durch": 438, + "os": 439, + "gl": 440, + "hal": 441, + "ihre": 442, + "wä": 443, + "immer": 444, + "ihm": 445, + "kann": 446, + "ort": 447, + "dann": 448, + "lan": 449, + "tzt": 450, + "oder": 451, + "hren": 452, + "et": 453, + "kön": 454, + "ick": 455, + "fa": 456, + "wieder": 457, + "daß": 458, + "mein": 459, + "fen": 460, + "ganz": 461, + "diese": 462, + "ster": 463, + "dar": 464, + "wa": 465, + "ges": 466, + "na": 467, + "fl": 468, + "igen": 469, + "sche": 470, + "ungen": 471, + "mehr": 472, + "ßen": 473, + "ot": 474, + "kon": 475, + "gew": 476, + "haben": 477, + "geh": 478, + "ät": 479, + "sind": 480, + "dr": 481, + "wel": 482, + "uns": 483, + "vo": 484, + "ma": 485, + "ute": 486, + "schon": 487, + "bes": 488, + "gesch": 489, + "bt": 490, + "che": 491, + "son": 492, + "ob": 493, + "la": 494, + "rück": 495, + "seine": 496, + "kr": 497, + "fre": 498, + "eil": 499, + "zum": 500, + "hier": 501, + "kt": 502, + "ige": 503, + "spr": 504, + "leben": 505, + "bst": 506, + "zeit": 507, + "gro": 508, + "denn": 509, + "ho": 510, + "scha": 511, + "bar": 512, + "alle": 513, + "gegen": 514, + "wür": 515, + "mü": 516, + "ze": 517, + "werden": 518, + "jetzt": 519, + "kommen": 520, + "nie": 521, + "sei": 522, + "heit": 523, + "soll": 524, + "glei": 525, + "meine": 526, + "woll": 527, + "ner": 528, + "habe": 529, + "wur": 530, + "lichen": 531, + "assen": 532, + "nte": 533, + "sehen": 534, + "wird": 535, + "bis": 536, + "gar": 537, + "ien": 538, + "mus": 539, + "uß": 540, + "är": 541, + "stell": 542, + "keit": 543, + "zwei": 544, + "selbst": 545, + "sta": 546, + "pa": 547, + "sagte": 548, + "tet": 549, + "kam": 550, + "ssen": 551, + "viel": 552, + "ug": 553, + "zen": 554, + "hei": 555, + "mann": 556, + "will": 557, + "geb": 558, + "waren": 559, + "ück": 560, + "äch": 561, + "mer": 562, + "ru": 563, + "hau": 564, + "eigen": 565, + "ang": 566, + "weg": 567, + "blick": 568, + "fra": 569, + "alles": 570, + "ka": 571, + "augen": 572, + "fin": 573, + "liche": 574, + "unser": 575, + "dern": 576, + "herr": 577, + "nun": 578, + "vie": 579, + "chte": 580, + "wohl": 581, + "fall": 582, + "ht": 583, + "ün": 584, + "etwas": 585, + "stand": 586, + "äu": 587, + "mö": 588, + "tel": 589, + "rie": 590, + "dich": 591, + "dies": 592, + "hand": 593, + "bin": 594, + "ffen": 595, + "nichts": 596, + "dan": 597, + "hne": 598, + "ihnen": 599, + "esen": 600, + "dieser": 601, + "frau": 602, + "art": 603, + "dir": 604, + "isch": 605, + "erst": 606, + "gleich": 607, + "komm": 608, + "hör": 609, + "ße": 610, + "dig": 611, + "sehr": 612, + "zei": 613, + "sam": 614, + "aum": 615, + "hät": 616, + "ingen": 617, + "gut": 618, + "mut": 619, + "cken": 620, + "konnte": 621, + "stimm": 622, + "zur": 623, + "itz": 624, + "weil": 625, + "würde": 626, + "fä": 627, + "können": 628, + "keine": 629, + "fer": 630, + "ischen": 631, + "voll": 632, + "eines": 633, + "setz": 634, + "zie": 635, + "del": 636, + "tete": 637, + "seiner": 638, + "ieren": 639, + "gest": 640, + "zurück": 641, + "wurde": 642, + "schn": 643, + "pr": 644, + "ließ": 645, + "tra": 646, + "mä": 647, + "gend": 648, + "fol": 649, + "ik": 650, + "schla": 651, + "schaft": 652, + "ater": 653, + "weiß": 654, + "seinen": 655, + "lassen": 656, + "lu": 657, + "unden": 658, + "teil": 659, + "neu": 660, + "iert": 661, + "menschen": 662, + "hmen": 663, + "str": 664, + "gi": 665, + "sah": 666, + "ihren": 667, + "eln": 668, + "weiter": 669, + "gehen": 670, + "iger": 671, + "macht": 672, + "tag": 673, + "also": 674, + "halten": 675, + "nis": 676, + "acht": 677, + "geben": 678, + "og": 679, + "nat": 680, + "mar": 681, + "det": 682, + "ohne": 683, + "haus": 684, + "tro": 685, + "ange": 686, + "lau": 687, + "spiel": 688, + "tre": 689, + "schr": 690, + "inn": 691, + "los": 692, + "machen": 693, + "hätte": 694, + "beg": 695, + "wirk": 696, + "alt": 697, + "glich": 698, + "tes": 699, + "richt": 700, + "freund": 701, + "ihrer": 702, + "fel": 703, + "bel": 704, + "sol": 705, + "einmal": 706, + "eben": 707, + "hol": 708, + "hän": 709, + "tern": 710, + "hö": 711, + "schw": 712, + "recht": 713, + "wahr": 714, + "seinem": 715, + "stehen": 716, + "hlen": 717, + "ins": 718, + "ging": 719, + "wollte": 720, + "wissen": 721, + "ungs": 722, + "ald": 723, + "ass": 724, + "jahr": 725, + "mor": 726, + "welt": 727, + "under": 728, + "zusa": 729, + "kopf": 730, + "lang": 731, + "hinter": 732, + "atz": 733, + "stra": 734, + "angen": 735, + "ank": 736, + "ade": 737, + "glau": 738, + "fach": 739, + "hatten": 740, + "fort": 741, + "eicht": 742, + "iff": 743, + "ler": 744, + "mei": 745, + "diesem": 746, + "kein": 747, + "frei": 748, + "führ": 749, + "vom": 750, + "β": 751, + "ai": 752, + "ait": 753, + "que": 754, + "les": 755, + "av": 756, + "ais": 757, + "oi": 758, + "eu": 759, + "lle": 760, + "par": 761, + "ans": 762, + "ment": 763, + "ét": 764, + "une": 765, + "pas": 766, + "qui": 767, + "elle": 768, + "dé": 769, + "pour": 770, + "dans": 771, + "ré": 772, + "tou": 773, + "vous": 774, + "vi": 775, + "ouv": 776, + "mon": 777, + "sur": 778, + "ci": 779, + "plu": 780, + "ère": 781, + "mais": 782, + "ois": 783, + "plus": 784, + "ée": 785, + "aient": 786, + "mp": 787, + "lui": 788, + "ave": 789, + "était": 790, + "ses": 791, + "tout": 792, + "oir": 793, + "avait": 794, + "és": 795, + "mes": 796, + "nous": 797, + "eux": 798, + "bi": 799, + "ons": 800, + "pu": 801, + "ces": 802, + "tu": 803, + "leur": 804, + "don": 805, + "eur": 806, + "ette": 807, + "aire": 808, + "avec": 809, + "dit": 810, + "té": 811, + "ille": 812, + "comme": 813, + "cr": 814, + "ux": 815, + "ès": 816, + "aux": 817, + "jour": 818, + "ils": 819, + "bien": 820, + "cou": 821, + "quel": 822, + "peu": 823, + "cette": 824, + "cu": 825, + "mê": 826, + "fait": 827, + "gu": 828, + "être": 829, + "ité": 830, + "ens": 831, + "ni": 832, + "lé": 833, + "dis": 834, + "ble": 835, + "né": 836, + "puis": 837, + "même": 838, + "ques": 839, + "fi": 840, + "age": 841, + "moi": 842, + "ence": 843, + "ont": 844, + "main": 845, + "ors": 846, + "aut": 847, + "ance": 848, + "mé": 849, + "sans": 850, + "sé": 851, + "lon": 852, + "hom": 853, + "car": 854, + "able": 855, + "cher": 856, + "deux": 857, + "enf": 858, + "où": 859, + "ph": 860, + "ure": 861, + "temp": 862, + "pos": 863, + "rent": 864, + "pé": 865, + "faire": 866, + "pi": 867, + "tres": 868, + "ça": 869, + "endre": 870, + "bon": 871, + "sou": 872, + "int": 873, + "pré": 874, + "sent": 875, + "tant": 876, + "cer": 877, + "là": 878, + "lais": 879, + "près": 880, + "bre": 881, + "cour": 882, + "pet": 883, + "comp": 884, + "lait": 885, + "trouv": 886, + "entre": 887, + "sont": 888, + "dev": 889, + "nu": 890, + "temps": 891, + "dou": 892, + "rait": 893, + "bou": 894, + "quand": 895, + "jours": 896, + "avoir": 897, + "été": 898, + "ale": 899, + "pre": 900, + "fois": 901, + "orte": 902, + "vé": 903, + "non": 904, + "tous": 905, + "jus": 906, + "coup": 907, + "homme": 908, + "ête": 909, + "aussi": 910, + "urs": 911, + "seu": 912, + "ord": 913, + "min": 914, + "gé": 915, + "core": 916, + "va": 917, + "vre": 918, + "encore": 919, + "sem": 920, + "ite": 921, + "autre": 922, + "pris": 923, + "peut": 924, + "ue": 925, + "ante": 926, + "gn": 927, + "rép": 928, + "hu": 929, + "sion": 930, + "votre": 931, + "dire": 932, + "ez": 933, + "fem": 934, + "leurs": 935, + "met": 936, + "cri": 937, + "mis": 938, + "tour": 939, + "rai": 940, + "jam": 941, + "regar": 942, + "rien": 943, + "vers": 944, + "suis": 945, + "pouv": 946, + "vis": 947, + "grand": 948, + "ants": 949, + "cor": 950, + "rer": 951, + "cé": 952, + "tent": 953, + "pres": 954, + "vou": 955, + "alors": 956, + "sieur": 957, + "aine": 958, + "quoi": 959, + "fon": 960, + "endant": 961, + "arri": 962, + "eure": 963, + "après": 964, + "donc": 965, + "itu": 966, + "lè": 967, + "sait": 968, + "toi": 969, + "cha": 970, + "ail": 971, + "asse": 972, + "imp": 973, + "voy": 974, + "conn": 975, + "pla": 976, + "petit": 977, + "avant": 978, + "nom": 979, + "tin": 980, + "dont": 981, + "sous": 982, + "emp": 983, + "person": 984, + "elles": 985, + "beau": 986, + "parti": 987, + "cho": 988, + "prit": 989, + "toujours": 990, + "rais": 991, + "jamais": 992, + "trav": 993, + "tions": 994, + "très": 995, + "voi": 996, + "ren": 997, + "yeux": 998, + "voir": 999, + "premi": 1000, + "gne": 1001, + "heure": 1002, + "rou": 1003, + "eff": 1004, + "notre": 1005, + "ments": 1006, + "ton": 1007, + "fais": 1008, + "cela": 1009, + "répon": 1010, + "cons": 1011, + "air": 1012, + "ôt": 1013, + "pendant": 1014, + "ici": 1015, + "toute": 1016, + "jet": 1017, + "port": 1018, + "étaient": 1019, + "pen": 1020, + "hé": 1021, + "autres": 1022, + "père": 1023, + "oc": 1024, + "quelques": 1025, + "ique": 1026, + "lis": 1027, + "femme": 1028, + "jou": 1029, + "teur": 1030, + "monde": 1031, + "nes": 1032, + "dre": 1033, + "aff": 1034, + "rap": 1035, + "part": 1036, + "lement": 1037, + "cla": 1038, + "fut": 1039, + "quelque": 1040, + "prendre": 1041, + "rê": 1042, + "aille": 1043, + "sais": 1044, + "ches": 1045, + "let": 1046, + "char": 1047, + "ères": 1048, + "ents": 1049, + "moins": 1050, + "eau": 1051, + "aî": 1052, + "jeu": 1053, + "heur": 1054, + "ées": 1055, + "tri": 1056, + "point": 1057, + "mom": 1058, + "vent": 1059, + "nouv": 1060, + "gran": 1061, + "trois": 1062, + "sant": 1063, + "toutes": 1064, + "contre": 1065, + "èrent": 1066, + "chez": 1067, + "avez": 1068, + "ût": 1069, + "att": 1070, + "pau": 1071, + "porte": 1072, + "ouver": 1073, + "lit": 1074, + "prés": 1075, + "chose": 1076, + "vit": 1077, + "monsieur": 1078, + "hab": 1079, + "tête": 1080, + "ju": 1081, + "tement": 1082, + "ction": 1083, + "vrai": 1084, + "lar": 1085, + "cet": 1086, + "regard": 1087, + "lant": 1088, + "som": 1089, + "moment": 1090, + "illes": 1091, + "ple": 1092, + "ps": 1093, + "mère": 1094, + "cl": 1095, + "sour": 1096, + "ys": 1097, + "trop": 1098, + "enne": 1099, + "jusqu": 1100, + "avaient": 1101, + "avais": 1102, + "jeune": 1103, + "depuis": 1104, + "personne": 1105, + "fit": 1106, + "cert": 1107, + "jo": 1108, + "oui": 1109, + "rest": 1110, + "semb": 1111, + "cap": 1112, + "mat": 1113, + "mu": 1114, + "long": 1115, + "fran": 1116, + "faut": 1117, + "iti": 1118, + "bli": 1119, + "chev": 1120, + "pri": 1121, + "ente": 1122, + "ainsi": 1123, + "cham": 1124, + "lors": 1125, + "cas": 1126, + "ili": 1127, + "bé": 1128, + "nos": 1129, + "sui": 1130, + "rit": 1131, + "cro": 1132, + "gue": 1133, + "ía": 1134, + "por": 1135, + "las": 1136, + "ón": 1137, + "una": 1138, + "aba": 1139, + "dos": 1140, + "era": 1141, + "mb": 1142, + "para": 1143, + "ás": 1144, + "mos": 1145, + "ando": 1146, + "como": 1147, + "más": 1148, + "ción": 1149, + "tan": 1150, + "dad": 1151, + "ado": 1152, + "fu": 1153, + "cia": 1154, + "mente": 1155, + "sus": 1156, + "tar": 1157, + "za": 1158, + "ba": 1159, + "pero": 1160, + "sin": 1161, + "lla": 1162, + "án": 1163, + "ia": 1164, + "ran": 1165, + "ga": 1166, + "yo": 1167, + "tos": 1168, + "cos": 1169, + "ya": 1170, + "ones": 1171, + "había": 1172, + "hi": 1173, + "esta": 1174, + "mas": 1175, + "tor": 1176, + "aban": 1177, + "dor": 1178, + "ían": 1179, + "tas": 1180, + "én": 1181, + "endo": 1182, + "aque": 1183, + "ero": 1184, + "io": 1185, + "qué": 1186, + "cab": 1187, + "tal": 1188, + "señ": 1189, + "ora": 1190, + "todo": 1191, + "sal": 1192, + "cuando": 1193, + "gun": 1194, + "bu": 1195, + "ras": 1196, + "esto": 1197, + "pare": 1198, + "él": 1199, + "tras": 1200, + "jos": 1201, + "mien": 1202, + "pue": 1203, + "cre": 1204, + "pon": 1205, + "día": 1206, + "tros": 1207, + "sab": 1208, + "sobre": 1209, + "ese": 1210, + "mbre": 1211, + "eron": 1212, + "añ": 1213, + "ido": 1214, + "porque": 1215, + "ella": 1216, + "cen": 1217, + "muy": 1218, + "cal": 1219, + "este": 1220, + "has": 1221, + "có": 1222, + "gra": 1223, + "ros": 1224, + "aquel": 1225, + "dijo": 1226, + "cía": 1227, + "zo": 1228, + "ciones": 1229, + "mbi": 1230, + "elo": 1231, + "tó": 1232, + "ina": 1233, + "todos": 1234, + "tien": 1235, + "estaba": 1236, + "deci": 1237, + "cio": 1238, + "ño": 1239, + "lor": 1240, + "nues": 1241, + "medi": 1242, + "len": 1243, + "vida": 1244, + "ali": 1245, + "pues": 1246, + "ales": 1247, + "vol": 1248, + "mí": 1249, + "rar": 1250, + "cion": 1251, + "hasta": 1252, + "señor": 1253, + "cono": 1254, + "ah": 1255, + "dios": 1256, + "esa": 1257, + "ún": 1258, + "var": 1259, + "san": 1260, + "gui": 1261, + "otros": 1262, + "tado": 1263, + "buen": 1264, + "ña": 1265, + "tiemp": 1266, + "hacer": 1267, + "jer": 1268, + "vu": 1269, + "ana": 1270, + "así": 1271, + "antes": 1272, + "vez": 1273, + "miento": 1274, + "jar": 1275, + "lab": 1276, + "casa": 1277, + "eso": 1278, + "ego": 1279, + "dió": 1280, + "está": 1281, + "encia": 1282, + "eli": 1283, + "ías": 1284, + "tiempo": 1285, + "zar": 1286, + "van": 1287, + "mun": 1288, + "erta": 1289, + "tambi": 1290, + "sí": 1291, + "aun": 1292, + "mismo": 1293, + "entes": 1294, + "mano": 1295, + "ele": 1296, + "nada": 1297, + "segu": 1298, + "mej": 1299, + "erra": 1300, + "tir": 1301, + "uno": 1302, + "donde": 1303, + "toda": 1304, + "desde": 1305, + "también": 1306, + "cuer": 1307, + "hombre": 1308, + "otro": 1309, + "lib": 1310, + "trar": 1311, + "cual": 1312, + "hay": 1313, + "cada": 1314, + "taba": 1315, + "mento": 1316, + "tenía": 1317, + "quer": 1318, + "eran": 1319, + "siemp": 1320, + "siempre": 1321, + "erto": 1322, + "quí": 1323, + "gos": 1324, + "pués": 1325, + "ellos": 1326, + "después": 1327, + "nue": 1328, + "llo": 1329, + "inter": 1330, + "cómo": 1331, + "ahora": 1332, + "uste": 1333, + "traba": 1334, + "lado": 1335, + "ino": 1336, + "poco": 1337, + "erte": 1338, + "mujer": 1339, + "quier": 1340, + "algun": 1341, + "fue": 1342, + "ojos": 1343, + "enton": 1344, + "vos": 1345, + "esper": 1346, + "much": 1347, + "otra": 1348, + "az": 1349, + "eza": 1350, + "aquí": 1351, + "cias": 1352, + "gua": 1353, + "mucho": 1354, + "decir": 1355, + "esti": 1356, + "idad": 1357, + "algo": 1358, + "ocu": 1359, + "entonces": 1360, + "dido": 1361, + "entos": 1362, + "gri": 1363, + "dado": 1364, + "ios": 1365, + "dose": 1366, + "usted": 1367, + "quien": 1368, + "ami": 1369, + "unto": 1370, + "mejor": 1371, + "bas": 1372, + "solo": 1373, + "pregun": 1374, + "tur": 1375, + "alg": 1376, + "todas": 1377, + "parte": 1378, + "emb": 1379, + "cto": 1380, + "mundo": 1381, + "tiene": 1382, + "tante": 1383, + "palab": 1384, + "tran": 1385, + "aquella": 1386, + "cios": 1387, + "aunque": 1388, + "cuen": 1389, + "tener": 1390, + "fun": 1391, + "respon": 1392, + "allí": 1393, + "xi": 1394, + "han": 1395, + "pens": 1396, + "contra": 1397, + "tura": 1398, + "val": 1399, + "dio": 1400, + "tanto": 1401, + "camin": 1402, + "mó": 1403, + "esp": 1404, + "ada": 1405, + "ío": 1406, + "hacia": 1407, + "dej": 1408, + "estar": 1409, + "ión": 1410, + "gas": 1411, + "vas": 1412, + "noche": 1413, + "ér": 1414, + "años": 1415, + "padre": 1416, + "gus": 1417, + "ár": 1418, + "sino": 1419, + "manos": 1420, + "cido": 1421, + "estu": 1422, + "hubi": 1423, + "vir": 1424, + "bri": 1425, + "raz": 1426, + "chi": 1427, + "puede": 1428, + "menos": 1429, + "habi": 1430, + "homb": 1431, + "neces": 1432, + "may": 1433, + "eros": 1434, + "ría": 1435, + "hecho": 1436, + "escu": 1437, + "lti": 1438, + "ándo": 1439, + "bus": 1440, + "cosas": 1441, + "tú": 1442, + "espa": 1443, + "reci": 1444, + "ctor": 1445, + "prim": 1446, + "dia": 1447, + "dese": 1448, + "mientras": 1449, + "hor": 1450, + "fuer": 1451, + "ida": 1452, + "posi": 1453, + "lante": 1454, + "ano": 1455, + "estas": 1456, + "pli": 1457, + "luego": 1458, + "sión": 1459, + "cin": 1460, + "tierra": 1461, + "guar": 1462, + "cado": 1463, + "encon": 1464, + "pren": 1465, + "mayor": 1466, + "fal": 1467, + "ð": 1468, + "ħ": 1469, + "ň": 1470, + "ə": 1471, + "θ": 1472, + "’": 1473, + "“": 1474, + "”": 1475, + "zi": 1476, + "gli": 1477, + "tto": 1478, + "ono": 1479, + "nel": 1480, + "tti": 1481, + "della": 1482, + "zione": 1483, + "tta": 1484, + "tà": 1485, + "uo": 1486, + "come": 1487, + "alla": 1488, + "oni": 1489, + "ggi": 1490, + "ssi": 1491, + "più": 1492, + "ini": 1493, + "bb": 1494, + "sto": 1495, + "sono": 1496, + "eri": 1497, + "sse": 1498, + "sc": 1499, + "sul": 1500, + "vano": 1501, + "sti": 1502, + "suo": 1503, + "cchi": 1504, + "zza": 1505, + "anche": 1506, + "tte": 1507, + "sci": 1508, + "col": 1509, + "sso": 1510, + "ssa": 1511, + "dei": 1512, + "aveva": 1513, + "zz": 1514, + "amo": 1515, + "gno": 1516, + "sua": 1517, + "ria": 1518, + "sì": 1519, + "ché": 1520, + "dal": 1521, + "ona": 1522, + "spe": 1523, + "gni": 1524, + "tt": 1525, + "delle": 1526, + "questo": 1527, + "nella": 1528, + "dere": 1529, + "anno": 1530, + "dell": 1531, + "uni": 1532, + "bbe": 1533, + "anti": 1534, + "ene": 1535, + "gio": 1536, + "uto": 1537, + "qual": 1538, + "glia": 1539, + "quando": 1540, + "tutto": 1541, + "glio": 1542, + "zioni": 1543, + "cam": 1544, + "esso": 1545, + "ss": 1546, + "mol": 1547, + "loro": 1548, + "perché": 1549, + "cosa": 1550, + "due": 1551, + "poi": 1552, + "sco": 1553, + "cco": 1554, + "gna": 1555, + "tem": 1556, + "prima": 1557, + "così": 1558, + "essere": 1559, + "ani": 1560, + "bra": 1561, + "rio": 1562, + "anco": 1563, + "cui": 1564, + "spi": 1565, + "via": 1566, + "gior": 1567, + "bile": 1568, + "ggio": 1569, + "mai": 1570, + "tare": 1571, + "indi": 1572, + "rebbe": 1573, + "senza": 1574, + "zio": 1575, + "tutti": 1576, + "stato": 1577, + "zia": 1578, + "dalla": 1579, + "mia": 1580, + "vita": 1581, + "quella": 1582, + "qua": 1583, + "dove": 1584, + "allo": 1585, + "sempre": 1586, + "zzo": 1587, + "sia": 1588, + "dopo": 1589, + "porta": 1590, + "ccia": 1591, + "erano": 1592, + "anni": 1593, + "chia": 1594, + "enza": 1595, + "propri": 1596, + "anda": 1597, + "cca": 1598, + "occhi": 1599, + "questa": 1600, + "ffi": 1601, + "ron": 1602, + "mio": 1603, + "ris": 1604, + "ogni": 1605, + "rin": 1606, + "far": 1607, + "menti": 1608, + "ancora": 1609, + "fatto": 1610, + "mani": 1611, + "senti": 1612, + "pra": 1613, + "tempo": 1614, + "essi": 1615, + "bbi": 1616, + "lare": 1617, + "pers": 1618, + "sor": 1619, + "anza": 1620, + "pie": 1621, + "verso": 1622, + "altro": 1623, + "tato": 1624, + "cato": 1625, + "ato": 1626, + "volta": 1627, + "cc": 1628, + "fare": 1629, + "ciò": 1630, + "bili": 1631, + "nuo": 1632, + "quello": 1633, + "colo": 1634, + "ppo": 1635, + "trova": 1636, + "ore": 1637, + "rono": 1638, + "molto": 1639, + "almente": 1640, + "sca": 1641, + "vole": 1642, + "tali": 1643, + "sulla": 1644, + "sce": 1645, + "meno": 1646, + "anto": 1647, + "pun": 1648, + "stu": 1649, + "capi": 1650, + "giu": 1651, + "mini": 1652, + "pia": 1653, + "lavo": 1654, + "vero": 1655, + "rsi": 1656, + "altri": 1657, + "scia": 1658, + "suoi": 1659, + "glie": 1660, + "sotto": 1661, + "bene": 1662, + "scri": 1663, + "tale": 1664, + "degli": 1665, + "alc": 1666, + "uomo": 1667, + "pel": 1668, + "pote": 1669, + "essa": 1670, + "scu": 1671, + "signo": 1672, + "stro": 1673, + "uti": 1674, + "sione": 1675, + "gre": 1676, + "fini": 1677, + "lun": 1678, + "esi": 1679, + "passa": 1680, + "rà": 1681, + "mentre": 1682, + "hanno": 1683, + "usci": 1684, + "gia": 1685, + "già": 1686, + "mina": 1687, + "tica": 1688, + "giorno": 1689, + "esse": 1690, + "modo": 1691, + "spa": 1692, + "proprio": 1693, + "ori": 1694, + "contro": 1695, + "stru": 1696, + "diven": 1697, + "disse": 1698, + "rato": 1699, + "noi": 1700, + "vere": 1701, + "può": 1702, + "dice": 1703, + "cci": 1704, + "secon": 1705, + "ccio": 1706, + "qualche": 1707, + "tutta": 1708, + "gg": 1709, + "mondo": 1710, + "forma": 1711, + "mma": 1712, + "pensa": 1713, + "deva": 1714, + "fosse": 1715, + "sopra": 1716, + "tamente": 1717, + "ness": 1718, + "quanto": 1719, + "raga": 1720, + "unque": 1721, + "care": 1722, + "stre": 1723, + "grande": 1724, + "picco": 1725, + "guarda": 1726, + "nell": 1727, + "possi": 1728, + "presen": 1729, + "rò": 1730, + "paro": 1731, + "tua": 1732, + "vin": 1733, + "ane": 1734, + "stesso": 1735, + "dav": 1736, + "nei": 1737, + "nelle": 1738, + "ghi": 1739, + "pio": 1740, + "lato": 1741, + "sid": 1742, + "fine": 1743, + "fuo": 1744, + "quasi": 1745, + "ulti": 1746, + "ito": 1747, + "sue": 1748, + "fil": 1749, + "allora": 1750, + "veni": 1751, + "tano": 1752, + "ello": 1753, + "ão": 1754, + "não": 1755, + "uma": 1756, + "ela": 1757, + "lh": 1758, + "ção": 1759, + "cê": 1760, + "inha": 1761, + "você": 1762, + "ec": 1763, + "dade": 1764, + "ao": 1765, + "ram": 1766, + "vel": 1767, + "ém": 1768, + "pode": 1769, + "estava": 1770, + "isso": 1771, + "mui": 1772, + "faz": 1773, + "ões": 1774, + "pes": 1775, + "ix": 1776, + "sim": 1777, + "olh": 1778, + "isa": 1779, + "ên": 1780, + "tinha": 1781, + "meu": 1782, + "são": 1783, + "minha": 1784, + "muito": 1785, + "foi": 1786, + "bem": 1787, + "diz": 1788, + "parec": 1789, + "ço": 1790, + "pesso": 1791, + "pois": 1792, + "mesmo": 1793, + "ções": 1794, + "seus": 1795, + "até": 1796, + "ência": 1797, + "lhe": 1798, + "tiv": 1799, + "mã": 1800, + "só": 1801, + "tão": 1802, + "tudo": 1803, + "então": 1804, + "inda": 1805, + "bal": 1806, + "indo": 1807, + "ndo": 1808, + "já": 1809, + "vam": 1810, + "eito": 1811, + "depois": 1812, + "mel": 1813, + "lha": 1814, + "ainda": 1815, + "fazer": 1816, + "pou": 1817, + "pergun": 1818, + "deix": 1819, + "tamb": 1820, + "ala": 1821, + "pelo": 1822, + "também": 1823, + "fica": 1824, + "prec": 1825, + "eles": 1826, + "havia": 1827, + "lá": 1828, + "nas": 1829, + "gem": 1830, + "mem": 1831, + "ós": 1832, + "deu": 1833, + "eiro": 1834, + "..": 1835, + "assim": 1836, + "ior": 1837, + "har": 1838, + "aqui": 1839, + "cul": 1840, + "sar": 1841, + "outra": 1842, + "olhos": 1843, + "ima": 1844, + "mim": 1845, + "ago": 1846, + "pessoas": 1847, + "eram": 1848, + "eira": 1849, + "pela": 1850, + "coisa": 1851, + "mão": 1852, + "conh": 1853, + "agora": 1854, + "iam": 1855, + "há": 1856, + "suas": 1857, + "guém": 1858, + "cabe": 1859, + "nem": 1860, + "ível": 1861, + "consegu": 1862, + "trabal": 1863, + "lev": 1864, + "lem": 1865, + "vai": 1866, + "tei": 1867, + "pró": 1868, + "quem": 1869, + "onde": 1870, + "cabeça": 1871, + "nunca": 1872, + "mentos": 1873, + "hum": 1874, + "dele": 1875, + "verdade": 1876, + "tá": 1877, + "hos": 1878, + "algum": 1879, + "dizer": 1880, + "penas": 1881, + "nós": 1882, + "enquanto": 1883, + "outro": 1884, + "lho": 1885, + "melhor": 1886, + "primei": 1887, + "iu": 1888, + "apenas": 1889, + "estou": 1890, + "conte": 1891, + "homem": 1892, + "dois": 1893, + "ças": 1894, + "pouco": 1895, + "senhor": 1896, + "tando": 1897, + "espera": 1898, + "pai": 1899, + "rios": 1900, + "baix": 1901, + "ase": 1902, + "isas": 1903, + "hora": 1904, + "ficar": 1905, + "seja": 1906, + "ân": 1907, + "clar": 1908, + "inc": 1909, + "fos": 1910, + "ouvi": 1911, + "vem": 1912, + "tava": 1913, + "ário": 1914, + "sos": 1915, + "inho": 1916, + "rando": 1917, + "ês": 1918, + "coisas": 1919, + "aconte": 1920, + "lher": 1921, + "anos": 1922, + "talvez": 1923, + "estão": 1924, + "liv": 1925, + "outros": 1926, + "qualquer": 1927, + "gou": 1928, + "lí": 1929, + "tivesse": 1930, + "rado": 1931, + "precisa": 1932, + "mãe": 1933, + "dela": 1934, + "entra": 1935, + "maior": 1936, + "noite": 1937, + "tiva": 1938, + "pala": 1939, + "ração": 1940, + "deus": 1941, + "sas": 1942, + "inte": 1943, + "fei": 1944, + "palav": 1945, + "trás": 1946, + "cidade": 1947, + "lugar": 1948, + "vezes": 1949, + "encontra": 1950, + "tru": 1951, + "eci": 1952, + "ın": 1953, + "bir": 1954, + "yor": 1955, + "ek": 1956, + "dı": 1957, + "ey": 1958, + "tı": 1959, + "mı": 1960, + "iz": 1961, + "ır": 1962, + "gö": 1963, + "sı": 1964, + "bil": 1965, + "lı": 1966, + "üz": 1967, + "iç": 1968, + "iy": 1969, + "ım": 1970, + "uz": 1971, + "cak": 1972, + "iş": 1973, + "ını": 1974, + "iyor": 1975, + "baş": 1976, + "dü": 1977, + "değ": 1978, + "kar": 1979, + "ev": 1980, + "öy": 1981, + "bun": 1982, + "yap": 1983, + "sun": 1984, + "gör": 1985, + "yı": 1986, + "ki": 1987, + "ara": 1988, + "alı": 1989, + "onu": 1990, + "çı": 1991, + "şey": 1992, + "sın": 1993, + "kı": 1994, + "kad": 1995, + "ağ": 1996, + "değil": 1997, + "ük": 1998, + "çok": 1999, + "şı": 2000, + "ül": 2001, + "için": 2002, + "eye": 2003, + "oldu": 2004, + "mış": 2005, + "kal": 2006, + "mek": 2007, + "öyle": 2008, + "yordu": 2009, + "yüz": 2010, + "miş": 2011, + "mak": 2012, + "ola": 2013, + "yan": 2014, + "cek": 2015, + "yorum": 2016, + "bak": 2017, + "üm": 2018, + "ları": 2019, + "oğ": 2020, + "kadar": 2021, + "arı": 2022, + "ında": 2023, + "gün": 2024, + "yok": 2025, + "yer": 2026, + "dım": 2027, + "daha": 2028, + "ına": 2029, + "dim": 2030, + "bilir": 2031, + "iki": 2032, + "siz": 2033, + "diğ": 2034, + "bü": 2035, + "düş": 2036, + "üç": 2037, + "unu": 2038, + "aman": 2039, + "fak": 2040, + "ede": 2041, + "sonra": 2042, + "hiç": 2043, + "aki": 2044, + "ğı": 2045, + "bul": 2046, + "maz": 2047, + "anla": 2048, + "bura": 2049, + "geç": 2050, + "maya": 2051, + "konu": 2052, + "din": 2053, + "tek": 2054, + "zaman": 2055, + "eler": 2056, + "öz": 2057, + "dır": 2058, + "gibi": 2059, + "şa": 2060, + "leri": 2061, + "kim": 2062, + "ku": 2063, + "fakat": 2064, + "yar": 2065, + "göz": 2066, + "cı": 2067, + "yorsun": 2068, + "bek": 2069, + "inde": 2070, + "pek": 2071, + "bunu": 2072, + "lik": 2073, + "iler": 2074, + "edi": 2075, + "öl": 2076, + "sür": 2077, + "sır": 2078, + "çık": 2079, + "sıl": 2080, + "alar": 2081, + "kes": 2082, + "yak": 2083, + "çek": 2084, + "yıl": 2085, + "ecek": 2086, + "ız": 2087, + "git": 2088, + "kap": 2089, + "ama": 2090, + "ıl": 2091, + "ların": 2092, + "biz": 2093, + "tır": 2094, + "oy": 2095, + "ancak": 2096, + "doğ": 2097, + "bana": 2098, + "şim": 2099, + "başla": 2100, + "lü": 2101, + "madı": 2102, + "beni": 2103, + "yük": 2104, + "lık": 2105, + "beş": 2106, + "nasıl": 2107, + "tık": 2108, + "tür": 2109, + "daki": 2110, + "ceğ": 2111, + "zı": 2112, + "iyi": 2113, + "dok": 2114, + "benim": 2115, + "cağ": 2116, + "yen": 2117, + "şu": 2118, + "mez": 2119, + "düşün": 2120, + "kendi": 2121, + "şimdi": 2122, + "yol": 2123, + "yu": 2124, + "iste": 2125, + "sek": 2126, + "mam": 2127, + "söyle": 2128, + "dik": 2129, + "kur": 2130, + "olduğ": 2131, + "sını": 2132, + "biliyor": 2133, + "kan": 2134, + "yal": 2135, + "meye": 2136, + "muş": 2137, + "kaç": 2138, + "iye": 2139, + "tü": 2140, + "ef": 2141, + "tım": 2142, + "evet": 2143, + "yet": 2144, + "burada": 2145, + "tim": 2146, + "biraz": 2147, + "kor": 2148, + "doğru": 2149, + "inin": 2150, + "kız": 2151, + "diye": 2152, + "dör": 2153, + "etti": 2154, + "onun": 2155, + "isti": 2156, + "ği": 2157, + "sana": 2158, + "üş": 2159, + "arka": 2160, + "hayır": 2161, + "karşı": 2162, + "ile": 2163, + "hak": 2164, + "ıyor": 2165, + "neden": 2166, + "sev": 2167, + "sız": 2168, + "çocu": 2169, + "çalı": 2170, + "olur": 2171, + "bır": 2172, + "gir": 2173, + "ise": 2174, + "ih": 2175, + "kır": 2176, + "dön": 2177, + "böyle": 2178, + "seni": 2179, + "!\"": 2180, + "dört": 2181, + "söy": 2182, + "oş": 2183, + "musun": 2184, + "laş": 2185, + "ip": 2186, + "kay": 2187, + "hem": 2188, + "büyük": 2189, + "aç": 2190, + "bırak": 2191, + "misin": 2192, + "söz": 2193, + "değiş": 2194, + "ünü": 2195, + "gül": 2196, + "kö": 2197, + "karı": 2198, + "tamam": 2199, + "olu": 2200, + "yeni": 2201, + "lam": 2202, + "mıştı": 2203, + "yaş": 2204, + "iniz": 2205, + "kadın": 2206, + "bunun": 2207, + "mey": 2208, + "altı": 2209, + "yi": 2210, + "inden": 2211, + "senin": 2212, + "yat": 2213, + "top": 2214, + "isi": 2215, + "dün": 2216, + "hiçbir": 2217, + "yon": 2218, + "dın": 2219, + "tün": 2220, + "başka": 2221, + "hep": 2222, + "irmi": 2223, + "devam": 2224, + "olacak": 2225, + "artık": 2226, + "durum": 2227, + "imiz": 2228, + "üzel": 2229, + "lerini": 2230, + "sağ": 2231, + "gerek": 2232, + "yirmi": 2233, + "şek": 2234, + "bağ": 2235, + "lara": 2236, + "yür": 2237, + "ması": 2238, + "katı": 2239, + "dedi": 2240, + "gü": 2241, + "sorun": 2242, + "üne": 2243, + "mız": 2244, + "yapı": 2245, + "mil": 2246, + "ğını": 2247, + "tara": 2248, + "vardı": 2249, + "konuş": 2250, + "arak": 2251, + "larak": 2252, + "çocuk": 2253, + "bütün": 2254, + "ley": 2255, + "dür": 2256, + "güzel": 2257, + "ayı": 2258, + "yapa": 2259, + "nı": 2260, + "ayr": 2261, + "öne": 2262, + "yordum": 2263, + "ban": 2264, + "i̇ş": 2265, + "dum": 2266, + "yorlar": 2267, + "larını": 2268, + "çıkar": 2269, + "zan": 2270, + "seç": 2271, + "liyor": 2272, + "tak": 2273, + "şık": 2274, + "tekrar": 2275, + "aş": 2276, + "eş": 2277, + "mişti": 2278, + "kin": 2279, + "imi": 2280, + "eğ": 2281, + "gidi": 2282, + "leş": 2283, + "başladı": 2284, + "gide": 2285, + "otur": 2286, + "dde": 2287, + "ından": 2288, + "üzer": 2289, + "ının": 2290, + "nız": 2291, + "uy": 2292, + "yedi": 2293, + "kat": 2294, + "olarak": 2295, + "ladı": 2296, + "yalnız": 2297, + "bah": 2298, + "iyet": 2299, + "sak": 2300, + "açık": 2301, + "sında": 2302, + "...": 2303, + "insan": 2304, + "aynı": 2305, + "eder": 2306, + "istan": 2307, + "uzun": 2308, + "geri": 2309, + "erek": 2310, + "olan": 2311, + "gerçek": 2312, + "alan": 2313, + "dış": 2314, + "alık": 2315, + "fark": 2316, + "üst": 2317, + "sade": 2318, + "kiş": 2319, + "ldı": 2320, + "zor": 2321, + "etir": 2322, + "herkes": 2323, + "ömer": 2324, + "unda": 2325, + "haf": 2326, + "buna": 2327, + "ydı": 2328, + "peki": 2329, + "adam": 2330, + "haz": 2331, + "sına": 2332, + "kapı": 2333, + "görüş": 2334, + "sadece": 2335, + "aldı": 2336, + "geldi": 2337, + "rz": 2338, + "sz": 2339, + "cz": 2340, + "ię": 2341, + "dz": 2342, + "ał": 2343, + "się": 2344, + "rze": 2345, + "że": 2346, + "wy": 2347, + "rzy": 2348, + "ła": 2349, + "ło": 2350, + "ny": 2351, + "dzie": 2352, + "dzi": 2353, + "czy": 2354, + "cie": 2355, + "prze": 2356, + "dy": 2357, + "kie": 2358, + "ry": 2359, + "ją": 2360, + "ów": 2361, + "przy": 2362, + "mie": 2363, + "szy": 2364, + "cze": 2365, + "bie": 2366, + "cy": 2367, + "nia": 2368, + "ści": 2369, + "sze": 2370, + "jest": 2371, + "ży": 2372, + "ną": 2373, + "któ": 2374, + "ała": 2375, + "mnie": 2376, + "ły": 2377, + "cza": 2378, + "jak": 2379, + "roz": 2380, + "ró": 2381, + "zna": 2382, + "łu": 2383, + "ść": 2384, + "wia": 2385, + "wszy": 2386, + "spo": 2387, + "gdy": 2388, + "wał": 2389, + "wię": 2390, + "łem": 2391, + "ję": 2392, + "sk": 2393, + "rę": 2394, + "dob": 2395, + "już": 2396, + "bę": 2397, + "ałem": 2398, + "sza": 2399, + "pod": 2400, + "dla": 2401, + "pan": 2402, + "nę": 2403, + "może": 2404, + "śli": 2405, + "ało": 2406, + "lko": 2407, + "nych": 2408, + "powie": 2409, + "cię": 2410, + "tylko": 2411, + "naj": 2412, + "tego": 2413, + "ski": 2414, + "nego": 2415, + "wszyst": 2416, + "szcze": 2417, + "jed": 2418, + "jej": 2419, + "two": 2420, + "ąd": 2421, + "śmy": 2422, + "czę": 2423, + "wać": 2424, + "jego": 2425, + "ża": 2426, + "sy": 2427, + "praw": 2428, + "tym": 2429, + "który": 2430, + "ały": 2431, + "trze": 2432, + "niej": 2433, + "nym": 2434, + "gło": 2435, + "jąc": 2436, + "mówi": 2437, + "ska": 2438, + "nej": 2439, + "słu": 2440, + "wła": 2441, + "będzie": 2442, + "dę": 2443, + "pó": 2444, + "bez": 2445, + "nic": 2446, + "pła": 2447, + "ście": 2448, + "są": 2449, + "trzy": 2450, + "kiem": 2451, + "był": 2452, + "mog": 2453, + "robi": 2454, + "tam": 2455, + "mię": 2456, + "zy": 2457, + "pew": 2458, + "myś": 2459, + "przed": 2460, + "sko": 2461, + "które": 2462, + "lę": 2463, + "wsze": 2464, + "ąc": 2465, + "było": 2466, + "sobie": 2467, + "py": 2468, + "cią": 2469, + "jeszcze": 2470, + "tę": 2471, + "czas": 2472, + "szę": 2473, + "gł": 2474, + "kę": 2475, + "czu": 2476, + "przez": 2477, + "sło": 2478, + "wz": 2479, + "kto": 2480, + "ków": 2481, + "czo": 2482, + "liśmy": 2483, + "więc": 2484, + "rą": 2485, + "wó": 2486, + "rza": 2487, + "ności": 2488, + "wet": 2489, + "nął": 2490, + "śmie": 2491, + "nawet": 2492, + "musi": 2493, + "swo": 2494, + "tej": 2495, + "wą": 2496, + "wu": 2497, + "wią": 2498, + "niu": 2499, + "czą": 2500, + "dzo": 2501, + "skie": 2502, + "jeśli": 2503, + "czego": 2504, + "chy": 2505, + "dł": 2506, + "tych": 2507, + "bym": 2508, + "żo": 2509, + "eś": 2510, + "sią": 2511, + "kiedy": 2512, + "wró": 2513, + "dze": 2514, + "dro": 2515, + "rów": 2516, + "pani": 2517, + "kul": 2518, + "nad": 2519, + "chwi": 2520, + "nim": 2521, + "być": 2522, + "chodzi": 2523, + "nio": 2524, + "dobrze": 2525, + "teraz": 2526, + "wokul": 2527, + "coś": 2528, + "kł": 2529, + "pier": 2530, + "gdzie": 2531, + "dzy": 2532, + "pię": 2533, + "dź": 2534, + "ką": 2535, + "gó": 2536, + "zda": 2537, + "chce": 2538, + "stę": 2539, + "świa": 2540, + "wszystko": 2541, + "peł": 2542, + "wiem": 2543, + "wiel": 2544, + "każ": 2545, + "rzu": 2546, + "sły": 2547, + "jedna": 2548, + "myśl": 2549, + "mój": 2550, + "jestem": 2551, + "óż": 2552, + "miej": 2553, + "moż": 2554, + "kła": 2555, + "resz": 2556, + "dłu": 2557, + "stwo": 2558, + "nię": 2559, + "masz": 2560, + "żeby": 2561, + "niem": 2562, + "jakie": 2563, + "sty": 2564, + "nią": 2565, + "wej": 2566, + "oj": 2567, + "sła": 2568, + "ność": 2569, + "zło": 2570, + "szczę": 2571, + "lej": 2572, + "wego": 2573, + "cał": 2574, + "dział": 2575, + "kich": 2576, + "dza": 2577, + "dzię": 2578, + "oczy": 2579, + "zosta": 2580, + "czło": 2581, + "nam": 2582, + "kil": 2583, + "szu": 2584, + "wę": 2585, + "miał": 2586, + "strze": 2587, + "cej": 2588, + "ej": 2589, + "znaj": 2590, + "dać": 2591, + "miejs": 2592, + "kró": 2593, + "kry": 2594, + "bardzo": 2595, + "śnie": 2596, + "lą": 2597, + "gie": 2598, + "ciebie": 2599, + "dni": 2600, + "potrze": 2601, + "wokulski": 2602, + "uwa": 2603, + "umie": 2604, + "jednak": 2605, + "kra": 2606, + "wróci": 2607, + "człowie": 2608, + "czyć": 2609, + "była": 2610, + "żeli": 2611, + "mę": 2612, + "cę": 2613, + "zrobi": 2614, + "mogę": 2615, + "prowa": 2616, + "rem": 2617, + "niech": 2618, + "cznie": 2619, + "kro": 2620, + "tą": 2621, + "chci": 2622, + "bro": 2623, + "dzieć": 2624, + "szą": 2625, + "pad": 2626, + "trz": 2627, + "jem": 2628, + "tów": 2629, + "dru": 2630, + "taj": 2631, + "rzekł": 2632, + "niego": 2633, + "takie": 2634, + "wała": 2635, + "towa": 2636, + "kapła": 2637, + "widzi": 2638, + "podob": 2639, + "dzę": 2640, + "tał": 2641, + "stęp": 2642, + "bą": 2643, + "poko": 2644, + "wem": 2645, + "gę": 2646, + "aby": 2647, + "albo": 2648, + "spra": 2649, + "zno": 2650, + "smo": 2651, + "jesz": 2652, + "księ": 2653, + "jesteś": 2654, + "poz": 2655, + "nigdy": 2656, + "ksią": 2657, + "cóż": 2658, + "ws": 2659, + "pow": 2660, + "tka": 2661, + "świe": 2662, + "szka": 2663, + "samo": 2664, + "sł": 2665, + "rzę": 2666, + "nale": 2667, + "chcesz": 2668, + "nik": 2669, + "pę": 2670, + "chyba": 2671, + "ciąg": 2672, + "jący": 2673, + "woj": 2674, + "nasze": 2675, + "mniej": 2676, + "więcej": 2677, + "zwy": 2678, + "osta": 2679, + "waż": 2680, + "śmier": 2681, + "wier": 2682, + "dzą": 2683, + "zaś": 2684, + "gdyby": 2685, + "jaki": 2686, + "wol": 2687, + "win": 2688, + "dą": 2689, + "ścia": 2690, + "rozma": 2691, + "wal": 2692, + "panie": 2693, + "star": 2694, + "kaz": 2695, + "jeżeli": 2696, + "wra": 2697, + "koń": 2698, + "siebie": 2699, + "znowu": 2700, + "czem": 2701, + "stwa": 2702, + "isto": 2703, + "pół": 2704, + "dał": 2705, + "kobie": 2706, + "ałam": 2707, + "wych": 2708, + "cesa": 2709, + "nich": 2710, + "zawsze": 2711, + "dzić": 2712, + "też": 2713, + "lepie": 2714, + "proszę": 2715, + "kre": 2716, + "twa": 2717, + "łą": 2718, + "chu": 2719, + "cą": 2720, + "prz": 2721, + "łe": 2722, + "szedł": 2723, + "odpowie": 2724, + "myśli": 2725, + "świą": 2726, + "ź": 2727, + "ł": 2728, + "&": 2729, + "=": 2730, + "ă": 2731, + "đ": 2732, + "ţ": 2733, + "–": 2734, + "‘": 2735, + "ij": 2736, + "aa": 2737, + "een": 2738, + "het": 2739, + "aar": 2740, + "oor": 2741, + "ijn": 2742, + "dat": 2743, + "oe": 2744, + "ijk": 2745, + "aan": 2746, + "voor": 2747, + "iet": 2748, + "zijn": 2749, + "niet": 2750, + "oo": 2751, + "moet": 2752, + "heb": 2753, + "uit": 2754, + "wij": 2755, + "aat": 2756, + "lijk": 2757, + "sl": 2758, + "daar": 2759, + "deze": 2760, + "worden": 2761, + "moeten": 2762, + "onder": 2763, + "hebben": 2764, + "ook": 2765, + "ct": 2766, + "nog": 2767, + "aal": 2768, + "eer": 2769, + "bij": 2770, + "mijn": 2771, + "kom": 2772, + "atie": 2773, + "eft": 2774, + "kel": 2775, + "rij": 2776, + "heid": 2777, + "af": 2778, + "stel": 2779, + "maar": 2780, + "wee": 2781, + "heeft": 2782, + "waar": 2783, + "eren": 2784, + "wat": 2785, + "wil": 2786, + "aag": 2787, + "bet": 2788, + "hij": 2789, + "kun": 2790, + "uw": 2791, + "dt": 2792, + "door": 2793, + "tij": 2794, + "ond": 2795, + "geen": 2796, + "gev": 2797, + "veel": 2798, + "naar": 2799, + "aten": 2800, + "kunnen": 2801, + "echt": 2802, + "goe": 2803, + "twee": 2804, + "delijk": 2805, + "uur": 2806, + "toe": 2807, + "meer": 2808, + "onze": 2809, + "tijd": 2810, + "hoe": 2811, + "tot": 2812, + "zou": 2813, + "aak": 2814, + "amen": 2815, + "woor": 2816, + "wordt": 2817, + "gelijk": 2818, + "gaan": 2819, + "ker": 2820, + "eld": 2821, + "hou": 2822, + "zel": 2823, + "tegen": 2824, + "komen": 2825, + "werk": 2826, + "goed": 2827, + "zal": 2828, + "zij": 2829, + "slag": 2830, + "zien": 2831, + "echter": 2832, + "itie": 2833, + "tie": 2834, + "elijk": 2835, + "ische": 2836, + "belan": 2837, + "haar": 2838, + "vr": 2839, + "grijk": 2840, + "doen": 2841, + "land": 2842, + "belangrijk": 2843, + "open": 2844, + "ctie": 2845, + "zelf": 2846, + "mij": 2847, + "iteit": 2848, + "stem": 2849, + "mee": 2850, + "aren": 2851, + "dien": 2852, + "gaat": 2853, + "prob": 2854, + "moe": 2855, + "ullen": 2856, + "zich": 2857, + "daarom": 2858, + "orm": 2859, + "staat": 2860, + "zit": 2861, + "dui": 2862, + "dus": 2863, + "ds": 2864, + "verslag": 2865, + "kelijk": 2866, + "proble": 2867, + "schap": 2868, + "gd": 2869, + "hun": 2870, + "erd": 2871, + "zet": 2872, + "staan": 2873, + "maal": 2874, + "inder": 2875, + "eid": 2876, + "kken": 2877, + "ged": 2878, + "zullen": 2879, + "mensen": 2880, + "jaar": 2881, + "regel": 2882, + "ieder": 2883, + "volgen": 2884, + "geven": 2885, + "even": 2886, + "blij": 2887, + "ië": 2888, + "uwe": 2889, + "maken": 2890, + "oek": 2891, + "nieuwe": 2892, + "baar": 2893, + "andere": 2894, + "ruik": 2895, + "agen": 2896, + "ouw": 2897, + "willen": 2898, + "aakt": 2899, + "hoo": 2900, + "anden": 2901, + "lig": 2902, + "samen": 2903, + "zeer": 2904, + "duidelijk": 2905, + "antwoor": 2906, + "heel": 2907, + "punt": 2908, + "houden": 2909, + "vraag": 2910, + "gele": 2911, + "eens": 2912, + "besch": 2913, + "omen": 2914, + "erg": 2915, + "doel": 2916, + "dag": 2917, + "uren": 2918, + "ings": 2919, + "oren": 2920, + "delen": 2921, + "steun": 2922, + "innen": 2923, + "pol": 2924, + "oon": 2925, + "sn": 2926, + "zonder": 2927, + "nodig": 2928, + "alleen": 2929, + "mid": 2930, + "ragen": 2931, + "iets": 2932, + "versch": 2933, + "gebruik": 2934, + "rouw": 2935, + "stellen": 2936, + "menten": 2937, + "eerste": 2938, + "laat": 2939, + "groot": 2940, + "ood": 2941, + "toch": 2942, + "laten": 2943, + "aard": 2944, + "sle": 2945, + "deel": 2946, + "plaat": 2947, + "ree": 2948, + "betre": 2949, + "lid": 2950, + "uiten": 2951, + "racht": 2952, + "beleid": 2953, + "stie": 2954, + "staten": 2955, + "ggen": 2956, + "reken": 2957, + "alen": 2958, + "ming": 2959, + "mogelijk": 2960, + "grote": 2961, + "altijd": 2962, + "enkel": 2963, + "wik": 2964, + "politie": 2965, + "elk": 2966, + "handel": 2967, + "kwe": 2968, + "maat": 2969, + "elen": 2970, + "vrij": 2971, + "jes": 2972, + "aam": 2973, + "huis": 2974, + "weer": 2975, + "lidstaten": 2976, + "king": 2977, + "kle": 2978, + "bed": 2979, + "geval": 2980, + "wikkel": 2981, + "kwestie": 2982, + "stee": 2983, + "hel": 2984, + "komst": 2985, + "iden": 2986, + "eerd": 2987, + "tweede": 2988, + "probleem": 2989, + "ussen": 2990, + "snel": 2991, + "tig": 2992, + "ult": 2993, + "nemen": 2994, + "commis": 2995, + "verschil": 2996, + "zoek": 2997, + "krij": 2998, + "graag": 2999, + "denk": 3000, + "landen": 3001, + "reden": 3002, + "besl": 3003, + "oeg": 3004, + "beter": 3005, + "heden": 3006, + "mag": 3007, + "boven": 3008, + "cont": 3009, + "fd": 3010, + "hele": 3011, + "vier": 3012, + "gez": 3013, + "kw": 3014, + "aas": 3015, + "ontwikkel": 3016, + "drie": 3017, + "vaak": 3018, + "plaats": 3019, + "gang": 3020, + "ijf": 3021, + "natuur": 3022, + "tussen": 3023, + "bat": 3024, + "komt": 3025, + "wacht": 3026, + "aad": 3027, + "achter": 3028, + "gebie": 3029, + "verk": 3030, + "ligt": 3031, + "nieuw": 3032, + "vand": 3033, + "ý": 3034, + "ď": 3035, + "ě": 3036, + "ř": 3037, + "ť": 3038, + "ů": 3039, + "„": 3040, + "ní": 3041, + "ně": 3042, + "ře": 3043, + "ná": 3044, + "vě": 3045, + "vá": 3046, + "rá": 3047, + "vy": 3048, + "mě": 3049, + "ři": 3050, + "ří": 3051, + "že": 3052, + "jí": 3053, + "vý": 3054, + "ji": 3055, + "dě": 3056, + "če": 3057, + "tě": 3058, + "ky": 3059, + "še": 3060, + "ké": 3061, + "ší": 3062, + "pře": 3063, + "ví": 3064, + "ný": 3065, + "ži": 3066, + "má": 3067, + "cí": 3068, + "zá": 3069, + "ské": 3070, + "dá": 3071, + "byl": 3072, + "tí": 3073, + "pří": 3074, + "při": 3075, + "či": 3076, + "vní": 3077, + "ča": 3078, + "dí": 3079, + "dní": 3080, + "ká": 3081, + "nou": 3082, + "vět": 3083, + "pě": 3084, + "kou": 3085, + "ých": 3086, + "bě": 3087, + "prá": 3088, + "jako": 3089, + "ží": 3090, + "zí": 3091, + "jsou": 3092, + "jsem": 3093, + "lní": 3094, + "cké": 3095, + "vat": 3096, + "před": 3097, + "hla": 3098, + "stá": 3099, + "čí": 3100, + "ši": 3101, + "kla": 3102, + "ště": 3103, + "lou": 3104, + "mů": 3105, + "chá": 3106, + "pů": 3107, + "také": 3108, + "dů": 3109, + "nost": 3110, + "tře": 3111, + "sku": 3112, + "vše": 3113, + "tní": 3114, + "byla": 3115, + "ční": 3116, + "jeho": 3117, + "bý": 3118, + "vání": 3119, + "ných": 3120, + "tři": 3121, + "vz": 3122, + "stře": 3123, + "dva": 3124, + "hle": 3125, + "čá": 3126, + "nosti": 3127, + "vš": 3128, + "hra": 3129, + "jen": 3130, + "slo": 3131, + "však": 3132, + "kdy": 3133, + "bylo": 3134, + "bude": 3135, + "jší": 3136, + "vých": 3137, + "ním": 3138, + "sm": 3139, + "koli": 3140, + "rů": 3141, + "může": 3142, + "není": 3143, + "hod": 3144, + "bí": 3145, + "tý": 3146, + "stě": 3147, + "uje": 3148, + "sá": 3149, + "pět": 3150, + "krá": 3151, + "tom": 3152, + "ství": 3153, + "vně": 3154, + "sed": 3155, + "své": 3156, + "pí": 3157, + "musí": 3158, + "už": 3159, + "tím": 3160, + "jící": 3161, + "jedno": 3162, + "čas": 3163, + "čty": 3164, + "ský": 3165, + "evro": 3166, + "toho": 3167, + "hy": 3168, + "kter": 3169, + "rní": 3170, + "stí": 3171, + "svě": 3172, + "pak": 3173, + "všech": 3174, + "ků": 3175, + "ng": 3176, + "ád": 3177, + "chází": 3178, + "být": 3179, + "první": 3180, + "mno": 3181, + "ského": 3182, + "pá": 3183, + "nebo": 3184, + "kem": 3185, + "sla": 3186, + "ného": 3187, + "zde": 3188, + "další": 3189, + "řa": 3190, + "čtyři": 3191, + "hrá": 3192, + "druh": 3193, + "lně": 3194, + "vla": 3195, + "ských": 3196, + "ško": 3197, + "půso": 3198, + "proto": 3199, + "vů": 3200, + "ská": 3201, + "šest": 3202, + "dně": 3203, + "ještě": 3204, + "mezi": 3205, + "několi": 3206, + "již": 3207, + "čně": 3208, + "slu": 3209, + "zná": 3210, + "sedm": 3211, + "vlá": 3212, + "osm": 3213, + "byly": 3214, + "vám": 3215, + "cký": 3216, + "tech": 3217, + "ději": 3218, + "velmi": 3219, + "leži": 3220, + "vala": 3221, + "lý": 3222, + "tvo": 3223, + "spole": 3224, + "stup": 3225, + "mož": 3226, + "evrop": 3227, + "stal": 3228, + "jde": 3229, + "rodi": 3230, + "její": 3231, + "poli": 3232, + "devět": 3233, + "sme": 3234, + "až": 3235, + "této": 3236, + "tento": 3237, + "kaž": 3238, + "nula": 3239, + "bych": 3240, + "moc": 3241, + "stou": 3242, + "kdo": 3243, + "zd": 3244, + "praco": 3245, + "tomu": 3246, + "ným": 3247, + "živo": 3248, + "zem": 3249, + "násle": 3250, + "sky": 3251, + "jich": 3252, + "měl": 3253, + "děla": 3254, + "jsme": 3255, + "nice": 3256, + "stej": 3257, + "stní": 3258, + "náro": 3259, + "nit": 3260, + "později": 3261, + "tako": 3262, + "nce": 3263, + "čer": 3264, + "ším": 3265, + "něco": 3266, + "vál": 3267, + "řej": 3268, + "krát": 3269, + "ální": 3270, + "asi": 3271, + "které": 3272, + "stav": 3273, + "mají": 3274, + "mys": 3275, + "době": 3276, + "sně": 3277, + "zku": 3278, + "tů": 3279, + "chod": 3280, + "spě": 3281, + "jejich": 3282, + "součas": 3283, + "vali": 3284, + "kte": 3285, + "prů": 3286, + "zení": 3287, + "pat": 3288, + "potře": 3289, + "dnes": 3290, + "zemí": 3291, + "znam": 3292, + "mám": 3293, + "tedy": 3294, + "hlavní": 3295, + "použí": 3296, + "bní": 3297, + "vede": 3298, + "lep": 3299, + "jek": 3300, + "prav": 3301, + "politi": 3302, + "dne": 3303, + "čení": 3304, + "než": 3305, + "děl": 3306, + "čo": 3307, + "cích": 3308, + "sté": 3309, + "dlou": 3310, + "několik": 3311, + "vyu": 3312, + "ckých": 3313, + "nové": 3314, + "čin": 3315, + "dělá": 3316, + "ký": 3317, + "obla": 3318, + "podle": 3319, + "důleži": 3320, + "poku": 3321, + "kone": 3322, + "dý": 3323, + "dvě": 3324, + "žád": 3325, + "nout": 3326, + "tku": 3327, + "tvr": 3328, + "ckého": 3329, + "rov": 3330, + "tele": 3331, + "psa": 3332, + "svět": 3333, + "tivní": 3334, + "dosta": 3335, + "šel": 3336, + "druhé": 3337, + "skou": 3338, + "žo": 3339, + "jedná": 3340, + "význam": 3341, + "problé": 3342, + "publi": 3343, + "ván": 3344, + "odpo": 3345, + "podpo": 3346, + "dle": 3347, + "jaké": 3348, + "šení": 3349, + "vím": 3350, + "během": 3351, + "nachází": 3352, + "slou": 3353, + "pouze": 3354, + "otá": 3355, + "plo": 3356, + "tové": 3357, + "větši": 3358, + "komi": 3359, + "vají": 3360, + "tyto": 3361, + "zápa": 3362, + "změ": 3363, + "moh": 3364, + "více": 3365, + "společ": 3366, + "auto": 3367, + "proti": 3368, + "dět": 3369, + "cháze": 3370, + "žel": 3371, + "«": 3372, + "»": 3373, + "а": 3374, + "б": 3375, + "в": 3376, + "г": 3377, + "д": 3378, + "е": 3379, + "ж": 3380, + "з": 3381, + "и": 3382, + "й": 3383, + "к": 3384, + "л": 3385, + "м": 3386, + "н": 3387, + "о": 3388, + "п": 3389, + "р": 3390, + "с": 3391, + "т": 3392, + "у": 3393, + "ф": 3394, + "х": 3395, + "ц": 3396, + "ч": 3397, + "ш": 3398, + "щ": 3399, + "ъ": 3400, + "ы": 3401, + "ь": 3402, + "э": 3403, + "ю": 3404, + "я": 3405, + "ё": 3406, + "‑": 3407, + "−": 3408, + "ст": 3409, + "ен": 3410, + "но": 3411, + "на": 3412, + "пр": 3413, + "то": 3414, + "по": 3415, + "ра": 3416, + "го": 3417, + "ко": 3418, + "не": 3419, + "во": 3420, + "ва": 3421, + "ет": 3422, + "ер": 3423, + "ни": 3424, + "ел": 3425, + "ит": 3426, + "ны": 3427, + "за": 3428, + "ро": 3429, + "ени": 3430, + "ка": 3431, + "ли": 3432, + "ем": 3433, + "да": 3434, + "об": 3435, + "ла": 3436, + "до": 3437, + "ся": 3438, + "ть": 3439, + "от": 3440, + "ло": 3441, + "ль": 3442, + "ед": 3443, + "со": 3444, + "ми": 3445, + "ре": 3446, + "мо": 3447, + "ци": 3448, + "про": 3449, + "та": 3450, + "это": 3451, + "ки": 3452, + "ру": 3453, + "при": 3454, + "ти": 3455, + "се": 3456, + "ста": 3457, + "вы": 3458, + "мы": 3459, + "ви": 3460, + "бы": 3461, + "ма": 3462, + "ес": 3463, + "ля": 3464, + "сти": 3465, + "ле": 3466, + "что": 3467, + "ме": 3468, + "ри": 3469, + "ча": 3470, + "од": 3471, + "ей": 3472, + "ель": 3473, + "ения": 3474, + "га": 3475, + "ну": 3476, + "си": 3477, + "па": 3478, + "раз": 3479, + "бо": 3480, + "сто": 3481, + "су": 3482, + "са": 3483, + "ду": 3484, + "его": 3485, + "ест": 3486, + "ин": 3487, + "ить": 3488, + "из": 3489, + "же": 3490, + "му": 3491, + "пер": 3492, + "под": 3493, + "ение": 3494, + "сь": 3495, + "ку": 3496, + "пред": 3497, + "ного": 3498, + "ных": 3499, + "вер": 3500, + "те": 3501, + "ной": 3502, + "ции": 3503, + "де": 3504, + "ры": 3505, + "дел": 3506, + "лю": 3507, + "ве": 3508, + "он": 3509, + "мен": 3510, + "ги": 3511, + "ня": 3512, + "бу": 3513, + "пра": 3514, + "все": 3515, + "ется": 3516, + "сть": 3517, + "жа": 3518, + "дол": 3519, + "жи": 3520, + "бе": 3521, + "кон": 3522, + "сл": 3523, + "ши": 3524, + "ди": 3525, + "ств": 3526, + "ско": 3527, + "ные": 3528, + "чи": 3529, + "ют": 3530, + "дер": 3531, + "стра": 3532, + "ты": 3533, + "ход": 3534, + "щи": 3535, + "зо": 3536, + "зна": 3537, + "ности": 3538, + "чес": 3539, + "вля": 3540, + "вать": 3541, + "ор": 3542, + "пол": 3543, + "вет": 3544, + "так": 3545, + "ша": 3546, + "ту": 3547, + "сво": 3548, + "пре": 3549, + "она": 3550, + "итель": 3551, + "ный": 3552, + "сло": 3553, + "как": 3554, + "вл": 3555, + "ность": 3556, + "хо": 3557, + "мож": 3558, + "пе": 3559, + "для": 3560, + "ния": 3561, + "ное": 3562, + "рас": 3563, + "долж": 3564, + "дар": 3565, + "тель": 3566, + "ска": 3567, + "пу": 3568, + "ство": 3569, + "кото": 3570, + "раб": 3571, + "ее": 3572, + "род": 3573, + "эти": 3574, + "соб": 3575, + "ору": 3576, + "жен": 3577, + "ным": 3578, + "ити": 3579, + "ние": 3580, + "ком": 3581, + "дет": 3582, + "сту": 3583, + "гу": 3584, + "пи": 3585, + "меж": 3586, + "ению": 3587, + "тер": 3588, + "работ": 3589, + "воз": 3590, + "ция": 3591, + "кой": 3592, + "щест": 3593, + "гра": 3594, + "зи": 3595, + "ря": 3596, + "между": 3597, + "ства": 3598, + "вс": 3599, + "ело": 3600, + "ше": 3601, + "мер": 3602, + "ба": 3603, + "зы": 3604, + "лу": 3605, + "аль": 3606, + "дей": 3607, + "гла": 3608, + "народ": 3609, + "кти": 3610, + "предста": 3611, + "лся": 3612, + "явля": 3613, + "ски": 3614, + "нов": 3615, + "един": 3616, + "ров": 3617, + "ис": 3618, + "нима": 3619, + "рем": 3620, + "ходи": 3621, + "также": 3622, + "дру": 3623, + "ать": 3624, + "след": 3625, + "гово": 3626, + "ная": 3627, + "ющи": 3628, + "ень": 3629, + "которы": 3630, + "хот": 3631, + "ву": 3632, + "их": 3633, + "ему": 3634, + "чит": 3635, + "важ": 3636, + "орга": 3637, + "чески": 3638, + "ще": 3639, + "ке": 3640, + "ха": 3641, + "пос": 3642, + "том": 3643, + "боль": 3644, + "мне": 3645, + "пас": 3646, + "объ": 3647, + "прав": 3648, + "конф": 3649, + "слу": 3650, + "поддер": 3651, + "стви": 3652, + "наш": 3653, + "лько": 3654, + "стоя": 3655, + "ную": 3656, + "лем": 3657, + "енных": 3658, + "кра": 3659, + "ды": 3660, + "международ": 3661, + "гда": 3662, + "необ": 3663, + "госу": 3664, + "ству": 3665, + "ении": 3666, + "государ": 3667, + "кто": 3668, + "им": 3669, + "чест": 3670, + "рет": 3671, + "вопро": 3672, + "лен": 3673, + "ели": 3674, + "рова": 3675, + "ций": 3676, + "нам": 3677, + "этой": 3678, + "жения": 3679, + "необходи": 3680, + "меня": 3681, + "было": 3682, + "сили": 3683, + "фи": 3684, + "вя": 3685, + "шь": 3686, + "этого": 3687, + "они": 3688, + "органи": 3689, + "безо": 3690, + "проб": 3691, + "име": 3692, + "реш": 3693, + "би": 3694, + "безопас": 3695, + "ются": 3696, + "оста": 3697, + "енно": 3698, + "год": 3699, + "ела": 3700, + "представ": 3701, + "ться": 3702, + "слово": 3703, + "организа": 3704, + "должны": 3705, + "этом": 3706, + "бла": 3707, + "че": 3708, + "чу": 3709, + "благо": 3710, + "этому": 3711, + "врем": 3712, + "спе": 3713, + "ном": 3714, + "ений": 3715, + "спо": 3716, + "нас": 3717, + "нет": 3718, + "зу": 3719, + "вед": 3720, + "еще": 3721, + "сказа": 3722, + "сей": 3723, + "ерен": 3724, + "дан": 3725, + "сам": 3726, + "еля": 3727, + "ран": 3728, + "зыва": 3729, + "является": 3730, + "будет": 3731, + "ктив": 3732, + "тре": 3733, + "деле": 3734, + "мот": 3735, + "конферен": 3736, + "лась": 3737, + "час": 3738, + "сторо": 3739, + "кого": 3740, + "ез": 3741, + "ней": 3742, + "ос": 3743, + "лись": 3744, + "разору": 3745, + "пере": 3746, + "сси": 3747, + "ными": 3748, + "проц": 3749, + "голо": 3750, + "чело": 3751, + "боле": 3752, + "челове": 3753, + "сер": 3754, + "пл": 3755, + "чет": 3756, + "стран": 3757, + "пя": 3758, + "был": 3759, + "кла": 3760, + "тов": 3761, + "жд": 3762, + "дела": 3763, + "ера": 3764, + "уже": 3765, + "совет": 3766, + "ген": 3767, + "безопасности": 3768, + "ца": 3769, + "седа": 3770, + "поз": 3771, + "ответ": 3772, + "проблем": 3773, + "нако": 3774, + "тем": 3775, + "доста": 3776, + "пы": 3777, + "ща": 3778, + "вой": 3779, + "сущест": 3780, + "необходимо": 3781, + "быть": 3782, + "может": 3783, + "дем": 3784, + "чтобы": 3785, + "ек": 3786, + "чер": 3787, + "усили": 3788, + "рес": 3789, + "руд": 3790, + "единенных": 3791, + "доб": 3792, + "дости": 3793, + "ствен": 3794, + "ядер": 3795, + "годня": 3796, + "каза": 3797, + "сегодня": 3798, + "сейчас": 3799, + "только": 3800, + "вод": 3801, + "есь": 3802, + "много": 3803, + "буду": 3804, + "ев": 3805, + "есть": 3806, + "три": 3807, + "общест": 3808, + "явл": 3809, + "высту": 3810, + "ред": 3811, + "счит": 3812, + "сит": 3813, + "делега": 3814, + "лож": 3815, + "этот": 3816, + "фор": 3817, + "клю": 3818, + "возмож": 3819, + "вания": 3820, + "бли": 3821, + "или": 3822, + "вз": 3823, + "наций": 3824, + "ского": 3825, + "приня": 3826, + "пла": 3827, + "оч": 3828, + "иться": 3829, + "сте": 3830, + "наши": 3831, + "которые": 3832, + "ар": 3833, + "имеет": 3834, + "сот": 3835, + "знач": 3836, + "перь": 3837, + "следу": 3838, + "ены": 3839, + "таки": 3840, + "объединенных": 3841, + "стро": 3842, + "теперь": 3843, + "бле": 3844, + "благодар": 3845, + "разв": 3846, + "ан": 3847, + "жива": 3848, + "очень": 3849, + "ят": 3850, + "без": 3851, + "обес": 3852, + "гро": 3853, + "лось": 3854, + "сы": 3855, + "организации": 3856, + "член": 3857, + "того": 3858, + "ональ": 3859, + "жда": 3860, + "всех": 3861, + "свя": 3862, + "более": 3863, + "сов": 3864, + "когда": 3865, + "вот": 3866, + "кре": 3867, + "кры": 3868, + "поэтому": 3869, + "воль": 3870, + "ой": 3871, + "генера": 3872, + "чем": 3873, + "лы": 3874, + "полити": 3875, + "вен": 3876, + "конференции": 3877, + "процес": 3878, + "бя": 3879, + "ите": 3880, + "отно": 3881, + "развити": 3882, + "аф": 3883, + "ющ": 3884, + "вно": 3885, + "мир": 3886, + "нии": 3887, + "кая": 3888, + "ас": 3889, + "ительно": 3890, + "вто": 3891, + "ением": 3892, + "генераль": 3893, + "прот": 3894, + "всем": 3895, + "самбле": 3896, + "ассамбле": 3897, + "ом": 3898, + "зд": 3899, + "смот": 3900, + "реги": 3901, + "чего": 3902, + "однако": 3903, + "усилия": 3904, + "действи": 3905, + "чно": 3906, + "уча": 3907, + "образ": 3908, + "вос": 3909, + "эта": 3910, + "перего": 3911, + "говор": 3912, + "вам": 3913, + "моло": 3914, + "время": 3915, + "дь": 3916, + "хотел": 3917, + "гру": 3918, + "заявл": 3919, + "предоста": 3920, + "поль": 3921, + "нее": 3922, + "резо": 3923, + "перегово": 3924, + "резолю": 3925, + "крет": 3926, + "поддерж": 3927, + "обеспе": 3928, + "него": 3929, + "представит": 3930, + "наде": 3931, + "кри": 3932, + "чь": 3933, + "проек": 3934, + "лет": 3935, + "други": 3936, + "_": 3937, + "،": 3938, + "؛": 3939, + "؟": 3940, + "ء": 3941, + "آ": 3942, + "أ": 3943, + "ؤ": 3944, + "إ": 3945, + "ئ": 3946, + "ا": 3947, + "ب": 3948, + "ة": 3949, + "ت": 3950, + "ث": 3951, + "ج": 3952, + "ح": 3953, + "خ": 3954, + "د": 3955, + "ذ": 3956, + "ر": 3957, + "ز": 3958, + "س": 3959, + "ش": 3960, + "ص": 3961, + "ض": 3962, + "ط": 3963, + "ظ": 3964, + "ع": 3965, + "غ": 3966, + "ـ": 3967, + "ف": 3968, + "ق": 3969, + "ك": 3970, + "ل": 3971, + "م": 3972, + "ن": 3973, + "ه": 3974, + "و": 3975, + "ى": 3976, + "ي": 3977, + "ً": 3978, + "ٌ": 3979, + "ٍ": 3980, + "َ": 3981, + "ُ": 3982, + "ِ": 3983, + "ّ": 3984, + "ْ": 3985, + "ٰ": 3986, + "چ": 3987, + "ڨ": 3988, + "ک": 3989, + "ھ": 3990, + "ی": 3991, + "ۖ": 3992, + "ۗ": 3993, + "ۘ": 3994, + "ۚ": 3995, + "ۛ": 3996, + "—": 3997, + "☭": 3998, + "ﺃ": 3999, + "ﻻ": 4000, + "ال": 4001, + "َا": 4002, + "وَ": 4003, + "َّ": 4004, + "ِي": 4005, + "أَ": 4006, + "لَ": 4007, + "نَ": 4008, + "الْ": 4009, + "هُ": 4010, + "ُو": 4011, + "ما": 4012, + "نْ": 4013, + "من": 4014, + "عَ": 4015, + "نا": 4016, + "لا": 4017, + "مَ": 4018, + "تَ": 4019, + "فَ": 4020, + "أن": 4021, + "لي": 4022, + "مِ": 4023, + "ان": 4024, + "في": 4025, + "رَ": 4026, + "يَ": 4027, + "هِ": 4028, + "مْ": 4029, + "قَ": 4030, + "بِ": 4031, + "لى": 4032, + "ين": 4033, + "إِ": 4034, + "لِ": 4035, + "وا": 4036, + "كَ": 4037, + "ها": 4038, + "ًا": 4039, + "مُ": 4040, + "ون": 4041, + "الم": 4042, + "بَ": 4043, + "يا": 4044, + "ذا": 4045, + "سا": 4046, + "الل": 4047, + "مي": 4048, + "يْ": 4049, + "را": 4050, + "ري": 4051, + "لك": 4052, + "مَا": 4053, + "نَّ": 4054, + "لم": 4055, + "إن": 4056, + "ست": 4057, + "وم": 4058, + "َّا": 4059, + "لَا": 4060, + "هم": 4061, + "ِّ": 4062, + "كُ": 4063, + "كان": 4064, + "سَ": 4065, + "با": 4066, + "دي": 4067, + "حَ": 4068, + "عْ": 4069, + "بي": 4070, + "الأ": 4071, + "ول": 4072, + "فِي": 4073, + "رِ": 4074, + "دا": 4075, + "مِنْ": 4076, + "ُونَ": 4077, + "وْ": 4078, + "هَا": 4079, + "ُّ": 4080, + "الس": 4081, + "الَ": 4082, + "ني": 4083, + "لْ": 4084, + "تُ": 4085, + "هل": 4086, + "رة": 4087, + "دَ": 4088, + "سْ": 4089, + "تِ": 4090, + "نَا": 4091, + "رْ": 4092, + "اللَّ": 4093, + "سامي": 4094, + "كن": 4095, + "كل": 4096, + "هَ": 4097, + "عَلَ": 4098, + "على": 4099, + "مع": 4100, + "إلى": 4101, + "قد": 4102, + "الر": 4103, + "ُوا": 4104, + "ير": 4105, + "عن": 4106, + "يُ": 4107, + "نِ": 4108, + "بْ": 4109, + "الح": 4110, + "هُمْ": 4111, + "قا": 4112, + "ذه": 4113, + "الت": 4114, + "ِينَ": 4115, + "جَ": 4116, + "هذا": 4117, + "عد": 4118, + "الع": 4119, + "دْ": 4120, + "قَالَ": 4121, + "رُ": 4122, + "يم": 4123, + "ية": 4124, + "نُ": 4125, + "خَ": 4126, + "رب": 4127, + "الك": 4128, + "وَا": 4129, + "أنا": 4130, + "ةِ": 4131, + "الن": 4132, + "حد": 4133, + "عِ": 4134, + "تا": 4135, + "هو": 4136, + "فا": 4137, + "عا": 4138, + "الش": 4139, + "لُ": 4140, + "يت": 4141, + "ذَا": 4142, + "يع": 4143, + "الذ": 4144, + "حْ": 4145, + "الص": 4146, + "إِنَّ": 4147, + "جا": 4148, + "علي": 4149, + "كَا": 4150, + "بُ": 4151, + "تع": 4152, + "وق": 4153, + "مل": 4154, + "لَّ": 4155, + "يد": 4156, + "أخ": 4157, + "رف": 4158, + "تي": 4159, + "الِ": 4160, + "ّا": 4161, + "ذلك": 4162, + "أَنْ": 4163, + "سِ": 4164, + "توم": 4165, + "مر": 4166, + "مَنْ": 4167, + "بل": 4168, + "الق": 4169, + "الله": 4170, + "ِيَ": 4171, + "كم": 4172, + "ذَ": 4173, + "عل": 4174, + "حب": 4175, + "سي": 4176, + "عُ": 4177, + "الج": 4178, + "الد": 4179, + "شَ": 4180, + "تك": 4181, + "فْ": 4182, + "صَ": 4183, + "لل": 4184, + "دِ": 4185, + "بر": 4186, + "فِ": 4187, + "ته": 4188, + "أع": 4189, + "تْ": 4190, + "قْ": 4191, + "الْأَ": 4192, + "ئِ": 4193, + "عَنْ": 4194, + "ور": 4195, + "حا": 4196, + "الَّ": 4197, + "مت": 4198, + "فر": 4199, + "دُ": 4200, + "هنا": 4201, + "وَأَ": 4202, + "تب": 4203, + "ةُ": 4204, + "أي": 4205, + "سب": 4206, + "ريد": 4207, + "وج": 4208, + "كُمْ": 4209, + "حِ": 4210, + "كْ": 4211, + "در": 4212, + "َاء": 4213, + "هذه": 4214, + "الط": 4215, + "الْمُ": 4216, + "دة": 4217, + "قل": 4218, + "غَ": 4219, + "يوم": 4220, + "الَّذ": 4221, + "كر": 4222, + "تر": 4223, + "كِ": 4224, + "كي": 4225, + "عَلَى": 4226, + "رَب": 4227, + "عة": 4228, + "قُ": 4229, + "جْ": 4230, + "فض": 4231, + "لة": 4232, + "هْ": 4233, + "رَا": 4234, + "وَلَ": 4235, + "الْمَ": 4236, + "أَنَّ": 4237, + "يَا": 4238, + "أُ": 4239, + "شي": 4240, + "اللَّهُ": 4241, + "لَى": 4242, + "قِ": 4243, + "أت": 4244, + "عَلَيْ": 4245, + "اللَّهِ": 4246, + "الب": 4247, + "ضَ": 4248, + "ةً": 4249, + "قي": 4250, + "ار": 4251, + "بد": 4252, + "خْ": 4253, + "سْتَ": 4254, + "طَ": 4255, + "قَدْ": 4256, + "ذهب": 4257, + "أم": 4258, + "ماذا": 4259, + "وَإِ": 4260, + "ةٌ": 4261, + "ونَ": 4262, + "ليلى": 4263, + "ولا": 4264, + "حُ": 4265, + "هي": 4266, + "صل": 4267, + "الخ": 4268, + "ود": 4269, + "ليس": 4270, + "لدي": 4271, + "قال": 4272, + "كَانَ": 4273, + "مَّ": 4274, + "حي": 4275, + "تم": 4276, + "لن": 4277, + "وَلَا": 4278, + "بع": 4279, + "يمكن": 4280, + "سُ": 4281, + "ةَ": 4282, + "حت": 4283, + "رًا": 4284, + "كا": 4285, + "شا": 4286, + "هِمْ": 4287, + "لَهُ": 4288, + "زَ": 4289, + "داً": 4290, + "مس": 4291, + "كث": 4292, + "الْعَ": 4293, + "جِ": 4294, + "صْ": 4295, + "فَا": 4296, + "له": 4297, + "وي": 4298, + "عَا": 4299, + "هُوَ": 4300, + "بِي": 4301, + "بَا": 4302, + "أس": 4303, + "ثَ": 4304, + "لِي": 4305, + "رض": 4306, + "الرَّ": 4307, + "لِكَ": 4308, + "تَّ": 4309, + "فُ": 4310, + "قة": 4311, + "فعل": 4312, + "مِن": 4313, + "الآ": 4314, + "ثُ": 4315, + "سم": 4316, + "مَّا": 4317, + "بِهِ": 4318, + "تق": 4319, + "خر": 4320, + "لقد": 4321, + "خل": 4322, + "شر": 4323, + "أنت": 4324, + "لَّا": 4325, + "سن": 4326, + "السَّ": 4327, + "الذي": 4328, + "سَا": 4329, + "وما": 4330, + "زل": 4331, + "وب": 4332, + "أْ": 4333, + "إذا": 4334, + "رِي": 4335, + "حة": 4336, + "نِي": 4337, + "الْحَ": 4338, + "وَقَالَ": 4339, + "به": 4340, + "ةٍ": 4341, + "سأ": 4342, + "رٌ": 4343, + "بال": 4344, + "مة": 4345, + "شْ": 4346, + "وت": 4347, + "عند": 4348, + "فس": 4349, + "بَعْ": 4350, + "هر": 4351, + "قط": 4352, + "أح": 4353, + "إنه": 4354, + "وع": 4355, + "فت": 4356, + "غا": 4357, + "هناك": 4358, + "بت": 4359, + "مِنَ": 4360, + "سر": 4361, + "ذَلِكَ": 4362, + "رس": 4363, + "حدث": 4364, + "غْ": 4365, + "ِّي": 4366, + "الإ": 4367, + "وَيَ": 4368, + "جل": 4369, + "است": 4370, + "قِي": 4371, + "عب": 4372, + "وس": 4373, + "يش": 4374, + "الَّذِينَ": 4375, + "تاب": 4376, + "دِي": 4377, + "جب": 4378, + "كون": 4379, + "بن": 4380, + "الث": 4381, + "لَيْ": 4382, + "بعد": 4383, + "وَالْ": 4384, + "فَأَ": 4385, + "عم": 4386, + "هُم": 4387, + "تن": 4388, + "ذْ": 4389, + "أص": 4390, + "أين": 4391, + "رَبِّ": 4392, + "الذين": 4393, + "إِن": 4394, + "بين": 4395, + "جُ": 4396, + "عَلَيْهِ": 4397, + "حَا": 4398, + "لو": 4399, + "ستط": 4400, + "ظر": 4401, + "لَمْ": 4402, + "ءِ": 4403, + "كُل": 4404, + "طل": 4405, + "تَا": 4406, + "ضُ": 4407, + "كنت": 4408, + "لًا": 4409, + "مٌ": 4410, + "قبل": 4411, + "ــ": 4412, + "ذِ": 4413, + "قَوْ": 4414, + "صِ": 4415, + "مًا": 4416, + "كانت": 4417, + "صا": 4418, + "يق": 4419, + "الف": 4420, + "النا": 4421, + "مٍ": 4422, + "إِنْ": 4423, + "النَّ": 4424, + "جد": 4425, + "وَمَا": 4426, + "تت": 4427, + "بح": 4428, + "مكان": 4429, + "كيف": 4430, + "ّة": 4431, + "الا": 4432, + "جَا": 4433, + "أو": 4434, + "ساعد": 4435, + "ضِ": 4436, + "إلا": 4437, + "راً": 4438, + "قَا": 4439, + "رأ": 4440, + "عت": 4441, + "أحد": 4442, + "هد": 4443, + "ضا": 4444, + "طر": 4445, + "أق": 4446, + "ماء": 4447, + "دَّ": 4448, + "البا": 4449, + "مُو": 4450, + "أَوْ": 4451, + "طا": 4452, + "قُو": 4453, + "خِ": 4454, + "تل": 4455, + "ستطيع": 4456, + "دَا": 4457, + "النَّا": 4458, + "إلَى": 4459, + "وَتَ": 4460, + "هَذَا": 4461, + "بة": 4462, + "عليك": 4463, + "جر": 4464, + "المن": 4465, + "زا": 4466, + "رٍ": 4467, + "دع": 4468, + "ًّا": 4469, + "سة": 4470, + "ثُمَّ": 4471, + "شيء": 4472, + "الغ": 4473, + "تح": 4474, + "رُونَ": 4475, + "اليوم": 4476, + "مِي": 4477, + "نُوا": 4478, + "أر": 4479, + "تُمْ": 4480, + "عر": 4481, + "يف": 4482, + "أب": 4483, + "دًا": 4484, + "صَا": 4485, + "التَّ": 4486, + "أريد": 4487, + "الز": 4488, + "يَوْ": 4489, + "إلي": 4490, + "جي": 4491, + "يَعْ": 4492, + "فضل": 4493, + "الإن": 4494, + "أنه": 4495, + "1": 4496, + "2": 4497, + "3": 4498, + "4": 4499, + "5": 4500, + "·": 4501, + "×": 4502, + "̃": 4503, + "̌": 4504, + "ε": 4505, + "λ": 4506, + "μ": 4507, + "•": 4508, + "‧": 4509, + "─": 4510, + "□": 4511, + "、": 4512, + "。": 4513, + "〈": 4514, + "〉": 4515, + "《": 4516, + "》": 4517, + "「": 4518, + "」": 4519, + "『": 4520, + "』": 4521, + "ア": 4522, + "オ": 4523, + "カ": 4524, + "チ": 4525, + "ド": 4526, + "ベ": 4527, + "ャ": 4528, + "ヤ": 4529, + "ン": 4530, + "・": 4531, + "ー": 4532, + "ㄟ": 4533, + "!": 4534, + "(": 4535, + ")": 4536, + ",": 4537, + "-": 4538, + "/": 4539, + ":": 4540, + ";": 4541, + "?": 4542, + "p": 4543, + "i4": 4544, + "zh": 4545, + "i2": 4546, + "ng1": 4547, + "u4": 4548, + "i1": 4549, + "ng2": 4550, + "u3": 4551, + "de5": 4552, + "e4": 4553, + "i3": 4554, + "ng4": 4555, + "an4": 4556, + "shi4": 4557, + "an2": 4558, + "u2": 4559, + "u1": 4560, + "ng3": 4561, + "a1": 4562, + "an1": 4563, + "e2": 4564, + "a4": 4565, + "ei4": 4566, + "ong1": 4567, + "ai4": 4568, + "ao4": 4569, + "ang1": 4570, + "an3": 4571, + "wei4": 4572, + "uo2": 4573, + "n1": 4574, + "en2": 4575, + "ao3": 4576, + "e1": 4577, + "qi": 4578, + "eng2": 4579, + "zho": 4580, + "ang3": 4581, + "ang4": 4582, + "ang2": 4583, + "uo4": 4584, + "ge4": 4585, + "yi1": 4586, + "guo2": 4587, + "a3": 4588, + "he2": 4589, + "e3": 4590, + "yi2": 4591, + "di4": 4592, + "zhong1": 4593, + "bu4": 4594, + "ai2": 4595, + "n2": 4596, + "zai4": 4597, + "shi2": 4598, + "eng1": 4599, + "ren2": 4600, + "ong2": 4601, + "xian4": 4602, + "xu": 4603, + "n4": 4604, + "li4": 4605, + "en4": 4606, + "yu2": 4607, + "ei2": 4608, + "yi2ge4": 4609, + "ou4": 4610, + "ei3": 4611, + "ui4": 4612, + "a2": 4613, + "you3": 4614, + "ao1": 4615, + "da4": 4616, + "cheng2": 4617, + "en1": 4618, + "eng4": 4619, + "yi4": 4620, + "si1": 4621, + "zhi4": 4622, + "jia1": 4623, + "yuan2": 4624, + "ta1": 4625, + "de5yi2ge4": 4626, + "ke1": 4627, + "shu3": 4628, + "xi1": 4629, + "ji2": 4630, + "ao2": 4631, + "ou3": 4632, + "ong4": 4633, + "xia4": 4634, + "ai1": 4635, + "gong1": 4636, + "zhi1": 4637, + "en3": 4638, + "wei2": 4639, + "xue2": 4640, + "qu1": 4641, + "zhou1": 4642, + "er3": 4643, + "ming2": 4644, + "zhong3": 4645, + "li3": 4646, + "wu4": 4647, + "yi3": 4648, + "uo1": 4649, + "e5": 4650, + "ji4": 4651, + "xing2": 4652, + "jian4": 4653, + "hua4": 4654, + "yu3": 4655, + "uo3": 4656, + "ji1": 4657, + "ai3": 4658, + "zuo4": 4659, + "hou4": 4660, + "hui4": 4661, + "ei1": 4662, + "nian2": 4663, + "qi2": 4664, + "dao4": 4665, + "sheng1": 4666, + "de2": 4667, + "dai4": 4668, + "uan2": 4669, + "zhe4": 4670, + "zheng4": 4671, + "ben3": 4672, + "shang4": 4673, + "zhu3": 4674, + "bei4": 4675, + "ye4": 4676, + "chu1": 4677, + "zhan4": 4678, + "le5": 4679, + "lai2": 4680, + "shi3": 4681, + "nan2": 4682, + "ren4": 4683, + "you2": 4684, + "ke4": 4685, + "ba1": 4686, + "fu4": 4687, + "dui4": 4688, + "ya4": 4689, + "mei3": 4690, + "zi4": 4691, + "xin1": 4692, + "jing1": 4693, + "zhu": 4694, + "n3": 4695, + "yong4": 4696, + "mu4": 4697, + "jiao4": 4698, + "ye3": 4699, + "jin4": 4700, + "bian4": 4701, + "lu4": 4702, + "qi1": 4703, + "she4": 4704, + "xiang1": 4705, + "ong3": 4706, + "shu4": 4707, + "dong4": 4708, + "suo3": 4709, + "guan1": 4710, + "san1": 4711, + "te4": 4712, + "duo1": 4713, + "fu2": 4714, + "min2": 4715, + "la1": 4716, + "zhi2": 4717, + "zhen4": 4718, + "ou1": 4719, + "wu3": 4720, + "ma3": 4721, + "i5": 4722, + "zi5": 4723, + "ju4": 4724, + "er4": 4725, + "yao4": 4726, + "xia4de5yi2ge4": 4727, + "si4": 4728, + "tu2": 4729, + "shan1": 4730, + "zui4": 4731, + "yin1": 4732, + "er2": 4733, + "tong2": 4734, + "dong1": 4735, + "yu4": 4736, + "yan2": 4737, + "qian2": 4738, + "shu3xia4de5yi2ge4": 4739, + "jun1": 4740, + "ke3": 4741, + "wen2": 4742, + "fa3": 4743, + "luo2": 4744, + "zhu4": 4745, + "xi4": 4746, + "kou3": 4747, + "bei3": 4748, + "jian1": 4749, + "fa1": 4750, + "dian4": 4751, + "jiang1": 4752, + "wei4yu2": 4753, + "xiang4": 4754, + "zhi3": 4755, + "eng3": 4756, + "fang1": 4757, + "lan2": 4758, + "shu": 4759, + "ri4": 4760, + "lian2": 4761, + "shou3": 4762, + "qiu2": 4763, + "jin1": 4764, + "huo4": 4765, + "shu3xia4de5yi2ge4zhong3": 4766, + "fen1": 4767, + "nei4": 4768, + "gai1": 4769, + "mei3guo2": 4770, + "un2": 4771, + "ge2": 4772, + "bao3": 4773, + "qing1": 4774, + "gao1": 4775, + "tai2": 4776, + "xiao3": 4777, + "jie2": 4778, + "tian1": 4779, + "chang2": 4780, + "quan2": 4781, + "lie4": 4782, + "hai3": 4783, + "fei1": 4784, + "ti3": 4785, + "jue2": 4786, + "ou2": 4787, + "ci3": 4788, + "zu2": 4789, + "ni2": 4790, + "biao3": 4791, + "zhong1guo2": 4792, + "du4": 4793, + "yue4": 4794, + "xing4": 4795, + "sheng4": 4796, + "che1": 4797, + "dan1": 4798, + "jie1": 4799, + "lin2": 4800, + "ping2": 4801, + "fu3": 4802, + "gu3": 4803, + "jie4": 4804, + "v3": 4805, + "sheng3": 4806, + "na4": 4807, + "yuan4": 4808, + "zhang3": 4809, + "guan3": 4810, + "dao3": 4811, + "zu3": 4812, + "ding4": 4813, + "dian3": 4814, + "ceng2": 4815, + "ren2kou3": 4816, + "tai4": 4817, + "tong1": 4818, + "guo4": 4819, + "neng2": 4820, + "chang3": 4821, + "hua2": 4822, + "liu2": 4823, + "ying1": 4824, + "xiao4": 4825, + "ci4": 4826, + "bian4hua4": 4827, + "liang3": 4828, + "gong4": 4829, + "zhong4": 4830, + "de5yi1": 4831, + "se4": 4832, + "kai1": 4833, + "wang2": 4834, + "jiu4": 4835, + "shi1": 4836, + "shou4": 4837, + "mei2": 4838, + "feng1": 4839, + "ze2": 4840, + "tu2shi4": 4841, + "ti2": 4842, + "qi4": 4843, + "jiu3": 4844, + "shen1": 4845, + "zhe3": 4846, + "ren2kou3bian4hua4": 4847, + "ren2kou3bian4hua4tu2shi4": 4848, + "di4qu1": 4849, + "yang2": 4850, + "men5": 4851, + "long2": 4852, + "bing4": 4853, + "chan3": 4854, + "zhu1": 4855, + "wei3": 4856, + "wai4": 4857, + "xing1": 4858, + "bo1": 4859, + "bi3": 4860, + "tang2": 4861, + "hua1": 4862, + "bo2": 4863, + "shui3": 4864, + "shu1": 4865, + "dou1": 4866, + "sai4": 4867, + "chao2": 4868, + "bi4": 4869, + "ling2": 4870, + "lei4": 4871, + "da4xue2": 4872, + "fen4": 4873, + "shu3de5": 4874, + "mu3": 4875, + "jiao1": 4876, + "dang1": 4877, + "cheng1": 4878, + "tong3": 4879, + "nv3": 4880, + "qi3": 4881, + "yan3": 4882, + "mian4": 4883, + "luo4": 4884, + "jing4": 4885, + "ge1": 4886, + "ru4": 4887, + "dan4": 4888, + "ri4ben3": 4889, + "pu3": 4890, + "yun4": 4891, + "huang2": 4892, + "wo3": 4893, + "lv": 4894, + "hai2": 4895, + "shi4yi1": 4896, + "xie1": 4897, + "ying3": 4898, + "wu2": 4899, + "shen2": 4900, + "wang3": 4901, + "guang3": 4902, + "liu4": 4903, + "su4": 4904, + "shi4zhen4": 4905, + "can1": 4906, + "cao3": 4907, + "xia2": 4908, + "ka3": 4909, + "da2": 4910, + "hu4": 4911, + "ban4": 4912, + "dang3": 4913, + "hu2": 4914, + "zong3": 4915, + "deng3": 4916, + "de5yi2ge4shi4zhen4": 4917, + "chuan2": 4918, + "mo4": 4919, + "zhang1": 4920, + "ban1": 4921, + "mo2": 4922, + "cha2": 4923, + "ce4": 4924, + "zhu3yao4": 4925, + "tou2": 4926, + "ju2": 4927, + "shi4wei4yu2": 4928, + "sa4": 4929, + "un1": 4930, + "ke3yi3": 4931, + "du1": 4932, + "han4": 4933, + "liang4": 4934, + "sha1": 4935, + "jia3": 4936, + "zi1": 4937, + "lv4": 4938, + "fu1": 4939, + "xian1": 4940, + "xu4": 4941, + "guang1": 4942, + "meng2": 4943, + "bao4": 4944, + "you4": 4945, + "rong2": 4946, + "zhi1yi1": 4947, + "wei1": 4948, + "mao2": 4949, + "guo2jia1": 4950, + "cong2": 4951, + "gou4": 4952, + "tie3": 4953, + "zhen1": 4954, + "du2": 4955, + "bian1": 4956, + "ci2": 4957, + "qu3": 4958, + "fan4": 4959, + "xiang3": 4960, + "men2": 4961, + "ju1": 4962, + "hong2": 4963, + "zi3": 4964, + "ta1men5": 4965, + "ji3": 4966, + "zong1": 4967, + "zhou1de5yi2ge4shi4zhen4": 4968, + "tuan2": 4969, + "jing3": 4970, + "gong1si1": 4971, + "xie4": 4972, + "li2": 4973, + "li4shi3": 4974, + "bao1": 4975, + "gang3": 4976, + "gui1": 4977, + "zheng1": 4978, + "zhi2wu4": 4979, + "ta1de5": 4980, + "pin3": 4981, + "zhuan1": 4982, + "chong2": 4983, + "shi3yong4": 4984, + "wa3": 4985, + "shuo1": 4986, + "chuan1": 4987, + "lei2": 4988, + "wan1": 4989, + "huo2": 4990, + "su1": 4991, + "zao3": 4992, + "gai3": 4993, + "qu4": 4994, + "gu4": 4995, + "xi2": 4996, + "hang2": 4997, + "ying4": 4998, + "cun1": 4999, + "gen1": 5000, + "ying2": 5001, + "ting2": 5002, + "cheng2shi4": 5003, + "jiang3": 5004, + "ling3": 5005, + "lun2": 5006, + "bu4fen4": 5007, + "deng1": 5008, + "xuan3": 5009, + "dong4wu4": 5010, + "de2guo2": 5011, + "xian3": 5012, + "fan3": 5013, + "zhe5": 5014, + "han2": 5015, + "hao4": 5016, + "mi4": 5017, + "ran2": 5018, + "qin1": 5019, + "tiao2": 5020, + "zhan3": 5021, + "[ar]": 5022, + "[zh-cn]": 5023, + "¡": 5024, + "é": 5025, + "shi": 5026, + "tsu": 5027, + "teki": 5028, + "nai": 5029, + "aru": 5030, + "uu": 5031, + "kai": 5032, + "shite": 5033, + "mono": 5034, + "koto": 5035, + "kara": 5036, + "shita": 5037, + "suru": 5038, + "masu": 5039, + "tai": 5040, + "ware": 5041, + "shin": 5042, + "oku": 5043, + "yuu": 5044, + "iru": 5045, + "jiko": 5046, + "desu": 5047, + "rare": 5048, + "shou": 5049, + "sha": 5050, + "sekai": 5051, + "kyou": 5052, + "mashita": 5053, + "nara": 5054, + "kei": 5055, + "ita": 5056, + "ari": 5057, + "itsu": 5058, + "kono": 5059, + "naka": 5060, + "chou": 5061, + "sore": 5062, + "naru": 5063, + "gaku": 5064, + "reba": 5065, + "hito": 5066, + "sai": 5067, + "nan": 5068, + "dai": 5069, + "tsuku": 5070, + "shiki": 5071, + "sare": 5072, + "naku": 5073, + "jun": 5074, + "kaku": 5075, + "zai": 5076, + "wata": 5077, + "shuu": 5078, + "ii": 5079, + "kare": 5080, + "shii": 5081, + "made": 5082, + "sho": 5083, + "kereba": 5084, + "shika": 5085, + "ichi": 5086, + "deki": 5087, + "nin": 5088, + "wareware": 5089, + "nakereba": 5090, + "oite": 5091, + "yaku": 5092, + "mujun": 5093, + "yoku": 5094, + "butsu": 5095, + "omo": 5096, + "gae": 5097, + "naranai": 5098, + "tachi": 5099, + "chuu": 5100, + "kangae": 5101, + "toki": 5102, + "koro": 5103, + "mujunteki": 5104, + "naga": 5105, + "jin": 5106, + "shima": 5107, + "iku": 5108, + "imasu": 5109, + "hon": 5110, + "kae": 5111, + "kore": 5112, + "kita": 5113, + "datta": 5114, + "jitsu": 5115, + "mae": 5116, + "toku": 5117, + "douitsu": 5118, + "ritsu": 5119, + "kyuu": 5120, + "hyou": 5121, + "rareta": 5122, + "keisei": 5123, + "kkan": 5124, + "rareru": 5125, + "mou": 5126, + "doko": 5127, + "ryou": 5128, + "dake": 5129, + "nakatta": 5130, + "soko": 5131, + "tabe": 5132, + "hana": 5133, + "fuku": 5134, + "yasu": 5135, + "wataku": 5136, + "yama": 5137, + "kyo": 5138, + "genzai": 5139, + "boku": 5140, + "ata": 5141, + "kawa": 5142, + "masen": 5143, + "juu": 5144, + "natte": 5145, + "watakushi": 5146, + "yotte": 5147, + "hai": 5148, + "jishin": 5149, + "rete": 5150, + "oka": 5151, + "kagaku": 5152, + "natta": 5153, + "karu": 5154, + "nari": 5155, + "mata": 5156, + "kuru": 5157, + "gai": 5158, + "kari": 5159, + "shakai": 5160, + "koui": 5161, + "yori": 5162, + "setsu": 5163, + "reru": 5164, + "tokoro": 5165, + "jutsu": 5166, + "saku": 5167, + "ttai": 5168, + "ningen": 5169, + "tame": 5170, + "kankyou": 5171, + "ooku": 5172, + "watashi": 5173, + "tsukuru": 5174, + "sugi": 5175, + "jibun": 5176, + "shitsu": 5177, + "keru": 5178, + "kishi": 5179, + "shikashi": 5180, + "moto": 5181, + "mari": 5182, + "itte": 5183, + "deshita": 5184, + "nde": 5185, + "arimasu": 5186, + "koe": 5187, + "zettai": 5188, + "kkanteki": 5189, + "rekishi": 5190, + "dekiru": 5191, + "tsuka": 5192, + "itta": 5193, + "kobutsu": 5194, + "miru": 5195, + "shoku": 5196, + "shimasu": 5197, + "gijutsu": 5198, + "gyou": 5199, + "joushiki": 5200, + "atta": 5201, + "hodo": 5202, + "koko": 5203, + "tsukurareta": 5204, + "zoku": 5205, + "hitei": 5206, + "koku": 5207, + "rekishiteki": 5208, + "kete": 5209, + "kako": 5210, + "nagara": 5211, + "kakaru": 5212, + "shutai": 5213, + "haji": 5214, + "taku": 5215, + "douitsuteki": 5216, + "mete": 5217, + "tsuu": 5218, + "sarete": 5219, + "genjitsu": 5220, + "bai": 5221, + "nawa": 5222, + "jikan": 5223, + "waru": 5224, + "rt": 5225, + "atsu": 5226, + "soku": 5227, + "kouiteki": 5228, + "kata": 5229, + "tetsu": 5230, + "gawa": 5231, + "kedo": 5232, + "reta": 5233, + "sayou": 5234, + "tteru": 5235, + "tori": 5236, + "kimi": 5237, + "mura": 5238, + "sareru": 5239, + "machi": 5240, + "kya": 5241, + "osa": 5242, + "konna": 5243, + "aku": 5244, + "sareta": 5245, + "ipp": 5246, + "shiku": 5247, + "uchi": 5248, + "hitotsu": 5249, + "hatara": 5250, + "tachiba": 5251, + "shiro": 5252, + "katachi": 5253, + "tomo": 5254, + "ete": 5255, + "meru": 5256, + "nichi": 5257, + "dare": 5258, + "katta": 5259, + "eru": 5260, + "suki": 5261, + "ooki": 5262, + "maru": 5263, + "moku": 5264, + "oko": 5265, + "kangaerareru": 5266, + "oto": 5267, + "tanni": 5268, + "tada": 5269, + "taiteki": 5270, + "motte": 5271, + "kinou": 5272, + "shinai": 5273, + "kki": 5274, + "tari": 5275, + "ranai": 5276, + "kkou": 5277, + "mirai": 5278, + "ppon": 5279, + "goto": 5280, + "hitsu": 5281, + "teru": 5282, + "mochi": 5283, + "katsu": 5284, + "nyuu": 5285, + "zuka": 5286, + "tsuite": 5287, + "nomi": 5288, + "sugu": 5289, + "kuda": 5290, + "tetsugaku": 5291, + "ika": 5292, + "ronri": 5293, + "oki": 5294, + "nippon": 5295, + "shimashita": 5296, + "chishiki": 5297, + "chokkanteki": 5298, + "suko": 5299, + "kuu": 5300, + "arou": 5301, + "katte": 5302, + "kuri": 5303, + "inai": 5304, + "hyougen": 5305, + "ishiki": 5306, + "doku": 5307, + "atte": 5308, + "atara": 5309, + "wari": 5310, + "kao": 5311, + "seisan": 5312, + "hanashi": 5313, + "kake": 5314, + "naji": 5315, + "sunawa": 5316, + "sunawachi": 5317, + "ugo": 5318, + "suu": 5319, + "bara": 5320, + "hiro": 5321, + "iwa": 5322, + "betsu": 5323, + "yoi": 5324, + "seru": 5325, + "shiteru": 5326, + "rarete": 5327, + "toshi": 5328, + "seki": 5329, + "tairitsu": 5330, + "wakara": 5331, + "tokyo": 5332, + "kka": 5333, + "kyoku": 5334, + "iro": 5335, + "mite": 5336, + "saki": 5337, + "kanji": 5338, + "mita": 5339, + "sube": 5340, + "ryoku": 5341, + "matta": 5342, + "kudasai": 5343, + "omoi": 5344, + "wareru": 5345, + "hitsuyou": 5346, + "kashi": 5347, + "renai": 5348, + "kankei": 5349, + "gatte": 5350, + "ochi": 5351, + "motsu": 5352, + "sonzai": 5353, + "taishite": 5354, + "ame": 5355, + "seimei": 5356, + "kano": 5357, + "giri": 5358, + "kangaeru": 5359, + "yue": 5360, + "asa": 5361, + "onaji": 5362, + "yoru": 5363, + "niku": 5364, + "osaka": 5365, + "sukoshi": 5366, + "tama": 5367, + "kanojo": 5368, + "kite": 5369, + "mondai": 5370, + "amari": 5371, + "eki": 5372, + "kojin": 5373, + "haya": 5374, + "dete": 5375, + "atarashii": 5376, + "awa": 5377, + "gakkou": 5378, + "tsuzu": 5379, + "shukan": 5380, + "imashita": 5381, + "atae": 5382, + "darou": 5383, + "hataraku": 5384, + "gata": 5385, + "dachi": 5386, + "matsu": 5387, + "arimasen": 5388, + "seibutsu": 5389, + "mitsu": 5390, + "heya": 5391, + "yasui": 5392, + "deni": 5393, + "noko": 5394, + "haha": 5395, + "domo": 5396, + "kami": 5397, + "sudeni": 5398, + "nao": 5399, + "raku": 5400, + "ike": 5401, + "meta": 5402, + "kodomo": 5403, + "soshite": 5404, + "game": 5405, + "bakari": 5406, + "tote": 5407, + "hatsu": 5408, + "mise": 5409, + "mokuteki": 5410, + "dakara": 5411, + "[ja]": 5412, + "ő": 5413, + "ű": 5414, + "そ": 5415, + "な": 5416, + "ん": 5417, + "포": 5418, + "�": 5419, + "gy": 5420, + "eg": 5421, + "cs": 5422, + "ál": 5423, + "egy": 5424, + "át": 5425, + "ott": 5426, + "ett": 5427, + "meg": 5428, + "hogy": 5429, + "ég": 5430, + "ól": 5431, + "nek": 5432, + "volt": 5433, + "ág": 5434, + "nk": 5435, + "ék": 5436, + "ít": 5437, + "ák": 5438, + "ud": 5439, + "szer": 5440, + "mind": 5441, + "oz": 5442, + "ép": 5443, + "ért": 5444, + "mond": 5445, + "szt": 5446, + "nak": 5447, + "ől": 5448, + "csak": 5449, + "oly": 5450, + "áll": 5451, + "ány": 5452, + "mint": 5453, + "már": 5454, + "ött": 5455, + "nagy": 5456, + "ész": 5457, + "azt": 5458, + "elő": 5459, + "tud": 5460, + "ény": 5461, + "áz": 5462, + "még": 5463, + "köz": 5464, + "ely": 5465, + "ség": 5466, + "hoz": 5467, + "uk": 5468, + "kez": 5469, + "ám": 5470, + "aj": 5471, + "unk": 5472, + "vagy": 5473, + "szem": 5474, + "ember": 5475, + "fog": 5476, + "mert": 5477, + "ös": 5478, + "ság": 5479, + "leg": 5480, + "ünk": 5481, + "hát": 5482, + "ony": 5483, + "ezt": 5484, + "minden": 5485, + "ült": 5486, + "jó": 5487, + "kis": 5488, + "áj": 5489, + "úgy": 5490, + "most": 5491, + "ír": 5492, + "itt": 5493, + "elt": 5494, + "mondta": 5495, + "kell": 5496, + "ált": 5497, + "érd": 5498, + "tö": 5499, + "vár": 5500, + "lát": 5501, + "ők": 5502, + "vet": 5503, + "után": 5504, + "két": 5505, + "nap": 5506, + "ív": 5507, + "ály": 5508, + "vég": 5509, + "ök": 5510, + "dul": 5511, + "néz": 5512, + "ában": 5513, + "kül": 5514, + "akkor": 5515, + "szél": 5516, + "új": 5517, + "olyan": 5518, + "ked": 5519, + "hely": 5520, + "tör": 5521, + "ból": 5522, + "elm": 5523, + "ára": 5524, + "ló": 5525, + "volna": 5526, + "lehet": 5527, + "ebb": 5528, + "sok": 5529, + "olt": 5530, + "eket": 5531, + "bor": 5532, + "fej": 5533, + "gond": 5534, + "akar": 5535, + "fél": 5536, + "úl": 5537, + "otta": 5538, + "valami": 5539, + "jel": 5540, + "éd": 5541, + "arc": 5542, + "hall": 5543, + "föl": 5544, + "ába": 5545, + "olg": 5546, + "kir": 5547, + "old": 5548, + "kérd": 5549, + "jár": 5550, + "úr": 5551, + "zs": 5552, + "élet": 5553, + "ját": 5554, + "ov": 5555, + "éz": 5556, + "vil": 5557, + "őr": 5558, + "ög": 5559, + "lesz": 5560, + "koz": 5561, + "ább": 5562, + "király": 5563, + "eng": 5564, + "igaz": 5565, + "haj": 5566, + "kod": 5567, + "ról": 5568, + "több": 5569, + "szó": 5570, + "ében": 5571, + "öt": 5572, + "nyi": 5573, + "szól": 5574, + "gondol": 5575, + "egész": 5576, + "így": 5577, + "ős": 5578, + "obb": 5579, + "osan": 5580, + "ből": 5581, + "abb": 5582, + "őt": 5583, + "nál": 5584, + "kép": 5585, + "aztán": 5586, + "tart": 5587, + "beszél": 5588, + "előtt": 5589, + "aszt": 5590, + "maj": 5591, + "kör": 5592, + "hang": 5593, + "íz": 5594, + "incs": 5595, + "év": 5596, + "ód": 5597, + "ók": 5598, + "hozz": 5599, + "okat": 5600, + "nagyon": 5601, + "ház": 5602, + "ped": 5603, + "ezte": 5604, + "etlen": 5605, + "neki": 5606, + "majd": 5607, + "szony": 5608, + "ának": 5609, + "felé": 5610, + "egyszer": 5611, + "adt": 5612, + "gyer": 5613, + "amikor": 5614, + "foly": 5615, + "szak": 5616, + "őd": 5617, + "hú": 5618, + "ász": 5619, + "amely": 5620, + "ére": 5621, + "ilyen": 5622, + "oda": 5623, + "ják": 5624, + "tár": 5625, + "ával": 5626, + "lak": 5627, + "gyan": 5628, + "ély": 5629, + "út": 5630, + "kezd": 5631, + "mell": 5632, + "mikor": 5633, + "hez": 5634, + "való": 5635, + "szeret": 5636, + "rend": 5637, + "vissza": 5638, + "fő": 5639, + "asszony": 5640, + "ről": 5641, + "pedig": 5642, + "szép": 5643, + "ták": 5644, + "öv": 5645, + "világ": 5646, + "maga": 5647, + "szik": 5648, + "éj": 5649, + "ént": 5650, + "jött": 5651, + "szí": 5652, + "gat": 5653, + "ettem": 5654, + "hány": 5655, + "ást": 5656, + "ahol": 5657, + "őket": 5658, + "hár": 5659, + "nő": 5660, + "csi": 5661, + "talál": 5662, + "elte": 5663, + "látt": 5664, + "tört": 5665, + "hagy": 5666, + "esz": 5667, + "nél": 5668, + "kut": 5669, + "lány": 5670, + "amit": 5671, + "ső": 5672, + "ellen": 5673, + "magát": 5674, + "ugyan": 5675, + "külön": 5676, + "asz": 5677, + "mindig": 5678, + "lép": 5679, + "talán": 5680, + "szor": 5681, + "illan": 5682, + "nincs": 5683, + "vagyok": 5684, + "telen": 5685, + "ismer": 5686, + "isten": 5687, + "ított": 5688, + "jobb": 5689, + "ves": 5690, + "dult": 5691, + "juk": 5692, + "szen": 5693, + "öm": 5694, + "lett": 5695, + "egyik": 5696, + "bár": 5697, + "szi": 5698, + "szív": 5699, + "azon": 5700, + "eszt": 5701, + "föld": 5702, + "kuty": 5703, + "pillan": 5704, + "fér": 5705, + "től": 5706, + "tű": 5707, + "ébe": 5708, + "tött": 5709, + "barát": 5710, + "íg": 5711, + "ahogy": 5712, + "eh": 5713, + "ep": 5714, + "jelent": 5715, + "tat": 5716, + "szeg": 5717, + "mintha": 5718, + "egyen": 5719, + "szab": 5720, + "bizony": 5721, + "jon": 5722, + "öreg": 5723, + "dolg": 5724, + "csap": 5725, + "tiszt": 5726, + "állt": 5727, + "ancs": 5728, + "idő": 5729, + "ügy": 5730, + "miért": 5731, + "ót": 5732, + "csin": 5733, + "ének": 5734, + "vér": 5735, + "jól": 5736, + "alatt": 5737, + "mely": 5738, + "semmi": 5739, + "nyug": 5740, + "vág": 5741, + "követ": 5742, + "össze": 5743, + "mad": 5744, + "acs": 5745, + "fiú": 5746, + "másik": 5747, + "jön": 5748, + "szám": 5749, + "rész": 5750, + "kér": 5751, + "ével": 5752, + "[hu]": 5753, + "%": 5754, + "0": 5755, + "6": 5756, + "7": 5757, + "8": 5758, + "9": 5759, + "A": 5760, + "B": 5761, + "C": 5762, + "D": 5763, + "E": 5764, + "F": 5765, + "G": 5766, + "H": 5767, + "I": 5768, + "J": 5769, + "K": 5770, + "L": 5771, + "M": 5772, + "N": 5773, + "O": 5774, + "P": 5775, + "Q": 5776, + "R": 5777, + "S": 5778, + "T": 5779, + "U": 5780, + "V": 5781, + "W": 5782, + "X": 5783, + "Y": 5784, + "Z": 5785, + "Ł": 5786, + "α": 5787, + "ς": 5788, + "♥": 5789, + "か": 5790, + "ズ": 5791, + "因": 5792, + "国": 5793, + "怎": 5794, + "抱": 5795, + "推": 5796, + "有": 5797, + "樣": 5798, + "為": 5799, + "群": 5800, + "麼": 5801, + "eo": 5802, + "eul": 5803, + "eun": 5804, + "eon": 5805, + "ae": 5806, + "yeon": 5807, + "yeo": 5808, + "ui": 5809, + "hae": 5810, + "geo": 5811, + "neun": 5812, + "ssda": 5813, + "seo": 5814, + "eong": 5815, + "kk": 5816, + "jeo": 5817, + "deul": 5818, + "eum": 5819, + "yeong": 5820, + "geos": 5821, + "hag": 5822, + "aneun": 5823, + "iss": 5824, + "dae": 5825, + "eob": 5826, + "eol": 5827, + "geu": 5828, + "jeong": 5829, + "sae": 5830, + "doe": 5831, + "geul": 5832, + "eulo": 5833, + "bn": 5834, + "sang": 5835, + "bnida": 5836, + "haneun": 5837, + "jeog": 5838, + "saeng": 5839, + "ineun": 5840, + "anh": 5841, + "salam": 5842, + "eom": 5843, + "nae": 5844, + "gwa": 5845, + "yeol": 5846, + "eseo": 5847, + "myeon": 5848, + "ttae": 5849, + "hw": 5850, + "eobs": 5851, + "jang": 5852, + "gw": 5853, + "ileul": 5854, + "yeog": 5855, + "jeon": 5856, + "sig": 5857, + "jag": 5858, + "hago": 5859, + "deun": 5860, + "seong": 5861, + "gag": 5862, + "ham": 5863, + "dang": 5864, + "leul": 5865, + "sil": 5866, + "dong": 5867, + "handa": 5868, + "eossda": 5869, + "aeg": 5870, + "seon": 5871, + "haessda": 5872, + "issda": 5873, + "ege": 5874, + "mul": 5875, + "jung": 5876, + "jig": 5877, + "issneun": 5878, + "geun": 5879, + "seubnida": 5880, + "won": 5881, + "daneun": 5882, + "eoh": 5883, + "deo": 5884, + "gam": 5885, + "jal": 5886, + "haeng": 5887, + "yang": 5888, + "bang": 5889, + "jae": 5890, + "saenggag": 5891, + "hage": 5892, + "sog": 5893, + "eoss": 5894, + "jasin": 5895, + "jil": 5896, + "eog": 5897, + "gyeong": 5898, + "gong": 5899, + "deon": 5900, + "haess": 5901, + "eung": 5902, + "joh": 5903, + "nal": 5904, + "myeong": 5905, + "eona": 5906, + "igo": 5907, + "gyeol": 5908, + "yag": 5909, + "gwan": 5910, + "uli": 5911, + "yong": 5912, + "lyeo": 5913, + "jog": 5914, + "eohge": 5915, + "bog": 5916, + "tong": 5917, + "manh": 5918, + "jeol": 5919, + "geol": 5920, + "aga": 5921, + "naneun": 5922, + "uneun": 5923, + "cheol": 5924, + "dol": 5925, + "bad": 5926, + "hamyeon": 5927, + "yeossda": 5928, + "ibnida": 5929, + "gye": 5930, + "eos": 5931, + "hwal": 5932, + "salamdeul": 5933, + "jiman": 5934, + "dangsin": 5935, + "jib": 5936, + "ttaemun": 5937, + "ib": 5938, + "eneun": 5939, + "eug": 5940, + "jeom": 5941, + "geuleon": 5942, + "hwa": 5943, + "assda": 5944, + "beob": 5945, + "bae": 5946, + "yeoss": 5947, + "chin": 5948, + "chaeg": 5949, + "geon": 5950, + "naega": 5951, + "iga": 5952, + "sigan": 5953, + "gil": 5954, + "hyeon": 5955, + "lyeog": 5956, + "gug": 5957, + "pyeon": 5958, + "wae": 5959, + "jul": 5960, + "seul": 5961, + "deung": 5962, + "hajiman": 5963, + "eumyeon": 5964, + "pil": 5965, + "nyeon": 5966, + "tae": 5967, + "pyo": 5968, + "jineun": 5969, + "beon": 5970, + "hada": 5971, + "seol": 5972, + "sip": 5973, + "daleun": 5974, + "salm": 5975, + "gyo": 5976, + "cheon": 5977, + "hagi": 5978, + "cheoleom": 5979, + "gal": 5980, + "ila": 5981, + "kkaji": 5982, + "anhneun": 5983, + "habnida": 5984, + "tteon": 5985, + "haeseo": 5986, + "doenda": 5987, + "ttal": 5988, + "ilo": 5989, + "seub": 5990, + "byeon": 5991, + "myeo": 5992, + "beol": 5993, + "jeung": 5994, + "chim": 5995, + "hwang": 5996, + "euneun": 5997, + "jong": 5998, + "boda": 5999, + "nol": 6000, + "neom": 6001, + "buteo": 6002, + "jigeum": 6003, + "eobsda": 6004, + "daelo": 6005, + "yul": 6006, + "pyeong": 6007, + "seoneun": 6008, + "salang": 6009, + "seut": 6010, + "heom": 6011, + "hyang": 6012, + "gwang": 6013, + "eobsneun": 6014, + "hwag": 6015, + "gess": 6016, + "jagi": 6017, + "ileon": 6018, + "wihae": 6019, + "daehan": 6020, + "gaji": 6021, + "meog": 6022, + "jyeo": 6023, + "chaj": 6024, + "byeong": 6025, + "eod": 6026, + "gyeo": 6027, + "eoji": 6028, + "gul": 6029, + "modeun": 6030, + "insaeng": 6031, + "geulae": 6032, + "sasil": 6033, + "sib": 6034, + "chal": 6035, + "ilago": 6036, + "geum": 6037, + "doeneun": 6038, + "bol": 6039, + "gajang": 6040, + "geuligo": 6041, + "hyeong": 6042, + "haengbog": 6043, + "chul": 6044, + "chae": 6045, + "mang": 6046, + "dam": 6047, + "choe": 6048, + "sijag": 6049, + "cheong": 6050, + "ilaneun": 6051, + "ulineun": 6052, + "aen": 6053, + "kke": 6054, + "munje": 6055, + "teu": 6056, + "geuneun": 6057, + "bge": 6058, + "cheo": 6059, + "baeg": 6060, + "jug": 6061, + "sangdae": 6062, + "geugeos": 6063, + "dog": 6064, + "eus": 6065, + "jab": 6066, + "hyeo": 6067, + "tteohge": 6068, + "chil": 6069, + "swi": 6070, + "jileul": 6071, + "chang": 6072, + "ganeun": 6073, + "iji": 6074, + "dago": 6075, + "yohan": 6076, + "teug": 6077, + "ppun": 6078, + "aleul": 6079, + "haengdong": 6080, + "sesang": 6081, + "edo": 6082, + "mandeul": 6083, + "amyeon": 6084, + "kkae": 6085, + "bag": 6086, + "ideul": 6087, + "pum": 6088, + "meol": 6089, + "neul": 6090, + "hamkke": 6091, + "chung": 6092, + "dab": 6093, + "yug": 6094, + "sag": 6095, + "gwangye": 6096, + "ileohge": 6097, + "balo": 6098, + "neunde": 6099, + "hamyeo": 6100, + "geuleoh": 6101, + "anila": 6102, + "bangbeob": 6103, + "dasi": 6104, + "byeol": 6105, + "gyeon": 6106, + "gamjeong": 6107, + "oneul": 6108, + "janeun": 6109, + "yeom": 6110, + "lago": 6111, + "igi": 6112, + "hwan": 6113, + "teul": 6114, + "eoseo": 6115, + "sik": 6116, + "jaga": 6117, + "geuleom": 6118, + "geuleona": 6119, + "jeongdo": 6120, + "gyeog": 6121, + "geuleohge": 6122, + "geudeul": 6123, + "eut": 6124, + "imyeon": 6125, + "jjae": 6126, + "keun": 6127, + "isang": 6128, + "malhaessda": 6129, + "euge": 6130, + "nop": 6131, + "ingan": 6132, + "bomyeon": 6133, + "taeg": 6134, + "dwi": 6135, + "saneun": 6136, + "wan": 6137, + "anhgo": 6138, + "nugu": 6139, + "sung": 6140, + "damyeon": 6141, + "adeul": 6142, + "peul": 6143, + "ttala": 6144, + "geosdo": 6145, + "aji": 6146, + "meon": 6147, + "eumyeo": 6148, + "dolog": 6149, + "neung": 6150, + "modu": 6151, + "[ko]": 6152, + "\u0014": 6153, + "\u0016": 6154, + "$": 6155, + "*": 6156, + "|": 6157, + "°": 6158, + "º": 6159, + "ँ": 6160, + "ं": 6161, + "ः": 6162, + "अ": 6163, + "आ": 6164, + "इ": 6165, + "ई": 6166, + "उ": 6167, + "ऊ": 6168, + "ऋ": 6169, + "ऎ": 6170, + "ए": 6171, + "ऐ": 6172, + "ऑ": 6173, + "ऒ": 6174, + "ओ": 6175, + "औ": 6176, + "क": 6177, + "ख": 6178, + "ग": 6179, + "घ": 6180, + "ङ": 6181, + "च": 6182, + "छ": 6183, + "ज": 6184, + "झ": 6185, + "ञ": 6186, + "ट": 6187, + "ठ": 6188, + "ड": 6189, + "ढ": 6190, + "ण": 6191, + "त": 6192, + "थ": 6193, + "द": 6194, + "ध": 6195, + "न": 6196, + "ऩ": 6197, + "प": 6198, + "फ": 6199, + "ब": 6200, + "भ": 6201, + "म": 6202, + "य": 6203, + "र": 6204, + "ऱ": 6205, + "ल": 6206, + "ळ": 6207, + "व": 6208, + "श": 6209, + "ष": 6210, + "स": 6211, + "ह": 6212, + "़": 6213, + "ा": 6214, + "ि": 6215, + "ी": 6216, + "ु": 6217, + "ू": 6218, + "ृ": 6219, + "ॄ": 6220, + "ॅ": 6221, + "ॆ": 6222, + "े": 6223, + "ै": 6224, + "ॉ": 6225, + "ॊ": 6226, + "ो": 6227, + "ौ": 6228, + "्": 6229, + "ॐ": 6230, + "ॖ": 6231, + "क़": 6232, + "ख़": 6233, + "ग़": 6234, + "ज़": 6235, + "ड़": 6236, + "ढ़": 6237, + "फ़": 6238, + "य़": 6239, + "ॠ": 6240, + "।": 6241, + "॥": 6242, + "०": 6243, + "१": 6244, + "२": 6245, + "३": 6246, + "४": 6247, + "५": 6248, + "६": 6249, + "७": 6250, + "८": 6251, + "९": 6252, + "॰": 6253, + "ॲ": 6254, + "​": 6255, + "‌": 6256, + "‍": 6257, + "‎": 6258, + "₹": 6259, + "के": 6260, + "है": 6261, + "ें": 6262, + "्र": 6263, + "ार": 6264, + "ने": 6265, + "या": 6266, + "में": 6267, + "से": 6268, + "की": 6269, + "का": 6270, + "ों": 6271, + "ता": 6272, + "कर": 6273, + "स्": 6274, + "कि": 6275, + "को": 6276, + "र्": 6277, + "ना": 6278, + "क्": 6279, + "ही": 6280, + "और": 6281, + "पर": 6282, + "ते": 6283, + "हो": 6284, + "प्र": 6285, + "ान": 6286, + "्य": 6287, + "ला": 6288, + "वा": 6289, + "ले": 6290, + "सा": 6291, + "हैं": 6292, + "लि": 6293, + "जा": 6294, + "हा": 6295, + "भी": 6296, + "वि": 6297, + "इस": 6298, + "ती": 6299, + "न्": 6300, + "रा": 6301, + "मा": 6302, + "दे": 6303, + "दि": 6304, + "बा": 6305, + "ति": 6306, + "था": 6307, + "नि": 6308, + "कार": 6309, + "एक": 6310, + "हीं": 6311, + "हु": 6312, + "ंग": 6313, + "ैं": 6314, + "नी": 6315, + "सी": 6316, + "अप": 6317, + "त्": 6318, + "नहीं": 6319, + "री": 6320, + "मे": 6321, + "मु": 6322, + "ित": 6323, + "तो": 6324, + "पा": 6325, + "ली": 6326, + "लिए": 6327, + "गा": 6328, + "ल्": 6329, + "रह": 6330, + "रे": 6331, + "क्ष": 6332, + "मैं": 6333, + "सम": 6334, + "उस": 6335, + "जि": 6336, + "त्र": 6337, + "मि": 6338, + "चा": 6339, + "ोग": 6340, + "सं": 6341, + "द्": 6342, + "सि": 6343, + "आप": 6344, + "तु": 6345, + "दा": 6346, + "कु": 6347, + "यों": 6348, + "वे": 6349, + "जी": 6350, + "्या": 6351, + "उन": 6352, + "िक": 6353, + "ये": 6354, + "भा": 6355, + "्ट": 6356, + "हम": 6357, + "स्ट": 6358, + "शा": 6359, + "ड़": 6360, + "ंद": 6361, + "खा": 6362, + "म्": 6363, + "श्": 6364, + "यह": 6365, + "सक": 6366, + "पू": 6367, + "किया": 6368, + "अपने": 6369, + "रू": 6370, + "सु": 6371, + "मी": 6372, + "हि": 6373, + "जो": 6374, + "थे": 6375, + "रि": 6376, + "दी": 6377, + "थी": 6378, + "गी": 6379, + "लोग": 6380, + "गया": 6381, + "तर": 6382, + "न्ह": 6383, + "च्": 6384, + "वार": 6385, + "बी": 6386, + "प्": 6387, + "दो": 6388, + "टी": 6389, + "शि": 6390, + "करने": 6391, + "गे": 6392, + "ैसे": 6393, + "इन": 6394, + "ंड": 6395, + "साथ": 6396, + "पु": 6397, + "बे": 6398, + "बार": 6399, + "वी": 6400, + "अन": 6401, + "हर": 6402, + "उन्ह": 6403, + "होता": 6404, + "जब": 6405, + "कुछ": 6406, + "मान": 6407, + "क्र": 6408, + "बि": 6409, + "पह": 6410, + "फि": 6411, + "सर": 6412, + "ारी": 6413, + "रो": 6414, + "दू": 6415, + "कहा": 6416, + "तक": 6417, + "शन": 6418, + "ब्": 6419, + "स्थ": 6420, + "वह": 6421, + "बाद": 6422, + "ओं": 6423, + "गु": 6424, + "ज्": 6425, + "्रे": 6426, + "गर": 6427, + "रहे": 6428, + "वर्": 6429, + "हू": 6430, + "ार्": 6431, + "पी": 6432, + "बहु": 6433, + "मुझ": 6434, + "्रा": 6435, + "दिया": 6436, + "सब": 6437, + "करते": 6438, + "अपनी": 6439, + "बहुत": 6440, + "कह": 6441, + "टे": 6442, + "हुए": 6443, + "किसी": 6444, + "रहा": 6445, + "ष्ट": 6446, + "ज़": 6447, + "बना": 6448, + "सो": 6449, + "डि": 6450, + "कोई": 6451, + "व्य": 6452, + "बात": 6453, + "रु": 6454, + "वो": 6455, + "मुझे": 6456, + "द्ध": 6457, + "चार": 6458, + "मेरे": 6459, + "वर": 6460, + "्री": 6461, + "जाता": 6462, + "नों": 6463, + "प्रा": 6464, + "देख": 6465, + "टा": 6466, + "क्या": 6467, + "अध": 6468, + "लग": 6469, + "लो": 6470, + "पि": 6471, + "यु": 6472, + "चे": 6473, + "जिस": 6474, + "ंत": 6475, + "ानी": 6476, + "पै": 6477, + "जन": 6478, + "ारे": 6479, + "ची": 6480, + "मिल": 6481, + "दु": 6482, + "देश": 6483, + "च्छ": 6484, + "ष्": 6485, + "सू": 6486, + "खे": 6487, + "चु": 6488, + "िया": 6489, + "लगा": 6490, + "बु": 6491, + "उनके": 6492, + "ज्ञ": 6493, + "क्षा": 6494, + "तरह": 6495, + "्यादा": 6496, + "वाले": 6497, + "पूर्": 6498, + "मैंने": 6499, + "काम": 6500, + "रूप": 6501, + "होती": 6502, + "उप": 6503, + "जान": 6504, + "प्रकार": 6505, + "भार": 6506, + "मन": 6507, + "हुआ": 6508, + "टर": 6509, + "हूँ": 6510, + "परि": 6511, + "पास": 6512, + "अनु": 6513, + "राज": 6514, + "लोगों": 6515, + "अब": 6516, + "समझ": 6517, + "डी": 6518, + "मौ": 6519, + "शु": 6520, + "चि": 6521, + "पे": 6522, + "कृ": 6523, + "सकते": 6524, + "मह": 6525, + "योग": 6526, + "दर्": 6527, + "उसे": 6528, + "ंध": 6529, + "डा": 6530, + "जाए": 6531, + "बो": 6532, + "ूल": 6533, + "मो": 6534, + "ोंने": 6535, + "ंस": 6536, + "तुम": 6537, + "पहले": 6538, + "बता": 6539, + "तथा": 6540, + "यो": 6541, + "गई": 6542, + "उत्": 6543, + "सकता": 6544, + "कम": 6545, + "ज्यादा": 6546, + "रख": 6547, + "समय": 6548, + "ारा": 6549, + "अगर": 6550, + "स्त": 6551, + "चल": 6552, + "फिर": 6553, + "वारा": 6554, + "करना": 6555, + "शी": 6556, + "गए": 6557, + "बन": 6558, + "ौर": 6559, + "होने": 6560, + "चाह": 6561, + "खु": 6562, + "हाँ": 6563, + "उन्हें": 6564, + "उन्होंने": 6565, + "छो": 6566, + "म्ह": 6567, + "प्रति": 6568, + "निक": 6569, + "वन": 6570, + "्यू": 6571, + "रही": 6572, + "तुम्ह": 6573, + "जैसे": 6574, + "ियों": 6575, + "क्यों": 6576, + "लों": 6577, + "फ़": 6578, + "ंत्र": 6579, + "होते": 6580, + "क्ति": 6581, + "त्य": 6582, + "कर्": 6583, + "कई": 6584, + "वं": 6585, + "किन": 6586, + "पो": 6587, + "कारण": 6588, + "ड़ी": 6589, + "भि": 6590, + "इसके": 6591, + "बर": 6592, + "उसके": 6593, + "द्वारा": 6594, + "शे": 6595, + "कॉ": 6596, + "दिन": 6597, + "न्न": 6598, + "ड़ा": 6599, + "स्व": 6600, + "निर्": 6601, + "मुख": 6602, + "लिया": 6603, + "टि": 6604, + "ज्ञान": 6605, + "क्त": 6606, + "द्र": 6607, + "ग्": 6608, + "क्स": 6609, + "मै": 6610, + "गो": 6611, + "जे": 6612, + "ट्र": 6613, + "मार": 6614, + "त्व": 6615, + "धार": 6616, + "भाव": 6617, + "करता": 6618, + "खि": 6619, + "कं": 6620, + "चाहि": 6621, + "यर": 6622, + "प्त": 6623, + "कों": 6624, + "ंच": 6625, + "जु": 6626, + "मत": 6627, + "अच्छ": 6628, + "हुई": 6629, + "कभी": 6630, + "लेकिन": 6631, + "भू": 6632, + "अपना": 6633, + "दूस": 6634, + "चाहिए": 6635, + "यू": 6636, + "घर": 6637, + "सबसे": 6638, + "मेरी": 6639, + "नाम": 6640, + "ढ़": 6641, + "ंट": 6642, + "ेंगे": 6643, + "बै": 6644, + "फा": 6645, + "एवं": 6646, + "यी": 6647, + "ग्र": 6648, + "क्षे": 6649, + "आज": 6650, + "आपको": 6651, + "भाग": 6652, + "ठा": 6653, + "कै": 6654, + "भारत": 6655, + "उनकी": 6656, + "पहु": 6657, + "सभी": 6658, + "धा": 6659, + "णा": 6660, + "सान": 6661, + "होगा": 6662, + "तब": 6663, + "संग": 6664, + "पर्": 6665, + "अव": 6666, + "तना": 6667, + "गि": 6668, + "यन": 6669, + "स्था": 6670, + "चित": 6671, + "ट्": 6672, + "छा": 6673, + "जाने": 6674, + "क्षेत्र": 6675, + "वाली": 6676, + "पूर्ण": 6677, + "समा": 6678, + "कारी": 6679, + "[hi]": 6680 + }, + "merges": [ + "t h", + "i n", + "th e", + "a n", + "e r", + "o u", + "r e", + "o n", + "a t", + "e d", + "e n", + "t o", + "in g", + "an d", + "i s", + "a s", + "a l", + "o r", + "o f", + "a r", + "i t", + "e s", + "h e", + "s t", + "l e", + "o m", + "s e", + "b e", + "a d", + "o w", + "l y", + "c h", + "w h", + "th at", + "y ou", + "l i", + "v e", + "a c", + "t i", + "l d", + "m e", + "w as", + "g h", + "i d", + "l l", + "w i", + "en t", + "f or", + "a y", + "r o", + "v er", + "i c", + "h er", + "k e", + "h is", + "n o", + "u t", + "u n", + "i r", + "l o", + "w e", + "r i", + "h a", + "wi th", + "gh t", + "ou t", + "i m", + "i on", + "al l", + "a b", + "on e", + "n e", + "g e", + "ou ld", + "t er", + "m o", + "h ad", + "c e", + "s he", + "g o", + "s h", + "u r", + "a m", + "s o", + "p e", + "m y", + "d e", + "a re", + "b ut", + "om e", + "f r", + "the r", + "f e", + "s u", + "d o", + "c on", + "t e", + "a in", + "er e", + "p o", + "i f", + "the y", + "u s", + "a g", + "t r", + "n ow", + "ou n", + "th is", + "ha ve", + "no t", + "s a", + "i l", + "u p", + "th ing", + "fr om", + "a p", + "h im", + "ac k", + "at ion", + "an t", + "ou r", + "o p", + "li ke", + "u st", + "es s", + "b o", + "o k", + "u l", + "in d", + "e x", + "c om", + "s ome", + "the re", + "er s", + "c o", + "re s", + "m an", + "ar d", + "p l", + "w or", + "w ay", + "ti on", + "f o", + "c a", + "w ere", + "b y", + "at e", + "p ro", + "t ed", + "oun d", + "ow n", + "w ould", + "t s", + "wh at", + "q u", + "al ly", + "i ght", + "c k", + "g r", + "wh en", + "v en", + "c an", + "ou gh", + "in e", + "en d", + "p er", + "ou s", + "o d", + "id e", + "k now", + "t y", + "ver y", + "s i", + "a k", + "wh o", + "ab out", + "i ll", + "the m", + "es t", + "re d", + "y e", + "c ould", + "on g", + "you r", + "the ir", + "e m", + "j ust", + "o ther", + "in to", + "an y", + "wh i", + "u m", + "t w", + "as t", + "d er", + "d id", + "i e", + "be en", + "ac e", + "in k", + "it y", + "b ack", + "t ing", + "b r", + "mo re", + "a ke", + "p p", + "the n", + "s p", + "e l", + "u se", + "b l", + "sa id", + "o ver", + "ge t", + "e n", + "e r", + "c h", + "e i", + "i e", + "u n", + "i ch", + "ei n", + "s t", + "a n", + "t e", + "g e", + "a u", + "i n", + "s ch", + "d er", + "un d", + "d ie", + "d a", + "e s", + "a l", + "d en", + "a r", + "g en", + "z u", + "d e", + "h r", + "o n", + "t en", + "e l", + "o r", + "m i", + "s ie", + "da s", + "a t", + "b e", + "ein e", + "ich t", + "b er", + "l e", + "a ch", + "v er", + "s e", + "au f", + "w i", + "s o", + "t er", + "l ich", + "c k", + "u r", + "n icht", + "m m", + "b en", + "a s", + "w ar", + "r e", + "mi t", + "s ich", + "i g", + "l l", + "au s", + "i st", + "w ie", + "o ch", + "un g", + "an n", + "ü r", + "h n", + "i hr", + "s a", + "s en", + "t z", + "de m", + "ei t", + "u m", + "h at", + "wi r", + "v on", + "h a", + "s p", + "w ei", + "i er", + "r o", + "h er", + "r a", + "ein en", + "n e", + "v or", + "al s", + "an d", + "al l", + "w as", + "w o", + "r ei", + "st e", + "l ie", + "au ch", + "d u", + "d es", + "k o", + "ü ber", + "a m", + "b ei", + "h en", + "h m", + "l ei", + "a ber", + "w en", + "h l", + "g er", + "i m", + "u t", + "n ach", + "h e", + "i s", + "b r", + "f t", + "en t", + "i mm", + "j e", + "sch en", + "w er", + "s er", + "a b", + "ä n", + "m e", + "s ein", + "i t", + "o l", + "ch t", + "f ür", + "k l", + "f f", + "eine m", + "n en", + "w e", + "j a", + "u s", + "n och", + "hat te", + "t r", + "p f", + "h in", + "d i", + "ch en", + "b l", + "m an", + "r ü", + "ie l", + "s el", + "das s", + "i hn", + "mi r", + "sch l", + "ö n", + "g an", + "g t", + "ein er", + "st en", + "m ich", + "wen n", + "el l", + "g te", + "in d", + "m al", + "ge l", + "k en", + "n ur", + "mm en", + "f ü", + "er n", + "ö r", + "un ter", + "f r", + "an der", + "g r", + "i l", + "d ur", + "u ch", + "f e", + "t a", + "m en", + "m ach", + "d och", + "t i", + "dur ch", + "o s", + "g l", + "h al", + "ihr e", + "w ä", + "imm er", + "i hm", + "k ann", + "or t", + "d ann", + "l an", + "tz t", + "o der", + "hr en", + "e t", + "k ön", + "i ck", + "f a", + "in g", + "i r", + "wie der", + "da ß", + "m ein", + "f en", + "gan z", + "die se", + "st er", + "da r", + "w a", + "ge s", + "n a", + "f l", + "i gen", + "sch e", + "un gen", + "me hr", + "ß en", + "o t", + "k on", + "ge w", + "ha ben", + "ge h", + "ä t", + "s ind", + "d r", + "w el", + "un s", + "v o", + "m a", + "u te", + "sch on", + "b es", + "ge sch", + "b t", + "ch e", + "s on", + "o b", + "l a", + "p p", + "rü ck", + "s eine", + "k r", + "f re", + "ei l", + "zu m", + "u l", + "h ier", + "k t", + "i ge", + "sp r", + "k e", + "le ben", + "b st", + "z eit", + "i on", + "g ro", + "den n", + "h o", + "sch a", + "b ar", + "al le", + "ge gen", + "w ür", + "m ü", + "z e", + "wer den", + "je tzt", + "ko mmen", + "n ie", + "s ei", + "h eit", + "so ll", + "g lei", + "m eine", + "wo ll", + "n er", + "ha be", + "w ur", + "lich en", + "p er", + "as sen", + "n te", + "se hen", + "wir d", + "b is", + "g ar", + "i en", + "m us", + "u ß", + "ä r", + "st ell", + "k eit", + "z wei", + "sel bst", + "st a", + "p a", + "sa gte", + "te t", + "k am", + "s sen", + "v iel", + "u g", + "z en", + "h ei", + "m ann", + "wi ll", + "ge b", + "war en", + "ü ck", + "ä ch", + "m er", + "r u", + "w or", + "h au", + "ei gen", + "an g", + "we g", + "bl ick", + "f ra", + "all es", + "k a", + "au gen", + "f in", + "lich e", + "t o", + "un ser", + "der n", + "her r", + "n un", + "v ie", + "ch te", + "wo hl", + "f all", + "h t", + "ü n", + "et was", + "st and", + "en d", + "ä u", + "e m", + "m ö", + "te l", + "r ie", + "d ich", + "die s", + "h and", + "b in", + "ff en", + "nicht s", + "d an", + "p l", + "hn e", + "ihn en", + "es en", + "die ser", + "fr au", + "an t", + "ar t", + "di r", + "i sch", + "er st", + "glei ch", + "ko mm", + "h ör", + "ß e", + "d ig", + "se hr", + "z ei", + "sa m", + "au m", + "h ät", + "in gen", + "g ut", + "b o", + "m ut", + "ck en", + "kon nte", + "st imm", + "p ro", + "zu r", + "i tz", + "wei l", + "wür de", + "f ä", + "kön nen", + "k eine", + "f er", + "i schen", + "vo ll", + "ein es", + "se tz", + "z ie", + "de l", + "te te", + "sein er", + "ier en", + "ge st", + "zu rück", + "wur de", + "sch n", + "p r", + "lie ß", + "t ra", + "m ä", + "gen d", + "f ol", + "i k", + "schl a", + "scha ft", + "at er", + "wei ß", + "s einen", + "l assen", + "l u", + "und en", + "t eil", + "ne u", + "ier t", + "men schen", + "hm en", + "st r", + "g i", + "sa h", + "ihr en", + "el n", + "wei ter", + "ge hen", + "ig er", + "mach t", + "ta g", + "al so", + "hal ten", + "n is", + "ach t", + "ge ben", + "f or", + "o g", + "n at", + "m ar", + "de t", + "o hne", + "h aus", + "t ro", + "an ge", + "l au", + "sp iel", + "t re", + "sch r", + "in n", + "s u", + "l os", + "mach en", + "hät te", + "be g", + "wir k", + "al t", + "g lich", + "te s", + "r icht", + "fre und", + "m o", + "ihr er", + "f el", + "b el", + "so l", + "ein mal", + "e ben", + "h ol", + "h än", + "q u", + "ter n", + "h ö", + "sch w", + "re cht", + "wa hr", + "s einem", + "ste hen", + "hl en", + "in s", + "g ing", + "woll te", + "wi ssen", + "ung s", + "al d", + "as s", + "ja hr", + "m or", + "wel t", + "un der", + "zu sa", + "at ion", + "ko pf", + "lan g", + "hin ter", + "at z", + "st ra", + "an gen", + "an k", + "a de", + "gl au", + "f ach", + "hat ten", + "l o", + "f ort", + "ei cht", + "i ff", + "l er", + "m ei", + "diese m", + "k ein", + "f rei", + "fü hr", + "vo m", + "e s", + "e n", + "a i", + "o u", + "o n", + "l e", + "d e", + "r e", + "q u", + "a n", + "e r", + "en t", + "e t", + "l a", + "n e", + "i l", + "a r", + "i s", + "ai t", + "t e", + "a u", + "i n", + "qu e", + "i t", + "u r", + "s e", + "l es", + "c h", + "c e", + "m e", + "o r", + "ou r", + "a s", + "p r", + "a v", + "o m", + "ai s", + "u n", + "an t", + "ou s", + "t r", + "t i", + "l u", + "o i", + "e u", + "l le", + "s i", + "p ar", + "d es", + "an s", + "m ent", + "é t", + "es t", + "j e", + "u ne", + "a l", + "p as", + "t re", + "qu i", + "d u", + "r i", + "c on", + "s on", + "c om", + "e lle", + "d é", + "p our", + "d ans", + "l i", + "s a", + "r é", + "t ou", + "v ous", + "d i", + "v i", + "a g", + "a m", + "a t", + "ou v", + "a p", + "ti on", + "m on", + "s ur", + "c i", + "o s", + "p lu", + "s u", + "en d", + "a b", + "è re", + "ai n", + "m ais", + "o is", + "r es", + "plu s", + "é e", + "ai ent", + "m p", + "ch e", + "lu i", + "av e", + "ét ait", + "m a", + "s es", + "tou t", + "i r", + "v o", + "a c", + "s er", + "an d", + "f f", + "oi r", + "g r", + "av ait", + "é s", + "m es", + "n ous", + "eu x", + "b i", + "t er", + "c o", + "on s", + "p u", + "c es", + "g e", + "t u", + "le ur", + "pr o", + "d on", + "e ur", + "et te", + "ai re", + "ave c", + "d it", + "t é", + "i e", + "u s", + "il le", + "p er", + "com me", + "c r", + "or t", + "m i", + "e x", + "u x", + "v er", + "m o", + "è s", + "v e", + "au x", + "r a", + "j our", + "il s", + "bi en", + "c ou", + "p e", + "que l", + "p eu", + "c ette", + "t es", + "p o", + "in s", + "c u", + "m ê", + "s o", + "f ait", + "g u", + "m ar", + "ê tre", + "l o", + "it é", + "f r", + "a tion", + "en s", + "b r", + "n i", + "l é", + "d is", + "b le", + "m an", + "n é", + "pu is", + "mê me", + "qu es", + "f i", + "e l", + "ag e", + "g ar", + "m oi", + "en ce", + "on t", + "m ain", + "or s", + "au t", + "an ce", + "v en", + "m é", + "s ans", + "e m", + "s é", + "l on", + "h om", + "r o", + "u t", + "c ar", + "ab le", + "i m", + "de r", + "ch er", + "n o", + "vi e", + "au s", + "b e", + "de ux", + "en f", + "o ù", + "t en", + "p h", + "u re", + "te mp", + "p os", + "r ent", + "p é", + "f aire", + "p i", + "tr es", + "ç a", + "an g", + "end re", + "f or", + "p a", + "b on", + "s ou", + "in t", + "pr é", + "s ent", + "t ant", + "n er", + "c er", + "l à", + "l ais", + "pr ès", + "b re", + "c our", + "p et", + "i on", + "i ne", + "com p", + "l ait", + "tr ouv", + "t a", + "ent re", + "son t", + "de v", + "n u", + "temp s", + "d ou", + "r ait", + "b ou", + "qu and", + "jour s", + "l an", + "er s", + "av oir", + "ét é", + "a le", + "p re", + "f ois", + "or te", + "v é", + "m er", + "n on", + "t ous", + "j us", + "cou p", + "t s", + "hom me", + "ê te", + "a d", + "aus si", + "ur s", + "se u", + "or d", + "o b", + "m in", + "g é", + "co re", + "v a", + "v re", + "en core", + "se m", + "i te", + "au tre", + "pr is", + "peu t", + "u e", + "an te", + "m al", + "g n", + "ré p", + "h u", + "si on", + "vo tre", + "di re", + "e z", + "f em", + "leur s", + "m et", + "f in", + "c ri", + "m is", + "t our", + "r ai", + "j am", + "re gar", + "ri en", + "ver s", + "su is", + "p ouv", + "o p", + "v is", + "gr and", + "ant s", + "c or", + "re r", + "ar d", + "c é", + "t ent", + "pr es", + "v ou", + "f a", + "al ors", + "si eur", + "ai ne", + "le r", + "qu oi", + "f on", + "end ant", + "ar ri", + "eu re", + "a près", + "don c", + "it u", + "l è", + "s ait", + "t oi", + "ch a", + "ai l", + "as se", + "i mp", + "vo y", + "con n", + "p la", + "pet it", + "av ant", + "n om", + "t in", + "don t", + "d a", + "s ous", + "e mp", + "per son", + "el les", + "be au", + "par ti", + "ch o", + "pr it", + "tou jours", + "m en", + "r ais", + "jam ais", + "tr av", + "tion s", + "tr ès", + "v oi", + "r en", + "y eux", + "f er", + "v oir", + "pre mi", + "c a", + "g ne", + "h eure", + "r ou", + "e ff", + "no tre", + "ment s", + "t on", + "f ais", + "ce la", + "i er", + "rép on", + "con s", + "ai r", + "ô t", + "p endant", + "i ci", + "tou te", + "j et", + "p ort", + "ét aient", + "p en", + "h é", + "au tres", + "p ère", + "o c", + "quel ques", + "i que", + "l is", + "fem me", + "j ou", + "te ur", + "mon de", + "u se", + "n es", + "d re", + "a ff", + "r ap", + "par t", + "le ment", + "c la", + "f ut", + "quel que", + "pr endre", + "r ê", + "ai lle", + "s ais", + "ch es", + "le t", + "ch ar", + "è res", + "ent s", + "b er", + "g er", + "mo ins", + "e au", + "a î", + "j eu", + "h eur", + "é es", + "tr i", + "po int", + "m om", + "v ent", + "n ouv", + "gr an", + "tr ois", + "s ant", + "tout es", + "con tre", + "è rent", + "che z", + "ave z", + "û t", + "a lle", + "at t", + "p au", + "p orte", + "ouv er", + "b ar", + "l it", + "f ort", + "o t", + "as s", + "pr és", + "cho se", + "v it", + "mon sieur", + "h ab", + "t ête", + "j u", + "te ment", + "c tion", + "v rai", + "la r", + "c et", + "regar d", + "l ant", + "de m", + "s om", + "mom ent", + "il les", + "p le", + "p s", + "b es", + "m ère", + "c l", + "s our", + "y s", + "tr op", + "en ne", + "jus qu", + "av aient", + "av ais", + "jeu ne", + "de puis", + "person ne", + "f it", + "cer t", + "j o", + "g es", + "ou i", + "r est", + "sem b", + "c ap", + "m at", + "m u", + "lon g", + "fr an", + "f aut", + "it i", + "b li", + "che v", + "pr i", + "ent e", + "ain si", + "ch am", + "l ors", + "c as", + "d o", + "il i", + "b é", + "n os", + "an ge", + "su i", + "r it", + "cr o", + "gu e", + "d e", + "e n", + "e s", + "o s", + "l a", + "e r", + "q u", + "a r", + "a n", + "o n", + "qu e", + "a s", + "o r", + "e l", + "d o", + "a l", + "c i", + "u n", + "r e", + "a b", + "i n", + "t e", + "t o", + "s e", + "d i", + "t r", + "d a", + "c on", + "t a", + "s u", + "m i", + "c o", + "t i", + "l e", + "l os", + "n o", + "l o", + "í a", + "c u", + "c a", + "s i", + "v i", + "m e", + "p or", + "m o", + "p ar", + "r a", + "r i", + "la s", + "c h", + "r o", + "m a", + "p er", + "ó n", + "m en", + "de s", + "un a", + "m p", + "s o", + "ab a", + "p u", + "d os", + "t u", + "g u", + "er a", + "de l", + "h a", + "m u", + "l i", + "en t", + "m b", + "h ab", + "es t", + "g o", + "p a", + "r es", + "par a", + "p o", + "á s", + "m os", + "tr a", + "t en", + "an do", + "p i", + "qu i", + "b i", + "m an", + "co mo", + "v e", + "m ás", + "j o", + "ci ón", + "i s", + "t an", + "v o", + "da d", + "c e", + "a do", + "v er", + "f u", + "ci a", + "c er", + "p e", + "c as", + "c ar", + "men te", + "n i", + "su s", + "t ar", + "n a", + "f i", + "t er", + "z a", + "p ro", + "tr o", + "s a", + "l u", + "b a", + "per o", + "s er", + "c es", + "d as", + "d u", + "s in", + "e mp", + "m ar", + "l la", + "e x", + "á n", + "c or", + "i a", + "v a", + "r an", + "ch o", + "g a", + "y o", + "t os", + "c os", + "mi s", + "l es", + "t es", + "v en", + "h o", + "y a", + "en te", + "on es", + "hab ía", + "n u", + "u s", + "p as", + "h i", + "n os", + "es ta", + "la n", + "m as", + "t or", + "l le", + "h e", + "s on", + "b re", + "p re", + "ab an", + "d or", + "í an", + "i r", + "t as", + "é n", + "r u", + "en do", + "a que", + "er o", + "i o", + "qu é", + "m in", + "c ab", + "j a", + "de r", + "t al", + "é s", + "se ñ", + "or a", + "to do", + "la r", + "d on", + "g ar", + "s al", + "p r", + "cu ando", + "j e", + "h u", + "g un", + "b u", + "g i", + "d ar", + "n e", + "r as", + "de n", + "es to", + "par e", + "p en", + "é l", + "tr as", + "c an", + "b o", + "j os", + "mi en", + "pu e", + "c re", + "co mp", + "p on", + "d ía", + "tr os", + "s ab", + "so bre", + "es e", + "mb re", + "er on", + "a ñ", + "m or", + "f or", + "i do", + "por que", + "el la", + "p ri", + "g ran", + "f a", + "c en", + "di s", + "c ri", + "mu y", + "ch a", + "c al", + "es te", + "h as", + "c ó", + "g ra", + "r os", + "p os", + "o b", + "al l", + "aque l", + "j u", + "p res", + "m er", + "di jo", + "c ía", + "ent re", + "z o", + "ci ones", + "bi en", + "mb i", + "el o", + "t ó", + "in a", + "to dos", + "g en", + "ti en", + "est aba", + "de ci", + "ci o", + "h er", + "ñ o", + "l or", + "nu es", + "me di", + "l en", + "vi da", + "f e", + "al i", + "m on", + "c la", + "d re", + "pu es", + "al es", + "vo l", + "m í", + "r ar", + "b le", + "ci on", + "has ta", + "señ or", + "con o", + "a h", + "di os", + "s en", + "es a", + "ú n", + "v ar", + "s an", + "gu i", + "a c", + "o tros", + "ta do", + "bu en", + "ñ a", + "ti emp", + "ha cer", + "j er", + "f er", + "v u", + "f in", + "an a", + "as í", + "an tes", + "t in", + "ve z", + "mien to", + "j ar", + "la b", + "ch e", + "cas a", + "d r", + "es o", + "e go", + "di ó", + "an te", + "est á", + "m al", + "en cia", + "el i", + "í as", + "tiemp o", + "z ar", + "v an", + "m un", + "er ta", + "ta mbi", + "s í", + "b ar", + "a un", + "al e", + "mis mo", + "ent es", + "vi s", + "man o", + "el e", + "na da", + "se gu", + "me j", + "er ra", + "ab le", + "b e", + "ti r", + "un o", + "don de", + "to da", + "des de", + "r en", + "tambi én", + "cu er", + "per son", + "ho mbre", + "o tro", + "li b", + "tr ar", + "cu al", + "ha y", + "a u", + "ca da", + "t aba", + "i mp", + "men to", + "ten ía", + "qu er", + "er an", + "si emp", + "siemp re", + "er to", + "qu í", + "g os", + "pu és", + "el los", + "des pués", + "nu e", + "g an", + "l lo", + "in ter", + "có mo", + "tr i", + "ah ora", + "us te", + "tr aba", + "la do", + "in o", + "po co", + "er te", + "mu jer", + "i m", + "qui er", + "al gun", + "fu e", + "o jos", + "ent on", + "v os", + "es per", + "mu ch", + "o tra", + "a z", + "a d", + "in g", + "e za", + "a quí", + "ci as", + "gu a", + "mu cho", + "deci r", + "es ti", + "i dad", + "al go", + "e z", + "o cu", + "enton ces", + "di do", + "ent os", + "g ri", + "da do", + "i os", + "so l", + "dos e", + "uste d", + "qui en", + "a mi", + "un to", + "f r", + "mi r", + "mej or", + "b as", + "so lo", + "pre gun", + "tu r", + "al g", + "p la", + "to das", + "par te", + "e mb", + "c to", + "mun do", + "tien e", + "tan te", + "pa lab", + "tr an", + "aque lla", + "ci os", + "aun que", + "a y", + "cu en", + "ten er", + "f un", + "res pon", + "all í", + "x i", + "h an", + "pen s", + "con tra", + "tu ra", + "v al", + "di o", + "tr es", + "t re", + "tan to", + "ca min", + "m ó", + "es p", + "a da", + "í o", + "in s", + "ha cia", + "de j", + "est ar", + "i ón", + "g as", + "b er", + "v as", + "no che", + "é r", + "añ os", + "pa dre", + "gu s", + "á r", + "sin o", + "man os", + "ci do", + "es tu", + "a de", + "hu bi", + "vi r", + "b ri", + "ra z", + "ch i", + "pue de", + "men os", + "hab i", + "ho mb", + "ne ces", + "ma y", + "er os", + "r ía", + "he cho", + "es cu", + "l ti", + "án do", + "b us", + "cos as", + "t ú", + "es pa", + "re ci", + "c tor", + "pri m", + "di a", + "de se", + "mien tras", + "h or", + "fu er", + "i da", + "pos i", + "lan te", + "t on", + "an o", + "est as", + "p li", + "ch ar", + "lu ego", + "si ón", + "ci n", + "ti erra", + "m es", + "gu ar", + "ca do", + "en con", + "pr en", + "may or", + "f al", + "e r", + "o n", + "a n", + "t o", + "d i", + "r e", + "l a", + "i n", + "e n", + "a l", + "t a", + "c h", + "e l", + "r i", + "c o", + "t i", + "t e", + "s i", + "r a", + "u n", + "l e", + "l i", + "ch e", + "r o", + "c i", + "c a", + "s e", + "q u", + "m a", + "p o", + "s o", + "i l", + "d o", + "e s", + "v a", + "p er", + "l o", + "c on", + "d el", + "p a", + "m o", + "s a", + "p i", + "d a", + "m i", + "g i", + "s u", + "d e", + "v i", + "z i", + "m e", + "g li", + "n o", + "m en", + "v o", + "t u", + "n on", + "v e", + "t to", + "s t", + "on e", + "an o", + "ch i", + "er a", + "er e", + "f a", + "c e", + "z a", + "un a", + "b i", + "p re", + "s ta", + "o r", + "a r", + "f i", + "on o", + "t ra", + "n a", + "n el", + "n e", + "p ro", + "t ro", + "al e", + "v er", + "n i", + "c u", + "t ti", + "men te", + "del la", + "t er", + "zi one", + "g u", + "p e", + "t ta", + "an do", + "t à", + "al i", + "u o", + "qu el", + "co m", + "s en", + "co me", + "b a", + "al la", + "p ri", + "d u", + "qu es", + "l u", + "on i", + "g gi", + "pa r", + "s si", + "v en", + "in a", + "g a", + "pi ù", + "ci a", + "i m", + "co r", + "m an", + "in o", + "in i", + "t en", + "r an", + "b b", + "g o", + "s to", + "t re", + "a ve", + "a v", + "s ono", + "er i", + "a c", + "s se", + "er o", + "h a", + "s c", + "su l", + "f or", + "v ano", + "po r", + "s ti", + "su o", + "c chi", + "t an", + "z za", + "an che", + "p u", + "i o", + "t te", + "vo l", + "es s", + "s ci", + "co l", + "r u", + "p en", + "f u", + "al l", + "s so", + "s te", + "se m", + "s sa", + "d en", + "a d", + "t ri", + "de i", + "in e", + "ave va", + "men to", + "z z", + "a mo", + "g no", + "f o", + "un o", + "su a", + "g en", + "ri a", + "g e", + "st ra", + "s ì", + "c er", + "ch é", + "b u", + "a p", + "c en", + "d al", + "on a", + "s pe", + "g ni", + "b o", + "t t", + "del le", + "ques to", + "nel la", + "f f", + "d ere", + "an no", + "del l", + "un i", + "bb e", + "an ti", + "g ra", + "s p", + "en e", + "gi o", + "u to", + "qu al", + "gli a", + "qu ando", + "tu tto", + "c an", + "gli o", + "zi oni", + "ca m", + "h o", + "es so", + "s s", + "mo l", + "a t", + "lo ro", + "per ché", + "co sa", + "du e", + "po i", + "ca r", + "s co", + "ci o", + "to r", + "c co", + "c re", + "a m", + "g na", + "te m", + "pri ma", + "lu i", + "co sì", + "qu e", + "gu ar", + "ess ere", + "an i", + "con o", + "b ra", + "al le", + "m on", + "ri o", + "an co", + "cu i", + "s pi", + "vi a", + "g ran", + "gi or", + "a i", + "bi le", + "u l", + "ggi o", + "f e", + "an te", + "ma i", + "ta re", + "in ter", + "in di", + "re bbe", + "sen za", + "so lo", + "zi o", + "e d", + "en te", + "tu tti", + "sta to", + "zi a", + "d alla", + "tu ra", + "mi a", + "vi ta", + "quel la", + "qu a", + "ma r", + "do ve", + "g h", + "al lo", + "sem pre", + "zz o", + "si a", + "mo r", + "do po", + "por ta", + "d re", + "c cia", + "er ano", + "an ni", + "di o", + "chi a", + "en za", + "pro pri", + "qu i", + "m u", + "m b", + "an da", + "c ca", + "o cchi", + "ques ta", + "f fi", + "le i", + "par te", + "d on", + "r on", + "mi o", + "tan to", + "ri s", + "o gni", + "di s", + "r in", + "fa r", + "men ti", + "t el", + "anco ra", + "f ra", + "fa tto", + "man i", + "sen ti", + "p ra", + "tem po", + "es si", + "b bi", + "f in", + "a re", + "la re", + "per s", + "f on", + "b el", + "so r", + "d er", + "pre n", + "an za", + "di re", + "pi e", + "o ra", + "ver so", + "se gu", + "al tro", + "ta to", + "ca to", + "a to", + "vol ta", + "c c", + "fa re", + "pa re", + "ci ò", + "li b", + "bi li", + "n uo", + "s er", + "quel lo", + "co lo", + "p po", + "ca sa", + "tro va", + "o re", + "f er", + "r ono", + "d es", + "mol to", + "al mente", + "s ca", + "vo le", + "t ali", + "sul la", + "s ce", + "men o", + "an to", + "p un", + "s tu", + "ca pi", + "so l", + "gi u", + "m ini", + "m ano", + "z e", + "pi a", + "par ti", + "s al", + "la vo", + "ver o", + "r si", + "al tri", + "es ti", + "s cia", + "suo i", + "gli e", + "so tto", + "b ene", + "sc ri", + "t ale", + "de gli", + "n u", + "al c", + "uo mo", + "p el", + "f re", + "po te", + "es sa", + "s cu", + "si gno", + "el e", + "st ro", + "u ti", + "di a", + "si one", + "g re", + "f ini", + "ar ri", + "l un", + "c ri", + "e si", + "pa ssa", + "r à", + "men tre", + "an d", + "h anno", + "el o", + "u sci", + "gi a", + "gi à", + "di e", + "m ina", + "b e", + "ti ca", + "gior no", + "t in", + "es se", + "mo do", + "c al", + "s pa", + "propri o", + "l en", + "o ri", + "con tro", + "st ru", + "di ven", + "di sse", + "ra to", + "no i", + "v ere", + "pu ò", + "di ce", + "s an", + "es a", + "c ci", + "se con", + "re n", + "c cio", + "qual che", + "tu tta", + "g g", + "mon do", + "for ma", + "p li", + "m ma", + "pen sa", + "de va", + "tu r", + "fo sse", + "so pra", + "ta mente", + "n ess", + "qu anto", + "ra ga", + "un que", + "ca re", + "st re", + "gran de", + "pi cco", + "guar da", + "b en", + "nel l", + "a ff", + "po ssi", + "pre sen", + "r ò", + "pa ro", + "tu a", + "v in", + "an e", + "a s", + "ste sso", + "da v", + "ne i", + "nel le", + "gh i", + "pi o", + "ta r", + "an a", + "la to", + "si d", + "f ine", + "f uo", + "m er", + "z o", + "qua si", + "ul ti", + "i to", + "su e", + "si e", + "f il", + "allo ra", + "m in", + "ven i", + "t ano", + "el lo", + "d e", + "r a", + "e s", + "d o", + "e n", + "q u", + "c o", + "a s", + "o s", + "e r", + "a r", + "s e", + "qu e", + "a n", + "i n", + "i s", + "t o", + "ã o", + "t e", + "d a", + "m a", + "e l", + "t a", + "o r", + "i a", + "r e", + "e m", + "a l", + "co m", + "p a", + "o u", + "c a", + "u m", + "r o", + "v a", + "t i", + "s o", + "m en", + "n ão", + "h a", + "co n", + "m e", + "r i", + "pa ra", + "p o", + "d i", + "s a", + "v o", + "u ma", + "c i", + "n a", + "p or", + "n o", + "g u", + "s u", + "h o", + "an do", + "t ra", + "e i", + "v i", + "e u", + "i m", + "do s", + "el e", + "r es", + "m o", + "en t", + "f i", + "l a", + "e ra", + "l e", + "de s", + "el a", + "men te", + "l h", + "p er", + "l i", + "ç ão", + "m as", + "t er", + "m u", + "es t", + "v e", + "g o", + "l o", + "u s", + "ma is", + "v er", + "c ê", + "in ha", + "vo cê", + "f a", + "t u", + "c u", + "p ar", + "com o", + "p ro", + "s i", + "m os", + "e c", + "p re", + "d as", + "ç a", + "es ta", + "s er", + "u n", + "da de", + "d is", + "f o", + "e x", + "c h", + "i r", + "ra n", + "t ar", + "en te", + "g a", + "t r", + "p e", + "t os", + "b o", + "c ia", + "p en", + "c ar", + "s en", + "su a", + "se m", + "c as", + "f or", + "to u", + "n os", + "te m", + "r ia", + "m es", + "se u", + "co r", + "o n", + "a o", + "p os", + "ra m", + "v el", + "é m", + "t en", + "po de", + "t es", + "esta va", + "c e", + "b a", + "qu ando", + "m i", + "qu er", + "men to", + "se gu", + "t as", + "is so", + "mu i", + "g ar", + "t ro", + "d u", + "fa z", + "õ es", + "p es", + "an to", + "l u", + "p i", + "i x", + "ve z", + "s im", + "j a", + "p r", + "m in", + "b e", + "ra s", + "m an", + "p res", + "est á", + "c er", + "b re", + "p as", + "d ia", + "m b", + "dis se", + "n i", + "r os", + "es se", + "v ia", + "o lh", + "is a", + "an te", + "ê n", + "z a", + "qu i", + "b i", + "t inha", + "me u", + "s ão", + "m inha", + "a c", + "ri o", + "m ar", + "a t", + "p el", + "mui to", + "ta l", + "to r", + "fo i", + "h or", + "j o", + "b em", + "g i", + "f al", + "vo l", + "po n", + "di z", + "l ar", + "gu n", + "m or", + "r u", + "par ec", + "ç o", + "do r", + "pes so", + "n e", + "f er", + "b er", + "p u", + "po is", + "in a", + "es p", + "d ar", + "en do", + "de n", + "so bre", + "co s", + "p ri", + "al i", + "mes mo", + "ç ões", + "g ra", + "se us", + "me i", + "b ra", + "vi da", + "an tes", + "b ri", + "at é", + "ên cia", + "lh e", + "ti v", + "m ã", + "al g", + "qu anto", + "s ó", + "g os", + "de r", + "t ão", + "tu do", + "ent ão", + "r ou", + "es s", + "in da", + "b al", + "in do", + "ci o", + "n do", + "j á", + "va m", + "re i", + "l es", + "ei to", + "v is", + "tem po", + "de pois", + "c ha", + "m el", + "ch e", + "l ha", + "a inda", + "faz er", + "con tra", + "p ou", + "per gun", + "de ix", + "ta mb", + "ra r", + "al a", + "v en", + "t in", + "pel o", + "tamb ém", + "fi ca", + "pre c", + "el es", + "tra n", + "ha via", + "l á", + "to dos", + "j u", + "qu al", + "c an", + "ta do", + "cas a", + "es sa", + "n as", + "g em", + "m em", + "se i", + "na da", + "sen ti", + "c ri", + "ó s", + "de u", + "ei ro", + ". .", + "f un", + "as sim", + "s ou", + "ent re", + "com e", + "i or", + "h ar", + "f e", + "por que", + "s or", + "f in", + "ta mente", + "a qui", + "cu l", + "t ó", + "for ma", + "s ar", + "ou tra", + "olh os", + "i ma", + "m im", + "a go", + "in s", + "co u", + "g ran", + "v al", + "pesso as", + "era m", + "ei ra", + "a que", + "com p", + "de i", + "p ela", + "co isa", + "m ão", + "con h", + "ca da", + "ago ra", + "ia m", + "h á", + "con s", + "su as", + "gu ém", + "o b", + "l an", + "es ti", + "á s", + "la do", + "in ter", + "ca be", + "por ta", + "n em", + "í vel", + "r is", + "j e", + "n un", + "sem pre", + "con segu", + "h as", + "tra bal", + "f u", + "le v", + "l em", + "l as", + "va i", + "tr os", + "t ante", + "te i", + "pr ó", + "que m", + "tu ra", + "on de", + "cabe ça", + "nun ca", + "men tos", + "h um", + "de le", + "ver dade", + "t á", + "h os", + "el i", + "ent es", + "m er", + "alg um", + "diz er", + "s in", + "pen as", + "n ós", + "en quanto", + "ou tro", + "l ho", + "es te", + "mel hor", + "est ar", + "g an", + "b ar", + "pri mei", + "a u", + "i u", + "pen sa", + "a penas", + "p ra", + "es tou", + "con te", + "res pon", + "ho mem", + "do is", + "a do", + "c al", + "a b", + "l os", + "ç as", + "pou co", + "sen hor", + "t ando", + "esp era", + "pa i", + "ri os", + "no i", + "i da", + "ba ix", + "as e", + "is as", + "f r", + "ho ra", + "mu ndo", + "pas sa", + "fi car", + "to do", + "se ja", + "al mente", + "â n", + "c lar", + "a d", + "in c", + "f os", + "lo n", + "g ri", + "ou vi", + "v em", + "g e", + "ta va", + "á rio", + "mo n", + "s os", + "in ho", + "ma l", + "t an", + "t re", + "gran de", + "ran do", + "b u", + "v ou", + "ê s", + "co isas", + "a conte", + "lh er", + "g en", + "ci on", + "an os", + "i do", + "tal vez", + "est ão", + "li v", + "sa b", + "su r", + "ou tros", + "c re", + "qual quer", + "g ou", + "t ri", + "l í", + "tiv esse", + "ra do", + "prec isa", + "mã e", + "su s", + "t anto", + "de la", + "men os", + "s al", + "en tra", + "p é", + "ma ior", + "noi te", + "ti va", + "p ala", + "so n", + "ra ção", + "de us", + "s as", + "un i", + "l or", + "u l", + "in te", + "f ei", + "an o", + "par ti", + "pala v", + "tr ás", + "par te", + "b el", + "ci dade", + "lu gar", + "v os", + "vez es", + "do u", + "en contra", + "tr u", + "e ci", + "a r", + "e r", + "a n", + "e n", + "i n", + "i r", + "o r", + "d e", + "a k", + "ı n", + "a l", + "d i", + "d a", + "b u", + "b ir", + "y or", + "i l", + "e k", + "y a", + "m a", + "l a", + "e l", + "u n", + "k a", + "l ar", + "i m", + "d ı", + "e t", + "o n", + "d u", + "o l", + "e y", + "t ı", + "m i", + "h a", + "b a", + "l er", + "ü n", + "m ı", + "i z", + "l e", + "ı r", + "m e", + "i s", + "n e", + "o k", + "t a", + "s a", + "u m", + "r a", + "g ö", + "i k", + "s ı", + "d en", + "e s", + "b il", + "t i", + "l ı", + "ü z", + "i ç", + "ü r", + "g i", + "u r", + "t e", + "b en", + "d an", + "i y", + "ı m", + "u z", + "v e", + "c ak", + "a y", + "c e", + "i ş", + "ın ı", + "i yor", + "ba ş", + "d ü", + "a t", + "a m", + "g el", + "de ğ", + "k ar", + "i ̇", + "m u", + "e v", + "ö y", + "bu n", + "v ar", + "ya p", + "s en", + "an a", + "s un", + "in i", + "gö r", + "y ı", + "k i", + "l i", + "ar a", + "al ı", + "on u", + "ç ı", + "ş ey", + "s ın", + "k ı", + "ka d", + "s e", + "t an", + "a ğ", + "değ il", + "s in", + "ü k", + "a z", + "ç ok", + "s on", + "ş ı", + "b i", + "ü l", + "t u", + "v er", + "iç in", + "g e", + "k en", + "ey e", + "ol du", + "mı ş", + "y e", + "k al", + "m ek", + "l an", + "öy le", + "yor du", + "er i", + "y üz", + "mi ş", + "b e", + "m ak", + "o la", + "in e", + "y an", + "h er", + "c ek", + "yor um", + "b ak", + "ü m", + "ö n", + "lar ı", + "o ğ", + "d er", + "kad ar", + "h al", + "ar ı", + "s t", + "s an", + "ın da", + "du r", + "g ün", + "v a", + "y ok", + "y er", + "dı m", + "k o", + "da ha", + "l u", + "ın a", + "di m", + "e m", + "bil ir", + "ik i", + "s iz", + "s i", + "n a", + "di ğ", + "s u", + "b ü", + "ha y", + "s or", + "dü ş", + "ü ç", + "un u", + "ö r", + "d ir", + "m ü", + "c a", + "am an", + "f ak", + "a da", + "e de", + "son ra", + "h iç", + "ak i", + "ğ ı", + "bu l", + "r u", + "ma z", + "an la", + "bu ra", + "ge ç", + "ma ya", + "l en", + "k onu", + "c i", + "c u", + "d in", + "t ek", + "z aman", + "el er", + "ö z", + "dı r", + "gi bi", + "o t", + "ş a", + "g er", + "ler i", + "k im", + "k u", + "fak at", + "y ar", + "gö z", + "c ı", + "yor sun", + "b ek", + "in de", + "r o", + "p ek", + "bun u", + "l ik", + "m an", + "il er", + "e di", + "ö l", + "s ür", + "b in", + "s ır", + "çı k", + "sı l", + "al ar", + "k es", + "y ak", + "ç ek", + "yı l", + "e cek", + "ı z", + "gi t", + "ka p", + "a ma", + "ı l", + "lar ın", + "b iz", + "tı r", + "o y", + "an cak", + "d oğ", + "ç a", + "b ana", + "ş im", + "baş la", + "l ü", + "ma dı", + "ben i", + "t ir", + "y ük", + "lı k", + "be ş", + "b el", + "b er", + "m er", + "na sıl", + "tı k", + "k e", + "t ür", + "a v", + ". .", + "d aki", + "p ar", + "t er", + "ce ğ", + "t en", + "z ı", + "iy i", + "d ok", + "ben im", + "c ağ", + "n er", + "y en", + "ş u", + "me z", + "düş ün", + "ken di", + "şim di", + "y ol", + "y u", + "de v", + "is te", + "s ek", + "ma m", + "s öyle", + "di k", + "t o", + "k ur", + "oldu ğ", + "s ını", + "t ar", + "bil iyor", + "k an", + "y al", + "m eye", + "mu ş", + "f a", + "ka ç", + "bil e", + "iy e", + "t ü", + "e f", + "tı m", + "ev et", + "ç o", + "y et", + "g en", + "bura da", + "t im", + "bir az", + "es i", + "k or", + "doğ ru", + "in in", + "kı z", + "di ye", + "d ör", + "et ti", + "on un", + "is ti", + "ğ i", + "h e", + "s ana", + "ü ş", + "ar ka", + "hay ır", + "kar şı", + "h ar", + "il e", + "h ak", + "ı yor", + "ne den", + "s ev", + "sı z", + "ço cu", + "me m", + "ç alı", + "ol ur", + "b ır", + "g ir", + "is e", + "i h", + "c an", + "k ır", + "d ön", + "b öyle", + "sen i", + "! \"", + "al t", + "dör t", + "s öy", + "o ş", + "mu sun", + "la ş", + "h an", + "i p", + "ka y", + "h em", + "bü yük", + "a ç", + "bır ak", + "mi sin", + "s öz", + "u l", + "değ iş", + "ün ü", + "g ül", + "k ö", + "kar ı", + "ta mam", + "ol u", + "r ar", + "yen i", + "la m", + "mış tı", + "ya ş", + "al a", + "in iz", + "kad ın", + "bun un", + "m ey", + "al tı", + "y i", + "s o", + "in den", + "sen in", + "ya t", + "to p", + "s er", + "is i", + "d ün", + "s es", + "hiç bir", + "y on", + "d ın", + "t ün", + "baş ka", + "a s", + "he p", + "i t", + "ir mi", + "dev am", + "ola cak", + "ar tık", + "r e", + "dur um", + "im iz", + "üz el", + "ler ini", + "sa ğ", + "p ro", + "ger ek", + "y irmi", + "ş ek", + "ba ğ", + "me di", + "lar a", + "a h", + "t ur", + "y ür", + "ma sı", + "ka tı", + "de di", + "g ü", + "sor un", + "el i", + "ün e", + "mı z", + "yap ı", + "m il", + "ğ ını", + "t ara", + "m en", + "ha t", + "var dı", + "m et", + "konu ş", + "ar ak", + "lar ak", + "çocu k", + "bü tün", + "l ey", + "d ür", + "g üzel", + "ay ı", + "yap a", + "n ı", + "ay r", + "ö ne", + "yordu m", + "b an", + "i̇ ş", + "du m", + "un a", + "on a", + "yor lar", + "lar ını", + "çı kar", + "z an", + "se ç", + "l iyor", + "t ak", + "şı k", + "tek rar", + "a ş", + "e ş", + "miş ti", + "f ar", + "k in", + "im i", + "i f", + "e ğ", + "gi di", + "le ş", + "başla dı", + "gi de", + "ot ur", + "d de", + "ın dan", + "üz er", + "ın ın", + "n ız", + "u y", + "ye di", + "ka t", + "o larak", + "la dı", + "yal nız", + "ba h", + "iy et", + "m al", + "s ak", + "a çık", + "sın da", + ".. .", + "in san", + "ay nı", + "e der", + "is tan", + "uz un", + "sa h", + "d o", + "g eri", + "er ek", + "ol an", + "ger çek", + "f en", + "al an", + "dı ş", + "alı k", + "far k", + "ü st", + "sa de", + "r i", + "k iş", + "l dı", + "z or", + "et ir", + "her kes", + "s al", + "ö mer", + "s el", + "un da", + "ha f", + "bun a", + "y dı", + "pek i", + "ada m", + "ha z", + "sın a", + "kap ı", + "gör üş", + "sade ce", + "al dı", + "gel di", + "i e", + "n ie", + "n a", + "r z", + "s z", + "c z", + "p o", + "s t", + "c h", + "i ę", + "d z", + "n i", + "a ł", + "r a", + "j e", + "r o", + "d o", + "s ię", + "z a", + "g o", + "e m", + "w i", + "c i", + "rz e", + "k o", + "l e", + "l i", + "w a", + "t o", + "k a", + "m i", + "ż e", + "t a", + "w ie", + "b y", + "m o", + "w y", + "rz y", + "ł a", + "j a", + "n o", + "ł o", + "w o", + "p a", + "m a", + "t e", + "t y", + "n y", + "k i", + "d a", + "n e", + "dz ie", + "dz i", + "cz y", + "c ie", + "m y", + "p rze", + "d y", + "o d", + "l a", + "k ie", + "r y", + "st a", + "j ą", + "ó w", + "c e", + "p rzy", + "c o", + "k u", + "m ie", + "sz y", + "cz e", + "r e", + "b a", + "s i", + "b ie", + "m u", + "w e", + "c y", + "ni a", + "ś ci", + "sz e", + "je st", + "k t", + "s a", + "b o", + "t u", + "ż y", + "n ą", + "b i", + "r u", + "a le", + "kt ó", + "p ra", + "ał a", + "m nie", + "p ie", + "ł y", + "cz a", + "ja k", + "ro z", + "r ó", + "l u", + "z na", + "g a", + "ra z", + "ł u", + "ta k", + "j u", + "p i", + "ś ć", + "s o", + "wi a", + "m ó", + "ch o", + "w szy", + "p e", + "s po", + "c a", + "g dy", + "w ał", + "w ię", + "d e", + "b e", + "p ro", + "ł em", + "j ę", + "s k", + "z e", + "l o", + "g i", + "r ę", + "do b", + "d u", + "ju ż", + "st o", + "b ę", + "ał em", + "sz a", + "m e", + "po d", + "d la", + "pa n", + "n ę", + "z o", + "mo że", + "ś li", + "s ie", + "ał o", + "t em", + "l ko", + "ny ch", + "po wie", + "c ię", + "s u", + "ty lko", + "i n", + "b u", + "na j", + "ch a", + "te go", + "p u", + "s ki", + "ne go", + "wszy st", + "sz cze", + "je d", + "je j", + "t wo", + "ą d", + "ś my", + "cz ę", + "wa ć", + "je go", + "ż a", + "i m", + "s y", + "pra w", + "ty m", + "któ ry", + "ał y", + "t rze", + "nie j", + "s e", + "ny m", + "i ch", + "o b", + ". .", + "g ło", + "ją c", + "mó wi", + "s ka", + "o n", + "ne j", + "s łu", + "w ła", + "bę dzie", + "d ę", + "p ó", + "be z", + "ni c", + "p ła", + "ś cie", + "mi a", + "s ą", + "t rzy", + "kie m", + "by ł", + "mo g", + "ro bi", + "ta m", + "c u", + "te n", + "m ię", + "z y", + "pe w", + "ci a", + "my ś", + "prze d", + "s ko", + "n u", + "któ re", + "a l", + "l ę", + "w sze", + "ą c", + "by ło", + "so bie", + "p y", + "ci ą", + "ba r", + "je szcze", + "h a", + "t ę", + "b ra", + "cza s", + "sz ę", + "g ł", + "k ę", + "ma r", + "cz u", + "prze z", + "f i", + "s ło", + "w z", + "k to", + "k ów", + "cz o", + "li śmy", + "st ra", + "wię c", + "r ą", + "ma m", + "w ó", + "rz a", + "g ro", + "no ści", + "f a", + "we t", + "ną ł", + "ś mie", + "na wet", + "mu si", + "s wo", + "te j", + "w ą", + "w u", + "wi ą", + "ni u", + "cz ą", + "b li", + "dz o", + "s kie", + "n em", + "je śli", + "cze go", + "ch y", + "d ł", + "ty ch", + "by m", + "ż o", + "e ś", + "si ą", + "kie dy", + "na s", + "w ró", + "dz e", + "d ro", + "t ra", + "r ów", + "pa ni", + "z ie", + "ku l", + "na d", + "ch wi", + "ni m", + "t ro", + "by ć", + "cho dzi", + "ni o", + "dob rze", + "te raz", + "wo kul", + "co ś", + "k ł", + "pie r", + "h e", + "g dzie", + "dz y", + "p ię", + "d ź", + "k ą", + "g ó", + "z da", + "ch ce", + "st ę", + "o r", + "ś wia", + "wszyst ko", + "st ro", + "pe ł", + "wie m", + "wie l", + "ka ż", + "ki m", + "rz u", + "s ły", + "jed na", + "z u", + "myś l", + "mó j", + "g u", + "wa r", + "jest em", + "ó ż", + "mie j", + "mo ż", + "k ła", + "re sz", + "d łu", + "st wo", + "n ię", + "ma sz", + "że by", + "nie m", + "ja kie", + "st y", + "ni ą", + "we j", + "o j", + "g ra", + "s ła", + "no ść", + "z ło", + "sz czę", + ".. .", + "r i", + "le j", + "we go", + "c ał", + "dzi ał", + "ki ch", + "dz a", + "dz ię", + "o czy", + "zo sta", + "cz ło", + "na m", + "ki l", + "o na", + "sz u", + "w ę", + "pa r", + "mi ał", + "st rze", + "ce j", + "e j", + "zna j", + "da ć", + "miej s", + "k ró", + "k ry", + "bar dzo", + "si a", + "z i", + "ś nie", + "l ą", + "g ie", + "cie bie", + "d ni", + "st u", + "po trze", + "wokul ski", + "u wa", + "u mie", + "jedna k", + "k ra", + "wró ci", + "czło wie", + "czy ć", + "by ła", + "że li", + "m ę", + "c ę", + "z robi", + "mog ę", + "pro wa", + "r em", + "nie ch", + "cz nie", + "k ro", + "t ą", + "ch ci", + "b ro", + "dzie ć", + "sz ą", + "pa d", + "t rz", + "t ru", + "je m", + "a ni", + "t ów", + "a r", + "d ru", + "ta j", + "rze kł", + "sa m", + "st e", + "nie go", + "ta kie", + "w ała", + "to wa", + "ka pła", + "wi dzi", + "po dob", + "dz ę", + "t ał", + "stę p", + "b ą", + "po ko", + "w em", + "g ę", + "a by", + "g e", + "al bo", + "s pra", + "z no", + "de n", + "s mo", + "je sz", + "k się", + "jest eś", + "po z", + "ni gdy", + "k sią", + "c óż", + "w s", + "po w", + "t ka", + "ś wie", + "sz ka", + "sa mo", + "s ł", + "rz ę", + "na le", + "chce sz", + "ni k", + "p ę", + "chy ba", + "cią g", + "ją cy", + "wo j", + "na sze", + "mnie j", + "wię cej", + "z wy", + "o sta", + "f e", + "wa ż", + "h o", + "se r", + "śmie r", + "wie r", + "dz ą", + "za ś", + "gdy by", + "ja ki", + "wo l", + "wi n", + "d ą", + "ści a", + "roz ma", + "wa l", + "pa nie", + "sta r", + "ka z", + "je żeli", + "d em", + "w ra", + "ko ń", + "sie bie", + "zno wu", + "p ró", + "cz em", + "st wa", + "i sto", + "pó ł", + "d ał", + "ko bie", + "ała m", + "wy ch", + "ce sa", + "ni ch", + "za wsze", + "dzi ć", + "te ż", + "le pie", + "pro szę", + "k re", + "t wa", + "o t", + "ł ą", + "ch u", + "c ą", + "p rz", + "ł e", + "sze dł", + "od powie", + "my śli", + "ś wią", + "e n", + "e r", + "d e", + "a n", + "e t", + "i j", + "i n", + "e l", + "a a", + "s t", + "o r", + "g e", + "i s", + "a t", + "i e", + "c h", + "o n", + "e en", + "h et", + "i t", + "v er", + "aa r", + "a l", + "o or", + "g en", + "v an", + "o p", + "d en", + "h e", + "o m", + "t e", + "w e", + "i k", + "r e", + "z e", + "ij n", + "d at", + "b e", + "d er", + "in g", + "o e", + "ij k", + "a an", + "ch t", + "v oor", + "l e", + "i et", + "r o", + "m o", + "k en", + "z ijn", + "m en", + "i g", + "j e", + "n iet", + "a r", + "o o", + "i d", + "u n", + "i l", + "s ch", + "mo et", + "st e", + "u r", + "o l", + "he b", + "u it", + "g el", + "w ij", + "a s", + "m e", + "t en", + "w or", + "o u", + "v en", + "l en", + "aa t", + "d it", + "m et", + "r a", + "b en", + "s p", + "o ver", + "d ie", + "n o", + "w er", + "l ijk", + "f t", + "s l", + "an d", + "v e", + "t er", + "i er", + "i en", + "t o", + "d aar", + "g r", + "b el", + "de ze", + "d u", + "a g", + "k an", + "wor den", + "in gen", + "moet en", + "n en", + "on der", + "heb ben", + "r u", + "oo k", + "s en", + "c t", + "k t", + "no g", + "aa l", + "w as", + "u l", + "e er", + "b ij", + "m ijn", + "p ro", + "v ol", + "d o", + "k om", + "at ie", + "e ft", + "k el", + "al s", + "r ij", + "he id", + "a f", + "st el", + "m aar", + "a p", + "we e", + "a d", + "he eft", + "w aar", + "i cht", + "d an", + "er en", + "n e", + "w el", + "w at", + "w il", + "a cht", + "aa g", + "ge b", + "c on", + "z o", + "k e", + "b et", + "h ij", + "d ig", + "k un", + "u w", + "d t", + "d oor", + "t ij", + "a m", + "an g", + "on d", + "er s", + "is ch", + "ge en", + "i ge", + "ge v", + "ve el", + "n u", + "m a", + "on s", + "o f", + "b l", + "n aar", + "g ro", + "p l", + "an der", + "at en", + "kun nen", + "e cht", + "h ier", + "g oe", + "an t", + "u s", + "t wee", + "on t", + "de lijk", + "el e", + "u ur", + "al le", + "t oe", + "me er", + "i st", + "n a", + "n ie", + "on ze", + "l o", + "i m", + "p en", + "h ad", + "tij d", + "h oe", + "to t", + "z ou", + "a k", + "aa k", + "a men", + "d r", + "w oor", + "s e", + "wor dt", + "o t", + "gel ijk", + "g aan", + "i c", + "g er", + "k er", + "el d", + "e m", + "h ou", + "de l", + "z en", + "z el", + "te gen", + "b o", + "kom en", + "c om", + "i gen", + "e it", + "wer k", + "goe d", + "z al", + "z ij", + "sl ag", + "e s", + "z ien", + "a st", + "echt er", + "it ie", + "t ie", + "el ijk", + "m is", + "isch e", + "bel an", + "h aar", + "i ch", + "b er", + "h an", + "v r", + "al e", + "c i", + "gr ijk", + "in d", + "do en", + "l and", + "belan grijk", + "p un", + "op en", + "ct ie", + "zel f", + "m ij", + "it eit", + "ste m", + "me e", + "ar en", + "al l", + "b r", + "re cht", + "d ien", + "h u", + "g aat", + "pro b", + "m oe", + "p er", + "a u", + "ul len", + "z ich", + "daar om", + "or m", + "k l", + "v o", + "en t", + "st aat", + "z it", + "du i", + "n at", + "du s", + "d s", + "ver slag", + "kel ijk", + "prob le", + "w et", + "ge m", + "c r", + "i on", + "p r", + "sch ap", + "g d", + "h un", + "z a", + "er d", + "z et", + "st aan", + "st r", + "m aal", + "in der", + "e id", + "st en", + "p ar", + "k ken", + "ge d", + "z ullen", + "re s", + "men sen", + "j aar", + "re gel", + "ie der", + "vol gen", + "ge ven", + "e ven", + "l u", + "bl ij", + "i ë", + "k o", + "u we", + "m an", + "ma ken", + "l ie", + "g a", + "oe k", + "nie uwe", + "b aar", + "h o", + "h er", + "in ter", + "ander e", + "ru ik", + "s u", + "a gen", + "or t", + "m er", + "ou w", + "st er", + "wil len", + "aa kt", + "h oo", + "an den", + "f f", + "l ig", + "t re", + "s amen", + "ze er", + "dui delijk", + "ant woor", + "he el", + "men t", + "pun t", + "hou den", + "we g", + "vr aag", + "gel e", + "een s", + "be sch", + "om en", + "er g", + "do el", + "d ag", + "sp e", + "ur en", + "ing s", + "or en", + "l ang", + "de len", + "m ar", + "ste un", + "in nen", + "p ol", + "o on", + "i de", + "s n", + "s ie", + "r icht", + "z onder", + "no dig", + "all een", + "m id", + "ra gen", + "iet s", + "ver sch", + "geb ruik", + "st u", + "ro uw", + "stel len", + "be g", + "men ten", + "v in", + "eer ste", + "l aat", + "gro ot", + "oo d", + "to ch", + "l aten", + "aar d", + "s le", + "de el", + "st and", + "pl aat", + "re e", + "bet re", + "d i", + "l id", + "uit en", + "ra cht", + "bel eid", + "g et", + "ar t", + "st ie", + "st aten", + "g gen", + "re ken", + "e in", + "al en", + "m ing", + "mo gelijk", + "gro te", + "al tijd", + "z or", + "en kel", + "w ik", + "pol itie", + "e igen", + "el k", + "han del", + "g t", + "k we", + "m aat", + "el en", + "i p", + "v rij", + "s om", + "je s", + "aa m", + "hu is", + "v al", + "we er", + "lid staten", + "k ing", + "k le", + "be d", + "gev al", + "stel l", + "a i", + "wik kel", + "kwe stie", + "t al", + "ste e", + "a b", + "h el", + "kom st", + "p as", + "s s", + "it u", + "i den", + "eer d", + "m in", + "c e", + "p o", + "twee de", + "proble em", + "w aren", + "us sen", + "sn el", + "t ig", + "ge w", + "j u", + "ul t", + "ne men", + "com mis", + "versch il", + "k on", + "z oek", + "k rij", + "gr aag", + "den k", + "l anden", + "re den", + "be sl", + "oe g", + "bet er", + "he den", + "m ag", + "p e", + "bo ven", + "a c", + "con t", + "f d", + "h ele", + "k r", + "v ier", + "w in", + "ge z", + "k w", + "m il", + "v or", + "he m", + "ra m", + "aa s", + "ont wikkel", + "dr ie", + "v aak", + "plaat s", + "l a", + "g ang", + "ij f", + "f in", + "nat uur", + "t ussen", + "u g", + "in e", + "d a", + "b at", + "kom t", + "w acht", + "aa d", + "u t", + "é n", + "acht er", + "geb ie", + "ver k", + "lig t", + "c es", + "nie uw", + "van d", + "s t", + "n í", + "j e", + "p o", + "c h", + "r o", + "n a", + "s e", + "t o", + "n e", + "l e", + "k o", + "l a", + "d o", + "r a", + "n o", + "t e", + "h o", + "n ě", + "v a", + "l i", + "l o", + "ř e", + "c e", + "d e", + "v e", + "b y", + "n i", + "s k", + "t a", + "n á", + "z a", + "p ro", + "v o", + "v ě", + "m e", + "v á", + "s o", + "k a", + "r á", + "v y", + "z e", + "m i", + "p a", + "t i", + "st a", + "m ě", + "n é", + "ř i", + "ř í", + "m o", + "ž e", + "m a", + "j í", + "v ý", + "j i", + "d ě", + "r e", + "d a", + "k u", + "j a", + "c i", + "r u", + "č e", + "o b", + "t ě", + "m u", + "k y", + "d i", + "š e", + "k é", + "š í", + "t u", + "v i", + "p ře", + "v í", + "s i", + "n ý", + "o d", + "so u", + "v é", + "n y", + "r i", + "d y", + "b u", + "b o", + "t y", + "l á", + "l u", + "n u", + "ž i", + "m á", + "st i", + "c í", + "z á", + "p ra", + "sk é", + "m í", + "c o", + "d u", + "d á", + "by l", + "st o", + "s a", + "t í", + "je d", + "p ří", + "p ři", + "t é", + "s í", + "č i", + "v ní", + "č a", + "d í", + "z i", + "st u", + "p e", + "b a", + "d ní", + "ro z", + "va l", + "l í", + "s po", + "k á", + "b e", + "p i", + "no u", + "ta k", + "st e", + "r y", + "l é", + "vě t", + "se m", + "p ě", + "ko n", + "ne j", + "l y", + "ko u", + "ý ch", + "b ě", + "p r", + "f i", + "p rá", + "a le", + "ja ko", + "po d", + "ž í", + "z í", + "j sou", + "j sem", + "ch o", + "l ní", + "c ké", + "t á", + "m y", + "a k", + "h u", + "va t", + "pře d", + "h la", + "k e", + "st á", + "č í", + "š i", + "s le", + "k la", + "š tě", + "lo u", + "m ů", + "z na", + "ch á", + "o r", + "p ů", + "h a", + "b i", + "ta ké", + "d ů", + "no st", + "t ře", + "te r", + "p u", + "i n", + "v r", + "ve l", + "sk u", + "v še", + "t ní", + "do b", + "by la", + "č ní", + "ja k", + "v u", + "je ho", + "b ý", + "vá ní", + "ný ch", + "po u", + "te n", + "t ři", + "v z", + "st ře", + "d va", + "h le", + "č á", + "no sti", + "c k", + "v š", + "vo u", + "s u", + "h e", + "h ra", + "je n", + "s y", + "da l", + "po z", + "s lo", + "te l", + "d ru", + "de n", + "vš ak", + "g i", + "k dy", + "by lo", + "bu de", + "st ra", + "j ší", + "m é", + "me n", + "vý ch", + "ní m", + "s m", + "ko li", + "r ů", + "t ra", + "mů že", + "ne ní", + "ho d", + "b í", + "do u", + "sk a", + "t ý", + "st ě", + "u je", + "s á", + "pě t", + "ne s", + "k rá", + "to m", + "st ví", + "v ně", + "se d", + "s vé", + "p í", + "z o", + "mu sí", + "u ž", + "tí m", + "jí cí", + "jed no", + "t r", + "ča s", + "e v", + "č ty", + "sk ý", + "ni c", + "ev ro", + "to ho", + "h y", + "k ter", + "r ní", + "st í", + "s vě", + "pa k", + "vše ch", + "k ů", + "n g", + "á d", + "chá zí", + "a ni", + "a r", + "jed na", + "bý t", + "t ro", + "k ra", + "pr vní", + "m no", + "ské ho", + "p á", + "p la", + "le m", + "ne bo", + "ke m", + "st ro", + "s la", + "né ho", + "z de", + "dal ší", + "ř a", + "čty ři", + "h rá", + "dru h", + "l ně", + "v la", + "sk ých", + "š ko", + "pů so", + "pro to", + "v ů", + "sk á", + "ve n", + "še st", + "d ně", + "je ště", + "me zi", + "te k", + "s ko", + "ch a", + "ně koli", + "be z", + "g ra", + "ji ž", + "č ně", + "j á", + "s lu", + "z ná", + "ve r", + "sed m", + "k ro", + "ta m", + "a no", + "v lá", + "o sm", + "byl y", + "vá m", + "ck ý", + "te ch", + "dě ji", + "vel mi", + "le ži", + "va la", + "l ý", + "t vo", + "spo le", + "ch u", + "stu p", + "mo ž", + "evro p", + "g e", + "sta l", + "j de", + "ch y", + "ro di", + "je jí", + "po li", + "de vět", + "s me", + "a ž", + "té to", + "re m", + "d é", + "f or", + "u ni", + "f o", + "ten to", + "a u", + "ka ž", + "nu la", + "na d", + "by ch", + "mo c", + "sto u", + "e x", + "le n", + "k do", + "z d", + "pra co", + "to mu", + "ný m", + "ži vo", + "ze m", + "f e", + "f u", + "ná sle", + "j o", + "sk y", + "ji ch", + "h á", + "mě l", + "dě la", + "j sme", + "p re", + "ni ce", + "ste j", + "ne m", + "st ní", + "he m", + "ná ro", + "z u", + "b li", + "ni t", + "pa r", + "a l", + "poz ději", + "ta ko", + "n ce", + "če r", + "ší m", + "ně co", + "vá l", + "ře j", + "krá t", + "á lní", + "u r", + ". .", + "a si", + "kter é", + "sta v", + "ma jí", + "my s", + "do bě", + "s ně", + "ce n", + "z y", + "z ku", + "t ů", + "ch od", + "s pě", + "je jich", + "sou čas", + "d r", + "va li", + "ri e", + "k te", + "pr ů", + "ze ní", + "pa t", + "a n", + "po tře", + "de m", + "d nes", + "ze mí", + "sa mo", + "zna m", + "b ra", + "má m", + "te dy", + "g o", + "hla vní", + "pou ží", + "b ní", + "ve de", + "le p", + "je k", + "pra v", + "poli ti", + "d ne", + "je m", + "le t", + "če ní", + "pro b", + "ne ž", + "dě l", + "fi l", + "č o", + "cí ch", + "st é", + "d lou", + "h i", + "a by", + "to u", + "několi k", + "d la", + "vy u", + "vi t", + "ho u", + "ck ých", + "no vé", + "či n", + "st y", + "dě lá", + "k ý", + "ob la", + "pod le", + "ra n", + "dů leži", + "ta to", + "po ku", + "ko ne", + "d ý", + "d vě", + "ž ád", + "nou t", + "t ku", + "t vr", + "cké ho", + "ro v", + "r é", + "te le", + "p sa", + "s vět", + "ti vní", + "do sta", + "te m", + "še l", + "druh é", + "s kou", + "ž o", + "jed ná", + "vý znam", + "prob lé", + "pu bli", + "vá n", + "od po", + "pod po", + "d le", + "ja ké", + "še ní", + "ví m", + "bě hem", + "na chází", + "s lou", + "pou ze", + "o tá", + "p lo", + "to vé", + "vět ši", + "ko mi", + "va jí", + "ty to", + "zá pa", + "z mě", + "mo h", + "ví ce", + "spole č", + "au to", + "pro ti", + "st ru", + "dě t", + "chá ze", + "že l", + "с т", + "е н", + "н о", + "н а", + "п р", + "т о", + "п о", + "р а", + "г о", + "к о", + "н е", + "в о", + "в а", + "е т", + "е р", + "н и", + "е л", + "и т", + "н ы", + "з а", + "р о", + "ен и", + "к а", + "л и", + "е м", + "д а", + "о б", + "л а", + "д о", + "с я", + "т ь", + "о т", + "л о", + "л ь", + "е д", + "с о", + "м и", + "р е", + "м о", + "ц и", + "пр о", + "т а", + "э то", + "к и", + "р у", + "пр и", + "т и", + "с е", + "ст а", + "в ы", + "м ы", + "в и", + "б ы", + "м а", + "е с", + "л я", + "ст и", + "л е", + "ч то", + "м е", + "р и", + "ч а", + "о д", + "е й", + "ел ь", + "ени я", + "г а", + "н у", + "с и", + "п а", + "ра з", + "б о", + "ст о", + "с у", + "с а", + "д у", + "е го", + "е ст", + "и н", + "ит ь", + "и з", + "ж е", + "м у", + "п ер", + "по д", + "ени е", + "с ь", + "к у", + "пр ед", + "но го", + "ны х", + "в ер", + "т е", + "но й", + "ци и", + "д е", + "р ы", + "д ел", + "л ю", + "в е", + "о н", + "м ен", + "г и", + "н я", + "б у", + "пр а", + "в се", + "ет ся", + "ст ь", + "ж а", + "до л", + "ж и", + "б е", + "ко н", + "с л", + "ш и", + "д и", + "ст в", + "с ко", + "ны е", + "ч и", + "ю т", + "д ер", + "ст ра", + "т ы", + "х од", + "щ и", + "з о", + "з на", + "но сти", + "ч ес", + "в ля", + "ва ть", + "о р", + "по л", + "в ет", + "та к", + "ш а", + "т у", + "с во", + "пр е", + "о на", + "ит ель", + "ны й", + "с ло", + "ка к", + "в л", + "но сть", + "х о", + "мо ж", + "п е", + "д ля", + "ни я", + "но е", + "ра с", + "дол ж", + "да р", + "т ель", + "с ка", + "п у", + "ст во", + "ко то", + "ра б", + "е е", + "ро д", + "э ти", + "с об", + "о ру", + "ж ен", + "ны м", + "ит и", + "ни е", + "ко м", + "д ет", + "ст у", + "г у", + "п и", + "ме ж", + "ени ю", + "т ер", + "раб от", + "во з", + "ци я", + "ко й", + "щ ест", + "г ра", + "з и", + "р я", + "меж ду", + "ст ва", + "в с", + "ел о", + "ш е", + "м ер", + "б а", + "з ы", + "л у", + "а ль", + "д ей", + "г ла", + "на род", + "к ти", + "пред ста", + "л ся", + "я вля", + "с ки", + "но в", + "ед ин", + "ро в", + "и с", + "ни ма", + "р ем", + "ход и", + "так же", + "д ру", + "а ть", + "сл ед", + "го во", + "на я", + "ю щи", + "ен ь", + "кото ры", + "х от", + "в у", + "и х", + "ем у", + "ч ит", + "ва ж", + "ор га", + "чес ки", + "щ е", + "к е", + "х а", + "по с", + "то м", + "бо ль", + "м не", + "па с", + "об ъ", + "пра в", + "кон ф", + "сл у", + "под дер", + "ст ви", + "на ш", + "ль ко", + "сто я", + "ну ю", + "л ем", + "ен ных", + "к ра", + "д ы", + "между народ", + "г да", + "не об", + "го су", + "ств у", + "ени и", + "госу дар", + "к то", + "и м", + "ч ест", + "р ет", + "во про", + "л ен", + "ел и", + "ро ва", + "ци й", + "на м", + "это й", + "ж ения", + "необ ходи", + "мен я", + "бы ло", + "си ли", + "ф и", + "в я", + "ш ь", + "это го", + "о ни", + "орга ни", + "бе зо", + "пр об", + "и ме", + "ре ш", + "б и", + "безо пас", + "ют ся", + "о ста", + "ен но", + "го д", + "ел а", + "предста в", + "ть ся", + "сло во", + "органи за", + "долж ны", + "это м", + "б ла", + "ч е", + "ч у", + "бла го", + "это му", + "в рем", + "с пе", + "но м", + "ени й", + "с по", + "на с", + "не т", + "з у", + "в ед", + "е ще", + "ска за", + "се й", + "ер ен", + "да н", + "са м", + "ел я", + "ра н", + "зы ва", + "явля ется", + "бу дет", + "кти в", + "т ре", + "дел е", + "м от", + "конф ерен", + "ла сь", + "ча с", + "сто ро", + "ко го", + "е з", + "не й", + "о с", + "ли сь", + "раз ору", + "пер е", + "с си", + "ны ми", + "про ц", + "го ло", + "ч ело", + "бо ле", + "чело ве", + "с ер", + "п л", + "ч ет", + "стра н", + "п я", + "бы л", + "к ла", + "то в", + "ж д", + "дел а", + "е ра", + "у же", + "со вет", + "г ен", + "безопас ности", + "ц а", + "се да", + "по з", + "от вет", + "проб лем", + "на ко", + "т ем", + "до ста", + "п ы", + "щ а", + "во й", + "су щест", + "необходи мо", + "бы ть", + "мож ет", + "д ем", + "что бы", + "е к", + "ч ер", + "у сили", + "ре с", + "ру д", + "един енных", + "д об", + "до сти", + "ств ен", + "я дер", + "год ня", + "ка за", + "се годня", + "сей час", + "то лько", + "во д", + "ес ь", + "м ного", + "бу ду", + "е в", + "ест ь", + "т ри", + "об щест", + ". .", + "я вл", + "вы сту", + "р ед", + "с чит", + "с ит", + "деле га", + "ло ж", + "это т", + "ф ор", + "к лю", + "воз мож", + "ва ния", + "б ли", + "и ли", + "в з", + "на ций", + "ско го", + "при ня", + "п ла", + "о ч", + "ить ся", + "ст е", + "на ши", + "которы е", + "а р", + "име ет", + "с от", + "зна ч", + "пер ь", + "след у", + "ен ы", + "та ки", + "объ единенных", + "ст ро", + "те перь", + "б ле", + "благо дар", + "раз в", + "а н", + "жи ва", + "оч ень", + "я т", + "бе з", + "об ес", + "г ро", + "ло сь", + "с ы", + "организа ции", + "ч лен", + "то го", + "она ль", + "ж да", + "все х", + "с вя", + "боле е", + "со в", + "ко гда", + "во т", + "к ре", + "к ры", + "по этому", + "во ль", + "о й", + "ген ера", + "ч ем", + "л ы", + "пол ити", + "в ен", + "конферен ции", + "проц ес", + "б я", + "ит е", + "от но", + "разв ити", + "а ф", + "ю щ", + "в но", + "ми р", + "ни и", + "ка я", + "а с", + "итель но", + "в то", + "ени ем", + "генера ль", + "пр от", + "вс ем", + "сам бле", + "ас самбле", + "о м", + "з д", + "с мот", + "ре ги", + "ч его", + "од нако", + "усили я", + "дей стви", + "ч но", + "у ча", + "об раз", + "во с", + "э та", + "пер его", + "гово р", + "ва м", + "мо ло", + "врем я", + "д ь", + "хот ел", + "г ру", + "за явл", + "пре доста", + "по ль", + "не е", + "ре зо", + "перего во", + "резо лю", + "к рет", + "поддер ж", + "обес пе", + "не го", + "представ ит", + "на де", + "к ри", + "ч ь", + "про ек", + "л ет", + "дру ги", + "ا ل", + "َ ا", + "و َ", + "ّ َ", + "ِ ي", + "أ َ", + "ل َ", + "ن َ", + "ال ْ", + "ه ُ", + "ُ و", + "م ا", + "ن ْ", + "م ن", + "ع َ", + "ن ا", + "ل ا", + "م َ", + "ت َ", + "ف َ", + "أ ن", + "ل ي", + "م ِ", + "ا ن", + "ف ي", + "ر َ", + "ي َ", + "ه ِ", + "م ْ", + "ق َ", + "ب ِ", + "ل ى", + "ي ن", + "إ ِ", + "ل ِ", + "و ا", + "ك َ", + "ه ا", + "ً ا", + "م ُ", + "و ن", + "ال م", + "ب َ", + "ي ا", + "ذ ا", + "س ا", + "ال ل", + "م ي", + "ي ْ", + "ر ا", + "ر ي", + "ل ك", + "م َا", + "ن َّ", + "ل م", + "إ ن", + "س ت", + "و م", + "ّ َا", + "ل َا", + "ه م", + "ّ ِ", + "ك ُ", + "ك ان", + "س َ", + "ب ا", + "د ي", + "ح َ", + "ع ْ", + "ب ي", + "ال أ", + "و ل", + "ف ِي", + "ر ِ", + "د ا", + "مِ نْ", + "ُو نَ", + "و ْ", + "ه َا", + "ّ ُ", + "ال س", + "ال َ", + "ن ي", + "ل ْ", + "ت ُ", + "ه ل", + "ر ة", + "د َ", + "س ْ", + "ت ِ", + "ن َا", + "ر ْ", + "الل َّ", + "سا مي", + "ك ن", + "ك ل", + "ه َ", + "عَ لَ", + "ع لى", + "م ع", + "إ لى", + "ق د", + "ال ر", + "ُو ا", + "ي ر", + "ع ن", + "ي ُ", + "ن ِ", + "ب ْ", + "ال ح", + "هُ مْ", + "ق ا", + "ذ ه", + "ال ت", + "ِي نَ", + "ج َ", + "ه ذا", + "ع د", + "ال ع", + "د ْ", + "قَ الَ", + "ر ُ", + "ي م", + "ي ة", + "ن ُ", + "خ َ", + "ر ب", + "ال ك", + "و َا", + "أ نا", + "ة ِ", + "ال ن", + "ح د", + "ع ِ", + "ت ا", + "ه و", + "ف ا", + "ع ا", + "ال ش", + "ل ُ", + "ي ت", + "ذ َا", + "ي ع", + "ال ذ", + "ح ْ", + "ال ص", + "إِ نَّ", + "ج ا", + "ع لي", + "ك َا", + "ب ُ", + "ت ع", + "و ق", + "م ل", + "ل َّ", + "ي د", + "أ خ", + "ر ف", + "ت ي", + "ال ِ", + "ّ ا", + "ذ لك", + "أَ نْ", + "س ِ", + "ت وم", + "م ر", + "مَ نْ", + "ب ل", + "ال ق", + "الل ه", + "ِي َ", + "ك م", + "ذ َ", + "ع ل", + "ح ب", + "س ي", + "ع ُ", + "ال ج", + "ال د", + "ش َ", + "ت ك", + "ف ْ", + "ص َ", + "ل ل", + "د ِ", + "ب ر", + "ف ِ", + "ت ه", + "أ ع", + "ت ْ", + "ق ْ", + "الْ أَ", + "ئ ِ", + "عَ نْ", + "و ر", + "ح ا", + "ال َّ", + "م ت", + "ف ر", + "د ُ", + "ه نا", + "وَ أَ", + "ت ب", + "ة ُ", + "أ ي", + "س ب", + "ري د", + "و ج", + "كُ مْ", + "ح ِ", + "ك ْ", + "د ر", + "َا ء", + "ه ذه", + "ال ط", + "الْ مُ", + "د ة", + "ق ل", + "غ َ", + "ي وم", + "الَّ ذ", + "ك ر", + "ت ر", + "ك ِ", + "ك ي", + "عَلَ ى", + "رَ ب", + "ع ة", + "ق ُ", + "ج ْ", + "ف ض", + "ل ة", + "ه ْ", + "ر َا", + "وَ لَ", + "الْ مَ", + "أَ نَّ", + "ي َا", + "أ ُ", + "ش ي", + "اللَّ هُ", + "لَ ى", + "ق ِ", + "أ ت", + "عَلَ يْ", + "اللَّ هِ", + "ال ب", + "ض َ", + "ة ً", + "ق ي", + "ا ر", + "ب د", + "خ ْ", + "سْ تَ", + "ط َ", + "قَ دْ", + "ذه ب", + "أ م", + "ما ذا", + "وَ إِ", + "ة ٌ", + "و نَ", + "لي لى", + "و لا", + "ح ُ", + "ه ي", + "ص ل", + "ال خ", + "و د", + "لي س", + "ل دي", + "ق ال", + "كَا نَ", + "م َّ", + "ح ي", + "ت م", + "ل ن", + "وَ لَا", + "ب ع", + "يم كن", + "س ُ", + "ة َ", + "ح ت", + "ر ًا", + "ك ا", + "ش ا", + "هِ مْ", + "لَ هُ", + "ز َ", + "دا ً", + "م س", + "ك ث", + "الْ عَ", + "ج ِ", + "ص ْ", + "ف َا", + "ل ه", + "و ي", + "ع َا", + "هُ وَ", + "ب ِي", + "ب َا", + "أ س", + "ث َ", + "ل ِي", + "ر ض", + "الر َّ", + "لِ كَ", + "ت َّ", + "ف ُ", + "ق ة", + "ف عل", + "مِ ن", + "ال آ", + "ث ُ", + "س م", + "م َّا", + "بِ هِ", + "ت ق", + "خ ر", + "ل قد", + "خ ل", + "ش ر", + "أن ت", + "ل َّا", + "س ن", + "الس َّ", + "الذ ي", + "س َا", + "و ما", + "ز ل", + "و ب", + "أ ْ", + "إ ذا", + "ر ِي", + "ح ة", + "ن ِي", + "الْ حَ", + "وَ قَالَ", + "ب ه", + "ة ٍ", + "س أ", + "ر ٌ", + "ب ال", + "م ة", + "ش ْ", + "و ت", + "عن د", + "ف س", + "بَ عْ", + "ه ر", + "ق ط", + "أ ح", + "إن ه", + "و ع", + "ف ت", + "غ ا", + "هنا ك", + "ب ت", + "مِ نَ", + "س ر", + "ذَ لِكَ", + "ر س", + "حد ث", + "غ ْ", + "ّ ِي", + "ال إ", + "وَ يَ", + "ج ل", + "ا ست", + "ق ِي", + "ع ب", + "و س", + "ي ش", + "الَّذ ِينَ", + "تا ب", + "د ِي", + "ج ب", + "ك ون", + "ب ن", + "ال ث", + "لَ يْ", + "ب عد", + "وَ الْ", + "فَ أَ", + "ع م", + "هُ م", + "ت ن", + "ذ ْ", + "أ ص", + "أ ين", + "رَب ِّ", + "الذ ين", + "إِ ن", + "ب ين", + "ج ُ", + "عَلَيْ هِ", + "ح َا", + "ل و", + "ست ط", + "ظ ر", + "لَ مْ", + "ء ِ", + "كُ ل", + "ط ل", + "ت َا", + "ض ُ", + "كن ت", + "ل ًا", + "م ٌ", + "ق بل", + "ـ ـ", + "ذ ِ", + "قَ وْ", + "ص ِ", + "م ًا", + "كان ت", + "ص ا", + "ي ق", + "ال ف", + "ال نا", + "م ٍ", + "إِ نْ", + "ال نَّ", + "ج د", + "وَ مَا", + "ت ت", + "ب ح", + "م كان", + "كي ف", + "ّ ة", + "ال ا", + "ج َا", + "أ و", + "سا عد", + "ض ِ", + "إ لا", + "را ً", + "ق َا", + "ر أ", + "ع ت", + "أ حد", + "ه د", + "ض ا", + "ط ر", + "أ ق", + "ما ء", + "د َّ", + "ال با", + "م ُو", + "أَ وْ", + "ط ا", + "ق ُو", + "خ ِ", + "ت ل", + "ستط يع", + "د َا", + "الن َّا", + "إ لَى", + "وَ تَ", + "هَ ذَا", + "ب ة", + "علي ك", + "ج ر", + "ال من", + "ز ا", + "ر ٍ", + "د ع", + "ّ ًا", + "س ة", + "ثُ مَّ", + "شي ء", + "ال غ", + "ت ح", + "ر ُونَ", + "ال يوم", + "م ِي", + "ن ُوا", + "أ ر", + "تُ مْ", + "ع ر", + "ي ف", + "أ ب", + "د ًا", + "ص َا", + "الت َّ", + "أ ريد", + "ال ز", + "يَ وْ", + "إ لي", + "ج ي", + "يَ عْ", + "فض ل", + "ال إن", + "أن ه", + "n g", + "i 4", + "a n", + "s h", + "z h", + "i 2", + "ng 1", + "u 4", + "i 1", + "ng 2", + "d e", + "j i", + "a o", + "x i", + "u 3", + "de 5", + "e 4", + "i 3", + "ng 4", + "an 4", + "e n", + "u o", + "sh i4", + "an 2", + "u 2", + "c h", + "u 1", + "ng 3", + "a 1", + "an 1", + "e 2", + "a 4", + "e i4", + "o ng1", + "a i4", + "ao 4", + "h u", + "a ng1", + "l i", + "y o", + "an 3", + "w ei4", + "uo 2", + "n 1", + "en 2", + "ao 3", + "e 1", + "y u", + "q i", + "e ng2", + "zh o", + "a ng3", + "a ng4", + "a ng2", + "uo 4", + "m i", + "g e4", + "y i1", + "g uo2", + "e r", + "b i", + "a 3", + "h e2", + "e 3", + "y i2", + "d i4", + "zh ong1", + "b u4", + "g u", + "a i2", + "n 2", + "z ai4", + "sh i2", + "e ng1", + "r en2", + "o ng2", + "xi an4", + "y i", + "x u", + "n 4", + "l i4", + "en 4", + "y u2", + "e i2", + "yi2 ge4", + "o u4", + "e i3", + "d i", + "u i4", + "a 2", + "yo u3", + "ao 1", + "d a4", + "ch eng2", + "en 1", + "e ng4", + "y i4", + "s i1", + "zh i4", + "ji a1", + "yu an2", + "n i", + "t a1", + "de5 yi2ge4", + "k e1", + "sh u3", + "x i1", + "j i2", + "ao 2", + "t i", + "o u3", + "o ng4", + "xi a4", + "a i1", + "g ong1", + "zh i1", + "en 3", + "w ei2", + "j u", + "xu e2", + "q u1", + "zho u1", + "er 3", + "mi ng2", + "zho ng3", + "l i3", + "w u4", + "y i3", + "uo 1", + "e 5", + "j i4", + "xi ng2", + "ji an4", + "hu a4", + "y u3", + "uo 3", + "j i1", + "a i3", + "z uo4", + "h ou4", + "hu i4", + "e i1", + "ni an2", + "q i2", + "p i", + "d ao4", + "sh eng1", + "de 2", + "d ai4", + "u an2", + "zh e4", + "zh eng4", + "b en3", + "sh ang4", + "zh u3", + "b ei4", + "y e4", + "ch u1", + "zh an4", + "l e5", + "l ai2", + "sh i3", + "n an2", + "r en4", + "yo u2", + "k e4", + "b a1", + "f u4", + "d ui4", + "y a4", + "m ei3", + "z i4", + "xi n1", + "ji ng1", + "zh u", + "n 3", + "yo ng4", + "m u4", + "ji ao4", + "y e3", + "ji n4", + "bi an4", + "l u4", + "q i1", + "sh e4", + "xi ang1", + "o ng3", + "sh u4", + "d ong4", + "s uo3", + "gu an1", + "s an1", + "b o", + "t e4", + "d uo1", + "f u2", + "mi n2", + "l a1", + "zh i2", + "zh en4", + "o u1", + "w u3", + "m a3", + "i 5", + "z i5", + "j u4", + "er 4", + "y ao4", + "xia4 de5yi2ge4", + "s i4", + "t u2", + "sh an1", + "z ui4", + "ch u", + "yi n1", + "er 2", + "t ong2", + "d ong1", + "y u4", + "y an2", + "qi an2", + "shu3 xia4de5yi2ge4", + "ju n1", + "k e3", + "w en2", + "f a3", + "l uo2", + "zh u4", + "x i4", + "k ou3", + "b ei3", + "ji an1", + "f a1", + "di an4", + "ji ang1", + "wei4 yu2", + "xi ang4", + "zh i3", + "e ng3", + "f ang1", + "l an2", + "sh u", + "r i4", + "li an2", + "sh ou3", + "m o", + "qi u2", + "ji n1", + "h uo4", + "shu3xia4de5yi2ge4 zhong3", + "f en1", + "n ei4", + "g ai1", + "mei3 guo2", + "u n2", + "g e2", + "b ao3", + "qi ng1", + "g ao1", + "t ai2", + "d u", + "xi ao3", + "ji e2", + "ti an1", + "ch ang2", + "q uan2", + "li e4", + "h ai3", + "f ei1", + "t i3", + "ju e2", + "o u2", + "c i3", + "z u2", + "n i2", + "bi ao3", + "zhong1 guo2", + "d u4", + "yu e4", + "xi ng4", + "sh eng4", + "ch e1", + "d an1", + "ji e1", + "li n2", + "pi ng2", + "f u3", + "g u3", + "ji e4", + "w o", + "v 3", + "sh eng3", + "n a4", + "yu an4", + "zh ang3", + "gu an3", + "d ao3", + "z u3", + "di ng4", + "di an3", + "c eng2", + "ren2 kou3", + "t ai4", + "t ong1", + "g uo4", + "n eng2", + "ch ang3", + "hu a2", + "li u2", + "yi ng1", + "xi ao4", + "c i4", + "bian4 hua4", + "li ang3", + "g ong4", + "zho ng4", + "de5 yi1", + "s e4", + "k ai1", + "w ang2", + "ji u4", + "sh i1", + "sh ou4", + "m ei2", + "k u", + "s u", + "f eng1", + "z e2", + "tu2 shi4", + "t i2", + "q i4", + "ji u3", + "sh en1", + "zh e3", + "ren2kou3 bian4hua4", + "ren2kou3bian4hua4 tu2shi4", + "di4 qu1", + "y ang2", + "m en", + "men 5", + "l ong2", + "bi ng4", + "ch an3", + "zh u1", + "w ei3", + "w ai4", + "xi ng1", + "bo 1", + "b i3", + "t ang2", + "hu a1", + "bo 2", + "shu i3", + "sh u1", + "d ou1", + "s ai4", + "ch ao2", + "b i4", + "li ng2", + "l ei4", + "da4 xue2", + "f en4", + "shu3 de5", + "m u3", + "ji ao1", + "d ang1", + "ch eng1", + "t ong3", + "n v3", + "q i3", + "y an3", + "mi an4", + "l uo4", + "ji ng4", + "g e1", + "r u4", + "d an4", + "ri4 ben3", + "p u3", + "yu n4", + "hu ang2", + "wo 3", + "l v", + "h ai2", + "shi4 yi1", + "xi e1", + "yi ng3", + "w u2", + "sh en2", + "w ang3", + "gu ang3", + "li u4", + "s u4", + "shi4 zhen4", + "c an1", + "c ao3", + "xi a2", + "k a3", + "d a2", + "h u4", + "b an4", + "d ang3", + "h u2", + "z ong3", + "de ng3", + "de5yi2ge4 shi4zhen4", + "ch uan2", + "mo 4", + "zh ang1", + "b an1", + "mo 2", + "ch a2", + "c e4", + "zhu3 yao4", + "t ou2", + "j u2", + "shi4 wei4yu2", + "s a4", + "u n1", + "ke3 yi3", + "d u1", + "h an4", + "li ang4", + "sh a1", + "ji a3", + "z i1", + "lv 4", + "f u1", + "xi an1", + "x u4", + "gu ang1", + "m eng2", + "b ao4", + "yo u4", + "r ong2", + "zhi1 yi1", + "w ei1", + "m ao2", + "guo2 jia1", + "c ong2", + "g ou4", + "ti e3", + "zh en1", + "d u2", + "bi an1", + "c i2", + "q u3", + "f an4", + "xi ang3", + "m en2", + "j u1", + "h ong2", + "z i3", + "ta1 men5", + "ji 3", + "z ong1", + "zhou1 de5yi2ge4shi4zhen4", + "t uan2", + "ji ng3", + "gong1 si1", + "xi e4", + "l i2", + "li4 shi3", + "b ao1", + "g ang3", + "gu i1", + "zh eng1", + "zhi2 wu4", + "ta1 de5", + "pi n3", + "zhu an1", + "ch ong2", + "shi3 yong4", + "w a3", + "sh uo1", + "chu an1", + "l ei2", + "w an1", + "h uo2", + "q u", + "s u1", + "z ao3", + "g ai3", + "q u4", + "g u4", + "l u", + "x i2", + "h ang2", + "yi ng4", + "c un1", + "g en1", + "yi ng2", + "ti ng2", + "cheng2 shi4", + "ji ang3", + "li ng3", + "l un2", + "bu4 fen4", + "de ng1", + "xu an3", + "dong4 wu4", + "de2 guo2", + "xi an3", + "f an3", + "zh e5", + "h an2", + "h ao4", + "m i4", + "r an2", + "qi n1", + "ti ao2", + "zh an3", + "h i", + "k a", + "n o", + "t e", + "s u", + "s hi", + "t a", + "t o", + "n a", + "w a", + "o u", + "r u", + "n i", + "k u", + "k i", + "g a", + "d e", + "k o", + "m a", + "r e", + "r a", + "m o", + "t su", + "w o", + "e n", + "r i", + "s a", + "d a", + "s e", + "j i", + "h a", + "c hi", + "k e", + "te ki", + "m i", + "y ou", + "s h", + "s o", + "y o", + "y a", + "na i", + "t te", + "a ru", + "b a", + "u u", + "t ta", + "ka i", + "ka n", + "shi te", + "m e", + "d o", + "mo no", + "se i", + "r o", + "ko to", + "ka ra", + "shi ta", + "b u", + "m u", + "c h", + "su ru", + "k ou", + "g o", + "ma su", + "ta i", + "f u", + "k en", + "i u", + "g en", + "wa re", + "shi n", + "z u", + "a i", + "o n", + "o ku", + "g i", + "d ou", + "n e", + "y uu", + "i ru", + "i te", + "ji ko", + "de su", + "j u", + "ra re", + "sh u", + "b e", + "sh ou", + "s ha", + "se kai", + "s ou", + "k you", + "ma shita", + "s en", + "na ra", + "sa n", + "ke i", + "i ta", + "a ri", + "i tsu", + "ko no", + "j ou", + "na ka", + "ch ou", + "so re", + "g u", + "na ru", + "ga ku", + "re ba", + "g e", + "h o", + "i n", + "hi to", + "sa i", + "na n", + "da i", + "tsu ku", + "shi ki", + "sa re", + "na ku", + "p p", + "bu n", + "ju n", + "so no", + "ka ku", + "z ai", + "b i", + "to u", + "wa ta", + "sh uu", + "i i", + "te i", + "ka re", + "y u", + "shi i", + "ma de", + "sh o", + "a n", + "ke reba", + "shi ka", + "i chi", + "ha n", + "de ki", + "ni n", + "ware ware", + "na kereba", + "o ite", + "h ou", + "ya ku", + "ra i", + "mu jun", + "l e", + "yo ku", + "bu tsu", + "o o", + "ko n", + "o mo", + "ga e", + "nara nai", + "ta chi", + "z en", + "ch uu", + "kan gae", + "ta ra", + "to ki", + "ko ro", + "mujun teki", + "z e", + "na ga", + "ji n", + "shi ma", + "te n", + "i ki", + "i ku", + "no u", + "i masu", + "r ou", + "h on", + "ka e", + "t to", + "ko re", + "ta n", + "ki ta", + "i s", + "da tta", + "ji tsu", + "ma e", + "i e", + "me i", + "da n", + "h e", + "to ku", + "dou itsu", + "ri tsu", + "k yuu", + "h you", + "rare ta", + "kei sei", + "k kan", + "rare ru", + "m ou", + "do ko", + "r you", + "da ke", + "naka tta", + "so ko", + "ta be", + "e r", + "ha na", + "c o", + "fu ku", + "p a", + "so n", + "ya su", + "ch o", + "wata ku", + "ya ma", + "z a", + "k yo", + "gen zai", + "b oku", + "a ta", + "j a", + "ka wa", + "ma sen", + "j uu", + "ro n", + "b o", + "na tte", + "wataku shi", + "yo tte", + "ma i", + "g ou", + "ha i", + "mo n", + "ba n", + "ji shin", + "c a", + "re te", + "n en", + "o ka", + "ka gaku", + "na tta", + "p o", + "ka ru", + "na ri", + "m en", + "ma ta", + "e i", + "ku ru", + "ga i", + "ka ri", + "sha kai", + "kou i", + "yo ri", + "se tsu", + "j o", + "re ru", + "to koro", + "ju tsu", + "i on", + "sa ku", + "tta i", + "c ha", + "nin gen", + "n u", + "c e", + "ta me", + "kan kyou", + "de n", + "o oku", + "i ma", + "wata shi", + "tsuku ru", + "su gi", + "b en", + "ji bun", + "shi tsu", + "ke ru", + "ki n", + "ki shi", + "shika shi", + "mo to", + "ma ri", + "i tte", + "de shita", + "n de", + "ari masu", + "te r", + "z ou", + "ko e", + "ze ttai", + "kkan teki", + "h en", + "re kishi", + "deki ru", + "tsu ka", + "l a", + "i tta", + "o i", + "ko butsu", + "mi ru", + "sh oku", + "shi masu", + "gi jutsu", + "g you", + "jou shiki", + "a tta", + "ho do", + "ko ko", + "tsuku rareta", + "z oku", + "hi tei", + "ko ku", + "rekishi teki", + "ke te", + "o ri", + "i mi", + "ka ko", + "naga ra", + "ka karu", + "shu tai", + "ha ji", + "ma n", + "ta ku", + "ra n", + "douitsu teki", + "z o", + "me te", + "re i", + "tsu u", + "sare te", + "gen jitsu", + "p e", + "s t", + "ba i", + "na wa", + "ji kan", + "wa ru", + "r t", + "a tsu", + "so ku", + "koui teki", + "a ra", + "u ma", + "a no", + "i de", + "ka ta", + "te tsu", + "ga wa", + "ke do", + "re ta", + "mi n", + "sa you", + "tte ru", + "to ri", + "p u", + "ki mi", + "b ou", + "mu ra", + "sare ru", + "ma chi", + "k ya", + "o sa", + "kon na", + "a ku", + "a l", + "sare ta", + "i pp", + "shi ku", + "u chi", + "hito tsu", + "ha tara", + "tachi ba", + "shi ro", + "ka tachi", + "to mo", + "e te", + "me ru", + "ni chi", + "da re", + "ka tta", + "e ru", + "su ki", + "a ge", + "oo ki", + "ma ru", + "mo ku", + "o ko", + "kangae rareru", + "o to", + "tan ni", + "ta da", + "tai teki", + "mo tte", + "ki nou", + "shi nai", + "k ki", + "u e", + "ta ri", + "l i", + "ra nai", + "k kou", + "mi rai", + "pp on", + "go to", + "hi n", + "hi tsu", + "te ru", + "mo chi", + "ka tsu", + "re n", + "n yuu", + "su i", + "zu ka", + "tsu ite", + "no mi", + "su gu", + "ku da", + "tetsu gaku", + "i ka", + "ron ri", + "o ki", + "ni ppon", + "p er", + "shi mashita", + "chi shiki", + "cho kkanteki", + "su ko", + "t ion", + "ku u", + "a na", + "a rou", + "ka tte", + "ku ri", + "i nai", + "hyou gen", + "i shiki", + "do ku", + "a tte", + "a tara", + "to n", + "wa ri", + "ka o", + "sei san", + "hana shi", + "s i", + "ka ke", + "na ji", + "su nawa", + "sunawa chi", + "u go", + "su u", + "ba ra", + "le v", + "hi ro", + "i wa", + "be tsu", + "yo i", + "se ru", + "shite ru", + "rare te", + "to shi", + "se ki", + "tai ritsu", + "wa kara", + "to kyo", + "k ka", + "k yoku", + "u n", + "i ro", + "mi te", + "sa ki", + "kan ji", + "mi ta", + "su be", + "r yoku", + "ma tta", + "kuda sai", + "omo i", + "ta no", + "ware ru", + "co m", + "hitsu you", + "ka shi", + "re nai", + "kan kei", + "a to", + "ga tte", + "o chi", + "mo tsu", + "in g", + "son zai", + "l l", + "o re", + "tai shite", + "a me", + "sei mei", + "ka no", + "gi ri", + "kangae ru", + "yu e", + "a sa", + "o naji", + "yo ru", + "ni ku", + "osa ka", + "suko shi", + "c k", + "ta ma", + "kano jo", + "ki te", + "mon dai", + "a mari", + "e ki", + "ko jin", + "ha ya", + "i t", + "de te", + "atara shii", + "a wa", + "ga kkou", + "tsu zu", + "shu kan", + "i mashita", + "mi na", + "ata e", + "da rou", + "hatara ku", + "ga ta", + "da chi", + "ma tsu", + "ari masen", + "sei butsu", + "mi tsu", + "he ya", + "yasu i", + "d i", + "de ni", + "no ko", + "ha ha", + "do mo", + "ka mi", + "su deni", + "na o", + "ra ku", + "i ke", + "a ki", + "me ta", + "l o", + "ko domo", + "so shite", + "ga me", + "ba kari", + "to te", + "ha tsu", + "mi se", + "moku teki", + "da kara", + "s z", + "e l", + "g y", + "e n", + "t t", + "e m", + "a n", + "a k", + "e r", + "a z", + "a l", + "e t", + "o l", + "e g", + "e k", + "m i", + "o n", + "é s", + "c s", + "a t", + "á r", + "h o", + "e z", + "á l", + "i s", + "á n", + "o r", + "a r", + "e gy", + "e s", + "é r", + "á t", + "o tt", + "e tt", + "m eg", + "t a", + "o k", + "o s", + "ho gy", + "n em", + "é g", + "n y", + "k i", + "é l", + "h a", + "á s", + "ü l", + "i n", + "mi n", + "n a", + "e d", + "o m", + "i k", + "k ö", + "m a", + "n i", + "v a", + "v ol", + "é t", + "b b", + "f el", + "i g", + "l e", + "r a", + "é n", + "t e", + "d e", + "a d", + "ó l", + "b e", + "on d", + "j a", + "r e", + "u l", + "b en", + "n ek", + "u t", + "vol t", + "b an", + "ö r", + "o g", + "a p", + "o d", + "á g", + "n k", + "é k", + "v al", + "k or", + "a m", + "i l", + "í t", + "á k", + "b a", + "u d", + "sz er", + "min d", + "o z", + "é p", + "el l", + "ér t", + "m ond", + "i t", + "sz t", + "n ak", + "a mi", + "n e", + "ő l", + "cs ak", + "n é", + "ma g", + "ol y", + "m er", + "ál l", + "án y", + "ö n", + "ö l", + "min t", + "m ár", + "ö tt", + "na gy", + "é sz", + "az t", + "el ő", + "t ud", + "o t", + "é ny", + "á z", + "m ég", + "kö z", + "el y", + "s ég", + "en t", + "s em", + "ta m", + "h et", + "h al", + "f i", + "a s", + "v an", + "ho z", + "v e", + "u k", + "k ez", + "á m", + "v el", + "b er", + "a j", + "u nk", + "i z", + "va gy", + "m os", + "sz em", + "em ber", + "f og", + "mer t", + "ü k", + "l en", + "ö s", + "e j", + "t al", + "h at", + "t ak", + "h i", + "m ás", + "s ág", + "ett e", + "l eg", + "ü nk", + "h át", + "sz a", + "on y", + "ez t", + "mind en", + "en d", + "ül t", + "h an", + "j ó", + "k is", + "á j", + "in t", + "ú gy", + "i d", + "mos t", + "ar t", + "í r", + "k er", + "i tt", + "a tt", + "el t", + "mond ta", + "k ell", + "l á", + "ak i", + "ál t", + "ér d", + "t ö", + "l an", + "v ár", + "h ol", + "t el", + "l át", + "ő k", + "v et", + "s e", + "ut án", + "k ét", + "na p", + "í v", + "ál y", + "v ég", + "ö k", + "i r", + "d ul", + "v is", + "né z", + "t er", + "á ban", + "k ül", + "ak kor", + "k ap", + "sz él", + "y en", + "ú j", + "i m", + "oly an", + "es en", + "k ed", + "h ely", + "t ör", + "b ól", + "el m", + "r á", + "ár a", + "r ó", + "l ó", + "vol na", + "t an", + "le het", + "e bb", + "t en", + "t ek", + "s ok", + "k al", + "f or", + "u g", + "ol t", + "k a", + "ek et", + "b or", + "f ej", + "g ond", + "a g", + "ak ar", + "f él", + "ú l", + "b el", + "ott a", + "mi t", + "val ami", + "j el", + "é d", + "ar c", + "u r", + "hal l", + "t i", + "f öl", + "á ba", + "ol g", + "ki r", + "ol d", + "m ar", + "k érd", + "j ár", + "ú r", + "sz e", + "z s", + "él et", + "j át", + "o v", + "u s", + "é z", + "v il", + "v er", + "ő r", + "á d", + "ö g", + "le sz", + "on t", + "b iz", + "k oz", + "á bb", + "kir ály", + "es t", + "a b", + "en g", + "ig az", + "b ar", + "ha j", + "d i", + "o b", + "k od", + "r ól", + "v ez", + "tö bb", + "sz ó", + "é ben", + "ö t", + "ny i", + "t á", + "sz ól", + "gond ol", + "eg ész", + "í gy", + "ő s", + "o bb", + "os an", + "b ől", + "a bb", + "c i", + "ő t", + "n ál", + "k ép", + "azt án", + "v i", + "t art", + "be szél", + "m en", + "elő tt", + "a szt", + "ma j", + "kö r", + "han g", + "í z", + "in cs", + "a i", + "é v", + "ó d", + "ó k", + "hoz z", + "t em", + "ok at", + "an y", + "nagy on", + "h áz", + "p er", + "p ed", + "ez te", + "et len", + "nek i", + "maj d", + "sz ony", + "án ak", + "fel é", + "egy szer", + "j e", + "ad t", + "gy er", + "ami kor", + "f oly", + "sz ak", + "ő d", + "h ú", + "á sz", + "am ely", + "h ar", + "ér e", + "il yen", + "od a", + "j ák", + "t ár", + "á val", + "l ak", + "t ó", + "m ent", + "gy an", + "él y", + "ú t", + "v ar", + "kez d", + "m ell", + "mi kor", + "h ez", + "val ó", + "k o", + "m es", + "szer et", + "r end", + "l et", + "vis sza", + "ig en", + "f ő", + "va s", + "as szony", + "r ől", + "ped ig", + "p i", + "sz ép", + "t ák", + "ö v", + "an i", + "vil ág", + "p en", + "mag a", + "t et", + "sz ik", + "é j", + "én t", + "j ött", + "s an", + "sz í", + "i de", + "g at", + "ett em", + "ul t", + "h ány", + "ás t", + "a hol", + "ők et", + "h ár", + "k el", + "n ő", + "cs i", + "tal ál", + "el te", + "lá tt", + "tör t", + "ha gy", + "e sz", + "s en", + "n él", + "p ar", + "v ál", + "k ut", + "l ány", + "ami t", + "s ő", + "ell en", + "mag át", + "in k", + "u gyan", + "kül ön", + "a sz", + "mind ig", + "l ép", + "tal án", + "u n", + "sz or", + "k e", + "il lan", + "n incs", + "z et", + "vagy ok", + "tel en", + "is mer", + "s or", + "is ten", + "ít ott", + "j obb", + "v es", + "dul t", + "j uk", + "sz en", + "r o", + "ö m", + "l ett", + "k ar", + "egy ik", + "b ár", + "sz i", + "sz ív", + "az on", + "e szt", + "föl d", + "kut y", + "p illan", + "f ér", + "k om", + "t ől", + "t ű", + "é be", + "t ött", + "bar át", + "í g", + "a hogy", + "e h", + "e p", + "s o", + "v en", + "jel ent", + "t at", + "sz eg", + "mint ha", + "f al", + "egy en", + "mi l", + "sza b", + "r i", + "é m", + "biz ony", + "j on", + "ör eg", + "d olg", + "cs ap", + "ti szt", + "áll t", + "an cs", + "id ő", + "k at", + "ü gy", + "mi ért", + "ó t", + "ü r", + "cs in", + "h az", + "b et", + "én ek", + "v ér", + "j ól", + "al att", + "m ely", + "l o", + "sem mi", + "ny ug", + "v ág", + "kö vet", + "ös sze", + "ma d", + "l i", + "a cs", + "fi ú", + "kö n", + "más ik", + "j ön", + "sz ám", + "g er", + "s ó", + "r ész", + "k ér", + "z el", + "é vel", + "e o", + "e u", + "a n", + "eu l", + "eu n", + "eo n", + "a e", + "d a", + "a l", + "s s", + "i n", + "i l", + "a g", + "an g", + "y eon", + "y eo", + "d o", + "c h", + "n g", + "j i", + "h an", + "g a", + "g o", + "u i", + "h ae", + "a m", + "u l", + "u n", + "g eo", + "s i", + "n eun", + "ss da", + "s eo", + "eon g", + "y o", + "i da", + "t t", + "k k", + "j eo", + "d eul", + "w a", + "eu m", + "g e", + "o n", + "o g", + "s al", + "m an", + "yeon g", + "geo s", + "h ag", + "an eun", + "j a", + "g i", + "s u", + "i ss", + "o l", + "d ae", + "eo b", + "h a", + "j u", + "eo l", + "g eu", + "j eong", + "s ae", + "do e", + "g eul", + "s eu", + "s in", + "eul o", + "b n", + "s ang", + "bn ida", + "h al", + "b o", + "han eun", + "m al", + "i m", + "m o", + "b u", + "jeo g", + "sae ng", + "in eun", + "an h", + "m a", + "sal am", + "j o", + "s a", + "eo m", + "n ae", + "w i", + "l o", + "g wa", + "yeo l", + "n a", + "e seo", + "y e", + "m yeon", + "tt ae", + "h w", + "j e", + "eob s", + "j ang", + "g u", + "g w", + "il eul", + "yeo g", + "j eon", + "si g", + "j ag", + "j in", + "y u", + "o e", + "s e", + "hag o", + "d eun", + "y a", + "m un", + "s eong", + "g ag", + "h am", + "d ang", + "b a", + "l eul", + "s il", + "do ng", + "kk a", + "b al", + "da l", + "han da", + "eo ssda", + "ae g", + "l i", + "ha ji", + "s eon", + "o ng", + "hae ssda", + "d e", + "i ssda", + "e ge", + "b un", + "m ul", + "ju ng", + "ji g", + "m u", + "iss neun", + "b i", + "g eun", + "seu bnida", + "w on", + "p p", + "d aneun", + "eo h", + "d eo", + "ga m", + "j al", + "hae ng", + "ag o", + "y ang", + "b ul", + "b ang", + "u m", + "s o", + "h i", + "j ae", + "si m", + "saeng gag", + "hag e", + "s og", + "eo ss", + "d an", + "ja sin", + "j il", + "eo g", + "g yeong", + "doe n", + "go ng", + "m i", + "ch i", + "d eu", + "d eon", + "hae ss", + "d u", + "n am", + "eun g", + "jo h", + "n al", + "m yeong", + "w o", + "eon a", + "i go", + "g yeol", + "y ag", + "gw an", + "ul i", + "yo ng", + "n o", + "l yeo", + "j og", + "eoh ge", + "ga t", + "b og", + "mo s", + "t ong", + "ch a", + "man h", + "jeo l", + "geo l", + "h oe", + "ag a", + "n aneun", + "g an", + "un eun", + "ch eol", + "ch e", + "do l", + "b on", + "b an", + "ba d", + "ch u", + "ham yeon", + "yeo ssda", + "i bnida", + "g ye", + "eo s", + "hw al", + "salam deul", + "ji man", + "dang sin", + "ji b", + "ttae mun", + "m ae", + "i b", + "e neun", + "eu g", + "jeo m", + "geul eon", + "h wa", + "a ssda", + "b eob", + "bu t", + "b ae", + "yeo ss", + "ch in", + "ch aeg", + "g eon", + "g ae", + "nae ga", + "i ga", + "m og", + "sig an", + "g il", + "h yeon", + "l yeog", + "gu g", + "p yeon", + "s an", + "w ae", + "j ul", + "s eul", + "deun g", + "haji man", + "eum yeon", + "p il", + "m ol", + "n eu", + "a ss", + "n yeon", + "t ae", + "h u", + "p yo", + "s ul", + "g ang", + "j ineun", + "b eon", + "ha da", + "seo l", + "si p", + "dal eun", + "a p", + "sal m", + "g yo", + "ch eon", + "hag i", + "in a", + "cheol eom", + "g al", + "il a", + "kka ji", + "anh neun", + "ha bnida", + "tt eon", + "n u", + "hae seo", + "doen da", + "s ol", + "tt al", + "l a", + "il o", + "seu b", + "b yeon", + "m yeo", + "b eol", + "s on", + "n un", + "j un", + "j am", + "j eung", + "tt o", + "e n", + "mo m", + "h o", + "ch im", + "hw ang", + "eun eun", + "jo ng", + "bo da", + "n ol", + "n eom", + "but eo", + "jig eum", + "eobs da", + "dae lo", + "i g", + "y ul", + "p yeong", + "seon eun", + "sal ang", + "seu t", + "h im", + "n an", + "h eom", + "h yang", + "p i", + "gw ang", + "eobs neun", + "hw ag", + "ge ss", + "jag i", + "il eon", + "wi hae", + "dae han", + "ga ji", + "m eog", + "j yeo", + "cha j", + "b yeong", + "eo d", + "g yeo", + "do n", + "eo ji", + "g ul", + "mo deun", + "j on", + "in saeng", + "geul ae", + "h ang", + "sa sil", + "si b", + "ch al", + "il ago", + "doe l", + "g eum", + "doe neun", + "b ol", + "ga jang", + "geul igo", + "e l", + "h yeong", + "haeng bog", + "ch ul", + "h on", + "ch ae", + "s am", + "m ang", + "in da", + "da m", + "w ol", + "ch oe", + "d ul", + "si jag", + "ch eong", + "il aneun", + "ul ineun", + "ae n", + "kk e", + "mun je", + "a do", + "t eu", + "g un", + "geun eun", + "b ge", + "ch eo", + "b aeg", + "ju g", + "t a", + "sang dae", + "geu geos", + "do g", + "eu s", + "deu s", + "ja b", + "h yeo", + "tt eohge", + "u g", + "ma j", + "ch il", + "s wi", + "j ileul", + "ch ang", + "g aneun", + "m ag", + "i ji", + "da go", + "m in", + "yo han", + "t eug", + "pp un", + "al eul", + "haeng dong", + "p o", + "m il", + "ch am", + "se sang", + "e do", + "p an", + "man deul", + "am yeon", + "a b", + "kk ae", + "b ag", + "i deul", + "p um", + "m eol", + "s un", + "n eul", + "ham kke", + "chu ng", + "da b", + "yu g", + "s ag", + "gwang ye", + "il eohge", + "bal o", + "neun de", + "ham yeo", + "go s", + "geul eoh", + "an ila", + "bang beob", + "da si", + "b yeol", + "g yeon", + "gam jeong", + "on eul", + "j aneun", + "yeo m", + "l ago", + "i gi", + "hw an", + "t eul", + "eo seo", + "si k", + "ch o", + "jag a", + "geul eom", + "geul eona", + "jeong do", + "g yeog", + "geul eohge", + "geu deul", + "eu t", + "im yeon", + "j jae", + "k eun", + "i sang", + "mal haessda", + "eu ge", + "no p", + "in gan", + "bo myeon", + "t aeg", + "seu s", + "d wi", + "s aneun", + "w an", + "anh go", + "t an", + "nu gu", + "su ng", + "da myeon", + "a deul", + "p eul", + "ttal a", + "d i", + "geos do", + "a ji", + "m eon", + "eum yeo", + "dol og", + "neun g", + "mo du", + "क े", + "ह ै", + "े ं", + "् र", + "ा र", + "न े", + "य ा", + "म ें", + "स े", + "क ी", + "क ा", + "ो ं", + "त ा", + "क र", + "स ्", + "क ि", + "क ो", + "र ्", + "न ा", + "क ्", + "ह ी", + "औ र", + "प र", + "त े", + "ह ो", + "प ्र", + "ा न", + "् य", + "ल ा", + "व ा", + "ल े", + "स ा", + "है ं", + "ल ि", + "ज ा", + "ह ा", + "भ ी", + "व ि", + "इ स", + "त ी", + "न ्", + "र ा", + "म ा", + "द े", + "द ि", + "ब ा", + "त ि", + "थ ा", + "न ि", + "क ार", + "ए क", + "ही ं", + "ह ु", + "ं ग", + "ै ं", + "न ी", + "स ी", + "अ प", + "त ्", + "न हीं", + "र ी", + "म े", + "म ु", + "ि त", + "त ो", + "प ा", + "ल ी", + "लि ए", + "ग ा", + "ल ्", + "र ह", + "र े", + "क् ष", + "म ैं", + "स म", + "उ स", + "ज ि", + "त ्र", + "म ि", + "च ा", + "ो ग", + "स ं", + "द ्", + "स ि", + "आ प", + "त ु", + "द ा", + "क ु", + "य ों", + "व े", + "ज ी", + "् या", + "उ न", + "ि क", + "य े", + "भ ा", + "् ट", + "ह म", + "स् ट", + "श ा", + "ड ़", + "ं द", + "ख ा", + "म ्", + "श ्", + "य ह", + "स क", + "प ू", + "कि या", + "अप ने", + "र ू", + "स ु", + "म ी", + "ह ि", + "ज ो", + "थ े", + "र ि", + "द ी", + "थ ी", + "ग ी", + "ल ोग", + "ग या", + "त र", + "न् ह", + "च ्", + "व ार", + "ब ी", + "प ्", + "द ो", + "ट ी", + "श ि", + "कर ने", + "ग े", + "ै से", + "इ न", + "ं ड", + "सा थ", + "प ु", + "ब े", + "ब ार", + "व ी", + "अ न", + "ह र", + "उ न्ह", + "हो ता", + "ज ब", + "कु छ", + "म ान", + "क ्र", + "ब ि", + "प ह", + "फ ि", + "स र", + "ार ी", + "र ो", + "द ू", + "क हा", + "त क", + "श न", + "ब ्", + "स् थ", + "व ह", + "बा द", + "ओ ं", + "ग ु", + "ज ्", + "्र े", + "ग र", + "रह े", + "व र्", + "ह ू", + "ार ्", + "प ी", + "ब हु", + "मु झ", + "्र ा", + "दि या", + "स ब", + "कर ते", + "अप नी", + "बहु त", + "क ह", + "ट े", + "हु ए", + "कि सी", + "र हा", + "ष ्ट", + "ज ़", + "ब ना", + "स ो", + "ड ि", + "को ई", + "व ्य", + "बा त", + "र ु", + "व ो", + "मुझ े", + "द् ध", + "च ार", + "मे रे", + "व र", + "्र ी", + "जा ता", + "न ों", + "प्र ा", + "दे ख", + "ट ा", + "क् या", + "अ ध", + "ल ग", + "ल ो", + "प ि", + "य ु", + "च े", + "जि स", + "ं त", + "ान ी", + "प ै", + "ज न", + "ार े", + "च ी", + "मि ल", + "द ु", + "दे श", + "च् छ", + "ष ्", + "स ू", + "ख े", + "च ु", + "ि या", + "ल गा", + "ब ु", + "उन के", + "ज् ञ", + "क्ष ा", + "त रह", + "्या दा", + "वा ले", + "पू र्", + "मैं ने", + "का म", + "रू प", + "हो ती", + "उ प", + "ज ान", + "प्र कार", + "भ ार", + "म न", + "हु आ", + "ट र", + "हू ँ", + "पर ि", + "पा स", + "अन ु", + "रा ज", + "लोग ों", + "अ ब", + "सम झ", + "ड ी", + "म ौ", + "श ु", + "च ि", + "प े", + "क ृ", + "सक ते", + "म ह", + "य ोग", + "द र्", + "उ से", + "ं ध", + "ड ा", + "जा ए", + "ब ो", + "ू ल", + "म ो", + "ों ने", + "ं स", + "तु म", + "पह ले", + "ब ता", + "त था", + "य ो", + "ग ई", + "उ त्", + "सक ता", + "क म", + "ज ्यादा", + "र ख", + "सम य", + "ार ा", + "अ गर", + "स् त", + "च ल", + "फि र", + "वार ा", + "कर ना", + "श ी", + "ग ए", + "ब न", + "ौ र", + "हो ने", + "चा ह", + "ख ु", + "हा ँ", + "उन्ह ें", + "उन्ह ोंने", + "छ ो", + "म् ह", + "प्र ति", + "नि क", + "व न", + "्य ू", + "र ही", + "तु म्ह", + "ज ैसे", + "ि यों", + "क् यों", + "ल ों", + "फ ़", + "ं त्र", + "हो ते", + "क् ति", + "त ्य", + "कर ्", + "क ई", + "व ं", + "कि न", + "प ो", + "कार ण", + "ड़ ी", + "भ ि", + "इस के", + "ब र", + "उस के", + "द् वारा", + "श े", + "क ॉ", + "दि न", + "न् न", + "ड़ ा", + "स् व", + "नि र्", + "मु ख", + "लि या", + "ट ि", + "ज्ञ ान", + "क् त", + "द ्र", + "ग ्", + "क् स", + "म ै", + "ग ो", + "ज े", + "ट ्र", + "म ार", + "त् व", + "ध ार", + "भा व", + "कर ता", + "ख ि", + "क ं", + "चा हि", + "य र", + "प् त", + "क ों", + "ं च", + "ज ु", + "म त", + "अ च्छ", + "हु ई", + "क भी", + "ले किन", + "भ ू", + "अप ना", + "दू स", + "चाहि ए", + "य ू", + "घ र", + "सब से", + "मे री", + "ना म", + "ढ ़", + "ं ट", + "ें गे", + "ब ै", + "फ ा", + "ए वं", + "य ी", + "ग ्र", + "क्ष े", + "आ ज", + "आप को", + "भा ग", + "ठ ा", + "क ै", + "भार त", + "उन की", + "प हु", + "स भी", + "ध ा", + "ण ा", + "स ान", + "हो गा", + "त ब", + "स ंग", + "प र्", + "अ व", + "त ना", + "ग ि", + "य न", + "स् था", + "च ित", + "ट ्", + "छ ा", + "जा ने", + "क्षे त्र", + "वा ली", + "पूर् ण", + "स मा", + "कार ी" + ] + } +} \ No newline at end of file diff --git a/comfy/text_encoders/ace_text_cleaners.py b/comfy/text_encoders/ace_text_cleaners.py new file mode 100644 index 000000000..ad3612e5f --- /dev/null +++ b/comfy/text_encoders/ace_text_cleaners.py @@ -0,0 +1,270 @@ +# basic text cleaners for the ACE step model +# I didn't copy the ones from the reference code because I didn't want to deal with the dependencies +# TODO: more languages than english? + +import re + +def number_to_text(num, ordinal=False): + """ + Convert a number (int or float) to its text representation. + + Args: + num: The number to convert + + Returns: + str: Text representation of the number + """ + + if not isinstance(num, (int, float)): + return "Input must be a number" + + # Handle special case of zero + if num == 0: + return "zero" + + # Handle negative numbers + negative = num < 0 + num = abs(num) + + # Handle floats + if isinstance(num, float): + # Split into integer and decimal parts + int_part = int(num) + + # Convert both parts + int_text = _int_to_text(int_part) + + # Handle decimal part (convert to string and remove '0.') + decimal_str = str(num).split('.')[1] + decimal_text = " point " + " ".join(_digit_to_text(int(digit)) for digit in decimal_str) + + result = int_text + decimal_text + else: + # Handle integers + result = _int_to_text(num) + + # Add 'negative' prefix for negative numbers + if negative: + result = "negative " + result + + return result + + +def _int_to_text(num): + """Helper function to convert an integer to text""" + + ones = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", + "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", + "seventeen", "eighteen", "nineteen"] + + tens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"] + + if num < 20: + return ones[num] + + if num < 100: + return tens[num // 10] + (" " + ones[num % 10] if num % 10 != 0 else "") + + if num < 1000: + return ones[num // 100] + " hundred" + (" " + _int_to_text(num % 100) if num % 100 != 0 else "") + + if num < 1000000: + return _int_to_text(num // 1000) + " thousand" + (" " + _int_to_text(num % 1000) if num % 1000 != 0 else "") + + if num < 1000000000: + return _int_to_text(num // 1000000) + " million" + (" " + _int_to_text(num % 1000000) if num % 1000000 != 0 else "") + + return _int_to_text(num // 1000000000) + " billion" + (" " + _int_to_text(num % 1000000000) if num % 1000000000 != 0 else "") + + +def _digit_to_text(digit): + """Convert a single digit to text""" + digits = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] + return digits[digit] + + +_whitespace_re = re.compile(r"\s+") + + +# List of (regular expression, replacement) pairs for abbreviations: +_abbreviations = { + "en": [ + (re.compile("\\b%s\\." % x[0], re.IGNORECASE), x[1]) + for x in [ + ("mrs", "misess"), + ("mr", "mister"), + ("dr", "doctor"), + ("st", "saint"), + ("co", "company"), + ("jr", "junior"), + ("maj", "major"), + ("gen", "general"), + ("drs", "doctors"), + ("rev", "reverend"), + ("lt", "lieutenant"), + ("hon", "honorable"), + ("sgt", "sergeant"), + ("capt", "captain"), + ("esq", "esquire"), + ("ltd", "limited"), + ("col", "colonel"), + ("ft", "fort"), + ] + ], +} + + +def expand_abbreviations_multilingual(text, lang="en"): + for regex, replacement in _abbreviations[lang]: + text = re.sub(regex, replacement, text) + return text + + +_symbols_multilingual = { + "en": [ + (re.compile(r"%s" % re.escape(x[0]), re.IGNORECASE), x[1]) + for x in [ + ("&", " and "), + ("@", " at "), + ("%", " percent "), + ("#", " hash "), + ("$", " dollar "), + ("£", " pound "), + ("°", " degree "), + ] + ], +} + + +def expand_symbols_multilingual(text, lang="en"): + for regex, replacement in _symbols_multilingual[lang]: + text = re.sub(regex, replacement, text) + text = text.replace(" ", " ") # Ensure there are no double spaces + return text.strip() + + +_ordinal_re = { + "en": re.compile(r"([0-9]+)(st|nd|rd|th)"), +} +_number_re = re.compile(r"[0-9]+") +_currency_re = { + "USD": re.compile(r"((\$[0-9\.\,]*[0-9]+)|([0-9\.\,]*[0-9]+\$))"), + "GBP": re.compile(r"((£[0-9\.\,]*[0-9]+)|([0-9\.\,]*[0-9]+£))"), + "EUR": re.compile(r"(([0-9\.\,]*[0-9]+€)|((€[0-9\.\,]*[0-9]+)))"), +} + +_comma_number_re = re.compile(r"\b\d{1,3}(,\d{3})*(\.\d+)?\b") +_dot_number_re = re.compile(r"\b\d{1,3}(.\d{3})*(\,\d+)?\b") +_decimal_number_re = re.compile(r"([0-9]+[.,][0-9]+)") + + +def _remove_commas(m): + text = m.group(0) + if "," in text: + text = text.replace(",", "") + return text + + +def _remove_dots(m): + text = m.group(0) + if "." in text: + text = text.replace(".", "") + return text + + +def _expand_decimal_point(m, lang="en"): + amount = m.group(1).replace(",", ".") + return number_to_text(float(amount)) + + +def _expand_currency(m, lang="en", currency="USD"): + amount = float((re.sub(r"[^\d.]", "", m.group(0).replace(",", ".")))) + full_amount = number_to_text(amount) + + and_equivalents = { + "en": ", ", + "es": " con ", + "fr": " et ", + "de": " und ", + "pt": " e ", + "it": " e ", + "pl": ", ", + "cs": ", ", + "ru": ", ", + "nl": ", ", + "ar": ", ", + "tr": ", ", + "hu": ", ", + "ko": ", ", + } + + if amount.is_integer(): + last_and = full_amount.rfind(and_equivalents[lang]) + if last_and != -1: + full_amount = full_amount[:last_and] + + return full_amount + + +def _expand_ordinal(m, lang="en"): + return number_to_text(int(m.group(1)), ordinal=True) + + +def _expand_number(m, lang="en"): + return number_to_text(int(m.group(0))) + + +def expand_numbers_multilingual(text, lang="en"): + if lang in ["en", "ru"]: + text = re.sub(_comma_number_re, _remove_commas, text) + else: + text = re.sub(_dot_number_re, _remove_dots, text) + try: + text = re.sub(_currency_re["GBP"], lambda m: _expand_currency(m, lang, "GBP"), text) + text = re.sub(_currency_re["USD"], lambda m: _expand_currency(m, lang, "USD"), text) + text = re.sub(_currency_re["EUR"], lambda m: _expand_currency(m, lang, "EUR"), text) + except: + pass + + text = re.sub(_decimal_number_re, lambda m: _expand_decimal_point(m, lang), text) + text = re.sub(_ordinal_re[lang], lambda m: _expand_ordinal(m, lang), text) + text = re.sub(_number_re, lambda m: _expand_number(m, lang), text) + return text + + +def lowercase(text): + return text.lower() + + +def collapse_whitespace(text): + return re.sub(_whitespace_re, " ", text) + + +def multilingual_cleaners(text, lang): + text = text.replace('"', "") + if lang == "tr": + text = text.replace("İ", "i") + text = text.replace("Ö", "ö") + text = text.replace("Ü", "ü") + text = lowercase(text) + try: + text = expand_numbers_multilingual(text, lang) + except: + pass + try: + text = expand_abbreviations_multilingual(text, lang) + except: + pass + try: + text = expand_symbols_multilingual(text, lang=lang) + except: + pass + text = collapse_whitespace(text) + return text + + +def basic_cleaners(text): + """Basic pipeline that lowercases and collapses whitespace without transliteration.""" + text = lowercase(text) + text = collapse_whitespace(text) + return text diff --git a/comfy/text_encoders/umt5_config_base.json b/comfy/text_encoders/umt5_config_base.json new file mode 100644 index 000000000..6b3618f07 --- /dev/null +++ b/comfy/text_encoders/umt5_config_base.json @@ -0,0 +1,22 @@ +{ + "d_ff": 2048, + "d_kv": 64, + "d_model": 768, + "decoder_start_token_id": 0, + "dropout_rate": 0.1, + "eos_token_id": 1, + "dense_act_fn": "gelu_pytorch_tanh", + "initializer_factor": 1.0, + "is_encoder_decoder": true, + "is_gated_act": true, + "layer_norm_epsilon": 1e-06, + "model_type": "umt5", + "num_decoder_layers": 12, + "num_heads": 12, + "num_layers": 12, + "output_past": true, + "pad_token_id": 0, + "relative_attention_num_buckets": 32, + "tie_word_embeddings": false, + "vocab_size": 256384 +} diff --git a/comfy_extras/nodes_ace.py b/comfy_extras/nodes_ace.py new file mode 100644 index 000000000..36eb999d1 --- /dev/null +++ b/comfy_extras/nodes_ace.py @@ -0,0 +1,46 @@ +import torch +import comfy.model_management + + +class TextEncodeAceStepAudio: + @classmethod + def INPUT_TYPES(s): + return {"required": { + "clip": ("CLIP", ), + "tags": ("STRING", {"multiline": True, "dynamicPrompts": True}), + "lyrics": ("STRING", {"multiline": True, "dynamicPrompts": True}), + }} + RETURN_TYPES = ("CONDITIONING",) + FUNCTION = "encode" + + CATEGORY = "conditioning" + + def encode(self, clip, tags, lyrics): + tokens = clip.tokenize(tags, lyrics=lyrics) + return (clip.encode_from_tokens_scheduled(tokens), ) + + +class EmptyAceStepLatentAudio: + def __init__(self): + self.device = comfy.model_management.intermediate_device() + + @classmethod + def INPUT_TYPES(s): + return {"required": {"seconds": ("FLOAT", {"default": 120.0, "min": 1.0, "max": 1000.0, "step": 0.1}), + "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096, "tooltip": "The number of latent images in the batch."}), + }} + RETURN_TYPES = ("LATENT",) + FUNCTION = "generate" + + CATEGORY = "latent/audio" + + def generate(self, seconds, batch_size): + length = int(seconds * 44100 / 512 / 8) + latent = torch.zeros([batch_size, 8, 16, length], device=self.device) + return ({"samples": latent, "type": "audio"}, ) + + +NODE_CLASS_MAPPINGS = { + "TextEncodeAceStepAudio": TextEncodeAceStepAudio, + "EmptyAceStepLatentAudio": EmptyAceStepLatentAudio, +} diff --git a/nodes.py b/nodes.py index 3c3617562..d2ffd5259 100644 --- a/nodes.py +++ b/nodes.py @@ -246,6 +246,9 @@ class ConditioningZeroOut: pooled_output = d.get("pooled_output", None) if pooled_output is not None: d["pooled_output"] = torch.zeros_like(pooled_output) + conditioning_lyrics = d.get("conditioning_lyrics", None) + if conditioning_lyrics is not None: + d["conditioning_lyrics"] = torch.zeros_like(conditioning_lyrics) n = [torch.zeros_like(t[0]), d] c.append(n) return (c, ) @@ -917,7 +920,7 @@ class CLIPLoader: @classmethod def INPUT_TYPES(s): return {"required": { "clip_name": (folder_paths.get_filename_list("text_encoders"), ), - "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart", "cosmos", "lumina2", "wan", "hidream", "chroma"], ), + "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart", "cosmos", "lumina2", "wan", "hidream", "chroma", "ace"], ), }, "optional": { "device": (["default", "cpu"], {"advanced": True}), @@ -2259,6 +2262,7 @@ def init_builtin_extra_nodes(): "nodes_hidream.py", "nodes_fresca.py", "nodes_preview_any.py", + "nodes_ace.py", ] import_failed = [] From b9980592c4c629be4d46b707c65c14dc2a3da842 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 7 May 2025 14:27:16 -0700 Subject: [PATCH 408/478] Refuse to load api nodes on old pyav version. (#7981) --- comfy_api_nodes/canary.py | 10 ++++++++++ nodes.py | 3 +++ 2 files changed, 13 insertions(+) create mode 100644 comfy_api_nodes/canary.py diff --git a/comfy_api_nodes/canary.py b/comfy_api_nodes/canary.py new file mode 100644 index 000000000..4df7590b6 --- /dev/null +++ b/comfy_api_nodes/canary.py @@ -0,0 +1,10 @@ +import av + +ver = av.__version__.split(".") +if int(ver[0]) < 14: + raise Exception("INSTALL NEW VERSION OF PYAV TO USE API NODES.") + +if int(ver[0]) == 14 and int(ver[1]) < 2: + raise Exception("INSTALL NEW VERSION OF PYAV TO USE API NODES.") + +NODE_CLASS_MAPPINGS = {} diff --git a/nodes.py b/nodes.py index d2ffd5259..a1ddf2dd6 100644 --- a/nodes.py +++ b/nodes.py @@ -2289,6 +2289,9 @@ def init_builtin_api_nodes(): "nodes_pika.py", ] + if not load_custom_node(os.path.join(api_nodes_dir, "canary.py"), module_parent="comfy_api_nodes"): + return api_nodes_files + import_failed = [] for node_file in api_nodes_files: if not load_custom_node(os.path.join(api_nodes_dir, node_file), module_parent="comfy_api_nodes"): From cc33cd3422642445c994b104f0380821043024ec Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 7 May 2025 16:22:07 -0700 Subject: [PATCH 409/478] Experimental lyrics strength for ACE. (#7984) --- comfy/ldm/ace/model.py | 6 +++++- comfy/model_base.py | 1 + comfy_extras/nodes_ace.py | 9 ++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/comfy/ldm/ace/model.py b/comfy/ldm/ace/model.py index e5883df90..12c524701 100644 --- a/comfy/ldm/ace/model.py +++ b/comfy/ldm/ace/model.py @@ -273,6 +273,7 @@ class ACEStepTransformer2DModel(nn.Module): speaker_embeds: Optional[torch.FloatTensor] = None, lyric_token_idx: Optional[torch.LongTensor] = None, lyric_mask: Optional[torch.LongTensor] = None, + lyrics_strength=1.0, ): bs = encoder_text_hidden_states.shape[0] @@ -291,6 +292,8 @@ class ACEStepTransformer2DModel(nn.Module): out_dtype=encoder_text_hidden_states.dtype, ) + encoder_lyric_hidden_states *= lyrics_strength + encoder_hidden_states = torch.cat([encoder_spk_hidden_states, encoder_text_hidden_states, encoder_lyric_hidden_states], dim=1) encoder_hidden_mask = None @@ -310,7 +313,6 @@ class ACEStepTransformer2DModel(nn.Module): output_length: int = 0, block_controlnet_hidden_states: Optional[Union[List[torch.Tensor], torch.Tensor]] = None, controlnet_scale: Union[float, torch.Tensor] = 1.0, - return_dict: bool = True, ): embedded_timestep = self.timestep_embedder(self.time_proj(timestep).to(dtype=hidden_states.dtype)) temb = self.t_block(embedded_timestep) @@ -353,6 +355,7 @@ class ACEStepTransformer2DModel(nn.Module): lyric_mask: Optional[torch.LongTensor] = None, block_controlnet_hidden_states: Optional[Union[List[torch.Tensor], torch.Tensor]] = None, controlnet_scale: Union[float, torch.Tensor] = 1.0, + lyrics_strength=1.0, **kwargs ): hidden_states = x @@ -363,6 +366,7 @@ class ACEStepTransformer2DModel(nn.Module): speaker_embeds=speaker_embeds, lyric_token_idx=lyric_token_idx, lyric_mask=lyric_mask, + lyrics_strength=lyrics_strength, ) output_length = hidden_states.shape[-1] diff --git a/comfy/model_base.py b/comfy/model_base.py index 6408005b6..6d27930dc 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -1139,4 +1139,5 @@ class ACEStep(BaseModel): if cross_attn is not None: out['lyric_token_idx'] = comfy.conds.CONDRegular(conditioning_lyrics) out['speaker_embeds'] = comfy.conds.CONDRegular(torch.zeros(noise.shape[0], 512, device=noise.device, dtype=noise.dtype)) + out['lyrics_strength'] = comfy.conds.CONDConstant(kwargs.get("lyrics_strength", 1.0)) return out diff --git a/comfy_extras/nodes_ace.py b/comfy_extras/nodes_ace.py index 36eb999d1..cbfec15a2 100644 --- a/comfy_extras/nodes_ace.py +++ b/comfy_extras/nodes_ace.py @@ -1,6 +1,6 @@ import torch import comfy.model_management - +import node_helpers class TextEncodeAceStepAudio: @classmethod @@ -9,15 +9,18 @@ class TextEncodeAceStepAudio: "clip": ("CLIP", ), "tags": ("STRING", {"multiline": True, "dynamicPrompts": True}), "lyrics": ("STRING", {"multiline": True, "dynamicPrompts": True}), + "lyrics_strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}), }} RETURN_TYPES = ("CONDITIONING",) FUNCTION = "encode" CATEGORY = "conditioning" - def encode(self, clip, tags, lyrics): + def encode(self, clip, tags, lyrics, lyrics_strength): tokens = clip.tokenize(tags, lyrics=lyrics) - return (clip.encode_from_tokens_scheduled(tokens), ) + conditioning = clip.encode_from_tokens_scheduled(tokens) + conditioning = node_helpers.conditioning_set_values(conditioning, {"lyrics_strength": lyrics_strength}) + return (conditioning, ) class EmptyAceStepLatentAudio: From 56b6ee6754f9ca7cf336394eacd17e24364090f1 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 7 May 2025 18:28:24 -0700 Subject: [PATCH 410/478] Detection code to make ltxv models without config work. (#7986) --- comfy/model_detection.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/comfy/model_detection.py b/comfy/model_detection.py index ff4c29d7e..28c586389 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -222,6 +222,10 @@ def detect_unet_config(state_dict, key_prefix, metadata=None): if '{}adaln_single.emb.timestep_embedder.linear_1.bias'.format(key_prefix) in state_dict_keys: #Lightricks ltxv dit_config = {} dit_config["image_model"] = "ltxv" + dit_config["num_layers"] = count_blocks(state_dict_keys, '{}transformer_blocks.'.format(key_prefix) + '{}.') + shape = state_dict['{}transformer_blocks.0.attn2.to_k.weight'.format(key_prefix)].shape + dit_config["attention_head_dim"] = shape[0] // 32 + dit_config["cross_attention_dim"] = shape[1] if metadata is not None and "config" in metadata: dit_config.update(json.loads(metadata["config"]).get("transformer", {})) return dit_config From fd08e39588b777552f88cb3800a73eb55e844ac5 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 7 May 2025 18:37:12 -0700 Subject: [PATCH 411/478] Make torchaudio not a hard requirement. (#7987) Some platforms can't install it apparently so if it's not there it should only break models that actually use it. --- comfy/ldm/ace/vae/music_dcae_pipeline.py | 7 ++++++- comfy/ldm/ace/vae/music_log_mel.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/comfy/ldm/ace/vae/music_dcae_pipeline.py b/comfy/ldm/ace/vae/music_dcae_pipeline.py index 3188bc770..af81280eb 100644 --- a/comfy/ldm/ace/vae/music_dcae_pipeline.py +++ b/comfy/ldm/ace/vae/music_dcae_pipeline.py @@ -1,7 +1,12 @@ # Original from: https://github.com/ace-step/ACE-Step/blob/main/music_dcae/music_dcae_pipeline.py import torch from .autoencoder_dc import AutoencoderDC -import torchaudio +import logging +try: + import torchaudio +except: + logging.warning("torchaudio missing, ACE model will be broken") + import torchvision.transforms as transforms from .music_vocoder import ADaMoSHiFiGANV1 diff --git a/comfy/ldm/ace/vae/music_log_mel.py b/comfy/ldm/ace/vae/music_log_mel.py index d73d3f8e8..9c584eb7f 100755 --- a/comfy/ldm/ace/vae/music_log_mel.py +++ b/comfy/ldm/ace/vae/music_log_mel.py @@ -2,7 +2,12 @@ import torch import torch.nn as nn from torch import Tensor -from torchaudio.transforms import MelScale +import logging +try: + from torchaudio.transforms import MelScale +except: + logging.warning("torchaudio missing, ACE model will be broken") + import comfy.model_management class LinearSpectrogram(nn.Module): From c7c025b8d16f7f34b01409ead4dba4476cc64dae Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 7 May 2025 22:22:23 -0700 Subject: [PATCH 412/478] Adjust memory estimation code for ACE VAE. (#7990) --- comfy/sd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/sd.py b/comfy/sd.py index 50af243ba..c6b6a3b19 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -442,7 +442,7 @@ class VAE: elif "vocoder.backbone.channel_layers.0.0.bias" in sd: #Ace Step Audio self.first_stage_model = comfy.ldm.ace.vae.music_dcae_pipeline.MusicDCAE(source_sample_rate=44100) self.memory_used_encode = lambda shape, dtype: (shape[2] * 300) * model_management.dtype_size(dtype) - self.memory_used_decode = lambda shape, dtype: (shape[2] * shape[3] * 72000) * model_management.dtype_size(dtype) + self.memory_used_decode = lambda shape, dtype: (shape[2] * shape[3] * 87000) * model_management.dtype_size(dtype) self.latent_channels = 8 self.output_channels = 2 # self.upscale_ratio = 2048 From 5d3cc85e13833aeb6ef9242cdae243083e30c6fc Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Thu, 8 May 2025 00:32:36 -0700 Subject: [PATCH 413/478] Make japanese hiragana and katakana characters work with ACE. (#7997) --- comfy/sd.py | 2 +- comfy/text_encoders/ace.py | 10 +- comfy/text_encoders/ace_text_cleaners.py | 125 +++++++++++++++++++++++ 3 files changed, 135 insertions(+), 2 deletions(-) diff --git a/comfy/sd.py b/comfy/sd.py index c6b6a3b19..161d96f1e 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -441,7 +441,7 @@ class VAE: self.working_dtypes = [torch.float16, torch.bfloat16, torch.float32] elif "vocoder.backbone.channel_layers.0.0.bias" in sd: #Ace Step Audio self.first_stage_model = comfy.ldm.ace.vae.music_dcae_pipeline.MusicDCAE(source_sample_rate=44100) - self.memory_used_encode = lambda shape, dtype: (shape[2] * 300) * model_management.dtype_size(dtype) + self.memory_used_encode = lambda shape, dtype: (shape[2] * 330) * model_management.dtype_size(dtype) self.memory_used_decode = lambda shape, dtype: (shape[2] * shape[3] * 87000) * model_management.dtype_size(dtype) self.latent_channels = 8 self.output_channels = 2 diff --git a/comfy/text_encoders/ace.py b/comfy/text_encoders/ace.py index b6fe451bd..d650bb10d 100644 --- a/comfy/text_encoders/ace.py +++ b/comfy/text_encoders/ace.py @@ -7,7 +7,7 @@ import torch import logging from tokenizers import Tokenizer -from .ace_text_cleaners import multilingual_cleaners +from .ace_text_cleaners import multilingual_cleaners, japanese_to_romaji SUPPORT_LANGUAGES = { "en": 259, "de": 260, "fr": 262, "es": 284, "it": 285, @@ -65,6 +65,14 @@ class VoiceBpeTokenizer: if "spa" in lang: lang = "es" + try: + line_out = japanese_to_romaji(line) + if line_out != line: + lang = "ja" + line = line_out + except: + pass + try: if structure_pattern.match(line): token_idx = self.encode(line, "en") diff --git a/comfy/text_encoders/ace_text_cleaners.py b/comfy/text_encoders/ace_text_cleaners.py index ad3612e5f..cd31d8d8c 100644 --- a/comfy/text_encoders/ace_text_cleaners.py +++ b/comfy/text_encoders/ace_text_cleaners.py @@ -4,6 +4,131 @@ import re +def japanese_to_romaji(japanese_text): + """ + Convert Japanese hiragana and katakana to romaji (Latin alphabet representation). + + Args: + japanese_text (str): Text containing hiragana and/or katakana characters + + Returns: + str: The romaji (Latin alphabet) equivalent + """ + # Dictionary mapping kana characters to their romaji equivalents + kana_map = { + # Katakana characters + 'ア': 'a', 'イ': 'i', 'ウ': 'u', 'エ': 'e', 'オ': 'o', + 'カ': 'ka', 'キ': 'ki', 'ク': 'ku', 'ケ': 'ke', 'コ': 'ko', + 'サ': 'sa', 'シ': 'shi', 'ス': 'su', 'セ': 'se', 'ソ': 'so', + 'タ': 'ta', 'チ': 'chi', 'ツ': 'tsu', 'テ': 'te', 'ト': 'to', + 'ナ': 'na', 'ニ': 'ni', 'ヌ': 'nu', 'ネ': 'ne', 'ノ': 'no', + 'ハ': 'ha', 'ヒ': 'hi', 'フ': 'fu', 'ヘ': 'he', 'ホ': 'ho', + 'マ': 'ma', 'ミ': 'mi', 'ム': 'mu', 'メ': 'me', 'モ': 'mo', + 'ヤ': 'ya', 'ユ': 'yu', 'ヨ': 'yo', + 'ラ': 'ra', 'リ': 'ri', 'ル': 'ru', 'レ': 're', 'ロ': 'ro', + 'ワ': 'wa', 'ヲ': 'wo', 'ン': 'n', + + # Katakana voiced consonants + 'ガ': 'ga', 'ギ': 'gi', 'グ': 'gu', 'ゲ': 'ge', 'ゴ': 'go', + 'ザ': 'za', 'ジ': 'ji', 'ズ': 'zu', 'ゼ': 'ze', 'ゾ': 'zo', + 'ダ': 'da', 'ヂ': 'ji', 'ヅ': 'zu', 'デ': 'de', 'ド': 'do', + 'バ': 'ba', 'ビ': 'bi', 'ブ': 'bu', 'ベ': 'be', 'ボ': 'bo', + 'パ': 'pa', 'ピ': 'pi', 'プ': 'pu', 'ペ': 'pe', 'ポ': 'po', + + # Katakana combinations + 'キャ': 'kya', 'キュ': 'kyu', 'キョ': 'kyo', + 'シャ': 'sha', 'シュ': 'shu', 'ショ': 'sho', + 'チャ': 'cha', 'チュ': 'chu', 'チョ': 'cho', + 'ニャ': 'nya', 'ニュ': 'nyu', 'ニョ': 'nyo', + 'ヒャ': 'hya', 'ヒュ': 'hyu', 'ヒョ': 'hyo', + 'ミャ': 'mya', 'ミュ': 'myu', 'ミョ': 'myo', + 'リャ': 'rya', 'リュ': 'ryu', 'リョ': 'ryo', + 'ギャ': 'gya', 'ギュ': 'gyu', 'ギョ': 'gyo', + 'ジャ': 'ja', 'ジュ': 'ju', 'ジョ': 'jo', + 'ビャ': 'bya', 'ビュ': 'byu', 'ビョ': 'byo', + 'ピャ': 'pya', 'ピュ': 'pyu', 'ピョ': 'pyo', + + # Katakana small characters and special cases + 'ッ': '', # Small tsu (doubles the following consonant) + 'ャ': 'ya', 'ュ': 'yu', 'ョ': 'yo', + + # Katakana extras + 'ヴ': 'vu', 'ファ': 'fa', 'フィ': 'fi', 'フェ': 'fe', 'フォ': 'fo', + 'ウィ': 'wi', 'ウェ': 'we', 'ウォ': 'wo', + + # Hiragana characters + 'あ': 'a', 'い': 'i', 'う': 'u', 'え': 'e', 'お': 'o', + 'か': 'ka', 'き': 'ki', 'く': 'ku', 'け': 'ke', 'こ': 'ko', + 'さ': 'sa', 'し': 'shi', 'す': 'su', 'せ': 'se', 'そ': 'so', + 'た': 'ta', 'ち': 'chi', 'つ': 'tsu', 'て': 'te', 'と': 'to', + 'な': 'na', 'に': 'ni', 'ぬ': 'nu', 'ね': 'ne', 'の': 'no', + 'は': 'ha', 'ひ': 'hi', 'ふ': 'fu', 'へ': 'he', 'ほ': 'ho', + 'ま': 'ma', 'み': 'mi', 'む': 'mu', 'め': 'me', 'も': 'mo', + 'や': 'ya', 'ゆ': 'yu', 'よ': 'yo', + 'ら': 'ra', 'り': 'ri', 'る': 'ru', 'れ': 're', 'ろ': 'ro', + 'わ': 'wa', 'を': 'wo', 'ん': 'n', + + # Hiragana voiced consonants + 'が': 'ga', 'ぎ': 'gi', 'ぐ': 'gu', 'げ': 'ge', 'ご': 'go', + 'ざ': 'za', 'じ': 'ji', 'ず': 'zu', 'ぜ': 'ze', 'ぞ': 'zo', + 'だ': 'da', 'ぢ': 'ji', 'づ': 'zu', 'で': 'de', 'ど': 'do', + 'ば': 'ba', 'び': 'bi', 'ぶ': 'bu', 'べ': 'be', 'ぼ': 'bo', + 'ぱ': 'pa', 'ぴ': 'pi', 'ぷ': 'pu', 'ぺ': 'pe', 'ぽ': 'po', + + # Hiragana combinations + 'きゃ': 'kya', 'きゅ': 'kyu', 'きょ': 'kyo', + 'しゃ': 'sha', 'しゅ': 'shu', 'しょ': 'sho', + 'ちゃ': 'cha', 'ちゅ': 'chu', 'ちょ': 'cho', + 'にゃ': 'nya', 'にゅ': 'nyu', 'にょ': 'nyo', + 'ひゃ': 'hya', 'ひゅ': 'hyu', 'ひょ': 'hyo', + 'みゃ': 'mya', 'みゅ': 'myu', 'みょ': 'myo', + 'りゃ': 'rya', 'りゅ': 'ryu', 'りょ': 'ryo', + 'ぎゃ': 'gya', 'ぎゅ': 'gyu', 'ぎょ': 'gyo', + 'じゃ': 'ja', 'じゅ': 'ju', 'じょ': 'jo', + 'びゃ': 'bya', 'びゅ': 'byu', 'びょ': 'byo', + 'ぴゃ': 'pya', 'ぴゅ': 'pyu', 'ぴょ': 'pyo', + + # Hiragana small characters and special cases + 'っ': '', # Small tsu (doubles the following consonant) + 'ゃ': 'ya', 'ゅ': 'yu', 'ょ': 'yo', + + # Common punctuation and spaces + ' ': ' ', # Japanese space + '、': ', ', '。': '. ', + } + + result = [] + i = 0 + + while i < len(japanese_text): + # Check for small tsu (doubling the following consonant) + if i < len(japanese_text) - 1 and (japanese_text[i] == 'っ' or japanese_text[i] == 'ッ'): + if i < len(japanese_text) - 1 and japanese_text[i+1] in kana_map: + next_romaji = kana_map[japanese_text[i+1]] + if next_romaji and next_romaji[0] not in 'aiueon': + result.append(next_romaji[0]) # Double the consonant + i += 1 + continue + + # Check for combinations with small ya, yu, yo + if i < len(japanese_text) - 1 and japanese_text[i+1] in ('ゃ', 'ゅ', 'ょ', 'ャ', 'ュ', 'ョ'): + combo = japanese_text[i:i+2] + if combo in kana_map: + result.append(kana_map[combo]) + i += 2 + continue + + # Regular character + if japanese_text[i] in kana_map: + result.append(kana_map[japanese_text[i]]) + else: + # If it's not in our map, keep it as is (might be kanji, romaji, etc.) + result.append(japanese_text[i]) + + i += 1 + + return ''.join(result) + def number_to_text(num, ordinal=False): """ Convert a number (int or float) to its text representation. From a692c3cca40f67ddceefaacf29dbf1bd38bdc293 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Thu, 8 May 2025 04:25:45 -0700 Subject: [PATCH 414/478] Make ACE VAE tiling work. (#8004) --- comfy/sd.py | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/comfy/sd.py b/comfy/sd.py index 161d96f1e..ee350d5b5 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -282,6 +282,7 @@ class VAE: self.downscale_index_formula = None self.upscale_index_formula = None + self.extra_1d_channel = None if config is None: if "decoder.mid.block_1.mix_factor" in sd: @@ -445,13 +446,14 @@ class VAE: self.memory_used_decode = lambda shape, dtype: (shape[2] * shape[3] * 87000) * model_management.dtype_size(dtype) self.latent_channels = 8 self.output_channels = 2 - # self.upscale_ratio = 2048 - # self.downscale_ratio = 2048 + self.upscale_ratio = 4096 + self.downscale_ratio = 4096 self.latent_dim = 2 self.process_output = lambda audio: audio self.process_input = lambda audio: audio self.working_dtypes = [torch.bfloat16, torch.float32] self.disable_offload = True + self.extra_1d_channel = 16 else: logging.warning("WARNING: No VAE weights detected, VAE not initalized.") self.first_stage_model = None @@ -510,7 +512,13 @@ class VAE: return output def decode_tiled_1d(self, samples, tile_x=128, overlap=32): - decode_fn = lambda a: self.first_stage_model.decode(a.to(self.vae_dtype).to(self.device)).float() + if samples.ndim == 3: + decode_fn = lambda a: self.first_stage_model.decode(a.to(self.vae_dtype).to(self.device)).float() + else: + og_shape = samples.shape + samples = samples.reshape((og_shape[0], og_shape[1] * og_shape[2], -1)) + decode_fn = lambda a: self.first_stage_model.decode(a.reshape((-1, og_shape[1], og_shape[2], a.shape[-1])).to(self.vae_dtype).to(self.device)).float() + return self.process_output(comfy.utils.tiled_scale_multidim(samples, decode_fn, tile=(tile_x,), overlap=overlap, upscale_amount=self.upscale_ratio, out_channels=self.output_channels, output_device=self.output_device)) def decode_tiled_3d(self, samples, tile_t=999, tile_x=32, tile_y=32, overlap=(1, 8, 8)): @@ -530,9 +538,24 @@ class VAE: samples /= 3.0 return samples - def encode_tiled_1d(self, samples, tile_x=128 * 2048, overlap=32 * 2048): - encode_fn = lambda a: self.first_stage_model.encode((self.process_input(a)).to(self.vae_dtype).to(self.device)).float() - return comfy.utils.tiled_scale_multidim(samples, encode_fn, tile=(tile_x,), overlap=overlap, upscale_amount=(1/self.downscale_ratio), out_channels=self.latent_channels, output_device=self.output_device) + def encode_tiled_1d(self, samples, tile_x=256 * 2048, overlap=64 * 2048): + if self.latent_dim == 1: + encode_fn = lambda a: self.first_stage_model.encode((self.process_input(a)).to(self.vae_dtype).to(self.device)).float() + out_channels = self.latent_channels + upscale_amount = 1 / self.downscale_ratio + else: + extra_channel_size = self.extra_1d_channel + out_channels = self.latent_channels * extra_channel_size + tile_x = tile_x // extra_channel_size + overlap = overlap // extra_channel_size + upscale_amount = 1 / self.downscale_ratio + encode_fn = lambda a: self.first_stage_model.encode((self.process_input(a)).to(self.vae_dtype).to(self.device)).reshape(1, out_channels, -1).float() + + out = comfy.utils.tiled_scale_multidim(samples, encode_fn, tile=(tile_x,), overlap=overlap, upscale_amount=upscale_amount, out_channels=out_channels, output_device=self.output_device) + if self.latent_dim == 1: + return out + else: + return out.reshape(samples.shape[0], self.latent_channels, extra_channel_size, -1) def encode_tiled_3d(self, samples, tile_t=9999, tile_x=512, tile_y=512, overlap=(1, 64, 64)): encode_fn = lambda a: self.first_stage_model.encode((self.process_input(a)).to(self.vae_dtype).to(self.device)).float() @@ -557,7 +580,7 @@ class VAE: except model_management.OOM_EXCEPTION: logging.warning("Warning: Ran out of memory when regular VAE decoding, retrying with tiled VAE decoding.") dims = samples_in.ndim - 2 - if dims == 1: + if dims == 1 or self.extra_1d_channel is not None: pixel_samples = self.decode_tiled_1d(samples_in) elif dims == 2: pixel_samples = self.decode_tiled_(samples_in) @@ -624,7 +647,7 @@ class VAE: tile = 256 overlap = tile // 4 samples = self.encode_tiled_3d(pixel_samples, tile_x=tile, tile_y=tile, overlap=(1, overlap, overlap)) - elif self.latent_dim == 1: + elif self.latent_dim == 1 or self.extra_1d_channel is not None: samples = self.encode_tiled_1d(pixel_samples) else: samples = self.encode_tiled_(pixel_samples) From 02a1b01aad28470f06c8b4f95b90914413d3e4c8 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 8 May 2025 07:36:48 -0400 Subject: [PATCH 415/478] ComfyUI version 0.3.33 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 61573aead..5a73f76e4 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.32" +__version__ = "0.3.33" diff --git a/pyproject.toml b/pyproject.toml index 878e7c66a..e0be329de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.32" +version = "0.3.33" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 924d771e18000f4cb223575189daa6d2c6c5a9c1 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Thu, 8 May 2025 05:40:57 -0700 Subject: [PATCH 416/478] Add ACE Step to README. (#8005) --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f39cfce2..deee70c6b 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,11 @@ See what ComfyUI can do with the [example workflows](https://comfyanonymous.gith - [Hunyuan Video](https://comfyanonymous.github.io/ComfyUI_examples/hunyuan_video/) - [Nvidia Cosmos](https://comfyanonymous.github.io/ComfyUI_examples/cosmos/) - [Wan 2.1](https://comfyanonymous.github.io/ComfyUI_examples/wan/) +- Audio Models + - [Stable Audio](https://comfyanonymous.github.io/ComfyUI_examples/audio/) + - [ACE Step](https://comfyanonymous.github.io/ComfyUI_examples/audio/) - 3D Models - [Hunyuan3D 2.0](https://docs.comfy.org/tutorials/3d/hunyuan3D-2) -- [Stable Audio](https://comfyanonymous.github.io/ComfyUI_examples/audio/) - Asynchronous Queue system - Many optimizations: Only re-executes the parts of the workflow that changes between executions. - Smart memory management: can automatically run models on GPUs with as low as 1GB vram. From 8ab15c863c91bce1f9c3a32f947cb4ec659fd7fb Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Fri, 9 May 2025 01:52:47 -0700 Subject: [PATCH 417/478] Add --mmap-torch-files to enable use of mmap when loading ckpt/pt (#8021) --- comfy/cli_args.py | 2 ++ comfy/utils.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 97b348f0d..de292d9b3 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -142,6 +142,8 @@ class PerformanceFeature(enum.Enum): parser.add_argument("--fast", nargs="*", type=PerformanceFeature, help="Enable some untested and potentially quality deteriorating optimizations. --fast with no arguments enables everything. You can pass a list specific optimizations if you only want to enable specific ones. Current valid optimizations: fp16_accumulation fp8_matrix_mult cublas_ops") +parser.add_argument("--mmap-torch-files", action="store_true", help="Use mmap when loading ckpt/pt files.") + parser.add_argument("--dont-print-server", action="store_true", help="Don't print server output.") parser.add_argument("--quick-test-for-ci", action="store_true", help="Quick test for CI.") parser.add_argument("--windows-standalone-build", action="store_true", help="Windows standalone build: Enable convenient things that most people using the standalone windows build will probably enjoy (like auto opening the page on startup).") diff --git a/comfy/utils.py b/comfy/utils.py index a826e41bf..561e1b858 100644 --- a/comfy/utils.py +++ b/comfy/utils.py @@ -28,6 +28,9 @@ import logging import itertools from torch.nn.functional import interpolate from einops import rearrange +from comfy.cli_args import args + +MMAP_TORCH_FILES = args.mmap_torch_files ALWAYS_SAFE_LOAD = False if hasattr(torch.serialization, "add_safe_globals"): # TODO: this was added in pytorch 2.4, the unsafe path should be removed once earlier versions are deprecated @@ -67,8 +70,12 @@ def load_torch_file(ckpt, safe_load=False, device=None, return_metadata=False): raise ValueError("{}\n\nFile path: {}\n\nThe safetensors file is corrupt/incomplete. Check the file size and make sure you have copied/downloaded it correctly.".format(message, ckpt)) raise e else: + torch_args = {} + if MMAP_TORCH_FILES: + torch_args["mmap"] = True + if safe_load or ALWAYS_SAFE_LOAD: - pl_sd = torch.load(ckpt, map_location=device, weights_only=True) + pl_sd = torch.load(ckpt, map_location=device, weights_only=True, **torch_args) else: pl_sd = torch.load(ckpt, map_location=device, pickle_module=comfy.checkpoint_pickle) if "global_step" in pl_sd: From 28f178a840aaa59971ecc6e0ce287bb40d275a89 Mon Sep 17 00:00:00 2001 From: thot experiment <94414189+thot-experiment@users.noreply.github.com> Date: Fri, 9 May 2025 10:46:34 -0700 Subject: [PATCH 418/478] move SVG to core (#7982) * move SVG to core * fix workflow embedding w/ unicode characters --- comfy_api_nodes/apis/recraft_api.py | 1 - comfy_api_nodes/nodes_recraft.py | 110 ++-------------------------- comfy_extras/nodes_images.py | 102 ++++++++++++++++++++++++++ 3 files changed, 107 insertions(+), 106 deletions(-) diff --git a/comfy_api_nodes/apis/recraft_api.py b/comfy_api_nodes/apis/recraft_api.py index c0ec9d0c8..c36d95f24 100644 --- a/comfy_api_nodes/apis/recraft_api.py +++ b/comfy_api_nodes/apis/recraft_api.py @@ -81,7 +81,6 @@ class RecraftStyle: class RecraftIO: STYLEV3 = "RECRAFT_V3_STYLE" - SVG = "SVG" # TODO: if acceptable, move into ComfyUI's typing class COLOR = "RECRAFT_COLOR" CONTROLS = "RECRAFT_CONTROLS" diff --git a/comfy_api_nodes/nodes_recraft.py b/comfy_api_nodes/nodes_recraft.py index 994f377d1..5c89d21e9 100644 --- a/comfy_api_nodes/nodes_recraft.py +++ b/comfy_api_nodes/nodes_recraft.py @@ -1,6 +1,7 @@ from __future__ import annotations from inspect import cleandoc from comfy.utils import ProgressBar +from comfy_extras.nodes_images import SVG # Added from comfy.comfy_types.node_typing import IO from comfy_api_nodes.apis.recraft_api import ( RecraftImageGenerationRequest, @@ -28,9 +29,6 @@ from comfy_api_nodes.apinode_utils import ( resize_mask_to_image, validate_string, ) -import folder_paths -import json -import os import torch from io import BytesIO from PIL import UnidentifiedImageError @@ -162,102 +160,6 @@ class handle_recraft_image_output: raise Exception("Received output data was not an image; likely an SVG. If you used style_id, make sure it is not a Vector art style.") -class SVG: - """ - Stores SVG representations via a list of BytesIO objects. - """ - def __init__(self, data: list[BytesIO]): - self.data = data - - def combine(self, other: SVG): - return SVG(self.data + other.data) - - @staticmethod - def combine_all(svgs: list[SVG]): - all_svgs = [] - for svg in svgs: - all_svgs.extend(svg.data) - return SVG(all_svgs) - - -class SaveSVGNode: - """ - Save SVG files on disk. - """ - - def __init__(self): - self.output_dir = folder_paths.get_output_directory() - self.type = "output" - self.prefix_append = "" - - RETURN_TYPES = () - DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value - FUNCTION = "save_svg" - CATEGORY = "api node/image/Recraft" - OUTPUT_NODE = True - - @classmethod - def INPUT_TYPES(s): - return { - "required": { - "svg": (RecraftIO.SVG,), - "filename_prefix": ("STRING", {"default": "svg/ComfyUI", "tooltip": "The prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Image.width% to include values from nodes."}) - }, - "hidden": { - "prompt": "PROMPT", - "extra_pnginfo": "EXTRA_PNGINFO" - } - } - - def save_svg(self, svg: SVG, filename_prefix="svg/ComfyUI", prompt=None, extra_pnginfo=None): - filename_prefix += self.prefix_append - full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir) - results = list() - - # Prepare metadata JSON - metadata_dict = {} - if prompt is not None: - metadata_dict["prompt"] = prompt - if extra_pnginfo is not None: - metadata_dict.update(extra_pnginfo) - - # Convert metadata to JSON string - metadata_json = json.dumps(metadata_dict, indent=2) if metadata_dict else None - - for batch_number, svg_bytes in enumerate(svg.data): - filename_with_batch_num = filename.replace("%batch_num%", str(batch_number)) - file = f"{filename_with_batch_num}_{counter:05}_.svg" - - # Read SVG content - svg_bytes.seek(0) - svg_content = svg_bytes.read().decode('utf-8') - - # Inject metadata if available - if metadata_json: - # Create metadata element with CDATA section - metadata_element = f""" - - -""" - # Insert metadata after opening svg tag using regex - import re - svg_content = re.sub(r'(]*>)', r'\1\n' + metadata_element, svg_content) - - # Write the modified SVG to file - with open(os.path.join(full_output_folder, file), 'wb') as svg_file: - svg_file.write(svg_content.encode('utf-8')) - - results.append({ - "filename": file, - "subfolder": subfolder, - "type": self.type - }) - counter += 1 - return { "ui": { "images": results } } - - class RecraftColorRGBNode: """ Create Recraft Color by choosing specific RGB values. @@ -796,8 +698,8 @@ class RecraftTextToVectorNode: Generates SVG synchronously based on prompt and resolution. """ - RETURN_TYPES = (RecraftIO.SVG,) - DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + RETURN_TYPES = ("SVG",) # Changed + DESCRIPTION = cleandoc(__doc__ or "") if 'cleandoc' in globals() else __doc__ # Keep cleandoc if other nodes use it FUNCTION = "api_call" API_NODE = True CATEGORY = "api node/image/Recraft" @@ -918,8 +820,8 @@ class RecraftVectorizeImageNode: Generates SVG synchronously from an input image. """ - RETURN_TYPES = (RecraftIO.SVG,) - DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + RETURN_TYPES = ("SVG",) # Changed + DESCRIPTION = cleandoc(__doc__ or "") if 'cleandoc' in globals() else __doc__ # Keep cleandoc if other nodes use it FUNCTION = "api_call" API_NODE = True CATEGORY = "api node/image/Recraft" @@ -1193,7 +1095,6 @@ NODE_CLASS_MAPPINGS = { "RecraftStyleV3InfiniteStyleLibrary": RecraftStyleInfiniteStyleLibrary, "RecraftColorRGB": RecraftColorRGBNode, "RecraftControls": RecraftControlsNode, - "SaveSVG": SaveSVGNode, } # A dictionary that contains the friendly/humanly readable titles for the nodes @@ -1213,5 +1114,4 @@ NODE_DISPLAY_NAME_MAPPINGS = { "RecraftStyleV3InfiniteStyleLibrary": "Recraft Style - Infinite Style Library", "RecraftColorRGB": "Recraft Color RGB", "RecraftControls": "Recraft Controls", - "SaveSVG": "Save SVG", } diff --git a/comfy_extras/nodes_images.py b/comfy_extras/nodes_images.py index e11a4583a..77c305619 100644 --- a/comfy_extras/nodes_images.py +++ b/comfy_extras/nodes_images.py @@ -10,6 +10,9 @@ from PIL.PngImagePlugin import PngInfo import numpy as np import json import os +import re +from io import BytesIO +from inspect import cleandoc from comfy.comfy_types import FileLocator @@ -190,10 +193,109 @@ class SaveAnimatedPNG: return { "ui": { "images": results, "animated": (True,)} } +class SVG: + """ + Stores SVG representations via a list of BytesIO objects. + """ + def __init__(self, data: list[BytesIO]): + self.data = data + + def combine(self, other: 'SVG') -> 'SVG': + return SVG(self.data + other.data) + + @staticmethod + def combine_all(svgs: list['SVG']) -> 'SVG': + all_svgs_list: list[BytesIO] = [] + for svg_item in svgs: + all_svgs_list.extend(svg_item.data) + return SVG(all_svgs_list) + +class SaveSVGNode: + """ + Save SVG files on disk. + """ + + def __init__(self): + self.output_dir = folder_paths.get_output_directory() + self.type = "output" + self.prefix_append = "" + + RETURN_TYPES = () + DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value + FUNCTION = "save_svg" + CATEGORY = "image/save" # Changed + OUTPUT_NODE = True + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "svg": ("SVG",), # Changed + "filename_prefix": ("STRING", {"default": "svg/ComfyUI", "tooltip": "The prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Image.width% to include values from nodes."}) + }, + "hidden": { + "prompt": "PROMPT", + "extra_pnginfo": "EXTRA_PNGINFO" + } + } + + def save_svg(self, svg: SVG, filename_prefix="svg/ComfyUI", prompt=None, extra_pnginfo=None): + filename_prefix += self.prefix_append + full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir) + results = list() + + # Prepare metadata JSON + metadata_dict = {} + if prompt is not None: + metadata_dict["prompt"] = prompt + if extra_pnginfo is not None: + metadata_dict.update(extra_pnginfo) + + # Convert metadata to JSON string + metadata_json = json.dumps(metadata_dict, indent=2) if metadata_dict else None + + for batch_number, svg_bytes in enumerate(svg.data): + filename_with_batch_num = filename.replace("%batch_num%", str(batch_number)) + file = f"{filename_with_batch_num}_{counter:05}_.svg" + + # Read SVG content + svg_bytes.seek(0) + svg_content = svg_bytes.read().decode('utf-8') + + # Inject metadata if available + if metadata_json: + # Create metadata element with CDATA section + metadata_element = f""" + + + """ + # Insert metadata after opening svg tag using regex with a replacement function + def replacement(match): + # match.group(1) contains the captured tag + return match.group(1) + '\n' + metadata_element + + # Apply the substitution + svg_content = re.sub(r'(]*>)', replacement, svg_content, flags=re.UNICODE) + + # Write the modified SVG to file + with open(os.path.join(full_output_folder, file), 'wb') as svg_file: + svg_file.write(svg_content.encode('utf-8')) + + results.append({ + "filename": file, + "subfolder": subfolder, + "type": self.type + }) + counter += 1 + return { "ui": { "images": results } } + NODE_CLASS_MAPPINGS = { "ImageCrop": ImageCrop, "RepeatImageBatch": RepeatImageBatch, "ImageFromBatch": ImageFromBatch, "SaveAnimatedWEBP": SaveAnimatedWEBP, "SaveAnimatedPNG": SaveAnimatedPNG, + "SaveSVGNode": SaveSVGNode, } From 42da274717ff75640e1fb50f88d5c117a9c50630 Mon Sep 17 00:00:00 2001 From: blepping <157360029+blepping@users.noreply.github.com> Date: Fri, 9 May 2025 11:51:02 -0600 Subject: [PATCH 419/478] Use normal ComfyUI attention in ACE-Steps model (#8023) * Use normal ComfyUI attention in ACE-Steps model * Let optimized_attention handle output reshape for ACE --- comfy/ldm/ace/attention.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/comfy/ldm/ace/attention.py b/comfy/ldm/ace/attention.py index 631d13647..f20a01669 100644 --- a/comfy/ldm/ace/attention.py +++ b/comfy/ldm/ace/attention.py @@ -19,6 +19,7 @@ import torch.nn.functional as F from torch import nn import comfy.model_management +from comfy.ldm.modules.attention import optimized_attention class Attention(nn.Module): def __init__( @@ -326,10 +327,6 @@ class CustomerAttnProcessor2_0: Processor for implementing scaled dot-product attention (enabled by default if you're using PyTorch 2.0). """ - def __init__(self): - if not hasattr(F, "scaled_dot_product_attention"): - raise ImportError("AttnProcessor2_0 requires PyTorch 2.0, to use it, please upgrade PyTorch to 2.0.") - def apply_rotary_emb( self, x: torch.Tensor, @@ -435,13 +432,9 @@ class CustomerAttnProcessor2_0: attention_mask = attention_mask.view(batch_size, attn.heads, -1, attention_mask.shape[-1]) # the output of sdp = (batch, num_heads, seq_len, head_dim) - # TODO: add support for attn.scale when we move to Torch 2.1 - hidden_states = F.scaled_dot_product_attention( - query, key, value, attn_mask=attention_mask, dropout_p=0.0, is_causal=False - ) - - hidden_states = hidden_states.transpose(1, 2).reshape(batch_size, -1, attn.heads * head_dim) - hidden_states = hidden_states.to(query.dtype) + hidden_states = optimized_attention( + query, key, value, heads=query.shape[1], mask=attention_mask, skip_reshape=True, + ).to(query.dtype) # linear proj hidden_states = attn.to_out[0](hidden_states) From ae60b150e577de470032840ed7194889686fa424 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 9 May 2025 17:02:45 -0700 Subject: [PATCH 420/478] update node tooltips and validation (#8036) --- comfy_api_nodes/nodes_ideogram.py | 13 +++--------- comfy_api_nodes/nodes_kling.py | 35 +++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/comfy_api_nodes/nodes_ideogram.py b/comfy_api_nodes/nodes_ideogram.py index 45c021f4a..0a16d74bf 100644 --- a/comfy_api_nodes/nodes_ideogram.py +++ b/comfy_api_nodes/nodes_ideogram.py @@ -234,9 +234,7 @@ def download_and_process_images(image_urls): class IdeogramV1(ComfyNodeABC): """ - Generates images synchronously using the Ideogram V1 model. - - Images links are available for a limited period of time; if you would like to keep the image, you must download it. + Generates images using the Ideogram V1 model. """ def __init__(self): @@ -365,9 +363,7 @@ class IdeogramV1(ComfyNodeABC): class IdeogramV2(ComfyNodeABC): """ - Generates images synchronously using the Ideogram V2 model. - - Images links are available for a limited period of time; if you would like to keep the image, you must download it. + Generates images using the Ideogram V2 model. """ def __init__(self): @@ -536,10 +532,7 @@ class IdeogramV2(ComfyNodeABC): class IdeogramV3(ComfyNodeABC): """ - Generates images synchronously using the Ideogram V3 model. - - Supports both regular image generation from text prompts and image editing with mask. - Images links are available for a limited period of time; if you would like to keep the image, you must download it. + Generates images using the Ideogram V3 model. Supports both regular image generation from text prompts and image editing with mask. """ def __init__(self): diff --git a/comfy_api_nodes/nodes_kling.py b/comfy_api_nodes/nodes_kling.py index 9aa8df58b..c8d1704c1 100644 --- a/comfy_api_nodes/nodes_kling.py +++ b/comfy_api_nodes/nodes_kling.py @@ -184,6 +184,33 @@ def validate_image_result_response(response) -> None: raise KlingApiError(error_msg) +def validate_input_image(image: torch.Tensor) -> None: + """ + Validates the input image adheres to the expectations of the Kling API: + - The image resolution should not be less than 300*300px + - The aspect ratio of the image should be between 1:2.5 ~ 2.5:1 + + See: https://app.klingai.com/global/dev/document-api/apiReference/model/imageToVideo + """ + if len(image.shape) == 4: + height, width = image.shape[1], image.shape[2] + elif len(image.shape) == 3: + height, width = image.shape[0], image.shape[1] + else: + raise ValueError("Invalid image tensor shape.") + + # Ensure minimum resolution is met + if height < 300: + raise ValueError("Image height must be at least 300px") + if width < 300: + raise ValueError("Image width must be at least 300px") + + # Ensure aspect ratio is within acceptable range + aspect_ratio = width / height + if aspect_ratio < 1 / 2.5 or aspect_ratio > 2.5: + raise ValueError("Image aspect ratio must be between 1:2.5 and 2.5:1") + + def get_camera_control_input_config( tooltip: str, default: float = 0.0 ) -> tuple[IO, InputTypeOptions]: @@ -530,7 +557,10 @@ class KlingImage2VideoNode(KlingNodeBase): return { "required": { "start_frame": model_field_to_node_input( - IO.IMAGE, KlingImage2VideoRequest, "image" + IO.IMAGE, + KlingImage2VideoRequest, + "image", + tooltip="The reference image used to generate the video.", ), "prompt": model_field_to_node_input( IO.STRING, KlingImage2VideoRequest, "prompt", multiline=True @@ -607,9 +637,10 @@ class KlingImage2VideoNode(KlingNodeBase): auth_token: Optional[str] = None, ) -> tuple[VideoFromFile]: validate_prompts(prompt, negative_prompt, MAX_PROMPT_LENGTH_I2V) + validate_input_image(start_frame) if camera_control is not None: - # Camera control type for image 2 video is always simple + # Camera control type for image 2 video is always `simple` camera_control.type = KlingCameraControlType.simple initial_operation = SynchronousOperation( From 1b3bf0a5dac887ec651df8e326bd260e17e56909 Mon Sep 17 00:00:00 2001 From: Pam <42671363+pamparamm@users.noreply.github.com> Date: Sat, 10 May 2025 05:14:13 +0500 Subject: [PATCH 421/478] Fix res_multistep_ancestral sampler (#8030) --- comfy/k_diffusion/sampling.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/comfy/k_diffusion/sampling.py b/comfy/k_diffusion/sampling.py index 77ef748e8..fbdf6f554 100644 --- a/comfy/k_diffusion/sampling.py +++ b/comfy/k_diffusion/sampling.py @@ -1277,6 +1277,7 @@ def res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None phi1_fn = lambda t: torch.expm1(t) / t phi2_fn = lambda t: (phi1_fn(t) - 1.0) / t + old_sigma_down = None old_denoised = None uncond_denoised = None def post_cfg_function(args): @@ -1304,9 +1305,9 @@ def res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None x = x + d * dt else: # Second order multistep method in https://arxiv.org/pdf/2308.02157 - t, t_next, t_prev = t_fn(sigmas[i]), t_fn(sigma_down), t_fn(sigmas[i - 1]) + t, t_old, t_next, t_prev = t_fn(sigmas[i]), t_fn(old_sigma_down), t_fn(sigma_down), t_fn(sigmas[i - 1]) h = t_next - t - c2 = (t_prev - t) / h + c2 = (t_prev - t_old) / h phi1_val, phi2_val = phi1_fn(-h), phi2_fn(-h) b1 = torch.nan_to_num(phi1_val - phi2_val / c2, nan=0.0) @@ -1326,6 +1327,7 @@ def res_multistep(model, x, sigmas, extra_args=None, callback=None, disable=None old_denoised = uncond_denoised else: old_denoised = denoised + old_sigma_down = sigma_down return x @torch.no_grad() From d42613686f3db1bf55e6dec75434ed2649baa6bc Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sat, 10 May 2025 04:52:56 -0700 Subject: [PATCH 422/478] Fix issue with fp8 ops on some models. (#8045) _scaled_mm errors when an input is non contiguous. --- comfy/ops.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/ops.py b/comfy/ops.py index 032787915..431c8f89d 100644 --- a/comfy/ops.py +++ b/comfy/ops.py @@ -308,10 +308,10 @@ def fp8_linear(self, input): if scale_input is None: scale_input = torch.ones((), device=input.device, dtype=torch.float32) input = torch.clamp(input, min=-448, max=448, out=input) - input = input.reshape(-1, input_shape[2]).to(dtype) + input = input.reshape(-1, input_shape[2]).to(dtype).contiguous() else: scale_input = scale_input.to(input.device) - input = (input * (1.0 / scale_input).to(input_dtype)).reshape(-1, input_shape[2]).to(dtype) + input = (input * (1.0 / scale_input).to(input_dtype)).reshape(-1, input_shape[2]).to(dtype).contiguous() if bias is not None: o = torch._scaled_mm(input, w, out_dtype=input_dtype, bias=bias, scale_a=scale_input, scale_b=scale_weight) From 235d3901fc3f97698e97ff52f61a7caa5f1f11ed Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 10 May 2025 17:40:02 -0700 Subject: [PATCH 423/478] Add method to stream text to node UI (#8018) * show text progress preview * include node id in message --- server.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index f64ec27d4..cb1c6a8fd 100644 --- a/server.py +++ b/server.py @@ -32,12 +32,13 @@ from app.frontend_management import FrontendManager from app.user_manager import UserManager from app.model_manager import ModelFileManager from app.custom_node_manager import CustomNodeManager -from typing import Optional +from typing import Optional, Union from api_server.routes.internal.internal_routes import InternalRoutes class BinaryEventTypes: PREVIEW_IMAGE = 1 UNENCODED_PREVIEW_IMAGE = 2 + TEXT = 3 async def send_socket_catch_exception(function, message): try: @@ -878,3 +879,15 @@ class PromptServer(): logging.warning(traceback.format_exc()) return json_data + + def send_progress_text( + self, text: Union[bytes, bytearray, str], node_id: str, sid=None + ): + if isinstance(text, str): + text = text.encode("utf-8") + node_id_bytes = str(node_id).encode("utf-8") + + # Pack the node_id length as a 4-byte unsigned integer, followed by the node_id bytes + message = struct.pack(">I", len(node_id_bytes)) + node_id_bytes + text + + self.send_sync(BinaryEventTypes.TEXT, message, sid) From 3535909eb8581ba3e4461f3c9723d244c446f65e Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 10 May 2025 19:10:58 -0700 Subject: [PATCH 424/478] Add support for Comfy API keys (#8041) * Handle Comfy API key based authorizaton (#167) Co-authored-by: Jedrzej Kosinski * Bump frontend version to include API key features (#170) * bump templates version --------- Co-authored-by: Jedrzej Kosinski --- comfy_api_nodes/apinode_utils.py | 25 ++--- comfy_api_nodes/apis/client.py | 43 +++++--- comfy_api_nodes/nodes_bfl.py | 24 ++--- comfy_api_nodes/nodes_ideogram.py | 29 +++-- comfy_api_nodes/nodes_kling.py | 166 ++++++++++++++++++----------- comfy_api_nodes/nodes_luma.py | 50 ++++----- comfy_api_nodes/nodes_minimax.py | 15 +-- comfy_api_nodes/nodes_openai.py | 27 +++-- comfy_api_nodes/nodes_pika.py | 60 ++++++----- comfy_api_nodes/nodes_pixverse.py | 28 ++--- comfy_api_nodes/nodes_recraft.py | 36 +++---- comfy_api_nodes/nodes_stability.py | 27 +++-- comfy_api_nodes/nodes_veo2.py | 7 +- execution.py | 2 + requirements.txt | 4 +- 15 files changed, 319 insertions(+), 224 deletions(-) diff --git a/comfy_api_nodes/apinode_utils.py b/comfy_api_nodes/apinode_utils.py index bd3b8908b..e28d7d607 100644 --- a/comfy_api_nodes/apinode_utils.py +++ b/comfy_api_nodes/apinode_utils.py @@ -1,3 +1,4 @@ +from __future__ import annotations import io import logging from typing import Optional @@ -314,7 +315,7 @@ def upload_file_to_comfyapi( file_bytes_io: BytesIO, filename: str, upload_mime_type: str, - auth_token: Optional[str] = None, + auth_kwargs: Optional[dict[str,str]] = None, ) -> str: """ Uploads a single file to ComfyUI API and returns its download URL. @@ -323,7 +324,7 @@ def upload_file_to_comfyapi( file_bytes_io: BytesIO object containing the file data. filename: The filename of the file. upload_mime_type: MIME type of the file. - auth_token: Optional authentication token. + auth_kwargs: Optional authentication token(s). Returns: The download URL for the uploaded file. @@ -337,7 +338,7 @@ def upload_file_to_comfyapi( response_model=UploadResponse, ), request=request_object, - auth_token=auth_token, + auth_kwargs=auth_kwargs, ) response: UploadResponse = operation.execute() @@ -351,7 +352,7 @@ def upload_file_to_comfyapi( def upload_video_to_comfyapi( video: VideoInput, - auth_token: Optional[str] = None, + auth_kwargs: Optional[dict[str,str]] = None, container: VideoContainer = VideoContainer.MP4, codec: VideoCodec = VideoCodec.H264, max_duration: Optional[int] = None, @@ -362,7 +363,7 @@ def upload_video_to_comfyapi( Args: video: VideoInput object (Comfy VIDEO type). - auth_token: Optional authentication token. + auth_kwargs: Optional authentication token(s). container: The video container format to use (default: MP4). codec: The video codec to use (default: H264). max_duration: Optional maximum duration of the video in seconds. If the video is longer than this, an error will be raised. @@ -390,7 +391,7 @@ def upload_video_to_comfyapi( video_bytes_io.seek(0) return upload_file_to_comfyapi( - video_bytes_io, filename, upload_mime_type, auth_token + video_bytes_io, filename, upload_mime_type, auth_kwargs ) @@ -453,7 +454,7 @@ def audio_ndarray_to_bytesio( def upload_audio_to_comfyapi( audio: AudioInput, - auth_token: Optional[str] = None, + auth_kwargs: Optional[dict[str,str]] = None, container_format: str = "mp4", codec_name: str = "aac", mime_type: str = "audio/mp4", @@ -465,7 +466,7 @@ def upload_audio_to_comfyapi( Args: audio: a Comfy `AUDIO` type (contains waveform tensor and sample_rate) - auth_token: Optional authentication token. + auth_kwargs: Optional authentication token(s). Returns: The download URL for the uploaded audio file. @@ -477,11 +478,11 @@ def upload_audio_to_comfyapi( audio_data_np, sample_rate, container_format, codec_name ) - return upload_file_to_comfyapi(audio_bytes_io, filename, mime_type, auth_token) + return upload_file_to_comfyapi(audio_bytes_io, filename, mime_type, auth_kwargs) def upload_images_to_comfyapi( - image: torch.Tensor, max_images=8, auth_token=None, mime_type: Optional[str] = None + image: torch.Tensor, max_images=8, auth_kwargs: Optional[dict[str,str]] = None, mime_type: Optional[str] = None ) -> list[str]: """ Uploads images to ComfyUI API and returns download URLs. @@ -490,7 +491,7 @@ def upload_images_to_comfyapi( Args: image: Input torch.Tensor image. max_images: Maximum number of images to upload. - auth_token: Optional authentication token. + auth_kwargs: Optional authentication token(s). mime_type: Optional MIME type for the image. """ # if batch, try to upload each file if max_images is greater than 0 @@ -521,7 +522,7 @@ def upload_images_to_comfyapi( response_model=UploadResponse, ), request=request_object, - auth_token=auth_token, + auth_kwargs=auth_kwargs, ) response = operation.execute() diff --git a/comfy_api_nodes/apis/client.py b/comfy_api_nodes/apis/client.py index 929e386d4..cff52714f 100644 --- a/comfy_api_nodes/apis/client.py +++ b/comfy_api_nodes/apis/client.py @@ -20,7 +20,8 @@ Usage Examples: # 1. Create the API client api_client = ApiClient( base_url="https://api.example.com", - api_key="your_api_key_here", + auth_token="your_auth_token_here", + comfy_api_key="your_comfy_api_key_here", timeout=30.0, verify_ssl=True ) @@ -146,12 +147,14 @@ class ApiClient: def __init__( self, base_url: str, - api_key: Optional[str] = None, + auth_token: Optional[str] = None, + comfy_api_key: Optional[str] = None, timeout: float = 3600.0, verify_ssl: bool = True, ): self.base_url = base_url - self.api_key = api_key + self.auth_token = auth_token + self.comfy_api_key = comfy_api_key self.timeout = timeout self.verify_ssl = verify_ssl @@ -201,8 +204,10 @@ class ApiClient: """Get headers for API requests, including authentication if available""" headers = {"Content-Type": "application/json", "Accept": "application/json"} - if self.api_key: - headers["Authorization"] = f"Bearer {self.api_key}" + if self.auth_token: + headers["Authorization"] = f"Bearer {self.auth_token}" + elif self.comfy_api_key: + headers["X-API-KEY"] = self.comfy_api_key return headers @@ -236,7 +241,7 @@ class ApiClient: requests.RequestException: If the request fails """ url = urljoin(self.base_url, path) - self.check_auth_token(self.api_key) + self.check_auth(self.auth_token, self.comfy_api_key) # Combine default headers with any provided headers request_headers = self.get_headers() if headers: @@ -320,11 +325,11 @@ class ApiClient: return response.json() return {} - def check_auth_token(self, auth_token): - """Verify that an auth token is present.""" - if auth_token is None: + def check_auth(self, auth_token, comfy_api_key): + """Verify that an auth token is present or comfy_api_key is present""" + if auth_token is None and comfy_api_key is None: raise Exception("Unauthorized: Please login first to use this node.") - return auth_token + return auth_token or comfy_api_key @staticmethod def upload_file( @@ -392,6 +397,8 @@ class SynchronousOperation(Generic[T, R]): files: Optional[Dict[str, Any]] = None, api_base: str | None = None, auth_token: Optional[str] = None, + comfy_api_key: Optional[str] = None, + auth_kwargs: Optional[Dict[str,str]] = None, timeout: float = 604800.0, verify_ssl: bool = True, content_type: str = "application/json", @@ -403,6 +410,10 @@ class SynchronousOperation(Generic[T, R]): self.error = None self.api_base: str = api_base or args.comfy_api_base self.auth_token = auth_token + self.comfy_api_key = comfy_api_key + if auth_kwargs is not None: + self.auth_token = auth_kwargs.get("auth_token", self.auth_token) + self.comfy_api_key = auth_kwargs.get("comfy_api_key", self.comfy_api_key) self.timeout = timeout self.verify_ssl = verify_ssl self.files = files @@ -415,7 +426,8 @@ class SynchronousOperation(Generic[T, R]): if client is None: client = ApiClient( base_url=self.api_base, - api_key=self.auth_token, + auth_token=self.auth_token, + comfy_api_key=self.comfy_api_key, timeout=self.timeout, verify_ssl=self.verify_ssl, ) @@ -502,12 +514,18 @@ class PollingOperation(Generic[T, R]): request: Optional[T] = None, api_base: str | None = None, auth_token: Optional[str] = None, + comfy_api_key: Optional[str] = None, + auth_kwargs: Optional[Dict[str,str]] = None, poll_interval: float = 5.0, ): self.poll_endpoint = poll_endpoint self.request = request self.api_base: str = api_base or args.comfy_api_base self.auth_token = auth_token + self.comfy_api_key = comfy_api_key + if auth_kwargs is not None: + self.auth_token = auth_kwargs.get("auth_token", self.auth_token) + self.comfy_api_key = auth_kwargs.get("comfy_api_key", self.comfy_api_key) self.poll_interval = poll_interval # Polling configuration @@ -528,7 +546,8 @@ class PollingOperation(Generic[T, R]): if client is None: client = ApiClient( base_url=self.api_base, - api_key=self.auth_token, + auth_token=self.auth_token, + comfy_api_key=self.comfy_api_key, ) return self._poll_until_complete(client) except Exception as e: diff --git a/comfy_api_nodes/nodes_bfl.py b/comfy_api_nodes/nodes_bfl.py index 122a6ddf8..66ef1b391 100644 --- a/comfy_api_nodes/nodes_bfl.py +++ b/comfy_api_nodes/nodes_bfl.py @@ -179,6 +179,7 @@ class FluxProUltraImageNode(ComfyNodeABC): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -211,7 +212,6 @@ class FluxProUltraImageNode(ComfyNodeABC): seed=0, image_prompt=None, image_prompt_strength=0.1, - auth_token=None, **kwargs, ): if image_prompt is None: @@ -244,7 +244,7 @@ class FluxProUltraImageNode(ComfyNodeABC): None if image_prompt is None else round(image_prompt_strength, 2) ), ), - auth_token=auth_token, + auth_kwargs=kwargs, ) output_image = handle_bfl_synchronous_operation(operation) return (output_image,) @@ -319,6 +319,7 @@ class FluxProImageNode(ComfyNodeABC): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -337,7 +338,6 @@ class FluxProImageNode(ComfyNodeABC): seed=0, image_prompt=None, # image_prompt_strength=0.1, - auth_token=None, **kwargs, ): image_prompt = ( @@ -361,7 +361,7 @@ class FluxProImageNode(ComfyNodeABC): seed=seed, image_prompt=image_prompt, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) output_image = handle_bfl_synchronous_operation(operation) return (output_image,) @@ -461,6 +461,7 @@ class FluxProExpandNode(ComfyNodeABC): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -482,7 +483,6 @@ class FluxProExpandNode(ComfyNodeABC): steps: int, guidance: float, seed=0, - auth_token=None, **kwargs, ): image = convert_image_to_base64(image) @@ -506,7 +506,7 @@ class FluxProExpandNode(ComfyNodeABC): seed=seed, image=image, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) output_image = handle_bfl_synchronous_operation(operation) return (output_image,) @@ -572,6 +572,7 @@ class FluxProFillNode(ComfyNodeABC): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -590,7 +591,6 @@ class FluxProFillNode(ComfyNodeABC): steps: int, guidance: float, seed=0, - auth_token=None, **kwargs, ): # prepare mask @@ -615,7 +615,7 @@ class FluxProFillNode(ComfyNodeABC): image=image, mask=mask, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) output_image = handle_bfl_synchronous_operation(operation) return (output_image,) @@ -706,6 +706,7 @@ class FluxProCannyNode(ComfyNodeABC): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -726,7 +727,6 @@ class FluxProCannyNode(ComfyNodeABC): steps: int, guidance: float, seed=0, - auth_token=None, **kwargs, ): control_image = convert_image_to_base64(control_image[:,:,:,:3]) @@ -763,7 +763,7 @@ class FluxProCannyNode(ComfyNodeABC): canny_high_threshold=canny_high_threshold, preprocessed_image=preprocessed_image, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) output_image = handle_bfl_synchronous_operation(operation) return (output_image,) @@ -834,6 +834,7 @@ class FluxProDepthNode(ComfyNodeABC): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -852,7 +853,6 @@ class FluxProDepthNode(ComfyNodeABC): steps: int, guidance: float, seed=0, - auth_token=None, **kwargs, ): control_image = convert_image_to_base64(control_image[:,:,:,:3]) @@ -878,7 +878,7 @@ class FluxProDepthNode(ComfyNodeABC): control_image=control_image, preprocessed_image=preprocessed_image, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) output_image = handle_bfl_synchronous_operation(operation) return (output_image,) diff --git a/comfy_api_nodes/nodes_ideogram.py b/comfy_api_nodes/nodes_ideogram.py index 0a16d74bf..d25468b17 100644 --- a/comfy_api_nodes/nodes_ideogram.py +++ b/comfy_api_nodes/nodes_ideogram.py @@ -301,7 +301,10 @@ class IdeogramV1(ComfyNodeABC): {"default": 1, "min": 1, "max": 8, "step": 1, "display": "number"}, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } RETURN_TYPES = (IO.IMAGE,) @@ -319,7 +322,7 @@ class IdeogramV1(ComfyNodeABC): seed=0, negative_prompt="", num_images=1, - auth_token=None, + **kwargs, ): # Determine the model based on turbo setting aspect_ratio = V1_V2_RATIO_MAP.get(aspect_ratio, None) @@ -345,7 +348,7 @@ class IdeogramV1(ComfyNodeABC): negative_prompt=negative_prompt if negative_prompt else None, ) ), - auth_token=auth_token, + auth_kwargs=kwargs, ) response = operation.execute() @@ -454,7 +457,10 @@ class IdeogramV2(ComfyNodeABC): # }, #), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } RETURN_TYPES = (IO.IMAGE,) @@ -475,7 +481,7 @@ class IdeogramV2(ComfyNodeABC): negative_prompt="", num_images=1, color_palette="", - auth_token=None, + **kwargs, ): aspect_ratio = V1_V2_RATIO_MAP.get(aspect_ratio, None) resolution = V1_V1_RES_MAP.get(resolution, None) @@ -515,7 +521,7 @@ class IdeogramV2(ComfyNodeABC): color_palette=color_palette if color_palette else None, ) ), - auth_token=auth_token, + auth_kwargs=kwargs, ) response = operation.execute() @@ -614,7 +620,10 @@ class IdeogramV3(ComfyNodeABC): }, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } RETURN_TYPES = (IO.IMAGE,) @@ -634,7 +643,7 @@ class IdeogramV3(ComfyNodeABC): seed=0, num_images=1, rendering_speed="BALANCED", - auth_token=None, + **kwargs, ): # Check if both image and mask are provided for editing mode if image is not None and mask is not None: @@ -698,7 +707,7 @@ class IdeogramV3(ComfyNodeABC): "mask": mask_binary, }, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=kwargs, ) elif image is not None or mask is not None: @@ -739,7 +748,7 @@ class IdeogramV3(ComfyNodeABC): response_model=IdeogramGenerateResponse, ), request=gen_request, - auth_token=auth_token, + auth_kwargs=kwargs, ) # Execute the operation and process response diff --git a/comfy_api_nodes/nodes_kling.py b/comfy_api_nodes/nodes_kling.py index c8d1704c1..b2be83656 100644 --- a/comfy_api_nodes/nodes_kling.py +++ b/comfy_api_nodes/nodes_kling.py @@ -95,7 +95,7 @@ class KlingApiError(Exception): pass -def poll_until_finished(auth_token: str, api_endpoint: ApiEndpoint[Any, R]) -> R: +def poll_until_finished(auth_kwargs: dict[str,str], api_endpoint: ApiEndpoint[Any, R]) -> R: """Polls the Kling API endpoint until the task reaches a terminal state, then returns the response.""" return PollingOperation( poll_endpoint=api_endpoint, @@ -108,7 +108,7 @@ def poll_until_finished(auth_token: str, api_endpoint: ApiEndpoint[Any, R]) -> R if response.data and response.data.task_status else None ), - auth_token=auth_token, + auth_kwargs=auth_kwargs, ).execute() @@ -418,16 +418,19 @@ class KlingTextToVideoNode(KlingNodeBase): }, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } RETURN_TYPES = ("VIDEO", "STRING", "STRING") RETURN_NAMES = ("VIDEO", "video_id", "duration") DESCRIPTION = "Kling Text to Video Node" - def get_response(self, task_id: str, auth_token: str) -> KlingText2VideoResponse: + def get_response(self, task_id: str, auth_kwargs: dict[str,str]) -> KlingText2VideoResponse: return poll_until_finished( - auth_token, + auth_kwargs, ApiEndpoint( path=f"{PATH_TEXT_TO_VIDEO}/{task_id}", method=HttpMethod.GET, @@ -446,7 +449,7 @@ class KlingTextToVideoNode(KlingNodeBase): camera_control: Optional[KlingCameraControl] = None, model_name: Optional[str] = None, duration: Optional[str] = None, - auth_token: Optional[str] = None, + **kwargs, ) -> tuple[VideoFromFile, str, str]: validate_prompts(prompt, negative_prompt, MAX_PROMPT_LENGTH_T2V) if model_name is None: @@ -468,14 +471,14 @@ class KlingTextToVideoNode(KlingNodeBase): aspect_ratio=KlingVideoGenAspectRatio(aspect_ratio), camera_control=camera_control, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) task_creation_response = initial_operation.execute() validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_token) + final_response = self.get_response(task_id, auth_kwargs=kwargs) validate_video_result_response(final_response) video = get_video_from_response(final_response) @@ -522,7 +525,10 @@ class KlingCameraControlT2VNode(KlingTextToVideoNode): }, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } DESCRIPTION = "Transform text into cinematic videos with professional camera movements that simulate real-world cinematography. Control virtual camera actions including zoom, rotation, pan, tilt, and first-person view, while maintaining focus on your original text." @@ -534,7 +540,7 @@ class KlingCameraControlT2VNode(KlingTextToVideoNode): cfg_scale: float, aspect_ratio: str, camera_control: Optional[KlingCameraControl] = None, - auth_token: Optional[str] = None, + **kwargs, ): return super().api_call( model_name=KlingVideoGenModelName.kling_v1, @@ -545,7 +551,7 @@ class KlingCameraControlT2VNode(KlingTextToVideoNode): prompt=prompt, negative_prompt=negative_prompt, camera_control=camera_control, - auth_token=auth_token, + **kwargs, ) @@ -604,16 +610,19 @@ class KlingImage2VideoNode(KlingNodeBase): enum_type=KlingVideoGenDuration, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } RETURN_TYPES = ("VIDEO", "STRING", "STRING") RETURN_NAMES = ("VIDEO", "video_id", "duration") DESCRIPTION = "Kling Image to Video Node" - def get_response(self, task_id: str, auth_token: str) -> KlingImage2VideoResponse: + def get_response(self, task_id: str, auth_kwargs: dict[str,str]) -> KlingImage2VideoResponse: return poll_until_finished( - auth_token, + auth_kwargs, ApiEndpoint( path=f"{PATH_IMAGE_TO_VIDEO}/{task_id}", method=HttpMethod.GET, @@ -634,7 +643,7 @@ class KlingImage2VideoNode(KlingNodeBase): duration: str, camera_control: Optional[KlingCameraControl] = None, end_frame: Optional[torch.Tensor] = None, - auth_token: Optional[str] = None, + **kwargs, ) -> tuple[VideoFromFile]: validate_prompts(prompt, negative_prompt, MAX_PROMPT_LENGTH_I2V) validate_input_image(start_frame) @@ -666,14 +675,14 @@ class KlingImage2VideoNode(KlingNodeBase): duration=KlingVideoGenDuration(duration), camera_control=camera_control, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) task_creation_response = initial_operation.execute() validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_token) + final_response = self.get_response(task_id, auth_kwargs=kwargs) validate_video_result_response(final_response) video = get_video_from_response(final_response) @@ -723,7 +732,10 @@ class KlingCameraControlI2VNode(KlingImage2VideoNode): }, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } DESCRIPTION = "Transform still images into cinematic videos with professional camera movements that simulate real-world cinematography. Control virtual camera actions including zoom, rotation, pan, tilt, and first-person view, while maintaining focus on your original image." @@ -736,7 +748,7 @@ class KlingCameraControlI2VNode(KlingImage2VideoNode): cfg_scale: float, aspect_ratio: str, camera_control: KlingCameraControl, - auth_token: Optional[str] = None, + **kwargs, ): return super().api_call( model_name=KlingVideoGenModelName.kling_v1_5, @@ -748,7 +760,7 @@ class KlingCameraControlI2VNode(KlingImage2VideoNode): prompt=prompt, negative_prompt=negative_prompt, camera_control=camera_control, - auth_token=auth_token, + **kwargs, ) @@ -816,7 +828,10 @@ class KlingStartEndFrameNode(KlingImage2VideoNode): }, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } DESCRIPTION = "Generate a video sequence that transitions between your provided start and end images. The node creates all frames in between, producing a smooth transformation from the first frame to the last." @@ -830,7 +845,7 @@ class KlingStartEndFrameNode(KlingImage2VideoNode): cfg_scale: float, aspect_ratio: str, mode: str, - auth_token: Optional[str] = None, + **kwargs, ): mode, duration, model_name = KlingStartEndFrameNode.get_mode_string_mapping()[ mode @@ -845,7 +860,7 @@ class KlingStartEndFrameNode(KlingImage2VideoNode): aspect_ratio=aspect_ratio, duration=duration, end_frame=end_frame, - auth_token=auth_token, + **kwargs, ) @@ -875,16 +890,19 @@ class KlingVideoExtendNode(KlingNodeBase): IO.STRING, KlingVideoExtendRequest, "video_id", forceInput=True ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } RETURN_TYPES = ("VIDEO", "STRING", "STRING") RETURN_NAMES = ("VIDEO", "video_id", "duration") DESCRIPTION = "Kling Video Extend Node. Extend videos made by other Kling nodes. The video_id is created by using other Kling Nodes." - def get_response(self, task_id: str, auth_token: str) -> KlingVideoExtendResponse: + def get_response(self, task_id: str, auth_kwargs: dict[str,str]) -> KlingVideoExtendResponse: return poll_until_finished( - auth_token, + auth_kwargs, ApiEndpoint( path=f"{PATH_VIDEO_EXTEND}/{task_id}", method=HttpMethod.GET, @@ -899,7 +917,7 @@ class KlingVideoExtendNode(KlingNodeBase): negative_prompt: str, cfg_scale: float, video_id: str, - auth_token: Optional[str] = None, + **kwargs, ) -> tuple[VideoFromFile, str, str]: validate_prompts(prompt, negative_prompt, MAX_PROMPT_LENGTH_T2V) initial_operation = SynchronousOperation( @@ -915,14 +933,14 @@ class KlingVideoExtendNode(KlingNodeBase): cfg_scale=cfg_scale, video_id=video_id, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) task_creation_response = initial_operation.execute() validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_token) + final_response = self.get_response(task_id, auth_kwargs=kwargs) validate_video_result_response(final_response) video = get_video_from_response(final_response) @@ -935,9 +953,9 @@ class KlingVideoEffectsBase(KlingNodeBase): RETURN_TYPES = ("VIDEO", "STRING", "STRING") RETURN_NAMES = ("VIDEO", "video_id", "duration") - def get_response(self, task_id: str, auth_token: str) -> KlingVideoEffectsResponse: + def get_response(self, task_id: str, auth_kwargs: dict[str,str]) -> KlingVideoEffectsResponse: return poll_until_finished( - auth_token, + auth_kwargs, ApiEndpoint( path=f"{PATH_VIDEO_EFFECTS}/{task_id}", method=HttpMethod.GET, @@ -955,7 +973,7 @@ class KlingVideoEffectsBase(KlingNodeBase): image_1: torch.Tensor, image_2: Optional[torch.Tensor] = None, mode: Optional[KlingVideoGenMode] = None, - auth_token: Optional[str] = None, + **kwargs, ): if dual_character: request_input_field = KlingDualCharacterEffectInput( @@ -985,14 +1003,14 @@ class KlingVideoEffectsBase(KlingNodeBase): effect_scene=effect_scene, input=request_input_field, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) task_creation_response = initial_operation.execute() validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_token) + final_response = self.get_response(task_id, auth_kwargs=kwargs) validate_video_result_response(final_response) video = get_video_from_response(final_response) @@ -1033,7 +1051,10 @@ class KlingDualCharacterVideoEffectNode(KlingVideoEffectsBase): enum_type=KlingVideoGenDuration, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } DESCRIPTION = "Achieve different special effects when generating a video based on the effect_scene. First image will be positioned on left side, second on right side of the composite." @@ -1048,7 +1069,7 @@ class KlingDualCharacterVideoEffectNode(KlingVideoEffectsBase): model_name: KlingCharacterEffectModelName, mode: KlingVideoGenMode, duration: KlingVideoGenDuration, - auth_token: Optional[str] = None, + **kwargs, ): video, _, duration = super().api_call( dual_character=True, @@ -1058,7 +1079,7 @@ class KlingDualCharacterVideoEffectNode(KlingVideoEffectsBase): duration=duration, image_1=image_left, image_2=image_right, - auth_token=auth_token, + **kwargs, ) return video, duration @@ -1094,7 +1115,10 @@ class KlingSingleImageVideoEffectNode(KlingVideoEffectsBase): enum_type=KlingVideoGenDuration, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } DESCRIPTION = "Achieve different special effects when generating a video based on the effect_scene." @@ -1105,7 +1129,7 @@ class KlingSingleImageVideoEffectNode(KlingVideoEffectsBase): effect_scene: KlingSingleImageEffectsScene, model_name: KlingSingleImageEffectModelName, duration: KlingVideoGenDuration, - auth_token: Optional[str] = None, + **kwargs, ): return super().api_call( dual_character=False, @@ -1113,7 +1137,7 @@ class KlingSingleImageVideoEffectNode(KlingVideoEffectsBase): model_name=model_name, duration=duration, image_1=image, - auth_token=auth_token, + **kwargs, ) @@ -1131,10 +1155,10 @@ class KlingLipSyncBase(KlingNodeBase): f"Text is too long. Maximum length is {MAX_PROMPT_LENGTH_LIP_SYNC} characters." ) - def get_response(self, task_id: str, auth_token: str) -> KlingLipSyncResponse: + def get_response(self, task_id: str, auth_kwargs: dict[str,str]) -> KlingLipSyncResponse: """Polls the Kling API endpoint until the task reaches a terminal state.""" return poll_until_finished( - auth_token, + auth_kwargs, ApiEndpoint( path=f"{PATH_LIP_SYNC}/{task_id}", method=HttpMethod.GET, @@ -1152,18 +1176,18 @@ class KlingLipSyncBase(KlingNodeBase): text: Optional[str] = None, voice_speed: Optional[float] = None, voice_id: Optional[str] = None, - auth_token: Optional[str] = None, + **kwargs ) -> tuple[VideoFromFile, str, str]: if text: self.validate_text(text) # Upload video to Comfy API and get download URL - video_url = upload_video_to_comfyapi(video, auth_token) + video_url = upload_video_to_comfyapi(video, auth_kwargs=kwargs) logging.info("Uploaded video to Comfy API. URL: %s", video_url) # Upload the audio file to Comfy API and get download URL if audio: - audio_url = upload_audio_to_comfyapi(audio, auth_token) + audio_url = upload_audio_to_comfyapi(audio, auth_kwargs=kwargs) logging.info("Uploaded audio to Comfy API. URL: %s", audio_url) else: audio_url = None @@ -1187,14 +1211,14 @@ class KlingLipSyncBase(KlingNodeBase): voice_id=voice_id, ), ), - auth_token=auth_token, + auth_kwargs=kwargs, ) task_creation_response = initial_operation.execute() validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_token) + final_response = self.get_response(task_id, auth_kwargs=kwargs) validate_video_result_response(final_response) video = get_video_from_response(final_response) @@ -1217,7 +1241,10 @@ class KlingLipSyncAudioToVideoNode(KlingLipSyncBase): enum_type=KlingLipSyncVoiceLanguage, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } DESCRIPTION = "Kling Lip Sync Audio to Video Node. Syncs mouth movements in a video file to the audio content of an audio file." @@ -1227,14 +1254,14 @@ class KlingLipSyncAudioToVideoNode(KlingLipSyncBase): video: VideoInput, audio: AudioInput, voice_language: str, - auth_token: Optional[str] = None, + **kwargs, ): return super().api_call( video=video, audio=audio, voice_language=voice_language, mode="audio2video", - auth_token=auth_token, + **kwargs, ) @@ -1323,7 +1350,10 @@ class KlingLipSyncTextToVideoNode(KlingLipSyncBase): IO.FLOAT, KlingLipSyncInputObject, "voice_speed", slider=True ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } DESCRIPTION = "Kling Lip Sync Text to Video Node. Syncs mouth movements in a video file to a text prompt." @@ -1334,7 +1364,7 @@ class KlingLipSyncTextToVideoNode(KlingLipSyncBase): text: str, voice: str, voice_speed: float, - auth_token: Optional[str] = None, + **kwargs, ): voice_id, voice_language = KlingLipSyncTextToVideoNode.get_voice_config()[voice] return super().api_call( @@ -1344,7 +1374,7 @@ class KlingLipSyncTextToVideoNode(KlingLipSyncBase): voice_id=voice_id, voice_speed=voice_speed, mode="text2video", - auth_token=auth_token, + **kwargs, ) @@ -1381,16 +1411,19 @@ class KlingVirtualTryOnNode(KlingImageGenerationBase): enum_type=KlingVirtualTryOnModelName, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } DESCRIPTION = "Kling Virtual Try On Node. Input a human image and a cloth image to try on the cloth on the human." def get_response( - self, task_id: str, auth_token: Optional[str] = None + self, task_id: str, auth_kwargs: dict[str,str] = None ) -> KlingVirtualTryOnResponse: return poll_until_finished( - auth_token, + auth_kwargs, ApiEndpoint( path=f"{PATH_VIRTUAL_TRY_ON}/{task_id}", method=HttpMethod.GET, @@ -1404,7 +1437,7 @@ class KlingVirtualTryOnNode(KlingImageGenerationBase): human_image: torch.Tensor, cloth_image: torch.Tensor, model_name: KlingVirtualTryOnModelName, - auth_token: Optional[str] = None, + **kwargs, ): initial_operation = SynchronousOperation( endpoint=ApiEndpoint( @@ -1418,14 +1451,14 @@ class KlingVirtualTryOnNode(KlingImageGenerationBase): cloth_image=tensor_to_base64_string(cloth_image), model_name=model_name, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) task_creation_response = initial_operation.execute() validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_token) + final_response = self.get_response(task_id, auth_kwargs=kwargs) validate_image_result_response(final_response) images = get_images_from_response(final_response) @@ -1493,16 +1526,19 @@ class KlingImageGenerationNode(KlingImageGenerationBase): "optional": { "image": (IO.IMAGE, {}), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } DESCRIPTION = "Kling Image Generation Node. Generate an image from a text prompt with an optional reference image." def get_response( - self, task_id: str, auth_token: Optional[str] = None + self, task_id: str, auth_kwargs: Optional[dict[str,str]] = None ) -> KlingImageGenerationsResponse: return poll_until_finished( - auth_token, + auth_kwargs, ApiEndpoint( path=f"{PATH_IMAGE_GENERATIONS}/{task_id}", method=HttpMethod.GET, @@ -1522,7 +1558,7 @@ class KlingImageGenerationNode(KlingImageGenerationBase): n: int, aspect_ratio: KlingImageGenAspectRatio, image: Optional[torch.Tensor] = None, - auth_token: Optional[str] = None, + **kwargs, ): self.validate_prompt(prompt, negative_prompt) @@ -1547,14 +1583,14 @@ class KlingImageGenerationNode(KlingImageGenerationBase): n=n, aspect_ratio=aspect_ratio, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) task_creation_response = initial_operation.execute() validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_token) + final_response = self.get_response(task_id, auth_kwargs=kwargs) validate_image_result_response(final_response) images = get_images_from_response(final_response) diff --git a/comfy_api_nodes/nodes_luma.py b/comfy_api_nodes/nodes_luma.py index 0f0d9aa80..bd33a53e0 100644 --- a/comfy_api_nodes/nodes_luma.py +++ b/comfy_api_nodes/nodes_luma.py @@ -1,4 +1,6 @@ +from __future__ import annotations from inspect import cleandoc +from typing import Optional from comfy.comfy_types.node_typing import IO, ComfyNodeABC from comfy_api.input_impl.video_types import VideoFromFile from comfy_api_nodes.apis.luma_api import ( @@ -201,6 +203,7 @@ class LumaImageGenerationNode(ComfyNodeABC): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -214,7 +217,6 @@ class LumaImageGenerationNode(ComfyNodeABC): image_luma_ref: LumaReferenceChain = None, style_image: torch.Tensor = None, character_image: torch.Tensor = None, - auth_token=None, **kwargs, ): validate_string(prompt, strip_whitespace=True, min_length=3) @@ -222,19 +224,19 @@ class LumaImageGenerationNode(ComfyNodeABC): api_image_ref = None if image_luma_ref is not None: api_image_ref = self._convert_luma_refs( - image_luma_ref, max_refs=4, auth_token=auth_token + image_luma_ref, max_refs=4, auth_kwargs=kwargs, ) # handle style_luma_ref api_style_ref = None if style_image is not None: api_style_ref = self._convert_style_image( - style_image, weight=style_image_weight, auth_token=auth_token + style_image, weight=style_image_weight, auth_kwargs=kwargs, ) # handle character_ref images character_ref = None if character_image is not None: download_urls = upload_images_to_comfyapi( - character_image, max_images=4, auth_token=auth_token + character_image, max_images=4, auth_kwargs=kwargs, ) character_ref = LumaCharacterRef( identity0=LumaImageIdentity(images=download_urls) @@ -255,7 +257,7 @@ class LumaImageGenerationNode(ComfyNodeABC): style_ref=api_style_ref, character_ref=character_ref, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) response_api: LumaGeneration = operation.execute() @@ -269,7 +271,7 @@ class LumaImageGenerationNode(ComfyNodeABC): completed_statuses=[LumaState.completed], failed_statuses=[LumaState.failed], status_extractor=lambda x: x.state, - auth_token=auth_token, + auth_kwargs=kwargs, ) response_poll = operation.execute() @@ -278,13 +280,13 @@ class LumaImageGenerationNode(ComfyNodeABC): return (img,) def _convert_luma_refs( - self, luma_ref: LumaReferenceChain, max_refs: int, auth_token=None + self, luma_ref: LumaReferenceChain, max_refs: int, auth_kwargs: Optional[dict[str,str]] = None ): luma_urls = [] ref_count = 0 for ref in luma_ref.refs: download_urls = upload_images_to_comfyapi( - ref.image, max_images=1, auth_token=auth_token + ref.image, max_images=1, auth_kwargs=auth_kwargs ) luma_urls.append(download_urls[0]) ref_count += 1 @@ -293,12 +295,12 @@ class LumaImageGenerationNode(ComfyNodeABC): return luma_ref.create_api_model(download_urls=luma_urls, max_refs=max_refs) def _convert_style_image( - self, style_image: torch.Tensor, weight: float, auth_token=None + self, style_image: torch.Tensor, weight: float, auth_kwargs: Optional[dict[str,str]] = None ): chain = LumaReferenceChain( first_ref=LumaReference(image=style_image, weight=weight) ) - return self._convert_luma_refs(chain, max_refs=1, auth_token=auth_token) + return self._convert_luma_refs(chain, max_refs=1, auth_kwargs=auth_kwargs) class LumaImageModifyNode(ComfyNodeABC): @@ -350,6 +352,7 @@ class LumaImageModifyNode(ComfyNodeABC): "optional": {}, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -360,12 +363,11 @@ class LumaImageModifyNode(ComfyNodeABC): image: torch.Tensor, image_weight: float, seed, - auth_token=None, **kwargs, ): # first, upload image download_urls = upload_images_to_comfyapi( - image, max_images=1, auth_token=auth_token + image, max_images=1, auth_kwargs=kwargs, ) image_url = download_urls[0] # next, make Luma call with download url provided @@ -383,7 +385,7 @@ class LumaImageModifyNode(ComfyNodeABC): url=image_url, weight=round(max(min(1.0-image_weight, 0.98), 0.0), 2) ), ), - auth_token=auth_token, + auth_kwargs=kwargs, ) response_api: LumaGeneration = operation.execute() @@ -397,7 +399,7 @@ class LumaImageModifyNode(ComfyNodeABC): completed_statuses=[LumaState.completed], failed_statuses=[LumaState.failed], status_extractor=lambda x: x.state, - auth_token=auth_token, + auth_kwargs=kwargs, ) response_poll = operation.execute() @@ -470,6 +472,7 @@ class LumaTextToVideoGenerationNode(ComfyNodeABC): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -483,7 +486,6 @@ class LumaTextToVideoGenerationNode(ComfyNodeABC): loop: bool, seed, luma_concepts: LumaConceptChain = None, - auth_token=None, **kwargs, ): validate_string(prompt, strip_whitespace=False, min_length=3) @@ -506,7 +508,7 @@ class LumaTextToVideoGenerationNode(ComfyNodeABC): loop=loop, concepts=luma_concepts.create_api_model() if luma_concepts else None, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) response_api: LumaGeneration = operation.execute() @@ -520,7 +522,7 @@ class LumaTextToVideoGenerationNode(ComfyNodeABC): completed_statuses=[LumaState.completed], failed_statuses=[LumaState.failed], status_extractor=lambda x: x.state, - auth_token=auth_token, + auth_kwargs=kwargs, ) response_poll = operation.execute() @@ -594,6 +596,7 @@ class LumaImageToVideoGenerationNode(ComfyNodeABC): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -608,14 +611,13 @@ class LumaImageToVideoGenerationNode(ComfyNodeABC): first_image: torch.Tensor = None, last_image: torch.Tensor = None, luma_concepts: LumaConceptChain = None, - auth_token=None, **kwargs, ): if first_image is None and last_image is None: raise Exception( "At least one of first_image and last_image requires an input." ) - keyframes = self._convert_to_keyframes(first_image, last_image, auth_token) + keyframes = self._convert_to_keyframes(first_image, last_image, auth_kwargs=kwargs) duration = duration if model != LumaVideoModel.ray_1_6 else None resolution = resolution if model != LumaVideoModel.ray_1_6 else None @@ -636,7 +638,7 @@ class LumaImageToVideoGenerationNode(ComfyNodeABC): keyframes=keyframes, concepts=luma_concepts.create_api_model() if luma_concepts else None, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) response_api: LumaGeneration = operation.execute() @@ -650,7 +652,7 @@ class LumaImageToVideoGenerationNode(ComfyNodeABC): completed_statuses=[LumaState.completed], failed_statuses=[LumaState.failed], status_extractor=lambda x: x.state, - auth_token=auth_token, + auth_kwargs=kwargs, ) response_poll = operation.execute() @@ -661,7 +663,7 @@ class LumaImageToVideoGenerationNode(ComfyNodeABC): self, first_image: torch.Tensor = None, last_image: torch.Tensor = None, - auth_token=None, + auth_kwargs: Optional[dict[str,str]] = None, ): if first_image is None and last_image is None: return None @@ -669,12 +671,12 @@ class LumaImageToVideoGenerationNode(ComfyNodeABC): frame1 = None if first_image is not None: download_urls = upload_images_to_comfyapi( - first_image, max_images=1, auth_token=auth_token + first_image, max_images=1, auth_kwargs=auth_kwargs, ) frame0 = LumaImageReference(type="image", url=download_urls[0]) if last_image is not None: download_urls = upload_images_to_comfyapi( - last_image, max_images=1, auth_token=auth_token + last_image, max_images=1, auth_kwargs=auth_kwargs, ) frame1 = LumaImageReference(type="image", url=download_urls[0]) return LumaKeyframes(frame0=frame0, frame1=frame1) diff --git a/comfy_api_nodes/nodes_minimax.py b/comfy_api_nodes/nodes_minimax.py index cacda22c6..fd64aeb0b 100644 --- a/comfy_api_nodes/nodes_minimax.py +++ b/comfy_api_nodes/nodes_minimax.py @@ -67,6 +67,7 @@ class MinimaxTextToVideoNode: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -84,7 +85,7 @@ class MinimaxTextToVideoNode: model="T2V-01", image: torch.Tensor=None, # used for ImageToVideo subject: torch.Tensor=None, # used for SubjectToVideo - auth_token=None, + **kwargs, ): ''' Function used between MiniMax nodes - supports T2V, I2V, and S2V, based on provided arguments. @@ -94,12 +95,12 @@ class MinimaxTextToVideoNode: # upload image, if passed in image_url = None if image is not None: - image_url = upload_images_to_comfyapi(image, max_images=1, auth_token=auth_token)[0] + image_url = upload_images_to_comfyapi(image, max_images=1, auth_kwargs=kwargs)[0] # TODO: figure out how to deal with subject properly, API returns invalid params when using S2V-01 model subject_reference = None if subject is not None: - subject_url = upload_images_to_comfyapi(subject, max_images=1, auth_token=auth_token)[0] + subject_url = upload_images_to_comfyapi(subject, max_images=1, auth_kwargs=kwargs)[0] subject_reference = [SubjectReferenceItem(image=subject_url)] @@ -118,7 +119,7 @@ class MinimaxTextToVideoNode: subject_reference=subject_reference, prompt_optimizer=None, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) response = video_generate_operation.execute() @@ -137,7 +138,7 @@ class MinimaxTextToVideoNode: completed_statuses=["Success"], failed_statuses=["Fail"], status_extractor=lambda x: x.status.value, - auth_token=auth_token, + auth_kwargs=kwargs, ) task_result = video_generate_operation.execute() @@ -153,7 +154,7 @@ class MinimaxTextToVideoNode: query_params={"file_id": int(file_id)}, ), request=EmptyRequest(), - auth_token=auth_token, + auth_kwargs=kwargs, ) file_result = file_retrieve_operation.execute() @@ -221,6 +222,7 @@ class MinimaxImageToVideoNode(MinimaxTextToVideoNode): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -279,6 +281,7 @@ class MinimaxSubjectToVideoNode(MinimaxTextToVideoNode): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } diff --git a/comfy_api_nodes/nodes_openai.py b/comfy_api_nodes/nodes_openai.py index c18c65d7a..c63908be2 100644 --- a/comfy_api_nodes/nodes_openai.py +++ b/comfy_api_nodes/nodes_openai.py @@ -93,7 +93,10 @@ class OpenAIDalle2(ComfyNodeABC): }, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } RETURN_TYPES = (IO.IMAGE,) @@ -110,7 +113,7 @@ class OpenAIDalle2(ComfyNodeABC): mask=None, n=1, size="1024x1024", - auth_token=None, + **kwargs ): validate_string(prompt, strip_whitespace=False) model = "dall-e-2" @@ -168,7 +171,7 @@ class OpenAIDalle2(ComfyNodeABC): else None ), content_type=content_type, - auth_token=auth_token, + auth_kwargs=kwargs, ) response = operation.execute() @@ -236,7 +239,10 @@ class OpenAIDalle3(ComfyNodeABC): }, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } RETURN_TYPES = (IO.IMAGE,) @@ -252,7 +258,7 @@ class OpenAIDalle3(ComfyNodeABC): style="natural", quality="standard", size="1024x1024", - auth_token=None, + **kwargs ): validate_string(prompt, strip_whitespace=False) model = "dall-e-3" @@ -273,7 +279,7 @@ class OpenAIDalle3(ComfyNodeABC): style=style, seed=seed, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) response = operation.execute() @@ -366,7 +372,10 @@ class OpenAIGPTImage1(ComfyNodeABC): }, ), }, - "hidden": {"auth_token": "AUTH_TOKEN_COMFY_ORG"}, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, } RETURN_TYPES = (IO.IMAGE,) @@ -385,7 +394,7 @@ class OpenAIGPTImage1(ComfyNodeABC): mask=None, n=1, size="1024x1024", - auth_token=None, + **kwargs ): validate_string(prompt, strip_whitespace=False) model = "gpt-image-1" @@ -462,7 +471,7 @@ class OpenAIGPTImage1(ComfyNodeABC): ), files=files if files else None, content_type=content_type, - auth_token=auth_token, + auth_kwargs=kwargs, ) response = operation.execute() diff --git a/comfy_api_nodes/nodes_pika.py b/comfy_api_nodes/nodes_pika.py index ba4e8457d..08ec9cf07 100644 --- a/comfy_api_nodes/nodes_pika.py +++ b/comfy_api_nodes/nodes_pika.py @@ -3,6 +3,7 @@ Pika x ComfyUI API Nodes Pika API docs: https://pika-827374fb.mintlify.app/api-reference """ +from __future__ import annotations import io from typing import Optional, TypeVar @@ -120,7 +121,7 @@ class PikaNodeBase(ComfyNodeABC): RETURN_TYPES = ("VIDEO",) def poll_for_task_status( - self, task_id: str, auth_token: str + self, task_id: str, auth_kwargs: Optional[dict[str,str]] = None ) -> PikaGenerateResponse: polling_operation = PollingOperation( poll_endpoint=ApiEndpoint( @@ -139,20 +140,20 @@ class PikaNodeBase(ComfyNodeABC): progress_extractor=lambda response: ( response.progress if hasattr(response, "progress") else None ), - auth_token=auth_token, + auth_kwargs=auth_kwargs, ) return polling_operation.execute() def execute_task( self, initial_operation: SynchronousOperation[R, PikaGenerateResponse], - auth_token: Optional[str] = None, + auth_kwargs: Optional[dict[str,str]] = None, ) -> tuple[VideoFromFile]: """Executes the initial operation then polls for the task status until it is completed. Args: initial_operation: The initial operation to execute. - auth_token: The authentication token to use for the API call. + auth_kwargs: The authentication token(s) to use for the API call. Returns: A tuple containing the video file as a VIDEO output. @@ -164,7 +165,7 @@ class PikaNodeBase(ComfyNodeABC): raise PikaApiError(error_msg) task_id = initial_response.video_id - final_response = self.poll_for_task_status(task_id, auth_token) + final_response = self.poll_for_task_status(task_id, auth_kwargs) if not is_valid_video_response(final_response): error_msg = ( f"Pika task {task_id} succeeded but no video data found in response." @@ -193,6 +194,7 @@ class PikaImageToVideoV2_2(PikaNodeBase): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -206,7 +208,7 @@ class PikaImageToVideoV2_2(PikaNodeBase): seed: int, resolution: str, duration: int, - auth_token: Optional[str] = None, + **kwargs ) -> tuple[VideoFromFile]: # Convert image to BytesIO image_bytes_io = tensor_to_bytesio(image) @@ -233,10 +235,10 @@ class PikaImageToVideoV2_2(PikaNodeBase): request=pika_request_data, files=pika_files, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=kwargs, ) - return self.execute_task(initial_operation, auth_token) + return self.execute_task(initial_operation, auth_kwargs=kwargs) class PikaTextToVideoNodeV2_2(PikaNodeBase): @@ -259,6 +261,7 @@ class PikaTextToVideoNodeV2_2(PikaNodeBase): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -272,7 +275,7 @@ class PikaTextToVideoNodeV2_2(PikaNodeBase): resolution: str, duration: int, aspect_ratio: float, - auth_token: Optional[str] = None, + **kwargs, ) -> tuple[VideoFromFile]: initial_operation = SynchronousOperation( endpoint=ApiEndpoint( @@ -289,11 +292,11 @@ class PikaTextToVideoNodeV2_2(PikaNodeBase): duration=duration, aspectRatio=aspect_ratio, ), - auth_token=auth_token, + auth_kwargs=kwargs, content_type="application/x-www-form-urlencoded", ) - return self.execute_task(initial_operation, auth_token) + return self.execute_task(initial_operation, auth_kwargs=kwargs) class PikaScenesV2_2(PikaNodeBase): @@ -336,6 +339,7 @@ class PikaScenesV2_2(PikaNodeBase): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -355,7 +359,7 @@ class PikaScenesV2_2(PikaNodeBase): image_ingredient_3: Optional[torch.Tensor] = None, image_ingredient_4: Optional[torch.Tensor] = None, image_ingredient_5: Optional[torch.Tensor] = None, - auth_token: Optional[str] = None, + **kwargs, ) -> tuple[VideoFromFile]: # Convert all passed images to BytesIO all_image_bytes_io = [] @@ -396,10 +400,10 @@ class PikaScenesV2_2(PikaNodeBase): request=pika_request_data, files=pika_files, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=kwargs, ) - return self.execute_task(initial_operation, auth_token) + return self.execute_task(initial_operation, auth_kwargs=kwargs) class PikAdditionsNode(PikaNodeBase): @@ -434,6 +438,7 @@ class PikAdditionsNode(PikaNodeBase): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -446,7 +451,7 @@ class PikAdditionsNode(PikaNodeBase): prompt_text: str, negative_prompt: str, seed: int, - auth_token: Optional[str] = None, + **kwargs, ) -> tuple[VideoFromFile]: # Convert video to BytesIO video_bytes_io = io.BytesIO() @@ -479,10 +484,10 @@ class PikAdditionsNode(PikaNodeBase): request=pika_request_data, files=pika_files, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=kwargs, ) - return self.execute_task(initial_operation, auth_token) + return self.execute_task(initial_operation, auth_kwargs=kwargs) class PikaSwapsNode(PikaNodeBase): @@ -526,6 +531,7 @@ class PikaSwapsNode(PikaNodeBase): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -540,7 +546,7 @@ class PikaSwapsNode(PikaNodeBase): prompt_text: str, negative_prompt: str, seed: int, - auth_token: Optional[str] = None, + **kwargs, ) -> tuple[VideoFromFile]: # Convert video to BytesIO video_bytes_io = io.BytesIO() @@ -583,10 +589,10 @@ class PikaSwapsNode(PikaNodeBase): request=pika_request_data, files=pika_files, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=kwargs, ) - return self.execute_task(initial_operation, auth_token) + return self.execute_task(initial_operation, auth_kwargs=kwargs) class PikaffectsNode(PikaNodeBase): @@ -630,6 +636,7 @@ class PikaffectsNode(PikaNodeBase): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -642,7 +649,7 @@ class PikaffectsNode(PikaNodeBase): prompt_text: str, negative_prompt: str, seed: int, - auth_token: Optional[str] = None, + **kwargs, ) -> tuple[VideoFromFile]: initial_operation = SynchronousOperation( @@ -660,10 +667,10 @@ class PikaffectsNode(PikaNodeBase): ), files={"image": ("image.png", tensor_to_bytesio(image), "image/png")}, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=kwargs, ) - return self.execute_task(initial_operation, auth_token) + return self.execute_task(initial_operation, auth_kwargs=kwargs) class PikaStartEndFrameNode2_2(PikaNodeBase): @@ -681,6 +688,7 @@ class PikaStartEndFrameNode2_2(PikaNodeBase): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -695,7 +703,7 @@ class PikaStartEndFrameNode2_2(PikaNodeBase): seed: int, resolution: str, duration: int, - auth_token: Optional[str] = None, + **kwargs, ) -> tuple[VideoFromFile]: pika_files = [ @@ -722,10 +730,10 @@ class PikaStartEndFrameNode2_2(PikaNodeBase): ), files=pika_files, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=kwargs, ) - return self.execute_task(initial_operation, auth_token) + return self.execute_task(initial_operation, auth_kwargs=kwargs) NODE_CLASS_MAPPINGS = { diff --git a/comfy_api_nodes/nodes_pixverse.py b/comfy_api_nodes/nodes_pixverse.py index dbb90c1dd..0c29e77c2 100644 --- a/comfy_api_nodes/nodes_pixverse.py +++ b/comfy_api_nodes/nodes_pixverse.py @@ -34,7 +34,7 @@ import requests from io import BytesIO -def upload_image_to_pixverse(image: torch.Tensor, auth_token=None): +def upload_image_to_pixverse(image: torch.Tensor, auth_kwargs=None): # first, upload image to Pixverse and get image id to use in actual generation call files = { "image": tensor_to_bytesio(image) @@ -49,7 +49,7 @@ def upload_image_to_pixverse(image: torch.Tensor, auth_token=None): request=EmptyRequest(), files=files, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=auth_kwargs, ) response_upload: PixverseImageUploadResponse = operation.execute() @@ -148,6 +148,7 @@ class PixverseTextToVideoNode(ComfyNodeABC): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -161,7 +162,6 @@ class PixverseTextToVideoNode(ComfyNodeABC): seed, negative_prompt: str=None, pixverse_template: int=None, - auth_token=None, **kwargs, ): validate_string(prompt, strip_whitespace=False) @@ -190,7 +190,7 @@ class PixverseTextToVideoNode(ComfyNodeABC): template_id=pixverse_template, seed=seed, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) response_api = operation.execute() @@ -207,7 +207,7 @@ class PixverseTextToVideoNode(ComfyNodeABC): completed_statuses=[PixverseStatus.successful], failed_statuses=[PixverseStatus.contents_moderation, PixverseStatus.failed, PixverseStatus.deleted], status_extractor=lambda x: x.Resp.status, - auth_token=auth_token, + auth_kwargs=kwargs, ) response_poll = operation.execute() @@ -278,6 +278,7 @@ class PixverseImageToVideoNode(ComfyNodeABC): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -291,11 +292,10 @@ class PixverseImageToVideoNode(ComfyNodeABC): seed, negative_prompt: str=None, pixverse_template: int=None, - auth_token=None, **kwargs, ): validate_string(prompt, strip_whitespace=False) - img_id = upload_image_to_pixverse(image, auth_token=auth_token) + img_id = upload_image_to_pixverse(image, auth_kwargs=kwargs) # 1080p is limited to 5 seconds duration # only normal motion_mode supported for 1080p or for non-5 second duration @@ -322,7 +322,7 @@ class PixverseImageToVideoNode(ComfyNodeABC): template_id=pixverse_template, seed=seed, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) response_api = operation.execute() @@ -339,7 +339,7 @@ class PixverseImageToVideoNode(ComfyNodeABC): completed_statuses=[PixverseStatus.successful], failed_statuses=[PixverseStatus.contents_moderation, PixverseStatus.failed, PixverseStatus.deleted], status_extractor=lambda x: x.Resp.status, - auth_token=auth_token, + auth_kwargs=kwargs, ) response_poll = operation.execute() @@ -407,6 +407,7 @@ class PixverseTransitionVideoNode(ComfyNodeABC): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -420,12 +421,11 @@ class PixverseTransitionVideoNode(ComfyNodeABC): motion_mode: str, seed, negative_prompt: str=None, - auth_token=None, **kwargs, ): validate_string(prompt, strip_whitespace=False) - first_frame_id = upload_image_to_pixverse(first_frame, auth_token=auth_token) - last_frame_id = upload_image_to_pixverse(last_frame, auth_token=auth_token) + first_frame_id = upload_image_to_pixverse(first_frame, auth_kwargs=kwargs) + last_frame_id = upload_image_to_pixverse(last_frame, auth_kwargs=kwargs) # 1080p is limited to 5 seconds duration # only normal motion_mode supported for 1080p or for non-5 second duration @@ -452,7 +452,7 @@ class PixverseTransitionVideoNode(ComfyNodeABC): negative_prompt=negative_prompt if negative_prompt else None, seed=seed, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) response_api = operation.execute() @@ -469,7 +469,7 @@ class PixverseTransitionVideoNode(ComfyNodeABC): completed_statuses=[PixverseStatus.successful], failed_statuses=[PixverseStatus.contents_moderation, PixverseStatus.failed, PixverseStatus.deleted], status_extractor=lambda x: x.Resp.status, - auth_token=auth_token, + auth_kwargs=kwargs, ) response_poll = operation.execute() diff --git a/comfy_api_nodes/nodes_recraft.py b/comfy_api_nodes/nodes_recraft.py index 5c89d21e9..767d93e3c 100644 --- a/comfy_api_nodes/nodes_recraft.py +++ b/comfy_api_nodes/nodes_recraft.py @@ -41,7 +41,7 @@ def handle_recraft_file_request( total_pixels=4096*4096, timeout=1024, request=None, - auth_token=None + auth_kwargs: dict[str,str] = None, ) -> list[BytesIO]: """ Handle sending common Recraft file-only request to get back file bytes. @@ -65,7 +65,7 @@ def handle_recraft_file_request( request=request, files=files, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=auth_kwargs, multipart_parser=recraft_multipart_parser, ) response: RecraftImageGenerationResponse = operation.execute() @@ -387,6 +387,7 @@ class RecraftTextToImageNode: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -399,7 +400,6 @@ class RecraftTextToImageNode: recraft_style: RecraftStyle = None, negative_prompt: str = None, recraft_controls: RecraftControls = None, - auth_token=None, **kwargs, ): validate_string(prompt, strip_whitespace=False, max_length=1000) @@ -432,7 +432,7 @@ class RecraftTextToImageNode: style_id=recraft_style.style_id, controls=controls_api, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) response: RecraftImageGenerationResponse = operation.execute() images = [] @@ -522,6 +522,7 @@ class RecraftImageToImageNode: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -532,7 +533,6 @@ class RecraftImageToImageNode: n: int, strength: float, seed, - auth_token=None, recraft_style: RecraftStyle = None, negative_prompt: str = None, recraft_controls: RecraftControls = None, @@ -570,7 +570,7 @@ class RecraftImageToImageNode: image=image[i], path="/proxy/recraft/images/imageToImage", request=request, - auth_token=auth_token, + auth_kwargs=kwargs, ) with handle_recraft_image_output(): images.append(torch.cat([bytesio_to_image_tensor(x) for x in sub_bytes], dim=0)) @@ -638,6 +638,7 @@ class RecraftImageInpaintingNode: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -648,7 +649,6 @@ class RecraftImageInpaintingNode: prompt: str, n: int, seed, - auth_token=None, recraft_style: RecraftStyle = None, negative_prompt: str = None, **kwargs, @@ -683,7 +683,7 @@ class RecraftImageInpaintingNode: mask=mask[i:i+1], path="/proxy/recraft/images/inpaint", request=request, - auth_token=auth_token, + auth_kwargs=kwargs, ) with handle_recraft_image_output(): images.append(torch.cat([bytesio_to_image_tensor(x) for x in sub_bytes], dim=0)) @@ -762,6 +762,7 @@ class RecraftTextToVectorNode: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -774,7 +775,6 @@ class RecraftTextToVectorNode: seed, negative_prompt: str = None, recraft_controls: RecraftControls = None, - auth_token=None, **kwargs, ): validate_string(prompt, strip_whitespace=False, max_length=1000) @@ -805,7 +805,7 @@ class RecraftTextToVectorNode: substyle=recraft_style.substyle, controls=controls_api, ), - auth_token=auth_token, + auth_kwargs=kwargs, ) response: RecraftImageGenerationResponse = operation.execute() svg_data = [] @@ -836,13 +836,13 @@ class RecraftVectorizeImageNode: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } def api_call( self, image: torch.Tensor, - auth_token=None, **kwargs, ): svgs = [] @@ -852,7 +852,7 @@ class RecraftVectorizeImageNode: sub_bytes = handle_recraft_file_request( image=image[i], path="/proxy/recraft/images/vectorize", - auth_token=auth_token, + auth_kwargs=kwargs, ) svgs.append(SVG(sub_bytes)) pbar.update(1) @@ -917,6 +917,7 @@ class RecraftReplaceBackgroundNode: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -926,7 +927,6 @@ class RecraftReplaceBackgroundNode: prompt: str, n: int, seed, - auth_token=None, recraft_style: RecraftStyle = None, negative_prompt: str = None, **kwargs, @@ -956,7 +956,7 @@ class RecraftReplaceBackgroundNode: image=image[i], path="/proxy/recraft/images/replaceBackground", request=request, - auth_token=auth_token, + auth_kwargs=kwargs, ) images.append(torch.cat([bytesio_to_image_tensor(x) for x in sub_bytes], dim=0)) pbar.update(1) @@ -986,13 +986,13 @@ class RecraftRemoveBackgroundNode: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } def api_call( self, image: torch.Tensor, - auth_token=None, **kwargs, ): images = [] @@ -1002,7 +1002,7 @@ class RecraftRemoveBackgroundNode: sub_bytes = handle_recraft_file_request( image=image[i], path="/proxy/recraft/images/removeBackground", - auth_token=auth_token, + auth_kwargs=kwargs, ) images.append(torch.cat([bytesio_to_image_tensor(x) for x in sub_bytes], dim=0)) pbar.update(1) @@ -1037,13 +1037,13 @@ class RecraftCrispUpscaleNode: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } def api_call( self, image: torch.Tensor, - auth_token=None, **kwargs, ): images = [] @@ -1053,7 +1053,7 @@ class RecraftCrispUpscaleNode: sub_bytes = handle_recraft_file_request( image=image[i], path=self.RECRAFT_PATH, - auth_token=auth_token, + auth_kwargs=kwargs, ) images.append(torch.cat([bytesio_to_image_tensor(x) for x in sub_bytes], dim=0)) pbar.update(1) diff --git a/comfy_api_nodes/nodes_stability.py b/comfy_api_nodes/nodes_stability.py index 52fe2417c..02e421678 100644 --- a/comfy_api_nodes/nodes_stability.py +++ b/comfy_api_nodes/nodes_stability.py @@ -120,12 +120,13 @@ class StabilityStableImageUltraNode: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } def api_call(self, prompt: str, aspect_ratio: str, style_preset: str, seed: int, negative_prompt: str=None, image: torch.Tensor = None, image_denoise: float=None, - auth_token=None): + **kwargs): validate_string(prompt, strip_whitespace=False) # prepare image binary if image present image_binary = None @@ -160,7 +161,7 @@ class StabilityStableImageUltraNode: ), files=files, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=kwargs, ) response_api = operation.execute() @@ -252,12 +253,13 @@ class StabilityStableImageSD_3_5Node: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } def api_call(self, model: str, prompt: str, aspect_ratio: str, style_preset: str, seed: int, cfg_scale: float, negative_prompt: str=None, image: torch.Tensor = None, image_denoise: float=None, - auth_token=None): + **kwargs): validate_string(prompt, strip_whitespace=False) # prepare image binary if image present image_binary = None @@ -298,7 +300,7 @@ class StabilityStableImageSD_3_5Node: ), files=files, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=kwargs, ) response_api = operation.execute() @@ -368,11 +370,12 @@ class StabilityUpscaleConservativeNode: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } def api_call(self, image: torch.Tensor, prompt: str, creativity: float, seed: int, negative_prompt: str=None, - auth_token=None): + **kwargs): validate_string(prompt, strip_whitespace=False) image_binary = tensor_to_bytesio(image, total_pixels=1024*1024).read() @@ -398,7 +401,7 @@ class StabilityUpscaleConservativeNode: ), files=files, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=kwargs, ) response_api = operation.execute() @@ -473,11 +476,12 @@ class StabilityUpscaleCreativeNode: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } def api_call(self, image: torch.Tensor, prompt: str, creativity: float, style_preset: str, seed: int, negative_prompt: str=None, - auth_token=None): + **kwargs): validate_string(prompt, strip_whitespace=False) image_binary = tensor_to_bytesio(image, total_pixels=1024*1024).read() @@ -506,7 +510,7 @@ class StabilityUpscaleCreativeNode: ), files=files, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=kwargs, ) response_api = operation.execute() @@ -521,7 +525,7 @@ class StabilityUpscaleCreativeNode: completed_statuses=[StabilityPollStatus.finished], failed_statuses=[StabilityPollStatus.failed], status_extractor=lambda x: get_async_dummy_status(x), - auth_token=auth_token, + auth_kwargs=kwargs, ) response_poll: StabilityResultsGetResponse = operation.execute() @@ -555,11 +559,12 @@ class StabilityUpscaleFastNode: }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } def api_call(self, image: torch.Tensor, - auth_token=None): + **kwargs): image_binary = tensor_to_bytesio(image, total_pixels=4096*4096).read() files = { @@ -576,7 +581,7 @@ class StabilityUpscaleFastNode: request=EmptyRequest(), files=files, content_type="multipart/form-data", - auth_token=auth_token, + auth_kwargs=kwargs, ) response_api = operation.execute() diff --git a/comfy_api_nodes/nodes_veo2.py b/comfy_api_nodes/nodes_veo2.py index 9233944b5..2740179c8 100644 --- a/comfy_api_nodes/nodes_veo2.py +++ b/comfy_api_nodes/nodes_veo2.py @@ -114,6 +114,7 @@ class VeoVideoGenerationNode(ComfyNodeABC): }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", }, } @@ -133,7 +134,7 @@ class VeoVideoGenerationNode(ComfyNodeABC): person_generation="ALLOW", seed=0, image=None, - auth_token=None, + **kwargs, ): # Prepare the instances for the request instances = [] @@ -179,7 +180,7 @@ class VeoVideoGenerationNode(ComfyNodeABC): instances=instances, parameters=parameters ), - auth_token=auth_token + auth_kwargs=kwargs, ) initial_response = initial_operation.execute() @@ -213,7 +214,7 @@ class VeoVideoGenerationNode(ComfyNodeABC): request=Veo2GenVidPollRequest( operationName=operation_name ), - auth_token=auth_token, + auth_kwargs=kwargs, poll_interval=5.0 ) diff --git a/execution.py b/execution.py index feb61ae82..e5d1c69d9 100644 --- a/execution.py +++ b/execution.py @@ -146,6 +146,8 @@ def get_input_data(inputs, class_def, unique_id, outputs=None, dynprompt=None, e input_data_all[x] = [unique_id] if h[x] == "AUTH_TOKEN_COMFY_ORG": input_data_all[x] = [extra_data.get("auth_token_comfy_org", None)] + if h[x] == "API_KEY_COMFY_ORG": + input_data_all[x] = [extra_data.get("api_key_comfy_org", None)] return input_data_all, missing_keys map_node_over_list = None #Don't hook this please diff --git a/requirements.txt b/requirements.txt index 29cf0e2ac..01aab4ca2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -comfyui-frontend-package==1.18.9 -comfyui-workflow-templates==0.1.11 +comfyui-frontend-package==1.18.10 +comfyui-workflow-templates==0.1.14 torch torchsde torchvision From 577de83ca9c99e997825439e017113456c4c78f7 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sun, 11 May 2025 01:58:00 -0700 Subject: [PATCH 425/478] ACE VAE works in fp16. (#8055) --- comfy/sd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/sd.py b/comfy/sd.py index ee350d5b5..e98a3aa87 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -451,7 +451,7 @@ class VAE: self.latent_dim = 2 self.process_output = lambda audio: audio self.process_input = lambda audio: audio - self.working_dtypes = [torch.bfloat16, torch.float32] + self.working_dtypes = [torch.bfloat16, torch.float16, torch.float32] self.disable_offload = True self.extra_1d_channel = 16 else: From 31e9e36c941bbedd29bb388a052911a65bed1bc4 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Mon, 12 May 2025 10:32:24 -0700 Subject: [PATCH 426/478] remove aspect ratio from kling request (#8062) --- comfy_api_nodes/nodes_kling.py | 1 - 1 file changed, 1 deletion(-) diff --git a/comfy_api_nodes/nodes_kling.py b/comfy_api_nodes/nodes_kling.py index b2be83656..2d0fd8883 100644 --- a/comfy_api_nodes/nodes_kling.py +++ b/comfy_api_nodes/nodes_kling.py @@ -671,7 +671,6 @@ class KlingImage2VideoNode(KlingNodeBase): negative_prompt=negative_prompt if negative_prompt else None, cfg_scale=cfg_scale, mode=KlingVideoGenMode(mode), - aspect_ratio=KlingVideoGenAspectRatio(aspect_ratio), duration=KlingVideoGenDuration(duration), camera_control=camera_control, ), From 640c47e7deeb52978e84716613015cd8bfd93c5c Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Mon, 12 May 2025 11:32:01 -0700 Subject: [PATCH 427/478] Fix torch warning about deprecated function. (#8075) Drop support for torch versions below 2.2 on the audio VAEs. --- comfy/ldm/ace/vae/music_vocoder.py | 22 +++++++++------------- comfy/ldm/audio/autoencoder.py | 10 ++-------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/comfy/ldm/ace/vae/music_vocoder.py b/comfy/ldm/ace/vae/music_vocoder.py index dc7c867da..2f989fa86 100755 --- a/comfy/ldm/ace/vae/music_vocoder.py +++ b/comfy/ldm/ace/vae/music_vocoder.py @@ -8,11 +8,7 @@ from typing import Callable, Tuple, List import numpy as np import torch.nn.functional as F -from torch.nn.utils import weight_norm from torch.nn.utils.parametrize import remove_parametrizations as remove_weight_norm -# from diffusers.models.modeling_utils import ModelMixin -# from diffusers.loaders import FromOriginalModelMixin -# from diffusers.configuration_utils import ConfigMixin, register_to_config from .music_log_mel import LogMelSpectrogram @@ -259,7 +255,7 @@ class ResBlock1(torch.nn.Module): self.convs1 = nn.ModuleList( [ - weight_norm( + torch.nn.utils.parametrizations.weight_norm( ops.Conv1d( channels, channels, @@ -269,7 +265,7 @@ class ResBlock1(torch.nn.Module): padding=get_padding(kernel_size, dilation[0]), ) ), - weight_norm( + torch.nn.utils.parametrizations.weight_norm( ops.Conv1d( channels, channels, @@ -279,7 +275,7 @@ class ResBlock1(torch.nn.Module): padding=get_padding(kernel_size, dilation[1]), ) ), - weight_norm( + torch.nn.utils.parametrizations.weight_norm( ops.Conv1d( channels, channels, @@ -294,7 +290,7 @@ class ResBlock1(torch.nn.Module): self.convs2 = nn.ModuleList( [ - weight_norm( + torch.nn.utils.parametrizations.weight_norm( ops.Conv1d( channels, channels, @@ -304,7 +300,7 @@ class ResBlock1(torch.nn.Module): padding=get_padding(kernel_size, 1), ) ), - weight_norm( + torch.nn.utils.parametrizations.weight_norm( ops.Conv1d( channels, channels, @@ -314,7 +310,7 @@ class ResBlock1(torch.nn.Module): padding=get_padding(kernel_size, 1), ) ), - weight_norm( + torch.nn.utils.parametrizations.weight_norm( ops.Conv1d( channels, channels, @@ -366,7 +362,7 @@ class HiFiGANGenerator(nn.Module): prod(upsample_rates) == hop_length ), f"hop_length must be {prod(upsample_rates)}" - self.conv_pre = weight_norm( + self.conv_pre = torch.nn.utils.parametrizations.weight_norm( ops.Conv1d( num_mels, upsample_initial_channel, @@ -386,7 +382,7 @@ class HiFiGANGenerator(nn.Module): for i, (u, k) in enumerate(zip(upsample_rates, upsample_kernel_sizes)): c_cur = upsample_initial_channel // (2 ** (i + 1)) self.ups.append( - weight_norm( + torch.nn.utils.parametrizations.weight_norm( ops.ConvTranspose1d( upsample_initial_channel // (2**i), upsample_initial_channel // (2 ** (i + 1)), @@ -421,7 +417,7 @@ class HiFiGANGenerator(nn.Module): self.resblocks.append(ResBlock1(ch, k, d)) self.activation_post = post_activation() - self.conv_post = weight_norm( + self.conv_post = torch.nn.utils.parametrizations.weight_norm( ops.Conv1d( ch, 1, diff --git a/comfy/ldm/audio/autoencoder.py b/comfy/ldm/audio/autoencoder.py index 9e7e7c876..78ed6ffa6 100644 --- a/comfy/ldm/audio/autoencoder.py +++ b/comfy/ldm/audio/autoencoder.py @@ -75,16 +75,10 @@ class SnakeBeta(nn.Module): return x def WNConv1d(*args, **kwargs): - try: - return torch.nn.utils.parametrizations.weight_norm(ops.Conv1d(*args, **kwargs)) - except: - return torch.nn.utils.weight_norm(ops.Conv1d(*args, **kwargs)) #support pytorch 2.1 and older + return torch.nn.utils.parametrizations.weight_norm(ops.Conv1d(*args, **kwargs)) def WNConvTranspose1d(*args, **kwargs): - try: - return torch.nn.utils.parametrizations.weight_norm(ops.ConvTranspose1d(*args, **kwargs)) - except: - return torch.nn.utils.weight_norm(ops.ConvTranspose1d(*args, **kwargs)) #support pytorch 2.1 and older + return torch.nn.utils.parametrizations.weight_norm(ops.ConvTranspose1d(*args, **kwargs)) def get_activation(activation: Literal["elu", "snake", "none"], antialias=False, channels=None) -> nn.Module: if activation == "elu": From 158419f3a0017c2ce123484b14b6c527716d6ec8 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Mon, 12 May 2025 15:58:28 -0400 Subject: [PATCH 428/478] ComfyUI version 0.3.34 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 5a73f76e4..b740b378d 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.33" +__version__ = "0.3.34" diff --git a/pyproject.toml b/pyproject.toml index e0be329de..80061b39a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.33" +version = "0.3.34" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From b4abca828e3a76ef565a2f5f519028e689837fc6 Mon Sep 17 00:00:00 2001 From: thot experiment <94414189+thot-experiment@users.noreply.github.com> Date: Mon, 12 May 2025 13:00:01 -0700 Subject: [PATCH 429/478] add opus and mp3 to audio output node (#8019) * first pass at opus and mp3 as well as migrating flac to pyav * minor mp3 encoding fix * fix ruff * delete dead code * split out save audio to separate nodes per filetype * fix ruff --- comfy_extras/nodes_audio.py | 229 +++++++++++++++++++++++++----------- 1 file changed, 160 insertions(+), 69 deletions(-) diff --git a/comfy_extras/nodes_audio.py b/comfy_extras/nodes_audio.py index 136ad6159..49af1eae4 100644 --- a/comfy_extras/nodes_audio.py +++ b/comfy_extras/nodes_audio.py @@ -1,5 +1,6 @@ from __future__ import annotations +import av import torchaudio import torch import comfy.model_management @@ -7,7 +8,6 @@ import folder_paths import os import io import json -import struct import random import hashlib import node_helpers @@ -90,60 +90,118 @@ class VAEDecodeAudio: return ({"waveform": audio, "sample_rate": 44100}, ) -def create_vorbis_comment_block(comment_dict, last_block): - vendor_string = b'ComfyUI' - vendor_length = len(vendor_string) +def save_audio(self, audio, filename_prefix="ComfyUI", format="flac", prompt=None, extra_pnginfo=None, quality="128k"): - comments = [] - for key, value in comment_dict.items(): - comment = f"{key}={value}".encode('utf-8') - comments.append(struct.pack('I', len(comment_data))[1:] + comment_data + # Opus supported sample rates + OPUS_RATES = [8000, 12000, 16000, 24000, 48000] - return comment_block + for (batch_number, waveform) in enumerate(audio["waveform"].cpu()): + filename_with_batch_num = filename.replace("%batch_num%", str(batch_number)) + file = f"{filename_with_batch_num}_{counter:05}_.{format}" + output_path = os.path.join(full_output_folder, file) -def insert_or_replace_vorbis_comment(flac_io, comment_dict): - if len(comment_dict) == 0: - return flac_io + # Use original sample rate initially + sample_rate = audio["sample_rate"] - flac_io.seek(4) + # Handle Opus sample rate requirements + if format == "opus": + if sample_rate > 48000: + sample_rate = 48000 + elif sample_rate not in OPUS_RATES: + # Find the next highest supported rate + for rate in sorted(OPUS_RATES): + if rate > sample_rate: + sample_rate = rate + break + if sample_rate not in OPUS_RATES: # Fallback if still not supported + sample_rate = 48000 - blocks = [] - last_block = False + # Resample if necessary + if sample_rate != audio["sample_rate"]: + waveform = torchaudio.functional.resample(waveform, audio["sample_rate"], sample_rate) - while not last_block: - header = flac_io.read(4) - last_block = (header[0] & 0x80) != 0 - block_type = header[0] & 0x7F - block_length = struct.unpack('>I', b'\x00' + header[1:])[0] - block_data = flac_io.read(block_length) + # Create in-memory WAV buffer + wav_buffer = io.BytesIO() + torchaudio.save(wav_buffer, waveform, sample_rate, format="WAV") + wav_buffer.seek(0) # Rewind for reading - if block_type == 4 or block_type == 1: - pass - else: - header = bytes([(header[0] & (~0x80))]) + header[1:] - blocks.append(header + block_data) + # Use PyAV to convert and add metadata + input_container = av.open(wav_buffer) - blocks.append(create_vorbis_comment_block(comment_dict, last_block=True)) + # Create output with specified format + output_buffer = io.BytesIO() + output_container = av.open(output_buffer, mode='w', format=format) - new_flac_io = io.BytesIO() - new_flac_io.write(b'fLaC') - for block in blocks: - new_flac_io.write(block) + # Set metadata on the container + for key, value in metadata.items(): + output_container.metadata[key] = value - new_flac_io.write(flac_io.read()) - return new_flac_io + # Set up the output stream with appropriate properties + input_container.streams.audio[0] + if format == "opus": + out_stream = output_container.add_stream("libopus", rate=sample_rate) + if quality == "64k": + out_stream.bit_rate = 64000 + elif quality == "96k": + out_stream.bit_rate = 96000 + elif quality == "128k": + out_stream.bit_rate = 128000 + elif quality == "192k": + out_stream.bit_rate = 192000 + elif quality == "320k": + out_stream.bit_rate = 320000 + elif format == "mp3": + out_stream = output_container.add_stream("libmp3lame", rate=sample_rate) + if quality == "V0": + #TODO i would really love to support V3 and V5 but there doesn't seem to be a way to set the qscale level, the property below is a bool + out_stream.codec_context.qscale = 1 + elif quality == "128k": + out_stream.bit_rate = 128000 + elif quality == "320k": + out_stream.bit_rate = 320000 + else: #format == "flac": + out_stream = output_container.add_stream("flac", rate=sample_rate) + # Copy frames from input to output + for frame in input_container.decode(audio=0): + frame.pts = None # Let PyAV handle timestamps + output_container.mux(out_stream.encode(frame)) + + # Flush encoder + output_container.mux(out_stream.encode(None)) + + # Close containers + output_container.close() + input_container.close() + + # Write the output to file + output_buffer.seek(0) + with open(output_path, 'wb') as f: + f.write(output_buffer.getbuffer()) + + results.append({ + "filename": file, + "subfolder": subfolder, + "type": self.type + }) + counter += 1 + + return { "ui": { "audio": results } } + class SaveAudio: def __init__(self): self.output_dir = folder_paths.get_output_directory() @@ -153,50 +211,70 @@ class SaveAudio: @classmethod def INPUT_TYPES(s): return {"required": { "audio": ("AUDIO", ), - "filename_prefix": ("STRING", {"default": "audio/ComfyUI"})}, + "filename_prefix": ("STRING", {"default": "audio/ComfyUI"}), + }, "hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"}, } RETURN_TYPES = () - FUNCTION = "save_audio" + FUNCTION = "save_flac" OUTPUT_NODE = True CATEGORY = "audio" - def save_audio(self, audio, filename_prefix="ComfyUI", prompt=None, extra_pnginfo=None): - filename_prefix += self.prefix_append - full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir) - results: list[FileLocator] = [] + def save_flac(self, audio, filename_prefix="ComfyUI", format="flac", prompt=None, extra_pnginfo=None): + return save_audio(self, audio, filename_prefix, format, prompt, extra_pnginfo) - metadata = {} - if not args.disable_metadata: - if prompt is not None: - metadata["prompt"] = json.dumps(prompt) - if extra_pnginfo is not None: - for x in extra_pnginfo: - metadata[x] = json.dumps(extra_pnginfo[x]) +class SaveAudioMP3: + def __init__(self): + self.output_dir = folder_paths.get_output_directory() + self.type = "output" + self.prefix_append = "" - for (batch_number, waveform) in enumerate(audio["waveform"].cpu()): - filename_with_batch_num = filename.replace("%batch_num%", str(batch_number)) - file = f"{filename_with_batch_num}_{counter:05}_.flac" + @classmethod + def INPUT_TYPES(s): + return {"required": { "audio": ("AUDIO", ), + "filename_prefix": ("STRING", {"default": "audio/ComfyUI"}), + "quality": (["V0", "128k", "320k"], {"default": "V0"}), + }, + "hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"}, + } - buff = io.BytesIO() - torchaudio.save(buff, waveform, audio["sample_rate"], format="FLAC") + RETURN_TYPES = () + FUNCTION = "save_mp3" - buff = insert_or_replace_vorbis_comment(buff, metadata) + OUTPUT_NODE = True - with open(os.path.join(full_output_folder, file), 'wb') as f: - f.write(buff.getbuffer()) + CATEGORY = "audio" - results.append({ - "filename": file, - "subfolder": subfolder, - "type": self.type - }) - counter += 1 + def save_mp3(self, audio, filename_prefix="ComfyUI", format="mp3", prompt=None, extra_pnginfo=None, quality="128k"): + return save_audio(self, audio, filename_prefix, format, prompt, extra_pnginfo, quality) - return { "ui": { "audio": results } } +class SaveAudioOpus: + def __init__(self): + self.output_dir = folder_paths.get_output_directory() + self.type = "output" + self.prefix_append = "" + + @classmethod + def INPUT_TYPES(s): + return {"required": { "audio": ("AUDIO", ), + "filename_prefix": ("STRING", {"default": "audio/ComfyUI"}), + "quality": (["64k", "96k", "128k", "192k", "320k"], {"default": "128k"}), + }, + "hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"}, + } + + RETURN_TYPES = () + FUNCTION = "save_opus" + + OUTPUT_NODE = True + + CATEGORY = "audio" + + def save_opus(self, audio, filename_prefix="ComfyUI", format="opus", prompt=None, extra_pnginfo=None, quality="V3"): + return save_audio(self, audio, filename_prefix, format, prompt, extra_pnginfo, quality) class PreviewAudio(SaveAudio): def __init__(self): @@ -248,7 +326,20 @@ NODE_CLASS_MAPPINGS = { "VAEEncodeAudio": VAEEncodeAudio, "VAEDecodeAudio": VAEDecodeAudio, "SaveAudio": SaveAudio, + "SaveAudioMP3": SaveAudioMP3, + "SaveAudioOpus": SaveAudioOpus, "LoadAudio": LoadAudio, "PreviewAudio": PreviewAudio, "ConditioningStableAudio": ConditioningStableAudio, } + +NODE_DISPLAY_NAME_MAPPINGS = { + "EmptyLatentAudio": "Empty Latent Audio", + "VAEEncodeAudio": "VAE Encode Audio", + "VAEDecodeAudio": "VAE Decode Audio", + "PreviewAudio": "Preview Audio", + "LoadAudio": "Load Audio", + "SaveAudio": "Save Audio (FLAC)", + "SaveAudioMP3": "Save Audio (MP3)", + "SaveAudioOpus": "Save Audio (Opus)", +} From b7ed5f57bda02d7cad3f77abe6de68da6dedc4e4 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Mon, 12 May 2025 16:29:32 -0400 Subject: [PATCH 430/478] string node (#7952) --- comfy_extras/nodes_string.py | 322 +++++++++++++++++++++++++++++++++++ nodes.py | 1 + 2 files changed, 323 insertions(+) create mode 100644 comfy_extras/nodes_string.py diff --git a/comfy_extras/nodes_string.py b/comfy_extras/nodes_string.py new file mode 100644 index 000000000..a852326e5 --- /dev/null +++ b/comfy_extras/nodes_string.py @@ -0,0 +1,322 @@ +import re + +from comfy.comfy_types.node_typing import IO + +class StringConcatenate(): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "string_a": (IO.STRING, {"multiline": True}), + "string_b": (IO.STRING, {"multiline": True}) + } + } + + RETURN_TYPES = (IO.STRING,) + FUNCTION = "execute" + CATEGORY = "utils/string" + + def execute(self, string_a, string_b, **kwargs): + return string_a + string_b, + +class StringSubstring(): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "string": (IO.STRING, {"multiline": True}), + "start": (IO.INT, {}), + "end": (IO.INT, {}), + } + } + + RETURN_TYPES = (IO.STRING,) + FUNCTION = "execute" + CATEGORY = "utils/string" + + def execute(self, string, start, end, **kwargs): + return string[start:end], + +class StringLength(): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "string": (IO.STRING, {"multiline": True}) + } + } + + RETURN_TYPES = (IO.INT,) + RETURN_NAMES = ("length",) + FUNCTION = "execute" + CATEGORY = "utils/string" + + def execute(self, string, **kwargs): + length = len(string) + + return length, + +class CaseConverter(): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "string": (IO.STRING, {"multiline": True}), + "mode": (IO.COMBO, {"options": ["UPPERCASE", "lowercase", "Capitalize", "Title Case"]}) + } + } + + RETURN_TYPES = (IO.STRING,) + FUNCTION = "execute" + CATEGORY = "utils/string" + + def execute(self, string, mode, **kwargs): + if mode == "UPPERCASE": + result = string.upper() + elif mode == "lowercase": + result = string.lower() + elif mode == "Capitalize": + result = string.capitalize() + elif mode == "Title Case": + result = string.title() + else: + result = string + + return result, + + +class StringTrim(): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "string": (IO.STRING, {"multiline": True}), + "mode": (IO.COMBO, {"options": ["Both", "Left", "Right"]}) + } + } + + RETURN_TYPES = (IO.STRING,) + FUNCTION = "execute" + CATEGORY = "utils/string" + + def execute(self, string, mode, **kwargs): + if mode == "Both": + result = string.strip() + elif mode == "Left": + result = string.lstrip() + elif mode == "Right": + result = string.rstrip() + else: + result = string + + return result, + +class StringReplace(): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "string": (IO.STRING, {"multiline": True}), + "find": (IO.STRING, {"multiline": True}), + "replace": (IO.STRING, {"multiline": True}) + } + } + + RETURN_TYPES = (IO.STRING,) + FUNCTION = "execute" + CATEGORY = "utils/string" + + def execute(self, string, find, replace, **kwargs): + result = string.replace(find, replace) + return result, + + +class StringContains(): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "string": (IO.STRING, {"multiline": True}), + "substring": (IO.STRING, {"multiline": True}), + "case_sensitive": (IO.BOOLEAN, {"default": True}) + } + } + + RETURN_TYPES = (IO.BOOLEAN,) + RETURN_NAMES = ("contains",) + FUNCTION = "execute" + CATEGORY = "utils/string" + + def execute(self, string, substring, case_sensitive, **kwargs): + if case_sensitive: + contains = substring in string + else: + contains = substring.lower() in string.lower() + + return contains, + + +class StringCompare(): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "string_a": (IO.STRING, {"multiline": True}), + "string_b": (IO.STRING, {"multiline": True}), + "mode": (IO.COMBO, {"options": ["Starts With", "Ends With", "Equal"]}), + "case_sensitive": (IO.BOOLEAN, {"default": True}) + } + } + + RETURN_TYPES = (IO.BOOLEAN,) + FUNCTION = "execute" + CATEGORY = "utils/string" + + def execute(self, string_a, string_b, mode, case_sensitive, **kwargs): + if case_sensitive: + a = string_a + b = string_b + else: + a = string_a.lower() + b = string_b.lower() + + if mode == "Equal": + return a == b, + elif mode == "Starts With": + return a.startswith(b), + elif mode == "Ends With": + return a.endswith(b), + +class RegexMatch(): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "string": (IO.STRING, {"multiline": True}), + "regex_pattern": (IO.STRING, {"multiline": True}), + "case_insensitive": (IO.BOOLEAN, {"default": True}), + "multiline": (IO.BOOLEAN, {"default": False}), + "dotall": (IO.BOOLEAN, {"default": False}) + } + } + + RETURN_TYPES = (IO.BOOLEAN,) + RETURN_NAMES = ("matches",) + FUNCTION = "execute" + CATEGORY = "utils/string" + + def execute(self, string, regex_pattern, case_insensitive, multiline, dotall, **kwargs): + flags = 0 + + if case_insensitive: + flags |= re.IGNORECASE + if multiline: + flags |= re.MULTILINE + if dotall: + flags |= re.DOTALL + + try: + match = re.search(regex_pattern, string, flags) + result = match is not None + + except re.error: + result = False + + return result, + + +class RegexExtract(): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "string": (IO.STRING, {"multiline": True}), + "regex_pattern": (IO.STRING, {"multiline": True}), + "mode": (IO.COMBO, {"options": ["First Match", "All Matches", "First Group", "All Groups"]}), + "case_insensitive": (IO.BOOLEAN, {"default": True}), + "multiline": (IO.BOOLEAN, {"default": False}), + "dotall": (IO.BOOLEAN, {"default": False}), + "group_index": (IO.INT, {"default": 1, "min": 0, "max": 100}) + } + } + + RETURN_TYPES = (IO.STRING,) + FUNCTION = "execute" + CATEGORY = "utils/string" + + def execute(self, string, regex_pattern, mode, case_insensitive, multiline, dotall, group_index, **kwargs): + join_delimiter = "\n" + + flags = 0 + if case_insensitive: + flags |= re.IGNORECASE + if multiline: + flags |= re.MULTILINE + if dotall: + flags |= re.DOTALL + + try: + if mode == "First Match": + match = re.search(regex_pattern, string, flags) + if match: + result = match.group(0) + else: + result = "" + + elif mode == "All Matches": + matches = re.findall(regex_pattern, string, flags) + if matches: + if isinstance(matches[0], tuple): + result = join_delimiter.join([m[0] for m in matches]) + else: + result = join_delimiter.join(matches) + else: + result = "" + + elif mode == "First Group": + match = re.search(regex_pattern, string, flags) + if match and len(match.groups()) >= group_index: + result = match.group(group_index) + else: + result = "" + + elif mode == "All Groups": + matches = re.finditer(regex_pattern, string, flags) + results = [] + for match in matches: + if match.groups() and len(match.groups()) >= group_index: + results.append(match.group(group_index)) + result = join_delimiter.join(results) + else: + result = "" + + except re.error: + result = "" + + return result, + +NODE_CLASS_MAPPINGS = { + "StringConcatenate": StringConcatenate, + "StringSubstring": StringSubstring, + "StringLength": StringLength, + "CaseConverter": CaseConverter, + "StringTrim": StringTrim, + "StringReplace": StringReplace, + "StringContains": StringContains, + "StringCompare": StringCompare, + "RegexMatch": RegexMatch, + "RegexExtract": RegexExtract +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "StringConcatenate": "Concatenate", + "StringSubstring": "Substring", + "StringLength": "Length", + "CaseConverter": "Case Converter", + "StringTrim": "Trim", + "StringReplace": "Replace", + "StringContains": "Contains", + "StringCompare": "Compare", + "RegexMatch": "Regex Match", + "RegexExtract": "Regex Extract" +} diff --git a/nodes.py b/nodes.py index a1ddf2dd6..a26a138fa 100644 --- a/nodes.py +++ b/nodes.py @@ -2263,6 +2263,7 @@ def init_builtin_extra_nodes(): "nodes_fresca.py", "nodes_preview_any.py", "nodes_ace.py", + "nodes_string.py", ] import_failed = [] From f5cacaeb14acb07c9dde561297ec5e06f5c9c4c8 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Mon, 12 May 2025 16:47:02 -0400 Subject: [PATCH 431/478] Update frontend to v1.19 (#8076) * Update frontend to v1.19 * Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 01aab4ca2..8f7a78984 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.18.10 +comfyui-frontend-package==1.19.9 comfyui-workflow-templates==0.1.14 torch torchsde From 9ad287ff20daca21e5ab30e82ceb3095fc32c154 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Mon, 12 May 2025 16:47:14 -0400 Subject: [PATCH 432/478] add support to record video as output for 3d node (#7927) * add support to record video as output for 3d node * source format * add support to record video for load3d animation node --- comfy_extras/nodes_load_3d.py | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/comfy_extras/nodes_load_3d.py b/comfy_extras/nodes_load_3d.py index 53d892bc4..d5b4d9111 100644 --- a/comfy_extras/nodes_load_3d.py +++ b/comfy_extras/nodes_load_3d.py @@ -2,6 +2,10 @@ import nodes import folder_paths import os +from comfy.comfy_types import IO +from comfy_api.input_impl import VideoFromFile + + def normalize_path(path): return path.replace('\\', '/') @@ -21,8 +25,8 @@ class Load3D(): "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), }} - RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "IMAGE", "LOAD3D_CAMERA") - RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "lineart", "camera_info") + RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "IMAGE", "LOAD3D_CAMERA", IO.VIDEO) + RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "lineart", "camera_info", "recording_video") FUNCTION = "process" EXPERIMENTAL = True @@ -41,7 +45,14 @@ class Load3D(): normal_image, ignore_mask2 = load_image_node.load_image(image=normal_path) lineart_image, ignore_mask3 = load_image_node.load_image(image=lineart_path) - return output_image, output_mask, model_file, normal_image, lineart_image, image['camera_info'] + video = None + + if image['recording'] != "": + recording_video_path = folder_paths.get_annotated_filepath(image['recording']) + + video = VideoFromFile(recording_video_path) + + return output_image, output_mask, model_file, normal_image, lineart_image, image['camera_info'], video class Load3DAnimation(): @classmethod @@ -59,8 +70,8 @@ class Load3DAnimation(): "height": ("INT", {"default": 1024, "min": 1, "max": 4096, "step": 1}), }} - RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "LOAD3D_CAMERA") - RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "camera_info") + RETURN_TYPES = ("IMAGE", "MASK", "STRING", "IMAGE", "LOAD3D_CAMERA", IO.VIDEO) + RETURN_NAMES = ("image", "mask", "mesh_path", "normal", "camera_info", "recording_video") FUNCTION = "process" EXPERIMENTAL = True @@ -77,7 +88,14 @@ class Load3DAnimation(): ignore_image, output_mask = load_image_node.load_image(image=mask_path) normal_image, ignore_mask2 = load_image_node.load_image(image=normal_path) - return output_image, output_mask, model_file, normal_image, image['camera_info'] + video = None + + if image['recording'] != "": + recording_video_path = folder_paths.get_annotated_filepath(image['recording']) + + video = VideoFromFile(recording_video_path) + + return output_image, output_mask, model_file, normal_image, image['camera_info'], video class Preview3D(): @classmethod From 4136502b7a530df28e489f81c0c58b30612f9ece Mon Sep 17 00:00:00 2001 From: thot experiment <94414189+thot-experiment@users.noreply.github.com> Date: Mon, 12 May 2025 18:10:24 -0700 Subject: [PATCH 433/478] implement APG guidance (#8081) * first pass at impementing AGP * rename, cleanup code * fix ruff * fix modified cond to match ref impl better, support different cond arity --- comfy_extras/nodes_apg.py | 76 +++++++++++++++++++++++++++++++++++++++ nodes.py | 1 + 2 files changed, 77 insertions(+) create mode 100644 comfy_extras/nodes_apg.py diff --git a/comfy_extras/nodes_apg.py b/comfy_extras/nodes_apg.py new file mode 100644 index 000000000..1325985b2 --- /dev/null +++ b/comfy_extras/nodes_apg.py @@ -0,0 +1,76 @@ +import torch + +def project(v0, v1): + v1 = torch.nn.functional.normalize(v1, dim=[-1, -2, -3]) + v0_parallel = (v0 * v1).sum(dim=[-1, -2, -3], keepdim=True) * v1 + v0_orthogonal = v0 - v0_parallel + return v0_parallel, v0_orthogonal + +class APG: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "model": ("MODEL",), + "eta": ("FLOAT", {"default": 1.0, "min": -10.0, "max": 10.0, "step": 0.01, "tooltip": "Controls the scale of the parallel guidance vector. Default CFG behavior at a setting of 1."}), + "norm_threshold": ("FLOAT", {"default": 5.0, "min": 0.0, "max": 50.0, "step": 0.1, "tooltip": "Normalize guidance vector to this value, normalization disable at a setting of 0."}), + "momentum": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.01, "tooltip":"Controls a running average of guidance during diffusion, disabled at a setting of 0."}), + } + } + RETURN_TYPES = ("MODEL",) + FUNCTION = "patch" + CATEGORY = "sampling/custom_sampling" + + def patch(self, model, eta, norm_threshold, momentum): + running_avg = 0 + prev_sigma = None + + def pre_cfg_function(args): + nonlocal running_avg, prev_sigma + + if len(args["conds_out"]) == 1: return args["conds_out"] + + cond = args["conds_out"][0] + uncond = args["conds_out"][1] + sigma = args["sigma"][0] + cond_scale = args["cond_scale"] + + if prev_sigma is not None and sigma > prev_sigma: + running_avg = 0 + prev_sigma = sigma + + guidance = cond - uncond + + if momentum > 0: + if not torch.is_tensor(running_avg): + running_avg = guidance + else: + running_avg = momentum * running_avg + guidance + guidance = running_avg + + if norm_threshold > 0: + guidance_norm = guidance.norm(p=2, dim=[-1, -2, -3], keepdim=True) + scale = torch.minimum( + torch.ones_like(guidance_norm), + norm_threshold / guidance_norm + ) + guidance = guidance * scale + + guidance_parallel, guidance_orthogonal = project(guidance, cond) + modified_guidance = guidance_orthogonal + eta * guidance_parallel + + modified_cond = (uncond + modified_guidance) + (cond - uncond) / cond_scale + + return [modified_cond, uncond] + args["conds_out"][2:] + + m = model.clone() + m.set_model_sampler_pre_cfg_function(pre_cfg_function) + return (m,) + +NODE_CLASS_MAPPINGS = { + "APG": APG, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "APG": "Adaptive Projected Guidance", +} diff --git a/nodes.py b/nodes.py index a26a138fa..54e3886a3 100644 --- a/nodes.py +++ b/nodes.py @@ -2261,6 +2261,7 @@ def init_builtin_extra_nodes(): "nodes_optimalsteps.py", "nodes_hidream.py", "nodes_fresca.py", + "nodes_apg.py", "nodes_preview_any.py", "nodes_ace.py", "nodes_string.py", From 2156ce9453a8508efec4c36c26e810a14a3ce473 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Mon, 12 May 2025 20:06:44 -0700 Subject: [PATCH 434/478] add comment about using api key in headless (#8082) --- script_examples/basic_api_example.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/script_examples/basic_api_example.py b/script_examples/basic_api_example.py index c916e6cb9..9128420c4 100644 --- a/script_examples/basic_api_example.py +++ b/script_examples/basic_api_example.py @@ -101,6 +101,14 @@ prompt_text = """ def queue_prompt(prompt): p = {"prompt": prompt} + + # If the workflow contains API nodes, you can add a Comfy API key to the `extra_data`` field of the payload. + # p["extra_data"] = { + # "api_key_comfy_org": "comfyui-87d01e28d*******************************************************" # replace with real key + # } + # See: https://docs.comfy.org/tutorials/api-nodes/overview + # Generate a key here: https://platform.comfy.org/login + data = json.dumps(p).encode('utf-8') req = request.Request("http://127.0.0.1:8188/prompt", data=data) request.urlopen(req) From 481732a0ed609ccd86cb3d2df00e3d14c9133280 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Tue, 13 May 2025 04:32:16 -0700 Subject: [PATCH 435/478] Support official ACE Step loras. (#8094) --- comfy/lora.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/comfy/lora.py b/comfy/lora.py index fff524be2..ef110c164 100644 --- a/comfy/lora.py +++ b/comfy/lora.py @@ -286,6 +286,12 @@ def model_lora_keys_unet(model, key_map={}): key_lora = k[len("diffusion_model."):-len(".weight")].replace(".", "_") key_map["lycoris_{}".format(key_lora)] = k #SimpleTuner lycoris format + if isinstance(model, comfy.model_base.ACEStep): + for k in sdk: + if k.startswith("diffusion_model.") and k.endswith(".weight"): #Official ACE step lora format + key_lora = k[len("diffusion_model."):-len(".weight")] + key_map["{}".format(key_lora)] = k + return key_map From a814f2e8ccf171c967ee2dc095dd02f2a93dccde Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Tue, 13 May 2025 04:54:28 -0700 Subject: [PATCH 436/478] Fix issue with old pytorch RMSNorm. (#8095) --- comfy/rmsnorm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/rmsnorm.py b/comfy/rmsnorm.py index 9d82bee1a..66ae8321d 100644 --- a/comfy/rmsnorm.py +++ b/comfy/rmsnorm.py @@ -30,7 +30,7 @@ if RMSNorm is None: def __init__( self, normalized_shape, - eps=None, + eps=1e-6, elementwise_affine=True, device=None, dtype=None, From 8a7c894d5415c499817c1fcdcba26940755c03a4 Mon Sep 17 00:00:00 2001 From: thot experiment <94414189+thot-experiment@users.noreply.github.com> Date: Tue, 13 May 2025 10:50:32 -0700 Subject: [PATCH 437/478] fix negative momentum (#8100) --- comfy_extras/nodes_apg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy_extras/nodes_apg.py b/comfy_extras/nodes_apg.py index 1325985b2..25b21b1b8 100644 --- a/comfy_extras/nodes_apg.py +++ b/comfy_extras/nodes_apg.py @@ -14,7 +14,7 @@ class APG: "model": ("MODEL",), "eta": ("FLOAT", {"default": 1.0, "min": -10.0, "max": 10.0, "step": 0.01, "tooltip": "Controls the scale of the parallel guidance vector. Default CFG behavior at a setting of 1."}), "norm_threshold": ("FLOAT", {"default": 5.0, "min": 0.0, "max": 50.0, "step": 0.1, "tooltip": "Normalize guidance vector to this value, normalization disable at a setting of 0."}), - "momentum": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.01, "tooltip":"Controls a running average of guidance during diffusion, disabled at a setting of 0."}), + "momentum": ("FLOAT", {"default": 0.0, "min": -5.0, "max": 1.0, "step": 0.01, "tooltip":"Controls a running average of guidance during diffusion, disabled at a setting of 0."}), } } RETURN_TYPES = ("MODEL",) @@ -41,7 +41,7 @@ class APG: guidance = cond - uncond - if momentum > 0: + if momentum != 0: if not torch.is_tensor(running_avg): running_avg = guidance else: From 4a9014e201b71dfcf97d59d1086cb451cd40873f Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Tue, 13 May 2025 12:53:47 -0700 Subject: [PATCH 438/478] Hunyuan Custom initial untested implementation. (#8101) --- comfy/ldm/hunyuan_video/model.py | 21 ++++++++++++++++++--- comfy/model_base.py | 4 ++++ comfy_extras/nodes_hunyuan.py | 6 ++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/comfy/ldm/hunyuan_video/model.py b/comfy/ldm/hunyuan_video/model.py index 72af3d5bb..fbd8d4196 100644 --- a/comfy/ldm/hunyuan_video/model.py +++ b/comfy/ldm/hunyuan_video/model.py @@ -228,6 +228,7 @@ class HunyuanVideo(nn.Module): y: Tensor, guidance: Tensor = None, guiding_frame_index=None, + ref_latent=None, control=None, transformer_options={}, ) -> Tensor: @@ -238,6 +239,14 @@ class HunyuanVideo(nn.Module): img = self.img_in(img) vec = self.time_in(timestep_embedding(timesteps, 256, time_factor=1.0).to(img.dtype)) + if ref_latent is not None: + ref_latent_ids = self.img_ids(ref_latent) + ref_latent = self.img_in(ref_latent) + img = torch.cat([ref_latent, img], dim=-2) + ref_latent_ids[..., 0] = -1 + ref_latent_ids[..., 2] += (initial_shape[-1] // self.patch_size[-1]) + img_ids = torch.cat([ref_latent_ids, img_ids], dim=-2) + if guiding_frame_index is not None: token_replace_vec = self.time_in(timestep_embedding(guiding_frame_index, 256, time_factor=1.0)) vec_ = self.vector_in(y[:, :self.params.vec_in_dim]) @@ -313,6 +322,8 @@ class HunyuanVideo(nn.Module): img[:, : img_len] += add img = img[:, : img_len] + if ref_latent is not None: + img = img[:, ref_latent.shape[1]:] img = self.final_layer(img, vec, modulation_dims=modulation_dims) # (N, T, patch_size ** 2 * out_channels) @@ -324,7 +335,7 @@ class HunyuanVideo(nn.Module): img = img.reshape(initial_shape[0], self.out_channels, initial_shape[2], initial_shape[3], initial_shape[4]) return img - def forward(self, x, timestep, context, y, guidance=None, attention_mask=None, guiding_frame_index=None, control=None, transformer_options={}, **kwargs): + def img_ids(self, x): bs, c, t, h, w = x.shape patch_size = self.patch_size t_len = ((t + (patch_size[0] // 2)) // patch_size[0]) @@ -334,7 +345,11 @@ class HunyuanVideo(nn.Module): img_ids[:, :, :, 0] = img_ids[:, :, :, 0] + torch.linspace(0, t_len - 1, steps=t_len, device=x.device, dtype=x.dtype).reshape(-1, 1, 1) img_ids[:, :, :, 1] = img_ids[:, :, :, 1] + torch.linspace(0, h_len - 1, steps=h_len, device=x.device, dtype=x.dtype).reshape(1, -1, 1) img_ids[:, :, :, 2] = img_ids[:, :, :, 2] + torch.linspace(0, w_len - 1, steps=w_len, device=x.device, dtype=x.dtype).reshape(1, 1, -1) - img_ids = repeat(img_ids, "t h w c -> b (t h w) c", b=bs) + return repeat(img_ids, "t h w c -> b (t h w) c", b=bs) + + def forward(self, x, timestep, context, y, guidance=None, attention_mask=None, guiding_frame_index=None, ref_latent=None, control=None, transformer_options={}, **kwargs): + bs, c, t, h, w = x.shape + img_ids = self.img_ids(x) txt_ids = torch.zeros((bs, context.shape[1], 3), device=x.device, dtype=x.dtype) - out = self.forward_orig(x, img_ids, context, txt_ids, attention_mask, timestep, y, guidance, guiding_frame_index, control, transformer_options) + out = self.forward_orig(x, img_ids, context, txt_ids, attention_mask, timestep, y, guidance, guiding_frame_index, ref_latent, control=control, transformer_options=transformer_options) return out diff --git a/comfy/model_base.py b/comfy/model_base.py index 6d27930dc..047861593 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -924,6 +924,10 @@ class HunyuanVideo(BaseModel): if guiding_frame_index is not None: out['guiding_frame_index'] = comfy.conds.CONDRegular(torch.FloatTensor([guiding_frame_index])) + ref_latent = kwargs.get("ref_latent", None) + if ref_latent is not None: + out['ref_latent'] = comfy.conds.CONDRegular(self.process_latent_in(ref_latent)) + return out def scale_latent_inpaint(self, latent_image, **kwargs): diff --git a/comfy_extras/nodes_hunyuan.py b/comfy_extras/nodes_hunyuan.py index 504010ad0..d7278e7a7 100644 --- a/comfy_extras/nodes_hunyuan.py +++ b/comfy_extras/nodes_hunyuan.py @@ -77,7 +77,7 @@ class HunyuanImageToVideo: "height": ("INT", {"default": 480, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), "length": ("INT", {"default": 53, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}), "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), - "guidance_type": (["v1 (concat)", "v2 (replace)"], ) + "guidance_type": (["v1 (concat)", "v2 (replace)", "custom"], ) }, "optional": {"start_image": ("IMAGE", ), }} @@ -101,10 +101,12 @@ class HunyuanImageToVideo: if guidance_type == "v1 (concat)": cond = {"concat_latent_image": concat_latent_image, "concat_mask": mask} - else: + elif guidance_type == "v2 (replace)": cond = {'guiding_frame_index': 0} latent[:, :, :concat_latent_image.shape[2]] = concat_latent_image out_latent["noise_mask"] = mask + elif guidance_type == "custom": + cond = {"ref_latent": concat_latent_image} positive = node_helpers.conditioning_set_values(positive, cond) From bab836d88d62ebbe3b3040f3a9fff05f79d5049d Mon Sep 17 00:00:00 2001 From: thot experiment <94414189+thot-experiment@users.noreply.github.com> Date: Tue, 13 May 2025 17:42:29 -0700 Subject: [PATCH 439/478] rework client.py to be more robust, add logging of api requests (#7988) * rework how errors are handled on the client side * add logging to /temp * fix ruff * fix rebase, stupid vscode gui --- comfy_api_nodes/apis/client.py | 543 ++++++++++++++++++++++--- comfy_api_nodes/apis/request_logger.py | 125 ++++++ 2 files changed, 622 insertions(+), 46 deletions(-) create mode 100644 comfy_api_nodes/apis/request_logger.py diff --git a/comfy_api_nodes/apis/client.py b/comfy_api_nodes/apis/client.py index cff52714f..158d20deb 100644 --- a/comfy_api_nodes/apis/client.py +++ b/comfy_api_nodes/apis/client.py @@ -94,15 +94,18 @@ from __future__ import annotations import logging import time import io -from typing import Dict, Type, Optional, Any, TypeVar, Generic, Callable +import socket +from typing import Dict, Type, Optional, Any, TypeVar, Generic, Callable, Tuple from enum import Enum import json import requests -from urllib.parse import urljoin +from urllib.parse import urljoin, urlparse from pydantic import BaseModel, Field +import uuid # For generating unique operation IDs from comfy.cli_args import args from comfy import utils +from . import request_logger T = TypeVar("T", bound=BaseModel) R = TypeVar("R", bound=BaseModel) @@ -111,6 +114,21 @@ P = TypeVar("P", bound=BaseModel) # For poll response PROGRESS_BAR_MAX = 100 +class NetworkError(Exception): + """Base exception for network-related errors with diagnostic information.""" + pass + + +class LocalNetworkError(NetworkError): + """Exception raised when local network connectivity issues are detected.""" + pass + + +class ApiServerError(NetworkError): + """Exception raised when the API server is unreachable but internet is working.""" + pass + + class EmptyRequest(BaseModel): """Base class for empty request bodies. For GET requests, fields will be sent as query parameters.""" @@ -141,7 +159,7 @@ class HttpMethod(str, Enum): class ApiClient: """ - Client for making HTTP requests to an API with authentication and error handling. + Client for making HTTP requests to an API with authentication, error handling, and retry logic. """ def __init__( @@ -151,12 +169,26 @@ class ApiClient: comfy_api_key: Optional[str] = None, timeout: float = 3600.0, verify_ssl: bool = True, + max_retries: int = 3, + retry_delay: float = 1.0, + retry_backoff_factor: float = 2.0, + retry_status_codes: Optional[Tuple[int, ...]] = None, ): self.base_url = base_url self.auth_token = auth_token self.comfy_api_key = comfy_api_key self.timeout = timeout self.verify_ssl = verify_ssl + self.max_retries = max_retries + self.retry_delay = retry_delay + self.retry_backoff_factor = retry_backoff_factor + # Default retry status codes: 408 (Request Timeout), 429 (Too Many Requests), + # 500, 502, 503, 504 (Server Errors) + self.retry_status_codes = retry_status_codes or (408, 429, 500, 502, 503, 504) + + def _generate_operation_id(self, path: str) -> str: + """Generates a unique operation ID for logging.""" + return f"{path.strip('/').replace('/', '_')}_{uuid.uuid4().hex[:8]}" def _create_json_payload_args( self, @@ -211,6 +243,56 @@ class ApiClient: return headers + def _check_connectivity(self, target_url: str) -> Dict[str, bool]: + """ + Check connectivity to determine if network issues are local or server-related. + + Args: + target_url: URL to check connectivity to + + Returns: + Dictionary with connectivity status details + """ + results = { + "internet_accessible": False, + "api_accessible": False, + "is_local_issue": False, + "is_api_issue": False + } + + # First check basic internet connectivity using a reliable external site + try: + # Use a reliable external domain for checking basic connectivity + check_response = requests.get("https://www.google.com", + timeout=5.0, + verify=self.verify_ssl) + if check_response.status_code < 500: + results["internet_accessible"] = True + except (requests.RequestException, socket.error): + results["internet_accessible"] = False + results["is_local_issue"] = True + return results + + # Now check API server connectivity + try: + # Extract domain from the target URL to do a simpler health check + parsed_url = urlparse(target_url) + api_base = f"{parsed_url.scheme}://{parsed_url.netloc}" + + # Try to reach the API domain + api_response = requests.get(f"{api_base}/health", timeout=5.0, verify=self.verify_ssl) + if api_response.status_code < 500: + results["api_accessible"] = True + else: + results["api_accessible"] = False + results["is_api_issue"] = True + except requests.RequestException: + results["api_accessible"] = False + # If we can reach the internet but not the API, it's an API issue + results["is_api_issue"] = True + + return results + def request( self, method: str, @@ -221,9 +303,10 @@ class ApiClient: headers: Optional[Dict[str, str]] = None, content_type: str = "application/json", multipart_parser: Callable = None, + retry_count: int = 0, # Used internally for tracking retries ) -> Dict[str, Any]: """ - Make an HTTP request to the API + Make an HTTP request to the API with automatic retries for transient errors. Args: method: HTTP method (GET, POST, etc.) @@ -233,12 +316,15 @@ class ApiClient: files: Files to upload headers: Additional headers content_type: Content type of the request. Defaults to application/json. + retry_count: Internal parameter for tracking retries, do not set manually Returns: Parsed JSON response Raises: - requests.RequestException: If the request fails + LocalNetworkError: If local network connectivity issues are detected + ApiServerError: If the API server is unreachable but internet is working + Exception: For other request failures """ url = urljoin(self.base_url, path) self.check_auth(self.auth_token, self.comfy_api_key) @@ -265,6 +351,16 @@ class ApiClient: else: payload_args = self._create_json_payload_args(data, request_headers) + operation_id = self._generate_operation_id(path) + request_logger.log_request_response( + operation_id=operation_id, + request_method=method, + request_url=url, + request_headers=request_headers, + request_params=params, + request_data=data if content_type == "application/json" else "[form-data or other]" + ) + try: response = requests.request( method=method, @@ -275,50 +371,228 @@ class ApiClient: **payload_args, ) + # Check if we should retry based on status code + if (response.status_code in self.retry_status_codes and + retry_count < self.max_retries): + + # Calculate delay with exponential backoff + delay = self.retry_delay * (self.retry_backoff_factor ** retry_count) + + logging.warning( + f"Request failed with status {response.status_code}. " + f"Retrying in {delay:.2f}s ({retry_count + 1}/{self.max_retries})" + ) + + time.sleep(delay) + return self.request( + method=method, + path=path, + params=params, + data=data, + files=files, + headers=headers, + content_type=content_type, + multipart_parser=multipart_parser, + retry_count=retry_count + 1, + ) + # Raise exception for error status codes response.raise_for_status() - except requests.ConnectionError: - raise Exception( - f"Unable to connect to the API server at {self.base_url}. Please check your internet connection or verify the service is available." + + # Log successful response + response_content_to_log = response.content + try: + # Attempt to parse JSON for prettier logging, fallback to raw content + response_content_to_log = response.json() + except json.JSONDecodeError: + pass # Keep as bytes/str if not JSON + + request_logger.log_request_response( + operation_id=operation_id, + request_method=method, # Pass request details again for context in log + request_url=url, + response_status_code=response.status_code, + response_headers=dict(response.headers), + response_content=response_content_to_log ) - except requests.Timeout: - raise Exception( - f"Request timed out after {self.timeout} seconds. The server might be experiencing high load or the operation is taking longer than expected." + except requests.ConnectionError as e: + error_message = f"ConnectionError: {str(e)}" + request_logger.log_request_response( + operation_id=operation_id, + request_method=method, + request_url=url, + error_message=error_message ) + # Only perform connectivity check if we've exhausted all retries + if retry_count >= self.max_retries: + # Check connectivity to determine if it's a local or API issue + connectivity = self._check_connectivity(self.base_url) + + if connectivity["is_local_issue"]: + raise LocalNetworkError( + "Unable to connect to the API server due to local network issues. " + "Please check your internet connection and try again." + ) from e + elif connectivity["is_api_issue"]: + raise ApiServerError( + f"The API server at {self.base_url} is currently unreachable. " + f"The service may be experiencing issues. Please try again later." + ) from e + + # If we haven't exhausted retries yet, retry the request + if retry_count < self.max_retries: + delay = self.retry_delay * (self.retry_backoff_factor ** retry_count) + logging.warning( + f"Connection error: {str(e)}. " + f"Retrying in {delay:.2f}s ({retry_count + 1}/{self.max_retries})" + ) + time.sleep(delay) + return self.request( + method=method, + path=path, + params=params, + data=data, + files=files, + headers=headers, + content_type=content_type, + multipart_parser=multipart_parser, + retry_count=retry_count + 1, + ) + + # If we've exhausted retries and didn't identify the specific issue, + # raise a generic exception + final_error_message = ( + f"Unable to connect to the API server after {self.max_retries} attempts. " + f"Please check your internet connection or try again later." + ) + request_logger.log_request_response( # Log final failure + operation_id=operation_id, + request_method=method, request_url=url, + error_message=final_error_message + ) + raise Exception(final_error_message) from e + + except requests.Timeout as e: + error_message = f"Timeout: {str(e)}" + request_logger.log_request_response( + operation_id=operation_id, + request_method=method, request_url=url, + error_message=error_message + ) + # Retry timeouts if we haven't exhausted retries + if retry_count < self.max_retries: + delay = self.retry_delay * (self.retry_backoff_factor ** retry_count) + logging.warning( + f"Request timed out. " + f"Retrying in {delay:.2f}s ({retry_count + 1}/{self.max_retries})" + ) + time.sleep(delay) + return self.request( + method=method, + path=path, + params=params, + data=data, + files=files, + headers=headers, + content_type=content_type, + multipart_parser=multipart_parser, + retry_count=retry_count + 1, + ) + final_error_message = ( + f"Request timed out after {self.timeout} seconds and {self.max_retries} retry attempts. " + f"The server might be experiencing high load or the operation is taking longer than expected." + ) + request_logger.log_request_response( # Log final failure + operation_id=operation_id, + request_method=method, request_url=url, + error_message=final_error_message + ) + raise Exception(final_error_message) from e except requests.HTTPError as e: status_code = e.response.status_code if hasattr(e, "response") else None - error_message = f"HTTP Error: {str(e)}" + original_error_message = f"HTTP Error: {str(e)}" + error_content_for_log = None + if hasattr(e, "response") and e.response is not None: + error_content_for_log = e.response.content + try: + error_content_for_log = e.response.json() + except json.JSONDecodeError: + pass + + + # Try to extract detailed error message from JSON response for user display + # but log the full error content. + user_display_error_message = original_error_message - # Try to extract detailed error message from JSON response try: - if hasattr(e, "response") and e.response.content: + if hasattr(e, "response") and e.response is not None and e.response.content: error_json = e.response.json() if "error" in error_json and "message" in error_json["error"]: - error_message = f"API Error: {error_json['error']['message']}" + user_display_error_message = f"API Error: {error_json['error']['message']}" if "type" in error_json["error"]: - error_message += f" (Type: {error_json['error']['type']})" + user_display_error_message += f" (Type: {error_json['error']['type']})" + elif isinstance(error_json, dict): # Handle cases where error is just a JSON dict + user_display_error_message = f"API Error: {json.dumps(error_json)}" + else: # Non-dict JSON error + user_display_error_message = f"API Error: {str(error_json)}" + except json.JSONDecodeError: + # If not JSON, use the raw content if it's not too long, or a summary + if hasattr(e, "response") and e.response is not None and e.response.content: + raw_content = e.response.content.decode(errors='ignore') + if len(raw_content) < 200: # Arbitrary limit for display + user_display_error_message = f"API Error (raw): {raw_content}" else: - error_message = f"API Error: {error_json}" - except Exception as json_error: - # If we can't parse the JSON, fall back to the original error message - logging.debug( - f"[DEBUG] Failed to parse error response: {str(json_error)}" + user_display_error_message = f"API Error (raw, status {status_code})" + + request_logger.log_request_response( + operation_id=operation_id, + request_method=method, request_url=url, + response_status_code=status_code, + response_headers=dict(e.response.headers) if hasattr(e, "response") and e.response is not None else None, + response_content=error_content_for_log, + error_message=original_error_message # Log the original exception string as error + ) + + logging.debug(f"[DEBUG] API Error: {user_display_error_message} (Status: {status_code})") + if hasattr(e, "response") and e.response is not None and e.response.content: + logging.debug(f"[DEBUG] Response content: {e.response.content}") + + # Retry if the status code is in our retry list and we haven't exhausted retries + if (status_code in self.retry_status_codes and + retry_count < self.max_retries): + + delay = self.retry_delay * (self.retry_backoff_factor ** retry_count) + logging.warning( + f"HTTP error {status_code}. " + f"Retrying in {delay:.2f}s ({retry_count + 1}/{self.max_retries})" + ) + time.sleep(delay) + return self.request( + method=method, + path=path, + params=params, + data=data, + files=files, + headers=headers, + content_type=content_type, + multipart_parser=multipart_parser, + retry_count=retry_count + 1, ) - logging.debug(f"[DEBUG] API Error: {error_message} (Status: {status_code})") - if hasattr(e, "response") and e.response.content: - logging.debug(f"[DEBUG] Response content: {e.response.content}") + # Specific error messages for common status codes for user display if status_code == 401: - error_message = "Unauthorized: Please login first to use this node." - if status_code == 402: - error_message = "Payment Required: Please add credits to your account to use this node." - if status_code == 409: - error_message = "There is a problem with your account. Please contact support@comfy.org. " - if status_code == 429: - error_message = "Rate Limit Exceeded: Please try again later." - raise Exception(error_message) + user_display_error_message = "Unauthorized: Please login first to use this node." + elif status_code == 402: + user_display_error_message = "Payment Required: Please add credits to your account to use this node." + elif status_code == 409: + user_display_error_message = "There is a problem with your account. Please contact support@comfy.org." + elif status_code == 429: + user_display_error_message = "Rate Limit Exceeded: Please try again later." + # else, user_display_error_message remains as parsed from response or original HTTPError string + + raise Exception(user_display_error_message) # Raise with the user-friendly message # Parse and return JSON response if response.content: @@ -336,26 +610,126 @@ class ApiClient: upload_url: str, file: io.BytesIO | str, content_type: str | None = None, + max_retries: int = 3, + retry_delay: float = 1.0, + retry_backoff_factor: float = 2.0, ): - """Upload a file to the API. Make sure the file has a filename equal to what the url expects. + """Upload a file to the API with retry logic. Args: upload_url: The URL to upload to file: Either a file path string, BytesIO object, or tuple of (file_path, filename) - mime_type: Optional mime type to set for the upload + content_type: Optional mime type to set for the upload + max_retries: Maximum number of retry attempts + retry_delay: Initial delay between retries in seconds + retry_backoff_factor: Multiplier for the delay after each retry """ headers = {} if content_type: headers["Content-Type"] = content_type + # Prepare the file data if isinstance(file, io.BytesIO): file.seek(0) # Ensure we're at the start of the file data = file.read() - return requests.put(upload_url, data=data, headers=headers) elif isinstance(file, str): with open(file, "rb") as f: data = f.read() - return requests.put(upload_url, data=data, headers=headers) + else: + raise ValueError("File must be either a BytesIO object or a file path string") + + # Try the upload with retries + last_exception = None + operation_id = f"upload_{upload_url.split('/')[-1]}_{uuid.uuid4().hex[:8]}" # Simplified ID for uploads + + # Log initial attempt (without full file data for brevity) + request_logger.log_request_response( + operation_id=operation_id, + request_method="PUT", + request_url=upload_url, + request_headers=headers, + request_data=f"[File data of type {content_type or 'unknown'}, size {len(data)} bytes]" + ) + + for retry_attempt in range(max_retries + 1): + try: + response = requests.put(upload_url, data=data, headers=headers) + response.raise_for_status() + request_logger.log_request_response( + operation_id=operation_id, + request_method="PUT", request_url=upload_url, # For context + response_status_code=response.status_code, + response_headers=dict(response.headers), + response_content="File uploaded successfully." # Or response.text if available + ) + return response + + except (requests.ConnectionError, requests.Timeout, requests.HTTPError) as e: + last_exception = e + error_message_for_log = f"{type(e).__name__}: {str(e)}" + response_content_for_log = None + status_code_for_log = None + headers_for_log = None + + if hasattr(e, 'response') and e.response is not None: + status_code_for_log = e.response.status_code + headers_for_log = dict(e.response.headers) + try: + response_content_for_log = e.response.json() + except json.JSONDecodeError: + response_content_for_log = e.response.content + + + request_logger.log_request_response( + operation_id=operation_id, + request_method="PUT", request_url=upload_url, + response_status_code=status_code_for_log, + response_headers=headers_for_log, + response_content=response_content_for_log, + error_message=error_message_for_log + ) + + if retry_attempt < max_retries: + delay = retry_delay * (retry_backoff_factor ** retry_attempt) + logging.warning( + f"File upload failed: {str(e)}. " + f"Retrying in {delay:.2f}s ({retry_attempt + 1}/{max_retries})" + ) + time.sleep(delay) + else: + break # Max retries reached + + # If we've exhausted all retries, determine the final error type and raise + final_error_message = f"Failed to upload file after {max_retries + 1} attempts. Error: {str(last_exception)}" + try: + # Check basic internet connectivity + check_response = requests.get("https://www.google.com", timeout=5.0, verify=True) # Assuming verify=True is desired + if check_response.status_code >= 500: # Google itself has an issue (rare) + final_error_message = (f"Failed to upload file. Internet connectivity check to Google failed " + f"(status {check_response.status_code}). Original error: {str(last_exception)}") + # Not raising LocalNetworkError here as Google itself might be down. + # If Google is reachable, the issue is likely with the upload server or a more specific local problem + # not caught by a simple Google ping (e.g., DNS for the specific upload URL, firewall). + # The original last_exception is probably most relevant. + + except (requests.RequestException, socket.error) as conn_check_exc: + # Could not reach Google, likely a local network issue + final_error_message = (f"Failed to upload file due to network connectivity issues " + f"(cannot reach Google: {str(conn_check_exc)}). " + f"Original upload error: {str(last_exception)}") + request_logger.log_request_response( # Log final failure reason + operation_id=operation_id, + request_method="PUT", request_url=upload_url, + error_message=final_error_message + ) + raise LocalNetworkError(final_error_message) from last_exception + + request_logger.log_request_response( # Log final failure reason if not LocalNetworkError + operation_id=operation_id, + request_method="PUT", request_url=upload_url, + error_message=final_error_message + ) + raise Exception(final_error_message) from last_exception class ApiEndpoint(Generic[T, R]): @@ -403,6 +777,9 @@ class SynchronousOperation(Generic[T, R]): verify_ssl: bool = True, content_type: str = "application/json", multipart_parser: Callable = None, + max_retries: int = 3, + retry_delay: float = 1.0, + retry_backoff_factor: float = 2.0, ): self.endpoint = endpoint self.request = request @@ -419,8 +796,12 @@ class SynchronousOperation(Generic[T, R]): self.files = files self.content_type = content_type self.multipart_parser = multipart_parser + self.max_retries = max_retries + self.retry_delay = retry_delay + self.retry_backoff_factor = retry_backoff_factor + def execute(self, client: Optional[ApiClient] = None) -> R: - """Execute the API operation using the provided client or create one""" + """Execute the API operation using the provided client or create one with retry support""" try: # Create client if not provided if client is None: @@ -430,6 +811,9 @@ class SynchronousOperation(Generic[T, R]): comfy_api_key=self.comfy_api_key, timeout=self.timeout, verify_ssl=self.verify_ssl, + max_retries=self.max_retries, + retry_delay=self.retry_delay, + retry_backoff_factor=self.retry_backoff_factor, ) # Convert request model to dict, but use None for EmptyRequest @@ -443,11 +827,6 @@ class SynchronousOperation(Generic[T, R]): if isinstance(value, Enum): request_dict[key] = value.value - if request_dict: - for key, value in request_dict.items(): - if isinstance(value, Enum): - request_dict[key] = value.value - # Debug log for request logging.debug( f"[DEBUG] API Request: {self.endpoint.method.value} {self.endpoint.path}" @@ -455,7 +834,7 @@ class SynchronousOperation(Generic[T, R]): logging.debug(f"[DEBUG] Request Data: {json.dumps(request_dict, indent=2)}") logging.debug(f"[DEBUG] Query Params: {self.endpoint.query_params}") - # Make the request + # Make the request with built-in retry resp = client.request( method=self.endpoint.method.value, path=self.endpoint.path, @@ -476,8 +855,18 @@ class SynchronousOperation(Generic[T, R]): # Parse and return the response return self._parse_response(resp) + except LocalNetworkError as e: + # Propagate specific network error types + logging.error(f"[ERROR] Local network error: {str(e)}") + raise + + except ApiServerError as e: + # Propagate API server errors + logging.error(f"[ERROR] API server error: {str(e)}") + raise + except Exception as e: - logging.error(f"[DEBUG] API Exception: {str(e)}") + logging.error(f"[ERROR] API Exception: {str(e)}") raise Exception(str(e)) def _parse_response(self, resp): @@ -517,6 +906,10 @@ class PollingOperation(Generic[T, R]): comfy_api_key: Optional[str] = None, auth_kwargs: Optional[Dict[str,str]] = None, poll_interval: float = 5.0, + max_poll_attempts: int = 120, # Default max polling attempts (10 minutes with 5s interval) + max_retries: int = 3, # Max retries per individual API call + retry_delay: float = 1.0, + retry_backoff_factor: float = 2.0, ): self.poll_endpoint = poll_endpoint self.request = request @@ -527,6 +920,10 @@ class PollingOperation(Generic[T, R]): self.auth_token = auth_kwargs.get("auth_token", self.auth_token) self.comfy_api_key = auth_kwargs.get("comfy_api_key", self.comfy_api_key) self.poll_interval = poll_interval + self.max_poll_attempts = max_poll_attempts + self.max_retries = max_retries + self.retry_delay = retry_delay + self.retry_backoff_factor = retry_backoff_factor # Polling configuration self.status_extractor = status_extractor or ( @@ -548,8 +945,23 @@ class PollingOperation(Generic[T, R]): base_url=self.api_base, auth_token=self.auth_token, comfy_api_key=self.comfy_api_key, + max_retries=self.max_retries, + retry_delay=self.retry_delay, + retry_backoff_factor=self.retry_backoff_factor, ) return self._poll_until_complete(client) + except LocalNetworkError as e: + # Provide clear message for local network issues + raise Exception( + f"Polling failed due to local network issues. Please check your internet connection. " + f"Details: {str(e)}" + ) from e + except ApiServerError as e: + # Provide clear message for API server issues + raise Exception( + f"Polling failed due to API server issues. The service may be experiencing problems. " + f"Please try again later. Details: {str(e)}" + ) from e except Exception as e: raise Exception(f"Error during polling: {str(e)}") @@ -569,10 +981,13 @@ class PollingOperation(Generic[T, R]): def _poll_until_complete(self, client: ApiClient) -> R: """Poll until the task is complete""" poll_count = 0 + consecutive_errors = 0 + max_consecutive_errors = min(5, self.max_retries * 2) # Limit consecutive errors + if self.progress_extractor: progress = utils.ProgressBar(PROGRESS_BAR_MAX) - while True: + while poll_count < self.max_poll_attempts: try: poll_count += 1 logging.debug(f"[DEBUG] Polling attempt #{poll_count}") @@ -599,8 +1014,12 @@ class PollingOperation(Generic[T, R]): data=request_dict, ) + # Successfully got a response, reset consecutive error count + consecutive_errors = 0 + # Parse response response_obj = self.poll_endpoint.response_model.model_validate(resp) + # Check if task is complete status = self._check_task_status(response_obj) logging.debug(f"[DEBUG] Task Status: {status}") @@ -630,6 +1049,38 @@ class PollingOperation(Generic[T, R]): ) time.sleep(self.poll_interval) + except (LocalNetworkError, ApiServerError) as e: + # For network-related errors, increment error count and potentially abort + consecutive_errors += 1 + if consecutive_errors >= max_consecutive_errors: + raise Exception( + f"Polling aborted after {consecutive_errors} consecutive network errors: {str(e)}" + ) from e + + # Log the error but continue polling + logging.warning( + f"Network error during polling (attempt {poll_count}/{self.max_poll_attempts}): {str(e)}. " + f"Will retry in {self.poll_interval} seconds." + ) + time.sleep(self.poll_interval) + except Exception as e: + # For other errors, increment count and potentially abort + consecutive_errors += 1 + if consecutive_errors >= max_consecutive_errors: + raise Exception( + f"Polling aborted after {consecutive_errors} consecutive errors: {str(e)}" + ) from e + logging.error(f"[DEBUG] Polling error: {str(e)}") - raise Exception(f"Error while polling: {str(e)}") + logging.warning( + f"Error during polling (attempt {poll_count}/{self.max_poll_attempts}): {str(e)}. " + f"Will retry in {self.poll_interval} seconds." + ) + time.sleep(self.poll_interval) + + # If we've exhausted all polling attempts + raise Exception( + f"Polling timed out after {poll_count} attempts ({poll_count * self.poll_interval} seconds). " + f"The operation may still be running on the server but is taking longer than expected." + ) diff --git a/comfy_api_nodes/apis/request_logger.py b/comfy_api_nodes/apis/request_logger.py new file mode 100644 index 000000000..93517ede9 --- /dev/null +++ b/comfy_api_nodes/apis/request_logger.py @@ -0,0 +1,125 @@ +import os +import datetime +import json +import logging +import folder_paths + +# Get the logger instance +logger = logging.getLogger(__name__) + +def get_log_directory(): + """ + Ensures the API log directory exists within ComfyUI's temp directory + and returns its path. + """ + base_temp_dir = folder_paths.get_temp_directory() + log_dir = os.path.join(base_temp_dir, "api_logs") + try: + os.makedirs(log_dir, exist_ok=True) + except Exception as e: + logger.error(f"Error creating API log directory {log_dir}: {e}") + # Fallback to base temp directory if sub-directory creation fails + return base_temp_dir + return log_dir + +def _format_data_for_logging(data): + """Helper to format data (dict, str, bytes) for logging.""" + if isinstance(data, bytes): + try: + return data.decode('utf-8') # Try to decode as text + except UnicodeDecodeError: + return f"[Binary data of length {len(data)} bytes]" + elif isinstance(data, (dict, list)): + try: + return json.dumps(data, indent=2, ensure_ascii=False) + except TypeError: + return str(data) # Fallback for non-serializable objects + return str(data) + +def log_request_response( + operation_id: str, + request_method: str, + request_url: str, + request_headers: dict | None = None, + request_params: dict | None = None, + request_data: any = None, + response_status_code: int | None = None, + response_headers: dict | None = None, + response_content: any = None, + error_message: str | None = None +): + """ + Logs API request and response details to a file in the temp/api_logs directory. + """ + log_dir = get_log_directory() + timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_%f") + filename = f"{timestamp}_{operation_id.replace('/', '_').replace(':', '_')}.log" + filepath = os.path.join(log_dir, filename) + + log_content = [] + + log_content.append(f"Timestamp: {datetime.datetime.now().isoformat()}") + log_content.append(f"Operation ID: {operation_id}") + log_content.append("-" * 30 + " REQUEST " + "-" * 30) + log_content.append(f"Method: {request_method}") + log_content.append(f"URL: {request_url}") + if request_headers: + log_content.append(f"Headers:\n{_format_data_for_logging(request_headers)}") + if request_params: + log_content.append(f"Params:\n{_format_data_for_logging(request_params)}") + if request_data: + log_content.append(f"Data/Body:\n{_format_data_for_logging(request_data)}") + + log_content.append("\n" + "-" * 30 + " RESPONSE " + "-" * 30) + if response_status_code is not None: + log_content.append(f"Status Code: {response_status_code}") + if response_headers: + log_content.append(f"Headers:\n{_format_data_for_logging(response_headers)}") + if response_content: + log_content.append(f"Content:\n{_format_data_for_logging(response_content)}") + if error_message: + log_content.append(f"Error:\n{error_message}") + + try: + with open(filepath, "w", encoding="utf-8") as f: + f.write("\n".join(log_content)) + logger.debug(f"API log saved to: {filepath}") + except Exception as e: + logger.error(f"Error writing API log to {filepath}: {e}") + +if __name__ == '__main__': + # Example usage (for testing the logger directly) + logger.setLevel(logging.DEBUG) + # Mock folder_paths for direct execution if not running within ComfyUI full context + if not hasattr(folder_paths, 'get_temp_directory'): + class MockFolderPaths: + def get_temp_directory(self): + # Create a local temp dir for testing if needed + p = os.path.join(os.path.dirname(__file__), 'temp_test_logs') + os.makedirs(p, exist_ok=True) + return p + folder_paths = MockFolderPaths() + + log_request_response( + operation_id="test_operation_get", + request_method="GET", + request_url="https://api.example.com/test", + request_headers={"Authorization": "Bearer testtoken"}, + request_params={"param1": "value1"}, + response_status_code=200, + response_content={"message": "Success!"} + ) + log_request_response( + operation_id="test_operation_post_error", + request_method="POST", + request_url="https://api.example.com/submit", + request_data={"key": "value", "nested": {"num": 123}}, + error_message="Connection timed out" + ) + log_request_response( + operation_id="test_binary_response", + request_method="GET", + request_url="https://api.example.com/image.png", + response_status_code=200, + response_content=b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR...' # Sample binary data + ) From 98ff01e1486353a3b0ddd8fa82fcbb25401f8364 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Tue, 13 May 2025 21:33:18 -0700 Subject: [PATCH 440/478] Display progress and result URL directly on API nodes (#8102) * [Luma] Print download URL of successful task result directly on nodes (#177) [Veo] Print download URL of successful task result directly on nodes (#184) [Recraft] Print download URL of successful task result directly on nodes (#183) [Pixverse] Print download URL of successful task result directly on nodes (#182) [Kling] Print download URL of successful task result directly on nodes (#181) [MiniMax] Print progress text and download URL of successful task result directly on nodes (#179) [Docs] Link to docs in `API_NODE` class property type annotation comment (#178) [Ideogram] Print download URL of successful task result directly on nodes (#176) [Kling] Print download URL of successful task result directly on nodes (#181) [Veo] Print download URL of successful task result directly on nodes (#184) [Recraft] Print download URL of successful task result directly on nodes (#183) [Pixverse] Print download URL of successful task result directly on nodes (#182) [MiniMax] Print progress text and download URL of successful task result directly on nodes (#179) [Docs] Link to docs in `API_NODE` class property type annotation comment (#178) [Luma] Print download URL of successful task result directly on nodes (#177) [Ideogram] Print download URL of successful task result directly on nodes (#176) Show output URL and progress text on Pika nodes (#168) [BFL] Print download URL of successful task result directly on nodes (#175) [OpenAI ] Print download URL of successful task result directly on nodes (#174) * fix ruff errors * fix 3.10 syntax error --- comfy/comfy_types/node_typing.py | 2 +- comfy_api_nodes/apinode_utils.py | 11 +- comfy_api_nodes/apis/client.py | 42 +++++++- comfy_api_nodes/nodes_bfl.py | 63 ++++++++---- comfy_api_nodes/nodes_ideogram.py | 24 ++++- comfy_api_nodes/nodes_kling.py | 164 ++++++++++++++++++++++++++---- comfy_api_nodes/nodes_luma.py | 33 ++++++ comfy_api_nodes/nodes_minimax.py | 27 ++++- comfy_api_nodes/nodes_openai.py | 12 ++- comfy_api_nodes/nodes_pika.py | 42 ++++++-- comfy_api_nodes/nodes_pixverse.py | 99 ++++++++++++------ comfy_api_nodes/nodes_recraft.py | 21 ++++ comfy_api_nodes/nodes_veo2.py | 26 ++++- 13 files changed, 474 insertions(+), 92 deletions(-) diff --git a/comfy/comfy_types/node_typing.py b/comfy/comfy_types/node_typing.py index 2ffc9c021..470eb9fdb 100644 --- a/comfy/comfy_types/node_typing.py +++ b/comfy/comfy_types/node_typing.py @@ -235,7 +235,7 @@ class ComfyNodeABC(ABC): DEPRECATED: bool """Flags a node as deprecated, indicating to users that they should find alternatives to this node.""" API_NODE: Optional[bool] - """Flags a node as an API node.""" + """Flags a node as an API node. See: https://docs.comfy.org/tutorials/api-nodes/overview.""" @classmethod @abstractmethod diff --git a/comfy_api_nodes/apinode_utils.py b/comfy_api_nodes/apinode_utils.py index e28d7d607..87d8c3e1d 100644 --- a/comfy_api_nodes/apinode_utils.py +++ b/comfy_api_nodes/apinode_utils.py @@ -1,7 +1,7 @@ from __future__ import annotations import io import logging -from typing import Optional +from typing import Optional, Union from comfy.utils import common_upscale from comfy_api.input_impl import VideoFromFile from comfy_api.util import VideoContainer, VideoCodec @@ -15,6 +15,7 @@ from comfy_api_nodes.apis.client import ( UploadRequest, UploadResponse, ) +from server import PromptServer import numpy as np @@ -60,7 +61,9 @@ def downscale_image_tensor(image, total_pixels=1536 * 1024) -> torch.Tensor: return s -def validate_and_cast_response(response, timeout: int = None) -> torch.Tensor: +def validate_and_cast_response( + response, timeout: int = None, node_id: Union[str, None] = None +) -> torch.Tensor: """Validates and casts a response to a torch.Tensor. Args: @@ -94,6 +97,10 @@ def validate_and_cast_response(response, timeout: int = None) -> torch.Tensor: img = Image.open(io.BytesIO(img_data)) elif image_url: + if node_id: + PromptServer.instance.send_progress_text( + f"Result URL: {image_url}", node_id + ) img_response = requests.get(image_url, timeout=timeout) if img_response.status_code != 200: raise ValueError("Failed to download the image") diff --git a/comfy_api_nodes/apis/client.py b/comfy_api_nodes/apis/client.py index 158d20deb..838ff1e8d 100644 --- a/comfy_api_nodes/apis/client.py +++ b/comfy_api_nodes/apis/client.py @@ -103,6 +103,7 @@ from urllib.parse import urljoin, urlparse from pydantic import BaseModel, Field import uuid # For generating unique operation IDs +from server import PromptServer from comfy.cli_args import args from comfy import utils from . import request_logger @@ -900,6 +901,7 @@ class PollingOperation(Generic[T, R]): failed_statuses: list, status_extractor: Callable[[R], str], progress_extractor: Callable[[R], float] = None, + result_url_extractor: Callable[[R], str] = None, request: Optional[T] = None, api_base: str | None = None, auth_token: Optional[str] = None, @@ -910,6 +912,8 @@ class PollingOperation(Generic[T, R]): max_retries: int = 3, # Max retries per individual API call retry_delay: float = 1.0, retry_backoff_factor: float = 2.0, + estimated_duration: Optional[float] = None, + node_id: Optional[str] = None, ): self.poll_endpoint = poll_endpoint self.request = request @@ -924,12 +928,15 @@ class PollingOperation(Generic[T, R]): self.max_retries = max_retries self.retry_delay = retry_delay self.retry_backoff_factor = retry_backoff_factor + self.estimated_duration = estimated_duration # Polling configuration self.status_extractor = status_extractor or ( lambda x: getattr(x, "status", None) ) self.progress_extractor = progress_extractor + self.result_url_extractor = result_url_extractor + self.node_id = node_id self.completed_statuses = completed_statuses self.failed_statuses = failed_statuses @@ -965,6 +972,26 @@ class PollingOperation(Generic[T, R]): except Exception as e: raise Exception(f"Error during polling: {str(e)}") + def _display_text_on_node(self, text: str): + """Sends text to the client which will be displayed on the node in the UI""" + if not self.node_id: + return + + PromptServer.instance.send_progress_text(text, self.node_id) + + def _display_time_progress_on_node(self, time_completed: int): + if not self.node_id: + return + + if self.estimated_duration is not None: + estimated_time_remaining = max( + 0, int(self.estimated_duration) - int(time_completed) + ) + message = f"Task in progress: {time_completed:.0f}s (~{estimated_time_remaining:.0f}s remaining)" + else: + message = f"Task in progress: {time_completed:.0f}s" + self._display_text_on_node(message) + def _check_task_status(self, response: R) -> TaskStatus: """Check task status using the status extractor function""" try: @@ -1031,7 +1058,15 @@ class PollingOperation(Generic[T, R]): progress.update_absolute(new_progress, total=PROGRESS_BAR_MAX) if status == TaskStatus.COMPLETED: - logging.debug("[DEBUG] Task completed successfully") + message = "Task completed successfully" + if self.result_url_extractor: + result_url = self.result_url_extractor(response_obj) + if result_url: + message = f"Result URL: {result_url}" + else: + message = "Task completed successfully!" + logging.debug(f"[DEBUG] {message}") + self._display_text_on_node(message) self.final_response = response_obj if self.progress_extractor: progress.update(100) @@ -1047,7 +1082,10 @@ class PollingOperation(Generic[T, R]): logging.debug( f"[DEBUG] Waiting {self.poll_interval} seconds before next poll" ) - time.sleep(self.poll_interval) + for i in range(int(self.poll_interval)): + time_completed = (poll_count * self.poll_interval) + i + self._display_time_progress_on_node(time_completed) + time.sleep(1) except (LocalNetworkError, ApiServerError) as e: # For network-related errors, increment error count and potentially abort diff --git a/comfy_api_nodes/nodes_bfl.py b/comfy_api_nodes/nodes_bfl.py index 66ef1b391..509170b34 100644 --- a/comfy_api_nodes/nodes_bfl.py +++ b/comfy_api_nodes/nodes_bfl.py @@ -1,5 +1,6 @@ import io from inspect import cleandoc +from typing import Union from comfy.comfy_types.node_typing import IO, ComfyNodeABC from comfy_api_nodes.apis.bfl_api import ( BFLStatus, @@ -30,6 +31,7 @@ import requests import torch import base64 import time +from server import PromptServer def convert_mask_to_image(mask: torch.Tensor): @@ -42,14 +44,19 @@ def convert_mask_to_image(mask: torch.Tensor): def handle_bfl_synchronous_operation( - operation: SynchronousOperation, timeout_bfl_calls=360 + operation: SynchronousOperation, + timeout_bfl_calls=360, + node_id: Union[str, None] = None, ): response_api: BFLFluxProGenerateResponse = operation.execute() return _poll_until_generated( - response_api.polling_url, timeout=timeout_bfl_calls + response_api.polling_url, timeout=timeout_bfl_calls, node_id=node_id ) -def _poll_until_generated(polling_url: str, timeout=360): + +def _poll_until_generated( + polling_url: str, timeout=360, node_id: Union[str, None] = None +): # used bfl-comfy-nodes to verify code implementation: # https://github.com/black-forest-labs/bfl-comfy-nodes/tree/main start_time = time.time() @@ -61,11 +68,21 @@ def _poll_until_generated(polling_url: str, timeout=360): request = requests.Request(method=HttpMethod.GET, url=polling_url) # NOTE: should True loop be replaced with checking if workflow has been interrupted? while True: + if node_id: + time_elapsed = time.time() - start_time + PromptServer.instance.send_progress_text( + f"Generating ({time_elapsed:.0f}s)", node_id + ) + response = requests.Session().send(request.prepare()) if response.status_code == 200: result = response.json() if result["status"] == BFLStatus.ready: img_url = result["result"]["sample"] + if node_id: + PromptServer.instance.send_progress_text( + f"Result URL: {img_url}", node_id + ) img_response = requests.get(img_url) return process_image_response(img_response) elif result["status"] in [ @@ -180,6 +197,7 @@ class FluxProUltraImageNode(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -212,6 +230,7 @@ class FluxProUltraImageNode(ComfyNodeABC): seed=0, image_prompt=None, image_prompt_strength=0.1, + unique_id: Union[str, None] = None, **kwargs, ): if image_prompt is None: @@ -246,7 +265,7 @@ class FluxProUltraImageNode(ComfyNodeABC): ), auth_kwargs=kwargs, ) - output_image = handle_bfl_synchronous_operation(operation) + output_image = handle_bfl_synchronous_operation(operation, node_id=unique_id) return (output_image,) @@ -320,6 +339,7 @@ class FluxProImageNode(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -338,6 +358,7 @@ class FluxProImageNode(ComfyNodeABC): seed=0, image_prompt=None, # image_prompt_strength=0.1, + unique_id: Union[str, None] = None, **kwargs, ): image_prompt = ( @@ -363,7 +384,7 @@ class FluxProImageNode(ComfyNodeABC): ), auth_kwargs=kwargs, ) - output_image = handle_bfl_synchronous_operation(operation) + output_image = handle_bfl_synchronous_operation(operation, node_id=unique_id) return (output_image,) @@ -457,11 +478,11 @@ class FluxProExpandNode(ComfyNodeABC): }, ), }, - "optional": { - }, + "optional": {}, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -483,6 +504,7 @@ class FluxProExpandNode(ComfyNodeABC): steps: int, guidance: float, seed=0, + unique_id: Union[str, None] = None, **kwargs, ): image = convert_image_to_base64(image) @@ -508,7 +530,7 @@ class FluxProExpandNode(ComfyNodeABC): ), auth_kwargs=kwargs, ) - output_image = handle_bfl_synchronous_operation(operation) + output_image = handle_bfl_synchronous_operation(operation, node_id=unique_id) return (output_image,) @@ -568,11 +590,11 @@ class FluxProFillNode(ComfyNodeABC): }, ), }, - "optional": { - }, + "optional": {}, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -591,13 +613,14 @@ class FluxProFillNode(ComfyNodeABC): steps: int, guidance: float, seed=0, + unique_id: Union[str, None] = None, **kwargs, ): # prepare mask mask = resize_mask_to_image(mask, image) mask = convert_image_to_base64(convert_mask_to_image(mask)) # make sure image will have alpha channel removed - image = convert_image_to_base64(image[:,:,:,:3]) + image = convert_image_to_base64(image[:, :, :, :3]) operation = SynchronousOperation( endpoint=ApiEndpoint( @@ -617,7 +640,7 @@ class FluxProFillNode(ComfyNodeABC): ), auth_kwargs=kwargs, ) - output_image = handle_bfl_synchronous_operation(operation) + output_image = handle_bfl_synchronous_operation(operation, node_id=unique_id) return (output_image,) @@ -702,11 +725,11 @@ class FluxProCannyNode(ComfyNodeABC): }, ), }, - "optional": { - }, + "optional": {}, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -727,9 +750,10 @@ class FluxProCannyNode(ComfyNodeABC): steps: int, guidance: float, seed=0, + unique_id: Union[str, None] = None, **kwargs, ): - control_image = convert_image_to_base64(control_image[:,:,:,:3]) + control_image = convert_image_to_base64(control_image[:, :, :, :3]) preprocessed_image = None # scale canny threshold between 0-500, to match BFL's API @@ -765,7 +789,7 @@ class FluxProCannyNode(ComfyNodeABC): ), auth_kwargs=kwargs, ) - output_image = handle_bfl_synchronous_operation(operation) + output_image = handle_bfl_synchronous_operation(operation, node_id=unique_id) return (output_image,) @@ -830,11 +854,11 @@ class FluxProDepthNode(ComfyNodeABC): }, ), }, - "optional": { - }, + "optional": {}, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -853,6 +877,7 @@ class FluxProDepthNode(ComfyNodeABC): steps: int, guidance: float, seed=0, + unique_id: Union[str, None] = None, **kwargs, ): control_image = convert_image_to_base64(control_image[:,:,:,:3]) @@ -880,7 +905,7 @@ class FluxProDepthNode(ComfyNodeABC): ), auth_kwargs=kwargs, ) - output_image = handle_bfl_synchronous_operation(operation) + output_image = handle_bfl_synchronous_operation(operation, node_id=unique_id) return (output_image,) diff --git a/comfy_api_nodes/nodes_ideogram.py b/comfy_api_nodes/nodes_ideogram.py index d25468b17..b1cbf511d 100644 --- a/comfy_api_nodes/nodes_ideogram.py +++ b/comfy_api_nodes/nodes_ideogram.py @@ -23,6 +23,7 @@ from comfy_api_nodes.apinode_utils import ( bytesio_to_image_tensor, resize_mask_to_image, ) +from server import PromptServer V1_V1_RES_MAP = { "Auto":"AUTO", @@ -232,6 +233,19 @@ def download_and_process_images(image_urls): return stacked_tensors +def display_image_urls_on_node(image_urls, node_id): + if node_id and image_urls: + if len(image_urls) == 1: + PromptServer.instance.send_progress_text( + f"Generated Image URL:\n{image_urls[0]}", node_id + ) + else: + urls_text = "Generated Image URLs:\n" + "\n".join( + f"{i+1}. {url}" for i, url in enumerate(image_urls) + ) + PromptServer.instance.send_progress_text(urls_text, node_id) + + class IdeogramV1(ComfyNodeABC): """ Generates images using the Ideogram V1 model. @@ -304,6 +318,7 @@ class IdeogramV1(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -322,6 +337,7 @@ class IdeogramV1(ComfyNodeABC): seed=0, negative_prompt="", num_images=1, + unique_id=None, **kwargs, ): # Determine the model based on turbo setting @@ -361,6 +377,7 @@ class IdeogramV1(ComfyNodeABC): if not image_urls: raise Exception("No image URLs were generated in the response") + display_image_urls_on_node(image_urls, unique_id) return (download_and_process_images(image_urls),) @@ -460,6 +477,7 @@ class IdeogramV2(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -481,6 +499,7 @@ class IdeogramV2(ComfyNodeABC): negative_prompt="", num_images=1, color_palette="", + unique_id=None, **kwargs, ): aspect_ratio = V1_V2_RATIO_MAP.get(aspect_ratio, None) @@ -534,6 +553,7 @@ class IdeogramV2(ComfyNodeABC): if not image_urls: raise Exception("No image URLs were generated in the response") + display_image_urls_on_node(image_urls, unique_id) return (download_and_process_images(image_urls),) class IdeogramV3(ComfyNodeABC): @@ -623,6 +643,7 @@ class IdeogramV3(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -643,6 +664,7 @@ class IdeogramV3(ComfyNodeABC): seed=0, num_images=1, rendering_speed="BALANCED", + unique_id=None, **kwargs, ): # Check if both image and mask are provided for editing mode @@ -762,6 +784,7 @@ class IdeogramV3(ComfyNodeABC): if not image_urls: raise Exception("No image URLs were generated in the response") + display_image_urls_on_node(image_urls, unique_id) return (download_and_process_images(image_urls),) @@ -776,4 +799,3 @@ NODE_DISPLAY_NAME_MAPPINGS = { "IdeogramV2": "Ideogram V2", "IdeogramV3": "Ideogram V3", } - diff --git a/comfy_api_nodes/nodes_kling.py b/comfy_api_nodes/nodes_kling.py index 2d0fd8883..456a86905 100644 --- a/comfy_api_nodes/nodes_kling.py +++ b/comfy_api_nodes/nodes_kling.py @@ -6,6 +6,7 @@ For source of truth on the allowed permutations of request fields, please refere from __future__ import annotations from typing import Optional, TypeVar, Any +from collections.abc import Callable import math import logging @@ -86,6 +87,15 @@ MAX_PROMPT_LENGTH_IMAGE_GEN = 500 MAX_NEGATIVE_PROMPT_LENGTH_IMAGE_GEN = 200 MAX_PROMPT_LENGTH_LIP_SYNC = 120 +# TODO: adjust based on tests +AVERAGE_DURATION_T2V = 319 # 319, +AVERAGE_DURATION_I2V = 164 # 164, +AVERAGE_DURATION_LIP_SYNC = 120 +AVERAGE_DURATION_VIRTUAL_TRY_ON = 19 # 19, +AVERAGE_DURATION_IMAGE_GEN = 32 +AVERAGE_DURATION_VIDEO_EFFECTS = 320 +AVERAGE_DURATION_VIDEO_EXTEND = 320 + R = TypeVar("R") @@ -95,7 +105,13 @@ class KlingApiError(Exception): pass -def poll_until_finished(auth_kwargs: dict[str,str], api_endpoint: ApiEndpoint[Any, R]) -> R: +def poll_until_finished( + auth_kwargs: dict[str, str], + api_endpoint: ApiEndpoint[Any, R], + result_url_extractor: Optional[Callable[[R], str]] = None, + estimated_duration: Optional[int] = None, + node_id: Optional[str] = None, +) -> R: """Polls the Kling API endpoint until the task reaches a terminal state, then returns the response.""" return PollingOperation( poll_endpoint=api_endpoint, @@ -109,6 +125,9 @@ def poll_until_finished(auth_kwargs: dict[str,str], api_endpoint: ApiEndpoint[An else None ), auth_kwargs=auth_kwargs, + result_url_extractor=result_url_extractor, + estimated_duration=estimated_duration, + node_id=node_id, ).execute() @@ -227,7 +246,9 @@ def get_camera_control_input_config( def get_video_from_response(response) -> KlingVideoResult: - """Returns the first video object from the Kling video generation task result.""" + """Returns the first video object from the Kling video generation task result. + Will raise an error if the response is not valid. + """ video = response.data.task_result.videos[0] logging.info( "Kling task %s succeeded. Video URL: %s", response.data.task_id, video.url @@ -235,12 +256,37 @@ def get_video_from_response(response) -> KlingVideoResult: return video +def get_video_url_from_response(response) -> Optional[str]: + """Returns the first video url from the Kling video generation task result. + Will not raise an error if the response is not valid. + """ + if response and is_valid_video_response(response): + return str(get_video_from_response(response).url) + else: + return None + + def get_images_from_response(response) -> list[KlingImageResult]: + """Returns the list of image objects from the Kling image generation task result. + Will raise an error if the response is not valid. + """ images = response.data.task_result.images logging.info("Kling task %s succeeded. Images: %s", response.data.task_id, images) return images +def get_images_urls_from_response(response) -> Optional[str]: + """Returns the list of image urls from the Kling image generation task result. + Will not raise an error if the response is not valid. If there is only one image, returns the url as a string. If there are multiple images, returns a list of urls. + """ + if response and is_valid_image_response(response): + images = get_images_from_response(response) + image_urls = [str(image.url) for image in images] + return "\n".join(image_urls) + else: + return None + + def video_result_to_node_output( video: KlingVideoResult, ) -> tuple[VideoFromFile, str, str]: @@ -312,6 +358,7 @@ class KlingCameraControls(KlingNodeBase): RETURN_TYPES = ("CAMERA_CONTROL",) RETURN_NAMES = ("camera_control",) FUNCTION = "main" + API_NODE = False # This is just a helper node, it doesn't make an API call @classmethod def VALIDATE_INPUTS( @@ -421,6 +468,7 @@ class KlingTextToVideoNode(KlingNodeBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -428,7 +476,9 @@ class KlingTextToVideoNode(KlingNodeBase): RETURN_NAMES = ("VIDEO", "video_id", "duration") DESCRIPTION = "Kling Text to Video Node" - def get_response(self, task_id: str, auth_kwargs: dict[str,str]) -> KlingText2VideoResponse: + def get_response( + self, task_id: str, auth_kwargs: dict[str, str], node_id: Optional[str] = None + ) -> KlingText2VideoResponse: return poll_until_finished( auth_kwargs, ApiEndpoint( @@ -437,6 +487,9 @@ class KlingTextToVideoNode(KlingNodeBase): request_model=EmptyRequest, response_model=KlingText2VideoResponse, ), + result_url_extractor=get_video_url_from_response, + estimated_duration=AVERAGE_DURATION_T2V, + node_id=node_id, ) def api_call( @@ -449,6 +502,7 @@ class KlingTextToVideoNode(KlingNodeBase): camera_control: Optional[KlingCameraControl] = None, model_name: Optional[str] = None, duration: Optional[str] = None, + unique_id: Optional[str] = None, **kwargs, ) -> tuple[VideoFromFile, str, str]: validate_prompts(prompt, negative_prompt, MAX_PROMPT_LENGTH_T2V) @@ -478,7 +532,9 @@ class KlingTextToVideoNode(KlingNodeBase): validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_kwargs=kwargs) + final_response = self.get_response( + task_id, auth_kwargs=kwargs, node_id=unique_id + ) validate_video_result_response(final_response) video = get_video_from_response(final_response) @@ -528,6 +584,7 @@ class KlingCameraControlT2VNode(KlingTextToVideoNode): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -540,6 +597,7 @@ class KlingCameraControlT2VNode(KlingTextToVideoNode): cfg_scale: float, aspect_ratio: str, camera_control: Optional[KlingCameraControl] = None, + unique_id: Optional[str] = None, **kwargs, ): return super().api_call( @@ -613,6 +671,7 @@ class KlingImage2VideoNode(KlingNodeBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -620,7 +679,9 @@ class KlingImage2VideoNode(KlingNodeBase): RETURN_NAMES = ("VIDEO", "video_id", "duration") DESCRIPTION = "Kling Image to Video Node" - def get_response(self, task_id: str, auth_kwargs: dict[str,str]) -> KlingImage2VideoResponse: + def get_response( + self, task_id: str, auth_kwargs: dict[str, str], node_id: Optional[str] = None + ) -> KlingImage2VideoResponse: return poll_until_finished( auth_kwargs, ApiEndpoint( @@ -629,6 +690,9 @@ class KlingImage2VideoNode(KlingNodeBase): request_model=KlingImage2VideoRequest, response_model=KlingImage2VideoResponse, ), + result_url_extractor=get_video_url_from_response, + estimated_duration=AVERAGE_DURATION_I2V, + node_id=node_id, ) def api_call( @@ -643,6 +707,7 @@ class KlingImage2VideoNode(KlingNodeBase): duration: str, camera_control: Optional[KlingCameraControl] = None, end_frame: Optional[torch.Tensor] = None, + unique_id: Optional[str] = None, **kwargs, ) -> tuple[VideoFromFile]: validate_prompts(prompt, negative_prompt, MAX_PROMPT_LENGTH_I2V) @@ -681,7 +746,9 @@ class KlingImage2VideoNode(KlingNodeBase): validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_kwargs=kwargs) + final_response = self.get_response( + task_id, auth_kwargs=kwargs, node_id=unique_id + ) validate_video_result_response(final_response) video = get_video_from_response(final_response) @@ -734,6 +801,7 @@ class KlingCameraControlI2VNode(KlingImage2VideoNode): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -747,6 +815,7 @@ class KlingCameraControlI2VNode(KlingImage2VideoNode): cfg_scale: float, aspect_ratio: str, camera_control: KlingCameraControl, + unique_id: Optional[str] = None, **kwargs, ): return super().api_call( @@ -759,6 +828,7 @@ class KlingCameraControlI2VNode(KlingImage2VideoNode): prompt=prompt, negative_prompt=negative_prompt, camera_control=camera_control, + unique_id=unique_id, **kwargs, ) @@ -830,6 +900,7 @@ class KlingStartEndFrameNode(KlingImage2VideoNode): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -844,6 +915,7 @@ class KlingStartEndFrameNode(KlingImage2VideoNode): cfg_scale: float, aspect_ratio: str, mode: str, + unique_id: Optional[str] = None, **kwargs, ): mode, duration, model_name = KlingStartEndFrameNode.get_mode_string_mapping()[ @@ -859,6 +931,7 @@ class KlingStartEndFrameNode(KlingImage2VideoNode): aspect_ratio=aspect_ratio, duration=duration, end_frame=end_frame, + unique_id=unique_id, **kwargs, ) @@ -892,6 +965,7 @@ class KlingVideoExtendNode(KlingNodeBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -899,7 +973,9 @@ class KlingVideoExtendNode(KlingNodeBase): RETURN_NAMES = ("VIDEO", "video_id", "duration") DESCRIPTION = "Kling Video Extend Node. Extend videos made by other Kling nodes. The video_id is created by using other Kling Nodes." - def get_response(self, task_id: str, auth_kwargs: dict[str,str]) -> KlingVideoExtendResponse: + def get_response( + self, task_id: str, auth_kwargs: dict[str, str], node_id: Optional[str] = None + ) -> KlingVideoExtendResponse: return poll_until_finished( auth_kwargs, ApiEndpoint( @@ -908,6 +984,9 @@ class KlingVideoExtendNode(KlingNodeBase): request_model=EmptyRequest, response_model=KlingVideoExtendResponse, ), + result_url_extractor=get_video_url_from_response, + estimated_duration=AVERAGE_DURATION_VIDEO_EXTEND, + node_id=node_id, ) def api_call( @@ -916,6 +995,7 @@ class KlingVideoExtendNode(KlingNodeBase): negative_prompt: str, cfg_scale: float, video_id: str, + unique_id: Optional[str] = None, **kwargs, ) -> tuple[VideoFromFile, str, str]: validate_prompts(prompt, negative_prompt, MAX_PROMPT_LENGTH_T2V) @@ -939,7 +1019,9 @@ class KlingVideoExtendNode(KlingNodeBase): validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_kwargs=kwargs) + final_response = self.get_response( + task_id, auth_kwargs=kwargs, node_id=unique_id + ) validate_video_result_response(final_response) video = get_video_from_response(final_response) @@ -952,7 +1034,9 @@ class KlingVideoEffectsBase(KlingNodeBase): RETURN_TYPES = ("VIDEO", "STRING", "STRING") RETURN_NAMES = ("VIDEO", "video_id", "duration") - def get_response(self, task_id: str, auth_kwargs: dict[str,str]) -> KlingVideoEffectsResponse: + def get_response( + self, task_id: str, auth_kwargs: dict[str, str], node_id: Optional[str] = None + ) -> KlingVideoEffectsResponse: return poll_until_finished( auth_kwargs, ApiEndpoint( @@ -961,6 +1045,9 @@ class KlingVideoEffectsBase(KlingNodeBase): request_model=EmptyRequest, response_model=KlingVideoEffectsResponse, ), + result_url_extractor=get_video_url_from_response, + estimated_duration=AVERAGE_DURATION_VIDEO_EFFECTS, + node_id=node_id, ) def api_call( @@ -972,6 +1059,7 @@ class KlingVideoEffectsBase(KlingNodeBase): image_1: torch.Tensor, image_2: Optional[torch.Tensor] = None, mode: Optional[KlingVideoGenMode] = None, + unique_id: Optional[str] = None, **kwargs, ): if dual_character: @@ -1009,7 +1097,9 @@ class KlingVideoEffectsBase(KlingNodeBase): validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_kwargs=kwargs) + final_response = self.get_response( + task_id, auth_kwargs=kwargs, node_id=unique_id + ) validate_video_result_response(final_response) video = get_video_from_response(final_response) @@ -1053,6 +1143,7 @@ class KlingDualCharacterVideoEffectNode(KlingVideoEffectsBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -1068,6 +1159,7 @@ class KlingDualCharacterVideoEffectNode(KlingVideoEffectsBase): model_name: KlingCharacterEffectModelName, mode: KlingVideoGenMode, duration: KlingVideoGenDuration, + unique_id: Optional[str] = None, **kwargs, ): video, _, duration = super().api_call( @@ -1078,10 +1170,12 @@ class KlingDualCharacterVideoEffectNode(KlingVideoEffectsBase): duration=duration, image_1=image_left, image_2=image_right, + unique_id=unique_id, **kwargs, ) return video, duration + class KlingSingleImageVideoEffectNode(KlingVideoEffectsBase): """Kling Single Image Video Effect Node""" @@ -1117,6 +1211,7 @@ class KlingSingleImageVideoEffectNode(KlingVideoEffectsBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -1128,6 +1223,7 @@ class KlingSingleImageVideoEffectNode(KlingVideoEffectsBase): effect_scene: KlingSingleImageEffectsScene, model_name: KlingSingleImageEffectModelName, duration: KlingVideoGenDuration, + unique_id: Optional[str] = None, **kwargs, ): return super().api_call( @@ -1136,6 +1232,7 @@ class KlingSingleImageVideoEffectNode(KlingVideoEffectsBase): model_name=model_name, duration=duration, image_1=image, + unique_id=unique_id, **kwargs, ) @@ -1154,7 +1251,9 @@ class KlingLipSyncBase(KlingNodeBase): f"Text is too long. Maximum length is {MAX_PROMPT_LENGTH_LIP_SYNC} characters." ) - def get_response(self, task_id: str, auth_kwargs: dict[str,str]) -> KlingLipSyncResponse: + def get_response( + self, task_id: str, auth_kwargs: dict[str, str], node_id: Optional[str] = None + ) -> KlingLipSyncResponse: """Polls the Kling API endpoint until the task reaches a terminal state.""" return poll_until_finished( auth_kwargs, @@ -1164,6 +1263,9 @@ class KlingLipSyncBase(KlingNodeBase): request_model=EmptyRequest, response_model=KlingLipSyncResponse, ), + result_url_extractor=get_video_url_from_response, + estimated_duration=AVERAGE_DURATION_LIP_SYNC, + node_id=node_id, ) def api_call( @@ -1175,7 +1277,8 @@ class KlingLipSyncBase(KlingNodeBase): text: Optional[str] = None, voice_speed: Optional[float] = None, voice_id: Optional[str] = None, - **kwargs + unique_id: Optional[str] = None, + **kwargs, ) -> tuple[VideoFromFile, str, str]: if text: self.validate_text(text) @@ -1217,7 +1320,9 @@ class KlingLipSyncBase(KlingNodeBase): validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_kwargs=kwargs) + final_response = self.get_response( + task_id, auth_kwargs=kwargs, node_id=unique_id + ) validate_video_result_response(final_response) video = get_video_from_response(final_response) @@ -1243,6 +1348,7 @@ class KlingLipSyncAudioToVideoNode(KlingLipSyncBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -1253,6 +1359,7 @@ class KlingLipSyncAudioToVideoNode(KlingLipSyncBase): video: VideoInput, audio: AudioInput, voice_language: str, + unique_id: Optional[str] = None, **kwargs, ): return super().api_call( @@ -1260,6 +1367,7 @@ class KlingLipSyncAudioToVideoNode(KlingLipSyncBase): audio=audio, voice_language=voice_language, mode="audio2video", + unique_id=unique_id, **kwargs, ) @@ -1352,6 +1460,7 @@ class KlingLipSyncTextToVideoNode(KlingLipSyncBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -1363,6 +1472,7 @@ class KlingLipSyncTextToVideoNode(KlingLipSyncBase): text: str, voice: str, voice_speed: float, + unique_id: Optional[str] = None, **kwargs, ): voice_id, voice_language = KlingLipSyncTextToVideoNode.get_voice_config()[voice] @@ -1373,6 +1483,7 @@ class KlingLipSyncTextToVideoNode(KlingLipSyncBase): voice_id=voice_id, voice_speed=voice_speed, mode="text2video", + unique_id=unique_id, **kwargs, ) @@ -1413,13 +1524,14 @@ class KlingVirtualTryOnNode(KlingImageGenerationBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } - DESCRIPTION = "Kling Virtual Try On Node. Input a human image and a cloth image to try on the cloth on the human." + DESCRIPTION = "Kling Virtual Try On Node. Input a human image and a cloth image to try on the cloth on the human. You can merge multiple clothing item pictures into one image with a white background." def get_response( - self, task_id: str, auth_kwargs: dict[str,str] = None + self, task_id: str, auth_kwargs: dict[str, str], node_id: Optional[str] = None ) -> KlingVirtualTryOnResponse: return poll_until_finished( auth_kwargs, @@ -1429,6 +1541,9 @@ class KlingVirtualTryOnNode(KlingImageGenerationBase): request_model=EmptyRequest, response_model=KlingVirtualTryOnResponse, ), + result_url_extractor=get_images_urls_from_response, + estimated_duration=AVERAGE_DURATION_VIRTUAL_TRY_ON, + node_id=node_id, ) def api_call( @@ -1436,6 +1551,7 @@ class KlingVirtualTryOnNode(KlingImageGenerationBase): human_image: torch.Tensor, cloth_image: torch.Tensor, model_name: KlingVirtualTryOnModelName, + unique_id: Optional[str] = None, **kwargs, ): initial_operation = SynchronousOperation( @@ -1457,7 +1573,9 @@ class KlingVirtualTryOnNode(KlingImageGenerationBase): validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_kwargs=kwargs) + final_response = self.get_response( + task_id, auth_kwargs=kwargs, node_id=unique_id + ) validate_image_result_response(final_response) images = get_images_from_response(final_response) @@ -1528,13 +1646,17 @@ class KlingImageGenerationNode(KlingImageGenerationBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } DESCRIPTION = "Kling Image Generation Node. Generate an image from a text prompt with an optional reference image." def get_response( - self, task_id: str, auth_kwargs: Optional[dict[str,str]] = None + self, + task_id: str, + auth_kwargs: Optional[dict[str, str]], + node_id: Optional[str] = None, ) -> KlingImageGenerationsResponse: return poll_until_finished( auth_kwargs, @@ -1544,6 +1666,9 @@ class KlingImageGenerationNode(KlingImageGenerationBase): request_model=EmptyRequest, response_model=KlingImageGenerationsResponse, ), + result_url_extractor=get_images_urls_from_response, + estimated_duration=AVERAGE_DURATION_IMAGE_GEN, + node_id=node_id, ) def api_call( @@ -1557,6 +1682,7 @@ class KlingImageGenerationNode(KlingImageGenerationBase): n: int, aspect_ratio: KlingImageGenAspectRatio, image: Optional[torch.Tensor] = None, + unique_id: Optional[str] = None, **kwargs, ): self.validate_prompt(prompt, negative_prompt) @@ -1589,7 +1715,9 @@ class KlingImageGenerationNode(KlingImageGenerationBase): validate_task_creation_response(task_creation_response) task_id = task_creation_response.data.task_id - final_response = self.get_response(task_id, auth_kwargs=kwargs) + final_response = self.get_response( + task_id, auth_kwargs=kwargs, node_id=unique_id + ) validate_image_result_response(final_response) images = get_images_from_response(final_response) diff --git a/comfy_api_nodes/nodes_luma.py b/comfy_api_nodes/nodes_luma.py index bd33a53e0..525dc38e6 100644 --- a/comfy_api_nodes/nodes_luma.py +++ b/comfy_api_nodes/nodes_luma.py @@ -36,11 +36,20 @@ from comfy_api_nodes.apinode_utils import ( process_image_response, validate_string, ) +from server import PromptServer import requests import torch from io import BytesIO +LUMA_T2V_AVERAGE_DURATION = 105 +LUMA_I2V_AVERAGE_DURATION = 100 + +def image_result_url_extractor(response: LumaGeneration): + return response.assets.image if hasattr(response, "assets") and hasattr(response.assets, "image") else None + +def video_result_url_extractor(response: LumaGeneration): + return response.assets.video if hasattr(response, "assets") and hasattr(response.assets, "video") else None class LumaReferenceNode(ComfyNodeABC): """ @@ -204,6 +213,7 @@ class LumaImageGenerationNode(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -217,6 +227,7 @@ class LumaImageGenerationNode(ComfyNodeABC): image_luma_ref: LumaReferenceChain = None, style_image: torch.Tensor = None, character_image: torch.Tensor = None, + unique_id: str = None, **kwargs, ): validate_string(prompt, strip_whitespace=True, min_length=3) @@ -271,6 +282,8 @@ class LumaImageGenerationNode(ComfyNodeABC): completed_statuses=[LumaState.completed], failed_statuses=[LumaState.failed], status_extractor=lambda x: x.state, + result_url_extractor=image_result_url_extractor, + node_id=unique_id, auth_kwargs=kwargs, ) response_poll = operation.execute() @@ -353,6 +366,7 @@ class LumaImageModifyNode(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -363,6 +377,7 @@ class LumaImageModifyNode(ComfyNodeABC): image: torch.Tensor, image_weight: float, seed, + unique_id: str = None, **kwargs, ): # first, upload image @@ -399,6 +414,8 @@ class LumaImageModifyNode(ComfyNodeABC): completed_statuses=[LumaState.completed], failed_statuses=[LumaState.failed], status_extractor=lambda x: x.state, + result_url_extractor=image_result_url_extractor, + node_id=unique_id, auth_kwargs=kwargs, ) response_poll = operation.execute() @@ -473,6 +490,7 @@ class LumaTextToVideoGenerationNode(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -486,6 +504,7 @@ class LumaTextToVideoGenerationNode(ComfyNodeABC): loop: bool, seed, luma_concepts: LumaConceptChain = None, + unique_id: str = None, **kwargs, ): validate_string(prompt, strip_whitespace=False, min_length=3) @@ -512,6 +531,9 @@ class LumaTextToVideoGenerationNode(ComfyNodeABC): ) response_api: LumaGeneration = operation.execute() + if unique_id: + PromptServer.instance.send_progress_text(f"Luma video generation started: {response_api.id}", unique_id) + operation = PollingOperation( poll_endpoint=ApiEndpoint( path=f"/proxy/luma/generations/{response_api.id}", @@ -522,6 +544,9 @@ class LumaTextToVideoGenerationNode(ComfyNodeABC): completed_statuses=[LumaState.completed], failed_statuses=[LumaState.failed], status_extractor=lambda x: x.state, + result_url_extractor=video_result_url_extractor, + node_id=unique_id, + estimated_duration=LUMA_T2V_AVERAGE_DURATION, auth_kwargs=kwargs, ) response_poll = operation.execute() @@ -597,6 +622,7 @@ class LumaImageToVideoGenerationNode(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -611,6 +637,7 @@ class LumaImageToVideoGenerationNode(ComfyNodeABC): first_image: torch.Tensor = None, last_image: torch.Tensor = None, luma_concepts: LumaConceptChain = None, + unique_id: str = None, **kwargs, ): if first_image is None and last_image is None: @@ -642,6 +669,9 @@ class LumaImageToVideoGenerationNode(ComfyNodeABC): ) response_api: LumaGeneration = operation.execute() + if unique_id: + PromptServer.instance.send_progress_text(f"Luma video generation started: {response_api.id}", unique_id) + operation = PollingOperation( poll_endpoint=ApiEndpoint( path=f"/proxy/luma/generations/{response_api.id}", @@ -652,6 +682,9 @@ class LumaImageToVideoGenerationNode(ComfyNodeABC): completed_statuses=[LumaState.completed], failed_statuses=[LumaState.failed], status_extractor=lambda x: x.state, + result_url_extractor=video_result_url_extractor, + node_id=unique_id, + estimated_duration=LUMA_I2V_AVERAGE_DURATION, auth_kwargs=kwargs, ) response_poll = operation.execute() diff --git a/comfy_api_nodes/nodes_minimax.py b/comfy_api_nodes/nodes_minimax.py index fd64aeb0b..9b46636db 100644 --- a/comfy_api_nodes/nodes_minimax.py +++ b/comfy_api_nodes/nodes_minimax.py @@ -1,3 +1,7 @@ +from typing import Union +import logging +import torch + from comfy.comfy_types.node_typing import IO from comfy_api.input_impl.video_types import VideoFromFile from comfy_api_nodes.apis import ( @@ -20,16 +24,19 @@ from comfy_api_nodes.apinode_utils import ( upload_images_to_comfyapi, validate_string, ) +from server import PromptServer -import torch -import logging +I2V_AVERAGE_DURATION = 114 +T2V_AVERAGE_DURATION = 234 class MinimaxTextToVideoNode: """ Generates videos synchronously based on a prompt, and optional parameters using MiniMax's API. """ + AVERAGE_DURATION = T2V_AVERAGE_DURATION + @classmethod def INPUT_TYPES(s): return { @@ -68,6 +75,7 @@ class MinimaxTextToVideoNode: "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -85,6 +93,7 @@ class MinimaxTextToVideoNode: model="T2V-01", image: torch.Tensor=None, # used for ImageToVideo subject: torch.Tensor=None, # used for SubjectToVideo + unique_id: Union[str, None]=None, **kwargs, ): ''' @@ -138,6 +147,8 @@ class MinimaxTextToVideoNode: completed_statuses=["Success"], failed_statuses=["Fail"], status_extractor=lambda x: x.status.value, + estimated_duration=self.AVERAGE_DURATION, + node_id=unique_id, auth_kwargs=kwargs, ) task_result = video_generate_operation.execute() @@ -164,6 +175,12 @@ class MinimaxTextToVideoNode: f"No video was found in the response. Full response: {file_result.model_dump()}" ) logging.info(f"Generated video URL: {file_url}") + if unique_id: + if hasattr(file_result.file, "backup_download_url"): + message = f"Result URL: {file_url}\nBackup URL: {file_result.file.backup_download_url}" + else: + message = f"Result URL: {file_url}" + PromptServer.instance.send_progress_text(message, unique_id) video_io = download_url_to_bytesio(file_url) if video_io is None: @@ -178,6 +195,8 @@ class MinimaxImageToVideoNode(MinimaxTextToVideoNode): Generates videos synchronously based on an image and prompt, and optional parameters using MiniMax's API. """ + AVERAGE_DURATION = I2V_AVERAGE_DURATION + @classmethod def INPUT_TYPES(s): return { @@ -223,6 +242,7 @@ class MinimaxImageToVideoNode(MinimaxTextToVideoNode): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -239,6 +259,8 @@ class MinimaxSubjectToVideoNode(MinimaxTextToVideoNode): Generates videos synchronously based on an image and prompt, and optional parameters using MiniMax's API. """ + AVERAGE_DURATION = T2V_AVERAGE_DURATION + @classmethod def INPUT_TYPES(s): return { @@ -282,6 +304,7 @@ class MinimaxSubjectToVideoNode(MinimaxTextToVideoNode): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } diff --git a/comfy_api_nodes/nodes_openai.py b/comfy_api_nodes/nodes_openai.py index c63908be2..ce8054afc 100644 --- a/comfy_api_nodes/nodes_openai.py +++ b/comfy_api_nodes/nodes_openai.py @@ -96,6 +96,7 @@ class OpenAIDalle2(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -113,6 +114,7 @@ class OpenAIDalle2(ComfyNodeABC): mask=None, n=1, size="1024x1024", + unique_id=None, **kwargs ): validate_string(prompt, strip_whitespace=False) @@ -176,7 +178,7 @@ class OpenAIDalle2(ComfyNodeABC): response = operation.execute() - img_tensor = validate_and_cast_response(response) + img_tensor = validate_and_cast_response(response, node_id=unique_id) return (img_tensor,) @@ -242,6 +244,7 @@ class OpenAIDalle3(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -258,6 +261,7 @@ class OpenAIDalle3(ComfyNodeABC): style="natural", quality="standard", size="1024x1024", + unique_id=None, **kwargs ): validate_string(prompt, strip_whitespace=False) @@ -284,7 +288,7 @@ class OpenAIDalle3(ComfyNodeABC): response = operation.execute() - img_tensor = validate_and_cast_response(response) + img_tensor = validate_and_cast_response(response, node_id=unique_id) return (img_tensor,) @@ -375,6 +379,7 @@ class OpenAIGPTImage1(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -394,6 +399,7 @@ class OpenAIGPTImage1(ComfyNodeABC): mask=None, n=1, size="1024x1024", + unique_id=None, **kwargs ): validate_string(prompt, strip_whitespace=False) @@ -476,7 +482,7 @@ class OpenAIGPTImage1(ComfyNodeABC): response = operation.execute() - img_tensor = validate_and_cast_response(response) + img_tensor = validate_and_cast_response(response, node_id=unique_id) return (img_tensor,) diff --git a/comfy_api_nodes/nodes_pika.py b/comfy_api_nodes/nodes_pika.py index 08ec9cf07..30562790a 100644 --- a/comfy_api_nodes/nodes_pika.py +++ b/comfy_api_nodes/nodes_pika.py @@ -121,7 +121,10 @@ class PikaNodeBase(ComfyNodeABC): RETURN_TYPES = ("VIDEO",) def poll_for_task_status( - self, task_id: str, auth_kwargs: Optional[dict[str,str]] = None + self, + task_id: str, + auth_kwargs: Optional[dict[str, str]] = None, + node_id: Optional[str] = None, ) -> PikaGenerateResponse: polling_operation = PollingOperation( poll_endpoint=ApiEndpoint( @@ -141,13 +144,19 @@ class PikaNodeBase(ComfyNodeABC): response.progress if hasattr(response, "progress") else None ), auth_kwargs=auth_kwargs, + result_url_extractor=lambda response: ( + response.url if hasattr(response, "url") else None + ), + node_id=node_id, + estimated_duration=60 ) return polling_operation.execute() def execute_task( self, initial_operation: SynchronousOperation[R, PikaGenerateResponse], - auth_kwargs: Optional[dict[str,str]] = None, + auth_kwargs: Optional[dict[str, str]] = None, + node_id: Optional[str] = None, ) -> tuple[VideoFromFile]: """Executes the initial operation then polls for the task status until it is completed. @@ -208,7 +217,8 @@ class PikaImageToVideoV2_2(PikaNodeBase): seed: int, resolution: str, duration: int, - **kwargs + unique_id: str, + **kwargs, ) -> tuple[VideoFromFile]: # Convert image to BytesIO image_bytes_io = tensor_to_bytesio(image) @@ -238,7 +248,7 @@ class PikaImageToVideoV2_2(PikaNodeBase): auth_kwargs=kwargs, ) - return self.execute_task(initial_operation, auth_kwargs=kwargs) + return self.execute_task(initial_operation, auth_kwargs=kwargs, node_id=unique_id) class PikaTextToVideoNodeV2_2(PikaNodeBase): @@ -262,6 +272,7 @@ class PikaTextToVideoNodeV2_2(PikaNodeBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -275,6 +286,7 @@ class PikaTextToVideoNodeV2_2(PikaNodeBase): resolution: str, duration: int, aspect_ratio: float, + unique_id: str, **kwargs, ) -> tuple[VideoFromFile]: initial_operation = SynchronousOperation( @@ -296,7 +308,7 @@ class PikaTextToVideoNodeV2_2(PikaNodeBase): content_type="application/x-www-form-urlencoded", ) - return self.execute_task(initial_operation, auth_kwargs=kwargs) + return self.execute_task(initial_operation, auth_kwargs=kwargs, node_id=unique_id) class PikaScenesV2_2(PikaNodeBase): @@ -340,6 +352,7 @@ class PikaScenesV2_2(PikaNodeBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -354,6 +367,7 @@ class PikaScenesV2_2(PikaNodeBase): duration: int, ingredients_mode: str, aspect_ratio: float, + unique_id: str, image_ingredient_1: Optional[torch.Tensor] = None, image_ingredient_2: Optional[torch.Tensor] = None, image_ingredient_3: Optional[torch.Tensor] = None, @@ -403,7 +417,7 @@ class PikaScenesV2_2(PikaNodeBase): auth_kwargs=kwargs, ) - return self.execute_task(initial_operation, auth_kwargs=kwargs) + return self.execute_task(initial_operation, auth_kwargs=kwargs, node_id=unique_id) class PikAdditionsNode(PikaNodeBase): @@ -439,6 +453,7 @@ class PikAdditionsNode(PikaNodeBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -451,6 +466,7 @@ class PikAdditionsNode(PikaNodeBase): prompt_text: str, negative_prompt: str, seed: int, + unique_id: str, **kwargs, ) -> tuple[VideoFromFile]: # Convert video to BytesIO @@ -487,7 +503,7 @@ class PikAdditionsNode(PikaNodeBase): auth_kwargs=kwargs, ) - return self.execute_task(initial_operation, auth_kwargs=kwargs) + return self.execute_task(initial_operation, auth_kwargs=kwargs, node_id=unique_id) class PikaSwapsNode(PikaNodeBase): @@ -532,6 +548,7 @@ class PikaSwapsNode(PikaNodeBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -546,6 +563,7 @@ class PikaSwapsNode(PikaNodeBase): prompt_text: str, negative_prompt: str, seed: int, + unique_id: str, **kwargs, ) -> tuple[VideoFromFile]: # Convert video to BytesIO @@ -592,7 +610,7 @@ class PikaSwapsNode(PikaNodeBase): auth_kwargs=kwargs, ) - return self.execute_task(initial_operation, auth_kwargs=kwargs) + return self.execute_task(initial_operation, auth_kwargs=kwargs, node_id=unique_id) class PikaffectsNode(PikaNodeBase): @@ -637,6 +655,7 @@ class PikaffectsNode(PikaNodeBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -649,6 +668,7 @@ class PikaffectsNode(PikaNodeBase): prompt_text: str, negative_prompt: str, seed: int, + unique_id: str, **kwargs, ) -> tuple[VideoFromFile]: @@ -670,7 +690,7 @@ class PikaffectsNode(PikaNodeBase): auth_kwargs=kwargs, ) - return self.execute_task(initial_operation, auth_kwargs=kwargs) + return self.execute_task(initial_operation, auth_kwargs=kwargs, node_id=unique_id) class PikaStartEndFrameNode2_2(PikaNodeBase): @@ -689,6 +709,7 @@ class PikaStartEndFrameNode2_2(PikaNodeBase): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -703,6 +724,7 @@ class PikaStartEndFrameNode2_2(PikaNodeBase): seed: int, resolution: str, duration: int, + unique_id: str, **kwargs, ) -> tuple[VideoFromFile]: @@ -733,7 +755,7 @@ class PikaStartEndFrameNode2_2(PikaNodeBase): auth_kwargs=kwargs, ) - return self.execute_task(initial_operation, auth_kwargs=kwargs) + return self.execute_task(initial_operation, auth_kwargs=kwargs, node_id=unique_id) NODE_CLASS_MAPPINGS = { diff --git a/comfy_api_nodes/nodes_pixverse.py b/comfy_api_nodes/nodes_pixverse.py index 0c29e77c2..ef4a9a802 100644 --- a/comfy_api_nodes/nodes_pixverse.py +++ b/comfy_api_nodes/nodes_pixverse.py @@ -1,5 +1,5 @@ from inspect import cleandoc - +from typing import Optional from comfy_api_nodes.apis.pixverse_api import ( PixverseTextVideoRequest, PixverseImageVideoRequest, @@ -34,11 +34,22 @@ import requests from io import BytesIO +AVERAGE_DURATION_T2V = 32 +AVERAGE_DURATION_I2V = 30 +AVERAGE_DURATION_T2T = 52 + + +def get_video_url_from_response( + response: PixverseGenerationStatusResponse, +) -> Optional[str]: + if response.Resp is None or response.Resp.url is None: + return None + return str(response.Resp.url) + + def upload_image_to_pixverse(image: torch.Tensor, auth_kwargs=None): # first, upload image to Pixverse and get image id to use in actual generation call - files = { - "image": tensor_to_bytesio(image) - } + files = {"image": tensor_to_bytesio(image)} operation = SynchronousOperation( endpoint=ApiEndpoint( path="/proxy/pixverse/image/upload", @@ -54,7 +65,9 @@ def upload_image_to_pixverse(image: torch.Tensor, auth_kwargs=None): response_upload: PixverseImageUploadResponse = operation.execute() if response_upload.Resp is None: - raise Exception(f"PixVerse image upload request failed: '{response_upload.ErrMsg}'") + raise Exception( + f"PixVerse image upload request failed: '{response_upload.ErrMsg}'" + ) return response_upload.Resp.img_id @@ -73,7 +86,7 @@ class PixverseTemplateNode: def INPUT_TYPES(s): return { "required": { - "template": (list(pixverse_templates.keys()), ), + "template": (list(pixverse_templates.keys()),), } } @@ -87,7 +100,7 @@ class PixverseTemplateNode: class PixverseTextToVideoNode(ComfyNodeABC): """ - Generates videos synchronously based on prompt and output_size. + Generates videos based on prompt and output_size. """ RETURN_TYPES = (IO.VIDEO,) @@ -108,9 +121,7 @@ class PixverseTextToVideoNode(ComfyNodeABC): "tooltip": "Prompt for the video generation", }, ), - "aspect_ratio": ( - [ratio.value for ratio in PixverseAspectRatio], - ), + "aspect_ratio": ([ratio.value for ratio in PixverseAspectRatio],), "quality": ( [resolution.value for resolution in PixverseQuality], { @@ -143,12 +154,13 @@ class PixverseTextToVideoNode(ComfyNodeABC): PixverseIO.TEMPLATE, { "tooltip": "An optional template to influence style of generation, created by the PixVerse Template node." - } - ) + }, + ), }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -160,8 +172,9 @@ class PixverseTextToVideoNode(ComfyNodeABC): duration_seconds: int, motion_mode: str, seed, - negative_prompt: str=None, - pixverse_template: int=None, + negative_prompt: str = None, + pixverse_template: int = None, + unique_id: Optional[str] = None, **kwargs, ): validate_string(prompt, strip_whitespace=False) @@ -205,19 +218,27 @@ class PixverseTextToVideoNode(ComfyNodeABC): response_model=PixverseGenerationStatusResponse, ), completed_statuses=[PixverseStatus.successful], - failed_statuses=[PixverseStatus.contents_moderation, PixverseStatus.failed, PixverseStatus.deleted], + failed_statuses=[ + PixverseStatus.contents_moderation, + PixverseStatus.failed, + PixverseStatus.deleted, + ], status_extractor=lambda x: x.Resp.status, auth_kwargs=kwargs, + node_id=unique_id, + result_url_extractor=get_video_url_from_response, + estimated_duration=AVERAGE_DURATION_T2V, ) response_poll = operation.execute() vid_response = requests.get(response_poll.Resp.url) + return (VideoFromFile(BytesIO(vid_response.content)),) class PixverseImageToVideoNode(ComfyNodeABC): """ - Generates videos synchronously based on prompt and output_size. + Generates videos based on prompt and output_size. """ RETURN_TYPES = (IO.VIDEO,) @@ -230,9 +251,7 @@ class PixverseImageToVideoNode(ComfyNodeABC): def INPUT_TYPES(s): return { "required": { - "image": ( - IO.IMAGE, - ), + "image": (IO.IMAGE,), "prompt": ( IO.STRING, { @@ -273,12 +292,13 @@ class PixverseImageToVideoNode(ComfyNodeABC): PixverseIO.TEMPLATE, { "tooltip": "An optional template to influence style of generation, created by the PixVerse Template node." - } - ) + }, + ), }, "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -290,8 +310,9 @@ class PixverseImageToVideoNode(ComfyNodeABC): duration_seconds: int, motion_mode: str, seed, - negative_prompt: str=None, - pixverse_template: int=None, + negative_prompt: str = None, + pixverse_template: int = None, + unique_id: Optional[str] = None, **kwargs, ): validate_string(prompt, strip_whitespace=False) @@ -337,9 +358,16 @@ class PixverseImageToVideoNode(ComfyNodeABC): response_model=PixverseGenerationStatusResponse, ), completed_statuses=[PixverseStatus.successful], - failed_statuses=[PixverseStatus.contents_moderation, PixverseStatus.failed, PixverseStatus.deleted], + failed_statuses=[ + PixverseStatus.contents_moderation, + PixverseStatus.failed, + PixverseStatus.deleted, + ], status_extractor=lambda x: x.Resp.status, auth_kwargs=kwargs, + node_id=unique_id, + result_url_extractor=get_video_url_from_response, + estimated_duration=AVERAGE_DURATION_I2V, ) response_poll = operation.execute() @@ -349,7 +377,7 @@ class PixverseImageToVideoNode(ComfyNodeABC): class PixverseTransitionVideoNode(ComfyNodeABC): """ - Generates videos synchronously based on prompt and output_size. + Generates videos based on prompt and output_size. """ RETURN_TYPES = (IO.VIDEO,) @@ -362,12 +390,8 @@ class PixverseTransitionVideoNode(ComfyNodeABC): def INPUT_TYPES(s): return { "required": { - "first_frame": ( - IO.IMAGE, - ), - "last_frame": ( - IO.IMAGE, - ), + "first_frame": (IO.IMAGE,), + "last_frame": (IO.IMAGE,), "prompt": ( IO.STRING, { @@ -408,6 +432,7 @@ class PixverseTransitionVideoNode(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -420,7 +445,8 @@ class PixverseTransitionVideoNode(ComfyNodeABC): duration_seconds: int, motion_mode: str, seed, - negative_prompt: str=None, + negative_prompt: str = None, + unique_id: Optional[str] = None, **kwargs, ): validate_string(prompt, strip_whitespace=False) @@ -467,9 +493,16 @@ class PixverseTransitionVideoNode(ComfyNodeABC): response_model=PixverseGenerationStatusResponse, ), completed_statuses=[PixverseStatus.successful], - failed_statuses=[PixverseStatus.contents_moderation, PixverseStatus.failed, PixverseStatus.deleted], + failed_statuses=[ + PixverseStatus.contents_moderation, + PixverseStatus.failed, + PixverseStatus.deleted, + ], status_extractor=lambda x: x.Resp.status, auth_kwargs=kwargs, + node_id=unique_id, + result_url_extractor=get_video_url_from_response, + estimated_duration=AVERAGE_DURATION_T2V, ) response_poll = operation.execute() diff --git a/comfy_api_nodes/nodes_recraft.py b/comfy_api_nodes/nodes_recraft.py index 767d93e3c..e369c4b7e 100644 --- a/comfy_api_nodes/nodes_recraft.py +++ b/comfy_api_nodes/nodes_recraft.py @@ -1,5 +1,6 @@ from __future__ import annotations from inspect import cleandoc +from typing import Optional from comfy.utils import ProgressBar from comfy_extras.nodes_images import SVG # Added from comfy.comfy_types.node_typing import IO @@ -29,6 +30,8 @@ from comfy_api_nodes.apinode_utils import ( resize_mask_to_image, validate_string, ) +from server import PromptServer + import torch from io import BytesIO from PIL import UnidentifiedImageError @@ -388,6 +391,7 @@ class RecraftTextToImageNode: "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -400,6 +404,7 @@ class RecraftTextToImageNode: recraft_style: RecraftStyle = None, negative_prompt: str = None, recraft_controls: RecraftControls = None, + unique_id: Optional[str] = None, **kwargs, ): validate_string(prompt, strip_whitespace=False, max_length=1000) @@ -436,8 +441,15 @@ class RecraftTextToImageNode: ) response: RecraftImageGenerationResponse = operation.execute() images = [] + urls = [] for data in response.data: with handle_recraft_image_output(): + if unique_id and data.url: + urls.append(data.url) + urls_string = '\n'.join(urls) + PromptServer.instance.send_progress_text( + f"Result URL: {urls_string}", unique_id + ) image = bytesio_to_image_tensor( download_url_to_bytesio(data.url, timeout=1024) ) @@ -763,6 +775,7 @@ class RecraftTextToVectorNode: "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -775,6 +788,7 @@ class RecraftTextToVectorNode: seed, negative_prompt: str = None, recraft_controls: RecraftControls = None, + unique_id: Optional[str] = None, **kwargs, ): validate_string(prompt, strip_whitespace=False, max_length=1000) @@ -809,7 +823,14 @@ class RecraftTextToVectorNode: ) response: RecraftImageGenerationResponse = operation.execute() svg_data = [] + urls = [] for data in response.data: + if unique_id and data.url: + urls.append(data.url) + # Print result on each iteration in case of error + PromptServer.instance.send_progress_text( + f"Result URL: {' '.join(urls)}", unique_id + ) svg_data.append(download_url_to_bytesio(data.url, timeout=1024)) return (SVG(svg_data),) diff --git a/comfy_api_nodes/nodes_veo2.py b/comfy_api_nodes/nodes_veo2.py index 2740179c8..df846d5dd 100644 --- a/comfy_api_nodes/nodes_veo2.py +++ b/comfy_api_nodes/nodes_veo2.py @@ -3,6 +3,7 @@ import logging import base64 import requests import torch +from typing import Optional from comfy.comfy_types.node_typing import IO, ComfyNodeABC from comfy_api.input_impl.video_types import VideoFromFile @@ -24,6 +25,8 @@ from comfy_api_nodes.apinode_utils import ( tensor_to_base64_string ) +AVERAGE_DURATION_VIDEO_GEN = 32 + def convert_image_to_base64(image: torch.Tensor): if image is None: return None @@ -31,6 +34,22 @@ def convert_image_to_base64(image: torch.Tensor): scaled_image = downscale_image_tensor(image, total_pixels=2048*2048) return tensor_to_base64_string(scaled_image) + +def get_video_url_from_response(poll_response: Veo2GenVidPollResponse) -> Optional[str]: + if ( + poll_response.response + and hasattr(poll_response.response, "videos") + and poll_response.response.videos + and len(poll_response.response.videos) > 0 + ): + video = poll_response.response.videos[0] + else: + return None + if hasattr(video, "gcsUri") and video.gcsUri: + return str(video.gcsUri) + return None + + class VeoVideoGenerationNode(ComfyNodeABC): """ Generates videos from text prompts using Google's Veo API. @@ -115,6 +134,7 @@ class VeoVideoGenerationNode(ComfyNodeABC): "hidden": { "auth_token": "AUTH_TOKEN_COMFY_ORG", "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", }, } @@ -134,6 +154,7 @@ class VeoVideoGenerationNode(ComfyNodeABC): person_generation="ALLOW", seed=0, image=None, + unique_id: Optional[str] = None, **kwargs, ): # Prepare the instances for the request @@ -215,7 +236,10 @@ class VeoVideoGenerationNode(ComfyNodeABC): operationName=operation_name ), auth_kwargs=kwargs, - poll_interval=5.0 + poll_interval=5.0, + result_url_extractor=get_video_url_from_response, + node_id=unique_id, + estimated_duration=AVERAGE_DURATION_VIDEO_GEN, ) # Execute the polling operation From f3ff5c40db3b68449b47112591eef31094cffe70 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Tue, 13 May 2025 22:28:30 -0700 Subject: [PATCH 441/478] don't retry if API returns task failure (#8111) --- comfy_api_nodes/apis/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy_api_nodes/apis/client.py b/comfy_api_nodes/apis/client.py index 838ff1e8d..62866216f 100644 --- a/comfy_api_nodes/apis/client.py +++ b/comfy_api_nodes/apis/client.py @@ -1105,7 +1105,7 @@ class PollingOperation(Generic[T, R]): except Exception as e: # For other errors, increment count and potentially abort consecutive_errors += 1 - if consecutive_errors >= max_consecutive_errors: + if consecutive_errors >= max_consecutive_errors or status == TaskStatus.FAILED: raise Exception( f"Polling aborted after {consecutive_errors} consecutive errors: {str(e)}" ) from e From 08368f8e00c07d6888907557c5ef1da7a64b5e42 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Wed, 14 May 2025 14:54:50 -0700 Subject: [PATCH 442/478] Update comment on ROCm pytorch attention in README. (#8123) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index deee70c6b..dcdaa353c 100644 --- a/README.md +++ b/README.md @@ -302,7 +302,7 @@ For AMD 7600 and maybe other RDNA3 cards: ```HSA_OVERRIDE_GFX_VERSION=11.0.0 pyt ### AMD ROCm Tips -You can enable experimental memory efficient attention on pytorch 2.5 in ComfyUI on RDNA3 and potentially other AMD GPUs using this command: +You can enable experimental memory efficient attention on recent pytorch in ComfyUI on some AMD GPUs using this command, it should already be enabled by default on RDNA3. If this improves speed for you on latest pytorch on your GPU please report it so that I can enable it by default. ```TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1 python main.py --use-pytorch-cross-attention``` From f1f9763b4c0e7c361ec2808b205ad32297c4777b Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Wed, 14 May 2025 21:11:41 -0700 Subject: [PATCH 443/478] Add `get_duration` method to Comfy VIDEO type (#8122) * get duration from VIDEO type * video get_duration unit test * fix Windows unit test: can't delete opened temp file --- comfy_api/input/video_types.py | 10 + comfy_api/input_impl/video_types.py | 32 +++ tests-unit/comfy_api_test/video_types_test.py | 239 ++++++++++++++++++ 3 files changed, 281 insertions(+) create mode 100644 tests-unit/comfy_api_test/video_types_test.py diff --git a/comfy_api/input/video_types.py b/comfy_api/input/video_types.py index 0676e0e66..dc22d34ff 100644 --- a/comfy_api/input/video_types.py +++ b/comfy_api/input/video_types.py @@ -43,3 +43,13 @@ class VideoInput(ABC): components = self.get_components() return components.images.shape[2], components.images.shape[1] + def get_duration(self) -> float: + """ + Returns the duration of the video in seconds. + + Returns: + Duration in seconds + """ + components = self.get_components() + frame_count = components.images.shape[0] + return float(frame_count / components.frame_rate) diff --git a/comfy_api/input_impl/video_types.py b/comfy_api/input_impl/video_types.py index ae48dbaa4..197f6558c 100644 --- a/comfy_api/input_impl/video_types.py +++ b/comfy_api/input_impl/video_types.py @@ -80,6 +80,38 @@ class VideoFromFile(VideoInput): return stream.width, stream.height raise ValueError(f"No video stream found in file '{self.__file}'") + def get_duration(self) -> float: + """ + Returns the duration of the video in seconds. + + Returns: + Duration in seconds + """ + if isinstance(self.__file, io.BytesIO): + self.__file.seek(0) + with av.open(self.__file, mode="r") as container: + if container.duration is not None: + return float(container.duration / av.time_base) + + # Fallback: calculate from frame count and frame rate + video_stream = next( + (s for s in container.streams if s.type == "video"), None + ) + if video_stream and video_stream.frames and video_stream.average_rate: + return float(video_stream.frames / video_stream.average_rate) + + # Last resort: decode frames to count them + if video_stream and video_stream.average_rate: + frame_count = 0 + container.seek(0) + for packet in container.demux(video_stream): + for _ in packet.decode(): + frame_count += 1 + if frame_count > 0: + return float(frame_count / video_stream.average_rate) + + raise ValueError(f"Could not determine duration for file '{self.__file}'") + def get_components_internal(self, container: InputContainer) -> VideoComponents: # Get video frames frames = [] diff --git a/tests-unit/comfy_api_test/video_types_test.py b/tests-unit/comfy_api_test/video_types_test.py new file mode 100644 index 000000000..b25fcb1ca --- /dev/null +++ b/tests-unit/comfy_api_test/video_types_test.py @@ -0,0 +1,239 @@ +import pytest +import torch +import tempfile +import os +import av +import io +from fractions import Fraction +from comfy_api.input_impl.video_types import VideoFromFile, VideoFromComponents +from comfy_api.util.video_types import VideoComponents +from comfy_api.input.basic_types import AudioInput +from av.error import InvalidDataError + +EPSILON = 0.0001 + + +@pytest.fixture +def sample_images(): + """3-frame 2x2 RGB video tensor""" + return torch.rand(3, 2, 2, 3) + + +@pytest.fixture +def sample_audio(): + """Stereo audio with 44.1kHz sample rate""" + return AudioInput( + { + "waveform": torch.rand(1, 2, 1000), + "sample_rate": 44100, + } + ) + + +@pytest.fixture +def video_components(sample_images, sample_audio): + """VideoComponents with images, audio, and metadata""" + return VideoComponents( + images=sample_images, + audio=sample_audio, + frame_rate=Fraction(30), + metadata={"test": "metadata"}, + ) + + +def create_test_video(width=4, height=4, frames=3, fps=30): + """Helper to create a temporary video file""" + tmp = tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) + with av.open(tmp.name, mode="w") as container: + stream = container.add_stream("h264", rate=fps) + stream.width = width + stream.height = height + stream.pix_fmt = "yuv420p" + + for i in range(frames): + frame = av.VideoFrame.from_ndarray( + torch.ones(height, width, 3, dtype=torch.uint8).numpy() * (i * 85), + format="rgb24", + ) + frame = frame.reformat(format="yuv420p") + packet = stream.encode(frame) + container.mux(packet) + + # Flush + packet = stream.encode(None) + container.mux(packet) + + return tmp.name + + +@pytest.fixture +def simple_video_file(): + """4x4 video with 3 frames at 30fps""" + file_path = create_test_video() + yield file_path + os.unlink(file_path) + + +def test_video_from_components_get_duration(video_components): + """Duration calculated correctly from frame count and frame rate""" + video = VideoFromComponents(video_components) + duration = video.get_duration() + + expected_duration = 3.0 / 30.0 + assert duration == pytest.approx(expected_duration) + + +def test_video_from_components_get_duration_different_frame_rates(sample_images): + """Duration correct for different frame rates including fractional""" + # Test with 60 fps + components_60fps = VideoComponents(images=sample_images, frame_rate=Fraction(60)) + video_60fps = VideoFromComponents(components_60fps) + assert video_60fps.get_duration() == pytest.approx(3.0 / 60.0) + + # Test with fractional frame rate (23.976fps) + components_frac = VideoComponents( + images=sample_images, frame_rate=Fraction(24000, 1001) + ) + video_frac = VideoFromComponents(components_frac) + expected_frac = 3.0 / (24000.0 / 1001.0) + assert video_frac.get_duration() == pytest.approx(expected_frac) + + +def test_video_from_components_get_duration_empty_video(): + """Duration is zero for empty video""" + empty_components = VideoComponents( + images=torch.zeros(0, 2, 2, 3), frame_rate=Fraction(30) + ) + video = VideoFromComponents(empty_components) + assert video.get_duration() == 0.0 + + +def test_video_from_components_get_dimensions(video_components): + """Dimensions returned correctly from image tensor shape""" + video = VideoFromComponents(video_components) + width, height = video.get_dimensions() + assert width == 2 + assert height == 2 + + +def test_video_from_file_get_duration(simple_video_file): + """Duration extracted from file metadata""" + video = VideoFromFile(simple_video_file) + duration = video.get_duration() + assert duration == pytest.approx(0.1, abs=0.01) + + +def test_video_from_file_get_dimensions(simple_video_file): + """Dimensions read from stream without decoding frames""" + video = VideoFromFile(simple_video_file) + width, height = video.get_dimensions() + assert width == 4 + assert height == 4 + + +def test_video_from_file_bytesio_input(): + """VideoFromFile works with BytesIO input""" + buffer = io.BytesIO() + with av.open(buffer, mode="w", format="mp4") as container: + stream = container.add_stream("h264", rate=30) + stream.width = 2 + stream.height = 2 + stream.pix_fmt = "yuv420p" + + frame = av.VideoFrame.from_ndarray( + torch.zeros(2, 2, 3, dtype=torch.uint8).numpy(), format="rgb24" + ) + frame = frame.reformat(format="yuv420p") + packet = stream.encode(frame) + container.mux(packet) + packet = stream.encode(None) + container.mux(packet) + + buffer.seek(0) + video = VideoFromFile(buffer) + + assert video.get_dimensions() == (2, 2) + assert video.get_duration() == pytest.approx(1 / 30, abs=0.01) + + +def test_video_from_file_invalid_file_error(): + """InvalidDataError raised for non-video files""" + with tempfile.NamedTemporaryFile(suffix=".txt", delete=False) as tmp: + tmp.write(b"not a video file") + tmp.flush() + tmp_name = tmp.name + + try: + with pytest.raises(InvalidDataError): + video = VideoFromFile(tmp_name) + video.get_dimensions() + finally: + os.unlink(tmp_name) + + +def test_video_from_file_audio_only_error(): + """ValueError raised for audio-only files""" + with tempfile.NamedTemporaryFile(suffix=".m4a", delete=False) as tmp: + tmp_name = tmp.name + + try: + with av.open(tmp_name, mode="w") as container: + stream = container.add_stream("aac", rate=44100) + stream.sample_rate = 44100 + stream.format = "fltp" + + audio_data = torch.zeros(1, 1024).numpy() + audio_frame = av.AudioFrame.from_ndarray( + audio_data, format="fltp", layout="mono" + ) + audio_frame.sample_rate = 44100 + audio_frame.pts = 0 + packet = stream.encode(audio_frame) + container.mux(packet) + + for packet in stream.encode(None): + container.mux(packet) + + with pytest.raises(ValueError, match="No video stream found"): + video = VideoFromFile(tmp_name) + video.get_dimensions() + finally: + os.unlink(tmp_name) + + +def test_single_frame_video(): + """Single frame video has correct duration""" + components = VideoComponents( + images=torch.rand(1, 10, 10, 3), frame_rate=Fraction(1) + ) + video = VideoFromComponents(components) + assert video.get_duration() == 1.0 + + +@pytest.mark.parametrize( + "frame_rate,expected_fps", + [ + (Fraction(24000, 1001), 24000 / 1001), + (Fraction(30000, 1001), 30000 / 1001), + (Fraction(25, 1), 25.0), + (Fraction(50, 2), 25.0), + ], +) +def test_fractional_frame_rates(frame_rate, expected_fps): + """Duration calculated correctly for various fractional frame rates""" + components = VideoComponents(images=torch.rand(100, 4, 4, 3), frame_rate=frame_rate) + video = VideoFromComponents(components) + duration = video.get_duration() + expected_duration = 100.0 / expected_fps + assert duration == pytest.approx(expected_duration) + + +def test_duration_consistency(video_components): + """get_duration() consistent with manual calculation from components""" + video = VideoFromComponents(video_components) + + duration = video.get_duration() + components = video.get_components() + manual_duration = float(components.images.shape[0] / components.frame_rate) + + assert duration == pytest.approx(manual_duration) From 6a2e4bb9e00c1ef467000d880abbbaf284c26d4a Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Thu, 15 May 2025 05:21:47 -0700 Subject: [PATCH 444/478] Remove old hack used to fix windows pytorch 2.4 on the portable. (#8139) Not necessary anymore. --- fix_torch.py | 28 ---------------------------- main.py | 7 ------- 2 files changed, 35 deletions(-) delete mode 100644 fix_torch.py diff --git a/fix_torch.py b/fix_torch.py deleted file mode 100644 index ce117b639..000000000 --- a/fix_torch.py +++ /dev/null @@ -1,28 +0,0 @@ -import importlib.util -import shutil -import os -import ctypes -import logging - - -def fix_pytorch_libomp(): - """ - Fix PyTorch libomp DLL issue on Windows by copying the correct DLL file if needed. - """ - torch_spec = importlib.util.find_spec("torch") - for folder in torch_spec.submodule_search_locations: - lib_folder = os.path.join(folder, "lib") - test_file = os.path.join(lib_folder, "fbgemm.dll") - dest = os.path.join(lib_folder, "libomp140.x86_64.dll") - if os.path.exists(dest): - break - - with open(test_file, "rb") as f: - contents = f.read() - if b"libomp140.x86_64.dll" not in contents: - break - try: - ctypes.cdll.LoadLibrary(test_file) - except FileNotFoundError: - logging.warning("Detected pytorch version with libomp issue, patching.") - shutil.copyfile(os.path.join(lib_folder, "libiomp5md.dll"), dest) diff --git a/main.py b/main.py index 221e48e41..0fde6d221 100644 --- a/main.py +++ b/main.py @@ -125,13 +125,6 @@ if __name__ == "__main__": import cuda_malloc -if args.windows_standalone_build: - try: - from fix_torch import fix_pytorch_libomp - fix_pytorch_libomp() - except: - pass - import comfy.utils import execution From c820ef950d10a6b4e4fa8ab28bc09274d563b13c Mon Sep 17 00:00:00 2001 From: George0726 <38740075+George0726@users.noreply.github.com> Date: Thu, 15 May 2025 19:00:43 -0400 Subject: [PATCH 445/478] Add Wan-FUN Camera Control models and Add WanCameraImageToVideo node (#8013) * support wan camera models * fix by ruff check * change camera_condition type; make camera_condition optional * support camera trajectory nodes * fix camera direction --------- Co-authored-by: Qirui Sun --- comfy/ldm/wan/model.py | 143 ++++++++++++++++ comfy/model_base.py | 11 ++ comfy/supported_models.py | 12 +- comfy_extras/nodes_camera_trajectory.py | 218 ++++++++++++++++++++++++ comfy_extras/nodes_wan.py | 47 +++++ nodes.py | 1 + 6 files changed, 431 insertions(+), 1 deletion(-) create mode 100644 comfy_extras/nodes_camera_trajectory.py diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index fc5ff40c5..a996dedf4 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -247,6 +247,60 @@ class VaceWanAttentionBlock(WanAttentionBlock): return c_skip, c +class WanCamAdapter(nn.Module): + def __init__(self, in_dim, out_dim, kernel_size, stride, num_residual_blocks=1, operation_settings={}): + super(WanCamAdapter, self).__init__() + + # Pixel Unshuffle: reduce spatial dimensions by a factor of 8 + self.pixel_unshuffle = nn.PixelUnshuffle(downscale_factor=8) + + # Convolution: reduce spatial dimensions by a factor + # of 2 (without overlap) + self.conv = operation_settings.get("operations").Conv2d(in_dim * 64, out_dim, kernel_size=kernel_size, stride=stride, padding=0, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + + # Residual blocks for feature extraction + self.residual_blocks = nn.Sequential( + *[WanCamResidualBlock(out_dim, operation_settings = operation_settings) for _ in range(num_residual_blocks)] + ) + + def forward(self, x): + # Reshape to merge the frame dimension into batch + bs, c, f, h, w = x.size() + x = x.permute(0, 2, 1, 3, 4).contiguous().view(bs * f, c, h, w) + + # Pixel Unshuffle operation + x_unshuffled = self.pixel_unshuffle(x) + + # Convolution operation + x_conv = self.conv(x_unshuffled) + + # Feature extraction with residual blocks + out = self.residual_blocks(x_conv) + + # Reshape to restore original bf dimension + out = out.view(bs, f, out.size(1), out.size(2), out.size(3)) + + # Permute dimensions to reorder (if needed), e.g., swap channels and feature frames + out = out.permute(0, 2, 1, 3, 4) + + return out + + +class WanCamResidualBlock(nn.Module): + def __init__(self, dim, operation_settings={}): + super(WanCamResidualBlock, self).__init__() + self.conv1 = operation_settings.get("operations").Conv2d(dim, dim, kernel_size=3, padding=1, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + self.relu = nn.ReLU(inplace=True) + self.conv2 = operation_settings.get("operations").Conv2d(dim, dim, kernel_size=3, padding=1, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")) + + def forward(self, x): + residual = x + out = self.relu(self.conv1(x)) + out = self.conv2(out) + out += residual + return out + + class Head(nn.Module): def __init__(self, dim, out_dim, patch_size, eps=1e-6, operation_settings={}): @@ -637,3 +691,92 @@ class VaceWanModel(WanModel): # unpatchify x = self.unpatchify(x, grid_sizes) return x + +class CameraWanModel(WanModel): + r""" + Wan diffusion backbone supporting both text-to-video and image-to-video. + """ + + def __init__(self, + model_type='camera', + patch_size=(1, 2, 2), + text_len=512, + in_dim=16, + dim=2048, + ffn_dim=8192, + freq_dim=256, + text_dim=4096, + out_dim=16, + num_heads=16, + num_layers=32, + window_size=(-1, -1), + qk_norm=True, + cross_attn_norm=True, + eps=1e-6, + flf_pos_embed_token_number=None, + image_model=None, + in_dim_control_adapter=24, + device=None, + dtype=None, + operations=None, + ): + + super().__init__(model_type='i2v', patch_size=patch_size, text_len=text_len, in_dim=in_dim, dim=dim, ffn_dim=ffn_dim, freq_dim=freq_dim, text_dim=text_dim, out_dim=out_dim, num_heads=num_heads, num_layers=num_layers, window_size=window_size, qk_norm=qk_norm, cross_attn_norm=cross_attn_norm, eps=eps, flf_pos_embed_token_number=flf_pos_embed_token_number, image_model=image_model, device=device, dtype=dtype, operations=operations) + operation_settings = {"operations": operations, "device": device, "dtype": dtype} + + self.control_adapter = WanCamAdapter(in_dim_control_adapter, dim, kernel_size=patch_size[1:], stride=patch_size[1:], operation_settings=operation_settings) + + + def forward_orig( + self, + x, + t, + context, + clip_fea=None, + freqs=None, + camera_conditions = None, + transformer_options={}, + **kwargs, + ): + # embeddings + x = self.patch_embedding(x.float()).to(x.dtype) + if self.control_adapter is not None and camera_conditions is not None: + x_camera = self.control_adapter(camera_conditions).to(x.dtype) + x = x + x_camera + grid_sizes = x.shape[2:] + x = x.flatten(2).transpose(1, 2) + + # time embeddings + e = self.time_embedding( + sinusoidal_embedding_1d(self.freq_dim, t).to(dtype=x[0].dtype)) + e0 = self.time_projection(e).unflatten(1, (6, self.dim)) + + # context + context = self.text_embedding(context) + + context_img_len = None + if clip_fea is not None: + if self.img_emb is not None: + context_clip = self.img_emb(clip_fea) # bs x 257 x dim + context = torch.concat([context_clip, context], dim=1) + context_img_len = clip_fea.shape[-2] + + patches_replace = transformer_options.get("patches_replace", {}) + blocks_replace = patches_replace.get("dit", {}) + for i, block in enumerate(self.blocks): + if ("double_block", i) in blocks_replace: + def block_wrap(args): + out = {} + out["img"] = block(args["img"], context=args["txt"], e=args["vec"], freqs=args["pe"], context_img_len=context_img_len) + return out + out = blocks_replace[("double_block", i)]({"img": x, "txt": context, "vec": e0, "pe": freqs}, {"original_block": block_wrap}) + x = out["img"] + else: + x = block(x, e=e0, freqs=freqs, context=context, context_img_len=context_img_len) + + # head + x = self.head(x, e) + + # unpatchify + x = self.unpatchify(x, grid_sizes) + return x diff --git a/comfy/model_base.py b/comfy/model_base.py index 047861593..f475e837e 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -1079,6 +1079,17 @@ class WAN21_Vace(WAN21): out['vace_strength'] = comfy.conds.CONDConstant(vace_strength) return out +class WAN21_Camera(WAN21): + def __init__(self, model_config, model_type=ModelType.FLOW, image_to_video=False, device=None): + super(WAN21, self).__init__(model_config, model_type, device=device, unet_model=comfy.ldm.wan.model.CameraWanModel) + self.image_to_video = image_to_video + + def extra_conds(self, **kwargs): + out = super().extra_conds(**kwargs) + camera_conditions = kwargs.get("camera_conditions", None) + if camera_conditions is not None: + out['camera_conditions'] = comfy.conds.CONDRegular(camera_conditions) + return out class Hunyuan3Dv2(BaseModel): def __init__(self, model_config, model_type=ModelType.FLOW, device=None): diff --git a/comfy/supported_models.py b/comfy/supported_models.py index fef25eb24..667393ac0 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -992,6 +992,16 @@ class WAN21_FunControl2V(WAN21_T2V): out = model_base.WAN21(self, image_to_video=False, device=device) return out +class WAN21_Camera(WAN21_T2V): + unet_config = { + "image_model": "wan2.1", + "model_type": "i2v", + "in_dim": 32, + } + + def get_model(self, state_dict, prefix="", device=None): + out = model_base.WAN21_Camera(self, image_to_video=False, device=device) + return out class WAN21_Vace(WAN21_T2V): unet_config = { "image_model": "wan2.1", @@ -1129,6 +1139,6 @@ class ACEStep(supported_models_base.BASE): def clip_target(self, state_dict={}): return supported_models_base.ClipTarget(comfy.text_encoders.ace.AceT5Tokenizer, comfy.text_encoders.ace.AceT5Model) -models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, WAN21_FunControl2V, WAN21_Vace, Hunyuan3Dv2mini, Hunyuan3Dv2, HiDream, Chroma, ACEStep] +models = [LotusD, Stable_Zero123, SD15_instructpix2pix, SD15, SD20, SD21UnclipL, SD21UnclipH, SDXL_instructpix2pix, SDXLRefiner, SDXL, SSD1B, KOALA_700M, KOALA_1B, Segmind_Vega, SD_X4Upscaler, Stable_Cascade_C, Stable_Cascade_B, SV3D_u, SV3D_p, SD3, StableAudio, AuraFlow, PixArtAlpha, PixArtSigma, HunyuanDiT, HunyuanDiT1, FluxInpaint, Flux, FluxSchnell, GenmoMochi, LTXV, HunyuanVideoSkyreelsI2V, HunyuanVideoI2V, HunyuanVideo, CosmosT2V, CosmosI2V, Lumina2, WAN21_T2V, WAN21_I2V, WAN21_FunControl2V, WAN21_Vace, WAN21_Camera, Hunyuan3Dv2mini, Hunyuan3Dv2, HiDream, Chroma, ACEStep] models += [SVD_img2vid] diff --git a/comfy_extras/nodes_camera_trajectory.py b/comfy_extras/nodes_camera_trajectory.py new file mode 100644 index 000000000..b84b4785c --- /dev/null +++ b/comfy_extras/nodes_camera_trajectory.py @@ -0,0 +1,218 @@ +import nodes +import torch +import numpy as np +from einops import rearrange +import comfy.model_management + + + +MAX_RESOLUTION = nodes.MAX_RESOLUTION + +CAMERA_DICT = { + "base_T_norm": 1.5, + "base_angle": np.pi/3, + "Static": { "angle":[0., 0., 0.], "T":[0., 0., 0.]}, + "Pan Up": { "angle":[0., 0., 0.], "T":[0., -1., 0.]}, + "Pan Down": { "angle":[0., 0., 0.], "T":[0.,1.,0.]}, + "Pan Left": { "angle":[0., 0., 0.], "T":[-1.,0.,0.]}, + "Pan Right": { "angle":[0., 0., 0.], "T": [1.,0.,0.]}, + "Zoom In": { "angle":[0., 0., 0.], "T": [0.,0.,2.]}, + "Zoom Out": { "angle":[0., 0., 0.], "T": [0.,0.,-2.]}, + "Anti Clockwise (ACW)": { "angle": [0., 0., -1.], "T":[0., 0., 0.]}, + "ClockWise (CW)": { "angle": [0., 0., 1.], "T":[0., 0., 0.]}, +} + + +def process_pose_params(cam_params, width=672, height=384, original_pose_width=1280, original_pose_height=720, device='cpu'): + + def get_relative_pose(cam_params): + """Copied from https://github.com/hehao13/CameraCtrl/blob/main/inference.py + """ + abs_w2cs = [cam_param.w2c_mat for cam_param in cam_params] + abs_c2ws = [cam_param.c2w_mat for cam_param in cam_params] + cam_to_origin = 0 + target_cam_c2w = np.array([ + [1, 0, 0, 0], + [0, 1, 0, -cam_to_origin], + [0, 0, 1, 0], + [0, 0, 0, 1] + ]) + abs2rel = target_cam_c2w @ abs_w2cs[0] + ret_poses = [target_cam_c2w, ] + [abs2rel @ abs_c2w for abs_c2w in abs_c2ws[1:]] + ret_poses = np.array(ret_poses, dtype=np.float32) + return ret_poses + + """Modified from https://github.com/hehao13/CameraCtrl/blob/main/inference.py + """ + cam_params = [Camera(cam_param) for cam_param in cam_params] + + sample_wh_ratio = width / height + pose_wh_ratio = original_pose_width / original_pose_height # Assuming placeholder ratios, change as needed + + if pose_wh_ratio > sample_wh_ratio: + resized_ori_w = height * pose_wh_ratio + for cam_param in cam_params: + cam_param.fx = resized_ori_w * cam_param.fx / width + else: + resized_ori_h = width / pose_wh_ratio + for cam_param in cam_params: + cam_param.fy = resized_ori_h * cam_param.fy / height + + intrinsic = np.asarray([[cam_param.fx * width, + cam_param.fy * height, + cam_param.cx * width, + cam_param.cy * height] + for cam_param in cam_params], dtype=np.float32) + + K = torch.as_tensor(intrinsic)[None] # [1, 1, 4] + c2ws = get_relative_pose(cam_params) # Assuming this function is defined elsewhere + c2ws = torch.as_tensor(c2ws)[None] # [1, n_frame, 4, 4] + plucker_embedding = ray_condition(K, c2ws, height, width, device=device)[0].permute(0, 3, 1, 2).contiguous() # V, 6, H, W + plucker_embedding = plucker_embedding[None] + plucker_embedding = rearrange(plucker_embedding, "b f c h w -> b f h w c")[0] + return plucker_embedding + +class Camera(object): + """Copied from https://github.com/hehao13/CameraCtrl/blob/main/inference.py + """ + def __init__(self, entry): + fx, fy, cx, cy = entry[1:5] + self.fx = fx + self.fy = fy + self.cx = cx + self.cy = cy + c2w_mat = np.array(entry[7:]).reshape(4, 4) + self.c2w_mat = c2w_mat + self.w2c_mat = np.linalg.inv(c2w_mat) + +def ray_condition(K, c2w, H, W, device): + """Copied from https://github.com/hehao13/CameraCtrl/blob/main/inference.py + """ + # c2w: B, V, 4, 4 + # K: B, V, 4 + + B = K.shape[0] + + j, i = torch.meshgrid( + torch.linspace(0, H - 1, H, device=device, dtype=c2w.dtype), + torch.linspace(0, W - 1, W, device=device, dtype=c2w.dtype), + indexing='ij' + ) + i = i.reshape([1, 1, H * W]).expand([B, 1, H * W]) + 0.5 # [B, HxW] + j = j.reshape([1, 1, H * W]).expand([B, 1, H * W]) + 0.5 # [B, HxW] + + fx, fy, cx, cy = K.chunk(4, dim=-1) # B,V, 1 + + zs = torch.ones_like(i) # [B, HxW] + xs = (i - cx) / fx * zs + ys = (j - cy) / fy * zs + zs = zs.expand_as(ys) + + directions = torch.stack((xs, ys, zs), dim=-1) # B, V, HW, 3 + directions = directions / directions.norm(dim=-1, keepdim=True) # B, V, HW, 3 + + rays_d = directions @ c2w[..., :3, :3].transpose(-1, -2) # B, V, 3, HW + rays_o = c2w[..., :3, 3] # B, V, 3 + rays_o = rays_o[:, :, None].expand_as(rays_d) # B, V, 3, HW + # c2w @ dirctions + rays_dxo = torch.cross(rays_o, rays_d) + plucker = torch.cat([rays_dxo, rays_d], dim=-1) + plucker = plucker.reshape(B, c2w.shape[1], H, W, 6) # B, V, H, W, 6 + # plucker = plucker.permute(0, 1, 4, 2, 3) + return plucker + +def get_camera_motion(angle, T, speed, n=81): + def compute_R_form_rad_angle(angles): + theta_x, theta_y, theta_z = angles + Rx = np.array([[1, 0, 0], + [0, np.cos(theta_x), -np.sin(theta_x)], + [0, np.sin(theta_x), np.cos(theta_x)]]) + + Ry = np.array([[np.cos(theta_y), 0, np.sin(theta_y)], + [0, 1, 0], + [-np.sin(theta_y), 0, np.cos(theta_y)]]) + + Rz = np.array([[np.cos(theta_z), -np.sin(theta_z), 0], + [np.sin(theta_z), np.cos(theta_z), 0], + [0, 0, 1]]) + + R = np.dot(Rz, np.dot(Ry, Rx)) + return R + RT = [] + for i in range(n): + _angle = (i/n)*speed*(CAMERA_DICT["base_angle"])*angle + R = compute_R_form_rad_angle(_angle) + _T=(i/n)*speed*(CAMERA_DICT["base_T_norm"])*(T.reshape(3,1)) + _RT = np.concatenate([R,_T], axis=1) + RT.append(_RT) + RT = np.stack(RT) + return RT + +class WanCameraEmbeding: + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "camera_pose":(["Static","Pan Up","Pan Down","Pan Left","Pan Right","Zoom In","Zoom Out","Anti Clockwise (ACW)", "ClockWise (CW)"],{"default":"Static"}), + "width": ("INT", {"default": 832, "min": 16, "max": MAX_RESOLUTION, "step": 16}), + "height": ("INT", {"default": 480, "min": 16, "max": MAX_RESOLUTION, "step": 16}), + "length": ("INT", {"default": 81, "min": 1, "max": MAX_RESOLUTION, "step": 4}), + }, + "optional":{ + "speed":("FLOAT",{"default":1.0, "min": 0, "max": 10.0, "step": 0.1}), + "fx":("FLOAT",{"default":0.5, "min": 0, "max": 1, "step": 0.000000001}), + "fy":("FLOAT",{"default":0.5, "min": 0, "max": 1, "step": 0.000000001}), + "cx":("FLOAT",{"default":0.5, "min": 0, "max": 1, "step": 0.01}), + "cy":("FLOAT",{"default":0.5, "min": 0, "max": 1, "step": 0.01}), + } + + } + + RETURN_TYPES = ("WAN_CAMERA_EMBEDDING","INT","INT","INT") + RETURN_NAMES = ("camera_embedding","width","height","length") + FUNCTION = "run" + CATEGORY = "camera" + + def run(self, camera_pose, width, height, length, speed=1.0, fx=0.5, fy=0.5, cx=0.5, cy=0.5): + """ + Use Camera trajectory as extrinsic parameters to calculate Plücker embeddings (Sitzmannet al., 2021) + Adapted from https://github.com/aigc-apps/VideoX-Fun/blob/main/comfyui/comfyui_nodes.py + """ + motion_list = [camera_pose] + speed = speed + angle = np.array(CAMERA_DICT[motion_list[0]]["angle"]) + T = np.array(CAMERA_DICT[motion_list[0]]["T"]) + RT = get_camera_motion(angle, T, speed, length) + + trajs=[] + for cp in RT.tolist(): + traj=[fx,fy,cx,cy,0,0] + traj.extend(cp[0]) + traj.extend(cp[1]) + traj.extend(cp[2]) + traj.extend([0,0,0,1]) + trajs.append(traj) + + cam_params = np.array([[float(x) for x in pose] for pose in trajs]) + cam_params = np.concatenate([np.zeros_like(cam_params[:, :1]), cam_params], 1) + control_camera_video = process_pose_params(cam_params, width=width, height=height) + control_camera_video = control_camera_video.permute([3, 0, 1, 2]).unsqueeze(0).to(device=comfy.model_management.intermediate_device()) + + control_camera_video = torch.concat( + [ + torch.repeat_interleave(control_camera_video[:, :, 0:1], repeats=4, dim=2), + control_camera_video[:, :, 1:] + ], dim=2 + ).transpose(1, 2) + + # Reshape, transpose, and view into desired shape + b, f, c, h, w = control_camera_video.shape + control_camera_video = control_camera_video.contiguous().view(b, f // 4, 4, c, h, w).transpose(2, 3) + control_camera_video = control_camera_video.contiguous().view(b, f // 4, c * 4, h, w).transpose(1, 2) + + return (control_camera_video, width, height, length) + + +NODE_CLASS_MAPPINGS = { + "WanCameraEmbeding": WanCameraEmbeding, +} diff --git a/comfy_extras/nodes_wan.py b/comfy_extras/nodes_wan.py index 9dda64597..a91b4aba9 100644 --- a/comfy_extras/nodes_wan.py +++ b/comfy_extras/nodes_wan.py @@ -297,6 +297,52 @@ class TrimVideoLatent: samples_out["samples"] = s1[:, :, trim_amount:] return (samples_out,) +class WanCameraImageToVideo: + @classmethod + def INPUT_TYPES(s): + return {"required": {"positive": ("CONDITIONING", ), + "negative": ("CONDITIONING", ), + "vae": ("VAE", ), + "width": ("INT", {"default": 832, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "height": ("INT", {"default": 480, "min": 16, "max": nodes.MAX_RESOLUTION, "step": 16}), + "length": ("INT", {"default": 81, "min": 1, "max": nodes.MAX_RESOLUTION, "step": 4}), + "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), + }, + "optional": {"clip_vision_output": ("CLIP_VISION_OUTPUT", ), + "start_image": ("IMAGE", ), + "camera_conditions": ("WAN_CAMERA_EMBEDDING", ), + }} + + RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT") + RETURN_NAMES = ("positive", "negative", "latent") + FUNCTION = "encode" + + CATEGORY = "conditioning/video_models" + + def encode(self, positive, negative, vae, width, height, length, batch_size, start_image=None, clip_vision_output=None, camera_conditions=None): + latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) + concat_latent = torch.zeros([batch_size, 16, ((length - 1) // 4) + 1, height // 8, width // 8], device=comfy.model_management.intermediate_device()) + concat_latent = comfy.latent_formats.Wan21().process_out(concat_latent) + + if start_image is not None: + start_image = comfy.utils.common_upscale(start_image[:length].movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1) + concat_latent_image = vae.encode(start_image[:, :, :, :3]) + concat_latent[:,:,:concat_latent_image.shape[2]] = concat_latent_image[:,:,:concat_latent.shape[2]] + + positive = node_helpers.conditioning_set_values(positive, {"concat_latent_image": concat_latent}) + negative = node_helpers.conditioning_set_values(negative, {"concat_latent_image": concat_latent}) + + if camera_conditions is not None: + positive = node_helpers.conditioning_set_values(positive, {'camera_conditions': camera_conditions}) + negative = node_helpers.conditioning_set_values(negative, {'camera_conditions': camera_conditions}) + + if clip_vision_output is not None: + positive = node_helpers.conditioning_set_values(positive, {"clip_vision_output": clip_vision_output}) + negative = node_helpers.conditioning_set_values(negative, {"clip_vision_output": clip_vision_output}) + + out_latent = {} + out_latent["samples"] = latent + return (positive, negative, out_latent) NODE_CLASS_MAPPINGS = { "WanImageToVideo": WanImageToVideo, @@ -305,4 +351,5 @@ NODE_CLASS_MAPPINGS = { "WanFirstLastFrameToVideo": WanFirstLastFrameToVideo, "WanVaceToVideo": WanVaceToVideo, "TrimVideoLatent": TrimVideoLatent, + "WanCameraImageToVideo": WanCameraImageToVideo, } diff --git a/nodes.py b/nodes.py index 54e3886a3..0a9db1393 100644 --- a/nodes.py +++ b/nodes.py @@ -2265,6 +2265,7 @@ def init_builtin_extra_nodes(): "nodes_preview_any.py", "nodes_ace.py", "nodes_string.py", + "nodes_camera_trajectory.py", ] import_failed = [] From 1c2d45d2b575c40efcb303a61318d4a415242e52 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Thu, 15 May 2025 16:02:19 -0700 Subject: [PATCH 446/478] Fix typo in last PR. (#8144) More robust model detection for future proofing. --- comfy/model_detection.py | 2 ++ comfy/supported_models.py | 2 +- comfy_extras/nodes_camera_trajectory.py | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/comfy/model_detection.py b/comfy/model_detection.py index 28c586389..20f287df9 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -361,6 +361,8 @@ def detect_unet_config(state_dict, key_prefix, metadata=None): dit_config["model_type"] = "vace" dit_config["vace_in_dim"] = state_dict['{}vace_patch_embedding.weight'.format(key_prefix)].shape[1] dit_config["vace_layers"] = count_blocks(state_dict_keys, '{}vace_blocks.'.format(key_prefix) + '{}.') + elif '{}control_adapter.conv.weight'.format(key_prefix) in state_dict_keys: + dit_config["model_type"] = "camera" else: if '{}img_emb.proj.0.bias'.format(key_prefix) in state_dict_keys: dit_config["model_type"] = "i2v" diff --git a/comfy/supported_models.py b/comfy/supported_models.py index 667393ac0..efe2e6b8f 100644 --- a/comfy/supported_models.py +++ b/comfy/supported_models.py @@ -995,7 +995,7 @@ class WAN21_FunControl2V(WAN21_T2V): class WAN21_Camera(WAN21_T2V): unet_config = { "image_model": "wan2.1", - "model_type": "i2v", + "model_type": "camera", "in_dim": 32, } diff --git a/comfy_extras/nodes_camera_trajectory.py b/comfy_extras/nodes_camera_trajectory.py index b84b4785c..5e0e39f91 100644 --- a/comfy_extras/nodes_camera_trajectory.py +++ b/comfy_extras/nodes_camera_trajectory.py @@ -148,7 +148,7 @@ def get_camera_motion(angle, T, speed, n=81): RT = np.stack(RT) return RT -class WanCameraEmbeding: +class WanCameraEmbedding: @classmethod def INPUT_TYPES(cls): return { @@ -214,5 +214,5 @@ class WanCameraEmbeding: NODE_CLASS_MAPPINGS = { - "WanCameraEmbeding": WanCameraEmbeding, + "WanCameraEmbedding": WanCameraEmbedding, } From 7046983d9538d49d1dd286a513aa6db42b9a74fd Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Sat, 17 May 2025 03:45:36 +1000 Subject: [PATCH 447/478] Remove Desktop versioning claim from README (#8155) --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index dcdaa353c..9b5f301c9 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,6 @@ ComfyUI follows a weekly release cycle every Friday, with three interconnected r 2. **[ComfyUI Desktop](https://github.com/Comfy-Org/desktop)** - Builds a new release using the latest stable core version - - Version numbers match the core release (e.g., Desktop v1.7.0 uses Core v1.7.0) 3. **[ComfyUI Frontend](https://github.com/Comfy-Org/ComfyUI_frontend)** - Weekly frontend updates are merged into the core repository From dc46db7aa48acd035dfc10730a064a9c994fb76b Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Fri, 16 May 2025 12:15:55 -0700 Subject: [PATCH 448/478] Make ImagePadForOutpaint return a 3 channel mask. (#8157) --- nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index 0a9db1393..95e831b8b 100644 --- a/nodes.py +++ b/nodes.py @@ -1940,7 +1940,7 @@ class ImagePadForOutpaint: mask[top:top + d2, left:left + d3] = t - return (new_image, mask) + return (new_image, mask.unsqueeze(0)) NODE_CLASS_MAPPINGS = { From aee2908d0395577a6e2e13d1307aaf271424108b Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sat, 17 May 2025 03:27:34 -0700 Subject: [PATCH 449/478] Remove useless log. (#8166) --- comfy/utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/comfy/utils.py b/comfy/utils.py index 561e1b858..1f8d71292 100644 --- a/comfy/utils.py +++ b/comfy/utils.py @@ -78,8 +78,6 @@ def load_torch_file(ckpt, safe_load=False, device=None, return_metadata=False): pl_sd = torch.load(ckpt, map_location=device, weights_only=True, **torch_args) else: pl_sd = torch.load(ckpt, map_location=device, pickle_module=comfy.checkpoint_pickle) - if "global_step" in pl_sd: - logging.debug(f"Global Step: {pl_sd['global_step']}") if "state_dict" in pl_sd: sd = pl_sd["state_dict"] else: From f5e4e976f43c9ed79e75b27f73719b2708f9ded9 Mon Sep 17 00:00:00 2001 From: Silver <65376327+silveroxides@users.noreply.github.com> Date: Sun, 18 May 2025 08:59:06 +0200 Subject: [PATCH 450/478] Add missing category for T5TokenizerOption (#8177) Change it if you need to but it should at least have a category. --- comfy_extras/nodes_cond.py | 1 + 1 file changed, 1 insertion(+) diff --git a/comfy_extras/nodes_cond.py b/comfy_extras/nodes_cond.py index 574262178..58c16f621 100644 --- a/comfy_extras/nodes_cond.py +++ b/comfy_extras/nodes_cond.py @@ -31,6 +31,7 @@ class T5TokenizerOptions: } } + CATEGORY = "_for_testing/conditioning" RETURN_TYPES = ("CLIP",) FUNCTION = "set_options" From 05eb10b43a42929033f449def7cd5a8feeb84673 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sun, 18 May 2025 01:08:47 -0700 Subject: [PATCH 451/478] Validate video inputs (#8133) * validate kling lip sync input video * add tooltips * update duration estimates * decrease epsilon * fix rebase error --- comfy_api_nodes/nodes_kling.py | 51 ++++++------ comfy_api_nodes/util/__init__.py | 0 comfy_api_nodes/util/validation_utils.py | 100 +++++++++++++++++++++++ 3 files changed, 126 insertions(+), 25 deletions(-) create mode 100644 comfy_api_nodes/util/__init__.py create mode 100644 comfy_api_nodes/util/validation_utils.py diff --git a/comfy_api_nodes/nodes_kling.py b/comfy_api_nodes/nodes_kling.py index 456a86905..641cd6353 100644 --- a/comfy_api_nodes/nodes_kling.py +++ b/comfy_api_nodes/nodes_kling.py @@ -65,6 +65,12 @@ from comfy_api_nodes.apinode_utils import ( download_url_to_image_tensor, ) from comfy_api_nodes.mapper_utils import model_field_to_node_input +from comfy_api_nodes.util.validation_utils import ( + validate_image_dimensions, + validate_image_aspect_ratio, + validate_video_dimensions, + validate_video_duration, +) from comfy_api.input.basic_types import AudioInput from comfy_api.input.video_types import VideoInput from comfy_api.input_impl import VideoFromFile @@ -80,18 +86,16 @@ PATH_CHARACTER_IMAGE = f"/proxy/kling/{KLING_API_VERSION}/images/generations" PATH_VIRTUAL_TRY_ON = f"/proxy/kling/{KLING_API_VERSION}/images/kolors-virtual-try-on" PATH_IMAGE_GENERATIONS = f"/proxy/kling/{KLING_API_VERSION}/images/generations" - MAX_PROMPT_LENGTH_T2V = 2500 MAX_PROMPT_LENGTH_I2V = 500 MAX_PROMPT_LENGTH_IMAGE_GEN = 500 MAX_NEGATIVE_PROMPT_LENGTH_IMAGE_GEN = 200 MAX_PROMPT_LENGTH_LIP_SYNC = 120 -# TODO: adjust based on tests -AVERAGE_DURATION_T2V = 319 # 319, -AVERAGE_DURATION_I2V = 164 # 164, -AVERAGE_DURATION_LIP_SYNC = 120 -AVERAGE_DURATION_VIRTUAL_TRY_ON = 19 # 19, +AVERAGE_DURATION_T2V = 319 +AVERAGE_DURATION_I2V = 164 +AVERAGE_DURATION_LIP_SYNC = 455 +AVERAGE_DURATION_VIRTUAL_TRY_ON = 19 AVERAGE_DURATION_IMAGE_GEN = 32 AVERAGE_DURATION_VIDEO_EFFECTS = 320 AVERAGE_DURATION_VIDEO_EXTEND = 320 @@ -211,23 +215,8 @@ def validate_input_image(image: torch.Tensor) -> None: See: https://app.klingai.com/global/dev/document-api/apiReference/model/imageToVideo """ - if len(image.shape) == 4: - height, width = image.shape[1], image.shape[2] - elif len(image.shape) == 3: - height, width = image.shape[0], image.shape[1] - else: - raise ValueError("Invalid image tensor shape.") - - # Ensure minimum resolution is met - if height < 300: - raise ValueError("Image height must be at least 300px") - if width < 300: - raise ValueError("Image width must be at least 300px") - - # Ensure aspect ratio is within acceptable range - aspect_ratio = width / height - if aspect_ratio < 1 / 2.5 or aspect_ratio > 2.5: - raise ValueError("Image aspect ratio must be between 1:2.5 and 2.5:1") + validate_image_dimensions(image, min_width=300, min_height=300) + validate_image_aspect_ratio(image, min_aspect_ratio=1 / 2.5, max_aspect_ratio=2.5) def get_camera_control_input_config( @@ -1243,6 +1232,17 @@ class KlingLipSyncBase(KlingNodeBase): RETURN_TYPES = ("VIDEO", "STRING", "STRING") RETURN_NAMES = ("VIDEO", "video_id", "duration") + def validate_lip_sync_video(self, video: VideoInput): + """ + Validates the input video adheres to the expectations of the Kling Lip Sync API: + - Video length does not exceed 10s and is not shorter than 2s + - Length and width dimensions should both be between 720px and 1920px + + See: https://app.klingai.com/global/dev/document-api/apiReference/model/videoTolip + """ + validate_video_dimensions(video, 720, 1920) + validate_video_duration(video, 2, 10) + def validate_text(self, text: str): if not text: raise ValueError("Text is required") @@ -1282,6 +1282,7 @@ class KlingLipSyncBase(KlingNodeBase): ) -> tuple[VideoFromFile, str, str]: if text: self.validate_text(text) + self.validate_lip_sync_video(video) # Upload video to Comfy API and get download URL video_url = upload_video_to_comfyapi(video, auth_kwargs=kwargs) @@ -1352,7 +1353,7 @@ class KlingLipSyncAudioToVideoNode(KlingLipSyncBase): }, } - DESCRIPTION = "Kling Lip Sync Audio to Video Node. Syncs mouth movements in a video file to the audio content of an audio file." + DESCRIPTION = "Kling Lip Sync Audio to Video Node. Syncs mouth movements in a video file to the audio content of an audio file. When using, ensure that the audio contains clearly distinguishable vocals and that the video contains a distinct face. The audio file should not be larger than 5MB. The video file should not be larger than 100MB, should have height/width between 720px and 1920px, and should be between 2s and 10s in length." def api_call( self, @@ -1464,7 +1465,7 @@ class KlingLipSyncTextToVideoNode(KlingLipSyncBase): }, } - DESCRIPTION = "Kling Lip Sync Text to Video Node. Syncs mouth movements in a video file to a text prompt." + DESCRIPTION = "Kling Lip Sync Text to Video Node. Syncs mouth movements in a video file to a text prompt. The video file should not be larger than 100MB, should have height/width between 720px and 1920px, and should be between 2s and 10s in length." def api_call( self, diff --git a/comfy_api_nodes/util/__init__.py b/comfy_api_nodes/util/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/comfy_api_nodes/util/validation_utils.py b/comfy_api_nodes/util/validation_utils.py new file mode 100644 index 000000000..031b9fbd3 --- /dev/null +++ b/comfy_api_nodes/util/validation_utils.py @@ -0,0 +1,100 @@ +import logging +from typing import Optional + +import torch +from comfy_api.input.video_types import VideoInput + + +def get_image_dimensions(image: torch.Tensor) -> tuple[int, int]: + if len(image.shape) == 4: + return image.shape[1], image.shape[2] + elif len(image.shape) == 3: + return image.shape[0], image.shape[1] + else: + raise ValueError("Invalid image tensor shape.") + + +def validate_image_dimensions( + image: torch.Tensor, + min_width: Optional[int] = None, + max_width: Optional[int] = None, + min_height: Optional[int] = None, + max_height: Optional[int] = None, +): + height, width = get_image_dimensions(image) + + if min_width is not None and width < min_width: + raise ValueError(f"Image width must be at least {min_width}px, got {width}px") + if max_width is not None and width > max_width: + raise ValueError(f"Image width must be at most {max_width}px, got {width}px") + if min_height is not None and height < min_height: + raise ValueError( + f"Image height must be at least {min_height}px, got {height}px" + ) + if max_height is not None and height > max_height: + raise ValueError(f"Image height must be at most {max_height}px, got {height}px") + + +def validate_image_aspect_ratio( + image: torch.Tensor, + min_aspect_ratio: Optional[float] = None, + max_aspect_ratio: Optional[float] = None, +): + width, height = get_image_dimensions(image) + aspect_ratio = width / height + + if min_aspect_ratio is not None and aspect_ratio < min_aspect_ratio: + raise ValueError( + f"Image aspect ratio must be at least {min_aspect_ratio}, got {aspect_ratio}" + ) + if max_aspect_ratio is not None and aspect_ratio > max_aspect_ratio: + raise ValueError( + f"Image aspect ratio must be at most {max_aspect_ratio}, got {aspect_ratio}" + ) + + +def validate_video_dimensions( + video: VideoInput, + min_width: Optional[int] = None, + max_width: Optional[int] = None, + min_height: Optional[int] = None, + max_height: Optional[int] = None, +): + try: + width, height = video.get_dimensions() + except Exception as e: + logging.error("Error getting dimensions of video: %s", e) + return + + if min_width is not None and width < min_width: + raise ValueError(f"Video width must be at least {min_width}px, got {width}px") + if max_width is not None and width > max_width: + raise ValueError(f"Video width must be at most {max_width}px, got {width}px") + if min_height is not None and height < min_height: + raise ValueError( + f"Video height must be at least {min_height}px, got {height}px" + ) + if max_height is not None and height > max_height: + raise ValueError(f"Video height must be at most {max_height}px, got {height}px") + + +def validate_video_duration( + video: VideoInput, + min_duration: Optional[float] = None, + max_duration: Optional[float] = None, +): + try: + duration = video.get_duration() + except Exception as e: + logging.error("Error getting duration of video: %s", e) + return + + epsilon = 0.0001 + if min_duration is not None and min_duration - epsilon > duration: + raise ValueError( + f"Video duration must be at least {min_duration}s, got {duration}s" + ) + if max_duration is not None and duration > max_duration + epsilon: + raise ValueError( + f"Video duration must be at most {max_duration}s, got {duration}s" + ) From 62690eddec9b7d715b4c37246f71abf5ca1c5844 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sun, 18 May 2025 01:09:56 -0700 Subject: [PATCH 452/478] Node to add pixel space noise to an image. (#8182) --- comfy_extras/nodes_images.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/comfy_extras/nodes_images.py b/comfy_extras/nodes_images.py index 77c305619..29a5d5b61 100644 --- a/comfy_extras/nodes_images.py +++ b/comfy_extras/nodes_images.py @@ -13,6 +13,7 @@ import os import re from io import BytesIO from inspect import cleandoc +import torch from comfy.comfy_types import FileLocator @@ -74,6 +75,24 @@ class ImageFromBatch: s = s_in[batch_index:batch_index + length].clone() return (s,) + +class ImageAddNoise: + @classmethod + def INPUT_TYPES(s): + return {"required": { "image": ("IMAGE",), + "seed": ("INT", {"default": 0, "min": 0, "max": 0xffffffffffffffff, "control_after_generate": True, "tooltip": "The random seed used for creating the noise."}), + "strength": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.01}), + }} + RETURN_TYPES = ("IMAGE",) + FUNCTION = "repeat" + + CATEGORY = "image" + + def repeat(self, image, seed, strength): + generator = torch.manual_seed(seed) + s = torch.clip((image + strength * torch.randn(image.size(), generator=generator, device="cpu").to(image)), min=0.0, max=1.0) + return (s,) + class SaveAnimatedWEBP: def __init__(self): self.output_dir = folder_paths.get_output_directory() @@ -295,6 +314,7 @@ NODE_CLASS_MAPPINGS = { "ImageCrop": ImageCrop, "RepeatImageBatch": RepeatImageBatch, "ImageFromBatch": ImageFromBatch, + "ImageAddNoise": ImageAddNoise, "SaveAnimatedWEBP": SaveAnimatedWEBP, "SaveAnimatedPNG": SaveAnimatedPNG, "SaveSVGNode": SaveSVGNode, From 3d44a09812c4f0880c30fcd1876125b7319300b4 Mon Sep 17 00:00:00 2001 From: LaVie024 <62406970+LaVie024@users.noreply.github.com> Date: Sun, 18 May 2025 08:11:11 +0000 Subject: [PATCH 453/478] Update nodes_string.py (#8173) --- comfy_extras/nodes_string.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/comfy_extras/nodes_string.py b/comfy_extras/nodes_string.py index a852326e5..9eaa71236 100644 --- a/comfy_extras/nodes_string.py +++ b/comfy_extras/nodes_string.py @@ -8,7 +8,8 @@ class StringConcatenate(): return { "required": { "string_a": (IO.STRING, {"multiline": True}), - "string_b": (IO.STRING, {"multiline": True}) + "string_b": (IO.STRING, {"multiline": True}), + "delimiter": (IO.STRING, {"multiline": False, "default": ", "}) } } @@ -16,8 +17,8 @@ class StringConcatenate(): FUNCTION = "execute" CATEGORY = "utils/string" - def execute(self, string_a, string_b, **kwargs): - return string_a + string_b, + def execute(self, string_a, string_b, delimiter, **kwargs): + return delimiter.join((string_a, string_b)), class StringSubstring(): @classmethod From d8e5662822168101afb5e08a8ba75b6eefff6e02 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sun, 18 May 2025 01:12:12 -0700 Subject: [PATCH 454/478] Remove default delimiter. (#8183) --- comfy_extras/nodes_string.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy_extras/nodes_string.py b/comfy_extras/nodes_string.py index 9eaa71236..b24222cee 100644 --- a/comfy_extras/nodes_string.py +++ b/comfy_extras/nodes_string.py @@ -9,7 +9,7 @@ class StringConcatenate(): "required": { "string_a": (IO.STRING, {"multiline": True}), "string_b": (IO.STRING, {"multiline": True}), - "delimiter": (IO.STRING, {"multiline": False, "default": ", "}) + "delimiter": (IO.STRING, {"multiline": False, "default": ""}) } } From e930a387d62cc819117502993b0b821b1e3f2687 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Mon, 19 May 2025 01:58:41 -0700 Subject: [PATCH 455/478] Update AMD instructions in README. (#8198) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9b5f301c9..15157f527 100644 --- a/README.md +++ b/README.md @@ -197,11 +197,11 @@ Put your VAE in: models/vae ### AMD GPUs (Linux only) AMD users can install rocm and pytorch with pip if you don't have it already installed, this is the command to install the stable version: -```pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.2.4``` +```pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.3``` This is the command to install the nightly with ROCm 6.3 which might have some performance improvements: -```pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.3``` +```pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.4``` ### Intel GPUs (Windows and Linux) From 4f3b50ba510e02fa3fdd8c755ef9ad319b36bd61 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Tue, 20 May 2025 06:40:55 +1000 Subject: [PATCH 456/478] Update README ROCm text to match link (#8199) - Follow-up on #8198 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 15157f527..47514d1b4 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ AMD users can install rocm and pytorch with pip if you don't have it already ins ```pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.3``` -This is the command to install the nightly with ROCm 6.3 which might have some performance improvements: +This is the command to install the nightly with ROCm 6.4 which might have some performance improvements: ```pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.4``` From 7e84bf53737879ace37a68dc93e0df7704a53514 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Tue, 20 May 2025 02:29:23 -0700 Subject: [PATCH 457/478] This doesn't seem to be needed on chroma. (#8209) --- comfy/ldm/chroma/layers.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/comfy/ldm/chroma/layers.py b/comfy/ldm/chroma/layers.py index 35da91ee2..18a4a9cfc 100644 --- a/comfy/ldm/chroma/layers.py +++ b/comfy/ldm/chroma/layers.py @@ -109,9 +109,6 @@ class DoubleStreamBlock(nn.Module): txt += txt_mod1.gate * self.txt_attn.proj(txt_attn) txt += txt_mod2.gate * self.txt_mlp((1 + txt_mod2.scale) * self.txt_norm2(txt) + txt_mod2.shift) - if txt.dtype == torch.float16: - txt = torch.nan_to_num(txt, nan=0.0, posinf=65504, neginf=-65504) - return img, txt @@ -163,8 +160,6 @@ class SingleStreamBlock(nn.Module): # compute activation in mlp stream, cat again and run second linear layer output = self.linear2(torch.cat((attn, self.mlp_act(mlp)), 2)) x += mod.gate * output - if x.dtype == torch.float16: - x = torch.nan_to_num(x, nan=0.0, posinf=65504, neginf=-65504) return x From 87f91307782ce0b401786d8edddd8f618b955141 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Tue, 20 May 2025 02:39:55 -0700 Subject: [PATCH 458/478] Revert "This doesn't seem to be needed on chroma. (#8209)" (#8210) This reverts commit 7e84bf53737879ace37a68dc93e0df7704a53514. --- comfy/ldm/chroma/layers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/comfy/ldm/chroma/layers.py b/comfy/ldm/chroma/layers.py index 18a4a9cfc..35da91ee2 100644 --- a/comfy/ldm/chroma/layers.py +++ b/comfy/ldm/chroma/layers.py @@ -109,6 +109,9 @@ class DoubleStreamBlock(nn.Module): txt += txt_mod1.gate * self.txt_attn.proj(txt_attn) txt += txt_mod2.gate * self.txt_mlp((1 + txt_mod2.scale) * self.txt_norm2(txt) + txt_mod2.shift) + if txt.dtype == torch.float16: + txt = torch.nan_to_num(txt, nan=0.0, posinf=65504, neginf=-65504) + return img, txt @@ -160,6 +163,8 @@ class SingleStreamBlock(nn.Module): # compute activation in mlp stream, cat again and run second linear layer output = self.linear2(torch.cat((attn, self.mlp_act(mlp)), 2)) x += mod.gate * output + if x.dtype == torch.float16: + x = torch.nan_to_num(x, nan=0.0, posinf=65504, neginf=-65504) return x From 10024a38ea8d7e8950b26500a540cd0323d0e611 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Wed, 21 May 2025 04:50:37 -0400 Subject: [PATCH 459/478] ComfyUI version v0.3.35 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index b740b378d..8db3bc803 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.34" +__version__ = "0.3.35" diff --git a/pyproject.toml b/pyproject.toml index 80061b39a..a33fc4370 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.34" +version = "0.3.35" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From 65da29aaa965afcb0811a9c8dac1cc0facb006d4 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Wed, 21 May 2025 01:56:56 -0700 Subject: [PATCH 460/478] Make torch.compile LoRA/key-compatible (#8213) * Make torch compile node use wrapper instead of object_patch for the entire diffusion_models object, allowing key assotiations on diffusion_models to not break (loras, getting attributes, etc.) * Moved torch compile code into comfy_api so it can be used by custom nodes with a degree of confidence * Refactor set_torch_compile_wrapper to support a list of keys instead of just diffusion_model, as well as additional torch.compile args * remove unused import * Moved torch compile kwargs to be stored in model_options instead of attachments; attachments are more intended for things to be 'persisted', AKA not deepcopied * Add some comments * Remove random line of code, not sure how it got there --- comfy_api/torch_helpers/__init__.py | 5 ++ comfy_api/torch_helpers/torch_compile.py | 69 ++++++++++++++++++++++++ comfy_extras/nodes_torch_compile.py | 5 +- 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 comfy_api/torch_helpers/__init__.py create mode 100644 comfy_api/torch_helpers/torch_compile.py diff --git a/comfy_api/torch_helpers/__init__.py b/comfy_api/torch_helpers/__init__.py new file mode 100644 index 000000000..be7ae7a61 --- /dev/null +++ b/comfy_api/torch_helpers/__init__.py @@ -0,0 +1,5 @@ +from .torch_compile import set_torch_compile_wrapper + +__all__ = [ + "set_torch_compile_wrapper", +] diff --git a/comfy_api/torch_helpers/torch_compile.py b/comfy_api/torch_helpers/torch_compile.py new file mode 100644 index 000000000..9223f58db --- /dev/null +++ b/comfy_api/torch_helpers/torch_compile.py @@ -0,0 +1,69 @@ +from __future__ import annotations +import torch + +import comfy.utils +from comfy.patcher_extension import WrappersMP +from typing import TYPE_CHECKING, Callable, Optional +if TYPE_CHECKING: + from comfy.model_patcher import ModelPatcher + from comfy.patcher_extension import WrapperExecutor + + +COMPILE_KEY = "torch.compile" +TORCH_COMPILE_KWARGS = "torch_compile_kwargs" + + +def apply_torch_compile_factory(compiled_module_dict: dict[str, Callable]) -> Callable: + ''' + Create a wrapper that will refer to the compiled_diffusion_model. + ''' + def apply_torch_compile_wrapper(executor: WrapperExecutor, *args, **kwargs): + try: + orig_modules = {} + for key, value in compiled_module_dict.items(): + orig_modules[key] = comfy.utils.get_attr(executor.class_obj, key) + comfy.utils.set_attr(executor.class_obj, key, value) + return executor(*args, **kwargs) + finally: + for key, value in orig_modules.items(): + comfy.utils.set_attr(executor.class_obj, key, value) + return apply_torch_compile_wrapper + + +def set_torch_compile_wrapper(model: ModelPatcher, backend: str, options: Optional[dict[str,str]]=None, + mode: Optional[str]=None, fullgraph=False, dynamic: Optional[bool]=None, + keys: list[str]=["diffusion_model"], *args, **kwargs): + ''' + Perform torch.compile that will be applied at sample time for either the whole model or specific params of the BaseModel instance. + + When keys is None, it will default to using ["diffusion_model"], compiling the whole diffusion_model. + When a list of keys is provided, it will perform torch.compile on only the selected modules. + ''' + # clear out any other torch.compile wrappers + model.remove_wrappers_with_key(WrappersMP.APPLY_MODEL, COMPILE_KEY) + # if no keys, default to 'diffusion_model' + if not keys: + keys = ["diffusion_model"] + # create kwargs dict that can be referenced later + compile_kwargs = { + "backend": backend, + "options": options, + "mode": mode, + "fullgraph": fullgraph, + "dynamic": dynamic, + } + # get a dict of compiled keys + compiled_modules = {} + for key in keys: + compiled_modules[key] = torch.compile( + model=model.get_model_object(key), + **compile_kwargs, + ) + # add torch.compile wrapper + wrapper_func = apply_torch_compile_factory( + compiled_module_dict=compiled_modules, + ) + # store wrapper to run on BaseModel's apply_model function + model.add_wrapper_with_key(WrappersMP.APPLY_MODEL, COMPILE_KEY, wrapper_func) + # keep compile kwargs for reference + model.model_options[TORCH_COMPILE_KWARGS] = compile_kwargs diff --git a/comfy_extras/nodes_torch_compile.py b/comfy_extras/nodes_torch_compile.py index 1fe6f42c7..605536678 100644 --- a/comfy_extras/nodes_torch_compile.py +++ b/comfy_extras/nodes_torch_compile.py @@ -1,4 +1,5 @@ -import torch +from comfy_api.torch_helpers import set_torch_compile_wrapper + class TorchCompileModel: @classmethod @@ -14,7 +15,7 @@ class TorchCompileModel: def patch(self, model, backend): m = model.clone() - m.add_object_patch("diffusion_model", torch.compile(model=m.get_model_object("diffusion_model"), backend=backend)) + set_torch_compile_wrapper(model=m, backend=backend) return (m, ) NODE_CLASS_MAPPINGS = { From 57893c843f44ea9e8a0be79292d19e5a5e16e9e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BC=96=E7=A8=8B=E7=95=8C=E7=9A=84=E5=B0=8F=E5=AD=A6?= =?UTF-8?q?=E7=94=9F?= <15620646321@163.com> Date: Wed, 21 May 2025 16:59:42 +0800 Subject: [PATCH 461/478] Code Optimization and Issues Fixes in ComfyUI server (#8196) * Update server.py * Update server.py --- server.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server.py b/server.py index cb1c6a8fd..16cd88d91 100644 --- a/server.py +++ b/server.py @@ -226,7 +226,7 @@ class PromptServer(): return response @routes.get("/embeddings") - def get_embeddings(self): + def get_embeddings(request): embeddings = folder_paths.get_filename_list("embeddings") return web.json_response(list(map(lambda a: os.path.splitext(a)[0], embeddings))) @@ -282,7 +282,6 @@ class PromptServer(): a.update(f.read()) b.update(image.file.read()) image.file.seek(0) - f.close() return a.hexdigest() == b.hexdigest() return False From 8bb858e4d39f7f6a6969c584aeeaa1d606a812d6 Mon Sep 17 00:00:00 2001 From: Michael Abrahams Date: Wed, 21 May 2025 05:14:17 -0400 Subject: [PATCH 462/478] Improve performance with large number of queued prompts (#8176) * get_current_queue_volatile * restore get_current_queue method * remove extra import --- execution.py | 9 ++++++++- main.py | 3 +-- server.py | 5 +++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/execution.py b/execution.py index e5d1c69d9..15ff7567c 100644 --- a/execution.py +++ b/execution.py @@ -909,7 +909,6 @@ class PromptQueue: self.currently_running = {} self.history = {} self.flags = {} - server.prompt_queue = self def put(self, item): with self.mutex: @@ -954,6 +953,7 @@ class PromptQueue: self.history[prompt[1]].update(history_result) self.server.queue_updated() + # Note: slow def get_current_queue(self): with self.mutex: out = [] @@ -961,6 +961,13 @@ class PromptQueue: out += [x] return (out, copy.deepcopy(self.queue)) + # read-safe as long as queue items are immutable + def get_current_queue_volatile(self): + with self.mutex: + running = [x for x in self.currently_running.values()] + queued = copy.copy(self.queue) + return (running, queued) + def get_tasks_remaining(self): with self.mutex: return len(self.queue) + len(self.currently_running) diff --git a/main.py b/main.py index 0fde6d221..fb1f8d20b 100644 --- a/main.py +++ b/main.py @@ -260,7 +260,6 @@ def start_comfyui(asyncio_loop=None): asyncio_loop = asyncio.new_event_loop() asyncio.set_event_loop(asyncio_loop) prompt_server = server.PromptServer(asyncio_loop) - q = execution.PromptQueue(prompt_server) hook_breaker_ac10a0.save_functions() nodes.init_extra_nodes(init_custom_nodes=not args.disable_all_custom_nodes, init_api_nodes=not args.disable_api_nodes) @@ -271,7 +270,7 @@ def start_comfyui(asyncio_loop=None): prompt_server.add_routes() hijack_progress(prompt_server) - threading.Thread(target=prompt_worker, daemon=True, args=(q, prompt_server,)).start() + threading.Thread(target=prompt_worker, daemon=True, args=(prompt_server.prompt_queue, prompt_server,)).start() if args.quick_test_for_ci: exit(0) diff --git a/server.py b/server.py index 16cd88d91..1b0a73601 100644 --- a/server.py +++ b/server.py @@ -29,6 +29,7 @@ import comfy.model_management import node_helpers from comfyui_version import __version__ from app.frontend_management import FrontendManager + from app.user_manager import UserManager from app.model_manager import ModelFileManager from app.custom_node_manager import CustomNodeManager @@ -159,7 +160,7 @@ class PromptServer(): self.custom_node_manager = CustomNodeManager() self.internal_routes = InternalRoutes(self) self.supports = ["custom_nodes_from_web"] - self.prompt_queue = None + self.prompt_queue = execution.PromptQueue(self) self.loop = loop self.messages = asyncio.Queue() self.client_session:Optional[aiohttp.ClientSession] = None @@ -620,7 +621,7 @@ class PromptServer(): @routes.get("/queue") async def get_queue(request): queue_info = {} - current_queue = self.prompt_queue.get_current_queue() + current_queue = self.prompt_queue.get_current_queue_volatile() queue_info['queue_running'] = current_queue[0] queue_info['queue_pending'] = current_queue[1] return web.json_response(queue_info) From ded60c33a0c0231c7109f30072c25e64e360e636 Mon Sep 17 00:00:00 2001 From: ComfyUI Wiki Date: Thu, 22 May 2025 02:40:08 +0800 Subject: [PATCH 463/478] Update templates to 0.1.18 (#8224) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8f7a78984..858e6343c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ comfyui-frontend-package==1.19.9 -comfyui-workflow-templates==0.1.14 +comfyui-workflow-templates==0.1.18 torch torchsde torchvision From fc39184ea9a442b6e9a346fa23d1b3cad3a6f493 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Thu, 22 May 2025 02:24:36 -0400 Subject: [PATCH 464/478] Update frontend to 1.20 (#8232) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 858e6343c..5a988ecd9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.19.9 +comfyui-frontend-package==1.20.4 comfyui-workflow-templates==0.1.18 torch torchsde From b838c367209a8530dc1c56c4150988a1d8af7ed6 Mon Sep 17 00:00:00 2001 From: Terry Jia Date: Thu, 22 May 2025 08:08:36 -0400 Subject: [PATCH 465/478] remove mtl from 3d model file list (#8192) --- comfy_extras/nodes_load_3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy_extras/nodes_load_3d.py b/comfy_extras/nodes_load_3d.py index d5b4d9111..40d03e18a 100644 --- a/comfy_extras/nodes_load_3d.py +++ b/comfy_extras/nodes_load_3d.py @@ -16,7 +16,7 @@ class Load3D(): os.makedirs(input_dir, exist_ok=True) - files = [normalize_path(os.path.join("3d", f)) for f in os.listdir(input_dir) if f.endswith(('.gltf', '.glb', '.obj', '.mtl', '.fbx', '.stl'))] + files = [normalize_path(os.path.join("3d", f)) for f in os.listdir(input_dir) if f.endswith(('.gltf', '.glb', '.obj', '.fbx', '.stl'))] return {"required": { "model_file": (sorted(files), {"file_upload": True}), From 4202e956a0172178f5d4ce1971da8c07c93420a9 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Thu, 22 May 2025 05:11:13 -0700 Subject: [PATCH 466/478] Add append feature to conditioning_set_values (#8239) Refactor unclipconditioning node. --- node_helpers.py | 10 ++++++++-- nodes.py | 11 +---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/node_helpers.py b/node_helpers.py index c3e1a14ca..4ff960ef8 100644 --- a/node_helpers.py +++ b/node_helpers.py @@ -5,12 +5,18 @@ from comfy.cli_args import args from PIL import ImageFile, UnidentifiedImageError -def conditioning_set_values(conditioning, values={}): +def conditioning_set_values(conditioning, values={}, append=False): c = [] for t in conditioning: n = [t[0], t[1].copy()] for k in values: - n[1][k] = values[k] + val = values[k] + if append: + old_val = n[1].get(k, None) + if old_val is not None: + val = old_val + val + + n[1][k] = val c.append(n) return c diff --git a/nodes.py b/nodes.py index 95e831b8b..1e328651b 100644 --- a/nodes.py +++ b/nodes.py @@ -1103,16 +1103,7 @@ class unCLIPConditioning: if strength == 0: return (conditioning, ) - c = [] - for t in conditioning: - o = t[1].copy() - x = {"clip_vision_output": clip_vision_output, "strength": strength, "noise_augmentation": noise_augmentation} - if "unclip_conditioning" in o: - o["unclip_conditioning"] = o["unclip_conditioning"][:] + [x] - else: - o["unclip_conditioning"] = [x] - n = [t[0], o] - c.append(n) + c = node_helpers.conditioning_set_values(conditioning, {"unclip_conditioning": [{"clip_vision_output": clip_vision_output, "strength": strength, "noise_augmentation": noise_augmentation}]}, append=True) return (c, ) class GLIGENLoader: From f85c08df0615a587e0974678b01199b88a1caae0 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Thu, 22 May 2025 16:22:26 -0700 Subject: [PATCH 467/478] Make VACE conditionings stackable. (#8240) --- comfy/ldm/wan/model.py | 10 +++++++--- comfy/model_base.py | 21 +++++++++++++-------- comfy_extras/nodes_wan.py | 5 +++-- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/comfy/ldm/wan/model.py b/comfy/ldm/wan/model.py index a996dedf4..1b51a4e4a 100644 --- a/comfy/ldm/wan/model.py +++ b/comfy/ldm/wan/model.py @@ -635,7 +635,7 @@ class VaceWanModel(WanModel): t, context, vace_context, - vace_strength=1.0, + vace_strength, clip_fea=None, freqs=None, transformer_options={}, @@ -661,8 +661,11 @@ class VaceWanModel(WanModel): context = torch.concat([context_clip, context], dim=1) context_img_len = clip_fea.shape[-2] + orig_shape = list(vace_context.shape) + vace_context = vace_context.movedim(0, 1).reshape([-1] + orig_shape[2:]) c = self.vace_patch_embedding(vace_context.float()).to(vace_context.dtype) c = c.flatten(2).transpose(1, 2) + c = list(c.split(orig_shape[0], dim=0)) # arguments x_orig = x @@ -682,8 +685,9 @@ class VaceWanModel(WanModel): ii = self.vace_layers_mapping.get(i, None) if ii is not None: - c_skip, c = self.vace_blocks[ii](c, x=x_orig, e=e0, freqs=freqs, context=context, context_img_len=context_img_len) - x += c_skip * vace_strength + for iii in range(len(c)): + c_skip, c[iii] = self.vace_blocks[ii](c[iii], x=x_orig, e=e0, freqs=freqs, context=context, context_img_len=context_img_len) + x += c_skip * vace_strength[iii] del c_skip # head x = self.head(x, e) diff --git a/comfy/model_base.py b/comfy/model_base.py index f475e837e..fb4724690 100644 --- a/comfy/model_base.py +++ b/comfy/model_base.py @@ -1062,20 +1062,25 @@ class WAN21_Vace(WAN21): vace_frames = kwargs.get("vace_frames", None) if vace_frames is None: noise_shape[1] = 32 - vace_frames = torch.zeros(noise_shape, device=noise.device, dtype=noise.dtype) - - for i in range(0, vace_frames.shape[1], 16): - vace_frames = vace_frames.clone() - vace_frames[:, i:i + 16] = self.process_latent_in(vace_frames[:, i:i + 16]) + vace_frames = [torch.zeros(noise_shape, device=noise.device, dtype=noise.dtype)] mask = kwargs.get("vace_mask", None) if mask is None: noise_shape[1] = 64 - mask = torch.ones(noise_shape, device=noise.device, dtype=noise.dtype) + mask = [torch.ones(noise_shape, device=noise.device, dtype=noise.dtype)] * len(vace_frames) - out['vace_context'] = comfy.conds.CONDRegular(torch.cat([vace_frames.to(noise), mask.to(noise)], dim=1)) + vace_frames_out = [] + for j in range(len(vace_frames)): + vf = vace_frames[j].clone() + for i in range(0, vf.shape[1], 16): + vf[:, i:i + 16] = self.process_latent_in(vf[:, i:i + 16]) + vf = torch.cat([vf, mask[j]], dim=1) + vace_frames_out.append(vf) - vace_strength = kwargs.get("vace_strength", 1.0) + vace_frames = torch.stack(vace_frames_out, dim=1) + out['vace_context'] = comfy.conds.CONDRegular(vace_frames) + + vace_strength = kwargs.get("vace_strength", [1.0] * len(vace_frames_out)) out['vace_strength'] = comfy.conds.CONDConstant(vace_strength) return out diff --git a/comfy_extras/nodes_wan.py b/comfy_extras/nodes_wan.py index a91b4aba9..c35c4871c 100644 --- a/comfy_extras/nodes_wan.py +++ b/comfy_extras/nodes_wan.py @@ -268,8 +268,9 @@ class WanVaceToVideo: trim_latent = reference_image.shape[2] mask = mask.unsqueeze(0) - positive = node_helpers.conditioning_set_values(positive, {"vace_frames": control_video_latent, "vace_mask": mask, "vace_strength": strength}) - negative = node_helpers.conditioning_set_values(negative, {"vace_frames": control_video_latent, "vace_mask": mask, "vace_strength": strength}) + + positive = node_helpers.conditioning_set_values(positive, {"vace_frames": [control_video_latent], "vace_mask": [mask], "vace_strength": [strength]}, append=True) + negative = node_helpers.conditioning_set_values(negative, {"vace_frames": [control_video_latent], "vace_mask": [mask], "vace_strength": [strength]}, append=True) latent = torch.zeros([batch_size, 16, latent_length, height // 8, width // 8], device=comfy.model_management.intermediate_device()) out_latent = {} From 30b2eb8a93ce931f7b8e15f9f7dbc7bf751b1c17 Mon Sep 17 00:00:00 2001 From: drhead <1313496+drhead@users.noreply.github.com> Date: Fri, 23 May 2025 16:15:06 -0400 Subject: [PATCH 468/478] create arange on-device (#8255) --- comfy/ldm/chroma/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/ldm/chroma/model.py b/comfy/ldm/chroma/model.py index 636748fc5..c75023a31 100644 --- a/comfy/ldm/chroma/model.py +++ b/comfy/ldm/chroma/model.py @@ -163,7 +163,7 @@ class Chroma(nn.Module): distil_guidance = timestep_embedding(guidance.detach().clone(), 16).to(img.device, img.dtype) # get all modulation index - modulation_index = timestep_embedding(torch.arange(mod_index_length), 32).to(img.device, img.dtype) + modulation_index = timestep_embedding(torch.arange(mod_index_length, device=img.device), 32).to(img.device, img.dtype) # we need to broadcast the modulation index here so each batch has all of the index modulation_index = modulation_index.unsqueeze(0).repeat(img.shape[0], 1, 1).to(img.device, img.dtype) # and we need to broadcast timestep and guidance along too From 0b50d4c0db025f4c1ede7d1094567bb22a8901bf Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Fri, 23 May 2025 14:43:50 -0700 Subject: [PATCH 469/478] Add argument to explicitly enable fp8 compute support. (#8257) This can be used to test if your current GPU/pytorch version supports fp8 matrix mult in combination with --fast or the fp8_e4m3fn_fast dtype. --- comfy/cli_args.py | 1 + comfy/model_management.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index de292d9b3..4fb675f99 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -88,6 +88,7 @@ parser.add_argument("--directml", type=int, nargs="?", metavar="DIRECTML_DEVICE" parser.add_argument("--oneapi-device-selector", type=str, default=None, metavar="SELECTOR_STRING", help="Sets the oneAPI device(s) this instance will use.") parser.add_argument("--disable-ipex-optimize", action="store_true", help="Disables ipex.optimize default when loading models with Intel's Extension for Pytorch.") +parser.add_argument("--supports-fp8-compute", action="store_true", help="ComfyUI will act like if the device supports fp8 compute.") class LatentPreviewMethod(enum.Enum): NoPreviews = "none" diff --git a/comfy/model_management.py b/comfy/model_management.py index 44aff3762..a49ed83e6 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -1257,6 +1257,9 @@ def should_use_bf16(device=None, model_params=0, prioritize_performance=True, ma return False def supports_fp8_compute(device=None): + if args.supports_fp8_compute: + return True + if not is_nvidia(): return False From 464aece92b86c93694390a1b385b3c505190d0cd Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 23 May 2025 21:53:49 -0700 Subject: [PATCH 470/478] update frontend package to v1.20.5 (#8260) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5a988ecd9..48631633d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.20.4 +comfyui-frontend-package==1.20.5 comfyui-workflow-templates==0.1.18 torch torchsde From 5a87757ef96f807cf1cf5b41c55a0a84c9551f20 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sat, 24 May 2025 03:43:12 -0700 Subject: [PATCH 471/478] Better error if sageattention is installed but a dependency is missing. (#8264) --- comfy/ldm/modules/attention.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/comfy/ldm/modules/attention.py b/comfy/ldm/modules/attention.py index 45f9e311e..2cb77d85d 100644 --- a/comfy/ldm/modules/attention.py +++ b/comfy/ldm/modules/attention.py @@ -20,8 +20,11 @@ if model_management.xformers_enabled(): if model_management.sage_attention_enabled(): try: from sageattention import sageattn - except ModuleNotFoundError: - logging.error(f"\n\nTo use the `--use-sage-attention` feature, the `sageattention` package must be installed first.\ncommand:\n\t{sys.executable} -m pip install sageattention") + except ModuleNotFoundError as e: + if e.name == "sageattention": + logging.error(f"\n\nTo use the `--use-sage-attention` feature, the `sageattention` package must be installed first.\ncommand:\n\t{sys.executable} -m pip install sageattention") + else: + raise e exit(-1) if model_management.flash_attention_enabled(): From ad3bd8aa4904de8c3798e148fcf02b00ac14277c Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 24 May 2025 17:30:37 -0400 Subject: [PATCH 472/478] ComfyUI version 0.3.36 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 8db3bc803..817b7d83b 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.35" +__version__ = "0.3.36" diff --git a/pyproject.toml b/pyproject.toml index a33fc4370..accf6f864 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.35" +version = "0.3.36" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" From a0651359d7a1ee968d5cf01c1b7302e41435e779 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Sun, 25 May 2025 02:28:11 -0700 Subject: [PATCH 473/478] Return proper error if diffusion model not detected properly. (#8272) --- comfy/model_detection.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/comfy/model_detection.py b/comfy/model_detection.py index 20f287df9..74f539598 100644 --- a/comfy/model_detection.py +++ b/comfy/model_detection.py @@ -620,6 +620,9 @@ def convert_config(unet_config): def unet_config_from_diffusers_unet(state_dict, dtype=None): + if "conv_in.weight" not in state_dict: + return None + match = {} transformer_depth = [] From e5799c4899f968d03a1a656c9c5df2926a0768b1 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Mon, 26 May 2025 01:29:25 -0700 Subject: [PATCH 474/478] Enable pytorch attention by default on AMD gfx1151 (#8282) --- comfy/model_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index a49ed83e6..1e6e8553f 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -301,7 +301,7 @@ try: logging.info("AMD arch: {}".format(arch)) if args.use_split_cross_attention == False and args.use_quad_cross_attention == False: if torch_version_numeric[0] >= 2 and torch_version_numeric[1] >= 7: # works on 2.6 but doesn't actually seem to improve much - if any((a in arch) for a in ["gfx1100", "gfx1101"]): # TODO: more arches + if any((a in arch) for a in ["gfx1100", "gfx1101", "gfx1151"]): # TODO: more arches ENABLE_PYTORCH_ATTENTION = True except: pass From 89a84e32d2a771743ba10d6a6a0634f7e321fef5 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Mon, 26 May 2025 13:39:27 -0700 Subject: [PATCH 475/478] Disable initial GPU load when novram is used. (#8294) --- comfy/model_management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 1e6e8553f..f5b37e68e 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -695,7 +695,7 @@ def unet_inital_load_device(parameters, dtype): return torch_dev cpu_dev = torch.device("cpu") - if DISABLE_SMART_MEMORY: + if DISABLE_SMART_MEMORY or vram_state == VRAMState.NO_VRAM: return cpu_dev model_size = dtype_size(dtype) * parameters From 3a10b9641ce05d7e80b7051fda4195978c8ba656 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Tue, 27 May 2025 16:47:06 +1000 Subject: [PATCH 476/478] [BugFix] Update frontend to 1.20.6 (#8296) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 48631633d..f56b3e096 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -comfyui-frontend-package==1.20.5 +comfyui-frontend-package==1.20.6 comfyui-workflow-templates==0.1.18 torch torchsde From f58f0f56969ccfe8d57a18976cd296719d795730 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Tue, 27 May 2025 00:00:58 -0700 Subject: [PATCH 477/478] More API nodes: Gemini/Open AI Chat, Tripo, Rodin, Runway Image (#8295) * Add Ideogram generate node. * Add staging api. * Add API_NODE and common error for missing auth token (#5) * Add Minimax Video Generation + Async Task queue polling example (#6) * [Minimax] Show video preview and embed workflow in ouput (#7) * Remove uv.lock * Remove polling operations. * Revert "Remove polling operations." This reverts commit 8415404ce8fbc0262b7de54fc700c5c8854a34fc. * Update stubs. * Added Ideogram and Minimax back in. * Added initial BFL Flux 1.1 [pro] Ultra node (#11) * Manually add BFL polling status response schema (#15) * Add function for uploading files. (#18) * Add Luma nodes (#16) Co-authored-by: Robin Huang * Refactor util functions (#20) * Add rest of Luma node functionality (#19) Co-authored-by: Robin Huang * Fix image_luma_ref not working (#28) Co-authored-by: Robin Huang * [Bug] Remove duplicated option T2V-01 in MinimaxTextToVideoNode (#31) * add veo2, bump av req (#32) * Add Recraft nodes (#29) * Add Kling Nodes (#12) * Add Camera Concepts (luma_concepts) to Luma Video nodes (#33) Co-authored-by: Robin Huang * Add Runway nodes (#17) * Convert Minimax node to use VIDEO output type (#34) * Standard `CATEGORY` system for api nodes (#35) * Set `Content-Type` header when uploading files (#36) * add better error propagation to veo2 (#37) * Add Realistic Image and Logo Raster styles for Recraft v3 (#38) * Fix runway image upload and progress polling (#39) * Fix image upload for Luma: only include `Content-Type` header field if it's set explicitly (#40) * Moved Luma nodes to nodes_luma.py (#47) * Moved Recraft nodes to nodes_recraft.py (#48) * Move and fix BFL nodes to node_bfl.py (#49) * Move and edit Minimax node to nodes_minimax.py (#50) * Add Recraft Text to Vector node, add Save SVG node to handle its output (#53) * Added pixverse_template support to Pixverse Text to Video node (#54) * Added Recraft Controls + Recraft Color RGB nodes (#57) * split remaining nodes out of nodes_api, make utility lib, refactor ideogram (#61) * Set request type explicitly (#66) * Add `control_after_generate` to all seed inputs (#69) * Fix bug: deleting `Content-Type` when property does not exist (#73) * Add Pixverse and updated Kling types (#75) * Added Recraft Style - Infinite Style Library node (#82) * add ideogram v3 (#83) * [Kling] Split Camera Control config to its own node (#81) * Add Pika i2v and t2v nodes (#52) * Remove Runway nodes (#88) * Fix: Prompt text can't be validated in Kling nodes when using primitive nodes (#90) * Update Pika Duration and Resolution options (#94) * Removed Infinite Style Library until later (#99) * fix multi image return (#101) close #96 * Serve SVG files directly (#107) * Add a bunch of nodes, 3 ready to use, the rest waiting for endpoint support (#108) * Revert "Serve SVG files directly" (#111) * Expose 4 remaining Recraft nodes (#112) * [Kling] Add `Duration` and `Video ID` outputs (#105) * Add Kling nodes: camera control, start-end frame, lip-sync, video extend (#115) * Fix error for Recraft ImageToImage error for nonexistent random_seed param (#118) * Add remaining Pika nodes (#119) * Make controls input work for Recraft Image to Image node (#120) * Fix: Nested `AnyUrl` in request model cannot be serialized (Kling, Runway) (#129) * Show errors and API output URLs to the user (change log levels) (#131) * Apply small fixes and most prompt validation (if needed to avoid API error) (#135) * Node name/category modifications (#140) * Add back Recraft Style - Infinite Style Library node (#141) * [Kling] Fix: Correct/verify supported subset of input combos in Kling nodes (#149) * Remove pixverse_template from PixVerse Transition Video node (#155) * Use 3.9 compat syntax (#164) * Handle Comfy API key based authorizaton (#167) Co-authored-by: Jedrzej Kosinski * [BFL] Print download URL of successful task result directly on nodes (#175) * Show output URL and progress text on Pika nodes (#168) * [Ideogram] Print download URL of successful task result directly on nodes (#176) * [Kling] Print download URL of successful task result directly on nodes (#181) * Merge upstream may 14 25 (#186) Co-authored-by: comfyanonymous Co-authored-by: AustinMroz Co-authored-by: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Co-authored-by: Benjamin Lu Co-authored-by: Andrew Kvochko Co-authored-by: Pam <42671363+pamparamm@users.noreply.github.com> Co-authored-by: chaObserv <154517000+chaObserv@users.noreply.github.com> Co-authored-by: Yoland Yan <4950057+yoland68@users.noreply.github.com> Co-authored-by: guill Co-authored-by: Chenlei Hu Co-authored-by: Terry Jia Co-authored-by: Silver <65376327+silveroxides@users.noreply.github.com> Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com> Co-authored-by: liesen Co-authored-by: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> Co-authored-by: Jedrzej Kosinski Co-authored-by: Robin Huang Co-authored-by: thot experiment <94414189+thot-experiment@users.noreply.github.com> Co-authored-by: blepping <157360029+blepping@users.noreply.github.com> * Update instructions on how to develop API Nodes. (#171) * Add Runway FLF and I2V nodes (#187) * Add OpenAI chat node (#188) * Update README. * Add Google Gemini API node (#191) * Add Runway Gen 4 Text to Image Node (#193) * [Runway, Gemini] Update node display names and attributes (#194) * Update path from "image-to-video" to "image_to_video" (#197) * [Runway] Split I2V nodes into separate gen3 and gen4 nodes (#198) * Update runway i2v ratio enum (#201) * Rodin3D: implement Rodin3D API Nodes (#190) Co-authored-by: WhiteGiven Co-authored-by: Robin Huang * Add Tripo Nodes. (#189) Co-authored-by: Robin Huang * Change casing of categories "3D" => "3d" (#208) * [tripo] fix negtive_prompt and mv2model (#212) * [tripo] set default param to None (#215) * Add description and tooltip to Tripo Refine model. (#218) * Update. * Fix rebase errors. * Fix rebase errors. * Update templates. * Bump frontend. * Add file type info for file inputs. --------- Co-authored-by: Christian Byrne Co-authored-by: Jedrzej Kosinski Co-authored-by: Chenlei Hu Co-authored-by: thot experiment <94414189+thot-experiment@users.noreply.github.com> Co-authored-by: comfyanonymous Co-authored-by: AustinMroz Co-authored-by: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Co-authored-by: Benjamin Lu Co-authored-by: Andrew Kvochko Co-authored-by: Pam <42671363+pamparamm@users.noreply.github.com> Co-authored-by: chaObserv <154517000+chaObserv@users.noreply.github.com> Co-authored-by: Yoland Yan <4950057+yoland68@users.noreply.github.com> Co-authored-by: guill Co-authored-by: Terry Jia Co-authored-by: Silver <65376327+silveroxides@users.noreply.github.com> Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com> Co-authored-by: liesen Co-authored-by: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> Co-authored-by: blepping <157360029+blepping@users.noreply.github.com> Co-authored-by: Changrz <51637999+WhiteGiven@users.noreply.github.com> Co-authored-by: WhiteGiven Co-authored-by: seed93 --- comfy_api_nodes/README.md | 26 +- comfy_api_nodes/apinode_utils.py | 125 +- comfy_api_nodes/apis/__init__.py | 5906 ++++++++++++++--------------- comfy_api_nodes/apis/client.py | 2 +- comfy_api_nodes/apis/rodin_api.py | 57 + comfy_api_nodes/apis/tripo_api.py | 275 ++ comfy_api_nodes/nodes_gemini.py | 446 +++ comfy_api_nodes/nodes_openai.py | 524 ++- comfy_api_nodes/nodes_rodin.py | 462 +++ comfy_api_nodes/nodes_runway.py | 635 ++++ comfy_api_nodes/nodes_tripo.py | 574 +++ nodes.py | 4 + requirements.txt | 2 +- 13 files changed, 5870 insertions(+), 3168 deletions(-) create mode 100644 comfy_api_nodes/apis/rodin_api.py create mode 100644 comfy_api_nodes/apis/tripo_api.py create mode 100644 comfy_api_nodes/nodes_gemini.py create mode 100644 comfy_api_nodes/nodes_rodin.py create mode 100644 comfy_api_nodes/nodes_runway.py create mode 100644 comfy_api_nodes/nodes_tripo.py diff --git a/comfy_api_nodes/README.md b/comfy_api_nodes/README.md index e2633a769..64a389cc1 100644 --- a/comfy_api_nodes/README.md +++ b/comfy_api_nodes/README.md @@ -18,6 +18,8 @@ Follow the instructions [here](https://github.com/Comfy-Org/ComfyUI_frontend) to python run main.py --comfy-api-base https://stagingapi.comfy.org ``` +To authenticate to staging, please login and then ask one of Comfy Org team to whitelist you for access to staging. + API stubs are generated through automatic codegen tools from OpenAPI definitions. Since the Comfy Org OpenAPI definition contains many things from the Comfy Registry as well, we use redocly/cli to filter out only the paths relevant for API nodes. ### Redocly Instructions @@ -28,7 +30,7 @@ When developing locally, use the `redocly-dev.yaml` file to generate pydantic mo Before your API node PR merges, make sure to add the `Released` tag to the `openapi.yaml` file and test in staging. ```bash -# Download the OpenAPI file from prod server. +# Download the OpenAPI file from staging server. curl -o openapi.yaml https://stagingapi.comfy.org/openapi # Filter out unneeded API definitions. @@ -39,3 +41,25 @@ redocly bundle openapi.yaml --output filtered-openapi.yaml --config comfy_api_no datamodel-codegen --use-subclass-enum --field-constraints --strict-types bytes --input filtered-openapi.yaml --output comfy_api_nodes/apis/__init__.py --output-model-type pydantic_v2.BaseModel ``` + + +# Merging to Master + +Before merging to comfyanonymous/ComfyUI master, follow these steps: + +1. Add the "Released" tag to the ComfyUI OpenAPI yaml file for each endpoint you are using in the nodes. +1. Make sure the ComfyUI API is deployed to prod with your changes. +1. Run the code generation again with `redocly.yaml` and the production OpenAPI yaml file. + +```bash +# Download the OpenAPI file from prod server. +curl -o openapi.yaml https://api.comfy.org/openapi + +# Filter out unneeded API definitions. +npm install -g @redocly/cli +redocly bundle openapi.yaml --output filtered-openapi.yaml --config comfy_api_nodes/redocly.yaml --remove-unused-components + +# Generate the pydantic datamodels for validation. +datamodel-codegen --use-subclass-enum --field-constraints --strict-types bytes --input filtered-openapi.yaml --output comfy_api_nodes/apis/__init__.py --output-model-type pydantic_v2.BaseModel + +``` diff --git a/comfy_api_nodes/apinode_utils.py b/comfy_api_nodes/apinode_utils.py index 87d8c3e1d..788e2803f 100644 --- a/comfy_api_nodes/apinode_utils.py +++ b/comfy_api_nodes/apinode_utils.py @@ -1,6 +1,7 @@ from __future__ import annotations import io import logging +import mimetypes from typing import Optional, Union from comfy.utils import common_upscale from comfy_api.input_impl import VideoFromFile @@ -214,6 +215,7 @@ def download_url_to_image_tensor(url: str, timeout: int = None) -> torch.Tensor: image_bytesio = download_url_to_bytesio(url, timeout) return bytesio_to_image_tensor(image_bytesio) + def process_image_response(response: requests.Response) -> torch.Tensor: """Uses content from a Response object and converts it to a torch.Tensor""" return bytesio_to_image_tensor(BytesIO(response.content)) @@ -318,11 +320,27 @@ def tensor_to_data_uri( return f"data:{mime_type};base64,{base64_string}" +def text_filepath_to_base64_string(filepath: str) -> str: + """Converts a text file to a base64 string.""" + with open(filepath, "rb") as f: + file_content = f.read() + return base64.b64encode(file_content).decode("utf-8") + + +def text_filepath_to_data_uri(filepath: str) -> str: + """Converts a text file to a data URI.""" + base64_string = text_filepath_to_base64_string(filepath) + mime_type, _ = mimetypes.guess_type(filepath) + if mime_type is None: + mime_type = "application/octet-stream" + return f"data:{mime_type};base64,{base64_string}" + + def upload_file_to_comfyapi( file_bytes_io: BytesIO, filename: str, upload_mime_type: str, - auth_kwargs: Optional[dict[str,str]] = None, + auth_kwargs: Optional[dict[str, str]] = None, ) -> str: """ Uploads a single file to ComfyUI API and returns its download URL. @@ -357,9 +375,33 @@ def upload_file_to_comfyapi( return response.download_url +def video_to_base64_string( + video: VideoInput, + container_format: VideoContainer = None, + codec: VideoCodec = None +) -> str: + """ + Converts a video input to a base64 string. + + Args: + video: The video input to convert + container_format: Optional container format to use (defaults to video.container if available) + codec: Optional codec to use (defaults to video.codec if available) + """ + video_bytes_io = io.BytesIO() + + # Use provided format/codec if specified, otherwise use video's own if available + format_to_use = container_format if container_format is not None else getattr(video, 'container', VideoContainer.MP4) + codec_to_use = codec if codec is not None else getattr(video, 'codec', VideoCodec.H264) + + video.save_to(video_bytes_io, format=format_to_use, codec=codec_to_use) + video_bytes_io.seek(0) + return base64.b64encode(video_bytes_io.getvalue()).decode("utf-8") + + def upload_video_to_comfyapi( video: VideoInput, - auth_kwargs: Optional[dict[str,str]] = None, + auth_kwargs: Optional[dict[str, str]] = None, container: VideoContainer = VideoContainer.MP4, codec: VideoCodec = VideoCodec.H264, max_duration: Optional[int] = None, @@ -461,7 +503,7 @@ def audio_ndarray_to_bytesio( def upload_audio_to_comfyapi( audio: AudioInput, - auth_kwargs: Optional[dict[str,str]] = None, + auth_kwargs: Optional[dict[str, str]] = None, container_format: str = "mp4", codec_name: str = "aac", mime_type: str = "audio/mp4", @@ -488,8 +530,25 @@ def upload_audio_to_comfyapi( return upload_file_to_comfyapi(audio_bytes_io, filename, mime_type, auth_kwargs) +def audio_to_base64_string( + audio: AudioInput, container_format: str = "mp4", codec_name: str = "aac" +) -> str: + """Converts an audio input to a base64 string.""" + sample_rate: int = audio["sample_rate"] + waveform: torch.Tensor = audio["waveform"] + audio_data_np = audio_tensor_to_contiguous_ndarray(waveform) + audio_bytes_io = audio_ndarray_to_bytesio( + audio_data_np, sample_rate, container_format, codec_name + ) + audio_bytes = audio_bytes_io.getvalue() + return base64.b64encode(audio_bytes).decode("utf-8") + + def upload_images_to_comfyapi( - image: torch.Tensor, max_images=8, auth_kwargs: Optional[dict[str,str]] = None, mime_type: Optional[str] = None + image: torch.Tensor, + max_images=8, + auth_kwargs: Optional[dict[str, str]] = None, + mime_type: Optional[str] = None, ) -> list[str]: """ Uploads images to ComfyUI API and returns download URLs. @@ -554,17 +613,24 @@ def upload_images_to_comfyapi( return download_urls -def resize_mask_to_image(mask: torch.Tensor, image: torch.Tensor, - upscale_method="nearest-exact", crop="disabled", - allow_gradient=True, add_channel_dim=False): +def resize_mask_to_image( + mask: torch.Tensor, + image: torch.Tensor, + upscale_method="nearest-exact", + crop="disabled", + allow_gradient=True, + add_channel_dim=False, +): """ Resize mask to be the same dimensions as an image, while maintaining proper format for API calls. """ _, H, W, _ = image.shape mask = mask.unsqueeze(-1) - mask = mask.movedim(-1,1) - mask = common_upscale(mask, width=W, height=H, upscale_method=upscale_method, crop=crop) - mask = mask.movedim(1,-1) + mask = mask.movedim(-1, 1) + mask = common_upscale( + mask, width=W, height=H, upscale_method=upscale_method, crop=crop + ) + mask = mask.movedim(1, -1) if not add_channel_dim: mask = mask.squeeze(-1) if not allow_gradient: @@ -572,12 +638,41 @@ def resize_mask_to_image(mask: torch.Tensor, image: torch.Tensor, return mask -def validate_string(string: str, strip_whitespace=True, field_name="prompt", min_length=None, max_length=None): +def validate_string( + string: str, + strip_whitespace=True, + field_name="prompt", + min_length=None, + max_length=None, +): + if string is None: + raise Exception(f"Field '{field_name}' cannot be empty.") if strip_whitespace: string = string.strip() if min_length and len(string) < min_length: - raise Exception(f"Field '{field_name}' cannot be shorter than {min_length} characters; was {len(string)} characters long.") + raise Exception( + f"Field '{field_name}' cannot be shorter than {min_length} characters; was {len(string)} characters long." + ) if max_length and len(string) > max_length: - raise Exception(f" Field '{field_name} cannot be longer than {max_length} characters; was {len(string)} characters long.") - if not string: - raise Exception(f"Field '{field_name}' cannot be empty.") + raise Exception( + f" Field '{field_name} cannot be longer than {max_length} characters; was {len(string)} characters long." + ) + + +def image_tensor_pair_to_batch( + image1: torch.Tensor, image2: torch.Tensor +) -> torch.Tensor: + """ + Converts a pair of image tensors to a batch tensor. + If the images are not the same size, the smaller image is resized to + match the larger image. + """ + if image1.shape[1:] != image2.shape[1:]: + image2 = common_upscale( + image2.movedim(-1, 1), + image1.shape[2], + image1.shape[1], + "bilinear", + "center", + ).movedim(1, -1) + return torch.cat((image1, image2), dim=0) diff --git a/comfy_api_nodes/apis/__init__.py b/comfy_api_nodes/apis/__init__.py index aa1c4ce0b..e38d38cc9 100644 --- a/comfy_api_nodes/apis/__init__.py +++ b/comfy_api_nodes/apis/__init__.py @@ -1,67 +1,197 @@ # generated by datamodel-codegen: # filename: filtered-openapi.yaml -# timestamp: 2025-05-04T04:12:39+00:00 +# timestamp: 2025-05-19T21:38:55+00:00 from __future__ import annotations -from datetime import datetime +from datetime import date, datetime from enum import Enum from typing import Any, Dict, List, Literal, Optional, Union from uuid import UUID -from pydantic import AnyUrl, BaseModel, Field, RootModel, StrictBytes +from pydantic import AnyUrl, BaseModel, ConfigDict, Field, RootModel, StrictBytes -class PersonalAccessToken(BaseModel): - id: Optional[UUID] = Field(None, description='Unique identifier for the GitCommit') - name: Optional[str] = Field( - None, - description='Required. The name of the token. Can be a simple description.', - ) - description: Optional[str] = Field( - None, - description="Optional. A more detailed description of the token's intended use.", +class APIKey(BaseModel): + created_at: Optional[datetime] = None + description: Optional[str] = None + id: Optional[str] = None + key_prefix: Optional[str] = None + name: Optional[str] = None + + +class APIKeyWithPlaintext(APIKey): + plaintext_key: Optional[str] = Field( + None, description='The full API key (only returned at creation)' ) + + +class AuditLog(BaseModel): createdAt: Optional[datetime] = Field( - None, description='[Output Only]The date and time the token was created.' + None, description='The date and time the event was created' ) - token: Optional[str] = Field( + event_id: Optional[str] = Field(None, description='the id of the event') + event_type: Optional[str] = Field(None, description='the type of the event') + params: Optional[Dict[str, Any]] = Field( + None, description='data related to the event' + ) + + +class OutputFormat(str, Enum): + jpeg = 'jpeg' + png = 'png' + + +class BFLFluxPro11GenerateRequest(BaseModel): + height: int = Field(..., description='Height of the generated image') + image_prompt: Optional[str] = Field(None, description='Optional image prompt') + output_format: Optional[OutputFormat] = Field( + None, description='Output image format' + ) + prompt: str = Field(..., description='The main text prompt for image generation') + prompt_upsampling: Optional[bool] = Field( + None, description='Whether to use prompt upsampling' + ) + safety_tolerance: Optional[int] = Field(None, description='Safety tolerance level') + seed: Optional[int] = Field(None, description='Random seed for reproducibility') + webhook_secret: Optional[str] = Field( + None, description='Optional webhook secret for async processing' + ) + webhook_url: Optional[str] = Field( + None, description='Optional webhook URL for async processing' + ) + width: int = Field(..., description='Width of the generated image') + + +class BFLFluxPro11GenerateResponse(BaseModel): + id: str = Field(..., description='Job ID for tracking') + polling_url: str = Field(..., description='URL to poll for results') + + +class BFLFluxProGenerateRequest(BaseModel): + guidance_scale: Optional[float] = Field( + None, description='The guidance scale for generation.', ge=1.0, le=20.0 + ) + height: int = Field( + ..., description='The height of the image to generate.', ge=64, le=2048 + ) + negative_prompt: Optional[str] = Field( + None, description='The negative prompt for image generation.' + ) + num_images: Optional[int] = Field( + None, description='The number of images to generate.', ge=1, le=4 + ) + num_inference_steps: Optional[int] = Field( + None, description='The number of inference steps.', ge=1, le=100 + ) + prompt: str = Field(..., description='The text prompt for image generation.') + seed: Optional[int] = Field(None, description='The seed value for reproducibility.') + width: int = Field( + ..., description='The width of the image to generate.', ge=64, le=2048 + ) + + +class BFLFluxProGenerateResponse(BaseModel): + id: str = Field(..., description='The unique identifier for the generation task.') + polling_url: str = Field(..., description='URL to poll for the generation result.') + + +class Status(str, Enum): + in_progress = 'in_progress' + completed = 'completed' + incomplete = 'incomplete' + + +class Type(str, Enum): + computer_call = 'computer_call' + + +class ComputerToolCall(BaseModel): + action: Dict[str, Any] + call_id: str = Field( + ..., + description='An identifier used when responding to the tool call with output.\n', + ) + id: str = Field(..., description='The unique ID of the computer call.') + status: Status = Field( + ..., + description='The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n', + ) + type: Type = Field( + ..., description='The type of the computer call. Always `computer_call`.' + ) + + +class Environment(str, Enum): + windows = 'windows' + mac = 'mac' + linux = 'linux' + ubuntu = 'ubuntu' + browser = 'browser' + + +class Type1(str, Enum): + computer_use_preview = 'computer_use_preview' + + +class ComputerUsePreviewTool(BaseModel): + display_height: int = Field(..., description='The height of the computer display.') + display_width: int = Field(..., description='The width of the computer display.') + environment: Environment = Field( + ..., description='The type of computer environment to control.' + ) + type: Literal['ComputerUsePreviewTool'] = Field( + ..., + description='The type of the computer use tool. Always `computer_use_preview`.', + ) + + +class CreateAPIKeyRequest(BaseModel): + description: Optional[str] = None + name: str + + +class Customer(BaseModel): + createdAt: Optional[datetime] = Field( + None, description='The date and time the user was created' + ) + email: Optional[str] = Field(None, description='The email address for this user') + id: str = Field(..., description='The firebase UID of the user') + is_admin: Optional[bool] = Field(None, description='Whether the user is an admin') + metronome_id: Optional[str] = Field(None, description='The Metronome customer ID') + name: Optional[str] = Field(None, description='The name for this user') + stripe_id: Optional[str] = Field(None, description='The Stripe customer ID') + updatedAt: Optional[datetime] = Field( + None, description='The date and time the user was last updated' + ) + + +class CustomerStorageResourceResponse(BaseModel): + download_url: Optional[str] = Field( None, - description='[Output Only]. The personal access token. Only returned during creation.', + description='The signed URL to use for downloading the file from the specified path', + ) + existing_file: Optional[bool] = Field( + None, description='Whether an existing file with the same hash was found' + ) + expires_at: Optional[datetime] = Field( + None, description='When the signed URL will expire' + ) + upload_url: Optional[str] = Field( + None, + description='The signed URL to use for uploading the file to the specified path', ) -class GitCommitSummary(BaseModel): - commit_hash: Optional[str] = Field(None, description='The hash of the commit') - commit_name: Optional[str] = Field(None, description='The name of the commit') - branch_name: Optional[str] = Field( - None, description='The branch where the commit was made' - ) - author: Optional[str] = Field(None, description='The author of the commit') - timestamp: Optional[datetime] = Field( - None, description='The timestamp when the commit was made' - ) - status_summary: Optional[Dict[str, str]] = Field( - None, description='A map of operating system to status pairs' - ) +class Role(str, Enum): + user = 'user' + assistant = 'assistant' + system = 'system' + developer = 'developer' -class User(BaseModel): - id: Optional[str] = Field(None, description='The unique id for this user.') - email: Optional[str] = Field(None, description='The email address for this user.') - name: Optional[str] = Field(None, description='The name for this user.') - isApproved: Optional[bool] = Field( - None, description='Indicates if the user is approved.' - ) - isAdmin: Optional[bool] = Field( - None, description='Indicates if the user has admin privileges.' - ) - - -class PublisherUser(BaseModel): - id: Optional[str] = Field(None, description='The unique id for this user.') - email: Optional[str] = Field(None, description='The email address for this user.') - name: Optional[str] = Field(None, description='The name for this user.') +class Type2(str, Enum): + message = 'message' class ErrorResponse(BaseModel): @@ -69,168 +199,247 @@ class ErrorResponse(BaseModel): message: str -class StorageFile(BaseModel): - id: Optional[UUID] = Field( - None, description='Unique identifier for the storage file' - ) - file_path: Optional[str] = Field(None, description='Path to the file in storage') - public_url: Optional[str] = Field(None, description='Public URL') +class Type3(str, Enum): + file_search = 'file_search' -class PublisherMember(BaseModel): - id: Optional[str] = Field( - None, description='The unique identifier for the publisher member.' - ) - user: Optional[PublisherUser] = Field( - None, description='The user associated with this publisher member.' - ) - role: Optional[str] = Field( - None, description='The role of the user in the publisher.' +class FileSearchTool(BaseModel): + type: Literal['FileSearchTool'] = Field(..., description='The type of tool') + vector_store_ids: List[str] = Field( + ..., description='IDs of vector stores to search in' ) -class ComfyNode(BaseModel): - comfy_node_name: Optional[str] = Field( - None, description='Unique identifier for the node' +class Result(BaseModel): + file_id: Optional[str] = Field(None, description='The unique ID of the file.\n') + filename: Optional[str] = Field(None, description='The name of the file.\n') + score: Optional[float] = Field( + None, description='The relevance score of the file - a value between 0 and 1.\n' ) - category: Optional[str] = Field( - None, - description='UI category where the node is listed, used for grouping nodes.', + text: Optional[str] = Field( + None, description='The text that was retrieved from the file.\n' ) + + +class Status1(str, Enum): + in_progress = 'in_progress' + searching = 'searching' + completed = 'completed' + incomplete = 'incomplete' + failed = 'failed' + + +class Type4(str, Enum): + file_search_call = 'file_search_call' + + +class FileSearchToolCall(BaseModel): + id: str = Field(..., description='The unique ID of the file search tool call.\n') + queries: List[str] = Field( + ..., description='The queries used to search for files.\n' + ) + results: Optional[List[Result]] = Field( + None, description='The results of the file search tool call.\n' + ) + status: Status1 = Field( + ..., + description='The status of the file search tool call. One of `in_progress`, \n`searching`, `incomplete` or `failed`,\n', + ) + type: Type4 = Field( + ..., + description='The type of the file search tool call. Always `file_search_call`.\n', + ) + + +class Type5(str, Enum): + function = 'function' + + +class FunctionTool(BaseModel): description: Optional[str] = Field( - None, description="Brief description of the node's functionality or purpose." + None, description='Description of what the function does' ) - input_types: Optional[str] = Field(None, description='Defines input parameters') - deprecated: Optional[bool] = Field( + name: str = Field(..., description='Name of the function') + parameters: Dict[str, Any] = Field( + ..., description='JSON Schema object describing the function parameters' + ) + type: Literal['FunctionTool'] = Field(..., description='The type of tool') + + +class Status2(str, Enum): + in_progress = 'in_progress' + completed = 'completed' + incomplete = 'incomplete' + + +class Type6(str, Enum): + function_call = 'function_call' + + +class FunctionToolCall(BaseModel): + arguments: str = Field( + ..., description='A JSON string of the arguments to pass to the function.\n' + ) + call_id: str = Field( + ..., + description='The unique ID of the function tool call generated by the model.\n', + ) + id: Optional[str] = Field( + None, description='The unique ID of the function tool call.\n' + ) + name: str = Field(..., description='The name of the function to run.\n') + status: Optional[Status2] = Field( None, - description='Indicates if the node is deprecated. Deprecated nodes are hidden in the UI.', + description='The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n', ) - experimental: Optional[bool] = Field( + type: Type6 = Field( + ..., description='The type of the function tool call. Always `function_call`.\n' + ) + + +class GeminiCitation(BaseModel): + authors: Optional[List[str]] = None + endIndex: Optional[int] = None + license: Optional[str] = None + publicationDate: Optional[date] = None + startIndex: Optional[int] = None + title: Optional[str] = None + uri: Optional[str] = None + + +class GeminiCitationMetadata(BaseModel): + citations: Optional[List[GeminiCitation]] = None + + +class Role1(str, Enum): + user = 'user' + model = 'model' + + +class GeminiFunctionDeclaration(BaseModel): + description: Optional[str] = None + name: str + parameters: Dict[str, Any] = Field( + ..., description='JSON schema for the function parameters' + ) + + +class GeminiGenerationConfig(BaseModel): + maxOutputTokens: Optional[int] = Field( None, - description='Indicates if the node is experimental, subject to changes or removal.', + description='Maximum number of tokens that can be generated in the response. A token is approximately 4 characters. 100 tokens correspond to roughly 60-80 words.\n', + examples=[2048], + ge=16, + le=8192, ) - output_is_list: Optional[List[bool]] = Field( - None, description='Boolean values indicating if each output is a list.' - ) - return_names: Optional[str] = Field( - None, description='Names of the outputs for clarity in workflows.' - ) - return_types: Optional[str] = Field( - None, description='Specifies the types of outputs produced by the node.' - ) - function: Optional[str] = Field( - None, description='Name of the entry-point function to execute the node.' - ) - - -class ComfyNodeCloudBuildInfo(BaseModel): - project_id: Optional[str] = None - project_number: Optional[str] = None - location: Optional[str] = None - build_id: Optional[str] = None - - -class Error(BaseModel): - message: Optional[str] = Field( - None, description='A clear and concise description of the error.' - ) - details: Optional[List[str]] = Field( + seed: Optional[int] = Field( None, - description='Optional detailed information about the error or hints for resolving it.', + description="When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. Deterministic output isn't guaranteed. Also, changing the model or parameter settings, such as the temperature, can cause variations in the response even when you use the same seed value. By default, a random seed value is used. Available for the following models:, gemini-2.5-flash-preview-04-1, gemini-2.5-pro-preview-05-0, gemini-2.0-flash-lite-00, gemini-2.0-flash-001\n", + examples=[343940597], + ) + stopSequences: Optional[List[str]] = None + temperature: Optional[float] = Field( + 1, + description="The temperature is used for sampling during response generation, which occurs when topP and topK are applied. Temperature controls the degree of randomness in token selection. Lower temperatures are good for prompts that require a less open-ended or creative response, while higher temperatures can lead to more diverse or creative results. A temperature of 0 means that the highest probability tokens are always selected. In this case, responses for a given prompt are mostly deterministic, but a small amount of variation is still possible. If the model returns a response that's too generic, too short, or the model gives a fallback response, try increasing the temperature\n", + ge=0.0, + le=2.0, + ) + topK: Optional[int] = Field( + 40, + description="Top-K changes how the model selects tokens for output. A top-K of 1 means the next selected token is the most probable among all tokens in the model's vocabulary. A top-K of 3 means that the next token is selected from among the 3 most probable tokens by using temperature.\n", + examples=[40], + ge=1, + ) + topP: Optional[float] = Field( + 0.95, + description='If specified, nucleus sampling is used.\nTop-P changes how the model selects tokens for output. Tokens are selected from the most (see top-K) to least probable until the sum of their probabilities equals the top-P value. For example, if tokens A, B, and C have a probability of 0.3, 0.2, and 0.1 and the top-P value is 0.5, then the model will select either A or B as the next token by using temperature and excludes C as a candidate.\nSpecify a lower value for less random responses and a higher value for more random responses.\n', + ge=0.0, + le=1.0, ) -class NodeVersionUpdateRequest(BaseModel): - changelog: Optional[str] = Field( - None, description='The changelog describing the version changes.' +class GeminiMimeType(str, Enum): + application_pdf = 'application/pdf' + audio_mpeg = 'audio/mpeg' + audio_mp3 = 'audio/mp3' + audio_wav = 'audio/wav' + image_png = 'image/png' + image_jpeg = 'image/jpeg' + image_webp = 'image/webp' + text_plain = 'text/plain' + video_mov = 'video/mov' + video_mpeg = 'video/mpeg' + video_mp4 = 'video/mp4' + video_mpg = 'video/mpg' + video_avi = 'video/avi' + video_wmv = 'video/wmv' + video_mpegps = 'video/mpegps' + video_flv = 'video/flv' + + +class GeminiOffset(BaseModel): + nanos: Optional[int] = Field( + None, + description='Signed fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values.\n', + examples=[0], + ge=0, + le=999999999, ) - deprecated: Optional[bool] = Field( - None, description='Whether the version is deprecated.' + seconds: Optional[int] = Field( + None, + description='Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive.\n', + examples=[60], + ge=-315576000000, + le=315576000000, ) -class NodeStatus(str, Enum): - NodeStatusActive = 'NodeStatusActive' - NodeStatusDeleted = 'NodeStatusDeleted' - NodeStatusBanned = 'NodeStatusBanned' +class GeminiSafetyCategory(str, Enum): + HARM_CATEGORY_SEXUALLY_EXPLICIT = 'HARM_CATEGORY_SEXUALLY_EXPLICIT' + HARM_CATEGORY_HATE_SPEECH = 'HARM_CATEGORY_HATE_SPEECH' + HARM_CATEGORY_HARASSMENT = 'HARM_CATEGORY_HARASSMENT' + HARM_CATEGORY_DANGEROUS_CONTENT = 'HARM_CATEGORY_DANGEROUS_CONTENT' -class NodeVersionStatus(str, Enum): - NodeVersionStatusActive = 'NodeVersionStatusActive' - NodeVersionStatusDeleted = 'NodeVersionStatusDeleted' - NodeVersionStatusBanned = 'NodeVersionStatusBanned' - NodeVersionStatusPending = 'NodeVersionStatusPending' - NodeVersionStatusFlagged = 'NodeVersionStatusFlagged' +class Probability(str, Enum): + NEGLIGIBLE = 'NEGLIGIBLE' + LOW = 'LOW' + MEDIUM = 'MEDIUM' + HIGH = 'HIGH' + UNKNOWN = 'UNKNOWN' -class PublisherStatus(str, Enum): - PublisherStatusActive = 'PublisherStatusActive' - PublisherStatusBanned = 'PublisherStatusBanned' - - -class WorkflowRunStatus(str, Enum): - WorkflowRunStatusStarted = 'WorkflowRunStatusStarted' - WorkflowRunStatusFailed = 'WorkflowRunStatusFailed' - WorkflowRunStatusCompleted = 'WorkflowRunStatusCompleted' - - -class MachineStats(BaseModel): - machine_name: Optional[str] = Field(None, description='Name of the machine.') - os_version: Optional[str] = Field( - None, description='The operating system version. eg. Ubuntu Linux 20.04' - ) - gpu_type: Optional[str] = Field( - None, description='The GPU type. eg. NVIDIA Tesla K80' - ) - cpu_capacity: Optional[str] = Field(None, description='Total CPU on the machine.') - initial_cpu: Optional[str] = Field( - None, description='Initial CPU available before the job starts.' - ) - memory_capacity: Optional[str] = Field( - None, description='Total memory on the machine.' - ) - initial_ram: Optional[str] = Field( - None, description='Initial RAM available before the job starts.' - ) - vram_time_series: Optional[Dict[str, Any]] = Field( - None, description='Time series of VRAM usage.' - ) - disk_capacity: Optional[str] = Field( - None, description='Total disk capacity on the machine.' - ) - initial_disk: Optional[str] = Field( - None, description='Initial disk available before the job starts.' - ) - pip_freeze: Optional[str] = Field(None, description='The pip freeze output') - - -class Customer(BaseModel): - id: str = Field(..., description='The firebase UID of the user') - email: Optional[str] = Field(None, description='The email address for this user') - name: Optional[str] = Field(None, description='The name for this user') - createdAt: Optional[datetime] = Field( - None, description='The date and time the user was created' - ) - updatedAt: Optional[datetime] = Field( - None, description='The date and time the user was last updated' +class GeminiSafetyRating(BaseModel): + category: Optional[GeminiSafetyCategory] = None + probability: Optional[Probability] = Field( + None, + description='The probability that the content violates the specified safety category', ) -class MagicPrompt(str, Enum): - ON = 'ON' +class GeminiSafetyThreshold(str, Enum): OFF = 'OFF' + BLOCK_NONE = 'BLOCK_NONE' + BLOCK_LOW_AND_ABOVE = 'BLOCK_LOW_AND_ABOVE' + BLOCK_MEDIUM_AND_ABOVE = 'BLOCK_MEDIUM_AND_ABOVE' + BLOCK_ONLY_HIGH = 'BLOCK_ONLY_HIGH' -class ColorPalette(BaseModel): - name: str = Field(..., description='Name of the color palette', examples=['PASTEL']) +class GeminiTextPart(BaseModel): + text: Optional[str] = Field( + None, + description='A text prompt or code snippet.', + examples=['Answer as concisely as possible'], + ) -class StyleCode(RootModel[str]): - root: str = Field(..., pattern='^[0-9A-Fa-f]{8}$') +class GeminiTool(BaseModel): + functionDeclarations: Optional[List[GeminiFunctionDeclaration]] = None -class StyleType(str, Enum): - GENERAL = 'GENERAL' +class GeminiVideoMetadata(BaseModel): + endOffset: Optional[GeminiOffset] = None + startOffset: Optional[GeminiOffset] = None class IdeogramColorPalette1(BaseModel): @@ -262,17 +471,34 @@ class IdeogramColorPalette( class ImageRequest(BaseModel): - prompt: str = Field( - ..., description='Required. The prompt to use to generate the image.' - ) aspect_ratio: Optional[str] = Field( None, description="Optional. The aspect ratio (e.g., 'ASPECT_16_9', 'ASPECT_1_1'). Cannot be used with resolution. Defaults to 'ASPECT_1_1' if unspecified.", ) - model: str = Field(..., description="The model used (e.g., 'V_2', 'V_2A_TURBO')") + color_palette: Optional[Dict[str, Any]] = Field( + None, description='Optional. Color palette object. Only for V_2, V_2_TURBO.' + ) magic_prompt_option: Optional[str] = Field( None, description="Optional. MagicPrompt usage ('AUTO', 'ON', 'OFF')." ) + model: str = Field(..., description="The model used (e.g., 'V_2', 'V_2A_TURBO')") + negative_prompt: Optional[str] = Field( + None, + description='Optional. Description of what to exclude. Only for V_1, V_1_TURBO, V_2, V_2_TURBO.', + ) + num_images: Optional[int] = Field( + 1, + description='Optional. Number of images to generate (1-8). Defaults to 1.', + ge=1, + le=8, + ) + prompt: str = Field( + ..., description='Required. The prompt to use to generate the image.' + ) + resolution: Optional[str] = Field( + None, + description="Optional. Resolution (e.g., 'RESOLUTION_1024_1024'). Only for model V_2. Cannot be used with aspect_ratio.", + ) seed: Optional[int] = Field( None, description='Optional. A number between 0 and 2147483647.', @@ -283,23 +509,6 @@ class ImageRequest(BaseModel): None, description="Optional. Style type ('AUTO', 'GENERAL', 'REALISTIC', 'DESIGN', 'RENDER_3D', 'ANIME'). Only for models V_2 and above.", ) - negative_prompt: Optional[str] = Field( - None, - description='Optional. Description of what to exclude. Only for V_1, V_1_TURBO, V_2, V_2_TURBO.', - ) - num_images: Optional[int] = Field( - 1, - description='Optional. Number of images to generate (1-8). Defaults to 1.', - ge=1, - le=8, - ) - resolution: Optional[str] = Field( - None, - description="Optional. Resolution (e.g., 'RESOLUTION_1024_1024'). Only for model V_2. Cannot be used with aspect_ratio.", - ) - color_palette: Optional[Dict[str, Any]] = Field( - None, description='Optional. Color palette object. Only for V_2, V_2_TURBO.' - ) class IdeogramGenerateRequest(BaseModel): @@ -309,23 +518,23 @@ class IdeogramGenerateRequest(BaseModel): class Datum(BaseModel): + is_image_safe: Optional[bool] = Field( + None, description='Indicates whether the image is considered safe.' + ) prompt: Optional[str] = Field( None, description='The prompt used to generate this image.' ) resolution: Optional[str] = Field( None, description="The resolution of the generated image (e.g., '1024x1024')." ) - is_image_safe: Optional[bool] = Field( - None, description='Indicates whether the image is considered safe.' - ) seed: Optional[int] = Field( None, description='The seed value used for this generation.' ) - url: Optional[str] = Field(None, description='URL to the generated image.') style_type: Optional[str] = Field( None, description="The style type used for generation (e.g., 'REALISTIC', 'ANIME').", ) + url: Optional[str] = Field(None, description='URL to the generated image.') class IdeogramGenerateResponse(BaseModel): @@ -337,49 +546,17 @@ class IdeogramGenerateResponse(BaseModel): ) -class RenderingSpeed1(str, Enum): - TURBO = 'TURBO' - DEFAULT = 'DEFAULT' - QUALITY = 'QUALITY' - - -class MagicPrompt1(str, Enum): - AUTO = 'AUTO' - ON = 'ON' - OFF = 'OFF' - - -class StyleType1(str, Enum): - AUTO = 'AUTO' - GENERAL = 'GENERAL' - REALISTIC = 'REALISTIC' - DESIGN = 'DESIGN' - - -class IdeogramV3RemixRequest(BaseModel): - image: Optional[StrictBytes] = None - prompt: str - image_weight: Optional[int] = Field(50, ge=1, le=100) - seed: Optional[int] = Field(None, ge=0, le=2147483647) - resolution: Optional[str] = None - aspect_ratio: Optional[str] = None - rendering_speed: Optional[RenderingSpeed1] = None - magic_prompt: Optional[MagicPrompt1] = None - negative_prompt: Optional[str] = None - num_images: Optional[int] = Field(None, ge=1, le=8) - color_palette: Optional[Dict[str, Any]] = None - style_codes: Optional[List[str]] = None - style_type: Optional[StyleType1] = None - style_reference_images: Optional[List[StrictBytes]] = None +class StyleCode(RootModel[str]): + root: str = Field(..., pattern='^[0-9A-Fa-f]{8}$') class Datum1(BaseModel): + is_image_safe: Optional[bool] = None prompt: Optional[str] = None resolution: Optional[str] = None - is_image_safe: Optional[bool] = None seed: Optional[int] = None - url: Optional[str] = None style_type: Optional[str] = None + url: Optional[str] = None class IdeogramV3IdeogramResponse(BaseModel): @@ -387,74 +564,201 @@ class IdeogramV3IdeogramResponse(BaseModel): data: Optional[List[Datum1]] = None +class RenderingSpeed1(str, Enum): + TURBO = 'TURBO' + DEFAULT = 'DEFAULT' + QUALITY = 'QUALITY' + + class IdeogramV3ReframeRequest(BaseModel): - image: Optional[StrictBytes] = None - resolution: str - num_images: Optional[int] = Field(None, ge=1, le=8) - seed: Optional[int] = Field(None, ge=0, le=2147483647) - rendering_speed: Optional[RenderingSpeed1] = None color_palette: Optional[Dict[str, Any]] = None + image: Optional[StrictBytes] = None + num_images: Optional[int] = Field(None, ge=1, le=8) + rendering_speed: Optional[RenderingSpeed1] = None + resolution: str + seed: Optional[int] = Field(None, ge=0, le=2147483647) style_codes: Optional[List[str]] = None style_reference_images: Optional[List[StrictBytes]] = None +class MagicPrompt(str, Enum): + AUTO = 'AUTO' + ON = 'ON' + OFF = 'OFF' + + +class StyleType(str, Enum): + AUTO = 'AUTO' + GENERAL = 'GENERAL' + REALISTIC = 'REALISTIC' + DESIGN = 'DESIGN' + + +class IdeogramV3RemixRequest(BaseModel): + aspect_ratio: Optional[str] = None + color_palette: Optional[Dict[str, Any]] = None + image: Optional[StrictBytes] = None + image_weight: Optional[int] = Field(50, ge=1, le=100) + magic_prompt: Optional[MagicPrompt] = None + negative_prompt: Optional[str] = None + num_images: Optional[int] = Field(None, ge=1, le=8) + prompt: str + rendering_speed: Optional[RenderingSpeed1] = None + resolution: Optional[str] = None + seed: Optional[int] = Field(None, ge=0, le=2147483647) + style_codes: Optional[List[str]] = None + style_reference_images: Optional[List[StrictBytes]] = None + style_type: Optional[StyleType] = None + + class IdeogramV3ReplaceBackgroundRequest(BaseModel): - image: Optional[StrictBytes] = None - prompt: str - magic_prompt: Optional[MagicPrompt1] = None - num_images: Optional[int] = Field(None, ge=1, le=8) - seed: Optional[int] = Field(None, ge=0, le=2147483647) - rendering_speed: Optional[RenderingSpeed1] = None color_palette: Optional[Dict[str, Any]] = None + image: Optional[StrictBytes] = None + magic_prompt: Optional[MagicPrompt] = None + num_images: Optional[int] = Field(None, ge=1, le=8) + prompt: str + rendering_speed: Optional[RenderingSpeed1] = None + seed: Optional[int] = Field(None, ge=0, le=2147483647) style_codes: Optional[List[str]] = None style_reference_images: Optional[List[StrictBytes]] = None -class KlingTaskStatus(str, Enum): - submitted = 'submitted' - processing = 'processing' - succeed = 'succeed' - failed = 'failed' +class ColorPalette(BaseModel): + name: str = Field(..., description='Name of the color palette', examples=['PASTEL']) -class KlingVideoGenModelName(str, Enum): - kling_v1 = 'kling-v1' - kling_v1_5 = 'kling-v1-5' - kling_v1_6 = 'kling-v1-6' - kling_v2_master = 'kling-v2-master' +class MagicPrompt2(str, Enum): + ON = 'ON' + OFF = 'OFF' -class KlingVideoGenMode(str, Enum): - std = 'std' - pro = 'pro' +class StyleType1(str, Enum): + GENERAL = 'GENERAL' -class KlingVideoGenAspectRatio(str, Enum): - field_16_9 = '16:9' - field_9_16 = '9:16' +class ImagenImageGenerationInstance(BaseModel): + prompt: str = Field(..., description='Text prompt for image generation') + + +class AspectRatio(str, Enum): field_1_1 = '1:1' + field_9_16 = '9:16' + field_16_9 = '16:9' + field_3_4 = '3:4' + field_4_3 = '4:3' -class KlingVideoGenDuration(str, Enum): - field_5 = '5' - field_10 = '10' +class PersonGeneration(str, Enum): + dont_allow = 'dont_allow' + allow_adult = 'allow_adult' + allow_all = 'allow_all' -class KlingVideoGenCfgScale(RootModel[float]): - root: float = Field( - ..., - description="Flexibility in video generation. The higher the value, the lower the model's degree of flexibility, and the stronger the relevance to the user's prompt.", - ge=0.0, - le=1.0, +class SafetySetting(str, Enum): + block_most = 'block_most' + block_some = 'block_some' + block_few = 'block_few' + block_fewest = 'block_fewest' + + +class ImagenImagePrediction(BaseModel): + bytesBase64Encoded: Optional[str] = Field( + None, description='Base64-encoded image content' + ) + mimeType: Optional[str] = Field( + None, description='MIME type of the generated image' + ) + prompt: Optional[str] = Field( + None, description='Enhanced or rewritten prompt used to generate this image' ) -class KlingCameraControlType(str, Enum): - simple = 'simple' - down_back = 'down_back' - forward_up = 'forward_up' - right_turn_forward = 'right_turn_forward' - left_turn_forward = 'left_turn_forward' +class MimeType(str, Enum): + image_png = 'image/png' + image_jpeg = 'image/jpeg' + + +class ImagenOutputOptions(BaseModel): + compressionQuality: Optional[int] = Field(None, ge=0, le=100) + mimeType: Optional[MimeType] = None + + +class Includable(str, Enum): + file_search_call_results = 'file_search_call.results' + message_input_image_image_url = 'message.input_image.image_url' + computer_call_output_output_image_url = 'computer_call_output.output.image_url' + + +class Type7(str, Enum): + input_file = 'input_file' + + +class InputFileContent(BaseModel): + file_data: Optional[str] = Field( + None, description='The content of the file to be sent to the model.\n' + ) + file_id: Optional[str] = Field( + None, description='The ID of the file to be sent to the model.' + ) + filename: Optional[str] = Field( + None, description='The name of the file to be sent to the model.' + ) + type: Type7 = Field( + ..., description='The type of the input item. Always `input_file`.' + ) + + +class Detail(str, Enum): + low = 'low' + high = 'high' + auto = 'auto' + + +class Type8(str, Enum): + input_image = 'input_image' + + +class InputImageContent(BaseModel): + detail: Detail = Field( + ..., + description='The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.', + ) + file_id: Optional[str] = Field( + None, description='The ID of the file to be sent to the model.' + ) + image_url: Optional[str] = Field( + None, + description='The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.', + ) + type: Type8 = Field( + ..., description='The type of the input item. Always `input_image`.' + ) + + +class Role3(str, Enum): + user = 'user' + system = 'system' + developer = 'developer' + + +class Type9(str, Enum): + message = 'message' + + +class Type10(str, Enum): + input_text = 'input_text' + + +class InputTextContent(BaseModel): + text: str = Field(..., description='The text input to the model.') + type: Type10 = Field( + ..., description='The type of the input item. Always `input_text`.' + ) + + +class KlingAudioUploadType(str, Enum): + file = 'file' + url = 'url' class KlingCameraConfig(BaseModel): @@ -464,27 +768,27 @@ class KlingCameraConfig(BaseModel): ge=-10.0, le=10.0, ) - vertical: Optional[float] = Field( - None, - description="Controls camera's movement along vertical axis (y-axis). Negative indicates downward, positive indicates upward.", - ge=-10.0, - le=10.0, - ) pan: Optional[float] = Field( None, description="Controls camera's rotation in vertical plane (x-axis). Negative indicates downward rotation, positive indicates upward rotation.", ge=-10.0, le=10.0, ) + roll: Optional[float] = Field( + None, + description="Controls camera's rolling amount (z-axis). Negative indicates counterclockwise, positive indicates clockwise.", + ge=-10.0, + le=10.0, + ) tilt: Optional[float] = Field( None, description="Controls camera's rotation in horizontal plane (y-axis). Negative indicates left rotation, positive indicates right rotation.", ge=-10.0, le=10.0, ) - roll: Optional[float] = Field( + vertical: Optional[float] = Field( None, - description="Controls camera's rolling amount (z-axis). Negative indicates counterclockwise, positive indicates clockwise.", + description="Controls camera's movement along vertical axis (y-axis). Negative indicates downward, positive indicates upward.", ge=-10.0, le=10.0, ) @@ -496,39 +800,12 @@ class KlingCameraConfig(BaseModel): ) -class KlingVideoResult(BaseModel): - id: Optional[str] = Field(None, description='Generated video ID') - url: Optional[AnyUrl] = Field(None, description='URL for generated video') - duration: Optional[str] = Field(None, description='Total video duration') - - -class KlingAudioUploadType(str, Enum): - file = 'file' - url = 'url' - - -class KlingLipSyncMode(str, Enum): - text2video = 'text2video' - audio2video = 'audio2video' - - -class KlingLipSyncVoiceLanguage(str, Enum): - zh = 'zh' - en = 'en' - - -class KlingDualCharacterEffectsScene(str, Enum): - hug = 'hug' - kiss = 'kiss' - heart_gesture = 'heart_gesture' - - -class KlingSingleImageEffectsScene(str, Enum): - bloombloom = 'bloombloom' - dizzydizzy = 'dizzydizzy' - fuzzyfuzzy = 'fuzzyfuzzy' - squish = 'squish' - expansion = 'expansion' +class KlingCameraControlType(str, Enum): + simple = 'simple' + down_back = 'down_back' + forward_up = 'forward_up' + right_turn_forward = 'right_turn_forward' + left_turn_forward = 'left_turn_forward' class KlingCharacterEffectModelName(str, Enum): @@ -537,18 +814,50 @@ class KlingCharacterEffectModelName(str, Enum): kling_v1_6 = 'kling-v1-6' -class KlingSingleImageEffectModelName(str, Enum): - kling_v1_6 = 'kling-v1-6' - - -class KlingSingleImageEffectDuration(str, Enum): - field_5 = '5' +class KlingDualCharacterEffectsScene(str, Enum): + hug = 'hug' + kiss = 'kiss' + heart_gesture = 'heart_gesture' class KlingDualCharacterImages(RootModel[List[str]]): root: List[str] = Field(..., max_length=2, min_length=2) +class KlingErrorResponse(BaseModel): + code: int = Field( + ..., + description='- 1000: Authentication failed\n- 1001: Authorization is empty\n- 1002: Authorization is invalid\n- 1003: Authorization is not yet valid\n- 1004: Authorization has expired\n- 1100: Account exception\n- 1101: Account in arrears (postpaid scenario)\n- 1102: Resource pack depleted or expired (prepaid scenario)\n- 1103: Unauthorized access to requested resource\n- 1200: Invalid request parameters\n- 1201: Invalid parameters\n- 1202: Invalid request method\n- 1203: Requested resource does not exist\n- 1300: Trigger platform strategy\n- 1301: Trigger content security policy\n- 1302: API request too frequent\n- 1303: Concurrency/QPS exceeds limit\n- 1304: Trigger IP whitelist policy\n- 5000: Internal server error\n- 5001: Service temporarily unavailable\n- 5002: Server internal timeout\n', + ) + message: str = Field(..., description='Human-readable error message') + request_id: str = Field( + ..., description='Request ID for tracking and troubleshooting' + ) + + +class Trajectory(BaseModel): + x: Optional[int] = Field( + None, + description='The horizontal coordinate of trajectory point. Based on bottom-left corner of image as origin (0,0).', + ) + y: Optional[int] = Field( + None, + description='The vertical coordinate of trajectory point. Based on bottom-left corner of image as origin (0,0).', + ) + + +class DynamicMask(BaseModel): + mask: Optional[AnyUrl] = Field( + None, + description='Dynamic Brush Application Area (Mask image created by users using the motion brush). The aspect ratio must match the input image.', + ) + trajectories: Optional[List[Trajectory]] = None + + +class TaskInfo(BaseModel): + external_task_id: Optional[str] = None + + class KlingImageGenAspectRatio(str, Enum): field_16_9 = '16:9' field_9_16 = '9:16' @@ -571,278 +880,42 @@ class KlingImageGenModelName(str, Enum): kling_v2 = 'kling-v2' +class KlingImageGenerationsRequest(BaseModel): + aspect_ratio: Optional[KlingImageGenAspectRatio] = '16:9' + callback_url: Optional[AnyUrl] = Field( + None, description='The callback notification address' + ) + human_fidelity: Optional[float] = Field( + 0.45, description='Subject reference similarity', ge=0.0, le=1.0 + ) + image: Optional[str] = Field( + None, description='Reference Image - Base64 encoded string or image URL' + ) + image_fidelity: Optional[float] = Field( + 0.5, description='Reference intensity for user-uploaded images', ge=0.0, le=1.0 + ) + image_reference: Optional[KlingImageGenImageReferenceType] = None + model_name: Optional[KlingImageGenModelName] = 'kling-v1' + n: Optional[int] = Field(1, description='Number of generated images', ge=1, le=9) + negative_prompt: Optional[str] = Field( + None, description='Negative text prompt', max_length=200 + ) + prompt: str = Field(..., description='Positive text prompt', max_length=500) + + class KlingImageResult(BaseModel): index: Optional[int] = Field(None, description='Image Number (0-9)') url: Optional[AnyUrl] = Field(None, description='URL for generated image') -class KlingVirtualTryOnModelName(str, Enum): - kolors_virtual_try_on_v1 = 'kolors-virtual-try-on-v1' - kolors_virtual_try_on_v1_5 = 'kolors-virtual-try-on-v1-5' +class KlingLipSyncMode(str, Enum): + text2video = 'text2video' + audio2video = 'audio2video' -class TaskInfo(BaseModel): - external_task_id: Optional[str] = None - - -class TaskResult(BaseModel): - videos: Optional[List[KlingVideoResult]] = None - - -class Data(BaseModel): - task_id: Optional[str] = Field(None, description='Task ID') - task_status: Optional[KlingTaskStatus] = None - task_info: Optional[TaskInfo] = None - created_at: Optional[int] = Field(None, description='Task creation time') - updated_at: Optional[int] = Field(None, description='Task update time') - task_result: Optional[TaskResult] = None - - -class KlingText2VideoResponse(BaseModel): - code: Optional[int] = Field(None, description='Error code') - message: Optional[str] = Field(None, description='Error message') - request_id: Optional[str] = Field(None, description='Request ID') - data: Optional[Data] = None - - -class Trajectory(BaseModel): - x: Optional[int] = Field( - None, - description='The horizontal coordinate of trajectory point. Based on bottom-left corner of image as origin (0,0).', - ) - y: Optional[int] = Field( - None, - description='The vertical coordinate of trajectory point. Based on bottom-left corner of image as origin (0,0).', - ) - - -class DynamicMask(BaseModel): - mask: Optional[AnyUrl] = Field( - None, - description='Dynamic Brush Application Area (Mask image created by users using the motion brush). The aspect ratio must match the input image.', - ) - trajectories: Optional[List[Trajectory]] = None - - -class Data1(BaseModel): - task_id: Optional[str] = Field(None, description='Task ID') - task_status: Optional[KlingTaskStatus] = None - task_info: Optional[TaskInfo] = None - created_at: Optional[int] = Field(None, description='Task creation time') - updated_at: Optional[int] = Field(None, description='Task update time') - task_result: Optional[TaskResult] = None - - -class KlingImage2VideoResponse(BaseModel): - code: Optional[int] = Field(None, description='Error code') - message: Optional[str] = Field(None, description='Error message') - request_id: Optional[str] = Field(None, description='Request ID') - data: Optional[Data1] = None - - -class KlingVideoExtendRequest(BaseModel): - video_id: Optional[str] = Field( - None, - description='The ID of the video to be extended. Supports videos generated by text-to-video, image-to-video, and previous video extension operations. Cannot exceed 3 minutes total duration after extension.', - ) - prompt: Optional[str] = Field( - None, - description='Positive text prompt for guiding the video extension', - max_length=2500, - ) - negative_prompt: Optional[str] = Field( - None, - description='Negative text prompt for elements to avoid in the extended video', - max_length=2500, - ) - cfg_scale: Optional[KlingVideoGenCfgScale] = Field( - default_factory=lambda: KlingVideoGenCfgScale.model_validate(0.5) - ) - callback_url: Optional[AnyUrl] = Field( - None, - description='The callback notification address. Server will notify when the task status changes.', - ) - - -class Data2(BaseModel): - task_id: Optional[str] = Field(None, description='Task ID') - task_status: Optional[KlingTaskStatus] = None - task_info: Optional[TaskInfo] = None - created_at: Optional[int] = Field(None, description='Task creation time') - updated_at: Optional[int] = Field(None, description='Task update time') - task_result: Optional[TaskResult] = None - - -class KlingVideoExtendResponse(BaseModel): - code: Optional[int] = Field(None, description='Error code') - message: Optional[str] = Field(None, description='Error message') - request_id: Optional[str] = Field(None, description='Request ID') - data: Optional[Data2] = None - - -class KlingLipSyncInputObject(BaseModel): - video_id: Optional[str] = Field( - None, - description='The ID of the video generated by Kling AI. Only supports 5-second and 10-second videos generated within the last 30 days.', - ) - video_url: Optional[str] = Field( - None, - description='Get link for uploaded video. Video files support .mp4/.mov, file size does not exceed 100MB, video length between 2-10s.', - ) - mode: KlingLipSyncMode - text: Optional[str] = Field( - None, - description='Text Content for Lip-Sync Video Generation. Required when mode is text2video. Maximum length is 120 characters.', - ) - voice_id: Optional[str] = Field( - None, - description='Voice ID. Required when mode is text2video. The system offers a variety of voice options to choose from.', - ) - voice_language: Optional[KlingLipSyncVoiceLanguage] = 'en' - voice_speed: Optional[float] = Field( - 1, - description='Speech Rate. Valid range: 0.8~2.0, accurate to one decimal place.', - ge=0.8, - le=2.0, - ) - audio_type: Optional[KlingAudioUploadType] = None - audio_file: Optional[str] = Field( - None, - description='Local Path of Audio File. Supported formats: .mp3/.wav/.m4a/.aac, maximum file size of 5MB. Base64 code.', - ) - audio_url: Optional[str] = Field( - None, - description='Audio File Download URL. Supported formats: .mp3/.wav/.m4a/.aac, maximum file size of 5MB.', - ) - - -class KlingLipSyncRequest(BaseModel): - input: KlingLipSyncInputObject - callback_url: Optional[AnyUrl] = Field( - None, - description='The callback notification address. Server will notify when the task status changes.', - ) - - -class Data3(BaseModel): - task_id: Optional[str] = Field(None, description='Task ID') - task_status: Optional[KlingTaskStatus] = None - task_info: Optional[TaskInfo] = None - created_at: Optional[int] = Field(None, description='Task creation time') - updated_at: Optional[int] = Field(None, description='Task update time') - task_result: Optional[TaskResult] = None - - -class KlingLipSyncResponse(BaseModel): - code: Optional[int] = Field(None, description='Error code') - message: Optional[str] = Field(None, description='Error message') - request_id: Optional[str] = Field(None, description='Request ID') - data: Optional[Data3] = None - - -class KlingSingleImageEffectInput(BaseModel): - model_name: KlingSingleImageEffectModelName - image: str = Field( - ..., - description='Reference Image. URL or Base64 encoded string (without data:image prefix). File size cannot exceed 10MB, resolution not less than 300*300px, aspect ratio between 1:2.5 ~ 2.5:1.', - ) - duration: KlingSingleImageEffectDuration - - -class KlingDualCharacterEffectInput(BaseModel): - model_name: Optional[KlingCharacterEffectModelName] = 'kling-v1' - mode: Optional[KlingVideoGenMode] = 'std' - images: KlingDualCharacterImages - duration: KlingVideoGenDuration - - -class Data4(BaseModel): - task_id: Optional[str] = Field(None, description='Task ID') - task_status: Optional[KlingTaskStatus] = None - task_info: Optional[TaskInfo] = None - created_at: Optional[int] = Field(None, description='Task creation time') - updated_at: Optional[int] = Field(None, description='Task update time') - task_result: Optional[TaskResult] = None - - -class KlingVideoEffectsResponse(BaseModel): - code: Optional[int] = Field(None, description='Error code') - message: Optional[str] = Field(None, description='Error message') - request_id: Optional[str] = Field(None, description='Request ID') - data: Optional[Data4] = None - - -class KlingImageGenerationsRequest(BaseModel): - model_name: Optional[KlingImageGenModelName] = 'kling-v1' - prompt: str = Field(..., description='Positive text prompt', max_length=500) - negative_prompt: Optional[str] = Field( - None, description='Negative text prompt', max_length=200 - ) - image: Optional[str] = Field( - None, description='Reference Image - Base64 encoded string or image URL' - ) - image_reference: Optional[KlingImageGenImageReferenceType] = None - image_fidelity: Optional[float] = Field( - 0.5, description='Reference intensity for user-uploaded images', ge=0.0, le=1.0 - ) - human_fidelity: Optional[float] = Field( - 0.45, description='Subject reference similarity', ge=0.0, le=1.0 - ) - n: Optional[int] = Field(1, description='Number of generated images', ge=1, le=9) - aspect_ratio: Optional[KlingImageGenAspectRatio] = '16:9' - callback_url: Optional[AnyUrl] = Field( - None, description='The callback notification address' - ) - - -class TaskResult5(BaseModel): - images: Optional[List[KlingImageResult]] = None - - -class Data5(BaseModel): - task_id: Optional[str] = Field(None, description='Task ID') - task_status: Optional[KlingTaskStatus] = None - task_status_msg: Optional[str] = Field(None, description='Task status information') - created_at: Optional[int] = Field(None, description='Task creation time') - updated_at: Optional[int] = Field(None, description='Task update time') - task_result: Optional[TaskResult5] = None - - -class KlingImageGenerationsResponse(BaseModel): - code: Optional[int] = Field(None, description='Error code') - message: Optional[str] = Field(None, description='Error message') - request_id: Optional[str] = Field(None, description='Request ID') - data: Optional[Data5] = None - - -class KlingVirtualTryOnRequest(BaseModel): - model_name: Optional[KlingVirtualTryOnModelName] = 'kolors-virtual-try-on-v1' - human_image: str = Field( - ..., description='Reference human image - Base64 encoded string or image URL' - ) - cloth_image: Optional[str] = Field( - None, - description='Reference clothing image - Base64 encoded string or image URL', - ) - callback_url: Optional[AnyUrl] = Field( - None, description='The callback notification address' - ) - - -class Data6(BaseModel): - task_id: Optional[str] = Field(None, description='Task ID') - task_status: Optional[KlingTaskStatus] = None - task_status_msg: Optional[str] = Field(None, description='Task status information') - created_at: Optional[int] = Field(None, description='Task creation time') - updated_at: Optional[int] = Field(None, description='Task update time') - task_result: Optional[TaskResult5] = None - - -class KlingVirtualTryOnResponse(BaseModel): - code: Optional[int] = Field(None, description='Error code') - message: Optional[str] = Field(None, description='Error message') - request_id: Optional[str] = Field(None, description='Request ID') - data: Optional[Data6] = None +class KlingLipSyncVoiceLanguage(str, Enum): + zh = 'zh' + en = 'en' class ResourcePackType(str, Enum): @@ -850,7 +923,7 @@ class ResourcePackType(str, Enum): constant_period = 'constant_period' -class Status(str, Enum): +class Status4(str, Enum): toBeOnline = 'toBeOnline' online = 'online' expired = 'expired' @@ -858,29 +931,29 @@ class Status(str, Enum): class ResourcePackSubscribeInfo(BaseModel): - resource_pack_name: Optional[str] = Field(None, description='Resource package name') - resource_pack_id: Optional[str] = Field(None, description='Resource package ID') - resource_pack_type: Optional[ResourcePackType] = Field( - None, - description='Resource package type (decreasing_total=decreasing total, constant_period=constant periodicity)', - ) - total_quantity: Optional[float] = Field(None, description='Total quantity') - remaining_quantity: Optional[float] = Field( - None, description='Remaining quantity (updated with a 12-hour delay)' - ) - purchase_time: Optional[int] = Field( - None, description='Purchase time, Unix timestamp in ms' - ) effective_time: Optional[int] = Field( None, description='Effective time, Unix timestamp in ms' ) invalid_time: Optional[int] = Field( None, description='Expiration time, Unix timestamp in ms' ) - status: Optional[Status] = Field(None, description='Resource Package Status') + purchase_time: Optional[int] = Field( + None, description='Purchase time, Unix timestamp in ms' + ) + remaining_quantity: Optional[float] = Field( + None, description='Remaining quantity (updated with a 12-hour delay)' + ) + resource_pack_id: Optional[str] = Field(None, description='Resource package ID') + resource_pack_name: Optional[str] = Field(None, description='Resource package name') + resource_pack_type: Optional[ResourcePackType] = Field( + None, + description='Resource package type (decreasing_total=decreasing total, constant_period=constant periodicity)', + ) + status: Optional[Status4] = Field(None, description='Resource Package Status') + total_quantity: Optional[float] = Field(None, description='Total quantity') -class Data7(BaseModel): +class Data3(BaseModel): code: Optional[int] = Field(None, description='Error code; 0 indicates success') msg: Optional[str] = Field(None, description='Error information') resource_pack_subscribe_infos: Optional[List[ResourcePackSubscribeInfo]] = Field( @@ -890,137 +963,313 @@ class Data7(BaseModel): class KlingResourcePackageResponse(BaseModel): code: Optional[int] = Field(None, description='Error code; 0 indicates success') + data: Optional[Data3] = None message: Optional[str] = Field(None, description='Error information') request_id: Optional[str] = Field( None, description='Request ID, generated by the system, used to track requests and troubleshoot problems', ) + + +class KlingSingleImageEffectDuration(str, Enum): + field_5 = '5' + + +class KlingSingleImageEffectModelName(str, Enum): + kling_v1_6 = 'kling-v1-6' + + +class KlingSingleImageEffectsScene(str, Enum): + bloombloom = 'bloombloom' + dizzydizzy = 'dizzydizzy' + fuzzyfuzzy = 'fuzzyfuzzy' + squish = 'squish' + expansion = 'expansion' + + +class KlingTaskStatus(str, Enum): + submitted = 'submitted' + processing = 'processing' + succeed = 'succeed' + failed = 'failed' + + +class KlingTextToVideoModelName(str, Enum): + kling_v1 = 'kling-v1' + kling_v1_6 = 'kling-v1-6' + + +class KlingVideoGenAspectRatio(str, Enum): + field_16_9 = '16:9' + field_9_16 = '9:16' + field_1_1 = '1:1' + + +class KlingVideoGenCfgScale(RootModel[float]): + root: float = Field( + ..., + description="Flexibility in video generation. The higher the value, the lower the model's degree of flexibility, and the stronger the relevance to the user's prompt.", + ge=0.0, + le=1.0, + ) + + +class KlingVideoGenDuration(str, Enum): + field_5 = '5' + field_10 = '10' + + +class KlingVideoGenMode(str, Enum): + std = 'std' + pro = 'pro' + + +class KlingVideoGenModelName(str, Enum): + kling_v1 = 'kling-v1' + kling_v1_5 = 'kling-v1-5' + kling_v1_6 = 'kling-v1-6' + kling_v2_master = 'kling-v2-master' + + +class KlingVideoResult(BaseModel): + duration: Optional[str] = Field(None, description='Total video duration') + id: Optional[str] = Field(None, description='Generated video ID') + url: Optional[AnyUrl] = Field(None, description='URL for generated video') + + +class KlingVirtualTryOnModelName(str, Enum): + kolors_virtual_try_on_v1 = 'kolors-virtual-try-on-v1' + kolors_virtual_try_on_v1_5 = 'kolors-virtual-try-on-v1-5' + + +class KlingVirtualTryOnRequest(BaseModel): + callback_url: Optional[AnyUrl] = Field( + None, description='The callback notification address' + ) + cloth_image: Optional[str] = Field( + None, + description='Reference clothing image - Base64 encoded string or image URL', + ) + human_image: str = Field( + ..., description='Reference human image - Base64 encoded string or image URL' + ) + model_name: Optional[KlingVirtualTryOnModelName] = 'kolors-virtual-try-on-v1' + + +class TaskResult6(BaseModel): + images: Optional[List[KlingImageResult]] = None + + +class Data7(BaseModel): + created_at: Optional[int] = Field(None, description='Task creation time') + task_id: Optional[str] = Field(None, description='Task ID') + task_result: Optional[TaskResult6] = None + task_status: Optional[KlingTaskStatus] = None + task_status_msg: Optional[str] = Field(None, description='Task status information') + updated_at: Optional[int] = Field(None, description='Task update time') + + +class KlingVirtualTryOnResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') data: Optional[Data7] = None + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') -class Object(str, Enum): - event = 'event' +class LumaAspectRatio(str, Enum): + field_1_1 = '1:1' + field_16_9 = '16:9' + field_9_16 = '9:16' + field_4_3 = '4:3' + field_3_4 = '3:4' + field_21_9 = '21:9' + field_9_21 = '9:21' -class Type(str, Enum): - payment_intent_succeeded = 'payment_intent.succeeded' +class LumaAssets(BaseModel): + image: Optional[AnyUrl] = Field(None, description='The URL of the image') + progress_video: Optional[AnyUrl] = Field( + None, description='The URL of the progress video' + ) + video: Optional[AnyUrl] = Field(None, description='The URL of the video') -class StripeRequestInfo(BaseModel): - id: Optional[str] = None - idempotency_key: Optional[str] = None +class GenerationType(str, Enum): + add_audio = 'add_audio' -class Object1(str, Enum): - payment_intent = 'payment_intent' +class LumaAudioGenerationRequest(BaseModel): + callback_url: Optional[AnyUrl] = Field( + None, description='The callback URL for the audio' + ) + generation_type: Optional[GenerationType] = 'add_audio' + negative_prompt: Optional[str] = Field( + None, description='The negative prompt of the audio' + ) + prompt: Optional[str] = Field(None, description='The prompt of the audio') -class StripeAmountDetails(BaseModel): - tip: Optional[Dict[str, Any]] = None +class LumaError(BaseModel): + detail: Optional[str] = Field(None, description='The error message') -class Object2(str, Enum): - charge = 'charge' +class Type11(str, Enum): + generation = 'generation' -class StripeAddress(BaseModel): - city: Optional[str] = None - country: Optional[str] = None - line1: Optional[str] = None - line2: Optional[str] = None - postal_code: Optional[str] = None - state: Optional[str] = None +class LumaGenerationReference(BaseModel): + id: UUID = Field(..., description='The ID of the generation') + type: Literal['generation'] -class StripeOutcome(BaseModel): - advice_code: Optional[Any] = None - network_advice_code: Optional[Any] = None - network_decline_code: Optional[Any] = None - network_status: Optional[str] = None - reason: Optional[Any] = None - risk_level: Optional[str] = None - risk_score: Optional[int] = None - seller_message: Optional[str] = None - type: Optional[str] = None +class GenerationType1(str, Enum): + video = 'video' -class Checks(BaseModel): - address_line1_check: Optional[Any] = None - address_postal_code_check: Optional[Any] = None - cvc_check: Optional[str] = None +class LumaGenerationType(str, Enum): + video = 'video' + image = 'image' -class ExtendedAuthorization(BaseModel): - status: Optional[str] = None +class GenerationType2(str, Enum): + image = 'image' -class IncrementalAuthorization(BaseModel): - status: Optional[str] = None +class LumaImageIdentity(BaseModel): + images: Optional[List[AnyUrl]] = Field( + None, description='The URLs of the image identity' + ) -class Multicapture(BaseModel): - status: Optional[str] = None +class LumaImageModel(str, Enum): + photon_1 = 'photon-1' + photon_flash_1 = 'photon-flash-1' -class NetworkToken(BaseModel): - used: Optional[bool] = None +class LumaImageRef(BaseModel): + url: Optional[AnyUrl] = Field(None, description='The URL of the image reference') + weight: Optional[float] = Field( + None, description='The weight of the image reference' + ) -class Overcapture(BaseModel): - maximum_amount_capturable: Optional[int] = None - status: Optional[str] = None +class Type12(str, Enum): + image = 'image' -class StripeCardDetails(BaseModel): - amount_authorized: Optional[int] = None - authorization_code: Optional[Any] = None - brand: Optional[str] = None - checks: Optional[Checks] = None - country: Optional[str] = None - exp_month: Optional[int] = None - exp_year: Optional[int] = None - extended_authorization: Optional[ExtendedAuthorization] = None - fingerprint: Optional[str] = None - funding: Optional[str] = None - incremental_authorization: Optional[IncrementalAuthorization] = None - installments: Optional[Any] = None - last4: Optional[str] = None - mandate: Optional[Any] = None - multicapture: Optional[Multicapture] = None - network: Optional[str] = None - network_token: Optional[NetworkToken] = None - network_transaction_id: Optional[str] = None - overcapture: Optional[Overcapture] = None - regulated_status: Optional[str] = None - three_d_secure: Optional[Any] = None - wallet: Optional[Any] = None +class LumaImageReference(BaseModel): + type: Literal['image'] + url: AnyUrl = Field(..., description='The URL of the image') -class StripeRefundList(BaseModel): - object: Optional[str] = None - data: Optional[List[Dict[str, Any]]] = None - has_more: Optional[bool] = None - total_count: Optional[int] = None - url: Optional[str] = None +class LumaKeyframe(RootModel[Union[LumaGenerationReference, LumaImageReference]]): + root: Union[LumaGenerationReference, LumaImageReference] = Field( + ..., + description='A keyframe can be either a Generation reference, an Image, or a Video', + discriminator='type', + ) -class Card(BaseModel): - installments: Optional[Any] = None - mandate_options: Optional[Any] = None - network: Optional[Any] = None - request_three_d_secure: Optional[str] = None +class LumaKeyframes(BaseModel): + frame0: Optional[LumaKeyframe] = None + frame1: Optional[LumaKeyframe] = None -class StripePaymentMethodOptions(BaseModel): - card: Optional[Card] = None +class LumaModifyImageRef(BaseModel): + url: Optional[AnyUrl] = Field(None, description='The URL of the image reference') + weight: Optional[float] = Field( + None, description='The weight of the modify image reference' + ) -class StripeShipping(BaseModel): - address: Optional[StripeAddress] = None - carrier: Optional[str] = None - name: Optional[str] = None - phone: Optional[str] = None - tracking_number: Optional[str] = None +class LumaState(str, Enum): + queued = 'queued' + dreaming = 'dreaming' + completed = 'completed' + failed = 'failed' + + +class GenerationType3(str, Enum): + upscale_video = 'upscale_video' + + +class LumaVideoModel(str, Enum): + ray_2 = 'ray-2' + ray_flash_2 = 'ray-flash-2' + ray_1_6 = 'ray-1-6' + + +class LumaVideoModelOutputDuration1(str, Enum): + field_5s = '5s' + field_9s = '9s' + + +class LumaVideoModelOutputDuration( + RootModel[Union[LumaVideoModelOutputDuration1, str]] +): + root: Union[LumaVideoModelOutputDuration1, str] + + +class LumaVideoModelOutputResolution1(str, Enum): + field_540p = '540p' + field_720p = '720p' + field_1080p = '1080p' + field_4k = '4k' + + +class LumaVideoModelOutputResolution( + RootModel[Union[LumaVideoModelOutputResolution1, str]] +): + root: Union[LumaVideoModelOutputResolution1, str] + + +class MinimaxBaseResponse(BaseModel): + status_code: int = Field( + ..., + description='Status code. 0 indicates success, other values indicate errors.', + ) + status_msg: str = Field( + ..., description='Specific error details or success message.' + ) + + +class File(BaseModel): + bytes: Optional[int] = Field(None, description='File size in bytes') + created_at: Optional[int] = Field( + None, description='Unix timestamp when the file was created, in seconds' + ) + download_url: Optional[str] = Field( + None, description='The URL to download the video' + ) + file_id: Optional[int] = Field(None, description='Unique identifier for the file') + filename: Optional[str] = Field(None, description='The name of the file') + purpose: Optional[str] = Field(None, description='The purpose of using the file') + + +class MinimaxFileRetrieveResponse(BaseModel): + base_resp: MinimaxBaseResponse + file: File + + +class Status5(str, Enum): + Queueing = 'Queueing' + Preparing = 'Preparing' + Processing = 'Processing' + Success = 'Success' + Fail = 'Fail' + + +class MinimaxTaskResultResponse(BaseModel): + base_resp: MinimaxBaseResponse + file_id: Optional[str] = Field( + None, + description='After the task status changes to Success, this field returns the file ID corresponding to the generated video.', + ) + status: Status5 = Field( + ..., + description="Task status: 'Queueing' (in queue), 'Preparing' (task is preparing), 'Processing' (generating), 'Success' (task completed successfully), or 'Fail' (task failed).", + ) + task_id: str = Field(..., description='The task ID being queried.') class Model(str, Enum): @@ -1043,6 +1292,14 @@ class SubjectReferenceItem(BaseModel): class MinimaxVideoGenerationRequest(BaseModel): + callback_url: Optional[str] = Field( + None, + description='Optional. URL to receive real-time status updates about the video generation task.', + ) + first_frame_image: Optional[str] = Field( + None, + description='URL or base64 encoding of the first frame image. Required when model is I2V-01, I2V-01-Director, or I2V-01-live.', + ) model: Model = Field( ..., description='Required. ID of model. Options: T2V-01-Director, I2V-01-Director, S2V-01, I2V-01, I2V-01-live, T2V-01', @@ -1056,927 +1313,175 @@ class MinimaxVideoGenerationRequest(BaseModel): True, description='If true (default), the model will automatically optimize the prompt. Set to false for more precise control.', ) - first_frame_image: Optional[str] = Field( - None, - description='URL or base64 encoding of the first frame image. Required when model is I2V-01, I2V-01-Director, or I2V-01-live.', - ) subject_reference: Optional[List[SubjectReferenceItem]] = Field( None, description='Only available when model is S2V-01. The model will generate a video based on the subject uploaded through this parameter.', ) - callback_url: Optional[str] = Field( - None, - description='Optional. URL to receive real-time status updates about the video generation task.', - ) - - -class MinimaxBaseResponse(BaseModel): - status_code: int = Field( - ..., - description='Status code. 0 indicates success, other values indicate errors.', - ) - status_msg: str = Field( - ..., description='Specific error details or success message.' - ) class MinimaxVideoGenerationResponse(BaseModel): + base_resp: MinimaxBaseResponse task_id: str = Field( ..., description='The task ID for the asynchronous video generation task.' ) - base_resp: MinimaxBaseResponse -class File(BaseModel): - file_id: Optional[int] = Field(None, description='Unique identifier for the file') - bytes: Optional[int] = Field(None, description='File size in bytes') - created_at: Optional[int] = Field( - None, description='Unix timestamp when the file was created, in seconds' +class Truncation(str, Enum): + disabled = 'disabled' + auto = 'auto' + + +class ModelResponseProperties(BaseModel): + instructions: Optional[str] = Field( + None, description='Instructions for the model on how to generate the response' ) - filename: Optional[str] = Field(None, description='The name of the file') - purpose: Optional[str] = Field(None, description='The purpose of using the file') - download_url: Optional[str] = Field( - None, description='The URL to download the video' + max_output_tokens: Optional[int] = Field( + None, description='Maximum number of tokens to generate' + ) + model: Optional[str] = Field( + None, description='The model used to generate the response' + ) + temperature: Optional[float] = Field( + 1, description='Controls randomness in the response', ge=0.0, le=2.0 + ) + top_p: Optional[float] = Field( + 1, + description='Controls diversity of the response via nucleus sampling', + ge=0.0, + le=1.0, + ) + truncation: Optional[Truncation] = Field( + 'disabled', description='How to handle truncation of the response' ) -class MinimaxFileRetrieveResponse(BaseModel): - file: File - base_resp: MinimaxBaseResponse +class Moderation(str, Enum): + low = 'low' + auto = 'auto' -class Status1(str, Enum): - Queueing = 'Queueing' - Preparing = 'Preparing' - Processing = 'Processing' - Success = 'Success' - Fail = 'Fail' - - -class MinimaxTaskResultResponse(BaseModel): - task_id: str = Field(..., description='The task ID being queried.') - status: Status1 = Field( - ..., - description="Task status: 'Queueing' (in queue), 'Preparing' (task is preparing), 'Processing' (generating), 'Success' (task completed successfully), or 'Fail' (task failed).", - ) - file_id: Optional[str] = Field( - None, - description='After the task status changes to Success, this field returns the file ID corresponding to the generated video.', - ) - base_resp: MinimaxBaseResponse - - -class OutputFormat(str, Enum): - jpeg = 'jpeg' +class OutputFormat1(str, Enum): png = 'png' - - -class BFLFluxPro11GenerateRequest(BaseModel): - prompt: str = Field(..., description='The main text prompt for image generation') - image_prompt: Optional[str] = Field(None, description='Optional image prompt') - width: int = Field(..., description='Width of the generated image') - height: int = Field(..., description='Height of the generated image') - prompt_upsampling: Optional[bool] = Field( - None, description='Whether to use prompt upsampling' - ) - seed: Optional[int] = Field(None, description='Random seed for reproducibility') - safety_tolerance: Optional[int] = Field(None, description='Safety tolerance level') - output_format: Optional[OutputFormat] = Field( - None, description='Output image format' - ) - webhook_url: Optional[str] = Field( - None, description='Optional webhook URL for async processing' - ) - webhook_secret: Optional[str] = Field( - None, description='Optional webhook secret for async processing' - ) - - -class BFLFluxPro11GenerateResponse(BaseModel): - id: str = Field(..., description='Job ID for tracking') - polling_url: str = Field(..., description='URL to poll for results') - - -class BFLFluxProGenerateRequest(BaseModel): - prompt: str = Field(..., description='The text prompt for image generation.') - negative_prompt: Optional[str] = Field( - None, description='The negative prompt for image generation.' - ) - width: int = Field( - ..., description='The width of the image to generate.', ge=64, le=2048 - ) - height: int = Field( - ..., description='The height of the image to generate.', ge=64, le=2048 - ) - num_inference_steps: Optional[int] = Field( - None, description='The number of inference steps.', ge=1, le=100 - ) - guidance_scale: Optional[float] = Field( - None, description='The guidance scale for generation.', ge=1.0, le=20.0 - ) - seed: Optional[int] = Field(None, description='The seed value for reproducibility.') - num_images: Optional[int] = Field( - None, description='The number of images to generate.', ge=1, le=4 - ) - - -class BFLFluxProGenerateResponse(BaseModel): - id: str = Field(..., description='The unique identifier for the generation task.') - polling_url: str = Field(..., description='URL to poll for the generation result.') - - -class Steps(RootModel[int]): - root: int = Field( - ..., - description='Number of steps for the image generation process', - examples=[50], - ge=15, - le=50, - title='Steps', - ) - - -class Guidance(RootModel[float]): - root: float = Field( - ..., - description='Guidance strength for the image generation process', - ge=1.5, - le=100.0, - title='Guidance', - ) - - -class WebhookUrl(RootModel[AnyUrl]): - root: AnyUrl = Field( - ..., description='URL to receive webhook notifications', title='Webhook Url' - ) - - -class BFLAsyncResponse(BaseModel): - id: str = Field(..., title='Id') - polling_url: str = Field(..., title='Polling Url') - - -class BFLAsyncWebhookResponse(BaseModel): - id: str = Field(..., title='Id') - status: str = Field(..., title='Status') - webhook_url: str = Field(..., title='Webhook Url') - - -class Top(RootModel[int]): - root: int = Field( - ..., - description='Number of pixels to expand at the top of the image', - ge=0, - le=2048, - title='Top', - ) - - -class Bottom(RootModel[int]): - root: int = Field( - ..., - description='Number of pixels to expand at the bottom of the image', - ge=0, - le=2048, - title='Bottom', - ) - - -class Left(RootModel[int]): - root: int = Field( - ..., - description='Number of pixels to expand on the left side of the image', - ge=0, - le=2048, - title='Left', - ) - - -class Right(RootModel[int]): - root: int = Field( - ..., - description='Number of pixels to expand on the right side of the image', - ge=0, - le=2048, - title='Right', - ) - - -class CannyLowThreshold(RootModel[int]): - root: int = Field( - ..., - description='Low threshold for Canny edge detection', - ge=0, - le=500, - title='Canny Low Threshold', - ) - - -class CannyHighThreshold(RootModel[int]): - root: int = Field( - ..., - description='High threshold for Canny edge detection', - ge=0, - le=500, - title='Canny High Threshold', - ) - - -class Steps2(RootModel[int]): - root: int = Field( - ..., - description='Number of steps for the image generation process', - ge=15, - le=50, - title='Steps', - ) - - -class Guidance2(RootModel[float]): - root: float = Field( - ..., - description='Guidance strength for the image generation process', - ge=1.0, - le=100.0, - title='Guidance', - ) - - -class BFLOutputFormat(str, Enum): - jpeg = 'jpeg' - png = 'png' - - -class BFLValidationError(BaseModel): - loc: List[Union[str, int]] = Field(..., title='Location') - msg: str = Field(..., title='Message') - type: str = Field(..., title='Error Type') - - -class Datum2(BaseModel): - image_id: Optional[str] = Field( - None, description='Unique identifier for the generated image' - ) - url: Optional[str] = Field(None, description='URL to access the generated image') - - -class RecraftImageGenerationResponse(BaseModel): - created: int = Field( - ..., description='Unix timestamp when the generation was created' - ) - credits: int = Field(..., description='Number of credits used for the generation') - data: List[Datum2] = Field(..., description='Array of generated image information') - - -class RecraftImageFeatures(BaseModel): - nsfw_score: Optional[float] = None - - -class RecraftTextLayoutItem(BaseModel): - bbox: List[List[float]] - text: str - - -class RecraftImageColor(BaseModel): - rgb: Optional[List[int]] = None - std: Optional[List[float]] = None - weight: Optional[float] = None - - -class RecraftImageStyle(str, Enum): - digital_illustration = 'digital_illustration' - icon = 'icon' - realistic_image = 'realistic_image' - vector_illustration = 'vector_illustration' - - -class RecraftImageSubStyle(str, Enum): - field_2d_art_poster = '2d_art_poster' - field_3d = '3d' - field_80s = '80s' - glow = 'glow' - grain = 'grain' - hand_drawn = 'hand_drawn' - infantile_sketch = 'infantile_sketch' - kawaii = 'kawaii' - pixel_art = 'pixel_art' - psychedelic = 'psychedelic' - seamless = 'seamless' - voxel = 'voxel' - watercolor = 'watercolor' - broken_line = 'broken_line' - colored_outline = 'colored_outline' - colored_shapes = 'colored_shapes' - colored_shapes_gradient = 'colored_shapes_gradient' - doodle_fill = 'doodle_fill' - doodle_offset_fill = 'doodle_offset_fill' - offset_fill = 'offset_fill' - outline = 'outline' - outline_gradient = 'outline_gradient' - uneven_fill = 'uneven_fill' - field_70s = '70s' - cartoon = 'cartoon' - doodle_line_art = 'doodle_line_art' - engraving = 'engraving' - flat_2 = 'flat_2' - kawaii_1 = 'kawaii' - line_art = 'line_art' - linocut = 'linocut' - seamless_1 = 'seamless' - b_and_w = 'b_and_w' - enterprise = 'enterprise' - hard_flash = 'hard_flash' - hdr = 'hdr' - motion_blur = 'motion_blur' - natural_light = 'natural_light' - studio_portrait = 'studio_portrait' - line_circuit = 'line_circuit' - field_2d_art_poster_2 = '2d_art_poster_2' - engraving_color = 'engraving_color' - flat_air_art = 'flat_air_art' - hand_drawn_outline = 'hand_drawn_outline' - handmade_3d = 'handmade_3d' - stickers_drawings = 'stickers_drawings' - plastic = 'plastic' - pictogram = 'pictogram' - - -class RecraftTransformModel(str, Enum): - refm1 = 'refm1' - recraft20b = 'recraft20b' - recraftv2 = 'recraftv2' - recraftv3 = 'recraftv3' - flux1_1pro = 'flux1_1pro' - flux1dev = 'flux1dev' - imagen3 = 'imagen3' - hidream_i1_dev = 'hidream_i1_dev' - - -class RecraftImageFormat(str, Enum): webp = 'webp' - png = 'png' + jpeg = 'jpeg' -class RecraftResponseFormat(str, Enum): +class OpenAIImageEditRequest(BaseModel): + background: Optional[str] = Field( + None, description='Background transparency', examples=['opaque'] + ) + model: str = Field( + ..., description='The model to use for image editing', examples=['gpt-image-1'] + ) + moderation: Optional[Moderation] = Field( + None, description='Content moderation setting', examples=['auto'] + ) + n: Optional[int] = Field( + None, description='The number of images to generate', examples=[1] + ) + output_compression: Optional[int] = Field( + None, description='Compression level for JPEG or WebP (0-100)', examples=[100] + ) + output_format: Optional[OutputFormat1] = Field( + None, description='Format of the output image', examples=['png'] + ) + prompt: str = Field( + ..., + description='A text description of the desired edit', + examples=['Give the rocketship rainbow coloring'], + ) + quality: Optional[str] = Field( + None, description='The quality of the edited image', examples=['low'] + ) + size: Optional[str] = Field( + None, description='Size of the output image', examples=['1024x1024'] + ) + user: Optional[str] = Field( + None, + description='A unique identifier for end-user monitoring', + examples=['user-1234'], + ) + + +class Background(str, Enum): + transparent = 'transparent' + opaque = 'opaque' + + +class Quality(str, Enum): + low = 'low' + medium = 'medium' + high = 'high' + standard = 'standard' + hd = 'hd' + + +class ResponseFormat(str, Enum): url = 'url' b64_json = 'b64_json' -class RecraftImage(BaseModel): - b64_json: Optional[str] = None - features: Optional[RecraftImageFeatures] = None - image_id: UUID - revised_prompt: Optional[str] = None - url: Optional[str] = None - - -class RecraftUserControls(BaseModel): - artistic_level: Optional[int] = None - background_color: Optional[RecraftImageColor] = None - colors: Optional[List[RecraftImageColor]] = None - no_text: Optional[bool] = None - - -class RecraftTextLayout(RootModel[List[RecraftTextLayoutItem]]): - root: List[RecraftTextLayoutItem] - - -class RecraftProcessImageRequest(BaseModel): - image: StrictBytes - image_format: Optional[RecraftImageFormat] = None - response_format: Optional[RecraftResponseFormat] = None - - -class RecraftProcessImageResponse(BaseModel): - created: int - credits: int - image: RecraftImage - - -class RecraftImageToImageRequest(BaseModel): - block_nsfw: Optional[bool] = None - calculate_features: Optional[bool] = None - controls: Optional[RecraftUserControls] = None - image: StrictBytes - image_format: Optional[RecraftImageFormat] = None - model: Optional[RecraftTransformModel] = None - n: Optional[int] = None - negative_prompt: Optional[str] = None - prompt: str - random_seed: Optional[int] = None - response_format: Optional[RecraftResponseFormat] = None - strength: float - style: Optional[RecraftImageStyle] = None - style_id: Optional[UUID] = None - substyle: Optional[RecraftImageSubStyle] = None - text_layout: Optional[RecraftTextLayout] = None - - -class RecraftGenerateImageResponse(BaseModel): - created: int - credits: int - data: List[RecraftImage] - - -class RecraftTransformImageWithMaskRequest(BaseModel): - block_nsfw: Optional[bool] = None - calculate_features: Optional[bool] = None - image: StrictBytes - image_format: Optional[RecraftImageFormat] = None - mask: StrictBytes - model: Optional[RecraftTransformModel] = None - n: Optional[int] = None - negative_prompt: Optional[str] = None - prompt: str - random_seed: Optional[int] = None - response_format: Optional[RecraftResponseFormat] = None - style: Optional[RecraftImageStyle] = None - style_id: Optional[UUID] = None - substyle: Optional[RecraftImageSubStyle] = None - text_layout: Optional[RecraftTextLayout] = None - - -class KlingErrorResponse(BaseModel): - code: int = Field( - ..., - description='- 1000: Authentication failed\n- 1001: Authorization is empty\n- 1002: Authorization is invalid\n- 1003: Authorization is not yet valid\n- 1004: Authorization has expired\n- 1100: Account exception\n- 1101: Account in arrears (postpaid scenario)\n- 1102: Resource pack depleted or expired (prepaid scenario)\n- 1103: Unauthorized access to requested resource\n- 1200: Invalid request parameters\n- 1201: Invalid parameters\n- 1202: Invalid request method\n- 1203: Requested resource does not exist\n- 1300: Trigger platform strategy\n- 1301: Trigger content security policy\n- 1302: API request too frequent\n- 1303: Concurrency/QPS exceeds limit\n- 1304: Trigger IP whitelist policy\n- 5000: Internal server error\n- 5001: Service temporarily unavailable\n- 5002: Server internal timeout\n', - ) - message: str = Field(..., description='Human-readable error message') - request_id: str = Field( - ..., description='Request ID for tracking and troubleshooting' - ) - - -class LumaAspectRatio(str, Enum): - field_1_1 = '1:1' - field_16_9 = '16:9' - field_9_16 = '9:16' - field_4_3 = '4:3' - field_3_4 = '3:4' - field_21_9 = '21:9' - field_9_21 = '9:21' - - -class LumaVideoModel(str, Enum): - ray_2 = 'ray-2' - ray_flash_2 = 'ray-flash-2' - ray_1_6 = 'ray-1-6' - - -class LumaVideoModelOutputResolution1(str, Enum): - field_540p = '540p' - field_720p = '720p' - field_1080p = '1080p' - field_4k = '4k' - - -class LumaVideoModelOutputResolution( - RootModel[Union[LumaVideoModelOutputResolution1, str]] -): - root: Union[LumaVideoModelOutputResolution1, str] - - -class LumaVideoModelOutputDuration1(str, Enum): - field_5s = '5s' - field_9s = '9s' - - -class LumaVideoModelOutputDuration( - RootModel[Union[LumaVideoModelOutputDuration1, str]] -): - root: Union[LumaVideoModelOutputDuration1, str] - - -class LumaImageModel(str, Enum): - photon_1 = 'photon-1' - photon_flash_1 = 'photon-flash-1' - - -class LumaImageRef(BaseModel): - url: Optional[AnyUrl] = Field(None, description='The URL of the image reference') - weight: Optional[float] = Field( - None, description='The weight of the image reference' - ) - - -class LumaImageIdentity(BaseModel): - images: Optional[List[AnyUrl]] = Field( - None, description='The URLs of the image identity' - ) - - -class LumaModifyImageRef(BaseModel): - url: Optional[AnyUrl] = Field(None, description='The URL of the image reference') - weight: Optional[float] = Field( - None, description='The weight of the modify image reference' - ) - - -class Type1(str, Enum): - generation = 'generation' - - -class LumaGenerationReference(BaseModel): - type: Literal['generation'] - id: UUID = Field(..., description='The ID of the generation') - - -class Type2(str, Enum): - image = 'image' - - -class LumaImageReference(BaseModel): - type: Literal['image'] - url: AnyUrl = Field(..., description='The URL of the image') - - -class LumaKeyframe(RootModel[Union[LumaGenerationReference, LumaImageReference]]): - root: Union[LumaGenerationReference, LumaImageReference] = Field( - ..., - description='A keyframe can be either a Generation reference, an Image, or a Video', - discriminator='type', - ) - - -class LumaGenerationType(str, Enum): - video = 'video' - image = 'image' - - -class LumaState(str, Enum): - queued = 'queued' - dreaming = 'dreaming' - completed = 'completed' - failed = 'failed' - - -class LumaAssets(BaseModel): - video: Optional[AnyUrl] = Field(None, description='The URL of the video') - image: Optional[AnyUrl] = Field(None, description='The URL of the image') - progress_video: Optional[AnyUrl] = Field( - None, description='The URL of the progress video' - ) - - -class GenerationType(str, Enum): - video = 'video' - - -class GenerationType1(str, Enum): - image = 'image' - - -class CharacterRef(BaseModel): - identity0: Optional[LumaImageIdentity] = None - - -class LumaImageGenerationRequest(BaseModel): - generation_type: Optional[GenerationType1] = 'image' - model: Optional[LumaImageModel] = 'photon-1' - prompt: Optional[str] = Field(None, description='The prompt of the generation') - aspect_ratio: Optional[LumaAspectRatio] = '16:9' - callback_url: Optional[AnyUrl] = Field( - None, description='The callback URL for the generation' - ) - image_ref: Optional[List[LumaImageRef]] = None - style_ref: Optional[List[LumaImageRef]] = None - character_ref: Optional[CharacterRef] = None - modify_image_ref: Optional[LumaModifyImageRef] = None - - -class GenerationType2(str, Enum): - upscale_video = 'upscale_video' - - -class LumaUpscaleVideoGenerationRequest(BaseModel): - generation_type: Optional[GenerationType2] = 'upscale_video' - resolution: Optional[LumaVideoModelOutputResolution] = None - callback_url: Optional[AnyUrl] = Field( - None, description='The callback URL for the upscale' - ) - - -class GenerationType3(str, Enum): - add_audio = 'add_audio' - - -class LumaAudioGenerationRequest(BaseModel): - generation_type: Optional[GenerationType3] = 'add_audio' - prompt: Optional[str] = Field(None, description='The prompt of the audio') - negative_prompt: Optional[str] = Field( - None, description='The negative prompt of the audio' - ) - callback_url: Optional[AnyUrl] = Field( - None, description='The callback URL for the audio' - ) - - -class LumaError(BaseModel): - detail: Optional[str] = Field(None, description='The error message') - - -class AspectRatio(str, Enum): - field_16_9 = '16:9' - field_4_3 = '4:3' - field_1_1 = '1:1' - field_3_4 = '3:4' - field_9_16 = '9:16' - - -class Duration(int, Enum): - integer_5 = 5 - integer_8 = 8 - - -class Model1(str, Enum): - v3_5 = 'v3.5' - - -class MotionMode(str, Enum): - normal = 'normal' - fast = 'fast' - - -class Quality(str, Enum): - field_360p = '360p' - field_540p = '540p' - field_720p = '720p' - field_1080p = '1080p' - - class Style(str, Enum): - anime = 'anime' - field_3d_animation = '3d_animation' - clay = 'clay' - comic = 'comic' - cyberpunk = 'cyberpunk' + vivid = 'vivid' + natural = 'natural' -class PixverseTextVideoRequest(BaseModel): - aspect_ratio: AspectRatio - duration: Duration - model: Model1 - motion_mode: Optional[MotionMode] = None - negative_prompt: Optional[str] = None - prompt: str - quality: Quality - seed: Optional[int] = None - style: Optional[Style] = None - template_id: Optional[int] = None - water_mark: Optional[bool] = None - - -class Resp(BaseModel): - video_id: Optional[int] = None - - -class PixverseVideoResponse(BaseModel): - ErrCode: Optional[int] = None - ErrMsg: Optional[str] = None - Resp_1: Optional[Resp] = Field(None, alias='Resp') - - -class Resp1(BaseModel): - img_id: Optional[int] = None - - -class PixverseImageUploadResponse(BaseModel): - ErrCode: Optional[int] = None - ErrMsg: Optional[str] = None - Resp: Optional[Resp1] = None - - -class PixverseImageVideoRequest(BaseModel): - img_id: int - model: Model1 - prompt: str - duration: Duration - quality: Quality - motion_mode: Optional[MotionMode] = None - seed: Optional[int] = None - style: Optional[Style] = None - template_id: Optional[int] = None - water_mark: Optional[bool] = None - - -class PixverseTransitionVideoRequest(BaseModel): - first_frame_img: int - last_frame_img: int - model: Model1 - duration: Duration - quality: Quality - motion_mode: MotionMode - seed: int - prompt: str - style: Optional[Style] = None - template_id: Optional[int] = None - water_mark: Optional[bool] = None - - -class Status2(int, Enum): - integer_1 = 1 - integer_5 = 5 - integer_6 = 6 - integer_7 = 7 - integer_8 = 8 - - -class Resp2(BaseModel): - create_time: Optional[str] = None - id: Optional[int] = None - modify_time: Optional[str] = None - negative_prompt: Optional[str] = None - outputHeight: Optional[int] = None - outputWidth: Optional[int] = None - prompt: Optional[str] = None - resolution_ratio: Optional[int] = None - seed: Optional[int] = None - size: Optional[int] = None - status: Optional[Status2] = Field( +class OpenAIImageGenerationRequest(BaseModel): + background: Optional[Background] = Field( + None, description='Background transparency', examples=['opaque'] + ) + model: Optional[str] = Field( + None, description='The model to use for image generation', examples=['dall-e-3'] + ) + moderation: Optional[Moderation] = Field( + None, description='Content moderation setting', examples=['auto'] + ) + n: Optional[int] = Field( None, - description='Video generation status codes:\n* 1 - Generation successful\n* 5 - Generating\n* 6 - Deleted\n* 7 - Contents moderation failed\n* 8 - Generation failed\n', + description='The number of images to generate (1-10). Only 1 supported for dall-e-3.', + examples=[1], ) - style: Optional[str] = None - url: Optional[str] = None - - -class PixverseVideoResultResponse(BaseModel): - ErrCode: Optional[int] = None - ErrMsg: Optional[str] = None - Resp: Optional[Resp2] = None - - -class Image(BaseModel): - bytesBase64Encoded: str - gcsUri: Optional[str] = None - mimeType: Optional[str] = None - - -class Image1(BaseModel): - bytesBase64Encoded: Optional[str] = None - gcsUri: str - mimeType: Optional[str] = None - - -class Instance(BaseModel): - prompt: str = Field(..., description='Text description of the video') - image: Optional[Union[Image, Image1]] = Field( - None, description='Optional image to guide video generation' + output_compression: Optional[int] = Field( + None, description='Compression level for JPEG or WebP (0-100)', examples=[100] ) - - -class PersonGeneration(str, Enum): - ALLOW = 'ALLOW' - BLOCK = 'BLOCK' - - -class Parameters(BaseModel): - aspectRatio: Optional[str] = Field(None, examples=['16:9']) - negativePrompt: Optional[str] = None - personGeneration: Optional[PersonGeneration] = None - sampleCount: Optional[int] = None - seed: Optional[int] = None - storageUri: Optional[str] = Field( - None, description='Optional Cloud Storage URI to upload the video' + output_format: Optional[OutputFormat1] = Field( + None, description='Format of the output image', examples=['png'] ) - durationSeconds: Optional[int] = None - enhancePrompt: Optional[bool] = None - - -class Veo2GenVidRequest(BaseModel): - instances: Optional[List[Instance]] = None - parameters: Optional[Parameters] = None - - -class Veo2GenVidResponse(BaseModel): - name: str = Field( + prompt: str = Field( ..., - description='Operation resource name', - examples=[ - 'projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID/operations/a1b07c8e-7b5a-4aba-bb34-3e1ccb8afcc8' - ], + description='A text description of the desired image', + examples=['Draw a rocket in front of a blackhole in deep space'], ) - - -class Veo2GenVidPollRequest(BaseModel): - operationName: str = Field( - ..., - description='Full operation name (from predict response)', - examples=[ - 'projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID/operations/OPERATION_ID' - ], + quality: Optional[Quality] = Field( + None, description='The quality of the generated image', examples=['high'] ) - - -class Video(BaseModel): - gcsUri: Optional[str] = Field(None, description='Cloud Storage URI of the video') - bytesBase64Encoded: Optional[str] = Field( - None, description='Base64-encoded video content' + response_format: Optional[ResponseFormat] = Field( + None, description='Response format of image data', examples=['b64_json'] ) - mimeType: Optional[str] = Field(None, description='Video MIME type') - - -class Response(BaseModel): - field_type: Optional[str] = Field( + size: Optional[str] = Field( None, - alias='@type', - examples=[ - 'type.googleapis.com/cloud.ai.large_models.vision.GenerateVideoResponse' - ], + description='Size of the image (e.g., 1024x1024, 1536x1024, auto)', + examples=['1024x1536'], ) - raiMediaFilteredCount: Optional[int] = Field( - None, description='Count of media filtered by responsible AI policies' + style: Optional[Style] = Field( + None, description='Style of the image (only for dall-e-3)', examples=['vivid'] ) - raiMediaFilteredReasons: Optional[List[str]] = Field( - None, description='Reasons why media was filtered by responsible AI policies' - ) - videos: Optional[List[Video]] = None - - -class Error1(BaseModel): - code: Optional[int] = Field(None, description='Error code') - message: Optional[str] = Field(None, description='Error message') - - -class Veo2GenVidPollResponse(BaseModel): - name: Optional[str] = None - done: Optional[bool] = None - response: Optional[Response] = Field( - None, description='The actual prediction response if done is true' - ) - error: Optional[Error1] = Field( - None, description='Error details if operation failed' + user: Optional[str] = Field( + None, + description='A unique identifier for end-user monitoring', + examples=['user-1234'], ) -class RunwayImageToVideoResponse(BaseModel): - id: Optional[str] = Field(None, description='Task ID') - - -class RunwayTaskStatusEnum(str, Enum): - SUCCEEDED = 'SUCCEEDED' - RUNNING = 'RUNNING' - FAILED = 'FAILED' - PENDING = 'PENDING' - CANCELLED = 'CANCELLED' - THROTTLED = 'THROTTLED' - - -class RunwayModelEnum(str, Enum): - gen4_turbo = 'gen4_turbo' - gen3a_turbo = 'gen3a_turbo' - - -class Position(str, Enum): - first = 'first' - last = 'last' - - -class RunwayPromptImageDetailedObject(BaseModel): - uri: str = Field( - ..., description='A HTTPS URL or data URI containing an encoded image.' - ) - position: Position = Field( - ..., - description="The position of the image in the output video. 'last' is currently supported for gen3a_turbo only.", - ) - - -class RunwayDurationEnum(int, Enum): - integer_5 = 5 - integer_10 = 10 - - -class RunwayAspectRatioEnum(str, Enum): - field_1280_720 = '1280:720' - field_720_1280 = '720:1280' - field_1104_832 = '1104:832' - field_832_1104 = '832:1104' - field_960_960 = '960:960' - field_1584_672 = '1584:672' - field_1280_768 = '1280:768' - field_768_1280 = '768:1280' - - -class RunwayPromptImageObject( - RootModel[Union[str, List[RunwayPromptImageDetailedObject]]] -): - root: Union[str, List[RunwayPromptImageDetailedObject]] = Field( - ..., - description='Image(s) to use for the video generation. Can be a single URI or an array of image objects with positions.', - ) - - -class Datum3(BaseModel): +class Datum2(BaseModel): b64_json: Optional[str] = Field(None, description='Base64 encoded image data') - url: Optional[str] = Field(None, description='URL of the image') revised_prompt: Optional[str] = Field(None, description='Revised prompt') + url: Optional[str] = Field(None, description='URL of the image') class InputTokensDetails(BaseModel): - text_tokens: Optional[int] = None image_tokens: Optional[int] = None + text_tokens: Optional[int] = None class Usage(BaseModel): @@ -1987,143 +1492,204 @@ class Usage(BaseModel): class OpenAIImageGenerationResponse(BaseModel): - data: Optional[List[Datum3]] = None + data: Optional[List[Datum2]] = None usage: Optional[Usage] = None -class Quality3(str, Enum): - low = 'low' - medium = 'medium' - high = 'high' - standard = 'standard' - hd = 'hd' +class OpenAIModels(str, Enum): + gpt_4 = 'gpt-4' + gpt_4_0314 = 'gpt-4-0314' + gpt_4_0613 = 'gpt-4-0613' + gpt_4_32k = 'gpt-4-32k' + gpt_4_32k_0314 = 'gpt-4-32k-0314' + gpt_4_32k_0613 = 'gpt-4-32k-0613' + gpt_4_0125_preview = 'gpt-4-0125-preview' + gpt_4_turbo = 'gpt-4-turbo' + gpt_4_turbo_2024_04_09 = 'gpt-4-turbo-2024-04-09' + gpt_4_turbo_preview = 'gpt-4-turbo-preview' + gpt_4_1106_preview = 'gpt-4-1106-preview' + gpt_4_vision_preview = 'gpt-4-vision-preview' + gpt_3_5_turbo = 'gpt-3.5-turbo' + gpt_3_5_turbo_16k = 'gpt-3.5-turbo-16k' + gpt_3_5_turbo_0301 = 'gpt-3.5-turbo-0301' + gpt_3_5_turbo_0613 = 'gpt-3.5-turbo-0613' + gpt_3_5_turbo_1106 = 'gpt-3.5-turbo-1106' + gpt_3_5_turbo_0125 = 'gpt-3.5-turbo-0125' + gpt_3_5_turbo_16k_0613 = 'gpt-3.5-turbo-16k-0613' + gpt_4_1 = 'gpt-4.1' + gpt_4_1_mini = 'gpt-4.1-mini' + gpt_4_1_nano = 'gpt-4.1-nano' + gpt_4_1_2025_04_14 = 'gpt-4.1-2025-04-14' + gpt_4_1_mini_2025_04_14 = 'gpt-4.1-mini-2025-04-14' + gpt_4_1_nano_2025_04_14 = 'gpt-4.1-nano-2025-04-14' + o1 = 'o1' + o1_mini = 'o1-mini' + o1_preview = 'o1-preview' + o1_pro = 'o1-pro' + o1_2024_12_17 = 'o1-2024-12-17' + o1_preview_2024_09_12 = 'o1-preview-2024-09-12' + o1_mini_2024_09_12 = 'o1-mini-2024-09-12' + o1_pro_2025_03_19 = 'o1-pro-2025-03-19' + o3 = 'o3' + o3_mini = 'o3-mini' + o3_2025_04_16 = 'o3-2025-04-16' + o3_mini_2025_01_31 = 'o3-mini-2025-01-31' + o4_mini = 'o4-mini' + o4_mini_2025_04_16 = 'o4-mini-2025-04-16' + gpt_4o = 'gpt-4o' + gpt_4o_mini = 'gpt-4o-mini' + gpt_4o_2024_11_20 = 'gpt-4o-2024-11-20' + gpt_4o_2024_08_06 = 'gpt-4o-2024-08-06' + gpt_4o_2024_05_13 = 'gpt-4o-2024-05-13' + gpt_4o_mini_2024_07_18 = 'gpt-4o-mini-2024-07-18' + gpt_4o_audio_preview = 'gpt-4o-audio-preview' + gpt_4o_audio_preview_2024_10_01 = 'gpt-4o-audio-preview-2024-10-01' + gpt_4o_audio_preview_2024_12_17 = 'gpt-4o-audio-preview-2024-12-17' + gpt_4o_mini_audio_preview = 'gpt-4o-mini-audio-preview' + gpt_4o_mini_audio_preview_2024_12_17 = 'gpt-4o-mini-audio-preview-2024-12-17' + gpt_4o_search_preview = 'gpt-4o-search-preview' + gpt_4o_mini_search_preview = 'gpt-4o-mini-search-preview' + gpt_4o_search_preview_2025_03_11 = 'gpt-4o-search-preview-2025-03-11' + gpt_4o_mini_search_preview_2025_03_11 = 'gpt-4o-mini-search-preview-2025-03-11' + computer_use_preview = 'computer-use-preview' + computer_use_preview_2025_03_11 = 'computer-use-preview-2025-03-11' + chatgpt_4o_latest = 'chatgpt-4o-latest' -class OutputFormat1(str, Enum): - png = 'png' - webp = 'webp' - jpeg = 'jpeg' +class Reason(str, Enum): + max_output_tokens = 'max_output_tokens' + content_filter = 'content_filter' -class Moderation(str, Enum): - low = 'low' - auto = 'auto' - - -class Background(str, Enum): - transparent = 'transparent' - opaque = 'opaque' - - -class ResponseFormat(str, Enum): - url = 'url' - b64_json = 'b64_json' - - -class Style3(str, Enum): - vivid = 'vivid' - natural = 'natural' - - -class OpenAIImageGenerationRequest(BaseModel): - model: Optional[str] = Field( - None, description='The model to use for image generation', examples=['dall-e-3'] +class IncompleteDetails(BaseModel): + reason: Optional[Reason] = Field( + None, description='The reason why the response is incomplete.' ) - prompt: str = Field( + + +class Object(str, Enum): + response = 'response' + + +class Status6(str, Enum): + completed = 'completed' + failed = 'failed' + in_progress = 'in_progress' + incomplete = 'incomplete' + + +class Type13(str, Enum): + output_audio = 'output_audio' + + +class OutputAudioContent(BaseModel): + data: str = Field(..., description='Base64-encoded audio data') + transcript: str = Field(..., description='Transcript of the audio') + type: Type13 = Field(..., description='The type of output content') + + +class Role4(str, Enum): + assistant = 'assistant' + + +class Type14(str, Enum): + message = 'message' + + +class Type15(str, Enum): + output_text = 'output_text' + + +class OutputTextContent(BaseModel): + text: str = Field(..., description='The text content') + type: Type15 = Field(..., description='The type of output content') + + +class AspectRatio1(RootModel[float]): + root: float = Field( ..., - description='A text description of the desired image', - examples=['Draw a rocket in front of a blackhole in deep space'], - ) - n: Optional[int] = Field( - None, - description='The number of images to generate (1-10). Only 1 supported for dall-e-3.', - examples=[1], - ) - quality: Optional[Quality3] = Field( - None, description='The quality of the generated image', examples=['high'] - ) - size: Optional[str] = Field( - None, - description='Size of the image (e.g., 1024x1024, 1536x1024, auto)', - examples=['1024x1536'], - ) - output_format: Optional[OutputFormat1] = Field( - None, description='Format of the output image', examples=['png'] - ) - output_compression: Optional[int] = Field( - None, description='Compression level for JPEG or WebP (0-100)', examples=[100] - ) - moderation: Optional[Moderation] = Field( - None, description='Content moderation setting', examples=['auto'] - ) - background: Optional[Background] = Field( - None, description='Background transparency', examples=['opaque'] - ) - response_format: Optional[ResponseFormat] = Field( - None, description='Response format of image data', examples=['b64_json'] - ) - style: Optional[Style3] = Field( - None, description='Style of the image (only for dall-e-3)', examples=['vivid'] - ) - user: Optional[str] = Field( - None, - description='A unique identifier for end-user monitoring', - examples=['user-1234'], + description='Aspect ratio (width / height)', + ge=0.4, + le=2.5, + title='Aspectratio', ) -class OpenAIImageEditRequest(BaseModel): - model: str = Field( - ..., description='The model to use for image editing', examples=['gpt-image-1'] - ) - prompt: str = Field( - ..., - description='A text description of the desired edit', - examples=['Give the rocketship rainbow coloring'], - ) - n: Optional[int] = Field( - None, description='The number of images to generate', examples=[1] - ) - quality: Optional[str] = Field( - None, description='The quality of the edited image', examples=['low'] - ) - size: Optional[str] = Field( - None, description='Size of the output image', examples=['1024x1024'] - ) - output_format: Optional[OutputFormat1] = Field( - None, description='Format of the output image', examples=['png'] - ) - output_compression: Optional[int] = Field( - None, description='Compression level for JPEG or WebP (0-100)', examples=[100] - ) - moderation: Optional[Moderation] = Field( - None, description='Content moderation setting', examples=['auto'] - ) - background: Optional[str] = Field( - None, description='Background transparency', examples=['opaque'] - ) - user: Optional[str] = Field( - None, - description='A unique identifier for end-user monitoring', - examples=['user-1234'], - ) +class IngredientsMode(str, Enum): + creative = 'creative' + precise = 'precise' -class CustomerStorageResourceResponse(BaseModel): - download_url: Optional[str] = Field( +class PikaBodyGenerate22C2vGenerate22PikascenesPost(BaseModel): + aspectRatio: Optional[AspectRatio1] = Field( + None, description='Aspect ratio (width / height)', title='Aspectratio' + ) + duration: Optional[int] = Field(5, title='Duration') + images: Optional[List[StrictBytes]] = Field(None, title='Images') + ingredientsMode: IngredientsMode = Field(..., title='Ingredientsmode') + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + promptText: Optional[str] = Field(None, title='Prompttext') + resolution: Optional[str] = Field('1080p', title='Resolution') + seed: Optional[int] = Field(None, title='Seed') + + +class PikaBodyGeneratePikadditionsGeneratePikadditionsPost(BaseModel): + image: Optional[StrictBytes] = Field(None, title='Image') + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + promptText: Optional[str] = Field(None, title='Prompttext') + seed: Optional[int] = Field(None, title='Seed') + video: Optional[StrictBytes] = Field(None, title='Video') + + +class PikaBodyGeneratePikaswapsGeneratePikaswapsPost(BaseModel): + image: Optional[StrictBytes] = Field(None, title='Image') + modifyRegionMask: Optional[StrictBytes] = Field( None, - description='The signed URL to use for downloading the file from the specified path', + description='A mask image that specifies the region to modify, where the mask is white and the background is black', + title='Modifyregionmask', ) - upload_url: Optional[str] = Field( + modifyRegionRoi: Optional[str] = Field( None, - description='The signed URL to use for uploading the file to the specified path', - ) - expires_at: Optional[datetime] = Field( - None, description='When the signed URL will expire' - ) - existing_file: Optional[bool] = Field( - None, description='Whether an existing file with the same hash was found' + description='Plaintext description of the object / region to modify', + title='Modifyregionroi', ) + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + promptText: Optional[str] = Field(None, title='Prompttext') + seed: Optional[int] = Field(None, title='Seed') + video: Optional[StrictBytes] = Field(None, title='Video') + + +class PikaDurationEnum(int, Enum): + integer_5 = 5 + integer_10 = 10 + + +class PikaGenerateResponse(BaseModel): + video_id: str = Field(..., title='Video Id') + + +class PikaResolutionEnum(str, Enum): + field_1080p = '1080p' + field_720p = '720p' + + +class PikaStatusEnum(str, Enum): + queued = 'queued' + started = 'started' + finished = 'finished' + + +class PikaValidationError(BaseModel): + loc: List[Union[str, int]] = Field(..., title='Location') + msg: str = Field(..., title='Message') + type: str = Field(..., title='Error Type') + + +class PikaVideoResponse(BaseModel): + id: str = Field(..., title='Id') + progress: Optional[int] = Field(None, title='Progress') + status: PikaStatusEnum + url: Optional[str] = Field(None, title='Url') class Pikaffect(str, Enum): @@ -2145,92 +1711,135 @@ class Pikaffect(str, Enum): Tear = 'Tear' -class PikaBodyGeneratePikaffectsGeneratePikaffectsPost(BaseModel): - image: Optional[StrictBytes] = Field(None, title='Image') - pikaffect: Optional[Pikaffect] = Field(None, title='Pikaffect') - promptText: Optional[str] = Field(None, title='Prompttext') - negativePrompt: Optional[str] = Field(None, title='Negativeprompt') - seed: Optional[int] = Field(None, title='Seed') +class Resp(BaseModel): + img_id: Optional[int] = None -class PikaGenerateResponse(BaseModel): - video_id: str = Field(..., title='Video Id') +class PixverseImageUploadResponse(BaseModel): + ErrCode: Optional[int] = None + ErrMsg: Optional[str] = None + Resp_1: Optional[Resp] = Field(None, alias='Resp') -class PikaBodyGeneratePikadditionsGeneratePikadditionsPost(BaseModel): - video: Optional[StrictBytes] = Field(None, title='Video') - image: Optional[StrictBytes] = Field(None, title='Image') - promptText: Optional[str] = Field(None, title='Prompttext') - negativePrompt: Optional[str] = Field(None, title='Negativeprompt') - seed: Optional[int] = Field(None, title='Seed') - - -class PikaBodyGeneratePikaswapsGeneratePikaswapsPost(BaseModel): - video: Optional[StrictBytes] = Field(None, title='Video') - image: Optional[StrictBytes] = Field(None, title='Image') - promptText: Optional[str] = Field(None, title='Prompttext') - modifyRegionMask: Optional[StrictBytes] = Field( - None, - description='A mask image that specifies the region to modify, where the mask is white and the background is black', - title='Modifyregionmask', - ) - modifyRegionRoi: Optional[str] = Field( - None, - description='Plaintext description of the object / region to modify', - title='Modifyregionroi', - ) - negativePrompt: Optional[str] = Field(None, title='Negativeprompt') - seed: Optional[int] = Field(None, title='Seed') - - -class IngredientsMode(str, Enum): - creative = 'creative' - precise = 'precise' - - -class AspectRatio1(RootModel[float]): - root: float = Field( - ..., - description='Aspect ratio (width / height)', - ge=0.4, - le=2.5, - title='Aspectratio', - ) - - -class PikaBodyGenerate22C2vGenerate22PikascenesPost(BaseModel): - images: Optional[List[StrictBytes]] = Field(None, title='Images') - ingredientsMode: IngredientsMode = Field(..., title='Ingredientsmode') - promptText: Optional[str] = Field(None, title='Prompttext') - negativePrompt: Optional[str] = Field(None, title='Negativeprompt') - seed: Optional[int] = Field(None, title='Seed') - resolution: Optional[str] = Field('1080p', title='Resolution') - duration: Optional[int] = Field(5, title='Duration') - aspectRatio: Optional[AspectRatio1] = Field( - None, description='Aspect ratio (width / height)', title='Aspectratio' - ) - - -class PikaStatusEnum(str, Enum): - queued = 'queued' - started = 'started' - finished = 'finished' - - -class PikaValidationError(BaseModel): - loc: List[Union[str, int]] = Field(..., title='Location') - msg: str = Field(..., title='Message') - type: str = Field(..., title='Error Type') - - -class PikaResolutionEnum(str, Enum): - field_1080p = '1080p' - field_720p = '720p' - - -class PikaDurationEnum(int, Enum): +class Duration(int, Enum): integer_5 = 5 - integer_10 = 10 + integer_8 = 8 + + +class Model1(str, Enum): + v3_5 = 'v3.5' + + +class MotionMode(str, Enum): + normal = 'normal' + fast = 'fast' + + +class Quality1(str, Enum): + field_360p = '360p' + field_540p = '540p' + field_720p = '720p' + field_1080p = '1080p' + + +class Style1(str, Enum): + anime = 'anime' + field_3d_animation = '3d_animation' + clay = 'clay' + comic = 'comic' + cyberpunk = 'cyberpunk' + + +class PixverseImageVideoRequest(BaseModel): + duration: Duration + img_id: int + model: Model1 + motion_mode: Optional[MotionMode] = None + prompt: str + quality: Quality1 + seed: Optional[int] = None + style: Optional[Style1] = None + template_id: Optional[int] = None + water_mark: Optional[bool] = None + + +class AspectRatio2(str, Enum): + field_16_9 = '16:9' + field_4_3 = '4:3' + field_1_1 = '1:1' + field_3_4 = '3:4' + field_9_16 = '9:16' + + +class PixverseTextVideoRequest(BaseModel): + aspect_ratio: AspectRatio2 + duration: Duration + model: Model1 + motion_mode: Optional[MotionMode] = None + negative_prompt: Optional[str] = None + prompt: str + quality: Quality1 + seed: Optional[int] = None + style: Optional[Style1] = None + template_id: Optional[int] = None + water_mark: Optional[bool] = None + + +class PixverseTransitionVideoRequest(BaseModel): + duration: Duration + first_frame_img: int + last_frame_img: int + model: Model1 + motion_mode: MotionMode + prompt: str + quality: Quality1 + seed: int + style: Optional[Style1] = None + template_id: Optional[int] = None + water_mark: Optional[bool] = None + + +class Resp1(BaseModel): + video_id: Optional[int] = None + + +class PixverseVideoResponse(BaseModel): + ErrCode: Optional[int] = None + ErrMsg: Optional[str] = None + Resp: Optional[Resp1] = None + + +class Status7(int, Enum): + integer_1 = 1 + integer_5 = 5 + integer_6 = 6 + integer_7 = 7 + integer_8 = 8 + + +class Resp2(BaseModel): + create_time: Optional[str] = None + id: Optional[int] = None + modify_time: Optional[str] = None + negative_prompt: Optional[str] = None + outputHeight: Optional[int] = None + outputWidth: Optional[int] = None + prompt: Optional[str] = None + resolution_ratio: Optional[int] = None + seed: Optional[int] = None + size: Optional[int] = None + status: Optional[Status7] = Field( + None, + description='Video generation status codes:\n* 1 - Generation successful\n* 5 - Generating\n* 6 - Deleted\n* 7 - Contents moderation failed\n* 8 - Generation failed\n', + ) + style: Optional[str] = None + url: Optional[str] = None + + +class PixverseVideoResultResponse(BaseModel): + ErrCode: Optional[int] = None + ErrMsg: Optional[str] = None + Resp: Optional[Resp2] = None class RgbItem(RootModel[int]): @@ -2241,213 +1850,364 @@ class RGBColor(BaseModel): rgb: List[RgbItem] = Field(..., max_length=3, min_length=3) -class StabilityStabilityClientID(RootModel[str]): - root: str = Field( +class GenerateSummary(str, Enum): + auto = 'auto' + concise = 'concise' + detailed = 'detailed' + + +class Summary(str, Enum): + auto = 'auto' + concise = 'concise' + detailed = 'detailed' + + +class ReasoningEffort(str, Enum): + low = 'low' + medium = 'medium' + high = 'high' + + +class Status8(str, Enum): + in_progress = 'in_progress' + completed = 'completed' + incomplete = 'incomplete' + + +class Type16(str, Enum): + summary_text = 'summary_text' + + +class SummaryItem(BaseModel): + text: str = Field( ..., - description='The name of your application, used to help us communicate app-specific debugging or moderation issues to you.', - examples=['my-awesome-app'], - max_length=256, + description='A short summary of the reasoning used by the model when generating\nthe response.\n', + ) + type: Type16 = Field( + ..., description='The type of the object. Always `summary_text`.\n' ) -class StabilityStabilityClientUserID(RootModel[str]): - root: str = Field( - ..., - description='A unique identifier for your end user. Used to help us communicate user-specific debugging or moderation issues to you. Feel free to obfuscate this value to protect user privacy.', - examples=['DiscordUser#9999'], - max_length=256, - ) +class Type17(str, Enum): + reasoning = 'reasoning' -class StabilityStabilityClientVersion(RootModel[str]): - root: str = Field( - ..., - description='The version of your application, used to help us communicate version-specific debugging or moderation issues to you.', - examples=['1.2.1'], - max_length=256, - ) - - -class Name(str, Enum): - content_moderation = 'content_moderation' - - -class StabilityContentModerationResponse(BaseModel): +class ReasoningItem(BaseModel): id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new) you file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, + ..., description='The unique identifier of the reasoning content.\n' ) - name: Name = Field( - ..., - description='Our content moderation system has flagged some part of your request and subsequently denied it. You were not charged for this request. While this may at times be frustrating, it is necessary to maintain the integrity of our platform and ensure a safe experience for all users. If you would like to provide feedback, please use the [Support Form](https://kb.stability.ai/knowledge-base/kb-tickets/new).', + status: Optional[Status8] = Field( + None, + description='The status of the item. One of `in_progress`, `completed`, or\n`incomplete`. Populated when items are returned via API.\n', ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, + summary: List[SummaryItem] = Field(..., description='Reasoning text contents.\n') + type: Type17 = Field( + ..., description='The type of the object. Always `reasoning`.\n' ) +class Controls(BaseModel): + artistic_level: Optional[int] = Field( + None, + description='Defines artistic tone of your image. At a simple level, the person looks straight at the camera in a static and clean style. Dynamic and eccentric levels introduce movement and creativity.', + ge=0, + le=5, + ) + background_color: Optional[RGBColor] = None + colors: Optional[List[RGBColor]] = Field( + None, description='An array of preferable colors' + ) + no_text: Optional[bool] = Field(None, description='Do not embed text layouts') + + +class RecraftImageGenerationRequest(BaseModel): + controls: Optional[Controls] = Field( + None, description='The controls for the generated image' + ) + model: str = Field( + ..., description='The model to use for generation (e.g., "recraftv3")' + ) + n: int = Field(..., description='The number of images to generate', ge=1, le=4) + prompt: str = Field( + ..., description='The text prompt describing the image to generate' + ) + size: str = Field( + ..., description='The size of the generated image (e.g., "1024x1024")' + ) + style: Optional[str] = Field( + None, + description='The style to apply to the generated image (e.g., "digital_illustration")', + ) + style_id: Optional[str] = Field( + None, + description='The style ID to apply to the generated image (e.g., "123e4567-e89b-12d3-a456-426614174000"). If style_id is provided, style should not be provided.', + ) + + +class Datum3(BaseModel): + image_id: Optional[str] = Field( + None, description='Unique identifier for the generated image' + ) + url: Optional[str] = Field(None, description='URL to access the generated image') + + +class RecraftImageGenerationResponse(BaseModel): + created: int = Field( + ..., description='Unix timestamp when the generation was created' + ) + credits: int = Field(..., description='Number of credits used for the generation') + data: List[Datum3] = Field(..., description='Array of generated image information') + + class RenderingSpeed(str, Enum): BALANCED = 'BALANCED' TURBO = 'TURBO' QUALITY = 'QUALITY' -class StabilityCreativity(RootModel[float]): - root: float = Field( +class ResponseErrorCode(str, Enum): + server_error = 'server_error' + rate_limit_exceeded = 'rate_limit_exceeded' + invalid_prompt = 'invalid_prompt' + vector_store_timeout = 'vector_store_timeout' + invalid_image = 'invalid_image' + invalid_image_format = 'invalid_image_format' + invalid_base64_image = 'invalid_base64_image' + invalid_image_url = 'invalid_image_url' + image_too_large = 'image_too_large' + image_too_small = 'image_too_small' + image_parse_error = 'image_parse_error' + image_content_policy_violation = 'image_content_policy_violation' + invalid_image_mode = 'invalid_image_mode' + image_file_too_large = 'image_file_too_large' + unsupported_image_media_type = 'unsupported_image_media_type' + empty_image_file = 'empty_image_file' + failed_to_download_image = 'failed_to_download_image' + image_file_not_found = 'image_file_not_found' + + +class Type18(str, Enum): + json_object = 'json_object' + + +class ResponseFormatJsonObject(BaseModel): + type: Type18 = Field( ..., - description='Controls the likelihood of creating additional details not heavily conditioned by the init image.', - ge=0.2, - le=0.5, + description='The type of response format being defined. Always `json_object`.', ) -class StabilityGenerationID(RootModel[str]): - root: str = Field( +class ResponseFormatJsonSchemaSchema(BaseModel): + pass + model_config = ConfigDict( + extra='allow', + ) + + +class Type19(str, Enum): + text = 'text' + + +class ResponseFormatText(BaseModel): + type: Type19 = Field( + ..., description='The type of response format being defined. Always `text`.' + ) + + +class Truncation1(str, Enum): + auto = 'auto' + disabled = 'disabled' + + +class InputTokensDetails1(BaseModel): + cached_tokens: int = Field( ..., - description='The `id` of a generation, typically used for async generations, that can be used to check the status of the generation or retrieve the result.', - examples=['a6dc6c6e20acda010fe14d71f180658f2896ed9b4ec25aa99a6ff06c796987c4'], - max_length=64, - min_length=64, + description='The number of tokens that were retrieved from the cache. \n[More on prompt caching](/docs/guides/prompt-caching).\n', ) -class Mode(str, Enum): - text_to_image = 'text-to-image' - image_to_image = 'image-to-image' +class OutputTokensDetails(BaseModel): + reasoning_tokens: int = Field(..., description='The number of reasoning tokens.') -class AspectRatio2(str, Enum): - field_21_9 = '21:9' - field_16_9 = '16:9' - field_3_2 = '3:2' - field_5_4 = '5:4' - field_1_1 = '1:1' - field_4_5 = '4:5' - field_2_3 = '2:3' - field_9_16 = '9:16' - field_9_21 = '9:21' +class ResponseUsage(BaseModel): + input_tokens: int = Field(..., description='The number of input tokens.') + input_tokens_details: InputTokensDetails1 = Field( + ..., description='A detailed breakdown of the input tokens.' + ) + output_tokens: int = Field(..., description='The number of output tokens.') + output_tokens_details: OutputTokensDetails = Field( + ..., description='A detailed breakdown of the output tokens.' + ) + total_tokens: int = Field(..., description='The total number of tokens used.') -class Model4(str, Enum): - sd3_5_large = 'sd3.5-large' - sd3_5_large_turbo = 'sd3.5-large-turbo' - sd3_5_medium = 'sd3.5-medium' +class Rodin3DCheckStatusRequest(BaseModel): + subscription_key: str = Field( + ..., description='subscription from generate endpoint' + ) -class OutputFormat3(str, Enum): - png = 'png' - jpeg = 'jpeg' +class Rodin3DCheckStatusResponse(BaseModel): + pass -class StylePreset(str, Enum): - enhance = 'enhance' - anime = 'anime' - photographic = 'photographic' - digital_art = 'digital-art' - comic_book = 'comic-book' - fantasy_art = 'fantasy-art' - line_art = 'line-art' - analog_film = 'analog-film' - neon_punk = 'neon-punk' - isometric = 'isometric' - low_poly = 'low-poly' - origami = 'origami' - modeling_compound = 'modeling-compound' - cinematic = 'cinematic' - field_3d_model = '3d-model' - pixel_art = 'pixel-art' - tile_texture = 'tile-texture' +class Rodin3DDownloadRequest(BaseModel): + task_uuid: str = Field(..., description='Task UUID') -class StabilityImageGenrationSD3Request(BaseModel): - prompt: str = Field( +class RodinGenerateJobsData(BaseModel): + subscription_key: Optional[str] = Field(None, description='Subscription Key.') + uuids: Optional[List[str]] = Field(None, description='subjobs uuid.') + + +class RodinMaterialType(str, Enum): + PBR = 'PBR' + Shaded = 'Shaded' + + +class RodinMeshModeType(str, Enum): + Quad = 'Quad' + Raw = 'Raw' + + +class RodinQualityType(str, Enum): + extra_low = 'extra-low' + low = 'low' + medium = 'medium' + high = 'high' + + +class RodinResourceItem(BaseModel): + name: Optional[str] = Field(None, description='File name') + url: Optional[str] = Field(None, description='Download url') + + +class RodinTierType(str, Enum): + Regular = 'Regular' + Sketch = 'Sketch' + Detail = 'Detail' + Smooth = 'Smooth' + + +class RunwayAspectRatioEnum(str, Enum): + field_1280_720 = '1280:720' + field_720_1280 = '720:1280' + field_1104_832 = '1104:832' + field_832_1104 = '832:1104' + field_960_960 = '960:960' + field_1584_672 = '1584:672' + field_1280_768 = '1280:768' + field_768_1280 = '768:1280' + + +class RunwayDurationEnum(int, Enum): + integer_5 = 5 + integer_10 = 10 + + +class RunwayImageToVideoResponse(BaseModel): + id: Optional[str] = Field(None, description='Task ID') + + +class RunwayModelEnum(str, Enum): + gen4_turbo = 'gen4_turbo' + gen3a_turbo = 'gen3a_turbo' + + +class Position(str, Enum): + first = 'first' + last = 'last' + + +class RunwayPromptImageDetailedObject(BaseModel): + position: Position = Field( ..., - description='What you wish to see in the output image. A strong, descriptive prompt that clearly defines\nelements, colors, and subjects will lead to better results.', - max_length=10000, - min_length=1, + description="The position of the image in the output video. 'last' is currently supported for gen3a_turbo only.", ) - mode: Optional[Mode] = Field( - 'text-to-image', - description='Controls whether this is a text-to-image or image-to-image generation, which affects which parameters are required:\n- **text-to-image** requires only the `prompt` parameter\n- **image-to-image** requires the `prompt`, `image`, and `strength` parameters', - title='GenerationMode', + uri: str = Field( + ..., description='A HTTPS URL or data URI containing an encoded image.' ) - image: Optional[StrictBytes] = Field( + + +class RunwayPromptImageObject( + RootModel[Union[str, List[RunwayPromptImageDetailedObject]]] +): + root: Union[str, List[RunwayPromptImageDetailedObject]] = Field( + ..., + description='Image(s) to use for the video generation. Can be a single URI or an array of image objects with positions.', + ) + + +class RunwayTaskStatusEnum(str, Enum): + SUCCEEDED = 'SUCCEEDED' + RUNNING = 'RUNNING' + FAILED = 'FAILED' + PENDING = 'PENDING' + CANCELLED = 'CANCELLED' + THROTTLED = 'THROTTLED' + + +class RunwayTaskStatusResponse(BaseModel): + createdAt: datetime = Field(..., description='Task creation timestamp') + id: str = Field(..., description='Task ID') + output: Optional[List[str]] = Field(None, description='Array of output video URLs') + progress: Optional[float] = Field( None, - description='The image to use as the starting point for the generation.\n\nSupported formats:\n\n\n\n - jpeg\n - png\n - webp\n\nSupported dimensions:\n\n\n\n - Every side must be at least 64 pixels\n\n> **Important:** This parameter is only valid for **image-to-image** requests.', - ) - strength: Optional[float] = Field( - None, - description='Sometimes referred to as _denoising_, this parameter controls how much influence the\n`image` parameter has on the generated image. A value of 0 would yield an image that\nis identical to the input. A value of 1 would be as if you passed in no image at all.\n\n> **Important:** This parameter is only valid for **image-to-image** requests.', + description='Float value between 0 and 1 representing the progress of the task. Only available if status is RUNNING.', ge=0.0, le=1.0, ) - aspect_ratio: Optional[AspectRatio2] = Field( - '1:1', - description='Controls the aspect ratio of the generated image. Defaults to 1:1.\n\n> **Important:** This parameter is only valid for **text-to-image** requests.', - ) - model: Optional[Model4] = Field( - 'sd3.5-large', - description='The model to use for generation.\n\n- `sd3.5-large` requires 6.5 credits per generation\n- `sd3.5-large-turbo` requires 4 credits per generation\n- `sd3.5-medium` requires 3.5 credits per generation\n- As of the April 17, 2025, `sd3-large`, `sd3-large-turbo` and `sd3-medium`\n\n\n\n are re-routed to their `sd3.5-[model version]` equivalent, at the same price.', - ) - seed: Optional[float] = Field( - 0, - description="A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.)", - ge=0.0, - le=4294967294.0, - ) - output_format: Optional[OutputFormat3] = Field( - 'png', description='Dictates the `content-type` of the generated image.' - ) - style_preset: Optional[StylePreset] = Field( - None, description='Guides the image model towards a particular style.' - ) - negative_prompt: Optional[str] = Field( - None, - description='Keywords of what you **do not** wish to see in the output image.\nThis is an advanced feature.', - max_length=10000, - ) - cfg_scale: Optional[float] = Field( - None, - description='How strictly the diffusion process adheres to the prompt text (higher values keep your image closer to your prompt). The _Large_ and _Medium_ models use a default of `4`. The _Turbo_ model uses a default of `1`.', - ge=1.0, - le=10.0, + status: RunwayTaskStatusEnum + + +class RunwayTextToImageAspectRatioEnum(str, Enum): + field_1920_1080 = '1920:1080' + field_1080_1920 = '1080:1920' + field_1024_1024 = '1024:1024' + field_1360_768 = '1360:768' + field_1080_1080 = '1080:1080' + field_1168_880 = '1168:880' + field_1440_1080 = '1440:1080' + field_1080_1440 = '1080:1440' + field_1808_768 = '1808:768' + field_2112_912 = '2112:912' + +class Model4(str, Enum): + gen4_image = 'gen4_image' + + +class ReferenceImage(BaseModel): + uri: Optional[str] = Field( + None, description='A HTTPS URL or data URI containing an encoded image' ) -class FinishReason(str, Enum): - SUCCESS = 'SUCCESS' - CONTENT_FILTERED = 'CONTENT_FILTERED' +class RunwayTextToImageRequest(BaseModel): + model: Model4 = Field(..., description='Model to use for generation') + promptText: str = Field( + ..., description='Text prompt for the image generation', max_length=1000 + ) + ratio: RunwayTextToImageAspectRatioEnum + referenceImages: Optional[List[ReferenceImage]] = Field( + None, description='Array of reference images to guide the generation' + ) -class StabilityImageGenrationSD3Response200(BaseModel): - image: str = Field( +class RunwayTextToImageResponse(BaseModel): + id: Optional[str] = Field(None, description='Task ID') + + +class StabilityError(BaseModel): + errors: List[str] = Field( ..., - description='The generated image, encoded to base64.', - examples=['AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1...'], + description='One or more error messages indicating what went wrong.', + examples=[[{'some-field': 'is required'}]], + min_length=1, ) - seed: Optional[float] = Field( - 0, - description='The seed used as random noise for this generation.', - examples=[343940597], - ge=0.0, - le=4294967294.0, - ) - finish_reason: FinishReason = Field( - ..., - description='The reason the generation finished.\n\n- `SUCCESS` = successful generation.\n- `CONTENT_FILTERED` = successful generation, however the output violated our content moderation\npolicy and has been blurred as a result.', - examples=['SUCCESS'], - ) - - -class StabilityImageGenrationSD3Response400(BaseModel): id: str = Field( ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', + description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new) you file, as it will greatly assist us in diagnosing the root cause of the problem.\n', examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], min_length=1, ) @@ -2457,704 +2217,501 @@ class StabilityImageGenrationSD3Response400(BaseModel): examples=['bad_request'], min_length=1, ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) -class StabilityImageGenrationSD3Response413(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) +class Status9(str, Enum): + in_progress = 'in-progress' -class StabilityImageGenrationSD3Response422(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationSD3Response429(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationSD3Response500(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class OutputFormat4(str, Enum): - jpeg = 'jpeg' - png = 'png' - webp = 'webp' - - -class StabilityImageGenrationUpscaleConservativeRequest(BaseModel): - image: StrictBytes = Field( - ..., - description='The image you wish to upscale.\n\nSupported Formats:\n- jpeg\n- png\n- webp\n\nValidation Rules:\n- Every side must be at least 64 pixels\n- Total pixel count must be between 4,096 and 9,437,184 pixels\n- The aspect ratio must be between 1:2.5 and 2.5:1', - examples=['./some/image.png'], - ) - prompt: str = Field( - ..., - description="What you wish to see in the output image. A strong, descriptive prompt that clearly defines\nelements, colors, and subjects will lead to better results.\n\nTo control the weight of a given word use the format `(word:weight)`,\nwhere `word` is the word you'd like to control the weight of and `weight`\nis a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)`\nwould convey a sky that was blue and green, but more green than blue.", - max_length=10000, - min_length=1, - ) - negative_prompt: Optional[str] = Field( - None, - description='A blurb of text describing what you **do not** wish to see in the output image.\nThis is an advanced feature.', - max_length=10000, - ) - seed: Optional[float] = Field( - 0, - description="A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.)", - ge=0.0, - le=4294967294.0, - ) - output_format: Optional[OutputFormat4] = Field( - 'png', description='Dictates the `content-type` of the generated image.' - ) - creativity: Optional[StabilityCreativity] = Field( - default_factory=lambda: StabilityCreativity.model_validate(0.35) - ) - - -class StabilityImageGenrationUpscaleConservativeResponse200(BaseModel): - image: str = Field( - ..., - description='The generated image, encoded to base64.', - examples=['AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1...'], - ) - seed: Optional[float] = Field( - 0, - description='The seed used as random noise for this generation.', - examples=[343940597], - ge=0.0, - le=4294967294.0, - ) - finish_reason: FinishReason = Field( - ..., - description='The reason the generation finished.\n\n- `SUCCESS` = successful generation.\n- `CONTENT_FILTERED` = successful generation, however the output violated our content moderation\npolicy and has been blurred as a result.', - examples=['SUCCESS'], - ) - - -class StabilityImageGenrationUpscaleConservativeResponse400(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleConservativeResponse413(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleConservativeResponse422(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleConservativeResponse429(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleConservativeResponse500(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleCreativeRequest(BaseModel): - image: StrictBytes = Field( - ..., - description='The image you wish to upscale.\n\nSupported Formats:\n- jpeg\n- png\n- webp\n\nValidation Rules:\n- Every side must be at least 64 pixels\n- Total pixel count must be between 4,096 and 1,048,576 pixels', - examples=['./some/image.png'], - ) - prompt: str = Field( - ..., - description="What you wish to see in the output image. A strong, descriptive prompt that clearly defines\nelements, colors, and subjects will lead to better results.\n\nTo control the weight of a given word use the format `(word:weight)`,\nwhere `word` is the word you'd like to control the weight of and `weight`\nis a value between 0 and 1. For example: `The sky was a crisp (blue:0.3) and (green:0.8)`\nwould convey a sky that was blue and green, but more green than blue.", - max_length=10000, - min_length=1, - ) - negative_prompt: Optional[str] = Field( - None, - description='A blurb of text describing what you **do not** wish to see in the output image.\nThis is an advanced feature.', - max_length=10000, - ) - output_format: Optional[OutputFormat4] = Field( - 'png', description='Dictates the `content-type` of the generated image.' - ) - seed: Optional[float] = Field( - 0, - description="A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass `0` to use a random seed.)", - ge=0.0, - le=4294967294.0, - ) - creativity: Optional[float] = Field( - 0.3, - description='Indicates how creative the model should be when upscaling an image.\nHigher values will result in more details being added to the image during upscaling.', - ge=0.1, - le=0.5, - ) - style_preset: Optional[StylePreset] = Field( - None, description='Guides the image model towards a particular style.' - ) - - -class StabilityImageGenrationUpscaleCreativeResponse200(BaseModel): - id: StabilityGenerationID - - -class StabilityImageGenrationUpscaleCreativeResponse400(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleCreativeResponse413(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleCreativeResponse422(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleCreativeResponse429(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleCreativeResponse500(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleFastRequest(BaseModel): - image: StrictBytes = Field( - ..., - description='The image you wish to upscale.\n\nSupported Formats:\n- jpeg\n- png\n- webp\n\nValidation Rules:\n- Width must be between 32 and 1,536 pixels\n- Height must be between 32 and 1,536 pixels\n- Total pixel count must be between 1,024 and 1,048,576 pixels', - examples=['./some/image.png'], - ) - output_format: Optional[OutputFormat4] = Field( - 'png', description='Dictates the `content-type` of the generated image.' - ) - - -class StabilityImageGenrationUpscaleFastResponse200(BaseModel): - image: str = Field( - ..., - description='The generated image, encoded to base64.', - examples=['AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1...'], - ) - seed: Optional[float] = Field( - 0, - description='The seed used as random noise for this generation.', - examples=[343940597], - ge=0.0, - le=4294967294.0, - ) - finish_reason: FinishReason = Field( - ..., - description='The reason the generation finished.\n\n- `SUCCESS` = successful generation.\n- `CONTENT_FILTERED` = successful generation, however the output violated our content moderation\npolicy and has been blurred as a result.', - examples=['SUCCESS'], - ) - - -class StabilityImageGenrationUpscaleFastResponse400(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleFastResponse413(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleFastResponse422(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleFastResponse429(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class StabilityImageGenrationUpscaleFastResponse500(BaseModel): - id: str = Field( - ..., - description='A unique identifier associated with this error. Please include this in any [support tickets](https://kb.stability.ai/knowledge-base/kb-tickets/new)\nyou file, as it will greatly assist us in diagnosing the root cause of the problem.', - examples=['a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4'], - min_length=1, - ) - name: str = Field( - ..., - description='Short-hand name for an error, useful for discriminating between errors with the same status code.', - examples=['bad_request'], - min_length=1, - ) - errors: List[str] = Field( - ..., - description='One or more error messages indicating what went wrong.', - examples=[['some-field: is required']], - min_length=1, - ) - - -class ActionJobResult(BaseModel): - id: Optional[UUID] = Field(None, description='Unique identifier for the job result') - workflow_name: Optional[str] = Field(None, description='Name of the workflow') - operating_system: Optional[str] = Field(None, description='Operating system used') - python_version: Optional[str] = Field(None, description='PyTorch version used') - pytorch_version: Optional[str] = Field(None, description='PyTorch version used') - action_run_id: Optional[str] = Field( - None, description='Identifier of the run this result belongs to' - ) - action_job_id: Optional[str] = Field( - None, description='Identifier of the job this result belongs to' - ) - cuda_version: Optional[str] = Field(None, description='CUDA version used') - branch_name: Optional[str] = Field( - None, description='Name of the relevant git branch' - ) - commit_hash: Optional[str] = Field(None, description='The hash of the commit') - commit_id: Optional[str] = Field(None, description='The ID of the commit') - commit_time: Optional[int] = Field( - None, description='The Unix timestamp when the commit was made' - ) - commit_message: Optional[str] = Field(None, description='The message of the commit') - comfy_run_flags: Optional[str] = Field( - None, description='The comfy run flags. E.g. `--low-vram`' - ) - git_repo: Optional[str] = Field(None, description='The repository name') - pr_number: Optional[str] = Field(None, description='The pull request number') - start_time: Optional[int] = Field( - None, description='The start time of the job as a Unix timestamp.' - ) - end_time: Optional[int] = Field( - None, description='The end time of the job as a Unix timestamp.' - ) - avg_vram: Optional[int] = Field( - None, description='The average VRAM used by the job' - ) - peak_vram: Optional[int] = Field(None, description='The peak VRAM used by the job') - job_trigger_user: Optional[str] = Field( - None, description='The user who triggered the job.' - ) - author: Optional[str] = Field(None, description='The author of the commit') - machine_stats: Optional[MachineStats] = None - status: Optional[WorkflowRunStatus] = None - storage_file: Optional[StorageFile] = None - - -class Publisher(BaseModel): - name: Optional[str] = None +class StabilityGetResultResponse202(BaseModel): id: Optional[str] = Field( + None, description='The ID of the generation result.', examples=[1234567890] + ) + status: Optional[Status9] = None + + +class Type20(str, Enum): + json_schema = 'json_schema' + + +class TextResponseFormatJsonSchema(BaseModel): + description: Optional[str] = Field( None, - description="The unique identifier for the publisher. It's akin to a username. Should be lowercase.", + description='A description of what the response format is for, used by the model to\ndetermine how to respond in the format.\n', ) - description: Optional[str] = None - website: Optional[str] = None - support: Optional[str] = None - source_code_repo: Optional[str] = None - logo: Optional[str] = Field(None, description="URL to the publisher's logo.") - createdAt: Optional[datetime] = Field( - None, description='The date and time the publisher was created.' + name: str = Field( + ..., + description='The name of the response format. Must be a-z, A-Z, 0-9, or contain\nunderscores and dashes, with a maximum length of 64.\n', ) - members: Optional[List[PublisherMember]] = Field( - None, description='A list of members in the publisher.' + schema_: ResponseFormatJsonSchemaSchema = Field(..., alias='schema') + strict: Optional[bool] = Field( + False, + description='Whether to enable strict schema adherence when generating the output.\nIf set to true, the model will always follow the exact schema defined\nin the `schema` field. Only a subset of JSON Schema is supported when\n`strict` is `true`. To learn more, read the [Structured Outputs\nguide](/docs/guides/structured-outputs).\n', ) - status: Optional[PublisherStatus] = Field( - None, description='The status of the publisher.' + type: Type20 = Field( + ..., + description='The type of response format being defined. Always `json_schema`.', ) -class NodeVersion(BaseModel): - id: Optional[str] = None - version: Optional[str] = Field( +class Type21(str, Enum): + function = 'function' + + +class ToolChoiceFunction(BaseModel): + name: str = Field(..., description='The name of the function to call.') + type: Type21 = Field( + ..., description='For function calling, the type is always `function`.' + ) + + +class ToolChoiceOptions(str, Enum): + none = 'none' + auto = 'auto' + required = 'required' + + +class Type22(str, Enum): + file_search = 'file_search' + web_search_preview = 'web_search_preview' + computer_use_preview = 'computer_use_preview' + web_search_preview_2025_03_11 = 'web_search_preview_2025_03_11' + + +class ToolChoiceTypes(BaseModel): + type: Type22 = Field( + ..., + description='The type of hosted tool the model should to use. Learn more about\n[built-in tools](/docs/guides/tools).\n\nAllowed values are:\n- `file_search`\n- `web_search_preview`\n- `computer_use_preview`\n', + ) + + +class TripoAnimation(str, Enum): + preset_idle = 'preset:idle' + preset_walk = 'preset:walk' + preset_climb = 'preset:climb' + preset_jump = 'preset:jump' + preset_run = 'preset:run' + preset_slash = 'preset:slash' + preset_shoot = 'preset:shoot' + preset_hurt = 'preset:hurt' + preset_fall = 'preset:fall' + preset_turn = 'preset:turn' + + +class TripoBalance(BaseModel): + balance: float + frozen: float + + +class TripoConvertFormat(str, Enum): + GLTF = 'GLTF' + USDZ = 'USDZ' + FBX = 'FBX' + OBJ = 'OBJ' + STL = 'STL' + field_3MF = '3MF' + + +class Code(int, Enum): + integer_1001 = 1001 + integer_2000 = 2000 + integer_2001 = 2001 + integer_2002 = 2002 + integer_2003 = 2003 + integer_2004 = 2004 + integer_2006 = 2006 + integer_2007 = 2007 + integer_2008 = 2008 + integer_2010 = 2010 + + +class TripoErrorResponse(BaseModel): + code: Code + message: str + suggestion: str + + +class TripoImageToModel(str, Enum): + image_to_model = 'image_to_model' + + +class TripoModelStyle(str, Enum): + person_person2cartoon = 'person:person2cartoon' + animal_venom = 'animal:venom' + object_clay = 'object:clay' + object_steampunk = 'object:steampunk' + object_christmas = 'object:christmas' + object_barbie = 'object:barbie' + gold = 'gold' + ancient_bronze = 'ancient_bronze' + + +class TripoModelVersion(str, Enum): + V2_5 = 'v2.5-20250123' + V2_0 = 'v2.0-20240919' + V1_4 = 'v1.4-20240625' + + +class TripoMultiviewMode(str, Enum): + LEFT = 'LEFT' + RIGHT = 'RIGHT' + + +class TripoMultiviewToModel(str, Enum): + multiview_to_model = 'multiview_to_model' + + +class TripoOrientation(str, Enum): + align_image = 'align_image' + default = 'default' + + +class TripoResponseSuccessCode(RootModel[int]): + root: int = Field( + ..., + description='Standard success code for Tripo API responses. Typically 0 for success.', + examples=[0], + ) + + +class TripoSpec(str, Enum): + mixamo = 'mixamo' + tripo = 'tripo' + + +class TripoStandardFormat(str, Enum): + glb = 'glb' + fbx = 'fbx' + + +class TripoStylizeOptions(str, Enum): + lego = 'lego' + voxel = 'voxel' + voronoi = 'voronoi' + minecraft = 'minecraft' + + +class Code1(int, Enum): + integer_0 = 0 + + +class Data8(BaseModel): + task_id: str = Field(..., description='used for getTask') + + +class TripoSuccessTask(BaseModel): + code: Code1 + data: Data8 + + +class Topology(str, Enum): + bip = 'bip' + quad = 'quad' + + +class Output(BaseModel): + base_model: Optional[str] = None + model: Optional[str] = None + pbr_model: Optional[str] = None + rendered_image: Optional[str] = None + riggable: Optional[bool] = None + topology: Optional[Topology] = None + + +class Status10(str, Enum): + queued = 'queued' + running = 'running' + success = 'success' + failed = 'failed' + cancelled = 'cancelled' + unknown = 'unknown' + banned = 'banned' + expired = 'expired' + + +class TripoTask(BaseModel): + create_time: int + input: Dict[str, Any] + output: Output + progress: int = Field(..., ge=0, le=100) + status: Status10 + task_id: str + type: str + + +class TripoTextToModel(str, Enum): + text_to_model = 'text_to_model' + + +class TripoTextureAlignment(str, Enum): + original_image = 'original_image' + geometry = 'geometry' + + +class TripoTextureFormat(str, Enum): + BMP = 'BMP' + DPX = 'DPX' + HDR = 'HDR' + JPEG = 'JPEG' + OPEN_EXR = 'OPEN_EXR' + PNG = 'PNG' + TARGA = 'TARGA' + TIFF = 'TIFF' + WEBP = 'WEBP' + + +class TripoTextureQuality(str, Enum): + standard = 'standard' + detailed = 'detailed' + + +class TripoTopology(str, Enum): + bip = 'bip' + quad = 'quad' + + +class TripoTypeAnimatePrerigcheck(str, Enum): + animate_prerigcheck = 'animate_prerigcheck' + + +class TripoTypeAnimateRetarget(str, Enum): + animate_retarget = 'animate_retarget' + + +class TripoTypeAnimateRig(str, Enum): + animate_rig = 'animate_rig' + + +class TripoTypeConvertModel(str, Enum): + convert_model = 'convert_model' + + +class TripoTypeRefineModel(str, Enum): + refine_model = 'refine_model' + + +class TripoTypeStylizeModel(str, Enum): + stylize_model = 'stylize_model' + + +class TripoTypeTextureModel(str, Enum): + texture_model = 'texture_model' + + +class Veo2GenVidPollRequest(BaseModel): + operationName: str = Field( + ..., + description='Full operation name (from predict response)', + examples=[ + 'projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID/operations/OPERATION_ID' + ], + ) + + +class Error(BaseModel): + code: Optional[int] = Field(None, description='Error code') + message: Optional[str] = Field(None, description='Error message') + + +class Video(BaseModel): + bytesBase64Encoded: Optional[str] = Field( + None, description='Base64-encoded video content' + ) + gcsUri: Optional[str] = Field(None, description='Cloud Storage URI of the video') + mimeType: Optional[str] = Field(None, description='Video MIME type') + + +class Response(BaseModel): + field_type: Optional[str] = Field( None, - description='The version identifier, following semantic versioning. Must be unique for the node.', + alias='@type', + examples=[ + 'type.googleapis.com/cloud.ai.large_models.vision.GenerateVideoResponse' + ], ) - createdAt: Optional[datetime] = Field( - None, description='The date and time the version was created.' + raiMediaFilteredCount: Optional[int] = Field( + None, description='Count of media filtered by responsible AI policies' ) - changelog: Optional[str] = Field( - None, description='Summary of changes made in this version' + raiMediaFilteredReasons: Optional[List[str]] = Field( + None, description='Reasons why media was filtered by responsible AI policies' ) - dependencies: Optional[List[str]] = Field( - None, description='A list of pip dependencies required by the node.' + videos: Optional[List[Video]] = None + + +class Veo2GenVidPollResponse(BaseModel): + done: Optional[bool] = None + error: Optional[Error] = Field( + None, description='Error details if operation failed' ) - downloadUrl: Optional[str] = Field( - None, description='[Output Only] URL to download this version of the node' - ) - deprecated: Optional[bool] = Field( - None, description='Indicates if this version is deprecated.' - ) - status: Optional[NodeVersionStatus] = Field( - None, description='The status of the node version.' - ) - status_reason: Optional[str] = Field( - None, description='The reason for the status change.' - ) - node_id: Optional[str] = Field( - None, description='The unique identifier of the node.' - ) - comfy_node_extract_status: Optional[str] = Field( - None, description='The status of comfy node extraction process.' + name: Optional[str] = None + response: Optional[Response] = Field( + None, description='The actual prediction response if done is true' ) -class IdeogramV3Request(BaseModel): - prompt: str = Field(..., description='The text prompt for image generation') - seed: Optional[int] = Field( - None, description='Seed value for reproducible generation' +class Image(BaseModel): + bytesBase64Encoded: str + gcsUri: Optional[str] = None + mimeType: Optional[str] = None + + +class Image1(BaseModel): + bytesBase64Encoded: Optional[str] = None + gcsUri: str + mimeType: Optional[str] = None + + +class Instance(BaseModel): + image: Optional[Union[Image, Image1]] = Field( + None, description='Optional image to guide video generation' ) - resolution: Optional[str] = Field( - None, description='Image resolution in format WxH', examples=['1280x800'] + prompt: str = Field(..., description='Text description of the video') + + +class PersonGeneration1(str, Enum): + ALLOW = 'ALLOW' + BLOCK = 'BLOCK' + + +class Parameters(BaseModel): + aspectRatio: Optional[str] = Field(None, examples=['16:9']) + durationSeconds: Optional[int] = None + enhancePrompt: Optional[bool] = None + negativePrompt: Optional[str] = None + personGeneration: Optional[PersonGeneration1] = None + sampleCount: Optional[int] = None + seed: Optional[int] = None + storageUri: Optional[str] = Field( + None, description='Optional Cloud Storage URI to upload the video' ) - aspect_ratio: Optional[str] = Field( - None, description='Aspect ratio in format WxH', examples=['1x3'] + + +class Veo2GenVidRequest(BaseModel): + instances: Optional[List[Instance]] = None + parameters: Optional[Parameters] = None + + +class Veo2GenVidResponse(BaseModel): + name: str = Field( + ..., + description='Operation resource name', + examples=[ + 'projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID/operations/a1b07c8e-7b5a-4aba-bb34-3e1ccb8afcc8' + ], ) - rendering_speed: RenderingSpeed - magic_prompt: Optional[MagicPrompt] = Field( - None, description='Whether to enable magic prompt enhancement' + + +class SearchContextSize(str, Enum): + low = 'low' + medium = 'medium' + high = 'high' + + +class Type23(str, Enum): + web_search_preview = 'web_search_preview' + web_search_preview_2025_03_11 = 'web_search_preview_2025_03_11' + + +class WebSearchPreviewTool(BaseModel): + search_context_size: Optional[SearchContextSize] = Field( + None, + description='High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default.', ) - negative_prompt: Optional[str] = Field( - None, description='Text prompt specifying what to avoid in the generation' + type: Literal['WebSearchPreviewTool'] = Field( + ..., + description='The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`.', ) - num_images: Optional[int] = Field( - None, description='Number of images to generate', ge=1 + + +class Status11(str, Enum): + in_progress = 'in_progress' + searching = 'searching' + completed = 'completed' + failed = 'failed' + + +class Type24(str, Enum): + web_search_call = 'web_search_call' + + +class WebSearchToolCall(BaseModel): + id: str = Field(..., description='The unique ID of the web search tool call.\n') + status: Status11 = Field( + ..., description='The status of the web search tool call.\n' ) - color_palette: Optional[ColorPalette] = None - style_codes: Optional[List[StyleCode]] = Field( - None, description='Array of style codes in hexadecimal format' + type: Type24 = Field( + ..., + description='The type of the web search tool call. Always `web_search_call`.\n', ) - style_type: Optional[StyleType] = Field( - None, description='The type of style to apply' + + +class CreateModelResponseProperties(ModelResponseProperties): + pass + + +class GeminiInlineData(BaseModel): + data: Optional[str] = Field( + None, + description='The base64 encoding of the image, PDF, or video to include inline in the prompt. When including media inline, you must also specify the media type (mimeType) of the data. Size limit: 20MB\n', ) - style_reference_images: Optional[List[str]] = Field( - None, description='Array of reference image URLs or identifiers' + mimeType: Optional[GeminiMimeType] = None + + +class GeminiPart(BaseModel): + inlineData: Optional[GeminiInlineData] = None + text: Optional[str] = Field( + None, + description='A text prompt or code snippet.', + examples=['Write a story about a robot learning to paint'], + ) + + +class GeminiPromptFeedback(BaseModel): + blockReason: Optional[str] = None + blockReasonMessage: Optional[str] = None + safetyRatings: Optional[List[GeminiSafetyRating]] = None + + +class GeminiSafetySetting(BaseModel): + category: GeminiSafetyCategory + threshold: GeminiSafetyThreshold + + +class GeminiSystemInstructionContent(BaseModel): + parts: List[GeminiTextPart] = Field( + ..., + description='A list of ordered parts that make up a single message. Different parts may have different IANA MIME types. For limits on the inputs, such as the maximum number of tokens or the number of images, see the model specifications on the Google models page.\n', + ) + role: Role1 = Field( + ..., + description='The identity of the entity that creates the message. The following values are supported: user: This indicates that the message is sent by a real person, typically a user-generated message. model: This indicates that the message is generated by the model. The model value is used to insert messages from the model into the conversation during multi-turn conversations. For non-multi-turn conversations, this field can be left blank or unset.\n', + examples=['user'], ) class IdeogramV3EditRequest(BaseModel): + color_palette: Optional[IdeogramColorPalette] = None image: Optional[StrictBytes] = Field( None, description='The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.', ) - mask: Optional[StrictBytes] = Field( - None, - description='A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time.', - ) - prompt: str = Field( - ..., description='The prompt used to describe the edited result.' - ) magic_prompt: Optional[str] = Field( None, description='Determine if MagicPrompt should be used in generating the request or not.', ) + mask: Optional[StrictBytes] = Field( + None, + description='A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time.', + ) num_images: Optional[int] = Field( None, description='The number of images to generate.' ) - seed: Optional[int] = Field( - None, description='Random seed. Set for reproducible generation.' + prompt: str = Field( + ..., description='The prompt used to describe the edited result.' ) rendering_speed: RenderingSpeed - color_palette: Optional[IdeogramColorPalette] = Field( - None, - description='A color palette for generation, must EITHER be specified via one of the presets (name) or explicitly via hexadecimal representations of the color with optional weights (members). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models.', + seed: Optional[int] = Field( + None, description='Random seed. Set for reproducible generation.' ) style_codes: Optional[List[StyleCode]] = Field( None, @@ -3166,34 +2723,102 @@ class IdeogramV3EditRequest(BaseModel): ) -class KlingCameraControl(BaseModel): - type: Optional[KlingCameraControlType] = None - config: Optional[KlingCameraConfig] = None - - -class KlingText2VideoRequest(BaseModel): - model_name: Optional[KlingVideoGenModelName] = 'kling-v2-master' - prompt: Optional[str] = Field( - None, description='Positive text prompt', max_length=2500 +class IdeogramV3Request(BaseModel): + aspect_ratio: Optional[str] = Field( + None, description='Aspect ratio in format WxH', examples=['1x3'] + ) + color_palette: Optional[ColorPalette] = None + magic_prompt: Optional[MagicPrompt2] = Field( + None, description='Whether to enable magic prompt enhancement' ) negative_prompt: Optional[str] = Field( - None, description='Negative text prompt', max_length=2500 + None, description='Text prompt specifying what to avoid in the generation' ) - cfg_scale: Optional[KlingVideoGenCfgScale] = Field( - default_factory=lambda: KlingVideoGenCfgScale.model_validate(0.5) + num_images: Optional[int] = Field( + None, description='Number of images to generate', ge=1 ) + prompt: str = Field(..., description='The text prompt for image generation') + rendering_speed: RenderingSpeed + resolution: Optional[str] = Field( + None, description='Image resolution in format WxH', examples=['1280x800'] + ) + seed: Optional[int] = Field( + None, description='Seed value for reproducible generation' + ) + style_codes: Optional[List[StyleCode]] = Field( + None, description='Array of style codes in hexadecimal format' + ) + style_reference_images: Optional[List[str]] = Field( + None, description='Array of reference image URLs or identifiers' + ) + style_type: Optional[StyleType1] = Field( + None, description='The type of style to apply' + ) + + +class ImagenGenerateImageResponse(BaseModel): + predictions: Optional[List[ImagenImagePrediction]] = None + + +class ImagenImageGenerationParameters(BaseModel): + addWatermark: Optional[bool] = None + aspectRatio: Optional[AspectRatio] = None + enhancePrompt: Optional[bool] = None + includeRaiReason: Optional[bool] = None + includeSafetyAttributes: Optional[bool] = None + outputOptions: Optional[ImagenOutputOptions] = None + personGeneration: Optional[PersonGeneration] = None + safetySetting: Optional[SafetySetting] = None + sampleCount: Optional[int] = Field(None, ge=1, le=4) + seed: Optional[int] = None + storageUri: Optional[AnyUrl] = None + + +class InputContent( + RootModel[Union[InputTextContent, InputImageContent, InputFileContent]] +): + root: Union[InputTextContent, InputImageContent, InputFileContent] + + +class InputMessageContentList(RootModel[List[InputContent]]): + root: List[InputContent] = Field( + ..., + description='A list of one or many input items to the model, containing different content \ntypes.\n', + title='Input item content list', + ) + + +class KlingCameraControl(BaseModel): + config: Optional[KlingCameraConfig] = None + type: Optional[KlingCameraControlType] = None + + +class KlingDualCharacterEffectInput(BaseModel): + duration: KlingVideoGenDuration + images: KlingDualCharacterImages mode: Optional[KlingVideoGenMode] = 'std' - camera_control: Optional[KlingCameraControl] = None - aspect_ratio: Optional[KlingVideoGenAspectRatio] = '16:9' - duration: Optional[KlingVideoGenDuration] = '5' - callback_url: Optional[AnyUrl] = Field( - None, description='The callback notification address' - ) - external_task_id: Optional[str] = Field(None, description='Customized Task ID') + model_name: Optional[KlingCharacterEffectModelName] = 'kling-v1' class KlingImage2VideoRequest(BaseModel): - model_name: Optional[KlingVideoGenModelName] = 'kling-v2-master' + aspect_ratio: Optional[KlingVideoGenAspectRatio] = '16:9' + callback_url: Optional[AnyUrl] = Field( + None, + description='The callback notification address. Server will notify when the task status changes.', + ) + camera_control: Optional[KlingCameraControl] = None + cfg_scale: Optional[KlingVideoGenCfgScale] = Field( + default_factory=lambda: KlingVideoGenCfgScale.model_validate(0.5) + ) + duration: Optional[KlingVideoGenDuration] = '5' + dynamic_masks: Optional[List[DynamicMask]] = Field( + None, + description='Dynamic Brush Configuration List (up to 6 groups). For 5-second videos, trajectory length must not exceed 77 coordinates.', + ) + external_task_id: Optional[str] = Field( + None, + description='Customized Task ID. Must be unique within a single user account.', + ) image: Optional[str] = Field( None, description='Reference Image - URL or Base64 encoded string, cannot exceed 10MB, resolution not less than 300*300px, aspect ratio between 1:2.5 ~ 2.5:1. Base64 should not include data:image prefix.', @@ -3202,35 +2827,168 @@ class KlingImage2VideoRequest(BaseModel): None, description='Reference Image - End frame control. URL or Base64 encoded string, cannot exceed 10MB, resolution not less than 300*300px. Base64 should not include data:image prefix.', ) - prompt: Optional[str] = Field( - None, description='Positive text prompt', max_length=2500 - ) + mode: Optional[KlingVideoGenMode] = 'std' + model_name: Optional[KlingVideoGenModelName] = 'kling-v2-master' negative_prompt: Optional[str] = Field( None, description='Negative text prompt', max_length=2500 ) - cfg_scale: Optional[KlingVideoGenCfgScale] = Field( - default_factory=lambda: KlingVideoGenCfgScale.model_validate(0.5) + prompt: Optional[str] = Field( + None, description='Positive text prompt', max_length=2500 ) - mode: Optional[KlingVideoGenMode] = 'std' static_mask: Optional[str] = Field( None, description='Static Brush Application Area (Mask image created by users using the motion brush). The aspect ratio must match the input image.', ) - dynamic_masks: Optional[List[DynamicMask]] = Field( + + +class TaskResult(BaseModel): + videos: Optional[List[KlingVideoResult]] = None + + +class Data(BaseModel): + created_at: Optional[int] = Field(None, description='Task creation time') + task_id: Optional[str] = Field(None, description='Task ID') + task_info: Optional[TaskInfo] = None + task_result: Optional[TaskResult] = None + task_status: Optional[KlingTaskStatus] = None + updated_at: Optional[int] = Field(None, description='Task update time') + + +class KlingImage2VideoResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') + data: Optional[Data] = None + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') + + +class TaskResult1(BaseModel): + images: Optional[List[KlingImageResult]] = None + + +class Data1(BaseModel): + created_at: Optional[int] = Field(None, description='Task creation time') + task_id: Optional[str] = Field(None, description='Task ID') + task_result: Optional[TaskResult1] = None + task_status: Optional[KlingTaskStatus] = None + task_status_msg: Optional[str] = Field(None, description='Task status information') + updated_at: Optional[int] = Field(None, description='Task update time') + + +class KlingImageGenerationsResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') + data: Optional[Data1] = None + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') + + +class KlingLipSyncInputObject(BaseModel): + audio_file: Optional[str] = Field( None, - description='Dynamic Brush Configuration List (up to 6 groups). For 5-second videos, trajectory length must not exceed 77 coordinates.', + description='Local Path of Audio File. Supported formats: .mp3/.wav/.m4a/.aac, maximum file size of 5MB. Base64 code.', ) - camera_control: Optional[KlingCameraControl] = None - aspect_ratio: Optional[KlingVideoGenAspectRatio] = '16:9' - duration: Optional[KlingVideoGenDuration] = '5' + audio_type: Optional[KlingAudioUploadType] = None + audio_url: Optional[str] = Field( + None, + description='Audio File Download URL. Supported formats: .mp3/.wav/.m4a/.aac, maximum file size of 5MB.', + ) + mode: KlingLipSyncMode + text: Optional[str] = Field( + None, + description='Text Content for Lip-Sync Video Generation. Required when mode is text2video. Maximum length is 120 characters.', + ) + video_id: Optional[str] = Field( + None, + description='The ID of the video generated by Kling AI. Only supports 5-second and 10-second videos generated within the last 30 days.', + ) + video_url: Optional[str] = Field( + None, + description='Get link for uploaded video. Video files support .mp4/.mov, file size does not exceed 100MB, video length between 2-10s.', + ) + voice_id: Optional[str] = Field( + None, + description='Voice ID. Required when mode is text2video. The system offers a variety of voice options to choose from.', + ) + voice_language: Optional[KlingLipSyncVoiceLanguage] = 'en' + voice_speed: Optional[float] = Field( + 1, + description='Speech Rate. Valid range: 0.8~2.0, accurate to one decimal place.', + ge=0.8, + le=2.0, + ) + + +class KlingLipSyncRequest(BaseModel): callback_url: Optional[AnyUrl] = Field( None, description='The callback notification address. Server will notify when the task status changes.', ) - external_task_id: Optional[str] = Field( - None, - description='Customized Task ID. Must be unique within a single user account.', + input: KlingLipSyncInputObject + + +class TaskResult2(BaseModel): + videos: Optional[List[KlingVideoResult]] = None + + +class Data2(BaseModel): + created_at: Optional[int] = Field(None, description='Task creation time') + task_id: Optional[str] = Field(None, description='Task ID') + task_info: Optional[TaskInfo] = None + task_result: Optional[TaskResult2] = None + task_status: Optional[KlingTaskStatus] = None + updated_at: Optional[int] = Field(None, description='Task update time') + + +class KlingLipSyncResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') + data: Optional[Data2] = None + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') + + +class KlingSingleImageEffectInput(BaseModel): + duration: KlingSingleImageEffectDuration + image: str = Field( + ..., + description='Reference Image. URL or Base64 encoded string (without data:image prefix). File size cannot exceed 10MB, resolution not less than 300*300px, aspect ratio between 1:2.5 ~ 2.5:1.', ) + model_name: KlingSingleImageEffectModelName + + +class KlingText2VideoRequest(BaseModel): + aspect_ratio: Optional[KlingVideoGenAspectRatio] = '16:9' + callback_url: Optional[AnyUrl] = Field( + None, description='The callback notification address' + ) + camera_control: Optional[KlingCameraControl] = None + cfg_scale: Optional[KlingVideoGenCfgScale] = Field( + default_factory=lambda: KlingVideoGenCfgScale.model_validate(0.5) + ) + duration: Optional[KlingVideoGenDuration] = '5' + external_task_id: Optional[str] = Field(None, description='Customized Task ID') + mode: Optional[KlingVideoGenMode] = 'std' + model_name: Optional[KlingTextToVideoModelName] = 'kling-v1' + negative_prompt: Optional[str] = Field( + None, description='Negative text prompt', max_length=2500 + ) + prompt: Optional[str] = Field( + None, description='Positive text prompt', max_length=2500 + ) + + +class Data4(BaseModel): + created_at: Optional[int] = Field(None, description='Task creation time') + task_id: Optional[str] = Field(None, description='Task ID') + task_info: Optional[TaskInfo] = None + task_result: Optional[TaskResult2] = None + task_status: Optional[KlingTaskStatus] = None + updated_at: Optional[int] = Field(None, description='Task update time') + + +class KlingText2VideoResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') + data: Optional[Data4] = None + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') class KlingVideoEffectsInput( @@ -3239,351 +2997,325 @@ class KlingVideoEffectsInput( root: Union[KlingSingleImageEffectInput, KlingDualCharacterEffectInput] -class StripeBillingDetails(BaseModel): - address: Optional[StripeAddress] = None - email: Optional[str] = None - name: Optional[str] = None - phone: Optional[str] = None - tax_id: Optional[Any] = None - - -class StripePaymentMethodDetails(BaseModel): - card: Optional[StripeCardDetails] = None - type: Optional[str] = None - - -class BFLFluxProFillInputs(BaseModel): - image: str = Field( - ..., - description='A Base64-encoded string representing the image you wish to modify. Can contain alpha mask if desired.', - title='Image', - ) - mask: Optional[str] = Field( +class KlingVideoEffectsRequest(BaseModel): + callback_url: Optional[AnyUrl] = Field( None, - description='A Base64-encoded string representing a mask for the areas you want to modify in the image. The mask should be the same dimensions as the image and in black and white. Black areas (0%) indicate no modification, while white areas (100%) specify areas for inpainting. Optional if you provide an alpha mask in the original image. Validation: The endpoint verifies that the dimensions of the mask match the original image.', - title='Mask', + description='The callback notification address for the result of this task.', + ) + effect_scene: Union[KlingDualCharacterEffectsScene, KlingSingleImageEffectsScene] + external_task_id: Optional[str] = Field( + None, + description='Customized Task ID. Must be unique within a single user account.', + ) + input: KlingVideoEffectsInput + + +class Data5(BaseModel): + created_at: Optional[int] = Field(None, description='Task creation time') + task_id: Optional[str] = Field(None, description='Task ID') + task_info: Optional[TaskInfo] = None + task_result: Optional[TaskResult2] = None + task_status: Optional[KlingTaskStatus] = None + updated_at: Optional[int] = Field(None, description='Task update time') + + +class KlingVideoEffectsResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') + data: Optional[Data5] = None + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') + + +class KlingVideoExtendRequest(BaseModel): + callback_url: Optional[AnyUrl] = Field( + None, + description='The callback notification address. Server will notify when the task status changes.', + ) + cfg_scale: Optional[KlingVideoGenCfgScale] = Field( + default_factory=lambda: KlingVideoGenCfgScale.model_validate(0.5) + ) + negative_prompt: Optional[str] = Field( + None, + description='Negative text prompt for elements to avoid in the extended video', + max_length=2500, ) prompt: Optional[str] = Field( - '', - description='The description of the changes you want to make. This text guides the inpainting process, allowing you to specify features, styles, or modifications for the masked area.', - examples=['ein fantastisches bild'], - title='Prompt', - ) - steps: Optional[Steps] = Field( - default_factory=lambda: Steps.model_validate(50), - description='Number of steps for the image generation process', - examples=[50], - title='Steps', - ) - prompt_upsampling: Optional[bool] = Field( - False, - description='Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation', - title='Prompt Upsampling', - ) - seed: Optional[int] = Field( - None, description='Optional seed for reproducibility', title='Seed' - ) - guidance: Optional[Guidance] = Field( - default_factory=lambda: Guidance.model_validate(60), - description='Guidance strength for the image generation process', - title='Guidance', - ) - output_format: Optional[BFLOutputFormat] = Field( - 'jpeg', - description="Output format for the generated image. Can be 'jpeg' or 'png'.", - ) - safety_tolerance: Optional[int] = Field( - 2, - description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict.', - examples=[2], - ge=0, - le=6, - title='Safety Tolerance', - ) - webhook_url: Optional[WebhookUrl] = Field( - None, description='URL to receive webhook notifications', title='Webhook Url' - ) - webhook_secret: Optional[str] = Field( None, - description='Optional secret for webhook signature verification', - title='Webhook Secret', + description='Positive text prompt for guiding the video extension', + max_length=2500, ) - - -class BFLHTTPValidationError(BaseModel): - detail: Optional[List[BFLValidationError]] = Field(None, title='Detail') - - -class BFLFluxProExpandInputs(BaseModel): - image: str = Field( - ..., - description='A Base64-encoded string representing the image you wish to expand.', - title='Image', - ) - top: Optional[Top] = Field( - 0, description='Number of pixels to expand at the top of the image', title='Top' - ) - bottom: Optional[Bottom] = Field( - 0, - description='Number of pixels to expand at the bottom of the image', - title='Bottom', - ) - left: Optional[Left] = Field( - 0, - description='Number of pixels to expand on the left side of the image', - title='Left', - ) - right: Optional[Right] = Field( - 0, - description='Number of pixels to expand on the right side of the image', - title='Right', - ) - prompt: Optional[str] = Field( - '', - description='The description of the changes you want to make. This text guides the expansion process, allowing you to specify features, styles, or modifications for the expanded areas.', - examples=['ein fantastisches bild'], - title='Prompt', - ) - steps: Optional[Steps] = Field( - default_factory=lambda: Steps.model_validate(50), - description='Number of steps for the image generation process', - examples=[50], - title='Steps', - ) - prompt_upsampling: Optional[bool] = Field( - False, - description='Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation', - title='Prompt Upsampling', - ) - seed: Optional[int] = Field( - None, description='Optional seed for reproducibility', title='Seed' - ) - guidance: Optional[Guidance] = Field( - default_factory=lambda: Guidance.model_validate(60), - description='Guidance strength for the image generation process', - title='Guidance', - ) - output_format: Optional[BFLOutputFormat] = Field( - 'jpeg', - description="Output format for the generated image. Can be 'jpeg' or 'png'.", - ) - safety_tolerance: Optional[int] = Field( - 2, - description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict.', - examples=[2], - ge=0, - le=6, - title='Safety Tolerance', - ) - webhook_url: Optional[WebhookUrl] = Field( - None, description='URL to receive webhook notifications', title='Webhook Url' - ) - webhook_secret: Optional[str] = Field( + video_id: Optional[str] = Field( None, - description='Optional secret for webhook signature verification', - title='Webhook Secret', + description='The ID of the video to be extended. Supports videos generated by text-to-video, image-to-video, and previous video extension operations. Cannot exceed 3 minutes total duration after extension.', ) -class BFLCannyInputs(BaseModel): - prompt: str = Field( - ..., - description='Text prompt for image generation', - examples=['ein fantastisches bild'], - title='Prompt', - ) - control_image: Optional[str] = Field( - None, - description='Base64 encoded image to use as control input if no preprocessed image is provided', - title='Control Image', - ) - preprocessed_image: Optional[str] = Field( - None, - description='Optional pre-processed image that will bypass the control preprocessing step', - title='Preprocessed Image', - ) - canny_low_threshold: Optional[CannyLowThreshold] = Field( - default_factory=lambda: CannyLowThreshold.model_validate(50), - description='Low threshold for Canny edge detection', - title='Canny Low Threshold', - ) - canny_high_threshold: Optional[CannyHighThreshold] = Field( - default_factory=lambda: CannyHighThreshold.model_validate(200), - description='High threshold for Canny edge detection', - title='Canny High Threshold', - ) - prompt_upsampling: Optional[bool] = Field( - False, - description='Whether to perform upsampling on the prompt', - title='Prompt Upsampling', - ) - seed: Optional[int] = Field( - None, - description='Optional seed for reproducibility', - examples=[42], - title='Seed', - ) - steps: Optional[Steps2] = Field( - default_factory=lambda: Steps2.model_validate(50), - description='Number of steps for the image generation process', - title='Steps', - ) - output_format: Optional[BFLOutputFormat] = Field( - 'jpeg', - description="Output format for the generated image. Can be 'jpeg' or 'png'.", - ) - guidance: Optional[Guidance2] = Field( - default_factory=lambda: Guidance2.model_validate(30), - description='Guidance strength for the image generation process', - title='Guidance', - ) - safety_tolerance: Optional[int] = Field( - 2, - description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict.', - ge=0, - le=6, - title='Safety Tolerance', - ) - webhook_url: Optional[WebhookUrl] = Field( - None, description='URL to receive webhook notifications', title='Webhook Url' - ) - webhook_secret: Optional[str] = Field( - None, - description='Optional secret for webhook signature verification', - title='Webhook Secret', - ) +class Data6(BaseModel): + created_at: Optional[int] = Field(None, description='Task creation time') + task_id: Optional[str] = Field(None, description='Task ID') + task_info: Optional[TaskInfo] = None + task_result: Optional[TaskResult2] = None + task_status: Optional[KlingTaskStatus] = None + updated_at: Optional[int] = Field(None, description='Task update time') -class BFLDepthInputs(BaseModel): - prompt: str = Field( - ..., - description='Text prompt for image generation', - examples=['ein fantastisches bild'], - title='Prompt', - ) - control_image: Optional[str] = Field( - None, - description='Base64 encoded image to use as control input', - title='Control Image', - ) - preprocessed_image: Optional[str] = Field( - None, - description='Optional pre-processed image that will bypass the control preprocessing step', - title='Preprocessed Image', - ) - prompt_upsampling: Optional[bool] = Field( - False, - description='Whether to perform upsampling on the prompt', - title='Prompt Upsampling', - ) - seed: Optional[int] = Field( - None, - description='Optional seed for reproducibility', - examples=[42], - title='Seed', - ) - steps: Optional[Steps2] = Field( - default_factory=lambda: Steps2.model_validate(50), - description='Number of steps for the image generation process', - title='Steps', - ) - output_format: Optional[BFLOutputFormat] = Field( - 'jpeg', - description="Output format for the generated image. Can be 'jpeg' or 'png'.", - ) - guidance: Optional[Guidance2] = Field( - default_factory=lambda: Guidance2.model_validate(15), - description='Guidance strength for the image generation process', - title='Guidance', - ) - safety_tolerance: Optional[int] = Field( - 2, - description='Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict.', - ge=0, - le=6, - title='Safety Tolerance', - ) - webhook_url: Optional[WebhookUrl] = Field( - None, description='URL to receive webhook notifications', title='Webhook Url' - ) - webhook_secret: Optional[str] = Field( - None, - description='Optional secret for webhook signature verification', - title='Webhook Secret', - ) - - -class Controls(BaseModel): - artistic_level: Optional[int] = Field( - None, - description='Defines artistic tone of your image. At a simple level, the person looks straight at the camera in a static and clean style. Dynamic and eccentric levels introduce movement and creativity.', - ge=0, - le=5, - ) - colors: Optional[List[RGBColor]] = Field( - None, description='An array of preferable colors' - ) - background_color: Optional[RGBColor] = Field( - None, description='Use given color as a desired background color' - ) - no_text: Optional[bool] = Field(None, description='Do not embed text layouts') - - -class RecraftImageGenerationRequest(BaseModel): - prompt: str = Field( - ..., description='The text prompt describing the image to generate' - ) - model: str = Field( - ..., description='The model to use for generation (e.g., "recraftv3")' - ) - style: Optional[str] = Field( - None, - description='The style to apply to the generated image (e.g., "digital_illustration")', - ) - style_id: Optional[str] = Field( - None, - description='The style ID to apply to the generated image (e.g., "123e4567-e89b-12d3-a456-426614174000"). If style_id is provided, style should not be provided.', - ) - size: str = Field( - ..., description='The size of the generated image (e.g., "1024x1024")' - ) - controls: Optional[Controls] = Field( - None, description='The controls for the generated image' - ) - n: int = Field(..., description='The number of images to generate', ge=1, le=4) - - -class LumaKeyframes(BaseModel): - frame0: Optional[LumaKeyframe] = None - frame1: Optional[LumaKeyframe] = None +class KlingVideoExtendResponse(BaseModel): + code: Optional[int] = Field(None, description='Error code') + data: Optional[Data6] = None + message: Optional[str] = Field(None, description='Error message') + request_id: Optional[str] = Field(None, description='Request ID') class LumaGenerationRequest(BaseModel): - generation_type: Optional[GenerationType] = 'video' - prompt: str = Field(..., description='The prompt of the generation') aspect_ratio: LumaAspectRatio - loop: Optional[bool] = Field(None, description='Whether to loop the video') - keyframes: Optional[LumaKeyframes] = None callback_url: Optional[AnyUrl] = Field( None, description='The callback URL of the generation, a POST request with Generation object will be sent to the callback URL when the generation is dreaming, completed, or failed', ) - model: LumaVideoModel - resolution: LumaVideoModelOutputResolution duration: LumaVideoModelOutputDuration + generation_type: Optional[GenerationType1] = 'video' + keyframes: Optional[LumaKeyframes] = None + loop: Optional[bool] = Field(None, description='Whether to loop the video') + model: LumaVideoModel + prompt: str = Field(..., description='The prompt of the generation') + resolution: LumaVideoModelOutputResolution + + +class CharacterRef(BaseModel): + identity0: Optional[LumaImageIdentity] = None + + +class LumaImageGenerationRequest(BaseModel): + aspect_ratio: Optional[LumaAspectRatio] = '16:9' + callback_url: Optional[AnyUrl] = Field( + None, description='The callback URL for the generation' + ) + character_ref: Optional[CharacterRef] = None + generation_type: Optional[GenerationType2] = 'image' + image_ref: Optional[List[LumaImageRef]] = None + model: Optional[LumaImageModel] = 'photon-1' + modify_image_ref: Optional[LumaModifyImageRef] = None + prompt: Optional[str] = Field(None, description='The prompt of the generation') + style_ref: Optional[List[LumaImageRef]] = None + + +class LumaUpscaleVideoGenerationRequest(BaseModel): + callback_url: Optional[AnyUrl] = Field( + None, description='The callback URL for the upscale' + ) + generation_type: Optional[GenerationType3] = 'upscale_video' + resolution: Optional[LumaVideoModelOutputResolution] = None + + +class OutputContent(RootModel[Union[OutputTextContent, OutputAudioContent]]): + root: Union[OutputTextContent, OutputAudioContent] + + +class OutputMessage(BaseModel): + content: List[OutputContent] = Field(..., description='The content of the message') + role: Role4 = Field(..., description='The role of the message') + type: Type14 = Field(..., description='The type of output item') + + +class PikaBodyGenerate22I2vGenerate22I2vPost(BaseModel): + duration: Optional[PikaDurationEnum] = 5 + image: Optional[StrictBytes] = Field(None, title='Image') + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + promptText: Optional[str] = Field(None, title='Prompttext') + resolution: Optional[PikaResolutionEnum] = '1080p' + seed: Optional[int] = Field(None, title='Seed') + + +class PikaBodyGenerate22KeyframeGenerate22PikaframesPost(BaseModel): + duration: Optional[int] = Field(None, ge=5, le=10, title='Duration') + keyFrames: Optional[List[StrictBytes]] = Field( + None, description='Array of keyframe images', title='Keyframes' + ) + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + promptText: str = Field(..., title='Prompttext') + resolution: Optional[PikaResolutionEnum] = '1080p' + seed: Optional[int] = Field(None, title='Seed') + + +class PikaBodyGenerate22T2vGenerate22T2vPost(BaseModel): + aspectRatio: Optional[float] = Field( + 1.7777777777777777, + description='Aspect ratio (width / height)', + ge=0.4, + le=2.5, + title='Aspectratio', + ) + duration: Optional[PikaDurationEnum] = 5 + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + promptText: str = Field(..., title='Prompttext') + resolution: Optional[PikaResolutionEnum] = '1080p' + seed: Optional[int] = Field(None, title='Seed') + + +class PikaBodyGeneratePikaffectsGeneratePikaffectsPost(BaseModel): + image: Optional[StrictBytes] = Field(None, title='Image') + negativePrompt: Optional[str] = Field(None, title='Negativeprompt') + pikaffect: Optional[Pikaffect] = None + promptText: Optional[str] = Field(None, title='Prompttext') + seed: Optional[int] = Field(None, title='Seed') + + +class PikaHTTPValidationError(BaseModel): + detail: Optional[List[PikaValidationError]] = Field(None, title='Detail') + + +class Reasoning(BaseModel): + effort: Optional[ReasoningEffort] = 'medium' + generate_summary: Optional[GenerateSummary] = Field( + None, + description="**Deprecated:** use `summary` instead.\n\nA summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n", + ) + summary: Optional[Summary] = Field( + None, + description="A summary of the reasoning performed by the model. This can be\nuseful for debugging and understanding the model's reasoning process.\nOne of `auto`, `concise`, or `detailed`.\n", + ) + + +class ResponseError(BaseModel): + code: ResponseErrorCode + message: str = Field(..., description='A human-readable description of the error.') + + +class Rodin3DDownloadResponse(BaseModel): + list: Optional[RodinResourceItem] = None + + +class Rodin3DGenerateRequest(BaseModel): + images: str = Field(..., description='The reference images to generate 3D Assets.') + material: Optional[RodinMaterialType] = None + mesh_mode: Optional[RodinMeshModeType] = None + quality: Optional[RodinQualityType] = None + seed: Optional[int] = Field(None, description='Seed.') + tier: Optional[RodinTierType] = None + + +class Rodin3DGenerateResponse(BaseModel): + jobs: Optional[RodinGenerateJobsData] = None + message: Optional[str] = Field(None, description='message') + prompt: Optional[str] = Field(None, description='prompt') + submit_time: Optional[str] = Field(None, description='Time') + uuid: Optional[str] = Field(None, description='Task UUID') + + +class RunwayImageToVideoRequest(BaseModel): + duration: RunwayDurationEnum + model: RunwayModelEnum + promptImage: RunwayPromptImageObject + promptText: Optional[str] = Field( + None, description='Text prompt for the generation', max_length=1000 + ) + ratio: RunwayAspectRatioEnum + seed: int = Field( + ..., description='Random seed for generation', ge=0, le=4294967295 + ) + + +class TextResponseFormatConfiguration( + RootModel[ + Union[ + ResponseFormatText, TextResponseFormatJsonSchema, ResponseFormatJsonObject + ] + ] +): + root: Union[ + ResponseFormatText, TextResponseFormatJsonSchema, ResponseFormatJsonObject + ] = Field( + ..., + description='An object specifying the format that the model must output.\n\nConfiguring `{ "type": "json_schema" }` enables Structured Outputs, \nwhich ensures the model will match your supplied JSON schema. Learn more in the \n[Structured Outputs guide](/docs/guides/structured-outputs).\n\nThe default format is `{ "type": "text" }` with no additional options.\n\n**Not recommended for gpt-4o and newer models:**\n\nSetting to `{ "type": "json_object" }` enables the older JSON mode, which\nensures the message the model generates is valid JSON. Using `json_schema`\nis preferred for models that support it.\n', + ) + + +class Tool( + RootModel[ + Union[ + FileSearchTool, FunctionTool, WebSearchPreviewTool, ComputerUsePreviewTool + ] + ] +): + root: Union[ + FileSearchTool, FunctionTool, WebSearchPreviewTool, ComputerUsePreviewTool + ] = Field(..., discriminator='type') + + +class EasyInputMessage(BaseModel): + content: Union[str, InputMessageContentList] = Field( + ..., + description='Text, image, or audio input to the model, used to generate a response.\nCan also contain previous assistant responses.\n', + ) + role: Role = Field( + ..., + description='The role of the message input. One of `user`, `assistant`, `system`, or\n`developer`.\n', + ) + type: Optional[Type2] = Field( + None, description='The type of the message input. Always `message`.\n' + ) + + +class GeminiContent(BaseModel): + parts: List[GeminiPart] + role: Role1 = Field(..., examples=['user']) + + +class GeminiGenerateContentRequest(BaseModel): + contents: List[GeminiContent] + generationConfig: Optional[GeminiGenerationConfig] = None + safetySettings: Optional[List[GeminiSafetySetting]] = None + systemInstruction: Optional[GeminiSystemInstructionContent] = None + tools: Optional[List[GeminiTool]] = None + videoMetadata: Optional[GeminiVideoMetadata] = None + + +class ImagenGenerateImageRequest(BaseModel): + instances: List[ImagenImageGenerationInstance] + parameters: ImagenImageGenerationParameters + + +class InputMessage(BaseModel): + content: Optional[InputMessageContentList] = None + role: Optional[Role3] = None + status: Optional[Status2] = None + type: Optional[Type9] = None + + +class Item( + RootModel[ + Union[ + InputMessage, + OutputMessage, + FileSearchToolCall, + ComputerToolCall, + WebSearchToolCall, + FunctionToolCall, + ReasoningItem, + ] + ] +): + root: Union[ + InputMessage, + OutputMessage, + FileSearchToolCall, + ComputerToolCall, + WebSearchToolCall, + FunctionToolCall, + ReasoningItem, + ] = Field(..., description='Content item used to generate a response.\n') class LumaGeneration(BaseModel): - id: Optional[UUID] = Field(None, description='The ID of the generation') - generation_type: Optional[LumaGenerationType] = None - state: Optional[LumaState] = None - failure_reason: Optional[str] = Field( - None, description='The reason for the state of the generation' - ) + assets: Optional[LumaAssets] = None created_at: Optional[datetime] = Field( None, description='The date and time when the generation was created' ) - assets: Optional[LumaAssets] = None + failure_reason: Optional[str] = Field( + None, description='The reason for the state of the generation' + ) + generation_type: Optional[LumaGenerationType] = None + id: Optional[UUID] = Field(None, description='The ID of the generation') model: Optional[str] = Field(None, description='The model used for the generation') request: Optional[ Union[ @@ -3593,237 +3325,129 @@ class LumaGeneration(BaseModel): LumaAudioGenerationRequest, ] ] = Field(None, description='The request of the generation') + state: Optional[LumaState] = None -class RunwayImageToVideoRequest(BaseModel): - promptImage: RunwayPromptImageObject - seed: int = Field( - ..., description='Random seed for generation', ge=0, le=4294967295 +class OutputItem( + RootModel[ + Union[ + OutputMessage, + FileSearchToolCall, + FunctionToolCall, + WebSearchToolCall, + ComputerToolCall, + ReasoningItem, + ] + ] +): + root: Union[ + OutputMessage, + FileSearchToolCall, + FunctionToolCall, + WebSearchToolCall, + ComputerToolCall, + ReasoningItem, + ] + + +class Text(BaseModel): + format: Optional[TextResponseFormatConfiguration] = None + + +class ResponseProperties(BaseModel): + instructions: Optional[str] = Field( + None, + description="Inserts a system (or developer) message as the first item in the model's context.\n\nWhen using along with `previous_response_id`, the instructions from a previous\nresponse will not be carried over to the next response. This makes it simple\nto swap out system (or developer) messages in new responses.\n", ) - model: RunwayModelEnum = Field(..., description='Model to use for generation') - promptText: Optional[str] = Field( - None, description='Text prompt for the generation', max_length=1000 + max_output_tokens: Optional[int] = Field( + None, + description='An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).\n', ) - duration: RunwayDurationEnum = Field( - ..., description='The number of seconds of duration for the output video.' + model: Optional[OpenAIModels] = None + previous_response_id: Optional[str] = Field( + None, + description='The unique ID of the previous response to the model. Use this to\ncreate multi-turn conversations. Learn more about \n[conversation state](/docs/guides/conversation-state).\n', ) - ratio: RunwayAspectRatioEnum = Field( + reasoning: Optional[Reasoning] = None + text: Optional[Text] = None + tool_choice: Optional[ + Union[ToolChoiceOptions, ToolChoiceTypes, ToolChoiceFunction] + ] = Field( + None, + description='How the model should select which tool (or tools) to use when generating\na response. See the `tools` parameter to see how to specify which tools\nthe model can call.\n', + ) + tools: Optional[List[Tool]] = None + truncation: Optional[Truncation1] = Field( + 'disabled', + description="The truncation strategy to use for the model response.\n- `auto`: If the context of this response and previous ones exceeds\n the model's context window size, the model will truncate the \n response to fit the context window by dropping input items in the\n middle of the conversation. \n- `disabled` (default): If a model response will exceed the context window \n size for a model, the request will fail with a 400 error.\n", + ) + + +class GeminiCandidate(BaseModel): + citationMetadata: Optional[GeminiCitationMetadata] = None + content: Optional[GeminiContent] = None + finishReason: Optional[str] = None + safetyRatings: Optional[List[GeminiSafetyRating]] = None + + +class GeminiGenerateContentResponse(BaseModel): + candidates: Optional[List[GeminiCandidate]] = None + promptFeedback: Optional[GeminiPromptFeedback] = None + + +class InputItem(RootModel[Union[EasyInputMessage, Item]]): + root: Union[EasyInputMessage, Item] + + +class OpenAICreateResponse(CreateModelResponseProperties, ResponseProperties): + include: Optional[List[Includable]] = Field( + None, + description='Specify additional output data to include in the model response. Currently\nsupported values are:\n- `file_search_call.results`: Include the search results of\n the file search tool call.\n- `message.input_image.image_url`: Include image urls from the input message.\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\n', + ) + input: Union[str, List[InputItem]] = Field( ..., - description='The resolution (aspect ratio) of the output video. Allowable values depend on the selected model. 1280:768 and 768:1280 are only supported for gen3a_turbo.', + description='Text, image, or file inputs to the model, used to generate a response.\n\nLearn more:\n- [Text inputs and outputs](/docs/guides/text)\n- [Image inputs](/docs/guides/images)\n- [File inputs](/docs/guides/pdf-files)\n- [Conversation state](/docs/guides/conversation-state)\n- [Function calling](/docs/guides/function-calling)\n', ) - - -class RunwayTaskStatusResponse(BaseModel): - id: Optional[str] = Field(None, description='Task ID') - status: Optional[RunwayTaskStatusEnum] = Field(None, description='Task status') - createdAt: Optional[datetime] = Field(None, description='Task creation timestamp') - output: Optional[List[str]] = Field(None, description='Array of output video URLs') - - -class PikaHTTPValidationError(BaseModel): - detail: Optional[List[PikaValidationError]] = Field(None, title='Detail') - - -class PikaBodyGenerate22T2vGenerate22T2vPost(BaseModel): - promptText: str = Field(..., title='Prompttext') - negativePrompt: Optional[str] = Field(None, title='Negativeprompt') - seed: Optional[int] = Field(None, title='Seed') - resolution: Optional[PikaResolutionEnum] = Field('1080p', title='Resolution') - duration: Optional[PikaDurationEnum] = Field(5, title='Duration') - aspectRatio: Optional[float] = Field( - 1.7777777777777777, - description='Aspect ratio (width / height)', - ge=0.4, - le=2.5, - title='Aspectratio', + parallel_tool_calls: Optional[bool] = Field( + True, description='Whether to allow the model to run tool calls in parallel.\n' ) - - -class PikaBodyGenerate22I2vGenerate22I2vPost(BaseModel): - image: Optional[StrictBytes] = Field(None, title='Image') - promptText: Optional[str] = Field(None, title='Prompttext') - negativePrompt: Optional[str] = Field(None, title='Negativeprompt') - seed: Optional[int] = Field(None, title='Seed') - resolution: Optional[PikaResolutionEnum] = Field('1080p', title='Resolution') - duration: Optional[PikaDurationEnum] = Field(5, title='Duration') - - -class PikaBodyGenerate22KeyframeGenerate22PikaframesPost(BaseModel): - keyFrames: Optional[List[StrictBytes]] = Field( - None, description='Array of keyframe images', title='Keyframes' + store: Optional[bool] = Field( + True, + description='Whether to store the generated model response for later retrieval via\nAPI.\n', ) - promptText: str = Field(..., title='Prompttext') - negativePrompt: Optional[str] = Field(None, title='Negativeprompt') - seed: Optional[int] = Field(None, title='Seed') - resolution: Optional[PikaResolutionEnum] = Field('1080p', title='Resolution') - duration: Optional[int] = Field(None, ge=5, le=10, title='Duration') + stream: Optional[bool] = Field( + False, + description='If set to true, the model response data will be streamed to the client\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\nSee the [Streaming section below](/docs/api-reference/responses-streaming)\nfor more information.\n', + ) + usage: Optional[ResponseUsage] = None -class PikaVideoResponse(BaseModel): - id: str = Field(..., title='Id') - status: PikaStatusEnum = Field( - ..., description='The status of the video', title='Status' - ) - url: Optional[str] = Field(None, title='Url') - progress: Optional[int] = Field(None, title='Progress') - - -class Node(BaseModel): - id: Optional[str] = Field(None, description='The unique identifier of the node.') - name: Optional[str] = Field(None, description='The display name of the node.') - category: Optional[str] = Field(None, description='The category of the node.') - description: Optional[str] = None - author: Optional[str] = None - license: Optional[str] = Field( - None, description="The path to the LICENSE file in the node's repository." - ) - icon: Optional[str] = Field(None, description="URL to the node's icon.") - repository: Optional[str] = Field(None, description="URL to the node's repository.") - tags: Optional[List[str]] = None - latest_version: Optional[NodeVersion] = Field( - None, description='The latest version of the node.' - ) - rating: Optional[float] = Field(None, description='The average rating of the node.') - downloads: Optional[int] = Field( - None, description='The number of downloads of the node.' - ) - publisher: Optional[Publisher] = Field( - None, description='The publisher of the node.' - ) - status: Optional[NodeStatus] = Field(None, description='The status of the node.') - status_detail: Optional[str] = Field( - None, description='The status detail of the node.' - ) - translations: Optional[Dict[str, Dict[str, Any]]] = None - - -class KlingVideoEffectsRequest(BaseModel): - effect_scene: Union[KlingDualCharacterEffectsScene, KlingSingleImageEffectsScene] - input: KlingVideoEffectsInput - callback_url: Optional[AnyUrl] = Field( +class OpenAIResponse(ModelResponseProperties, ResponseProperties): + created_at: Optional[float] = Field( None, - description='The callback notification address for the result of this task.', + description='Unix timestamp (in seconds) of when this Response was created.', ) - external_task_id: Optional[str] = Field( + error: Optional[ResponseError] = None + id: Optional[str] = Field(None, description='Unique identifier for this Response.') + incomplete_details: Optional[IncompleteDetails] = Field( + None, description='Details about why the response is incomplete.\n' + ) + object: Optional[Object] = Field( + None, description='The object type of this resource - always set to `response`.' + ) + output: Optional[List[OutputItem]] = Field( None, - description='Customized Task ID. Must be unique within a single user account.', + description="An array of content items generated by the model.\n\n- The length and order of items in the `output` array is dependent\n on the model's response.\n- Rather than accessing the first item in the `output` array and \n assuming it's an `assistant` message with the content generated by\n the model, you might consider using the `output_text` property where\n supported in SDKs.\n", ) - - -class StripeCharge(BaseModel): - id: Optional[str] = None - object: Optional[Object2] = None - amount: Optional[int] = None - amount_captured: Optional[int] = None - amount_refunded: Optional[int] = None - application: Optional[str] = None - application_fee: Optional[str] = None - application_fee_amount: Optional[int] = None - balance_transaction: Optional[str] = None - billing_details: Optional[StripeBillingDetails] = None - calculated_statement_descriptor: Optional[str] = None - captured: Optional[bool] = None - created: Optional[int] = None - currency: Optional[str] = None - customer: Optional[str] = None - description: Optional[str] = None - destination: Optional[Any] = None - dispute: Optional[Any] = None - disputed: Optional[bool] = None - failure_balance_transaction: Optional[Any] = None - failure_code: Optional[Any] = None - failure_message: Optional[Any] = None - fraud_details: Optional[Dict[str, Any]] = None - invoice: Optional[Any] = None - livemode: Optional[bool] = None - metadata: Optional[Dict[str, Any]] = None - on_behalf_of: Optional[Any] = None - order: Optional[Any] = None - outcome: Optional[StripeOutcome] = None - paid: Optional[bool] = None - payment_intent: Optional[str] = None - payment_method: Optional[str] = None - payment_method_details: Optional[StripePaymentMethodDetails] = None - radar_options: Optional[Dict[str, Any]] = None - receipt_email: Optional[str] = None - receipt_number: Optional[str] = None - receipt_url: Optional[str] = None - refunded: Optional[bool] = None - refunds: Optional[StripeRefundList] = None - review: Optional[Any] = None - shipping: Optional[StripeShipping] = None - source: Optional[Any] = None - source_transfer: Optional[Any] = None - statement_descriptor: Optional[Any] = None - statement_descriptor_suffix: Optional[Any] = None - status: Optional[str] = None - transfer_data: Optional[Any] = None - transfer_group: Optional[Any] = None - - -class StripeChargeList(BaseModel): - object: Optional[str] = None - data: Optional[List[StripeCharge]] = None - has_more: Optional[bool] = None - total_count: Optional[int] = None - url: Optional[str] = None - - -class StripePaymentIntent(BaseModel): - id: Optional[str] = None - object: Optional[Object1] = None - amount: Optional[int] = None - amount_capturable: Optional[int] = None - amount_details: Optional[StripeAmountDetails] = None - amount_received: Optional[int] = None - application: Optional[str] = None - application_fee_amount: Optional[int] = None - automatic_payment_methods: Optional[Any] = None - canceled_at: Optional[int] = None - cancellation_reason: Optional[str] = None - capture_method: Optional[str] = None - charges: Optional[StripeChargeList] = None - client_secret: Optional[str] = None - confirmation_method: Optional[str] = None - created: Optional[int] = None - currency: Optional[str] = None - customer: Optional[str] = None - description: Optional[str] = None - invoice: Optional[str] = None - last_payment_error: Optional[Any] = None - latest_charge: Optional[str] = None - livemode: Optional[bool] = None - metadata: Optional[Dict[str, Any]] = None - next_action: Optional[Any] = None - on_behalf_of: Optional[Any] = None - payment_method: Optional[str] = None - payment_method_configuration_details: Optional[Any] = None - payment_method_options: Optional[StripePaymentMethodOptions] = None - payment_method_types: Optional[List[str]] = None - processing: Optional[Any] = None - receipt_email: Optional[str] = None - review: Optional[Any] = None - setup_future_usage: Optional[Any] = None - shipping: Optional[StripeShipping] = None - source: Optional[Any] = None - statement_descriptor: Optional[Any] = None - statement_descriptor_suffix: Optional[Any] = None - status: Optional[str] = None - transfer_data: Optional[Any] = None - transfer_group: Optional[Any] = None - - -class Data8(BaseModel): - object: Optional[StripePaymentIntent] = None - - -class StripeEvent(BaseModel): - id: str - object: Object - api_version: Optional[str] = None - created: Optional[int] = None - data: Data8 - livemode: Optional[bool] = None - pending_webhooks: Optional[int] = None - request: Optional[StripeRequestInfo] = None - type: Type + output_text: Optional[str] = Field( + None, + description='SDK-only convenience property that contains the aggregated text output \nfrom all `output_text` items in the `output` array, if any are present. \nSupported in the Python and JavaScript SDKs.\n', + ) + parallel_tool_calls: Optional[bool] = Field( + True, description='Whether to allow the model to run tool calls in parallel.\n' + ) + status: Optional[Status6] = Field( + None, + description='The status of the response generation. One of `completed`, `failed`, `in_progress`, or `incomplete`.', + ) + usage: Optional[ResponseUsage] = None diff --git a/comfy_api_nodes/apis/client.py b/comfy_api_nodes/apis/client.py index 62866216f..0897d5d78 100644 --- a/comfy_api_nodes/apis/client.py +++ b/comfy_api_nodes/apis/client.py @@ -139,7 +139,7 @@ class EmptyRequest(BaseModel): class UploadRequest(BaseModel): file_name: str = Field(..., description="Filename to upload") - content_type: str | None = Field( + content_type: Optional[str] = Field( None, description="Mime type of the file. For example: image/png, image/jpeg, video/mp4, etc.", ) diff --git a/comfy_api_nodes/apis/rodin_api.py b/comfy_api_nodes/apis/rodin_api.py new file mode 100644 index 000000000..b0cf171fa --- /dev/null +++ b/comfy_api_nodes/apis/rodin_api.py @@ -0,0 +1,57 @@ +from __future__ import annotations + +from enum import Enum +from typing import Optional, List +from pydantic import BaseModel, Field + + +class Rodin3DGenerateRequest(BaseModel): + seed: int = Field(..., description="seed_") + tier: str = Field(..., description="Tier of generation.") + material: str = Field(..., description="The material type.") + quality: str = Field(..., description="The generation quality of the mesh.") + mesh_mode: str = Field(..., description="It controls the type of faces of generated models.") + +class GenerateJobsData(BaseModel): + uuids: List[str] = Field(..., description="str LIST") + subscription_key: str = Field(..., description="subscription key") + +class Rodin3DGenerateResponse(BaseModel): + message: Optional[str] = Field(None, description="Return message.") + prompt: Optional[str] = Field(None, description="Generated Prompt from image.") + submit_time: Optional[str] = Field(None, description="Submit Time") + uuid: Optional[str] = Field(None, description="Task str") + jobs: Optional[GenerateJobsData] = Field(None, description="Details of jobs") + +class JobStatus(str, Enum): + """ + Status for jobs + """ + Done = "Done" + Failed = "Failed" + Generating = "Generating" + Waiting = "Waiting" + +class Rodin3DCheckStatusRequest(BaseModel): + subscription_key: str = Field(..., description="subscription from generate endpoint") + +class JobItem(BaseModel): + uuid: str = Field(..., description="uuid") + status: JobStatus = Field(...,description="Status Currently") + +class Rodin3DCheckStatusResponse(BaseModel): + jobs: List[JobItem] = Field(..., description="Job status List") + +class Rodin3DDownloadRequest(BaseModel): + task_uuid: str = Field(..., description="Task str") + +class RodinResourceItem(BaseModel): + url: str = Field(..., description="Download Url") + name: str = Field(..., description="File name with ext") + +class Rodin3DDownloadResponse(BaseModel): + list: List[RodinResourceItem] = Field(..., description="Source List") + + + + diff --git a/comfy_api_nodes/apis/tripo_api.py b/comfy_api_nodes/apis/tripo_api.py new file mode 100644 index 000000000..626e8d277 --- /dev/null +++ b/comfy_api_nodes/apis/tripo_api.py @@ -0,0 +1,275 @@ +from __future__ import annotations +from comfy_api_nodes.apis import ( + TripoModelVersion, + TripoTextureQuality, +) +from enum import Enum +from typing import Optional, List, Dict, Any, Union + +from pydantic import BaseModel, Field, RootModel + +class TripoStyle(str, Enum): + PERSON_TO_CARTOON = "person:person2cartoon" + ANIMAL_VENOM = "animal:venom" + OBJECT_CLAY = "object:clay" + OBJECT_STEAMPUNK = "object:steampunk" + OBJECT_CHRISTMAS = "object:christmas" + OBJECT_BARBIE = "object:barbie" + GOLD = "gold" + ANCIENT_BRONZE = "ancient_bronze" + NONE = "None" + +class TripoTaskType(str, Enum): + TEXT_TO_MODEL = "text_to_model" + IMAGE_TO_MODEL = "image_to_model" + MULTIVIEW_TO_MODEL = "multiview_to_model" + TEXTURE_MODEL = "texture_model" + REFINE_MODEL = "refine_model" + ANIMATE_PRERIGCHECK = "animate_prerigcheck" + ANIMATE_RIG = "animate_rig" + ANIMATE_RETARGET = "animate_retarget" + STYLIZE_MODEL = "stylize_model" + CONVERT_MODEL = "convert_model" + +class TripoTextureAlignment(str, Enum): + ORIGINAL_IMAGE = "original_image" + GEOMETRY = "geometry" + +class TripoOrientation(str, Enum): + ALIGN_IMAGE = "align_image" + DEFAULT = "default" + +class TripoOutFormat(str, Enum): + GLB = "glb" + FBX = "fbx" + +class TripoTopology(str, Enum): + BIP = "bip" + QUAD = "quad" + +class TripoSpec(str, Enum): + MIXAMO = "mixamo" + TRIPO = "tripo" + +class TripoAnimation(str, Enum): + IDLE = "preset:idle" + WALK = "preset:walk" + CLIMB = "preset:climb" + JUMP = "preset:jump" + RUN = "preset:run" + SLASH = "preset:slash" + SHOOT = "preset:shoot" + HURT = "preset:hurt" + FALL = "preset:fall" + TURN = "preset:turn" + +class TripoStylizeStyle(str, Enum): + LEGO = "lego" + VOXEL = "voxel" + VORONOI = "voronoi" + MINECRAFT = "minecraft" + +class TripoConvertFormat(str, Enum): + GLTF = "GLTF" + USDZ = "USDZ" + FBX = "FBX" + OBJ = "OBJ" + STL = "STL" + _3MF = "3MF" + +class TripoTextureFormat(str, Enum): + BMP = "BMP" + DPX = "DPX" + HDR = "HDR" + JPEG = "JPEG" + OPEN_EXR = "OPEN_EXR" + PNG = "PNG" + TARGA = "TARGA" + TIFF = "TIFF" + WEBP = "WEBP" + +class TripoTaskStatus(str, Enum): + QUEUED = "queued" + RUNNING = "running" + SUCCESS = "success" + FAILED = "failed" + CANCELLED = "cancelled" + UNKNOWN = "unknown" + BANNED = "banned" + EXPIRED = "expired" + +class TripoFileTokenReference(BaseModel): + type: Optional[str] = Field(None, description='The type of the reference') + file_token: str + +class TripoUrlReference(BaseModel): + type: Optional[str] = Field(None, description='The type of the reference') + url: str + +class TripoObjectStorage(BaseModel): + bucket: str + key: str + +class TripoObjectReference(BaseModel): + type: str + object: TripoObjectStorage + +class TripoFileEmptyReference(BaseModel): + pass + +class TripoFileReference(RootModel): + root: Union[TripoFileTokenReference, TripoUrlReference, TripoObjectReference, TripoFileEmptyReference] + +class TripoGetStsTokenRequest(BaseModel): + format: str = Field(..., description='The format of the image') + +class TripoTextToModelRequest(BaseModel): + type: TripoTaskType = Field(TripoTaskType.TEXT_TO_MODEL, description='Type of task') + prompt: str = Field(..., description='The text prompt describing the model to generate', max_length=1024) + negative_prompt: Optional[str] = Field(None, description='The negative text prompt', max_length=1024) + model_version: Optional[TripoModelVersion] = TripoModelVersion.V2_5 + face_limit: Optional[int] = Field(None, description='The number of faces to limit the generation to') + texture: Optional[bool] = Field(True, description='Whether to apply texture to the generated model') + pbr: Optional[bool] = Field(True, description='Whether to apply PBR to the generated model') + image_seed: Optional[int] = Field(None, description='The seed for the text') + model_seed: Optional[int] = Field(None, description='The seed for the model') + texture_seed: Optional[int] = Field(None, description='The seed for the texture') + texture_quality: Optional[TripoTextureQuality] = TripoTextureQuality.standard + style: Optional[TripoStyle] = None + auto_size: Optional[bool] = Field(False, description='Whether to auto-size the model') + quad: Optional[bool] = Field(False, description='Whether to apply quad to the generated model') + +class TripoImageToModelRequest(BaseModel): + type: TripoTaskType = Field(TripoTaskType.IMAGE_TO_MODEL, description='Type of task') + file: TripoFileReference = Field(..., description='The file reference to convert to a model') + model_version: Optional[TripoModelVersion] = Field(None, description='The model version to use for generation') + face_limit: Optional[int] = Field(None, description='The number of faces to limit the generation to') + texture: Optional[bool] = Field(True, description='Whether to apply texture to the generated model') + pbr: Optional[bool] = Field(True, description='Whether to apply PBR to the generated model') + model_seed: Optional[int] = Field(None, description='The seed for the model') + texture_seed: Optional[int] = Field(None, description='The seed for the texture') + texture_quality: Optional[TripoTextureQuality] = TripoTextureQuality.standard + texture_alignment: Optional[TripoTextureAlignment] = Field(TripoTextureAlignment.ORIGINAL_IMAGE, description='The texture alignment method') + style: Optional[TripoStyle] = Field(None, description='The style to apply to the generated model') + auto_size: Optional[bool] = Field(False, description='Whether to auto-size the model') + orientation: Optional[TripoOrientation] = TripoOrientation.DEFAULT + quad: Optional[bool] = Field(False, description='Whether to apply quad to the generated model') + +class TripoMultiviewToModelRequest(BaseModel): + type: TripoTaskType = TripoTaskType.MULTIVIEW_TO_MODEL + files: List[TripoFileReference] = Field(..., description='The file references to convert to a model') + model_version: Optional[TripoModelVersion] = Field(None, description='The model version to use for generation') + orthographic_projection: Optional[bool] = Field(False, description='Whether to use orthographic projection') + face_limit: Optional[int] = Field(None, description='The number of faces to limit the generation to') + texture: Optional[bool] = Field(True, description='Whether to apply texture to the generated model') + pbr: Optional[bool] = Field(True, description='Whether to apply PBR to the generated model') + model_seed: Optional[int] = Field(None, description='The seed for the model') + texture_seed: Optional[int] = Field(None, description='The seed for the texture') + texture_quality: Optional[TripoTextureQuality] = TripoTextureQuality.standard + texture_alignment: Optional[TripoTextureAlignment] = TripoTextureAlignment.ORIGINAL_IMAGE + auto_size: Optional[bool] = Field(False, description='Whether to auto-size the model') + orientation: Optional[TripoOrientation] = Field(TripoOrientation.DEFAULT, description='The orientation for the model') + quad: Optional[bool] = Field(False, description='Whether to apply quad to the generated model') + +class TripoTextureModelRequest(BaseModel): + type: TripoTaskType = Field(TripoTaskType.TEXTURE_MODEL, description='Type of task') + original_model_task_id: str = Field(..., description='The task ID of the original model') + texture: Optional[bool] = Field(True, description='Whether to apply texture to the model') + pbr: Optional[bool] = Field(True, description='Whether to apply PBR to the model') + model_seed: Optional[int] = Field(None, description='The seed for the model') + texture_seed: Optional[int] = Field(None, description='The seed for the texture') + texture_quality: Optional[TripoTextureQuality] = Field(None, description='The quality of the texture') + texture_alignment: Optional[TripoTextureAlignment] = Field(TripoTextureAlignment.ORIGINAL_IMAGE, description='The texture alignment method') + +class TripoRefineModelRequest(BaseModel): + type: TripoTaskType = Field(TripoTaskType.REFINE_MODEL, description='Type of task') + draft_model_task_id: str = Field(..., description='The task ID of the draft model') + +class TripoAnimatePrerigcheckRequest(BaseModel): + type: TripoTaskType = Field(TripoTaskType.ANIMATE_PRERIGCHECK, description='Type of task') + original_model_task_id: str = Field(..., description='The task ID of the original model') + +class TripoAnimateRigRequest(BaseModel): + type: TripoTaskType = Field(TripoTaskType.ANIMATE_RIG, description='Type of task') + original_model_task_id: str = Field(..., description='The task ID of the original model') + out_format: Optional[TripoOutFormat] = Field(TripoOutFormat.GLB, description='The output format') + spec: Optional[TripoSpec] = Field(TripoSpec.TRIPO, description='The specification for rigging') + +class TripoAnimateRetargetRequest(BaseModel): + type: TripoTaskType = Field(TripoTaskType.ANIMATE_RETARGET, description='Type of task') + original_model_task_id: str = Field(..., description='The task ID of the original model') + animation: TripoAnimation = Field(..., description='The animation to apply') + out_format: Optional[TripoOutFormat] = Field(TripoOutFormat.GLB, description='The output format') + bake_animation: Optional[bool] = Field(True, description='Whether to bake the animation') + +class TripoStylizeModelRequest(BaseModel): + type: TripoTaskType = Field(TripoTaskType.STYLIZE_MODEL, description='Type of task') + style: TripoStylizeStyle = Field(..., description='The style to apply to the model') + original_model_task_id: str = Field(..., description='The task ID of the original model') + block_size: Optional[int] = Field(80, description='The block size for stylization') + +class TripoConvertModelRequest(BaseModel): + type: TripoTaskType = Field(TripoTaskType.CONVERT_MODEL, description='Type of task') + format: TripoConvertFormat = Field(..., description='The format to convert to') + original_model_task_id: str = Field(..., description='The task ID of the original model') + quad: Optional[bool] = Field(False, description='Whether to apply quad to the model') + force_symmetry: Optional[bool] = Field(False, description='Whether to force symmetry') + face_limit: Optional[int] = Field(10000, description='The number of faces to limit the conversion to') + flatten_bottom: Optional[bool] = Field(False, description='Whether to flatten the bottom of the model') + flatten_bottom_threshold: Optional[float] = Field(0.01, description='The threshold for flattening the bottom') + texture_size: Optional[int] = Field(4096, description='The size of the texture') + texture_format: Optional[TripoTextureFormat] = Field(TripoTextureFormat.JPEG, description='The format of the texture') + pivot_to_center_bottom: Optional[bool] = Field(False, description='Whether to pivot to the center bottom') + +class TripoTaskRequest(RootModel): + root: Union[ + TripoTextToModelRequest, + TripoImageToModelRequest, + TripoMultiviewToModelRequest, + TripoTextureModelRequest, + TripoRefineModelRequest, + TripoAnimatePrerigcheckRequest, + TripoAnimateRigRequest, + TripoAnimateRetargetRequest, + TripoStylizeModelRequest, + TripoConvertModelRequest + ] + +class TripoTaskOutput(BaseModel): + model: Optional[str] = Field(None, description='URL to the model') + base_model: Optional[str] = Field(None, description='URL to the base model') + pbr_model: Optional[str] = Field(None, description='URL to the PBR model') + rendered_image: Optional[str] = Field(None, description='URL to the rendered image') + riggable: Optional[bool] = Field(None, description='Whether the model is riggable') + +class TripoTask(BaseModel): + task_id: str = Field(..., description='The task ID') + type: Optional[str] = Field(None, description='The type of task') + status: Optional[TripoTaskStatus] = Field(None, description='The status of the task') + input: Optional[Dict[str, Any]] = Field(None, description='The input parameters for the task') + output: Optional[TripoTaskOutput] = Field(None, description='The output of the task') + progress: Optional[int] = Field(None, description='The progress of the task', ge=0, le=100) + create_time: Optional[int] = Field(None, description='The creation time of the task') + running_left_time: Optional[int] = Field(None, description='The estimated time left for the task') + queue_position: Optional[int] = Field(None, description='The position in the queue') + +class TripoTaskResponse(BaseModel): + code: int = Field(0, description='The response code') + data: TripoTask = Field(..., description='The task data') + +class TripoGeneralResponse(BaseModel): + code: int = Field(0, description='The response code') + data: Dict[str, str] = Field(..., description='The task ID data') + +class TripoBalanceData(BaseModel): + balance: float = Field(..., description='The account balance') + frozen: float = Field(..., description='The frozen balance') + +class TripoBalanceResponse(BaseModel): + code: int = Field(0, description='The response code') + data: TripoBalanceData = Field(..., description='The balance data') + +class TripoErrorResponse(BaseModel): + code: int = Field(..., description='The error code') + message: str = Field(..., description='The error message') + suggestion: str = Field(..., description='The suggestion for fixing the error') diff --git a/comfy_api_nodes/nodes_gemini.py b/comfy_api_nodes/nodes_gemini.py new file mode 100644 index 000000000..ae7b04846 --- /dev/null +++ b/comfy_api_nodes/nodes_gemini.py @@ -0,0 +1,446 @@ +""" +API Nodes for Gemini Multimodal LLM Usage via Remote API +See: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference +""" + +import os +from enum import Enum +from typing import Optional, Literal + +import torch + +import folder_paths +from comfy.comfy_types.node_typing import IO, ComfyNodeABC, InputTypeDict +from server import PromptServer +from comfy_api_nodes.apis import ( + GeminiContent, + GeminiGenerateContentRequest, + GeminiGenerateContentResponse, + GeminiInlineData, + GeminiPart, + GeminiMimeType, +) +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, +) +from comfy_api_nodes.apinode_utils import ( + validate_string, + audio_to_base64_string, + video_to_base64_string, + tensor_to_base64_string, +) + + +GEMINI_BASE_ENDPOINT = "/proxy/vertexai/gemini" +GEMINI_MAX_INPUT_FILE_SIZE = 20 * 1024 * 1024 # 20 MB + + +class GeminiModel(str, Enum): + """ + Gemini Model Names allowed by comfy-api + """ + + gemini_2_5_pro_preview_05_06 = "gemini-2.5-pro-preview-05-06" + gemini_2_5_flash_preview_04_17 = "gemini-2.5-flash-preview-04-17" + + +def get_gemini_endpoint( + model: GeminiModel, +) -> ApiEndpoint[GeminiGenerateContentRequest, GeminiGenerateContentResponse]: + """ + Get the API endpoint for a given Gemini model. + + Args: + model: The Gemini model to use, either as enum or string value. + + Returns: + ApiEndpoint configured for the specific Gemini model. + """ + if isinstance(model, str): + model = GeminiModel(model) + return ApiEndpoint( + path=f"{GEMINI_BASE_ENDPOINT}/{model.value}", + method=HttpMethod.POST, + request_model=GeminiGenerateContentRequest, + response_model=GeminiGenerateContentResponse, + ) + + +class GeminiNode(ComfyNodeABC): + """ + Node to generate text responses from a Gemini model. + + This node allows users to interact with Google's Gemini AI models, providing + multimodal inputs (text, images, audio, video, files) to generate coherent + text responses. The node works with the latest Gemini models, handling the + API communication and response parsing. + """ + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Text inputs to the model, used to generate a response. You can include detailed instructions, questions, or context for the model.", + }, + ), + "model": ( + IO.COMBO, + { + "tooltip": "The Gemini model to use for generating responses.", + "options": [model.value for model in GeminiModel], + "default": GeminiModel.gemini_2_5_pro_preview_05_06.value, + }, + ), + "seed": ( + IO.INT, + { + "default": 42, + "min": 0, + "max": 0xFFFFFFFFFFFFFFFF, + "control_after_generate": True, + "tooltip": "When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. Deterministic output isn't guaranteed. Also, changing the model or parameter settings, such as the temperature, can cause variations in the response even when you use the same seed value. By default, a random seed value is used.", + }, + ), + }, + "optional": { + "images": ( + IO.IMAGE, + { + "default": None, + "tooltip": "Optional image(s) to use as context for the model. To include multiple images, you can use the Batch Images node.", + }, + ), + "audio": ( + IO.AUDIO, + { + "tooltip": "Optional audio to use as context for the model.", + "default": None, + }, + ), + "video": ( + IO.VIDEO, + { + "tooltip": "Optional video to use as context for the model.", + "default": None, + }, + ), + "files": ( + "GEMINI_INPUT_FILES", + { + "default": None, + "tooltip": "Optional file(s) to use as context for the model. Accepts inputs from the Gemini Generate Content Input Files node.", + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", + }, + } + + DESCRIPTION = "Generate text responses with Google's Gemini AI model. You can provide multiple types of inputs (text, images, audio, video) as context for generating more relevant and meaningful responses." + RETURN_TYPES = ("STRING",) + FUNCTION = "api_call" + CATEGORY = "api node/text/Gemini" + API_NODE = True + + def get_parts_from_response( + self, response: GeminiGenerateContentResponse + ) -> list[GeminiPart]: + """ + Extract all parts from the Gemini API response. + + Args: + response: The API response from Gemini. + + Returns: + List of response parts from the first candidate. + """ + return response.candidates[0].content.parts + + def get_parts_by_type( + self, response: GeminiGenerateContentResponse, part_type: Literal["text"] | str + ) -> list[GeminiPart]: + """ + Filter response parts by their type. + + Args: + response: The API response from Gemini. + part_type: Type of parts to extract ("text" or a MIME type). + + Returns: + List of response parts matching the requested type. + """ + parts = [] + for part in self.get_parts_from_response(response): + if part_type == "text" and hasattr(part, "text") and part.text: + parts.append(part) + elif ( + hasattr(part, "inlineData") + and part.inlineData + and part.inlineData.mimeType == part_type + ): + parts.append(part) + # Skip parts that don't match the requested type + return parts + + def get_text_from_response(self, response: GeminiGenerateContentResponse) -> str: + """ + Extract and concatenate all text parts from the response. + + Args: + response: The API response from Gemini. + + Returns: + Combined text from all text parts in the response. + """ + parts = self.get_parts_by_type(response, "text") + return "\n".join([part.text for part in parts]) + + def create_video_parts(self, video_input: IO.VIDEO, **kwargs) -> list[GeminiPart]: + """ + Convert video input to Gemini API compatible parts. + + Args: + video_input: Video tensor from ComfyUI. + **kwargs: Additional arguments to pass to the conversion function. + + Returns: + List of GeminiPart objects containing the encoded video. + """ + from comfy_api.util import VideoContainer, VideoCodec + base_64_string = video_to_base64_string( + video_input, + container_format=VideoContainer.MP4, + codec=VideoCodec.H264 + ) + return [ + GeminiPart( + inlineData=GeminiInlineData( + mimeType=GeminiMimeType.video_mp4, + data=base_64_string, + ) + ) + ] + + def create_audio_parts(self, audio_input: IO.AUDIO) -> list[GeminiPart]: + """ + Convert audio input to Gemini API compatible parts. + + Args: + audio_input: Audio input from ComfyUI, containing waveform tensor and sample rate. + + Returns: + List of GeminiPart objects containing the encoded audio. + """ + audio_parts: list[GeminiPart] = [] + for batch_index in range(audio_input["waveform"].shape[0]): + # Recreate an IO.AUDIO object for the given batch dimension index + audio_at_index = { + "waveform": audio_input["waveform"][batch_index].unsqueeze(0), + "sample_rate": audio_input["sample_rate"], + } + # Convert to MP3 format for compatibility with Gemini API + audio_bytes = audio_to_base64_string( + audio_at_index, + container_format="mp3", + codec_name="libmp3lame", + ) + audio_parts.append( + GeminiPart( + inlineData=GeminiInlineData( + mimeType=GeminiMimeType.audio_mp3, + data=audio_bytes, + ) + ) + ) + return audio_parts + + def create_image_parts(self, image_input: torch.Tensor) -> list[GeminiPart]: + """ + Convert image tensor input to Gemini API compatible parts. + + Args: + image_input: Batch of image tensors from ComfyUI. + + Returns: + List of GeminiPart objects containing the encoded images. + """ + image_parts: list[GeminiPart] = [] + for image_index in range(image_input.shape[0]): + image_as_b64 = tensor_to_base64_string( + image_input[image_index].unsqueeze(0) + ) + image_parts.append( + GeminiPart( + inlineData=GeminiInlineData( + mimeType=GeminiMimeType.image_png, + data=image_as_b64, + ) + ) + ) + return image_parts + + def create_text_part(self, text: str) -> GeminiPart: + """ + Create a text part for the Gemini API request. + + Args: + text: The text content to include in the request. + + Returns: + A GeminiPart object with the text content. + """ + return GeminiPart(text=text) + + def api_call( + self, + prompt: str, + model: GeminiModel, + images: Optional[IO.IMAGE] = None, + audio: Optional[IO.AUDIO] = None, + video: Optional[IO.VIDEO] = None, + files: Optional[list[GeminiPart]] = None, + unique_id: Optional[str] = None, + **kwargs, + ) -> tuple[str]: + # Validate inputs + validate_string(prompt, strip_whitespace=False) + + # Create parts list with text prompt as the first part + parts: list[GeminiPart] = [self.create_text_part(prompt)] + + # Add other modal parts + if images is not None: + image_parts = self.create_image_parts(images) + parts.extend(image_parts) + if audio is not None: + parts.extend(self.create_audio_parts(audio)) + if video is not None: + parts.extend(self.create_video_parts(video)) + if files is not None: + parts.extend(files) + + # Create response + response = SynchronousOperation( + endpoint=get_gemini_endpoint(model), + request=GeminiGenerateContentRequest( + contents=[ + GeminiContent( + role="user", + parts=parts, + ) + ] + ), + auth_kwargs=kwargs, + ).execute() + + # Get result output + output_text = self.get_text_from_response(response) + if unique_id and output_text: + PromptServer.instance.send_progress_text(output_text, node_id=unique_id) + + return (output_text or "Empty response from Gemini model...",) + + +class GeminiInputFiles(ComfyNodeABC): + """ + Loads and formats input files for use with the Gemini API. + + This node allows users to include text (.txt) and PDF (.pdf) files as input + context for the Gemini model. Files are converted to the appropriate format + required by the API and can be chained together to include multiple files + in a single request. + """ + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + """ + For details about the supported file input types, see: + https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference + """ + input_dir = folder_paths.get_input_directory() + input_files = [ + f + for f in os.scandir(input_dir) + if f.is_file() + and (f.name.endswith(".txt") or f.name.endswith(".pdf")) + and f.stat().st_size < GEMINI_MAX_INPUT_FILE_SIZE + ] + input_files = sorted(input_files, key=lambda x: x.name) + input_files = [f.name for f in input_files] + return { + "required": { + "file": ( + IO.COMBO, + { + "tooltip": "Input files to include as context for the model. Only accepts text (.txt) and PDF (.pdf) files for now.", + "options": input_files, + "default": input_files[0] if input_files else None, + }, + ), + }, + "optional": { + "GEMINI_INPUT_FILES": ( + "GEMINI_INPUT_FILES", + { + "tooltip": "An optional additional file(s) to batch together with the file loaded from this node. Allows chaining of input files so that a single message can include multiple input files.", + "default": None, + }, + ), + }, + } + + DESCRIPTION = "Loads and prepares input files to include as inputs for Gemini LLM nodes. The files will be read by the Gemini model when generating a response. The contents of the text file count toward the token limit. 🛈 TIP: Can be chained together with other Gemini Input File nodes." + RETURN_TYPES = ("GEMINI_INPUT_FILES",) + FUNCTION = "prepare_files" + CATEGORY = "api node/text/Gemini" + + def create_file_part(self, file_path: str) -> GeminiPart: + mime_type = ( + GeminiMimeType.pdf + if file_path.endswith(".pdf") + else GeminiMimeType.text_plain + ) + # Use base64 string directly, not the data URI + with open(file_path, "rb") as f: + file_content = f.read() + import base64 + base64_str = base64.b64encode(file_content).decode("utf-8") + + return GeminiPart( + inlineData=GeminiInlineData( + mimeType=mime_type, + data=base64_str, + ) + ) + + def prepare_files( + self, file: str, GEMINI_INPUT_FILES: list[GeminiPart] = [] + ) -> tuple[list[GeminiPart]]: + """ + Loads and formats input files for Gemini API. + """ + file_path = folder_paths.get_annotated_filepath(file) + input_file_content = self.create_file_part(file_path) + files = [input_file_content] + GEMINI_INPUT_FILES + return (files,) + + +NODE_CLASS_MAPPINGS = { + "GeminiNode": GeminiNode, + "GeminiInputFiles": GeminiInputFiles, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "GeminiNode": "Google Gemini", + "GeminiInputFiles": "Gemini Input Files", +} diff --git a/comfy_api_nodes/nodes_openai.py b/comfy_api_nodes/nodes_openai.py index ce8054afc..be1d2de4a 100644 --- a/comfy_api_nodes/nodes_openai.py +++ b/comfy_api_nodes/nodes_openai.py @@ -1,29 +1,86 @@ import io +from typing import TypedDict, Optional +import json +import os +import time +import re +import uuid +from enum import Enum from inspect import cleandoc import numpy as np import torch from PIL import Image - from comfy.comfy_types.node_typing import IO, ComfyNodeABC, InputTypeDict +from server import PromptServer +import folder_paths from comfy_api_nodes.apis import ( OpenAIImageGenerationRequest, OpenAIImageEditRequest, OpenAIImageGenerationResponse, + OpenAICreateResponse, + OpenAIResponse, + CreateModelResponseProperties, + Item, + Includable, + OutputContent, + InputImageContent, + Detail, + InputTextContent, + InputMessage, + InputMessageContentList, + InputContent, + InputFileContent, ) from comfy_api_nodes.apis.client import ( ApiEndpoint, HttpMethod, SynchronousOperation, + PollingOperation, + EmptyRequest, ) from comfy_api_nodes.apinode_utils import ( downscale_image_tensor, validate_and_cast_response, validate_string, + tensor_to_base64_string, + text_filepath_to_data_uri, ) +from comfy_api_nodes.mapper_utils import model_field_to_node_input + + +RESPONSES_ENDPOINT = "/proxy/openai/v1/responses" +STARTING_POINT_ID_PATTERN = r"" + + +class HistoryEntry(TypedDict): + """Type definition for a single history entry in the chat.""" + + prompt: str + response: str + response_id: str + timestamp: float + + +class ChatHistory(TypedDict): + """Type definition for the chat history dictionary.""" + + __annotations__: dict[str, list[HistoryEntry]] + + +class SupportedOpenAIModel(str, Enum): + o4_mini = "o4-mini" + o1 = "o1" + o3 = "o3" + o1_pro = "o1-pro" + gpt_4o = "gpt-4o" + gpt_4_1 = "gpt-4.1" + gpt_4_1_mini = "gpt-4.1-mini" + gpt_4_1_nano = "gpt-4.1-nano" + class OpenAIDalle2(ComfyNodeABC): """ @@ -115,7 +172,7 @@ class OpenAIDalle2(ComfyNodeABC): n=1, size="1024x1024", unique_id=None, - **kwargs + **kwargs, ): validate_string(prompt, strip_whitespace=False) model = "dall-e-2" @@ -262,7 +319,7 @@ class OpenAIDalle3(ComfyNodeABC): quality="standard", size="1024x1024", unique_id=None, - **kwargs + **kwargs, ): validate_string(prompt, strip_whitespace=False) model = "dall-e-3" @@ -400,12 +457,12 @@ class OpenAIGPTImage1(ComfyNodeABC): n=1, size="1024x1024", unique_id=None, - **kwargs + **kwargs, ): validate_string(prompt, strip_whitespace=False) model = "gpt-image-1" path = "/proxy/openai/images/generations" - content_type="application/json" + content_type = "application/json" request_class = OpenAIImageGenerationRequest img_binaries = [] mask_binary = None @@ -414,7 +471,7 @@ class OpenAIGPTImage1(ComfyNodeABC): if image is not None: path = "/proxy/openai/images/edits" request_class = OpenAIImageEditRequest - content_type ="multipart/form-data" + content_type = "multipart/form-data" batch_size = image.shape[0] @@ -486,17 +543,466 @@ class OpenAIGPTImage1(ComfyNodeABC): return (img_tensor,) -# A dictionary that contains all nodes you want to export with their names -# NOTE: names should be globally unique +class OpenAITextNode(ComfyNodeABC): + """ + Base class for OpenAI text generation nodes. + """ + + RETURN_TYPES = (IO.STRING,) + FUNCTION = "api_call" + CATEGORY = "api node/text/OpenAI" + API_NODE = True + + +class OpenAIChatNode(OpenAITextNode): + """ + Node to generate text responses from an OpenAI model. + """ + + def __init__(self) -> None: + """Initialize the chat node with a new session ID and empty history.""" + self.current_session_id: str = str(uuid.uuid4()) + self.history: dict[str, list[HistoryEntry]] = {} + self.previous_response_id: Optional[str] = None + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": { + "prompt": ( + IO.STRING, + { + "multiline": True, + "default": "", + "tooltip": "Text inputs to the model, used to generate a response.", + }, + ), + "persist_context": ( + IO.BOOLEAN, + { + "default": True, + "tooltip": "Persist chat context between calls (multi-turn conversation)", + }, + ), + "model": model_field_to_node_input( + IO.COMBO, + OpenAICreateResponse, + "model", + enum_type=SupportedOpenAIModel, + ), + }, + "optional": { + "images": ( + IO.IMAGE, + { + "default": None, + "tooltip": "Optional image(s) to use as context for the model. To include multiple images, you can use the Batch Images node.", + }, + ), + "files": ( + "OPENAI_INPUT_FILES", + { + "default": None, + "tooltip": "Optional file(s) to use as context for the model. Accepts inputs from the OpenAI Chat Input Files node.", + }, + ), + "advanced_options": ( + "OPENAI_CHAT_CONFIG", + { + "default": None, + "tooltip": "Optional configuration for the model. Accepts inputs from the OpenAI Chat Advanced Options node.", + }, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", + }, + } + + DESCRIPTION = "Generate text responses from an OpenAI model." + + def get_result_response( + self, + response_id: str, + include: Optional[list[Includable]] = None, + auth_kwargs: Optional[dict[str, str]] = None, + ) -> OpenAIResponse: + """ + Retrieve a model response with the given ID from the OpenAI API. + + Args: + response_id (str): The ID of the response to retrieve. + include (Optional[List[Includable]]): Additional fields to include + in the response. See the `include` parameter for Response + creation above for more information. + + """ + return PollingOperation( + poll_endpoint=ApiEndpoint( + path=f"{RESPONSES_ENDPOINT}/{response_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=OpenAIResponse, + query_params={"include": include}, + ), + completed_statuses=["completed"], + failed_statuses=["failed"], + status_extractor=lambda response: response.status, + auth_kwargs=auth_kwargs, + ).execute() + + def get_message_content_from_response( + self, response: OpenAIResponse + ) -> list[OutputContent]: + """Extract message content from the API response.""" + for output in response.output: + if output.root.type == "message": + return output.root.content + raise TypeError("No output message found in response") + + def get_text_from_message_content( + self, message_content: list[OutputContent] + ) -> str: + """Extract text content from message content.""" + for content_item in message_content: + if content_item.root.type == "output_text": + return str(content_item.root.text) + return "No text output found in response" + + def get_history_text(self, session_id: str) -> str: + """Convert the entire history for a given session to JSON string.""" + return json.dumps(self.history[session_id]) + + def display_history_on_node(self, session_id: str, node_id: str) -> None: + """Display formatted chat history on the node UI.""" + render_spec = { + "node_id": node_id, + "component": "ChatHistoryWidget", + "props": { + "history": self.get_history_text(session_id), + }, + } + PromptServer.instance.send_sync( + "display_component", + render_spec, + ) + + def add_to_history( + self, session_id: str, prompt: str, output_text: str, response_id: str + ) -> None: + """Add a new entry to the chat history.""" + if session_id not in self.history: + self.history[session_id] = [] + self.history[session_id].append( + { + "prompt": prompt, + "response": output_text, + "response_id": response_id, + "timestamp": time.time(), + } + ) + + def parse_output_text_from_response(self, response: OpenAIResponse) -> str: + """Extract text output from the API response.""" + message_contents = self.get_message_content_from_response(response) + return self.get_text_from_message_content(message_contents) + + def generate_new_session_id(self) -> str: + """Generate a new unique session ID.""" + return str(uuid.uuid4()) + + def get_session_id(self, persist_context: bool) -> str: + """Get the current or generate a new session ID based on context persistence.""" + return ( + self.current_session_id + if persist_context + else self.generate_new_session_id() + ) + + def tensor_to_input_image_content( + self, image: torch.Tensor, detail_level: Detail = "auto" + ) -> InputImageContent: + """Convert a tensor to an input image content object.""" + return InputImageContent( + detail=detail_level, + image_url=f"data:image/png;base64,{tensor_to_base64_string(image)}", + type="input_image", + ) + + def create_input_message_contents( + self, + prompt: str, + image: Optional[torch.Tensor] = None, + files: Optional[list[InputFileContent]] = None, + ) -> InputMessageContentList: + """Create a list of input message contents from prompt and optional image.""" + content_list: list[InputContent] = [ + InputTextContent(text=prompt, type="input_text"), + ] + if image is not None: + for i in range(image.shape[0]): + content_list.append( + self.tensor_to_input_image_content(image[i].unsqueeze(0)) + ) + if files is not None: + content_list.extend(files) + + return InputMessageContentList( + root=content_list, + ) + + def parse_response_id_from_prompt(self, prompt: str) -> Optional[str]: + """Extract response ID from prompt if it exists.""" + parsed_id = re.search(STARTING_POINT_ID_PATTERN, prompt) + return parsed_id.group(1) if parsed_id else None + + def strip_response_tag_from_prompt(self, prompt: str) -> str: + """Remove the response ID tag from the prompt.""" + return re.sub(STARTING_POINT_ID_PATTERN, "", prompt.strip()) + + def delete_history_after_response_id( + self, new_start_id: str, session_id: str + ) -> None: + """Delete history entries after a specific response ID.""" + if session_id not in self.history: + return + + new_history = [] + i = 0 + while ( + i < len(self.history[session_id]) + and self.history[session_id][i]["response_id"] != new_start_id + ): + new_history.append(self.history[session_id][i]) + i += 1 + + # Since it's the new starting point (not the response being edited), we include it as well + if i < len(self.history[session_id]): + new_history.append(self.history[session_id][i]) + + self.history[session_id] = new_history + + def api_call( + self, + prompt: str, + persist_context: bool, + model: SupportedOpenAIModel, + unique_id: Optional[str] = None, + images: Optional[torch.Tensor] = None, + files: Optional[list[InputFileContent]] = None, + advanced_options: Optional[CreateModelResponseProperties] = None, + **kwargs, + ) -> tuple[str]: + # Validate inputs + validate_string(prompt, strip_whitespace=False) + + session_id = self.get_session_id(persist_context) + response_id_override = self.parse_response_id_from_prompt(prompt) + if response_id_override: + is_starting_from_beginning = response_id_override == "start" + if is_starting_from_beginning: + self.history[session_id] = [] + previous_response_id = None + else: + previous_response_id = response_id_override + self.delete_history_after_response_id(response_id_override, session_id) + prompt = self.strip_response_tag_from_prompt(prompt) + elif persist_context: + previous_response_id = self.previous_response_id + else: + previous_response_id = None + + # Create response + create_response = SynchronousOperation( + endpoint=ApiEndpoint( + path=RESPONSES_ENDPOINT, + method=HttpMethod.POST, + request_model=OpenAICreateResponse, + response_model=OpenAIResponse, + ), + request=OpenAICreateResponse( + input=[ + Item( + root=InputMessage( + content=self.create_input_message_contents( + prompt, images, files + ), + role="user", + ) + ), + ], + store=True, + stream=False, + model=model, + previous_response_id=previous_response_id, + **( + advanced_options.model_dump(exclude_none=True) + if advanced_options + else {} + ), + ), + auth_kwargs=kwargs, + ).execute() + response_id = create_response.id + + # Get result output + result_response = self.get_result_response(response_id, auth_kwargs=kwargs) + output_text = self.parse_output_text_from_response(result_response) + + # Update history + self.add_to_history(session_id, prompt, output_text, response_id) + self.display_history_on_node(session_id, unique_id) + self.previous_response_id = response_id + + return (output_text,) + + +class OpenAIInputFiles(ComfyNodeABC): + """ + Loads and formats input files for OpenAI API. + """ + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + """ + For details about the supported file input types, see: + https://platform.openai.com/docs/guides/pdf-files?api-mode=responses + """ + input_dir = folder_paths.get_input_directory() + input_files = [ + f + for f in os.scandir(input_dir) + if f.is_file() + and (f.name.endswith(".txt") or f.name.endswith(".pdf")) + and f.stat().st_size < 32 * 1024 * 1024 + ] + input_files = sorted(input_files, key=lambda x: x.name) + input_files = [f.name for f in input_files] + return { + "required": { + "file": ( + IO.COMBO, + { + "tooltip": "Input files to include as context for the model. Only accepts text (.txt) and PDF (.pdf) files for now.", + "options": input_files, + "default": input_files[0] if input_files else None, + }, + ), + }, + "optional": { + "OPENAI_INPUT_FILES": ( + "OPENAI_INPUT_FILES", + { + "tooltip": "An optional additional file(s) to batch together with the file loaded from this node. Allows chaining of input files so that a single message can include multiple input files.", + "default": None, + }, + ), + }, + } + + DESCRIPTION = "Loads and prepares input files (text, pdf, etc.) to include as inputs for the OpenAI Chat Node. The files will be read by the OpenAI model when generating a response. 🛈 TIP: Can be chained together with other OpenAI Input File nodes." + RETURN_TYPES = ("OPENAI_INPUT_FILES",) + FUNCTION = "prepare_files" + CATEGORY = "api node/text/OpenAI" + + def create_input_file_content(self, file_path: str) -> InputFileContent: + return InputFileContent( + file_data=text_filepath_to_data_uri(file_path), + filename=os.path.basename(file_path), + type="input_file", + ) + + def prepare_files( + self, file: str, OPENAI_INPUT_FILES: list[InputFileContent] = [] + ) -> tuple[list[InputFileContent]]: + """ + Loads and formats input files for OpenAI API. + """ + file_path = folder_paths.get_annotated_filepath(file) + input_file_content = self.create_input_file_content(file_path) + files = [input_file_content] + OPENAI_INPUT_FILES + return (files,) + + +class OpenAIChatConfig(ComfyNodeABC): + """Allows setting additional configuration for the OpenAI Chat Node.""" + + RETURN_TYPES = ("OPENAI_CHAT_CONFIG",) + FUNCTION = "configure" + DESCRIPTION = ( + "Allows specifying advanced configuration options for the OpenAI Chat Nodes." + ) + CATEGORY = "api node/text/OpenAI" + + @classmethod + def INPUT_TYPES(cls) -> InputTypeDict: + return { + "required": { + "truncation": ( + IO.COMBO, + { + "options": ["auto", "disabled"], + "default": "auto", + "tooltip": "The truncation strategy to use for the model response. auto: If the context of this response and previous ones exceeds the model's context window size, the model will truncate the response to fit the context window by dropping input items in the middle of the conversation.disabled: If a model response will exceed the context window size for a model, the request will fail with a 400 error", + }, + ), + }, + "optional": { + "max_output_tokens": model_field_to_node_input( + IO.INT, + OpenAICreateResponse, + "max_output_tokens", + min=16, + default=4096, + max=16384, + tooltip="An upper bound for the number of tokens that can be generated for a response, including visible output tokens", + ), + "instructions": model_field_to_node_input( + IO.STRING, OpenAICreateResponse, "instructions", multiline=True + ), + }, + } + + def configure( + self, + truncation: bool, + instructions: Optional[str] = None, + max_output_tokens: Optional[int] = None, + ) -> tuple[CreateModelResponseProperties]: + """ + Configure advanced options for the OpenAI Chat Node. + + Note: + While `top_p` and `temperature` are listed as properties in the + spec, they are not supported for all models (e.g., o4-mini). + They are not exposed as inputs at all to avoid having to manually + remove depending on model choice. + """ + return ( + CreateModelResponseProperties( + instructions=instructions, + truncation=truncation, + max_output_tokens=max_output_tokens, + ), + ) + + NODE_CLASS_MAPPINGS = { "OpenAIDalle2": OpenAIDalle2, "OpenAIDalle3": OpenAIDalle3, "OpenAIGPTImage1": OpenAIGPTImage1, + "OpenAIChatNode": OpenAIChatNode, + "OpenAIInputFiles": OpenAIInputFiles, + "OpenAIChatConfig": OpenAIChatConfig, } -# A dictionary that contains the friendly/humanly readable titles for the nodes NODE_DISPLAY_NAME_MAPPINGS = { "OpenAIDalle2": "OpenAI DALL·E 2", "OpenAIDalle3": "OpenAI DALL·E 3", "OpenAIGPTImage1": "OpenAI GPT Image 1", + "OpenAIChatNode": "OpenAI Chat", + "OpenAIInputFiles": "OpenAI Chat Input Files", + "OpenAIChatConfig": "OpenAI Chat Advanced Options", } diff --git a/comfy_api_nodes/nodes_rodin.py b/comfy_api_nodes/nodes_rodin.py new file mode 100644 index 000000000..67f90478c --- /dev/null +++ b/comfy_api_nodes/nodes_rodin.py @@ -0,0 +1,462 @@ +""" +ComfyUI X Rodin3D(Deemos) API Nodes + +Rodin API docs: https://developer.hyper3d.ai/ + +""" + +from __future__ import annotations +from inspect import cleandoc +from comfy.comfy_types.node_typing import IO +import folder_paths as comfy_paths +import requests +import os +import datetime +import shutil +import time +import io +import logging +import math +from PIL import Image +from comfy_api_nodes.apis.rodin_api import ( + Rodin3DGenerateRequest, + Rodin3DGenerateResponse, + Rodin3DCheckStatusRequest, + Rodin3DCheckStatusResponse, + Rodin3DDownloadRequest, + Rodin3DDownloadResponse, + JobStatus, +) +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, + PollingOperation, +) + + +COMMON_PARAMETERS = { + "Seed": ( + IO.INT, + { + "default":0, + "min":0, + "max":65535, + "display":"number" + } + ), + "Material_Type": ( + IO.COMBO, + { + "options": ["PBR", "Shaded"], + "default": "PBR" + } + ), + "Polygon_count": ( + IO.COMBO, + { + "options": ["4K-Quad", "8K-Quad", "18K-Quad", "50K-Quad", "200K-Triangle"], + "default": "18K-Quad" + } + ) +} + +def create_task_error(response: Rodin3DGenerateResponse): + """Check if the response has error""" + return hasattr(response, "error") + + + +class Rodin3DAPI: + """ + Generate 3D Assets using Rodin API + """ + RETURN_TYPES = (IO.STRING,) + RETURN_NAMES = ("3D Model Path",) + CATEGORY = "api node/3d/Rodin" + DESCRIPTION = cleandoc(__doc__ or "") + FUNCTION = "api_call" + API_NODE = True + + def tensor_to_filelike(self, tensor, max_pixels: int = 2048*2048): + """ + Converts a PyTorch tensor to a file-like object. + + Args: + - tensor (torch.Tensor): A tensor representing an image of shape (H, W, C) + where C is the number of channels (3 for RGB), H is height, and W is width. + + Returns: + - io.BytesIO: A file-like object containing the image data. + """ + array = tensor.cpu().numpy() + array = (array * 255).astype('uint8') + image = Image.fromarray(array, 'RGB') + + original_width, original_height = image.size + original_pixels = original_width * original_height + if original_pixels > max_pixels: + scale = math.sqrt(max_pixels / original_pixels) + new_width = int(original_width * scale) + new_height = int(original_height * scale) + else: + new_width, new_height = original_width, original_height + + if new_width != original_width or new_height != original_height: + image = image.resize((new_width, new_height), Image.Resampling.LANCZOS) + + img_byte_arr = io.BytesIO() + image.save(img_byte_arr, format='PNG') # PNG is used for lossless compression + img_byte_arr.seek(0) + return img_byte_arr + + def check_rodin_status(self, response: Rodin3DCheckStatusResponse) -> str: + has_failed = any(job.status == JobStatus.Failed for job in response.jobs) + all_done = all(job.status == JobStatus.Done for job in response.jobs) + status_list = [str(job.status) for job in response.jobs] + logging.info(f"[ Rodin3D API - CheckStatus ] Generate Status: {status_list}") + if has_failed: + logging.error(f"[ Rodin3D API - CheckStatus ] Generate Failed: {status_list}, Please try again.") + raise Exception("[ Rodin3D API ] Generate Failed, Please Try again.") + elif all_done: + return "DONE" + else: + return "Generating" + + def CreateGenerateTask(self, images=None, seed=1, material="PBR", quality="medium", tier="Regular", mesh_mode="Quad", **kwargs): + if images == None: + raise Exception("Rodin 3D generate requires at least 1 image.") + if len(images) >= 5: + raise Exception("Rodin 3D generate requires up to 5 image.") + + path = "/proxy/rodin/api/v2/rodin" + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=path, + method=HttpMethod.POST, + request_model=Rodin3DGenerateRequest, + response_model=Rodin3DGenerateResponse, + ), + request=Rodin3DGenerateRequest( + seed=seed, + tier=tier, + material=material, + quality=quality, + mesh_mode=mesh_mode + ), + files=[ + ( + "images", + open(image, "rb") if isinstance(image, str) else self.tensor_to_filelike(image) + ) + for image in images if image is not None + ], + content_type = "multipart/form-data", + auth_kwargs=kwargs, + ) + + response = operation.execute() + + if create_task_error(response): + error_message = f"Rodin3D Create 3D generate Task Failed. Message: {response.message}, error: {response.error}" + logging.error(error_message) + raise Exception(error_message) + + logging.info("[ Rodin3D API - Submit Jobs ] Submit Generate Task Success!") + subscription_key = response.jobs.subscription_key + task_uuid = response.uuid + logging.info(f"[ Rodin3D API - Submit Jobs ] UUID: {task_uuid}") + return task_uuid, subscription_key + + def poll_for_task_status(self, subscription_key, **kwargs) -> Rodin3DCheckStatusResponse: + + path = "/proxy/rodin/api/v2/status" + + poll_operation = PollingOperation( + poll_endpoint=ApiEndpoint( + path = path, + method=HttpMethod.POST, + request_model=Rodin3DCheckStatusRequest, + response_model=Rodin3DCheckStatusResponse, + ), + request=Rodin3DCheckStatusRequest( + subscription_key = subscription_key + ), + completed_statuses=["DONE"], + failed_statuses=["FAILED"], + status_extractor=self.check_rodin_status, + poll_interval=3.0, + auth_kwargs=kwargs, + ) + + logging.info("[ Rodin3D API - CheckStatus ] Generate Start!") + + return poll_operation.execute() + + + + def GetRodinDownloadList(self, uuid, **kwargs) -> Rodin3DDownloadResponse: + logging.info("[ Rodin3D API - Downloading ] Generate Successfully!") + + path = "/proxy/rodin/api/v2/download" + operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=path, + method=HttpMethod.POST, + request_model=Rodin3DDownloadRequest, + response_model=Rodin3DDownloadResponse, + ), + request=Rodin3DDownloadRequest( + task_uuid=uuid + ), + auth_kwargs=kwargs + ) + + return operation.execute() + + def GetQualityAndMode(self, PolyCount): + if PolyCount == "200K-Triangle": + mesh_mode = "Raw" + quality = "medium" + else: + mesh_mode = "Quad" + if PolyCount == "4K-Quad": + quality = "extra-low" + elif PolyCount == "8K-Quad": + quality = "low" + elif PolyCount == "18K-Quad": + quality = "medium" + elif PolyCount == "50K-Quad": + quality = "high" + else: + quality = "medium" + + return mesh_mode, quality + + def DownLoadFiles(self, Url_List): + Save_path = os.path.join(comfy_paths.get_output_directory(), "Rodin3D", datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")) + os.makedirs(Save_path, exist_ok=True) + model_file_path = None + for Item in Url_List.list: + url = Item.url + file_name = Item.name + file_path = os.path.join(Save_path, file_name) + if file_path.endswith(".glb"): + model_file_path = file_path + logging.info(f"[ Rodin3D API - download_files ] Downloading file: {file_path}") + max_retries = 5 + for attempt in range(max_retries): + try: + with requests.get(url, stream=True) as r: + r.raise_for_status() + with open(file_path, "wb") as f: + shutil.copyfileobj(r.raw, f) + break + except Exception as e: + logging.info(f"[ Rodin3D API - download_files ] Error downloading {file_path}:{e}") + if attempt < max_retries - 1: + logging.info("Retrying...") + time.sleep(2) + else: + logging.info(f"[ Rodin3D API - download_files ] Failed to download {file_path} after {max_retries} attempts.") + + return model_file_path + + +class Rodin3D_Regular(Rodin3DAPI): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "Images": + ( + IO.IMAGE, + { + "forceInput":True, + } + ) + }, + "optional": { + **COMMON_PARAMETERS + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, + } + + def api_call( + self, + Images, + Seed, + Material_Type, + Polygon_count, + **kwargs + ): + tier = "Regular" + num_images = Images.shape[0] + m_images = [] + for i in range(num_images): + m_images.append(Images[i]) + mesh_mode, quality = self.GetQualityAndMode(Polygon_count) + task_uuid, subscription_key = self.CreateGenerateTask(images=m_images, seed=Seed, material=Material_Type, quality=quality, tier=tier, mesh_mode=mesh_mode, **kwargs) + self.poll_for_task_status(subscription_key, **kwargs) + Download_List = self.GetRodinDownloadList(task_uuid, **kwargs) + model = self.DownLoadFiles(Download_List) + + return (model,) + +class Rodin3D_Detail(Rodin3DAPI): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "Images": + ( + IO.IMAGE, + { + "forceInput":True, + } + ) + }, + "optional": { + **COMMON_PARAMETERS + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, + } + + def api_call( + self, + Images, + Seed, + Material_Type, + Polygon_count, + **kwargs + ): + tier = "Detail" + num_images = Images.shape[0] + m_images = [] + for i in range(num_images): + m_images.append(Images[i]) + mesh_mode, quality = self.GetQualityAndMode(Polygon_count) + task_uuid, subscription_key = self.CreateGenerateTask(images=m_images, seed=Seed, material=Material_Type, quality=quality, tier=tier, mesh_mode=mesh_mode, **kwargs) + self.poll_for_task_status(subscription_key, **kwargs) + Download_List = self.GetRodinDownloadList(task_uuid, **kwargs) + model = self.DownLoadFiles(Download_List) + + return (model,) + +class Rodin3D_Smooth(Rodin3DAPI): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "Images": + ( + IO.IMAGE, + { + "forceInput":True, + } + ) + }, + "optional": { + **COMMON_PARAMETERS + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, + } + + def api_call( + self, + Images, + Seed, + Material_Type, + Polygon_count, + **kwargs + ): + tier = "Smooth" + num_images = Images.shape[0] + m_images = [] + for i in range(num_images): + m_images.append(Images[i]) + mesh_mode, quality = self.GetQualityAndMode(Polygon_count) + task_uuid, subscription_key = self.CreateGenerateTask(images=m_images, seed=Seed, material=Material_Type, quality=quality, tier=tier, mesh_mode=mesh_mode, **kwargs) + self.poll_for_task_status(subscription_key, **kwargs) + Download_List = self.GetRodinDownloadList(task_uuid, **kwargs) + model = self.DownLoadFiles(Download_List) + + return (model,) + +class Rodin3D_Sketch(Rodin3DAPI): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "Images": + ( + IO.IMAGE, + { + "forceInput":True, + } + ) + }, + "optional": { + "Seed": + ( + IO.INT, + { + "default":0, + "min":0, + "max":65535, + "display":"number" + } + ) + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, + } + + def api_call( + self, + Images, + Seed, + **kwargs + ): + tier = "Sketch" + num_images = Images.shape[0] + m_images = [] + for i in range(num_images): + m_images.append(Images[i]) + material_type = "PBR" + quality = "medium" + mesh_mode = "Quad" + task_uuid, subscription_key = self.CreateGenerateTask(images=m_images, seed=Seed, material=material_type, quality=quality, tier=tier, mesh_mode=mesh_mode, **kwargs) + self.poll_for_task_status(subscription_key, **kwargs) + Download_List = self.GetRodinDownloadList(task_uuid, **kwargs) + model = self.DownLoadFiles(Download_List) + + return (model,) + +# A dictionary that contains all nodes you want to export with their names +# NOTE: names should be globally unique +NODE_CLASS_MAPPINGS = { + "Rodin3D_Regular": Rodin3D_Regular, + "Rodin3D_Detail": Rodin3D_Detail, + "Rodin3D_Smooth": Rodin3D_Smooth, + "Rodin3D_Sketch": Rodin3D_Sketch, +} + +# A dictionary that contains the friendly/humanly readable titles for the nodes +NODE_DISPLAY_NAME_MAPPINGS = { + "Rodin3D_Regular": "Rodin 3D Generate - Regular Generate", + "Rodin3D_Detail": "Rodin 3D Generate - Detail Generate", + "Rodin3D_Smooth": "Rodin 3D Generate - Smooth Generate", + "Rodin3D_Sketch": "Rodin 3D Generate - Sketch Generate", +} diff --git a/comfy_api_nodes/nodes_runway.py b/comfy_api_nodes/nodes_runway.py new file mode 100644 index 000000000..af4b321f9 --- /dev/null +++ b/comfy_api_nodes/nodes_runway.py @@ -0,0 +1,635 @@ +"""Runway API Nodes + +API Docs: + - https://docs.dev.runwayml.com/api/#tag/Task-management/paths/~1v1~1tasks~1%7Bid%7D/delete + +User Guides: + - https://help.runwayml.com/hc/en-us/sections/30265301423635-Gen-3-Alpha + - https://help.runwayml.com/hc/en-us/articles/37327109429011-Creating-with-Gen-4-Video + - https://help.runwayml.com/hc/en-us/articles/33927968552339-Creating-with-Act-One-on-Gen-3-Alpha-and-Turbo + - https://help.runwayml.com/hc/en-us/articles/34170748696595-Creating-with-Keyframes-on-Gen-3 + +""" + +from typing import Union, Optional, Any +from enum import Enum + +import torch + +from comfy_api_nodes.apis import ( + RunwayImageToVideoRequest, + RunwayImageToVideoResponse, + RunwayTaskStatusResponse as TaskStatusResponse, + RunwayTaskStatusEnum as TaskStatus, + RunwayModelEnum as Model, + RunwayDurationEnum as Duration, + RunwayAspectRatioEnum as AspectRatio, + RunwayPromptImageObject, + RunwayPromptImageDetailedObject, + RunwayTextToImageRequest, + RunwayTextToImageResponse, + Model4, + ReferenceImage, + RunwayTextToImageAspectRatioEnum, +) +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, + PollingOperation, + EmptyRequest, +) +from comfy_api_nodes.apinode_utils import ( + upload_images_to_comfyapi, + download_url_to_video_output, + image_tensor_pair_to_batch, + validate_string, + download_url_to_image_tensor, +) +from comfy_api_nodes.mapper_utils import model_field_to_node_input +from comfy_api.input_impl import VideoFromFile +from comfy.comfy_types.node_typing import IO, ComfyNodeABC + +PATH_IMAGE_TO_VIDEO = "/proxy/runway/image_to_video" +PATH_TEXT_TO_IMAGE = "/proxy/runway/text_to_image" +PATH_GET_TASK_STATUS = "/proxy/runway/tasks" + +AVERAGE_DURATION_I2V_SECONDS = 64 +AVERAGE_DURATION_FLF_SECONDS = 256 +AVERAGE_DURATION_T2I_SECONDS = 41 + + +class RunwayApiError(Exception): + """Base exception for Runway API errors.""" + + pass + + +class RunwayGen4TurboAspectRatio(str, Enum): + """Aspect ratios supported for Image to Video API when using gen4_turbo model.""" + + field_1280_720 = "1280:720" + field_720_1280 = "720:1280" + field_1104_832 = "1104:832" + field_832_1104 = "832:1104" + field_960_960 = "960:960" + field_1584_672 = "1584:672" + + +class RunwayGen3aAspectRatio(str, Enum): + """Aspect ratios supported for Image to Video API when using gen3a_turbo model.""" + + field_768_1280 = "768:1280" + field_1280_768 = "1280:768" + + +def get_video_url_from_task_status(response: TaskStatusResponse) -> Union[str, None]: + """Returns the video URL from the task status response if it exists.""" + if response.output and len(response.output) > 0: + return response.output[0] + return None + + +# TODO: replace with updated image validation utils (upstream) +def validate_input_image(image: torch.Tensor) -> bool: + """ + Validate the input image is within the size limits for the Runway API. + See: https://docs.dev.runwayml.com/assets/inputs/#common-error-reasons + """ + return image.shape[2] < 8000 and image.shape[1] < 8000 + + +def poll_until_finished( + auth_kwargs: dict[str, str], + api_endpoint: ApiEndpoint[Any, TaskStatusResponse], + estimated_duration: Optional[int] = None, + node_id: Optional[str] = None, +) -> TaskStatusResponse: + """Polls the Runway API endpoint until the task reaches a terminal state, then returns the response.""" + return PollingOperation( + poll_endpoint=api_endpoint, + completed_statuses=[ + TaskStatus.SUCCEEDED.value, + ], + failed_statuses=[ + TaskStatus.FAILED.value, + TaskStatus.CANCELLED.value, + ], + status_extractor=lambda response: (response.status.value), + auth_kwargs=auth_kwargs, + result_url_extractor=get_video_url_from_task_status, + estimated_duration=estimated_duration, + node_id=node_id, + progress_extractor=extract_progress_from_task_status, + ).execute() + + +def extract_progress_from_task_status( + response: TaskStatusResponse, +) -> Union[float, None]: + if hasattr(response, "progress") and response.progress is not None: + return response.progress * 100 + return None + + +def get_image_url_from_task_status(response: TaskStatusResponse) -> Union[str, None]: + """Returns the image URL from the task status response if it exists.""" + if response.output and len(response.output) > 0: + return response.output[0] + return None + + +class RunwayVideoGenNode(ComfyNodeABC): + """Runway Video Node Base.""" + + RETURN_TYPES = ("VIDEO",) + FUNCTION = "api_call" + CATEGORY = "api node/video/Runway" + API_NODE = True + + def validate_task_created(self, response: RunwayImageToVideoResponse) -> bool: + """ + Validate the task creation response from the Runway API matches + expected format. + """ + if not bool(response.id): + raise RunwayApiError("Invalid initial response from Runway API.") + return True + + def validate_response(self, response: RunwayImageToVideoResponse) -> bool: + """ + Validate the successful task status response from the Runway API + matches expected format. + """ + if not response.output or len(response.output) == 0: + raise RunwayApiError( + "Runway task succeeded but no video data found in response." + ) + return True + + def get_response( + self, task_id: str, auth_kwargs: dict[str, str], node_id: Optional[str] = None + ) -> RunwayImageToVideoResponse: + """Poll the task status until it is finished then get the response.""" + return poll_until_finished( + auth_kwargs, + ApiEndpoint( + path=f"{PATH_GET_TASK_STATUS}/{task_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=TaskStatusResponse, + ), + estimated_duration=AVERAGE_DURATION_FLF_SECONDS, + node_id=node_id, + ) + + def generate_video( + self, + request: RunwayImageToVideoRequest, + auth_kwargs: dict[str, str], + node_id: Optional[str] = None, + ) -> tuple[VideoFromFile]: + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_IMAGE_TO_VIDEO, + method=HttpMethod.POST, + request_model=RunwayImageToVideoRequest, + response_model=RunwayImageToVideoResponse, + ), + request=request, + auth_kwargs=auth_kwargs, + ) + + initial_response = initial_operation.execute() + self.validate_task_created(initial_response) + task_id = initial_response.id + + final_response = self.get_response(task_id, auth_kwargs, node_id) + self.validate_response(final_response) + + video_url = get_video_url_from_task_status(final_response) + return (download_url_to_video_output(video_url),) + + +class RunwayImageToVideoNodeGen3a(RunwayVideoGenNode): + """Runway Image to Video Node using Gen3a Turbo model.""" + + DESCRIPTION = "Generate a video from a single starting frame using Gen3a Turbo model. Before diving in, review these best practices to ensure that your input selections will set your generation up for success: https://help.runwayml.com/hc/en-us/articles/33927968552339-Creating-with-Act-One-on-Gen-3-Alpha-and-Turbo." + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": model_field_to_node_input( + IO.STRING, RunwayImageToVideoRequest, "promptText", multiline=True + ), + "start_frame": ( + IO.IMAGE, + {"tooltip": "Start frame to be used for the video"}, + ), + "duration": model_field_to_node_input( + IO.COMBO, RunwayImageToVideoRequest, "duration", enum_type=Duration + ), + "ratio": model_field_to_node_input( + IO.COMBO, + RunwayImageToVideoRequest, + "ratio", + enum_type=RunwayGen3aAspectRatio, + ), + "seed": model_field_to_node_input( + IO.INT, + RunwayImageToVideoRequest, + "seed", + control_after_generate=True, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", + }, + } + + def api_call( + self, + prompt: str, + start_frame: torch.Tensor, + duration: str, + ratio: str, + seed: int, + unique_id: Optional[str] = None, + **kwargs, + ) -> tuple[VideoFromFile]: + # Validate inputs + validate_string(prompt, min_length=1) + validate_input_image(start_frame) + + # Upload image + download_urls = upload_images_to_comfyapi( + start_frame, + max_images=1, + mime_type="image/png", + auth_kwargs=kwargs, + ) + if len(download_urls) != 1: + raise RunwayApiError("Failed to upload one or more images to comfy api.") + + return self.generate_video( + RunwayImageToVideoRequest( + promptText=prompt, + seed=seed, + model=Model("gen3a_turbo"), + duration=Duration(duration), + ratio=AspectRatio(ratio), + promptImage=RunwayPromptImageObject( + root=[ + RunwayPromptImageDetailedObject( + uri=str(download_urls[0]), position="first" + ) + ] + ), + ), + auth_kwargs=kwargs, + node_id=unique_id, + ) + + +class RunwayImageToVideoNodeGen4(RunwayVideoGenNode): + """Runway Image to Video Node using Gen4 Turbo model.""" + + DESCRIPTION = "Generate a video from a single starting frame using Gen4 Turbo model. Before diving in, review these best practices to ensure that your input selections will set your generation up for success: https://help.runwayml.com/hc/en-us/articles/37327109429011-Creating-with-Gen-4-Video." + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": model_field_to_node_input( + IO.STRING, RunwayImageToVideoRequest, "promptText", multiline=True + ), + "start_frame": ( + IO.IMAGE, + {"tooltip": "Start frame to be used for the video"}, + ), + "duration": model_field_to_node_input( + IO.COMBO, RunwayImageToVideoRequest, "duration", enum_type=Duration + ), + "ratio": model_field_to_node_input( + IO.COMBO, + RunwayImageToVideoRequest, + "ratio", + enum_type=RunwayGen4TurboAspectRatio, + ), + "seed": model_field_to_node_input( + IO.INT, + RunwayImageToVideoRequest, + "seed", + control_after_generate=True, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", + }, + } + + def api_call( + self, + prompt: str, + start_frame: torch.Tensor, + duration: str, + ratio: str, + seed: int, + unique_id: Optional[str] = None, + **kwargs, + ) -> tuple[VideoFromFile]: + # Validate inputs + validate_string(prompt, min_length=1) + validate_input_image(start_frame) + + # Upload image + download_urls = upload_images_to_comfyapi( + start_frame, + max_images=1, + mime_type="image/png", + auth_kwargs=kwargs, + ) + if len(download_urls) != 1: + raise RunwayApiError("Failed to upload one or more images to comfy api.") + + return self.generate_video( + RunwayImageToVideoRequest( + promptText=prompt, + seed=seed, + model=Model("gen4_turbo"), + duration=Duration(duration), + ratio=AspectRatio(ratio), + promptImage=RunwayPromptImageObject( + root=[ + RunwayPromptImageDetailedObject( + uri=str(download_urls[0]), position="first" + ) + ] + ), + ), + auth_kwargs=kwargs, + node_id=unique_id, + ) + + +class RunwayFirstLastFrameNode(RunwayVideoGenNode): + """Runway First-Last Frame Node.""" + + DESCRIPTION = "Upload first and last keyframes, draft a prompt, and generate a video. More complex transitions, such as cases where the Last frame is completely different from the First frame, may benefit from the longer 10s duration. This would give the generation more time to smoothly transition between the two inputs. Before diving in, review these best practices to ensure that your input selections will set your generation up for success: https://help.runwayml.com/hc/en-us/articles/34170748696595-Creating-with-Keyframes-on-Gen-3." + + def get_response( + self, task_id: str, auth_kwargs: dict[str, str], node_id: Optional[str] = None + ) -> RunwayImageToVideoResponse: + return poll_until_finished( + auth_kwargs, + ApiEndpoint( + path=f"{PATH_GET_TASK_STATUS}/{task_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=TaskStatusResponse, + ), + estimated_duration=AVERAGE_DURATION_FLF_SECONDS, + node_id=node_id, + ) + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": model_field_to_node_input( + IO.STRING, RunwayImageToVideoRequest, "promptText", multiline=True + ), + "start_frame": ( + IO.IMAGE, + {"tooltip": "Start frame to be used for the video"}, + ), + "end_frame": ( + IO.IMAGE, + { + "tooltip": "End frame to be used for the video. Supported for gen3a_turbo only." + }, + ), + "duration": model_field_to_node_input( + IO.COMBO, RunwayImageToVideoRequest, "duration", enum_type=Duration + ), + "ratio": model_field_to_node_input( + IO.COMBO, + RunwayImageToVideoRequest, + "ratio", + enum_type=RunwayGen3aAspectRatio, + ), + "seed": model_field_to_node_input( + IO.INT, + RunwayImageToVideoRequest, + "seed", + control_after_generate=True, + ), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "unique_id": "UNIQUE_ID", + "comfy_api_key": "API_KEY_COMFY_ORG", + }, + } + + def api_call( + self, + prompt: str, + start_frame: torch.Tensor, + end_frame: torch.Tensor, + duration: str, + ratio: str, + seed: int, + unique_id: Optional[str] = None, + **kwargs, + ) -> tuple[VideoFromFile]: + # Validate inputs + validate_string(prompt, min_length=1) + validate_input_image(start_frame) + validate_input_image(end_frame) + + # Upload images + stacked_input_images = image_tensor_pair_to_batch(start_frame, end_frame) + download_urls = upload_images_to_comfyapi( + stacked_input_images, + max_images=2, + mime_type="image/png", + auth_kwargs=kwargs, + ) + if len(download_urls) != 2: + raise RunwayApiError("Failed to upload one or more images to comfy api.") + + return self.generate_video( + RunwayImageToVideoRequest( + promptText=prompt, + seed=seed, + model=Model("gen3a_turbo"), + duration=Duration(duration), + ratio=AspectRatio(ratio), + promptImage=RunwayPromptImageObject( + root=[ + RunwayPromptImageDetailedObject( + uri=str(download_urls[0]), position="first" + ), + RunwayPromptImageDetailedObject( + uri=str(download_urls[1]), position="last" + ), + ] + ), + ), + auth_kwargs=kwargs, + node_id=unique_id, + ) + + +class RunwayTextToImageNode(ComfyNodeABC): + """Runway Text to Image Node.""" + + RETURN_TYPES = ("IMAGE",) + FUNCTION = "api_call" + CATEGORY = "api node/image/Runway" + API_NODE = True + DESCRIPTION = "Generate an image from a text prompt using Runway's Gen 4 model. You can also include reference images to guide the generation." + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": model_field_to_node_input( + IO.STRING, RunwayTextToImageRequest, "promptText", multiline=True + ), + "ratio": model_field_to_node_input( + IO.COMBO, + RunwayTextToImageRequest, + "ratio", + enum_type=RunwayTextToImageAspectRatioEnum, + ), + }, + "optional": { + "reference_image": ( + IO.IMAGE, + {"tooltip": "Optional reference image to guide the generation"}, + ) + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", + }, + } + + def validate_task_created(self, response: RunwayTextToImageResponse) -> bool: + """ + Validate the task creation response from the Runway API matches + expected format. + """ + if not bool(response.id): + raise RunwayApiError("Invalid initial response from Runway API.") + return True + + def validate_response(self, response: TaskStatusResponse) -> bool: + """ + Validate the successful task status response from the Runway API + matches expected format. + """ + if not response.output or len(response.output) == 0: + raise RunwayApiError( + "Runway task succeeded but no image data found in response." + ) + return True + + def get_response( + self, task_id: str, auth_kwargs: dict[str, str], node_id: Optional[str] = None + ) -> TaskStatusResponse: + """Poll the task status until it is finished then get the response.""" + return poll_until_finished( + auth_kwargs, + ApiEndpoint( + path=f"{PATH_GET_TASK_STATUS}/{task_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=TaskStatusResponse, + ), + estimated_duration=AVERAGE_DURATION_T2I_SECONDS, + node_id=node_id, + ) + + def api_call( + self, + prompt: str, + ratio: str, + reference_image: Optional[torch.Tensor] = None, + unique_id: Optional[str] = None, + **kwargs, + ) -> tuple[torch.Tensor]: + # Validate inputs + validate_string(prompt, min_length=1) + + # Prepare reference images if provided + reference_images = None + if reference_image is not None: + validate_input_image(reference_image) + download_urls = upload_images_to_comfyapi( + reference_image, + max_images=1, + mime_type="image/png", + auth_kwargs=kwargs, + ) + if len(download_urls) != 1: + raise RunwayApiError("Failed to upload reference image to comfy api.") + + reference_images = [ReferenceImage(uri=str(download_urls[0]))] + + # Create request + request = RunwayTextToImageRequest( + promptText=prompt, + model=Model4.gen4_image, + ratio=ratio, + referenceImages=reference_images, + ) + + # Execute initial request + initial_operation = SynchronousOperation( + endpoint=ApiEndpoint( + path=PATH_TEXT_TO_IMAGE, + method=HttpMethod.POST, + request_model=RunwayTextToImageRequest, + response_model=RunwayTextToImageResponse, + ), + request=request, + auth_kwargs=kwargs, + ) + + initial_response = initial_operation.execute() + self.validate_task_created(initial_response) + task_id = initial_response.id + + # Poll for completion + final_response = self.get_response( + task_id, auth_kwargs=kwargs, node_id=unique_id + ) + self.validate_response(final_response) + + # Download and return image + image_url = get_image_url_from_task_status(final_response) + return (download_url_to_image_tensor(image_url),) + + +NODE_CLASS_MAPPINGS = { + "RunwayFirstLastFrameNode": RunwayFirstLastFrameNode, + "RunwayImageToVideoNodeGen3a": RunwayImageToVideoNodeGen3a, + "RunwayImageToVideoNodeGen4": RunwayImageToVideoNodeGen4, + "RunwayTextToImageNode": RunwayTextToImageNode, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "RunwayFirstLastFrameNode": "Runway First-Last-Frame to Video", + "RunwayImageToVideoNodeGen3a": "Runway Image to Video (Gen3a Turbo)", + "RunwayImageToVideoNodeGen4": "Runway Image to Video (Gen4 Turbo)", + "RunwayTextToImageNode": "Runway Text to Image", +} diff --git a/comfy_api_nodes/nodes_tripo.py b/comfy_api_nodes/nodes_tripo.py new file mode 100644 index 000000000..65f3b21f5 --- /dev/null +++ b/comfy_api_nodes/nodes_tripo.py @@ -0,0 +1,574 @@ +import os +from folder_paths import get_output_directory +from comfy_api_nodes.mapper_utils import model_field_to_node_input +from comfy.comfy_types.node_typing import IO +from comfy_api_nodes.apis import ( + TripoOrientation, + TripoModelVersion, +) +from comfy_api_nodes.apis.tripo_api import ( + TripoTaskType, + TripoStyle, + TripoFileReference, + TripoFileEmptyReference, + TripoUrlReference, + TripoTaskResponse, + TripoTaskStatus, + TripoTextToModelRequest, + TripoImageToModelRequest, + TripoMultiviewToModelRequest, + TripoTextureModelRequest, + TripoRefineModelRequest, + TripoAnimateRigRequest, + TripoAnimateRetargetRequest, + TripoConvertModelRequest, +) + +from comfy_api_nodes.apis.client import ( + ApiEndpoint, + HttpMethod, + SynchronousOperation, + PollingOperation, + EmptyRequest, +) +from comfy_api_nodes.apinode_utils import ( + upload_images_to_comfyapi, + download_url_to_bytesio, +) + + +def upload_image_to_tripo(image, **kwargs): + urls = upload_images_to_comfyapi(image, max_images=1, auth_kwargs=kwargs) + return TripoFileReference(TripoUrlReference(url=urls[0], type="jpeg")) + +def get_model_url_from_response(response: TripoTaskResponse) -> str: + if response.data is not None: + for key in ["pbr_model", "model", "base_model"]: + if getattr(response.data.output, key, None) is not None: + return getattr(response.data.output, key) + raise RuntimeError(f"Failed to get model url from response: {response}") + + +def poll_until_finished( + kwargs: dict[str, str], + response: TripoTaskResponse, +) -> tuple[str, str]: + """Polls the Tripo API endpoint until the task reaches a terminal state, then returns the response.""" + if response.code != 0: + raise RuntimeError(f"Failed to generate mesh: {response.error}") + task_id = response.data.task_id + response_poll = PollingOperation( + poll_endpoint=ApiEndpoint( + path=f"/proxy/tripo/v2/openapi/task/{task_id}", + method=HttpMethod.GET, + request_model=EmptyRequest, + response_model=TripoTaskResponse, + ), + completed_statuses=[TripoTaskStatus.SUCCESS], + failed_statuses=[ + TripoTaskStatus.FAILED, + TripoTaskStatus.CANCELLED, + TripoTaskStatus.UNKNOWN, + TripoTaskStatus.BANNED, + TripoTaskStatus.EXPIRED, + ], + status_extractor=lambda x: x.data.status, + auth_kwargs=kwargs, + node_id=kwargs["unique_id"], + result_url_extractor=get_model_url_from_response, + progress_extractor=lambda x: x.data.progress, + ).execute() + if response_poll.data.status == TripoTaskStatus.SUCCESS: + url = get_model_url_from_response(response_poll) + bytesio = download_url_to_bytesio(url) + # Save the downloaded model file + model_file = f"tripo_model_{task_id}.glb" + with open(os.path.join(get_output_directory(), model_file), "wb") as f: + f.write(bytesio.getvalue()) + return model_file, task_id + raise RuntimeError(f"Failed to generate mesh: {response_poll}") + +class TripoTextToModelNode: + """ + Generates 3D models synchronously based on a text prompt using Tripo's API. + """ + AVERAGE_DURATION = 80 + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "prompt": ("STRING", {"multiline": True}), + }, + "optional": { + "negative_prompt": ("STRING", {"multiline": True}), + "model_version": model_field_to_node_input(IO.COMBO, TripoTextToModelRequest, "model_version", enum_type=TripoModelVersion), + "style": model_field_to_node_input(IO.COMBO, TripoTextToModelRequest, "style", enum_type=TripoStyle, default="None"), + "texture": ("BOOLEAN", {"default": True}), + "pbr": ("BOOLEAN", {"default": True}), + "image_seed": ("INT", {"default": 42}), + "model_seed": ("INT", {"default": 42}), + "texture_seed": ("INT", {"default": 42}), + "texture_quality": (["standard", "detailed"], {"default": "standard"}), + "face_limit": ("INT", {"min": -1, "max": 500000, "default": -1}), + "quad": ("BOOLEAN", {"default": False}) + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", + }, + } + + RETURN_TYPES = ("STRING", "MODEL_TASK_ID",) + RETURN_NAMES = ("model_file", "model task_id") + FUNCTION = "generate_mesh" + CATEGORY = "api node/3d/Tripo" + API_NODE = True + OUTPUT_NODE = True + + def generate_mesh(self, prompt, negative_prompt=None, model_version=None, style=None, texture=None, pbr=None, image_seed=None, model_seed=None, texture_seed=None, texture_quality=None, face_limit=None, quad=None, **kwargs): + style_enum = None if style == "None" else style + if not prompt: + raise RuntimeError("Prompt is required") + response = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/tripo/v2/openapi/task", + method=HttpMethod.POST, + request_model=TripoTextToModelRequest, + response_model=TripoTaskResponse, + ), + request=TripoTextToModelRequest( + type=TripoTaskType.TEXT_TO_MODEL, + prompt=prompt, + negative_prompt=negative_prompt if negative_prompt else None, + model_version=model_version, + style=style_enum, + texture=texture, + pbr=pbr, + image_seed=image_seed, + model_seed=model_seed, + texture_seed=texture_seed, + texture_quality=texture_quality, + face_limit=face_limit, + auto_size=True, + quad=quad + ), + auth_kwargs=kwargs, + ).execute() + return poll_until_finished(kwargs, response) + +class TripoImageToModelNode: + """ + Generates 3D models synchronously based on a single image using Tripo's API. + """ + AVERAGE_DURATION = 80 + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": ("IMAGE",), + }, + "optional": { + "model_version": model_field_to_node_input(IO.COMBO, TripoImageToModelRequest, "model_version", enum_type=TripoModelVersion), + "style": model_field_to_node_input(IO.COMBO, TripoTextToModelRequest, "style", enum_type=TripoStyle, default="None"), + "texture": ("BOOLEAN", {"default": True}), + "pbr": ("BOOLEAN", {"default": True}), + "model_seed": ("INT", {"default": 42}), + "orientation": model_field_to_node_input(IO.COMBO, TripoImageToModelRequest, "orientation", enum_type=TripoOrientation), + "texture_seed": ("INT", {"default": 42}), + "texture_quality": (["standard", "detailed"], {"default": "standard"}), + "texture_alignment": (["original_image", "geometry"], {"default": "original_image"}), + "face_limit": ("INT", {"min": -1, "max": 500000, "default": -1}), + "quad": ("BOOLEAN", {"default": False}) + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", + }, + } + + RETURN_TYPES = ("STRING", "MODEL_TASK_ID",) + RETURN_NAMES = ("model_file", "model task_id") + FUNCTION = "generate_mesh" + CATEGORY = "api node/3d/Tripo" + API_NODE = True + OUTPUT_NODE = True + + def generate_mesh(self, image, model_version=None, style=None, texture=None, pbr=None, model_seed=None, orientation=None, texture_alignment=None, texture_seed=None, texture_quality=None, face_limit=None, quad=None, **kwargs): + style_enum = None if style == "None" else style + if image is None: + raise RuntimeError("Image is required") + tripo_file = upload_image_to_tripo(image, **kwargs) + response = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/tripo/v2/openapi/task", + method=HttpMethod.POST, + request_model=TripoImageToModelRequest, + response_model=TripoTaskResponse, + ), + request=TripoImageToModelRequest( + type=TripoTaskType.IMAGE_TO_MODEL, + file=tripo_file, + model_version=model_version, + style=style_enum, + texture=texture, + pbr=pbr, + model_seed=model_seed, + orientation=orientation, + texture_alignment=texture_alignment, + texture_seed=texture_seed, + texture_quality=texture_quality, + face_limit=face_limit, + auto_size=True, + quad=quad + ), + auth_kwargs=kwargs, + ).execute() + return poll_until_finished(kwargs, response) + +class TripoMultiviewToModelNode: + """ + Generates 3D models synchronously based on up to four images (front, left, back, right) using Tripo's API. + """ + AVERAGE_DURATION = 80 + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": ("IMAGE",), + }, + "optional": { + "image_left": ("IMAGE",), + "image_back": ("IMAGE",), + "image_right": ("IMAGE",), + "model_version": model_field_to_node_input(IO.COMBO, TripoMultiviewToModelRequest, "model_version", enum_type=TripoModelVersion), + "orientation": model_field_to_node_input(IO.COMBO, TripoImageToModelRequest, "orientation", enum_type=TripoOrientation), + "texture": ("BOOLEAN", {"default": True}), + "pbr": ("BOOLEAN", {"default": True}), + "model_seed": ("INT", {"default": 42}), + "texture_seed": ("INT", {"default": 42}), + "texture_quality": (["standard", "detailed"], {"default": "standard"}), + "texture_alignment": (["original_image", "geometry"], {"default": "original_image"}), + "face_limit": ("INT", {"min": -1, "max": 500000, "default": -1}), + "quad": ("BOOLEAN", {"default": False}) + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", + }, + } + + RETURN_TYPES = ("STRING", "MODEL_TASK_ID",) + RETURN_NAMES = ("model_file", "model task_id") + FUNCTION = "generate_mesh" + CATEGORY = "api node/3d/Tripo" + API_NODE = True + OUTPUT_NODE = True + + def generate_mesh(self, image, image_left=None, image_back=None, image_right=None, model_version=None, orientation=None, texture=None, pbr=None, model_seed=None, texture_seed=None, texture_quality=None, texture_alignment=None, face_limit=None, quad=None, **kwargs): + if image is None: + raise RuntimeError("front image for multiview is required") + images = [] + image_dict = { + "image": image, + "image_left": image_left, + "image_back": image_back, + "image_right": image_right + } + if image_left is None and image_back is None and image_right is None: + raise RuntimeError("At least one of left, back, or right image must be provided for multiview") + for image_name in ["image", "image_left", "image_back", "image_right"]: + image_ = image_dict[image_name] + if image_ is not None: + tripo_file = upload_image_to_tripo(image_, **kwargs) + images.append(tripo_file) + else: + images.append(TripoFileEmptyReference()) + response = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/tripo/v2/openapi/task", + method=HttpMethod.POST, + request_model=TripoMultiviewToModelRequest, + response_model=TripoTaskResponse, + ), + request=TripoMultiviewToModelRequest( + type=TripoTaskType.MULTIVIEW_TO_MODEL, + files=images, + model_version=model_version, + orientation=orientation, + texture=texture, + pbr=pbr, + model_seed=model_seed, + texture_seed=texture_seed, + texture_quality=texture_quality, + texture_alignment=texture_alignment, + face_limit=face_limit, + quad=quad, + ), + auth_kwargs=kwargs, + ).execute() + return poll_until_finished(kwargs, response) + +class TripoTextureNode: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "model_task_id": ("MODEL_TASK_ID",), + }, + "optional": { + "texture": ("BOOLEAN", {"default": True}), + "pbr": ("BOOLEAN", {"default": True}), + "texture_seed": ("INT", {"default": 42}), + "texture_quality": (["standard", "detailed"], {"default": "standard"}), + "texture_alignment": (["original_image", "geometry"], {"default": "original_image"}), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", + }, + } + + RETURN_TYPES = ("STRING", "MODEL_TASK_ID",) + RETURN_NAMES = ("model_file", "model task_id") + FUNCTION = "generate_mesh" + CATEGORY = "api node/3d/Tripo" + API_NODE = True + OUTPUT_NODE = True + AVERAGE_DURATION = 80 + + def generate_mesh(self, model_task_id, texture=None, pbr=None, texture_seed=None, texture_quality=None, texture_alignment=None, **kwargs): + response = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/tripo/v2/openapi/task", + method=HttpMethod.POST, + request_model=TripoTextureModelRequest, + response_model=TripoTaskResponse, + ), + request=TripoTextureModelRequest( + original_model_task_id=model_task_id, + texture=texture, + pbr=pbr, + texture_seed=texture_seed, + texture_quality=texture_quality, + texture_alignment=texture_alignment + ), + auth_kwargs=kwargs, + ).execute() + return poll_until_finished(kwargs, response) + + +class TripoRefineNode: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "model_task_id": ("MODEL_TASK_ID", { + "tooltip": "Must be a v1.4 Tripo model" + }), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", + }, + } + + DESCRIPTION = "Refine a draft model created by v1.4 Tripo models only." + + RETURN_TYPES = ("STRING", "MODEL_TASK_ID",) + RETURN_NAMES = ("model_file", "model task_id") + FUNCTION = "generate_mesh" + CATEGORY = "api node/3d/Tripo" + API_NODE = True + OUTPUT_NODE = True + AVERAGE_DURATION = 240 + + def generate_mesh(self, model_task_id, **kwargs): + response = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/tripo/v2/openapi/task", + method=HttpMethod.POST, + request_model=TripoRefineModelRequest, + response_model=TripoTaskResponse, + ), + request=TripoRefineModelRequest( + draft_model_task_id=model_task_id + ), + auth_kwargs=kwargs, + ).execute() + return poll_until_finished(kwargs, response) + + +class TripoRigNode: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "original_model_task_id": ("MODEL_TASK_ID",), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", + }, + } + + RETURN_TYPES = ("STRING", "RIG_TASK_ID") + RETURN_NAMES = ("model_file", "rig task_id") + FUNCTION = "generate_mesh" + CATEGORY = "api node/3d/Tripo" + API_NODE = True + OUTPUT_NODE = True + AVERAGE_DURATION = 180 + + def generate_mesh(self, original_model_task_id, **kwargs): + response = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/tripo/v2/openapi/task", + method=HttpMethod.POST, + request_model=TripoAnimateRigRequest, + response_model=TripoTaskResponse, + ), + request=TripoAnimateRigRequest( + original_model_task_id=original_model_task_id, + out_format="glb", + spec="tripo" + ), + auth_kwargs=kwargs, + ).execute() + return poll_until_finished(kwargs, response) + +class TripoRetargetNode: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "original_model_task_id": ("RIG_TASK_ID",), + "animation": ([ + "preset:idle", + "preset:walk", + "preset:climb", + "preset:jump", + "preset:slash", + "preset:shoot", + "preset:hurt", + "preset:fall", + "preset:turn", + ],), + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", + }, + } + + RETURN_TYPES = ("STRING", "RETARGET_TASK_ID") + RETURN_NAMES = ("model_file", "retarget task_id") + FUNCTION = "generate_mesh" + CATEGORY = "api node/3d/Tripo" + API_NODE = True + OUTPUT_NODE = True + AVERAGE_DURATION = 30 + + def generate_mesh(self, animation, original_model_task_id, **kwargs): + response = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/tripo/v2/openapi/task", + method=HttpMethod.POST, + request_model=TripoAnimateRetargetRequest, + response_model=TripoTaskResponse, + ), + request=TripoAnimateRetargetRequest( + original_model_task_id=original_model_task_id, + animation=animation, + out_format="glb", + bake_animation=True + ), + auth_kwargs=kwargs, + ).execute() + return poll_until_finished(kwargs, response) + +class TripoConversionNode: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "original_model_task_id": ("MODEL_TASK_ID,RIG_TASK_ID,RETARGET_TASK_ID",), + "format": (["GLTF", "USDZ", "FBX", "OBJ", "STL", "3MF"],), + }, + "optional": { + "quad": ("BOOLEAN", {"default": False}), + "face_limit": ("INT", {"min": -1, "max": 500000, "default": -1}), + "texture_size": ("INT", {"min": 128, "max": 4096, "default": 4096}), + "texture_format": (["BMP", "DPX", "HDR", "JPEG", "OPEN_EXR", "PNG", "TARGA", "TIFF", "WEBP"], {"default": "JPEG"}) + }, + "hidden": { + "auth_token": "AUTH_TOKEN_COMFY_ORG", + "comfy_api_key": "API_KEY_COMFY_ORG", + "unique_id": "UNIQUE_ID", + }, + } + + @classmethod + def VALIDATE_INPUTS(cls, input_types): + # The min and max of input1 and input2 are still validated because + # we didn't take `input1` or `input2` as arguments + if input_types["original_model_task_id"] not in ("MODEL_TASK_ID", "RIG_TASK_ID", "RETARGET_TASK_ID"): + return "original_model_task_id must be MODEL_TASK_ID, RIG_TASK_ID or RETARGET_TASK_ID type" + return True + + RETURN_TYPES = () + FUNCTION = "generate_mesh" + CATEGORY = "api node/3d/Tripo" + API_NODE = True + OUTPUT_NODE = True + AVERAGE_DURATION = 30 + + def generate_mesh(self, original_model_task_id, format, quad, face_limit, texture_size, texture_format, **kwargs): + if not original_model_task_id: + raise RuntimeError("original_model_task_id is required") + response = SynchronousOperation( + endpoint=ApiEndpoint( + path="/proxy/tripo/v2/openapi/task", + method=HttpMethod.POST, + request_model=TripoConvertModelRequest, + response_model=TripoTaskResponse, + ), + request=TripoConvertModelRequest( + original_model_task_id=original_model_task_id, + format=format, + quad=quad if quad else None, + face_limit=face_limit if face_limit != -1 else None, + texture_size=texture_size if texture_size != 4096 else None, + texture_format=texture_format if texture_format != "JPEG" else None + ), + auth_kwargs=kwargs, + ).execute() + return poll_until_finished(kwargs, response) + +NODE_CLASS_MAPPINGS = { + "TripoTextToModelNode": TripoTextToModelNode, + "TripoImageToModelNode": TripoImageToModelNode, + "TripoMultiviewToModelNode": TripoMultiviewToModelNode, + "TripoTextureNode": TripoTextureNode, + "TripoRefineNode": TripoRefineNode, + "TripoRigNode": TripoRigNode, + "TripoRetargetNode": TripoRetargetNode, + "TripoConversionNode": TripoConversionNode, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "TripoTextToModelNode": "Tripo: Text to Model", + "TripoImageToModelNode": "Tripo: Image to Model", + "TripoMultiviewToModelNode": "Tripo: Multiview to Model", + "TripoTextureNode": "Tripo: Texture model", + "TripoRefineNode": "Tripo: Refine Draft model", + "TripoRigNode": "Tripo: Rig model", + "TripoRetargetNode": "Tripo: Retarget rigged model", + "TripoConversionNode": "Tripo: Convert model", +} diff --git a/nodes.py b/nodes.py index 1e328651b..2d499051e 100644 --- a/nodes.py +++ b/nodes.py @@ -2281,6 +2281,10 @@ def init_builtin_api_nodes(): "nodes_pixverse.py", "nodes_stability.py", "nodes_pika.py", + "nodes_runway.py", + "nodes_tripo.py", + "nodes_rodin.py", + "nodes_gemini.py", ] if not load_custom_node(os.path.join(api_nodes_dir, "canary.py"), module_parent="comfy_api_nodes"): diff --git a/requirements.txt b/requirements.txt index f56b3e096..38991dbf9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ comfyui-frontend-package==1.20.6 -comfyui-workflow-templates==0.1.18 +comfyui-workflow-templates==0.1.20 torch torchsde torchvision From c9e1821a7b49bb58f18f114336bae911160ac69d Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 27 May 2025 07:07:44 -0400 Subject: [PATCH 478/478] ComfyUI version 0.3.37 --- comfyui_version.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfyui_version.py b/comfyui_version.py index 817b7d83b..c13b6501f 100644 --- a/comfyui_version.py +++ b/comfyui_version.py @@ -1,3 +1,3 @@ # This file is automatically generated by the build process when version is # updated in pyproject.toml. -__version__ = "0.3.36" +__version__ = "0.3.37" diff --git a/pyproject.toml b/pyproject.toml index accf6f864..c21b9b5c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ComfyUI" -version = "0.3.36" +version = "0.3.37" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9"